From: support Date: Tue, 28 Mar 2023 08:57:52 +0000 (+0000) Subject: Built motion from commit e8da49ee.|2.6.33 X-Git-Url: http://repos.xcallymotion.com/base/%22https:/wiki.xcallymotion.com/display/XMV//%22%7B%7Blicense.messaging?a=commitdiff_plain;h=f4f483393db3d1e38b48d42f90b200c44c4d7d0d;p=motion2.git Built motion from commit e8da49ee.|2.6.33 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index b9e4532..c956f69 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2023-03-28T08:22:22.752Z", + "time": "2023-03-28T08:48:44.376Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 041f9c9..4fe93b5 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2023-03-28T08:22:22.752Z", + "time": "2023-03-28T08:48:44.376Z", "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 bd1495d..f182ffa 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 _0xabdb=['jscripty','browser','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','exports','VIRTUAL','getDataValue','STRING','integration','motionbar'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xabdb,0x93));var _0xbabd=function(_0x5ded12,_0xed47a){_0x5ded12=_0x5ded12-0x0;var _0x1c01b0=_0xabdb[_0x5ded12];return _0x1c01b0;};'use strict';var Sequelize=require('sequelize');module[_0xbabd('0x0')]={'name':{'type':Sequelize[_0xbabd('0x1')],'get':function(_0xb14022){return this[_0xbabd('0x2')]('action');}},'action':{'type':Sequelize[_0xbabd('0x3')],'allowNull':![],'validate':{'isIn':{'args':[['contactManager',_0xbabd('0x4'),_0xbabd('0x5'),_0xbabd('0x6'),'urlForward',_0xbabd('0x7'),'bot',_0xbabd('0x8')]],'msg':_0xbabd('0x9')}},'comment':_0xbabd('0x9')},'data1':{'type':Sequelize['STRING'](0x1000),'comment':_0xbabd('0xa')},'data2':{'type':Sequelize['STRING'](0x1000),'comment':_0xbabd('0xb')},'data3':{'type':Sequelize[_0xbabd('0x3')](0x1000),'comment':_0xbabd('0xc')},'data4':{'type':Sequelize[_0xbabd('0x3')](0x1000),'comments':'browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]'},'data5':{'type':Sequelize['STRING'](0x1000),'comments':_0xbabd('0xd')},'data6':{'type':Sequelize['STRING'],'comments':_0xbabd('0xe')},'data7':{'type':Sequelize[_0xbabd('0xf')],'comments':_0xbabd('0x10')}}; \ No newline at end of file +var _0x7ae5=['urlForward[body]','sequelize','exports','VIRTUAL','action','STRING','contactManager','integration','urlForward','browser','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT'];(function(_0x9b007,_0x416098){var _0x12f148=function(_0x3dfc0a){while(--_0x3dfc0a){_0x9b007['push'](_0x9b007['shift']());}};_0x12f148(++_0x416098);}(_0x7ae5,0x133));var _0x57ae=function(_0x329d59,_0xae2550){_0x329d59=_0x329d59-0x0;var _0x2ff3bb=_0x7ae5[_0x329d59];return _0x2ff3bb;};'use strict';var Sequelize=require(_0x57ae('0x0'));module[_0x57ae('0x1')]={'name':{'type':Sequelize[_0x57ae('0x2')],'get':function(_0xf2be0a){return this['getDataValue'](_0x57ae('0x3'));}},'action':{'type':Sequelize[_0x57ae('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0x57ae('0x5'),_0x57ae('0x6'),'motionbar','jscripty',_0x57ae('0x7'),_0x57ae('0x8'),'bot',_0x57ae('0x9')]],'msg':_0x57ae('0xa')}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize[_0x57ae('0x4')](0x1000),'comment':_0x57ae('0xb')},'data2':{'type':Sequelize[_0x57ae('0x4')](0x1000),'comment':'contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]'},'data3':{'type':Sequelize[_0x57ae('0x4')](0x1000),'comment':_0x57ae('0xc')},'data4':{'type':Sequelize[_0x57ae('0x4')](0x1000),'comments':_0x57ae('0xd')},'data5':{'type':Sequelize[_0x57ae('0x4')](0x1000),'comments':_0x57ae('0xe')},'data6':{'type':Sequelize[_0x57ae('0x4')],'comments':_0x57ae('0xf')},'data7':{'type':Sequelize[_0x57ae('0x10')],'comments':_0x57ae('0x11')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index a27b8bd..5f65063 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 _0xfae3=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','error','name','body','Action','params','catch','find','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xfae3,0xa1));var _0x3fae=function(_0x416f4e,_0x46a4b1){_0x416f4e=_0x416f4e-0x0;var _0x230028=_0xfae3[_0x416f4e];return _0x230028;};'use strict';var emlformat=require(_0x3fae('0x0'));var rimraf=require(_0x3fae('0x1'));var zipdir=require(_0x3fae('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3fae('0x3'));var moment=require(_0x3fae('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3fae('0x5'));var util=require(_0x3fae('0x6'));var path=require('path');var sox=require(_0x3fae('0x7'));var csv=require(_0x3fae('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3fae('0x9'));var _=require(_0x3fae('0xa'));var squel=require(_0x3fae('0xb'));var crypto=require(_0x3fae('0xc'));var jsforce=require(_0x3fae('0xd'));var deskjs=require(_0x3fae('0xe'));var toCsv=require(_0x3fae('0x8'));var querystring=require('querystring');var Papa=require(_0x3fae('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3fae('0x10'));var as=require(_0x3fae('0x11'));var hardwareService=require(_0x3fae('0x12'));var logger=require(_0x3fae('0x13'))(_0x3fae('0x14'));var utils=require(_0x3fae('0x15'));var config=require(_0x3fae('0x16'));var licenseUtil=require(_0x3fae('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x588541,_0x17c764){_0x17c764=_0x17c764||0xcc;return function(_0x2bef52){if(_0x2bef52){return _0x588541[_0x3fae('0x18')](_0x17c764);}return _0x588541[_0x3fae('0x19')](_0x17c764)[_0x3fae('0x1a')]();};}function respondWithResult(_0x2da9f0,_0x5e055d){_0x5e055d=_0x5e055d||0xc8;return function(_0x222428){if(_0x222428){return _0x2da9f0[_0x3fae('0x19')](_0x5e055d)[_0x3fae('0x1b')](_0x222428);}};}function respondWithFilteredResult(_0x455260,_0x17f28b){return function(_0x3d6322){if(_0x3d6322){var _0x167b6f=typeof _0x17f28b[_0x3fae('0x1c')]===_0x3fae('0x1d')&&typeof _0x17f28b[_0x3fae('0x1e')]==='undefined';var _0x10021d=_0x3d6322[_0x3fae('0x1f')];var _0x401886=_0x167b6f?0x0:_0x17f28b['offset'];var _0x30c016=_0x167b6f?_0x3d6322[_0x3fae('0x1f')]:_0x17f28b[_0x3fae('0x1c')]+_0x17f28b['limit'];var _0x26663d;if(_0x30c016>=_0x10021d){_0x30c016=_0x10021d;_0x26663d=0xc8;}else{_0x26663d=0xce;}_0x455260['status'](_0x26663d);return _0x455260[_0x3fae('0x20')](_0x3fae('0x21'),_0x401886+'-'+_0x30c016+'/'+_0x10021d)[_0x3fae('0x1b')](_0x3d6322);}return null;};}function patchUpdates(_0x4aeb49){return function(_0x34fb1c){try{jsonpatch[_0x3fae('0x22')](_0x34fb1c,_0x4aeb49,!![]);}catch(_0x308e18){return BPromise[_0x3fae('0x23')](_0x308e18);}return _0x34fb1c['save']();};}function saveUpdates(_0x186db1,_0x3efe3e){return function(_0x14c9eb){if(_0x14c9eb){return _0x14c9eb['update'](_0x186db1)[_0x3fae('0x24')](function(_0x12ce06){return _0x12ce06;});}return null;};}function removeEntity(_0x5bb7c5,_0x4effd3){return function(_0x3b4131){if(_0x3b4131){return _0x3b4131[_0x3fae('0x25')]()['then'](function(){_0x5bb7c5[_0x3fae('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c62e7,_0x41694a){return function(_0x281dd7){if(!_0x281dd7){_0x3c62e7[_0x3fae('0x18')](0x194);}return _0x281dd7;};}function handleError(_0x54dcdd,_0x5511de){_0x5511de=_0x5511de||0x1f4;return function(_0x241950){logger[_0x3fae('0x26')](_0x241950['stack']);if(_0x241950['name']){delete _0x241950[_0x3fae('0x27')];}_0x54dcdd[_0x3fae('0x19')](_0x5511de)['send'](_0x241950);};}exports['update']=function(_0x35b32a,_0x7e19da){if(_0x35b32a[_0x3fae('0x28')]['id']){delete _0x35b32a[_0x3fae('0x28')]['id'];}return db[_0x3fae('0x29')]['find']({'where':{'id':_0x35b32a[_0x3fae('0x2a')]['id']}})[_0x3fae('0x24')](handleEntityNotFound(_0x7e19da,null))['then'](saveUpdates(_0x35b32a[_0x3fae('0x28')],null))[_0x3fae('0x24')](respondWithResult(_0x7e19da,null))[_0x3fae('0x2b')](handleError(_0x7e19da,null));};exports[_0x3fae('0x25')]=function(_0x129c01,_0x44a4eb){return db['Action'][_0x3fae('0x2c')]({'where':{'id':_0x129c01[_0x3fae('0x2a')]['id']}})['then'](handleEntityNotFound(_0x44a4eb,null))[_0x3fae('0x24')](removeEntity(_0x44a4eb,null))[_0x3fae('0x2b')](handleError(_0x44a4eb,null));}; \ No newline at end of file +var _0xb34a=['limit','offset','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','body','Action','find','params','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined'];(function(_0x4bf96c,_0x4d24fd){var _0x281d09=function(_0x56538e){while(--_0x56538e){_0x4bf96c['push'](_0x4bf96c['shift']());}};_0x281d09(++_0x4d24fd);}(_0xb34a,0x1aa));var _0xab34=function(_0x56ea67,_0x255351){_0x56ea67=_0x56ea67-0x0;var _0x1958f7=_0xb34a[_0x56ea67];return _0x1958f7;};'use strict';var emlformat=require(_0xab34('0x0'));var rimraf=require(_0xab34('0x1'));var zipdir=require(_0xab34('0x2'));var jsonpatch=require(_0xab34('0x3'));var rp=require(_0xab34('0x4'));var moment=require(_0xab34('0x5'));var BPromise=require(_0xab34('0x6'));var Mustache=require(_0xab34('0x7'));var util=require(_0xab34('0x8'));var path=require(_0xab34('0x9'));var sox=require(_0xab34('0xa'));var csv=require(_0xab34('0xb'));var ejs=require(_0xab34('0xc'));var fs=require('fs');var fs_extra=require(_0xab34('0xd'));var _=require(_0xab34('0xe'));var squel=require('squel');var crypto=require(_0xab34('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xab34('0xb'));var querystring=require(_0xab34('0x10'));var Papa=require(_0xab34('0x11'));var Redis=require(_0xab34('0x12'));var authService=require(_0xab34('0x13'));var qs=require(_0xab34('0x14'));var as=require(_0xab34('0x15'));var hardwareService=require(_0xab34('0x16'));var logger=require(_0xab34('0x17'))(_0xab34('0x18'));var utils=require(_0xab34('0x19'));var config=require(_0xab34('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xab34('0x1b'))['db'];function respondWithStatusCode(_0x39e750,_0x14bc59){_0x14bc59=_0x14bc59||0xcc;return function(_0x2fb80e){if(_0x2fb80e){return _0x39e750[_0xab34('0x1c')](_0x14bc59);}return _0x39e750[_0xab34('0x1d')](_0x14bc59)[_0xab34('0x1e')]();};}function respondWithResult(_0x3aa0e3,_0x2a4017){_0x2a4017=_0x2a4017||0xc8;return function(_0x5dd407){if(_0x5dd407){return _0x3aa0e3[_0xab34('0x1d')](_0x2a4017)[_0xab34('0x1f')](_0x5dd407);}};}function respondWithFilteredResult(_0xe2168,_0x1ef9f1){return function(_0x2ec1ce){if(_0x2ec1ce){var _0x1ea169=typeof _0x1ef9f1['offset']===_0xab34('0x20')&&typeof _0x1ef9f1[_0xab34('0x21')]==='undefined';var _0x8804ca=_0x2ec1ce['count'];var _0x431e7d=_0x1ea169?0x0:_0x1ef9f1[_0xab34('0x22')];var _0x23def7=_0x1ea169?_0x2ec1ce['count']:_0x1ef9f1[_0xab34('0x22')]+_0x1ef9f1[_0xab34('0x21')];var _0x4d8661;if(_0x23def7>=_0x8804ca){_0x23def7=_0x8804ca;_0x4d8661=0xc8;}else{_0x4d8661=0xce;}_0xe2168[_0xab34('0x1d')](_0x4d8661);return _0xe2168['set'](_0xab34('0x23'),_0x431e7d+'-'+_0x23def7+'/'+_0x8804ca)[_0xab34('0x1f')](_0x2ec1ce);}return null;};}function patchUpdates(_0x60cbaf){return function(_0xc0eb35){try{jsonpatch[_0xab34('0x24')](_0xc0eb35,_0x60cbaf,!![]);}catch(_0x4305ad){return BPromise[_0xab34('0x25')](_0x4305ad);}return _0xc0eb35[_0xab34('0x26')]();};}function saveUpdates(_0x325853,_0x24b503){return function(_0xeb199c){if(_0xeb199c){return _0xeb199c[_0xab34('0x27')](_0x325853)[_0xab34('0x28')](function(_0x1f50b7){return _0x1f50b7;});}return null;};}function removeEntity(_0x2bfb1a,_0x26c82a){return function(_0x40ab27){if(_0x40ab27){return _0x40ab27[_0xab34('0x29')]()[_0xab34('0x28')](function(){_0x2bfb1a[_0xab34('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x7a6f42,_0x4905fb){return function(_0x3c4f7c){if(!_0x3c4f7c){_0x7a6f42['sendStatus'](0x194);}return _0x3c4f7c;};}function handleError(_0x72ad3e,_0xc47c4b){_0xc47c4b=_0xc47c4b||0x1f4;return function(_0x369b12){logger[_0xab34('0x2a')](_0x369b12[_0xab34('0x2b')]);if(_0x369b12[_0xab34('0x2c')]){delete _0x369b12[_0xab34('0x2c')];}_0x72ad3e['status'](_0xc47c4b)[_0xab34('0x2d')](_0x369b12);};}exports['update']=function(_0xd6a0a,_0x25d27b){if(_0xd6a0a[_0xab34('0x2e')]['id']){delete _0xd6a0a[_0xab34('0x2e')]['id'];}return db[_0xab34('0x2f')][_0xab34('0x30')]({'where':{'id':_0xd6a0a[_0xab34('0x31')]['id']}})['then'](handleEntityNotFound(_0x25d27b,null))[_0xab34('0x28')](saveUpdates(_0xd6a0a[_0xab34('0x2e')],null))[_0xab34('0x28')](respondWithResult(_0x25d27b,null))['catch'](handleError(_0x25d27b,null));};exports[_0xab34('0x29')]=function(_0x44a5e8,_0x1c9b81){return db['Action']['find']({'where':{'id':_0x44a5e8[_0xab34('0x31')]['id']}})['then'](handleEntityNotFound(_0x1c9b81,null))['then'](removeEntity(_0x1c9b81,null))[_0xab34('0x32')](handleError(_0x1c9b81,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 0e346a2..118c215 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 _0x7615=['path','rimraf','./action.attributes','exports','define','Action','lodash','api','bluebird','request-promise'];(function(_0x14d3cc,_0x567831){var _0x1f822b=function(_0x1eeeb9){while(--_0x1eeeb9){_0x14d3cc['push'](_0x14d3cc['shift']());}};_0x1f822b(++_0x567831);}(_0x7615,0xec));var _0x5761=function(_0x4bc65f,_0x39ec43){_0x4bc65f=_0x4bc65f-0x0;var _0x44f85f=_0x7615[_0x4bc65f];return _0x44f85f;};'use strict';var _=require(_0x5761('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5761('0x1'));var moment=require('moment');var BPromise=require(_0x5761('0x2'));var rp=require(_0x5761('0x3'));var fs=require('fs');var path=require(_0x5761('0x4'));var rimraf=require(_0x5761('0x5'));var config=require('../../config/environment');var attributes=require(_0x5761('0x6'));module[_0x5761('0x7')]=function(_0x17609e,_0x1e81a2){return _0x17609e[_0x5761('0x8')](_0x5761('0x9'),attributes,{'tableName':'tools_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd34c=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','tools_actions','lodash'];(function(_0x5ad753,_0x21bc14){var _0x55b69=function(_0x459144){while(--_0x459144){_0x5ad753['push'](_0x5ad753['shift']());}};_0x55b69(++_0x21bc14);}(_0xd34c,0x185));var _0xcd34=function(_0x53a154,_0x21ff77){_0x53a154=_0x53a154-0x0;var _0x18c240=_0xd34c[_0x53a154];return _0x18c240;};'use strict';var _=require(_0xcd34('0x0'));var util=require(_0xcd34('0x1'));var logger=require(_0xcd34('0x2'))(_0xcd34('0x3'));var moment=require(_0xcd34('0x4'));var BPromise=require(_0xcd34('0x5'));var rp=require(_0xcd34('0x6'));var fs=require('fs');var path=require(_0xcd34('0x7'));var rimraf=require(_0xcd34('0x8'));var config=require(_0xcd34('0x9'));var attributes=require('./action.attributes');module[_0xcd34('0xa')]=function(_0x2852e4,_0x4df05f){return _0x2852e4[_0xcd34('0xb')]('Action',attributes,{'tableName':_0xcd34('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/action/action.rpc.js b/server/api/action/action.rpc.js index 950ad33..0e9e55c 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 _0x7a54=['info','Action,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x7a54,0x106));var _0x47a5=function(_0x4c571f,_0x520dd9){_0x4c571f=_0x4c571f-0x0;var _0x13c69e=_0x7a54[_0x4c571f];return _0x13c69e;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Action,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +var _0xabce=['util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','client','then','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash'];(function(_0xab6372,_0x3daf3d){var _0x83504f=function(_0x121113){while(--_0x121113){_0xab6372['push'](_0xab6372['shift']());}};_0x83504f(++_0x3daf3d);}(_0xabce,0x103));var _0xeabc=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xabce[_0x54d4fe];return _0x1ab5bb;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var moment=require(_0xeabc('0x2'));var BPromise=require(_0xeabc('0x3'));var rs=require(_0xeabc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xeabc('0x5'));var logger=require(_0xeabc('0x6'))(_0xeabc('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xeabc('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x229ba4,_0x52ede8,_0x3bdc29){return new BPromise(function(_0x9417af,_0x8434c5){return client['request'](_0x229ba4,_0x3bdc29)[_0xeabc('0x9')](function(_0x341f16){logger[_0xeabc('0xa')](_0xeabc('0xb'),_0x52ede8,_0xeabc('0xc'));logger[_0xeabc('0xd')](_0xeabc('0xe'),_0x52ede8,_0xeabc('0xc'),JSON[_0xeabc('0xf')](_0x341f16));if(_0x341f16[_0xeabc('0x10')]){if(_0x341f16[_0xeabc('0x10')][_0xeabc('0x11')]===0x1f4){logger[_0xeabc('0x10')](_0xeabc('0xb'),_0x52ede8,_0x341f16[_0xeabc('0x10')][_0xeabc('0x12')]);return _0x8434c5(_0x341f16['error'][_0xeabc('0x12')]);}logger[_0xeabc('0x10')](_0xeabc('0xb'),_0x52ede8,_0x341f16['error']['message']);return _0x9417af(_0x341f16[_0xeabc('0x10')][_0xeabc('0x12')]);}else{logger[_0xeabc('0xa')]('Action,\x20%s,\x20%s',_0x52ede8,_0xeabc('0xc'));_0x9417af(_0x341f16[_0xeabc('0x13')]['message']);}})['catch'](function(_0x10fa8e){logger['error'](_0xeabc('0xb'),_0x52ede8,_0x10fa8e);_0x8434c5(_0x10fa8e);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index e2de447..9778cfa 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 _0x3f1a=['/:id','isAuthenticated','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./action.controller','put'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x3f1a,0x104));var _0xa3f1=function(_0x248701,_0x27e401){_0x248701=_0x248701-0x0;var _0x557185=_0x3f1a[_0x248701];return _0x557185;};'use strict';var multer=require(_0xa3f1('0x0'));var util=require(_0xa3f1('0x1'));var path=require(_0xa3f1('0x2'));var timeout=require(_0xa3f1('0x3'));var express=require(_0xa3f1('0x4'));var router=express[_0xa3f1('0x5')]();var fs_extra=require(_0xa3f1('0x6'));var auth=require(_0xa3f1('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa3f1('0x8'));router[_0xa3f1('0x9')](_0xa3f1('0xa'),auth[_0xa3f1('0xb')](),controller[_0xa3f1('0xc')]);router[_0xa3f1('0xd')](_0xa3f1('0xa'),auth[_0xa3f1('0xb')](),controller[_0xa3f1('0xe')]);module['exports']=router; \ No newline at end of file +var _0x934e=['put','/:id','isAuthenticated','update','destroy','exports','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./action.controller'];(function(_0x5245bc,_0x55e740){var _0x2acb9a=function(_0x4fd1e6){while(--_0x4fd1e6){_0x5245bc['push'](_0x5245bc['shift']());}};_0x2acb9a(++_0x55e740);}(_0x934e,0x165));var _0xe934=function(_0xb0c93e,_0x4988ee){_0xb0c93e=_0xb0c93e-0x0;var _0x30c74b=_0x934e[_0xb0c93e];return _0x30c74b;};'use strict';var multer=require(_0xe934('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xe934('0x1'));var express=require(_0xe934('0x2'));var router=express['Router']();var fs_extra=require(_0xe934('0x3'));var auth=require(_0xe934('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xe934('0x5'));var controller=require(_0xe934('0x6'));router[_0xe934('0x7')](_0xe934('0x8'),auth[_0xe934('0x9')](),controller[_0xe934('0xa')]);router['delete'](_0xe934('0x8'),auth[_0xe934('0x9')](),controller[_0xe934('0xb')]);module[_0xe934('0xc')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 762882a..3c4d348 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 _0xeff8=['STRING','TEXT','sequelize','exports'];(function(_0x4b9438,_0x1f41c){var _0x128b3a=function(_0x546826){while(--_0x546826){_0x4b9438['push'](_0x4b9438['shift']());}};_0x128b3a(++_0x1f41c);}(_0xeff8,0x186));var _0x8eff=function(_0x1780f8,_0x11ba93){_0x1780f8=_0x1780f8-0x0;var _0x33a410=_0xeff8[_0x1780f8];return _0x33a410;};'use strict';var Sequelize=require(_0x8eff('0x0'));module[_0x8eff('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x8eff('0x2')]},'parent':{'type':Sequelize[_0x8eff('0x2')]},'table':{'type':Sequelize[_0x8eff('0x2')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0x8eff('0x3')]}}; \ No newline at end of file +var _0xdbf5=['exports','STRING','TEXT'];(function(_0x54ebca,_0x5bc67e){var _0x5b432a=function(_0x441caa){while(--_0x441caa){_0x54ebca['push'](_0x54ebca['shift']());}};_0x5b432a(++_0x5bc67e);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x2d6d3b,_0x2fac6e){_0x2d6d3b=_0x2d6d3b-0x0;var _0x398948=_0xdbf5[_0x2d6d3b];return _0x398948;};'use strict';var Sequelize=require('sequelize');module[_0x5dbf('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x5dbf('0x1')]},'table':{'type':Sequelize[_0x5dbf('0x1')]},'conditions':{'type':Sequelize[_0x5dbf('0x2')]},'joins':{'type':Sequelize[_0x5dbf('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 470a4a1..f7e9780 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 _0xc0ac=['filters','pick','filter','merge','map','type','VIRTUAL','options','findAll','rows','show','params','includeAll','include','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','group','field','condition','value','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','select','from','table','MetricId','metric','function','replace','format','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','debug','Limited\x20Query:','toString','sequelize','SELECT','COUNT(DISTINCT\x20%s)','HOUR(%s)','operator','getFields','Sequelize','keyBy','output','web','fullPath','randomstring','generate','csv','custom','AnalyticExtractedReport','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','countTable','QueryTypes','run','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','dbH','sendStatus','end','json','offset','count','status','set','Content-Range','save','update','then','destroy','get','CustomReports','UserProfileResource','stack','name','send','index','AnalyticCustomReport','rawAttributes','fieldName','key','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','limit','order','sort','where'];(function(_0x1cc0b8,_0x3bdfe7){var _0x4b1daf=function(_0x4edc04){while(--_0x4edc04){_0x1cc0b8['push'](_0x1cc0b8['shift']());}};_0x4b1daf(++_0x3bdfe7);}(_0xc0ac,0x65));var _0xcc0a=function(_0x83195f,_0x48c6d6){_0x83195f=_0x83195f-0x0;var _0x409b61=_0xc0ac[_0x83195f];return _0x409b61;};'use strict';var emlformat=require(_0xcc0a('0x0'));var rimraf=require(_0xcc0a('0x1'));var zipdir=require(_0xcc0a('0x2'));var jsonpatch=require(_0xcc0a('0x3'));var rp=require(_0xcc0a('0x4'));var moment=require(_0xcc0a('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xcc0a('0x6'));var path=require('path');var sox=require(_0xcc0a('0x7'));var csv=require('to-csv');var ejs=require(_0xcc0a('0x8'));var fs=require('fs');var fs_extra=require(_0xcc0a('0x9'));var _=require(_0xcc0a('0xa'));var squel=require(_0xcc0a('0xb'));var crypto=require('crypto');var jsforce=require(_0xcc0a('0xc'));var deskjs=require(_0xcc0a('0xd'));var toCsv=require(_0xcc0a('0xe'));var querystring=require('querystring');var Papa=require(_0xcc0a('0xf'));var Redis=require('ioredis');var authService=require(_0xcc0a('0x10'));var qs=require(_0xcc0a('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcc0a('0x12'));var logger=require(_0xcc0a('0x13'))(_0xcc0a('0x14'));var utils=require(_0xcc0a('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xcc0a('0x16'));var db=require(_0xcc0a('0x17'))['db'];var dbH=require(_0xcc0a('0x17'))[_0xcc0a('0x18')];function respondWithStatusCode(_0x116e7a,_0x41c1e2){_0x41c1e2=_0x41c1e2||0xcc;return function(_0x2b41db){if(_0x2b41db){return _0x116e7a[_0xcc0a('0x19')](_0x41c1e2);}return _0x116e7a['status'](_0x41c1e2)[_0xcc0a('0x1a')]();};}function respondWithResult(_0x6c390b,_0x3fdb7f){_0x3fdb7f=_0x3fdb7f||0xc8;return function(_0x1238aa){if(_0x1238aa){return _0x6c390b['status'](_0x3fdb7f)[_0xcc0a('0x1b')](_0x1238aa);}};}function respondWithFilteredResult(_0x4cc3d6,_0x302bd2){return function(_0x5d60c1){if(_0x5d60c1){var _0x421f02=typeof _0x302bd2[_0xcc0a('0x1c')]==='undefined'&&typeof _0x302bd2['limit']==='undefined';var _0x4230ee=_0x5d60c1[_0xcc0a('0x1d')];var _0x27433e=_0x421f02?0x0:_0x302bd2[_0xcc0a('0x1c')];var _0x33befe=_0x421f02?_0x5d60c1[_0xcc0a('0x1d')]:_0x302bd2[_0xcc0a('0x1c')]+_0x302bd2['limit'];var _0x39b122;if(_0x33befe>=_0x4230ee){_0x33befe=_0x4230ee;_0x39b122=0xc8;}else{_0x39b122=0xce;}_0x4cc3d6[_0xcc0a('0x1e')](_0x39b122);return _0x4cc3d6[_0xcc0a('0x1f')](_0xcc0a('0x20'),_0x27433e+'-'+_0x33befe+'/'+_0x4230ee)[_0xcc0a('0x1b')](_0x5d60c1);}return null;};}function patchUpdates(_0x561a6a){return function(_0x250b3b){try{jsonpatch['apply'](_0x250b3b,_0x561a6a,!![]);}catch(_0x465aa5){return BPromise['reject'](_0x465aa5);}return _0x250b3b[_0xcc0a('0x21')]();};}function saveUpdates(_0x233ea8,_0x7a16ca){return function(_0x3cdaf4){if(_0x3cdaf4){return _0x3cdaf4[_0xcc0a('0x22')](_0x233ea8)[_0xcc0a('0x23')](function(_0x2633c1){return _0x2633c1;});}return null;};}function removeEntity(_0x290579,_0x328b53){return function(_0x304791){if(_0x304791){return _0x304791[_0xcc0a('0x24')]()[_0xcc0a('0x23')](function(){var _0x29843d=_0x304791[_0xcc0a('0x25')]({'plain':!![]});var _0x16969f=_0xcc0a('0x26');return db[_0xcc0a('0x27')][_0xcc0a('0x24')]({'where':{'type':_0x16969f,'resourceId':_0x29843d['id']}})[_0xcc0a('0x23')](function(){return _0x304791;});})['then'](function(){_0x290579[_0xcc0a('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5ec74f,_0x2e51b1){return function(_0x4f5728){if(!_0x4f5728){_0x5ec74f[_0xcc0a('0x19')](0x194);}return _0x4f5728;};}function handleError(_0x43f4a7,_0x52d3dd){_0x52d3dd=_0x52d3dd||0x1f4;return function(_0x56046a){logger['error'](_0x56046a[_0xcc0a('0x28')]);if(_0x56046a[_0xcc0a('0x29')]){delete _0x56046a[_0xcc0a('0x29')];}_0x43f4a7[_0xcc0a('0x1e')](_0x52d3dd)[_0xcc0a('0x2a')](_0x56046a);};}exports[_0xcc0a('0x2b')]=function(_0x335782,_0x42c098){var _0x3ce04c={},_0x55a0c8={},_0x33f3b8={'count':0x0,'rows':[]};var _0xe504c1=_['map'](db[_0xcc0a('0x2c')][_0xcc0a('0x2d')],function(_0x424bcf){return{'name':_0x424bcf[_0xcc0a('0x2e')],'type':_0x424bcf['type'][_0xcc0a('0x2f')]};});_0x55a0c8['model']=_['map'](_0xe504c1,_0xcc0a('0x29'));_0x55a0c8['query']=_[_0xcc0a('0x30')](_0x335782[_0xcc0a('0x31')]);_0x55a0c8['filters']=_[_0xcc0a('0x32')](_0x55a0c8[_0xcc0a('0x33')],_0x55a0c8[_0xcc0a('0x31')]);_0x3ce04c[_0xcc0a('0x34')]=_[_0xcc0a('0x32')](_0x55a0c8[_0xcc0a('0x33')],qs[_0xcc0a('0x35')](_0x335782[_0xcc0a('0x31')][_0xcc0a('0x35')]));_0x3ce04c[_0xcc0a('0x34')]=_0x3ce04c[_0xcc0a('0x34')][_0xcc0a('0x36')]?_0x3ce04c['attributes']:_0x55a0c8[_0xcc0a('0x33')];if(!_0x335782[_0xcc0a('0x31')][_0xcc0a('0x37')]('nolimit')){_0x3ce04c['limit']=qs['limit'](_0x335782['query'][_0xcc0a('0x38')]);_0x3ce04c[_0xcc0a('0x1c')]=qs['offset'](_0x335782['query'][_0xcc0a('0x1c')]);}_0x3ce04c[_0xcc0a('0x39')]=qs[_0xcc0a('0x3a')](_0x335782['query'][_0xcc0a('0x3a')]);_0x3ce04c[_0xcc0a('0x3b')]=qs[_0xcc0a('0x3c')](_[_0xcc0a('0x3d')](_0x335782['query'],_0x55a0c8[_0xcc0a('0x3c')]),_0xe504c1);if(_0x335782['query'][_0xcc0a('0x3e')]){_0x3ce04c['where']=_[_0xcc0a('0x3f')](_0x3ce04c['where'],{'$or':_[_0xcc0a('0x40')](_0xe504c1,function(_0x9ddea7){if(_0x9ddea7[_0xcc0a('0x41')]!==_0xcc0a('0x42')){var _0x43e705={};_0x43e705[_0x9ddea7[_0xcc0a('0x29')]]={'$like':'%'+_0x335782['query'][_0xcc0a('0x3e')]+'%'};return _0x43e705;}})});}_0x3ce04c=_['merge']({},_0x3ce04c,_0x335782[_0xcc0a('0x43')]);var _0xb9ea9={'where':_0x3ce04c[_0xcc0a('0x3b')]};return db[_0xcc0a('0x2c')][_0xcc0a('0x1d')](_0xb9ea9)[_0xcc0a('0x23')](function(_0x31f637){_0x33f3b8[_0xcc0a('0x1d')]=_0x31f637;if(_0x335782[_0xcc0a('0x31')]['includeAll']){_0x3ce04c['include']=[{'all':!![]}];}return db['AnalyticCustomReport'][_0xcc0a('0x44')](_0x3ce04c);})[_0xcc0a('0x23')](function(_0x5687e4){_0x33f3b8[_0xcc0a('0x45')]=_0x5687e4;return _0x33f3b8;})[_0xcc0a('0x23')](respondWithFilteredResult(_0x42c098,_0x3ce04c))['catch'](handleError(_0x42c098,null));};exports[_0xcc0a('0x46')]=function(_0x2a6e2d,_0xb1eef1){var _0x32873c={'raw':![],'where':{'id':_0x2a6e2d[_0xcc0a('0x47')]['id']}},_0x38d28b={};_0x38d28b[_0xcc0a('0x33')]=_['keys'](db['AnalyticCustomReport'][_0xcc0a('0x2d')]);_0x38d28b[_0xcc0a('0x31')]=_[_0xcc0a('0x30')](_0x2a6e2d['query']);_0x38d28b[_0xcc0a('0x3c')]=_[_0xcc0a('0x32')](_0x38d28b[_0xcc0a('0x33')],_0x38d28b['query']);_0x32873c[_0xcc0a('0x34')]=_[_0xcc0a('0x32')](_0x38d28b['model'],qs['fields'](_0x2a6e2d[_0xcc0a('0x31')][_0xcc0a('0x35')]));_0x32873c[_0xcc0a('0x34')]=_0x32873c[_0xcc0a('0x34')][_0xcc0a('0x36')]?_0x32873c['attributes']:_0x38d28b[_0xcc0a('0x33')];if(_0x2a6e2d[_0xcc0a('0x31')][_0xcc0a('0x48')]){_0x32873c[_0xcc0a('0x49')]=[{'all':!![]}];}_0x32873c=_[_0xcc0a('0x3f')]({},_0x32873c,_0x2a6e2d[_0xcc0a('0x43')]);return db[_0xcc0a('0x2c')][_0xcc0a('0x4a')](_0x32873c)['then'](handleEntityNotFound(_0xb1eef1,null))[_0xcc0a('0x23')](respondWithResult(_0xb1eef1,null))[_0xcc0a('0x4b')](handleError(_0xb1eef1,null));};exports[_0xcc0a('0x4c')]=function(_0x4fa3bb,_0x4253ff){return db['AnalyticCustomReport'][_0xcc0a('0x4c')](_0x4fa3bb[_0xcc0a('0x4d')],{})[_0xcc0a('0x23')](function(_0x45f3e8){var _0x58be84=_0x4fa3bb[_0xcc0a('0x4e')][_0xcc0a('0x25')]({'plain':!![]});if(!_0x58be84)throw new Error(_0xcc0a('0x4f'));if(_0x58be84[_0xcc0a('0x50')]===_0xcc0a('0x4e')){var _0x58ce00=_0x45f3e8[_0xcc0a('0x25')]({'plain':!![]});var _0x198770='Reports';return db['UserProfileSection'][_0xcc0a('0x4a')]({'where':{'name':_0x198770,'userProfileId':_0x58be84[_0xcc0a('0x51')]},'raw':!![]})['then'](function(_0x156c9c){if(_0x156c9c&&_0x156c9c[_0xcc0a('0x52')]===0x0){return db[_0xcc0a('0x27')]['create']({'name':_0x58ce00['name'],'resourceId':_0x58ce00['id'],'type':'CustomReports','sectionId':_0x156c9c['id']},{})[_0xcc0a('0x23')](function(){return _0x45f3e8;});}else{return _0x45f3e8;}})[_0xcc0a('0x4b')](function(_0x211834){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x211834);throw _0x211834;});}return _0x45f3e8;})[_0xcc0a('0x23')](respondWithResult(_0x4253ff,0xc9))['catch'](handleError(_0x4253ff,null));};exports[_0xcc0a('0x22')]=function(_0xd85fec,_0x488235){if(_0xd85fec[_0xcc0a('0x4d')]['id']){delete _0xd85fec[_0xcc0a('0x4d')]['id'];}return db[_0xcc0a('0x2c')][_0xcc0a('0x4a')]({'where':{'id':_0xd85fec[_0xcc0a('0x47')]['id']}})['then'](handleEntityNotFound(_0x488235,null))[_0xcc0a('0x23')](saveUpdates(_0xd85fec[_0xcc0a('0x4d')],null))[_0xcc0a('0x23')](respondWithResult(_0x488235,null))['catch'](handleError(_0x488235,null));};exports[_0xcc0a('0x24')]=function(_0x465502,_0x4b49d4){return db[_0xcc0a('0x2c')][_0xcc0a('0x4a')]({'where':{'id':_0x465502['params']['id']}})['then'](handleEntityNotFound(_0x4b49d4,null))[_0xcc0a('0x23')](removeEntity(_0x4b49d4,null))[_0xcc0a('0x4b')](handleError(_0x4b49d4,null));};exports[_0xcc0a('0x53')]=function(_0x20c7ca,_0x40934a){var _0x482ff8=0xa;var _0xb18262=[_0xcc0a('0x54'),_0xcc0a('0x55'),_0xcc0a('0x56'),_0xcc0a('0x57')];var _0x12f584={'SUM':_0xcc0a('0x58'),'COUNT':_0xcc0a('0x59'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xcc0a('0x5a'),'MIN':_0xcc0a('0x5b'),'AVG':_0xcc0a('0x5c'),'GROUP_CONCAT':_0xcc0a('0x5d'),'GROUP_CONCAT ASC':_0xcc0a('0x5e'),'GROUP_CONCAT DESC':_0xcc0a('0x5f')};var _0x12b24c={'SEC_TO_TIME':_0xcc0a('0x60'),'DATE':_0xcc0a('0x61'),'HOUR':'HOUR(%s)','ROUND':_0xcc0a('0x62'),'UNIX_TIMESTAMP':_0xcc0a('0x63')};var _0x5f1bbd=function(_0x16f0bf){return!_[_0xcc0a('0x64')]([_0xcc0a('0x65'),_0xcc0a('0x66'),_0xcc0a('0x67'),_0xcc0a('0x68')],_0x16f0bf);};var _0x2509eb=function(_0x3c38ee){if(!_0x3c38ee||!_0x3c38ee[_0xcc0a('0x69')][_0xcc0a('0x36')]){return'';}for(var _0x21355a='(',_0x3d40f3=0x0;_0x3d40f3<_0x3c38ee['rules'][_0xcc0a('0x36')];_0x3d40f3+=0x1){_0x3d40f3>0x0&&(_0x21355a+='\x20'+_0x3c38ee['operator']+'\x20');_0x21355a+=_0x3c38ee[_0xcc0a('0x69')][_0x3d40f3][_0xcc0a('0x6a')]?_0x2509eb(_0x3c38ee['rules'][_0x3d40f3][_0xcc0a('0x6a')]):_0x3c38ee[_0xcc0a('0x69')][_0x3d40f3][_0xcc0a('0x6b')]+'\x20'+_0x3c38ee[_0xcc0a('0x69')][_0x3d40f3][_0xcc0a('0x6c')]+(_0x5f1bbd(_0x3c38ee['rules'][_0x3d40f3]['condition'])?'\x20'+_0x3c38ee[_0xcc0a('0x69')][_0x3d40f3][_0xcc0a('0x6d')]:'');}return _0x21355a+')';};var _0x12a824={'where':{'id':_0x20c7ca[_0xcc0a('0x47')]['id']}},_0x3b8e1d,_0x581f27,_0x16c444,_0x1625ec,_0x354b60;_0x12a824=_['merge']({},_0x12a824,_0x20c7ca[_0xcc0a('0x43')]);return db[_0xcc0a('0x2c')]['find'](_0x12a824)['then'](function(_0x14257c){if(_0x14257c){_0x3b8e1d=_0x14257c;return _0x14257c['getFields']();}return null;})['then'](function(_0x300216){if(_0x300216){if(!_0x300216[_0xcc0a('0x36')]){throw new db['Sequelize'][(_0xcc0a('0x6e'))](_0xcc0a('0x6f'),0x193);}_0x581f27=_0x300216;return db[_0xcc0a('0x70')][_0xcc0a('0x44')]({'raw':!![]});}return null;})['then'](function(_0x545f2d){if(_0x545f2d){_0x16c444=_['keyBy'](_0x545f2d,'id');var _0xdadb47;var _0x4da418=squel[_0xcc0a('0x71')]();_0x4da418[_0xcc0a('0x72')](_0x3b8e1d[_0xcc0a('0x73')]);for(var _0x302302=0x0;_0x302302<_0x581f27[_0xcc0a('0x36')];_0x302302+=0x1){_0xdadb47=_0x581f27[_0x302302][_0xcc0a('0x74')]?_0x16c444[_0x581f27[_0x302302]['MetricId']][_0xcc0a('0x75')]:_0x581f27[_0x302302][_0xcc0a('0x6b')];_0xdadb47=_0x581f27[_0x302302][_0xcc0a('0x76')]?_[_0xcc0a('0x77')](_0x12f584[_0x581f27[_0x302302][_0xcc0a('0x76')]],'%s',_0xdadb47):_0xdadb47;_0xdadb47=_0x581f27[_0x302302][_0xcc0a('0x78')]?_[_0xcc0a('0x77')](_0x12b24c[_0x581f27[_0x302302][_0xcc0a('0x78')]],'%s',_0xdadb47):_0xdadb47;if(_0x581f27[_0x302302]['groupBy']){_0x4da418[_0xcc0a('0x6a')](_0xdadb47);}_0x581f27[_0x302302][_0xcc0a('0x79')]&&_0x4da418[_0xcc0a('0x39')](_0xdadb47,_0x581f27[_0x302302][_0xcc0a('0x79')]===_0xcc0a('0x7a')?![]:!![]);_0x4da418[_0xcc0a('0x6b')](_0xdadb47,_0x581f27[_0x302302][_0xcc0a('0x7b')]||_0xdadb47);}if(_0x3b8e1d[_0xcc0a('0x7c')]){_0x3b8e1d['joins']=JSON[_0xcc0a('0x7d')](_0x3b8e1d['joins']);for(var _0x2f19a1=0x0;_0x2f19a1<_0x3b8e1d[_0xcc0a('0x7c')][_0xcc0a('0x36')];_0x2f19a1+=0x1){if(_0x3b8e1d['joins'][_0x2f19a1][_0xcc0a('0x41')]&&_['includes'](_0xb18262,_0x3b8e1d['joins'][_0x2f19a1][_0xcc0a('0x41')])&&_0x3b8e1d['joins'][_0x2f19a1][_0xcc0a('0x7e')]&&_0x3b8e1d[_0xcc0a('0x7c')][_0x2f19a1][_0xcc0a('0x7f')]&&_0x3b8e1d[_0xcc0a('0x7c')][_0x2f19a1][_0xcc0a('0x80')]){_0x4da418[_0x3b8e1d[_0xcc0a('0x7c')][_0x2f19a1][_0xcc0a('0x41')]](_0x3b8e1d[_0xcc0a('0x7c')][_0x2f19a1][_0xcc0a('0x7f')],null,util[_0xcc0a('0x78')](_0xcc0a('0x81'),_0x3b8e1d[_0xcc0a('0x73')],_0x3b8e1d[_0xcc0a('0x7c')][_0x2f19a1][_0xcc0a('0x7e')],_0x3b8e1d[_0xcc0a('0x7c')][_0x2f19a1][_0xcc0a('0x7f')],_0x3b8e1d[_0xcc0a('0x7c')][_0x2f19a1][_0xcc0a('0x80')]));}}}if(_0x3b8e1d[_0xcc0a('0x82')]){_0x3b8e1d['conditions']=JSON[_0xcc0a('0x7d')](_0x3b8e1d[_0xcc0a('0x82')]);_0x4da418[_0xcc0a('0x3b')](_0x2509eb(_0x3b8e1d[_0xcc0a('0x82')][_0xcc0a('0x6a')]));}_0x354b60=_0x4da418['clone']();_0x4da418['limit'](_0x482ff8);_0x4da418['offset'](0x0);logger[_0xcc0a('0x83')](_0xcc0a('0x84'),_0x4da418[_0xcc0a('0x85')]());return dbH[_0xcc0a('0x86')][_0xcc0a('0x31')](_0x4da418['toString'](),{'type':dbH[_0xcc0a('0x86')]['QueryTypes'][_0xcc0a('0x87')]});}})[_0xcc0a('0x23')](respondWithResult(_0x40934a,null))[_0xcc0a('0x4b')](handleError(_0x40934a,null));};function runReport(_0x305b37,_0x428f9f,_0x2ceee5){var _0x1f75e4=_0x428f9f[_0xcc0a('0x29')];var _0x1a9b6c=0xa;var _0x426f9b=[_0xcc0a('0x54'),'left_join','right_join',_0xcc0a('0x57')];var _0x22f1b3={'SUM':_0xcc0a('0x58'),'COUNT':_0xcc0a('0x59'),'COUNT DISTINCT':_0xcc0a('0x88'),'MAX':_0xcc0a('0x5a'),'MIN':_0xcc0a('0x5b'),'AVG':_0xcc0a('0x5c'),'GROUP_CONCAT':_0xcc0a('0x5d'),'GROUP_CONCAT ASC':_0xcc0a('0x5e'),'GROUP_CONCAT DESC':_0xcc0a('0x5f')};var _0x1a12a0={'SEC_TO_TIME':_0xcc0a('0x60'),'DATE':'DATE(%s)','HOUR':_0xcc0a('0x89'),'ROUND':_0xcc0a('0x62'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0xc0f9f6=function(_0x27e5e9){return!_[_0xcc0a('0x64')]([_0xcc0a('0x65'),_0xcc0a('0x66'),_0xcc0a('0x67'),_0xcc0a('0x68')],_0x27e5e9);};var _0x114ae8=function(_0x15348d){if(!_0x15348d||!_0x15348d[_0xcc0a('0x69')][_0xcc0a('0x36')]){return'';}for(var _0x5f1497='(',_0x3a7154=0x0;_0x3a7154<_0x15348d[_0xcc0a('0x69')][_0xcc0a('0x36')];_0x3a7154+=0x1){_0x3a7154>0x0&&(_0x5f1497+='\x20'+_0x15348d[_0xcc0a('0x8a')]+'\x20');_0x5f1497+=_0x15348d[_0xcc0a('0x69')][_0x3a7154][_0xcc0a('0x6a')]?_0x114ae8(_0x15348d[_0xcc0a('0x69')][_0x3a7154][_0xcc0a('0x6a')]):_0x15348d[_0xcc0a('0x69')][_0x3a7154][_0xcc0a('0x6b')]+'\x20'+_0x15348d[_0xcc0a('0x69')][_0x3a7154]['condition']+(_0xc0f9f6(_0x15348d['rules'][_0x3a7154][_0xcc0a('0x6c')])?'\x20'+_0x15348d['rules'][_0x3a7154][_0xcc0a('0x6d')]:'');}return _0x5f1497+')';};var _0x2821ab={'where':{'id':_0x305b37['id']}},_0x1c2419,_0xa3263b,_0x115445,_0x501428,_0x34be1c;_0x2821ab=_[_0xcc0a('0x3f')]({},_0x2821ab,_0x2ceee5);return db['AnalyticCustomReport'][_0xcc0a('0x4a')](_0x2821ab)[_0xcc0a('0x23')](function(_0x2b061d){if(_0x2b061d){_0x1c2419=_0x2b061d;return _0x2b061d[_0xcc0a('0x8b')]();}return null;})['then'](function(_0x239392){if(_0x239392){if(!_0x239392['length']){throw new db[(_0xcc0a('0x8c'))][(_0xcc0a('0x6e'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0xa3263b=_0x239392;return db[_0xcc0a('0x70')][_0xcc0a('0x44')]({'raw':!![]});}return null;})[_0xcc0a('0x23')](function(_0x1f91b8){if(_0x1f91b8){_0x115445=_[_0xcc0a('0x8d')](_0x1f91b8,'id');var _0xf3a820;var _0x462cd1=squel[_0xcc0a('0x71')]();_0x462cd1[_0xcc0a('0x72')](_0x1c2419[_0xcc0a('0x73')]);for(var _0x1c7121=0x0;_0x1c7121<_0xa3263b[_0xcc0a('0x36')];_0x1c7121+=0x1){_0xf3a820=_0xa3263b[_0x1c7121]['MetricId']?_0x115445[_0xa3263b[_0x1c7121][_0xcc0a('0x74')]]['metric']:_0xa3263b[_0x1c7121][_0xcc0a('0x6b')];_0xf3a820=_0xa3263b[_0x1c7121][_0xcc0a('0x76')]?_[_0xcc0a('0x77')](_0x22f1b3[_0xa3263b[_0x1c7121][_0xcc0a('0x76')]],'%s',_0xf3a820):_0xf3a820;_0xf3a820=_0xa3263b[_0x1c7121][_0xcc0a('0x78')]?_['replace'](_0x1a12a0[_0xa3263b[_0x1c7121][_0xcc0a('0x78')]],'%s',_0xf3a820):_0xf3a820;if(_0xa3263b[_0x1c7121]['groupBy']){_0x462cd1[_0xcc0a('0x6a')](_0xf3a820);}_0xa3263b[_0x1c7121][_0xcc0a('0x79')]&&_0x462cd1[_0xcc0a('0x39')](_0xf3a820,_0xa3263b[_0x1c7121][_0xcc0a('0x79')]===_0xcc0a('0x7a')?![]:!![]);_0x462cd1[_0xcc0a('0x6b')](_0xf3a820,_0xa3263b[_0x1c7121]['alias']||_0xf3a820);}if(_0x1c2419['joins']){_0x1c2419[_0xcc0a('0x7c')]=JSON['parse'](_0x1c2419['joins']);for(var _0x26224b=0x0;_0x26224b<_0x1c2419['joins'][_0xcc0a('0x36')];_0x26224b+=0x1){if(_0x1c2419[_0xcc0a('0x7c')][_0x26224b][_0xcc0a('0x41')]&&_[_0xcc0a('0x64')](_0x426f9b,_0x1c2419['joins'][_0x26224b][_0xcc0a('0x41')])&&_0x1c2419[_0xcc0a('0x7c')][_0x26224b][_0xcc0a('0x7e')]&&_0x1c2419[_0xcc0a('0x7c')][_0x26224b][_0xcc0a('0x7f')]&&_0x1c2419[_0xcc0a('0x7c')][_0x26224b][_0xcc0a('0x80')]){_0x462cd1[_0x1c2419[_0xcc0a('0x7c')][_0x26224b][_0xcc0a('0x41')]](_0x1c2419['joins'][_0x26224b]['foreignTable'],null,util[_0xcc0a('0x78')](_0xcc0a('0x81'),_0x1c2419['table'],_0x1c2419[_0xcc0a('0x7c')][_0x26224b][_0xcc0a('0x7e')],_0x1c2419[_0xcc0a('0x7c')][_0x26224b]['foreignTable'],_0x1c2419[_0xcc0a('0x7c')][_0x26224b][_0xcc0a('0x80')]));}}}if(_0x1c2419[_0xcc0a('0x82')]){_0x1c2419[_0xcc0a('0x82')]=JSON[_0xcc0a('0x7d')](_0x1c2419[_0xcc0a('0x82')]);_0x462cd1[_0xcc0a('0x3b')](_0x114ae8(_0x1c2419[_0xcc0a('0x82')]['group']));}_0x34be1c=_0x462cd1['clone']();_0x462cd1[_0xcc0a('0x38')](_0x1a9b6c);_0x462cd1[_0xcc0a('0x1c')](0x0);return;}})[_0xcc0a('0x23')](function(){if(_0x428f9f[_0xcc0a('0x8e')]===_0xcc0a('0x8f')){return null;}var _0x4276a1=_[_0xcc0a('0x3f')](_0x428f9f,{'name':_0x428f9f[_0xcc0a('0x90')]||_0x428f9f[_0xcc0a('0x29')]||_0x1c2419['name'],'basename':_0x1f75e4,'savename':util[_0xcc0a('0x78')]('%s-%s.%s',_0x428f9f[_0xcc0a('0x29')]||_0x1c2419[_0xcc0a('0x29')],require(_0xcc0a('0x91'))[_0xcc0a('0x92')](0x4),_0x428f9f[_0xcc0a('0x8e')]||_0xcc0a('0x93')),'reportId':_0x1c2419['id'],'reportType':_0xcc0a('0x94')});return db[_0xcc0a('0x95')][_0xcc0a('0x4c')](_0x4276a1,{'raw':!![]});})[_0xcc0a('0x23')](function(_0x4cf13d){if(_0x1c2419[_0xcc0a('0x73')]==='cdr'){_0x34be1c[_0xcc0a('0x3b')](_0x1c2419[_0xcc0a('0x73')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x428f9f[_0xcc0a('0x96')],_0x428f9f['endDate']);}else{_0x34be1c[_0xcc0a('0x3b')](_0x1c2419[_0xcc0a('0x73')]+_0xcc0a('0x97'),_0x428f9f[_0xcc0a('0x96')],_0x428f9f['endDate']);}if(_0x4cf13d){logger[_0xcc0a('0x98')](_0xcc0a('0x99'),_0x34be1c['toString']());require(_0xcc0a('0x9a'))[_0xcc0a('0x9b')](path[_0xcc0a('0x54')](__dirname,_0xcc0a('0x9c'),_0x4cf13d[_0xcc0a('0x8e')]),[_0x4cf13d['id'],_0x34be1c[_0xcc0a('0x85')](),path['join'](__dirname,_0xcc0a('0x9d'),_0x4cf13d['savename']),_0x1f75e4]);return _0x4cf13d;}else{var _0x472356=squel[_0xcc0a('0x71')]();_0x472356[_0xcc0a('0x72')]('('+_0x34be1c[_0xcc0a('0x85')]()+')',_0xcc0a('0x9e'));_0x472356[_0xcc0a('0x6b')]('COUNT(*)',_0xcc0a('0x1d'));_0x34be1c['limit'](_0x428f9f[_0xcc0a('0x38')]||_0x1a9b6c);_0x34be1c[_0xcc0a('0x1c')](_0x428f9f['offset']||0x0);return dbH[_0xcc0a('0x86')][_0xcc0a('0x31')](_0x472356['toString'](),{'type':dbH[_0xcc0a('0x86')][_0xcc0a('0x9f')][_0xcc0a('0x87')]})[_0xcc0a('0x23')](function(_0x218289){if(!_0x218289[_0xcc0a('0x36')]){_0x501428=0x0;}else{_0x501428=_0x218289[0x0][_0xcc0a('0x1d')]||0x0;}return dbH['sequelize'][_0xcc0a('0x31')](_0x34be1c[_0xcc0a('0x85')](),{'type':dbH[_0xcc0a('0x86')][_0xcc0a('0x9f')][_0xcc0a('0x87')]});})[_0xcc0a('0x23')](function(_0x42778e){return{'rows':_0x42778e||[],'count':_0x501428};});}});}exports[_0xcc0a('0xa0')]=function(_0x48f4b9,_0x525ec5){return runReport(_0x48f4b9[_0xcc0a('0x47')],_0x48f4b9[_0xcc0a('0x31')],_0x48f4b9[_0xcc0a('0x43')])[_0xcc0a('0x23')](respondWithResult(_0x525ec5,null))[_0xcc0a('0x4b')](handleError(_0x525ec5,null));};exports['runReport']=runReport;exports[_0xcc0a('0x31')]=function(_0x4a7952,_0x8a991a){var _0x42c962=0xa;var _0x20eebd=['join',_0xcc0a('0x55'),'right_join','cross_join'];var _0x517ecb={'SUM':_0xcc0a('0x58'),'COUNT':_0xcc0a('0x59'),'COUNT DISTINCT':_0xcc0a('0x88'),'MAX':_0xcc0a('0x5a'),'MIN':_0xcc0a('0x5b'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xcc0a('0x5d'),'GROUP_CONCAT ASC':_0xcc0a('0x5e'),'GROUP_CONCAT DESC':_0xcc0a('0x5f')};var _0x151371={'SEC_TO_TIME':_0xcc0a('0x60'),'DATE':_0xcc0a('0x61'),'HOUR':_0xcc0a('0x89'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x2ff6d2=function(_0x190351){return!_[_0xcc0a('0x64')]([_0xcc0a('0x65'),_0xcc0a('0x66'),_0xcc0a('0x67'),_0xcc0a('0x68')],_0x190351);};var _0x3efd22=function(_0x52774c){if(!_0x52774c||!_0x52774c[_0xcc0a('0x69')]['length']){return'';}for(var _0xda857d='(',_0x1612f4=0x0;_0x1612f4<_0x52774c[_0xcc0a('0x69')][_0xcc0a('0x36')];_0x1612f4+=0x1){_0x1612f4>0x0&&(_0xda857d+='\x20'+_0x52774c[_0xcc0a('0x8a')]+'\x20');_0xda857d+=_0x52774c['rules'][_0x1612f4]['group']?_0x3efd22(_0x52774c['rules'][_0x1612f4][_0xcc0a('0x6a')]):_0x52774c[_0xcc0a('0x69')][_0x1612f4][_0xcc0a('0x6b')]+'\x20'+_0x52774c[_0xcc0a('0x69')][_0x1612f4][_0xcc0a('0x6c')]+(_0x2ff6d2(_0x52774c[_0xcc0a('0x69')][_0x1612f4][_0xcc0a('0x6c')])?'\x20'+_0x52774c['rules'][_0x1612f4]['value']:'');}return _0xda857d+')';};var _0x1e7249={'where':{'id':_0x4a7952[_0xcc0a('0x47')]['id']}},_0x5446d8,_0x307d3e,_0x2fdc86,_0x3e3c2f,_0x332abd;_0x1e7249=_[_0xcc0a('0x3f')]({},_0x1e7249,_0x4a7952['options']);return db['AnalyticCustomReport'][_0xcc0a('0x4a')](_0x1e7249)[_0xcc0a('0x23')](function(_0x2b1468){if(_0x2b1468){_0x5446d8=_0x2b1468;return _0x2b1468['getFields']();}return null;})[_0xcc0a('0x23')](function(_0x11b29a){if(_0x11b29a){if(!_0x11b29a[_0xcc0a('0x36')]){throw new db[(_0xcc0a('0x8c'))][(_0xcc0a('0x6e'))](_0xcc0a('0x6f'),0x193);}_0x307d3e=_0x11b29a;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0xcc0a('0x23')](function(_0x592734){if(_0x592734){_0x2fdc86=_[_0xcc0a('0x8d')](_0x592734,'id');var _0x2bf625;var _0x368779=squel[_0xcc0a('0x71')]();_0x368779[_0xcc0a('0x72')](_0x5446d8[_0xcc0a('0x73')]);for(var _0x246cfd=0x0;_0x246cfd<_0x307d3e[_0xcc0a('0x36')];_0x246cfd+=0x1){_0x2bf625=_0x307d3e[_0x246cfd][_0xcc0a('0x74')]?_0x2fdc86[_0x307d3e[_0x246cfd][_0xcc0a('0x74')]]['metric']:_0x307d3e[_0x246cfd][_0xcc0a('0x6b')];_0x2bf625=_0x307d3e[_0x246cfd][_0xcc0a('0x76')]?_[_0xcc0a('0x77')](_0x517ecb[_0x307d3e[_0x246cfd][_0xcc0a('0x76')]],'%s',_0x2bf625):_0x2bf625;_0x2bf625=_0x307d3e[_0x246cfd][_0xcc0a('0x78')]?_[_0xcc0a('0x77')](_0x151371[_0x307d3e[_0x246cfd][_0xcc0a('0x78')]],'%s',_0x2bf625):_0x2bf625;if(_0x307d3e[_0x246cfd]['groupBy']){_0x368779[_0xcc0a('0x6a')](_0x2bf625);}_0x307d3e[_0x246cfd][_0xcc0a('0x79')]&&_0x368779['order'](_0x2bf625,_0x307d3e[_0x246cfd][_0xcc0a('0x79')]===_0xcc0a('0x7a')?![]:!![]);_0x368779[_0xcc0a('0x6b')](_0x2bf625,_0x307d3e[_0x246cfd][_0xcc0a('0x7b')]||_0x2bf625);}if(_0x5446d8[_0xcc0a('0x7c')]){_0x5446d8[_0xcc0a('0x7c')]=JSON[_0xcc0a('0x7d')](_0x5446d8[_0xcc0a('0x7c')]);for(var _0x5cd454=0x0;_0x5cd454<_0x5446d8[_0xcc0a('0x7c')]['length'];_0x5cd454+=0x1){if(_0x5446d8[_0xcc0a('0x7c')][_0x5cd454][_0xcc0a('0x41')]&&_[_0xcc0a('0x64')](_0x20eebd,_0x5446d8[_0xcc0a('0x7c')][_0x5cd454][_0xcc0a('0x41')])&&_0x5446d8[_0xcc0a('0x7c')][_0x5cd454][_0xcc0a('0x7e')]&&_0x5446d8[_0xcc0a('0x7c')][_0x5cd454][_0xcc0a('0x7f')]&&_0x5446d8[_0xcc0a('0x7c')][_0x5cd454]['foreignKey']){_0x368779[_0x5446d8['joins'][_0x5cd454][_0xcc0a('0x41')]](_0x5446d8[_0xcc0a('0x7c')][_0x5cd454][_0xcc0a('0x7f')],null,util[_0xcc0a('0x78')](_0xcc0a('0x81'),_0x5446d8[_0xcc0a('0x73')],_0x5446d8['joins'][_0x5cd454]['parentKey'],_0x5446d8[_0xcc0a('0x7c')][_0x5cd454][_0xcc0a('0x7f')],_0x5446d8[_0xcc0a('0x7c')][_0x5cd454][_0xcc0a('0x80')]));}}}if(_0x5446d8[_0xcc0a('0x82')]){_0x5446d8[_0xcc0a('0x82')]=JSON[_0xcc0a('0x7d')](_0x5446d8['conditions']);_0x368779[_0xcc0a('0x3b')](_0x3efd22(_0x5446d8[_0xcc0a('0x82')]['group']));}_0x332abd=_0x368779['clone']();_0x368779[_0xcc0a('0x38')](_0x42c962);_0x368779[_0xcc0a('0x1c')](0x0);logger[_0xcc0a('0x83')](_0xcc0a('0x84'),_0x368779[_0xcc0a('0x85')]());return dbH[_0xcc0a('0x86')]['query'](_0x368779[_0xcc0a('0x85')](),{'type':dbH[_0xcc0a('0x86')]['QueryTypes'][_0xcc0a('0x87')]});}})[_0xcc0a('0x23')](function(){return{'sql':_0x332abd[_0xcc0a('0x85')]()};})[_0xcc0a('0x23')](respondWithResult(_0x8a991a,null))['catch'](handleError(_0x8a991a,null));}; \ No newline at end of file +var _0x4034=['foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','sequelize','toString','QueryTypes','SELECT','join','cross_join','SUM(%s)','MIN(%s)','AVG(%s)','DATE(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','operator','MetricId','output','web','randomstring','generate','csv','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','../../components/export/','savename','COUNT(*)','run','runReport','GROUP_CONCAT(%s)','Sequelize','DESC','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','lodash','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','dbH','status','end','json','limit','undefined','count','Content-Range','reject','save','then','destroy','get','CustomReports','error','stack','name','send','index','map','AnalyticCustomReport','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','filter','where','VIRTUAL','merge','options','includeAll','catch','keys','rawAttributes','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','Reports','find','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','preview','left_join','right_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','HOUR(%s)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','group','field','condition','value','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','keyBy','select','from','table','metric','replace','function','format','groupBy','orderBy','alias','joins','parse','includes','parentKey'];(function(_0x1d994b,_0x400019){var _0x5af338=function(_0x549672){while(--_0x549672){_0x1d994b['push'](_0x1d994b['shift']());}};_0x5af338(++_0x400019);}(_0x4034,0x166));var _0x4403=function(_0x2b441f,_0x249bac){_0x2b441f=_0x2b441f-0x0;var _0x1cc771=_0x4034[_0x2b441f];return _0x1cc771;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4403('0x0'));var zipdir=require(_0x4403('0x1'));var jsonpatch=require(_0x4403('0x2'));var rp=require('request-promise');var moment=require(_0x4403('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x4403('0x4'));var util=require(_0x4403('0x5'));var path=require('path');var sox=require(_0x4403('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4403('0x7'));var squel=require('squel');var crypto=require(_0x4403('0x8'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4403('0x9'));var Redis=require(_0x4403('0xa'));var authService=require(_0x4403('0xb'));var qs=require(_0x4403('0xc'));var as=require(_0x4403('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4403('0xe'))(_0x4403('0xf'));var utils=require(_0x4403('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0x4403('0x11'));var db=require(_0x4403('0x12'))['db'];var dbH=require(_0x4403('0x12'))[_0x4403('0x13')];function respondWithStatusCode(_0x1309d8,_0x48ee68){_0x48ee68=_0x48ee68||0xcc;return function(_0x192dc8){if(_0x192dc8){return _0x1309d8['sendStatus'](_0x48ee68);}return _0x1309d8[_0x4403('0x14')](_0x48ee68)[_0x4403('0x15')]();};}function respondWithResult(_0x4f7d51,_0x712752){_0x712752=_0x712752||0xc8;return function(_0x23148e){if(_0x23148e){return _0x4f7d51[_0x4403('0x14')](_0x712752)[_0x4403('0x16')](_0x23148e);}};}function respondWithFilteredResult(_0x339b67,_0xee64a6){return function(_0x1086fb){if(_0x1086fb){var _0x1a247b=typeof _0xee64a6['offset']==='undefined'&&typeof _0xee64a6[_0x4403('0x17')]===_0x4403('0x18');var _0x5ed2dc=_0x1086fb[_0x4403('0x19')];var _0x2be877=_0x1a247b?0x0:_0xee64a6['offset'];var _0x57bd36=_0x1a247b?_0x1086fb[_0x4403('0x19')]:_0xee64a6['offset']+_0xee64a6[_0x4403('0x17')];var _0x275d33;if(_0x57bd36>=_0x5ed2dc){_0x57bd36=_0x5ed2dc;_0x275d33=0xc8;}else{_0x275d33=0xce;}_0x339b67[_0x4403('0x14')](_0x275d33);return _0x339b67['set'](_0x4403('0x1a'),_0x2be877+'-'+_0x57bd36+'/'+_0x5ed2dc)[_0x4403('0x16')](_0x1086fb);}return null;};}function patchUpdates(_0x4d5fda){return function(_0x3d615b){try{jsonpatch['apply'](_0x3d615b,_0x4d5fda,!![]);}catch(_0x3f4b0b){return BPromise[_0x4403('0x1b')](_0x3f4b0b);}return _0x3d615b[_0x4403('0x1c')]();};}function saveUpdates(_0x11f975,_0x2f7809){return function(_0x22f964){if(_0x22f964){return _0x22f964['update'](_0x11f975)[_0x4403('0x1d')](function(_0x34a5e9){return _0x34a5e9;});}return null;};}function removeEntity(_0x2f8f91,_0x1c549a){return function(_0x132cf3){if(_0x132cf3){return _0x132cf3[_0x4403('0x1e')]()['then'](function(){var _0x5e4e60=_0x132cf3[_0x4403('0x1f')]({'plain':!![]});var _0x468db5=_0x4403('0x20');return db['UserProfileResource'][_0x4403('0x1e')]({'where':{'type':_0x468db5,'resourceId':_0x5e4e60['id']}})['then'](function(){return _0x132cf3;});})['then'](function(){_0x2f8f91['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4ef7a6,_0x3d6c96){return function(_0x5998c6){if(!_0x5998c6){_0x4ef7a6['sendStatus'](0x194);}return _0x5998c6;};}function handleError(_0x4b2fe8,_0x24b8a5){_0x24b8a5=_0x24b8a5||0x1f4;return function(_0xf5a7f){logger[_0x4403('0x21')](_0xf5a7f[_0x4403('0x22')]);if(_0xf5a7f['name']){delete _0xf5a7f[_0x4403('0x23')];}_0x4b2fe8[_0x4403('0x14')](_0x24b8a5)[_0x4403('0x24')](_0xf5a7f);};}exports[_0x4403('0x25')]=function(_0x3edc56,_0x511eb6){var _0x4f7424={},_0x121a5c={},_0x104203={'count':0x0,'rows':[]};var _0x398ef0=_[_0x4403('0x26')](db[_0x4403('0x27')]['rawAttributes'],function(_0x5ec6a9){return{'name':_0x5ec6a9['fieldName'],'type':_0x5ec6a9[_0x4403('0x28')][_0x4403('0x29')]};});_0x121a5c[_0x4403('0x2a')]=_[_0x4403('0x26')](_0x398ef0,'name');_0x121a5c[_0x4403('0x2b')]=_['keys'](_0x3edc56[_0x4403('0x2b')]);_0x121a5c[_0x4403('0x2c')]=_[_0x4403('0x2d')](_0x121a5c[_0x4403('0x2a')],_0x121a5c[_0x4403('0x2b')]);_0x4f7424[_0x4403('0x2e')]=_['intersection'](_0x121a5c[_0x4403('0x2a')],qs[_0x4403('0x2f')](_0x3edc56[_0x4403('0x2b')][_0x4403('0x2f')]));_0x4f7424[_0x4403('0x2e')]=_0x4f7424['attributes'][_0x4403('0x30')]?_0x4f7424[_0x4403('0x2e')]:_0x121a5c[_0x4403('0x2a')];if(!_0x3edc56[_0x4403('0x2b')][_0x4403('0x31')](_0x4403('0x32'))){_0x4f7424[_0x4403('0x17')]=qs[_0x4403('0x17')](_0x3edc56['query'][_0x4403('0x17')]);_0x4f7424['offset']=qs[_0x4403('0x33')](_0x3edc56[_0x4403('0x2b')]['offset']);}_0x4f7424[_0x4403('0x34')]=qs[_0x4403('0x35')](_0x3edc56[_0x4403('0x2b')][_0x4403('0x35')]);_0x4f7424['where']=qs[_0x4403('0x2c')](_['pick'](_0x3edc56[_0x4403('0x2b')],_0x121a5c['filters']),_0x398ef0);if(_0x3edc56[_0x4403('0x2b')][_0x4403('0x36')]){_0x4f7424[_0x4403('0x37')]=_['merge'](_0x4f7424[_0x4403('0x37')],{'$or':_[_0x4403('0x26')](_0x398ef0,function(_0x2117b3){if(_0x2117b3[_0x4403('0x28')]!==_0x4403('0x38')){var _0x4d5b32={};_0x4d5b32[_0x2117b3[_0x4403('0x23')]]={'$like':'%'+_0x3edc56[_0x4403('0x2b')][_0x4403('0x36')]+'%'};return _0x4d5b32;}})});}_0x4f7424=_[_0x4403('0x39')]({},_0x4f7424,_0x3edc56[_0x4403('0x3a')]);var _0x51ce1b={'where':_0x4f7424[_0x4403('0x37')]};return db[_0x4403('0x27')][_0x4403('0x19')](_0x51ce1b)['then'](function(_0x574b28){_0x104203[_0x4403('0x19')]=_0x574b28;if(_0x3edc56[_0x4403('0x2b')][_0x4403('0x3b')]){_0x4f7424['include']=[{'all':!![]}];}return db['AnalyticCustomReport']['findAll'](_0x4f7424);})[_0x4403('0x1d')](function(_0x5d907d){_0x104203['rows']=_0x5d907d;return _0x104203;})[_0x4403('0x1d')](respondWithFilteredResult(_0x511eb6,_0x4f7424))[_0x4403('0x3c')](handleError(_0x511eb6,null));};exports['show']=function(_0x4d3b30,_0x17871c){var _0x9cecb5={'raw':![],'where':{'id':_0x4d3b30['params']['id']}},_0x245f4e={};_0x245f4e[_0x4403('0x2a')]=_[_0x4403('0x3d')](db[_0x4403('0x27')][_0x4403('0x3e')]);_0x245f4e[_0x4403('0x2b')]=_[_0x4403('0x3d')](_0x4d3b30['query']);_0x245f4e[_0x4403('0x2c')]=_['intersection'](_0x245f4e[_0x4403('0x2a')],_0x245f4e['query']);_0x9cecb5[_0x4403('0x2e')]=_[_0x4403('0x2d')](_0x245f4e[_0x4403('0x2a')],qs[_0x4403('0x2f')](_0x4d3b30[_0x4403('0x2b')][_0x4403('0x2f')]));_0x9cecb5['attributes']=_0x9cecb5[_0x4403('0x2e')][_0x4403('0x30')]?_0x9cecb5[_0x4403('0x2e')]:_0x245f4e[_0x4403('0x2a')];if(_0x4d3b30[_0x4403('0x2b')]['includeAll']){_0x9cecb5['include']=[{'all':!![]}];}_0x9cecb5=_['merge']({},_0x9cecb5,_0x4d3b30[_0x4403('0x3a')]);return db[_0x4403('0x27')]['find'](_0x9cecb5)[_0x4403('0x1d')](handleEntityNotFound(_0x17871c,null))[_0x4403('0x1d')](respondWithResult(_0x17871c,null))['catch'](handleError(_0x17871c,null));};exports[_0x4403('0x3f')]=function(_0x448845,_0x9cbcf7){return db['AnalyticCustomReport'][_0x4403('0x3f')](_0x448845[_0x4403('0x40')],{})[_0x4403('0x1d')](function(_0x244d3b){var _0x392972=_0x448845['user']['get']({'plain':!![]});if(!_0x392972)throw new Error(_0x4403('0x41'));if(_0x392972['role']===_0x4403('0x42')){var _0x2fa8a1=_0x244d3b[_0x4403('0x1f')]({'plain':!![]});var _0x102bc4=_0x4403('0x43');return db['UserProfileSection'][_0x4403('0x44')]({'where':{'name':_0x102bc4,'userProfileId':_0x392972['userProfileId']},'raw':!![]})[_0x4403('0x1d')](function(_0x1c0694){if(_0x1c0694&&_0x1c0694[_0x4403('0x45')]===0x0){return db[_0x4403('0x46')][_0x4403('0x3f')]({'name':_0x2fa8a1[_0x4403('0x23')],'resourceId':_0x2fa8a1['id'],'type':_0x4403('0x20'),'sectionId':_0x1c0694['id']},{})[_0x4403('0x1d')](function(){return _0x244d3b;});}else{return _0x244d3b;}})[_0x4403('0x3c')](function(_0x3138a3){logger[_0x4403('0x21')](_0x4403('0x47'),_0x3138a3);throw _0x3138a3;});}return _0x244d3b;})[_0x4403('0x1d')](respondWithResult(_0x9cbcf7,0xc9))['catch'](handleError(_0x9cbcf7,null));};exports[_0x4403('0x48')]=function(_0x1e28eb,_0x243619){if(_0x1e28eb[_0x4403('0x40')]['id']){delete _0x1e28eb[_0x4403('0x40')]['id'];}return db[_0x4403('0x27')][_0x4403('0x44')]({'where':{'id':_0x1e28eb['params']['id']}})[_0x4403('0x1d')](handleEntityNotFound(_0x243619,null))[_0x4403('0x1d')](saveUpdates(_0x1e28eb[_0x4403('0x40')],null))[_0x4403('0x1d')](respondWithResult(_0x243619,null))[_0x4403('0x3c')](handleError(_0x243619,null));};exports[_0x4403('0x1e')]=function(_0x181e47,_0x13f0bf){return db[_0x4403('0x27')]['find']({'where':{'id':_0x181e47[_0x4403('0x49')]['id']}})[_0x4403('0x1d')](handleEntityNotFound(_0x13f0bf,null))[_0x4403('0x1d')](removeEntity(_0x13f0bf,null))[_0x4403('0x3c')](handleError(_0x13f0bf,null));};exports[_0x4403('0x4a')]=function(_0x14453d,_0x38703c){var _0x47fa7b=0xa;var _0xc80a2c=['join',_0x4403('0x4b'),_0x4403('0x4c'),'cross_join'];var _0x907316={'SUM':'SUM(%s)','COUNT':_0x4403('0x4d'),'COUNT DISTINCT':_0x4403('0x4e'),'MAX':_0x4403('0x4f'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x4403('0x50'),'GROUP_CONCAT DESC':_0x4403('0x51')};var _0x597cf2={'SEC_TO_TIME':_0x4403('0x52'),'DATE':'DATE(%s)','HOUR':_0x4403('0x53'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x1d3620=function(_0x253212){return!_['includes']([_0x4403('0x54'),_0x4403('0x55'),_0x4403('0x56'),_0x4403('0x57')],_0x253212);};var _0x4935a9=function(_0x83973b){if(!_0x83973b||!_0x83973b[_0x4403('0x58')]['length']){return'';}for(var _0x3343ab='(',_0xec83d6=0x0;_0xec83d6<_0x83973b['rules'][_0x4403('0x30')];_0xec83d6+=0x1){_0xec83d6>0x0&&(_0x3343ab+='\x20'+_0x83973b['operator']+'\x20');_0x3343ab+=_0x83973b[_0x4403('0x58')][_0xec83d6][_0x4403('0x59')]?_0x4935a9(_0x83973b['rules'][_0xec83d6][_0x4403('0x59')]):_0x83973b[_0x4403('0x58')][_0xec83d6][_0x4403('0x5a')]+'\x20'+_0x83973b[_0x4403('0x58')][_0xec83d6]['condition']+(_0x1d3620(_0x83973b[_0x4403('0x58')][_0xec83d6][_0x4403('0x5b')])?'\x20'+_0x83973b['rules'][_0xec83d6][_0x4403('0x5c')]:'');}return _0x3343ab+')';};var _0x5c9d7c={'where':{'id':_0x14453d[_0x4403('0x49')]['id']}},_0x19b872,_0x1d571f,_0x43305a,_0x38428d,_0x1ed127;_0x5c9d7c=_[_0x4403('0x39')]({},_0x5c9d7c,_0x14453d[_0x4403('0x3a')]);return db['AnalyticCustomReport'][_0x4403('0x44')](_0x5c9d7c)[_0x4403('0x1d')](function(_0x4b80f1){if(_0x4b80f1){_0x19b872=_0x4b80f1;return _0x4b80f1[_0x4403('0x5d')]();}return null;})[_0x4403('0x1d')](function(_0x205710){if(_0x205710){if(!_0x205710[_0x4403('0x30')]){throw new db['Sequelize'][(_0x4403('0x5e'))](_0x4403('0x5f'),0x193);}_0x1d571f=_0x205710;return db[_0x4403('0x60')][_0x4403('0x61')]({'raw':!![]});}return null;})['then'](function(_0x3bf115){if(_0x3bf115){_0x43305a=_[_0x4403('0x62')](_0x3bf115,'id');var _0x28f28f;var _0x58b3fc=squel[_0x4403('0x63')]();_0x58b3fc[_0x4403('0x64')](_0x19b872[_0x4403('0x65')]);for(var _0x47e14c=0x0;_0x47e14c<_0x1d571f[_0x4403('0x30')];_0x47e14c+=0x1){_0x28f28f=_0x1d571f[_0x47e14c]['MetricId']?_0x43305a[_0x1d571f[_0x47e14c]['MetricId']][_0x4403('0x66')]:_0x1d571f[_0x47e14c][_0x4403('0x5a')];_0x28f28f=_0x1d571f[_0x47e14c]['function']?_[_0x4403('0x67')](_0x907316[_0x1d571f[_0x47e14c][_0x4403('0x68')]],'%s',_0x28f28f):_0x28f28f;_0x28f28f=_0x1d571f[_0x47e14c][_0x4403('0x69')]?_[_0x4403('0x67')](_0x597cf2[_0x1d571f[_0x47e14c][_0x4403('0x69')]],'%s',_0x28f28f):_0x28f28f;if(_0x1d571f[_0x47e14c][_0x4403('0x6a')]){_0x58b3fc[_0x4403('0x59')](_0x28f28f);}_0x1d571f[_0x47e14c][_0x4403('0x6b')]&&_0x58b3fc['order'](_0x28f28f,_0x1d571f[_0x47e14c]['orderBy']==='DESC'?![]:!![]);_0x58b3fc[_0x4403('0x5a')](_0x28f28f,_0x1d571f[_0x47e14c][_0x4403('0x6c')]||_0x28f28f);}if(_0x19b872[_0x4403('0x6d')]){_0x19b872['joins']=JSON[_0x4403('0x6e')](_0x19b872[_0x4403('0x6d')]);for(var _0x58688f=0x0;_0x58688f<_0x19b872[_0x4403('0x6d')][_0x4403('0x30')];_0x58688f+=0x1){if(_0x19b872['joins'][_0x58688f][_0x4403('0x28')]&&_[_0x4403('0x6f')](_0xc80a2c,_0x19b872[_0x4403('0x6d')][_0x58688f]['type'])&&_0x19b872[_0x4403('0x6d')][_0x58688f][_0x4403('0x70')]&&_0x19b872[_0x4403('0x6d')][_0x58688f][_0x4403('0x71')]&&_0x19b872['joins'][_0x58688f][_0x4403('0x72')]){_0x58b3fc[_0x19b872[_0x4403('0x6d')][_0x58688f][_0x4403('0x28')]](_0x19b872['joins'][_0x58688f][_0x4403('0x71')],null,util[_0x4403('0x69')](_0x4403('0x73'),_0x19b872[_0x4403('0x65')],_0x19b872[_0x4403('0x6d')][_0x58688f][_0x4403('0x70')],_0x19b872[_0x4403('0x6d')][_0x58688f][_0x4403('0x71')],_0x19b872[_0x4403('0x6d')][_0x58688f][_0x4403('0x72')]));}}}if(_0x19b872[_0x4403('0x74')]){_0x19b872[_0x4403('0x74')]=JSON[_0x4403('0x6e')](_0x19b872[_0x4403('0x74')]);_0x58b3fc[_0x4403('0x37')](_0x4935a9(_0x19b872[_0x4403('0x74')][_0x4403('0x59')]));}_0x1ed127=_0x58b3fc[_0x4403('0x75')]();_0x58b3fc['limit'](_0x47fa7b);_0x58b3fc[_0x4403('0x33')](0x0);logger[_0x4403('0x76')](_0x4403('0x77'),_0x58b3fc['toString']());return dbH[_0x4403('0x78')][_0x4403('0x2b')](_0x58b3fc[_0x4403('0x79')](),{'type':dbH['sequelize'][_0x4403('0x7a')][_0x4403('0x7b')]});}})[_0x4403('0x1d')](respondWithResult(_0x38703c,null))[_0x4403('0x3c')](handleError(_0x38703c,null));};function runReport(_0x3a8bd7,_0x19101a,_0x1f2ba0){var _0x219810=_0x19101a['name'];var _0x401478=0xa;var _0x4abcf8=[_0x4403('0x7c'),'left_join','right_join',_0x4403('0x7d')];var _0x318132={'SUM':_0x4403('0x7e'),'COUNT':_0x4403('0x4d'),'COUNT DISTINCT':_0x4403('0x4e'),'MAX':_0x4403('0x4f'),'MIN':_0x4403('0x7f'),'AVG':_0x4403('0x80'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x4403('0x50'),'GROUP_CONCAT DESC':_0x4403('0x51')};var _0x25b6c5={'SEC_TO_TIME':_0x4403('0x52'),'DATE':_0x4403('0x81'),'HOUR':_0x4403('0x53'),'ROUND':_0x4403('0x82'),'UNIX_TIMESTAMP':_0x4403('0x83')};var _0x569501=function(_0x54226a){return!_[_0x4403('0x6f')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x4403('0x56'),_0x4403('0x57')],_0x54226a);};var _0x535a26=function(_0x37ce6b){if(!_0x37ce6b||!_0x37ce6b[_0x4403('0x58')][_0x4403('0x30')]){return'';}for(var _0x426ad8='(',_0x566e3a=0x0;_0x566e3a<_0x37ce6b['rules'][_0x4403('0x30')];_0x566e3a+=0x1){_0x566e3a>0x0&&(_0x426ad8+='\x20'+_0x37ce6b[_0x4403('0x84')]+'\x20');_0x426ad8+=_0x37ce6b[_0x4403('0x58')][_0x566e3a]['group']?_0x535a26(_0x37ce6b['rules'][_0x566e3a][_0x4403('0x59')]):_0x37ce6b[_0x4403('0x58')][_0x566e3a][_0x4403('0x5a')]+'\x20'+_0x37ce6b[_0x4403('0x58')][_0x566e3a][_0x4403('0x5b')]+(_0x569501(_0x37ce6b['rules'][_0x566e3a][_0x4403('0x5b')])?'\x20'+_0x37ce6b[_0x4403('0x58')][_0x566e3a]['value']:'');}return _0x426ad8+')';};var _0x194276={'where':{'id':_0x3a8bd7['id']}},_0x11165c,_0x15f8e0,_0x18cb29,_0x5ee8db,_0x4a430c;_0x194276=_[_0x4403('0x39')]({},_0x194276,_0x1f2ba0);return db['AnalyticCustomReport'][_0x4403('0x44')](_0x194276)[_0x4403('0x1d')](function(_0x2d345a){if(_0x2d345a){_0x11165c=_0x2d345a;return _0x2d345a[_0x4403('0x5d')]();}return null;})['then'](function(_0x11d125){if(_0x11d125){if(!_0x11d125[_0x4403('0x30')]){throw new db['Sequelize'][(_0x4403('0x5e'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x15f8e0=_0x11d125;return db[_0x4403('0x60')][_0x4403('0x61')]({'raw':!![]});}return null;})['then'](function(_0x551e2d){if(_0x551e2d){_0x18cb29=_['keyBy'](_0x551e2d,'id');var _0x1da879;var _0x540211=squel[_0x4403('0x63')]();_0x540211[_0x4403('0x64')](_0x11165c[_0x4403('0x65')]);for(var _0x827bd9=0x0;_0x827bd9<_0x15f8e0[_0x4403('0x30')];_0x827bd9+=0x1){_0x1da879=_0x15f8e0[_0x827bd9][_0x4403('0x85')]?_0x18cb29[_0x15f8e0[_0x827bd9]['MetricId']][_0x4403('0x66')]:_0x15f8e0[_0x827bd9]['field'];_0x1da879=_0x15f8e0[_0x827bd9][_0x4403('0x68')]?_[_0x4403('0x67')](_0x318132[_0x15f8e0[_0x827bd9][_0x4403('0x68')]],'%s',_0x1da879):_0x1da879;_0x1da879=_0x15f8e0[_0x827bd9][_0x4403('0x69')]?_[_0x4403('0x67')](_0x25b6c5[_0x15f8e0[_0x827bd9][_0x4403('0x69')]],'%s',_0x1da879):_0x1da879;if(_0x15f8e0[_0x827bd9]['groupBy']){_0x540211[_0x4403('0x59')](_0x1da879);}_0x15f8e0[_0x827bd9][_0x4403('0x6b')]&&_0x540211[_0x4403('0x34')](_0x1da879,_0x15f8e0[_0x827bd9]['orderBy']==='DESC'?![]:!![]);_0x540211[_0x4403('0x5a')](_0x1da879,_0x15f8e0[_0x827bd9][_0x4403('0x6c')]||_0x1da879);}if(_0x11165c[_0x4403('0x6d')]){_0x11165c[_0x4403('0x6d')]=JSON[_0x4403('0x6e')](_0x11165c[_0x4403('0x6d')]);for(var _0x2255cb=0x0;_0x2255cb<_0x11165c['joins'][_0x4403('0x30')];_0x2255cb+=0x1){if(_0x11165c['joins'][_0x2255cb][_0x4403('0x28')]&&_[_0x4403('0x6f')](_0x4abcf8,_0x11165c['joins'][_0x2255cb][_0x4403('0x28')])&&_0x11165c[_0x4403('0x6d')][_0x2255cb]['parentKey']&&_0x11165c['joins'][_0x2255cb]['foreignTable']&&_0x11165c[_0x4403('0x6d')][_0x2255cb]['foreignKey']){_0x540211[_0x11165c[_0x4403('0x6d')][_0x2255cb][_0x4403('0x28')]](_0x11165c[_0x4403('0x6d')][_0x2255cb][_0x4403('0x71')],null,util[_0x4403('0x69')]('%s.%s\x20=\x20%s.%s',_0x11165c[_0x4403('0x65')],_0x11165c[_0x4403('0x6d')][_0x2255cb][_0x4403('0x70')],_0x11165c[_0x4403('0x6d')][_0x2255cb]['foreignTable'],_0x11165c[_0x4403('0x6d')][_0x2255cb]['foreignKey']));}}}if(_0x11165c[_0x4403('0x74')]){_0x11165c['conditions']=JSON['parse'](_0x11165c[_0x4403('0x74')]);_0x540211[_0x4403('0x37')](_0x535a26(_0x11165c['conditions'][_0x4403('0x59')]));}_0x4a430c=_0x540211[_0x4403('0x75')]();_0x540211['limit'](_0x401478);_0x540211['offset'](0x0);return;}})[_0x4403('0x1d')](function(){if(_0x19101a[_0x4403('0x86')]===_0x4403('0x87')){return null;}var _0x3cc0ac=_['merge'](_0x19101a,{'name':_0x19101a['fullPath']||_0x19101a[_0x4403('0x23')]||_0x11165c[_0x4403('0x23')],'basename':_0x219810,'savename':util[_0x4403('0x69')]('%s-%s.%s',_0x19101a[_0x4403('0x23')]||_0x11165c['name'],require(_0x4403('0x88'))[_0x4403('0x89')](0x4),_0x19101a[_0x4403('0x86')]||_0x4403('0x8a')),'reportId':_0x11165c['id'],'reportType':_0x4403('0x8b')});return db[_0x4403('0x8c')][_0x4403('0x3f')](_0x3cc0ac,{'raw':!![]});})[_0x4403('0x1d')](function(_0x52e0ad){if(_0x11165c['table']===_0x4403('0x8d')){_0x4a430c[_0x4403('0x37')](_0x11165c[_0x4403('0x65')]+_0x4403('0x8e'),_0x19101a[_0x4403('0x8f')],_0x19101a[_0x4403('0x90')]);}else{_0x4a430c['where'](_0x11165c[_0x4403('0x65')]+_0x4403('0x91'),_0x19101a[_0x4403('0x8f')],_0x19101a[_0x4403('0x90')]);}if(_0x52e0ad){logger[_0x4403('0x92')](_0x4403('0x93'),_0x4a430c[_0x4403('0x79')]());require(_0x4403('0x94'))['fork'](path['join'](__dirname,_0x4403('0x95'),_0x52e0ad['output']),[_0x52e0ad['id'],_0x4a430c[_0x4403('0x79')](),path[_0x4403('0x7c')](__dirname,'../../files/reports',_0x52e0ad[_0x4403('0x96')]),_0x219810]);return _0x52e0ad;}else{var _0x397b09=squel[_0x4403('0x63')]();_0x397b09[_0x4403('0x64')]('('+_0x4a430c[_0x4403('0x79')]()+')','countTable');_0x397b09['field'](_0x4403('0x97'),_0x4403('0x19'));_0x4a430c[_0x4403('0x17')](_0x19101a[_0x4403('0x17')]||_0x401478);_0x4a430c[_0x4403('0x33')](_0x19101a[_0x4403('0x33')]||0x0);return dbH[_0x4403('0x78')]['query'](_0x397b09['toString'](),{'type':dbH[_0x4403('0x78')][_0x4403('0x7a')][_0x4403('0x7b')]})[_0x4403('0x1d')](function(_0x514d93){if(!_0x514d93[_0x4403('0x30')]){_0x5ee8db=0x0;}else{_0x5ee8db=_0x514d93[0x0][_0x4403('0x19')]||0x0;}return dbH[_0x4403('0x78')][_0x4403('0x2b')](_0x4a430c[_0x4403('0x79')](),{'type':dbH[_0x4403('0x78')][_0x4403('0x7a')][_0x4403('0x7b')]});})[_0x4403('0x1d')](function(_0x121bd6){return{'rows':_0x121bd6||[],'count':_0x5ee8db};});}});}exports[_0x4403('0x98')]=function(_0x5e04e2,_0x3d3383){return runReport(_0x5e04e2[_0x4403('0x49')],_0x5e04e2['query'],_0x5e04e2[_0x4403('0x3a')])[_0x4403('0x1d')](respondWithResult(_0x3d3383,null))[_0x4403('0x3c')](handleError(_0x3d3383,null));};exports[_0x4403('0x99')]=runReport;exports[_0x4403('0x2b')]=function(_0x128e11,_0x4877e1){var _0x15f58b=0xa;var _0x4750c1=[_0x4403('0x7c'),_0x4403('0x4b'),_0x4403('0x4c'),'cross_join'];var _0x2d2ac3={'SUM':_0x4403('0x7e'),'COUNT':_0x4403('0x4d'),'COUNT DISTINCT':_0x4403('0x4e'),'MAX':_0x4403('0x4f'),'MIN':_0x4403('0x7f'),'AVG':_0x4403('0x80'),'GROUP_CONCAT':_0x4403('0x9a'),'GROUP_CONCAT ASC':_0x4403('0x50'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x1ba103={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x4403('0x81'),'HOUR':_0x4403('0x53'),'ROUND':_0x4403('0x82'),'UNIX_TIMESTAMP':_0x4403('0x83')};var _0x1dcb23=function(_0x25409b){return!_['includes']([_0x4403('0x54'),_0x4403('0x55'),'IS\x20EMPTY',_0x4403('0x57')],_0x25409b);};var _0x3ee747=function(_0x5be49c){if(!_0x5be49c||!_0x5be49c['rules'][_0x4403('0x30')]){return'';}for(var _0x5ee784='(',_0x313bc6=0x0;_0x313bc6<_0x5be49c['rules'][_0x4403('0x30')];_0x313bc6+=0x1){_0x313bc6>0x0&&(_0x5ee784+='\x20'+_0x5be49c[_0x4403('0x84')]+'\x20');_0x5ee784+=_0x5be49c['rules'][_0x313bc6][_0x4403('0x59')]?_0x3ee747(_0x5be49c[_0x4403('0x58')][_0x313bc6][_0x4403('0x59')]):_0x5be49c['rules'][_0x313bc6][_0x4403('0x5a')]+'\x20'+_0x5be49c[_0x4403('0x58')][_0x313bc6][_0x4403('0x5b')]+(_0x1dcb23(_0x5be49c[_0x4403('0x58')][_0x313bc6]['condition'])?'\x20'+_0x5be49c['rules'][_0x313bc6][_0x4403('0x5c')]:'');}return _0x5ee784+')';};var _0x50fa45={'where':{'id':_0x128e11[_0x4403('0x49')]['id']}},_0x16d70f,_0x1e690b,_0x1d41b0,_0x17a322,_0x1054af;_0x50fa45=_[_0x4403('0x39')]({},_0x50fa45,_0x128e11[_0x4403('0x3a')]);return db['AnalyticCustomReport']['find'](_0x50fa45)['then'](function(_0x1458e2){if(_0x1458e2){_0x16d70f=_0x1458e2;return _0x1458e2['getFields']();}return null;})[_0x4403('0x1d')](function(_0x2c4734){if(_0x2c4734){if(!_0x2c4734[_0x4403('0x30')]){throw new db[(_0x4403('0x9b'))]['ValidationErrorItem'](_0x4403('0x5f'),0x193);}_0x1e690b=_0x2c4734;return db[_0x4403('0x60')][_0x4403('0x61')]({'raw':!![]});}return null;})[_0x4403('0x1d')](function(_0x3523cd){if(_0x3523cd){_0x1d41b0=_['keyBy'](_0x3523cd,'id');var _0x15ca76;var _0x355ad7=squel[_0x4403('0x63')]();_0x355ad7[_0x4403('0x64')](_0x16d70f[_0x4403('0x65')]);for(var _0x4fe8a5=0x0;_0x4fe8a5<_0x1e690b[_0x4403('0x30')];_0x4fe8a5+=0x1){_0x15ca76=_0x1e690b[_0x4fe8a5][_0x4403('0x85')]?_0x1d41b0[_0x1e690b[_0x4fe8a5][_0x4403('0x85')]][_0x4403('0x66')]:_0x1e690b[_0x4fe8a5]['field'];_0x15ca76=_0x1e690b[_0x4fe8a5]['function']?_[_0x4403('0x67')](_0x2d2ac3[_0x1e690b[_0x4fe8a5][_0x4403('0x68')]],'%s',_0x15ca76):_0x15ca76;_0x15ca76=_0x1e690b[_0x4fe8a5][_0x4403('0x69')]?_[_0x4403('0x67')](_0x1ba103[_0x1e690b[_0x4fe8a5]['format']],'%s',_0x15ca76):_0x15ca76;if(_0x1e690b[_0x4fe8a5][_0x4403('0x6a')]){_0x355ad7[_0x4403('0x59')](_0x15ca76);}_0x1e690b[_0x4fe8a5][_0x4403('0x6b')]&&_0x355ad7[_0x4403('0x34')](_0x15ca76,_0x1e690b[_0x4fe8a5][_0x4403('0x6b')]===_0x4403('0x9c')?![]:!![]);_0x355ad7[_0x4403('0x5a')](_0x15ca76,_0x1e690b[_0x4fe8a5]['alias']||_0x15ca76);}if(_0x16d70f[_0x4403('0x6d')]){_0x16d70f[_0x4403('0x6d')]=JSON[_0x4403('0x6e')](_0x16d70f[_0x4403('0x6d')]);for(var _0x3c2c93=0x0;_0x3c2c93<_0x16d70f[_0x4403('0x6d')][_0x4403('0x30')];_0x3c2c93+=0x1){if(_0x16d70f['joins'][_0x3c2c93]['type']&&_[_0x4403('0x6f')](_0x4750c1,_0x16d70f['joins'][_0x3c2c93][_0x4403('0x28')])&&_0x16d70f[_0x4403('0x6d')][_0x3c2c93][_0x4403('0x70')]&&_0x16d70f[_0x4403('0x6d')][_0x3c2c93][_0x4403('0x71')]&&_0x16d70f[_0x4403('0x6d')][_0x3c2c93][_0x4403('0x72')]){_0x355ad7[_0x16d70f[_0x4403('0x6d')][_0x3c2c93][_0x4403('0x28')]](_0x16d70f['joins'][_0x3c2c93][_0x4403('0x71')],null,util[_0x4403('0x69')]('%s.%s\x20=\x20%s.%s',_0x16d70f[_0x4403('0x65')],_0x16d70f[_0x4403('0x6d')][_0x3c2c93]['parentKey'],_0x16d70f['joins'][_0x3c2c93][_0x4403('0x71')],_0x16d70f[_0x4403('0x6d')][_0x3c2c93]['foreignKey']));}}}if(_0x16d70f[_0x4403('0x74')]){_0x16d70f[_0x4403('0x74')]=JSON[_0x4403('0x6e')](_0x16d70f[_0x4403('0x74')]);_0x355ad7['where'](_0x3ee747(_0x16d70f[_0x4403('0x74')]['group']));}_0x1054af=_0x355ad7['clone']();_0x355ad7[_0x4403('0x17')](_0x15f58b);_0x355ad7[_0x4403('0x33')](0x0);logger[_0x4403('0x76')](_0x4403('0x77'),_0x355ad7[_0x4403('0x79')]());return dbH['sequelize'][_0x4403('0x2b')](_0x355ad7[_0x4403('0x79')](),{'type':dbH['sequelize'][_0x4403('0x7a')][_0x4403('0x7b')]});}})[_0x4403('0x1d')](function(){return{'sql':_0x1054af[_0x4403('0x79')]()};})['then'](respondWithResult(_0x4877e1,null))[_0x4403('0x3c')](handleError(_0x4877e1,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 2484517..95feeb1 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 _0x3855=['path','rimraf','./analyticCustomReport.attributes','analytics_custom_reports','lodash','util','api','moment','bluebird','request-promise'];(function(_0x1df0a9,_0xc0d944){var _0x13238e=function(_0x12db5c){while(--_0x12db5c){_0x1df0a9['push'](_0x1df0a9['shift']());}};_0x13238e(++_0xc0d944);}(_0x3855,0xea));var _0x5385=function(_0x186b4c,_0x376b66){_0x186b4c=_0x186b4c-0x0;var _0x48346b=_0x3855[_0x186b4c];return _0x48346b;};'use strict';var _=require(_0x5385('0x0'));var util=require(_0x5385('0x1'));var logger=require('../../config/logger')(_0x5385('0x2'));var moment=require(_0x5385('0x3'));var BPromise=require(_0x5385('0x4'));var rp=require(_0x5385('0x5'));var fs=require('fs');var path=require(_0x5385('0x6'));var rimraf=require(_0x5385('0x7'));var config=require('../../config/environment');var attributes=require(_0x5385('0x8'));module['exports']=function(_0x1e15c3,_0x58f0e1){return _0x1e15c3['define']('AnalyticCustomReport',attributes,{'tableName':_0x5385('0x9'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa4ef=['bluebird','request-promise','exports','define','AnalyticCustomReport','lodash','util','api'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0xa4ef,0x9d));var _0xfa4e=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xa4ef[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0xfa4e('0x0'));var util=require(_0xfa4e('0x1'));var logger=require('../../config/logger')(_0xfa4e('0x2'));var moment=require('moment');var BPromise=require(_0xfa4e('0x3'));var rp=require(_0xfa4e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./analyticCustomReport.attributes');module[_0xfa4e('0x5')]=function(_0x8481c2,_0x406fd6){return _0x8481c2[_0xfa4e('0x6')](_0xfa4e('0x7'),attributes,{'tableName':'analytics_custom_reports','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.rpc.js b/server/api/analyticCustomReport/analyticCustomReport.rpc.js index 0123fa3..faca118 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 _0xbbc9=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x3794db,_0x5e1968){var _0x3a7499=function(_0x1f4241){while(--_0x1f4241){_0x3794db['push'](_0x3794db['shift']());}};_0x3a7499(++_0x5e1968);}(_0xbbc9,0x15a));var _0x9bbc=function(_0x4efa2a,_0x1dbe0e){_0x4efa2a=_0x4efa2a-0x0;var _0x1055f7=_0xbbc9[_0x4efa2a];return _0x1055f7;};'use strict';var _=require(_0x9bbc('0x0'));var util=require(_0x9bbc('0x1'));var moment=require(_0x9bbc('0x2'));var BPromise=require(_0x9bbc('0x3'));var rs=require(_0x9bbc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9bbc('0x5'))['db'];var utils=require(_0x9bbc('0x6'));var logger=require(_0x9bbc('0x7'))(_0x9bbc('0x8'));var config=require(_0x9bbc('0x9'));var jayson=require(_0x9bbc('0xa'));var client=jayson[_0x9bbc('0xb')][_0x9bbc('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x396af3,_0x40d49f,_0x2825b4){return new BPromise(function(_0x4ccd0a,_0x421e32){return client['request'](_0x396af3,_0x2825b4)[_0x9bbc('0xd')](function(_0x3ced5f){logger[_0x9bbc('0xe')](_0x9bbc('0xf'),_0x40d49f,_0x9bbc('0x10'));logger[_0x9bbc('0x11')](_0x9bbc('0x12'),_0x40d49f,_0x9bbc('0x10'),JSON[_0x9bbc('0x13')](_0x3ced5f));if(_0x3ced5f[_0x9bbc('0x14')]){if(_0x3ced5f[_0x9bbc('0x14')][_0x9bbc('0x15')]===0x1f4){logger['error']('AnalyticCustomReport,\x20%s,\x20%s',_0x40d49f,_0x3ced5f[_0x9bbc('0x14')]['message']);return _0x421e32(_0x3ced5f[_0x9bbc('0x14')]['message']);}logger[_0x9bbc('0x14')](_0x9bbc('0xf'),_0x40d49f,_0x3ced5f[_0x9bbc('0x14')][_0x9bbc('0x16')]);return _0x4ccd0a(_0x3ced5f[_0x9bbc('0x14')][_0x9bbc('0x16')]);}else{logger[_0x9bbc('0xe')](_0x9bbc('0xf'),_0x40d49f,_0x9bbc('0x10'));_0x4ccd0a(_0x3ced5f[_0x9bbc('0x17')][_0x9bbc('0x16')]);}})[_0x9bbc('0x18')](function(_0x48daee){logger[_0x9bbc('0x14')](_0x9bbc('0xf'),_0x40d49f,_0x48daee);_0x421e32(_0x48daee);});});} \ No newline at end of file +var _0x661f=['../../mysqldb','../../config/logger','../../config/environment','client','http','request','then','info','request\x20sent','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','AnalyticCustomReport,\x20%s,\x20%s','lodash','util','moment','randomstring','ioredis'];(function(_0x113775,_0x496335){var _0x110077=function(_0x34271e){while(--_0x34271e){_0x113775['push'](_0x113775['shift']());}};_0x110077(++_0x496335);}(_0x661f,0x73));var _0xf661=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0x661f[_0x599f41];return _0x2e4d58;};'use strict';var _=require(_0xf661('0x0'));var util=require(_0xf661('0x1'));var moment=require(_0xf661('0x2'));var BPromise=require('bluebird');var rs=require(_0xf661('0x3'));var fs=require('fs');var Redis=require(_0xf661('0x4'));var db=require(_0xf661('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf661('0x6'))('rpc');var config=require(_0xf661('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xf661('0x8')][_0xf661('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x593f7d,_0x400889,_0x346187){return new BPromise(function(_0xf2c128,_0x54cfec){return client[_0xf661('0xa')](_0x593f7d,_0x346187)[_0xf661('0xb')](function(_0xa866e1){logger[_0xf661('0xc')]('AnalyticCustomReport,\x20%s,\x20%s',_0x400889,_0xf661('0xd'));logger['debug'](_0xf661('0xe'),_0x400889,_0xf661('0xd'),JSON[_0xf661('0xf')](_0xa866e1));if(_0xa866e1[_0xf661('0x10')]){if(_0xa866e1[_0xf661('0x10')][_0xf661('0x11')]===0x1f4){logger['error']('AnalyticCustomReport,\x20%s,\x20%s',_0x400889,_0xa866e1[_0xf661('0x10')]['message']);return _0x54cfec(_0xa866e1[_0xf661('0x10')][_0xf661('0x12')]);}logger[_0xf661('0x10')]('AnalyticCustomReport,\x20%s,\x20%s',_0x400889,_0xa866e1['error'][_0xf661('0x12')]);return _0xf2c128(_0xa866e1[_0xf661('0x10')][_0xf661('0x12')]);}else{logger[_0xf661('0xc')](_0xf661('0x13'),_0x400889,'request\x20sent');_0xf2c128(_0xa866e1['result'][_0xf661('0x12')]);}})['catch'](function(_0x32b5a2){logger[_0xf661('0x10')](_0xf661('0x13'),_0x400889,_0x32b5a2);_0x54cfec(_0x32b5a2);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index b1a9367..ddebd5c 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 _0xd9d1=['/:id/preview','/:id/run','run','/:id/query','query','post','create','put','/:id','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','get','isAuthenticated','index'];(function(_0x4b416c,_0x53ef9e){var _0x2037fa=function(_0x5d9816){while(--_0x5d9816){_0x4b416c['push'](_0x4b416c['shift']());}};_0x2037fa(++_0x53ef9e);}(_0xd9d1,0x12a));var _0x1d9d=function(_0x476f8a,_0x492fac){_0x476f8a=_0x476f8a-0x0;var _0x4a3dda=_0xd9d1[_0x476f8a];return _0x4a3dda;};'use strict';var multer=require('multer');var util=require(_0x1d9d('0x0'));var path=require(_0x1d9d('0x1'));var timeout=require(_0x1d9d('0x2'));var express=require(_0x1d9d('0x3'));var router=express[_0x1d9d('0x4')]();var fs_extra=require(_0x1d9d('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1d9d('0x6'));var controller=require('./analyticCustomReport.controller');router[_0x1d9d('0x7')]('/',auth[_0x1d9d('0x8')](),controller[_0x1d9d('0x9')]);router[_0x1d9d('0x7')]('/:id',auth[_0x1d9d('0x8')](),controller['show']);router[_0x1d9d('0x7')](_0x1d9d('0xa'),auth[_0x1d9d('0x8')](),controller['preview']);router['get'](_0x1d9d('0xb'),auth[_0x1d9d('0x8')](),controller[_0x1d9d('0xc')]);router[_0x1d9d('0x7')](_0x1d9d('0xd'),auth[_0x1d9d('0x8')](),controller[_0x1d9d('0xe')]);router[_0x1d9d('0xf')]('/',auth['isAuthenticated'](),controller[_0x1d9d('0x10')]);router[_0x1d9d('0x11')](_0x1d9d('0x12'),auth[_0x1d9d('0x8')](),controller[_0x1d9d('0x13')]);router[_0x1d9d('0x14')]('/:id',auth[_0x1d9d('0x8')](),controller[_0x1d9d('0x15')]);module['exports']=router; \ No newline at end of file +var _0x4e6d=['path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','/:id/preview','preview','/:id/run','/:id/query','query','post','create','put','/:id','delete','exports','util'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0x4e6d,0x92));var _0xd4e6=function(_0x363842,_0x369636){_0x363842=_0x363842-0x0;var _0x257bc2=_0x4e6d[_0x363842];return _0x257bc2;};'use strict';var multer=require('multer');var util=require(_0xd4e6('0x0'));var path=require(_0xd4e6('0x1'));var timeout=require('connect-timeout');var express=require(_0xd4e6('0x2'));var router=express[_0xd4e6('0x3')]();var fs_extra=require(_0xd4e6('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xd4e6('0x5'));var config=require(_0xd4e6('0x6'));var controller=require('./analyticCustomReport.controller');router[_0xd4e6('0x7')]('/',auth[_0xd4e6('0x8')](),controller['index']);router['get']('/:id',auth[_0xd4e6('0x8')](),controller[_0xd4e6('0x9')]);router[_0xd4e6('0x7')](_0xd4e6('0xa'),auth[_0xd4e6('0x8')](),controller[_0xd4e6('0xb')]);router['get'](_0xd4e6('0xc'),auth[_0xd4e6('0x8')](),controller['run']);router['get'](_0xd4e6('0xd'),auth[_0xd4e6('0x8')](),controller[_0xd4e6('0xe')]);router[_0xd4e6('0xf')]('/',auth[_0xd4e6('0x8')](),controller[_0xd4e6('0x10')]);router[_0xd4e6('0x11')](_0xd4e6('0x12'),auth[_0xd4e6('0x8')](),controller['update']);router[_0xd4e6('0x13')](_0xd4e6('0x12'),auth[_0xd4e6('0x8')](),controller['destroy']);module[_0xd4e6('0x14')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 00bc2ff..417a8d5 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 _0xb4c7=['STRING','TEXT','sequelize','exports'];(function(_0xb0fe92,_0x147e42){var _0x41787f=function(_0x42ae35){while(--_0x42ae35){_0xb0fe92['push'](_0xb0fe92['shift']());}};_0x41787f(++_0x147e42);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x6bcc5,_0x9c28f0){_0x6bcc5=_0x6bcc5-0x0;var _0x345542=_0xb4c7[_0x6bcc5];return _0x345542;};'use strict';var Sequelize=require(_0x7b4c('0x0'));module[_0x7b4c('0x1')]={'name':{'type':Sequelize[_0x7b4c('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x7b4c('0x2')]},'parent':{'type':Sequelize[_0x7b4c('0x2')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x7b4c('0x3')]},'joins':{'type':Sequelize[_0x7b4c('0x3')]}}; \ No newline at end of file +var _0x7217=['sequelize','STRING','TEXT'];(function(_0x5ddd23,_0x38b636){var _0x15ebce=function(_0x3a0170){while(--_0x3a0170){_0x5ddd23['push'](_0x5ddd23['shift']());}};_0x15ebce(++_0x38b636);}(_0x7217,0x19e));var _0x7721=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x7217[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require(_0x7721('0x0'));module['exports']={'name':{'type':Sequelize[_0x7721('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x7721('0x1')]},'parent':{'type':Sequelize[_0x7721('0x1')]},'table':{'type':Sequelize[_0x7721('0x1')]},'conditions':{'type':Sequelize[_0x7721('0x2')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 43fa31a..2369cc6 100644 --- a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js +++ b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1967=['conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','SUM(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','IS\x20NOT\x20NULL','table','web','%s-%s.%s','randomstring','output','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','runReport','select','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','update','then','destroy','get','stack','name','send','index','map','AnalyticDefaultReport','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','show','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','DefaultReports','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','join','left_join','right_join','cross_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','from','MetricId','metric','function','replace','format','groupBy','orderBy','DESC','alias','joins','parse','foreignTable','%s.%s\x20=\x20%s.%s','parentKey','foreignKey'];(function(_0x415a01,_0x4a47df){var _0x3ad4ed=function(_0x1ab653){while(--_0x1ab653){_0x415a01['push'](_0x415a01['shift']());}};_0x3ad4ed(++_0x4a47df);}(_0x1967,0x173));var _0x7196=function(_0x7da333,_0x180e53){_0x7da333=_0x7da333-0x0;var _0x5d878e=_0x1967[_0x7da333];return _0x5d878e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7196('0x0'));var zipdir=require(_0x7196('0x1'));var jsonpatch=require(_0x7196('0x2'));var rp=require(_0x7196('0x3'));var moment=require(_0x7196('0x4'));var BPromise=require(_0x7196('0x5'));var Mustache=require(_0x7196('0x6'));var util=require(_0x7196('0x7'));var path=require(_0x7196('0x8'));var sox=require(_0x7196('0x9'));var csv=require('to-csv');var ejs=require(_0x7196('0xa'));var fs=require('fs');var fs_extra=require(_0x7196('0xb'));var _=require(_0x7196('0xc'));var squel=require(_0x7196('0xd'));var crypto=require(_0x7196('0xe'));var jsforce=require(_0x7196('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x7196('0x10'));var querystring=require(_0x7196('0x11'));var Papa=require(_0x7196('0x12'));var Redis=require(_0x7196('0x13'));var authService=require(_0x7196('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7196('0x15'));var logger=require(_0x7196('0x16'))(_0x7196('0x17'));var utils=require(_0x7196('0x18'));var config=require(_0x7196('0x19'));var licenseUtil=require(_0x7196('0x1a'));var db=require(_0x7196('0x1b'))['db'];var dbH=require(_0x7196('0x1b'))[_0x7196('0x1c')];function respondWithStatusCode(_0xba707b,_0x154101){_0x154101=_0x154101||0xcc;return function(_0x4e8c4c){if(_0x4e8c4c){return _0xba707b[_0x7196('0x1d')](_0x154101);}return _0xba707b[_0x7196('0x1e')](_0x154101)[_0x7196('0x1f')]();};}function respondWithResult(_0xf098c1,_0x511aa1){_0x511aa1=_0x511aa1||0xc8;return function(_0x31c778){if(_0x31c778){return _0xf098c1['status'](_0x511aa1)[_0x7196('0x20')](_0x31c778);}};}function respondWithFilteredResult(_0x2590a6,_0xf7e97){return function(_0x3ed1ad){if(_0x3ed1ad){var _0x12dce7=typeof _0xf7e97[_0x7196('0x21')]===_0x7196('0x22')&&typeof _0xf7e97[_0x7196('0x23')]===_0x7196('0x22');var _0x32fe2b=_0x3ed1ad[_0x7196('0x24')];var _0x5b716a=_0x12dce7?0x0:_0xf7e97['offset'];var _0x448f13=_0x12dce7?_0x3ed1ad[_0x7196('0x24')]:_0xf7e97[_0x7196('0x21')]+_0xf7e97['limit'];var _0x39b944;if(_0x448f13>=_0x32fe2b){_0x448f13=_0x32fe2b;_0x39b944=0xc8;}else{_0x39b944=0xce;}_0x2590a6['status'](_0x39b944);return _0x2590a6['set'](_0x7196('0x25'),_0x5b716a+'-'+_0x448f13+'/'+_0x32fe2b)[_0x7196('0x20')](_0x3ed1ad);}return null;};}function patchUpdates(_0x8dee9d){return function(_0x4ddf78){try{jsonpatch['apply'](_0x4ddf78,_0x8dee9d,!![]);}catch(_0x38d291){return BPromise[_0x7196('0x26')](_0x38d291);}return _0x4ddf78['save']();};}function saveUpdates(_0x18649b,_0x27ff84){return function(_0x6e22e5){if(_0x6e22e5){return _0x6e22e5[_0x7196('0x27')](_0x18649b)[_0x7196('0x28')](function(_0x549f34){return _0x549f34;});}return null;};}function removeEntity(_0x3f8178,_0x520d01){return function(_0x3ce9a0){if(_0x3ce9a0){return _0x3ce9a0[_0x7196('0x29')]()[_0x7196('0x28')](function(){var _0xa69810=_0x3ce9a0[_0x7196('0x2a')]({'plain':!![]});var _0x43f6a2='DefaultReports';return db['UserProfileResource'][_0x7196('0x29')]({'where':{'type':_0x43f6a2,'resourceId':_0xa69810['id']}})[_0x7196('0x28')](function(){return _0x3ce9a0;});})[_0x7196('0x28')](function(){_0x3f8178['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x41cfd2,_0x162cfc){return function(_0x675e64){if(!_0x675e64){_0x41cfd2['sendStatus'](0x194);}return _0x675e64;};}function handleError(_0x35eef9,_0x4ecea1){_0x4ecea1=_0x4ecea1||0x1f4;return function(_0x4fd339){logger['error'](_0x4fd339[_0x7196('0x2b')]);if(_0x4fd339[_0x7196('0x2c')]){delete _0x4fd339[_0x7196('0x2c')];}_0x35eef9['status'](_0x4ecea1)[_0x7196('0x2d')](_0x4fd339);};}exports[_0x7196('0x2e')]=function(_0x2f9583,_0xf999e9){var _0x50c386={},_0x39710d={},_0x429160={'count':0x0,'rows':[]};var _0xd07f22=_[_0x7196('0x2f')](db[_0x7196('0x30')][_0x7196('0x31')],function(_0x15c5f0){return{'name':_0x15c5f0[_0x7196('0x32')],'type':_0x15c5f0[_0x7196('0x33')][_0x7196('0x34')]};});_0x39710d[_0x7196('0x35')]=_['map'](_0xd07f22,_0x7196('0x2c'));_0x39710d['query']=_[_0x7196('0x36')](_0x2f9583['query']);_0x39710d[_0x7196('0x37')]=_[_0x7196('0x38')](_0x39710d['model'],_0x39710d[_0x7196('0x39')]);_0x50c386[_0x7196('0x3a')]=_[_0x7196('0x38')](_0x39710d[_0x7196('0x35')],qs[_0x7196('0x3b')](_0x2f9583['query'][_0x7196('0x3b')]));_0x50c386[_0x7196('0x3a')]=_0x50c386[_0x7196('0x3a')][_0x7196('0x3c')]?_0x50c386[_0x7196('0x3a')]:_0x39710d[_0x7196('0x35')];if(!_0x2f9583['query'][_0x7196('0x3d')](_0x7196('0x3e'))){_0x50c386[_0x7196('0x23')]=qs['limit'](_0x2f9583[_0x7196('0x39')][_0x7196('0x23')]);_0x50c386[_0x7196('0x21')]=qs[_0x7196('0x21')](_0x2f9583[_0x7196('0x39')][_0x7196('0x21')]);}_0x50c386[_0x7196('0x3f')]=qs[_0x7196('0x40')](_0x2f9583[_0x7196('0x39')][_0x7196('0x40')]);_0x50c386['where']=qs[_0x7196('0x37')](_[_0x7196('0x41')](_0x2f9583['query'],_0x39710d[_0x7196('0x37')]),_0xd07f22);if(_0x2f9583['query']['filter']){_0x50c386[_0x7196('0x42')]=_[_0x7196('0x43')](_0x50c386['where'],{'$or':_['map'](_0xd07f22,function(_0x1bad95){if(_0x1bad95[_0x7196('0x33')]!==_0x7196('0x44')){var _0x4c2341={};_0x4c2341[_0x1bad95[_0x7196('0x2c')]]={'$like':'%'+_0x2f9583[_0x7196('0x39')][_0x7196('0x45')]+'%'};return _0x4c2341;}})});}_0x50c386=_[_0x7196('0x43')]({},_0x50c386,_0x2f9583[_0x7196('0x46')]);var _0x428d76={'where':_0x50c386[_0x7196('0x42')]};return db[_0x7196('0x30')]['count'](_0x428d76)[_0x7196('0x28')](function(_0xa852e1){_0x429160['count']=_0xa852e1;if(_0x2f9583[_0x7196('0x39')][_0x7196('0x47')]){_0x50c386['include']=[{'all':!![]}];}return db[_0x7196('0x30')][_0x7196('0x48')](_0x50c386);})[_0x7196('0x28')](function(_0x5749e2){_0x429160[_0x7196('0x49')]=_0x5749e2;return _0x429160;})[_0x7196('0x28')](respondWithFilteredResult(_0xf999e9,_0x50c386))['catch'](handleError(_0xf999e9,null));};exports[_0x7196('0x4a')]=function(_0x1a7052,_0x4f0c6c){var _0x335e6f={'raw':!![],'where':{'id':_0x1a7052['params']['id']}},_0x53a5e6={};_0x53a5e6['model']=_['keys'](db['AnalyticDefaultReport'][_0x7196('0x31')]);_0x53a5e6['query']=_[_0x7196('0x36')](_0x1a7052[_0x7196('0x39')]);_0x53a5e6[_0x7196('0x37')]=_[_0x7196('0x38')](_0x53a5e6['model'],_0x53a5e6[_0x7196('0x39')]);_0x335e6f['attributes']=_[_0x7196('0x38')](_0x53a5e6[_0x7196('0x35')],qs[_0x7196('0x3b')](_0x1a7052['query'][_0x7196('0x3b')]));_0x335e6f[_0x7196('0x3a')]=_0x335e6f[_0x7196('0x3a')]['length']?_0x335e6f['attributes']:_0x53a5e6[_0x7196('0x35')];if(_0x1a7052['query'][_0x7196('0x47')]){_0x335e6f['include']=[{'all':!![]}];}_0x335e6f=_['merge']({},_0x335e6f,_0x1a7052[_0x7196('0x46')]);return db['AnalyticDefaultReport']['find'](_0x335e6f)['then'](handleEntityNotFound(_0x4f0c6c,null))[_0x7196('0x28')](respondWithResult(_0x4f0c6c,null))['catch'](handleError(_0x4f0c6c,null));};exports['create']=function(_0x28591e,_0x182c8b){return db[_0x7196('0x30')][_0x7196('0x4b')](_0x28591e['body'],{})[_0x7196('0x28')](function(_0x564688){var _0x36844f=_0x28591e[_0x7196('0x4c')]['get']({'plain':!![]});if(!_0x36844f)throw new Error(_0x7196('0x4d'));if(_0x36844f[_0x7196('0x4e')]===_0x7196('0x4c')){var _0x4fa18f=_0x564688[_0x7196('0x2a')]({'plain':!![]});var _0x5d51aa=_0x7196('0x4f');return db[_0x7196('0x50')][_0x7196('0x51')]({'where':{'name':_0x5d51aa,'userProfileId':_0x36844f[_0x7196('0x52')]},'raw':!![]})[_0x7196('0x28')](function(_0x19733a){if(_0x19733a&&_0x19733a[_0x7196('0x53')]===0x0){return db[_0x7196('0x54')]['create']({'name':_0x4fa18f['name'],'resourceId':_0x4fa18f['id'],'type':_0x7196('0x55'),'sectionId':_0x19733a['id']},{})[_0x7196('0x28')](function(){return _0x564688;});}else{return _0x564688;}})[_0x7196('0x56')](function(_0xe4b032){logger['error'](_0x7196('0x57'),_0xe4b032);throw _0xe4b032;});}return _0x564688;})[_0x7196('0x28')](respondWithResult(_0x182c8b,0xc9))[_0x7196('0x56')](handleError(_0x182c8b,null));};exports[_0x7196('0x27')]=function(_0x9fcfd4,_0x3177c2){if(_0x9fcfd4[_0x7196('0x58')]['id']){delete _0x9fcfd4[_0x7196('0x58')]['id'];}return db[_0x7196('0x30')][_0x7196('0x51')]({'where':{'id':_0x9fcfd4[_0x7196('0x59')]['id']}})['then'](handleEntityNotFound(_0x3177c2,null))[_0x7196('0x28')](saveUpdates(_0x9fcfd4[_0x7196('0x58')],null))[_0x7196('0x28')](respondWithResult(_0x3177c2,null))['catch'](handleError(_0x3177c2,null));};exports[_0x7196('0x29')]=function(_0x5ca1ca,_0x34407d){return db[_0x7196('0x30')][_0x7196('0x51')]({'where':{'id':_0x5ca1ca[_0x7196('0x59')]['id']}})[_0x7196('0x28')](handleEntityNotFound(_0x34407d,null))['then'](removeEntity(_0x34407d,null))[_0x7196('0x56')](handleError(_0x34407d,null));};exports['preview']=function(_0x4be36d,_0x5b9824){var _0x1bc358=0xa;var _0x3be180=[_0x7196('0x5a'),_0x7196('0x5b'),_0x7196('0x5c'),_0x7196('0x5d')];var _0x2d8b3d={'SUM':'SUM(%s)','COUNT':_0x7196('0x5e'),'COUNT DISTINCT':_0x7196('0x5f'),'MAX':_0x7196('0x60'),'MIN':_0x7196('0x61'),'AVG':_0x7196('0x62'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x7196('0x63')};var _0x1c7eb2={'SEC_TO_TIME':_0x7196('0x64'),'DATE':_0x7196('0x65'),'HOUR':_0x7196('0x66'),'ROUND':_0x7196('0x67'),'UNIX_TIMESTAMP':_0x7196('0x68')};var _0x43ee13=function(_0x13e9d0){return!_[_0x7196('0x69')]([_0x7196('0x6a'),'IS\x20NOT\x20NULL',_0x7196('0x6b'),_0x7196('0x6c')],_0x13e9d0);};var _0x27d5d7=function(_0x33f43b){if(!_0x33f43b||!_0x33f43b['rules'][_0x7196('0x3c')]){return'';}for(var _0x204c3a='(',_0x1f3acc=0x0;_0x1f3acc<_0x33f43b[_0x7196('0x6d')][_0x7196('0x3c')];_0x1f3acc+=0x1){_0x1f3acc>0x0&&(_0x204c3a+='\x20'+_0x33f43b[_0x7196('0x6e')]+'\x20');_0x204c3a+=_0x33f43b[_0x7196('0x6d')][_0x1f3acc]['group']?_0x27d5d7(_0x33f43b[_0x7196('0x6d')][_0x1f3acc][_0x7196('0x6f')]):_0x33f43b[_0x7196('0x6d')][_0x1f3acc][_0x7196('0x70')]+'\x20'+_0x33f43b['rules'][_0x1f3acc][_0x7196('0x71')]+(_0x43ee13(_0x33f43b[_0x7196('0x6d')][_0x1f3acc][_0x7196('0x71')])?'\x20'+_0x33f43b[_0x7196('0x6d')][_0x1f3acc][_0x7196('0x72')]:'');}return _0x204c3a+')';};var _0x37c6be={'where':{'id':_0x4be36d['params']['id']}},_0x57065,_0x517dfb,_0x56b2eb,_0x56955e,_0x72f6f1;_0x37c6be=_[_0x7196('0x43')]({},_0x37c6be,_0x4be36d[_0x7196('0x46')]);return db[_0x7196('0x30')][_0x7196('0x51')](_0x37c6be)[_0x7196('0x28')](function(_0x30d44f){if(_0x30d44f){_0x57065=_0x30d44f;return _0x30d44f[_0x7196('0x73')]();}return null;})[_0x7196('0x28')](function(_0x3881a5){if(_0x3881a5){if(!_0x3881a5['length']){throw new db['Sequelize'][(_0x7196('0x74'))](_0x7196('0x75'),0x193);}_0x517dfb=_0x3881a5;return db[_0x7196('0x76')][_0x7196('0x48')]({'raw':!![]});}return null;})[_0x7196('0x28')](function(_0x45e21f){if(_0x45e21f){_0x56b2eb=_[_0x7196('0x77')](_0x45e21f,'id');var _0x2f36f8;var _0x4cc5e3=squel['select']();_0x4cc5e3[_0x7196('0x78')](_0x57065['table']);for(var _0x30d114=0x0;_0x30d114<_0x517dfb['length'];_0x30d114+=0x1){_0x2f36f8=_0x517dfb[_0x30d114][_0x7196('0x79')]?_0x56b2eb[_0x517dfb[_0x30d114][_0x7196('0x79')]][_0x7196('0x7a')]:_0x517dfb[_0x30d114][_0x7196('0x70')];_0x2f36f8=_0x517dfb[_0x30d114]['function']?_['replace'](_0x2d8b3d[_0x517dfb[_0x30d114][_0x7196('0x7b')]],'%s',_0x2f36f8):_0x2f36f8;_0x2f36f8=_0x517dfb[_0x30d114]['format']?_[_0x7196('0x7c')](_0x1c7eb2[_0x517dfb[_0x30d114][_0x7196('0x7d')]],'%s',_0x2f36f8):_0x2f36f8;if(_0x517dfb[_0x30d114][_0x7196('0x7e')]){_0x4cc5e3[_0x7196('0x6f')](_0x2f36f8);}_0x517dfb[_0x30d114][_0x7196('0x7f')]&&_0x4cc5e3[_0x7196('0x3f')](_0x2f36f8,_0x517dfb[_0x30d114]['orderBy']===_0x7196('0x80')?![]:!![]);_0x4cc5e3[_0x7196('0x70')](_0x2f36f8,_0x517dfb[_0x30d114][_0x7196('0x81')]||_0x2f36f8);}if(_0x57065[_0x7196('0x82')]){_0x57065[_0x7196('0x82')]=JSON[_0x7196('0x83')](_0x57065[_0x7196('0x82')]);for(var _0x473c0e=0x0;_0x473c0e<_0x57065[_0x7196('0x82')][_0x7196('0x3c')];_0x473c0e+=0x1){if(_0x57065[_0x7196('0x82')][_0x473c0e][_0x7196('0x33')]&&_['includes'](_0x3be180,_0x57065[_0x7196('0x82')][_0x473c0e][_0x7196('0x33')])&&_0x57065['joins'][_0x473c0e]['parentKey']&&_0x57065[_0x7196('0x82')][_0x473c0e][_0x7196('0x84')]&&_0x57065[_0x7196('0x82')][_0x473c0e]['foreignKey']){_0x4cc5e3[_0x57065[_0x7196('0x82')][_0x473c0e]['type']](_0x57065[_0x7196('0x82')][_0x473c0e][_0x7196('0x84')],null,util['format'](_0x7196('0x85'),_0x57065['table'],_0x57065['joins'][_0x473c0e][_0x7196('0x86')],_0x57065[_0x7196('0x82')][_0x473c0e][_0x7196('0x84')],_0x57065['joins'][_0x473c0e][_0x7196('0x87')]));}}}if(_0x57065['conditions']){_0x57065[_0x7196('0x88')]=JSON[_0x7196('0x83')](_0x57065[_0x7196('0x88')]);_0x4cc5e3[_0x7196('0x42')](_0x27d5d7(_0x57065[_0x7196('0x88')]['group']));}_0x72f6f1=_0x4cc5e3[_0x7196('0x89')]();_0x4cc5e3[_0x7196('0x23')](_0x1bc358);_0x4cc5e3[_0x7196('0x21')](0x0);logger[_0x7196('0x8a')](_0x7196('0x8b'),_0x4cc5e3[_0x7196('0x8c')]());return dbH[_0x7196('0x8d')][_0x7196('0x39')](_0x4cc5e3['toString'](),{'type':dbH[_0x7196('0x8d')][_0x7196('0x8e')][_0x7196('0x8f')]});}})[_0x7196('0x28')](respondWithResult(_0x5b9824,null))['catch'](handleError(_0x5b9824,null));};function runReport(_0x1364f5,_0x2cb53c,_0x4fe2cb){var _0x2e4807=_0x2cb53c['name'];var _0xd6d8cf=0xa;var _0x5318c1=[_0x7196('0x5a'),_0x7196('0x5b'),'right_join',_0x7196('0x5d')];var _0x2b52c0={'SUM':_0x7196('0x90'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x7196('0x60'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x7196('0x91'),'GROUP_CONCAT ASC':_0x7196('0x92'),'GROUP_CONCAT DESC':_0x7196('0x63')};var _0x509c4a={'SEC_TO_TIME':_0x7196('0x64'),'DATE':_0x7196('0x65'),'HOUR':_0x7196('0x66'),'ROUND':_0x7196('0x67'),'UNIX_TIMESTAMP':_0x7196('0x68')};var _0x26048c=function(_0x1a4d17){return!_[_0x7196('0x69')]([_0x7196('0x6a'),_0x7196('0x93'),_0x7196('0x6b'),'IS\x20NOT\x20EMPTY'],_0x1a4d17);};var _0x5acff1=function(_0x32ab6c){if(!_0x32ab6c||!_0x32ab6c['rules']['length']){return'';}for(var _0x2bfdc4='(',_0x1604fa=0x0;_0x1604fa<_0x32ab6c[_0x7196('0x6d')][_0x7196('0x3c')];_0x1604fa+=0x1){_0x1604fa>0x0&&(_0x2bfdc4+='\x20'+_0x32ab6c['operator']+'\x20');_0x2bfdc4+=_0x32ab6c['rules'][_0x1604fa][_0x7196('0x6f')]?_0x5acff1(_0x32ab6c[_0x7196('0x6d')][_0x1604fa][_0x7196('0x6f')]):_0x32ab6c[_0x7196('0x6d')][_0x1604fa]['field']+'\x20'+_0x32ab6c[_0x7196('0x6d')][_0x1604fa]['condition']+(_0x26048c(_0x32ab6c['rules'][_0x1604fa][_0x7196('0x71')])?'\x20'+_0x32ab6c[_0x7196('0x6d')][_0x1604fa][_0x7196('0x72')]:'');}return _0x2bfdc4+')';};var _0x494418={'where':{'id':_0x1364f5['id']}},_0x400aa5,_0x40d4c3,_0x1824e2,_0x30c54b,_0x10712f;_0x494418=_[_0x7196('0x43')]({},_0x494418,_0x4fe2cb);return db[_0x7196('0x30')][_0x7196('0x51')](_0x494418)['then'](function(_0x9bd2ea){if(_0x9bd2ea){_0x400aa5=_0x9bd2ea;return _0x9bd2ea[_0x7196('0x73')]();}return null;})[_0x7196('0x28')](function(_0x408760){if(_0x408760){if(!_0x408760[_0x7196('0x3c')]){throw new db['Sequelize'][(_0x7196('0x74'))](_0x7196('0x75'),0x193);}_0x40d4c3=_0x408760;return db[_0x7196('0x76')]['findAll']({'raw':!![]});}return null;})[_0x7196('0x28')](function(_0x4b98de){if(_0x4b98de){_0x1824e2=_['keyBy'](_0x4b98de,'id');var _0x1dcf93;var _0x25d323=squel['select']();_0x25d323[_0x7196('0x78')](_0x400aa5[_0x7196('0x94')]);for(var _0x48ceda=0x0;_0x48ceda<_0x40d4c3[_0x7196('0x3c')];_0x48ceda+=0x1){_0x1dcf93=_0x40d4c3[_0x48ceda][_0x7196('0x79')]?_0x1824e2[_0x40d4c3[_0x48ceda][_0x7196('0x79')]][_0x7196('0x7a')]:_0x40d4c3[_0x48ceda][_0x7196('0x70')];_0x1dcf93=_0x40d4c3[_0x48ceda][_0x7196('0x7b')]?_['replace'](_0x2b52c0[_0x40d4c3[_0x48ceda][_0x7196('0x7b')]],'%s',_0x1dcf93):_0x1dcf93;_0x1dcf93=_0x40d4c3[_0x48ceda][_0x7196('0x7d')]?_[_0x7196('0x7c')](_0x509c4a[_0x40d4c3[_0x48ceda]['format']],'%s',_0x1dcf93):_0x1dcf93;if(_0x40d4c3[_0x48ceda]['groupBy']){_0x25d323['group'](_0x1dcf93);}_0x40d4c3[_0x48ceda][_0x7196('0x7f')]&&_0x25d323[_0x7196('0x3f')](_0x1dcf93,_0x40d4c3[_0x48ceda][_0x7196('0x7f')]==='DESC'?![]:!![]);_0x25d323[_0x7196('0x70')](_0x1dcf93,_0x40d4c3[_0x48ceda]['alias']||_0x1dcf93);}if(_0x400aa5[_0x7196('0x82')]){_0x400aa5['joins']=JSON[_0x7196('0x83')](_0x400aa5[_0x7196('0x82')]);for(var _0x33d5bf=0x0;_0x33d5bf<_0x400aa5[_0x7196('0x82')][_0x7196('0x3c')];_0x33d5bf+=0x1){if(_0x400aa5[_0x7196('0x82')][_0x33d5bf][_0x7196('0x33')]&&_['includes'](_0x5318c1,_0x400aa5[_0x7196('0x82')][_0x33d5bf]['type'])&&_0x400aa5['joins'][_0x33d5bf]['parentKey']&&_0x400aa5['joins'][_0x33d5bf]['foreignTable']&&_0x400aa5[_0x7196('0x82')][_0x33d5bf][_0x7196('0x87')]){_0x25d323[_0x400aa5[_0x7196('0x82')][_0x33d5bf]['type']](_0x400aa5[_0x7196('0x82')][_0x33d5bf]['foreignTable'],null,util['format']('%s.%s\x20=\x20%s.%s',_0x400aa5[_0x7196('0x94')],_0x400aa5['joins'][_0x33d5bf][_0x7196('0x86')],_0x400aa5[_0x7196('0x82')][_0x33d5bf][_0x7196('0x84')],_0x400aa5[_0x7196('0x82')][_0x33d5bf][_0x7196('0x87')]));}}}if(_0x400aa5[_0x7196('0x88')]){_0x400aa5[_0x7196('0x88')]=JSON[_0x7196('0x83')](_0x400aa5['conditions']);_0x25d323[_0x7196('0x42')](_0x5acff1(_0x400aa5[_0x7196('0x88')][_0x7196('0x6f')]));}_0x10712f=_0x25d323['clone']();_0x25d323[_0x7196('0x23')](_0xd6d8cf);_0x25d323[_0x7196('0x21')](0x0);return;}})[_0x7196('0x28')](function(){if(_0x2cb53c['output']===_0x7196('0x95')){return null;}var _0x46a563=_[_0x7196('0x43')](_0x2cb53c,{'name':_0x2cb53c['fullPath']||_0x2cb53c[_0x7196('0x2c')]||_0x400aa5[_0x7196('0x2c')],'basename':_0x2e4807,'savename':util['format'](_0x7196('0x96'),_0x2cb53c['name']||_0x400aa5[_0x7196('0x2c')],require(_0x7196('0x97'))['generate'](0x4),_0x2cb53c[_0x7196('0x98')]||'csv'),'reportId':_0x400aa5['id'],'reportType':_0x7196('0x99')});return db[_0x7196('0x9a')][_0x7196('0x4b')](_0x46a563,{'raw':!![]});})['then'](function(_0xd9619d){if(_0x400aa5[_0x7196('0x94')]===_0x7196('0x9b')){_0x10712f[_0x7196('0x42')](_0x400aa5['table']+_0x7196('0x9c'),_0x2cb53c[_0x7196('0x9d')],_0x2cb53c[_0x7196('0x9e')]);}else{_0x10712f['where'](_0x400aa5['table']+_0x7196('0x9f'),_0x2cb53c[_0x7196('0x9d')],_0x2cb53c[_0x7196('0x9e')]);}if(_0xd9619d){logger[_0x7196('0xa0')]('Run\x20Query:',_0x10712f[_0x7196('0x8c')]());require('child_process')[_0x7196('0xa1')](path['join'](__dirname,_0x7196('0xa2'),_0xd9619d[_0x7196('0x98')]),[_0xd9619d['id'],_0x10712f[_0x7196('0x8c')](),path[_0x7196('0x5a')](__dirname,_0x7196('0xa3'),_0xd9619d[_0x7196('0xa4')]),_0x2e4807]);return _0xd9619d;}else{var _0x342fb1=squel['select']();_0x342fb1[_0x7196('0x78')]('('+_0x10712f[_0x7196('0x8c')]()+')',_0x7196('0xa5'));_0x342fb1[_0x7196('0x70')](_0x7196('0xa6'),_0x7196('0x24'));_0x10712f[_0x7196('0x23')](_0x2cb53c[_0x7196('0x23')]||_0xd6d8cf);_0x10712f['offset'](_0x2cb53c[_0x7196('0x21')]||0x0);return dbH[_0x7196('0x8d')]['query'](_0x342fb1[_0x7196('0x8c')](),{'type':dbH[_0x7196('0x8d')]['QueryTypes'][_0x7196('0x8f')]})[_0x7196('0x28')](function(_0xdf1ede){if(!_0xdf1ede[_0x7196('0x3c')]){_0x30c54b=0x0;}else{_0x30c54b=_0xdf1ede[0x0]['count']||0x0;}return dbH['sequelize'][_0x7196('0x39')](_0x10712f['toString'](),{'type':dbH[_0x7196('0x8d')][_0x7196('0x8e')][_0x7196('0x8f')]});})[_0x7196('0x28')](function(_0x2df80a){return{'rows':_0x2df80a||[],'count':_0x30c54b};});}});}exports['run']=function(_0x392e74,_0x17ba6d){return runReport(_0x392e74[_0x7196('0x59')],_0x392e74[_0x7196('0x39')],_0x392e74[_0x7196('0x46')])[_0x7196('0x28')](respondWithResult(_0x17ba6d,null))[_0x7196('0x56')](handleError(_0x17ba6d,null));};exports[_0x7196('0xa7')]=runReport;exports[_0x7196('0x39')]=function(_0x5a3c87,_0x58fb86){var _0x51da79=0xa;var _0x144613=[_0x7196('0x5a'),_0x7196('0x5b'),_0x7196('0x5c'),_0x7196('0x5d')];var _0x9055af={'SUM':_0x7196('0x90'),'COUNT':_0x7196('0x5e'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x7196('0x91'),'GROUP_CONCAT ASC':_0x7196('0x92'),'GROUP_CONCAT DESC':_0x7196('0x63')};var _0xab9595={'SEC_TO_TIME':_0x7196('0x64'),'DATE':_0x7196('0x65'),'HOUR':'HOUR(%s)','ROUND':_0x7196('0x67'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x5236a0=function(_0x520fe8){return!_['includes'](['IS\x20NULL',_0x7196('0x93'),'IS\x20EMPTY',_0x7196('0x6c')],_0x520fe8);};var _0x425a57=function(_0x302728){if(!_0x302728||!_0x302728[_0x7196('0x6d')][_0x7196('0x3c')]){return'';}for(var _0x14492e='(',_0x58df43=0x0;_0x58df43<_0x302728[_0x7196('0x6d')][_0x7196('0x3c')];_0x58df43+=0x1){_0x58df43>0x0&&(_0x14492e+='\x20'+_0x302728[_0x7196('0x6e')]+'\x20');_0x14492e+=_0x302728['rules'][_0x58df43][_0x7196('0x6f')]?_0x425a57(_0x302728[_0x7196('0x6d')][_0x58df43][_0x7196('0x6f')]):_0x302728['rules'][_0x58df43]['field']+'\x20'+_0x302728[_0x7196('0x6d')][_0x58df43][_0x7196('0x71')]+(_0x5236a0(_0x302728[_0x7196('0x6d')][_0x58df43][_0x7196('0x71')])?'\x20'+_0x302728[_0x7196('0x6d')][_0x58df43][_0x7196('0x72')]:'');}return _0x14492e+')';};var _0x1a8a5a={'where':{'id':_0x5a3c87[_0x7196('0x59')]['id']}},_0x2944e5,_0x3f9385,_0xbd94ef,_0x5d2a56,_0x2fb552;_0x1a8a5a=_['merge']({},_0x1a8a5a,_0x5a3c87[_0x7196('0x46')]);return db[_0x7196('0x30')]['find'](_0x1a8a5a)[_0x7196('0x28')](function(_0x386259){if(_0x386259){_0x2944e5=_0x386259;return _0x386259[_0x7196('0x73')]();}return null;})[_0x7196('0x28')](function(_0x1e7a64){if(_0x1e7a64){if(!_0x1e7a64[_0x7196('0x3c')]){throw new db['Sequelize']['ValidationErrorItem'](_0x7196('0x75'),0x193);}_0x3f9385=_0x1e7a64;return db['AnalyticMetric'][_0x7196('0x48')]({'raw':!![]});}return null;})[_0x7196('0x28')](function(_0x30db09){if(_0x30db09){_0xbd94ef=_['keyBy'](_0x30db09,'id');var _0x4729e1;var _0x66e1e6=squel[_0x7196('0xa8')]();_0x66e1e6[_0x7196('0x78')](_0x2944e5[_0x7196('0x94')]);for(var _0x1e2105=0x0;_0x1e2105<_0x3f9385[_0x7196('0x3c')];_0x1e2105+=0x1){_0x4729e1=_0x3f9385[_0x1e2105][_0x7196('0x79')]?_0xbd94ef[_0x3f9385[_0x1e2105][_0x7196('0x79')]]['metric']:_0x3f9385[_0x1e2105][_0x7196('0x70')];_0x4729e1=_0x3f9385[_0x1e2105][_0x7196('0x7b')]?_[_0x7196('0x7c')](_0x9055af[_0x3f9385[_0x1e2105][_0x7196('0x7b')]],'%s',_0x4729e1):_0x4729e1;_0x4729e1=_0x3f9385[_0x1e2105][_0x7196('0x7d')]?_[_0x7196('0x7c')](_0xab9595[_0x3f9385[_0x1e2105]['format']],'%s',_0x4729e1):_0x4729e1;if(_0x3f9385[_0x1e2105][_0x7196('0x7e')]){_0x66e1e6['group'](_0x4729e1);}_0x3f9385[_0x1e2105][_0x7196('0x7f')]&&_0x66e1e6[_0x7196('0x3f')](_0x4729e1,_0x3f9385[_0x1e2105][_0x7196('0x7f')]==='DESC'?![]:!![]);_0x66e1e6['field'](_0x4729e1,_0x3f9385[_0x1e2105][_0x7196('0x81')]||_0x4729e1);}if(_0x2944e5[_0x7196('0x82')]){_0x2944e5[_0x7196('0x82')]=JSON[_0x7196('0x83')](_0x2944e5[_0x7196('0x82')]);for(var _0x220315=0x0;_0x220315<_0x2944e5[_0x7196('0x82')][_0x7196('0x3c')];_0x220315+=0x1){if(_0x2944e5['joins'][_0x220315][_0x7196('0x33')]&&_[_0x7196('0x69')](_0x144613,_0x2944e5['joins'][_0x220315][_0x7196('0x33')])&&_0x2944e5[_0x7196('0x82')][_0x220315][_0x7196('0x86')]&&_0x2944e5['joins'][_0x220315][_0x7196('0x84')]&&_0x2944e5[_0x7196('0x82')][_0x220315][_0x7196('0x87')]){_0x66e1e6[_0x2944e5[_0x7196('0x82')][_0x220315][_0x7196('0x33')]](_0x2944e5['joins'][_0x220315]['foreignTable'],null,util[_0x7196('0x7d')](_0x7196('0x85'),_0x2944e5[_0x7196('0x94')],_0x2944e5[_0x7196('0x82')][_0x220315][_0x7196('0x86')],_0x2944e5[_0x7196('0x82')][_0x220315]['foreignTable'],_0x2944e5[_0x7196('0x82')][_0x220315][_0x7196('0x87')]));}}}if(_0x2944e5[_0x7196('0x88')]){_0x2944e5[_0x7196('0x88')]=JSON['parse'](_0x2944e5[_0x7196('0x88')]);_0x66e1e6[_0x7196('0x42')](_0x425a57(_0x2944e5[_0x7196('0x88')][_0x7196('0x6f')]));}_0x2fb552=_0x66e1e6[_0x7196('0x89')]();_0x66e1e6[_0x7196('0x23')](_0x51da79);_0x66e1e6[_0x7196('0x21')](0x0);logger[_0x7196('0x8a')](_0x7196('0x8b'),_0x66e1e6[_0x7196('0x8c')]());return dbH[_0x7196('0x8d')][_0x7196('0x39')](_0x66e1e6['toString'](),{'type':dbH[_0x7196('0x8d')]['QueryTypes'][_0x7196('0x8f')]});}})['then'](function(){return{'sql':_0x2fb552[_0x7196('0x8c')]()};})['then'](respondWithResult(_0x58fb86,null))[_0x7196('0x56')](handleError(_0x58fb86,null));}; \ No newline at end of file +var _0x2675=['AnalyticDefaultReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','sort','where','filters','pick','VIRTUAL','merge','options','includeAll','include','catch','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Reports','UserProfileSection','find','userProfileId','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','preview','join','left_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','operator','group','condition','value','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','select','table','MetricId','metric','field','function','replace','format','groupBy','order','orderBy','DESC','joins','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','parse','clone','toString','sequelize','QueryTypes','right_join','SEC_TO_TIME(%s)','IS\x20EMPTY','Sequelize','keyBy','from','alias','output','randomstring','generate','csv','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','info','Run\x20Query:','child_process','fork','../../files/reports','savename','COUNT(*)','SELECT','run','runReport','MIN(%s)','debug','eml-format','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','then','get','DefaultReports','name','map'];(function(_0x4c5822,_0x4e552f){var _0x46b2ba=function(_0x20bce8){while(--_0x20bce8){_0x4c5822['push'](_0x4c5822['shift']());}};_0x46b2ba(++_0x4e552f);}(_0x2675,0x75));var _0x5267=function(_0x476f40,_0x3ab80e){_0x476f40=_0x476f40-0x0;var _0x263172=_0x2675[_0x476f40];return _0x263172;};'use strict';var emlformat=require(_0x5267('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5267('0x1'));var moment=require(_0x5267('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x5267('0x3'));var util=require(_0x5267('0x4'));var path=require('path');var sox=require(_0x5267('0x5'));var csv=require(_0x5267('0x6'));var ejs=require(_0x5267('0x7'));var fs=require('fs');var fs_extra=require(_0x5267('0x8'));var _=require(_0x5267('0x9'));var squel=require(_0x5267('0xa'));var crypto=require('crypto');var jsforce=require(_0x5267('0xb'));var deskjs=require(_0x5267('0xc'));var toCsv=require('to-csv');var querystring=require(_0x5267('0xd'));var Papa=require('papaparse');var Redis=require(_0x5267('0xe'));var authService=require(_0x5267('0xf'));var qs=require(_0x5267('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5267('0x11'));var logger=require('../../config/logger')(_0x5267('0x12'));var utils=require('../../config/utils');var config=require(_0x5267('0x13'));var licenseUtil=require(_0x5267('0x14'));var db=require(_0x5267('0x15'))['db'];var dbH=require(_0x5267('0x15'))[_0x5267('0x16')];function respondWithStatusCode(_0x1171b9,_0x20785c){_0x20785c=_0x20785c||0xcc;return function(_0x36dc17){if(_0x36dc17){return _0x1171b9[_0x5267('0x17')](_0x20785c);}return _0x1171b9[_0x5267('0x18')](_0x20785c)[_0x5267('0x19')]();};}function respondWithResult(_0x29349a,_0x3e2bab){_0x3e2bab=_0x3e2bab||0xc8;return function(_0x548040){if(_0x548040){return _0x29349a['status'](_0x3e2bab)[_0x5267('0x1a')](_0x548040);}};}function respondWithFilteredResult(_0x40d897,_0x38a147){return function(_0x3f5344){if(_0x3f5344){var _0x46b2c2=typeof _0x38a147[_0x5267('0x1b')]===_0x5267('0x1c')&&typeof _0x38a147[_0x5267('0x1d')]===_0x5267('0x1c');var _0xb1c97a=_0x3f5344[_0x5267('0x1e')];var _0x1ab03=_0x46b2c2?0x0:_0x38a147['offset'];var _0x18f32e=_0x46b2c2?_0x3f5344[_0x5267('0x1e')]:_0x38a147['offset']+_0x38a147[_0x5267('0x1d')];var _0x56733e;if(_0x18f32e>=_0xb1c97a){_0x18f32e=_0xb1c97a;_0x56733e=0xc8;}else{_0x56733e=0xce;}_0x40d897[_0x5267('0x18')](_0x56733e);return _0x40d897[_0x5267('0x1f')](_0x5267('0x20'),_0x1ab03+'-'+_0x18f32e+'/'+_0xb1c97a)[_0x5267('0x1a')](_0x3f5344);}return null;};}function patchUpdates(_0x5ca9c6){return function(_0x4dd637){try{jsonpatch[_0x5267('0x21')](_0x4dd637,_0x5ca9c6,!![]);}catch(_0x5aebdd){return BPromise[_0x5267('0x22')](_0x5aebdd);}return _0x4dd637[_0x5267('0x23')]();};}function saveUpdates(_0x3b53ac,_0x56dd95){return function(_0x499f19){if(_0x499f19){return _0x499f19['update'](_0x3b53ac)['then'](function(_0x5ea6a6){return _0x5ea6a6;});}return null;};}function removeEntity(_0x26c7f8,_0x399e64){return function(_0x2d761d){if(_0x2d761d){return _0x2d761d[_0x5267('0x24')]()[_0x5267('0x25')](function(){var _0x40d1be=_0x2d761d[_0x5267('0x26')]({'plain':!![]});var _0x220e03=_0x5267('0x27');return db['UserProfileResource']['destroy']({'where':{'type':_0x220e03,'resourceId':_0x40d1be['id']}})[_0x5267('0x25')](function(){return _0x2d761d;});})[_0x5267('0x25')](function(){_0x26c7f8['status'](0xcc)[_0x5267('0x19')]();});}};}function handleEntityNotFound(_0x52504e,_0x4d7c2a){return function(_0x43e7e7){if(!_0x43e7e7){_0x52504e[_0x5267('0x17')](0x194);}return _0x43e7e7;};}function handleError(_0x1f33b7,_0x2d2ace){_0x2d2ace=_0x2d2ace||0x1f4;return function(_0x33c431){logger['error'](_0x33c431['stack']);if(_0x33c431[_0x5267('0x28')]){delete _0x33c431[_0x5267('0x28')];}_0x1f33b7[_0x5267('0x18')](_0x2d2ace)['send'](_0x33c431);};}exports['index']=function(_0xbe7922,_0x3ef2a8){var _0x1fa725={},_0x5bec7e={},_0x59b091={'count':0x0,'rows':[]};var _0x2249a1=_[_0x5267('0x29')](db[_0x5267('0x2a')][_0x5267('0x2b')],function(_0x5bbb83){return{'name':_0x5bbb83[_0x5267('0x2c')],'type':_0x5bbb83[_0x5267('0x2d')][_0x5267('0x2e')]};});_0x5bec7e[_0x5267('0x2f')]=_[_0x5267('0x29')](_0x2249a1,_0x5267('0x28'));_0x5bec7e[_0x5267('0x30')]=_[_0x5267('0x31')](_0xbe7922['query']);_0x5bec7e['filters']=_[_0x5267('0x32')](_0x5bec7e['model'],_0x5bec7e[_0x5267('0x30')]);_0x1fa725[_0x5267('0x33')]=_[_0x5267('0x32')](_0x5bec7e[_0x5267('0x2f')],qs['fields'](_0xbe7922[_0x5267('0x30')][_0x5267('0x34')]));_0x1fa725[_0x5267('0x33')]=_0x1fa725[_0x5267('0x33')][_0x5267('0x35')]?_0x1fa725[_0x5267('0x33')]:_0x5bec7e[_0x5267('0x2f')];if(!_0xbe7922[_0x5267('0x30')]['hasOwnProperty'](_0x5267('0x36'))){_0x1fa725['limit']=qs[_0x5267('0x1d')](_0xbe7922[_0x5267('0x30')][_0x5267('0x1d')]);_0x1fa725[_0x5267('0x1b')]=qs[_0x5267('0x1b')](_0xbe7922[_0x5267('0x30')][_0x5267('0x1b')]);}_0x1fa725['order']=qs[_0x5267('0x37')](_0xbe7922[_0x5267('0x30')][_0x5267('0x37')]);_0x1fa725[_0x5267('0x38')]=qs[_0x5267('0x39')](_[_0x5267('0x3a')](_0xbe7922[_0x5267('0x30')],_0x5bec7e['filters']),_0x2249a1);if(_0xbe7922[_0x5267('0x30')]['filter']){_0x1fa725[_0x5267('0x38')]=_['merge'](_0x1fa725['where'],{'$or':_['map'](_0x2249a1,function(_0x46bfcc){if(_0x46bfcc['type']!==_0x5267('0x3b')){var _0x146476={};_0x146476[_0x46bfcc[_0x5267('0x28')]]={'$like':'%'+_0xbe7922[_0x5267('0x30')]['filter']+'%'};return _0x146476;}})});}_0x1fa725=_[_0x5267('0x3c')]({},_0x1fa725,_0xbe7922[_0x5267('0x3d')]);var _0x588edf={'where':_0x1fa725['where']};return db[_0x5267('0x2a')]['count'](_0x588edf)[_0x5267('0x25')](function(_0x1cf94a){_0x59b091[_0x5267('0x1e')]=_0x1cf94a;if(_0xbe7922[_0x5267('0x30')][_0x5267('0x3e')]){_0x1fa725[_0x5267('0x3f')]=[{'all':!![]}];}return db[_0x5267('0x2a')]['findAll'](_0x1fa725);})['then'](function(_0x28ea4a){_0x59b091['rows']=_0x28ea4a;return _0x59b091;})[_0x5267('0x25')](respondWithFilteredResult(_0x3ef2a8,_0x1fa725))[_0x5267('0x40')](handleError(_0x3ef2a8,null));};exports['show']=function(_0x1fa925,_0xc764cd){var _0x299a13={'raw':!![],'where':{'id':_0x1fa925[_0x5267('0x41')]['id']}},_0x161fed={};_0x161fed[_0x5267('0x2f')]=_[_0x5267('0x31')](db[_0x5267('0x2a')][_0x5267('0x2b')]);_0x161fed['query']=_[_0x5267('0x31')](_0x1fa925[_0x5267('0x30')]);_0x161fed[_0x5267('0x39')]=_[_0x5267('0x32')](_0x161fed[_0x5267('0x2f')],_0x161fed['query']);_0x299a13[_0x5267('0x33')]=_['intersection'](_0x161fed[_0x5267('0x2f')],qs['fields'](_0x1fa925['query'][_0x5267('0x34')]));_0x299a13['attributes']=_0x299a13[_0x5267('0x33')][_0x5267('0x35')]?_0x299a13[_0x5267('0x33')]:_0x161fed[_0x5267('0x2f')];if(_0x1fa925['query'][_0x5267('0x3e')]){_0x299a13['include']=[{'all':!![]}];}_0x299a13=_['merge']({},_0x299a13,_0x1fa925[_0x5267('0x3d')]);return db[_0x5267('0x2a')]['find'](_0x299a13)['then'](handleEntityNotFound(_0xc764cd,null))[_0x5267('0x25')](respondWithResult(_0xc764cd,null))[_0x5267('0x40')](handleError(_0xc764cd,null));};exports[_0x5267('0x42')]=function(_0x1b5a7e,_0x1c2803){return db[_0x5267('0x2a')][_0x5267('0x42')](_0x1b5a7e[_0x5267('0x43')],{})[_0x5267('0x25')](function(_0x2cfe09){var _0x21b040=_0x1b5a7e[_0x5267('0x44')][_0x5267('0x26')]({'plain':!![]});if(!_0x21b040)throw new Error(_0x5267('0x45'));if(_0x21b040['role']===_0x5267('0x44')){var _0x466d46=_0x2cfe09[_0x5267('0x26')]({'plain':!![]});var _0x4f0148=_0x5267('0x46');return db[_0x5267('0x47')][_0x5267('0x48')]({'where':{'name':_0x4f0148,'userProfileId':_0x21b040[_0x5267('0x49')]},'raw':!![]})[_0x5267('0x25')](function(_0x1457cf){if(_0x1457cf&&_0x1457cf['autoAssociation']===0x0){return db[_0x5267('0x4a')]['create']({'name':_0x466d46[_0x5267('0x28')],'resourceId':_0x466d46['id'],'type':_0x5267('0x27'),'sectionId':_0x1457cf['id']},{})[_0x5267('0x25')](function(){return _0x2cfe09;});}else{return _0x2cfe09;}})[_0x5267('0x40')](function(_0x91b932){logger[_0x5267('0x4b')](_0x5267('0x4c'),_0x91b932);throw _0x91b932;});}return _0x2cfe09;})['then'](respondWithResult(_0x1c2803,0xc9))['catch'](handleError(_0x1c2803,null));};exports[_0x5267('0x4d')]=function(_0x15b5c9,_0x566b6f){if(_0x15b5c9[_0x5267('0x43')]['id']){delete _0x15b5c9['body']['id'];}return db['AnalyticDefaultReport'][_0x5267('0x48')]({'where':{'id':_0x15b5c9[_0x5267('0x41')]['id']}})[_0x5267('0x25')](handleEntityNotFound(_0x566b6f,null))[_0x5267('0x25')](saveUpdates(_0x15b5c9[_0x5267('0x43')],null))[_0x5267('0x25')](respondWithResult(_0x566b6f,null))[_0x5267('0x40')](handleError(_0x566b6f,null));};exports[_0x5267('0x24')]=function(_0xf0b5a9,_0x43d254){return db['AnalyticDefaultReport'][_0x5267('0x48')]({'where':{'id':_0xf0b5a9[_0x5267('0x41')]['id']}})[_0x5267('0x25')](handleEntityNotFound(_0x43d254,null))[_0x5267('0x25')](removeEntity(_0x43d254,null))[_0x5267('0x40')](handleError(_0x43d254,null));};exports[_0x5267('0x4e')]=function(_0x552211,_0x195575){var _0x5ad1ce=0xa;var _0x1522d6=[_0x5267('0x4f'),_0x5267('0x50'),'right_join',_0x5267('0x51')];var _0x161dab={'SUM':_0x5267('0x52'),'COUNT':_0x5267('0x53'),'COUNT DISTINCT':_0x5267('0x54'),'MAX':_0x5267('0x55'),'MIN':'MIN(%s)','AVG':_0x5267('0x56'),'GROUP_CONCAT':_0x5267('0x57'),'GROUP_CONCAT ASC':_0x5267('0x58'),'GROUP_CONCAT DESC':_0x5267('0x59')};var _0x51220c={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x5267('0x5a'),'HOUR':'HOUR(%s)','ROUND':_0x5267('0x5b'),'UNIX_TIMESTAMP':_0x5267('0x5c')};var _0x4e3771=function(_0x489780){return!_[_0x5267('0x5d')]([_0x5267('0x5e'),_0x5267('0x5f'),'IS\x20EMPTY',_0x5267('0x60')],_0x489780);};var _0xc88193=function(_0x293e61){if(!_0x293e61||!_0x293e61[_0x5267('0x61')]['length']){return'';}for(var _0x5a87b5='(',_0x540ab8=0x0;_0x540ab8<_0x293e61[_0x5267('0x61')][_0x5267('0x35')];_0x540ab8+=0x1){_0x540ab8>0x0&&(_0x5a87b5+='\x20'+_0x293e61[_0x5267('0x62')]+'\x20');_0x5a87b5+=_0x293e61[_0x5267('0x61')][_0x540ab8][_0x5267('0x63')]?_0xc88193(_0x293e61[_0x5267('0x61')][_0x540ab8][_0x5267('0x63')]):_0x293e61[_0x5267('0x61')][_0x540ab8]['field']+'\x20'+_0x293e61[_0x5267('0x61')][_0x540ab8][_0x5267('0x64')]+(_0x4e3771(_0x293e61['rules'][_0x540ab8][_0x5267('0x64')])?'\x20'+_0x293e61[_0x5267('0x61')][_0x540ab8][_0x5267('0x65')]:'');}return _0x5a87b5+')';};var _0x1b6dd7={'where':{'id':_0x552211[_0x5267('0x41')]['id']}},_0x19adf5,_0xde1ecd,_0x4915f4,_0x2ca259,_0x726410;_0x1b6dd7=_[_0x5267('0x3c')]({},_0x1b6dd7,_0x552211[_0x5267('0x3d')]);return db[_0x5267('0x2a')]['find'](_0x1b6dd7)[_0x5267('0x25')](function(_0x87465){if(_0x87465){_0x19adf5=_0x87465;return _0x87465[_0x5267('0x66')]();}return null;})[_0x5267('0x25')](function(_0x1a4016){if(_0x1a4016){if(!_0x1a4016[_0x5267('0x35')]){throw new db['Sequelize'][(_0x5267('0x67'))](_0x5267('0x68'),0x193);}_0xde1ecd=_0x1a4016;return db[_0x5267('0x69')][_0x5267('0x6a')]({'raw':!![]});}return null;})['then'](function(_0x516e6e){if(_0x516e6e){_0x4915f4=_['keyBy'](_0x516e6e,'id');var _0x910f97;var _0x5cca85=squel[_0x5267('0x6b')]();_0x5cca85['from'](_0x19adf5[_0x5267('0x6c')]);for(var _0x1150ba=0x0;_0x1150ba<_0xde1ecd[_0x5267('0x35')];_0x1150ba+=0x1){_0x910f97=_0xde1ecd[_0x1150ba][_0x5267('0x6d')]?_0x4915f4[_0xde1ecd[_0x1150ba][_0x5267('0x6d')]][_0x5267('0x6e')]:_0xde1ecd[_0x1150ba][_0x5267('0x6f')];_0x910f97=_0xde1ecd[_0x1150ba][_0x5267('0x70')]?_['replace'](_0x161dab[_0xde1ecd[_0x1150ba]['function']],'%s',_0x910f97):_0x910f97;_0x910f97=_0xde1ecd[_0x1150ba]['format']?_[_0x5267('0x71')](_0x51220c[_0xde1ecd[_0x1150ba][_0x5267('0x72')]],'%s',_0x910f97):_0x910f97;if(_0xde1ecd[_0x1150ba][_0x5267('0x73')]){_0x5cca85[_0x5267('0x63')](_0x910f97);}_0xde1ecd[_0x1150ba]['orderBy']&&_0x5cca85[_0x5267('0x74')](_0x910f97,_0xde1ecd[_0x1150ba][_0x5267('0x75')]===_0x5267('0x76')?![]:!![]);_0x5cca85[_0x5267('0x6f')](_0x910f97,_0xde1ecd[_0x1150ba]['alias']||_0x910f97);}if(_0x19adf5[_0x5267('0x77')]){_0x19adf5[_0x5267('0x77')]=JSON['parse'](_0x19adf5[_0x5267('0x77')]);for(var _0x268805=0x0;_0x268805<_0x19adf5['joins']['length'];_0x268805+=0x1){if(_0x19adf5[_0x5267('0x77')][_0x268805][_0x5267('0x2d')]&&_['includes'](_0x1522d6,_0x19adf5['joins'][_0x268805][_0x5267('0x2d')])&&_0x19adf5[_0x5267('0x77')][_0x268805][_0x5267('0x78')]&&_0x19adf5[_0x5267('0x77')][_0x268805][_0x5267('0x79')]&&_0x19adf5['joins'][_0x268805][_0x5267('0x7a')]){_0x5cca85[_0x19adf5[_0x5267('0x77')][_0x268805]['type']](_0x19adf5[_0x5267('0x77')][_0x268805][_0x5267('0x79')],null,util[_0x5267('0x72')](_0x5267('0x7b'),_0x19adf5[_0x5267('0x6c')],_0x19adf5[_0x5267('0x77')][_0x268805][_0x5267('0x78')],_0x19adf5[_0x5267('0x77')][_0x268805]['foreignTable'],_0x19adf5['joins'][_0x268805][_0x5267('0x7a')]));}}}if(_0x19adf5[_0x5267('0x7c')]){_0x19adf5[_0x5267('0x7c')]=JSON[_0x5267('0x7d')](_0x19adf5['conditions']);_0x5cca85[_0x5267('0x38')](_0xc88193(_0x19adf5['conditions'][_0x5267('0x63')]));}_0x726410=_0x5cca85[_0x5267('0x7e')]();_0x5cca85[_0x5267('0x1d')](_0x5ad1ce);_0x5cca85[_0x5267('0x1b')](0x0);logger['debug']('Limited\x20Query:',_0x5cca85[_0x5267('0x7f')]());return dbH[_0x5267('0x80')][_0x5267('0x30')](_0x5cca85[_0x5267('0x7f')](),{'type':dbH[_0x5267('0x80')][_0x5267('0x81')]['SELECT']});}})[_0x5267('0x25')](respondWithResult(_0x195575,null))['catch'](handleError(_0x195575,null));};function runReport(_0x418a03,_0x5b8026,_0x2c2b95){var _0x20888d=_0x5b8026[_0x5267('0x28')];var _0x87aa90=0xa;var _0x164cc1=[_0x5267('0x4f'),_0x5267('0x50'),_0x5267('0x82'),_0x5267('0x51')];var _0x28e4b6={'SUM':_0x5267('0x52'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x5267('0x54'),'MAX':_0x5267('0x55'),'MIN':'MIN(%s)','AVG':_0x5267('0x56'),'GROUP_CONCAT':_0x5267('0x57'),'GROUP_CONCAT ASC':_0x5267('0x58'),'GROUP_CONCAT DESC':_0x5267('0x59')};var _0xd18795={'SEC_TO_TIME':_0x5267('0x83'),'DATE':_0x5267('0x5a'),'HOUR':'HOUR(%s)','ROUND':_0x5267('0x5b'),'UNIX_TIMESTAMP':_0x5267('0x5c')};var _0x2543a4=function(_0x2feea8){return!_[_0x5267('0x5d')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x5267('0x84'),_0x5267('0x60')],_0x2feea8);};var _0x199ff6=function(_0xbf36fb){if(!_0xbf36fb||!_0xbf36fb['rules'][_0x5267('0x35')]){return'';}for(var _0x3cc775='(',_0x2630f2=0x0;_0x2630f2<_0xbf36fb[_0x5267('0x61')][_0x5267('0x35')];_0x2630f2+=0x1){_0x2630f2>0x0&&(_0x3cc775+='\x20'+_0xbf36fb[_0x5267('0x62')]+'\x20');_0x3cc775+=_0xbf36fb[_0x5267('0x61')][_0x2630f2][_0x5267('0x63')]?_0x199ff6(_0xbf36fb[_0x5267('0x61')][_0x2630f2][_0x5267('0x63')]):_0xbf36fb[_0x5267('0x61')][_0x2630f2][_0x5267('0x6f')]+'\x20'+_0xbf36fb[_0x5267('0x61')][_0x2630f2]['condition']+(_0x2543a4(_0xbf36fb[_0x5267('0x61')][_0x2630f2][_0x5267('0x64')])?'\x20'+_0xbf36fb[_0x5267('0x61')][_0x2630f2][_0x5267('0x65')]:'');}return _0x3cc775+')';};var _0x447b5f={'where':{'id':_0x418a03['id']}},_0x25ce90,_0x257c69,_0x160c9c,_0x42694a,_0x11a2f4;_0x447b5f=_[_0x5267('0x3c')]({},_0x447b5f,_0x2c2b95);return db[_0x5267('0x2a')][_0x5267('0x48')](_0x447b5f)[_0x5267('0x25')](function(_0x35c3b7){if(_0x35c3b7){_0x25ce90=_0x35c3b7;return _0x35c3b7[_0x5267('0x66')]();}return null;})[_0x5267('0x25')](function(_0x35a4a3){if(_0x35a4a3){if(!_0x35a4a3[_0x5267('0x35')]){throw new db[(_0x5267('0x85'))][(_0x5267('0x67'))](_0x5267('0x68'),0x193);}_0x257c69=_0x35a4a3;return db[_0x5267('0x69')]['findAll']({'raw':!![]});}return null;})[_0x5267('0x25')](function(_0x318393){if(_0x318393){_0x160c9c=_[_0x5267('0x86')](_0x318393,'id');var _0x405eb4;var _0x38f5b7=squel['select']();_0x38f5b7[_0x5267('0x87')](_0x25ce90[_0x5267('0x6c')]);for(var _0x4c68cd=0x0;_0x4c68cd<_0x257c69['length'];_0x4c68cd+=0x1){_0x405eb4=_0x257c69[_0x4c68cd]['MetricId']?_0x160c9c[_0x257c69[_0x4c68cd][_0x5267('0x6d')]]['metric']:_0x257c69[_0x4c68cd][_0x5267('0x6f')];_0x405eb4=_0x257c69[_0x4c68cd]['function']?_['replace'](_0x28e4b6[_0x257c69[_0x4c68cd][_0x5267('0x70')]],'%s',_0x405eb4):_0x405eb4;_0x405eb4=_0x257c69[_0x4c68cd][_0x5267('0x72')]?_[_0x5267('0x71')](_0xd18795[_0x257c69[_0x4c68cd][_0x5267('0x72')]],'%s',_0x405eb4):_0x405eb4;if(_0x257c69[_0x4c68cd][_0x5267('0x73')]){_0x38f5b7['group'](_0x405eb4);}_0x257c69[_0x4c68cd]['orderBy']&&_0x38f5b7[_0x5267('0x74')](_0x405eb4,_0x257c69[_0x4c68cd][_0x5267('0x75')]===_0x5267('0x76')?![]:!![]);_0x38f5b7[_0x5267('0x6f')](_0x405eb4,_0x257c69[_0x4c68cd][_0x5267('0x88')]||_0x405eb4);}if(_0x25ce90['joins']){_0x25ce90[_0x5267('0x77')]=JSON['parse'](_0x25ce90['joins']);for(var _0x3dfd8d=0x0;_0x3dfd8d<_0x25ce90['joins']['length'];_0x3dfd8d+=0x1){if(_0x25ce90[_0x5267('0x77')][_0x3dfd8d][_0x5267('0x2d')]&&_['includes'](_0x164cc1,_0x25ce90['joins'][_0x3dfd8d]['type'])&&_0x25ce90[_0x5267('0x77')][_0x3dfd8d]['parentKey']&&_0x25ce90[_0x5267('0x77')][_0x3dfd8d]['foreignTable']&&_0x25ce90[_0x5267('0x77')][_0x3dfd8d][_0x5267('0x7a')]){_0x38f5b7[_0x25ce90['joins'][_0x3dfd8d][_0x5267('0x2d')]](_0x25ce90[_0x5267('0x77')][_0x3dfd8d][_0x5267('0x79')],null,util[_0x5267('0x72')](_0x5267('0x7b'),_0x25ce90[_0x5267('0x6c')],_0x25ce90['joins'][_0x3dfd8d]['parentKey'],_0x25ce90[_0x5267('0x77')][_0x3dfd8d]['foreignTable'],_0x25ce90['joins'][_0x3dfd8d][_0x5267('0x7a')]));}}}if(_0x25ce90['conditions']){_0x25ce90[_0x5267('0x7c')]=JSON['parse'](_0x25ce90[_0x5267('0x7c')]);_0x38f5b7['where'](_0x199ff6(_0x25ce90[_0x5267('0x7c')][_0x5267('0x63')]));}_0x11a2f4=_0x38f5b7[_0x5267('0x7e')]();_0x38f5b7[_0x5267('0x1d')](_0x87aa90);_0x38f5b7[_0x5267('0x1b')](0x0);return;}})[_0x5267('0x25')](function(){if(_0x5b8026[_0x5267('0x89')]==='web'){return null;}var _0x4df99f=_[_0x5267('0x3c')](_0x5b8026,{'name':_0x5b8026['fullPath']||_0x5b8026['name']||_0x25ce90['name'],'basename':_0x20888d,'savename':util['format']('%s-%s.%s',_0x5b8026['name']||_0x25ce90[_0x5267('0x28')],require(_0x5267('0x8a'))[_0x5267('0x8b')](0x4),_0x5b8026[_0x5267('0x89')]||_0x5267('0x8c')),'reportId':_0x25ce90['id'],'reportType':_0x5267('0x8d')});return db[_0x5267('0x8e')][_0x5267('0x42')](_0x4df99f,{'raw':!![]});})['then'](function(_0x5df23d){if(_0x25ce90['table']===_0x5267('0x8f')){_0x11a2f4[_0x5267('0x38')](_0x25ce90['table']+_0x5267('0x90'),_0x5b8026[_0x5267('0x91')],_0x5b8026[_0x5267('0x92')]);}else{_0x11a2f4[_0x5267('0x38')](_0x25ce90['table']+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x5b8026[_0x5267('0x91')],_0x5b8026[_0x5267('0x92')]);}if(_0x5df23d){logger[_0x5267('0x93')](_0x5267('0x94'),_0x11a2f4[_0x5267('0x7f')]());require(_0x5267('0x95'))[_0x5267('0x96')](path['join'](__dirname,'../../components/export/',_0x5df23d['output']),[_0x5df23d['id'],_0x11a2f4[_0x5267('0x7f')](),path[_0x5267('0x4f')](__dirname,_0x5267('0x97'),_0x5df23d[_0x5267('0x98')]),_0x20888d]);return _0x5df23d;}else{var _0x190ef4=squel[_0x5267('0x6b')]();_0x190ef4['from']('('+_0x11a2f4[_0x5267('0x7f')]()+')','countTable');_0x190ef4[_0x5267('0x6f')](_0x5267('0x99'),_0x5267('0x1e'));_0x11a2f4[_0x5267('0x1d')](_0x5b8026[_0x5267('0x1d')]||_0x87aa90);_0x11a2f4['offset'](_0x5b8026[_0x5267('0x1b')]||0x0);return dbH[_0x5267('0x80')][_0x5267('0x30')](_0x190ef4['toString'](),{'type':dbH['sequelize']['QueryTypes'][_0x5267('0x9a')]})[_0x5267('0x25')](function(_0x1be763){if(!_0x1be763[_0x5267('0x35')]){_0x42694a=0x0;}else{_0x42694a=_0x1be763[0x0]['count']||0x0;}return dbH['sequelize'][_0x5267('0x30')](_0x11a2f4[_0x5267('0x7f')](),{'type':dbH['sequelize'][_0x5267('0x81')][_0x5267('0x9a')]});})['then'](function(_0x5005b3){return{'rows':_0x5005b3||[],'count':_0x42694a};});}});}exports[_0x5267('0x9b')]=function(_0x11a6f4,_0x5a16ee){return runReport(_0x11a6f4[_0x5267('0x41')],_0x11a6f4[_0x5267('0x30')],_0x11a6f4[_0x5267('0x3d')])[_0x5267('0x25')](respondWithResult(_0x5a16ee,null))[_0x5267('0x40')](handleError(_0x5a16ee,null));};exports[_0x5267('0x9c')]=runReport;exports[_0x5267('0x30')]=function(_0x1e9651,_0x66da7a){var _0x54b582=0xa;var _0x4e4724=[_0x5267('0x4f'),'left_join',_0x5267('0x82'),_0x5267('0x51')];var _0x2722f9={'SUM':_0x5267('0x52'),'COUNT':_0x5267('0x53'),'COUNT DISTINCT':_0x5267('0x54'),'MAX':_0x5267('0x55'),'MIN':_0x5267('0x9d'),'AVG':_0x5267('0x56'),'GROUP_CONCAT':_0x5267('0x57'),'GROUP_CONCAT ASC':_0x5267('0x58'),'GROUP_CONCAT DESC':_0x5267('0x59')};var _0x5909b3={'SEC_TO_TIME':_0x5267('0x83'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0x5267('0x5b'),'UNIX_TIMESTAMP':_0x5267('0x5c')};var _0x1d7987=function(_0x59efe1){return!_[_0x5267('0x5d')]([_0x5267('0x5e'),_0x5267('0x5f'),_0x5267('0x84'),_0x5267('0x60')],_0x59efe1);};var _0x46c79e=function(_0xcfba51){if(!_0xcfba51||!_0xcfba51[_0x5267('0x61')][_0x5267('0x35')]){return'';}for(var _0x3c5516='(',_0x1e8367=0x0;_0x1e8367<_0xcfba51[_0x5267('0x61')]['length'];_0x1e8367+=0x1){_0x1e8367>0x0&&(_0x3c5516+='\x20'+_0xcfba51[_0x5267('0x62')]+'\x20');_0x3c5516+=_0xcfba51[_0x5267('0x61')][_0x1e8367]['group']?_0x46c79e(_0xcfba51[_0x5267('0x61')][_0x1e8367][_0x5267('0x63')]):_0xcfba51[_0x5267('0x61')][_0x1e8367][_0x5267('0x6f')]+'\x20'+_0xcfba51['rules'][_0x1e8367][_0x5267('0x64')]+(_0x1d7987(_0xcfba51[_0x5267('0x61')][_0x1e8367][_0x5267('0x64')])?'\x20'+_0xcfba51['rules'][_0x1e8367][_0x5267('0x65')]:'');}return _0x3c5516+')';};var _0x19935d={'where':{'id':_0x1e9651[_0x5267('0x41')]['id']}},_0x3102e0,_0x2d215e,_0xc0af94,_0x178080,_0x3485ab;_0x19935d=_[_0x5267('0x3c')]({},_0x19935d,_0x1e9651['options']);return db[_0x5267('0x2a')][_0x5267('0x48')](_0x19935d)['then'](function(_0x17d2d4){if(_0x17d2d4){_0x3102e0=_0x17d2d4;return _0x17d2d4['getFields']();}return null;})[_0x5267('0x25')](function(_0x4c5a26){if(_0x4c5a26){if(!_0x4c5a26[_0x5267('0x35')]){throw new db[(_0x5267('0x85'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x2d215e=_0x4c5a26;return db[_0x5267('0x69')][_0x5267('0x6a')]({'raw':!![]});}return null;})[_0x5267('0x25')](function(_0x1a0883){if(_0x1a0883){_0xc0af94=_[_0x5267('0x86')](_0x1a0883,'id');var _0x501da6;var _0x3dcf73=squel['select']();_0x3dcf73['from'](_0x3102e0['table']);for(var _0x1ded05=0x0;_0x1ded05<_0x2d215e[_0x5267('0x35')];_0x1ded05+=0x1){_0x501da6=_0x2d215e[_0x1ded05][_0x5267('0x6d')]?_0xc0af94[_0x2d215e[_0x1ded05][_0x5267('0x6d')]][_0x5267('0x6e')]:_0x2d215e[_0x1ded05][_0x5267('0x6f')];_0x501da6=_0x2d215e[_0x1ded05][_0x5267('0x70')]?_['replace'](_0x2722f9[_0x2d215e[_0x1ded05]['function']],'%s',_0x501da6):_0x501da6;_0x501da6=_0x2d215e[_0x1ded05][_0x5267('0x72')]?_[_0x5267('0x71')](_0x5909b3[_0x2d215e[_0x1ded05][_0x5267('0x72')]],'%s',_0x501da6):_0x501da6;if(_0x2d215e[_0x1ded05][_0x5267('0x73')]){_0x3dcf73[_0x5267('0x63')](_0x501da6);}_0x2d215e[_0x1ded05]['orderBy']&&_0x3dcf73[_0x5267('0x74')](_0x501da6,_0x2d215e[_0x1ded05][_0x5267('0x75')]===_0x5267('0x76')?![]:!![]);_0x3dcf73[_0x5267('0x6f')](_0x501da6,_0x2d215e[_0x1ded05][_0x5267('0x88')]||_0x501da6);}if(_0x3102e0['joins']){_0x3102e0[_0x5267('0x77')]=JSON[_0x5267('0x7d')](_0x3102e0[_0x5267('0x77')]);for(var _0x4bfafd=0x0;_0x4bfafd<_0x3102e0[_0x5267('0x77')]['length'];_0x4bfafd+=0x1){if(_0x3102e0[_0x5267('0x77')][_0x4bfafd][_0x5267('0x2d')]&&_['includes'](_0x4e4724,_0x3102e0[_0x5267('0x77')][_0x4bfafd]['type'])&&_0x3102e0[_0x5267('0x77')][_0x4bfafd][_0x5267('0x78')]&&_0x3102e0['joins'][_0x4bfafd][_0x5267('0x79')]&&_0x3102e0[_0x5267('0x77')][_0x4bfafd]['foreignKey']){_0x3dcf73[_0x3102e0[_0x5267('0x77')][_0x4bfafd][_0x5267('0x2d')]](_0x3102e0[_0x5267('0x77')][_0x4bfafd][_0x5267('0x79')],null,util[_0x5267('0x72')]('%s.%s\x20=\x20%s.%s',_0x3102e0['table'],_0x3102e0[_0x5267('0x77')][_0x4bfafd][_0x5267('0x78')],_0x3102e0['joins'][_0x4bfafd][_0x5267('0x79')],_0x3102e0['joins'][_0x4bfafd][_0x5267('0x7a')]));}}}if(_0x3102e0[_0x5267('0x7c')]){_0x3102e0[_0x5267('0x7c')]=JSON[_0x5267('0x7d')](_0x3102e0[_0x5267('0x7c')]);_0x3dcf73[_0x5267('0x38')](_0x46c79e(_0x3102e0[_0x5267('0x7c')][_0x5267('0x63')]));}_0x3485ab=_0x3dcf73[_0x5267('0x7e')]();_0x3dcf73[_0x5267('0x1d')](_0x54b582);_0x3dcf73[_0x5267('0x1b')](0x0);logger[_0x5267('0x9e')]('Limited\x20Query:',_0x3dcf73[_0x5267('0x7f')]());return dbH[_0x5267('0x80')][_0x5267('0x30')](_0x3dcf73[_0x5267('0x7f')](),{'type':dbH[_0x5267('0x80')][_0x5267('0x81')][_0x5267('0x9a')]});}})[_0x5267('0x25')](function(){return{'sql':_0x3485ab[_0x5267('0x7f')]()};})[_0x5267('0x25')](respondWithResult(_0x66da7a,null))[_0x5267('0x40')](handleError(_0x66da7a,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 264d171..bc6e601 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 _0x2468=['analytics_default_reports','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','AnalyticDefaultReport'];(function(_0x18392d,_0x1646af){var _0x300409=function(_0x352c54){while(--_0x352c54){_0x18392d['push'](_0x18392d['shift']());}};_0x300409(++_0x1646af);}(_0x2468,0x145));var _0x8246=function(_0x3f5dca,_0x59472b){_0x3f5dca=_0x3f5dca-0x0;var _0x5b833a=_0x2468[_0x3f5dca];return _0x5b833a;};'use strict';var _=require(_0x8246('0x0'));var util=require('util');var logger=require(_0x8246('0x1'))(_0x8246('0x2'));var moment=require(_0x8246('0x3'));var BPromise=require(_0x8246('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8246('0x5'));var rimraf=require(_0x8246('0x6'));var config=require(_0x8246('0x7'));var attributes=require(_0x8246('0x8'));module[_0x8246('0x9')]=function(_0x737d2f,_0x4b830d){return _0x737d2f['define'](_0x8246('0xa'),attributes,{'tableName':_0x8246('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x73b3=['../../config/environment','./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport','analytics_default_reports','lodash','moment','bluebird','path','rimraf'];(function(_0x53c26d,_0x4ad64e){var _0x5727d6=function(_0x3be8c5){while(--_0x3be8c5){_0x53c26d['push'](_0x53c26d['shift']());}};_0x5727d6(++_0x4ad64e);}(_0x73b3,0xa0));var _0x373b=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0x73b3[_0x2576d7];return _0x16a08c;};'use strict';var _=require(_0x373b('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x373b('0x1'));var BPromise=require(_0x373b('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x373b('0x3'));var rimraf=require(_0x373b('0x4'));var config=require(_0x373b('0x5'));var attributes=require(_0x373b('0x6'));module[_0x373b('0x7')]=function(_0x3d5d06,_0x47fee7){return _0x3d5d06[_0x373b('0x8')](_0x373b('0x9'),attributes,{'tableName':_0x373b('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 0634619..b02476d 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 _0x8f5a=['AnalyticDefaultReport,\x20%s,\x20%s','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','info'];(function(_0x493b42,_0x3161e5){var _0x1ab527=function(_0x54ec08){while(--_0x54ec08){_0x493b42['push'](_0x493b42['shift']());}};_0x1ab527(++_0x3161e5);}(_0x8f5a,0x138));var _0xa8f5=function(_0x4760a0,_0x1d1ee2){_0x4760a0=_0x4760a0-0x0;var _0x5d7ebc=_0x8f5a[_0x4760a0];return _0x5d7ebc;};'use strict';var _=require(_0xa8f5('0x0'));var util=require(_0xa8f5('0x1'));var moment=require(_0xa8f5('0x2'));var BPromise=require(_0xa8f5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa8f5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa8f5('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xa8f5('0x6'));var jayson=require(_0xa8f5('0x7'));var client=jayson[_0xa8f5('0x8')][_0xa8f5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2f8cd4,_0x22d627,_0xc4165b){return new BPromise(function(_0xaee3a1,_0x2adf97){return client['request'](_0x2f8cd4,_0xc4165b)['then'](function(_0x450fbb){logger[_0xa8f5('0xa')](_0xa8f5('0xb'),_0x22d627,'request\x20sent');logger['debug'](_0xa8f5('0xc'),_0x22d627,_0xa8f5('0xd'),JSON[_0xa8f5('0xe')](_0x450fbb));if(_0x450fbb[_0xa8f5('0xf')]){if(_0x450fbb['error'][_0xa8f5('0x10')]===0x1f4){logger['error']('AnalyticDefaultReport,\x20%s,\x20%s',_0x22d627,_0x450fbb[_0xa8f5('0xf')][_0xa8f5('0x11')]);return _0x2adf97(_0x450fbb[_0xa8f5('0xf')][_0xa8f5('0x11')]);}logger['error'](_0xa8f5('0xb'),_0x22d627,_0x450fbb[_0xa8f5('0xf')][_0xa8f5('0x11')]);return _0xaee3a1(_0x450fbb[_0xa8f5('0xf')][_0xa8f5('0x11')]);}else{logger[_0xa8f5('0xa')](_0xa8f5('0xb'),_0x22d627,_0xa8f5('0xd'));_0xaee3a1(_0x450fbb['result'][_0xa8f5('0x11')]);}})[_0xa8f5('0x12')](function(_0x58fec7){logger[_0xa8f5('0xf')](_0xa8f5('0xb'),_0x22d627,_0x58fec7);_0x2adf97(_0x58fec7);});});} \ No newline at end of file +var _0x5b18=['result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','then','info','AnalyticDefaultReport,\x20%s,\x20%s','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x40dabf,_0x1b7cd9){var _0x14544f=function(_0x248e26){while(--_0x248e26){_0x40dabf['push'](_0x40dabf['shift']());}};_0x14544f(++_0x1b7cd9);}(_0x5b18,0xb2));var _0x85b1=function(_0x5756f8,_0x22b6d5){_0x5756f8=_0x5756f8-0x0;var _0x3bb749=_0x5b18[_0x5756f8];return _0x3bb749;};'use strict';var _=require(_0x85b1('0x0'));var util=require('util');var moment=require(_0x85b1('0x1'));var BPromise=require(_0x85b1('0x2'));var rs=require(_0x85b1('0x3'));var fs=require('fs');var Redis=require(_0x85b1('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x85b1('0x5'))(_0x85b1('0x6'));var config=require(_0x85b1('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x85b1('0x8')][_0x85b1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x595800,_0x394d14,_0x5470a1){return new BPromise(function(_0x293847,_0x33d21d){return client['request'](_0x595800,_0x5470a1)[_0x85b1('0xa')](function(_0x3eed96){logger[_0x85b1('0xb')](_0x85b1('0xc'),_0x394d14,'request\x20sent');logger[_0x85b1('0xd')](_0x85b1('0xe'),_0x394d14,_0x85b1('0xf'),JSON[_0x85b1('0x10')](_0x3eed96));if(_0x3eed96[_0x85b1('0x11')]){if(_0x3eed96[_0x85b1('0x11')][_0x85b1('0x12')]===0x1f4){logger[_0x85b1('0x11')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x394d14,_0x3eed96[_0x85b1('0x11')]['message']);return _0x33d21d(_0x3eed96[_0x85b1('0x11')]['message']);}logger[_0x85b1('0x11')](_0x85b1('0xc'),_0x394d14,_0x3eed96[_0x85b1('0x11')][_0x85b1('0x13')]);return _0x293847(_0x3eed96['error'][_0x85b1('0x13')]);}else{logger[_0x85b1('0xb')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x394d14,'request\x20sent');_0x293847(_0x3eed96[_0x85b1('0x14')][_0x85b1('0x13')]);}})[_0x85b1('0x15')](function(_0x12688c){logger[_0x85b1('0x11')](_0x85b1('0xc'),_0x394d14,_0x12688c);_0x33d21d(_0x12688c);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index d22d806..fae4bf8 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 _0xc00b=['put','update','delete','destroy','exports','multer','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','/:id/preview','run','post','create'];(function(_0x374fab,_0x32970f){var _0x3dc5c9=function(_0x5d1160){while(--_0x5d1160){_0x374fab['push'](_0x374fab['shift']());}};_0x3dc5c9(++_0x32970f);}(_0xc00b,0x1e5));var _0xbc00=function(_0x12a020,_0x85b476){_0x12a020=_0x12a020-0x0;var _0x63cddd=_0xc00b[_0x12a020];return _0x63cddd;};'use strict';var multer=require(_0xbc00('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbc00('0x1'));var router=express['Router']();var fs_extra=require(_0xbc00('0x2'));var auth=require(_0xbc00('0x3'));var interaction=require(_0xbc00('0x4'));var config=require(_0xbc00('0x5'));var controller=require('./analyticDefaultReport.controller');router[_0xbc00('0x6')]('/',auth['isAuthenticated'](),controller[_0xbc00('0x7')]);router['get'](_0xbc00('0x8'),auth[_0xbc00('0x9')](),controller[_0xbc00('0xa')]);router[_0xbc00('0x6')](_0xbc00('0xb'),auth[_0xbc00('0x9')](),controller['preview']);router[_0xbc00('0x6')]('/:id/run',auth[_0xbc00('0x9')](),controller[_0xbc00('0xc')]);router[_0xbc00('0x6')]('/:id/query',auth[_0xbc00('0x9')](),controller['query']);router[_0xbc00('0xd')]('/',auth['isAuthenticated'](),controller[_0xbc00('0xe')]);router[_0xbc00('0xf')](_0xbc00('0x8'),auth['isAuthenticated'](),controller[_0xbc00('0x10')]);router[_0xbc00('0x11')](_0xbc00('0x8'),auth['isAuthenticated'](),controller[_0xbc00('0x12')]);module[_0xbc00('0x13')]=router; \ No newline at end of file +var _0x2b1b=['preview','/:id/run','run','/:id/query','query','create','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../config/environment','./analyticDefaultReport.controller','get','/:id','isAuthenticated','/:id/preview'];(function(_0x201042,_0x50bd0a){var _0x17f363=function(_0x4d7519){while(--_0x4d7519){_0x201042['push'](_0x201042['shift']());}};_0x17f363(++_0x50bd0a);}(_0x2b1b,0x11f));var _0xb2b1=function(_0x1803c9,_0x4c7457){_0x1803c9=_0x1803c9-0x0;var _0x3b9840=_0x2b1b[_0x1803c9];return _0x3b9840;};'use strict';var multer=require(_0xb2b1('0x0'));var util=require(_0xb2b1('0x1'));var path=require(_0xb2b1('0x2'));var timeout=require('connect-timeout');var express=require(_0xb2b1('0x3'));var router=express[_0xb2b1('0x4')]();var fs_extra=require(_0xb2b1('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb2b1('0x6'));var controller=require(_0xb2b1('0x7'));router[_0xb2b1('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xb2b1('0x8')](_0xb2b1('0x9'),auth[_0xb2b1('0xa')](),controller['show']);router['get'](_0xb2b1('0xb'),auth[_0xb2b1('0xa')](),controller[_0xb2b1('0xc')]);router[_0xb2b1('0x8')](_0xb2b1('0xd'),auth[_0xb2b1('0xa')](),controller[_0xb2b1('0xe')]);router[_0xb2b1('0x8')](_0xb2b1('0xf'),auth['isAuthenticated'](),controller[_0xb2b1('0x10')]);router['post']('/',auth[_0xb2b1('0xa')](),controller[_0xb2b1('0x11')]);router[_0xb2b1('0x12')](_0xb2b1('0x9'),auth[_0xb2b1('0xa')](),controller[_0xb2b1('0x13')]);router[_0xb2b1('0x14')](_0xb2b1('0x9'),auth[_0xb2b1('0xa')](),controller[_0xb2b1('0x15')]);module[_0xb2b1('0x16')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index e22745e..795afd0 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 _0xd3c4=['pdf','xlsx','csv','DATE','Loading','ENUM','manual','scheduled','UNSIGNED','sequelize','moment','exports','STRING'];(function(_0x5e0ad7,_0x527a48){var _0x1da054=function(_0x2d040c){while(--_0x2d040c){_0x5e0ad7['push'](_0x5e0ad7['shift']());}};_0x1da054(++_0x527a48);}(_0xd3c4,0x1c3));var _0x4d3c=function(_0x1f7a55,_0x352d22){_0x1f7a55=_0x1f7a55-0x0;var _0x2a291b=_0xd3c4[_0x1f7a55];return _0x2a291b;};'use strict';var Sequelize=require(_0x4d3c('0x0'));var moment=require(_0x4d3c('0x1'));module[_0x4d3c('0x2')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize[_0x4d3c('0x3')],'allowNull':![]},'output':{'type':Sequelize['ENUM']('csv',_0x4d3c('0x4'),_0x4d3c('0x5')),'allowNull':![],'defaultValue':_0x4d3c('0x6')},'savename':{'type':Sequelize[_0x4d3c('0x3')],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize[_0x4d3c('0x7')]},'status':{'type':Sequelize[_0x4d3c('0x3')],'defaultValue':_0x4d3c('0x8')},'type':{'type':Sequelize[_0x4d3c('0x9')](_0x4d3c('0xa'),_0x4d3c('0xb')),'allowNull':![],'defaultValue':_0x4d3c('0xa')},'reportId':{'type':Sequelize['INTEGER'](0xb)[_0x4d3c('0xc')]},'reportType':{'type':Sequelize[_0x4d3c('0x3')]}}; \ No newline at end of file +var _0x727a=['manual','scheduled','INTEGER','moment','STRING','ENUM','csv','pdf','xlsx','DATE','Loading'];(function(_0x3b53d7,_0x2f2095){var _0x513d11=function(_0x369829){while(--_0x369829){_0x3b53d7['push'](_0x3b53d7['shift']());}};_0x513d11(++_0x2f2095);}(_0x727a,0x1e7));var _0xa727=function(_0x1860ee,_0x23372a){_0x1860ee=_0x1860ee-0x0;var _0x4d798d=_0x727a[_0x1860ee];return _0x4d798d;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xa727('0x0'));module['exports']={'name':{'type':Sequelize[_0xa727('0x1')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize[_0xa727('0x2')](_0xa727('0x3'),_0xa727('0x4'),_0xa727('0x5')),'allowNull':![],'defaultValue':_0xa727('0x3')},'savename':{'type':Sequelize[_0xa727('0x1')],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize[_0xa727('0x6')]},'status':{'type':Sequelize[_0xa727('0x1')],'defaultValue':_0xa727('0x7')},'type':{'type':Sequelize[_0xa727('0x2')](_0xa727('0x8'),_0xa727('0x9')),'allowNull':![],'defaultValue':_0xa727('0x8')},'reportId':{'type':Sequelize[_0xa727('0xa')](0xb)['UNSIGNED']},'reportType':{'type':Sequelize[_0xa727('0x1')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index c2a8c66..7c9fca9 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 _0xd653=['keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','include','rows','catch','show','params','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','basename','savename','output','join','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','download','root','server/files/reports','format','%s.%s','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','get','ExtractedReports','UserProfileResource','error','stack','name','send','index','AnalyticExtractedReport','rawAttributes','fieldName','key','map'];(function(_0x270f63,_0x4d27f6){var _0x2d7cd8=function(_0x377acf){while(--_0x377acf){_0x270f63['push'](_0x270f63['shift']());}};_0x2d7cd8(++_0x4d27f6);}(_0xd653,0x163));var _0x3d65=function(_0x350587,_0x11849d){_0x350587=_0x350587-0x0;var _0x329a56=_0xd653[_0x350587];return _0x329a56;};'use strict';var emlformat=require(_0x3d65('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3d65('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3d65('0x2'));var moment=require(_0x3d65('0x3'));var BPromise=require(_0x3d65('0x4'));var Mustache=require(_0x3d65('0x5'));var util=require(_0x3d65('0x6'));var path=require('path');var sox=require(_0x3d65('0x7'));var csv=require('to-csv');var ejs=require(_0x3d65('0x8'));var fs=require('fs');var fs_extra=require(_0x3d65('0x9'));var _=require('lodash');var squel=require(_0x3d65('0xa'));var crypto=require(_0x3d65('0xb'));var jsforce=require(_0x3d65('0xc'));var deskjs=require(_0x3d65('0xd'));var toCsv=require(_0x3d65('0xe'));var querystring=require(_0x3d65('0xf'));var Papa=require(_0x3d65('0x10'));var Redis=require(_0x3d65('0x11'));var authService=require(_0x3d65('0x12'));var qs=require(_0x3d65('0x13'));var as=require(_0x3d65('0x14'));var hardwareService=require(_0x3d65('0x15'));var logger=require(_0x3d65('0x16'))(_0x3d65('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x3d65('0x18'));var db=require(_0x3d65('0x19'))['db'];function respondWithStatusCode(_0x12e4fd,_0x49cd75){_0x49cd75=_0x49cd75||0xcc;return function(_0x29663c){if(_0x29663c){return _0x12e4fd[_0x3d65('0x1a')](_0x49cd75);}return _0x12e4fd[_0x3d65('0x1b')](_0x49cd75)[_0x3d65('0x1c')]();};}function respondWithResult(_0x4e53f0,_0x21f8b5){_0x21f8b5=_0x21f8b5||0xc8;return function(_0x2fc2b3){if(_0x2fc2b3){return _0x4e53f0[_0x3d65('0x1b')](_0x21f8b5)[_0x3d65('0x1d')](_0x2fc2b3);}};}function respondWithFilteredResult(_0x99e6e3,_0x15bcec){return function(_0x387955){if(_0x387955){var _0x103cab=typeof _0x15bcec[_0x3d65('0x1e')]===_0x3d65('0x1f')&&typeof _0x15bcec[_0x3d65('0x20')]==='undefined';var _0x83ef15=_0x387955[_0x3d65('0x21')];var _0x54c136=_0x103cab?0x0:_0x15bcec[_0x3d65('0x1e')];var _0x2049a7=_0x103cab?_0x387955['count']:_0x15bcec[_0x3d65('0x1e')]+_0x15bcec[_0x3d65('0x20')];var _0x33d95f;if(_0x2049a7>=_0x83ef15){_0x2049a7=_0x83ef15;_0x33d95f=0xc8;}else{_0x33d95f=0xce;}_0x99e6e3[_0x3d65('0x1b')](_0x33d95f);return _0x99e6e3[_0x3d65('0x22')](_0x3d65('0x23'),_0x54c136+'-'+_0x2049a7+'/'+_0x83ef15)[_0x3d65('0x1d')](_0x387955);}return null;};}function patchUpdates(_0x4ed88d){return function(_0x5e510d){try{jsonpatch[_0x3d65('0x24')](_0x5e510d,_0x4ed88d,!![]);}catch(_0x4c0061){return BPromise['reject'](_0x4c0061);}return _0x5e510d[_0x3d65('0x25')]();};}function saveUpdates(_0x22d480,_0x4e3b36){return function(_0x33146b){if(_0x33146b){return _0x33146b['update'](_0x22d480)[_0x3d65('0x26')](function(_0x44c07d){return _0x44c07d;});}return null;};}function removeEntity(_0x386dbf,_0x5b10ce){return function(_0x50b441){if(_0x50b441){return _0x50b441[_0x3d65('0x27')]()[_0x3d65('0x26')](function(){var _0x88cf70=_0x50b441[_0x3d65('0x28')]({'plain':!![]});var _0x16c87b=_0x3d65('0x29');return db[_0x3d65('0x2a')]['destroy']({'where':{'type':_0x16c87b,'resourceId':_0x88cf70['id']}})[_0x3d65('0x26')](function(){return _0x50b441;});})['then'](function(){_0x386dbf['status'](0xcc)[_0x3d65('0x1c')]();});}};}function handleEntityNotFound(_0x1cf784,_0x4e05d0){return function(_0x66813e){if(!_0x66813e){_0x1cf784['sendStatus'](0x194);}return _0x66813e;};}function handleError(_0x49108d,_0x42816c){_0x42816c=_0x42816c||0x1f4;return function(_0x3939c2){logger[_0x3d65('0x2b')](_0x3939c2[_0x3d65('0x2c')]);if(_0x3939c2[_0x3d65('0x2d')]){delete _0x3939c2[_0x3d65('0x2d')];}_0x49108d[_0x3d65('0x1b')](_0x42816c)[_0x3d65('0x2e')](_0x3939c2);};}exports[_0x3d65('0x2f')]=function(_0x51afcf,_0xcbcd12){var _0x2330dc={},_0x4963be={},_0x5e810b={'count':0x0,'rows':[]};var _0x1929ac=_['map'](db[_0x3d65('0x30')][_0x3d65('0x31')],function(_0x28deb2){return{'name':_0x28deb2[_0x3d65('0x32')],'type':_0x28deb2['type'][_0x3d65('0x33')]};});_0x4963be['model']=_[_0x3d65('0x34')](_0x1929ac,'name');_0x4963be['query']=_[_0x3d65('0x35')](_0x51afcf[_0x3d65('0x36')]);_0x4963be[_0x3d65('0x37')]=_[_0x3d65('0x38')](_0x4963be[_0x3d65('0x39')],_0x4963be[_0x3d65('0x36')]);_0x2330dc['attributes']=_[_0x3d65('0x38')](_0x4963be[_0x3d65('0x39')],qs[_0x3d65('0x3a')](_0x51afcf[_0x3d65('0x36')][_0x3d65('0x3a')]));_0x2330dc[_0x3d65('0x3b')]=_0x2330dc[_0x3d65('0x3b')][_0x3d65('0x3c')]?_0x2330dc[_0x3d65('0x3b')]:_0x4963be[_0x3d65('0x39')];if(!_0x51afcf['query'][_0x3d65('0x3d')](_0x3d65('0x3e'))){_0x2330dc[_0x3d65('0x20')]=qs[_0x3d65('0x20')](_0x51afcf[_0x3d65('0x36')][_0x3d65('0x20')]);_0x2330dc[_0x3d65('0x1e')]=qs[_0x3d65('0x1e')](_0x51afcf['query'][_0x3d65('0x1e')]);}_0x2330dc[_0x3d65('0x3f')]=qs[_0x3d65('0x40')](_0x51afcf[_0x3d65('0x36')][_0x3d65('0x40')]);_0x2330dc[_0x3d65('0x41')]=qs[_0x3d65('0x37')](_[_0x3d65('0x42')](_0x51afcf[_0x3d65('0x36')],_0x4963be[_0x3d65('0x37')]),_0x1929ac);if(_0x51afcf[_0x3d65('0x36')][_0x3d65('0x43')]){_0x2330dc[_0x3d65('0x41')]=_[_0x3d65('0x44')](_0x2330dc[_0x3d65('0x41')],{'$or':_['map'](_0x1929ac,function(_0x636ecc){if(_0x636ecc[_0x3d65('0x45')]!==_0x3d65('0x46')){var _0x4e8997={};_0x4e8997[_0x636ecc['name']]={'$like':'%'+_0x51afcf[_0x3d65('0x36')][_0x3d65('0x43')]+'%'};return _0x4e8997;}})});}_0x2330dc=_[_0x3d65('0x44')]({},_0x2330dc,_0x51afcf[_0x3d65('0x47')]);var _0x371663={'where':_0x2330dc[_0x3d65('0x41')]};return db[_0x3d65('0x30')][_0x3d65('0x21')](_0x371663)['then'](function(_0x201e08){_0x5e810b[_0x3d65('0x21')]=_0x201e08;if(_0x51afcf['query']['includeAll']){_0x2330dc[_0x3d65('0x48')]=[{'all':!![]}];}return db[_0x3d65('0x30')]['findAll'](_0x2330dc);})[_0x3d65('0x26')](function(_0x459957){_0x5e810b[_0x3d65('0x49')]=_0x459957;return _0x5e810b;})[_0x3d65('0x26')](respondWithFilteredResult(_0xcbcd12,_0x2330dc))[_0x3d65('0x4a')](handleError(_0xcbcd12,null));};exports[_0x3d65('0x4b')]=function(_0x55cda1,_0x3e9786){var _0x260cca={'raw':!![],'where':{'id':_0x55cda1[_0x3d65('0x4c')]['id']}},_0x3ce11e={};_0x3ce11e[_0x3d65('0x39')]=_['keys'](db[_0x3d65('0x30')][_0x3d65('0x31')]);_0x3ce11e[_0x3d65('0x36')]=_[_0x3d65('0x35')](_0x55cda1[_0x3d65('0x36')]);_0x3ce11e[_0x3d65('0x37')]=_[_0x3d65('0x38')](_0x3ce11e[_0x3d65('0x39')],_0x3ce11e[_0x3d65('0x36')]);_0x260cca[_0x3d65('0x3b')]=_[_0x3d65('0x38')](_0x3ce11e[_0x3d65('0x39')],qs[_0x3d65('0x3a')](_0x55cda1['query'][_0x3d65('0x3a')]));_0x260cca['attributes']=_0x260cca[_0x3d65('0x3b')][_0x3d65('0x3c')]?_0x260cca[_0x3d65('0x3b')]:_0x3ce11e[_0x3d65('0x39')];if(_0x55cda1[_0x3d65('0x36')][_0x3d65('0x4d')]){_0x260cca['include']=[{'all':!![]}];}_0x260cca=_[_0x3d65('0x44')]({},_0x260cca,_0x55cda1[_0x3d65('0x47')]);return db[_0x3d65('0x30')][_0x3d65('0x4e')](_0x260cca)['then'](handleEntityNotFound(_0x3e9786,null))[_0x3d65('0x26')](respondWithResult(_0x3e9786,null))[_0x3d65('0x4a')](handleError(_0x3e9786,null));};exports[_0x3d65('0x4f')]=function(_0x34041,_0x415f11){return db[_0x3d65('0x30')][_0x3d65('0x4f')](_0x34041[_0x3d65('0x50')],{})['then'](function(_0x5646f2){var _0x50c762=_0x34041[_0x3d65('0x51')][_0x3d65('0x28')]({'plain':!![]});if(!_0x50c762)throw new Error(_0x3d65('0x52'));if(_0x50c762[_0x3d65('0x53')]==='user'){var _0x367d12=_0x5646f2[_0x3d65('0x28')]({'plain':!![]});var _0x3c35ce=_0x3d65('0x29');return db[_0x3d65('0x54')][_0x3d65('0x4e')]({'where':{'name':_0x3c35ce,'userProfileId':_0x50c762[_0x3d65('0x55')]},'raw':!![]})['then'](function(_0x494718){if(_0x494718&&_0x494718[_0x3d65('0x56')]===0x0){return db['UserProfileResource'][_0x3d65('0x4f')]({'name':_0x367d12['name'],'resourceId':_0x367d12['id'],'type':_0x494718[_0x3d65('0x2d')],'sectionId':_0x494718['id']},{})[_0x3d65('0x26')](function(){return _0x5646f2;});}else{return _0x5646f2;}})[_0x3d65('0x4a')](function(_0x5d60eb){logger[_0x3d65('0x2b')](_0x3d65('0x57'),_0x5d60eb);throw _0x5d60eb;});}return _0x5646f2;})[_0x3d65('0x26')](respondWithResult(_0x415f11,0xc9))[_0x3d65('0x4a')](handleError(_0x415f11,null));};exports[_0x3d65('0x58')]=function(_0x40613c,_0x30da0e){if(_0x40613c[_0x3d65('0x50')]['id']){delete _0x40613c[_0x3d65('0x50')]['id'];}return db[_0x3d65('0x30')][_0x3d65('0x4e')]({'where':{'id':_0x40613c[_0x3d65('0x4c')]['id']}})[_0x3d65('0x26')](handleEntityNotFound(_0x30da0e,null))[_0x3d65('0x26')](saveUpdates(_0x40613c['body'],null))[_0x3d65('0x26')](respondWithResult(_0x30da0e,null))[_0x3d65('0x4a')](handleError(_0x30da0e,null));};exports['destroy']=function(_0xf3488,_0x58c76e){return db[_0x3d65('0x30')][_0x3d65('0x4e')]({'where':{'id':_0xf3488[_0x3d65('0x4c')]['id']}})[_0x3d65('0x26')](handleEntityNotFound(_0x58c76e,null))[_0x3d65('0x26')](removeEntity(_0x58c76e,null))[_0x3d65('0x4a')](handleError(_0x58c76e,null));};exports['download']=function(_0x41cb21,_0x53793d,_0x2feed2){return db[_0x3d65('0x30')]['find']({'where':{'id':_0x41cb21['params']['id']},'attributes':['name',_0x3d65('0x59'),_0x3d65('0x5a'),_0x3d65('0x5b')],'raw':!![]})[_0x3d65('0x26')](handleEntityNotFound(_0x53793d,null))['then'](function(_0x57b0d0){if(_0x57b0d0){if(!fs['existsSync'](path[_0x3d65('0x5c')](config['root'],'server/files/reports',_0x57b0d0['savename']))){throw new db[(_0x3d65('0x5d'))][(_0x3d65('0x5e'))](_0x3d65('0x5f'));}if(_0x41cb21[_0x3d65('0x36')][_0x3d65('0x60')]){return _0x53793d[_0x3d65('0x1a')](0xc8);}return _0x53793d[_0x3d65('0x61')](path['join'](config[_0x3d65('0x62')],_0x3d65('0x63'),_0x57b0d0[_0x3d65('0x5a')]),util[_0x3d65('0x64')](_0x3d65('0x65'),_0x57b0d0['basename']||_0x57b0d0[_0x3d65('0x2d')],_0x57b0d0['output']['toLowerCase']()));}})[_0x3d65('0x4a')](handleError(_0x53793d,null));}; \ No newline at end of file +var _0xd021=['index','map','AnalyticExtractedReport','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','pick','where','VIRTUAL','filter','merge','options','includeAll','include','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','basename','savename','output','existsSync','join','root','Sequelize','Report\x20not\x20found\x20or\x20empty','exists','download','format','%s.%s','toLowerCase','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','get','ExtractedReports','UserProfileResource','destroy','error','name','send'];(function(_0x5babb8,_0x453b94){var _0x4a2829=function(_0x40c8ff){while(--_0x40c8ff){_0x5babb8['push'](_0x5babb8['shift']());}};_0x4a2829(++_0x453b94);}(_0xd021,0x1ae));var _0x1d02=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd021[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x1d02('0x0'));var rimraf=require(_0x1d02('0x1'));var zipdir=require(_0x1d02('0x2'));var jsonpatch=require(_0x1d02('0x3'));var rp=require('request-promise');var moment=require(_0x1d02('0x4'));var BPromise=require(_0x1d02('0x5'));var Mustache=require(_0x1d02('0x6'));var util=require(_0x1d02('0x7'));var path=require(_0x1d02('0x8'));var sox=require(_0x1d02('0x9'));var csv=require(_0x1d02('0xa'));var ejs=require(_0x1d02('0xb'));var fs=require('fs');var fs_extra=require(_0x1d02('0xc'));var _=require('lodash');var squel=require(_0x1d02('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x1d02('0xa'));var querystring=require(_0x1d02('0xe'));var Papa=require(_0x1d02('0xf'));var Redis=require(_0x1d02('0x10'));var authService=require(_0x1d02('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x1d02('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1d02('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x1d02('0x14'));var licenseUtil=require(_0x1d02('0x15'));var db=require(_0x1d02('0x16'))['db'];function respondWithStatusCode(_0x51c275,_0x15e5eb){_0x15e5eb=_0x15e5eb||0xcc;return function(_0x147f82){if(_0x147f82){return _0x51c275[_0x1d02('0x17')](_0x15e5eb);}return _0x51c275[_0x1d02('0x18')](_0x15e5eb)[_0x1d02('0x19')]();};}function respondWithResult(_0x5b99b1,_0x580758){_0x580758=_0x580758||0xc8;return function(_0x2ad6b8){if(_0x2ad6b8){return _0x5b99b1[_0x1d02('0x18')](_0x580758)[_0x1d02('0x1a')](_0x2ad6b8);}};}function respondWithFilteredResult(_0x429523,_0x1a110c){return function(_0x35108b){if(_0x35108b){var _0x2aa24c=typeof _0x1a110c[_0x1d02('0x1b')]===_0x1d02('0x1c')&&typeof _0x1a110c['limit']===_0x1d02('0x1c');var _0x3374d9=_0x35108b['count'];var _0x465633=_0x2aa24c?0x0:_0x1a110c[_0x1d02('0x1b')];var _0x531f05=_0x2aa24c?_0x35108b[_0x1d02('0x1d')]:_0x1a110c[_0x1d02('0x1b')]+_0x1a110c[_0x1d02('0x1e')];var _0x1359a8;if(_0x531f05>=_0x3374d9){_0x531f05=_0x3374d9;_0x1359a8=0xc8;}else{_0x1359a8=0xce;}_0x429523[_0x1d02('0x18')](_0x1359a8);return _0x429523[_0x1d02('0x1f')](_0x1d02('0x20'),_0x465633+'-'+_0x531f05+'/'+_0x3374d9)[_0x1d02('0x1a')](_0x35108b);}return null;};}function patchUpdates(_0x5c13b2){return function(_0x1b39f9){try{jsonpatch[_0x1d02('0x21')](_0x1b39f9,_0x5c13b2,!![]);}catch(_0x3cd07e){return BPromise[_0x1d02('0x22')](_0x3cd07e);}return _0x1b39f9[_0x1d02('0x23')]();};}function saveUpdates(_0x5e4f9e,_0x40a629){return function(_0x34532e){if(_0x34532e){return _0x34532e[_0x1d02('0x24')](_0x5e4f9e)[_0x1d02('0x25')](function(_0x5017b2){return _0x5017b2;});}return null;};}function removeEntity(_0x24f517,_0x3dbc99){return function(_0x2f2a0b){if(_0x2f2a0b){return _0x2f2a0b['destroy']()[_0x1d02('0x25')](function(){var _0x186d6c=_0x2f2a0b[_0x1d02('0x26')]({'plain':!![]});var _0x2cd7e8=_0x1d02('0x27');return db[_0x1d02('0x28')][_0x1d02('0x29')]({'where':{'type':_0x2cd7e8,'resourceId':_0x186d6c['id']}})[_0x1d02('0x25')](function(){return _0x2f2a0b;});})['then'](function(){_0x24f517[_0x1d02('0x18')](0xcc)[_0x1d02('0x19')]();});}};}function handleEntityNotFound(_0x20a89e,_0x468567){return function(_0x102739){if(!_0x102739){_0x20a89e[_0x1d02('0x17')](0x194);}return _0x102739;};}function handleError(_0x4804c4,_0x2cf7fd){_0x2cf7fd=_0x2cf7fd||0x1f4;return function(_0x46a352){logger[_0x1d02('0x2a')](_0x46a352['stack']);if(_0x46a352[_0x1d02('0x2b')]){delete _0x46a352[_0x1d02('0x2b')];}_0x4804c4[_0x1d02('0x18')](_0x2cf7fd)[_0x1d02('0x2c')](_0x46a352);};}exports[_0x1d02('0x2d')]=function(_0x220699,_0x4b1b7b){var _0x3caab8={},_0x19f14e={},_0x63c9cd={'count':0x0,'rows':[]};var _0x376bfc=_[_0x1d02('0x2e')](db[_0x1d02('0x2f')]['rawAttributes'],function(_0x3b2624){return{'name':_0x3b2624[_0x1d02('0x30')],'type':_0x3b2624[_0x1d02('0x31')][_0x1d02('0x32')]};});_0x19f14e['model']=_['map'](_0x376bfc,_0x1d02('0x2b'));_0x19f14e[_0x1d02('0x33')]=_[_0x1d02('0x34')](_0x220699[_0x1d02('0x33')]);_0x19f14e[_0x1d02('0x35')]=_[_0x1d02('0x36')](_0x19f14e[_0x1d02('0x37')],_0x19f14e['query']);_0x3caab8['attributes']=_[_0x1d02('0x36')](_0x19f14e['model'],qs[_0x1d02('0x38')](_0x220699[_0x1d02('0x33')][_0x1d02('0x38')]));_0x3caab8[_0x1d02('0x39')]=_0x3caab8[_0x1d02('0x39')][_0x1d02('0x3a')]?_0x3caab8['attributes']:_0x19f14e['model'];if(!_0x220699['query'][_0x1d02('0x3b')]('nolimit')){_0x3caab8[_0x1d02('0x1e')]=qs[_0x1d02('0x1e')](_0x220699[_0x1d02('0x33')]['limit']);_0x3caab8[_0x1d02('0x1b')]=qs[_0x1d02('0x1b')](_0x220699[_0x1d02('0x33')][_0x1d02('0x1b')]);}_0x3caab8[_0x1d02('0x3c')]=qs[_0x1d02('0x3d')](_0x220699[_0x1d02('0x33')]['sort']);_0x3caab8['where']=qs['filters'](_[_0x1d02('0x3e')](_0x220699['query'],_0x19f14e[_0x1d02('0x35')]),_0x376bfc);if(_0x220699['query']['filter']){_0x3caab8[_0x1d02('0x3f')]=_['merge'](_0x3caab8[_0x1d02('0x3f')],{'$or':_[_0x1d02('0x2e')](_0x376bfc,function(_0x55692d){if(_0x55692d['type']!==_0x1d02('0x40')){var _0x76a023={};_0x76a023[_0x55692d[_0x1d02('0x2b')]]={'$like':'%'+_0x220699[_0x1d02('0x33')][_0x1d02('0x41')]+'%'};return _0x76a023;}})});}_0x3caab8=_[_0x1d02('0x42')]({},_0x3caab8,_0x220699[_0x1d02('0x43')]);var _0x28c646={'where':_0x3caab8[_0x1d02('0x3f')]};return db[_0x1d02('0x2f')][_0x1d02('0x1d')](_0x28c646)[_0x1d02('0x25')](function(_0x546a84){_0x63c9cd[_0x1d02('0x1d')]=_0x546a84;if(_0x220699['query'][_0x1d02('0x44')]){_0x3caab8[_0x1d02('0x45')]=[{'all':!![]}];}return db[_0x1d02('0x2f')]['findAll'](_0x3caab8);})[_0x1d02('0x25')](function(_0x58cd5d){_0x63c9cd['rows']=_0x58cd5d;return _0x63c9cd;})[_0x1d02('0x25')](respondWithFilteredResult(_0x4b1b7b,_0x3caab8))[_0x1d02('0x46')](handleError(_0x4b1b7b,null));};exports[_0x1d02('0x47')]=function(_0x4cb2d9,_0x49756e){var _0x56c94={'raw':!![],'where':{'id':_0x4cb2d9[_0x1d02('0x48')]['id']}},_0x5027ce={};_0x5027ce[_0x1d02('0x37')]=_[_0x1d02('0x34')](db[_0x1d02('0x2f')]['rawAttributes']);_0x5027ce[_0x1d02('0x33')]=_[_0x1d02('0x34')](_0x4cb2d9[_0x1d02('0x33')]);_0x5027ce[_0x1d02('0x35')]=_[_0x1d02('0x36')](_0x5027ce[_0x1d02('0x37')],_0x5027ce[_0x1d02('0x33')]);_0x56c94[_0x1d02('0x39')]=_[_0x1d02('0x36')](_0x5027ce['model'],qs[_0x1d02('0x38')](_0x4cb2d9[_0x1d02('0x33')][_0x1d02('0x38')]));_0x56c94[_0x1d02('0x39')]=_0x56c94[_0x1d02('0x39')][_0x1d02('0x3a')]?_0x56c94['attributes']:_0x5027ce['model'];if(_0x4cb2d9['query']['includeAll']){_0x56c94[_0x1d02('0x45')]=[{'all':!![]}];}_0x56c94=_['merge']({},_0x56c94,_0x4cb2d9[_0x1d02('0x43')]);return db['AnalyticExtractedReport'][_0x1d02('0x49')](_0x56c94)[_0x1d02('0x25')](handleEntityNotFound(_0x49756e,null))[_0x1d02('0x25')](respondWithResult(_0x49756e,null))[_0x1d02('0x46')](handleError(_0x49756e,null));};exports[_0x1d02('0x4a')]=function(_0x1f859e,_0x27980f){return db[_0x1d02('0x2f')][_0x1d02('0x4a')](_0x1f859e[_0x1d02('0x4b')],{})['then'](function(_0x2dfef9){var _0xdf9384=_0x1f859e[_0x1d02('0x4c')][_0x1d02('0x26')]({'plain':!![]});if(!_0xdf9384)throw new Error(_0x1d02('0x4d'));if(_0xdf9384[_0x1d02('0x4e')]===_0x1d02('0x4c')){var _0x3e992a=_0x2dfef9['get']({'plain':!![]});var _0x339b10=_0x1d02('0x27');return db['UserProfileSection'][_0x1d02('0x49')]({'where':{'name':_0x339b10,'userProfileId':_0xdf9384[_0x1d02('0x4f')]},'raw':!![]})[_0x1d02('0x25')](function(_0x50cbfc){if(_0x50cbfc&&_0x50cbfc[_0x1d02('0x50')]===0x0){return db[_0x1d02('0x28')]['create']({'name':_0x3e992a['name'],'resourceId':_0x3e992a['id'],'type':_0x50cbfc[_0x1d02('0x2b')],'sectionId':_0x50cbfc['id']},{})[_0x1d02('0x25')](function(){return _0x2dfef9;});}else{return _0x2dfef9;}})[_0x1d02('0x46')](function(_0x82b379){logger[_0x1d02('0x2a')](_0x1d02('0x51'),_0x82b379);throw _0x82b379;});}return _0x2dfef9;})[_0x1d02('0x25')](respondWithResult(_0x27980f,0xc9))[_0x1d02('0x46')](handleError(_0x27980f,null));};exports[_0x1d02('0x24')]=function(_0x5f4ed2,_0x591244){if(_0x5f4ed2[_0x1d02('0x4b')]['id']){delete _0x5f4ed2[_0x1d02('0x4b')]['id'];}return db['AnalyticExtractedReport'][_0x1d02('0x49')]({'where':{'id':_0x5f4ed2[_0x1d02('0x48')]['id']}})[_0x1d02('0x25')](handleEntityNotFound(_0x591244,null))[_0x1d02('0x25')](saveUpdates(_0x5f4ed2[_0x1d02('0x4b')],null))['then'](respondWithResult(_0x591244,null))[_0x1d02('0x46')](handleError(_0x591244,null));};exports[_0x1d02('0x29')]=function(_0x53a226,_0x37243c){return db['AnalyticExtractedReport'][_0x1d02('0x49')]({'where':{'id':_0x53a226[_0x1d02('0x48')]['id']}})[_0x1d02('0x25')](handleEntityNotFound(_0x37243c,null))[_0x1d02('0x25')](removeEntity(_0x37243c,null))['catch'](handleError(_0x37243c,null));};exports['download']=function(_0x4bf798,_0x2cf86c,_0x562a26){return db[_0x1d02('0x2f')]['find']({'where':{'id':_0x4bf798[_0x1d02('0x48')]['id']},'attributes':['name',_0x1d02('0x52'),_0x1d02('0x53'),_0x1d02('0x54')],'raw':!![]})[_0x1d02('0x25')](handleEntityNotFound(_0x2cf86c,null))[_0x1d02('0x25')](function(_0x230d73){if(_0x230d73){if(!fs[_0x1d02('0x55')](path[_0x1d02('0x56')](config[_0x1d02('0x57')],'server/files/reports',_0x230d73['savename']))){throw new db[(_0x1d02('0x58'))]['ValidationError'](_0x1d02('0x59'));}if(_0x4bf798[_0x1d02('0x33')][_0x1d02('0x5a')]){return _0x2cf86c['sendStatus'](0xc8);}return _0x2cf86c[_0x1d02('0x5b')](path[_0x1d02('0x56')](config[_0x1d02('0x57')],'server/files/reports',_0x230d73['savename']),util[_0x1d02('0x5c')](_0x1d02('0x5d'),_0x230d73['basename']||_0x230d73['name'],_0x230d73['output'][_0x1d02('0x5e')]()));}})[_0x1d02('0x46')](handleError(_0x2cf86c,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 63ba31d..63bb1bd 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 _0x2c43=['AnalyticExtractedReport','analytics_extracted_reports','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./analyticExtractedReport.attributes','exports','define'];(function(_0x691117,_0x5f26ca){var _0x55479c=function(_0x5af2e9){while(--_0x5af2e9){_0x691117['push'](_0x691117['shift']());}};_0x55479c(++_0x5f26ca);}(_0x2c43,0x6a));var _0x32c4=function(_0x3597c9,_0x4a27b6){_0x3597c9=_0x3597c9-0x0;var _0x4c7a54=_0x2c43[_0x3597c9];return _0x4c7a54;};'use strict';var _=require(_0x32c4('0x0'));var util=require(_0x32c4('0x1'));var logger=require('../../config/logger')(_0x32c4('0x2'));var moment=require(_0x32c4('0x3'));var BPromise=require(_0x32c4('0x4'));var rp=require(_0x32c4('0x5'));var fs=require('fs');var path=require(_0x32c4('0x6'));var rimraf=require('rimraf');var config=require(_0x32c4('0x7'));var attributes=require(_0x32c4('0x8'));module[_0x32c4('0x9')]=function(_0x41056e,_0x248fa5){return _0x41056e[_0x32c4('0xa')](_0x32c4('0xb'),attributes,{'tableName':_0x32c4('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb774=['lodash','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport','analytics_extracted_reports'];(function(_0x6106d8,_0x67937c){var _0x8a8fe8=function(_0x77027d){while(--_0x77027d){_0x6106d8['push'](_0x6106d8['shift']());}};_0x8a8fe8(++_0x67937c);}(_0xb774,0x18c));var _0x4b77=function(_0x48f0a5,_0x157aca){_0x48f0a5=_0x48f0a5-0x0;var _0x469cf9=_0xb774[_0x48f0a5];return _0x469cf9;};'use strict';var _=require(_0x4b77('0x0'));var util=require('util');var logger=require(_0x4b77('0x1'))(_0x4b77('0x2'));var moment=require('moment');var BPromise=require(_0x4b77('0x3'));var rp=require(_0x4b77('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4b77('0x5'));var config=require(_0x4b77('0x6'));var attributes=require(_0x4b77('0x7'));module[_0x4b77('0x8')]=function(_0x4880ae,_0x12ae85){return _0x4880ae[_0x4b77('0x9')](_0x4b77('0xa'),attributes,{'tableName':_0x4b77('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 4aaecf3..833f202 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 _0x528e=['catch','lodash','util','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x544d92,_0x42421d){var _0x2dd78b=function(_0x54dd0c){while(--_0x54dd0c){_0x544d92['push'](_0x544d92['shift']());}};_0x2dd78b(++_0x42421d);}(_0x528e,0x157));var _0xe528=function(_0x292047,_0x24abc5){_0x292047=_0x292047-0x0;var _0x550376=_0x528e[_0x292047];return _0x550376;};'use strict';var _=require(_0xe528('0x0'));var util=require(_0xe528('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe528('0x2'))['db'];var utils=require(_0xe528('0x3'));var logger=require(_0xe528('0x4'))('rpc');var config=require(_0xe528('0x5'));var jayson=require(_0xe528('0x6'));var client=jayson[_0xe528('0x7')][_0xe528('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x331d1e,_0x27a49b,_0x3c4d62){return new BPromise(function(_0x21913e,_0x4e0525){return client['request'](_0x331d1e,_0x3c4d62)['then'](function(_0xc050ff){logger[_0xe528('0x9')](_0xe528('0xa'),_0x27a49b,_0xe528('0xb'));logger[_0xe528('0xc')](_0xe528('0xd'),_0x27a49b,_0xe528('0xb'),JSON['stringify'](_0xc050ff));if(_0xc050ff['error']){if(_0xc050ff[_0xe528('0xe')][_0xe528('0xf')]===0x1f4){logger[_0xe528('0xe')](_0xe528('0xa'),_0x27a49b,_0xc050ff[_0xe528('0xe')][_0xe528('0x10')]);return _0x4e0525(_0xc050ff[_0xe528('0xe')][_0xe528('0x10')]);}logger[_0xe528('0xe')](_0xe528('0xa'),_0x27a49b,_0xc050ff['error']['message']);return _0x21913e(_0xc050ff[_0xe528('0xe')][_0xe528('0x10')]);}else{logger[_0xe528('0x9')](_0xe528('0xa'),_0x27a49b,_0xe528('0xb'));_0x21913e(_0xc050ff['result'][_0xe528('0x10')]);}})[_0xe528('0x11')](function(_0x52494b){logger[_0xe528('0xe')](_0xe528('0xa'),_0x27a49b,_0x52494b);_0x4e0525(_0x52494b);});});} \ No newline at end of file +var _0xd237=['client','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x4d11a2,_0xc058dc){var _0x3f64bb=function(_0x3ce929){while(--_0x3ce929){_0x4d11a2['push'](_0x4d11a2['shift']());}};_0x3f64bb(++_0xc058dc);}(_0xd237,0x14f));var _0x7d23=function(_0x2853ab,_0x8acdcb){_0x2853ab=_0x2853ab-0x0;var _0x335454=_0xd237[_0x2853ab];return _0x335454;};'use strict';var _=require(_0x7d23('0x0'));var util=require(_0x7d23('0x1'));var moment=require(_0x7d23('0x2'));var BPromise=require(_0x7d23('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7d23('0x4'));var db=require(_0x7d23('0x5'))['db'];var utils=require(_0x7d23('0x6'));var logger=require(_0x7d23('0x7'))(_0x7d23('0x8'));var config=require(_0x7d23('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7d23('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5ca126,_0x48358f,_0xc43371){return new BPromise(function(_0x42c334,_0x6ce28d){return client[_0x7d23('0xb')](_0x5ca126,_0xc43371)[_0x7d23('0xc')](function(_0x23f1d6){logger[_0x7d23('0xd')](_0x7d23('0xe'),_0x48358f,'request\x20sent');logger[_0x7d23('0xf')](_0x7d23('0x10'),_0x48358f,_0x7d23('0x11'),JSON['stringify'](_0x23f1d6));if(_0x23f1d6[_0x7d23('0x12')]){if(_0x23f1d6['error'][_0x7d23('0x13')]===0x1f4){logger[_0x7d23('0x12')](_0x7d23('0xe'),_0x48358f,_0x23f1d6[_0x7d23('0x12')][_0x7d23('0x14')]);return _0x6ce28d(_0x23f1d6[_0x7d23('0x12')][_0x7d23('0x14')]);}logger['error']('AnalyticExtractedReport,\x20%s,\x20%s',_0x48358f,_0x23f1d6[_0x7d23('0x12')][_0x7d23('0x14')]);return _0x42c334(_0x23f1d6[_0x7d23('0x12')][_0x7d23('0x14')]);}else{logger['info'](_0x7d23('0xe'),_0x48358f,'request\x20sent');_0x42c334(_0x23f1d6[_0x7d23('0x15')]['message']);}})[_0x7d23('0x16')](function(_0x46a35b){logger[_0x7d23('0x12')](_0x7d23('0xe'),_0x48358f,_0x46a35b);_0x6ce28d(_0x46a35b);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index ec57a82..6934905 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 _0xbce5=['Router','fs-extra','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','index','/:id','show','download','create','delete','destroy','exports','multer','connect-timeout','express'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0xbce5,0x1ad));var _0x5bce=function(_0x2860ab,_0x27440f){_0x2860ab=_0x2860ab-0x0;var _0x3037c4=_0xbce5[_0x2860ab];return _0x3037c4;};'use strict';var multer=require(_0x5bce('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5bce('0x1'));var express=require(_0x5bce('0x2'));var router=express[_0x5bce('0x3')]();var fs_extra=require(_0x5bce('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x5bce('0x5'));var config=require(_0x5bce('0x6'));var controller=require(_0x5bce('0x7'));router[_0x5bce('0x8')]('/',auth[_0x5bce('0x9')](),controller[_0x5bce('0xa')]);router[_0x5bce('0x8')](_0x5bce('0xb'),auth['isAuthenticated'](),controller[_0x5bce('0xc')]);router['get']('/:id/download',auth[_0x5bce('0x9')](),controller[_0x5bce('0xd')]);router['post']('/',auth[_0x5bce('0x9')](),controller[_0x5bce('0xe')]);router['put']('/:id',auth[_0x5bce('0x9')](),controller['update']);router[_0x5bce('0xf')](_0x5bce('0xb'),auth[_0x5bce('0x9')](),controller[_0x5bce('0x10')]);module[_0x5bce('0x11')]=router; \ No newline at end of file +var _0x85c8=['../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','index','get','/:id','isAuthenticated','show','/:id/download','download','delete','destroy','multer','path','express','Router','fs-extra'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x85c8,0x13f));var _0x885c=function(_0x35c2d1,_0xc18ad8){_0x35c2d1=_0x35c2d1-0x0;var _0x3e1104=_0x85c8[_0x35c2d1];return _0x3e1104;};'use strict';var multer=require(_0x885c('0x0'));var util=require('util');var path=require(_0x885c('0x1'));var timeout=require('connect-timeout');var express=require(_0x885c('0x2'));var router=express[_0x885c('0x3')]();var fs_extra=require(_0x885c('0x4'));var auth=require(_0x885c('0x5'));var interaction=require(_0x885c('0x6'));var config=require(_0x885c('0x7'));var controller=require(_0x885c('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x885c('0x9')]);router[_0x885c('0xa')](_0x885c('0xb'),auth[_0x885c('0xc')](),controller[_0x885c('0xd')]);router[_0x885c('0xa')](_0x885c('0xe'),auth['isAuthenticated'](),controller[_0x885c('0xf')]);router['post']('/',auth[_0x885c('0xc')](),controller['create']);router['put'](_0x885c('0xb'),auth[_0x885c('0xc')](),controller['update']);router[_0x885c('0x10')]('/:id',auth[_0x885c('0xc')](),controller[_0x885c('0x11')]);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 de586d0..15073aa 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 _0xaed8=['STRING','sequelize','TEXT'];(function(_0x27b671,_0x1b91e2){var _0x865f50=function(_0x21f1a4){while(--_0x21f1a4){_0x27b671['push'](_0x27b671['shift']());}};_0x865f50(++_0x1b91e2);}(_0xaed8,0x109));var _0x8aed=function(_0x3cea78,_0x4a6751){_0x3cea78=_0x3cea78-0x0;var _0x33b66b=_0xaed8[_0x3cea78];return _0x33b66b;};'use strict';var Sequelize=require(_0x8aed('0x0'));module['exports']={'field':{'type':Sequelize[_0x8aed('0x1')]},'alias':{'type':Sequelize[_0x8aed('0x2')]},'function':{'type':Sequelize[_0x8aed('0x2')]},'format':{'type':Sequelize[_0x8aed('0x2')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x8aed('0x2')]},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xb916=['sequelize','exports','TEXT','STRING','BOOLEAN'];(function(_0x4562bb,_0x5a8f8d){var _0x110188=function(_0x48aa24){while(--_0x48aa24){_0x4562bb['push'](_0x4562bb['shift']());}};_0x110188(++_0x5a8f8d);}(_0xb916,0x131));var _0x6b91=function(_0x46884f,_0x2b5c5a){_0x46884f=_0x46884f-0x0;var _0x78c6c0=_0xb916[_0x46884f];return _0x78c6c0;};'use strict';var Sequelize=require(_0x6b91('0x0'));module[_0x6b91('0x1')]={'field':{'type':Sequelize[_0x6b91('0x2')]},'alias':{'type':Sequelize[_0x6b91('0x3')]},'function':{'type':Sequelize[_0x6b91('0x3')]},'format':{'type':Sequelize[_0x6b91('0x3')]},'groupBy':{'type':Sequelize[_0x6b91('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x6b91('0x3')]},'custom':{'type':Sequelize[_0x6b91('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 35c6dc8..16c9e18 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 _0x99f5=['model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','pick','filter','where','VIRTUAL','merge','options','count','includeAll','include','findAll','rows','catch','params','find','create','body','bulkCreate','bulkDestroy','ids','addFields','AnalyticCustomReport','findOne','transaction','CustomReportId','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','set','json','apply','reject','save','update','then','destroy','stack','name','index','map','AnalyticFieldReport','rawAttributes','fieldName','type'];(function(_0x4650fd,_0x453fd1){var _0x392588=function(_0xc153c1){while(--_0xc153c1){_0x4650fd['push'](_0x4650fd['shift']());}};_0x392588(++_0x453fd1);}(_0x99f5,0xc4));var _0x599f=function(_0x51c9b0,_0x106a90){_0x51c9b0=_0x51c9b0-0x0;var _0x4a08e9=_0x99f5[_0x51c9b0];return _0x4a08e9;};'use strict';var emlformat=require(_0x599f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x599f('0x1'));var jsonpatch=require(_0x599f('0x2'));var rp=require(_0x599f('0x3'));var moment=require(_0x599f('0x4'));var BPromise=require(_0x599f('0x5'));var Mustache=require(_0x599f('0x6'));var util=require('util');var path=require(_0x599f('0x7'));var sox=require(_0x599f('0x8'));var csv=require(_0x599f('0x9'));var ejs=require(_0x599f('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x599f('0xb'));var squel=require(_0x599f('0xc'));var crypto=require('crypto');var jsforce=require(_0x599f('0xd'));var deskjs=require(_0x599f('0xe'));var toCsv=require(_0x599f('0x9'));var querystring=require('querystring');var Papa=require(_0x599f('0xf'));var Redis=require(_0x599f('0x10'));var authService=require(_0x599f('0x11'));var qs=require(_0x599f('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x599f('0x13'));var logger=require(_0x599f('0x14'))('api');var utils=require(_0x599f('0x15'));var config=require(_0x599f('0x16'));var licenseUtil=require(_0x599f('0x17'));var db=require(_0x599f('0x18'))['db'];function respondWithStatusCode(_0x1654cb,_0x179519){_0x179519=_0x179519||0xcc;return function(_0x218bf5){if(_0x218bf5){return _0x1654cb[_0x599f('0x19')](_0x179519);}return _0x1654cb['status'](_0x179519)[_0x599f('0x1a')]();};}function respondWithResult(_0x47224c,_0x44e739){_0x44e739=_0x44e739||0xc8;return function(_0x401ddb){if(_0x401ddb){return _0x47224c[_0x599f('0x1b')](_0x44e739)['json'](_0x401ddb);}};}function respondWithFilteredResult(_0x19b198,_0x5c7a29){return function(_0x25d1f6){if(_0x25d1f6){var _0x20e7ac=typeof _0x5c7a29[_0x599f('0x1c')]===_0x599f('0x1d')&&typeof _0x5c7a29[_0x599f('0x1e')]===_0x599f('0x1d');var _0x1b532f=_0x25d1f6['count'];var _0x28fa5f=_0x20e7ac?0x0:_0x5c7a29[_0x599f('0x1c')];var _0x5c040c=_0x20e7ac?_0x25d1f6['count']:_0x5c7a29['offset']+_0x5c7a29[_0x599f('0x1e')];var _0x166e65;if(_0x5c040c>=_0x1b532f){_0x5c040c=_0x1b532f;_0x166e65=0xc8;}else{_0x166e65=0xce;}_0x19b198['status'](_0x166e65);return _0x19b198[_0x599f('0x1f')]('Content-Range',_0x28fa5f+'-'+_0x5c040c+'/'+_0x1b532f)[_0x599f('0x20')](_0x25d1f6);}return null;};}function patchUpdates(_0x3b3f22){return function(_0x5e569f){try{jsonpatch[_0x599f('0x21')](_0x5e569f,_0x3b3f22,!![]);}catch(_0x4a1c1f){return BPromise[_0x599f('0x22')](_0x4a1c1f);}return _0x5e569f[_0x599f('0x23')]();};}function saveUpdates(_0x5a9e43,_0x4f8ce7){return function(_0x4b3457){if(_0x4b3457){return _0x4b3457[_0x599f('0x24')](_0x5a9e43)[_0x599f('0x25')](function(_0x58f81e){return _0x58f81e;});}return null;};}function removeEntity(_0x1ac9a3,_0x1cc2ff){return function(_0x2c80cc){if(_0x2c80cc){return _0x2c80cc[_0x599f('0x26')]()[_0x599f('0x25')](function(){_0x1ac9a3['status'](0xcc)[_0x599f('0x1a')]();});}};}function handleEntityNotFound(_0x182bab,_0x3e8d25){return function(_0x29673a){if(!_0x29673a){_0x182bab[_0x599f('0x19')](0x194);}return _0x29673a;};}function handleError(_0x411759,_0x175287){_0x175287=_0x175287||0x1f4;return function(_0x3de57c){logger['error'](_0x3de57c[_0x599f('0x27')]);if(_0x3de57c[_0x599f('0x28')]){delete _0x3de57c[_0x599f('0x28')];}_0x411759[_0x599f('0x1b')](_0x175287)['send'](_0x3de57c);};}exports[_0x599f('0x29')]=function(_0x57056f,_0x51d45c){var _0x1054d3={},_0x4e6ea2={},_0x22c393={'count':0x0,'rows':[]};var _0x34004b=_[_0x599f('0x2a')](db[_0x599f('0x2b')][_0x599f('0x2c')],function(_0x36833c){return{'name':_0x36833c[_0x599f('0x2d')],'type':_0x36833c[_0x599f('0x2e')]['key']};});_0x4e6ea2[_0x599f('0x2f')]=_['map'](_0x34004b,_0x599f('0x28'));_0x4e6ea2[_0x599f('0x30')]=_[_0x599f('0x31')](_0x57056f[_0x599f('0x30')]);_0x4e6ea2[_0x599f('0x32')]=_[_0x599f('0x33')](_0x4e6ea2['model'],_0x4e6ea2[_0x599f('0x30')]);_0x1054d3[_0x599f('0x34')]=_[_0x599f('0x33')](_0x4e6ea2[_0x599f('0x2f')],qs['fields'](_0x57056f[_0x599f('0x30')][_0x599f('0x35')]));_0x1054d3[_0x599f('0x34')]=_0x1054d3[_0x599f('0x34')][_0x599f('0x36')]?_0x1054d3['attributes']:_0x4e6ea2[_0x599f('0x2f')];if(!_0x57056f['query']['hasOwnProperty'](_0x599f('0x37'))){_0x1054d3[_0x599f('0x1e')]=qs[_0x599f('0x1e')](_0x57056f['query'][_0x599f('0x1e')]);_0x1054d3[_0x599f('0x1c')]=qs[_0x599f('0x1c')](_0x57056f[_0x599f('0x30')][_0x599f('0x1c')]);}_0x1054d3['order']=qs[_0x599f('0x38')](_0x57056f['query'][_0x599f('0x38')]);_0x1054d3['where']=qs['filters'](_[_0x599f('0x39')](_0x57056f[_0x599f('0x30')],_0x4e6ea2[_0x599f('0x32')]),_0x34004b);if(_0x57056f[_0x599f('0x30')][_0x599f('0x3a')]){_0x1054d3[_0x599f('0x3b')]=_['merge'](_0x1054d3[_0x599f('0x3b')],{'$or':_[_0x599f('0x2a')](_0x34004b,function(_0x21806b){if(_0x21806b[_0x599f('0x2e')]!==_0x599f('0x3c')){var _0x33aed2={};_0x33aed2[_0x21806b[_0x599f('0x28')]]={'$like':'%'+_0x57056f[_0x599f('0x30')][_0x599f('0x3a')]+'%'};return _0x33aed2;}})});}_0x1054d3=_[_0x599f('0x3d')]({},_0x1054d3,_0x57056f[_0x599f('0x3e')]);var _0x52945e={'where':_0x1054d3[_0x599f('0x3b')]};return db[_0x599f('0x2b')][_0x599f('0x3f')](_0x52945e)[_0x599f('0x25')](function(_0x2ea9d3){_0x22c393[_0x599f('0x3f')]=_0x2ea9d3;if(_0x57056f[_0x599f('0x30')][_0x599f('0x40')]){_0x1054d3[_0x599f('0x41')]=[{'all':!![]}];}return db[_0x599f('0x2b')][_0x599f('0x42')](_0x1054d3);})[_0x599f('0x25')](function(_0x518bc7){_0x22c393[_0x599f('0x43')]=_0x518bc7;return _0x22c393;})[_0x599f('0x25')](respondWithFilteredResult(_0x51d45c,_0x1054d3))[_0x599f('0x44')](handleError(_0x51d45c,null));};exports['show']=function(_0x448032,_0x30e7bb){var _0x3ab9a4={'raw':![],'where':{'id':_0x448032[_0x599f('0x45')]['id']}},_0x41fee2={};_0x41fee2[_0x599f('0x2f')]=_[_0x599f('0x31')](db[_0x599f('0x2b')][_0x599f('0x2c')]);_0x41fee2['query']=_[_0x599f('0x31')](_0x448032['query']);_0x41fee2['filters']=_[_0x599f('0x33')](_0x41fee2[_0x599f('0x2f')],_0x41fee2['query']);_0x3ab9a4[_0x599f('0x34')]=_[_0x599f('0x33')](_0x41fee2[_0x599f('0x2f')],qs['fields'](_0x448032[_0x599f('0x30')][_0x599f('0x35')]));_0x3ab9a4[_0x599f('0x34')]=_0x3ab9a4[_0x599f('0x34')][_0x599f('0x36')]?_0x3ab9a4[_0x599f('0x34')]:_0x41fee2[_0x599f('0x2f')];if(_0x448032['query'][_0x599f('0x40')]){_0x3ab9a4[_0x599f('0x41')]=[{'all':!![]}];}_0x3ab9a4=_['merge']({},_0x3ab9a4,_0x448032[_0x599f('0x3e')]);return db[_0x599f('0x2b')][_0x599f('0x46')](_0x3ab9a4)['then'](handleEntityNotFound(_0x30e7bb,null))[_0x599f('0x25')](respondWithResult(_0x30e7bb,null))['catch'](handleError(_0x30e7bb,null));};exports['create']=function(_0x1edda8,_0x51a468){return db['AnalyticFieldReport'][_0x599f('0x47')](_0x1edda8[_0x599f('0x48')],{})[_0x599f('0x25')](respondWithResult(_0x51a468,0xc9))['catch'](handleError(_0x51a468,null));};exports[_0x599f('0x49')]=function(_0x554fb4,_0x150703){return db[_0x599f('0x2b')][_0x599f('0x49')](_0x554fb4[_0x599f('0x48')],{'raw':![],'individualHooks':!![]})[_0x599f('0x25')](respondWithResult(_0x150703,0xc9))[_0x599f('0x44')](handleError(_0x150703,null));};exports[_0x599f('0x24')]=function(_0x17aff6,_0xcbab6){if(_0x17aff6[_0x599f('0x48')]['id']){delete _0x17aff6[_0x599f('0x48')]['id'];}return db[_0x599f('0x2b')]['find']({'where':{'id':_0x17aff6['params']['id']}})[_0x599f('0x25')](handleEntityNotFound(_0xcbab6,null))[_0x599f('0x25')](saveUpdates(_0x17aff6[_0x599f('0x48')],null))[_0x599f('0x25')](respondWithResult(_0xcbab6,null))[_0x599f('0x44')](handleError(_0xcbab6,null));};exports[_0x599f('0x26')]=function(_0x567f9c,_0x26d43e){return db[_0x599f('0x2b')][_0x599f('0x46')]({'where':{'id':_0x567f9c['params']['id']}})[_0x599f('0x25')](handleEntityNotFound(_0x26d43e,null))[_0x599f('0x25')](removeEntity(_0x26d43e,null))[_0x599f('0x44')](handleError(_0x26d43e,null));};exports[_0x599f('0x4a')]=function(_0x30e97b,_0x11b790){return db[_0x599f('0x2b')][_0x599f('0x26')]({'where':{'id':_0x30e97b[_0x599f('0x30')][_0x599f('0x4b')]||[]},'raw':![],'individualHooks':!![]})[_0x599f('0x25')](respondWithResult(_0x11b790,0xcc))[_0x599f('0x44')](handleError(_0x11b790,null));};exports[_0x599f('0x4c')]=function(_0x59a36d,_0x3b5d2c,_0x8e4745){return db[_0x599f('0x4d')][_0x599f('0x4e')]({'where':{'id':_0x59a36d['params']['id']}})[_0x599f('0x25')](handleEntityNotFound(_0x3b5d2c,null))[_0x599f('0x25')](function(_0x183b70){if(_0x183b70){return db['sequelize'][_0x599f('0x4f')](function(_0x38210a){return db[_0x599f('0x2b')][_0x599f('0x26')]({'where':{'CustomReportId':_0x59a36d[_0x599f('0x45')]['id']},'transaction':_0x38210a})[_0x599f('0x25')](function(_0x422bec){var _0x2ff754=_['map'](_0x59a36d['body'],function(_0x140129){delete _0x140129['id'];_0x140129[_0x599f('0x50')]=_0x59a36d['params']['id'];return _0x140129;});return db[_0x599f('0x2b')][_0x599f('0x49')](_0x2ff754,{'transaction':_0x38210a});});})[_0x599f('0x25')](function(){return db[_0x599f('0x2b')][_0x599f('0x42')]({'where':{'CustomReportId':_0x59a36d[_0x599f('0x45')]['id']}});});}})[_0x599f('0x25')](respondWithResult(_0x3b5d2c,null))[_0x599f('0x44')](handleError(_0x3b5d2c,null));}; \ No newline at end of file +var _0x47a9=['rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','error','stack','name','status','send','index','map','AnalyticFieldReport','fieldName','type','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','length','options','create','body','bulkCreate','update','find','destroy','ids','addFields','findOne','eml-format'];(function(_0x18a794,_0x335c63){var _0x4fadaa=function(_0x49b618){while(--_0x49b618){_0x18a794['push'](_0x18a794['shift']());}};_0x4fadaa(++_0x335c63);}(_0x47a9,0x9b));var _0x947a=function(_0x4dcaaf,_0x39bf5f){_0x4dcaaf=_0x4dcaaf-0x0;var _0x5c6fa2=_0x47a9[_0x4dcaaf];return _0x5c6fa2;};'use strict';var emlformat=require(_0x947a('0x0'));var rimraf=require(_0x947a('0x1'));var zipdir=require(_0x947a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x947a('0x3'));var moment=require(_0x947a('0x4'));var BPromise=require(_0x947a('0x5'));var Mustache=require('mustache');var util=require(_0x947a('0x6'));var path=require(_0x947a('0x7'));var sox=require(_0x947a('0x8'));var csv=require(_0x947a('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x947a('0xa'));var _=require(_0x947a('0xb'));var squel=require(_0x947a('0xc'));var crypto=require('crypto');var jsforce=require(_0x947a('0xd'));var deskjs=require(_0x947a('0xe'));var toCsv=require(_0x947a('0x9'));var querystring=require(_0x947a('0xf'));var Papa=require(_0x947a('0x10'));var Redis=require('ioredis');var authService=require(_0x947a('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x947a('0x12'));var logger=require(_0x947a('0x13'))(_0x947a('0x14'));var utils=require(_0x947a('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3e0134,_0x29a24a){_0x29a24a=_0x29a24a||0xcc;return function(_0x18c83e){if(_0x18c83e){return _0x3e0134[_0x947a('0x16')](_0x29a24a);}return _0x3e0134['status'](_0x29a24a)[_0x947a('0x17')]();};}function respondWithResult(_0x14c11a,_0x5d5a2b){_0x5d5a2b=_0x5d5a2b||0xc8;return function(_0x238742){if(_0x238742){return _0x14c11a['status'](_0x5d5a2b)[_0x947a('0x18')](_0x238742);}};}function respondWithFilteredResult(_0x3b3207,_0x368161){return function(_0x4516fa){if(_0x4516fa){var _0x12bb41=typeof _0x368161[_0x947a('0x19')]===_0x947a('0x1a')&&typeof _0x368161['limit']===_0x947a('0x1a');var _0x2ad5f2=_0x4516fa[_0x947a('0x1b')];var _0x512298=_0x12bb41?0x0:_0x368161[_0x947a('0x19')];var _0x110906=_0x12bb41?_0x4516fa[_0x947a('0x1b')]:_0x368161[_0x947a('0x19')]+_0x368161[_0x947a('0x1c')];var _0x3c4086;if(_0x110906>=_0x2ad5f2){_0x110906=_0x2ad5f2;_0x3c4086=0xc8;}else{_0x3c4086=0xce;}_0x3b3207['status'](_0x3c4086);return _0x3b3207[_0x947a('0x1d')](_0x947a('0x1e'),_0x512298+'-'+_0x110906+'/'+_0x2ad5f2)[_0x947a('0x18')](_0x4516fa);}return null;};}function patchUpdates(_0x3ba1a2){return function(_0x57e6e2){try{jsonpatch[_0x947a('0x1f')](_0x57e6e2,_0x3ba1a2,!![]);}catch(_0x45834c){return BPromise[_0x947a('0x20')](_0x45834c);}return _0x57e6e2[_0x947a('0x21')]();};}function saveUpdates(_0x518764,_0x214f5c){return function(_0x5e056d){if(_0x5e056d){return _0x5e056d['update'](_0x518764)['then'](function(_0x5dbde2){return _0x5dbde2;});}return null;};}function removeEntity(_0x1d9ebb,_0x397501){return function(_0x4741c1){if(_0x4741c1){return _0x4741c1['destroy']()[_0x947a('0x22')](function(){_0x1d9ebb['status'](0xcc)[_0x947a('0x17')]();});}};}function handleEntityNotFound(_0x20d021,_0x5274f2){return function(_0x519a15){if(!_0x519a15){_0x20d021[_0x947a('0x16')](0x194);}return _0x519a15;};}function handleError(_0x36060d,_0x17336b){_0x17336b=_0x17336b||0x1f4;return function(_0x212bc5){logger[_0x947a('0x23')](_0x212bc5[_0x947a('0x24')]);if(_0x212bc5[_0x947a('0x25')]){delete _0x212bc5[_0x947a('0x25')];}_0x36060d[_0x947a('0x26')](_0x17336b)[_0x947a('0x27')](_0x212bc5);};}exports[_0x947a('0x28')]=function(_0x143e00,_0x544312){var _0x3163c7={},_0x59ce3b={},_0x25305d={'count':0x0,'rows':[]};var _0x1633fe=_[_0x947a('0x29')](db[_0x947a('0x2a')]['rawAttributes'],function(_0x54bb38){return{'name':_0x54bb38[_0x947a('0x2b')],'type':_0x54bb38[_0x947a('0x2c')]['key']};});_0x59ce3b['model']=_['map'](_0x1633fe,_0x947a('0x25'));_0x59ce3b[_0x947a('0x2d')]=_[_0x947a('0x2e')](_0x143e00[_0x947a('0x2d')]);_0x59ce3b[_0x947a('0x2f')]=_[_0x947a('0x30')](_0x59ce3b[_0x947a('0x31')],_0x59ce3b[_0x947a('0x2d')]);_0x3163c7['attributes']=_['intersection'](_0x59ce3b[_0x947a('0x31')],qs[_0x947a('0x32')](_0x143e00[_0x947a('0x2d')]['fields']));_0x3163c7[_0x947a('0x33')]=_0x3163c7[_0x947a('0x33')]['length']?_0x3163c7[_0x947a('0x33')]:_0x59ce3b['model'];if(!_0x143e00['query'][_0x947a('0x34')]('nolimit')){_0x3163c7[_0x947a('0x1c')]=qs[_0x947a('0x1c')](_0x143e00['query'][_0x947a('0x1c')]);_0x3163c7[_0x947a('0x19')]=qs[_0x947a('0x19')](_0x143e00[_0x947a('0x2d')][_0x947a('0x19')]);}_0x3163c7[_0x947a('0x35')]=qs[_0x947a('0x36')](_0x143e00[_0x947a('0x2d')][_0x947a('0x36')]);_0x3163c7[_0x947a('0x37')]=qs['filters'](_[_0x947a('0x38')](_0x143e00['query'],_0x59ce3b[_0x947a('0x2f')]),_0x1633fe);if(_0x143e00[_0x947a('0x2d')][_0x947a('0x39')]){_0x3163c7[_0x947a('0x37')]=_['merge'](_0x3163c7[_0x947a('0x37')],{'$or':_[_0x947a('0x29')](_0x1633fe,function(_0xb8311d){if(_0xb8311d[_0x947a('0x2c')]!==_0x947a('0x3a')){var _0x52f150={};_0x52f150[_0xb8311d[_0x947a('0x25')]]={'$like':'%'+_0x143e00[_0x947a('0x2d')][_0x947a('0x39')]+'%'};return _0x52f150;}})});}_0x3163c7=_[_0x947a('0x3b')]({},_0x3163c7,_0x143e00['options']);var _0x54b91c={'where':_0x3163c7['where']};return db[_0x947a('0x2a')]['count'](_0x54b91c)['then'](function(_0x148df9){_0x25305d[_0x947a('0x1b')]=_0x148df9;if(_0x143e00[_0x947a('0x2d')][_0x947a('0x3c')]){_0x3163c7[_0x947a('0x3d')]=[{'all':!![]}];}return db['AnalyticFieldReport'][_0x947a('0x3e')](_0x3163c7);})[_0x947a('0x22')](function(_0x5b5e26){_0x25305d[_0x947a('0x3f')]=_0x5b5e26;return _0x25305d;})['then'](respondWithFilteredResult(_0x544312,_0x3163c7))[_0x947a('0x40')](handleError(_0x544312,null));};exports[_0x947a('0x41')]=function(_0x1e82cc,_0x419d41){var _0x1d8a57={'raw':![],'where':{'id':_0x1e82cc[_0x947a('0x42')]['id']}},_0x1bf8cb={};_0x1bf8cb[_0x947a('0x31')]=_[_0x947a('0x2e')](db[_0x947a('0x2a')]['rawAttributes']);_0x1bf8cb[_0x947a('0x2d')]=_['keys'](_0x1e82cc[_0x947a('0x2d')]);_0x1bf8cb[_0x947a('0x2f')]=_['intersection'](_0x1bf8cb[_0x947a('0x31')],_0x1bf8cb[_0x947a('0x2d')]);_0x1d8a57[_0x947a('0x33')]=_[_0x947a('0x30')](_0x1bf8cb['model'],qs[_0x947a('0x32')](_0x1e82cc[_0x947a('0x2d')][_0x947a('0x32')]));_0x1d8a57[_0x947a('0x33')]=_0x1d8a57[_0x947a('0x33')][_0x947a('0x43')]?_0x1d8a57[_0x947a('0x33')]:_0x1bf8cb['model'];if(_0x1e82cc[_0x947a('0x2d')][_0x947a('0x3c')]){_0x1d8a57[_0x947a('0x3d')]=[{'all':!![]}];}_0x1d8a57=_[_0x947a('0x3b')]({},_0x1d8a57,_0x1e82cc[_0x947a('0x44')]);return db[_0x947a('0x2a')]['find'](_0x1d8a57)[_0x947a('0x22')](handleEntityNotFound(_0x419d41,null))[_0x947a('0x22')](respondWithResult(_0x419d41,null))[_0x947a('0x40')](handleError(_0x419d41,null));};exports[_0x947a('0x45')]=function(_0x39c745,_0x3a7551){return db[_0x947a('0x2a')][_0x947a('0x45')](_0x39c745[_0x947a('0x46')],{})[_0x947a('0x22')](respondWithResult(_0x3a7551,0xc9))[_0x947a('0x40')](handleError(_0x3a7551,null));};exports[_0x947a('0x47')]=function(_0x3054c7,_0x5adf05){return db[_0x947a('0x2a')]['bulkCreate'](_0x3054c7[_0x947a('0x46')],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x5adf05,0xc9))[_0x947a('0x40')](handleError(_0x5adf05,null));};exports[_0x947a('0x48')]=function(_0x3f6377,_0x5150eb){if(_0x3f6377[_0x947a('0x46')]['id']){delete _0x3f6377[_0x947a('0x46')]['id'];}return db[_0x947a('0x2a')][_0x947a('0x49')]({'where':{'id':_0x3f6377['params']['id']}})[_0x947a('0x22')](handleEntityNotFound(_0x5150eb,null))[_0x947a('0x22')](saveUpdates(_0x3f6377[_0x947a('0x46')],null))['then'](respondWithResult(_0x5150eb,null))[_0x947a('0x40')](handleError(_0x5150eb,null));};exports[_0x947a('0x4a')]=function(_0x270b9f,_0x4cd0ed){return db[_0x947a('0x2a')][_0x947a('0x49')]({'where':{'id':_0x270b9f[_0x947a('0x42')]['id']}})['then'](handleEntityNotFound(_0x4cd0ed,null))[_0x947a('0x22')](removeEntity(_0x4cd0ed,null))[_0x947a('0x40')](handleError(_0x4cd0ed,null));};exports['bulkDestroy']=function(_0x368d71,_0x248f5b){return db[_0x947a('0x2a')][_0x947a('0x4a')]({'where':{'id':_0x368d71[_0x947a('0x2d')][_0x947a('0x4b')]||[]},'raw':![],'individualHooks':!![]})[_0x947a('0x22')](respondWithResult(_0x248f5b,0xcc))[_0x947a('0x40')](handleError(_0x248f5b,null));};exports[_0x947a('0x4c')]=function(_0x4f4dfa,_0x4faadd,_0x2883ba){return db['AnalyticCustomReport'][_0x947a('0x4d')]({'where':{'id':_0x4f4dfa['params']['id']}})[_0x947a('0x22')](handleEntityNotFound(_0x4faadd,null))['then'](function(_0x2a3ce7){if(_0x2a3ce7){return db['sequelize']['transaction'](function(_0x5d65a5){return db[_0x947a('0x2a')]['destroy']({'where':{'CustomReportId':_0x4f4dfa[_0x947a('0x42')]['id']},'transaction':_0x5d65a5})['then'](function(_0x5436ac){var _0xc8cbfc=_['map'](_0x4f4dfa[_0x947a('0x46')],function(_0x31579e){delete _0x31579e['id'];_0x31579e['CustomReportId']=_0x4f4dfa[_0x947a('0x42')]['id'];return _0x31579e;});return db[_0x947a('0x2a')][_0x947a('0x47')](_0xc8cbfc,{'transaction':_0x5d65a5});});})['then'](function(){return db[_0x947a('0x2a')]['findAll']({'where':{'CustomReportId':_0x4f4dfa[_0x947a('0x42')]['id']}});});}})[_0x947a('0x22')](respondWithResult(_0x4faadd,null))['catch'](handleError(_0x4faadd,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index db34d62..8d659c7 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 _0x0039=['moment','bluebird','path','rimraf','../../config/environment','./analyticFieldReport.attributes','exports','AnalyticFieldReport','analytics_report_fields','lodash','util','../../config/logger'];(function(_0x50a843,_0x4de0b0){var _0x270d03=function(_0x228107){while(--_0x228107){_0x50a843['push'](_0x50a843['shift']());}};_0x270d03(++_0x4de0b0);}(_0x0039,0xf9));var _0x9003=function(_0x1ff110,_0xb6cef2){_0x1ff110=_0x1ff110-0x0;var _0x342283=_0x0039[_0x1ff110];return _0x342283;};'use strict';var _=require(_0x9003('0x0'));var util=require(_0x9003('0x1'));var logger=require(_0x9003('0x2'))('api');var moment=require(_0x9003('0x3'));var BPromise=require(_0x9003('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9003('0x5'));var rimraf=require(_0x9003('0x6'));var config=require(_0x9003('0x7'));var attributes=require(_0x9003('0x8'));module[_0x9003('0x9')]=function(_0x46fc59,_0x52f40f){return _0x46fc59['define'](_0x9003('0xa'),attributes,{'tableName':_0x9003('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8041=['bluebird','rimraf','../../config/environment','./analyticFieldReport.attributes','define','analytics_report_fields','../../config/logger','api'];(function(_0x25d2fb,_0x18a774){var _0x1ded53=function(_0x4c0715){while(--_0x4c0715){_0x25d2fb['push'](_0x25d2fb['shift']());}};_0x1ded53(++_0x18a774);}(_0x8041,0x17e));var _0x1804=function(_0xf99553,_0x52f679){_0xf99553=_0xf99553-0x0;var _0x10a965=_0x8041[_0xf99553];return _0x10a965;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1804('0x0'))(_0x1804('0x1'));var moment=require('moment');var BPromise=require(_0x1804('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1804('0x3'));var config=require(_0x1804('0x4'));var attributes=require(_0x1804('0x5'));module['exports']=function(_0x8bb39a,_0x26c319){return _0x8bb39a[_0x1804('0x6')]('AnalyticFieldReport',attributes,{'tableName':_0x1804('0x7'),'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 ae0f0c4..e645883 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 _0x2435=['code','error','AnalyticFieldReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','info','request\x20sent','debug','stringify'];(function(_0x557d3f,_0xf772a2){var _0x19155e=function(_0x497853){while(--_0x497853){_0x557d3f['push'](_0x557d3f['shift']());}};_0x19155e(++_0xf772a2);}(_0x2435,0x8a));var _0x5243=function(_0x5a776b,_0x46f785){_0x5a776b=_0x5a776b-0x0;var _0xbbef59=_0x2435[_0x5a776b];return _0xbbef59;};'use strict';var _=require(_0x5243('0x0'));var util=require(_0x5243('0x1'));var moment=require(_0x5243('0x2'));var BPromise=require(_0x5243('0x3'));var rs=require(_0x5243('0x4'));var fs=require('fs');var Redis=require(_0x5243('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x5243('0x6'));var logger=require('../../config/logger')(_0x5243('0x7'));var config=require(_0x5243('0x8'));var jayson=require(_0x5243('0x9'));var client=jayson[_0x5243('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xa98f6,_0x2a7746,_0x4f6d48){return new BPromise(function(_0xb03a30,_0x45ff08){return client[_0x5243('0xb')](_0xa98f6,_0x4f6d48)['then'](function(_0x419d7c){logger[_0x5243('0xc')]('AnalyticFieldReport,\x20%s,\x20%s',_0x2a7746,_0x5243('0xd'));logger[_0x5243('0xe')]('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0x2a7746,_0x5243('0xd'),JSON[_0x5243('0xf')](_0x419d7c));if(_0x419d7c['error']){if(_0x419d7c['error'][_0x5243('0x10')]===0x1f4){logger[_0x5243('0x11')](_0x5243('0x12'),_0x2a7746,_0x419d7c[_0x5243('0x11')][_0x5243('0x13')]);return _0x45ff08(_0x419d7c[_0x5243('0x11')]['message']);}logger[_0x5243('0x11')](_0x5243('0x12'),_0x2a7746,_0x419d7c[_0x5243('0x11')]['message']);return _0xb03a30(_0x419d7c['error'][_0x5243('0x13')]);}else{logger[_0x5243('0xc')]('AnalyticFieldReport,\x20%s,\x20%s',_0x2a7746,_0x5243('0xd'));_0xb03a30(_0x419d7c[_0x5243('0x14')][_0x5243('0x13')]);}})[_0x5243('0x15')](function(_0x5bdcf9){logger[_0x5243('0x11')](_0x5243('0x12'),_0x2a7746,_0x5bdcf9);_0x45ff08(_0x5bdcf9);});});} \ No newline at end of file +var _0x23fa=['error','code','message','request\x20sent','catch','lodash','moment','bluebird','randomstring','../../mysqldb','rpc','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s'];(function(_0x2beb43,_0x1188d6){var _0x540848=function(_0x126b57){while(--_0x126b57){_0x2beb43['push'](_0x2beb43['shift']());}};_0x540848(++_0x1188d6);}(_0x23fa,0x9e));var _0xa23f=function(_0xc2f834,_0x5e49d8){_0xc2f834=_0xc2f834-0x0;var _0x34668f=_0x23fa[_0xc2f834];return _0x34668f;};'use strict';var _=require(_0xa23f('0x0'));var util=require('util');var moment=require(_0xa23f('0x1'));var BPromise=require(_0xa23f('0x2'));var rs=require(_0xa23f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa23f('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa23f('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5712d8,_0x13ca67,_0x23213d){return new BPromise(function(_0x5b9355,_0x3bac43){return client[_0xa23f('0x6')](_0x5712d8,_0x23213d)[_0xa23f('0x7')](function(_0x2c18d3){logger[_0xa23f('0x8')](_0xa23f('0x9'),_0x13ca67,'request\x20sent');logger[_0xa23f('0xa')](_0xa23f('0xb'),_0x13ca67,'request\x20sent',JSON['stringify'](_0x2c18d3));if(_0x2c18d3[_0xa23f('0xc')]){if(_0x2c18d3[_0xa23f('0xc')][_0xa23f('0xd')]===0x1f4){logger[_0xa23f('0xc')](_0xa23f('0x9'),_0x13ca67,_0x2c18d3[_0xa23f('0xc')][_0xa23f('0xe')]);return _0x3bac43(_0x2c18d3[_0xa23f('0xc')][_0xa23f('0xe')]);}logger[_0xa23f('0xc')](_0xa23f('0x9'),_0x13ca67,_0x2c18d3[_0xa23f('0xc')]['message']);return _0x5b9355(_0x2c18d3['error'][_0xa23f('0xe')]);}else{logger[_0xa23f('0x8')]('AnalyticFieldReport,\x20%s,\x20%s',_0x13ca67,_0xa23f('0xf'));_0x5b9355(_0x2c18d3['result'][_0xa23f('0xe')]);}})[_0xa23f('0x10')](function(_0x22cd15){logger[_0xa23f('0xc')](_0xa23f('0x9'),_0x13ca67,_0x22cd15);_0x3bac43(_0x22cd15);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 69bb356..1efb529 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(_0x3b2fd8,_0x1f5100){var _0x1c1b8a=function(_0x1fbd07){while(--_0x1fbd07){_0x3b2fd8['push'](_0x3b2fd8['shift']());}};_0x1c1b8a(++_0x1f5100);}(_0xa9e0,0x123));var _0x0a9e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa9e0[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0a9e('0xb')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xb')](_0x0a9e('0xf'),auth['isAuthenticated'](),controller['addFields']);router['put']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);module[_0x0a9e('0x15')]=router; \ No newline at end of file +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(_0xfb0ebf,_0x2efd36){var _0x44639e=function(_0x5839ee){while(--_0x5839ee){_0xfb0ebf['push'](_0xfb0ebf['shift']());}};_0x44639e(++_0x2efd36);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));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 c65f969..f14c453 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 _0x9f4d=['TEXT','sequelize','exports','STRING','name'];(function(_0x2c0a07,_0x56553b){var _0x515ba5=function(_0x384f1e){while(--_0x384f1e){_0x2c0a07['push'](_0x2c0a07['shift']());}};_0x515ba5(++_0x56553b);}(_0x9f4d,0xb0));var _0xd9f4=function(_0x2b7567,_0x412715){_0x2b7567=_0x2b7567-0x0;var _0x2522dc=_0x9f4d[_0x2b7567];return _0x2522dc;};'use strict';var Sequelize=require(_0xd9f4('0x0'));module[_0xd9f4('0x1')]={'name':{'type':Sequelize[_0xd9f4('0x2')],'allowNull':![],'unique':_0xd9f4('0x3')},'table':{'type':Sequelize[_0xd9f4('0x2')]},'metric':{'type':Sequelize[_0xd9f4('0x4')]},'description':{'type':Sequelize[_0xd9f4('0x2')]}}; \ No newline at end of file +var _0xb458=['name','TEXT','sequelize','exports','STRING'];(function(_0x18f396,_0x174d17){var _0x3ba532=function(_0x2bc92f){while(--_0x2bc92f){_0x18f396['push'](_0x18f396['shift']());}};_0x3ba532(++_0x174d17);}(_0xb458,0xca));var _0x8b45=function(_0x5275e1,_0x11eae6){_0x5275e1=_0x5275e1-0x0;var _0x334a15=_0xb458[_0x5275e1];return _0x334a15;};'use strict';var Sequelize=require(_0x8b45('0x0'));module[_0x8b45('0x1')]={'name':{'type':Sequelize[_0x8b45('0x2')],'allowNull':![],'unique':_0x8b45('0x3')},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize[_0x8b45('0x4')]},'description':{'type':Sequelize[_0x8b45('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index fbc7d88..d08480d 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 _0x008c=['path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','save','update','then','destroy','get','stack','name','index','map','AnalyticMetric','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','options','include','findAll','catch','show','params','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util'];(function(_0xd0a0ae,_0x239a61){var _0x4da1a4=function(_0x10554c){while(--_0x10554c){_0xd0a0ae['push'](_0xd0a0ae['shift']());}};_0x4da1a4(++_0x239a61);}(_0x008c,0x188));var _0xc008=function(_0x121737,_0x37e36b){_0x121737=_0x121737-0x0;var _0x5f4d4b=_0x008c[_0x121737];return _0x5f4d4b;};'use strict';var emlformat=require(_0xc008('0x0'));var rimraf=require(_0xc008('0x1'));var zipdir=require(_0xc008('0x2'));var jsonpatch=require(_0xc008('0x3'));var rp=require(_0xc008('0x4'));var moment=require('moment');var BPromise=require(_0xc008('0x5'));var Mustache=require(_0xc008('0x6'));var util=require(_0xc008('0x7'));var path=require(_0xc008('0x8'));var sox=require(_0xc008('0x9'));var csv=require(_0xc008('0xa'));var ejs=require(_0xc008('0xb'));var fs=require('fs');var fs_extra=require(_0xc008('0xc'));var _=require(_0xc008('0xd'));var squel=require('squel');var crypto=require(_0xc008('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc008('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc008('0x10'));var Redis=require(_0xc008('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc008('0x12'));var logger=require(_0xc008('0x13'))('api');var utils=require(_0xc008('0x14'));var config=require(_0xc008('0x15'));var licenseUtil=require(_0xc008('0x16'));var db=require(_0xc008('0x17'))['db'];function respondWithStatusCode(_0x9ffa93,_0x1819c6){_0x1819c6=_0x1819c6||0xcc;return function(_0x69726e){if(_0x69726e){return _0x9ffa93['sendStatus'](_0x1819c6);}return _0x9ffa93['status'](_0x1819c6)[_0xc008('0x18')]();};}function respondWithResult(_0x50c1ab,_0x25e13f){_0x25e13f=_0x25e13f||0xc8;return function(_0x4584e1){if(_0x4584e1){return _0x50c1ab[_0xc008('0x19')](_0x25e13f)[_0xc008('0x1a')](_0x4584e1);}};}function respondWithFilteredResult(_0x3f0ecf,_0x5ee00b){return function(_0x5e894e){if(_0x5e894e){var _0x4bd0f4=typeof _0x5ee00b[_0xc008('0x1b')]===_0xc008('0x1c')&&typeof _0x5ee00b[_0xc008('0x1d')]===_0xc008('0x1c');var _0x4fe771=_0x5e894e['count'];var _0x540e45=_0x4bd0f4?0x0:_0x5ee00b['offset'];var _0x46042b=_0x4bd0f4?_0x5e894e[_0xc008('0x1e')]:_0x5ee00b['offset']+_0x5ee00b[_0xc008('0x1d')];var _0x5906e6;if(_0x46042b>=_0x4fe771){_0x46042b=_0x4fe771;_0x5906e6=0xc8;}else{_0x5906e6=0xce;}_0x3f0ecf['status'](_0x5906e6);return _0x3f0ecf['set']('Content-Range',_0x540e45+'-'+_0x46042b+'/'+_0x4fe771)[_0xc008('0x1a')](_0x5e894e);}return null;};}function patchUpdates(_0x4b9726){return function(_0x5560b1){try{jsonpatch['apply'](_0x5560b1,_0x4b9726,!![]);}catch(_0x4a582d){return BPromise['reject'](_0x4a582d);}return _0x5560b1[_0xc008('0x1f')]();};}function saveUpdates(_0x4777a6,_0x251db2){return function(_0x415af3){if(_0x415af3){return _0x415af3[_0xc008('0x20')](_0x4777a6)[_0xc008('0x21')](function(_0x4f43e2){return _0x4f43e2;});}return null;};}function removeEntity(_0x459fd9,_0x5c85f2){return function(_0x58a6ea){if(_0x58a6ea){return _0x58a6ea[_0xc008('0x22')]()[_0xc008('0x21')](function(){var _0x2e3cfb=_0x58a6ea[_0xc008('0x23')]({'plain':!![]});var _0x5410f5='Metrics';return db['UserProfileResource'][_0xc008('0x22')]({'where':{'type':_0x5410f5,'resourceId':_0x2e3cfb['id']}})[_0xc008('0x21')](function(){return _0x58a6ea;});})[_0xc008('0x21')](function(){_0x459fd9[_0xc008('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e2aca,_0x4fce9c){return function(_0x4adbab){if(!_0x4adbab){_0x5e2aca['sendStatus'](0x194);}return _0x4adbab;};}function handleError(_0x3865c0,_0x29ba43){_0x29ba43=_0x29ba43||0x1f4;return function(_0x25eae4){logger['error'](_0x25eae4[_0xc008('0x24')]);if(_0x25eae4[_0xc008('0x25')]){delete _0x25eae4[_0xc008('0x25')];}_0x3865c0[_0xc008('0x19')](_0x29ba43)['send'](_0x25eae4);};}exports[_0xc008('0x26')]=function(_0x2e0b4e,_0x53ed35){var _0x58db82={},_0x539766={},_0x1032b2={'count':0x0,'rows':[]};var _0x267abd=_[_0xc008('0x27')](db[_0xc008('0x28')][_0xc008('0x29')],function(_0xceebc3){return{'name':_0xceebc3[_0xc008('0x2a')],'type':_0xceebc3[_0xc008('0x2b')][_0xc008('0x2c')]};});_0x539766[_0xc008('0x2d')]=_[_0xc008('0x27')](_0x267abd,_0xc008('0x25'));_0x539766['query']=_[_0xc008('0x2e')](_0x2e0b4e[_0xc008('0x2f')]);_0x539766['filters']=_[_0xc008('0x30')](_0x539766[_0xc008('0x2d')],_0x539766[_0xc008('0x2f')]);_0x58db82[_0xc008('0x31')]=_[_0xc008('0x30')](_0x539766[_0xc008('0x2d')],qs[_0xc008('0x32')](_0x2e0b4e[_0xc008('0x2f')][_0xc008('0x32')]));_0x58db82['attributes']=_0x58db82[_0xc008('0x31')][_0xc008('0x33')]?_0x58db82[_0xc008('0x31')]:_0x539766[_0xc008('0x2d')];if(!_0x2e0b4e[_0xc008('0x2f')][_0xc008('0x34')](_0xc008('0x35'))){_0x58db82['limit']=qs[_0xc008('0x1d')](_0x2e0b4e[_0xc008('0x2f')]['limit']);_0x58db82[_0xc008('0x1b')]=qs[_0xc008('0x1b')](_0x2e0b4e['query'][_0xc008('0x1b')]);}_0x58db82[_0xc008('0x36')]=qs[_0xc008('0x37')](_0x2e0b4e['query']['sort']);_0x58db82['where']=qs[_0xc008('0x38')](_['pick'](_0x2e0b4e[_0xc008('0x2f')],_0x539766[_0xc008('0x38')]),_0x267abd);if(_0x2e0b4e[_0xc008('0x2f')][_0xc008('0x39')]){_0x58db82[_0xc008('0x3a')]=_[_0xc008('0x3b')](_0x58db82[_0xc008('0x3a')],{'$or':_[_0xc008('0x27')](_0x267abd,function(_0xffd2b3){if(_0xffd2b3[_0xc008('0x2b')]!==_0xc008('0x3c')){var _0xdfca2e={};_0xdfca2e[_0xffd2b3[_0xc008('0x25')]]={'$like':'%'+_0x2e0b4e[_0xc008('0x2f')]['filter']+'%'};return _0xdfca2e;}})});}_0x58db82=_[_0xc008('0x3b')]({},_0x58db82,_0x2e0b4e[_0xc008('0x3d')]);var _0x30b7df={'where':_0x58db82[_0xc008('0x3a')]};return db['AnalyticMetric'][_0xc008('0x1e')](_0x30b7df)[_0xc008('0x21')](function(_0xc8cb91){_0x1032b2[_0xc008('0x1e')]=_0xc8cb91;if(_0x2e0b4e[_0xc008('0x2f')]['includeAll']){_0x58db82[_0xc008('0x3e')]=[{'all':!![]}];}return db[_0xc008('0x28')][_0xc008('0x3f')](_0x58db82);})[_0xc008('0x21')](function(_0x7279e8){_0x1032b2['rows']=_0x7279e8;return _0x1032b2;})[_0xc008('0x21')](respondWithFilteredResult(_0x53ed35,_0x58db82))[_0xc008('0x40')](handleError(_0x53ed35,null));};exports[_0xc008('0x41')]=function(_0x408192,_0x4b80f3){var _0x26cd05={'raw':!![],'where':{'id':_0x408192[_0xc008('0x42')]['id']}},_0xe37446={};_0xe37446['model']=_[_0xc008('0x2e')](db['AnalyticMetric'][_0xc008('0x29')]);_0xe37446['query']=_[_0xc008('0x2e')](_0x408192[_0xc008('0x2f')]);_0xe37446['filters']=_[_0xc008('0x30')](_0xe37446[_0xc008('0x2d')],_0xe37446[_0xc008('0x2f')]);_0x26cd05['attributes']=_[_0xc008('0x30')](_0xe37446[_0xc008('0x2d')],qs[_0xc008('0x32')](_0x408192[_0xc008('0x2f')][_0xc008('0x32')]));_0x26cd05[_0xc008('0x31')]=_0x26cd05['attributes']['length']?_0x26cd05['attributes']:_0xe37446[_0xc008('0x2d')];if(_0x408192[_0xc008('0x2f')][_0xc008('0x43')]){_0x26cd05[_0xc008('0x3e')]=[{'all':!![]}];}_0x26cd05=_[_0xc008('0x3b')]({},_0x26cd05,_0x408192[_0xc008('0x3d')]);return db[_0xc008('0x28')][_0xc008('0x44')](_0x26cd05)['then'](handleEntityNotFound(_0x4b80f3,null))['then'](respondWithResult(_0x4b80f3,null))['catch'](handleError(_0x4b80f3,null));};exports[_0xc008('0x45')]=function(_0x2651cf,_0x158eae){return db['AnalyticMetric'][_0xc008('0x45')](_0x2651cf[_0xc008('0x46')],{})[_0xc008('0x21')](function(_0x1c2c50){var _0x4981b4=_0x2651cf[_0xc008('0x47')][_0xc008('0x23')]({'plain':!![]});if(!_0x4981b4)throw new Error(_0xc008('0x48'));if(_0x4981b4[_0xc008('0x49')]===_0xc008('0x47')){var _0x52c444=_0x1c2c50['get']({'plain':!![]});var _0x223056='Metrics';return db[_0xc008('0x4a')][_0xc008('0x44')]({'where':{'name':_0x223056,'userProfileId':_0x4981b4[_0xc008('0x4b')]},'raw':!![]})['then'](function(_0x144ab2){if(_0x144ab2&&_0x144ab2[_0xc008('0x4c')]===0x0){return db[_0xc008('0x4d')][_0xc008('0x45')]({'name':_0x52c444[_0xc008('0x25')],'resourceId':_0x52c444['id'],'type':_0x144ab2['name'],'sectionId':_0x144ab2['id']},{})[_0xc008('0x21')](function(){return _0x1c2c50;});}else{return _0x1c2c50;}})[_0xc008('0x40')](function(_0x4b4c6d){logger[_0xc008('0x4e')](_0xc008('0x4f'),_0x4b4c6d);throw _0x4b4c6d;});}return _0x1c2c50;})['then'](respondWithResult(_0x158eae,0xc9))['catch'](handleError(_0x158eae,null));};exports[_0xc008('0x20')]=function(_0xd47b74,_0x20947b){if(_0xd47b74[_0xc008('0x46')]['id']){delete _0xd47b74[_0xc008('0x46')]['id'];}return db['AnalyticMetric']['find']({'where':{'id':_0xd47b74[_0xc008('0x42')]['id']}})['then'](handleEntityNotFound(_0x20947b,null))[_0xc008('0x21')](saveUpdates(_0xd47b74[_0xc008('0x46')],null))[_0xc008('0x21')](respondWithResult(_0x20947b,null))[_0xc008('0x40')](handleError(_0x20947b,null));};exports[_0xc008('0x22')]=function(_0x27a167,_0x49d8b0){return db[_0xc008('0x28')][_0xc008('0x44')]({'where':{'id':_0x27a167[_0xc008('0x42')]['id']}})[_0xc008('0x21')](handleEntityNotFound(_0x49d8b0,null))[_0xc008('0x21')](removeEntity(_0x49d8b0,null))['catch'](handleError(_0x49d8b0,null));}; \ No newline at end of file +var _0xd6d6=['includeAll','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Metrics','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','merge','where','VIRTUAL','options','include','AnalyticMetric','rows','show'];(function(_0x400423,_0x192af9){var _0x337e55=function(_0x397bd2){while(--_0x397bd2){_0x400423['push'](_0x400423['shift']());}};_0x337e55(++_0x192af9);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x44ad88,_0xc510c7){_0x44ad88=_0x44ad88-0x0;var _0x1d42ec=_0xd6d6[_0x44ad88];return _0x1d42ec;};'use strict';var emlformat=require(_0x6d6d('0x0'));var rimraf=require(_0x6d6d('0x1'));var zipdir=require(_0x6d6d('0x2'));var jsonpatch=require(_0x6d6d('0x3'));var rp=require('request-promise');var moment=require(_0x6d6d('0x4'));var BPromise=require(_0x6d6d('0x5'));var Mustache=require(_0x6d6d('0x6'));var util=require(_0x6d6d('0x7'));var path=require(_0x6d6d('0x8'));var sox=require(_0x6d6d('0x9'));var csv=require(_0x6d6d('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6d6d('0xb'));var _=require(_0x6d6d('0xc'));var squel=require(_0x6d6d('0xd'));var crypto=require(_0x6d6d('0xe'));var jsforce=require(_0x6d6d('0xf'));var deskjs=require(_0x6d6d('0x10'));var toCsv=require(_0x6d6d('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6d6d('0x11'));var authService=require(_0x6d6d('0x12'));var qs=require(_0x6d6d('0x13'));var as=require(_0x6d6d('0x14'));var hardwareService=require(_0x6d6d('0x15'));var logger=require('../../config/logger')(_0x6d6d('0x16'));var utils=require(_0x6d6d('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x6d6d('0x18'))['db'];function respondWithStatusCode(_0x32146d,_0xe61c36){_0xe61c36=_0xe61c36||0xcc;return function(_0x3f8542){if(_0x3f8542){return _0x32146d[_0x6d6d('0x19')](_0xe61c36);}return _0x32146d[_0x6d6d('0x1a')](_0xe61c36)[_0x6d6d('0x1b')]();};}function respondWithResult(_0x2cb2dd,_0x5f4154){_0x5f4154=_0x5f4154||0xc8;return function(_0xd09ea7){if(_0xd09ea7){return _0x2cb2dd[_0x6d6d('0x1a')](_0x5f4154)[_0x6d6d('0x1c')](_0xd09ea7);}};}function respondWithFilteredResult(_0xa3b05d,_0x29cbd8){return function(_0x5d80c0){if(_0x5d80c0){var _0x2e6fdb=typeof _0x29cbd8['offset']===_0x6d6d('0x1d')&&typeof _0x29cbd8[_0x6d6d('0x1e')]===_0x6d6d('0x1d');var _0x4bb3d1=_0x5d80c0['count'];var _0x9e1e18=_0x2e6fdb?0x0:_0x29cbd8[_0x6d6d('0x1f')];var _0x2b59d4=_0x2e6fdb?_0x5d80c0[_0x6d6d('0x20')]:_0x29cbd8['offset']+_0x29cbd8['limit'];var _0x474873;if(_0x2b59d4>=_0x4bb3d1){_0x2b59d4=_0x4bb3d1;_0x474873=0xc8;}else{_0x474873=0xce;}_0xa3b05d['status'](_0x474873);return _0xa3b05d[_0x6d6d('0x21')](_0x6d6d('0x22'),_0x9e1e18+'-'+_0x2b59d4+'/'+_0x4bb3d1)[_0x6d6d('0x1c')](_0x5d80c0);}return null;};}function patchUpdates(_0x450352){return function(_0x40d35b){try{jsonpatch[_0x6d6d('0x23')](_0x40d35b,_0x450352,!![]);}catch(_0x164c67){return BPromise[_0x6d6d('0x24')](_0x164c67);}return _0x40d35b[_0x6d6d('0x25')]();};}function saveUpdates(_0x6f64e3,_0x24b10d){return function(_0x6e58e3){if(_0x6e58e3){return _0x6e58e3[_0x6d6d('0x26')](_0x6f64e3)[_0x6d6d('0x27')](function(_0x1f7f88){return _0x1f7f88;});}return null;};}function removeEntity(_0x25a02e,_0xced622){return function(_0x583b10){if(_0x583b10){return _0x583b10[_0x6d6d('0x28')]()[_0x6d6d('0x27')](function(){var _0x99f7d6=_0x583b10[_0x6d6d('0x29')]({'plain':!![]});var _0xf0df7f=_0x6d6d('0x2a');return db['UserProfileResource'][_0x6d6d('0x28')]({'where':{'type':_0xf0df7f,'resourceId':_0x99f7d6['id']}})[_0x6d6d('0x27')](function(){return _0x583b10;});})[_0x6d6d('0x27')](function(){_0x25a02e[_0x6d6d('0x1a')](0xcc)[_0x6d6d('0x1b')]();});}};}function handleEntityNotFound(_0x408f98,_0x3641fc){return function(_0x4a57a1){if(!_0x4a57a1){_0x408f98[_0x6d6d('0x19')](0x194);}return _0x4a57a1;};}function handleError(_0x9595d8,_0x51bd68){_0x51bd68=_0x51bd68||0x1f4;return function(_0x553645){logger[_0x6d6d('0x2b')](_0x553645[_0x6d6d('0x2c')]);if(_0x553645[_0x6d6d('0x2d')]){delete _0x553645['name'];}_0x9595d8[_0x6d6d('0x1a')](_0x51bd68)[_0x6d6d('0x2e')](_0x553645);};}exports[_0x6d6d('0x2f')]=function(_0x1c8340,_0x64d1f7){var _0x428c17={},_0xdda3f2={},_0x359cfd={'count':0x0,'rows':[]};var _0x6c4741=_[_0x6d6d('0x30')](db['AnalyticMetric'][_0x6d6d('0x31')],function(_0x4f1fc5){return{'name':_0x4f1fc5[_0x6d6d('0x32')],'type':_0x4f1fc5[_0x6d6d('0x33')][_0x6d6d('0x34')]};});_0xdda3f2[_0x6d6d('0x35')]=_['map'](_0x6c4741,_0x6d6d('0x2d'));_0xdda3f2['query']=_[_0x6d6d('0x36')](_0x1c8340[_0x6d6d('0x37')]);_0xdda3f2['filters']=_[_0x6d6d('0x38')](_0xdda3f2[_0x6d6d('0x35')],_0xdda3f2[_0x6d6d('0x37')]);_0x428c17[_0x6d6d('0x39')]=_[_0x6d6d('0x38')](_0xdda3f2[_0x6d6d('0x35')],qs[_0x6d6d('0x3a')](_0x1c8340[_0x6d6d('0x37')][_0x6d6d('0x3a')]));_0x428c17[_0x6d6d('0x39')]=_0x428c17[_0x6d6d('0x39')][_0x6d6d('0x3b')]?_0x428c17[_0x6d6d('0x39')]:_0xdda3f2[_0x6d6d('0x35')];if(!_0x1c8340['query'][_0x6d6d('0x3c')](_0x6d6d('0x3d'))){_0x428c17[_0x6d6d('0x1e')]=qs[_0x6d6d('0x1e')](_0x1c8340['query']['limit']);_0x428c17[_0x6d6d('0x1f')]=qs[_0x6d6d('0x1f')](_0x1c8340[_0x6d6d('0x37')]['offset']);}_0x428c17[_0x6d6d('0x3e')]=qs[_0x6d6d('0x3f')](_0x1c8340[_0x6d6d('0x37')][_0x6d6d('0x3f')]);_0x428c17['where']=qs['filters'](_['pick'](_0x1c8340[_0x6d6d('0x37')],_0xdda3f2[_0x6d6d('0x40')]),_0x6c4741);if(_0x1c8340[_0x6d6d('0x37')][_0x6d6d('0x41')]){_0x428c17['where']=_[_0x6d6d('0x42')](_0x428c17[_0x6d6d('0x43')],{'$or':_[_0x6d6d('0x30')](_0x6c4741,function(_0x3c6d23){if(_0x3c6d23[_0x6d6d('0x33')]!==_0x6d6d('0x44')){var _0x4b457d={};_0x4b457d[_0x3c6d23[_0x6d6d('0x2d')]]={'$like':'%'+_0x1c8340[_0x6d6d('0x37')][_0x6d6d('0x41')]+'%'};return _0x4b457d;}})});}_0x428c17=_[_0x6d6d('0x42')]({},_0x428c17,_0x1c8340[_0x6d6d('0x45')]);var _0x3e27b7={'where':_0x428c17[_0x6d6d('0x43')]};return db['AnalyticMetric'][_0x6d6d('0x20')](_0x3e27b7)[_0x6d6d('0x27')](function(_0x16e177){_0x359cfd[_0x6d6d('0x20')]=_0x16e177;if(_0x1c8340[_0x6d6d('0x37')]['includeAll']){_0x428c17[_0x6d6d('0x46')]=[{'all':!![]}];}return db[_0x6d6d('0x47')]['findAll'](_0x428c17);})[_0x6d6d('0x27')](function(_0x50dc17){_0x359cfd[_0x6d6d('0x48')]=_0x50dc17;return _0x359cfd;})[_0x6d6d('0x27')](respondWithFilteredResult(_0x64d1f7,_0x428c17))['catch'](handleError(_0x64d1f7,null));};exports[_0x6d6d('0x49')]=function(_0x3324ec,_0x252cbe){var _0x4041f3={'raw':!![],'where':{'id':_0x3324ec['params']['id']}},_0xf7ea0d={};_0xf7ea0d['model']=_[_0x6d6d('0x36')](db['AnalyticMetric']['rawAttributes']);_0xf7ea0d[_0x6d6d('0x37')]=_[_0x6d6d('0x36')](_0x3324ec[_0x6d6d('0x37')]);_0xf7ea0d['filters']=_[_0x6d6d('0x38')](_0xf7ea0d['model'],_0xf7ea0d[_0x6d6d('0x37')]);_0x4041f3[_0x6d6d('0x39')]=_[_0x6d6d('0x38')](_0xf7ea0d[_0x6d6d('0x35')],qs[_0x6d6d('0x3a')](_0x3324ec[_0x6d6d('0x37')][_0x6d6d('0x3a')]));_0x4041f3['attributes']=_0x4041f3[_0x6d6d('0x39')][_0x6d6d('0x3b')]?_0x4041f3[_0x6d6d('0x39')]:_0xf7ea0d[_0x6d6d('0x35')];if(_0x3324ec[_0x6d6d('0x37')][_0x6d6d('0x4a')]){_0x4041f3[_0x6d6d('0x46')]=[{'all':!![]}];}_0x4041f3=_[_0x6d6d('0x42')]({},_0x4041f3,_0x3324ec[_0x6d6d('0x45')]);return db['AnalyticMetric']['find'](_0x4041f3)[_0x6d6d('0x27')](handleEntityNotFound(_0x252cbe,null))[_0x6d6d('0x27')](respondWithResult(_0x252cbe,null))[_0x6d6d('0x4b')](handleError(_0x252cbe,null));};exports[_0x6d6d('0x4c')]=function(_0xe2a20e,_0x492834){return db[_0x6d6d('0x47')][_0x6d6d('0x4c')](_0xe2a20e[_0x6d6d('0x4d')],{})[_0x6d6d('0x27')](function(_0x2ee917){var _0x23c2db=_0xe2a20e[_0x6d6d('0x4e')][_0x6d6d('0x29')]({'plain':!![]});if(!_0x23c2db)throw new Error(_0x6d6d('0x4f'));if(_0x23c2db[_0x6d6d('0x50')]===_0x6d6d('0x4e')){var _0x175e26=_0x2ee917['get']({'plain':!![]});var _0x190786=_0x6d6d('0x2a');return db[_0x6d6d('0x51')][_0x6d6d('0x52')]({'where':{'name':_0x190786,'userProfileId':_0x23c2db[_0x6d6d('0x53')]},'raw':!![]})['then'](function(_0x38c307){if(_0x38c307&&_0x38c307[_0x6d6d('0x54')]===0x0){return db[_0x6d6d('0x55')]['create']({'name':_0x175e26['name'],'resourceId':_0x175e26['id'],'type':_0x38c307[_0x6d6d('0x2d')],'sectionId':_0x38c307['id']},{})['then'](function(){return _0x2ee917;});}else{return _0x2ee917;}})[_0x6d6d('0x4b')](function(_0x995fe2){logger[_0x6d6d('0x2b')](_0x6d6d('0x56'),_0x995fe2);throw _0x995fe2;});}return _0x2ee917;})[_0x6d6d('0x27')](respondWithResult(_0x492834,0xc9))[_0x6d6d('0x4b')](handleError(_0x492834,null));};exports[_0x6d6d('0x26')]=function(_0x26c23a,_0x1a8f33){if(_0x26c23a[_0x6d6d('0x4d')]['id']){delete _0x26c23a['body']['id'];}return db[_0x6d6d('0x47')][_0x6d6d('0x52')]({'where':{'id':_0x26c23a[_0x6d6d('0x57')]['id']}})[_0x6d6d('0x27')](handleEntityNotFound(_0x1a8f33,null))[_0x6d6d('0x27')](saveUpdates(_0x26c23a[_0x6d6d('0x4d')],null))[_0x6d6d('0x27')](respondWithResult(_0x1a8f33,null))['catch'](handleError(_0x1a8f33,null));};exports['destroy']=function(_0x3ad9b0,_0x122865){return db['AnalyticMetric'][_0x6d6d('0x52')]({'where':{'id':_0x3ad9b0[_0x6d6d('0x57')]['id']}})[_0x6d6d('0x27')](handleEntityNotFound(_0x122865,null))[_0x6d6d('0x27')](removeEntity(_0x122865,null))[_0x6d6d('0x4b')](handleError(_0x122865,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index fe66b94..ae25dc6 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 _0xb3d8=['util','../../config/logger','api','moment','path','rimraf','../../config/environment','./analyticMetric.attributes','exports','define','AnalyticMetric'];(function(_0xecea29,_0x1a5257){var _0x2d0701=function(_0x16b646){while(--_0x16b646){_0xecea29['push'](_0xecea29['shift']());}};_0x2d0701(++_0x1a5257);}(_0xb3d8,0xdc));var _0x8b3d=function(_0x1db2d6,_0x4445f3){_0x1db2d6=_0x1db2d6-0x0;var _0x3f52f8=_0xb3d8[_0x1db2d6];return _0x3f52f8;};'use strict';var _=require('lodash');var util=require(_0x8b3d('0x0'));var logger=require(_0x8b3d('0x1'))(_0x8b3d('0x2'));var moment=require(_0x8b3d('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8b3d('0x4'));var rimraf=require(_0x8b3d('0x5'));var config=require(_0x8b3d('0x6'));var attributes=require(_0x8b3d('0x7'));module[_0x8b3d('0x8')]=function(_0x22d97b,_0x3b0f04){return _0x22d97b[_0x8b3d('0x9')](_0x8b3d('0xa'),attributes,{'tableName':'analytics_metrics','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x71ad=['api','bluebird','request-promise','rimraf','exports','define','AnalyticMetric','analytics_metrics','lodash','util'];(function(_0x118b6e,_0x48b5fc){var _0x33be58=function(_0x56567e){while(--_0x56567e){_0x118b6e['push'](_0x118b6e['shift']());}};_0x33be58(++_0x48b5fc);}(_0x71ad,0xee));var _0xd71a=function(_0x4e95b2,_0x113282){_0x4e95b2=_0x4e95b2-0x0;var _0x8f4beb=_0x71ad[_0x4e95b2];return _0x8f4beb;};'use strict';var _=require(_0xd71a('0x0'));var util=require(_0xd71a('0x1'));var logger=require('../../config/logger')(_0xd71a('0x2'));var moment=require('moment');var BPromise=require(_0xd71a('0x3'));var rp=require(_0xd71a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd71a('0x5'));var config=require('../../config/environment');var attributes=require('./analyticMetric.attributes');module[_0xd71a('0x6')]=function(_0x5ec697,_0x1e0701){return _0x5ec697[_0xd71a('0x7')](_0xd71a('0x8'),attributes,{'tableName':_0xd71a('0x9'),'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 0f7e457..0d4ad5c 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 _0x482b=['../../config/environment','jayson/promise','http','request','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x47f19b,_0x56f361){var _0x2af1aa=function(_0x430768){while(--_0x430768){_0x47f19b['push'](_0x47f19b['shift']());}};_0x2af1aa(++_0x56f361);}(_0x482b,0xb8));var _0xb482=function(_0x5f07d0,_0x30a246){_0x5f07d0=_0x5f07d0-0x0;var _0x1c83f1=_0x482b[_0x5f07d0];return _0x1c83f1;};'use strict';var _=require(_0xb482('0x0'));var util=require(_0xb482('0x1'));var moment=require('moment');var BPromise=require(_0xb482('0x2'));var rs=require(_0xb482('0x3'));var fs=require('fs');var Redis=require(_0xb482('0x4'));var db=require(_0xb482('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb482('0x6'))(_0xb482('0x7'));var config=require(_0xb482('0x8'));var jayson=require(_0xb482('0x9'));var client=jayson['client'][_0xb482('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x475438,_0x15753c,_0x3bbcbd){return new BPromise(function(_0x2a2b2c,_0x3a0598){return client[_0xb482('0xb')](_0x475438,_0x3bbcbd)[_0xb482('0xc')](function(_0x40dc09){logger[_0xb482('0xd')](_0xb482('0xe'),_0x15753c,_0xb482('0xf'));logger[_0xb482('0x10')](_0xb482('0x11'),_0x15753c,'request\x20sent',JSON[_0xb482('0x12')](_0x40dc09));if(_0x40dc09[_0xb482('0x13')]){if(_0x40dc09[_0xb482('0x13')][_0xb482('0x14')]===0x1f4){logger[_0xb482('0x13')](_0xb482('0xe'),_0x15753c,_0x40dc09['error'][_0xb482('0x15')]);return _0x3a0598(_0x40dc09[_0xb482('0x13')]['message']);}logger[_0xb482('0x13')](_0xb482('0xe'),_0x15753c,_0x40dc09[_0xb482('0x13')][_0xb482('0x15')]);return _0x2a2b2c(_0x40dc09[_0xb482('0x13')][_0xb482('0x15')]);}else{logger['info'](_0xb482('0xe'),_0x15753c,'request\x20sent');_0x2a2b2c(_0x40dc09[_0xb482('0x16')][_0xb482('0x15')]);}})[_0xb482('0x17')](function(_0x25df00){logger[_0xb482('0x13')](_0xb482('0xe'),_0x15753c,_0x25df00);_0x3a0598(_0x25df00);});});} \ No newline at end of file +var _0x62c1=['code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','request','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','error'];(function(_0x5c2a5d,_0x2caf3e){var _0x14e902=function(_0x17a915){while(--_0x17a915){_0x5c2a5d['push'](_0x5c2a5d['shift']());}};_0x14e902(++_0x2caf3e);}(_0x62c1,0x190));var _0x162c=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x62c1[_0x465028];return _0xb783d4;};'use strict';var _=require(_0x162c('0x0'));var util=require(_0x162c('0x1'));var moment=require(_0x162c('0x2'));var BPromise=require(_0x162c('0x3'));var rs=require(_0x162c('0x4'));var fs=require('fs');var Redis=require(_0x162c('0x5'));var db=require(_0x162c('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x162c('0x7'));var jayson=require(_0x162c('0x8'));var client=jayson[_0x162c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x238800,_0x48016f,_0x19e1ae){return new BPromise(function(_0x17dfe3,_0x33f3b6){return client[_0x162c('0xa')](_0x238800,_0x19e1ae)[_0x162c('0xb')](function(_0x3fbcd1){logger[_0x162c('0xc')](_0x162c('0xd'),_0x48016f,_0x162c('0xe'));logger[_0x162c('0xf')](_0x162c('0x10'),_0x48016f,_0x162c('0xe'),JSON['stringify'](_0x3fbcd1));if(_0x3fbcd1[_0x162c('0x11')]){if(_0x3fbcd1[_0x162c('0x11')][_0x162c('0x12')]===0x1f4){logger[_0x162c('0x11')]('AnalyticMetric,\x20%s,\x20%s',_0x48016f,_0x3fbcd1[_0x162c('0x11')][_0x162c('0x13')]);return _0x33f3b6(_0x3fbcd1[_0x162c('0x11')][_0x162c('0x13')]);}logger[_0x162c('0x11')](_0x162c('0xd'),_0x48016f,_0x3fbcd1[_0x162c('0x11')]['message']);return _0x17dfe3(_0x3fbcd1['error'][_0x162c('0x13')]);}else{logger[_0x162c('0xc')](_0x162c('0xd'),_0x48016f,_0x162c('0xe'));_0x17dfe3(_0x3fbcd1[_0x162c('0x14')][_0x162c('0x13')]);}})[_0x162c('0x15')](function(_0x268312){logger['error']('AnalyticMetric,\x20%s,\x20%s',_0x48016f,_0x268312);_0x33f3b6(_0x268312);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index f347e6e..cb596a6 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 _0xa74a=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','post','create','delete','destroy'];(function(_0x3f932d,_0x46d3e9){var _0x39fea1=function(_0x4ba570){while(--_0x4ba570){_0x3f932d['push'](_0x3f932d['shift']());}};_0x39fea1(++_0x46d3e9);}(_0xa74a,0x66));var _0xaa74=function(_0x4979fb,_0x1e0921){_0x4979fb=_0x4979fb-0x0;var _0x58fbea=_0xa74a[_0x4979fb];return _0x58fbea;};'use strict';var multer=require(_0xaa74('0x0'));var util=require(_0xaa74('0x1'));var path=require(_0xaa74('0x2'));var timeout=require(_0xaa74('0x3'));var express=require(_0xaa74('0x4'));var router=express[_0xaa74('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xaa74('0x6'));var interaction=require(_0xaa74('0x7'));var config=require(_0xaa74('0x8'));var controller=require('./analyticMetric.controller');router['get']('/',auth[_0xaa74('0x9')](),controller[_0xaa74('0xa')]);router[_0xaa74('0xb')](_0xaa74('0xc'),auth[_0xaa74('0x9')](),controller['show']);router[_0xaa74('0xd')]('/',auth['isAuthenticated'](),controller[_0xaa74('0xe')]);router['put'](_0xaa74('0xc'),auth[_0xaa74('0x9')](),controller['update']);router[_0xaa74('0xf')]('/:id',auth[_0xaa74('0x9')](),controller[_0xaa74('0x10')]);module['exports']=router; \ No newline at end of file +var _0x2e8a=['update','delete','/:id','exports','util','path','express','Router','../../components/auth/service','isAuthenticated','index','get','show','post','put'];(function(_0x4364f6,_0x1d165b){var _0x5a37ab=function(_0x9feb8c){while(--_0x9feb8c){_0x4364f6['push'](_0x4364f6['shift']());}};_0x5a37ab(++_0x1d165b);}(_0x2e8a,0xc7));var _0xa2e8=function(_0x8f7d2b,_0x1bebaf){_0x8f7d2b=_0x8f7d2b-0x0;var _0x13c298=_0x2e8a[_0x8f7d2b];return _0x13c298;};'use strict';var multer=require('multer');var util=require(_0xa2e8('0x0'));var path=require(_0xa2e8('0x1'));var timeout=require('connect-timeout');var express=require(_0xa2e8('0x2'));var router=express[_0xa2e8('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xa2e8('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./analyticMetric.controller');router['get']('/',auth[_0xa2e8('0x5')](),controller[_0xa2e8('0x6')]);router[_0xa2e8('0x7')]('/:id',auth[_0xa2e8('0x5')](),controller[_0xa2e8('0x8')]);router[_0xa2e8('0x9')]('/',auth[_0xa2e8('0x5')](),controller['create']);router[_0xa2e8('0xa')]('/:id',auth[_0xa2e8('0x5')](),controller[_0xa2e8('0xb')]);router[_0xa2e8('0xc')](_0xa2e8('0xd'),auth[_0xa2e8('0x5')](),controller['destroy']);module[_0xa2e8('0xe')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index ccd8e10..b999686 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 _0x433e=['exports','TEXT','sequelize'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x433e,0xbf));var _0xe433=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x433e[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xe433('0x0'));module[_0xe433('0x1')]={'tree':{'type':Sequelize[_0xe433('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x944b=['exports','sequelize'];(function(_0x3825a8,_0x2ce1a2){var _0xabc9bc=function(_0x101073){while(--_0x101073){_0x3825a8['push'](_0x3825a8['shift']());}};_0xabc9bc(++_0x2ce1a2);}(_0x944b,0xc3));var _0xb944=function(_0x1c2d8b,_0x5d091b){_0x1c2d8b=_0x1c2d8b-0x0;var _0xb90fca=_0x944b[_0x1c2d8b];return _0xb90fca;};'use strict';var Sequelize=require(_0xb944('0x0'));module[_0xb944('0x1')]={'tree':{'type':Sequelize['TEXT'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index 92532d5..aefd773 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 _0x0f5b=['length','hasOwnProperty','nolimit','order','sort','filter','where','VIRTUAL','includeAll','rows','catch','params','filters','include','find','create','body','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','fs-extra','lodash','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','destroy','then','name','index','map','AnalyticTreeReport','rawAttributes','type','model','query','keys','intersection','attributes','fields'];(function(_0xc74a9a,_0x3595ae){var _0x4b794d=function(_0x38c2d9){while(--_0x38c2d9){_0xc74a9a['push'](_0xc74a9a['shift']());}};_0x4b794d(++_0x3595ae);}(_0x0f5b,0x1ca));var _0xb0f5=function(_0x309a5e,_0x1ec246){_0x309a5e=_0x309a5e-0x0;var _0x1d21f1=_0x0f5b[_0x309a5e];return _0x1d21f1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb0f5('0x0'));var zipdir=require(_0xb0f5('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb0f5('0x2'));var moment=require(_0xb0f5('0x3'));var BPromise=require(_0xb0f5('0x4'));var Mustache=require(_0xb0f5('0x5'));var util=require('util');var path=require(_0xb0f5('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb0f5('0x7'));var _=require(_0xb0f5('0x8'));var squel=require('squel');var crypto=require(_0xb0f5('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xb0f5('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb0f5('0xb'));var authService=require(_0xb0f5('0xc'));var qs=require(_0xb0f5('0xd'));var as=require(_0xb0f5('0xe'));var hardwareService=require(_0xb0f5('0xf'));var logger=require(_0xb0f5('0x10'))(_0xb0f5('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xb0f5('0x12'));var db=require(_0xb0f5('0x13'))['db'];function respondWithStatusCode(_0x34924c,_0x761147){_0x761147=_0x761147||0xcc;return function(_0x3e4774){if(_0x3e4774){return _0x34924c[_0xb0f5('0x14')](_0x761147);}return _0x34924c['status'](_0x761147)[_0xb0f5('0x15')]();};}function respondWithResult(_0x20e886,_0x4e4af8){_0x4e4af8=_0x4e4af8||0xc8;return function(_0x10f0f8){if(_0x10f0f8){return _0x20e886[_0xb0f5('0x16')](_0x4e4af8)[_0xb0f5('0x17')](_0x10f0f8);}};}function respondWithFilteredResult(_0x56d58f,_0xd76902){return function(_0x25ab18){if(_0x25ab18){var _0x4ac4ca=typeof _0xd76902[_0xb0f5('0x18')]===_0xb0f5('0x19')&&typeof _0xd76902[_0xb0f5('0x1a')]===_0xb0f5('0x19');var _0x21f72d=_0x25ab18[_0xb0f5('0x1b')];var _0x4013e9=_0x4ac4ca?0x0:_0xd76902[_0xb0f5('0x18')];var _0x4ca0a1=_0x4ac4ca?_0x25ab18[_0xb0f5('0x1b')]:_0xd76902[_0xb0f5('0x18')]+_0xd76902[_0xb0f5('0x1a')];var _0x2f5619;if(_0x4ca0a1>=_0x21f72d){_0x4ca0a1=_0x21f72d;_0x2f5619=0xc8;}else{_0x2f5619=0xce;}_0x56d58f[_0xb0f5('0x16')](_0x2f5619);return _0x56d58f['set'](_0xb0f5('0x1c'),_0x4013e9+'-'+_0x4ca0a1+'/'+_0x21f72d)[_0xb0f5('0x17')](_0x25ab18);}return null;};}function patchUpdates(_0x29bc4b){return function(_0xc1e55b){try{jsonpatch[_0xb0f5('0x1d')](_0xc1e55b,_0x29bc4b,!![]);}catch(_0x1ec1f4){return BPromise[_0xb0f5('0x1e')](_0x1ec1f4);}return _0xc1e55b[_0xb0f5('0x1f')]();};}function saveUpdates(_0x1d305f,_0x7293a6){return function(_0x5e3c8e){if(_0x5e3c8e){return _0x5e3c8e['update'](_0x1d305f)['then'](function(_0x1657a8){return _0x1657a8;});}return null;};}function removeEntity(_0x4a2b05,_0x103a32){return function(_0x3c04fa){if(_0x3c04fa){return _0x3c04fa[_0xb0f5('0x20')]()[_0xb0f5('0x21')](function(){_0x4a2b05[_0xb0f5('0x16')](0xcc)[_0xb0f5('0x15')]();});}};}function handleEntityNotFound(_0xec778c,_0x250c05){return function(_0x48c004){if(!_0x48c004){_0xec778c[_0xb0f5('0x14')](0x194);}return _0x48c004;};}function handleError(_0x1a4a9e,_0x2b73c1){_0x2b73c1=_0x2b73c1||0x1f4;return function(_0x57a152){logger['error'](_0x57a152['stack']);if(_0x57a152[_0xb0f5('0x22')]){delete _0x57a152[_0xb0f5('0x22')];}_0x1a4a9e[_0xb0f5('0x16')](_0x2b73c1)['send'](_0x57a152);};}exports[_0xb0f5('0x23')]=function(_0x295c1a,_0x492e0f){var _0x36846a={},_0x11bbd5={},_0x4cfe0e={'count':0x0,'rows':[]};var _0x1460c2=_[_0xb0f5('0x24')](db[_0xb0f5('0x25')][_0xb0f5('0x26')],function(_0x13d5ff){return{'name':_0x13d5ff['fieldName'],'type':_0x13d5ff[_0xb0f5('0x27')]['key']};});_0x11bbd5[_0xb0f5('0x28')]=_[_0xb0f5('0x24')](_0x1460c2,_0xb0f5('0x22'));_0x11bbd5[_0xb0f5('0x29')]=_[_0xb0f5('0x2a')](_0x295c1a[_0xb0f5('0x29')]);_0x11bbd5['filters']=_[_0xb0f5('0x2b')](_0x11bbd5[_0xb0f5('0x28')],_0x11bbd5[_0xb0f5('0x29')]);_0x36846a[_0xb0f5('0x2c')]=_[_0xb0f5('0x2b')](_0x11bbd5[_0xb0f5('0x28')],qs[_0xb0f5('0x2d')](_0x295c1a[_0xb0f5('0x29')][_0xb0f5('0x2d')]));_0x36846a['attributes']=_0x36846a[_0xb0f5('0x2c')][_0xb0f5('0x2e')]?_0x36846a['attributes']:_0x11bbd5[_0xb0f5('0x28')];if(!_0x295c1a[_0xb0f5('0x29')][_0xb0f5('0x2f')](_0xb0f5('0x30'))){_0x36846a[_0xb0f5('0x1a')]=qs[_0xb0f5('0x1a')](_0x295c1a['query'][_0xb0f5('0x1a')]);_0x36846a[_0xb0f5('0x18')]=qs['offset'](_0x295c1a['query'][_0xb0f5('0x18')]);}_0x36846a[_0xb0f5('0x31')]=qs[_0xb0f5('0x32')](_0x295c1a[_0xb0f5('0x29')]['sort']);_0x36846a['where']=qs['filters'](_['pick'](_0x295c1a[_0xb0f5('0x29')],_0x11bbd5['filters']),_0x1460c2);if(_0x295c1a[_0xb0f5('0x29')][_0xb0f5('0x33')]){_0x36846a[_0xb0f5('0x34')]=_['merge'](_0x36846a[_0xb0f5('0x34')],{'$or':_['map'](_0x1460c2,function(_0x51b48d){if(_0x51b48d[_0xb0f5('0x27')]!==_0xb0f5('0x35')){var _0x2bcc18={};_0x2bcc18[_0x51b48d[_0xb0f5('0x22')]]={'$like':'%'+_0x295c1a['query'][_0xb0f5('0x33')]+'%'};return _0x2bcc18;}})});}_0x36846a=_['merge']({},_0x36846a,_0x295c1a['options']);var _0x5f59bd={'where':_0x36846a[_0xb0f5('0x34')]};return db['AnalyticTreeReport']['count'](_0x5f59bd)[_0xb0f5('0x21')](function(_0x4a8d4e){_0x4cfe0e[_0xb0f5('0x1b')]=_0x4a8d4e;if(_0x295c1a[_0xb0f5('0x29')][_0xb0f5('0x36')]){_0x36846a['include']=[{'all':!![]}];}return db['AnalyticTreeReport']['findAll'](_0x36846a);})[_0xb0f5('0x21')](function(_0x33f744){_0x4cfe0e[_0xb0f5('0x37')]=_0x33f744;return _0x4cfe0e;})[_0xb0f5('0x21')](respondWithFilteredResult(_0x492e0f,_0x36846a))[_0xb0f5('0x38')](handleError(_0x492e0f,null));};exports['show']=function(_0x2edb9f,_0xedf52a){var _0x4e92ed={'raw':!![],'where':{'id':_0x2edb9f[_0xb0f5('0x39')]['id']}},_0x30ec50={};_0x30ec50[_0xb0f5('0x28')]=_[_0xb0f5('0x2a')](db[_0xb0f5('0x25')][_0xb0f5('0x26')]);_0x30ec50[_0xb0f5('0x29')]=_['keys'](_0x2edb9f[_0xb0f5('0x29')]);_0x30ec50[_0xb0f5('0x3a')]=_[_0xb0f5('0x2b')](_0x30ec50[_0xb0f5('0x28')],_0x30ec50['query']);_0x4e92ed[_0xb0f5('0x2c')]=_[_0xb0f5('0x2b')](_0x30ec50['model'],qs['fields'](_0x2edb9f['query'][_0xb0f5('0x2d')]));_0x4e92ed[_0xb0f5('0x2c')]=_0x4e92ed[_0xb0f5('0x2c')]['length']?_0x4e92ed[_0xb0f5('0x2c')]:_0x30ec50[_0xb0f5('0x28')];if(_0x2edb9f[_0xb0f5('0x29')][_0xb0f5('0x36')]){_0x4e92ed[_0xb0f5('0x3b')]=[{'all':!![]}];}_0x4e92ed=_['merge']({},_0x4e92ed,_0x2edb9f['options']);return db[_0xb0f5('0x25')][_0xb0f5('0x3c')](_0x4e92ed)[_0xb0f5('0x21')](handleEntityNotFound(_0xedf52a,null))['then'](respondWithResult(_0xedf52a,null))[_0xb0f5('0x38')](handleError(_0xedf52a,null));};exports[_0xb0f5('0x3d')]=function(_0x5a2c22,_0x4f32b0){return db[_0xb0f5('0x25')][_0xb0f5('0x3d')](_0x5a2c22[_0xb0f5('0x3e')],{})[_0xb0f5('0x21')](respondWithResult(_0x4f32b0,0xc9))['catch'](handleError(_0x4f32b0,null));};exports['update']=function(_0x3beaf0,_0x1c871b){if(_0x3beaf0[_0xb0f5('0x3e')]['id']){delete _0x3beaf0['body']['id'];}return db[_0xb0f5('0x25')][_0xb0f5('0x3c')]({'where':{'id':_0x3beaf0[_0xb0f5('0x39')]['id']}})['then'](handleEntityNotFound(_0x1c871b,null))[_0xb0f5('0x21')](saveUpdates(_0x3beaf0[_0xb0f5('0x3e')],null))['then'](respondWithResult(_0x1c871b,null))[_0xb0f5('0x38')](handleError(_0x1c871b,null));};exports['destroy']=function(_0x2589d6,_0x6061b5){return db[_0xb0f5('0x25')][_0xb0f5('0x3c')]({'where':{'id':_0x2589d6[_0xb0f5('0x39')]['id']}})[_0xb0f5('0x21')](handleEntityNotFound(_0x6061b5,null))[_0xb0f5('0x21')](removeEntity(_0x6061b5,null))[_0xb0f5('0x38')](handleError(_0x6061b5,null));}; \ No newline at end of file +var _0x433c=['hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','params','options','find','catch','create','body','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','error','name','send','index','AnalyticTreeReport','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields'];(function(_0x401128,_0x285722){var _0x2890e8=function(_0xb9b465){while(--_0xb9b465){_0x401128['push'](_0x401128['shift']());}};_0x2890e8(++_0x285722);}(_0x433c,0x1cf));var _0xc433=function(_0x213ed5,_0x26712a){_0x213ed5=_0x213ed5-0x0;var _0x191514=_0x433c[_0x213ed5];return _0x191514;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc433('0x0'));var zipdir=require(_0xc433('0x1'));var jsonpatch=require(_0xc433('0x2'));var rp=require('request-promise');var moment=require(_0xc433('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xc433('0x4'));var util=require(_0xc433('0x5'));var path=require('path');var sox=require(_0xc433('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc433('0x7'));var _=require('lodash');var squel=require(_0xc433('0x8'));var crypto=require(_0xc433('0x9'));var jsforce=require(_0xc433('0xa'));var deskjs=require(_0xc433('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc433('0xc'));var Redis=require(_0xc433('0xd'));var authService=require(_0xc433('0xe'));var qs=require(_0xc433('0xf'));var as=require(_0xc433('0x10'));var hardwareService=require(_0xc433('0x11'));var logger=require(_0xc433('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xc433('0x13'));var licenseUtil=require(_0xc433('0x14'));var db=require(_0xc433('0x15'))['db'];function respondWithStatusCode(_0x43b490,_0x2b9383){_0x2b9383=_0x2b9383||0xcc;return function(_0x39e487){if(_0x39e487){return _0x43b490[_0xc433('0x16')](_0x2b9383);}return _0x43b490[_0xc433('0x17')](_0x2b9383)[_0xc433('0x18')]();};}function respondWithResult(_0x15ca54,_0x214cea){_0x214cea=_0x214cea||0xc8;return function(_0x2f9b6c){if(_0x2f9b6c){return _0x15ca54['status'](_0x214cea)[_0xc433('0x19')](_0x2f9b6c);}};}function respondWithFilteredResult(_0x34a77e,_0x335e40){return function(_0x7b70a7){if(_0x7b70a7){var _0x233c5f=typeof _0x335e40['offset']===_0xc433('0x1a')&&typeof _0x335e40['limit']===_0xc433('0x1a');var _0x42af0f=_0x7b70a7[_0xc433('0x1b')];var _0x244176=_0x233c5f?0x0:_0x335e40[_0xc433('0x1c')];var _0x18f85d=_0x233c5f?_0x7b70a7[_0xc433('0x1b')]:_0x335e40[_0xc433('0x1c')]+_0x335e40[_0xc433('0x1d')];var _0x13cca6;if(_0x18f85d>=_0x42af0f){_0x18f85d=_0x42af0f;_0x13cca6=0xc8;}else{_0x13cca6=0xce;}_0x34a77e['status'](_0x13cca6);return _0x34a77e[_0xc433('0x1e')](_0xc433('0x1f'),_0x244176+'-'+_0x18f85d+'/'+_0x42af0f)[_0xc433('0x19')](_0x7b70a7);}return null;};}function patchUpdates(_0x76ccd0){return function(_0x5e18ad){try{jsonpatch[_0xc433('0x20')](_0x5e18ad,_0x76ccd0,!![]);}catch(_0x30cb56){return BPromise[_0xc433('0x21')](_0x30cb56);}return _0x5e18ad[_0xc433('0x22')]();};}function saveUpdates(_0x4ee802,_0xe5b524){return function(_0x280706){if(_0x280706){return _0x280706[_0xc433('0x23')](_0x4ee802)['then'](function(_0x32d2c7){return _0x32d2c7;});}return null;};}function removeEntity(_0x47d852,_0x443b32){return function(_0x31a974){if(_0x31a974){return _0x31a974[_0xc433('0x24')]()[_0xc433('0x25')](function(){_0x47d852[_0xc433('0x17')](0xcc)[_0xc433('0x18')]();});}};}function handleEntityNotFound(_0x4fc646,_0x7e67bd){return function(_0x388a12){if(!_0x388a12){_0x4fc646[_0xc433('0x16')](0x194);}return _0x388a12;};}function handleError(_0x307157,_0x368241){_0x368241=_0x368241||0x1f4;return function(_0x51fc36){logger[_0xc433('0x26')](_0x51fc36['stack']);if(_0x51fc36[_0xc433('0x27')]){delete _0x51fc36['name'];}_0x307157['status'](_0x368241)[_0xc433('0x28')](_0x51fc36);};}exports[_0xc433('0x29')]=function(_0x400fa7,_0x4d3826){var _0x6d7ed={},_0x53f9d9={},_0x52aca0={'count':0x0,'rows':[]};var _0x24c960=_['map'](db[_0xc433('0x2a')][_0xc433('0x2b')],function(_0x119efd){return{'name':_0x119efd[_0xc433('0x2c')],'type':_0x119efd[_0xc433('0x2d')][_0xc433('0x2e')]};});_0x53f9d9[_0xc433('0x2f')]=_[_0xc433('0x30')](_0x24c960,'name');_0x53f9d9['query']=_[_0xc433('0x31')](_0x400fa7[_0xc433('0x32')]);_0x53f9d9[_0xc433('0x33')]=_[_0xc433('0x34')](_0x53f9d9[_0xc433('0x2f')],_0x53f9d9['query']);_0x6d7ed[_0xc433('0x35')]=_[_0xc433('0x34')](_0x53f9d9[_0xc433('0x2f')],qs[_0xc433('0x36')](_0x400fa7[_0xc433('0x32')][_0xc433('0x36')]));_0x6d7ed[_0xc433('0x35')]=_0x6d7ed['attributes']['length']?_0x6d7ed[_0xc433('0x35')]:_0x53f9d9[_0xc433('0x2f')];if(!_0x400fa7[_0xc433('0x32')][_0xc433('0x37')](_0xc433('0x38'))){_0x6d7ed['limit']=qs[_0xc433('0x1d')](_0x400fa7['query']['limit']);_0x6d7ed[_0xc433('0x1c')]=qs['offset'](_0x400fa7[_0xc433('0x32')]['offset']);}_0x6d7ed[_0xc433('0x39')]=qs[_0xc433('0x3a')](_0x400fa7[_0xc433('0x32')][_0xc433('0x3a')]);_0x6d7ed[_0xc433('0x3b')]=qs[_0xc433('0x33')](_[_0xc433('0x3c')](_0x400fa7[_0xc433('0x32')],_0x53f9d9['filters']),_0x24c960);if(_0x400fa7[_0xc433('0x32')][_0xc433('0x3d')]){_0x6d7ed[_0xc433('0x3b')]=_[_0xc433('0x3e')](_0x6d7ed[_0xc433('0x3b')],{'$or':_[_0xc433('0x30')](_0x24c960,function(_0x2d8ef9){if(_0x2d8ef9['type']!==_0xc433('0x3f')){var _0x532665={};_0x532665[_0x2d8ef9[_0xc433('0x27')]]={'$like':'%'+_0x400fa7[_0xc433('0x32')][_0xc433('0x3d')]+'%'};return _0x532665;}})});}_0x6d7ed=_[_0xc433('0x3e')]({},_0x6d7ed,_0x400fa7['options']);var _0x2e2d31={'where':_0x6d7ed[_0xc433('0x3b')]};return db[_0xc433('0x2a')][_0xc433('0x1b')](_0x2e2d31)[_0xc433('0x25')](function(_0x298d3a){_0x52aca0[_0xc433('0x1b')]=_0x298d3a;if(_0x400fa7[_0xc433('0x32')][_0xc433('0x40')]){_0x6d7ed[_0xc433('0x41')]=[{'all':!![]}];}return db[_0xc433('0x2a')][_0xc433('0x42')](_0x6d7ed);})[_0xc433('0x25')](function(_0x22c4c6){_0x52aca0[_0xc433('0x43')]=_0x22c4c6;return _0x52aca0;})[_0xc433('0x25')](respondWithFilteredResult(_0x4d3826,_0x6d7ed))['catch'](handleError(_0x4d3826,null));};exports['show']=function(_0x188301,_0x115429){var _0x341b48={'raw':!![],'where':{'id':_0x188301[_0xc433('0x44')]['id']}},_0x20264c={};_0x20264c['model']=_['keys'](db['AnalyticTreeReport'][_0xc433('0x2b')]);_0x20264c[_0xc433('0x32')]=_[_0xc433('0x31')](_0x188301[_0xc433('0x32')]);_0x20264c[_0xc433('0x33')]=_[_0xc433('0x34')](_0x20264c[_0xc433('0x2f')],_0x20264c['query']);_0x341b48[_0xc433('0x35')]=_[_0xc433('0x34')](_0x20264c[_0xc433('0x2f')],qs[_0xc433('0x36')](_0x188301['query'][_0xc433('0x36')]));_0x341b48['attributes']=_0x341b48[_0xc433('0x35')]['length']?_0x341b48[_0xc433('0x35')]:_0x20264c[_0xc433('0x2f')];if(_0x188301[_0xc433('0x32')]['includeAll']){_0x341b48['include']=[{'all':!![]}];}_0x341b48=_[_0xc433('0x3e')]({},_0x341b48,_0x188301[_0xc433('0x45')]);return db[_0xc433('0x2a')][_0xc433('0x46')](_0x341b48)[_0xc433('0x25')](handleEntityNotFound(_0x115429,null))['then'](respondWithResult(_0x115429,null))[_0xc433('0x47')](handleError(_0x115429,null));};exports[_0xc433('0x48')]=function(_0x4aec44,_0x477df9){return db[_0xc433('0x2a')]['create'](_0x4aec44[_0xc433('0x49')],{})[_0xc433('0x25')](respondWithResult(_0x477df9,0xc9))[_0xc433('0x47')](handleError(_0x477df9,null));};exports[_0xc433('0x23')]=function(_0x108e7d,_0x1335ed){if(_0x108e7d[_0xc433('0x49')]['id']){delete _0x108e7d[_0xc433('0x49')]['id'];}return db['AnalyticTreeReport'][_0xc433('0x46')]({'where':{'id':_0x108e7d[_0xc433('0x44')]['id']}})[_0xc433('0x25')](handleEntityNotFound(_0x1335ed,null))['then'](saveUpdates(_0x108e7d['body'],null))[_0xc433('0x25')](respondWithResult(_0x1335ed,null))[_0xc433('0x47')](handleError(_0x1335ed,null));};exports[_0xc433('0x24')]=function(_0x1cefb2,_0x468173){return db[_0xc433('0x2a')][_0xc433('0x46')]({'where':{'id':_0x1cefb2['params']['id']}})['then'](handleEntityNotFound(_0x468173,null))[_0xc433('0x25')](removeEntity(_0x468173,null))[_0xc433('0x47')](handleError(_0x468173,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 9ce3b44..30ad489 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 _0x4ff1=['util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./analyticTreeReport.attributes','define','analytics_report_trees','lodash'];(function(_0x41f15f,_0x1a39ef){var _0x269a71=function(_0x52c50e){while(--_0x52c50e){_0x41f15f['push'](_0x41f15f['shift']());}};_0x269a71(++_0x1a39ef);}(_0x4ff1,0x112));var _0x14ff=function(_0x49e2b8,_0x5cf700){_0x49e2b8=_0x49e2b8-0x0;var _0x1f2213=_0x4ff1[_0x49e2b8];return _0x1f2213;};'use strict';var _=require(_0x14ff('0x0'));var util=require(_0x14ff('0x1'));var logger=require(_0x14ff('0x2'))('api');var moment=require('moment');var BPromise=require(_0x14ff('0x3'));var rp=require(_0x14ff('0x4'));var fs=require('fs');var path=require(_0x14ff('0x5'));var rimraf=require(_0x14ff('0x6'));var config=require(_0x14ff('0x7'));var attributes=require(_0x14ff('0x8'));module['exports']=function(_0x19b5dd,_0x15afa3){return _0x19b5dd[_0x14ff('0x9')]('AnalyticTreeReport',attributes,{'tableName':_0x14ff('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xec9d=['../../config/environment','./analyticTreeReport.attributes','exports','AnalyticTreeReport','analytics_report_trees','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x194f13,_0x39e6b3){var _0x31efc4=function(_0x29b124){while(--_0x29b124){_0x194f13['push'](_0x194f13['shift']());}};_0x31efc4(++_0x39e6b3);}(_0xec9d,0x155));var _0xdec9=function(_0x14e6de,_0x293358){_0x14e6de=_0x14e6de-0x0;var _0xc157fc=_0xec9d[_0x14e6de];return _0xc157fc;};'use strict';var _=require(_0xdec9('0x0'));var util=require(_0xdec9('0x1'));var logger=require(_0xdec9('0x2'))(_0xdec9('0x3'));var moment=require(_0xdec9('0x4'));var BPromise=require(_0xdec9('0x5'));var rp=require(_0xdec9('0x6'));var fs=require('fs');var path=require(_0xdec9('0x7'));var rimraf=require(_0xdec9('0x8'));var config=require(_0xdec9('0x9'));var attributes=require(_0xdec9('0xa'));module[_0xdec9('0xb')]=function(_0x168578,_0xf0577e){return _0x168578['define'](_0xdec9('0xc'),attributes,{'tableName':_0xdec9('0xd'),'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 f6ef299..3d5f967 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 _0x5f66=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','stringify','code','message','error','info','catch','util','bluebird','randomstring','ioredis'];(function(_0x255769,_0x4a37fb){var _0x25db2a=function(_0x5eec59){while(--_0x5eec59){_0x255769['push'](_0x255769['shift']());}};_0x25db2a(++_0x4a37fb);}(_0x5f66,0x1a0));var _0x65f6=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x5f66[_0x3ab9ee];return _0x82ee88;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ed98f,_0x1c0e12,_0x2c6571){return new BPromise(function(_0x112079,_0x8f6451){return client[_0x65f6('0x9')](_0x4ed98f,_0x2c6571)[_0x65f6('0xa')](function(_0x48d85c){logger['info'](_0x65f6('0xb'),_0x1c0e12,_0x65f6('0xc'));logger[_0x65f6('0xd')](_0x65f6('0xe'),_0x1c0e12,'request\x20sent',JSON[_0x65f6('0xf')](_0x48d85c));if(_0x48d85c['error']){if(_0x48d85c['error'][_0x65f6('0x10')]===0x1f4){logger['error'](_0x65f6('0xb'),_0x1c0e12,_0x48d85c['error'][_0x65f6('0x11')]);return _0x8f6451(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);return _0x112079(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}else{logger[_0x65f6('0x13')]('AnalyticTreeReport,\x20%s,\x20%s',_0x1c0e12,_0x65f6('0xc'));_0x112079(_0x48d85c['result']['message']);}})[_0x65f6('0x14')](function(_0x5c69f8){logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x5c69f8);_0x8f6451(_0x5c69f8);});});} \ No newline at end of file +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(_0x535cd9,_0x331c5d){var _0x21dde4=function(_0x4132f7){while(--_0x4132f7){_0x535cd9['push'](_0x535cd9['shift']());}};_0x21dde4(++_0x331c5d);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0xc4aa[_0x53ccf2];return _0x5a2964;};'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 diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 668805d..e35044c 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 _0x3606=['../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','isAuthenticated','index','get','/:id','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x3ac91c,_0x52d391){var _0x249e30=function(_0x4c5e30){while(--_0x4c5e30){_0x3ac91c['push'](_0x3ac91c['shift']());}};_0x249e30(++_0x52d391);}(_0x3606,0x1dc));var _0x6360=function(_0x4d1ee9,_0x394a78){_0x4d1ee9=_0x4d1ee9-0x0;var _0x9a5456=_0x3606[_0x4d1ee9];return _0x9a5456;};'use strict';var multer=require(_0x6360('0x0'));var util=require(_0x6360('0x1'));var path=require(_0x6360('0x2'));var timeout=require(_0x6360('0x3'));var express=require(_0x6360('0x4'));var router=express[_0x6360('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x6360('0x6'));var interaction=require(_0x6360('0x7'));var config=require(_0x6360('0x8'));var controller=require(_0x6360('0x9'));router['get']('/',auth[_0x6360('0xa')](),controller[_0x6360('0xb')]);router[_0x6360('0xc')](_0x6360('0xd'),auth[_0x6360('0xa')](),controller['show']);router[_0x6360('0xe')]('/',auth[_0x6360('0xa')](),controller[_0x6360('0xf')]);router[_0x6360('0x10')](_0x6360('0xd'),auth['isAuthenticated'](),controller[_0x6360('0x11')]);router[_0x6360('0x12')](_0x6360('0xd'),auth[_0x6360('0xa')](),controller[_0x6360('0x13')]);module[_0x6360('0x14')]=router; \ No newline at end of file +var _0xa1f1=['Router','fs-extra','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','multer','path','connect-timeout','express'];(function(_0x4733d3,_0x454290){var _0x1b9a44=function(_0x1a93bb){while(--_0x1a93bb){_0x4733d3['push'](_0x4733d3['shift']());}};_0x1b9a44(++_0x454290);}(_0xa1f1,0x18b));var _0x1a1f=function(_0x19159a,_0x1cb5c3){_0x19159a=_0x19159a-0x0;var _0xa677f4=_0xa1f1[_0x19159a];return _0xa677f4;};'use strict';var multer=require(_0x1a1f('0x0'));var util=require('util');var path=require(_0x1a1f('0x1'));var timeout=require(_0x1a1f('0x2'));var express=require(_0x1a1f('0x3'));var router=express[_0x1a1f('0x4')]();var fs_extra=require(_0x1a1f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x1a1f('0x6'));var config=require(_0x1a1f('0x7'));var controller=require(_0x1a1f('0x8'));router[_0x1a1f('0x9')]('/',auth[_0x1a1f('0xa')](),controller[_0x1a1f('0xb')]);router[_0x1a1f('0x9')](_0x1a1f('0xc'),auth[_0x1a1f('0xa')](),controller[_0x1a1f('0xd')]);router[_0x1a1f('0xe')]('/',auth[_0x1a1f('0xa')](),controller[_0x1a1f('0xf')]);router[_0x1a1f('0x10')](_0x1a1f('0xc'),auth[_0x1a1f('0xa')](),controller[_0x1a1f('0x11')]);router[_0x1a1f('0x12')]('/:id',auth[_0x1a1f('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index d758818..126aa7d 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 _0x2bd6=['exports','STRING','sequelize'];(function(_0x6b252,_0x5d91af){var _0x354504=function(_0x1aeedc){while(--_0x1aeedc){_0x6b252['push'](_0x6b252['shift']());}};_0x354504(++_0x5d91af);}(_0x2bd6,0x1f4));var _0x62bd=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0x2bd6[_0x5608a3];return _0x1ed50a;};'use strict';var Sequelize=require(_0x62bd('0x0'));module[_0x62bd('0x1')]={'name':{'type':Sequelize[_0x62bd('0x2')]},'basename':{'type':Sequelize[_0x62bd('0x2')]},'type':{'type':Sequelize[_0x62bd('0x2')]}}; \ No newline at end of file +var _0x14ee=['STRING','sequelize'];(function(_0x5cb1af,_0x4bdc8c){var _0x8d7940=function(_0x3db70a){while(--_0x3db70a){_0x5cb1af['push'](_0x5cb1af['shift']());}};_0x8d7940(++_0x4bdc8c);}(_0x14ee,0x115));var _0xe14e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x14ee[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xe14e('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize[_0xe14e('0x1')]},'type':{'type':Sequelize[_0xe14e('0x1')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 9a6ac61..585f6e7 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 _0x0e65=['key','model','query','keys','attributes','intersection','fields','length','nolimit','sort','where','pick','filters','filter','type','VIRTUAL','merge','options','rows','catch','params','includeAll','include','find','get','omit','createdAt','updatedAt','body','create','file','basename','mimetype','download','findOne','ChatOfflineMessageId','join','root','server/files/attachments/','rimraf','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','Attachment','fieldName'];(function(_0x377031,_0x1825c9){var _0x532ea4=function(_0x84e692){while(--_0x84e692){_0x377031['push'](_0x377031['shift']());}};_0x532ea4(++_0x1825c9);}(_0x0e65,0xd1));var _0x50e6=function(_0x326488,_0x37fa02){_0x326488=_0x326488-0x0;var _0x130c5e=_0x0e65[_0x326488];return _0x130c5e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x50e6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x50e6('0x1'));var BPromise=require(_0x50e6('0x2'));var Mustache=require(_0x50e6('0x3'));var util=require(_0x50e6('0x4'));var path=require(_0x50e6('0x5'));var sox=require(_0x50e6('0x6'));var csv=require(_0x50e6('0x7'));var ejs=require(_0x50e6('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x50e6('0x9'));var squel=require('squel');var crypto=require(_0x50e6('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x50e6('0xb'));var Papa=require(_0x50e6('0xc'));var Redis=require(_0x50e6('0xd'));var authService=require(_0x50e6('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x50e6('0xf'));var hardwareService=require(_0x50e6('0x10'));var logger=require(_0x50e6('0x11'))(_0x50e6('0x12'));var utils=require(_0x50e6('0x13'));var config=require(_0x50e6('0x14'));var licenseUtil=require(_0x50e6('0x15'));var db=require(_0x50e6('0x16'))['db'];function respondWithStatusCode(_0x53507f,_0x4eb0a4){_0x4eb0a4=_0x4eb0a4||0xcc;return function(_0x3167ba){if(_0x3167ba){return _0x53507f[_0x50e6('0x17')](_0x4eb0a4);}return _0x53507f['status'](_0x4eb0a4)['end']();};}function respondWithResult(_0x442f38,_0x2d3012){_0x2d3012=_0x2d3012||0xc8;return function(_0x4bce25){if(_0x4bce25){return _0x442f38[_0x50e6('0x18')](_0x2d3012)[_0x50e6('0x19')](_0x4bce25);}};}function respondWithFilteredResult(_0x270fd5,_0x297cf8){return function(_0x3b35e7){if(_0x3b35e7){var _0x4f48fc=typeof _0x297cf8[_0x50e6('0x1a')]===_0x50e6('0x1b')&&typeof _0x297cf8[_0x50e6('0x1c')]===_0x50e6('0x1b');var _0x55afe8=_0x3b35e7[_0x50e6('0x1d')];var _0x1159a2=_0x4f48fc?0x0:_0x297cf8[_0x50e6('0x1a')];var _0x194144=_0x4f48fc?_0x3b35e7[_0x50e6('0x1d')]:_0x297cf8[_0x50e6('0x1a')]+_0x297cf8[_0x50e6('0x1c')];var _0x5e5c0e;if(_0x194144>=_0x55afe8){_0x194144=_0x55afe8;_0x5e5c0e=0xc8;}else{_0x5e5c0e=0xce;}_0x270fd5[_0x50e6('0x18')](_0x5e5c0e);return _0x270fd5[_0x50e6('0x1e')](_0x50e6('0x1f'),_0x1159a2+'-'+_0x194144+'/'+_0x55afe8)[_0x50e6('0x19')](_0x3b35e7);}return null;};}function patchUpdates(_0x2e77b7){return function(_0x1c4ccb){try{jsonpatch[_0x50e6('0x20')](_0x1c4ccb,_0x2e77b7,!![]);}catch(_0x14b17a){return BPromise[_0x50e6('0x21')](_0x14b17a);}return _0x1c4ccb[_0x50e6('0x22')]();};}function saveUpdates(_0x486718,_0x3bc1db){return function(_0x5e6201){if(_0x5e6201){return _0x5e6201[_0x50e6('0x23')](_0x486718)[_0x50e6('0x24')](function(_0x529a03){return _0x529a03;});}return null;};}function removeEntity(_0x226bff,_0x1d1e2c){return function(_0xe0a76c){if(_0xe0a76c){return _0xe0a76c[_0x50e6('0x25')]()[_0x50e6('0x24')](function(){_0x226bff[_0x50e6('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x41f7bc,_0x15df56){return function(_0x2a1186){if(!_0x2a1186){_0x41f7bc[_0x50e6('0x17')](0x194);}return _0x2a1186;};}function handleError(_0x500043,_0x225ce9){_0x225ce9=_0x225ce9||0x1f4;return function(_0x4392ab){logger[_0x50e6('0x26')](_0x4392ab[_0x50e6('0x27')]);if(_0x4392ab[_0x50e6('0x28')]){delete _0x4392ab['name'];}_0x500043[_0x50e6('0x18')](_0x225ce9)[_0x50e6('0x29')](_0x4392ab);};}exports[_0x50e6('0x2a')]=function(_0xcd9e6,_0x1d4077){var _0x330cc2={},_0x181356={},_0x507f77={'count':0x0,'rows':[]};var _0x1d1617=_[_0x50e6('0x2b')](db[_0x50e6('0x2c')]['rawAttributes'],function(_0x44f0eb){return{'name':_0x44f0eb[_0x50e6('0x2d')],'type':_0x44f0eb['type'][_0x50e6('0x2e')]};});_0x181356[_0x50e6('0x2f')]=_[_0x50e6('0x2b')](_0x1d1617,_0x50e6('0x28'));_0x181356[_0x50e6('0x30')]=_[_0x50e6('0x31')](_0xcd9e6[_0x50e6('0x30')]);_0x181356['filters']=_['intersection'](_0x181356[_0x50e6('0x2f')],_0x181356[_0x50e6('0x30')]);_0x330cc2[_0x50e6('0x32')]=_[_0x50e6('0x33')](_0x181356[_0x50e6('0x2f')],qs[_0x50e6('0x34')](_0xcd9e6[_0x50e6('0x30')][_0x50e6('0x34')]));_0x330cc2[_0x50e6('0x32')]=_0x330cc2['attributes'][_0x50e6('0x35')]?_0x330cc2[_0x50e6('0x32')]:_0x181356[_0x50e6('0x2f')];if(!_0xcd9e6[_0x50e6('0x30')]['hasOwnProperty'](_0x50e6('0x36'))){_0x330cc2[_0x50e6('0x1c')]=qs[_0x50e6('0x1c')](_0xcd9e6[_0x50e6('0x30')]['limit']);_0x330cc2[_0x50e6('0x1a')]=qs['offset'](_0xcd9e6['query']['offset']);}_0x330cc2['order']=qs[_0x50e6('0x37')](_0xcd9e6[_0x50e6('0x30')]['sort']);_0x330cc2[_0x50e6('0x38')]=qs['filters'](_[_0x50e6('0x39')](_0xcd9e6['query'],_0x181356[_0x50e6('0x3a')]),_0x1d1617);if(_0xcd9e6[_0x50e6('0x30')][_0x50e6('0x3b')]){_0x330cc2['where']=_['merge'](_0x330cc2['where'],{'$or':_[_0x50e6('0x2b')](_0x1d1617,function(_0x564bc2){if(_0x564bc2[_0x50e6('0x3c')]!==_0x50e6('0x3d')){var _0x4c91d7={};_0x4c91d7[_0x564bc2[_0x50e6('0x28')]]={'$like':'%'+_0xcd9e6[_0x50e6('0x30')][_0x50e6('0x3b')]+'%'};return _0x4c91d7;}})});}_0x330cc2=_[_0x50e6('0x3e')]({},_0x330cc2,_0xcd9e6[_0x50e6('0x3f')]);var _0x45a84d={'where':_0x330cc2[_0x50e6('0x38')]};return db[_0x50e6('0x2c')][_0x50e6('0x1d')](_0x45a84d)[_0x50e6('0x24')](function(_0x55c955){_0x507f77[_0x50e6('0x1d')]=_0x55c955;if(_0xcd9e6[_0x50e6('0x30')]['includeAll']){_0x330cc2['include']=[{'all':!![]}];}return db[_0x50e6('0x2c')]['findAll'](_0x330cc2);})[_0x50e6('0x24')](function(_0x57041b){_0x507f77[_0x50e6('0x40')]=_0x57041b;return _0x507f77;})[_0x50e6('0x24')](respondWithFilteredResult(_0x1d4077,_0x330cc2))[_0x50e6('0x41')](handleError(_0x1d4077,null));};exports['show']=function(_0x17f7cb,_0x538959){var _0x418c1d={'raw':!![],'where':{'id':_0x17f7cb[_0x50e6('0x42')]['id']}},_0x304b29={};_0x304b29[_0x50e6('0x2f')]=_[_0x50e6('0x31')](db[_0x50e6('0x2c')]['rawAttributes']);_0x304b29[_0x50e6('0x30')]=_[_0x50e6('0x31')](_0x17f7cb[_0x50e6('0x30')]);_0x304b29[_0x50e6('0x3a')]=_['intersection'](_0x304b29[_0x50e6('0x2f')],_0x304b29[_0x50e6('0x30')]);_0x418c1d[_0x50e6('0x32')]=_[_0x50e6('0x33')](_0x304b29['model'],qs['fields'](_0x17f7cb[_0x50e6('0x30')][_0x50e6('0x34')]));_0x418c1d[_0x50e6('0x32')]=_0x418c1d[_0x50e6('0x32')][_0x50e6('0x35')]?_0x418c1d[_0x50e6('0x32')]:_0x304b29[_0x50e6('0x2f')];if(_0x17f7cb[_0x50e6('0x30')][_0x50e6('0x43')]){_0x418c1d[_0x50e6('0x44')]=[{'all':!![]}];}_0x418c1d=_['merge']({},_0x418c1d,_0x17f7cb[_0x50e6('0x3f')]);return db[_0x50e6('0x2c')][_0x50e6('0x45')](_0x418c1d)[_0x50e6('0x24')](handleEntityNotFound(_0x538959,null))['then'](respondWithResult(_0x538959,null))[_0x50e6('0x41')](handleError(_0x538959,null));};exports['clone']=function(_0x5a0cf6,_0x2b6a93){var _0x57f5b4={'where':{'id':_0x5a0cf6['params']['id']}},_0x538ca1={};_0x538ca1[_0x50e6('0x2f')]=_[_0x50e6('0x31')](db['Attachment']['rawAttributes']);_0x57f5b4[_0x50e6('0x32')]=_[_0x50e6('0x33')](_0x538ca1[_0x50e6('0x2f')],qs['fields'](_0x5a0cf6['query'][_0x50e6('0x34')]));_0x57f5b4[_0x50e6('0x32')]=_0x57f5b4[_0x50e6('0x32')][_0x50e6('0x35')]?_0x57f5b4[_0x50e6('0x32')]:_0x538ca1[_0x50e6('0x2f')];if(_0x5a0cf6[_0x50e6('0x30')][_0x50e6('0x43')]){_0x57f5b4[_0x50e6('0x44')]=[{'all':!![]}];}_0x57f5b4=_[_0x50e6('0x3e')]({},_0x57f5b4,_0x5a0cf6['options']);return db[_0x50e6('0x2c')][_0x50e6('0x45')](_0x57f5b4)[_0x50e6('0x24')](handleEntityNotFound(_0x2b6a93,null))['then'](function(_0x5266ea){if(_0x5266ea){var _0x350431=_0x5266ea[_0x50e6('0x46')]({'plain':!![]});_0x350431=qs[_0x50e6('0x47')](_0x350431,['id',_0x50e6('0x48'),_0x50e6('0x49')]);_0x5a0cf6[_0x50e6('0x4a')]=_['omit'](_0x5a0cf6[_0x50e6('0x4a')],['id','createdAt',_0x50e6('0x49')]);return db[_0x50e6('0x2c')][_0x50e6('0x4b')](_['merge'](_0x350431,_0x5a0cf6['body']),{'include':_0x5a0cf6[_0x50e6('0x30')][_0x50e6('0x43')]?[{'all':!![]}]:undefined});}})[_0x50e6('0x24')](respondWithResult(_0x2b6a93,0xc9))[_0x50e6('0x41')](handleError(_0x2b6a93,null));};exports[_0x50e6('0x23')]=function(_0x5bf954,_0x1f7e76){if(_0x5bf954[_0x50e6('0x4a')]['id']){delete _0x5bf954[_0x50e6('0x4a')]['id'];}return db[_0x50e6('0x2c')][_0x50e6('0x45')]({'where':{'id':_0x5bf954['params']['id']}})[_0x50e6('0x24')](handleEntityNotFound(_0x1f7e76,null))[_0x50e6('0x24')](saveUpdates(_0x5bf954['body'],null))['then'](respondWithResult(_0x1f7e76,null))[_0x50e6('0x41')](handleError(_0x1f7e76,null));};exports['destroy']=function(_0x4fc356,_0x1ff127){return db[_0x50e6('0x2c')][_0x50e6('0x45')]({'where':{'id':_0x4fc356[_0x50e6('0x42')]['id']}})['then'](handleEntityNotFound(_0x1ff127,null))[_0x50e6('0x24')](removeEntity(_0x1ff127,null))[_0x50e6('0x41')](handleError(_0x1ff127,null));};exports[_0x50e6('0x4b')]=function(_0x27086e,_0xa21f70,_0x54cf56){_0x27086e['body'][_0x50e6('0x28')]=_0x27086e[_0x50e6('0x4c')]['originalname'];_0x27086e['body'][_0x50e6('0x4d')]=_0x27086e[_0x50e6('0x4c')]['filename'];_0x27086e[_0x50e6('0x4a')][_0x50e6('0x3c')]=_0x27086e[_0x50e6('0x4c')][_0x50e6('0x4e')];return db[_0x50e6('0x2c')][_0x50e6('0x4b')](_0x27086e[_0x50e6('0x4a')])['then'](respondWithResult(_0xa21f70,0xc9))[_0x50e6('0x41')](handleError(_0xa21f70,null));};exports[_0x50e6('0x4f')]=function(_0x4bea5d,_0x588fda,_0x46f158){return db[_0x50e6('0x2c')][_0x50e6('0x50')]({'where':{'id':_0x4bea5d[_0x50e6('0x42')]['id']},'raw':!![]})[_0x50e6('0x24')](handleEntityNotFound(_0x588fda,null))[_0x50e6('0x24')](function(_0x5e831a){if(_0x5e831a){var _0x5d70b6=_0x5e831a[_0x50e6('0x51')]!==null;var _0x31875f=path[_0x50e6('0x52')](config[_0x50e6('0x53')],_0x50e6('0x54'));if(_0x5d70b6){_0x31875f=path[_0x50e6('0x52')](_0x31875f,'offline-chat/');}var _0x321c45=path['join'](_0x31875f,_0x5e831a[_0x50e6('0x4d')]);return _0x588fda[_0x50e6('0x4f')](_0x321c45);}})[_0x50e6('0x41')](handleError(_0x588fda,null));}; \ No newline at end of file +var _0xd8da=['ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','name','send','index','map','Attachment','rawAttributes','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','rows','catch','show','params','clone','length','find','get','omit','createdAt','updatedAt','body','create','file','basename','filename','mimetype','download','root','server/files/attachments/','offline-chat/','join','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv'];(function(_0x24b8f7,_0x583957){var _0x7776c0=function(_0x12478e){while(--_0x12478e){_0x24b8f7['push'](_0x24b8f7['shift']());}};_0x7776c0(++_0x583957);}(_0xd8da,0xac));var _0xad8d=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0xd8da[_0xd1d19a];return _0x52a79d;};'use strict';var emlformat=require(_0xad8d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xad8d('0x1'));var jsonpatch=require(_0xad8d('0x2'));var rp=require(_0xad8d('0x3'));var moment=require(_0xad8d('0x4'));var BPromise=require(_0xad8d('0x5'));var Mustache=require(_0xad8d('0x6'));var util=require(_0xad8d('0x7'));var path=require(_0xad8d('0x8'));var sox=require('sox');var csv=require(_0xad8d('0x9'));var ejs=require(_0xad8d('0xa'));var fs=require('fs');var fs_extra=require(_0xad8d('0xb'));var _=require('lodash');var squel=require(_0xad8d('0xc'));var crypto=require(_0xad8d('0xd'));var jsforce=require(_0xad8d('0xe'));var deskjs=require(_0xad8d('0xf'));var toCsv=require('to-csv');var querystring=require(_0xad8d('0x10'));var Papa=require(_0xad8d('0x11'));var Redis=require(_0xad8d('0x12'));var authService=require(_0xad8d('0x13'));var qs=require(_0xad8d('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xad8d('0x15'));var logger=require(_0xad8d('0x16'))(_0xad8d('0x17'));var utils=require(_0xad8d('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xad8d('0x19'));var db=require(_0xad8d('0x1a'))['db'];function respondWithStatusCode(_0x3f1248,_0x5cd1d1){_0x5cd1d1=_0x5cd1d1||0xcc;return function(_0x445a76){if(_0x445a76){return _0x3f1248[_0xad8d('0x1b')](_0x5cd1d1);}return _0x3f1248['status'](_0x5cd1d1)[_0xad8d('0x1c')]();};}function respondWithResult(_0x2dcfa8,_0xe8854){_0xe8854=_0xe8854||0xc8;return function(_0x1d1a2d){if(_0x1d1a2d){return _0x2dcfa8[_0xad8d('0x1d')](_0xe8854)[_0xad8d('0x1e')](_0x1d1a2d);}};}function respondWithFilteredResult(_0x177201,_0x32f4c2){return function(_0x39a88f){if(_0x39a88f){var _0x88c62e=typeof _0x32f4c2[_0xad8d('0x1f')]===_0xad8d('0x20')&&typeof _0x32f4c2[_0xad8d('0x21')]===_0xad8d('0x20');var _0x3581fa=_0x39a88f[_0xad8d('0x22')];var _0x34ea56=_0x88c62e?0x0:_0x32f4c2[_0xad8d('0x1f')];var _0x326c77=_0x88c62e?_0x39a88f[_0xad8d('0x22')]:_0x32f4c2[_0xad8d('0x1f')]+_0x32f4c2[_0xad8d('0x21')];var _0x2e52e8;if(_0x326c77>=_0x3581fa){_0x326c77=_0x3581fa;_0x2e52e8=0xc8;}else{_0x2e52e8=0xce;}_0x177201[_0xad8d('0x1d')](_0x2e52e8);return _0x177201[_0xad8d('0x23')](_0xad8d('0x24'),_0x34ea56+'-'+_0x326c77+'/'+_0x3581fa)[_0xad8d('0x1e')](_0x39a88f);}return null;};}function patchUpdates(_0x2af45d){return function(_0x440a70){try{jsonpatch[_0xad8d('0x25')](_0x440a70,_0x2af45d,!![]);}catch(_0x3a4b3c){return BPromise[_0xad8d('0x26')](_0x3a4b3c);}return _0x440a70[_0xad8d('0x27')]();};}function saveUpdates(_0x2dd141,_0x4ca29c){return function(_0x1bbffe){if(_0x1bbffe){return _0x1bbffe['update'](_0x2dd141)[_0xad8d('0x28')](function(_0xb8ef70){return _0xb8ef70;});}return null;};}function removeEntity(_0x30a635,_0x545a93){return function(_0x54679d){if(_0x54679d){return _0x54679d[_0xad8d('0x29')]()['then'](function(){_0x30a635[_0xad8d('0x1d')](0xcc)[_0xad8d('0x1c')]();});}};}function handleEntityNotFound(_0x5cd9e6,_0x1a8d77){return function(_0x5a6bdc){if(!_0x5a6bdc){_0x5cd9e6[_0xad8d('0x1b')](0x194);}return _0x5a6bdc;};}function handleError(_0x214456,_0x5445dd){_0x5445dd=_0x5445dd||0x1f4;return function(_0x2db65d){logger[_0xad8d('0x2a')](_0x2db65d['stack']);if(_0x2db65d[_0xad8d('0x2b')]){delete _0x2db65d[_0xad8d('0x2b')];}_0x214456[_0xad8d('0x1d')](_0x5445dd)[_0xad8d('0x2c')](_0x2db65d);};}exports[_0xad8d('0x2d')]=function(_0x481f69,_0x53ebf2){var _0x5ea3e9={},_0x2af1d8={},_0x52ac3e={'count':0x0,'rows':[]};var _0x343c87=_[_0xad8d('0x2e')](db[_0xad8d('0x2f')][_0xad8d('0x30')],function(_0x44e871){return{'name':_0x44e871['fieldName'],'type':_0x44e871['type']['key']};});_0x2af1d8[_0xad8d('0x31')]=_['map'](_0x343c87,_0xad8d('0x2b'));_0x2af1d8['query']=_[_0xad8d('0x32')](_0x481f69[_0xad8d('0x33')]);_0x2af1d8[_0xad8d('0x34')]=_[_0xad8d('0x35')](_0x2af1d8[_0xad8d('0x31')],_0x2af1d8[_0xad8d('0x33')]);_0x5ea3e9[_0xad8d('0x36')]=_[_0xad8d('0x35')](_0x2af1d8['model'],qs[_0xad8d('0x37')](_0x481f69[_0xad8d('0x33')][_0xad8d('0x37')]));_0x5ea3e9[_0xad8d('0x36')]=_0x5ea3e9[_0xad8d('0x36')]['length']?_0x5ea3e9[_0xad8d('0x36')]:_0x2af1d8[_0xad8d('0x31')];if(!_0x481f69[_0xad8d('0x33')][_0xad8d('0x38')](_0xad8d('0x39'))){_0x5ea3e9[_0xad8d('0x21')]=qs['limit'](_0x481f69['query'][_0xad8d('0x21')]);_0x5ea3e9[_0xad8d('0x1f')]=qs[_0xad8d('0x1f')](_0x481f69[_0xad8d('0x33')][_0xad8d('0x1f')]);}_0x5ea3e9[_0xad8d('0x3a')]=qs[_0xad8d('0x3b')](_0x481f69[_0xad8d('0x33')][_0xad8d('0x3b')]);_0x5ea3e9[_0xad8d('0x3c')]=qs['filters'](_[_0xad8d('0x3d')](_0x481f69[_0xad8d('0x33')],_0x2af1d8[_0xad8d('0x34')]),_0x343c87);if(_0x481f69[_0xad8d('0x33')][_0xad8d('0x3e')]){_0x5ea3e9[_0xad8d('0x3c')]=_[_0xad8d('0x3f')](_0x5ea3e9[_0xad8d('0x3c')],{'$or':_[_0xad8d('0x2e')](_0x343c87,function(_0x35f2c6){if(_0x35f2c6[_0xad8d('0x40')]!=='VIRTUAL'){var _0x36b6c3={};_0x36b6c3[_0x35f2c6[_0xad8d('0x2b')]]={'$like':'%'+_0x481f69[_0xad8d('0x33')][_0xad8d('0x3e')]+'%'};return _0x36b6c3;}})});}_0x5ea3e9=_[_0xad8d('0x3f')]({},_0x5ea3e9,_0x481f69[_0xad8d('0x41')]);var _0x43d0ee={'where':_0x5ea3e9[_0xad8d('0x3c')]};return db[_0xad8d('0x2f')][_0xad8d('0x22')](_0x43d0ee)['then'](function(_0x46c79c){_0x52ac3e[_0xad8d('0x22')]=_0x46c79c;if(_0x481f69[_0xad8d('0x33')][_0xad8d('0x42')]){_0x5ea3e9[_0xad8d('0x43')]=[{'all':!![]}];}return db['Attachment'][_0xad8d('0x44')](_0x5ea3e9);})[_0xad8d('0x28')](function(_0xa8016c){_0x52ac3e[_0xad8d('0x45')]=_0xa8016c;return _0x52ac3e;})[_0xad8d('0x28')](respondWithFilteredResult(_0x53ebf2,_0x5ea3e9))[_0xad8d('0x46')](handleError(_0x53ebf2,null));};exports[_0xad8d('0x47')]=function(_0x1f805f,_0x40e7a2){var _0x41a33c={'raw':!![],'where':{'id':_0x1f805f[_0xad8d('0x48')]['id']}},_0x4d69f3={};_0x4d69f3[_0xad8d('0x31')]=_[_0xad8d('0x32')](db[_0xad8d('0x2f')]['rawAttributes']);_0x4d69f3['query']=_['keys'](_0x1f805f[_0xad8d('0x33')]);_0x4d69f3[_0xad8d('0x34')]=_[_0xad8d('0x35')](_0x4d69f3[_0xad8d('0x31')],_0x4d69f3[_0xad8d('0x33')]);_0x41a33c[_0xad8d('0x36')]=_['intersection'](_0x4d69f3['model'],qs[_0xad8d('0x37')](_0x1f805f[_0xad8d('0x33')][_0xad8d('0x37')]));_0x41a33c['attributes']=_0x41a33c['attributes']['length']?_0x41a33c[_0xad8d('0x36')]:_0x4d69f3[_0xad8d('0x31')];if(_0x1f805f[_0xad8d('0x33')][_0xad8d('0x42')]){_0x41a33c['include']=[{'all':!![]}];}_0x41a33c=_['merge']({},_0x41a33c,_0x1f805f[_0xad8d('0x41')]);return db[_0xad8d('0x2f')]['find'](_0x41a33c)[_0xad8d('0x28')](handleEntityNotFound(_0x40e7a2,null))[_0xad8d('0x28')](respondWithResult(_0x40e7a2,null))[_0xad8d('0x46')](handleError(_0x40e7a2,null));};exports[_0xad8d('0x49')]=function(_0x3d1280,_0x478d10){var _0x3f54f8={'where':{'id':_0x3d1280[_0xad8d('0x48')]['id']}},_0xf07e4b={};_0xf07e4b[_0xad8d('0x31')]=_[_0xad8d('0x32')](db[_0xad8d('0x2f')]['rawAttributes']);_0x3f54f8[_0xad8d('0x36')]=_[_0xad8d('0x35')](_0xf07e4b[_0xad8d('0x31')],qs[_0xad8d('0x37')](_0x3d1280[_0xad8d('0x33')]['fields']));_0x3f54f8[_0xad8d('0x36')]=_0x3f54f8['attributes'][_0xad8d('0x4a')]?_0x3f54f8[_0xad8d('0x36')]:_0xf07e4b['model'];if(_0x3d1280[_0xad8d('0x33')]['includeAll']){_0x3f54f8[_0xad8d('0x43')]=[{'all':!![]}];}_0x3f54f8=_[_0xad8d('0x3f')]({},_0x3f54f8,_0x3d1280[_0xad8d('0x41')]);return db[_0xad8d('0x2f')][_0xad8d('0x4b')](_0x3f54f8)[_0xad8d('0x28')](handleEntityNotFound(_0x478d10,null))['then'](function(_0xbcdf6b){if(_0xbcdf6b){var _0x1c07fe=_0xbcdf6b[_0xad8d('0x4c')]({'plain':!![]});_0x1c07fe=qs[_0xad8d('0x4d')](_0x1c07fe,['id',_0xad8d('0x4e'),_0xad8d('0x4f')]);_0x3d1280[_0xad8d('0x50')]=_['omit'](_0x3d1280[_0xad8d('0x50')],['id',_0xad8d('0x4e'),_0xad8d('0x4f')]);return db[_0xad8d('0x2f')][_0xad8d('0x51')](_[_0xad8d('0x3f')](_0x1c07fe,_0x3d1280['body']),{'include':_0x3d1280[_0xad8d('0x33')][_0xad8d('0x42')]?[{'all':!![]}]:undefined});}})[_0xad8d('0x28')](respondWithResult(_0x478d10,0xc9))[_0xad8d('0x46')](handleError(_0x478d10,null));};exports['update']=function(_0x3919ea,_0x511f6d){if(_0x3919ea[_0xad8d('0x50')]['id']){delete _0x3919ea[_0xad8d('0x50')]['id'];}return db['Attachment'][_0xad8d('0x4b')]({'where':{'id':_0x3919ea[_0xad8d('0x48')]['id']}})['then'](handleEntityNotFound(_0x511f6d,null))['then'](saveUpdates(_0x3919ea[_0xad8d('0x50')],null))['then'](respondWithResult(_0x511f6d,null))[_0xad8d('0x46')](handleError(_0x511f6d,null));};exports[_0xad8d('0x29')]=function(_0x1b6d17,_0x40548f){return db['Attachment'][_0xad8d('0x4b')]({'where':{'id':_0x1b6d17[_0xad8d('0x48')]['id']}})[_0xad8d('0x28')](handleEntityNotFound(_0x40548f,null))[_0xad8d('0x28')](removeEntity(_0x40548f,null))['catch'](handleError(_0x40548f,null));};exports[_0xad8d('0x51')]=function(_0x541aa5,_0x3e9a73,_0x59c428){_0x541aa5[_0xad8d('0x50')]['name']=_0x541aa5[_0xad8d('0x52')]['originalname'];_0x541aa5[_0xad8d('0x50')][_0xad8d('0x53')]=_0x541aa5[_0xad8d('0x52')][_0xad8d('0x54')];_0x541aa5[_0xad8d('0x50')][_0xad8d('0x40')]=_0x541aa5['file'][_0xad8d('0x55')];return db['Attachment'][_0xad8d('0x51')](_0x541aa5[_0xad8d('0x50')])[_0xad8d('0x28')](respondWithResult(_0x3e9a73,0xc9))[_0xad8d('0x46')](handleError(_0x3e9a73,null));};exports[_0xad8d('0x56')]=function(_0x2d2877,_0x5c5918,_0x4ac956){return db[_0xad8d('0x2f')]['findOne']({'where':{'id':_0x2d2877[_0xad8d('0x48')]['id']},'raw':!![]})[_0xad8d('0x28')](handleEntityNotFound(_0x5c5918,null))[_0xad8d('0x28')](function(_0x351297){if(_0x351297){var _0x516389=_0x351297['ChatOfflineMessageId']!==null;var _0xc817e0=path['join'](config[_0xad8d('0x57')],_0xad8d('0x58'));if(_0x516389){_0xc817e0=path['join'](_0xc817e0,_0xad8d('0x59'));}var _0x6e777b=path[_0xad8d('0x5a')](_0xc817e0,_0x351297[_0xad8d('0x53')]);return _0x5c5918['download'](_0x6e777b);}})[_0xad8d('0x46')](handleError(_0x5c5918,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 4dfc112..4108a51 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 _0x7e05=['path','../../config/environment','./attachment.attributes','exports','define','Attachment','attachments','lodash','util','api','moment','request-promise'];(function(_0x4e8fb5,_0x5bb89a){var _0x198b65=function(_0x2c6be8){while(--_0x2c6be8){_0x4e8fb5['push'](_0x4e8fb5['shift']());}};_0x198b65(++_0x5bb89a);}(_0x7e05,0x19f));var _0x57e0=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x7e05[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x57e0('0x0'));var util=require(_0x57e0('0x1'));var logger=require('../../config/logger')(_0x57e0('0x2'));var moment=require(_0x57e0('0x3'));var BPromise=require('bluebird');var rp=require(_0x57e0('0x4'));var fs=require('fs');var path=require(_0x57e0('0x5'));var rimraf=require('rimraf');var config=require(_0x57e0('0x6'));var attributes=require(_0x57e0('0x7'));module[_0x57e0('0x8')]=function(_0x5af8d8,_0x1c28d4){return _0x5af8d8[_0x57e0('0x9')](_0x57e0('0xa'),attributes,{'tableName':_0x57e0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9bdc=['request-promise','./attachment.attributes','exports','define','attachments','lodash','util','../../config/logger','api','bluebird'];(function(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0x9bdc,0x9b));var _0xc9bd=function(_0x582974,_0xb6918c){_0x582974=_0x582974-0x0;var _0x5a1914=_0x9bdc[_0x582974];return _0x5a1914;};'use strict';var _=require(_0xc9bd('0x0'));var util=require(_0xc9bd('0x1'));var logger=require(_0xc9bd('0x2'))(_0xc9bd('0x3'));var moment=require('moment');var BPromise=require(_0xc9bd('0x4'));var rp=require(_0xc9bd('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc9bd('0x6'));module[_0xc9bd('0x7')]=function(_0x2d0335,_0x570a3d){return _0x2d0335[_0xc9bd('0x8')]('Attachment',attributes,{'tableName':_0xc9bd('0x9'),'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 d1527d4..5b40065 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 _0xe812=['error','code','message','info','result','CreateAttachment','Attachment','create','body','options','raw','catch','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','then','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x50d160,_0x447b4f){var _0x28172e=function(_0x569824){while(--_0x569824){_0x50d160['push'](_0x50d160['shift']());}};_0x28172e(++_0x447b4f);}(_0xe812,0x1f2));var _0x2e81=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xe812[_0x2641f9];return _0x585741;};'use strict';var _=require('lodash');var util=require(_0x2e81('0x0'));var moment=require(_0x2e81('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2e81('0x2'));var db=require(_0x2e81('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x2e81('0x4'))(_0x2e81('0x5'));var config=require('../../config/environment');var jayson=require(_0x2e81('0x6'));var client=jayson[_0x2e81('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x36604d,_0x32b221,_0x27f9c6){return new BPromise(function(_0x5559ca,_0x142cab){return client[_0x2e81('0x8')](_0x36604d,_0x27f9c6)[_0x2e81('0x9')](function(_0x11a56b){logger['info'](_0x2e81('0xa'),_0x32b221,_0x2e81('0xb'));logger[_0x2e81('0xc')](_0x2e81('0xd'),_0x32b221,_0x2e81('0xb'),JSON[_0x2e81('0xe')](_0x11a56b));if(_0x11a56b[_0x2e81('0xf')]){if(_0x11a56b[_0x2e81('0xf')][_0x2e81('0x10')]===0x1f4){logger[_0x2e81('0xf')](_0x2e81('0xa'),_0x32b221,_0x11a56b['error'][_0x2e81('0x11')]);return _0x142cab(_0x11a56b[_0x2e81('0xf')]['message']);}logger[_0x2e81('0xf')]('Attachment,\x20%s,\x20%s',_0x32b221,_0x11a56b[_0x2e81('0xf')][_0x2e81('0x11')]);return _0x5559ca(_0x11a56b[_0x2e81('0xf')][_0x2e81('0x11')]);}else{logger[_0x2e81('0x12')](_0x2e81('0xa'),_0x32b221,'request\x20sent');_0x5559ca(_0x11a56b[_0x2e81('0x13')][_0x2e81('0x11')]);}})['catch'](function(_0x330131){logger['error'](_0x2e81('0xa'),_0x32b221,_0x330131);_0x142cab(_0x330131);});});}exports[_0x2e81('0x14')]=function(_0x4c1b11){var _0x402992=this;return new Promise(function(_0x2bb9b6,_0xbb61a4){return db[_0x2e81('0x15')][_0x2e81('0x16')](_0x4c1b11[_0x2e81('0x17')],{'raw':_0x4c1b11[_0x2e81('0x18')]?_0x4c1b11[_0x2e81('0x18')][_0x2e81('0x19')]===undefined?!![]:![]:!![]})[_0x2e81('0x9')](function(_0x524694){logger[_0x2e81('0x12')](_0x2e81('0x14'),_0x4c1b11);logger[_0x2e81('0xc')](_0x2e81('0x14'),_0x4c1b11,JSON[_0x2e81('0xe')](_0x524694));_0x2bb9b6(_0x524694);})[_0x2e81('0x1a')](function(_0x18b9be){logger[_0x2e81('0xf')]('CreateAttachment',_0x18b9be[_0x2e81('0x11')],_0x4c1b11);_0xbb61a4(_0x402992['error'](0x1f4,_0x18b9be[_0x2e81('0x11')]));});});}; \ No newline at end of file +var _0x8aa7=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateAttachment','Attachment','create','body','options','raw','stringify','util','moment','bluebird','randomstring'];(function(_0x3c90df,_0x249ce5){var _0x15c7a6=function(_0x33c960){while(--_0x33c960){_0x3c90df['push'](_0x3c90df['shift']());}};_0x15c7a6(++_0x249ce5);}(_0x8aa7,0xb6));var _0x78aa=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0x8aa7[_0x5f09c5];return _0x426ad9;};'use strict';var _=require('lodash');var util=require(_0x78aa('0x0'));var moment=require(_0x78aa('0x1'));var BPromise=require(_0x78aa('0x2'));var rs=require(_0x78aa('0x3'));var fs=require('fs');var Redis=require(_0x78aa('0x4'));var db=require(_0x78aa('0x5'))['db'];var utils=require(_0x78aa('0x6'));var logger=require('../../config/logger')(_0x78aa('0x7'));var config=require(_0x78aa('0x8'));var jayson=require(_0x78aa('0x9'));var client=jayson[_0x78aa('0xa')][_0x78aa('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x369ee7,_0x462a9a,_0xa79008){return new BPromise(function(_0x2368ac,_0x460488){return client[_0x78aa('0xc')](_0x369ee7,_0xa79008)[_0x78aa('0xd')](function(_0x45d377){logger[_0x78aa('0xe')](_0x78aa('0xf'),_0x462a9a,_0x78aa('0x10'));logger[_0x78aa('0x11')](_0x78aa('0x12'),_0x462a9a,_0x78aa('0x10'),JSON['stringify'](_0x45d377));if(_0x45d377['error']){if(_0x45d377[_0x78aa('0x13')][_0x78aa('0x14')]===0x1f4){logger['error'](_0x78aa('0xf'),_0x462a9a,_0x45d377[_0x78aa('0x13')][_0x78aa('0x15')]);return _0x460488(_0x45d377[_0x78aa('0x13')][_0x78aa('0x15')]);}logger['error'](_0x78aa('0xf'),_0x462a9a,_0x45d377[_0x78aa('0x13')][_0x78aa('0x15')]);return _0x2368ac(_0x45d377[_0x78aa('0x13')][_0x78aa('0x15')]);}else{logger['info'](_0x78aa('0xf'),_0x462a9a,_0x78aa('0x10'));_0x2368ac(_0x45d377[_0x78aa('0x16')][_0x78aa('0x15')]);}})[_0x78aa('0x17')](function(_0x2897f8){logger['error']('Attachment,\x20%s,\x20%s',_0x462a9a,_0x2897f8);_0x460488(_0x2897f8);});});}exports[_0x78aa('0x18')]=function(_0x345e4d){var _0xc316d9=this;return new Promise(function(_0x4207b0,_0x9879bf){return db[_0x78aa('0x19')][_0x78aa('0x1a')](_0x345e4d[_0x78aa('0x1b')],{'raw':_0x345e4d[_0x78aa('0x1c')]?_0x345e4d[_0x78aa('0x1c')][_0x78aa('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x18c60d){logger[_0x78aa('0xe')]('CreateAttachment',_0x345e4d);logger[_0x78aa('0x11')](_0x78aa('0x18'),_0x345e4d,JSON[_0x78aa('0x1e')](_0x18c60d));_0x4207b0(_0x18c60d);})['catch'](function(_0x5a9dbf){logger[_0x78aa('0x13')](_0x78aa('0x18'),_0x5a9dbf['message'],_0x345e4d);_0x9879bf(_0xc316d9[_0x78aa('0x13')](0x1f4,_0x5a9dbf[_0x78aa('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index de6e249..66790de 100644 --- a/server/api/attachment/index.js +++ b/server/api/attachment/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['/:id/clone','clone','diskStorage','join','server/files/attachments/','format','now','originalname','replace','single','create','/:id','delete','destroy','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','isAuthenticated','index','show','/:id/download','post'];(function(_0x3305de,_0x16582f){var _0x3b5a84=function(_0x57d7e1){while(--_0x57d7e1){_0x3305de['push'](_0x3305de['shift']());}};_0x3b5a84(++_0x16582f);}(_0x0b0e,0x187));var _0xe0b0=function(_0x20ae3b,_0x23a21c){_0x20ae3b=_0x20ae3b-0x0;var _0x391475=_0x0b0e[_0x20ae3b];return _0x391475;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var fs_extra=require(_0xe0b0('0x4'));var auth=require(_0xe0b0('0x5'));var interaction=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var controller=require(_0xe0b0('0x8'));router[_0xe0b0('0x9')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xb')]);router[_0xe0b0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0x9')](_0xe0b0('0xd'),auth[_0xe0b0('0xa')](),controller['download']);router[_0xe0b0('0xe')](_0xe0b0('0xf'),auth['isAuthenticated'](),controller[_0xe0b0('0x10')]);var upload=multer({'storage':multer[_0xe0b0('0x11')]({'destination':function(_0x574d96,_0x399320,_0x2cdad2){_0x2cdad2(null,path[_0xe0b0('0x12')](config['root'],_0xe0b0('0x13')));},'filename':function(_0x1c358a,_0x3cc19a,_0x45f914){_0x45f914(null,util[_0xe0b0('0x14')]('%s-%s',Date[_0xe0b0('0x15')](),_0x3cc19a[_0xe0b0('0x16')][_0xe0b0('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xe0b0('0xe')]('/',upload[_0xe0b0('0x18')]('file'),controller[_0xe0b0('0x19')]);router['put'](_0xe0b0('0x1a'),auth[_0xe0b0('0xa')](),controller['update']);router[_0xe0b0('0x1b')]('/:id',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x1c')]);module['exports']=router; \ No newline at end of file +var _0x5f2f=['show','/:id/download','download','post','/:id/clone','clone','root','server/files/attachments/','format','now','originalname','replace','single','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./attachment.controller','get','isAuthenticated','index','/:id'];(function(_0x605a77,_0x38ccfe){var _0x225ce7=function(_0x36672e){while(--_0x36672e){_0x605a77['push'](_0x605a77['shift']());}};_0x225ce7(++_0x38ccfe);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4fb32f,_0x39f177){_0x4fb32f=_0x4fb32f-0x0;var _0x2fd978=_0x5f2f[_0x4fb32f];return _0x2fd978;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var fs_extra=require(_0xf5f2('0x6'));var auth=require(_0xf5f2('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf5f2('0x8'));router[_0xf5f2('0x9')]('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0xb')]);router[_0xf5f2('0x9')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0xd')]);router[_0xf5f2('0x9')](_0xf5f2('0xe'),auth['isAuthenticated'](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x10')](_0xf5f2('0x11'),auth['isAuthenticated'](),controller[_0xf5f2('0x12')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x53fb33,_0xa7e1a6,_0x151aba){_0x151aba(null,path['join'](config[_0xf5f2('0x13')],_0xf5f2('0x14')));},'filename':function(_0x331482,_0x3f2997,_0x59bb6c){_0x59bb6c(null,util[_0xf5f2('0x15')]('%s-%s',Date[_0xf5f2('0x16')](),_0x3f2997[_0xf5f2('0x17')][_0xf5f2('0x18')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xf5f2('0x10')]('/',upload[_0xf5f2('0x19')]('file'),controller[_0xf5f2('0x1a')]);router[_0xf5f2('0x1b')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x1c')]);router[_0xf5f2('0x1d')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x1e')]);module[_0xf5f2('0x1f')]=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index b798b2a..cd779a2 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 _0x6c25=['findOne','adSsoEnabled','blockDuration','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','name','salt','disabled','blocked','blockedAt','online','admin','user','agent','add','minutes','clearBlockUser','getLicense','catch','status','send','message','login','Something\x20went\x20wrong,\x20please\x20try\x20again.','role','json','use','password','passport-local','Strategy','activedirectory2','bluebird','util','../../mysqldb','../../components/auth/service','../../config/utils','api','activedirectory','undefined','baseDN','url','domain','authenticate','error','Error\x20authenticate\x20%s:\x20%s','inspect','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured'];(function(_0x159378,_0x280501){var _0x4abb7c=function(_0x3eaffa){while(--_0x3eaffa){_0x159378['push'](_0x159378['shift']());}};_0x4abb7c(++_0x280501);}(_0x6c25,0x143));var _0x56c2=function(_0x2937af,_0xf5d16b){_0x2937af=_0x2937af-0x0;var _0x1c272d=_0x6c25[_0x2937af];return _0x1c272d;};'use strict';var passport=require('passport');var LocalStrategy=require(_0x56c2('0x0'))[_0x56c2('0x1')];var moment=require('moment');var ActiveDirectory=require(_0x56c2('0x2'));var BPromise=require(_0x56c2('0x3'));var util=require(_0x56c2('0x4'));var db=require(_0x56c2('0x5'))['db'];var authService=require(_0x56c2('0x6'));var utils=require(_0x56c2('0x7'));var config=require('../../config/environment');var logger=require('../../config/logger')(_0x56c2('0x8'));function isActiveDirectoryConfigured(_0xbeb27e){var _0x5b67e5=![];if(typeof _0xbeb27e[_0x56c2('0x9')]!==_0x56c2('0xa')){_0x5b67e5=_0xbeb27e[_0x56c2('0x9')][_0x56c2('0xb')]&&_0xbeb27e['activedirectory'][_0x56c2('0xc')]&&_0xbeb27e[_0x56c2('0x9')][_0x56c2('0xd')];}return _0x5b67e5;}function adAuthenticate(_0x3783ba,_0x13d6ca,_0x555454){return new BPromise(function(_0x2acc9e,_0x2ffddc){try{var _0x5c883e=new ActiveDirectory(_0x3783ba);_0x5c883e[_0x56c2('0xe')](_0x13d6ca,_0x555454,function(_0x499780,_0x3a776d){if(_0x499780){logger[_0x56c2('0xf')](_0x56c2('0x10'),_0x13d6ca,util[_0x56c2('0x11')](_0x499780,{'showHidden':![],'depth':null}));_0x2ffddc('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(!_0x3a776d){logger['error'](_0x56c2('0x12'),_0x13d6ca);_0x2ffddc('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x2acc9e(_0x3a776d);}});}catch(_0x106147){_0x2ffddc(_0x106147);}});}function ActiveDirectoryAuthenticate(_0x5e7292,_0x499557,_0x2eec30,_0x3430fe){var _0xc6df82,_0x14ae4b;if(!isActiveDirectoryConfigured(config)){logger[_0x56c2('0xf')](_0x56c2('0x13'),_0x499557);return _0x3430fe(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}return db['Setting'][_0x56c2('0x14')]({'where':{'id':0x1},'attributes':[_0x56c2('0x15'),_0x56c2('0x16')],'raw':!![]})[_0x56c2('0x17')](function(_0x5d711d){_0xc6df82=_0x5d711d;if(!_0xc6df82[_0x56c2('0x15')]){logger[_0x56c2('0xf')](_0x56c2('0x18'),_0x499557);throw new Error(_0x56c2('0x19'));}return _0x5e7292[_0x56c2('0x14')]({'attributes':['id',_0x56c2('0x1a'),'password',_0x56c2('0x1b'),'role',_0x56c2('0x1c'),_0x56c2('0x1d'),_0x56c2('0x1e'),_0x56c2('0x1f')],'where':{'name':_0x499557,'role':{'$or':[_0x56c2('0x20'),_0x56c2('0x21'),_0x56c2('0x22')]},'adSsoEnabled':!![]}});})[_0x56c2('0x17')](function(_0x470e6d){if(!_0x470e6d||_0x470e6d&&_0x470e6d['name']!==_0x499557){throw new Error(_0x56c2('0x19'));}_0x14ae4b=_0x470e6d;var _0x4064f3=_0x14ae4b['name']+'@'+config[_0x56c2('0x9')]['domain'];return adAuthenticate(config['activedirectory'],_0x4064f3,_0x2eec30);})[_0x56c2('0x17')](function(_0x246358){if(_0x14ae4b[_0x56c2('0x1c')]){throw new Error(_0x56c2('0x19'));}if(_0xc6df82[_0x56c2('0x16')]>0x0){if(_0x14ae4b[_0x56c2('0x1d')]){if(moment(_0x14ae4b[_0x56c2('0x1e')])[_0x56c2('0x23')](_0xc6df82[_0x56c2('0x16')],_0x56c2('0x24'))>moment()){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return utils[_0x56c2('0x25')](_0x14ae4b,0x0,![],null)[_0x56c2('0x17')](function(){return utils['getLicense'](_0x14ae4b);})[_0x56c2('0x17')](function(){return _0x3430fe(null,_0x14ae4b);});}else{return utils[_0x56c2('0x26')](_0x14ae4b)[_0x56c2('0x17')](function(){return _0x3430fe(null,_0x14ae4b);});}}else{return utils[_0x56c2('0x26')](_0x14ae4b)['then'](function(){return _0x3430fe(null,_0x14ae4b);});}})[_0x56c2('0x27')](function(_0x20ee11){return _0x3430fe(null,![],_0x20ee11);});}function handleError(_0x5e5826,_0xe59a86,_0x164c48){return _0x5e5826[_0x56c2('0x28')](_0xe59a86||0x1f4)[_0x56c2('0x29')]({'message':_0x164c48?_0x164c48[_0x56c2('0x2a')]||_0x164c48:''});}exports[_0x56c2('0x2b')]=function(_0x26fe6a,_0x50b59c,_0x183e09){passport['authenticate']('ad-login',function(_0x2229e1,_0x55edc9,_0x2135c1){var _0x1126cf=_0x2229e1||_0x2135c1;if(_0x1126cf){return handleError(_0x50b59c,0x191,_0x1126cf);}if(!_0x55edc9){return handleError(_0x50b59c,0x194,{'message':_0x56c2('0x2c')});}else{var _0x51eb09={'payload':{'id':_0x55edc9['id'],'role':_0x55edc9[_0x56c2('0x2d')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x51eb09)[_0x56c2('0x17')](function(_0x1a3a5e){_0x50b59c[_0x56c2('0x2e')]({'id':_0x55edc9['id'],'token':_0x1a3a5e,'statusCall':'','isAlreadyLogged':_0x55edc9['online']});});}})(_0x26fe6a,_0x50b59c,_0x183e09);};passport[_0x56c2('0x2f')]('ad-login',new LocalStrategy({'usernameField':_0x56c2('0x1a'),'passwordField':_0x56c2('0x30')},function(_0x661d39,_0x3cb47c,_0x4364b4){return ActiveDirectoryAuthenticate(db['User'],_0x661d39,_0x3cb47c,_0x4364b4);})); \ No newline at end of file +var _0xffbd=['api','undefined','activedirectory','baseDN','url','domain','authenticate','error','Error\x20authenticate\x20%s:\x20%s','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','adSsoEnabled','blockDuration','name','password','salt','role','blocked','online','admin','user','then','disabled','blockedAt','add','minutes','clearBlockUser','getLicense','catch','status','send','message','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','use','passport-local','Strategy','moment','activedirectory2','util','../../mysqldb','../../config/environment','../../config/logger'];(function(_0x21badd,_0x4362cb){var _0x5850aa=function(_0x146d41){while(--_0x146d41){_0x21badd['push'](_0x21badd['shift']());}};_0x5850aa(++_0x4362cb);}(_0xffbd,0x170));var _0xdffb=function(_0x2e4a0f,_0x3a9bb6){_0x2e4a0f=_0x2e4a0f-0x0;var _0x25a3cd=_0xffbd[_0x2e4a0f];return _0x25a3cd;};'use strict';var passport=require('passport');var LocalStrategy=require(_0xdffb('0x0'))[_0xdffb('0x1')];var moment=require(_0xdffb('0x2'));var ActiveDirectory=require(_0xdffb('0x3'));var BPromise=require('bluebird');var util=require(_0xdffb('0x4'));var db=require(_0xdffb('0x5'))['db'];var authService=require('../../components/auth/service');var utils=require('../../config/utils');var config=require(_0xdffb('0x6'));var logger=require(_0xdffb('0x7'))(_0xdffb('0x8'));function isActiveDirectoryConfigured(_0x305f3e){var _0x3b6dd4=![];if(typeof _0x305f3e['activedirectory']!==_0xdffb('0x9')){_0x3b6dd4=_0x305f3e[_0xdffb('0xa')][_0xdffb('0xb')]&&_0x305f3e[_0xdffb('0xa')][_0xdffb('0xc')]&&_0x305f3e[_0xdffb('0xa')][_0xdffb('0xd')];}return _0x3b6dd4;}function adAuthenticate(_0x3d1d98,_0x577331,_0x4bded3){return new BPromise(function(_0x56b869,_0x496ea8){try{var _0x4f09bc=new ActiveDirectory(_0x3d1d98);_0x4f09bc[_0xdffb('0xe')](_0x577331,_0x4bded3,function(_0x31b05f,_0x57e843){if(_0x31b05f){logger[_0xdffb('0xf')](_0xdffb('0x10'),_0x577331,util[_0xdffb('0x11')](_0x31b05f,{'showHidden':![],'depth':null}));_0x496ea8(_0xdffb('0x12'));}else if(!_0x57e843){logger[_0xdffb('0xf')](_0xdffb('0x13'),_0x577331);_0x496ea8('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x56b869(_0x57e843);}});}catch(_0x744a61){_0x496ea8(_0x744a61);}});}function ActiveDirectoryAuthenticate(_0x1d9c12,_0x479900,_0x8456cb,_0x2e2d64){var _0x278b5e,_0x84bc0a;if(!isActiveDirectoryConfigured(config)){logger[_0xdffb('0xf')](_0xdffb('0x14'),_0x479900);return _0x2e2d64(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}return db['Setting']['findOne']({'where':{'id':0x1},'attributes':[_0xdffb('0x15'),_0xdffb('0x16')],'raw':!![]})['then'](function(_0x3c1b56){_0x278b5e=_0x3c1b56;if(!_0x278b5e[_0xdffb('0x15')]){logger[_0xdffb('0xf')]('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled',_0x479900);throw new Error(_0xdffb('0x12'));}return _0x1d9c12['findOne']({'attributes':['id',_0xdffb('0x17'),_0xdffb('0x18'),_0xdffb('0x19'),_0xdffb('0x1a'),'disabled',_0xdffb('0x1b'),'blockedAt',_0xdffb('0x1c')],'where':{'name':_0x479900,'role':{'$or':[_0xdffb('0x1d'),_0xdffb('0x1e'),'agent']},'adSsoEnabled':!![]}});})[_0xdffb('0x1f')](function(_0x368bb7){if(!_0x368bb7||_0x368bb7&&_0x368bb7[_0xdffb('0x17')]!==_0x479900){throw new Error(_0xdffb('0x12'));}_0x84bc0a=_0x368bb7;var _0x480c9c=_0x84bc0a[_0xdffb('0x17')]+'@'+config[_0xdffb('0xa')][_0xdffb('0xd')];return adAuthenticate(config[_0xdffb('0xa')],_0x480c9c,_0x8456cb);})[_0xdffb('0x1f')](function(_0x3517fe){if(_0x84bc0a[_0xdffb('0x20')]){throw new Error(_0xdffb('0x12'));}if(_0x278b5e[_0xdffb('0x16')]>0x0){if(_0x84bc0a[_0xdffb('0x1b')]){if(moment(_0x84bc0a[_0xdffb('0x21')])[_0xdffb('0x22')](_0x278b5e[_0xdffb('0x16')],_0xdffb('0x23'))>moment()){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return utils[_0xdffb('0x24')](_0x84bc0a,0x0,![],null)[_0xdffb('0x1f')](function(){return utils[_0xdffb('0x25')](_0x84bc0a);})[_0xdffb('0x1f')](function(){return _0x2e2d64(null,_0x84bc0a);});}else{return utils['getLicense'](_0x84bc0a)[_0xdffb('0x1f')](function(){return _0x2e2d64(null,_0x84bc0a);});}}else{return utils['getLicense'](_0x84bc0a)['then'](function(){return _0x2e2d64(null,_0x84bc0a);});}})[_0xdffb('0x26')](function(_0x46742b){return _0x2e2d64(null,![],_0x46742b);});}function handleError(_0x56f35c,_0x493bbe,_0x3c1166){return _0x56f35c[_0xdffb('0x27')](_0x493bbe||0x1f4)[_0xdffb('0x28')]({'message':_0x3c1166?_0x3c1166[_0xdffb('0x29')]||_0x3c1166:''});}exports['login']=function(_0x3636e6,_0x5b92ec,_0x5946dd){passport[_0xdffb('0xe')](_0xdffb('0x2a'),function(_0x5649fa,_0x1a0226,_0x57a0cb){var _0x5558cc=_0x5649fa||_0x57a0cb;if(_0x5558cc){return handleError(_0x5b92ec,0x191,_0x5558cc);}if(!_0x1a0226){return handleError(_0x5b92ec,0x194,{'message':_0xdffb('0x2b')});}else{var _0x10ad55={'payload':{'id':_0x1a0226['id'],'role':_0x1a0226[_0xdffb('0x1a')]},'options':{'expiresIn':0x15180}};return authService[_0xdffb('0x2c')](_0x10ad55)['then'](function(_0x2d598e){_0x5b92ec[_0xdffb('0x2d')]({'id':_0x1a0226['id'],'token':_0x2d598e,'statusCall':'','isAlreadyLogged':_0x1a0226[_0xdffb('0x1c')]});});}})(_0x3636e6,_0x5b92ec,_0x5946dd);};passport[_0xdffb('0x2e')](_0xdffb('0x2a'),new LocalStrategy({'usernameField':_0xdffb('0x17'),'passwordField':_0xdffb('0x18')},function(_0x238d25,_0x166a3b,_0x107288){return ActiveDirectoryAuthenticate(db['User'],_0x238d25,_0x166a3b,_0x107288);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index 69ff908..a33e79d 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 _0x2c09=['express','exports'];(function(_0x5c9364,_0x27d6b1){var _0x5f52fa=function(_0x122bc6){while(--_0x122bc6){_0x5c9364['push'](_0x5c9364['shift']());}};_0x5f52fa(++_0x27d6b1);}(_0x2c09,0x188));var _0x92c0=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0x2c09[_0x278e3c];return _0x3e2d9b;};'use strict';var express=require(_0x92c0('0x0'));var router=express['Router']();var controller=require('./authActiveDirectory.controller');router['post']('/',controller['login']);module[_0x92c0('0x1')]=router; \ No newline at end of file +var _0x7e66=['Router','exports','express'];(function(_0x1150d0,_0x24f90e){var _0x48a927=function(_0x502654){while(--_0x502654){_0x1150d0['push'](_0x1150d0['shift']());}};_0x48a927(++_0x24f90e);}(_0x7e66,0xe9));var _0x67e6=function(_0x5dc6b6,_0x4771c5){_0x5dc6b6=_0x5dc6b6-0x0;var _0x4eb7e8=_0x7e66[_0x5dc6b6];return _0x4eb7e8;};'use strict';var express=require(_0x67e6('0x0'));var router=express[_0x67e6('0x1')]();var controller=require('./authActiveDirectory.controller');router['post']('/',controller['login']);module[_0x67e6('0x2')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index c9d4000..22c3509 100644 --- a/server/api/authGoogle/authGoogle.controller.js +++ b/server/api/authGoogle/authGoogle.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../config/utils','login','authenticate','google','/login','email','use','secret','callbackURL','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','value','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x7a54,0x106));var _0x47a5=function(_0x2cade3,_0x57de32){_0x2cade3=_0x2cade3-0x0;var _0x5a4877=_0x7a54[_0x2cade3];return _0x5a4877;};'use strict';var _=require(_0x47a5('0x0'));var passport=require(_0x47a5('0x1'));var GoogleStrategy=require(_0x47a5('0x2'))['Strategy'];var moment=require(_0x47a5('0x3'));var db=require(_0x47a5('0x4'))['db'];var config=require('../../config/environment');var utils=require(_0x47a5('0x5'));exports[_0x47a5('0x6')]=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':_0x47a5('0x9'),'scope':['profile',_0x47a5('0xa')],'session':![]});exports['callback']=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':'/login','session':![]});passport[_0x47a5('0xb')](new GoogleStrategy({'clientID':config['google']?config['google']['clientID']:'id','clientSecret':config[_0x47a5('0x8')]?config[_0x47a5('0x8')]['clientSecret']:_0x47a5('0xc'),'callbackURL':config['google']?config['google'][_0x47a5('0xd')]:''},function(_0x69e4d4,_0x2f399b,_0x250fad,_0xd612dd){var _0xd308b8,_0x1eae59;return db['Setting'][_0x47a5('0xe')]({'where':{'id':0x1},'attributes':[_0x47a5('0xf'),_0x47a5('0x10')],'raw':!![]})[_0x47a5('0x11')](function(_0x139f25){_0xd308b8=_0x139f25;return db[_0x47a5('0x12')][_0x47a5('0x13')]({'where':{'email':_[_0x47a5('0x14')](_0x250fad['emails'],_0x47a5('0x15')),'role':{'$or':[_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18')]}}});})[_0x47a5('0x11')](function(_0x574af6){_0x1eae59=_0x574af6;if(_0x1eae59){if(_0x1eae59['disabled']){return _0xd612dd(_0x47a5('0x19'));}else if(_0xd308b8['blockDuration']>0x0){if(_0x1eae59['blocked']){if(moment(_0x1eae59[_0x47a5('0x1a')])[_0x47a5('0x1b')](_0xd308b8[_0x47a5('0x10')],_0x47a5('0x1c'))>moment()){return _0xd612dd(_0x47a5('0x19'));}else{return utils[_0x47a5('0x1d')](_0x1eae59,0x0,![],null)[_0x47a5('0x11')](function(){return utils[_0x47a5('0x1e')](_0x1eae59);})[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils['getLicense'](_0x1eae59)[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils[_0x47a5('0x1e')](_0x1eae59)['then'](function(){return _0xd612dd(null,_0x1eae59);});}}return _0xd612dd(_0x47a5('0x19'));})[_0x47a5('0x1f')](function(_0x36874d){_0xd612dd(_0x36874d);});})); \ No newline at end of file +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(_0x1780fb,_0xf933a4){var _0x2d1059=function(_0xfc88a0){while(--_0xfc88a0){_0x1780fb['push'](_0x1780fb['shift']());}};_0x2d1059(++_0xf933a4);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x7995('0x0'));var passport=require(_0x7995('0x1'));var GoogleStrategy=require(_0x7995('0x2'))[_0x7995('0x3')];var moment=require('moment');var db=require(_0x7995('0x4'))['db'];var config=require(_0x7995('0x5'));var utils=require(_0x7995('0x6'));exports[_0x7995('0x7')]=passport['authenticate'](_0x7995('0x8'),{'failureRedirect':_0x7995('0x9'),'scope':[_0x7995('0xa'),_0x7995('0xb')],'session':![]});exports[_0x7995('0xc')]=passport[_0x7995('0xd')]('google',{'failureRedirect':_0x7995('0x9'),'session':![]});passport[_0x7995('0xe')](new GoogleStrategy({'clientID':config['google']?config[_0x7995('0x8')][_0x7995('0xf')]:'id','clientSecret':config[_0x7995('0x8')]?config[_0x7995('0x8')][_0x7995('0x10')]:_0x7995('0x11'),'callbackURL':config[_0x7995('0x8')]?config['google'][_0x7995('0x12')]:''},function(_0x41c652,_0x581f22,_0xb0c872,_0x2cb37a){var _0x19a27e,_0x385f00;return db[_0x7995('0x13')][_0x7995('0x14')]({'where':{'id':0x1},'attributes':[_0x7995('0x15'),'blockDuration'],'raw':!![]})['then'](function(_0x2b4e94){_0x19a27e=_0x2b4e94;return db[_0x7995('0x16')][_0x7995('0x17')]({'where':{'email':_[_0x7995('0x18')](_0xb0c872[_0x7995('0x19')],_0x7995('0x1a')),'role':{'$or':[_0x7995('0x1b'),_0x7995('0x1c'),'agent']}}});})[_0x7995('0x1d')](function(_0x565d97){_0x385f00=_0x565d97;if(_0x385f00){if(_0x385f00[_0x7995('0x1e')]){return _0x2cb37a(_0x7995('0x1f'));}else if(_0x19a27e[_0x7995('0x20')]>0x0){if(_0x385f00[_0x7995('0x21')]){if(moment(_0x385f00[_0x7995('0x22')])[_0x7995('0x23')](_0x19a27e['blockDuration'],'minutes')>moment()){return _0x2cb37a(_0x7995('0x1f'));}else{return utils['clearBlockUser'](_0x385f00,0x0,![],null)['then'](function(){return utils[_0x7995('0x24')](_0x385f00);})[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)['then'](function(){return _0x2cb37a(null,_0x385f00);});}}return _0x2cb37a(_0x7995('0x1f'));})[_0x7995('0x25')](function(_0x350fd9){_0x2cb37a(_0x350fd9);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 67a315c..4b4cd7e 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 _0x8c52=['login','/callback','callback','isMiddleware','setTokenCookie','express','Router','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get'];(function(_0x299ffa,_0x4609df){var _0x17fe64=function(_0x41de7c){while(--_0x41de7c){_0x299ffa['push'](_0x299ffa['shift']());}};_0x17fe64(++_0x4609df);}(_0x8c52,0x7e));var _0x28c5=function(_0x5d8778,_0x3c2f0e){_0x5d8778=_0x5d8778-0x0;var _0x133e42=_0x8c52[_0x5d8778];return _0x133e42;};'use strict';var express=require(_0x28c5('0x0'));var passport=require('passport');var router=express[_0x28c5('0x1')]();var controller=require(_0x28c5('0x2'));var userController=require(_0x28c5('0x3'));var authService=require(_0x28c5('0x4'));router[_0x28c5('0x5')]('/',controller[_0x28c5('0x6')]);router[_0x28c5('0x5')](_0x28c5('0x7'),controller[_0x28c5('0x8')],authService[_0x28c5('0x9')],userController[_0x28c5('0x6')],authService[_0x28c5('0xa')]);module['exports']=router; \ No newline at end of file +var _0x45c9=['passport','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get','login','/callback','isMiddleware','setTokenCookie','exports'];(function(_0x1ecf17,_0x2724d4){var _0x485a9e=function(_0x18773e){while(--_0x18773e){_0x1ecf17['push'](_0x1ecf17['shift']());}};_0x485a9e(++_0x2724d4);}(_0x45c9,0x96));var _0x945c=function(_0x93ab9b,_0x3e80ef){_0x93ab9b=_0x93ab9b-0x0;var _0x4e6b76=_0x45c9[_0x93ab9b];return _0x4e6b76;};'use strict';var express=require('express');var passport=require(_0x945c('0x0'));var router=express['Router']();var controller=require(_0x945c('0x1'));var userController=require(_0x945c('0x2'));var authService=require(_0x945c('0x3'));router[_0x945c('0x4')]('/',controller[_0x945c('0x5')]);router['get'](_0x945c('0x6'),controller['callback'],authService[_0x945c('0x7')],userController[_0x945c('0x5')],authService[_0x945c('0x8')]);module[_0x945c('0x9')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 0d8e840..70089d3 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 _0xf5a2=['error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','status','send','login','local-login','signToken','online','forgot','body','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','host','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','catch','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','password','previousPasswords','validatePasswordHistory','Password\x20reset!','use','util','passport','Strategy','jayson/promise','../../components/auth/service','../../config/utils','client','http','Setting','findOne','allowedLoginAttempts','then','salt','role','disabled','blockedAt','loginAttempts','admin','user','agent','name','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','add','blockDuration','clearBlockUser','minutes','getLicense','blocked','MailAccount','find','email','MailServerOut','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','merge','format','\x22%s\x22\x20<%s>','Smtp','request'];(function(_0xf73dcd,_0x15c363){var _0x44c1e2=function(_0x5f1996){while(--_0x5f1996){_0xf73dcd['push'](_0xf73dcd['shift']());}};_0x44c1e2(++_0x15c363);}(_0xf5a2,0x185));var _0x2f5a=function(_0x480c57,_0x5bba33){_0x480c57=_0x480c57-0x0;var _0x1109b7=_0xf5a2[_0x480c57];return _0x1109b7;};'use strict';var util=require(_0x2f5a('0x0'));var passport=require(_0x2f5a('0x1'));var LocalStrategy=require('passport-local')[_0x2f5a('0x2')];var jayson=require(_0x2f5a('0x3'));var _=require('lodash');var rs=require('randomstring');var moment=require('moment');var db=require('../../mysqldb')['db'];var authService=require(_0x2f5a('0x4'));var utils=require(_0x2f5a('0x5'));var client=jayson[_0x2f5a('0x6')][_0x2f5a('0x7')]({'port':0x232b});function localAuthenticate(_0x5ee553,_0x2cd5f2,_0xbb0bec,_0x1186a6){var _0x4adae1,_0x112fb9;return db[_0x2f5a('0x8')][_0x2f5a('0x9')]({'where':{'id':0x1},'attributes':[_0x2f5a('0xa'),'blockDuration'],'raw':!![]})[_0x2f5a('0xb')](function(_0x173089){_0x4adae1=_0x173089;return _0x5ee553['findOne']({'attributes':['id','name','password',_0x2f5a('0xc'),_0x2f5a('0xd'),_0x2f5a('0xe'),'blocked',_0x2f5a('0xf'),_0x2f5a('0x10')],'where':{'name':_0x2cd5f2,'role':{'$or':[_0x2f5a('0x11'),_0x2f5a('0x12'),_0x2f5a('0x13')]}}});})['then'](function(_0x2d4e15){if(!_0x2d4e15||_0x2d4e15&&_0x2d4e15[_0x2f5a('0x14')]!==_0x2cd5f2){throw new Error(_0x2f5a('0x15'));}else{_0x112fb9=_0x2d4e15;return _0x112fb9;}})[_0x2f5a('0xb')](function(){_0x112fb9[_0x2f5a('0x16')](_0xbb0bec,function(_0x5ca12f,_0x5cbe8b){var _0x3cdc3a=_0x112fb9[_0x2f5a('0x10')]+0x1;if(_0x5ca12f){return _0x1186a6(_0x5ca12f);}else if(!_0x5cbe8b){if(_0x112fb9['disabled']){return _0x1186a6(null,![],{'message':_0x2f5a('0x15')});}else if(_0x4adae1['allowedLoginAttempts']>0x0){if(_0x112fb9['blocked']){if(_0x4adae1['blockDuration']>0x0){if(moment(_0x112fb9[_0x2f5a('0xf')])[_0x2f5a('0x17')](_0x4adae1[_0x2f5a('0x18')],'minutes')>moment()){return _0x1186a6(null,![],{'message':_0x2f5a('0x15')});}else{return utils['clearBlockUser'](_0x112fb9,_0x3cdc3a,![],null)[_0x2f5a('0xb')](function(){return _0x1186a6(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x1186a6(null,![],{'message':_0x2f5a('0x15')});}}else{if(_0x3cdc3a>=_0x4adae1['allowedLoginAttempts']){return utils[_0x2f5a('0x19')](_0x112fb9,0x0,!![],moment())[_0x2f5a('0xb')](function(){return _0x1186a6(null,![],{'message':_0x2f5a('0x15')});});}else{return utils['clearBlockUser'](_0x112fb9,_0x3cdc3a,![],null)[_0x2f5a('0xb')](function(){return _0x1186a6(null,![],{'message':_0x2f5a('0x15')});});}}}else{return _0x1186a6(null,![],{'message':_0x2f5a('0x15')});}}else{if(_0x112fb9['disabled']){return _0x1186a6(null,![],{'message':_0x2f5a('0x15')});}else if(_0x4adae1[_0x2f5a('0xa')]>0x0){if(_0x112fb9['blocked']){if(_0x4adae1[_0x2f5a('0x18')]>0x0){if(moment(_0x112fb9[_0x2f5a('0xf')])['add'](_0x4adae1[_0x2f5a('0x18')],_0x2f5a('0x1a'))>moment()){return _0x1186a6(null,![],{'message':_0x2f5a('0x15')});}else{return utils['clearBlockUser'](_0x112fb9,0x0,![],null)[_0x2f5a('0xb')](function(){return utils[_0x2f5a('0x1b')](_0x112fb9);})[_0x2f5a('0xb')](function(){return _0x1186a6(null,_0x112fb9);});}}else{return _0x1186a6(null,![],{'message':_0x2f5a('0x15')});}}else{return utils['clearBlockUser'](_0x112fb9,0x0,![],null)[_0x2f5a('0xb')](function(){return utils['getLicense'](_0x112fb9);})[_0x2f5a('0xb')](function(){return _0x1186a6(null,_0x112fb9);})['catch'](function(_0x4470f4){return _0x1186a6(null,![],_0x4470f4);});}}else{if(_0x112fb9[_0x2f5a('0x1c')]){return _0x1186a6(null,![],{'message':_0x2f5a('0x15')});}else{return utils['getLicense'](_0x112fb9)['then'](function(){return _0x1186a6(null,_0x112fb9);});}}}});})['catch'](function(_0x416c24){return _0x1186a6(null,![],_0x416c24);});}function sendServiceMail(_0x3f5900){return db[_0x2f5a('0x1d')][_0x2f5a('0x1e')]({'where':{'service':!![]},'attributes':['id',_0x2f5a('0x14'),_0x2f5a('0x1f')],'include':[{'model':db[_0x2f5a('0x20')],'as':'Smtp','include':[{'model':db[_0x2f5a('0x21')],'as':_0x2f5a('0x21')}]}]})[_0x2f5a('0xb')](function(_0x502342){if(!_0x502342){throw new Error(_0x2f5a('0x22'));}var _0xd082c=_0x502342[_0x2f5a('0x23')]();var _0x597904={'account':_0xd082c,'message':_[_0x2f5a('0x24')]({'from':util[_0x2f5a('0x25')](_0x2f5a('0x26'),_0x502342[_0x2f5a('0x14')],_0x502342[_0x2f5a('0x1f')]||_0x502342[_0x2f5a('0x27')][_0x2f5a('0x12')])},_0x3f5900)};return client[_0x2f5a('0x28')]('SendMail',_0x597904);})['then'](function(_0x6f51f9){if(_0x6f51f9[_0x2f5a('0x29')]){throw new Error(util[_0x2f5a('0x25')](_0x2f5a('0x2a'),_0x6f51f9[_0x2f5a('0x29')][_0x2f5a('0x2b')]||JSON['stringify'](_0x6f51f9['error'])));}return!![];});}function handleError(_0x454afd,_0x1a1446,_0x5ec2e7){return _0x454afd[_0x2f5a('0x2c')](_0x1a1446||0x1f4)[_0x2f5a('0x2d')]({'message':_0x5ec2e7?_0x5ec2e7['message']||_0x5ec2e7:''});}exports[_0x2f5a('0x2e')]=function(_0x453127,_0x3a057b,_0x1cff3b){passport[_0x2f5a('0x16')](_0x2f5a('0x2f'),function(_0xdafc3a,_0x2958d4,_0x5f2410){var _0x32640c=_0xdafc3a||_0x5f2410;if(_0x32640c){return handleError(_0x3a057b,0x191,_0x32640c);}if(!_0x2958d4){return handleError(_0x3a057b,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x55b2d4={'payload':{'id':_0x2958d4['id'],'role':_0x2958d4[_0x2f5a('0xd')]},'options':{'expiresIn':0x15180}};return authService[_0x2f5a('0x30')](_0x55b2d4)[_0x2f5a('0xb')](function(_0x593144){_0x3a057b['json']({'id':_0x2958d4['id'],'token':_0x593144,'statusCall':'','isAlreadyLogged':_0x2958d4[_0x2f5a('0x31')]});});}})(_0x453127,_0x3a057b,_0x1cff3b);};exports[_0x2f5a('0x32')]=function(_0xe517df,_0x1f57bc){if(!_0xe517df[_0x2f5a('0x33')]['email']){return handleError(_0x1f57bc,0x1f4,{'message':_0x2f5a('0x34')});}var _0x32e11d=rs[_0x2f5a('0x35')]();_0xe517df[_0x2f5a('0x33')][_0x2f5a('0x1f')]=_0xe517df[_0x2f5a('0x33')][_0x2f5a('0x1f')][_0x2f5a('0x36')]()[_0x2f5a('0x37')]();var _0x51b6d5;return db['Setting'][_0x2f5a('0x9')]({'where':{'id':0x1},'attributes':[_0x2f5a('0xa'),'blockDuration'],'raw':!![]})['then'](function(_0x339708){_0x51b6d5=_0x339708;return db[_0x2f5a('0x38')][_0x2f5a('0x1e')]({'where':{'email':_0xe517df['body']['email']}});})[_0x2f5a('0xb')](function(_0x5ea25f){if(!_0x5ea25f){throw new Error(_0x2f5a('0x39'));}if(_0x5ea25f[_0x2f5a('0xe')]){throw new Error(_0x2f5a('0x3a'));}if(_0x5ea25f[_0x2f5a('0x1c')]){if(moment(_0x5ea25f[_0x2f5a('0xf')])[_0x2f5a('0x17')](_0x51b6d5['blockDuration'],_0x2f5a('0x1a'))>moment()){throw new Error(_0x2f5a('0x3b'));}else{_0x5ea25f[_0x2f5a('0x1c')]=![];_0x5ea25f[_0x2f5a('0xf')]=null;}}_0x5ea25f[_0x2f5a('0x3c')]=_0x32e11d;_0x5ea25f[_0x2f5a('0x3d')]=Date[_0x2f5a('0x3e')]()+0x36ee80;return _0x5ea25f[_0x2f5a('0x3f')]();})[_0x2f5a('0xb')](function(){return sendServiceMail({'to':_0xe517df[_0x2f5a('0x33')][_0x2f5a('0x1f')],'subject':_0x2f5a('0x40'),'text':_0x2f5a('0x41')+_0x2f5a('0x42')+_0x2f5a('0x43')+_0xe517df[_0x2f5a('0x44')][_0x2f5a('0x45')]+_0x2f5a('0x46')+_0x32e11d+'\x0a\x0a'+_0x2f5a('0x47')});})[_0x2f5a('0xb')](function(){_0x1f57bc[_0x2f5a('0x2c')](0xc8)[_0x2f5a('0x2d')]({'message':_0x2f5a('0x48')});})[_0x2f5a('0x49')](function(_0x496a17){return handleError(_0x1f57bc,0x1f4,_0x496a17);});};exports['reset']=function(_0x222707,_0x4cbb84){return db['User']['find']({'where':{'resetPasswordToken':_0x222707[_0x2f5a('0x4a')][_0x2f5a('0x4b')],'resetPasswordExpires':{'$gt':Date[_0x2f5a('0x3e')]()}}})[_0x2f5a('0xb')](function(_0x2cd422){if(!_0x2cd422){throw new Error(_0x2f5a('0x4c'));}return db['Setting'][_0x2f5a('0x9')]({'attributes':['id',_0x2f5a('0x4d'),_0x2f5a('0x4e'),_0x2f5a('0x4f')]})[_0x2f5a('0xb')](function(_0x16127c){if(_0x16127c[_0x2f5a('0x4d')])authService[_0x2f5a('0x50')](_0x222707[_0x2f5a('0x33')][_0x2f5a('0x51')]);if(!_0x16127c[_0x2f5a('0x4e')]||!_0x2cd422[_0x2f5a('0x52')])return _0x2cd422;authService[_0x2f5a('0x53')](_0x222707['body'][_0x2f5a('0x51')],_0x2cd422['previousPasswords'],_0x16127c['passwordHistoryLimit']);return _0x2cd422;})[_0x2f5a('0xb')](function(){_0x2cd422[_0x2f5a('0x51')]=_0x222707['body']['password'];_0x2cd422['resetPasswordToken']=null;_0x2cd422[_0x2f5a('0x3d')]=null;return _0x2cd422[_0x2f5a('0x3f')]();});})[_0x2f5a('0xb')](function(){_0x4cbb84[_0x2f5a('0x2c')](0xc8)['send']({'message':_0x2f5a('0x54')});})[_0x2f5a('0x49')](function(_0x3ed5e0){return handleError(_0x4cbb84,0x1f4,_0x3ed5e0);});};passport[_0x2f5a('0x55')]('local-login',new LocalStrategy({'usernameField':_0x2f5a('0x14'),'passwordField':'password'},function(_0x410a1e,_0x19985f,_0x4f7d77){return localAuthenticate(db[_0x2f5a('0x38')],_0x410a1e,_0x19985f,_0x4f7d77);})); \ No newline at end of file +var _0x83bb=['message','send','login','authenticate','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','online','forgot','body','Email\x20parameter\x20is\x20missing','email','trim','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','host','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','status','Reset\x20Email\x20sent!','reset','now','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','previousPasswords','validatePasswordHistory','resetPasswordToken','use','local-login','util','passport','passport-local','Strategy','lodash','randomstring','../../mysqldb','client','http','Setting','findOne','then','name','password','salt','role','disabled','blocked','blockedAt','loginAttempts','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','allowedLoginAttempts','blockDuration','add','clearBlockUser','minutes','getLicense','catch','find','MailServerOut','CloudProvider','getSmtpOptions','format','Smtp','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!'];(function(_0x3e8741,_0x40b2ad){var _0x8b0d66=function(_0x2c25ff){while(--_0x2c25ff){_0x3e8741['push'](_0x3e8741['shift']());}};_0x8b0d66(++_0x40b2ad);}(_0x83bb,0x1b7));var _0xb83b=function(_0xb05ed,_0x38964c){_0xb05ed=_0xb05ed-0x0;var _0x4ce84f=_0x83bb[_0xb05ed];return _0x4ce84f;};'use strict';var util=require(_0xb83b('0x0'));var passport=require(_0xb83b('0x1'));var LocalStrategy=require(_0xb83b('0x2'))[_0xb83b('0x3')];var jayson=require('jayson/promise');var _=require(_0xb83b('0x4'));var rs=require(_0xb83b('0x5'));var moment=require('moment');var db=require(_0xb83b('0x6'))['db'];var authService=require('../../components/auth/service');var utils=require('../../config/utils');var client=jayson[_0xb83b('0x7')][_0xb83b('0x8')]({'port':0x232b});function localAuthenticate(_0x292adb,_0x5c6dc9,_0x272d74,_0x1bb235){var _0x3ad566,_0x28049f;return db[_0xb83b('0x9')][_0xb83b('0xa')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts','blockDuration'],'raw':!![]})[_0xb83b('0xb')](function(_0x48ec89){_0x3ad566=_0x48ec89;return _0x292adb['findOne']({'attributes':['id',_0xb83b('0xc'),_0xb83b('0xd'),_0xb83b('0xe'),_0xb83b('0xf'),_0xb83b('0x10'),_0xb83b('0x11'),_0xb83b('0x12'),_0xb83b('0x13')],'where':{'name':_0x5c6dc9,'role':{'$or':[_0xb83b('0x14'),_0xb83b('0x15'),_0xb83b('0x16')]}}});})[_0xb83b('0xb')](function(_0x1d0912){if(!_0x1d0912||_0x1d0912&&_0x1d0912[_0xb83b('0xc')]!==_0x5c6dc9){throw new Error(_0xb83b('0x17'));}else{_0x28049f=_0x1d0912;return _0x28049f;}})[_0xb83b('0xb')](function(){_0x28049f['authenticate'](_0x272d74,function(_0x510f88,_0x6147ff){var _0x4704a4=_0x28049f[_0xb83b('0x13')]+0x1;if(_0x510f88){return _0x1bb235(_0x510f88);}else if(!_0x6147ff){if(_0x28049f[_0xb83b('0x10')]){return _0x1bb235(null,![],{'message':_0xb83b('0x17')});}else if(_0x3ad566[_0xb83b('0x18')]>0x0){if(_0x28049f[_0xb83b('0x11')]){if(_0x3ad566[_0xb83b('0x19')]>0x0){if(moment(_0x28049f[_0xb83b('0x12')])[_0xb83b('0x1a')](_0x3ad566[_0xb83b('0x19')],'minutes')>moment()){return _0x1bb235(null,![],{'message':_0xb83b('0x17')});}else{return utils[_0xb83b('0x1b')](_0x28049f,_0x4704a4,![],null)[_0xb83b('0xb')](function(){return _0x1bb235(null,![],{'message':_0xb83b('0x17')});});}}else{return _0x1bb235(null,![],{'message':_0xb83b('0x17')});}}else{if(_0x4704a4>=_0x3ad566[_0xb83b('0x18')]){return utils[_0xb83b('0x1b')](_0x28049f,0x0,!![],moment())[_0xb83b('0xb')](function(){return _0x1bb235(null,![],{'message':_0xb83b('0x17')});});}else{return utils[_0xb83b('0x1b')](_0x28049f,_0x4704a4,![],null)[_0xb83b('0xb')](function(){return _0x1bb235(null,![],{'message':_0xb83b('0x17')});});}}}else{return _0x1bb235(null,![],{'message':_0xb83b('0x17')});}}else{if(_0x28049f[_0xb83b('0x10')]){return _0x1bb235(null,![],{'message':_0xb83b('0x17')});}else if(_0x3ad566[_0xb83b('0x18')]>0x0){if(_0x28049f['blocked']){if(_0x3ad566[_0xb83b('0x19')]>0x0){if(moment(_0x28049f[_0xb83b('0x12')])['add'](_0x3ad566[_0xb83b('0x19')],_0xb83b('0x1c'))>moment()){return _0x1bb235(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0xb83b('0x1b')](_0x28049f,0x0,![],null)[_0xb83b('0xb')](function(){return utils['getLicense'](_0x28049f);})[_0xb83b('0xb')](function(){return _0x1bb235(null,_0x28049f);});}}else{return _0x1bb235(null,![],{'message':_0xb83b('0x17')});}}else{return utils[_0xb83b('0x1b')](_0x28049f,0x0,![],null)['then'](function(){return utils[_0xb83b('0x1d')](_0x28049f);})[_0xb83b('0xb')](function(){return _0x1bb235(null,_0x28049f);})[_0xb83b('0x1e')](function(_0x2b508b){return _0x1bb235(null,![],_0x2b508b);});}}else{if(_0x28049f[_0xb83b('0x11')]){return _0x1bb235(null,![],{'message':_0xb83b('0x17')});}else{return utils[_0xb83b('0x1d')](_0x28049f)[_0xb83b('0xb')](function(){return _0x1bb235(null,_0x28049f);});}}}});})[_0xb83b('0x1e')](function(_0x491b47){return _0x1bb235(null,![],_0x491b47);});}function sendServiceMail(_0x595d32){return db['MailAccount'][_0xb83b('0x1f')]({'where':{'service':!![]},'attributes':['id','name','email'],'include':[{'model':db[_0xb83b('0x20')],'as':'Smtp','include':[{'model':db[_0xb83b('0x21')],'as':_0xb83b('0x21')}]}]})[_0xb83b('0xb')](function(_0x5805e3){if(!_0x5805e3){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0xf67228=_0x5805e3[_0xb83b('0x22')]();var _0x3c393a={'account':_0xf67228,'message':_['merge']({'from':util[_0xb83b('0x23')]('\x22%s\x22\x20<%s>',_0x5805e3[_0xb83b('0xc')],_0x5805e3['email']||_0x5805e3[_0xb83b('0x24')]['user'])},_0x595d32)};return client[_0xb83b('0x25')](_0xb83b('0x26'),_0x3c393a);})[_0xb83b('0xb')](function(_0x13939d){if(_0x13939d[_0xb83b('0x27')]){throw new Error(util[_0xb83b('0x23')](_0xb83b('0x28'),_0x13939d['error'][_0xb83b('0x29')]||JSON['stringify'](_0x13939d[_0xb83b('0x27')])));}return!![];});}function handleError(_0x5cffc4,_0xdc32fe,_0x992ef6){return _0x5cffc4['status'](_0xdc32fe||0x1f4)[_0xb83b('0x2a')]({'message':_0x992ef6?_0x992ef6['message']||_0x992ef6:''});}exports[_0xb83b('0x2b')]=function(_0x3a568a,_0x41b7bd,_0x46f6df){passport[_0xb83b('0x2c')]('local-login',function(_0x5831cc,_0x167ec2,_0x1b7aac){var _0x2ffd48=_0x5831cc||_0x1b7aac;if(_0x2ffd48){return handleError(_0x41b7bd,0x191,_0x2ffd48);}if(!_0x167ec2){return handleError(_0x41b7bd,0x194,{'message':_0xb83b('0x2d')});}else{var _0x1adb0b={'payload':{'id':_0x167ec2['id'],'role':_0x167ec2['role']},'options':{'expiresIn':0x15180}};return authService[_0xb83b('0x2e')](_0x1adb0b)[_0xb83b('0xb')](function(_0x3a6c3b){_0x41b7bd['json']({'id':_0x167ec2['id'],'token':_0x3a6c3b,'statusCall':'','isAlreadyLogged':_0x167ec2[_0xb83b('0x2f')]});});}})(_0x3a568a,_0x41b7bd,_0x46f6df);};exports[_0xb83b('0x30')]=function(_0x248d39,_0x555546){if(!_0x248d39[_0xb83b('0x31')]['email']){return handleError(_0x555546,0x1f4,{'message':_0xb83b('0x32')});}var _0x42552a=rs['generate']();_0x248d39[_0xb83b('0x31')]['email']=_0x248d39['body'][_0xb83b('0x33')][_0xb83b('0x34')]()[_0xb83b('0x35')]();var _0x307e63;return db['Setting']['findOne']({'where':{'id':0x1},'attributes':[_0xb83b('0x18'),_0xb83b('0x19')],'raw':!![]})['then'](function(_0x5c0ac9){_0x307e63=_0x5c0ac9;return db[_0xb83b('0x36')]['find']({'where':{'email':_0x248d39['body'][_0xb83b('0x33')]}});})['then'](function(_0x5c0e6d){if(!_0x5c0e6d){throw new Error(_0xb83b('0x37'));}if(_0x5c0e6d['disabled']){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0x5c0e6d['blocked']){if(moment(_0x5c0e6d['blockedAt'])['add'](_0x307e63['blockDuration'],_0xb83b('0x1c'))>moment()){throw new Error(_0xb83b('0x38'));}else{_0x5c0e6d[_0xb83b('0x11')]=![];_0x5c0e6d[_0xb83b('0x12')]=null;}}_0x5c0e6d['resetPasswordToken']=_0x42552a;_0x5c0e6d['resetPasswordExpires']=Date['now']()+0x36ee80;return _0x5c0e6d[_0xb83b('0x39')]();})[_0xb83b('0xb')](function(){return sendServiceMail({'to':_0x248d39[_0xb83b('0x31')][_0xb83b('0x33')],'subject':_0xb83b('0x3a'),'text':_0xb83b('0x3b')+_0xb83b('0x3c')+_0xb83b('0x3d')+_0x248d39[_0xb83b('0x3e')][_0xb83b('0x3f')]+_0xb83b('0x40')+_0x42552a+'\x0a\x0a'+_0xb83b('0x41')});})['then'](function(){_0x555546[_0xb83b('0x42')](0xc8)['send']({'message':_0xb83b('0x43')});})[_0xb83b('0x1e')](function(_0x4a3be9){return handleError(_0x555546,0x1f4,_0x4a3be9);});};exports[_0xb83b('0x44')]=function(_0x16ba19,_0x58ead1){return db['User'][_0xb83b('0x1f')]({'where':{'resetPasswordToken':_0x16ba19['params']['token'],'resetPasswordExpires':{'$gt':Date[_0xb83b('0x45')]()}}})[_0xb83b('0xb')](function(_0x207e95){if(!_0x207e95){throw new Error(_0xb83b('0x46'));}return db[_0xb83b('0x9')][_0xb83b('0xa')]({'attributes':['id',_0xb83b('0x47'),_0xb83b('0x48'),_0xb83b('0x49')]})[_0xb83b('0xb')](function(_0x128326){if(_0x128326['securePassword'])authService[_0xb83b('0x4a')](_0x16ba19[_0xb83b('0x31')][_0xb83b('0xd')]);if(!_0x128326[_0xb83b('0x48')]||!_0x207e95[_0xb83b('0x4b')])return _0x207e95;authService[_0xb83b('0x4c')](_0x16ba19['body'][_0xb83b('0xd')],_0x207e95[_0xb83b('0x4b')],_0x128326['passwordHistoryLimit']);return _0x207e95;})[_0xb83b('0xb')](function(){_0x207e95[_0xb83b('0xd')]=_0x16ba19[_0xb83b('0x31')][_0xb83b('0xd')];_0x207e95[_0xb83b('0x4d')]=null;_0x207e95['resetPasswordExpires']=null;return _0x207e95[_0xb83b('0x39')]();});})[_0xb83b('0xb')](function(){_0x58ead1[_0xb83b('0x42')](0xc8)[_0xb83b('0x2a')]({'message':'Password\x20reset!'});})[_0xb83b('0x1e')](function(_0x387635){return handleError(_0x58ead1,0x1f4,_0x387635);});};passport[_0xb83b('0x4e')](_0xb83b('0x4f'),new LocalStrategy({'usernameField':_0xb83b('0xc'),'passwordField':_0xb83b('0xd')},function(_0x2a8ee1,_0x2230dc,_0x8ae610){return localAuthenticate(db['User'],_0x2a8ee1,_0x2230dc,_0x8ae610);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 7cc5328..9185a9e 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 _0xe73e=['forgot','/reset/:token','exports','Router','./authLocal.controller','login','post','/forgot'];(function(_0x2a8443,_0x43f6a8){var _0x1ccfac=function(_0x3a533c){while(--_0x3a533c){_0x2a8443['push'](_0x2a8443['shift']());}};_0x1ccfac(++_0x43f6a8);}(_0xe73e,0x1f3));var _0xee73=function(_0x5ae190,_0x104c8a){_0x5ae190=_0x5ae190-0x0;var _0x42d1c5=_0xe73e[_0x5ae190];return _0x42d1c5;};'use strict';var express=require('express');var router=express[_0xee73('0x0')]();var controller=require(_0xee73('0x1'));router['post']('/',controller[_0xee73('0x2')]);router[_0xee73('0x3')](_0xee73('0x4'),controller[_0xee73('0x5')]);router['post'](_0xee73('0x6'),controller['reset']);module[_0xee73('0x7')]=router; \ No newline at end of file +var _0x602b=['/reset/:token','reset','exports','Router','post','/forgot','forgot'];(function(_0x5a27fe,_0x43993b){var _0x121c88=function(_0x2aff1f){while(--_0x2aff1f){_0x5a27fe['push'](_0x5a27fe['shift']());}};_0x121c88(++_0x43993b);}(_0x602b,0x14c));var _0xb602=function(_0x4d3770,_0x1adea9){_0x4d3770=_0x4d3770-0x0;var _0x443579=_0x602b[_0x4d3770];return _0x443579;};'use strict';var express=require('express');var router=express[_0xb602('0x0')]();var controller=require('./authLocal.controller');router['post']('/',controller['login']);router[_0xb602('0x1')](_0xb602('0x2'),controller[_0xb602('0x3')]);router[_0xb602('0x1')](_0xb602('0x4'),controller[_0xb602('0x5')]);module[_0xb602('0x6')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index d70345b..551eda0 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 _0x3d29=['exports','BOOLEAN','sequelize'];(function(_0x2b3cad,_0x573629){var _0x2175c4=function(_0x2f5a4f){while(--_0x2f5a4f){_0x2b3cad['push'](_0x2b3cad['shift']());}};_0x2175c4(++_0x573629);}(_0x3d29,0x110));var _0x93d2=function(_0x3afe18,_0x26922c){_0x3afe18=_0x3afe18-0x0;var _0x19ed1f=_0x3d29[_0x3afe18];return _0x19ed1f;};'use strict';var Sequelize=require(_0x93d2('0x0'));module[_0x93d2('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x93d2('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa}}; \ No newline at end of file +var _0x3223=['exports','STRING','BOOLEAN','INTEGER','sequelize'];(function(_0x3e7b39,_0x2c2110){var _0x4ad001=function(_0x3fd134){while(--_0x3fd134){_0x3e7b39['push'](_0x3e7b39['shift']());}};_0x4ad001(++_0x2c2110);}(_0x3223,0xbd));var _0x3322=function(_0x3106eb,_0x165c89){_0x3106eb=_0x3106eb-0x0;var _0x16369e=_0x3223[_0x3106eb];return _0x16369e;};'use strict';var Sequelize=require(_0x3322('0x0'));module[_0x3322('0x1')]={'name':{'type':Sequelize[_0x3322('0x2')],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x3322('0x2')]},'status':{'type':Sequelize[_0x3322('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x3322('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 03d0320..a06b2a0 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 _0xeeb1=['includeAll','include','findAll','rows','catch','show','params','keys','options','create','body','find','ids','findOne','Condition','getConditions','hasOwnProperty','addActions','omit','getActions','Action','nolimit','eml-format','zip-dir','fast-json-patch','moment','util','lodash','jsforce','to-csv','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','save','update','then','destroy','error','name','send','index','Automation','rawAttributes','fieldName','type','key','model','map','query','attributes','intersection','fields','length','order','sort','where','filters','pick','filter','VIRTUAL','merge'];(function(_0x3fabbf,_0xe1b751){var _0x3186ea=function(_0x1f9493){while(--_0x1f9493){_0x3fabbf['push'](_0x3fabbf['shift']());}};_0x3186ea(++_0xe1b751);}(_0xeeb1,0x14e));var _0x1eeb=function(_0x6a7421,_0x20b4f5){_0x6a7421=_0x6a7421-0x0;var _0x33f5d1=_0xeeb1[_0x6a7421];return _0x33f5d1;};'use strict';var emlformat=require(_0x1eeb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1eeb('0x1'));var jsonpatch=require(_0x1eeb('0x2'));var rp=require('request-promise');var moment=require(_0x1eeb('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1eeb('0x4'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1eeb('0x5'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1eeb('0x6'));var deskjs=require('desk.js');var toCsv=require(_0x1eeb('0x7'));var querystring=require(_0x1eeb('0x8'));var Papa=require(_0x1eeb('0x9'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x1eeb('0xa'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1eeb('0xb'));var logger=require(_0x1eeb('0xc'))(_0x1eeb('0xd'));var utils=require(_0x1eeb('0xe'));var config=require(_0x1eeb('0xf'));var licenseUtil=require(_0x1eeb('0x10'));var db=require(_0x1eeb('0x11'))['db'];function respondWithStatusCode(_0x2faa7b,_0x2d460a){_0x2d460a=_0x2d460a||0xcc;return function(_0x46f067){if(_0x46f067){return _0x2faa7b[_0x1eeb('0x12')](_0x2d460a);}return _0x2faa7b[_0x1eeb('0x13')](_0x2d460a)[_0x1eeb('0x14')]();};}function respondWithResult(_0x1f6566,_0x17312b){_0x17312b=_0x17312b||0xc8;return function(_0x3d7596){if(_0x3d7596){return _0x1f6566[_0x1eeb('0x13')](_0x17312b)[_0x1eeb('0x15')](_0x3d7596);}};}function respondWithFilteredResult(_0x461be8,_0xdc3c33){return function(_0x4e6d49){if(_0x4e6d49){var _0x92c488=typeof _0xdc3c33['offset']===_0x1eeb('0x16')&&typeof _0xdc3c33[_0x1eeb('0x17')]==='undefined';var _0x53a297=_0x4e6d49['count'];var _0x216d77=_0x92c488?0x0:_0xdc3c33['offset'];var _0x2c7b98=_0x92c488?_0x4e6d49[_0x1eeb('0x18')]:_0xdc3c33[_0x1eeb('0x19')]+_0xdc3c33[_0x1eeb('0x17')];var _0x3fcb29;if(_0x2c7b98>=_0x53a297){_0x2c7b98=_0x53a297;_0x3fcb29=0xc8;}else{_0x3fcb29=0xce;}_0x461be8[_0x1eeb('0x13')](_0x3fcb29);return _0x461be8['set'](_0x1eeb('0x1a'),_0x216d77+'-'+_0x2c7b98+'/'+_0x53a297)['json'](_0x4e6d49);}return null;};}function patchUpdates(_0x42b665){return function(_0x2b5b0b){try{jsonpatch[_0x1eeb('0x1b')](_0x2b5b0b,_0x42b665,!![]);}catch(_0x5ac8a9){return BPromise['reject'](_0x5ac8a9);}return _0x2b5b0b[_0x1eeb('0x1c')]();};}function saveUpdates(_0x1fe93f,_0xc73ff8){return function(_0x5b72fc){if(_0x5b72fc){return _0x5b72fc[_0x1eeb('0x1d')](_0x1fe93f)[_0x1eeb('0x1e')](function(_0x3ddb59){return _0x3ddb59;});}return null;};}function removeEntity(_0x2e0484,_0x2540a6){return function(_0x787ddc){if(_0x787ddc){return _0x787ddc[_0x1eeb('0x1f')]()['then'](function(){_0x2e0484[_0x1eeb('0x13')](0xcc)[_0x1eeb('0x14')]();});}};}function handleEntityNotFound(_0x159561,_0xf56d6a){return function(_0x36d557){if(!_0x36d557){_0x159561[_0x1eeb('0x12')](0x194);}return _0x36d557;};}function handleError(_0x41e2a4,_0x16da5f){_0x16da5f=_0x16da5f||0x1f4;return function(_0xd30c4d){logger[_0x1eeb('0x20')](_0xd30c4d['stack']);if(_0xd30c4d[_0x1eeb('0x21')]){delete _0xd30c4d[_0x1eeb('0x21')];}_0x41e2a4[_0x1eeb('0x13')](_0x16da5f)[_0x1eeb('0x22')](_0xd30c4d);};}exports[_0x1eeb('0x23')]=function(_0x369065,_0x3ace44){var _0x323bb5={},_0x2e6cb2={},_0x2cda05={'count':0x0,'rows':[]};var _0x933be1=_['map'](db[_0x1eeb('0x24')][_0x1eeb('0x25')],function(_0x5c0f97){return{'name':_0x5c0f97[_0x1eeb('0x26')],'type':_0x5c0f97[_0x1eeb('0x27')][_0x1eeb('0x28')]};});_0x2e6cb2[_0x1eeb('0x29')]=_[_0x1eeb('0x2a')](_0x933be1,_0x1eeb('0x21'));_0x2e6cb2[_0x1eeb('0x2b')]=_['keys'](_0x369065['query']);_0x2e6cb2['filters']=_['intersection'](_0x2e6cb2[_0x1eeb('0x29')],_0x2e6cb2[_0x1eeb('0x2b')]);_0x323bb5[_0x1eeb('0x2c')]=_[_0x1eeb('0x2d')](_0x2e6cb2[_0x1eeb('0x29')],qs['fields'](_0x369065[_0x1eeb('0x2b')][_0x1eeb('0x2e')]));_0x323bb5[_0x1eeb('0x2c')]=_0x323bb5[_0x1eeb('0x2c')][_0x1eeb('0x2f')]?_0x323bb5[_0x1eeb('0x2c')]:_0x2e6cb2[_0x1eeb('0x29')];if(!_0x369065[_0x1eeb('0x2b')]['hasOwnProperty']('nolimit')){_0x323bb5['limit']=qs[_0x1eeb('0x17')](_0x369065[_0x1eeb('0x2b')][_0x1eeb('0x17')]);_0x323bb5[_0x1eeb('0x19')]=qs['offset'](_0x369065[_0x1eeb('0x2b')][_0x1eeb('0x19')]);}_0x323bb5[_0x1eeb('0x30')]=qs['sort'](_0x369065[_0x1eeb('0x2b')][_0x1eeb('0x31')]);_0x323bb5[_0x1eeb('0x32')]=qs[_0x1eeb('0x33')](_[_0x1eeb('0x34')](_0x369065[_0x1eeb('0x2b')],_0x2e6cb2[_0x1eeb('0x33')]),_0x933be1);if(_0x369065[_0x1eeb('0x2b')][_0x1eeb('0x35')]){_0x323bb5['where']=_['merge'](_0x323bb5[_0x1eeb('0x32')],{'$or':_[_0x1eeb('0x2a')](_0x933be1,function(_0x2868a1){if(_0x2868a1[_0x1eeb('0x27')]!==_0x1eeb('0x36')){var _0x47fa0c={};_0x47fa0c[_0x2868a1[_0x1eeb('0x21')]]={'$like':'%'+_0x369065[_0x1eeb('0x2b')]['filter']+'%'};return _0x47fa0c;}})});}_0x323bb5=_[_0x1eeb('0x37')]({},_0x323bb5,_0x369065['options']);var _0x1bd5ed={'where':_0x323bb5[_0x1eeb('0x32')]};return db[_0x1eeb('0x24')][_0x1eeb('0x18')](_0x1bd5ed)['then'](function(_0x266edb){_0x2cda05['count']=_0x266edb;if(_0x369065[_0x1eeb('0x2b')][_0x1eeb('0x38')]){_0x323bb5[_0x1eeb('0x39')]=[{'all':!![]}];}return db[_0x1eeb('0x24')][_0x1eeb('0x3a')](_0x323bb5);})[_0x1eeb('0x1e')](function(_0x53d459){_0x2cda05[_0x1eeb('0x3b')]=_0x53d459;return _0x2cda05;})[_0x1eeb('0x1e')](respondWithFilteredResult(_0x3ace44,_0x323bb5))[_0x1eeb('0x3c')](handleError(_0x3ace44,null));};exports[_0x1eeb('0x3d')]=function(_0x2aba74,_0x59b7df){var _0x5ac76f={'raw':![],'where':{'id':_0x2aba74[_0x1eeb('0x3e')]['id']}},_0x20d4a7={};_0x20d4a7[_0x1eeb('0x29')]=_[_0x1eeb('0x3f')](db[_0x1eeb('0x24')][_0x1eeb('0x25')]);_0x20d4a7[_0x1eeb('0x2b')]=_['keys'](_0x2aba74[_0x1eeb('0x2b')]);_0x20d4a7[_0x1eeb('0x33')]=_[_0x1eeb('0x2d')](_0x20d4a7[_0x1eeb('0x29')],_0x20d4a7[_0x1eeb('0x2b')]);_0x5ac76f[_0x1eeb('0x2c')]=_[_0x1eeb('0x2d')](_0x20d4a7[_0x1eeb('0x29')],qs['fields'](_0x2aba74['query'][_0x1eeb('0x2e')]));_0x5ac76f[_0x1eeb('0x2c')]=_0x5ac76f[_0x1eeb('0x2c')][_0x1eeb('0x2f')]?_0x5ac76f[_0x1eeb('0x2c')]:_0x20d4a7[_0x1eeb('0x29')];if(_0x2aba74[_0x1eeb('0x2b')][_0x1eeb('0x38')]){_0x5ac76f[_0x1eeb('0x39')]=[{'all':!![]}];}_0x5ac76f=_[_0x1eeb('0x37')]({},_0x5ac76f,_0x2aba74[_0x1eeb('0x40')]);return db[_0x1eeb('0x24')]['find'](_0x5ac76f)[_0x1eeb('0x1e')](handleEntityNotFound(_0x59b7df,null))[_0x1eeb('0x1e')](respondWithResult(_0x59b7df,null))[_0x1eeb('0x3c')](handleError(_0x59b7df,null));};exports[_0x1eeb('0x41')]=function(_0xfe982c,_0x498153){return db['Automation'][_0x1eeb('0x41')](_0xfe982c['body'],{})[_0x1eeb('0x1e')](respondWithResult(_0x498153,0xc9))[_0x1eeb('0x3c')](handleError(_0x498153,null));};exports[_0x1eeb('0x1d')]=function(_0x13ff3d,_0x44d64f){if(_0x13ff3d[_0x1eeb('0x42')]['id']){delete _0x13ff3d['body']['id'];}return db[_0x1eeb('0x24')][_0x1eeb('0x43')]({'where':{'id':_0x13ff3d[_0x1eeb('0x3e')]['id']}})[_0x1eeb('0x1e')](handleEntityNotFound(_0x44d64f,null))[_0x1eeb('0x1e')](saveUpdates(_0x13ff3d[_0x1eeb('0x42')],null))[_0x1eeb('0x1e')](respondWithResult(_0x44d64f,null))[_0x1eeb('0x3c')](handleError(_0x44d64f,null));};exports[_0x1eeb('0x1f')]=function(_0x327041,_0x5ce347){return db[_0x1eeb('0x24')]['find']({'where':{'id':_0x327041[_0x1eeb('0x3e')]['id']}})['then'](handleEntityNotFound(_0x5ce347,null))['then'](removeEntity(_0x5ce347,null))[_0x1eeb('0x3c')](handleError(_0x5ce347,null));};exports['addConditions']=function(_0x291252,_0x5706d2,_0x2e97ca){return db['Condition'][_0x1eeb('0x43')]({'where':{'id':_0x291252['params']['id']}})[_0x1eeb('0x1e')](handleEntityNotFound(_0x5706d2,null))['then'](function(_0x111a2a){if(_0x111a2a){return _0x111a2a['addConditions'](_0x291252[_0x1eeb('0x42')][_0x1eeb('0x44')],_['omit'](_0x291252['body'],[_0x1eeb('0x44'),'id'])||{});}})[_0x1eeb('0x1e')](respondWithResult(_0x5706d2,null))[_0x1eeb('0x3c')](handleError(_0x5706d2,null));};exports['getConditions']=function(_0x48e214,_0x226869,_0x2f11bb){var _0x271066={};var _0x4a36d0={};var _0x2648e1;var _0x458e00;return db[_0x1eeb('0x24')][_0x1eeb('0x45')]({'where':{'id':_0x48e214[_0x1eeb('0x3e')]['id']}})[_0x1eeb('0x1e')](handleEntityNotFound(_0x226869,null))[_0x1eeb('0x1e')](function(_0x1e08a7){if(_0x1e08a7){_0x2648e1=_0x1e08a7;_0x4a36d0[_0x1eeb('0x29')]=_[_0x1eeb('0x3f')](db[_0x1eeb('0x46')][_0x1eeb('0x25')]);_0x4a36d0[_0x1eeb('0x2b')]=_[_0x1eeb('0x3f')](_0x48e214[_0x1eeb('0x2b')]);_0x4a36d0[_0x1eeb('0x33')]=_[_0x1eeb('0x2d')](_0x4a36d0['model'],_0x4a36d0[_0x1eeb('0x2b')]);_0x271066[_0x1eeb('0x2c')]=_[_0x1eeb('0x2d')](_0x4a36d0[_0x1eeb('0x29')],qs[_0x1eeb('0x2e')](_0x48e214[_0x1eeb('0x2b')][_0x1eeb('0x2e')]));_0x271066['attributes']=_0x271066[_0x1eeb('0x2c')][_0x1eeb('0x2f')]?_0x271066[_0x1eeb('0x2c')]:_0x4a36d0[_0x1eeb('0x29')];_0x271066[_0x1eeb('0x30')]=qs[_0x1eeb('0x31')](_0x48e214[_0x1eeb('0x2b')][_0x1eeb('0x31')]);_0x271066['where']=qs[_0x1eeb('0x33')](_[_0x1eeb('0x34')](_0x48e214['query'],_0x4a36d0['filters']));if(_0x48e214[_0x1eeb('0x2b')][_0x1eeb('0x35')]){_0x271066[_0x1eeb('0x32')]=_[_0x1eeb('0x37')](_0x271066[_0x1eeb('0x32')],{'$or':_['map'](_0x271066[_0x1eeb('0x2c')],function(_0x1387b1){var _0x117e88={};_0x117e88[_0x1387b1]={'$like':'%'+_0x48e214[_0x1eeb('0x2b')][_0x1eeb('0x35')]+'%'};return _0x117e88;})});}_0x271066=_[_0x1eeb('0x37')]({},_0x271066,_0x48e214['options']);return _0x2648e1[_0x1eeb('0x47')](_0x271066);}})[_0x1eeb('0x1e')](function(_0x2c2057){if(_0x2c2057){_0x458e00=_0x2c2057['length'];if(!_0x48e214[_0x1eeb('0x2b')][_0x1eeb('0x48')]('nolimit')){_0x271066['limit']=qs['limit'](_0x48e214[_0x1eeb('0x2b')][_0x1eeb('0x17')]);_0x271066[_0x1eeb('0x19')]=qs[_0x1eeb('0x19')](_0x48e214[_0x1eeb('0x2b')][_0x1eeb('0x19')]);}return _0x2648e1[_0x1eeb('0x47')](_0x271066);}})['then'](function(_0x2aed06){if(_0x2aed06){return _0x2aed06?{'count':_0x458e00,'rows':_0x2aed06}:null;}})[_0x1eeb('0x1e')](respondWithResult(_0x226869,null))[_0x1eeb('0x3c')](handleError(_0x226869,null));};exports[_0x1eeb('0x49')]=function(_0x2b9544,_0x102749,_0x226c9b){return db['Action'][_0x1eeb('0x43')]({'where':{'id':_0x2b9544[_0x1eeb('0x3e')]['id']}})['then'](handleEntityNotFound(_0x102749,null))['then'](function(_0x43b9e0){if(_0x43b9e0){return _0x43b9e0[_0x1eeb('0x49')](_0x2b9544[_0x1eeb('0x42')]['ids'],_[_0x1eeb('0x4a')](_0x2b9544[_0x1eeb('0x42')],[_0x1eeb('0x44'),'id'])||{});}})['then'](respondWithResult(_0x102749,null))[_0x1eeb('0x3c')](handleError(_0x102749,null));};exports[_0x1eeb('0x4b')]=function(_0x3e4f1c,_0x1e36ca,_0x224938){var _0xda9f5a={};var _0x31a455={};var _0x51f467;var _0x2306e5;return db['Automation']['findOne']({'where':{'id':_0x3e4f1c[_0x1eeb('0x3e')]['id']}})[_0x1eeb('0x1e')](handleEntityNotFound(_0x1e36ca,null))['then'](function(_0x4bcad8){if(_0x4bcad8){_0x51f467=_0x4bcad8;_0x31a455['model']=_['keys'](db[_0x1eeb('0x4c')][_0x1eeb('0x25')]);_0x31a455[_0x1eeb('0x2b')]=_[_0x1eeb('0x3f')](_0x3e4f1c[_0x1eeb('0x2b')]);_0x31a455['filters']=_[_0x1eeb('0x2d')](_0x31a455['model'],_0x31a455[_0x1eeb('0x2b')]);_0xda9f5a[_0x1eeb('0x2c')]=_['intersection'](_0x31a455[_0x1eeb('0x29')],qs[_0x1eeb('0x2e')](_0x3e4f1c[_0x1eeb('0x2b')]['fields']));_0xda9f5a[_0x1eeb('0x2c')]=_0xda9f5a[_0x1eeb('0x2c')][_0x1eeb('0x2f')]?_0xda9f5a[_0x1eeb('0x2c')]:_0x31a455[_0x1eeb('0x29')];_0xda9f5a['order']=qs['sort'](_0x3e4f1c[_0x1eeb('0x2b')][_0x1eeb('0x31')]);_0xda9f5a['where']=qs[_0x1eeb('0x33')](_[_0x1eeb('0x34')](_0x3e4f1c[_0x1eeb('0x2b')],_0x31a455[_0x1eeb('0x33')]));if(_0x3e4f1c[_0x1eeb('0x2b')][_0x1eeb('0x35')]){_0xda9f5a[_0x1eeb('0x32')]=_[_0x1eeb('0x37')](_0xda9f5a[_0x1eeb('0x32')],{'$or':_[_0x1eeb('0x2a')](_0xda9f5a['attributes'],function(_0x3a3af7){var _0x51639f={};_0x51639f[_0x3a3af7]={'$like':'%'+_0x3e4f1c[_0x1eeb('0x2b')][_0x1eeb('0x35')]+'%'};return _0x51639f;})});}_0xda9f5a=_[_0x1eeb('0x37')]({},_0xda9f5a,_0x3e4f1c[_0x1eeb('0x40')]);return _0x51f467[_0x1eeb('0x4b')](_0xda9f5a);}})['then'](function(_0x49b19d){if(_0x49b19d){_0x2306e5=_0x49b19d[_0x1eeb('0x2f')];if(!_0x3e4f1c[_0x1eeb('0x2b')][_0x1eeb('0x48')](_0x1eeb('0x4d'))){_0xda9f5a[_0x1eeb('0x17')]=qs[_0x1eeb('0x17')](_0x3e4f1c[_0x1eeb('0x2b')][_0x1eeb('0x17')]);_0xda9f5a[_0x1eeb('0x19')]=qs[_0x1eeb('0x19')](_0x3e4f1c[_0x1eeb('0x2b')][_0x1eeb('0x19')]);}return _0x51f467[_0x1eeb('0x4b')](_0xda9f5a);}})['then'](function(_0x494eae){if(_0x494eae){return _0x494eae?{'count':_0x2306e5,'rows':_0x494eae}:null;}})[_0x1eeb('0x1e')](respondWithResult(_0x1e36ca,null))[_0x1eeb('0x3c')](handleError(_0x1e36ca,null));}; \ No newline at end of file +var _0x9ada=['path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','error','stack','name','index','map','Automation','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','sort','where','filters','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','rawAttributes','include','find','create','body','destroy','addConditions','Condition','ids','omit','getConditions','order','addActions','getActions','findOne','Action','pick','nolimit','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util'];(function(_0xde78f8,_0x19713c){var _0x1c2ec9=function(_0x33d448){while(--_0x33d448){_0xde78f8['push'](_0xde78f8['shift']());}};_0x1c2ec9(++_0x19713c);}(_0x9ada,0xa9));var _0xa9ad=function(_0x1667c2,_0x50a7c4){_0x1667c2=_0x1667c2-0x0;var _0x142d18=_0x9ada[_0x1667c2];return _0x142d18;};'use strict';var emlformat=require(_0xa9ad('0x0'));var rimraf=require(_0xa9ad('0x1'));var zipdir=require(_0xa9ad('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa9ad('0x3'));var moment=require(_0xa9ad('0x4'));var BPromise=require(_0xa9ad('0x5'));var Mustache=require('mustache');var util=require(_0xa9ad('0x6'));var path=require(_0xa9ad('0x7'));var sox=require(_0xa9ad('0x8'));var csv=require(_0xa9ad('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa9ad('0xa'));var _=require(_0xa9ad('0xb'));var squel=require(_0xa9ad('0xc'));var crypto=require(_0xa9ad('0xd'));var jsforce=require(_0xa9ad('0xe'));var deskjs=require(_0xa9ad('0xf'));var toCsv=require('to-csv');var querystring=require(_0xa9ad('0x10'));var Papa=require(_0xa9ad('0x11'));var Redis=require(_0xa9ad('0x12'));var authService=require(_0xa9ad('0x13'));var qs=require(_0xa9ad('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa9ad('0x15'));var logger=require(_0xa9ad('0x16'))(_0xa9ad('0x17'));var utils=require(_0xa9ad('0x18'));var config=require(_0xa9ad('0x19'));var licenseUtil=require(_0xa9ad('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x152292,_0x544055){_0x544055=_0x544055||0xcc;return function(_0x173698){if(_0x173698){return _0x152292[_0xa9ad('0x1b')](_0x544055);}return _0x152292[_0xa9ad('0x1c')](_0x544055)[_0xa9ad('0x1d')]();};}function respondWithResult(_0x445171,_0x3284f2){_0x3284f2=_0x3284f2||0xc8;return function(_0x319306){if(_0x319306){return _0x445171[_0xa9ad('0x1c')](_0x3284f2)[_0xa9ad('0x1e')](_0x319306);}};}function respondWithFilteredResult(_0x4e0bb1,_0x48c87f){return function(_0x2e22d1){if(_0x2e22d1){var _0x2428f7=typeof _0x48c87f[_0xa9ad('0x1f')]===_0xa9ad('0x20')&&typeof _0x48c87f[_0xa9ad('0x21')]===_0xa9ad('0x20');var _0x3fa6ec=_0x2e22d1[_0xa9ad('0x22')];var _0x3421dc=_0x2428f7?0x0:_0x48c87f['offset'];var _0x403df3=_0x2428f7?_0x2e22d1[_0xa9ad('0x22')]:_0x48c87f['offset']+_0x48c87f[_0xa9ad('0x21')];var _0x5bf1f7;if(_0x403df3>=_0x3fa6ec){_0x403df3=_0x3fa6ec;_0x5bf1f7=0xc8;}else{_0x5bf1f7=0xce;}_0x4e0bb1[_0xa9ad('0x1c')](_0x5bf1f7);return _0x4e0bb1[_0xa9ad('0x23')](_0xa9ad('0x24'),_0x3421dc+'-'+_0x403df3+'/'+_0x3fa6ec)['json'](_0x2e22d1);}return null;};}function patchUpdates(_0x3c7b06){return function(_0x5d1d63){try{jsonpatch['apply'](_0x5d1d63,_0x3c7b06,!![]);}catch(_0x94bd78){return BPromise[_0xa9ad('0x25')](_0x94bd78);}return _0x5d1d63[_0xa9ad('0x26')]();};}function saveUpdates(_0x39f7e9,_0x1997f2){return function(_0x576d6a){if(_0x576d6a){return _0x576d6a[_0xa9ad('0x27')](_0x39f7e9)['then'](function(_0x214a71){return _0x214a71;});}return null;};}function removeEntity(_0x48c41b,_0xc4536f){return function(_0x4a2ab2){if(_0x4a2ab2){return _0x4a2ab2['destroy']()[_0xa9ad('0x28')](function(){_0x48c41b[_0xa9ad('0x1c')](0xcc)[_0xa9ad('0x1d')]();});}};}function handleEntityNotFound(_0x56a374,_0x566004){return function(_0x19daec){if(!_0x19daec){_0x56a374['sendStatus'](0x194);}return _0x19daec;};}function handleError(_0x12b95e,_0x418705){_0x418705=_0x418705||0x1f4;return function(_0x512bd0){logger[_0xa9ad('0x29')](_0x512bd0[_0xa9ad('0x2a')]);if(_0x512bd0[_0xa9ad('0x2b')]){delete _0x512bd0[_0xa9ad('0x2b')];}_0x12b95e[_0xa9ad('0x1c')](_0x418705)['send'](_0x512bd0);};}exports[_0xa9ad('0x2c')]=function(_0x54ef05,_0x514a21){var _0x28dcd2={},_0x4d0118={},_0x3fa31b={'count':0x0,'rows':[]};var _0x6ec464=_[_0xa9ad('0x2d')](db[_0xa9ad('0x2e')]['rawAttributes'],function(_0x22f870){return{'name':_0x22f870['fieldName'],'type':_0x22f870['type'][_0xa9ad('0x2f')]};});_0x4d0118[_0xa9ad('0x30')]=_[_0xa9ad('0x2d')](_0x6ec464,_0xa9ad('0x2b'));_0x4d0118[_0xa9ad('0x31')]=_[_0xa9ad('0x32')](_0x54ef05['query']);_0x4d0118['filters']=_[_0xa9ad('0x33')](_0x4d0118['model'],_0x4d0118[_0xa9ad('0x31')]);_0x28dcd2[_0xa9ad('0x34')]=_[_0xa9ad('0x33')](_0x4d0118[_0xa9ad('0x30')],qs[_0xa9ad('0x35')](_0x54ef05[_0xa9ad('0x31')][_0xa9ad('0x35')]));_0x28dcd2[_0xa9ad('0x34')]=_0x28dcd2['attributes'][_0xa9ad('0x36')]?_0x28dcd2[_0xa9ad('0x34')]:_0x4d0118[_0xa9ad('0x30')];if(!_0x54ef05[_0xa9ad('0x31')][_0xa9ad('0x37')]('nolimit')){_0x28dcd2[_0xa9ad('0x21')]=qs[_0xa9ad('0x21')](_0x54ef05['query'][_0xa9ad('0x21')]);_0x28dcd2[_0xa9ad('0x1f')]=qs[_0xa9ad('0x1f')](_0x54ef05['query'][_0xa9ad('0x1f')]);}_0x28dcd2['order']=qs['sort'](_0x54ef05[_0xa9ad('0x31')][_0xa9ad('0x38')]);_0x28dcd2[_0xa9ad('0x39')]=qs[_0xa9ad('0x3a')](_['pick'](_0x54ef05['query'],_0x4d0118[_0xa9ad('0x3a')]),_0x6ec464);if(_0x54ef05['query'][_0xa9ad('0x3b')]){_0x28dcd2['where']=_[_0xa9ad('0x3c')](_0x28dcd2['where'],{'$or':_[_0xa9ad('0x2d')](_0x6ec464,function(_0x1e68a0){if(_0x1e68a0[_0xa9ad('0x3d')]!==_0xa9ad('0x3e')){var _0x5f3818={};_0x5f3818[_0x1e68a0[_0xa9ad('0x2b')]]={'$like':'%'+_0x54ef05[_0xa9ad('0x31')][_0xa9ad('0x3b')]+'%'};return _0x5f3818;}})});}_0x28dcd2=_[_0xa9ad('0x3c')]({},_0x28dcd2,_0x54ef05[_0xa9ad('0x3f')]);var _0x1155c3={'where':_0x28dcd2['where']};return db[_0xa9ad('0x2e')]['count'](_0x1155c3)[_0xa9ad('0x28')](function(_0x2c6d17){_0x3fa31b['count']=_0x2c6d17;if(_0x54ef05[_0xa9ad('0x31')][_0xa9ad('0x40')]){_0x28dcd2['include']=[{'all':!![]}];}return db['Automation'][_0xa9ad('0x41')](_0x28dcd2);})[_0xa9ad('0x28')](function(_0x7c372d){_0x3fa31b[_0xa9ad('0x42')]=_0x7c372d;return _0x3fa31b;})['then'](respondWithFilteredResult(_0x514a21,_0x28dcd2))[_0xa9ad('0x43')](handleError(_0x514a21,null));};exports[_0xa9ad('0x44')]=function(_0x145ad2,_0x425069){var _0x4924fc={'raw':![],'where':{'id':_0x145ad2[_0xa9ad('0x45')]['id']}},_0x71f21d={};_0x71f21d['model']=_['keys'](db[_0xa9ad('0x2e')][_0xa9ad('0x46')]);_0x71f21d[_0xa9ad('0x31')]=_[_0xa9ad('0x32')](_0x145ad2[_0xa9ad('0x31')]);_0x71f21d[_0xa9ad('0x3a')]=_[_0xa9ad('0x33')](_0x71f21d[_0xa9ad('0x30')],_0x71f21d[_0xa9ad('0x31')]);_0x4924fc[_0xa9ad('0x34')]=_[_0xa9ad('0x33')](_0x71f21d[_0xa9ad('0x30')],qs['fields'](_0x145ad2[_0xa9ad('0x31')][_0xa9ad('0x35')]));_0x4924fc['attributes']=_0x4924fc['attributes'][_0xa9ad('0x36')]?_0x4924fc[_0xa9ad('0x34')]:_0x71f21d[_0xa9ad('0x30')];if(_0x145ad2[_0xa9ad('0x31')][_0xa9ad('0x40')]){_0x4924fc[_0xa9ad('0x47')]=[{'all':!![]}];}_0x4924fc=_[_0xa9ad('0x3c')]({},_0x4924fc,_0x145ad2[_0xa9ad('0x3f')]);return db[_0xa9ad('0x2e')][_0xa9ad('0x48')](_0x4924fc)[_0xa9ad('0x28')](handleEntityNotFound(_0x425069,null))[_0xa9ad('0x28')](respondWithResult(_0x425069,null))[_0xa9ad('0x43')](handleError(_0x425069,null));};exports[_0xa9ad('0x49')]=function(_0x82059d,_0x15d5d1){return db[_0xa9ad('0x2e')][_0xa9ad('0x49')](_0x82059d[_0xa9ad('0x4a')],{})['then'](respondWithResult(_0x15d5d1,0xc9))[_0xa9ad('0x43')](handleError(_0x15d5d1,null));};exports[_0xa9ad('0x27')]=function(_0x3d9de6,_0x56f0bd){if(_0x3d9de6[_0xa9ad('0x4a')]['id']){delete _0x3d9de6[_0xa9ad('0x4a')]['id'];}return db[_0xa9ad('0x2e')][_0xa9ad('0x48')]({'where':{'id':_0x3d9de6[_0xa9ad('0x45')]['id']}})['then'](handleEntityNotFound(_0x56f0bd,null))[_0xa9ad('0x28')](saveUpdates(_0x3d9de6[_0xa9ad('0x4a')],null))[_0xa9ad('0x28')](respondWithResult(_0x56f0bd,null))['catch'](handleError(_0x56f0bd,null));};exports[_0xa9ad('0x4b')]=function(_0x4f4059,_0x422104){return db[_0xa9ad('0x2e')]['find']({'where':{'id':_0x4f4059['params']['id']}})[_0xa9ad('0x28')](handleEntityNotFound(_0x422104,null))[_0xa9ad('0x28')](removeEntity(_0x422104,null))[_0xa9ad('0x43')](handleError(_0x422104,null));};exports[_0xa9ad('0x4c')]=function(_0x193b85,_0x2c1862,_0x3ba4f5){return db[_0xa9ad('0x4d')][_0xa9ad('0x48')]({'where':{'id':_0x193b85[_0xa9ad('0x45')]['id']}})[_0xa9ad('0x28')](handleEntityNotFound(_0x2c1862,null))['then'](function(_0x5f0815){if(_0x5f0815){return _0x5f0815[_0xa9ad('0x4c')](_0x193b85[_0xa9ad('0x4a')][_0xa9ad('0x4e')],_[_0xa9ad('0x4f')](_0x193b85[_0xa9ad('0x4a')],['ids','id'])||{});}})[_0xa9ad('0x28')](respondWithResult(_0x2c1862,null))['catch'](handleError(_0x2c1862,null));};exports[_0xa9ad('0x50')]=function(_0x48b7f5,_0x5ddb6d,_0x159bbf){var _0x321401={};var _0x358ea7={};var _0x10ab7c;var _0x401ccd;return db[_0xa9ad('0x2e')]['findOne']({'where':{'id':_0x48b7f5['params']['id']}})['then'](handleEntityNotFound(_0x5ddb6d,null))[_0xa9ad('0x28')](function(_0x84e05){if(_0x84e05){_0x10ab7c=_0x84e05;_0x358ea7[_0xa9ad('0x30')]=_[_0xa9ad('0x32')](db[_0xa9ad('0x4d')][_0xa9ad('0x46')]);_0x358ea7['query']=_[_0xa9ad('0x32')](_0x48b7f5['query']);_0x358ea7[_0xa9ad('0x3a')]=_['intersection'](_0x358ea7[_0xa9ad('0x30')],_0x358ea7[_0xa9ad('0x31')]);_0x321401[_0xa9ad('0x34')]=_[_0xa9ad('0x33')](_0x358ea7[_0xa9ad('0x30')],qs[_0xa9ad('0x35')](_0x48b7f5[_0xa9ad('0x31')][_0xa9ad('0x35')]));_0x321401[_0xa9ad('0x34')]=_0x321401[_0xa9ad('0x34')][_0xa9ad('0x36')]?_0x321401[_0xa9ad('0x34')]:_0x358ea7['model'];_0x321401[_0xa9ad('0x51')]=qs[_0xa9ad('0x38')](_0x48b7f5[_0xa9ad('0x31')][_0xa9ad('0x38')]);_0x321401[_0xa9ad('0x39')]=qs[_0xa9ad('0x3a')](_['pick'](_0x48b7f5[_0xa9ad('0x31')],_0x358ea7[_0xa9ad('0x3a')]));if(_0x48b7f5['query'][_0xa9ad('0x3b')]){_0x321401[_0xa9ad('0x39')]=_['merge'](_0x321401['where'],{'$or':_['map'](_0x321401[_0xa9ad('0x34')],function(_0x687bce){var _0x110c68={};_0x110c68[_0x687bce]={'$like':'%'+_0x48b7f5[_0xa9ad('0x31')][_0xa9ad('0x3b')]+'%'};return _0x110c68;})});}_0x321401=_[_0xa9ad('0x3c')]({},_0x321401,_0x48b7f5['options']);return _0x10ab7c[_0xa9ad('0x50')](_0x321401);}})[_0xa9ad('0x28')](function(_0x435a73){if(_0x435a73){_0x401ccd=_0x435a73['length'];if(!_0x48b7f5['query'][_0xa9ad('0x37')]('nolimit')){_0x321401['limit']=qs[_0xa9ad('0x21')](_0x48b7f5[_0xa9ad('0x31')]['limit']);_0x321401[_0xa9ad('0x1f')]=qs['offset'](_0x48b7f5[_0xa9ad('0x31')][_0xa9ad('0x1f')]);}return _0x10ab7c[_0xa9ad('0x50')](_0x321401);}})[_0xa9ad('0x28')](function(_0x30bb5a){if(_0x30bb5a){return _0x30bb5a?{'count':_0x401ccd,'rows':_0x30bb5a}:null;}})['then'](respondWithResult(_0x5ddb6d,null))[_0xa9ad('0x43')](handleError(_0x5ddb6d,null));};exports[_0xa9ad('0x52')]=function(_0x1aea29,_0x5a7b9e,_0x1e95fc){return db['Action'][_0xa9ad('0x48')]({'where':{'id':_0x1aea29[_0xa9ad('0x45')]['id']}})[_0xa9ad('0x28')](handleEntityNotFound(_0x5a7b9e,null))[_0xa9ad('0x28')](function(_0x1b572e){if(_0x1b572e){return _0x1b572e[_0xa9ad('0x52')](_0x1aea29['body'][_0xa9ad('0x4e')],_[_0xa9ad('0x4f')](_0x1aea29['body'],[_0xa9ad('0x4e'),'id'])||{});}})[_0xa9ad('0x28')](respondWithResult(_0x5a7b9e,null))['catch'](handleError(_0x5a7b9e,null));};exports[_0xa9ad('0x53')]=function(_0x51babc,_0x4e651b,_0x1c7767){var _0x53bf8a={};var _0x5625f0={};var _0x5164a7;var _0x1df631;return db[_0xa9ad('0x2e')][_0xa9ad('0x54')]({'where':{'id':_0x51babc[_0xa9ad('0x45')]['id']}})[_0xa9ad('0x28')](handleEntityNotFound(_0x4e651b,null))['then'](function(_0x4a72cd){if(_0x4a72cd){_0x5164a7=_0x4a72cd;_0x5625f0['model']=_[_0xa9ad('0x32')](db[_0xa9ad('0x55')][_0xa9ad('0x46')]);_0x5625f0[_0xa9ad('0x31')]=_[_0xa9ad('0x32')](_0x51babc[_0xa9ad('0x31')]);_0x5625f0[_0xa9ad('0x3a')]=_[_0xa9ad('0x33')](_0x5625f0[_0xa9ad('0x30')],_0x5625f0[_0xa9ad('0x31')]);_0x53bf8a[_0xa9ad('0x34')]=_[_0xa9ad('0x33')](_0x5625f0[_0xa9ad('0x30')],qs['fields'](_0x51babc[_0xa9ad('0x31')]['fields']));_0x53bf8a[_0xa9ad('0x34')]=_0x53bf8a[_0xa9ad('0x34')]['length']?_0x53bf8a[_0xa9ad('0x34')]:_0x5625f0[_0xa9ad('0x30')];_0x53bf8a[_0xa9ad('0x51')]=qs[_0xa9ad('0x38')](_0x51babc['query'][_0xa9ad('0x38')]);_0x53bf8a['where']=qs[_0xa9ad('0x3a')](_[_0xa9ad('0x56')](_0x51babc[_0xa9ad('0x31')],_0x5625f0[_0xa9ad('0x3a')]));if(_0x51babc['query'][_0xa9ad('0x3b')]){_0x53bf8a['where']=_[_0xa9ad('0x3c')](_0x53bf8a[_0xa9ad('0x39')],{'$or':_[_0xa9ad('0x2d')](_0x53bf8a[_0xa9ad('0x34')],function(_0x826f62){var _0x51d21b={};_0x51d21b[_0x826f62]={'$like':'%'+_0x51babc['query'][_0xa9ad('0x3b')]+'%'};return _0x51d21b;})});}_0x53bf8a=_[_0xa9ad('0x3c')]({},_0x53bf8a,_0x51babc[_0xa9ad('0x3f')]);return _0x5164a7['getActions'](_0x53bf8a);}})[_0xa9ad('0x28')](function(_0x13c60c){if(_0x13c60c){_0x1df631=_0x13c60c['length'];if(!_0x51babc[_0xa9ad('0x31')]['hasOwnProperty'](_0xa9ad('0x57'))){_0x53bf8a[_0xa9ad('0x21')]=qs['limit'](_0x51babc[_0xa9ad('0x31')][_0xa9ad('0x21')]);_0x53bf8a[_0xa9ad('0x1f')]=qs[_0xa9ad('0x1f')](_0x51babc[_0xa9ad('0x31')]['offset']);}return _0x5164a7[_0xa9ad('0x53')](_0x53bf8a);}})['then'](function(_0xd4d300){if(_0xd4d300){return _0xd4d300?{'count':_0x1df631,'rows':_0xd4d300}:null;}})[_0xa9ad('0x28')](respondWithResult(_0x4e651b,null))[_0xa9ad('0x43')](handleError(_0x4e651b,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 7e28f5c..f617eb0 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 _0x864c=['../../config/environment','./automation.attributes','define','Automation','tools_automations','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x864c,0x125));var _0xc864=function(_0x121789,_0x24bd14){_0x121789=_0x121789-0x0;var _0x108646=_0x864c[_0x121789];return _0x108646;};'use strict';var _=require(_0xc864('0x0'));var util=require(_0xc864('0x1'));var logger=require(_0xc864('0x2'))(_0xc864('0x3'));var moment=require(_0xc864('0x4'));var BPromise=require(_0xc864('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc864('0x6'));var rimraf=require('rimraf');var config=require(_0xc864('0x7'));var attributes=require(_0xc864('0x8'));module['exports']=function(_0x42b298,_0x15dd9b){return _0x42b298[_0xc864('0x9')](_0xc864('0xa'),attributes,{'tableName':_0xc864('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2aa9=['rimraf','../../config/environment','./automation.attributes','exports','define','tools_automations','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x1778e1,_0x3e1727){var _0x2bc4c6=function(_0x359c65){while(--_0x359c65){_0x1778e1['push'](_0x1778e1['shift']());}};_0x2bc4c6(++_0x3e1727);}(_0x2aa9,0x117));var _0x92aa=function(_0x525596,_0x64e4a8){_0x525596=_0x525596-0x0;var _0x5c6fb1=_0x2aa9[_0x525596];return _0x5c6fb1;};'use strict';var _=require(_0x92aa('0x0'));var util=require(_0x92aa('0x1'));var logger=require('../../config/logger')(_0x92aa('0x2'));var moment=require(_0x92aa('0x3'));var BPromise=require(_0x92aa('0x4'));var rp=require(_0x92aa('0x5'));var fs=require('fs');var path=require(_0x92aa('0x6'));var rimraf=require(_0x92aa('0x7'));var config=require(_0x92aa('0x8'));var attributes=require(_0x92aa('0x9'));module[_0x92aa('0xa')]=function(_0x1bb2e3,_0x3103c6){return _0x1bb2e3[_0x92aa('0xb')]('Automation',attributes,{'tableName':_0x92aa('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/automation/automation.rpc.js b/server/api/automation/automation.rpc.js index 8babc30..a91575c 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 _0x390a=['jayson/promise','client','request','then','info','debug','Automation,\x20%s,\x20%s,\x20%s','request\x20sent','error','Automation,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x9ead04,_0x5abdf1){var _0x1fa9c8=function(_0x9c348){while(--_0x9c348){_0x9ead04['push'](_0x9ead04['shift']());}};_0x1fa9c8(++_0x5abdf1);}(_0x390a,0xc9));var _0xa390=function(_0x1289a7,_0x51e6d8){_0x1289a7=_0x1289a7-0x0;var _0x341185=_0x390a[_0x1289a7];return _0x341185;};'use strict';var _=require(_0xa390('0x0'));var util=require(_0xa390('0x1'));var moment=require(_0xa390('0x2'));var BPromise=require(_0xa390('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa390('0x4'));var db=require(_0xa390('0x5'))['db'];var utils=require(_0xa390('0x6'));var logger=require(_0xa390('0x7'))('rpc');var config=require(_0xa390('0x8'));var jayson=require(_0xa390('0x9'));var client=jayson[_0xa390('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2d49cc,_0x1f9de0,_0x53bfb4){return new BPromise(function(_0x492418,_0xc8cd85){return client[_0xa390('0xb')](_0x2d49cc,_0x53bfb4)[_0xa390('0xc')](function(_0x226003){logger[_0xa390('0xd')]('Automation,\x20%s,\x20%s',_0x1f9de0,'request\x20sent');logger[_0xa390('0xe')](_0xa390('0xf'),_0x1f9de0,_0xa390('0x10'),JSON['stringify'](_0x226003));if(_0x226003[_0xa390('0x11')]){if(_0x226003[_0xa390('0x11')]['code']===0x1f4){logger[_0xa390('0x11')](_0xa390('0x12'),_0x1f9de0,_0x226003['error']['message']);return _0xc8cd85(_0x226003[_0xa390('0x11')][_0xa390('0x13')]);}logger['error'](_0xa390('0x12'),_0x1f9de0,_0x226003['error']['message']);return _0x492418(_0x226003['error'][_0xa390('0x13')]);}else{logger['info'](_0xa390('0x12'),_0x1f9de0,_0xa390('0x10'));_0x492418(_0x226003['result'][_0xa390('0x13')]);}})[_0xa390('0x14')](function(_0x59d609){logger[_0xa390('0x11')]('Automation,\x20%s,\x20%s',_0x1f9de0,_0x59d609);_0xc8cd85(_0x59d609);});});} \ No newline at end of file +var _0x09df=['rpc','../../config/environment','request','then','info','request\x20sent','debug','error','code','Automation,\x20%s,\x20%s','message','lodash','util','bluebird','../../mysqldb'];(function(_0x558b60,_0x55ac48){var _0x2dcea6=function(_0x185eb0){while(--_0x185eb0){_0x558b60['push'](_0x558b60['shift']());}};_0x2dcea6(++_0x55ac48);}(_0x09df,0x164));var _0xf09d=function(_0x4ed4d2,_0x47acf7){_0x4ed4d2=_0x4ed4d2-0x0;var _0x15ae2e=_0x09df[_0x4ed4d2];return _0x15ae2e;};'use strict';var _=require(_0xf09d('0x0'));var util=require(_0xf09d('0x1'));var moment=require('moment');var BPromise=require(_0xf09d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf09d('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf09d('0x4'));var config=require(_0xf09d('0x5'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x284a42,_0x48b82f,_0x28c91c){return new BPromise(function(_0x2555c7,_0x2f1810){return client[_0xf09d('0x6')](_0x284a42,_0x28c91c)[_0xf09d('0x7')](function(_0x2a59a8){logger[_0xf09d('0x8')]('Automation,\x20%s,\x20%s',_0x48b82f,_0xf09d('0x9'));logger[_0xf09d('0xa')]('Automation,\x20%s,\x20%s,\x20%s',_0x48b82f,_0xf09d('0x9'),JSON['stringify'](_0x2a59a8));if(_0x2a59a8[_0xf09d('0xb')]){if(_0x2a59a8[_0xf09d('0xb')][_0xf09d('0xc')]===0x1f4){logger[_0xf09d('0xb')](_0xf09d('0xd'),_0x48b82f,_0x2a59a8[_0xf09d('0xb')][_0xf09d('0xe')]);return _0x2f1810(_0x2a59a8[_0xf09d('0xb')][_0xf09d('0xe')]);}logger['error'](_0xf09d('0xd'),_0x48b82f,_0x2a59a8[_0xf09d('0xb')][_0xf09d('0xe')]);return _0x2555c7(_0x2a59a8['error']['message']);}else{logger[_0xf09d('0x8')](_0xf09d('0xd'),_0x48b82f,_0xf09d('0x9'));_0x2555c7(_0x2a59a8['result'][_0xf09d('0xe')]);}})['catch'](function(_0x3614f7){logger[_0xf09d('0xb')](_0xf09d('0xd'),_0x48b82f,_0x3614f7);_0x2f1810(_0x3614f7);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 1e15159..b4a3965 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 _0xdecb=['../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated','index','/:id','show','/:id/conditions','getConditions','getActions','post','/:id/actions','addActions','put','update','delete','destroy','util','path','connect-timeout','Router'];(function(_0x4d87a1,_0x3029fe){var _0x4c0343=function(_0x5355d0){while(--_0x5355d0){_0x4d87a1['push'](_0x4d87a1['shift']());}};_0x4c0343(++_0x3029fe);}(_0xdecb,0xe2));var _0xbdec=function(_0x498a6a,_0x3136d8){_0x498a6a=_0x498a6a-0x0;var _0x1fb842=_0xdecb[_0x498a6a];return _0x1fb842;};'use strict';var multer=require('multer');var util=require(_0xbdec('0x0'));var path=require(_0xbdec('0x1'));var timeout=require(_0xbdec('0x2'));var express=require('express');var router=express[_0xbdec('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbdec('0x4'));var interaction=require(_0xbdec('0x5'));var config=require(_0xbdec('0x6'));var controller=require(_0xbdec('0x7'));router[_0xbdec('0x8')]('/',auth[_0xbdec('0x9')](),controller[_0xbdec('0xa')]);router['get'](_0xbdec('0xb'),auth[_0xbdec('0x9')](),controller[_0xbdec('0xc')]);router[_0xbdec('0x8')](_0xbdec('0xd'),auth[_0xbdec('0x9')](),controller[_0xbdec('0xe')]);router[_0xbdec('0x8')]('/:id/actions',auth[_0xbdec('0x9')](),controller[_0xbdec('0xf')]);router[_0xbdec('0x10')]('/',auth[_0xbdec('0x9')](),controller['create']);router[_0xbdec('0x10')](_0xbdec('0xd'),auth[_0xbdec('0x9')](),controller['addConditions']);router[_0xbdec('0x10')](_0xbdec('0x11'),auth[_0xbdec('0x9')](),controller[_0xbdec('0x12')]);router[_0xbdec('0x13')](_0xbdec('0xb'),auth[_0xbdec('0x9')](),controller[_0xbdec('0x14')]);router[_0xbdec('0x15')](_0xbdec('0xb'),auth[_0xbdec('0x9')](),controller[_0xbdec('0x16')]);module['exports']=router; \ No newline at end of file +var _0x5697=['express','./automation.controller','get','/:id','isAuthenticated','show','/:id/conditions','getConditions','/:id/actions','getActions','post','create','addActions','put','update','delete','exports','multer','path','connect-timeout'];(function(_0x47d91e,_0x3e5da9){var _0x1be66b=function(_0x3fd2ca){while(--_0x3fd2ca){_0x47d91e['push'](_0x47d91e['shift']());}};_0x1be66b(++_0x3e5da9);}(_0x5697,0x1b5));var _0x7569=function(_0x56b886,_0x1ff474){_0x56b886=_0x56b886-0x0;var _0x164baf=_0x5697[_0x56b886];return _0x164baf;};'use strict';var multer=require(_0x7569('0x0'));var util=require('util');var path=require(_0x7569('0x1'));var timeout=require(_0x7569('0x2'));var express=require(_0x7569('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7569('0x4'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x7569('0x5')](_0x7569('0x6'),auth[_0x7569('0x7')](),controller[_0x7569('0x8')]);router[_0x7569('0x5')](_0x7569('0x9'),auth['isAuthenticated'](),controller[_0x7569('0xa')]);router['get'](_0x7569('0xb'),auth[_0x7569('0x7')](),controller[_0x7569('0xc')]);router[_0x7569('0xd')]('/',auth[_0x7569('0x7')](),controller[_0x7569('0xe')]);router[_0x7569('0xd')](_0x7569('0x9'),auth[_0x7569('0x7')](),controller['addConditions']);router[_0x7569('0xd')](_0x7569('0xb'),auth[_0x7569('0x7')](),controller[_0x7569('0xf')]);router[_0x7569('0x10')](_0x7569('0x6'),auth['isAuthenticated'](),controller[_0x7569('0x11')]);router[_0x7569('0x12')](_0x7569('0x6'),auth[_0x7569('0x7')](),controller['destroy']);module[_0x7569('0x13')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index b8e7b55..e5e760a 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 _0x69ed=['NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','STRING','name','ENUM','ivr','BOOLEAN','INTEGER','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','onlyIfOpen','always','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','ASC','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x69ed,0x1b6));var _0xd69e=function(_0xfc68da,_0x14afb0){_0xfc68da=_0xfc68da-0x0;var _0x10919e=_0x69ed[_0xfc68da];return _0x10919e;};'use strict';var Sequelize=require(_0xd69e('0x0'));module['exports']={'name':{'type':Sequelize[_0xd69e('0x1')],'unique':_0xd69e('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xd69e('0x3')](_0xd69e('0x4')),'allowNull':![],'defaultValue':_0xd69e('0x4')},'description':{'type':Sequelize[_0xd69e('0x1')]},'active':{'type':Sequelize[_0xd69e('0x5')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize[_0xd69e('0x6')](0x4)[_0xd69e('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xd69e('0x8')},'dialOriginateCallerIdName':{'type':Sequelize[_0xd69e('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xd69e('0x1')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0xd69e('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd69e('0x9')},'dialCongestionMaxRetry':{'type':Sequelize[_0xd69e('0x6')](0x3)[_0xd69e('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd69e('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xd69e('0x6')](0x5)[_0xd69e('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0xd69e('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0xd69e('0x6')](0x5)[_0xd69e('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xd69e('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0xd69e('0xb')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xd69e('0x7')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xd69e('0xc')},'dialTimezone':{'type':Sequelize[_0xd69e('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xd69e('0x1')],'defaultValue':_0xd69e('0xd')},'dialCheckDuplicateType':{'type':Sequelize[_0xd69e('0x3')]('always','never',_0xd69e('0xe')),'defaultValue':_0xd69e('0xf')},'dialAMDActive':{'type':Sequelize[_0xd69e('0x5')],'defaultValue':0x0,'comment':_0xd69e('0x10')},'dialAMDInitialSilence':{'type':Sequelize[_0xd69e('0x6')](0x9)[_0xd69e('0x7')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xd69e('0x11')},'dialAMDGreeting':{'type':Sequelize[_0xd69e('0x6')](0x9)[_0xd69e('0x7')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xd69e('0x12')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xd69e('0x6')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xd69e('0x13')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xd69e('0x6')](0x9)[_0xd69e('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0xd69e('0x7')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xd69e('0x14')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0xd69e('0x7')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xd69e('0x15')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xd69e('0x6')](0x9)[_0xd69e('0x7')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xd69e('0x16')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0xd69e('0x7')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xd69e('0x17')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0xd69e('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xd69e('0x18')},'dialOrderByScheduledAt':{'type':Sequelize[_0xd69e('0x3')]('DESC',_0xd69e('0x19')),'defaultValue':_0xd69e('0x1a')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xd69e('0x6')](0x3)[_0xd69e('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xd69e('0x1b')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xd69e('0x1c')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xd69e('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd69e('0x1d')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xd69e('0x6')](0x5)[_0xd69e('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd69e('0x1e')},'dialDropMaxRetry':{'type':Sequelize[_0xd69e('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd69e('0x1f')},'dialDropRetryFrequency':{'type':Sequelize[_0xd69e('0x6')](0x5)[_0xd69e('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd69e('0x20')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xd69e('0x6')](0x3)[_0xd69e('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd69e('0x21')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xd69e('0x6')](0x5)[_0xd69e('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd69e('0x22')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xd69e('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd69e('0x23')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xd69e('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd69e('0x24')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xd69e('0x6')](0x3)[_0xd69e('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd69e('0x25')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xd69e('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd69e('0x26')}}; \ No newline at end of file +var _0xbb29=['AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','name','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','STRING','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'];(function(_0x1eac2e,_0x6bce0c){var _0x11dd63=function(_0x24a38f){while(--_0x24a38f){_0x1eac2e['push'](_0x1eac2e['shift']());}};_0x11dd63(++_0x6bce0c);}(_0xbb29,0x6d));var _0x9bb2=function(_0x249ede,_0x13d74a){_0x249ede=_0x249ede-0x0;var _0xa4c823=_0xbb29[_0x249ede];return _0xa4c823;};'use strict';var Sequelize=require(_0x9bb2('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x9bb2('0x1'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x9bb2('0x2')](_0x9bb2('0x3')),'allowNull':![],'defaultValue':_0x9bb2('0x3')},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x9bb2('0x4')],'defaultValue':0x0,'comment':_0x9bb2('0x5')},'limitCalls':{'type':Sequelize[_0x9bb2('0x6')](0x4)[_0x9bb2('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x9bb2('0x8')},'dialOriginateCallerIdName':{'type':Sequelize[_0x9bb2('0x9')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x9bb2('0x9')]},'dialOriginateTimeout':{'type':Sequelize[_0x9bb2('0x6')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x9bb2('0x6')](0x3)[_0x9bb2('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9bb2('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x9bb2('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9bb2('0xb')},'dialBusyMaxRetry':{'type':Sequelize[_0x9bb2('0x6')](0x3)[_0x9bb2('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9bb2('0xc')},'dialBusyRetryFrequency':{'type':Sequelize[_0x9bb2('0x6')](0x5)[_0x9bb2('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x9bb2('0x7')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x9bb2('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9bb2('0xd')},'dialGlobalMaxRetry':{'type':Sequelize[_0x9bb2('0x6')](0x3)[_0x9bb2('0x7')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0x9bb2('0x9')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x9bb2('0x9')],'defaultValue':_0x9bb2('0xe')},'dialCheckDuplicateType':{'type':Sequelize[_0x9bb2('0x2')](_0x9bb2('0xf'),_0x9bb2('0x10'),_0x9bb2('0x11')),'defaultValue':_0x9bb2('0xf')},'dialAMDActive':{'type':Sequelize[_0x9bb2('0x4')],'defaultValue':0x0,'comment':_0x9bb2('0x12')},'dialAMDInitialSilence':{'type':Sequelize[_0x9bb2('0x6')](0x9)[_0x9bb2('0x7')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x9bb2('0x13')},'dialAMDGreeting':{'type':Sequelize[_0x9bb2('0x6')](0x9)[_0x9bb2('0x7')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x9bb2('0x14')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x9bb2('0x6')](0x9)[_0x9bb2('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x9bb2('0x15')},'dialAMDMinWordLength':{'type':Sequelize[_0x9bb2('0x6')](0x9)[_0x9bb2('0x7')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x9bb2('0x16')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x9bb2('0x6')](0x9)[_0x9bb2('0x7')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x9bb2('0x6')](0x9)[_0x9bb2('0x7')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x9bb2('0x17')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x9bb2('0x18')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x9bb2('0x6')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize[_0x9bb2('0x2')](_0x9bb2('0x19'),'ASC'),'defaultValue':_0x9bb2('0x19')},'dialPrefix':{'type':Sequelize[_0x9bb2('0x9')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x9bb2('0x6')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x9bb2('0x1a')},'dialCutDigit':{'type':Sequelize[_0x9bb2('0x6')](0x3)[_0x9bb2('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x9bb2('0x1b')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x9bb2('0x6')](0x3)[_0x9bb2('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9bb2('0x1c')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x9bb2('0x6')](0x5)[_0x9bb2('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9bb2('0x1d')},'dialDropMaxRetry':{'type':Sequelize[_0x9bb2('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9bb2('0x1e')},'dialDropRetryFrequency':{'type':Sequelize[_0x9bb2('0x6')](0x5)[_0x9bb2('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9bb2('0x1f')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x9bb2('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x9bb2('0x6')](0x5)[_0x9bb2('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9bb2('0x20')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x9bb2('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9bb2('0x21')},'dialMachineRetryFrequency':{'type':Sequelize[_0x9bb2('0x6')](0x5)[_0x9bb2('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9bb2('0x22')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x9bb2('0x6')](0x3)[_0x9bb2('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x9bb2('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9bb2('0x23')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 284d1e5..5200464 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 _0x0647=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','getHoppers','CmHopper','CampaignId','getHopperHistories','findOne','CmHopperHistory','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','YYYY-MM-DD\x20HH:mm:ss','ids','spread','dialCheckDuplicateType','always','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','NOW()','field','toString','from','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','CmListId','phone\x20IS\x20NOT\x20NULL','select','COALESCE(calleridnum,\x27\x27)','CampaignId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','onlyIfOpen','cm_contacts','COALESCE(phone,\x27\x27)','insert','into','cm_hopper_additional_phones','cmHopperId','OrderBy','h.id','ci.OrderBY','cm_contact_has_items','join','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.CampaignId=?','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','format','cm_hopper_black','removeBlackLists','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','apply','save','then','IvrCampaigns','UserProfileResource','error','stack','name','send','index','type','key','map','query','keys','intersection','attributes','fields','model','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','Campaign','includeAll','include','findAll','rows','catch','params','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','UserProfileSection','autoAssociation','clone','rawAttributes','length','find','omit','createdAt','updatedAt','body','role','userProfileId'];(function(_0x392890,_0xb8d3dd){var _0x2b2e30=function(_0x4b355f){while(--_0x4b355f){_0x392890['push'](_0x392890['shift']());}};_0x2b2e30(++_0xb8d3dd);}(_0x0647,0xd0));var _0x7064=function(_0x1ccdf7,_0x215d5a){_0x1ccdf7=_0x1ccdf7-0x0;var _0x52a0ae=_0x0647[_0x1ccdf7];return _0x52a0ae;};'use strict';var emlformat=require(_0x7064('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7064('0x1'));var jsonpatch=require(_0x7064('0x2'));var rp=require(_0x7064('0x3'));var moment=require(_0x7064('0x4'));var BPromise=require(_0x7064('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x7064('0x6'));var sox=require(_0x7064('0x7'));var csv=require(_0x7064('0x8'));var ejs=require(_0x7064('0x9'));var fs=require('fs');var fs_extra=require(_0x7064('0xa'));var _=require(_0x7064('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7064('0xc'));var deskjs=require(_0x7064('0xd'));var toCsv=require(_0x7064('0x8'));var querystring=require('querystring');var Papa=require(_0x7064('0xe'));var Redis=require(_0x7064('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x7064('0x10'));var as=require(_0x7064('0x11'));var hardwareService=require(_0x7064('0x12'));var logger=require('../../config/logger')(_0x7064('0x13'));var utils=require(_0x7064('0x14'));var config=require(_0x7064('0x15'));var licenseUtil=require(_0x7064('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x303dcd,_0x4151b6){_0x4151b6=_0x4151b6||0xcc;return function(_0x268a94){if(_0x268a94){return _0x303dcd[_0x7064('0x17')](_0x4151b6);}return _0x303dcd[_0x7064('0x18')](_0x4151b6)[_0x7064('0x19')]();};}function respondWithResult(_0x265aa6,_0x3badc8){_0x3badc8=_0x3badc8||0xc8;return function(_0x57e440){if(_0x57e440){return _0x265aa6['status'](_0x3badc8)['json'](_0x57e440);}};}function respondWithFilteredResult(_0x39f83b,_0x15a1c0){return function(_0x36378c){if(_0x36378c){var _0x4b39db=typeof _0x15a1c0[_0x7064('0x1a')]===_0x7064('0x1b')&&typeof _0x15a1c0['limit']===_0x7064('0x1b');var _0x38d20c=_0x36378c[_0x7064('0x1c')];var _0x203633=_0x4b39db?0x0:_0x15a1c0[_0x7064('0x1a')];var _0x17f306=_0x4b39db?_0x36378c[_0x7064('0x1c')]:_0x15a1c0[_0x7064('0x1a')]+_0x15a1c0[_0x7064('0x1d')];var _0x19b456;if(_0x17f306>=_0x38d20c){_0x17f306=_0x38d20c;_0x19b456=0xc8;}else{_0x19b456=0xce;}_0x39f83b[_0x7064('0x18')](_0x19b456);return _0x39f83b[_0x7064('0x1e')](_0x7064('0x1f'),_0x203633+'-'+_0x17f306+'/'+_0x38d20c)['json'](_0x36378c);}return null;};}function patchUpdates(_0x431fac){return function(_0x141983){try{jsonpatch[_0x7064('0x20')](_0x141983,_0x431fac,!![]);}catch(_0x2d49a9){return BPromise['reject'](_0x2d49a9);}return _0x141983[_0x7064('0x21')]();};}function saveUpdates(_0x51ae69,_0x446730){return function(_0x6eed9e){if(_0x6eed9e){return _0x6eed9e['update'](_0x51ae69)[_0x7064('0x22')](function(_0x14b006){return _0x14b006;});}return null;};}function removeEntity(_0x1a62a2,_0x464e8a){return function(_0x167149){if(_0x167149){return _0x167149['destroy']()['then'](function(){var _0x33f470=_0x167149['get']({'plain':!![]});var _0x2eec57=_0x7064('0x23');return db[_0x7064('0x24')]['destroy']({'where':{'type':_0x2eec57,'resourceId':_0x33f470['id']}})[_0x7064('0x22')](function(){return _0x167149;});})[_0x7064('0x22')](function(){_0x1a62a2[_0x7064('0x18')](0xcc)[_0x7064('0x19')]();});}};}function handleEntityNotFound(_0x358e67,_0x57039f){return function(_0x561186){if(!_0x561186){_0x358e67['sendStatus'](0x194);}return _0x561186;};}function handleError(_0x5e2a06,_0x2fc640){_0x2fc640=_0x2fc640||0x1f4;return function(_0x4aad53){logger[_0x7064('0x25')](_0x4aad53[_0x7064('0x26')]);if(_0x4aad53['name']){delete _0x4aad53[_0x7064('0x27')];}_0x5e2a06[_0x7064('0x18')](_0x2fc640)[_0x7064('0x28')](_0x4aad53);};}exports[_0x7064('0x29')]=function(_0x19749e,_0x5c1b1d){var _0x41db8a={},_0x230f24={},_0x2a95b2={'count':0x0,'rows':[]};var _0x16f422=_['map'](db['Campaign']['rawAttributes'],function(_0x21192d){return{'name':_0x21192d['fieldName'],'type':_0x21192d[_0x7064('0x2a')][_0x7064('0x2b')]};});_0x230f24['model']=_[_0x7064('0x2c')](_0x16f422,_0x7064('0x27'));_0x230f24[_0x7064('0x2d')]=_[_0x7064('0x2e')](_0x19749e['query']);_0x230f24['filters']=_[_0x7064('0x2f')](_0x230f24['model'],_0x230f24[_0x7064('0x2d')]);_0x41db8a[_0x7064('0x30')]=_[_0x7064('0x2f')](_0x230f24['model'],qs[_0x7064('0x31')](_0x19749e[_0x7064('0x2d')][_0x7064('0x31')]));_0x41db8a[_0x7064('0x30')]=_0x41db8a['attributes']['length']?_0x41db8a[_0x7064('0x30')]:_0x230f24[_0x7064('0x32')];if(!_0x19749e['query'][_0x7064('0x33')](_0x7064('0x34'))){_0x41db8a[_0x7064('0x1d')]=qs[_0x7064('0x1d')](_0x19749e[_0x7064('0x2d')][_0x7064('0x1d')]);_0x41db8a[_0x7064('0x1a')]=qs[_0x7064('0x1a')](_0x19749e[_0x7064('0x2d')][_0x7064('0x1a')]);}_0x41db8a[_0x7064('0x35')]=qs['sort'](_0x19749e[_0x7064('0x2d')][_0x7064('0x36')]);_0x41db8a[_0x7064('0x37')]=qs[_0x7064('0x38')](_[_0x7064('0x39')](_0x19749e['query'],_0x230f24[_0x7064('0x38')]),_0x16f422);if(_0x19749e[_0x7064('0x2d')][_0x7064('0x3a')]){_0x41db8a[_0x7064('0x37')]=_[_0x7064('0x3b')](_0x41db8a[_0x7064('0x37')],{'$or':_['map'](_0x16f422,function(_0x1c301e){if(_0x1c301e[_0x7064('0x2a')]!=='VIRTUAL'){var _0x995bec={};_0x995bec[_0x1c301e[_0x7064('0x27')]]={'$like':'%'+_0x19749e[_0x7064('0x2d')][_0x7064('0x3a')]+'%'};return _0x995bec;}})});}_0x41db8a=_[_0x7064('0x3b')]({},_0x41db8a,_0x19749e[_0x7064('0x3c')]);var _0x73d2c0={'where':_0x41db8a[_0x7064('0x37')]};return db[_0x7064('0x3d')][_0x7064('0x1c')](_0x73d2c0)[_0x7064('0x22')](function(_0x329dfa){_0x2a95b2[_0x7064('0x1c')]=_0x329dfa;if(_0x19749e['query'][_0x7064('0x3e')]){_0x41db8a[_0x7064('0x3f')]=[{'all':!![]}];}return db['Campaign'][_0x7064('0x40')](_0x41db8a);})[_0x7064('0x22')](function(_0x10e45f){_0x2a95b2[_0x7064('0x41')]=_0x10e45f;return _0x2a95b2;})[_0x7064('0x22')](respondWithFilteredResult(_0x5c1b1d,_0x41db8a))[_0x7064('0x42')](handleError(_0x5c1b1d,null));};exports['show']=function(_0x5b1cac,_0x24f6b9){var _0x173d43={'raw':![],'where':{'id':_0x5b1cac[_0x7064('0x43')]['id']}},_0x5d4040={};_0x5d4040[_0x7064('0x32')]=_['keys'](db[_0x7064('0x3d')]['rawAttributes']);_0x5d4040['query']=_['keys'](_0x5b1cac[_0x7064('0x2d')]);_0x5d4040[_0x7064('0x38')]=_['intersection'](_0x5d4040[_0x7064('0x32')],_0x5d4040[_0x7064('0x2d')]);_0x173d43['attributes']=_[_0x7064('0x2f')](_0x5d4040[_0x7064('0x32')],qs['fields'](_0x5b1cac[_0x7064('0x2d')][_0x7064('0x31')]));_0x173d43[_0x7064('0x30')]=_0x173d43['attributes']['length']?_0x173d43[_0x7064('0x30')]:_0x5d4040[_0x7064('0x32')];if(_0x5b1cac[_0x7064('0x2d')][_0x7064('0x3e')]){_0x173d43[_0x7064('0x3f')]=[{'all':!![]}];}_0x173d43=_[_0x7064('0x3b')]({},_0x173d43,_0x5b1cac[_0x7064('0x3c')]);return db['Campaign']['find'](_0x173d43)[_0x7064('0x22')](handleEntityNotFound(_0x24f6b9,null))[_0x7064('0x22')](respondWithResult(_0x24f6b9,null))[_0x7064('0x42')](handleError(_0x24f6b9,null));};exports[_0x7064('0x44')]=function(_0x1db6f7,_0x56fda1){return db[_0x7064('0x3d')]['create'](_0x1db6f7['body'],{})['then'](function(_0x4d0829){var _0x58ee99=_0x1db6f7['user']['get']({'plain':!![]});if(!_0x58ee99)throw new Error(_0x7064('0x45'));if(_0x58ee99['role']===_0x7064('0x46')){var _0x249e43=_0x4d0829[_0x7064('0x47')]({'plain':!![]});var _0x43bbdc=_0x7064('0x23');return db[_0x7064('0x48')]['find']({'where':{'name':_0x43bbdc,'userProfileId':_0x58ee99['userProfileId']},'raw':!![]})['then'](function(_0x1a713a){if(_0x1a713a&&_0x1a713a[_0x7064('0x49')]===0x0){return db['UserProfileResource'][_0x7064('0x44')]({'name':_0x249e43[_0x7064('0x27')],'resourceId':_0x249e43['id'],'type':_0x1a713a[_0x7064('0x27')],'sectionId':_0x1a713a['id']},{})[_0x7064('0x22')](function(){return _0x4d0829;});}else{return _0x4d0829;}})[_0x7064('0x42')](function(_0x4f7e16){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4f7e16);throw _0x4f7e16;});}return _0x4d0829;})[_0x7064('0x22')](respondWithResult(_0x56fda1,0xc9))['catch'](handleError(_0x56fda1,null));};exports[_0x7064('0x4a')]=function(_0x388a59,_0x10c14b){var _0x22a0bd={'where':{'id':_0x388a59['params']['id']}},_0x3c73a6={};_0x3c73a6['model']=_[_0x7064('0x2e')](db['Campaign'][_0x7064('0x4b')]);_0x22a0bd[_0x7064('0x30')]=_[_0x7064('0x2f')](_0x3c73a6[_0x7064('0x32')],qs[_0x7064('0x31')](_0x388a59[_0x7064('0x2d')]['fields']));_0x22a0bd['attributes']=_0x22a0bd[_0x7064('0x30')][_0x7064('0x4c')]?_0x22a0bd[_0x7064('0x30')]:_0x3c73a6[_0x7064('0x32')];if(_0x388a59[_0x7064('0x2d')][_0x7064('0x3e')]){_0x22a0bd[_0x7064('0x3f')]=[{'all':!![]}];}_0x22a0bd=_['merge']({},_0x22a0bd,_0x388a59[_0x7064('0x3c')]);return db['Campaign'][_0x7064('0x4d')](_0x22a0bd)[_0x7064('0x22')](handleEntityNotFound(_0x10c14b,null))['then'](function(_0x3c16a5){if(_0x3c16a5){var _0xc26fc1=_0x3c16a5[_0x7064('0x47')]({'plain':!![]});_0xc26fc1=qs[_0x7064('0x4e')](_0xc26fc1,['id',_0x7064('0x4f'),_0x7064('0x50')]);_0x388a59[_0x7064('0x51')]=_[_0x7064('0x4e')](_0x388a59[_0x7064('0x51')],['id','createdAt',_0x7064('0x50')]);return db[_0x7064('0x3d')][_0x7064('0x44')](_['merge'](_0xc26fc1,_0x388a59['body']),{'include':_0x388a59[_0x7064('0x2d')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x3f5275){var _0x4d71f9=_0x388a59[_0x7064('0x46')][_0x7064('0x47')]({'plain':!![]});if(!_0x4d71f9)throw new Error(_0x7064('0x45'));if(_0x4d71f9[_0x7064('0x52')]===_0x7064('0x46')){var _0x4fb294=_0x3f5275['get']({'plain':!![]});var _0x47e7f4='IvrCampaigns';return db['UserProfileSection'][_0x7064('0x4d')]({'where':{'name':_0x47e7f4,'userProfileId':_0x4d71f9[_0x7064('0x53')]},'raw':!![]})[_0x7064('0x22')](function(_0x22b5d1){if(_0x22b5d1&&_0x22b5d1[_0x7064('0x49')]===0x0){return db[_0x7064('0x24')][_0x7064('0x44')]({'name':_0x4fb294[_0x7064('0x27')],'resourceId':_0x4fb294['id'],'type':_0x22b5d1[_0x7064('0x27')],'sectionId':_0x22b5d1['id']},{})['then'](function(){return _0x3f5275;});}else{return _0x3f5275;}})['catch'](function(_0xf9ceda){logger[_0x7064('0x25')](_0x7064('0x54'),_0xf9ceda);throw _0xf9ceda;});}return _0x3f5275;});}})[_0x7064('0x22')](respondWithResult(_0x10c14b,0xc9))['catch'](handleError(_0x10c14b,null));};exports['update']=function(_0xe7fb0e,_0x1457f7){if(_0xe7fb0e[_0x7064('0x51')]['id']){delete _0xe7fb0e[_0x7064('0x51')]['id'];}return db['Campaign'][_0x7064('0x4d')]({'where':{'id':_0xe7fb0e[_0x7064('0x43')]['id']}})[_0x7064('0x22')](handleEntityNotFound(_0x1457f7,null))[_0x7064('0x22')](saveUpdates(_0xe7fb0e[_0x7064('0x51')],null))[_0x7064('0x22')](respondWithResult(_0x1457f7,null))[_0x7064('0x42')](handleError(_0x1457f7,null));};exports[_0x7064('0x55')]=function(_0x5ec835,_0xc71b4a){return db[_0x7064('0x3d')][_0x7064('0x4d')]({'where':{'id':_0x5ec835[_0x7064('0x43')]['id']}})[_0x7064('0x22')](handleEntityNotFound(_0xc71b4a,null))[_0x7064('0x22')](removeEntity(_0xc71b4a,null))['catch'](handleError(_0xc71b4a,null));};exports[_0x7064('0x56')]=function(_0xf94d89,_0x17dbdb,_0x37cbc5){var _0x4c08f2={'raw':!![],'where':{}};var _0x158a10={};var _0x4d194a={'count':0x0,'rows':[]};return db[_0x7064('0x3d')]['findOne']({'where':{'id':_0xf94d89[_0x7064('0x43')]['id']}})[_0x7064('0x22')](handleEntityNotFound(_0x17dbdb,null))[_0x7064('0x22')](function(_0x2eb5cd){if(_0x2eb5cd){_0x158a10[_0x7064('0x32')]=_['keys'](db[_0x7064('0x57')][_0x7064('0x4b')]);_0x158a10[_0x7064('0x2d')]=_['keys'](_0xf94d89[_0x7064('0x2d')]);_0x158a10[_0x7064('0x38')]=_[_0x7064('0x2f')](_0x158a10[_0x7064('0x32')],_0x158a10[_0x7064('0x2d')]);_0x4c08f2[_0x7064('0x30')]=_[_0x7064('0x2f')](_0x158a10['model'],qs['fields'](_0xf94d89[_0x7064('0x2d')][_0x7064('0x31')]));_0x4c08f2[_0x7064('0x30')]=_0x4c08f2[_0x7064('0x30')][_0x7064('0x4c')]?_0x4c08f2[_0x7064('0x30')]:_0x158a10[_0x7064('0x32')];if(!_0xf94d89[_0x7064('0x2d')]['hasOwnProperty'](_0x7064('0x34'))){_0x4c08f2['limit']=qs[_0x7064('0x1d')](_0xf94d89[_0x7064('0x2d')][_0x7064('0x1d')]);_0x4c08f2[_0x7064('0x1a')]=qs[_0x7064('0x1a')](_0xf94d89[_0x7064('0x2d')]['offset']);}_0x4c08f2[_0x7064('0x35')]=qs[_0x7064('0x36')](_0xf94d89[_0x7064('0x2d')]['sort']);_0x4c08f2[_0x7064('0x37')]=qs[_0x7064('0x38')](_['pick'](_0xf94d89[_0x7064('0x2d')],_0x158a10[_0x7064('0x38')]));_0x4c08f2[_0x7064('0x37')][_0x7064('0x58')]=_0x2eb5cd['id'];if(_0xf94d89[_0x7064('0x2d')][_0x7064('0x3a')]){_0x4c08f2[_0x7064('0x37')]=_[_0x7064('0x3b')](_0x4c08f2[_0x7064('0x37')],{'$or':_[_0x7064('0x2c')](_0x4c08f2[_0x7064('0x30')],function(_0x596d8f){var _0x53fad1={};_0x53fad1[_0x596d8f]={'$like':'%'+_0xf94d89[_0x7064('0x2d')][_0x7064('0x3a')]+'%'};return _0x53fad1;})});}_0x4c08f2=_[_0x7064('0x3b')]({},_0x4c08f2,_0xf94d89[_0x7064('0x3c')]);return db[_0x7064('0x57')][_0x7064('0x1c')]({'where':_0x4c08f2[_0x7064('0x37')]})['then'](function(_0x54e172){_0x4d194a[_0x7064('0x1c')]=_0x54e172;if(_0xf94d89[_0x7064('0x2d')]['includeAll']){_0x4c08f2[_0x7064('0x3f')]=[{'all':!![]}];}return db[_0x7064('0x57')][_0x7064('0x40')](_0x4c08f2);})[_0x7064('0x22')](function(_0x520ac5){_0x4d194a[_0x7064('0x41')]=_0x520ac5;return _0x4d194a;});}})[_0x7064('0x22')](respondWithFilteredResult(_0x17dbdb,_0x4c08f2))[_0x7064('0x42')](handleError(_0x17dbdb,null));};exports[_0x7064('0x59')]=function(_0x3c51b7,_0xe0995a,_0x2a39c2){var _0x343e44={'raw':!![],'where':{}};var _0x5784e4={};var _0x281bcb={'count':0x0,'rows':[]};return db[_0x7064('0x3d')][_0x7064('0x5a')]({'where':{'id':_0x3c51b7[_0x7064('0x43')]['id']}})['then'](handleEntityNotFound(_0xe0995a,null))['then'](function(_0x1e5e14){if(_0x1e5e14){_0x5784e4['model']=_[_0x7064('0x2e')](db[_0x7064('0x5b')][_0x7064('0x4b')]);_0x5784e4[_0x7064('0x2d')]=_[_0x7064('0x2e')](_0x3c51b7[_0x7064('0x2d')]);_0x5784e4[_0x7064('0x38')]=_['intersection'](_0x5784e4[_0x7064('0x32')],_0x5784e4['query']);_0x343e44[_0x7064('0x30')]=_['intersection'](_0x5784e4['model'],qs[_0x7064('0x31')](_0x3c51b7[_0x7064('0x2d')][_0x7064('0x31')]));_0x343e44[_0x7064('0x30')]=_0x343e44[_0x7064('0x30')]['length']?_0x343e44['attributes']:_0x5784e4['model'];if(!_0x3c51b7[_0x7064('0x2d')][_0x7064('0x33')]('nolimit')){_0x343e44[_0x7064('0x1d')]=qs[_0x7064('0x1d')](_0x3c51b7[_0x7064('0x2d')]['limit']);_0x343e44[_0x7064('0x1a')]=qs['offset'](_0x3c51b7[_0x7064('0x2d')][_0x7064('0x1a')]);}_0x343e44[_0x7064('0x35')]=qs['sort'](_0x3c51b7['query']['sort']);_0x343e44[_0x7064('0x37')]=qs[_0x7064('0x38')](_['pick'](_0x3c51b7[_0x7064('0x2d')],_0x5784e4[_0x7064('0x38')]));_0x343e44[_0x7064('0x37')]['CampaignId']=_0x1e5e14['id'];if(_0x3c51b7[_0x7064('0x2d')][_0x7064('0x3a')]){_0x343e44[_0x7064('0x37')]=_[_0x7064('0x3b')](_0x343e44['where'],{'$or':_[_0x7064('0x2c')](_0x343e44[_0x7064('0x30')],function(_0x8450fc){var _0x4cffb4={};_0x4cffb4[_0x8450fc]={'$like':'%'+_0x3c51b7[_0x7064('0x2d')][_0x7064('0x3a')]+'%'};return _0x4cffb4;})});}_0x343e44=_['merge']({},_0x343e44,_0x3c51b7[_0x7064('0x3c')]);return db['CmHopperHistory'][_0x7064('0x1c')]({'where':_0x343e44[_0x7064('0x37')]})['then'](function(_0x5b0d95){_0x281bcb['count']=_0x5b0d95;if(_0x3c51b7[_0x7064('0x2d')][_0x7064('0x3e')]){_0x343e44[_0x7064('0x3f')]=[{'all':!![]}];}return db[_0x7064('0x5b')][_0x7064('0x40')](_0x343e44);})['then'](function(_0x3c2fb4){_0x281bcb[_0x7064('0x41')]=_0x3c2fb4;return _0x281bcb;});}})['then'](respondWithFilteredResult(_0xe0995a,_0x343e44))['catch'](handleError(_0xe0995a,null));};exports['getHopperFinals']=function(_0x3e2524,_0x50a8a4,_0x14440c){var _0x3c66a1={'raw':!![],'where':{}};var _0x510e3={};var _0x18afb6={'count':0x0,'rows':[]};return db['Campaign'][_0x7064('0x5a')]({'where':{'id':_0x3e2524['params']['id']}})[_0x7064('0x22')](handleEntityNotFound(_0x50a8a4,null))[_0x7064('0x22')](function(_0x553210){if(_0x553210){_0x510e3[_0x7064('0x32')]=_[_0x7064('0x2e')](db[_0x7064('0x5c')][_0x7064('0x4b')]);_0x510e3[_0x7064('0x2d')]=_['keys'](_0x3e2524['query']);_0x510e3['filters']=_[_0x7064('0x2f')](_0x510e3['model'],_0x510e3[_0x7064('0x2d')]);_0x3c66a1[_0x7064('0x30')]=_[_0x7064('0x2f')](_0x510e3[_0x7064('0x32')],qs['fields'](_0x3e2524[_0x7064('0x2d')][_0x7064('0x31')]));_0x3c66a1[_0x7064('0x30')]=_0x3c66a1[_0x7064('0x30')][_0x7064('0x4c')]?_0x3c66a1[_0x7064('0x30')]:_0x510e3[_0x7064('0x32')];if(!_0x3e2524['query'][_0x7064('0x33')](_0x7064('0x34'))){_0x3c66a1['limit']=qs[_0x7064('0x1d')](_0x3e2524[_0x7064('0x2d')][_0x7064('0x1d')]);_0x3c66a1['offset']=qs[_0x7064('0x1a')](_0x3e2524['query'][_0x7064('0x1a')]);}_0x3c66a1[_0x7064('0x35')]=qs[_0x7064('0x36')](_0x3e2524[_0x7064('0x2d')]['sort']);_0x3c66a1[_0x7064('0x37')]=qs[_0x7064('0x38')](_[_0x7064('0x39')](_0x3e2524[_0x7064('0x2d')],_0x510e3[_0x7064('0x38')]));_0x3c66a1[_0x7064('0x37')][_0x7064('0x58')]=_0x553210['id'];if(_0x3e2524['query']['filter']){_0x3c66a1[_0x7064('0x37')]=_[_0x7064('0x3b')](_0x3c66a1[_0x7064('0x37')],{'$or':_['map'](_0x3c66a1[_0x7064('0x30')],function(_0x17fdb1){var _0x4af513={};_0x4af513[_0x17fdb1]={'$like':'%'+_0x3e2524[_0x7064('0x2d')]['filter']+'%'};return _0x4af513;})});}_0x3c66a1=_['merge']({},_0x3c66a1,_0x3e2524[_0x7064('0x3c')]);return db['CmHopperFinal'][_0x7064('0x1c')]({'where':_0x3c66a1[_0x7064('0x37')]})['then'](function(_0x49da1d){_0x18afb6['count']=_0x49da1d;if(_0x3e2524[_0x7064('0x2d')][_0x7064('0x3e')]){_0x3c66a1[_0x7064('0x3f')]=[{'all':!![]}];}return db[_0x7064('0x5c')][_0x7064('0x40')](_0x3c66a1);})[_0x7064('0x22')](function(_0x5f9ec9){_0x18afb6[_0x7064('0x41')]=_0x5f9ec9;return _0x18afb6;});}})[_0x7064('0x22')](respondWithFilteredResult(_0x50a8a4,_0x3c66a1))['catch'](handleError(_0x50a8a4,null));};exports[_0x7064('0x5d')]=function(_0x331edd,_0x31df93,_0x3e81dc){var _0x434dae={'raw':!![],'where':{}};var _0x5a561c={};var _0x306ebe={'count':0x0,'rows':[]};return db['Campaign'][_0x7064('0x5a')]({'where':{'id':_0x331edd[_0x7064('0x43')]['id']}})[_0x7064('0x22')](handleEntityNotFound(_0x31df93,null))[_0x7064('0x22')](function(_0x1e3d34){if(_0x1e3d34){_0x5a561c[_0x7064('0x32')]=_[_0x7064('0x2e')](db[_0x7064('0x5e')]['rawAttributes']);_0x5a561c[_0x7064('0x2d')]=_[_0x7064('0x2e')](_0x331edd[_0x7064('0x2d')]);_0x5a561c[_0x7064('0x38')]=_['intersection'](_0x5a561c[_0x7064('0x32')],_0x5a561c['query']);_0x434dae[_0x7064('0x30')]=_[_0x7064('0x2f')](_0x5a561c[_0x7064('0x32')],qs[_0x7064('0x31')](_0x331edd['query'][_0x7064('0x31')]));_0x434dae[_0x7064('0x30')]=_0x434dae[_0x7064('0x30')][_0x7064('0x4c')]?_0x434dae[_0x7064('0x30')]:_0x5a561c['model'];if(!_0x331edd[_0x7064('0x2d')]['hasOwnProperty'](_0x7064('0x34'))){_0x434dae[_0x7064('0x1d')]=qs['limit'](_0x331edd[_0x7064('0x2d')][_0x7064('0x1d')]);_0x434dae[_0x7064('0x1a')]=qs[_0x7064('0x1a')](_0x331edd['query'][_0x7064('0x1a')]);}_0x434dae[_0x7064('0x35')]=qs[_0x7064('0x36')](_0x331edd[_0x7064('0x2d')][_0x7064('0x36')]);_0x434dae[_0x7064('0x37')]=qs[_0x7064('0x38')](_[_0x7064('0x39')](_0x331edd[_0x7064('0x2d')],_0x5a561c[_0x7064('0x38')]));_0x434dae['where'][_0x7064('0x58')]=_0x1e3d34['id'];if(_0x331edd[_0x7064('0x2d')][_0x7064('0x3a')]){_0x434dae['where']=_[_0x7064('0x3b')](_0x434dae[_0x7064('0x37')],{'$or':_['map'](_0x434dae[_0x7064('0x30')],function(_0x26e373){var _0xa140d6={};_0xa140d6[_0x26e373]={'$like':'%'+_0x331edd['query'][_0x7064('0x3a')]+'%'};return _0xa140d6;})});}_0x434dae=_[_0x7064('0x3b')]({},_0x434dae,_0x331edd[_0x7064('0x3c')]);return db[_0x7064('0x5e')][_0x7064('0x1c')]({'where':_0x434dae['where']})[_0x7064('0x22')](function(_0x589c92){_0x306ebe[_0x7064('0x1c')]=_0x589c92;if(_0x331edd[_0x7064('0x2d')]['includeAll']){_0x434dae[_0x7064('0x3f')]=[{'all':!![]}];}return db[_0x7064('0x5e')]['findAll'](_0x434dae);})[_0x7064('0x22')](function(_0x5a6d9e){_0x306ebe['rows']=_0x5a6d9e;return _0x306ebe;});}})['then'](respondWithFilteredResult(_0x31df93,_0x434dae))['catch'](handleError(_0x31df93,null));};exports[_0x7064('0x5f')]=function(_0x24cc3c,_0x5e5d29,_0x4d47cb){var _0x5c61a0={};var _0x8d755e={};var _0x710297;var _0x50ebfe;return db[_0x7064('0x3d')][_0x7064('0x5a')]({'where':{'id':_0x24cc3c[_0x7064('0x43')]['id']}})[_0x7064('0x22')](handleEntityNotFound(_0x5e5d29,null))[_0x7064('0x22')](function(_0x771372){if(_0x771372){_0x710297=_0x771372;_0x8d755e[_0x7064('0x32')]=_[_0x7064('0x2e')](db[_0x7064('0x60')][_0x7064('0x4b')]);_0x8d755e['query']=_[_0x7064('0x2e')](_0x24cc3c[_0x7064('0x2d')]);_0x8d755e[_0x7064('0x38')]=_[_0x7064('0x2f')](_0x8d755e[_0x7064('0x32')],_0x8d755e[_0x7064('0x2d')]);_0x5c61a0[_0x7064('0x30')]=_['intersection'](_0x8d755e[_0x7064('0x32')],qs[_0x7064('0x31')](_0x24cc3c[_0x7064('0x2d')][_0x7064('0x31')]));_0x5c61a0['attributes']=_0x5c61a0[_0x7064('0x30')]['length']?_0x5c61a0['attributes']:_0x8d755e[_0x7064('0x32')];_0x5c61a0[_0x7064('0x35')]=qs[_0x7064('0x36')](_0x24cc3c[_0x7064('0x2d')][_0x7064('0x36')]);_0x5c61a0[_0x7064('0x37')]=qs[_0x7064('0x38')](_['pick'](_0x24cc3c['query'],_0x8d755e['filters']));if(_0x24cc3c[_0x7064('0x2d')]['filter']){_0x5c61a0[_0x7064('0x37')]=_[_0x7064('0x3b')](_0x5c61a0[_0x7064('0x37')],{'$or':_[_0x7064('0x2c')](_0x5c61a0[_0x7064('0x30')],function(_0x34e187){var _0x211d94={};_0x211d94[_0x34e187]={'$like':'%'+_0x24cc3c[_0x7064('0x2d')]['filter']+'%'};return _0x211d94;})});}_0x5c61a0=_[_0x7064('0x3b')]({},_0x5c61a0,_0x24cc3c['options']);return _0x710297[_0x7064('0x5f')](_0x5c61a0);}})[_0x7064('0x22')](function(_0x4ef45b){if(_0x4ef45b){_0x50ebfe=_0x4ef45b['length'];if(!_0x24cc3c[_0x7064('0x2d')][_0x7064('0x33')]('nolimit')){_0x5c61a0[_0x7064('0x1d')]=qs['limit'](_0x24cc3c[_0x7064('0x2d')][_0x7064('0x1d')]);_0x5c61a0[_0x7064('0x1a')]=qs[_0x7064('0x1a')](_0x24cc3c[_0x7064('0x2d')]['offset']);}return _0x710297['getLists'](_0x5c61a0);}})[_0x7064('0x22')](function(_0xe1d574){if(_0xe1d574){return _0xe1d574?{'count':_0x50ebfe,'rows':_0xe1d574}:null;}})[_0x7064('0x22')](respondWithResult(_0x5e5d29,null))[_0x7064('0x42')](handleError(_0x5e5d29,null));};exports[_0x7064('0x61')]=function(_0x8c906d,_0x3b00d2,_0x3b7629){var _0x2aa6dc,_0x14c746;var _0x2355de=[];var _0x1b8159=moment()['format'](_0x7064('0x62'));return db[_0x7064('0x3d')][_0x7064('0x4d')]({'where':{'id':_0x8c906d[_0x7064('0x43')]['id']}})[_0x7064('0x22')](handleEntityNotFound(_0x3b00d2,null))[_0x7064('0x22')](function(_0x109b58){if(_0x109b58){_0x14c746=_0x109b58;return _0x109b58[_0x7064('0x61')](_0x8c906d['body'][_0x7064('0x63')],_[_0x7064('0x4e')](_0x8c906d['body'],[_0x7064('0x63'),'id'])||{});}return null;})[_0x7064('0x64')](function(_0x155196){var _0x1cc3dc;var _0x5d774b;_0x2aa6dc=_0x155196||[];var _0x187826=[];if(_0x155196){for(var _0x41bde3=0x0;_0x41bde3<_0x155196['length'];_0x41bde3+=0x1){var _0xa3d60e=_0x155196[_0x41bde3][_0x7064('0x47')]({'plain':!![]});_0x14c746[_0x7064('0x65')]=_0x8c906d[_0x7064('0x51')][_0x7064('0x65')]?_0x8c906d[_0x7064('0x51')][_0x7064('0x65')]:_0x14c746[_0x7064('0x65')];switch(_0x14c746[_0x7064('0x65')]){case _0x7064('0x66'):_0x1cc3dc=squel['insert']()['into'](_0x7064('0x67'))[_0x7064('0x68')]([_0x7064('0x69'),_0x7064('0x6a'),_0x7064('0x6b'),_0x7064('0x6c'),_0x7064('0x58'),'createdAt','updatedAt'],squel['select']()['field'](_0x7064('0x69'),'phone')['field'](_0x7064('0x6d'),_0x7064('0x6a'))['field']('id','ContactId')[_0x7064('0x6e')](_0xa3d60e['CmListId'][_0x7064('0x6f')](),'ListId')[_0x7064('0x6e')](_0x8c906d[_0x7064('0x43')]['id']['toString'](),'CampaignId')[_0x7064('0x6e')]('\x27'+_0x1b8159+'\x27',_0x7064('0x4f'))[_0x7064('0x6e')]('\x27'+_0x1b8159+'\x27',_0x7064('0x50'))[_0x7064('0x70')]('cm_contacts')[_0x7064('0x37')](_0x7064('0x71'))[_0x7064('0x37')](_0x7064('0x72'),_0xa3d60e[_0x7064('0x73')][_0x7064('0x6f')]())[_0x7064('0x37')](_0x7064('0x74'))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x7064('0x75')]()[_0x7064('0x6e')](_0x7064('0x76'))[_0x7064('0x70')]('cm_hopper_final')['where'](_0x7064('0x77'),_0x8c906d[_0x7064('0x43')]['id'][_0x7064('0x6f')]()))[_0x7064('0x37')](_0x7064('0x78'),squel[_0x7064('0x75')]()[_0x7064('0x6e')]('COALESCE(phone,\x27\x27)')[_0x7064('0x70')](_0x7064('0x67'))[_0x7064('0x37')](_0x7064('0x77'),_0x8c906d[_0x7064('0x43')]['id'][_0x7064('0x6f')]())))[_0x7064('0x6f')]();break;case _0x7064('0x79'):_0x1cc3dc=squel['insert']()['into'](_0x7064('0x67'))['fromQuery']([_0x7064('0x69'),_0x7064('0x6a'),_0x7064('0x6b'),_0x7064('0x6c'),_0x7064('0x58'),_0x7064('0x4f'),'updatedAt'],squel[_0x7064('0x75')]()[_0x7064('0x6e')](_0x7064('0x69'),_0x7064('0x69'))['field']('NOW()',_0x7064('0x6a'))[_0x7064('0x6e')]('id',_0x7064('0x6b'))['field'](_0xa3d60e[_0x7064('0x73')][_0x7064('0x6f')](),'ListId')[_0x7064('0x6e')](_0x8c906d['params']['id'][_0x7064('0x6f')](),_0x7064('0x58'))[_0x7064('0x6e')]('\x27'+_0x1b8159+'\x27',_0x7064('0x4f'))['field']('\x27'+_0x1b8159+'\x27',_0x7064('0x50'))[_0x7064('0x70')](_0x7064('0x7a'))['where']('deletedAt\x20IS\x20NULL')['where'](_0x7064('0x72'),_0xa3d60e[_0x7064('0x73')][_0x7064('0x6f')]())[_0x7064('0x37')](_0x7064('0x74'))['where'](_0x7064('0x78'),squel[_0x7064('0x75')]()[_0x7064('0x6e')](_0x7064('0x7b'))[_0x7064('0x70')](_0x7064('0x67'))[_0x7064('0x37')](_0x7064('0x77'),_0x8c906d[_0x7064('0x43')]['id'][_0x7064('0x6f')]())))['toString']();break;default:_0x1cc3dc=squel[_0x7064('0x7c')]()[_0x7064('0x7d')](_0x7064('0x67'))[_0x7064('0x68')]([_0x7064('0x69'),_0x7064('0x6a'),'ContactId','ListId',_0x7064('0x58'),_0x7064('0x4f'),_0x7064('0x50')],squel[_0x7064('0x75')]()[_0x7064('0x6e')](_0x7064('0x69'),_0x7064('0x69'))[_0x7064('0x6e')]('NOW()','scheduledAt')['field']('id',_0x7064('0x6b'))['field'](_0xa3d60e[_0x7064('0x73')]['toString'](),_0x7064('0x6c'))['field'](_0x8c906d[_0x7064('0x43')]['id'][_0x7064('0x6f')](),_0x7064('0x58'))[_0x7064('0x6e')]('\x27'+_0x1b8159+'\x27',_0x7064('0x4f'))[_0x7064('0x6e')]('\x27'+_0x1b8159+'\x27',_0x7064('0x50'))[_0x7064('0x70')](_0x7064('0x7a'))[_0x7064('0x37')](_0x7064('0x71'))['where'](_0x7064('0x72'),_0xa3d60e[_0x7064('0x73')][_0x7064('0x6f')]())[_0x7064('0x37')](_0x7064('0x74')))[_0x7064('0x6f')]();}_0x5d774b=squel[_0x7064('0x7c')]()[_0x7064('0x7d')](_0x7064('0x7e'))[_0x7064('0x68')]([_0x7064('0x7f'),_0x7064('0x6a'),_0x7064('0x69'),_0x7064('0x80'),_0x7064('0x4f'),_0x7064('0x50')],squel[_0x7064('0x75')]()[_0x7064('0x6e')](_0x7064('0x81'),'id')[_0x7064('0x6e')]('NOW()',_0x7064('0x6a'))[_0x7064('0x6e')]('ci.item',_0x7064('0x69'))[_0x7064('0x6e')](_0x7064('0x82'),_0x7064('0x80'))[_0x7064('0x6e')]('\x27'+_0x1b8159+'\x27',_0x7064('0x4f'))[_0x7064('0x6e')]('\x27'+_0x1b8159+'\x27',_0x7064('0x50'))['from'](_0x7064('0x83'),'ci')[_0x7064('0x84')](_0x7064('0x67'),'h',_0x7064('0x85'))[_0x7064('0x37')](_0x7064('0x86'),_0xa3d60e['CmListId'][_0x7064('0x6f')]())[_0x7064('0x37')](_0x7064('0x87'),_0x8c906d[_0x7064('0x43')]['id']['toString']())[_0x7064('0x37')](_0x7064('0x88'),_0x1b8159))[_0x7064('0x6f')]();_0x187826[_0x7064('0x89')](db[_0x7064('0x8a')][_0x7064('0x2d')](_0x1cc3dc));_0x2355de[_0x7064('0x89')](db[_0x7064('0x8a')][_0x7064('0x2d')](_0x5d774b));}return BPromise[_0x7064('0x8b')](_0x187826);}})[_0x7064('0x22')](function(){return BPromise[_0x7064('0x8b')](_0x2355de);})['then'](function(){return _0x2aa6dc;})[_0x7064('0x22')](respondWithResult(_0x3b00d2,null))['catch'](handleError(_0x3b00d2,null));};exports[_0x7064('0x8c')]=function(_0x1d14de,_0x300bba,_0x3fc398){return db[_0x7064('0x3d')][_0x7064('0x4d')]({'where':{'id':_0x1d14de[_0x7064('0x43')]['id']}})[_0x7064('0x22')](handleEntityNotFound(_0x300bba,null))['then'](function(_0x5f4db2){if(_0x5f4db2){return _0x5f4db2[_0x7064('0x8c')](_0x1d14de[_0x7064('0x2d')][_0x7064('0x63')]);}})[_0x7064('0x22')](function(_0x5d080f){if(_0x5d080f){return db[_0x7064('0x57')]['destroy']({'where':{'ListId':_0x1d14de['query'][_0x7064('0x63')],'CampaignId':_0x1d14de['params']['id']}})[_0x7064('0x22')](function(){return _0x5d080f;});}})[_0x7064('0x22')](respondWithStatusCode(_0x300bba,null))[_0x7064('0x42')](handleError(_0x300bba,null));};exports['getBlackLists']=function(_0x204954,_0x4c82d2,_0x46d142){var _0x2663b6={};var _0x5608ea={};var _0x3c5c30;var _0x2a7226;return db[_0x7064('0x3d')][_0x7064('0x5a')]({'where':{'id':_0x204954[_0x7064('0x43')]['id']}})['then'](handleEntityNotFound(_0x4c82d2,null))['then'](function(_0x540fae){if(_0x540fae){_0x3c5c30=_0x540fae;_0x5608ea[_0x7064('0x32')]=_[_0x7064('0x2e')](db[_0x7064('0x60')][_0x7064('0x4b')]);_0x5608ea[_0x7064('0x2d')]=_[_0x7064('0x2e')](_0x204954[_0x7064('0x2d')]);_0x5608ea[_0x7064('0x38')]=_[_0x7064('0x2f')](_0x5608ea[_0x7064('0x32')],_0x5608ea[_0x7064('0x2d')]);_0x2663b6[_0x7064('0x30')]=_['intersection'](_0x5608ea[_0x7064('0x32')],qs[_0x7064('0x31')](_0x204954[_0x7064('0x2d')]['fields']));_0x2663b6[_0x7064('0x30')]=_0x2663b6[_0x7064('0x30')][_0x7064('0x4c')]?_0x2663b6[_0x7064('0x30')]:_0x5608ea[_0x7064('0x32')];_0x2663b6['order']=qs['sort'](_0x204954[_0x7064('0x2d')][_0x7064('0x36')]);_0x2663b6[_0x7064('0x37')]=qs[_0x7064('0x38')](_['pick'](_0x204954[_0x7064('0x2d')],_0x5608ea['filters']));if(_0x204954[_0x7064('0x2d')][_0x7064('0x3a')]){_0x2663b6['where']=_[_0x7064('0x3b')](_0x2663b6[_0x7064('0x37')],{'$or':_['map'](_0x2663b6[_0x7064('0x30')],function(_0x5b2206){var _0x502520={};_0x502520[_0x5b2206]={'$like':'%'+_0x204954[_0x7064('0x2d')][_0x7064('0x3a')]+'%'};return _0x502520;})});}_0x2663b6=_[_0x7064('0x3b')]({},_0x2663b6,_0x204954[_0x7064('0x3c')]);return _0x3c5c30[_0x7064('0x8d')](_0x2663b6);}})['then'](function(_0x47fb5c){if(_0x47fb5c){_0x2a7226=_0x47fb5c[_0x7064('0x4c')];if(!_0x204954[_0x7064('0x2d')][_0x7064('0x33')](_0x7064('0x34'))){_0x2663b6[_0x7064('0x1d')]=qs[_0x7064('0x1d')](_0x204954['query'][_0x7064('0x1d')]);_0x2663b6[_0x7064('0x1a')]=qs[_0x7064('0x1a')](_0x204954['query'][_0x7064('0x1a')]);}return _0x3c5c30[_0x7064('0x8d')](_0x2663b6);}})[_0x7064('0x22')](function(_0x5d8c1b){if(_0x5d8c1b){return _0x5d8c1b?{'count':_0x2a7226,'rows':_0x5d8c1b}:null;}})[_0x7064('0x22')](respondWithResult(_0x4c82d2,null))[_0x7064('0x42')](handleError(_0x4c82d2,null));};exports[_0x7064('0x8e')]=function(_0x5662e9,_0x5e0899,_0x51ee08){var _0x4e52b8,_0x4d91e0;var _0x26c475=[];var _0x11bd8e=moment()[_0x7064('0x8f')](_0x7064('0x62'));return db[_0x7064('0x3d')][_0x7064('0x4d')]({'where':{'id':_0x5662e9[_0x7064('0x43')]['id']}})[_0x7064('0x22')](handleEntityNotFound(_0x5e0899,null))[_0x7064('0x22')](function(_0x3a693a){if(_0x3a693a){_0x4d91e0=_0x3a693a;return _0x3a693a[_0x7064('0x8e')](_0x5662e9[_0x7064('0x51')][_0x7064('0x63')],_[_0x7064('0x4e')](_0x5662e9[_0x7064('0x51')],['ids','id'])||{});}return null;})[_0x7064('0x64')](function(_0x196ef9){var _0xb89e04;var _0x904c1b;_0x4e52b8=_0x196ef9||[];var _0x5ac7b0=[];if(_0x196ef9){for(var _0x41ee85=0x0;_0x41ee85<_0x196ef9[_0x7064('0x4c')];_0x41ee85+=0x1){var _0x49be4b=_0x196ef9[_0x41ee85]['get']({'plain':!![]});_0xb89e04=squel[_0x7064('0x7c')]()[_0x7064('0x7d')](_0x7064('0x90'))[_0x7064('0x68')]([_0x7064('0x69'),_0x7064('0x6b'),'ListId',_0x7064('0x58'),'createdAt',_0x7064('0x50')],squel[_0x7064('0x75')]()[_0x7064('0x6e')](_0x7064('0x69'),'phone')[_0x7064('0x6e')]('id',_0x7064('0x6b'))[_0x7064('0x6e')](_0x49be4b['CmListId'][_0x7064('0x6f')](),'ListId')['field'](_0x5662e9[_0x7064('0x43')]['id'][_0x7064('0x6f')](),'CampaignId')[_0x7064('0x6e')](_0x7064('0x6d'),_0x7064('0x4f'))[_0x7064('0x6e')](_0x7064('0x6d'),_0x7064('0x50'))[_0x7064('0x70')]('cm_contacts')[_0x7064('0x37')]('deletedAt\x20IS\x20NULL')[_0x7064('0x37')](_0x7064('0x72'),_0x49be4b[_0x7064('0x73')][_0x7064('0x6f')]())[_0x7064('0x37')](_0x7064('0x74')))['toString']();_0x5ac7b0[_0x7064('0x89')](db['sequelize']['query'](_0xb89e04));}return BPromise['all'](_0x5ac7b0);}})['then'](function(){return _0x4e52b8;})[_0x7064('0x22')](respondWithResult(_0x5e0899,null))[_0x7064('0x42')](handleError(_0x5e0899,null));};exports[_0x7064('0x91')]=function(_0x205f3f,_0x1bd14f,_0x3b6a67){return db[_0x7064('0x3d')]['find']({'where':{'id':_0x205f3f[_0x7064('0x43')]['id']}})[_0x7064('0x22')](handleEntityNotFound(_0x1bd14f,null))['then'](function(_0x544db7){if(_0x544db7){return _0x544db7[_0x7064('0x91')](_0x205f3f[_0x7064('0x2d')]['ids']);}})[_0x7064('0x22')](function(_0x80c877){if(_0x80c877){return db[_0x7064('0x5e')][_0x7064('0x55')]({'where':{'ListId':_0x205f3f[_0x7064('0x2d')][_0x7064('0x63')],'CampaignId':_0x205f3f[_0x7064('0x43')]['id']}})[_0x7064('0x22')](function(){return _0x80c877;});}})[_0x7064('0x22')](respondWithStatusCode(_0x1bd14f,null))[_0x7064('0x42')](handleError(_0x1bd14f,null));}; \ No newline at end of file +var _0x1eba=['COALESCE(phone,\x27\x27)','CampaignId\x20=\x20?','into','cm_contacts','cm_hopper_additional_phones','cmHopperId','OrderBy','h.id','ci.item','ci.OrderBY','cm_contact_has_items','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.CampaignId=?','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','CmList','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','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/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','offset','limit','count','set','Content-Range','reject','save','update','then','destroy','get','IvrCampaigns','UserProfileResource','sendStatus','error','stack','name','index','map','Campaign','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params','keys','include','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','UserProfileSection','getHoppers','findOne','CmHopper','nolimit','CampaignId','getHopperHistories','CmHopperHistory','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','addLists','format','YYYY-MM-DD\x20HH:mm:ss','ids','spread','dialCheckDuplicateType','always','insert','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','createdAt','select','field','NOW()','CmListId','toString','from','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','cm_hopper_final'];(function(_0x24fdf4,_0x171979){var _0xf45e83=function(_0x1c9d98){while(--_0x1c9d98){_0x24fdf4['push'](_0x24fdf4['shift']());}};_0xf45e83(++_0x171979);}(_0x1eba,0x1d7));var _0xa1eb=function(_0x1526e1,_0x5ed5a5){_0x1526e1=_0x1526e1-0x0;var _0x249a1e=_0x1eba[_0x1526e1];return _0x249a1e;};'use strict';var emlformat=require(_0xa1eb('0x0'));var rimraf=require(_0xa1eb('0x1'));var zipdir=require(_0xa1eb('0x2'));var jsonpatch=require(_0xa1eb('0x3'));var rp=require(_0xa1eb('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xa1eb('0x5'));var util=require(_0xa1eb('0x6'));var path=require(_0xa1eb('0x7'));var sox=require(_0xa1eb('0x8'));var csv=require(_0xa1eb('0x9'));var ejs=require(_0xa1eb('0xa'));var fs=require('fs');var fs_extra=require(_0xa1eb('0xb'));var _=require(_0xa1eb('0xc'));var squel=require(_0xa1eb('0xd'));var crypto=require(_0xa1eb('0xe'));var jsforce=require(_0xa1eb('0xf'));var deskjs=require(_0xa1eb('0x10'));var toCsv=require('to-csv');var querystring=require(_0xa1eb('0x11'));var Papa=require('papaparse');var Redis=require(_0xa1eb('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xa1eb('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa1eb('0x14'));var logger=require('../../config/logger')(_0xa1eb('0x15'));var utils=require(_0xa1eb('0x16'));var config=require(_0xa1eb('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xa1eb('0x18'))['db'];function respondWithStatusCode(_0x39b4a3,_0x5df92d){_0x5df92d=_0x5df92d||0xcc;return function(_0x16a623){if(_0x16a623){return _0x39b4a3['sendStatus'](_0x5df92d);}return _0x39b4a3['status'](_0x5df92d)[_0xa1eb('0x19')]();};}function respondWithResult(_0x4c7983,_0x25d058){_0x25d058=_0x25d058||0xc8;return function(_0x2178e2){if(_0x2178e2){return _0x4c7983[_0xa1eb('0x1a')](_0x25d058)[_0xa1eb('0x1b')](_0x2178e2);}};}function respondWithFilteredResult(_0x3cd675,_0x44f37d){return function(_0x1c858c){if(_0x1c858c){var _0x45d6dd=typeof _0x44f37d[_0xa1eb('0x1c')]==='undefined'&&typeof _0x44f37d[_0xa1eb('0x1d')]==='undefined';var _0x1401ef=_0x1c858c[_0xa1eb('0x1e')];var _0x33c4e3=_0x45d6dd?0x0:_0x44f37d[_0xa1eb('0x1c')];var _0x49bfaa=_0x45d6dd?_0x1c858c[_0xa1eb('0x1e')]:_0x44f37d[_0xa1eb('0x1c')]+_0x44f37d[_0xa1eb('0x1d')];var _0xcf45c1;if(_0x49bfaa>=_0x1401ef){_0x49bfaa=_0x1401ef;_0xcf45c1=0xc8;}else{_0xcf45c1=0xce;}_0x3cd675[_0xa1eb('0x1a')](_0xcf45c1);return _0x3cd675[_0xa1eb('0x1f')](_0xa1eb('0x20'),_0x33c4e3+'-'+_0x49bfaa+'/'+_0x1401ef)[_0xa1eb('0x1b')](_0x1c858c);}return null;};}function patchUpdates(_0x4fc14a){return function(_0x137e2c){try{jsonpatch['apply'](_0x137e2c,_0x4fc14a,!![]);}catch(_0x2258d1){return BPromise[_0xa1eb('0x21')](_0x2258d1);}return _0x137e2c[_0xa1eb('0x22')]();};}function saveUpdates(_0x250f99,_0x5e7a34){return function(_0x539634){if(_0x539634){return _0x539634[_0xa1eb('0x23')](_0x250f99)[_0xa1eb('0x24')](function(_0x5b0903){return _0x5b0903;});}return null;};}function removeEntity(_0x437b2a,_0x250728){return function(_0x258d3a){if(_0x258d3a){return _0x258d3a[_0xa1eb('0x25')]()[_0xa1eb('0x24')](function(){var _0x1c59e1=_0x258d3a[_0xa1eb('0x26')]({'plain':!![]});var _0x364b1c=_0xa1eb('0x27');return db[_0xa1eb('0x28')][_0xa1eb('0x25')]({'where':{'type':_0x364b1c,'resourceId':_0x1c59e1['id']}})[_0xa1eb('0x24')](function(){return _0x258d3a;});})['then'](function(){_0x437b2a[_0xa1eb('0x1a')](0xcc)[_0xa1eb('0x19')]();});}};}function handleEntityNotFound(_0x491f37,_0x2680c0){return function(_0x4e2aa7){if(!_0x4e2aa7){_0x491f37[_0xa1eb('0x29')](0x194);}return _0x4e2aa7;};}function handleError(_0x2d31d1,_0x53a890){_0x53a890=_0x53a890||0x1f4;return function(_0x45ff0d){logger[_0xa1eb('0x2a')](_0x45ff0d[_0xa1eb('0x2b')]);if(_0x45ff0d['name']){delete _0x45ff0d[_0xa1eb('0x2c')];}_0x2d31d1[_0xa1eb('0x1a')](_0x53a890)['send'](_0x45ff0d);};}exports[_0xa1eb('0x2d')]=function(_0xb27bf9,_0x401510){var _0x2e281a={},_0x5a6544={},_0x52f9c7={'count':0x0,'rows':[]};var _0x9d49d8=_[_0xa1eb('0x2e')](db[_0xa1eb('0x2f')][_0xa1eb('0x30')],function(_0x383e26){return{'name':_0x383e26[_0xa1eb('0x31')],'type':_0x383e26[_0xa1eb('0x32')][_0xa1eb('0x33')]};});_0x5a6544[_0xa1eb('0x34')]=_[_0xa1eb('0x2e')](_0x9d49d8,_0xa1eb('0x2c'));_0x5a6544['query']=_['keys'](_0xb27bf9[_0xa1eb('0x35')]);_0x5a6544[_0xa1eb('0x36')]=_[_0xa1eb('0x37')](_0x5a6544[_0xa1eb('0x34')],_0x5a6544[_0xa1eb('0x35')]);_0x2e281a['attributes']=_['intersection'](_0x5a6544[_0xa1eb('0x34')],qs[_0xa1eb('0x38')](_0xb27bf9['query']['fields']));_0x2e281a[_0xa1eb('0x39')]=_0x2e281a['attributes'][_0xa1eb('0x3a')]?_0x2e281a['attributes']:_0x5a6544[_0xa1eb('0x34')];if(!_0xb27bf9[_0xa1eb('0x35')][_0xa1eb('0x3b')]('nolimit')){_0x2e281a[_0xa1eb('0x1d')]=qs[_0xa1eb('0x1d')](_0xb27bf9[_0xa1eb('0x35')]['limit']);_0x2e281a[_0xa1eb('0x1c')]=qs[_0xa1eb('0x1c')](_0xb27bf9[_0xa1eb('0x35')][_0xa1eb('0x1c')]);}_0x2e281a[_0xa1eb('0x3c')]=qs['sort'](_0xb27bf9[_0xa1eb('0x35')][_0xa1eb('0x3d')]);_0x2e281a[_0xa1eb('0x3e')]=qs[_0xa1eb('0x36')](_[_0xa1eb('0x3f')](_0xb27bf9[_0xa1eb('0x35')],_0x5a6544[_0xa1eb('0x36')]),_0x9d49d8);if(_0xb27bf9[_0xa1eb('0x35')]['filter']){_0x2e281a[_0xa1eb('0x3e')]=_[_0xa1eb('0x40')](_0x2e281a[_0xa1eb('0x3e')],{'$or':_[_0xa1eb('0x2e')](_0x9d49d8,function(_0x1c390c){if(_0x1c390c['type']!==_0xa1eb('0x41')){var _0x3d28dc={};_0x3d28dc[_0x1c390c[_0xa1eb('0x2c')]]={'$like':'%'+_0xb27bf9['query'][_0xa1eb('0x42')]+'%'};return _0x3d28dc;}})});}_0x2e281a=_[_0xa1eb('0x40')]({},_0x2e281a,_0xb27bf9[_0xa1eb('0x43')]);var _0x13ced7={'where':_0x2e281a[_0xa1eb('0x3e')]};return db[_0xa1eb('0x2f')][_0xa1eb('0x1e')](_0x13ced7)['then'](function(_0x3c8713){_0x52f9c7[_0xa1eb('0x1e')]=_0x3c8713;if(_0xb27bf9['query'][_0xa1eb('0x44')]){_0x2e281a['include']=[{'all':!![]}];}return db[_0xa1eb('0x2f')][_0xa1eb('0x45')](_0x2e281a);})[_0xa1eb('0x24')](function(_0x361675){_0x52f9c7[_0xa1eb('0x46')]=_0x361675;return _0x52f9c7;})[_0xa1eb('0x24')](respondWithFilteredResult(_0x401510,_0x2e281a))[_0xa1eb('0x47')](handleError(_0x401510,null));};exports[_0xa1eb('0x48')]=function(_0x9c297d,_0x44a2de){var _0xd5b217={'raw':![],'where':{'id':_0x9c297d[_0xa1eb('0x49')]['id']}},_0x3c4690={};_0x3c4690[_0xa1eb('0x34')]=_[_0xa1eb('0x4a')](db[_0xa1eb('0x2f')]['rawAttributes']);_0x3c4690[_0xa1eb('0x35')]=_['keys'](_0x9c297d[_0xa1eb('0x35')]);_0x3c4690[_0xa1eb('0x36')]=_['intersection'](_0x3c4690['model'],_0x3c4690[_0xa1eb('0x35')]);_0xd5b217[_0xa1eb('0x39')]=_[_0xa1eb('0x37')](_0x3c4690['model'],qs[_0xa1eb('0x38')](_0x9c297d[_0xa1eb('0x35')][_0xa1eb('0x38')]));_0xd5b217[_0xa1eb('0x39')]=_0xd5b217[_0xa1eb('0x39')][_0xa1eb('0x3a')]?_0xd5b217[_0xa1eb('0x39')]:_0x3c4690[_0xa1eb('0x34')];if(_0x9c297d[_0xa1eb('0x35')][_0xa1eb('0x44')]){_0xd5b217[_0xa1eb('0x4b')]=[{'all':!![]}];}_0xd5b217=_[_0xa1eb('0x40')]({},_0xd5b217,_0x9c297d[_0xa1eb('0x43')]);return db[_0xa1eb('0x2f')]['find'](_0xd5b217)[_0xa1eb('0x24')](handleEntityNotFound(_0x44a2de,null))[_0xa1eb('0x24')](respondWithResult(_0x44a2de,null))[_0xa1eb('0x47')](handleError(_0x44a2de,null));};exports[_0xa1eb('0x4c')]=function(_0x2b0cbf,_0x12dfd4){return db[_0xa1eb('0x2f')]['create'](_0x2b0cbf[_0xa1eb('0x4d')],{})[_0xa1eb('0x24')](function(_0x27021a){var _0x10a6da=_0x2b0cbf[_0xa1eb('0x4e')][_0xa1eb('0x26')]({'plain':!![]});if(!_0x10a6da)throw new Error(_0xa1eb('0x4f'));if(_0x10a6da[_0xa1eb('0x50')]===_0xa1eb('0x4e')){var _0x4f7c05=_0x27021a[_0xa1eb('0x26')]({'plain':!![]});var _0x5c3db1=_0xa1eb('0x27');return db['UserProfileSection'][_0xa1eb('0x51')]({'where':{'name':_0x5c3db1,'userProfileId':_0x10a6da[_0xa1eb('0x52')]},'raw':!![]})[_0xa1eb('0x24')](function(_0x5cc25e){if(_0x5cc25e&&_0x5cc25e[_0xa1eb('0x53')]===0x0){return db[_0xa1eb('0x28')]['create']({'name':_0x4f7c05[_0xa1eb('0x2c')],'resourceId':_0x4f7c05['id'],'type':_0x5cc25e[_0xa1eb('0x2c')],'sectionId':_0x5cc25e['id']},{})[_0xa1eb('0x24')](function(){return _0x27021a;});}else{return _0x27021a;}})[_0xa1eb('0x47')](function(_0x11cc84){logger[_0xa1eb('0x2a')](_0xa1eb('0x54'),_0x11cc84);throw _0x11cc84;});}return _0x27021a;})[_0xa1eb('0x24')](respondWithResult(_0x12dfd4,0xc9))[_0xa1eb('0x47')](handleError(_0x12dfd4,null));};exports[_0xa1eb('0x55')]=function(_0x42519b,_0x4391be){var _0x159a19={'where':{'id':_0x42519b[_0xa1eb('0x49')]['id']}},_0x260c4a={};_0x260c4a[_0xa1eb('0x34')]=_[_0xa1eb('0x4a')](db['Campaign'][_0xa1eb('0x30')]);_0x159a19[_0xa1eb('0x39')]=_[_0xa1eb('0x37')](_0x260c4a[_0xa1eb('0x34')],qs[_0xa1eb('0x38')](_0x42519b[_0xa1eb('0x35')]['fields']));_0x159a19[_0xa1eb('0x39')]=_0x159a19[_0xa1eb('0x39')][_0xa1eb('0x3a')]?_0x159a19[_0xa1eb('0x39')]:_0x260c4a[_0xa1eb('0x34')];if(_0x42519b[_0xa1eb('0x35')][_0xa1eb('0x44')]){_0x159a19['include']=[{'all':!![]}];}_0x159a19=_[_0xa1eb('0x40')]({},_0x159a19,_0x42519b[_0xa1eb('0x43')]);return db[_0xa1eb('0x2f')][_0xa1eb('0x51')](_0x159a19)['then'](handleEntityNotFound(_0x4391be,null))['then'](function(_0x58ca4e){if(_0x58ca4e){var _0x5673fa=_0x58ca4e[_0xa1eb('0x26')]({'plain':!![]});_0x5673fa=qs[_0xa1eb('0x56')](_0x5673fa,['id','createdAt',_0xa1eb('0x57')]);_0x42519b[_0xa1eb('0x4d')]=_[_0xa1eb('0x56')](_0x42519b[_0xa1eb('0x4d')],['id','createdAt','updatedAt']);return db[_0xa1eb('0x2f')][_0xa1eb('0x4c')](_[_0xa1eb('0x40')](_0x5673fa,_0x42519b[_0xa1eb('0x4d')]),{'include':_0x42519b[_0xa1eb('0x35')][_0xa1eb('0x44')]?[{'all':!![]}]:undefined})['then'](function(_0x532dfa){var _0x43f223=_0x42519b['user'][_0xa1eb('0x26')]({'plain':!![]});if(!_0x43f223)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x43f223[_0xa1eb('0x50')]===_0xa1eb('0x4e')){var _0x59aee1=_0x532dfa[_0xa1eb('0x26')]({'plain':!![]});var _0xf48372='IvrCampaigns';return db[_0xa1eb('0x58')][_0xa1eb('0x51')]({'where':{'name':_0xf48372,'userProfileId':_0x43f223[_0xa1eb('0x52')]},'raw':!![]})['then'](function(_0x9799d3){if(_0x9799d3&&_0x9799d3[_0xa1eb('0x53')]===0x0){return db['UserProfileResource'][_0xa1eb('0x4c')]({'name':_0x59aee1[_0xa1eb('0x2c')],'resourceId':_0x59aee1['id'],'type':_0x9799d3[_0xa1eb('0x2c')],'sectionId':_0x9799d3['id']},{})['then'](function(){return _0x532dfa;});}else{return _0x532dfa;}})[_0xa1eb('0x47')](function(_0x5aa916){logger[_0xa1eb('0x2a')](_0xa1eb('0x54'),_0x5aa916);throw _0x5aa916;});}return _0x532dfa;});}})[_0xa1eb('0x24')](respondWithResult(_0x4391be,0xc9))[_0xa1eb('0x47')](handleError(_0x4391be,null));};exports[_0xa1eb('0x23')]=function(_0x48f49d,_0x2aba03){if(_0x48f49d[_0xa1eb('0x4d')]['id']){delete _0x48f49d[_0xa1eb('0x4d')]['id'];}return db['Campaign'][_0xa1eb('0x51')]({'where':{'id':_0x48f49d['params']['id']}})['then'](handleEntityNotFound(_0x2aba03,null))['then'](saveUpdates(_0x48f49d['body'],null))[_0xa1eb('0x24')](respondWithResult(_0x2aba03,null))[_0xa1eb('0x47')](handleError(_0x2aba03,null));};exports[_0xa1eb('0x25')]=function(_0x4039de,_0x149de3){return db[_0xa1eb('0x2f')][_0xa1eb('0x51')]({'where':{'id':_0x4039de[_0xa1eb('0x49')]['id']}})[_0xa1eb('0x24')](handleEntityNotFound(_0x149de3,null))[_0xa1eb('0x24')](removeEntity(_0x149de3,null))['catch'](handleError(_0x149de3,null));};exports[_0xa1eb('0x59')]=function(_0x1d1c91,_0x46207c,_0x1f9418){var _0x1a9afe={'raw':!![],'where':{}};var _0x4593f6={};var _0x4bf3c9={'count':0x0,'rows':[]};return db[_0xa1eb('0x2f')][_0xa1eb('0x5a')]({'where':{'id':_0x1d1c91[_0xa1eb('0x49')]['id']}})['then'](handleEntityNotFound(_0x46207c,null))[_0xa1eb('0x24')](function(_0x11a74e){if(_0x11a74e){_0x4593f6[_0xa1eb('0x34')]=_[_0xa1eb('0x4a')](db[_0xa1eb('0x5b')]['rawAttributes']);_0x4593f6[_0xa1eb('0x35')]=_['keys'](_0x1d1c91[_0xa1eb('0x35')]);_0x4593f6['filters']=_[_0xa1eb('0x37')](_0x4593f6[_0xa1eb('0x34')],_0x4593f6[_0xa1eb('0x35')]);_0x1a9afe[_0xa1eb('0x39')]=_['intersection'](_0x4593f6[_0xa1eb('0x34')],qs[_0xa1eb('0x38')](_0x1d1c91[_0xa1eb('0x35')][_0xa1eb('0x38')]));_0x1a9afe['attributes']=_0x1a9afe[_0xa1eb('0x39')][_0xa1eb('0x3a')]?_0x1a9afe[_0xa1eb('0x39')]:_0x4593f6[_0xa1eb('0x34')];if(!_0x1d1c91[_0xa1eb('0x35')][_0xa1eb('0x3b')](_0xa1eb('0x5c'))){_0x1a9afe[_0xa1eb('0x1d')]=qs[_0xa1eb('0x1d')](_0x1d1c91['query']['limit']);_0x1a9afe['offset']=qs[_0xa1eb('0x1c')](_0x1d1c91['query'][_0xa1eb('0x1c')]);}_0x1a9afe[_0xa1eb('0x3c')]=qs['sort'](_0x1d1c91['query'][_0xa1eb('0x3d')]);_0x1a9afe[_0xa1eb('0x3e')]=qs[_0xa1eb('0x36')](_[_0xa1eb('0x3f')](_0x1d1c91[_0xa1eb('0x35')],_0x4593f6['filters']));_0x1a9afe['where'][_0xa1eb('0x5d')]=_0x11a74e['id'];if(_0x1d1c91[_0xa1eb('0x35')][_0xa1eb('0x42')]){_0x1a9afe[_0xa1eb('0x3e')]=_['merge'](_0x1a9afe[_0xa1eb('0x3e')],{'$or':_[_0xa1eb('0x2e')](_0x1a9afe[_0xa1eb('0x39')],function(_0x4050d6){var _0x3863ce={};_0x3863ce[_0x4050d6]={'$like':'%'+_0x1d1c91[_0xa1eb('0x35')][_0xa1eb('0x42')]+'%'};return _0x3863ce;})});}_0x1a9afe=_[_0xa1eb('0x40')]({},_0x1a9afe,_0x1d1c91[_0xa1eb('0x43')]);return db[_0xa1eb('0x5b')][_0xa1eb('0x1e')]({'where':_0x1a9afe['where']})[_0xa1eb('0x24')](function(_0x3c027a){_0x4bf3c9[_0xa1eb('0x1e')]=_0x3c027a;if(_0x1d1c91[_0xa1eb('0x35')][_0xa1eb('0x44')]){_0x1a9afe[_0xa1eb('0x4b')]=[{'all':!![]}];}return db['CmHopper'][_0xa1eb('0x45')](_0x1a9afe);})[_0xa1eb('0x24')](function(_0x2ff1fb){_0x4bf3c9[_0xa1eb('0x46')]=_0x2ff1fb;return _0x4bf3c9;});}})['then'](respondWithFilteredResult(_0x46207c,_0x1a9afe))['catch'](handleError(_0x46207c,null));};exports[_0xa1eb('0x5e')]=function(_0x5e0cd5,_0x2bd903,_0x2ca83a){var _0x518261={'raw':!![],'where':{}};var _0x2f9822={};var _0x1b01f9={'count':0x0,'rows':[]};return db['Campaign'][_0xa1eb('0x5a')]({'where':{'id':_0x5e0cd5[_0xa1eb('0x49')]['id']}})[_0xa1eb('0x24')](handleEntityNotFound(_0x2bd903,null))[_0xa1eb('0x24')](function(_0x3d9034){if(_0x3d9034){_0x2f9822[_0xa1eb('0x34')]=_[_0xa1eb('0x4a')](db[_0xa1eb('0x5f')][_0xa1eb('0x30')]);_0x2f9822[_0xa1eb('0x35')]=_[_0xa1eb('0x4a')](_0x5e0cd5['query']);_0x2f9822[_0xa1eb('0x36')]=_[_0xa1eb('0x37')](_0x2f9822[_0xa1eb('0x34')],_0x2f9822[_0xa1eb('0x35')]);_0x518261['attributes']=_[_0xa1eb('0x37')](_0x2f9822[_0xa1eb('0x34')],qs[_0xa1eb('0x38')](_0x5e0cd5['query'][_0xa1eb('0x38')]));_0x518261[_0xa1eb('0x39')]=_0x518261[_0xa1eb('0x39')]['length']?_0x518261[_0xa1eb('0x39')]:_0x2f9822['model'];if(!_0x5e0cd5[_0xa1eb('0x35')][_0xa1eb('0x3b')](_0xa1eb('0x5c'))){_0x518261[_0xa1eb('0x1d')]=qs[_0xa1eb('0x1d')](_0x5e0cd5[_0xa1eb('0x35')][_0xa1eb('0x1d')]);_0x518261[_0xa1eb('0x1c')]=qs['offset'](_0x5e0cd5[_0xa1eb('0x35')][_0xa1eb('0x1c')]);}_0x518261[_0xa1eb('0x3c')]=qs[_0xa1eb('0x3d')](_0x5e0cd5[_0xa1eb('0x35')]['sort']);_0x518261[_0xa1eb('0x3e')]=qs[_0xa1eb('0x36')](_['pick'](_0x5e0cd5[_0xa1eb('0x35')],_0x2f9822['filters']));_0x518261['where'][_0xa1eb('0x5d')]=_0x3d9034['id'];if(_0x5e0cd5[_0xa1eb('0x35')]['filter']){_0x518261[_0xa1eb('0x3e')]=_[_0xa1eb('0x40')](_0x518261['where'],{'$or':_[_0xa1eb('0x2e')](_0x518261[_0xa1eb('0x39')],function(_0x4d2598){var _0x4d75a8={};_0x4d75a8[_0x4d2598]={'$like':'%'+_0x5e0cd5[_0xa1eb('0x35')]['filter']+'%'};return _0x4d75a8;})});}_0x518261=_[_0xa1eb('0x40')]({},_0x518261,_0x5e0cd5[_0xa1eb('0x43')]);return db[_0xa1eb('0x5f')][_0xa1eb('0x1e')]({'where':_0x518261[_0xa1eb('0x3e')]})[_0xa1eb('0x24')](function(_0x4d589f){_0x1b01f9[_0xa1eb('0x1e')]=_0x4d589f;if(_0x5e0cd5['query'][_0xa1eb('0x44')]){_0x518261[_0xa1eb('0x4b')]=[{'all':!![]}];}return db[_0xa1eb('0x5f')][_0xa1eb('0x45')](_0x518261);})[_0xa1eb('0x24')](function(_0x2e85dd){_0x1b01f9[_0xa1eb('0x46')]=_0x2e85dd;return _0x1b01f9;});}})['then'](respondWithFilteredResult(_0x2bd903,_0x518261))[_0xa1eb('0x47')](handleError(_0x2bd903,null));};exports['getHopperFinals']=function(_0x5594b5,_0x44d29c,_0xd72914){var _0x456ddb={'raw':!![],'where':{}};var _0x559d58={};var _0x14eff1={'count':0x0,'rows':[]};return db[_0xa1eb('0x2f')]['findOne']({'where':{'id':_0x5594b5[_0xa1eb('0x49')]['id']}})['then'](handleEntityNotFound(_0x44d29c,null))[_0xa1eb('0x24')](function(_0x52863d){if(_0x52863d){_0x559d58[_0xa1eb('0x34')]=_[_0xa1eb('0x4a')](db['CmHopperFinal']['rawAttributes']);_0x559d58[_0xa1eb('0x35')]=_[_0xa1eb('0x4a')](_0x5594b5[_0xa1eb('0x35')]);_0x559d58[_0xa1eb('0x36')]=_[_0xa1eb('0x37')](_0x559d58[_0xa1eb('0x34')],_0x559d58[_0xa1eb('0x35')]);_0x456ddb[_0xa1eb('0x39')]=_[_0xa1eb('0x37')](_0x559d58[_0xa1eb('0x34')],qs[_0xa1eb('0x38')](_0x5594b5[_0xa1eb('0x35')][_0xa1eb('0x38')]));_0x456ddb[_0xa1eb('0x39')]=_0x456ddb[_0xa1eb('0x39')]['length']?_0x456ddb[_0xa1eb('0x39')]:_0x559d58[_0xa1eb('0x34')];if(!_0x5594b5['query'][_0xa1eb('0x3b')]('nolimit')){_0x456ddb[_0xa1eb('0x1d')]=qs[_0xa1eb('0x1d')](_0x5594b5[_0xa1eb('0x35')]['limit']);_0x456ddb[_0xa1eb('0x1c')]=qs[_0xa1eb('0x1c')](_0x5594b5[_0xa1eb('0x35')][_0xa1eb('0x1c')]);}_0x456ddb['order']=qs[_0xa1eb('0x3d')](_0x5594b5['query'][_0xa1eb('0x3d')]);_0x456ddb[_0xa1eb('0x3e')]=qs[_0xa1eb('0x36')](_[_0xa1eb('0x3f')](_0x5594b5[_0xa1eb('0x35')],_0x559d58[_0xa1eb('0x36')]));_0x456ddb[_0xa1eb('0x3e')][_0xa1eb('0x5d')]=_0x52863d['id'];if(_0x5594b5['query'][_0xa1eb('0x42')]){_0x456ddb[_0xa1eb('0x3e')]=_[_0xa1eb('0x40')](_0x456ddb[_0xa1eb('0x3e')],{'$or':_[_0xa1eb('0x2e')](_0x456ddb[_0xa1eb('0x39')],function(_0x215d28){var _0x8d8091={};_0x8d8091[_0x215d28]={'$like':'%'+_0x5594b5[_0xa1eb('0x35')][_0xa1eb('0x42')]+'%'};return _0x8d8091;})});}_0x456ddb=_[_0xa1eb('0x40')]({},_0x456ddb,_0x5594b5[_0xa1eb('0x43')]);return db[_0xa1eb('0x60')][_0xa1eb('0x1e')]({'where':_0x456ddb['where']})[_0xa1eb('0x24')](function(_0x1bb3ae){_0x14eff1['count']=_0x1bb3ae;if(_0x5594b5['query'][_0xa1eb('0x44')]){_0x456ddb[_0xa1eb('0x4b')]=[{'all':!![]}];}return db[_0xa1eb('0x60')][_0xa1eb('0x45')](_0x456ddb);})['then'](function(_0x402acb){_0x14eff1['rows']=_0x402acb;return _0x14eff1;});}})[_0xa1eb('0x24')](respondWithFilteredResult(_0x44d29c,_0x456ddb))[_0xa1eb('0x47')](handleError(_0x44d29c,null));};exports[_0xa1eb('0x61')]=function(_0xdb596f,_0x33a90e,_0x36b2df){var _0x33d180={'raw':!![],'where':{}};var _0x47e820={};var _0x4df201={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0xdb596f[_0xa1eb('0x49')]['id']}})['then'](handleEntityNotFound(_0x33a90e,null))[_0xa1eb('0x24')](function(_0x2c97f8){if(_0x2c97f8){_0x47e820[_0xa1eb('0x34')]=_[_0xa1eb('0x4a')](db[_0xa1eb('0x62')][_0xa1eb('0x30')]);_0x47e820[_0xa1eb('0x35')]=_[_0xa1eb('0x4a')](_0xdb596f[_0xa1eb('0x35')]);_0x47e820[_0xa1eb('0x36')]=_[_0xa1eb('0x37')](_0x47e820[_0xa1eb('0x34')],_0x47e820[_0xa1eb('0x35')]);_0x33d180[_0xa1eb('0x39')]=_[_0xa1eb('0x37')](_0x47e820['model'],qs[_0xa1eb('0x38')](_0xdb596f['query'][_0xa1eb('0x38')]));_0x33d180[_0xa1eb('0x39')]=_0x33d180['attributes']['length']?_0x33d180[_0xa1eb('0x39')]:_0x47e820[_0xa1eb('0x34')];if(!_0xdb596f[_0xa1eb('0x35')][_0xa1eb('0x3b')](_0xa1eb('0x5c'))){_0x33d180[_0xa1eb('0x1d')]=qs['limit'](_0xdb596f[_0xa1eb('0x35')][_0xa1eb('0x1d')]);_0x33d180[_0xa1eb('0x1c')]=qs[_0xa1eb('0x1c')](_0xdb596f[_0xa1eb('0x35')][_0xa1eb('0x1c')]);}_0x33d180[_0xa1eb('0x3c')]=qs['sort'](_0xdb596f[_0xa1eb('0x35')][_0xa1eb('0x3d')]);_0x33d180['where']=qs['filters'](_[_0xa1eb('0x3f')](_0xdb596f['query'],_0x47e820['filters']));_0x33d180[_0xa1eb('0x3e')]['CampaignId']=_0x2c97f8['id'];if(_0xdb596f[_0xa1eb('0x35')][_0xa1eb('0x42')]){_0x33d180['where']=_[_0xa1eb('0x40')](_0x33d180[_0xa1eb('0x3e')],{'$or':_[_0xa1eb('0x2e')](_0x33d180[_0xa1eb('0x39')],function(_0x4f535b){var _0x21b450={};_0x21b450[_0x4f535b]={'$like':'%'+_0xdb596f[_0xa1eb('0x35')][_0xa1eb('0x42')]+'%'};return _0x21b450;})});}_0x33d180=_[_0xa1eb('0x40')]({},_0x33d180,_0xdb596f[_0xa1eb('0x43')]);return db['CmHopperBlack']['count']({'where':_0x33d180['where']})[_0xa1eb('0x24')](function(_0x2ce42f){_0x4df201[_0xa1eb('0x1e')]=_0x2ce42f;if(_0xdb596f[_0xa1eb('0x35')][_0xa1eb('0x44')]){_0x33d180[_0xa1eb('0x4b')]=[{'all':!![]}];}return db[_0xa1eb('0x62')][_0xa1eb('0x45')](_0x33d180);})[_0xa1eb('0x24')](function(_0x34e1ae){_0x4df201[_0xa1eb('0x46')]=_0x34e1ae;return _0x4df201;});}})[_0xa1eb('0x24')](respondWithFilteredResult(_0x33a90e,_0x33d180))[_0xa1eb('0x47')](handleError(_0x33a90e,null));};exports[_0xa1eb('0x63')]=function(_0x16622a,_0x644b33,_0x460abc){var _0x5d78fe={};var _0x33e541={};var _0x14c4c3;var _0x5988ef;return db[_0xa1eb('0x2f')][_0xa1eb('0x5a')]({'where':{'id':_0x16622a[_0xa1eb('0x49')]['id']}})[_0xa1eb('0x24')](handleEntityNotFound(_0x644b33,null))[_0xa1eb('0x24')](function(_0x4d15c6){if(_0x4d15c6){_0x14c4c3=_0x4d15c6;_0x33e541['model']=_[_0xa1eb('0x4a')](db['CmList'][_0xa1eb('0x30')]);_0x33e541[_0xa1eb('0x35')]=_['keys'](_0x16622a['query']);_0x33e541['filters']=_[_0xa1eb('0x37')](_0x33e541['model'],_0x33e541[_0xa1eb('0x35')]);_0x5d78fe[_0xa1eb('0x39')]=_[_0xa1eb('0x37')](_0x33e541[_0xa1eb('0x34')],qs[_0xa1eb('0x38')](_0x16622a[_0xa1eb('0x35')][_0xa1eb('0x38')]));_0x5d78fe['attributes']=_0x5d78fe[_0xa1eb('0x39')][_0xa1eb('0x3a')]?_0x5d78fe[_0xa1eb('0x39')]:_0x33e541['model'];_0x5d78fe['order']=qs[_0xa1eb('0x3d')](_0x16622a[_0xa1eb('0x35')][_0xa1eb('0x3d')]);_0x5d78fe[_0xa1eb('0x3e')]=qs[_0xa1eb('0x36')](_['pick'](_0x16622a[_0xa1eb('0x35')],_0x33e541['filters']));if(_0x16622a[_0xa1eb('0x35')][_0xa1eb('0x42')]){_0x5d78fe[_0xa1eb('0x3e')]=_[_0xa1eb('0x40')](_0x5d78fe['where'],{'$or':_[_0xa1eb('0x2e')](_0x5d78fe[_0xa1eb('0x39')],function(_0x35e0f5){var _0x45f906={};_0x45f906[_0x35e0f5]={'$like':'%'+_0x16622a[_0xa1eb('0x35')]['filter']+'%'};return _0x45f906;})});}_0x5d78fe=_[_0xa1eb('0x40')]({},_0x5d78fe,_0x16622a[_0xa1eb('0x43')]);return _0x14c4c3[_0xa1eb('0x63')](_0x5d78fe);}})['then'](function(_0x13cf02){if(_0x13cf02){_0x5988ef=_0x13cf02[_0xa1eb('0x3a')];if(!_0x16622a['query'][_0xa1eb('0x3b')](_0xa1eb('0x5c'))){_0x5d78fe[_0xa1eb('0x1d')]=qs[_0xa1eb('0x1d')](_0x16622a[_0xa1eb('0x35')][_0xa1eb('0x1d')]);_0x5d78fe[_0xa1eb('0x1c')]=qs[_0xa1eb('0x1c')](_0x16622a[_0xa1eb('0x35')]['offset']);}return _0x14c4c3[_0xa1eb('0x63')](_0x5d78fe);}})[_0xa1eb('0x24')](function(_0x188f2f){if(_0x188f2f){return _0x188f2f?{'count':_0x5988ef,'rows':_0x188f2f}:null;}})[_0xa1eb('0x24')](respondWithResult(_0x644b33,null))[_0xa1eb('0x47')](handleError(_0x644b33,null));};exports[_0xa1eb('0x64')]=function(_0x1c08f3,_0x57b29c,_0x450f96){var _0x5c8665,_0x509bdd;var _0x9b8e68=[];var _0x107c29=moment()[_0xa1eb('0x65')](_0xa1eb('0x66'));return db['Campaign']['find']({'where':{'id':_0x1c08f3[_0xa1eb('0x49')]['id']}})[_0xa1eb('0x24')](handleEntityNotFound(_0x57b29c,null))[_0xa1eb('0x24')](function(_0x238508){if(_0x238508){_0x509bdd=_0x238508;return _0x238508[_0xa1eb('0x64')](_0x1c08f3[_0xa1eb('0x4d')][_0xa1eb('0x67')],_['omit'](_0x1c08f3[_0xa1eb('0x4d')],['ids','id'])||{});}return null;})[_0xa1eb('0x68')](function(_0x53b5bc){var _0x7a2630;var _0x262ff1;_0x5c8665=_0x53b5bc||[];var _0x1c9a2b=[];if(_0x53b5bc){for(var _0x1a63a1=0x0;_0x1a63a1<_0x53b5bc[_0xa1eb('0x3a')];_0x1a63a1+=0x1){var _0x23f7d5=_0x53b5bc[_0x1a63a1][_0xa1eb('0x26')]({'plain':!![]});_0x509bdd[_0xa1eb('0x69')]=_0x1c08f3[_0xa1eb('0x4d')][_0xa1eb('0x69')]?_0x1c08f3[_0xa1eb('0x4d')]['dialCheckDuplicateType']:_0x509bdd[_0xa1eb('0x69')];switch(_0x509bdd[_0xa1eb('0x69')]){case _0xa1eb('0x6a'):_0x7a2630=squel[_0xa1eb('0x6b')]()['into'](_0xa1eb('0x6c'))[_0xa1eb('0x6d')]([_0xa1eb('0x6e'),_0xa1eb('0x6f'),_0xa1eb('0x70'),_0xa1eb('0x71'),'CampaignId',_0xa1eb('0x72'),_0xa1eb('0x57')],squel[_0xa1eb('0x73')]()[_0xa1eb('0x74')]('phone',_0xa1eb('0x6e'))[_0xa1eb('0x74')](_0xa1eb('0x75'),'scheduledAt')['field']('id',_0xa1eb('0x70'))[_0xa1eb('0x74')](_0x23f7d5[_0xa1eb('0x76')][_0xa1eb('0x77')](),_0xa1eb('0x71'))[_0xa1eb('0x74')](_0x1c08f3[_0xa1eb('0x49')]['id'][_0xa1eb('0x77')](),_0xa1eb('0x5d'))[_0xa1eb('0x74')]('\x27'+_0x107c29+'\x27','createdAt')[_0xa1eb('0x74')]('\x27'+_0x107c29+'\x27',_0xa1eb('0x57'))[_0xa1eb('0x78')]('cm_contacts')[_0xa1eb('0x3e')](_0xa1eb('0x79'))[_0xa1eb('0x3e')](_0xa1eb('0x7a'),_0x23f7d5[_0xa1eb('0x76')][_0xa1eb('0x77')]())[_0xa1eb('0x3e')](_0xa1eb('0x7b'))[_0xa1eb('0x3e')]('phone\x20NOT\x20IN\x20(?)',squel[_0xa1eb('0x73')]()['field']('COALESCE(calleridnum,\x27\x27)')[_0xa1eb('0x78')](_0xa1eb('0x7c'))[_0xa1eb('0x3e')]('CampaignId\x20=\x20?',_0x1c08f3['params']['id'][_0xa1eb('0x77')]()))['where']('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0xa1eb('0x74')](_0xa1eb('0x7d'))['from'](_0xa1eb('0x6c'))['where'](_0xa1eb('0x7e'),_0x1c08f3[_0xa1eb('0x49')]['id']['toString']())))[_0xa1eb('0x77')]();break;case'onlyIfOpen':_0x7a2630=squel[_0xa1eb('0x6b')]()[_0xa1eb('0x7f')](_0xa1eb('0x6c'))[_0xa1eb('0x6d')](['phone',_0xa1eb('0x6f'),_0xa1eb('0x70'),_0xa1eb('0x71'),'CampaignId',_0xa1eb('0x72'),_0xa1eb('0x57')],squel['select']()['field']('phone',_0xa1eb('0x6e'))[_0xa1eb('0x74')]('NOW()',_0xa1eb('0x6f'))[_0xa1eb('0x74')]('id',_0xa1eb('0x70'))['field'](_0x23f7d5[_0xa1eb('0x76')][_0xa1eb('0x77')](),'ListId')[_0xa1eb('0x74')](_0x1c08f3[_0xa1eb('0x49')]['id'][_0xa1eb('0x77')](),_0xa1eb('0x5d'))[_0xa1eb('0x74')]('\x27'+_0x107c29+'\x27',_0xa1eb('0x72'))[_0xa1eb('0x74')]('\x27'+_0x107c29+'\x27',_0xa1eb('0x57'))[_0xa1eb('0x78')](_0xa1eb('0x80'))[_0xa1eb('0x3e')](_0xa1eb('0x79'))[_0xa1eb('0x3e')](_0xa1eb('0x7a'),_0x23f7d5[_0xa1eb('0x76')]['toString']())[_0xa1eb('0x3e')](_0xa1eb('0x7b'))[_0xa1eb('0x3e')]('phone\x20NOT\x20IN\x20(?)',squel[_0xa1eb('0x73')]()[_0xa1eb('0x74')]('COALESCE(phone,\x27\x27)')[_0xa1eb('0x78')](_0xa1eb('0x6c'))[_0xa1eb('0x3e')](_0xa1eb('0x7e'),_0x1c08f3[_0xa1eb('0x49')]['id'][_0xa1eb('0x77')]())))[_0xa1eb('0x77')]();break;default:_0x7a2630=squel[_0xa1eb('0x6b')]()[_0xa1eb('0x7f')](_0xa1eb('0x6c'))['fromQuery'](['phone',_0xa1eb('0x6f'),_0xa1eb('0x70'),_0xa1eb('0x71'),'CampaignId',_0xa1eb('0x72'),_0xa1eb('0x57')],squel[_0xa1eb('0x73')]()[_0xa1eb('0x74')](_0xa1eb('0x6e'),_0xa1eb('0x6e'))[_0xa1eb('0x74')](_0xa1eb('0x75'),_0xa1eb('0x6f'))[_0xa1eb('0x74')]('id','ContactId')['field'](_0x23f7d5['CmListId'][_0xa1eb('0x77')](),_0xa1eb('0x71'))[_0xa1eb('0x74')](_0x1c08f3[_0xa1eb('0x49')]['id'][_0xa1eb('0x77')](),_0xa1eb('0x5d'))[_0xa1eb('0x74')]('\x27'+_0x107c29+'\x27',_0xa1eb('0x72'))[_0xa1eb('0x74')]('\x27'+_0x107c29+'\x27',_0xa1eb('0x57'))[_0xa1eb('0x78')]('cm_contacts')['where']('deletedAt\x20IS\x20NULL')[_0xa1eb('0x3e')](_0xa1eb('0x7a'),_0x23f7d5[_0xa1eb('0x76')]['toString']())[_0xa1eb('0x3e')]('phone\x20IS\x20NOT\x20NULL'))['toString']();}_0x262ff1=squel[_0xa1eb('0x6b')]()[_0xa1eb('0x7f')](_0xa1eb('0x81'))[_0xa1eb('0x6d')]([_0xa1eb('0x82'),_0xa1eb('0x6f'),_0xa1eb('0x6e'),_0xa1eb('0x83'),_0xa1eb('0x72'),_0xa1eb('0x57')],squel['select']()['field'](_0xa1eb('0x84'),'id')[_0xa1eb('0x74')](_0xa1eb('0x75'),'scheduledAt')[_0xa1eb('0x74')](_0xa1eb('0x85'),_0xa1eb('0x6e'))[_0xa1eb('0x74')](_0xa1eb('0x86'),_0xa1eb('0x83'))[_0xa1eb('0x74')]('\x27'+_0x107c29+'\x27','createdAt')[_0xa1eb('0x74')]('\x27'+_0x107c29+'\x27',_0xa1eb('0x57'))[_0xa1eb('0x78')](_0xa1eb('0x87'),'ci')['join'](_0xa1eb('0x6c'),'h',_0xa1eb('0x88'))[_0xa1eb('0x3e')](_0xa1eb('0x89'),_0x23f7d5['CmListId'][_0xa1eb('0x77')]())['where'](_0xa1eb('0x8a'),_0x1c08f3[_0xa1eb('0x49')]['id']['toString']())['where'](_0xa1eb('0x8b'),_0x107c29))['toString']();_0x1c9a2b[_0xa1eb('0x8c')](db[_0xa1eb('0x8d')][_0xa1eb('0x35')](_0x7a2630));_0x9b8e68['push'](db[_0xa1eb('0x8d')][_0xa1eb('0x35')](_0x262ff1));}return BPromise['all'](_0x1c9a2b);}})['then'](function(){return BPromise[_0xa1eb('0x8e')](_0x9b8e68);})[_0xa1eb('0x24')](function(){return _0x5c8665;})['then'](respondWithResult(_0x57b29c,null))[_0xa1eb('0x47')](handleError(_0x57b29c,null));};exports[_0xa1eb('0x8f')]=function(_0x32ddbb,_0x14f9e1,_0x479ea4){return db[_0xa1eb('0x2f')]['find']({'where':{'id':_0x32ddbb[_0xa1eb('0x49')]['id']}})['then'](handleEntityNotFound(_0x14f9e1,null))[_0xa1eb('0x24')](function(_0x3307ca){if(_0x3307ca){return _0x3307ca[_0xa1eb('0x8f')](_0x32ddbb[_0xa1eb('0x35')][_0xa1eb('0x67')]);}})[_0xa1eb('0x24')](function(_0x1ac7ac){if(_0x1ac7ac){return db[_0xa1eb('0x5b')][_0xa1eb('0x25')]({'where':{'ListId':_0x32ddbb[_0xa1eb('0x35')][_0xa1eb('0x67')],'CampaignId':_0x32ddbb['params']['id']}})[_0xa1eb('0x24')](function(){return _0x1ac7ac;});}})[_0xa1eb('0x24')](respondWithStatusCode(_0x14f9e1,null))[_0xa1eb('0x47')](handleError(_0x14f9e1,null));};exports['getBlackLists']=function(_0x1675ae,_0x11661b,_0x3cde48){var _0x34241b={};var _0x5980e8={};var _0x2147f9;var _0x70f16b;return db[_0xa1eb('0x2f')][_0xa1eb('0x5a')]({'where':{'id':_0x1675ae[_0xa1eb('0x49')]['id']}})[_0xa1eb('0x24')](handleEntityNotFound(_0x11661b,null))['then'](function(_0x50c7fb){if(_0x50c7fb){_0x2147f9=_0x50c7fb;_0x5980e8[_0xa1eb('0x34')]=_[_0xa1eb('0x4a')](db[_0xa1eb('0x90')][_0xa1eb('0x30')]);_0x5980e8[_0xa1eb('0x35')]=_['keys'](_0x1675ae[_0xa1eb('0x35')]);_0x5980e8['filters']=_[_0xa1eb('0x37')](_0x5980e8[_0xa1eb('0x34')],_0x5980e8[_0xa1eb('0x35')]);_0x34241b[_0xa1eb('0x39')]=_['intersection'](_0x5980e8[_0xa1eb('0x34')],qs[_0xa1eb('0x38')](_0x1675ae[_0xa1eb('0x35')]['fields']));_0x34241b['attributes']=_0x34241b['attributes'][_0xa1eb('0x3a')]?_0x34241b[_0xa1eb('0x39')]:_0x5980e8['model'];_0x34241b[_0xa1eb('0x3c')]=qs['sort'](_0x1675ae[_0xa1eb('0x35')][_0xa1eb('0x3d')]);_0x34241b[_0xa1eb('0x3e')]=qs[_0xa1eb('0x36')](_[_0xa1eb('0x3f')](_0x1675ae['query'],_0x5980e8[_0xa1eb('0x36')]));if(_0x1675ae[_0xa1eb('0x35')][_0xa1eb('0x42')]){_0x34241b[_0xa1eb('0x3e')]=_[_0xa1eb('0x40')](_0x34241b[_0xa1eb('0x3e')],{'$or':_[_0xa1eb('0x2e')](_0x34241b[_0xa1eb('0x39')],function(_0x3d58f8){var _0x50fa4f={};_0x50fa4f[_0x3d58f8]={'$like':'%'+_0x1675ae[_0xa1eb('0x35')][_0xa1eb('0x42')]+'%'};return _0x50fa4f;})});}_0x34241b=_['merge']({},_0x34241b,_0x1675ae[_0xa1eb('0x43')]);return _0x2147f9[_0xa1eb('0x91')](_0x34241b);}})[_0xa1eb('0x24')](function(_0x584478){if(_0x584478){_0x70f16b=_0x584478[_0xa1eb('0x3a')];if(!_0x1675ae['query'][_0xa1eb('0x3b')](_0xa1eb('0x5c'))){_0x34241b[_0xa1eb('0x1d')]=qs[_0xa1eb('0x1d')](_0x1675ae[_0xa1eb('0x35')][_0xa1eb('0x1d')]);_0x34241b[_0xa1eb('0x1c')]=qs[_0xa1eb('0x1c')](_0x1675ae[_0xa1eb('0x35')][_0xa1eb('0x1c')]);}return _0x2147f9[_0xa1eb('0x91')](_0x34241b);}})[_0xa1eb('0x24')](function(_0x1e2b6c){if(_0x1e2b6c){return _0x1e2b6c?{'count':_0x70f16b,'rows':_0x1e2b6c}:null;}})[_0xa1eb('0x24')](respondWithResult(_0x11661b,null))[_0xa1eb('0x47')](handleError(_0x11661b,null));};exports[_0xa1eb('0x92')]=function(_0x5a1166,_0x2d0eb3,_0x474ec1){var _0x2f0cb5,_0x4167c2;var _0x57eb4c=[];var _0x560705=moment()[_0xa1eb('0x65')](_0xa1eb('0x66'));return db[_0xa1eb('0x2f')][_0xa1eb('0x51')]({'where':{'id':_0x5a1166[_0xa1eb('0x49')]['id']}})[_0xa1eb('0x24')](handleEntityNotFound(_0x2d0eb3,null))[_0xa1eb('0x24')](function(_0xcb765f){if(_0xcb765f){_0x4167c2=_0xcb765f;return _0xcb765f[_0xa1eb('0x92')](_0x5a1166[_0xa1eb('0x4d')][_0xa1eb('0x67')],_[_0xa1eb('0x56')](_0x5a1166['body'],['ids','id'])||{});}return null;})[_0xa1eb('0x68')](function(_0x5739ed){var _0xe7518a;var _0xaadb24;_0x2f0cb5=_0x5739ed||[];var _0x3161c0=[];if(_0x5739ed){for(var _0x3220c7=0x0;_0x3220c7<_0x5739ed[_0xa1eb('0x3a')];_0x3220c7+=0x1){var _0x37d951=_0x5739ed[_0x3220c7]['get']({'plain':!![]});_0xe7518a=squel[_0xa1eb('0x6b')]()[_0xa1eb('0x7f')](_0xa1eb('0x93'))['fromQuery']([_0xa1eb('0x6e'),_0xa1eb('0x70'),_0xa1eb('0x71'),_0xa1eb('0x5d'),_0xa1eb('0x72'),_0xa1eb('0x57')],squel[_0xa1eb('0x73')]()[_0xa1eb('0x74')]('phone',_0xa1eb('0x6e'))[_0xa1eb('0x74')]('id',_0xa1eb('0x70'))['field'](_0x37d951[_0xa1eb('0x76')][_0xa1eb('0x77')](),'ListId')[_0xa1eb('0x74')](_0x5a1166[_0xa1eb('0x49')]['id'][_0xa1eb('0x77')](),_0xa1eb('0x5d'))['field'](_0xa1eb('0x75'),'createdAt')['field'](_0xa1eb('0x75'),_0xa1eb('0x57'))[_0xa1eb('0x78')](_0xa1eb('0x80'))[_0xa1eb('0x3e')](_0xa1eb('0x79'))['where']('ListId\x20=\x20?',_0x37d951[_0xa1eb('0x76')][_0xa1eb('0x77')]())[_0xa1eb('0x3e')]('phone\x20IS\x20NOT\x20NULL'))['toString']();_0x3161c0['push'](db[_0xa1eb('0x8d')][_0xa1eb('0x35')](_0xe7518a));}return BPromise[_0xa1eb('0x8e')](_0x3161c0);}})[_0xa1eb('0x24')](function(){return _0x2f0cb5;})[_0xa1eb('0x24')](respondWithResult(_0x2d0eb3,null))[_0xa1eb('0x47')](handleError(_0x2d0eb3,null));};exports[_0xa1eb('0x94')]=function(_0x1c8d24,_0x48b2a9,_0x6e4fa1){return db[_0xa1eb('0x2f')]['find']({'where':{'id':_0x1c8d24['params']['id']}})['then'](handleEntityNotFound(_0x48b2a9,null))['then'](function(_0x93d325){if(_0x93d325){return _0x93d325[_0xa1eb('0x94')](_0x1c8d24[_0xa1eb('0x35')][_0xa1eb('0x67')]);}})['then'](function(_0x11455c){if(_0x11455c){return db[_0xa1eb('0x62')][_0xa1eb('0x25')]({'where':{'ListId':_0x1c8d24[_0xa1eb('0x35')][_0xa1eb('0x67')],'CampaignId':_0x1c8d24[_0xa1eb('0x49')]['id']}})[_0xa1eb('0x24')](function(){return _0x11455c;});}})[_0xa1eb('0x24')](respondWithStatusCode(_0x48b2a9,null))[_0xa1eb('0x47')](handleError(_0x48b2a9,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 113c0dd..f022b86 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(_0x13c312,_0xb56507){var _0x1c31fe=function(_0x4fa80b){while(--_0x4fa80b){_0x13c312['push'](_0x13c312['shift']());}};_0x1c31fe(++_0xb56507);}(_0x7a54,0x106));var _0x47a5=function(_0x1445dd,_0x5843bd){_0x1445dd=_0x1445dd-0x0;var _0x5818c5=_0x7a54[_0x1445dd];return _0x5818c5;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'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 e87b1cf..8ea7fbb 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 _0x8b7c=['debug','Campaign,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetCampaign','Campaign','options','where','attributes','limit','include','map','model','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','then','info','Campaign,\x20%s,\x20%s','request\x20sent'];(function(_0x3e235d,_0x4ec78a){var _0x3bfa12=function(_0x7f9c34){while(--_0x7f9c34){_0x3e235d['push'](_0x3e235d['shift']());}};_0x3bfa12(++_0x4ec78a);}(_0x8b7c,0x119));var _0xc8b7=function(_0x5b87ce,_0x20b7f6){_0x5b87ce=_0x5b87ce-0x0;var _0x597aa7=_0x8b7c[_0x5b87ce];return _0x597aa7;};'use strict';var _=require(_0xc8b7('0x0'));var util=require(_0xc8b7('0x1'));var moment=require(_0xc8b7('0x2'));var BPromise=require(_0xc8b7('0x3'));var rs=require(_0xc8b7('0x4'));var fs=require('fs');var Redis=require(_0xc8b7('0x5'));var db=require(_0xc8b7('0x6'))['db'];var utils=require(_0xc8b7('0x7'));var logger=require('../../config/logger')(_0xc8b7('0x8'));var config=require(_0xc8b7('0x9'));var jayson=require(_0xc8b7('0xa'));var client=jayson['client'][_0xc8b7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x90cb38,_0x42d65e,_0x2c7807){return new BPromise(function(_0x9e4763,_0x2f149d){return client['request'](_0x90cb38,_0x2c7807)[_0xc8b7('0xc')](function(_0x504550){logger[_0xc8b7('0xd')](_0xc8b7('0xe'),_0x42d65e,_0xc8b7('0xf'));logger[_0xc8b7('0x10')](_0xc8b7('0x11'),_0x42d65e,'request\x20sent',JSON['stringify'](_0x504550));if(_0x504550['error']){if(_0x504550[_0xc8b7('0x12')][_0xc8b7('0x13')]===0x1f4){logger[_0xc8b7('0x12')](_0xc8b7('0xe'),_0x42d65e,_0x504550['error']['message']);return _0x2f149d(_0x504550['error'][_0xc8b7('0x14')]);}logger[_0xc8b7('0x12')](_0xc8b7('0xe'),_0x42d65e,_0x504550['error'][_0xc8b7('0x14')]);return _0x9e4763(_0x504550[_0xc8b7('0x12')][_0xc8b7('0x14')]);}else{logger[_0xc8b7('0xd')](_0xc8b7('0xe'),_0x42d65e,'request\x20sent');_0x9e4763(_0x504550[_0xc8b7('0x15')][_0xc8b7('0x14')]);}})[_0xc8b7('0x16')](function(_0x3323de){logger[_0xc8b7('0x12')](_0xc8b7('0xe'),_0x42d65e,_0x3323de);_0x2f149d(_0x3323de);});});}exports[_0xc8b7('0x17')]=function(_0x485415){var _0x5ae36a=this;return new Promise(function(_0x1cf47c,_0x403659){return db[_0xc8b7('0x18')]['findAll']({'raw':_0x485415['options']?_0x485415[_0xc8b7('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x485415[_0xc8b7('0x19')]?_0x485415['options'][_0xc8b7('0x1a')]||null:null,'attributes':_0x485415[_0xc8b7('0x19')]?_0x485415['options'][_0xc8b7('0x1b')]||null:null,'limit':_0x485415['options']?_0x485415[_0xc8b7('0x19')][_0xc8b7('0x1c')]||null:null,'include':_0x485415[_0xc8b7('0x19')]?_0x485415['options'][_0xc8b7('0x1d')]?_[_0xc8b7('0x1e')](_0x485415[_0xc8b7('0x19')]['include'],function(_0x3b0e47){return{'model':db[_0x3b0e47[_0xc8b7('0x1f')]],'as':_0x3b0e47['as'],'attributes':_0x3b0e47[_0xc8b7('0x1b')],'include':_0x3b0e47[_0xc8b7('0x1d')]?_[_0xc8b7('0x1e')](_0x3b0e47[_0xc8b7('0x1d')],function(_0x2acda2){return{'model':db[_0x2acda2[_0xc8b7('0x1f')]],'as':_0x2acda2['as'],'attributes':_0x2acda2[_0xc8b7('0x1b')],'include':_0x2acda2[_0xc8b7('0x1d')]?_[_0xc8b7('0x1e')](_0x2acda2['include'],function(_0x28e65d){return{'model':db[_0x28e65d[_0xc8b7('0x1f')]],'as':_0x28e65d['as'],'attributes':_0x28e65d[_0xc8b7('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xc8b7('0xc')](function(_0x2046f5){logger[_0xc8b7('0xd')]('GetCampaign',_0x485415);logger['debug'](_0xc8b7('0x17'),_0x485415,JSON[_0xc8b7('0x20')](_0x2046f5));_0x1cf47c(_0x2046f5);})[_0xc8b7('0x16')](function(_0x2a2b25){logger[_0xc8b7('0x12')](_0xc8b7('0x17'),_0x2a2b25[_0xc8b7('0x14')],_0x485415);_0x403659(_0x5ae36a['error'](0x1f4,_0x2a2b25[_0xc8b7('0x14')]));});});}; \ No newline at end of file +var _0x6822=['util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Campaign,\x20%s,\x20%s,\x20%s','request\x20sent','error','Campaign,\x20%s,\x20%s','message','catch','GetCampaign','Campaign','findAll','options','raw','where','attributes','include','map','model','then','debug','stringify'];(function(_0x1686c9,_0x57aca1){var _0x5961dd=function(_0xddb41d){while(--_0xddb41d){_0x1686c9['push'](_0x1686c9['shift']());}};_0x5961dd(++_0x57aca1);}(_0x6822,0x18c));var _0x2682=function(_0xc61f1a,_0x1fff20){_0xc61f1a=_0xc61f1a-0x0;var _0x5f5de=_0x6822[_0xc61f1a];return _0x5f5de;};'use strict';var _=require('lodash');var util=require(_0x2682('0x0'));var moment=require(_0x2682('0x1'));var BPromise=require(_0x2682('0x2'));var rs=require(_0x2682('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2682('0x4'))['db'];var utils=require(_0x2682('0x5'));var logger=require(_0x2682('0x6'))(_0x2682('0x7'));var config=require(_0x2682('0x8'));var jayson=require(_0x2682('0x9'));var client=jayson[_0x2682('0xa')][_0x2682('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x35f55b,_0x3f706c,_0x4242c5){return new BPromise(function(_0x1a1307,_0x303fe4){return client[_0x2682('0xc')](_0x35f55b,_0x4242c5)['then'](function(_0x3e72bc){logger[_0x2682('0xd')]('Campaign,\x20%s,\x20%s',_0x3f706c,'request\x20sent');logger['debug'](_0x2682('0xe'),_0x3f706c,_0x2682('0xf'),JSON['stringify'](_0x3e72bc));if(_0x3e72bc[_0x2682('0x10')]){if(_0x3e72bc[_0x2682('0x10')]['code']===0x1f4){logger[_0x2682('0x10')](_0x2682('0x11'),_0x3f706c,_0x3e72bc[_0x2682('0x10')][_0x2682('0x12')]);return _0x303fe4(_0x3e72bc[_0x2682('0x10')][_0x2682('0x12')]);}logger[_0x2682('0x10')](_0x2682('0x11'),_0x3f706c,_0x3e72bc[_0x2682('0x10')][_0x2682('0x12')]);return _0x1a1307(_0x3e72bc[_0x2682('0x10')][_0x2682('0x12')]);}else{logger[_0x2682('0xd')](_0x2682('0x11'),_0x3f706c,_0x2682('0xf'));_0x1a1307(_0x3e72bc['result']['message']);}})[_0x2682('0x13')](function(_0x2b1ed2){logger[_0x2682('0x10')]('Campaign,\x20%s,\x20%s',_0x3f706c,_0x2b1ed2);_0x303fe4(_0x2b1ed2);});});}exports[_0x2682('0x14')]=function(_0x494946){var _0x498424=this;return new Promise(function(_0x19391e,_0x3d2b43){return db[_0x2682('0x15')][_0x2682('0x16')]({'raw':_0x494946[_0x2682('0x17')]?_0x494946['options'][_0x2682('0x18')]===undefined?!![]:![]:!![],'where':_0x494946['options']?_0x494946[_0x2682('0x17')][_0x2682('0x19')]||null:null,'attributes':_0x494946[_0x2682('0x17')]?_0x494946[_0x2682('0x17')][_0x2682('0x1a')]||null:null,'limit':_0x494946[_0x2682('0x17')]?_0x494946[_0x2682('0x17')]['limit']||null:null,'include':_0x494946['options']?_0x494946['options'][_0x2682('0x1b')]?_[_0x2682('0x1c')](_0x494946['options'][_0x2682('0x1b')],function(_0x35aa4c){return{'model':db[_0x35aa4c[_0x2682('0x1d')]],'as':_0x35aa4c['as'],'attributes':_0x35aa4c[_0x2682('0x1a')],'include':_0x35aa4c['include']?_[_0x2682('0x1c')](_0x35aa4c[_0x2682('0x1b')],function(_0x361791){return{'model':db[_0x361791[_0x2682('0x1d')]],'as':_0x361791['as'],'attributes':_0x361791[_0x2682('0x1a')],'include':_0x361791[_0x2682('0x1b')]?_['map'](_0x361791['include'],function(_0x48eee6){return{'model':db[_0x48eee6['model']],'as':_0x48eee6['as'],'attributes':_0x48eee6[_0x2682('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x2682('0x1e')](function(_0x3eff92){logger[_0x2682('0xd')](_0x2682('0x14'),_0x494946);logger[_0x2682('0x1f')](_0x2682('0x14'),_0x494946,JSON[_0x2682('0x20')](_0x3eff92));_0x19391e(_0x3eff92);})['catch'](function(_0x9384b5){logger[_0x2682('0x10')]('GetCampaign',_0x9384b5[_0x2682('0x12')],_0x494946);_0x3d2b43(_0x498424[_0x2682('0x10')](0x1f4,_0x9384b5[_0x2682('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index d93cc9b..8477520 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 _0x303a=['/:id/hoppers','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','create','/:id/clone','clone','put','update','delete','destroy','removeLists','removeBlackLists','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','get','isAuthenticated','index','/:id'];(function(_0x30f78d,_0x41a626){var _0x70a7dd=function(_0x563da5){while(--_0x563da5){_0x30f78d['push'](_0x30f78d['shift']());}};_0x70a7dd(++_0x41a626);}(_0x303a,0x1a0));var _0xa303=function(_0x5e2a0f,_0x447ab4){_0x5e2a0f=_0x5e2a0f-0x0;var _0x3e8c10=_0x303a[_0x5e2a0f];return _0x3e8c10;};'use strict';var multer=require(_0xa303('0x0'));var util=require('util');var path=require(_0xa303('0x1'));var timeout=require(_0xa303('0x2'));var express=require(_0xa303('0x3'));var router=express[_0xa303('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xa303('0x5'));var interaction=require(_0xa303('0x6'));var config=require(_0xa303('0x7'));var controller=require(_0xa303('0x8'));router[_0xa303('0x9')]('/',auth[_0xa303('0xa')](),controller[_0xa303('0xb')]);router[_0xa303('0x9')](_0xa303('0xc'),auth['isAuthenticated'](),controller['show']);router['get'](_0xa303('0xd'),auth[_0xa303('0xa')](),controller['getHoppers']);router[_0xa303('0x9')]('/:id/hopper_histories',auth[_0xa303('0xa')](),controller['getHopperHistories']);router[_0xa303('0x9')](_0xa303('0xe'),auth[_0xa303('0xa')](),controller[_0xa303('0xf')]);router['get'](_0xa303('0x10'),auth['isAuthenticated'](),controller[_0xa303('0x11')]);router[_0xa303('0x9')](_0xa303('0x12'),auth['isAuthenticated'](),controller[_0xa303('0x13')]);router[_0xa303('0x9')](_0xa303('0x14'),auth[_0xa303('0xa')](),controller[_0xa303('0x15')]);router[_0xa303('0x16')]('/',auth[_0xa303('0xa')](),controller[_0xa303('0x17')]);router['post'](_0xa303('0x18'),auth[_0xa303('0xa')](),controller[_0xa303('0x19')]);router[_0xa303('0x16')](_0xa303('0x12'),auth[_0xa303('0xa')](),controller['addLists']);router[_0xa303('0x16')]('/:id/blacklists',auth[_0xa303('0xa')](),controller['addBlackLists']);router[_0xa303('0x1a')]('/:id',auth[_0xa303('0xa')](),controller[_0xa303('0x1b')]);router[_0xa303('0x1c')]('/:id',auth[_0xa303('0xa')](),controller[_0xa303('0x1d')]);router[_0xa303('0x1c')]('/:id/lists',auth[_0xa303('0xa')](),controller[_0xa303('0x1e')]);router[_0xa303('0x1c')](_0xa303('0x14'),auth['isAuthenticated'](),controller[_0xa303('0x1f')]);module[_0xa303('0x20')]=router; \ No newline at end of file +var _0x1352=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','get','isAuthenticated','index','show','/:id/hoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','getHopperBlacks','/:id/lists','getBlackLists','post','create','/:id/clone','clone','addLists','/:id/blacklists','addBlackLists','put','/:id','update','delete','destroy','removeLists','removeBlackLists','exports','multer','util'];(function(_0x34ce9c,_0x101034){var _0x4a82fa=function(_0x5a033f){while(--_0x5a033f){_0x34ce9c['push'](_0x34ce9c['shift']());}};_0x4a82fa(++_0x101034);}(_0x1352,0x17a));var _0x2135=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0x1352[_0x173d7e];return _0x2220d6;};'use strict';var multer=require(_0x2135('0x0'));var util=require(_0x2135('0x1'));var path=require(_0x2135('0x2'));var timeout=require(_0x2135('0x3'));var express=require(_0x2135('0x4'));var router=express[_0x2135('0x5')]();var fs_extra=require(_0x2135('0x6'));var auth=require(_0x2135('0x7'));var interaction=require(_0x2135('0x8'));var config=require(_0x2135('0x9'));var controller=require(_0x2135('0xa'));router[_0x2135('0xb')]('/',auth[_0x2135('0xc')](),controller[_0x2135('0xd')]);router[_0x2135('0xb')]('/:id',auth[_0x2135('0xc')](),controller[_0x2135('0xe')]);router['get'](_0x2135('0xf'),auth[_0x2135('0xc')](),controller['getHoppers']);router[_0x2135('0xb')](_0x2135('0x10'),auth[_0x2135('0xc')](),controller[_0x2135('0x11')]);router[_0x2135('0xb')](_0x2135('0x12'),auth[_0x2135('0xc')](),controller[_0x2135('0x13')]);router[_0x2135('0xb')]('/:id/hopper_black',auth['isAuthenticated'](),controller[_0x2135('0x14')]);router[_0x2135('0xb')](_0x2135('0x15'),auth[_0x2135('0xc')](),controller['getLists']);router[_0x2135('0xb')]('/:id/blacklists',auth[_0x2135('0xc')](),controller[_0x2135('0x16')]);router[_0x2135('0x17')]('/',auth[_0x2135('0xc')](),controller[_0x2135('0x18')]);router[_0x2135('0x17')](_0x2135('0x19'),auth[_0x2135('0xc')](),controller[_0x2135('0x1a')]);router[_0x2135('0x17')]('/:id/lists',auth['isAuthenticated'](),controller[_0x2135('0x1b')]);router[_0x2135('0x17')](_0x2135('0x1c'),auth['isAuthenticated'](),controller[_0x2135('0x1d')]);router[_0x2135('0x1e')](_0x2135('0x1f'),auth[_0x2135('0xc')](),controller[_0x2135('0x20')]);router[_0x2135('0x21')]('/:id',auth[_0x2135('0xc')](),controller[_0x2135('0x22')]);router[_0x2135('0x21')](_0x2135('0x15'),auth[_0x2135('0xc')](),controller[_0x2135('0x23')]);router[_0x2135('0x21')](_0x2135('0x1c'),auth[_0x2135('0xc')](),controller[_0x2135('0x24')]);module[_0x2135('0x25')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 9fc812b..d7e76e3 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 _0x185a=['STRING','TEXT','medium','getDataValue','sequelize','exports'];(function(_0x14e1cb,_0xd3465e){var _0x18a337=function(_0x3b97f3){while(--_0x3b97f3){_0x14e1cb['push'](_0x14e1cb['shift']());}};_0x18a337(++_0xd3465e);}(_0x185a,0x1ae));var _0xa185=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x185a[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require(_0xa185('0x0'));module[_0xa185('0x1')]={'key':{'type':Sequelize[_0xa185('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0xa185('0x3')],'length':_0xa185('0x4'),'allowNull':![]},'description':{'type':Sequelize[_0xa185('0x2')]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xa185('0x5')]('key');}}}; \ No newline at end of file +var _0x17be=['VIRTUAL','key','sequelize','exports','STRING','TEXT','medium'];(function(_0x14b60e,_0x5bcdad){var _0xb7c345=function(_0x3fb27d){while(--_0x3fb27d){_0x14b60e['push'](_0x14b60e['shift']());}};_0xb7c345(++_0x5bcdad);}(_0x17be,0x136));var _0xe17b=function(_0x3902fd,_0x5ab635){_0x3902fd=_0x3902fd-0x0;var _0x1e0990=_0x17be[_0x3902fd];return _0x1e0990;};'use strict';var Sequelize=require(_0xe17b('0x0'));module[_0xe17b('0x1')]={'key':{'type':Sequelize[_0xe17b('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0xe17b('0x3')],'length':_0xe17b('0x4'),'allowNull':![]},'description':{'type':Sequelize[_0xe17b('0x2')]},'name':{'type':Sequelize[_0xe17b('0x5')],'get':function(){return this['getDataValue'](_0xe17b('0x6'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 775a24e..8ba665f 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 _0x1444=['merge','options','includeAll','rows','show','params','include','body','find','catch','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','The\x20inserted\x20key\x20already\x20exists.','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','apply','reject','save','update','then','destroy','CannedAnswers','UserProfileResource','error','name','map','CannedAnswer','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter'];(function(_0x1fcca4,_0x4e1a61){var _0x3568a4=function(_0x187191){while(--_0x187191){_0x1fcca4['push'](_0x1fcca4['shift']());}};_0x3568a4(++_0x4e1a61);}(_0x1444,0x123));var _0x4144=function(_0x1b4b23,_0x5dd6d6){_0x1b4b23=_0x1b4b23-0x0;var _0x2a325b=_0x1444[_0x1b4b23];return _0x2a325b;};'use strict';var emlformat=require(_0x4144('0x0'));var rimraf=require(_0x4144('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4144('0x2'));var rp=require(_0x4144('0x3'));var moment=require(_0x4144('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4144('0x5'));var util=require(_0x4144('0x6'));var path=require(_0x4144('0x7'));var sox=require(_0x4144('0x8'));var csv=require(_0x4144('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4144('0xa'));var _=require(_0x4144('0xb'));var squel=require(_0x4144('0xc'));var crypto=require(_0x4144('0xd'));var jsforce=require(_0x4144('0xe'));var deskjs=require(_0x4144('0xf'));var toCsv=require(_0x4144('0x9'));var querystring=require(_0x4144('0x10'));var Papa=require('papaparse');var Redis=require(_0x4144('0x11'));var authService=require(_0x4144('0x12'));var qs=require(_0x4144('0x13'));var as=require(_0x4144('0x14'));var hardwareService=require(_0x4144('0x15'));var logger=require(_0x4144('0x16'))(_0x4144('0x17'));var utils=require('../../config/utils');var config=require(_0x4144('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x4144('0x19'))['db'];function respondWithStatusCode(_0x1637cc,_0x424853){_0x424853=_0x424853||0xcc;return function(_0x26f558){if(_0x26f558){return _0x1637cc[_0x4144('0x1a')](_0x424853);}return _0x1637cc['status'](_0x424853)[_0x4144('0x1b')]();};}function respondWithResult(_0x500b98,_0x506f71){_0x506f71=_0x506f71||0xc8;return function(_0x11927d){if(_0x11927d){return _0x500b98[_0x4144('0x1c')](_0x506f71)[_0x4144('0x1d')](_0x11927d);}};}function respondWithFilteredResult(_0x54aad2,_0x47f568){return function(_0x119ddf){if(_0x119ddf){var _0x1486a3=typeof _0x47f568[_0x4144('0x1e')]===_0x4144('0x1f')&&typeof _0x47f568['limit']===_0x4144('0x1f');var _0x4fbb9e=_0x119ddf[_0x4144('0x20')];var _0x289b9d=_0x1486a3?0x0:_0x47f568['offset'];var _0x11a9e7=_0x1486a3?_0x119ddf[_0x4144('0x20')]:_0x47f568[_0x4144('0x1e')]+_0x47f568[_0x4144('0x21')];var _0x4e3cc4;if(_0x11a9e7>=_0x4fbb9e){_0x11a9e7=_0x4fbb9e;_0x4e3cc4=0xc8;}else{_0x4e3cc4=0xce;}_0x54aad2[_0x4144('0x1c')](_0x4e3cc4);return _0x54aad2[_0x4144('0x22')]('Content-Range',_0x289b9d+'-'+_0x11a9e7+'/'+_0x4fbb9e)[_0x4144('0x1d')](_0x119ddf);}return null;};}function patchUpdates(_0x4222f1){return function(_0x16e83f){try{jsonpatch[_0x4144('0x23')](_0x16e83f,_0x4222f1,!![]);}catch(_0x1b9f18){return BPromise[_0x4144('0x24')](_0x1b9f18);}return _0x16e83f[_0x4144('0x25')]();};}function saveUpdates(_0x1170ea,_0x22ee17){return function(_0x4b3efc){if(_0x4b3efc){return _0x4b3efc[_0x4144('0x26')](_0x1170ea)[_0x4144('0x27')](function(_0x383af2){return _0x383af2;});}return null;};}function removeEntity(_0x22a89e,_0x38dffb){return function(_0x575a8f){if(_0x575a8f){return _0x575a8f[_0x4144('0x28')]()[_0x4144('0x27')](function(){var _0x53ef19=_0x575a8f['get']({'plain':!![]});var _0x3f13c7=_0x4144('0x29');return db[_0x4144('0x2a')]['destroy']({'where':{'type':_0x3f13c7,'resourceId':_0x53ef19['id']}})[_0x4144('0x27')](function(){return _0x575a8f;});})['then'](function(){_0x22a89e[_0x4144('0x1c')](0xcc)[_0x4144('0x1b')]();});}};}function handleEntityNotFound(_0x58773a,_0x49e142){return function(_0x1162fb){if(!_0x1162fb){_0x58773a[_0x4144('0x1a')](0x194);}return _0x1162fb;};}function handleError(_0x3a40e4,_0xdfe3e4){_0xdfe3e4=_0xdfe3e4||0x1f4;return function(_0x2c63e6){logger[_0x4144('0x2b')](_0x2c63e6['stack']);if(_0x2c63e6['name']){delete _0x2c63e6[_0x4144('0x2c')];}_0x3a40e4['status'](_0xdfe3e4)['send'](_0x2c63e6);};}exports['index']=function(_0x3dda7f,_0x5b14cf){var _0x4a480c={},_0x18a9f3={},_0x4d15f9={'count':0x0,'rows':[]};var _0x534c99=_[_0x4144('0x2d')](db[_0x4144('0x2e')][_0x4144('0x2f')],function(_0x5331ab){return{'name':_0x5331ab[_0x4144('0x30')],'type':_0x5331ab[_0x4144('0x31')][_0x4144('0x32')]};});_0x18a9f3['model']=_['map'](_0x534c99,_0x4144('0x2c'));_0x18a9f3[_0x4144('0x33')]=_[_0x4144('0x34')](_0x3dda7f[_0x4144('0x33')]);_0x18a9f3['filters']=_[_0x4144('0x35')](_0x18a9f3[_0x4144('0x36')],_0x18a9f3[_0x4144('0x33')]);_0x4a480c[_0x4144('0x37')]=_[_0x4144('0x35')](_0x18a9f3[_0x4144('0x36')],qs[_0x4144('0x38')](_0x3dda7f[_0x4144('0x33')]['fields']));_0x4a480c[_0x4144('0x37')]=_0x4a480c[_0x4144('0x37')][_0x4144('0x39')]?_0x4a480c['attributes']:_0x18a9f3[_0x4144('0x36')];if(!_0x3dda7f['query'][_0x4144('0x3a')](_0x4144('0x3b'))){_0x4a480c[_0x4144('0x21')]=qs[_0x4144('0x21')](_0x3dda7f[_0x4144('0x33')][_0x4144('0x21')]);_0x4a480c[_0x4144('0x1e')]=qs[_0x4144('0x1e')](_0x3dda7f[_0x4144('0x33')][_0x4144('0x1e')]);}_0x4a480c[_0x4144('0x3c')]=qs[_0x4144('0x3d')](_0x3dda7f['query']['sort']);_0x4a480c[_0x4144('0x3e')]=qs[_0x4144('0x3f')](_['pick'](_0x3dda7f[_0x4144('0x33')],_0x18a9f3[_0x4144('0x3f')]),_0x534c99);if(_0x3dda7f['query']['filter']){_0x4a480c[_0x4144('0x3e')]=_['merge'](_0x4a480c[_0x4144('0x3e')],{'$or':[{'key':{'$like':'%'+_0x3dda7f['query'][_0x4144('0x40')]+'%'}},{'value':{'$like':'%'+_0x3dda7f['query'][_0x4144('0x40')]+'%'}}]});}_0x4a480c=_[_0x4144('0x41')]({},_0x4a480c,_0x3dda7f[_0x4144('0x42')]);var _0x4103c3={'where':_0x4a480c[_0x4144('0x3e')]};return db[_0x4144('0x2e')][_0x4144('0x20')](_0x4103c3)[_0x4144('0x27')](function(_0x2156e9){_0x4d15f9[_0x4144('0x20')]=_0x2156e9;if(_0x3dda7f[_0x4144('0x33')][_0x4144('0x43')]){_0x4a480c['include']=[{'all':!![]}];}return db[_0x4144('0x2e')]['findAll'](_0x4a480c);})[_0x4144('0x27')](function(_0x4b9d05){_0x4d15f9[_0x4144('0x44')]=_0x4b9d05;return _0x4d15f9;})[_0x4144('0x27')](respondWithFilteredResult(_0x5b14cf,_0x4a480c))['catch'](handleError(_0x5b14cf,null));};exports[_0x4144('0x45')]=function(_0x35d89c,_0x586ff6){var _0x20226d={'raw':!![],'where':{'id':_0x35d89c[_0x4144('0x46')]['id']}},_0x245d5b={};_0x245d5b[_0x4144('0x36')]=_[_0x4144('0x34')](db[_0x4144('0x2e')][_0x4144('0x2f')]);_0x245d5b[_0x4144('0x33')]=_[_0x4144('0x34')](_0x35d89c['query']);_0x245d5b[_0x4144('0x3f')]=_[_0x4144('0x35')](_0x245d5b[_0x4144('0x36')],_0x245d5b[_0x4144('0x33')]);_0x20226d['attributes']=_[_0x4144('0x35')](_0x245d5b[_0x4144('0x36')],qs['fields'](_0x35d89c[_0x4144('0x33')][_0x4144('0x38')]));_0x20226d[_0x4144('0x37')]=_0x20226d['attributes']['length']?_0x20226d['attributes']:_0x245d5b[_0x4144('0x36')];if(_0x35d89c['query'][_0x4144('0x43')]){_0x20226d[_0x4144('0x47')]=[{'all':!![]}];}_0x20226d=_['merge']({},_0x20226d,_0x35d89c[_0x4144('0x42')]);return db['CannedAnswer']['find'](_0x20226d)[_0x4144('0x27')](handleEntityNotFound(_0x586ff6,null))[_0x4144('0x27')](respondWithResult(_0x586ff6,null))['catch'](handleError(_0x586ff6,null));};exports['update']=function(_0x17ed3d,_0x1eddbc){if(_0x17ed3d['body']['id']){delete _0x17ed3d[_0x4144('0x48')]['id'];}return db[_0x4144('0x2e')][_0x4144('0x49')]({'where':{'id':_0x17ed3d[_0x4144('0x46')]['id']}})[_0x4144('0x27')](handleEntityNotFound(_0x1eddbc,null))[_0x4144('0x27')](saveUpdates(_0x17ed3d[_0x4144('0x48')],null))[_0x4144('0x27')](respondWithResult(_0x1eddbc,null))[_0x4144('0x4a')](handleError(_0x1eddbc,null));};exports[_0x4144('0x28')]=function(_0xadd6d,_0x36040e){return db[_0x4144('0x2e')][_0x4144('0x49')]({'where':{'id':_0xadd6d['params']['id']}})['then'](handleEntityNotFound(_0x36040e,null))[_0x4144('0x27')](removeEntity(_0x36040e,null))[_0x4144('0x4a')](handleError(_0x36040e,null));};exports[_0x4144('0x4b')]=function(_0x2e0eb5,_0x394b40){var _0x9d5ee9={'key':_0x2e0eb5['body'][_0x4144('0x32')]};if(_0x2e0eb5['body']['MailAccountId']){_0x9d5ee9[_0x4144('0x4c')]=_0x2e0eb5[_0x4144('0x48')][_0x4144('0x4c')];}else if(_0x2e0eb5[_0x4144('0x48')][_0x4144('0x4d')]){_0x9d5ee9[_0x4144('0x4d')]=_0x2e0eb5[_0x4144('0x48')][_0x4144('0x4d')];}else if(_0x2e0eb5[_0x4144('0x48')][_0x4144('0x4e')]){_0x9d5ee9['OpenchannelAccountId']=_0x2e0eb5[_0x4144('0x48')][_0x4144('0x4e')];}else if(_0x2e0eb5[_0x4144('0x48')][_0x4144('0x4f')]){_0x9d5ee9[_0x4144('0x4f')]=_0x2e0eb5[_0x4144('0x48')][_0x4144('0x4f')];}return db[_0x4144('0x2e')][_0x4144('0x49')]({'where':_0x9d5ee9})[_0x4144('0x27')](function(_0x2f58f3){if(_0x2f58f3){throw new db['Sequelize']['ValidationError'](_0x4144('0x50'));}return db[_0x4144('0x2e')][_0x4144('0x4b')](_0x2e0eb5['body']);})['then'](function(_0x1ad4bb){var _0x15fb25=_0x2e0eb5['user']['get']({'plain':!![]});if(!_0x15fb25)throw new Error(_0x4144('0x51'));if(_0x15fb25[_0x4144('0x52')]===_0x4144('0x53')){var _0x1a1c7f=_0x1ad4bb[_0x4144('0x54')]({'plain':!![]});return db[_0x4144('0x55')][_0x4144('0x49')]({'where':{'name':_0x4144('0x29'),'userProfileId':_0x15fb25[_0x4144('0x56')]},'raw':!![]})[_0x4144('0x27')](function(_0xbe6dc9){if(_0xbe6dc9&&_0xbe6dc9[_0x4144('0x57')]===0x0){return db['UserProfileResource']['create']({'name':_0x1a1c7f[_0x4144('0x2c')],'resourceId':_0x1a1c7f['id'],'type':_0xbe6dc9[_0x4144('0x2c')],'sectionId':_0xbe6dc9['id']},{})[_0x4144('0x27')](function(){return _0x1ad4bb;});}else{return _0x1ad4bb;}})[_0x4144('0x4a')](function(_0x2a10a0){logger[_0x4144('0x2b')](_0x4144('0x58'),_0x2a10a0);throw _0x2a10a0;});}return _0x1ad4bb;})['then'](respondWithResult(_0x394b40,0xc9))[_0x4144('0x4a')](handleError(_0x394b40,null));}; \ No newline at end of file +var _0x6533=['hasOwnProperty','order','sort','where','pick','filter','merge','options','CannedAnswer','includeAll','include','findAll','rows','catch','params','find','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','request-promise','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/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','reject','save','update','then','destroy','get','CannedAnswers','UserProfileResource','error','send','rawAttributes','type','key','model','map','name','query','keys','filters','intersection','attributes','fields','length'];(function(_0x283973,_0x2eecfd){var _0x1d927f=function(_0x5d501e){while(--_0x5d501e){_0x283973['push'](_0x283973['shift']());}};_0x1d927f(++_0x2eecfd);}(_0x6533,0x127));var _0x3653=function(_0x40e681,_0x39999a){_0x40e681=_0x40e681-0x0;var _0x8528d2=_0x6533[_0x40e681];return _0x8528d2;};'use strict';var emlformat=require(_0x3653('0x0'));var rimraf=require(_0x3653('0x1'));var zipdir=require(_0x3653('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3653('0x3'));var moment=require('moment');var BPromise=require(_0x3653('0x4'));var Mustache=require(_0x3653('0x5'));var util=require('util');var path=require(_0x3653('0x6'));var sox=require(_0x3653('0x7'));var csv=require(_0x3653('0x8'));var ejs=require(_0x3653('0x9'));var fs=require('fs');var fs_extra=require(_0x3653('0xa'));var _=require(_0x3653('0xb'));var squel=require(_0x3653('0xc'));var crypto=require(_0x3653('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x3653('0xe'));var toCsv=require(_0x3653('0x8'));var querystring=require(_0x3653('0xf'));var Papa=require(_0x3653('0x10'));var Redis=require(_0x3653('0x11'));var authService=require(_0x3653('0x12'));var qs=require(_0x3653('0x13'));var as=require(_0x3653('0x14'));var hardwareService=require(_0x3653('0x15'));var logger=require(_0x3653('0x16'))(_0x3653('0x17'));var utils=require('../../config/utils');var config=require(_0x3653('0x18'));var licenseUtil=require(_0x3653('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x42452f,_0x7896a4){_0x7896a4=_0x7896a4||0xcc;return function(_0x7bfff6){if(_0x7bfff6){return _0x42452f[_0x3653('0x1a')](_0x7896a4);}return _0x42452f[_0x3653('0x1b')](_0x7896a4)[_0x3653('0x1c')]();};}function respondWithResult(_0x56e99b,_0x53147b){_0x53147b=_0x53147b||0xc8;return function(_0x287170){if(_0x287170){return _0x56e99b[_0x3653('0x1b')](_0x53147b)[_0x3653('0x1d')](_0x287170);}};}function respondWithFilteredResult(_0x390892,_0x2cda51){return function(_0x4b936e){if(_0x4b936e){var _0x2f0a86=typeof _0x2cda51[_0x3653('0x1e')]===_0x3653('0x1f')&&typeof _0x2cda51[_0x3653('0x20')]==='undefined';var _0x2201c7=_0x4b936e[_0x3653('0x21')];var _0x109884=_0x2f0a86?0x0:_0x2cda51['offset'];var _0x2d835d=_0x2f0a86?_0x4b936e[_0x3653('0x21')]:_0x2cda51[_0x3653('0x1e')]+_0x2cda51[_0x3653('0x20')];var _0x17e2b4;if(_0x2d835d>=_0x2201c7){_0x2d835d=_0x2201c7;_0x17e2b4=0xc8;}else{_0x17e2b4=0xce;}_0x390892[_0x3653('0x1b')](_0x17e2b4);return _0x390892['set']('Content-Range',_0x109884+'-'+_0x2d835d+'/'+_0x2201c7)['json'](_0x4b936e);}return null;};}function patchUpdates(_0x597efc){return function(_0x335a39){try{jsonpatch['apply'](_0x335a39,_0x597efc,!![]);}catch(_0x22f592){return BPromise[_0x3653('0x22')](_0x22f592);}return _0x335a39[_0x3653('0x23')]();};}function saveUpdates(_0xe1c5c2,_0x39dca9){return function(_0x25219c){if(_0x25219c){return _0x25219c[_0x3653('0x24')](_0xe1c5c2)[_0x3653('0x25')](function(_0x4f1386){return _0x4f1386;});}return null;};}function removeEntity(_0x4e5a3b,_0x62a475){return function(_0x111f94){if(_0x111f94){return _0x111f94[_0x3653('0x26')]()['then'](function(){var _0x2999a0=_0x111f94[_0x3653('0x27')]({'plain':!![]});var _0x14e683=_0x3653('0x28');return db[_0x3653('0x29')][_0x3653('0x26')]({'where':{'type':_0x14e683,'resourceId':_0x2999a0['id']}})[_0x3653('0x25')](function(){return _0x111f94;});})[_0x3653('0x25')](function(){_0x4e5a3b[_0x3653('0x1b')](0xcc)[_0x3653('0x1c')]();});}};}function handleEntityNotFound(_0x232974,_0x2d79f7){return function(_0x4aa435){if(!_0x4aa435){_0x232974['sendStatus'](0x194);}return _0x4aa435;};}function handleError(_0x135a4b,_0x24f90d){_0x24f90d=_0x24f90d||0x1f4;return function(_0x3de48b){logger[_0x3653('0x2a')](_0x3de48b['stack']);if(_0x3de48b['name']){delete _0x3de48b['name'];}_0x135a4b[_0x3653('0x1b')](_0x24f90d)[_0x3653('0x2b')](_0x3de48b);};}exports['index']=function(_0x539f62,_0x55e516){var _0x167b5c={},_0x169f1f={},_0x516771={'count':0x0,'rows':[]};var _0xb14bac=_['map'](db['CannedAnswer'][_0x3653('0x2c')],function(_0x4dad81){return{'name':_0x4dad81['fieldName'],'type':_0x4dad81[_0x3653('0x2d')][_0x3653('0x2e')]};});_0x169f1f[_0x3653('0x2f')]=_[_0x3653('0x30')](_0xb14bac,_0x3653('0x31'));_0x169f1f[_0x3653('0x32')]=_[_0x3653('0x33')](_0x539f62['query']);_0x169f1f[_0x3653('0x34')]=_[_0x3653('0x35')](_0x169f1f['model'],_0x169f1f[_0x3653('0x32')]);_0x167b5c[_0x3653('0x36')]=_[_0x3653('0x35')](_0x169f1f[_0x3653('0x2f')],qs['fields'](_0x539f62[_0x3653('0x32')][_0x3653('0x37')]));_0x167b5c[_0x3653('0x36')]=_0x167b5c[_0x3653('0x36')][_0x3653('0x38')]?_0x167b5c['attributes']:_0x169f1f[_0x3653('0x2f')];if(!_0x539f62[_0x3653('0x32')][_0x3653('0x39')]('nolimit')){_0x167b5c['limit']=qs[_0x3653('0x20')](_0x539f62[_0x3653('0x32')]['limit']);_0x167b5c[_0x3653('0x1e')]=qs[_0x3653('0x1e')](_0x539f62['query']['offset']);}_0x167b5c[_0x3653('0x3a')]=qs[_0x3653('0x3b')](_0x539f62[_0x3653('0x32')][_0x3653('0x3b')]);_0x167b5c[_0x3653('0x3c')]=qs[_0x3653('0x34')](_[_0x3653('0x3d')](_0x539f62['query'],_0x169f1f[_0x3653('0x34')]),_0xb14bac);if(_0x539f62[_0x3653('0x32')][_0x3653('0x3e')]){_0x167b5c[_0x3653('0x3c')]=_[_0x3653('0x3f')](_0x167b5c['where'],{'$or':[{'key':{'$like':'%'+_0x539f62[_0x3653('0x32')][_0x3653('0x3e')]+'%'}},{'value':{'$like':'%'+_0x539f62[_0x3653('0x32')][_0x3653('0x3e')]+'%'}}]});}_0x167b5c=_[_0x3653('0x3f')]({},_0x167b5c,_0x539f62[_0x3653('0x40')]);var _0x38dd77={'where':_0x167b5c[_0x3653('0x3c')]};return db[_0x3653('0x41')][_0x3653('0x21')](_0x38dd77)['then'](function(_0x3dbdd0){_0x516771[_0x3653('0x21')]=_0x3dbdd0;if(_0x539f62['query'][_0x3653('0x42')]){_0x167b5c[_0x3653('0x43')]=[{'all':!![]}];}return db[_0x3653('0x41')][_0x3653('0x44')](_0x167b5c);})[_0x3653('0x25')](function(_0x58ef01){_0x516771[_0x3653('0x45')]=_0x58ef01;return _0x516771;})[_0x3653('0x25')](respondWithFilteredResult(_0x55e516,_0x167b5c))[_0x3653('0x46')](handleError(_0x55e516,null));};exports['show']=function(_0x28da23,_0x4b2ee5){var _0x432e4c={'raw':!![],'where':{'id':_0x28da23[_0x3653('0x47')]['id']}},_0x57f8d4={};_0x57f8d4[_0x3653('0x2f')]=_[_0x3653('0x33')](db[_0x3653('0x41')][_0x3653('0x2c')]);_0x57f8d4[_0x3653('0x32')]=_[_0x3653('0x33')](_0x28da23[_0x3653('0x32')]);_0x57f8d4[_0x3653('0x34')]=_[_0x3653('0x35')](_0x57f8d4[_0x3653('0x2f')],_0x57f8d4[_0x3653('0x32')]);_0x432e4c[_0x3653('0x36')]=_[_0x3653('0x35')](_0x57f8d4[_0x3653('0x2f')],qs[_0x3653('0x37')](_0x28da23[_0x3653('0x32')]['fields']));_0x432e4c[_0x3653('0x36')]=_0x432e4c['attributes']['length']?_0x432e4c['attributes']:_0x57f8d4[_0x3653('0x2f')];if(_0x28da23[_0x3653('0x32')]['includeAll']){_0x432e4c[_0x3653('0x43')]=[{'all':!![]}];}_0x432e4c=_['merge']({},_0x432e4c,_0x28da23['options']);return db['CannedAnswer'][_0x3653('0x48')](_0x432e4c)['then'](handleEntityNotFound(_0x4b2ee5,null))[_0x3653('0x25')](respondWithResult(_0x4b2ee5,null))['catch'](handleError(_0x4b2ee5,null));};exports[_0x3653('0x24')]=function(_0x3f917f,_0x1b8790){if(_0x3f917f['body']['id']){delete _0x3f917f[_0x3653('0x49')]['id'];}return db[_0x3653('0x41')]['find']({'where':{'id':_0x3f917f[_0x3653('0x47')]['id']}})[_0x3653('0x25')](handleEntityNotFound(_0x1b8790,null))[_0x3653('0x25')](saveUpdates(_0x3f917f[_0x3653('0x49')],null))['then'](respondWithResult(_0x1b8790,null))['catch'](handleError(_0x1b8790,null));};exports[_0x3653('0x26')]=function(_0xd82c24,_0x1c7657){return db['CannedAnswer'][_0x3653('0x48')]({'where':{'id':_0xd82c24['params']['id']}})[_0x3653('0x25')](handleEntityNotFound(_0x1c7657,null))['then'](removeEntity(_0x1c7657,null))[_0x3653('0x46')](handleError(_0x1c7657,null));};exports[_0x3653('0x4a')]=function(_0x589d8e,_0xb605bf){var _0x282711={'key':_0x589d8e[_0x3653('0x49')][_0x3653('0x2e')]};if(_0x589d8e[_0x3653('0x49')]['MailAccountId']){_0x282711[_0x3653('0x4b')]=_0x589d8e['body'][_0x3653('0x4b')];}else if(_0x589d8e[_0x3653('0x49')][_0x3653('0x4c')]){_0x282711[_0x3653('0x4c')]=_0x589d8e[_0x3653('0x49')][_0x3653('0x4c')];}else if(_0x589d8e[_0x3653('0x49')][_0x3653('0x4d')]){_0x282711['OpenchannelAccountId']=_0x589d8e[_0x3653('0x49')]['OpenchannelAccountId'];}else if(_0x589d8e[_0x3653('0x49')][_0x3653('0x4e')]){_0x282711[_0x3653('0x4e')]=_0x589d8e[_0x3653('0x49')][_0x3653('0x4e')];}return db['CannedAnswer'][_0x3653('0x48')]({'where':_0x282711})[_0x3653('0x25')](function(_0xb39d03){if(_0xb39d03){throw new db[(_0x3653('0x4f'))][(_0x3653('0x50'))](_0x3653('0x51'));}return db[_0x3653('0x41')][_0x3653('0x4a')](_0x589d8e['body']);})[_0x3653('0x25')](function(_0x3b6163){var _0x1fbd65=_0x589d8e[_0x3653('0x52')][_0x3653('0x27')]({'plain':!![]});if(!_0x1fbd65)throw new Error(_0x3653('0x53'));if(_0x1fbd65[_0x3653('0x54')]===_0x3653('0x52')){var _0x20151e=_0x3b6163[_0x3653('0x27')]({'plain':!![]});return db[_0x3653('0x55')][_0x3653('0x48')]({'where':{'name':_0x3653('0x28'),'userProfileId':_0x1fbd65['userProfileId']},'raw':!![]})[_0x3653('0x25')](function(_0x317d17){if(_0x317d17&&_0x317d17[_0x3653('0x56')]===0x0){return db[_0x3653('0x29')][_0x3653('0x4a')]({'name':_0x20151e[_0x3653('0x31')],'resourceId':_0x20151e['id'],'type':_0x317d17[_0x3653('0x31')],'sectionId':_0x317d17['id']},{})[_0x3653('0x25')](function(){return _0x3b6163;});}else{return _0x3b6163;}})[_0x3653('0x46')](function(_0x1d2493){logger[_0x3653('0x2a')](_0x3653('0x57'),_0x1d2493);throw _0x1d2493;});}return _0x3b6163;})[_0x3653('0x25')](respondWithResult(_0xb605bf,0xc9))['catch'](handleError(_0xb605bf,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 8736492..0ade65b 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 _0x2b80=['utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','CannedAnswer'];(function(_0x38f6a6,_0x1ffef2){var _0x210267=function(_0x40122e){while(--_0x40122e){_0x38f6a6['push'](_0x38f6a6['shift']());}};_0x210267(++_0x1ffef2);}(_0x2b80,0x139));var _0x02b8=function(_0x3abc9f,_0x49440e){_0x3abc9f=_0x3abc9f-0x0;var _0x486bc4=_0x2b80[_0x3abc9f];return _0x486bc4;};'use strict';var _=require('lodash');var util=require(_0x02b8('0x0'));var logger=require(_0x02b8('0x1'))(_0x02b8('0x2'));var moment=require(_0x02b8('0x3'));var BPromise=require(_0x02b8('0x4'));var rp=require(_0x02b8('0x5'));var fs=require('fs');var path=require(_0x02b8('0x6'));var rimraf=require(_0x02b8('0x7'));var config=require(_0x02b8('0x8'));var attributes=require('./cannedAnswer.attributes');module[_0x02b8('0x9')]=function(_0x363531,_0x3949b8){return _0x363531['define'](_0x02b8('0xa'),attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x02b8('0xb')});}; \ No newline at end of file +var _0xe171=['utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./cannedAnswer.attributes','define','CannedAnswer','utf8mb4'];(function(_0x5680f9,_0x4e96a8){var _0x1dd746=function(_0x284ce4){while(--_0x284ce4){_0x5680f9['push'](_0x5680f9['shift']());}};_0x1dd746(++_0x4e96a8);}(_0xe171,0xeb));var _0x1e17=function(_0x570d20,_0x185c1a){_0x570d20=_0x570d20-0x0;var _0x5872a8=_0xe171[_0x570d20];return _0x5872a8;};'use strict';var _=require(_0x1e17('0x0'));var util=require('util');var logger=require(_0x1e17('0x1'))(_0x1e17('0x2'));var moment=require(_0x1e17('0x3'));var BPromise=require('bluebird');var rp=require(_0x1e17('0x4'));var fs=require('fs');var path=require(_0x1e17('0x5'));var rimraf=require(_0x1e17('0x6'));var config=require(_0x1e17('0x7'));var attributes=require(_0x1e17('0x8'));module['exports']=function(_0x364dae,_0x5b14ad){return _0x364dae[_0x1e17('0x9')](_0x1e17('0xa'),attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1e17('0xb'),'collate':_0x1e17('0xc')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 3270bc6..80927c4 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(_0x597b07,_0x3586d4){var _0x515abd=function(_0x313916){while(--_0x313916){_0x597b07['push'](_0x597b07['shift']());}};_0x515abd(++_0x3586d4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xa9e0[_0x2a6809];return _0x11c371;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +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(_0xefd8a0,_0x286b7b){var _0x4c4897=function(_0x7793ac){while(--_0x7793ac){_0xefd8a0['push'](_0xefd8a0['shift']());}};_0x4c4897(++_0x286b7b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xa9e0[_0x4baae2];return _0x1a2285;};'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 e3c7148..7d7dfc6 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 _0xb51b=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','multer','util','path','express'];(function(_0x2a71d2,_0x35bcda){var _0x200112=function(_0x40735f){while(--_0x40735f){_0x2a71d2['push'](_0x2a71d2['shift']());}};_0x200112(++_0x35bcda);}(_0xb51b,0x1be));var _0xbb51=function(_0x452856,_0x4b73e2){_0x452856=_0x452856-0x0;var _0x340ecc=_0xb51b[_0x452856];return _0x340ecc;};'use strict';var multer=require(_0xbb51('0x0'));var util=require(_0xbb51('0x1'));var path=require(_0xbb51('0x2'));var timeout=require('connect-timeout');var express=require(_0xbb51('0x3'));var router=express[_0xbb51('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xbb51('0x5'));var interaction=require(_0xbb51('0x6'));var config=require(_0xbb51('0x7'));var controller=require('./cannedAnswer.controller');router[_0xbb51('0x8')]('/',auth[_0xbb51('0x9')](),controller[_0xbb51('0xa')]);router[_0xbb51('0x8')](_0xbb51('0xb'),auth[_0xbb51('0x9')](),controller[_0xbb51('0xc')]);router[_0xbb51('0xd')]('/',auth[_0xbb51('0x9')](),controller[_0xbb51('0xe')]);router['put'](_0xbb51('0xb'),auth[_0xbb51('0x9')](),controller[_0xbb51('0xf')]);router[_0xbb51('0x10')](_0xbb51('0xb'),auth['isAuthenticated'](),controller[_0xbb51('0x11')]);module['exports']=router; \ No newline at end of file +var _0x3599=['multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./cannedAnswer.controller','index','isAuthenticated','create','/:id','update','delete','destroy'];(function(_0x57b3df,_0x445081){var _0x206656=function(_0x16aeb3){while(--_0x16aeb3){_0x57b3df['push'](_0x57b3df['shift']());}};_0x206656(++_0x445081);}(_0x3599,0x170));var _0x9359=function(_0x58b0c9,_0x372df0){_0x58b0c9=_0x58b0c9-0x0;var _0x227a49=_0x3599[_0x58b0c9];return _0x227a49;};'use strict';var multer=require(_0x9359('0x0'));var util=require('util');var path=require(_0x9359('0x1'));var timeout=require(_0x9359('0x2'));var express=require(_0x9359('0x3'));var router=express[_0x9359('0x4')]();var fs_extra=require(_0x9359('0x5'));var auth=require(_0x9359('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x9359('0x7'));var controller=require(_0x9359('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x9359('0x9')]);router['get']('/:id',auth[_0x9359('0xa')](),controller['show']);router['post']('/',auth[_0x9359('0xa')](),controller[_0x9359('0xb')]);router['put'](_0x9359('0xc'),auth[_0x9359('0xa')](),controller[_0x9359('0xd')]);router[_0x9359('0xe')](_0x9359('0xc'),auth[_0x9359('0xa')](),controller[_0x9359('0xf')]);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 8fbc656..be3b147 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 _0xecf8=['STRING','INTEGER','sequelize','exports','DATE','1970-01-01\x2000:00:01'];(function(_0x4a93bb,_0x495404){var _0x208468=function(_0x1d82b7){while(--_0x1d82b7){_0x4a93bb['push'](_0x4a93bb['shift']());}};_0x208468(++_0x495404);}(_0xecf8,0xd4));var _0x8ecf=function(_0xe7f95,_0x3699cf){_0xe7f95=_0xe7f95-0x0;var _0x245a31=_0xecf8[_0xe7f95];return _0x245a31;};'use strict';var Sequelize=require(_0x8ecf('0x0'));module[_0x8ecf('0x1')]={'calldate':{'type':Sequelize[_0x8ecf('0x2')],'allowNull':![],'defaultValue':_0x8ecf('0x3')},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize[_0x8ecf('0x4')]},'dst':{'type':Sequelize['STRING']},'dcontext':{'type':Sequelize[_0x8ecf('0x4')]},'channel':{'type':Sequelize[_0x8ecf('0x4')]},'dstchannel':{'type':Sequelize['STRING']},'lastapp':{'type':Sequelize[_0x8ecf('0x4')]},'lastdata':{'type':Sequelize[_0x8ecf('0x4')]},'duration':{'type':Sequelize[_0x8ecf('0x5')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x8ecf('0x5')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x8ecf('0x4')]},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x8ecf('0x4')]},'userfield':{'type':Sequelize[_0x8ecf('0x4')]},'uniqueid':{'type':Sequelize[_0x8ecf('0x4')]},'linkedid':{'type':Sequelize[_0x8ecf('0x4')]},'sequence':{'type':Sequelize[_0x8ecf('0x4')]},'peeraccount':{'type':Sequelize[_0x8ecf('0x4')]},'type':{'type':Sequelize[_0x8ecf('0x4')]},'tag':{'type':Sequelize[_0x8ecf('0x4')]}}; \ No newline at end of file +var _0x402f=['DATE','STRING','INTEGER','sequelize'];(function(_0x20e43f,_0x3a9a95){var _0xa76f8=function(_0x225db6){while(--_0x225db6){_0x20e43f['push'](_0x20e43f['shift']());}};_0xa76f8(++_0x3a9a95);}(_0x402f,0x6f));var _0xf402=function(_0x308c2e,_0x21ba44){_0x308c2e=_0x308c2e-0x0;var _0x2ef55d=_0x402f[_0x308c2e];return _0x2ef55d;};'use strict';var Sequelize=require(_0xf402('0x0'));module['exports']={'calldate':{'type':Sequelize[_0xf402('0x1')],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize[_0xf402('0x2')]},'dst':{'type':Sequelize[_0xf402('0x2')]},'dcontext':{'type':Sequelize[_0xf402('0x2')]},'channel':{'type':Sequelize['STRING']},'dstchannel':{'type':Sequelize[_0xf402('0x2')]},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0xf402('0x2')]},'duration':{'type':Sequelize[_0xf402('0x3')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xf402('0x3')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xf402('0x2')]},'amaflags':{'type':Sequelize[_0xf402('0x3')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xf402('0x2')]},'linkedid':{'type':Sequelize[_0xf402('0x2')]},'sequence':{'type':Sequelize[_0xf402('0x2')]},'peeraccount':{'type':Sequelize[_0xf402('0x2')]},'type':{'type':Sequelize[_0xf402('0x2')]},'tag':{'type':Sequelize[_0xf402('0x2')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 101a090..7cb340f 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 _0x60c2=['squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','filters','filter','merge','where','VIRTUAL','options','includeAll','include','Cdr','findAll','rows','params','find','create','body','catch','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash'];(function(_0x2cf9f9,_0x52b995){var _0x44e2b3=function(_0x5d76ae){while(--_0x5d76ae){_0x2cf9f9['push'](_0x2cf9f9['shift']());}};_0x44e2b3(++_0x52b995);}(_0x60c2,0x8f));var _0x260c=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x60c2[_0x3947c9];return _0x2e7871;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x260c('0x0'));var zipdir=require(_0x260c('0x1'));var jsonpatch=require(_0x260c('0x2'));var rp=require(_0x260c('0x3'));var moment=require(_0x260c('0x4'));var BPromise=require(_0x260c('0x5'));var Mustache=require(_0x260c('0x6'));var util=require(_0x260c('0x7'));var path=require(_0x260c('0x8'));var sox=require(_0x260c('0x9'));var csv=require(_0x260c('0xa'));var ejs=require(_0x260c('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x260c('0xc'));var squel=require(_0x260c('0xd'));var crypto=require(_0x260c('0xe'));var jsforce=require(_0x260c('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x260c('0xa'));var querystring=require(_0x260c('0x10'));var Papa=require(_0x260c('0x11'));var Redis=require(_0x260c('0x12'));var authService=require(_0x260c('0x13'));var qs=require(_0x260c('0x14'));var as=require(_0x260c('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x260c('0x16'))(_0x260c('0x17'));var utils=require(_0x260c('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x260c('0x19'));var db=require(_0x260c('0x1a'))['db'];function respondWithStatusCode(_0x191490,_0x5aed37){_0x5aed37=_0x5aed37||0xcc;return function(_0xc44e8d){if(_0xc44e8d){return _0x191490[_0x260c('0x1b')](_0x5aed37);}return _0x191490[_0x260c('0x1c')](_0x5aed37)[_0x260c('0x1d')]();};}function respondWithResult(_0x1d3775,_0x53df53){_0x53df53=_0x53df53||0xc8;return function(_0x3930b6){if(_0x3930b6){return _0x1d3775['status'](_0x53df53)[_0x260c('0x1e')](_0x3930b6);}};}function respondWithFilteredResult(_0x5a021c,_0x47edc1){return function(_0xd8b310){if(_0xd8b310){var _0x5299a4=typeof _0x47edc1[_0x260c('0x1f')]===_0x260c('0x20')&&typeof _0x47edc1[_0x260c('0x21')]===_0x260c('0x20');var _0x2bf3b8=_0xd8b310[_0x260c('0x22')];var _0x11e634=_0x5299a4?0x0:_0x47edc1[_0x260c('0x1f')];var _0x201e59=_0x5299a4?_0xd8b310[_0x260c('0x22')]:_0x47edc1[_0x260c('0x1f')]+_0x47edc1['limit'];var _0xd977b;if(_0x201e59>=_0x2bf3b8){_0x201e59=_0x2bf3b8;_0xd977b=0xc8;}else{_0xd977b=0xce;}_0x5a021c['status'](_0xd977b);return _0x5a021c[_0x260c('0x23')](_0x260c('0x24'),_0x11e634+'-'+_0x201e59+'/'+_0x2bf3b8)['json'](_0xd8b310);}return null;};}function patchUpdates(_0x1ccf81){return function(_0xe824db){try{jsonpatch[_0x260c('0x25')](_0xe824db,_0x1ccf81,!![]);}catch(_0x1c53e1){return BPromise[_0x260c('0x26')](_0x1c53e1);}return _0xe824db[_0x260c('0x27')]();};}function saveUpdates(_0x4b5b7a,_0xd5b7d8){return function(_0x158bc6){if(_0x158bc6){return _0x158bc6[_0x260c('0x28')](_0x4b5b7a)[_0x260c('0x29')](function(_0x58688c){return _0x58688c;});}return null;};}function removeEntity(_0x3f299f,_0x304961){return function(_0x461c8a){if(_0x461c8a){return _0x461c8a[_0x260c('0x2a')]()['then'](function(){_0x3f299f[_0x260c('0x1c')](0xcc)[_0x260c('0x1d')]();});}};}function handleEntityNotFound(_0x3bdfce,_0x29e10e){return function(_0x4cf0f9){if(!_0x4cf0f9){_0x3bdfce[_0x260c('0x1b')](0x194);}return _0x4cf0f9;};}function handleError(_0x2957e5,_0x480179){_0x480179=_0x480179||0x1f4;return function(_0x5def72){logger[_0x260c('0x2b')](_0x5def72[_0x260c('0x2c')]);if(_0x5def72[_0x260c('0x2d')]){delete _0x5def72[_0x260c('0x2d')];}_0x2957e5[_0x260c('0x1c')](_0x480179)[_0x260c('0x2e')](_0x5def72);};}exports['index']=function(_0xf1ad3e,_0x2e49dd){var _0x16b663={},_0x233a61={},_0x5993fd={'count':0x0,'rows':[]};var _0xc6868a=_[_0x260c('0x2f')](db['Cdr'][_0x260c('0x30')],function(_0xcb8c28){return{'name':_0xcb8c28[_0x260c('0x31')],'type':_0xcb8c28[_0x260c('0x32')][_0x260c('0x33')]};});_0x233a61[_0x260c('0x34')]=_[_0x260c('0x2f')](_0xc6868a,_0x260c('0x2d'));_0x233a61['query']=_[_0x260c('0x35')](_0xf1ad3e[_0x260c('0x36')]);_0x233a61['filters']=_[_0x260c('0x37')](_0x233a61['model'],_0x233a61['query']);_0x16b663['attributes']=_[_0x260c('0x37')](_0x233a61[_0x260c('0x34')],qs['fields'](_0xf1ad3e[_0x260c('0x36')][_0x260c('0x38')]));_0x16b663[_0x260c('0x39')]=_0x16b663[_0x260c('0x39')][_0x260c('0x3a')]?_0x16b663[_0x260c('0x39')]:_0x233a61['model'];if(!_0xf1ad3e[_0x260c('0x36')][_0x260c('0x3b')](_0x260c('0x3c'))){_0x16b663[_0x260c('0x21')]=qs[_0x260c('0x21')](_0xf1ad3e[_0x260c('0x36')][_0x260c('0x21')]);_0x16b663[_0x260c('0x1f')]=qs[_0x260c('0x1f')](_0xf1ad3e['query'][_0x260c('0x1f')]);}_0x16b663['order']=qs['sort'](_0xf1ad3e['query']['sort']);_0x16b663['where']=qs['filters'](_['pick'](_0xf1ad3e[_0x260c('0x36')],_0x233a61[_0x260c('0x3d')]),_0xc6868a);if(_0xf1ad3e[_0x260c('0x36')][_0x260c('0x3e')]){_0x16b663['where']=_[_0x260c('0x3f')](_0x16b663[_0x260c('0x40')],{'$or':_['map'](_0xc6868a,function(_0x35afd6){if(_0x35afd6[_0x260c('0x32')]!==_0x260c('0x41')){var _0x1dbc8a={};_0x1dbc8a[_0x35afd6[_0x260c('0x2d')]]={'$like':'%'+_0xf1ad3e['query']['filter']+'%'};return _0x1dbc8a;}})});}_0x16b663=_[_0x260c('0x3f')]({},_0x16b663,_0xf1ad3e[_0x260c('0x42')]);var _0x1de711={'where':_0x16b663[_0x260c('0x40')]};return db['Cdr'][_0x260c('0x22')](_0x1de711)[_0x260c('0x29')](function(_0x265bd8){_0x5993fd[_0x260c('0x22')]=_0x265bd8;if(_0xf1ad3e[_0x260c('0x36')][_0x260c('0x43')]){_0x16b663[_0x260c('0x44')]=[{'all':!![]}];}return db[_0x260c('0x45')][_0x260c('0x46')](_0x16b663);})[_0x260c('0x29')](function(_0x3392df){_0x5993fd[_0x260c('0x47')]=_0x3392df;return _0x5993fd;})[_0x260c('0x29')](respondWithFilteredResult(_0x2e49dd,_0x16b663))['catch'](handleError(_0x2e49dd,null));};exports['show']=function(_0x19ab59,_0x30b3f9){var _0xccd9c1={'raw':!![],'where':{'id':_0x19ab59[_0x260c('0x48')]['id']}},_0x50ed87={};_0x50ed87['model']=_['keys'](db[_0x260c('0x45')]['rawAttributes']);_0x50ed87[_0x260c('0x36')]=_[_0x260c('0x35')](_0x19ab59[_0x260c('0x36')]);_0x50ed87[_0x260c('0x3d')]=_['intersection'](_0x50ed87[_0x260c('0x34')],_0x50ed87[_0x260c('0x36')]);_0xccd9c1['attributes']=_[_0x260c('0x37')](_0x50ed87['model'],qs[_0x260c('0x38')](_0x19ab59[_0x260c('0x36')][_0x260c('0x38')]));_0xccd9c1['attributes']=_0xccd9c1[_0x260c('0x39')][_0x260c('0x3a')]?_0xccd9c1[_0x260c('0x39')]:_0x50ed87[_0x260c('0x34')];if(_0x19ab59[_0x260c('0x36')][_0x260c('0x43')]){_0xccd9c1[_0x260c('0x44')]=[{'all':!![]}];}_0xccd9c1=_[_0x260c('0x3f')]({},_0xccd9c1,_0x19ab59[_0x260c('0x42')]);return db[_0x260c('0x45')][_0x260c('0x49')](_0xccd9c1)[_0x260c('0x29')](handleEntityNotFound(_0x30b3f9,null))['then'](respondWithResult(_0x30b3f9,null))['catch'](handleError(_0x30b3f9,null));};exports[_0x260c('0x4a')]=function(_0x4517be,_0x18321f){return db[_0x260c('0x45')]['create'](_0x4517be[_0x260c('0x4b')],{})[_0x260c('0x29')](respondWithResult(_0x18321f,0xc9))[_0x260c('0x4c')](handleError(_0x18321f,null));};exports[_0x260c('0x28')]=function(_0x45175a,_0x1d0890){if(_0x45175a[_0x260c('0x4b')]['id']){delete _0x45175a[_0x260c('0x4b')]['id'];}return db[_0x260c('0x45')]['find']({'where':{'id':_0x45175a[_0x260c('0x48')]['id']}})[_0x260c('0x29')](handleEntityNotFound(_0x1d0890,null))['then'](saveUpdates(_0x45175a[_0x260c('0x4b')],null))['then'](respondWithResult(_0x1d0890,null))[_0x260c('0x4c')](handleError(_0x1d0890,null));};exports['destroy']=function(_0x4dcdca,_0x1e34fe){return db[_0x260c('0x45')][_0x260c('0x49')]({'where':{'id':_0x4dcdca[_0x260c('0x48')]['id']}})[_0x260c('0x29')](handleEntityNotFound(_0x1e34fe,null))[_0x260c('0x29')](removeEntity(_0x1e34fe,null))[_0x260c('0x4c')](handleError(_0x1e34fe,null));};exports['describe']=function(_0x12fbe5,_0x49b350){return db[_0x260c('0x45')][_0x260c('0x4d')]()[_0x260c('0x29')](respondWithResult(_0x49b350,null))[_0x260c('0x4c')](handleError(_0x49b350,null));}; \ No newline at end of file +var _0x6b8f=['attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','rows','catch','show','params','keys','find','create','body','describe','rimraf','fast-json-patch','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','apply','reject','save','update','destroy','then','end','name','send','index','map','Cdr','rawAttributes','fieldName','type','key','query','filters','intersection','model'];(function(_0x2df413,_0x5303ae){var _0x1f5133=function(_0xb2347c){while(--_0xb2347c){_0x2df413['push'](_0x2df413['shift']());}};_0x1f5133(++_0x5303ae);}(_0x6b8f,0x1bc));var _0xf6b8=function(_0x302da8,_0x32ad49){_0x302da8=_0x302da8-0x0;var _0x456c5d=_0x6b8f[_0x302da8];return _0x456c5d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf6b8('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf6b8('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf6b8('0x2'));var Mustache=require(_0xf6b8('0x3'));var util=require('util');var path=require(_0xf6b8('0x4'));var sox=require(_0xf6b8('0x5'));var csv=require(_0xf6b8('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf6b8('0x7'));var _=require(_0xf6b8('0x8'));var squel=require(_0xf6b8('0x9'));var crypto=require(_0xf6b8('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf6b8('0x6'));var querystring=require('querystring');var Papa=require(_0xf6b8('0xb'));var Redis=require(_0xf6b8('0xc'));var authService=require(_0xf6b8('0xd'));var qs=require(_0xf6b8('0xe'));var as=require(_0xf6b8('0xf'));var hardwareService=require(_0xf6b8('0x10'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xf6b8('0x11'));var licenseUtil=require(_0xf6b8('0x12'));var db=require(_0xf6b8('0x13'))['db'];function respondWithStatusCode(_0x1d96b9,_0x5a6118){_0x5a6118=_0x5a6118||0xcc;return function(_0x4e5235){if(_0x4e5235){return _0x1d96b9[_0xf6b8('0x14')](_0x5a6118);}return _0x1d96b9[_0xf6b8('0x15')](_0x5a6118)['end']();};}function respondWithResult(_0xfcecc9,_0x2db10c){_0x2db10c=_0x2db10c||0xc8;return function(_0x454d8a){if(_0x454d8a){return _0xfcecc9['status'](_0x2db10c)[_0xf6b8('0x16')](_0x454d8a);}};}function respondWithFilteredResult(_0x53d744,_0x410345){return function(_0x1ee041){if(_0x1ee041){var _0x2e1748=typeof _0x410345[_0xf6b8('0x17')]===_0xf6b8('0x18')&&typeof _0x410345['limit']==='undefined';var _0x3bb9ae=_0x1ee041['count'];var _0x3cf63c=_0x2e1748?0x0:_0x410345[_0xf6b8('0x17')];var _0x4a93a8=_0x2e1748?_0x1ee041['count']:_0x410345[_0xf6b8('0x17')]+_0x410345[_0xf6b8('0x19')];var _0x3081db;if(_0x4a93a8>=_0x3bb9ae){_0x4a93a8=_0x3bb9ae;_0x3081db=0xc8;}else{_0x3081db=0xce;}_0x53d744[_0xf6b8('0x15')](_0x3081db);return _0x53d744['set']('Content-Range',_0x3cf63c+'-'+_0x4a93a8+'/'+_0x3bb9ae)['json'](_0x1ee041);}return null;};}function patchUpdates(_0x3298a4){return function(_0x2a8195){try{jsonpatch[_0xf6b8('0x1a')](_0x2a8195,_0x3298a4,!![]);}catch(_0x56b48a){return BPromise[_0xf6b8('0x1b')](_0x56b48a);}return _0x2a8195[_0xf6b8('0x1c')]();};}function saveUpdates(_0x3d2c57,_0x9c660c){return function(_0x5dd616){if(_0x5dd616){return _0x5dd616[_0xf6b8('0x1d')](_0x3d2c57)['then'](function(_0x22c52d){return _0x22c52d;});}return null;};}function removeEntity(_0x2b5bd3,_0x13a451){return function(_0x4127c9){if(_0x4127c9){return _0x4127c9[_0xf6b8('0x1e')]()[_0xf6b8('0x1f')](function(){_0x2b5bd3['status'](0xcc)[_0xf6b8('0x20')]();});}};}function handleEntityNotFound(_0x1ebfea,_0x4815f7){return function(_0x205d6c){if(!_0x205d6c){_0x1ebfea[_0xf6b8('0x14')](0x194);}return _0x205d6c;};}function handleError(_0x324057,_0xd5ebb5){_0xd5ebb5=_0xd5ebb5||0x1f4;return function(_0x3365b8){logger['error'](_0x3365b8['stack']);if(_0x3365b8[_0xf6b8('0x21')]){delete _0x3365b8[_0xf6b8('0x21')];}_0x324057['status'](_0xd5ebb5)[_0xf6b8('0x22')](_0x3365b8);};}exports[_0xf6b8('0x23')]=function(_0x888319,_0x5a7f55){var _0x458935={},_0xc958f4={},_0x511896={'count':0x0,'rows':[]};var _0x309f04=_[_0xf6b8('0x24')](db[_0xf6b8('0x25')][_0xf6b8('0x26')],function(_0x51ffcf){return{'name':_0x51ffcf[_0xf6b8('0x27')],'type':_0x51ffcf[_0xf6b8('0x28')][_0xf6b8('0x29')]};});_0xc958f4['model']=_[_0xf6b8('0x24')](_0x309f04,_0xf6b8('0x21'));_0xc958f4[_0xf6b8('0x2a')]=_['keys'](_0x888319[_0xf6b8('0x2a')]);_0xc958f4[_0xf6b8('0x2b')]=_[_0xf6b8('0x2c')](_0xc958f4[_0xf6b8('0x2d')],_0xc958f4['query']);_0x458935[_0xf6b8('0x2e')]=_[_0xf6b8('0x2c')](_0xc958f4[_0xf6b8('0x2d')],qs['fields'](_0x888319['query'][_0xf6b8('0x2f')]));_0x458935[_0xf6b8('0x2e')]=_0x458935[_0xf6b8('0x2e')][_0xf6b8('0x30')]?_0x458935[_0xf6b8('0x2e')]:_0xc958f4[_0xf6b8('0x2d')];if(!_0x888319[_0xf6b8('0x2a')][_0xf6b8('0x31')](_0xf6b8('0x32'))){_0x458935[_0xf6b8('0x19')]=qs[_0xf6b8('0x19')](_0x888319[_0xf6b8('0x2a')][_0xf6b8('0x19')]);_0x458935[_0xf6b8('0x17')]=qs[_0xf6b8('0x17')](_0x888319[_0xf6b8('0x2a')][_0xf6b8('0x17')]);}_0x458935[_0xf6b8('0x33')]=qs['sort'](_0x888319['query'][_0xf6b8('0x34')]);_0x458935[_0xf6b8('0x35')]=qs[_0xf6b8('0x2b')](_[_0xf6b8('0x36')](_0x888319[_0xf6b8('0x2a')],_0xc958f4[_0xf6b8('0x2b')]),_0x309f04);if(_0x888319[_0xf6b8('0x2a')][_0xf6b8('0x37')]){_0x458935[_0xf6b8('0x35')]=_[_0xf6b8('0x38')](_0x458935[_0xf6b8('0x35')],{'$or':_[_0xf6b8('0x24')](_0x309f04,function(_0x4a8c49){if(_0x4a8c49[_0xf6b8('0x28')]!==_0xf6b8('0x39')){var _0x5d26ad={};_0x5d26ad[_0x4a8c49[_0xf6b8('0x21')]]={'$like':'%'+_0x888319[_0xf6b8('0x2a')][_0xf6b8('0x37')]+'%'};return _0x5d26ad;}})});}_0x458935=_[_0xf6b8('0x38')]({},_0x458935,_0x888319[_0xf6b8('0x3a')]);var _0x87a4ee={'where':_0x458935[_0xf6b8('0x35')]};return db[_0xf6b8('0x25')][_0xf6b8('0x3b')](_0x87a4ee)[_0xf6b8('0x1f')](function(_0x15a63b){_0x511896[_0xf6b8('0x3b')]=_0x15a63b;if(_0x888319[_0xf6b8('0x2a')][_0xf6b8('0x3c')]){_0x458935['include']=[{'all':!![]}];}return db['Cdr']['findAll'](_0x458935);})[_0xf6b8('0x1f')](function(_0x2c68f5){_0x511896[_0xf6b8('0x3d')]=_0x2c68f5;return _0x511896;})[_0xf6b8('0x1f')](respondWithFilteredResult(_0x5a7f55,_0x458935))[_0xf6b8('0x3e')](handleError(_0x5a7f55,null));};exports[_0xf6b8('0x3f')]=function(_0x1390dc,_0x48f4cb){var _0x1f5e72={'raw':!![],'where':{'id':_0x1390dc[_0xf6b8('0x40')]['id']}},_0x5086d9={};_0x5086d9[_0xf6b8('0x2d')]=_[_0xf6b8('0x41')](db[_0xf6b8('0x25')][_0xf6b8('0x26')]);_0x5086d9['query']=_[_0xf6b8('0x41')](_0x1390dc[_0xf6b8('0x2a')]);_0x5086d9[_0xf6b8('0x2b')]=_[_0xf6b8('0x2c')](_0x5086d9[_0xf6b8('0x2d')],_0x5086d9['query']);_0x1f5e72[_0xf6b8('0x2e')]=_[_0xf6b8('0x2c')](_0x5086d9[_0xf6b8('0x2d')],qs['fields'](_0x1390dc['query'][_0xf6b8('0x2f')]));_0x1f5e72[_0xf6b8('0x2e')]=_0x1f5e72[_0xf6b8('0x2e')][_0xf6b8('0x30')]?_0x1f5e72['attributes']:_0x5086d9['model'];if(_0x1390dc['query'][_0xf6b8('0x3c')]){_0x1f5e72['include']=[{'all':!![]}];}_0x1f5e72=_[_0xf6b8('0x38')]({},_0x1f5e72,_0x1390dc[_0xf6b8('0x3a')]);return db[_0xf6b8('0x25')][_0xf6b8('0x42')](_0x1f5e72)[_0xf6b8('0x1f')](handleEntityNotFound(_0x48f4cb,null))[_0xf6b8('0x1f')](respondWithResult(_0x48f4cb,null))[_0xf6b8('0x3e')](handleError(_0x48f4cb,null));};exports[_0xf6b8('0x43')]=function(_0x394a34,_0x597511){return db[_0xf6b8('0x25')]['create'](_0x394a34[_0xf6b8('0x44')],{})[_0xf6b8('0x1f')](respondWithResult(_0x597511,0xc9))[_0xf6b8('0x3e')](handleError(_0x597511,null));};exports[_0xf6b8('0x1d')]=function(_0x1abf17,_0x291845){if(_0x1abf17[_0xf6b8('0x44')]['id']){delete _0x1abf17['body']['id'];}return db[_0xf6b8('0x25')][_0xf6b8('0x42')]({'where':{'id':_0x1abf17[_0xf6b8('0x40')]['id']}})[_0xf6b8('0x1f')](handleEntityNotFound(_0x291845,null))['then'](saveUpdates(_0x1abf17[_0xf6b8('0x44')],null))[_0xf6b8('0x1f')](respondWithResult(_0x291845,null))['catch'](handleError(_0x291845,null));};exports[_0xf6b8('0x1e')]=function(_0x143164,_0x392582){return db[_0xf6b8('0x25')][_0xf6b8('0x42')]({'where':{'id':_0x143164['params']['id']}})[_0xf6b8('0x1f')](handleEntityNotFound(_0x392582,null))[_0xf6b8('0x1f')](removeEntity(_0x392582,null))['catch'](handleError(_0x392582,null));};exports['describe']=function(_0x55c392,_0x22c1eb){return db[_0xf6b8('0x25')][_0xf6b8('0x45')]()[_0xf6b8('0x1f')](respondWithResult(_0x22c1eb,null))['catch'](handleError(_0x22c1eb,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 47d9d20..bcbf1fd 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(_0x517db2,_0x22e5f6){var _0x636271=function(_0x4af022){while(--_0x4af022){_0x517db2['push'](_0x517db2['shift']());}};_0x636271(++_0x22e5f6);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xc')]},{'name':'calldate','fields':[_0x7995('0xd')]},{'name':_0x7995('0xe'),'fields':[_0x7995('0xe')]},{'name':_0x7995('0xf'),'fields':[_0x7995('0xf')]},{'name':_0x7995('0x10'),'fields':[_0x7995('0x10')]},{'name':'uniqueid','fields':[_0x7995('0x11')]}],'timestamps':![]});}; \ No newline at end of file +var _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0x480361,_0x24e86d){var _0x347d09=function(_0x5ff02d){while(--_0x5ff02d){_0x480361['push'](_0x480361['shift']());}};_0x347d09(++_0x24e86d);}(_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 faea156..2b1ead3 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 _0x3e2c=['then','info','debug','Cdr,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Cdr,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request'];(function(_0x431344,_0x1840f8){var _0x3a6bf6=function(_0xae0376){while(--_0xae0376){_0x431344['push'](_0x431344['shift']());}};_0x3a6bf6(++_0x1840f8);}(_0x3e2c,0x174));var _0xc3e2=function(_0x455afa,_0x235bfc){_0x455afa=_0x455afa-0x0;var _0x46ee43=_0x3e2c[_0x455afa];return _0x46ee43;};'use strict';var _=require(_0xc3e2('0x0'));var util=require(_0xc3e2('0x1'));var moment=require(_0xc3e2('0x2'));var BPromise=require(_0xc3e2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc3e2('0x4'));var db=require(_0xc3e2('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc3e2('0x6'))('rpc');var config=require(_0xc3e2('0x7'));var jayson=require(_0xc3e2('0x8'));var client=jayson[_0xc3e2('0x9')][_0xc3e2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x277700,_0x17fb54,_0x54a486){return new BPromise(function(_0x2ea2d2,_0x1f1b72){return client[_0xc3e2('0xb')](_0x277700,_0x54a486)[_0xc3e2('0xc')](function(_0xacbf8e){logger[_0xc3e2('0xd')]('Cdr,\x20%s,\x20%s',_0x17fb54,'request\x20sent');logger[_0xc3e2('0xe')](_0xc3e2('0xf'),_0x17fb54,_0xc3e2('0x10'),JSON[_0xc3e2('0x11')](_0xacbf8e));if(_0xacbf8e[_0xc3e2('0x12')]){if(_0xacbf8e[_0xc3e2('0x12')][_0xc3e2('0x13')]===0x1f4){logger[_0xc3e2('0x12')](_0xc3e2('0x14'),_0x17fb54,_0xacbf8e['error']['message']);return _0x1f1b72(_0xacbf8e['error']['message']);}logger[_0xc3e2('0x12')](_0xc3e2('0x14'),_0x17fb54,_0xacbf8e[_0xc3e2('0x12')][_0xc3e2('0x15')]);return _0x2ea2d2(_0xacbf8e[_0xc3e2('0x12')][_0xc3e2('0x15')]);}else{logger[_0xc3e2('0xd')](_0xc3e2('0x14'),_0x17fb54,'request\x20sent');_0x2ea2d2(_0xacbf8e[_0xc3e2('0x16')]['message']);}})[_0xc3e2('0x17')](function(_0x4b1baf){logger[_0xc3e2('0x12')](_0xc3e2('0x14'),_0x17fb54,_0x4b1baf);_0x1f1b72(_0x4b1baf);});});} \ No newline at end of file +var _0x1f6d=['http','request','then','Cdr,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0x1f6d,0x19a));var _0xd1f6=function(_0x18860c,_0x4af1bb){_0x18860c=_0x18860c-0x0;var _0x51f126=_0x1f6d[_0x18860c];return _0x51f126;};'use strict';var _=require(_0xd1f6('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xd1f6('0x1'));var rs=require(_0xd1f6('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd1f6('0x3'))['db'];var utils=require(_0xd1f6('0x4'));var logger=require('../../config/logger')(_0xd1f6('0x5'));var config=require(_0xd1f6('0x6'));var jayson=require(_0xd1f6('0x7'));var client=jayson['client'][_0xd1f6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x17030b,_0x5116be,_0x1bca2f){return new BPromise(function(_0x508c05,_0x4cf19b){return client[_0xd1f6('0x9')](_0x17030b,_0x1bca2f)[_0xd1f6('0xa')](function(_0x26916b){logger['info'](_0xd1f6('0xb'),_0x5116be,_0xd1f6('0xc'));logger[_0xd1f6('0xd')]('Cdr,\x20%s,\x20%s,\x20%s',_0x5116be,_0xd1f6('0xc'),JSON[_0xd1f6('0xe')](_0x26916b));if(_0x26916b[_0xd1f6('0xf')]){if(_0x26916b[_0xd1f6('0xf')][_0xd1f6('0x10')]===0x1f4){logger[_0xd1f6('0xf')](_0xd1f6('0xb'),_0x5116be,_0x26916b['error'][_0xd1f6('0x11')]);return _0x4cf19b(_0x26916b[_0xd1f6('0xf')][_0xd1f6('0x11')]);}logger[_0xd1f6('0xf')](_0xd1f6('0xb'),_0x5116be,_0x26916b[_0xd1f6('0xf')][_0xd1f6('0x11')]);return _0x508c05(_0x26916b[_0xd1f6('0xf')][_0xd1f6('0x11')]);}else{logger['info'](_0xd1f6('0xb'),_0x5116be,_0xd1f6('0xc'));_0x508c05(_0x26916b['result'][_0xd1f6('0x11')]);}})[_0xd1f6('0x12')](function(_0x19c060){logger[_0xd1f6('0xf')](_0xd1f6('0xb'),_0x5116be,_0x19c060);_0x4cf19b(_0x19c060);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index c0c547f..350f858 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(_0x53ff3b,_0x58f396){var _0x4d7ac2=function(_0x13e433){while(--_0x13e433){_0x53ff3b['push'](_0x53ff3b['shift']());}};_0x4d7ac2(++_0x58f396);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file +var _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cdr.controller','get','index','/describe','show','post'];(function(_0x8a969d,_0x339d9f){var _0x1d8dc7=function(_0x283ec0){while(--_0x283ec0){_0x8a969d['push'](_0x8a969d['shift']());}};_0x1d8dc7(++_0x339d9f);}(_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['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/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index 5d0801c..822361e 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 _0x655d=['noop','*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0x872b02,_0x4f4458){var _0x1a6b24=function(_0x1dfb4e){while(--_0x1dfb4e){_0x872b02['push'](_0x872b02['shift']());}};_0x1a6b24(++_0x4f4458);}(_0x655d,0x15e));var _0xd655=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x655d[_0x1cc8fe];return _0x230054;};'use strict';var Sequelize=require(_0xd655('0x0'));module[_0xd655('0x1')]={'priority':{'type':Sequelize[_0xd655('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xd655('0x3')],'allowNull':![],'defaultValue':_0xd655('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xd655('0x3')]},'interval':{'type':Sequelize[_0xd655('0x3')],'defaultValue':_0xd655('0x5')}}; \ No newline at end of file +var _0xfb7f=['TEXT','*,*,*,*','sequelize','exports','STRING','noop'];(function(_0xef8146,_0x459c34){var _0x5a6cb0=function(_0x2f84ec){while(--_0x2f84ec){_0xef8146['push'](_0xef8146['shift']());}};_0x5a6cb0(++_0x459c34);}(_0xfb7f,0x1a6));var _0xffb7=function(_0x2405a8,_0x453e33){_0x2405a8=_0x2405a8-0x0;var _0x2b31a3=_0xfb7f[_0x2405a8];return _0x2b31a3;};'use strict';var Sequelize=require(_0xffb7('0x0'));module[_0xffb7('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xffb7('0x2')],'allowNull':![],'defaultValue':_0xffb7('0x3')},'appdata':{'type':Sequelize[_0xffb7('0x4')]()},'description':{'type':Sequelize[_0xffb7('0x2')]},'interval':{'type':Sequelize[_0xffb7('0x2')],'defaultValue':_0xffb7('0x5')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index fb0dd21..13a12d9 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 _0x515d=['filters','attributes','intersection','fields','length','includeAll','include','merge','ChatApplication','find','catch','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','params','model','keys','query'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x515d,0x104));var _0xd515=function(_0x40472f,_0x577cb8){_0x40472f=_0x40472f-0x0;var _0x1a819e=_0x515d[_0x40472f];return _0x1a819e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd515('0x0'));var zipdir=require(_0xd515('0x1'));var jsonpatch=require(_0xd515('0x2'));var rp=require(_0xd515('0x3'));var moment=require(_0xd515('0x4'));var BPromise=require(_0xd515('0x5'));var Mustache=require(_0xd515('0x6'));var util=require(_0xd515('0x7'));var path=require('path');var sox=require(_0xd515('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd515('0x9'));var _=require(_0xd515('0xa'));var squel=require(_0xd515('0xb'));var crypto=require(_0xd515('0xc'));var jsforce=require(_0xd515('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xd515('0xe'));var querystring=require(_0xd515('0xf'));var Papa=require(_0xd515('0x10'));var Redis=require(_0xd515('0x11'));var authService=require(_0xd515('0x12'));var qs=require(_0xd515('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd515('0x14'));var logger=require(_0xd515('0x15'))(_0xd515('0x16'));var utils=require(_0xd515('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xd515('0x18'));var db=require(_0xd515('0x19'))['db'];function respondWithStatusCode(_0x29c078,_0x33b905){_0x33b905=_0x33b905||0xcc;return function(_0x1d6bda){if(_0x1d6bda){return _0x29c078[_0xd515('0x1a')](_0x33b905);}return _0x29c078[_0xd515('0x1b')](_0x33b905)[_0xd515('0x1c')]();};}function respondWithResult(_0x1f23b7,_0x43384b){_0x43384b=_0x43384b||0xc8;return function(_0x10620b){if(_0x10620b){return _0x1f23b7[_0xd515('0x1b')](_0x43384b)[_0xd515('0x1d')](_0x10620b);}};}function respondWithFilteredResult(_0x589d04,_0x274550){return function(_0xc41eca){if(_0xc41eca){var _0xc8fbf=typeof _0x274550[_0xd515('0x1e')]===_0xd515('0x1f')&&typeof _0x274550[_0xd515('0x20')]===_0xd515('0x1f');var _0x139e91=_0xc41eca[_0xd515('0x21')];var _0x564c4e=_0xc8fbf?0x0:_0x274550['offset'];var _0x43bb12=_0xc8fbf?_0xc41eca[_0xd515('0x21')]:_0x274550[_0xd515('0x1e')]+_0x274550[_0xd515('0x20')];var _0x1ef858;if(_0x43bb12>=_0x139e91){_0x43bb12=_0x139e91;_0x1ef858=0xc8;}else{_0x1ef858=0xce;}_0x589d04[_0xd515('0x1b')](_0x1ef858);return _0x589d04[_0xd515('0x22')](_0xd515('0x23'),_0x564c4e+'-'+_0x43bb12+'/'+_0x139e91)[_0xd515('0x1d')](_0xc41eca);}return null;};}function patchUpdates(_0x5c7fef){return function(_0x57e1f4){try{jsonpatch[_0xd515('0x24')](_0x57e1f4,_0x5c7fef,!![]);}catch(_0x5b1649){return BPromise[_0xd515('0x25')](_0x5b1649);}return _0x57e1f4[_0xd515('0x26')]();};}function saveUpdates(_0x2b2ed5,_0x4e9d06){return function(_0xb422bc){if(_0xb422bc){return _0xb422bc[_0xd515('0x27')](_0x2b2ed5)[_0xd515('0x28')](function(_0x299b46){return _0x299b46;});}return null;};}function removeEntity(_0x519b7f,_0x430153){return function(_0x11cc9f){if(_0x11cc9f){return _0x11cc9f[_0xd515('0x29')]()[_0xd515('0x28')](function(){_0x519b7f[_0xd515('0x1b')](0xcc)[_0xd515('0x1c')]();});}};}function handleEntityNotFound(_0x130533,_0x84adb){return function(_0x19ce0c){if(!_0x19ce0c){_0x130533['sendStatus'](0x194);}return _0x19ce0c;};}function handleError(_0x5b6a98,_0x2e4455){_0x2e4455=_0x2e4455||0x1f4;return function(_0x2b803a){logger[_0xd515('0x2a')](_0x2b803a[_0xd515('0x2b')]);if(_0x2b803a[_0xd515('0x2c')]){delete _0x2b803a[_0xd515('0x2c')];}_0x5b6a98[_0xd515('0x1b')](_0x2e4455)[_0xd515('0x2d')](_0x2b803a);};}exports['show']=function(_0x38766a,_0x290489){var _0x3c2841={'raw':!![],'where':{'id':_0x38766a[_0xd515('0x2e')]['id']}},_0x154c02={};_0x154c02[_0xd515('0x2f')]=_[_0xd515('0x30')](db['ChatApplication']['rawAttributes']);_0x154c02['query']=_[_0xd515('0x30')](_0x38766a[_0xd515('0x31')]);_0x154c02[_0xd515('0x32')]=_['intersection'](_0x154c02['model'],_0x154c02['query']);_0x3c2841[_0xd515('0x33')]=_[_0xd515('0x34')](_0x154c02[_0xd515('0x2f')],qs[_0xd515('0x35')](_0x38766a[_0xd515('0x31')]['fields']));_0x3c2841[_0xd515('0x33')]=_0x3c2841['attributes'][_0xd515('0x36')]?_0x3c2841[_0xd515('0x33')]:_0x154c02[_0xd515('0x2f')];if(_0x38766a[_0xd515('0x31')][_0xd515('0x37')]){_0x3c2841[_0xd515('0x38')]=[{'all':!![]}];}_0x3c2841=_[_0xd515('0x39')]({},_0x3c2841,_0x38766a['options']);return db[_0xd515('0x3a')][_0xd515('0x3b')](_0x3c2841)[_0xd515('0x28')](handleEntityNotFound(_0x290489,null))[_0xd515('0x28')](respondWithResult(_0x290489,null))[_0xd515('0x3c')](handleError(_0x290489,null));};exports['update']=function(_0x21c3dc,_0x599054){if(_0x21c3dc[_0xd515('0x3d')]['id']){delete _0x21c3dc[_0xd515('0x3d')]['id'];}return db[_0xd515('0x3a')][_0xd515('0x3b')]({'where':{'id':_0x21c3dc[_0xd515('0x2e')]['id']}})[_0xd515('0x28')](handleEntityNotFound(_0x599054,null))[_0xd515('0x28')](saveUpdates(_0x21c3dc[_0xd515('0x3d')],null))[_0xd515('0x28')](respondWithResult(_0x599054,null))[_0xd515('0x3c')](handleError(_0x599054,null));};exports[_0xd515('0x29')]=function(_0x4201c3,_0x59a029){return db[_0xd515('0x3a')][_0xd515('0x3b')]({'where':{'id':_0x4201c3[_0xd515('0x2e')]['id']}})['then'](handleEntityNotFound(_0x59a029,null))[_0xd515('0x28')](removeEntity(_0x59a029,null))['catch'](handleError(_0x59a029,null));}; \ No newline at end of file +var _0xaf1d=['ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','show','params','model','rawAttributes','query','keys','filters','intersection','attributes','fields','include','merge','find','catch','body','ChatApplication','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','jsforce','querystring','papaparse'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaf1d,0x9f));var _0xdaf1=function(_0x53bdff,_0x377d10){_0x53bdff=_0x53bdff-0x0;var _0x43fdbf=_0xaf1d[_0x53bdff];return _0x43fdbf;};'use strict';var emlformat=require(_0xdaf1('0x0'));var rimraf=require(_0xdaf1('0x1'));var zipdir=require(_0xdaf1('0x2'));var jsonpatch=require(_0xdaf1('0x3'));var rp=require('request-promise');var moment=require(_0xdaf1('0x4'));var BPromise=require(_0xdaf1('0x5'));var Mustache=require('mustache');var util=require(_0xdaf1('0x6'));var path=require(_0xdaf1('0x7'));var sox=require(_0xdaf1('0x8'));var csv=require(_0xdaf1('0x9'));var ejs=require(_0xdaf1('0xa'));var fs=require('fs');var fs_extra=require(_0xdaf1('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xdaf1('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xdaf1('0xd'));var Papa=require(_0xdaf1('0xe'));var Redis=require(_0xdaf1('0xf'));var authService=require(_0xdaf1('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xdaf1('0x11'));var hardwareService=require(_0xdaf1('0x12'));var logger=require(_0xdaf1('0x13'))(_0xdaf1('0x14'));var utils=require(_0xdaf1('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xdaf1('0x16'));var db=require(_0xdaf1('0x17'))['db'];function respondWithStatusCode(_0x260c4b,_0x112c60){_0x112c60=_0x112c60||0xcc;return function(_0x3543e1){if(_0x3543e1){return _0x260c4b[_0xdaf1('0x18')](_0x112c60);}return _0x260c4b[_0xdaf1('0x19')](_0x112c60)[_0xdaf1('0x1a')]();};}function respondWithResult(_0x9a5ec6,_0x7393af){_0x7393af=_0x7393af||0xc8;return function(_0x2add26){if(_0x2add26){return _0x9a5ec6[_0xdaf1('0x19')](_0x7393af)[_0xdaf1('0x1b')](_0x2add26);}};}function respondWithFilteredResult(_0x4ed852,_0x506590){return function(_0x2e98d4){if(_0x2e98d4){var _0x562534=typeof _0x506590[_0xdaf1('0x1c')]==='undefined'&&typeof _0x506590[_0xdaf1('0x1d')]===_0xdaf1('0x1e');var _0xc1141c=_0x2e98d4['count'];var _0x1dd985=_0x562534?0x0:_0x506590['offset'];var _0x4896c1=_0x562534?_0x2e98d4[_0xdaf1('0x1f')]:_0x506590[_0xdaf1('0x1c')]+_0x506590[_0xdaf1('0x1d')];var _0x36792f;if(_0x4896c1>=_0xc1141c){_0x4896c1=_0xc1141c;_0x36792f=0xc8;}else{_0x36792f=0xce;}_0x4ed852['status'](_0x36792f);return _0x4ed852['set'](_0xdaf1('0x20'),_0x1dd985+'-'+_0x4896c1+'/'+_0xc1141c)[_0xdaf1('0x1b')](_0x2e98d4);}return null;};}function patchUpdates(_0x37b377){return function(_0x5030e5){try{jsonpatch[_0xdaf1('0x21')](_0x5030e5,_0x37b377,!![]);}catch(_0x2e776d){return BPromise[_0xdaf1('0x22')](_0x2e776d);}return _0x5030e5[_0xdaf1('0x23')]();};}function saveUpdates(_0x77d6c6,_0x110e33){return function(_0x446c5b){if(_0x446c5b){return _0x446c5b[_0xdaf1('0x24')](_0x77d6c6)[_0xdaf1('0x25')](function(_0x28916c){return _0x28916c;});}return null;};}function removeEntity(_0x56b426,_0x1f97e4){return function(_0x41b020){if(_0x41b020){return _0x41b020[_0xdaf1('0x26')]()['then'](function(){_0x56b426['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x556bd8,_0x2e6bf4){return function(_0x10c286){if(!_0x10c286){_0x556bd8['sendStatus'](0x194);}return _0x10c286;};}function handleError(_0x997245,_0x3c2166){_0x3c2166=_0x3c2166||0x1f4;return function(_0x3125d7){logger['error'](_0x3125d7[_0xdaf1('0x27')]);if(_0x3125d7[_0xdaf1('0x28')]){delete _0x3125d7['name'];}_0x997245[_0xdaf1('0x19')](_0x3c2166)[_0xdaf1('0x29')](_0x3125d7);};}exports[_0xdaf1('0x2a')]=function(_0x3892ae,_0x6731f6){var _0x16f6e0={'raw':!![],'where':{'id':_0x3892ae[_0xdaf1('0x2b')]['id']}},_0x520500={};_0x520500[_0xdaf1('0x2c')]=_['keys'](db['ChatApplication'][_0xdaf1('0x2d')]);_0x520500[_0xdaf1('0x2e')]=_[_0xdaf1('0x2f')](_0x3892ae['query']);_0x520500[_0xdaf1('0x30')]=_[_0xdaf1('0x31')](_0x520500[_0xdaf1('0x2c')],_0x520500[_0xdaf1('0x2e')]);_0x16f6e0[_0xdaf1('0x32')]=_['intersection'](_0x520500[_0xdaf1('0x2c')],qs[_0xdaf1('0x33')](_0x3892ae[_0xdaf1('0x2e')]['fields']));_0x16f6e0['attributes']=_0x16f6e0[_0xdaf1('0x32')]['length']?_0x16f6e0[_0xdaf1('0x32')]:_0x520500[_0xdaf1('0x2c')];if(_0x3892ae[_0xdaf1('0x2e')]['includeAll']){_0x16f6e0[_0xdaf1('0x34')]=[{'all':!![]}];}_0x16f6e0=_[_0xdaf1('0x35')]({},_0x16f6e0,_0x3892ae['options']);return db['ChatApplication'][_0xdaf1('0x36')](_0x16f6e0)[_0xdaf1('0x25')](handleEntityNotFound(_0x6731f6,null))['then'](respondWithResult(_0x6731f6,null))[_0xdaf1('0x37')](handleError(_0x6731f6,null));};exports[_0xdaf1('0x24')]=function(_0x318565,_0x57b9ca){if(_0x318565[_0xdaf1('0x38')]['id']){delete _0x318565[_0xdaf1('0x38')]['id'];}return db[_0xdaf1('0x39')][_0xdaf1('0x36')]({'where':{'id':_0x318565['params']['id']}})[_0xdaf1('0x25')](handleEntityNotFound(_0x57b9ca,null))[_0xdaf1('0x25')](saveUpdates(_0x318565[_0xdaf1('0x38')],null))[_0xdaf1('0x25')](respondWithResult(_0x57b9ca,null))[_0xdaf1('0x37')](handleError(_0x57b9ca,null));};exports['destroy']=function(_0x219551,_0x20dee8){return db[_0xdaf1('0x39')]['find']({'where':{'id':_0x219551[_0xdaf1('0x2b')]['id']}})['then'](handleEntityNotFound(_0x20dee8,null))[_0xdaf1('0x25')](removeEntity(_0x20dee8,null))[_0xdaf1('0x37')](handleError(_0x20dee8,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index e82bed4..394dcec 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 _0x1502=['moment','bluebird','path','rimraf','../../config/environment','./chatApplication.attributes','ChatApplication','chat_applications','utf8mb4','lodash','util','../../config/logger','api'];(function(_0x496738,_0x3f1a9f){var _0xee1381=function(_0x4dc50c){while(--_0x4dc50c){_0x496738['push'](_0x496738['shift']());}};_0xee1381(++_0x3f1a9f);}(_0x1502,0x1c3));var _0x2150=function(_0x196d3e,_0x2c56da){_0x196d3e=_0x196d3e-0x0;var _0x160f54=_0x1502[_0x196d3e];return _0x160f54;};'use strict';var _=require(_0x2150('0x0'));var util=require(_0x2150('0x1'));var logger=require(_0x2150('0x2'))(_0x2150('0x3'));var moment=require(_0x2150('0x4'));var BPromise=require(_0x2150('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2150('0x6'));var rimraf=require(_0x2150('0x7'));var config=require(_0x2150('0x8'));var attributes=require(_0x2150('0x9'));module['exports']=function(_0x2e34e9,_0x38dbdf){return _0x2e34e9['define'](_0x2150('0xa'),attributes,{'tableName':_0x2150('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2150('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x6db1=['ChatApplication','chat_applications','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./chatApplication.attributes','exports','define'];(function(_0x10a3b5,_0x195ca5){var _0x4c1604=function(_0x3e073c){while(--_0x3e073c){_0x10a3b5['push'](_0x10a3b5['shift']());}};_0x4c1604(++_0x195ca5);}(_0x6db1,0x13e));var _0x16db=function(_0x38d83c,_0x589bd0){_0x38d83c=_0x38d83c-0x0;var _0x38c3bb=_0x6db1[_0x38d83c];return _0x38c3bb;};'use strict';var _=require(_0x16db('0x0'));var util=require(_0x16db('0x1'));var logger=require(_0x16db('0x2'))(_0x16db('0x3'));var moment=require(_0x16db('0x4'));var BPromise=require(_0x16db('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x16db('0x6'));var rimraf=require(_0x16db('0x7'));var config=require(_0x16db('0x8'));var attributes=require(_0x16db('0x9'));module[_0x16db('0xa')]=function(_0x1cf88f,_0x38b8af){return _0x1cf88f[_0x16db('0xb')](_0x16db('0xc'),attributes,{'tableName':_0x16db('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x16db('0xe'),'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 c99f67e..dd597ec 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 _0x1cd2=['stringify','error','message','ChatApplication,\x20%s,\x20%s','result','catch','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0x1cd2,0xae));var _0x21cd=function(_0x20af23,_0x3b4d17){_0x20af23=_0x20af23-0x0;var _0x20983d=_0x1cd2[_0x20af23];return _0x20983d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x21cd('0x0'));var BPromise=require(_0x21cd('0x1'));var rs=require(_0x21cd('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x21cd('0x3'))['db'];var utils=require(_0x21cd('0x4'));var logger=require(_0x21cd('0x5'))(_0x21cd('0x6'));var config=require('../../config/environment');var jayson=require(_0x21cd('0x7'));var client=jayson['client'][_0x21cd('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5a2abd,_0x52f6b7,_0x321233){return new BPromise(function(_0x5853ad,_0x16c012){return client[_0x21cd('0x9')](_0x5a2abd,_0x321233)[_0x21cd('0xa')](function(_0x5e532a){logger[_0x21cd('0xb')]('ChatApplication,\x20%s,\x20%s',_0x52f6b7,_0x21cd('0xc'));logger[_0x21cd('0xd')](_0x21cd('0xe'),_0x52f6b7,_0x21cd('0xc'),JSON[_0x21cd('0xf')](_0x5e532a));if(_0x5e532a[_0x21cd('0x10')]){if(_0x5e532a['error']['code']===0x1f4){logger['error']('ChatApplication,\x20%s,\x20%s',_0x52f6b7,_0x5e532a[_0x21cd('0x10')]['message']);return _0x16c012(_0x5e532a[_0x21cd('0x10')][_0x21cd('0x11')]);}logger[_0x21cd('0x10')](_0x21cd('0x12'),_0x52f6b7,_0x5e532a[_0x21cd('0x10')][_0x21cd('0x11')]);return _0x5853ad(_0x5e532a[_0x21cd('0x10')][_0x21cd('0x11')]);}else{logger['info'](_0x21cd('0x12'),_0x52f6b7,_0x21cd('0xc'));_0x5853ad(_0x5e532a[_0x21cd('0x13')][_0x21cd('0x11')]);}})[_0x21cd('0x14')](function(_0x391958){logger['error'](_0x21cd('0x12'),_0x52f6b7,_0x391958);_0x16c012(_0x391958);});});} \ No newline at end of file +var _0x65a4=['jayson/promise','client','http','request','then','request\x20sent','ChatApplication,\x20%s,\x20%s,\x20%s','error','ChatApplication,\x20%s,\x20%s','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0xacc326,_0x56bc9f){var _0x37143f=function(_0x12526a){while(--_0x12526a){_0xacc326['push'](_0xacc326['shift']());}};_0x37143f(++_0x56bc9f);}(_0x65a4,0xf4));var _0x465a=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x65a4[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x465a('0x0'));var util=require('util');var moment=require(_0x465a('0x1'));var BPromise=require(_0x465a('0x2'));var rs=require(_0x465a('0x3'));var fs=require('fs');var Redis=require(_0x465a('0x4'));var db=require(_0x465a('0x5'))['db'];var utils=require(_0x465a('0x6'));var logger=require('../../config/logger')(_0x465a('0x7'));var config=require('../../config/environment');var jayson=require(_0x465a('0x8'));var client=jayson[_0x465a('0x9')][_0x465a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x31cf34,_0x343dc6,_0x3706ff){return new BPromise(function(_0xfcfeaa,_0x48ce11){return client[_0x465a('0xb')](_0x31cf34,_0x3706ff)[_0x465a('0xc')](function(_0x1c9eb5){logger['info']('ChatApplication,\x20%s,\x20%s',_0x343dc6,_0x465a('0xd'));logger['debug'](_0x465a('0xe'),_0x343dc6,_0x465a('0xd'),JSON['stringify'](_0x1c9eb5));if(_0x1c9eb5[_0x465a('0xf')]){if(_0x1c9eb5[_0x465a('0xf')]['code']===0x1f4){logger[_0x465a('0xf')](_0x465a('0x10'),_0x343dc6,_0x1c9eb5[_0x465a('0xf')][_0x465a('0x11')]);return _0x48ce11(_0x1c9eb5[_0x465a('0xf')][_0x465a('0x11')]);}logger[_0x465a('0xf')](_0x465a('0x10'),_0x343dc6,_0x1c9eb5[_0x465a('0xf')][_0x465a('0x11')]);return _0xfcfeaa(_0x1c9eb5[_0x465a('0xf')][_0x465a('0x11')]);}else{logger[_0x465a('0x12')](_0x465a('0x10'),_0x343dc6,_0x465a('0xd'));_0xfcfeaa(_0x1c9eb5[_0x465a('0x13')]['message']);}})[_0x465a('0x14')](function(_0x3d80b4){logger[_0x465a('0xf')](_0x465a('0x10'),_0x343dc6,_0x3d80b4);_0x48ce11(_0x3d80b4);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 3cc1b87..1818210 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 _0xeb70=['../../components/auth/service','../../config/environment','./chatApplication.controller','get','/:id','isAuthenticated','show','update','delete','destroy','exports','util','path','express','fs-extra'];(function(_0x5addbe,_0x3978c9){var _0x6287f2=function(_0x14af78){while(--_0x14af78){_0x5addbe['push'](_0x5addbe['shift']());}};_0x6287f2(++_0x3978c9);}(_0xeb70,0x173));var _0x0eb7=function(_0x117c97,_0x3ebe2b){_0x117c97=_0x117c97-0x0;var _0x47dedc=_0xeb70[_0x117c97];return _0x47dedc;};'use strict';var multer=require('multer');var util=require(_0x0eb7('0x0'));var path=require(_0x0eb7('0x1'));var timeout=require('connect-timeout');var express=require(_0x0eb7('0x2'));var router=express['Router']();var fs_extra=require(_0x0eb7('0x3'));var auth=require(_0x0eb7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x0eb7('0x5'));var controller=require(_0x0eb7('0x6'));router[_0x0eb7('0x7')](_0x0eb7('0x8'),auth[_0x0eb7('0x9')](),controller[_0x0eb7('0xa')]);router['put'](_0x0eb7('0x8'),auth[_0x0eb7('0x9')](),controller[_0x0eb7('0xb')]);router[_0x0eb7('0xc')](_0x0eb7('0x8'),auth[_0x0eb7('0x9')](),controller[_0x0eb7('0xd')]);module[_0x0eb7('0xe')]=router; \ No newline at end of file +var _0x8514=['destroy','exports','multer','util','path','express','Router','../../config/environment','./chatApplication.controller','get','isAuthenticated','put','/:id','delete'];(function(_0x196c4e,_0xb8263e){var _0x1fabb6=function(_0x35ba45){while(--_0x35ba45){_0x196c4e['push'](_0x196c4e['shift']());}};_0x1fabb6(++_0xb8263e);}(_0x8514,0x1a6));var _0x4851=function(_0x48afc5,_0x16647a){_0x48afc5=_0x48afc5-0x0;var _0x14a9b1=_0x8514[_0x48afc5];return _0x14a9b1;};'use strict';var multer=require(_0x4851('0x0'));var util=require(_0x4851('0x1'));var path=require(_0x4851('0x2'));var timeout=require('connect-timeout');var express=require(_0x4851('0x3'));var router=express[_0x4851('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4851('0x5'));var controller=require(_0x4851('0x6'));router[_0x4851('0x7')]('/:id',auth[_0x4851('0x8')](),controller['show']);router[_0x4851('0x9')](_0x4851('0xa'),auth[_0x4851('0x8')](),controller['update']);router[_0x4851('0xb')]('/:id',auth[_0x4851('0x8')](),controller[_0x4851('0xc')]);module[_0x4851('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 692c7bd..f3ee131 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 _0xd367=['exports','STRING'];(function(_0x440c0e,_0x2124b9){var _0x1bfaf4=function(_0x688b9f){while(--_0x688b9f){_0x440c0e['push'](_0x440c0e['shift']());}};_0x1bfaf4(++_0x2124b9);}(_0xd367,0x1dc));var _0x7d36=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd367[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require('sequelize');module[_0x7d36('0x0')]={'name':{'type':Sequelize[_0x7d36('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x7d36('0x1')]},'write':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0xfaee=['BOOLEAN','sequelize','exports','STRING'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0xfaee,0x15d));var _0xefae=function(_0x53cc66,_0x5162fc){_0x53cc66=_0x53cc66-0x0;var _0x6effae=_0xfaee[_0x53cc66];return _0x6effae;};'use strict';var Sequelize=require(_0xefae('0x0'));module[_0xefae('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xefae('0x2')]},'write':{'type':Sequelize[_0xefae('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 a5c7ec4..31a94b6 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 _0x7b4b=['YYYY-MM-DD\x20HH:mm:ss','hasOwnProperty','eml-format','rimraf','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','ChatGroup','rawAttributes','type','key','model','query','keys','intersection','attributes','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','includeAll','include','findAll','params','fields','length','find','catch','create','body','getUnread','ChatInternalMessage','user','addMembers','ids','omit','getMembers','findOne','User','pick','options','removeMembers','addMessage','getMessages','$gte','format'];(function(_0x1e5d56,_0x8a4924){var _0x37f85b=function(_0x250679){while(--_0x250679){_0x1e5d56['push'](_0x1e5d56['shift']());}};_0x37f85b(++_0x8a4924);}(_0x7b4b,0x1ce));var _0xb7b4=function(_0x513aa5,_0x1fba79){_0x513aa5=_0x513aa5-0x0;var _0x1a1a7c=_0x7b4b[_0x513aa5];return _0x1a1a7c;};'use strict';var emlformat=require(_0xb7b4('0x0'));var rimraf=require(_0xb7b4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb7b4('0x2'));var moment=require(_0xb7b4('0x3'));var BPromise=require(_0xb7b4('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xb7b4('0x5'));var sox=require(_0xb7b4('0x6'));var csv=require(_0xb7b4('0x7'));var ejs=require(_0xb7b4('0x8'));var fs=require('fs');var fs_extra=require(_0xb7b4('0x9'));var _=require('lodash');var squel=require(_0xb7b4('0xa'));var crypto=require('crypto');var jsforce=require(_0xb7b4('0xb'));var deskjs=require(_0xb7b4('0xc'));var toCsv=require(_0xb7b4('0x7'));var querystring=require(_0xb7b4('0xd'));var Papa=require(_0xb7b4('0xe'));var Redis=require(_0xb7b4('0xf'));var authService=require(_0xb7b4('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xb7b4('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb7b4('0x12'));var utils=require(_0xb7b4('0x13'));var config=require(_0xb7b4('0x14'));var licenseUtil=require(_0xb7b4('0x15'));var db=require(_0xb7b4('0x16'))['db'];config[_0xb7b4('0x17')]=_['defaults'](config[_0xb7b4('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0xb7b4('0x18'))(new Redis(config[_0xb7b4('0x17')]));require('./chatGroup.socket')[_0xb7b4('0x19')](socket);function respondWithStatusCode(_0x2cbed4,_0x3fb267){_0x3fb267=_0x3fb267||0xcc;return function(_0x14f4de){if(_0x14f4de){return _0x2cbed4[_0xb7b4('0x1a')](_0x3fb267);}return _0x2cbed4[_0xb7b4('0x1b')](_0x3fb267)[_0xb7b4('0x1c')]();};}function respondWithResult(_0x4d70a9,_0x27ebad){_0x27ebad=_0x27ebad||0xc8;return function(_0x1064d0){if(_0x1064d0){return _0x4d70a9[_0xb7b4('0x1b')](_0x27ebad)[_0xb7b4('0x1d')](_0x1064d0);}};}function respondWithFilteredResult(_0x2fe1b6,_0x2eb336){return function(_0x1daaa8){if(_0x1daaa8){var _0x321917=typeof _0x2eb336[_0xb7b4('0x1e')]===_0xb7b4('0x1f')&&typeof _0x2eb336[_0xb7b4('0x20')]===_0xb7b4('0x1f');var _0x707168=_0x1daaa8['count'];var _0x484de4=_0x321917?0x0:_0x2eb336[_0xb7b4('0x1e')];var _0xfe6849=_0x321917?_0x1daaa8[_0xb7b4('0x21')]:_0x2eb336['offset']+_0x2eb336['limit'];var _0x427fb7;if(_0xfe6849>=_0x707168){_0xfe6849=_0x707168;_0x427fb7=0xc8;}else{_0x427fb7=0xce;}_0x2fe1b6['status'](_0x427fb7);return _0x2fe1b6[_0xb7b4('0x22')](_0xb7b4('0x23'),_0x484de4+'-'+_0xfe6849+'/'+_0x707168)['json'](_0x1daaa8);}return null;};}function patchUpdates(_0x51cfd1){return function(_0x1fd025){try{jsonpatch[_0xb7b4('0x24')](_0x1fd025,_0x51cfd1,!![]);}catch(_0x2c33cf){return BPromise[_0xb7b4('0x25')](_0x2c33cf);}return _0x1fd025[_0xb7b4('0x26')]();};}function saveUpdates(_0x23c38b,_0x45555b){return function(_0x34c8e2){if(_0x34c8e2){return _0x34c8e2[_0xb7b4('0x27')](_0x23c38b)[_0xb7b4('0x28')](function(_0x3d8af7){return _0x3d8af7;});}return null;};}function removeEntity(_0x2e0e99,_0x12ee93){return function(_0x5b6d5a){if(_0x5b6d5a){return _0x5b6d5a[_0xb7b4('0x29')]()[_0xb7b4('0x28')](function(){_0x2e0e99[_0xb7b4('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0xba8502,_0x4f7d5c){return function(_0x50e37c){if(!_0x50e37c){_0xba8502[_0xb7b4('0x1a')](0x194);}return _0x50e37c;};}function handleError(_0xfd7c76,_0x14c7c1){_0x14c7c1=_0x14c7c1||0x1f4;return function(_0x6e39b6){logger[_0xb7b4('0x2a')](_0x6e39b6['stack']);if(_0x6e39b6[_0xb7b4('0x2b')]){delete _0x6e39b6[_0xb7b4('0x2b')];}_0xfd7c76[_0xb7b4('0x1b')](_0x14c7c1)[_0xb7b4('0x2c')](_0x6e39b6);};}exports[_0xb7b4('0x2d')]=function(_0x5dd56f,_0x11cbdb){var _0x46a0a9={},_0x2350cf={},_0x2b9798={'count':0x0,'rows':[]};var _0x2ab287=_[_0xb7b4('0x2e')](db[_0xb7b4('0x2f')][_0xb7b4('0x30')],function(_0x42a2a1){return{'name':_0x42a2a1['fieldName'],'type':_0x42a2a1[_0xb7b4('0x31')][_0xb7b4('0x32')]};});_0x2350cf[_0xb7b4('0x33')]=_['map'](_0x2ab287,_0xb7b4('0x2b'));_0x2350cf[_0xb7b4('0x34')]=_[_0xb7b4('0x35')](_0x5dd56f[_0xb7b4('0x34')]);_0x2350cf['filters']=_[_0xb7b4('0x36')](_0x2350cf['model'],_0x2350cf[_0xb7b4('0x34')]);_0x46a0a9[_0xb7b4('0x37')]=_[_0xb7b4('0x36')](_0x2350cf[_0xb7b4('0x33')],qs['fields'](_0x5dd56f[_0xb7b4('0x34')]['fields']));_0x46a0a9['attributes']=_0x46a0a9['attributes']['length']?_0x46a0a9['attributes']:_0x2350cf[_0xb7b4('0x33')];if(!_0x5dd56f[_0xb7b4('0x34')]['hasOwnProperty'](_0xb7b4('0x38'))){_0x46a0a9[_0xb7b4('0x20')]=qs[_0xb7b4('0x20')](_0x5dd56f['query'][_0xb7b4('0x20')]);_0x46a0a9[_0xb7b4('0x1e')]=qs['offset'](_0x5dd56f[_0xb7b4('0x34')][_0xb7b4('0x1e')]);}_0x46a0a9[_0xb7b4('0x39')]=qs['sort'](_0x5dd56f['query'][_0xb7b4('0x3a')]);_0x46a0a9['where']=qs[_0xb7b4('0x3b')](_['pick'](_0x5dd56f[_0xb7b4('0x34')],_0x2350cf[_0xb7b4('0x3b')]),_0x2ab287);if(_0x5dd56f['query'][_0xb7b4('0x3c')]){_0x46a0a9[_0xb7b4('0x3d')]=_[_0xb7b4('0x3e')](_0x46a0a9[_0xb7b4('0x3d')],{'$or':_[_0xb7b4('0x2e')](_0x2ab287,function(_0x365f31){if(_0x365f31[_0xb7b4('0x31')]!==_0xb7b4('0x3f')){var _0x50a47f={};_0x50a47f[_0x365f31['name']]={'$like':'%'+_0x5dd56f[_0xb7b4('0x34')][_0xb7b4('0x3c')]+'%'};return _0x50a47f;}})});}_0x46a0a9=_[_0xb7b4('0x3e')]({},_0x46a0a9,_0x5dd56f['options']);var _0xf59747={'where':_0x46a0a9[_0xb7b4('0x3d')]};return db[_0xb7b4('0x2f')][_0xb7b4('0x21')](_0xf59747)['then'](function(_0x1abde1){_0x2b9798[_0xb7b4('0x21')]=_0x1abde1;if(_0x5dd56f[_0xb7b4('0x34')][_0xb7b4('0x40')]){_0x46a0a9[_0xb7b4('0x41')]=[{'all':!![]}];}return db[_0xb7b4('0x2f')][_0xb7b4('0x42')](_0x46a0a9);})[_0xb7b4('0x28')](function(_0xd1e414){_0x2b9798['rows']=_0xd1e414;return _0x2b9798;})[_0xb7b4('0x28')](respondWithFilteredResult(_0x11cbdb,_0x46a0a9))['catch'](handleError(_0x11cbdb,null));};exports['show']=function(_0x579826,_0xc1652){var _0x594a02={'raw':!![],'where':{'id':_0x579826[_0xb7b4('0x43')]['id']}},_0x235455={};_0x235455[_0xb7b4('0x33')]=_['keys'](db[_0xb7b4('0x2f')][_0xb7b4('0x30')]);_0x235455[_0xb7b4('0x34')]=_['keys'](_0x579826[_0xb7b4('0x34')]);_0x235455[_0xb7b4('0x3b')]=_['intersection'](_0x235455[_0xb7b4('0x33')],_0x235455[_0xb7b4('0x34')]);_0x594a02['attributes']=_[_0xb7b4('0x36')](_0x235455[_0xb7b4('0x33')],qs[_0xb7b4('0x44')](_0x579826['query']['fields']));_0x594a02[_0xb7b4('0x37')]=_0x594a02[_0xb7b4('0x37')][_0xb7b4('0x45')]?_0x594a02[_0xb7b4('0x37')]:_0x235455['model'];if(_0x579826[_0xb7b4('0x34')][_0xb7b4('0x40')]){_0x594a02[_0xb7b4('0x41')]=[{'all':!![]}];}_0x594a02=_['merge']({},_0x594a02,_0x579826['options']);return db['ChatGroup'][_0xb7b4('0x46')](_0x594a02)[_0xb7b4('0x28')](handleEntityNotFound(_0xc1652,null))[_0xb7b4('0x28')](respondWithResult(_0xc1652,null))[_0xb7b4('0x47')](handleError(_0xc1652,null));};exports[_0xb7b4('0x48')]=function(_0x33cfd8,_0x4db448){return db[_0xb7b4('0x2f')]['create'](_0x33cfd8['body'],{})[_0xb7b4('0x28')](respondWithResult(_0x4db448,0xc9))[_0xb7b4('0x47')](handleError(_0x4db448,null));};exports[_0xb7b4('0x27')]=function(_0x46235b,_0x12a505){if(_0x46235b[_0xb7b4('0x49')]['id']){delete _0x46235b[_0xb7b4('0x49')]['id'];}return db['ChatGroup']['find']({'where':{'id':_0x46235b['params']['id']}})[_0xb7b4('0x28')](handleEntityNotFound(_0x12a505,null))[_0xb7b4('0x28')](saveUpdates(_0x46235b[_0xb7b4('0x49')],null))[_0xb7b4('0x28')](respondWithResult(_0x12a505,null))[_0xb7b4('0x47')](handleError(_0x12a505,null));};exports[_0xb7b4('0x29')]=function(_0x1b9a9c,_0x38c20c){return db['ChatGroup']['find']({'where':{'id':_0x1b9a9c[_0xb7b4('0x43')]['id']}})['then'](handleEntityNotFound(_0x38c20c,null))[_0xb7b4('0x28')](removeEntity(_0x38c20c,null))['catch'](handleError(_0x38c20c,null));};exports['describe']=function(_0x3277a6,_0xf96752){return db['ChatGroup']['describe']()[_0xb7b4('0x28')](respondWithResult(_0xf96752,null))[_0xb7b4('0x47')](handleError(_0xf96752,null));};exports[_0xb7b4('0x4a')]=function(_0x20b864,_0x54dce6,_0x1134ff){return db[_0xb7b4('0x4b')][_0xb7b4('0x21')]({'where':{'ChatGroupId':_0x20b864[_0xb7b4('0x43')]['id'],'ToId':_0x20b864[_0xb7b4('0x4c')]['id'],'read':![]}})[_0xb7b4('0x28')](function(_0x18f4ee){return{'id':_['toInteger'](_0x20b864[_0xb7b4('0x43')]['id']),'count':_0x18f4ee};})['then'](respondWithResult(_0x54dce6,null))['catch'](handleError(_0x54dce6,null));};exports['addMembers']=function(_0x1b0633,_0x245a52,_0x44edcc){return db[_0xb7b4('0x2f')][_0xb7b4('0x46')]({'where':{'id':_0x1b0633[_0xb7b4('0x43')]['id']}})[_0xb7b4('0x28')](handleEntityNotFound(_0x245a52,null))[_0xb7b4('0x28')](function(_0x558c0d){if(_0x558c0d){return _0x558c0d[_0xb7b4('0x4d')](_0x1b0633[_0xb7b4('0x49')][_0xb7b4('0x4e')],_[_0xb7b4('0x4f')](_0x1b0633[_0xb7b4('0x49')],[_0xb7b4('0x4e'),'id'])||{});}})[_0xb7b4('0x28')](respondWithResult(_0x245a52,null))[_0xb7b4('0x47')](handleError(_0x245a52,null));};exports[_0xb7b4('0x50')]=function(_0xf65a67,_0x2616ce,_0x4a1101){var _0x1f9917={};var _0x31eb25={};var _0x26017b;var _0xec4c98;return db[_0xb7b4('0x2f')][_0xb7b4('0x51')]({'where':{'id':_0xf65a67[_0xb7b4('0x43')]['id']}})[_0xb7b4('0x28')](handleEntityNotFound(_0x2616ce,null))[_0xb7b4('0x28')](function(_0x3039e2){if(_0x3039e2){_0x26017b=_0x3039e2;_0x31eb25[_0xb7b4('0x33')]=_[_0xb7b4('0x35')](db[_0xb7b4('0x52')]['rawAttributes']);_0x31eb25['query']=_[_0xb7b4('0x35')](_0xf65a67['query']);_0x31eb25[_0xb7b4('0x3b')]=_[_0xb7b4('0x36')](_0x31eb25[_0xb7b4('0x33')],_0x31eb25[_0xb7b4('0x34')]);_0x1f9917[_0xb7b4('0x37')]=_[_0xb7b4('0x36')](_0x31eb25[_0xb7b4('0x33')],qs[_0xb7b4('0x44')](_0xf65a67[_0xb7b4('0x34')][_0xb7b4('0x44')]));_0x1f9917[_0xb7b4('0x37')]=_0x1f9917[_0xb7b4('0x37')][_0xb7b4('0x45')]?_0x1f9917['attributes']:_0x31eb25[_0xb7b4('0x33')];_0x1f9917[_0xb7b4('0x39')]=qs[_0xb7b4('0x3a')](_0xf65a67['query'][_0xb7b4('0x3a')]);_0x1f9917[_0xb7b4('0x3d')]=qs['filters'](_[_0xb7b4('0x53')](_0xf65a67[_0xb7b4('0x34')],_0x31eb25['filters']));if(_0xf65a67[_0xb7b4('0x34')]['filter']){_0x1f9917['where']=_[_0xb7b4('0x3e')](_0x1f9917[_0xb7b4('0x3d')],{'$or':_[_0xb7b4('0x2e')](_0x1f9917[_0xb7b4('0x37')],function(_0x518ef5){var _0x4c54a5={};_0x4c54a5[_0x518ef5]={'$like':'%'+_0xf65a67[_0xb7b4('0x34')][_0xb7b4('0x3c')]+'%'};return _0x4c54a5;})});}_0x1f9917=_[_0xb7b4('0x3e')]({},_0x1f9917,_0xf65a67[_0xb7b4('0x54')]);return _0x26017b[_0xb7b4('0x50')](_0x1f9917);}})[_0xb7b4('0x28')](function(_0x55553e){if(_0x55553e){_0xec4c98=_0x55553e[_0xb7b4('0x45')];if(!_0xf65a67[_0xb7b4('0x34')]['hasOwnProperty']('nolimit')){_0x1f9917[_0xb7b4('0x20')]=qs[_0xb7b4('0x20')](_0xf65a67[_0xb7b4('0x34')][_0xb7b4('0x20')]);_0x1f9917['offset']=qs[_0xb7b4('0x1e')](_0xf65a67['query'][_0xb7b4('0x1e')]);}return _0x26017b[_0xb7b4('0x50')](_0x1f9917);}})[_0xb7b4('0x28')](function(_0xab212d){if(_0xab212d){return _0xab212d?{'count':_0xec4c98,'rows':_0xab212d}:null;}})[_0xb7b4('0x28')](respondWithResult(_0x2616ce,null))[_0xb7b4('0x47')](handleError(_0x2616ce,null));};exports[_0xb7b4('0x55')]=function(_0x3cfdb3,_0x396892,_0x2baf50){return db[_0xb7b4('0x2f')][_0xb7b4('0x46')]({'where':{'id':_0x3cfdb3['params']['id']}})[_0xb7b4('0x28')](handleEntityNotFound(_0x396892,null))[_0xb7b4('0x28')](function(_0x55a054){if(_0x55a054){return _0x55a054[_0xb7b4('0x55')](_0x3cfdb3[_0xb7b4('0x34')][_0xb7b4('0x4e')]);}})[_0xb7b4('0x28')](respondWithStatusCode(_0x396892,null))['catch'](handleError(_0x396892,null));};exports[_0xb7b4('0x56')]=function(_0x5aca2b,_0x3477e0,_0x109ae8){if(_0x5aca2b[_0xb7b4('0x49')]['id']){delete _0x5aca2b[_0xb7b4('0x49')]['id'];}return db['ChatGroup'][_0xb7b4('0x46')]({'where':{'id':_0x5aca2b['params']['id']}})['then'](handleEntityNotFound(_0x3477e0,null))[_0xb7b4('0x28')](function(_0x4599d7){if(_0x4599d7){_0x5aca2b[_0xb7b4('0x49')]['ChatGroupId']=_0x4599d7['id'];return db[_0xb7b4('0x4b')][_0xb7b4('0x48')](_0x5aca2b[_0xb7b4('0x49')]);}})[_0xb7b4('0x28')](respondWithResult(_0x3477e0,null))[_0xb7b4('0x47')](handleError(_0x3477e0,null));};exports[_0xb7b4('0x57')]=function(_0x1aeb63,_0x3afbce,_0x2d7693){var _0x20dcaa={};var _0x3632d1={};var _0x5b5748;var _0x185170;return db[_0xb7b4('0x2f')][_0xb7b4('0x51')]({'where':{'id':_0x1aeb63['params']['id']}})[_0xb7b4('0x28')](handleEntityNotFound(_0x3afbce,null))[_0xb7b4('0x28')](function(_0x2f5892){if(_0x2f5892){_0x5b5748=_0x2f5892;_0x3632d1['model']=_['keys'](db[_0xb7b4('0x4b')][_0xb7b4('0x30')]);_0x3632d1[_0xb7b4('0x34')]=_['keys'](_0x1aeb63[_0xb7b4('0x34')]);_0x3632d1[_0xb7b4('0x3b')]=_[_0xb7b4('0x36')](_0x3632d1['model'],_0x3632d1[_0xb7b4('0x34')]);_0x20dcaa[_0xb7b4('0x37')]=_[_0xb7b4('0x36')](_0x3632d1['model'],qs[_0xb7b4('0x44')](_0x1aeb63[_0xb7b4('0x34')]['fields']));_0x20dcaa[_0xb7b4('0x37')]=_0x20dcaa['attributes'][_0xb7b4('0x45')]?_0x20dcaa['attributes']:_0x3632d1[_0xb7b4('0x33')];_0x20dcaa[_0xb7b4('0x39')]=qs[_0xb7b4('0x3a')](_0x1aeb63[_0xb7b4('0x34')][_0xb7b4('0x3a')]);_0x20dcaa[_0xb7b4('0x3d')]=qs[_0xb7b4('0x3b')](_[_0xb7b4('0x53')](_0x1aeb63[_0xb7b4('0x34')],_0x3632d1[_0xb7b4('0x3b')]));if(_0x1aeb63[_0xb7b4('0x34')][_0xb7b4('0x3c')]){_0x20dcaa[_0xb7b4('0x3d')]=_[_0xb7b4('0x3e')](_0x20dcaa[_0xb7b4('0x3d')],{'$or':_[_0xb7b4('0x2e')](_0x20dcaa['attributes'],function(_0x235fc6){var _0x46b99a={};_0x46b99a[_0x235fc6]={'$like':'%'+_0x1aeb63[_0xb7b4('0x34')]['filter']+'%'};return _0x46b99a;})});}if(_0x1aeb63[_0xb7b4('0x34')][_0xb7b4('0x58')]){var _0x2616fd=_0x1aeb63['query'][_0xb7b4('0x58')]['split'](',');var _0x886b41={};_0x886b41[_0x2616fd[0x0]]={'$gte':moment(_0x2616fd[0x1])[_0xb7b4('0x59')](_0xb7b4('0x5a'))};_0x20dcaa[_0xb7b4('0x3d')]=_[_0xb7b4('0x3e')](_0x20dcaa[_0xb7b4('0x3d')],_0x886b41);}_0x20dcaa=_[_0xb7b4('0x3e')]({},_0x20dcaa,_0x1aeb63[_0xb7b4('0x54')]);return _0x5b5748[_0xb7b4('0x57')](_0x20dcaa);}})[_0xb7b4('0x28')](function(_0x786b72){if(_0x786b72){_0x185170=_0x786b72['length'];if(!_0x1aeb63[_0xb7b4('0x34')][_0xb7b4('0x5b')](_0xb7b4('0x38'))){_0x20dcaa[_0xb7b4('0x20')]=qs[_0xb7b4('0x20')](_0x1aeb63[_0xb7b4('0x34')][_0xb7b4('0x20')]);_0x20dcaa[_0xb7b4('0x1e')]=qs[_0xb7b4('0x1e')](_0x1aeb63[_0xb7b4('0x34')][_0xb7b4('0x1e')]);}return _0x5b5748[_0xb7b4('0x57')](_0x20dcaa);}})[_0xb7b4('0x28')](function(_0x4b99a9){if(_0x4b99a9){return _0x4b99a9?{'count':_0x185170,'rows':_0x4b99a9}:null;}})[_0xb7b4('0x28')](respondWithResult(_0x3afbce,null))[_0xb7b4('0x47')](handleError(_0x3afbce,null));}; \ No newline at end of file +var _0x53ec=['catch','body','params','describe','ChatInternalMessage','user','addMembers','ids','omit','findOne','User','rawAttributes','order','options','getMembers','nolimit','removeMembers','addMessage','ChatGroupId','create','getMessages','$gte','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','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/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./chatGroup.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','name','send','ChatGroup','fieldName','type','key','map','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','sort','filters','pick','filter','where','VIRTUAL','merge','includeAll','include','rows','show','find'];(function(_0x1b6546,_0x4d8b88){var _0x365e23=function(_0x480707){while(--_0x480707){_0x1b6546['push'](_0x1b6546['shift']());}};_0x365e23(++_0x4d8b88);}(_0x53ec,0x147));var _0xc53e=function(_0x2577d9,_0x8f2f28){_0x2577d9=_0x2577d9-0x0;var _0x36fe58=_0x53ec[_0x2577d9];return _0x36fe58;};'use strict';var emlformat=require(_0xc53e('0x0'));var rimraf=require(_0xc53e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc53e('0x2'));var rp=require(_0xc53e('0x3'));var moment=require('moment');var BPromise=require(_0xc53e('0x4'));var Mustache=require(_0xc53e('0x5'));var util=require(_0xc53e('0x6'));var path=require(_0xc53e('0x7'));var sox=require(_0xc53e('0x8'));var csv=require(_0xc53e('0x9'));var ejs=require(_0xc53e('0xa'));var fs=require('fs');var fs_extra=require(_0xc53e('0xb'));var _=require(_0xc53e('0xc'));var squel=require(_0xc53e('0xd'));var crypto=require(_0xc53e('0xe'));var jsforce=require(_0xc53e('0xf'));var deskjs=require(_0xc53e('0x10'));var toCsv=require(_0xc53e('0x9'));var querystring=require(_0xc53e('0x11'));var Papa=require(_0xc53e('0x12'));var Redis=require(_0xc53e('0x13'));var authService=require(_0xc53e('0x14'));var qs=require(_0xc53e('0x15'));var as=require(_0xc53e('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc53e('0x17'))(_0xc53e('0x18'));var utils=require(_0xc53e('0x19'));var config=require(_0xc53e('0x1a'));var licenseUtil=require(_0xc53e('0x1b'));var db=require(_0xc53e('0x1c'))['db'];config[_0xc53e('0x1d')]=_['defaults'](config[_0xc53e('0x1d')],{'host':_0xc53e('0x1e'),'port':0x18eb});var socket=require(_0xc53e('0x1f'))(new Redis(config['redis']));require(_0xc53e('0x20'))[_0xc53e('0x21')](socket);function respondWithStatusCode(_0x3003c9,_0x200bec){_0x200bec=_0x200bec||0xcc;return function(_0x10a1f7){if(_0x10a1f7){return _0x3003c9[_0xc53e('0x22')](_0x200bec);}return _0x3003c9[_0xc53e('0x23')](_0x200bec)[_0xc53e('0x24')]();};}function respondWithResult(_0x212f1a,_0xf0ec5e){_0xf0ec5e=_0xf0ec5e||0xc8;return function(_0x3a46b9){if(_0x3a46b9){return _0x212f1a[_0xc53e('0x23')](_0xf0ec5e)[_0xc53e('0x25')](_0x3a46b9);}};}function respondWithFilteredResult(_0x31c675,_0x424f5f){return function(_0x376c7f){if(_0x376c7f){var _0x391876=typeof _0x424f5f[_0xc53e('0x26')]===_0xc53e('0x27')&&typeof _0x424f5f[_0xc53e('0x28')]===_0xc53e('0x27');var _0x3e3904=_0x376c7f[_0xc53e('0x29')];var _0x45ac06=_0x391876?0x0:_0x424f5f[_0xc53e('0x26')];var _0x4ec45a=_0x391876?_0x376c7f['count']:_0x424f5f[_0xc53e('0x26')]+_0x424f5f['limit'];var _0x4d3e7a;if(_0x4ec45a>=_0x3e3904){_0x4ec45a=_0x3e3904;_0x4d3e7a=0xc8;}else{_0x4d3e7a=0xce;}_0x31c675['status'](_0x4d3e7a);return _0x31c675[_0xc53e('0x2a')](_0xc53e('0x2b'),_0x45ac06+'-'+_0x4ec45a+'/'+_0x3e3904)[_0xc53e('0x25')](_0x376c7f);}return null;};}function patchUpdates(_0xcbe7a6){return function(_0x241415){try{jsonpatch[_0xc53e('0x2c')](_0x241415,_0xcbe7a6,!![]);}catch(_0x144878){return BPromise[_0xc53e('0x2d')](_0x144878);}return _0x241415['save']();};}function saveUpdates(_0x499a87,_0x5714d6){return function(_0x5716a9){if(_0x5716a9){return _0x5716a9[_0xc53e('0x2e')](_0x499a87)[_0xc53e('0x2f')](function(_0x174d69){return _0x174d69;});}return null;};}function removeEntity(_0x8fa090,_0x269369){return function(_0x389bee){if(_0x389bee){return _0x389bee[_0xc53e('0x30')]()[_0xc53e('0x2f')](function(){_0x8fa090[_0xc53e('0x23')](0xcc)[_0xc53e('0x24')]();});}};}function handleEntityNotFound(_0xa1906a,_0x3a0f25){return function(_0x2c4d3e){if(!_0x2c4d3e){_0xa1906a[_0xc53e('0x22')](0x194);}return _0x2c4d3e;};}function handleError(_0xcbc1c2,_0x3768a5){_0x3768a5=_0x3768a5||0x1f4;return function(_0x58c9e9){logger[_0xc53e('0x31')](_0x58c9e9['stack']);if(_0x58c9e9[_0xc53e('0x32')]){delete _0x58c9e9[_0xc53e('0x32')];}_0xcbc1c2[_0xc53e('0x23')](_0x3768a5)[_0xc53e('0x33')](_0x58c9e9);};}exports['index']=function(_0x4ad03a,_0x2a9408){var _0xc2e202={},_0x53c3d0={},_0x5cf0aa={'count':0x0,'rows':[]};var _0x526c73=_['map'](db[_0xc53e('0x34')]['rawAttributes'],function(_0x17add7){return{'name':_0x17add7[_0xc53e('0x35')],'type':_0x17add7[_0xc53e('0x36')][_0xc53e('0x37')]};});_0x53c3d0['model']=_[_0xc53e('0x38')](_0x526c73,_0xc53e('0x32'));_0x53c3d0[_0xc53e('0x39')]=_[_0xc53e('0x3a')](_0x4ad03a[_0xc53e('0x39')]);_0x53c3d0['filters']=_['intersection'](_0x53c3d0[_0xc53e('0x3b')],_0x53c3d0[_0xc53e('0x39')]);_0xc2e202[_0xc53e('0x3c')]=_[_0xc53e('0x3d')](_0x53c3d0[_0xc53e('0x3b')],qs[_0xc53e('0x3e')](_0x4ad03a['query'][_0xc53e('0x3e')]));_0xc2e202['attributes']=_0xc2e202[_0xc53e('0x3c')][_0xc53e('0x3f')]?_0xc2e202[_0xc53e('0x3c')]:_0x53c3d0['model'];if(!_0x4ad03a['query'][_0xc53e('0x40')]('nolimit')){_0xc2e202[_0xc53e('0x28')]=qs[_0xc53e('0x28')](_0x4ad03a['query'][_0xc53e('0x28')]);_0xc2e202[_0xc53e('0x26')]=qs[_0xc53e('0x26')](_0x4ad03a[_0xc53e('0x39')][_0xc53e('0x26')]);}_0xc2e202['order']=qs[_0xc53e('0x41')](_0x4ad03a[_0xc53e('0x39')]['sort']);_0xc2e202['where']=qs[_0xc53e('0x42')](_[_0xc53e('0x43')](_0x4ad03a[_0xc53e('0x39')],_0x53c3d0['filters']),_0x526c73);if(_0x4ad03a[_0xc53e('0x39')][_0xc53e('0x44')]){_0xc2e202[_0xc53e('0x45')]=_['merge'](_0xc2e202['where'],{'$or':_[_0xc53e('0x38')](_0x526c73,function(_0x2c0f36){if(_0x2c0f36['type']!==_0xc53e('0x46')){var _0x19fae9={};_0x19fae9[_0x2c0f36[_0xc53e('0x32')]]={'$like':'%'+_0x4ad03a[_0xc53e('0x39')]['filter']+'%'};return _0x19fae9;}})});}_0xc2e202=_[_0xc53e('0x47')]({},_0xc2e202,_0x4ad03a['options']);var _0x341fec={'where':_0xc2e202[_0xc53e('0x45')]};return db[_0xc53e('0x34')][_0xc53e('0x29')](_0x341fec)[_0xc53e('0x2f')](function(_0x513d7d){_0x5cf0aa[_0xc53e('0x29')]=_0x513d7d;if(_0x4ad03a[_0xc53e('0x39')][_0xc53e('0x48')]){_0xc2e202[_0xc53e('0x49')]=[{'all':!![]}];}return db[_0xc53e('0x34')]['findAll'](_0xc2e202);})[_0xc53e('0x2f')](function(_0x3154a6){_0x5cf0aa[_0xc53e('0x4a')]=_0x3154a6;return _0x5cf0aa;})[_0xc53e('0x2f')](respondWithFilteredResult(_0x2a9408,_0xc2e202))['catch'](handleError(_0x2a9408,null));};exports[_0xc53e('0x4b')]=function(_0x332a76,_0xa167f9){var _0x1b3cc4={'raw':!![],'where':{'id':_0x332a76['params']['id']}},_0x59333e={};_0x59333e[_0xc53e('0x3b')]=_['keys'](db[_0xc53e('0x34')]['rawAttributes']);_0x59333e[_0xc53e('0x39')]=_['keys'](_0x332a76['query']);_0x59333e[_0xc53e('0x42')]=_[_0xc53e('0x3d')](_0x59333e[_0xc53e('0x3b')],_0x59333e[_0xc53e('0x39')]);_0x1b3cc4['attributes']=_[_0xc53e('0x3d')](_0x59333e['model'],qs[_0xc53e('0x3e')](_0x332a76['query'][_0xc53e('0x3e')]));_0x1b3cc4[_0xc53e('0x3c')]=_0x1b3cc4[_0xc53e('0x3c')][_0xc53e('0x3f')]?_0x1b3cc4[_0xc53e('0x3c')]:_0x59333e[_0xc53e('0x3b')];if(_0x332a76['query']['includeAll']){_0x1b3cc4[_0xc53e('0x49')]=[{'all':!![]}];}_0x1b3cc4=_[_0xc53e('0x47')]({},_0x1b3cc4,_0x332a76['options']);return db[_0xc53e('0x34')][_0xc53e('0x4c')](_0x1b3cc4)[_0xc53e('0x2f')](handleEntityNotFound(_0xa167f9,null))[_0xc53e('0x2f')](respondWithResult(_0xa167f9,null))[_0xc53e('0x4d')](handleError(_0xa167f9,null));};exports['create']=function(_0x4fb84a,_0x3ce123){return db[_0xc53e('0x34')]['create'](_0x4fb84a[_0xc53e('0x4e')],{})[_0xc53e('0x2f')](respondWithResult(_0x3ce123,0xc9))[_0xc53e('0x4d')](handleError(_0x3ce123,null));};exports[_0xc53e('0x2e')]=function(_0xdcb289,_0x86b286){if(_0xdcb289['body']['id']){delete _0xdcb289[_0xc53e('0x4e')]['id'];}return db[_0xc53e('0x34')][_0xc53e('0x4c')]({'where':{'id':_0xdcb289[_0xc53e('0x4f')]['id']}})['then'](handleEntityNotFound(_0x86b286,null))['then'](saveUpdates(_0xdcb289[_0xc53e('0x4e')],null))[_0xc53e('0x2f')](respondWithResult(_0x86b286,null))[_0xc53e('0x4d')](handleError(_0x86b286,null));};exports['destroy']=function(_0x37951c,_0x43f827){return db[_0xc53e('0x34')]['find']({'where':{'id':_0x37951c['params']['id']}})[_0xc53e('0x2f')](handleEntityNotFound(_0x43f827,null))[_0xc53e('0x2f')](removeEntity(_0x43f827,null))[_0xc53e('0x4d')](handleError(_0x43f827,null));};exports[_0xc53e('0x50')]=function(_0x1892f6,_0x36c7d5){return db['ChatGroup'][_0xc53e('0x50')]()[_0xc53e('0x2f')](respondWithResult(_0x36c7d5,null))['catch'](handleError(_0x36c7d5,null));};exports['getUnread']=function(_0x2bcc0c,_0x28c826,_0x2b8e80){return db[_0xc53e('0x51')][_0xc53e('0x29')]({'where':{'ChatGroupId':_0x2bcc0c[_0xc53e('0x4f')]['id'],'ToId':_0x2bcc0c[_0xc53e('0x52')]['id'],'read':![]}})['then'](function(_0x71a06a){return{'id':_['toInteger'](_0x2bcc0c[_0xc53e('0x4f')]['id']),'count':_0x71a06a};})['then'](respondWithResult(_0x28c826,null))[_0xc53e('0x4d')](handleError(_0x28c826,null));};exports[_0xc53e('0x53')]=function(_0x27f297,_0x2b5a89,_0x4a9692){return db[_0xc53e('0x34')]['find']({'where':{'id':_0x27f297[_0xc53e('0x4f')]['id']}})['then'](handleEntityNotFound(_0x2b5a89,null))[_0xc53e('0x2f')](function(_0x2cc666){if(_0x2cc666){return _0x2cc666['addMembers'](_0x27f297[_0xc53e('0x4e')][_0xc53e('0x54')],_[_0xc53e('0x55')](_0x27f297[_0xc53e('0x4e')],['ids','id'])||{});}})[_0xc53e('0x2f')](respondWithResult(_0x2b5a89,null))['catch'](handleError(_0x2b5a89,null));};exports['getMembers']=function(_0x3a34a3,_0x5107bd,_0x45479c){var _0x4c42d5={};var _0xb4c23e={};var _0x465ea7;var _0x21f726;return db[_0xc53e('0x34')][_0xc53e('0x56')]({'where':{'id':_0x3a34a3[_0xc53e('0x4f')]['id']}})['then'](handleEntityNotFound(_0x5107bd,null))[_0xc53e('0x2f')](function(_0x15725a){if(_0x15725a){_0x465ea7=_0x15725a;_0xb4c23e[_0xc53e('0x3b')]=_[_0xc53e('0x3a')](db[_0xc53e('0x57')][_0xc53e('0x58')]);_0xb4c23e[_0xc53e('0x39')]=_['keys'](_0x3a34a3['query']);_0xb4c23e['filters']=_[_0xc53e('0x3d')](_0xb4c23e[_0xc53e('0x3b')],_0xb4c23e[_0xc53e('0x39')]);_0x4c42d5[_0xc53e('0x3c')]=_[_0xc53e('0x3d')](_0xb4c23e['model'],qs[_0xc53e('0x3e')](_0x3a34a3[_0xc53e('0x39')][_0xc53e('0x3e')]));_0x4c42d5[_0xc53e('0x3c')]=_0x4c42d5[_0xc53e('0x3c')]['length']?_0x4c42d5['attributes']:_0xb4c23e[_0xc53e('0x3b')];_0x4c42d5[_0xc53e('0x59')]=qs['sort'](_0x3a34a3['query'][_0xc53e('0x41')]);_0x4c42d5[_0xc53e('0x45')]=qs['filters'](_[_0xc53e('0x43')](_0x3a34a3[_0xc53e('0x39')],_0xb4c23e[_0xc53e('0x42')]));if(_0x3a34a3[_0xc53e('0x39')]['filter']){_0x4c42d5['where']=_[_0xc53e('0x47')](_0x4c42d5[_0xc53e('0x45')],{'$or':_[_0xc53e('0x38')](_0x4c42d5['attributes'],function(_0x25fb94){var _0x297f12={};_0x297f12[_0x25fb94]={'$like':'%'+_0x3a34a3[_0xc53e('0x39')][_0xc53e('0x44')]+'%'};return _0x297f12;})});}_0x4c42d5=_[_0xc53e('0x47')]({},_0x4c42d5,_0x3a34a3[_0xc53e('0x5a')]);return _0x465ea7[_0xc53e('0x5b')](_0x4c42d5);}})[_0xc53e('0x2f')](function(_0x19169a){if(_0x19169a){_0x21f726=_0x19169a[_0xc53e('0x3f')];if(!_0x3a34a3['query'][_0xc53e('0x40')](_0xc53e('0x5c'))){_0x4c42d5[_0xc53e('0x28')]=qs['limit'](_0x3a34a3[_0xc53e('0x39')]['limit']);_0x4c42d5[_0xc53e('0x26')]=qs[_0xc53e('0x26')](_0x3a34a3[_0xc53e('0x39')][_0xc53e('0x26')]);}return _0x465ea7[_0xc53e('0x5b')](_0x4c42d5);}})[_0xc53e('0x2f')](function(_0x285705){if(_0x285705){return _0x285705?{'count':_0x21f726,'rows':_0x285705}:null;}})[_0xc53e('0x2f')](respondWithResult(_0x5107bd,null))[_0xc53e('0x4d')](handleError(_0x5107bd,null));};exports[_0xc53e('0x5d')]=function(_0xee7c16,_0x4bf468,_0x1a000f){return db[_0xc53e('0x34')][_0xc53e('0x4c')]({'where':{'id':_0xee7c16[_0xc53e('0x4f')]['id']}})[_0xc53e('0x2f')](handleEntityNotFound(_0x4bf468,null))[_0xc53e('0x2f')](function(_0x3e9599){if(_0x3e9599){return _0x3e9599[_0xc53e('0x5d')](_0xee7c16[_0xc53e('0x39')][_0xc53e('0x54')]);}})[_0xc53e('0x2f')](respondWithStatusCode(_0x4bf468,null))[_0xc53e('0x4d')](handleError(_0x4bf468,null));};exports[_0xc53e('0x5e')]=function(_0x6d3960,_0x33e708,_0x4d224f){if(_0x6d3960[_0xc53e('0x4e')]['id']){delete _0x6d3960[_0xc53e('0x4e')]['id'];}return db[_0xc53e('0x34')]['find']({'where':{'id':_0x6d3960[_0xc53e('0x4f')]['id']}})['then'](handleEntityNotFound(_0x33e708,null))[_0xc53e('0x2f')](function(_0x4f72f8){if(_0x4f72f8){_0x6d3960[_0xc53e('0x4e')][_0xc53e('0x5f')]=_0x4f72f8['id'];return db[_0xc53e('0x51')][_0xc53e('0x60')](_0x6d3960[_0xc53e('0x4e')]);}})['then'](respondWithResult(_0x33e708,null))[_0xc53e('0x4d')](handleError(_0x33e708,null));};exports[_0xc53e('0x61')]=function(_0x3f38e1,_0x15a33c,_0x5941c0){var _0x32a9e9={};var _0x7edffd={};var _0x5c5db8;var _0x290017;return db[_0xc53e('0x34')][_0xc53e('0x56')]({'where':{'id':_0x3f38e1[_0xc53e('0x4f')]['id']}})[_0xc53e('0x2f')](handleEntityNotFound(_0x15a33c,null))[_0xc53e('0x2f')](function(_0x281d20){if(_0x281d20){_0x5c5db8=_0x281d20;_0x7edffd[_0xc53e('0x3b')]=_[_0xc53e('0x3a')](db[_0xc53e('0x51')][_0xc53e('0x58')]);_0x7edffd[_0xc53e('0x39')]=_[_0xc53e('0x3a')](_0x3f38e1[_0xc53e('0x39')]);_0x7edffd[_0xc53e('0x42')]=_[_0xc53e('0x3d')](_0x7edffd['model'],_0x7edffd[_0xc53e('0x39')]);_0x32a9e9['attributes']=_[_0xc53e('0x3d')](_0x7edffd['model'],qs[_0xc53e('0x3e')](_0x3f38e1[_0xc53e('0x39')][_0xc53e('0x3e')]));_0x32a9e9[_0xc53e('0x3c')]=_0x32a9e9[_0xc53e('0x3c')][_0xc53e('0x3f')]?_0x32a9e9['attributes']:_0x7edffd[_0xc53e('0x3b')];_0x32a9e9[_0xc53e('0x59')]=qs[_0xc53e('0x41')](_0x3f38e1['query'][_0xc53e('0x41')]);_0x32a9e9['where']=qs['filters'](_['pick'](_0x3f38e1['query'],_0x7edffd[_0xc53e('0x42')]));if(_0x3f38e1['query'][_0xc53e('0x44')]){_0x32a9e9[_0xc53e('0x45')]=_[_0xc53e('0x47')](_0x32a9e9[_0xc53e('0x45')],{'$or':_[_0xc53e('0x38')](_0x32a9e9[_0xc53e('0x3c')],function(_0x3028de){var _0x4e4743={};_0x4e4743[_0x3028de]={'$like':'%'+_0x3f38e1['query'][_0xc53e('0x44')]+'%'};return _0x4e4743;})});}if(_0x3f38e1[_0xc53e('0x39')][_0xc53e('0x62')]){var _0x5166ac=_0x3f38e1[_0xc53e('0x39')][_0xc53e('0x62')]['split'](',');var _0x242782={};_0x242782[_0x5166ac[0x0]]={'$gte':moment(_0x5166ac[0x1])[_0xc53e('0x63')](_0xc53e('0x64'))};_0x32a9e9[_0xc53e('0x45')]=_['merge'](_0x32a9e9[_0xc53e('0x45')],_0x242782);}_0x32a9e9=_[_0xc53e('0x47')]({},_0x32a9e9,_0x3f38e1[_0xc53e('0x5a')]);return _0x5c5db8[_0xc53e('0x61')](_0x32a9e9);}})[_0xc53e('0x2f')](function(_0x465623){if(_0x465623){_0x290017=_0x465623[_0xc53e('0x3f')];if(!_0x3f38e1['query'][_0xc53e('0x40')](_0xc53e('0x5c'))){_0x32a9e9['limit']=qs[_0xc53e('0x28')](_0x3f38e1['query'][_0xc53e('0x28')]);_0x32a9e9[_0xc53e('0x26')]=qs[_0xc53e('0x26')](_0x3f38e1[_0xc53e('0x39')][_0xc53e('0x26')]);}return _0x5c5db8[_0xc53e('0x61')](_0x32a9e9);}})['then'](function(_0x103920){if(_0x103920){return _0x103920?{'count':_0x290017,'rows':_0x103920}:null;}})['then'](respondWithResult(_0x15a33c,null))[_0xc53e('0x4d')](handleError(_0x15a33c,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index f68cb39..8bd557c 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 _0x22a7=['ChatGroup','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x4a8e2d,_0x4aefc9){var _0x11bc28=function(_0x17b594){while(--_0x17b594){_0x4a8e2d['push'](_0x4a8e2d['shift']());}};_0x11bc28(++_0x4aefc9);}(_0x22a7,0xe4));var _0x722a=function(_0x1911ed,_0x4e8c73){_0x1911ed=_0x1911ed-0x0;var _0x11edaa=_0x22a7[_0x1911ed];return _0x11edaa;};'use strict';var EventEmitter=require(_0x722a('0x0'));var ChatGroup=require(_0x722a('0x1'))['db'][_0x722a('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x722a('0x3')](0x0);var events={'afterCreate':_0x722a('0x4'),'afterUpdate':_0x722a('0x5'),'afterDestroy':_0x722a('0x6')};function emitEvent(_0x43a0f5){return function(_0x464d07,_0x462040,_0x2b51f3){ChatGroupEvents['emit'](_0x43a0f5+':'+_0x464d07['id'],_0x464d07);ChatGroupEvents[_0x722a('0x7')](_0x43a0f5,_0x464d07);_0x2b51f3(null);};}for(var e in events){if(events[_0x722a('0x8')](e)){var event=events[e];ChatGroup[_0x722a('0x9')](e,emitEvent(event));}}module['exports']=ChatGroupEvents; \ No newline at end of file +var _0x9632=['exports','events','../../mysqldb','ChatGroup','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x57f993,_0x32a645){var _0x2703d6=function(_0x563777){while(--_0x563777){_0x57f993['push'](_0x57f993['shift']());}};_0x2703d6(++_0x32a645);}(_0x9632,0x109));var _0x2963=function(_0x456e6c,_0x505c52){_0x456e6c=_0x456e6c-0x0;var _0x373dcc=_0x9632[_0x456e6c];return _0x373dcc;};'use strict';var EventEmitter=require(_0x2963('0x0'));var ChatGroup=require(_0x2963('0x1'))['db'][_0x2963('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x2963('0x3')](0x0);var events={'afterCreate':_0x2963('0x4'),'afterUpdate':_0x2963('0x5'),'afterDestroy':_0x2963('0x6')};function emitEvent(_0x5f5833){return function(_0x4aa47c,_0x7e629f,_0x263ab9){ChatGroupEvents[_0x2963('0x7')](_0x5f5833+':'+_0x4aa47c['id'],_0x4aa47c);ChatGroupEvents[_0x2963('0x7')](_0x5f5833,_0x4aa47c);_0x263ab9(null);};}for(var e in events){if(events[_0x2963('0x8')](e)){var event=events[e];ChatGroup[_0x2963('0x9')](e,emitEvent(event));}}module[_0x2963('0xa')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index dfd2bd3..2c0158a 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 _0xb92d=['path','rimraf','./chatGroup.attributes','ChatGroup','chat_groups','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0xb92d,0xa1));var _0xdb92=function(_0x4fb9ed,_0x187ea0){_0x4fb9ed=_0x4fb9ed-0x0;var _0x263645=_0xb92d[_0x4fb9ed];return _0x263645;};'use strict';var _=require(_0xdb92('0x0'));var util=require(_0xdb92('0x1'));var logger=require(_0xdb92('0x2'))(_0xdb92('0x3'));var moment=require(_0xdb92('0x4'));var BPromise=require(_0xdb92('0x5'));var rp=require(_0xdb92('0x6'));var fs=require('fs');var path=require(_0xdb92('0x7'));var rimraf=require(_0xdb92('0x8'));var config=require('../../config/environment');var attributes=require(_0xdb92('0x9'));module['exports']=function(_0xf77bdd,_0x2ed444){return _0xf77bdd['define'](_0xdb92('0xa'),attributes,{'tableName':_0xdb92('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9d2b=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatGroup.attributes','define','ChatGroup','chat_groups','lodash','util'];(function(_0x550e29,_0x4047f){var _0x3515b6=function(_0x303fe2){while(--_0x303fe2){_0x550e29['push'](_0x550e29['shift']());}};_0x3515b6(++_0x4047f);}(_0x9d2b,0x15c));var _0xb9d2=function(_0x4b7e4d,_0x82d2ab){_0x4b7e4d=_0x4b7e4d-0x0;var _0x38d6af=_0x9d2b[_0x4b7e4d];return _0x38d6af;};'use strict';var _=require(_0xb9d2('0x0'));var util=require(_0xb9d2('0x1'));var logger=require(_0xb9d2('0x2'))(_0xb9d2('0x3'));var moment=require(_0xb9d2('0x4'));var BPromise=require(_0xb9d2('0x5'));var rp=require(_0xb9d2('0x6'));var fs=require('fs');var path=require(_0xb9d2('0x7'));var rimraf=require(_0xb9d2('0x8'));var config=require(_0xb9d2('0x9'));var attributes=require(_0xb9d2('0xa'));module['exports']=function(_0xe5a8cf,_0x2cca48){return _0xe5a8cf[_0xb9d2('0xb')](_0xb9d2('0xc'),attributes,{'tableName':_0xb9d2('0xd'),'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 0ca96ee..4e553c0 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 _0x5a52=['code','message','ChatGroup,\x20%s,\x20%s','result','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./chatGroup.socket','request','then','info','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x35eaf7,_0xe9b5ef){var _0x1ecb45=function(_0x289852){while(--_0x289852){_0x35eaf7['push'](_0x35eaf7['shift']());}};_0x1ecb45(++_0xe9b5ef);}(_0x5a52,0x18d));var _0x25a5=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x5a52[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x25a5('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x25a5('0x1'));var fs=require('fs');var Redis=require(_0x25a5('0x2'));var db=require(_0x25a5('0x3'))['db'];var utils=require(_0x25a5('0x4'));var logger=require(_0x25a5('0x5'))(_0x25a5('0x6'));var config=require(_0x25a5('0x7'));var jayson=require(_0x25a5('0x8'));var client=jayson['client'][_0x25a5('0x9')]({'port':0x232a});config['redis']=_[_0x25a5('0xa')](config[_0x25a5('0xb')],{'host':_0x25a5('0xc'),'port':0x18eb});var socket=require(_0x25a5('0xd'))(new Redis(config[_0x25a5('0xb')]));require(_0x25a5('0xe'))['register'](socket);function respondWithRpcPromise(_0x4dcda5,_0x428795,_0x304a26){return new BPromise(function(_0x107e85,_0x2a6e38){return client[_0x25a5('0xf')](_0x4dcda5,_0x304a26)[_0x25a5('0x10')](function(_0x1610b8){logger[_0x25a5('0x11')]('ChatGroup,\x20%s,\x20%s',_0x428795,_0x25a5('0x12'));logger[_0x25a5('0x13')](_0x25a5('0x14'),_0x428795,'request\x20sent',JSON[_0x25a5('0x15')](_0x1610b8));if(_0x1610b8['error']){if(_0x1610b8[_0x25a5('0x16')][_0x25a5('0x17')]===0x1f4){logger[_0x25a5('0x16')]('ChatGroup,\x20%s,\x20%s',_0x428795,_0x1610b8['error'][_0x25a5('0x18')]);return _0x2a6e38(_0x1610b8['error'][_0x25a5('0x18')]);}logger[_0x25a5('0x16')](_0x25a5('0x19'),_0x428795,_0x1610b8[_0x25a5('0x16')]['message']);return _0x107e85(_0x1610b8[_0x25a5('0x16')]['message']);}else{logger['info'](_0x25a5('0x19'),_0x428795,_0x25a5('0x12'));_0x107e85(_0x1610b8[_0x25a5('0x1a')][_0x25a5('0x18')]);}})[_0x25a5('0x1b')](function(_0x54987f){logger['error'](_0x25a5('0x19'),_0x428795,_0x54987f);_0x2a6e38(_0x54987f);});});} \ No newline at end of file +var _0x1a8f=['then','info','request\x20sent','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatGroup,\x20%s,\x20%s','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','register','request'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0x1a8f,0x87));var _0xf1a8=function(_0x481ff7,_0x2b6ebb){_0x481ff7=_0x481ff7-0x0;var _0x1c1573=_0x1a8f[_0x481ff7];return _0x1c1573;};'use strict';var _=require(_0xf1a8('0x0'));var util=require('util');var moment=require(_0xf1a8('0x1'));var BPromise=require(_0xf1a8('0x2'));var rs=require(_0xf1a8('0x3'));var fs=require('fs');var Redis=require(_0xf1a8('0x4'));var db=require(_0xf1a8('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xf1a8('0x6'));var client=jayson[_0xf1a8('0x7')][_0xf1a8('0x8')]({'port':0x232a});config['redis']=_[_0xf1a8('0x9')](config['redis'],{'host':_0xf1a8('0xa'),'port':0x18eb});var socket=require(_0xf1a8('0xb'))(new Redis(config[_0xf1a8('0xc')]));require('./chatGroup.socket')[_0xf1a8('0xd')](socket);function respondWithRpcPromise(_0x5012c6,_0x6915e2,_0x4d567f){return new BPromise(function(_0x1f2595,_0x3ff385){return client[_0xf1a8('0xe')](_0x5012c6,_0x4d567f)[_0xf1a8('0xf')](function(_0x49e1e1){logger[_0xf1a8('0x10')]('ChatGroup,\x20%s,\x20%s',_0x6915e2,_0xf1a8('0x11'));logger['debug'](_0xf1a8('0x12'),_0x6915e2,_0xf1a8('0x11'),JSON[_0xf1a8('0x13')](_0x49e1e1));if(_0x49e1e1[_0xf1a8('0x14')]){if(_0x49e1e1[_0xf1a8('0x14')][_0xf1a8('0x15')]===0x1f4){logger[_0xf1a8('0x14')](_0xf1a8('0x16'),_0x6915e2,_0x49e1e1[_0xf1a8('0x14')]['message']);return _0x3ff385(_0x49e1e1[_0xf1a8('0x14')][_0xf1a8('0x17')]);}logger[_0xf1a8('0x14')](_0xf1a8('0x16'),_0x6915e2,_0x49e1e1[_0xf1a8('0x14')][_0xf1a8('0x17')]);return _0x1f2595(_0x49e1e1[_0xf1a8('0x14')][_0xf1a8('0x17')]);}else{logger[_0xf1a8('0x10')](_0xf1a8('0x16'),_0x6915e2,_0xf1a8('0x11'));_0x1f2595(_0x49e1e1[_0xf1a8('0x18')][_0xf1a8('0x17')]);}})['catch'](function(_0x159d9d){logger[_0xf1a8('0x14')](_0xf1a8('0x16'),_0x6915e2,_0x159d9d);_0x3ff385(_0x159d9d);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index e243f53..04c737f 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 _0x001d=['removeListener','register','chatGroup:','./chatGroup.events','save','remove','update','emit'];(function(_0x1e2f5b,_0x60bf47){var _0x2bb7bc=function(_0x1ddf91){while(--_0x1ddf91){_0x1e2f5b['push'](_0x1e2f5b['shift']());}};_0x2bb7bc(++_0x60bf47);}(_0x001d,0x1d3));var _0xd001=function(_0x4054f7,_0x44b868){_0x4054f7=_0x4054f7-0x0;var _0x62b262=_0x001d[_0x4054f7];return _0x62b262;};'use strict';var ChatGroupEvents=require(_0xd001('0x0'));var events=[_0xd001('0x1'),_0xd001('0x2'),_0xd001('0x3')];function createListener(_0x2a0ee9,_0x30958b){return function(_0xa19fd4){_0x30958b[_0xd001('0x4')](_0x2a0ee9,_0xa19fd4);};}function removeListener(_0x16f820,_0x2fd4c6){return function(){ChatGroupEvents[_0xd001('0x5')](_0x16f820,_0x2fd4c6);};}exports[_0xd001('0x6')]=function(_0x1bd914){for(var _0x553afb=0x0,_0x4db95c=events['length'];_0x553afb<_0x4db95c;_0x553afb++){var _0x58335b=events[_0x553afb];var _0x194f3d=createListener(_0xd001('0x7')+_0x58335b,_0x1bd914);ChatGroupEvents['on'](_0x58335b,_0x194f3d);}}; \ No newline at end of file +var _0x40ba=['length','chatGroup:','./chatGroup.events','save','remove','update','emit','removeListener','register'];(function(_0x56a3bb,_0x4af1a2){var _0xe712b8=function(_0x1bd238){while(--_0x1bd238){_0x56a3bb['push'](_0x56a3bb['shift']());}};_0xe712b8(++_0x4af1a2);}(_0x40ba,0xad));var _0xa40b=function(_0x4fdc46,_0x2a3759){_0x4fdc46=_0x4fdc46-0x0;var _0x2c178a=_0x40ba[_0x4fdc46];return _0x2c178a;};'use strict';var ChatGroupEvents=require(_0xa40b('0x0'));var events=[_0xa40b('0x1'),_0xa40b('0x2'),_0xa40b('0x3')];function createListener(_0x237741,_0x24c05b){return function(_0x3c0ea2){_0x24c05b[_0xa40b('0x4')](_0x237741,_0x3c0ea2);};}function removeListener(_0x33a3e7,_0x107f5b){return function(){ChatGroupEvents[_0xa40b('0x5')](_0x33a3e7,_0x107f5b);};}exports[_0xa40b('0x6')]=function(_0x3d777a){for(var _0x24cfc2=0x0,_0x5a6eee=events[_0xa40b('0x7')];_0x24cfc2<_0x5a6eee;_0x24cfc2++){var _0x161276=events[_0x24cfc2];var _0x510cc9=createListener(_0xa40b('0x8')+_0x161276,_0x3d777a);ChatGroupEvents['on'](_0x161276,_0x510cc9);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 4175eec..1e30228 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 _0x6db0=['exports','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./chatGroup.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/unread','getUnread','/:id/members','getMessages','post','create','addMembers','addMessage','put','update','delete','destroy'];(function(_0x1c6e46,_0x173536){var _0x236239=function(_0x6a5894){while(--_0x6a5894){_0x1c6e46['push'](_0x1c6e46['shift']());}};_0x236239(++_0x173536);}(_0x6db0,0x12a));var _0x06db=function(_0x2daf14,_0x2ec184){_0x2daf14=_0x2daf14-0x0;var _0x2aa029=_0x6db0[_0x2daf14];return _0x2aa029;};'use strict';var multer=require('multer');var util=require(_0x06db('0x0'));var path=require(_0x06db('0x1'));var timeout=require(_0x06db('0x2'));var express=require(_0x06db('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x06db('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x06db('0x5'));var controller=require(_0x06db('0x6'));router[_0x06db('0x7')]('/',auth[_0x06db('0x8')](),controller[_0x06db('0x9')]);router[_0x06db('0x7')](_0x06db('0xa'),auth['isAuthenticated'](),controller[_0x06db('0xb')]);router[_0x06db('0x7')](_0x06db('0xc'),auth['isAuthenticated'](),controller[_0x06db('0xd')]);router[_0x06db('0x7')](_0x06db('0xe'),auth[_0x06db('0x8')](),controller[_0x06db('0xf')]);router[_0x06db('0x7')](_0x06db('0x10'),auth[_0x06db('0x8')](),controller['getMembers']);router[_0x06db('0x7')]('/:id/messages',auth[_0x06db('0x8')](),controller[_0x06db('0x11')]);router[_0x06db('0x12')]('/',auth[_0x06db('0x8')](),controller[_0x06db('0x13')]);router[_0x06db('0x12')]('/:id/members',auth[_0x06db('0x8')](),controller[_0x06db('0x14')]);router[_0x06db('0x12')]('/:id/messages',auth[_0x06db('0x8')](),controller[_0x06db('0x15')]);router[_0x06db('0x16')](_0x06db('0xc'),auth[_0x06db('0x8')](),controller[_0x06db('0x17')]);router[_0x06db('0x18')](_0x06db('0xc'),auth['isAuthenticated'](),controller[_0x06db('0x19')]);router[_0x06db('0x18')](_0x06db('0x10'),auth[_0x06db('0x8')](),controller['removeMembers']);module[_0x06db('0x1a')]=router; \ No newline at end of file +var _0x7ccd=['exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','index','/describe','isAuthenticated','describe','getUnread','getMembers','/:id/messages','getMessages','post','addMembers','addMessage','put','/:id','update','delete','removeMembers'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7ccd,0x139));var _0xd7cc=function(_0x2dc81b,_0x2063ae){_0x2dc81b=_0x2dc81b-0x0;var _0x3a2946=_0x7ccd[_0x2dc81b];return _0x3a2946;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xd7cc('0x0'));var timeout=require(_0xd7cc('0x1'));var express=require(_0xd7cc('0x2'));var router=express[_0xd7cc('0x3')]();var fs_extra=require(_0xd7cc('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xd7cc('0x5'));var config=require(_0xd7cc('0x6'));var controller=require(_0xd7cc('0x7'));router[_0xd7cc('0x8')]('/',auth['isAuthenticated'](),controller[_0xd7cc('0x9')]);router[_0xd7cc('0x8')](_0xd7cc('0xa'),auth[_0xd7cc('0xb')](),controller[_0xd7cc('0xc')]);router[_0xd7cc('0x8')]('/:id',auth[_0xd7cc('0xb')](),controller['show']);router[_0xd7cc('0x8')]('/:id/unread',auth[_0xd7cc('0xb')](),controller[_0xd7cc('0xd')]);router[_0xd7cc('0x8')]('/:id/members',auth[_0xd7cc('0xb')](),controller[_0xd7cc('0xe')]);router['get'](_0xd7cc('0xf'),auth[_0xd7cc('0xb')](),controller[_0xd7cc('0x10')]);router[_0xd7cc('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0xd7cc('0x11')]('/:id/members',auth['isAuthenticated'](),controller[_0xd7cc('0x12')]);router[_0xd7cc('0x11')]('/:id/messages',auth['isAuthenticated'](),controller[_0xd7cc('0x13')]);router[_0xd7cc('0x14')](_0xd7cc('0x15'),auth[_0xd7cc('0xb')](),controller[_0xd7cc('0x16')]);router[_0xd7cc('0x17')](_0xd7cc('0x15'),auth['isAuthenticated'](),controller['destroy']);router['delete']('/:id/members',auth[_0xd7cc('0xb')](),controller[_0xd7cc('0x18')]);module[_0xd7cc('0x19')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index c443495..d4bf4be 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 _0x28b7=['sequelize','exports','BOOLEAN','star','TEXT','STRING','DATE','ENUM','out'];(function(_0x1cd43e,_0x3c9426){var _0x2d32fa=function(_0x2c22b4){while(--_0x2c22b4){_0x1cd43e['push'](_0x1cd43e['shift']());}};_0x2d32fa(++_0x3c9426);}(_0x28b7,0x1dd));var _0x728b=function(_0x4a3baa,_0x19cb30){_0x4a3baa=_0x4a3baa-0x0;var _0x1e8aef=_0x28b7[_0x4a3baa];return _0x1e8aef;};'use strict';var Sequelize=require(_0x728b('0x0'));module[_0x728b('0x1')]={'closed':{'type':Sequelize[_0x728b('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize['ENUM']('star','thumb'),'defaultValue':_0x728b('0x3')},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize[_0x728b('0x4')]},'mailTranscript':{'type':Sequelize[_0x728b('0x5')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x728b('0x6')]},'disposition':{'type':Sequelize[_0x728b('0x5')]},'secondDisposition':{'type':Sequelize[_0x728b('0x5')]},'thirdDisposition':{'type':Sequelize[_0x728b('0x5')]},'note':{'type':Sequelize[_0x728b('0x5')]},'browserName':{'type':Sequelize[_0x728b('0x5')]},'browserVersion':{'type':Sequelize[_0x728b('0x5')]},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize[_0x728b('0x5')]},'deviceModel':{'type':Sequelize[_0x728b('0x5')]},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize[_0x728b('0x5')]},'referer':{'type':Sequelize[_0x728b('0x4')]},'customerIp':{'type':Sequelize[_0x728b('0x5')]},'formData':{'type':Sequelize[_0x728b('0x4')]('long')},'read1stAt':{'type':Sequelize['DATE']},'lastMsgAt':{'type':Sequelize[_0x728b('0x6')]},'lastMsgDirection':{'type':Sequelize[_0x728b('0x7')]('in',_0x728b('0x8')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x728b('0x5')]},'customerPort':{'type':Sequelize[_0x728b('0x5')]},'vidaooSessionId':{'type':Sequelize['TEXT']},'autoreplyExecuted':{'type':Sequelize[_0x728b('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x83d8=['STRING','DATE','out','exports','BOOLEAN','INTEGER','ENUM','star','TEXT'];(function(_0x232cb8,_0x390d88){var _0x319ea0=function(_0x3395aa){while(--_0x3395aa){_0x232cb8['push'](_0x232cb8['shift']());}};_0x319ea0(++_0x390d88);}(_0x83d8,0xdb));var _0x883d=function(_0x1bb727,_0xfaa60e){_0x1bb727=_0x1bb727-0x0;var _0x2001d5=_0x83d8[_0x1bb727];return _0x2001d5;};'use strict';var Sequelize=require('sequelize');module[_0x883d('0x0')]={'closed':{'type':Sequelize[_0x883d('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x883d('0x2')]},'ratingType':{'type':Sequelize[_0x883d('0x3')](_0x883d('0x4'),'thumb'),'defaultValue':_0x883d('0x4')},'ratingMessage':{'type':Sequelize[_0x883d('0x5')]},'pathTranscript':{'type':Sequelize[_0x883d('0x5')]},'mailTranscript':{'type':Sequelize[_0x883d('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x883d('0x7')]},'disposition':{'type':Sequelize[_0x883d('0x6')]},'secondDisposition':{'type':Sequelize[_0x883d('0x6')]},'thirdDisposition':{'type':Sequelize[_0x883d('0x6')]},'note':{'type':Sequelize[_0x883d('0x6')]},'browserName':{'type':Sequelize[_0x883d('0x6')]},'browserVersion':{'type':Sequelize[_0x883d('0x6')]},'osName':{'type':Sequelize[_0x883d('0x6')]},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize[_0x883d('0x6')]},'deviceVendor':{'type':Sequelize[_0x883d('0x6')]},'deviceType':{'type':Sequelize[_0x883d('0x6')]},'referer':{'type':Sequelize[_0x883d('0x5')]},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x883d('0x5')]('long')},'read1stAt':{'type':Sequelize[_0x883d('0x7')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x883d('0x3')]('in',_0x883d('0x8')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize[_0x883d('0x6')]},'vidaooSessionId':{'type':Sequelize[_0x883d('0x5')]},'autoreplyExecuted':{'type':Sequelize[_0x883d('0x1')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x883d('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 85abb50..d732194 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 _0xd463=['Sequelize','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','customUpdate','Contact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','UserId','closed','attachmentUpload','file','originalname','basename','filename','mimetype','Attachment','attachId','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','download','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','Messages','User','ChatWebsiteId','CmContact','length','%s%d','agentAlias','System','customer','Visitor','ContactId','website_alias','agent_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','secret','MailAccount','MailServerOut','Smtp','CloudProvider','getSmtpOptions','SendMail','\x22%s\x22\x20<%s>','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','ids','omit','getMessages','intersection','hasOwnProperty','nolimit','limit','sort','where','ChatInteractionId','filter','$gte','options','include','rows','getMyMessages','pick','addTags','setTags','spread','Tag','color','chatInteractionTags:save','removeTags','server','files','transcript-%d-%s.zip','push','firstName','attachments','read','Owner','get','mkdirSync','Account','N.A.','toString','disposition','browserName','referer','customerIp','customerPort','existsSync','createReadStream','pipe','createWriteStream','YYYY-MM-DD\x20HH:mm:ss','lastName','value','renderFile','views','downloadInteraction.ejs','Chat','createPdfFromHTML','err','unlinkSync','rimraf','zip-dir','util','path','ejs','../../components/interaction/service','../../components/export/pdf','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./chatInteraction.socket','register','client','ChatInteraction,\x20%s,\x20%s','request\x20sent','error','message','info','result','catch','status','json','offset','undefined','count','set','update','then','destroy','end','stack','name','render','merge','body','contact','interaction','account','index','map','ChatInteraction','rawAttributes','fieldName','type','findAll','chat','show','params','model','keys','query','filters','fields','attributes','includeAll','find','create','describe','createVidaooSession','findOne','ChatWebsite','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','user','fullname','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','follow','parse'];(function(_0xdb255f,_0x3e9f0d){var _0x922e3c=function(_0x3da198){while(--_0x3da198){_0xdb255f['push'](_0xdb255f['shift']());}};_0x922e3c(++_0x3e9f0d);}(_0xd463,0x139));var _0x3d46=function(_0x5484f4,_0x4f2c3a){_0x5484f4=_0x5484f4-0x0;var _0x7f7dc9=_0xd463[_0x5484f4];return _0x7f7dc9;};'use strict';var rimraf=require(_0x3d46('0x0'));var zipdir=require(_0x3d46('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x3d46('0x2'));var path=require(_0x3d46('0x3'));var ejs=require(_0x3d46('0x4'));var fs=require('fs');var _=require('lodash');var Redis=require('ioredis');var interaction=require(_0x3d46('0x5'));var qs=require('../../components/parsers/qs');var pdf=require(_0x3d46('0x6'));var logger=require('../../config/logger')('api');var config=require(_0x3d46('0x7'));var db=require(_0x3d46('0x8'))['db'];config[_0x3d46('0x9')]=_[_0x3d46('0xa')](config[_0x3d46('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x3d46('0xb'))(new Redis(config[_0x3d46('0x9')]));require(_0x3d46('0xc'))[_0x3d46('0xd')](socket);var jayson=require('jayson/promise');var client=jayson[_0x3d46('0xe')]['http']({'port':0x232b});var client9004=jayson[_0x3d46('0xe')]['http']({'port':0x232c});function respondWithRpcPromise(_0x424dca,_0x38f9e8,_0x48ded,_0x18ec0b){return new BPromise(function(_0x285583,_0x378d28){var _0x51b499=_0x18ec0b||client;return _0x51b499['request'](_0x424dca,_0x48ded)['then'](function(_0x19b5f2){logger['info'](_0x3d46('0xf'),_0x38f9e8,_0x3d46('0x10'));logger['debug']('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x38f9e8,'request\x20sent',JSON['stringify'](_0x19b5f2));if(_0x19b5f2[_0x3d46('0x11')]){if(_0x19b5f2['error']['code']===0x1f4){logger['error'](_0x3d46('0xf'),_0x38f9e8,_0x19b5f2[_0x3d46('0x11')]['message']);return _0x378d28(_0x19b5f2[_0x3d46('0x11')][_0x3d46('0x12')]);}logger[_0x3d46('0x11')](_0x3d46('0xf'),_0x38f9e8,_0x19b5f2[_0x3d46('0x11')][_0x3d46('0x12')]);return _0x285583(_0x19b5f2['error'][_0x3d46('0x12')]);}else{logger[_0x3d46('0x13')](_0x3d46('0xf'),_0x38f9e8,_0x3d46('0x10'));_0x285583(_0x19b5f2[_0x3d46('0x14')][_0x3d46('0x12')]);}})[_0x3d46('0x15')](function(_0x501a80){logger[_0x3d46('0x11')](_0x3d46('0xf'),_0x38f9e8,_0x501a80);_0x378d28(_0x501a80);});});}function respondWithStatusCode(_0x3dc3dd,_0xb51e08){_0xb51e08=_0xb51e08||0xcc;return function(_0x2ec010){if(_0x2ec010){return _0x3dc3dd['sendStatus'](_0xb51e08);}return _0x3dc3dd[_0x3d46('0x16')](_0xb51e08)['end']();};}function respondWithResult(_0x28a58a,_0x2d52aa){_0x2d52aa=_0x2d52aa||0xc8;return function(_0x485c32){if(_0x485c32){return _0x28a58a[_0x3d46('0x16')](_0x2d52aa)[_0x3d46('0x17')](_0x485c32);}};}function respondWithFilteredResult(_0x21b97e,_0x2fcd83){return function(_0x5e46e5){if(_0x5e46e5){var _0x26c600=typeof _0x2fcd83[_0x3d46('0x18')]==='undefined'&&typeof _0x2fcd83['limit']===_0x3d46('0x19');var _0x2f135a=_0x5e46e5[_0x3d46('0x1a')];var _0x30f56a=_0x26c600?0x0:_0x2fcd83['offset'];var _0x53161b=_0x26c600?_0x5e46e5[_0x3d46('0x1a')]:_0x2fcd83[_0x3d46('0x18')]+_0x2fcd83['limit'];var _0x101381;if(_0x53161b>=_0x2f135a){_0x53161b=_0x2f135a;_0x101381=0xc8;}else{_0x101381=0xce;}_0x21b97e[_0x3d46('0x16')](_0x101381);return _0x21b97e[_0x3d46('0x1b')]('Content-Range',_0x30f56a+'-'+_0x53161b+'/'+_0x2f135a)[_0x3d46('0x17')](_0x5e46e5);}return null;};}function saveUpdates(_0x57ccc9){return function(_0x10a76b){if(_0x10a76b){return _0x10a76b[_0x3d46('0x1c')](_0x57ccc9)[_0x3d46('0x1d')](function(_0x46da00){return _0x46da00;});}return null;};}function removeEntity(_0x3f43f8){return function(_0x23544d){if(_0x23544d){return _0x23544d[_0x3d46('0x1e')]()[_0x3d46('0x1d')](function(){_0x3f43f8[_0x3d46('0x16')](0xcc)[_0x3d46('0x1f')]();});}};}function handleEntityNotFound(_0x44021a){return function(_0x2d57f2){if(!_0x2d57f2){_0x44021a['sendStatus'](0x194);}return _0x2d57f2;};}function handleError(_0xca5409,_0x4ceb12){_0x4ceb12=_0x4ceb12||0x1f4;return function(_0x6775d){logger[_0x3d46('0x11')](_0x6775d[_0x3d46('0x20')]);if(_0x6775d[_0x3d46('0x21')]){delete _0x6775d['name'];}_0xca5409[_0x3d46('0x16')](_0x4ceb12)['send'](_0x6775d);};}function getMustacheRender(_0x222ef0,_0xe1cf44){return Mustache[_0x3d46('0x22')](_0x222ef0,_[_0x3d46('0x23')](_0xe1cf44[_0x3d46('0x24')],{'contact':_0xe1cf44[_0x3d46('0x25')],'message':_0xe1cf44[_0x3d46('0x12')],'agent':_0xe1cf44['agent'],'interaction':_0xe1cf44[_0x3d46('0x26')],'account':_0xe1cf44[_0x3d46('0x27')]}))||'';}exports[_0x3d46('0x28')]=function(_0x53d1f8,_0x3a9e3){var _0x2f5b8a={};var _0x416a60=_[_0x3d46('0x29')](db[_0x3d46('0x2a')][_0x3d46('0x2b')],function(_0x5e61ec){return{'name':_0x5e61ec[_0x3d46('0x2c')],'type':_0x5e61ec[_0x3d46('0x2d')]['key']};});_0x2f5b8a=qs['getOptions'](_0x416a60,_0x53d1f8);return interaction[_0x3d46('0x2e')](_0x3d46('0x2f'),_0x53d1f8['query'],_0x53d1f8['user'],_0x2f5b8a,_0x416a60)[_0x3d46('0x1d')](respondWithFilteredResult(_0x3a9e3,_0x2f5b8a))['catch'](handleError(_0x3a9e3,null));};exports[_0x3d46('0x30')]=function(_0x5672b8,_0x18ff05){var _0x1d5460={'raw':![],'where':{'id':_0x5672b8[_0x3d46('0x31')]['id']}},_0x20b87a={};_0x20b87a[_0x3d46('0x32')]=_[_0x3d46('0x33')](db[_0x3d46('0x2a')][_0x3d46('0x2b')]);_0x20b87a[_0x3d46('0x34')]=_['keys'](_0x5672b8['query']);_0x20b87a[_0x3d46('0x35')]=_['intersection'](_0x20b87a[_0x3d46('0x32')],_0x20b87a[_0x3d46('0x34')]);_0x1d5460['attributes']=_['intersection'](_0x20b87a[_0x3d46('0x32')],qs[_0x3d46('0x36')](_0x5672b8[_0x3d46('0x34')][_0x3d46('0x36')]));_0x1d5460[_0x3d46('0x37')]=_0x1d5460['attributes']['length']?_0x1d5460['attributes']:_0x20b87a[_0x3d46('0x32')];if(_0x5672b8[_0x3d46('0x34')][_0x3d46('0x38')]){_0x1d5460['include']=[{'all':!![]}];}_0x1d5460=_[_0x3d46('0x23')]({},_0x1d5460,_0x5672b8['options']);return db[_0x3d46('0x2a')][_0x3d46('0x39')](_0x1d5460)['then'](handleEntityNotFound(_0x18ff05,null))[_0x3d46('0x1d')](respondWithResult(_0x18ff05,null))['catch'](handleError(_0x18ff05,null));};exports[_0x3d46('0x3a')]=function(_0x32ac59,_0x5f379f){return db[_0x3d46('0x2a')][_0x3d46('0x3a')](_0x32ac59[_0x3d46('0x24')],{})[_0x3d46('0x1d')](respondWithResult(_0x5f379f,0xc9))[_0x3d46('0x15')](handleError(_0x5f379f,null));};exports[_0x3d46('0x1c')]=function(_0x70993d,_0x5ea568){if(_0x70993d['body']['id']){delete _0x70993d[_0x3d46('0x24')]['id'];}return db[_0x3d46('0x2a')][_0x3d46('0x39')]({'where':{'id':_0x70993d[_0x3d46('0x31')]['id']}})[_0x3d46('0x1d')](handleEntityNotFound(_0x5ea568,null))[_0x3d46('0x1d')](saveUpdates(_0x70993d[_0x3d46('0x24')],null))[_0x3d46('0x1d')](respondWithResult(_0x5ea568,null))[_0x3d46('0x15')](handleError(_0x5ea568,null));};exports[_0x3d46('0x1e')]=function(_0x15885d,_0x47d4ef){return db[_0x3d46('0x2a')][_0x3d46('0x39')]({'where':{'id':_0x15885d['params']['id']}})[_0x3d46('0x1d')](handleEntityNotFound(_0x47d4ef,null))[_0x3d46('0x1d')](removeEntity(_0x47d4ef,null))['catch'](handleError(_0x47d4ef,null));};exports[_0x3d46('0x3b')]=function(_0xbdbeb3,_0x4cf737){return db[_0x3d46('0x2a')][_0x3d46('0x3b')]()[_0x3d46('0x1d')](respondWithResult(_0x4cf737,null))['catch'](handleError(_0x4cf737,null));};exports[_0x3d46('0x3c')]=function(_0x20adc3,_0x4eab29){var _0x2591b4=_0x20adc3[_0x3d46('0x31')]['id'];var _0x5768c0;var _0x13a411;var _0x89cc38;return db[_0x3d46('0x2a')][_0x3d46('0x3d')]({'where':{'id':_0x2591b4}})[_0x3d46('0x1d')](function(_0x30d60){_0x5768c0=_0x30d60;return db[_0x3d46('0x3e')][_0x3d46('0x3d')]({'where':{'id':_0x30d60['ChatWebsiteId']},'attributes':['id',_0x3d46('0x3f'),_0x3d46('0x40'),_0x3d46('0x41'),_0x3d46('0x42'),_0x3d46('0x43')],'raw':!![]});})['then'](function(_0xcd8955){if(_0xcd8955&&_0xcd8955['vidaooApiKey']&&_0xcd8955[_0x3d46('0x40')]){_0x13a411=_0xcd8955;var _0x59ae11={'interaction':{'id':_0x2591b4},'agent':{'id':_0x20adc3[_0x3d46('0x44')]['id'],'name':_0x20adc3[_0x3d46('0x44')]['name'],'fullname':_0x20adc3['user'][_0x3d46('0x45')],'email':_0x20adc3[_0x3d46('0x44')][_0x3d46('0x46')]},'contact':_0x20adc3[_0x3d46('0x24')][_0x3d46('0x25')],'account':_0x20adc3[_0x3d46('0x24')]['account']};var _0x396bee={'rejectUnauthorized':![],'method':_0x3d46('0x47'),'url':_0x3d46('0x48'),'headers':{'X-APIKEY':_0xcd8955[_0x3d46('0x3f')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x20adc3[_0x3d46('0x44')][_0x3d46('0x46')]],'buttons':null,'topic':_0x13a411[_0x3d46('0x41')],'note':_['isNull'](_0x13a411['vidaooNote'])?null:getMustacheRender(_0x13a411[_0x3d46('0x42')],_0x59ae11),'metadata':null},'redirect':_0x3d46('0x49'),'json':!![]};try{if(!_['isNull'](_0x13a411['vidaooMetadata'])){var _0x567a7b=getMustacheRender(_0x13a411[_0x3d46('0x43')],_0x59ae11);var _0x235377=JSON[_0x3d46('0x4a')](_0x567a7b);_0x396bee[_0x3d46('0x24')]['metadata']=_0x235377;}}catch(_0x342ee3){throw new db[(_0x3d46('0x4b'))][(_0x3d46('0x4c'))](_0x3d46('0x4d'));}return rp(_0x396bee);}else{throw new db[(_0x3d46('0x4b'))][(_0x3d46('0x4c'))](_0x3d46('0x4e'));}})[_0x3d46('0x1d')](function(_0x49fda3){_0x89cc38=_0x49fda3;if(_0x89cc38['id']){var _0xacaa4e={'body':_0x89cc38[_0x3d46('0x4f')],'ChatWebsiteId':_0x13a411['id'],'ChatInteractionId':_0x5768c0['id'],'direction':_0x3d46('0x50'),'UserId':_0x20adc3[_0x3d46('0x44')]['id']};return db[_0x3d46('0x51')][_0x3d46('0x3a')](_0xacaa4e,{});}else{throw new db[(_0x3d46('0x4b'))][(_0x3d46('0x4c'))](_0x3d46('0x52'));}})[_0x3d46('0x1d')](function(){return _0x5768c0['updateAttributes']({'vidaooSessionId':_0x89cc38['id']});})[_0x3d46('0x1d')](respondWithResult(_0x4eab29,null))[_0x3d46('0x15')](handleError(_0x4eab29,null));};exports[_0x3d46('0x53')]=function(_0x15b84b,_0xb02869){if(_0x15b84b[_0x3d46('0x24')]['id']){delete _0x15b84b['body']['id'];}return db[_0x3d46('0x2a')][_0x3d46('0x39')]({'where':{'id':_0x15b84b[_0x3d46('0x31')]['id']},'include':[{'model':db['CmContact'],'as':_0x3d46('0x54')}]})['then'](handleEntityNotFound(_0xb02869,null))[_0x3d46('0x1d')](saveUpdates(_0x15b84b[_0x3d46('0x24')],null))['then'](respondWithResult(_0xb02869,null))[_0x3d46('0x15')](handleError(_0xb02869,null));};exports[_0x3d46('0x55')]=function(_0x490169,_0x3a79a6){if(_0x490169[_0x3d46('0x24')]['id']){delete _0x490169[_0x3d46('0x24')]['id'];}return db['ChatInteraction'][_0x3d46('0x39')]({'where':{'id':_0x490169['params']['id']}})[_0x3d46('0x1d')](function(_0x147e59){if(!_0x147e59){logger[_0x3d46('0x11')](_0x3d46('0x56'),_0x3d46('0x55'),0x194,_0x3d46('0x57'));_0x3a79a6['sendStatus'](0x194);}else{if(_0x147e59[_0x3d46('0x58')]){throw new db['Sequelize'][(_0x3d46('0x4c'))]('Interaction\x20already\x20assigned');}}return _0x147e59;})[_0x3d46('0x1d')](function(_0x80f85a){if(_0x80f85a){return _0x80f85a[_0x3d46('0x1c')]({'closed':_0x490169[_0x3d46('0x24')][_0x3d46('0x59')],'disposition':_0x490169['body']['disposition']})[_0x3d46('0x1d')](function(_0x5c7037){return _0x5c7037;});}})['then'](function(){return respondWithRpcPromise('AbandonInteraction',_0x3d46('0x55'),_0x490169[_0x3d46('0x24')],client9004);})['then'](respondWithResult(_0x3a79a6,null))[_0x3d46('0x15')](handleError(_0x3a79a6,null));};exports[_0x3d46('0x5a')]=function(_0x35daaa,_0x1a5e66){_0x35daaa['body'][_0x3d46('0x21')]=_0x35daaa[_0x3d46('0x5b')][_0x3d46('0x5c')];_0x35daaa[_0x3d46('0x24')][_0x3d46('0x5d')]=_0x35daaa[_0x3d46('0x5b')][_0x3d46('0x5e')];_0x35daaa[_0x3d46('0x24')][_0x3d46('0x2d')]=_0x35daaa[_0x3d46('0x5b')][_0x3d46('0x5f')];return db[_0x3d46('0x60')][_0x3d46('0x3a')](_0x35daaa[_0x3d46('0x24')])[_0x3d46('0x1d')](respondWithResult(_0x1a5e66,0xc9))[_0x3d46('0x15')](handleError(_0x1a5e66,null));};exports['attachmentDownload']=function(_0x238a7f,_0x2bf2fd){return db[_0x3d46('0x2a')][_0x3d46('0x3d')]({'where':{'id':_0x238a7f[_0x3d46('0x31')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x2bf2fd,null))[_0x3d46('0x1d')](function(_0x16189c){if(_0x16189c){if(_0x16189c[_0x3d46('0x59')]){return _0x2bf2fd['status'](0x193)[_0x3d46('0x17')]({'status':0x193,'message':'Unauthorized'});}return db[_0x3d46('0x60')][_0x3d46('0x3d')]({'where':{'id':_0x238a7f[_0x3d46('0x34')][_0x3d46('0x61')]},'raw':!![]})['then'](handleEntityNotFound(_0x2bf2fd,null));}})[_0x3d46('0x1d')](function(_0x4e3b7a){if(_0x4e3b7a){var _0x1baee4=_0x4e3b7a[_0x3d46('0x62')]!==null;var _0x7f920c=path[_0x3d46('0x63')](config[_0x3d46('0x64')],_0x3d46('0x65'));if(_0x1baee4){_0x7f920c=path['join'](_0x7f920c,_0x3d46('0x66'));}var _0x2b7716=path[_0x3d46('0x63')](_0x7f920c,_0x4e3b7a['basename']);return _0x2bf2fd[_0x3d46('0x67')](_0x2b7716);}})[_0x3d46('0x15')](handleError(_0x2bf2fd,null));};exports['close']=function(_0x423a54,_0x417bf7){var _0x3c6d16=null;var _0x4b1225=null;var _0x5789cc=null;if(_0x423a54[_0x3d46('0x24')]['id']){delete _0x423a54[_0x3d46('0x24')]['id'];}if(_0x423a54['body'][_0x3d46('0x68')]){_0x5789cc=path['join'](config['root'],_0x3d46('0x69'),util[_0x3d46('0x6a')](_0x3d46('0x6b'),Date[_0x3d46('0x6c')]()));_0x423a54['body'][_0x3d46('0x6d')]=_0x5789cc;}return db[_0x3d46('0x2a')][_0x3d46('0x39')]({'where':{'id':_0x423a54['params']['id']},'include':[{'model':db[_0x3d46('0x51')],'as':_0x3d46('0x6e'),'include':[{'model':db[_0x3d46('0x6f')],'as':_0x3d46('0x6f')}]}]})[_0x3d46('0x1d')](handleEntityNotFound(_0x417bf7,null))[_0x3d46('0x1d')](saveUpdates(_0x423a54[_0x3d46('0x24')],null))[_0x3d46('0x1d')](function(_0x3dd1f8){if(_0x3dd1f8){_0x3c6d16=_0x3dd1f8;return db[_0x3d46('0x3e')][_0x3d46('0x39')]({'where':{'id':_0x3c6d16[_0x3d46('0x70')]}});}})[_0x3d46('0x1d')](function(_0x347ccc){if(_0x347ccc){_0x4b1225=_0x347ccc;return db[_0x3d46('0x71')][_0x3d46('0x39')]({'where':{'id':_0x3c6d16['ContactId']}});}})[_0x3d46('0x1d')](function(_0x431524){if(_0x431524){if(_0x5789cc){var _0x5898b0=null;for(var _0x1a1093=0x1;_0x1a1093<_0x3c6d16['Messages'][_0x3d46('0x72')];++_0x1a1093){_0x5898b0=_0x3c6d16[_0x3d46('0x6e')][_0x1a1093];var _0x5cbb27=_0x5898b0[_0x3d46('0x58')]?util[_0x3d46('0x6a')](_0x3d46('0x73'),_0x4b1225[_0x3d46('0x74')],_0x5898b0['UserId']):_0x3d46('0x75');var _0x5c0032=_0x423a54[_0x3d46('0x24')][_0x3d46('0x76')]||util['format'](_0x3d46('0x73'),_0x3d46('0x77'),_0x5898b0[_0x3d46('0x78')]);switch(_0x4b1225['agentIdentifier']){case _0x3d46('0x79'):_0x5cbb27=_0x5898b0[_0x3d46('0x58')]?util[_0x3d46('0x6a')]('%s%d',_0x4b1225[_0x3d46('0x74')],_0x5898b0[_0x3d46('0x58')]):_0x3d46('0x75');break;case _0x3d46('0x7a'):_0x5cbb27=_0x5898b0['UserId']?_0x5898b0['User'][_0x3d46('0x7b')]||_0x5898b0[_0x3d46('0x6f')][_0x3d46('0x45')]:_0x3d46('0x75');break;case _0x3d46('0x7c'):_0x5cbb27=_0x5898b0[_0x3d46('0x58')]?_0x5898b0[_0x3d46('0x6f')][_0x3d46('0x45')]:'System';break;default:_0x5cbb27=_0x5898b0[_0x3d46('0x58')]?util['format'](_0x3d46('0x73'),_0x4b1225['agentAlias'],_0x5898b0[_0x3d46('0x58')]):_0x3d46('0x75');}var _0xb8b4a4=util[_0x3d46('0x6a')](_0x3d46('0x7d'),moment(_0x5898b0[_0x3d46('0x7e')])[_0x3d46('0x6a')](_0x3d46('0x7f')),_0x5898b0[_0x3d46('0x80')]==='in'?_0x5c0032:_0x5cbb27,_0x5898b0[_0x3d46('0x24')]);if(!_0x5898b0[_0x3d46('0x81')]){fs['appendFileSync'](_0x5789cc,_0xb8b4a4);}}return db[_0x3d46('0x82')][_0x3d46('0x3d')]({'where':{'service':!![]},'include':[{'model':db[_0x3d46('0x83')],'as':_0x3d46('0x84'),'raw':!![],'include':[{'model':db[_0x3d46('0x85')],'as':'CloudProvider','raw':!![]}]}]});}}})[_0x3d46('0x1d')](function(_0x1ed05f){if(!_0x1ed05f||!_0x1ed05f[_0x3d46('0x84')]||!_0x423a54['body'])return _0x3c6d16;var _0x4d49f9=_0x1ed05f[_0x3d46('0x86')]();return respondWithRpcPromise(_0x3d46('0x87'),'sendMail',{'account':_0x4d49f9,'message':{'from':util[_0x3d46('0x6a')](_0x3d46('0x88'),_0x1ed05f['name'],_0x1ed05f['email']||_0x1ed05f[_0x3d46('0x84')][_0x3d46('0x44')]),'to':_0x423a54['body'][_0x3d46('0x68')],'subject':'Mail\x20Transcript','text':util[_0x3d46('0x6a')](_0x3d46('0x89'),_0x423a54[_0x3d46('0x24')][_0x3d46('0x68')]),'attachments':[{'path':_0x5789cc}]}})[_0x3d46('0x1d')](function(){return _0x3c6d16;})[_0x3d46('0x15')](function(_0x35f43f){logger[_0x3d46('0x11')](_0x35f43f);});})[_0x3d46('0x1d')](respondWithStatusCode(_0x417bf7,0xc8))['catch'](handleError(_0x417bf7,null));};exports['addMessage']=function(_0x10e2bd,_0x16c65e){return db[_0x3d46('0x51')][_0x3d46('0x39')]({'where':{'id':_0x10e2bd[_0x3d46('0x31')]['id']}})[_0x3d46('0x1d')](handleEntityNotFound(_0x16c65e,null))[_0x3d46('0x1d')](function(_0x51428a){if(_0x51428a){return _0x51428a['addMessage'](_0x10e2bd['body'][_0x3d46('0x8a')],_[_0x3d46('0x8b')](_0x10e2bd[_0x3d46('0x24')],[_0x3d46('0x8a'),'id'])||{});}})[_0x3d46('0x1d')](respondWithResult(_0x16c65e,null))[_0x3d46('0x15')](handleError(_0x16c65e,null));};exports[_0x3d46('0x8c')]=function(_0x5a8218,_0x28f91c){var _0x10db33={'raw':![],'where':{}};var _0xa5843c={};var _0x3f9be6={'count':0x0,'rows':[]};return db[_0x3d46('0x2a')][_0x3d46('0x3d')]({'where':{'id':_0x5a8218['params']['id']}})[_0x3d46('0x1d')](handleEntityNotFound(_0x28f91c,null))[_0x3d46('0x1d')](function(_0x297a09){if(_0x297a09){_0xa5843c[_0x3d46('0x32')]=_[_0x3d46('0x33')](db[_0x3d46('0x51')][_0x3d46('0x2b')]);_0xa5843c[_0x3d46('0x34')]=_[_0x3d46('0x33')](_0x5a8218['query']);_0xa5843c[_0x3d46('0x35')]=_[_0x3d46('0x8d')](_0xa5843c[_0x3d46('0x32')],_0xa5843c[_0x3d46('0x34')]);_0x10db33[_0x3d46('0x37')]=_['intersection'](_0xa5843c[_0x3d46('0x32')],qs['fields'](_0x5a8218['query'][_0x3d46('0x36')]));_0x10db33[_0x3d46('0x37')]=_0x10db33[_0x3d46('0x37')][_0x3d46('0x72')]?_0x10db33[_0x3d46('0x37')]:_0xa5843c[_0x3d46('0x32')];if(!_0x5a8218[_0x3d46('0x34')][_0x3d46('0x8e')](_0x3d46('0x8f'))){_0x10db33[_0x3d46('0x90')]=qs['limit'](_0x5a8218[_0x3d46('0x34')][_0x3d46('0x90')]);_0x10db33[_0x3d46('0x18')]=qs['offset'](_0x5a8218[_0x3d46('0x34')]['offset']);}_0x10db33['order']=qs[_0x3d46('0x91')](_0x5a8218['query']['sort']);_0x10db33[_0x3d46('0x92')]=qs[_0x3d46('0x35')](_['pick'](_0x5a8218[_0x3d46('0x34')],_0xa5843c[_0x3d46('0x35')]));_0x10db33[_0x3d46('0x92')][_0x3d46('0x93')]=_0x297a09['id'];if(_0x5a8218[_0x3d46('0x34')][_0x3d46('0x94')]){_0x10db33[_0x3d46('0x92')]=_[_0x3d46('0x23')](_0x10db33['where'],{'$or':_[_0x3d46('0x29')](_0x10db33[_0x3d46('0x37')],function(_0x249e1f){var _0x23c5e6={};_0x23c5e6[_0x249e1f]={'$like':'%'+_0x5a8218[_0x3d46('0x34')][_0x3d46('0x94')]+'%'};return _0x23c5e6;})});}if(_0x5a8218[_0x3d46('0x34')]['$gte']){var _0x2a69ba=_0x5a8218['query'][_0x3d46('0x95')]['split'](',');var _0x24c1f5={};_0x24c1f5[_0x2a69ba[0x0]]={'$gte':moment(_0x2a69ba[0x1])[_0x3d46('0x6a')]('YYYY-MM-DD\x20HH:mm:ss')};_0x10db33['where']=_['merge'](_0x10db33[_0x3d46('0x92')],_0x24c1f5);}_0x10db33=_[_0x3d46('0x23')]({},_0x10db33,_0x5a8218[_0x3d46('0x96')]);return db['ChatMessage'][_0x3d46('0x1a')]({'where':_0x10db33[_0x3d46('0x92')]})[_0x3d46('0x1d')](function(_0x41be3f){_0x3f9be6['count']=_0x41be3f;if(_0x5a8218[_0x3d46('0x34')][_0x3d46('0x38')]){_0x10db33[_0x3d46('0x97')]=[{'all':!![]}];}return db[_0x3d46('0x51')][_0x3d46('0x2e')](_0x10db33);})['then'](function(_0x4e1c61){_0x3f9be6[_0x3d46('0x98')]=_0x4e1c61;return _0x3f9be6;});}})[_0x3d46('0x1d')](respondWithFilteredResult(_0x28f91c,_0x10db33))[_0x3d46('0x15')](handleError(_0x28f91c,null));};exports[_0x3d46('0x99')]=function(_0x19d951,_0x420612){var _0x4c9d86={'where':{}},_0x3637d0={},_0x1bad8f={'count':0x0,'rows':[]};return db[_0x3d46('0x2a')][_0x3d46('0x3d')]({'where':{'id':_0x19d951[_0x3d46('0x31')]['id']}})[_0x3d46('0x1d')](handleEntityNotFound(_0x420612,null))[_0x3d46('0x1d')](function(_0x406cde){if(_0x406cde){_0x3637d0[_0x3d46('0x32')]=_['keys'](db[_0x3d46('0x51')][_0x3d46('0x2b')]);_0x3637d0[_0x3d46('0x34')]=_['keys'](_0x19d951['query']);_0x3637d0[_0x3d46('0x35')]=_[_0x3d46('0x8d')](_0x3637d0[_0x3d46('0x32')],_0x3637d0['query']);_0x4c9d86[_0x3d46('0x37')]=_['intersection'](_0x3637d0[_0x3d46('0x32')],qs[_0x3d46('0x36')](_0x19d951[_0x3d46('0x34')]['fields']));_0x4c9d86[_0x3d46('0x37')]=_0x4c9d86[_0x3d46('0x37')][_0x3d46('0x72')]?_0x4c9d86[_0x3d46('0x37')]:_0x3637d0[_0x3d46('0x32')];if(!_0x19d951[_0x3d46('0x34')][_0x3d46('0x8e')](_0x3d46('0x8f'))){_0x4c9d86[_0x3d46('0x90')]=qs[_0x3d46('0x90')](_0x19d951[_0x3d46('0x34')][_0x3d46('0x90')]);_0x4c9d86[_0x3d46('0x18')]=qs['offset'](_0x19d951['query']['offset']);}_0x4c9d86['order']=qs[_0x3d46('0x91')](_0x19d951['query'][_0x3d46('0x91')]);_0x4c9d86[_0x3d46('0x92')]=qs[_0x3d46('0x35')](_[_0x3d46('0x9a')](_0x19d951[_0x3d46('0x34')],_0x3637d0[_0x3d46('0x35')]));_0x4c9d86[_0x3d46('0x92')][_0x3d46('0x93')]=_0x406cde['id'];if(_0x19d951['query'][_0x3d46('0x94')]){_0x4c9d86[_0x3d46('0x92')]=_[_0x3d46('0x23')](_0x4c9d86['where'],{'$or':_[_0x3d46('0x29')](_0x4c9d86[_0x3d46('0x37')],function(_0x379edf){var _0x38bd50={};_0x38bd50[_0x379edf]={'$like':'%'+_0x19d951[_0x3d46('0x34')]['filter']+'%'};return _0x38bd50;})});}_0x4c9d86[_0x3d46('0x92')][_0x3d46('0x81')]=![];if(_0x19d951['query']['id']){_0x4c9d86[_0x3d46('0x92')]['id']={'$gt':_0x19d951[_0x3d46('0x34')]['id']};}_0x4c9d86=_['merge']({},_0x4c9d86,_0x19d951[_0x3d46('0x96')]);return db[_0x3d46('0x51')][_0x3d46('0x1a')]({'where':_0x4c9d86[_0x3d46('0x92')]})[_0x3d46('0x1d')](function(_0x1f6509){_0x1bad8f[_0x3d46('0x1a')]=_0x1f6509;_0x4c9d86[_0x3d46('0x97')]=[];if(_0x19d951['query']['includeAgent']){_0x4c9d86['include']['push']({'model':db[_0x3d46('0x6f')],'as':'User','attributes':['id',_0x3d46('0x45'),_0x3d46('0x7b')]});}if(_0x19d951[_0x3d46('0x34')]['includeAll']){_0x4c9d86[_0x3d46('0x97')]=[{'all':!![]}];}return db[_0x3d46('0x51')]['findAll'](_0x4c9d86);})[_0x3d46('0x1d')](function(_0x240a35){_0x1bad8f[_0x3d46('0x98')]=_0x240a35;return _0x1bad8f;});}})[_0x3d46('0x1d')](respondWithFilteredResult(_0x420612,_0x4c9d86))[_0x3d46('0x15')](handleError(_0x420612,null));};exports[_0x3d46('0x9b')]=function(_0x26b33a,_0x2117f5){return db[_0x3d46('0x2a')][_0x3d46('0x39')]({'where':{'id':_0x26b33a[_0x3d46('0x31')]['id']}})['then'](handleEntityNotFound(_0x2117f5,null))['then'](function(_0x3effaf){if(_0x3effaf){return _0x3effaf[_0x3d46('0x9c')](_0x26b33a[_0x3d46('0x24')][_0x3d46('0x8a')],_['omit'](_0x26b33a[_0x3d46('0x24')],['ids','id'])||{})[_0x3d46('0x9d')](function(){return db[_0x3d46('0x9e')]['findAll']({'attributes':['id',_0x3d46('0x21'),_0x3d46('0x9f')],'where':{'id':_0x26b33a[_0x3d46('0x24')][_0x3d46('0x8a')]}});})['then'](function(_0x16e785){socket['emit'](_0x3d46('0xa0'),{'id':Number(_0x26b33a[_0x3d46('0x31')]['id']),'tags':_0x16e785||[]});return{'id':Number(_0x26b33a[_0x3d46('0x31')]['id']),'tags':_0x16e785||[]};});}})['then'](respondWithResult(_0x2117f5,null))['catch'](handleError(_0x2117f5,null));};exports[_0x3d46('0xa1')]=function(_0x38e78a,_0x3a2d7f){return db[_0x3d46('0x2a')][_0x3d46('0x39')]({'where':{'id':_0x38e78a[_0x3d46('0x31')]['id']}})[_0x3d46('0x1d')](handleEntityNotFound(_0x3a2d7f,null))[_0x3d46('0x1d')](function(_0x3969a9){if(_0x3969a9){return _0x3969a9[_0x3d46('0xa1')](_0x38e78a[_0x3d46('0x34')][_0x3d46('0x8a')]);}})[_0x3d46('0x1d')](respondWithStatusCode(_0x3a2d7f,null))[_0x3d46('0x15')](handleError(_0x3a2d7f,null));};exports[_0x3d46('0x67')]=function(_0x5251b3,_0xaae522){var _0x550375=moment()['unix']()['toString']();var _0x35e908=path[_0x3d46('0x63')](config[_0x3d46('0x64')],_0x3d46('0xa2'),_0x3d46('0xa3'),'tmp');var _0x4b21bf=path[_0x3d46('0x63')](config[_0x3d46('0x64')],_0x3d46('0xa2'),'files','attachments');var _0x34e107=path[_0x3d46('0x63')](_0x35e908,_0x550375);var _0x471f1c=util['format'](_0x3d46('0xa4'),_0x5251b3['params']['id'],_0x550375);var _0x2d4e1b=path[_0x3d46('0x63')](_0x35e908,_0x471f1c);var _0xfa3c95=[];_0xfa3c95[_0x3d46('0xa5')]({'model':db['User'],'as':_0x3d46('0x6f'),'attributes':['id',_0x3d46('0x45')],'raw':!![]});_0xfa3c95[_0x3d46('0xa5')]({'model':db[_0x3d46('0x71')],'as':_0x3d46('0x54'),'attributes':['id',_0x3d46('0xa6'),'lastName'],'raw':!![]});if(_0x5251b3[_0x3d46('0x34')][_0x3d46('0xa7')]){_0xfa3c95['push']({'model':db['Attachment'],'as':_0x3d46('0x60'),'raw':!![]});}var _0x480b40=[{'model':db[_0x3d46('0x51')],'as':_0x3d46('0x6e'),'attributes':['id',_0x3d46('0x24'),_0x3d46('0x7e'),_0x3d46('0x80'),_0x3d46('0x81'),_0x3d46('0xa8')],'include':_0xfa3c95}];_0x480b40[_0x3d46('0xa5')]({'model':db[_0x3d46('0x3e')],'as':'Account','attributes':['id','name']});_0x480b40[_0x3d46('0xa5')]({'model':db[_0x3d46('0x6f')],'as':_0x3d46('0xa9'),'attributes':['id',_0x3d46('0x45')]});return db['ChatInteraction'][_0x3d46('0x39')]({'where':{'id':_0x5251b3['params']['id']},'include':_0x480b40})[_0x3d46('0x1d')](handleEntityNotFound(_0xaae522,null))[_0x3d46('0x1d')](function(_0x12b45b){if(_0x12b45b){var _0x262fcd=_0x12b45b[_0x3d46('0xaa')]({'plain':!![]});fs[_0x3d46('0xab')](_0x34e107);var _0x4adb53={'channel':'Chat','account':_0x262fcd[_0x3d46('0xac')][_0x3d46('0x21')],'agent':_0x262fcd[_0x3d46('0xa9')]?_0x262fcd[_0x3d46('0xa9')]['fullname']:_0x3d46('0xad'),'createdAt':moment(_0x262fcd[_0x3d46('0x7e')])[_0x3d46('0x6a')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x262fcd[_0x3d46('0x59')]?moment(_0x262fcd['closedAt'])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x3d46('0xae')]():'','disposition':_0x262fcd[_0x3d46('0xaf')],'chatInfo':{'browser':_0x262fcd[_0x3d46('0xb0')],'os':_0x262fcd['osName'],'referer':_0x262fcd[_0x3d46('0xb1')],'customerIp':_0x262fcd[_0x3d46('0xb2')],'customerPort':_0x262fcd[_0x3d46('0xb3')]?_0x262fcd[_0x3d46('0xb3')]:_0x3d46('0xad')},'messages':_(_0x262fcd['Messages'])['tail']()[_0x3d46('0x94')]({'secret':![]})['map'](function(_0x7bd9bb){if(_0x7bd9bb['Attachment']){var _0x33523a=path[_0x3d46('0x63')](_0x4b21bf,_0x7bd9bb[_0x3d46('0x60')]['basename']);if(fs[_0x3d46('0xb4')](_0x33523a)){fs[_0x3d46('0xb5')](_0x33523a)[_0x3d46('0xb6')](fs[_0x3d46('0xb7')](path[_0x3d46('0x63')](_0x34e107,_0x7bd9bb['Attachment'][_0x3d46('0x5d')])));}}return{'date':moment(_0x7bd9bb[_0x3d46('0x7e')])[_0x3d46('0x6a')](_0x3d46('0xb8'))[_0x3d46('0xae')](),'sender':_0x7bd9bb[_0x3d46('0x80')]==='out'?_0x7bd9bb['User']?_0x7bd9bb[_0x3d46('0x6f')][_0x3d46('0x45')]:_0x3d46('0x75'):_0x7bd9bb['Contact'][_0x3d46('0xa6')]+(_0x7bd9bb[_0x3d46('0x54')][_0x3d46('0xb9')]?'\x20'+_0x7bd9bb[_0x3d46('0x54')][_0x3d46('0xb9')]:''),'body':_0x7bd9bb[_0x3d46('0x60')]?_0x7bd9bb[_0x3d46('0x60')][_0x3d46('0x5d')]:_0x7bd9bb['body'],'direction':_0x7bd9bb[_0x3d46('0x80')]==='out'?'A':'C','secret':_0x7bd9bb['secret'],'read':_0x7bd9bb[_0x3d46('0xa8')],'attachment':_0x7bd9bb['Attachment']};})[_0x3d46('0xba')]()};return ejs[_0x3d46('0xbb')](path[_0x3d46('0x63')](config['root'],_0x3d46('0xa2'),_0x3d46('0xbc'),_0x3d46('0xbd')),{'interaction':_0x4adb53})['then'](function(_0x2190dc){var _0x1aff82=path[_0x3d46('0x63')](_0x34e107,'transcript-'+_0x262fcd['id']+'-'+_0x550375+'.pdf');var _0x144269={'path':_0x1aff82,'channel':_0x3d46('0xbe'),'interactionId':_0x262fcd['id']};return pdf[_0x3d46('0xbf')](_0x2190dc,_0x144269);})[_0x3d46('0x1d')](function(){return new Promise(function(_0x2e24a4,_0x436b79){zipdir(_0x34e107,{'saveTo':_0x2d4e1b},function(_0x223f05,_0x164996){if(_0x223f05)return _0x436b79(_0x223f05);return _0x2e24a4(_0x164996);});})['then'](function(){return new BPromise(function(_0x516f96,_0x2aa33c){rimraf(_0x34e107,function(_0x3c1744){if(_0x3c1744)_0x2aa33c(_0x3c1744);return _0x516f96();});});})[_0x3d46('0x1d')](function(){return _0xaae522[_0x3d46('0x67')](_0x2d4e1b,_0x471f1c,function(_0x37bda7){if(_0x37bda7){logger[_0x3d46('0x11')](_0x3d46('0xc0'),_0x37bda7);}else{fs[_0x3d46('0xc1')](_0x2d4e1b);}});});});}else{return _0xaae522['sendStatus'](0xc8);}})['catch'](handleError(_0xaae522,null));}; \ No newline at end of file +var _0x1e57=['merge','body','contact','agent','interaction','account','index','rawAttributes','fieldName','type','key','query','user','show','params','model','ChatInteraction','keys','filters','intersection','attributes','fields','length','includeAll','include','options','find','create','describe','createVidaooSession','ChatWebsite','findOne','ChatWebsiteId','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','fullname','email','isNull','follow','parse','metadata','Sequelize','ValidationError','Error\x20in\x20Vidaoo\x20configuration','out','Unable\x20to\x20create\x20Vidaoo\x20session','customUpdate','CmContact','Contact','abandonInteraction,\x20%s,\x20%s,\x20%s','abandon','entity\x20not\x20found','UserId','closed','disposition','AbandonInteraction','attachmentUpload','file','filename','mimetype','Attachment','attachmentDownload','Unauthorized','attachId','ChatOfflineMessageId','root','server/files/attachments/','join','offline-chat/','basename','download','close','mailTranscript','server/files/chat/upload/','format','now','pathTranscript','ChatMessage','User','ContactId','Messages','%s%d','agentAlias','customer','Visitor','website_alias','System','alias','agent_fullname','createdAt','MM/DD/YYYY\x20HH:mm:ss','secret','appendFileSync','MailServerOut','CloudProvider','Smtp','SendMail','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','getMessages','nolimit','order','sort','where','pick','filter','split','count','findAll','rows','getMyMessages','hasOwnProperty','ChatInteractionId','map','includeAgent','push','addTags','setTags','omit','spread','emit','chatInteractionTags:save','unix','toString','files','tmp','server','attachments','lastName','direction','read','Account','get','Owner','N.A.','YYYY-MM-DD\x20HH:mm:ss','closedAt','referer','customerIp','customerPort','tail','existsSync','createReadStream','pipe','createWriteStream','firstName','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','Chat','err','unlinkSync','rimraf','request-promise','bluebird','mustache','util','path','ejs','ioredis','../../components/interaction/service','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./chatInteraction.socket','register','jayson/promise','client','http','request','then','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatInteraction,\x20%s,\x20%s','message','info','result','catch','sendStatus','end','status','json','offset','undefined','limit','set','update','destroy','stack','name','send','render'];(function(_0x5de70d,_0x10a712){var _0x353b67=function(_0x3c10fd){while(--_0x3c10fd){_0x5de70d['push'](_0x5de70d['shift']());}};_0x353b67(++_0x10a712);}(_0x1e57,0x176));var _0x71e5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1e57[_0x3dd15e];return _0x231fd0;};'use strict';var rimraf=require(_0x71e5('0x0'));var zipdir=require('zip-dir');var rp=require(_0x71e5('0x1'));var moment=require('moment');var BPromise=require(_0x71e5('0x2'));var Mustache=require(_0x71e5('0x3'));var util=require(_0x71e5('0x4'));var path=require(_0x71e5('0x5'));var ejs=require(_0x71e5('0x6'));var fs=require('fs');var _=require('lodash');var Redis=require(_0x71e5('0x7'));var interaction=require(_0x71e5('0x8'));var qs=require('../../components/parsers/qs');var pdf=require(_0x71e5('0x9'));var logger=require(_0x71e5('0xa'))(_0x71e5('0xb'));var config=require(_0x71e5('0xc'));var db=require(_0x71e5('0xd'))['db'];config['redis']=_[_0x71e5('0xe')](config['redis'],{'host':_0x71e5('0xf'),'port':0x18eb});var socket=require(_0x71e5('0x10'))(new Redis(config[_0x71e5('0x11')]));require(_0x71e5('0x12'))[_0x71e5('0x13')](socket);var jayson=require(_0x71e5('0x14'));var client=jayson[_0x71e5('0x15')][_0x71e5('0x16')]({'port':0x232b});var client9004=jayson[_0x71e5('0x15')][_0x71e5('0x16')]({'port':0x232c});function respondWithRpcPromise(_0x270996,_0x2aba45,_0x2cd72f,_0x9f8a17){return new BPromise(function(_0x112224,_0x44428b){var _0xe1c02d=_0x9f8a17||client;return _0xe1c02d[_0x71e5('0x17')](_0x270996,_0x2cd72f)[_0x71e5('0x18')](function(_0x497b8a){logger['info']('ChatInteraction,\x20%s,\x20%s',_0x2aba45,_0x71e5('0x19'));logger[_0x71e5('0x1a')](_0x71e5('0x1b'),_0x2aba45,_0x71e5('0x19'),JSON[_0x71e5('0x1c')](_0x497b8a));if(_0x497b8a[_0x71e5('0x1d')]){if(_0x497b8a[_0x71e5('0x1d')][_0x71e5('0x1e')]===0x1f4){logger[_0x71e5('0x1d')](_0x71e5('0x1f'),_0x2aba45,_0x497b8a['error'][_0x71e5('0x20')]);return _0x44428b(_0x497b8a[_0x71e5('0x1d')]['message']);}logger['error'](_0x71e5('0x1f'),_0x2aba45,_0x497b8a[_0x71e5('0x1d')][_0x71e5('0x20')]);return _0x112224(_0x497b8a[_0x71e5('0x1d')][_0x71e5('0x20')]);}else{logger[_0x71e5('0x21')](_0x71e5('0x1f'),_0x2aba45,'request\x20sent');_0x112224(_0x497b8a[_0x71e5('0x22')][_0x71e5('0x20')]);}})[_0x71e5('0x23')](function(_0x3bb7ed){logger[_0x71e5('0x1d')]('ChatInteraction,\x20%s,\x20%s',_0x2aba45,_0x3bb7ed);_0x44428b(_0x3bb7ed);});});}function respondWithStatusCode(_0x5933f4,_0x1c93af){_0x1c93af=_0x1c93af||0xcc;return function(_0x14354f){if(_0x14354f){return _0x5933f4[_0x71e5('0x24')](_0x1c93af);}return _0x5933f4['status'](_0x1c93af)[_0x71e5('0x25')]();};}function respondWithResult(_0x530055,_0x191b6a){_0x191b6a=_0x191b6a||0xc8;return function(_0x2e0f46){if(_0x2e0f46){return _0x530055[_0x71e5('0x26')](_0x191b6a)[_0x71e5('0x27')](_0x2e0f46);}};}function respondWithFilteredResult(_0x48adfb,_0x5e79d8){return function(_0x26e390){if(_0x26e390){var _0x2dbe5b=typeof _0x5e79d8[_0x71e5('0x28')]===_0x71e5('0x29')&&typeof _0x5e79d8[_0x71e5('0x2a')]===_0x71e5('0x29');var _0x1e4a78=_0x26e390['count'];var _0x546b9e=_0x2dbe5b?0x0:_0x5e79d8[_0x71e5('0x28')];var _0x228c71=_0x2dbe5b?_0x26e390['count']:_0x5e79d8[_0x71e5('0x28')]+_0x5e79d8[_0x71e5('0x2a')];var _0x277661;if(_0x228c71>=_0x1e4a78){_0x228c71=_0x1e4a78;_0x277661=0xc8;}else{_0x277661=0xce;}_0x48adfb['status'](_0x277661);return _0x48adfb[_0x71e5('0x2b')]('Content-Range',_0x546b9e+'-'+_0x228c71+'/'+_0x1e4a78)[_0x71e5('0x27')](_0x26e390);}return null;};}function saveUpdates(_0x19e505){return function(_0x5cac91){if(_0x5cac91){return _0x5cac91[_0x71e5('0x2c')](_0x19e505)[_0x71e5('0x18')](function(_0x2f0606){return _0x2f0606;});}return null;};}function removeEntity(_0xb599e3){return function(_0x4c57b5){if(_0x4c57b5){return _0x4c57b5[_0x71e5('0x2d')]()[_0x71e5('0x18')](function(){_0xb599e3['status'](0xcc)[_0x71e5('0x25')]();});}};}function handleEntityNotFound(_0x4e97b0){return function(_0x4fa967){if(!_0x4fa967){_0x4e97b0['sendStatus'](0x194);}return _0x4fa967;};}function handleError(_0x5172ff,_0x25c5f5){_0x25c5f5=_0x25c5f5||0x1f4;return function(_0x4c41c7){logger[_0x71e5('0x1d')](_0x4c41c7[_0x71e5('0x2e')]);if(_0x4c41c7[_0x71e5('0x2f')]){delete _0x4c41c7[_0x71e5('0x2f')];}_0x5172ff[_0x71e5('0x26')](_0x25c5f5)[_0x71e5('0x30')](_0x4c41c7);};}function getMustacheRender(_0x536539,_0x18886e){return Mustache[_0x71e5('0x31')](_0x536539,_[_0x71e5('0x32')](_0x18886e[_0x71e5('0x33')],{'contact':_0x18886e[_0x71e5('0x34')],'message':_0x18886e[_0x71e5('0x20')],'agent':_0x18886e[_0x71e5('0x35')],'interaction':_0x18886e[_0x71e5('0x36')],'account':_0x18886e[_0x71e5('0x37')]}))||'';}exports[_0x71e5('0x38')]=function(_0x19cac3,_0x3f842a){var _0x57778b={};var _0x2a65ee=_['map'](db['ChatInteraction'][_0x71e5('0x39')],function(_0xced590){return{'name':_0xced590[_0x71e5('0x3a')],'type':_0xced590[_0x71e5('0x3b')][_0x71e5('0x3c')]};});_0x57778b=qs['getOptions'](_0x2a65ee,_0x19cac3);return interaction['findAll']('chat',_0x19cac3[_0x71e5('0x3d')],_0x19cac3[_0x71e5('0x3e')],_0x57778b,_0x2a65ee)['then'](respondWithFilteredResult(_0x3f842a,_0x57778b))['catch'](handleError(_0x3f842a,null));};exports[_0x71e5('0x3f')]=function(_0x16d766,_0x2c7d6a){var _0xbe7065={'raw':![],'where':{'id':_0x16d766[_0x71e5('0x40')]['id']}},_0xf6aa2={};_0xf6aa2[_0x71e5('0x41')]=_['keys'](db[_0x71e5('0x42')][_0x71e5('0x39')]);_0xf6aa2[_0x71e5('0x3d')]=_[_0x71e5('0x43')](_0x16d766[_0x71e5('0x3d')]);_0xf6aa2[_0x71e5('0x44')]=_[_0x71e5('0x45')](_0xf6aa2['model'],_0xf6aa2[_0x71e5('0x3d')]);_0xbe7065[_0x71e5('0x46')]=_[_0x71e5('0x45')](_0xf6aa2[_0x71e5('0x41')],qs[_0x71e5('0x47')](_0x16d766[_0x71e5('0x3d')][_0x71e5('0x47')]));_0xbe7065[_0x71e5('0x46')]=_0xbe7065[_0x71e5('0x46')][_0x71e5('0x48')]?_0xbe7065['attributes']:_0xf6aa2[_0x71e5('0x41')];if(_0x16d766['query'][_0x71e5('0x49')]){_0xbe7065[_0x71e5('0x4a')]=[{'all':!![]}];}_0xbe7065=_[_0x71e5('0x32')]({},_0xbe7065,_0x16d766[_0x71e5('0x4b')]);return db[_0x71e5('0x42')][_0x71e5('0x4c')](_0xbe7065)[_0x71e5('0x18')](handleEntityNotFound(_0x2c7d6a,null))[_0x71e5('0x18')](respondWithResult(_0x2c7d6a,null))[_0x71e5('0x23')](handleError(_0x2c7d6a,null));};exports[_0x71e5('0x4d')]=function(_0xe2e8af,_0x5e90ab){return db[_0x71e5('0x42')][_0x71e5('0x4d')](_0xe2e8af[_0x71e5('0x33')],{})[_0x71e5('0x18')](respondWithResult(_0x5e90ab,0xc9))[_0x71e5('0x23')](handleError(_0x5e90ab,null));};exports[_0x71e5('0x2c')]=function(_0x5591af,_0xfb96c6){if(_0x5591af['body']['id']){delete _0x5591af['body']['id'];}return db[_0x71e5('0x42')][_0x71e5('0x4c')]({'where':{'id':_0x5591af[_0x71e5('0x40')]['id']}})[_0x71e5('0x18')](handleEntityNotFound(_0xfb96c6,null))[_0x71e5('0x18')](saveUpdates(_0x5591af['body'],null))[_0x71e5('0x18')](respondWithResult(_0xfb96c6,null))[_0x71e5('0x23')](handleError(_0xfb96c6,null));};exports[_0x71e5('0x2d')]=function(_0x83071d,_0x3fe793){return db['ChatInteraction']['find']({'where':{'id':_0x83071d[_0x71e5('0x40')]['id']}})[_0x71e5('0x18')](handleEntityNotFound(_0x3fe793,null))[_0x71e5('0x18')](removeEntity(_0x3fe793,null))[_0x71e5('0x23')](handleError(_0x3fe793,null));};exports['describe']=function(_0x1890ea,_0x2f3db6){return db[_0x71e5('0x42')][_0x71e5('0x4e')]()['then'](respondWithResult(_0x2f3db6,null))[_0x71e5('0x23')](handleError(_0x2f3db6,null));};exports[_0x71e5('0x4f')]=function(_0x15176b,_0x4b9252){var _0x1aedc6=_0x15176b['params']['id'];var _0x4ee2e2;var _0x5ce4a9;var _0x45c5ef;return db[_0x71e5('0x42')]['findOne']({'where':{'id':_0x1aedc6}})[_0x71e5('0x18')](function(_0x4f33d9){_0x4ee2e2=_0x4f33d9;return db[_0x71e5('0x50')][_0x71e5('0x51')]({'where':{'id':_0x4f33d9[_0x71e5('0x52')]},'attributes':['id',_0x71e5('0x53'),_0x71e5('0x54'),_0x71e5('0x55'),_0x71e5('0x56'),_0x71e5('0x57')],'raw':!![]});})[_0x71e5('0x18')](function(_0xb0c6da){if(_0xb0c6da&&_0xb0c6da['vidaooApiKey']&&_0xb0c6da[_0x71e5('0x54')]){_0x5ce4a9=_0xb0c6da;var _0x43a50b={'interaction':{'id':_0x1aedc6},'agent':{'id':_0x15176b[_0x71e5('0x3e')]['id'],'name':_0x15176b[_0x71e5('0x3e')][_0x71e5('0x2f')],'fullname':_0x15176b[_0x71e5('0x3e')][_0x71e5('0x58')],'email':_0x15176b[_0x71e5('0x3e')][_0x71e5('0x59')]},'contact':_0x15176b[_0x71e5('0x33')][_0x71e5('0x34')],'account':_0x15176b['body'][_0x71e5('0x37')]};var _0x23d852={'rejectUnauthorized':![],'method':'POST','url':'https://api-vidaoo.xcally.com/api/v1/meetings','headers':{'X-APIKEY':_0xb0c6da[_0x71e5('0x53')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x15176b[_0x71e5('0x3e')][_0x71e5('0x59')]],'buttons':null,'topic':_0x5ce4a9[_0x71e5('0x55')],'note':_[_0x71e5('0x5a')](_0x5ce4a9[_0x71e5('0x56')])?null:getMustacheRender(_0x5ce4a9['vidaooNote'],_0x43a50b),'metadata':null},'redirect':_0x71e5('0x5b'),'json':!![]};try{if(!_['isNull'](_0x5ce4a9[_0x71e5('0x57')])){var _0x2b4d72=getMustacheRender(_0x5ce4a9[_0x71e5('0x57')],_0x43a50b);var _0x10d835=JSON[_0x71e5('0x5c')](_0x2b4d72);_0x23d852[_0x71e5('0x33')][_0x71e5('0x5d')]=_0x10d835;}}catch(_0x44fbd7){throw new db[(_0x71e5('0x5e'))][(_0x71e5('0x5f'))]('Error\x20in\x20conversion\x20vidaooMetadata');}return rp(_0x23d852);}else{throw new db[(_0x71e5('0x5e'))][(_0x71e5('0x5f'))](_0x71e5('0x60'));}})[_0x71e5('0x18')](function(_0x549b2c){_0x45c5ef=_0x549b2c;if(_0x45c5ef['id']){var _0x6c6af5={'body':_0x45c5ef['join_url'],'ChatWebsiteId':_0x5ce4a9['id'],'ChatInteractionId':_0x4ee2e2['id'],'direction':_0x71e5('0x61'),'UserId':_0x15176b['user']['id']};return db['ChatMessage'][_0x71e5('0x4d')](_0x6c6af5,{});}else{throw new db[(_0x71e5('0x5e'))][(_0x71e5('0x5f'))](_0x71e5('0x62'));}})[_0x71e5('0x18')](function(){return _0x4ee2e2['updateAttributes']({'vidaooSessionId':_0x45c5ef['id']});})[_0x71e5('0x18')](respondWithResult(_0x4b9252,null))[_0x71e5('0x23')](handleError(_0x4b9252,null));};exports[_0x71e5('0x63')]=function(_0x224957,_0x153705){if(_0x224957[_0x71e5('0x33')]['id']){delete _0x224957[_0x71e5('0x33')]['id'];}return db[_0x71e5('0x42')][_0x71e5('0x4c')]({'where':{'id':_0x224957[_0x71e5('0x40')]['id']},'include':[{'model':db[_0x71e5('0x64')],'as':_0x71e5('0x65')}]})[_0x71e5('0x18')](handleEntityNotFound(_0x153705,null))['then'](saveUpdates(_0x224957[_0x71e5('0x33')],null))['then'](respondWithResult(_0x153705,null))[_0x71e5('0x23')](handleError(_0x153705,null));};exports['abandon']=function(_0x2cc560,_0x59e009){if(_0x2cc560['body']['id']){delete _0x2cc560[_0x71e5('0x33')]['id'];}return db[_0x71e5('0x42')][_0x71e5('0x4c')]({'where':{'id':_0x2cc560[_0x71e5('0x40')]['id']}})['then'](function(_0x4f37b0){if(!_0x4f37b0){logger[_0x71e5('0x1d')](_0x71e5('0x66'),_0x71e5('0x67'),0x194,_0x71e5('0x68'));_0x59e009[_0x71e5('0x24')](0x194);}else{if(_0x4f37b0[_0x71e5('0x69')]){throw new db[(_0x71e5('0x5e'))][(_0x71e5('0x5f'))]('Interaction\x20already\x20assigned');}}return _0x4f37b0;})['then'](function(_0x33d1ac){if(_0x33d1ac){return _0x33d1ac['update']({'closed':_0x2cc560['body'][_0x71e5('0x6a')],'disposition':_0x2cc560['body'][_0x71e5('0x6b')]})[_0x71e5('0x18')](function(_0x4dc408){return _0x4dc408;});}})[_0x71e5('0x18')](function(){return respondWithRpcPromise(_0x71e5('0x6c'),_0x71e5('0x67'),_0x2cc560[_0x71e5('0x33')],client9004);})[_0x71e5('0x18')](respondWithResult(_0x59e009,null))[_0x71e5('0x23')](handleError(_0x59e009,null));};exports[_0x71e5('0x6d')]=function(_0x4e8b14,_0x2fa04b){_0x4e8b14[_0x71e5('0x33')]['name']=_0x4e8b14['file']['originalname'];_0x4e8b14[_0x71e5('0x33')]['basename']=_0x4e8b14[_0x71e5('0x6e')][_0x71e5('0x6f')];_0x4e8b14[_0x71e5('0x33')][_0x71e5('0x3b')]=_0x4e8b14['file'][_0x71e5('0x70')];return db[_0x71e5('0x71')][_0x71e5('0x4d')](_0x4e8b14['body'])['then'](respondWithResult(_0x2fa04b,0xc9))['catch'](handleError(_0x2fa04b,null));};exports[_0x71e5('0x72')]=function(_0x32dca8,_0x96715e){return db[_0x71e5('0x42')][_0x71e5('0x51')]({'where':{'id':_0x32dca8['params']['id']},'raw':!![]})[_0x71e5('0x18')](handleEntityNotFound(_0x96715e,null))[_0x71e5('0x18')](function(_0xaf2a6b){if(_0xaf2a6b){if(_0xaf2a6b[_0x71e5('0x6a')]){return _0x96715e['status'](0x193)['json']({'status':0x193,'message':_0x71e5('0x73')});}return db[_0x71e5('0x71')][_0x71e5('0x51')]({'where':{'id':_0x32dca8[_0x71e5('0x3d')][_0x71e5('0x74')]},'raw':!![]})[_0x71e5('0x18')](handleEntityNotFound(_0x96715e,null));}})[_0x71e5('0x18')](function(_0x3b5954){if(_0x3b5954){var _0x4c7911=_0x3b5954[_0x71e5('0x75')]!==null;var _0x24de54=path['join'](config[_0x71e5('0x76')],_0x71e5('0x77'));if(_0x4c7911){_0x24de54=path[_0x71e5('0x78')](_0x24de54,_0x71e5('0x79'));}var _0x25f15d=path[_0x71e5('0x78')](_0x24de54,_0x3b5954[_0x71e5('0x7a')]);return _0x96715e[_0x71e5('0x7b')](_0x25f15d);}})[_0x71e5('0x23')](handleError(_0x96715e,null));};exports[_0x71e5('0x7c')]=function(_0x1a59a2,_0x19d322){var _0x11f0fe=null;var _0x363353=null;var _0x2eff54=null;if(_0x1a59a2[_0x71e5('0x33')]['id']){delete _0x1a59a2['body']['id'];}if(_0x1a59a2[_0x71e5('0x33')][_0x71e5('0x7d')]){_0x2eff54=path['join'](config[_0x71e5('0x76')],_0x71e5('0x7e'),util[_0x71e5('0x7f')]('transcript-%s.txt',Date[_0x71e5('0x80')]()));_0x1a59a2[_0x71e5('0x33')][_0x71e5('0x81')]=_0x2eff54;}return db[_0x71e5('0x42')][_0x71e5('0x4c')]({'where':{'id':_0x1a59a2[_0x71e5('0x40')]['id']},'include':[{'model':db[_0x71e5('0x82')],'as':'Messages','include':[{'model':db[_0x71e5('0x83')],'as':_0x71e5('0x83')}]}]})[_0x71e5('0x18')](handleEntityNotFound(_0x19d322,null))['then'](saveUpdates(_0x1a59a2[_0x71e5('0x33')],null))[_0x71e5('0x18')](function(_0x38529d){if(_0x38529d){_0x11f0fe=_0x38529d;return db[_0x71e5('0x50')][_0x71e5('0x4c')]({'where':{'id':_0x11f0fe[_0x71e5('0x52')]}});}})[_0x71e5('0x18')](function(_0x412d2b){if(_0x412d2b){_0x363353=_0x412d2b;return db[_0x71e5('0x64')]['find']({'where':{'id':_0x11f0fe[_0x71e5('0x84')]}});}})[_0x71e5('0x18')](function(_0x18a97c){if(_0x18a97c){if(_0x2eff54){var _0xaf3434=null;for(var _0x34b3f4=0x1;_0x34b3f4<_0x11f0fe['Messages'][_0x71e5('0x48')];++_0x34b3f4){_0xaf3434=_0x11f0fe[_0x71e5('0x85')][_0x34b3f4];var _0x28e099=_0xaf3434[_0x71e5('0x69')]?util['format'](_0x71e5('0x86'),_0x363353[_0x71e5('0x87')],_0xaf3434[_0x71e5('0x69')]):'System';var _0x57dfa4=_0x1a59a2['body'][_0x71e5('0x88')]||util[_0x71e5('0x7f')]('%s%d',_0x71e5('0x89'),_0xaf3434[_0x71e5('0x84')]);switch(_0x363353['agentIdentifier']){case _0x71e5('0x8a'):_0x28e099=_0xaf3434[_0x71e5('0x69')]?util[_0x71e5('0x7f')]('%s%d',_0x363353[_0x71e5('0x87')],_0xaf3434[_0x71e5('0x69')]):_0x71e5('0x8b');break;case'agent_alias':_0x28e099=_0xaf3434[_0x71e5('0x69')]?_0xaf3434['User'][_0x71e5('0x8c')]||_0xaf3434[_0x71e5('0x83')]['fullname']:_0x71e5('0x8b');break;case _0x71e5('0x8d'):_0x28e099=_0xaf3434[_0x71e5('0x69')]?_0xaf3434[_0x71e5('0x83')][_0x71e5('0x58')]:_0x71e5('0x8b');break;default:_0x28e099=_0xaf3434[_0x71e5('0x69')]?util[_0x71e5('0x7f')](_0x71e5('0x86'),_0x363353['agentAlias'],_0xaf3434[_0x71e5('0x69')]):'System';}var _0x26a9cc=util[_0x71e5('0x7f')]('[%s]\x20%s:\x20%s\x0a',moment(_0xaf3434[_0x71e5('0x8e')])[_0x71e5('0x7f')](_0x71e5('0x8f')),_0xaf3434['direction']==='in'?_0x57dfa4:_0x28e099,_0xaf3434[_0x71e5('0x33')]);if(!_0xaf3434[_0x71e5('0x90')]){fs[_0x71e5('0x91')](_0x2eff54,_0x26a9cc);}}return db['MailAccount'][_0x71e5('0x51')]({'where':{'service':!![]},'include':[{'model':db[_0x71e5('0x92')],'as':'Smtp','raw':!![],'include':[{'model':db[_0x71e5('0x93')],'as':_0x71e5('0x93'),'raw':!![]}]}]});}}})[_0x71e5('0x18')](function(_0x6eea2){if(!_0x6eea2||!_0x6eea2[_0x71e5('0x94')]||!_0x1a59a2['body'])return _0x11f0fe;var _0x362fb2=_0x6eea2['getSmtpOptions']();return respondWithRpcPromise(_0x71e5('0x95'),_0x71e5('0x96'),{'account':_0x362fb2,'message':{'from':util[_0x71e5('0x7f')](_0x71e5('0x97'),_0x6eea2['name'],_0x6eea2[_0x71e5('0x59')]||_0x6eea2[_0x71e5('0x94')][_0x71e5('0x3e')]),'to':_0x1a59a2['body']['mailTranscript'],'subject':_0x71e5('0x98'),'text':util[_0x71e5('0x7f')](_0x71e5('0x99'),_0x1a59a2['body'][_0x71e5('0x7d')]),'attachments':[{'path':_0x2eff54}]}})[_0x71e5('0x18')](function(){return _0x11f0fe;})[_0x71e5('0x23')](function(_0x5f0622){logger['error'](_0x5f0622);});})[_0x71e5('0x18')](respondWithStatusCode(_0x19d322,0xc8))[_0x71e5('0x23')](handleError(_0x19d322,null));};exports[_0x71e5('0x9a')]=function(_0x3dabf0,_0x5cfa0d){return db[_0x71e5('0x82')]['find']({'where':{'id':_0x3dabf0['params']['id']}})[_0x71e5('0x18')](handleEntityNotFound(_0x5cfa0d,null))[_0x71e5('0x18')](function(_0x2567cc){if(_0x2567cc){return _0x2567cc['addMessage'](_0x3dabf0[_0x71e5('0x33')][_0x71e5('0x9b')],_['omit'](_0x3dabf0[_0x71e5('0x33')],['ids','id'])||{});}})['then'](respondWithResult(_0x5cfa0d,null))['catch'](handleError(_0x5cfa0d,null));};exports[_0x71e5('0x9c')]=function(_0x5b6893,_0x333bff){var _0x1ca46c={'raw':![],'where':{}};var _0x4867d0={};var _0x2c9f65={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x71e5('0x51')]({'where':{'id':_0x5b6893['params']['id']}})[_0x71e5('0x18')](handleEntityNotFound(_0x333bff,null))[_0x71e5('0x18')](function(_0x2368b8){if(_0x2368b8){_0x4867d0[_0x71e5('0x41')]=_['keys'](db[_0x71e5('0x82')][_0x71e5('0x39')]);_0x4867d0['query']=_[_0x71e5('0x43')](_0x5b6893[_0x71e5('0x3d')]);_0x4867d0[_0x71e5('0x44')]=_[_0x71e5('0x45')](_0x4867d0['model'],_0x4867d0[_0x71e5('0x3d')]);_0x1ca46c[_0x71e5('0x46')]=_[_0x71e5('0x45')](_0x4867d0[_0x71e5('0x41')],qs[_0x71e5('0x47')](_0x5b6893[_0x71e5('0x3d')][_0x71e5('0x47')]));_0x1ca46c[_0x71e5('0x46')]=_0x1ca46c[_0x71e5('0x46')][_0x71e5('0x48')]?_0x1ca46c[_0x71e5('0x46')]:_0x4867d0[_0x71e5('0x41')];if(!_0x5b6893[_0x71e5('0x3d')]['hasOwnProperty'](_0x71e5('0x9d'))){_0x1ca46c[_0x71e5('0x2a')]=qs['limit'](_0x5b6893[_0x71e5('0x3d')][_0x71e5('0x2a')]);_0x1ca46c['offset']=qs['offset'](_0x5b6893[_0x71e5('0x3d')][_0x71e5('0x28')]);}_0x1ca46c[_0x71e5('0x9e')]=qs[_0x71e5('0x9f')](_0x5b6893[_0x71e5('0x3d')]['sort']);_0x1ca46c[_0x71e5('0xa0')]=qs[_0x71e5('0x44')](_[_0x71e5('0xa1')](_0x5b6893[_0x71e5('0x3d')],_0x4867d0[_0x71e5('0x44')]));_0x1ca46c['where']['ChatInteractionId']=_0x2368b8['id'];if(_0x5b6893[_0x71e5('0x3d')]['filter']){_0x1ca46c[_0x71e5('0xa0')]=_[_0x71e5('0x32')](_0x1ca46c[_0x71e5('0xa0')],{'$or':_['map'](_0x1ca46c[_0x71e5('0x46')],function(_0xb6ae1b){var _0x3057b6={};_0x3057b6[_0xb6ae1b]={'$like':'%'+_0x5b6893[_0x71e5('0x3d')][_0x71e5('0xa2')]+'%'};return _0x3057b6;})});}if(_0x5b6893['query']['$gte']){var _0x2cd393=_0x5b6893['query']['$gte'][_0x71e5('0xa3')](',');var _0x18554b={};_0x18554b[_0x2cd393[0x0]]={'$gte':moment(_0x2cd393[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x1ca46c[_0x71e5('0xa0')]=_[_0x71e5('0x32')](_0x1ca46c[_0x71e5('0xa0')],_0x18554b);}_0x1ca46c=_[_0x71e5('0x32')]({},_0x1ca46c,_0x5b6893['options']);return db[_0x71e5('0x82')][_0x71e5('0xa4')]({'where':_0x1ca46c[_0x71e5('0xa0')]})[_0x71e5('0x18')](function(_0x409854){_0x2c9f65[_0x71e5('0xa4')]=_0x409854;if(_0x5b6893[_0x71e5('0x3d')][_0x71e5('0x49')]){_0x1ca46c['include']=[{'all':!![]}];}return db[_0x71e5('0x82')][_0x71e5('0xa5')](_0x1ca46c);})[_0x71e5('0x18')](function(_0x98c6c2){_0x2c9f65[_0x71e5('0xa6')]=_0x98c6c2;return _0x2c9f65;});}})[_0x71e5('0x18')](respondWithFilteredResult(_0x333bff,_0x1ca46c))[_0x71e5('0x23')](handleError(_0x333bff,null));};exports[_0x71e5('0xa7')]=function(_0x224e2f,_0x5465b0){var _0x37a26a={'where':{}},_0x5f2ff9={},_0x39a0dc={'count':0x0,'rows':[]};return db['ChatInteraction']['findOne']({'where':{'id':_0x224e2f[_0x71e5('0x40')]['id']}})[_0x71e5('0x18')](handleEntityNotFound(_0x5465b0,null))['then'](function(_0x3b1ec2){if(_0x3b1ec2){_0x5f2ff9[_0x71e5('0x41')]=_['keys'](db[_0x71e5('0x82')][_0x71e5('0x39')]);_0x5f2ff9['query']=_[_0x71e5('0x43')](_0x224e2f['query']);_0x5f2ff9[_0x71e5('0x44')]=_[_0x71e5('0x45')](_0x5f2ff9[_0x71e5('0x41')],_0x5f2ff9[_0x71e5('0x3d')]);_0x37a26a[_0x71e5('0x46')]=_[_0x71e5('0x45')](_0x5f2ff9[_0x71e5('0x41')],qs[_0x71e5('0x47')](_0x224e2f['query'][_0x71e5('0x47')]));_0x37a26a[_0x71e5('0x46')]=_0x37a26a['attributes'][_0x71e5('0x48')]?_0x37a26a['attributes']:_0x5f2ff9[_0x71e5('0x41')];if(!_0x224e2f['query'][_0x71e5('0xa8')]('nolimit')){_0x37a26a['limit']=qs['limit'](_0x224e2f['query'][_0x71e5('0x2a')]);_0x37a26a[_0x71e5('0x28')]=qs[_0x71e5('0x28')](_0x224e2f[_0x71e5('0x3d')][_0x71e5('0x28')]);}_0x37a26a[_0x71e5('0x9e')]=qs[_0x71e5('0x9f')](_0x224e2f[_0x71e5('0x3d')][_0x71e5('0x9f')]);_0x37a26a['where']=qs['filters'](_['pick'](_0x224e2f[_0x71e5('0x3d')],_0x5f2ff9[_0x71e5('0x44')]));_0x37a26a[_0x71e5('0xa0')][_0x71e5('0xa9')]=_0x3b1ec2['id'];if(_0x224e2f[_0x71e5('0x3d')][_0x71e5('0xa2')]){_0x37a26a['where']=_[_0x71e5('0x32')](_0x37a26a[_0x71e5('0xa0')],{'$or':_[_0x71e5('0xaa')](_0x37a26a['attributes'],function(_0x419383){var _0x37b5b4={};_0x37b5b4[_0x419383]={'$like':'%'+_0x224e2f[_0x71e5('0x3d')]['filter']+'%'};return _0x37b5b4;})});}_0x37a26a[_0x71e5('0xa0')][_0x71e5('0x90')]=![];if(_0x224e2f[_0x71e5('0x3d')]['id']){_0x37a26a[_0x71e5('0xa0')]['id']={'$gt':_0x224e2f['query']['id']};}_0x37a26a=_[_0x71e5('0x32')]({},_0x37a26a,_0x224e2f[_0x71e5('0x4b')]);return db[_0x71e5('0x82')]['count']({'where':_0x37a26a['where']})[_0x71e5('0x18')](function(_0x382afb){_0x39a0dc['count']=_0x382afb;_0x37a26a[_0x71e5('0x4a')]=[];if(_0x224e2f[_0x71e5('0x3d')][_0x71e5('0xab')]){_0x37a26a[_0x71e5('0x4a')][_0x71e5('0xac')]({'model':db[_0x71e5('0x83')],'as':_0x71e5('0x83'),'attributes':['id',_0x71e5('0x58'),_0x71e5('0x8c')]});}if(_0x224e2f[_0x71e5('0x3d')]['includeAll']){_0x37a26a['include']=[{'all':!![]}];}return db['ChatMessage'][_0x71e5('0xa5')](_0x37a26a);})[_0x71e5('0x18')](function(_0x37241e){_0x39a0dc['rows']=_0x37241e;return _0x39a0dc;});}})[_0x71e5('0x18')](respondWithFilteredResult(_0x5465b0,_0x37a26a))['catch'](handleError(_0x5465b0,null));};exports[_0x71e5('0xad')]=function(_0x327ea5,_0x423db6){return db[_0x71e5('0x42')][_0x71e5('0x4c')]({'where':{'id':_0x327ea5[_0x71e5('0x40')]['id']}})[_0x71e5('0x18')](handleEntityNotFound(_0x423db6,null))['then'](function(_0x880549){if(_0x880549){return _0x880549[_0x71e5('0xae')](_0x327ea5[_0x71e5('0x33')][_0x71e5('0x9b')],_[_0x71e5('0xaf')](_0x327ea5[_0x71e5('0x33')],[_0x71e5('0x9b'),'id'])||{})[_0x71e5('0xb0')](function(){return db['Tag']['findAll']({'attributes':['id',_0x71e5('0x2f'),'color'],'where':{'id':_0x327ea5[_0x71e5('0x33')]['ids']}});})['then'](function(_0x231df3){socket[_0x71e5('0xb1')](_0x71e5('0xb2'),{'id':Number(_0x327ea5[_0x71e5('0x40')]['id']),'tags':_0x231df3||[]});return{'id':Number(_0x327ea5[_0x71e5('0x40')]['id']),'tags':_0x231df3||[]};});}})[_0x71e5('0x18')](respondWithResult(_0x423db6,null))[_0x71e5('0x23')](handleError(_0x423db6,null));};exports['removeTags']=function(_0x32d996,_0x3dedf6){return db[_0x71e5('0x42')][_0x71e5('0x4c')]({'where':{'id':_0x32d996['params']['id']}})['then'](handleEntityNotFound(_0x3dedf6,null))[_0x71e5('0x18')](function(_0x3691b6){if(_0x3691b6){return _0x3691b6['removeTags'](_0x32d996[_0x71e5('0x3d')][_0x71e5('0x9b')]);}})[_0x71e5('0x18')](respondWithStatusCode(_0x3dedf6,null))[_0x71e5('0x23')](handleError(_0x3dedf6,null));};exports[_0x71e5('0x7b')]=function(_0x1cfc06,_0x2d2aef){var _0x59114c=moment()[_0x71e5('0xb3')]()[_0x71e5('0xb4')]();var _0x3f7829=path['join'](config[_0x71e5('0x76')],'server',_0x71e5('0xb5'),_0x71e5('0xb6'));var _0x418a90=path[_0x71e5('0x78')](config['root'],_0x71e5('0xb7'),_0x71e5('0xb5'),_0x71e5('0xb8'));var _0x2e1514=path[_0x71e5('0x78')](_0x3f7829,_0x59114c);var _0x309b42=util[_0x71e5('0x7f')]('transcript-%d-%s.zip',_0x1cfc06[_0x71e5('0x40')]['id'],_0x59114c);var _0x22def5=path['join'](_0x3f7829,_0x309b42);var _0x4cde8d=[];_0x4cde8d[_0x71e5('0xac')]({'model':db['User'],'as':_0x71e5('0x83'),'attributes':['id',_0x71e5('0x58')],'raw':!![]});_0x4cde8d[_0x71e5('0xac')]({'model':db[_0x71e5('0x64')],'as':_0x71e5('0x65'),'attributes':['id','firstName',_0x71e5('0xb9')],'raw':!![]});if(_0x1cfc06[_0x71e5('0x3d')][_0x71e5('0xb8')]){_0x4cde8d[_0x71e5('0xac')]({'model':db['Attachment'],'as':_0x71e5('0x71'),'raw':!![]});}var _0x4a7edc=[{'model':db['ChatMessage'],'as':_0x71e5('0x85'),'attributes':['id',_0x71e5('0x33'),_0x71e5('0x8e'),_0x71e5('0xba'),_0x71e5('0x90'),_0x71e5('0xbb')],'include':_0x4cde8d}];_0x4a7edc[_0x71e5('0xac')]({'model':db[_0x71e5('0x50')],'as':_0x71e5('0xbc'),'attributes':['id',_0x71e5('0x2f')]});_0x4a7edc['push']({'model':db[_0x71e5('0x83')],'as':'Owner','attributes':['id',_0x71e5('0x58')]});return db[_0x71e5('0x42')][_0x71e5('0x4c')]({'where':{'id':_0x1cfc06['params']['id']},'include':_0x4a7edc})[_0x71e5('0x18')](handleEntityNotFound(_0x2d2aef,null))[_0x71e5('0x18')](function(_0x35b069){if(_0x35b069){var _0x4d4c27=_0x35b069[_0x71e5('0xbd')]({'plain':!![]});fs['mkdirSync'](_0x2e1514);var _0x86e45e={'channel':'Chat','account':_0x4d4c27[_0x71e5('0xbc')]['name'],'agent':_0x4d4c27[_0x71e5('0xbe')]?_0x4d4c27[_0x71e5('0xbe')][_0x71e5('0x58')]:_0x71e5('0xbf'),'createdAt':moment(_0x4d4c27[_0x71e5('0x8e')])[_0x71e5('0x7f')](_0x71e5('0xc0'))[_0x71e5('0xb4')](),'closedAt':_0x4d4c27[_0x71e5('0x6a')]?moment(_0x4d4c27[_0x71e5('0xc1')])[_0x71e5('0x7f')](_0x71e5('0xc0'))[_0x71e5('0xb4')]():'','disposition':_0x4d4c27[_0x71e5('0x6b')],'chatInfo':{'browser':_0x4d4c27['browserName'],'os':_0x4d4c27['osName'],'referer':_0x4d4c27[_0x71e5('0xc2')],'customerIp':_0x4d4c27[_0x71e5('0xc3')],'customerPort':_0x4d4c27[_0x71e5('0xc4')]?_0x4d4c27[_0x71e5('0xc4')]:_0x71e5('0xbf')},'messages':_(_0x4d4c27[_0x71e5('0x85')])[_0x71e5('0xc5')]()[_0x71e5('0xa2')]({'secret':![]})['map'](function(_0x565e16){if(_0x565e16[_0x71e5('0x71')]){var _0x2b0554=path[_0x71e5('0x78')](_0x418a90,_0x565e16[_0x71e5('0x71')]['basename']);if(fs[_0x71e5('0xc6')](_0x2b0554)){fs[_0x71e5('0xc7')](_0x2b0554)[_0x71e5('0xc8')](fs[_0x71e5('0xc9')](path[_0x71e5('0x78')](_0x2e1514,_0x565e16[_0x71e5('0x71')][_0x71e5('0x7a')])));}}return{'date':moment(_0x565e16[_0x71e5('0x8e')])['format'](_0x71e5('0xc0'))['toString'](),'sender':_0x565e16[_0x71e5('0xba')]==='out'?_0x565e16['User']?_0x565e16[_0x71e5('0x83')][_0x71e5('0x58')]:'System':_0x565e16[_0x71e5('0x65')][_0x71e5('0xca')]+(_0x565e16[_0x71e5('0x65')][_0x71e5('0xb9')]?'\x20'+_0x565e16[_0x71e5('0x65')][_0x71e5('0xb9')]:''),'body':_0x565e16[_0x71e5('0x71')]?_0x565e16['Attachment'][_0x71e5('0x7a')]:_0x565e16['body'],'direction':_0x565e16[_0x71e5('0xba')]===_0x71e5('0x61')?'A':'C','secret':_0x565e16[_0x71e5('0x90')],'read':_0x565e16['read'],'attachment':_0x565e16[_0x71e5('0x71')]};})[_0x71e5('0xcb')]()};return ejs[_0x71e5('0xcc')](path[_0x71e5('0x78')](config[_0x71e5('0x76')],_0x71e5('0xb7'),_0x71e5('0xcd'),_0x71e5('0xce')),{'interaction':_0x86e45e})['then'](function(_0x4242a4){var _0x2840c8=path[_0x71e5('0x78')](_0x2e1514,_0x71e5('0xcf')+_0x4d4c27['id']+'-'+_0x59114c+_0x71e5('0xd0'));var _0x33b1aa={'path':_0x2840c8,'channel':_0x71e5('0xd1'),'interactionId':_0x4d4c27['id']};return pdf['createPdfFromHTML'](_0x4242a4,_0x33b1aa);})['then'](function(){return new Promise(function(_0xdece94,_0x350663){zipdir(_0x2e1514,{'saveTo':_0x22def5},function(_0x561dc9,_0xc59af6){if(_0x561dc9)return _0x350663(_0x561dc9);return _0xdece94(_0xc59af6);});})[_0x71e5('0x18')](function(){return new BPromise(function(_0x1384af,_0x53b25f){rimraf(_0x2e1514,function(_0xe85a5c){if(_0xe85a5c)_0x53b25f(_0xe85a5c);return _0x1384af();});});})['then'](function(){return _0x2d2aef[_0x71e5('0x7b')](_0x22def5,_0x309b42,function(_0x3c583a){if(_0x3c583a){logger[_0x71e5('0x1d')](_0x71e5('0xd2'),_0x3c583a);}else{fs[_0x71e5('0xd3')](_0x22def5);}});});});}else{return _0x2d2aef[_0x71e5('0x24')](0xc8);}})[_0x71e5('0x23')](handleError(_0x2d2aef,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index c666144..e4d8fed 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 _0x0c56=['exports','events','../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','update','remove','setDataValue','Users','then','unreadMessages','emit','hasOwnProperty','hook'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0c56,0x97));var _0x60c5=function(_0x55c334,_0x2529b0){_0x55c334=_0x55c334-0x0;var _0xc2fc54=_0x0c56[_0x55c334];return _0xc2fc54;};'use strict';var EventEmitter=require(_0x60c5('0x0'));var ChatInteraction=require(_0x60c5('0x1'))['db'][_0x60c5('0x2')];var ChatMessage=require(_0x60c5('0x1'))['db'][_0x60c5('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x60c5('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x60c5('0x5'),'afterDestroy':_0x60c5('0x6')};function emitEvent(_0x5cf68f){return function(_0x1ac38b,_0x3e22ec,_0x27f8a8){_0x1ac38b['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x3a11eb){_0x1ac38b[_0x60c5('0x7')](_0x60c5('0x8'),_0x3a11eb['map'](function(_0x3d8ffa){return{'id':_0x3d8ffa['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0x1ac38b['id'],'direction':'in','read':![]},'raw':!![]});})[_0x60c5('0x9')](function(_0x5b6501){_0x1ac38b[_0x60c5('0x7')](_0x60c5('0xa'),_0x5b6501['length']);ChatInteractionEvents['emit'](_0x5cf68f+':'+_0x1ac38b['id'],_0x1ac38b);ChatInteractionEvents[_0x60c5('0xb')](_0x5cf68f,_0x1ac38b);_0x27f8a8(null);})['catch'](_0x27f8a8(null));};}for(var e in events){if(events[_0x60c5('0xc')](e)){var event=events[e];ChatInteraction[_0x60c5('0xd')](e,emitEvent(event));}}module[_0x60c5('0xe')]=ChatInteractionEvents; \ No newline at end of file +var _0x7538=['emit','catch','hasOwnProperty','exports','events','../../mysqldb','ChatMessage','setMaxListeners','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages'];(function(_0x31ab90,_0x145a96){var _0x2d6123=function(_0x2bf73f){while(--_0x2bf73f){_0x31ab90['push'](_0x31ab90['shift']());}};_0x2d6123(++_0x145a96);}(_0x7538,0x103));var _0x8753=function(_0x3bdb09,_0x2f1fb7){_0x3bdb09=_0x3bdb09-0x0;var _0x5f3ec7=_0x7538[_0x3bdb09];return _0x5f3ec7;};'use strict';var EventEmitter=require(_0x8753('0x0'));var ChatInteraction=require(_0x8753('0x1'))['db']['ChatInteraction'];var ChatMessage=require('../../mysqldb')['db'][_0x8753('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x8753('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8753('0x4'),'afterDestroy':_0x8753('0x5')};function emitEvent(_0x2e3fbb){return function(_0x326f55,_0x13465d,_0x36981e){_0x326f55[_0x8753('0x6')]({'attributes':['id'],'raw':!![]})[_0x8753('0x7')](function(_0x28533e){_0x326f55[_0x8753('0x8')](_0x8753('0x9'),_0x28533e[_0x8753('0xa')](function(_0x54eefe){return{'id':_0x54eefe['id']};}));return ChatMessage[_0x8753('0xb')]({'where':{'ChatInteractionId':_0x326f55['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x13d7bc){_0x326f55[_0x8753('0x8')](_0x8753('0xc'),_0x13d7bc['length']);ChatInteractionEvents[_0x8753('0xd')](_0x2e3fbb+':'+_0x326f55['id'],_0x326f55);ChatInteractionEvents[_0x8753('0xd')](_0x2e3fbb,_0x326f55);_0x36981e(null);})[_0x8753('0xe')](_0x36981e(null));};}for(var e in events){if(events[_0x8753('0xf')](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module[_0x8753('0x10')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index e8f792c..9e14121 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 _0xc518=['bluebird','path','rimraf','../../config/environment','exports','define','ChatInteraction','chat_interactions','changed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','api','moment'];(function(_0x5367c5,_0x439de4){var _0x22c25e=function(_0x54317c){while(--_0x54317c){_0x5367c5['push'](_0x5367c5['shift']());}};_0x22c25e(++_0x439de4);}(_0xc518,0x6d));var _0x8c51=function(_0x12ac1f,_0x461a52){_0x12ac1f=_0x12ac1f-0x0;var _0x724467=_0xc518[_0x12ac1f];return _0x724467;};'use strict';var _=require(_0x8c51('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x8c51('0x1'));var moment=require(_0x8c51('0x2'));var BPromise=require(_0x8c51('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8c51('0x4'));var rimraf=require(_0x8c51('0x5'));var config=require(_0x8c51('0x6'));var attributes=require('./chatInteraction.attributes');module[_0x8c51('0x7')]=function(_0x23586e,_0x573f86){return _0x23586e[_0x8c51('0x8')](_0x8c51('0x9'),attributes,{'tableName':_0x8c51('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x11a8a2,_0x25e78e,_0x439a9f){if(_0x11a8a2[_0x8c51('0xb')]('closed')){_0x11a8a2[_0x8c51('0xc')]=moment()['format'](_0x8c51('0xd'));}_0x439a9f(null,_0x11a8a2);}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x533e=['format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./chatInteraction.attributes','exports','define','ChatInteraction','changed','closedAt'];(function(_0x56ab8f,_0x320fea){var _0x25442a=function(_0x34e64f){while(--_0x34e64f){_0x56ab8f['push'](_0x56ab8f['shift']());}};_0x25442a(++_0x320fea);}(_0x533e,0x134));var _0xe533=function(_0x443468,_0x5c8c24){_0x443468=_0x443468-0x0;var _0xb723f=_0x533e[_0x443468];return _0xb723f;};'use strict';var _=require(_0xe533('0x0'));var util=require(_0xe533('0x1'));var logger=require(_0xe533('0x2'))(_0xe533('0x3'));var moment=require(_0xe533('0x4'));var BPromise=require(_0xe533('0x5'));var rp=require(_0xe533('0x6'));var fs=require('fs');var path=require(_0xe533('0x7'));var rimraf=require('rimraf');var config=require(_0xe533('0x8'));var attributes=require(_0xe533('0x9'));module[_0xe533('0xa')]=function(_0x4a33d5,_0x53b4bc){return _0x4a33d5[_0xe533('0xb')](_0xe533('0xc'),attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2721a6,_0x49f3c5,_0xe6bdd5){if(_0x2721a6[_0xe533('0xd')]('closed')){_0x2721a6[_0xe533('0xe')]=moment()[_0xe533('0xf')](_0xe533('0x10'));}_0xe6bdd5(null,_0x2721a6);}},'charset':_0xe533('0x11'),'collate':_0xe533('0x12')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 3607628..dd3bf06 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 _0x63ce=['body','options','raw','where','attributes','limit','UpdateChatInteraction','AddTagsToChatInteraction','ChatInteraction','find','addTags','ids','omit','spread','AddTags','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','request','then','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','update'];(function(_0x4ccefa,_0xcbf16){var _0x163fc6=function(_0x3baec4){while(--_0x3baec4){_0x4ccefa['push'](_0x4ccefa['shift']());}};_0x163fc6(++_0xcbf16);}(_0x63ce,0x111));var _0xe63c=function(_0xad57ee,_0x2823a6){_0xad57ee=_0xad57ee-0x0;var _0x3eaea9=_0x63ce[_0xad57ee];return _0x3eaea9;};'use strict';var _=require(_0xe63c('0x0'));var util=require(_0xe63c('0x1'));var moment=require('moment');var BPromise=require(_0xe63c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe63c('0x3'));var db=require(_0xe63c('0x4'))['db'];var utils=require(_0xe63c('0x5'));var logger=require('../../config/logger')(_0xe63c('0x6'));var config=require(_0xe63c('0x7'));var jayson=require(_0xe63c('0x8'));var client=jayson[_0xe63c('0x9')][_0xe63c('0xa')]({'port':0x232a});config['redis']=_[_0xe63c('0xb')](config[_0xe63c('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xe63c('0xd'))(new Redis(config[_0xe63c('0xc')]));require('./chatInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x313de5,_0x1e3230,_0x3c03d1){return new BPromise(function(_0x542c71,_0x75c546){return client[_0xe63c('0xe')](_0x313de5,_0x3c03d1)[_0xe63c('0xf')](function(_0x8cf663){logger['info'](_0xe63c('0x10'),_0x1e3230,_0xe63c('0x11'));logger[_0xe63c('0x12')](_0xe63c('0x13'),_0x1e3230,_0xe63c('0x11'),JSON[_0xe63c('0x14')](_0x8cf663));if(_0x8cf663[_0xe63c('0x15')]){if(_0x8cf663[_0xe63c('0x15')][_0xe63c('0x16')]===0x1f4){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x1e3230,_0x8cf663[_0xe63c('0x15')]['message']);return _0x75c546(_0x8cf663[_0xe63c('0x15')]['message']);}logger['error'](_0xe63c('0x10'),_0x1e3230,_0x8cf663[_0xe63c('0x15')][_0xe63c('0x17')]);return _0x542c71(_0x8cf663[_0xe63c('0x15')][_0xe63c('0x17')]);}else{logger[_0xe63c('0x18')](_0xe63c('0x10'),_0x1e3230,_0xe63c('0x11'));_0x542c71(_0x8cf663[_0xe63c('0x19')][_0xe63c('0x17')]);}})[_0xe63c('0x1a')](function(_0x24a802){logger[_0xe63c('0x15')](_0xe63c('0x10'),_0x1e3230,_0x24a802);_0x75c546(_0x24a802);});});}exports['UpdateChatInteraction']=function(_0x20a9d9){var _0xc4c00e=this;return new Promise(function(_0x4519b3,_0x5034ef){return db['ChatInteraction'][_0xe63c('0x1b')](_0x20a9d9[_0xe63c('0x1c')],{'raw':_0x20a9d9[_0xe63c('0x1d')]?_0x20a9d9['options'][_0xe63c('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x20a9d9['options']?_0x20a9d9['options'][_0xe63c('0x1f')]||null:null,'attributes':_0x20a9d9[_0xe63c('0x1d')]?_0x20a9d9[_0xe63c('0x1d')][_0xe63c('0x20')]||null:null,'limit':_0x20a9d9[_0xe63c('0x1d')]?_0x20a9d9['options'][_0xe63c('0x21')]||null:null})[_0xe63c('0xf')](function(_0xb37f){logger[_0xe63c('0x18')]('UpdateChatInteraction',_0x20a9d9);logger[_0xe63c('0x12')](_0xe63c('0x22'),_0x20a9d9,JSON[_0xe63c('0x14')](_0xb37f));_0x4519b3(_0xb37f);})[_0xe63c('0x1a')](function(_0x55fc85){logger[_0xe63c('0x15')]('UpdateChatInteraction',_0x55fc85[_0xe63c('0x17')],_0x20a9d9);_0x5034ef(_0xc4c00e['error'](0x1f4,_0x55fc85[_0xe63c('0x17')]));});});};exports[_0xe63c('0x23')]=function(_0x44b183){return new Promise(function(_0x43075a,_0x3ff052){return db[_0xe63c('0x24')][_0xe63c('0x25')]({'where':_0x44b183[_0xe63c('0x1d')]?_0x44b183[_0xe63c('0x1d')]['where']||null:null})[_0xe63c('0xf')](function(_0x1188c6){if(_0x1188c6){return _0x1188c6[_0xe63c('0x26')](_0x44b183[_0xe63c('0x1c')][_0xe63c('0x27')],_[_0xe63c('0x28')](_0x44b183[_0xe63c('0x1c')],[_0xe63c('0x27'),'id'])||{});}})[_0xe63c('0x29')](function(_0x426509){logger['info'](_0xe63c('0x2a'),_0x44b183);logger[_0xe63c('0x12')](_0xe63c('0x2a'),_0x44b183,JSON[_0xe63c('0x14')](_0x426509));_0x43075a(_0x426509);})['catch'](function(_0x471d42){logger[_0xe63c('0x15')]('AddTags',_0x471d42[_0xe63c('0x17')],_0x44b183);_0x3ff052(_this[_0xe63c('0x15')](0x1f4,_0x471d42['message']));});});}; \ No newline at end of file +var _0xe758=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','error','code','message','catch','UpdateChatInteraction','ChatInteraction','update','body','options','raw','where','limit','AddTagsToChatInteraction','find','addTags','omit','stringify','AddTags','util'];(function(_0x47bc5e,_0x6fc500){var _0x323a59=function(_0x32df89){while(--_0x32df89){_0x47bc5e['push'](_0x47bc5e['shift']());}};_0x323a59(++_0x6fc500);}(_0xe758,0x11e));var _0x8e75=function(_0x1c043c,_0x3e5802){_0x1c043c=_0x1c043c-0x0;var _0x37929d=_0xe758[_0x1c043c];return _0x37929d;};'use strict';var _=require('lodash');var util=require(_0x8e75('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8e75('0x1'));var fs=require('fs');var Redis=require(_0x8e75('0x2'));var db=require(_0x8e75('0x3'))['db'];var utils=require(_0x8e75('0x4'));var logger=require(_0x8e75('0x5'))(_0x8e75('0x6'));var config=require(_0x8e75('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x8e75('0x8')][_0x8e75('0x9')]({'port':0x232a});config[_0x8e75('0xa')]=_[_0x8e75('0xb')](config[_0x8e75('0xa')],{'host':_0x8e75('0xc'),'port':0x18eb});var socket=require(_0x8e75('0xd'))(new Redis(config[_0x8e75('0xa')]));require(_0x8e75('0xe'))[_0x8e75('0xf')](socket);function respondWithRpcPromise(_0x2cf30b,_0x2c2ff2,_0x45e116){return new BPromise(function(_0x37baa0,_0x1e1a80){return client[_0x8e75('0x10')](_0x2cf30b,_0x45e116)[_0x8e75('0x11')](function(_0x7f2119){logger[_0x8e75('0x12')](_0x8e75('0x13'),_0x2c2ff2,_0x8e75('0x14'));logger[_0x8e75('0x15')](_0x8e75('0x16'),_0x2c2ff2,_0x8e75('0x14'),JSON['stringify'](_0x7f2119));if(_0x7f2119[_0x8e75('0x17')]){if(_0x7f2119['error'][_0x8e75('0x18')]===0x1f4){logger[_0x8e75('0x17')](_0x8e75('0x13'),_0x2c2ff2,_0x7f2119[_0x8e75('0x17')]['message']);return _0x1e1a80(_0x7f2119[_0x8e75('0x17')][_0x8e75('0x19')]);}logger['error']('ChatInteraction,\x20%s,\x20%s',_0x2c2ff2,_0x7f2119['error']['message']);return _0x37baa0(_0x7f2119[_0x8e75('0x17')]['message']);}else{logger[_0x8e75('0x12')](_0x8e75('0x13'),_0x2c2ff2,'request\x20sent');_0x37baa0(_0x7f2119['result'][_0x8e75('0x19')]);}})[_0x8e75('0x1a')](function(_0x4ba0e3){logger[_0x8e75('0x17')]('ChatInteraction,\x20%s,\x20%s',_0x2c2ff2,_0x4ba0e3);_0x1e1a80(_0x4ba0e3);});});}exports[_0x8e75('0x1b')]=function(_0x9601dc){var _0x291e89=this;return new Promise(function(_0x2648bf,_0x3cd161){return db[_0x8e75('0x1c')][_0x8e75('0x1d')](_0x9601dc[_0x8e75('0x1e')],{'raw':_0x9601dc[_0x8e75('0x1f')]?_0x9601dc[_0x8e75('0x1f')][_0x8e75('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x9601dc[_0x8e75('0x1f')]?_0x9601dc[_0x8e75('0x1f')][_0x8e75('0x21')]||null:null,'attributes':_0x9601dc[_0x8e75('0x1f')]?_0x9601dc[_0x8e75('0x1f')]['attributes']||null:null,'limit':_0x9601dc['options']?_0x9601dc[_0x8e75('0x1f')][_0x8e75('0x22')]||null:null})['then'](function(_0x57e4b4){logger[_0x8e75('0x12')](_0x8e75('0x1b'),_0x9601dc);logger['debug']('UpdateChatInteraction',_0x9601dc,JSON['stringify'](_0x57e4b4));_0x2648bf(_0x57e4b4);})[_0x8e75('0x1a')](function(_0x1370c2){logger[_0x8e75('0x17')]('UpdateChatInteraction',_0x1370c2[_0x8e75('0x19')],_0x9601dc);_0x3cd161(_0x291e89['error'](0x1f4,_0x1370c2['message']));});});};exports[_0x8e75('0x23')]=function(_0x4fdb1e){return new Promise(function(_0x44d24b,_0x50b8d){return db[_0x8e75('0x1c')][_0x8e75('0x24')]({'where':_0x4fdb1e['options']?_0x4fdb1e[_0x8e75('0x1f')]['where']||null:null})[_0x8e75('0x11')](function(_0x225fa0){if(_0x225fa0){return _0x225fa0[_0x8e75('0x25')](_0x4fdb1e[_0x8e75('0x1e')]['ids'],_[_0x8e75('0x26')](_0x4fdb1e[_0x8e75('0x1e')],['ids','id'])||{});}})['spread'](function(_0x201bbf){logger[_0x8e75('0x12')]('AddTags',_0x4fdb1e);logger[_0x8e75('0x15')]('AddTags',_0x4fdb1e,JSON[_0x8e75('0x27')](_0x201bbf));_0x44d24b(_0x201bbf);})[_0x8e75('0x1a')](function(_0x51d61d){logger[_0x8e75('0x17')](_0x8e75('0x28'),_0x51d61d[_0x8e75('0x19')],_0x4fdb1e);_0x50b8d(_this[_0x8e75('0x17')](0x1f4,_0x51d61d['message']));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 090d614..b5ad79b 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 _0x69db=['update','emit','removeListener','register','length','chatInteraction:','./chatInteraction.events','save'];(function(_0x57a2a6,_0x3d21b2){var _0x74724a=function(_0x5918cc){while(--_0x5918cc){_0x57a2a6['push'](_0x57a2a6['shift']());}};_0x74724a(++_0x3d21b2);}(_0x69db,0x106));var _0xb69d=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x69db[_0x2dafbe];return _0x58a45a;};'use strict';var ChatInteractionEvents=require(_0xb69d('0x0'));var events=[_0xb69d('0x1'),'remove',_0xb69d('0x2')];function createListener(_0x264d83,_0xb8a9d7){return function(_0x4334fa){_0xb8a9d7[_0xb69d('0x3')](_0x264d83,_0x4334fa);};}function removeListener(_0x40ad08,_0x1ac2c6){return function(){ChatInteractionEvents[_0xb69d('0x4')](_0x40ad08,_0x1ac2c6);};}exports[_0xb69d('0x5')]=function(_0x13d2c1){for(var _0x29ed58=0x0,_0x2f39b5=events[_0xb69d('0x6')];_0x29ed58<_0x2f39b5;_0x29ed58++){var _0x297707=events[_0x29ed58];var _0x51b684=createListener(_0xb69d('0x7')+_0x297707,_0x13d2c1);ChatInteractionEvents['on'](_0x297707,_0x51b684);}}; \ No newline at end of file +var _0xec61=['register','length','chatInteraction:','./chatInteraction.events','save','remove','update','emit','removeListener'];(function(_0x1147ab,_0x10e72b){var _0x55cb5a=function(_0x364bd6){while(--_0x364bd6){_0x1147ab['push'](_0x1147ab['shift']());}};_0x55cb5a(++_0x10e72b);}(_0xec61,0x66));var _0x1ec6=function(_0x42a78b,_0x36d6b1){_0x42a78b=_0x42a78b-0x0;var _0x2270f6=_0xec61[_0x42a78b];return _0x2270f6;};'use strict';var ChatInteractionEvents=require(_0x1ec6('0x0'));var events=[_0x1ec6('0x1'),_0x1ec6('0x2'),_0x1ec6('0x3')];function createListener(_0xe3ddbf,_0x2e0014){return function(_0x1814a2){_0x2e0014[_0x1ec6('0x4')](_0xe3ddbf,_0x1814a2);};}function removeListener(_0xc6eb03,_0x3bc11a){return function(){ChatInteractionEvents[_0x1ec6('0x5')](_0xc6eb03,_0x3bc11a);};}exports[_0x1ec6('0x6')]=function(_0xd27618){for(var _0x3b470f=0x0,_0x8d7732=events[_0x1ec6('0x7')];_0x3b470f<_0x8d7732;_0x3b470f++){var _0x24043f=events[_0x3b470f];var _0x48457f=createListener(_0x1ec6('0x8')+_0x24043f,_0xd27618);ChatInteractionEvents['on'](_0x24043f,_0x48457f);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index ebce9a2..dd0f9d1 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 _0x5749=['/:id/tags','tracked','chat','addTags','put','update','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','close','delete','chatinteraction:destroy','destroy','removeTags','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','isChatInteractionAuthorized','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','getMyMessages','/:id/download','download','post','createVidaooSession','diskStorage','join','root','server/files/attachments/','format','%s-%s','now','originalname','/:id/attachment_upload','single','file','attachmentUpload','addMessage'];(function(_0x4a538c,_0x50804b){var _0x552930=function(_0x49e6db){while(--_0x49e6db){_0x4a538c['push'](_0x4a538c['shift']());}};_0x552930(++_0x50804b);}(_0x5749,0x148));var _0x9574=function(_0x4584a2,_0x56e5d9){_0x4584a2=_0x4584a2-0x0;var _0x2510e0=_0x5749[_0x4584a2];return _0x2510e0;};'use strict';var multer=require('multer');var util=require(_0x9574('0x0'));var path=require('path');var timeout=require(_0x9574('0x1'));var express=require(_0x9574('0x2'));var router=express[_0x9574('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x9574('0x4'));var interaction=require(_0x9574('0x5'));var config=require(_0x9574('0x6'));var controller=require('./chatInteraction.controller');router[_0x9574('0x7')]('/',auth[_0x9574('0x8')](),controller[_0x9574('0x9')]);router[_0x9574('0x7')](_0x9574('0xa'),auth[_0x9574('0x8')](),controller[_0x9574('0xb')]);router['get'](_0x9574('0xc'),auth[_0x9574('0xd')](),controller['show']);router[_0x9574('0x7')](_0x9574('0xe'),auth[_0x9574('0xd')](),controller[_0x9574('0xf')]);router[_0x9574('0x7')](_0x9574('0x10'),auth[_0x9574('0x8')](),controller[_0x9574('0x11')]);router[_0x9574('0x7')]('/:id/my_messages',auth[_0x9574('0xd')](),controller[_0x9574('0x12')]);router[_0x9574('0x7')](_0x9574('0x13'),auth[_0x9574('0x8')](),controller[_0x9574('0x14')]);router[_0x9574('0x15')]('/',auth[_0x9574('0x8')](),controller['create']);router['post']('/:id/vidaoo',auth[_0x9574('0x8')](),controller[_0x9574('0x16')]);var upload=multer({'storage':multer[_0x9574('0x17')]({'destination':function(_0x19c507,_0x1019c5,_0x3ec19f){_0x3ec19f(null,path[_0x9574('0x18')](config[_0x9574('0x19')],_0x9574('0x1a')));},'filename':function(_0x5ad45b,_0x1fff1a,_0x871cdf){_0x871cdf(null,util[_0x9574('0x1b')](_0x9574('0x1c'),Date[_0x9574('0x1d')](),_0x1fff1a[_0x9574('0x1e')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x9574('0x15')](_0x9574('0x1f'),upload[_0x9574('0x20')](_0x9574('0x21')),controller[_0x9574('0x22')]);router[_0x9574('0x15')](_0x9574('0x10'),auth[_0x9574('0xd')](),controller[_0x9574('0x23')]);router[_0x9574('0x15')](_0x9574('0x24'),auth[_0x9574('0x8')](),interaction[_0x9574('0x25')](_0x9574('0x26'),'chatinteraction:addtags'),controller[_0x9574('0x27')]);router[_0x9574('0x28')](_0x9574('0xc'),auth[_0x9574('0x8')](),interaction[_0x9574('0x25')](_0x9574('0x26'),'chatinteraction:update'),controller[_0x9574('0x29')]);router[_0x9574('0x28')](_0x9574('0x2a'),controller[_0x9574('0x2b')]);router['put'](_0x9574('0x2c'),auth[_0x9574('0xd')](),controller[_0x9574('0x2d')]);router[_0x9574('0x28')](_0x9574('0x2e'),controller[_0x9574('0x2f')]);router[_0x9574('0x30')]('/:id',auth[_0x9574('0x8')](),interaction[_0x9574('0x25')](_0x9574('0x26'),_0x9574('0x31')),controller[_0x9574('0x32')]);router['delete'](_0x9574('0x24'),auth['isAuthenticated'](),controller[_0x9574('0x33')]);module['exports']=router; \ No newline at end of file +var _0xf939=['../../config/environment','get','isAuthenticated','index','/describe','describe','isChatInteractionAuthorized','show','/:id/attachment_download','/:id/messages','getMessages','/:id/my_messages','getMyMessages','/:id/download','post','/:id/vidaoo','createVidaooSession','diskStorage','join','root','server/files/attachments/','format','now','originalname','single','file','tracked','chat','chatinteraction:addtags','addTags','put','chatinteraction:update','update','/:id/custom_update','customUpdate','abandon','/:id/close','close','delete','/:id','chatinteraction:destroy','destroy','removeTags','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xf939,0x164));var _0x9f93=function(_0x511284,_0x37603d){_0x511284=_0x511284-0x0;var _0x5126cc=_0xf939[_0x511284];return _0x5126cc;};'use strict';var multer=require(_0x9f93('0x0'));var util=require(_0x9f93('0x1'));var path=require('path');var timeout=require(_0x9f93('0x2'));var express=require(_0x9f93('0x3'));var router=express[_0x9f93('0x4')]();var fs_extra=require(_0x9f93('0x5'));var auth=require(_0x9f93('0x6'));var interaction=require(_0x9f93('0x7'));var config=require(_0x9f93('0x8'));var controller=require('./chatInteraction.controller');router[_0x9f93('0x9')]('/',auth[_0x9f93('0xa')](),controller[_0x9f93('0xb')]);router[_0x9f93('0x9')](_0x9f93('0xc'),auth['isAuthenticated'](),controller[_0x9f93('0xd')]);router['get']('/:id',auth[_0x9f93('0xe')](),controller[_0x9f93('0xf')]);router[_0x9f93('0x9')](_0x9f93('0x10'),auth['isChatInteractionAuthorized'](),controller['attachmentDownload']);router[_0x9f93('0x9')](_0x9f93('0x11'),auth[_0x9f93('0xa')](),controller[_0x9f93('0x12')]);router['get'](_0x9f93('0x13'),auth[_0x9f93('0xe')](),controller[_0x9f93('0x14')]);router[_0x9f93('0x9')](_0x9f93('0x15'),auth[_0x9f93('0xa')](),controller['download']);router['post']('/',auth[_0x9f93('0xa')](),controller['create']);router[_0x9f93('0x16')](_0x9f93('0x17'),auth[_0x9f93('0xa')](),controller[_0x9f93('0x18')]);var upload=multer({'storage':multer[_0x9f93('0x19')]({'destination':function(_0x4acd13,_0x506db6,_0x3e6fa1){_0x3e6fa1(null,path[_0x9f93('0x1a')](config[_0x9f93('0x1b')],_0x9f93('0x1c')));},'filename':function(_0x3e1858,_0x1a5cdf,_0x5c8b70){_0x5c8b70(null,util[_0x9f93('0x1d')]('%s-%s',Date[_0x9f93('0x1e')](),_0x1a5cdf[_0x9f93('0x1f')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post']('/:id/attachment_upload',upload[_0x9f93('0x20')](_0x9f93('0x21')),controller['attachmentUpload']);router[_0x9f93('0x16')](_0x9f93('0x11'),auth[_0x9f93('0xe')](),controller['addMessage']);router[_0x9f93('0x16')]('/:id/tags',auth[_0x9f93('0xa')](),interaction[_0x9f93('0x22')](_0x9f93('0x23'),_0x9f93('0x24')),controller[_0x9f93('0x25')]);router[_0x9f93('0x26')]('/:id',auth[_0x9f93('0xa')](),interaction[_0x9f93('0x22')](_0x9f93('0x23'),_0x9f93('0x27')),controller[_0x9f93('0x28')]);router[_0x9f93('0x26')](_0x9f93('0x29'),controller[_0x9f93('0x2a')]);router['put']('/:id/abandon',auth[_0x9f93('0xe')](),controller[_0x9f93('0x2b')]);router[_0x9f93('0x26')](_0x9f93('0x2c'),controller[_0x9f93('0x2d')]);router[_0x9f93('0x2e')](_0x9f93('0x2f'),auth[_0x9f93('0xa')](),interaction[_0x9f93('0x22')](_0x9f93('0x23'),_0x9f93('0x30')),controller[_0x9f93('0x31')]);router[_0x9f93('0x2e')]('/:id/tags',auth[_0x9f93('0xa')](),controller[_0x9f93('0x32')]);module[_0x9f93('0x33')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 016b01e..b56ad2c 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 _0x7fc9=['TEXT','medium','BOOLEAN','INTEGER','sequelize','exports'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x7fc9,0xee));var _0x97fc=function(_0xe61544,_0x30b2d2){_0xe61544=_0xe61544-0x0;var _0x58cc3e=_0x7fc9[_0xe61544];return _0x58cc3e;};'use strict';var Sequelize=require(_0x97fc('0x0'));module[_0x97fc('0x1')]={'body':{'type':Sequelize[_0x97fc('0x2')](_0x97fc('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x97fc('0x4')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x97fc('0x5')]}}; \ No newline at end of file +var _0x34b6=['medium','BOOLEAN','INTEGER','sequelize','TEXT'];(function(_0x4b9ac1,_0x597aba){var _0x5e116e=function(_0xa5e0d0){while(--_0xa5e0d0){_0x4b9ac1['push'](_0x4b9ac1['shift']());}};_0x5e116e(++_0x597aba);}(_0x34b6,0xda));var _0x634b=function(_0x179e41,_0x3f91fb){_0x179e41=_0x179e41-0x0;var _0x3ba133=_0x34b6[_0x179e41];return _0x3ba133;};'use strict';var Sequelize=require(_0x634b('0x0'));module['exports']={'body':{'type':Sequelize[_0x634b('0x1')](_0x634b('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x634b('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x634b('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 8dcfc30..54cb7c9 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 _0x2de3=['FromId','ToId','read','-createdAt','all','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','defaults','redis','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','json','limit','undefined','offset','count','set','Content-Range','apply','reject','save','update','destroy','then','end','error','stack','name','index','map','rawAttributes','fieldName','type','key','query','keys','attributes','intersection','model','fields','length','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','options','ChatInternalMessage','include','findAll','show','params','includeAll','merge','create','body','catch','find','describe','messages','lastMessageAt','createdAt','lastMessage','YYYY-MM-DD\x20HH:mm:ss','agent','admin','user','fullname','role','userpic','internal','online','showWebBar','-online','VoiceQueues','UserProfileSection','userProfileId','autoAssociation','isEmpty','resourceId','push'];(function(_0x493d61,_0x67f009){var _0x147baa=function(_0x2ed817){while(--_0x2ed817){_0x493d61['push'](_0x493d61['shift']());}};_0x147baa(++_0x67f009);}(_0x2de3,0x70));var _0x32de=function(_0x44d37f,_0x5d21ee){_0x44d37f=_0x44d37f-0x0;var _0x48f105=_0x2de3[_0x44d37f];return _0x48f105;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x32de('0x0'));var zipdir=require(_0x32de('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x32de('0x2'));var moment=require('moment');var BPromise=require(_0x32de('0x3'));var Mustache=require(_0x32de('0x4'));var util=require(_0x32de('0x5'));var path=require(_0x32de('0x6'));var sox=require(_0x32de('0x7'));var csv=require('to-csv');var ejs=require(_0x32de('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x32de('0x9'));var squel=require(_0x32de('0xa'));var crypto=require(_0x32de('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x32de('0xc'));var toCsv=require(_0x32de('0xd'));var querystring=require(_0x32de('0xe'));var Papa=require(_0x32de('0xf'));var Redis=require('ioredis');var authService=require(_0x32de('0x10'));var qs=require(_0x32de('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x32de('0x12'))(_0x32de('0x13'));var utils=require('../../config/utils');var config=require(_0x32de('0x14'));var licenseUtil=require(_0x32de('0x15'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x32de('0x16')](config[_0x32de('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x32de('0x18'))(new Redis(config[_0x32de('0x17')]));require(_0x32de('0x19'))[_0x32de('0x1a')](socket);function respondWithStatusCode(_0x232376,_0x3316a1){_0x3316a1=_0x3316a1||0xcc;return function(_0x4042eb){if(_0x4042eb){return _0x232376[_0x32de('0x1b')](_0x3316a1);}return _0x232376['status'](_0x3316a1)['end']();};}function respondWithResult(_0x23cedc,_0x3fe272){_0x3fe272=_0x3fe272||0xc8;return function(_0x4db7b7){if(_0x4db7b7){return _0x23cedc[_0x32de('0x1c')](_0x3fe272)[_0x32de('0x1d')](_0x4db7b7);}};}function respondWithFilteredResult(_0x553d7d,_0x5870e1){return function(_0x16d6c6){if(_0x16d6c6){var _0x1e3cea=typeof _0x5870e1['offset']==='undefined'&&typeof _0x5870e1[_0x32de('0x1e')]===_0x32de('0x1f');var _0x27dcfc=_0x16d6c6['count'];var _0x2b75e9=_0x1e3cea?0x0:_0x5870e1[_0x32de('0x20')];var _0x2fe59a=_0x1e3cea?_0x16d6c6[_0x32de('0x21')]:_0x5870e1[_0x32de('0x20')]+_0x5870e1[_0x32de('0x1e')];var _0x54ae9e;if(_0x2fe59a>=_0x27dcfc){_0x2fe59a=_0x27dcfc;_0x54ae9e=0xc8;}else{_0x54ae9e=0xce;}_0x553d7d[_0x32de('0x1c')](_0x54ae9e);return _0x553d7d[_0x32de('0x22')](_0x32de('0x23'),_0x2b75e9+'-'+_0x2fe59a+'/'+_0x27dcfc)[_0x32de('0x1d')](_0x16d6c6);}return null;};}function patchUpdates(_0x243385){return function(_0x38a526){try{jsonpatch[_0x32de('0x24')](_0x38a526,_0x243385,!![]);}catch(_0x1d5ee7){return BPromise[_0x32de('0x25')](_0x1d5ee7);}return _0x38a526[_0x32de('0x26')]();};}function saveUpdates(_0x4d16c9,_0x5cecb1){return function(_0x55b208){if(_0x55b208){return _0x55b208[_0x32de('0x27')](_0x4d16c9)['then'](function(_0x4244f7){return _0x4244f7;});}return null;};}function removeEntity(_0x36936f,_0x573bcf){return function(_0x4e1ca4){if(_0x4e1ca4){return _0x4e1ca4[_0x32de('0x28')]()[_0x32de('0x29')](function(){_0x36936f[_0x32de('0x1c')](0xcc)[_0x32de('0x2a')]();});}};}function handleEntityNotFound(_0x2b6fde,_0x4d6299){return function(_0x5598c7){if(!_0x5598c7){_0x2b6fde['sendStatus'](0x194);}return _0x5598c7;};}function handleError(_0x23a532,_0x4ca57c){_0x4ca57c=_0x4ca57c||0x1f4;return function(_0x592bfa){logger[_0x32de('0x2b')](_0x592bfa[_0x32de('0x2c')]);if(_0x592bfa['name']){delete _0x592bfa[_0x32de('0x2d')];}_0x23a532['status'](_0x4ca57c)['send'](_0x592bfa);};}exports[_0x32de('0x2e')]=function(_0x5e5a4c,_0x3a902a){var _0x3aa285={},_0x358d72={},_0x5d6e5c={'count':0x0,'rows':[]};var _0x588868=_[_0x32de('0x2f')](db['ChatInternalMessage'][_0x32de('0x30')],function(_0x3b2ffa){return{'name':_0x3b2ffa[_0x32de('0x31')],'type':_0x3b2ffa[_0x32de('0x32')][_0x32de('0x33')]};});_0x358d72['model']=_[_0x32de('0x2f')](_0x588868,_0x32de('0x2d'));_0x358d72[_0x32de('0x34')]=_[_0x32de('0x35')](_0x5e5a4c[_0x32de('0x34')]);_0x358d72['filters']=_['intersection'](_0x358d72['model'],_0x358d72[_0x32de('0x34')]);_0x3aa285[_0x32de('0x36')]=_[_0x32de('0x37')](_0x358d72[_0x32de('0x38')],qs[_0x32de('0x39')](_0x5e5a4c[_0x32de('0x34')][_0x32de('0x39')]));_0x3aa285[_0x32de('0x36')]=_0x3aa285['attributes'][_0x32de('0x3a')]?_0x3aa285[_0x32de('0x36')]:_0x358d72[_0x32de('0x38')];if(!_0x5e5a4c['query']['hasOwnProperty'](_0x32de('0x3b'))){_0x3aa285[_0x32de('0x1e')]=qs['limit'](_0x5e5a4c[_0x32de('0x34')][_0x32de('0x1e')]);_0x3aa285[_0x32de('0x20')]=qs[_0x32de('0x20')](_0x5e5a4c[_0x32de('0x34')][_0x32de('0x20')]);}_0x3aa285[_0x32de('0x3c')]=qs[_0x32de('0x3d')](_0x5e5a4c[_0x32de('0x34')][_0x32de('0x3d')]);_0x3aa285[_0x32de('0x3e')]=qs[_0x32de('0x3f')](_[_0x32de('0x40')](_0x5e5a4c[_0x32de('0x34')],_0x358d72[_0x32de('0x3f')]),_0x588868);if(_0x5e5a4c[_0x32de('0x34')][_0x32de('0x41')]){_0x3aa285['where']=_['merge'](_0x3aa285[_0x32de('0x3e')],{'$or':_[_0x32de('0x2f')](_0x588868,function(_0x24d58f){if(_0x24d58f[_0x32de('0x32')]!==_0x32de('0x42')){var _0x2a6b2a={};_0x2a6b2a[_0x24d58f[_0x32de('0x2d')]]={'$like':'%'+_0x5e5a4c[_0x32de('0x34')][_0x32de('0x41')]+'%'};return _0x2a6b2a;}})});}_0x3aa285=_['merge']({},_0x3aa285,_0x5e5a4c[_0x32de('0x43')]);var _0x43a26c={'where':_0x3aa285[_0x32de('0x3e')]};return db[_0x32de('0x44')][_0x32de('0x21')](_0x43a26c)[_0x32de('0x29')](function(_0x3b2807){_0x5d6e5c[_0x32de('0x21')]=_0x3b2807;if(_0x5e5a4c[_0x32de('0x34')]['includeAll']){_0x3aa285[_0x32de('0x45')]=[{'all':!![]}];}return db[_0x32de('0x44')][_0x32de('0x46')](_0x3aa285);})[_0x32de('0x29')](function(_0x3502d0){_0x5d6e5c['rows']=_0x3502d0;return _0x5d6e5c;})[_0x32de('0x29')](respondWithFilteredResult(_0x3a902a,_0x3aa285))['catch'](handleError(_0x3a902a,null));};exports[_0x32de('0x47')]=function(_0x490d87,_0x1b9465){var _0x6ff599={'raw':!![],'where':{'id':_0x490d87[_0x32de('0x48')]['id']}},_0x54591d={};_0x54591d[_0x32de('0x38')]=_[_0x32de('0x35')](db['ChatInternalMessage'][_0x32de('0x30')]);_0x54591d['query']=_[_0x32de('0x35')](_0x490d87[_0x32de('0x34')]);_0x54591d[_0x32de('0x3f')]=_[_0x32de('0x37')](_0x54591d[_0x32de('0x38')],_0x54591d[_0x32de('0x34')]);_0x6ff599[_0x32de('0x36')]=_[_0x32de('0x37')](_0x54591d[_0x32de('0x38')],qs['fields'](_0x490d87['query']['fields']));_0x6ff599[_0x32de('0x36')]=_0x6ff599[_0x32de('0x36')]['length']?_0x6ff599[_0x32de('0x36')]:_0x54591d[_0x32de('0x38')];if(_0x490d87[_0x32de('0x34')][_0x32de('0x49')]){_0x6ff599[_0x32de('0x45')]=[{'all':!![]}];}_0x6ff599=_[_0x32de('0x4a')]({},_0x6ff599,_0x490d87['options']);return db[_0x32de('0x44')]['find'](_0x6ff599)[_0x32de('0x29')](handleEntityNotFound(_0x1b9465,null))[_0x32de('0x29')](respondWithResult(_0x1b9465,null))['catch'](handleError(_0x1b9465,null));};exports[_0x32de('0x4b')]=function(_0x579fc2,_0x3bdd64){return db[_0x32de('0x44')][_0x32de('0x4b')](_0x579fc2[_0x32de('0x4c')],{})[_0x32de('0x29')](respondWithResult(_0x3bdd64,0xc9))['catch'](handleError(_0x3bdd64,null));};exports[_0x32de('0x27')]=function(_0x370af8,_0x504021){if(_0x370af8[_0x32de('0x4c')]['id']){delete _0x370af8[_0x32de('0x4c')]['id'];}return db['ChatInternalMessage']['find']({'where':{'id':_0x370af8[_0x32de('0x48')]['id']}})[_0x32de('0x29')](handleEntityNotFound(_0x504021,null))['then'](saveUpdates(_0x370af8[_0x32de('0x4c')],null))['then'](respondWithResult(_0x504021,null))[_0x32de('0x4d')](handleError(_0x504021,null));};exports['destroy']=function(_0x41cd38,_0x187c61){return db['ChatInternalMessage'][_0x32de('0x4e')]({'where':{'id':_0x41cd38[_0x32de('0x48')]['id']}})[_0x32de('0x29')](handleEntityNotFound(_0x187c61,null))[_0x32de('0x29')](removeEntity(_0x187c61,null))[_0x32de('0x4d')](handleError(_0x187c61,null));};exports[_0x32de('0x4f')]=function(_0x4a40f6,_0x36fcbd){return db['ChatInternalMessage']['describe']()[_0x32de('0x29')](respondWithResult(_0x36fcbd,null))['catch'](handleError(_0x36fcbd,null));};function wrapUser(_0x54d93b){return function(_0xc72320){var _0x4c9e7a=_0x54d93b['get']({'plain':!![]});_0x4c9e7a[_0x32de('0x50')]=[];if(_0xc72320){_0x4c9e7a[_0x32de('0x51')]=_0xc72320[_0x32de('0x52')];_0x4c9e7a[_0x32de('0x53')]=_0xc72320;}else{_0x4c9e7a[_0x32de('0x51')]=moment(0x0)['format'](_0x32de('0x54'));_0x4c9e7a['lastMessage']={};}return _0x4c9e7a;};}exports['getUsers']=function(_0xb00e59,_0x55708f,_0x45cb9d){var _0x4fbf1c=[];return db['User'][_0x32de('0x46')]({'where':{'role':[_0x32de('0x55'),_0x32de('0x56'),_0x32de('0x57')]},'attributes':['id',_0x32de('0x58'),_0x32de('0x2d'),_0x32de('0x59'),_0x32de('0x5a'),_0x32de('0x5b'),_0x32de('0x5c'),'lastLoginAt','allowmessenger',_0x32de('0x5d')],'order':qs[_0x32de('0x3d')](_0x32de('0x5e')),'include':[{'model':db['VoiceQueue'],'as':_0x32de('0x5f'),'attributes':['id',_0x32de('0x2d'),_0x32de('0x32')],'through':{'attributes':[]}}]})[_0x32de('0x29')](function(_0x49429d){if(_0x49429d){var _0x17519b=_0xb00e59[_0x32de('0x57')]['get']({'plain':!![]});if(!_0x17519b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x17519b['role']==='user'){return db[_0x32de('0x60')][_0x32de('0x4e')]({'where':{'name':'Agents','userProfileId':_0x17519b[_0x32de('0x61')]},'raw':!![]})['then'](function(_0x348ab4){if(_0x348ab4){if(_0x348ab4[_0x32de('0x62')]===0x0){return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x348ab4['id']},'raw':!![]})['then'](function(_0xe6a8eb){var _0xd92e9a=[];if(_[_0x32de('0x63')](_0xe6a8eb)){_0xd92e9a=_[_0x32de('0x41')](_0x49429d,function(_0x2b030f){if(_0x2b030f['role']!==_0x32de('0x55')){return _0x2b030f;}});return _0xd92e9a;}else{for(var _0x4e2702=0x0;_0x4e2702<_0x49429d['length'];_0x4e2702++){var _0x406cb9=_0x49429d[_0x4e2702];if(_0x406cb9[_0x32de('0x59')]===_0x32de('0x55')){var _0x1acd15=_[_0x32de('0x4e')](_0xe6a8eb,function(_0x111e2c){return _0x111e2c[_0x32de('0x64')]===_0x406cb9['id'];});if(_0x1acd15)_0xd92e9a[_0x32de('0x65')](_0x406cb9);}else{_0xd92e9a[_0x32de('0x65')](_0x406cb9);}}return _0xd92e9a;}});}else{return _0x49429d;}}else{var _0x2f5f79=_[_0x32de('0x41')](_0x49429d,function(_0x5c25a3){if(_0x5c25a3[_0x32de('0x59')]!=='agent'){return _0x5c25a3;}});return _0x2f5f79;}});}else{return _0x49429d;}}})['then'](function(_0x3224c0){var _0x976982=[];if(_0x3224c0){_0x4fbf1c=_0x3224c0;for(var _0x1541bf=0x0;_0x1541bf<_0x3224c0['length'];_0x1541bf+=0x1){_0x4fbf1c[_0x1541bf][_0x32de('0x50')]=[];_0x976982[_0x32de('0x65')](db[_0x32de('0x44')][_0x32de('0x4e')]({'where':{'FromId':[_0xb00e59[_0x32de('0x57')]['id'],_0x3224c0[_0x1541bf]['id']],'ToId':[_0xb00e59[_0x32de('0x57')]['id'],_0x3224c0[_0x1541bf]['id']],'ChatGroupId':null},'attributes':['id','createdAt',_0x32de('0x66'),_0x32de('0x67'),_0x32de('0x68'),_0x32de('0x4c')],'order':qs[_0x32de('0x3d')](_0x32de('0x69')),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0x3224c0[_0x1541bf])));}return BPromise[_0x32de('0x6a')](_0x976982);}return[];})[_0x32de('0x29')](function(_0x38e323){return{'rows':_0x38e323,'count':_0x38e323[_0x32de('0x3a')]};})[_0x32de('0x29')](respondWithResult(_0x55708f,null))[_0x32de('0x4d')](handleError(_0x55708f,null));}; \ No newline at end of file +var _0xa8cd=['apply','reject','save','destroy','then','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','ChatInternalMessage','includeAll','include','findAll','rows','show','params','keys','options','catch','body','update','find','describe','get','messages','lastMessageAt','createdAt','lastMessage','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','agent','admin','user','fullname','role','userpic','online','lastLoginAt','allowmessenger','showWebBar','VoiceQueue','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource','isEmpty','push','FromId','read','-createdAt','all','eml-format','rimraf','zip-dir','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range'];(function(_0x5b062e,_0x18210e){var _0x1ab2b3=function(_0x290cf5){while(--_0x290cf5){_0x5b062e['push'](_0x5b062e['shift']());}};_0x1ab2b3(++_0x18210e);}(_0xa8cd,0x19c));var _0xda8c=function(_0x2a8860,_0x2da926){_0x2a8860=_0x2a8860-0x0;var _0x2f47a4=_0xa8cd[_0x2a8860];return _0x2f47a4;};'use strict';var emlformat=require(_0xda8c('0x0'));var rimraf=require(_0xda8c('0x1'));var zipdir=require(_0xda8c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xda8c('0x3'));var BPromise=require(_0xda8c('0x4'));var Mustache=require('mustache');var util=require(_0xda8c('0x5'));var path=require(_0xda8c('0x6'));var sox=require(_0xda8c('0x7'));var csv=require(_0xda8c('0x8'));var ejs=require(_0xda8c('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xda8c('0xa'));var squel=require(_0xda8c('0xb'));var crypto=require(_0xda8c('0xc'));var jsforce=require(_0xda8c('0xd'));var deskjs=require(_0xda8c('0xe'));var toCsv=require('to-csv');var querystring=require(_0xda8c('0xf'));var Papa=require(_0xda8c('0x10'));var Redis=require(_0xda8c('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xda8c('0x12'));var as=require(_0xda8c('0x13'));var hardwareService=require(_0xda8c('0x14'));var logger=require(_0xda8c('0x15'))('api');var utils=require(_0xda8c('0x16'));var config=require(_0xda8c('0x17'));var licenseUtil=require(_0xda8c('0x18'));var db=require(_0xda8c('0x19'))['db'];config[_0xda8c('0x1a')]=_['defaults'](config['redis'],{'host':_0xda8c('0x1b'),'port':0x18eb});var socket=require(_0xda8c('0x1c'))(new Redis(config[_0xda8c('0x1a')]));require('./chatInternalMessage.socket')[_0xda8c('0x1d')](socket);function respondWithStatusCode(_0x4c1a85,_0x27bc8f){_0x27bc8f=_0x27bc8f||0xcc;return function(_0x34accc){if(_0x34accc){return _0x4c1a85[_0xda8c('0x1e')](_0x27bc8f);}return _0x4c1a85[_0xda8c('0x1f')](_0x27bc8f)[_0xda8c('0x20')]();};}function respondWithResult(_0x3834a1,_0x51d651){_0x51d651=_0x51d651||0xc8;return function(_0x4392be){if(_0x4392be){return _0x3834a1[_0xda8c('0x1f')](_0x51d651)[_0xda8c('0x21')](_0x4392be);}};}function respondWithFilteredResult(_0x1700a7,_0x48ecac){return function(_0x5565a3){if(_0x5565a3){var _0x222f7c=typeof _0x48ecac[_0xda8c('0x22')]===_0xda8c('0x23')&&typeof _0x48ecac[_0xda8c('0x24')]===_0xda8c('0x23');var _0x1302f3=_0x5565a3[_0xda8c('0x25')];var _0x3e1c41=_0x222f7c?0x0:_0x48ecac[_0xda8c('0x22')];var _0xa46fa7=_0x222f7c?_0x5565a3[_0xda8c('0x25')]:_0x48ecac['offset']+_0x48ecac[_0xda8c('0x24')];var _0xa2b57a;if(_0xa46fa7>=_0x1302f3){_0xa46fa7=_0x1302f3;_0xa2b57a=0xc8;}else{_0xa2b57a=0xce;}_0x1700a7[_0xda8c('0x1f')](_0xa2b57a);return _0x1700a7[_0xda8c('0x26')](_0xda8c('0x27'),_0x3e1c41+'-'+_0xa46fa7+'/'+_0x1302f3)[_0xda8c('0x21')](_0x5565a3);}return null;};}function patchUpdates(_0x565486){return function(_0x39c3c2){try{jsonpatch[_0xda8c('0x28')](_0x39c3c2,_0x565486,!![]);}catch(_0x52c95e){return BPromise[_0xda8c('0x29')](_0x52c95e);}return _0x39c3c2[_0xda8c('0x2a')]();};}function saveUpdates(_0x31328d,_0x34807a){return function(_0x589054){if(_0x589054){return _0x589054['update'](_0x31328d)['then'](function(_0x55b257){return _0x55b257;});}return null;};}function removeEntity(_0x1addd7,_0x27f7d2){return function(_0x49a266){if(_0x49a266){return _0x49a266[_0xda8c('0x2b')]()[_0xda8c('0x2c')](function(){_0x1addd7['status'](0xcc)[_0xda8c('0x20')]();});}};}function handleEntityNotFound(_0x261df3,_0x56cf7c){return function(_0x898970){if(!_0x898970){_0x261df3[_0xda8c('0x1e')](0x194);}return _0x898970;};}function handleError(_0x411aff,_0x30916b){_0x30916b=_0x30916b||0x1f4;return function(_0x103fd3){logger[_0xda8c('0x2d')](_0x103fd3[_0xda8c('0x2e')]);if(_0x103fd3[_0xda8c('0x2f')]){delete _0x103fd3[_0xda8c('0x2f')];}_0x411aff[_0xda8c('0x1f')](_0x30916b)[_0xda8c('0x30')](_0x103fd3);};}exports['index']=function(_0x5f5b7b,_0x2c0a18){var _0x28c737={},_0x434870={},_0x73a538={'count':0x0,'rows':[]};var _0x19ca01=_[_0xda8c('0x31')](db['ChatInternalMessage'][_0xda8c('0x32')],function(_0x56e80c){return{'name':_0x56e80c[_0xda8c('0x33')],'type':_0x56e80c[_0xda8c('0x34')][_0xda8c('0x35')]};});_0x434870[_0xda8c('0x36')]=_['map'](_0x19ca01,'name');_0x434870[_0xda8c('0x37')]=_['keys'](_0x5f5b7b[_0xda8c('0x37')]);_0x434870[_0xda8c('0x38')]=_[_0xda8c('0x39')](_0x434870[_0xda8c('0x36')],_0x434870[_0xda8c('0x37')]);_0x28c737[_0xda8c('0x3a')]=_[_0xda8c('0x39')](_0x434870[_0xda8c('0x36')],qs[_0xda8c('0x3b')](_0x5f5b7b['query'][_0xda8c('0x3b')]));_0x28c737[_0xda8c('0x3a')]=_0x28c737[_0xda8c('0x3a')][_0xda8c('0x3c')]?_0x28c737[_0xda8c('0x3a')]:_0x434870[_0xda8c('0x36')];if(!_0x5f5b7b[_0xda8c('0x37')][_0xda8c('0x3d')](_0xda8c('0x3e'))){_0x28c737[_0xda8c('0x24')]=qs[_0xda8c('0x24')](_0x5f5b7b[_0xda8c('0x37')]['limit']);_0x28c737[_0xda8c('0x22')]=qs[_0xda8c('0x22')](_0x5f5b7b[_0xda8c('0x37')]['offset']);}_0x28c737[_0xda8c('0x3f')]=qs[_0xda8c('0x40')](_0x5f5b7b[_0xda8c('0x37')][_0xda8c('0x40')]);_0x28c737[_0xda8c('0x41')]=qs[_0xda8c('0x38')](_['pick'](_0x5f5b7b[_0xda8c('0x37')],_0x434870['filters']),_0x19ca01);if(_0x5f5b7b[_0xda8c('0x37')][_0xda8c('0x42')]){_0x28c737['where']=_[_0xda8c('0x43')](_0x28c737[_0xda8c('0x41')],{'$or':_[_0xda8c('0x31')](_0x19ca01,function(_0x5db995){if(_0x5db995['type']!=='VIRTUAL'){var _0xdf37a6={};_0xdf37a6[_0x5db995[_0xda8c('0x2f')]]={'$like':'%'+_0x5f5b7b[_0xda8c('0x37')][_0xda8c('0x42')]+'%'};return _0xdf37a6;}})});}_0x28c737=_['merge']({},_0x28c737,_0x5f5b7b['options']);var _0x2d50f6={'where':_0x28c737[_0xda8c('0x41')]};return db[_0xda8c('0x44')][_0xda8c('0x25')](_0x2d50f6)[_0xda8c('0x2c')](function(_0x3ad2f7){_0x73a538[_0xda8c('0x25')]=_0x3ad2f7;if(_0x5f5b7b[_0xda8c('0x37')][_0xda8c('0x45')]){_0x28c737[_0xda8c('0x46')]=[{'all':!![]}];}return db[_0xda8c('0x44')][_0xda8c('0x47')](_0x28c737);})[_0xda8c('0x2c')](function(_0x334cdc){_0x73a538[_0xda8c('0x48')]=_0x334cdc;return _0x73a538;})['then'](respondWithFilteredResult(_0x2c0a18,_0x28c737))['catch'](handleError(_0x2c0a18,null));};exports[_0xda8c('0x49')]=function(_0x2829d9,_0x8a4f2a){var _0x4c8f45={'raw':!![],'where':{'id':_0x2829d9[_0xda8c('0x4a')]['id']}},_0xea6f65={};_0xea6f65[_0xda8c('0x36')]=_[_0xda8c('0x4b')](db[_0xda8c('0x44')][_0xda8c('0x32')]);_0xea6f65[_0xda8c('0x37')]=_[_0xda8c('0x4b')](_0x2829d9['query']);_0xea6f65[_0xda8c('0x38')]=_[_0xda8c('0x39')](_0xea6f65[_0xda8c('0x36')],_0xea6f65['query']);_0x4c8f45[_0xda8c('0x3a')]=_[_0xda8c('0x39')](_0xea6f65['model'],qs['fields'](_0x2829d9[_0xda8c('0x37')][_0xda8c('0x3b')]));_0x4c8f45[_0xda8c('0x3a')]=_0x4c8f45[_0xda8c('0x3a')]['length']?_0x4c8f45[_0xda8c('0x3a')]:_0xea6f65[_0xda8c('0x36')];if(_0x2829d9['query'][_0xda8c('0x45')]){_0x4c8f45[_0xda8c('0x46')]=[{'all':!![]}];}_0x4c8f45=_['merge']({},_0x4c8f45,_0x2829d9[_0xda8c('0x4c')]);return db[_0xda8c('0x44')]['find'](_0x4c8f45)[_0xda8c('0x2c')](handleEntityNotFound(_0x8a4f2a,null))[_0xda8c('0x2c')](respondWithResult(_0x8a4f2a,null))[_0xda8c('0x4d')](handleError(_0x8a4f2a,null));};exports['create']=function(_0x3bda0c,_0x2e6edd){return db[_0xda8c('0x44')]['create'](_0x3bda0c[_0xda8c('0x4e')],{})[_0xda8c('0x2c')](respondWithResult(_0x2e6edd,0xc9))[_0xda8c('0x4d')](handleError(_0x2e6edd,null));};exports[_0xda8c('0x4f')]=function(_0x126c95,_0x1778dc){if(_0x126c95['body']['id']){delete _0x126c95[_0xda8c('0x4e')]['id'];}return db['ChatInternalMessage']['find']({'where':{'id':_0x126c95[_0xda8c('0x4a')]['id']}})[_0xda8c('0x2c')](handleEntityNotFound(_0x1778dc,null))[_0xda8c('0x2c')](saveUpdates(_0x126c95[_0xda8c('0x4e')],null))['then'](respondWithResult(_0x1778dc,null))[_0xda8c('0x4d')](handleError(_0x1778dc,null));};exports[_0xda8c('0x2b')]=function(_0x10de26,_0x36cb3a){return db[_0xda8c('0x44')][_0xda8c('0x50')]({'where':{'id':_0x10de26['params']['id']}})[_0xda8c('0x2c')](handleEntityNotFound(_0x36cb3a,null))[_0xda8c('0x2c')](removeEntity(_0x36cb3a,null))[_0xda8c('0x4d')](handleError(_0x36cb3a,null));};exports[_0xda8c('0x51')]=function(_0x567c47,_0x15555c){return db[_0xda8c('0x44')][_0xda8c('0x51')]()[_0xda8c('0x2c')](respondWithResult(_0x15555c,null))[_0xda8c('0x4d')](handleError(_0x15555c,null));};function wrapUser(_0x3c9834){return function(_0x182b38){var _0x57076c=_0x3c9834[_0xda8c('0x52')]({'plain':!![]});_0x57076c[_0xda8c('0x53')]=[];if(_0x182b38){_0x57076c[_0xda8c('0x54')]=_0x182b38[_0xda8c('0x55')];_0x57076c[_0xda8c('0x56')]=_0x182b38;}else{_0x57076c[_0xda8c('0x54')]=moment(0x0)['format'](_0xda8c('0x57'));_0x57076c['lastMessage']={};}return _0x57076c;};}exports[_0xda8c('0x58')]=function(_0x4511cf,_0x3197b3,_0x26d822){var _0x546a9d=[];return db[_0xda8c('0x59')]['findAll']({'where':{'role':[_0xda8c('0x5a'),_0xda8c('0x5b'),_0xda8c('0x5c')]},'attributes':['id',_0xda8c('0x5d'),_0xda8c('0x2f'),_0xda8c('0x5e'),_0xda8c('0x5f'),'internal',_0xda8c('0x60'),_0xda8c('0x61'),_0xda8c('0x62'),_0xda8c('0x63')],'order':qs[_0xda8c('0x40')]('-online'),'include':[{'model':db[_0xda8c('0x64')],'as':'VoiceQueues','attributes':['id',_0xda8c('0x2f'),_0xda8c('0x34')],'through':{'attributes':[]}}]})[_0xda8c('0x2c')](function(_0x5def58){if(_0x5def58){var _0x45e6af=_0x4511cf[_0xda8c('0x5c')][_0xda8c('0x52')]({'plain':!![]});if(!_0x45e6af)throw new Error(_0xda8c('0x65'));if(_0x45e6af[_0xda8c('0x5e')]===_0xda8c('0x5c')){return db[_0xda8c('0x66')]['find']({'where':{'name':_0xda8c('0x67'),'userProfileId':_0x45e6af[_0xda8c('0x68')]},'raw':!![]})[_0xda8c('0x2c')](function(_0x29cb36){if(_0x29cb36){if(_0x29cb36[_0xda8c('0x69')]===0x0){return db[_0xda8c('0x6a')]['findAll']({'where':{'sectionId':_0x29cb36['id']},'raw':!![]})['then'](function(_0x8b9283){var _0x45d42d=[];if(_[_0xda8c('0x6b')](_0x8b9283)){_0x45d42d=_[_0xda8c('0x42')](_0x5def58,function(_0x2f9847){if(_0x2f9847['role']!==_0xda8c('0x5a')){return _0x2f9847;}});return _0x45d42d;}else{for(var _0x55eb5b=0x0;_0x55eb5b<_0x5def58[_0xda8c('0x3c')];_0x55eb5b++){var _0x234ba2=_0x5def58[_0x55eb5b];if(_0x234ba2['role']===_0xda8c('0x5a')){var _0x1e4a2a=_['find'](_0x8b9283,function(_0xfcb99c){return _0xfcb99c['resourceId']===_0x234ba2['id'];});if(_0x1e4a2a)_0x45d42d[_0xda8c('0x6c')](_0x234ba2);}else{_0x45d42d[_0xda8c('0x6c')](_0x234ba2);}}return _0x45d42d;}});}else{return _0x5def58;}}else{var _0x192a8=_[_0xda8c('0x42')](_0x5def58,function(_0x301f4e){if(_0x301f4e[_0xda8c('0x5e')]!==_0xda8c('0x5a')){return _0x301f4e;}});return _0x192a8;}});}else{return _0x5def58;}}})[_0xda8c('0x2c')](function(_0x3c84fa){var _0x7ec189=[];if(_0x3c84fa){_0x546a9d=_0x3c84fa;for(var _0x4222f0=0x0;_0x4222f0<_0x3c84fa['length'];_0x4222f0+=0x1){_0x546a9d[_0x4222f0][_0xda8c('0x53')]=[];_0x7ec189[_0xda8c('0x6c')](db[_0xda8c('0x44')][_0xda8c('0x50')]({'where':{'FromId':[_0x4511cf['user']['id'],_0x3c84fa[_0x4222f0]['id']],'ToId':[_0x4511cf[_0xda8c('0x5c')]['id'],_0x3c84fa[_0x4222f0]['id']],'ChatGroupId':null},'attributes':['id','createdAt',_0xda8c('0x6d'),'ToId',_0xda8c('0x6e'),_0xda8c('0x4e')],'order':qs[_0xda8c('0x40')](_0xda8c('0x6f')),'limit':0x1,'offset':0x0,'raw':!![]})[_0xda8c('0x2c')](wrapUser(_0x3c84fa[_0x4222f0])));}return BPromise[_0xda8c('0x70')](_0x7ec189);}return[];})[_0xda8c('0x2c')](function(_0x2cb7a2){return{'rows':_0x2cb7a2,'count':_0x2cb7a2[_0xda8c('0x3c')]};})['then'](respondWithResult(_0x3197b3,null))[_0xda8c('0x4d')](handleError(_0x3197b3,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 6a3cde9..7268708 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 _0x6e1d=['events','../../mysqldb','ChatInternalMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0xbc8e40,_0x281072){var _0x5c5bcc=function(_0x41fa81){while(--_0x41fa81){_0xbc8e40['push'](_0xbc8e40['shift']());}};_0x5c5bcc(++_0x281072);}(_0x6e1d,0xfa));var _0xd6e1=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x6e1d[_0x1d9aa0];return _0x226868;};'use strict';var EventEmitter=require(_0xd6e1('0x0'));var ChatInternalMessage=require(_0xd6e1('0x1'))['db'][_0xd6e1('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xd6e1('0x3')](0x0);var events={'afterCreate':_0xd6e1('0x4'),'afterUpdate':_0xd6e1('0x5'),'afterDestroy':_0xd6e1('0x6')};function emitEvent(_0x313df4){return function(_0x51f6fd,_0x362040,_0x13d61e){ChatInternalMessageEvents[_0xd6e1('0x7')](_0x313df4+':'+_0x51f6fd['id'],_0x51f6fd);ChatInternalMessageEvents['emit'](_0x313df4,_0x51f6fd);_0x13d61e(null);};}for(var e in events){if(events[_0xd6e1('0x8')](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module[_0xd6e1('0x9')]=ChatInternalMessageEvents; \ No newline at end of file +var _0x0b7f=['update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','setMaxListeners'];(function(_0x38f6aa,_0x32503d){var _0xaa2345=function(_0x446e06){while(--_0x446e06){_0x38f6aa['push'](_0x38f6aa['shift']());}};_0xaa2345(++_0x32503d);}(_0x0b7f,0x115));var _0xf0b7=function(_0x787d44,_0x36fea9){_0x787d44=_0x787d44-0x0;var _0x1c1430=_0x0b7f[_0x787d44];return _0x1c1430;};'use strict';var EventEmitter=require(_0xf0b7('0x0'));var ChatInternalMessage=require(_0xf0b7('0x1'))['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xf0b7('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xf0b7('0x3'),'afterDestroy':_0xf0b7('0x4')};function emitEvent(_0x20e3e8){return function(_0x4cd257,_0x5c4ce8,_0x28d608){ChatInternalMessageEvents[_0xf0b7('0x5')](_0x20e3e8+':'+_0x4cd257['id'],_0x4cd257);ChatInternalMessageEvents[_0xf0b7('0x5')](_0x20e3e8,_0x4cd257);_0x28d608(null);};}for(var e in events){if(events[_0xf0b7('0x6')](e)){var event=events[e];ChatInternalMessage[_0xf0b7('0x7')](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 2430ea9..d9f9e28 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 _0xf8b2=['./chatInternalMessage.attributes','exports','define','ChatInternalMessage','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x56d35f,_0x3508d1){var _0x56b755=function(_0x54c273){while(--_0x54c273){_0x56d35f['push'](_0x56d35f['shift']());}};_0x56b755(++_0x3508d1);}(_0xf8b2,0x150));var _0x2f8b=function(_0x21a44e,_0x203f07){_0x21a44e=_0x21a44e-0x0;var _0x5f1638=_0xf8b2[_0x21a44e];return _0x5f1638;};'use strict';var _=require(_0x2f8b('0x0'));var util=require('util');var logger=require(_0x2f8b('0x1'))(_0x2f8b('0x2'));var moment=require(_0x2f8b('0x3'));var BPromise=require(_0x2f8b('0x4'));var rp=require(_0x2f8b('0x5'));var fs=require('fs');var path=require(_0x2f8b('0x6'));var rimraf=require(_0x2f8b('0x7'));var config=require(_0x2f8b('0x8'));var attributes=require(_0x2f8b('0x9'));module[_0x2f8b('0xa')]=function(_0x3094f8,_0x4bc4f4){return _0x3094f8[_0x2f8b('0xb')](_0x2f8b('0xc'),attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2f8b('0xd'),'collate':_0x2f8b('0xe')});}; \ No newline at end of file +var _0x38e4=['path','rimraf','../../config/environment','./chatInternalMessage.attributes','exports','define','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x38e4,0xa9));var _0x438e=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x38e4[_0x465a0c];return _0x1e202e;};'use strict';var _=require(_0x438e('0x0'));var util=require(_0x438e('0x1'));var logger=require(_0x438e('0x2'))(_0x438e('0x3'));var moment=require(_0x438e('0x4'));var BPromise=require(_0x438e('0x5'));var rp=require(_0x438e('0x6'));var fs=require('fs');var path=require(_0x438e('0x7'));var rimraf=require(_0x438e('0x8'));var config=require(_0x438e('0x9'));var attributes=require(_0x438e('0xa'));module[_0x438e('0xb')]=function(_0xa30574,_0x38df29){return _0xa30574[_0x438e('0xc')]('ChatInternalMessage',attributes,{'tableName':_0x438e('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x438e('0xe'),'collate':_0x438e('0xf')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 8334110..422f4a8 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 _0x7a55=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./chatInternalMessage.socket','register','request','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x22016b,_0x3ed930){var _0x3ed6f1=function(_0x1e7c48){while(--_0x1e7c48){_0x22016b['push'](_0x22016b['shift']());}};_0x3ed6f1(++_0x3ed930);}(_0x7a55,0x173));var _0x57a5=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x7a55[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x57a5('0x0'));var util=require(_0x57a5('0x1'));var moment=require('moment');var BPromise=require(_0x57a5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x57a5('0x3'));var db=require(_0x57a5('0x4'))['db'];var utils=require(_0x57a5('0x5'));var logger=require(_0x57a5('0x6'))(_0x57a5('0x7'));var config=require(_0x57a5('0x8'));var jayson=require(_0x57a5('0x9'));var client=jayson[_0x57a5('0xa')][_0x57a5('0xb')]({'port':0x232a});config[_0x57a5('0xc')]=_['defaults'](config[_0x57a5('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x57a5('0xd'))(new Redis(config[_0x57a5('0xc')]));require(_0x57a5('0xe'))[_0x57a5('0xf')](socket);function respondWithRpcPromise(_0x227632,_0x31c321,_0x2e86f1){return new BPromise(function(_0x4a14ab,_0x108c93){return client[_0x57a5('0x10')](_0x227632,_0x2e86f1)[_0x57a5('0x11')](function(_0x47f431){logger[_0x57a5('0x12')](_0x57a5('0x13'),_0x31c321,_0x57a5('0x14'));logger[_0x57a5('0x15')](_0x57a5('0x16'),_0x31c321,_0x57a5('0x14'),JSON[_0x57a5('0x17')](_0x47f431));if(_0x47f431[_0x57a5('0x18')]){if(_0x47f431[_0x57a5('0x18')][_0x57a5('0x19')]===0x1f4){logger['error'](_0x57a5('0x13'),_0x31c321,_0x47f431['error'][_0x57a5('0x1a')]);return _0x108c93(_0x47f431['error']['message']);}logger[_0x57a5('0x18')]('ChatInternalMessage,\x20%s,\x20%s',_0x31c321,_0x47f431[_0x57a5('0x18')]['message']);return _0x4a14ab(_0x47f431[_0x57a5('0x18')]['message']);}else{logger[_0x57a5('0x12')]('ChatInternalMessage,\x20%s,\x20%s',_0x31c321,_0x57a5('0x14'));_0x4a14ab(_0x47f431[_0x57a5('0x1b')]['message']);}})[_0x57a5('0x1c')](function(_0x23cfa1){logger['error'](_0x57a5('0x13'),_0x31c321,_0x23cfa1);_0x108c93(_0x23cfa1);});});} \ No newline at end of file +var _0x2908=['redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','then','info','ChatInternalMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','ChatInternalMessage,\x20%s,\x20%s','result','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','client'];(function(_0x337972,_0x1f1182){var _0x4b3f58=function(_0x254827){while(--_0x254827){_0x337972['push'](_0x337972['shift']());}};_0x4b3f58(++_0x1f1182);}(_0x2908,0x1ef));var _0x8290=function(_0x36310d,_0x5e3999){_0x36310d=_0x36310d-0x0;var _0x3d622d=_0x2908[_0x36310d];return _0x3d622d;};'use strict';var _=require(_0x8290('0x0'));var util=require(_0x8290('0x1'));var moment=require(_0x8290('0x2'));var BPromise=require(_0x8290('0x3'));var rs=require(_0x8290('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8290('0x5'));var logger=require('../../config/logger')(_0x8290('0x6'));var config=require(_0x8290('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x8290('0x8')]['http']({'port':0x232a});config[_0x8290('0x9')]=_[_0x8290('0xa')](config['redis'],{'host':_0x8290('0xb'),'port':0x18eb});var socket=require(_0x8290('0xc'))(new Redis(config[_0x8290('0x9')]));require(_0x8290('0xd'))['register'](socket);function respondWithRpcPromise(_0x21fca1,_0x46e0c9,_0x2b0c6a){return new BPromise(function(_0x46fb6b,_0x226edc){return client['request'](_0x21fca1,_0x2b0c6a)[_0x8290('0xe')](function(_0x3037b8){logger[_0x8290('0xf')]('ChatInternalMessage,\x20%s,\x20%s',_0x46e0c9,'request\x20sent');logger['debug'](_0x8290('0x10'),_0x46e0c9,_0x8290('0x11'),JSON[_0x8290('0x12')](_0x3037b8));if(_0x3037b8[_0x8290('0x13')]){if(_0x3037b8[_0x8290('0x13')][_0x8290('0x14')]===0x1f4){logger[_0x8290('0x13')]('ChatInternalMessage,\x20%s,\x20%s',_0x46e0c9,_0x3037b8[_0x8290('0x13')][_0x8290('0x15')]);return _0x226edc(_0x3037b8[_0x8290('0x13')][_0x8290('0x15')]);}logger['error'](_0x8290('0x16'),_0x46e0c9,_0x3037b8[_0x8290('0x13')][_0x8290('0x15')]);return _0x46fb6b(_0x3037b8['error'][_0x8290('0x15')]);}else{logger[_0x8290('0xf')](_0x8290('0x16'),_0x46e0c9,_0x8290('0x11'));_0x46fb6b(_0x3037b8[_0x8290('0x17')][_0x8290('0x15')]);}})['catch'](function(_0x4caf0c){logger[_0x8290('0x13')](_0x8290('0x16'),_0x46e0c9,_0x4caf0c);_0x226edc(_0x4caf0c);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 120189f..11b6f89 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 _0x0d5b=['removeListener','register','length','chatInternalMessage:','save','update'];(function(_0x24579a,_0x59612d){var _0x59dff7=function(_0x47c50f){while(--_0x47c50f){_0x24579a['push'](_0x24579a['shift']());}};_0x59dff7(++_0x59612d);}(_0x0d5b,0x1a2));var _0xb0d5=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x0d5b[_0xa464c9];return _0x3d73c4;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=[_0xb0d5('0x0'),'remove',_0xb0d5('0x1')];function createListener(_0x3bea57,_0x4d5595){return function(_0x19e1f8){_0x4d5595['emit'](_0x3bea57,_0x19e1f8);};}function removeListener(_0x400434,_0x3c7ca5){return function(){ChatInternalMessageEvents[_0xb0d5('0x2')](_0x400434,_0x3c7ca5);};}exports[_0xb0d5('0x3')]=function(_0x3acb99){for(var _0x3cfb99=0x0,_0x56ba72=events[_0xb0d5('0x4')];_0x3cfb99<_0x56ba72;_0x3cfb99++){var _0x4f85c8=events[_0x3cfb99];var _0x20b444=createListener(_0xb0d5('0x5')+_0x4f85c8,_0x3acb99);ChatInternalMessageEvents['on'](_0x4f85c8,_0x20b444);}}; \ No newline at end of file +var _0x24fc=['save','remove','emit','removeListener','register','length','chatInternalMessage:','./chatInternalMessage.events'];(function(_0x6a6b3,_0x4c48ee){var _0x13e9c9=function(_0x240d62){while(--_0x240d62){_0x6a6b3['push'](_0x6a6b3['shift']());}};_0x13e9c9(++_0x4c48ee);}(_0x24fc,0xb7));var _0xc24f=function(_0x42b9e5,_0x32d2f9){_0x42b9e5=_0x42b9e5-0x0;var _0x2f76e2=_0x24fc[_0x42b9e5];return _0x2f76e2;};'use strict';var ChatInternalMessageEvents=require(_0xc24f('0x0'));var events=[_0xc24f('0x1'),_0xc24f('0x2'),'update'];function createListener(_0x3f1e58,_0x5b1f98){return function(_0x14ed8d){_0x5b1f98[_0xc24f('0x3')](_0x3f1e58,_0x14ed8d);};}function removeListener(_0x51dd06,_0x525ab7){return function(){ChatInternalMessageEvents[_0xc24f('0x4')](_0x51dd06,_0x525ab7);};}exports[_0xc24f('0x5')]=function(_0x31738f){for(var _0x33d669=0x0,_0x59eb17=events[_0xc24f('0x6')];_0x33d669<_0x59eb17;_0x33d669++){var _0x4b0291=events[_0x33d669];var _0x623e8f=createListener(_0xc24f('0x7')+_0x4b0291,_0x31738f);ChatInternalMessageEvents['on'](_0x4b0291,_0x623e8f);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 6ef9afb..17a3edc 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 _0xed84=['connect-timeout','fs-extra','../../components/interaction/service','./chatInternalMessage.controller','get','isAuthenticated','/describe','describe','getUsers','/:id','post','put','update','delete','destroy','exports','util','path'];(function(_0x19c6a6,_0x36701d){var _0x29014=function(_0x4a61b3){while(--_0x4a61b3){_0x19c6a6['push'](_0x19c6a6['shift']());}};_0x29014(++_0x36701d);}(_0xed84,0x166));var _0x4ed8=function(_0x2ee365,_0x4340e6){_0x2ee365=_0x2ee365-0x0;var _0x4b5298=_0xed84[_0x2ee365];return _0x4b5298;};'use strict';var multer=require('multer');var util=require(_0x4ed8('0x0'));var path=require(_0x4ed8('0x1'));var timeout=require(_0x4ed8('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x4ed8('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x4ed8('0x4'));var config=require('../../config/environment');var controller=require(_0x4ed8('0x5'));router[_0x4ed8('0x6')]('/',auth[_0x4ed8('0x7')](),controller['index']);router['get'](_0x4ed8('0x8'),auth[_0x4ed8('0x7')](),controller[_0x4ed8('0x9')]);router['get']('/users',auth[_0x4ed8('0x7')](),controller[_0x4ed8('0xa')]);router[_0x4ed8('0x6')](_0x4ed8('0xb'),auth[_0x4ed8('0x7')](),controller['show']);router[_0x4ed8('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x4ed8('0xd')]('/:id',controller[_0x4ed8('0xe')]);router[_0x4ed8('0xf')](_0x4ed8('0xb'),auth[_0x4ed8('0x7')](),controller[_0x4ed8('0x10')]);module[_0x4ed8('0x11')]=router; \ No newline at end of file +var _0x9bb1=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','describe','/users','getUsers','/:id','show','post','create','update','delete'];(function(_0x122424,_0x518a79){var _0x2a1679=function(_0x4ddd83){while(--_0x4ddd83){_0x122424['push'](_0x122424['shift']());}};_0x2a1679(++_0x518a79);}(_0x9bb1,0x152));var _0x19bb=function(_0x2bd9cd,_0x2887d5){_0x2bd9cd=_0x2bd9cd-0x0;var _0x23453b=_0x9bb1[_0x2bd9cd];return _0x23453b;};'use strict';var multer=require(_0x19bb('0x0'));var util=require(_0x19bb('0x1'));var path=require(_0x19bb('0x2'));var timeout=require(_0x19bb('0x3'));var express=require(_0x19bb('0x4'));var router=express[_0x19bb('0x5')]();var fs_extra=require(_0x19bb('0x6'));var auth=require(_0x19bb('0x7'));var interaction=require(_0x19bb('0x8'));var config=require(_0x19bb('0x9'));var controller=require(_0x19bb('0xa'));router[_0x19bb('0xb')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/describe',auth[_0x19bb('0xc')](),controller[_0x19bb('0xd')]);router[_0x19bb('0xb')](_0x19bb('0xe'),auth[_0x19bb('0xc')](),controller[_0x19bb('0xf')]);router[_0x19bb('0xb')](_0x19bb('0x10'),auth[_0x19bb('0xc')](),controller[_0x19bb('0x11')]);router[_0x19bb('0x12')]('/',auth[_0x19bb('0xc')](),controller[_0x19bb('0x13')]);router['put'](_0x19bb('0x10'),controller[_0x19bb('0x14')]);router[_0x19bb('0x15')](_0x19bb('0x10'),auth[_0x19bb('0xc')](),controller[_0x19bb('0x16')]);module[_0x19bb('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 f02e840..d2f26d5 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 _0x81a5=['sequelize','exports','TEXT','medium','BOOLEAN','out'];(function(_0x92c450,_0x41f1e3){var _0x2a9599=function(_0x4f27df){while(--_0x4f27df){_0x92c450['push'](_0x92c450['shift']());}};_0x2a9599(++_0x41f1e3);}(_0x81a5,0x1c8));var _0x581a=function(_0x191fa4,_0x59286d){_0x191fa4=_0x191fa4-0x0;var _0x4b7dac=_0x81a5[_0x191fa4];return _0x4b7dac;};'use strict';var Sequelize=require(_0x581a('0x0'));module[_0x581a('0x1')]={'body':{'type':Sequelize[_0x581a('0x2')](_0x581a('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x581a('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0x581a('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x581a('0x5')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x7633=['DATE','STRING','sequelize','exports','TEXT','medium','BOOLEAN','ENUM','out'];(function(_0x5da535,_0x9c65ae){var _0x54c87e=function(_0x876261){while(--_0x876261){_0x5da535['push'](_0x5da535['shift']());}};_0x54c87e(++_0x9c65ae);}(_0x7633,0x1c4));var _0x3763=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x7633[_0x160c73];return _0xd9302;};'use strict';var Sequelize=require(_0x3763('0x0'));module[_0x3763('0x1')]={'body':{'type':Sequelize[_0x3763('0x2')](_0x3763('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x3763('0x4')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x3763('0x5')]('in',_0x3763('0x6')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x3763('0x7')]},'providerName':{'type':Sequelize[_0x3763('0x8')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index f5bfb3d..44efc57 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 _0x3e4f=['User','agent','email','interface','format','SIP/%s','channel','EventManager','rejectmessage','util','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','chat-interactions','request','then','debug','request\x20sent','stringify','error','ChatMessage,\x20%s,\x20%s','message','result','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','end','sendStatus','name','index','map','ChatMessage','rawAttributes','fieldName','key','model','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','sort','pick','filter','where','type','options','includeAll','include','findAll','catch','show','params','keys','length','merge','create','body','find','describe','accept','chat','acceptMessage','reject','UserId','user','ChatInteraction','ChatInteractionId','get','info','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','contact'];(function(_0x45e98e,_0x169b60){var _0x374dba=function(_0x597612){while(--_0x597612){_0x45e98e['push'](_0x45e98e['shift']());}};_0x374dba(++_0x169b60);}(_0x3e4f,0xd7));var _0xf3e4=function(_0x279275,_0x5eb9a7){_0x279275=_0x279275-0x0;var _0x651a96=_0x3e4f[_0x279275];return _0x651a96;};'use strict';var util=require(_0xf3e4('0x0'));var _=require(_0xf3e4('0x1'));var Redis=require(_0xf3e4('0x2'));var interactionService=require(_0xf3e4('0x3'));var qs=require(_0xf3e4('0x4'));var logger=require(_0xf3e4('0x5'))(_0xf3e4('0x6'));var config=require('../../config/environment');var db=require(_0xf3e4('0x7'))['db'];config[_0xf3e4('0x8')]=_[_0xf3e4('0x9')](config[_0xf3e4('0x8')],{'host':_0xf3e4('0xa'),'port':0x18eb});var socket=require(_0xf3e4('0xb'))(new Redis(config[_0xf3e4('0x8')]));require('./chatMessage.socket')[_0xf3e4('0xc')](socket);var jayson=require(_0xf3e4('0xd'));var client=jayson[_0xf3e4('0xe')][_0xf3e4('0xf')]({'port':0x232c});var client9002=jayson[_0xf3e4('0xe')][_0xf3e4('0xf')]({'port':0x232a});var interaction_log=require(_0xf3e4('0x5'))(_0xf3e4('0x10'));function respondWithRpcPromise(_0x16733d,_0x370623,_0x41978b,_0x2d1195){return new Promise(function(_0x2d991f,_0x5a6780){var _0x368d98=_0x2d1195||client;return _0x368d98[_0xf3e4('0x11')](_0x16733d,_0x41978b)[_0xf3e4('0x12')](function(_0xf6b7ac){logger['info']('ChatMessage,\x20%s,\x20%s',_0x370623,'request\x20sent');logger[_0xf3e4('0x13')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x370623,_0xf3e4('0x14'),JSON[_0xf3e4('0x15')](_0xf6b7ac));if(_0xf6b7ac[_0xf3e4('0x16')]){if(_0xf6b7ac['error']['code']===0x1f4){logger[_0xf3e4('0x16')](_0xf3e4('0x17'),_0x370623,_0xf6b7ac[_0xf3e4('0x16')]['message']);return _0x5a6780(_0xf6b7ac[_0xf3e4('0x16')]['message']);}logger[_0xf3e4('0x16')](_0xf3e4('0x17'),_0x370623,_0xf6b7ac['error'][_0xf3e4('0x18')]);return _0x2d991f(_0xf6b7ac['error'][_0xf3e4('0x18')]);}else{logger['info'](_0xf3e4('0x17'),_0x370623,_0xf3e4('0x14'));_0x2d991f(_0xf6b7ac[_0xf3e4('0x19')][_0xf3e4('0x18')]);}})['catch'](function(_0x3f14ca){logger['error'](_0xf3e4('0x17'),_0x370623,_0x3f14ca);_0x5a6780(_0x3f14ca);});});}function respondWithResult(_0x3032bc,_0x42264d){_0x42264d=_0x42264d||0xc8;return function(_0x23e034){if(_0x23e034){return _0x3032bc[_0xf3e4('0x1a')](_0x42264d)[_0xf3e4('0x1b')](_0x23e034);}};}function respondWithFilteredResult(_0x3f4a75,_0x98aeaf){return function(_0x4218eb){if(_0x4218eb){var _0x8486d1=typeof _0x98aeaf[_0xf3e4('0x1c')]===_0xf3e4('0x1d')&&typeof _0x98aeaf[_0xf3e4('0x1e')]===_0xf3e4('0x1d');var _0x3fcc9d=_0x4218eb[_0xf3e4('0x1f')];var _0x5f51c3=_0x8486d1?0x0:_0x98aeaf['offset'];var _0x377741=_0x8486d1?_0x4218eb[_0xf3e4('0x1f')]:_0x98aeaf[_0xf3e4('0x1c')]+_0x98aeaf[_0xf3e4('0x1e')];var _0x260ec3;if(_0x377741>=_0x3fcc9d){_0x377741=_0x3fcc9d;_0x260ec3=0xc8;}else{_0x260ec3=0xce;}_0x3f4a75[_0xf3e4('0x1a')](_0x260ec3);return _0x3f4a75[_0xf3e4('0x20')](_0xf3e4('0x21'),_0x5f51c3+'-'+_0x377741+'/'+_0x3fcc9d)[_0xf3e4('0x1b')](_0x4218eb);}return null;};}function saveUpdates(_0x4a2dee){return function(_0x459d62){if(_0x459d62){return _0x459d62[_0xf3e4('0x22')](_0x4a2dee)['then'](function(_0x7c302c){return _0x7c302c;});}return null;};}function removeEntity(_0x26cebe){return function(_0x4a4398){if(_0x4a4398){return _0x4a4398[_0xf3e4('0x23')]()['then'](function(){_0x26cebe[_0xf3e4('0x1a')](0xcc)[_0xf3e4('0x24')]();});}};}function handleEntityNotFound(_0x263383){return function(_0x14ae5f){if(!_0x14ae5f){_0x263383[_0xf3e4('0x25')](0x194);}return _0x14ae5f;};}function handleError(_0x467320,_0x3b7c76){_0x3b7c76=_0x3b7c76||0x1f4;return function(_0x59523e){logger[_0xf3e4('0x16')](_0x59523e['stack']);if(_0x59523e[_0xf3e4('0x26')]){delete _0x59523e['name'];}_0x467320[_0xf3e4('0x1a')](_0x3b7c76)['send'](_0x59523e);};}exports[_0xf3e4('0x27')]=function(_0x5769be,_0x2b5be3){var _0x5846be={},_0x234277={},_0x2e0ca2={'count':0x0,'rows':[]};var _0x1ca858=_[_0xf3e4('0x28')](db[_0xf3e4('0x29')][_0xf3e4('0x2a')],function(_0x8cce2f){return{'name':_0x8cce2f[_0xf3e4('0x2b')],'type':_0x8cce2f['type'][_0xf3e4('0x2c')]};});_0x234277[_0xf3e4('0x2d')]=_[_0xf3e4('0x28')](_0x1ca858,_0xf3e4('0x26'));_0x234277['query']=_['keys'](_0x5769be['query']);_0x234277[_0xf3e4('0x2e')]=_[_0xf3e4('0x2f')](_0x234277['model'],_0x234277[_0xf3e4('0x30')]);_0x5846be[_0xf3e4('0x31')]=_['intersection'](_0x234277[_0xf3e4('0x2d')],qs[_0xf3e4('0x32')](_0x5769be[_0xf3e4('0x30')][_0xf3e4('0x32')]));_0x5846be[_0xf3e4('0x31')]=_0x5846be[_0xf3e4('0x31')]['length']?_0x5846be[_0xf3e4('0x31')]:_0x234277[_0xf3e4('0x2d')];if(!_0x5769be['query'][_0xf3e4('0x33')](_0xf3e4('0x34'))){_0x5846be[_0xf3e4('0x1e')]=qs[_0xf3e4('0x1e')](_0x5769be[_0xf3e4('0x30')][_0xf3e4('0x1e')]);_0x5846be['offset']=qs['offset'](_0x5769be[_0xf3e4('0x30')]['offset']);}_0x5846be['order']=qs[_0xf3e4('0x35')](_0x5769be[_0xf3e4('0x30')][_0xf3e4('0x35')]);_0x5846be['where']=qs['filters'](_[_0xf3e4('0x36')](_0x5769be[_0xf3e4('0x30')],_0x234277['filters']),_0x1ca858);if(_0x5769be[_0xf3e4('0x30')][_0xf3e4('0x37')]){_0x5846be[_0xf3e4('0x38')]=_['merge'](_0x5846be['where'],{'$or':_[_0xf3e4('0x28')](_0x1ca858,function(_0x28afd3){if(_0x28afd3[_0xf3e4('0x39')]!=='VIRTUAL'){var _0x1facbf={};_0x1facbf[_0x28afd3[_0xf3e4('0x26')]]={'$like':'%'+_0x5769be['query'][_0xf3e4('0x37')]+'%'};return _0x1facbf;}})});}_0x5846be=_['merge']({},_0x5846be,_0x5769be[_0xf3e4('0x3a')]);var _0x51380c={'where':_0x5846be[_0xf3e4('0x38')]};return db['ChatMessage'][_0xf3e4('0x1f')](_0x51380c)['then'](function(_0x2a7207){_0x2e0ca2[_0xf3e4('0x1f')]=_0x2a7207;if(_0x5769be[_0xf3e4('0x30')][_0xf3e4('0x3b')]){_0x5846be[_0xf3e4('0x3c')]=[{'all':!![]}];}return db['ChatMessage'][_0xf3e4('0x3d')](_0x5846be);})[_0xf3e4('0x12')](function(_0x22c220){_0x2e0ca2['rows']=_0x22c220;return _0x2e0ca2;})[_0xf3e4('0x12')](respondWithFilteredResult(_0x2b5be3,_0x5846be))[_0xf3e4('0x3e')](handleError(_0x2b5be3,null));};exports[_0xf3e4('0x3f')]=function(_0x2415d0,_0x27e137){var _0x3d35b4={'raw':!![],'where':{'id':_0x2415d0[_0xf3e4('0x40')]['id']}},_0x2cd4fc={};_0x2cd4fc[_0xf3e4('0x2d')]=_[_0xf3e4('0x41')](db[_0xf3e4('0x29')]['rawAttributes']);_0x2cd4fc['query']=_['keys'](_0x2415d0['query']);_0x2cd4fc['filters']=_[_0xf3e4('0x2f')](_0x2cd4fc[_0xf3e4('0x2d')],_0x2cd4fc['query']);_0x3d35b4['attributes']=_[_0xf3e4('0x2f')](_0x2cd4fc[_0xf3e4('0x2d')],qs['fields'](_0x2415d0[_0xf3e4('0x30')]['fields']));_0x3d35b4[_0xf3e4('0x31')]=_0x3d35b4[_0xf3e4('0x31')][_0xf3e4('0x42')]?_0x3d35b4[_0xf3e4('0x31')]:_0x2cd4fc[_0xf3e4('0x2d')];if(_0x2415d0[_0xf3e4('0x30')][_0xf3e4('0x3b')]){_0x3d35b4[_0xf3e4('0x3c')]=[{'all':!![]}];}_0x3d35b4=_[_0xf3e4('0x43')]({},_0x3d35b4,_0x2415d0[_0xf3e4('0x3a')]);return db['ChatMessage']['find'](_0x3d35b4)[_0xf3e4('0x12')](handleEntityNotFound(_0x27e137,null))[_0xf3e4('0x12')](respondWithResult(_0x27e137,null))[_0xf3e4('0x3e')](handleError(_0x27e137,null));};exports[_0xf3e4('0x44')]=function(_0x5466f3,_0x3cc5f8){return db['ChatMessage'][_0xf3e4('0x44')](_0x5466f3[_0xf3e4('0x45')],{})[_0xf3e4('0x12')](respondWithResult(_0x3cc5f8,0xc9))['catch'](handleError(_0x3cc5f8,null));};exports[_0xf3e4('0x22')]=function(_0x3646b5,_0x19b53f){if(_0x3646b5[_0xf3e4('0x45')]['id']){delete _0x3646b5[_0xf3e4('0x45')]['id'];}return db[_0xf3e4('0x29')][_0xf3e4('0x46')]({'where':{'id':_0x3646b5[_0xf3e4('0x40')]['id']}})[_0xf3e4('0x12')](handleEntityNotFound(_0x19b53f,null))[_0xf3e4('0x12')](saveUpdates(_0x3646b5[_0xf3e4('0x45')],null))[_0xf3e4('0x12')](respondWithResult(_0x19b53f,null))[_0xf3e4('0x3e')](handleError(_0x19b53f,null));};exports[_0xf3e4('0x23')]=function(_0x28c2b5,_0x4cea9a){return db[_0xf3e4('0x29')][_0xf3e4('0x46')]({'where':{'id':_0x28c2b5[_0xf3e4('0x40')]['id']}})[_0xf3e4('0x12')](handleEntityNotFound(_0x4cea9a,null))[_0xf3e4('0x12')](removeEntity(_0x4cea9a,null))[_0xf3e4('0x3e')](handleError(_0x4cea9a,null));};exports[_0xf3e4('0x47')]=function(_0x13fc75,_0x3063bf){return db[_0xf3e4('0x29')][_0xf3e4('0x47')]()[_0xf3e4('0x12')](respondWithResult(_0x3063bf,null))[_0xf3e4('0x3e')](handleError(_0x3063bf,null));};exports[_0xf3e4('0x48')]=function(_0x53abbf,_0x488829){var _0x34d4dd=_0xf3e4('0x49');return interactionService[_0xf3e4('0x4a')](_0x53abbf,_0x34d4dd)[_0xf3e4('0x12')](respondWithResult(_0x488829,null))[_0xf3e4('0x3e')](handleError(_0x488829,null));};exports[_0xf3e4('0x4b')]=function(_0x413070,_0x5ed390){var _0x45cce0={'agent':{},'channel':_0xf3e4('0x49')};if(_0x413070[_0xf3e4('0x45')]['id']){delete _0x413070['body']['id'];}_0x413070['body'][_0xf3e4('0x4c')]=_0x413070['body'][_0xf3e4('0x4c')]||_0x413070[_0xf3e4('0x4d')]['id'];_0x45cce0['agent']['id']=_0x413070['body'][_0xf3e4('0x4c')];return db[_0xf3e4('0x29')]['find']({'where':{'id':_0x413070[_0xf3e4('0x40')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x5ed390,null))[_0xf3e4('0x12')](function(_0x5d7527){if(_0x5d7527){_0x45cce0['message']=_0x5d7527['get']({'plain':!![]});return db[_0xf3e4('0x4e')][_0xf3e4('0x46')]({'where':{'id':_0x5d7527[_0xf3e4('0x4f')]}});}return null;})[_0xf3e4('0x12')](handleEntityNotFound(_0x5ed390,null))[_0xf3e4('0x12')](function(_0x5400b1){if(_0x5400b1){_0x45cce0['interaction']=_0x5400b1[_0xf3e4('0x50')]({'plain':!![]});interaction_log[_0xf3e4('0x51')](_0xf3e4('0x52'),_0x413070[_0xf3e4('0x4d')]['id'],_0x413070['user']['name'],_0x413070[_0xf3e4('0x4d')][_0xf3e4('0x53')],_0x45cce0[_0xf3e4('0x54')]['id'],_0x413070['body']?JSON[_0xf3e4('0x15')](_0x413070[_0xf3e4('0x45')]):_0xf3e4('0x55'));return respondWithRpcPromise(_0xf3e4('0x56'),_0xf3e4('0x57'),_0x45cce0);}return null;})[_0xf3e4('0x12')](function(_0x3be4c1){var _0x2ecbef=_0xf3e4('0x58')+_0x3be4c1['message'][_0xf3e4('0x59')];return db[_0xf3e4('0x5a')][_0xf3e4('0x30')](_0x2ecbef,{'type':db['Sequelize'][_0xf3e4('0x5b')][_0xf3e4('0x5c')],'raw':!![]})[_0xf3e4('0x12')](function(_0x1dbe47){return _0x1dbe47;});})[_0xf3e4('0x12')](function(_0x5b1cdb){if(_0x5b1cdb){_0x45cce0[_0xf3e4('0x18')][_0xf3e4('0x5d')]=_0x5b1cdb[0x0];if(!_0x413070[_0xf3e4('0x45')][_0xf3e4('0x4c')])return;return db[_0xf3e4('0x5e')][_0xf3e4('0x46')]({'where':{'id':_0x413070[_0xf3e4('0x45')][_0xf3e4('0x4c')],'role':_0xf3e4('0x5f')},'attributes':['id',_0xf3e4('0x26'),'fullname',_0xf3e4('0x60'),'internal'],'raw':!![]});}return null;})[_0xf3e4('0x12')](function(_0x21c5b1){if(!_0x21c5b1)return null;_0x45cce0[_0xf3e4('0x18')][_0xf3e4('0x5f')]=_0x21c5b1;return _0x45cce0;})[_0xf3e4('0x12')](function(_0xc42701){if(_0xc42701){_0xc42701[_0xf3e4('0x18')][_0xf3e4('0x61')]=util[_0xf3e4('0x62')](_0xf3e4('0x63'),_0x413070[_0xf3e4('0x4d')][_0xf3e4('0x26')]);_0xc42701['message'][_0xf3e4('0x64')]=_0x45cce0[_0xf3e4('0x64')];_0xc42701[_0xf3e4('0x18')]['motionChannel']=_0x45cce0[_0xf3e4('0x64')];_0xc42701[_0xf3e4('0x18')]['event']=_0xf3e4('0x4b');respondWithRpcPromise(_0xf3e4('0x65'),'EventManager',{'event':_0xf3e4('0x66'),'message':_[_0xf3e4('0x43')](_0x45cce0[_0xf3e4('0x18')],JSON['parse'](_0x45cce0[_0xf3e4('0x54')]['formData']))},client9002);return _0x45cce0;}return null;})['then'](respondWithResult(_0x5ed390,null))[_0xf3e4('0x3e')](handleError(_0x5ed390,null));}; \ No newline at end of file +var _0xeae9=['accept','chat','acceptMessage','reject','UserId','user','agent','get','ChatInteraction','ChatInteractionId','role','interaction','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','interface','SIP/%s','channel','motionChannel','event','EventManager','parse','formData','util','lodash','../../components/interaction/service','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','http','chat-interactions','request','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','status','json','offset','undefined','limit','count','set','update','then','destroy','end','sendStatus','name','send','index','rawAttributes','type','model','map','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','merge','VIRTUAL','options','where','ChatMessage','includeAll','include','findAll','rows','show','params','fields','find','create','body','describe'];(function(_0x370254,_0x4acf36){var _0xa00514=function(_0xc8da84){while(--_0xc8da84){_0x370254['push'](_0x370254['shift']());}};_0xa00514(++_0x4acf36);}(_0xeae9,0x8b));var _0x9eae=function(_0x95c465,_0x1f7f82){_0x95c465=_0x95c465-0x0;var _0x386c2d=_0xeae9[_0x95c465];return _0x386c2d;};'use strict';var util=require(_0x9eae('0x0'));var _=require(_0x9eae('0x1'));var Redis=require('ioredis');var interactionService=require(_0x9eae('0x2'));var qs=require('../../components/parsers/qs');var logger=require(_0x9eae('0x3'))(_0x9eae('0x4'));var config=require(_0x9eae('0x5'));var db=require(_0x9eae('0x6'))['db'];config[_0x9eae('0x7')]=_[_0x9eae('0x8')](config[_0x9eae('0x7')],{'host':_0x9eae('0x9'),'port':0x18eb});var socket=require(_0x9eae('0xa'))(new Redis(config[_0x9eae('0x7')]));require(_0x9eae('0xb'))[_0x9eae('0xc')](socket);var jayson=require(_0x9eae('0xd'));var client=jayson[_0x9eae('0xe')][_0x9eae('0xf')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});var interaction_log=require(_0x9eae('0x3'))(_0x9eae('0x10'));function respondWithRpcPromise(_0x274dd2,_0x5dde5a,_0x673249,_0x23e67c){return new Promise(function(_0x22fbd5,_0x219c10){var _0x390fc6=_0x23e67c||client;return _0x390fc6[_0x9eae('0x11')](_0x274dd2,_0x673249)['then'](function(_0x5f1392){logger[_0x9eae('0x12')](_0x9eae('0x13'),_0x5dde5a,_0x9eae('0x14'));logger[_0x9eae('0x15')](_0x9eae('0x16'),_0x5dde5a,'request\x20sent',JSON[_0x9eae('0x17')](_0x5f1392));if(_0x5f1392['error']){if(_0x5f1392['error'][_0x9eae('0x18')]===0x1f4){logger[_0x9eae('0x19')]('ChatMessage,\x20%s,\x20%s',_0x5dde5a,_0x5f1392[_0x9eae('0x19')][_0x9eae('0x1a')]);return _0x219c10(_0x5f1392[_0x9eae('0x19')]['message']);}logger['error'](_0x9eae('0x13'),_0x5dde5a,_0x5f1392[_0x9eae('0x19')]['message']);return _0x22fbd5(_0x5f1392[_0x9eae('0x19')]['message']);}else{logger['info'](_0x9eae('0x13'),_0x5dde5a,_0x9eae('0x14'));_0x22fbd5(_0x5f1392[_0x9eae('0x1b')][_0x9eae('0x1a')]);}})[_0x9eae('0x1c')](function(_0x5005e9){logger[_0x9eae('0x19')](_0x9eae('0x13'),_0x5dde5a,_0x5005e9);_0x219c10(_0x5005e9);});});}function respondWithResult(_0x281cdc,_0x372378){_0x372378=_0x372378||0xc8;return function(_0x1e959e){if(_0x1e959e){return _0x281cdc[_0x9eae('0x1d')](_0x372378)[_0x9eae('0x1e')](_0x1e959e);}};}function respondWithFilteredResult(_0x2ee489,_0x42a002){return function(_0x16c921){if(_0x16c921){var _0x3ce277=typeof _0x42a002[_0x9eae('0x1f')]===_0x9eae('0x20')&&typeof _0x42a002[_0x9eae('0x21')]==='undefined';var _0x13ee00=_0x16c921[_0x9eae('0x22')];var _0x4cf256=_0x3ce277?0x0:_0x42a002[_0x9eae('0x1f')];var _0x408223=_0x3ce277?_0x16c921['count']:_0x42a002[_0x9eae('0x1f')]+_0x42a002[_0x9eae('0x21')];var _0x257068;if(_0x408223>=_0x13ee00){_0x408223=_0x13ee00;_0x257068=0xc8;}else{_0x257068=0xce;}_0x2ee489[_0x9eae('0x1d')](_0x257068);return _0x2ee489[_0x9eae('0x23')]('Content-Range',_0x4cf256+'-'+_0x408223+'/'+_0x13ee00)[_0x9eae('0x1e')](_0x16c921);}return null;};}function saveUpdates(_0x5122ae){return function(_0x57f2ca){if(_0x57f2ca){return _0x57f2ca[_0x9eae('0x24')](_0x5122ae)[_0x9eae('0x25')](function(_0x2eea02){return _0x2eea02;});}return null;};}function removeEntity(_0x5b333e){return function(_0x15afd1){if(_0x15afd1){return _0x15afd1[_0x9eae('0x26')]()[_0x9eae('0x25')](function(){_0x5b333e[_0x9eae('0x1d')](0xcc)[_0x9eae('0x27')]();});}};}function handleEntityNotFound(_0x5c942d){return function(_0x3803a2){if(!_0x3803a2){_0x5c942d[_0x9eae('0x28')](0x194);}return _0x3803a2;};}function handleError(_0x2f6eda,_0x5f073b){_0x5f073b=_0x5f073b||0x1f4;return function(_0x5c0932){logger[_0x9eae('0x19')](_0x5c0932['stack']);if(_0x5c0932[_0x9eae('0x29')]){delete _0x5c0932[_0x9eae('0x29')];}_0x2f6eda[_0x9eae('0x1d')](_0x5f073b)[_0x9eae('0x2a')](_0x5c0932);};}exports[_0x9eae('0x2b')]=function(_0x1349b3,_0x514e1d){var _0x30dd56={},_0x261ff8={},_0x1d9450={'count':0x0,'rows':[]};var _0x5a4937=_['map'](db['ChatMessage'][_0x9eae('0x2c')],function(_0x3146f1){return{'name':_0x3146f1['fieldName'],'type':_0x3146f1[_0x9eae('0x2d')]['key']};});_0x261ff8[_0x9eae('0x2e')]=_[_0x9eae('0x2f')](_0x5a4937,_0x9eae('0x29'));_0x261ff8['query']=_[_0x9eae('0x30')](_0x1349b3[_0x9eae('0x31')]);_0x261ff8[_0x9eae('0x32')]=_[_0x9eae('0x33')](_0x261ff8[_0x9eae('0x2e')],_0x261ff8[_0x9eae('0x31')]);_0x30dd56[_0x9eae('0x34')]=_['intersection'](_0x261ff8[_0x9eae('0x2e')],qs['fields'](_0x1349b3['query']['fields']));_0x30dd56[_0x9eae('0x34')]=_0x30dd56[_0x9eae('0x34')][_0x9eae('0x35')]?_0x30dd56[_0x9eae('0x34')]:_0x261ff8[_0x9eae('0x2e')];if(!_0x1349b3[_0x9eae('0x31')][_0x9eae('0x36')](_0x9eae('0x37'))){_0x30dd56['limit']=qs['limit'](_0x1349b3[_0x9eae('0x31')][_0x9eae('0x21')]);_0x30dd56[_0x9eae('0x1f')]=qs[_0x9eae('0x1f')](_0x1349b3[_0x9eae('0x31')][_0x9eae('0x1f')]);}_0x30dd56['order']=qs['sort'](_0x1349b3[_0x9eae('0x31')][_0x9eae('0x38')]);_0x30dd56['where']=qs[_0x9eae('0x32')](_[_0x9eae('0x39')](_0x1349b3['query'],_0x261ff8[_0x9eae('0x32')]),_0x5a4937);if(_0x1349b3[_0x9eae('0x31')][_0x9eae('0x3a')]){_0x30dd56['where']=_[_0x9eae('0x3b')](_0x30dd56['where'],{'$or':_[_0x9eae('0x2f')](_0x5a4937,function(_0x31273c){if(_0x31273c['type']!==_0x9eae('0x3c')){var _0x338dd0={};_0x338dd0[_0x31273c[_0x9eae('0x29')]]={'$like':'%'+_0x1349b3['query']['filter']+'%'};return _0x338dd0;}})});}_0x30dd56=_[_0x9eae('0x3b')]({},_0x30dd56,_0x1349b3[_0x9eae('0x3d')]);var _0x507451={'where':_0x30dd56[_0x9eae('0x3e')]};return db[_0x9eae('0x3f')][_0x9eae('0x22')](_0x507451)[_0x9eae('0x25')](function(_0xccaaca){_0x1d9450[_0x9eae('0x22')]=_0xccaaca;if(_0x1349b3['query'][_0x9eae('0x40')]){_0x30dd56[_0x9eae('0x41')]=[{'all':!![]}];}return db[_0x9eae('0x3f')][_0x9eae('0x42')](_0x30dd56);})[_0x9eae('0x25')](function(_0x342545){_0x1d9450[_0x9eae('0x43')]=_0x342545;return _0x1d9450;})[_0x9eae('0x25')](respondWithFilteredResult(_0x514e1d,_0x30dd56))[_0x9eae('0x1c')](handleError(_0x514e1d,null));};exports[_0x9eae('0x44')]=function(_0xca54fa,_0x46a2cb){var _0xedd896={'raw':!![],'where':{'id':_0xca54fa[_0x9eae('0x45')]['id']}},_0x346cc6={};_0x346cc6[_0x9eae('0x2e')]=_[_0x9eae('0x30')](db[_0x9eae('0x3f')][_0x9eae('0x2c')]);_0x346cc6[_0x9eae('0x31')]=_[_0x9eae('0x30')](_0xca54fa[_0x9eae('0x31')]);_0x346cc6[_0x9eae('0x32')]=_['intersection'](_0x346cc6['model'],_0x346cc6[_0x9eae('0x31')]);_0xedd896[_0x9eae('0x34')]=_[_0x9eae('0x33')](_0x346cc6[_0x9eae('0x2e')],qs[_0x9eae('0x46')](_0xca54fa[_0x9eae('0x31')][_0x9eae('0x46')]));_0xedd896[_0x9eae('0x34')]=_0xedd896[_0x9eae('0x34')]['length']?_0xedd896[_0x9eae('0x34')]:_0x346cc6[_0x9eae('0x2e')];if(_0xca54fa[_0x9eae('0x31')][_0x9eae('0x40')]){_0xedd896[_0x9eae('0x41')]=[{'all':!![]}];}_0xedd896=_[_0x9eae('0x3b')]({},_0xedd896,_0xca54fa[_0x9eae('0x3d')]);return db['ChatMessage'][_0x9eae('0x47')](_0xedd896)[_0x9eae('0x25')](handleEntityNotFound(_0x46a2cb,null))['then'](respondWithResult(_0x46a2cb,null))[_0x9eae('0x1c')](handleError(_0x46a2cb,null));};exports['create']=function(_0x1d2237,_0x1f1ba0){return db[_0x9eae('0x3f')][_0x9eae('0x48')](_0x1d2237[_0x9eae('0x49')],{})[_0x9eae('0x25')](respondWithResult(_0x1f1ba0,0xc9))[_0x9eae('0x1c')](handleError(_0x1f1ba0,null));};exports[_0x9eae('0x24')]=function(_0x2ea0c4,_0x3f585f){if(_0x2ea0c4[_0x9eae('0x49')]['id']){delete _0x2ea0c4[_0x9eae('0x49')]['id'];}return db[_0x9eae('0x3f')][_0x9eae('0x47')]({'where':{'id':_0x2ea0c4[_0x9eae('0x45')]['id']}})[_0x9eae('0x25')](handleEntityNotFound(_0x3f585f,null))['then'](saveUpdates(_0x2ea0c4[_0x9eae('0x49')],null))[_0x9eae('0x25')](respondWithResult(_0x3f585f,null))[_0x9eae('0x1c')](handleError(_0x3f585f,null));};exports[_0x9eae('0x26')]=function(_0x17d9e4,_0x42c8ce){return db['ChatMessage'][_0x9eae('0x47')]({'where':{'id':_0x17d9e4['params']['id']}})[_0x9eae('0x25')](handleEntityNotFound(_0x42c8ce,null))[_0x9eae('0x25')](removeEntity(_0x42c8ce,null))[_0x9eae('0x1c')](handleError(_0x42c8ce,null));};exports[_0x9eae('0x4a')]=function(_0x3656b2,_0x4f6f5e){return db['ChatMessage'][_0x9eae('0x4a')]()[_0x9eae('0x25')](respondWithResult(_0x4f6f5e,null))[_0x9eae('0x1c')](handleError(_0x4f6f5e,null));};exports[_0x9eae('0x4b')]=function(_0x4bd2cf,_0xec3b8f){var _0x2ad351=_0x9eae('0x4c');return interactionService[_0x9eae('0x4d')](_0x4bd2cf,_0x2ad351)['then'](respondWithResult(_0xec3b8f,null))['catch'](handleError(_0xec3b8f,null));};exports[_0x9eae('0x4e')]=function(_0x14850d,_0x26916f){var _0x2fabb9={'agent':{},'channel':_0x9eae('0x4c')};if(_0x14850d[_0x9eae('0x49')]['id']){delete _0x14850d[_0x9eae('0x49')]['id'];}_0x14850d[_0x9eae('0x49')][_0x9eae('0x4f')]=_0x14850d[_0x9eae('0x49')]['UserId']||_0x14850d[_0x9eae('0x50')]['id'];_0x2fabb9[_0x9eae('0x51')]['id']=_0x14850d[_0x9eae('0x49')][_0x9eae('0x4f')];return db[_0x9eae('0x3f')]['find']({'where':{'id':_0x14850d[_0x9eae('0x45')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x26916f,null))[_0x9eae('0x25')](function(_0x4ca826){if(_0x4ca826){_0x2fabb9[_0x9eae('0x1a')]=_0x4ca826[_0x9eae('0x52')]({'plain':!![]});return db[_0x9eae('0x53')][_0x9eae('0x47')]({'where':{'id':_0x4ca826[_0x9eae('0x54')]}});}return null;})[_0x9eae('0x25')](handleEntityNotFound(_0x26916f,null))[_0x9eae('0x25')](function(_0x5d0cdd){if(_0x5d0cdd){_0x2fabb9['interaction']=_0x5d0cdd[_0x9eae('0x52')]({'plain':!![]});interaction_log['info']('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x14850d['user']['id'],_0x14850d[_0x9eae('0x50')]['name'],_0x14850d[_0x9eae('0x50')][_0x9eae('0x55')],_0x2fabb9[_0x9eae('0x56')]['id'],_0x14850d[_0x9eae('0x49')]?JSON[_0x9eae('0x17')](_0x14850d['body']):'null');return respondWithRpcPromise(_0x9eae('0x57'),_0x9eae('0x58'),_0x2fabb9);}return null;})[_0x9eae('0x25')](function(_0x1fe1c9){var _0xeff7f9=_0x9eae('0x59')+_0x1fe1c9[_0x9eae('0x1a')][_0x9eae('0x5a')];return db[_0x9eae('0x5b')][_0x9eae('0x31')](_0xeff7f9,{'type':db['Sequelize'][_0x9eae('0x5c')][_0x9eae('0x5d')],'raw':!![]})[_0x9eae('0x25')](function(_0x59b89e){return _0x59b89e;});})[_0x9eae('0x25')](function(_0x1a89e5){if(_0x1a89e5){_0x2fabb9[_0x9eae('0x1a')][_0x9eae('0x5e')]=_0x1a89e5[0x0];if(!_0x14850d['body'][_0x9eae('0x4f')])return;return db[_0x9eae('0x5f')][_0x9eae('0x47')]({'where':{'id':_0x14850d['body']['UserId'],'role':_0x9eae('0x51')},'attributes':['id','name',_0x9eae('0x60'),_0x9eae('0x61'),_0x9eae('0x62')],'raw':!![]});}return null;})['then'](function(_0x40cca8){if(!_0x40cca8)return null;_0x2fabb9[_0x9eae('0x1a')]['agent']=_0x40cca8;return _0x2fabb9;})[_0x9eae('0x25')](function(_0x5428dd){if(_0x5428dd){_0x5428dd[_0x9eae('0x1a')][_0x9eae('0x63')]=util['format'](_0x9eae('0x64'),_0x14850d[_0x9eae('0x50')][_0x9eae('0x29')]);_0x5428dd[_0x9eae('0x1a')][_0x9eae('0x65')]=_0x2fabb9[_0x9eae('0x65')];_0x5428dd['message'][_0x9eae('0x66')]=_0x2fabb9[_0x9eae('0x65')];_0x5428dd['message'][_0x9eae('0x67')]=_0x9eae('0x4e');respondWithRpcPromise(_0x9eae('0x68'),'EventManager',{'event':'rejectmessage','message':_[_0x9eae('0x3b')](_0x2fabb9[_0x9eae('0x1a')],JSON[_0x9eae('0x69')](_0x2fabb9[_0x9eae('0x56')][_0x9eae('0x6a')]))},client9002);return _0x2fabb9;}return null;})[_0x9eae('0x25')](respondWithResult(_0x26916f,null))[_0x9eae('0x1c')](handleError(_0x26916f,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index e8d89c5..12632ed 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 _0x1f25=['../../mysqldb','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x30deef,_0x1590bc){var _0x398e43=function(_0x329367){while(--_0x329367){_0x30deef['push'](_0x30deef['shift']());}};_0x398e43(++_0x1590bc);}(_0x1f25,0x19d));var _0x51f2=function(_0x1248b6,_0x38035d){_0x1248b6=_0x1248b6-0x0;var _0x652c77=_0x1f25[_0x1248b6];return _0x652c77;};'use strict';var EventEmitter=require(_0x51f2('0x0'));var ChatMessage=require(_0x51f2('0x1'))['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x51f2('0x2'),'afterUpdate':_0x51f2('0x3'),'afterDestroy':_0x51f2('0x4')};function emitEvent(_0x38fc14){return function(_0x13ae99,_0x52a404,_0x49784f){ChatMessageEvents[_0x51f2('0x5')](_0x38fc14+':'+_0x13ae99['id'],_0x13ae99);ChatMessageEvents[_0x51f2('0x5')](_0x38fc14,_0x13ae99);_0x49784f(null);};}for(var e in events){if(events[_0x51f2('0x6')](e)){var event=events[e];ChatMessage[_0x51f2('0x7')](e,emitEvent(event));}}module[_0x51f2('0x8')]=ChatMessageEvents; \ No newline at end of file +var _0x10f0=['../../mysqldb','ChatMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events'];(function(_0x1c4409,_0x3b2e8f){var _0x356d8f=function(_0xae43bf){while(--_0xae43bf){_0x1c4409['push'](_0x1c4409['shift']());}};_0x356d8f(++_0x3b2e8f);}(_0x10f0,0x1ad));var _0x010f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x10f0[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require(_0x010f('0x0'));var ChatMessage=require(_0x010f('0x1'))['db'][_0x010f('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x010f('0x3')](0x0);var events={'afterCreate':_0x010f('0x4'),'afterUpdate':_0x010f('0x5'),'afterDestroy':_0x010f('0x6')};function emitEvent(_0x593446){return function(_0x17b65d,_0x297fe3,_0x172316){ChatMessageEvents[_0x010f('0x7')](_0x593446+':'+_0x17b65d['id'],_0x17b65d);ChatMessageEvents[_0x010f('0x7')](_0x593446,_0x17b65d);_0x172316(null);};}for(var e in events){if(events[_0x010f('0x8')](e)){var event=events[e];ChatMessage['hook'](e,emitEvent(event));}}module[_0x010f('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 b34af50..655ac27 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 _0xc081=['path','rimraf','./chatMessage.attributes','exports','define','ChatMessage','chat_messages','fti_chat_messages','body','models','get','direction','toLowerCase','secret','isNil','UserId','ChatInteraction','findOne','ChatInteractionId','then','update','createdAt','catch','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x4fb6b6,_0x5eb1c7){var _0x3ea470=function(_0x26228c){while(--_0x26228c){_0x4fb6b6['push'](_0x4fb6b6['shift']());}};_0x3ea470(++_0x5eb1c7);}(_0xc081,0x14f));var _0x1c08=function(_0x431ff8,_0x4085dd){_0x431ff8=_0x431ff8-0x0;var _0x84ccd4=_0xc081[_0x431ff8];return _0x84ccd4;};'use strict';var _=require('lodash');var util=require(_0x1c08('0x0'));var logger=require(_0x1c08('0x1'))(_0x1c08('0x2'));var moment=require(_0x1c08('0x3'));var BPromise=require(_0x1c08('0x4'));var rp=require(_0x1c08('0x5'));var fs=require('fs');var path=require(_0x1c08('0x6'));var rimraf=require(_0x1c08('0x7'));var config=require('../../config/environment');var attributes=require(_0x1c08('0x8'));module[_0x1c08('0x9')]=function(_0x42283c,_0x4e6eec){return _0x42283c[_0x1c08('0xa')](_0x1c08('0xb'),attributes,{'tableName':_0x1c08('0xc'),'paranoid':![],'indexes':[{'name':_0x1c08('0xd'),'fields':[_0x1c08('0xe')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x645f58,_0x143e3f,_0x2183bc){var _0x2a050c=_0x42283c[_0x1c08('0xf')];var _0x274a4d=_0x645f58[_0x1c08('0x10')]({'plain':!![]});if(_0x274a4d[_0x1c08('0x11')][_0x1c08('0x12')]()==='in'||_0x274a4d[_0x1c08('0x11')][_0x1c08('0x12')]()==='out'&&!_0x274a4d[_0x1c08('0x13')]&&!_[_0x1c08('0x14')](_0x274a4d[_0x1c08('0x15')])){_0x2a050c[_0x1c08('0x16')][_0x1c08('0x17')]({'where':{'id':_0x274a4d[_0x1c08('0x18')]}})[_0x1c08('0x19')](function(_0x2e6a89){if(_0x2e6a89){_0x2e6a89[_0x1c08('0x1a')]({'lastMsgAt':_0x274a4d[_0x1c08('0x1b')],'lastMsgDirection':_0x274a4d[_0x1c08('0x11')][_0x1c08('0x12')]()});}})[_0x1c08('0x1c')](function(_0x4227db){console['error'](_0x4227db);});}_0x2183bc();}},'charset':_0x1c08('0x1d'),'collate':_0x1c08('0x1e')});}; \ No newline at end of file +var _0xa2cf=['rimraf','./chatMessage.attributes','exports','define','chat_messages','FULLTEXT','models','get','direction','isNil','findOne','ChatInteractionId','update','createdAt','toLowerCase','catch','error','utf8mb4','lodash','util','api','moment','bluebird','request-promise'];(function(_0x20645f,_0x5688f0){var _0xf0485b=function(_0x4220af){while(--_0x4220af){_0x20645f['push'](_0x20645f['shift']());}};_0xf0485b(++_0x5688f0);}(_0xa2cf,0x162));var _0xfa2c=function(_0x107c87,_0x366dfe){_0x107c87=_0x107c87-0x0;var _0x13795f=_0xa2cf[_0x107c87];return _0x13795f;};'use strict';var _=require(_0xfa2c('0x0'));var util=require(_0xfa2c('0x1'));var logger=require('../../config/logger')(_0xfa2c('0x2'));var moment=require(_0xfa2c('0x3'));var BPromise=require(_0xfa2c('0x4'));var rp=require(_0xfa2c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfa2c('0x6'));var config=require('../../config/environment');var attributes=require(_0xfa2c('0x7'));module[_0xfa2c('0x8')]=function(_0x47b668,_0x490734){return _0x47b668[_0xfa2c('0x9')]('ChatMessage',attributes,{'tableName':_0xfa2c('0xa'),'paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':['body'],'type':_0xfa2c('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x45bab3,_0x32e7e7,_0x9a0c8e){var _0x43cdde=_0x47b668[_0xfa2c('0xc')];var _0x3ccdc9=_0x45bab3[_0xfa2c('0xd')]({'plain':!![]});if(_0x3ccdc9[_0xfa2c('0xe')]['toLowerCase']()==='in'||_0x3ccdc9[_0xfa2c('0xe')]['toLowerCase']()==='out'&&!_0x3ccdc9['secret']&&!_[_0xfa2c('0xf')](_0x3ccdc9['UserId'])){_0x43cdde['ChatInteraction'][_0xfa2c('0x10')]({'where':{'id':_0x3ccdc9[_0xfa2c('0x11')]}})['then'](function(_0x2d544f){if(_0x2d544f){_0x2d544f[_0xfa2c('0x12')]({'lastMsgAt':_0x3ccdc9[_0xfa2c('0x13')],'lastMsgDirection':_0x3ccdc9[_0xfa2c('0xe')][_0xfa2c('0x14')]()});}})[_0xfa2c('0x15')](function(_0x3b09ef){console[_0xfa2c('0x16')](_0x3b09ef);});}_0x9a0c8e();}},'charset':_0xfa2c('0x17'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 671b673..2261238 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 _0xfc33=['options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','./chatMessage.socket','request','then','info','ChatMessage,\x20%s,\x20%s','debug','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','CreateChatMessage','ChatMessage','create','body'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xfc33,0xf0));var _0x3fc3=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xfc33[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0x3fc3('0x0'));var util=require(_0x3fc3('0x1'));var moment=require(_0x3fc3('0x2'));var BPromise=require(_0x3fc3('0x3'));var rs=require(_0x3fc3('0x4'));var fs=require('fs');var Redis=require(_0x3fc3('0x5'));var db=require(_0x3fc3('0x6'))['db'];var utils=require(_0x3fc3('0x7'));var logger=require('../../config/logger')(_0x3fc3('0x8'));var config=require(_0x3fc3('0x9'));var jayson=require(_0x3fc3('0xa'));var client=jayson[_0x3fc3('0xb')][_0x3fc3('0xc')]({'port':0x232a});config[_0x3fc3('0xd')]=_[_0x3fc3('0xe')](config[_0x3fc3('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3fc3('0xd')]));require(_0x3fc3('0xf'))['register'](socket);function respondWithRpcPromise(_0x471b0c,_0x200521,_0x1f0f72){return new BPromise(function(_0x3c188e,_0x2a8e1b){return client[_0x3fc3('0x10')](_0x471b0c,_0x1f0f72)[_0x3fc3('0x11')](function(_0x2822ed){logger[_0x3fc3('0x12')](_0x3fc3('0x13'),_0x200521,'request\x20sent');logger[_0x3fc3('0x14')](_0x3fc3('0x15'),_0x200521,_0x3fc3('0x16'),JSON['stringify'](_0x2822ed));if(_0x2822ed[_0x3fc3('0x17')]){if(_0x2822ed[_0x3fc3('0x17')][_0x3fc3('0x18')]===0x1f4){logger[_0x3fc3('0x17')]('ChatMessage,\x20%s,\x20%s',_0x200521,_0x2822ed['error']['message']);return _0x2a8e1b(_0x2822ed['error'][_0x3fc3('0x19')]);}logger[_0x3fc3('0x17')]('ChatMessage,\x20%s,\x20%s',_0x200521,_0x2822ed[_0x3fc3('0x17')][_0x3fc3('0x19')]);return _0x3c188e(_0x2822ed[_0x3fc3('0x17')][_0x3fc3('0x19')]);}else{logger[_0x3fc3('0x12')](_0x3fc3('0x13'),_0x200521,_0x3fc3('0x16'));_0x3c188e(_0x2822ed[_0x3fc3('0x1a')][_0x3fc3('0x19')]);}})[_0x3fc3('0x1b')](function(_0x53c435){logger[_0x3fc3('0x17')]('ChatMessage,\x20%s,\x20%s',_0x200521,_0x53c435);_0x2a8e1b(_0x53c435);});});}exports[_0x3fc3('0x1c')]=function(_0x5ea38e){var _0x4efe16=this;return new Promise(function(_0x49a58e,_0x20f84a){return db[_0x3fc3('0x1d')][_0x3fc3('0x1e')](_0x5ea38e[_0x3fc3('0x1f')],{'raw':_0x5ea38e[_0x3fc3('0x20')]?_0x5ea38e[_0x3fc3('0x20')][_0x3fc3('0x21')]===undefined?!![]:![]:!![]})[_0x3fc3('0x11')](function(_0x57534b){logger['info'](_0x3fc3('0x1c'),_0x5ea38e);logger[_0x3fc3('0x14')](_0x3fc3('0x1c'),_0x5ea38e,JSON['stringify'](_0x57534b));_0x49a58e(_0x57534b);})['catch'](function(_0x5ca044){logger[_0x3fc3('0x17')]('CreateChatMessage',_0x5ca044[_0x3fc3('0x19')],_0x5ea38e);_0x20f84a(_0x4efe16[_0x3fc3('0x17')](0x1f4,_0x5ca044[_0x3fc3('0x19')]));});});}; \ No newline at end of file +var _0x7d6f=['raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','redis','defaults','localhost','./chatMessage.socket','register','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','ChatMessage','create','body','options'];(function(_0x5389e4,_0x4d98b2){var _0x521efc=function(_0x285e3f){while(--_0x285e3f){_0x5389e4['push'](_0x5389e4['shift']());}};_0x521efc(++_0x4d98b2);}(_0x7d6f,0x194));var _0xf7d6=function(_0x3ce0ae,_0x2f0041){_0x3ce0ae=_0x3ce0ae-0x0;var _0x150999=_0x7d6f[_0x3ce0ae];return _0x150999;};'use strict';var _=require(_0xf7d6('0x0'));var util=require(_0xf7d6('0x1'));var moment=require(_0xf7d6('0x2'));var BPromise=require(_0xf7d6('0x3'));var rs=require(_0xf7d6('0x4'));var fs=require('fs');var Redis=require(_0xf7d6('0x5'));var db=require(_0xf7d6('0x6'))['db'];var utils=require(_0xf7d6('0x7'));var logger=require(_0xf7d6('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0xf7d6('0x9'));var client=jayson['client'][_0xf7d6('0xa')]({'port':0x232a});config[_0xf7d6('0xb')]=_[_0xf7d6('0xc')](config['redis'],{'host':_0xf7d6('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf7d6('0xb')]));require(_0xf7d6('0xe'))[_0xf7d6('0xf')](socket);function respondWithRpcPromise(_0x4e1fa8,_0x2c2981,_0x2c9da9){return new BPromise(function(_0x159897,_0x1ab4c1){return client['request'](_0x4e1fa8,_0x2c9da9)['then'](function(_0x4d91f7){logger[_0xf7d6('0x10')](_0xf7d6('0x11'),_0x2c2981,_0xf7d6('0x12'));logger[_0xf7d6('0x13')](_0xf7d6('0x14'),_0x2c2981,_0xf7d6('0x12'),JSON[_0xf7d6('0x15')](_0x4d91f7));if(_0x4d91f7[_0xf7d6('0x16')]){if(_0x4d91f7[_0xf7d6('0x16')][_0xf7d6('0x17')]===0x1f4){logger[_0xf7d6('0x16')](_0xf7d6('0x11'),_0x2c2981,_0x4d91f7[_0xf7d6('0x16')][_0xf7d6('0x18')]);return _0x1ab4c1(_0x4d91f7[_0xf7d6('0x16')]['message']);}logger[_0xf7d6('0x16')](_0xf7d6('0x11'),_0x2c2981,_0x4d91f7['error'][_0xf7d6('0x18')]);return _0x159897(_0x4d91f7['error'][_0xf7d6('0x18')]);}else{logger['info']('ChatMessage,\x20%s,\x20%s',_0x2c2981,_0xf7d6('0x12'));_0x159897(_0x4d91f7['result'][_0xf7d6('0x18')]);}})[_0xf7d6('0x19')](function(_0x1f8478){logger[_0xf7d6('0x16')](_0xf7d6('0x11'),_0x2c2981,_0x1f8478);_0x1ab4c1(_0x1f8478);});});}exports['CreateChatMessage']=function(_0x25d25){var _0x394468=this;return new Promise(function(_0x5228a0,_0x24ef09){return db[_0xf7d6('0x1a')][_0xf7d6('0x1b')](_0x25d25[_0xf7d6('0x1c')],{'raw':_0x25d25[_0xf7d6('0x1d')]?_0x25d25['options'][_0xf7d6('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x54ce16){logger[_0xf7d6('0x10')]('CreateChatMessage',_0x25d25);logger['debug']('CreateChatMessage',_0x25d25,JSON[_0xf7d6('0x15')](_0x54ce16));_0x5228a0(_0x54ce16);})[_0xf7d6('0x19')](function(_0x14552a){logger[_0xf7d6('0x16')]('CreateChatMessage',_0x14552a['message'],_0x25d25);_0x24ef09(_0x394468[_0xf7d6('0x16')](0x1f4,_0x14552a['message']));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 5585972..5242fa7 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 _0x2fed=['emit','removeListener','register','length','./chatMessage.events','save','remove','update'];(function(_0x575df6,_0x19aa77){var _0xa101a5=function(_0x279d85){while(--_0x279d85){_0x575df6['push'](_0x575df6['shift']());}};_0xa101a5(++_0x19aa77);}(_0x2fed,0x7c));var _0xd2fe=function(_0x138400,_0x16d644){_0x138400=_0x138400-0x0;var _0x1da107=_0x2fed[_0x138400];return _0x1da107;};'use strict';var ChatMessageEvents=require(_0xd2fe('0x0'));var events=[_0xd2fe('0x1'),_0xd2fe('0x2'),_0xd2fe('0x3')];function createListener(_0x15f95a,_0x4b70e7){return function(_0x3c9206){_0x4b70e7[_0xd2fe('0x4')](_0x15f95a,_0x3c9206);};}function removeListener(_0x48707a,_0x58f3f8){return function(){ChatMessageEvents[_0xd2fe('0x5')](_0x48707a,_0x58f3f8);};}exports[_0xd2fe('0x6')]=function(_0xd85f89){for(var _0x5be4d3=0x0,_0x2f7bf5=events[_0xd2fe('0x7')];_0x5be4d3<_0x2f7bf5;_0x5be4d3++){var _0x3b6591=events[_0x5be4d3];var _0x42a8fb=createListener('chatMessage:'+_0x3b6591,_0xd85f89);ChatMessageEvents['on'](_0x3b6591,_0x42a8fb);}}; \ No newline at end of file +var _0x7923=['register','length','chatMessage:','./chatMessage.events','save','remove','update'];(function(_0x79c6de,_0x10de94){var _0x321a56=function(_0x2e313e){while(--_0x2e313e){_0x79c6de['push'](_0x79c6de['shift']());}};_0x321a56(++_0x10de94);}(_0x7923,0x8f));var _0x3792=function(_0x4716b0,_0x167fe7){_0x4716b0=_0x4716b0-0x0;var _0x3d59c1=_0x7923[_0x4716b0];return _0x3d59c1;};'use strict';var ChatMessageEvents=require(_0x3792('0x0'));var events=[_0x3792('0x1'),_0x3792('0x2'),_0x3792('0x3')];function createListener(_0xfd3952,_0xf88b72){return function(_0x3bdefe){_0xf88b72['emit'](_0xfd3952,_0x3bdefe);};}function removeListener(_0x21134d,_0x51d334){return function(){ChatMessageEvents['removeListener'](_0x21134d,_0x51d334);};}exports[_0x3792('0x4')]=function(_0x4f98c6){for(var _0x326cc2=0x0,_0x18b993=events[_0x3792('0x5')];_0x326cc2<_0x18b993;_0x326cc2++){var _0x5b55f8=events[_0x326cc2];var _0x5b453a=createListener(_0x3792('0x6')+_0x5b55f8,_0x4f98c6);ChatMessageEvents['on'](_0x5b55f8,_0x5b453a);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 8f0e65e..bf85d9c 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 _0xf6a7=['multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','/describe','describe','/:id','show','post','tracked','chat','chatmessage:create','put','update','delete','destroy','exports'];(function(_0x1857d0,_0x6eade0){var _0x3e3c46=function(_0x3915b8){while(--_0x3915b8){_0x1857d0['push'](_0x1857d0['shift']());}};_0x3e3c46(++_0x6eade0);}(_0xf6a7,0xa1));var _0x7f6a=function(_0x2ab0b1,_0x4344be){_0x2ab0b1=_0x2ab0b1-0x0;var _0x30f3fc=_0xf6a7[_0x2ab0b1];return _0x30f3fc;};'use strict';var multer=require(_0x7f6a('0x0'));var util=require('util');var path=require(_0x7f6a('0x1'));var timeout=require(_0x7f6a('0x2'));var express=require(_0x7f6a('0x3'));var router=express[_0x7f6a('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x7f6a('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7f6a('0x6'));var controller=require(_0x7f6a('0x7'));router[_0x7f6a('0x8')]('/',auth[_0x7f6a('0x9')](),controller['index']);router[_0x7f6a('0x8')](_0x7f6a('0xa'),auth[_0x7f6a('0x9')](),controller[_0x7f6a('0xb')]);router[_0x7f6a('0x8')](_0x7f6a('0xc'),auth[_0x7f6a('0x9')](),controller[_0x7f6a('0xd')]);router[_0x7f6a('0xe')]('/',auth[_0x7f6a('0x9')](),interaction[_0x7f6a('0xf')](_0x7f6a('0x10'),_0x7f6a('0x11')),controller['create']);router[_0x7f6a('0x12')]('/:id',controller[_0x7f6a('0x13')]);router['put']('/:id/accept',auth['isAuthenticated'](),controller['accept']);router['put']('/:id/reject',auth['isAuthenticated'](),controller['reject']);router[_0x7f6a('0x14')](_0x7f6a('0xc'),auth[_0x7f6a('0x9')](),controller[_0x7f6a('0x15')]);module[_0x7f6a('0x16')]=router; \ No newline at end of file +var _0x8309=['put','/:id/accept','reject','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./chatMessage.controller','index','get','/describe','isAuthenticated','show','post','tracked','chatmessage:create','create','/:id','update'];(function(_0x1a51a1,_0x56d77b){var _0x127d55=function(_0x4f6800){while(--_0x4f6800){_0x1a51a1['push'](_0x1a51a1['shift']());}};_0x127d55(++_0x56d77b);}(_0x8309,0x17c));var _0x9830=function(_0x2c1ab8,_0x21ced6){_0x2c1ab8=_0x2c1ab8-0x0;var _0x535c24=_0x8309[_0x2c1ab8];return _0x535c24;};'use strict';var multer=require(_0x9830('0x0'));var util=require(_0x9830('0x1'));var path=require(_0x9830('0x2'));var timeout=require(_0x9830('0x3'));var express=require(_0x9830('0x4'));var router=express[_0x9830('0x5')]();var fs_extra=require(_0x9830('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9830('0x7'));var controller=require(_0x9830('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x9830('0x9')]);router[_0x9830('0xa')](_0x9830('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x9830('0xa')]('/:id',auth[_0x9830('0xc')](),controller[_0x9830('0xd')]);router[_0x9830('0xe')]('/',auth[_0x9830('0xc')](),interaction[_0x9830('0xf')]('chat',_0x9830('0x10')),controller[_0x9830('0x11')]);router['put'](_0x9830('0x12'),controller[_0x9830('0x13')]);router[_0x9830('0x14')](_0x9830('0x15'),auth[_0x9830('0xc')](),controller['accept']);router[_0x9830('0x14')]('/:id/reject',auth['isAuthenticated'](),controller[_0x9830('0x16')]);router['delete'](_0x9830('0x12'),auth[_0x9830('0xc')](),controller[_0x9830('0x17')]);module[_0x9830('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 366dcfc..6240840 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 _0xb10b=['medium','sequelize','TEXT'];(function(_0x31eea3,_0x2d40f2){var _0x3e7fef=function(_0x443476){while(--_0x443476){_0x31eea3['push'](_0x31eea3['shift']());}};_0x3e7fef(++_0x2d40f2);}(_0xb10b,0x12a));var _0xbb10=function(_0x231a42,_0x39f4db){_0x231a42=_0x231a42-0x0;var _0x3c2a56=_0xb10b[_0x231a42];return _0x3c2a56;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'body':{'type':Sequelize[_0xbb10('0x1')](_0xbb10('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xbb10('0x1')]('medium'),'allowNull':![]}}; \ No newline at end of file +var _0xb10b=['medium','sequelize','TEXT'];(function(_0x1dfe92,_0x4960a4){var _0x15d6b0=function(_0x1675f1){while(--_0x1675f1){_0x1dfe92['push'](_0x1dfe92['shift']());}};_0x15d6b0(++_0x4960a4);}(_0xb10b,0x12a));var _0xbb10=function(_0x4e1926,_0x2415d6){_0x4e1926=_0x4e1926-0x0;var _0x85fa41=_0xb10b[_0x4e1926];return _0x85fa41;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'body':{'type':Sequelize[_0xbb10('0x1')](_0xbb10('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xbb10('0x1')]('medium'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index c96e7f2..e87e9c1 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(_0x217890,_0x40f4ed){var _0x21398a=function(_0x4e9a30){while(--_0x4e9a30){_0x217890['push'](_0x217890['shift']());}};_0x21398a(++_0x40f4ed);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['ChatOfflineMessage']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['ChatOfflineMessage'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['ChatOfflineMessage'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x4c')][_0x7995('0x41')]({'where':{'ChatOfflineMessageId':_0x4ffc8a['params']['id']},'raw':!![]})['then'](function(_0x5a592e){_0x5a592e[_0x7995('0x4d')](function(_0x1fd1ca){var _0x4cf5db=path[_0x7995('0x4e')](config[_0x7995('0x4f')],_0x7995('0x50'),_0x7995('0x51'),_0x7995('0x52'),'offline-chat',_0x1fd1ca[_0x7995('0x53')]);var _0x4ab09f=fs[_0x7995('0x54')](_0x4cf5db);if(_0x4ab09f)fs_extra[_0x7995('0x55')](_0x4cf5db);});})[_0x7995('0x26')](function(){return db['ChatOfflineMessage']['find']({'where':{'id':_0x4ffc8a['params']['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x19da63,null))[_0x7995('0x26')](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x56')]=function(_0x150261,_0x1d957e){return db[_0x7995('0x40')][_0x7995('0x56')]()[_0x7995('0x26')](respondWithResult(_0x1d957e,null))[_0x7995('0x49')](handleError(_0x1d957e,null));}; \ No newline at end of file +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(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0x7a54,0x106));var _0x47a5=function(_0x4abcef,_0xbcf2d7){_0x4abcef=_0x4abcef-0x0;var _0x3e4ebc=_0x7a54[_0x4abcef];return _0x3e4ebc;};'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 ad23f53..489426e 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 _0x4071=['ChatOfflineMessage','setMaxListeners','update','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x5d3eeb,_0x1f6625){var _0x3e14d3=function(_0x87bcce){while(--_0x87bcce){_0x5d3eeb['push'](_0x5d3eeb['shift']());}};_0x3e14d3(++_0x1f6625);}(_0x4071,0x1e6));var _0x1407=function(_0x56904a,_0x1f845a){_0x56904a=_0x56904a-0x0;var _0x2825eb=_0x4071[_0x56904a];return _0x2825eb;};'use strict';var EventEmitter=require(_0x1407('0x0'));var ChatOfflineMessage=require(_0x1407('0x1'))['db'][_0x1407('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x1407('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x1407('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3b752f){return function(_0x2ab190,_0x16809b,_0x565160){ChatOfflineMessageEvents[_0x1407('0x5')](_0x3b752f+':'+_0x2ab190['id'],_0x2ab190);ChatOfflineMessageEvents[_0x1407('0x5')](_0x3b752f,_0x2ab190);_0x565160(null);};}for(var e in events){if(events[_0x1407('0x6')](e)){var event=events[e];ChatOfflineMessage['hook'](e,emitEvent(event));}}module[_0x1407('0x7')]=ChatOfflineMessageEvents; \ No newline at end of file +var _0xc7dd=['exports','events','../../mysqldb','setMaxListeners','remove','hasOwnProperty'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0xc7dd,0x15d));var _0xdc7d=function(_0x311aad,_0x54d658){_0x311aad=_0x311aad-0x0;var _0x1779bd=_0xc7dd[_0x311aad];return _0x1779bd;};'use strict';var EventEmitter=require(_0xdc7d('0x0'));var ChatOfflineMessage=require(_0xdc7d('0x1'))['db']['ChatOfflineMessage'];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0xdc7d('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xdc7d('0x3')};function emitEvent(_0x2b0318){return function(_0x4bc843,_0x24f3e7,_0x84a50){ChatOfflineMessageEvents['emit'](_0x2b0318+':'+_0x4bc843['id'],_0x4bc843);ChatOfflineMessageEvents['emit'](_0x2b0318,_0x4bc843);_0x84a50(null);};}for(var e in events){if(events[_0xdc7d('0x4')](e)){var event=events[e];ChatOfflineMessage['hook'](e,emitEvent(event));}}module[_0xdc7d('0x5')]=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index eea89fe..dda2d63 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 _0xfdd0=['ChatOfflineMessage','chat_offline_messages','utf8mb4_unicode_ci','exports'];(function(_0x26b94d,_0x168f2f){var _0x29519f=function(_0x4717c5){while(--_0x4717c5){_0x26b94d['push'](_0x26b94d['shift']());}};_0x29519f(++_0x168f2f);}(_0xfdd0,0xb7));var _0x0fdd=function(_0x2cf818,_0x1cd613){_0x2cf818=_0x2cf818-0x0;var _0x4c1fc7=_0xfdd0[_0x2cf818];return _0x4c1fc7;};'use strict';var attributes=require('./chatOfflineMessage.attributes');module[_0x0fdd('0x0')]=function(_0x310a4c){return _0x310a4c['define'](_0x0fdd('0x1'),attributes,{'tableName':_0x0fdd('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0fdd('0x3')});}; \ No newline at end of file +var _0xd47d=['ChatOfflineMessage','utf8mb4','utf8mb4_unicode_ci','./chatOfflineMessage.attributes','exports'];(function(_0x1a6519,_0x395572){var _0x300b42=function(_0x24b243){while(--_0x24b243){_0x1a6519['push'](_0x1a6519['shift']());}};_0x300b42(++_0x395572);}(_0xd47d,0x1c5));var _0xdd47=function(_0x2307fa,_0x266e5e){_0x2307fa=_0x2307fa-0x0;var _0x496486=_0xd47d[_0x2307fa];return _0x496486;};'use strict';var attributes=require(_0xdd47('0x0'));module[_0xdd47('0x1')]=function(_0x341c88){return _0x341c88['define'](_0xdd47('0x2'),attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xdd47('0x3'),'collate':_0xdd47('0x4')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index d5d1d02..87615cf 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 _0xc2e5=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring'];(function(_0x4cee82,_0x208e67){var _0x200c1d=function(_0x372584){while(--_0x372584){_0x4cee82['push'](_0x4cee82['shift']());}};_0x200c1d(++_0x208e67);}(_0xc2e5,0x6f));var _0x5c2e=function(_0x4fe19c,_0x45d0fe){_0x4fe19c=_0x4fe19c-0x0;var _0x952ac7=_0xc2e5[_0x4fe19c];return _0x952ac7;};'use strict';var _=require('lodash');var util=require(_0x5c2e('0x0'));var moment=require(_0x5c2e('0x1'));var BPromise=require(_0x5c2e('0x2'));var rs=require(_0x5c2e('0x3'));var fs=require('fs');var Redis=require(_0x5c2e('0x4'));var db=require(_0x5c2e('0x5'))['db'];var utils=require(_0x5c2e('0x6'));var logger=require('../../config/logger')(_0x5c2e('0x7'));var config=require(_0x5c2e('0x8'));var jayson=require(_0x5c2e('0x9'));var client=jayson['client'][_0x5c2e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5316f3,_0x3f34d9,_0x461b83){return new BPromise(function(_0x11782c,_0xb70b30){return client[_0x5c2e('0xb')](_0x5316f3,_0x461b83)['then'](function(_0x3f2455){logger[_0x5c2e('0xc')](_0x5c2e('0xd'),_0x3f34d9,_0x5c2e('0xe'));logger[_0x5c2e('0xf')](_0x5c2e('0x10'),_0x3f34d9,'request\x20sent',JSON[_0x5c2e('0x11')](_0x3f2455));if(_0x3f2455[_0x5c2e('0x12')]){if(_0x3f2455[_0x5c2e('0x12')][_0x5c2e('0x13')]===0x1f4){logger[_0x5c2e('0x12')](_0x5c2e('0xd'),_0x3f34d9,_0x3f2455['error'][_0x5c2e('0x14')]);return _0xb70b30(_0x3f2455['error']['message']);}logger[_0x5c2e('0x12')](_0x5c2e('0xd'),_0x3f34d9,_0x3f2455[_0x5c2e('0x12')][_0x5c2e('0x14')]);return _0x11782c(_0x3f2455[_0x5c2e('0x12')][_0x5c2e('0x14')]);}else{logger[_0x5c2e('0xc')](_0x5c2e('0xd'),_0x3f34d9,_0x5c2e('0xe'));_0x11782c(_0x3f2455[_0x5c2e('0x15')][_0x5c2e('0x14')]);}})[_0x5c2e('0x16')](function(_0x50210c){logger['error']('ChatOfflineMessage,\x20%s,\x20%s',_0x3f34d9,_0x50210c);_0xb70b30(_0x50210c);});});} \ No newline at end of file +var _0xdfe7=['../../config/environment','client','http','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x56ee15,_0x1effd1){var _0x94991f=function(_0x5018fa){while(--_0x5018fa){_0x56ee15['push'](_0x56ee15['shift']());}};_0x94991f(++_0x1effd1);}(_0xdfe7,0xc8));var _0x7dfe=function(_0x2ec81f,_0x34004c){_0x2ec81f=_0x2ec81f-0x0;var _0x1039ce=_0xdfe7[_0x2ec81f];return _0x1039ce;};'use strict';var _=require('lodash');var util=require(_0x7dfe('0x0'));var moment=require(_0x7dfe('0x1'));var BPromise=require('bluebird');var rs=require(_0x7dfe('0x2'));var fs=require('fs');var Redis=require(_0x7dfe('0x3'));var db=require(_0x7dfe('0x4'))['db'];var utils=require(_0x7dfe('0x5'));var logger=require('../../config/logger')(_0x7dfe('0x6'));var config=require(_0x7dfe('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x7dfe('0x8')][_0x7dfe('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x23d0c1,_0x2163fc,_0x56d67e){return new BPromise(function(_0x3fc0a0,_0x37705a){return client[_0x7dfe('0xa')](_0x23d0c1,_0x56d67e)[_0x7dfe('0xb')](function(_0x52040d){logger[_0x7dfe('0xc')](_0x7dfe('0xd'),_0x2163fc,_0x7dfe('0xe'));logger[_0x7dfe('0xf')](_0x7dfe('0x10'),_0x2163fc,'request\x20sent',JSON[_0x7dfe('0x11')](_0x52040d));if(_0x52040d[_0x7dfe('0x12')]){if(_0x52040d[_0x7dfe('0x12')][_0x7dfe('0x13')]===0x1f4){logger['error']('ChatOfflineMessage,\x20%s,\x20%s',_0x2163fc,_0x52040d[_0x7dfe('0x12')]['message']);return _0x37705a(_0x52040d['error'][_0x7dfe('0x14')]);}logger['error'](_0x7dfe('0xd'),_0x2163fc,_0x52040d[_0x7dfe('0x12')][_0x7dfe('0x14')]);return _0x3fc0a0(_0x52040d['error'][_0x7dfe('0x14')]);}else{logger[_0x7dfe('0xc')](_0x7dfe('0xd'),_0x2163fc,_0x7dfe('0xe'));_0x3fc0a0(_0x52040d[_0x7dfe('0x15')][_0x7dfe('0x14')]);}})[_0x7dfe('0x16')](function(_0x225fef){logger[_0x7dfe('0x12')](_0x7dfe('0xd'),_0x2163fc,_0x225fef);_0x37705a(_0x225fef);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index d84665f..3da28ff 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 _0x8d2c=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x1aeda2,_0x1217eb){var _0x32dc6d=function(_0x34a460){while(--_0x34a460){_0x1aeda2['push'](_0x1aeda2['shift']());}};_0x32dc6d(++_0x1217eb);}(_0x8d2c,0xfd));var _0xc8d2=function(_0x1ebec5,_0x28e315){_0x1ebec5=_0x1ebec5-0x0;var _0x9b7fa7=_0x8d2c[_0x1ebec5];return _0x9b7fa7;};'use strict';var multer=require('multer');var util=require(_0xc8d2('0x0'));var path=require('path');var timeout=require(_0xc8d2('0x1'));var express=require(_0xc8d2('0x2'));var router=express[_0xc8d2('0x3')]();var fs_extra=require(_0xc8d2('0x4'));var auth=require(_0xc8d2('0x5'));var interaction=require(_0xc8d2('0x6'));var config=require(_0xc8d2('0x7'));var controller=require(_0xc8d2('0x8'));router[_0xc8d2('0x9')]('/',auth[_0xc8d2('0xa')](),controller[_0xc8d2('0xb')]);router['get'](_0xc8d2('0xc'),auth[_0xc8d2('0xa')](),controller[_0xc8d2('0xd')]);router[_0xc8d2('0x9')](_0xc8d2('0xe'),auth['isAuthenticated'](),controller[_0xc8d2('0xf')]);router[_0xc8d2('0x10')]('/',auth[_0xc8d2('0xa')](),controller[_0xc8d2('0x11')]);router[_0xc8d2('0x12')](_0xc8d2('0xe'),auth['isAuthenticated'](),controller[_0xc8d2('0x13')]);router[_0xc8d2('0x14')](_0xc8d2('0xe'),auth['isAuthenticated'](),controller[_0xc8d2('0x15')]);module[_0xc8d2('0x16')]=router; \ No newline at end of file +var _0xb2a1=['put','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','index','describe','/:id','post'];(function(_0x13c147,_0x2f9e09){var _0x494688=function(_0x47941a){while(--_0x47941a){_0x13c147['push'](_0x13c147['shift']());}};_0x494688(++_0x2f9e09);}(_0xb2a1,0x121));var _0x1b2a=function(_0x301fa3,_0x438b73){_0x301fa3=_0x301fa3-0x0;var _0x28a9d6=_0xb2a1[_0x301fa3];return _0x28a9d6;};'use strict';var multer=require('multer');var util=require(_0x1b2a('0x0'));var path=require(_0x1b2a('0x1'));var timeout=require(_0x1b2a('0x2'));var express=require(_0x1b2a('0x3'));var router=express[_0x1b2a('0x4')]();var fs_extra=require(_0x1b2a('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x1b2a('0x6'));var config=require(_0x1b2a('0x7'));var controller=require(_0x1b2a('0x8'));router[_0x1b2a('0x9')]('/',auth[_0x1b2a('0xa')](),controller[_0x1b2a('0xb')]);router[_0x1b2a('0x9')]('/describe',auth[_0x1b2a('0xa')](),controller[_0x1b2a('0xc')]);router[_0x1b2a('0x9')](_0x1b2a('0xd'),auth[_0x1b2a('0xa')](),controller['show']);router[_0x1b2a('0xe')]('/',auth[_0x1b2a('0xa')](),controller['create']);router[_0x1b2a('0xf')](_0x1b2a('0xd'),auth[_0x1b2a('0xa')](),controller['update']);router[_0x1b2a('0x10')](_0x1b2a('0xd'),auth[_0x1b2a('0xa')](),controller[_0x1b2a('0x11')]);module[_0x1b2a('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 41d383c..0ea4f98 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 _0xf1aa=['ENUM','mouseOver','timeout','INTEGER','sequelize','exports','STRING'];(function(_0x36315e,_0x1cb3fc){var _0x905dc=function(_0x15e32f){while(--_0x15e32f){_0x36315e['push'](_0x36315e['shift']());}};_0x905dc(++_0x1cb3fc);}(_0xf1aa,0x1cb));var _0xaf1a=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xf1aa[_0x42cae2];return _0x5f256f;};'use strict';var Sequelize=require(_0xaf1a('0x0'));module[_0xaf1a('0x1')]={'name':{'type':Sequelize[_0xaf1a('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xaf1a('0x3')](_0xaf1a('0x4'),_0xaf1a('0x5')),'defaultValue':_0xaf1a('0x4')},'selector':{'type':Sequelize[_0xaf1a('0x2')]},'timeout':{'type':Sequelize[_0xaf1a('0x6')]}}; \ No newline at end of file +var _0xfad6=['sequelize','exports','timeout','mouseOver','STRING','INTEGER'];(function(_0x3501fc,_0x9cd204){var _0x4a0a3e=function(_0x14bf41){while(--_0x14bf41){_0x3501fc['push'](_0x3501fc['shift']());}};_0x4a0a3e(++_0x9cd204);}(_0xfad6,0xe4));var _0x6fad=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfad6[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x6fad('0x0'));module[_0x6fad('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM']('mouseOver',_0x6fad('0x2')),'defaultValue':_0x6fad('0x3')},'selector':{'type':Sequelize[_0x6fad('0x4')]},'timeout':{'type':Sequelize[_0x6fad('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 3f8f64a..d35c9c8 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 _0x0d4e=['fields','length','includeAll','include','merge','options','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','save','update','then','destroy','stack','name','send','show','params','model','keys','ChatProactiveAction','query','filters','intersection','attributes'];(function(_0x989656,_0x51b2b2){var _0x4be280=function(_0x4987a7){while(--_0x4987a7){_0x989656['push'](_0x989656['shift']());}};_0x4be280(++_0x51b2b2);}(_0x0d4e,0x1ca));var _0xe0d4=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x0d4e[_0x413feb];return _0x40ee88;};'use strict';var emlformat=require(_0xe0d4('0x0'));var rimraf=require(_0xe0d4('0x1'));var zipdir=require(_0xe0d4('0x2'));var jsonpatch=require(_0xe0d4('0x3'));var rp=require(_0xe0d4('0x4'));var moment=require(_0xe0d4('0x5'));var BPromise=require(_0xe0d4('0x6'));var Mustache=require(_0xe0d4('0x7'));var util=require(_0xe0d4('0x8'));var path=require('path');var sox=require(_0xe0d4('0x9'));var csv=require(_0xe0d4('0xa'));var ejs=require(_0xe0d4('0xb'));var fs=require('fs');var fs_extra=require(_0xe0d4('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xe0d4('0xd'));var jsforce=require(_0xe0d4('0xe'));var deskjs=require(_0xe0d4('0xf'));var toCsv=require(_0xe0d4('0xa'));var querystring=require(_0xe0d4('0x10'));var Papa=require(_0xe0d4('0x11'));var Redis=require(_0xe0d4('0x12'));var authService=require(_0xe0d4('0x13'));var qs=require(_0xe0d4('0x14'));var as=require(_0xe0d4('0x15'));var hardwareService=require(_0xe0d4('0x16'));var logger=require(_0xe0d4('0x17'))(_0xe0d4('0x18'));var utils=require('../../config/utils');var config=require(_0xe0d4('0x19'));var licenseUtil=require(_0xe0d4('0x1a'));var db=require(_0xe0d4('0x1b'))['db'];function respondWithStatusCode(_0x258e16,_0x34bce6){_0x34bce6=_0x34bce6||0xcc;return function(_0x2561b5){if(_0x2561b5){return _0x258e16[_0xe0d4('0x1c')](_0x34bce6);}return _0x258e16[_0xe0d4('0x1d')](_0x34bce6)[_0xe0d4('0x1e')]();};}function respondWithResult(_0x161175,_0x3bbfd3){_0x3bbfd3=_0x3bbfd3||0xc8;return function(_0x42db0e){if(_0x42db0e){return _0x161175[_0xe0d4('0x1d')](_0x3bbfd3)[_0xe0d4('0x1f')](_0x42db0e);}};}function respondWithFilteredResult(_0x3a2a41,_0x4d536f){return function(_0x25b833){if(_0x25b833){var _0x3c0986=typeof _0x4d536f[_0xe0d4('0x20')]==='undefined'&&typeof _0x4d536f['limit']===_0xe0d4('0x21');var _0x252b69=_0x25b833[_0xe0d4('0x22')];var _0x174bfa=_0x3c0986?0x0:_0x4d536f[_0xe0d4('0x20')];var _0x58bd0a=_0x3c0986?_0x25b833[_0xe0d4('0x22')]:_0x4d536f[_0xe0d4('0x20')]+_0x4d536f[_0xe0d4('0x23')];var _0x20795b;if(_0x58bd0a>=_0x252b69){_0x58bd0a=_0x252b69;_0x20795b=0xc8;}else{_0x20795b=0xce;}_0x3a2a41[_0xe0d4('0x1d')](_0x20795b);return _0x3a2a41['set'](_0xe0d4('0x24'),_0x174bfa+'-'+_0x58bd0a+'/'+_0x252b69)['json'](_0x25b833);}return null;};}function patchUpdates(_0x533a85){return function(_0x795cf5){try{jsonpatch[_0xe0d4('0x25')](_0x795cf5,_0x533a85,!![]);}catch(_0x20c2c8){return BPromise['reject'](_0x20c2c8);}return _0x795cf5[_0xe0d4('0x26')]();};}function saveUpdates(_0x4527e9,_0x7e5713){return function(_0xb97419){if(_0xb97419){return _0xb97419[_0xe0d4('0x27')](_0x4527e9)[_0xe0d4('0x28')](function(_0x1e13bf){return _0x1e13bf;});}return null;};}function removeEntity(_0x18613d,_0x51adfc){return function(_0x4bfdef){if(_0x4bfdef){return _0x4bfdef[_0xe0d4('0x29')]()[_0xe0d4('0x28')](function(){_0x18613d['status'](0xcc)[_0xe0d4('0x1e')]();});}};}function handleEntityNotFound(_0x48cdef,_0x13c108){return function(_0x9fc63d){if(!_0x9fc63d){_0x48cdef[_0xe0d4('0x1c')](0x194);}return _0x9fc63d;};}function handleError(_0x4becc8,_0x3fe0c9){_0x3fe0c9=_0x3fe0c9||0x1f4;return function(_0x525088){logger['error'](_0x525088[_0xe0d4('0x2a')]);if(_0x525088[_0xe0d4('0x2b')]){delete _0x525088[_0xe0d4('0x2b')];}_0x4becc8[_0xe0d4('0x1d')](_0x3fe0c9)[_0xe0d4('0x2c')](_0x525088);};}exports[_0xe0d4('0x2d')]=function(_0xcae18f,_0x12089c){var _0xe65b15={'raw':!![],'where':{'id':_0xcae18f[_0xe0d4('0x2e')]['id']}},_0x4573ee={};_0x4573ee[_0xe0d4('0x2f')]=_[_0xe0d4('0x30')](db[_0xe0d4('0x31')]['rawAttributes']);_0x4573ee[_0xe0d4('0x32')]=_['keys'](_0xcae18f[_0xe0d4('0x32')]);_0x4573ee[_0xe0d4('0x33')]=_[_0xe0d4('0x34')](_0x4573ee[_0xe0d4('0x2f')],_0x4573ee[_0xe0d4('0x32')]);_0xe65b15[_0xe0d4('0x35')]=_[_0xe0d4('0x34')](_0x4573ee[_0xe0d4('0x2f')],qs[_0xe0d4('0x36')](_0xcae18f[_0xe0d4('0x32')][_0xe0d4('0x36')]));_0xe65b15[_0xe0d4('0x35')]=_0xe65b15['attributes'][_0xe0d4('0x37')]?_0xe65b15['attributes']:_0x4573ee[_0xe0d4('0x2f')];if(_0xcae18f['query'][_0xe0d4('0x38')]){_0xe65b15[_0xe0d4('0x39')]=[{'all':!![]}];}_0xe65b15=_[_0xe0d4('0x3a')]({},_0xe65b15,_0xcae18f[_0xe0d4('0x3b')]);return db['ChatProactiveAction'][_0xe0d4('0x3c')](_0xe65b15)[_0xe0d4('0x28')](handleEntityNotFound(_0x12089c,null))[_0xe0d4('0x28')](respondWithResult(_0x12089c,null))[_0xe0d4('0x3d')](handleError(_0x12089c,null));};exports[_0xe0d4('0x3e')]=function(_0xb845dc,_0x1932c2){return db[_0xe0d4('0x31')][_0xe0d4('0x3e')](_0xb845dc['body'],{})[_0xe0d4('0x28')](respondWithResult(_0x1932c2,0xc9))[_0xe0d4('0x3d')](handleError(_0x1932c2,null));};exports['update']=function(_0x2042ae,_0x396fe2){if(_0x2042ae[_0xe0d4('0x3f')]['id']){delete _0x2042ae[_0xe0d4('0x3f')]['id'];}return db[_0xe0d4('0x31')][_0xe0d4('0x3c')]({'where':{'id':_0x2042ae['params']['id']}})[_0xe0d4('0x28')](handleEntityNotFound(_0x396fe2,null))['then'](saveUpdates(_0x2042ae['body'],null))['then'](respondWithResult(_0x396fe2,null))[_0xe0d4('0x3d')](handleError(_0x396fe2,null));};exports[_0xe0d4('0x29')]=function(_0x1bd6e8,_0xd732fc){return db[_0xe0d4('0x31')]['find']({'where':{'id':_0x1bd6e8['params']['id']}})[_0xe0d4('0x28')](handleEntityNotFound(_0xd732fc,null))[_0xe0d4('0x28')](removeEntity(_0xd732fc,null))[_0xe0d4('0x3d')](handleError(_0xd732fc,null));}; \ No newline at end of file +var _0x6726=['path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','update','then','destroy','sendStatus','error','name','params','keys','rawAttributes','query','filters','model','intersection','fields','attributes','length','include','options','ChatProactiveAction','find','catch','body','rimraf','zip-dir','request-promise','moment','mustache'];(function(_0x21ee8a,_0x1a705c){var _0x5125f4=function(_0x45cef0){while(--_0x45cef0){_0x21ee8a['push'](_0x21ee8a['shift']());}};_0x5125f4(++_0x1a705c);}(_0x6726,0xdb));var _0x6672=function(_0x5a1a51,_0x144c79){_0x5a1a51=_0x5a1a51-0x0;var _0x47edd7=_0x6726[_0x5a1a51];return _0x47edd7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6672('0x0'));var zipdir=require(_0x6672('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6672('0x2'));var moment=require(_0x6672('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x6672('0x4'));var util=require('util');var path=require(_0x6672('0x5'));var sox=require(_0x6672('0x6'));var csv=require(_0x6672('0x7'));var ejs=require(_0x6672('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6672('0x9'));var squel=require(_0x6672('0xa'));var crypto=require(_0x6672('0xb'));var jsforce=require(_0x6672('0xc'));var deskjs=require(_0x6672('0xd'));var toCsv=require(_0x6672('0x7'));var querystring=require(_0x6672('0xe'));var Papa=require(_0x6672('0xf'));var Redis=require(_0x6672('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x6672('0x11'));var as=require(_0x6672('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6672('0x13'))(_0x6672('0x14'));var utils=require(_0x6672('0x15'));var config=require(_0x6672('0x16'));var licenseUtil=require(_0x6672('0x17'));var db=require(_0x6672('0x18'))['db'];function respondWithStatusCode(_0x182b77,_0x2dbf18){_0x2dbf18=_0x2dbf18||0xcc;return function(_0x2ec0bd){if(_0x2ec0bd){return _0x182b77['sendStatus'](_0x2dbf18);}return _0x182b77[_0x6672('0x19')](_0x2dbf18)[_0x6672('0x1a')]();};}function respondWithResult(_0x3e45de,_0x40f310){_0x40f310=_0x40f310||0xc8;return function(_0x1e3eb0){if(_0x1e3eb0){return _0x3e45de[_0x6672('0x19')](_0x40f310)[_0x6672('0x1b')](_0x1e3eb0);}};}function respondWithFilteredResult(_0x514097,_0xbf2cce){return function(_0x3261c9){if(_0x3261c9){var _0x46b6cb=typeof _0xbf2cce[_0x6672('0x1c')]===_0x6672('0x1d')&&typeof _0xbf2cce[_0x6672('0x1e')]===_0x6672('0x1d');var _0x184a79=_0x3261c9['count'];var _0x1a6d2a=_0x46b6cb?0x0:_0xbf2cce[_0x6672('0x1c')];var _0x344300=_0x46b6cb?_0x3261c9[_0x6672('0x1f')]:_0xbf2cce['offset']+_0xbf2cce[_0x6672('0x1e')];var _0x52b617;if(_0x344300>=_0x184a79){_0x344300=_0x184a79;_0x52b617=0xc8;}else{_0x52b617=0xce;}_0x514097[_0x6672('0x19')](_0x52b617);return _0x514097['set'](_0x6672('0x20'),_0x1a6d2a+'-'+_0x344300+'/'+_0x184a79)[_0x6672('0x1b')](_0x3261c9);}return null;};}function patchUpdates(_0x50e8c2){return function(_0x636fed){try{jsonpatch[_0x6672('0x21')](_0x636fed,_0x50e8c2,!![]);}catch(_0x3c23d5){return BPromise['reject'](_0x3c23d5);}return _0x636fed['save']();};}function saveUpdates(_0x1b221c,_0x12fa16){return function(_0x255212){if(_0x255212){return _0x255212[_0x6672('0x22')](_0x1b221c)[_0x6672('0x23')](function(_0xd2d057){return _0xd2d057;});}return null;};}function removeEntity(_0x35e285,_0x124bb5){return function(_0x1252de){if(_0x1252de){return _0x1252de[_0x6672('0x24')]()[_0x6672('0x23')](function(){_0x35e285[_0x6672('0x19')](0xcc)[_0x6672('0x1a')]();});}};}function handleEntityNotFound(_0x1c2886,_0x387614){return function(_0x37e76e){if(!_0x37e76e){_0x1c2886[_0x6672('0x25')](0x194);}return _0x37e76e;};}function handleError(_0x19d58c,_0x1f4c29){_0x1f4c29=_0x1f4c29||0x1f4;return function(_0x4ed516){logger[_0x6672('0x26')](_0x4ed516['stack']);if(_0x4ed516[_0x6672('0x27')]){delete _0x4ed516['name'];}_0x19d58c[_0x6672('0x19')](_0x1f4c29)['send'](_0x4ed516);};}exports['show']=function(_0x4fcd14,_0x302306){var _0x39da71={'raw':!![],'where':{'id':_0x4fcd14[_0x6672('0x28')]['id']}},_0x2a3e42={};_0x2a3e42['model']=_[_0x6672('0x29')](db['ChatProactiveAction'][_0x6672('0x2a')]);_0x2a3e42[_0x6672('0x2b')]=_[_0x6672('0x29')](_0x4fcd14['query']);_0x2a3e42[_0x6672('0x2c')]=_['intersection'](_0x2a3e42[_0x6672('0x2d')],_0x2a3e42['query']);_0x39da71['attributes']=_[_0x6672('0x2e')](_0x2a3e42[_0x6672('0x2d')],qs[_0x6672('0x2f')](_0x4fcd14[_0x6672('0x2b')][_0x6672('0x2f')]));_0x39da71[_0x6672('0x30')]=_0x39da71[_0x6672('0x30')][_0x6672('0x31')]?_0x39da71[_0x6672('0x30')]:_0x2a3e42[_0x6672('0x2d')];if(_0x4fcd14[_0x6672('0x2b')]['includeAll']){_0x39da71[_0x6672('0x32')]=[{'all':!![]}];}_0x39da71=_['merge']({},_0x39da71,_0x4fcd14[_0x6672('0x33')]);return db[_0x6672('0x34')][_0x6672('0x35')](_0x39da71)['then'](handleEntityNotFound(_0x302306,null))[_0x6672('0x23')](respondWithResult(_0x302306,null))[_0x6672('0x36')](handleError(_0x302306,null));};exports['create']=function(_0x4c5849,_0x4fbe1a){return db['ChatProactiveAction']['create'](_0x4c5849['body'],{})['then'](respondWithResult(_0x4fbe1a,0xc9))[_0x6672('0x36')](handleError(_0x4fbe1a,null));};exports[_0x6672('0x22')]=function(_0x21571e,_0x3da7b8){if(_0x21571e[_0x6672('0x37')]['id']){delete _0x21571e['body']['id'];}return db[_0x6672('0x34')][_0x6672('0x35')]({'where':{'id':_0x21571e['params']['id']}})[_0x6672('0x23')](handleEntityNotFound(_0x3da7b8,null))['then'](saveUpdates(_0x21571e[_0x6672('0x37')],null))['then'](respondWithResult(_0x3da7b8,null))['catch'](handleError(_0x3da7b8,null));};exports[_0x6672('0x24')]=function(_0x2856be,_0x53a382){return db[_0x6672('0x34')]['find']({'where':{'id':_0x2856be[_0x6672('0x28')]['id']}})[_0x6672('0x23')](handleEntityNotFound(_0x53a382,null))[_0x6672('0x23')](removeEntity(_0x53a382,null))['catch'](handleError(_0x53a382,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index e8d0b6e..0924258 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 _0x8c31=['path','../../config/environment','exports','define','chat_proactive_actions','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x2a2c4c,_0x4e6d8f){var _0x364481=function(_0x40c2be){while(--_0x40c2be){_0x2a2c4c['push'](_0x2a2c4c['shift']());}};_0x364481(++_0x4e6d8f);}(_0x8c31,0x12e));var _0x18c3=function(_0x3f5262,_0x1ad642){_0x3f5262=_0x3f5262-0x0;var _0x113366=_0x8c31[_0x3f5262];return _0x113366;};'use strict';var _=require(_0x18c3('0x0'));var util=require(_0x18c3('0x1'));var logger=require(_0x18c3('0x2'))('api');var moment=require(_0x18c3('0x3'));var BPromise=require(_0x18c3('0x4'));var rp=require(_0x18c3('0x5'));var fs=require('fs');var path=require(_0x18c3('0x6'));var rimraf=require('rimraf');var config=require(_0x18c3('0x7'));var attributes=require('./chatProactiveAction.attributes');module[_0x18c3('0x8')]=function(_0x361a05,_0x3e9ae3){return _0x361a05[_0x18c3('0x9')]('ChatProactiveAction',attributes,{'tableName':_0x18c3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x49c9=['bluebird','request-promise','path','./chatProactiveAction.attributes','exports','ChatProactiveAction','lodash','util','../../config/logger','api','moment'];(function(_0x5f04e5,_0x4cebe8){var _0x1703ab=function(_0x4d6d30){while(--_0x4d6d30){_0x5f04e5['push'](_0x5f04e5['shift']());}};_0x1703ab(++_0x4cebe8);}(_0x49c9,0x1be));var _0x949c=function(_0x236d94,_0x2ca004){_0x236d94=_0x236d94-0x0;var _0x51506f=_0x49c9[_0x236d94];return _0x51506f;};'use strict';var _=require(_0x949c('0x0'));var util=require(_0x949c('0x1'));var logger=require(_0x949c('0x2'))(_0x949c('0x3'));var moment=require(_0x949c('0x4'));var BPromise=require(_0x949c('0x5'));var rp=require(_0x949c('0x6'));var fs=require('fs');var path=require(_0x949c('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x949c('0x8'));module[_0x949c('0x9')]=function(_0x3e7e41,_0x53ff8a){return _0x3e7e41['define'](_0x949c('0xa'),attributes,{'tableName':'chat_proactive_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.rpc.js b/server/api/chatProactiveAction/chatProactiveAction.rpc.js index 522c142..5f6de20 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 _0xcb68=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','then','info','request\x20sent','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatProactiveAction,\x20%s,\x20%s'];(function(_0x15f941,_0x4637f4){var _0x473b27=function(_0x2a63f3){while(--_0x2a63f3){_0x15f941['push'](_0x15f941['shift']());}};_0x473b27(++_0x4637f4);}(_0xcb68,0x1d1));var _0x8cb6=function(_0x1e73ec,_0x46f875){_0x1e73ec=_0x1e73ec-0x0;var _0x44ee6b=_0xcb68[_0x1e73ec];return _0x44ee6b;};'use strict';var _=require(_0x8cb6('0x0'));var util=require(_0x8cb6('0x1'));var moment=require(_0x8cb6('0x2'));var BPromise=require(_0x8cb6('0x3'));var rs=require(_0x8cb6('0x4'));var fs=require('fs');var Redis=require(_0x8cb6('0x5'));var db=require(_0x8cb6('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x8cb6('0x7'))('rpc');var config=require(_0x8cb6('0x8'));var jayson=require(_0x8cb6('0x9'));var client=jayson['client'][_0x8cb6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5a4ecc,_0x62da10,_0x370825){return new BPromise(function(_0x2646fb,_0xb430cf){return client['request'](_0x5a4ecc,_0x370825)[_0x8cb6('0xb')](function(_0x21717f){logger[_0x8cb6('0xc')]('ChatProactiveAction,\x20%s,\x20%s',_0x62da10,_0x8cb6('0xd'));logger['debug'](_0x8cb6('0xe'),_0x62da10,_0x8cb6('0xd'),JSON[_0x8cb6('0xf')](_0x21717f));if(_0x21717f[_0x8cb6('0x10')]){if(_0x21717f['error'][_0x8cb6('0x11')]===0x1f4){logger[_0x8cb6('0x10')](_0x8cb6('0x12'),_0x62da10,_0x21717f[_0x8cb6('0x10')]['message']);return _0xb430cf(_0x21717f[_0x8cb6('0x10')]['message']);}logger[_0x8cb6('0x10')](_0x8cb6('0x12'),_0x62da10,_0x21717f['error'][_0x8cb6('0x13')]);return _0x2646fb(_0x21717f[_0x8cb6('0x10')]['message']);}else{logger['info'](_0x8cb6('0x12'),_0x62da10,_0x8cb6('0xd'));_0x2646fb(_0x21717f[_0x8cb6('0x14')][_0x8cb6('0x13')]);}})[_0x8cb6('0x15')](function(_0x28c7f0){logger['error'](_0x8cb6('0x12'),_0x62da10,_0x28c7f0);_0xb430cf(_0x28c7f0);});});} \ No newline at end of file +var _0x5ecd=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatProactiveAction,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x5ecd,0x18a));var _0xd5ec=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5ecd[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd5ec('0x0'));var util=require(_0xd5ec('0x1'));var moment=require(_0xd5ec('0x2'));var BPromise=require(_0xd5ec('0x3'));var rs=require(_0xd5ec('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd5ec('0x5'))['db'];var utils=require(_0xd5ec('0x6'));var logger=require(_0xd5ec('0x7'))(_0xd5ec('0x8'));var config=require(_0xd5ec('0x9'));var jayson=require(_0xd5ec('0xa'));var client=jayson[_0xd5ec('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x157d1b,_0x28c324,_0x3b666a){return new BPromise(function(_0xedd40d,_0x213bb2){return client[_0xd5ec('0xc')](_0x157d1b,_0x3b666a)[_0xd5ec('0xd')](function(_0x6591a3){logger[_0xd5ec('0xe')]('ChatProactiveAction,\x20%s,\x20%s',_0x28c324,_0xd5ec('0xf'));logger[_0xd5ec('0x10')](_0xd5ec('0x11'),_0x28c324,_0xd5ec('0xf'),JSON[_0xd5ec('0x12')](_0x6591a3));if(_0x6591a3[_0xd5ec('0x13')]){if(_0x6591a3['error'][_0xd5ec('0x14')]===0x1f4){logger[_0xd5ec('0x13')](_0xd5ec('0x15'),_0x28c324,_0x6591a3['error'][_0xd5ec('0x16')]);return _0x213bb2(_0x6591a3['error'][_0xd5ec('0x16')]);}logger[_0xd5ec('0x13')](_0xd5ec('0x15'),_0x28c324,_0x6591a3[_0xd5ec('0x13')][_0xd5ec('0x16')]);return _0xedd40d(_0x6591a3[_0xd5ec('0x13')][_0xd5ec('0x16')]);}else{logger[_0xd5ec('0xe')](_0xd5ec('0x15'),_0x28c324,_0xd5ec('0xf'));_0xedd40d(_0x6591a3[_0xd5ec('0x17')][_0xd5ec('0x16')]);}})[_0xd5ec('0x18')](function(_0x1bef54){logger[_0xd5ec('0x13')]('ChatProactiveAction,\x20%s,\x20%s',_0x28c324,_0x1bef54);_0x213bb2(_0x1bef54);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 778cb86..c1c50d7 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 _0x7da7=['util','path','Router','fs-extra','../../components/interaction/service','../../config/environment','get','/:id','show','isAuthenticated','create','put','delete','exports','multer'];(function(_0x2bddf9,_0x22c873){var _0x3f3ae9=function(_0x2d91ac){while(--_0x2d91ac){_0x2bddf9['push'](_0x2bddf9['shift']());}};_0x3f3ae9(++_0x22c873);}(_0x7da7,0x10d));var _0x77da=function(_0x284bc3,_0x22dffe){_0x284bc3=_0x284bc3-0x0;var _0x41ac81=_0x7da7[_0x284bc3];return _0x41ac81;};'use strict';var multer=require(_0x77da('0x0'));var util=require(_0x77da('0x1'));var path=require(_0x77da('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x77da('0x3')]();var fs_extra=require(_0x77da('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x77da('0x5'));var config=require(_0x77da('0x6'));var controller=require('./chatProactiveAction.controller');router[_0x77da('0x7')](_0x77da('0x8'),auth['isAuthenticated'](),controller[_0x77da('0x9')]);router['post']('/',auth[_0x77da('0xa')](),controller[_0x77da('0xb')]);router[_0x77da('0xc')](_0x77da('0x8'),auth[_0x77da('0xa')](),controller['update']);router[_0x77da('0xd')](_0x77da('0x8'),auth[_0x77da('0xa')](),controller['destroy']);module[_0x77da('0xe')]=router; \ No newline at end of file +var _0x4819=['post','isAuthenticated','create','put','update','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','/:id'];(function(_0x36067f,_0xba548e){var _0x44f0b3=function(_0x1954af){while(--_0x1954af){_0x36067f['push'](_0x36067f['shift']());}};_0x44f0b3(++_0xba548e);}(_0x4819,0xcd));var _0x9481=function(_0x1a547e,_0x5917d3){_0x1a547e=_0x1a547e-0x0;var _0x5ebdaf=_0x4819[_0x1a547e];return _0x5ebdaf;};'use strict';var multer=require('multer');var util=require(_0x9481('0x0'));var path=require(_0x9481('0x1'));var timeout=require(_0x9481('0x2'));var express=require(_0x9481('0x3'));var router=express[_0x9481('0x4')]();var fs_extra=require(_0x9481('0x5'));var auth=require(_0x9481('0x6'));var interaction=require(_0x9481('0x7'));var config=require(_0x9481('0x8'));var controller=require(_0x9481('0x9'));router['get'](_0x9481('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x9481('0xb')]('/',auth[_0x9481('0xc')](),controller[_0x9481('0xd')]);router[_0x9481('0xe')](_0x9481('0xa'),auth['isAuthenticated'](),controller[_0x9481('0xf')]);router['delete'](_0x9481('0xa'),auth['isAuthenticated'](),controller[_0x9481('0x10')]);module[_0x9481('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 4723efc..9df13ae 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 _0x03a8=['sequelize','STRING','name','INTEGER'];(function(_0x25ccbe,_0xc935c0){var _0x289529=function(_0x478776){while(--_0x478776){_0x25ccbe['push'](_0x25ccbe['shift']());}};_0x289529(++_0xc935c0);}(_0x03a8,0x16c));var _0x803a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x03a8[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x803a('0x0'));module['exports']={'name':{'type':Sequelize[_0x803a('0x1')],'unique':_0x803a('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x803a('0x1')]},'timeout':{'type':Sequelize[_0x803a('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory','beepall','roundrobin')}}; \ No newline at end of file +var _0x0537=['INTEGER','rrmemory','beepall','sequelize','exports','STRING','name'];(function(_0x443308,_0x1bdf81){var _0x4cc59c=function(_0x35a992){while(--_0x35a992){_0x443308['push'](_0x443308['shift']());}};_0x4cc59c(++_0x1bdf81);}(_0x0537,0x1d1));var _0x7053=function(_0x5538b3,_0x402023){_0x5538b3=_0x5538b3-0x0;var _0x43ddfe=_0x0537[_0x5538b3];return _0x43ddfe;};'use strict';var Sequelize=require(_0x7053('0x0'));module[_0x7053('0x1')]={'name':{'type':Sequelize[_0x7053('0x2')],'unique':_0x7053('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x7053('0x2')]},'timeout':{'type':Sequelize[_0x7053('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x7053('0x5'),_0x7053('0x6'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 4545ce1..a3d9b06 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 _0x88bb=['from','join','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','TeamId','includes','all','union','value','isEmpty','removeAgents','userChatQueue:remove','addAgents','omit','spread','userChatQueue:save','isArray','getAgents','util','squel','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','then','ChatQueues','UserProfileResource','destroy','error','stack','name','send','map','ChatQueue','rawAttributes','fieldName','type','getOptions','where','include','query','catch','params','model','keys','filters','intersection','attributes','fields','length','includeAll','merge','options','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','findOne','UserChatQueue','hasOwnProperty','nolimit','sort','ChatQueueId','filter','findAll','User','UserId','agent','chatPause','updatedAt','createdAt','rows','format','SIP','getTeams','Team','order','pick','ids','Agents','voicePause','interface','flatMap','sequelize','transaction','addTeams','each','findOrCreate','forEach','emit','removeTeams','select'];(function(_0x29e32c,_0x68fe8e){var _0x2ce2ae=function(_0x4e9190){while(--_0x4e9190){_0x29e32c['push'](_0x29e32c['shift']());}};_0x2ce2ae(++_0x68fe8e);}(_0x88bb,0x109));var _0xb88b=function(_0x55ec85,_0x3cc9ed){_0x55ec85=_0x55ec85-0x0;var _0xdf9b38=_0x88bb[_0x55ec85];return _0xdf9b38;};'use strict';var BPromise=require('bluebird');var util=require(_0xb88b('0x0'));var _=require('lodash');var squel=require(_0xb88b('0x1'));var Redis=require('ioredis');var qs=require(_0xb88b('0x2'));var logger=require(_0xb88b('0x3'))(_0xb88b('0x4'));var config=require(_0xb88b('0x5'));var db=require(_0xb88b('0x6'))['db'];config[_0xb88b('0x7')]=_[_0xb88b('0x8')](config['redis'],{'host':_0xb88b('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./chatQueue.socket')['register'](socket);function respondWithStatusCode(_0x482bb9,_0x22eb73){_0x22eb73=_0x22eb73||0xcc;return function(_0x1cf797){if(_0x1cf797){return _0x482bb9[_0xb88b('0xa')](_0x22eb73);}return _0x482bb9['status'](_0x22eb73)[_0xb88b('0xb')]();};}function respondWithResult(_0x298f3a,_0x2b4aa4){_0x2b4aa4=_0x2b4aa4||0xc8;return function(_0x3cc95b){if(_0x3cc95b){return _0x298f3a[_0xb88b('0xc')](_0x2b4aa4)[_0xb88b('0xd')](_0x3cc95b);}};}function respondWithFilteredResult(_0x57fb79,_0x4182aa){return function(_0x369a02){if(_0x369a02){var _0x1ea354=typeof _0x4182aa['offset']===_0xb88b('0xe')&&typeof _0x4182aa[_0xb88b('0xf')]===_0xb88b('0xe');var _0x158f85=_0x369a02[_0xb88b('0x10')];var _0x5dfa9e=_0x1ea354?0x0:_0x4182aa[_0xb88b('0x11')];var _0x4a0126=_0x1ea354?_0x369a02['count']:_0x4182aa[_0xb88b('0x11')]+_0x4182aa[_0xb88b('0xf')];var _0x4ff402;if(_0x4a0126>=_0x158f85){_0x4a0126=_0x158f85;_0x4ff402=0xc8;}else{_0x4ff402=0xce;}_0x57fb79[_0xb88b('0xc')](_0x4ff402);return _0x57fb79[_0xb88b('0x12')](_0xb88b('0x13'),_0x5dfa9e+'-'+_0x4a0126+'/'+_0x158f85)[_0xb88b('0xd')](_0x369a02);}return null;};}function saveUpdates(_0x37e8b7){return function(_0x316a7a){if(_0x316a7a){return _0x316a7a['update'](_0x37e8b7)[_0xb88b('0x14')](function(_0x32baa2){return _0x32baa2;});}return null;};}function removeEntity(_0xe214d2){return function(_0xb45be0){if(_0xb45be0){return _0xb45be0['destroy']()['then'](function(){var _0x8eb8e1=_0xb45be0['get']({'plain':!![]});var _0x3cfac1=_0xb88b('0x15');return db[_0xb88b('0x16')][_0xb88b('0x17')]({'where':{'type':_0x3cfac1,'resourceId':_0x8eb8e1['id']}})[_0xb88b('0x14')](function(){return _0xb45be0;});})[_0xb88b('0x14')](function(){_0xe214d2[_0xb88b('0xc')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ea3a9){return function(_0xdf5afb){if(!_0xdf5afb){_0x3ea3a9[_0xb88b('0xa')](0x194);}return _0xdf5afb;};}function handleError(_0x2b6a84,_0x47b28b){_0x47b28b=_0x47b28b||0x1f4;return function(_0x59f77d){logger[_0xb88b('0x18')](_0x59f77d[_0xb88b('0x19')]);if(_0x59f77d['name']){delete _0x59f77d[_0xb88b('0x1a')];}_0x2b6a84[_0xb88b('0xc')](_0x47b28b)[_0xb88b('0x1b')](_0x59f77d);};}exports['index']=function(_0xbd503b,_0x2f9b8d){var _0x182450={};var _0x523252={'count':0x0,'rows':[]};var _0x16aff4=_[_0xb88b('0x1c')](db[_0xb88b('0x1d')][_0xb88b('0x1e')],function(_0x2e06f1){return{'name':_0x2e06f1[_0xb88b('0x1f')],'type':_0x2e06f1[_0xb88b('0x20')]['key']};});_0x182450=qs[_0xb88b('0x21')](_0x16aff4,_0xbd503b);var _0x2ffcd5={'where':_0x182450[_0xb88b('0x22')]};return db[_0xb88b('0x1d')][_0xb88b('0x10')](_0x2ffcd5)[_0xb88b('0x14')](function(_0x14f603){_0x523252[_0xb88b('0x10')]=_0x14f603;_0x182450[_0xb88b('0x23')]=qs['include'](_0xbd503b[_0xb88b('0x24')]);return db['ChatQueue']['findAll'](_0x182450);})[_0xb88b('0x14')](function(_0x505a12){_0x523252['rows']=_0x505a12;return _0x523252;})['then'](respondWithFilteredResult(_0x2f9b8d,_0x182450))[_0xb88b('0x25')](handleError(_0x2f9b8d,null));};exports['show']=function(_0x44e08d,_0x5e6141){var _0x27eb12={'raw':!![],'where':{'id':_0x44e08d[_0xb88b('0x26')]['id']}},_0x2fb1d5={};_0x2fb1d5[_0xb88b('0x27')]=_[_0xb88b('0x28')](db[_0xb88b('0x1d')]['rawAttributes']);_0x2fb1d5['query']=_[_0xb88b('0x28')](_0x44e08d['query']);_0x2fb1d5[_0xb88b('0x29')]=_[_0xb88b('0x2a')](_0x2fb1d5[_0xb88b('0x27')],_0x2fb1d5[_0xb88b('0x24')]);_0x27eb12[_0xb88b('0x2b')]=_['intersection'](_0x2fb1d5[_0xb88b('0x27')],qs[_0xb88b('0x2c')](_0x44e08d[_0xb88b('0x24')][_0xb88b('0x2c')]));_0x27eb12[_0xb88b('0x2b')]=_0x27eb12[_0xb88b('0x2b')][_0xb88b('0x2d')]?_0x27eb12[_0xb88b('0x2b')]:_0x2fb1d5[_0xb88b('0x27')];if(_0x44e08d[_0xb88b('0x24')][_0xb88b('0x2e')]){_0x27eb12[_0xb88b('0x23')]=[{'all':!![]}];}_0x27eb12=_[_0xb88b('0x2f')]({},_0x27eb12,_0x44e08d[_0xb88b('0x30')]);return db[_0xb88b('0x1d')]['find'](_0x27eb12)[_0xb88b('0x14')](handleEntityNotFound(_0x5e6141,null))[_0xb88b('0x14')](respondWithResult(_0x5e6141,null))[_0xb88b('0x25')](handleError(_0x5e6141,null));};exports[_0xb88b('0x31')]=function(_0x20df2a,_0x56d8a9){return db[_0xb88b('0x1d')]['create'](_0x20df2a[_0xb88b('0x32')],{})[_0xb88b('0x14')](function(_0x21c726){var _0x237163=_0x20df2a['user'][_0xb88b('0x33')]({'plain':!![]});if(!_0x237163)throw new Error(_0xb88b('0x34'));if(_0x237163[_0xb88b('0x35')]===_0xb88b('0x36')){var _0x4078ed=_0x21c726[_0xb88b('0x33')]({'plain':!![]});var _0x2833a=_0xb88b('0x15');return db[_0xb88b('0x37')][_0xb88b('0x38')]({'where':{'name':_0x2833a,'userProfileId':_0x237163[_0xb88b('0x39')]},'raw':!![]})[_0xb88b('0x14')](function(_0x502f63){if(_0x502f63&&_0x502f63[_0xb88b('0x3a')]===0x0){return db[_0xb88b('0x16')][_0xb88b('0x31')]({'name':_0x4078ed['name'],'resourceId':_0x4078ed['id'],'type':_0x502f63[_0xb88b('0x1a')],'sectionId':_0x502f63['id']},{})[_0xb88b('0x14')](function(){return _0x21c726;});}else{return _0x21c726;}})['catch'](function(_0x55b1ec){logger[_0xb88b('0x18')](_0xb88b('0x3b'),_0x55b1ec);throw _0x55b1ec;});}return _0x21c726;})['then'](respondWithResult(_0x56d8a9,0xc9))['catch'](handleError(_0x56d8a9,null));};exports[_0xb88b('0x3c')]=function(_0x24bed2,_0x4ce61a){if(_0x24bed2['body']['id']){delete _0x24bed2['body']['id'];}return db[_0xb88b('0x1d')][_0xb88b('0x38')]({'where':{'id':_0x24bed2[_0xb88b('0x26')]['id']}})[_0xb88b('0x14')](handleEntityNotFound(_0x4ce61a,null))['then'](saveUpdates(_0x24bed2[_0xb88b('0x32')],null))[_0xb88b('0x14')](respondWithResult(_0x4ce61a,null))[_0xb88b('0x25')](handleError(_0x4ce61a,null));};exports[_0xb88b('0x17')]=function(_0x39fbda,_0x3720cf){return db[_0xb88b('0x1d')][_0xb88b('0x38')]({'where':{'id':_0x39fbda[_0xb88b('0x26')]['id']}})['then'](handleEntityNotFound(_0x3720cf,null))[_0xb88b('0x14')](removeEntity(_0x3720cf,null))[_0xb88b('0x25')](handleError(_0x3720cf,null));};exports['describe']=function(_0x30ba0f,_0x35a44d){return db[_0xb88b('0x1d')][_0xb88b('0x3d')]()[_0xb88b('0x14')](respondWithResult(_0x35a44d,null))[_0xb88b('0x25')](handleError(_0x35a44d,null));};exports[_0xb88b('0x3e')]=function(_0x4b693a,_0x28a7ef){var _0x2e520b={'raw':!![],'where':{}},_0x185c30={},_0x58caaa;return db[_0xb88b('0x1d')][_0xb88b('0x3f')]({'where':{'id':_0x4b693a['params']['id']}})[_0xb88b('0x14')](handleEntityNotFound(_0x28a7ef,null))[_0xb88b('0x14')](function(_0x56651d){if(_0x56651d){_0x58caaa=_0x56651d[_0xb88b('0x33')]({'plain':!![]});_0x185c30[_0xb88b('0x27')]=_[_0xb88b('0x28')](db[_0xb88b('0x40')][_0xb88b('0x1e')]);_0x185c30['query']=_['keys'](_0x4b693a[_0xb88b('0x24')]);_0x185c30['filters']=_[_0xb88b('0x2a')](_0x185c30[_0xb88b('0x27')],_0x185c30[_0xb88b('0x24')]);_0x2e520b[_0xb88b('0x2b')]=_['intersection'](_0x185c30['model'],qs[_0xb88b('0x2c')](_0x4b693a[_0xb88b('0x24')][_0xb88b('0x2c')]));_0x2e520b['attributes']=_0x2e520b['attributes']['length']?_0x2e520b[_0xb88b('0x2b')]:_0x185c30[_0xb88b('0x27')];if(!_0x4b693a[_0xb88b('0x24')][_0xb88b('0x41')](_0xb88b('0x42'))){_0x2e520b['limit']=qs[_0xb88b('0xf')](_0x4b693a['query'][_0xb88b('0xf')]);_0x2e520b['offset']=qs[_0xb88b('0x11')](_0x4b693a['query']['offset']);}_0x2e520b['order']=qs[_0xb88b('0x43')](_0x4b693a['query'][_0xb88b('0x43')]);_0x2e520b[_0xb88b('0x22')]=qs[_0xb88b('0x29')](_['pick'](_0x4b693a[_0xb88b('0x24')],_0x185c30['filters']));_0x2e520b[_0xb88b('0x22')][_0xb88b('0x44')]=_0x56651d['id'];if(_0x4b693a[_0xb88b('0x24')][_0xb88b('0x45')]){_0x2e520b['where']=_['merge'](_0x2e520b[_0xb88b('0x22')],{'$or':_['map'](_0x2e520b[_0xb88b('0x2b')],function(_0x5e76ce){var _0x3c5efa={};_0x3c5efa[_0x5e76ce]={'$like':'%'+_0x4b693a[_0xb88b('0x24')][_0xb88b('0x45')]+'%'};return _0x3c5efa;})});}_0x2e520b=_['merge']({},_0x2e520b,_0x4b693a[_0xb88b('0x30')]);return db[_0xb88b('0x40')][_0xb88b('0x46')](_0x2e520b);}})[_0xb88b('0x14')](function(_0x452b6b){if(_0x452b6b){return db[_0xb88b('0x47')]['findAndCountAll']({'where':{'id':_[_0xb88b('0x1c')](_0x452b6b,_0xb88b('0x48')),'role':_0xb88b('0x49')},'attributes':['id','name',_0xb88b('0x4a'),_0xb88b('0x4b'),_0xb88b('0x4c')]});}})['then'](function(_0x381ec9){if(_0x381ec9){return{'count':_0x381ec9[_0xb88b('0x10')],'rows':_[_0xb88b('0x1c')](_0x381ec9[_0xb88b('0x4d')],function(_0x4c4401){return{'membername':_0x4c4401[_0xb88b('0x1a')],'UserId':_0x4c4401['id'],'queue_name':_0x58caaa[_0xb88b('0x1a')],'ChatQueueId':_0x58caaa['id'],'interface':util[_0xb88b('0x4e')]('%s/%s',_0xb88b('0x4f'),_0x4c4401[_0xb88b('0x1a')]),'penalty':0x0,'paused':_0x4c4401[_0xb88b('0x4a')],'createdAt':_0x4c4401['createdAt'],'updatedAt':_0x4c4401[_0xb88b('0x4b')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xb88b('0x14')](respondWithFilteredResult(_0x28a7ef,_0x2e520b))['catch'](handleError(_0x28a7ef,null));};exports[_0xb88b('0x50')]=function(_0x21e209,_0x17cea5){var _0x1a75f3={};var _0x11fc41={};var _0x2ec9f9;var _0x52ef4b;return db[_0xb88b('0x1d')]['findOne']({'where':{'id':_0x21e209[_0xb88b('0x26')]['id']}})['then'](handleEntityNotFound(_0x17cea5,null))[_0xb88b('0x14')](function(_0xa27099){if(_0xa27099){_0x2ec9f9=_0xa27099;_0x11fc41[_0xb88b('0x27')]=_[_0xb88b('0x28')](db[_0xb88b('0x51')]['rawAttributes']);_0x11fc41[_0xb88b('0x24')]=_[_0xb88b('0x28')](_0x21e209[_0xb88b('0x24')]);_0x11fc41[_0xb88b('0x29')]=_[_0xb88b('0x2a')](_0x11fc41[_0xb88b('0x27')],_0x11fc41[_0xb88b('0x24')]);_0x1a75f3['attributes']=_[_0xb88b('0x2a')](_0x11fc41['model'],qs[_0xb88b('0x2c')](_0x21e209['query'][_0xb88b('0x2c')]));_0x1a75f3[_0xb88b('0x2b')]=_0x1a75f3[_0xb88b('0x2b')]['length']?_0x1a75f3[_0xb88b('0x2b')]:_0x11fc41[_0xb88b('0x27')];_0x1a75f3[_0xb88b('0x52')]=qs[_0xb88b('0x43')](_0x21e209[_0xb88b('0x24')][_0xb88b('0x43')]);_0x1a75f3[_0xb88b('0x22')]=qs['filters'](_[_0xb88b('0x53')](_0x21e209[_0xb88b('0x24')],_0x11fc41[_0xb88b('0x29')]));if(_0x21e209['query']['filter']){_0x1a75f3[_0xb88b('0x22')]=_[_0xb88b('0x2f')](_0x1a75f3[_0xb88b('0x22')],{'$or':_[_0xb88b('0x1c')](_0x1a75f3[_0xb88b('0x2b')],function(_0x48f3ad){var _0x101798={};_0x101798[_0x48f3ad]={'$like':'%'+_0x21e209[_0xb88b('0x24')]['filter']+'%'};return _0x101798;})});}_0x1a75f3=_[_0xb88b('0x2f')]({},_0x1a75f3,_0x21e209[_0xb88b('0x30')]);return _0x2ec9f9[_0xb88b('0x50')](_0x1a75f3);}})[_0xb88b('0x14')](function(_0x7bff22){if(_0x7bff22){_0x52ef4b=_0x7bff22['length'];if(!_0x21e209['query'][_0xb88b('0x41')]('nolimit')){_0x1a75f3['limit']=qs[_0xb88b('0xf')](_0x21e209[_0xb88b('0x24')]['limit']);_0x1a75f3[_0xb88b('0x11')]=qs[_0xb88b('0x11')](_0x21e209[_0xb88b('0x24')][_0xb88b('0x11')]);}return _0x2ec9f9[_0xb88b('0x50')](_0x1a75f3);}})[_0xb88b('0x14')](function(_0x537ada){if(_0x537ada){return _0x537ada?{'count':_0x52ef4b,'rows':_0x537ada}:null;}})[_0xb88b('0x14')](respondWithResult(_0x17cea5,null))[_0xb88b('0x25')](handleError(_0x17cea5,null));};exports['addTeams']=function(_0x7dfbfe,_0x2b9e6b){var _0x1260c7=_0x7dfbfe[_0xb88b('0x32')][_0xb88b('0x54')];return db[_0xb88b('0x51')][_0xb88b('0x46')]({'where':{'id':_0x1260c7},'attributes':['id'],'include':[{'model':db[_0xb88b('0x47')],'as':_0xb88b('0x55'),'attributes':['id',_0xb88b('0x1a'),'online',_0xb88b('0x56'),_0xb88b('0x57')],'raw':!![]}]})[_0xb88b('0x14')](function(_0x373bb8){if(_0x373bb8){var _0x558e2d=_[_0xb88b('0x58')](_0x373bb8,function(_0xa04b2b){var _0x166cf5=_0xa04b2b[_0xb88b('0x33')]({'plain':!![]});return _0x166cf5[_0xb88b('0x55')];});return db[_0xb88b('0x1d')]['find']({'where':{'id':_0x7dfbfe[_0xb88b('0x26')]['id']}})['then'](function(_0x40899c){return db[_0xb88b('0x59')][_0xb88b('0x5a')](function(_0x2ba189){return _0x40899c[_0xb88b('0x5b')](_0x1260c7,{'transaction':_0x2ba189})[_0xb88b('0x14')](function(){return BPromise[_0xb88b('0x5c')](_0x558e2d,function(_0x20d826){return db[_0xb88b('0x40')][_0xb88b('0x5d')]({'where':{'UserId':_0x20d826['id'],'ChatQueueId':_0x7dfbfe[_0xb88b('0x26')]['id']},'transaction':_0x2ba189});});})[_0xb88b('0x14')](function(){_0x558e2d[_0xb88b('0x5e')](function(_0x10f3cc){socket[_0xb88b('0x5f')]('userChatQueue:save',{'UserId':_0x10f3cc['id'],'ChatQueueId':_0x40899c['id']});});});});});}})[_0xb88b('0x14')](respondWithStatusCode(_0x2b9e6b,null))[_0xb88b('0x25')](handleError(_0x2b9e6b,null));};exports[_0xb88b('0x60')]=function(_0x157d8c,_0x3751ce){return db['Team'][_0xb88b('0x46')]({'where':{'id':_0x157d8c[_0xb88b('0x24')][_0xb88b('0x54')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xb88b('0x55'),'attributes':['id'],'raw':!![]}]})[_0xb88b('0x14')](handleEntityNotFound(_0x3751ce,null))[_0xb88b('0x14')](function(_0x1f75d9){var _0x12664a=_[_0xb88b('0x1c')](_0x1f75d9,'id');var _0x7c3782=[];var _0x5ec1db=[];var _0x1d4e51=squel[_0xb88b('0x61')]();_0x1d4e51['field']('tq.TeamId')[_0xb88b('0x62')]('team_has_chat_queues','tq')[_0xb88b('0x63')]('user_has_teams','ut',_0xb88b('0x64'))[_0xb88b('0x22')](_0xb88b('0x65'),_0x157d8c[_0xb88b('0x26')]['id']);for(var _0x5a8c9b=0x0;_0x5a8c9b<_0x1f75d9[_0xb88b('0x2d')];_0x5a8c9b+=0x1){let _0x54fab0=_0x1f75d9[_0x5a8c9b];for(var _0x90a1ab=0x0;_0x90a1ab<_0x54fab0[_0xb88b('0x55')]['length'];_0x90a1ab+=0x1){let _0x49d3a1=_0x54fab0['Agents'][_0x90a1ab];var _0x1a21fb=_0x1d4e51['clone']();_0x1a21fb['where'](_0xb88b('0x66'),_0x49d3a1['id']);_0x5ec1db[_0xb88b('0x67')](db['sequelize'][_0xb88b('0x24')](_0x1a21fb[_0xb88b('0x68')](),{'type':db[_0xb88b('0x59')][_0xb88b('0x69')]['SELECT']})['then'](function(_0x2d0046){if(_0x2d0046[_0xb88b('0x2d')]===0x1){return _0x49d3a1['id'];}else{var _0x557243=_[_0xb88b('0x6a')](_[_0xb88b('0x1c')](_0x2d0046,_0xb88b('0x6b')),function(_0x3f835a){return _[_0xb88b('0x6c')](_0x12664a,_0x3f835a);});if(_0x557243){return _0x49d3a1['id'];}}}));}}return BPromise[_0xb88b('0x6d')](_0x5ec1db)[_0xb88b('0x14')](function(_0x230745){_0x7c3782=_(_0x7c3782)[_0xb88b('0x6e')](_0x230745)['compact']()[_0xb88b('0x6f')]();return db[_0xb88b('0x1d')]['find']({'where':{'id':_0x157d8c[_0xb88b('0x26')]['id']}})[_0xb88b('0x14')](function(_0x4114eb){return db[_0xb88b('0x59')][_0xb88b('0x5a')](function(_0x2f8cc0){return _0x4114eb[_0xb88b('0x60')](_0x157d8c['query']['ids'],{'transaction':_0x2f8cc0})['then'](function(){if(!_[_0xb88b('0x70')](_0x7c3782)){return _0x4114eb[_0xb88b('0x71')](_0x7c3782,{'transaction':_0x2f8cc0});}})[_0xb88b('0x14')](function(){_0x7c3782[_0xb88b('0x5e')](function(_0x80b4b3){socket[_0xb88b('0x5f')](_0xb88b('0x72'),{'UserId':_0x80b4b3,'ChatQueueId':_0x4114eb['id']});});});});});});})[_0xb88b('0x14')](respondWithStatusCode(_0x3751ce,null))[_0xb88b('0x25')](handleError(_0x3751ce,null));};exports[_0xb88b('0x73')]=function(_0x22f5a3,_0x2cc510){return db['ChatQueue'][_0xb88b('0x38')]({'where':{'id':_0x22f5a3[_0xb88b('0x26')]['id']}})['then'](handleEntityNotFound(_0x2cc510,null))[_0xb88b('0x14')](function(_0x46e798){if(_0x46e798){return _0x46e798['addAgents'](_0x22f5a3['body'][_0xb88b('0x54')],_[_0xb88b('0x74')](_0x22f5a3[_0xb88b('0x32')],['ids','id'])||{})[_0xb88b('0x75')](function(_0x2dd4d4){for(var _0x3b5bac=0x0;_0x3b5bac<_0x22f5a3['body'][_0xb88b('0x54')][_0xb88b('0x2d')];_0x3b5bac+=0x1){socket[_0xb88b('0x5f')](_0xb88b('0x76'),{'UserId':Number(_0x22f5a3['body'][_0xb88b('0x54')][_0x3b5bac]),'ChatQueueId':Number(_0x22f5a3[_0xb88b('0x26')]['id'])});}return _0x2dd4d4;});}})[_0xb88b('0x14')](respondWithResult(_0x2cc510,null))['catch'](handleError(_0x2cc510,null));};exports[_0xb88b('0x71')]=function(_0x1d183f,_0xecaadc){return db[_0xb88b('0x1d')][_0xb88b('0x38')]({'where':{'id':_0x1d183f[_0xb88b('0x26')]['id']}})[_0xb88b('0x14')](handleEntityNotFound(_0xecaadc,null))[_0xb88b('0x14')](function(_0x3b97dd){if(_0x3b97dd){return _0x3b97dd[_0xb88b('0x71')](_0x1d183f[_0xb88b('0x24')][_0xb88b('0x54')])['then'](function(){if(_[_0xb88b('0x77')](_0x1d183f[_0xb88b('0x24')][_0xb88b('0x54')])){for(var _0x3af9f3=0x0;_0x3af9f3<_0x1d183f[_0xb88b('0x24')][_0xb88b('0x54')][_0xb88b('0x2d')];_0x3af9f3+=0x1){socket[_0xb88b('0x5f')](_0xb88b('0x72'),{'UserId':Number(_0x1d183f[_0xb88b('0x24')][_0xb88b('0x54')][_0x3af9f3]),'ChatQueueId':Number(_0x1d183f[_0xb88b('0x26')]['id'])});}}else{socket[_0xb88b('0x5f')](_0xb88b('0x72'),{'UserId':Number(_0x1d183f['query'][_0xb88b('0x54')]),'ChatQueueId':Number(_0x1d183f[_0xb88b('0x26')]['id'])});}});}})['then'](respondWithStatusCode(_0xecaadc,null))[_0xb88b('0x25')](handleError(_0xecaadc,null));};exports[_0xb88b('0x78')]=function(_0x58ecf0,_0x31df5f){var _0x386003={};var _0x40746f={};var _0x1ebe94;var _0x348be1;return db[_0xb88b('0x1d')][_0xb88b('0x3f')]({'where':{'id':_0x58ecf0['params']['id']}})[_0xb88b('0x14')](handleEntityNotFound(_0x31df5f,null))['then'](function(_0xd9cd9a){if(_0xd9cd9a){_0x1ebe94=_0xd9cd9a;_0x40746f[_0xb88b('0x27')]=_[_0xb88b('0x28')](db[_0xb88b('0x47')]['rawAttributes']);_0x40746f[_0xb88b('0x24')]=_[_0xb88b('0x28')](_0x58ecf0[_0xb88b('0x24')]);_0x40746f[_0xb88b('0x29')]=_[_0xb88b('0x2a')](_0x40746f[_0xb88b('0x27')],_0x40746f[_0xb88b('0x24')]);_0x386003[_0xb88b('0x2b')]=_[_0xb88b('0x2a')](_0x40746f['model'],qs['fields'](_0x58ecf0[_0xb88b('0x24')][_0xb88b('0x2c')]));_0x386003[_0xb88b('0x2b')]=_0x386003['attributes']['length']?_0x386003[_0xb88b('0x2b')]:_0x40746f[_0xb88b('0x27')];_0x386003[_0xb88b('0x52')]=qs[_0xb88b('0x43')](_0x58ecf0[_0xb88b('0x24')]['sort']);_0x386003['where']=qs[_0xb88b('0x29')](_['pick'](_0x58ecf0[_0xb88b('0x24')],_0x40746f[_0xb88b('0x29')]));if(_0x58ecf0[_0xb88b('0x24')][_0xb88b('0x45')]){_0x386003[_0xb88b('0x22')]=_[_0xb88b('0x2f')](_0x386003[_0xb88b('0x22')],{'$or':_[_0xb88b('0x1c')](_0x386003['attributes'],function(_0x4b1593){var _0x4f7255={};_0x4f7255[_0x4b1593]={'$like':'%'+_0x58ecf0[_0xb88b('0x24')][_0xb88b('0x45')]+'%'};return _0x4f7255;})});}_0x386003=_[_0xb88b('0x2f')]({},_0x386003,_0x58ecf0[_0xb88b('0x30')]);return _0x1ebe94['getAgents'](_0x386003);}})[_0xb88b('0x14')](function(_0x131765){if(_0x131765){_0x348be1=_0x131765[_0xb88b('0x2d')];if(!_0x58ecf0[_0xb88b('0x24')][_0xb88b('0x41')](_0xb88b('0x42'))){_0x386003['limit']=qs[_0xb88b('0xf')](_0x58ecf0[_0xb88b('0x24')]['limit']);_0x386003[_0xb88b('0x11')]=qs['offset'](_0x58ecf0['query']['offset']);}return _0x1ebe94[_0xb88b('0x78')](_0x386003);}})[_0xb88b('0x14')](function(_0x46fc49){if(_0x46fc49){return _0x46fc49?{'count':_0x348be1,'rows':_0x46fc49}:null;}})[_0xb88b('0x14')](respondWithResult(_0x31df5f,null))[_0xb88b('0x25')](handleError(_0x31df5f,null));}; \ No newline at end of file +var _0x8541=['every','TeamId','includes','all','union','value','transaction','ids','isEmpty','removeAgents','userChatQueue:remove','addAgents','omit','isArray','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','socket.io-emitter','./chatQueue.socket','end','status','json','offset','undefined','limit','set','Content-Range','update','then','destroy','get','ChatQueues','sendStatus','error','stack','name','ChatQueue','rawAttributes','fieldName','getOptions','count','include','query','findAll','catch','show','params','keys','intersection','model','attributes','fields','length','includeAll','merge','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','describe','getMembers','findOne','UserChatQueue','filters','hasOwnProperty','nolimit','order','sort','where','filter','User','findAndCountAll','map','chatPause','createdAt','rows','format','SIP','getTeams','Team','pick','addTeams','Agents','online','voicePause','interface','flatMap','sequelize','each','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','select','tq.TeamId','from','team_has_chat_queues','user_has_teams','ChatQueueId\x20=\x20?','clone','push','toString','SELECT'];(function(_0x5b5b2f,_0x59f174){var _0x274e33=function(_0x2a2342){while(--_0x2a2342){_0x5b5b2f['push'](_0x5b5b2f['shift']());}};_0x274e33(++_0x59f174);}(_0x8541,0xfd));var _0x1854=function(_0x1c7117,_0x1c3af2){_0x1c7117=_0x1c7117-0x0;var _0x5d3c3c=_0x8541[_0x1c7117];return _0x5d3c3c;};'use strict';var BPromise=require(_0x1854('0x0'));var util=require(_0x1854('0x1'));var _=require(_0x1854('0x2'));var squel=require(_0x1854('0x3'));var Redis=require(_0x1854('0x4'));var qs=require(_0x1854('0x5'));var logger=require(_0x1854('0x6'))(_0x1854('0x7'));var config=require('../../config/environment');var db=require(_0x1854('0x8'))['db'];config[_0x1854('0x9')]=_[_0x1854('0xa')](config[_0x1854('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x1854('0xb'))(new Redis(config[_0x1854('0x9')]));require(_0x1854('0xc'))['register'](socket);function respondWithStatusCode(_0x52d767,_0x16c963){_0x16c963=_0x16c963||0xcc;return function(_0xf4cff6){if(_0xf4cff6){return _0x52d767['sendStatus'](_0x16c963);}return _0x52d767['status'](_0x16c963)[_0x1854('0xd')]();};}function respondWithResult(_0x407443,_0x1bc02b){_0x1bc02b=_0x1bc02b||0xc8;return function(_0x54f658){if(_0x54f658){return _0x407443[_0x1854('0xe')](_0x1bc02b)[_0x1854('0xf')](_0x54f658);}};}function respondWithFilteredResult(_0x1ed32f,_0x2a0cf9){return function(_0x24cfdc){if(_0x24cfdc){var _0x35b770=typeof _0x2a0cf9[_0x1854('0x10')]===_0x1854('0x11')&&typeof _0x2a0cf9[_0x1854('0x12')]==='undefined';var _0x17c8ec=_0x24cfdc['count'];var _0x1ae8ed=_0x35b770?0x0:_0x2a0cf9[_0x1854('0x10')];var _0x503b1e=_0x35b770?_0x24cfdc['count']:_0x2a0cf9[_0x1854('0x10')]+_0x2a0cf9[_0x1854('0x12')];var _0x47a3ff;if(_0x503b1e>=_0x17c8ec){_0x503b1e=_0x17c8ec;_0x47a3ff=0xc8;}else{_0x47a3ff=0xce;}_0x1ed32f[_0x1854('0xe')](_0x47a3ff);return _0x1ed32f[_0x1854('0x13')](_0x1854('0x14'),_0x1ae8ed+'-'+_0x503b1e+'/'+_0x17c8ec)[_0x1854('0xf')](_0x24cfdc);}return null;};}function saveUpdates(_0x1cc594){return function(_0x1b1f9a){if(_0x1b1f9a){return _0x1b1f9a[_0x1854('0x15')](_0x1cc594)[_0x1854('0x16')](function(_0x3abf5d){return _0x3abf5d;});}return null;};}function removeEntity(_0xf5f0b5){return function(_0x5ea653){if(_0x5ea653){return _0x5ea653[_0x1854('0x17')]()[_0x1854('0x16')](function(){var _0xb4bd91=_0x5ea653[_0x1854('0x18')]({'plain':!![]});var _0x4cd4c6=_0x1854('0x19');return db['UserProfileResource'][_0x1854('0x17')]({'where':{'type':_0x4cd4c6,'resourceId':_0xb4bd91['id']}})['then'](function(){return _0x5ea653;});})[_0x1854('0x16')](function(){_0xf5f0b5['status'](0xcc)[_0x1854('0xd')]();});}};}function handleEntityNotFound(_0x1b9ada){return function(_0x1217be){if(!_0x1217be){_0x1b9ada[_0x1854('0x1a')](0x194);}return _0x1217be;};}function handleError(_0x4f8f03,_0x292900){_0x292900=_0x292900||0x1f4;return function(_0x5c6853){logger[_0x1854('0x1b')](_0x5c6853[_0x1854('0x1c')]);if(_0x5c6853[_0x1854('0x1d')]){delete _0x5c6853['name'];}_0x4f8f03['status'](_0x292900)['send'](_0x5c6853);};}exports['index']=function(_0x376db6,_0x6b9f83){var _0x29cdbe={};var _0x397a2c={'count':0x0,'rows':[]};var _0xafc05d=_['map'](db[_0x1854('0x1e')][_0x1854('0x1f')],function(_0x8c7b68){return{'name':_0x8c7b68[_0x1854('0x20')],'type':_0x8c7b68['type']['key']};});_0x29cdbe=qs[_0x1854('0x21')](_0xafc05d,_0x376db6);var _0x23b75c={'where':_0x29cdbe['where']};return db[_0x1854('0x1e')][_0x1854('0x22')](_0x23b75c)['then'](function(_0x208c85){_0x397a2c[_0x1854('0x22')]=_0x208c85;_0x29cdbe[_0x1854('0x23')]=qs['include'](_0x376db6[_0x1854('0x24')]);return db[_0x1854('0x1e')][_0x1854('0x25')](_0x29cdbe);})[_0x1854('0x16')](function(_0x149980){_0x397a2c['rows']=_0x149980;return _0x397a2c;})[_0x1854('0x16')](respondWithFilteredResult(_0x6b9f83,_0x29cdbe))[_0x1854('0x26')](handleError(_0x6b9f83,null));};exports[_0x1854('0x27')]=function(_0x424a95,_0xf9933f){var _0x49f013={'raw':!![],'where':{'id':_0x424a95[_0x1854('0x28')]['id']}},_0x5481c9={};_0x5481c9['model']=_[_0x1854('0x29')](db['ChatQueue'][_0x1854('0x1f')]);_0x5481c9[_0x1854('0x24')]=_[_0x1854('0x29')](_0x424a95[_0x1854('0x24')]);_0x5481c9['filters']=_[_0x1854('0x2a')](_0x5481c9[_0x1854('0x2b')],_0x5481c9[_0x1854('0x24')]);_0x49f013[_0x1854('0x2c')]=_[_0x1854('0x2a')](_0x5481c9[_0x1854('0x2b')],qs['fields'](_0x424a95[_0x1854('0x24')][_0x1854('0x2d')]));_0x49f013['attributes']=_0x49f013[_0x1854('0x2c')][_0x1854('0x2e')]?_0x49f013[_0x1854('0x2c')]:_0x5481c9[_0x1854('0x2b')];if(_0x424a95[_0x1854('0x24')][_0x1854('0x2f')]){_0x49f013[_0x1854('0x23')]=[{'all':!![]}];}_0x49f013=_[_0x1854('0x30')]({},_0x49f013,_0x424a95[_0x1854('0x31')]);return db[_0x1854('0x1e')][_0x1854('0x32')](_0x49f013)[_0x1854('0x16')](handleEntityNotFound(_0xf9933f,null))[_0x1854('0x16')](respondWithResult(_0xf9933f,null))[_0x1854('0x26')](handleError(_0xf9933f,null));};exports[_0x1854('0x33')]=function(_0x5e2ace,_0x28c966){return db[_0x1854('0x1e')][_0x1854('0x33')](_0x5e2ace[_0x1854('0x34')],{})['then'](function(_0x45a5fb){var _0x1cb58b=_0x5e2ace['user'][_0x1854('0x18')]({'plain':!![]});if(!_0x1cb58b)throw new Error(_0x1854('0x35'));if(_0x1cb58b['role']===_0x1854('0x36')){var _0x3b3b22=_0x45a5fb['get']({'plain':!![]});var _0x2de7d7=_0x1854('0x19');return db[_0x1854('0x37')]['find']({'where':{'name':_0x2de7d7,'userProfileId':_0x1cb58b[_0x1854('0x38')]},'raw':!![]})[_0x1854('0x16')](function(_0xc828e1){if(_0xc828e1&&_0xc828e1[_0x1854('0x39')]===0x0){return db[_0x1854('0x3a')]['create']({'name':_0x3b3b22[_0x1854('0x1d')],'resourceId':_0x3b3b22['id'],'type':_0xc828e1[_0x1854('0x1d')],'sectionId':_0xc828e1['id']},{})[_0x1854('0x16')](function(){return _0x45a5fb;});}else{return _0x45a5fb;}})[_0x1854('0x26')](function(_0x41b783){logger[_0x1854('0x1b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x41b783);throw _0x41b783;});}return _0x45a5fb;})['then'](respondWithResult(_0x28c966,0xc9))[_0x1854('0x26')](handleError(_0x28c966,null));};exports[_0x1854('0x15')]=function(_0x19b435,_0x4b6f49){if(_0x19b435['body']['id']){delete _0x19b435[_0x1854('0x34')]['id'];}return db[_0x1854('0x1e')][_0x1854('0x32')]({'where':{'id':_0x19b435[_0x1854('0x28')]['id']}})[_0x1854('0x16')](handleEntityNotFound(_0x4b6f49,null))[_0x1854('0x16')](saveUpdates(_0x19b435[_0x1854('0x34')],null))[_0x1854('0x16')](respondWithResult(_0x4b6f49,null))['catch'](handleError(_0x4b6f49,null));};exports[_0x1854('0x17')]=function(_0x17dfb8,_0x198c62){return db[_0x1854('0x1e')][_0x1854('0x32')]({'where':{'id':_0x17dfb8[_0x1854('0x28')]['id']}})[_0x1854('0x16')](handleEntityNotFound(_0x198c62,null))[_0x1854('0x16')](removeEntity(_0x198c62,null))[_0x1854('0x26')](handleError(_0x198c62,null));};exports[_0x1854('0x3b')]=function(_0xfc8eee,_0x356e25){return db[_0x1854('0x1e')][_0x1854('0x3b')]()[_0x1854('0x16')](respondWithResult(_0x356e25,null))[_0x1854('0x26')](handleError(_0x356e25,null));};exports[_0x1854('0x3c')]=function(_0x4b8b2f,_0x324617){var _0x28f680={'raw':!![],'where':{}},_0x30c8d0={},_0x59dba7;return db[_0x1854('0x1e')][_0x1854('0x3d')]({'where':{'id':_0x4b8b2f['params']['id']}})[_0x1854('0x16')](handleEntityNotFound(_0x324617,null))[_0x1854('0x16')](function(_0xb72c65){if(_0xb72c65){_0x59dba7=_0xb72c65[_0x1854('0x18')]({'plain':!![]});_0x30c8d0['model']=_['keys'](db[_0x1854('0x3e')]['rawAttributes']);_0x30c8d0['query']=_[_0x1854('0x29')](_0x4b8b2f[_0x1854('0x24')]);_0x30c8d0[_0x1854('0x3f')]=_[_0x1854('0x2a')](_0x30c8d0[_0x1854('0x2b')],_0x30c8d0[_0x1854('0x24')]);_0x28f680[_0x1854('0x2c')]=_[_0x1854('0x2a')](_0x30c8d0[_0x1854('0x2b')],qs[_0x1854('0x2d')](_0x4b8b2f[_0x1854('0x24')]['fields']));_0x28f680['attributes']=_0x28f680[_0x1854('0x2c')][_0x1854('0x2e')]?_0x28f680[_0x1854('0x2c')]:_0x30c8d0[_0x1854('0x2b')];if(!_0x4b8b2f[_0x1854('0x24')][_0x1854('0x40')](_0x1854('0x41'))){_0x28f680[_0x1854('0x12')]=qs[_0x1854('0x12')](_0x4b8b2f[_0x1854('0x24')][_0x1854('0x12')]);_0x28f680[_0x1854('0x10')]=qs['offset'](_0x4b8b2f[_0x1854('0x24')][_0x1854('0x10')]);}_0x28f680[_0x1854('0x42')]=qs[_0x1854('0x43')](_0x4b8b2f[_0x1854('0x24')]['sort']);_0x28f680[_0x1854('0x44')]=qs['filters'](_['pick'](_0x4b8b2f[_0x1854('0x24')],_0x30c8d0['filters']));_0x28f680[_0x1854('0x44')]['ChatQueueId']=_0xb72c65['id'];if(_0x4b8b2f['query'][_0x1854('0x45')]){_0x28f680[_0x1854('0x44')]=_[_0x1854('0x30')](_0x28f680['where'],{'$or':_['map'](_0x28f680[_0x1854('0x2c')],function(_0x5c33b1){var _0x4af719={};_0x4af719[_0x5c33b1]={'$like':'%'+_0x4b8b2f['query']['filter']+'%'};return _0x4af719;})});}_0x28f680=_[_0x1854('0x30')]({},_0x28f680,_0x4b8b2f[_0x1854('0x31')]);return db[_0x1854('0x3e')]['findAll'](_0x28f680);}})['then'](function(_0x7e1602){if(_0x7e1602){return db[_0x1854('0x46')][_0x1854('0x47')]({'where':{'id':_[_0x1854('0x48')](_0x7e1602,'UserId'),'role':'agent'},'attributes':['id',_0x1854('0x1d'),_0x1854('0x49'),'updatedAt',_0x1854('0x4a')]});}})[_0x1854('0x16')](function(_0x124784){if(_0x124784){return{'count':_0x124784[_0x1854('0x22')],'rows':_[_0x1854('0x48')](_0x124784[_0x1854('0x4b')],function(_0xdbdecd){return{'membername':_0xdbdecd[_0x1854('0x1d')],'UserId':_0xdbdecd['id'],'queue_name':_0x59dba7[_0x1854('0x1d')],'ChatQueueId':_0x59dba7['id'],'interface':util[_0x1854('0x4c')]('%s/%s',_0x1854('0x4d'),_0xdbdecd[_0x1854('0x1d')]),'penalty':0x0,'paused':_0xdbdecd['chatPause'],'createdAt':_0xdbdecd['createdAt'],'updatedAt':_0xdbdecd['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x1854('0x16')](respondWithFilteredResult(_0x324617,_0x28f680))['catch'](handleError(_0x324617,null));};exports[_0x1854('0x4e')]=function(_0x1cf437,_0x1f0473){var _0x1e3c71={};var _0x183c44={};var _0x3e0cdd;var _0x111440;return db['ChatQueue'][_0x1854('0x3d')]({'where':{'id':_0x1cf437[_0x1854('0x28')]['id']}})['then'](handleEntityNotFound(_0x1f0473,null))[_0x1854('0x16')](function(_0x5b147e){if(_0x5b147e){_0x3e0cdd=_0x5b147e;_0x183c44[_0x1854('0x2b')]=_[_0x1854('0x29')](db[_0x1854('0x4f')][_0x1854('0x1f')]);_0x183c44['query']=_[_0x1854('0x29')](_0x1cf437[_0x1854('0x24')]);_0x183c44[_0x1854('0x3f')]=_['intersection'](_0x183c44[_0x1854('0x2b')],_0x183c44[_0x1854('0x24')]);_0x1e3c71[_0x1854('0x2c')]=_[_0x1854('0x2a')](_0x183c44['model'],qs['fields'](_0x1cf437[_0x1854('0x24')][_0x1854('0x2d')]));_0x1e3c71[_0x1854('0x2c')]=_0x1e3c71['attributes']['length']?_0x1e3c71[_0x1854('0x2c')]:_0x183c44['model'];_0x1e3c71['order']=qs[_0x1854('0x43')](_0x1cf437[_0x1854('0x24')]['sort']);_0x1e3c71['where']=qs[_0x1854('0x3f')](_[_0x1854('0x50')](_0x1cf437[_0x1854('0x24')],_0x183c44[_0x1854('0x3f')]));if(_0x1cf437[_0x1854('0x24')][_0x1854('0x45')]){_0x1e3c71[_0x1854('0x44')]=_[_0x1854('0x30')](_0x1e3c71[_0x1854('0x44')],{'$or':_[_0x1854('0x48')](_0x1e3c71[_0x1854('0x2c')],function(_0x3276ed){var _0x11f559={};_0x11f559[_0x3276ed]={'$like':'%'+_0x1cf437[_0x1854('0x24')][_0x1854('0x45')]+'%'};return _0x11f559;})});}_0x1e3c71=_[_0x1854('0x30')]({},_0x1e3c71,_0x1cf437[_0x1854('0x31')]);return _0x3e0cdd['getTeams'](_0x1e3c71);}})[_0x1854('0x16')](function(_0x3dd654){if(_0x3dd654){_0x111440=_0x3dd654[_0x1854('0x2e')];if(!_0x1cf437['query']['hasOwnProperty'](_0x1854('0x41'))){_0x1e3c71['limit']=qs[_0x1854('0x12')](_0x1cf437[_0x1854('0x24')][_0x1854('0x12')]);_0x1e3c71[_0x1854('0x10')]=qs[_0x1854('0x10')](_0x1cf437['query'][_0x1854('0x10')]);}return _0x3e0cdd[_0x1854('0x4e')](_0x1e3c71);}})['then'](function(_0x2c874e){if(_0x2c874e){return _0x2c874e?{'count':_0x111440,'rows':_0x2c874e}:null;}})[_0x1854('0x16')](respondWithResult(_0x1f0473,null))[_0x1854('0x26')](handleError(_0x1f0473,null));};exports[_0x1854('0x51')]=function(_0x17ec30,_0x333136){var _0x524923=_0x17ec30[_0x1854('0x34')]['ids'];return db[_0x1854('0x4f')][_0x1854('0x25')]({'where':{'id':_0x524923},'attributes':['id'],'include':[{'model':db['User'],'as':_0x1854('0x52'),'attributes':['id',_0x1854('0x1d'),_0x1854('0x53'),_0x1854('0x54'),_0x1854('0x55')],'raw':!![]}]})[_0x1854('0x16')](function(_0x358b86){if(_0x358b86){var _0x4ae7f5=_[_0x1854('0x56')](_0x358b86,function(_0xda9fea){var _0xa1ae1a=_0xda9fea[_0x1854('0x18')]({'plain':!![]});return _0xa1ae1a[_0x1854('0x52')];});return db[_0x1854('0x1e')][_0x1854('0x32')]({'where':{'id':_0x17ec30[_0x1854('0x28')]['id']}})[_0x1854('0x16')](function(_0x535bd9){return db[_0x1854('0x57')]['transaction'](function(_0x1f4c17){return _0x535bd9[_0x1854('0x51')](_0x524923,{'transaction':_0x1f4c17})[_0x1854('0x16')](function(){return BPromise[_0x1854('0x58')](_0x4ae7f5,function(_0x14e30b){return db[_0x1854('0x3e')][_0x1854('0x59')]({'where':{'UserId':_0x14e30b['id'],'ChatQueueId':_0x17ec30[_0x1854('0x28')]['id']},'transaction':_0x1f4c17});});})[_0x1854('0x16')](function(){_0x4ae7f5[_0x1854('0x5a')](function(_0x2edb1a){socket[_0x1854('0x5b')](_0x1854('0x5c'),{'UserId':_0x2edb1a['id'],'ChatQueueId':_0x535bd9['id']});});});});});}})[_0x1854('0x16')](respondWithStatusCode(_0x333136,null))[_0x1854('0x26')](handleError(_0x333136,null));};exports[_0x1854('0x5d')]=function(_0x1c4485,_0x30b6d2){return db[_0x1854('0x4f')][_0x1854('0x25')]({'where':{'id':_0x1c4485[_0x1854('0x24')]['ids']},'attributes':['id'],'include':[{'model':db[_0x1854('0x46')],'as':_0x1854('0x52'),'attributes':['id'],'raw':!![]}]})[_0x1854('0x16')](handleEntityNotFound(_0x30b6d2,null))[_0x1854('0x16')](function(_0x510df3){var _0x145332=_['map'](_0x510df3,'id');var _0x399ccf=[];var _0x3a4c26=[];var _0x78508a=squel[_0x1854('0x5e')]();_0x78508a['field'](_0x1854('0x5f'))[_0x1854('0x60')](_0x1854('0x61'),'tq')['join'](_0x1854('0x62'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x1854('0x63'),_0x1c4485[_0x1854('0x28')]['id']);for(var _0x14a4ef=0x0;_0x14a4ef<_0x510df3[_0x1854('0x2e')];_0x14a4ef+=0x1){let _0x841532=_0x510df3[_0x14a4ef];for(var _0x139de6=0x0;_0x139de6<_0x841532[_0x1854('0x52')][_0x1854('0x2e')];_0x139de6+=0x1){let _0x233420=_0x841532[_0x1854('0x52')][_0x139de6];var _0xe1ed60=_0x78508a[_0x1854('0x64')]();_0xe1ed60[_0x1854('0x44')]('ut.UserId\x20=\x20?',_0x233420['id']);_0x3a4c26[_0x1854('0x65')](db[_0x1854('0x57')][_0x1854('0x24')](_0xe1ed60[_0x1854('0x66')](),{'type':db[_0x1854('0x57')]['QueryTypes'][_0x1854('0x67')]})['then'](function(_0x3711d0){if(_0x3711d0['length']===0x1){return _0x233420['id'];}else{var _0x178927=_[_0x1854('0x68')](_['map'](_0x3711d0,_0x1854('0x69')),function(_0x395e50){return _[_0x1854('0x6a')](_0x145332,_0x395e50);});if(_0x178927){return _0x233420['id'];}}}));}}return BPromise[_0x1854('0x6b')](_0x3a4c26)[_0x1854('0x16')](function(_0x265264){_0x399ccf=_(_0x399ccf)[_0x1854('0x6c')](_0x265264)['compact']()[_0x1854('0x6d')]();return db['ChatQueue'][_0x1854('0x32')]({'where':{'id':_0x1c4485[_0x1854('0x28')]['id']}})[_0x1854('0x16')](function(_0x3ab765){return db[_0x1854('0x57')][_0x1854('0x6e')](function(_0x2147cd){return _0x3ab765[_0x1854('0x5d')](_0x1c4485[_0x1854('0x24')][_0x1854('0x6f')],{'transaction':_0x2147cd})[_0x1854('0x16')](function(){if(!_[_0x1854('0x70')](_0x399ccf)){return _0x3ab765[_0x1854('0x71')](_0x399ccf,{'transaction':_0x2147cd});}})['then'](function(){_0x399ccf[_0x1854('0x5a')](function(_0x5eb1f5){socket[_0x1854('0x5b')](_0x1854('0x72'),{'UserId':_0x5eb1f5,'ChatQueueId':_0x3ab765['id']});});});});});});})[_0x1854('0x16')](respondWithStatusCode(_0x30b6d2,null))[_0x1854('0x26')](handleError(_0x30b6d2,null));};exports[_0x1854('0x73')]=function(_0x31c472,_0x5bc0f5){return db['ChatQueue'][_0x1854('0x32')]({'where':{'id':_0x31c472[_0x1854('0x28')]['id']}})[_0x1854('0x16')](handleEntityNotFound(_0x5bc0f5,null))['then'](function(_0x38366a){if(_0x38366a){return _0x38366a['addAgents'](_0x31c472[_0x1854('0x34')]['ids'],_[_0x1854('0x74')](_0x31c472[_0x1854('0x34')],[_0x1854('0x6f'),'id'])||{})['spread'](function(_0x5ada4a){for(var _0x59ccaa=0x0;_0x59ccaa<_0x31c472[_0x1854('0x34')][_0x1854('0x6f')][_0x1854('0x2e')];_0x59ccaa+=0x1){socket[_0x1854('0x5b')](_0x1854('0x5c'),{'UserId':Number(_0x31c472[_0x1854('0x34')][_0x1854('0x6f')][_0x59ccaa]),'ChatQueueId':Number(_0x31c472[_0x1854('0x28')]['id'])});}return _0x5ada4a;});}})[_0x1854('0x16')](respondWithResult(_0x5bc0f5,null))[_0x1854('0x26')](handleError(_0x5bc0f5,null));};exports['removeAgents']=function(_0x263e74,_0x378e1e){return db[_0x1854('0x1e')][_0x1854('0x32')]({'where':{'id':_0x263e74[_0x1854('0x28')]['id']}})[_0x1854('0x16')](handleEntityNotFound(_0x378e1e,null))[_0x1854('0x16')](function(_0x5aa113){if(_0x5aa113){return _0x5aa113[_0x1854('0x71')](_0x263e74[_0x1854('0x24')][_0x1854('0x6f')])[_0x1854('0x16')](function(){if(_[_0x1854('0x75')](_0x263e74[_0x1854('0x24')][_0x1854('0x6f')])){for(var _0x1c3ea0=0x0;_0x1c3ea0<_0x263e74[_0x1854('0x24')]['ids'][_0x1854('0x2e')];_0x1c3ea0+=0x1){socket['emit']('userChatQueue:remove',{'UserId':Number(_0x263e74[_0x1854('0x24')][_0x1854('0x6f')][_0x1c3ea0]),'ChatQueueId':Number(_0x263e74[_0x1854('0x28')]['id'])});}}else{socket[_0x1854('0x5b')](_0x1854('0x72'),{'UserId':Number(_0x263e74[_0x1854('0x24')][_0x1854('0x6f')]),'ChatQueueId':Number(_0x263e74[_0x1854('0x28')]['id'])});}});}})[_0x1854('0x16')](respondWithStatusCode(_0x378e1e,null))['catch'](handleError(_0x378e1e,null));};exports['getAgents']=function(_0x45d2ec,_0x36e2ec){var _0x287bb3={};var _0xad9589={};var _0x525017;var _0x23a6be;return db[_0x1854('0x1e')]['findOne']({'where':{'id':_0x45d2ec['params']['id']}})[_0x1854('0x16')](handleEntityNotFound(_0x36e2ec,null))[_0x1854('0x16')](function(_0x4960bc){if(_0x4960bc){_0x525017=_0x4960bc;_0xad9589[_0x1854('0x2b')]=_[_0x1854('0x29')](db['User'][_0x1854('0x1f')]);_0xad9589[_0x1854('0x24')]=_[_0x1854('0x29')](_0x45d2ec[_0x1854('0x24')]);_0xad9589[_0x1854('0x3f')]=_[_0x1854('0x2a')](_0xad9589[_0x1854('0x2b')],_0xad9589[_0x1854('0x24')]);_0x287bb3[_0x1854('0x2c')]=_[_0x1854('0x2a')](_0xad9589[_0x1854('0x2b')],qs[_0x1854('0x2d')](_0x45d2ec[_0x1854('0x24')][_0x1854('0x2d')]));_0x287bb3[_0x1854('0x2c')]=_0x287bb3[_0x1854('0x2c')][_0x1854('0x2e')]?_0x287bb3['attributes']:_0xad9589[_0x1854('0x2b')];_0x287bb3[_0x1854('0x42')]=qs[_0x1854('0x43')](_0x45d2ec[_0x1854('0x24')][_0x1854('0x43')]);_0x287bb3['where']=qs['filters'](_['pick'](_0x45d2ec['query'],_0xad9589['filters']));if(_0x45d2ec[_0x1854('0x24')][_0x1854('0x45')]){_0x287bb3[_0x1854('0x44')]=_['merge'](_0x287bb3[_0x1854('0x44')],{'$or':_[_0x1854('0x48')](_0x287bb3[_0x1854('0x2c')],function(_0x560f73){var _0x6eb3b8={};_0x6eb3b8[_0x560f73]={'$like':'%'+_0x45d2ec[_0x1854('0x24')][_0x1854('0x45')]+'%'};return _0x6eb3b8;})});}_0x287bb3=_[_0x1854('0x30')]({},_0x287bb3,_0x45d2ec[_0x1854('0x31')]);return _0x525017[_0x1854('0x76')](_0x287bb3);}})[_0x1854('0x16')](function(_0x2a32a7){if(_0x2a32a7){_0x23a6be=_0x2a32a7['length'];if(!_0x45d2ec[_0x1854('0x24')][_0x1854('0x40')](_0x1854('0x41'))){_0x287bb3[_0x1854('0x12')]=qs['limit'](_0x45d2ec[_0x1854('0x24')][_0x1854('0x12')]);_0x287bb3['offset']=qs['offset'](_0x45d2ec['query']['offset']);}return _0x525017[_0x1854('0x76')](_0x287bb3);}})[_0x1854('0x16')](function(_0x5963e8){if(_0x5963e8){return _0x5963e8?{'count':_0x23a6be,'rows':_0x5963e8}:null;}})['then'](respondWithResult(_0x36e2ec,null))[_0x1854('0x26')](handleError(_0x36e2ec,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index f417cb2..215c031 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 _0xe35f=['events','ChatQueue','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x512d4f,_0xb1b718){var _0x2dc3a0=function(_0xc1b01b){while(--_0xc1b01b){_0x512d4f['push'](_0x512d4f['shift']());}};_0x2dc3a0(++_0xb1b718);}(_0xe35f,0x140));var _0xfe35=function(_0x15b3a0,_0x38bbf0){_0x15b3a0=_0x15b3a0-0x0;var _0x4cfc99=_0xe35f[_0x15b3a0];return _0x4cfc99;};'use strict';var EventEmitter=require(_0xfe35('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0xfe35('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xfe35('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xfe35('0x3'),'afterDestroy':_0xfe35('0x4')};function emitEvent(_0x288435){return function(_0x52b875,_0x566e85,_0x2f6401){ChatQueueEvents[_0xfe35('0x5')](_0x288435+':'+_0x52b875['id'],_0x52b875);ChatQueueEvents[_0xfe35('0x5')](_0x288435,_0x52b875);_0x2f6401(null);};}for(var e in events){if(events[_0xfe35('0x6')](e)){var event=events[e];ChatQueue[_0xfe35('0x7')](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file +var _0xd056=['hook','exports','../../mysqldb','ChatQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x5ac257,_0x5b60ad){var _0x4e0118=function(_0x31a28e){while(--_0x31a28e){_0x5ac257['push'](_0x5ac257['shift']());}};_0x4e0118(++_0x5b60ad);}(_0xd056,0x142));var _0x6d05=function(_0x138a70,_0x50cb30){_0x138a70=_0x138a70-0x0;var _0x505885=_0xd056[_0x138a70];return _0x505885;};'use strict';var EventEmitter=require('events');var ChatQueue=require(_0x6d05('0x0'))['db'][_0x6d05('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x6d05('0x2')](0x0);var events={'afterCreate':_0x6d05('0x3'),'afterUpdate':_0x6d05('0x4'),'afterDestroy':_0x6d05('0x5')};function emitEvent(_0x463830){return function(_0x55a338,_0x439ee9,_0x1367e9){ChatQueueEvents[_0x6d05('0x6')](_0x463830+':'+_0x55a338['id'],_0x55a338);ChatQueueEvents[_0x6d05('0x6')](_0x463830,_0x55a338);_0x1367e9(null);};}for(var e in events){if(events[_0x6d05('0x7')](e)){var event=events[e];ChatQueue[_0x6d05('0x8')](e,emitEvent(event));}}module[_0x6d05('0x9')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 6011096..d5fadc9 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 _0x758f=['request-promise','path','rimraf','../../config/environment','./chatQueue.attributes','exports','define','ChatQueue','chat_queues','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x367e5b,_0x5721e4){var _0x4b909e=function(_0x22c6a4){while(--_0x22c6a4){_0x367e5b['push'](_0x367e5b['shift']());}};_0x4b909e(++_0x5721e4);}(_0x758f,0x180));var _0xf758=function(_0x2f8000,_0x37c02b){_0x2f8000=_0x2f8000-0x0;var _0x25cfee=_0x758f[_0x2f8000];return _0x25cfee;};'use strict';var _=require(_0xf758('0x0'));var util=require(_0xf758('0x1'));var logger=require(_0xf758('0x2'))(_0xf758('0x3'));var moment=require(_0xf758('0x4'));var BPromise=require(_0xf758('0x5'));var rp=require(_0xf758('0x6'));var fs=require('fs');var path=require(_0xf758('0x7'));var rimraf=require(_0xf758('0x8'));var config=require(_0xf758('0x9'));var attributes=require(_0xf758('0xa'));module[_0xf758('0xb')]=function(_0x9ac051,_0x311ed0){return _0x9ac051[_0xf758('0xc')](_0xf758('0xd'),attributes,{'tableName':_0xf758('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa733=['bluebird','request-promise','path','rimraf','../../config/environment','./chatQueue.attributes','exports','define','ChatQueue','chat_queues','util','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa733,0x9a));var _0x3a73=function(_0x2b2375,_0x31530b){_0x2b2375=_0x2b2375-0x0;var _0x258f3a=_0xa733[_0x2b2375];return _0x258f3a;};'use strict';var _=require('lodash');var util=require(_0x3a73('0x0'));var logger=require(_0x3a73('0x1'))('api');var moment=require('moment');var BPromise=require(_0x3a73('0x2'));var rp=require(_0x3a73('0x3'));var fs=require('fs');var path=require(_0x3a73('0x4'));var rimraf=require(_0x3a73('0x5'));var config=require(_0x3a73('0x6'));var attributes=require(_0x3a73('0x7'));module[_0x3a73('0x8')]=function(_0x223cdc,_0x113dbe){return _0x223cdc[_0x3a73('0x9')](_0x3a73('0xa'),attributes,{'tableName':_0x3a73('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.rpc.js b/server/api/chatQueue/chatQueue.rpc.js index 852fb28..b51a14c 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 _0x7497=['stringify','ShowChatQueue','find','lodash','util','moment','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','ChatQueue,\x20%s,\x20%s','ChatQueue,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','ChatQueue','findAll','options','raw','where','attributes','limit','include','map','model','GetChatQueue','debug'];(function(_0x1625d5,_0x2cb18b){var _0x5f0d99=function(_0x23cbb8){while(--_0x23cbb8){_0x1625d5['push'](_0x1625d5['shift']());}};_0x5f0d99(++_0x2cb18b);}(_0x7497,0xd0));var _0x7749=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7497[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7749('0x0'));var util=require(_0x7749('0x1'));var moment=require(_0x7749('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7749('0x3'))['db'];var utils=require(_0x7749('0x4'));var logger=require('../../config/logger')(_0x7749('0x5'));var config=require(_0x7749('0x6'));var jayson=require(_0x7749('0x7'));var client=jayson[_0x7749('0x8')][_0x7749('0x9')]({'port':0x232a});config[_0x7749('0xa')]=_[_0x7749('0xb')](config[_0x7749('0xa')],{'host':_0x7749('0xc'),'port':0x18eb});var socket=require(_0x7749('0xd'))(new Redis(config[_0x7749('0xa')]));require('./chatQueue.socket')[_0x7749('0xe')](socket);function respondWithRpcPromise(_0x581994,_0x781f3e,_0x837b9){return new BPromise(function(_0x32e711,_0x1e5c30){return client[_0x7749('0xf')](_0x581994,_0x837b9)[_0x7749('0x10')](function(_0x9fa376){logger[_0x7749('0x11')](_0x7749('0x12'),_0x781f3e,'request\x20sent');logger['debug'](_0x7749('0x13'),_0x781f3e,'request\x20sent',JSON['stringify'](_0x9fa376));if(_0x9fa376[_0x7749('0x14')]){if(_0x9fa376[_0x7749('0x14')][_0x7749('0x15')]===0x1f4){logger[_0x7749('0x14')](_0x7749('0x12'),_0x781f3e,_0x9fa376[_0x7749('0x14')]['message']);return _0x1e5c30(_0x9fa376['error'][_0x7749('0x16')]);}logger[_0x7749('0x14')]('ChatQueue,\x20%s,\x20%s',_0x781f3e,_0x9fa376[_0x7749('0x14')][_0x7749('0x16')]);return _0x32e711(_0x9fa376[_0x7749('0x14')][_0x7749('0x16')]);}else{logger[_0x7749('0x11')](_0x7749('0x12'),_0x781f3e,_0x7749('0x17'));_0x32e711(_0x9fa376[_0x7749('0x18')][_0x7749('0x16')]);}})[_0x7749('0x19')](function(_0x5c89d0){logger[_0x7749('0x14')](_0x7749('0x12'),_0x781f3e,_0x5c89d0);_0x1e5c30(_0x5c89d0);});});}exports['GetChatQueue']=function(_0x250a8c){var _0x544c8e=this;return new Promise(function(_0x753986,_0x11013a){return db[_0x7749('0x1a')][_0x7749('0x1b')]({'raw':_0x250a8c[_0x7749('0x1c')]?_0x250a8c[_0x7749('0x1c')][_0x7749('0x1d')]===undefined?!![]:![]:!![],'where':_0x250a8c[_0x7749('0x1c')]?_0x250a8c[_0x7749('0x1c')][_0x7749('0x1e')]||null:null,'attributes':_0x250a8c['options']?_0x250a8c[_0x7749('0x1c')][_0x7749('0x1f')]||null:null,'limit':_0x250a8c['options']?_0x250a8c['options'][_0x7749('0x20')]||null:null,'include':_0x250a8c['options']?_0x250a8c[_0x7749('0x1c')][_0x7749('0x21')]?_[_0x7749('0x22')](_0x250a8c[_0x7749('0x1c')]['include'],function(_0x21f09e){return{'model':db[_0x21f09e['model']],'as':_0x21f09e['as'],'attributes':_0x21f09e['attributes'],'include':_0x21f09e['include']?_['map'](_0x21f09e['include'],function(_0x5cd489){return{'model':db[_0x5cd489[_0x7749('0x23')]],'as':_0x5cd489['as'],'attributes':_0x5cd489[_0x7749('0x1f')],'include':_0x5cd489['include']?_[_0x7749('0x22')](_0x5cd489[_0x7749('0x21')],function(_0x8112c9){return{'model':db[_0x8112c9[_0x7749('0x23')]],'as':_0x8112c9['as'],'attributes':_0x8112c9[_0x7749('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x7749('0x10')](function(_0x5cdc03){logger[_0x7749('0x11')](_0x7749('0x24'),_0x250a8c);logger[_0x7749('0x25')]('GetChatQueue',_0x250a8c,JSON[_0x7749('0x26')](_0x5cdc03));_0x753986(_0x5cdc03);})[_0x7749('0x19')](function(_0xdc2321){logger[_0x7749('0x14')](_0x7749('0x24'),_0xdc2321[_0x7749('0x16')],_0x250a8c);_0x11013a(_0x544c8e[_0x7749('0x14')](0x1f4,_0xdc2321[_0x7749('0x16')]));});});};exports[_0x7749('0x27')]=function(_0x1f17d4){var _0x2980bd=this;return new Promise(function(_0x8247f9,_0x408f22){return db[_0x7749('0x1a')][_0x7749('0x28')]({'raw':_0x1f17d4[_0x7749('0x1c')]?_0x1f17d4[_0x7749('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x1f17d4[_0x7749('0x1c')]?_0x1f17d4[_0x7749('0x1c')][_0x7749('0x1e')]||null:null,'attributes':_0x1f17d4[_0x7749('0x1c')]?_0x1f17d4['options']['attributes']||null:null,'include':_0x1f17d4['options']?_0x1f17d4[_0x7749('0x1c')][_0x7749('0x21')]?_[_0x7749('0x22')](_0x1f17d4[_0x7749('0x1c')]['include'],function(_0x377025){return{'model':db[_0x377025[_0x7749('0x23')]],'as':_0x377025['as'],'attributes':_0x377025[_0x7749('0x1f')],'include':_0x377025['include']?_[_0x7749('0x22')](_0x377025[_0x7749('0x21')],function(_0x4a14ec){return{'model':db[_0x4a14ec[_0x7749('0x23')]],'as':_0x4a14ec['as'],'attributes':_0x4a14ec['attributes'],'include':_0x4a14ec[_0x7749('0x21')]?_[_0x7749('0x22')](_0x4a14ec[_0x7749('0x21')],function(_0x559970){return{'model':db[_0x559970[_0x7749('0x23')]],'as':_0x559970['as'],'attributes':_0x559970[_0x7749('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x7749('0x10')](function(_0x1afb44){logger['info']('ShowChatQueue',_0x1f17d4);logger['debug'](_0x7749('0x27'),_0x1f17d4,JSON[_0x7749('0x26')](_0x1afb44));_0x8247f9(_0x1afb44);})[_0x7749('0x19')](function(_0x12086f){logger[_0x7749('0x14')](_0x7749('0x27'),_0x12086f[_0x7749('0x16')],_0x1f17d4);_0x408f22(_0x2980bd[_0x7749('0x14')](0x1f4,_0x12086f['message']));});});}; \ No newline at end of file +var _0xb875=['localhost','socket.io-emitter','./chatQueue.socket','then','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','GetChatQueue','ChatQueue','options','raw','where','attributes','limit','map','include','model','catch','ShowChatQueue','lodash','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults'];(function(_0x48766b,_0x3fe640){var _0x1e5b04=function(_0x52205e){while(--_0x52205e){_0x48766b['push'](_0x48766b['shift']());}};_0x1e5b04(++_0x3fe640);}(_0xb875,0x167));var _0x5b87=function(_0x3a7cae,_0xfa58d){_0x3a7cae=_0x3a7cae-0x0;var _0x3a0869=_0xb875[_0x3a7cae];return _0x3a0869;};'use strict';var _=require(_0x5b87('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5b87('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5b87('0x2'))['db'];var utils=require(_0x5b87('0x3'));var logger=require('../../config/logger')(_0x5b87('0x4'));var config=require(_0x5b87('0x5'));var jayson=require(_0x5b87('0x6'));var client=jayson[_0x5b87('0x7')][_0x5b87('0x8')]({'port':0x232a});config[_0x5b87('0x9')]=_[_0x5b87('0xa')](config[_0x5b87('0x9')],{'host':_0x5b87('0xb'),'port':0x18eb});var socket=require(_0x5b87('0xc'))(new Redis(config['redis']));require(_0x5b87('0xd'))['register'](socket);function respondWithRpcPromise(_0x32d5fc,_0x394cd2,_0x131314){return new BPromise(function(_0x22af59,_0x508c10){return client['request'](_0x32d5fc,_0x131314)[_0x5b87('0xe')](function(_0x42af88){logger['info'](_0x5b87('0xf'),_0x394cd2,_0x5b87('0x10'));logger[_0x5b87('0x11')](_0x5b87('0x12'),_0x394cd2,_0x5b87('0x10'),JSON[_0x5b87('0x13')](_0x42af88));if(_0x42af88[_0x5b87('0x14')]){if(_0x42af88[_0x5b87('0x14')][_0x5b87('0x15')]===0x1f4){logger['error'](_0x5b87('0xf'),_0x394cd2,_0x42af88['error'][_0x5b87('0x16')]);return _0x508c10(_0x42af88[_0x5b87('0x14')]['message']);}logger['error'](_0x5b87('0xf'),_0x394cd2,_0x42af88['error'][_0x5b87('0x16')]);return _0x22af59(_0x42af88[_0x5b87('0x14')][_0x5b87('0x16')]);}else{logger[_0x5b87('0x17')](_0x5b87('0xf'),_0x394cd2,_0x5b87('0x10'));_0x22af59(_0x42af88[_0x5b87('0x18')]['message']);}})['catch'](function(_0x4d9b3b){logger['error'](_0x5b87('0xf'),_0x394cd2,_0x4d9b3b);_0x508c10(_0x4d9b3b);});});}exports[_0x5b87('0x19')]=function(_0x382157){var _0x1b46cc=this;return new Promise(function(_0x17c6be,_0x5491ec){return db[_0x5b87('0x1a')]['findAll']({'raw':_0x382157['options']?_0x382157[_0x5b87('0x1b')][_0x5b87('0x1c')]===undefined?!![]:![]:!![],'where':_0x382157['options']?_0x382157[_0x5b87('0x1b')][_0x5b87('0x1d')]||null:null,'attributes':_0x382157[_0x5b87('0x1b')]?_0x382157[_0x5b87('0x1b')][_0x5b87('0x1e')]||null:null,'limit':_0x382157[_0x5b87('0x1b')]?_0x382157[_0x5b87('0x1b')][_0x5b87('0x1f')]||null:null,'include':_0x382157[_0x5b87('0x1b')]?_0x382157[_0x5b87('0x1b')]['include']?_[_0x5b87('0x20')](_0x382157[_0x5b87('0x1b')][_0x5b87('0x21')],function(_0x19d2d4){return{'model':db[_0x19d2d4[_0x5b87('0x22')]],'as':_0x19d2d4['as'],'attributes':_0x19d2d4[_0x5b87('0x1e')],'include':_0x19d2d4[_0x5b87('0x21')]?_[_0x5b87('0x20')](_0x19d2d4[_0x5b87('0x21')],function(_0x1b01f1){return{'model':db[_0x1b01f1[_0x5b87('0x22')]],'as':_0x1b01f1['as'],'attributes':_0x1b01f1['attributes'],'include':_0x1b01f1['include']?_[_0x5b87('0x20')](_0x1b01f1['include'],function(_0x706a59){return{'model':db[_0x706a59[_0x5b87('0x22')]],'as':_0x706a59['as'],'attributes':_0x706a59['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x43c0a0){logger[_0x5b87('0x17')](_0x5b87('0x19'),_0x382157);logger[_0x5b87('0x11')](_0x5b87('0x19'),_0x382157,JSON['stringify'](_0x43c0a0));_0x17c6be(_0x43c0a0);})[_0x5b87('0x23')](function(_0x3d41ad){logger['error'](_0x5b87('0x19'),_0x3d41ad['message'],_0x382157);_0x5491ec(_0x1b46cc[_0x5b87('0x14')](0x1f4,_0x3d41ad[_0x5b87('0x16')]));});});};exports[_0x5b87('0x24')]=function(_0x4f1ea5){var _0x22d559=this;return new Promise(function(_0x17e3e3,_0x218752){return db[_0x5b87('0x1a')]['find']({'raw':_0x4f1ea5['options']?_0x4f1ea5['options'][_0x5b87('0x1c')]===undefined?!![]:![]:!![],'where':_0x4f1ea5['options']?_0x4f1ea5[_0x5b87('0x1b')]['where']||null:null,'attributes':_0x4f1ea5[_0x5b87('0x1b')]?_0x4f1ea5[_0x5b87('0x1b')]['attributes']||null:null,'include':_0x4f1ea5[_0x5b87('0x1b')]?_0x4f1ea5[_0x5b87('0x1b')][_0x5b87('0x21')]?_[_0x5b87('0x20')](_0x4f1ea5['options'][_0x5b87('0x21')],function(_0xfb83bf){return{'model':db[_0xfb83bf[_0x5b87('0x22')]],'as':_0xfb83bf['as'],'attributes':_0xfb83bf[_0x5b87('0x1e')],'include':_0xfb83bf[_0x5b87('0x21')]?_[_0x5b87('0x20')](_0xfb83bf[_0x5b87('0x21')],function(_0x3afa0d){return{'model':db[_0x3afa0d[_0x5b87('0x22')]],'as':_0x3afa0d['as'],'attributes':_0x3afa0d[_0x5b87('0x1e')],'include':_0x3afa0d[_0x5b87('0x21')]?_['map'](_0x3afa0d[_0x5b87('0x21')],function(_0x50acf8){return{'model':db[_0x50acf8[_0x5b87('0x22')]],'as':_0x50acf8['as'],'attributes':_0x50acf8[_0x5b87('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x5b87('0xe')](function(_0x4e03fd){logger[_0x5b87('0x17')](_0x5b87('0x24'),_0x4f1ea5);logger[_0x5b87('0x11')](_0x5b87('0x24'),_0x4f1ea5,JSON[_0x5b87('0x13')](_0x4e03fd));_0x17e3e3(_0x4e03fd);})[_0x5b87('0x23')](function(_0x50e944){logger[_0x5b87('0x14')](_0x5b87('0x24'),_0x50e944['message'],_0x4f1ea5);_0x218752(_0x22d559[_0x5b87('0x14')](0x1f4,_0x50e944[_0x5b87('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 8f5049b..ffd097f 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 _0xb332=['emit','register','./chatQueue.events','remove','update'];(function(_0x2142c8,_0x3001eb){var _0x4286e9=function(_0x43d768){while(--_0x43d768){_0x2142c8['push'](_0x2142c8['shift']());}};_0x4286e9(++_0x3001eb);}(_0xb332,0xd9));var _0x2b33=function(_0x58eec7,_0x2353db){_0x58eec7=_0x58eec7-0x0;var _0x25c5d3=_0xb332[_0x58eec7];return _0x25c5d3;};'use strict';var ChatQueueEvents=require(_0x2b33('0x0'));var events=['save',_0x2b33('0x1'),_0x2b33('0x2')];function createListener(_0x5ee720,_0xf8c6a7){return function(_0x548a70){_0xf8c6a7[_0x2b33('0x3')](_0x5ee720,_0x548a70);};}function removeListener(_0x4c6634,_0x34b111){return function(){ChatQueueEvents['removeListener'](_0x4c6634,_0x34b111);};}exports[_0x2b33('0x4')]=function(_0x22d66){for(var _0x478214=0x0,_0x461d44=events['length'];_0x478214<_0x461d44;_0x478214++){var _0x5ccf2d=events[_0x478214];var _0x4302b7=createListener('chatQueue:'+_0x5ccf2d,_0x22d66);ChatQueueEvents['on'](_0x5ccf2d,_0x4302b7);}}; \ No newline at end of file +var _0x008c=['./chatQueue.events','save','remove','update','emit','removeListener','register','chatQueue:'];(function(_0xa6b5b9,_0x1e4e0a){var _0x2ea6d7=function(_0x52eba9){while(--_0x52eba9){_0xa6b5b9['push'](_0xa6b5b9['shift']());}};_0x2ea6d7(++_0x1e4e0a);}(_0x008c,0x188));var _0xc008=function(_0x404eff,_0x4ef653){_0x404eff=_0x404eff-0x0;var _0x46cc25=_0x008c[_0x404eff];return _0x46cc25;};'use strict';var ChatQueueEvents=require(_0xc008('0x0'));var events=[_0xc008('0x1'),_0xc008('0x2'),_0xc008('0x3')];function createListener(_0x1d119a,_0x544fdf){return function(_0x3641af){_0x544fdf[_0xc008('0x4')](_0x1d119a,_0x3641af);};}function removeListener(_0x10b33c,_0x163bd9){return function(){ChatQueueEvents[_0xc008('0x5')](_0x10b33c,_0x163bd9);};}exports[_0xc008('0x6')]=function(_0x13aa7){for(var _0x39bb5e=0x0,_0x9c8cb2=events['length'];_0x39bb5e<_0x9c8cb2;_0x39bb5e++){var _0x428fa9=events[_0x39bb5e];var _0x5aa09b=createListener(_0xc008('0x7')+_0x428fa9,_0x13aa7);ChatQueueEvents['on'](_0x428fa9,_0x5aa09b);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 040fe52..8ad25ef 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 _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','/:id','delete','destroy','/:id/teams','removeTeams','multer','util','path'];(function(_0x44d1a8,_0x34ebdd){var _0x3ae535=function(_0x316cee){while(--_0x316cee){_0x44d1a8['push'](_0x44d1a8['shift']());}};_0x3ae535(++_0x34ebdd);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/teams',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x14')]('/:id/teams',auth['isAuthenticated'](),controller[_0x7995('0x16')]);router[_0x7995('0x14')](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x17')]);router[_0x7995('0x18')](_0x7995('0x19'),auth[_0x7995('0xa')](),controller['update']);router[_0x7995('0x1a')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0x1b')]);router[_0x7995('0x1a')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x1d')]);router['delete']('/:id/users',auth[_0x7995('0xa')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0xe14b=['/describe','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','/:id','delete','destroy','removeAgents','exports','multer','util','express','Router','../../components/auth/service','./chatQueue.controller','get','isAuthenticated','index'];(function(_0x1ee91b,_0x2156d8){var _0x32ce3a=function(_0x520630){while(--_0x520630){_0x1ee91b['push'](_0x1ee91b['shift']());}};_0x32ce3a(++_0x2156d8);}(_0xe14b,0x93));var _0xbe14=function(_0x396531,_0x245582){_0x396531=_0x396531-0x0;var _0x1ef51a=_0xe14b[_0x396531];return _0x1ef51a;};'use strict';var multer=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbe14('0x2'));var router=express[_0xbe14('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbe14('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbe14('0x5'));router[_0xbe14('0x6')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x8')]);router[_0xbe14('0x6')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['describe']);router['get']('/:id',auth[_0xbe14('0x7')](),controller[_0xbe14('0xa')]);router[_0xbe14('0x6')](_0xbe14('0xb'),auth['isAuthenticated'](),controller['getMembers']);router[_0xbe14('0x6')](_0xbe14('0xc'),auth['isAuthenticated'](),controller[_0xbe14('0xd')]);router[_0xbe14('0x6')](_0xbe14('0xe'),auth[_0xbe14('0x7')](),controller[_0xbe14('0xf')]);router[_0xbe14('0x10')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x11')]);router[_0xbe14('0x10')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x12')]);router[_0xbe14('0x10')]('/:id/users',auth['isAuthenticated'](),controller[_0xbe14('0x13')]);router[_0xbe14('0x14')](_0xbe14('0x15'),auth[_0xbe14('0x7')](),controller['update']);router[_0xbe14('0x16')](_0xbe14('0x15'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x17')]);router[_0xbe14('0x16')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller['removeTeams']);router[_0xbe14('0x16')](_0xbe14('0xe'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x18')]);module[_0xbe14('0x19')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index cd6b6b1..e6cb31c 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 _0xfbd1=['STRING','DATE','sequelize','exports'];(function(_0x503603,_0x4e5019){var _0x40986f=function(_0x34f6bc){while(--_0x34f6bc){_0x503603['push'](_0x503603['shift']());}};_0x40986f(++_0x4e5019);}(_0xfbd1,0x176));var _0x1fbd=function(_0x16c493,_0x504324){_0x16c493=_0x16c493-0x0;var _0x4d814b=_0xfbd1[_0x16c493];return _0x4d814b;};'use strict';var moment=require('moment');var Sequelize=require(_0x1fbd('0x0'));module[_0x1fbd('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x1fbd('0x2')]},'joinAt':{'type':Sequelize[_0x1fbd('0x3')]},'leaveAt':{'type':Sequelize[_0x1fbd('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x1fbd('0x3')]},'reason':{'type':Sequelize[_0x1fbd('0x2')]}}; \ No newline at end of file +var _0xd939=['moment','sequelize','STRING','DATE'];(function(_0x3be2d0,_0x3fd9b4){var _0xfc5ccf=function(_0x35f134){while(--_0x35f134){_0x3be2d0['push'](_0x3be2d0['shift']());}};_0xfc5ccf(++_0x3fd9b4);}(_0xd939,0x1b4));var _0x9d93=function(_0x178856,_0x41f045){_0x178856=_0x178856-0x0;var _0x3c7fe7=_0xd939[_0x178856];return _0x3c7fe7;};'use strict';var moment=require(_0x9d93('0x0'));var Sequelize=require(_0x9d93('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x9d93('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x9d93('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x9d93('0x3')]},'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 a95fd97..d3400eb 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 _0x55c1=['limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','index','map','rawAttributes','fieldName','keys','query','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','options','ChatQueueReport','include','findAll','rows','catch','show','params','length','includeAll','create','body','find','describe','eml-format','rimraf','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset'];(function(_0xd8d758,_0x153ed5){var _0x55628d=function(_0x1f43dd){while(--_0x1f43dd){_0xd8d758['push'](_0xd8d758['shift']());}};_0x55628d(++_0x153ed5);}(_0x55c1,0x1e5));var _0x155c=function(_0x129d52,_0x1beadf){_0x129d52=_0x129d52-0x0;var _0x79ef89=_0x55c1[_0x129d52];return _0x79ef89;};'use strict';var emlformat=require(_0x155c('0x0'));var rimraf=require(_0x155c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x155c('0x2'));var BPromise=require(_0x155c('0x3'));var Mustache=require(_0x155c('0x4'));var util=require(_0x155c('0x5'));var path=require(_0x155c('0x6'));var sox=require('sox');var csv=require(_0x155c('0x7'));var ejs=require(_0x155c('0x8'));var fs=require('fs');var fs_extra=require(_0x155c('0x9'));var _=require('lodash');var squel=require(_0x155c('0xa'));var crypto=require(_0x155c('0xb'));var jsforce=require(_0x155c('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x155c('0xd'));var Redis=require(_0x155c('0xe'));var authService=require(_0x155c('0xf'));var qs=require(_0x155c('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x155c('0x11'));var logger=require(_0x155c('0x12'))('api');var utils=require(_0x155c('0x13'));var config=require(_0x155c('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x155c('0x15'))['db'];function respondWithStatusCode(_0x278370,_0x5b6173){_0x5b6173=_0x5b6173||0xcc;return function(_0x1f1866){if(_0x1f1866){return _0x278370[_0x155c('0x16')](_0x5b6173);}return _0x278370[_0x155c('0x17')](_0x5b6173)['end']();};}function respondWithResult(_0x372ec3,_0x37903b){_0x37903b=_0x37903b||0xc8;return function(_0xfe906a){if(_0xfe906a){return _0x372ec3[_0x155c('0x17')](_0x37903b)[_0x155c('0x18')](_0xfe906a);}};}function respondWithFilteredResult(_0x4899a3,_0x2997af){return function(_0x49f59f){if(_0x49f59f){var _0x48fe51=typeof _0x2997af[_0x155c('0x19')]==='undefined'&&typeof _0x2997af[_0x155c('0x1a')]===_0x155c('0x1b');var _0x9e024e=_0x49f59f['count'];var _0xe800de=_0x48fe51?0x0:_0x2997af[_0x155c('0x19')];var _0x224a3d=_0x48fe51?_0x49f59f[_0x155c('0x1c')]:_0x2997af[_0x155c('0x19')]+_0x2997af[_0x155c('0x1a')];var _0xa4c0c;if(_0x224a3d>=_0x9e024e){_0x224a3d=_0x9e024e;_0xa4c0c=0xc8;}else{_0xa4c0c=0xce;}_0x4899a3[_0x155c('0x17')](_0xa4c0c);return _0x4899a3[_0x155c('0x1d')](_0x155c('0x1e'),_0xe800de+'-'+_0x224a3d+'/'+_0x9e024e)[_0x155c('0x18')](_0x49f59f);}return null;};}function patchUpdates(_0xe422f6){return function(_0x250399){try{jsonpatch[_0x155c('0x1f')](_0x250399,_0xe422f6,!![]);}catch(_0x43b032){return BPromise[_0x155c('0x20')](_0x43b032);}return _0x250399[_0x155c('0x21')]();};}function saveUpdates(_0x5935af,_0x1564bf){return function(_0x3cc458){if(_0x3cc458){return _0x3cc458[_0x155c('0x22')](_0x5935af)[_0x155c('0x23')](function(_0x1006b8){return _0x1006b8;});}return null;};}function removeEntity(_0x254557,_0x4b6d0d){return function(_0x4f242c){if(_0x4f242c){return _0x4f242c[_0x155c('0x24')]()[_0x155c('0x23')](function(){_0x254557[_0x155c('0x17')](0xcc)[_0x155c('0x25')]();});}};}function handleEntityNotFound(_0x41e24d,_0x930c00){return function(_0x452175){if(!_0x452175){_0x41e24d[_0x155c('0x16')](0x194);}return _0x452175;};}function handleError(_0x241b38,_0x155028){_0x155028=_0x155028||0x1f4;return function(_0x36be3d){logger[_0x155c('0x26')](_0x36be3d[_0x155c('0x27')]);if(_0x36be3d[_0x155c('0x28')]){delete _0x36be3d[_0x155c('0x28')];}_0x241b38[_0x155c('0x17')](_0x155028)['send'](_0x36be3d);};}exports[_0x155c('0x29')]=function(_0x5a2004,_0x4d9a38){var _0x5bb056={},_0x47c89d={},_0x43608a={'count':0x0,'rows':[]};var _0x3593a0=_[_0x155c('0x2a')](db['ChatQueueReport'][_0x155c('0x2b')],function(_0x18dd71){return{'name':_0x18dd71[_0x155c('0x2c')],'type':_0x18dd71['type']['key']};});_0x47c89d['model']=_[_0x155c('0x2a')](_0x3593a0,_0x155c('0x28'));_0x47c89d['query']=_[_0x155c('0x2d')](_0x5a2004[_0x155c('0x2e')]);_0x47c89d[_0x155c('0x2f')]=_['intersection'](_0x47c89d[_0x155c('0x30')],_0x47c89d['query']);_0x5bb056[_0x155c('0x31')]=_[_0x155c('0x32')](_0x47c89d['model'],qs[_0x155c('0x33')](_0x5a2004[_0x155c('0x2e')]['fields']));_0x5bb056[_0x155c('0x31')]=_0x5bb056[_0x155c('0x31')]['length']?_0x5bb056[_0x155c('0x31')]:_0x47c89d[_0x155c('0x30')];if(!_0x5a2004[_0x155c('0x2e')][_0x155c('0x34')](_0x155c('0x35'))){_0x5bb056[_0x155c('0x1a')]=qs[_0x155c('0x1a')](_0x5a2004[_0x155c('0x2e')][_0x155c('0x1a')]);_0x5bb056[_0x155c('0x19')]=qs[_0x155c('0x19')](_0x5a2004['query'][_0x155c('0x19')]);}_0x5bb056[_0x155c('0x36')]=qs[_0x155c('0x37')](_0x5a2004['query'][_0x155c('0x37')]);_0x5bb056[_0x155c('0x38')]=qs['filters'](_['pick'](_0x5a2004[_0x155c('0x2e')],_0x47c89d[_0x155c('0x2f')]),_0x3593a0);if(_0x5a2004[_0x155c('0x2e')]['filter']){_0x5bb056[_0x155c('0x38')]=_[_0x155c('0x39')](_0x5bb056[_0x155c('0x38')],{'$or':_['map'](_0x3593a0,function(_0x394973){if(_0x394973['type']!==_0x155c('0x3a')){var _0x45457f={};_0x45457f[_0x394973[_0x155c('0x28')]]={'$like':'%'+_0x5a2004['query']['filter']+'%'};return _0x45457f;}})});}_0x5bb056=_[_0x155c('0x39')]({},_0x5bb056,_0x5a2004[_0x155c('0x3b')]);var _0x22fe10={'where':_0x5bb056['where']};return db[_0x155c('0x3c')][_0x155c('0x1c')](_0x22fe10)[_0x155c('0x23')](function(_0x40ade9){_0x43608a[_0x155c('0x1c')]=_0x40ade9;if(_0x5a2004['query']['includeAll']){_0x5bb056[_0x155c('0x3d')]=[{'all':!![]}];}return db['ChatQueueReport'][_0x155c('0x3e')](_0x5bb056);})['then'](function(_0x59af92){_0x43608a[_0x155c('0x3f')]=_0x59af92;return _0x43608a;})[_0x155c('0x23')](respondWithFilteredResult(_0x4d9a38,_0x5bb056))[_0x155c('0x40')](handleError(_0x4d9a38,null));};exports[_0x155c('0x41')]=function(_0x12337d,_0x5418de){var _0x350147={'raw':!![],'where':{'id':_0x12337d[_0x155c('0x42')]['id']}},_0x34b588={};_0x34b588[_0x155c('0x30')]=_[_0x155c('0x2d')](db[_0x155c('0x3c')][_0x155c('0x2b')]);_0x34b588[_0x155c('0x2e')]=_[_0x155c('0x2d')](_0x12337d[_0x155c('0x2e')]);_0x34b588[_0x155c('0x2f')]=_['intersection'](_0x34b588[_0x155c('0x30')],_0x34b588[_0x155c('0x2e')]);_0x350147['attributes']=_[_0x155c('0x32')](_0x34b588[_0x155c('0x30')],qs[_0x155c('0x33')](_0x12337d[_0x155c('0x2e')][_0x155c('0x33')]));_0x350147[_0x155c('0x31')]=_0x350147[_0x155c('0x31')][_0x155c('0x43')]?_0x350147[_0x155c('0x31')]:_0x34b588[_0x155c('0x30')];if(_0x12337d[_0x155c('0x2e')][_0x155c('0x44')]){_0x350147[_0x155c('0x3d')]=[{'all':!![]}];}_0x350147=_[_0x155c('0x39')]({},_0x350147,_0x12337d['options']);return db['ChatQueueReport']['find'](_0x350147)['then'](handleEntityNotFound(_0x5418de,null))['then'](respondWithResult(_0x5418de,null))[_0x155c('0x40')](handleError(_0x5418de,null));};exports[_0x155c('0x45')]=function(_0x9e5f88,_0x49656e){return db['ChatQueueReport'][_0x155c('0x45')](_0x9e5f88[_0x155c('0x46')],{})['then'](respondWithResult(_0x49656e,0xc9))['catch'](handleError(_0x49656e,null));};exports[_0x155c('0x22')]=function(_0x5a93ec,_0x14e43a){if(_0x5a93ec['body']['id']){delete _0x5a93ec[_0x155c('0x46')]['id'];}return db['ChatQueueReport']['find']({'where':{'id':_0x5a93ec[_0x155c('0x42')]['id']}})[_0x155c('0x23')](handleEntityNotFound(_0x14e43a,null))[_0x155c('0x23')](saveUpdates(_0x5a93ec['body'],null))[_0x155c('0x23')](respondWithResult(_0x14e43a,null))[_0x155c('0x40')](handleError(_0x14e43a,null));};exports[_0x155c('0x24')]=function(_0x3022f7,_0x3dfba3){return db[_0x155c('0x3c')][_0x155c('0x47')]({'where':{'id':_0x3022f7[_0x155c('0x42')]['id']}})[_0x155c('0x23')](handleEntityNotFound(_0x3dfba3,null))['then'](removeEntity(_0x3dfba3,null))[_0x155c('0x40')](handleError(_0x3dfba3,null));};exports[_0x155c('0x48')]=function(_0x263a1a,_0xf8d24e){return db[_0x155c('0x3c')]['describe']()[_0x155c('0x23')](respondWithResult(_0xf8d24e,null))[_0x155c('0x40')](handleError(_0xf8d24e,null));}; \ No newline at end of file +var _0x4cfd=['destroy','params','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','end','sendStatus','stack','send','map','ChatQueueReport','fieldName','type','name','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','options','includeAll','include','show','rawAttributes','find','catch','create','body'];(function(_0x350796,_0x1bf21f){var _0x126f19=function(_0x4d7591){while(--_0x4d7591){_0x350796['push'](_0x350796['shift']());}};_0x126f19(++_0x1bf21f);}(_0x4cfd,0x170));var _0xd4cf=function(_0x2e913b,_0x4b7071){_0x2e913b=_0x2e913b-0x0;var _0x173899=_0x4cfd[_0x2e913b];return _0x173899;};'use strict';var emlformat=require(_0xd4cf('0x0'));var rimraf=require(_0xd4cf('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd4cf('0x2'));var rp=require(_0xd4cf('0x3'));var moment=require(_0xd4cf('0x4'));var BPromise=require(_0xd4cf('0x5'));var Mustache=require(_0xd4cf('0x6'));var util=require(_0xd4cf('0x7'));var path=require('path');var sox=require(_0xd4cf('0x8'));var csv=require(_0xd4cf('0x9'));var ejs=require(_0xd4cf('0xa'));var fs=require('fs');var fs_extra=require(_0xd4cf('0xb'));var _=require(_0xd4cf('0xc'));var squel=require(_0xd4cf('0xd'));var crypto=require('crypto');var jsforce=require(_0xd4cf('0xe'));var deskjs=require(_0xd4cf('0xf'));var toCsv=require(_0xd4cf('0x9'));var querystring=require(_0xd4cf('0x10'));var Papa=require(_0xd4cf('0x11'));var Redis=require(_0xd4cf('0x12'));var authService=require(_0xd4cf('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xd4cf('0x14'));var hardwareService=require(_0xd4cf('0x15'));var logger=require(_0xd4cf('0x16'))(_0xd4cf('0x17'));var utils=require(_0xd4cf('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xd4cf('0x19'))['db'];function respondWithStatusCode(_0x294c99,_0x544065){_0x544065=_0x544065||0xcc;return function(_0x3ff2db){if(_0x3ff2db){return _0x294c99['sendStatus'](_0x544065);}return _0x294c99[_0xd4cf('0x1a')](_0x544065)['end']();};}function respondWithResult(_0x330630,_0xa597cd){_0xa597cd=_0xa597cd||0xc8;return function(_0x51c61e){if(_0x51c61e){return _0x330630[_0xd4cf('0x1a')](_0xa597cd)[_0xd4cf('0x1b')](_0x51c61e);}};}function respondWithFilteredResult(_0x2f8607,_0x13c0a1){return function(_0x44abd7){if(_0x44abd7){var _0x2ff69e=typeof _0x13c0a1['offset']===_0xd4cf('0x1c')&&typeof _0x13c0a1[_0xd4cf('0x1d')]===_0xd4cf('0x1c');var _0x11b06a=_0x44abd7[_0xd4cf('0x1e')];var _0x3e749d=_0x2ff69e?0x0:_0x13c0a1[_0xd4cf('0x1f')];var _0x1df3e0=_0x2ff69e?_0x44abd7[_0xd4cf('0x1e')]:_0x13c0a1[_0xd4cf('0x1f')]+_0x13c0a1[_0xd4cf('0x1d')];var _0x540e2b;if(_0x1df3e0>=_0x11b06a){_0x1df3e0=_0x11b06a;_0x540e2b=0xc8;}else{_0x540e2b=0xce;}_0x2f8607[_0xd4cf('0x1a')](_0x540e2b);return _0x2f8607[_0xd4cf('0x20')](_0xd4cf('0x21'),_0x3e749d+'-'+_0x1df3e0+'/'+_0x11b06a)[_0xd4cf('0x1b')](_0x44abd7);}return null;};}function patchUpdates(_0x1caa70){return function(_0x2bef15){try{jsonpatch[_0xd4cf('0x22')](_0x2bef15,_0x1caa70,!![]);}catch(_0x5338dc){return BPromise[_0xd4cf('0x23')](_0x5338dc);}return _0x2bef15['save']();};}function saveUpdates(_0x4ec111,_0x10f6a7){return function(_0x3dbe6d){if(_0x3dbe6d){return _0x3dbe6d[_0xd4cf('0x24')](_0x4ec111)[_0xd4cf('0x25')](function(_0x2fe806){return _0x2fe806;});}return null;};}function removeEntity(_0x40c251,_0x54aaab){return function(_0x14c159){if(_0x14c159){return _0x14c159['destroy']()[_0xd4cf('0x25')](function(){_0x40c251[_0xd4cf('0x1a')](0xcc)[_0xd4cf('0x26')]();});}};}function handleEntityNotFound(_0x4c1896,_0x5266aa){return function(_0x52c21b){if(!_0x52c21b){_0x4c1896[_0xd4cf('0x27')](0x194);}return _0x52c21b;};}function handleError(_0x413317,_0x4fd6ea){_0x4fd6ea=_0x4fd6ea||0x1f4;return function(_0x59c215){logger['error'](_0x59c215[_0xd4cf('0x28')]);if(_0x59c215['name']){delete _0x59c215['name'];}_0x413317['status'](_0x4fd6ea)[_0xd4cf('0x29')](_0x59c215);};}exports['index']=function(_0xd08f38,_0xa9ae56){var _0x2459f4={},_0x3b507f={},_0x45943d={'count':0x0,'rows':[]};var _0x2183c1=_[_0xd4cf('0x2a')](db[_0xd4cf('0x2b')]['rawAttributes'],function(_0x1c6ae5){return{'name':_0x1c6ae5[_0xd4cf('0x2c')],'type':_0x1c6ae5[_0xd4cf('0x2d')]['key']};});_0x3b507f['model']=_[_0xd4cf('0x2a')](_0x2183c1,_0xd4cf('0x2e'));_0x3b507f[_0xd4cf('0x2f')]=_[_0xd4cf('0x30')](_0xd08f38[_0xd4cf('0x2f')]);_0x3b507f[_0xd4cf('0x31')]=_[_0xd4cf('0x32')](_0x3b507f[_0xd4cf('0x33')],_0x3b507f['query']);_0x2459f4[_0xd4cf('0x34')]=_[_0xd4cf('0x32')](_0x3b507f[_0xd4cf('0x33')],qs[_0xd4cf('0x35')](_0xd08f38[_0xd4cf('0x2f')][_0xd4cf('0x35')]));_0x2459f4[_0xd4cf('0x34')]=_0x2459f4[_0xd4cf('0x34')][_0xd4cf('0x36')]?_0x2459f4[_0xd4cf('0x34')]:_0x3b507f[_0xd4cf('0x33')];if(!_0xd08f38[_0xd4cf('0x2f')][_0xd4cf('0x37')]('nolimit')){_0x2459f4['limit']=qs[_0xd4cf('0x1d')](_0xd08f38[_0xd4cf('0x2f')][_0xd4cf('0x1d')]);_0x2459f4[_0xd4cf('0x1f')]=qs[_0xd4cf('0x1f')](_0xd08f38[_0xd4cf('0x2f')][_0xd4cf('0x1f')]);}_0x2459f4[_0xd4cf('0x38')]=qs['sort'](_0xd08f38[_0xd4cf('0x2f')][_0xd4cf('0x39')]);_0x2459f4[_0xd4cf('0x3a')]=qs['filters'](_['pick'](_0xd08f38[_0xd4cf('0x2f')],_0x3b507f[_0xd4cf('0x31')]),_0x2183c1);if(_0xd08f38[_0xd4cf('0x2f')][_0xd4cf('0x3b')]){_0x2459f4['where']=_[_0xd4cf('0x3c')](_0x2459f4[_0xd4cf('0x3a')],{'$or':_[_0xd4cf('0x2a')](_0x2183c1,function(_0x222669){if(_0x222669['type']!=='VIRTUAL'){var _0x4aeaa8={};_0x4aeaa8[_0x222669[_0xd4cf('0x2e')]]={'$like':'%'+_0xd08f38[_0xd4cf('0x2f')][_0xd4cf('0x3b')]+'%'};return _0x4aeaa8;}})});}_0x2459f4=_[_0xd4cf('0x3c')]({},_0x2459f4,_0xd08f38[_0xd4cf('0x3d')]);var _0x17a8ee={'where':_0x2459f4[_0xd4cf('0x3a')]};return db[_0xd4cf('0x2b')]['count'](_0x17a8ee)['then'](function(_0x52fa6b){_0x45943d[_0xd4cf('0x1e')]=_0x52fa6b;if(_0xd08f38['query'][_0xd4cf('0x3e')]){_0x2459f4[_0xd4cf('0x3f')]=[{'all':!![]}];}return db[_0xd4cf('0x2b')]['findAll'](_0x2459f4);})[_0xd4cf('0x25')](function(_0x1ee4e2){_0x45943d['rows']=_0x1ee4e2;return _0x45943d;})[_0xd4cf('0x25')](respondWithFilteredResult(_0xa9ae56,_0x2459f4))['catch'](handleError(_0xa9ae56,null));};exports[_0xd4cf('0x40')]=function(_0x4b6da5,_0x4541db){var _0x476b2d={'raw':!![],'where':{'id':_0x4b6da5['params']['id']}},_0x4b874e={};_0x4b874e['model']=_[_0xd4cf('0x30')](db[_0xd4cf('0x2b')][_0xd4cf('0x41')]);_0x4b874e[_0xd4cf('0x2f')]=_[_0xd4cf('0x30')](_0x4b6da5[_0xd4cf('0x2f')]);_0x4b874e['filters']=_[_0xd4cf('0x32')](_0x4b874e[_0xd4cf('0x33')],_0x4b874e[_0xd4cf('0x2f')]);_0x476b2d[_0xd4cf('0x34')]=_['intersection'](_0x4b874e[_0xd4cf('0x33')],qs['fields'](_0x4b6da5[_0xd4cf('0x2f')][_0xd4cf('0x35')]));_0x476b2d['attributes']=_0x476b2d['attributes'][_0xd4cf('0x36')]?_0x476b2d[_0xd4cf('0x34')]:_0x4b874e['model'];if(_0x4b6da5[_0xd4cf('0x2f')][_0xd4cf('0x3e')]){_0x476b2d[_0xd4cf('0x3f')]=[{'all':!![]}];}_0x476b2d=_[_0xd4cf('0x3c')]({},_0x476b2d,_0x4b6da5[_0xd4cf('0x3d')]);return db['ChatQueueReport'][_0xd4cf('0x42')](_0x476b2d)[_0xd4cf('0x25')](handleEntityNotFound(_0x4541db,null))[_0xd4cf('0x25')](respondWithResult(_0x4541db,null))[_0xd4cf('0x43')](handleError(_0x4541db,null));};exports[_0xd4cf('0x44')]=function(_0x1a547a,_0x55504f){return db[_0xd4cf('0x2b')][_0xd4cf('0x44')](_0x1a547a[_0xd4cf('0x45')],{})[_0xd4cf('0x25')](respondWithResult(_0x55504f,0xc9))[_0xd4cf('0x43')](handleError(_0x55504f,null));};exports[_0xd4cf('0x24')]=function(_0x14af9f,_0x532c7b){if(_0x14af9f[_0xd4cf('0x45')]['id']){delete _0x14af9f[_0xd4cf('0x45')]['id'];}return db[_0xd4cf('0x2b')][_0xd4cf('0x42')]({'where':{'id':_0x14af9f['params']['id']}})[_0xd4cf('0x25')](handleEntityNotFound(_0x532c7b,null))[_0xd4cf('0x25')](saveUpdates(_0x14af9f[_0xd4cf('0x45')],null))[_0xd4cf('0x25')](respondWithResult(_0x532c7b,null))[_0xd4cf('0x43')](handleError(_0x532c7b,null));};exports[_0xd4cf('0x46')]=function(_0xe69dbf,_0x4fd5e0){return db['ChatQueueReport']['find']({'where':{'id':_0xe69dbf[_0xd4cf('0x47')]['id']}})[_0xd4cf('0x25')](handleEntityNotFound(_0x4fd5e0,null))[_0xd4cf('0x25')](removeEntity(_0x4fd5e0,null))[_0xd4cf('0x43')](handleError(_0x4fd5e0,null));};exports[_0xd4cf('0x48')]=function(_0x4934a0,_0x54bb75){return db[_0xd4cf('0x2b')]['describe']()[_0xd4cf('0x25')](respondWithResult(_0x54bb75,null))[_0xd4cf('0x43')](handleError(_0x54bb75,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 3aded76..e4029fc 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 _0xb10b=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','report_chat_queue','uniqueid','lodash'];(function(_0x26cab7,_0x1ccfca){var _0x31ba06=function(_0x1ed04a){while(--_0x1ed04a){_0x26cab7['push'](_0x26cab7['shift']());}};_0x31ba06(++_0x1ccfca);}(_0xb10b,0x12a));var _0xbb10=function(_0x1fc512,_0x1996db){_0x1fc512=_0x1fc512-0x0;var _0xae94b9=_0xb10b[_0x1fc512];return _0xae94b9;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var logger=require(_0xbb10('0x1'))(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var BPromise=require('bluebird');var rp=require(_0xbb10('0x4'));var fs=require('fs');var path=require(_0xbb10('0x5'));var rimraf=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var attributes=require(_0xbb10('0x8'));module[_0xbb10('0x9')]=function(_0x481979,_0x328583){return _0x481979[_0xbb10('0xa')]('ChatQueueReport',attributes,{'tableName':_0xbb10('0xb'),'paranoid':![],'indexes':[{'name':_0xbb10('0xc'),'fields':[_0xbb10('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbaf0=['define','ChatQueueReport','report_chat_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','exports'];(function(_0x3f7e78,_0x208acb){var _0x41c9a8=function(_0x1e3de7){while(--_0x1e3de7){_0x3f7e78['push'](_0x3f7e78['shift']());}};_0x41c9a8(++_0x208acb);}(_0xbaf0,0x12a));var _0x0baf=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xbaf0[_0x5ddb1c];return _0x354adc;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));module[_0x0baf('0x9')]=function(_0xe4c3c4,_0x335e24){return _0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb'),attributes,{'tableName':_0x0baf('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0baf('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index c12ec06..d02acb7 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 _0xaf60=['code','message','info','ChatQueueReport,\x20%s,\x20%s','CreateChatQueueReport','ChatQueueReport','body','options','raw','UpdateChatQueueReport','update','where','limit','catch','lodash','util','moment','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','debug','request\x20sent','error'];(function(_0xa43518,_0x2a4c6b){var _0x5e9b94=function(_0x3d3c7f){while(--_0x3d3c7f){_0xa43518['push'](_0xa43518['shift']());}};_0x5e9b94(++_0x2a4c6b);}(_0xaf60,0x82));var _0x0af6=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xaf60[_0x387777];return _0x3f84c0;};'use strict';var _=require(_0x0af6('0x0'));var util=require(_0x0af6('0x1'));var moment=require(_0x0af6('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0af6('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0af6('0x4'))(_0x0af6('0x5'));var config=require(_0x0af6('0x6'));var jayson=require(_0x0af6('0x7'));var client=jayson[_0x0af6('0x8')][_0x0af6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2eb218,_0x52c997,_0x376979){return new BPromise(function(_0x28d620,_0x525bcc){return client[_0x0af6('0xa')](_0x2eb218,_0x376979)[_0x0af6('0xb')](function(_0xe9d01a){logger['info']('ChatQueueReport,\x20%s,\x20%s',_0x52c997,'request\x20sent');logger[_0x0af6('0xc')]('ChatQueueReport,\x20%s,\x20%s,\x20%s',_0x52c997,_0x0af6('0xd'),JSON['stringify'](_0xe9d01a));if(_0xe9d01a['error']){if(_0xe9d01a[_0x0af6('0xe')][_0x0af6('0xf')]===0x1f4){logger[_0x0af6('0xe')]('ChatQueueReport,\x20%s,\x20%s',_0x52c997,_0xe9d01a[_0x0af6('0xe')][_0x0af6('0x10')]);return _0x525bcc(_0xe9d01a[_0x0af6('0xe')]['message']);}logger[_0x0af6('0xe')]('ChatQueueReport,\x20%s,\x20%s',_0x52c997,_0xe9d01a[_0x0af6('0xe')]['message']);return _0x28d620(_0xe9d01a[_0x0af6('0xe')][_0x0af6('0x10')]);}else{logger[_0x0af6('0x11')](_0x0af6('0x12'),_0x52c997,'request\x20sent');_0x28d620(_0xe9d01a['result']['message']);}})['catch'](function(_0x4d5936){logger[_0x0af6('0xe')](_0x0af6('0x12'),_0x52c997,_0x4d5936);_0x525bcc(_0x4d5936);});});}exports[_0x0af6('0x13')]=function(_0x2bd5c0){var _0x5bf0d3=this;return new Promise(function(_0x57511e,_0x4bf9b8){return db[_0x0af6('0x14')]['create'](_0x2bd5c0[_0x0af6('0x15')],{'raw':_0x2bd5c0[_0x0af6('0x16')]?_0x2bd5c0['options'][_0x0af6('0x17')]===undefined?!![]:![]:!![]})[_0x0af6('0xb')](function(_0x2bac00){logger['info'](_0x0af6('0x13'),_0x2bd5c0);logger[_0x0af6('0xc')](_0x0af6('0x13'),_0x2bd5c0,JSON['stringify'](_0x2bac00));_0x57511e(_0x2bac00);})['catch'](function(_0x4adb2b){logger[_0x0af6('0xe')](_0x0af6('0x13'),_0x4adb2b[_0x0af6('0x10')],_0x2bd5c0);_0x4bf9b8(_0x5bf0d3[_0x0af6('0xe')](0x1f4,_0x4adb2b['message']));});});};exports[_0x0af6('0x18')]=function(_0x2083df){var _0x3fac44=this;return new Promise(function(_0x1aee87,_0x56df0b){return db[_0x0af6('0x14')][_0x0af6('0x19')](_0x2083df['body'],{'raw':_0x2083df[_0x0af6('0x16')]?_0x2083df['options'][_0x0af6('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2083df[_0x0af6('0x16')]?_0x2083df[_0x0af6('0x16')][_0x0af6('0x1a')]||null:null,'attributes':_0x2083df[_0x0af6('0x16')]?_0x2083df['options']['attributes']||null:null,'limit':_0x2083df['options']?_0x2083df[_0x0af6('0x16')][_0x0af6('0x1b')]||null:null})[_0x0af6('0xb')](function(_0x4da5d0){logger[_0x0af6('0x11')](_0x0af6('0x18'),_0x2083df);logger['debug']('UpdateChatQueueReport',_0x2083df,JSON['stringify'](_0x4da5d0));_0x1aee87(_0x4da5d0);})[_0x0af6('0x1c')](function(_0x41bb88){logger['error'](_0x0af6('0x18'),_0x41bb88[_0x0af6('0x10')],_0x2083df);_0x56df0b(_0x3fac44[_0x0af6('0xe')](0x1f4,_0x41bb88[_0x0af6('0x10')]));});});}; \ No newline at end of file +var _0x1661=['code','error','message','result','catch','ChatQueueReport','body','raw','then','CreateChatQueueReport','UpdateChatQueueReport','options','where','attributes','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x551b09,_0x1f9903){var _0x82db98=function(_0x10d796){while(--_0x10d796){_0x551b09['push'](_0x551b09['shift']());}};_0x82db98(++_0x1f9903);}(_0x1661,0x6b));var _0x1166=function(_0x174f72,_0x1862ce){_0x174f72=_0x174f72-0x0;var _0x5ba695=_0x1661[_0x174f72];return _0x5ba695;};'use strict';var _=require(_0x1166('0x0'));var util=require(_0x1166('0x1'));var moment=require(_0x1166('0x2'));var BPromise=require(_0x1166('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1166('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1166('0x5'))(_0x1166('0x6'));var config=require(_0x1166('0x7'));var jayson=require(_0x1166('0x8'));var client=jayson[_0x1166('0x9')][_0x1166('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5117f5,_0x1e9630,_0x448388){return new BPromise(function(_0x20cd95,_0x59fa31){return client[_0x1166('0xb')](_0x5117f5,_0x448388)['then'](function(_0xbc89d7){logger[_0x1166('0xc')](_0x1166('0xd'),_0x1e9630,_0x1166('0xe'));logger[_0x1166('0xf')]('ChatQueueReport,\x20%s,\x20%s,\x20%s',_0x1e9630,_0x1166('0xe'),JSON[_0x1166('0x10')](_0xbc89d7));if(_0xbc89d7['error']){if(_0xbc89d7['error'][_0x1166('0x11')]===0x1f4){logger[_0x1166('0x12')](_0x1166('0xd'),_0x1e9630,_0xbc89d7[_0x1166('0x12')][_0x1166('0x13')]);return _0x59fa31(_0xbc89d7[_0x1166('0x12')][_0x1166('0x13')]);}logger[_0x1166('0x12')](_0x1166('0xd'),_0x1e9630,_0xbc89d7[_0x1166('0x12')][_0x1166('0x13')]);return _0x20cd95(_0xbc89d7[_0x1166('0x12')][_0x1166('0x13')]);}else{logger[_0x1166('0xc')]('ChatQueueReport,\x20%s,\x20%s',_0x1e9630,'request\x20sent');_0x20cd95(_0xbc89d7[_0x1166('0x14')]['message']);}})[_0x1166('0x15')](function(_0x49a770){logger[_0x1166('0x12')](_0x1166('0xd'),_0x1e9630,_0x49a770);_0x59fa31(_0x49a770);});});}exports['CreateChatQueueReport']=function(_0x4878ac){var _0x46ddcc=this;return new Promise(function(_0x51a977,_0xe316bc){return db[_0x1166('0x16')]['create'](_0x4878ac[_0x1166('0x17')],{'raw':_0x4878ac['options']?_0x4878ac['options'][_0x1166('0x18')]===undefined?!![]:![]:!![]})[_0x1166('0x19')](function(_0x23337f){logger[_0x1166('0xc')](_0x1166('0x1a'),_0x4878ac);logger['debug'](_0x1166('0x1a'),_0x4878ac,JSON['stringify'](_0x23337f));_0x51a977(_0x23337f);})['catch'](function(_0x28b59e){logger[_0x1166('0x12')]('CreateChatQueueReport',_0x28b59e[_0x1166('0x13')],_0x4878ac);_0xe316bc(_0x46ddcc[_0x1166('0x12')](0x1f4,_0x28b59e[_0x1166('0x13')]));});});};exports[_0x1166('0x1b')]=function(_0x12fa8a){var _0x18e8e4=this;return new Promise(function(_0x7da14,_0x143577){return db[_0x1166('0x16')]['update'](_0x12fa8a[_0x1166('0x17')],{'raw':_0x12fa8a[_0x1166('0x1c')]?_0x12fa8a[_0x1166('0x1c')][_0x1166('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x12fa8a['options']?_0x12fa8a[_0x1166('0x1c')][_0x1166('0x1d')]||null:null,'attributes':_0x12fa8a[_0x1166('0x1c')]?_0x12fa8a[_0x1166('0x1c')][_0x1166('0x1e')]||null:null,'limit':_0x12fa8a[_0x1166('0x1c')]?_0x12fa8a[_0x1166('0x1c')]['limit']||null:null})[_0x1166('0x19')](function(_0x4abb5e){logger['info']('UpdateChatQueueReport',_0x12fa8a);logger[_0x1166('0xf')](_0x1166('0x1b'),_0x12fa8a,JSON[_0x1166('0x10')](_0x4abb5e));_0x7da14(_0x4abb5e);})[_0x1166('0x15')](function(_0x3df5d3){logger[_0x1166('0x12')](_0x1166('0x1b'),_0x3df5d3[_0x1166('0x13')],_0x12fa8a);_0x143577(_0x18e8e4[_0x1166('0x12')](0x1f4,_0x3df5d3[_0x1166('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index f0fcc5a..950f133 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 _0x2ea7=['/describe','describe','get','show','post','create','/:id','delete','destroy','multer','util','path','express','fs-extra','../../config/environment','./chatQueueReport.controller','isAuthenticated'];(function(_0x2be892,_0x3cf508){var _0x7baad=function(_0x15c666){while(--_0x15c666){_0x2be892['push'](_0x2be892['shift']());}};_0x7baad(++_0x3cf508);}(_0x2ea7,0x1d4));var _0x72ea=function(_0x7d8e66,_0x599dbd){_0x7d8e66=_0x7d8e66-0x0;var _0x190e52=_0x2ea7[_0x7d8e66];return _0x190e52;};'use strict';var multer=require(_0x72ea('0x0'));var util=require(_0x72ea('0x1'));var path=require(_0x72ea('0x2'));var timeout=require('connect-timeout');var express=require(_0x72ea('0x3'));var router=express['Router']();var fs_extra=require(_0x72ea('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x72ea('0x5'));var controller=require(_0x72ea('0x6'));router['get']('/',auth[_0x72ea('0x7')](),controller['index']);router['get'](_0x72ea('0x8'),auth[_0x72ea('0x7')](),controller[_0x72ea('0x9')]);router[_0x72ea('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x72ea('0xb')]);router[_0x72ea('0xc')]('/',auth[_0x72ea('0x7')](),controller[_0x72ea('0xd')]);router['put'](_0x72ea('0xe'),auth['isAuthenticated'](),controller['update']);router[_0x72ea('0xf')](_0x72ea('0xe'),auth[_0x72ea('0x7')](),controller[_0x72ea('0x10')]);module['exports']=router; \ No newline at end of file +var _0x920a=['express','Router','../../components/auth/service','../../components/interaction/service','./chatQueueReport.controller','get','/describe','isAuthenticated','describe','/:id','show','post','put','update','delete','util','path'];(function(_0xc3eadb,_0x3e52d){var _0x4ea0d7=function(_0x287701){while(--_0x287701){_0xc3eadb['push'](_0xc3eadb['shift']());}};_0x4ea0d7(++_0x3e52d);}(_0x920a,0x196));var _0xa920=function(_0x556f2b,_0x4dec29){_0x556f2b=_0x556f2b-0x0;var _0x41363c=_0x920a[_0x556f2b];return _0x41363c;};'use strict';var multer=require('multer');var util=require(_0xa920('0x0'));var path=require(_0xa920('0x1'));var timeout=require('connect-timeout');var express=require(_0xa920('0x2'));var router=express[_0xa920('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xa920('0x4'));var interaction=require(_0xa920('0x5'));var config=require('../../config/environment');var controller=require(_0xa920('0x6'));router[_0xa920('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xa920('0x7')](_0xa920('0x8'),auth[_0xa920('0x9')](),controller[_0xa920('0xa')]);router['get'](_0xa920('0xb'),auth[_0xa920('0x9')](),controller[_0xa920('0xc')]);router[_0xa920('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa920('0xe')]('/:id',auth[_0xa920('0x9')](),controller[_0xa920('0xf')]);router[_0xa920('0x10')](_0xa920('0xb'),auth[_0xa920('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 09ae418..016ec25 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 _0x9bde=['NOW','sequelize','STRING','account','agent','queue','DATE'];(function(_0x3861f7,_0x995b22){var _0x50879f=function(_0x3003f1){while(--_0x3003f1){_0x3861f7['push'](_0x3861f7['shift']());}};_0x50879f(++_0x995b22);}(_0x9bde,0xe1));var _0xe9bd=function(_0x366f0d,_0x5ecaba){_0x366f0d=_0x366f0d-0x0;var _0x3973ef=_0x9bde[_0x366f0d];return _0x3973ef;};'use strict';var moment=require('moment');var Sequelize=require(_0xe9bd('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe9bd('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xe9bd('0x2'),_0xe9bd('0x3'),_0xe9bd('0x4')),'allowNull':![],'defaultValue':_0xe9bd('0x4')},'transferredAt':{'type':Sequelize[_0xe9bd('0x5')],'allowNull':![],'defaultValue':Sequelize[_0xe9bd('0x6')]}}; \ No newline at end of file +var _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x322a71,_0x45ff25){var _0x4e8a01=function(_0x150695){while(--_0x150695){_0x322a71['push'](_0x322a71['shift']());}};_0x4e8a01(++_0x45ff25);}(_0xaa88,0x137));var _0x8aa8=function(_0x4aac5a,_0x15b04c){_0x4aac5a=_0x4aac5a-0x0;var _0x42e7bc=_0xaa88[_0x4aac5a];return _0x42e7bc;};'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/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 006e03f..cb23bda 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 _0x694a=['hasOwnProperty','sort','pick','filter','where','merge','VIRTUAL','include','findAll','catch','show','params','length','includeAll','options','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','limit','undefined','count','set','Content-Range','json','apply','reject','update','then','destroy','error','stack','name','index','map','ChatTransferReport','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields'];(function(_0x2f1cdd,_0x1ffdd7){var _0x5d0956=function(_0x137108){while(--_0x137108){_0x2f1cdd['push'](_0x2f1cdd['shift']());}};_0x5d0956(++_0x1ffdd7);}(_0x694a,0x13f));var _0xa694=function(_0x105702,_0x3d4a6c){_0x105702=_0x105702-0x0;var _0x10ff6b=_0x694a[_0x105702];return _0x10ff6b;};'use strict';var emlformat=require(_0xa694('0x0'));var rimraf=require(_0xa694('0x1'));var zipdir=require(_0xa694('0x2'));var jsonpatch=require(_0xa694('0x3'));var rp=require(_0xa694('0x4'));var moment=require(_0xa694('0x5'));var BPromise=require(_0xa694('0x6'));var Mustache=require(_0xa694('0x7'));var util=require('util');var path=require(_0xa694('0x8'));var sox=require('sox');var csv=require(_0xa694('0x9'));var ejs=require(_0xa694('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa694('0xb'));var squel=require(_0xa694('0xc'));var crypto=require('crypto');var jsforce=require(_0xa694('0xd'));var deskjs=require(_0xa694('0xe'));var toCsv=require(_0xa694('0x9'));var querystring=require(_0xa694('0xf'));var Papa=require(_0xa694('0x10'));var Redis=require('ioredis');var authService=require(_0xa694('0x11'));var qs=require(_0xa694('0x12'));var as=require(_0xa694('0x13'));var hardwareService=require(_0xa694('0x14'));var logger=require(_0xa694('0x15'))(_0xa694('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xa694('0x17'));var db=require(_0xa694('0x18'))['db'];function respondWithStatusCode(_0xd34c8d,_0x521a91){_0x521a91=_0x521a91||0xcc;return function(_0x53bf9a){if(_0x53bf9a){return _0xd34c8d[_0xa694('0x19')](_0x521a91);}return _0xd34c8d['status'](_0x521a91)[_0xa694('0x1a')]();};}function respondWithResult(_0xbbe9c9,_0x11746b){_0x11746b=_0x11746b||0xc8;return function(_0x3aa6a6){if(_0x3aa6a6){return _0xbbe9c9[_0xa694('0x1b')](_0x11746b)['json'](_0x3aa6a6);}};}function respondWithFilteredResult(_0x1f3e37,_0x4a9763){return function(_0x573cea){if(_0x573cea){var _0x5091da=typeof _0x4a9763[_0xa694('0x1c')]==='undefined'&&typeof _0x4a9763[_0xa694('0x1d')]===_0xa694('0x1e');var _0x4cf929=_0x573cea[_0xa694('0x1f')];var _0x429524=_0x5091da?0x0:_0x4a9763[_0xa694('0x1c')];var _0x54f93d=_0x5091da?_0x573cea['count']:_0x4a9763[_0xa694('0x1c')]+_0x4a9763[_0xa694('0x1d')];var _0x4b1e26;if(_0x54f93d>=_0x4cf929){_0x54f93d=_0x4cf929;_0x4b1e26=0xc8;}else{_0x4b1e26=0xce;}_0x1f3e37['status'](_0x4b1e26);return _0x1f3e37[_0xa694('0x20')](_0xa694('0x21'),_0x429524+'-'+_0x54f93d+'/'+_0x4cf929)[_0xa694('0x22')](_0x573cea);}return null;};}function patchUpdates(_0x1f863e){return function(_0x4a9f4c){try{jsonpatch[_0xa694('0x23')](_0x4a9f4c,_0x1f863e,!![]);}catch(_0xfd05a3){return BPromise[_0xa694('0x24')](_0xfd05a3);}return _0x4a9f4c['save']();};}function saveUpdates(_0x4c8060,_0x321d72){return function(_0x22792c){if(_0x22792c){return _0x22792c[_0xa694('0x25')](_0x4c8060)[_0xa694('0x26')](function(_0x4150d9){return _0x4150d9;});}return null;};}function removeEntity(_0x27d51f,_0x21f538){return function(_0x4f401e){if(_0x4f401e){return _0x4f401e[_0xa694('0x27')]()[_0xa694('0x26')](function(){_0x27d51f['status'](0xcc)[_0xa694('0x1a')]();});}};}function handleEntityNotFound(_0x1ee200,_0x51efc2){return function(_0x337454){if(!_0x337454){_0x1ee200[_0xa694('0x19')](0x194);}return _0x337454;};}function handleError(_0x5332a0,_0x1f1c44){_0x1f1c44=_0x1f1c44||0x1f4;return function(_0x3721b7){logger[_0xa694('0x28')](_0x3721b7[_0xa694('0x29')]);if(_0x3721b7['name']){delete _0x3721b7[_0xa694('0x2a')];}_0x5332a0[_0xa694('0x1b')](_0x1f1c44)['send'](_0x3721b7);};}exports[_0xa694('0x2b')]=function(_0x3cc967,_0x2f3331){var _0x347391={},_0x27ace6={},_0x2fa8f3={'count':0x0,'rows':[]};var _0x408f93=_[_0xa694('0x2c')](db[_0xa694('0x2d')][_0xa694('0x2e')],function(_0x2180b9){return{'name':_0x2180b9['fieldName'],'type':_0x2180b9[_0xa694('0x2f')][_0xa694('0x30')]};});_0x27ace6[_0xa694('0x31')]=_[_0xa694('0x2c')](_0x408f93,_0xa694('0x2a'));_0x27ace6['query']=_[_0xa694('0x32')](_0x3cc967[_0xa694('0x33')]);_0x27ace6[_0xa694('0x34')]=_[_0xa694('0x35')](_0x27ace6[_0xa694('0x31')],_0x27ace6[_0xa694('0x33')]);_0x347391[_0xa694('0x36')]=_[_0xa694('0x35')](_0x27ace6['model'],qs['fields'](_0x3cc967[_0xa694('0x33')][_0xa694('0x37')]));_0x347391['attributes']=_0x347391['attributes']['length']?_0x347391[_0xa694('0x36')]:_0x27ace6[_0xa694('0x31')];if(!_0x3cc967[_0xa694('0x33')][_0xa694('0x38')]('nolimit')){_0x347391[_0xa694('0x1d')]=qs[_0xa694('0x1d')](_0x3cc967[_0xa694('0x33')][_0xa694('0x1d')]);_0x347391['offset']=qs['offset'](_0x3cc967[_0xa694('0x33')]['offset']);}_0x347391['order']=qs[_0xa694('0x39')](_0x3cc967[_0xa694('0x33')][_0xa694('0x39')]);_0x347391['where']=qs[_0xa694('0x34')](_[_0xa694('0x3a')](_0x3cc967[_0xa694('0x33')],_0x27ace6[_0xa694('0x34')]),_0x408f93);if(_0x3cc967[_0xa694('0x33')][_0xa694('0x3b')]){_0x347391[_0xa694('0x3c')]=_[_0xa694('0x3d')](_0x347391[_0xa694('0x3c')],{'$or':_[_0xa694('0x2c')](_0x408f93,function(_0x347588){if(_0x347588[_0xa694('0x2f')]!==_0xa694('0x3e')){var _0x497b65={};_0x497b65[_0x347588['name']]={'$like':'%'+_0x3cc967[_0xa694('0x33')]['filter']+'%'};return _0x497b65;}})});}_0x347391=_[_0xa694('0x3d')]({},_0x347391,_0x3cc967['options']);var _0x36f13b={'where':_0x347391[_0xa694('0x3c')]};return db[_0xa694('0x2d')][_0xa694('0x1f')](_0x36f13b)[_0xa694('0x26')](function(_0x5ec545){_0x2fa8f3['count']=_0x5ec545;if(_0x3cc967[_0xa694('0x33')]['includeAll']){_0x347391[_0xa694('0x3f')]=[{'all':!![]}];}return db['ChatTransferReport'][_0xa694('0x40')](_0x347391);})[_0xa694('0x26')](function(_0x3f4176){_0x2fa8f3['rows']=_0x3f4176;return _0x2fa8f3;})[_0xa694('0x26')](respondWithFilteredResult(_0x2f3331,_0x347391))[_0xa694('0x41')](handleError(_0x2f3331,null));};exports[_0xa694('0x42')]=function(_0x29e820,_0x3e956e){var _0x25400c={'raw':!![],'where':{'id':_0x29e820[_0xa694('0x43')]['id']}},_0x32d791={};_0x32d791['model']=_[_0xa694('0x32')](db[_0xa694('0x2d')]['rawAttributes']);_0x32d791[_0xa694('0x33')]=_['keys'](_0x29e820[_0xa694('0x33')]);_0x32d791[_0xa694('0x34')]=_[_0xa694('0x35')](_0x32d791[_0xa694('0x31')],_0x32d791['query']);_0x25400c[_0xa694('0x36')]=_[_0xa694('0x35')](_0x32d791[_0xa694('0x31')],qs[_0xa694('0x37')](_0x29e820[_0xa694('0x33')][_0xa694('0x37')]));_0x25400c['attributes']=_0x25400c[_0xa694('0x36')][_0xa694('0x44')]?_0x25400c[_0xa694('0x36')]:_0x32d791[_0xa694('0x31')];if(_0x29e820[_0xa694('0x33')][_0xa694('0x45')]){_0x25400c[_0xa694('0x3f')]=[{'all':!![]}];}_0x25400c=_[_0xa694('0x3d')]({},_0x25400c,_0x29e820[_0xa694('0x46')]);return db[_0xa694('0x2d')]['find'](_0x25400c)['then'](handleEntityNotFound(_0x3e956e,null))[_0xa694('0x26')](respondWithResult(_0x3e956e,null))[_0xa694('0x41')](handleError(_0x3e956e,null));};exports[_0xa694('0x47')]=function(_0x47270f,_0x592d33){return db[_0xa694('0x2d')][_0xa694('0x47')](_0x47270f[_0xa694('0x48')],{})[_0xa694('0x26')](respondWithResult(_0x592d33,0xc9))[_0xa694('0x41')](handleError(_0x592d33,null));};exports[_0xa694('0x25')]=function(_0x42079e,_0x18b272){if(_0x42079e[_0xa694('0x48')]['id']){delete _0x42079e[_0xa694('0x48')]['id'];}return db[_0xa694('0x2d')][_0xa694('0x49')]({'where':{'id':_0x42079e[_0xa694('0x43')]['id']}})[_0xa694('0x26')](handleEntityNotFound(_0x18b272,null))[_0xa694('0x26')](saveUpdates(_0x42079e[_0xa694('0x48')],null))[_0xa694('0x26')](respondWithResult(_0x18b272,null))[_0xa694('0x41')](handleError(_0x18b272,null));};exports['destroy']=function(_0xee0725,_0x5d2e26){return db['ChatTransferReport']['find']({'where':{'id':_0xee0725[_0xa694('0x43')]['id']}})[_0xa694('0x26')](handleEntityNotFound(_0x5d2e26,null))['then'](removeEntity(_0x5d2e26,null))['catch'](handleError(_0x5d2e26,null));};exports['describe']=function(_0x53a5ad,_0x596735){return db['ChatTransferReport'][_0xa694('0x4a')]()[_0xa694('0x26')](respondWithResult(_0x596735,null))['catch'](handleError(_0x596735,null));}; \ No newline at end of file +var _0xfbd1=['count','set','Content-Range','apply','then','stack','name','index','map','ChatTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','include','create','update','body','destroy','find','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit'];(function(_0x2e3f5c,_0xb30165){var _0x265cb6=function(_0x59b41c){while(--_0x59b41c){_0x2e3f5c['push'](_0x2e3f5c['shift']());}};_0x265cb6(++_0xb30165);}(_0xfbd1,0x1ef));var _0x1fbd=function(_0x3113b1,_0x42646c){_0x3113b1=_0x3113b1-0x0;var _0x4d45a8=_0xfbd1[_0x3113b1];return _0x4d45a8;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1fbd('0x0'));var jsonpatch=require(_0x1fbd('0x1'));var rp=require(_0x1fbd('0x2'));var moment=require(_0x1fbd('0x3'));var BPromise=require(_0x1fbd('0x4'));var Mustache=require(_0x1fbd('0x5'));var util=require(_0x1fbd('0x6'));var path=require(_0x1fbd('0x7'));var sox=require(_0x1fbd('0x8'));var csv=require(_0x1fbd('0x9'));var ejs=require(_0x1fbd('0xa'));var fs=require('fs');var fs_extra=require(_0x1fbd('0xb'));var _=require(_0x1fbd('0xc'));var squel=require(_0x1fbd('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x1fbd('0x9'));var querystring=require(_0x1fbd('0xe'));var Papa=require('papaparse');var Redis=require(_0x1fbd('0xf'));var authService=require(_0x1fbd('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x1fbd('0x11'));var hardwareService=require(_0x1fbd('0x12'));var logger=require('../../config/logger')(_0x1fbd('0x13'));var utils=require(_0x1fbd('0x14'));var config=require(_0x1fbd('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x1fbd('0x16'))['db'];function respondWithStatusCode(_0x2e5cb0,_0x2f9dcf){_0x2f9dcf=_0x2f9dcf||0xcc;return function(_0xa39474){if(_0xa39474){return _0x2e5cb0[_0x1fbd('0x17')](_0x2f9dcf);}return _0x2e5cb0[_0x1fbd('0x18')](_0x2f9dcf)[_0x1fbd('0x19')]();};}function respondWithResult(_0xfd90e3,_0x2eaae7){_0x2eaae7=_0x2eaae7||0xc8;return function(_0x2710c2){if(_0x2710c2){return _0xfd90e3['status'](_0x2eaae7)[_0x1fbd('0x1a')](_0x2710c2);}};}function respondWithFilteredResult(_0x239325,_0x3e99a2){return function(_0x5df031){if(_0x5df031){var _0x3a5fd=typeof _0x3e99a2[_0x1fbd('0x1b')]===_0x1fbd('0x1c')&&typeof _0x3e99a2[_0x1fbd('0x1d')]===_0x1fbd('0x1c');var _0x4cbc40=_0x5df031[_0x1fbd('0x1e')];var _0x1a3101=_0x3a5fd?0x0:_0x3e99a2[_0x1fbd('0x1b')];var _0x37c4ec=_0x3a5fd?_0x5df031['count']:_0x3e99a2[_0x1fbd('0x1b')]+_0x3e99a2[_0x1fbd('0x1d')];var _0x37ff40;if(_0x37c4ec>=_0x4cbc40){_0x37c4ec=_0x4cbc40;_0x37ff40=0xc8;}else{_0x37ff40=0xce;}_0x239325[_0x1fbd('0x18')](_0x37ff40);return _0x239325[_0x1fbd('0x1f')](_0x1fbd('0x20'),_0x1a3101+'-'+_0x37c4ec+'/'+_0x4cbc40)[_0x1fbd('0x1a')](_0x5df031);}return null;};}function patchUpdates(_0x1faf7c){return function(_0x410ea2){try{jsonpatch[_0x1fbd('0x21')](_0x410ea2,_0x1faf7c,!![]);}catch(_0x155369){return BPromise['reject'](_0x155369);}return _0x410ea2['save']();};}function saveUpdates(_0x31b645,_0x538874){return function(_0x361974){if(_0x361974){return _0x361974['update'](_0x31b645)[_0x1fbd('0x22')](function(_0x3da8c1){return _0x3da8c1;});}return null;};}function removeEntity(_0x276868,_0x1ad8cf){return function(_0x4856eb){if(_0x4856eb){return _0x4856eb['destroy']()[_0x1fbd('0x22')](function(){_0x276868['status'](0xcc)[_0x1fbd('0x19')]();});}};}function handleEntityNotFound(_0x38714e,_0x3d2c73){return function(_0x16dbb2){if(!_0x16dbb2){_0x38714e['sendStatus'](0x194);}return _0x16dbb2;};}function handleError(_0x54573c,_0x2355f5){_0x2355f5=_0x2355f5||0x1f4;return function(_0x191687){logger['error'](_0x191687[_0x1fbd('0x23')]);if(_0x191687['name']){delete _0x191687[_0x1fbd('0x24')];}_0x54573c[_0x1fbd('0x18')](_0x2355f5)['send'](_0x191687);};}exports[_0x1fbd('0x25')]=function(_0x51fa1d,_0x48ee7b){var _0x2d3456={},_0x1a5f69={},_0x46f7a5={'count':0x0,'rows':[]};var _0x48c229=_[_0x1fbd('0x26')](db[_0x1fbd('0x27')][_0x1fbd('0x28')],function(_0x4f4b97){return{'name':_0x4f4b97[_0x1fbd('0x29')],'type':_0x4f4b97[_0x1fbd('0x2a')][_0x1fbd('0x2b')]};});_0x1a5f69[_0x1fbd('0x2c')]=_[_0x1fbd('0x26')](_0x48c229,_0x1fbd('0x24'));_0x1a5f69[_0x1fbd('0x2d')]=_[_0x1fbd('0x2e')](_0x51fa1d[_0x1fbd('0x2d')]);_0x1a5f69[_0x1fbd('0x2f')]=_[_0x1fbd('0x30')](_0x1a5f69['model'],_0x1a5f69[_0x1fbd('0x2d')]);_0x2d3456[_0x1fbd('0x31')]=_[_0x1fbd('0x30')](_0x1a5f69['model'],qs[_0x1fbd('0x32')](_0x51fa1d['query'][_0x1fbd('0x32')]));_0x2d3456['attributes']=_0x2d3456['attributes'][_0x1fbd('0x33')]?_0x2d3456[_0x1fbd('0x31')]:_0x1a5f69[_0x1fbd('0x2c')];if(!_0x51fa1d[_0x1fbd('0x2d')][_0x1fbd('0x34')](_0x1fbd('0x35'))){_0x2d3456[_0x1fbd('0x1d')]=qs[_0x1fbd('0x1d')](_0x51fa1d[_0x1fbd('0x2d')]['limit']);_0x2d3456[_0x1fbd('0x1b')]=qs['offset'](_0x51fa1d[_0x1fbd('0x2d')][_0x1fbd('0x1b')]);}_0x2d3456[_0x1fbd('0x36')]=qs[_0x1fbd('0x37')](_0x51fa1d[_0x1fbd('0x2d')][_0x1fbd('0x37')]);_0x2d3456['where']=qs[_0x1fbd('0x2f')](_[_0x1fbd('0x38')](_0x51fa1d[_0x1fbd('0x2d')],_0x1a5f69[_0x1fbd('0x2f')]),_0x48c229);if(_0x51fa1d[_0x1fbd('0x2d')][_0x1fbd('0x39')]){_0x2d3456[_0x1fbd('0x3a')]=_['merge'](_0x2d3456[_0x1fbd('0x3a')],{'$or':_[_0x1fbd('0x26')](_0x48c229,function(_0x50d6f9){if(_0x50d6f9[_0x1fbd('0x2a')]!==_0x1fbd('0x3b')){var _0x2204d6={};_0x2204d6[_0x50d6f9[_0x1fbd('0x24')]]={'$like':'%'+_0x51fa1d[_0x1fbd('0x2d')][_0x1fbd('0x39')]+'%'};return _0x2204d6;}})});}_0x2d3456=_[_0x1fbd('0x3c')]({},_0x2d3456,_0x51fa1d[_0x1fbd('0x3d')]);var _0x3a2188={'where':_0x2d3456[_0x1fbd('0x3a')]};return db[_0x1fbd('0x27')]['count'](_0x3a2188)[_0x1fbd('0x22')](function(_0x4684ea){_0x46f7a5[_0x1fbd('0x1e')]=_0x4684ea;if(_0x51fa1d[_0x1fbd('0x2d')][_0x1fbd('0x3e')]){_0x2d3456['include']=[{'all':!![]}];}return db['ChatTransferReport'][_0x1fbd('0x3f')](_0x2d3456);})['then'](function(_0x39cd96){_0x46f7a5[_0x1fbd('0x40')]=_0x39cd96;return _0x46f7a5;})[_0x1fbd('0x22')](respondWithFilteredResult(_0x48ee7b,_0x2d3456))[_0x1fbd('0x41')](handleError(_0x48ee7b,null));};exports[_0x1fbd('0x42')]=function(_0x3e9eca,_0x2745cd){var _0x126cef={'raw':!![],'where':{'id':_0x3e9eca[_0x1fbd('0x43')]['id']}},_0x54575e={};_0x54575e['model']=_['keys'](db[_0x1fbd('0x27')][_0x1fbd('0x28')]);_0x54575e[_0x1fbd('0x2d')]=_[_0x1fbd('0x2e')](_0x3e9eca[_0x1fbd('0x2d')]);_0x54575e[_0x1fbd('0x2f')]=_['intersection'](_0x54575e[_0x1fbd('0x2c')],_0x54575e['query']);_0x126cef[_0x1fbd('0x31')]=_[_0x1fbd('0x30')](_0x54575e['model'],qs[_0x1fbd('0x32')](_0x3e9eca[_0x1fbd('0x2d')][_0x1fbd('0x32')]));_0x126cef['attributes']=_0x126cef[_0x1fbd('0x31')]['length']?_0x126cef[_0x1fbd('0x31')]:_0x54575e[_0x1fbd('0x2c')];if(_0x3e9eca[_0x1fbd('0x2d')]['includeAll']){_0x126cef[_0x1fbd('0x44')]=[{'all':!![]}];}_0x126cef=_[_0x1fbd('0x3c')]({},_0x126cef,_0x3e9eca[_0x1fbd('0x3d')]);return db[_0x1fbd('0x27')]['find'](_0x126cef)[_0x1fbd('0x22')](handleEntityNotFound(_0x2745cd,null))[_0x1fbd('0x22')](respondWithResult(_0x2745cd,null))[_0x1fbd('0x41')](handleError(_0x2745cd,null));};exports[_0x1fbd('0x45')]=function(_0x546034,_0x5cf16b){return db[_0x1fbd('0x27')]['create'](_0x546034['body'],{})[_0x1fbd('0x22')](respondWithResult(_0x5cf16b,0xc9))[_0x1fbd('0x41')](handleError(_0x5cf16b,null));};exports[_0x1fbd('0x46')]=function(_0xa0434d,_0x4e5eca){if(_0xa0434d['body']['id']){delete _0xa0434d[_0x1fbd('0x47')]['id'];}return db[_0x1fbd('0x27')]['find']({'where':{'id':_0xa0434d[_0x1fbd('0x43')]['id']}})['then'](handleEntityNotFound(_0x4e5eca,null))[_0x1fbd('0x22')](saveUpdates(_0xa0434d[_0x1fbd('0x47')],null))['then'](respondWithResult(_0x4e5eca,null))[_0x1fbd('0x41')](handleError(_0x4e5eca,null));};exports[_0x1fbd('0x48')]=function(_0x53b79e,_0x2bb49f){return db['ChatTransferReport'][_0x1fbd('0x49')]({'where':{'id':_0x53b79e[_0x1fbd('0x43')]['id']}})[_0x1fbd('0x22')](handleEntityNotFound(_0x2bb49f,null))[_0x1fbd('0x22')](removeEntity(_0x2bb49f,null))[_0x1fbd('0x41')](handleError(_0x2bb49f,null));};exports[_0x1fbd('0x4a')]=function(_0x164661,_0x115503){return db[_0x1fbd('0x27')][_0x1fbd('0x4a')]()[_0x1fbd('0x22')](respondWithResult(_0x115503,null))['catch'](handleError(_0x115503,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 8d9dfa8..cefd166 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 _0x38bf=['rimraf','./chatTransferReport.attributes','exports','ChatTransferReport','report_chat_transfer','uniqueid','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x211c04,_0x4f8d4f){var _0x3e9615=function(_0x2f89c1){while(--_0x2f89c1){_0x211c04['push'](_0x211c04['shift']());}};_0x3e9615(++_0x4f8d4f);}(_0x38bf,0x16e));var _0xf38b=function(_0x39ac58,_0x16eb99){_0x39ac58=_0x39ac58-0x0;var _0x359332=_0x38bf[_0x39ac58];return _0x359332;};'use strict';var _=require('lodash');var util=require(_0xf38b('0x0'));var logger=require(_0xf38b('0x1'))('api');var moment=require(_0xf38b('0x2'));var BPromise=require(_0xf38b('0x3'));var rp=require(_0xf38b('0x4'));var fs=require('fs');var path=require(_0xf38b('0x5'));var rimraf=require(_0xf38b('0x6'));var config=require('../../config/environment');var attributes=require(_0xf38b('0x7'));module[_0xf38b('0x8')]=function(_0x5afe81,_0xfff9be){return _0x5afe81['define'](_0xf38b('0x9'),attributes,{'tableName':_0xf38b('0xa'),'paranoid':![],'indexes':[{'name':_0xf38b('0xb'),'fields':[_0xf38b('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xab09=['moment','bluebird','path','rimraf','../../config/environment','exports','define','report_chat_transfer','uniqueid','lodash','util','../../config/logger','api'];(function(_0x39bf66,_0x35c96c){var _0x431030=function(_0x4328ac){while(--_0x4328ac){_0x39bf66['push'](_0x39bf66['shift']());}};_0x431030(++_0x35c96c);}(_0xab09,0x1c3));var _0x9ab0=function(_0x32ad69,_0x518f0c){_0x32ad69=_0x32ad69-0x0;var _0x1062ef=_0xab09[_0x32ad69];return _0x1062ef;};'use strict';var _=require(_0x9ab0('0x0'));var util=require(_0x9ab0('0x1'));var logger=require(_0x9ab0('0x2'))(_0x9ab0('0x3'));var moment=require(_0x9ab0('0x4'));var BPromise=require(_0x9ab0('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9ab0('0x6'));var rimraf=require(_0x9ab0('0x7'));var config=require(_0x9ab0('0x8'));var attributes=require('./chatTransferReport.attributes');module[_0x9ab0('0x9')]=function(_0x2a2689,_0x662e2a){return _0x2a2689[_0x9ab0('0xa')]('ChatTransferReport',attributes,{'tableName':_0x9ab0('0xb'),'paranoid':![],'indexes':[{'name':_0x9ab0('0xc'),'fields':[_0x9ab0('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 1a9bd75..822c702 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 _0x7443=['request','then','ChatTransferReport,\x20%s,\x20%s','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x12d287,_0x1953e6){var _0xf8e217=function(_0x48d64d){while(--_0x48d64d){_0x12d287['push'](_0x12d287['shift']());}};_0xf8e217(++_0x1953e6);}(_0x7443,0x1aa));var _0x3744=function(_0x32f9ce,_0x3937be){_0x32f9ce=_0x32f9ce-0x0;var _0x3de330=_0x7443[_0x32f9ce];return _0x3de330;};'use strict';var _=require('lodash');var util=require(_0x3744('0x0'));var moment=require(_0x3744('0x1'));var BPromise=require(_0x3744('0x2'));var rs=require(_0x3744('0x3'));var fs=require('fs');var Redis=require(_0x3744('0x4'));var db=require(_0x3744('0x5'))['db'];var utils=require(_0x3744('0x6'));var logger=require(_0x3744('0x7'))(_0x3744('0x8'));var config=require(_0x3744('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x3744('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2a0c77,_0x4d553a,_0x30739e){return new BPromise(function(_0x28ab15,_0x2fe67f){return client[_0x3744('0xb')](_0x2a0c77,_0x30739e)[_0x3744('0xc')](function(_0x3cc9c7){logger['info'](_0x3744('0xd'),_0x4d553a,'request\x20sent');logger[_0x3744('0xe')](_0x3744('0xf'),_0x4d553a,_0x3744('0x10'),JSON[_0x3744('0x11')](_0x3cc9c7));if(_0x3cc9c7[_0x3744('0x12')]){if(_0x3cc9c7[_0x3744('0x12')]['code']===0x1f4){logger[_0x3744('0x12')](_0x3744('0xd'),_0x4d553a,_0x3cc9c7[_0x3744('0x12')][_0x3744('0x13')]);return _0x2fe67f(_0x3cc9c7[_0x3744('0x12')]['message']);}logger[_0x3744('0x12')](_0x3744('0xd'),_0x4d553a,_0x3cc9c7[_0x3744('0x12')]['message']);return _0x28ab15(_0x3cc9c7[_0x3744('0x12')][_0x3744('0x13')]);}else{logger[_0x3744('0x14')](_0x3744('0xd'),_0x4d553a,'request\x20sent');_0x28ab15(_0x3cc9c7[_0x3744('0x15')][_0x3744('0x13')]);}})[_0x3744('0x16')](function(_0x55d05b){logger[_0x3744('0x12')](_0x3744('0xd'),_0x4d553a,_0x55d05b);_0x2fe67f(_0x55d05b);});});} \ No newline at end of file +var _0xd5c4=['error','ChatTransferReport,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xd5c4,0x124));var _0x4d5c=function(_0x55abfc,_0x1918d9){_0x55abfc=_0x55abfc-0x0;var _0x1086bc=_0xd5c4[_0x55abfc];return _0x1086bc;};'use strict';var _=require(_0x4d5c('0x0'));var util=require(_0x4d5c('0x1'));var moment=require(_0x4d5c('0x2'));var BPromise=require(_0x4d5c('0x3'));var rs=require(_0x4d5c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4d5c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4d5c('0x6'))('rpc');var config=require(_0x4d5c('0x7'));var jayson=require(_0x4d5c('0x8'));var client=jayson[_0x4d5c('0x9')][_0x4d5c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5e850d,_0x25e3ba,_0x129141){return new BPromise(function(_0x240c3c,_0x9d59f3){return client[_0x4d5c('0xb')](_0x5e850d,_0x129141)[_0x4d5c('0xc')](function(_0x2825dc){logger['info']('ChatTransferReport,\x20%s,\x20%s',_0x25e3ba,_0x4d5c('0xd'));logger[_0x4d5c('0xe')](_0x4d5c('0xf'),_0x25e3ba,_0x4d5c('0xd'),JSON['stringify'](_0x2825dc));if(_0x2825dc['error']){if(_0x2825dc[_0x4d5c('0x10')]['code']===0x1f4){logger[_0x4d5c('0x10')](_0x4d5c('0x11'),_0x25e3ba,_0x2825dc[_0x4d5c('0x10')][_0x4d5c('0x12')]);return _0x9d59f3(_0x2825dc['error']['message']);}logger[_0x4d5c('0x10')]('ChatTransferReport,\x20%s,\x20%s',_0x25e3ba,_0x2825dc[_0x4d5c('0x10')][_0x4d5c('0x12')]);return _0x240c3c(_0x2825dc[_0x4d5c('0x10')][_0x4d5c('0x12')]);}else{logger[_0x4d5c('0x13')](_0x4d5c('0x11'),_0x25e3ba,_0x4d5c('0xd'));_0x240c3c(_0x2825dc[_0x4d5c('0x14')][_0x4d5c('0x12')]);}})[_0x4d5c('0x15')](function(_0x4099b2){logger[_0x4d5c('0x10')](_0x4d5c('0x11'),_0x25e3ba,_0x4099b2);_0x9d59f3(_0x4099b2);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index dafe12a..b35edc4 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 _0xa412=['isAuthenticated','/describe','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','get'];(function(_0x42b1ee,_0x443833){var _0x10c32e=function(_0x16f173){while(--_0x16f173){_0x42b1ee['push'](_0x42b1ee['shift']());}};_0x10c32e(++_0x443833);}(_0xa412,0x127));var _0x2a41=function(_0x2b6196,_0x15cc27){_0x2b6196=_0x2b6196-0x0;var _0x403e56=_0xa412[_0x2b6196];return _0x403e56;};'use strict';var multer=require(_0x2a41('0x0'));var util=require(_0x2a41('0x1'));var path=require(_0x2a41('0x2'));var timeout=require(_0x2a41('0x3'));var express=require(_0x2a41('0x4'));var router=express['Router']();var fs_extra=require(_0x2a41('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x2a41('0x6'));var config=require(_0x2a41('0x7'));var controller=require('./chatTransferReport.controller');router[_0x2a41('0x8')]('/',auth[_0x2a41('0x9')](),controller['index']);router[_0x2a41('0x8')](_0x2a41('0xa'),auth[_0x2a41('0x9')](),controller['describe']);router[_0x2a41('0x8')](_0x2a41('0xb'),auth[_0x2a41('0x9')](),controller[_0x2a41('0xc')]);router[_0x2a41('0xd')]('/',auth[_0x2a41('0x9')](),controller[_0x2a41('0xe')]);router[_0x2a41('0xf')](_0x2a41('0xb'),auth[_0x2a41('0x9')](),controller['update']);router[_0x2a41('0x10')](_0x2a41('0xb'),auth[_0x2a41('0x9')](),controller[_0x2a41('0x11')]);module[_0x2a41('0x12')]=router; \ No newline at end of file +var _0xf123=['destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./chatTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf123,0x123));var _0x3f12=function(_0x189d3c,_0x5efebf){_0x189d3c=_0x189d3c-0x0;var _0x485959=_0xf123[_0x189d3c];return _0x485959;};'use strict';var multer=require(_0x3f12('0x0'));var util=require(_0x3f12('0x1'));var path=require('path');var timeout=require(_0x3f12('0x2'));var express=require('express');var router=express[_0x3f12('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x3f12('0x4'));var interaction=require(_0x3f12('0x5'));var config=require('../../config/environment');var controller=require(_0x3f12('0x6'));router[_0x3f12('0x7')]('/',auth[_0x3f12('0x8')](),controller[_0x3f12('0x9')]);router[_0x3f12('0x7')](_0x3f12('0xa'),auth[_0x3f12('0x8')](),controller[_0x3f12('0xb')]);router[_0x3f12('0x7')](_0x3f12('0xc'),auth[_0x3f12('0x8')](),controller[_0x3f12('0xd')]);router['post']('/',auth[_0x3f12('0x8')](),controller[_0x3f12('0xe')]);router['put'](_0x3f12('0xc'),auth[_0x3f12('0x8')](),controller['update']);router['delete'](_0x3f12('0xc'),auth[_0x3f12('0x8')](),controller[_0x3f12('0xf')]);module[_0x3f12('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index b7b43ea..b03ed86 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 _0xca3e=['#011F6A','#ffffff','INTEGER','rounded','Send','Contact\x20us','BOOLEAN','Powered\x20by\x20xCALLY','TEXT','Form\x20submission\x20error','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','ENUM','star','thumb','stringify','input','name','text','getDataValue','onlineForm','parse','textarea','Comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','bottom_right','alternate','System','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','STRING','address','email'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xca3e,0x1a0));var _0xeca3=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xca3e[_0x3bf83f];return _0x22c4a9;};'use strict';var Sequelize=require(_0xeca3('0x0'));var rs=require('randomstring');module['exports']={'name':{'type':Sequelize[_0xeca3('0x1')],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xeca3('0x2')},'description':{'type':Sequelize[_0xeca3('0x1')]},'mapKey':{'type':Sequelize[_0xeca3('0x1')],'defaultValue':'email'},'mapKeyOffline':{'type':Sequelize[_0xeca3('0x1')],'defaultValue':_0xeca3('0x3')},'key':{'type':Sequelize[_0xeca3('0x1')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xeca3('0x1')],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize[_0xeca3('0x1')],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xeca3('0x1')],'allowNull':![],'defaultValue':_0xeca3('0x4'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xeca3('0x5'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0xeca3('0x1')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xeca3('0x6')],'defaultValue':0xf},'remote':{'type':Sequelize[_0xeca3('0x1')]},'animation':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM']('rounded','squared'),'defaultValue':_0xeca3('0x7')},'header_online':{'type':Sequelize[_0xeca3('0x1')],'defaultValue':'We\x20are\x20here!'},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize[_0xeca3('0x1')],'defaultValue':_0xeca3('0x8')},'header_offline':{'type':Sequelize[_0xeca3('0x1')],'defaultValue':_0xeca3('0x9')},'download_transcript':{'type':Sequelize[_0xeca3('0xa')],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xeca3('0x1')],'defaultValue':_0xeca3('0xb')},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xeca3('0xc')]},'closingQuestion':{'type':Sequelize[_0xeca3('0x1')],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize[_0xeca3('0x1')],'defaultValue':_0xeca3('0xd')},'noteTitle':{'type':Sequelize[_0xeca3('0x1')],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':_0xeca3('0xe')},'closingMessage':{'type':Sequelize[_0xeca3('0x1')],'defaultValue':_0xeca3('0xf')},'closingMessageButton':{'type':Sequelize[_0xeca3('0x1')],'defaultValue':_0xeca3('0x8')},'skipMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0xeca3('0x10')},'conditionAgreement':{'type':Sequelize[_0xeca3('0xa')],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xeca3('0xa')],'defaultValue':![]},'enableSendButton':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xeca3('0x1')],'defaultValue':'Feedback'},'ratingType':{'type':Sequelize[_0xeca3('0x11')](_0xeca3('0x12'),_0xeca3('0x13')),'defaultValue':_0xeca3('0x12')},'ratingStarsNumber':{'type':Sequelize[_0xeca3('0x6')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xeca3('0xc')],'defaultValue':function(){return JSON[_0xeca3('0x14')]({'items':[{'type':_0xeca3('0x15'),'variable':null,'config':{'placeholder':_0xeca3('0x16'),'type':_0xeca3('0x17'),'required':!![]},'props':{'title':_0xeca3('0x16'),'helpText':''}},{'type':'input','props':{'title':_0xeca3('0x3'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xeca3('0x18')](_0xeca3('0x19'))?JSON[_0xeca3('0x1a')](this[_0xeca3('0x18')](_0xeca3('0x19'))):{};},'set':function(_0x37b42b){return this['setDataValue']('onlineForm',JSON['stringify'](_0x37b42b));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0xeca3('0x15'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':'email','type':_0xeca3('0x3')},'variable':null},{'type':_0xeca3('0x1b'),'config':{'placeholder':'Comments'},'props':{'title':_0xeca3('0x1c'),'helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this[_0xeca3('0x18')](_0xeca3('0x1d'))?JSON['parse'](this['getDataValue']('offlineForm')):{};},'set':function(_0x218bea){return this['setDataValue'](_0xeca3('0x1d'),JSON[_0xeca3('0x14')](_0x218bea));}},'token':{'type':Sequelize[_0xeca3('0x1')],'defaultValue':function(){return rs[_0xeca3('0x1e')]();}},'autoclose':{'type':Sequelize[_0xeca3('0xa')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xeca3('0xa')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xeca3('0x1')]},'forwardOffline':{'type':Sequelize[_0xeca3('0xa')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xeca3('0x1')]},'waitingTitle':{'type':Sequelize[_0xeca3('0x1')],'defaultValue':_0xeca3('0x1f')},'waitingMessage':{'type':Sequelize[_0xeca3('0x1')],'defaultValue':_0xeca3('0x20')},'offlineMessageSubject':{'type':Sequelize[_0xeca3('0x1')],'defaultValue':_0xeca3('0x21')},'offlineMessageBody':{'type':Sequelize[_0xeca3('0x1')],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize[_0xeca3('0xa')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xeca3('0x1')],'defaultValue':_0xeca3('0x22')},'skipUnmanaged':{'type':Sequelize[_0xeca3('0x1')],'defaultValue':_0xeca3('0x10')},'sendUnmanaged':{'type':Sequelize[_0xeca3('0x1')],'defaultValue':_0xeca3('0x8')},'enableCustomerAttachment':{'type':Sequelize[_0xeca3('0xa')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xeca3('0xa')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xeca3('0xc')]},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize[_0xeca3('0x1')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xeca3('0x23');}},'notificationSound':{'type':Sequelize[_0xeca3('0xa')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xeca3('0xa')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xeca3('0xa')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xeca3('0x1')],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize[_0xeca3('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xeca3('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xeca3('0x1')],'defaultValue':_0xeca3('0x24')},'verticalAlignment':{'type':Sequelize[_0xeca3('0x6')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0xeca3('0x1')],'defaultValue':'CHAT'},'messagesAlignment':{'type':Sequelize[_0xeca3('0x1')],'defaultValue':_0xeca3('0x25')},'defaultTitle':{'type':Sequelize[_0xeca3('0x1')]},'customerAvatar':{'type':Sequelize[_0xeca3('0xc')]},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xeca3('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xeca3('0xa')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xeca3('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize['STRING'],'defaultValue':_0xeca3('0x26')},'systemAvatar':{'type':Sequelize[_0xeca3('0xc')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xeca3('0x6')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xeca3('0xa')],'defaultValue':![],'comment':_0xeca3('0x27'),'set':function(_0x53077e){if(!_0x53077e)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0xeca3('0x28')]('mandatoryDisposition',_0x53077e);}},'vidaooEscalation':{'type':Sequelize[_0xeca3('0xa')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xeca3('0x1')]},'vidaooTopic':{'type':Sequelize[_0xeca3('0x1')],'allowNull':![],'defaultValue':'Generated\x20by\x20XCALLY\x20Motion'},'vidaooNote':{'type':Sequelize[_0xeca3('0x1')],'defaultValue':function(){return _0xeca3('0x29');}},'vidaooMetadata':{'type':Sequelize[_0xeca3('0xc')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0xeca3('0xa')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0xeca3('0xc')]}}; \ No newline at end of file +var _0x59a2=['textarea','Comments','offlineForm','setDataValue','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','CHAT','System','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','exports','STRING','address','email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','squared','rounded','We\x20are\x20here!','Chat','Send','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Skip','Feedback','thumb','star','stringify','input','text','name','getDataValue','parse','onlineForm'];(function(_0x4f8912,_0x209a3d){var _0xe17e9d=function(_0x486ba7){while(--_0x486ba7){_0x4f8912['push'](_0x4f8912['shift']());}};_0xe17e9d(++_0x209a3d);}(_0x59a2,0x1ee));var _0x259a=function(_0x25efb8,_0x2ebd12){_0x25efb8=_0x25efb8-0x0;var _0x44de2a=_0x59a2[_0x25efb8];return _0x44de2a;};'use strict';var Sequelize=require(_0x259a('0x0'));var rs=require(_0x259a('0x1'));module[_0x259a('0x2')]={'name':{'type':Sequelize[_0x259a('0x3')],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x259a('0x4')},'description':{'type':Sequelize[_0x259a('0x3')]},'mapKey':{'type':Sequelize[_0x259a('0x3')],'defaultValue':_0x259a('0x5')},'mapKeyOffline':{'type':Sequelize[_0x259a('0x3')],'defaultValue':_0x259a('0x5')},'key':{'type':Sequelize[_0x259a('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x259a('0x3')],'defaultValue':_0x259a('0x6')},'customerAlias':{'type':Sequelize[_0x259a('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x259a('0x3')],'allowNull':![],'defaultValue':_0x259a('0x7'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x259a('0x3')],'allowNull':![],'defaultValue':_0x259a('0x8'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0x259a('0x3')],'allowNull':![],'defaultValue':_0x259a('0x8'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x259a('0x9')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x259a('0x3')]},'animation':{'type':Sequelize[_0x259a('0xa')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x259a('0xb')]('rounded',_0x259a('0xc')),'defaultValue':_0x259a('0xd')},'header_online':{'type':Sequelize[_0x259a('0x3')],'defaultValue':_0x259a('0xe')},'start_chat_button':{'type':Sequelize[_0x259a('0x3')],'defaultValue':_0x259a('0xf')},'offline_chat_button':{'type':Sequelize[_0x259a('0x3')],'defaultValue':_0x259a('0x10')},'header_offline':{'type':Sequelize[_0x259a('0x3')],'defaultValue':_0x259a('0x11')},'download_transcript':{'type':Sequelize[_0x259a('0xa')],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x259a('0x3')],'defaultValue':_0x259a('0x12')},'defaultWhiteLabel':{'type':Sequelize[_0x259a('0xa')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x259a('0x13')]},'closingQuestion':{'type':Sequelize[_0x259a('0x3')],'defaultValue':_0x259a('0x14')},'formSubmitSuccessMessage':{'type':Sequelize[_0x259a('0x3')],'defaultValue':_0x259a('0x15')},'formSubmitFailureMessage':{'type':Sequelize[_0x259a('0x3')],'defaultValue':_0x259a('0x16')},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':_0x259a('0x17')},'placeholderMessage':{'type':Sequelize[_0x259a('0x3')],'defaultValue':_0x259a('0x18')},'closingMessage':{'type':Sequelize[_0x259a('0x3')],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize[_0x259a('0x3')],'defaultValue':_0x259a('0x10')},'skipMessageButton':{'type':Sequelize[_0x259a('0x3')],'defaultValue':_0x259a('0x19')},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x259a('0xa')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x259a('0xa')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x259a('0xa')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x259a('0x3')],'defaultValue':_0x259a('0x1a')},'ratingType':{'type':Sequelize[_0x259a('0xb')]('star',_0x259a('0x1b')),'defaultValue':_0x259a('0x1c')},'ratingStarsNumber':{'type':Sequelize[_0x259a('0x9')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x259a('0x13')],'defaultValue':function(){return JSON[_0x259a('0x1d')]({'items':[{'type':_0x259a('0x1e'),'variable':null,'config':{'placeholder':'name','type':_0x259a('0x1f'),'required':!![]},'props':{'title':_0x259a('0x20'),'helpText':''}},{'type':_0x259a('0x1e'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x259a('0x5'),'type':_0x259a('0x5')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x259a('0x21')]('onlineForm')?JSON[_0x259a('0x22')](this[_0x259a('0x21')](_0x259a('0x23'))):{};},'set':function(_0x4cd9bb){return this['setDataValue']('onlineForm',JSON[_0x259a('0x1d')](_0x4cd9bb));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x259a('0x1d')]({'items':[{'type':'input','props':{'title':_0x259a('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0x259a('0x5'),'type':'email'},'variable':null},{'type':_0x259a('0x24'),'config':{'placeholder':_0x259a('0x25')},'props':{'title':'Comments','helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this[_0x259a('0x21')](_0x259a('0x26'))?JSON[_0x259a('0x22')](this[_0x259a('0x21')]('offlineForm')):{};},'set':function(_0x4d87e0){return this[_0x259a('0x27')](_0x259a('0x26'),JSON[_0x259a('0x1d')](_0x4d87e0));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize[_0x259a('0xa')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x259a('0xa')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x259a('0x3')]},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x259a('0x3')]},'waitingTitle':{'type':Sequelize[_0x259a('0x3')],'defaultValue':_0x259a('0x28')},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x259a('0x29')},'offlineMessageSubject':{'type':Sequelize[_0x259a('0x3')],'defaultValue':_0x259a('0x2a')},'offlineMessageBody':{'type':Sequelize[_0x259a('0x3')],'defaultValue':_0x259a('0x2b')},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize[_0x259a('0x3')],'defaultValue':_0x259a('0x19')},'sendUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x259a('0x10')},'enableCustomerAttachment':{'type':Sequelize[_0x259a('0xa')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x259a('0xa')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x259a('0x13')]},'showAgentAvatar':{'type':Sequelize[_0x259a('0xa')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x259a('0x3')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x259a('0x2c');}},'notificationSound':{'type':Sequelize[_0x259a('0xa')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x259a('0xa')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x259a('0xa')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x259a('0x3')],'defaultValue':_0x259a('0x2d')},'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['STRING'],'defaultValue':_0x259a('0x2e')},'verticalAlignment':{'type':Sequelize[_0x259a('0x9')],'defaultValue':0x1e},'labelText':{'type':Sequelize['STRING'],'defaultValue':_0x259a('0x2f')},'messagesAlignment':{'type':Sequelize[_0x259a('0x3')],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize[_0x259a('0x13')]},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x259a('0x9')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x259a('0xa')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x259a('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x259a('0x3')],'defaultValue':_0x259a('0x30')},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x259a('0x9')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x259a('0xa')],'defaultValue':![],'comment':_0x259a('0x31'),'set':function(_0xe4766d){if(!_0xe4766d)this[_0x259a('0x27')](_0x259a('0x32'),null);this['setDataValue'](_0x259a('0x33'),_0xe4766d);}},'vidaooEscalation':{'type':Sequelize[_0x259a('0xa')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x259a('0x3')]},'vidaooTopic':{'type':Sequelize[_0x259a('0x3')],'allowNull':![],'defaultValue':'Generated\x20by\x20XCALLY\x20Motion'},'vidaooNote':{'type':Sequelize[_0x259a('0x3')],'defaultValue':function(){return _0x259a('0x34');}},'vidaooMetadata':{'type':Sequelize['TEXT'],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x259a('0xa')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 40961e5..74e9ff2 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 _0xe5b3=['path','ejs','fs-extra','lodash','querystring','html-to-text','ioredis','jayson/promise','../../components/parsers/qs','../../config/logger','../../config/environment','../../errors/api','APINotFoundError','APIOutOfIntervalError','APIConflictError','./helpers/wildcard-expressions','url','URL','redis','localhost','socket.io-emitter','./chatWebsite.socket','register','client','http','then','ChatWebsite,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','destroy','get','ChatWebsites','UserProfileResource','stack','name','send','user-agent-parser','setUA','user-agent','getResult','split','firstName','lastName','x-real-port','referer','browser','version','format','unknown','%s\x20%s','device','vendor','%s\x20%s\x20%s','model','type','index','Pause','map','ChatWebsite','rawAttributes','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','options','includeAll','include','show','params','mandatoryDispositionPause','merge','find','create','body','address','forEach','trim','testWildcardValidity','\x22\x20is\x20not\x20a\x20valid\x20wildcard\x20expression','user','role','UserProfileSection','userProfileId','autoAssociation','update','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','findOne','findAll','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','sitepic','file','filename','addAvatar','agentAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','getLicense','custom','isNil','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','existsSync','server/files/images/avatars/','getCustomerAvatar','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','Interval','ifTime','notify','chat','from','From\x20is\x20mandatory','isEmpty','CmContact','No\x20available\x20attributes','createdAt','updatedAt','ListId','includes','mapKey','CmList','List','Contacts','DESC','ChatApplication','Applications','Intervals','Chat\x20Website\x20with\x20id\x20%s\x20not\x20found','account','applications','orderBy','list','defaults','contact','headers','threadId','closed','ChatInteraction','Writing\x20on\x20closed\x20interaction','externalUrl','ContactId','interaction','customerIp','messageId','created','autoclose','push','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','forcedOwnership','ChatQueue','queueId','Start','startRouting','EventManager','offline','files','Sequelize','difference','CompanyId','from\x20is\x20mandatory','ValidationError','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','render','fromString','originalname','mimetype','offline-chat','openNewInteraction','sequelize','transaction','MailAccount','MailServerOut','Smtp','CloudProvider','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','email','forwardOfflineAddress','offlineMessageSubject','MailAccountId','subjectOffline','toPairsIn','mapValues','Chat','NotifyMailAccount','notifyMail','server','attachments','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','order','Contact','Owner','fullname','internal','Tags','tag','getSnippet','interval','getProactiveActions','../../config/license/util','virtual','License','increment','chatLicenseExceeded','timezone','server/files/chat/iframe.ejs','3.13.0','origin','testWebsiteWithWildcard','remote','x-forwarded-for','connection','replace','verticalAlignment','color','labelText','textColor','textButtonColor','color_button','backgroundColor','hideWhenOffline','IntervalId','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','finally','getApplications','chatProactiveAction','ChatProactiveAction','getFields','online','false','onlineForm','items','fromKey','ChatOfflineMessage','Attachment','rows','addAgents','spread','emit','userChatWebsite:save','removeAgents','userChatWebsite:remove','getAgents','util'];(function(_0x3f46e6,_0x1870d2){var _0x291241=function(_0x4f5e8d){while(--_0x4f5e8d){_0x3f46e6['push'](_0x3f46e6['shift']());}};_0x291241(++_0x1870d2);}(_0xe5b3,0x133));var _0x3e5b=function(_0x66a2aa,_0x43001c){_0x66a2aa=_0x66a2aa-0x0;var _0x3933e7=_0xe5b3[_0x66a2aa];return _0x3933e7;};'use strict';var Mustache=require('mustache');var util=require(_0x3e5b('0x0'));var path=require(_0x3e5b('0x1'));var ejs=require(_0x3e5b('0x2'));var fs=require('fs');var fs_extra=require(_0x3e5b('0x3'));var _=require(_0x3e5b('0x4'));var querystring=require(_0x3e5b('0x5'));var htmlToText=require(_0x3e5b('0x6'));var Redis=require(_0x3e5b('0x7'));var jayson=require(_0x3e5b('0x8'));var qs=require(_0x3e5b('0x9'));var logger=require(_0x3e5b('0xa'))('api');var config=require(_0x3e5b('0xb'));var APIBadRequestError=require(_0x3e5b('0xc'))['APIBadRequestError'];var APINotFoundError=require(_0x3e5b('0xc'))[_0x3e5b('0xd')];var APIOutOfIntervalError=require(_0x3e5b('0xc'))[_0x3e5b('0xe')];var APIHandleError=require('../../errors/api')['handleError'];var APIConflictError=require(_0x3e5b('0xc'))[_0x3e5b('0xf')];var wildcardUtils=require(_0x3e5b('0x10'));var URL=require(_0x3e5b('0x11'))[_0x3e5b('0x12')];var db=require('../../mysqldb')['db'];config[_0x3e5b('0x13')]=_['defaults'](config[_0x3e5b('0x13')],{'host':_0x3e5b('0x14'),'port':0x18eb});var socket=require(_0x3e5b('0x15'))(new Redis(config[_0x3e5b('0x13')]));require(_0x3e5b('0x16'))[_0x3e5b('0x17')](socket);var client=jayson[_0x3e5b('0x18')]['http']({'port':0x232c});var client9002=jayson[_0x3e5b('0x18')]['http']({'port':0x232a});var client9003=jayson['client']['http']({'port':0x232b});var client9001=jayson[_0x3e5b('0x18')][_0x3e5b('0x19')]({'port':0x2329});function respondWithRpcPromise(_0x17aaa3,_0x4fb471,_0x1f81a7,_0x59ddc0){return new Promise(function(_0x56a453,_0x258d6a){var _0x11b41b=_0x59ddc0||client;return _0x11b41b['request'](_0x17aaa3,_0x1f81a7)[_0x3e5b('0x1a')](function(_0x143040){logger['info'](_0x3e5b('0x1b'),_0x4fb471,_0x3e5b('0x1c'));logger['debug']('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x4fb471,_0x3e5b('0x1c'),JSON[_0x3e5b('0x1d')](_0x143040));if(_0x143040[_0x3e5b('0x1e')]){if(_0x143040[_0x3e5b('0x1e')][_0x3e5b('0x1f')]===0x1f4){logger[_0x3e5b('0x1e')](_0x3e5b('0x1b'),_0x4fb471,_0x143040[_0x3e5b('0x1e')][_0x3e5b('0x20')]);return _0x258d6a(_0x143040[_0x3e5b('0x1e')][_0x3e5b('0x20')]);}logger[_0x3e5b('0x1e')](_0x3e5b('0x1b'),_0x4fb471,_0x143040[_0x3e5b('0x1e')]['message']);return _0x56a453(_0x143040[_0x3e5b('0x1e')][_0x3e5b('0x20')]);}else{logger[_0x3e5b('0x21')](_0x3e5b('0x1b'),_0x4fb471,'request\x20sent');_0x56a453(_0x143040[_0x3e5b('0x22')]['message']);}})[_0x3e5b('0x23')](function(_0x36d960){logger['error'](_0x3e5b('0x1b'),_0x4fb471,_0x36d960);_0x258d6a(_0x36d960);});});}function respondWithStatusCode(_0x2f6368,_0x42d7e9){_0x42d7e9=_0x42d7e9||0xcc;return function(_0x3c8965){if(_0x3c8965){return _0x2f6368[_0x3e5b('0x24')](_0x42d7e9);}return _0x2f6368[_0x3e5b('0x25')](_0x42d7e9)[_0x3e5b('0x26')]();};}function respondWithResult(_0x2ddf57,_0x4c4b89){_0x4c4b89=_0x4c4b89||0xc8;return function(_0x1c7278){if(_0x1c7278){return _0x2ddf57['status'](_0x4c4b89)[_0x3e5b('0x27')](_0x1c7278);}};}function respondWithFilteredResult(_0x4fd64b,_0x101653){return function(_0x1f6473){if(_0x1f6473){var _0x1296ec=typeof _0x101653[_0x3e5b('0x28')]===_0x3e5b('0x29')&&typeof _0x101653[_0x3e5b('0x2a')]===_0x3e5b('0x29');var _0x9c2123=_0x1f6473[_0x3e5b('0x2b')];var _0x112dc0=_0x1296ec?0x0:_0x101653[_0x3e5b('0x28')];var _0x489221=_0x1296ec?_0x1f6473[_0x3e5b('0x2b')]:_0x101653[_0x3e5b('0x28')]+_0x101653[_0x3e5b('0x2a')];var _0x2a14eb;if(_0x489221>=_0x9c2123){_0x489221=_0x9c2123;_0x2a14eb=0xc8;}else{_0x2a14eb=0xce;}_0x4fd64b[_0x3e5b('0x25')](_0x2a14eb);return _0x4fd64b[_0x3e5b('0x2c')](_0x3e5b('0x2d'),_0x112dc0+'-'+_0x489221+'/'+_0x9c2123)['json'](_0x1f6473);}return null;};}function saveUpdates(_0x33f089){return function(_0x56a527){if(_0x56a527){return _0x56a527['update'](_0x33f089)[_0x3e5b('0x1a')](function(_0x78d68a){return _0x78d68a;});}return null;};}function removeEntity(_0x51ea0d){return function(_0x40e37d){if(_0x40e37d){return _0x40e37d[_0x3e5b('0x2e')]()[_0x3e5b('0x1a')](function(){var _0x33e356=_0x40e37d[_0x3e5b('0x2f')]({'plain':!![]});var _0x26f842=_0x3e5b('0x30');return db[_0x3e5b('0x31')][_0x3e5b('0x2e')]({'where':{'type':_0x26f842,'resourceId':_0x33e356['id']}})[_0x3e5b('0x1a')](function(){return _0x40e37d;});})[_0x3e5b('0x1a')](function(){_0x51ea0d[_0x3e5b('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x141b7e){return function(_0xec45c5){if(!_0xec45c5){_0x141b7e['sendStatus'](0x194);}return _0xec45c5;};}function handleError(_0x4edf59,_0x471196){_0x471196=_0x471196||0x1f4;return function(_0x56d7ef){logger[_0x3e5b('0x1e')](_0x56d7ef[_0x3e5b('0x32')]);if(_0x56d7ef[_0x3e5b('0x33')]){delete _0x56d7ef[_0x3e5b('0x33')];}_0x4edf59['status'](_0x471196)[_0x3e5b('0x34')](_0x56d7ef);};}function createInteractionObject(_0x4cdcb1,_0x42b970,_0x5ec841,_0x47f7c8){var _0x48f414=require(_0x3e5b('0x35'));var _0x174ebf=new _0x48f414();var _0x2eaa30=_0x174ebf[_0x3e5b('0x36')](_0x5ec841[_0x3e5b('0x37')])[_0x3e5b('0x38')]();var _0x5466ac=_0x42b970['customerIp'];if(_0x5ec841['cf-connecting-ip']){_0x5466ac=_0x5ec841['cf-connecting-ip'];}else if(_0x5ec841['x-forwarded-for']){_0x5466ac=_['first'](_0x5ec841['x-forwarded-for'][_0x3e5b('0x39')](','));}return{'ContactId':_0x47f7c8['id'],'ChatWebsiteId':_0x4cdcb1,'from':(_0x47f7c8[_0x3e5b('0x3a')]||'')+'\x20'+(_0x47f7c8[_0x3e5b('0x3b')]||''),'customerIp':_0x5466ac,'customerPort':_0x5ec841[_0x3e5b('0x3c')]?_0x5ec841[_0x3e5b('0x3c')]:null,'referer':_0x42b970[_0x3e5b('0x3d')],'browserName':_0x2eaa30[_0x3e5b('0x3e')][_0x3e5b('0x33')]&&_0x2eaa30[_0x3e5b('0x3e')][_0x3e5b('0x3f')]?util[_0x3e5b('0x40')]('%s\x20%s',_0x2eaa30[_0x3e5b('0x3e')][_0x3e5b('0x33')],_0x2eaa30[_0x3e5b('0x3e')][_0x3e5b('0x3f')]):_0x3e5b('0x41'),'browserVersion':_0x2eaa30[_0x3e5b('0x3e')][_0x3e5b('0x3f')]||_0x3e5b('0x41'),'osName':util[_0x3e5b('0x40')](_0x3e5b('0x42'),_0x2eaa30['os'][_0x3e5b('0x33')],_0x2eaa30['os']['version']),'osVersion':_0x2eaa30['os']['version'],'deviceModel':_0x2eaa30['device']['model']&&_0x2eaa30[_0x3e5b('0x43')][_0x3e5b('0x44')]?util[_0x3e5b('0x40')](_0x3e5b('0x45'),_0x2eaa30[_0x3e5b('0x43')][_0x3e5b('0x46')],_0x2eaa30[_0x3e5b('0x43')][_0x3e5b('0x44')],_0x2eaa30[_0x3e5b('0x43')][_0x3e5b('0x47')]):null,'deviceVendor':_0x2eaa30['device'][_0x3e5b('0x44')],'deviceType':_0x2eaa30[_0x3e5b('0x43')][_0x3e5b('0x47')],'formData':JSON[_0x3e5b('0x1d')](_0x42b970)};}exports[_0x3e5b('0x48')]=function(_0x4f0c2c,_0x588ee7){var _0x495217={'include':[{'model':db[_0x3e5b('0x49')],'as':'mandatoryDispositionPause'}]},_0x1fbd87={},_0x20af6a={'count':0x0,'rows':[]};var _0x4b604d=_[_0x3e5b('0x4a')](db[_0x3e5b('0x4b')][_0x3e5b('0x4c')],function(_0x5acf51){return{'name':_0x5acf51['fieldName'],'type':_0x5acf51[_0x3e5b('0x47')]['key']};});_0x1fbd87[_0x3e5b('0x46')]=_[_0x3e5b('0x4a')](_0x4b604d,_0x3e5b('0x33'));_0x1fbd87[_0x3e5b('0x4d')]=_[_0x3e5b('0x4e')](_0x4f0c2c[_0x3e5b('0x4d')]);_0x1fbd87[_0x3e5b('0x4f')]=_[_0x3e5b('0x50')](_0x1fbd87[_0x3e5b('0x46')],_0x1fbd87['query']);_0x495217[_0x3e5b('0x51')]=_['intersection'](_0x1fbd87[_0x3e5b('0x46')],qs[_0x3e5b('0x52')](_0x4f0c2c[_0x3e5b('0x4d')][_0x3e5b('0x52')]));_0x495217[_0x3e5b('0x51')]=_0x495217[_0x3e5b('0x51')][_0x3e5b('0x53')]?_0x495217[_0x3e5b('0x51')]:_0x1fbd87[_0x3e5b('0x46')];if(!_0x4f0c2c[_0x3e5b('0x4d')][_0x3e5b('0x54')](_0x3e5b('0x55'))){_0x495217[_0x3e5b('0x2a')]=qs['limit'](_0x4f0c2c[_0x3e5b('0x4d')][_0x3e5b('0x2a')]);_0x495217[_0x3e5b('0x28')]=qs[_0x3e5b('0x28')](_0x4f0c2c[_0x3e5b('0x4d')][_0x3e5b('0x28')]);}_0x495217['order']=qs[_0x3e5b('0x56')](_0x4f0c2c[_0x3e5b('0x4d')][_0x3e5b('0x56')]);_0x495217[_0x3e5b('0x57')]=qs[_0x3e5b('0x4f')](_[_0x3e5b('0x58')](_0x4f0c2c[_0x3e5b('0x4d')],_0x1fbd87[_0x3e5b('0x4f')]),_0x4b604d);if(_0x4f0c2c['query'][_0x3e5b('0x59')]){_0x495217['where']=_['merge'](_0x495217[_0x3e5b('0x57')],{'$or':_['map'](_0x4b604d,function(_0x4a0c86){if(_0x4a0c86[_0x3e5b('0x47')]!==_0x3e5b('0x5a')){var _0x1f7959={};_0x1f7959[_0x4a0c86['name']]={'$like':'%'+_0x4f0c2c['query']['filter']+'%'};return _0x1f7959;}})});}_0x495217=_['merge']({},_0x495217,_0x4f0c2c[_0x3e5b('0x5b')]);var _0x999518={'where':_0x495217[_0x3e5b('0x57')]};return db[_0x3e5b('0x4b')][_0x3e5b('0x2b')](_0x999518)['then'](function(_0x5ac379){_0x20af6a[_0x3e5b('0x2b')]=_0x5ac379;if(_0x4f0c2c[_0x3e5b('0x4d')][_0x3e5b('0x5c')]){_0x495217[_0x3e5b('0x5d')]=[{'all':!![]}];}return db[_0x3e5b('0x4b')]['findAll'](_0x495217);})['then'](function(_0x4abd65){_0x20af6a['rows']=_0x4abd65;return _0x20af6a;})[_0x3e5b('0x1a')](respondWithFilteredResult(_0x588ee7,_0x495217))[_0x3e5b('0x23')](handleError(_0x588ee7,null));};exports[_0x3e5b('0x5e')]=function(_0x80b4,_0x424a3d){var _0x24087b={'raw':![],'where':{'id':_0x80b4[_0x3e5b('0x5f')]['id']},'include':[{'model':db['Pause'],'as':_0x3e5b('0x60')}]},_0x1915bc={};_0x1915bc[_0x3e5b('0x46')]=_[_0x3e5b('0x4e')](db[_0x3e5b('0x4b')][_0x3e5b('0x4c')]);_0x1915bc['query']=_[_0x3e5b('0x4e')](_0x80b4['query']);_0x1915bc[_0x3e5b('0x4f')]=_[_0x3e5b('0x50')](_0x1915bc['model'],_0x1915bc['query']);_0x24087b['attributes']=_[_0x3e5b('0x50')](_0x1915bc['model'],qs[_0x3e5b('0x52')](_0x80b4[_0x3e5b('0x4d')][_0x3e5b('0x52')]));_0x24087b[_0x3e5b('0x51')]=_0x24087b[_0x3e5b('0x51')]['length']?_0x24087b['attributes']:_0x1915bc[_0x3e5b('0x46')];if(_0x80b4[_0x3e5b('0x4d')][_0x3e5b('0x5c')]){_0x24087b['include']=[{'all':!![]}];}_0x24087b=_[_0x3e5b('0x61')]({},_0x24087b,_0x80b4[_0x3e5b('0x5b')]);return db[_0x3e5b('0x4b')][_0x3e5b('0x62')](_0x24087b)[_0x3e5b('0x1a')](handleEntityNotFound(_0x424a3d,null))[_0x3e5b('0x1a')](respondWithResult(_0x424a3d,null))[_0x3e5b('0x23')](handleError(_0x424a3d,null));};exports[_0x3e5b('0x63')]=function(_0x3a11a8,_0x52e98f){var _0x4eb336=null;_0x3a11a8[_0x3e5b('0x64')][_0x3e5b('0x65')][_0x3e5b('0x39')](',')[_0x3e5b('0x66')](_0x2411c3=>{if(_0x2411c3[_0x3e5b('0x67')]()!==''&&!wildcardUtils[_0x3e5b('0x68')](_0x2411c3['trim']())){_0x4eb336=new APIBadRequestError('\x22'+_0x2411c3[_0x3e5b('0x67')]()+_0x3e5b('0x69'));}});if(_0x4eb336){return handleError(_0x52e98f,null)(_0x4eb336);}return db['ChatWebsite'][_0x3e5b('0x63')](_0x3a11a8[_0x3e5b('0x64')],{})['then'](function(_0x52d89e){var _0x4f67d1=_0x3a11a8[_0x3e5b('0x6a')][_0x3e5b('0x2f')]({'plain':!![]});if(!_0x4f67d1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4f67d1[_0x3e5b('0x6b')]===_0x3e5b('0x6a')){var _0x47b810=_0x52d89e[_0x3e5b('0x2f')]({'plain':!![]});var _0x17f60f=_0x3e5b('0x30');return db[_0x3e5b('0x6c')][_0x3e5b('0x62')]({'where':{'name':_0x17f60f,'userProfileId':_0x4f67d1[_0x3e5b('0x6d')]},'raw':!![]})[_0x3e5b('0x1a')](function(_0x410c7a){if(_0x410c7a&&_0x410c7a[_0x3e5b('0x6e')]===0x0){return db['UserProfileResource'][_0x3e5b('0x63')]({'name':_0x47b810[_0x3e5b('0x33')],'resourceId':_0x47b810['id'],'type':_0x410c7a[_0x3e5b('0x33')],'sectionId':_0x410c7a['id']},{})[_0x3e5b('0x1a')](function(){return _0x52d89e;});}else{return _0x52d89e;}})[_0x3e5b('0x23')](function(_0x1ec1f6){logger[_0x3e5b('0x1e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1ec1f6);throw _0x1ec1f6;});}return _0x52d89e;})['then'](respondWithResult(_0x52e98f,0xc9))[_0x3e5b('0x23')](handleError(_0x52e98f,null));};exports[_0x3e5b('0x6f')]=function(_0x4dd417,_0x404621){var _0x6e1c5=null;_0x4dd417[_0x3e5b('0x64')][_0x3e5b('0x65')][_0x3e5b('0x39')](',')[_0x3e5b('0x66')](_0x1bbcf5=>{if(_0x1bbcf5['trim']()!==''&&!wildcardUtils[_0x3e5b('0x68')](_0x1bbcf5[_0x3e5b('0x67')]())){_0x6e1c5=new APIBadRequestError('\x22'+_0x1bbcf5['trim']()+'\x22\x20is\x20not\x20a\x20valid\x20wildcard\x20expression');}});if(_0x6e1c5){return handleError(_0x404621,null)(_0x6e1c5);}if(_0x4dd417['body']['id']){delete _0x4dd417[_0x3e5b('0x64')]['id'];}return db[_0x3e5b('0x4b')][_0x3e5b('0x62')]({'where':{'id':_0x4dd417[_0x3e5b('0x5f')]['id']},'include':[{'model':db[_0x3e5b('0x49')],'as':_0x3e5b('0x60')}]})['then'](handleEntityNotFound(_0x404621,null))[_0x3e5b('0x1a')](saveUpdates(_0x4dd417[_0x3e5b('0x64')],null))['then'](respondWithResult(_0x404621,null))[_0x3e5b('0x23')](handleError(_0x404621,null));};exports['destroy']=function(_0x4f62fb,_0x211e73){return db[_0x3e5b('0x4b')]['find']({'where':{'id':_0x4f62fb[_0x3e5b('0x5f')]['id']}})[_0x3e5b('0x1a')](handleEntityNotFound(_0x211e73,null))['then'](removeEntity(_0x211e73,null))[_0x3e5b('0x23')](handleError(_0x211e73,null));};exports[_0x3e5b('0x70')]=function(_0x14baa9,_0x1425eb){return db[_0x3e5b('0x4b')][_0x3e5b('0x70')]()['then'](respondWithResult(_0x1425eb,null))['catch'](handleError(_0x1425eb,null));};exports[_0x3e5b('0x71')]=function(_0x5c63d0,_0x568890){if(_0x5c63d0[_0x3e5b('0x64')]['id']){delete _0x5c63d0[_0x3e5b('0x64')]['id'];}return db[_0x3e5b('0x4b')]['find']({'where':{'id':_0x5c63d0[_0x3e5b('0x5f')]['id']}})['then'](handleEntityNotFound(_0x568890,null))[_0x3e5b('0x1a')](function(_0x4dbea3){if(_0x4dbea3){_0x5c63d0[_0x3e5b('0x64')][_0x3e5b('0x72')]=_0x4dbea3['id'];return db[_0x3e5b('0x73')][_0x3e5b('0x63')](_0x5c63d0['body']);}})[_0x3e5b('0x1a')](respondWithResult(_0x568890,null))['catch'](handleError(_0x568890,null));};exports[_0x3e5b('0x74')]=function(_0x8f992f,_0x58ccf3){var _0x272ef1={'raw':![],'where':{}};var _0x3279cc={};var _0x43e8ad={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x3e5b('0x75')]({'where':{'id':_0x8f992f[_0x3e5b('0x5f')]['id']}})[_0x3e5b('0x1a')](handleEntityNotFound(_0x58ccf3,null))['then'](function(_0x1797da){if(_0x1797da){_0x3279cc[_0x3e5b('0x46')]=_['keys'](db[_0x3e5b('0x73')][_0x3e5b('0x4c')]);_0x3279cc[_0x3e5b('0x4d')]=_['keys'](_0x8f992f[_0x3e5b('0x4d')]);_0x3279cc[_0x3e5b('0x4f')]=_[_0x3e5b('0x50')](_0x3279cc[_0x3e5b('0x46')],_0x3279cc['query']);_0x272ef1[_0x3e5b('0x51')]=_['intersection'](_0x3279cc[_0x3e5b('0x46')],qs['fields'](_0x8f992f[_0x3e5b('0x4d')][_0x3e5b('0x52')]));_0x272ef1['attributes']=_0x272ef1[_0x3e5b('0x51')][_0x3e5b('0x53')]?_0x272ef1['attributes']:_0x3279cc[_0x3e5b('0x46')];if(!_0x8f992f[_0x3e5b('0x4d')][_0x3e5b('0x54')](_0x3e5b('0x55'))){_0x272ef1['limit']=qs['limit'](_0x8f992f[_0x3e5b('0x4d')][_0x3e5b('0x2a')]);_0x272ef1[_0x3e5b('0x28')]=qs[_0x3e5b('0x28')](_0x8f992f[_0x3e5b('0x4d')][_0x3e5b('0x28')]);}_0x272ef1['order']=qs['sort'](_0x8f992f[_0x3e5b('0x4d')][_0x3e5b('0x56')]);_0x272ef1[_0x3e5b('0x57')]=qs[_0x3e5b('0x4f')](_[_0x3e5b('0x58')](_0x8f992f[_0x3e5b('0x4d')],_0x3279cc[_0x3e5b('0x4f')]));_0x272ef1[_0x3e5b('0x57')]['ChatWebsiteId']=_0x1797da['id'];if(_0x8f992f['query'][_0x3e5b('0x59')]){_0x272ef1['where']=_[_0x3e5b('0x61')](_0x272ef1[_0x3e5b('0x57')],{'$or':_[_0x3e5b('0x4a')](_0x272ef1[_0x3e5b('0x51')],function(_0x3d4e20){var _0x269c0a={};_0x269c0a[_0x3d4e20]={'$like':'%'+_0x8f992f[_0x3e5b('0x4d')][_0x3e5b('0x59')]+'%'};return _0x269c0a;})});}_0x272ef1=_[_0x3e5b('0x61')]({},_0x272ef1,_0x8f992f[_0x3e5b('0x5b')]);return db[_0x3e5b('0x73')][_0x3e5b('0x2b')]({'where':_0x272ef1[_0x3e5b('0x57')]})['then'](function(_0x59909d){_0x43e8ad[_0x3e5b('0x2b')]=_0x59909d;if(_0x8f992f[_0x3e5b('0x4d')][_0x3e5b('0x5c')]){_0x272ef1[_0x3e5b('0x5d')]=[{'all':!![]}];}return db['Disposition'][_0x3e5b('0x76')](_0x272ef1);})['then'](function(_0x215c43){_0x43e8ad['rows']=_0x215c43;return _0x43e8ad;});}})[_0x3e5b('0x1a')](respondWithFilteredResult(_0x58ccf3,_0x272ef1))[_0x3e5b('0x23')](handleError(_0x58ccf3,null));};exports[_0x3e5b('0x77')]=function(_0x5bc994,_0x121c8f){return db[_0x3e5b('0x4b')][_0x3e5b('0x62')]({'where':{'id':_0x5bc994[_0x3e5b('0x5f')]['id']}})[_0x3e5b('0x1a')](handleEntityNotFound(_0x121c8f,null))['then'](function(_0x57819a){if(_0x57819a){return _0x57819a[_0x3e5b('0x77')](_0x5bc994['query'][_0x3e5b('0x78')]);}})[_0x3e5b('0x1a')](respondWithStatusCode(_0x121c8f,null))[_0x3e5b('0x23')](handleError(_0x121c8f,null));};exports[_0x3e5b('0x79')]=function(_0x41de83,_0x2df067){if(_0x41de83[_0x3e5b('0x64')]['id']){delete _0x41de83[_0x3e5b('0x64')]['id'];}return db[_0x3e5b('0x4b')][_0x3e5b('0x62')]({'where':{'id':_0x41de83[_0x3e5b('0x5f')]['id']}})[_0x3e5b('0x1a')](handleEntityNotFound(_0x2df067,null))['then'](function(_0x9aecab){if(_0x9aecab){_0x41de83[_0x3e5b('0x64')]['ChatWebsiteId']=_0x9aecab['id'];return db['CannedAnswer'][_0x3e5b('0x63')](_0x41de83[_0x3e5b('0x64')]);}})[_0x3e5b('0x1a')](respondWithResult(_0x2df067,null))[_0x3e5b('0x23')](handleError(_0x2df067,null));};exports[_0x3e5b('0x7a')]=function(_0x4c66b7,_0xc78d12){var _0x41f7c8={'raw':![],'where':{}};var _0x506a2d={};var _0x53913d={'count':0x0,'rows':[]};return db[_0x3e5b('0x4b')][_0x3e5b('0x75')]({'where':{'id':_0x4c66b7['params']['id']}})['then'](handleEntityNotFound(_0xc78d12,null))[_0x3e5b('0x1a')](function(_0x12fcdf){if(_0x12fcdf){_0x506a2d['model']=_[_0x3e5b('0x4e')](db[_0x3e5b('0x7b')][_0x3e5b('0x4c')]);_0x506a2d[_0x3e5b('0x4d')]=_[_0x3e5b('0x4e')](_0x4c66b7['query']);_0x506a2d['filters']=_[_0x3e5b('0x50')](_0x506a2d[_0x3e5b('0x46')],_0x506a2d[_0x3e5b('0x4d')]);_0x41f7c8[_0x3e5b('0x51')]=_[_0x3e5b('0x50')](_0x506a2d[_0x3e5b('0x46')],qs[_0x3e5b('0x52')](_0x4c66b7[_0x3e5b('0x4d')][_0x3e5b('0x52')]));_0x41f7c8[_0x3e5b('0x51')]=_0x41f7c8[_0x3e5b('0x51')][_0x3e5b('0x53')]?_0x41f7c8[_0x3e5b('0x51')]:_0x506a2d[_0x3e5b('0x46')];if(!_0x4c66b7[_0x3e5b('0x4d')][_0x3e5b('0x54')](_0x3e5b('0x55'))){_0x41f7c8[_0x3e5b('0x2a')]=qs[_0x3e5b('0x2a')](_0x4c66b7[_0x3e5b('0x4d')][_0x3e5b('0x2a')]);_0x41f7c8[_0x3e5b('0x28')]=qs[_0x3e5b('0x28')](_0x4c66b7[_0x3e5b('0x4d')][_0x3e5b('0x28')]);}_0x41f7c8['order']=qs['sort'](_0x4c66b7[_0x3e5b('0x4d')][_0x3e5b('0x56')]);_0x41f7c8[_0x3e5b('0x57')]=qs[_0x3e5b('0x4f')](_['pick'](_0x4c66b7[_0x3e5b('0x4d')],_0x506a2d['filters']));_0x41f7c8[_0x3e5b('0x57')][_0x3e5b('0x72')]=_0x12fcdf['id'];if(_0x4c66b7[_0x3e5b('0x4d')][_0x3e5b('0x59')]){_0x41f7c8[_0x3e5b('0x57')]=_['merge'](_0x41f7c8[_0x3e5b('0x57')],{'$or':_[_0x3e5b('0x4a')](_0x41f7c8[_0x3e5b('0x51')],function(_0x2cedeb){var _0xf51840={};_0xf51840[_0x2cedeb]={'$like':'%'+_0x4c66b7[_0x3e5b('0x4d')]['filter']+'%'};return _0xf51840;})});}_0x41f7c8=_['merge']({},_0x41f7c8,_0x4c66b7[_0x3e5b('0x5b')]);return db['CannedAnswer'][_0x3e5b('0x2b')]({'where':_0x41f7c8[_0x3e5b('0x57')]})[_0x3e5b('0x1a')](function(_0x28d461){_0x53913d['count']=_0x28d461;if(_0x4c66b7['query'][_0x3e5b('0x5c')]){_0x41f7c8[_0x3e5b('0x5d')]=[{'all':!![]}];}return db[_0x3e5b('0x7b')][_0x3e5b('0x76')](_0x41f7c8);})[_0x3e5b('0x1a')](function(_0x1bbe3e){_0x53913d['rows']=_0x1bbe3e;return _0x53913d;});}})['then'](respondWithFilteredResult(_0xc78d12,_0x41f7c8))[_0x3e5b('0x23')](handleError(_0xc78d12,null));};exports[_0x3e5b('0x7c')]=function(_0x38db0c,_0x1ac1ad){return db[_0x3e5b('0x4b')][_0x3e5b('0x62')]({'where':{'id':_0x38db0c[_0x3e5b('0x5f')]['id']}})[_0x3e5b('0x1a')](handleEntityNotFound(_0x1ac1ad,null))[_0x3e5b('0x1a')](function(_0x3df23e){if(_0x3df23e){return _0x3df23e[_0x3e5b('0x7c')](_0x38db0c[_0x3e5b('0x4d')][_0x3e5b('0x78')]);}})[_0x3e5b('0x1a')](respondWithStatusCode(_0x1ac1ad,null))[_0x3e5b('0x23')](handleError(_0x1ac1ad,null));};exports['addLogo']=function(_0x3d381b,_0x3e4458){_0x3d381b[_0x3e5b('0x64')][_0x3e5b('0x7d')]=_0x3d381b[_0x3e5b('0x7e')][_0x3e5b('0x7f')];return db[_0x3e5b('0x4b')]['find']({'where':{'id':_0x3d381b[_0x3e5b('0x5f')]['id']}})[_0x3e5b('0x1a')](handleEntityNotFound(_0x3e4458,null))[_0x3e5b('0x1a')](saveUpdates(_0x3d381b[_0x3e5b('0x64')],null))['then'](respondWithResult(_0x3e4458,null))[_0x3e5b('0x23')](handleError(_0x3e4458,null));};exports[_0x3e5b('0x80')]=function(_0x253b17,_0x111f23){_0x253b17[_0x3e5b('0x64')][_0x3e5b('0x81')]=_0x253b17[_0x3e5b('0x7e')][_0x3e5b('0x7f')];return db[_0x3e5b('0x4b')][_0x3e5b('0x62')]({'where':{'id':_0x253b17[_0x3e5b('0x5f')]['id']}})[_0x3e5b('0x1a')](handleEntityNotFound(_0x111f23,null))['then'](saveUpdates(_0x253b17[_0x3e5b('0x64')],null))[_0x3e5b('0x1a')](respondWithResult(_0x111f23,null))[_0x3e5b('0x23')](handleError(_0x111f23,null));};exports[_0x3e5b('0x82')]=function(_0x1f12d8,_0x1ab144){_0x1f12d8[_0x3e5b('0x64')][_0x3e5b('0x83')]=_0x1f12d8[_0x3e5b('0x7e')]['filename'];return db['ChatWebsite'][_0x3e5b('0x62')]({'where':{'id':_0x1f12d8[_0x3e5b('0x5f')]['id']}})[_0x3e5b('0x1a')](handleEntityNotFound(_0x1ab144,null))['then'](saveUpdates(_0x1f12d8[_0x3e5b('0x64')],null))[_0x3e5b('0x1a')](respondWithResult(_0x1ab144,null))['catch'](handleError(_0x1ab144,null));};exports[_0x3e5b('0x84')]=function(_0x36c589,_0x3e6f62){_0x36c589[_0x3e5b('0x64')][_0x3e5b('0x85')]=_0x36c589[_0x3e5b('0x7e')][_0x3e5b('0x7f')];return db[_0x3e5b('0x4b')][_0x3e5b('0x62')]({'where':{'id':_0x36c589[_0x3e5b('0x5f')]['id']}})['then'](handleEntityNotFound(_0x3e6f62,null))[_0x3e5b('0x1a')](saveUpdates(_0x36c589['body'],null))[_0x3e5b('0x1a')](respondWithResult(_0x3e6f62,null))[_0x3e5b('0x23')](handleError(_0x3e6f62,null));};exports[_0x3e5b('0x86')]=function(_0x45b212,_0x272aab){var _0x5c8cf2=path[_0x3e5b('0x87')](config[_0x3e5b('0x88')],_0x3e5b('0x89'));var _0xe07809={'where':{'id':_0x45b212[_0x3e5b('0x5f')]['id']},'attributes':['id',_0x3e5b('0x7d')],'raw':!![]};var _0x61d17a=![];return require('../../config/license/util')[_0x3e5b('0x8a')]()[_0x3e5b('0x1a')](function(_0x5027ef){if(_0x5027ef){_0x61d17a=_0x5027ef[_0x3e5b('0x8b')];}})[_0x3e5b('0x1a')](function(){return db['ChatWebsite']['find'](_0xe07809);})['then'](handleEntityNotFound(_0x272aab,null))[_0x3e5b('0x1a')](function(_0x39dafa){if(_0x39dafa){if(!_[_0x3e5b('0x8c')](_0x39dafa['sitepic'])){if(fs['existsSync'](path[_0x3e5b('0x87')](config[_0x3e5b('0x88')],'server/files/images/logos/',_0x39dafa['sitepic']))&&_0x61d17a){_0x5c8cf2=path[_0x3e5b('0x87')](config[_0x3e5b('0x88')],_0x3e5b('0x8d'),_0x39dafa[_0x3e5b('0x7d')]);}}return _0x272aab[_0x3e5b('0x8e')](_0x5c8cf2);}})['catch'](handleError(_0x272aab,null));};exports[_0x3e5b('0x8f')]=function(_0x23c2e1,_0x6dc9ea){var _0x5c7523=path[_0x3e5b('0x87')](config[_0x3e5b('0x88')],_0x3e5b('0x90'));var _0x48d60d={'where':{'id':_0x23c2e1['params']['id']},'attributes':['id',_0x3e5b('0x81')],'raw':!![]};return db[_0x3e5b('0x4b')][_0x3e5b('0x62')](_0x48d60d)[_0x3e5b('0x1a')](handleEntityNotFound(_0x6dc9ea,null))[_0x3e5b('0x1a')](function(_0x55afb6){if(_0x55afb6){if(!_[_0x3e5b('0x8c')](_0x55afb6[_0x3e5b('0x81')])){if(fs[_0x3e5b('0x91')](path[_0x3e5b('0x87')](config[_0x3e5b('0x88')],_0x3e5b('0x92'),_0x55afb6['agentAvatar']))){_0x5c7523=path[_0x3e5b('0x87')](config[_0x3e5b('0x88')],_0x3e5b('0x92'),_0x55afb6['agentAvatar']);}}return _0x6dc9ea[_0x3e5b('0x8e')](_0x5c7523);}})[_0x3e5b('0x23')](handleError(_0x6dc9ea,null));};exports[_0x3e5b('0x93')]=function(_0x334086,_0x44b54b){var _0x4c1c66=path['join'](config['root'],'server/files/images/avatars/customer_avatar.png');var _0x5f2b13={'where':{'id':_0x334086[_0x3e5b('0x5f')]['id']},'attributes':['id',_0x3e5b('0x83'),_0x3e5b('0x94')],'raw':!![]};return db['ChatWebsite'][_0x3e5b('0x62')](_0x5f2b13)['then'](handleEntityNotFound(_0x44b54b,null))['then'](function(_0x376d11){if(_0x376d11){if(!_[_0x3e5b('0x8c')](_0x376d11['customerAvatar'])){if(fs[_0x3e5b('0x91')](path['join'](config[_0x3e5b('0x88')],'server/files/images/avatars/',_0x376d11[_0x3e5b('0x83')]))&&_0x376d11[_0x3e5b('0x94')]){_0x4c1c66=path[_0x3e5b('0x87')](config[_0x3e5b('0x88')],'server/files/images/avatars/',_0x376d11[_0x3e5b('0x83')]);}}return _0x44b54b[_0x3e5b('0x8e')](_0x4c1c66);}})[_0x3e5b('0x23')](handleError(_0x44b54b,null));};exports[_0x3e5b('0x95')]=function(_0x9a8a57,_0x59762c){var _0x2ad1dc=path[_0x3e5b('0x87')](config['root'],_0x3e5b('0x96'));var _0x5cf336={'where':{'id':_0x9a8a57[_0x3e5b('0x5f')]['id']},'attributes':['id',_0x3e5b('0x85')],'raw':!![]};return db[_0x3e5b('0x4b')]['find'](_0x5cf336)['then'](handleEntityNotFound(_0x59762c,null))['then'](function(_0x571557){if(_0x571557){if(!_[_0x3e5b('0x8c')](_0x571557[_0x3e5b('0x85')])){if(fs[_0x3e5b('0x91')](path[_0x3e5b('0x87')](config['root'],'server/files/images/avatars/',_0x571557['systemAvatar']))){_0x2ad1dc=path[_0x3e5b('0x87')](config[_0x3e5b('0x88')],_0x3e5b('0x92'),_0x571557['systemAvatar']);}}return _0x59762c[_0x3e5b('0x8e')](_0x2ad1dc);}})[_0x3e5b('0x23')](handleError(_0x59762c,null));};function checkWebsiteInterval(_0x25a910){var _0x59be8d=_0x25a910[_0x3e5b('0x97')];if(!_0x59be8d){return Promise['resolve'](_0x25a910);}var _0x13a7c1=_0x25a910['timezone']||undefined;return _0x59be8d[_0x3e5b('0x98')](_0x13a7c1)[_0x3e5b('0x1a')](function(_0x408741){if(!_0x408741){throw new APIOutOfIntervalError();}return _0x25a910;});}exports[_0x3e5b('0x99')]=function(_0x10fc88,_0x127d75){var _0x370c16={'body':_0x10fc88['body'],'channel':_0x3e5b('0x9a')};var _0x49ea7b=[];var _0x259c6d=[];var _0x51b6ae={};var _0x1a2f6e=![];if(_0x10fc88['body']['id']){delete _0x10fc88[_0x3e5b('0x64')]['id'];}if(_[_0x3e5b('0x8c')](_0x10fc88[_0x3e5b('0x64')][_0x3e5b('0x9b')])){throw new APIBadRequestError(_0x3e5b('0x9c'));}if(_[_0x3e5b('0x8c')](_0x10fc88[_0x3e5b('0x64')]['mapKey'])){throw new APIBadRequestError('MapKey\x20is\x20mandatory');}if(_[_0x3e5b('0x9d')](_0x10fc88[_0x3e5b('0x64')][_0x3e5b('0x64')])){throw new APIBadRequestError('Body\x20is\x20mandatory');}var _0x4a1cba=_0x10fc88[_0x3e5b('0x64')]['customerIp']&&_0x10fc88[_0x3e5b('0x64')][_0x3e5b('0x3d')];return db[_0x3e5b('0x9e')][_0x3e5b('0x70')]()[_0x3e5b('0x1a')](function(_0x4531d9){if(!_0x4531d9){throw new Error(_0x3e5b('0x9f'));}_0x49ea7b=Object[_0x3e5b('0x4e')](_0x4531d9)[_0x3e5b('0x59')](function(_0x5cb09d){return![_0x3e5b('0xa0'),_0x3e5b('0xa1')]['includes'](_0x5cb09d);});_0x259c6d=Object[_0x3e5b('0x4e')](_0x4531d9)[_0x3e5b('0x59')](function(_0x4bf241){return![_0x3e5b('0xa0'),_0x3e5b('0xa1'),'CompanyId',_0x3e5b('0xa2')]['includes'](_0x4bf241);});if(!_[_0x3e5b('0xa3')](_0x259c6d,_0x10fc88['body'][_0x3e5b('0xa4')])){throw new APIBadRequestError('Invalid\x20MapKey\x20parameter.\x20Allowed\x20values:\x20'+_0x259c6d[_0x3e5b('0x87')](',\x20'));}_0x51b6ae[_0x10fc88[_0x3e5b('0x64')][_0x3e5b('0xa4')]]=_0x10fc88[_0x3e5b('0x64')][_0x3e5b('0x9b')];})[_0x3e5b('0x1a')](function(){return db[_0x3e5b('0x4b')]['find']({'where':{'id':_0x10fc88[_0x3e5b('0x5f')]['id']},'include':[{'model':db[_0x3e5b('0xa5')],'as':_0x3e5b('0xa6'),'include':[{'model':db[_0x3e5b('0x9e')],'as':_0x3e5b('0xa7'),'where':_0x51b6ae,'limit':0x1,'order':[[_0x3e5b('0xa1'),_0x3e5b('0xa8')]]}]},{'model':db[_0x3e5b('0xa9')],'as':_0x3e5b('0xaa')},{'model':db[_0x3e5b('0x97')],'as':_0x3e5b('0x97'),'include':[{'model':db[_0x3e5b('0x97')],'as':_0x3e5b('0xab'),'attributes':['id','interval'],'raw':!![]}]}]});})[_0x3e5b('0x1a')](function(_0x240456){if(!_0x240456){throw new APINotFoundError(util[_0x3e5b('0x40')](_0x3e5b('0xac'),_0x10fc88[_0x3e5b('0x5f')]['id']));}if(_0x4a1cba){return checkWebsiteInterval(_0x240456);}return _0x240456;})[_0x3e5b('0x1a')](function(_0x40a017){_0x370c16[_0x3e5b('0xad')]=_0x40a017;_0x370c16[_0x3e5b('0xae')]=_[_0x3e5b('0xaf')](_0x40a017[_0x3e5b('0xaa')],['priority'],['asc']);if(_0x370c16['account'][_0x3e5b('0xaa')]){delete _0x370c16[_0x3e5b('0xad')][_0x3e5b('0xaa')];}_0x370c16[_0x3e5b('0xb0')]=_0x40a017[_0x3e5b('0xa6')]||{'id':_0x40a017[_0x3e5b('0xa2')]};if(_0x370c16[_0x3e5b('0xb0')]&&_0x370c16[_0x3e5b('0xb0')]['Contacts'][_0x3e5b('0x53')]){return _0x370c16[_0x3e5b('0xb0')][_0x3e5b('0xa7')][0x0];}var _0x27281e=_[_0x3e5b('0xb1')](_0x10fc88[_0x3e5b('0x64')],{'firstName':_0x10fc88[_0x3e5b('0x64')][_0x3e5b('0x9b')],'ListId':_0x40a017[_0x3e5b('0xa2')]});_0x27281e[_0x10fc88[_0x3e5b('0x64')][_0x3e5b('0xa4')]]=_0x10fc88[_0x3e5b('0x64')][_0x3e5b('0x9b')];return db[_0x3e5b('0x9e')]['create'](_0x27281e,{'fields':_0x49ea7b,'raw':!![]});})[_0x3e5b('0x1a')](function(_0x42b8dc){_0x370c16[_0x3e5b('0xb2')]=_0x42b8dc;var _0x1b9c17=createInteractionObject(_0x10fc88[_0x3e5b('0x5f')]['id'],_0x10fc88[_0x3e5b('0x64')],_0x10fc88[_0x3e5b('0xb3')],_0x42b8dc);var _0x5b6312={'ChatWebsiteId':_0x10fc88[_0x3e5b('0x5f')]['id']};if(_0x10fc88[_0x3e5b('0x64')]['threadId']){_0x5b6312['threadId']=_0x10fc88[_0x3e5b('0x64')][_0x3e5b('0xb4')];_0x5b6312[_0x3e5b('0xb5')]=![];return db[_0x3e5b('0xb6')][_0x3e5b('0x62')]({'where':_0x5b6312})['then'](function(_0x18bc27){var _0x34cec1=_0x10fc88[_0x3e5b('0x64')]['customerIp']&&_0x10fc88['body'][_0x3e5b('0x3d')];if(_0x18bc27){_0x1a2f6e=!![];return _0x18bc27;}else if(!_0x34cec1&&_0x18bc27&&_0x18bc27[_0x3e5b('0xb5')]){throw new APIConflictError(_0x3e5b('0xb7'));}_0x1b9c17['threadId']=_0x10fc88[_0x3e5b('0x64')][_0x3e5b('0xb4')];_0x1b9c17['externalUrl']=_0x10fc88[_0x3e5b('0x64')][_0x3e5b('0xb8')];return db[_0x3e5b('0xb6')][_0x3e5b('0x63')](_0x1b9c17);});}_0x5b6312[_0x3e5b('0xb9')]=_0x42b8dc['id'];if(_0x10fc88['body'][_0x3e5b('0xba')]&&_0x10fc88[_0x3e5b('0x64')][_0x3e5b('0xba')]['id']){_0x5b6312['id']=_0x10fc88['body'][_0x3e5b('0xba')]['id'];return db[_0x3e5b('0xb6')]['find']({'where':_0x5b6312})['then'](function(_0x2f56d7){var _0x329531=_0x10fc88['body'][_0x3e5b('0xbb')]&&_0x10fc88['body']['referer'];if(!_0x329531&&_0x2f56d7&&_0x2f56d7['closed']){throw new APIConflictError(_0x3e5b('0xb7'));}else if(_0x2f56d7){_0x1a2f6e=!![];return _0x2f56d7;}else{return db[_0x3e5b('0xb6')][_0x3e5b('0x63')](_0x1b9c17);}});}return db[_0x3e5b('0xb6')]['create'](_0x1b9c17);})['then'](function(_0x31dd7a){if(!_0x1a2f6e){return _0x31dd7a;}var _0x2af831={'from':(_0x370c16[_0x3e5b('0xb2')][_0x3e5b('0x3a')]||'')+'\x20'+(_0x370c16['contact'][_0x3e5b('0x3b')]||'')};if(_0x10fc88['body'][_0x3e5b('0xb4')]&&_0x10fc88['body']['messageId']&&_0x10fc88[_0x3e5b('0x64')]['threadId']!=_0x10fc88[_0x3e5b('0x64')][_0x3e5b('0xbc')]){_0x2af831[_0x3e5b('0xb4')]=_0x10fc88['body']['messageId'];}return _0x31dd7a['update'](_0x2af831);})['then'](function(_0x5d655f){_0x370c16[_0x3e5b('0xba')]=_0x5d655f[_0x3e5b('0x2f')]({'plain':!![]});_0x370c16[_0x3e5b('0xba')][_0x3e5b('0xbd')]=!_0x1a2f6e;if(_0x370c16['interaction'][_0x3e5b('0xbd')]){if(_0x370c16[_0x3e5b('0xad')][_0x3e5b('0xbe')]){_0x370c16[_0x3e5b('0xae')][_0x3e5b('0xbf')]({'id':0x0,'priority':_0x370c16[_0x3e5b('0xae')]['length']+0x1,'app':_0x3e5b('0xc0'),'appdata':_0x3e5b('0xc1'),'interval':_0x3e5b('0xc2')});}}return db[_0x3e5b('0xc3')][_0x3e5b('0x63')]({'body':_0x10fc88['body'][_0x3e5b('0x64')],'ChatWebsiteId':_0x10fc88[_0x3e5b('0x5f')]['id'],'ChatInteractionId':_0x5d655f['id'],'direction':'in','ContactId':_0x370c16['contact']['id'],'AttachmentId':_0x10fc88[_0x3e5b('0x64')][_0x3e5b('0xc4')]});})[_0x3e5b('0x1a')](function(_0x34c414){_0x370c16['message']=_0x34c414;if(!_0x370c16['interaction'][_0x3e5b('0xc5')]){return;}return db[_0x3e5b('0xc6')][_0x3e5b('0x62')]({'attributes':['id','name'],'where':{'id':_0x370c16['interaction']['UserId']}});})[_0x3e5b('0x1a')](function(_0x2be7d4){if(_0x2be7d4){_0x370c16['applications'][_0x3e5b('0xc7')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x2be7d4[_0x3e5b('0x33')]+','+(_0x370c16[_0x3e5b('0xad')][_0x3e5b('0xc8')]||0xa),'interval':_0x3e5b('0xc2')});_0x370c16[_0x3e5b('0xc9')]=!![];}if(!_0x370c16['interaction']['queueId']){return;}return db[_0x3e5b('0xca')]['find']({'attributes':['id',_0x3e5b('0x33')],'where':{'id':_0x370c16[_0x3e5b('0xba')][_0x3e5b('0xcb')]}});})['then'](function(_0x18621c){if(_0x18621c){_0x370c16[_0x3e5b('0xae')]['unshift']({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x18621c[_0x3e5b('0x33')]+','+(_0x370c16['account']['waitForTheAssignedQueue']||0x12c),'interval':_0x3e5b('0xc2')});}return respondWithRpcPromise(_0x3e5b('0xcc'),_0x3e5b('0xcd'),_0x370c16);})[_0x3e5b('0x1a')](function(_0x37943a){respondWithRpcPromise(_0x3e5b('0xce'),_0x3e5b('0xce'),{'event':_0x3e5b('0x99'),'message':_0x37943a},client9002);return _0x37943a;})['then'](respondWithResult(_0x127d75,null))['catch'](APIHandleError(_0x127d75));};exports[_0x3e5b('0xcf')]=function(_0x5750df,_0x5a26d9){var _0x2d8ef1,_0x556e15,_0x1fe234;var _0x1f0764=[];var _0x1eae47={};var _0x24f71b=_0x5750df[_0x3e5b('0xd0')]||[];var _0x242093=[];var _0x1b1564;return db[_0x3e5b('0x9e')][_0x3e5b('0x70')]()[_0x3e5b('0x1a')](function(_0x4ba35e){if(!_0x4ba35e){throw new db[(_0x3e5b('0xd1'))]['ValidationError']('no\x20available\x20attributes');}_0x1f0764=_[_0x3e5b('0xd2')](_[_0x3e5b('0x4e')](_0x4ba35e),['createdAt',_0x3e5b('0xa1'),_0x3e5b('0xd3'),_0x3e5b('0xa2')]);if(_0x5750df[_0x3e5b('0x64')]['id']){delete _0x5750df['body']['id'];}if(_[_0x3e5b('0x8c')](_0x5750df['body'][_0x3e5b('0x9b')])){throw _0x5a26d9[_0x3e5b('0x25')](0x1f4)[_0x3e5b('0x34')](new db[(_0x3e5b('0xd1'))]['ValidationError'](_0x3e5b('0xd4')));}if(_[_0x3e5b('0x8c')](_0x5750df[_0x3e5b('0x64')][_0x3e5b('0x64')])||_0x5750df[_0x3e5b('0x64')]['body']===''){throw _0x5a26d9[_0x3e5b('0x25')](0x1f4)[_0x3e5b('0x34')](new db[(_0x3e5b('0xd1'))][(_0x3e5b('0xd5'))]('body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_['isNil'](_0x5750df[_0x3e5b('0x64')][_0x3e5b('0xd6')])){throw _0x5a26d9[_0x3e5b('0x25')](0x1f4)[_0x3e5b('0x34')](new db['Sequelize'][(_0x3e5b('0xd5'))]('mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1f0764));}if(!_[_0x3e5b('0xa3')](_0x1f0764,_0x5750df['body'][_0x3e5b('0xd6')])){throw _0x5a26d9[_0x3e5b('0x25')](0x1f4)[_0x3e5b('0x34')](new db[(_0x3e5b('0xd1'))][(_0x3e5b('0xd5'))](_0x3e5b('0xd7')+_0x1f0764));}_0x1eae47[_0x5750df[_0x3e5b('0x64')][_0x3e5b('0xd6')]]=_0x5750df[_0x3e5b('0x64')][_0x3e5b('0x9b')];})[_0x3e5b('0x1a')](function(){return db[_0x3e5b('0x4b')][_0x3e5b('0x62')]({'where':{'id':_0x5750df[_0x3e5b('0x5f')]['id']},'include':[{'model':db[_0x3e5b('0xa5')],'as':_0x3e5b('0xa6')},{'model':db['MailAccount'],'as':'MailAccount'}]});})['then'](handleEntityNotFound(_0x5a26d9,null))[_0x3e5b('0x1a')](function(_0x38295b){if(_0x38295b&&_0x38295b[_0x3e5b('0xa6')]){_0x556e15=_0x38295b;var _0x533bbb=_[_0x3e5b('0xb1')](_0x5750df[_0x3e5b('0x64')],{'firstName':_0x5750df[_0x3e5b('0x64')][_0x3e5b('0x9b')],'phone':_0x5750df[_0x3e5b('0x64')][_0x3e5b('0x9b')],'ListId':_0x38295b[_0x3e5b('0xa2')]});_0x533bbb[_0x5750df[_0x3e5b('0x64')][_0x3e5b('0xd6')]]=_0x5750df[_0x3e5b('0x64')]['from'];return db[_0x3e5b('0x9e')][_0x3e5b('0xd8')]({'where':_0x1eae47,'defaults':_0x533bbb});}})['spread'](function(_0x1fe8af){if(_0x1fe8af){_0x1fe234=_0x1fe8af;var _0x104a3f=fs[_0x3e5b('0xd9')](path[_0x3e5b('0x87')](config['root'],_0x3e5b('0xda')),'utf8');var _0x3e907b=ejs[_0x3e5b('0xdb')](_0x104a3f,{'body':_['toPairs'](_0x5750df[_0x3e5b('0x64')][_0x3e5b('0x64')]),'bodyTitle':_0x556e15['offlineMessageBody']});return db['ChatOfflineMessage']['create']({'body':_0x3e907b,'plainBody':htmlToText[_0x3e5b('0xdc')](_0x3e907b),'ContactId':_0x1fe8af['id'],'ChatWebsiteId':_0x556e15['id']});}})[_0x3e5b('0x1a')](function(_0x346598){_0x1b1564=_0x346598;if(_0x24f71b[_0x3e5b('0x53')]){var _0x1e8990=_0x24f71b[_0x3e5b('0x4a')](function(_0x38cfb0){return{'name':_0x38cfb0[_0x3e5b('0xdd')],'basename':_0x38cfb0[_0x3e5b('0x7f')],'type':_0x38cfb0[_0x3e5b('0xde')],'ChatOfflineMessageId':_0x346598['id']};});_0x242093=_0x1e8990[_0x3e5b('0x4a')](_0x34d441=>{var _0x13b073={'filename':_0x34d441['name'],'path':path[_0x3e5b('0x87')](config[_0x3e5b('0x88')],'server','files','attachments',_0x3e5b('0xdf'),_0x34d441['basename'])};return _0x13b073;});if(!_0x556e15[_0x3e5b('0xe0')]){return db[_0x3e5b('0xe1')][_0x3e5b('0xe2')](function(_0x7a013d){return db['Attachment']['bulkCreate'](_0x1e8990,{'transaction':_0x7a013d});});}}})[_0x3e5b('0x1a')](function(){if(_0x1b1564){_0x2d8ef1=_0x1b1564;return db[_0x3e5b('0xe3')][_0x3e5b('0x75')]({'where':{'service':!![]},'include':[{'model':db[_0x3e5b('0xe4')],'as':_0x3e5b('0xe5'),'raw':!![],'include':[{'model':db[_0x3e5b('0xe6')],'as':'CloudProvider','raw':!![]}]}]});}})['then'](function(_0x110efe){if(_0x110efe&&_0x110efe[_0x3e5b('0xe5')]&&_0x556e15['forwardOffline']&&_0x556e15['forwardOfflineAddress']){var _0x11311d=_0x110efe[_0x3e5b('0xe7')]();return respondWithRpcPromise(_0x3e5b('0xe8'),_0x3e5b('0xe9'),{'account':_0x11311d,'message':{'from':util['format'](_0x3e5b('0xea'),_0x110efe[_0x3e5b('0x33')],_0x110efe[_0x3e5b('0xeb')]||_0x110efe[_0x3e5b('0xe5')][_0x3e5b('0x6a')]),'to':_0x556e15[_0x3e5b('0xec')],'subject':_0x556e15[_0x3e5b('0xed')],'html':_0x2d8ef1[_0x3e5b('0x64')],'attachments':_0x242093}},client9003)[_0x3e5b('0x1a')](function(){return _0x2d8ef1;})['catch'](function(_0x5756f9){logger['error'](_0x5756f9);});}})[_0x3e5b('0x1a')](function(){if(_0x556e15&&_0x556e15[_0x3e5b('0xe0')]&&_0x556e15[_0x3e5b('0xee')]){var _0x43d8ed=[];if(_0x24f71b[_0x3e5b('0x53')]){_0x43d8ed=_0x24f71b[_0x3e5b('0x4a')](function(_0x4da8aa){return{'name':_0x4da8aa['originalname'],'basename':_0x4da8aa[_0x3e5b('0x7f')],'type':_0x4da8aa[_0x3e5b('0xde')],'ChatOfflineMessageId':_0x1b1564['id']};});}var _0x180906;if(!_[_0x3e5b('0x8c')](_0x556e15[_0x3e5b('0xef')])){var _0x1f0412=_[_0x3e5b('0x4a')](_0x5750df['body'],function(_0x45114e){return _0x45114e;});var _0x35430b=_[_0x3e5b('0xf0')](_0x1f0412)[0x0];var _0x386a66=_[_0x3e5b('0xf1')](_0x35430b,function(_0x434e78){return _0x434e78;});_0x180906=_0x386a66[0x1][_0x556e15[_0x3e5b('0xef')]];}var _0x1583d7={'from':_0x1fe234[_0x3e5b('0xeb')],'firstName':_0x1fe234[_0x3e5b('0x3a')],'lastName':_0x1fe234[_0x3e5b('0x3b')],'mapKey':'email','message':{'from':_0x1fe234[_0x3e5b('0xeb')],'to':_0x556e15['MailAccount']['email'],'cc':'','subject':_[_0x3e5b('0x8c')](_0x180906)?_0x556e15[_0x3e5b('0xed')]:_0x180906,'messageId':'','sentAt':new Date(),'attach':_0x43d8ed[_0x3e5b('0x53')],'attachments':_0x43d8ed,'originChannel':_0x3e5b('0xf2'),'ChatWebsiteId':_0x556e15['id'],'ChatOfflineMessageId':_0x2d8ef1['id'],'originTo':_0x556e15[_0x3e5b('0xe3')]['email']},'body':_0x2d8ef1['body']};var _0x3a3e20={'account':{'id':_0x556e15[_0x3e5b('0xee')]},'body':_0x1583d7,'log':_0x3e5b('0xf3')};return respondWithRpcPromise('NotifyMailAccount',_0x3e5b('0xf4'),_0x3a3e20,client9001)[_0x3e5b('0x1a')](function(){return _0x2d8ef1;})[_0x3e5b('0x23')](function(_0x5e42d4){logger[_0x3e5b('0x1e')](_0x5e42d4);});}return;})[_0x3e5b('0x1a')](function(){if(_0x2d8ef1){return _0x2d8ef1;}})[_0x3e5b('0x1a')](respondWithResult(_0x5a26d9,null))[_0x3e5b('0x23')](function(){for(var _0x1a5048 of _0x24f71b){var _0x3dc35c=path[_0x3e5b('0x87')](config[_0x3e5b('0x88')],_0x3e5b('0xf5'),_0x3e5b('0xd0'),_0x3e5b('0xf6'),_0x3e5b('0xdf'),_0x1a5048[_0x3e5b('0x7f')]);fs_extra['remove'](_0x3dc35c)[_0x3e5b('0x23')](function(_0x555225){logger[_0x3e5b('0x1e')](_0x3e5b('0xf7'),_0x3dc35c,_0x555225);});}});};exports[_0x3e5b('0xf8')]=function(_0x42db1f,_0x4c8745){return db[_0x3e5b('0xb6')][_0x3e5b('0x62')]({'where':{'id':_0x42db1f[_0x3e5b('0x5f')]['id']}})['then'](handleEntityNotFound(_0x4c8745,null))[_0x3e5b('0x1a')](function(_0x332a9e){if(_0x332a9e){return _0x332a9e['addInteraction'](_0x42db1f[_0x3e5b('0x64')]['ids'],_[_0x3e5b('0xf9')](_0x42db1f[_0x3e5b('0x64')],[_0x3e5b('0x78'),'id'])||{});}})[_0x3e5b('0x1a')](respondWithResult(_0x4c8745,null))[_0x3e5b('0x23')](handleError(_0x4c8745,null));};exports[_0x3e5b('0xfa')]=function(_0x362b4a,_0x64d132){var _0x3fd595={'raw':![],'where':{}};var _0x5382e6={};var _0x50e28d={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x3e5b('0x75')]({'where':{'id':_0x362b4a['params']['id']}})[_0x3e5b('0x1a')](handleEntityNotFound(_0x64d132,null))['then'](function(_0x2aef9e){if(_0x2aef9e){_0x5382e6[_0x3e5b('0x46')]=_[_0x3e5b('0x4e')](db[_0x3e5b('0xb6')][_0x3e5b('0x4c')]);_0x5382e6['query']=_[_0x3e5b('0x4e')](_0x362b4a['query']);_0x5382e6['filters']=_[_0x3e5b('0x50')](_0x5382e6['model'],_0x5382e6[_0x3e5b('0x4d')]);_0x3fd595['attributes']=_[_0x3e5b('0x50')](_0x5382e6[_0x3e5b('0x46')],qs['fields'](_0x362b4a[_0x3e5b('0x4d')][_0x3e5b('0x52')]));_0x3fd595[_0x3e5b('0x51')]=_0x3fd595[_0x3e5b('0x51')][_0x3e5b('0x53')]?_0x3fd595['attributes']:_0x5382e6['model'];if(!_0x362b4a[_0x3e5b('0x4d')][_0x3e5b('0x54')](_0x3e5b('0x55'))){_0x3fd595[_0x3e5b('0x2a')]=qs['limit'](_0x362b4a['query']['limit']);_0x3fd595[_0x3e5b('0x28')]=qs[_0x3e5b('0x28')](_0x362b4a[_0x3e5b('0x4d')][_0x3e5b('0x28')]);}_0x3fd595[_0x3e5b('0xfb')]=qs[_0x3e5b('0x56')](_0x362b4a[_0x3e5b('0x4d')][_0x3e5b('0x56')]);_0x3fd595[_0x3e5b('0x57')]=qs[_0x3e5b('0x4f')](_[_0x3e5b('0x58')](_0x362b4a[_0x3e5b('0x4d')],_0x5382e6['filters']));_0x3fd595[_0x3e5b('0x57')][_0x3e5b('0x72')]=_0x2aef9e['id'];if(_0x362b4a['query'][_0x3e5b('0x59')]){_0x3fd595[_0x3e5b('0x57')]=_['merge'](_0x3fd595[_0x3e5b('0x57')],{'$or':_['map'](_0x3fd595[_0x3e5b('0x51')],function(_0x5a2747){var _0x292214={};_0x292214[_0x5a2747]={'$like':'%'+_0x362b4a[_0x3e5b('0x4d')][_0x3e5b('0x59')]+'%'};return _0x292214;})});}_0x3fd595=_[_0x3e5b('0x61')]({},_0x3fd595,_0x362b4a[_0x3e5b('0x5b')]);return db[_0x3e5b('0xb6')][_0x3e5b('0x2b')]({'where':_0x3fd595[_0x3e5b('0x57')]})[_0x3e5b('0x1a')](function(_0x5f0004){_0x50e28d[_0x3e5b('0x2b')]=_0x5f0004;if(_0x362b4a[_0x3e5b('0x4d')]['includeAll']){_0x3fd595[_0x3e5b('0x5d')]=[{'model':db[_0x3e5b('0x9e')],'as':_0x3e5b('0xfc'),'required':![]},{'model':db['User'],'as':_0x3e5b('0xfd'),'attributes':[_0x3e5b('0x33'),_0x3e5b('0xfe'),_0x3e5b('0xff')],'required':![]},{'model':db['Tag'],'as':_0x3e5b('0x100'),'attributes':['id',_0x3e5b('0x33'),'color'],'where':_0x362b4a[_0x3e5b('0x4d')][_0x3e5b('0x101')]?{'id':_0x362b4a['query']['tag']}:undefined,'required':_0x362b4a[_0x3e5b('0x4d')][_0x3e5b('0x101')]?!![]:![]}];}return db[_0x3e5b('0xb6')][_0x3e5b('0x76')](_0x3fd595);})[_0x3e5b('0x1a')](function(_0x3fb849){_0x50e28d['rows']=_0x3fb849;return _0x50e28d;});}})['then'](respondWithFilteredResult(_0x64d132,_0x3fd595))['catch'](handleError(_0x64d132,null));};exports[_0x3e5b('0x102')]=function(_0x2ba7c8,_0x5a0553){var _0x3c619a=0x0;var _0x927b25=0x0;var _0x4377be=![];var _0x41269e;var _0x1384a7;return db['ChatWebsite'][_0x3e5b('0x62')]({'where':{'id':_0x2ba7c8['params']['id']},'include':[{'model':db[_0x3e5b('0x97')],'as':_0x3e5b('0x97'),'include':[{'model':db[_0x3e5b('0x97')],'as':_0x3e5b('0xab'),'attributes':['id',_0x3e5b('0x103')]}]}]})['then'](handleEntityNotFound(_0x5a0553,null))[_0x3e5b('0x1a')](function(_0x145d81){if(_0x145d81){_0x41269e=_0x145d81;return _0x145d81[_0x3e5b('0x104')]({'raw':!![]});}})['then'](function(_0xe4197d){if(_0x41269e){if(_0xe4197d){_0x1384a7=_0xe4197d;}}return require(_0x3e5b('0x105'))[_0x3e5b('0x8a')]();})[_0x3e5b('0x1a')](function(_0x101f78){if(_0x101f78){_0x927b25=_0x101f78[_0x3e5b('0x106')];_0x4377be=_0x101f78[_0x3e5b('0x8b')];}})[_0x3e5b('0x1a')](function(){return db[_0x3e5b('0xb6')][_0x3e5b('0x2b')]({'where':{'closed':![]}});})[_0x3e5b('0x1a')](function(_0x2cfbdb){_0x3c619a=_0x2cfbdb;if(_0x927b25&&_0x2cfbdb>_0x927b25){return db[_0x3e5b('0x107')][_0x3e5b('0x75')]({'where':{'id':0x1}})[_0x3e5b('0x1a')](function(_0x315efe){if(_0x315efe){_0x315efe[_0x3e5b('0x108')](_0x3e5b('0x109'));}});}})[_0x3e5b('0x1a')](function(){var _0x4d20ac=_0x41269e[_0x3e5b('0x97')];var _0x385726=_0x41269e[_0x3e5b('0x10a')]||undefined;return _0x4d20ac?_0x4d20ac[_0x3e5b('0x98')](_0x385726):!![];})[_0x3e5b('0x1a')](function(_0x2a5704){var _0x2279fe=fs[_0x3e5b('0xd9')](path[_0x3e5b('0x87')](config[_0x3e5b('0x88')],_0x3e5b('0x10b')),'utf8');var _0x57712=_0x3e5b('0x10c');var _0x5a6b89=![];var _0x3a0d03,_0x174147;if(_0x2ba7c8['headers'][_0x3e5b('0x3d')]){_0x3a0d03=new URL(_0x2ba7c8[_0x3e5b('0xb3')][_0x3e5b('0x3d')])['origin'];}else if(_0x2ba7c8[_0x3e5b('0xb3')][_0x3e5b('0x10d')]){_0x3a0d03=new URL(_0x2ba7c8[_0x3e5b('0xb3')][_0x3e5b('0x10d')])[_0x3e5b('0x10d')];}else{_0x3a0d03='http://localhost:9000';}_0x174147=typeof _0x41269e[_0x3e5b('0x65')][_0x3e5b('0x39')](',')[_0x3e5b('0x62')](function(_0x279916){return wildcardUtils[_0x3e5b('0x10e')](_0x279916,_0x3a0d03);})!==_0x3e5b('0x29');var _0x1064b7={'chatVersion':_0x57712,'chatWebsiteAddressOrigin':_0x174147?_0x3a0d03:_0x41269e[_0x3e5b('0x65')],'remote':_0x41269e[_0x3e5b('0x10f')],'query':querystring[_0x3e5b('0x1d')](_[_0x3e5b('0x61')](_0x41269e[_0x3e5b('0x2f')]({'plain':!![]}),{'customerIp':_0x2ba7c8['headers'][_0x3e5b('0x110')]||_0x2ba7c8['headers']['x-real-ip']||_0x2ba7c8[_0x3e5b('0x111')]['remoteAddress']||_0x2ba7c8['ip'],'referer':_0x2ba7c8[_0x3e5b('0xb3')][_0x3e5b('0x3d')],'openedInteractions':_0x3c619a,'maxInteractions':_0x927b25,'virtual':_0x4377be['virtual'],'online':_0x2a5704,'custom':_0x4377be,'address':_0x174147?_0x3a0d03:null}))[_0x3e5b('0x112')](/'/g,'\x5c\x27')};_0x5a0553[_0x3e5b('0x34')](ejs[_0x3e5b('0xdb')](Mustache[_0x3e5b('0xdb')](_0x2279fe,_0x1064b7),{'proactiveActions':_0x1384a7,'alignment':_0x41269e['alignment'],'verticalAlignment':_0x41269e[_0x3e5b('0x113')],'div_color':_0x41269e[_0x3e5b('0x114')],'labelText':_0x41269e[_0x3e5b('0x115')],'text_color':_0x41269e[_0x3e5b('0x116')],'text_button_color':_0x41269e[_0x3e5b('0x117')],'button_color':_0x41269e[_0x3e5b('0x118')],'background_color':_0x41269e[_0x3e5b('0x119')],'hideWhenOffline':_0x41269e[_0x3e5b('0x11a')],'intervalId':_0x41269e[_0x3e5b('0x11b')],'isDevelopment':_0x5a6b89,'chatVersion':_0x57712}));})[_0x3e5b('0x23')](handleError(_0x5a0553,null));};exports['addApplications']=function(_0x44bebe,_0x42320e){var _0x20d4a2=_0x44bebe[_0x3e5b('0x5f')]['id'];var _0x53e2d0=_0x44bebe[_0x3e5b('0x64')];var _0x33c246=0xc8;var _0x179eb4=null;return db[_0x3e5b('0xe1')][_0x3e5b('0xe2')]({'isolationLevel':db[_0x3e5b('0xe1')][_0x3e5b('0x11c')][_0x3e5b('0x11d')][_0x3e5b('0x11e')]},function(_0x4fecda){return db[_0x3e5b('0x4b')][_0x3e5b('0x75')]({'where':{'id':_0x20d4a2},'transaction':_0x4fecda})[_0x3e5b('0x1a')](function(_0xc33124){if(_0xc33124){return db[_0x3e5b('0xa9')][_0x3e5b('0x2e')]({'where':{'ChatWebsiteId':_0x20d4a2},'transaction':_0x4fecda})[_0x3e5b('0x1a')](function(){var _0x4fcaf4=_[_0x3e5b('0x4a')](_0x53e2d0,function(_0x2fd7f8){_0x2fd7f8[_0x3e5b('0x72')]=_0x20d4a2;return _0x2fd7f8;});return db[_0x3e5b('0xa9')]['bulkCreate'](_0x4fcaf4,{'transaction':_0x4fecda});});}else{_0x33c246=0x194;_0x179eb4=[];}});})[_0x3e5b('0x1a')](function(){if(_0x33c246!==0x194){return db['ChatApplication'][_0x3e5b('0x11f')]({'where':{'ChatWebsiteId':_0x20d4a2},'order':'priority'})[_0x3e5b('0x1a')](function(_0x24361e){_0x179eb4=_0x24361e;});}})[_0x3e5b('0x23')](function(_0x4e95be){_0x33c246=0x1f4;logger['error'](_0x4e95be[_0x3e5b('0x32')]);if(_0x4e95be['name']){delete _0x4e95be[_0x3e5b('0x33')];}_0x179eb4=_0x4e95be;})[_0x3e5b('0x120')](function(){if(_0x179eb4===null){_0x42320e[_0x3e5b('0x24')](_0x33c246);}else{if(_0x33c246===0x1f4){_0x42320e[_0x3e5b('0x25')](_0x33c246)[_0x3e5b('0x34')](_0x179eb4);}else{_0x42320e['status'](_0x33c246)[_0x3e5b('0x27')](_0x179eb4);}}});};exports[_0x3e5b('0x121')]=function(_0x4ea05f,_0x3674dd){var _0x39e7bf={};var _0x31896f={};var _0x1be5f8;var _0x372e8b;return db[_0x3e5b('0x4b')][_0x3e5b('0x75')]({'where':{'id':_0x4ea05f['params']['id']}})[_0x3e5b('0x1a')](handleEntityNotFound(_0x3674dd,null))['then'](function(_0x4321c4){if(_0x4321c4){_0x1be5f8=_0x4321c4;_0x31896f[_0x3e5b('0x46')]=_['keys'](db[_0x3e5b('0xa9')][_0x3e5b('0x4c')]);_0x31896f[_0x3e5b('0x4d')]=_[_0x3e5b('0x4e')](_0x4ea05f[_0x3e5b('0x4d')]);_0x31896f[_0x3e5b('0x4f')]=_['intersection'](_0x31896f[_0x3e5b('0x46')],_0x31896f['query']);_0x39e7bf[_0x3e5b('0x51')]=_[_0x3e5b('0x50')](_0x31896f[_0x3e5b('0x46')],qs[_0x3e5b('0x52')](_0x4ea05f[_0x3e5b('0x4d')][_0x3e5b('0x52')]));_0x39e7bf[_0x3e5b('0x51')]=_0x39e7bf[_0x3e5b('0x51')][_0x3e5b('0x53')]?_0x39e7bf['attributes']:_0x31896f[_0x3e5b('0x46')];_0x39e7bf[_0x3e5b('0xfb')]=qs[_0x3e5b('0x56')](_0x4ea05f[_0x3e5b('0x4d')][_0x3e5b('0x56')]);_0x39e7bf[_0x3e5b('0x57')]=qs[_0x3e5b('0x4f')](_[_0x3e5b('0x58')](_0x4ea05f[_0x3e5b('0x4d')],_0x31896f[_0x3e5b('0x4f')]));if(_0x4ea05f[_0x3e5b('0x4d')]['filter']){_0x39e7bf[_0x3e5b('0x57')]=_[_0x3e5b('0x61')](_0x39e7bf[_0x3e5b('0x57')],{'$or':_[_0x3e5b('0x4a')](_0x39e7bf[_0x3e5b('0x51')],function(_0x4c94ea){var _0x853439={};_0x853439[_0x4c94ea]={'$like':'%'+_0x4ea05f[_0x3e5b('0x4d')]['filter']+'%'};return _0x853439;})});}_0x39e7bf=_[_0x3e5b('0x61')]({},_0x39e7bf,_0x4ea05f[_0x3e5b('0x5b')]);return _0x1be5f8['getApplications'](_0x39e7bf);}})[_0x3e5b('0x1a')](function(_0x3dec64){if(_0x3dec64){_0x372e8b=_0x3dec64[_0x3e5b('0x53')];if(!_0x4ea05f[_0x3e5b('0x4d')][_0x3e5b('0x54')](_0x3e5b('0x55'))){_0x39e7bf[_0x3e5b('0x2a')]=qs[_0x3e5b('0x2a')](_0x4ea05f[_0x3e5b('0x4d')][_0x3e5b('0x2a')]);_0x39e7bf[_0x3e5b('0x28')]=qs[_0x3e5b('0x28')](_0x4ea05f['query'][_0x3e5b('0x28')]);}return _0x1be5f8[_0x3e5b('0x121')](_0x39e7bf);}})[_0x3e5b('0x1a')](function(_0x2149df){if(_0x2149df){return _0x2149df?{'count':_0x372e8b,'rows':_0x2149df}:null;}})[_0x3e5b('0x1a')](respondWithResult(_0x3674dd,null))[_0x3e5b('0x23')](handleError(_0x3674dd,null));};exports['addProactiveActions']=function(_0xf3179,_0x7efc5a){return db[_0x3e5b('0x122')]['find']({'where':{'id':_0xf3179[_0x3e5b('0x5f')]['id']}})['then'](handleEntityNotFound(_0x7efc5a,null))[_0x3e5b('0x1a')](function(_0xcbca5a){if(_0xcbca5a){return _0xcbca5a['addProactiveActions'](_0xf3179[_0x3e5b('0x64')][_0x3e5b('0x78')],_[_0x3e5b('0xf9')](_0xf3179[_0x3e5b('0x64')],[_0x3e5b('0x78'),'id'])||{});}})[_0x3e5b('0x1a')](respondWithResult(_0x7efc5a,null))[_0x3e5b('0x23')](handleError(_0x7efc5a,null));};exports['getProactiveActions']=function(_0x52afba,_0x2d5599){var _0x4f4773={};var _0x24c8be={};var _0x5c8f64;var _0x58f4dc;return db[_0x3e5b('0x4b')]['findOne']({'where':{'id':_0x52afba['params']['id']}})[_0x3e5b('0x1a')](handleEntityNotFound(_0x2d5599,null))[_0x3e5b('0x1a')](function(_0x25eda6){if(_0x25eda6){_0x5c8f64=_0x25eda6;_0x24c8be[_0x3e5b('0x46')]=_[_0x3e5b('0x4e')](db[_0x3e5b('0x123')][_0x3e5b('0x4c')]);_0x24c8be[_0x3e5b('0x4d')]=_['keys'](_0x52afba['query']);_0x24c8be[_0x3e5b('0x4f')]=_[_0x3e5b('0x50')](_0x24c8be['model'],_0x24c8be[_0x3e5b('0x4d')]);_0x4f4773[_0x3e5b('0x51')]=_[_0x3e5b('0x50')](_0x24c8be['model'],qs[_0x3e5b('0x52')](_0x52afba[_0x3e5b('0x4d')][_0x3e5b('0x52')]));_0x4f4773[_0x3e5b('0x51')]=_0x4f4773[_0x3e5b('0x51')][_0x3e5b('0x53')]?_0x4f4773['attributes']:_0x24c8be[_0x3e5b('0x46')];_0x4f4773[_0x3e5b('0xfb')]=qs[_0x3e5b('0x56')](_0x52afba[_0x3e5b('0x4d')][_0x3e5b('0x56')]);_0x4f4773[_0x3e5b('0x57')]=qs['filters'](_['pick'](_0x52afba[_0x3e5b('0x4d')],_0x24c8be['filters']));if(_0x52afba[_0x3e5b('0x4d')]['filter']){_0x4f4773['where']=_['merge'](_0x4f4773['where'],{'$or':_['map'](_0x4f4773['attributes'],function(_0x44c05a){var _0x4605e7={};_0x4605e7[_0x44c05a]={'$like':'%'+_0x52afba[_0x3e5b('0x4d')]['filter']+'%'};return _0x4605e7;})});}_0x4f4773=_[_0x3e5b('0x61')]({},_0x4f4773,_0x52afba[_0x3e5b('0x5b')]);return _0x5c8f64[_0x3e5b('0x104')](_0x4f4773);}})[_0x3e5b('0x1a')](function(_0x2c71b7){if(_0x2c71b7){_0x58f4dc=_0x2c71b7['length'];if(!_0x52afba[_0x3e5b('0x4d')][_0x3e5b('0x54')](_0x3e5b('0x55'))){_0x4f4773[_0x3e5b('0x2a')]=qs[_0x3e5b('0x2a')](_0x52afba[_0x3e5b('0x4d')]['limit']);_0x4f4773[_0x3e5b('0x28')]=qs['offset'](_0x52afba[_0x3e5b('0x4d')][_0x3e5b('0x28')]);}return _0x5c8f64[_0x3e5b('0x104')](_0x4f4773);}})[_0x3e5b('0x1a')](function(_0x19e743){if(_0x19e743){return _0x19e743?{'count':_0x58f4dc,'rows':_0x19e743}:null;}})[_0x3e5b('0x1a')](respondWithResult(_0x2d5599,null))[_0x3e5b('0x23')](handleError(_0x2d5599,null));};exports[_0x3e5b('0x124')]=function(_0x2f56f7,_0x4f4124){var _0x5b3865=_0x2f56f7[_0x3e5b('0x4d')][_0x3e5b('0x125')]===_0x3e5b('0x126')?'offlineForm':_0x3e5b('0x127');return db[_0x3e5b('0x4b')][_0x3e5b('0x62')]({'attributes':['id',_0x5b3865],'where':{'id':_0x2f56f7[_0x3e5b('0x5f')]['id']}})[_0x3e5b('0x1a')](handleEntityNotFound(_0x4f4124,null))[_0x3e5b('0x1a')](function(_0x237cd0){if(_0x237cd0){var _0x4dfcc3=_0x237cd0[_0x5b3865];var _0x26c52b=_0x4dfcc3&&_0x4dfcc3[_0x3e5b('0x128')]?_0x4dfcc3['items']:[];_0x4f4124[_0x3e5b('0x34')]({'fromKey':_[_0x3e5b('0x8c')](_0x4dfcc3[_0x3e5b('0x129')])?undefined:_0x4dfcc3[_0x3e5b('0x129')],'count':_0x26c52b['length'],'rows':_0x26c52b});}})[_0x3e5b('0x23')](handleError(_0x4f4124,null));};exports['getOfflineMessages']=function(_0x1fe8da,_0x5df772){var _0x1b5c74={'raw':![],'where':{}};var _0x37dc9e={};var _0x5c7a01={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x3e5b('0x75')]({'where':{'id':_0x1fe8da[_0x3e5b('0x5f')]['id']}})[_0x3e5b('0x1a')](handleEntityNotFound(_0x5df772,null))[_0x3e5b('0x1a')](function(_0x35fb01){if(_0x35fb01){_0x37dc9e[_0x3e5b('0x46')]=_[_0x3e5b('0x4e')](db[_0x3e5b('0x12a')][_0x3e5b('0x4c')]);_0x37dc9e[_0x3e5b('0x4d')]=_[_0x3e5b('0x4e')](_0x1fe8da[_0x3e5b('0x4d')]);_0x37dc9e['filters']=_[_0x3e5b('0x50')](_0x37dc9e['model'],_0x37dc9e[_0x3e5b('0x4d')]);_0x1b5c74[_0x3e5b('0x51')]=_['intersection'](_0x37dc9e['model'],qs[_0x3e5b('0x52')](_0x1fe8da[_0x3e5b('0x4d')][_0x3e5b('0x52')]));_0x1b5c74[_0x3e5b('0x51')]=_0x1b5c74[_0x3e5b('0x51')][_0x3e5b('0x53')]?_0x1b5c74['attributes']:_0x37dc9e['model'];if(!_0x1fe8da[_0x3e5b('0x4d')]['hasOwnProperty'](_0x3e5b('0x55'))){_0x1b5c74[_0x3e5b('0x2a')]=qs[_0x3e5b('0x2a')](_0x1fe8da[_0x3e5b('0x4d')]['limit']);_0x1b5c74[_0x3e5b('0x28')]=qs[_0x3e5b('0x28')](_0x1fe8da[_0x3e5b('0x4d')][_0x3e5b('0x28')]);}_0x1b5c74[_0x3e5b('0xfb')]=qs[_0x3e5b('0x56')](_0x1fe8da[_0x3e5b('0x4d')]['sort']);_0x1b5c74[_0x3e5b('0x57')]=qs[_0x3e5b('0x4f')](_[_0x3e5b('0x58')](_0x1fe8da[_0x3e5b('0x4d')],_0x37dc9e[_0x3e5b('0x4f')]));_0x1b5c74['where'][_0x3e5b('0x72')]=_0x35fb01['id'];if(_0x1fe8da[_0x3e5b('0x4d')][_0x3e5b('0x59')]){_0x1b5c74[_0x3e5b('0x57')]=_[_0x3e5b('0x61')](_0x1b5c74[_0x3e5b('0x57')],{'$or':_[_0x3e5b('0x4a')](_0x1b5c74[_0x3e5b('0x51')],function(_0xe37b2d){var _0x3f7969={};_0x3f7969[_0xe37b2d]={'$like':'%'+_0x1fe8da[_0x3e5b('0x4d')][_0x3e5b('0x59')]+'%'};return _0x3f7969;})});}_0x1b5c74=_['merge']({},_0x1b5c74,_0x1fe8da[_0x3e5b('0x5b')]);return db[_0x3e5b('0x12a')]['count']({'where':_0x1b5c74['where']})[_0x3e5b('0x1a')](function(_0x305242){_0x5c7a01[_0x3e5b('0x2b')]=_0x305242;if(_0x1fe8da['query'][_0x3e5b('0x5c')]){_0x1b5c74[_0x3e5b('0x5d')]=[{'all':!![]}];}else{_0x1b5c74[_0x3e5b('0x5d')]=[{'model':db[_0x3e5b('0x9e')],'as':'Contact','required':![]},{'model':db[_0x3e5b('0x12b')],'as':'Attachments','required':![]}];}return db[_0x3e5b('0x12a')]['findAll'](_0x1b5c74);})[_0x3e5b('0x1a')](function(_0x1ad093){_0x5c7a01[_0x3e5b('0x12c')]=_0x1ad093;return _0x5c7a01;});}})['then'](respondWithFilteredResult(_0x5df772,_0x1b5c74))[_0x3e5b('0x23')](handleError(_0x5df772,null));};exports[_0x3e5b('0x12d')]=function(_0x1e909b,_0x422e9f){return db[_0x3e5b('0x4b')][_0x3e5b('0x62')]({'where':{'id':_0x1e909b[_0x3e5b('0x5f')]['id']}})[_0x3e5b('0x1a')](handleEntityNotFound(_0x422e9f,null))[_0x3e5b('0x1a')](function(_0x318838){if(_0x318838){return _0x318838[_0x3e5b('0x12d')](_0x1e909b[_0x3e5b('0x64')][_0x3e5b('0x78')],_[_0x3e5b('0xf9')](_0x1e909b[_0x3e5b('0x64')],[_0x3e5b('0x78'),'id'])||{})[_0x3e5b('0x12e')](function(_0x329c7e){for(var _0x4a2afa=0x0;_0x4a2afa<_0x1e909b[_0x3e5b('0x64')][_0x3e5b('0x78')][_0x3e5b('0x53')];_0x4a2afa+=0x1){socket[_0x3e5b('0x12f')](_0x3e5b('0x130'),{'UserId':Number(_0x1e909b['body'][_0x3e5b('0x78')][_0x4a2afa]),'ChatWebsiteId':Number(_0x1e909b[_0x3e5b('0x5f')]['id'])});}return _0x329c7e;});}})[_0x3e5b('0x1a')](respondWithResult(_0x422e9f,null))[_0x3e5b('0x23')](handleError(_0x422e9f,null));};exports['removeAgents']=function(_0x32a075,_0x33cc14){return db[_0x3e5b('0x4b')][_0x3e5b('0x62')]({'where':{'id':_0x32a075['params']['id']}})['then'](handleEntityNotFound(_0x33cc14,null))['then'](function(_0x5cb446){if(_0x5cb446){return _0x5cb446[_0x3e5b('0x131')](_0x32a075['query'][_0x3e5b('0x78')])[_0x3e5b('0x1a')](function(){if(_['isArray'](_0x32a075[_0x3e5b('0x4d')][_0x3e5b('0x78')])){for(var _0x2c4edd=0x0;_0x2c4edd<_0x32a075[_0x3e5b('0x4d')][_0x3e5b('0x78')][_0x3e5b('0x53')];_0x2c4edd+=0x1){socket[_0x3e5b('0x12f')](_0x3e5b('0x132'),{'UserId':Number(_0x32a075[_0x3e5b('0x4d')][_0x3e5b('0x78')][_0x2c4edd]),'ChatWebsiteId':Number(_0x32a075['params']['id'])});}}else{socket[_0x3e5b('0x12f')]('userChatWebsite:remove',{'UserId':Number(_0x32a075[_0x3e5b('0x4d')]['ids']),'ChatWebsiteId':Number(_0x32a075[_0x3e5b('0x5f')]['id'])});}});}})[_0x3e5b('0x1a')](respondWithStatusCode(_0x33cc14,null))['catch'](handleError(_0x33cc14,null));};exports[_0x3e5b('0x133')]=function(_0x381f5c,_0x586800){var _0x1373cc={};var _0x6ca7ba={};var _0x5d596f;var _0x5a52a3;return db[_0x3e5b('0x4b')][_0x3e5b('0x75')]({'where':{'id':_0x381f5c[_0x3e5b('0x5f')]['id']}})['then'](handleEntityNotFound(_0x586800,null))[_0x3e5b('0x1a')](function(_0x207b1a){if(_0x207b1a){_0x5d596f=_0x207b1a;_0x6ca7ba[_0x3e5b('0x46')]=_['keys'](db[_0x3e5b('0xc6')][_0x3e5b('0x4c')]);_0x6ca7ba[_0x3e5b('0x4d')]=_['keys'](_0x381f5c[_0x3e5b('0x4d')]);_0x6ca7ba[_0x3e5b('0x4f')]=_[_0x3e5b('0x50')](_0x6ca7ba[_0x3e5b('0x46')],_0x6ca7ba[_0x3e5b('0x4d')]);_0x1373cc[_0x3e5b('0x51')]=_[_0x3e5b('0x50')](_0x6ca7ba[_0x3e5b('0x46')],qs[_0x3e5b('0x52')](_0x381f5c[_0x3e5b('0x4d')]['fields']));_0x1373cc[_0x3e5b('0x51')]=_0x1373cc[_0x3e5b('0x51')]['length']?_0x1373cc[_0x3e5b('0x51')]:_0x6ca7ba[_0x3e5b('0x46')];_0x1373cc[_0x3e5b('0xfb')]=qs[_0x3e5b('0x56')](_0x381f5c[_0x3e5b('0x4d')]['sort']);_0x1373cc['where']=qs[_0x3e5b('0x4f')](_[_0x3e5b('0x58')](_0x381f5c[_0x3e5b('0x4d')],_0x6ca7ba[_0x3e5b('0x4f')]));if(_0x381f5c['query']['filter']){_0x1373cc[_0x3e5b('0x57')]=_[_0x3e5b('0x61')](_0x1373cc['where'],{'$or':_[_0x3e5b('0x4a')](_0x1373cc[_0x3e5b('0x51')],function(_0x1ebd4c){var _0x1db91a={};_0x1db91a[_0x1ebd4c]={'$like':'%'+_0x381f5c['query'][_0x3e5b('0x59')]+'%'};return _0x1db91a;})});}_0x1373cc=_['merge']({},_0x1373cc,_0x381f5c['options']);return _0x5d596f[_0x3e5b('0x133')](_0x1373cc);}})[_0x3e5b('0x1a')](function(_0x4a966d){if(_0x4a966d){_0x5a52a3=_0x4a966d[_0x3e5b('0x53')];if(!_0x381f5c['query'][_0x3e5b('0x54')](_0x3e5b('0x55'))){_0x1373cc['limit']=qs[_0x3e5b('0x2a')](_0x381f5c[_0x3e5b('0x4d')][_0x3e5b('0x2a')]);_0x1373cc[_0x3e5b('0x28')]=qs[_0x3e5b('0x28')](_0x381f5c[_0x3e5b('0x4d')][_0x3e5b('0x28')]);}return _0x5d596f[_0x3e5b('0x133')](_0x1373cc);}})['then'](function(_0x3ff5c4){if(_0x3ff5c4){return _0x3ff5c4?{'count':_0x5a52a3,'rows':_0x3ff5c4}:null;}})['then'](respondWithResult(_0x586800,null))[_0x3e5b('0x23')](handleError(_0x586800,null));}; \ No newline at end of file +var _0x5c12=['sequelize','transaction','Attachment','bulkCreate','MailServerOut','Smtp','CloudProvider','forwardOffline','getSmtpOptions','sendMail','email','user','offlineMessageSubject','mimetype','subjectOffline','toPairsIn','mapValues','Chat','NotifyMailAccount','notifyMail','remove','addInteraction','omit','getInteractions','hasOwnProperty','Contact','fullname','internal','Tag','Tags','tag','getSnippet','interval','getProactiveActions','getLicense','virtual','increment','chatLicenseExceeded','ifTime','server/files/chat/iframe.ejs','3.13.0','origin','http://localhost:9000','address','testWebsiteWithWildcard','remote','x-real-ip','connection','remoteAddress','alignment','color','labelText','textColor','textButtonColor','color_button','hideWhenOffline','IntervalId','addApplications','Transaction','ISOLATION_LEVELS','ChatApplication','finally','getApplications','chatProactiveAction','getFields','online','false','items','fromKey','ChatOfflineMessage','Attachments','addAgents','userChatWebsite:save','removeAgents','isArray','emit','getAgents','util','path','fs-extra','lodash','querystring','html-to-text','ioredis','jayson/promise','../../components/parsers/qs','api','../../config/environment','../../errors/api','APINotFoundError','APIOutOfIntervalError','handleError','APIConflictError','./helpers/wildcard-expressions','url','URL','../../mysqldb','defaults','redis','socket.io-emitter','./chatWebsite.socket','register','client','http','request','info','request\x20sent','debug','error','code','message','ChatWebsite,\x20%s,\x20%s','result','catch','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','then','destroy','get','ChatWebsites','stack','name','send','user-agent-parser','setUA','user-agent','cf-connecting-ip','x-forwarded-for','first','split','firstName','x-real-port','referer','browser','version','unknown','model','device','vendor','type','stringify','index','mandatoryDispositionPause','map','ChatWebsite','fieldName','key','query','keys','intersection','attributes','fields','length','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','rawAttributes','includeAll','create','body','forEach','trim','testWildcardValidity','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','\x22\x20is\x20not\x20a\x20valid\x20wildcard\x20expression','find','Pause','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','findOne','order','removeDispositions','addAnswer','CannedAnswer','removeAnswers','ids','addLogo','sitepic','file','filename','addAvatar','agentAvatar','addCustomerAvatar','addSystemAvatar','systemAvatar','getLogo','root','server/files/images/logos/default_logo.svg','../../config/license/util','custom','isNil','join','server/files/images/logos/','download','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','showCustomerAvatar','customerAvatar','existsSync','getSystemAvatar','Interval','resolve','timezone','notify','chat','from','From\x20is\x20mandatory','mapKey','MapKey\x20is\x20mandatory','Body\x20is\x20mandatory','customerIp','CmContact','No\x20available\x20attributes','createdAt','includes','updatedAt','CompanyId','ListId','Invalid\x20MapKey\x20parameter.\x20Allowed\x20values:\x20','CmList','List','Contacts','DESC','Intervals','format','Chat\x20Website\x20with\x20id\x20%s\x20not\x20found','applications','orderBy','priority','asc','account','Applications','list','headers','threadId','ChatInteraction','closed','Writing\x20on\x20closed\x20interaction','externalUrl','ContactId','interaction','contact','lastName','messageId','created','autoclose','push','close','unmanaged','*,*,*,*','ChatMessage','UserId','User','unshift','agent','waitForTheAssignedAgent','queueId','queue','waitForTheAssignedQueue','Start','startRouting','EventManager','offline','files','no\x20available\x20attributes','difference','Sequelize','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','spread','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','offlineMessageBody','originalname','server','attachments','offline-chat','basename','openNewInteraction'];(function(_0x11df3e,_0x21249e){var _0x5139c4=function(_0x5d8f55){while(--_0x5d8f55){_0x11df3e['push'](_0x11df3e['shift']());}};_0x5139c4(++_0x21249e);}(_0x5c12,0x188));var _0x25c1=function(_0x2a7b50,_0x545d55){_0x2a7b50=_0x2a7b50-0x0;var _0x4224c9=_0x5c12[_0x2a7b50];return _0x4224c9;};'use strict';var Mustache=require('mustache');var util=require(_0x25c1('0x0'));var path=require(_0x25c1('0x1'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x25c1('0x2'));var _=require(_0x25c1('0x3'));var querystring=require(_0x25c1('0x4'));var htmlToText=require(_0x25c1('0x5'));var Redis=require(_0x25c1('0x6'));var jayson=require(_0x25c1('0x7'));var qs=require(_0x25c1('0x8'));var logger=require('../../config/logger')(_0x25c1('0x9'));var config=require(_0x25c1('0xa'));var APIBadRequestError=require(_0x25c1('0xb'))['APIBadRequestError'];var APINotFoundError=require('../../errors/api')[_0x25c1('0xc')];var APIOutOfIntervalError=require(_0x25c1('0xb'))[_0x25c1('0xd')];var APIHandleError=require(_0x25c1('0xb'))[_0x25c1('0xe')];var APIConflictError=require('../../errors/api')[_0x25c1('0xf')];var wildcardUtils=require(_0x25c1('0x10'));var URL=require(_0x25c1('0x11'))[_0x25c1('0x12')];var db=require(_0x25c1('0x13'))['db'];config['redis']=_[_0x25c1('0x14')](config[_0x25c1('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x25c1('0x16'))(new Redis(config[_0x25c1('0x15')]));require(_0x25c1('0x17'))[_0x25c1('0x18')](socket);var client=jayson['client']['http']({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});var client9003=jayson[_0x25c1('0x19')][_0x25c1('0x1a')]({'port':0x232b});var client9001=jayson[_0x25c1('0x19')][_0x25c1('0x1a')]({'port':0x2329});function respondWithRpcPromise(_0x17a032,_0x4ea926,_0x4638f0,_0x55b62d){return new Promise(function(_0x5d631e,_0x5b852a){var _0x284712=_0x55b62d||client;return _0x284712[_0x25c1('0x1b')](_0x17a032,_0x4638f0)['then'](function(_0x4c55e7){logger[_0x25c1('0x1c')]('ChatWebsite,\x20%s,\x20%s',_0x4ea926,_0x25c1('0x1d'));logger[_0x25c1('0x1e')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x4ea926,'request\x20sent',JSON['stringify'](_0x4c55e7));if(_0x4c55e7[_0x25c1('0x1f')]){if(_0x4c55e7[_0x25c1('0x1f')][_0x25c1('0x20')]===0x1f4){logger[_0x25c1('0x1f')]('ChatWebsite,\x20%s,\x20%s',_0x4ea926,_0x4c55e7[_0x25c1('0x1f')][_0x25c1('0x21')]);return _0x5b852a(_0x4c55e7[_0x25c1('0x1f')][_0x25c1('0x21')]);}logger['error']('ChatWebsite,\x20%s,\x20%s',_0x4ea926,_0x4c55e7[_0x25c1('0x1f')][_0x25c1('0x21')]);return _0x5d631e(_0x4c55e7[_0x25c1('0x1f')][_0x25c1('0x21')]);}else{logger[_0x25c1('0x1c')](_0x25c1('0x22'),_0x4ea926,_0x25c1('0x1d'));_0x5d631e(_0x4c55e7[_0x25c1('0x23')][_0x25c1('0x21')]);}})[_0x25c1('0x24')](function(_0x2f78dd){logger[_0x25c1('0x1f')](_0x25c1('0x22'),_0x4ea926,_0x2f78dd);_0x5b852a(_0x2f78dd);});});}function respondWithStatusCode(_0x4915cc,_0x2dadae){_0x2dadae=_0x2dadae||0xcc;return function(_0x20dbb9){if(_0x20dbb9){return _0x4915cc[_0x25c1('0x25')](_0x2dadae);}return _0x4915cc[_0x25c1('0x26')](_0x2dadae)[_0x25c1('0x27')]();};}function respondWithResult(_0x326a5f,_0x5ad776){_0x5ad776=_0x5ad776||0xc8;return function(_0x17c924){if(_0x17c924){return _0x326a5f[_0x25c1('0x26')](_0x5ad776)[_0x25c1('0x28')](_0x17c924);}};}function respondWithFilteredResult(_0x38c1d5,_0x11c0ae){return function(_0x193a68){if(_0x193a68){var _0x5c56ab=typeof _0x11c0ae[_0x25c1('0x29')]==='undefined'&&typeof _0x11c0ae[_0x25c1('0x2a')]===_0x25c1('0x2b');var _0x2c42b9=_0x193a68[_0x25c1('0x2c')];var _0x2e80b5=_0x5c56ab?0x0:_0x11c0ae[_0x25c1('0x29')];var _0x1fd4e3=_0x5c56ab?_0x193a68[_0x25c1('0x2c')]:_0x11c0ae[_0x25c1('0x29')]+_0x11c0ae['limit'];var _0xa46f98;if(_0x1fd4e3>=_0x2c42b9){_0x1fd4e3=_0x2c42b9;_0xa46f98=0xc8;}else{_0xa46f98=0xce;}_0x38c1d5['status'](_0xa46f98);return _0x38c1d5['set'](_0x25c1('0x2d'),_0x2e80b5+'-'+_0x1fd4e3+'/'+_0x2c42b9)[_0x25c1('0x28')](_0x193a68);}return null;};}function saveUpdates(_0x4ef790){return function(_0x173f3e){if(_0x173f3e){return _0x173f3e['update'](_0x4ef790)[_0x25c1('0x2e')](function(_0x4834b3){return _0x4834b3;});}return null;};}function removeEntity(_0x1084b8){return function(_0x7f1e7a){if(_0x7f1e7a){return _0x7f1e7a[_0x25c1('0x2f')]()[_0x25c1('0x2e')](function(){var _0x1d4afc=_0x7f1e7a[_0x25c1('0x30')]({'plain':!![]});var _0x461d23=_0x25c1('0x31');return db['UserProfileResource'][_0x25c1('0x2f')]({'where':{'type':_0x461d23,'resourceId':_0x1d4afc['id']}})['then'](function(){return _0x7f1e7a;});})[_0x25c1('0x2e')](function(){_0x1084b8['status'](0xcc)[_0x25c1('0x27')]();});}};}function handleEntityNotFound(_0x1917e6){return function(_0x18f10c){if(!_0x18f10c){_0x1917e6[_0x25c1('0x25')](0x194);}return _0x18f10c;};}function handleError(_0x390083,_0x92184a){_0x92184a=_0x92184a||0x1f4;return function(_0x35e632){logger[_0x25c1('0x1f')](_0x35e632[_0x25c1('0x32')]);if(_0x35e632[_0x25c1('0x33')]){delete _0x35e632[_0x25c1('0x33')];}_0x390083[_0x25c1('0x26')](_0x92184a)[_0x25c1('0x34')](_0x35e632);};}function createInteractionObject(_0x1b6e92,_0x266f3b,_0x14288b,_0x349aef){var _0x30b1d7=require(_0x25c1('0x35'));var _0x357385=new _0x30b1d7();var _0x5c6d45=_0x357385[_0x25c1('0x36')](_0x14288b[_0x25c1('0x37')])['getResult']();var _0x32ab98=_0x266f3b['customerIp'];if(_0x14288b[_0x25c1('0x38')]){_0x32ab98=_0x14288b['cf-connecting-ip'];}else if(_0x14288b[_0x25c1('0x39')]){_0x32ab98=_[_0x25c1('0x3a')](_0x14288b[_0x25c1('0x39')][_0x25c1('0x3b')](','));}return{'ContactId':_0x349aef['id'],'ChatWebsiteId':_0x1b6e92,'from':(_0x349aef[_0x25c1('0x3c')]||'')+'\x20'+(_0x349aef['lastName']||''),'customerIp':_0x32ab98,'customerPort':_0x14288b[_0x25c1('0x3d')]?_0x14288b['x-real-port']:null,'referer':_0x266f3b[_0x25c1('0x3e')],'browserName':_0x5c6d45[_0x25c1('0x3f')][_0x25c1('0x33')]&&_0x5c6d45[_0x25c1('0x3f')]['version']?util['format']('%s\x20%s',_0x5c6d45[_0x25c1('0x3f')][_0x25c1('0x33')],_0x5c6d45['browser'][_0x25c1('0x40')]):'unknown','browserVersion':_0x5c6d45[_0x25c1('0x3f')][_0x25c1('0x40')]||_0x25c1('0x41'),'osName':util['format']('%s\x20%s',_0x5c6d45['os']['name'],_0x5c6d45['os'][_0x25c1('0x40')]),'osVersion':_0x5c6d45['os'][_0x25c1('0x40')],'deviceModel':_0x5c6d45['device'][_0x25c1('0x42')]&&_0x5c6d45[_0x25c1('0x43')][_0x25c1('0x44')]?util['format']('%s\x20%s\x20%s',_0x5c6d45['device']['model'],_0x5c6d45[_0x25c1('0x43')][_0x25c1('0x44')],_0x5c6d45['device'][_0x25c1('0x45')]):null,'deviceVendor':_0x5c6d45[_0x25c1('0x43')][_0x25c1('0x44')],'deviceType':_0x5c6d45[_0x25c1('0x43')][_0x25c1('0x45')],'formData':JSON[_0x25c1('0x46')](_0x266f3b)};}exports[_0x25c1('0x47')]=function(_0x552174,_0x545934){var _0x28fc89={'include':[{'model':db['Pause'],'as':_0x25c1('0x48')}]},_0x43d96a={},_0x389547={'count':0x0,'rows':[]};var _0x1c95e5=_[_0x25c1('0x49')](db[_0x25c1('0x4a')]['rawAttributes'],function(_0xb87cf1){return{'name':_0xb87cf1[_0x25c1('0x4b')],'type':_0xb87cf1[_0x25c1('0x45')][_0x25c1('0x4c')]};});_0x43d96a['model']=_['map'](_0x1c95e5,_0x25c1('0x33'));_0x43d96a[_0x25c1('0x4d')]=_[_0x25c1('0x4e')](_0x552174[_0x25c1('0x4d')]);_0x43d96a['filters']=_[_0x25c1('0x4f')](_0x43d96a[_0x25c1('0x42')],_0x43d96a['query']);_0x28fc89[_0x25c1('0x50')]=_[_0x25c1('0x4f')](_0x43d96a[_0x25c1('0x42')],qs[_0x25c1('0x51')](_0x552174['query']['fields']));_0x28fc89[_0x25c1('0x50')]=_0x28fc89[_0x25c1('0x50')][_0x25c1('0x52')]?_0x28fc89['attributes']:_0x43d96a[_0x25c1('0x42')];if(!_0x552174[_0x25c1('0x4d')]['hasOwnProperty'](_0x25c1('0x53'))){_0x28fc89[_0x25c1('0x2a')]=qs[_0x25c1('0x2a')](_0x552174[_0x25c1('0x4d')][_0x25c1('0x2a')]);_0x28fc89[_0x25c1('0x29')]=qs[_0x25c1('0x29')](_0x552174['query']['offset']);}_0x28fc89['order']=qs[_0x25c1('0x54')](_0x552174['query'][_0x25c1('0x54')]);_0x28fc89[_0x25c1('0x55')]=qs[_0x25c1('0x56')](_[_0x25c1('0x57')](_0x552174[_0x25c1('0x4d')],_0x43d96a[_0x25c1('0x56')]),_0x1c95e5);if(_0x552174['query'][_0x25c1('0x58')]){_0x28fc89[_0x25c1('0x55')]=_[_0x25c1('0x59')](_0x28fc89[_0x25c1('0x55')],{'$or':_[_0x25c1('0x49')](_0x1c95e5,function(_0xed718b){if(_0xed718b['type']!==_0x25c1('0x5a')){var _0x2e741f={};_0x2e741f[_0xed718b[_0x25c1('0x33')]]={'$like':'%'+_0x552174[_0x25c1('0x4d')][_0x25c1('0x58')]+'%'};return _0x2e741f;}})});}_0x28fc89=_['merge']({},_0x28fc89,_0x552174[_0x25c1('0x5b')]);var _0x3df219={'where':_0x28fc89['where']};return db[_0x25c1('0x4a')][_0x25c1('0x2c')](_0x3df219)[_0x25c1('0x2e')](function(_0x24c71a){_0x389547[_0x25c1('0x2c')]=_0x24c71a;if(_0x552174[_0x25c1('0x4d')]['includeAll']){_0x28fc89[_0x25c1('0x5c')]=[{'all':!![]}];}return db[_0x25c1('0x4a')][_0x25c1('0x5d')](_0x28fc89);})[_0x25c1('0x2e')](function(_0x286800){_0x389547[_0x25c1('0x5e')]=_0x286800;return _0x389547;})[_0x25c1('0x2e')](respondWithFilteredResult(_0x545934,_0x28fc89))[_0x25c1('0x24')](handleError(_0x545934,null));};exports[_0x25c1('0x5f')]=function(_0x455607,_0x270d67){var _0x2d9e6b={'raw':![],'where':{'id':_0x455607[_0x25c1('0x60')]['id']},'include':[{'model':db['Pause'],'as':_0x25c1('0x48')}]},_0x3ff0fa={};_0x3ff0fa[_0x25c1('0x42')]=_[_0x25c1('0x4e')](db[_0x25c1('0x4a')][_0x25c1('0x61')]);_0x3ff0fa[_0x25c1('0x4d')]=_[_0x25c1('0x4e')](_0x455607['query']);_0x3ff0fa[_0x25c1('0x56')]=_['intersection'](_0x3ff0fa[_0x25c1('0x42')],_0x3ff0fa[_0x25c1('0x4d')]);_0x2d9e6b[_0x25c1('0x50')]=_[_0x25c1('0x4f')](_0x3ff0fa[_0x25c1('0x42')],qs[_0x25c1('0x51')](_0x455607[_0x25c1('0x4d')][_0x25c1('0x51')]));_0x2d9e6b['attributes']=_0x2d9e6b[_0x25c1('0x50')][_0x25c1('0x52')]?_0x2d9e6b[_0x25c1('0x50')]:_0x3ff0fa[_0x25c1('0x42')];if(_0x455607[_0x25c1('0x4d')][_0x25c1('0x62')]){_0x2d9e6b[_0x25c1('0x5c')]=[{'all':!![]}];}_0x2d9e6b=_['merge']({},_0x2d9e6b,_0x455607[_0x25c1('0x5b')]);return db['ChatWebsite']['find'](_0x2d9e6b)['then'](handleEntityNotFound(_0x270d67,null))[_0x25c1('0x2e')](respondWithResult(_0x270d67,null))[_0x25c1('0x24')](handleError(_0x270d67,null));};exports[_0x25c1('0x63')]=function(_0x15cd6d,_0x45724c){var _0x58c743=null;_0x15cd6d[_0x25c1('0x64')]['address'][_0x25c1('0x3b')](',')[_0x25c1('0x65')](_0x2029ac=>{if(_0x2029ac[_0x25c1('0x66')]()!==''&&!wildcardUtils[_0x25c1('0x67')](_0x2029ac[_0x25c1('0x66')]())){_0x58c743=new APIBadRequestError('\x22'+_0x2029ac[_0x25c1('0x66')]()+'\x22\x20is\x20not\x20a\x20valid\x20wildcard\x20expression');}});if(_0x58c743){return handleError(_0x45724c,null)(_0x58c743);}return db[_0x25c1('0x4a')][_0x25c1('0x63')](_0x15cd6d[_0x25c1('0x64')],{})[_0x25c1('0x2e')](function(_0x242149){var _0x425f3e=_0x15cd6d['user'][_0x25c1('0x30')]({'plain':!![]});if(!_0x425f3e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x425f3e[_0x25c1('0x68')]==='user'){var _0x588b5f=_0x242149[_0x25c1('0x30')]({'plain':!![]});var _0x58fd37='ChatWebsites';return db['UserProfileSection']['find']({'where':{'name':_0x58fd37,'userProfileId':_0x425f3e[_0x25c1('0x69')]},'raw':!![]})['then'](function(_0x11aafa){if(_0x11aafa&&_0x11aafa[_0x25c1('0x6a')]===0x0){return db[_0x25c1('0x6b')][_0x25c1('0x63')]({'name':_0x588b5f['name'],'resourceId':_0x588b5f['id'],'type':_0x11aafa['name'],'sectionId':_0x11aafa['id']},{})[_0x25c1('0x2e')](function(){return _0x242149;});}else{return _0x242149;}})[_0x25c1('0x24')](function(_0x5df07e){logger[_0x25c1('0x1f')](_0x25c1('0x6c'),_0x5df07e);throw _0x5df07e;});}return _0x242149;})[_0x25c1('0x2e')](respondWithResult(_0x45724c,0xc9))['catch'](handleError(_0x45724c,null));};exports[_0x25c1('0x6d')]=function(_0x48ecff,_0x21df62){var _0x1b501d=null;_0x48ecff[_0x25c1('0x64')]['address'][_0x25c1('0x3b')](',')[_0x25c1('0x65')](_0x2a3aad=>{if(_0x2a3aad['trim']()!==''&&!wildcardUtils[_0x25c1('0x67')](_0x2a3aad[_0x25c1('0x66')]())){_0x1b501d=new APIBadRequestError('\x22'+_0x2a3aad[_0x25c1('0x66')]()+_0x25c1('0x6e'));}});if(_0x1b501d){return handleError(_0x21df62,null)(_0x1b501d);}if(_0x48ecff[_0x25c1('0x64')]['id']){delete _0x48ecff[_0x25c1('0x64')]['id'];}return db[_0x25c1('0x4a')][_0x25c1('0x6f')]({'where':{'id':_0x48ecff[_0x25c1('0x60')]['id']},'include':[{'model':db[_0x25c1('0x70')],'as':_0x25c1('0x48')}]})[_0x25c1('0x2e')](handleEntityNotFound(_0x21df62,null))[_0x25c1('0x2e')](saveUpdates(_0x48ecff[_0x25c1('0x64')],null))['then'](respondWithResult(_0x21df62,null))[_0x25c1('0x24')](handleError(_0x21df62,null));};exports[_0x25c1('0x2f')]=function(_0x138376,_0x35792c){return db[_0x25c1('0x4a')][_0x25c1('0x6f')]({'where':{'id':_0x138376[_0x25c1('0x60')]['id']}})[_0x25c1('0x2e')](handleEntityNotFound(_0x35792c,null))[_0x25c1('0x2e')](removeEntity(_0x35792c,null))[_0x25c1('0x24')](handleError(_0x35792c,null));};exports[_0x25c1('0x71')]=function(_0x5bd027,_0x1a1a02){return db['ChatWebsite'][_0x25c1('0x71')]()[_0x25c1('0x2e')](respondWithResult(_0x1a1a02,null))['catch'](handleError(_0x1a1a02,null));};exports[_0x25c1('0x72')]=function(_0x13755b,_0x833e8f){if(_0x13755b['body']['id']){delete _0x13755b[_0x25c1('0x64')]['id'];}return db[_0x25c1('0x4a')]['find']({'where':{'id':_0x13755b[_0x25c1('0x60')]['id']}})[_0x25c1('0x2e')](handleEntityNotFound(_0x833e8f,null))[_0x25c1('0x2e')](function(_0x50ce85){if(_0x50ce85){_0x13755b[_0x25c1('0x64')][_0x25c1('0x73')]=_0x50ce85['id'];return db[_0x25c1('0x74')][_0x25c1('0x63')](_0x13755b['body']);}})[_0x25c1('0x2e')](respondWithResult(_0x833e8f,null))['catch'](handleError(_0x833e8f,null));};exports[_0x25c1('0x75')]=function(_0x35153c,_0x48e3bc){var _0x41e5c5={'raw':![],'where':{}};var _0x5f55c1={};var _0x3e14e6={'count':0x0,'rows':[]};return db[_0x25c1('0x4a')][_0x25c1('0x76')]({'where':{'id':_0x35153c[_0x25c1('0x60')]['id']}})[_0x25c1('0x2e')](handleEntityNotFound(_0x48e3bc,null))[_0x25c1('0x2e')](function(_0xed1dc5){if(_0xed1dc5){_0x5f55c1['model']=_['keys'](db[_0x25c1('0x74')][_0x25c1('0x61')]);_0x5f55c1['query']=_[_0x25c1('0x4e')](_0x35153c[_0x25c1('0x4d')]);_0x5f55c1[_0x25c1('0x56')]=_['intersection'](_0x5f55c1['model'],_0x5f55c1[_0x25c1('0x4d')]);_0x41e5c5['attributes']=_[_0x25c1('0x4f')](_0x5f55c1[_0x25c1('0x42')],qs[_0x25c1('0x51')](_0x35153c[_0x25c1('0x4d')]['fields']));_0x41e5c5['attributes']=_0x41e5c5[_0x25c1('0x50')]['length']?_0x41e5c5[_0x25c1('0x50')]:_0x5f55c1[_0x25c1('0x42')];if(!_0x35153c[_0x25c1('0x4d')]['hasOwnProperty'](_0x25c1('0x53'))){_0x41e5c5[_0x25c1('0x2a')]=qs[_0x25c1('0x2a')](_0x35153c[_0x25c1('0x4d')][_0x25c1('0x2a')]);_0x41e5c5[_0x25c1('0x29')]=qs[_0x25c1('0x29')](_0x35153c[_0x25c1('0x4d')][_0x25c1('0x29')]);}_0x41e5c5[_0x25c1('0x77')]=qs[_0x25c1('0x54')](_0x35153c['query'][_0x25c1('0x54')]);_0x41e5c5['where']=qs[_0x25c1('0x56')](_[_0x25c1('0x57')](_0x35153c[_0x25c1('0x4d')],_0x5f55c1[_0x25c1('0x56')]));_0x41e5c5[_0x25c1('0x55')][_0x25c1('0x73')]=_0xed1dc5['id'];if(_0x35153c[_0x25c1('0x4d')]['filter']){_0x41e5c5['where']=_[_0x25c1('0x59')](_0x41e5c5['where'],{'$or':_['map'](_0x41e5c5[_0x25c1('0x50')],function(_0x20c41d){var _0x21f642={};_0x21f642[_0x20c41d]={'$like':'%'+_0x35153c[_0x25c1('0x4d')][_0x25c1('0x58')]+'%'};return _0x21f642;})});}_0x41e5c5=_[_0x25c1('0x59')]({},_0x41e5c5,_0x35153c['options']);return db[_0x25c1('0x74')][_0x25c1('0x2c')]({'where':_0x41e5c5[_0x25c1('0x55')]})[_0x25c1('0x2e')](function(_0x4a3b87){_0x3e14e6[_0x25c1('0x2c')]=_0x4a3b87;if(_0x35153c[_0x25c1('0x4d')][_0x25c1('0x62')]){_0x41e5c5[_0x25c1('0x5c')]=[{'all':!![]}];}return db['Disposition'][_0x25c1('0x5d')](_0x41e5c5);})[_0x25c1('0x2e')](function(_0x27bdf6){_0x3e14e6[_0x25c1('0x5e')]=_0x27bdf6;return _0x3e14e6;});}})[_0x25c1('0x2e')](respondWithFilteredResult(_0x48e3bc,_0x41e5c5))['catch'](handleError(_0x48e3bc,null));};exports[_0x25c1('0x78')]=function(_0x4a79a0,_0x174af3){return db['ChatWebsite'][_0x25c1('0x6f')]({'where':{'id':_0x4a79a0[_0x25c1('0x60')]['id']}})[_0x25c1('0x2e')](handleEntityNotFound(_0x174af3,null))['then'](function(_0x3e1429){if(_0x3e1429){return _0x3e1429['removeDispositions'](_0x4a79a0[_0x25c1('0x4d')]['ids']);}})[_0x25c1('0x2e')](respondWithStatusCode(_0x174af3,null))[_0x25c1('0x24')](handleError(_0x174af3,null));};exports[_0x25c1('0x79')]=function(_0x137725,_0x40b950){if(_0x137725[_0x25c1('0x64')]['id']){delete _0x137725['body']['id'];}return db[_0x25c1('0x4a')][_0x25c1('0x6f')]({'where':{'id':_0x137725[_0x25c1('0x60')]['id']}})['then'](handleEntityNotFound(_0x40b950,null))['then'](function(_0xfa8a4c){if(_0xfa8a4c){_0x137725[_0x25c1('0x64')][_0x25c1('0x73')]=_0xfa8a4c['id'];return db[_0x25c1('0x7a')][_0x25c1('0x63')](_0x137725[_0x25c1('0x64')]);}})[_0x25c1('0x2e')](respondWithResult(_0x40b950,null))['catch'](handleError(_0x40b950,null));};exports['getAnswers']=function(_0x5aabfa,_0x513f6a){var _0x14c05a={'raw':![],'where':{}};var _0xc68a7f={};var _0x158120={'count':0x0,'rows':[]};return db[_0x25c1('0x4a')][_0x25c1('0x76')]({'where':{'id':_0x5aabfa[_0x25c1('0x60')]['id']}})[_0x25c1('0x2e')](handleEntityNotFound(_0x513f6a,null))[_0x25c1('0x2e')](function(_0x23463e){if(_0x23463e){_0xc68a7f[_0x25c1('0x42')]=_[_0x25c1('0x4e')](db[_0x25c1('0x7a')][_0x25c1('0x61')]);_0xc68a7f[_0x25c1('0x4d')]=_[_0x25c1('0x4e')](_0x5aabfa['query']);_0xc68a7f[_0x25c1('0x56')]=_[_0x25c1('0x4f')](_0xc68a7f['model'],_0xc68a7f[_0x25c1('0x4d')]);_0x14c05a[_0x25c1('0x50')]=_['intersection'](_0xc68a7f['model'],qs['fields'](_0x5aabfa['query'][_0x25c1('0x51')]));_0x14c05a[_0x25c1('0x50')]=_0x14c05a[_0x25c1('0x50')]['length']?_0x14c05a[_0x25c1('0x50')]:_0xc68a7f[_0x25c1('0x42')];if(!_0x5aabfa[_0x25c1('0x4d')]['hasOwnProperty'](_0x25c1('0x53'))){_0x14c05a[_0x25c1('0x2a')]=qs['limit'](_0x5aabfa[_0x25c1('0x4d')][_0x25c1('0x2a')]);_0x14c05a[_0x25c1('0x29')]=qs[_0x25c1('0x29')](_0x5aabfa[_0x25c1('0x4d')]['offset']);}_0x14c05a[_0x25c1('0x77')]=qs[_0x25c1('0x54')](_0x5aabfa['query'][_0x25c1('0x54')]);_0x14c05a[_0x25c1('0x55')]=qs[_0x25c1('0x56')](_[_0x25c1('0x57')](_0x5aabfa[_0x25c1('0x4d')],_0xc68a7f[_0x25c1('0x56')]));_0x14c05a[_0x25c1('0x55')][_0x25c1('0x73')]=_0x23463e['id'];if(_0x5aabfa[_0x25c1('0x4d')]['filter']){_0x14c05a[_0x25c1('0x55')]=_[_0x25c1('0x59')](_0x14c05a[_0x25c1('0x55')],{'$or':_[_0x25c1('0x49')](_0x14c05a['attributes'],function(_0x2dcbb8){var _0x36c50a={};_0x36c50a[_0x2dcbb8]={'$like':'%'+_0x5aabfa[_0x25c1('0x4d')][_0x25c1('0x58')]+'%'};return _0x36c50a;})});}_0x14c05a=_[_0x25c1('0x59')]({},_0x14c05a,_0x5aabfa[_0x25c1('0x5b')]);return db[_0x25c1('0x7a')][_0x25c1('0x2c')]({'where':_0x14c05a['where']})[_0x25c1('0x2e')](function(_0x4c4207){_0x158120[_0x25c1('0x2c')]=_0x4c4207;if(_0x5aabfa[_0x25c1('0x4d')][_0x25c1('0x62')]){_0x14c05a[_0x25c1('0x5c')]=[{'all':!![]}];}return db[_0x25c1('0x7a')][_0x25c1('0x5d')](_0x14c05a);})['then'](function(_0x307a83){_0x158120[_0x25c1('0x5e')]=_0x307a83;return _0x158120;});}})['then'](respondWithFilteredResult(_0x513f6a,_0x14c05a))[_0x25c1('0x24')](handleError(_0x513f6a,null));};exports[_0x25c1('0x7b')]=function(_0x33e71d,_0x1925a4){return db[_0x25c1('0x4a')][_0x25c1('0x6f')]({'where':{'id':_0x33e71d[_0x25c1('0x60')]['id']}})[_0x25c1('0x2e')](handleEntityNotFound(_0x1925a4,null))[_0x25c1('0x2e')](function(_0x438486){if(_0x438486){return _0x438486[_0x25c1('0x7b')](_0x33e71d['query'][_0x25c1('0x7c')]);}})[_0x25c1('0x2e')](respondWithStatusCode(_0x1925a4,null))['catch'](handleError(_0x1925a4,null));};exports[_0x25c1('0x7d')]=function(_0x629ba6,_0x21de80){_0x629ba6[_0x25c1('0x64')][_0x25c1('0x7e')]=_0x629ba6[_0x25c1('0x7f')][_0x25c1('0x80')];return db[_0x25c1('0x4a')][_0x25c1('0x6f')]({'where':{'id':_0x629ba6[_0x25c1('0x60')]['id']}})['then'](handleEntityNotFound(_0x21de80,null))[_0x25c1('0x2e')](saveUpdates(_0x629ba6['body'],null))[_0x25c1('0x2e')](respondWithResult(_0x21de80,null))[_0x25c1('0x24')](handleError(_0x21de80,null));};exports[_0x25c1('0x81')]=function(_0x3bf69f,_0x47897e){_0x3bf69f[_0x25c1('0x64')][_0x25c1('0x82')]=_0x3bf69f[_0x25c1('0x7f')][_0x25c1('0x80')];return db['ChatWebsite']['find']({'where':{'id':_0x3bf69f['params']['id']}})[_0x25c1('0x2e')](handleEntityNotFound(_0x47897e,null))[_0x25c1('0x2e')](saveUpdates(_0x3bf69f[_0x25c1('0x64')],null))[_0x25c1('0x2e')](respondWithResult(_0x47897e,null))[_0x25c1('0x24')](handleError(_0x47897e,null));};exports[_0x25c1('0x83')]=function(_0x360415,_0x4af1db){_0x360415[_0x25c1('0x64')]['customerAvatar']=_0x360415['file'][_0x25c1('0x80')];return db[_0x25c1('0x4a')][_0x25c1('0x6f')]({'where':{'id':_0x360415[_0x25c1('0x60')]['id']}})[_0x25c1('0x2e')](handleEntityNotFound(_0x4af1db,null))[_0x25c1('0x2e')](saveUpdates(_0x360415[_0x25c1('0x64')],null))[_0x25c1('0x2e')](respondWithResult(_0x4af1db,null))[_0x25c1('0x24')](handleError(_0x4af1db,null));};exports[_0x25c1('0x84')]=function(_0x53259d,_0x58a64a){_0x53259d[_0x25c1('0x64')][_0x25c1('0x85')]=_0x53259d['file'][_0x25c1('0x80')];return db[_0x25c1('0x4a')]['find']({'where':{'id':_0x53259d[_0x25c1('0x60')]['id']}})[_0x25c1('0x2e')](handleEntityNotFound(_0x58a64a,null))[_0x25c1('0x2e')](saveUpdates(_0x53259d[_0x25c1('0x64')],null))[_0x25c1('0x2e')](respondWithResult(_0x58a64a,null))[_0x25c1('0x24')](handleError(_0x58a64a,null));};exports[_0x25c1('0x86')]=function(_0xc165a,_0x475aa2){var _0x349d97=path['join'](config[_0x25c1('0x87')],_0x25c1('0x88'));var _0x30bd45={'where':{'id':_0xc165a['params']['id']},'attributes':['id',_0x25c1('0x7e')],'raw':!![]};var _0x158a0f=![];return require(_0x25c1('0x89'))['getLicense']()[_0x25c1('0x2e')](function(_0x1894a6){if(_0x1894a6){_0x158a0f=_0x1894a6[_0x25c1('0x8a')];}})[_0x25c1('0x2e')](function(){return db[_0x25c1('0x4a')][_0x25c1('0x6f')](_0x30bd45);})['then'](handleEntityNotFound(_0x475aa2,null))[_0x25c1('0x2e')](function(_0x10e4ca){if(_0x10e4ca){if(!_[_0x25c1('0x8b')](_0x10e4ca[_0x25c1('0x7e')])){if(fs['existsSync'](path[_0x25c1('0x8c')](config[_0x25c1('0x87')],_0x25c1('0x8d'),_0x10e4ca[_0x25c1('0x7e')]))&&_0x158a0f){_0x349d97=path[_0x25c1('0x8c')](config[_0x25c1('0x87')],_0x25c1('0x8d'),_0x10e4ca[_0x25c1('0x7e')]);}}return _0x475aa2[_0x25c1('0x8e')](_0x349d97);}})[_0x25c1('0x24')](handleError(_0x475aa2,null));};exports['getAvatar']=function(_0x10abc4,_0x2ecac3){var _0x2fa46e=path[_0x25c1('0x8c')](config[_0x25c1('0x87')],_0x25c1('0x8f'));var _0x5f1c08={'where':{'id':_0x10abc4['params']['id']},'attributes':['id',_0x25c1('0x82')],'raw':!![]};return db[_0x25c1('0x4a')][_0x25c1('0x6f')](_0x5f1c08)[_0x25c1('0x2e')](handleEntityNotFound(_0x2ecac3,null))[_0x25c1('0x2e')](function(_0x2ed32a){if(_0x2ed32a){if(!_['isNil'](_0x2ed32a['agentAvatar'])){if(fs['existsSync'](path[_0x25c1('0x8c')](config[_0x25c1('0x87')],_0x25c1('0x90'),_0x2ed32a['agentAvatar']))){_0x2fa46e=path[_0x25c1('0x8c')](config[_0x25c1('0x87')],_0x25c1('0x90'),_0x2ed32a[_0x25c1('0x82')]);}}return _0x2ecac3[_0x25c1('0x8e')](_0x2fa46e);}})[_0x25c1('0x24')](handleError(_0x2ecac3,null));};exports[_0x25c1('0x91')]=function(_0x34c639,_0x412bb7){var _0x110385=path[_0x25c1('0x8c')](config[_0x25c1('0x87')],'server/files/images/avatars/customer_avatar.png');var _0x1f934f={'where':{'id':_0x34c639[_0x25c1('0x60')]['id']},'attributes':['id','customerAvatar',_0x25c1('0x92')],'raw':!![]};return db[_0x25c1('0x4a')][_0x25c1('0x6f')](_0x1f934f)[_0x25c1('0x2e')](handleEntityNotFound(_0x412bb7,null))[_0x25c1('0x2e')](function(_0x51dffd){if(_0x51dffd){if(!_[_0x25c1('0x8b')](_0x51dffd[_0x25c1('0x93')])){if(fs[_0x25c1('0x94')](path[_0x25c1('0x8c')](config['root'],_0x25c1('0x90'),_0x51dffd['customerAvatar']))&&_0x51dffd[_0x25c1('0x92')]){_0x110385=path[_0x25c1('0x8c')](config[_0x25c1('0x87')],'server/files/images/avatars/',_0x51dffd[_0x25c1('0x93')]);}}return _0x412bb7[_0x25c1('0x8e')](_0x110385);}})[_0x25c1('0x24')](handleError(_0x412bb7,null));};exports[_0x25c1('0x95')]=function(_0x385ffe,_0x230f47){var _0x2e18b5=path[_0x25c1('0x8c')](config[_0x25c1('0x87')],'server/files/images/avatars/system_avatar.png');var _0xbbce83={'where':{'id':_0x385ffe[_0x25c1('0x60')]['id']},'attributes':['id',_0x25c1('0x85')],'raw':!![]};return db[_0x25c1('0x4a')][_0x25c1('0x6f')](_0xbbce83)['then'](handleEntityNotFound(_0x230f47,null))[_0x25c1('0x2e')](function(_0xc402d1){if(_0xc402d1){if(!_[_0x25c1('0x8b')](_0xc402d1['systemAvatar'])){if(fs[_0x25c1('0x94')](path[_0x25c1('0x8c')](config[_0x25c1('0x87')],'server/files/images/avatars/',_0xc402d1['systemAvatar']))){_0x2e18b5=path['join'](config[_0x25c1('0x87')],_0x25c1('0x90'),_0xc402d1[_0x25c1('0x85')]);}}return _0x230f47[_0x25c1('0x8e')](_0x2e18b5);}})[_0x25c1('0x24')](handleError(_0x230f47,null));};function checkWebsiteInterval(_0x13d48c){var _0x468312=_0x13d48c[_0x25c1('0x96')];if(!_0x468312){return Promise[_0x25c1('0x97')](_0x13d48c);}var _0x4a436d=_0x13d48c[_0x25c1('0x98')]||undefined;return _0x468312['ifTime'](_0x4a436d)['then'](function(_0x355e71){if(!_0x355e71){throw new APIOutOfIntervalError();}return _0x13d48c;});}exports[_0x25c1('0x99')]=function(_0x17d6dd,_0x762495){var _0x3a5e79={'body':_0x17d6dd['body'],'channel':_0x25c1('0x9a')};var _0x5ae7d3=[];var _0x3a9e3b=[];var _0x287f68={};var _0x1055b7=![];if(_0x17d6dd[_0x25c1('0x64')]['id']){delete _0x17d6dd['body']['id'];}if(_['isNil'](_0x17d6dd[_0x25c1('0x64')][_0x25c1('0x9b')])){throw new APIBadRequestError(_0x25c1('0x9c'));}if(_['isNil'](_0x17d6dd['body'][_0x25c1('0x9d')])){throw new APIBadRequestError(_0x25c1('0x9e'));}if(_['isEmpty'](_0x17d6dd[_0x25c1('0x64')][_0x25c1('0x64')])){throw new APIBadRequestError(_0x25c1('0x9f'));}var _0x33f8ee=_0x17d6dd[_0x25c1('0x64')][_0x25c1('0xa0')]&&_0x17d6dd[_0x25c1('0x64')][_0x25c1('0x3e')];return db[_0x25c1('0xa1')][_0x25c1('0x71')]()[_0x25c1('0x2e')](function(_0x3675c2){if(!_0x3675c2){throw new Error(_0x25c1('0xa2'));}_0x5ae7d3=Object[_0x25c1('0x4e')](_0x3675c2)['filter'](function(_0x38e111){return![_0x25c1('0xa3'),'updatedAt'][_0x25c1('0xa4')](_0x38e111);});_0x3a9e3b=Object['keys'](_0x3675c2)[_0x25c1('0x58')](function(_0x4370b2){return!['createdAt',_0x25c1('0xa5'),_0x25c1('0xa6'),_0x25c1('0xa7')][_0x25c1('0xa4')](_0x4370b2);});if(!_[_0x25c1('0xa4')](_0x3a9e3b,_0x17d6dd['body'][_0x25c1('0x9d')])){throw new APIBadRequestError(_0x25c1('0xa8')+_0x3a9e3b[_0x25c1('0x8c')](',\x20'));}_0x287f68[_0x17d6dd[_0x25c1('0x64')]['mapKey']]=_0x17d6dd[_0x25c1('0x64')][_0x25c1('0x9b')];})[_0x25c1('0x2e')](function(){return db['ChatWebsite'][_0x25c1('0x6f')]({'where':{'id':_0x17d6dd[_0x25c1('0x60')]['id']},'include':[{'model':db[_0x25c1('0xa9')],'as':_0x25c1('0xaa'),'include':[{'model':db[_0x25c1('0xa1')],'as':_0x25c1('0xab'),'where':_0x287f68,'limit':0x1,'order':[[_0x25c1('0xa5'),_0x25c1('0xac')]]}]},{'model':db['ChatApplication'],'as':'Applications'},{'model':db['Interval'],'as':_0x25c1('0x96'),'include':[{'model':db[_0x25c1('0x96')],'as':_0x25c1('0xad'),'attributes':['id','interval'],'raw':!![]}]}]});})[_0x25c1('0x2e')](function(_0x9069a2){if(!_0x9069a2){throw new APINotFoundError(util[_0x25c1('0xae')](_0x25c1('0xaf'),_0x17d6dd[_0x25c1('0x60')]['id']));}if(_0x33f8ee){return checkWebsiteInterval(_0x9069a2);}return _0x9069a2;})[_0x25c1('0x2e')](function(_0x764652){_0x3a5e79['account']=_0x764652;_0x3a5e79[_0x25c1('0xb0')]=_[_0x25c1('0xb1')](_0x764652['Applications'],[_0x25c1('0xb2')],[_0x25c1('0xb3')]);if(_0x3a5e79[_0x25c1('0xb4')][_0x25c1('0xb5')]){delete _0x3a5e79[_0x25c1('0xb4')][_0x25c1('0xb5')];}_0x3a5e79[_0x25c1('0xb6')]=_0x764652[_0x25c1('0xaa')]||{'id':_0x764652[_0x25c1('0xa7')]};if(_0x3a5e79[_0x25c1('0xb6')]&&_0x3a5e79[_0x25c1('0xb6')][_0x25c1('0xab')][_0x25c1('0x52')]){return _0x3a5e79[_0x25c1('0xb6')][_0x25c1('0xab')][0x0];}var _0x5d8f18=_['defaults'](_0x17d6dd[_0x25c1('0x64')],{'firstName':_0x17d6dd[_0x25c1('0x64')]['from'],'ListId':_0x764652[_0x25c1('0xa7')]});_0x5d8f18[_0x17d6dd[_0x25c1('0x64')][_0x25c1('0x9d')]]=_0x17d6dd['body'][_0x25c1('0x9b')];return db[_0x25c1('0xa1')][_0x25c1('0x63')](_0x5d8f18,{'fields':_0x5ae7d3,'raw':!![]});})[_0x25c1('0x2e')](function(_0x1a0354){_0x3a5e79['contact']=_0x1a0354;var _0x2e6dfd=createInteractionObject(_0x17d6dd[_0x25c1('0x60')]['id'],_0x17d6dd[_0x25c1('0x64')],_0x17d6dd[_0x25c1('0xb7')],_0x1a0354);var _0x4fa88e={'ChatWebsiteId':_0x17d6dd['params']['id']};if(_0x17d6dd['body']['threadId']){_0x4fa88e[_0x25c1('0xb8')]=_0x17d6dd['body'][_0x25c1('0xb8')];_0x4fa88e['closed']=![];return db[_0x25c1('0xb9')][_0x25c1('0x6f')]({'where':_0x4fa88e})[_0x25c1('0x2e')](function(_0x12a17f){var _0x2c2395=_0x17d6dd[_0x25c1('0x64')][_0x25c1('0xa0')]&&_0x17d6dd['body']['referer'];if(_0x12a17f){_0x1055b7=!![];return _0x12a17f;}else if(!_0x2c2395&&_0x12a17f&&_0x12a17f[_0x25c1('0xba')]){throw new APIConflictError(_0x25c1('0xbb'));}_0x2e6dfd[_0x25c1('0xb8')]=_0x17d6dd[_0x25c1('0x64')][_0x25c1('0xb8')];_0x2e6dfd['externalUrl']=_0x17d6dd['body'][_0x25c1('0xbc')];return db[_0x25c1('0xb9')][_0x25c1('0x63')](_0x2e6dfd);});}_0x4fa88e[_0x25c1('0xbd')]=_0x1a0354['id'];if(_0x17d6dd[_0x25c1('0x64')][_0x25c1('0xbe')]&&_0x17d6dd[_0x25c1('0x64')][_0x25c1('0xbe')]['id']){_0x4fa88e['id']=_0x17d6dd[_0x25c1('0x64')][_0x25c1('0xbe')]['id'];return db[_0x25c1('0xb9')][_0x25c1('0x6f')]({'where':_0x4fa88e})['then'](function(_0x396ed5){var _0x30e70a=_0x17d6dd['body'][_0x25c1('0xa0')]&&_0x17d6dd[_0x25c1('0x64')][_0x25c1('0x3e')];if(!_0x30e70a&&_0x396ed5&&_0x396ed5[_0x25c1('0xba')]){throw new APIConflictError('Writing\x20on\x20closed\x20interaction');}else if(_0x396ed5){_0x1055b7=!![];return _0x396ed5;}else{return db[_0x25c1('0xb9')]['create'](_0x2e6dfd);}});}return db['ChatInteraction'][_0x25c1('0x63')](_0x2e6dfd);})[_0x25c1('0x2e')](function(_0x567ea4){if(!_0x1055b7){return _0x567ea4;}var _0x569b69={'from':(_0x3a5e79[_0x25c1('0xbf')][_0x25c1('0x3c')]||'')+'\x20'+(_0x3a5e79[_0x25c1('0xbf')][_0x25c1('0xc0')]||'')};if(_0x17d6dd[_0x25c1('0x64')]['threadId']&&_0x17d6dd[_0x25c1('0x64')][_0x25c1('0xc1')]&&_0x17d6dd['body']['threadId']!=_0x17d6dd[_0x25c1('0x64')][_0x25c1('0xc1')]){_0x569b69[_0x25c1('0xb8')]=_0x17d6dd[_0x25c1('0x64')][_0x25c1('0xc1')];}return _0x567ea4[_0x25c1('0x6d')](_0x569b69);})[_0x25c1('0x2e')](function(_0x573382){_0x3a5e79[_0x25c1('0xbe')]=_0x573382[_0x25c1('0x30')]({'plain':!![]});_0x3a5e79[_0x25c1('0xbe')][_0x25c1('0xc2')]=!_0x1055b7;if(_0x3a5e79[_0x25c1('0xbe')][_0x25c1('0xc2')]){if(_0x3a5e79[_0x25c1('0xb4')][_0x25c1('0xc3')]){_0x3a5e79[_0x25c1('0xb0')][_0x25c1('0xc4')]({'id':0x0,'priority':_0x3a5e79[_0x25c1('0xb0')][_0x25c1('0x52')]+0x1,'app':_0x25c1('0xc5'),'appdata':_0x25c1('0xc6'),'interval':_0x25c1('0xc7')});}}return db[_0x25c1('0xc8')][_0x25c1('0x63')]({'body':_0x17d6dd[_0x25c1('0x64')]['body'],'ChatWebsiteId':_0x17d6dd[_0x25c1('0x60')]['id'],'ChatInteractionId':_0x573382['id'],'direction':'in','ContactId':_0x3a5e79['contact']['id'],'AttachmentId':_0x17d6dd[_0x25c1('0x64')]['AttachmentId']});})['then'](function(_0x56d4ca){_0x3a5e79['message']=_0x56d4ca;if(!_0x3a5e79[_0x25c1('0xbe')][_0x25c1('0xc9')]){return;}return db[_0x25c1('0xca')]['find']({'attributes':['id','name'],'where':{'id':_0x3a5e79[_0x25c1('0xbe')][_0x25c1('0xc9')]}});})['then'](function(_0x29d6f7){if(_0x29d6f7){_0x3a5e79[_0x25c1('0xb0')][_0x25c1('0xcb')]({'id':0x0,'priority':0x0,'app':_0x25c1('0xcc'),'appdata':_0x29d6f7[_0x25c1('0x33')]+','+(_0x3a5e79[_0x25c1('0xb4')][_0x25c1('0xcd')]||0xa),'interval':_0x25c1('0xc7')});_0x3a5e79['forcedOwnership']=!![];}if(!_0x3a5e79[_0x25c1('0xbe')][_0x25c1('0xce')]){return;}return db['ChatQueue']['find']({'attributes':['id','name'],'where':{'id':_0x3a5e79[_0x25c1('0xbe')][_0x25c1('0xce')]}});})[_0x25c1('0x2e')](function(_0x1d8202){if(_0x1d8202){_0x3a5e79[_0x25c1('0xb0')]['unshift']({'id':0x0,'priority':0x1,'app':_0x25c1('0xcf'),'appdata':_0x1d8202[_0x25c1('0x33')]+','+(_0x3a5e79['account'][_0x25c1('0xd0')]||0x12c),'interval':_0x25c1('0xc7')});}return respondWithRpcPromise(_0x25c1('0xd1'),_0x25c1('0xd2'),_0x3a5e79);})[_0x25c1('0x2e')](function(_0x4bf7b2){respondWithRpcPromise(_0x25c1('0xd3'),_0x25c1('0xd3'),{'event':_0x25c1('0x99'),'message':_0x4bf7b2},client9002);return _0x4bf7b2;})[_0x25c1('0x2e')](respondWithResult(_0x762495,null))[_0x25c1('0x24')](APIHandleError(_0x762495));};exports[_0x25c1('0xd4')]=function(_0x10a363,_0x271769){var _0x4642e2,_0x56ed52,_0x116fc4;var _0x485b8e=[];var _0x2b5af0={};var _0x4f0eca=_0x10a363[_0x25c1('0xd5')]||[];var _0x3a5a6e=[];var _0xcb437e;return db[_0x25c1('0xa1')][_0x25c1('0x71')]()[_0x25c1('0x2e')](function(_0x255cc4){if(!_0x255cc4){throw new db['Sequelize']['ValidationError'](_0x25c1('0xd6'));}_0x485b8e=_[_0x25c1('0xd7')](_[_0x25c1('0x4e')](_0x255cc4),['createdAt',_0x25c1('0xa5'),_0x25c1('0xa6'),'ListId']);if(_0x10a363[_0x25c1('0x64')]['id']){delete _0x10a363[_0x25c1('0x64')]['id'];}if(_[_0x25c1('0x8b')](_0x10a363[_0x25c1('0x64')][_0x25c1('0x9b')])){throw _0x271769[_0x25c1('0x26')](0x1f4)['send'](new db[(_0x25c1('0xd8'))][(_0x25c1('0xd9'))](_0x25c1('0xda')));}if(_[_0x25c1('0x8b')](_0x10a363[_0x25c1('0x64')][_0x25c1('0x64')])||_0x10a363[_0x25c1('0x64')][_0x25c1('0x64')]===''){throw _0x271769[_0x25c1('0x26')](0x1f4)[_0x25c1('0x34')](new db[(_0x25c1('0xd8'))][(_0x25c1('0xd9'))](_0x25c1('0xdb')));}if(_[_0x25c1('0x8b')](_0x10a363[_0x25c1('0x64')][_0x25c1('0xdc')])){throw _0x271769[_0x25c1('0x26')](0x1f4)[_0x25c1('0x34')](new db[(_0x25c1('0xd8'))][(_0x25c1('0xd9'))](_0x25c1('0xdd')+_0x485b8e));}if(!_[_0x25c1('0xa4')](_0x485b8e,_0x10a363['body'][_0x25c1('0xdc')])){throw _0x271769['status'](0x1f4)['send'](new db[(_0x25c1('0xd8'))][(_0x25c1('0xd9'))](_0x25c1('0xde')+_0x485b8e));}_0x2b5af0[_0x10a363[_0x25c1('0x64')]['mapKeyOffline']]=_0x10a363[_0x25c1('0x64')][_0x25c1('0x9b')];})[_0x25c1('0x2e')](function(){return db[_0x25c1('0x4a')][_0x25c1('0x6f')]({'where':{'id':_0x10a363[_0x25c1('0x60')]['id']},'include':[{'model':db[_0x25c1('0xa9')],'as':_0x25c1('0xaa')},{'model':db[_0x25c1('0xdf')],'as':_0x25c1('0xdf')}]});})[_0x25c1('0x2e')](handleEntityNotFound(_0x271769,null))[_0x25c1('0x2e')](function(_0x2df80b){if(_0x2df80b&&_0x2df80b[_0x25c1('0xaa')]){_0x56ed52=_0x2df80b;var _0x4bda5a=_['defaults'](_0x10a363['body'],{'firstName':_0x10a363[_0x25c1('0x64')][_0x25c1('0x9b')],'phone':_0x10a363['body'][_0x25c1('0x9b')],'ListId':_0x2df80b[_0x25c1('0xa7')]});_0x4bda5a[_0x10a363[_0x25c1('0x64')][_0x25c1('0xdc')]]=_0x10a363[_0x25c1('0x64')]['from'];return db[_0x25c1('0xa1')][_0x25c1('0xe0')]({'where':_0x2b5af0,'defaults':_0x4bda5a});}})[_0x25c1('0xe1')](function(_0x3e1cda){if(_0x3e1cda){_0x116fc4=_0x3e1cda;var _0x4c5ccd=fs[_0x25c1('0xe2')](path[_0x25c1('0x8c')](config[_0x25c1('0x87')],_0x25c1('0xe3')),_0x25c1('0xe4'));var _0x2b4f5c=ejs[_0x25c1('0xe5')](_0x4c5ccd,{'body':_[_0x25c1('0xe6')](_0x10a363[_0x25c1('0x64')][_0x25c1('0x64')]),'bodyTitle':_0x56ed52[_0x25c1('0xe7')]});return db['ChatOfflineMessage'][_0x25c1('0x63')]({'body':_0x2b4f5c,'plainBody':htmlToText['fromString'](_0x2b4f5c),'ContactId':_0x3e1cda['id'],'ChatWebsiteId':_0x56ed52['id']});}})[_0x25c1('0x2e')](function(_0x1895c0){_0xcb437e=_0x1895c0;if(_0x4f0eca[_0x25c1('0x52')]){var _0x31fc7f=_0x4f0eca[_0x25c1('0x49')](function(_0x490a5a){return{'name':_0x490a5a[_0x25c1('0xe8')],'basename':_0x490a5a[_0x25c1('0x80')],'type':_0x490a5a['mimetype'],'ChatOfflineMessageId':_0x1895c0['id']};});_0x3a5a6e=_0x31fc7f[_0x25c1('0x49')](_0x794186=>{var _0x369eae={'filename':_0x794186[_0x25c1('0x33')],'path':path[_0x25c1('0x8c')](config[_0x25c1('0x87')],_0x25c1('0xe9'),_0x25c1('0xd5'),_0x25c1('0xea'),_0x25c1('0xeb'),_0x794186[_0x25c1('0xec')])};return _0x369eae;});if(!_0x56ed52[_0x25c1('0xed')]){return db[_0x25c1('0xee')][_0x25c1('0xef')](function(_0x4c09c0){return db[_0x25c1('0xf0')][_0x25c1('0xf1')](_0x31fc7f,{'transaction':_0x4c09c0});});}}})['then'](function(){if(_0xcb437e){_0x4642e2=_0xcb437e;return db[_0x25c1('0xdf')][_0x25c1('0x76')]({'where':{'service':!![]},'include':[{'model':db[_0x25c1('0xf2')],'as':_0x25c1('0xf3'),'raw':!![],'include':[{'model':db[_0x25c1('0xf4')],'as':'CloudProvider','raw':!![]}]}]});}})[_0x25c1('0x2e')](function(_0x50a1a4){if(_0x50a1a4&&_0x50a1a4['Smtp']&&_0x56ed52[_0x25c1('0xf5')]&&_0x56ed52['forwardOfflineAddress']){var _0xba0af6=_0x50a1a4[_0x25c1('0xf6')]();return respondWithRpcPromise('SendMail',_0x25c1('0xf7'),{'account':_0xba0af6,'message':{'from':util[_0x25c1('0xae')]('\x22%s\x22\x20<%s>',_0x50a1a4[_0x25c1('0x33')],_0x50a1a4[_0x25c1('0xf8')]||_0x50a1a4[_0x25c1('0xf3')][_0x25c1('0xf9')]),'to':_0x56ed52['forwardOfflineAddress'],'subject':_0x56ed52[_0x25c1('0xfa')],'html':_0x4642e2[_0x25c1('0x64')],'attachments':_0x3a5a6e}},client9003)[_0x25c1('0x2e')](function(){return _0x4642e2;})[_0x25c1('0x24')](function(_0x1477c8){logger[_0x25c1('0x1f')](_0x1477c8);});}})[_0x25c1('0x2e')](function(){if(_0x56ed52&&_0x56ed52[_0x25c1('0xed')]&&_0x56ed52['MailAccountId']){var _0x5184d1=[];if(_0x4f0eca[_0x25c1('0x52')]){_0x5184d1=_0x4f0eca[_0x25c1('0x49')](function(_0x2fc71c){return{'name':_0x2fc71c[_0x25c1('0xe8')],'basename':_0x2fc71c[_0x25c1('0x80')],'type':_0x2fc71c[_0x25c1('0xfb')],'ChatOfflineMessageId':_0xcb437e['id']};});}var _0x27835b;if(!_[_0x25c1('0x8b')](_0x56ed52[_0x25c1('0xfc')])){var _0x12cc47=_['map'](_0x10a363['body'],function(_0x2b87d2){return _0x2b87d2;});var _0x507407=_[_0x25c1('0xfd')](_0x12cc47)[0x0];var _0x46f4a3=_[_0x25c1('0xfe')](_0x507407,function(_0x52a22e){return _0x52a22e;});_0x27835b=_0x46f4a3[0x1][_0x56ed52[_0x25c1('0xfc')]];}var _0x35b5c8={'from':_0x116fc4['email'],'firstName':_0x116fc4[_0x25c1('0x3c')],'lastName':_0x116fc4['lastName'],'mapKey':_0x25c1('0xf8'),'message':{'from':_0x116fc4[_0x25c1('0xf8')],'to':_0x56ed52[_0x25c1('0xdf')][_0x25c1('0xf8')],'cc':'','subject':_[_0x25c1('0x8b')](_0x27835b)?_0x56ed52[_0x25c1('0xfa')]:_0x27835b,'messageId':'','sentAt':new Date(),'attach':_0x5184d1['length'],'attachments':_0x5184d1,'originChannel':_0x25c1('0xff'),'ChatWebsiteId':_0x56ed52['id'],'ChatOfflineMessageId':_0x4642e2['id'],'originTo':_0x56ed52[_0x25c1('0xdf')]['email']},'body':_0x4642e2[_0x25c1('0x64')]};var _0x291897={'account':{'id':_0x56ed52['MailAccountId']},'body':_0x35b5c8,'log':_0x25c1('0x100')};return respondWithRpcPromise('NotifyMailAccount',_0x25c1('0x101'),_0x291897,client9001)[_0x25c1('0x2e')](function(){return _0x4642e2;})[_0x25c1('0x24')](function(_0xaa68f5){logger['error'](_0xaa68f5);});}return;})['then'](function(){if(_0x4642e2){return _0x4642e2;}})['then'](respondWithResult(_0x271769,null))['catch'](function(){for(var _0x1f978d of _0x4f0eca){var _0x3a5243=path[_0x25c1('0x8c')](config[_0x25c1('0x87')],'server',_0x25c1('0xd5'),_0x25c1('0xea'),_0x25c1('0xeb'),_0x1f978d[_0x25c1('0x80')]);fs_extra[_0x25c1('0x102')](_0x3a5243)[_0x25c1('0x24')](function(_0x7b4c19){logger['error']('Could\x20not\x20remove\x20attachment\x20file',_0x3a5243,_0x7b4c19);});}});};exports['addInteraction']=function(_0x4b8da9,_0x39b8f9){return db['ChatInteraction'][_0x25c1('0x6f')]({'where':{'id':_0x4b8da9[_0x25c1('0x60')]['id']}})[_0x25c1('0x2e')](handleEntityNotFound(_0x39b8f9,null))['then'](function(_0x2b0a1e){if(_0x2b0a1e){return _0x2b0a1e[_0x25c1('0x103')](_0x4b8da9['body'][_0x25c1('0x7c')],_[_0x25c1('0x104')](_0x4b8da9['body'],[_0x25c1('0x7c'),'id'])||{});}})['then'](respondWithResult(_0x39b8f9,null))[_0x25c1('0x24')](handleError(_0x39b8f9,null));};exports[_0x25c1('0x105')]=function(_0x343078,_0x50dc41){var _0x35b676={'raw':![],'where':{}};var _0x49fbe9={};var _0x33d84b={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x25c1('0x76')]({'where':{'id':_0x343078[_0x25c1('0x60')]['id']}})['then'](handleEntityNotFound(_0x50dc41,null))[_0x25c1('0x2e')](function(_0x44041f){if(_0x44041f){_0x49fbe9[_0x25c1('0x42')]=_[_0x25c1('0x4e')](db[_0x25c1('0xb9')][_0x25c1('0x61')]);_0x49fbe9[_0x25c1('0x4d')]=_['keys'](_0x343078[_0x25c1('0x4d')]);_0x49fbe9[_0x25c1('0x56')]=_[_0x25c1('0x4f')](_0x49fbe9[_0x25c1('0x42')],_0x49fbe9[_0x25c1('0x4d')]);_0x35b676['attributes']=_[_0x25c1('0x4f')](_0x49fbe9['model'],qs[_0x25c1('0x51')](_0x343078[_0x25c1('0x4d')][_0x25c1('0x51')]));_0x35b676[_0x25c1('0x50')]=_0x35b676[_0x25c1('0x50')][_0x25c1('0x52')]?_0x35b676['attributes']:_0x49fbe9[_0x25c1('0x42')];if(!_0x343078[_0x25c1('0x4d')][_0x25c1('0x106')](_0x25c1('0x53'))){_0x35b676[_0x25c1('0x2a')]=qs[_0x25c1('0x2a')](_0x343078[_0x25c1('0x4d')]['limit']);_0x35b676[_0x25c1('0x29')]=qs['offset'](_0x343078[_0x25c1('0x4d')][_0x25c1('0x29')]);}_0x35b676['order']=qs[_0x25c1('0x54')](_0x343078[_0x25c1('0x4d')]['sort']);_0x35b676[_0x25c1('0x55')]=qs[_0x25c1('0x56')](_['pick'](_0x343078[_0x25c1('0x4d')],_0x49fbe9[_0x25c1('0x56')]));_0x35b676['where'][_0x25c1('0x73')]=_0x44041f['id'];if(_0x343078[_0x25c1('0x4d')][_0x25c1('0x58')]){_0x35b676[_0x25c1('0x55')]=_[_0x25c1('0x59')](_0x35b676[_0x25c1('0x55')],{'$or':_[_0x25c1('0x49')](_0x35b676[_0x25c1('0x50')],function(_0x1547ac){var _0x15fc82={};_0x15fc82[_0x1547ac]={'$like':'%'+_0x343078[_0x25c1('0x4d')][_0x25c1('0x58')]+'%'};return _0x15fc82;})});}_0x35b676=_[_0x25c1('0x59')]({},_0x35b676,_0x343078[_0x25c1('0x5b')]);return db[_0x25c1('0xb9')]['count']({'where':_0x35b676[_0x25c1('0x55')]})[_0x25c1('0x2e')](function(_0x4ad924){_0x33d84b['count']=_0x4ad924;if(_0x343078['query'][_0x25c1('0x62')]){_0x35b676['include']=[{'model':db['CmContact'],'as':_0x25c1('0x107'),'required':![]},{'model':db[_0x25c1('0xca')],'as':'Owner','attributes':[_0x25c1('0x33'),_0x25c1('0x108'),_0x25c1('0x109')],'required':![]},{'model':db[_0x25c1('0x10a')],'as':_0x25c1('0x10b'),'attributes':['id',_0x25c1('0x33'),'color'],'where':_0x343078[_0x25c1('0x4d')][_0x25c1('0x10c')]?{'id':_0x343078[_0x25c1('0x4d')][_0x25c1('0x10c')]}:undefined,'required':_0x343078[_0x25c1('0x4d')][_0x25c1('0x10c')]?!![]:![]}];}return db['ChatInteraction']['findAll'](_0x35b676);})['then'](function(_0x49f80c){_0x33d84b[_0x25c1('0x5e')]=_0x49f80c;return _0x33d84b;});}})['then'](respondWithFilteredResult(_0x50dc41,_0x35b676))['catch'](handleError(_0x50dc41,null));};exports[_0x25c1('0x10d')]=function(_0x2bb12a,_0x3c3585){var _0x4e7aa3=0x0;var _0x3c38ec=0x0;var _0x105c50=![];var _0x1ac4d3;var _0x21739f;return db[_0x25c1('0x4a')][_0x25c1('0x6f')]({'where':{'id':_0x2bb12a[_0x25c1('0x60')]['id']},'include':[{'model':db[_0x25c1('0x96')],'as':_0x25c1('0x96'),'include':[{'model':db['Interval'],'as':'Intervals','attributes':['id',_0x25c1('0x10e')]}]}]})[_0x25c1('0x2e')](handleEntityNotFound(_0x3c3585,null))[_0x25c1('0x2e')](function(_0x552128){if(_0x552128){_0x1ac4d3=_0x552128;return _0x552128[_0x25c1('0x10f')]({'raw':!![]});}})[_0x25c1('0x2e')](function(_0x529e3d){if(_0x1ac4d3){if(_0x529e3d){_0x21739f=_0x529e3d;}}return require(_0x25c1('0x89'))[_0x25c1('0x110')]();})[_0x25c1('0x2e')](function(_0x3670f1){if(_0x3670f1){_0x3c38ec=_0x3670f1[_0x25c1('0x111')];_0x105c50=_0x3670f1[_0x25c1('0x8a')];}})[_0x25c1('0x2e')](function(){return db['ChatInteraction'][_0x25c1('0x2c')]({'where':{'closed':![]}});})[_0x25c1('0x2e')](function(_0x475d48){_0x4e7aa3=_0x475d48;if(_0x3c38ec&&_0x475d48>_0x3c38ec){return db['License'][_0x25c1('0x76')]({'where':{'id':0x1}})[_0x25c1('0x2e')](function(_0x1d1789){if(_0x1d1789){_0x1d1789[_0x25c1('0x112')](_0x25c1('0x113'));}});}})[_0x25c1('0x2e')](function(){var _0xbf3d09=_0x1ac4d3[_0x25c1('0x96')];var _0x45e89a=_0x1ac4d3[_0x25c1('0x98')]||undefined;return _0xbf3d09?_0xbf3d09[_0x25c1('0x114')](_0x45e89a):!![];})[_0x25c1('0x2e')](function(_0x2b7be1){var _0x38b295=fs[_0x25c1('0xe2')](path[_0x25c1('0x8c')](config[_0x25c1('0x87')],_0x25c1('0x115')),_0x25c1('0xe4'));var _0x347946=_0x25c1('0x116');var _0x3d3a22=![];var _0xdd2b64,_0x425131;if(_0x2bb12a[_0x25c1('0xb7')][_0x25c1('0x3e')]){_0xdd2b64=new URL(_0x2bb12a['headers']['referer'])[_0x25c1('0x117')];}else if(_0x2bb12a[_0x25c1('0xb7')][_0x25c1('0x117')]){_0xdd2b64=new URL(_0x2bb12a[_0x25c1('0xb7')]['origin'])[_0x25c1('0x117')];}else{_0xdd2b64=_0x25c1('0x118');}_0x425131=typeof _0x1ac4d3[_0x25c1('0x119')][_0x25c1('0x3b')](',')[_0x25c1('0x6f')](function(_0x4d3e9b){return wildcardUtils[_0x25c1('0x11a')](_0x4d3e9b,_0xdd2b64);})!=='undefined';var _0x137f7b={'chatVersion':_0x347946,'chatWebsiteAddressOrigin':_0x425131?_0xdd2b64:_0x1ac4d3[_0x25c1('0x119')],'remote':_0x1ac4d3[_0x25c1('0x11b')],'query':querystring[_0x25c1('0x46')](_[_0x25c1('0x59')](_0x1ac4d3[_0x25c1('0x30')]({'plain':!![]}),{'customerIp':_0x2bb12a[_0x25c1('0xb7')][_0x25c1('0x39')]||_0x2bb12a[_0x25c1('0xb7')][_0x25c1('0x11c')]||_0x2bb12a[_0x25c1('0x11d')][_0x25c1('0x11e')]||_0x2bb12a['ip'],'referer':_0x2bb12a[_0x25c1('0xb7')][_0x25c1('0x3e')],'openedInteractions':_0x4e7aa3,'maxInteractions':_0x3c38ec,'virtual':_0x105c50[_0x25c1('0x111')],'online':_0x2b7be1,'custom':_0x105c50,'address':_0x425131?_0xdd2b64:null}))['replace'](/'/g,'\x5c\x27')};_0x3c3585['send'](ejs[_0x25c1('0xe5')](Mustache[_0x25c1('0xe5')](_0x38b295,_0x137f7b),{'proactiveActions':_0x21739f,'alignment':_0x1ac4d3[_0x25c1('0x11f')],'verticalAlignment':_0x1ac4d3['verticalAlignment'],'div_color':_0x1ac4d3[_0x25c1('0x120')],'labelText':_0x1ac4d3[_0x25c1('0x121')],'text_color':_0x1ac4d3[_0x25c1('0x122')],'text_button_color':_0x1ac4d3[_0x25c1('0x123')],'button_color':_0x1ac4d3[_0x25c1('0x124')],'background_color':_0x1ac4d3['backgroundColor'],'hideWhenOffline':_0x1ac4d3[_0x25c1('0x125')],'intervalId':_0x1ac4d3[_0x25c1('0x126')],'isDevelopment':_0x3d3a22,'chatVersion':_0x347946}));})[_0x25c1('0x24')](handleError(_0x3c3585,null));};exports[_0x25c1('0x127')]=function(_0x24c0e1,_0x3cb379){var _0x1b9df7=_0x24c0e1[_0x25c1('0x60')]['id'];var _0x2e788d=_0x24c0e1['body'];var _0x19371f=0xc8;var _0x60c433=null;return db[_0x25c1('0xee')][_0x25c1('0xef')]({'isolationLevel':db['sequelize'][_0x25c1('0x128')][_0x25c1('0x129')]['READ_COMMITTED']},function(_0x3f8ccf){return db[_0x25c1('0x4a')][_0x25c1('0x76')]({'where':{'id':_0x1b9df7},'transaction':_0x3f8ccf})[_0x25c1('0x2e')](function(_0x1b9807){if(_0x1b9807){return db[_0x25c1('0x12a')][_0x25c1('0x2f')]({'where':{'ChatWebsiteId':_0x1b9df7},'transaction':_0x3f8ccf})[_0x25c1('0x2e')](function(){var _0x3011a3=_['map'](_0x2e788d,function(_0x3cee4c){_0x3cee4c[_0x25c1('0x73')]=_0x1b9df7;return _0x3cee4c;});return db[_0x25c1('0x12a')][_0x25c1('0xf1')](_0x3011a3,{'transaction':_0x3f8ccf});});}else{_0x19371f=0x194;_0x60c433=[];}});})[_0x25c1('0x2e')](function(){if(_0x19371f!==0x194){return db[_0x25c1('0x12a')]['findAndCountAll']({'where':{'ChatWebsiteId':_0x1b9df7},'order':'priority'})[_0x25c1('0x2e')](function(_0x5158c6){_0x60c433=_0x5158c6;});}})[_0x25c1('0x24')](function(_0xfecf83){_0x19371f=0x1f4;logger['error'](_0xfecf83['stack']);if(_0xfecf83[_0x25c1('0x33')]){delete _0xfecf83['name'];}_0x60c433=_0xfecf83;})[_0x25c1('0x12b')](function(){if(_0x60c433===null){_0x3cb379[_0x25c1('0x25')](_0x19371f);}else{if(_0x19371f===0x1f4){_0x3cb379['status'](_0x19371f)[_0x25c1('0x34')](_0x60c433);}else{_0x3cb379[_0x25c1('0x26')](_0x19371f)[_0x25c1('0x28')](_0x60c433);}}});};exports[_0x25c1('0x12c')]=function(_0x12e92f,_0x5c619c){var _0x1bb98d={};var _0x3beb87={};var _0x159849;var _0x336d03;return db['ChatWebsite'][_0x25c1('0x76')]({'where':{'id':_0x12e92f[_0x25c1('0x60')]['id']}})['then'](handleEntityNotFound(_0x5c619c,null))['then'](function(_0x3e97d4){if(_0x3e97d4){_0x159849=_0x3e97d4;_0x3beb87[_0x25c1('0x42')]=_['keys'](db[_0x25c1('0x12a')][_0x25c1('0x61')]);_0x3beb87[_0x25c1('0x4d')]=_['keys'](_0x12e92f[_0x25c1('0x4d')]);_0x3beb87[_0x25c1('0x56')]=_[_0x25c1('0x4f')](_0x3beb87[_0x25c1('0x42')],_0x3beb87['query']);_0x1bb98d[_0x25c1('0x50')]=_[_0x25c1('0x4f')](_0x3beb87['model'],qs[_0x25c1('0x51')](_0x12e92f[_0x25c1('0x4d')][_0x25c1('0x51')]));_0x1bb98d[_0x25c1('0x50')]=_0x1bb98d[_0x25c1('0x50')][_0x25c1('0x52')]?_0x1bb98d[_0x25c1('0x50')]:_0x3beb87['model'];_0x1bb98d['order']=qs[_0x25c1('0x54')](_0x12e92f[_0x25c1('0x4d')][_0x25c1('0x54')]);_0x1bb98d[_0x25c1('0x55')]=qs[_0x25c1('0x56')](_[_0x25c1('0x57')](_0x12e92f[_0x25c1('0x4d')],_0x3beb87[_0x25c1('0x56')]));if(_0x12e92f[_0x25c1('0x4d')][_0x25c1('0x58')]){_0x1bb98d[_0x25c1('0x55')]=_[_0x25c1('0x59')](_0x1bb98d[_0x25c1('0x55')],{'$or':_['map'](_0x1bb98d[_0x25c1('0x50')],function(_0xd47cf6){var _0x1bc04a={};_0x1bc04a[_0xd47cf6]={'$like':'%'+_0x12e92f[_0x25c1('0x4d')][_0x25c1('0x58')]+'%'};return _0x1bc04a;})});}_0x1bb98d=_['merge']({},_0x1bb98d,_0x12e92f[_0x25c1('0x5b')]);return _0x159849['getApplications'](_0x1bb98d);}})[_0x25c1('0x2e')](function(_0x48b0da){if(_0x48b0da){_0x336d03=_0x48b0da[_0x25c1('0x52')];if(!_0x12e92f['query'][_0x25c1('0x106')]('nolimit')){_0x1bb98d[_0x25c1('0x2a')]=qs['limit'](_0x12e92f[_0x25c1('0x4d')]['limit']);_0x1bb98d[_0x25c1('0x29')]=qs[_0x25c1('0x29')](_0x12e92f[_0x25c1('0x4d')][_0x25c1('0x29')]);}return _0x159849[_0x25c1('0x12c')](_0x1bb98d);}})[_0x25c1('0x2e')](function(_0x7d40d){if(_0x7d40d){return _0x7d40d?{'count':_0x336d03,'rows':_0x7d40d}:null;}})[_0x25c1('0x2e')](respondWithResult(_0x5c619c,null))[_0x25c1('0x24')](handleError(_0x5c619c,null));};exports['addProactiveActions']=function(_0x4c051b,_0x438d00){return db[_0x25c1('0x12d')][_0x25c1('0x6f')]({'where':{'id':_0x4c051b[_0x25c1('0x60')]['id']}})['then'](handleEntityNotFound(_0x438d00,null))[_0x25c1('0x2e')](function(_0x7cca8a){if(_0x7cca8a){return _0x7cca8a['addProactiveActions'](_0x4c051b[_0x25c1('0x64')][_0x25c1('0x7c')],_[_0x25c1('0x104')](_0x4c051b[_0x25c1('0x64')],[_0x25c1('0x7c'),'id'])||{});}})[_0x25c1('0x2e')](respondWithResult(_0x438d00,null))[_0x25c1('0x24')](handleError(_0x438d00,null));};exports[_0x25c1('0x10f')]=function(_0x1bfd85,_0x4f5b1d){var _0x25a834={};var _0x2bd187={};var _0x449871;var _0x508a31;return db[_0x25c1('0x4a')][_0x25c1('0x76')]({'where':{'id':_0x1bfd85['params']['id']}})[_0x25c1('0x2e')](handleEntityNotFound(_0x4f5b1d,null))[_0x25c1('0x2e')](function(_0x2ea33b){if(_0x2ea33b){_0x449871=_0x2ea33b;_0x2bd187[_0x25c1('0x42')]=_['keys'](db['ChatProactiveAction'][_0x25c1('0x61')]);_0x2bd187[_0x25c1('0x4d')]=_[_0x25c1('0x4e')](_0x1bfd85[_0x25c1('0x4d')]);_0x2bd187[_0x25c1('0x56')]=_[_0x25c1('0x4f')](_0x2bd187[_0x25c1('0x42')],_0x2bd187[_0x25c1('0x4d')]);_0x25a834['attributes']=_['intersection'](_0x2bd187[_0x25c1('0x42')],qs['fields'](_0x1bfd85[_0x25c1('0x4d')][_0x25c1('0x51')]));_0x25a834['attributes']=_0x25a834[_0x25c1('0x50')][_0x25c1('0x52')]?_0x25a834[_0x25c1('0x50')]:_0x2bd187['model'];_0x25a834['order']=qs[_0x25c1('0x54')](_0x1bfd85[_0x25c1('0x4d')][_0x25c1('0x54')]);_0x25a834['where']=qs[_0x25c1('0x56')](_[_0x25c1('0x57')](_0x1bfd85[_0x25c1('0x4d')],_0x2bd187[_0x25c1('0x56')]));if(_0x1bfd85['query'][_0x25c1('0x58')]){_0x25a834['where']=_['merge'](_0x25a834[_0x25c1('0x55')],{'$or':_['map'](_0x25a834[_0x25c1('0x50')],function(_0x3d68d2){var _0x48e005={};_0x48e005[_0x3d68d2]={'$like':'%'+_0x1bfd85[_0x25c1('0x4d')]['filter']+'%'};return _0x48e005;})});}_0x25a834=_[_0x25c1('0x59')]({},_0x25a834,_0x1bfd85[_0x25c1('0x5b')]);return _0x449871['getProactiveActions'](_0x25a834);}})[_0x25c1('0x2e')](function(_0x4bd350){if(_0x4bd350){_0x508a31=_0x4bd350[_0x25c1('0x52')];if(!_0x1bfd85[_0x25c1('0x4d')][_0x25c1('0x106')](_0x25c1('0x53'))){_0x25a834['limit']=qs[_0x25c1('0x2a')](_0x1bfd85['query'][_0x25c1('0x2a')]);_0x25a834[_0x25c1('0x29')]=qs[_0x25c1('0x29')](_0x1bfd85[_0x25c1('0x4d')]['offset']);}return _0x449871['getProactiveActions'](_0x25a834);}})[_0x25c1('0x2e')](function(_0x675a30){if(_0x675a30){return _0x675a30?{'count':_0x508a31,'rows':_0x675a30}:null;}})[_0x25c1('0x2e')](respondWithResult(_0x4f5b1d,null))['catch'](handleError(_0x4f5b1d,null));};exports[_0x25c1('0x12e')]=function(_0x3c70f2,_0x12a251){var _0x25cca3=_0x3c70f2[_0x25c1('0x4d')][_0x25c1('0x12f')]===_0x25c1('0x130')?'offlineForm':'onlineForm';return db['ChatWebsite']['find']({'attributes':['id',_0x25cca3],'where':{'id':_0x3c70f2[_0x25c1('0x60')]['id']}})[_0x25c1('0x2e')](handleEntityNotFound(_0x12a251,null))[_0x25c1('0x2e')](function(_0x326c5f){if(_0x326c5f){var _0xd4a070=_0x326c5f[_0x25cca3];var _0xc71cbe=_0xd4a070&&_0xd4a070[_0x25c1('0x131')]?_0xd4a070[_0x25c1('0x131')]:[];_0x12a251['send']({'fromKey':_['isNil'](_0xd4a070[_0x25c1('0x132')])?undefined:_0xd4a070[_0x25c1('0x132')],'count':_0xc71cbe[_0x25c1('0x52')],'rows':_0xc71cbe});}})[_0x25c1('0x24')](handleError(_0x12a251,null));};exports['getOfflineMessages']=function(_0x1fcb09,_0x639cf5){var _0x2f2258={'raw':![],'where':{}};var _0x4ac0d0={};var _0x4b029f={'count':0x0,'rows':[]};return db[_0x25c1('0x4a')][_0x25c1('0x76')]({'where':{'id':_0x1fcb09[_0x25c1('0x60')]['id']}})['then'](handleEntityNotFound(_0x639cf5,null))[_0x25c1('0x2e')](function(_0x45d76e){if(_0x45d76e){_0x4ac0d0[_0x25c1('0x42')]=_[_0x25c1('0x4e')](db[_0x25c1('0x133')][_0x25c1('0x61')]);_0x4ac0d0['query']=_[_0x25c1('0x4e')](_0x1fcb09[_0x25c1('0x4d')]);_0x4ac0d0[_0x25c1('0x56')]=_[_0x25c1('0x4f')](_0x4ac0d0['model'],_0x4ac0d0[_0x25c1('0x4d')]);_0x2f2258[_0x25c1('0x50')]=_[_0x25c1('0x4f')](_0x4ac0d0[_0x25c1('0x42')],qs[_0x25c1('0x51')](_0x1fcb09['query'][_0x25c1('0x51')]));_0x2f2258['attributes']=_0x2f2258[_0x25c1('0x50')][_0x25c1('0x52')]?_0x2f2258[_0x25c1('0x50')]:_0x4ac0d0[_0x25c1('0x42')];if(!_0x1fcb09[_0x25c1('0x4d')]['hasOwnProperty'](_0x25c1('0x53'))){_0x2f2258[_0x25c1('0x2a')]=qs[_0x25c1('0x2a')](_0x1fcb09[_0x25c1('0x4d')][_0x25c1('0x2a')]);_0x2f2258[_0x25c1('0x29')]=qs[_0x25c1('0x29')](_0x1fcb09['query'][_0x25c1('0x29')]);}_0x2f2258[_0x25c1('0x77')]=qs[_0x25c1('0x54')](_0x1fcb09[_0x25c1('0x4d')][_0x25c1('0x54')]);_0x2f2258[_0x25c1('0x55')]=qs[_0x25c1('0x56')](_[_0x25c1('0x57')](_0x1fcb09[_0x25c1('0x4d')],_0x4ac0d0[_0x25c1('0x56')]));_0x2f2258[_0x25c1('0x55')][_0x25c1('0x73')]=_0x45d76e['id'];if(_0x1fcb09['query'][_0x25c1('0x58')]){_0x2f2258[_0x25c1('0x55')]=_[_0x25c1('0x59')](_0x2f2258[_0x25c1('0x55')],{'$or':_[_0x25c1('0x49')](_0x2f2258[_0x25c1('0x50')],function(_0x1eda47){var _0x4a4c39={};_0x4a4c39[_0x1eda47]={'$like':'%'+_0x1fcb09[_0x25c1('0x4d')][_0x25c1('0x58')]+'%'};return _0x4a4c39;})});}_0x2f2258=_[_0x25c1('0x59')]({},_0x2f2258,_0x1fcb09[_0x25c1('0x5b')]);return db['ChatOfflineMessage'][_0x25c1('0x2c')]({'where':_0x2f2258[_0x25c1('0x55')]})[_0x25c1('0x2e')](function(_0x458089){_0x4b029f[_0x25c1('0x2c')]=_0x458089;if(_0x1fcb09[_0x25c1('0x4d')][_0x25c1('0x62')]){_0x2f2258['include']=[{'all':!![]}];}else{_0x2f2258[_0x25c1('0x5c')]=[{'model':db[_0x25c1('0xa1')],'as':_0x25c1('0x107'),'required':![]},{'model':db[_0x25c1('0xf0')],'as':_0x25c1('0x134'),'required':![]}];}return db[_0x25c1('0x133')][_0x25c1('0x5d')](_0x2f2258);})[_0x25c1('0x2e')](function(_0x226f36){_0x4b029f[_0x25c1('0x5e')]=_0x226f36;return _0x4b029f;});}})[_0x25c1('0x2e')](respondWithFilteredResult(_0x639cf5,_0x2f2258))[_0x25c1('0x24')](handleError(_0x639cf5,null));};exports[_0x25c1('0x135')]=function(_0x172f7b,_0x395c16){return db['ChatWebsite']['find']({'where':{'id':_0x172f7b[_0x25c1('0x60')]['id']}})[_0x25c1('0x2e')](handleEntityNotFound(_0x395c16,null))['then'](function(_0x476493){if(_0x476493){return _0x476493[_0x25c1('0x135')](_0x172f7b[_0x25c1('0x64')][_0x25c1('0x7c')],_[_0x25c1('0x104')](_0x172f7b[_0x25c1('0x64')],[_0x25c1('0x7c'),'id'])||{})[_0x25c1('0xe1')](function(_0x29cff){for(var _0x497d81=0x0;_0x497d81<_0x172f7b[_0x25c1('0x64')][_0x25c1('0x7c')]['length'];_0x497d81+=0x1){socket['emit'](_0x25c1('0x136'),{'UserId':Number(_0x172f7b[_0x25c1('0x64')]['ids'][_0x497d81]),'ChatWebsiteId':Number(_0x172f7b[_0x25c1('0x60')]['id'])});}return _0x29cff;});}})[_0x25c1('0x2e')](respondWithResult(_0x395c16,null))[_0x25c1('0x24')](handleError(_0x395c16,null));};exports[_0x25c1('0x137')]=function(_0x2f0ba0,_0x2f585b){return db[_0x25c1('0x4a')][_0x25c1('0x6f')]({'where':{'id':_0x2f0ba0[_0x25c1('0x60')]['id']}})[_0x25c1('0x2e')](handleEntityNotFound(_0x2f585b,null))['then'](function(_0x290d71){if(_0x290d71){return _0x290d71[_0x25c1('0x137')](_0x2f0ba0[_0x25c1('0x4d')]['ids'])[_0x25c1('0x2e')](function(){if(_[_0x25c1('0x138')](_0x2f0ba0[_0x25c1('0x4d')][_0x25c1('0x7c')])){for(var _0x5eec9e=0x0;_0x5eec9e<_0x2f0ba0[_0x25c1('0x4d')]['ids'][_0x25c1('0x52')];_0x5eec9e+=0x1){socket[_0x25c1('0x139')]('userChatWebsite:remove',{'UserId':Number(_0x2f0ba0[_0x25c1('0x4d')][_0x25c1('0x7c')][_0x5eec9e]),'ChatWebsiteId':Number(_0x2f0ba0['params']['id'])});}}else{socket['emit']('userChatWebsite:remove',{'UserId':Number(_0x2f0ba0[_0x25c1('0x4d')]['ids']),'ChatWebsiteId':Number(_0x2f0ba0[_0x25c1('0x60')]['id'])});}});}})['then'](respondWithStatusCode(_0x2f585b,null))[_0x25c1('0x24')](handleError(_0x2f585b,null));};exports[_0x25c1('0x13a')]=function(_0x4c02da,_0x26ed1f){var _0x201581={};var _0x34fdf5={};var _0x2cdcb5;var _0x1f0cf6;return db[_0x25c1('0x4a')][_0x25c1('0x76')]({'where':{'id':_0x4c02da[_0x25c1('0x60')]['id']}})[_0x25c1('0x2e')](handleEntityNotFound(_0x26ed1f,null))['then'](function(_0x370cb2){if(_0x370cb2){_0x2cdcb5=_0x370cb2;_0x34fdf5['model']=_['keys'](db['User']['rawAttributes']);_0x34fdf5[_0x25c1('0x4d')]=_[_0x25c1('0x4e')](_0x4c02da[_0x25c1('0x4d')]);_0x34fdf5[_0x25c1('0x56')]=_[_0x25c1('0x4f')](_0x34fdf5[_0x25c1('0x42')],_0x34fdf5[_0x25c1('0x4d')]);_0x201581['attributes']=_[_0x25c1('0x4f')](_0x34fdf5[_0x25c1('0x42')],qs[_0x25c1('0x51')](_0x4c02da[_0x25c1('0x4d')]['fields']));_0x201581[_0x25c1('0x50')]=_0x201581[_0x25c1('0x50')][_0x25c1('0x52')]?_0x201581[_0x25c1('0x50')]:_0x34fdf5[_0x25c1('0x42')];_0x201581['order']=qs['sort'](_0x4c02da[_0x25c1('0x4d')][_0x25c1('0x54')]);_0x201581['where']=qs[_0x25c1('0x56')](_[_0x25c1('0x57')](_0x4c02da[_0x25c1('0x4d')],_0x34fdf5[_0x25c1('0x56')]));if(_0x4c02da[_0x25c1('0x4d')]['filter']){_0x201581[_0x25c1('0x55')]=_[_0x25c1('0x59')](_0x201581['where'],{'$or':_[_0x25c1('0x49')](_0x201581[_0x25c1('0x50')],function(_0x198673){var _0x5c288e={};_0x5c288e[_0x198673]={'$like':'%'+_0x4c02da['query'][_0x25c1('0x58')]+'%'};return _0x5c288e;})});}_0x201581=_[_0x25c1('0x59')]({},_0x201581,_0x4c02da[_0x25c1('0x5b')]);return _0x2cdcb5[_0x25c1('0x13a')](_0x201581);}})[_0x25c1('0x2e')](function(_0xba65bb){if(_0xba65bb){_0x1f0cf6=_0xba65bb['length'];if(!_0x4c02da['query'][_0x25c1('0x106')](_0x25c1('0x53'))){_0x201581[_0x25c1('0x2a')]=qs[_0x25c1('0x2a')](_0x4c02da[_0x25c1('0x4d')]['limit']);_0x201581[_0x25c1('0x29')]=qs['offset'](_0x4c02da[_0x25c1('0x4d')][_0x25c1('0x29')]);}return _0x2cdcb5[_0x25c1('0x13a')](_0x201581);}})[_0x25c1('0x2e')](function(_0x32f3cb){if(_0x32f3cb){return _0x32f3cb?{'count':_0x1f0cf6,'rows':_0x32f3cb}:null;}})['then'](respondWithResult(_0x26ed1f,null))['catch'](handleError(_0x26ed1f,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 22c737c..6553e18 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 _0x0f3c=['exports','events','../../mysqldb','update','remove','emit','hook'];(function(_0x35d3a8,_0x44406a){var _0x182378=function(_0x298e0b){while(--_0x298e0b){_0x35d3a8['push'](_0x35d3a8['shift']());}};_0x182378(++_0x44406a);}(_0x0f3c,0x189));var _0xc0f3=function(_0x22f86d,_0x3ad632){_0x22f86d=_0x22f86d-0x0;var _0x137d5d=_0x0f3c[_0x22f86d];return _0x137d5d;};'use strict';var EventEmitter=require(_0xc0f3('0x0'));var ChatWebsite=require(_0xc0f3('0x1'))['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xc0f3('0x2'),'afterDestroy':_0xc0f3('0x3')};function emitEvent(_0xa6a874){return function(_0x2d1f5d,_0x1be43d,_0x279717){ChatWebsiteEvents[_0xc0f3('0x4')](_0xa6a874+':'+_0x2d1f5d['id'],_0x2d1f5d);ChatWebsiteEvents[_0xc0f3('0x4')](_0xa6a874,_0x2d1f5d);_0x279717(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatWebsite[_0xc0f3('0x5')](e,emitEvent(event));}}module[_0xc0f3('0x6')]=ChatWebsiteEvents; \ No newline at end of file +var _0x207c=['hook','exports','../../mysqldb','ChatWebsite','setMaxListeners','save','update','remove','hasOwnProperty'];(function(_0x8ae98b,_0x155f88){var _0xc30bd4=function(_0x5ca462){while(--_0x5ca462){_0x8ae98b['push'](_0x8ae98b['shift']());}};_0xc30bd4(++_0x155f88);}(_0x207c,0x1e8));var _0xc207=function(_0x3fbb91,_0x5ec106){_0x3fbb91=_0x3fbb91-0x0;var _0x3eb213=_0x207c[_0x3fbb91];return _0x3eb213;};'use strict';var EventEmitter=require('events');var ChatWebsite=require(_0xc207('0x0'))['db'][_0xc207('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xc207('0x2')](0x0);var events={'afterCreate':_0xc207('0x3'),'afterUpdate':_0xc207('0x4'),'afterDestroy':_0xc207('0x5')};function emitEvent(_0x1dd107){return function(_0x4b9daa,_0x38ff02,_0x59bc89){ChatWebsiteEvents['emit'](_0x1dd107+':'+_0x4b9daa['id'],_0x4b9daa);ChatWebsiteEvents['emit'](_0x1dd107,_0x4b9daa);_0x59bc89(null);};}for(var e in events){if(events[_0xc207('0x6')](e)){var event=events[e];ChatWebsite[_0xc207('0x7')](e,emitEvent(event));}}module[_0xc207('0x8')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 6d8b960..e297a02 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 _0x2ef6=['ChatWebsite','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatWebsite.attributes','define'];(function(_0x44066b,_0x126423){var _0x4db055=function(_0x321cd1){while(--_0x321cd1){_0x44066b['push'](_0x44066b['shift']());}};_0x4db055(++_0x126423);}(_0x2ef6,0xe8));var _0x62ef=function(_0x3f1861,_0x7b4285){_0x3f1861=_0x3f1861-0x0;var _0x7ca70a=_0x2ef6[_0x3f1861];return _0x7ca70a;};'use strict';var _=require(_0x62ef('0x0'));var util=require(_0x62ef('0x1'));var logger=require('../../config/logger')(_0x62ef('0x2'));var moment=require(_0x62ef('0x3'));var BPromise=require(_0x62ef('0x4'));var rp=require(_0x62ef('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x62ef('0x6'));var config=require(_0x62ef('0x7'));var attributes=require(_0x62ef('0x8'));module['exports']=function(_0x443e70,_0x1479a9){return _0x443e70[_0x62ef('0x9')](_0x62ef('0xa'),attributes,{'tableName':'chat_websites','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaa82=['chat_websites','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./chatWebsite.attributes','exports','define'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0xaa82,0x1e1));var _0x2aa8=function(_0x59afc0,_0x5d46b9){_0x59afc0=_0x59afc0-0x0;var _0x2d4e1a=_0xaa82[_0x59afc0];return _0x2d4e1a;};'use strict';var _=require(_0x2aa8('0x0'));var util=require('util');var logger=require(_0x2aa8('0x1'))(_0x2aa8('0x2'));var moment=require(_0x2aa8('0x3'));var BPromise=require('bluebird');var rp=require(_0x2aa8('0x4'));var fs=require('fs');var path=require(_0x2aa8('0x5'));var rimraf=require(_0x2aa8('0x6'));var config=require(_0x2aa8('0x7'));var attributes=require(_0x2aa8('0x8'));module[_0x2aa8('0x9')]=function(_0xbb176d,_0x32ba0e){return _0xbb176d[_0x2aa8('0xa')]('ChatWebsite',attributes,{'tableName':_0x2aa8('0xb'),'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 71b536b..ab25ae3 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 _0x9933=['../../config/environment','jayson/promise','client','http','redis','defaults','localhost','register','request','then','info','request\x20sent','debug','error','code','ChatWebsite,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0x9933,0xfd));var _0x3993=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x9933[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x3993('0x0'));var util=require('util');var moment=require(_0x3993('0x1'));var BPromise=require(_0x3993('0x2'));var rs=require(_0x3993('0x3'));var fs=require('fs');var Redis=require(_0x3993('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3993('0x5'));var logger=require(_0x3993('0x6'))('rpc');var config=require(_0x3993('0x7'));var jayson=require(_0x3993('0x8'));var client=jayson[_0x3993('0x9')][_0x3993('0xa')]({'port':0x232a});config[_0x3993('0xb')]=_[_0x3993('0xc')](config[_0x3993('0xb')],{'host':_0x3993('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./chatWebsite.socket')[_0x3993('0xe')](socket);function respondWithRpcPromise(_0x9c9dde,_0x19666a,_0x1947d7){return new BPromise(function(_0x101469,_0x310087){return client[_0x3993('0xf')](_0x9c9dde,_0x1947d7)[_0x3993('0x10')](function(_0x5e776d){logger[_0x3993('0x11')]('ChatWebsite,\x20%s,\x20%s',_0x19666a,_0x3993('0x12'));logger[_0x3993('0x13')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x19666a,_0x3993('0x12'),JSON['stringify'](_0x5e776d));if(_0x5e776d[_0x3993('0x14')]){if(_0x5e776d['error'][_0x3993('0x15')]===0x1f4){logger['error'](_0x3993('0x16'),_0x19666a,_0x5e776d[_0x3993('0x14')][_0x3993('0x17')]);return _0x310087(_0x5e776d[_0x3993('0x14')][_0x3993('0x17')]);}logger[_0x3993('0x14')](_0x3993('0x16'),_0x19666a,_0x5e776d[_0x3993('0x14')]['message']);return _0x101469(_0x5e776d[_0x3993('0x14')]['message']);}else{logger[_0x3993('0x11')]('ChatWebsite,\x20%s,\x20%s',_0x19666a,_0x3993('0x12'));_0x101469(_0x5e776d[_0x3993('0x18')][_0x3993('0x17')]);}})[_0x3993('0x19')](function(_0x25f0ca){logger[_0x3993('0x14')]('ChatWebsite,\x20%s,\x20%s',_0x19666a,_0x25f0ca);_0x310087(_0x25f0ca);});});} \ No newline at end of file +var _0x02a7=['jayson/promise','http','redis','defaults','localhost','./chatWebsite.socket','register','request','then','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','error','message','info','result','catch','lodash','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x1ab60d,_0x4a4260){var _0x3c52b8=function(_0x3d1e7b){while(--_0x3d1e7b){_0x1ab60d['push'](_0x1ab60d['shift']());}};_0x3c52b8(++_0x4a4260);}(_0x02a7,0x16a));var _0x702a=function(_0x4b85de,_0x137569){_0x4b85de=_0x4b85de-0x0;var _0x1df244=_0x02a7[_0x4b85de];return _0x1df244;};'use strict';var _=require(_0x702a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x702a('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x702a('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x702a('0x3'))(_0x702a('0x4'));var config=require(_0x702a('0x5'));var jayson=require(_0x702a('0x6'));var client=jayson['client'][_0x702a('0x7')]({'port':0x232a});config[_0x702a('0x8')]=_[_0x702a('0x9')](config[_0x702a('0x8')],{'host':_0x702a('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x702a('0x8')]));require(_0x702a('0xb'))[_0x702a('0xc')](socket);function respondWithRpcPromise(_0x2feb13,_0x1015ba,_0x508601){return new BPromise(function(_0x241c4b,_0x2fa187){return client[_0x702a('0xd')](_0x2feb13,_0x508601)[_0x702a('0xe')](function(_0xb29ae4){logger['info'](_0x702a('0xf'),_0x1015ba,_0x702a('0x10'));logger[_0x702a('0x11')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x1015ba,_0x702a('0x10'),JSON['stringify'](_0xb29ae4));if(_0xb29ae4[_0x702a('0x12')]){if(_0xb29ae4[_0x702a('0x12')]['code']===0x1f4){logger[_0x702a('0x12')]('ChatWebsite,\x20%s,\x20%s',_0x1015ba,_0xb29ae4[_0x702a('0x12')]['message']);return _0x2fa187(_0xb29ae4[_0x702a('0x12')][_0x702a('0x13')]);}logger[_0x702a('0x12')](_0x702a('0xf'),_0x1015ba,_0xb29ae4['error'][_0x702a('0x13')]);return _0x241c4b(_0xb29ae4['error'][_0x702a('0x13')]);}else{logger[_0x702a('0x14')](_0x702a('0xf'),_0x1015ba,_0x702a('0x10'));_0x241c4b(_0xb29ae4[_0x702a('0x15')][_0x702a('0x13')]);}})[_0x702a('0x16')](function(_0x4235c9){logger['error'](_0x702a('0xf'),_0x1015ba,_0x4235c9);_0x2fa187(_0x4235c9);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 4f85e34..cccf068 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 _0xb9dd=['removeListener','register','length','chatWebsite:','save','remove','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb9dd,0xd6));var _0xdb9d=function(_0x372eff,_0x37d36c){_0x372eff=_0x372eff-0x0;var _0x25f618=_0xb9dd[_0x372eff];return _0x25f618;};'use strict';var ChatWebsiteEvents=require('./chatWebsite.events');var events=[_0xdb9d('0x0'),_0xdb9d('0x1'),_0xdb9d('0x2')];function createListener(_0x3565f3,_0x1ae172){return function(_0x34cd86){_0x1ae172['emit'](_0x3565f3,_0x34cd86);};}function removeListener(_0x24980c,_0x2de9b8){return function(){ChatWebsiteEvents[_0xdb9d('0x3')](_0x24980c,_0x2de9b8);};}exports[_0xdb9d('0x4')]=function(_0x177a05){for(var _0x7ed8d6=0x0,_0x35a62c=events[_0xdb9d('0x5')];_0x7ed8d6<_0x35a62c;_0x7ed8d6++){var _0x13f736=events[_0x7ed8d6];var _0x101184=createListener(_0xdb9d('0x6')+_0x13f736,_0x177a05);ChatWebsiteEvents['on'](_0x13f736,_0x101184);}}; \ No newline at end of file +var _0xb320=['emit','removeListener','register','length','./chatWebsite.events','save','remove','update'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xb320,0x1ac));var _0x0b32=function(_0x56a871,_0x18b7fe){_0x56a871=_0x56a871-0x0;var _0x124954=_0xb320[_0x56a871];return _0x124954;};'use strict';var ChatWebsiteEvents=require(_0x0b32('0x0'));var events=[_0x0b32('0x1'),_0x0b32('0x2'),_0x0b32('0x3')];function createListener(_0x41bcb6,_0x216b4f){return function(_0x3e6582){_0x216b4f[_0x0b32('0x4')](_0x41bcb6,_0x3e6582);};}function removeListener(_0x4338d9,_0x44c23b){return function(){ChatWebsiteEvents[_0x0b32('0x5')](_0x4338d9,_0x44c23b);};}exports[_0x0b32('0x6')]=function(_0x58842c){for(var _0x2c589f=0x0,_0x57b62e=events[_0x0b32('0x7')];_0x2c589f<_0x57b62e;_0x2c589f++){var _0x4636c6=events[_0x2c589f];var _0x396340=createListener('chatWebsite:'+_0x4636c6,_0x58842c);ChatWebsiteEvents['on'](_0x4636c6,_0x396340);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/helpers/wildcard-expressions.js b/server/api/chatWebsite/helpers/wildcard-expressions.js index 99ed0f6..657bde9 100644 --- a/server/api/chatWebsite/helpers/wildcard-expressions.js +++ b/server/api/chatWebsite/helpers/wildcard-expressions.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaac4=['../../../utils/misc','escapeRegExp','URL','localhost','test','trim','replace','([\x5cw]+)','exports'];(function(_0x4c968c,_0x10f37b){var _0x565d7f=function(_0x3d86a9){while(--_0x3d86a9){_0x4c968c['push'](_0x4c968c['shift']());}};_0x565d7f(++_0x10f37b);}(_0xaac4,0x6c));var _0x4aac=function(_0x30aa48,_0x5cf0c9){_0x30aa48=_0x30aa48-0x0;var _0x35fc1f=_0xaac4[_0x30aa48];return _0x35fc1f;};var escapeRegExp=require(_0x4aac('0x0'))[_0x4aac('0x1')];var URL=require('url')[_0x4aac('0x2')];function testWildcardValidity(_0x3e93f9){var _0x158ac2=!![];try{new URL(_0x3e93f9['replace']('*',_0x4aac('0x3')));}catch(_0x2e630e){_0x158ac2=![];}return _0x158ac2&&new RegExp(/(http(s)?):\/\/(\*|(((\*\.)+)?([a-zA-Z0-9\-_]+\.){0,}([a-zA-Z0-9\-_]+)))(:[\d]+)?\/?$/)[_0x4aac('0x4')](_0x3e93f9);}function testWebsiteWithWildcard(_0x63c769,_0x40cf08){var _0x4c94f2;var _0x2d795c=escapeRegExp(_0x63c769[_0x4aac('0x5')]()[_0x4aac('0x6')](/\/$/,''))['replace']('\x5c*',_0x4aac('0x7'));try{new URL(_0x63c769['replace']('\x5c*',_0x4aac('0x3')));_0x4c94f2=new RegExp(_0x2d795c)[_0x4aac('0x4')](_0x40cf08);}catch(_0x239771){_0x4c94f2=![];}return _0x4c94f2;}module[_0x4aac('0x8')]={'testWebsiteWithWildcard':testWebsiteWithWildcard,'testWildcardValidity':testWildcardValidity}; \ No newline at end of file +var _0xb422=['([\x5cw]+)','URL','replace','trim'];(function(_0x46567b,_0x3445e9){var _0x496280=function(_0xedacf2){while(--_0xedacf2){_0x46567b['push'](_0x46567b['shift']());}};_0x496280(++_0x3445e9);}(_0xb422,0x85));var _0x2b42=function(_0x1b1604,_0x368535){_0x1b1604=_0x1b1604-0x0;var _0x57918d=_0xb422[_0x1b1604];return _0x57918d;};var escapeRegExp=require('../../../utils/misc')['escapeRegExp'];var URL=require('url')[_0x2b42('0x0')];function testWildcardValidity(_0x5df79b){var _0x51ff45=!![];try{new URL(_0x5df79b[_0x2b42('0x1')]('*','localhost'));}catch(_0x14330f){_0x51ff45=![];}return _0x51ff45&&new RegExp(/(http(s)?):\/\/(\*|(((\*\.)+)?([a-zA-Z0-9\-_]+\.){0,}([a-zA-Z0-9\-_]+)))(:[\d]+)?\/?$/)['test'](_0x5df79b);}function testWebsiteWithWildcard(_0x1b469f,_0x5d0f67){var _0x406d93;var _0x1a0fbe=escapeRegExp(_0x1b469f[_0x2b42('0x2')]()['replace'](/\/$/,''))[_0x2b42('0x1')]('\x5c*',_0x2b42('0x3'));try{new URL(_0x1b469f[_0x2b42('0x1')]('\x5c*','localhost'));_0x406d93=new RegExp(_0x1a0fbe)['test'](_0x5d0f67);}catch(_0x4174e8){_0x406d93=![];}return _0x406d93;}module['exports']={'testWebsiteWithWildcard':testWebsiteWithWildcard,'testWildcardValidity':testWildcardValidity}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index c873a76..2ea176b 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 _0x8f14=['addLogo','join','server/files/images/avatars/','addCustomerAvatar','/:id/notify','notify','offline-chat','ensureDir','replace','extname','/:id/offline','offline','addInteraction','addProactiveActions','addAgents','put','/:id','delete','destroy','removeAnswers','removeAgents','exports','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','index','/describe','isAuthenticated','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getInteractions','/:id/snippet','getSnippet','/:id/applications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','create','addAnswer','diskStorage','root','server/files/images/logos/','format','%s-%s','now','originalname','single','file'];(function(_0x3902c1,_0x1c9eb2){var _0x1266cc=function(_0x50c2c5){while(--_0x50c2c5){_0x3902c1['push'](_0x3902c1['shift']());}};_0x1266cc(++_0x1c9eb2);}(_0x8f14,0x12a));var _0x48f1=function(_0x596819,_0x67618e){_0x596819=_0x596819-0x0;var _0x5a27a8=_0x8f14[_0x596819];return _0x5a27a8;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x48f1('0x0'));var express=require(_0x48f1('0x1'));var router=express[_0x48f1('0x2')]();var fs_extra=require(_0x48f1('0x3'));var auth=require(_0x48f1('0x4'));var interaction=require(_0x48f1('0x5'));var config=require(_0x48f1('0x6'));var controller=require(_0x48f1('0x7'));router[_0x48f1('0x8')]('/',auth['isAuthenticated'](),controller[_0x48f1('0x9')]);router['get'](_0x48f1('0xa'),auth[_0x48f1('0xb')](),controller['describe']);router[_0x48f1('0x8')]('/:id',auth[_0x48f1('0xb')](),controller[_0x48f1('0xc')]);router[_0x48f1('0x8')](_0x48f1('0xd'),auth['isAuthenticated'](),controller[_0x48f1('0xe')]);router[_0x48f1('0x8')](_0x48f1('0xf'),auth[_0x48f1('0xb')](),controller['getAnswers']);router[_0x48f1('0x8')](_0x48f1('0x10'),controller[_0x48f1('0x11')]);router[_0x48f1('0x8')](_0x48f1('0x12'),controller[_0x48f1('0x13')]);router[_0x48f1('0x8')](_0x48f1('0x14'),controller[_0x48f1('0x15')]);router[_0x48f1('0x8')](_0x48f1('0x16'),controller['getSystemAvatar']);router['get']('/:id/interactions',auth[_0x48f1('0xb')](),controller[_0x48f1('0x17')]);router['get'](_0x48f1('0x18'),controller[_0x48f1('0x19')]);router[_0x48f1('0x8')](_0x48f1('0x1a'),auth[_0x48f1('0xb')](),controller['getApplications']);router[_0x48f1('0x8')](_0x48f1('0x1b'),auth[_0x48f1('0xb')](),controller[_0x48f1('0x1c')]);router['get'](_0x48f1('0x1d'),controller[_0x48f1('0x1e')]);router[_0x48f1('0x8')](_0x48f1('0x1f'),auth['isAuthenticated'](),controller[_0x48f1('0x20')]);router[_0x48f1('0x8')](_0x48f1('0x21'),auth[_0x48f1('0xb')](),controller[_0x48f1('0x22')]);router[_0x48f1('0x23')]('/',auth[_0x48f1('0xb')](),controller[_0x48f1('0x24')]);router[_0x48f1('0x23')](_0x48f1('0xd'),auth[_0x48f1('0xb')](),controller['addDisposition']);router[_0x48f1('0x23')](_0x48f1('0xf'),auth['isAuthenticated'](),controller[_0x48f1('0x25')]);var upload=multer({'storage':multer[_0x48f1('0x26')]({'destination':function(_0x407c9a,_0x18cde7,_0x315b79){_0x315b79(null,path['join'](config[_0x48f1('0x27')],_0x48f1('0x28')));},'filename':function(_0x355421,_0x32a28d,_0x15ad72){_0x15ad72(null,util[_0x48f1('0x29')](_0x48f1('0x2a'),Date[_0x48f1('0x2b')](),_0x32a28d[_0x48f1('0x2c')]));}})});router[_0x48f1('0x23')](_0x48f1('0x10'),upload[_0x48f1('0x2d')](_0x48f1('0x2e')),controller[_0x48f1('0x2f')]);var upload=multer({'storage':multer[_0x48f1('0x26')]({'destination':function(_0x343dfe,_0x4e95b1,_0x4bc0be){_0x4bc0be(null,path[_0x48f1('0x30')](config[_0x48f1('0x27')],'server/files/images/avatars/'));},'filename':function(_0xc70433,_0x4c12da,_0x37d1b3){_0x37d1b3(null,util['format'](_0x48f1('0x2a'),Date[_0x48f1('0x2b')](),_0x4c12da[_0x48f1('0x2c')]));}})});router['post'](_0x48f1('0x12'),upload[_0x48f1('0x2d')]('file'),controller['addAvatar']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5d9d6f,_0x3fa565,_0x2da98b){_0x2da98b(null,path['join'](config[_0x48f1('0x27')],_0x48f1('0x31')));},'filename':function(_0x1e7a4c,_0x12adf4,_0x1a3e79){_0x1a3e79(null,util[_0x48f1('0x29')](_0x48f1('0x2a'),Date['now'](),_0x12adf4[_0x48f1('0x2c')]));}})});router['post']('/:id/customer_avatar',upload[_0x48f1('0x2d')](_0x48f1('0x2e')),controller[_0x48f1('0x32')]);var upload=multer({'storage':multer[_0x48f1('0x26')]({'destination':function(_0x58f479,_0x4505a2,_0xfd0984){_0xfd0984(null,path['join'](config[_0x48f1('0x27')],_0x48f1('0x31')));},'filename':function(_0x5c229d,_0x45d4cd,_0x5b8eb9){_0x5b8eb9(null,util[_0x48f1('0x29')](_0x48f1('0x2a'),Date['now'](),_0x45d4cd['originalname']));}})});router['post'](_0x48f1('0x16'),upload['single'](_0x48f1('0x2e')),controller['addSystemAvatar']);router[_0x48f1('0x23')](_0x48f1('0x33'),controller[_0x48f1('0x34')]);const offlineUploadMulter=multer({'storage':multer[_0x48f1('0x26')]({'destination':function(_0xb1d306,_0x44e017,_0x594aa3){const _0x22357d=path[_0x48f1('0x30')](config[_0x48f1('0x27')],'server/files','attachments',_0x48f1('0x35'));fs_extra[_0x48f1('0x36')](_0x22357d,function(){_0x594aa3(null,_0x22357d);});},'filename':function(_0x1c10c2,_0x2060ec,_0xff8426){const _0x25603f=_0x2060ec[_0x48f1('0x2c')][_0x48f1('0x37')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x30be9f=path[_0x48f1('0x38')](_0x25603f);const _0x546d03=Date[_0x48f1('0x2b')]()+'-'+_0x25603f[_0x48f1('0x37')](_0x30be9f,'')+_0x30be9f;_0xff8426(null,_0x546d03);}})});router[_0x48f1('0x23')](_0x48f1('0x39'),offlineUploadMulter['any'](),controller[_0x48f1('0x3a')]);router[_0x48f1('0x23')]('/:id/interactions',auth[_0x48f1('0xb')](),controller[_0x48f1('0x3b')]);router['post'](_0x48f1('0x1a'),auth[_0x48f1('0xb')](),controller['addApplications']);router[_0x48f1('0x23')](_0x48f1('0x1b'),auth[_0x48f1('0xb')](),controller[_0x48f1('0x3c')]);router['post'](_0x48f1('0x21'),auth[_0x48f1('0xb')](),controller[_0x48f1('0x3d')]);router[_0x48f1('0x3e')](_0x48f1('0x3f'),auth[_0x48f1('0xb')](),controller['update']);router[_0x48f1('0x40')](_0x48f1('0x3f'),auth[_0x48f1('0xb')](),controller[_0x48f1('0x41')]);router['delete'](_0x48f1('0xd'),auth[_0x48f1('0xb')](),controller['removeDispositions']);router['delete']('/:id/canned_answers',auth[_0x48f1('0xb')](),controller[_0x48f1('0x42')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0x48f1('0x43')]);module[_0x48f1('0x44')]=router; \ No newline at end of file +var _0x0fde=['/:id/users','getAgents','post','create','/:id/dispositions','addDisposition','diskStorage','join','root','format','%s-%s','now','originalname','single','addLogo','server/files/images/avatars/','file','addSystemAvatar','attachments','offline-chat','ensureDir','replace','extname','/:id/offline','any','offline','/:id/applications','addProactiveActions','addAgents','put','update','delete','/:id','removeDispositions','/:id/canned_answers','removeAgents','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','./chatWebsite.controller','get','isAuthenticated','/describe','describe','getDispositions','getAnswers','getLogo','getAvatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','/:id/snippet','getSnippet','getApplications','/:id/proactive_actions','getProactiveActions','getFields','getOfflineMessages'];(function(_0x8ce506,_0x517f30){var _0x23c8e5=function(_0x1d048e){while(--_0x1d048e){_0x8ce506['push'](_0x8ce506['shift']());}};_0x23c8e5(++_0x517f30);}(_0x0fde,0x64));var _0xe0fd=function(_0x16ac66,_0x5d6dc3){_0x16ac66=_0x16ac66-0x0;var _0x32e972=_0x0fde[_0x16ac66];return _0x32e972;};'use strict';var multer=require(_0xe0fd('0x0'));var util=require(_0xe0fd('0x1'));var path=require(_0xe0fd('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe0fd('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xe0fd('0x4'));var interaction=require(_0xe0fd('0x5'));var config=require('../../config/environment');var controller=require(_0xe0fd('0x6'));router[_0xe0fd('0x7')]('/',auth[_0xe0fd('0x8')](),controller['index']);router['get'](_0xe0fd('0x9'),auth[_0xe0fd('0x8')](),controller[_0xe0fd('0xa')]);router[_0xe0fd('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router['get']('/:id/dispositions',auth[_0xe0fd('0x8')](),controller[_0xe0fd('0xb')]);router[_0xe0fd('0x7')]('/:id/canned_answers',auth[_0xe0fd('0x8')](),controller[_0xe0fd('0xc')]);router[_0xe0fd('0x7')]('/:id/logo',controller[_0xe0fd('0xd')]);router[_0xe0fd('0x7')]('/:id/avatar',controller[_0xe0fd('0xe')]);router['get']('/:id/customer_avatar',controller[_0xe0fd('0xf')]);router[_0xe0fd('0x7')](_0xe0fd('0x10'),controller[_0xe0fd('0x11')]);router[_0xe0fd('0x7')](_0xe0fd('0x12'),auth[_0xe0fd('0x8')](),controller['getInteractions']);router[_0xe0fd('0x7')](_0xe0fd('0x13'),controller[_0xe0fd('0x14')]);router[_0xe0fd('0x7')]('/:id/applications',auth[_0xe0fd('0x8')](),controller[_0xe0fd('0x15')]);router[_0xe0fd('0x7')](_0xe0fd('0x16'),auth[_0xe0fd('0x8')](),controller[_0xe0fd('0x17')]);router[_0xe0fd('0x7')]('/:id/fields',controller[_0xe0fd('0x18')]);router[_0xe0fd('0x7')]('/:id/offline_messages',auth[_0xe0fd('0x8')](),controller[_0xe0fd('0x19')]);router[_0xe0fd('0x7')](_0xe0fd('0x1a'),auth[_0xe0fd('0x8')](),controller[_0xe0fd('0x1b')]);router[_0xe0fd('0x1c')]('/',auth[_0xe0fd('0x8')](),controller[_0xe0fd('0x1d')]);router['post'](_0xe0fd('0x1e'),auth[_0xe0fd('0x8')](),controller[_0xe0fd('0x1f')]);router[_0xe0fd('0x1c')]('/:id/canned_answers',auth[_0xe0fd('0x8')](),controller['addAnswer']);var upload=multer({'storage':multer[_0xe0fd('0x20')]({'destination':function(_0x4dad24,_0x359974,_0x344d1c){_0x344d1c(null,path[_0xe0fd('0x21')](config[_0xe0fd('0x22')],'server/files/images/logos/'));},'filename':function(_0x3e3580,_0x2acfec,_0x560bd6){_0x560bd6(null,util[_0xe0fd('0x23')](_0xe0fd('0x24'),Date[_0xe0fd('0x25')](),_0x2acfec[_0xe0fd('0x26')]));}})});router[_0xe0fd('0x1c')]('/:id/logo',upload[_0xe0fd('0x27')]('file'),controller[_0xe0fd('0x28')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x136d7a,_0x1d3bb0,_0x17baec){_0x17baec(null,path[_0xe0fd('0x21')](config[_0xe0fd('0x22')],_0xe0fd('0x29')));},'filename':function(_0xc70ed3,_0x4e28be,_0x508102){_0x508102(null,util[_0xe0fd('0x23')]('%s-%s',Date['now'](),_0x4e28be[_0xe0fd('0x26')]));}})});router['post']('/:id/avatar',upload[_0xe0fd('0x27')](_0xe0fd('0x2a')),controller['addAvatar']);var upload=multer({'storage':multer[_0xe0fd('0x20')]({'destination':function(_0x11ed49,_0x3449aa,_0x5e8326){_0x5e8326(null,path[_0xe0fd('0x21')](config['root'],_0xe0fd('0x29')));},'filename':function(_0x109067,_0x711661,_0x45b4cb){_0x45b4cb(null,util[_0xe0fd('0x23')]('%s-%s',Date[_0xe0fd('0x25')](),_0x711661['originalname']));}})});router[_0xe0fd('0x1c')]('/:id/customer_avatar',upload[_0xe0fd('0x27')](_0xe0fd('0x2a')),controller['addCustomerAvatar']);var upload=multer({'storage':multer[_0xe0fd('0x20')]({'destination':function(_0x576f18,_0x1b054f,_0x4b80d8){_0x4b80d8(null,path['join'](config['root'],_0xe0fd('0x29')));},'filename':function(_0x18e2a3,_0x4f1434,_0xa62c0a){_0xa62c0a(null,util[_0xe0fd('0x23')](_0xe0fd('0x24'),Date[_0xe0fd('0x25')](),_0x4f1434[_0xe0fd('0x26')]));}})});router[_0xe0fd('0x1c')](_0xe0fd('0x10'),upload[_0xe0fd('0x27')](_0xe0fd('0x2a')),controller[_0xe0fd('0x2b')]);router['post']('/:id/notify',controller['notify']);const offlineUploadMulter=multer({'storage':multer[_0xe0fd('0x20')]({'destination':function(_0x3e578b,_0x3d399e,_0x29aab5){const _0x302883=path['join'](config[_0xe0fd('0x22')],'server/files',_0xe0fd('0x2c'),_0xe0fd('0x2d'));fs_extra[_0xe0fd('0x2e')](_0x302883,function(){_0x29aab5(null,_0x302883);});},'filename':function(_0x1ca3c7,_0x34ee7c,_0x11d341){const _0x46f69b=_0x34ee7c[_0xe0fd('0x26')][_0xe0fd('0x2f')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x76388a=path[_0xe0fd('0x30')](_0x46f69b);const _0x31a400=Date['now']()+'-'+_0x46f69b[_0xe0fd('0x2f')](_0x76388a,'')+_0x76388a;_0x11d341(null,_0x31a400);}})});router['post'](_0xe0fd('0x31'),offlineUploadMulter[_0xe0fd('0x32')](),controller[_0xe0fd('0x33')]);router['post'](_0xe0fd('0x12'),auth['isAuthenticated'](),controller['addInteraction']);router[_0xe0fd('0x1c')](_0xe0fd('0x34'),auth[_0xe0fd('0x8')](),controller['addApplications']);router['post'](_0xe0fd('0x16'),auth['isAuthenticated'](),controller[_0xe0fd('0x35')]);router[_0xe0fd('0x1c')]('/:id/users',auth[_0xe0fd('0x8')](),controller[_0xe0fd('0x36')]);router[_0xe0fd('0x37')]('/:id',auth[_0xe0fd('0x8')](),controller[_0xe0fd('0x38')]);router[_0xe0fd('0x39')](_0xe0fd('0x3a'),auth[_0xe0fd('0x8')](),controller['destroy']);router[_0xe0fd('0x39')](_0xe0fd('0x1e'),auth[_0xe0fd('0x8')](),controller[_0xe0fd('0x3b')]);router[_0xe0fd('0x39')](_0xe0fd('0x3c'),auth[_0xe0fd('0x8')](),controller['removeAnswers']);router[_0xe0fd('0x39')](_0xe0fd('0x1a'),auth[_0xe0fd('0x8')](),controller[_0xe0fd('0x3d')]);module[_0xe0fd('0x3e')]=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index 475af03..b01c233 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 _0xf2ec=['client-side-logger','expressEndpoint','/client-logs','use','isAuthenticated','exports','express','../components/auth/service','../config/environment','Router','production','app','get'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0xf2ec,0xa2));var _0xcf2e=function(_0x368328,_0x16dd60){_0x368328=_0x368328-0x0;var _0x3b66d6=_0xf2ec[_0x368328];return _0x3b66d6;};var beaverLogger=require('beaver-logger/server');var express=require(_0xcf2e('0x0'));var auth=require(_0xcf2e('0x1'));var config=require(_0xcf2e('0x2'));var router=express[_0xcf2e('0x3')]();var isProduction=config['env']===_0xcf2e('0x4')||![];function clientSideLogs(_0x5ebffa,_0x47483b,_0x5c1990){var _0x4e5a2b=_0x5ebffa[_0xcf2e('0x5')][_0xcf2e('0x6')](_0xcf2e('0x7'));if(!_0x4e5a2b){throw new Error('Client-Side\x20logger\x20not\x20found!');}return beaverLogger[_0xcf2e('0x8')]({'uri':_0xcf2e('0x9'),'logger':_0x4e5a2b,'enableCors':!isProduction})(_0x5ebffa,_0x47483b,_0x5c1990);}router[_0xcf2e('0xa')](auth[_0xcf2e('0xb')](),clientSideLogs);module[_0xcf2e('0xc')]=router; \ No newline at end of file +var _0x1481=['production','app','get','Client-Side\x20logger\x20not\x20found!','expressEndpoint','/client-logs','use','isAuthenticated','beaver-logger/server','express','../components/auth/service','../config/environment','Router','env'];(function(_0x321781,_0x585793){var _0x1eacdc=function(_0x4f1695){while(--_0x4f1695){_0x321781['push'](_0x321781['shift']());}};_0x1eacdc(++_0x585793);}(_0x1481,0x6a));var _0x1148=function(_0x128c49,_0x4e77c6){_0x128c49=_0x128c49-0x0;var _0x5b9d42=_0x1481[_0x128c49];return _0x5b9d42;};var beaverLogger=require(_0x1148('0x0'));var express=require(_0x1148('0x1'));var auth=require(_0x1148('0x2'));var config=require(_0x1148('0x3'));var router=express[_0x1148('0x4')]();var isProduction=config[_0x1148('0x5')]===_0x1148('0x6')||![];function clientSideLogs(_0x319261,_0x428414,_0x4f6500){var _0x217ca5=_0x319261[_0x1148('0x7')][_0x1148('0x8')]('client-side-logger');if(!_0x217ca5){throw new Error(_0x1148('0x9'));}return beaverLogger[_0x1148('0xa')]({'uri':_0x1148('0xb'),'logger':_0x217ca5,'enableCors':!isProduction})(_0x319261,_0x428414,_0x4f6500);}router[_0x1148('0xc')](auth[_0x1148('0xd')](),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 0dc2b0b..4dfe73e 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 _0xb87d=['TEXT','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','exports','STRING','AmazonAWS','Google','Outlook365','Dynamics365','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret'];(function(_0x353f2d,_0x2627b7){var _0x929909=function(_0x41ba60){while(--_0x41ba60){_0x353f2d['push'](_0x353f2d['shift']());}};_0x929909(++_0x2627b7);}(_0xb87d,0x120));var _0xdb87=function(_0x3e5af9,_0x38d86f){_0x3e5af9=_0x3e5af9-0x0;var _0x44fb99=_0xb87d[_0x3e5af9];return _0x44fb99;};'use strict';var Sequelize=require(_0xdb87('0x0'));module[_0xdb87('0x1')]={'name':{'type':Sequelize[_0xdb87('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize['ENUM'](_0xdb87('0x3'),_0xdb87('0x4'),'MicrosoftAzure'),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0xdb87('0x5'),_0xdb87('0x6'))},'data1':{'type':Sequelize[_0xdb87('0x2')],'comment':'MicrosoftAzure\x20=>\x20client_id'},'data2':{'type':Sequelize[_0xdb87('0x2')],'comment':_0xdb87('0x7')},'data3':{'type':Sequelize[_0xdb87('0x2')],'comment':_0xdb87('0x8')},'data4':{'type':Sequelize[_0xdb87('0x2')],'comment':'MicrosoftAzure\x20=>\x20redirect_uri'},'data5':{'type':Sequelize['TEXT'],'comment':'MicrosoftAzure\x20=>\x20access_token'},'data6':{'type':Sequelize[_0xdb87('0x9')],'comment':'MicrosoftAzure\x20=>\x20refresh_token'},'data7':{'type':Sequelize[_0xdb87('0x9')],'comment':_0xdb87('0xa')}}; \ No newline at end of file +var _0x190a=['AmazonAWS','Google','MicrosoftAzure','Outlook365','Dynamics365','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','MicrosoftAzure\x20=>\x20access_token','TEXT','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','exports','STRING','ENUM'];(function(_0x7ed9e9,_0x35fb5d){var _0x383437=function(_0x496ea0){while(--_0x496ea0){_0x7ed9e9['push'](_0x7ed9e9['shift']());}};_0x383437(++_0x35fb5d);}(_0x190a,0x174));var _0xa190=function(_0x377fd1,_0x252296){_0x377fd1=_0x377fd1-0x0;var _0x4457dd=_0x190a[_0x377fd1];return _0x4457dd;};'use strict';var Sequelize=require('sequelize');module[_0xa190('0x0')]={'name':{'type':Sequelize[_0xa190('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xa190('0x2')](_0xa190('0x3'),_0xa190('0x4'),_0xa190('0x5')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0xa190('0x2')](_0xa190('0x6'),_0xa190('0x7'))},'data1':{'type':Sequelize[_0xa190('0x1')],'comment':'MicrosoftAzure\x20=>\x20client_id'},'data2':{'type':Sequelize[_0xa190('0x1')],'comment':_0xa190('0x8')},'data3':{'type':Sequelize[_0xa190('0x1')],'comment':_0xa190('0x9')},'data4':{'type':Sequelize[_0xa190('0x1')],'comment':_0xa190('0xa')},'data5':{'type':Sequelize['TEXT'],'comment':_0xa190('0xb')},'data6':{'type':Sequelize[_0xa190('0xc')],'comment':_0xa190('0xd')},'data7':{'type':Sequelize['TEXT'],'comment':_0xa190('0xe')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index eadc71c..1a6895e 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 _0x0806=['find','create','body','Service\x20parameter\x20not\x20specified','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','MicrosoftAzure','oauth2MicrosoftAuthorize','generateMicrosoftAuthorizationUrl','user','oauth2MicrosoftCallback','error','get','state','Invalid\x20state\x20parameter','parse','toString','isValidIdToken','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','getOauth2MicrosoftAccessToken','code','data5','data6','refresh_token','emit','microsoftAuthorization:success','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','ioredis','../../components/parsers/qs','../../components/encryptor','../../config/environment','../../config/logger','api','../../mysqldb','./cloudProvider.oauth','redis','defaults','localhost','socket.io-emitter','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','then','end','stack','name','send','padEnd','index','map','CloudProvider','fieldName','type','key','query','keys','intersection','attributes','fields','length','model','nolimit','sort','where','filters','filter','merge','VIRTUAL','options','include','findAll','rows','service','decryptString','data3','catch','show','params','includeAll'];(function(_0x85cbff,_0x3ad65f){var _0x167640=function(_0x20b744){while(--_0x20b744){_0x85cbff['push'](_0x85cbff['shift']());}};_0x167640(++_0x3ad65f);}(_0x0806,0x83));var _0x6080=function(_0xd71d33,_0x3bc6a1){_0xd71d33=_0xd71d33-0x0;var _0x5dffe4=_0x0806[_0xd71d33];return _0x5dffe4;};'use strict';var _=require('lodash');var Redis=require(_0x6080('0x0'));var qs=require(_0x6080('0x1'));var encryptor=require(_0x6080('0x2'));var config=require(_0x6080('0x3'));var logger=require(_0x6080('0x4'))(_0x6080('0x5'));var db=require(_0x6080('0x6'))['db'];var oauth=require(_0x6080('0x7'));config[_0x6080('0x8')]=_[_0x6080('0x9')](config[_0x6080('0x8')],{'host':_0x6080('0xa'),'port':0x18eb});var socket=require(_0x6080('0xb'))(new Redis(config[_0x6080('0x8')]));var redis=new Redis(config['redis']);function respondWithStatusCode(_0x3e6ff6,_0x1efbe7){_0x1efbe7=_0x1efbe7||0xcc;return function(_0x36fa15){if(_0x36fa15){return _0x3e6ff6[_0x6080('0xc')](_0x1efbe7);}return _0x3e6ff6[_0x6080('0xd')](_0x1efbe7)['end']();};}function respondWithResult(_0x17c1ec,_0xc1fdbd){_0xc1fdbd=_0xc1fdbd||0xc8;return function(_0xf7e24e){if(_0xf7e24e){return _0x17c1ec[_0x6080('0xd')](_0xc1fdbd)[_0x6080('0xe')](_0xf7e24e);}};}function respondWithFilteredResult(_0x18f807,_0x346bc8){return function(_0xa90968){if(_0xa90968){var _0x1c9d04=typeof _0x346bc8[_0x6080('0xf')]===_0x6080('0x10')&&typeof _0x346bc8[_0x6080('0x11')]==='undefined';var _0x33a0e8=_0xa90968['count'];var _0x308ecd=_0x1c9d04?0x0:_0x346bc8[_0x6080('0xf')];var _0x1cc349=_0x1c9d04?_0xa90968[_0x6080('0x12')]:_0x346bc8[_0x6080('0xf')]+_0x346bc8[_0x6080('0x11')];var _0x5a6661;if(_0x1cc349>=_0x33a0e8){_0x1cc349=_0x33a0e8;_0x5a6661=0xc8;}else{_0x5a6661=0xce;}_0x18f807[_0x6080('0xd')](_0x5a6661);return _0x18f807[_0x6080('0x13')](_0x6080('0x14'),_0x308ecd+'-'+_0x1cc349+'/'+_0x33a0e8)['json'](_0xa90968);}return null;};}function saveUpdates(_0x5e1e01){return function(_0x3439fa){if(_0x3439fa){return _0x3439fa[_0x6080('0x15')](_0x5e1e01)[_0x6080('0x16')](function(_0x3e2db5){return _0x3e2db5;});}return null;};}function removeEntity(_0x2a0377){return function(_0x3ffdfe){if(_0x3ffdfe){return _0x3ffdfe['destroy']()['then'](function(){_0x2a0377['status'](0xcc)[_0x6080('0x17')]();});}};}function handleEntityNotFound(_0x3136fe){return function(_0x2fb840){if(!_0x2fb840){_0x3136fe[_0x6080('0xc')](0x194);}return _0x2fb840;};}function handleError(_0x54b6d6,_0x3d16ea){_0x3d16ea=_0x3d16ea||0x1f4;return function(_0x25ac17){logger['error'](_0x25ac17[_0x6080('0x18')]);if(_0x25ac17[_0x6080('0x19')]){delete _0x25ac17[_0x6080('0x19')];}_0x54b6d6[_0x6080('0xd')](_0x3d16ea)[_0x6080('0x1a')](_0x25ac17);};}function maskClientSecret(_0x3d7f85){return _[_0x6080('0x1b')](_0x3d7f85['slice'](0x0,0x3),0x14,'*');}exports[_0x6080('0x1c')]=function(_0x4ab999,_0xa02301){var _0x302f03={},_0x13d306={},_0x358ee1={'count':0x0,'rows':[]};var _0x2b9327=_[_0x6080('0x1d')](db[_0x6080('0x1e')]['rawAttributes'],function(_0x552c94){return{'name':_0x552c94[_0x6080('0x1f')],'type':_0x552c94[_0x6080('0x20')][_0x6080('0x21')]};});_0x13d306['model']=_[_0x6080('0x1d')](_0x2b9327,_0x6080('0x19'));_0x13d306[_0x6080('0x22')]=_[_0x6080('0x23')](_0x4ab999['query']);_0x13d306['filters']=_[_0x6080('0x24')](_0x13d306['model'],_0x13d306[_0x6080('0x22')]);_0x302f03[_0x6080('0x25')]=_['intersection'](_0x13d306['model'],qs[_0x6080('0x26')](_0x4ab999[_0x6080('0x22')][_0x6080('0x26')]));_0x302f03[_0x6080('0x25')]=_0x302f03['attributes'][_0x6080('0x27')]?_0x302f03[_0x6080('0x25')]:_0x13d306[_0x6080('0x28')];if(!_0x4ab999[_0x6080('0x22')]['hasOwnProperty'](_0x6080('0x29'))){_0x302f03[_0x6080('0x11')]=qs[_0x6080('0x11')](_0x4ab999[_0x6080('0x22')][_0x6080('0x11')]);_0x302f03['offset']=qs[_0x6080('0xf')](_0x4ab999[_0x6080('0x22')]['offset']);}_0x302f03['order']=qs[_0x6080('0x2a')](_0x4ab999['query']['sort']);_0x302f03[_0x6080('0x2b')]=qs[_0x6080('0x2c')](_['pick'](_0x4ab999[_0x6080('0x22')],_0x13d306[_0x6080('0x2c')]),_0x2b9327);if(_0x4ab999[_0x6080('0x22')][_0x6080('0x2d')]){_0x302f03[_0x6080('0x2b')]=_[_0x6080('0x2e')](_0x302f03[_0x6080('0x2b')],{'$or':_[_0x6080('0x1d')](_0x2b9327,function(_0x3502f9){if(_0x3502f9[_0x6080('0x20')]!==_0x6080('0x2f')){var _0x9bf22f={};_0x9bf22f[_0x3502f9[_0x6080('0x19')]]={'$like':'%'+_0x4ab999[_0x6080('0x22')][_0x6080('0x2d')]+'%'};return _0x9bf22f;}})});}_0x302f03=_['merge']({},_0x302f03,_0x4ab999[_0x6080('0x30')]);var _0x506b3b={'where':_0x302f03[_0x6080('0x2b')]};return db['CloudProvider'][_0x6080('0x12')](_0x506b3b)[_0x6080('0x16')](function(_0x41be3b){_0x358ee1[_0x6080('0x12')]=_0x41be3b;if(_0x4ab999[_0x6080('0x22')]['includeAll']){_0x302f03[_0x6080('0x31')]=[{'all':!![]}];}return db[_0x6080('0x1e')][_0x6080('0x32')](_0x302f03);})[_0x6080('0x16')](function(_0x2d96f4){_0x358ee1[_0x6080('0x33')]=_[_0x6080('0x1d')](_0x2d96f4,function(_0x25005a){if(_0x25005a[_0x6080('0x34')]==='MicrosoftAzure'){var _0x9ba907=encryptor[_0x6080('0x35')](_0x25005a[_0x6080('0x36')]);_0x25005a['data3']=maskClientSecret(_0x9ba907);}return _0x25005a;});return _0x358ee1;})[_0x6080('0x16')](respondWithFilteredResult(_0xa02301,_0x302f03))[_0x6080('0x37')](handleError(_0xa02301,null));};exports[_0x6080('0x38')]=function(_0x1ff727,_0x27572e){var _0x55cc12={'raw':!![],'where':{'id':_0x1ff727[_0x6080('0x39')]['id']}},_0x5c7ed4={};_0x5c7ed4[_0x6080('0x28')]=_[_0x6080('0x23')](db[_0x6080('0x1e')]['rawAttributes']);_0x5c7ed4['query']=_[_0x6080('0x23')](_0x1ff727[_0x6080('0x22')]);_0x5c7ed4[_0x6080('0x2c')]=_[_0x6080('0x24')](_0x5c7ed4[_0x6080('0x28')],_0x5c7ed4[_0x6080('0x22')]);_0x55cc12[_0x6080('0x25')]=_[_0x6080('0x24')](_0x5c7ed4['model'],qs[_0x6080('0x26')](_0x1ff727['query'][_0x6080('0x26')]));_0x55cc12['attributes']=_0x55cc12[_0x6080('0x25')][_0x6080('0x27')]?_0x55cc12['attributes']:_0x5c7ed4['model'];if(_0x1ff727[_0x6080('0x22')][_0x6080('0x3a')]){_0x55cc12[_0x6080('0x31')]=[{'all':!![]}];}_0x55cc12=_[_0x6080('0x2e')]({},_0x55cc12,_0x1ff727[_0x6080('0x30')]);return db[_0x6080('0x1e')][_0x6080('0x3b')](_0x55cc12)[_0x6080('0x16')](handleEntityNotFound(_0x27572e,null))['then'](function(_0xf78349){if(_0xf78349['service']==='MicrosoftAzure'){var _0x5efe77=encryptor[_0x6080('0x35')](_0xf78349[_0x6080('0x36')]);_0xf78349[_0x6080('0x36')]=maskClientSecret(_0x5efe77);}return _0xf78349;})[_0x6080('0x16')](respondWithResult(_0x27572e,null))[_0x6080('0x37')](handleError(_0x27572e,null));};exports[_0x6080('0x3c')]=function(_0x4d288f,_0x2d539d){if(!_0x4d288f['body'][_0x6080('0x19')])throw new Error('Name\x20parameter\x20not\x20specified');if(!_0x4d288f[_0x6080('0x3d')][_0x6080('0x34')])throw new Error(_0x6080('0x3e'));var _0x42c856=db[_0x6080('0x1e')]['rawAttributes']['service'][_0x6080('0x3f')];if(!_0x42c856[_0x6080('0x40')](_0x4d288f[_0x6080('0x3d')][_0x6080('0x34')]))throw new Error(_0x6080('0x41')+_0x42c856[_0x6080('0x42')](',\x20'));if(_0x4d288f[_0x6080('0x3d')][_0x6080('0x34')]==='MicrosoftAzure'&&_0x4d288f[_0x6080('0x3d')][_0x6080('0x36')]){_0x4d288f[_0x6080('0x3d')]['data3']=encryptor[_0x6080('0x43')](_0x4d288f[_0x6080('0x3d')][_0x6080('0x36')]);}return db[_0x6080('0x1e')]['create'](_0x4d288f[_0x6080('0x3d')],{})[_0x6080('0x16')](respondWithResult(_0x2d539d,0xc9))[_0x6080('0x37')](handleError(_0x2d539d,null));};exports['update']=function(_0x30b4f1,_0x5a7a04){if(_0x30b4f1['body']['id']){delete _0x30b4f1[_0x6080('0x3d')]['id'];}return db['CloudProvider'][_0x6080('0x3b')]({'where':{'id':_0x30b4f1[_0x6080('0x39')]['id']}})[_0x6080('0x16')](handleEntityNotFound(_0x5a7a04,null))['then'](function(_0x4b3741){if(_0x4b3741['service']===_0x6080('0x44')&&_0x30b4f1[_0x6080('0x3d')][_0x6080('0x36')]){_0x30b4f1['body'][_0x6080('0x36')]=encryptor[_0x6080('0x43')](_0x30b4f1[_0x6080('0x3d')][_0x6080('0x36')]);}return _0x4b3741;})[_0x6080('0x16')](saveUpdates(_0x30b4f1[_0x6080('0x3d')],null))[_0x6080('0x16')](respondWithResult(_0x5a7a04,null))[_0x6080('0x37')](handleError(_0x5a7a04,null));};exports['destroy']=function(_0x4e7f13,_0x53ca59){return db[_0x6080('0x1e')][_0x6080('0x3b')]({'where':{'id':_0x4e7f13['params']['id']}})['then'](handleEntityNotFound(_0x53ca59,null))['then'](removeEntity(_0x53ca59,null))[_0x6080('0x37')](handleError(_0x53ca59,null));};exports[_0x6080('0x45')]=function(_0x2bb40a,_0x2638ac){return db[_0x6080('0x1e')]['findOne']({'where':{'id':_0x2bb40a[_0x6080('0x39')]['id']},'raw':!![]})['then'](function(_0x340775){if(!_0x340775)return _0x2638ac[_0x6080('0xc')](0x194);return{'url':oauth[_0x6080('0x46')](_0x340775,_0x2bb40a[_0x6080('0x47')]['id'])};})[_0x6080('0x16')](respondWithResult(_0x2638ac,null))['catch'](handleError(_0x2638ac,null));};exports[_0x6080('0x48')]=function(_0x4d010f,_0x4b76b3){var _0x21a0fc=_0x4d010f[_0x6080('0x3d')];var _0x23f9b9;var _0x245ac5;if(_0x21a0fc[_0x6080('0x49')])throw _0x21a0fc;redis[_0x6080('0x4a')](_0x21a0fc[_0x6080('0x4b')])[_0x6080('0x16')](function(_0x5a3d53){if(!_0x5a3d53)throw new Error(_0x6080('0x4c'));_0x23f9b9=JSON[_0x6080('0x4d')](_0x5a3d53);var _0x27359b=Buffer['from'](_0x21a0fc[_0x6080('0x4b')],'base64')[_0x6080('0x4e')]('ascii');_0x245ac5=JSON[_0x6080('0x4d')](_0x27359b);if(!oauth[_0x6080('0x4f')](_0x21a0fc[_0x6080('0x50')],_0x23f9b9[_0x6080('0x51')]))throw new Error(_0x6080('0x52'));redis[_0x6080('0x53')](_0x21a0fc['state']);return oauth[_0x6080('0x54')](_0x21a0fc[_0x6080('0x55')],_0x23f9b9);})[_0x6080('0x16')](function(_0x6306c6){_0x23f9b9[_0x6080('0x56')]=_0x6306c6['access_token'];_0x23f9b9[_0x6080('0x57')]=_0x6306c6[_0x6080('0x58')];return db[_0x6080('0x1e')][_0x6080('0x15')]({'data5':_0x23f9b9[_0x6080('0x56')],'data6':_0x23f9b9[_0x6080('0x57')]},{'where':{'id':_0x23f9b9['id']}});})[_0x6080('0x16')](function(){oauth['startRefreshInterval'](_0x23f9b9);socket[_0x6080('0x59')](_0x6080('0x5a'),{'id':_0x245ac5['id']});return;})['then'](respondWithStatusCode(_0x4b76b3,null))[_0x6080('0x37')](function(_0x103b30){if(_0x245ac5){socket[_0x6080('0x59')](_0x6080('0x5b'),{'id':_0x245ac5['id']});}if(!_0x23f9b9){logger['error'](_0x6080('0x5c'),_0x103b30);return _0x4b76b3[_0x6080('0xd')](0x1f4)[_0x6080('0x1a')](_0x103b30['message']);}logger['error'](_0x6080('0x5d'),_0x23f9b9['id'],JSON[_0x6080('0x5e')](_0x103b30));});}; \ No newline at end of file +var _0xc24f=['index','map','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','nolimit','order','sort','where','filters','merge','VIRTUAL','options','CloudProvider','includeAll','findAll','service','MicrosoftAzure','data3','catch','show','params','keys','include','find','decryptString','create','Name\x20parameter\x20not\x20specified','body','Service\x20parameter\x20not\x20specified','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','oauth2MicrosoftAuthorize','findOne','get','state','Invalid\x20state\x20parameter','parse','from','base64','isValidIdToken','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','getOauth2MicrosoftAccessToken','code','access_token','data6','emit','microsoftAuthorization:success','microsoftAuthorization:error','message','stringify','ioredis','../../components/parsers/qs','../../components/encryptor','api','../../mysqldb','./cloudProvider.oauth','redis','socket.io-emitter','sendStatus','end','status','json','offset','undefined','limit','count','set','update','then','error','stack','name','send','padEnd','slice'];(function(_0x3e29df,_0x42fdf8){var _0x3e3ba9=function(_0x47ccb0){while(--_0x47ccb0){_0x3e29df['push'](_0x3e29df['shift']());}};_0x3e3ba9(++_0x42fdf8);}(_0xc24f,0x95));var _0xfc24=function(_0x90a029,_0x51e6b1){_0x90a029=_0x90a029-0x0;var _0xe30212=_0xc24f[_0x90a029];return _0xe30212;};'use strict';var _=require('lodash');var Redis=require(_0xfc24('0x0'));var qs=require(_0xfc24('0x1'));var encryptor=require(_0xfc24('0x2'));var config=require('../../config/environment');var logger=require('../../config/logger')(_0xfc24('0x3'));var db=require(_0xfc24('0x4'))['db'];var oauth=require(_0xfc24('0x5'));config[_0xfc24('0x6')]=_['defaults'](config[_0xfc24('0x6')],{'host':'localhost','port':0x18eb});var socket=require(_0xfc24('0x7'))(new Redis(config['redis']));var redis=new Redis(config[_0xfc24('0x6')]);function respondWithStatusCode(_0x48e475,_0x38c35f){_0x38c35f=_0x38c35f||0xcc;return function(_0x40a4ad){if(_0x40a4ad){return _0x48e475[_0xfc24('0x8')](_0x38c35f);}return _0x48e475['status'](_0x38c35f)[_0xfc24('0x9')]();};}function respondWithResult(_0x190df5,_0x3ab18c){_0x3ab18c=_0x3ab18c||0xc8;return function(_0x35ab8d){if(_0x35ab8d){return _0x190df5[_0xfc24('0xa')](_0x3ab18c)[_0xfc24('0xb')](_0x35ab8d);}};}function respondWithFilteredResult(_0xc8685,_0x562744){return function(_0xa24470){if(_0xa24470){var _0x262c65=typeof _0x562744[_0xfc24('0xc')]===_0xfc24('0xd')&&typeof _0x562744[_0xfc24('0xe')]===_0xfc24('0xd');var _0x55b8e3=_0xa24470['count'];var _0x532990=_0x262c65?0x0:_0x562744[_0xfc24('0xc')];var _0x25bf3b=_0x262c65?_0xa24470[_0xfc24('0xf')]:_0x562744['offset']+_0x562744['limit'];var _0x407448;if(_0x25bf3b>=_0x55b8e3){_0x25bf3b=_0x55b8e3;_0x407448=0xc8;}else{_0x407448=0xce;}_0xc8685[_0xfc24('0xa')](_0x407448);return _0xc8685[_0xfc24('0x10')]('Content-Range',_0x532990+'-'+_0x25bf3b+'/'+_0x55b8e3)[_0xfc24('0xb')](_0xa24470);}return null;};}function saveUpdates(_0x1e181f){return function(_0x4dc69d){if(_0x4dc69d){return _0x4dc69d[_0xfc24('0x11')](_0x1e181f)[_0xfc24('0x12')](function(_0x4209d7){return _0x4209d7;});}return null;};}function removeEntity(_0xdc7e7c){return function(_0x58d6f5){if(_0x58d6f5){return _0x58d6f5['destroy']()[_0xfc24('0x12')](function(){_0xdc7e7c[_0xfc24('0xa')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5bed2c){return function(_0x16f434){if(!_0x16f434){_0x5bed2c[_0xfc24('0x8')](0x194);}return _0x16f434;};}function handleError(_0x592ab3,_0x7f54bf){_0x7f54bf=_0x7f54bf||0x1f4;return function(_0x3ec3f7){logger[_0xfc24('0x13')](_0x3ec3f7[_0xfc24('0x14')]);if(_0x3ec3f7[_0xfc24('0x15')]){delete _0x3ec3f7['name'];}_0x592ab3[_0xfc24('0xa')](_0x7f54bf)[_0xfc24('0x16')](_0x3ec3f7);};}function maskClientSecret(_0xb890d9){return _[_0xfc24('0x17')](_0xb890d9[_0xfc24('0x18')](0x0,0x3),0x14,'*');}exports[_0xfc24('0x19')]=function(_0x5ab4a0,_0x1a1f8c){var _0xb2983e={},_0x385132={},_0x169778={'count':0x0,'rows':[]};var _0x4a8c95=_[_0xfc24('0x1a')](db['CloudProvider'][_0xfc24('0x1b')],function(_0x7dc29f){return{'name':_0x7dc29f[_0xfc24('0x1c')],'type':_0x7dc29f[_0xfc24('0x1d')][_0xfc24('0x1e')]};});_0x385132[_0xfc24('0x1f')]=_[_0xfc24('0x1a')](_0x4a8c95,_0xfc24('0x15'));_0x385132['query']=_['keys'](_0x5ab4a0[_0xfc24('0x20')]);_0x385132['filters']=_[_0xfc24('0x21')](_0x385132[_0xfc24('0x1f')],_0x385132[_0xfc24('0x20')]);_0xb2983e['attributes']=_[_0xfc24('0x21')](_0x385132[_0xfc24('0x1f')],qs['fields'](_0x5ab4a0[_0xfc24('0x20')][_0xfc24('0x22')]));_0xb2983e[_0xfc24('0x23')]=_0xb2983e['attributes'][_0xfc24('0x24')]?_0xb2983e[_0xfc24('0x23')]:_0x385132[_0xfc24('0x1f')];if(!_0x5ab4a0[_0xfc24('0x20')]['hasOwnProperty'](_0xfc24('0x25'))){_0xb2983e[_0xfc24('0xe')]=qs[_0xfc24('0xe')](_0x5ab4a0[_0xfc24('0x20')]['limit']);_0xb2983e['offset']=qs['offset'](_0x5ab4a0[_0xfc24('0x20')]['offset']);}_0xb2983e[_0xfc24('0x26')]=qs['sort'](_0x5ab4a0[_0xfc24('0x20')][_0xfc24('0x27')]);_0xb2983e[_0xfc24('0x28')]=qs['filters'](_['pick'](_0x5ab4a0[_0xfc24('0x20')],_0x385132[_0xfc24('0x29')]),_0x4a8c95);if(_0x5ab4a0[_0xfc24('0x20')]['filter']){_0xb2983e[_0xfc24('0x28')]=_[_0xfc24('0x2a')](_0xb2983e['where'],{'$or':_[_0xfc24('0x1a')](_0x4a8c95,function(_0x2f2268){if(_0x2f2268[_0xfc24('0x1d')]!==_0xfc24('0x2b')){var _0x5605cc={};_0x5605cc[_0x2f2268[_0xfc24('0x15')]]={'$like':'%'+_0x5ab4a0[_0xfc24('0x20')]['filter']+'%'};return _0x5605cc;}})});}_0xb2983e=_[_0xfc24('0x2a')]({},_0xb2983e,_0x5ab4a0[_0xfc24('0x2c')]);var _0x50e938={'where':_0xb2983e[_0xfc24('0x28')]};return db[_0xfc24('0x2d')][_0xfc24('0xf')](_0x50e938)[_0xfc24('0x12')](function(_0xafed1d){_0x169778[_0xfc24('0xf')]=_0xafed1d;if(_0x5ab4a0[_0xfc24('0x20')][_0xfc24('0x2e')]){_0xb2983e['include']=[{'all':!![]}];}return db[_0xfc24('0x2d')][_0xfc24('0x2f')](_0xb2983e);})[_0xfc24('0x12')](function(_0x9e6ed9){_0x169778['rows']=_[_0xfc24('0x1a')](_0x9e6ed9,function(_0xe6a284){if(_0xe6a284[_0xfc24('0x30')]===_0xfc24('0x31')){var _0x517e67=encryptor['decryptString'](_0xe6a284['data3']);_0xe6a284[_0xfc24('0x32')]=maskClientSecret(_0x517e67);}return _0xe6a284;});return _0x169778;})[_0xfc24('0x12')](respondWithFilteredResult(_0x1a1f8c,_0xb2983e))[_0xfc24('0x33')](handleError(_0x1a1f8c,null));};exports[_0xfc24('0x34')]=function(_0xb628b5,_0x196c36){var _0x156676={'raw':!![],'where':{'id':_0xb628b5[_0xfc24('0x35')]['id']}},_0x25eb62={};_0x25eb62[_0xfc24('0x1f')]=_[_0xfc24('0x36')](db['CloudProvider'][_0xfc24('0x1b')]);_0x25eb62[_0xfc24('0x20')]=_[_0xfc24('0x36')](_0xb628b5[_0xfc24('0x20')]);_0x25eb62[_0xfc24('0x29')]=_[_0xfc24('0x21')](_0x25eb62[_0xfc24('0x1f')],_0x25eb62[_0xfc24('0x20')]);_0x156676[_0xfc24('0x23')]=_[_0xfc24('0x21')](_0x25eb62[_0xfc24('0x1f')],qs[_0xfc24('0x22')](_0xb628b5['query'][_0xfc24('0x22')]));_0x156676['attributes']=_0x156676['attributes']['length']?_0x156676['attributes']:_0x25eb62['model'];if(_0xb628b5['query'][_0xfc24('0x2e')]){_0x156676[_0xfc24('0x37')]=[{'all':!![]}];}_0x156676=_[_0xfc24('0x2a')]({},_0x156676,_0xb628b5['options']);return db[_0xfc24('0x2d')][_0xfc24('0x38')](_0x156676)[_0xfc24('0x12')](handleEntityNotFound(_0x196c36,null))[_0xfc24('0x12')](function(_0x33dd38){if(_0x33dd38[_0xfc24('0x30')]===_0xfc24('0x31')){var _0x3828d1=encryptor[_0xfc24('0x39')](_0x33dd38[_0xfc24('0x32')]);_0x33dd38[_0xfc24('0x32')]=maskClientSecret(_0x3828d1);}return _0x33dd38;})[_0xfc24('0x12')](respondWithResult(_0x196c36,null))[_0xfc24('0x33')](handleError(_0x196c36,null));};exports[_0xfc24('0x3a')]=function(_0x557732,_0x40d5ab){if(!_0x557732['body'][_0xfc24('0x15')])throw new Error(_0xfc24('0x3b'));if(!_0x557732[_0xfc24('0x3c')][_0xfc24('0x30')])throw new Error(_0xfc24('0x3d'));var _0x2fa800=db[_0xfc24('0x2d')][_0xfc24('0x1b')]['service']['values'];if(!_0x2fa800[_0xfc24('0x3e')](_0x557732['body'][_0xfc24('0x30')]))throw new Error(_0xfc24('0x3f')+_0x2fa800[_0xfc24('0x40')](',\x20'));if(_0x557732['body'][_0xfc24('0x30')]===_0xfc24('0x31')&&_0x557732[_0xfc24('0x3c')][_0xfc24('0x32')]){_0x557732[_0xfc24('0x3c')][_0xfc24('0x32')]=encryptor['encryptString'](_0x557732[_0xfc24('0x3c')][_0xfc24('0x32')]);}return db[_0xfc24('0x2d')]['create'](_0x557732[_0xfc24('0x3c')],{})[_0xfc24('0x12')](respondWithResult(_0x40d5ab,0xc9))[_0xfc24('0x33')](handleError(_0x40d5ab,null));};exports['update']=function(_0x21e16,_0x3200fc){if(_0x21e16[_0xfc24('0x3c')]['id']){delete _0x21e16[_0xfc24('0x3c')]['id'];}return db[_0xfc24('0x2d')][_0xfc24('0x38')]({'where':{'id':_0x21e16[_0xfc24('0x35')]['id']}})['then'](handleEntityNotFound(_0x3200fc,null))[_0xfc24('0x12')](function(_0x4b73a1){if(_0x4b73a1[_0xfc24('0x30')]===_0xfc24('0x31')&&_0x21e16[_0xfc24('0x3c')][_0xfc24('0x32')]){_0x21e16[_0xfc24('0x3c')]['data3']=encryptor['encryptString'](_0x21e16['body'][_0xfc24('0x32')]);}return _0x4b73a1;})[_0xfc24('0x12')](saveUpdates(_0x21e16[_0xfc24('0x3c')],null))['then'](respondWithResult(_0x3200fc,null))['catch'](handleError(_0x3200fc,null));};exports['destroy']=function(_0x5a8679,_0x494f36){return db[_0xfc24('0x2d')][_0xfc24('0x38')]({'where':{'id':_0x5a8679[_0xfc24('0x35')]['id']}})[_0xfc24('0x12')](handleEntityNotFound(_0x494f36,null))[_0xfc24('0x12')](removeEntity(_0x494f36,null))[_0xfc24('0x33')](handleError(_0x494f36,null));};exports[_0xfc24('0x41')]=function(_0x3389bd,_0x5e6892){return db['CloudProvider'][_0xfc24('0x42')]({'where':{'id':_0x3389bd['params']['id']},'raw':!![]})[_0xfc24('0x12')](function(_0x241202){if(!_0x241202)return _0x5e6892[_0xfc24('0x8')](0x194);return{'url':oauth['generateMicrosoftAuthorizationUrl'](_0x241202,_0x3389bd['user']['id'])};})[_0xfc24('0x12')](respondWithResult(_0x5e6892,null))[_0xfc24('0x33')](handleError(_0x5e6892,null));};exports['oauth2MicrosoftCallback']=function(_0x39070c,_0x15cbd3){var _0x45f2d6=_0x39070c[_0xfc24('0x3c')];var _0x35df6b;var _0x910cb;if(_0x45f2d6[_0xfc24('0x13')])throw _0x45f2d6;redis[_0xfc24('0x43')](_0x45f2d6[_0xfc24('0x44')])['then'](function(_0xc57dbf){if(!_0xc57dbf)throw new Error(_0xfc24('0x45'));_0x35df6b=JSON[_0xfc24('0x46')](_0xc57dbf);var _0x33d46c=Buffer[_0xfc24('0x47')](_0x45f2d6[_0xfc24('0x44')],_0xfc24('0x48'))['toString']('ascii');_0x910cb=JSON[_0xfc24('0x46')](_0x33d46c);if(!oauth[_0xfc24('0x49')](_0x45f2d6[_0xfc24('0x4a')],_0x35df6b[_0xfc24('0x4b')]))throw new Error(_0xfc24('0x4c'));redis[_0xfc24('0x4d')](_0x45f2d6[_0xfc24('0x44')]);return oauth[_0xfc24('0x4e')](_0x45f2d6[_0xfc24('0x4f')],_0x35df6b);})['then'](function(_0x74ece6){_0x35df6b['data5']=_0x74ece6[_0xfc24('0x50')];_0x35df6b['data6']=_0x74ece6['refresh_token'];return db[_0xfc24('0x2d')][_0xfc24('0x11')]({'data5':_0x35df6b['data5'],'data6':_0x35df6b[_0xfc24('0x51')]},{'where':{'id':_0x35df6b['id']}});})[_0xfc24('0x12')](function(){oauth['startRefreshInterval'](_0x35df6b);socket[_0xfc24('0x52')](_0xfc24('0x53'),{'id':_0x910cb['id']});return;})['then'](respondWithStatusCode(_0x15cbd3,null))[_0xfc24('0x33')](function(_0x4203a8){if(_0x910cb){socket[_0xfc24('0x52')](_0xfc24('0x54'),{'id':_0x910cb['id']});}if(!_0x35df6b){logger['error']('Invalid\x20authentication\x20state\x20parameter',_0x4203a8);return _0x15cbd3[_0xfc24('0xa')](0x1f4)[_0xfc24('0x16')](_0x4203a8[_0xfc24('0x55')]);}logger[_0xfc24('0x13')]('Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s',_0x35df6b['id'],JSON[_0xfc24('0x56')](_0x4203a8));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 0859593..2691209 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 _0x0d34=['define','CloudProvider','cloud_providers','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./cloudProvider.attributes','exports'];(function(_0x4dca91,_0x265b6c){var _0x5295a2=function(_0x3bee91){while(--_0x3bee91){_0x4dca91['push'](_0x4dca91['shift']());}};_0x5295a2(++_0x265b6c);}(_0x0d34,0x18b));var _0x40d3=function(_0x2c7a93,_0x32a9e0){_0x2c7a93=_0x2c7a93-0x0;var _0x513d22=_0x0d34[_0x2c7a93];return _0x513d22;};'use strict';var _=require(_0x40d3('0x0'));var util=require(_0x40d3('0x1'));var logger=require(_0x40d3('0x2'))(_0x40d3('0x3'));var moment=require(_0x40d3('0x4'));var BPromise=require(_0x40d3('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x40d3('0x6'));var rimraf=require(_0x40d3('0x7'));var config=require(_0x40d3('0x8'));var attributes=require(_0x40d3('0x9'));module[_0x40d3('0xa')]=function(_0xaec73e,_0x257358){return _0xaec73e[_0x40d3('0xb')](_0x40d3('0xc'),attributes,{'tableName':_0x40d3('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0137=['../../config/environment','./cloudProvider.attributes','exports','define','CloudProvider','lodash','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x4de9df,_0x1d5c49){var _0x58b88b=function(_0xc08be7){while(--_0xc08be7){_0x4de9df['push'](_0x4de9df['shift']());}};_0x58b88b(++_0x1d5c49);}(_0x0137,0xc5));var _0x7013=function(_0x485539,_0x5491b7){_0x485539=_0x485539-0x0;var _0x2d3d75=_0x0137[_0x485539];return _0x2d3d75;};'use strict';var _=require(_0x7013('0x0'));var util=require('util');var logger=require(_0x7013('0x1'))(_0x7013('0x2'));var moment=require(_0x7013('0x3'));var BPromise=require('bluebird');var rp=require(_0x7013('0x4'));var fs=require('fs');var path=require(_0x7013('0x5'));var rimraf=require(_0x7013('0x6'));var config=require(_0x7013('0x7'));var attributes=require(_0x7013('0x8'));module[_0x7013('0x9')]=function(_0x9e752c,_0x560bd1){return _0x9e752c[_0x7013('0xa')](_0x7013('0xb'),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 8ae1684..9aa3edc 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 _0xfdb7=['update','catch','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','decryptString','intervals','bind','findAll','all','inspect','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','lodash','crypto','jsonwebtoken','moment','ioredis','request-promise','util','../../config/environment','../../config/logger','api','../../config/schedule/cloud-provider','../../mysqldb','redis','defaults','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','profile','email','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','openid','offline_access','/authorize','/token','map','type','Dynamics365','push','data7','join','Outlook365','https://outlook.office365.com/IMAP.AccessAsUser.All','/.default','{TENANT_ID}','data2','id_token','from','stringify','toString','base64','randomBytes','hex','client_id','data1','redirect_uri','data4','response_mode','scope','nonce','prompt','login','key','value','oauth2Claims','replace','oauth2/','set','decode','payload','issuer','audience','isAfter','unix','exp','then','CloudProvider','findOne','data6','data3','POST','data5','access_token','refresh_token'];(function(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0xfdb7,0x1bb));var _0x7fdb=function(_0x45aadc,_0x5187c0){_0x45aadc=_0x45aadc-0x0;var _0x4c84a1=_0xfdb7[_0x45aadc];return _0x4c84a1;};'use strict';var _=require(_0x7fdb('0x0'));var crypto=require(_0x7fdb('0x1'));var jwt=require(_0x7fdb('0x2'));var moment=require(_0x7fdb('0x3'));var Redis=require(_0x7fdb('0x4'));var rp=require(_0x7fdb('0x5'));var util=require(_0x7fdb('0x6'));var encryptor=require('../../components/encryptor');var config=require(_0x7fdb('0x7'));var logger=require(_0x7fdb('0x8'))(_0x7fdb('0x9'));var schedule=require(_0x7fdb('0xa'));var db=require(_0x7fdb('0xb'))['db'];config[_0x7fdb('0xc')]=_[_0x7fdb('0xd')](config[_0x7fdb('0xc')],{'host':_0x7fdb('0xe'),'port':0x18eb});var redis=new Redis(config[_0x7fdb('0xc')]);var MICROSOFT_AUTH_URL=_0x7fdb('0xf');var AZURE_AUTH_SCOPES={'Outlook365':['openid',_0x7fdb('0x10'),_0x7fdb('0x11'),'offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All',_0x7fdb('0x12'),_0x7fdb('0x13')],'Dynamics365':[_0x7fdb('0x14'),_0x7fdb('0x15')]};var MICROSOFT_AUTH_ENDPOINT=_0x7fdb('0x16');var MICROSOFT_TOKEN_ENDPOINT=_0x7fdb('0x17');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x4ccae7){var _0x4e0930=_[_0x7fdb('0x18')](AZURE_AUTH_SCOPES[_0x4ccae7[_0x7fdb('0x19')]]);if(_0x4ccae7[_0x7fdb('0x19')]===_0x7fdb('0x1a'))_0x4e0930[_0x7fdb('0x1b')](_0x4ccae7[_0x7fdb('0x1c')]+'/.default');return _0x4e0930[_0x7fdb('0x1d')]('\x20');}function getAccessTokenScope(_0x3c0416){if(_0x3c0416['type']===_0x7fdb('0x1e'))return _0x7fdb('0x1f');if(_0x3c0416[_0x7fdb('0x19')]===_0x7fdb('0x1a'))return _0x3c0416[_0x7fdb('0x1c')]+_0x7fdb('0x20');}function generateMicrosoftAuthorizationUrl(_0x1f7c2b,_0x134fb4){var _0x3763f9=MICROSOFT_AUTH_URL['replace'](_0x7fdb('0x21'),_0x1f7c2b[_0x7fdb('0x22')]);var _0x5313f1=['code',_0x7fdb('0x23')];var _0x2b6c7f=Buffer[_0x7fdb('0x24')](JSON[_0x7fdb('0x25')]({'id':_0x134fb4}))[_0x7fdb('0x26')](_0x7fdb('0x27'));var _0x4e8076=crypto[_0x7fdb('0x28')](0x10)['toString'](_0x7fdb('0x29'));var _0x179a00=getAuthorizationScopes(_0x1f7c2b);var _0x4001a5=[{'key':_0x7fdb('0x2a'),'value':_0x1f7c2b[_0x7fdb('0x2b')]},{'key':'response_type','value':encodeURIComponent(_0x5313f1[_0x7fdb('0x1d')]('\x20'))},{'key':_0x7fdb('0x2c'),'value':_0x1f7c2b[_0x7fdb('0x2d')]},{'key':_0x7fdb('0x2e'),'value':'form_post'},{'key':_0x7fdb('0x2f'),'value':encodeURIComponent(_0x179a00)},{'key':'state','value':_0x2b6c7f},{'key':_0x7fdb('0x30'),'value':_0x4e8076},{'key':_0x7fdb('0x31'),'value':_0x7fdb('0x32')}];var _0x3f3b42=_0x3763f9+MICROSOFT_AUTH_ENDPOINT+'?'+_['map'](_0x4001a5,function(_0x1d9a4f){return _0x1d9a4f[_0x7fdb('0x33')]+'='+_0x1d9a4f[_0x7fdb('0x34')];})['join']('&');_0x1f7c2b[_0x7fdb('0x35')]={'issuer':_0x3763f9[_0x7fdb('0x36')](_0x7fdb('0x37'),''),'audience':_0x1f7c2b[_0x7fdb('0x2b')],'state':_0x2b6c7f,'nonce':_0x4e8076};redis[_0x7fdb('0x38')](_0x2b6c7f,JSON[_0x7fdb('0x25')](_0x1f7c2b));return _0x3f3b42;}function isValidIdToken(_0x48bcef,_0x18c314){try{var _0x20757f=jwt[_0x7fdb('0x39')](_0x48bcef,{'complete':!![]});var _0x376fe2=_0x20757f[_0x7fdb('0x3a')];if(_0x376fe2['iss']!==_0x18c314[_0x7fdb('0x3b')])return![];if(_0x376fe2['aud']!==_0x18c314[_0x7fdb('0x3c')])return![];if(_0x376fe2[_0x7fdb('0x30')]!==_0x18c314[_0x7fdb('0x30')])return![];if(moment()[_0x7fdb('0x3d')](moment[_0x7fdb('0x3e')](_0x376fe2[_0x7fdb('0x3f')])))return![];return!![];}catch(_0x2bd9a5){throw _0x2bd9a5;}}function refreshOauth2MicrosoftAccessToken(_0x51dd68){return Promise['resolve']()[_0x7fdb('0x40')](function(){if(_0x51dd68['data3'])return _0x51dd68;return db[_0x7fdb('0x41')][_0x7fdb('0x42')]({'where':{'id':_0x51dd68['id']},'raw':!![]});})[_0x7fdb('0x40')](function(_0x2c5a75){var _0x19d819={'grant_type':'refresh_token','refresh_token':_0x2c5a75[_0x7fdb('0x43')],'scope':getAccessTokenScope(_0x2c5a75),'redirect_uri':_0x2c5a75['data4'],'client_id':_0x2c5a75[_0x7fdb('0x2b')],'client_secret':encryptor['decryptString'](_0x2c5a75[_0x7fdb('0x44')])};var _0x450c98={'method':_0x7fdb('0x45'),'uri':MICROSOFT_AUTH_URL['replace'](_0x7fdb('0x21'),_0x2c5a75[_0x7fdb('0x22')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x19d819,'json':!![]};return rp(_0x450c98);})[_0x7fdb('0x40')](function(_0x41b540){_0x51dd68[_0x7fdb('0x46')]=_0x41b540[_0x7fdb('0x47')];_0x51dd68[_0x7fdb('0x43')]=_0x41b540[_0x7fdb('0x48')];return db['CloudProvider'][_0x7fdb('0x49')]({'data5':_0x51dd68[_0x7fdb('0x46')],'data6':_0x51dd68[_0x7fdb('0x43')]},{'where':{'id':_0x51dd68['id']}});})['then'](function(){return _0x51dd68;})[_0x7fdb('0x4a')](function(_0x4398ee){logger[_0x7fdb('0x4b')](_0x7fdb('0x4c'),_0x51dd68['id'],_0x4398ee);});}function getOauth2MicrosoftAccessToken(_0x30cb44,_0x3cf199){var _0x1a3686={'grant_type':_0x7fdb('0x4d'),'code':_0x30cb44,'scope':getAccessTokenScope(_0x3cf199),'redirect_uri':_0x3cf199[_0x7fdb('0x2d')],'client_id':_0x3cf199[_0x7fdb('0x2b')],'client_secret':encryptor[_0x7fdb('0x4e')](_0x3cf199['data3'])};var _0x7c0cd5={'method':_0x7fdb('0x45'),'uri':MICROSOFT_AUTH_URL[_0x7fdb('0x36')](_0x7fdb('0x21'),_0x3cf199[_0x7fdb('0x22')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x1a3686,'json':!![]};return rp(_0x7c0cd5);}function startRefreshInterval(_0x3253d5){var _0x15c459=schedule[_0x7fdb('0x4f')];if(_0x15c459[_0x3253d5['id']])clearInterval(_0x15c459[_0x3253d5['id']]);_0x15c459[_0x3253d5['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x7fdb('0x50')](this,{'id':_0x3253d5['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x7fdb('0x4f')]=_0x15c459;}function startAllRefreshIntervals(){return db['CloudProvider'][_0x7fdb('0x51')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x7fdb('0x40')](function(_0x16c058){var _0x5339fa=_0x16c058['map'](function(_0x359c0d){return refreshOauth2MicrosoftAccessToken(_0x359c0d)[_0x7fdb('0x40')](function(_0x520eff){startRefreshInterval(_0x520eff);});});return Promise[_0x7fdb('0x52')](_0x5339fa);})[_0x7fdb('0x4a')](function(_0x514ecc){var _0x114508=_0x514ecc?util[_0x7fdb('0x53')](_0x514ecc,{'showHidden':![],'depth':null}):'';logger[_0x7fdb('0x4b')](_0x7fdb('0x54'),_0x114508);});}module[_0x7fdb('0x55')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0x7e1b=['email','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','offline_access','/authorize','/token','type','Dynamics365','push','data7','/.default','join','Outlook365','replace','{TENANT_ID}','data2','code','id_token','stringify','toString','randomBytes','client_id','data1','redirect_uri','data4','form_post','scope','state','nonce','prompt','login','map','key','value','oauth2Claims','oauth2/','set','decode','iss','issuer','aud','audience','isAfter','unix','exp','resolve','then','data3','CloudProvider','findOne','refresh_token','data6','decryptString','POST','data5','access_token','update','catch','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','intervals','findAll','all','inspect','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','lodash','crypto','moment','ioredis','request-promise','../../components/encryptor','../../config/environment','api','redis','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','profile'];(function(_0x532d2d,_0x5d33ce){var _0x1da8d1=function(_0x1bd1c7){while(--_0x1bd1c7){_0x532d2d['push'](_0x532d2d['shift']());}};_0x1da8d1(++_0x5d33ce);}(_0x7e1b,0x1d9));var _0xb7e1=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x7e1b[_0x2be8c2];return _0x97f531;};'use strict';var _=require(_0xb7e1('0x0'));var crypto=require(_0xb7e1('0x1'));var jwt=require('jsonwebtoken');var moment=require(_0xb7e1('0x2'));var Redis=require(_0xb7e1('0x3'));var rp=require(_0xb7e1('0x4'));var util=require('util');var encryptor=require(_0xb7e1('0x5'));var config=require(_0xb7e1('0x6'));var logger=require('../../config/logger')(_0xb7e1('0x7'));var schedule=require('../../config/schedule/cloud-provider');var db=require('../../mysqldb')['db'];config[_0xb7e1('0x8')]=_['defaults'](config[_0xb7e1('0x8')],{'host':_0xb7e1('0x9'),'port':0x18eb});var redis=new Redis(config[_0xb7e1('0x8')]);var MICROSOFT_AUTH_URL=_0xb7e1('0xa');var AZURE_AUTH_SCOPES={'Outlook365':[_0xb7e1('0xb'),_0xb7e1('0xc'),_0xb7e1('0xd'),'offline_access',_0xb7e1('0xe'),_0xb7e1('0xf'),_0xb7e1('0x10')],'Dynamics365':[_0xb7e1('0xb'),_0xb7e1('0x11')]};var MICROSOFT_AUTH_ENDPOINT=_0xb7e1('0x12');var MICROSOFT_TOKEN_ENDPOINT=_0xb7e1('0x13');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x430516){var _0x4af17e=_['map'](AZURE_AUTH_SCOPES[_0x430516[_0xb7e1('0x14')]]);if(_0x430516[_0xb7e1('0x14')]===_0xb7e1('0x15'))_0x4af17e[_0xb7e1('0x16')](_0x430516[_0xb7e1('0x17')]+_0xb7e1('0x18'));return _0x4af17e[_0xb7e1('0x19')]('\x20');}function getAccessTokenScope(_0x51dac5){if(_0x51dac5['type']===_0xb7e1('0x1a'))return _0xb7e1('0xe');if(_0x51dac5[_0xb7e1('0x14')]===_0xb7e1('0x15'))return _0x51dac5[_0xb7e1('0x17')]+_0xb7e1('0x18');}function generateMicrosoftAuthorizationUrl(_0x44ccce,_0x2c0c15){var _0x49742c=MICROSOFT_AUTH_URL[_0xb7e1('0x1b')](_0xb7e1('0x1c'),_0x44ccce[_0xb7e1('0x1d')]);var _0x162eca=[_0xb7e1('0x1e'),_0xb7e1('0x1f')];var _0x190b0e=Buffer['from'](JSON[_0xb7e1('0x20')]({'id':_0x2c0c15}))[_0xb7e1('0x21')]('base64');var _0x269990=crypto[_0xb7e1('0x22')](0x10)[_0xb7e1('0x21')]('hex');var _0x1d3124=getAuthorizationScopes(_0x44ccce);var _0x14e250=[{'key':_0xb7e1('0x23'),'value':_0x44ccce[_0xb7e1('0x24')]},{'key':'response_type','value':encodeURIComponent(_0x162eca[_0xb7e1('0x19')]('\x20'))},{'key':_0xb7e1('0x25'),'value':_0x44ccce[_0xb7e1('0x26')]},{'key':'response_mode','value':_0xb7e1('0x27')},{'key':_0xb7e1('0x28'),'value':encodeURIComponent(_0x1d3124)},{'key':_0xb7e1('0x29'),'value':_0x190b0e},{'key':_0xb7e1('0x2a'),'value':_0x269990},{'key':_0xb7e1('0x2b'),'value':_0xb7e1('0x2c')}];var _0x1b267b=_0x49742c+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0xb7e1('0x2d')](_0x14e250,function(_0x377360){return _0x377360[_0xb7e1('0x2e')]+'='+_0x377360[_0xb7e1('0x2f')];})['join']('&');_0x44ccce[_0xb7e1('0x30')]={'issuer':_0x49742c[_0xb7e1('0x1b')](_0xb7e1('0x31'),''),'audience':_0x44ccce[_0xb7e1('0x24')],'state':_0x190b0e,'nonce':_0x269990};redis[_0xb7e1('0x32')](_0x190b0e,JSON[_0xb7e1('0x20')](_0x44ccce));return _0x1b267b;}function isValidIdToken(_0x330b9c,_0x1c405e){try{var _0x546008=jwt[_0xb7e1('0x33')](_0x330b9c,{'complete':!![]});var _0x3411d8=_0x546008['payload'];if(_0x3411d8[_0xb7e1('0x34')]!==_0x1c405e[_0xb7e1('0x35')])return![];if(_0x3411d8[_0xb7e1('0x36')]!==_0x1c405e[_0xb7e1('0x37')])return![];if(_0x3411d8[_0xb7e1('0x2a')]!==_0x1c405e[_0xb7e1('0x2a')])return![];if(moment()[_0xb7e1('0x38')](moment[_0xb7e1('0x39')](_0x3411d8[_0xb7e1('0x3a')])))return![];return!![];}catch(_0x586166){throw _0x586166;}}function refreshOauth2MicrosoftAccessToken(_0x380647){return Promise[_0xb7e1('0x3b')]()[_0xb7e1('0x3c')](function(){if(_0x380647[_0xb7e1('0x3d')])return _0x380647;return db[_0xb7e1('0x3e')][_0xb7e1('0x3f')]({'where':{'id':_0x380647['id']},'raw':!![]});})[_0xb7e1('0x3c')](function(_0x407fb4){var _0x42d868={'grant_type':_0xb7e1('0x40'),'refresh_token':_0x407fb4[_0xb7e1('0x41')],'scope':getAccessTokenScope(_0x407fb4),'redirect_uri':_0x407fb4[_0xb7e1('0x26')],'client_id':_0x407fb4[_0xb7e1('0x24')],'client_secret':encryptor[_0xb7e1('0x42')](_0x407fb4[_0xb7e1('0x3d')])};var _0x464cb2={'method':_0xb7e1('0x43'),'uri':MICROSOFT_AUTH_URL[_0xb7e1('0x1b')]('{TENANT_ID}',_0x407fb4['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x42d868,'json':!![]};return rp(_0x464cb2);})[_0xb7e1('0x3c')](function(_0x1ad22e){_0x380647[_0xb7e1('0x44')]=_0x1ad22e[_0xb7e1('0x45')];_0x380647[_0xb7e1('0x41')]=_0x1ad22e[_0xb7e1('0x40')];return db[_0xb7e1('0x3e')][_0xb7e1('0x46')]({'data5':_0x380647[_0xb7e1('0x44')],'data6':_0x380647['data6']},{'where':{'id':_0x380647['id']}});})[_0xb7e1('0x3c')](function(){return _0x380647;})[_0xb7e1('0x47')](function(_0xe21849){logger[_0xb7e1('0x48')](_0xb7e1('0x49'),_0x380647['id'],_0xe21849);});}function getOauth2MicrosoftAccessToken(_0x2535c2,_0x2740b1){var _0x371b62={'grant_type':_0xb7e1('0x4a'),'code':_0x2535c2,'scope':getAccessTokenScope(_0x2740b1),'redirect_uri':_0x2740b1[_0xb7e1('0x26')],'client_id':_0x2740b1[_0xb7e1('0x24')],'client_secret':encryptor['decryptString'](_0x2740b1[_0xb7e1('0x3d')])};var _0x4b0a05={'method':_0xb7e1('0x43'),'uri':MICROSOFT_AUTH_URL['replace'](_0xb7e1('0x1c'),_0x2740b1['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x371b62,'json':!![]};return rp(_0x4b0a05);}function startRefreshInterval(_0x5917cb){var _0x5b877c=schedule[_0xb7e1('0x4b')];if(_0x5b877c[_0x5917cb['id']])clearInterval(_0x5b877c[_0x5917cb['id']]);_0x5b877c[_0x5917cb['id']]=setInterval(refreshOauth2MicrosoftAccessToken['bind'](this,{'id':_0x5917cb['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule['intervals']=_0x5b877c;}function startAllRefreshIntervals(){return db[_0xb7e1('0x3e')][_0xb7e1('0x4c')]({'where':{'data6':{'$ne':null}},'raw':!![]})['then'](function(_0x34f9bf){var _0x5c850f=_0x34f9bf['map'](function(_0x504a22){return refreshOauth2MicrosoftAccessToken(_0x504a22)[_0xb7e1('0x3c')](function(_0x5b3e1d){startRefreshInterval(_0x5b3e1d);});});return Promise[_0xb7e1('0x4d')](_0x5c850f);})[_0xb7e1('0x47')](function(_0x55e763){var _0x575250=_0x55e763?util[_0xb7e1('0x4e')](_0x55e763,{'showHidden':![],'depth':null}):'';logger[_0xb7e1('0x48')](_0xb7e1('0x4f'),_0x575250);});}module[_0xb7e1('0x50')]={'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 b6328fe..202f7a4 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 _0xb5fb=['request','info','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','CloudProvider,\x20%s,\x20%s','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x15c530,_0x489b22){var _0x3bd24f=function(_0x164499){while(--_0x164499){_0x15c530['push'](_0x15c530['shift']());}};_0x3bd24f(++_0x489b22);}(_0xb5fb,0x172));var _0xbb5f=function(_0x5905f7,_0x2261f6){_0x5905f7=_0x5905f7-0x0;var _0x18724f=_0xb5fb[_0x5905f7];return _0x18724f;};'use strict';var _=require(_0xbb5f('0x0'));var util=require(_0xbb5f('0x1'));var moment=require(_0xbb5f('0x2'));var BPromise=require(_0xbb5f('0x3'));var rs=require(_0xbb5f('0x4'));var fs=require('fs');var Redis=require(_0xbb5f('0x5'));var db=require(_0xbb5f('0x6'))['db'];var utils=require(_0xbb5f('0x7'));var logger=require(_0xbb5f('0x8'))(_0xbb5f('0x9'));var config=require(_0xbb5f('0xa'));var jayson=require(_0xbb5f('0xb'));var client=jayson[_0xbb5f('0xc')][_0xbb5f('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x487a1a,_0x597050,_0x317cd9){return new BPromise(function(_0x5e7943,_0x5b91){return client[_0xbb5f('0xe')](_0x487a1a,_0x317cd9)['then'](function(_0x4f13a9){logger[_0xbb5f('0xf')]('CloudProvider,\x20%s,\x20%s',_0x597050,_0xbb5f('0x10'));logger[_0xbb5f('0x11')](_0xbb5f('0x12'),_0x597050,_0xbb5f('0x10'),JSON[_0xbb5f('0x13')](_0x4f13a9));if(_0x4f13a9[_0xbb5f('0x14')]){if(_0x4f13a9[_0xbb5f('0x14')][_0xbb5f('0x15')]===0x1f4){logger['error'](_0xbb5f('0x16'),_0x597050,_0x4f13a9['error'][_0xbb5f('0x17')]);return _0x5b91(_0x4f13a9[_0xbb5f('0x14')][_0xbb5f('0x17')]);}logger['error'](_0xbb5f('0x16'),_0x597050,_0x4f13a9[_0xbb5f('0x14')]['message']);return _0x5e7943(_0x4f13a9[_0xbb5f('0x14')][_0xbb5f('0x17')]);}else{logger[_0xbb5f('0xf')](_0xbb5f('0x16'),_0x597050,'request\x20sent');_0x5e7943(_0x4f13a9['result'][_0xbb5f('0x17')]);}})['catch'](function(_0xdf4ec8){logger[_0xbb5f('0x14')]('CloudProvider,\x20%s,\x20%s',_0x597050,_0xdf4ec8);_0x5b91(_0xdf4ec8);});});} \ No newline at end of file +var _0xa701=['rpc','../../config/environment','jayson/promise','request','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','util','moment','ioredis','../../config/logger'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xa701,0xd4));var _0x1a70=function(_0x4c4560,_0x56a797){_0x4c4560=_0x4c4560-0x0;var _0x313b56=_0xa701[_0x4c4560];return _0x313b56;};'use strict';var _=require('lodash');var util=require(_0x1a70('0x0'));var moment=require(_0x1a70('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1a70('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1a70('0x3'))(_0x1a70('0x4'));var config=require(_0x1a70('0x5'));var jayson=require(_0x1a70('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1c700b,_0x191a56,_0x1e5432){return new BPromise(function(_0x85bfd0,_0x1dd89b){return client[_0x1a70('0x7')](_0x1c700b,_0x1e5432)[_0x1a70('0x8')](function(_0x55b5e2){logger[_0x1a70('0x9')](_0x1a70('0xa'),_0x191a56,_0x1a70('0xb'));logger[_0x1a70('0xc')]('CloudProvider,\x20%s,\x20%s,\x20%s',_0x191a56,_0x1a70('0xb'),JSON[_0x1a70('0xd')](_0x55b5e2));if(_0x55b5e2[_0x1a70('0xe')]){if(_0x55b5e2['error']['code']===0x1f4){logger[_0x1a70('0xe')]('CloudProvider,\x20%s,\x20%s',_0x191a56,_0x55b5e2[_0x1a70('0xe')]['message']);return _0x1dd89b(_0x55b5e2[_0x1a70('0xe')]['message']);}logger[_0x1a70('0xe')]('CloudProvider,\x20%s,\x20%s',_0x191a56,_0x55b5e2[_0x1a70('0xe')][_0x1a70('0xf')]);return _0x85bfd0(_0x55b5e2[_0x1a70('0xe')][_0x1a70('0xf')]);}else{logger[_0x1a70('0x9')]('CloudProvider,\x20%s,\x20%s',_0x191a56,'request\x20sent');_0x85bfd0(_0x55b5e2[_0x1a70('0x10')]['message']);}})[_0x1a70('0x11')](function(_0x3d8745){logger['error'](_0x1a70('0xa'),_0x191a56,_0x3d8745);_0x1dd89b(_0x3d8745);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 5a6e725..250e28e 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 _0x5f66=['index','post','/:id','update','delete','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','oauth2MicrosoftCallback','Router','./cloudProvider.controller','get','isAuthenticated'];(function(_0x362743,_0x4f4b49){var _0x27047f=function(_0x54ef8e){while(--_0x54ef8e){_0x362743['push'](_0x362743['shift']());}};_0x27047f(++_0x4f4b49);}(_0x5f66,0x1a0));var _0x65f6=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x5f66[_0x465028];return _0xb783d4;};'use strict';var express=require('express');var router=express[_0x65f6('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x65f6('0x1'));router[_0x65f6('0x2')]('/',auth[_0x65f6('0x3')](),controller[_0x65f6('0x4')]);router[_0x65f6('0x2')]('/:id',auth[_0x65f6('0x3')](),controller['show']);router[_0x65f6('0x5')]('/',auth[_0x65f6('0x3')](),controller['create']);router['put'](_0x65f6('0x6'),auth[_0x65f6('0x3')](),controller[_0x65f6('0x7')]);router[_0x65f6('0x8')](_0x65f6('0x6'),auth[_0x65f6('0x3')](),controller['destroy']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x3')](),controller[_0x65f6('0xa')]);router[_0x65f6('0x5')]('/oauth2/microsoft/callback',controller[_0x65f6('0xb')]);module['exports']=router; \ No newline at end of file +var _0x7a54=['isAuthenticated','/:id','show','post','create','delete','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','oauth2MicrosoftCallback','exports','express','Router','../../components/auth/service','get'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x7a54,0x106));var _0x47a5=function(_0x3e97dc,_0x1149f5){_0x3e97dc=_0x3e97dc-0x0;var _0xa601db=_0x7a54[_0x3e97dc];return _0xa601db;};'use strict';var express=require(_0x47a5('0x0'));var router=express[_0x47a5('0x1')]();var auth=require(_0x47a5('0x2'));var controller=require('./cloudProvider.controller');router[_0x47a5('0x3')]('/',auth[_0x47a5('0x4')](),controller['index']);router[_0x47a5('0x3')](_0x47a5('0x5'),auth[_0x47a5('0x4')](),controller[_0x47a5('0x6')]);router[_0x47a5('0x7')]('/',auth['isAuthenticated'](),controller[_0x47a5('0x8')]);router['put'](_0x47a5('0x5'),auth[_0x47a5('0x4')](),controller['update']);router[_0x47a5('0x9')]('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0x47a5('0x3')](_0x47a5('0xa'),auth['isAuthenticated'](),controller[_0x47a5('0xb')]);router['post']('/oauth2/microsoft/callback',controller[_0x47a5('0xc')]);module[_0x47a5('0xd')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 135e64e..d185cdf 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 _0x1948=['sequelize','STRING'];(function(_0x45875a,_0x2645c9){var _0x16da59=function(_0x29fa56){while(--_0x29fa56){_0x45875a['push'](_0x45875a['shift']());}};_0x16da59(++_0x2645c9);}(_0x1948,0x1b4));var _0x8194=function(_0x130308,_0x4d4478){_0x130308=_0x130308-0x0;var _0x1a728d=_0x1948[_0x130308];return _0x1a728d;};'use strict';var Sequelize=require(_0x8194('0x0'));module['exports']={'name':{'type':Sequelize[_0x8194('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x8194('0x1')]},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0x8194('0x1')]},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x8194('0x1')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x8194('0x1')]},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x8194('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x8194('0x1')]},'sStreet':{'type':Sequelize[_0x8194('0x1')]},'sPostalCode':{'type':Sequelize[_0x8194('0x1')]},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x8194('0x1')]}}; \ No newline at end of file +var _0x673e=['exports','name','STRING'];(function(_0x1d83e7,_0x36adda){var _0x3cd567=function(_0x2b6cfe){while(--_0x2b6cfe){_0x1d83e7['push'](_0x1d83e7['shift']());}};_0x3cd567(++_0x36adda);}(_0x673e,0x1c8));var _0xe673=function(_0x16c084,_0x9cd758){_0x16c084=_0x16c084-0x0;var _0x435b66=_0x673e[_0x16c084];return _0x435b66;};'use strict';var Sequelize=require('sequelize');module[_0xe673('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xe673('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xe673('0x2')]},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0xe673('0x2')]},'phone':{'type':Sequelize[_0xe673('0x2')]},'fax':{'type':Sequelize[_0xe673('0x2')]},'type':{'type':Sequelize[_0xe673('0x2')]},'street':{'type':Sequelize[_0xe673('0x2')]},'postalCode':{'type':Sequelize[_0xe673('0x2')]},'city':{'type':Sequelize[_0xe673('0x2')]},'country':{'type':Sequelize[_0xe673('0x2')]},'email':{'type':Sequelize[_0xe673('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xe673('0x2')]},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize[_0xe673('0x2')]},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize[_0xe673('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index a0777a4..7363628 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 _0x9f57=['query','attributes','fields','length','nolimit','order','sort','where','pick','merge','filter','options','CmCompany','include','findAll','rows','catch','show','params','rawAttributes','includeAll','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addContacts','ids','omit','getContacts','CmContact','map','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','Companies','error','stack','name','index','describe','keys','filters','intersection','model'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x9f57,0x7b));var _0x79f5=function(_0x3e6058,_0xc27036){_0x3e6058=_0x3e6058-0x0;var _0x3b21ad=_0x9f57[_0x3e6058];return _0x3b21ad;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x79f5('0x0'));var zipdir=require(_0x79f5('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x79f5('0x2'));var moment=require('moment');var BPromise=require(_0x79f5('0x3'));var Mustache=require(_0x79f5('0x4'));var util=require('util');var path=require(_0x79f5('0x5'));var sox=require(_0x79f5('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x79f5('0x7'));var squel=require(_0x79f5('0x8'));var crypto=require(_0x79f5('0x9'));var jsforce=require(_0x79f5('0xa'));var deskjs=require(_0x79f5('0xb'));var toCsv=require(_0x79f5('0xc'));var querystring=require(_0x79f5('0xd'));var Papa=require(_0x79f5('0xe'));var Redis=require(_0x79f5('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x79f5('0x10'));var hardwareService=require(_0x79f5('0x11'));var logger=require(_0x79f5('0x12'))(_0x79f5('0x13'));var utils=require('../../config/utils');var config=require(_0x79f5('0x14'));var licenseUtil=require(_0x79f5('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3ac636,_0x24686b){_0x24686b=_0x24686b||0xcc;return function(_0x3a86c6){if(_0x3a86c6){return _0x3ac636[_0x79f5('0x16')](_0x24686b);}return _0x3ac636[_0x79f5('0x17')](_0x24686b)[_0x79f5('0x18')]();};}function respondWithResult(_0x28eb6b,_0x3c1645){_0x3c1645=_0x3c1645||0xc8;return function(_0x1ce988){if(_0x1ce988){return _0x28eb6b[_0x79f5('0x17')](_0x3c1645)[_0x79f5('0x19')](_0x1ce988);}};}function respondWithFilteredResult(_0xe71172,_0x190561){return function(_0x145f83){if(_0x145f83){var _0x3b55d9=typeof _0x190561[_0x79f5('0x1a')]===_0x79f5('0x1b')&&typeof _0x190561[_0x79f5('0x1c')]===_0x79f5('0x1b');var _0x447a05=_0x145f83[_0x79f5('0x1d')];var _0x2fbcbf=_0x3b55d9?0x0:_0x190561[_0x79f5('0x1a')];var _0x3b0ed6=_0x3b55d9?_0x145f83[_0x79f5('0x1d')]:_0x190561['offset']+_0x190561[_0x79f5('0x1c')];var _0x1b73e3;if(_0x3b0ed6>=_0x447a05){_0x3b0ed6=_0x447a05;_0x1b73e3=0xc8;}else{_0x1b73e3=0xce;}_0xe71172[_0x79f5('0x17')](_0x1b73e3);return _0xe71172[_0x79f5('0x1e')](_0x79f5('0x1f'),_0x2fbcbf+'-'+_0x3b0ed6+'/'+_0x447a05)['json'](_0x145f83);}return null;};}function patchUpdates(_0x359ef4){return function(_0xd81731){try{jsonpatch[_0x79f5('0x20')](_0xd81731,_0x359ef4,!![]);}catch(_0x2ee8bd){return BPromise['reject'](_0x2ee8bd);}return _0xd81731[_0x79f5('0x21')]();};}function saveUpdates(_0x292d40,_0x38fef5){return function(_0x945d1a){if(_0x945d1a){return _0x945d1a[_0x79f5('0x22')](_0x292d40)[_0x79f5('0x23')](function(_0x69b8f9){return _0x69b8f9;});}return null;};}function removeEntity(_0x36cd42,_0x392203){return function(_0x333e69){if(_0x333e69){return _0x333e69[_0x79f5('0x24')]()[_0x79f5('0x23')](function(){var _0x42a0b5=_0x333e69['get']({'plain':!![]});var _0x348622=_0x79f5('0x25');return db['UserProfileResource'][_0x79f5('0x24')]({'where':{'type':_0x348622,'resourceId':_0x42a0b5['id']}})['then'](function(){return _0x333e69;});})['then'](function(){_0x36cd42[_0x79f5('0x17')](0xcc)[_0x79f5('0x18')]();});}};}function handleEntityNotFound(_0x4c32b0,_0x21b878){return function(_0x295fd6){if(!_0x295fd6){_0x4c32b0[_0x79f5('0x16')](0x194);}return _0x295fd6;};}function handleError(_0x3a7b54,_0x372f48){_0x372f48=_0x372f48||0x1f4;return function(_0x5d7479){logger[_0x79f5('0x26')](_0x5d7479[_0x79f5('0x27')]);if(_0x5d7479[_0x79f5('0x28')]){delete _0x5d7479[_0x79f5('0x28')];}_0x3a7b54[_0x79f5('0x17')](_0x372f48)['send'](_0x5d7479);};}exports[_0x79f5('0x29')]=function(_0x112e29,_0x100bfe){var _0x28cca4={},_0x4d7f45={},_0x10df3b={'count':0x0,'rows':[]};return db['CmCompany'][_0x79f5('0x2a')]()[_0x79f5('0x23')](function(_0x1e929b){_0x4d7f45['model']=_[_0x79f5('0x2b')](_0x1e929b);_0x4d7f45['query']=_[_0x79f5('0x2b')](_0x112e29['query']);_0x4d7f45[_0x79f5('0x2c')]=_[_0x79f5('0x2d')](_0x4d7f45[_0x79f5('0x2e')],_0x4d7f45[_0x79f5('0x2f')]);_0x28cca4[_0x79f5('0x30')]=_[_0x79f5('0x2d')](_0x4d7f45[_0x79f5('0x2e')],qs[_0x79f5('0x31')](_0x112e29[_0x79f5('0x2f')][_0x79f5('0x31')]));_0x28cca4[_0x79f5('0x30')]=_0x28cca4['attributes'][_0x79f5('0x32')]?_0x28cca4[_0x79f5('0x30')]:_0x4d7f45[_0x79f5('0x2e')];if(!_0x112e29['query']['hasOwnProperty'](_0x79f5('0x33'))){_0x28cca4[_0x79f5('0x1c')]=qs['limit'](_0x112e29[_0x79f5('0x2f')][_0x79f5('0x1c')]);_0x28cca4['offset']=qs[_0x79f5('0x1a')](_0x112e29[_0x79f5('0x2f')][_0x79f5('0x1a')]);}_0x28cca4[_0x79f5('0x34')]=qs[_0x79f5('0x35')](_0x112e29[_0x79f5('0x2f')][_0x79f5('0x35')]);_0x28cca4[_0x79f5('0x36')]=qs[_0x79f5('0x2c')](_[_0x79f5('0x37')](_0x112e29['query'],_0x4d7f45[_0x79f5('0x2c')]),_0x1e929b);if(_0x112e29['query']['filter']){_0x28cca4['where']=_[_0x79f5('0x38')](_0x28cca4[_0x79f5('0x36')],{'$or':_['map'](_0x28cca4[_0x79f5('0x30')],function(_0x5d9053){var _0x3f76b8={};_0x3f76b8[_0x5d9053]={'$like':'%'+_0x112e29['query'][_0x79f5('0x39')]+'%'};return _0x3f76b8;})});}_0x28cca4=_[_0x79f5('0x38')]({},_0x28cca4,_0x112e29[_0x79f5('0x3a')]);var _0x3727b0={'where':_0x28cca4[_0x79f5('0x36')]};return db[_0x79f5('0x3b')]['count'](_0x3727b0)[_0x79f5('0x23')](function(_0x4ffe14){_0x10df3b[_0x79f5('0x1d')]=_0x4ffe14;if(_0x112e29[_0x79f5('0x2f')]['includeAll']){_0x28cca4[_0x79f5('0x3c')]=[{'all':!![]}];}return db[_0x79f5('0x3b')][_0x79f5('0x3d')](_0x28cca4);})[_0x79f5('0x23')](function(_0x292250){_0x10df3b[_0x79f5('0x3e')]=_0x292250;return _0x10df3b;})[_0x79f5('0x23')](respondWithFilteredResult(_0x100bfe,_0x28cca4))[_0x79f5('0x3f')](handleError(_0x100bfe,null));})['catch'](handleError(_0x100bfe,null));};exports[_0x79f5('0x40')]=function(_0x205eba,_0x519cac){var _0x60556={'raw':![],'where':{'id':_0x205eba[_0x79f5('0x41')]['id']}},_0x13ac09={};_0x13ac09[_0x79f5('0x2e')]=_[_0x79f5('0x2b')](db[_0x79f5('0x3b')][_0x79f5('0x42')]);_0x13ac09['query']=_['keys'](_0x205eba[_0x79f5('0x2f')]);_0x13ac09[_0x79f5('0x2c')]=_[_0x79f5('0x2d')](_0x13ac09[_0x79f5('0x2e')],_0x13ac09[_0x79f5('0x2f')]);_0x60556[_0x79f5('0x30')]=_[_0x79f5('0x2d')](_0x13ac09['model'],qs[_0x79f5('0x31')](_0x205eba[_0x79f5('0x2f')][_0x79f5('0x31')]));_0x60556[_0x79f5('0x30')]=_0x60556['attributes']['length']?_0x60556['attributes']:_0x13ac09['model'];if(_0x205eba[_0x79f5('0x2f')][_0x79f5('0x43')]){_0x60556[_0x79f5('0x3c')]=[{'all':!![]}];}_0x60556=_[_0x79f5('0x38')]({},_0x60556,_0x205eba[_0x79f5('0x3a')]);return db[_0x79f5('0x3b')][_0x79f5('0x44')](_0x60556)['then'](handleEntityNotFound(_0x519cac,null))[_0x79f5('0x23')](respondWithResult(_0x519cac,null))[_0x79f5('0x3f')](handleError(_0x519cac,null));};exports[_0x79f5('0x45')]=function(_0xc07226,_0x445516){return db[_0x79f5('0x3b')][_0x79f5('0x45')](_0xc07226[_0x79f5('0x46')],{})[_0x79f5('0x23')](function(_0x442511){var _0x3c74bb=_0xc07226[_0x79f5('0x47')][_0x79f5('0x48')]({'plain':!![]});if(!_0x3c74bb)throw new Error(_0x79f5('0x49'));if(_0x3c74bb['role']===_0x79f5('0x47')){var _0x226dc0=_0x442511['get']({'plain':!![]});var _0x5251b1=_0x79f5('0x25');return db[_0x79f5('0x4a')][_0x79f5('0x44')]({'where':{'name':_0x5251b1,'userProfileId':_0x3c74bb[_0x79f5('0x4b')]},'raw':!![]})[_0x79f5('0x23')](function(_0x33b5b3){if(_0x33b5b3&&_0x33b5b3[_0x79f5('0x4c')]===0x0){return db[_0x79f5('0x4d')]['create']({'name':_0x226dc0[_0x79f5('0x28')],'resourceId':_0x226dc0['id'],'type':_0x33b5b3[_0x79f5('0x28')],'sectionId':_0x33b5b3['id']},{})[_0x79f5('0x23')](function(){return _0x442511;});}else{return _0x442511;}})[_0x79f5('0x3f')](function(_0x41c30e){logger['error'](_0x79f5('0x4e'),_0x41c30e);throw _0x41c30e;});}return _0x442511;})[_0x79f5('0x23')](respondWithResult(_0x445516,0xc9))['catch'](handleError(_0x445516,null));};exports['update']=function(_0x3a4825,_0x3bf655){if(_0x3a4825['body']['id']){delete _0x3a4825[_0x79f5('0x46')]['id'];}return db['CmCompany']['find']({'where':{'id':_0x3a4825['params']['id']}})[_0x79f5('0x23')](handleEntityNotFound(_0x3bf655,null))[_0x79f5('0x23')](saveUpdates(_0x3a4825[_0x79f5('0x46')],null))[_0x79f5('0x23')](respondWithResult(_0x3bf655,null))[_0x79f5('0x3f')](handleError(_0x3bf655,null));};exports[_0x79f5('0x24')]=function(_0x1455b3,_0x31c3cf){return db[_0x79f5('0x3b')][_0x79f5('0x44')]({'where':{'id':_0x1455b3['params']['id']}})[_0x79f5('0x23')](handleEntityNotFound(_0x31c3cf,null))[_0x79f5('0x23')](removeEntity(_0x31c3cf,null))['catch'](handleError(_0x31c3cf,null));};exports[_0x79f5('0x2a')]=function(_0x1306fd,_0x35e8ce){return db[_0x79f5('0x3b')][_0x79f5('0x2a')]()[_0x79f5('0x23')](respondWithResult(_0x35e8ce,null))[_0x79f5('0x3f')](handleError(_0x35e8ce,null));};exports[_0x79f5('0x4f')]=function(_0x23cff5,_0x3c858c,_0x6b915f){return db['CmContact'][_0x79f5('0x44')]({'where':{'id':_0x23cff5['params']['id']}})['then'](handleEntityNotFound(_0x3c858c,null))[_0x79f5('0x23')](function(_0x5f4c53){if(_0x5f4c53){return _0x5f4c53[_0x79f5('0x4f')](_0x23cff5['body'][_0x79f5('0x50')],_[_0x79f5('0x51')](_0x23cff5[_0x79f5('0x46')],['ids','id'])||{});}})[_0x79f5('0x23')](respondWithResult(_0x3c858c,null))['catch'](handleError(_0x3c858c,null));};exports[_0x79f5('0x52')]=function(_0x290c21,_0x30c1dd,_0x3b77fd){var _0x1d97bc={};var _0x3b36fe={};var _0x1785fe;var _0x333db7;return db[_0x79f5('0x3b')]['findOne']({'where':{'id':_0x290c21['params']['id']}})[_0x79f5('0x23')](handleEntityNotFound(_0x30c1dd,null))[_0x79f5('0x23')](function(_0x400570){if(_0x400570){_0x1785fe=_0x400570;_0x3b36fe['model']=_['keys'](db[_0x79f5('0x53')][_0x79f5('0x42')]);_0x3b36fe['query']=_[_0x79f5('0x2b')](_0x290c21[_0x79f5('0x2f')]);_0x3b36fe[_0x79f5('0x2c')]=_[_0x79f5('0x2d')](_0x3b36fe[_0x79f5('0x2e')],_0x3b36fe['query']);_0x1d97bc[_0x79f5('0x30')]=_[_0x79f5('0x2d')](_0x3b36fe['model'],qs['fields'](_0x290c21[_0x79f5('0x2f')][_0x79f5('0x31')]));_0x1d97bc[_0x79f5('0x30')]=_0x1d97bc[_0x79f5('0x30')][_0x79f5('0x32')]?_0x1d97bc[_0x79f5('0x30')]:_0x3b36fe['model'];_0x1d97bc[_0x79f5('0x34')]=qs[_0x79f5('0x35')](_0x290c21['query'][_0x79f5('0x35')]);_0x1d97bc[_0x79f5('0x36')]=qs['filters'](_[_0x79f5('0x37')](_0x290c21[_0x79f5('0x2f')],_0x3b36fe[_0x79f5('0x2c')]));if(_0x290c21[_0x79f5('0x2f')]['filter']){_0x1d97bc['where']=_['merge'](_0x1d97bc[_0x79f5('0x36')],{'$or':_[_0x79f5('0x54')](_0x1d97bc[_0x79f5('0x30')],function(_0x501c3a){var _0x546bc1={};_0x546bc1[_0x501c3a]={'$like':'%'+_0x290c21['query'][_0x79f5('0x39')]+'%'};return _0x546bc1;})});}_0x1d97bc=_[_0x79f5('0x38')]({},_0x1d97bc,_0x290c21['options']);return _0x1785fe[_0x79f5('0x52')](_0x1d97bc);}})[_0x79f5('0x23')](function(_0x5aaaa2){if(_0x5aaaa2){_0x333db7=_0x5aaaa2[_0x79f5('0x32')];if(!_0x290c21['query']['hasOwnProperty'](_0x79f5('0x33'))){_0x1d97bc['limit']=qs[_0x79f5('0x1c')](_0x290c21['query'][_0x79f5('0x1c')]);_0x1d97bc[_0x79f5('0x1a')]=qs['offset'](_0x290c21[_0x79f5('0x2f')][_0x79f5('0x1a')]);}return _0x1785fe[_0x79f5('0x52')](_0x1d97bc);}})[_0x79f5('0x23')](function(_0x5ad320){if(_0x5ad320){return _0x5ad320?{'count':_0x333db7,'rows':_0x5ad320}:null;}})['then'](respondWithResult(_0x30c1dd,null))[_0x79f5('0x3f')](handleError(_0x30c1dd,null));}; \ No newline at end of file +var _0xae34=['CmContact','ids','omit','getContacts','rawAttributes','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','update','then','Companies','destroy','error','name','send','index','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','includeAll','include','CmCompany','findAll','catch','show','params','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addContacts'];(function(_0x1109e8,_0xc364e7){var _0x1a217f=function(_0x3f2563){while(--_0x3f2563){_0x1109e8['push'](_0x1109e8['shift']());}};_0x1a217f(++_0xc364e7);}(_0xae34,0x104));var _0x4ae3=function(_0x2688cf,_0x5dfc42){_0x2688cf=_0x2688cf-0x0;var _0x441144=_0xae34[_0x2688cf];return _0x441144;};'use strict';var emlformat=require(_0x4ae3('0x0'));var rimraf=require(_0x4ae3('0x1'));var zipdir=require(_0x4ae3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4ae3('0x3'));var moment=require(_0x4ae3('0x4'));var BPromise=require(_0x4ae3('0x5'));var Mustache=require(_0x4ae3('0x6'));var util=require(_0x4ae3('0x7'));var path=require(_0x4ae3('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4ae3('0x9'));var fs=require('fs');var fs_extra=require(_0x4ae3('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4ae3('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4ae3('0xc'));var Redis=require(_0x4ae3('0xd'));var authService=require(_0x4ae3('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x4ae3('0xf'));var hardwareService=require(_0x4ae3('0x10'));var logger=require('../../config/logger')(_0x4ae3('0x11'));var utils=require(_0x4ae3('0x12'));var config=require(_0x4ae3('0x13'));var licenseUtil=require(_0x4ae3('0x14'));var db=require(_0x4ae3('0x15'))['db'];function respondWithStatusCode(_0x34429e,_0x24183b){_0x24183b=_0x24183b||0xcc;return function(_0x4bc4be){if(_0x4bc4be){return _0x34429e[_0x4ae3('0x16')](_0x24183b);}return _0x34429e['status'](_0x24183b)[_0x4ae3('0x17')]();};}function respondWithResult(_0xf348d4,_0x132dce){_0x132dce=_0x132dce||0xc8;return function(_0x28e9fd){if(_0x28e9fd){return _0xf348d4[_0x4ae3('0x18')](_0x132dce)[_0x4ae3('0x19')](_0x28e9fd);}};}function respondWithFilteredResult(_0x120e2b,_0x478836){return function(_0x413394){if(_0x413394){var _0x512138=typeof _0x478836[_0x4ae3('0x1a')]==='undefined'&&typeof _0x478836[_0x4ae3('0x1b')]===_0x4ae3('0x1c');var _0x311b6a=_0x413394[_0x4ae3('0x1d')];var _0x1e5d70=_0x512138?0x0:_0x478836['offset'];var _0x2eb6dc=_0x512138?_0x413394['count']:_0x478836[_0x4ae3('0x1a')]+_0x478836[_0x4ae3('0x1b')];var _0x593c3f;if(_0x2eb6dc>=_0x311b6a){_0x2eb6dc=_0x311b6a;_0x593c3f=0xc8;}else{_0x593c3f=0xce;}_0x120e2b[_0x4ae3('0x18')](_0x593c3f);return _0x120e2b[_0x4ae3('0x1e')](_0x4ae3('0x1f'),_0x1e5d70+'-'+_0x2eb6dc+'/'+_0x311b6a)[_0x4ae3('0x19')](_0x413394);}return null;};}function patchUpdates(_0xdb8179){return function(_0x5bdbb3){try{jsonpatch[_0x4ae3('0x20')](_0x5bdbb3,_0xdb8179,!![]);}catch(_0xe3e3de){return BPromise['reject'](_0xe3e3de);}return _0x5bdbb3['save']();};}function saveUpdates(_0x55c4e1,_0x30a55f){return function(_0x410a82){if(_0x410a82){return _0x410a82[_0x4ae3('0x21')](_0x55c4e1)['then'](function(_0x349302){return _0x349302;});}return null;};}function removeEntity(_0x32e0a1,_0x367c2e){return function(_0x2a39a8){if(_0x2a39a8){return _0x2a39a8['destroy']()[_0x4ae3('0x22')](function(){var _0x3b6afc=_0x2a39a8['get']({'plain':!![]});var _0x1662a8=_0x4ae3('0x23');return db['UserProfileResource'][_0x4ae3('0x24')]({'where':{'type':_0x1662a8,'resourceId':_0x3b6afc['id']}})[_0x4ae3('0x22')](function(){return _0x2a39a8;});})[_0x4ae3('0x22')](function(){_0x32e0a1[_0x4ae3('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f1f06,_0x5331eb){return function(_0x202b9a){if(!_0x202b9a){_0x4f1f06[_0x4ae3('0x16')](0x194);}return _0x202b9a;};}function handleError(_0x5c5a18,_0x3b0bb5){_0x3b0bb5=_0x3b0bb5||0x1f4;return function(_0x46c835){logger[_0x4ae3('0x25')](_0x46c835['stack']);if(_0x46c835[_0x4ae3('0x26')]){delete _0x46c835[_0x4ae3('0x26')];}_0x5c5a18[_0x4ae3('0x18')](_0x3b0bb5)[_0x4ae3('0x27')](_0x46c835);};}exports[_0x4ae3('0x28')]=function(_0x3e6b3f,_0x4c5e47){var _0x23ba17={},_0x5cf6a6={},_0x998fbf={'count':0x0,'rows':[]};return db['CmCompany']['describe']()['then'](function(_0x6f9421){_0x5cf6a6[_0x4ae3('0x29')]=_[_0x4ae3('0x2a')](_0x6f9421);_0x5cf6a6[_0x4ae3('0x2b')]=_['keys'](_0x3e6b3f[_0x4ae3('0x2b')]);_0x5cf6a6[_0x4ae3('0x2c')]=_[_0x4ae3('0x2d')](_0x5cf6a6[_0x4ae3('0x29')],_0x5cf6a6['query']);_0x23ba17[_0x4ae3('0x2e')]=_[_0x4ae3('0x2d')](_0x5cf6a6[_0x4ae3('0x29')],qs[_0x4ae3('0x2f')](_0x3e6b3f[_0x4ae3('0x2b')][_0x4ae3('0x2f')]));_0x23ba17[_0x4ae3('0x2e')]=_0x23ba17[_0x4ae3('0x2e')][_0x4ae3('0x30')]?_0x23ba17[_0x4ae3('0x2e')]:_0x5cf6a6[_0x4ae3('0x29')];if(!_0x3e6b3f[_0x4ae3('0x2b')][_0x4ae3('0x31')](_0x4ae3('0x32'))){_0x23ba17[_0x4ae3('0x1b')]=qs['limit'](_0x3e6b3f[_0x4ae3('0x2b')][_0x4ae3('0x1b')]);_0x23ba17[_0x4ae3('0x1a')]=qs[_0x4ae3('0x1a')](_0x3e6b3f[_0x4ae3('0x2b')][_0x4ae3('0x1a')]);}_0x23ba17[_0x4ae3('0x33')]=qs['sort'](_0x3e6b3f[_0x4ae3('0x2b')][_0x4ae3('0x34')]);_0x23ba17[_0x4ae3('0x35')]=qs[_0x4ae3('0x2c')](_[_0x4ae3('0x36')](_0x3e6b3f[_0x4ae3('0x2b')],_0x5cf6a6[_0x4ae3('0x2c')]),_0x6f9421);if(_0x3e6b3f[_0x4ae3('0x2b')][_0x4ae3('0x37')]){_0x23ba17[_0x4ae3('0x35')]=_[_0x4ae3('0x38')](_0x23ba17[_0x4ae3('0x35')],{'$or':_[_0x4ae3('0x39')](_0x23ba17['attributes'],function(_0x39c82f){var _0x4ac8ca={};_0x4ac8ca[_0x39c82f]={'$like':'%'+_0x3e6b3f[_0x4ae3('0x2b')][_0x4ae3('0x37')]+'%'};return _0x4ac8ca;})});}_0x23ba17=_[_0x4ae3('0x38')]({},_0x23ba17,_0x3e6b3f['options']);var _0x2a9657={'where':_0x23ba17[_0x4ae3('0x35')]};return db['CmCompany'][_0x4ae3('0x1d')](_0x2a9657)[_0x4ae3('0x22')](function(_0x2e65b8){_0x998fbf[_0x4ae3('0x1d')]=_0x2e65b8;if(_0x3e6b3f[_0x4ae3('0x2b')][_0x4ae3('0x3a')]){_0x23ba17[_0x4ae3('0x3b')]=[{'all':!![]}];}return db[_0x4ae3('0x3c')][_0x4ae3('0x3d')](_0x23ba17);})[_0x4ae3('0x22')](function(_0x373f19){_0x998fbf['rows']=_0x373f19;return _0x998fbf;})[_0x4ae3('0x22')](respondWithFilteredResult(_0x4c5e47,_0x23ba17))[_0x4ae3('0x3e')](handleError(_0x4c5e47,null));})[_0x4ae3('0x3e')](handleError(_0x4c5e47,null));};exports[_0x4ae3('0x3f')]=function(_0x4446f7,_0x2851db){var _0x15dc50={'raw':![],'where':{'id':_0x4446f7[_0x4ae3('0x40')]['id']}},_0x5b6553={};_0x5b6553[_0x4ae3('0x29')]=_[_0x4ae3('0x2a')](db['CmCompany']['rawAttributes']);_0x5b6553[_0x4ae3('0x2b')]=_[_0x4ae3('0x2a')](_0x4446f7[_0x4ae3('0x2b')]);_0x5b6553[_0x4ae3('0x2c')]=_[_0x4ae3('0x2d')](_0x5b6553[_0x4ae3('0x29')],_0x5b6553[_0x4ae3('0x2b')]);_0x15dc50['attributes']=_[_0x4ae3('0x2d')](_0x5b6553[_0x4ae3('0x29')],qs['fields'](_0x4446f7[_0x4ae3('0x2b')][_0x4ae3('0x2f')]));_0x15dc50[_0x4ae3('0x2e')]=_0x15dc50[_0x4ae3('0x2e')][_0x4ae3('0x30')]?_0x15dc50[_0x4ae3('0x2e')]:_0x5b6553['model'];if(_0x4446f7[_0x4ae3('0x2b')][_0x4ae3('0x3a')]){_0x15dc50[_0x4ae3('0x3b')]=[{'all':!![]}];}_0x15dc50=_[_0x4ae3('0x38')]({},_0x15dc50,_0x4446f7[_0x4ae3('0x41')]);return db[_0x4ae3('0x3c')][_0x4ae3('0x42')](_0x15dc50)[_0x4ae3('0x22')](handleEntityNotFound(_0x2851db,null))['then'](respondWithResult(_0x2851db,null))[_0x4ae3('0x3e')](handleError(_0x2851db,null));};exports['create']=function(_0x1e8c4a,_0x36e44b){return db[_0x4ae3('0x3c')][_0x4ae3('0x43')](_0x1e8c4a['body'],{})[_0x4ae3('0x22')](function(_0x20b01b){var _0x224f69=_0x1e8c4a[_0x4ae3('0x44')]['get']({'plain':!![]});if(!_0x224f69)throw new Error(_0x4ae3('0x45'));if(_0x224f69[_0x4ae3('0x46')]===_0x4ae3('0x44')){var _0x19259e=_0x20b01b[_0x4ae3('0x47')]({'plain':!![]});var _0x5f3914='Companies';return db[_0x4ae3('0x48')][_0x4ae3('0x42')]({'where':{'name':_0x5f3914,'userProfileId':_0x224f69[_0x4ae3('0x49')]},'raw':!![]})[_0x4ae3('0x22')](function(_0x291b16){if(_0x291b16&&_0x291b16[_0x4ae3('0x4a')]===0x0){return db[_0x4ae3('0x4b')][_0x4ae3('0x43')]({'name':_0x19259e['name'],'resourceId':_0x19259e['id'],'type':_0x291b16[_0x4ae3('0x26')],'sectionId':_0x291b16['id']},{})[_0x4ae3('0x22')](function(){return _0x20b01b;});}else{return _0x20b01b;}})[_0x4ae3('0x3e')](function(_0x44f7c1){logger[_0x4ae3('0x25')](_0x4ae3('0x4c'),_0x44f7c1);throw _0x44f7c1;});}return _0x20b01b;})[_0x4ae3('0x22')](respondWithResult(_0x36e44b,0xc9))[_0x4ae3('0x3e')](handleError(_0x36e44b,null));};exports['update']=function(_0x2aab4a,_0x2ed188){if(_0x2aab4a[_0x4ae3('0x4d')]['id']){delete _0x2aab4a['body']['id'];}return db[_0x4ae3('0x3c')][_0x4ae3('0x42')]({'where':{'id':_0x2aab4a[_0x4ae3('0x40')]['id']}})[_0x4ae3('0x22')](handleEntityNotFound(_0x2ed188,null))[_0x4ae3('0x22')](saveUpdates(_0x2aab4a[_0x4ae3('0x4d')],null))[_0x4ae3('0x22')](respondWithResult(_0x2ed188,null))['catch'](handleError(_0x2ed188,null));};exports['destroy']=function(_0x23ff58,_0x3a26e3){return db[_0x4ae3('0x3c')][_0x4ae3('0x42')]({'where':{'id':_0x23ff58[_0x4ae3('0x40')]['id']}})[_0x4ae3('0x22')](handleEntityNotFound(_0x3a26e3,null))[_0x4ae3('0x22')](removeEntity(_0x3a26e3,null))['catch'](handleError(_0x3a26e3,null));};exports[_0x4ae3('0x4e')]=function(_0x598c4e,_0x4a39a5){return db['CmCompany'][_0x4ae3('0x4e')]()[_0x4ae3('0x22')](respondWithResult(_0x4a39a5,null))[_0x4ae3('0x3e')](handleError(_0x4a39a5,null));};exports[_0x4ae3('0x4f')]=function(_0x483a91,_0x31e9b5,_0x54669b){return db[_0x4ae3('0x50')][_0x4ae3('0x42')]({'where':{'id':_0x483a91[_0x4ae3('0x40')]['id']}})['then'](handleEntityNotFound(_0x31e9b5,null))[_0x4ae3('0x22')](function(_0x2139e7){if(_0x2139e7){return _0x2139e7[_0x4ae3('0x4f')](_0x483a91[_0x4ae3('0x4d')][_0x4ae3('0x51')],_[_0x4ae3('0x52')](_0x483a91['body'],[_0x4ae3('0x51'),'id'])||{});}})[_0x4ae3('0x22')](respondWithResult(_0x31e9b5,null))[_0x4ae3('0x3e')](handleError(_0x31e9b5,null));};exports[_0x4ae3('0x53')]=function(_0x3e9714,_0x503e21,_0x40c903){var _0x4f0fdc={};var _0x356c14={};var _0x47f9e8;var _0x19d700;return db[_0x4ae3('0x3c')]['findOne']({'where':{'id':_0x3e9714[_0x4ae3('0x40')]['id']}})[_0x4ae3('0x22')](handleEntityNotFound(_0x503e21,null))['then'](function(_0x1748bd){if(_0x1748bd){_0x47f9e8=_0x1748bd;_0x356c14[_0x4ae3('0x29')]=_[_0x4ae3('0x2a')](db[_0x4ae3('0x50')][_0x4ae3('0x54')]);_0x356c14[_0x4ae3('0x2b')]=_[_0x4ae3('0x2a')](_0x3e9714[_0x4ae3('0x2b')]);_0x356c14[_0x4ae3('0x2c')]=_[_0x4ae3('0x2d')](_0x356c14[_0x4ae3('0x29')],_0x356c14[_0x4ae3('0x2b')]);_0x4f0fdc['attributes']=_[_0x4ae3('0x2d')](_0x356c14['model'],qs[_0x4ae3('0x2f')](_0x3e9714[_0x4ae3('0x2b')][_0x4ae3('0x2f')]));_0x4f0fdc[_0x4ae3('0x2e')]=_0x4f0fdc[_0x4ae3('0x2e')]['length']?_0x4f0fdc[_0x4ae3('0x2e')]:_0x356c14[_0x4ae3('0x29')];_0x4f0fdc[_0x4ae3('0x33')]=qs[_0x4ae3('0x34')](_0x3e9714[_0x4ae3('0x2b')][_0x4ae3('0x34')]);_0x4f0fdc[_0x4ae3('0x35')]=qs[_0x4ae3('0x2c')](_[_0x4ae3('0x36')](_0x3e9714['query'],_0x356c14['filters']));if(_0x3e9714['query'][_0x4ae3('0x37')]){_0x4f0fdc[_0x4ae3('0x35')]=_[_0x4ae3('0x38')](_0x4f0fdc[_0x4ae3('0x35')],{'$or':_[_0x4ae3('0x39')](_0x4f0fdc[_0x4ae3('0x2e')],function(_0x2cb2a3){var _0x524d00={};_0x524d00[_0x2cb2a3]={'$like':'%'+_0x3e9714[_0x4ae3('0x2b')][_0x4ae3('0x37')]+'%'};return _0x524d00;})});}_0x4f0fdc=_[_0x4ae3('0x38')]({},_0x4f0fdc,_0x3e9714[_0x4ae3('0x41')]);return _0x47f9e8[_0x4ae3('0x53')](_0x4f0fdc);}})[_0x4ae3('0x22')](function(_0x432645){if(_0x432645){_0x19d700=_0x432645['length'];if(!_0x3e9714[_0x4ae3('0x2b')]['hasOwnProperty'](_0x4ae3('0x32'))){_0x4f0fdc[_0x4ae3('0x1b')]=qs[_0x4ae3('0x1b')](_0x3e9714['query'][_0x4ae3('0x1b')]);_0x4f0fdc[_0x4ae3('0x1a')]=qs[_0x4ae3('0x1a')](_0x3e9714[_0x4ae3('0x2b')][_0x4ae3('0x1a')]);}return _0x47f9e8[_0x4ae3('0x53')](_0x4f0fdc);}})['then'](function(_0x2fee01){if(_0x2fee01){return _0x2fee01?{'count':_0x19d700,'rows':_0x2fee01}:null;}})[_0x4ae3('0x22')](respondWithResult(_0x503e21,null))[_0x4ae3('0x3e')](handleError(_0x503e21,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 40445d5..6f1e610 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 _0xb215=['./cmCompany.attributes','exports','define','CmCompany','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment'];(function(_0x1fe81b,_0x3cf73b){var _0xddc709=function(_0x36e5cd){while(--_0x36e5cd){_0x1fe81b['push'](_0x1fe81b['shift']());}};_0xddc709(++_0x3cf73b);}(_0xb215,0x159));var _0x5b21=function(_0x334be1,_0x567a25){_0x334be1=_0x334be1-0x0;var _0x3bc278=_0xb215[_0x334be1];return _0x3bc278;};'use strict';var _=require('lodash');var util=require(_0x5b21('0x0'));var logger=require(_0x5b21('0x1'))(_0x5b21('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5b21('0x3'));var fs=require('fs');var path=require(_0x5b21('0x4'));var rimraf=require(_0x5b21('0x5'));var config=require(_0x5b21('0x6'));var attributes=require(_0x5b21('0x7'));module[_0x5b21('0x8')]=function(_0x5c5cb5,_0x32ce2e){return _0x5c5cb5[_0x5b21('0x9')](_0x5b21('0xa'),attributes,{'tableName':'cm_companies','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf355=['api','moment','bluebird','request-promise','path','rimraf','./cmCompany.attributes','define','CmCompany','lodash'];(function(_0x1eafae,_0x581257){var _0x37cc60=function(_0x4b4aad){while(--_0x4b4aad){_0x1eafae['push'](_0x1eafae['shift']());}};_0x37cc60(++_0x581257);}(_0xf355,0x17b));var _0x5f35=function(_0x2411ea,_0x4e2188){_0x2411ea=_0x2411ea-0x0;var _0x4b9644=_0xf355[_0x2411ea];return _0x4b9644;};'use strict';var _=require(_0x5f35('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5f35('0x1'));var moment=require(_0x5f35('0x2'));var BPromise=require(_0x5f35('0x3'));var rp=require(_0x5f35('0x4'));var fs=require('fs');var path=require(_0x5f35('0x5'));var rimraf=require(_0x5f35('0x6'));var config=require('../../config/environment');var attributes=require(_0x5f35('0x7'));module['exports']=function(_0x2363c0,_0xbee771){return _0x2363c0[_0x5f35('0x8')](_0x5f35('0x9'),attributes,{'tableName':'cm_companies','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.rpc.js b/server/api/cmCompany/cmCompany.rpc.js index 0a61bd5..4c89e00 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 _0x0e5a=['CmCompany,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','then','info','CmCompany,\x20%s,\x20%s','debug'];(function(_0x201fe8,_0x5f3725){var _0x247260=function(_0x131362){while(--_0x131362){_0x201fe8['push'](_0x201fe8['shift']());}};_0x247260(++_0x5f3725);}(_0x0e5a,0x70));var _0xa0e5=function(_0x1eb2c3,_0x2dd707){_0x1eb2c3=_0x1eb2c3-0x0;var _0x4e749d=_0x0e5a[_0x1eb2c3];return _0x4e749d;};'use strict';var _=require(_0xa0e5('0x0'));var util=require(_0xa0e5('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa0e5('0x2'));var fs=require('fs');var Redis=require(_0xa0e5('0x3'));var db=require(_0xa0e5('0x4'))['db'];var utils=require(_0xa0e5('0x5'));var logger=require('../../config/logger')(_0xa0e5('0x6'));var config=require(_0xa0e5('0x7'));var jayson=require(_0xa0e5('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x282ff4,_0x43d41d,_0x1545c3){return new BPromise(function(_0x404c4f,_0x1b2e57){return client[_0xa0e5('0x9')](_0x282ff4,_0x1545c3)[_0xa0e5('0xa')](function(_0x39fe38){logger[_0xa0e5('0xb')](_0xa0e5('0xc'),_0x43d41d,'request\x20sent');logger[_0xa0e5('0xd')](_0xa0e5('0xe'),_0x43d41d,_0xa0e5('0xf'),JSON['stringify'](_0x39fe38));if(_0x39fe38['error']){if(_0x39fe38['error'][_0xa0e5('0x10')]===0x1f4){logger[_0xa0e5('0x11')](_0xa0e5('0xc'),_0x43d41d,_0x39fe38[_0xa0e5('0x11')]['message']);return _0x1b2e57(_0x39fe38[_0xa0e5('0x11')]['message']);}logger[_0xa0e5('0x11')](_0xa0e5('0xc'),_0x43d41d,_0x39fe38[_0xa0e5('0x11')][_0xa0e5('0x12')]);return _0x404c4f(_0x39fe38['error'][_0xa0e5('0x12')]);}else{logger[_0xa0e5('0xb')](_0xa0e5('0xc'),_0x43d41d,'request\x20sent');_0x404c4f(_0x39fe38[_0xa0e5('0x13')]['message']);}})[_0xa0e5('0x14')](function(_0x922444){logger['error'](_0xa0e5('0xc'),_0x43d41d,_0x922444);_0x1b2e57(_0x922444);});});} \ No newline at end of file +var _0xe90e=['info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then'];(function(_0x4f1050,_0xaceeab){var _0x1cc2cf=function(_0x325cef){while(--_0x325cef){_0x4f1050['push'](_0x4f1050['shift']());}};_0x1cc2cf(++_0xaceeab);}(_0xe90e,0x1c0));var _0xee90=function(_0x1d619,_0x51f2b5){_0x1d619=_0x1d619-0x0;var _0x330693=_0xe90e[_0x1d619];return _0x330693;};'use strict';var _=require(_0xee90('0x0'));var util=require('util');var moment=require(_0xee90('0x1'));var BPromise=require(_0xee90('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xee90('0x3'));var db=require(_0xee90('0x4'))['db'];var utils=require(_0xee90('0x5'));var logger=require(_0xee90('0x6'))(_0xee90('0x7'));var config=require('../../config/environment');var jayson=require(_0xee90('0x8'));var client=jayson[_0xee90('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xab031d,_0x58350d,_0x25d765){return new BPromise(function(_0x56e6d1,_0x30ceb0){return client[_0xee90('0xa')](_0xab031d,_0x25d765)[_0xee90('0xb')](function(_0x1b98af){logger[_0xee90('0xc')](_0xee90('0xd'),_0x58350d,_0xee90('0xe'));logger[_0xee90('0xf')](_0xee90('0x10'),_0x58350d,_0xee90('0xe'),JSON['stringify'](_0x1b98af));if(_0x1b98af[_0xee90('0x11')]){if(_0x1b98af[_0xee90('0x11')]['code']===0x1f4){logger['error'](_0xee90('0xd'),_0x58350d,_0x1b98af[_0xee90('0x11')]['message']);return _0x30ceb0(_0x1b98af[_0xee90('0x11')][_0xee90('0x12')]);}logger[_0xee90('0x11')](_0xee90('0xd'),_0x58350d,_0x1b98af['error'][_0xee90('0x12')]);return _0x56e6d1(_0x1b98af[_0xee90('0x11')][_0xee90('0x12')]);}else{logger[_0xee90('0xc')](_0xee90('0xd'),_0x58350d,_0xee90('0xe'));_0x56e6d1(_0x1b98af['result'][_0xee90('0x12')]);}})[_0xee90('0x13')](function(_0x4e423f){logger[_0xee90('0x11')](_0xee90('0xd'),_0x58350d,_0x4e423f);_0x30ceb0(_0x4e423f);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index bbc54d9..fe6d0b5 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 _0x37a5=['show','/:id/contacts','getContacts','post','create','put','update','/:id','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe'];(function(_0x57f8c0,_0x136cf6){var _0x117f08=function(_0x426cd4){while(--_0x426cd4){_0x57f8c0['push'](_0x57f8c0['shift']());}};_0x117f08(++_0x136cf6);}(_0x37a5,0x107));var _0x537a=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x37a5[_0x160c73];return _0xd9302;};'use strict';var multer=require(_0x537a('0x0'));var util=require(_0x537a('0x1'));var path=require('path');var timeout=require(_0x537a('0x2'));var express=require(_0x537a('0x3'));var router=express[_0x537a('0x4')]();var fs_extra=require(_0x537a('0x5'));var auth=require(_0x537a('0x6'));var interaction=require(_0x537a('0x7'));var config=require(_0x537a('0x8'));var controller=require('./cmCompany.controller');router['get']('/',auth[_0x537a('0x9')](),controller[_0x537a('0xa')]);router[_0x537a('0xb')](_0x537a('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x537a('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x537a('0xd')]);router[_0x537a('0xb')](_0x537a('0xe'),auth['isAuthenticated'](),controller[_0x537a('0xf')]);router[_0x537a('0x10')]('/',auth[_0x537a('0x9')](),controller[_0x537a('0x11')]);router[_0x537a('0x10')]('/:id/contacts',auth['isAuthenticated'](),controller['addContacts']);router[_0x537a('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x537a('0x13')]);router['delete'](_0x537a('0x14'),auth[_0x537a('0x9')](),controller[_0x537a('0x15')]);module[_0x537a('0x16')]=router; \ No newline at end of file +var _0x8a0b=['/:id','show','/:id/contacts','getContacts','create','post','put','delete','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','index','get','isAuthenticated'];(function(_0x85a7e,_0x2b6e2c){var _0x2e9266=function(_0x1d3bb7){while(--_0x1d3bb7){_0x85a7e['push'](_0x85a7e['shift']());}};_0x2e9266(++_0x2b6e2c);}(_0x8a0b,0x9c));var _0xb8a0=function(_0xf7f04c,_0x15c148){_0xf7f04c=_0xf7f04c-0x0;var _0x7094ba=_0x8a0b[_0xf7f04c];return _0x7094ba;};'use strict';var multer=require('multer');var util=require(_0xb8a0('0x0'));var path=require(_0xb8a0('0x1'));var timeout=require('connect-timeout');var express=require(_0xb8a0('0x2'));var router=express[_0xb8a0('0x3')]();var fs_extra=require(_0xb8a0('0x4'));var auth=require(_0xb8a0('0x5'));var interaction=require(_0xb8a0('0x6'));var config=require(_0xb8a0('0x7'));var controller=require(_0xb8a0('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xb8a0('0x9')]);router[_0xb8a0('0xa')]('/describe',auth[_0xb8a0('0xb')](),controller['describe']);router[_0xb8a0('0xa')](_0xb8a0('0xc'),auth[_0xb8a0('0xb')](),controller[_0xb8a0('0xd')]);router[_0xb8a0('0xa')](_0xb8a0('0xe'),auth[_0xb8a0('0xb')](),controller[_0xb8a0('0xf')]);router['post']('/',auth[_0xb8a0('0xb')](),controller[_0xb8a0('0x10')]);router[_0xb8a0('0x11')]('/:id/contacts',auth[_0xb8a0('0xb')](),controller['addContacts']);router[_0xb8a0('0x12')]('/:id',auth[_0xb8a0('0xb')](),controller['update']);router[_0xb8a0('0x13')](_0xb8a0('0xc'),auth[_0xb8a0('0xb')](),controller['destroy']);module[_0xb8a0('0x14')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 6c8c8a9..2ad30a7 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 _0x6681=['UNSIGNED','DATE','NOW','exports','STRING','TEXT','INTEGER'];(function(_0x134150,_0x3bd9a8){var _0x554990=function(_0x1498c2){while(--_0x1498c2){_0x134150['push'](_0x134150['shift']());}};_0x554990(++_0x3bd9a8);}(_0x6681,0x17d));var _0x1668=function(_0x4cd69a,_0x3b6881){_0x4cd69a=_0x4cd69a-0x0;var _0x38f36c=_0x6681[_0x4cd69a];return _0x38f36c;};'use strict';var _=require('lodash');var Sequelize=require('sequelize');module[_0x1668('0x0')]={'firstName':{'type':Sequelize[_0x1668('0x1')],'allowNull':![]},'lastName':{'type':Sequelize[_0x1668('0x1')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x1668('0x1')]},'city':{'type':Sequelize[_0x1668('0x1')]},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x1668('0x2')]},'phone':{'type':Sequelize[_0x1668('0x1')]},'mobile':{'type':Sequelize[_0x1668('0x1')]},'fax':{'type':Sequelize[_0x1668('0x1')]},'email':{'type':Sequelize[_0x1668('0x1')]},'url':{'type':Sequelize[_0x1668('0x1')]},'facebook':{'type':Sequelize[_0x1668('0x1')]},'fb_data':{'type':Sequelize[_0x1668('0x1')]},'twitter':{'type':Sequelize['STRING']},'skype':{'type':Sequelize[_0x1668('0x1')]},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize[_0x1668('0x1')]},'line':{'type':Sequelize[_0x1668('0x1')]},'wechat':{'type':Sequelize[_0x1668('0x1')]},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize[_0x1668('0x3')]},'AdditionalPhones':{'type':Sequelize[_0x1668('0x1')]},'priority':{'type':Sequelize[_0x1668('0x3')](0x2)[_0x1668('0x4')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x1668('0x5')],'defaultValue':Sequelize[_0x1668('0x6')]},'dialTimezone':{'type':Sequelize[_0x1668('0x1')]},'utcOffset':{'type':Sequelize[_0x1668('0x3')]}}; \ No newline at end of file +var _0xcb81=['UNSIGNED','NOW','lodash','STRING','INTEGER'];(function(_0x46bc6e,_0x1b2c3b){var _0xef4298=function(_0x4526bb){while(--_0x4526bb){_0x46bc6e['push'](_0x46bc6e['shift']());}};_0xef4298(++_0x1b2c3b);}(_0xcb81,0xfc));var _0x1cb8=function(_0x1e03a6,_0xf0349){_0x1e03a6=_0x1e03a6-0x0;var _0x295b64=_0xcb81[_0x1e03a6];return _0x295b64;};'use strict';var _=require(_0x1cb8('0x0'));var Sequelize=require('sequelize');module['exports']={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x1cb8('0x1')]},'dateOfBirth':{'type':Sequelize[_0x1cb8('0x1')]},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x1cb8('0x1')]},'fax':{'type':Sequelize[_0x1cb8('0x1')]},'email':{'type':Sequelize[_0x1cb8('0x1')]},'url':{'type':Sequelize[_0x1cb8('0x1')]},'facebook':{'type':Sequelize[_0x1cb8('0x1')]},'fb_data':{'type':Sequelize[_0x1cb8('0x1')]},'twitter':{'type':Sequelize[_0x1cb8('0x1')]},'skype':{'type':Sequelize['STRING']},'teams':{'type':Sequelize[_0x1cb8('0x1')]},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize[_0x1cb8('0x1')]},'wechat':{'type':Sequelize[_0x1cb8('0x1')]},'telegram':{'type':Sequelize[_0x1cb8('0x1')]},'UserId':{'type':Sequelize[_0x1cb8('0x2')]},'AdditionalPhones':{'type':Sequelize[_0x1cb8('0x1')]},'priority':{'type':Sequelize[_0x1cb8('0x2')](0x2)[_0x1cb8('0x3')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':Sequelize[_0x1cb8('0x4')]},'dialTimezone':{'type':Sequelize[_0x1cb8('0x1')]},'utcOffset':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 88879d6..caa00d1 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 _0x20bb=['merge','body','from','get','mergeWith','isArray','join','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','CmHopperBlack','ChatInteraction','update','ChatMessage','MailMessage','MailInteraction','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperFinal','CmHopperHistory','ReportAgentPreview','ChatQueueReport','MailQueueReport','SmsQueueReport','WhatsappInteraction','WhatsappMessage','create','isNil','timezones','utcOffset','additionalPhones','bulkCreate','each','duplicates','push','where','ListId','findOrCreate','all','show','find','Tag','Tags','tag','Phones','ContactItemType','ItemType','sequelize','literal','Phones.OrderBy','$and','omit','map','format','dialTimezone','CmCustomField','pickBy','cf_%d','isEmpty','table','cm_contacts','setFields','id\x20=\x20?','toParam','text','phone','getTags','findOne','model','rawAttributes','filters','intersection','attributes','fields','order','sort','pick','filter','options','nolimit','setTags','ids','setAdditionalPhones','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','CmHopperAdditionalPhone','item','`ItemType`.OrderBy','PHONE','duplicateAdditionalPhones','fromContactId','toContactId','rescheduleAdditionalPhones','hopperId','getHoppers','ContactId','includeAll','getHopperHistories','include','rows','getHopperFinals','getJscriptySessions','JscriptySessionReport','uploadCsv','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','server/files/tmp','chmodSync','0777','child_process','fork','CompanyId','File\x20uploaded\x20correctly!','pid','file','parse','meta','import','User','agent','binding','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','exit','importUpdates','No\x20ListId\x20specified','error\x20child\x20process','getJourney','chat','sms','resolve','channel','toLowerCase','Invalid\x20channel','range','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','uniqueid','type','source','destination','starttime','endtime','duration','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','fullname','alias','DESC','VoiceCallReport','findAndCountAll','startCase','Website','Account','closed','disposition','secondDisposition','key','color','customerPort','deviceModel','osName','ratingMessage','ratingValue','referer','mail','openchannel','externalUrl','threadId','Interaction','Owner','flatten','reverse','slice','moment','bluebird','path','papaparse','../../components/contacts','../../config/logger','api','../../mysqldb','redis','localhost','socket.io-emitter','status','json','offset','undefined','limit','count','set','Content-Range','destroy','then','end','sendStatus','error','stack','name','send','describe','getOptions','findAll','query','user','CmContact','params','tags','length','startsWith','cf_','displayName','values','info','keys','forEach','hasOwnProperty','columnName','catch'];(function(_0x4c975c,_0x3f71b6){var _0xf90e1f=function(_0xf7ee81){while(--_0xf7ee81){_0x4c975c['push'](_0x4c975c['shift']());}};_0xf90e1f(++_0x3f71b6);}(_0x20bb,0x1ba));var _0xb20b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x20bb[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0xb20b('0x0'));var BPromise=require(_0xb20b('0x1'));var util=require('util');var path=require(_0xb20b('0x2'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var Papa=require(_0xb20b('0x3'));var Redis=require('ioredis');var contacts=require(_0xb20b('0x4'));var qs=require('../../components/parsers/qs');var logger=require(_0xb20b('0x5'))(_0xb20b('0x6'));var config=require('../../config/environment');var shared=require('../../config/environment/shared');var db=require(_0xb20b('0x7'))['db'];config[_0xb20b('0x8')]=_['defaults'](config['redis'],{'host':_0xb20b('0x9'),'port':0x18eb});var socket=require(_0xb20b('0xa'))(new Redis(config[_0xb20b('0x8')]));require('./cmContact.socket')['register'](socket);function respondWithResult(_0x476bf6,_0x160886){_0x160886=_0x160886||0xc8;return function(_0x2749b6){if(_0x2749b6){return _0x476bf6[_0xb20b('0xb')](_0x160886)[_0xb20b('0xc')](_0x2749b6);}};}function respondWithFilteredResult(_0x2aaa2f,_0x288151){return function(_0x165d09){if(_0x165d09){var _0x4057db=typeof _0x288151[_0xb20b('0xd')]===_0xb20b('0xe')&&typeof _0x288151[_0xb20b('0xf')]===_0xb20b('0xe');var _0x47ee21=_0x165d09[_0xb20b('0x10')];var _0xd89cfc=_0x4057db?0x0:_0x288151[_0xb20b('0xd')];var _0x1d3422=_0x4057db?_0x165d09[_0xb20b('0x10')]:_0x288151[_0xb20b('0xd')]+_0x288151[_0xb20b('0xf')];var _0x48c0d6;if(_0x1d3422>=_0x47ee21){_0x1d3422=_0x47ee21;_0x48c0d6=0xc8;}else{_0x48c0d6=0xce;}_0x2aaa2f[_0xb20b('0xb')](_0x48c0d6);return _0x2aaa2f[_0xb20b('0x11')](_0xb20b('0x12'),_0xd89cfc+'-'+_0x1d3422+'/'+_0x47ee21)['json'](_0x165d09);}return null;};}function saveUpdates(_0x37b959){return function(_0x868534){if(_0x868534){return _0x868534['update'](_0x37b959)['then'](function(_0x2cb12e){return _0x2cb12e;});}return null;};}function removeEntity(_0x2bbc36){return function(_0x42d07b){if(_0x42d07b){return _0x42d07b[_0xb20b('0x13')]()[_0xb20b('0x14')](function(){_0x2bbc36[_0xb20b('0xb')](0xcc)[_0xb20b('0x15')]();});}};}function handleEntityNotFound(_0x7ab4c3){return function(_0x5a84d0){if(!_0x5a84d0){_0x7ab4c3[_0xb20b('0x16')](0x194);}return _0x5a84d0;};}function handleError(_0x1e886c,_0x417eca){_0x417eca=_0x417eca||0x1f4;return function(_0x4f0931){logger[_0xb20b('0x17')](_0x4f0931[_0xb20b('0x18')]);if(_0x4f0931[_0xb20b('0x19')]){delete _0x4f0931[_0xb20b('0x19')];}_0x1e886c[_0xb20b('0xb')](_0x417eca)[_0xb20b('0x1a')](_0x4f0931);};}exports['index']=function(_0x439890,_0xed1148){var _0x397b33={};return contacts[_0xb20b('0x1b')]()[_0xb20b('0x14')](function(_0x43a300){_0x397b33=qs[_0xb20b('0x1c')](_0x43a300,_0x439890);return contacts[_0xb20b('0x1d')](_0x439890[_0xb20b('0x1e')],_0x439890[_0xb20b('0x1f')],_0x397b33,_0x43a300);})[_0xb20b('0x14')](respondWithFilteredResult(_0xed1148,_0x397b33))['catch'](handleError(_0xed1148,null));};exports[_0xb20b('0x13')]=function(_0xcf1d77,_0x26c73b){return db[_0xb20b('0x20')]['find']({'where':{'id':_0xcf1d77[_0xb20b('0x21')]['id']}})[_0xb20b('0x14')](handleEntityNotFound(_0x26c73b,null))[_0xb20b('0x14')](removeEntity(_0x26c73b,null))['catch'](handleError(_0x26c73b,null));};exports[_0xb20b('0x1b')]=function(_0x3e9c75,_0x59a3ac){return db[_0xb20b('0x20')][_0xb20b('0x1b')]()[_0xb20b('0x14')](function(_0x516cc8){delete _0x516cc8[_0xb20b('0x22')];for(var _0x2867aa=0x0;_0x2867aa0x0){return new Promise(function(_0x59a814){var _0x1cc42f=[];for(var _0x38f352=0x0;_0x38f352<_0x36012a[_0xb20b('0x23')];_0x38f352++){_0x1cc42f[_0xb20b('0x54')](insertAdditionalPhones(_0x36012a[_0x38f352]['contact'],_0x36012a[_0x38f352][_0xb20b('0x50')]));}Promise[_0xb20b('0x58')](_0x1cc42f)[_0xb20b('0x14')](function(){_0x59a814(0x1);});})['then'](function(){return{'success':_0x5d7a81,'failure':_0x555544,'duplicates':_0x453d29};});}else{return{'success':_0x5d7a81,'failure':_0x555544,'duplicates':_0x453d29};}}})[_0xb20b('0x14')](respondWithResult(_0x15752d,0xc9))[_0xb20b('0x2d')](handleError(_0x15752d,null));};exports[_0xb20b('0x59')]=function(_0x4b9a06,_0x136858){var _0x3db918;return db[_0xb20b('0x20')]['describe']()[_0xb20b('0x14')](function(_0x47ba8b){return db[_0xb20b('0x20')][_0xb20b('0x5a')]({'where':{'id':_0x4b9a06['params']['id']},'include':[{'model':db[_0xb20b('0x5b')],'as':_0xb20b('0x5c'),'attributes':['id',_0xb20b('0x19'),'color'],'required':_0x4b9a06[_0xb20b('0x1e')][_0xb20b('0x5d')]?!![]:![]},{'model':db['CmContactHasItem'],'as':_0xb20b('0x5e'),'where':{'CmContactId':_0x4b9a06[_0xb20b('0x21')]['id']},'required':![],'include':[{'model':db[_0xb20b('0x5f')],'as':_0xb20b('0x60')}]}],'order':[db[_0xb20b('0x61')][_0xb20b('0x62')](_0xb20b('0x63'))],'attributes':_[_0xb20b('0x29')](_0x47ba8b)});})[_0xb20b('0x14')](function(_0x1ae4a6){if(!_['isNil'](_0x1ae4a6)){_0x3db918=_0x1ae4a6[_0xb20b('0x31')]({'plain':!![]});var _0x482979={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x1ae4a6&&_0x1ae4a6[_0xb20b('0x56')]){if(_0x1ae4a6['ListId']){_0x482979[_0xb20b('0x55')][_0xb20b('0x64')]['push']({'ListId':{'$ne':_0x1ae4a6[_0xb20b('0x56')]}});}}return db['CmCustomField'][_0xb20b('0x1d')](_0x482979);}})[_0xb20b('0x14')](function(_0x402aa7){if(!_['isNil'](_0x402aa7)){return _[_0xb20b('0x65')](_0x3db918,_[_0xb20b('0x66')](_0x402aa7,function(_0x3535d8){return util[_0xb20b('0x67')]('cf_%d',_0x3535d8['id']);}));}})[_0xb20b('0x14')](handleEntityNotFound(_0x136858,null))[_0xb20b('0x14')](respondWithResult(_0x136858,null))[_0xb20b('0x2d')](handleError(_0x136858,null));};exports[_0xb20b('0x39')]=function(_0x38f995,_0x185280){var _0xa9f731;if(_0x38f995[_0xb20b('0x2f')]['id']){delete _0x38f995[_0xb20b('0x2f')]['id'];}if(!_[_0xb20b('0x4d')](_0x38f995[_0xb20b('0x2f')][_0xb20b('0x68')])){var _0x51f535=_0x38f995[_0xb20b('0x2f')]['dialTimezone'];if(!_[_0xb20b('0x4d')](shared[_0xb20b('0x4e')][_0x51f535]))_0x38f995[_0xb20b('0x2f')][_0xb20b('0x4f')]=shared[_0xb20b('0x4e')][_0x51f535][_0xb20b('0x4f')];}return db[_0xb20b('0x20')][_0xb20b('0x5a')]({'where':{'id':_0x38f995[_0xb20b('0x21')]['id']}})[_0xb20b('0x14')](handleEntityNotFound(_0x185280,null))[_0xb20b('0x14')](saveUpdates(_0x38f995[_0xb20b('0x2f')],null))[_0xb20b('0x14')](function(_0x58f173){_0xa9f731=_0x58f173;var _0x227bdb={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x58f173&&_0x58f173['ListId']){if(_0x58f173[_0xb20b('0x56')]){_0x227bdb[_0xb20b('0x55')]['$and'][_0xb20b('0x54')]({'ListId':{'$ne':_0x58f173['ListId']}});}}return db[_0xb20b('0x69')][_0xb20b('0x1d')](_0x227bdb);})['then'](function(_0x5f1e0e){if(_0x5f1e0e){return _[_0xb20b('0x65')](_[_0xb20b('0x6a')](_0x38f995[_0xb20b('0x2f')],function(_0x2befda,_0x27d5f7){return _[_0xb20b('0x24')](_0x27d5f7,_0xb20b('0x25'));}),_[_0xb20b('0x66')](_0x5f1e0e,function(_0x5f4c84){return util[_0xb20b('0x67')](_0xb20b('0x6b'),_0x5f4c84['id']);}));}})['then'](function(_0xadea89){if(_0xadea89&&!_[_0xb20b('0x6c')](_0xadea89)){var _0x35b637=squel[_0xb20b('0x39')]()[_0xb20b('0x6d')](_0xb20b('0x6e'))[_0xb20b('0x6f')](_0xadea89)[_0xb20b('0x55')](_0xb20b('0x70'),_0x38f995[_0xb20b('0x21')]['id'])[_0xb20b('0x71')]();return db[_0xb20b('0x61')][_0xb20b('0x1e')](_0x35b637[_0xb20b('0x72')],{'replacements':_0x35b637[_0xb20b('0x27')]});}})['then'](function(){if(_0x38f995[_0xb20b('0x2f')][_0xb20b('0x73')]&&_0xa9f731){return db[_0xb20b('0x36')][_0xb20b('0x39')]({'phone':_0x38f995['body'][_0xb20b('0x73')],'OrderBy':0x0},{'where':{'ContactId':_0xa9f731['id']}});}})[_0xb20b('0x14')](function(){return _0xa9f731;})[_0xb20b('0x14')](respondWithResult(_0x185280,null))[_0xb20b('0x2d')](handleError(_0x185280,null));};exports[_0xb20b('0x74')]=function(_0x8409cb,_0x518ae3){var _0x747ddc={};var _0x3f2098={};var _0x21dd8d;var _0x238927;return db['CmContact'][_0xb20b('0x75')]({'where':{'id':_0x8409cb[_0xb20b('0x21')]['id']}})[_0xb20b('0x14')](handleEntityNotFound(_0x518ae3,null))[_0xb20b('0x14')](function(_0x4895b4){if(_0x4895b4){_0x21dd8d=_0x4895b4;_0x3f2098[_0xb20b('0x76')]=_[_0xb20b('0x29')](db[_0xb20b('0x5b')][_0xb20b('0x77')]);_0x3f2098[_0xb20b('0x1e')]=_[_0xb20b('0x29')](_0x8409cb[_0xb20b('0x1e')]);_0x3f2098[_0xb20b('0x78')]=_[_0xb20b('0x79')](_0x3f2098[_0xb20b('0x76')],_0x3f2098[_0xb20b('0x1e')]);_0x747ddc[_0xb20b('0x7a')]=_[_0xb20b('0x79')](_0x3f2098['model'],qs[_0xb20b('0x7b')](_0x8409cb[_0xb20b('0x1e')][_0xb20b('0x7b')]));_0x747ddc['attributes']=_0x747ddc[_0xb20b('0x7a')][_0xb20b('0x23')]?_0x747ddc[_0xb20b('0x7a')]:_0x3f2098[_0xb20b('0x76')];_0x747ddc[_0xb20b('0x7c')]=qs[_0xb20b('0x7d')](_0x8409cb['query'][_0xb20b('0x7d')]);_0x747ddc[_0xb20b('0x55')]=qs[_0xb20b('0x78')](_[_0xb20b('0x7e')](_0x8409cb['query'],_0x3f2098[_0xb20b('0x78')]));if(_0x8409cb[_0xb20b('0x1e')][_0xb20b('0x7f')]){_0x747ddc[_0xb20b('0x55')]=_[_0xb20b('0x2e')](_0x747ddc['where'],{'$or':_[_0xb20b('0x66')](_0x747ddc[_0xb20b('0x7a')],function(_0x5485d3){var _0x295c5b={};_0x295c5b[_0x5485d3]={'$like':'%'+_0x8409cb[_0xb20b('0x1e')][_0xb20b('0x7f')]+'%'};return _0x295c5b;})});}_0x747ddc=_['merge']({},_0x747ddc,_0x8409cb[_0xb20b('0x80')]);return _0x21dd8d[_0xb20b('0x74')](_0x747ddc);}})[_0xb20b('0x14')](function(_0x46c3d8){if(_0x46c3d8){_0x238927=_0x46c3d8[_0xb20b('0x23')];if(!_0x8409cb[_0xb20b('0x1e')][_0xb20b('0x2b')](_0xb20b('0x81'))){_0x747ddc['limit']=qs[_0xb20b('0xf')](_0x8409cb[_0xb20b('0x1e')][_0xb20b('0xf')]);_0x747ddc['offset']=qs[_0xb20b('0xd')](_0x8409cb[_0xb20b('0x1e')][_0xb20b('0xd')]);}return _0x21dd8d[_0xb20b('0x74')](_0x747ddc);}})['then'](function(_0x3e57f1){if(_0x3e57f1){return _0x3e57f1?{'count':_0x238927,'rows':_0x3e57f1}:null;}})[_0xb20b('0x14')](respondWithResult(_0x518ae3,null))[_0xb20b('0x2d')](handleError(_0x518ae3,null));};exports[_0xb20b('0x82')]=function(_0x4bbc7c,_0x4d4815){if(_0x4bbc7c['body']['id']){delete _0x4bbc7c[_0xb20b('0x2f')]['id'];}return db[_0xb20b('0x20')][_0xb20b('0x75')]({'where':{'id':_0x4bbc7c['params']['id']}})[_0xb20b('0x14')](handleEntityNotFound(_0x4d4815,null))[_0xb20b('0x14')](function(_0x4c2cf3){if(_0x4c2cf3){return _0x4c2cf3[_0xb20b('0x82')](_0x4bbc7c[_0xb20b('0x2f')][_0xb20b('0x83')]||[]);}return null;})[_0xb20b('0x14')](respondWithResult(_0x4d4815,null))[_0xb20b('0x2d')](handleError(_0x4d4815,null));};exports[_0xb20b('0x84')]=function(_0x103821,_0x3cc315){var _0x14e763=[];_0x14e763[_0xb20b('0x54')](addAdditionalPhones(_0x103821[_0xb20b('0x2f')]));Promise[_0xb20b('0x58')](_0x14e763)[_0xb20b('0x14')](function(){_0x14e763=[];_0x14e763['push'](deleteCmHopperPhones(_0x103821[_0xb20b('0x2f')]['id']));_0x14e763[_0xb20b('0x54')](addCmHopperPhones(_0x103821[_0xb20b('0x2f')]['id']));Promise['all'](_0x14e763)[_0xb20b('0x14')](function(){return[0x1];})[_0xb20b('0x14')](respondWithResult(_0x3cc315,null));});};function addAdditionalPhones(_0x2ab2e0){var _0x46b079;return new Promise(function(_0x55f634){return db[_0xb20b('0x43')][_0xb20b('0x13')]({'where':{'CmContactId':_0x2ab2e0['id']}})[_0xb20b('0x14')](function(){db[_0xb20b('0x5f')][_0xb20b('0x1d')]({'raw':!![],'attributes':['id',_0xb20b('0x85')]})[_0xb20b('0x14')](function(_0x578af1){var _0x4e379f=[];for(var _0x2a2ea2=0x0;_0x2a2ea2<_0x2ab2e0[_0xb20b('0x86')][_0xb20b('0x23')];_0x2a2ea2++){var _0x322576=_0x2ab2e0[_0xb20b('0x87')]?_[_0xb20b('0x4d')](_0x2ab2e0['item_types'][_0x2a2ea2])?'':_0x2ab2e0[_0xb20b('0x87')][_0x2a2ea2]:_0x2ab2e0[_0xb20b('0x86')][_0x2a2ea2][_0xb20b('0x88')]?_0x2ab2e0[_0xb20b('0x86')][_0x2a2ea2][_0xb20b('0x88')]:'';var _0xa72869=_[_0xb20b('0x4d')](_0x2ab2e0['items'][_0x2a2ea2][_0xb20b('0x89')])?'':_0x2ab2e0[_0xb20b('0x86')][_0x2a2ea2][_0xb20b('0x89')];var _0x8b50e6=_0x322576+':'+_0x2ab2e0[_0xb20b('0x86')][_0x2a2ea2][_0xb20b('0x73')]+'§'+_0xa72869;if(_['isNil'](_0x46b079))_0x46b079=_0x8b50e6;else _0x46b079+=';'+_0x8b50e6;var _0x4ff937=null;var _0x411bcd=null;if(_0x2ab2e0[_0xb20b('0x87')]){if(!_['isNil'](_0x2ab2e0[_0xb20b('0x87')][_0x2a2ea2])){_0x411bcd=_[_0xb20b('0x5a')](_0x578af1,function(_0x337fb6){return _0x337fb6['id']===_0x2ab2e0[_0xb20b('0x87')][_0x2a2ea2];});if(!_['isNil'](_0x411bcd)){_0x4ff937=_0x411bcd[_0xb20b('0x85')];}}}else{if(!_[_0xb20b('0x4d')](_0x2ab2e0[_0xb20b('0x86')][_0x2a2ea2])){_0x411bcd=_['find'](_0x578af1,function(_0x129ac1){return _0x129ac1['id']===_0x2ab2e0[_0xb20b('0x86')][_0x2a2ea2][_0xb20b('0x88')];});if(!_[_0xb20b('0x4d')](_0x411bcd)){_0x4ff937=_0x2a2ea2;}}}if(_['isNil'](_0x4ff937)){_0x4ff937=0x64;}_0x4e379f[_0xb20b('0x54')](addAdditionalPhone(_0x2ab2e0['id'],_0x2ab2e0[_0xb20b('0x86')][_0x2a2ea2][_0xb20b('0x73')],_0x2ab2e0[_0xb20b('0x87')]?_[_0xb20b('0x4d')](_0x2ab2e0['item_types'][_0x2a2ea2])?null:_0x2ab2e0[_0xb20b('0x87')][_0x2a2ea2]:_0x2ab2e0['items'][_0x2a2ea2]['ItemTypeId']?_0x2ab2e0[_0xb20b('0x86')][_0x2a2ea2][_0xb20b('0x88')]:null,_0x4ff937,_0xa72869));}Promise[_0xb20b('0x58')](_0x4e379f)[_0xb20b('0x14')](function(){db[_0xb20b('0x20')][_0xb20b('0x39')]({'AdditionalPhones':_0x46b079},{'where':{'id':_0x2ab2e0['id']}})[_0xb20b('0x14')](function(){_0x55f634(0x1);});});});});});}function addAdditionalPhone(_0x5b3bbb,_0x498553,_0x9647d0,_0xabcb80,_0x38fa68){return db[_0xb20b('0x43')][_0xb20b('0x5a')]({'where':{'CmContactId':_0x5b3bbb,'item':_0x498553}})[_0xb20b('0x14')](function(_0x4f7c8b){if(_0x4f7c8b)logger['info'](_0xb20b('0x8a'),_0x4f7c8b);else{db['CmContactHasItem']['create']({'CmContactId':_0x5b3bbb,'item':_0x498553,'ItemTypeId':_0x9647d0,'OrderBy':_0xabcb80,'ItemClass':'PHONE','description':_0x38fa68});}});}function deleteCmHopperPhones(_0x3620de){return new Promise(function(_0x17a230){return db[_0xb20b('0x36')][_0xb20b('0x1d')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x3620de}})[_0xb20b('0x14')](function(_0x3c3066){db[_0xb20b('0x8b')]['destroy']({'where':{'CmHopperId':{'$in':_[_0xb20b('0x66')](_0x3c3066,'id')}}});})[_0xb20b('0x14')](function(){_0x17a230(0x1);});});}function addCmHopperPhones(_0x11063c){return new Promise(function(_0x35d661){return db['CmHopper'][_0xb20b('0x1d')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x11063c}})[_0xb20b('0x14')](function(_0x308658){var _0x3c982b=[];_[_0xb20b('0x66')](_0x308658,function(_0x4c691){_0x3c982b['push'](createCmHopperPhone(_0x11063c,_0x4c691['id']));});Promise[_0xb20b('0x58')](_0x3c982b)[_0xb20b('0x14')](function(){_0x35d661(0x1);});});});}function createCmHopperPhone(_0x5692d5,_0x459f8c){return new Promise(function(_0x440cdc){db[_0xb20b('0x43')][_0xb20b('0x1d')]({'raw':!![],'attributes':[_0xb20b('0x8c'),_0xb20b('0x85')],'where':{'CmContactId':_0x5692d5,'ItemClass':'PHONE'},'include':[{'model':db[_0xb20b('0x5f')],'attributes':['OrderBy'],'as':'ItemType'}],'order':[_0xb20b('0x85'),db[_0xb20b('0x61')][_0xb20b('0x62')](_0xb20b('0x8d'))]})[_0xb20b('0x14')](function(_0x7bf912){var _0xb5fe11=0x1;var _0x5710b5=_[_0xb20b('0x66')](_0x7bf912,function(_0x2abe61){_0x2abe61['CmHopperId']=_0x459f8c;_0x2abe61[_0xb20b('0x73')]=_0x2abe61[_0xb20b('0x8c')];_0x2abe61[_0xb20b('0x85')]=_0xb5fe11;delete _0x2abe61['ItemType.OrderBy'];_0xb5fe11=_0xb5fe11+0x1;return _0x2abe61;});return db[_0xb20b('0x8b')][_0xb20b('0x51')](_0x5710b5,{});})[_0xb20b('0x14')](function(){_0x440cdc(0x1);});});}function insertAdditionalPhones(_0x1b7731,_0x123e9e){return new Promise(function(_0x1c1182){var _0x5a690a=[];for(var _0xc15d=0x0;_0xc15d<_0x123e9e[_0xb20b('0x23')];_0xc15d++){var _0x59a13a=_0x123e9e[_0xc15d];_0x5a690a[_0xb20b('0x54')](parseContactItemType(_0x59a13a));}Promise[_0xb20b('0x58')](_0x5a690a)[_0xb20b('0x14')](function(){var _0x5208a8={'id':_0x1b7731['id'],'items':_0x123e9e};return addAdditionalPhones(_0x5208a8)[_0xb20b('0x14')](function(){return addCmHopperPhones(_0x1b7731['id']);});})['then'](function(){_0x1c1182(_0x1b7731);});});}function parseContactItemType(_0x2100fe){return new Promise(function(_0x14797a){if(_0x2100fe[_0xb20b('0x2b')](_0xb20b('0x88'))){_0x14797a(_0x2100fe);}else{return db[_0xb20b('0x5f')][_0xb20b('0x5a')]({'where':{'name':_0x2100fe[_0xb20b('0x60')]}})[_0xb20b('0x14')](function(_0x594a8f){if(_['isNil'](_0x594a8f))_0x2100fe[_0xb20b('0x88')]=null;else _0x2100fe[_0xb20b('0x88')]=_0x594a8f['id'];_0x14797a(_0x2100fe);});}});}exports['getAdditionalPhones']=function(_0xf4defc,_0x92e895){return db[_0xb20b('0x43')][_0xb20b('0x1d')]({'raw':!![],'where':{'CmContactId':_0xf4defc[_0xb20b('0x21')]['id'],'ItemClass':_0xb20b('0x8e')},'include':[{'model':db[_0xb20b('0x5f')],'as':_0xb20b('0x60')}],'order':[[_0xb20b('0x85')],[db[_0xb20b('0x61')]['literal']('`ItemType`.OrderBy')]]})[_0xb20b('0x14')](function(_0x3a6f6f){return _0x3a6f6f;})[_0xb20b('0x14')](respondWithResult(_0x92e895,null))[_0xb20b('0x2d')](handleError(_0x92e895,null));};exports[_0xb20b('0x8f')]=function(_0x946e0d,_0x20a6cd){return db[_0xb20b('0x43')][_0xb20b('0x1d')]({'raw':!![],'where':{'CmContactId':_0x946e0d[_0xb20b('0x2f')][_0xb20b('0x90')]}})['then'](function(_0x472eb2){var _0x1b5460=_[_0xb20b('0x66')](_0x472eb2,function(_0x463078){_0x463078['CmContactId']=_0x946e0d['body'][_0xb20b('0x91')];return _0x463078;});return db['CmContactHasItem'][_0xb20b('0x51')](_0x1b5460,{});})[_0xb20b('0x14')](function(){return addCmHopperPhones(_0x946e0d['body'][_0xb20b('0x91')]);})['then'](function(){return['ok'];})[_0xb20b('0x14')](respondWithResult(_0x20a6cd,null))[_0xb20b('0x2d')](handleError(_0x20a6cd,null));};exports[_0xb20b('0x92')]=function(_0x3d5f25,_0x5bb5a4){var _0x4f503e=[];_0x4f503e[_0xb20b('0x54')](createCmHopperPhone(_0x3d5f25[_0xb20b('0x2f')]['id'],_0x3d5f25[_0xb20b('0x2f')][_0xb20b('0x93')]));Promise[_0xb20b('0x58')](_0x4f503e)[_0xb20b('0x14')](function(){return[0x1];})[_0xb20b('0x14')](respondWithResult(_0x5bb5a4,null));};exports[_0xb20b('0x94')]=function(_0x4e3b14,_0x9e451d){var _0x37eb3f={'raw':![],'where':{}};var _0x5a64ca={};var _0x48b073={'count':0x0,'rows':[]};return db[_0xb20b('0x20')][_0xb20b('0x75')]({'where':{'id':_0x4e3b14['params']['id']}})['then'](handleEntityNotFound(_0x9e451d,null))[_0xb20b('0x14')](function(_0x1cb8aa){if(_0x1cb8aa){_0x5a64ca[_0xb20b('0x76')]=_[_0xb20b('0x29')](db[_0xb20b('0x36')][_0xb20b('0x77')]);_0x5a64ca['query']=_[_0xb20b('0x29')](_0x4e3b14['query']);_0x5a64ca[_0xb20b('0x78')]=_[_0xb20b('0x79')](_0x5a64ca[_0xb20b('0x76')],_0x5a64ca[_0xb20b('0x1e')]);_0x37eb3f[_0xb20b('0x7a')]=_['intersection'](_0x5a64ca[_0xb20b('0x76')],qs['fields'](_0x4e3b14[_0xb20b('0x1e')][_0xb20b('0x7b')]));_0x37eb3f[_0xb20b('0x7a')]=_0x37eb3f['attributes'][_0xb20b('0x23')]?_0x37eb3f['attributes']:_0x5a64ca['model'];if(!_0x4e3b14[_0xb20b('0x1e')][_0xb20b('0x2b')](_0xb20b('0x81'))){_0x37eb3f[_0xb20b('0xf')]=qs['limit'](_0x4e3b14[_0xb20b('0x1e')]['limit']);_0x37eb3f[_0xb20b('0xd')]=qs[_0xb20b('0xd')](_0x4e3b14['query'][_0xb20b('0xd')]);}_0x37eb3f['order']=qs[_0xb20b('0x7d')](_0x4e3b14['query']['sort']);_0x37eb3f[_0xb20b('0x55')]=qs['filters'](_['pick'](_0x4e3b14['query'],_0x5a64ca[_0xb20b('0x78')]));_0x37eb3f['where'][_0xb20b('0x95')]=_0x1cb8aa['id'];if(_0x4e3b14[_0xb20b('0x1e')]['filter']){_0x37eb3f[_0xb20b('0x55')]=_[_0xb20b('0x2e')](_0x37eb3f['where'],{'$or':_[_0xb20b('0x66')](_0x37eb3f['attributes'],function(_0x2d2578){var _0x2b3963={};_0x2b3963[_0x2d2578]={'$like':'%'+_0x4e3b14[_0xb20b('0x1e')][_0xb20b('0x7f')]+'%'};return _0x2b3963;})});}_0x37eb3f=_[_0xb20b('0x2e')]({},_0x37eb3f,_0x4e3b14[_0xb20b('0x80')]);return db[_0xb20b('0x36')][_0xb20b('0x10')]({'where':_0x37eb3f[_0xb20b('0x55')]})[_0xb20b('0x14')](function(_0x207800){_0x48b073[_0xb20b('0x10')]=_0x207800;if(_0x4e3b14[_0xb20b('0x1e')][_0xb20b('0x96')]){_0x37eb3f['include']=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x37eb3f);})['then'](function(_0x46f8fa){_0x48b073['rows']=_0x46f8fa;return _0x48b073;});}})[_0xb20b('0x14')](respondWithFilteredResult(_0x9e451d,_0x37eb3f))[_0xb20b('0x2d')](handleError(_0x9e451d,null));};exports[_0xb20b('0x97')]=function(_0x126038,_0x2a6429){var _0x2e0938={'raw':!![],'where':{}};var _0x2d8b89={};var _0x1c7dda={'count':0x0,'rows':[]};return db[_0xb20b('0x20')]['findOne']({'where':{'id':_0x126038[_0xb20b('0x21')]['id']}})[_0xb20b('0x14')](handleEntityNotFound(_0x2a6429,null))[_0xb20b('0x14')](function(_0x283bd1){if(_0x283bd1){_0x2d8b89[_0xb20b('0x76')]=_[_0xb20b('0x29')](db[_0xb20b('0x45')][_0xb20b('0x77')]);_0x2d8b89[_0xb20b('0x1e')]=_[_0xb20b('0x29')](_0x126038['query']);_0x2d8b89[_0xb20b('0x78')]=_['intersection'](_0x2d8b89[_0xb20b('0x76')],_0x2d8b89[_0xb20b('0x1e')]);_0x2e0938[_0xb20b('0x7a')]=_[_0xb20b('0x79')](_0x2d8b89[_0xb20b('0x76')],qs[_0xb20b('0x7b')](_0x126038[_0xb20b('0x1e')][_0xb20b('0x7b')]));_0x2e0938['attributes']=_0x2e0938[_0xb20b('0x7a')][_0xb20b('0x23')]?_0x2e0938[_0xb20b('0x7a')]:_0x2d8b89[_0xb20b('0x76')];if(!_0x126038[_0xb20b('0x1e')][_0xb20b('0x2b')]('nolimit')){_0x2e0938[_0xb20b('0xf')]=qs[_0xb20b('0xf')](_0x126038['query'][_0xb20b('0xf')]);_0x2e0938[_0xb20b('0xd')]=qs[_0xb20b('0xd')](_0x126038['query'][_0xb20b('0xd')]);}_0x2e0938[_0xb20b('0x7c')]=qs[_0xb20b('0x7d')](_0x126038[_0xb20b('0x1e')][_0xb20b('0x7d')]);_0x2e0938[_0xb20b('0x55')]=qs['filters'](_[_0xb20b('0x7e')](_0x126038[_0xb20b('0x1e')],_0x2d8b89[_0xb20b('0x78')]));_0x2e0938['where'][_0xb20b('0x95')]=_0x283bd1['id'];if(_0x126038[_0xb20b('0x1e')]['filter']){_0x2e0938[_0xb20b('0x55')]=_[_0xb20b('0x2e')](_0x2e0938[_0xb20b('0x55')],{'$or':_[_0xb20b('0x66')](_0x2e0938[_0xb20b('0x7a')],function(_0x35426d){var _0x147cca={};_0x147cca[_0x35426d]={'$like':'%'+_0x126038[_0xb20b('0x1e')][_0xb20b('0x7f')]+'%'};return _0x147cca;})});}_0x2e0938=_['merge']({},_0x2e0938,_0x126038['options']);return db[_0xb20b('0x45')][_0xb20b('0x10')]({'where':_0x2e0938[_0xb20b('0x55')]})['then'](function(_0x35f6a9){_0x1c7dda[_0xb20b('0x10')]=_0x35f6a9;if(_0x126038[_0xb20b('0x1e')][_0xb20b('0x96')]){_0x2e0938[_0xb20b('0x98')]=[{'all':!![]}];}return db[_0xb20b('0x45')][_0xb20b('0x1d')](_0x2e0938);})[_0xb20b('0x14')](function(_0x3e559d){_0x1c7dda[_0xb20b('0x99')]=_0x3e559d;return _0x1c7dda;});}})['then'](respondWithFilteredResult(_0x2a6429,_0x2e0938))['catch'](handleError(_0x2a6429,null));};exports[_0xb20b('0x9a')]=function(_0x5adca3,_0x3d3da8){var _0x245c96={'raw':!![],'where':{}};var _0x2c6910={};var _0x224285={'count':0x0,'rows':[]};return db[_0xb20b('0x20')][_0xb20b('0x75')]({'where':{'id':_0x5adca3[_0xb20b('0x21')]['id']}})[_0xb20b('0x14')](handleEntityNotFound(_0x3d3da8,null))[_0xb20b('0x14')](function(_0x37780a){if(_0x37780a){_0x2c6910[_0xb20b('0x76')]=_[_0xb20b('0x29')](db[_0xb20b('0x44')][_0xb20b('0x77')]);_0x2c6910['query']=_['keys'](_0x5adca3['query']);_0x2c6910[_0xb20b('0x78')]=_[_0xb20b('0x79')](_0x2c6910[_0xb20b('0x76')],_0x2c6910[_0xb20b('0x1e')]);_0x245c96[_0xb20b('0x7a')]=_[_0xb20b('0x79')](_0x2c6910['model'],qs[_0xb20b('0x7b')](_0x5adca3[_0xb20b('0x1e')][_0xb20b('0x7b')]));_0x245c96[_0xb20b('0x7a')]=_0x245c96[_0xb20b('0x7a')][_0xb20b('0x23')]?_0x245c96[_0xb20b('0x7a')]:_0x2c6910['model'];if(!_0x5adca3[_0xb20b('0x1e')]['hasOwnProperty'](_0xb20b('0x81'))){_0x245c96['limit']=qs['limit'](_0x5adca3[_0xb20b('0x1e')][_0xb20b('0xf')]);_0x245c96[_0xb20b('0xd')]=qs[_0xb20b('0xd')](_0x5adca3[_0xb20b('0x1e')][_0xb20b('0xd')]);}_0x245c96[_0xb20b('0x7c')]=qs[_0xb20b('0x7d')](_0x5adca3[_0xb20b('0x1e')][_0xb20b('0x7d')]);_0x245c96[_0xb20b('0x55')]=qs[_0xb20b('0x78')](_[_0xb20b('0x7e')](_0x5adca3[_0xb20b('0x1e')],_0x2c6910[_0xb20b('0x78')]));_0x245c96[_0xb20b('0x55')]['ContactId']=_0x37780a['id'];if(_0x5adca3['query']['filter']){_0x245c96[_0xb20b('0x55')]=_[_0xb20b('0x2e')](_0x245c96[_0xb20b('0x55')],{'$or':_[_0xb20b('0x66')](_0x245c96[_0xb20b('0x7a')],function(_0x1a2c75){var _0x37ee89={};_0x37ee89[_0x1a2c75]={'$like':'%'+_0x5adca3[_0xb20b('0x1e')][_0xb20b('0x7f')]+'%'};return _0x37ee89;})});}_0x245c96=_['merge']({},_0x245c96,_0x5adca3[_0xb20b('0x80')]);return db['CmHopperFinal'][_0xb20b('0x10')]({'where':_0x245c96[_0xb20b('0x55')]})[_0xb20b('0x14')](function(_0x19ed8d){_0x224285[_0xb20b('0x10')]=_0x19ed8d;if(_0x5adca3['query'][_0xb20b('0x96')]){_0x245c96[_0xb20b('0x98')]=[{'all':!![]}];}return db[_0xb20b('0x44')][_0xb20b('0x1d')](_0x245c96);})[_0xb20b('0x14')](function(_0x3d0516){_0x224285['rows']=_0x3d0516;return _0x224285;});}})[_0xb20b('0x14')](respondWithFilteredResult(_0x3d3da8,_0x245c96))['catch'](handleError(_0x3d3da8,null));};exports[_0xb20b('0x9b')]=function(_0x5ed360,_0x57d88d){var _0x1483a4={'raw':!![],'where':{}};var _0x1897cc={};var _0x815fb8={'count':0x0,'rows':[]};return db[_0xb20b('0x20')][_0xb20b('0x75')]({'where':{'id':_0x5ed360['params']['id']}})['then'](handleEntityNotFound(_0x57d88d,null))[_0xb20b('0x14')](function(_0x3d290c){if(_0x3d290c){_0x1897cc[_0xb20b('0x76')]=_['keys'](db[_0xb20b('0x9c')]['rawAttributes']);_0x1897cc[_0xb20b('0x1e')]=_[_0xb20b('0x29')](_0x5ed360[_0xb20b('0x1e')]);_0x1897cc[_0xb20b('0x78')]=_[_0xb20b('0x79')](_0x1897cc[_0xb20b('0x76')],_0x1897cc[_0xb20b('0x1e')]);_0x1483a4[_0xb20b('0x7a')]=_[_0xb20b('0x79')](_0x1897cc[_0xb20b('0x76')],qs[_0xb20b('0x7b')](_0x5ed360['query'][_0xb20b('0x7b')]));_0x1483a4[_0xb20b('0x7a')]=_0x1483a4[_0xb20b('0x7a')][_0xb20b('0x23')]?_0x1483a4[_0xb20b('0x7a')]:_0x1897cc[_0xb20b('0x76')];if(!_0x5ed360[_0xb20b('0x1e')]['hasOwnProperty'](_0xb20b('0x81'))){_0x1483a4[_0xb20b('0xf')]=qs[_0xb20b('0xf')](_0x5ed360[_0xb20b('0x1e')][_0xb20b('0xf')]);_0x1483a4[_0xb20b('0xd')]=qs[_0xb20b('0xd')](_0x5ed360[_0xb20b('0x1e')]['offset']);}_0x1483a4[_0xb20b('0x7c')]=qs[_0xb20b('0x7d')](_0x5ed360[_0xb20b('0x1e')]['sort']);_0x1483a4[_0xb20b('0x55')]=qs[_0xb20b('0x78')](_[_0xb20b('0x7e')](_0x5ed360[_0xb20b('0x1e')],_0x1897cc[_0xb20b('0x78')]));_0x1483a4[_0xb20b('0x55')][_0xb20b('0x95')]=_0x3d290c['id'];if(_0x5ed360['query'][_0xb20b('0x7f')]){_0x1483a4[_0xb20b('0x55')]=_[_0xb20b('0x2e')](_0x1483a4[_0xb20b('0x55')],{'$or':_[_0xb20b('0x66')](_0x1483a4[_0xb20b('0x7a')],function(_0x1ed673){var _0x4c412c={};_0x4c412c[_0x1ed673]={'$like':'%'+_0x5ed360[_0xb20b('0x1e')][_0xb20b('0x7f')]+'%'};return _0x4c412c;})});}_0x1483a4=_[_0xb20b('0x2e')]({},_0x1483a4,_0x5ed360[_0xb20b('0x80')]);return db[_0xb20b('0x9c')]['count']({'where':_0x1483a4[_0xb20b('0x55')]})['then'](function(_0x361aa5){_0x815fb8[_0xb20b('0x10')]=_0x361aa5;if(_0x5ed360['query']['includeAll']){_0x1483a4[_0xb20b('0x98')]=[{'all':!![]}];}return db['JscriptySessionReport']['findAll'](_0x1483a4);})[_0xb20b('0x14')](function(_0x25b1e2){_0x815fb8['rows']=_0x25b1e2;return _0x815fb8;});}})[_0xb20b('0x14')](respondWithFilteredResult(_0x57d88d,_0x1483a4))['catch'](handleError(_0x57d88d,null));};exports[_0xb20b('0x9d')]=function(_0x4e5f58,_0x22f7ca){try{if(!_0x4e5f58[_0xb20b('0x2f')][_0xb20b('0x56')]){throw new Error('No\x20ListId\x20specified');}if(!_0x4e5f58[_0xb20b('0x2f')][_0xb20b('0x9e')]){throw new Error(_0xb20b('0x9f'));}if(!_0x4e5f58[_0xb20b('0x2f')][_0xb20b('0xa0')]){throw new Error(_0xb20b('0xa1'));}if(!_0x4e5f58[_0xb20b('0x2f')][_0xb20b('0xa2')]){throw new Error(_0xb20b('0xa3'));}var _0x2a0222=_0x4e5f58['body'][_0xb20b('0x9e')][_0xb20b('0xa4')](',');var _0x5d8998=_0x4e5f58[_0xb20b('0x2f')][_0xb20b('0xa0')][_0xb20b('0xa4')](',');if(!_0x2a0222[_0xb20b('0x23')]||!_0x5d8998['length']||_0x2a0222['length']!==_0x5d8998[_0xb20b('0x23')]){throw new Error(_0xb20b('0xa5'));}_0x4e5f58['body'][_0xb20b('0x7b')]=_[_0xb20b('0xa6')](_0x2a0222,_0x5d8998);if(!_0x4e5f58[_0xb20b('0x2f')][_0xb20b('0x7b')][_0xb20b('0x73')]){throw new Error(_0xb20b('0xa7'));}if(!_0x4e5f58[_0xb20b('0x2f')][_0xb20b('0x7b')][_0xb20b('0xa8')]){throw new Error(_0xb20b('0xa9'));}var _0xebc346=path[_0xb20b('0x34')](config['root'],_0xb20b('0xaa'),_0x4e5f58['file']['filename']);fs[_0xb20b('0xab')](_0xebc346,parseInt(_0xb20b('0xac'),0x8));var _0x12e4f4=require(_0xb20b('0xad'))[_0xb20b('0xae')](path[_0xb20b('0x34')](__dirname,'../../components/import/cm/csv'),[_0xebc346,_0x4e5f58[_0xb20b('0x2f')][_0xb20b('0x9e')],_0x4e5f58[_0xb20b('0x2f')][_0xb20b('0xa0')],_0x4e5f58[_0xb20b('0x2f')][_0xb20b('0x56')],_0x4e5f58['body'][_0xb20b('0xaf')],_0x4e5f58[_0xb20b('0x2f')][_0xb20b('0x53')],_0x4e5f58[_0xb20b('0x2f')][_0xb20b('0xa2')]]);return _0x22f7ca['status'](0xc8)[_0xb20b('0xc')]({'message':_0xb20b('0xb0'),'pid':_0x12e4f4[_0xb20b('0xb1')]});}catch(_0x1cde74){return _0x22f7ca['status'](0x1f4)[_0xb20b('0x1a')](_0x1cde74);}};exports['upload']=function(_0x18cfba,_0x5b6d4c){var _0x2d4790=fs['createReadStream'](_0x18cfba[_0xb20b('0xb2')]['path']);Papa[_0xb20b('0xb3')](_0x2d4790,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x1f80d5){return _0x5b6d4c[_0xb20b('0xb')](0xc8)[_0xb20b('0xc')]({'file':_0x18cfba[_0xb20b('0xb2')],'fields':_0x1f80d5[_0xb20b('0xb4')]['fields']});}});};exports[_0xb20b('0xb5')]=function(_0x3a38f5,_0x351462){return db[_0xb20b('0xb6')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0xb20b('0xb7')}})['then'](function(_0x15bd1a){var _0x4e8816=![];if(!_0x3a38f5[_0xb20b('0x2f')][_0xb20b('0x56')]){throw new Error('No\x20ListId\x20specified');}if(!_0x3a38f5[_0xb20b('0x2f')][_0xb20b('0xb8')][_0xb20b('0x73')]){throw new Error(_0xb20b('0xa7'));}if(!_0x3a38f5['body']['binding'][_0xb20b('0xa8')]){throw new Error(_0xb20b('0xa9'));}if(!_0x3a38f5[_0xb20b('0x2f')][_0xb20b('0xa2')]){throw new Error(_0xb20b('0xa3'));}var _0x103a56=require(_0xb20b('0xad'))[_0xb20b('0xae')](path[_0xb20b('0x34')](__dirname,_0xb20b('0xb9')),[_0x3a38f5[_0xb20b('0x21')]['id'],JSON[_0xb20b('0xba')](_0x3a38f5[_0xb20b('0x2f')]),JSON[_0xb20b('0xba')](_0x15bd1a)]);_0x103a56['on'](_0xb20b('0xbb'),function(){_0x4e8816=!![];return _0x351462[_0xb20b('0xb')](0xc8)['json']({'message':_0xb20b('0xbc'),'pid':_0x103a56[_0xb20b('0xb1')]});});_0x103a56['on'](_0xb20b('0xbd'),function(_0x4a9202){if(_0x4a9202&&!_0x4e8816){return _0x351462[_0xb20b('0xb')](0x1f4)[_0xb20b('0xc')]({'message':'error\x20child\x20process','pid':_0x103a56['pid']});}});})['catch'](handleError(_0x351462,null));};exports[_0xb20b('0xbe')]=function(_0xc4c050,_0x87a948){return db[_0xb20b('0xb6')][_0xb20b('0x1d')]({'raw':!![],'attributes':['id'],'where':{'role':_0xb20b('0xb7')}})[_0xb20b('0x14')](function(_0x541d14){var _0x15edff=![];if(!_0xc4c050['body'][_0xb20b('0x56')]){throw new Error(_0xb20b('0xbf'));}if(!_0xc4c050[_0xb20b('0x2f')][_0xb20b('0xb8')][_0xb20b('0x73')]){throw new Error(_0xb20b('0xa7'));}if(!_0xc4c050[_0xb20b('0x2f')]['binding'][_0xb20b('0xa8')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0xc4c050[_0xb20b('0x2f')][_0xb20b('0xa2')]){throw new Error(_0xb20b('0xa3'));}var _0x4347d4=require('child_process')[_0xb20b('0xae')](path['join'](__dirname,'../../components/import/cm/csvUpdates'),[_0xc4c050['params']['id'],JSON['stringify'](_0xc4c050[_0xb20b('0x2f')]),JSON[_0xb20b('0xba')](_0x541d14)]);_0x4347d4['on']('message',function(){_0x15edff=!![];return _0x87a948[_0xb20b('0xb')](0xc8)[_0xb20b('0xc')]({'message':_0xb20b('0xbc'),'pid':_0x4347d4[_0xb20b('0xb1')]});});_0x4347d4['on'](_0xb20b('0xbd'),function(_0x388b11){if(_0x388b11&&!_0x15edff){return _0x87a948[_0xb20b('0xb')](0x1f4)[_0xb20b('0xc')]({'message':_0xb20b('0xc0'),'pid':_0x4347d4[_0xb20b('0xb1')]});}});})[_0xb20b('0x2d')](handleError(_0x87a948,null));};exports[_0xb20b('0xc1')]=function(_0x139db0,_0x5941b5){var _0x3fa93d=['mail',_0xb20b('0xc2'),_0xb20b('0xc3'),'openchannel','fax','whatsapp','voice'];var _0x564887={'offset':0x0,'order':qs[_0xb20b('0x7d')]('-createdAt')},_0x32cb34={'count':0x0,'rows':[]};Promise[_0xb20b('0xc4')]()[_0xb20b('0x14')](function(){if(_0x139db0[_0xb20b('0x1e')][_0xb20b('0xc5')]){if(!_['includes'](_0x3fa93d,_0x139db0[_0xb20b('0x1e')]['channel'][_0xb20b('0xc6')]())){throw new Error(_0xb20b('0xc7'));}_0x3fa93d=[_0x139db0[_0xb20b('0x1e')]['channel'][_0xb20b('0xc6')]()];}if(_0x139db0[_0xb20b('0x1e')]['range']){try{var _0x4eacb2=JSON[_0xb20b('0xb3')](_0x139db0[_0xb20b('0x1e')][_0xb20b('0xc8')]);if(!moment(_0x4eacb2[_0xb20b('0x30')])[_0xb20b('0xc9')]()){throw new Error('Invalid\x20date\x20for\x20range\x20from\x20filter');}if(!moment(_0x4eacb2['to'])[_0xb20b('0xc9')]()){throw new Error(_0xb20b('0xca'));}}catch(_0x4200c9){throw new Error('Invalid\x20createdAt\x20filter');}}if(!_0x139db0[_0xb20b('0x1e')][_0xb20b('0x2b')](_0xb20b('0x81'))){_0x564887[_0xb20b('0xf')]=qs[_0xb20b('0xf')](_0x139db0[_0xb20b('0x1e')]['limit']||0xa);_0x564887[_0xb20b('0xd')]=qs['offset'](_0x139db0[_0xb20b('0x1e')][_0xb20b('0xd')]);}var _0x426277=_0x3fa93d[_0xb20b('0x66')](function(_0xeab1e0){if(_0xeab1e0==='voice'){var _0x420f7b={'attributes':['id',_0xb20b('0xcb'),_0xb20b('0xcc'),_0xb20b('0xcd'),_0xb20b('0xce'),'callerid',_0xb20b('0xcf'),_0xb20b('0xd0'),_0xb20b('0xd1'),_0xb20b('0xd2'),_0xb20b('0xd3'),_0xb20b('0xd4'),_0xb20b('0xd5'),_0xb20b('0xd6'),_0xb20b('0xd7')],'where':{'ContactId':_0x139db0[_0xb20b('0x21')]['id']},'include':[{'model':db['User'],'as':'User','attributes':['id',_0xb20b('0x19'),_0xb20b('0xd8'),_0xb20b('0xd9')]}],'order':[[_0xb20b('0xd3'),_0xb20b('0xda')]]};if(_0x139db0['query'][_0xb20b('0xc8')]){_0x420f7b[_0xb20b('0x55')]['createdAt']={'$gte':_0x4eacb2[_0xb20b('0x30')],'$lte':_0x4eacb2['to']};}return db[_0xb20b('0xdb')][_0xb20b('0xdc')](_0x420f7b)[_0xb20b('0x14')](function(_0x999ad4){_0x32cb34['count']+=_0x999ad4['count'];return _['map'](_0x999ad4['rows'],function(_0x13b673){var _0x3dbea8=_0x13b673[_0xb20b('0x31')]({'plain':!![]});_0x3dbea8[_0xb20b('0xc5')]=_0xeab1e0;if(_0x3dbea8[_0xb20b('0xb6')]){_0x3dbea8['User']={'id':_0x3dbea8['User']['id'],'name':_0x3dbea8[_0xb20b('0xb6')]['name'],'fullname':_0x3dbea8[_0xb20b('0xb6')][_0xb20b('0xd8')],'alias':_0x3dbea8[_0xb20b('0xb6')][_0xb20b('0xd9')]};}return _0x3dbea8;});});}else{var _0x12e4aa=_[_0xb20b('0xdd')](_0xeab1e0)+(_0xeab1e0===_0xb20b('0xc2')?_0xb20b('0xde'):_0xb20b('0xdf'));var _0x2a4cce={'attributes':['id',_0xb20b('0xe0'),'closedAt',_0xb20b('0xd3'),_0xb20b('0xd2'),_0xb20b('0xe1'),_0xb20b('0xe2'),'thirdDisposition','UserId',_0x12e4aa+'Id'],'where':{'ContactId':_0x139db0['params']['id']},'include':[{'model':db[_0x12e4aa],'as':_0xb20b('0xdf'),'attributes':['id',_0xb20b('0x19'),_0xb20b('0xe3')]},{'model':db['User'],'as':'Owner','attributes':['id','name',_0xb20b('0xd8')]},{'model':db['Tag'],'as':_0xb20b('0x5c'),'attributes':['id','name',_0xb20b('0xe4')],'through':{'attributes':[]}}],'order':[[_0xb20b('0xd3'),_0xb20b('0xda')]]};if(_0x139db0[_0xb20b('0x1e')]['range']){_0x2a4cce[_0xb20b('0x55')][_0xb20b('0xd3')]={'$gte':_0x4eacb2[_0xb20b('0x30')],'$lte':_0x4eacb2['to']};}switch(_0xeab1e0){case _0xb20b('0xc2'):_0x2a4cce[_0xb20b('0x7a')]['push']('browserName','customerIp',_0xb20b('0xe5'),_0xb20b('0xe6'),_0xb20b('0xe7'),_0xb20b('0xe8'),'ratingType',_0xb20b('0xe9'),_0xb20b('0xea'));break;case _0xb20b('0xeb'):_0x2a4cce['attributes'][_0xb20b('0x54')]('subject','substatus');break;case _0xb20b('0xec'):_0x2a4cce[_0xb20b('0x7a')]['push'](_0xb20b('0xed'),_0xb20b('0xee'));break;}return db[_['startCase'](_0xeab1e0)+_0xb20b('0xef')]['findAndCountAll'](_0x2a4cce)[_0xb20b('0x14')](function(_0x5252bf){_0x32cb34[_0xb20b('0x10')]+=_0x5252bf[_0xb20b('0x10')];return _['map'](_0x5252bf[_0xb20b('0x99')],function(_0x12ff17){var _0x3cb4d7=_0x12ff17[_0xb20b('0x31')]({'plain':!![]});_0x3cb4d7[_0xb20b('0xc5')]=_0xeab1e0;if(_0x3cb4d7[_0xb20b('0xf0')]){_0x3cb4d7[_0xb20b('0xf0')]={'id':_0x3cb4d7[_0xb20b('0xf0')]['id'],'name':_0x3cb4d7[_0xb20b('0xf0')]['name'],'fullname':_0x3cb4d7[_0xb20b('0xf0')][_0xb20b('0xd8')]};}return _0x3cb4d7;});});}});return Promise['all'](_0x426277);})[_0xb20b('0x14')](function(_0x4c84cd){return _(_0x4c84cd)[_0xb20b('0xf1')]()['sortBy'](_0xb20b('0xd3'))[_0xb20b('0xf2')]()['value']();})[_0xb20b('0x14')](function(_0x17e3f3){_0x32cb34['rows']=_0x564887['limit']?_0x17e3f3[_0xb20b('0xf3')](_0x564887[_0xb20b('0xd')],_0x564887[_0xb20b('0xd')]+_0x564887['limit']):_0x17e3f3;return _0x32cb34;})[_0xb20b('0x14')](respondWithFilteredResult(_0x5941b5,_0x564887))[_0xb20b('0x2d')](handleError(_0x5941b5,null));}; \ No newline at end of file +var _0x5f98=['status','json','undefined','limit','count','offset','Content-Range','update','then','destroy','end','sendStatus','error','stack','name','index','describe','findAll','query','user','catch','tags','keys','cf_','columnName','analytics','CmCustomField','displayName','alias','custom','info','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','forEach','hasOwnProperty','body','CmContact','from','length','get','mergeWith','isArray','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','ChatInteraction','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','CmHopperFinal','ReportAgentPreview','VoiceCallReport','ChatQueueReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','create','join','dialTimezone','timezones','utcOffset','additionalPhones','bulkCreate','each','duplicates','where','push','ListId','findOrCreate','all','show','find','color','tag','CmContactHasItem','Phones','params','ContactItemType','ItemType','sequelize','Phones.OrderBy','$and','omit','map','format','cf_%d','isNil','isEmpty','table','cm_contacts','setFields','text','values','phone','getTags','findOne','model','filters','intersection','fields','attributes','sort','pick','filter','merge','nolimit','setTags','setAdditionalPhones','OrderBy','items','item_types','ItemTypeId','description','PHONE','literal','CmHopperId','`ItemType`.OrderBy','duplicateAdditionalPhones','fromContactId','CmContactId','toContactId','rawAttributes','order','ContactId','options','includeAll','include','rows','getHopperHistories','CmHopperHistory','getHopperFinals','getJscriptySessions','uploadCsv','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','server/files/tmp','file','filename','chmodSync','0777','child_process','fork','CompanyId','File\x20uploaded\x20correctly!','path','meta','import','User','agent','No\x20ListId\x20specified','binding','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','pid','exit','error\x20child\x20process','importUpdates','../../components/import/cm/csvUpdates','getJourney','chat','sms','openchannel','fax','whatsapp','voice','-createdAt','includes','channel','toLowerCase','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','type','source','destination','callerid','endtime','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','DESC','findAndCountAll','fullname','startCase','closed','closedAt','secondDisposition','thirdDisposition','key','Tag','Tags','customerIp','customerPort','deviceModel','ratingMessage','ratingType','ratingValue','referer','mail','subject','substatus','Interaction','Owner','flatten','sortBy','reverse','moment','util','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/environment/shared','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmContact.socket','register'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x5f98,0x1de));var _0x85f9=function(_0x243b2f,_0x30aa15){_0x243b2f=_0x243b2f-0x0;var _0xcb3c2d=_0x5f98[_0x243b2f];return _0xcb3c2d;};'use strict';var moment=require(_0x85f9('0x0'));var BPromise=require('bluebird');var util=require(_0x85f9('0x1'));var path=require('path');var fs=require('fs');var _=require('lodash');var squel=require(_0x85f9('0x2'));var Papa=require('papaparse');var Redis=require(_0x85f9('0x3'));var contacts=require('../../components/contacts');var qs=require(_0x85f9('0x4'));var logger=require(_0x85f9('0x5'))(_0x85f9('0x6'));var config=require(_0x85f9('0x7'));var shared=require(_0x85f9('0x8'));var db=require(_0x85f9('0x9'))['db'];config[_0x85f9('0xa')]=_[_0x85f9('0xb')](config[_0x85f9('0xa')],{'host':_0x85f9('0xc'),'port':0x18eb});var socket=require(_0x85f9('0xd'))(new Redis(config[_0x85f9('0xa')]));require(_0x85f9('0xe'))[_0x85f9('0xf')](socket);function respondWithResult(_0x11ca1d,_0x547827){_0x547827=_0x547827||0xc8;return function(_0x210451){if(_0x210451){return _0x11ca1d[_0x85f9('0x10')](_0x547827)[_0x85f9('0x11')](_0x210451);}};}function respondWithFilteredResult(_0x497fcb,_0x3b3dc5){return function(_0x442d4f){if(_0x442d4f){var _0x4f52f2=typeof _0x3b3dc5['offset']===_0x85f9('0x12')&&typeof _0x3b3dc5[_0x85f9('0x13')]===_0x85f9('0x12');var _0x3aee2f=_0x442d4f[_0x85f9('0x14')];var _0x3b9113=_0x4f52f2?0x0:_0x3b3dc5[_0x85f9('0x15')];var _0x3d474c=_0x4f52f2?_0x442d4f[_0x85f9('0x14')]:_0x3b3dc5[_0x85f9('0x15')]+_0x3b3dc5[_0x85f9('0x13')];var _0x3fb579;if(_0x3d474c>=_0x3aee2f){_0x3d474c=_0x3aee2f;_0x3fb579=0xc8;}else{_0x3fb579=0xce;}_0x497fcb['status'](_0x3fb579);return _0x497fcb['set'](_0x85f9('0x16'),_0x3b9113+'-'+_0x3d474c+'/'+_0x3aee2f)[_0x85f9('0x11')](_0x442d4f);}return null;};}function saveUpdates(_0x332eaf){return function(_0x3f6601){if(_0x3f6601){return _0x3f6601[_0x85f9('0x17')](_0x332eaf)[_0x85f9('0x18')](function(_0x389145){return _0x389145;});}return null;};}function removeEntity(_0x23a5e5){return function(_0x7990cb){if(_0x7990cb){return _0x7990cb[_0x85f9('0x19')]()['then'](function(){_0x23a5e5[_0x85f9('0x10')](0xcc)[_0x85f9('0x1a')]();});}};}function handleEntityNotFound(_0x3ef23e){return function(_0x4dfc91){if(!_0x4dfc91){_0x3ef23e[_0x85f9('0x1b')](0x194);}return _0x4dfc91;};}function handleError(_0x1f6752,_0x5b3ced){_0x5b3ced=_0x5b3ced||0x1f4;return function(_0x3f6cfd){logger[_0x85f9('0x1c')](_0x3f6cfd[_0x85f9('0x1d')]);if(_0x3f6cfd[_0x85f9('0x1e')]){delete _0x3f6cfd[_0x85f9('0x1e')];}_0x1f6752[_0x85f9('0x10')](_0x5b3ced)['send'](_0x3f6cfd);};}exports[_0x85f9('0x1f')]=function(_0x1fd340,_0x23c266){var _0x3b71c8={};return contacts[_0x85f9('0x20')]()[_0x85f9('0x18')](function(_0xa5c08){_0x3b71c8=qs['getOptions'](_0xa5c08,_0x1fd340);return contacts[_0x85f9('0x21')](_0x1fd340[_0x85f9('0x22')],_0x1fd340[_0x85f9('0x23')],_0x3b71c8,_0xa5c08);})[_0x85f9('0x18')](respondWithFilteredResult(_0x23c266,_0x3b71c8))[_0x85f9('0x24')](handleError(_0x23c266,null));};exports[_0x85f9('0x19')]=function(_0x5220cc,_0x402efb){return db['CmContact']['find']({'where':{'id':_0x5220cc['params']['id']}})[_0x85f9('0x18')](handleEntityNotFound(_0x402efb,null))[_0x85f9('0x18')](removeEntity(_0x402efb,null))[_0x85f9('0x24')](handleError(_0x402efb,null));};exports[_0x85f9('0x20')]=function(_0xfbad82,_0x11dc61){return db['CmContact'][_0x85f9('0x20')]()['then'](function(_0x120bea){delete _0x120bea[_0x85f9('0x25')];for(var _0x25bd5f=0x0;_0x25bd5f0x0){return new Promise(function(_0x64ecb8){var _0x40e516=[];for(var _0x5311fd=0x0;_0x5311fd<_0x2779d0[_0x85f9('0x35')];_0x5311fd++){_0x40e516['push'](insertAdditionalPhones(_0x2779d0[_0x5311fd]['contact'],_0x2779d0[_0x5311fd][_0x85f9('0x56')]));}Promise[_0x85f9('0x5e')](_0x40e516)[_0x85f9('0x18')](function(){_0x64ecb8(0x1);});})[_0x85f9('0x18')](function(){return{'success':_0xca83a6,'failure':_0x1c0453,'duplicates':_0x2e2981};});}else{return{'success':_0xca83a6,'failure':_0x1c0453,'duplicates':_0x2e2981};}}})[_0x85f9('0x18')](respondWithResult(_0x1a052e,0xc9))['catch'](handleError(_0x1a052e,null));};exports[_0x85f9('0x5f')]=function(_0x5155b6,_0x26bfb2){var _0x51d50a;return db[_0x85f9('0x33')][_0x85f9('0x20')]()[_0x85f9('0x18')](function(_0x4b80d5){return db[_0x85f9('0x33')][_0x85f9('0x60')]({'where':{'id':_0x5155b6['params']['id']},'include':[{'model':db['Tag'],'as':'Tags','attributes':['id',_0x85f9('0x1e'),_0x85f9('0x61')],'required':_0x5155b6[_0x85f9('0x22')][_0x85f9('0x62')]?!![]:![]},{'model':db[_0x85f9('0x63')],'as':_0x85f9('0x64'),'where':{'CmContactId':_0x5155b6[_0x85f9('0x65')]['id']},'required':![],'include':[{'model':db[_0x85f9('0x66')],'as':_0x85f9('0x67')}]}],'order':[db[_0x85f9('0x68')]['literal'](_0x85f9('0x69'))],'attributes':_[_0x85f9('0x26')](_0x4b80d5)});})['then'](function(_0x5c77d3){if(!_['isNil'](_0x5c77d3)){_0x51d50a=_0x5c77d3[_0x85f9('0x36')]({'plain':!![]});var _0x7e6df7={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x5c77d3&&_0x5c77d3[_0x85f9('0x5c')]){if(_0x5c77d3['ListId']){_0x7e6df7[_0x85f9('0x5a')][_0x85f9('0x6a')][_0x85f9('0x5b')]({'ListId':{'$ne':_0x5c77d3['ListId']}});}}return db[_0x85f9('0x2a')][_0x85f9('0x21')](_0x7e6df7);}})[_0x85f9('0x18')](function(_0x2c6571){if(!_['isNil'](_0x2c6571)){return _[_0x85f9('0x6b')](_0x51d50a,_[_0x85f9('0x6c')](_0x2c6571,function(_0x1be5a6){return util[_0x85f9('0x6d')](_0x85f9('0x6e'),_0x1be5a6['id']);}));}})[_0x85f9('0x18')](handleEntityNotFound(_0x26bfb2,null))[_0x85f9('0x18')](respondWithResult(_0x26bfb2,null))[_0x85f9('0x24')](handleError(_0x26bfb2,null));};exports[_0x85f9('0x17')]=function(_0x4af0e0,_0x14249e){var _0x5666e4;if(_0x4af0e0['body']['id']){delete _0x4af0e0[_0x85f9('0x32')]['id'];}if(!_[_0x85f9('0x6f')](_0x4af0e0[_0x85f9('0x32')][_0x85f9('0x53')])){var _0x52bc48=_0x4af0e0[_0x85f9('0x32')][_0x85f9('0x53')];if(!_[_0x85f9('0x6f')](shared['timezones'][_0x52bc48]))_0x4af0e0['body'][_0x85f9('0x55')]=shared[_0x85f9('0x54')][_0x52bc48]['utcOffset'];}return db['CmContact'][_0x85f9('0x60')]({'where':{'id':_0x4af0e0[_0x85f9('0x65')]['id']}})[_0x85f9('0x18')](handleEntityNotFound(_0x14249e,null))[_0x85f9('0x18')](saveUpdates(_0x4af0e0[_0x85f9('0x32')],null))['then'](function(_0x1e3c84){_0x5666e4=_0x1e3c84;var _0x56c914={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x1e3c84&&_0x1e3c84[_0x85f9('0x5c')]){if(_0x1e3c84[_0x85f9('0x5c')]){_0x56c914[_0x85f9('0x5a')][_0x85f9('0x6a')][_0x85f9('0x5b')]({'ListId':{'$ne':_0x1e3c84[_0x85f9('0x5c')]}});}}return db[_0x85f9('0x2a')]['findAll'](_0x56c914);})[_0x85f9('0x18')](function(_0x1b2d01){if(_0x1b2d01){return _[_0x85f9('0x6b')](_['pickBy'](_0x4af0e0['body'],function(_0x13c241,_0x273252){return _['startsWith'](_0x273252,_0x85f9('0x27'));}),_[_0x85f9('0x6c')](_0x1b2d01,function(_0x467d83){return util[_0x85f9('0x6d')](_0x85f9('0x6e'),_0x467d83['id']);}));}})[_0x85f9('0x18')](function(_0x3b82b1){if(_0x3b82b1&&!_[_0x85f9('0x70')](_0x3b82b1)){var _0x302024=squel['update']()[_0x85f9('0x71')](_0x85f9('0x72'))[_0x85f9('0x73')](_0x3b82b1)[_0x85f9('0x5a')]('id\x20=\x20?',_0x4af0e0['params']['id'])['toParam']();return db[_0x85f9('0x68')][_0x85f9('0x22')](_0x302024[_0x85f9('0x74')],{'replacements':_0x302024[_0x85f9('0x75')]});}})[_0x85f9('0x18')](function(){if(_0x4af0e0[_0x85f9('0x32')][_0x85f9('0x76')]&&_0x5666e4){return db[_0x85f9('0x39')][_0x85f9('0x17')]({'phone':_0x4af0e0[_0x85f9('0x32')]['phone'],'OrderBy':0x0},{'where':{'ContactId':_0x5666e4['id']}});}})[_0x85f9('0x18')](function(){return _0x5666e4;})[_0x85f9('0x18')](respondWithResult(_0x14249e,null))['catch'](handleError(_0x14249e,null));};exports[_0x85f9('0x77')]=function(_0x13bbec,_0x1723a9){var _0x332213={};var _0x53bf79={};var _0x3dd555;var _0x1cc47d;return db['CmContact'][_0x85f9('0x78')]({'where':{'id':_0x13bbec[_0x85f9('0x65')]['id']}})[_0x85f9('0x18')](handleEntityNotFound(_0x1723a9,null))[_0x85f9('0x18')](function(_0x220aba){if(_0x220aba){_0x3dd555=_0x220aba;_0x53bf79[_0x85f9('0x79')]=_[_0x85f9('0x26')](db['Tag']['rawAttributes']);_0x53bf79[_0x85f9('0x22')]=_['keys'](_0x13bbec['query']);_0x53bf79[_0x85f9('0x7a')]=_[_0x85f9('0x7b')](_0x53bf79['model'],_0x53bf79['query']);_0x332213['attributes']=_[_0x85f9('0x7b')](_0x53bf79[_0x85f9('0x79')],qs[_0x85f9('0x7c')](_0x13bbec[_0x85f9('0x22')][_0x85f9('0x7c')]));_0x332213[_0x85f9('0x7d')]=_0x332213[_0x85f9('0x7d')]['length']?_0x332213[_0x85f9('0x7d')]:_0x53bf79[_0x85f9('0x79')];_0x332213['order']=qs[_0x85f9('0x7e')](_0x13bbec['query']['sort']);_0x332213[_0x85f9('0x5a')]=qs[_0x85f9('0x7a')](_[_0x85f9('0x7f')](_0x13bbec[_0x85f9('0x22')],_0x53bf79[_0x85f9('0x7a')]));if(_0x13bbec[_0x85f9('0x22')][_0x85f9('0x80')]){_0x332213[_0x85f9('0x5a')]=_[_0x85f9('0x81')](_0x332213[_0x85f9('0x5a')],{'$or':_[_0x85f9('0x6c')](_0x332213[_0x85f9('0x7d')],function(_0xb90a3a){var _0x4151f8={};_0x4151f8[_0xb90a3a]={'$like':'%'+_0x13bbec[_0x85f9('0x22')][_0x85f9('0x80')]+'%'};return _0x4151f8;})});}_0x332213=_[_0x85f9('0x81')]({},_0x332213,_0x13bbec['options']);return _0x3dd555[_0x85f9('0x77')](_0x332213);}})['then'](function(_0x2db84b){if(_0x2db84b){_0x1cc47d=_0x2db84b[_0x85f9('0x35')];if(!_0x13bbec[_0x85f9('0x22')][_0x85f9('0x31')](_0x85f9('0x82'))){_0x332213['limit']=qs['limit'](_0x13bbec[_0x85f9('0x22')][_0x85f9('0x13')]);_0x332213[_0x85f9('0x15')]=qs[_0x85f9('0x15')](_0x13bbec[_0x85f9('0x22')]['offset']);}return _0x3dd555[_0x85f9('0x77')](_0x332213);}})[_0x85f9('0x18')](function(_0x4fc5ec){if(_0x4fc5ec){return _0x4fc5ec?{'count':_0x1cc47d,'rows':_0x4fc5ec}:null;}})[_0x85f9('0x18')](respondWithResult(_0x1723a9,null))[_0x85f9('0x24')](handleError(_0x1723a9,null));};exports['setTags']=function(_0x2985bf,_0x198928){if(_0x2985bf[_0x85f9('0x32')]['id']){delete _0x2985bf[_0x85f9('0x32')]['id'];}return db[_0x85f9('0x33')]['findOne']({'where':{'id':_0x2985bf[_0x85f9('0x65')]['id']}})[_0x85f9('0x18')](handleEntityNotFound(_0x198928,null))[_0x85f9('0x18')](function(_0x58f7b2){if(_0x58f7b2){return _0x58f7b2[_0x85f9('0x83')](_0x2985bf[_0x85f9('0x32')]['ids']||[]);}return null;})['then'](respondWithResult(_0x198928,null))['catch'](handleError(_0x198928,null));};exports[_0x85f9('0x84')]=function(_0x565026,_0x1a3d23){var _0x1f38ff=[];_0x1f38ff[_0x85f9('0x5b')](addAdditionalPhones(_0x565026[_0x85f9('0x32')]));Promise['all'](_0x1f38ff)['then'](function(){_0x1f38ff=[];_0x1f38ff[_0x85f9('0x5b')](deleteCmHopperPhones(_0x565026[_0x85f9('0x32')]['id']));_0x1f38ff[_0x85f9('0x5b')](addCmHopperPhones(_0x565026[_0x85f9('0x32')]['id']));Promise['all'](_0x1f38ff)[_0x85f9('0x18')](function(){return[0x1];})[_0x85f9('0x18')](respondWithResult(_0x1a3d23,null));});};function addAdditionalPhones(_0x5494d5){var _0x2d31a;return new Promise(function(_0x37f02e){return db[_0x85f9('0x63')][_0x85f9('0x19')]({'where':{'CmContactId':_0x5494d5['id']}})[_0x85f9('0x18')](function(){db['ContactItemType'][_0x85f9('0x21')]({'raw':!![],'attributes':['id',_0x85f9('0x85')]})[_0x85f9('0x18')](function(_0x736f26){var _0x59f74f=[];for(var _0x4e6319=0x0;_0x4e6319<_0x5494d5[_0x85f9('0x86')][_0x85f9('0x35')];_0x4e6319++){var _0x8cfaaa=_0x5494d5[_0x85f9('0x87')]?_[_0x85f9('0x6f')](_0x5494d5['item_types'][_0x4e6319])?'':_0x5494d5[_0x85f9('0x87')][_0x4e6319]:_0x5494d5[_0x85f9('0x86')][_0x4e6319][_0x85f9('0x88')]?_0x5494d5['items'][_0x4e6319][_0x85f9('0x88')]:'';var _0x112887=_[_0x85f9('0x6f')](_0x5494d5[_0x85f9('0x86')][_0x4e6319][_0x85f9('0x89')])?'':_0x5494d5[_0x85f9('0x86')][_0x4e6319]['description'];var _0x58cd10=_0x8cfaaa+':'+_0x5494d5[_0x85f9('0x86')][_0x4e6319][_0x85f9('0x76')]+'§'+_0x112887;if(_[_0x85f9('0x6f')](_0x2d31a))_0x2d31a=_0x58cd10;else _0x2d31a+=';'+_0x58cd10;var _0x4a75e3=null;var _0xe10e65=null;if(_0x5494d5[_0x85f9('0x87')]){if(!_[_0x85f9('0x6f')](_0x5494d5[_0x85f9('0x87')][_0x4e6319])){_0xe10e65=_[_0x85f9('0x60')](_0x736f26,function(_0x41aa70){return _0x41aa70['id']===_0x5494d5[_0x85f9('0x87')][_0x4e6319];});if(!_[_0x85f9('0x6f')](_0xe10e65)){_0x4a75e3=_0xe10e65[_0x85f9('0x85')];}}}else{if(!_['isNil'](_0x5494d5[_0x85f9('0x86')][_0x4e6319])){_0xe10e65=_[_0x85f9('0x60')](_0x736f26,function(_0x3b0ec3){return _0x3b0ec3['id']===_0x5494d5[_0x85f9('0x86')][_0x4e6319]['ItemTypeId'];});if(!_[_0x85f9('0x6f')](_0xe10e65)){_0x4a75e3=_0x4e6319;}}}if(_['isNil'](_0x4a75e3)){_0x4a75e3=0x64;}_0x59f74f[_0x85f9('0x5b')](addAdditionalPhone(_0x5494d5['id'],_0x5494d5['items'][_0x4e6319]['phone'],_0x5494d5[_0x85f9('0x87')]?_[_0x85f9('0x6f')](_0x5494d5[_0x85f9('0x87')][_0x4e6319])?null:_0x5494d5['item_types'][_0x4e6319]:_0x5494d5[_0x85f9('0x86')][_0x4e6319][_0x85f9('0x88')]?_0x5494d5[_0x85f9('0x86')][_0x4e6319]['ItemTypeId']:null,_0x4a75e3,_0x112887));}Promise[_0x85f9('0x5e')](_0x59f74f)[_0x85f9('0x18')](function(){db['CmContact'][_0x85f9('0x17')]({'AdditionalPhones':_0x2d31a},{'where':{'id':_0x5494d5['id']}})[_0x85f9('0x18')](function(){_0x37f02e(0x1);});});});});});}function addAdditionalPhone(_0x506c0b,_0x2d4d42,_0x3276ba,_0x241e63,_0x6a762a){return db['CmContactHasItem']['find']({'where':{'CmContactId':_0x506c0b,'item':_0x2d4d42}})[_0x85f9('0x18')](function(_0xcd5966){if(_0xcd5966)logger[_0x85f9('0x2e')]('contact\x20phone\x20exists',_0xcd5966);else{db[_0x85f9('0x63')][_0x85f9('0x51')]({'CmContactId':_0x506c0b,'item':_0x2d4d42,'ItemTypeId':_0x3276ba,'OrderBy':_0x241e63,'ItemClass':_0x85f9('0x8a'),'description':_0x6a762a});}});}function deleteCmHopperPhones(_0x5a45bd){return new Promise(function(_0x11ef55){return db['CmHopper']['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x5a45bd}})[_0x85f9('0x18')](function(_0x1cc2b5){db['CmHopperAdditionalPhone'][_0x85f9('0x19')]({'where':{'CmHopperId':{'$in':_[_0x85f9('0x6c')](_0x1cc2b5,'id')}}});})[_0x85f9('0x18')](function(){_0x11ef55(0x1);});});}function addCmHopperPhones(_0x15fd04){return new Promise(function(_0x5d76fe){return db['CmHopper'][_0x85f9('0x21')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x15fd04}})[_0x85f9('0x18')](function(_0x4ecf4b){var _0x4b7112=[];_[_0x85f9('0x6c')](_0x4ecf4b,function(_0x27ffad){_0x4b7112[_0x85f9('0x5b')](createCmHopperPhone(_0x15fd04,_0x27ffad['id']));});Promise[_0x85f9('0x5e')](_0x4b7112)[_0x85f9('0x18')](function(){_0x5d76fe(0x1);});});});}function createCmHopperPhone(_0x364907,_0x587232){return new Promise(function(_0x3e67b2){db[_0x85f9('0x63')][_0x85f9('0x21')]({'raw':!![],'attributes':['item',_0x85f9('0x85')],'where':{'CmContactId':_0x364907,'ItemClass':_0x85f9('0x8a')},'include':[{'model':db[_0x85f9('0x66')],'attributes':[_0x85f9('0x85')],'as':_0x85f9('0x67')}],'order':['OrderBy',db[_0x85f9('0x68')][_0x85f9('0x8b')]('`ItemType`.OrderBy')]})[_0x85f9('0x18')](function(_0x383cee){var _0x50c987=0x1;var _0x1dac40=_[_0x85f9('0x6c')](_0x383cee,function(_0x7036cb){_0x7036cb[_0x85f9('0x8c')]=_0x587232;_0x7036cb[_0x85f9('0x76')]=_0x7036cb['item'];_0x7036cb[_0x85f9('0x85')]=_0x50c987;delete _0x7036cb['ItemType.OrderBy'];_0x50c987=_0x50c987+0x1;return _0x7036cb;});return db['CmHopperAdditionalPhone'][_0x85f9('0x57')](_0x1dac40,{});})[_0x85f9('0x18')](function(){_0x3e67b2(0x1);});});}function insertAdditionalPhones(_0x4b7bce,_0x275768){return new Promise(function(_0x5795e7){var _0x1eab9e=[];for(var _0x560194=0x0;_0x560194<_0x275768['length'];_0x560194++){var _0x292fd0=_0x275768[_0x560194];_0x1eab9e[_0x85f9('0x5b')](parseContactItemType(_0x292fd0));}Promise[_0x85f9('0x5e')](_0x1eab9e)[_0x85f9('0x18')](function(){var _0x7c679a={'id':_0x4b7bce['id'],'items':_0x275768};return addAdditionalPhones(_0x7c679a)['then'](function(){return addCmHopperPhones(_0x4b7bce['id']);});})['then'](function(){_0x5795e7(_0x4b7bce);});});}function parseContactItemType(_0x26dc87){return new Promise(function(_0x35326f){if(_0x26dc87['hasOwnProperty']('ItemTypeId')){_0x35326f(_0x26dc87);}else{return db['ContactItemType']['find']({'where':{'name':_0x26dc87[_0x85f9('0x67')]}})['then'](function(_0x439510){if(_[_0x85f9('0x6f')](_0x439510))_0x26dc87['ItemTypeId']=null;else _0x26dc87[_0x85f9('0x88')]=_0x439510['id'];_0x35326f(_0x26dc87);});}});}exports['getAdditionalPhones']=function(_0x4069b8,_0x2e0ff1){return db[_0x85f9('0x63')][_0x85f9('0x21')]({'raw':!![],'where':{'CmContactId':_0x4069b8['params']['id'],'ItemClass':_0x85f9('0x8a')},'include':[{'model':db[_0x85f9('0x66')],'as':_0x85f9('0x67')}],'order':[[_0x85f9('0x85')],[db['sequelize'][_0x85f9('0x8b')](_0x85f9('0x8d'))]]})['then'](function(_0x1fdb73){return _0x1fdb73;})[_0x85f9('0x18')](respondWithResult(_0x2e0ff1,null))[_0x85f9('0x24')](handleError(_0x2e0ff1,null));};exports[_0x85f9('0x8e')]=function(_0x187208,_0x856191){return db[_0x85f9('0x63')]['findAll']({'raw':!![],'where':{'CmContactId':_0x187208[_0x85f9('0x32')][_0x85f9('0x8f')]}})['then'](function(_0x5ef1bc){var _0x3d336b=_[_0x85f9('0x6c')](_0x5ef1bc,function(_0x46c7cc){_0x46c7cc[_0x85f9('0x90')]=_0x187208[_0x85f9('0x32')]['toContactId'];return _0x46c7cc;});return db[_0x85f9('0x63')][_0x85f9('0x57')](_0x3d336b,{});})[_0x85f9('0x18')](function(){return addCmHopperPhones(_0x187208[_0x85f9('0x32')][_0x85f9('0x91')]);})[_0x85f9('0x18')](function(){return['ok'];})[_0x85f9('0x18')](respondWithResult(_0x856191,null))[_0x85f9('0x24')](handleError(_0x856191,null));};exports['rescheduleAdditionalPhones']=function(_0x1de9b4,_0x5c116d){var _0x348a3a=[];_0x348a3a[_0x85f9('0x5b')](createCmHopperPhone(_0x1de9b4[_0x85f9('0x32')]['id'],_0x1de9b4[_0x85f9('0x32')]['hopperId']));Promise[_0x85f9('0x5e')](_0x348a3a)[_0x85f9('0x18')](function(){return[0x1];})[_0x85f9('0x18')](respondWithResult(_0x5c116d,null));};exports['getHoppers']=function(_0x28d460,_0x32ca0c){var _0x502a0a={'raw':![],'where':{}};var _0x5ed7c4={};var _0x2c446a={'count':0x0,'rows':[]};return db[_0x85f9('0x33')][_0x85f9('0x78')]({'where':{'id':_0x28d460[_0x85f9('0x65')]['id']}})[_0x85f9('0x18')](handleEntityNotFound(_0x32ca0c,null))[_0x85f9('0x18')](function(_0xa0fe57){if(_0xa0fe57){_0x5ed7c4[_0x85f9('0x79')]=_['keys'](db[_0x85f9('0x39')][_0x85f9('0x92')]);_0x5ed7c4['query']=_[_0x85f9('0x26')](_0x28d460[_0x85f9('0x22')]);_0x5ed7c4[_0x85f9('0x7a')]=_['intersection'](_0x5ed7c4['model'],_0x5ed7c4[_0x85f9('0x22')]);_0x502a0a[_0x85f9('0x7d')]=_[_0x85f9('0x7b')](_0x5ed7c4[_0x85f9('0x79')],qs[_0x85f9('0x7c')](_0x28d460['query'][_0x85f9('0x7c')]));_0x502a0a[_0x85f9('0x7d')]=_0x502a0a['attributes'][_0x85f9('0x35')]?_0x502a0a['attributes']:_0x5ed7c4['model'];if(!_0x28d460[_0x85f9('0x22')][_0x85f9('0x31')]('nolimit')){_0x502a0a[_0x85f9('0x13')]=qs[_0x85f9('0x13')](_0x28d460[_0x85f9('0x22')]['limit']);_0x502a0a['offset']=qs['offset'](_0x28d460[_0x85f9('0x22')][_0x85f9('0x15')]);}_0x502a0a[_0x85f9('0x93')]=qs['sort'](_0x28d460[_0x85f9('0x22')]['sort']);_0x502a0a[_0x85f9('0x5a')]=qs[_0x85f9('0x7a')](_[_0x85f9('0x7f')](_0x28d460[_0x85f9('0x22')],_0x5ed7c4[_0x85f9('0x7a')]));_0x502a0a[_0x85f9('0x5a')][_0x85f9('0x94')]=_0xa0fe57['id'];if(_0x28d460[_0x85f9('0x22')]['filter']){_0x502a0a[_0x85f9('0x5a')]=_[_0x85f9('0x81')](_0x502a0a[_0x85f9('0x5a')],{'$or':_[_0x85f9('0x6c')](_0x502a0a[_0x85f9('0x7d')],function(_0x278728){var _0x5e3025={};_0x5e3025[_0x278728]={'$like':'%'+_0x28d460['query'][_0x85f9('0x80')]+'%'};return _0x5e3025;})});}_0x502a0a=_['merge']({},_0x502a0a,_0x28d460[_0x85f9('0x95')]);return db[_0x85f9('0x39')][_0x85f9('0x14')]({'where':_0x502a0a['where']})[_0x85f9('0x18')](function(_0x2edb20){_0x2c446a['count']=_0x2edb20;if(_0x28d460[_0x85f9('0x22')][_0x85f9('0x96')]){_0x502a0a[_0x85f9('0x97')]=[{'all':!![]}];}return db[_0x85f9('0x39')][_0x85f9('0x21')](_0x502a0a);})[_0x85f9('0x18')](function(_0x1fd5e4){_0x2c446a[_0x85f9('0x98')]=_0x1fd5e4;return _0x2c446a;});}})[_0x85f9('0x18')](respondWithFilteredResult(_0x32ca0c,_0x502a0a))['catch'](handleError(_0x32ca0c,null));};exports[_0x85f9('0x99')]=function(_0x28d778,_0x20a41c){var _0x3c46bd={'raw':!![],'where':{}};var _0x3b8419={};var _0x1eb521={'count':0x0,'rows':[]};return db[_0x85f9('0x33')][_0x85f9('0x78')]({'where':{'id':_0x28d778['params']['id']}})['then'](handleEntityNotFound(_0x20a41c,null))['then'](function(_0x4bfad0){if(_0x4bfad0){_0x3b8419[_0x85f9('0x79')]=_[_0x85f9('0x26')](db[_0x85f9('0x9a')]['rawAttributes']);_0x3b8419[_0x85f9('0x22')]=_['keys'](_0x28d778['query']);_0x3b8419[_0x85f9('0x7a')]=_[_0x85f9('0x7b')](_0x3b8419[_0x85f9('0x79')],_0x3b8419['query']);_0x3c46bd[_0x85f9('0x7d')]=_[_0x85f9('0x7b')](_0x3b8419[_0x85f9('0x79')],qs[_0x85f9('0x7c')](_0x28d778['query']['fields']));_0x3c46bd[_0x85f9('0x7d')]=_0x3c46bd[_0x85f9('0x7d')][_0x85f9('0x35')]?_0x3c46bd[_0x85f9('0x7d')]:_0x3b8419['model'];if(!_0x28d778[_0x85f9('0x22')][_0x85f9('0x31')]('nolimit')){_0x3c46bd[_0x85f9('0x13')]=qs[_0x85f9('0x13')](_0x28d778[_0x85f9('0x22')][_0x85f9('0x13')]);_0x3c46bd['offset']=qs[_0x85f9('0x15')](_0x28d778[_0x85f9('0x22')]['offset']);}_0x3c46bd['order']=qs[_0x85f9('0x7e')](_0x28d778[_0x85f9('0x22')][_0x85f9('0x7e')]);_0x3c46bd['where']=qs[_0x85f9('0x7a')](_['pick'](_0x28d778[_0x85f9('0x22')],_0x3b8419['filters']));_0x3c46bd['where'][_0x85f9('0x94')]=_0x4bfad0['id'];if(_0x28d778[_0x85f9('0x22')]['filter']){_0x3c46bd[_0x85f9('0x5a')]=_[_0x85f9('0x81')](_0x3c46bd[_0x85f9('0x5a')],{'$or':_['map'](_0x3c46bd['attributes'],function(_0x35e6e4){var _0x50fc78={};_0x50fc78[_0x35e6e4]={'$like':'%'+_0x28d778[_0x85f9('0x22')][_0x85f9('0x80')]+'%'};return _0x50fc78;})});}_0x3c46bd=_['merge']({},_0x3c46bd,_0x28d778[_0x85f9('0x95')]);return db['CmHopperHistory']['count']({'where':_0x3c46bd[_0x85f9('0x5a')]})['then'](function(_0x3470ff){_0x1eb521[_0x85f9('0x14')]=_0x3470ff;if(_0x28d778['query'][_0x85f9('0x96')]){_0x3c46bd['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0x85f9('0x21')](_0x3c46bd);})[_0x85f9('0x18')](function(_0x374a8d){_0x1eb521[_0x85f9('0x98')]=_0x374a8d;return _0x1eb521;});}})[_0x85f9('0x18')](respondWithFilteredResult(_0x20a41c,_0x3c46bd))[_0x85f9('0x24')](handleError(_0x20a41c,null));};exports[_0x85f9('0x9b')]=function(_0x402a1f,_0x19c9f1){var _0x156359={'raw':!![],'where':{}};var _0x4b70ae={};var _0x53b335={'count':0x0,'rows':[]};return db['CmContact'][_0x85f9('0x78')]({'where':{'id':_0x402a1f['params']['id']}})[_0x85f9('0x18')](handleEntityNotFound(_0x19c9f1,null))['then'](function(_0x40a988){if(_0x40a988){_0x4b70ae[_0x85f9('0x79')]=_['keys'](db['CmHopperFinal']['rawAttributes']);_0x4b70ae[_0x85f9('0x22')]=_[_0x85f9('0x26')](_0x402a1f[_0x85f9('0x22')]);_0x4b70ae['filters']=_['intersection'](_0x4b70ae[_0x85f9('0x79')],_0x4b70ae[_0x85f9('0x22')]);_0x156359['attributes']=_[_0x85f9('0x7b')](_0x4b70ae['model'],qs[_0x85f9('0x7c')](_0x402a1f[_0x85f9('0x22')]['fields']));_0x156359[_0x85f9('0x7d')]=_0x156359[_0x85f9('0x7d')][_0x85f9('0x35')]?_0x156359[_0x85f9('0x7d')]:_0x4b70ae[_0x85f9('0x79')];if(!_0x402a1f[_0x85f9('0x22')]['hasOwnProperty'](_0x85f9('0x82'))){_0x156359[_0x85f9('0x13')]=qs[_0x85f9('0x13')](_0x402a1f[_0x85f9('0x22')][_0x85f9('0x13')]);_0x156359[_0x85f9('0x15')]=qs[_0x85f9('0x15')](_0x402a1f[_0x85f9('0x22')][_0x85f9('0x15')]);}_0x156359[_0x85f9('0x93')]=qs[_0x85f9('0x7e')](_0x402a1f[_0x85f9('0x22')]['sort']);_0x156359[_0x85f9('0x5a')]=qs[_0x85f9('0x7a')](_[_0x85f9('0x7f')](_0x402a1f[_0x85f9('0x22')],_0x4b70ae[_0x85f9('0x7a')]));_0x156359[_0x85f9('0x5a')][_0x85f9('0x94')]=_0x40a988['id'];if(_0x402a1f[_0x85f9('0x22')][_0x85f9('0x80')]){_0x156359[_0x85f9('0x5a')]=_[_0x85f9('0x81')](_0x156359[_0x85f9('0x5a')],{'$or':_['map'](_0x156359[_0x85f9('0x7d')],function(_0x43f558){var _0x45f711={};_0x45f711[_0x43f558]={'$like':'%'+_0x402a1f[_0x85f9('0x22')][_0x85f9('0x80')]+'%'};return _0x45f711;})});}_0x156359=_[_0x85f9('0x81')]({},_0x156359,_0x402a1f[_0x85f9('0x95')]);return db['CmHopperFinal'][_0x85f9('0x14')]({'where':_0x156359['where']})[_0x85f9('0x18')](function(_0x53d818){_0x53b335[_0x85f9('0x14')]=_0x53d818;if(_0x402a1f['query'][_0x85f9('0x96')]){_0x156359[_0x85f9('0x97')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x85f9('0x21')](_0x156359);})[_0x85f9('0x18')](function(_0x41442b){_0x53b335['rows']=_0x41442b;return _0x53b335;});}})['then'](respondWithFilteredResult(_0x19c9f1,_0x156359))[_0x85f9('0x24')](handleError(_0x19c9f1,null));};exports[_0x85f9('0x9c')]=function(_0xfbc21d,_0xf2e939){var _0x2a34db={'raw':!![],'where':{}};var _0x15982f={};var _0x19c6d3={'count':0x0,'rows':[]};return db['CmContact'][_0x85f9('0x78')]({'where':{'id':_0xfbc21d[_0x85f9('0x65')]['id']}})[_0x85f9('0x18')](handleEntityNotFound(_0xf2e939,null))['then'](function(_0x375a1c){if(_0x375a1c){_0x15982f['model']=_[_0x85f9('0x26')](db[_0x85f9('0x4e')][_0x85f9('0x92')]);_0x15982f[_0x85f9('0x22')]=_[_0x85f9('0x26')](_0xfbc21d[_0x85f9('0x22')]);_0x15982f[_0x85f9('0x7a')]=_[_0x85f9('0x7b')](_0x15982f[_0x85f9('0x79')],_0x15982f['query']);_0x2a34db[_0x85f9('0x7d')]=_['intersection'](_0x15982f[_0x85f9('0x79')],qs[_0x85f9('0x7c')](_0xfbc21d[_0x85f9('0x22')][_0x85f9('0x7c')]));_0x2a34db[_0x85f9('0x7d')]=_0x2a34db[_0x85f9('0x7d')][_0x85f9('0x35')]?_0x2a34db[_0x85f9('0x7d')]:_0x15982f[_0x85f9('0x79')];if(!_0xfbc21d[_0x85f9('0x22')][_0x85f9('0x31')](_0x85f9('0x82'))){_0x2a34db[_0x85f9('0x13')]=qs['limit'](_0xfbc21d[_0x85f9('0x22')][_0x85f9('0x13')]);_0x2a34db[_0x85f9('0x15')]=qs[_0x85f9('0x15')](_0xfbc21d[_0x85f9('0x22')][_0x85f9('0x15')]);}_0x2a34db[_0x85f9('0x93')]=qs[_0x85f9('0x7e')](_0xfbc21d['query'][_0x85f9('0x7e')]);_0x2a34db[_0x85f9('0x5a')]=qs[_0x85f9('0x7a')](_[_0x85f9('0x7f')](_0xfbc21d[_0x85f9('0x22')],_0x15982f['filters']));_0x2a34db[_0x85f9('0x5a')]['ContactId']=_0x375a1c['id'];if(_0xfbc21d[_0x85f9('0x22')][_0x85f9('0x80')]){_0x2a34db[_0x85f9('0x5a')]=_[_0x85f9('0x81')](_0x2a34db[_0x85f9('0x5a')],{'$or':_[_0x85f9('0x6c')](_0x2a34db[_0x85f9('0x7d')],function(_0x4f7bdd){var _0x39b169={};_0x39b169[_0x4f7bdd]={'$like':'%'+_0xfbc21d[_0x85f9('0x22')]['filter']+'%'};return _0x39b169;})});}_0x2a34db=_[_0x85f9('0x81')]({},_0x2a34db,_0xfbc21d[_0x85f9('0x95')]);return db[_0x85f9('0x4e')][_0x85f9('0x14')]({'where':_0x2a34db[_0x85f9('0x5a')]})['then'](function(_0x253150){_0x19c6d3[_0x85f9('0x14')]=_0x253150;if(_0xfbc21d[_0x85f9('0x22')]['includeAll']){_0x2a34db['include']=[{'all':!![]}];}return db['JscriptySessionReport'][_0x85f9('0x21')](_0x2a34db);})[_0x85f9('0x18')](function(_0xb006ee){_0x19c6d3[_0x85f9('0x98')]=_0xb006ee;return _0x19c6d3;});}})[_0x85f9('0x18')](respondWithFilteredResult(_0xf2e939,_0x2a34db))[_0x85f9('0x24')](handleError(_0xf2e939,null));};exports[_0x85f9('0x9d')]=function(_0x4bb839,_0x2a49bc){try{if(!_0x4bb839[_0x85f9('0x32')]['ListId']){throw new Error('No\x20ListId\x20specified');}if(!_0x4bb839[_0x85f9('0x32')][_0x85f9('0x9e')]){throw new Error(_0x85f9('0x9f'));}if(!_0x4bb839['body'][_0x85f9('0xa0')]){throw new Error(_0x85f9('0xa1'));}if(!_0x4bb839['body'][_0x85f9('0xa2')]){throw new Error(_0x85f9('0xa3'));}var _0x131a3c=_0x4bb839[_0x85f9('0x32')]['binding_keys'][_0x85f9('0xa4')](',');var _0x107b0b=_0x4bb839['body'][_0x85f9('0xa0')][_0x85f9('0xa4')](',');if(!_0x131a3c[_0x85f9('0x35')]||!_0x107b0b[_0x85f9('0x35')]||_0x131a3c[_0x85f9('0x35')]!==_0x107b0b[_0x85f9('0x35')]){throw new Error(_0x85f9('0xa5'));}_0x4bb839[_0x85f9('0x32')]['fields']=_[_0x85f9('0xa6')](_0x131a3c,_0x107b0b);if(!_0x4bb839[_0x85f9('0x32')][_0x85f9('0x7c')][_0x85f9('0x76')]){throw new Error(_0x85f9('0xa7'));}if(!_0x4bb839['body'][_0x85f9('0x7c')][_0x85f9('0xa8')]){throw new Error(_0x85f9('0xa9'));}var _0x200560=path[_0x85f9('0x52')](config[_0x85f9('0xaa')],_0x85f9('0xab'),_0x4bb839[_0x85f9('0xac')][_0x85f9('0xad')]);fs[_0x85f9('0xae')](_0x200560,parseInt(_0x85f9('0xaf'),0x8));var _0x252127=require(_0x85f9('0xb0'))[_0x85f9('0xb1')](path[_0x85f9('0x52')](__dirname,'../../components/import/cm/csv'),[_0x200560,_0x4bb839['body'][_0x85f9('0x9e')],_0x4bb839[_0x85f9('0x32')][_0x85f9('0xa0')],_0x4bb839[_0x85f9('0x32')][_0x85f9('0x5c')],_0x4bb839[_0x85f9('0x32')][_0x85f9('0xb2')],_0x4bb839[_0x85f9('0x32')][_0x85f9('0x59')],_0x4bb839[_0x85f9('0x32')][_0x85f9('0xa2')]]);return _0x2a49bc['status'](0xc8)[_0x85f9('0x11')]({'message':_0x85f9('0xb3'),'pid':_0x252127['pid']});}catch(_0x46711d){return _0x2a49bc[_0x85f9('0x10')](0x1f4)['send'](_0x46711d);}};exports['upload']=function(_0x48c127,_0x1a9c08){var _0x2143df=fs['createReadStream'](_0x48c127['file'][_0x85f9('0xb4')]);Papa['parse'](_0x2143df,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x5c3e90){return _0x1a9c08[_0x85f9('0x10')](0xc8)[_0x85f9('0x11')]({'file':_0x48c127[_0x85f9('0xac')],'fields':_0x5c3e90[_0x85f9('0xb5')][_0x85f9('0x7c')]});}});};exports[_0x85f9('0xb6')]=function(_0x2733d0,_0x12c375){return db[_0x85f9('0xb7')][_0x85f9('0x21')]({'raw':!![],'attributes':['id'],'where':{'role':_0x85f9('0xb8')}})[_0x85f9('0x18')](function(_0x364f6e){var _0xe4e89=![];if(!_0x2733d0[_0x85f9('0x32')][_0x85f9('0x5c')]){throw new Error(_0x85f9('0xb9'));}if(!_0x2733d0[_0x85f9('0x32')][_0x85f9('0xba')][_0x85f9('0x76')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x2733d0[_0x85f9('0x32')]['binding'][_0x85f9('0xa8')]){throw new Error(_0x85f9('0xa9'));}if(!_0x2733d0[_0x85f9('0x32')][_0x85f9('0xa2')]){throw new Error(_0x85f9('0xa3'));}var _0x3c4ab5=require(_0x85f9('0xb0'))[_0x85f9('0xb1')](path[_0x85f9('0x52')](__dirname,_0x85f9('0xbb')),[_0x2733d0[_0x85f9('0x65')]['id'],JSON['stringify'](_0x2733d0[_0x85f9('0x32')]),JSON[_0x85f9('0xbc')](_0x364f6e)]);_0x3c4ab5['on'](_0x85f9('0xbd'),function(){_0xe4e89=!![];return _0x12c375[_0x85f9('0x10')](0xc8)['json']({'message':_0x85f9('0xbe'),'pid':_0x3c4ab5[_0x85f9('0xbf')]});});_0x3c4ab5['on'](_0x85f9('0xc0'),function(_0x3836d9){if(_0x3836d9&&!_0xe4e89){return _0x12c375[_0x85f9('0x10')](0x1f4)[_0x85f9('0x11')]({'message':_0x85f9('0xc1'),'pid':_0x3c4ab5[_0x85f9('0xbf')]});}});})[_0x85f9('0x24')](handleError(_0x12c375,null));};exports[_0x85f9('0xc2')]=function(_0xdc48f0,_0x20c7ac){return db[_0x85f9('0xb7')][_0x85f9('0x21')]({'raw':!![],'attributes':['id'],'where':{'role':'agent'}})[_0x85f9('0x18')](function(_0x11b7c3){var _0x38ef14=![];if(!_0xdc48f0[_0x85f9('0x32')][_0x85f9('0x5c')]){throw new Error(_0x85f9('0xb9'));}if(!_0xdc48f0[_0x85f9('0x32')]['binding'][_0x85f9('0x76')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0xdc48f0[_0x85f9('0x32')]['binding'][_0x85f9('0xa8')]){throw new Error(_0x85f9('0xa9'));}if(!_0xdc48f0[_0x85f9('0x32')][_0x85f9('0xa2')]){throw new Error(_0x85f9('0xa3'));}var _0x24002b=require(_0x85f9('0xb0'))[_0x85f9('0xb1')](path[_0x85f9('0x52')](__dirname,_0x85f9('0xc3')),[_0xdc48f0['params']['id'],JSON[_0x85f9('0xbc')](_0xdc48f0[_0x85f9('0x32')]),JSON[_0x85f9('0xbc')](_0x11b7c3)]);_0x24002b['on'](_0x85f9('0xbd'),function(){_0x38ef14=!![];return _0x20c7ac['status'](0xc8)[_0x85f9('0x11')]({'message':_0x85f9('0xbe'),'pid':_0x24002b[_0x85f9('0xbf')]});});_0x24002b['on'](_0x85f9('0xc0'),function(_0x577074){if(_0x577074&&!_0x38ef14){return _0x20c7ac[_0x85f9('0x10')](0x1f4)[_0x85f9('0x11')]({'message':_0x85f9('0xc1'),'pid':_0x24002b[_0x85f9('0xbf')]});}});})[_0x85f9('0x24')](handleError(_0x20c7ac,null));};exports[_0x85f9('0xc4')]=function(_0x441350,_0x54a115){var _0x5caeab=['mail',_0x85f9('0xc5'),_0x85f9('0xc6'),_0x85f9('0xc7'),_0x85f9('0xc8'),_0x85f9('0xc9'),_0x85f9('0xca')];var _0x1e5de6={'offset':0x0,'order':qs[_0x85f9('0x7e')](_0x85f9('0xcb'))},_0x10a213={'count':0x0,'rows':[]};Promise['resolve']()[_0x85f9('0x18')](function(){if(_0x441350[_0x85f9('0x22')]['channel']){if(!_[_0x85f9('0xcc')](_0x5caeab,_0x441350[_0x85f9('0x22')][_0x85f9('0xcd')][_0x85f9('0xce')]())){throw new Error('Invalid\x20channel');}_0x5caeab=[_0x441350[_0x85f9('0x22')][_0x85f9('0xcd')]['toLowerCase']()];}if(_0x441350[_0x85f9('0x22')][_0x85f9('0xcf')]){try{var _0x293d57=JSON['parse'](_0x441350[_0x85f9('0x22')][_0x85f9('0xcf')]);if(!moment(_0x293d57[_0x85f9('0x34')])[_0x85f9('0xd0')]()){throw new Error(_0x85f9('0xd1'));}if(!moment(_0x293d57['to'])[_0x85f9('0xd0')]()){throw new Error('Invalid\x20date\x20for\x20range\x20to\x20filter');}}catch(_0x2ed1ca){throw new Error('Invalid\x20createdAt\x20filter');}}if(!_0x441350[_0x85f9('0x22')][_0x85f9('0x31')]('nolimit')){_0x1e5de6[_0x85f9('0x13')]=qs['limit'](_0x441350['query'][_0x85f9('0x13')]||0xa);_0x1e5de6['offset']=qs[_0x85f9('0x15')](_0x441350['query'][_0x85f9('0x15')]);}var _0xa81b0d=_0x5caeab['map'](function(_0x1fe203){if(_0x1fe203===_0x85f9('0xca')){var _0x5cb60f={'attributes':['id','uniqueid',_0x85f9('0xd2'),_0x85f9('0xd3'),_0x85f9('0xd4'),_0x85f9('0xd5'),'starttime',_0x85f9('0xd6'),'duration',_0x85f9('0xd7'),_0x85f9('0xd8'),_0x85f9('0xd9'),_0x85f9('0xda'),_0x85f9('0xdb'),_0x85f9('0xdc')],'where':{'ContactId':_0x441350[_0x85f9('0x65')]['id']},'include':[{'model':db['User'],'as':_0x85f9('0xb7'),'attributes':['id',_0x85f9('0x1e'),'fullname',_0x85f9('0x2c')]}],'order':[[_0x85f9('0xd8'),_0x85f9('0xdd')]]};if(_0x441350['query'][_0x85f9('0xcf')]){_0x5cb60f[_0x85f9('0x5a')][_0x85f9('0xd8')]={'$gte':_0x293d57[_0x85f9('0x34')],'$lte':_0x293d57['to']};}return db['VoiceCallReport'][_0x85f9('0xde')](_0x5cb60f)[_0x85f9('0x18')](function(_0x3f2ee5){_0x10a213[_0x85f9('0x14')]+=_0x3f2ee5[_0x85f9('0x14')];return _[_0x85f9('0x6c')](_0x3f2ee5['rows'],function(_0x4530ef){var _0x1c2523=_0x4530ef['get']({'plain':!![]});_0x1c2523[_0x85f9('0xcd')]=_0x1fe203;if(_0x1c2523[_0x85f9('0xb7')]){_0x1c2523[_0x85f9('0xb7')]={'id':_0x1c2523[_0x85f9('0xb7')]['id'],'name':_0x1c2523[_0x85f9('0xb7')][_0x85f9('0x1e')],'fullname':_0x1c2523['User'][_0x85f9('0xdf')],'alias':_0x1c2523['User'][_0x85f9('0x2c')]};}return _0x1c2523;});});}else{var _0x24c2ba=_[_0x85f9('0xe0')](_0x1fe203)+(_0x1fe203==='chat'?'Website':'Account');var _0x2fb110={'attributes':['id',_0x85f9('0xe1'),_0x85f9('0xe2'),_0x85f9('0xd8'),_0x85f9('0xd7'),'disposition',_0x85f9('0xe3'),_0x85f9('0xe4'),'UserId',_0x24c2ba+'Id'],'where':{'ContactId':_0x441350['params']['id']},'include':[{'model':db[_0x24c2ba],'as':'Account','attributes':['id',_0x85f9('0x1e'),_0x85f9('0xe5')]},{'model':db[_0x85f9('0xb7')],'as':'Owner','attributes':['id',_0x85f9('0x1e'),'fullname']},{'model':db[_0x85f9('0xe6')],'as':_0x85f9('0xe7'),'attributes':['id',_0x85f9('0x1e'),_0x85f9('0x61')],'through':{'attributes':[]}}],'order':[[_0x85f9('0xd8'),'DESC']]};if(_0x441350[_0x85f9('0x22')][_0x85f9('0xcf')]){_0x2fb110['where']['createdAt']={'$gte':_0x293d57[_0x85f9('0x34')],'$lte':_0x293d57['to']};}switch(_0x1fe203){case _0x85f9('0xc5'):_0x2fb110[_0x85f9('0x7d')][_0x85f9('0x5b')]('browserName',_0x85f9('0xe8'),_0x85f9('0xe9'),_0x85f9('0xea'),'osName',_0x85f9('0xeb'),_0x85f9('0xec'),_0x85f9('0xed'),_0x85f9('0xee'));break;case _0x85f9('0xef'):_0x2fb110[_0x85f9('0x7d')][_0x85f9('0x5b')](_0x85f9('0xf0'),_0x85f9('0xf1'));break;case _0x85f9('0xc7'):_0x2fb110[_0x85f9('0x7d')][_0x85f9('0x5b')]('externalUrl','threadId');break;}return db[_['startCase'](_0x1fe203)+_0x85f9('0xf2')][_0x85f9('0xde')](_0x2fb110)[_0x85f9('0x18')](function(_0x1f584b){_0x10a213['count']+=_0x1f584b[_0x85f9('0x14')];return _[_0x85f9('0x6c')](_0x1f584b[_0x85f9('0x98')],function(_0x276334){var _0x59f36e=_0x276334[_0x85f9('0x36')]({'plain':!![]});_0x59f36e[_0x85f9('0xcd')]=_0x1fe203;if(_0x59f36e['Owner']){_0x59f36e[_0x85f9('0xf3')]={'id':_0x59f36e['Owner']['id'],'name':_0x59f36e[_0x85f9('0xf3')]['name'],'fullname':_0x59f36e[_0x85f9('0xf3')][_0x85f9('0xdf')]};}return _0x59f36e;});});}});return Promise[_0x85f9('0x5e')](_0xa81b0d);})[_0x85f9('0x18')](function(_0x21d0d5){return _(_0x21d0d5)[_0x85f9('0xf4')]()[_0x85f9('0xf5')]('createdAt')[_0x85f9('0xf6')]()['value']();})[_0x85f9('0x18')](function(_0xc64960){_0x10a213[_0x85f9('0x98')]=_0x1e5de6[_0x85f9('0x13')]?_0xc64960['slice'](_0x1e5de6['offset'],_0x1e5de6[_0x85f9('0x15')]+_0x1e5de6[_0x85f9('0x13')]):_0xc64960;return _0x10a213;})['then'](respondWithFilteredResult(_0x54a115,_0x1e5de6))[_0x85f9('0x24')](handleError(_0x54a115,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index 147f783..315df7e 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 _0x2042=['remove','emit','hasOwnProperty','events','../../mysqldb','CmContact','setMaxListeners','save','update'];(function(_0x12953a,_0x5b758c){var _0x1badf3=function(_0x5bbe2f){while(--_0x5bbe2f){_0x12953a['push'](_0x12953a['shift']());}};_0x1badf3(++_0x5b758c);}(_0x2042,0x8a));var _0x2204=function(_0x1be23a,_0x3d7311){_0x1be23a=_0x1be23a-0x0;var _0x106912=_0x2042[_0x1be23a];return _0x106912;};'use strict';var EventEmitter=require(_0x2204('0x0'));var CmContact=require(_0x2204('0x1'))['db'][_0x2204('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents[_0x2204('0x3')](0x0);var events={'afterCreate':_0x2204('0x4'),'afterUpdate':_0x2204('0x5'),'afterDestroy':_0x2204('0x6')};function emitEvent(_0x54d9bd){return function(_0x803075,_0x32709b,_0x30aa47){CmContactEvents[_0x2204('0x7')](_0x54d9bd+':'+_0x803075['id'],_0x803075);CmContactEvents[_0x2204('0x7')](_0x54d9bd,_0x803075);_0x30aa47(null);};}for(var e in events){if(events[_0x2204('0x8')](e)){var event=events[e];CmContact['hook'](e,emitEvent(event));}}module['exports']=CmContactEvents; \ No newline at end of file +var _0x7c9a=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','CmContact','save','update'];(function(_0x5b1c43,_0x1491b1){var _0x396f4f=function(_0x1ea922){while(--_0x1ea922){_0x5b1c43['push'](_0x5b1c43['shift']());}};_0x396f4f(++_0x1491b1);}(_0x7c9a,0x14f));var _0xa7c9=function(_0x582340,_0x185c84){_0x582340=_0x582340-0x0;var _0x1e4e12=_0x7c9a[_0x582340];return _0x1e4e12;};'use strict';var EventEmitter=require(_0xa7c9('0x0'));var CmContact=require(_0xa7c9('0x1'))['db'][_0xa7c9('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa7c9('0x3'),'afterUpdate':_0xa7c9('0x4'),'afterDestroy':_0xa7c9('0x5')};function emitEvent(_0x4d6947){return function(_0x3739ec,_0x341ff9,_0xdb622e){CmContactEvents['emit'](_0x4d6947+':'+_0x3739ec['id'],_0x3739ec);CmContactEvents[_0xa7c9('0x6')](_0x4d6947,_0x3739ec);_0xdb622e(null);};}for(var e in events){if(events[_0xa7c9('0x7')](e)){var event=events[e];CmContact[_0xa7c9('0x8')](e,emitEvent(event));}}module[_0xa7c9('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 f59ba9a..7393faa 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 _0xb840=['get','error','[cmContact][afterCreate]\x20List\x20not\x20found\x20for\x20contact\x20with\x20id\x20','[cmContact][afterCreate]','message','isEmpty','length','destroy','push','info','catch','[CmContact][afterDestroy][Error]','inspect','lodash','util','moment','../../config/environment/shared','./cmContact.attributes','Campaign','isNil','resolve','findOne','then','dialTimezone','timezones','utcOffset','scheduledat','add','minutes','format','YYYY-MM-DD\x20HH:mm:ss','phone','ListId','priority','callbackUniqueid','assign','CmHopper','[Always]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','CampaignId','VoiceQueueId','create','always','onlyIfOpen','VoiceQueue','findAll','outbound','dialCheckDuplicateType','Lists','map','all','CmList','BlackLists','CmHopperBlack','define','CmContact','fti_cm_contacts','firstName','mobile','email','FULLTEXT','utf8mb4','utf8mb4_unicode_ci','models'];(function(_0x55d0fe,_0x13710a){var _0x33a650=function(_0x1c6a29){while(--_0x1c6a29){_0x55d0fe['push'](_0x55d0fe['shift']());}};_0x33a650(++_0x13710a);}(_0xb840,0xca));var _0x0b84=function(_0x97877,_0x422052){_0x97877=_0x97877-0x0;var _0x5d9569=_0xb840[_0x97877];return _0x5d9569;};'use strict';var _=require(_0x0b84('0x0'));var util=require(_0x0b84('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x0b84('0x2'));var shared=require(_0x0b84('0x3'));var attributes=require(_0x0b84('0x4'));function getTimezoneCallbackAt(_0x23bb87,_0x21a210,_0x3ec277,_0x177837){var _0x7817cb=_0x177837?_0x0b84('0x5'):'VoiceQueue';var _0x33ffb6=_0x3ec277['scheduledat']?_0x3ec277['scheduledat']:moment()['format']('YYYY-MM-DD\x20HH:mm:ss');if(_[_0x0b84('0x6')](_0x3ec277['dialTimezone'])){return Promise[_0x0b84('0x7')](_0x33ffb6);}return _0x23bb87[_0x7817cb][_0x0b84('0x8')]({'where':{'id':_0x21a210}})[_0x0b84('0x9')](function(_0x40e8cb){if(_[_0x0b84('0x6')](_0x40e8cb)||_[_0x0b84('0x6')](_0x40e8cb[_0x0b84('0xa')])){return Promise[_0x0b84('0x7')](_0x33ffb6);}var _0x2bdd5c=shared[_0x0b84('0xb')];var _0x32d703=_0x2bdd5c[_0x40e8cb[_0x0b84('0xa')]];var _0x219cf2=_0x2bdd5c[_0x3ec277[_0x0b84('0xa')]];if(_['isNil'](_0x32d703)&&_[_0x0b84('0x6')](_0x219cf2)){return Promise['resolve'](_0x33ffb6);}var _0x4a1d3b=_0x32d703[_0x0b84('0xc')]-_0x219cf2[_0x0b84('0xc')];var _0x342c9c=_0x3ec277[_0x0b84('0xd')]?_0x3ec277[_0x0b84('0xd')]:moment();_0x33ffb6=moment(_0x342c9c)[_0x0b84('0xe')](_0x4a1d3b,_0x0b84('0xf'))[_0x0b84('0x10')](_0x0b84('0x11'));return Promise[_0x0b84('0x7')](_0x33ffb6);});}function getNewHopperPayload(_0x52fdb2){return{'phone':_0x52fdb2[_0x0b84('0x12')],'ContactId':_0x52fdb2['id'],'ListId':_0x52fdb2[_0x0b84('0x13')],'scheduledat':_0x52fdb2[_0x0b84('0xd')]?_0x52fdb2[_0x0b84('0xd')]:moment()[_0x0b84('0x10')](_0x0b84('0x11')),'priority':_0x52fdb2[_0x0b84('0x14')]?_0x52fdb2[_0x0b84('0x14')]:0x2,'callback':_0x52fdb2[_0x0b84('0x15')]?!![]:![],'callbackuniqueid':_0x52fdb2[_0x0b84('0x15')]?_0x52fdb2[_0x0b84('0x15')]:undefined,'callbackat':_0x52fdb2[_0x0b84('0x15')]?moment()[_0x0b84('0x10')](_0x0b84('0x11')):undefined};}function handleAlwaysCheckDuplicate(_0x4a5b03,_0xf9d7ad,_0x285ad5,_0x247dde){var _0x5273ba={'phone':_0x285ad5['phone']};var _0x4edbcb={'calleridnum':_0x285ad5[_0x0b84('0x12')]};if(_0x247dde){Object['assign'](_0x5273ba,{'CampaignId':_0xf9d7ad['id']});Object[_0x0b84('0x16')](_0x4edbcb,{'CampaignId':_0xf9d7ad['id']});}else{Object['assign'](_0x5273ba,{'VoiceQueueId':_0xf9d7ad['id']});Object[_0x0b84('0x16')](_0x4edbcb,{'VoiceQueueId':_0xf9d7ad['id']});}return _0x4a5b03[_0x0b84('0x17')][_0x0b84('0x8')]({'where':_0x5273ba})[_0x0b84('0x9')](function(_0x55f294){if(_0x55f294){throw new Error(_0x0b84('0x18')+_0x285ad5['phone']+'\x20in\x20Campaign\x20with\x20id\x20'+_0xf9d7ad['id']);}return _0x4a5b03['CmHopperFinal'][_0x0b84('0x8')]({'where':_0x4edbcb});})['then'](function(_0x560629){if(_0x560629){throw new Error('[Always]\x20Hopper\x20Final\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20'+_0x285ad5[_0x0b84('0x12')]+'\x20in\x20Campaign\x20with\x20id\x20'+_0xf9d7ad['id']);}var _0x524a5f=getNewHopperPayload(_0x285ad5);if(_0x247dde){_0x524a5f[_0x0b84('0x19')]=_0xf9d7ad['id'];}else{_0x524a5f[_0x0b84('0x1a')]=_0xf9d7ad['id'];}return _0x4a5b03[_0x0b84('0x17')][_0x0b84('0x1b')](_0x524a5f);});}function handleOnlyIfOpenCheckDuplicate(_0x4c2d15,_0x4874f0,_0x1b9f62,_0x2f9560){var _0x2bee72={'phone':_0x1b9f62[_0x0b84('0x12')]};if(_0x2f9560){Object[_0x0b84('0x16')](_0x2bee72,{'CampaignId':_0x4874f0['id']});}else{Object[_0x0b84('0x16')](_0x2bee72,{'VoiceQueueId':_0x4874f0['id']});}return _0x4c2d15[_0x0b84('0x17')][_0x0b84('0x8')]({'where':_0x2bee72})[_0x0b84('0x9')](function(_0x2a4b49){if(_0x2a4b49){throw new Error('[OnlyIfOpen]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20'+_0x1b9f62[_0x0b84('0x12')]+'\x20in\x20Campaign\x20with\x20id\x20'+_0x4874f0['id']);}var _0x447a62=getNewHopperPayload(_0x1b9f62);if(_0x2f9560){_0x447a62[_0x0b84('0x19')]=_0x4874f0['id'];}else{_0x447a62[_0x0b84('0x1a')]=_0x4874f0['id'];}return _0x4c2d15[_0x0b84('0x17')]['create'](_0x447a62);});}function handleNeverCheckDuplicate(_0x1de573,_0x350316,_0x29bbc6){var _0x5ad49c=getNewHopperPayload(_0x29bbc6);_0x5ad49c['VoiceQueueId']=_0x350316['id'];return _0x1de573[_0x0b84('0x17')][_0x0b84('0x1b')](_0x5ad49c);}function handleCheckDuplicate(_0x6e5bfd,_0x1a0c9e,_0x415f5a,_0x2189a5){return getTimezoneCallbackAt(_0x6e5bfd,_0x1a0c9e,_0x415f5a,_0x2189a5)[_0x0b84('0x9')](function(_0xe6df9e){_0x415f5a[_0x0b84('0xd')]=_0xe6df9e;switch(_0x1a0c9e['dialCheckDuplicateType']){case _0x0b84('0x1c'):return handleAlwaysCheckDuplicate(_0x6e5bfd,_0x1a0c9e,_0x415f5a,_0x2189a5);case _0x0b84('0x1d'):return handleOnlyIfOpenCheckDuplicate(_0x6e5bfd,_0x1a0c9e,_0x415f5a,_0x2189a5);default:return handleNeverCheckDuplicate(_0x6e5bfd,_0x1a0c9e,_0x415f5a);}});}function createHopperForVoiceQueues(_0x3c2b8b,_0xe816f3){return _0x3c2b8b[_0x0b84('0x1e')][_0x0b84('0x1f')]({'where':{'type':_0x0b84('0x20')},'attributes':['id',_0x0b84('0x21'),_0x0b84('0xa')],'include':[{'model':_0x3c2b8b['CmList'],'as':_0x0b84('0x22'),'where':{'id':_0xe816f3['ListId']}}],'raw':!![]})[_0x0b84('0x9')](function(_0x2a8b6c){var _0x44c0ad=_0x2a8b6c[_0x0b84('0x23')](function(_0x2e9d52){return handleCheckDuplicate(_0x3c2b8b,_0x2e9d52,_0xe816f3,![]);});return Promise[_0x0b84('0x24')](_0x44c0ad);});}function createHopperForCampaigns(_0x58ad82,_0x5e9bc6){return _0x58ad82[_0x0b84('0x5')][_0x0b84('0x1f')]({'attributes':['id',_0x0b84('0x21'),_0x0b84('0xa')],'include':[{'model':_0x58ad82[_0x0b84('0x25')],'as':_0x0b84('0x22'),'where':{'id':_0x5e9bc6[_0x0b84('0x13')]}}],'raw':!![]})[_0x0b84('0x9')](function(_0x3d88be){var _0x27a337=_0x3d88be[_0x0b84('0x23')](function(_0x1e18ed){return handleCheckDuplicate(_0x58ad82,_0x1e18ed,_0x5e9bc6,!![]);});return Promise['all'](_0x27a337);});}function createHopperBlackForVoiceQueues(_0x112122,_0x3fd736){return _0x112122[_0x0b84('0x1e')][_0x0b84('0x1f')]({'where':{'type':_0x0b84('0x20')},'attributes':['id'],'include':[{'model':_0x112122['CmList'],'as':_0x0b84('0x26'),'where':{'id':_0x3fd736[_0x0b84('0x13')]}}],'raw':!![]})['then'](function(_0x13e263){var _0x4ed5ce=_0x13e263[_0x0b84('0x23')](function(_0x53a437){return _0x112122['CmHopperBlack'][_0x0b84('0x1b')]({'phone':_0x3fd736[_0x0b84('0x12')],'ContactId':_0x3fd736['id'],'ListId':_0x3fd736[_0x0b84('0x13')],'VoiceQueueId':_0x53a437['id']});});return Promise[_0x0b84('0x24')](_0x4ed5ce);});}function createHopperBlackForCampaigns(_0x36c2e7,_0x2a88d4){return _0x36c2e7[_0x0b84('0x5')][_0x0b84('0x1f')]({'attributes':['id'],'include':[{'model':_0x36c2e7[_0x0b84('0x25')],'as':_0x0b84('0x26'),'where':{'id':_0x2a88d4[_0x0b84('0x13')]}}],'raw':!![]})[_0x0b84('0x9')](function(_0x3214e6){var _0x428528=_0x3214e6['map'](function(_0x2ba240){return _0x36c2e7[_0x0b84('0x27')][_0x0b84('0x1b')]({'phone':_0x2a88d4[_0x0b84('0x12')],'ContactId':_0x2a88d4['id'],'ListId':_0x2a88d4[_0x0b84('0x13')],'CampaignId':_0x2ba240['id']});});return Promise['all'](_0x428528);});}module['exports']=function(_0x9363e1){return _0x9363e1[_0x0b84('0x28')](_0x0b84('0x29'),attributes,{'tableName':'cm_contacts','paranoid':!![],'indexes':[{'name':_0x0b84('0x12'),'fields':[_0x0b84('0x12')]},{'name':_0x0b84('0x2a'),'fields':[_0x0b84('0x2b'),'lastName',_0x0b84('0x12'),_0x0b84('0x2c'),'fax',_0x0b84('0x2d')],'type':_0x0b84('0x2e')}],'timestamps':!![],'charset':_0x0b84('0x2f'),'collate':_0x0b84('0x30'),'hooks':{'afterCreate':function(_0x78b52f,_0x38df5b,_0x3b099d){var _0x372f62=_0x9363e1[_0x0b84('0x31')];var _0x5eefa2=_0x78b52f[_0x0b84('0x32')]({'plain':!![]});if(!_0x5eefa2[_0x0b84('0x13')]){logger[_0x0b84('0x33')](_0x0b84('0x34')+_0x5eefa2['id']);return _0x3b099d();}if(!_0x5eefa2[_0x0b84('0x12')]){return _0x3b099d();}return createHopperForVoiceQueues(_0x372f62,_0x5eefa2)['then'](function(){return createHopperBlackForVoiceQueues(_0x372f62,_0x5eefa2);})[_0x0b84('0x9')](function(){return createHopperForCampaigns(_0x372f62,_0x5eefa2);})['then'](function(){return createHopperBlackForCampaigns(_0x372f62,_0x5eefa2);})[_0x0b84('0x9')](function(){return _0x3b099d();})['catch'](function(_0x1bb551){logger[_0x0b84('0x33')](_0x0b84('0x35'),_0x1bb551[_0x0b84('0x36')]);_0x3b099d();});},'afterDestroy':function(_0x2cd22f,_0xb1ab6b,_0x31ddd0){var _0x5621b5=_0x9363e1[_0x0b84('0x31')];var _0x56f333=_0x2cd22f['get']({'plain':!![]});return _0x5621b5['CmHopper']['findAll']({'raw':!![],'where':{'ListId':_0x56f333[_0x0b84('0x13')],'ContactId':_0x56f333['id']}})['then'](function(_0x39986a){if(!_[_0x0b84('0x37')](_0x39986a)){var _0x1c069e=[];for(var _0x34d7b0=0x0;_0x34d7b0<_0x39986a[_0x0b84('0x38')];_0x34d7b0+=0x1){var _0x3d7f07=_0x5621b5[_0x0b84('0x17')][_0x0b84('0x39')]({'where':{'ListId':_0x39986a[_0x34d7b0][_0x0b84('0x13')],'ContactId':_0x39986a[_0x34d7b0]['ContactId'],'VoiceQueueId':_0x39986a[_0x34d7b0][_0x0b84('0x1a')],'CampaignId':_0x39986a[_0x34d7b0]['CampaignId']}});_0x1c069e[_0x0b84('0x3a')](_0x3d7f07);}return Promise['all'](_0x1c069e);}})[_0x0b84('0x9')](function(_0x232c3a){logger[_0x0b84('0x3b')]('[CmContact][afterDestroy][Succesfull]',util['inspect'](_0x232c3a,{'showHidden':![],'depth':null}));_0x31ddd0();})[_0x0b84('0x3c')](function(_0x2224d0){logger[_0x0b84('0x33')](_0x0b84('0x3d'),util[_0x0b84('0x3e')](_0x2224d0,{'showHidden':![],'depth':null}));_0x31ddd0(_0x2224d0);});}}});}; \ No newline at end of file +var _0x55a0=['[OnlyIfOpen]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','always','onlyIfOpen','findAll','dialCheckDuplicateType','CmList','Lists','map','all','outbound','CmHopperBlack','BlackLists','exports','define','CmContact','cm_contacts','firstName','lastName','mobile','fax','FULLTEXT','models','get','error','catch','[cmContact][afterCreate]','message','isEmpty','destroy','ContactId','push','[CmContact][afterDestroy][Succesfull]','inspect','lodash','../../config/logger','api','moment','../../config/environment/shared','Campaign','scheduledat','format','isNil','dialTimezone','resolve','findOne','then','timezones','utcOffset','add','minutes','YYYY-MM-DD\x20HH:mm:ss','phone','ListId','priority','callbackUniqueid','assign','CmHopper','[Always]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','\x20in\x20Campaign\x20with\x20id\x20','CmHopperFinal','[Always]\x20Hopper\x20Final\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','CampaignId','VoiceQueueId','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x55a0,0x1a1));var _0x055a=function(_0x12bdd1,_0x15abbc){_0x12bdd1=_0x12bdd1-0x0;var _0x4ad209=_0x55a0[_0x12bdd1];return _0x4ad209;};'use strict';var _=require(_0x055a('0x0'));var util=require('util');var logger=require(_0x055a('0x1'))(_0x055a('0x2'));var moment=require(_0x055a('0x3'));var shared=require(_0x055a('0x4'));var attributes=require('./cmContact.attributes');function getTimezoneCallbackAt(_0x2cb996,_0xc87786,_0x2578bb,_0x46f783){var _0x18a308=_0x46f783?_0x055a('0x5'):'VoiceQueue';var _0x4804c6=_0x2578bb[_0x055a('0x6')]?_0x2578bb['scheduledat']:moment()[_0x055a('0x7')]('YYYY-MM-DD\x20HH:mm:ss');if(_[_0x055a('0x8')](_0x2578bb[_0x055a('0x9')])){return Promise[_0x055a('0xa')](_0x4804c6);}return _0x2cb996[_0x18a308][_0x055a('0xb')]({'where':{'id':_0xc87786}})[_0x055a('0xc')](function(_0xda368a){if(_['isNil'](_0xda368a)||_[_0x055a('0x8')](_0xda368a[_0x055a('0x9')])){return Promise[_0x055a('0xa')](_0x4804c6);}var _0x407f03=shared[_0x055a('0xd')];var _0x3439fa=_0x407f03[_0xda368a[_0x055a('0x9')]];var _0xec00c4=_0x407f03[_0x2578bb[_0x055a('0x9')]];if(_[_0x055a('0x8')](_0x3439fa)&&_['isNil'](_0xec00c4)){return Promise[_0x055a('0xa')](_0x4804c6);}var _0x276c30=_0x3439fa[_0x055a('0xe')]-_0xec00c4[_0x055a('0xe')];var _0x4dc4a3=_0x2578bb[_0x055a('0x6')]?_0x2578bb['scheduledat']:moment();_0x4804c6=moment(_0x4dc4a3)[_0x055a('0xf')](_0x276c30,_0x055a('0x10'))[_0x055a('0x7')](_0x055a('0x11'));return Promise[_0x055a('0xa')](_0x4804c6);});}function getNewHopperPayload(_0x96267e){return{'phone':_0x96267e[_0x055a('0x12')],'ContactId':_0x96267e['id'],'ListId':_0x96267e[_0x055a('0x13')],'scheduledat':_0x96267e[_0x055a('0x6')]?_0x96267e[_0x055a('0x6')]:moment()[_0x055a('0x7')](_0x055a('0x11')),'priority':_0x96267e[_0x055a('0x14')]?_0x96267e[_0x055a('0x14')]:0x2,'callback':_0x96267e[_0x055a('0x15')]?!![]:![],'callbackuniqueid':_0x96267e[_0x055a('0x15')]?_0x96267e[_0x055a('0x15')]:undefined,'callbackat':_0x96267e[_0x055a('0x15')]?moment()[_0x055a('0x7')]('YYYY-MM-DD\x20HH:mm:ss'):undefined};}function handleAlwaysCheckDuplicate(_0x1c1d10,_0x5c2165,_0x3a4f8e,_0x31b904){var _0x205403={'phone':_0x3a4f8e[_0x055a('0x12')]};var _0x3c8c21={'calleridnum':_0x3a4f8e[_0x055a('0x12')]};if(_0x31b904){Object[_0x055a('0x16')](_0x205403,{'CampaignId':_0x5c2165['id']});Object[_0x055a('0x16')](_0x3c8c21,{'CampaignId':_0x5c2165['id']});}else{Object['assign'](_0x205403,{'VoiceQueueId':_0x5c2165['id']});Object['assign'](_0x3c8c21,{'VoiceQueueId':_0x5c2165['id']});}return _0x1c1d10[_0x055a('0x17')][_0x055a('0xb')]({'where':_0x205403})[_0x055a('0xc')](function(_0x2916c3){if(_0x2916c3){throw new Error(_0x055a('0x18')+_0x3a4f8e[_0x055a('0x12')]+_0x055a('0x19')+_0x5c2165['id']);}return _0x1c1d10[_0x055a('0x1a')][_0x055a('0xb')]({'where':_0x3c8c21});})[_0x055a('0xc')](function(_0x281840){if(_0x281840){throw new Error(_0x055a('0x1b')+_0x3a4f8e[_0x055a('0x12')]+_0x055a('0x19')+_0x5c2165['id']);}var _0x3d4bd7=getNewHopperPayload(_0x3a4f8e);if(_0x31b904){_0x3d4bd7[_0x055a('0x1c')]=_0x5c2165['id'];}else{_0x3d4bd7[_0x055a('0x1d')]=_0x5c2165['id'];}return _0x1c1d10['CmHopper'][_0x055a('0x1e')](_0x3d4bd7);});}function handleOnlyIfOpenCheckDuplicate(_0xf9c115,_0x17c5f2,_0x1c6e06,_0x484d41){var _0xe0e22a={'phone':_0x1c6e06[_0x055a('0x12')]};if(_0x484d41){Object['assign'](_0xe0e22a,{'CampaignId':_0x17c5f2['id']});}else{Object[_0x055a('0x16')](_0xe0e22a,{'VoiceQueueId':_0x17c5f2['id']});}return _0xf9c115[_0x055a('0x17')][_0x055a('0xb')]({'where':_0xe0e22a})[_0x055a('0xc')](function(_0x33eab8){if(_0x33eab8){throw new Error(_0x055a('0x1f')+_0x1c6e06['phone']+_0x055a('0x19')+_0x17c5f2['id']);}var _0x3540d4=getNewHopperPayload(_0x1c6e06);if(_0x484d41){_0x3540d4[_0x055a('0x1c')]=_0x17c5f2['id'];}else{_0x3540d4[_0x055a('0x1d')]=_0x17c5f2['id'];}return _0xf9c115[_0x055a('0x17')][_0x055a('0x1e')](_0x3540d4);});}function handleNeverCheckDuplicate(_0x322780,_0x4f7209,_0x204d87){var _0x2c5cfb=getNewHopperPayload(_0x204d87);_0x2c5cfb[_0x055a('0x1d')]=_0x4f7209['id'];return _0x322780[_0x055a('0x17')]['create'](_0x2c5cfb);}function handleCheckDuplicate(_0x1a345a,_0x3e7d96,_0x428ea5,_0x2b9de7){return getTimezoneCallbackAt(_0x1a345a,_0x3e7d96,_0x428ea5,_0x2b9de7)['then'](function(_0x15d96e){_0x428ea5[_0x055a('0x6')]=_0x15d96e;switch(_0x3e7d96['dialCheckDuplicateType']){case _0x055a('0x20'):return handleAlwaysCheckDuplicate(_0x1a345a,_0x3e7d96,_0x428ea5,_0x2b9de7);case _0x055a('0x21'):return handleOnlyIfOpenCheckDuplicate(_0x1a345a,_0x3e7d96,_0x428ea5,_0x2b9de7);default:return handleNeverCheckDuplicate(_0x1a345a,_0x3e7d96,_0x428ea5);}});}function createHopperForVoiceQueues(_0x41d4bb,_0x3ce416){return _0x41d4bb['VoiceQueue'][_0x055a('0x22')]({'where':{'type':'outbound'},'attributes':['id',_0x055a('0x23'),_0x055a('0x9')],'include':[{'model':_0x41d4bb[_0x055a('0x24')],'as':_0x055a('0x25'),'where':{'id':_0x3ce416[_0x055a('0x13')]}}],'raw':!![]})[_0x055a('0xc')](function(_0x27cee0){var _0x172c46=_0x27cee0[_0x055a('0x26')](function(_0x4e8792){return handleCheckDuplicate(_0x41d4bb,_0x4e8792,_0x3ce416,![]);});return Promise['all'](_0x172c46);});}function createHopperForCampaigns(_0x1d02d4,_0x44006d){return _0x1d02d4['Campaign']['findAll']({'attributes':['id',_0x055a('0x23'),'dialTimezone'],'include':[{'model':_0x1d02d4[_0x055a('0x24')],'as':_0x055a('0x25'),'where':{'id':_0x44006d[_0x055a('0x13')]}}],'raw':!![]})[_0x055a('0xc')](function(_0x925f02){var _0x5386b2=_0x925f02[_0x055a('0x26')](function(_0x5d6f90){return handleCheckDuplicate(_0x1d02d4,_0x5d6f90,_0x44006d,!![]);});return Promise[_0x055a('0x27')](_0x5386b2);});}function createHopperBlackForVoiceQueues(_0x8ec60a,_0x3889cd){return _0x8ec60a['VoiceQueue'][_0x055a('0x22')]({'where':{'type':_0x055a('0x28')},'attributes':['id'],'include':[{'model':_0x8ec60a[_0x055a('0x24')],'as':'BlackLists','where':{'id':_0x3889cd['ListId']}}],'raw':!![]})['then'](function(_0x4d0271){var _0x278381=_0x4d0271['map'](function(_0x1d35d7){return _0x8ec60a[_0x055a('0x29')]['create']({'phone':_0x3889cd['phone'],'ContactId':_0x3889cd['id'],'ListId':_0x3889cd[_0x055a('0x13')],'VoiceQueueId':_0x1d35d7['id']});});return Promise['all'](_0x278381);});}function createHopperBlackForCampaigns(_0xcb75f9,_0xe2929c){return _0xcb75f9['Campaign'][_0x055a('0x22')]({'attributes':['id'],'include':[{'model':_0xcb75f9['CmList'],'as':_0x055a('0x2a'),'where':{'id':_0xe2929c['ListId']}}],'raw':!![]})[_0x055a('0xc')](function(_0x369d2d){var _0x5975b9=_0x369d2d[_0x055a('0x26')](function(_0x390b9d){return _0xcb75f9[_0x055a('0x29')][_0x055a('0x1e')]({'phone':_0xe2929c[_0x055a('0x12')],'ContactId':_0xe2929c['id'],'ListId':_0xe2929c['ListId'],'CampaignId':_0x390b9d['id']});});return Promise[_0x055a('0x27')](_0x5975b9);});}module[_0x055a('0x2b')]=function(_0x38a2ac){return _0x38a2ac[_0x055a('0x2c')](_0x055a('0x2d'),attributes,{'tableName':_0x055a('0x2e'),'paranoid':!![],'indexes':[{'name':_0x055a('0x12'),'fields':[_0x055a('0x12')]},{'name':'fti_cm_contacts','fields':[_0x055a('0x2f'),_0x055a('0x30'),'phone',_0x055a('0x31'),_0x055a('0x32'),'email'],'type':_0x055a('0x33')}],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci','hooks':{'afterCreate':function(_0x101db1,_0x4daa0f,_0x310e0c){var _0x2fdca7=_0x38a2ac[_0x055a('0x34')];var _0x1d2676=_0x101db1[_0x055a('0x35')]({'plain':!![]});if(!_0x1d2676[_0x055a('0x13')]){logger[_0x055a('0x36')]('[cmContact][afterCreate]\x20List\x20not\x20found\x20for\x20contact\x20with\x20id\x20'+_0x1d2676['id']);return _0x310e0c();}if(!_0x1d2676[_0x055a('0x12')]){return _0x310e0c();}return createHopperForVoiceQueues(_0x2fdca7,_0x1d2676)[_0x055a('0xc')](function(){return createHopperBlackForVoiceQueues(_0x2fdca7,_0x1d2676);})[_0x055a('0xc')](function(){return createHopperForCampaigns(_0x2fdca7,_0x1d2676);})[_0x055a('0xc')](function(){return createHopperBlackForCampaigns(_0x2fdca7,_0x1d2676);})['then'](function(){return _0x310e0c();})[_0x055a('0x37')](function(_0x368a77){logger[_0x055a('0x36')](_0x055a('0x38'),_0x368a77[_0x055a('0x39')]);_0x310e0c();});},'afterDestroy':function(_0x3ea0c9,_0x18582f,_0x40e655){var _0x58bba6=_0x38a2ac[_0x055a('0x34')];var _0x2f2566=_0x3ea0c9[_0x055a('0x35')]({'plain':!![]});return _0x58bba6['CmHopper']['findAll']({'raw':!![],'where':{'ListId':_0x2f2566['ListId'],'ContactId':_0x2f2566['id']}})[_0x055a('0xc')](function(_0x4afea0){if(!_[_0x055a('0x3a')](_0x4afea0)){var _0x11d07b=[];for(var _0x249b58=0x0;_0x249b58<_0x4afea0['length'];_0x249b58+=0x1){var _0x562806=_0x58bba6[_0x055a('0x17')][_0x055a('0x3b')]({'where':{'ListId':_0x4afea0[_0x249b58][_0x055a('0x13')],'ContactId':_0x4afea0[_0x249b58][_0x055a('0x3c')],'VoiceQueueId':_0x4afea0[_0x249b58][_0x055a('0x1d')],'CampaignId':_0x4afea0[_0x249b58][_0x055a('0x1c')]}});_0x11d07b[_0x055a('0x3d')](_0x562806);}return Promise['all'](_0x11d07b);}})['then'](function(_0x28a5eb){logger['info'](_0x055a('0x3e'),util[_0x055a('0x3f')](_0x28a5eb,{'showHidden':![],'depth':null}));_0x40e655();})[_0x055a('0x37')](function(_0x5665c6){logger[_0x055a('0x36')]('[CmContact][afterDestroy][Error]',util[_0x055a('0x3f')](_0x5665c6,{'showHidden':![],'depth':null}));_0x40e655(_0x5665c6);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index 3d7dd7d..6980aa3 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 _0x9957=['include','model','length','CmContactHasItem','find','ListId','Contact','isNil','CmContactId','CmContact','catch','CreateCmContact','create','body','keys','startsWith','cf_','table','cm_contacts','set','where','id\x20=\x20?','toString','sequelize','query','lodash','util','moment','bluebird','ioredis','squel','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./cmContact.socket','register','request','then','info','CmContact,\x20%s,\x20%s','request\x20sent','debug','CmContact,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','GetCmContact','findAll','options','raw','attributes','limit','map'];(function(_0x1284e1,_0x5995e2){var _0x1e559f=function(_0x5d43db){while(--_0x5d43db){_0x1284e1['push'](_0x1284e1['shift']());}};_0x1e559f(++_0x5995e2);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'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 squel=require(_0x7995('0x5'));var db=require(_0x7995('0x6'))['db'];var utils=require(_0x7995('0x7'));var logger=require('../../config/logger')(_0x7995('0x8'));var config=require(_0x7995('0x9'));var jayson=require(_0x7995('0xa'));var client=jayson[_0x7995('0xb')][_0x7995('0xc')]({'port':0x232a});config[_0x7995('0xd')]=_['defaults'](config[_0x7995('0xd')],{'host':_0x7995('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7995('0xd')]));require(_0x7995('0xf'))[_0x7995('0x10')](socket);function respondWithRpcPromise(_0x35b5fe,_0x3c1d19,_0x1e400a){return new BPromise(function(_0x341672,_0x524f7b){return client[_0x7995('0x11')](_0x35b5fe,_0x1e400a)[_0x7995('0x12')](function(_0x581f22){logger[_0x7995('0x13')](_0x7995('0x14'),_0x3c1d19,_0x7995('0x15'));logger[_0x7995('0x16')](_0x7995('0x17'),_0x3c1d19,_0x7995('0x15'),JSON[_0x7995('0x18')](_0x581f22));if(_0x581f22['error']){if(_0x581f22['error'][_0x7995('0x19')]===0x1f4){logger[_0x7995('0x1a')](_0x7995('0x14'),_0x3c1d19,_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);return _0x524f7b(_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);}logger[_0x7995('0x1a')]('CmContact,\x20%s,\x20%s',_0x3c1d19,_0x581f22[_0x7995('0x1a')]['message']);return _0x341672(_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);}else{logger[_0x7995('0x13')](_0x7995('0x14'),_0x3c1d19,_0x7995('0x15'));_0x341672(_0x581f22[_0x7995('0x1c')]['message']);}})['catch'](function(_0x2536c8){logger['error']('CmContact,\x20%s,\x20%s',_0x3c1d19,_0x2536c8);_0x524f7b(_0x2536c8);});});}exports[_0x7995('0x1d')]=function(_0x3d463e){var _0x4cbe10=this;return new Promise(function(_0x3a9b54,_0x51f276){return db['CmContact'][_0x7995('0x1e')]({'raw':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x20')]===undefined?!![]:![]:!![],'where':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')]['where']||null:null,'attributes':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x21')]||null:null,'limit':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x22')]||null:null,'include':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')]['include']?_[_0x7995('0x23')](_0x3d463e[_0x7995('0x1f')][_0x7995('0x24')],function(_0x268ce7){return{'model':db[_0x268ce7[_0x7995('0x25')]],'as':_0x268ce7['as'],'attributes':_0x268ce7[_0x7995('0x21')],'include':_0x268ce7['include']?_[_0x7995('0x23')](_0x268ce7['include'],function(_0x229742){return{'model':db[_0x229742[_0x7995('0x25')]],'as':_0x229742['as'],'attributes':_0x229742[_0x7995('0x21')],'include':_0x229742[_0x7995('0x24')]?_[_0x7995('0x23')](_0x229742['include'],function(_0x9b2a15){return{'model':db[_0x9b2a15['model']],'as':_0x9b2a15['as'],'attributes':_0x9b2a15[_0x7995('0x21')]};}):[]};}):[]};}):[]:[]})[_0x7995('0x12')](function(_0x4253e5){logger['info']('GetCmContact',_0x3d463e);logger['debug'](_0x7995('0x1d'),_0x3d463e,JSON[_0x7995('0x18')](_0x4253e5));if(_0x4253e5[_0x7995('0x26')]==0x0){return db[_0x7995('0x27')][_0x7995('0x28')]({'raw':!![],'where':{'item':_0x3d463e[_0x7995('0x1f')]['phone']},'include':[{'model':db['CmContact'],'where':{'ListId':_0x3d463e[_0x7995('0x1f')]['where'][_0x7995('0x29')],'deletedAt':{'$eq':null}},'as':_0x7995('0x2a')}]})[_0x7995('0x12')](function(_0x1e9fa4){if(_[_0x7995('0x2b')](_0x1e9fa4)){_0x3a9b54(_0x4253e5);}else{var _0x510841=_0x1e9fa4[_0x7995('0x2c')];return db[_0x7995('0x2d')]['findAll']({'raw':!![],'where':{'id':_0x510841},'attributes':_0x3d463e['options']?_0x3d463e['options'][_0x7995('0x21')]||null:null})[_0x7995('0x12')](function(_0x4a176f){_0x3a9b54(_0x4a176f);});}});}else{_0x3a9b54(_0x4253e5);}})[_0x7995('0x2e')](function(_0x51b95d){logger[_0x7995('0x1a')](_0x7995('0x1d'),_0x51b95d[_0x7995('0x1b')],_0x3d463e);_0x51f276(_0x4cbe10['error'](0x1f4,_0x51b95d['message']));});});};exports[_0x7995('0x2f')]=function(_0x5e67fe){var _0x5d2428=this;return new Promise(function(_0x3e99cd,_0xe328b1){return db['CmContact'][_0x7995('0x30')](_0x5e67fe[_0x7995('0x31')],{'raw':_0x5e67fe[_0x7995('0x1f')]?_0x5e67fe[_0x7995('0x1f')][_0x7995('0x20')]===undefined?!![]:![]:!![]})['then'](function(_0x2d4285){var _0x242713;for(var _0xf612e6=0x0;_0xf612e6{}\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(_0x43cb0e,_0x3733e6){var _0x1538c3=function(_0x28a283){while(--_0x28a283){_0x43cb0e['push'](_0x43cb0e['shift']());}};_0x1538c3(++_0x3733e6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0xa9e0[_0x1da04e];return _0xdd8c41;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/phones',auth['isAuthenticated'](),controller['getAdditionalPhones']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getHopperHistories']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x18')]('/merge',auth[_0x0a9e('0xd')](),controller['merge']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/phones',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x1e'),auth['isAuthenticated'](),controller['duplicateAdditionalPhones']);router[_0x0a9e('0x18')](_0x0a9e('0x1f'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xfb6e48,_0x2fb0e4,_0x3b45bc){_0x3b45bc(null,path[_0x0a9e('0x21')](config[_0x0a9e('0x22')],_0x0a9e('0x23')));},'filename':function(_0x16b1ca,_0x5ea472,_0x59181e){_0x5ea472[_0x0a9e('0x24')]=_0x5ea472[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.attributes.js b/server/api/cmContactHasItem/cmContactHasItem.attributes.js index 4033d9a..953afc8 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 _0x0c02=['exports','INTEGER','STRING','PHONE'];(function(_0x4de487,_0x4dbeed){var _0x4642ad=function(_0x2bad4b){while(--_0x2bad4b){_0x4de487['push'](_0x4de487['shift']());}};_0x4642ad(++_0x4dbeed);}(_0x0c02,0x84));var _0x20c0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0c02[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x20c0('0x0')]={'CmContactId':{'type':Sequelize[_0x20c0('0x1')],'primaryKey':!![]},'item':{'type':Sequelize['STRING'],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x20c0('0x1')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x20c0('0x2')],'defaultValue':_0x20c0('0x3')},'OrderBy':{'type':Sequelize[_0x20c0('0x1')],'defaultValue':null},'description':{'type':Sequelize[_0x20c0('0x2')],'defaultValue':null}}; \ No newline at end of file +var _0x3098=['exports','INTEGER','STRING','PHONE','sequelize'];(function(_0x1c8c28,_0x3ee093){var _0x1f59b4=function(_0x29bcc0){while(--_0x29bcc0){_0x1c8c28['push'](_0x1c8c28['shift']());}};_0x1f59b4(++_0x3ee093);}(_0x3098,0x86));var _0x8309=function(_0xd21fe7,_0x225a39){_0xd21fe7=_0xd21fe7-0x0;var _0x14d570=_0x3098[_0xd21fe7];return _0x14d570;};'use strict';var Sequelize=require(_0x8309('0x0'));module[_0x8309('0x1')]={'CmContactId':{'type':Sequelize[_0x8309('0x2')],'primaryKey':!![]},'item':{'type':Sequelize[_0x8309('0x3')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize['INTEGER'],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x8309('0x3')],'defaultValue':_0x8309('0x4')},'OrderBy':{'type':Sequelize[_0x8309('0x2')],'defaultValue':null},'description':{'type':Sequelize[_0x8309('0x3')],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.controller.js b/server/api/cmContactHasItem/cmContactHasItem.controller.js index d85ea96..1a15037 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 _0x1a94=['get','CmContactHasItems','error','stack','name','index','map','CmContactHasItem','rawAttributes','fieldName','type','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','show','params','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','fs-extra','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy'];(function(_0x3c5acb,_0x35f0af){var _0x3e069c=function(_0x56eb5f){while(--_0x56eb5f){_0x3c5acb['push'](_0x3c5acb['shift']());}};_0x3e069c(++_0x35f0af);}(_0x1a94,0xcd));var _0x41a9=function(_0x34843e,_0x4c4224){_0x34843e=_0x34843e-0x0;var _0x598f7f=_0x1a94[_0x34843e];return _0x598f7f;};'use strict';var emlformat=require(_0x41a9('0x0'));var rimraf=require(_0x41a9('0x1'));var zipdir=require(_0x41a9('0x2'));var jsonpatch=require(_0x41a9('0x3'));var rp=require(_0x41a9('0x4'));var moment=require(_0x41a9('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x41a9('0x6'));var path=require(_0x41a9('0x7'));var sox=require('sox');var csv=require(_0x41a9('0x8'));var ejs=require(_0x41a9('0x9'));var fs=require('fs');var fs_extra=require(_0x41a9('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x41a9('0xb'));var deskjs=require(_0x41a9('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x41a9('0xd'));var Redis=require(_0x41a9('0xe'));var authService=require(_0x41a9('0xf'));var qs=require(_0x41a9('0x10'));var as=require(_0x41a9('0x11'));var hardwareService=require(_0x41a9('0x12'));var logger=require(_0x41a9('0x13'))(_0x41a9('0x14'));var utils=require(_0x41a9('0x15'));var config=require(_0x41a9('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x41a9('0x17'))['db'];function respondWithStatusCode(_0xc30a48,_0x2933a3){_0x2933a3=_0x2933a3||0xcc;return function(_0x5a24e9){if(_0x5a24e9){return _0xc30a48[_0x41a9('0x18')](_0x2933a3);}return _0xc30a48[_0x41a9('0x19')](_0x2933a3)[_0x41a9('0x1a')]();};}function respondWithResult(_0x1348fe,_0x53e9db){_0x53e9db=_0x53e9db||0xc8;return function(_0x508e46){if(_0x508e46){return _0x1348fe[_0x41a9('0x19')](_0x53e9db)[_0x41a9('0x1b')](_0x508e46);}};}function respondWithFilteredResult(_0x29e86d,_0x3888d9){return function(_0x5e7314){if(_0x5e7314){var _0x276cc4=typeof _0x3888d9[_0x41a9('0x1c')]===_0x41a9('0x1d')&&typeof _0x3888d9[_0x41a9('0x1e')]===_0x41a9('0x1d');var _0x501c9c=_0x5e7314[_0x41a9('0x1f')];var _0x5c262e=_0x276cc4?0x0:_0x3888d9['offset'];var _0x5e8b5c=_0x276cc4?_0x5e7314['count']:_0x3888d9['offset']+_0x3888d9[_0x41a9('0x1e')];var _0x1eb1f4;if(_0x5e8b5c>=_0x501c9c){_0x5e8b5c=_0x501c9c;_0x1eb1f4=0xc8;}else{_0x1eb1f4=0xce;}_0x29e86d[_0x41a9('0x19')](_0x1eb1f4);return _0x29e86d['set'](_0x41a9('0x20'),_0x5c262e+'-'+_0x5e8b5c+'/'+_0x501c9c)[_0x41a9('0x1b')](_0x5e7314);}return null;};}function patchUpdates(_0x54f05e){return function(_0x367458){try{jsonpatch[_0x41a9('0x21')](_0x367458,_0x54f05e,!![]);}catch(_0x25692b){return BPromise[_0x41a9('0x22')](_0x25692b);}return _0x367458['save']();};}function saveUpdates(_0x281551,_0x5d71a0){return function(_0x5384bf){if(_0x5384bf){return _0x5384bf[_0x41a9('0x23')](_0x281551)[_0x41a9('0x24')](function(_0x3e2be5){return _0x3e2be5;});}return null;};}function removeEntity(_0x54c9ff,_0x410e22){return function(_0x2c0540){if(_0x2c0540){return _0x2c0540[_0x41a9('0x25')]()['then'](function(){var _0x11705b=_0x2c0540[_0x41a9('0x26')]({'plain':!![]});var _0xcee575=_0x41a9('0x27');return db['UserProfileResource']['destroy']({'where':{'type':_0xcee575,'resourceId':_0x11705b['id']}})[_0x41a9('0x24')](function(){return _0x2c0540;});})[_0x41a9('0x24')](function(){_0x54c9ff[_0x41a9('0x19')](0xcc)[_0x41a9('0x1a')]();});}};}function handleEntityNotFound(_0x48b2f5,_0x56ebbb){return function(_0x4a42ea){if(!_0x4a42ea){_0x48b2f5[_0x41a9('0x18')](0x194);}return _0x4a42ea;};}function handleError(_0x5a1a08,_0x343a73){_0x343a73=_0x343a73||0x1f4;return function(_0x58ffdb){logger[_0x41a9('0x28')](_0x58ffdb[_0x41a9('0x29')]);if(_0x58ffdb[_0x41a9('0x2a')]){delete _0x58ffdb[_0x41a9('0x2a')];}_0x5a1a08[_0x41a9('0x19')](_0x343a73)['send'](_0x58ffdb);};}exports[_0x41a9('0x2b')]=function(_0x3d0e32,_0x9b61a4){var _0x2eeab0={},_0x16afda={},_0x5841fd={'count':0x0,'rows':[]};var _0x579ca8=_[_0x41a9('0x2c')](db[_0x41a9('0x2d')][_0x41a9('0x2e')],function(_0x36d3a5){return{'name':_0x36d3a5[_0x41a9('0x2f')],'type':_0x36d3a5[_0x41a9('0x30')]['key']};});_0x16afda[_0x41a9('0x31')]=_[_0x41a9('0x2c')](_0x579ca8,'name');_0x16afda[_0x41a9('0x32')]=_[_0x41a9('0x33')](_0x3d0e32['query']);_0x16afda['filters']=_[_0x41a9('0x34')](_0x16afda[_0x41a9('0x31')],_0x16afda['query']);_0x2eeab0['attributes']=_[_0x41a9('0x34')](_0x16afda['model'],qs[_0x41a9('0x35')](_0x3d0e32[_0x41a9('0x32')][_0x41a9('0x35')]));_0x2eeab0['attributes']=_0x2eeab0[_0x41a9('0x36')][_0x41a9('0x37')]?_0x2eeab0[_0x41a9('0x36')]:_0x16afda[_0x41a9('0x31')];if(!_0x3d0e32[_0x41a9('0x32')][_0x41a9('0x38')](_0x41a9('0x39'))){_0x2eeab0[_0x41a9('0x1e')]=qs[_0x41a9('0x1e')](_0x3d0e32[_0x41a9('0x32')][_0x41a9('0x1e')]);_0x2eeab0[_0x41a9('0x1c')]=qs[_0x41a9('0x1c')](_0x3d0e32['query'][_0x41a9('0x1c')]);}_0x2eeab0[_0x41a9('0x3a')]=qs[_0x41a9('0x3b')](_0x3d0e32[_0x41a9('0x32')]['sort']);_0x2eeab0[_0x41a9('0x3c')]=qs[_0x41a9('0x3d')](_[_0x41a9('0x3e')](_0x3d0e32[_0x41a9('0x32')],_0x16afda[_0x41a9('0x3d')]),_0x579ca8);if(_0x3d0e32[_0x41a9('0x32')][_0x41a9('0x3f')]){_0x2eeab0['where']=_['merge'](_0x2eeab0['where'],{'$or':_[_0x41a9('0x2c')](_0x579ca8,function(_0x53692e){if(_0x53692e[_0x41a9('0x30')]!==_0x41a9('0x40')){var _0x439f0f={};_0x439f0f[_0x53692e[_0x41a9('0x2a')]]={'$like':'%'+_0x3d0e32[_0x41a9('0x32')][_0x41a9('0x3f')]+'%'};return _0x439f0f;}})});}_0x2eeab0=_[_0x41a9('0x41')]({},_0x2eeab0,_0x3d0e32[_0x41a9('0x42')]);var _0x3bb573={'where':_0x2eeab0[_0x41a9('0x3c')]};return db['CmContactHasItem'][_0x41a9('0x1f')](_0x3bb573)[_0x41a9('0x24')](function(_0x21a1b0){_0x5841fd[_0x41a9('0x1f')]=_0x21a1b0;if(_0x3d0e32[_0x41a9('0x32')][_0x41a9('0x43')]){_0x2eeab0['include']=[{'all':!![]}];}return db[_0x41a9('0x2d')][_0x41a9('0x44')](_0x2eeab0);})['then'](function(_0x179c4f){_0x5841fd[_0x41a9('0x45')]=_0x179c4f;return _0x5841fd;})[_0x41a9('0x24')](respondWithFilteredResult(_0x9b61a4,_0x2eeab0))['catch'](handleError(_0x9b61a4,null));};exports[_0x41a9('0x46')]=function(_0x14c9d2,_0x33a8ce){var _0x237544={'raw':!![],'where':{'id':_0x14c9d2[_0x41a9('0x47')]['id']}},_0x553ba7={};_0x553ba7[_0x41a9('0x31')]=_['keys'](db[_0x41a9('0x2d')][_0x41a9('0x2e')]);_0x553ba7['query']=_[_0x41a9('0x33')](_0x14c9d2[_0x41a9('0x32')]);_0x553ba7['filters']=_[_0x41a9('0x34')](_0x553ba7[_0x41a9('0x31')],_0x553ba7[_0x41a9('0x32')]);_0x237544[_0x41a9('0x36')]=_[_0x41a9('0x34')](_0x553ba7[_0x41a9('0x31')],qs['fields'](_0x14c9d2[_0x41a9('0x32')][_0x41a9('0x35')]));_0x237544['attributes']=_0x237544['attributes']['length']?_0x237544[_0x41a9('0x36')]:_0x553ba7['model'];if(_0x14c9d2[_0x41a9('0x32')][_0x41a9('0x43')]){_0x237544['include']=[{'all':!![]}];}_0x237544=_[_0x41a9('0x41')]({},_0x237544,_0x14c9d2['options']);return db[_0x41a9('0x2d')][_0x41a9('0x48')](_0x237544)[_0x41a9('0x24')](handleEntityNotFound(_0x33a8ce,null))[_0x41a9('0x24')](respondWithResult(_0x33a8ce,null))[_0x41a9('0x49')](handleError(_0x33a8ce,null));};exports[_0x41a9('0x4a')]=function(_0x24ad12,_0x71e74d){return db['CmContactHasItem'][_0x41a9('0x4a')](_0x24ad12[_0x41a9('0x4b')],{})[_0x41a9('0x24')](function(_0x5f11af){var _0x2ef973=_0x24ad12[_0x41a9('0x4c')]['get']({'plain':!![]});if(!_0x2ef973)throw new Error(_0x41a9('0x4d'));if(_0x2ef973['role']===_0x41a9('0x4c')){var _0xd8a25b=_0x5f11af[_0x41a9('0x26')]({'plain':!![]});var _0x3ae09f=_0x41a9('0x27');return db[_0x41a9('0x4e')][_0x41a9('0x48')]({'where':{'name':_0x3ae09f,'userProfileId':_0x2ef973[_0x41a9('0x4f')]},'raw':!![]})[_0x41a9('0x24')](function(_0x272253){if(_0x272253&&_0x272253[_0x41a9('0x50')]===0x0){return db['UserProfileResource'][_0x41a9('0x4a')]({'name':_0xd8a25b['name'],'resourceId':_0xd8a25b['id'],'type':_0x272253[_0x41a9('0x2a')],'sectionId':_0x272253['id']},{})[_0x41a9('0x24')](function(){return _0x5f11af;});}else{return _0x5f11af;}})[_0x41a9('0x49')](function(_0x5af028){logger[_0x41a9('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5af028);throw _0x5af028;});}return _0x5f11af;})['then'](respondWithResult(_0x71e74d,0xc9))[_0x41a9('0x49')](handleError(_0x71e74d,null));};exports[_0x41a9('0x23')]=function(_0x2cb123,_0x3e3ff7){if(_0x2cb123[_0x41a9('0x4b')]['id']){delete _0x2cb123[_0x41a9('0x4b')]['id'];}return db[_0x41a9('0x2d')]['find']({'where':{'id':_0x2cb123['params']['id']}})[_0x41a9('0x24')](handleEntityNotFound(_0x3e3ff7,null))['then'](saveUpdates(_0x2cb123[_0x41a9('0x4b')],null))[_0x41a9('0x24')](respondWithResult(_0x3e3ff7,null))[_0x41a9('0x49')](handleError(_0x3e3ff7,null));};exports[_0x41a9('0x25')]=function(_0x32e81f,_0x34dd55){return db['CmContactHasItem'][_0x41a9('0x48')]({'where':{'id':_0x32e81f['params']['id']}})[_0x41a9('0x24')](handleEntityNotFound(_0x34dd55,null))[_0x41a9('0x24')](removeEntity(_0x34dd55,null))['catch'](handleError(_0x34dd55,null));}; \ No newline at end of file +var _0x355a=['eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','CmContactHasItems','UserProfileResource','error','stack','name','send','index','map','CmContactHasItem','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','where','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0x355a,0xa6));var _0xa355=function(_0x321543,_0x47fc87){_0x321543=_0x321543-0x0;var _0x47ffc8=_0x355a[_0x321543];return _0x47ffc8;};'use strict';var emlformat=require(_0xa355('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa355('0x1'));var jsonpatch=require(_0xa355('0x2'));var rp=require(_0xa355('0x3'));var moment=require(_0xa355('0x4'));var BPromise=require(_0xa355('0x5'));var Mustache=require(_0xa355('0x6'));var util=require('util');var path=require(_0xa355('0x7'));var sox=require(_0xa355('0x8'));var csv=require(_0xa355('0x9'));var ejs=require(_0xa355('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa355('0xb'));var squel=require(_0xa355('0xc'));var crypto=require(_0xa355('0xd'));var jsforce=require(_0xa355('0xe'));var deskjs=require(_0xa355('0xf'));var toCsv=require(_0xa355('0x9'));var querystring=require(_0xa355('0x10'));var Papa=require(_0xa355('0x11'));var Redis=require('ioredis');var authService=require(_0xa355('0x12'));var qs=require(_0xa355('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa355('0x14'));var logger=require(_0xa355('0x15'))('api');var utils=require(_0xa355('0x16'));var config=require(_0xa355('0x17'));var licenseUtil=require(_0xa355('0x18'));var db=require(_0xa355('0x19'))['db'];function respondWithStatusCode(_0x425ef8,_0x118669){_0x118669=_0x118669||0xcc;return function(_0x30706a){if(_0x30706a){return _0x425ef8[_0xa355('0x1a')](_0x118669);}return _0x425ef8[_0xa355('0x1b')](_0x118669)[_0xa355('0x1c')]();};}function respondWithResult(_0x5a94e7,_0xee41a2){_0xee41a2=_0xee41a2||0xc8;return function(_0x195295){if(_0x195295){return _0x5a94e7[_0xa355('0x1b')](_0xee41a2)[_0xa355('0x1d')](_0x195295);}};}function respondWithFilteredResult(_0x43508a,_0x56443e){return function(_0x516cb8){if(_0x516cb8){var _0x3077bf=typeof _0x56443e[_0xa355('0x1e')]===_0xa355('0x1f')&&typeof _0x56443e[_0xa355('0x20')]===_0xa355('0x1f');var _0x520c92=_0x516cb8[_0xa355('0x21')];var _0x558858=_0x3077bf?0x0:_0x56443e['offset'];var _0x3b16eb=_0x3077bf?_0x516cb8[_0xa355('0x21')]:_0x56443e[_0xa355('0x1e')]+_0x56443e[_0xa355('0x20')];var _0x487ce0;if(_0x3b16eb>=_0x520c92){_0x3b16eb=_0x520c92;_0x487ce0=0xc8;}else{_0x487ce0=0xce;}_0x43508a[_0xa355('0x1b')](_0x487ce0);return _0x43508a[_0xa355('0x22')](_0xa355('0x23'),_0x558858+'-'+_0x3b16eb+'/'+_0x520c92)[_0xa355('0x1d')](_0x516cb8);}return null;};}function patchUpdates(_0x51af35){return function(_0x3fdfc9){try{jsonpatch[_0xa355('0x24')](_0x3fdfc9,_0x51af35,!![]);}catch(_0x1e49a0){return BPromise['reject'](_0x1e49a0);}return _0x3fdfc9['save']();};}function saveUpdates(_0x254af1,_0x3c4c78){return function(_0x2973f8){if(_0x2973f8){return _0x2973f8[_0xa355('0x25')](_0x254af1)[_0xa355('0x26')](function(_0x447d28){return _0x447d28;});}return null;};}function removeEntity(_0xef0c31,_0x5849ed){return function(_0x559da8){if(_0x559da8){return _0x559da8[_0xa355('0x27')]()[_0xa355('0x26')](function(){var _0x5b6e49=_0x559da8['get']({'plain':!![]});var _0x33216a=_0xa355('0x28');return db[_0xa355('0x29')]['destroy']({'where':{'type':_0x33216a,'resourceId':_0x5b6e49['id']}})[_0xa355('0x26')](function(){return _0x559da8;});})[_0xa355('0x26')](function(){_0xef0c31['status'](0xcc)[_0xa355('0x1c')]();});}};}function handleEntityNotFound(_0x6ebdb2,_0x5b7d71){return function(_0x3e18aa){if(!_0x3e18aa){_0x6ebdb2[_0xa355('0x1a')](0x194);}return _0x3e18aa;};}function handleError(_0x16fb53,_0x406b5a){_0x406b5a=_0x406b5a||0x1f4;return function(_0x2dfacc){logger[_0xa355('0x2a')](_0x2dfacc[_0xa355('0x2b')]);if(_0x2dfacc[_0xa355('0x2c')]){delete _0x2dfacc[_0xa355('0x2c')];}_0x16fb53[_0xa355('0x1b')](_0x406b5a)[_0xa355('0x2d')](_0x2dfacc);};}exports[_0xa355('0x2e')]=function(_0x5a0a16,_0x12b789){var _0x194f4e={},_0x4afcd5={},_0x4eca37={'count':0x0,'rows':[]};var _0x3402ba=_[_0xa355('0x2f')](db[_0xa355('0x30')][_0xa355('0x31')],function(_0x4e097e){return{'name':_0x4e097e[_0xa355('0x32')],'type':_0x4e097e[_0xa355('0x33')]['key']};});_0x4afcd5[_0xa355('0x34')]=_[_0xa355('0x2f')](_0x3402ba,_0xa355('0x2c'));_0x4afcd5[_0xa355('0x35')]=_[_0xa355('0x36')](_0x5a0a16[_0xa355('0x35')]);_0x4afcd5[_0xa355('0x37')]=_[_0xa355('0x38')](_0x4afcd5[_0xa355('0x34')],_0x4afcd5['query']);_0x194f4e[_0xa355('0x39')]=_[_0xa355('0x38')](_0x4afcd5[_0xa355('0x34')],qs[_0xa355('0x3a')](_0x5a0a16[_0xa355('0x35')][_0xa355('0x3a')]));_0x194f4e[_0xa355('0x39')]=_0x194f4e[_0xa355('0x39')][_0xa355('0x3b')]?_0x194f4e['attributes']:_0x4afcd5[_0xa355('0x34')];if(!_0x5a0a16['query']['hasOwnProperty'](_0xa355('0x3c'))){_0x194f4e[_0xa355('0x20')]=qs[_0xa355('0x20')](_0x5a0a16['query']['limit']);_0x194f4e[_0xa355('0x1e')]=qs[_0xa355('0x1e')](_0x5a0a16[_0xa355('0x35')]['offset']);}_0x194f4e['order']=qs['sort'](_0x5a0a16[_0xa355('0x35')]['sort']);_0x194f4e[_0xa355('0x3d')]=qs[_0xa355('0x37')](_['pick'](_0x5a0a16[_0xa355('0x35')],_0x4afcd5[_0xa355('0x37')]),_0x3402ba);if(_0x5a0a16[_0xa355('0x35')][_0xa355('0x3e')]){_0x194f4e[_0xa355('0x3d')]=_[_0xa355('0x3f')](_0x194f4e[_0xa355('0x3d')],{'$or':_[_0xa355('0x2f')](_0x3402ba,function(_0xd6a229){if(_0xd6a229[_0xa355('0x33')]!==_0xa355('0x40')){var _0x2806a8={};_0x2806a8[_0xd6a229['name']]={'$like':'%'+_0x5a0a16[_0xa355('0x35')][_0xa355('0x3e')]+'%'};return _0x2806a8;}})});}_0x194f4e=_[_0xa355('0x3f')]({},_0x194f4e,_0x5a0a16[_0xa355('0x41')]);var _0x3e8b57={'where':_0x194f4e[_0xa355('0x3d')]};return db[_0xa355('0x30')][_0xa355('0x21')](_0x3e8b57)[_0xa355('0x26')](function(_0x7ffd09){_0x4eca37[_0xa355('0x21')]=_0x7ffd09;if(_0x5a0a16[_0xa355('0x35')]['includeAll']){_0x194f4e[_0xa355('0x42')]=[{'all':!![]}];}return db[_0xa355('0x30')][_0xa355('0x43')](_0x194f4e);})['then'](function(_0x52d1b5){_0x4eca37[_0xa355('0x44')]=_0x52d1b5;return _0x4eca37;})['then'](respondWithFilteredResult(_0x12b789,_0x194f4e))[_0xa355('0x45')](handleError(_0x12b789,null));};exports[_0xa355('0x46')]=function(_0x49efc1,_0x3f0643){var _0x1ce1d0={'raw':!![],'where':{'id':_0x49efc1[_0xa355('0x47')]['id']}},_0x2c90ed={};_0x2c90ed[_0xa355('0x34')]=_['keys'](db[_0xa355('0x30')][_0xa355('0x31')]);_0x2c90ed[_0xa355('0x35')]=_[_0xa355('0x36')](_0x49efc1[_0xa355('0x35')]);_0x2c90ed[_0xa355('0x37')]=_[_0xa355('0x38')](_0x2c90ed[_0xa355('0x34')],_0x2c90ed['query']);_0x1ce1d0[_0xa355('0x39')]=_['intersection'](_0x2c90ed[_0xa355('0x34')],qs['fields'](_0x49efc1[_0xa355('0x35')][_0xa355('0x3a')]));_0x1ce1d0[_0xa355('0x39')]=_0x1ce1d0['attributes'][_0xa355('0x3b')]?_0x1ce1d0[_0xa355('0x39')]:_0x2c90ed[_0xa355('0x34')];if(_0x49efc1['query'][_0xa355('0x48')]){_0x1ce1d0[_0xa355('0x42')]=[{'all':!![]}];}_0x1ce1d0=_[_0xa355('0x3f')]({},_0x1ce1d0,_0x49efc1[_0xa355('0x41')]);return db[_0xa355('0x30')][_0xa355('0x49')](_0x1ce1d0)[_0xa355('0x26')](handleEntityNotFound(_0x3f0643,null))[_0xa355('0x26')](respondWithResult(_0x3f0643,null))[_0xa355('0x45')](handleError(_0x3f0643,null));};exports['create']=function(_0x3c576c,_0x507f40){return db['CmContactHasItem'][_0xa355('0x4a')](_0x3c576c[_0xa355('0x4b')],{})[_0xa355('0x26')](function(_0x5ce5b8){var _0x4425f0=_0x3c576c[_0xa355('0x4c')][_0xa355('0x4d')]({'plain':!![]});if(!_0x4425f0)throw new Error(_0xa355('0x4e'));if(_0x4425f0[_0xa355('0x4f')]===_0xa355('0x4c')){var _0x3fc1b4=_0x5ce5b8[_0xa355('0x4d')]({'plain':!![]});var _0x549162=_0xa355('0x28');return db[_0xa355('0x50')]['find']({'where':{'name':_0x549162,'userProfileId':_0x4425f0['userProfileId']},'raw':!![]})[_0xa355('0x26')](function(_0x4d18c8){if(_0x4d18c8&&_0x4d18c8[_0xa355('0x51')]===0x0){return db[_0xa355('0x29')][_0xa355('0x4a')]({'name':_0x3fc1b4['name'],'resourceId':_0x3fc1b4['id'],'type':_0x4d18c8[_0xa355('0x2c')],'sectionId':_0x4d18c8['id']},{})[_0xa355('0x26')](function(){return _0x5ce5b8;});}else{return _0x5ce5b8;}})[_0xa355('0x45')](function(_0x6d1144){logger['error'](_0xa355('0x52'),_0x6d1144);throw _0x6d1144;});}return _0x5ce5b8;})[_0xa355('0x26')](respondWithResult(_0x507f40,0xc9))['catch'](handleError(_0x507f40,null));};exports['update']=function(_0x332028,_0x22b890){if(_0x332028[_0xa355('0x4b')]['id']){delete _0x332028[_0xa355('0x4b')]['id'];}return db[_0xa355('0x30')][_0xa355('0x49')]({'where':{'id':_0x332028[_0xa355('0x47')]['id']}})[_0xa355('0x26')](handleEntityNotFound(_0x22b890,null))['then'](saveUpdates(_0x332028[_0xa355('0x4b')],null))[_0xa355('0x26')](respondWithResult(_0x22b890,null))['catch'](handleError(_0x22b890,null));};exports['destroy']=function(_0xcefc70,_0x570692){return db[_0xa355('0x30')]['find']({'where':{'id':_0xcefc70[_0xa355('0x47')]['id']}})[_0xa355('0x26')](handleEntityNotFound(_0x570692,null))[_0xa355('0x26')](removeEntity(_0x570692,null))['catch'](handleError(_0x570692,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index 3dfdb3b..7750b75 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 _0x7152=['./cmContactHasItem.attributes','exports','define','CmContactHasItem','cm_contact_has_items','lodash','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3e8f79,_0x3843a6){var _0x319b97=function(_0x504d79){while(--_0x504d79){_0x3e8f79['push'](_0x3e8f79['shift']());}};_0x319b97(++_0x3843a6);}(_0x7152,0x1f1));var _0x2715=function(_0x179b80,_0x440291){_0x179b80=_0x179b80-0x0;var _0x1e8d03=_0x7152[_0x179b80];return _0x1e8d03;};'use strict';var _=require(_0x2715('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x2715('0x1'));var BPromise=require(_0x2715('0x2'));var rp=require(_0x2715('0x3'));var fs=require('fs');var path=require(_0x2715('0x4'));var rimraf=require(_0x2715('0x5'));var config=require(_0x2715('0x6'));var attributes=require(_0x2715('0x7'));module[_0x2715('0x8')]=function(_0x4fc237,_0x32e0e0){return _0x4fc237[_0x2715('0x9')](_0x2715('0xa'),attributes,{'tableName':_0x2715('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb386=['cm_contact_has_items','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./cmContactHasItem.attributes','exports','define','CmContactHasItem'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0xb386,0x1bb));var _0x6b38=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0xb386[_0x1928c9];return _0x51b5fb;};'use strict';var _=require(_0x6b38('0x0'));var util=require(_0x6b38('0x1'));var logger=require(_0x6b38('0x2'))(_0x6b38('0x3'));var moment=require(_0x6b38('0x4'));var BPromise=require(_0x6b38('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6b38('0x6'));var config=require(_0x6b38('0x7'));var attributes=require(_0x6b38('0x8'));module[_0x6b38('0x9')]=function(_0x2a4f09,_0x1778d4){return _0x2a4f09[_0x6b38('0xa')](_0x6b38('0xb'),attributes,{'tableName':_0x6b38('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.rpc.js b/server/api/cmContactHasItem/cmContactHasItem.rpc.js index ac020e8..a6fe3e5 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 _0x78a4=['result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','code','CmContactHasItem,\x20%s,\x20%s','message'];(function(_0x2a0350,_0x249319){var _0x425220=function(_0x1d5f78){while(--_0x1d5f78){_0x2a0350['push'](_0x2a0350['shift']());}};_0x425220(++_0x249319);}(_0x78a4,0x6f));var _0x478a=function(_0x256e32,_0x4013bc){_0x256e32=_0x256e32-0x0;var _0x464070=_0x78a4[_0x256e32];return _0x464070;};'use strict';var _=require(_0x478a('0x0'));var util=require(_0x478a('0x1'));var moment=require(_0x478a('0x2'));var BPromise=require(_0x478a('0x3'));var rs=require(_0x478a('0x4'));var fs=require('fs');var Redis=require(_0x478a('0x5'));var db=require(_0x478a('0x6'))['db'];var utils=require(_0x478a('0x7'));var logger=require(_0x478a('0x8'))('rpc');var config=require(_0x478a('0x9'));var jayson=require(_0x478a('0xa'));var client=jayson['client'][_0x478a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x506e5a,_0x2abd38,_0xa73a92){return new BPromise(function(_0x2340dc,_0x53ae5d){return client[_0x478a('0xc')](_0x506e5a,_0xa73a92)[_0x478a('0xd')](function(_0x16075c){logger[_0x478a('0xe')]('CmContactHasItem,\x20%s,\x20%s',_0x2abd38,'request\x20sent');logger['debug'](_0x478a('0xf'),_0x2abd38,'request\x20sent',JSON[_0x478a('0x10')](_0x16075c));if(_0x16075c['error']){if(_0x16075c[_0x478a('0x11')][_0x478a('0x12')]===0x1f4){logger[_0x478a('0x11')](_0x478a('0x13'),_0x2abd38,_0x16075c[_0x478a('0x11')][_0x478a('0x14')]);return _0x53ae5d(_0x16075c[_0x478a('0x11')][_0x478a('0x14')]);}logger['error'](_0x478a('0x13'),_0x2abd38,_0x16075c[_0x478a('0x11')][_0x478a('0x14')]);return _0x2340dc(_0x16075c[_0x478a('0x11')]['message']);}else{logger['info'](_0x478a('0x13'),_0x2abd38,'request\x20sent');_0x2340dc(_0x16075c[_0x478a('0x15')][_0x478a('0x14')]);}})['catch'](function(_0x1099b2){logger[_0x478a('0x11')](_0x478a('0x13'),_0x2abd38,_0x1099b2);_0x53ae5d(_0x1099b2);});});} \ No newline at end of file +var _0x8f5a=['CmContactHasItem,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','then','info','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x8e015d,_0x49893f){var _0x5c5653=function(_0x1e2abb){while(--_0x1e2abb){_0x8e015d['push'](_0x8e015d['shift']());}};_0x5c5653(++_0x49893f);}(_0x8f5a,0xe0));var _0xa8f5=function(_0x3e5c8f,_0x171c0a){_0x3e5c8f=_0x3e5c8f-0x0;var _0xbc9c20=_0x8f5a[_0x3e5c8f];return _0xbc9c20;};'use strict';var _=require(_0xa8f5('0x0'));var util=require(_0xa8f5('0x1'));var moment=require(_0xa8f5('0x2'));var BPromise=require('bluebird');var rs=require(_0xa8f5('0x3'));var fs=require('fs');var Redis=require(_0xa8f5('0x4'));var db=require(_0xa8f5('0x5'))['db'];var utils=require(_0xa8f5('0x6'));var logger=require('../../config/logger')(_0xa8f5('0x7'));var config=require(_0xa8f5('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xa8f5('0x9')][_0xa8f5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x36beaa,_0x1bcf2c,_0x502847){return new BPromise(function(_0x59eabb,_0x14f67b){return client['request'](_0x36beaa,_0x502847)[_0xa8f5('0xb')](function(_0x26185e){logger[_0xa8f5('0xc')]('CmContactHasItem,\x20%s,\x20%s',_0x1bcf2c,_0xa8f5('0xd'));logger[_0xa8f5('0xe')](_0xa8f5('0xf'),_0x1bcf2c,_0xa8f5('0xd'),JSON['stringify'](_0x26185e));if(_0x26185e[_0xa8f5('0x10')]){if(_0x26185e['error'][_0xa8f5('0x11')]===0x1f4){logger[_0xa8f5('0x10')](_0xa8f5('0x12'),_0x1bcf2c,_0x26185e[_0xa8f5('0x10')][_0xa8f5('0x13')]);return _0x14f67b(_0x26185e[_0xa8f5('0x10')][_0xa8f5('0x13')]);}logger['error']('CmContactHasItem,\x20%s,\x20%s',_0x1bcf2c,_0x26185e[_0xa8f5('0x10')]['message']);return _0x59eabb(_0x26185e['error'][_0xa8f5('0x13')]);}else{logger[_0xa8f5('0xc')](_0xa8f5('0x12'),_0x1bcf2c,_0xa8f5('0xd'));_0x59eabb(_0x26185e[_0xa8f5('0x14')][_0xa8f5('0x13')]);}})[_0xa8f5('0x15')](function(_0x3bfc59){logger['error'](_0xa8f5('0x12'),_0x1bcf2c,_0x3bfc59);_0x14f67b(_0x3bfc59);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index 6c61687..1c842c0 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 _0x72e6=['get','/:id','show','post','create','update','delete','exports','connect-timeout','express','../../components/auth/service','../../components/interaction/service','isAuthenticated','index'];(function(_0x339129,_0x86dcc6){var _0x1570df=function(_0x3b537e){while(--_0x3b537e){_0x339129['push'](_0x339129['shift']());}};_0x1570df(++_0x86dcc6);}(_0x72e6,0xda));var _0x672e=function(_0x4c6fa9,_0x3a7005){_0x4c6fa9=_0x4c6fa9-0x0;var _0x33ef35=_0x72e6[_0x4c6fa9];return _0x33ef35;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x672e('0x0'));var express=require(_0x672e('0x1'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x672e('0x2'));var interaction=require(_0x672e('0x3'));var config=require('../../config/environment');var controller=require('./cmContactHasItem.controller');router['get']('/',auth[_0x672e('0x4')](),controller[_0x672e('0x5')]);router[_0x672e('0x6')](_0x672e('0x7'),auth['isAuthenticated'](),controller[_0x672e('0x8')]);router[_0x672e('0x9')]('/',auth[_0x672e('0x4')](),controller[_0x672e('0xa')]);router['put'](_0x672e('0x7'),auth[_0x672e('0x4')](),controller[_0x672e('0xb')]);router[_0x672e('0xc')](_0x672e('0x7'),auth[_0x672e('0x4')](),controller['destroy']);module[_0x672e('0xd')]=router; \ No newline at end of file +var _0x4600=['exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller','isAuthenticated','/:id','show','post','create','put','update','delete','destroy'];(function(_0xa8883,_0x1f107f){var _0x479426=function(_0x4e56b9){while(--_0x4e56b9){_0xa8883['push'](_0xa8883['shift']());}};_0x479426(++_0x1f107f);}(_0x4600,0x191));var _0x0460=function(_0x4ba112,_0x25021c){_0x4ba112=_0x4ba112-0x0;var _0x7edcb9=_0x4600[_0x4ba112];return _0x7edcb9;};'use strict';var multer=require(_0x0460('0x0'));var util=require(_0x0460('0x1'));var path=require(_0x0460('0x2'));var timeout=require(_0x0460('0x3'));var express=require('express');var router=express[_0x0460('0x4')]();var fs_extra=require(_0x0460('0x5'));var auth=require(_0x0460('0x6'));var interaction=require(_0x0460('0x7'));var config=require(_0x0460('0x8'));var controller=require(_0x0460('0x9'));router['get']('/',auth[_0x0460('0xa')](),controller['index']);router['get'](_0x0460('0xb'),auth[_0x0460('0xa')](),controller[_0x0460('0xc')]);router[_0x0460('0xd')]('/',auth[_0x0460('0xa')](),controller[_0x0460('0xe')]);router[_0x0460('0xf')](_0x0460('0xb'),auth[_0x0460('0xa')](),controller[_0x0460('0x10')]);router[_0x0460('0x11')](_0x0460('0xb'),auth['isAuthenticated'](),controller[_0x0460('0x12')]);module[_0x0460('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 a24e8aa..f42c818 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 _0xa808=['isArray','stringify','BOOLEAN','ENUM','voice','sequelize','lodash','exports','VIRTUAL','alias','setDataValue','getDataValue','STRING','long','select','parse','values'];(function(_0x30f07a,_0x98341){var _0xb38461=function(_0x7b287a){while(--_0x7b287a){_0x30f07a['push'](_0x30f07a['shift']());}};_0xb38461(++_0x98341);}(_0xa808,0x8d));var _0x8a80=function(_0x41e1a7,_0xfd63ec){_0x41e1a7=_0x41e1a7-0x0;var _0x466ca1=_0xa808[_0x41e1a7];return _0x466ca1;};'use strict';var Sequelize=require(_0x8a80('0x0'));var _=require(_0x8a80('0x1'));module[_0x8a80('0x2')]={'name':{'type':Sequelize[_0x8a80('0x3')],'get':function(_0x47298c){return this['getDataValue'](_0x8a80('0x4'));}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x5a5362){this[_0x8a80('0x5')](_0x8a80('0x4'),_0x5a5362?_0x5a5362:this[_0x8a80('0x6')]('name'));}},'type':{'type':Sequelize[_0x8a80('0x7')],'allowNull':![]},'values':{'type':Sequelize['TEXT'](_0x8a80('0x8')),'get':function(){if(this['getDataValue']('type')===_0x8a80('0x9')){return JSON[_0x8a80('0xa')](this['getDataValue'](_0x8a80('0xb')));}else{return this[_0x8a80('0x6')](_0x8a80('0xb'));}},'set':function(_0x24cd44){if(Array[_0x8a80('0xc')](_0x24cd44)){this[_0x8a80('0x5')](_0x8a80('0xb'),JSON[_0x8a80('0xd')](_0x24cd44));}else{this[_0x8a80('0x5')](_0x8a80('0xb'),_0x24cd44);}}},'required':{'type':Sequelize[_0x8a80('0xe')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x8a80('0xe')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x8a80('0xf')](_0x8a80('0x10'))}}; \ No newline at end of file +var _0x796f=['STRING','setDataValue','name','TEXT','long','type','select','values','isArray','stringify','BOOLEAN','ENUM','voice','sequelize','lodash','exports','getDataValue','alias'];(function(_0x162ab4,_0x578437){var _0x410f69=function(_0x350bfc){while(--_0x350bfc){_0x162ab4['push'](_0x162ab4['shift']());}};_0x410f69(++_0x578437);}(_0x796f,0xd3));var _0xf796=function(_0x406123,_0x20da0b){_0x406123=_0x406123-0x0;var _0x2e079e=_0x796f[_0x406123];return _0x2e079e;};'use strict';var Sequelize=require(_0xf796('0x0'));var _=require(_0xf796('0x1'));module[_0xf796('0x2')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x144012){return this[_0xf796('0x3')](_0xf796('0x4'));}},'alias':{'type':Sequelize[_0xf796('0x5')],'allowNull':![],'set':function(_0x348c64){this[_0xf796('0x6')](_0xf796('0x4'),_0x348c64?_0x348c64:this[_0xf796('0x3')](_0xf796('0x7')));}},'type':{'type':Sequelize[_0xf796('0x5')],'allowNull':![]},'values':{'type':Sequelize[_0xf796('0x8')](_0xf796('0x9')),'get':function(){if(this[_0xf796('0x3')](_0xf796('0xa'))===_0xf796('0xb')){return JSON['parse'](this[_0xf796('0x3')](_0xf796('0xc')));}else{return this[_0xf796('0x3')](_0xf796('0xc'));}},'set':function(_0x202dff){if(Array[_0xf796('0xd')](_0x202dff)){this[_0xf796('0x6')](_0xf796('0xc'),JSON[_0xf796('0xe')](_0x202dff));}else{this[_0xf796('0x6')](_0xf796('0xc'),_0x202dff);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xf796('0xf')],'defaultValue':![]},'actionType':{'type':Sequelize[_0xf796('0x10')](_0xf796('0x11'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index d06a9eb..ab9d7de 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 _0x0294=['body','create','sequelize','transaction','TEXT','Sequelize','number','INTEGER','switch','defaultValue','queryInterface','addColumn','cm_contacts','cf_%d','eml-format','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','reject','save','update','destroy','then','name','send','index','map','CmCustomField','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find'];(function(_0x483ab9,_0x419148){var _0x35043b=function(_0x3453a3){while(--_0x3453a3){_0x483ab9['push'](_0x483ab9['shift']());}};_0x35043b(++_0x419148);}(_0x0294,0x15e));var _0x4029=function(_0x456cd7,_0x3be3f2){_0x456cd7=_0x456cd7-0x0;var _0x40c880=_0x0294[_0x456cd7];return _0x40c880;};'use strict';var emlformat=require(_0x4029('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4029('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4029('0x2'));var moment=require('moment');var BPromise=require(_0x4029('0x3'));var Mustache=require(_0x4029('0x4'));var util=require('util');var path=require(_0x4029('0x5'));var sox=require(_0x4029('0x6'));var csv=require(_0x4029('0x7'));var ejs=require(_0x4029('0x8'));var fs=require('fs');var fs_extra=require(_0x4029('0x9'));var _=require(_0x4029('0xa'));var squel=require('squel');var crypto=require(_0x4029('0xb'));var jsforce=require(_0x4029('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x4029('0x7'));var querystring=require(_0x4029('0xd'));var Papa=require(_0x4029('0xe'));var Redis=require(_0x4029('0xf'));var authService=require(_0x4029('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x4029('0x11'));var hardwareService=require(_0x4029('0x12'));var logger=require('../../config/logger')(_0x4029('0x13'));var utils=require('../../config/utils');var config=require(_0x4029('0x14'));var licenseUtil=require(_0x4029('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x299362,_0x27778c){_0x27778c=_0x27778c||0xcc;return function(_0x298e3d){if(_0x298e3d){return _0x299362[_0x4029('0x16')](_0x27778c);}return _0x299362[_0x4029('0x17')](_0x27778c)[_0x4029('0x18')]();};}function respondWithResult(_0x310672,_0x18c36b){_0x18c36b=_0x18c36b||0xc8;return function(_0x40c9b5){if(_0x40c9b5){return _0x310672[_0x4029('0x17')](_0x18c36b)[_0x4029('0x19')](_0x40c9b5);}};}function respondWithFilteredResult(_0x4b5e6d,_0x3509f9){return function(_0x3c19e9){if(_0x3c19e9){var _0x59ec50=typeof _0x3509f9[_0x4029('0x1a')]===_0x4029('0x1b')&&typeof _0x3509f9[_0x4029('0x1c')]===_0x4029('0x1b');var _0x187fb0=_0x3c19e9['count'];var _0x7c151a=_0x59ec50?0x0:_0x3509f9['offset'];var _0x2403b7=_0x59ec50?_0x3c19e9['count']:_0x3509f9[_0x4029('0x1a')]+_0x3509f9[_0x4029('0x1c')];var _0x48d6b5;if(_0x2403b7>=_0x187fb0){_0x2403b7=_0x187fb0;_0x48d6b5=0xc8;}else{_0x48d6b5=0xce;}_0x4b5e6d[_0x4029('0x17')](_0x48d6b5);return _0x4b5e6d[_0x4029('0x1d')](_0x4029('0x1e'),_0x7c151a+'-'+_0x2403b7+'/'+_0x187fb0)['json'](_0x3c19e9);}return null;};}function patchUpdates(_0x184848){return function(_0x280d03){try{jsonpatch['apply'](_0x280d03,_0x184848,!![]);}catch(_0x48fa58){return BPromise[_0x4029('0x1f')](_0x48fa58);}return _0x280d03[_0x4029('0x20')]();};}function saveUpdates(_0x423c1e,_0x316bca){return function(_0x30945f){if(_0x30945f){return _0x30945f[_0x4029('0x21')](_0x423c1e)['then'](function(_0x45ce71){return _0x45ce71;});}return null;};}function removeEntity(_0x401ce0,_0x4e6665){return function(_0x553c81){if(_0x553c81){return _0x553c81[_0x4029('0x22')]()[_0x4029('0x23')](function(){_0x401ce0[_0x4029('0x17')](0xcc)[_0x4029('0x18')]();});}};}function handleEntityNotFound(_0x3734d8,_0x13a89d){return function(_0x585737){if(!_0x585737){_0x3734d8['sendStatus'](0x194);}return _0x585737;};}function handleError(_0x18e0f5,_0xefadc7){_0xefadc7=_0xefadc7||0x1f4;return function(_0x5f042d){logger['error'](_0x5f042d['stack']);if(_0x5f042d['name']){delete _0x5f042d[_0x4029('0x24')];}_0x18e0f5[_0x4029('0x17')](_0xefadc7)[_0x4029('0x25')](_0x5f042d);};}exports[_0x4029('0x26')]=function(_0x28b450,_0x2b8060){var _0xaffc3b={},_0x11e43c={},_0x2f6528={'count':0x0,'rows':[]};var _0xed6de=_[_0x4029('0x27')](db[_0x4029('0x28')]['rawAttributes'],function(_0x50b490){return{'name':_0x50b490['fieldName'],'type':_0x50b490[_0x4029('0x29')][_0x4029('0x2a')]};});_0x11e43c[_0x4029('0x2b')]=_['differenceBy'](_[_0x4029('0x27')](_0xed6de,_0x4029('0x24')),['name']);_0x11e43c['query']=_[_0x4029('0x2c')](_0x28b450[_0x4029('0x2d')]);_0x11e43c['filters']=_[_0x4029('0x2e')](_0x11e43c[_0x4029('0x2b')],_0x11e43c['query']);_0xaffc3b[_0x4029('0x2f')]=_[_0x4029('0x2e')](_0x11e43c[_0x4029('0x2b')],qs[_0x4029('0x30')](_0x28b450['query']['fields']));_0xaffc3b['attributes']=_0xaffc3b[_0x4029('0x2f')][_0x4029('0x31')]?_0xaffc3b[_0x4029('0x2f')]:_0x11e43c[_0x4029('0x2b')];if(!_0x28b450[_0x4029('0x2d')][_0x4029('0x32')](_0x4029('0x33'))){_0xaffc3b['limit']=qs[_0x4029('0x1c')](_0x28b450[_0x4029('0x2d')][_0x4029('0x1c')]);_0xaffc3b[_0x4029('0x1a')]=qs[_0x4029('0x1a')](_0x28b450[_0x4029('0x2d')][_0x4029('0x1a')]);}_0xaffc3b['order']=qs[_0x4029('0x34')](_0x28b450[_0x4029('0x2d')]['sort']);_0xaffc3b[_0x4029('0x35')]=qs[_0x4029('0x36')](_[_0x4029('0x37')](_0x28b450[_0x4029('0x2d')],_0x11e43c['filters']),_0xed6de);if(_0x28b450[_0x4029('0x2d')][_0x4029('0x38')]){_0xaffc3b['where']=_[_0x4029('0x39')](_0xaffc3b[_0x4029('0x35')],{'$or':_[_0x4029('0x27')](_0xed6de,function(_0x33c53f){if(_0x33c53f[_0x4029('0x29')]!==_0x4029('0x3a')){var _0xb7a14b={};_0xb7a14b[_0x33c53f[_0x4029('0x24')]]={'$like':'%'+_0x28b450[_0x4029('0x2d')]['filter']+'%'};return _0xb7a14b;}})});}_0xaffc3b=_[_0x4029('0x39')]({},_0xaffc3b,_0x28b450[_0x4029('0x3b')]);var _0x1ebd46={'where':_0xaffc3b[_0x4029('0x35')]};return db[_0x4029('0x28')][_0x4029('0x3c')](_0x1ebd46)[_0x4029('0x23')](function(_0x24adca){_0x2f6528['count']=_0x24adca;if(_0x28b450[_0x4029('0x2d')][_0x4029('0x3d')]){_0xaffc3b[_0x4029('0x3e')]=[{'all':!![]}];}return db[_0x4029('0x28')][_0x4029('0x3f')](_0xaffc3b);})['then'](function(_0xd0aef5){_0x2f6528[_0x4029('0x40')]=_0xd0aef5;return _0x2f6528;})[_0x4029('0x23')](respondWithFilteredResult(_0x2b8060,_0xaffc3b))[_0x4029('0x41')](handleError(_0x2b8060,null));};exports[_0x4029('0x42')]=function(_0x149ebd,_0x299f2f){var _0x162436={'raw':!![],'where':{'id':_0x149ebd[_0x4029('0x43')]['id']}},_0x247d95={};_0x247d95[_0x4029('0x2b')]=_[_0x4029('0x2c')](db[_0x4029('0x28')][_0x4029('0x44')]);_0x247d95[_0x4029('0x2d')]=_['keys'](_0x149ebd['query']);_0x247d95[_0x4029('0x36')]=_[_0x4029('0x2e')](_0x247d95[_0x4029('0x2b')],_0x247d95['query']);_0x162436[_0x4029('0x2f')]=_[_0x4029('0x2e')](_0x247d95[_0x4029('0x2b')],qs['fields'](_0x149ebd[_0x4029('0x2d')][_0x4029('0x30')]));_0x162436[_0x4029('0x2f')]=_0x162436[_0x4029('0x2f')][_0x4029('0x31')]?_0x162436[_0x4029('0x2f')]:_0x247d95[_0x4029('0x2b')];if(_0x149ebd[_0x4029('0x2d')]['includeAll']){_0x162436[_0x4029('0x3e')]=[{'all':!![]}];}_0x162436=_[_0x4029('0x39')]({},_0x162436,_0x149ebd[_0x4029('0x3b')]);return db['CmCustomField'][_0x4029('0x45')](_0x162436)[_0x4029('0x23')](handleEntityNotFound(_0x299f2f,null))[_0x4029('0x23')](respondWithResult(_0x299f2f,null))['catch'](handleError(_0x299f2f,null));};exports[_0x4029('0x21')]=function(_0x593cf0,_0x457876){if(_0x593cf0[_0x4029('0x46')]['id']){delete _0x593cf0[_0x4029('0x46')]['id'];}return db[_0x4029('0x28')]['find']({'where':{'id':_0x593cf0[_0x4029('0x43')]['id']}})[_0x4029('0x23')](handleEntityNotFound(_0x457876,null))[_0x4029('0x23')](saveUpdates(_0x593cf0[_0x4029('0x46')],null))[_0x4029('0x23')](respondWithResult(_0x457876,null))[_0x4029('0x41')](handleError(_0x457876,null));};exports[_0x4029('0x22')]=function(_0x2627b5,_0x1103a5){return db[_0x4029('0x28')][_0x4029('0x45')]({'where':{'id':_0x2627b5[_0x4029('0x43')]['id']}})[_0x4029('0x23')](handleEntityNotFound(_0x1103a5,null))[_0x4029('0x23')](removeEntity(_0x1103a5,null))[_0x4029('0x41')](handleError(_0x1103a5,null));};exports[_0x4029('0x47')]=function(_0x41443c,_0x380193){var _0x18a746;return db[_0x4029('0x48')][_0x4029('0x49')](function(_0x366c14){return db[_0x4029('0x28')][_0x4029('0x47')](_0x41443c[_0x4029('0x46')],{'transaction':_0x366c14})[_0x4029('0x23')](function(_0x1d8a56){_0x18a746=_0x1d8a56;var _0x3164d8={'type':db['Sequelize'][_0x4029('0x4a')],'transaction':_0x366c14};switch(_0x41443c['body'][_0x4029('0x29')]){case'text':_0x3164d8['type']=db[_0x4029('0x4b')]['TEXT'];break;case _0x4029('0x4c'):_0x3164d8[_0x4029('0x29')]=db[_0x4029('0x4b')][_0x4029('0x4d')];break;case _0x4029('0x4e'):_0x3164d8[_0x4029('0x29')]=db[_0x4029('0x4b')]['BOOLEAN'];_0x3164d8[_0x4029('0x4f')]=![];break;default:}return db[_0x4029('0x48')][_0x4029('0x50')][_0x4029('0x51')](_0x4029('0x52'),util['format'](_0x4029('0x53'),_0x18a746['id']),_0x3164d8);})['then'](function(){return _0x18a746;});})[_0x4029('0x23')](respondWithResult(_0x380193,0xc9))[_0x4029('0x41')](handleError(_0x380193,null));}; \ No newline at end of file +var _0x9fd3=['count','set','Content-Range','json','apply','reject','update','then','destroy','error','name','send','index','map','CmCustomField','fieldName','type','key','query','keys','filters','intersection','fields','attributes','model','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','include','rows','show','params','rawAttributes','length','includeAll','find','catch','body','create','sequelize','Sequelize','TEXT','text','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','format','cf_%d','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x9fd3,0x141));var _0x39fd=function(_0x6419c0,_0xc09705){_0x6419c0=_0x6419c0-0x0;var _0x20a52f=_0x9fd3[_0x6419c0];return _0x20a52f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x39fd('0x0'));var zipdir=require(_0x39fd('0x1'));var jsonpatch=require(_0x39fd('0x2'));var rp=require('request-promise');var moment=require(_0x39fd('0x3'));var BPromise=require(_0x39fd('0x4'));var Mustache=require(_0x39fd('0x5'));var util=require(_0x39fd('0x6'));var path=require(_0x39fd('0x7'));var sox=require(_0x39fd('0x8'));var csv=require(_0x39fd('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x39fd('0xa'));var _=require(_0x39fd('0xb'));var squel=require(_0x39fd('0xc'));var crypto=require(_0x39fd('0xd'));var jsforce=require(_0x39fd('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x39fd('0x9'));var querystring=require('querystring');var Papa=require(_0x39fd('0xf'));var Redis=require(_0x39fd('0x10'));var authService=require(_0x39fd('0x11'));var qs=require(_0x39fd('0x12'));var as=require(_0x39fd('0x13'));var hardwareService=require(_0x39fd('0x14'));var logger=require(_0x39fd('0x15'))('api');var utils=require(_0x39fd('0x16'));var config=require(_0x39fd('0x17'));var licenseUtil=require(_0x39fd('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x177b7a,_0x3462b2){_0x3462b2=_0x3462b2||0xcc;return function(_0x5b186c){if(_0x5b186c){return _0x177b7a[_0x39fd('0x19')](_0x3462b2);}return _0x177b7a[_0x39fd('0x1a')](_0x3462b2)[_0x39fd('0x1b')]();};}function respondWithResult(_0x4fe325,_0x3532e6){_0x3532e6=_0x3532e6||0xc8;return function(_0x4ee5e1){if(_0x4ee5e1){return _0x4fe325[_0x39fd('0x1a')](_0x3532e6)['json'](_0x4ee5e1);}};}function respondWithFilteredResult(_0x4ca8d8,_0x5604bf){return function(_0xcf5f74){if(_0xcf5f74){var _0x490f41=typeof _0x5604bf[_0x39fd('0x1c')]===_0x39fd('0x1d')&&typeof _0x5604bf[_0x39fd('0x1e')]==='undefined';var _0x99665e=_0xcf5f74['count'];var _0x4c018d=_0x490f41?0x0:_0x5604bf[_0x39fd('0x1c')];var _0x23bfa2=_0x490f41?_0xcf5f74[_0x39fd('0x1f')]:_0x5604bf[_0x39fd('0x1c')]+_0x5604bf[_0x39fd('0x1e')];var _0x3c8fa8;if(_0x23bfa2>=_0x99665e){_0x23bfa2=_0x99665e;_0x3c8fa8=0xc8;}else{_0x3c8fa8=0xce;}_0x4ca8d8[_0x39fd('0x1a')](_0x3c8fa8);return _0x4ca8d8[_0x39fd('0x20')](_0x39fd('0x21'),_0x4c018d+'-'+_0x23bfa2+'/'+_0x99665e)[_0x39fd('0x22')](_0xcf5f74);}return null;};}function patchUpdates(_0x2d5cc8){return function(_0x50d77e){try{jsonpatch[_0x39fd('0x23')](_0x50d77e,_0x2d5cc8,!![]);}catch(_0x6ea82a){return BPromise[_0x39fd('0x24')](_0x6ea82a);}return _0x50d77e['save']();};}function saveUpdates(_0x2e149d,_0x16c1cd){return function(_0x1c88d1){if(_0x1c88d1){return _0x1c88d1[_0x39fd('0x25')](_0x2e149d)[_0x39fd('0x26')](function(_0x221552){return _0x221552;});}return null;};}function removeEntity(_0x46ff02,_0x47b41b){return function(_0x46f03a){if(_0x46f03a){return _0x46f03a[_0x39fd('0x27')]()[_0x39fd('0x26')](function(){_0x46ff02[_0x39fd('0x1a')](0xcc)[_0x39fd('0x1b')]();});}};}function handleEntityNotFound(_0x241bff,_0x46c5cd){return function(_0x4f9023){if(!_0x4f9023){_0x241bff[_0x39fd('0x19')](0x194);}return _0x4f9023;};}function handleError(_0x49c33e,_0x2b573e){_0x2b573e=_0x2b573e||0x1f4;return function(_0x54a0d0){logger[_0x39fd('0x28')](_0x54a0d0['stack']);if(_0x54a0d0[_0x39fd('0x29')]){delete _0x54a0d0[_0x39fd('0x29')];}_0x49c33e[_0x39fd('0x1a')](_0x2b573e)[_0x39fd('0x2a')](_0x54a0d0);};}exports[_0x39fd('0x2b')]=function(_0x2d62e7,_0x234eff){var _0x4c7786={},_0xff3326={},_0x25c739={'count':0x0,'rows':[]};var _0x14d9f3=_[_0x39fd('0x2c')](db[_0x39fd('0x2d')]['rawAttributes'],function(_0x47b965){return{'name':_0x47b965[_0x39fd('0x2e')],'type':_0x47b965[_0x39fd('0x2f')][_0x39fd('0x30')]};});_0xff3326['model']=_['differenceBy'](_[_0x39fd('0x2c')](_0x14d9f3,_0x39fd('0x29')),[_0x39fd('0x29')]);_0xff3326[_0x39fd('0x31')]=_[_0x39fd('0x32')](_0x2d62e7[_0x39fd('0x31')]);_0xff3326[_0x39fd('0x33')]=_[_0x39fd('0x34')](_0xff3326['model'],_0xff3326[_0x39fd('0x31')]);_0x4c7786['attributes']=_[_0x39fd('0x34')](_0xff3326['model'],qs[_0x39fd('0x35')](_0x2d62e7['query']['fields']));_0x4c7786[_0x39fd('0x36')]=_0x4c7786[_0x39fd('0x36')]['length']?_0x4c7786[_0x39fd('0x36')]:_0xff3326[_0x39fd('0x37')];if(!_0x2d62e7[_0x39fd('0x31')][_0x39fd('0x38')](_0x39fd('0x39'))){_0x4c7786['limit']=qs[_0x39fd('0x1e')](_0x2d62e7[_0x39fd('0x31')]['limit']);_0x4c7786['offset']=qs['offset'](_0x2d62e7['query'][_0x39fd('0x1c')]);}_0x4c7786[_0x39fd('0x3a')]=qs[_0x39fd('0x3b')](_0x2d62e7[_0x39fd('0x31')]['sort']);_0x4c7786[_0x39fd('0x3c')]=qs['filters'](_['pick'](_0x2d62e7[_0x39fd('0x31')],_0xff3326[_0x39fd('0x33')]),_0x14d9f3);if(_0x2d62e7[_0x39fd('0x31')]['filter']){_0x4c7786[_0x39fd('0x3c')]=_[_0x39fd('0x3d')](_0x4c7786['where'],{'$or':_[_0x39fd('0x2c')](_0x14d9f3,function(_0x23dd74){if(_0x23dd74[_0x39fd('0x2f')]!==_0x39fd('0x3e')){var _0x5c0c62={};_0x5c0c62[_0x23dd74[_0x39fd('0x29')]]={'$like':'%'+_0x2d62e7[_0x39fd('0x31')][_0x39fd('0x3f')]+'%'};return _0x5c0c62;}})});}_0x4c7786=_['merge']({},_0x4c7786,_0x2d62e7[_0x39fd('0x40')]);var _0x1597f7={'where':_0x4c7786[_0x39fd('0x3c')]};return db[_0x39fd('0x2d')][_0x39fd('0x1f')](_0x1597f7)[_0x39fd('0x26')](function(_0x6abfb5){_0x25c739[_0x39fd('0x1f')]=_0x6abfb5;if(_0x2d62e7[_0x39fd('0x31')]['includeAll']){_0x4c7786[_0x39fd('0x41')]=[{'all':!![]}];}return db[_0x39fd('0x2d')]['findAll'](_0x4c7786);})['then'](function(_0x5c3c8f){_0x25c739[_0x39fd('0x42')]=_0x5c3c8f;return _0x25c739;})['then'](respondWithFilteredResult(_0x234eff,_0x4c7786))['catch'](handleError(_0x234eff,null));};exports[_0x39fd('0x43')]=function(_0x3dfba8,_0x5221bd){var _0x437712={'raw':!![],'where':{'id':_0x3dfba8[_0x39fd('0x44')]['id']}},_0x815dbd={};_0x815dbd[_0x39fd('0x37')]=_['keys'](db['CmCustomField'][_0x39fd('0x45')]);_0x815dbd['query']=_[_0x39fd('0x32')](_0x3dfba8[_0x39fd('0x31')]);_0x815dbd['filters']=_['intersection'](_0x815dbd[_0x39fd('0x37')],_0x815dbd[_0x39fd('0x31')]);_0x437712[_0x39fd('0x36')]=_['intersection'](_0x815dbd[_0x39fd('0x37')],qs[_0x39fd('0x35')](_0x3dfba8[_0x39fd('0x31')][_0x39fd('0x35')]));_0x437712[_0x39fd('0x36')]=_0x437712[_0x39fd('0x36')][_0x39fd('0x46')]?_0x437712[_0x39fd('0x36')]:_0x815dbd['model'];if(_0x3dfba8[_0x39fd('0x31')][_0x39fd('0x47')]){_0x437712[_0x39fd('0x41')]=[{'all':!![]}];}_0x437712=_['merge']({},_0x437712,_0x3dfba8['options']);return db['CmCustomField'][_0x39fd('0x48')](_0x437712)[_0x39fd('0x26')](handleEntityNotFound(_0x5221bd,null))[_0x39fd('0x26')](respondWithResult(_0x5221bd,null))[_0x39fd('0x49')](handleError(_0x5221bd,null));};exports['update']=function(_0x32d8c6,_0x45fe7e){if(_0x32d8c6[_0x39fd('0x4a')]['id']){delete _0x32d8c6[_0x39fd('0x4a')]['id'];}return db[_0x39fd('0x2d')]['find']({'where':{'id':_0x32d8c6[_0x39fd('0x44')]['id']}})['then'](handleEntityNotFound(_0x45fe7e,null))[_0x39fd('0x26')](saveUpdates(_0x32d8c6[_0x39fd('0x4a')],null))[_0x39fd('0x26')](respondWithResult(_0x45fe7e,null))['catch'](handleError(_0x45fe7e,null));};exports[_0x39fd('0x27')]=function(_0x4254cf,_0x47b2eb){return db[_0x39fd('0x2d')][_0x39fd('0x48')]({'where':{'id':_0x4254cf['params']['id']}})['then'](handleEntityNotFound(_0x47b2eb,null))['then'](removeEntity(_0x47b2eb,null))[_0x39fd('0x49')](handleError(_0x47b2eb,null));};exports[_0x39fd('0x4b')]=function(_0x3d4791,_0x2c05a0){var _0x2cb0c7;return db[_0x39fd('0x4c')]['transaction'](function(_0x7f4340){return db[_0x39fd('0x2d')][_0x39fd('0x4b')](_0x3d4791[_0x39fd('0x4a')],{'transaction':_0x7f4340})['then'](function(_0x535ef3){_0x2cb0c7=_0x535ef3;var _0x3882af={'type':db[_0x39fd('0x4d')][_0x39fd('0x4e')],'transaction':_0x7f4340};switch(_0x3d4791[_0x39fd('0x4a')]['type']){case _0x39fd('0x4f'):_0x3882af[_0x39fd('0x2f')]=db[_0x39fd('0x4d')][_0x39fd('0x4e')];break;case'number':_0x3882af[_0x39fd('0x2f')]=db[_0x39fd('0x4d')]['INTEGER'];break;case _0x39fd('0x50'):_0x3882af[_0x39fd('0x2f')]=db['Sequelize'][_0x39fd('0x51')];_0x3882af[_0x39fd('0x52')]=![];break;default:}return db[_0x39fd('0x4c')][_0x39fd('0x53')][_0x39fd('0x54')](_0x39fd('0x55'),util[_0x39fd('0x56')](_0x39fd('0x57'),_0x2cb0c7['id']),_0x3882af);})[_0x39fd('0x26')](function(){return _0x2cb0c7;});})[_0x39fd('0x26')](respondWithResult(_0x2c05a0,0xc9))[_0x39fd('0x49')](handleError(_0x2c05a0,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 7f815fe..349c24c 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 _0xaa15=['api','moment','path','rimraf','../../config/environment','exports','define','CmCustomField','cm_custom_fields','lodash','util','../../config/logger'];(function(_0x42dd63,_0x42af83){var _0x15a8a1=function(_0x532f63){while(--_0x532f63){_0x42dd63['push'](_0x42dd63['shift']());}};_0x15a8a1(++_0x42af83);}(_0xaa15,0xc9));var _0x5aa1=function(_0x1137ec,_0x2cd0b5){_0x1137ec=_0x1137ec-0x0;var _0x41dae3=_0xaa15[_0x1137ec];return _0x41dae3;};'use strict';var _=require(_0x5aa1('0x0'));var util=require(_0x5aa1('0x1'));var logger=require(_0x5aa1('0x2'))(_0x5aa1('0x3'));var moment=require(_0x5aa1('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5aa1('0x5'));var rimraf=require(_0x5aa1('0x6'));var config=require(_0x5aa1('0x7'));var attributes=require('./cmCustomField.attributes');module[_0x5aa1('0x8')]=function(_0x51adad,_0x45e7ba){return _0x51adad[_0x5aa1('0x9')](_0x5aa1('0xa'),attributes,{'tableName':_0x5aa1('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc49f=['exports','define','CmCustomField','cm_custom_fields','lodash','../../config/logger','api','bluebird','rimraf','./cmCustomField.attributes'];(function(_0x44c340,_0x575719){var _0x2cd080=function(_0x1109ea){while(--_0x1109ea){_0x44c340['push'](_0x44c340['shift']());}};_0x2cd080(++_0x575719);}(_0xc49f,0x108));var _0xfc49=function(_0x542ce8,_0x475277){_0x542ce8=_0x542ce8-0x0;var _0x2409eb=_0xc49f[_0x542ce8];return _0x2409eb;};'use strict';var _=require(_0xfc49('0x0'));var util=require('util');var logger=require(_0xfc49('0x1'))(_0xfc49('0x2'));var moment=require('moment');var BPromise=require(_0xfc49('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xfc49('0x4'));var config=require('../../config/environment');var attributes=require(_0xfc49('0x5'));module[_0xfc49('0x6')]=function(_0x4bfaca,_0x219626){return _0x4bfaca[_0xfc49('0x7')](_0xfc49('0x8'),attributes,{'tableName':_0xfc49('0x9'),'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 220136e..10bdaf8 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 _0xaa15=['lodash','util','moment','bluebird','randomstring','../../config/logger','../../config/environment','jayson/promise','client','request','info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x18f64a,_0x1c8248){var _0x44687f=function(_0x1234ad){while(--_0x1234ad){_0x18f64a['push'](_0x18f64a['shift']());}};_0x44687f(++_0x1c8248);}(_0xaa15,0xfc));var _0x5aa1=function(_0x1816ea,_0x10978a){_0x1816ea=_0x1816ea-0x0;var _0x369a33=_0xaa15[_0x1816ea];return _0x369a33;};'use strict';var _=require(_0x5aa1('0x0'));var util=require(_0x5aa1('0x1'));var moment=require(_0x5aa1('0x2'));var BPromise=require(_0x5aa1('0x3'));var rs=require(_0x5aa1('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5aa1('0x5'))('rpc');var config=require(_0x5aa1('0x6'));var jayson=require(_0x5aa1('0x7'));var client=jayson[_0x5aa1('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x441fb1,_0xc74bc3,_0x21cce0){return new BPromise(function(_0x320f6c,_0x5308f5){return client[_0x5aa1('0x9')](_0x441fb1,_0x21cce0)['then'](function(_0x86a76a){logger[_0x5aa1('0xa')](_0x5aa1('0xb'),_0xc74bc3,_0x5aa1('0xc'));logger[_0x5aa1('0xd')](_0x5aa1('0xe'),_0xc74bc3,_0x5aa1('0xc'),JSON[_0x5aa1('0xf')](_0x86a76a));if(_0x86a76a[_0x5aa1('0x10')]){if(_0x86a76a['error'][_0x5aa1('0x11')]===0x1f4){logger['error'](_0x5aa1('0xb'),_0xc74bc3,_0x86a76a[_0x5aa1('0x10')][_0x5aa1('0x12')]);return _0x5308f5(_0x86a76a[_0x5aa1('0x10')][_0x5aa1('0x12')]);}logger['error'](_0x5aa1('0xb'),_0xc74bc3,_0x86a76a[_0x5aa1('0x10')][_0x5aa1('0x12')]);return _0x320f6c(_0x86a76a[_0x5aa1('0x10')][_0x5aa1('0x12')]);}else{logger[_0x5aa1('0xa')](_0x5aa1('0xb'),_0xc74bc3,_0x5aa1('0xc'));_0x320f6c(_0x86a76a[_0x5aa1('0x13')]['message']);}})[_0x5aa1('0x14')](function(_0x15ed7a){logger['error'](_0x5aa1('0xb'),_0xc74bc3,_0x15ed7a);_0x5308f5(_0x15ed7a);});});} \ No newline at end of file +var _0xf087=['CmCustomField,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x529e13,_0x232c89){var _0x275b55=function(_0x420d4f){while(--_0x420d4f){_0x529e13['push'](_0x529e13['shift']());}};_0x275b55(++_0x232c89);}(_0xf087,0x198));var _0x7f08=function(_0x4cdd6e,_0x542cd2){_0x4cdd6e=_0x4cdd6e-0x0;var _0x130abf=_0xf087[_0x4cdd6e];return _0x130abf;};'use strict';var _=require(_0x7f08('0x0'));var util=require(_0x7f08('0x1'));var moment=require(_0x7f08('0x2'));var BPromise=require(_0x7f08('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7f08('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7f08('0x5'));var logger=require(_0x7f08('0x6'))(_0x7f08('0x7'));var config=require(_0x7f08('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x7f08('0x9')][_0x7f08('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x8fde10,_0x4fd6b6,_0x1a41e8){return new BPromise(function(_0x7f470a,_0x150a2f){return client[_0x7f08('0xb')](_0x8fde10,_0x1a41e8)['then'](function(_0x168860){logger['info'](_0x7f08('0xc'),_0x4fd6b6,_0x7f08('0xd'));logger[_0x7f08('0xe')]('CmCustomField,\x20%s,\x20%s,\x20%s',_0x4fd6b6,_0x7f08('0xd'),JSON[_0x7f08('0xf')](_0x168860));if(_0x168860['error']){if(_0x168860['error'][_0x7f08('0x10')]===0x1f4){logger[_0x7f08('0x11')](_0x7f08('0xc'),_0x4fd6b6,_0x168860[_0x7f08('0x11')]['message']);return _0x150a2f(_0x168860[_0x7f08('0x11')][_0x7f08('0x12')]);}logger['error'](_0x7f08('0xc'),_0x4fd6b6,_0x168860[_0x7f08('0x11')][_0x7f08('0x12')]);return _0x7f470a(_0x168860[_0x7f08('0x11')][_0x7f08('0x12')]);}else{logger['info']('CmCustomField,\x20%s,\x20%s',_0x4fd6b6,_0x7f08('0xd'));_0x7f470a(_0x168860[_0x7f08('0x13')]['message']);}})[_0x7f08('0x14')](function(_0x1d52d5){logger[_0x7f08('0x11')](_0x7f08('0xc'),_0x4fd6b6,_0x1d52d5);_0x150a2f(_0x1d52d5);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 2cdc145..d57e560 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 _0xac39=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','index','show','post','update','destroy','exports','multer'];(function(_0xd02bb,_0x26e2d0){var _0x1cdf23=function(_0x18fd05){while(--_0x18fd05){_0xd02bb['push'](_0xd02bb['shift']());}};_0x1cdf23(++_0x26e2d0);}(_0xac39,0x11c));var _0x9ac3=function(_0x300090,_0x3ae21d){_0x300090=_0x300090-0x0;var _0xf93823=_0xac39[_0x300090];return _0xf93823;};'use strict';var multer=require(_0x9ac3('0x0'));var util=require(_0x9ac3('0x1'));var path=require(_0x9ac3('0x2'));var timeout=require(_0x9ac3('0x3'));var express=require(_0x9ac3('0x4'));var router=express[_0x9ac3('0x5')]();var fs_extra=require(_0x9ac3('0x6'));var auth=require(_0x9ac3('0x7'));var interaction=require(_0x9ac3('0x8'));var config=require(_0x9ac3('0x9'));var controller=require(_0x9ac3('0xa'));router[_0x9ac3('0xb')]('/',auth[_0x9ac3('0xc')](),controller[_0x9ac3('0xd')]);router[_0x9ac3('0xb')]('/:id',auth[_0x9ac3('0xc')](),controller[_0x9ac3('0xe')]);router[_0x9ac3('0xf')]('/',auth[_0x9ac3('0xc')](),controller['create']);router['put']('/:id',auth[_0x9ac3('0xc')](),controller[_0x9ac3('0x10')]);router['delete']('/:id',auth[_0x9ac3('0xc')](),controller[_0x9ac3('0x11')]);module[_0x9ac3('0x12')]=router; \ No newline at end of file +var _0x28e3=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','show','post','create','/:id','update','destroy','exports','multer','util','path','connect-timeout'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0x28e3,0x106));var _0x328e=function(_0x2b5513,_0x3fe5cd){_0x2b5513=_0x2b5513-0x0;var _0x578fd2=_0x28e3[_0x2b5513];return _0x578fd2;};'use strict';var multer=require(_0x328e('0x0'));var util=require(_0x328e('0x1'));var path=require(_0x328e('0x2'));var timeout=require(_0x328e('0x3'));var express=require('express');var router=express[_0x328e('0x4')]();var fs_extra=require(_0x328e('0x5'));var auth=require(_0x328e('0x6'));var interaction=require(_0x328e('0x7'));var config=require(_0x328e('0x8'));var controller=require(_0x328e('0x9'));router[_0x328e('0xa')]('/',auth[_0x328e('0xb')](),controller['index']);router['get']('/:id',auth[_0x328e('0xb')](),controller[_0x328e('0xc')]);router[_0x328e('0xd')]('/',auth[_0x328e('0xb')](),controller[_0x328e('0xe')]);router['put'](_0x328e('0xf'),auth[_0x328e('0xb')](),controller[_0x328e('0x10')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x328e('0x11')]);module[_0x328e('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 8bf05af..85e78c4 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 _0xeb01=['moment','exports','STRING','BOOLEAN','YYYY-MM-DD\x20HH:mm:ss','INTEGER','contactListQueue','DATE'];(function(_0x10bbf3,_0xde620a){var _0x13e422=function(_0x578026){while(--_0x578026){_0x10bbf3['push'](_0x10bbf3['shift']());}};_0x13e422(++_0xde620a);}(_0xeb01,0x1d0));var _0x1eb0=function(_0x116b06,_0x89886f){_0x116b06=_0x116b06-0x0;var _0xa66abd=_0xeb01[_0x116b06];return _0xa66abd;};'use strict';var moment=require(_0x1eb0('0x0'));var Sequelize=require('sequelize');module[_0x1eb0('0x1')]={'phone':{'type':Sequelize[_0x1eb0('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0x1eb0('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()['format'](_0x1eb0('0x4'))},'countbusyretry':{'type':Sequelize[_0x1eb0('0x5')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x1eb0('0x5')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x1eb0('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x1eb0('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x1eb0('0x5')],'unique':_0x1eb0('0x6')},'ListId':{'type':Sequelize[_0x1eb0('0x5')],'unique':_0x1eb0('0x6')},'UserId':{'type':Sequelize[_0x1eb0('0x5')]},'VoiceQueueId':{'type':Sequelize[_0x1eb0('0x5')],'unique':_0x1eb0('0x6')},'CampaignId':{'type':Sequelize[_0x1eb0('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0x1eb0('0x5')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x1eb0('0x5')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x1eb0('0x5')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']},'recallmeNotifiedDate':{'type':Sequelize[_0x1eb0('0x7')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0xe526=['BOOLEAN','DATE','YYYY-MM-DD\x20HH:mm:ss','INTEGER','STRING','UNSIGNED','contactListQueue','sequelize'];(function(_0x3b803f,_0x5bfa02){var _0x1cf048=function(_0x5dd411){while(--_0x5dd411){_0x3b803f['push'](_0x3b803f['shift']());}};_0x1cf048(++_0x5bfa02);}(_0xe526,0xaf));var _0x6e52=function(_0xe67fb6,_0x55f75c){_0xe67fb6=_0xe67fb6-0x0;var _0x5f1cc9=_0xe526[_0xe67fb6];return _0x5f1cc9;};'use strict';var moment=require('moment');var Sequelize=require(_0x6e52('0x0'));module['exports']={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize[_0x6e52('0x1')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x6e52('0x2')],'defaultValue':moment()['format'](_0x6e52('0x3'))},'countbusyretry':{'type':Sequelize[_0x6e52('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x6e52('0x4')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x6e52('0x1')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x6e52('0x5')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x6e52('0x2')]},'priority':{'type':Sequelize[_0x6e52('0x4')](0x2)[_0x6e52('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x6e52('0x1')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x6e52('0x4')],'unique':_0x6e52('0x7')},'ListId':{'type':Sequelize[_0x6e52('0x4')],'unique':'contactListQueue'},'UserId':{'type':Sequelize[_0x6e52('0x4')]},'VoiceQueueId':{'type':Sequelize[_0x6e52('0x4')],'unique':_0x6e52('0x7')},'CampaignId':{'type':Sequelize[_0x6e52('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0x6e52('0x4')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x6e52('0x4')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x6e52('0x4')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x6e52('0x4')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x6e52('0x4')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x6e52('0x5')]},'recallmeNotifiedDate':{'type':Sequelize[_0x6e52('0x2')],'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 6d00b95..b8fb248 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 _0xfc76=['destroy','end','getPreview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize','value','direction','hopperIds','priority','ASC','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','isEmpty','scheduledAt','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','recallme','LOCK','UPDATE','Contact','List','dialActive','getPreviewRecall','transaction','Company','CmList','Queue','getOpenContacts','getVoiceQueues','outbound','preview','isNumber','error','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','sendStatus','timezones','json','getTimezone','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','status','offset','undefined','limit','count','set','Content-Range','update','then','stack','name','index','map','CmHopper','rawAttributes','fieldName','key','model','keys','filters','intersection','$and','$or','$gt','$gte','$lt','$lte','$ne','$eq','$not','$between','$notBetween','$in','$notIn','$like','$iLike','$notILike','$overlap','$contained','$any','attributes','fields','query','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','describe','VoiceQueueId','CampaignId','VoiceQueue','Campaign','dataValues','createdAt','updatedAt','state','statedesc','deleted','campaign','user','UserId','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','queue','ivr','CmContact','ContactId','lastName','isNil','firstName','calleridname','CmHopperFinal'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xfc76,0xb5));var _0x6fc7=function(_0x19221b,_0x5cb19b){_0x19221b=_0x19221b-0x0;var _0x110b8c=_0xfc76[_0x19221b];return _0x110b8c;};'use strict';var moment=require('moment');var _=require(_0x6fc7('0x0'));var qs=require(_0x6fc7('0x1'));var logger=require(_0x6fc7('0x2'))(_0x6fc7('0x3'));var shared=require(_0x6fc7('0x4'));var db=require('../../mysqldb')['db'];function respondWithResult(_0x316cc4,_0x40d212){_0x40d212=_0x40d212||0xc8;return function(_0x51280c){if(_0x51280c){return _0x316cc4[_0x6fc7('0x5')](_0x40d212)['json'](_0x51280c);}};}function respondWithFilteredResult(_0xe8177b,_0x82a35a){return function(_0x385a5a){if(_0x385a5a){var _0x4da7c3=typeof _0x82a35a[_0x6fc7('0x6')]===_0x6fc7('0x7')&&typeof _0x82a35a[_0x6fc7('0x8')]===_0x6fc7('0x7');var _0x36cb16=_0x385a5a[_0x6fc7('0x9')];var _0x4de75e=_0x4da7c3?0x0:_0x82a35a[_0x6fc7('0x6')];var _0x61730a=_0x4da7c3?_0x385a5a[_0x6fc7('0x9')]:_0x82a35a[_0x6fc7('0x6')]+_0x82a35a[_0x6fc7('0x8')];var _0x3c067c;if(_0x61730a>=_0x36cb16){_0x61730a=_0x36cb16;_0x3c067c=0xc8;}else{_0x3c067c=0xce;}_0xe8177b['status'](_0x3c067c);return _0xe8177b[_0x6fc7('0xa')](_0x6fc7('0xb'),_0x4de75e+'-'+_0x61730a+'/'+_0x36cb16)['json'](_0x385a5a);}return null;};}function saveUpdates(_0x433adc,_0x2c32b8){return function(_0x5f438d){if(_0x5f438d){return _0x5f438d[_0x6fc7('0xc')](_0x433adc)[_0x6fc7('0xd')](function(_0x4af729){return _0x4af729;});}return null;};}function handleEntityNotFound(_0x44d8e0,_0x3c107f){return function(_0x10a482){if(!_0x10a482){_0x44d8e0['sendStatus'](0x194);}return _0x10a482;};}function handleError(_0x556e28,_0xbb4a3e){_0xbb4a3e=_0xbb4a3e||0x1f4;return function(_0x45d585){logger['error'](_0x45d585[_0x6fc7('0xe')]);if(_0x45d585[_0x6fc7('0xf')]){delete _0x45d585[_0x6fc7('0xf')];}_0x556e28[_0x6fc7('0x5')](_0xbb4a3e)['send'](_0x45d585);};}exports[_0x6fc7('0x10')]=function(_0x69ea70,_0x280c69){var _0x62ec76={},_0x12be21={},_0x4258f0={'count':0x0,'rows':[]};var _0x59bb98=_[_0x6fc7('0x11')](db[_0x6fc7('0x12')][_0x6fc7('0x13')],function(_0x3bd771){return{'name':_0x3bd771[_0x6fc7('0x14')],'type':_0x3bd771['type'][_0x6fc7('0x15')]};});_0x12be21[_0x6fc7('0x16')]=_['map'](_0x59bb98,_0x6fc7('0xf'));_0x12be21['query']=_[_0x6fc7('0x17')](_0x69ea70['query']);_0x12be21[_0x6fc7('0x18')]=_[_0x6fc7('0x19')](_0x12be21[_0x6fc7('0x16')],_0x12be21['query']);_0x12be21[_0x6fc7('0x18')]=_['concat'](_0x12be21[_0x6fc7('0x18')],[_0x6fc7('0x1a'),_0x6fc7('0x1b'),_0x6fc7('0x1c'),_0x6fc7('0x1d'),_0x6fc7('0x1e'),_0x6fc7('0x1f'),_0x6fc7('0x20'),_0x6fc7('0x21'),_0x6fc7('0x22'),_0x6fc7('0x23'),_0x6fc7('0x24'),_0x6fc7('0x25'),_0x6fc7('0x26'),_0x6fc7('0x27'),'$notLike',_0x6fc7('0x28'),_0x6fc7('0x29'),_0x6fc7('0x27'),_0x6fc7('0x2a'),'$contains',_0x6fc7('0x2b'),_0x6fc7('0x2c')]);_0x62ec76[_0x6fc7('0x2d')]=_[_0x6fc7('0x19')](_0x12be21[_0x6fc7('0x16')],qs[_0x6fc7('0x2e')](_0x69ea70[_0x6fc7('0x2f')][_0x6fc7('0x2e')]));_0x62ec76['attributes']=_0x62ec76['attributes'][_0x6fc7('0x30')]?_0x62ec76[_0x6fc7('0x2d')]:_0x12be21[_0x6fc7('0x16')];if(!_0x69ea70[_0x6fc7('0x2f')][_0x6fc7('0x31')](_0x6fc7('0x32'))){_0x62ec76['limit']=qs[_0x6fc7('0x8')](_0x69ea70[_0x6fc7('0x2f')][_0x6fc7('0x8')]);_0x62ec76[_0x6fc7('0x6')]=qs['offset'](_0x69ea70['query']['offset']);}_0x62ec76[_0x6fc7('0x33')]=qs[_0x6fc7('0x34')](_0x69ea70[_0x6fc7('0x2f')][_0x6fc7('0x34')]);_0x62ec76[_0x6fc7('0x35')]=qs[_0x6fc7('0x18')](_[_0x6fc7('0x36')](_0x69ea70[_0x6fc7('0x2f')],_0x12be21[_0x6fc7('0x18')]),_0x59bb98);if(_0x69ea70['query'][_0x6fc7('0x37')]){_0x62ec76['where']=_[_0x6fc7('0x38')](_0x62ec76[_0x6fc7('0x35')],{'$or':_[_0x6fc7('0x11')](_0x59bb98,function(_0x24bb23){if(_0x24bb23['type']!==_0x6fc7('0x39')){var _0x3245a8={};_0x3245a8[_0x24bb23[_0x6fc7('0xf')]]={'$like':'%'+_0x69ea70[_0x6fc7('0x2f')]['filter']+'%'};return _0x3245a8;}})});}_0x62ec76=_[_0x6fc7('0x38')]({},_0x62ec76,_0x69ea70['options']);var _0xec700a={'where':_0x62ec76['where']};return db['CmHopper']['count'](_0xec700a)[_0x6fc7('0xd')](function(_0x516580){_0x4258f0[_0x6fc7('0x9')]=_0x516580;if(_0x69ea70[_0x6fc7('0x2f')][_0x6fc7('0x3a')]){_0x62ec76[_0x6fc7('0x3b')]=[{'all':!![]}];}return db[_0x6fc7('0x12')][_0x6fc7('0x3c')](_0x62ec76);})[_0x6fc7('0xd')](function(_0x2990af){_0x4258f0[_0x6fc7('0x3d')]=_0x2990af;return _0x4258f0;})[_0x6fc7('0xd')](respondWithFilteredResult(_0x280c69,_0x62ec76))[_0x6fc7('0x3e')](handleError(_0x280c69,null));};exports[_0x6fc7('0x3f')]=function(_0x3c652e,_0xe46d5){var _0x3ac76e={'raw':!![],'where':{'id':_0x3c652e[_0x6fc7('0x40')]['id']}},_0x3be13b={};_0x3be13b[_0x6fc7('0x16')]=_['keys'](db['CmHopper'][_0x6fc7('0x13')]);_0x3be13b[_0x6fc7('0x2f')]=_[_0x6fc7('0x17')](_0x3c652e[_0x6fc7('0x2f')]);_0x3be13b['filters']=_[_0x6fc7('0x19')](_0x3be13b[_0x6fc7('0x16')],_0x3be13b[_0x6fc7('0x2f')]);_0x3ac76e[_0x6fc7('0x2d')]=_[_0x6fc7('0x19')](_0x3be13b[_0x6fc7('0x16')],qs[_0x6fc7('0x2e')](_0x3c652e[_0x6fc7('0x2f')][_0x6fc7('0x2e')]));_0x3ac76e[_0x6fc7('0x2d')]=_0x3ac76e[_0x6fc7('0x2d')][_0x6fc7('0x30')]?_0x3ac76e['attributes']:_0x3be13b[_0x6fc7('0x16')];if(_0x3c652e[_0x6fc7('0x2f')]['includeAll']){_0x3ac76e[_0x6fc7('0x3b')]=[{'all':!![]}];}_0x3ac76e=_[_0x6fc7('0x38')]({},_0x3ac76e,_0x3c652e[_0x6fc7('0x41')]);return db[_0x6fc7('0x12')][_0x6fc7('0x42')](_0x3ac76e)[_0x6fc7('0xd')](handleEntityNotFound(_0xe46d5,null))[_0x6fc7('0xd')](respondWithResult(_0xe46d5,null))[_0x6fc7('0x3e')](handleError(_0xe46d5,null));};exports[_0x6fc7('0x43')]=function(_0x1a727d,_0x49bfe6){return db[_0x6fc7('0x12')][_0x6fc7('0x43')](_0x1a727d['body'],{})['then'](respondWithResult(_0x49bfe6,0xc9))[_0x6fc7('0x3e')](handleError(_0x49bfe6,null));};exports[_0x6fc7('0xc')]=function(_0x4496e4,_0x554a48){if(_0x4496e4[_0x6fc7('0x44')]['id']){delete _0x4496e4[_0x6fc7('0x44')]['id'];}return db['CmHopper'][_0x6fc7('0x42')]({'where':{'id':_0x4496e4[_0x6fc7('0x40')]['id']}})[_0x6fc7('0xd')](handleEntityNotFound(_0x554a48,null))[_0x6fc7('0xd')](saveUpdates(_0x4496e4[_0x6fc7('0x44')],null))[_0x6fc7('0xd')](respondWithResult(_0x554a48,null))[_0x6fc7('0x3e')](handleError(_0x554a48,null));};exports[_0x6fc7('0x45')]=function(_0x357d7a,_0x24df1f){return db[_0x6fc7('0x12')]['describe']()['then'](respondWithResult(_0x24df1f,null))['catch'](handleError(_0x24df1f,null));};exports['destroy']=function(_0x22a0c5,_0x5d4d40){var _0x3357f9;var _0x25e671=_0x22a0c5[_0x6fc7('0x40')]['id'];return db[_0x6fc7('0x12')][_0x6fc7('0x42')]({'where':{'id':_0x22a0c5[_0x6fc7('0x40')]['id']}})['then'](handleEntityNotFound(_0x5d4d40,null))[_0x6fc7('0xd')](function(_0x2ac05d){if(_0x2ac05d){return _0x2ac05d['destroy']()[_0x6fc7('0xd')](function(_0x24bf3e){return _0x24bf3e;});}})[_0x6fc7('0xd')](function(_0x334256){_0x3357f9=_0x334256;if(_0x334256){if(_0x334256[_0x6fc7('0x46')]||_0x334256[_0x6fc7('0x47')]){return db[_0x334256[_0x6fc7('0x46')]?_0x6fc7('0x48'):_0x6fc7('0x49')][_0x6fc7('0x42')]({'where':{'id':_0x334256['VoiceQueueId']?_0x334256[_0x6fc7('0x46')]:_0x334256[_0x6fc7('0x47')]},'attributes':['id',_0x6fc7('0xf')],'raw':!![]});}}})['then'](function(_0x44105e){var _0x4bb441={};if(_0x44105e){_[_0x6fc7('0x38')](_0x4bb441,_['omit'](_0x3357f9[_0x6fc7('0x4a')],[_0x6fc7('0x4b'),_0x6fc7('0x4c'),'id']));_0x4bb441[_0x6fc7('0x4d')]=0x15;_0x4bb441[_0x6fc7('0x4e')]=_0x6fc7('0x4f');_0x4bb441[_0x6fc7('0x50')]=_0x44105e[_0x6fc7('0xf')];_0x4bb441['membername']=_0x22a0c5[_0x6fc7('0x51')][_0x6fc7('0xf')];_0x4bb441[_0x6fc7('0x52')]=_0x22a0c5[_0x6fc7('0x51')]['id'];_0x4bb441[_0x6fc7('0x4f')]=!![];_0x4bb441['deletedat']=moment()[_0x6fc7('0x53')](_0x6fc7('0x54'));_0x4bb441[_0x6fc7('0x55')]=_0x3357f9[_0x6fc7('0x56')];_0x4bb441[_0x6fc7('0x57')]=_0x3357f9[_0x6fc7('0x46')]?_0x6fc7('0x58'):_0x6fc7('0x59');return db[_0x6fc7('0x5a')][_0x6fc7('0x42')]({'where':{'id':_0x4bb441[_0x6fc7('0x5b')]},'attributes':['firstName',_0x6fc7('0x5c')]})[_0x6fc7('0xd')](function(_0x27aa59){if(!_[_0x6fc7('0x5d')](_0x5d4d40)&&!_[_0x6fc7('0x5d')](_0x27aa59[_0x6fc7('0x5e')])){_0x4bb441[_0x6fc7('0x5f')]=_0x27aa59[_0x6fc7('0x5e')];if(!_['isNil'](_0x27aa59[_0x6fc7('0x5c')])){_0x4bb441['calleridname']+='\x20'+_0x27aa59['lastName'];}}})['finally'](function(){return db[_0x6fc7('0x60')][_0x6fc7('0x43')](_0x4bb441);});}})[_0x6fc7('0xd')](function(_0x4a166c){return db['CmHopperAdditionalPhone'][_0x6fc7('0x61')]({'where':{'CmHopperId':_0x25e671}});})['then'](function(){return _0x5d4d40[_0x6fc7('0x5')](0xcc)[_0x6fc7('0x62')]();})[_0x6fc7('0x3e')](handleError(_0x5d4d40,null));};exports[_0x6fc7('0x63')]=function(_0x389b31,_0x376047){var _0x26fb83=[];return db[_0x6fc7('0x5a')][_0x6fc7('0x45')]()[_0x6fc7('0xd')](function(_0x5642df){_0x26fb83=_[_0x6fc7('0x17')](_0x5642df);return _0x389b31[_0x6fc7('0x51')]['getVoiceQueues']({'where':{'type':'outbound','dialActive':!![],'dialMethod':'preview'},'attributes':['id',_0x6fc7('0x64'),_0x6fc7('0x65')],'raw':!![]});})[_0x6fc7('0xd')](function(_0x2852ff){if(_0x2852ff&&_0x2852ff[_0x6fc7('0x30')]){return db[_0x6fc7('0x66')]['transaction'](function(_0x17c6c5){var _0x33e02b={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0x6fc7('0x11')](_0x2852ff,'id')},'$or':[{'UserId':null},{'UserId':_0x389b31[_0x6fc7('0x51')]['id']}]};var _0xe5c9f0={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x2852ff)[_0x6fc7('0x37')]([_0x6fc7('0x65'),0x0])[_0x6fc7('0x11')]('id')[_0x6fc7('0x67')]()},'$or':[{'UserId':null},{'UserId':_0x389b31[_0x6fc7('0x51')]['id']}]};var _0x287604={'$or':[_0x33e02b,_0xe5c9f0]};var _0xbeec61=[];if(_0x389b31['body'][_0x6fc7('0x68')]&&_0x389b31[_0x6fc7('0x44')][_0x6fc7('0x68')]==='prev'){if(!_['isEmpty'](_0x389b31[_0x6fc7('0x44')][_0x6fc7('0x69')])){_0x287604['id']={'$in':_0x389b31[_0x6fc7('0x44')][_0x6fc7('0x69')]};}_0xbeec61=[[_0x6fc7('0x6a'),_0x6fc7('0x6b')],['scheduledAt',_0x2852ff[0x0][_0x6fc7('0x64')]==='ASC'?_0x6fc7('0x6c'):_0x6fc7('0x6b')],db['sequelize'][_0x6fc7('0x6d')](_0x6fc7('0x6e')),['id',_0x6fc7('0x6c')]];}else{if(!_[_0x6fc7('0x6f')](_0x389b31[_0x6fc7('0x44')][_0x6fc7('0x69')])){_0x287604['id']={'$notIn':_0x389b31['body']['hopperIds']};}_0xbeec61=[[_0x6fc7('0x6a'),'DESC'],[_0x6fc7('0x70'),_0x2852ff[0x0]['dialOrderByScheduledAt']],db[_0x6fc7('0x66')][_0x6fc7('0x6d')](_0x6fc7('0x71')),['id',_0x6fc7('0x6b')]];}return db[_0x6fc7('0x12')][_0x6fc7('0x72')]({'attributes':['id',_0x6fc7('0x73'),_0x6fc7('0x56'),_0x6fc7('0x74')],'where':_0x287604,'order':_0xbeec61,'transaction':_0x17c6c5,'lock':_0x17c6c5[_0x6fc7('0x75')][_0x6fc7('0x76')],'include':[{'model':db[_0x6fc7('0x5a')],'as':_0x6fc7('0x77'),'attributes':_0x26fb83,'include':[{'model':db['CmCompany'],'as':'Company','attributes':['id','name']}]},{'model':db['CmList'],'as':_0x6fc7('0x78'),'attributes':['id',_0x6fc7('0xf')]},{'model':db[_0x6fc7('0x48')],'as':'Queue','attributes':['id','name',_0x6fc7('0x79')]}]})[_0x6fc7('0xd')](function(_0x57c69b){if(_0x57c69b){return _0x57c69b[_0x6fc7('0xc')]({'UserId':_0x389b31[_0x6fc7('0x51')]['id']},{'transaction':_0x17c6c5});}});});}})[_0x6fc7('0xd')](handleEntityNotFound(_0x376047,null))[_0x6fc7('0xd')](respondWithResult(_0x376047,null))['catch'](handleError(_0x376047,null));};exports[_0x6fc7('0x7a')]=function(_0x52873a,_0x52508f,_0xcee3db){var _0x148c69=[];var _0x681873=_0x52873a[_0x6fc7('0x40')]['id'];var _0x5755b6=_0x52873a[_0x6fc7('0x51')]['id'];return db['CmContact']['describe']()[_0x6fc7('0xd')](function(_0x351919){_0x148c69=_[_0x6fc7('0x17')](_0x351919);return db[_0x6fc7('0x66')][_0x6fc7('0x7b')](function(_0x5109b0){const _0x265cb2={'id':_0x681873};return db[_0x6fc7('0x12')][_0x6fc7('0x72')]({'attributes':['id',_0x6fc7('0x73'),'recallme'],'where':_0x265cb2,'transaction':_0x5109b0,'lock':_0x5109b0[_0x6fc7('0x75')][_0x6fc7('0x76')],'include':[{'model':db[_0x6fc7('0x5a')],'as':'Contact','attributes':_0x148c69,'include':[{'model':db['CmCompany'],'as':_0x6fc7('0x7c'),'attributes':['id',_0x6fc7('0xf')]}]},{'model':db[_0x6fc7('0x7d')],'as':_0x6fc7('0x78'),'attributes':['id',_0x6fc7('0xf')]},{'model':db[_0x6fc7('0x48')],'as':_0x6fc7('0x7e'),'attributes':['id',_0x6fc7('0xf'),_0x6fc7('0x79')]}]})[_0x6fc7('0xd')](function(_0x5cdb17){if(_0x5cdb17){return _0x5cdb17[_0x6fc7('0xc')]({'UserId':_0x5755b6},{'transaction':_0x5109b0});}});});})[_0x6fc7('0xd')](handleEntityNotFound(_0x52508f,null))['then'](respondWithResult(_0x52508f,null))[_0x6fc7('0x3e')](handleError(_0x52508f,null));};exports[_0x6fc7('0x7f')]=function(_0xa4384d,_0x17f059){return _0xa4384d['user'][_0x6fc7('0x80')]({'where':{'type':_0x6fc7('0x81'),'dialActive':!![],'dialMethod':_0x6fc7('0x82')},'attributes':['id'],'raw':!![]})[_0x6fc7('0xd')](function(_0x50134d){if(_0x50134d&&_0x50134d[_0x6fc7('0x30')]){return db[_0x6fc7('0x12')][_0x6fc7('0x9')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x6fc7('0x53')](_0x6fc7('0x54'))},'VoiceQueueId':{'$in':_[_0x6fc7('0x11')](_0x50134d,'id')},'$or':[{'UserId':null},{'UserId':_0xa4384d[_0x6fc7('0x51')]['id']}]}});}return 0x0;})[_0x6fc7('0xd')](function(_0x2716de){if(!_['isNil'](_0x2716de)&&_[_0x6fc7('0x83')](_0x2716de)){return _0x17f059['status'](0xc8)['json']({'contacts':_0x2716de});}else{logger[_0x6fc7('0x84')](_0x6fc7('0x85'),'getOpenContacts',0x194,_0x6fc7('0x86'));_0x17f059[_0x6fc7('0x87')](0x194);}})[_0x6fc7('0x3e')](handleError(_0x17f059,null));};exports['getTimezones']=function(_0x2975d3,_0x29d9bc){var _0x4e34a2=shared[_0x6fc7('0x88')];var _0x209e66=[];_[_0x6fc7('0x11')](_0x4e34a2,function(_0xae380a){_0x209e66['push']({'id':_0xae380a[_0x6fc7('0xf')],'name':_0xae380a[_0x6fc7('0xf')],'utcOffset':_0xae380a['utcOffset']});});return _0x29d9bc['status'](0xc8)[_0x6fc7('0x89')]({'tz':_0x209e66});};exports[_0x6fc7('0x8a')]=function(_0x21fa82,_0x502fe3){var _0x58c6f1=shared[_0x6fc7('0x88')];var _0x40f459={};if(!_[_0x6fc7('0x5d')](_0x58c6f1[_0x21fa82[_0x6fc7('0x44')]['id']]))_0x40f459=_0x58c6f1[_0x21fa82[_0x6fc7('0x44')]['id']];return _0x502fe3['status'](0xc8)['json'](_0x40f459);}; \ No newline at end of file +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(_0x56443d,_0x59150c){_0x56443d=_0x56443d-0x0;var _0x241220=_0x80d9[_0x56443d];return _0x241220;};'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 diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index fcb3ee8..d87b0f7 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 _0x2542=['../../config/environment','./cmHopper.attributes','exports','define','CmHopper','cm_hopper','scheduledat','phone','priority','lodash','util','../../config/logger','api','bluebird','path','rimraf'];(function(_0x25fd12,_0x214bec){var _0x5c629b=function(_0x56e34c){while(--_0x56e34c){_0x25fd12['push'](_0x25fd12['shift']());}};_0x5c629b(++_0x214bec);}(_0x2542,0x169));var _0x2254=function(_0x70dfa,_0x229594){_0x70dfa=_0x70dfa-0x0;var _0x15a6f9=_0x2542[_0x70dfa];return _0x15a6f9;};'use strict';var _=require(_0x2254('0x0'));var util=require(_0x2254('0x1'));var logger=require(_0x2254('0x2'))(_0x2254('0x3'));var moment=require('moment');var BPromise=require(_0x2254('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2254('0x5'));var rimraf=require(_0x2254('0x6'));var config=require(_0x2254('0x7'));var attributes=require(_0x2254('0x8'));module[_0x2254('0x9')]=function(_0x508183,_0x19ad3c){return _0x508183[_0x2254('0xa')](_0x2254('0xb'),attributes,{'tableName':_0x2254('0xc'),'paranoid':![],'indexes':[{'name':_0x2254('0xd'),'fields':[_0x2254('0xd')]},{'name':_0x2254('0xe'),'fields':[_0x2254('0xe')]},{'name':_0x2254('0xf'),'fields':[_0x2254('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc4aa=['define','CmHopper','cm_hopper','phone','priority','lodash','util','../../config/logger','api','moment','bluebird','../../config/environment','./cmHopper.attributes','exports'];(function(_0x308129,_0x8d7121){var _0x3f3df1=function(_0x59bf85){while(--_0x59bf85){_0x308129['push'](_0x308129['shift']());}};_0x3f3df1(++_0x8d7121);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0xc4aa[_0x5c2e3e];return _0x53f64a;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var logger=require(_0xac4a('0x2'))(_0xac4a('0x3'));var moment=require(_0xac4a('0x4'));var BPromise=require(_0xac4a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xac4a('0x6'));var attributes=require(_0xac4a('0x7'));module[_0xac4a('0x8')]=function(_0x215f39,_0x96be2b){return _0x215f39[_0xac4a('0x9')](_0xac4a('0xa'),attributes,{'tableName':_0xac4a('0xb'),'paranoid':![],'indexes':[{'name':'scheduledat','fields':['scheduledat']},{'name':_0xac4a('0xc'),'fields':[_0xac4a('0xc')]},{'name':_0xac4a('0xd'),'fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 1d58189..d17d6cd 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 _0x80f7=['info','GetCmHopper','debug','stringify','catch','error','message','ShowCmHopper','find','where','create','body','CreateCmHopper','UpdateCmHopper','update','limit','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','findAll','order','UPDATE','Contact','User','Agent','length','UserId','push','dataValues','ContactId','MoveContactManagedDialer','sequelize','transaction','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','literal','`scheduledat`\x20>=\x20','format','YYYY-MM-DD\x20HH:mm:ss','contactsRescheduled','CountReScheduled','GetContactRecallMe','all','keys','GetContactByPhone','findOne','phone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','name','voicePause','List','NOW()','lodash','moment','bluebird','../../mysqldb','../../config/logger','rpc','CmHopper','options','raw','attributes','include','map','model','then'];(function(_0x465d26,_0x4178ef){var _0x55da6b=function(_0x168c09){while(--_0x168c09){_0x465d26['push'](_0x465d26['shift']());}};_0x55da6b(++_0x4178ef);}(_0x80f7,0xd6));var _0x780f=function(_0x4d579b,_0x2327f3){_0x4d579b=_0x4d579b-0x0;var _0x288145=_0x80f7[_0x4d579b];return _0x288145;};'use strict';var _=require(_0x780f('0x0'));var util=require('util');var moment=require(_0x780f('0x1'));var BPromise=require(_0x780f('0x2'));var db=require(_0x780f('0x3'))['db'];var logger=require(_0x780f('0x4'))(_0x780f('0x5'));exports['GetCmHopper']=function(_0x48fadd){var _0xc5ea04=this;return new Promise(function(_0x36dbe0,_0x418805){return db[_0x780f('0x6')]['findAll']({'raw':_0x48fadd[_0x780f('0x7')]?_0x48fadd[_0x780f('0x7')][_0x780f('0x8')]===undefined?!![]:![]:!![],'where':_0x48fadd[_0x780f('0x7')]?_0x48fadd[_0x780f('0x7')]['where']||null:null,'attributes':_0x48fadd[_0x780f('0x7')]?_0x48fadd[_0x780f('0x7')][_0x780f('0x9')]||null:null,'limit':_0x48fadd[_0x780f('0x7')]?_0x48fadd[_0x780f('0x7')]['limit']||null:null,'include':_0x48fadd[_0x780f('0x7')]?_0x48fadd[_0x780f('0x7')][_0x780f('0xa')]?_[_0x780f('0xb')](_0x48fadd[_0x780f('0x7')]['include'],function(_0x24e2ba){return{'model':db[_0x24e2ba[_0x780f('0xc')]],'as':_0x24e2ba['as'],'attributes':_0x24e2ba['attributes'],'include':_0x24e2ba[_0x780f('0xa')]?_[_0x780f('0xb')](_0x24e2ba[_0x780f('0xa')],function(_0x15ef60){return{'model':db[_0x15ef60[_0x780f('0xc')]],'as':_0x15ef60['as'],'attributes':_0x15ef60[_0x780f('0x9')],'include':_0x15ef60[_0x780f('0xa')]?_[_0x780f('0xb')](_0x15ef60['include'],function(_0x156654){return{'model':db[_0x156654[_0x780f('0xc')]],'as':_0x156654['as'],'attributes':_0x156654[_0x780f('0x9')]};}):[]};}):[]};}):[]:[]})[_0x780f('0xd')](function(_0x380e25){logger[_0x780f('0xe')](_0x780f('0xf'),_0x48fadd);logger[_0x780f('0x10')]('GetCmHopper',_0x48fadd,JSON[_0x780f('0x11')](_0x380e25));_0x36dbe0(_0x380e25);})[_0x780f('0x12')](function(_0x5ca44c){logger[_0x780f('0x13')](_0x780f('0xf'),_0x5ca44c[_0x780f('0x14')],_0x48fadd);_0x418805(_0xc5ea04[_0x780f('0x13')](0x1f4,_0x5ca44c['message']));});});};exports[_0x780f('0x15')]=function(_0x5d0ce1){var _0x46dd57=this;return new Promise(function(_0xdce1bf,_0x53347e){return db[_0x780f('0x6')][_0x780f('0x16')]({'raw':_0x5d0ce1['options']?_0x5d0ce1['options'][_0x780f('0x8')]===undefined?!![]:![]:!![],'where':_0x5d0ce1[_0x780f('0x7')]?_0x5d0ce1[_0x780f('0x7')][_0x780f('0x17')]||null:null,'attributes':_0x5d0ce1['options']?_0x5d0ce1[_0x780f('0x7')][_0x780f('0x9')]||null:null,'include':_0x5d0ce1[_0x780f('0x7')]?_0x5d0ce1[_0x780f('0x7')][_0x780f('0xa')]?_[_0x780f('0xb')](_0x5d0ce1[_0x780f('0x7')][_0x780f('0xa')],function(_0x5690e6){return{'model':db[_0x5690e6['model']],'as':_0x5690e6['as'],'attributes':_0x5690e6[_0x780f('0x9')],'include':_0x5690e6[_0x780f('0xa')]?_[_0x780f('0xb')](_0x5690e6[_0x780f('0xa')],function(_0x4312c0){return{'model':db[_0x4312c0[_0x780f('0xc')]],'as':_0x4312c0['as'],'attributes':_0x4312c0['attributes'],'include':_0x4312c0[_0x780f('0xa')]?_[_0x780f('0xb')](_0x4312c0[_0x780f('0xa')],function(_0x132a99){return{'model':db[_0x132a99[_0x780f('0xc')]],'as':_0x132a99['as'],'attributes':_0x132a99[_0x780f('0x9')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4d0415){logger[_0x780f('0xe')](_0x780f('0x15'),_0x5d0ce1);logger[_0x780f('0x10')](_0x780f('0x15'),_0x5d0ce1,JSON['stringify'](_0x4d0415));_0xdce1bf(_0x4d0415);})[_0x780f('0x12')](function(_0x5501ae){logger['error']('ShowCmHopper',_0x5501ae['message'],_0x5d0ce1);_0x53347e(_0x46dd57[_0x780f('0x13')](0x1f4,_0x5501ae[_0x780f('0x14')]));});});};exports['CreateCmHopper']=function(_0x11cb72){var _0x11c4ba=this;return new Promise(function(_0x1b5216,_0x38fbea){return db[_0x780f('0x6')][_0x780f('0x18')](_0x11cb72[_0x780f('0x19')],{'raw':_0x11cb72[_0x780f('0x7')]?_0x11cb72[_0x780f('0x7')][_0x780f('0x8')]===undefined?!![]:![]:!![]})[_0x780f('0xd')](function(_0x27df93){logger[_0x780f('0xe')](_0x780f('0x1a'),_0x11cb72);logger[_0x780f('0x10')](_0x780f('0x1a'),_0x11cb72,JSON[_0x780f('0x11')](_0x27df93));_0x1b5216(_0x27df93);})[_0x780f('0x12')](function(_0x236b3a){logger[_0x780f('0x13')]('CreateCmHopper',_0x236b3a[_0x780f('0x14')],_0x11cb72);_0x38fbea(_0x11c4ba[_0x780f('0x13')](0x1f4,_0x236b3a[_0x780f('0x14')]));});});};exports[_0x780f('0x1b')]=function(_0x1e347c){var _0x282703=this;return new Promise(function(_0x5eab7a,_0x5ad62c){return db['CmHopper'][_0x780f('0x1c')](_0x1e347c['body'],{'raw':_0x1e347c[_0x780f('0x7')]?_0x1e347c['options'][_0x780f('0x8')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1e347c[_0x780f('0x7')]?_0x1e347c[_0x780f('0x7')]['where']||null:null,'attributes':_0x1e347c[_0x780f('0x7')]?_0x1e347c['options'][_0x780f('0x9')]||null:null,'limit':_0x1e347c[_0x780f('0x7')]?_0x1e347c[_0x780f('0x7')][_0x780f('0x1d')]||null:null})[_0x780f('0xd')](function(_0x552cff){logger[_0x780f('0xe')](_0x780f('0x1b'),_0x1e347c);logger['info'](_0x780f('0x1e'),JSON[_0x780f('0x11')](_0x1e347c['options'][_0x780f('0x17')]),_0x1e347c[_0x780f('0x19')][_0x780f('0x1f')]);logger[_0x780f('0x10')](_0x780f('0x1b'),_0x1e347c,JSON[_0x780f('0x11')](_0x552cff));_0x5eab7a(_0x552cff);})['catch'](function(_0x217a68){logger['error'](_0x780f('0x1b'),_0x217a68[_0x780f('0x14')],_0x1e347c);_0x5ad62c(_0x282703[_0x780f('0x13')](0x1f4,_0x217a68['message']));});});};exports[_0x780f('0x20')]=function(_0x4861b6){var _0x32895a=this;return new Promise(function(_0x34054a,_0xce7bc){return db[_0x780f('0x6')][_0x780f('0x21')]({'where':_0x4861b6[_0x780f('0x7')]?_0x4861b6[_0x780f('0x7')]['where']||null:null})[_0x780f('0xd')](function(_0x4f1b8f){logger[_0x780f('0xe')](_0x780f('0x20'),_0x4861b6);logger[_0x780f('0x10')](_0x780f('0x20'),_0x4861b6,JSON[_0x780f('0x11')](_0x4f1b8f));_0x34054a(_0x4f1b8f);})[_0x780f('0x12')](function(_0x5d7498){logger[_0x780f('0x13')](_0x780f('0x20'),_0x5d7498[_0x780f('0x14')],_0x4861b6);_0xce7bc(_0x32895a[_0x780f('0x13')](0x1f4,_0x5d7498['message']));});});};exports[_0x780f('0x22')]=function(_0x1f1afd){var _0x2c38d2=this;return new Promise(function(_0x3079d0,_0x3e2207){return db[_0x780f('0x23')][_0x780f('0x24')]()[_0x780f('0xd')](function(_0x4053a7){return db['sequelize']['transaction'](function(_0x25c263){return db['CmHopper'][_0x780f('0x25')]({'where':_0x1f1afd[_0x780f('0x7')]?_0x1f1afd['options']['where']||null:null,'attributes':_0x1f1afd[_0x780f('0x7')]?_0x1f1afd[_0x780f('0x7')][_0x780f('0x9')]||null:null,'limit':_0x1f1afd['options']?_0x1f1afd[_0x780f('0x7')]['limit']||null:null,'order':_0x1f1afd['options']?_0x1f1afd[_0x780f('0x7')][_0x780f('0x26')]||null:null,'transaction':_0x25c263,'lock':_0x25c263['LOCK'][_0x780f('0x27')],'include':[{'model':db[_0x780f('0x23')],'as':_0x780f('0x28'),'attributes':_['keys'](_0x4053a7)},{'model':db[_0x780f('0x29')],'as':_0x780f('0x2a'),'attributes':['id','name','voicePause']}]})[_0x780f('0xd')](function(_0x44e6ee){var _0x5abe65=[];var _0x185c1b=[];for(var _0x520369=0x0;_0x520369<_0x44e6ee[_0x780f('0x2b')];_0x520369+=0x1){var _0x5afa4a=_0x44e6ee[_0x520369][_0x780f('0x2c')];if(_0x5afa4a===null){_0x5abe65[_0x780f('0x2d')](_0x44e6ee[_0x520369][_0x780f('0x1c')](_0x1f1afd[_0x780f('0x19')],{'transaction':_0x25c263}));}else if(!_0x185c1b['includes'](_0x5afa4a)){_0x185c1b[_0x780f('0x2d')](_0x5afa4a);_0x5abe65[_0x780f('0x2d')](_0x44e6ee[_0x520369][_0x780f('0x1c')](_0x1f1afd['body'],{'transaction':_0x25c263}));}}return BPromise['all'](_0x5abe65);});})[_0x780f('0xd')](function(_0x260f03){logger['info'](_0x780f('0x22'),_0x1f1afd);if(_0x260f03[_0x780f('0x2b')]>0x0){logger[_0x780f('0xe')]('GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]',_0x260f03[0x0][_0x780f('0x2e')]['id'],_0x260f03[0x0]['dataValues'][_0x780f('0x2f')],_0x260f03[0x0]['dataValues'][_0x780f('0x1f')]);}logger[_0x780f('0x10')](_0x780f('0x22'),_0x1f1afd,JSON[_0x780f('0x11')](_0x260f03));_0x3079d0(_0x260f03);})['catch'](function(_0x16b25c){logger[_0x780f('0x13')](_0x780f('0x22'),_0x16b25c[_0x780f('0x14')],_0x1f1afd);_0x3e2207(_0x2c38d2[_0x780f('0x13')](0x1f4,_0x16b25c[_0x780f('0x14')]));});});});};exports[_0x780f('0x30')]=function(_0x43264d){var _0x8e5b4c=this;return new Promise(function(_0x295094,_0x4e4a83){return db[_0x780f('0x31')][_0x780f('0x32')](function(_0x11c805){return db['CmHopperFinal']['create'](_0x43264d[_0x780f('0x19')],{'raw':_0x43264d[_0x780f('0x7')]?_0x43264d[_0x780f('0x7')][_0x780f('0x8')]===undefined?!![]:![]:!![],'transaction':_0x11c805})[_0x780f('0xd')](function(){logger[_0x780f('0xe')](_0x780f('0x33'),JSON[_0x780f('0x11')](_0x43264d[_0x780f('0x7')][_0x780f('0x17')]),_0x43264d[_0x780f('0x7')][_0x780f('0x17')][_0x780f('0x1f')]);return db[_0x780f('0x6')][_0x780f('0x21')]({'where':_0x43264d['options']?_0x43264d[_0x780f('0x7')]['where']||null:null,'transaction':_0x11c805});});})[_0x780f('0xd')](function(_0x4c1516){logger[_0x780f('0xe')]('MoveContactManagedDialer',_0x43264d);logger[_0x780f('0x10')](_0x780f('0x30'),_0x43264d,JSON['stringify'](_0x4c1516));_0x295094(_0x4c1516);})[_0x780f('0x12')](function(_0x4448b2){logger[_0x780f('0x13')]('MoveContactManagedDialer',_0x4448b2[_0x780f('0x14')],_0x43264d);_0x4e4a83(_0x8e5b4c['error'](0x1f4,_0x4448b2['message']));});});};exports['CountReScheduled']=function(_0xa6e46a){var _0x3e3846=this;return new Promise(function(_0xdd9e7,_0x1af9bf){return db[_0x780f('0x6')][_0x780f('0x25')]({'raw':_0xa6e46a[_0x780f('0x7')]?_0xa6e46a['options']['raw']===undefined?!![]:![]:!![],'where':_0xa6e46a[_0x780f('0x7')]?_0xa6e46a[_0x780f('0x7')][_0x780f('0x17')]||null:null,'attributes':[[db[_0x780f('0x31')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x780f('0x31')][_0x780f('0x34')](_0x780f('0x35')+util[_0x780f('0x36')]('\x22%s\x22',moment()[_0x780f('0x36')](_0x780f('0x37')))+'\x20,\x201,\x20null'))),_0x780f('0x38')]]})[_0x780f('0xd')](function(_0x47c28d){logger[_0x780f('0xe')]('CountReScheduled',_0xa6e46a);logger['debug'](_0x780f('0x39'),_0xa6e46a,JSON[_0x780f('0x11')](_0x47c28d));_0xdd9e7(_0x47c28d);})[_0x780f('0x12')](function(_0x54582d){logger[_0x780f('0x13')](_0x780f('0x39'),_0x54582d[_0x780f('0x14')],_0xa6e46a);_0x1af9bf(_0x3e3846[_0x780f('0x13')](0x1f4,_0x54582d[_0x780f('0x14')]));});});};exports[_0x780f('0x3a')]=function(_0x583823){var _0x2ef2e8=this;return new Promise(function(_0x274979,_0x30fbcf){return db[_0x780f('0x23')][_0x780f('0x24')]()[_0x780f('0xd')](function(){return db[_0x780f('0x31')]['transaction'](function(_0x1c006b){return db[_0x780f('0x6')]['findAll']({'where':_0x583823['options']?_0x583823['options'][_0x780f('0x17')]||null:null,'attributes':_0x583823['options']?_0x583823[_0x780f('0x7')][_0x780f('0x9')]||null:null,'limit':0x1,'order':_0x583823['options']?_0x583823[_0x780f('0x7')][_0x780f('0x26')]||null:null,'group':db[_0x780f('0x6')][_0x780f('0x2c')],'transaction':_0x1c006b,'lock':_0x1c006b['LOCK'][_0x780f('0x27')],'include':_0x583823[_0x780f('0x7')]?_0x583823[_0x780f('0x7')][_0x780f('0xa')]?_[_0x780f('0xb')](_0x583823[_0x780f('0x7')]['include'],function(_0x524446){return{'model':db[_0x524446[_0x780f('0xc')]],'as':_0x524446['as'],'attributes':_0x524446['attributes'],'include':_0x524446['include']?_[_0x780f('0xb')](_0x524446[_0x780f('0xa')],function(_0x4bf1cd){return{'model':db[_0x4bf1cd[_0x780f('0xc')]],'as':_0x4bf1cd['as'],'attributes':_0x4bf1cd['attributes'],'include':_0x4bf1cd[_0x780f('0xa')]?_['map'](_0x4bf1cd[_0x780f('0xa')],function(_0x410dd3){return{'model':db[_0x410dd3[_0x780f('0xc')]],'as':_0x410dd3['as'],'attributes':_0x410dd3[_0x780f('0x9')]};}):[]};}):[]};}):[]:[]})[_0x780f('0xd')](function(_0xe25688){var _0x4d0905=[];for(var _0x5c7f95=0x0;_0x5c7f95<_0xe25688[_0x780f('0x2b')];_0x5c7f95+=0x1){_0x4d0905[_0x780f('0x2d')](_0xe25688[_0x5c7f95]['update'](_0x583823[_0x780f('0x19')],{'transaction':_0x1c006b}));}return BPromise[_0x780f('0x3b')](_0x4d0905);});})[_0x780f('0xd')](function(_0x241f08){logger[_0x780f('0xe')](_0x780f('0x3a'),_0x583823);logger[_0x780f('0x10')](_0x780f('0x3a'),_0x583823,JSON[_0x780f('0x11')](_0x241f08));_0x274979(_0x241f08);})[_0x780f('0x12')](function(_0x2b6fe2){logger[_0x780f('0x13')]('GetContactRecallMe',_0x2b6fe2[_0x780f('0x14')],_0x583823);_0x30fbcf(_0x2ef2e8[_0x780f('0x13')](0x1f4,_0x2b6fe2[_0x780f('0x14')]));});});});};exports['GetCmHopperPreview']=function(_0x35cbab){var _0x9614e7=this;return new Promise(function(_0x34d87c,_0xe2093e){db[_0x780f('0x23')][_0x780f('0x24')]()[_0x780f('0xd')](function(_0x16161d){return db[_0x780f('0x6')][_0x780f('0x25')]({'raw':_0x35cbab[_0x780f('0x7')]?_0x35cbab[_0x780f('0x7')][_0x780f('0x8')]===undefined?!![]:![]:!![],'where':_0x35cbab[_0x780f('0x7')]?_0x35cbab[_0x780f('0x7')][_0x780f('0x17')]||null:null,'attributes':_0x35cbab[_0x780f('0x7')]?_0x35cbab[_0x780f('0x7')][_0x780f('0x9')]||null:null,'limit':_0x35cbab[_0x780f('0x7')]?_0x35cbab[_0x780f('0x7')][_0x780f('0x1d')]||null:null,'include':_0x35cbab[_0x780f('0x7')]?_0x35cbab[_0x780f('0x7')][_0x780f('0xa')]?_[_0x780f('0xb')](_0x35cbab[_0x780f('0x7')][_0x780f('0xa')],function(_0x477b6a){return{'model':db[_0x477b6a['model']],'as':_0x477b6a['as'],'attributes':_0x477b6a['as']===_0x780f('0x28')?_[_0x780f('0x3c')](_0x16161d):_0x477b6a['attributes'],'include':_0x477b6a[_0x780f('0xa')]?_[_0x780f('0xb')](_0x477b6a['include'],function(_0x2e6a8d){return{'model':db[_0x2e6a8d[_0x780f('0xc')]],'as':_0x2e6a8d['as'],'attributes':_0x2e6a8d[_0x780f('0x9')],'include':_0x2e6a8d[_0x780f('0xa')]?_[_0x780f('0xb')](_0x2e6a8d['include'],function(_0x2da3b4){return{'model':db[_0x2da3b4['model']],'as':_0x2da3b4['as'],'attributes':_0x2da3b4[_0x780f('0x9')]};}):[]};}):[]};}):[]:[]})[_0x780f('0xd')](function(_0x4e794c){logger[_0x780f('0xe')](_0x780f('0xf'),_0x35cbab);logger[_0x780f('0x10')](_0x780f('0xf'),_0x35cbab,JSON[_0x780f('0x11')](_0x4e794c));_0x34d87c(_0x4e794c);})['catch'](function(_0xd9ea63){logger['error'](_0x780f('0xf'),_0xd9ea63[_0x780f('0x14')],_0x35cbab);_0xe2093e(_0x9614e7[_0x780f('0x13')](0x1f4,_0xd9ea63[_0x780f('0x14')]));});});});};exports[_0x780f('0x3d')]=function(_0x16cc8b){var _0x2063ef=this;return new Promise(function(_0x1d9ea9,_0x59c7af){return db[_0x780f('0x23')][_0x780f('0x3e')]({'raw':!![],'where':{'phone':_0x16cc8b['options']['where'][_0x780f('0x3f')]},'attributes':['id',_0x780f('0x40')],'order':[['id',_0x780f('0x41')]]})[_0x780f('0xd')](function(_0x616812){logger[_0x780f('0xe')](_0x780f('0x42'),_0x16cc8b);logger[_0x780f('0x10')]('getContactByPhone',_0x16cc8b,JSON[_0x780f('0x11')](_0x616812));_0x1d9ea9(_0x616812);})[_0x780f('0x12')](function(_0x5c2479){logger[_0x780f('0x13')](_0x780f('0x42'),_0x5c2479[_0x780f('0x14')],_0x16cc8b);_0x59c7af(_0x2063ef[_0x780f('0x13')](0x1f4,_0x5c2479[_0x780f('0x14')]));});});};exports['ResetActiveCalls']=function(_0x19ff5b){var _0x5cd755=this;return new Promise(function(_0x398c01,_0x487719){return db[_0x780f('0x31')]['transaction'](function(_0x423c59){var _0xf55c81=_0x19ff5b[_0x780f('0x7')]&&_0x19ff5b['options'][_0x780f('0x17')]?_0x19ff5b['options']['where']:{};return db[_0x780f('0x6')][_0x780f('0x1c')](_0x19ff5b[_0x780f('0x19')],{'where':_0xf55c81,'transaction':_0x423c59})[_0x780f('0xd')](function(_0x4972e4){logger['info']('ResetActiveCalls',_0x19ff5b);logger[_0x780f('0x10')](_0x780f('0x43'),_0x19ff5b,JSON[_0x780f('0x11')](_0x4972e4));_0x398c01(_0x4972e4);})['catch'](function(_0x38cb6c){logger[_0x780f('0x13')](_0x780f('0x43'),_0x38cb6c['message'],_0x19ff5b);_0x487719(_0x5cd755[_0x780f('0x13')](0x1f4,_0x38cb6c[_0x780f('0x14')]));});});});};exports[_0x780f('0x44')]=function(_0x2d78d8){var _0xfda5=this;var _0x369bdb=_0x2d78d8[_0x780f('0x19')][_0x780f('0x17')][_0x780f('0x45')];var _0x39cb68=_0x2d78d8[_0x780f('0x19')]['where']['interval'];var _0x50219d=_0x2d78d8['body']['where'][_0x780f('0x46')];return new Promise(function(_0x1d65f4,_0x3e7a10){return db[_0x780f('0x6')][_0x780f('0x25')]({'where':{'voiceQueueId':{'$in':_0x369bdb},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db['sequelize'][_0x780f('0x34')](_0x780f('0x47')+_0x39cb68+'\x20MINUTE'),'$gt':db['sequelize']['literal']('NOW()')}},'UserId':{'$in':_0x50219d}},'include':[{'model':db[_0x780f('0x23')],'as':_0x780f('0x28')},{'model':db[_0x780f('0x29')],'as':_0x780f('0x2a'),'attributes':['id',_0x780f('0x48'),_0x780f('0x49')]},{'model':db['CmList'],'as':_0x780f('0x4a')}]})[_0x780f('0xd')](function(_0x37bbcf){if(_0x37bbcf[_0x780f('0x2b')]>0x0){return db[_0x780f('0x31')][_0x780f('0x32')](function(_0x34867c){return db[_0x780f('0x6')][_0x780f('0x1c')]({'recallmeNotifiedDate':db[_0x780f('0x31')][_0x780f('0x34')](_0x780f('0x4b'))},{'where':{'id':{'$in':_[_0x780f('0xb')](_0x37bbcf,'id')}},'transaction':_0x34867c})['then'](function(){_0x1d65f4(_0x37bbcf);})[_0x780f('0x12')](function(_0x5a7ce6){logger[_0x780f('0x13')](_0x780f('0x44'),_0x5a7ce6[_0x780f('0x14')],_0x2d78d8);_0x3e7a10(_0xfda5[_0x780f('0x13')](0x1f4,_0x5a7ce6['message']));});})['catch'](function(_0x586726){logger[_0x780f('0x13')]('CmHopperHandlePreviewRecallNotifications',_0x586726[_0x780f('0x14')],_0x2d78d8);_0x3e7a10(_0xfda5[_0x780f('0x13')](0x1f4,_0x586726['message']));});}else{_0x1d65f4(_0x37bbcf);}});});}; \ No newline at end of file +var _0xe667=['map','model','then','info','debug','stringify','catch','error','message','ShowCmHopper','find','CreateCmHopper','body','UpdateCmHopper','update','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','GetContactDialer','CmContact','describe','transaction','order','LOCK','UPDATE','User','voicePause','length','push','includes','all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','MoveContactManagedDialer','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','destroy','CountReScheduled','COUNT','sequelize','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','contactsRescheduled','GetContactRecallMe','GetCmHopperPreview','Contact','findOne','phone','dialTimezone','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','interval','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','NOW()','Agent','name','CmList','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','GetCmHopper','CmHopper','findAll','options','raw','where','attributes','limit','include'];(function(_0x45e92c,_0x36ff1e){var _0xc17495=function(_0x1b70b3){while(--_0x1b70b3){_0x45e92c['push'](_0x45e92c['shift']());}};_0xc17495(++_0x36ff1e);}(_0xe667,0x17c));var _0x7e66=function(_0x1157cf,_0x26ee4e){_0x1157cf=_0x1157cf-0x0;var _0x3aec10=_0xe667[_0x1157cf];return _0x3aec10;};'use strict';var _=require('lodash');var util=require(_0x7e66('0x0'));var moment=require(_0x7e66('0x1'));var BPromise=require(_0x7e66('0x2'));var db=require(_0x7e66('0x3'))['db'];var logger=require(_0x7e66('0x4'))(_0x7e66('0x5'));exports[_0x7e66('0x6')]=function(_0x354f57){var _0x176db3=this;return new Promise(function(_0x2f8f0b,_0x1cea2d){return db[_0x7e66('0x7')][_0x7e66('0x8')]({'raw':_0x354f57[_0x7e66('0x9')]?_0x354f57[_0x7e66('0x9')][_0x7e66('0xa')]===undefined?!![]:![]:!![],'where':_0x354f57[_0x7e66('0x9')]?_0x354f57['options'][_0x7e66('0xb')]||null:null,'attributes':_0x354f57[_0x7e66('0x9')]?_0x354f57[_0x7e66('0x9')][_0x7e66('0xc')]||null:null,'limit':_0x354f57[_0x7e66('0x9')]?_0x354f57['options'][_0x7e66('0xd')]||null:null,'include':_0x354f57[_0x7e66('0x9')]?_0x354f57[_0x7e66('0x9')]['include']?_['map'](_0x354f57['options'][_0x7e66('0xe')],function(_0x7755cd){return{'model':db[_0x7755cd['model']],'as':_0x7755cd['as'],'attributes':_0x7755cd['attributes'],'include':_0x7755cd[_0x7e66('0xe')]?_[_0x7e66('0xf')](_0x7755cd[_0x7e66('0xe')],function(_0x5ace51){return{'model':db[_0x5ace51[_0x7e66('0x10')]],'as':_0x5ace51['as'],'attributes':_0x5ace51[_0x7e66('0xc')],'include':_0x5ace51[_0x7e66('0xe')]?_[_0x7e66('0xf')](_0x5ace51['include'],function(_0x1990f3){return{'model':db[_0x1990f3['model']],'as':_0x1990f3['as'],'attributes':_0x1990f3[_0x7e66('0xc')]};}):[]};}):[]};}):[]:[]})[_0x7e66('0x11')](function(_0x1062f7){logger[_0x7e66('0x12')]('GetCmHopper',_0x354f57);logger[_0x7e66('0x13')](_0x7e66('0x6'),_0x354f57,JSON[_0x7e66('0x14')](_0x1062f7));_0x2f8f0b(_0x1062f7);})[_0x7e66('0x15')](function(_0x7f42d8){logger[_0x7e66('0x16')](_0x7e66('0x6'),_0x7f42d8['message'],_0x354f57);_0x1cea2d(_0x176db3[_0x7e66('0x16')](0x1f4,_0x7f42d8[_0x7e66('0x17')]));});});};exports[_0x7e66('0x18')]=function(_0x506e98){var _0x3f2b67=this;return new Promise(function(_0x1626d0,_0x2db212){return db[_0x7e66('0x7')][_0x7e66('0x19')]({'raw':_0x506e98[_0x7e66('0x9')]?_0x506e98[_0x7e66('0x9')][_0x7e66('0xa')]===undefined?!![]:![]:!![],'where':_0x506e98[_0x7e66('0x9')]?_0x506e98[_0x7e66('0x9')][_0x7e66('0xb')]||null:null,'attributes':_0x506e98[_0x7e66('0x9')]?_0x506e98['options'][_0x7e66('0xc')]||null:null,'include':_0x506e98['options']?_0x506e98[_0x7e66('0x9')][_0x7e66('0xe')]?_[_0x7e66('0xf')](_0x506e98[_0x7e66('0x9')]['include'],function(_0x16aab2){return{'model':db[_0x16aab2[_0x7e66('0x10')]],'as':_0x16aab2['as'],'attributes':_0x16aab2[_0x7e66('0xc')],'include':_0x16aab2[_0x7e66('0xe')]?_[_0x7e66('0xf')](_0x16aab2[_0x7e66('0xe')],function(_0x3fc5ff){return{'model':db[_0x3fc5ff['model']],'as':_0x3fc5ff['as'],'attributes':_0x3fc5ff[_0x7e66('0xc')],'include':_0x3fc5ff['include']?_[_0x7e66('0xf')](_0x3fc5ff[_0x7e66('0xe')],function(_0x434364){return{'model':db[_0x434364[_0x7e66('0x10')]],'as':_0x434364['as'],'attributes':_0x434364[_0x7e66('0xc')]};}):[]};}):[]};}):[]:[]})[_0x7e66('0x11')](function(_0x58aa97){logger['info'](_0x7e66('0x18'),_0x506e98);logger[_0x7e66('0x13')]('ShowCmHopper',_0x506e98,JSON['stringify'](_0x58aa97));_0x1626d0(_0x58aa97);})['catch'](function(_0x136cb3){logger['error'](_0x7e66('0x18'),_0x136cb3[_0x7e66('0x17')],_0x506e98);_0x2db212(_0x3f2b67[_0x7e66('0x16')](0x1f4,_0x136cb3[_0x7e66('0x17')]));});});};exports[_0x7e66('0x1a')]=function(_0x47c777){var _0x58ec29=this;return new Promise(function(_0x281e12,_0x14956e){return db['CmHopper']['create'](_0x47c777[_0x7e66('0x1b')],{'raw':_0x47c777[_0x7e66('0x9')]?_0x47c777[_0x7e66('0x9')][_0x7e66('0xa')]===undefined?!![]:![]:!![]})[_0x7e66('0x11')](function(_0x22341a){logger[_0x7e66('0x12')](_0x7e66('0x1a'),_0x47c777);logger[_0x7e66('0x13')](_0x7e66('0x1a'),_0x47c777,JSON[_0x7e66('0x14')](_0x22341a));_0x281e12(_0x22341a);})[_0x7e66('0x15')](function(_0x35ae55){logger[_0x7e66('0x16')](_0x7e66('0x1a'),_0x35ae55[_0x7e66('0x17')],_0x47c777);_0x14956e(_0x58ec29[_0x7e66('0x16')](0x1f4,_0x35ae55[_0x7e66('0x17')]));});});};exports[_0x7e66('0x1c')]=function(_0xf41807){var _0x4d9b72=this;return new Promise(function(_0x13ce35,_0x2d1d8c){return db[_0x7e66('0x7')][_0x7e66('0x1d')](_0xf41807[_0x7e66('0x1b')],{'raw':_0xf41807[_0x7e66('0x9')]?_0xf41807[_0x7e66('0x9')][_0x7e66('0xa')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xf41807[_0x7e66('0x9')]?_0xf41807[_0x7e66('0x9')][_0x7e66('0xb')]||null:null,'attributes':_0xf41807['options']?_0xf41807['options'][_0x7e66('0xc')]||null:null,'limit':_0xf41807[_0x7e66('0x9')]?_0xf41807[_0x7e66('0x9')]['limit']||null:null})['then'](function(_0xd73bb9){logger[_0x7e66('0x12')](_0x7e66('0x1c'),_0xf41807);logger[_0x7e66('0x12')](_0x7e66('0x1e'),JSON[_0x7e66('0x14')](_0xf41807[_0x7e66('0x9')][_0x7e66('0xb')]),_0xf41807[_0x7e66('0x1b')][_0x7e66('0x1f')]);logger[_0x7e66('0x13')]('UpdateCmHopper',_0xf41807,JSON[_0x7e66('0x14')](_0xd73bb9));_0x13ce35(_0xd73bb9);})[_0x7e66('0x15')](function(_0x38931d){logger[_0x7e66('0x16')]('UpdateCmHopper',_0x38931d[_0x7e66('0x17')],_0xf41807);_0x2d1d8c(_0x4d9b72[_0x7e66('0x16')](0x1f4,_0x38931d[_0x7e66('0x17')]));});});};exports[_0x7e66('0x20')]=function(_0x585596){var _0x43e959=this;return new Promise(function(_0x37f5ee,_0x169fba){return db[_0x7e66('0x7')]['destroy']({'where':_0x585596[_0x7e66('0x9')]?_0x585596['options'][_0x7e66('0xb')]||null:null})[_0x7e66('0x11')](function(_0x1445f4){logger['info']('DestroyCmHopper',_0x585596);logger[_0x7e66('0x13')]('DestroyCmHopper',_0x585596,JSON[_0x7e66('0x14')](_0x1445f4));_0x37f5ee(_0x1445f4);})[_0x7e66('0x15')](function(_0x309a21){logger['error'](_0x7e66('0x20'),_0x309a21[_0x7e66('0x17')],_0x585596);_0x169fba(_0x43e959[_0x7e66('0x16')](0x1f4,_0x309a21[_0x7e66('0x17')]));});});};exports[_0x7e66('0x21')]=function(_0x3696b9){var _0x59ae81=this;return new Promise(function(_0xd48a35,_0x682857){return db[_0x7e66('0x22')][_0x7e66('0x23')]()[_0x7e66('0x11')](function(_0xdc1e7c){return db['sequelize'][_0x7e66('0x24')](function(_0x5b5ce8){return db[_0x7e66('0x7')][_0x7e66('0x8')]({'where':_0x3696b9['options']?_0x3696b9[_0x7e66('0x9')][_0x7e66('0xb')]||null:null,'attributes':_0x3696b9[_0x7e66('0x9')]?_0x3696b9['options'][_0x7e66('0xc')]||null:null,'limit':_0x3696b9[_0x7e66('0x9')]?_0x3696b9[_0x7e66('0x9')][_0x7e66('0xd')]||null:null,'order':_0x3696b9['options']?_0x3696b9[_0x7e66('0x9')][_0x7e66('0x25')]||null:null,'transaction':_0x5b5ce8,'lock':_0x5b5ce8[_0x7e66('0x26')][_0x7e66('0x27')],'include':[{'model':db[_0x7e66('0x22')],'as':'Contact','attributes':_['keys'](_0xdc1e7c)},{'model':db[_0x7e66('0x28')],'as':'Agent','attributes':['id','name',_0x7e66('0x29')]}]})[_0x7e66('0x11')](function(_0x56fec9){var _0x1edbe7=[];var _0x1c199a=[];for(var _0x127232=0x0;_0x127232<_0x56fec9[_0x7e66('0x2a')];_0x127232+=0x1){var _0x19facd=_0x56fec9[_0x127232]['UserId'];if(_0x19facd===null){_0x1edbe7[_0x7e66('0x2b')](_0x56fec9[_0x127232][_0x7e66('0x1d')](_0x3696b9[_0x7e66('0x1b')],{'transaction':_0x5b5ce8}));}else if(!_0x1c199a[_0x7e66('0x2c')](_0x19facd)){_0x1c199a[_0x7e66('0x2b')](_0x19facd);_0x1edbe7['push'](_0x56fec9[_0x127232][_0x7e66('0x1d')](_0x3696b9[_0x7e66('0x1b')],{'transaction':_0x5b5ce8}));}}return BPromise[_0x7e66('0x2d')](_0x1edbe7);});})[_0x7e66('0x11')](function(_0x1e7c04){logger[_0x7e66('0x12')](_0x7e66('0x21'),_0x3696b9);if(_0x1e7c04[_0x7e66('0x2a')]>0x0){logger[_0x7e66('0x12')](_0x7e66('0x2e'),_0x1e7c04[0x0][_0x7e66('0x2f')]['id'],_0x1e7c04[0x0]['dataValues'][_0x7e66('0x30')],_0x1e7c04[0x0][_0x7e66('0x2f')][_0x7e66('0x1f')]);}logger[_0x7e66('0x13')](_0x7e66('0x21'),_0x3696b9,JSON[_0x7e66('0x14')](_0x1e7c04));_0xd48a35(_0x1e7c04);})[_0x7e66('0x15')](function(_0x48483f){logger[_0x7e66('0x16')]('GetContactDialer',_0x48483f[_0x7e66('0x17')],_0x3696b9);_0x682857(_0x59ae81[_0x7e66('0x16')](0x1f4,_0x48483f[_0x7e66('0x17')]));});});});};exports[_0x7e66('0x31')]=function(_0x234f82){var _0x504229=this;return new Promise(function(_0x1d3e05,_0x59e084){return db['sequelize']['transaction'](function(_0x115838){return db['CmHopperFinal']['create'](_0x234f82['body'],{'raw':_0x234f82[_0x7e66('0x9')]?_0x234f82[_0x7e66('0x9')][_0x7e66('0xa')]===undefined?!![]:![]:!![],'transaction':_0x115838})['then'](function(){logger[_0x7e66('0x12')](_0x7e66('0x32'),JSON[_0x7e66('0x14')](_0x234f82[_0x7e66('0x9')][_0x7e66('0xb')]),_0x234f82[_0x7e66('0x9')]['where'][_0x7e66('0x1f')]);return db[_0x7e66('0x7')][_0x7e66('0x33')]({'where':_0x234f82['options']?_0x234f82['options'][_0x7e66('0xb')]||null:null,'transaction':_0x115838});});})[_0x7e66('0x11')](function(_0x4ae480){logger['info'](_0x7e66('0x31'),_0x234f82);logger[_0x7e66('0x13')](_0x7e66('0x31'),_0x234f82,JSON[_0x7e66('0x14')](_0x4ae480));_0x1d3e05(_0x4ae480);})['catch'](function(_0x315d0b){logger[_0x7e66('0x16')]('MoveContactManagedDialer',_0x315d0b[_0x7e66('0x17')],_0x234f82);_0x59e084(_0x504229[_0x7e66('0x16')](0x1f4,_0x315d0b[_0x7e66('0x17')]));});});};exports[_0x7e66('0x34')]=function(_0x192b94){var _0x7b9e6e=this;return new Promise(function(_0x2acef0,_0x1c707d){return db[_0x7e66('0x7')][_0x7e66('0x8')]({'raw':_0x192b94[_0x7e66('0x9')]?_0x192b94['options'][_0x7e66('0xa')]===undefined?!![]:![]:!![],'where':_0x192b94['options']?_0x192b94['options'][_0x7e66('0xb')]||null:null,'attributes':[[db['sequelize']['fn'](_0x7e66('0x35'),db[_0x7e66('0x36')]['fn']('IF',db[_0x7e66('0x36')][_0x7e66('0x37')](_0x7e66('0x38')+util[_0x7e66('0x39')](_0x7e66('0x3a'),moment()[_0x7e66('0x39')](_0x7e66('0x3b')))+'\x20,\x201,\x20null'))),_0x7e66('0x3c')]]})['then'](function(_0xa448a1){logger['info']('CountReScheduled',_0x192b94);logger[_0x7e66('0x13')](_0x7e66('0x34'),_0x192b94,JSON[_0x7e66('0x14')](_0xa448a1));_0x2acef0(_0xa448a1);})['catch'](function(_0xfb3b0c){logger['error']('CountReScheduled',_0xfb3b0c['message'],_0x192b94);_0x1c707d(_0x7b9e6e['error'](0x1f4,_0xfb3b0c[_0x7e66('0x17')]));});});};exports[_0x7e66('0x3d')]=function(_0x127c89){var _0x21642a=this;return new Promise(function(_0xbd3a51,_0x19b78e){return db[_0x7e66('0x22')][_0x7e66('0x23')]()[_0x7e66('0x11')](function(){return db[_0x7e66('0x36')]['transaction'](function(_0x4d46fc){return db['CmHopper'][_0x7e66('0x8')]({'where':_0x127c89['options']?_0x127c89[_0x7e66('0x9')][_0x7e66('0xb')]||null:null,'attributes':_0x127c89[_0x7e66('0x9')]?_0x127c89[_0x7e66('0x9')][_0x7e66('0xc')]||null:null,'limit':0x1,'order':_0x127c89[_0x7e66('0x9')]?_0x127c89[_0x7e66('0x9')][_0x7e66('0x25')]||null:null,'group':db[_0x7e66('0x7')]['UserId'],'transaction':_0x4d46fc,'lock':_0x4d46fc[_0x7e66('0x26')][_0x7e66('0x27')],'include':_0x127c89[_0x7e66('0x9')]?_0x127c89['options']['include']?_['map'](_0x127c89[_0x7e66('0x9')][_0x7e66('0xe')],function(_0xc2ecb3){return{'model':db[_0xc2ecb3[_0x7e66('0x10')]],'as':_0xc2ecb3['as'],'attributes':_0xc2ecb3[_0x7e66('0xc')],'include':_0xc2ecb3[_0x7e66('0xe')]?_[_0x7e66('0xf')](_0xc2ecb3[_0x7e66('0xe')],function(_0x2b7478){return{'model':db[_0x2b7478[_0x7e66('0x10')]],'as':_0x2b7478['as'],'attributes':_0x2b7478[_0x7e66('0xc')],'include':_0x2b7478[_0x7e66('0xe')]?_[_0x7e66('0xf')](_0x2b7478[_0x7e66('0xe')],function(_0x4fe5fa){return{'model':db[_0x4fe5fa['model']],'as':_0x4fe5fa['as'],'attributes':_0x4fe5fa['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3c9736){var _0x3322c2=[];for(var _0x1dccf0=0x0;_0x1dccf0<_0x3c9736['length'];_0x1dccf0+=0x1){_0x3322c2[_0x7e66('0x2b')](_0x3c9736[_0x1dccf0][_0x7e66('0x1d')](_0x127c89['body'],{'transaction':_0x4d46fc}));}return BPromise[_0x7e66('0x2d')](_0x3322c2);});})[_0x7e66('0x11')](function(_0x429480){logger[_0x7e66('0x12')](_0x7e66('0x3d'),_0x127c89);logger[_0x7e66('0x13')]('GetContactRecallMe',_0x127c89,JSON['stringify'](_0x429480));_0xbd3a51(_0x429480);})[_0x7e66('0x15')](function(_0x341fc3){logger[_0x7e66('0x16')]('GetContactRecallMe',_0x341fc3[_0x7e66('0x17')],_0x127c89);_0x19b78e(_0x21642a[_0x7e66('0x16')](0x1f4,_0x341fc3[_0x7e66('0x17')]));});});});};exports[_0x7e66('0x3e')]=function(_0x522d1a){var _0x3bafe7=this;return new Promise(function(_0x486a1b,_0x18efb2){db[_0x7e66('0x22')][_0x7e66('0x23')]()['then'](function(_0x2498eb){return db[_0x7e66('0x7')]['findAll']({'raw':_0x522d1a[_0x7e66('0x9')]?_0x522d1a[_0x7e66('0x9')][_0x7e66('0xa')]===undefined?!![]:![]:!![],'where':_0x522d1a[_0x7e66('0x9')]?_0x522d1a[_0x7e66('0x9')][_0x7e66('0xb')]||null:null,'attributes':_0x522d1a[_0x7e66('0x9')]?_0x522d1a[_0x7e66('0x9')][_0x7e66('0xc')]||null:null,'limit':_0x522d1a[_0x7e66('0x9')]?_0x522d1a[_0x7e66('0x9')][_0x7e66('0xd')]||null:null,'include':_0x522d1a[_0x7e66('0x9')]?_0x522d1a[_0x7e66('0x9')][_0x7e66('0xe')]?_[_0x7e66('0xf')](_0x522d1a[_0x7e66('0x9')][_0x7e66('0xe')],function(_0x34ef2e){return{'model':db[_0x34ef2e[_0x7e66('0x10')]],'as':_0x34ef2e['as'],'attributes':_0x34ef2e['as']===_0x7e66('0x3f')?_['keys'](_0x2498eb):_0x34ef2e[_0x7e66('0xc')],'include':_0x34ef2e[_0x7e66('0xe')]?_[_0x7e66('0xf')](_0x34ef2e['include'],function(_0x527dc9){return{'model':db[_0x527dc9[_0x7e66('0x10')]],'as':_0x527dc9['as'],'attributes':_0x527dc9[_0x7e66('0xc')],'include':_0x527dc9[_0x7e66('0xe')]?_[_0x7e66('0xf')](_0x527dc9[_0x7e66('0xe')],function(_0x592cbc){return{'model':db[_0x592cbc[_0x7e66('0x10')]],'as':_0x592cbc['as'],'attributes':_0x592cbc['attributes']};}):[]};}):[]};}):[]:[]})[_0x7e66('0x11')](function(_0x1b6e27){logger[_0x7e66('0x12')](_0x7e66('0x6'),_0x522d1a);logger[_0x7e66('0x13')](_0x7e66('0x6'),_0x522d1a,JSON[_0x7e66('0x14')](_0x1b6e27));_0x486a1b(_0x1b6e27);})['catch'](function(_0x47e076){logger[_0x7e66('0x16')](_0x7e66('0x6'),_0x47e076[_0x7e66('0x17')],_0x522d1a);_0x18efb2(_0x3bafe7[_0x7e66('0x16')](0x1f4,_0x47e076[_0x7e66('0x17')]));});});});};exports['GetContactByPhone']=function(_0x2f597c){var _0x873546=this;return new Promise(function(_0x14cb89,_0x31db22){return db[_0x7e66('0x22')][_0x7e66('0x40')]({'raw':!![],'where':{'phone':_0x2f597c[_0x7e66('0x9')][_0x7e66('0xb')][_0x7e66('0x41')]},'attributes':['id',_0x7e66('0x42')],'order':[['id','DESC']]})[_0x7e66('0x11')](function(_0xaa676f){logger[_0x7e66('0x12')](_0x7e66('0x43'),_0x2f597c);logger[_0x7e66('0x13')](_0x7e66('0x43'),_0x2f597c,JSON[_0x7e66('0x14')](_0xaa676f));_0x14cb89(_0xaa676f);})[_0x7e66('0x15')](function(_0xcd8a22){logger[_0x7e66('0x16')]('getContactByPhone',_0xcd8a22[_0x7e66('0x17')],_0x2f597c);_0x31db22(_0x873546[_0x7e66('0x16')](0x1f4,_0xcd8a22[_0x7e66('0x17')]));});});};exports['ResetActiveCalls']=function(_0xd66a13){var _0x28b93c=this;return new Promise(function(_0x57072b,_0x2ba205){return db[_0x7e66('0x36')][_0x7e66('0x24')](function(_0x455aaf){var _0x4ac133=_0xd66a13[_0x7e66('0x9')]&&_0xd66a13[_0x7e66('0x9')][_0x7e66('0xb')]?_0xd66a13[_0x7e66('0x9')]['where']:{};return db['CmHopper'][_0x7e66('0x1d')](_0xd66a13[_0x7e66('0x1b')],{'where':_0x4ac133,'transaction':_0x455aaf})[_0x7e66('0x11')](function(_0xc708f4){logger[_0x7e66('0x12')]('ResetActiveCalls',_0xd66a13);logger['debug']('ResetActiveCalls',_0xd66a13,JSON['stringify'](_0xc708f4));_0x57072b(_0xc708f4);})['catch'](function(_0xec4ea9){logger[_0x7e66('0x16')](_0x7e66('0x44'),_0xec4ea9[_0x7e66('0x17')],_0xd66a13);_0x2ba205(_0x28b93c['error'](0x1f4,_0xec4ea9[_0x7e66('0x17')]));});});});};exports[_0x7e66('0x45')]=function(_0x3c19a7){var _0x42624e=this;var _0x51b491=_0x3c19a7[_0x7e66('0x1b')][_0x7e66('0xb')][_0x7e66('0x46')];var _0x4d643f=_0x3c19a7[_0x7e66('0x1b')][_0x7e66('0xb')][_0x7e66('0x47')];var _0x55478e=_0x3c19a7[_0x7e66('0x1b')][_0x7e66('0xb')][_0x7e66('0x48')];return new Promise(function(_0x425267,_0x1b77f1){return db[_0x7e66('0x7')][_0x7e66('0x8')]({'where':{'voiceQueueId':{'$in':_0x51b491},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0x7e66('0x36')][_0x7e66('0x37')](_0x7e66('0x49')+_0x4d643f+_0x7e66('0x4a')),'$gt':db[_0x7e66('0x36')][_0x7e66('0x37')](_0x7e66('0x4b'))}},'UserId':{'$in':_0x55478e}},'include':[{'model':db[_0x7e66('0x22')],'as':'Contact'},{'model':db[_0x7e66('0x28')],'as':_0x7e66('0x4c'),'attributes':['id',_0x7e66('0x4d'),_0x7e66('0x29')]},{'model':db[_0x7e66('0x4e')],'as':'List'}]})[_0x7e66('0x11')](function(_0x148d8e){if(_0x148d8e[_0x7e66('0x2a')]>0x0){return db[_0x7e66('0x36')][_0x7e66('0x24')](function(_0x1ddc6b){return db[_0x7e66('0x7')][_0x7e66('0x1d')]({'recallmeNotifiedDate':db[_0x7e66('0x36')]['literal'](_0x7e66('0x4b'))},{'where':{'id':{'$in':_['map'](_0x148d8e,'id')}},'transaction':_0x1ddc6b})[_0x7e66('0x11')](function(){_0x425267(_0x148d8e);})[_0x7e66('0x15')](function(_0x47636b){logger['error'](_0x7e66('0x45'),_0x47636b[_0x7e66('0x17')],_0x3c19a7);_0x1b77f1(_0x42624e[_0x7e66('0x16')](0x1f4,_0x47636b[_0x7e66('0x17')]));});})['catch'](function(_0x30d365){logger[_0x7e66('0x16')](_0x7e66('0x45'),_0x30d365['message'],_0x3c19a7);_0x1b77f1(_0x42624e[_0x7e66('0x16')](0x1f4,_0x30d365[_0x7e66('0x17')]));});}else{_0x425267(_0x148d8e);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 115b997..6e8ebdd 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 _0x4ed5=['describe','/opencontacts','getOpenContacts','isAuthenticated','show','getPreviewRecall','post','create','/preview','getPreview','/timezone','getTimezone','put','/:id','update','delete','destroy','exports','Router','get','index','/describe'];(function(_0x231e16,_0x67347b){var _0x570a7c=function(_0x2c35b4){while(--_0x2c35b4){_0x231e16['push'](_0x231e16['shift']());}};_0x570a7c(++_0x67347b);}(_0x4ed5,0xd8));var _0x54ed=function(_0x299eef,_0x232e2c){_0x299eef=_0x299eef-0x0;var _0x1bb665=_0x4ed5[_0x299eef];return _0x1bb665;};'use strict';var express=require('express');var router=express[_0x54ed('0x0')]();var auth=require('../../components/auth/service');var controller=require('./cmHopper.controller');router[_0x54ed('0x1')]('/',auth['isAuthenticated'](),controller[_0x54ed('0x2')]);router[_0x54ed('0x1')](_0x54ed('0x3'),auth['isAuthenticated'](),controller[_0x54ed('0x4')]);router[_0x54ed('0x1')](_0x54ed('0x5'),auth['isAuthenticated'](),controller[_0x54ed('0x6')]);router[_0x54ed('0x1')]('/timezones',auth[_0x54ed('0x7')](),controller['getTimezones']);router[_0x54ed('0x1')]('/:id',auth['isAuthenticated'](),controller[_0x54ed('0x8')]);router[_0x54ed('0x1')]('/:id/previewrecall',auth['isAuthenticated'](),controller[_0x54ed('0x9')]);router[_0x54ed('0xa')]('/',auth[_0x54ed('0x7')](),controller[_0x54ed('0xb')]);router[_0x54ed('0xa')](_0x54ed('0xc'),auth['isAuthenticated'](),controller[_0x54ed('0xd')]);router['post'](_0x54ed('0xe'),auth[_0x54ed('0x7')](),controller[_0x54ed('0xf')]);router[_0x54ed('0x10')](_0x54ed('0x11'),auth[_0x54ed('0x7')](),controller[_0x54ed('0x12')]);router[_0x54ed('0x13')](_0x54ed('0x11'),auth[_0x54ed('0x7')](),controller[_0x54ed('0x14')]);module[_0x54ed('0x15')]=router; \ No newline at end of file +var _0xa706=['show','/:id/previewrecall','getPreviewRecall','post','create','/preview','getPreview','/timezone','getTimezone','put','update','delete','destroy','exports','express','Router','../../components/auth/service','./cmHopper.controller','get','index','/opencontacts','getOpenContacts','isAuthenticated','getTimezones','/:id'];(function(_0x12d6c2,_0x409bc8){var _0x1c9825=function(_0x569f66){while(--_0x569f66){_0x12d6c2['push'](_0x12d6c2['shift']());}};_0x1c9825(++_0x409bc8);}(_0xa706,0xa4));var _0x6a70=function(_0x4e5f74,_0x1edc00){_0x4e5f74=_0x4e5f74-0x0;var _0x5cdaf0=_0xa706[_0x4e5f74];return _0x5cdaf0;};'use strict';var express=require(_0x6a70('0x0'));var router=express[_0x6a70('0x1')]();var auth=require(_0x6a70('0x2'));var controller=require(_0x6a70('0x3'));router[_0x6a70('0x4')]('/',auth['isAuthenticated'](),controller[_0x6a70('0x5')]);router[_0x6a70('0x4')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x6a70('0x4')](_0x6a70('0x6'),auth['isAuthenticated'](),controller[_0x6a70('0x7')]);router[_0x6a70('0x4')]('/timezones',auth[_0x6a70('0x8')](),controller[_0x6a70('0x9')]);router[_0x6a70('0x4')](_0x6a70('0xa'),auth['isAuthenticated'](),controller[_0x6a70('0xb')]);router[_0x6a70('0x4')](_0x6a70('0xc'),auth['isAuthenticated'](),controller[_0x6a70('0xd')]);router[_0x6a70('0xe')]('/',auth[_0x6a70('0x8')](),controller[_0x6a70('0xf')]);router[_0x6a70('0xe')](_0x6a70('0x10'),auth[_0x6a70('0x8')](),controller[_0x6a70('0x11')]);router[_0x6a70('0xe')](_0x6a70('0x12'),auth[_0x6a70('0x8')](),controller[_0x6a70('0x13')]);router[_0x6a70('0x14')]('/:id',auth[_0x6a70('0x8')](),controller[_0x6a70('0x15')]);router[_0x6a70('0x16')](_0x6a70('0xa'),auth[_0x6a70('0x8')](),controller[_0x6a70('0x17')]);module[_0x6a70('0x18')]=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index a343783..19ded30 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 _0x0677=['exports','INTEGER','STRING','format','YYYY-MM-DD\x20HH:mm:ss','sequelize'];(function(_0x25e7c5,_0x93bc23){var _0x47f9a1=function(_0x47a078){while(--_0x47a078){_0x25e7c5['push'](_0x25e7c5['shift']());}};_0x47f9a1(++_0x93bc23);}(_0x0677,0x1c7));var _0x7067=function(_0x113dd1,_0x15aaa1){_0x113dd1=_0x113dd1-0x0;var _0x1605e0=_0x0677[_0x113dd1];return _0x1605e0;};'use strict';var moment=require('moment');var Sequelize=require(_0x7067('0x0'));module[_0x7067('0x1')]={'CmHopperId':{'type':Sequelize[_0x7067('0x2')]},'phone':{'type':Sequelize[_0x7067('0x3')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x7067('0x2')],'defaultValue':0x0},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0x7067('0x4')](_0x7067('0x5'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x7067('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x7067('0x2')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x7067('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x7067('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x7067('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x7067('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xc49c=['INTEGER','STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss','moment','sequelize','exports'];(function(_0x306e30,_0x107fe3){var _0x247281=function(_0x2930a9){while(--_0x2930a9){_0x306e30['push'](_0x306e30['shift']());}};_0x247281(++_0x107fe3);}(_0xc49c,0x125));var _0xcc49=function(_0x4e8821,_0x291712){_0x4e8821=_0x4e8821-0x0;var _0x19520d=_0xc49c[_0x4e8821];return _0x19520d;};'use strict';var moment=require(_0xcc49('0x0'));var Sequelize=require(_0xcc49('0x1'));module[_0xcc49('0x2')]={'CmHopperId':{'type':Sequelize[_0xcc49('0x3')]},'phone':{'type':Sequelize[_0xcc49('0x4')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0xcc49('0x3')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0xcc49('0x5')],'defaultValue':moment()[_0xcc49('0x6')](_0xcc49('0x7'))},'countbusyretry':{'type':Sequelize[_0xcc49('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0xcc49('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xcc49('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xcc49('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xcc49('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js index 4dc580a..9a8dc0a 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 _0x77ab=['where','filters','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','catch','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','update','body','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','json','offset','undefined','limit','count','set','save','then','get','CmHopperAdditionalPhones','UserProfileResource','destroy','end','error','stack','name','send','index','map','CmHopperAdditionalPhone','fieldName','type','key','keys','query','intersection','model','fields','attributes','length','hasOwnProperty','order','sort'];(function(_0x5d7db0,_0x16404e){var _0x8fb186=function(_0x231b58){while(--_0x231b58){_0x5d7db0['push'](_0x5d7db0['shift']());}};_0x8fb186(++_0x16404e);}(_0x77ab,0x106));var _0xb77a=function(_0x21644e,_0x172f3a){_0x21644e=_0x21644e-0x0;var _0x49b905=_0x77ab[_0x21644e];return _0x49b905;};'use strict';var emlformat=require(_0xb77a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb77a('0x1'));var jsonpatch=require(_0xb77a('0x2'));var rp=require(_0xb77a('0x3'));var moment=require(_0xb77a('0x4'));var BPromise=require(_0xb77a('0x5'));var Mustache=require(_0xb77a('0x6'));var util=require(_0xb77a('0x7'));var path=require(_0xb77a('0x8'));var sox=require(_0xb77a('0x9'));var csv=require(_0xb77a('0xa'));var ejs=require(_0xb77a('0xb'));var fs=require('fs');var fs_extra=require(_0xb77a('0xc'));var _=require(_0xb77a('0xd'));var squel=require(_0xb77a('0xe'));var crypto=require(_0xb77a('0xf'));var jsforce=require(_0xb77a('0x10'));var deskjs=require(_0xb77a('0x11'));var toCsv=require(_0xb77a('0xa'));var querystring=require('querystring');var Papa=require(_0xb77a('0x12'));var Redis=require(_0xb77a('0x13'));var authService=require(_0xb77a('0x14'));var qs=require(_0xb77a('0x15'));var as=require(_0xb77a('0x16'));var hardwareService=require(_0xb77a('0x17'));var logger=require(_0xb77a('0x18'))(_0xb77a('0x19'));var utils=require('../../config/utils');var config=require(_0xb77a('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x238cab,_0x3402a2){_0x3402a2=_0x3402a2||0xcc;return function(_0x5d5abb){if(_0x5d5abb){return _0x238cab[_0xb77a('0x1b')](_0x3402a2);}return _0x238cab[_0xb77a('0x1c')](_0x3402a2)['end']();};}function respondWithResult(_0xca9f1e,_0x2de730){_0x2de730=_0x2de730||0xc8;return function(_0x34066b){if(_0x34066b){return _0xca9f1e[_0xb77a('0x1c')](_0x2de730)[_0xb77a('0x1d')](_0x34066b);}};}function respondWithFilteredResult(_0x5bd1c1,_0x1b9431){return function(_0x4dbe84){if(_0x4dbe84){var _0x2149ee=typeof _0x1b9431[_0xb77a('0x1e')]===_0xb77a('0x1f')&&typeof _0x1b9431[_0xb77a('0x20')]===_0xb77a('0x1f');var _0x31fdee=_0x4dbe84[_0xb77a('0x21')];var _0x4cebc5=_0x2149ee?0x0:_0x1b9431[_0xb77a('0x1e')];var _0x5baa2c=_0x2149ee?_0x4dbe84[_0xb77a('0x21')]:_0x1b9431['offset']+_0x1b9431['limit'];var _0x4dd45c;if(_0x5baa2c>=_0x31fdee){_0x5baa2c=_0x31fdee;_0x4dd45c=0xc8;}else{_0x4dd45c=0xce;}_0x5bd1c1[_0xb77a('0x1c')](_0x4dd45c);return _0x5bd1c1[_0xb77a('0x22')]('Content-Range',_0x4cebc5+'-'+_0x5baa2c+'/'+_0x31fdee)['json'](_0x4dbe84);}return null;};}function patchUpdates(_0x19d158){return function(_0x5b4beb){try{jsonpatch['apply'](_0x5b4beb,_0x19d158,!![]);}catch(_0xd8c3d2){return BPromise['reject'](_0xd8c3d2);}return _0x5b4beb[_0xb77a('0x23')]();};}function saveUpdates(_0x14a2af,_0x3600c9){return function(_0x4eb85e){if(_0x4eb85e){return _0x4eb85e['update'](_0x14a2af)[_0xb77a('0x24')](function(_0x5aa6e5){return _0x5aa6e5;});}return null;};}function removeEntity(_0x1dba2b,_0x1d6f39){return function(_0xd01c1f){if(_0xd01c1f){return _0xd01c1f['destroy']()[_0xb77a('0x24')](function(){var _0x3af2db=_0xd01c1f[_0xb77a('0x25')]({'plain':!![]});var _0x3d2ac2=_0xb77a('0x26');return db[_0xb77a('0x27')][_0xb77a('0x28')]({'where':{'type':_0x3d2ac2,'resourceId':_0x3af2db['id']}})[_0xb77a('0x24')](function(){return _0xd01c1f;});})[_0xb77a('0x24')](function(){_0x1dba2b[_0xb77a('0x1c')](0xcc)[_0xb77a('0x29')]();});}};}function handleEntityNotFound(_0x3148b1,_0x85d439){return function(_0x5e2671){if(!_0x5e2671){_0x3148b1['sendStatus'](0x194);}return _0x5e2671;};}function handleError(_0x1fffb9,_0x3697b0){_0x3697b0=_0x3697b0||0x1f4;return function(_0x524e00){logger[_0xb77a('0x2a')](_0x524e00[_0xb77a('0x2b')]);if(_0x524e00[_0xb77a('0x2c')]){delete _0x524e00[_0xb77a('0x2c')];}_0x1fffb9[_0xb77a('0x1c')](_0x3697b0)[_0xb77a('0x2d')](_0x524e00);};}exports[_0xb77a('0x2e')]=function(_0x570dda,_0x42014c){var _0xaa0b96={},_0x5a42f5={},_0x343c7a={'count':0x0,'rows':[]};var _0x15c7a3=_[_0xb77a('0x2f')](db[_0xb77a('0x30')]['rawAttributes'],function(_0x230bf9){return{'name':_0x230bf9[_0xb77a('0x31')],'type':_0x230bf9[_0xb77a('0x32')][_0xb77a('0x33')]};});_0x5a42f5['model']=_[_0xb77a('0x2f')](_0x15c7a3,_0xb77a('0x2c'));_0x5a42f5['query']=_[_0xb77a('0x34')](_0x570dda[_0xb77a('0x35')]);_0x5a42f5['filters']=_[_0xb77a('0x36')](_0x5a42f5[_0xb77a('0x37')],_0x5a42f5['query']);_0xaa0b96['attributes']=_['intersection'](_0x5a42f5[_0xb77a('0x37')],qs[_0xb77a('0x38')](_0x570dda[_0xb77a('0x35')][_0xb77a('0x38')]));_0xaa0b96[_0xb77a('0x39')]=_0xaa0b96[_0xb77a('0x39')][_0xb77a('0x3a')]?_0xaa0b96['attributes']:_0x5a42f5[_0xb77a('0x37')];if(!_0x570dda['query'][_0xb77a('0x3b')]('nolimit')){_0xaa0b96[_0xb77a('0x20')]=qs[_0xb77a('0x20')](_0x570dda['query']['limit']);_0xaa0b96[_0xb77a('0x1e')]=qs[_0xb77a('0x1e')](_0x570dda[_0xb77a('0x35')]['offset']);}_0xaa0b96[_0xb77a('0x3c')]=qs[_0xb77a('0x3d')](_0x570dda[_0xb77a('0x35')][_0xb77a('0x3d')]);_0xaa0b96[_0xb77a('0x3e')]=qs[_0xb77a('0x3f')](_[_0xb77a('0x40')](_0x570dda[_0xb77a('0x35')],_0x5a42f5['filters']),_0x15c7a3);if(_0x570dda[_0xb77a('0x35')]['filter']){_0xaa0b96[_0xb77a('0x3e')]=_['merge'](_0xaa0b96[_0xb77a('0x3e')],{'$or':_[_0xb77a('0x2f')](_0x15c7a3,function(_0x3b9175){if(_0x3b9175[_0xb77a('0x32')]!==_0xb77a('0x41')){var _0x25a60f={};_0x25a60f[_0x3b9175[_0xb77a('0x2c')]]={'$like':'%'+_0x570dda[_0xb77a('0x35')][_0xb77a('0x42')]+'%'};return _0x25a60f;}})});}_0xaa0b96=_[_0xb77a('0x43')]({},_0xaa0b96,_0x570dda[_0xb77a('0x44')]);var _0x1a9931={'where':_0xaa0b96[_0xb77a('0x3e')]};return db[_0xb77a('0x30')][_0xb77a('0x21')](_0x1a9931)[_0xb77a('0x24')](function(_0x23dfea){_0x343c7a[_0xb77a('0x21')]=_0x23dfea;if(_0x570dda[_0xb77a('0x35')][_0xb77a('0x45')]){_0xaa0b96[_0xb77a('0x46')]=[{'all':!![]}];}return db[_0xb77a('0x30')][_0xb77a('0x47')](_0xaa0b96);})[_0xb77a('0x24')](function(_0x3841e7){_0x343c7a['rows']=_0x3841e7;return _0x343c7a;})[_0xb77a('0x24')](respondWithFilteredResult(_0x42014c,_0xaa0b96))[_0xb77a('0x48')](handleError(_0x42014c,null));};exports['show']=function(_0x23860a,_0x4db366){var _0x441f7d={'raw':!![],'where':{'id':_0x23860a['params']['id']}},_0x323cde={};_0x323cde[_0xb77a('0x37')]=_[_0xb77a('0x34')](db['CmHopperAdditionalPhone']['rawAttributes']);_0x323cde[_0xb77a('0x35')]=_[_0xb77a('0x34')](_0x23860a[_0xb77a('0x35')]);_0x323cde[_0xb77a('0x3f')]=_[_0xb77a('0x36')](_0x323cde[_0xb77a('0x37')],_0x323cde[_0xb77a('0x35')]);_0x441f7d[_0xb77a('0x39')]=_['intersection'](_0x323cde[_0xb77a('0x37')],qs[_0xb77a('0x38')](_0x23860a[_0xb77a('0x35')]['fields']));_0x441f7d[_0xb77a('0x39')]=_0x441f7d[_0xb77a('0x39')][_0xb77a('0x3a')]?_0x441f7d[_0xb77a('0x39')]:_0x323cde[_0xb77a('0x37')];if(_0x23860a[_0xb77a('0x35')][_0xb77a('0x45')]){_0x441f7d[_0xb77a('0x46')]=[{'all':!![]}];}_0x441f7d=_[_0xb77a('0x43')]({},_0x441f7d,_0x23860a['options']);return db['CmHopperAdditionalPhone'][_0xb77a('0x49')](_0x441f7d)[_0xb77a('0x24')](handleEntityNotFound(_0x4db366,null))[_0xb77a('0x24')](respondWithResult(_0x4db366,null))[_0xb77a('0x48')](handleError(_0x4db366,null));};exports[_0xb77a('0x4a')]=function(_0xf245da,_0x55c4db){return db[_0xb77a('0x30')][_0xb77a('0x4a')](_0xf245da['body'],{})['then'](function(_0x3ce5f0){var _0x12ae09=_0xf245da[_0xb77a('0x4b')][_0xb77a('0x25')]({'plain':!![]});if(!_0x12ae09)throw new Error(_0xb77a('0x4c'));if(_0x12ae09['role']==='user'){var _0x39e62c=_0x3ce5f0['get']({'plain':!![]});var _0x52a133='CmHopperAdditionalPhones';return db['UserProfileSection'][_0xb77a('0x49')]({'where':{'name':_0x52a133,'userProfileId':_0x12ae09['userProfileId']},'raw':!![]})[_0xb77a('0x24')](function(_0x11f791){if(_0x11f791&&_0x11f791[_0xb77a('0x4d')]===0x0){return db[_0xb77a('0x27')][_0xb77a('0x4a')]({'name':_0x39e62c[_0xb77a('0x2c')],'resourceId':_0x39e62c['id'],'type':_0x11f791[_0xb77a('0x2c')],'sectionId':_0x11f791['id']},{})[_0xb77a('0x24')](function(){return _0x3ce5f0;});}else{return _0x3ce5f0;}})[_0xb77a('0x48')](function(_0x3998e8){logger[_0xb77a('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3998e8);throw _0x3998e8;});}return _0x3ce5f0;})[_0xb77a('0x24')](respondWithResult(_0x55c4db,0xc9))[_0xb77a('0x48')](handleError(_0x55c4db,null));};exports[_0xb77a('0x4e')]=function(_0x5d9246,_0x4eee91){if(_0x5d9246[_0xb77a('0x4f')]['id']){delete _0x5d9246[_0xb77a('0x4f')]['id'];}return db[_0xb77a('0x30')][_0xb77a('0x49')]({'where':{'id':_0x5d9246[_0xb77a('0x50')]['id']}})[_0xb77a('0x24')](handleEntityNotFound(_0x4eee91,null))['then'](saveUpdates(_0x5d9246[_0xb77a('0x4f')],null))[_0xb77a('0x24')](respondWithResult(_0x4eee91,null))[_0xb77a('0x48')](handleError(_0x4eee91,null));};exports[_0xb77a('0x28')]=function(_0xae2c7b,_0x12a74f){return db['CmHopperAdditionalPhone']['find']({'where':{'id':_0xae2c7b[_0xb77a('0x50')]['id']}})['then'](handleEntityNotFound(_0x12a74f,null))[_0xb77a('0x24')](removeEntity(_0x12a74f,null))[_0xb77a('0x48')](handleError(_0x12a74f,null));}; \ No newline at end of file +var _0x4a23=['attributes','intersection','fields','length','model','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','rimraf','zip-dir','fast-json-patch','bluebird','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/environment','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','destroy','then','get','CmHopperAdditionalPhones','UserProfileResource','end','error','stack','name','index','map','CmHopperAdditionalPhone','rawAttributes','key','query','keys'];(function(_0x21bfab,_0x2fee48){var _0x4db318=function(_0x10396d){while(--_0x10396d){_0x21bfab['push'](_0x21bfab['shift']());}};_0x4db318(++_0x2fee48);}(_0x4a23,0x6f));var _0x34a2=function(_0x4c9371,_0x4ea641){_0x4c9371=_0x4c9371-0x0;var _0x1f3c41=_0x4a23[_0x4c9371];return _0x1f3c41;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x34a2('0x0'));var zipdir=require(_0x34a2('0x1'));var jsonpatch=require(_0x34a2('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x34a2('0x3'));var Mustache=require('mustache');var util=require(_0x34a2('0x4'));var path=require('path');var sox=require(_0x34a2('0x5'));var csv=require(_0x34a2('0x6'));var ejs=require(_0x34a2('0x7'));var fs=require('fs');var fs_extra=require(_0x34a2('0x8'));var _=require(_0x34a2('0x9'));var squel=require(_0x34a2('0xa'));var crypto=require(_0x34a2('0xb'));var jsforce=require(_0x34a2('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x34a2('0x6'));var querystring=require(_0x34a2('0xd'));var Papa=require(_0x34a2('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x34a2('0xf'));var hardwareService=require(_0x34a2('0x10'));var logger=require(_0x34a2('0x11'))(_0x34a2('0x12'));var utils=require(_0x34a2('0x13'));var config=require(_0x34a2('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x54d0b6,_0xe7cee0){_0xe7cee0=_0xe7cee0||0xcc;return function(_0x315bbb){if(_0x315bbb){return _0x54d0b6[_0x34a2('0x15')](_0xe7cee0);}return _0x54d0b6['status'](_0xe7cee0)['end']();};}function respondWithResult(_0x3297f7,_0x2b99c9){_0x2b99c9=_0x2b99c9||0xc8;return function(_0xa09e6f){if(_0xa09e6f){return _0x3297f7[_0x34a2('0x16')](_0x2b99c9)[_0x34a2('0x17')](_0xa09e6f);}};}function respondWithFilteredResult(_0x5ca39a,_0x279f7c){return function(_0x35e7fd){if(_0x35e7fd){var _0x2e466e=typeof _0x279f7c['offset']===_0x34a2('0x18')&&typeof _0x279f7c[_0x34a2('0x19')]===_0x34a2('0x18');var _0x474726=_0x35e7fd[_0x34a2('0x1a')];var _0x4a9104=_0x2e466e?0x0:_0x279f7c[_0x34a2('0x1b')];var _0x1146e1=_0x2e466e?_0x35e7fd['count']:_0x279f7c['offset']+_0x279f7c[_0x34a2('0x19')];var _0x4298e8;if(_0x1146e1>=_0x474726){_0x1146e1=_0x474726;_0x4298e8=0xc8;}else{_0x4298e8=0xce;}_0x5ca39a[_0x34a2('0x16')](_0x4298e8);return _0x5ca39a[_0x34a2('0x1c')](_0x34a2('0x1d'),_0x4a9104+'-'+_0x1146e1+'/'+_0x474726)[_0x34a2('0x17')](_0x35e7fd);}return null;};}function patchUpdates(_0x43941d){return function(_0x1b542f){try{jsonpatch[_0x34a2('0x1e')](_0x1b542f,_0x43941d,!![]);}catch(_0x2fff36){return BPromise[_0x34a2('0x1f')](_0x2fff36);}return _0x1b542f[_0x34a2('0x20')]();};}function saveUpdates(_0x5f1392,_0x31954e){return function(_0x145264){if(_0x145264){return _0x145264['update'](_0x5f1392)['then'](function(_0x5e4ae1){return _0x5e4ae1;});}return null;};}function removeEntity(_0x57687b,_0x8aacfc){return function(_0x135f0f){if(_0x135f0f){return _0x135f0f[_0x34a2('0x21')]()[_0x34a2('0x22')](function(){var _0x272671=_0x135f0f[_0x34a2('0x23')]({'plain':!![]});var _0x7f8f77=_0x34a2('0x24');return db[_0x34a2('0x25')][_0x34a2('0x21')]({'where':{'type':_0x7f8f77,'resourceId':_0x272671['id']}})[_0x34a2('0x22')](function(){return _0x135f0f;});})[_0x34a2('0x22')](function(){_0x57687b[_0x34a2('0x16')](0xcc)[_0x34a2('0x26')]();});}};}function handleEntityNotFound(_0x12825a,_0xde2cbd){return function(_0x152a8d){if(!_0x152a8d){_0x12825a[_0x34a2('0x15')](0x194);}return _0x152a8d;};}function handleError(_0x336cb5,_0x5ced61){_0x5ced61=_0x5ced61||0x1f4;return function(_0x3f6276){logger[_0x34a2('0x27')](_0x3f6276[_0x34a2('0x28')]);if(_0x3f6276[_0x34a2('0x29')]){delete _0x3f6276['name'];}_0x336cb5[_0x34a2('0x16')](_0x5ced61)['send'](_0x3f6276);};}exports[_0x34a2('0x2a')]=function(_0x4cd16f,_0x2136c5){var _0x5dc857={},_0x4f0029={},_0x1af305={'count':0x0,'rows':[]};var _0x2f5cea=_[_0x34a2('0x2b')](db[_0x34a2('0x2c')][_0x34a2('0x2d')],function(_0x9f7cb9){return{'name':_0x9f7cb9['fieldName'],'type':_0x9f7cb9['type'][_0x34a2('0x2e')]};});_0x4f0029['model']=_[_0x34a2('0x2b')](_0x2f5cea,'name');_0x4f0029[_0x34a2('0x2f')]=_[_0x34a2('0x30')](_0x4cd16f['query']);_0x4f0029['filters']=_['intersection'](_0x4f0029['model'],_0x4f0029[_0x34a2('0x2f')]);_0x5dc857[_0x34a2('0x31')]=_[_0x34a2('0x32')](_0x4f0029['model'],qs[_0x34a2('0x33')](_0x4cd16f['query'][_0x34a2('0x33')]));_0x5dc857[_0x34a2('0x31')]=_0x5dc857[_0x34a2('0x31')][_0x34a2('0x34')]?_0x5dc857['attributes']:_0x4f0029[_0x34a2('0x35')];if(!_0x4cd16f[_0x34a2('0x2f')][_0x34a2('0x36')](_0x34a2('0x37'))){_0x5dc857[_0x34a2('0x19')]=qs['limit'](_0x4cd16f['query'][_0x34a2('0x19')]);_0x5dc857[_0x34a2('0x1b')]=qs['offset'](_0x4cd16f[_0x34a2('0x2f')][_0x34a2('0x1b')]);}_0x5dc857[_0x34a2('0x38')]=qs[_0x34a2('0x39')](_0x4cd16f[_0x34a2('0x2f')][_0x34a2('0x39')]);_0x5dc857[_0x34a2('0x3a')]=qs['filters'](_[_0x34a2('0x3b')](_0x4cd16f['query'],_0x4f0029['filters']),_0x2f5cea);if(_0x4cd16f[_0x34a2('0x2f')][_0x34a2('0x3c')]){_0x5dc857[_0x34a2('0x3a')]=_[_0x34a2('0x3d')](_0x5dc857['where'],{'$or':_[_0x34a2('0x2b')](_0x2f5cea,function(_0x31f99f){if(_0x31f99f[_0x34a2('0x3e')]!==_0x34a2('0x3f')){var _0x4f86f1={};_0x4f86f1[_0x31f99f[_0x34a2('0x29')]]={'$like':'%'+_0x4cd16f['query'][_0x34a2('0x3c')]+'%'};return _0x4f86f1;}})});}_0x5dc857=_[_0x34a2('0x3d')]({},_0x5dc857,_0x4cd16f[_0x34a2('0x40')]);var _0x54d1f4={'where':_0x5dc857['where']};return db[_0x34a2('0x2c')][_0x34a2('0x1a')](_0x54d1f4)[_0x34a2('0x22')](function(_0x477199){_0x1af305['count']=_0x477199;if(_0x4cd16f[_0x34a2('0x2f')][_0x34a2('0x41')]){_0x5dc857[_0x34a2('0x42')]=[{'all':!![]}];}return db[_0x34a2('0x2c')]['findAll'](_0x5dc857);})[_0x34a2('0x22')](function(_0x10020b){_0x1af305[_0x34a2('0x43')]=_0x10020b;return _0x1af305;})['then'](respondWithFilteredResult(_0x2136c5,_0x5dc857))[_0x34a2('0x44')](handleError(_0x2136c5,null));};exports[_0x34a2('0x45')]=function(_0x44f3d6,_0x8e75c4){var _0x5b7b18={'raw':!![],'where':{'id':_0x44f3d6[_0x34a2('0x46')]['id']}},_0x5669ac={};_0x5669ac[_0x34a2('0x35')]=_[_0x34a2('0x30')](db[_0x34a2('0x2c')][_0x34a2('0x2d')]);_0x5669ac[_0x34a2('0x2f')]=_['keys'](_0x44f3d6[_0x34a2('0x2f')]);_0x5669ac['filters']=_[_0x34a2('0x32')](_0x5669ac[_0x34a2('0x35')],_0x5669ac[_0x34a2('0x2f')]);_0x5b7b18[_0x34a2('0x31')]=_[_0x34a2('0x32')](_0x5669ac[_0x34a2('0x35')],qs['fields'](_0x44f3d6['query'][_0x34a2('0x33')]));_0x5b7b18[_0x34a2('0x31')]=_0x5b7b18['attributes']['length']?_0x5b7b18[_0x34a2('0x31')]:_0x5669ac[_0x34a2('0x35')];if(_0x44f3d6[_0x34a2('0x2f')][_0x34a2('0x41')]){_0x5b7b18[_0x34a2('0x42')]=[{'all':!![]}];}_0x5b7b18=_[_0x34a2('0x3d')]({},_0x5b7b18,_0x44f3d6['options']);return db[_0x34a2('0x2c')][_0x34a2('0x47')](_0x5b7b18)[_0x34a2('0x22')](handleEntityNotFound(_0x8e75c4,null))['then'](respondWithResult(_0x8e75c4,null))[_0x34a2('0x44')](handleError(_0x8e75c4,null));};exports['create']=function(_0x37f9cb,_0x4f8bb7){return db[_0x34a2('0x2c')][_0x34a2('0x48')](_0x37f9cb['body'],{})[_0x34a2('0x22')](function(_0x4c8c16){var _0x562ddb=_0x37f9cb[_0x34a2('0x49')][_0x34a2('0x23')]({'plain':!![]});if(!_0x562ddb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x562ddb['role']==='user'){var _0x61da8a=_0x4c8c16['get']({'plain':!![]});var _0x5d7505='CmHopperAdditionalPhones';return db[_0x34a2('0x4a')][_0x34a2('0x47')]({'where':{'name':_0x5d7505,'userProfileId':_0x562ddb[_0x34a2('0x4b')]},'raw':!![]})[_0x34a2('0x22')](function(_0x5b8737){if(_0x5b8737&&_0x5b8737[_0x34a2('0x4c')]===0x0){return db[_0x34a2('0x25')][_0x34a2('0x48')]({'name':_0x61da8a[_0x34a2('0x29')],'resourceId':_0x61da8a['id'],'type':_0x5b8737['name'],'sectionId':_0x5b8737['id']},{})['then'](function(){return _0x4c8c16;});}else{return _0x4c8c16;}})[_0x34a2('0x44')](function(_0x7f392a){logger[_0x34a2('0x27')](_0x34a2('0x4d'),_0x7f392a);throw _0x7f392a;});}return _0x4c8c16;})['then'](respondWithResult(_0x4f8bb7,0xc9))[_0x34a2('0x44')](handleError(_0x4f8bb7,null));};exports[_0x34a2('0x4e')]=function(_0x2cd8d7,_0x70f9e1){if(_0x2cd8d7[_0x34a2('0x4f')]['id']){delete _0x2cd8d7[_0x34a2('0x4f')]['id'];}return db['CmHopperAdditionalPhone']['find']({'where':{'id':_0x2cd8d7[_0x34a2('0x46')]['id']}})['then'](handleEntityNotFound(_0x70f9e1,null))['then'](saveUpdates(_0x2cd8d7['body'],null))[_0x34a2('0x22')](respondWithResult(_0x70f9e1,null))[_0x34a2('0x44')](handleError(_0x70f9e1,null));};exports[_0x34a2('0x21')]=function(_0xccb87f,_0x505e02){return db[_0x34a2('0x2c')][_0x34a2('0x47')]({'where':{'id':_0xccb87f[_0x34a2('0x46')]['id']}})[_0x34a2('0x22')](handleEntityNotFound(_0x505e02,null))['then'](removeEntity(_0x505e02,null))['catch'](handleError(_0x505e02,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index 33e417d..a87f22b 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 _0x3bc4=['../../config/logger','moment','request-promise','path','../../config/environment','./cmHopperAdditionalPhone.attributes','exports','define','cm_hopper_additional_phones','lodash','util'];(function(_0x1d51c7,_0xf0e8e4){var _0x53aff9=function(_0x408dd0){while(--_0x408dd0){_0x1d51c7['push'](_0x1d51c7['shift']());}};_0x53aff9(++_0xf0e8e4);}(_0x3bc4,0xda));var _0x43bc=function(_0x5a2d95,_0xb362e5){_0x5a2d95=_0x5a2d95-0x0;var _0x2c3986=_0x3bc4[_0x5a2d95];return _0x2c3986;};'use strict';var _=require(_0x43bc('0x0'));var util=require(_0x43bc('0x1'));var logger=require(_0x43bc('0x2'))('api');var moment=require(_0x43bc('0x3'));var BPromise=require('bluebird');var rp=require(_0x43bc('0x4'));var fs=require('fs');var path=require(_0x43bc('0x5'));var rimraf=require('rimraf');var config=require(_0x43bc('0x6'));var attributes=require(_0x43bc('0x7'));module[_0x43bc('0x8')]=function(_0x5813a4,_0x538761){return _0x5813a4[_0x43bc('0x9')]('CmHopperAdditionalPhone',attributes,{'tableName':_0x43bc('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1b50=['request-promise','../../config/environment','./cmHopperAdditionalPhone.attributes','exports','define','cm_hopper_additional_phones','util','../../config/logger','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1b50,0x10a));var _0x01b5=function(_0x25bbdd,_0x4137ed){_0x25bbdd=_0x25bbdd-0x0;var _0x20ec55=_0x1b50[_0x25bbdd];return _0x20ec55;};'use strict';var _=require('lodash');var util=require(_0x01b5('0x0'));var logger=require(_0x01b5('0x1'))('api');var moment=require(_0x01b5('0x2'));var BPromise=require(_0x01b5('0x3'));var rp=require(_0x01b5('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x01b5('0x5'));var attributes=require(_0x01b5('0x6'));module[_0x01b5('0x7')]=function(_0x3e6b51,_0x704d8c){return _0x3e6b51[_0x01b5('0x8')]('CmHopperAdditionalPhone',attributes,{'tableName':_0x01b5('0x9'),'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 c3b6d22..c23fc4d 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 _0xf030=['ASC','countdropretry','dialGlobalMaxRetry','SwapAdditionalPhones','CmHopperAdditionalPhone','duration','waitTime','isNil','scheduledat','minutes','add','phone','countagentrejectretry','createdAt','updatedAt','sequelize','transaction','update','IncrementPreviewCounters','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','code','CmHopperAdditionalPhone,\x20%s,\x20%s','message','result','catch','VerifyAdditionalPhones','CmHopper','findOne','ContactId','ListId','body','VoiceQueueId','CampaignId','OrderBy','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','entity'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0xf030,0x1e3));var _0x0f03=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xf030[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x0f03('0x0'));var util=require(_0x0f03('0x1'));var moment=require(_0x0f03('0x2'));var BPromise=require('bluebird');var rs=require(_0x0f03('0x3'));var fs=require('fs');var Redis=require(_0x0f03('0x4'));var db=require(_0x0f03('0x5'))['db'];var utils=require(_0x0f03('0x6'));var logger=require(_0x0f03('0x7'))('rpc');var config=require(_0x0f03('0x8'));var jayson=require(_0x0f03('0x9'));var client=jayson[_0x0f03('0xa')][_0x0f03('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2d0002,_0x294c64,_0x438976){return new BPromise(function(_0xe2d6cd,_0x554a9c){return client[_0x0f03('0xc')](_0x2d0002,_0x438976)[_0x0f03('0xd')](function(_0x5b1d4d){logger['info']('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x294c64,_0x0f03('0xe'));logger['debug'](_0x0f03('0xf'),_0x294c64,'request\x20sent',JSON[_0x0f03('0x10')](_0x5b1d4d));if(_0x5b1d4d[_0x0f03('0x11')]){if(_0x5b1d4d[_0x0f03('0x11')][_0x0f03('0x12')]===0x1f4){logger[_0x0f03('0x11')](_0x0f03('0x13'),_0x294c64,_0x5b1d4d[_0x0f03('0x11')][_0x0f03('0x14')]);return _0x554a9c(_0x5b1d4d[_0x0f03('0x11')][_0x0f03('0x14')]);}logger[_0x0f03('0x11')](_0x0f03('0x13'),_0x294c64,_0x5b1d4d[_0x0f03('0x11')][_0x0f03('0x14')]);return _0xe2d6cd(_0x5b1d4d[_0x0f03('0x11')][_0x0f03('0x14')]);}else{logger['info']('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x294c64,_0x0f03('0xe'));_0xe2d6cd(_0x5b1d4d[_0x0f03('0x15')][_0x0f03('0x14')]);}})[_0x0f03('0x16')](function(_0x30bac2){logger['error'](_0x0f03('0x13'),_0x294c64,_0x30bac2);_0x554a9c(_0x30bac2);});});}exports[_0x0f03('0x17')]=function(_0x15b9c0){var _0x1c1c32=this;return new Promise(function(_0x50d0ce,_0xcf06dc){return db[_0x0f03('0x18')][_0x0f03('0x19')]({'raw':!![],'where':{'ContactId':_0x15b9c0['body'][_0x0f03('0x1a')],'ListId':_0x15b9c0['body'][_0x0f03('0x1b')],'VoiceQueueId':_0x15b9c0[_0x0f03('0x1c')]['VoiceQueueId']===undefined?null:_0x15b9c0['body'][_0x0f03('0x1d')],'CampaignId':_0x15b9c0[_0x0f03('0x1c')][_0x0f03('0x1e')]===undefined?null:_0x15b9c0[_0x0f03('0x1c')]['CampaignId']}})[_0x0f03('0xd')](function(_0x8da287){if(_0x8da287!=null){return db['CmHopperAdditionalPhone'][_0x0f03('0x19')]({'raw':!![],'where':{'CmHopperId':_0x8da287['id'],'OrderBy':{'$gt':_0x8da287[_0x0f03('0x1f')]}},'order':[[_0x0f03('0x1f'),'ASC']]})[_0x0f03('0xd')](function(_0x1fe4cd){var _0x1b9ed5=0x0;if(_0x1fe4cd){if(_0x1fe4cd[_0x0f03('0x20')]+_0x1fe4cd[_0x0f03('0x21')]+_0x1fe4cd[_0x0f03('0x22')]+_0x1fe4cd[_0x0f03('0x23')]+_0x1fe4cd['countdropretry']+_0x1fe4cd[_0x0f03('0x24')]+_0x1fe4cd[_0x0f03('0x25')]+_0x1fe4cd['countagentrejectretry']<_0x15b9c0[_0x0f03('0x26')]['dialGlobalMaxRetry'])_0x1b9ed5=0x1;_0x50d0ce({'additional':_0x1b9ed5});}else{return db['CmHopperAdditionalPhone'][_0x0f03('0x19')]({'raw':!![],'where':{'CmHopperId':_0x8da287['id']},'order':[[_0x0f03('0x1f'),_0x0f03('0x27')]]})[_0x0f03('0xd')](function(_0x26e2d5){var _0x7008e5=0x0;if(_0x26e2d5){if(_0x26e2d5[_0x0f03('0x20')]+_0x26e2d5[_0x0f03('0x21')]+_0x26e2d5[_0x0f03('0x22')]+_0x26e2d5[_0x0f03('0x23')]+_0x26e2d5[_0x0f03('0x28')]+_0x26e2d5[_0x0f03('0x24')]+_0x26e2d5[_0x0f03('0x25')]+_0x26e2d5['countagentrejectretry']<_0x15b9c0[_0x0f03('0x26')][_0x0f03('0x29')])_0x7008e5=0x1;_0x50d0ce({'additional':_0x7008e5});}else{_0x50d0ce({'additional':0x0});}})[_0x0f03('0x16')](function(_0x2aae20){logger['error'](_0x0f03('0x17'),_0x2aae20['message']);_0xcf06dc(_0x1c1c32[_0x0f03('0x11')](0x1f4,_0x2aae20[_0x0f03('0x14')]));});}})[_0x0f03('0x16')](function(_0x16fd08){logger[_0x0f03('0x11')](_0x0f03('0x17'),_0x16fd08[_0x0f03('0x14')]);_0xcf06dc(_0x1c1c32['error'](0x1f4,_0x16fd08[_0x0f03('0x14')]));});}else _0x50d0ce({'additional':0x0});});});};exports[_0x0f03('0x2a')]=function(_0x3d87a3){var _0x1cea71=this;return new Promise(function(_0xe96862,_0x23462f){return db[_0x0f03('0x18')]['findOne']({'raw':!![],'where':{'ContactId':_0x3d87a3[_0x0f03('0x1c')][_0x0f03('0x1a')],'ListId':_0x3d87a3[_0x0f03('0x1c')]['ListId'],'VoiceQueueId':_0x3d87a3[_0x0f03('0x1c')][_0x0f03('0x1d')]===undefined?null:_0x3d87a3[_0x0f03('0x1c')][_0x0f03('0x1d')],'CampaignId':_0x3d87a3[_0x0f03('0x1c')][_0x0f03('0x1e')]===undefined?null:_0x3d87a3[_0x0f03('0x1c')][_0x0f03('0x1e')]}})[_0x0f03('0xd')](function(_0x3a2950){if(_0x3a2950!=null){return db[_0x0f03('0x2b')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x3a2950['id'],'OrderBy':{'$gte':_0x3a2950['OrderBy']}},'order':[[_0x0f03('0x1f'),_0x0f03('0x27')]]})[_0x0f03('0xd')](function(_0xd64c44){if(_0xd64c44)return activateAdditionalPhone(_0x3a2950,_0x3d87a3[_0x0f03('0x1c')],_0xd64c44,_0x3d87a3[_0x0f03('0x2c')],_0x3d87a3['waitTime'])[_0x0f03('0xd')](function(_0x133151){_0xe96862(_0x133151);});else{return db[_0x0f03('0x2b')][_0x0f03('0x19')]({'raw':!![],'where':{'CmHopperId':_0x3a2950['id']},'order':[[_0x0f03('0x1f'),_0x0f03('0x27')]]})[_0x0f03('0xd')](function(_0x256d0f){if(_0x256d0f)return activateAdditionalPhone(_0x3a2950,_0x3d87a3[_0x0f03('0x1c')],_0x256d0f,_0x3d87a3['duration'],_0x3d87a3[_0x0f03('0x2d')])[_0x0f03('0xd')](function(_0x333ce2){_0xe96862(_0x333ce2);});else{_0xe96862({'id':_0x3a2950['id'],'phone':''});}})['catch'](function(_0x2f096e){logger[_0x0f03('0x11')]('VerifyAdditionalPhones',_0x2f096e[_0x0f03('0x14')]);_0x23462f(_0x1cea71[_0x0f03('0x11')](0x1f4,_0x2f096e[_0x0f03('0x14')]));});}})[_0x0f03('0x16')](function(_0x5d51d4){logger[_0x0f03('0x11')](_0x0f03('0x17'),_0x5d51d4[_0x0f03('0x14')]);_0x23462f(_0x1cea71[_0x0f03('0x11')](0x1f4,_0x5d51d4[_0x0f03('0x14')]));});}else _0xe96862(0x1);});});};function activateAdditionalPhone(_0x57d04c,_0x4e6e93,_0x3cd841,_0x12827e,_0x50fa2f){return new Promise(function(_0x26e288,_0x1ff91a){var _0x5767fa;if(_[_0x0f03('0x2e')](_0x3cd841['scheduledat'])){_0x3cd841[_0x0f03('0x2f')]=moment();}if(moment()>moment(_0x3cd841[_0x0f03('0x2f')])){_0x5767fa=moment()['add'](_0x50fa2f||0x3,_0x0f03('0x30'));}else{if(_0x3cd841[_0x0f03('0x1f')]==0x0){_0x5767fa=moment(_0x3cd841[_0x0f03('0x2f')]);}else{_0x5767fa=moment()[_0x0f03('0x31')](_0x50fa2f||0x3,_0x0f03('0x30'));}}if(_[_0x0f03('0x2e')](_0x5767fa)){_0x5767fa=moment()['add'](_0x50fa2f||0x3,_0x0f03('0x30'));}var _0x45859d={'phone':_0x57d04c[_0x0f03('0x32')],'active':0x0,'OrderBy':_[_0x0f03('0x2e')](_0x57d04c[_0x0f03('0x1f')])?0x0:_0x57d04c['OrderBy'],'scheduledat':moment()[_0x0f03('0x31')](_0x12827e||0x1,_0x0f03('0x30')),'countbusyretry':_0x4e6e93[_0x0f03('0x20')],'countcongestionretry':_0x4e6e93[_0x0f03('0x21')],'countnoanswerretry':_0x4e6e93[_0x0f03('0x22')],'countnosuchnumberretry':_0x4e6e93[_0x0f03('0x23')],'countdropretry':_0x4e6e93[_0x0f03('0x28')],'countabandonedretry':_0x4e6e93['countabandonedretry'],'countmachineretry':_0x4e6e93[_0x0f03('0x25')],'countagentrejectretry':_0x4e6e93[_0x0f03('0x33')],'createdAt':_0x4e6e93[_0x0f03('0x34')],'updatedAt':_0x4e6e93[_0x0f03('0x35')]};var _0xf5892c={'CmHopperId':_0x57d04c['id'],'phone':_0x3cd841[_0x0f03('0x32')],'active':0x0,'OrderBy':_[_0x0f03('0x2e')](_0x3cd841['OrderBy'])?0x0:_0x3cd841[_0x0f03('0x1f')],'scheduledat':_0x5767fa,'countbusyretry':_0x3cd841[_0x0f03('0x20')],'countcongestionretry':_0x3cd841[_0x0f03('0x21')],'countnoanswerretry':_0x3cd841[_0x0f03('0x22')],'countnosuchnumberretry':_0x3cd841[_0x0f03('0x23')],'countdropretry':_0x3cd841[_0x0f03('0x28')],'countabandonedretry':_0x3cd841[_0x0f03('0x24')],'countmachineretry':_0x3cd841[_0x0f03('0x25')],'countagentrejectretry':_0x3cd841[_0x0f03('0x33')],'createdAt':_0x3cd841[_0x0f03('0x34')],'updatedAt':_0x3cd841[_0x0f03('0x35')]};return db[_0x0f03('0x36')][_0x0f03('0x37')](function(_0x352fe1){return db[_0x0f03('0x2b')]['update'](_0x45859d,{'where':{'id':_0x3cd841['id']}},{'transaction':_0x352fe1})[_0x0f03('0xd')](function(){return db[_0x0f03('0x18')][_0x0f03('0x38')](_0xf5892c,{'where':{'id':_0x57d04c['id']}},{'transaction':_0x352fe1});});})['then'](function(_0x37a51c){_0x26e288({'id':_0x57d04c['id'],'phone':_0x3cd841[_0x0f03('0x32')]});})['catch'](function(_0x39044a){logger['error']('activateAdditionalPhone',_0x39044a[_0x0f03('0x14')]);_0x1ff91a({'error':_0x39044a[_0x0f03('0x14')]});});});}exports[_0x0f03('0x39')]=function(_0x3e4572){var _0xb79cc8=this;return new Promise(function(_0x44e183,_0x481a23){return db[_0x0f03('0x18')]['update'](_0x3e4572['body']['field'],{'where':{'id':_0x3e4572['body']['id']}})[_0x0f03('0xd')](function(_0x8b189b){_0x44e183(_0x8b189b);})[_0x0f03('0x16')](function(_0x4ca701){logger['error']('IncrementPreviewCounters',_0x4ca701[_0x0f03('0x14')]);_0x481a23(_0xb79cc8[_0x0f03('0x11')](0x1f4,_0x4ca701['message']));});});}; \ No newline at end of file +var _0x7ef1=['transaction','update','activateAdditionalPhone','IncrementPreviewCounters','field','util','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CmHopper','body','ContactId','ListId','CampaignId','CmHopperAdditionalPhone','OrderBy','countbusyretry','countnoanswerretry','countnosuchnumberretry','countdropretry','dialGlobalMaxRetry','findOne','ASC','countcongestionretry','countabandonedretry','countagentrejectretry','entity','VerifyAdditionalPhones','SwapAdditionalPhones','VoiceQueueId','duration','waitTime','scheduledat','add','minutes','isNil','phone','countmachineretry','createdAt','updatedAt','sequelize'];(function(_0xec1dd5,_0x244c31){var _0x494ef1=function(_0x711c36){while(--_0x711c36){_0xec1dd5['push'](_0xec1dd5['shift']());}};_0x494ef1(++_0x244c31);}(_0x7ef1,0x77));var _0x17ef=function(_0x3cde12,_0x32e88e){_0x3cde12=_0x3cde12-0x0;var _0x4e9bd1=_0x7ef1[_0x3cde12];return _0x4e9bd1;};'use strict';var _=require('lodash');var util=require(_0x17ef('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x17ef('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x17ef('0x2'))['db'];var utils=require(_0x17ef('0x3'));var logger=require('../../config/logger')(_0x17ef('0x4'));var config=require(_0x17ef('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x17ef('0x6')][_0x17ef('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3594d6,_0x2a3789,_0x1d4b1c){return new BPromise(function(_0x53cabf,_0x5b9a95){return client[_0x17ef('0x8')](_0x3594d6,_0x1d4b1c)[_0x17ef('0x9')](function(_0x32cddb){logger[_0x17ef('0xa')](_0x17ef('0xb'),_0x2a3789,_0x17ef('0xc'));logger['debug'](_0x17ef('0xd'),_0x2a3789,'request\x20sent',JSON[_0x17ef('0xe')](_0x32cddb));if(_0x32cddb[_0x17ef('0xf')]){if(_0x32cddb[_0x17ef('0xf')][_0x17ef('0x10')]===0x1f4){logger[_0x17ef('0xf')](_0x17ef('0xb'),_0x2a3789,_0x32cddb[_0x17ef('0xf')]['message']);return _0x5b9a95(_0x32cddb['error'][_0x17ef('0x11')]);}logger['error'](_0x17ef('0xb'),_0x2a3789,_0x32cddb[_0x17ef('0xf')][_0x17ef('0x11')]);return _0x53cabf(_0x32cddb['error'][_0x17ef('0x11')]);}else{logger[_0x17ef('0xa')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x2a3789,_0x17ef('0xc'));_0x53cabf(_0x32cddb[_0x17ef('0x12')][_0x17ef('0x11')]);}})[_0x17ef('0x13')](function(_0x1963e2){logger[_0x17ef('0xf')](_0x17ef('0xb'),_0x2a3789,_0x1963e2);_0x5b9a95(_0x1963e2);});});}exports['VerifyAdditionalPhones']=function(_0x3b15fb){var _0x48fdeb=this;return new Promise(function(_0x159ebc,_0x2e7cab){return db[_0x17ef('0x14')]['findOne']({'raw':!![],'where':{'ContactId':_0x3b15fb[_0x17ef('0x15')][_0x17ef('0x16')],'ListId':_0x3b15fb[_0x17ef('0x15')][_0x17ef('0x17')],'VoiceQueueId':_0x3b15fb['body']['VoiceQueueId']===undefined?null:_0x3b15fb[_0x17ef('0x15')]['VoiceQueueId'],'CampaignId':_0x3b15fb[_0x17ef('0x15')][_0x17ef('0x18')]===undefined?null:_0x3b15fb[_0x17ef('0x15')][_0x17ef('0x18')]}})[_0x17ef('0x9')](function(_0x75f82c){if(_0x75f82c!=null){return db[_0x17ef('0x19')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x75f82c['id'],'OrderBy':{'$gt':_0x75f82c[_0x17ef('0x1a')]}},'order':[[_0x17ef('0x1a'),'ASC']]})[_0x17ef('0x9')](function(_0x5ec89e){var _0x18e0b9=0x0;if(_0x5ec89e){if(_0x5ec89e[_0x17ef('0x1b')]+_0x5ec89e['countcongestionretry']+_0x5ec89e[_0x17ef('0x1c')]+_0x5ec89e[_0x17ef('0x1d')]+_0x5ec89e[_0x17ef('0x1e')]+_0x5ec89e['countabandonedretry']+_0x5ec89e['countmachineretry']+_0x5ec89e['countagentrejectretry']<_0x3b15fb['entity'][_0x17ef('0x1f')])_0x18e0b9=0x1;_0x159ebc({'additional':_0x18e0b9});}else{return db[_0x17ef('0x19')][_0x17ef('0x20')]({'raw':!![],'where':{'CmHopperId':_0x75f82c['id']},'order':[['OrderBy',_0x17ef('0x21')]]})[_0x17ef('0x9')](function(_0xbb113c){var _0x32237b=0x0;if(_0xbb113c){if(_0xbb113c[_0x17ef('0x1b')]+_0xbb113c[_0x17ef('0x22')]+_0xbb113c[_0x17ef('0x1c')]+_0xbb113c['countnosuchnumberretry']+_0xbb113c[_0x17ef('0x1e')]+_0xbb113c[_0x17ef('0x23')]+_0xbb113c['countmachineretry']+_0xbb113c[_0x17ef('0x24')]<_0x3b15fb[_0x17ef('0x25')][_0x17ef('0x1f')])_0x32237b=0x1;_0x159ebc({'additional':_0x32237b});}else{_0x159ebc({'additional':0x0});}})['catch'](function(_0x11cefe){logger[_0x17ef('0xf')](_0x17ef('0x26'),_0x11cefe[_0x17ef('0x11')]);_0x2e7cab(_0x48fdeb[_0x17ef('0xf')](0x1f4,_0x11cefe[_0x17ef('0x11')]));});}})[_0x17ef('0x13')](function(_0x4f1ae7){logger[_0x17ef('0xf')]('VerifyAdditionalPhones',_0x4f1ae7[_0x17ef('0x11')]);_0x2e7cab(_0x48fdeb['error'](0x1f4,_0x4f1ae7[_0x17ef('0x11')]));});}else _0x159ebc({'additional':0x0});});});};exports[_0x17ef('0x27')]=function(_0x4345aa){var _0x10d6f9=this;return new Promise(function(_0x5a503d,_0x18a09c){return db[_0x17ef('0x14')][_0x17ef('0x20')]({'raw':!![],'where':{'ContactId':_0x4345aa[_0x17ef('0x15')][_0x17ef('0x16')],'ListId':_0x4345aa[_0x17ef('0x15')][_0x17ef('0x17')],'VoiceQueueId':_0x4345aa['body'][_0x17ef('0x28')]===undefined?null:_0x4345aa['body']['VoiceQueueId'],'CampaignId':_0x4345aa[_0x17ef('0x15')][_0x17ef('0x18')]===undefined?null:_0x4345aa[_0x17ef('0x15')]['CampaignId']}})[_0x17ef('0x9')](function(_0x3fbd13){if(_0x3fbd13!=null){return db['CmHopperAdditionalPhone'][_0x17ef('0x20')]({'raw':!![],'where':{'CmHopperId':_0x3fbd13['id'],'OrderBy':{'$gte':_0x3fbd13[_0x17ef('0x1a')]}},'order':[['OrderBy',_0x17ef('0x21')]]})[_0x17ef('0x9')](function(_0x183ff5){if(_0x183ff5)return activateAdditionalPhone(_0x3fbd13,_0x4345aa['body'],_0x183ff5,_0x4345aa[_0x17ef('0x29')],_0x4345aa['waitTime'])[_0x17ef('0x9')](function(_0x39ffe6){_0x5a503d(_0x39ffe6);});else{return db[_0x17ef('0x19')][_0x17ef('0x20')]({'raw':!![],'where':{'CmHopperId':_0x3fbd13['id']},'order':[['OrderBy','ASC']]})['then'](function(_0x5ee055){if(_0x5ee055)return activateAdditionalPhone(_0x3fbd13,_0x4345aa['body'],_0x5ee055,_0x4345aa['duration'],_0x4345aa[_0x17ef('0x2a')])[_0x17ef('0x9')](function(_0x4eef6c){_0x5a503d(_0x4eef6c);});else{_0x5a503d({'id':_0x3fbd13['id'],'phone':''});}})[_0x17ef('0x13')](function(_0x5e9efe){logger[_0x17ef('0xf')]('VerifyAdditionalPhones',_0x5e9efe[_0x17ef('0x11')]);_0x18a09c(_0x10d6f9[_0x17ef('0xf')](0x1f4,_0x5e9efe[_0x17ef('0x11')]));});}})['catch'](function(_0x279153){logger[_0x17ef('0xf')](_0x17ef('0x26'),_0x279153['message']);_0x18a09c(_0x10d6f9[_0x17ef('0xf')](0x1f4,_0x279153[_0x17ef('0x11')]));});}else _0x5a503d(0x1);});});};function activateAdditionalPhone(_0x53cd05,_0x59e4df,_0x1a19e1,_0x3168a4,_0x2ea42b){return new Promise(function(_0x31bf82,_0x2f2e39){var _0xc84c8e;if(_['isNil'](_0x1a19e1[_0x17ef('0x2b')])){_0x1a19e1[_0x17ef('0x2b')]=moment();}if(moment()>moment(_0x1a19e1[_0x17ef('0x2b')])){_0xc84c8e=moment()[_0x17ef('0x2c')](_0x2ea42b||0x3,_0x17ef('0x2d'));}else{if(_0x1a19e1[_0x17ef('0x1a')]==0x0){_0xc84c8e=moment(_0x1a19e1[_0x17ef('0x2b')]);}else{_0xc84c8e=moment()[_0x17ef('0x2c')](_0x2ea42b||0x3,_0x17ef('0x2d'));}}if(_[_0x17ef('0x2e')](_0xc84c8e)){_0xc84c8e=moment()[_0x17ef('0x2c')](_0x2ea42b||0x3,_0x17ef('0x2d'));}var _0x5a4ef1={'phone':_0x53cd05[_0x17ef('0x2f')],'active':0x0,'OrderBy':_[_0x17ef('0x2e')](_0x53cd05['OrderBy'])?0x0:_0x53cd05[_0x17ef('0x1a')],'scheduledat':moment()[_0x17ef('0x2c')](_0x3168a4||0x1,'minutes'),'countbusyretry':_0x59e4df[_0x17ef('0x1b')],'countcongestionretry':_0x59e4df[_0x17ef('0x22')],'countnoanswerretry':_0x59e4df[_0x17ef('0x1c')],'countnosuchnumberretry':_0x59e4df[_0x17ef('0x1d')],'countdropretry':_0x59e4df['countdropretry'],'countabandonedretry':_0x59e4df['countabandonedretry'],'countmachineretry':_0x59e4df[_0x17ef('0x30')],'countagentrejectretry':_0x59e4df[_0x17ef('0x24')],'createdAt':_0x59e4df[_0x17ef('0x31')],'updatedAt':_0x59e4df[_0x17ef('0x32')]};var _0x373ded={'CmHopperId':_0x53cd05['id'],'phone':_0x1a19e1[_0x17ef('0x2f')],'active':0x0,'OrderBy':_['isNil'](_0x1a19e1[_0x17ef('0x1a')])?0x0:_0x1a19e1[_0x17ef('0x1a')],'scheduledat':_0xc84c8e,'countbusyretry':_0x1a19e1[_0x17ef('0x1b')],'countcongestionretry':_0x1a19e1[_0x17ef('0x22')],'countnoanswerretry':_0x1a19e1[_0x17ef('0x1c')],'countnosuchnumberretry':_0x1a19e1[_0x17ef('0x1d')],'countdropretry':_0x1a19e1['countdropretry'],'countabandonedretry':_0x1a19e1['countabandonedretry'],'countmachineretry':_0x1a19e1[_0x17ef('0x30')],'countagentrejectretry':_0x1a19e1['countagentrejectretry'],'createdAt':_0x1a19e1['createdAt'],'updatedAt':_0x1a19e1[_0x17ef('0x32')]};return db[_0x17ef('0x33')][_0x17ef('0x34')](function(_0x3f57c5){return db[_0x17ef('0x19')]['update'](_0x5a4ef1,{'where':{'id':_0x1a19e1['id']}},{'transaction':_0x3f57c5})[_0x17ef('0x9')](function(){return db['CmHopper'][_0x17ef('0x35')](_0x373ded,{'where':{'id':_0x53cd05['id']}},{'transaction':_0x3f57c5});});})[_0x17ef('0x9')](function(_0x12aaed){_0x31bf82({'id':_0x53cd05['id'],'phone':_0x1a19e1[_0x17ef('0x2f')]});})[_0x17ef('0x13')](function(_0x4efee5){logger[_0x17ef('0xf')](_0x17ef('0x36'),_0x4efee5[_0x17ef('0x11')]);_0x2f2e39({'error':_0x4efee5[_0x17ef('0x11')]});});});}exports[_0x17ef('0x37')]=function(_0x242b98){var _0x434756=this;return new Promise(function(_0x3f9dc4,_0x306d7a){return db['CmHopper'][_0x17ef('0x35')](_0x242b98[_0x17ef('0x15')][_0x17ef('0x38')],{'where':{'id':_0x242b98[_0x17ef('0x15')]['id']}})[_0x17ef('0x9')](function(_0x2a1a26){_0x3f9dc4(_0x2a1a26);})[_0x17ef('0x13')](function(_0x183dd1){logger[_0x17ef('0xf')](_0x17ef('0x37'),_0x183dd1[_0x17ef('0x11')]);_0x306d7a(_0x434756[_0x17ef('0xf')](0x1f4,_0x183dd1['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index 5c200fe..c16a048 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 _0xd87e=['express','Router','../../components/auth/service','../../config/environment','./cmHopperAdditionalPhone.controller','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout'];(function(_0x4c5276,_0x29c86c){var _0x17d86a=function(_0x4afd9b){while(--_0x4afd9b){_0x4c5276['push'](_0x4c5276['shift']());}};_0x17d86a(++_0x29c86c);}(_0xd87e,0x1bf));var _0xed87=function(_0x2ec9a3,_0x4c511d){_0x2ec9a3=_0x2ec9a3-0x0;var _0x245fc0=_0xd87e[_0x2ec9a3];return _0x245fc0;};'use strict';var multer=require(_0xed87('0x0'));var util=require(_0xed87('0x1'));var path=require('path');var timeout=require(_0xed87('0x2'));var express=require(_0xed87('0x3'));var router=express[_0xed87('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xed87('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xed87('0x6'));var controller=require(_0xed87('0x7'));router['get']('/',auth[_0xed87('0x8')](),controller['index']);router['get'](_0xed87('0x9'),auth[_0xed87('0x8')](),controller[_0xed87('0xa')]);router[_0xed87('0xb')]('/',auth['isAuthenticated'](),controller[_0xed87('0xc')]);router[_0xed87('0xd')](_0xed87('0x9'),auth[_0xed87('0x8')](),controller[_0xed87('0xe')]);router[_0xed87('0xf')](_0xed87('0x9'),auth['isAuthenticated'](),controller[_0xed87('0x10')]);module[_0xed87('0x11')]=router; \ No newline at end of file +var _0x7759=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','show','post','put','/:id','update','delete','destroy','multer'];(function(_0x1d30f0,_0x172f04){var _0x2da23a=function(_0x529f4d){while(--_0x529f4d){_0x1d30f0['push'](_0x1d30f0['shift']());}};_0x2da23a(++_0x172f04);}(_0x7759,0x143));var _0x9775=function(_0x17a1a6,_0x372dd8){_0x17a1a6=_0x17a1a6-0x0;var _0x2613db=_0x7759[_0x17a1a6];return _0x2613db;};'use strict';var multer=require(_0x9775('0x0'));var util=require('util');var path=require(_0x9775('0x1'));var timeout=require(_0x9775('0x2'));var express=require(_0x9775('0x3'));var router=express[_0x9775('0x4')]();var fs_extra=require(_0x9775('0x5'));var auth=require(_0x9775('0x6'));var interaction=require(_0x9775('0x7'));var config=require(_0x9775('0x8'));var controller=require('./cmHopperAdditionalPhone.controller');router['get']('/',auth[_0x9775('0x9')](),controller['index']);router[_0x9775('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x9775('0xb')]);router[_0x9775('0xc')]('/',auth[_0x9775('0x9')](),controller['create']);router[_0x9775('0xd')](_0x9775('0xe'),auth[_0x9775('0x9')](),controller[_0x9775('0xf')]);router[_0x9775('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x9775('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 6f479bd..96416f3 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 _0x984b=['STRING','contactListQueue','moment','sequelize','exports'];(function(_0x57e479,_0x52aeb5){var _0x2788f7=function(_0x4d8435){while(--_0x4d8435){_0x57e479['push'](_0x57e479['shift']());}};_0x2788f7(++_0x52aeb5);}(_0x984b,0x15b));var _0xb984=function(_0x19980c,_0x1ea0f7){_0x19980c=_0x19980c-0x0;var _0x19c53c=_0x984b[_0x19980c];return _0x19c53c;};'use strict';var moment=require(_0xb984('0x0'));var Sequelize=require(_0xb984('0x1'));module[_0xb984('0x2')]={'phone':{'type':Sequelize[_0xb984('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0xb984('0x4')},'ListId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0xb984('0x4')}}; \ No newline at end of file +var _0x323e=['INTEGER','contactListQueue','moment','sequelize','exports','STRING'];(function(_0x53ed98,_0x4500e3){var _0x5b3d9d=function(_0x4050a1){while(--_0x4050a1){_0x53ed98['push'](_0x53ed98['shift']());}};_0x5b3d9d(++_0x4500e3);}(_0x323e,0x188));var _0xe323=function(_0x1c238f,_0x36012b){_0x1c238f=_0x1c238f-0x0;var _0x344288=_0x323e[_0x1c238f];return _0x344288;};'use strict';var moment=require(_0xe323('0x0'));var Sequelize=require(_0xe323('0x1'));module[_0xe323('0x2')]={'phone':{'type':Sequelize[_0xe323('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xe323('0x4')],'unique':_0xe323('0x5')},'ListId':{'type':Sequelize[_0xe323('0x4')],'unique':_0xe323('0x5')},'VoiceQueueId':{'type':Sequelize[_0xe323('0x4')],'unique':_0xe323('0x5')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 0ca3e73..25866e6 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 _0x82d8=['model','keys','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','where','filters','pick','filter','type','VIRTUAL','CmHopperBlack','includeAll','include','rows','rawAttributes','merge','options','find','catch','body','params','destroy','describe','eml-format','zip-dir','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','sendStatus','error','stack','name','index','map','fieldName'];(function(_0x4ce479,_0x116f2a){var _0x38bb9d=function(_0x50ddf4){while(--_0x50ddf4){_0x4ce479['push'](_0x4ce479['shift']());}};_0x38bb9d(++_0x116f2a);}(_0x82d8,0x19e));var _0x882d=function(_0x49dba5,_0x41d504){_0x49dba5=_0x49dba5-0x0;var _0x1460a7=_0x82d8[_0x49dba5];return _0x1460a7;};'use strict';var emlformat=require(_0x882d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x882d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x882d('0x2'));var moment=require(_0x882d('0x3'));var BPromise=require(_0x882d('0x4'));var Mustache=require('mustache');var util=require(_0x882d('0x5'));var path=require('path');var sox=require(_0x882d('0x6'));var csv=require(_0x882d('0x7'));var ejs=require(_0x882d('0x8'));var fs=require('fs');var fs_extra=require(_0x882d('0x9'));var _=require('lodash');var squel=require(_0x882d('0xa'));var crypto=require(_0x882d('0xb'));var jsforce=require(_0x882d('0xc'));var deskjs=require(_0x882d('0xd'));var toCsv=require('to-csv');var querystring=require(_0x882d('0xe'));var Papa=require(_0x882d('0xf'));var Redis=require(_0x882d('0x10'));var authService=require(_0x882d('0x11'));var qs=require(_0x882d('0x12'));var as=require(_0x882d('0x13'));var hardwareService=require(_0x882d('0x14'));var logger=require(_0x882d('0x15'))(_0x882d('0x16'));var utils=require(_0x882d('0x17'));var config=require(_0x882d('0x18'));var licenseUtil=require(_0x882d('0x19'));var db=require(_0x882d('0x1a'))['db'];function respondWithStatusCode(_0x21e2ca,_0x2f3e00){_0x2f3e00=_0x2f3e00||0xcc;return function(_0x329363){if(_0x329363){return _0x21e2ca['sendStatus'](_0x2f3e00);}return _0x21e2ca[_0x882d('0x1b')](_0x2f3e00)[_0x882d('0x1c')]();};}function respondWithResult(_0x3a74ce,_0x15f5cb){_0x15f5cb=_0x15f5cb||0xc8;return function(_0x9d4973){if(_0x9d4973){return _0x3a74ce['status'](_0x15f5cb)['json'](_0x9d4973);}};}function respondWithFilteredResult(_0x49b9c5,_0x55ef5b){return function(_0x57ad18){if(_0x57ad18){var _0x58ea6e=typeof _0x55ef5b[_0x882d('0x1d')]===_0x882d('0x1e')&&typeof _0x55ef5b[_0x882d('0x1f')]==='undefined';var _0x587300=_0x57ad18['count'];var _0x1b3bfa=_0x58ea6e?0x0:_0x55ef5b[_0x882d('0x1d')];var _0xcd03cf=_0x58ea6e?_0x57ad18[_0x882d('0x20')]:_0x55ef5b[_0x882d('0x1d')]+_0x55ef5b[_0x882d('0x1f')];var _0x331d46;if(_0xcd03cf>=_0x587300){_0xcd03cf=_0x587300;_0x331d46=0xc8;}else{_0x331d46=0xce;}_0x49b9c5[_0x882d('0x1b')](_0x331d46);return _0x49b9c5[_0x882d('0x21')](_0x882d('0x22'),_0x1b3bfa+'-'+_0xcd03cf+'/'+_0x587300)[_0x882d('0x23')](_0x57ad18);}return null;};}function patchUpdates(_0x50b9d5){return function(_0x38bba1){try{jsonpatch[_0x882d('0x24')](_0x38bba1,_0x50b9d5,!![]);}catch(_0x32323a){return BPromise[_0x882d('0x25')](_0x32323a);}return _0x38bba1[_0x882d('0x26')]();};}function saveUpdates(_0x34f374,_0x8b2002){return function(_0x22d8f8){if(_0x22d8f8){return _0x22d8f8[_0x882d('0x27')](_0x34f374)[_0x882d('0x28')](function(_0x2691ce){return _0x2691ce;});}return null;};}function removeEntity(_0x22bb33,_0x53846f){return function(_0x38d3cb){if(_0x38d3cb){return _0x38d3cb['destroy']()[_0x882d('0x28')](function(){_0x22bb33[_0x882d('0x1b')](0xcc)[_0x882d('0x1c')]();});}};}function handleEntityNotFound(_0x20e7d4,_0xd4dafe){return function(_0x513e72){if(!_0x513e72){_0x20e7d4[_0x882d('0x29')](0x194);}return _0x513e72;};}function handleError(_0x153307,_0x32b865){_0x32b865=_0x32b865||0x1f4;return function(_0x3031cd){logger[_0x882d('0x2a')](_0x3031cd[_0x882d('0x2b')]);if(_0x3031cd[_0x882d('0x2c')]){delete _0x3031cd[_0x882d('0x2c')];}_0x153307[_0x882d('0x1b')](_0x32b865)['send'](_0x3031cd);};}exports[_0x882d('0x2d')]=function(_0x3bce2d,_0x4f6400){var _0x2f225d={},_0x1c4b9d={},_0x2648d3={'count':0x0,'rows':[]};var _0x53ff78=_[_0x882d('0x2e')](db['CmHopperBlack']['rawAttributes'],function(_0x38eb5c){return{'name':_0x38eb5c[_0x882d('0x2f')],'type':_0x38eb5c['type']['key']};});_0x1c4b9d[_0x882d('0x30')]=_[_0x882d('0x2e')](_0x53ff78,_0x882d('0x2c'));_0x1c4b9d['query']=_[_0x882d('0x31')](_0x3bce2d['query']);_0x1c4b9d['filters']=_[_0x882d('0x32')](_0x1c4b9d[_0x882d('0x30')],_0x1c4b9d[_0x882d('0x33')]);_0x2f225d[_0x882d('0x34')]=_['intersection'](_0x1c4b9d[_0x882d('0x30')],qs['fields'](_0x3bce2d[_0x882d('0x33')][_0x882d('0x35')]));_0x2f225d['attributes']=_0x2f225d['attributes'][_0x882d('0x36')]?_0x2f225d['attributes']:_0x1c4b9d[_0x882d('0x30')];if(!_0x3bce2d['query'][_0x882d('0x37')](_0x882d('0x38'))){_0x2f225d['limit']=qs[_0x882d('0x1f')](_0x3bce2d['query'][_0x882d('0x1f')]);_0x2f225d[_0x882d('0x1d')]=qs[_0x882d('0x1d')](_0x3bce2d['query']['offset']);}_0x2f225d[_0x882d('0x39')]=qs['sort'](_0x3bce2d['query']['sort']);_0x2f225d[_0x882d('0x3a')]=qs[_0x882d('0x3b')](_[_0x882d('0x3c')](_0x3bce2d[_0x882d('0x33')],_0x1c4b9d[_0x882d('0x3b')]),_0x53ff78);if(_0x3bce2d[_0x882d('0x33')][_0x882d('0x3d')]){_0x2f225d[_0x882d('0x3a')]=_['merge'](_0x2f225d[_0x882d('0x3a')],{'$or':_[_0x882d('0x2e')](_0x53ff78,function(_0x39a4e6){if(_0x39a4e6[_0x882d('0x3e')]!==_0x882d('0x3f')){var _0x15fbd1={};_0x15fbd1[_0x39a4e6[_0x882d('0x2c')]]={'$like':'%'+_0x3bce2d[_0x882d('0x33')][_0x882d('0x3d')]+'%'};return _0x15fbd1;}})});}_0x2f225d=_['merge']({},_0x2f225d,_0x3bce2d['options']);var _0x3241b9={'where':_0x2f225d[_0x882d('0x3a')]};return db[_0x882d('0x40')][_0x882d('0x20')](_0x3241b9)[_0x882d('0x28')](function(_0x35e188){_0x2648d3['count']=_0x35e188;if(_0x3bce2d[_0x882d('0x33')][_0x882d('0x41')]){_0x2f225d[_0x882d('0x42')]=[{'all':!![]}];}return db['CmHopperBlack']['findAll'](_0x2f225d);})[_0x882d('0x28')](function(_0x41b874){_0x2648d3[_0x882d('0x43')]=_0x41b874;return _0x2648d3;})[_0x882d('0x28')](respondWithFilteredResult(_0x4f6400,_0x2f225d))['catch'](handleError(_0x4f6400,null));};exports['show']=function(_0x249532,_0x439f2f){var _0x2c7d26={'raw':!![],'where':{'id':_0x249532['params']['id']}},_0x421f0e={};_0x421f0e[_0x882d('0x30')]=_[_0x882d('0x31')](db[_0x882d('0x40')][_0x882d('0x44')]);_0x421f0e['query']=_[_0x882d('0x31')](_0x249532[_0x882d('0x33')]);_0x421f0e[_0x882d('0x3b')]=_[_0x882d('0x32')](_0x421f0e[_0x882d('0x30')],_0x421f0e[_0x882d('0x33')]);_0x2c7d26[_0x882d('0x34')]=_[_0x882d('0x32')](_0x421f0e['model'],qs[_0x882d('0x35')](_0x249532[_0x882d('0x33')][_0x882d('0x35')]));_0x2c7d26[_0x882d('0x34')]=_0x2c7d26['attributes'][_0x882d('0x36')]?_0x2c7d26[_0x882d('0x34')]:_0x421f0e['model'];if(_0x249532[_0x882d('0x33')][_0x882d('0x41')]){_0x2c7d26[_0x882d('0x42')]=[{'all':!![]}];}_0x2c7d26=_[_0x882d('0x45')]({},_0x2c7d26,_0x249532[_0x882d('0x46')]);return db[_0x882d('0x40')][_0x882d('0x47')](_0x2c7d26)[_0x882d('0x28')](handleEntityNotFound(_0x439f2f,null))['then'](respondWithResult(_0x439f2f,null))[_0x882d('0x48')](handleError(_0x439f2f,null));};exports['update']=function(_0x2d1de7,_0x37c175){if(_0x2d1de7[_0x882d('0x49')]['id']){delete _0x2d1de7['body']['id'];}return db['CmHopperBlack'][_0x882d('0x47')]({'where':{'id':_0x2d1de7[_0x882d('0x4a')]['id']}})[_0x882d('0x28')](handleEntityNotFound(_0x37c175,null))['then'](saveUpdates(_0x2d1de7[_0x882d('0x49')],null))[_0x882d('0x28')](respondWithResult(_0x37c175,null))[_0x882d('0x48')](handleError(_0x37c175,null));};exports[_0x882d('0x4b')]=function(_0x525992,_0x358b7c){return db['CmHopperBlack']['find']({'where':{'id':_0x525992[_0x882d('0x4a')]['id']}})['then'](handleEntityNotFound(_0x358b7c,null))[_0x882d('0x28')](removeEntity(_0x358b7c,null))['catch'](handleError(_0x358b7c,null));};exports[_0x882d('0x4c')]=function(_0xfc440c,_0xa7837e){return db[_0x882d('0x40')]['describe']()[_0x882d('0x28')](respondWithResult(_0xa7837e,null))[_0x882d('0x48')](handleError(_0xa7837e,null));}; \ No newline at end of file +var _0x3f21=['sendStatus','status','end','json','undefined','limit','count','offset','set','apply','save','update','destroy','then','error','stack','name','index','map','rawAttributes','fieldName','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','where','VIRTUAL','filter','options','CmHopperBlack','includeAll','rows','catch','show','params','keys','include','find','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x5a7618,_0x3f44c2){var _0x12dc65=function(_0x3cc4cd){while(--_0x3cc4cd){_0x5a7618['push'](_0x5a7618['shift']());}};_0x12dc65(++_0x3f44c2);}(_0x3f21,0x7b));var _0x13f2=function(_0x3aa56b,_0x44ea4f){_0x3aa56b=_0x3aa56b-0x0;var _0x24736c=_0x3f21[_0x3aa56b];return _0x24736c;};'use strict';var emlformat=require(_0x13f2('0x0'));var rimraf=require(_0x13f2('0x1'));var zipdir=require(_0x13f2('0x2'));var jsonpatch=require(_0x13f2('0x3'));var rp=require('request-promise');var moment=require(_0x13f2('0x4'));var BPromise=require(_0x13f2('0x5'));var Mustache=require(_0x13f2('0x6'));var util=require(_0x13f2('0x7'));var path=require(_0x13f2('0x8'));var sox=require(_0x13f2('0x9'));var csv=require(_0x13f2('0xa'));var ejs=require(_0x13f2('0xb'));var fs=require('fs');var fs_extra=require(_0x13f2('0xc'));var _=require(_0x13f2('0xd'));var squel=require(_0x13f2('0xe'));var crypto=require(_0x13f2('0xf'));var jsforce=require(_0x13f2('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x13f2('0x11'));var Papa=require(_0x13f2('0x12'));var Redis=require(_0x13f2('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x13f2('0x14'));var as=require(_0x13f2('0x15'));var hardwareService=require(_0x13f2('0x16'));var logger=require(_0x13f2('0x17'))(_0x13f2('0x18'));var utils=require(_0x13f2('0x19'));var config=require(_0x13f2('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4c4411,_0x32ff83){_0x32ff83=_0x32ff83||0xcc;return function(_0x1d9d75){if(_0x1d9d75){return _0x4c4411[_0x13f2('0x1b')](_0x32ff83);}return _0x4c4411[_0x13f2('0x1c')](_0x32ff83)[_0x13f2('0x1d')]();};}function respondWithResult(_0x5acd51,_0x3bbaea){_0x3bbaea=_0x3bbaea||0xc8;return function(_0x229104){if(_0x229104){return _0x5acd51[_0x13f2('0x1c')](_0x3bbaea)[_0x13f2('0x1e')](_0x229104);}};}function respondWithFilteredResult(_0x9bf8b4,_0x5c643c){return function(_0x13c6fe){if(_0x13c6fe){var _0x9beeaa=typeof _0x5c643c['offset']===_0x13f2('0x1f')&&typeof _0x5c643c[_0x13f2('0x20')]===_0x13f2('0x1f');var _0x4e32ea=_0x13c6fe['count'];var _0x5ae41e=_0x9beeaa?0x0:_0x5c643c['offset'];var _0xe4627e=_0x9beeaa?_0x13c6fe[_0x13f2('0x21')]:_0x5c643c[_0x13f2('0x22')]+_0x5c643c[_0x13f2('0x20')];var _0x560168;if(_0xe4627e>=_0x4e32ea){_0xe4627e=_0x4e32ea;_0x560168=0xc8;}else{_0x560168=0xce;}_0x9bf8b4[_0x13f2('0x1c')](_0x560168);return _0x9bf8b4[_0x13f2('0x23')]('Content-Range',_0x5ae41e+'-'+_0xe4627e+'/'+_0x4e32ea)['json'](_0x13c6fe);}return null;};}function patchUpdates(_0x3c53f8){return function(_0x2255ff){try{jsonpatch[_0x13f2('0x24')](_0x2255ff,_0x3c53f8,!![]);}catch(_0x33ef74){return BPromise['reject'](_0x33ef74);}return _0x2255ff[_0x13f2('0x25')]();};}function saveUpdates(_0x4eeb0f,_0x473680){return function(_0x470547){if(_0x470547){return _0x470547[_0x13f2('0x26')](_0x4eeb0f)['then'](function(_0xdaafd0){return _0xdaafd0;});}return null;};}function removeEntity(_0x22cf18,_0x9d1f4d){return function(_0x4d1466){if(_0x4d1466){return _0x4d1466[_0x13f2('0x27')]()[_0x13f2('0x28')](function(){_0x22cf18[_0x13f2('0x1c')](0xcc)[_0x13f2('0x1d')]();});}};}function handleEntityNotFound(_0x358b98,_0x435b17){return function(_0x3f30b9){if(!_0x3f30b9){_0x358b98['sendStatus'](0x194);}return _0x3f30b9;};}function handleError(_0x487e5b,_0x4ada07){_0x4ada07=_0x4ada07||0x1f4;return function(_0x6e9bb7){logger[_0x13f2('0x29')](_0x6e9bb7[_0x13f2('0x2a')]);if(_0x6e9bb7[_0x13f2('0x2b')]){delete _0x6e9bb7[_0x13f2('0x2b')];}_0x487e5b['status'](_0x4ada07)['send'](_0x6e9bb7);};}exports[_0x13f2('0x2c')]=function(_0x27a8ff,_0x481db4){var _0x335994={},_0x384b57={},_0x25b111={'count':0x0,'rows':[]};var _0x53cfd3=_[_0x13f2('0x2d')](db['CmHopperBlack'][_0x13f2('0x2e')],function(_0x283db9){return{'name':_0x283db9[_0x13f2('0x2f')],'type':_0x283db9['type']['key']};});_0x384b57[_0x13f2('0x30')]=_[_0x13f2('0x2d')](_0x53cfd3,_0x13f2('0x2b'));_0x384b57[_0x13f2('0x31')]=_['keys'](_0x27a8ff[_0x13f2('0x31')]);_0x384b57['filters']=_[_0x13f2('0x32')](_0x384b57[_0x13f2('0x30')],_0x384b57[_0x13f2('0x31')]);_0x335994[_0x13f2('0x33')]=_['intersection'](_0x384b57[_0x13f2('0x30')],qs[_0x13f2('0x34')](_0x27a8ff['query'][_0x13f2('0x34')]));_0x335994[_0x13f2('0x33')]=_0x335994[_0x13f2('0x33')][_0x13f2('0x35')]?_0x335994['attributes']:_0x384b57[_0x13f2('0x30')];if(!_0x27a8ff['query'][_0x13f2('0x36')](_0x13f2('0x37'))){_0x335994[_0x13f2('0x20')]=qs[_0x13f2('0x20')](_0x27a8ff[_0x13f2('0x31')]['limit']);_0x335994[_0x13f2('0x22')]=qs['offset'](_0x27a8ff['query']['offset']);}_0x335994[_0x13f2('0x38')]=qs[_0x13f2('0x39')](_0x27a8ff['query']['sort']);_0x335994['where']=qs[_0x13f2('0x3a')](_[_0x13f2('0x3b')](_0x27a8ff[_0x13f2('0x31')],_0x384b57[_0x13f2('0x3a')]),_0x53cfd3);if(_0x27a8ff[_0x13f2('0x31')]['filter']){_0x335994[_0x13f2('0x3c')]=_['merge'](_0x335994[_0x13f2('0x3c')],{'$or':_['map'](_0x53cfd3,function(_0x1480df){if(_0x1480df['type']!==_0x13f2('0x3d')){var _0x227b8b={};_0x227b8b[_0x1480df[_0x13f2('0x2b')]]={'$like':'%'+_0x27a8ff[_0x13f2('0x31')][_0x13f2('0x3e')]+'%'};return _0x227b8b;}})});}_0x335994=_['merge']({},_0x335994,_0x27a8ff[_0x13f2('0x3f')]);var _0x262523={'where':_0x335994[_0x13f2('0x3c')]};return db[_0x13f2('0x40')][_0x13f2('0x21')](_0x262523)['then'](function(_0x35432f){_0x25b111['count']=_0x35432f;if(_0x27a8ff['query'][_0x13f2('0x41')]){_0x335994['include']=[{'all':!![]}];}return db[_0x13f2('0x40')]['findAll'](_0x335994);})[_0x13f2('0x28')](function(_0x4d3a75){_0x25b111[_0x13f2('0x42')]=_0x4d3a75;return _0x25b111;})['then'](respondWithFilteredResult(_0x481db4,_0x335994))[_0x13f2('0x43')](handleError(_0x481db4,null));};exports[_0x13f2('0x44')]=function(_0x151c23,_0x4f7135){var _0x2887da={'raw':!![],'where':{'id':_0x151c23[_0x13f2('0x45')]['id']}},_0x32b76a={};_0x32b76a[_0x13f2('0x30')]=_[_0x13f2('0x46')](db[_0x13f2('0x40')][_0x13f2('0x2e')]);_0x32b76a[_0x13f2('0x31')]=_[_0x13f2('0x46')](_0x151c23[_0x13f2('0x31')]);_0x32b76a[_0x13f2('0x3a')]=_[_0x13f2('0x32')](_0x32b76a[_0x13f2('0x30')],_0x32b76a[_0x13f2('0x31')]);_0x2887da[_0x13f2('0x33')]=_[_0x13f2('0x32')](_0x32b76a[_0x13f2('0x30')],qs[_0x13f2('0x34')](_0x151c23[_0x13f2('0x31')][_0x13f2('0x34')]));_0x2887da['attributes']=_0x2887da[_0x13f2('0x33')][_0x13f2('0x35')]?_0x2887da[_0x13f2('0x33')]:_0x32b76a[_0x13f2('0x30')];if(_0x151c23[_0x13f2('0x31')][_0x13f2('0x41')]){_0x2887da[_0x13f2('0x47')]=[{'all':!![]}];}_0x2887da=_['merge']({},_0x2887da,_0x151c23['options']);return db['CmHopperBlack'][_0x13f2('0x48')](_0x2887da)[_0x13f2('0x28')](handleEntityNotFound(_0x4f7135,null))[_0x13f2('0x28')](respondWithResult(_0x4f7135,null))['catch'](handleError(_0x4f7135,null));};exports['update']=function(_0x363f33,_0x5971a0){if(_0x363f33['body']['id']){delete _0x363f33[_0x13f2('0x49')]['id'];}return db['CmHopperBlack'][_0x13f2('0x48')]({'where':{'id':_0x363f33[_0x13f2('0x45')]['id']}})[_0x13f2('0x28')](handleEntityNotFound(_0x5971a0,null))['then'](saveUpdates(_0x363f33[_0x13f2('0x49')],null))[_0x13f2('0x28')](respondWithResult(_0x5971a0,null))['catch'](handleError(_0x5971a0,null));};exports['destroy']=function(_0x20b9a8,_0x3870af){return db['CmHopperBlack'][_0x13f2('0x48')]({'where':{'id':_0x20b9a8['params']['id']}})[_0x13f2('0x28')](handleEntityNotFound(_0x3870af,null))[_0x13f2('0x28')](removeEntity(_0x3870af,null))[_0x13f2('0x43')](handleError(_0x3870af,null));};exports['describe']=function(_0x274f70,_0x1eca11){return db[_0x13f2('0x40')][_0x13f2('0x4a')]()[_0x13f2('0x28')](respondWithResult(_0x1eca11,null))['catch'](handleError(_0x1eca11,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index f6ea347..7458b80 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 _0x0d00=['CmHopperBlack','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x2f1650,_0x3b0ab5){var _0x4d829e=function(_0x301986){while(--_0x301986){_0x2f1650['push'](_0x2f1650['shift']());}};_0x4d829e(++_0x3b0ab5);}(_0x0d00,0x6d));var _0x00d0=function(_0x25248b,_0x3c8491){_0x25248b=_0x25248b-0x0;var _0x509939=_0x0d00[_0x25248b];return _0x509939;};'use strict';var _=require(_0x00d0('0x0'));var util=require(_0x00d0('0x1'));var logger=require(_0x00d0('0x2'))(_0x00d0('0x3'));var moment=require('moment');var BPromise=require(_0x00d0('0x4'));var rp=require(_0x00d0('0x5'));var fs=require('fs');var path=require(_0x00d0('0x6'));var rimraf=require(_0x00d0('0x7'));var config=require(_0x00d0('0x8'));var attributes=require('./cmHopperBlack.attributes');module[_0x00d0('0x9')]=function(_0x463edb,_0x391b6f){return _0x463edb[_0x00d0('0xa')](_0x00d0('0xb'),attributes,{'tableName':'cm_hopper_black','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x73cf=['CmHopperBlack','cm_hopper_black','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x311d45,_0xad8766){var _0x55ba6e=function(_0x4c17f5){while(--_0x4c17f5){_0x311d45['push'](_0x311d45['shift']());}};_0x55ba6e(++_0xad8766);}(_0x73cf,0x18e));var _0xf73c=function(_0x5e36d1,_0x471178){_0x5e36d1=_0x5e36d1-0x0;var _0x950b9e=_0x73cf[_0x5e36d1];return _0x950b9e;};'use strict';var _=require(_0xf73c('0x0'));var util=require(_0xf73c('0x1'));var logger=require(_0xf73c('0x2'))(_0xf73c('0x3'));var moment=require(_0xf73c('0x4'));var BPromise=require(_0xf73c('0x5'));var rp=require(_0xf73c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf73c('0x7'));var config=require(_0xf73c('0x8'));var attributes=require('./cmHopperBlack.attributes');module['exports']=function(_0x15539c,_0x2d0360){return _0x15539c['define'](_0xf73c('0x9'),attributes,{'tableName':_0xf73c('0xa'),'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 a13792f..72bc6b4 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 _0x8da3=['destroy','DestroyCmHopperBlack','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','message','CmHopperBlack,\x20%s,\x20%s','result','catch','GetCmHopperBlack','options','raw','where','attributes','include','map','model','UpdateCmHopperBlack','CmHopperBlack','update'];(function(_0x46ffa8,_0x3f3d11){var _0x380693=function(_0x10f32b){while(--_0x10f32b){_0x46ffa8['push'](_0x46ffa8['shift']());}};_0x380693(++_0x3f3d11);}(_0x8da3,0x71));var _0x38da=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x8da3[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x38da('0x0'));var util=require(_0x38da('0x1'));var moment=require(_0x38da('0x2'));var BPromise=require('bluebird');var rs=require(_0x38da('0x3'));var fs=require('fs');var Redis=require(_0x38da('0x4'));var db=require(_0x38da('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x38da('0x6'))(_0x38da('0x7'));var config=require(_0x38da('0x8'));var jayson=require(_0x38da('0x9'));var client=jayson[_0x38da('0xa')][_0x38da('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x51a1d7,_0x13aab3,_0x2f67db){return new BPromise(function(_0x1f0a9e,_0x2b6574){return client[_0x38da('0xc')](_0x51a1d7,_0x2f67db)[_0x38da('0xd')](function(_0x267901){logger[_0x38da('0xe')]('CmHopperBlack,\x20%s,\x20%s',_0x13aab3,_0x38da('0xf'));logger[_0x38da('0x10')](_0x38da('0x11'),_0x13aab3,_0x38da('0xf'),JSON[_0x38da('0x12')](_0x267901));if(_0x267901[_0x38da('0x13')]){if(_0x267901[_0x38da('0x13')]['code']===0x1f4){logger[_0x38da('0x13')]('CmHopperBlack,\x20%s,\x20%s',_0x13aab3,_0x267901[_0x38da('0x13')][_0x38da('0x14')]);return _0x2b6574(_0x267901[_0x38da('0x13')][_0x38da('0x14')]);}logger[_0x38da('0x13')](_0x38da('0x15'),_0x13aab3,_0x267901[_0x38da('0x13')][_0x38da('0x14')]);return _0x1f0a9e(_0x267901['error'][_0x38da('0x14')]);}else{logger[_0x38da('0xe')]('CmHopperBlack,\x20%s,\x20%s',_0x13aab3,_0x38da('0xf'));_0x1f0a9e(_0x267901[_0x38da('0x16')]['message']);}})[_0x38da('0x17')](function(_0x3d9f8c){logger['error'](_0x38da('0x15'),_0x13aab3,_0x3d9f8c);_0x2b6574(_0x3d9f8c);});});}exports[_0x38da('0x18')]=function(_0x333a77){var _0x605b9=this;return new Promise(function(_0x533c3c,_0x225cd6){return db['CmHopperBlack']['findAll']({'raw':_0x333a77[_0x38da('0x19')]?_0x333a77[_0x38da('0x19')][_0x38da('0x1a')]===undefined?!![]:![]:!![],'where':_0x333a77[_0x38da('0x19')]?_0x333a77['options'][_0x38da('0x1b')]||null:null,'attributes':_0x333a77[_0x38da('0x19')]?_0x333a77[_0x38da('0x19')][_0x38da('0x1c')]||null:null,'limit':_0x333a77[_0x38da('0x19')]?_0x333a77[_0x38da('0x19')]['limit']||null:null,'include':_0x333a77[_0x38da('0x19')]?_0x333a77['options'][_0x38da('0x1d')]?_[_0x38da('0x1e')](_0x333a77[_0x38da('0x19')][_0x38da('0x1d')],function(_0x254afd){return{'model':db[_0x254afd[_0x38da('0x1f')]],'as':_0x254afd['as'],'attributes':_0x254afd['attributes'],'include':_0x254afd[_0x38da('0x1d')]?_[_0x38da('0x1e')](_0x254afd[_0x38da('0x1d')],function(_0x16bb5b){return{'model':db[_0x16bb5b[_0x38da('0x1f')]],'as':_0x16bb5b['as'],'attributes':_0x16bb5b[_0x38da('0x1c')],'include':_0x16bb5b[_0x38da('0x1d')]?_[_0x38da('0x1e')](_0x16bb5b[_0x38da('0x1d')],function(_0xf9c1ad){return{'model':db[_0xf9c1ad[_0x38da('0x1f')]],'as':_0xf9c1ad['as'],'attributes':_0xf9c1ad[_0x38da('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xc83933){logger['info'](_0x38da('0x18'),_0x333a77);logger['debug'](_0x38da('0x18'),_0x333a77,JSON[_0x38da('0x12')](_0xc83933));_0x533c3c(_0xc83933);})[_0x38da('0x17')](function(_0x2f839a){logger[_0x38da('0x13')]('GetCmHopperBlack',_0x2f839a[_0x38da('0x14')],_0x333a77);_0x225cd6(_0x605b9[_0x38da('0x13')](0x1f4,_0x2f839a[_0x38da('0x14')]));});});};exports[_0x38da('0x20')]=function(_0xa21df3){var _0x56fc60=this;return new Promise(function(_0x1c93d4,_0x17e8ab){return db[_0x38da('0x21')][_0x38da('0x22')](_0xa21df3['body'],{'raw':_0xa21df3[_0x38da('0x19')]?_0xa21df3[_0x38da('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xa21df3[_0x38da('0x19')]?_0xa21df3[_0x38da('0x19')][_0x38da('0x1b')]||null:null,'attributes':_0xa21df3[_0x38da('0x19')]?_0xa21df3[_0x38da('0x19')][_0x38da('0x1c')]||null:null,'limit':_0xa21df3['options']?_0xa21df3[_0x38da('0x19')]['limit']||null:null})[_0x38da('0xd')](function(_0x1a174c){logger[_0x38da('0xe')](_0x38da('0x20'),_0xa21df3);logger[_0x38da('0x10')](_0x38da('0x20'),_0xa21df3,JSON['stringify'](_0x1a174c));_0x1c93d4(_0x1a174c);})['catch'](function(_0x50a8aa){logger['error']('UpdateCmHopperBlack',_0x50a8aa[_0x38da('0x14')],_0xa21df3);_0x17e8ab(_0x56fc60[_0x38da('0x13')](0x1f4,_0x50a8aa[_0x38da('0x14')]));});});};exports['DestroyCmHopperBlack']=function(_0x5e6c03){var _0x19bdda=this;return new Promise(function(_0x4ef807,_0x4c5742){return db[_0x38da('0x21')][_0x38da('0x23')]({'where':_0x5e6c03[_0x38da('0x19')]?_0x5e6c03[_0x38da('0x19')][_0x38da('0x1b')]||null:null})[_0x38da('0xd')](function(_0x2f8f45){logger[_0x38da('0xe')](_0x38da('0x24'),_0x5e6c03);logger['debug'](_0x38da('0x24'),_0x5e6c03,JSON[_0x38da('0x12')](_0x2f8f45));_0x4ef807(_0x2f8f45);})[_0x38da('0x17')](function(_0x11ba5d){logger[_0x38da('0x13')](_0x38da('0x24'),_0x11ba5d[_0x38da('0x14')],_0x5e6c03);_0x4c5742(_0x19bdda['error'](0x1f4,_0x11ba5d[_0x38da('0x14')]));});});}; \ No newline at end of file +var _0x8141=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','error','code','message','info','GetCmHopperBlack','findAll','options','raw','where','attributes','include','map','model','catch','UpdateCmHopperBlack','CmHopperBlack','limit','destroy','DestroyCmHopperBlack','stringify','lodash','util','moment','bluebird'];(function(_0xd95342,_0xb75bf6){var _0x54d694=function(_0x1190c1){while(--_0x1190c1){_0xd95342['push'](_0xd95342['shift']());}};_0x54d694(++_0xb75bf6);}(_0x8141,0xff));var _0x1814=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8141[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x1814('0x0'));var util=require(_0x1814('0x1'));var moment=require(_0x1814('0x2'));var BPromise=require(_0x1814('0x3'));var rs=require(_0x1814('0x4'));var fs=require('fs');var Redis=require(_0x1814('0x5'));var db=require(_0x1814('0x6'))['db'];var utils=require(_0x1814('0x7'));var logger=require(_0x1814('0x8'))(_0x1814('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1814('0xa')][_0x1814('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5507ed,_0x454647,_0x377389){return new BPromise(function(_0x39850c,_0x27a181){return client['request'](_0x5507ed,_0x377389)[_0x1814('0xc')](function(_0x395de0){logger['info'](_0x1814('0xd'),_0x454647,_0x1814('0xe'));logger[_0x1814('0xf')](_0x1814('0x10'),_0x454647,_0x1814('0xe'),JSON['stringify'](_0x395de0));if(_0x395de0[_0x1814('0x11')]){if(_0x395de0[_0x1814('0x11')][_0x1814('0x12')]===0x1f4){logger['error'](_0x1814('0xd'),_0x454647,_0x395de0[_0x1814('0x11')][_0x1814('0x13')]);return _0x27a181(_0x395de0[_0x1814('0x11')]['message']);}logger[_0x1814('0x11')](_0x1814('0xd'),_0x454647,_0x395de0[_0x1814('0x11')]['message']);return _0x39850c(_0x395de0[_0x1814('0x11')][_0x1814('0x13')]);}else{logger[_0x1814('0x14')](_0x1814('0xd'),_0x454647,_0x1814('0xe'));_0x39850c(_0x395de0['result']['message']);}})['catch'](function(_0x38ab6a){logger['error'](_0x1814('0xd'),_0x454647,_0x38ab6a);_0x27a181(_0x38ab6a);});});}exports[_0x1814('0x15')]=function(_0x63144){var _0xeba8fe=this;return new Promise(function(_0x545c64,_0xb07cb3){return db['CmHopperBlack'][_0x1814('0x16')]({'raw':_0x63144[_0x1814('0x17')]?_0x63144[_0x1814('0x17')][_0x1814('0x18')]===undefined?!![]:![]:!![],'where':_0x63144['options']?_0x63144[_0x1814('0x17')][_0x1814('0x19')]||null:null,'attributes':_0x63144[_0x1814('0x17')]?_0x63144[_0x1814('0x17')][_0x1814('0x1a')]||null:null,'limit':_0x63144['options']?_0x63144['options']['limit']||null:null,'include':_0x63144['options']?_0x63144[_0x1814('0x17')][_0x1814('0x1b')]?_[_0x1814('0x1c')](_0x63144[_0x1814('0x17')][_0x1814('0x1b')],function(_0x382f62){return{'model':db[_0x382f62[_0x1814('0x1d')]],'as':_0x382f62['as'],'attributes':_0x382f62[_0x1814('0x1a')],'include':_0x382f62['include']?_[_0x1814('0x1c')](_0x382f62[_0x1814('0x1b')],function(_0x2becf0){return{'model':db[_0x2becf0[_0x1814('0x1d')]],'as':_0x2becf0['as'],'attributes':_0x2becf0[_0x1814('0x1a')],'include':_0x2becf0[_0x1814('0x1b')]?_['map'](_0x2becf0['include'],function(_0x5214ad){return{'model':db[_0x5214ad[_0x1814('0x1d')]],'as':_0x5214ad['as'],'attributes':_0x5214ad['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xc186a1){logger[_0x1814('0x14')](_0x1814('0x15'),_0x63144);logger[_0x1814('0xf')](_0x1814('0x15'),_0x63144,JSON['stringify'](_0xc186a1));_0x545c64(_0xc186a1);})[_0x1814('0x1e')](function(_0x2e744c){logger[_0x1814('0x11')]('GetCmHopperBlack',_0x2e744c[_0x1814('0x13')],_0x63144);_0xb07cb3(_0xeba8fe[_0x1814('0x11')](0x1f4,_0x2e744c[_0x1814('0x13')]));});});};exports[_0x1814('0x1f')]=function(_0x1a52c4){var _0x4c0892=this;return new Promise(function(_0x10f4c5,_0x59a746){return db[_0x1814('0x20')]['update'](_0x1a52c4['body'],{'raw':_0x1a52c4[_0x1814('0x17')]?_0x1a52c4[_0x1814('0x17')][_0x1814('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1a52c4[_0x1814('0x17')]?_0x1a52c4[_0x1814('0x17')][_0x1814('0x19')]||null:null,'attributes':_0x1a52c4[_0x1814('0x17')]?_0x1a52c4['options']['attributes']||null:null,'limit':_0x1a52c4['options']?_0x1a52c4['options'][_0x1814('0x21')]||null:null})['then'](function(_0x535be0){logger[_0x1814('0x14')](_0x1814('0x1f'),_0x1a52c4);logger[_0x1814('0xf')](_0x1814('0x1f'),_0x1a52c4,JSON['stringify'](_0x535be0));_0x10f4c5(_0x535be0);})[_0x1814('0x1e')](function(_0x83a747){logger['error'](_0x1814('0x1f'),_0x83a747[_0x1814('0x13')],_0x1a52c4);_0x59a746(_0x4c0892[_0x1814('0x11')](0x1f4,_0x83a747[_0x1814('0x13')]));});});};exports['DestroyCmHopperBlack']=function(_0x525668){var _0x5b785f=this;return new Promise(function(_0x42e64f,_0x2ebce6){return db[_0x1814('0x20')][_0x1814('0x22')]({'where':_0x525668[_0x1814('0x17')]?_0x525668['options']['where']||null:null})[_0x1814('0xc')](function(_0x469a31){logger[_0x1814('0x14')](_0x1814('0x23'),_0x525668);logger['debug'](_0x1814('0x23'),_0x525668,JSON[_0x1814('0x24')](_0x469a31));_0x42e64f(_0x469a31);})[_0x1814('0x1e')](function(_0x340e6b){logger[_0x1814('0x11')]('DestroyCmHopperBlack',_0x340e6b['message'],_0x525668);_0x2ebce6(_0x5b785f[_0x1814('0x11')](0x1f4,_0x340e6b[_0x1814('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 01d778c..a19155d 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 _0xe2fe=['/describe','describe','/:id','put','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x21353c,_0x2ea587){var _0xa99120=function(_0x557f33){while(--_0x557f33){_0x21353c['push'](_0x21353c['shift']());}};_0xa99120(++_0x2ea587);}(_0xe2fe,0x86));var _0xee2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe2fe[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xee2f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xee2f('0x1'));var express=require('express');var router=express[_0xee2f('0x2')]();var fs_extra=require(_0xee2f('0x3'));var auth=require(_0xee2f('0x4'));var interaction=require(_0xee2f('0x5'));var config=require(_0xee2f('0x6'));var controller=require('./cmHopperBlack.controller');router[_0xee2f('0x7')]('/',auth[_0xee2f('0x8')](),controller['index']);router[_0xee2f('0x7')](_0xee2f('0x9'),auth['isAuthenticated'](),controller[_0xee2f('0xa')]);router['get'](_0xee2f('0xb'),auth[_0xee2f('0x8')](),controller['show']);router[_0xee2f('0xc')](_0xee2f('0xb'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0xee2f('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xb145=['update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmHopperBlack.controller','get','isAuthenticated','index','/describe','describe','/:id','show','put'];(function(_0x5716b2,_0x4c2f1a){var _0x2dd657=function(_0x5a2651){while(--_0x5a2651){_0x5716b2['push'](_0x5716b2['shift']());}};_0x2dd657(++_0x4c2f1a);}(_0xb145,0xa3));var _0x5b14=function(_0x5cf046,_0x17778c){_0x5cf046=_0x5cf046-0x0;var _0x42c854=_0xb145[_0x5cf046];return _0x42c854;};'use strict';var multer=require('multer');var util=require(_0x5b14('0x0'));var path=require(_0x5b14('0x1'));var timeout=require(_0x5b14('0x2'));var express=require(_0x5b14('0x3'));var router=express[_0x5b14('0x4')]();var fs_extra=require(_0x5b14('0x5'));var auth=require(_0x5b14('0x6'));var interaction=require(_0x5b14('0x7'));var config=require('../../config/environment');var controller=require(_0x5b14('0x8'));router[_0x5b14('0x9')]('/',auth[_0x5b14('0xa')](),controller[_0x5b14('0xb')]);router['get'](_0x5b14('0xc'),auth[_0x5b14('0xa')](),controller[_0x5b14('0xd')]);router[_0x5b14('0x9')](_0x5b14('0xe'),auth['isAuthenticated'](),controller[_0x5b14('0xf')]);router[_0x5b14('0x10')]('/:id',auth[_0x5b14('0xa')](),controller[_0x5b14('0x11')]);router[_0x5b14('0x12')](_0x5b14('0xe'),auth[_0x5b14('0xa')](),controller['destroy']);module[_0x5b14('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 356ffcc..c5516fb 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 _0xf50d=['diff','seconds','BOOLEAN','moment','exports','INTEGER','STRING','DATE','getDataValue','endtime','followuptime'];(function(_0x57c701,_0x18ee4d){var _0xd624f1=function(_0x1231c5){while(--_0x1231c5){_0x57c701['push'](_0x57c701['shift']());}};_0xd624f1(++_0x18ee4d);}(_0xf50d,0xdf));var _0xdf50=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0xf50d[_0x525c7b];return _0x27b33e;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xdf50('0x0'));module[_0xdf50('0x1')]={'state':{'type':Sequelize[_0xdf50('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xdf50('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0xdf50('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xdf50('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xdf50('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xdf50('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xdf50('0x3')]},'starttime':{'type':Sequelize[_0xdf50('0x4')]},'responsetime':{'type':Sequelize[_0xdf50('0x4')]},'answertime':{'type':Sequelize[_0xdf50('0x4')]},'droptime':{'type':Sequelize[_0xdf50('0x4')]},'endtime':{'type':Sequelize[_0xdf50('0x4')]},'ringtime':{'type':Sequelize[_0xdf50('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xdf50('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xdf50('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0xdf50('0x3')]},'campaigntype':{'type':Sequelize[_0xdf50('0x3')]},'membername':{'type':Sequelize[_0xdf50('0x3')]},'reason':{'type':Sequelize[_0xdf50('0x3')]},'disposition':{'type':Sequelize[_0xdf50('0x3')]},'secondDisposition':{'type':Sequelize[_0xdf50('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize[_0xdf50('0x4')],'set':function(_0x59c7e0){var _0x253a13=this[_0xdf50('0x5')](_0xdf50('0x6'));if(_0x253a13&&_0x59c7e0){this['setDataValue'](_0xdf50('0x7'),moment(_0x59c7e0)[_0xdf50('0x8')](moment(_0x253a13),_0xdf50('0x9')));}}},'amd':{'type':Sequelize[_0xdf50('0xa')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xdf50('0xa')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize[_0xdf50('0xa')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xdf50('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xdf50('0x4')]},'deleted':{'type':Sequelize[_0xdf50('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize[_0xdf50('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xdf50('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xdf50('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xdf50('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xdf50('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb876=['setDataValue','followuptime','diff','seconds','BOOLEAN','moment','exports','INTEGER','STRING','DATE','getDataValue','endtime'];(function(_0x3c2c86,_0x2088f8){var _0x3c427d=function(_0x4c4c30){while(--_0x4c4c30){_0x3c2c86['push'](_0x3c2c86['shift']());}};_0x3c427d(++_0x2088f8);}(_0xb876,0x161));var _0x6b87=function(_0x67f04d,_0x451fa6){_0x67f04d=_0x67f04d-0x0;var _0x520a6e=_0xb876[_0x67f04d];return _0x520a6e;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x6b87('0x0'));module[_0x6b87('0x1')]={'state':{'type':Sequelize[_0x6b87('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x6b87('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x6b87('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x6b87('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x6b87('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x6b87('0x3')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x6b87('0x3')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x6b87('0x4')]},'responsetime':{'type':Sequelize[_0x6b87('0x4')]},'answertime':{'type':Sequelize[_0x6b87('0x4')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x6b87('0x4')]},'ringtime':{'type':Sequelize[_0x6b87('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x6b87('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x6b87('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x6b87('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x6b87('0x3')]},'membername':{'type':Sequelize[_0x6b87('0x3')]},'reason':{'type':Sequelize[_0x6b87('0x3')]},'disposition':{'type':Sequelize[_0x6b87('0x3')]},'secondDisposition':{'type':Sequelize[_0x6b87('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize[_0x6b87('0x4')],'set':function(_0x2baad8){var _0x4b562e=this[_0x6b87('0x5')](_0x6b87('0x6'));if(_0x4b562e&&_0x2baad8){this[_0x6b87('0x7')](_0x6b87('0x8'),moment(_0x2baad8)[_0x6b87('0x9')](moment(_0x4b562e),_0x6b87('0xa')));}}},'amd':{'type':Sequelize[_0x6b87('0xb')],'defaultValue':![]},'fax':{'type':Sequelize[_0x6b87('0xb')],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x6b87('0xb')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x6b87('0x4')]},'callback':{'type':Sequelize[_0x6b87('0xb')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x6b87('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x6b87('0x4')]},'deleted':{'type':Sequelize[_0x6b87('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x6b87('0x4')]},'recallme':{'type':Sequelize[_0x6b87('0xb')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x6b87('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0x6b87('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x6b87('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x6b87('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x6b87('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x6b87('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index 814d697..d446a0e 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 _0x1261=['attributes','fields','length','hasOwnProperty','sort','pick','filters','where','type','VIRTUAL','filter','merge','options','findAll','rows','params','include','find','describe','catch','body','uniqueid','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','dropContacts','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','moveContactsQueueCampaignHopperFinal','VoiceQueue','cm_hopper','fromQuery','phone','scheduledAt','createdAt','updatedAt','select','field','NOW()','ANY_VALUE(ContactId)','ContactId','ANY_VALUE(ListId)','VoiceQueueId','from','VoiceQueueId\x20=\x20?','toString','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','cm_hopper_final','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','into','ListId','CampaignId','ANY_VALUE(calleridnum)','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','state\x20=\x20?','checkContactHopper','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','error','stack','send','CmHopperFinal','model','map','name','keys','query','intersection'];(function(_0x245683,_0xd10784){var _0x3c7789=function(_0xbf8cc9){while(--_0xbf8cc9){_0x245683['push'](_0x245683['shift']());}};_0x3c7789(++_0xd10784);}(_0x1261,0x144));var _0x1126=function(_0x371b64,_0x67b4bb){_0x371b64=_0x371b64-0x0;var _0x3cf3b1=_0x1261[_0x371b64];return _0x3cf3b1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1126('0x0'));var zipdir=require(_0x1126('0x1'));var jsonpatch=require(_0x1126('0x2'));var rp=require(_0x1126('0x3'));var moment=require(_0x1126('0x4'));var BPromise=require(_0x1126('0x5'));var Mustache=require(_0x1126('0x6'));var util=require(_0x1126('0x7'));var path=require(_0x1126('0x8'));var sox=require(_0x1126('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1126('0xa'));var _=require(_0x1126('0xb'));var squel=require('squel');var crypto=require(_0x1126('0xc'));var jsforce=require(_0x1126('0xd'));var deskjs=require(_0x1126('0xe'));var toCsv=require(_0x1126('0xf'));var querystring=require(_0x1126('0x10'));var Papa=require('papaparse');var Redis=require(_0x1126('0x11'));var authService=require(_0x1126('0x12'));var qs=require(_0x1126('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1126('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x1126('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x1126('0x16'));var db=require(_0x1126('0x17'))['db'];function respondWithStatusCode(_0xd26a32,_0x273896){_0x273896=_0x273896||0xcc;return function(_0xca0355){if(_0xca0355){return _0xd26a32[_0x1126('0x18')](_0x273896);}return _0xd26a32[_0x1126('0x19')](_0x273896)[_0x1126('0x1a')]();};}function respondWithResult(_0x43850b,_0x53a8f0){_0x53a8f0=_0x53a8f0||0xc8;return function(_0x5de9a7){if(_0x5de9a7){return _0x43850b[_0x1126('0x19')](_0x53a8f0)[_0x1126('0x1b')](_0x5de9a7);}};}function respondWithFilteredResult(_0x279455,_0x4be0c6){return function(_0x45149c){if(_0x45149c){var _0x4794a7=typeof _0x4be0c6[_0x1126('0x1c')]===_0x1126('0x1d')&&typeof _0x4be0c6[_0x1126('0x1e')]==='undefined';var _0x245cd7=_0x45149c[_0x1126('0x1f')];var _0x4a7b49=_0x4794a7?0x0:_0x4be0c6['offset'];var _0x22ae0b=_0x4794a7?_0x45149c[_0x1126('0x1f')]:_0x4be0c6['offset']+_0x4be0c6['limit'];var _0x4564c0;if(_0x22ae0b>=_0x245cd7){_0x22ae0b=_0x245cd7;_0x4564c0=0xc8;}else{_0x4564c0=0xce;}_0x279455['status'](_0x4564c0);return _0x279455[_0x1126('0x20')](_0x1126('0x21'),_0x4a7b49+'-'+_0x22ae0b+'/'+_0x245cd7)[_0x1126('0x1b')](_0x45149c);}return null;};}function patchUpdates(_0x54400a){return function(_0x2a08ba){try{jsonpatch['apply'](_0x2a08ba,_0x54400a,!![]);}catch(_0x56efeb){return BPromise[_0x1126('0x22')](_0x56efeb);}return _0x2a08ba[_0x1126('0x23')]();};}function saveUpdates(_0x25b24b,_0x36d254){return function(_0x526ca1){if(_0x526ca1){return _0x526ca1[_0x1126('0x24')](_0x25b24b)[_0x1126('0x25')](function(_0x48a08d){return _0x48a08d;});}return null;};}function removeEntity(_0x2175fa,_0x59cd8e){return function(_0x529dd9){if(_0x529dd9){return _0x529dd9['destroy']()[_0x1126('0x25')](function(){_0x2175fa[_0x1126('0x19')](0xcc)[_0x1126('0x1a')]();});}};}function handleEntityNotFound(_0x34bcf1,_0x566c09){return function(_0x1b07a7){if(!_0x1b07a7){_0x34bcf1[_0x1126('0x18')](0x194);}return _0x1b07a7;};}function handleError(_0x38119d,_0x589725){_0x589725=_0x589725||0x1f4;return function(_0x35eec3){logger[_0x1126('0x26')](_0x35eec3[_0x1126('0x27')]);if(_0x35eec3['name']){delete _0x35eec3['name'];}_0x38119d[_0x1126('0x19')](_0x589725)[_0x1126('0x28')](_0x35eec3);};}exports['index']=function(_0x2fb797,_0x23d2bc){var _0x4a334a={},_0x3fa694={},_0x4bf807={'count':0x0,'rows':[]};var _0xc62460=_['map'](db[_0x1126('0x29')]['rawAttributes'],function(_0x378f4d){return{'name':_0x378f4d['fieldName'],'type':_0x378f4d['type']['key']};});_0x3fa694[_0x1126('0x2a')]=_[_0x1126('0x2b')](_0xc62460,_0x1126('0x2c'));_0x3fa694['query']=_[_0x1126('0x2d')](_0x2fb797[_0x1126('0x2e')]);_0x3fa694['filters']=_[_0x1126('0x2f')](_0x3fa694[_0x1126('0x2a')],_0x3fa694[_0x1126('0x2e')]);_0x4a334a[_0x1126('0x30')]=_['intersection'](_0x3fa694['model'],qs[_0x1126('0x31')](_0x2fb797[_0x1126('0x2e')][_0x1126('0x31')]));_0x4a334a[_0x1126('0x30')]=_0x4a334a['attributes'][_0x1126('0x32')]?_0x4a334a[_0x1126('0x30')]:_0x3fa694[_0x1126('0x2a')];if(!_0x2fb797[_0x1126('0x2e')][_0x1126('0x33')]('nolimit')){_0x4a334a[_0x1126('0x1e')]=qs[_0x1126('0x1e')](_0x2fb797[_0x1126('0x2e')][_0x1126('0x1e')]);_0x4a334a['offset']=qs['offset'](_0x2fb797[_0x1126('0x2e')][_0x1126('0x1c')]);}_0x4a334a['order']=qs[_0x1126('0x34')](_0x2fb797[_0x1126('0x2e')][_0x1126('0x34')]);_0x4a334a['where']=qs['filters'](_[_0x1126('0x35')](_0x2fb797[_0x1126('0x2e')],_0x3fa694[_0x1126('0x36')]),_0xc62460);if(_0x2fb797[_0x1126('0x2e')]['filter']){_0x4a334a[_0x1126('0x37')]=_['merge'](_0x4a334a[_0x1126('0x37')],{'$or':_[_0x1126('0x2b')](_0xc62460,function(_0xfa96e0){if(_0xfa96e0[_0x1126('0x38')]!==_0x1126('0x39')){var _0x5746f6={};_0x5746f6[_0xfa96e0[_0x1126('0x2c')]]={'$like':'%'+_0x2fb797[_0x1126('0x2e')][_0x1126('0x3a')]+'%'};return _0x5746f6;}})});}_0x4a334a=_[_0x1126('0x3b')]({},_0x4a334a,_0x2fb797[_0x1126('0x3c')]);var _0x3442b8={'where':_0x4a334a[_0x1126('0x37')]};return db['CmHopperFinal'][_0x1126('0x1f')](_0x3442b8)[_0x1126('0x25')](function(_0x227a6b){_0x4bf807[_0x1126('0x1f')]=_0x227a6b;if(_0x2fb797[_0x1126('0x2e')]['includeAll']){_0x4a334a['include']=[{'all':!![]}];}return db[_0x1126('0x29')][_0x1126('0x3d')](_0x4a334a);})[_0x1126('0x25')](function(_0x21c38e){_0x4bf807[_0x1126('0x3e')]=_0x21c38e;return _0x4bf807;})[_0x1126('0x25')](respondWithFilteredResult(_0x23d2bc,_0x4a334a))['catch'](handleError(_0x23d2bc,null));};exports['show']=function(_0x4cb1db,_0xb8054e){var _0x5d4194={'raw':!![],'where':{'id':_0x4cb1db[_0x1126('0x3f')]['id']}},_0xf84005={};_0xf84005[_0x1126('0x2a')]=_[_0x1126('0x2d')](db['CmHopperFinal']['rawAttributes']);_0xf84005[_0x1126('0x2e')]=_[_0x1126('0x2d')](_0x4cb1db[_0x1126('0x2e')]);_0xf84005['filters']=_[_0x1126('0x2f')](_0xf84005['model'],_0xf84005[_0x1126('0x2e')]);_0x5d4194['attributes']=_[_0x1126('0x2f')](_0xf84005[_0x1126('0x2a')],qs[_0x1126('0x31')](_0x4cb1db['query'][_0x1126('0x31')]));_0x5d4194[_0x1126('0x30')]=_0x5d4194[_0x1126('0x30')]['length']?_0x5d4194['attributes']:_0xf84005['model'];if(_0x4cb1db[_0x1126('0x2e')]['includeAll']){_0x5d4194[_0x1126('0x40')]=[{'all':!![]}];}_0x5d4194=_['merge']({},_0x5d4194,_0x4cb1db[_0x1126('0x3c')]);return db[_0x1126('0x29')][_0x1126('0x41')](_0x5d4194)[_0x1126('0x25')](handleEntityNotFound(_0xb8054e,null))[_0x1126('0x25')](respondWithResult(_0xb8054e,null))['catch'](handleError(_0xb8054e,null));};exports[_0x1126('0x42')]=function(_0x512f60,_0x5111d3){return db[_0x1126('0x29')][_0x1126('0x42')]()['then'](respondWithResult(_0x5111d3,null))[_0x1126('0x43')](handleError(_0x5111d3,null));};exports[_0x1126('0x24')]=function(_0x518e0a,_0x3e4eeb){if(_0x518e0a[_0x1126('0x44')][_0x1126('0x45')]){delete _0x518e0a['body'][_0x1126('0x45')];}return db[_0x1126('0x29')][_0x1126('0x41')]({'where':{'uniqueid':_0x518e0a[_0x1126('0x3f')]['id']}})[_0x1126('0x25')](handleEntityNotFound(_0x3e4eeb,null))[_0x1126('0x25')](saveUpdates(_0x518e0a[_0x1126('0x44')],null))[_0x1126('0x25')](respondWithResult(_0x3e4eeb,null))['catch'](handleError(_0x3e4eeb,null));};exports[_0x1126('0x46')]=function(_0x5a2287,_0x40168e,_0x2ad118){return db['CmHopperFinal']['findAll']({'raw':![],'where':{'VoiceQueueId':_0x5a2287[_0x1126('0x3f')]['id']},'attributes':[[db[_0x1126('0x47')]['fn'](_0x1126('0x48'),db['sequelize']['fn']('IF',db[_0x1126('0x47')][_0x1126('0x49')](_0x1126('0x4a')))),_0x1126('0x4b')],[db['sequelize']['fn'](_0x1126('0x48'),db[_0x1126('0x47')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x203,\x201,\x20null'))),'noAnswerContacts'],[db[_0x1126('0x47')]['fn'](_0x1126('0x48'),db['sequelize']['fn']('IF',db[_0x1126('0x47')][_0x1126('0x49')](_0x1126('0x4c')))),_0x1126('0x4d')],[db[_0x1126('0x47')]['fn']('COUNT',db[_0x1126('0x47')]['fn']('IF',db[_0x1126('0x47')]['literal'](_0x1126('0x4e')))),_0x1126('0x4f')],[db[_0x1126('0x47')]['fn'](_0x1126('0x48'),db[_0x1126('0x47')]['fn']('IF',db['sequelize'][_0x1126('0x49')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x1126('0x50')],[db[_0x1126('0x47')]['fn'](_0x1126('0x48'),db['sequelize']['fn']('IF',db[_0x1126('0x47')][_0x1126('0x49')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x1126('0x51')],[db[_0x1126('0x47')]['fn'](_0x1126('0x48'),db['sequelize']['fn']('IF',db[_0x1126('0x47')][_0x1126('0x49')](_0x1126('0x52')))),_0x1126('0x53')],[db[_0x1126('0x47')]['fn'](_0x1126('0x48'),db[_0x1126('0x47')]['fn']('IF',db[_0x1126('0x47')]['literal'](_0x1126('0x54')))),_0x1126('0x55')]]})[_0x1126('0x25')](handleEntityNotFound(_0x40168e,null))[_0x1126('0x25')](respondWithResult(_0x40168e,null))[_0x1126('0x43')](handleError(_0x40168e,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0xcc1a95,_0x315386,_0x5e0ea1){return db[_0x1126('0x29')]['findAll']({'raw':![],'where':{'CampaignId':_0xcc1a95[_0x1126('0x3f')]['id']},'attributes':[[db[_0x1126('0x47')]['fn']('COUNT',db[_0x1126('0x47')]['fn']('IF',db[_0x1126('0x47')][_0x1126('0x49')]('`state`\x20=\x200,\x201,\x20null'))),_0x1126('0x4b')],[db['sequelize']['fn']('COUNT',db[_0x1126('0x47')]['fn']('IF',db[_0x1126('0x47')][_0x1126('0x49')](_0x1126('0x56')))),_0x1126('0x57')],[db[_0x1126('0x47')]['fn'](_0x1126('0x48'),db['sequelize']['fn']('IF',db[_0x1126('0x47')][_0x1126('0x49')](_0x1126('0x4c')))),_0x1126('0x4d')],[db[_0x1126('0x47')]['fn'](_0x1126('0x48'),db['sequelize']['fn']('IF',db['sequelize'][_0x1126('0x49')](_0x1126('0x4e')))),'congestionContacts'],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x1126('0x47')][_0x1126('0x49')](_0x1126('0x58')))),'dropContacts'],[db[_0x1126('0x47')]['fn'](_0x1126('0x48'),db[_0x1126('0x47')]['fn']('IF',db[_0x1126('0x47')][_0x1126('0x49')](_0x1126('0x59')))),_0x1126('0x51')],[db['sequelize']['fn'](_0x1126('0x48'),db[_0x1126('0x47')]['fn']('IF',db[_0x1126('0x47')][_0x1126('0x49')](_0x1126('0x52')))),'reCallContacts'],[db['sequelize']['fn'](_0x1126('0x48'),db[_0x1126('0x47')]['fn']('IF',db['sequelize'][_0x1126('0x49')](_0x1126('0x54')))),_0x1126('0x55')]]})[_0x1126('0x25')](handleEntityNotFound(_0x315386,null))[_0x1126('0x25')](respondWithResult(_0x315386,null))[_0x1126('0x43')](handleError(_0x315386,null));};exports[_0x1126('0x5a')]=function(_0x247f12,_0xd20fbe,_0x3d5e15){return db[_0x1126('0x5b')][_0x1126('0x41')]({'where':{'id':_0x247f12[_0x1126('0x3f')]['id']}})['then'](handleEntityNotFound(_0xd20fbe,null))[_0x1126('0x25')](function(_0x274343){var _0x2b61ae;if(_0x274343){_0x2b61ae=squel['insert']()['into'](_0x1126('0x5c'))[_0x1126('0x5d')]([_0x1126('0x5e'),_0x1126('0x5f'),'ContactId','ListId','VoiceQueueId',_0x1126('0x60'),_0x1126('0x61')],squel[_0x1126('0x62')]()[_0x1126('0x63')]('ANY_VALUE(calleridnum)',_0x1126('0x5e'))['field'](_0x1126('0x64'),_0x1126('0x5f'))[_0x1126('0x63')](_0x1126('0x65'),_0x1126('0x66'))[_0x1126('0x63')](_0x1126('0x67'),'ListId')[_0x1126('0x63')]('ANY_VALUE(VoiceQueueId)',_0x1126('0x68'))[_0x1126('0x63')]('NOW()',_0x1126('0x60'))[_0x1126('0x63')]('NOW()',_0x1126('0x61'))[_0x1126('0x69')]('cm_hopper_final')['where'](_0x1126('0x6a'),_0x247f12[_0x1126('0x3f')]['id'][_0x1126('0x6b')]())['where']('state\x20=\x20?',_0x247f12['body'][_0x1126('0x6c')]['toString']())['where'](_0x1126('0x6d'))['where'](_0x1126('0x6e'),squel[_0x1126('0x62')]()['field'](_0x1126('0x5e'))[_0x1126('0x69')](_0x1126('0x5c'))[_0x1126('0x37')](_0x1126('0x6a'),_0x247f12['params']['id'][_0x1126('0x6b')]()))[_0x1126('0x37')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x1126('0x62')]()[_0x1126('0x63')](_0x1126('0x6f'))[_0x1126('0x69')](_0x1126('0x70'))[_0x1126('0x37')](_0x1126('0x6a'),_0x247f12[_0x1126('0x3f')]['id'][_0x1126('0x6b')]())[_0x1126('0x37')](_0x1126('0x71')))[_0x1126('0x72')](_0x1126('0x66')))[_0x1126('0x6b')]();return db[_0x1126('0x47')][_0x1126('0x2e')](_0x2b61ae);}return[];})['then'](respondWithResult(_0xd20fbe,null))[_0x1126('0x43')](handleError(_0xd20fbe,null));};exports[_0x1126('0x73')]=function(_0x33cccf,_0x1483f4,_0x3be5bf){return db['Campaign'][_0x1126('0x41')]({'where':{'id':_0x33cccf['params']['id']}})['then'](handleEntityNotFound(_0x1483f4,null))[_0x1126('0x25')](function(_0x2b1884){var _0x55f366;if(_0x2b1884){_0x55f366=squel['insert']()[_0x1126('0x74')](_0x1126('0x5c'))[_0x1126('0x5d')]([_0x1126('0x5e'),_0x1126('0x5f'),_0x1126('0x66'),_0x1126('0x75'),_0x1126('0x76'),_0x1126('0x60'),'updatedAt'],squel[_0x1126('0x62')]()[_0x1126('0x63')](_0x1126('0x77'),_0x1126('0x5e'))[_0x1126('0x63')](_0x1126('0x64'),'scheduledAt')[_0x1126('0x63')](_0x1126('0x65'),_0x1126('0x66'))[_0x1126('0x63')](_0x1126('0x67'),_0x1126('0x75'))[_0x1126('0x63')](_0x1126('0x78'),_0x1126('0x76'))[_0x1126('0x63')]('NOW()','createdAt')[_0x1126('0x63')]('NOW()',_0x1126('0x61'))['from'](_0x1126('0x70'))['where'](_0x1126('0x79'),_0x33cccf['params']['id']['toString']())['where'](_0x1126('0x7a'),_0x33cccf[_0x1126('0x44')]['state']['toString']())[_0x1126('0x37')](_0x1126('0x6d'))[_0x1126('0x37')]('calleridnum\x20NOT\x20IN\x20(?)',squel['select']()[_0x1126('0x63')]('phone')[_0x1126('0x69')](_0x1126('0x5c'))[_0x1126('0x37')](_0x1126('0x79'),_0x33cccf[_0x1126('0x3f')]['id']['toString']()))['where'](_0x1126('0x6e'),squel[_0x1126('0x62')]()[_0x1126('0x63')](_0x1126('0x6f'))[_0x1126('0x69')](_0x1126('0x70'))[_0x1126('0x37')](_0x1126('0x79'),_0x33cccf[_0x1126('0x3f')]['id'][_0x1126('0x6b')]())[_0x1126('0x37')]('state\x20=\x204'))[_0x1126('0x72')]('ContactId'))[_0x1126('0x6b')]();return db['sequelize'][_0x1126('0x2e')](_0x55f366);}return[];})[_0x1126('0x25')](respondWithResult(_0x1483f4,null))[_0x1126('0x43')](handleError(_0x1483f4,null));};exports[_0x1126('0x7b')]=function(_0x59c04b,_0x429183,_0x834360){return db['CmHopper']['findOne']({'where':{'VoiceQueueId':_0x59c04b[_0x1126('0x44')][_0x1126('0x68')],'CampaignId':_0x59c04b[_0x1126('0x44')]['CampaignId'],'ContactId':_0x59c04b[_0x1126('0x44')]['ContactId']}})[_0x1126('0x25')](handleEntityNotFound(_0x429183,null))[_0x1126('0x25')](function(_0x4d6bb2){if(_0x4d6bb2){return _0x4d6bb2;}return null;})[_0x1126('0x25')](respondWithResult(_0x429183,null))[_0x1126('0x43')](handleError(_0x429183,null));}; \ No newline at end of file +var _0x2ef3=['params','keys','describe','uniqueid','body','find','countContactsQueueCampaignHopperFinal','sequelize','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','COUNT','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','countContactsIvrCampaignHopperFinal','noAnswerContacts','busyContacts','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','answeringMachine','VoiceQueue','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','createdAt','updatedAt','field','NOW()','VoiceQueueId','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','select','from','calleridnum','state\x20=\x204','group','Campaign','ListId','CampaignId','ANY_VALUE(calleridnum)','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','CampaignId\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','CmHopper','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','pick','filter','merge','options','CmHopperFinal','then','includeAll','include','findAll','catch','show'];(function(_0x25e53c,_0x31b73c){var _0x53a78a=function(_0x1224d8){while(--_0x1224d8){_0x25e53c['push'](_0x25e53c['shift']());}};_0x53a78a(++_0x31b73c);}(_0x2ef3,0xba));var _0x32ef=function(_0x373afe,_0x4841f3){_0x373afe=_0x373afe-0x0;var _0x4decea=_0x2ef3[_0x373afe];return _0x4decea;};'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['CmHopperFinal'][_0x32ef('0x2a')],function(_0x22bf86){return{'name':_0x22bf86[_0x32ef('0x2b')],'type':_0x22bf86[_0x32ef('0x2c')][_0x32ef('0x2d')]};});_0x12de1a[_0x32ef('0x2e')]=_[_0x32ef('0x29')](_0x30b250,'name');_0x12de1a[_0x32ef('0x2f')]=_['keys'](_0xd65fde[_0x32ef('0x2f')]);_0x12de1a[_0x32ef('0x30')]=_['intersection'](_0x12de1a[_0x32ef('0x2e')],_0x12de1a[_0x32ef('0x2f')]);_0x5a04cd[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0x12de1a[_0x32ef('0x2e')],qs['fields'](_0xd65fde['query'][_0x32ef('0x33')]));_0x5a04cd['attributes']=_0x5a04cd[_0x32ef('0x31')][_0x32ef('0x34')]?_0x5a04cd[_0x32ef('0x31')]:_0x12de1a[_0x32ef('0x2e')];if(!_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x35')]('nolimit')){_0x5a04cd['limit']=qs['limit'](_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x1d')]);_0x5a04cd[_0x32ef('0x1b')]=qs['offset'](_0xd65fde['query'][_0x32ef('0x1b')]);}_0x5a04cd[_0x32ef('0x36')]=qs[_0x32ef('0x37')](_0xd65fde['query']['sort']);_0x5a04cd[_0x32ef('0x38')]=qs[_0x32ef('0x30')](_[_0x32ef('0x39')](_0xd65fde[_0x32ef('0x2f')],_0x12de1a[_0x32ef('0x30')]),_0x30b250);if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]){_0x5a04cd[_0x32ef('0x38')]=_[_0x32ef('0x3b')](_0x5a04cd['where'],{'$or':_[_0x32ef('0x29')](_0x30b250,function(_0x36e374){if(_0x36e374[_0x32ef('0x2c')]!=='VIRTUAL'){var _0x365125={};_0x365125[_0x36e374[_0x32ef('0x27')]]={'$like':'%'+_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]+'%'};return _0x365125;}})});}_0x5a04cd=_[_0x32ef('0x3b')]({},_0x5a04cd,_0xd65fde[_0x32ef('0x3c')]);var _0x256c40={'where':_0x5a04cd[_0x32ef('0x38')]};return db[_0x32ef('0x3d')][_0x32ef('0x1e')](_0x256c40)[_0x32ef('0x3e')](function(_0x4615b4){_0x3c569d['count']=_0x4615b4;if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3f')]){_0x5a04cd[_0x32ef('0x40')]=[{'all':!![]}];}return db[_0x32ef('0x3d')][_0x32ef('0x41')](_0x5a04cd);})[_0x32ef('0x3e')](function(_0x3c0e44){_0x3c569d['rows']=_0x3c0e44;return _0x3c569d;})['then'](respondWithFilteredResult(_0x2f5d06,_0x5a04cd))[_0x32ef('0x42')](handleError(_0x2f5d06,null));};exports[_0x32ef('0x43')]=function(_0x2a33dd,_0x765c63){var _0x5dca14={'raw':!![],'where':{'id':_0x2a33dd[_0x32ef('0x44')]['id']}},_0x2901a1={};_0x2901a1['model']=_[_0x32ef('0x45')](db['CmHopperFinal'][_0x32ef('0x2a')]);_0x2901a1[_0x32ef('0x2f')]=_[_0x32ef('0x45')](_0x2a33dd[_0x32ef('0x2f')]);_0x2901a1[_0x32ef('0x30')]=_[_0x32ef('0x32')](_0x2901a1[_0x32ef('0x2e')],_0x2901a1[_0x32ef('0x2f')]);_0x5dca14[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0x2901a1['model'],qs[_0x32ef('0x33')](_0x2a33dd['query'][_0x32ef('0x33')]));_0x5dca14[_0x32ef('0x31')]=_0x5dca14[_0x32ef('0x31')]['length']?_0x5dca14[_0x32ef('0x31')]:_0x2901a1[_0x32ef('0x2e')];if(_0x2a33dd[_0x32ef('0x2f')][_0x32ef('0x3f')]){_0x5dca14[_0x32ef('0x40')]=[{'all':!![]}];}_0x5dca14=_[_0x32ef('0x3b')]({},_0x5dca14,_0x2a33dd[_0x32ef('0x3c')]);return db['CmHopperFinal']['find'](_0x5dca14)[_0x32ef('0x3e')](handleEntityNotFound(_0x765c63,null))[_0x32ef('0x3e')](respondWithResult(_0x765c63,null))[_0x32ef('0x42')](handleError(_0x765c63,null));};exports[_0x32ef('0x46')]=function(_0x209361,_0xd67dc9){return db[_0x32ef('0x3d')][_0x32ef('0x46')]()[_0x32ef('0x3e')](respondWithResult(_0xd67dc9,null))[_0x32ef('0x42')](handleError(_0xd67dc9,null));};exports[_0x32ef('0x24')]=function(_0x30ad49,_0x36a65c){if(_0x30ad49['body'][_0x32ef('0x47')]){delete _0x30ad49[_0x32ef('0x48')][_0x32ef('0x47')];}return db[_0x32ef('0x3d')][_0x32ef('0x49')]({'where':{'uniqueid':_0x30ad49[_0x32ef('0x44')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x36a65c,null))[_0x32ef('0x3e')](saveUpdates(_0x30ad49[_0x32ef('0x48')],null))[_0x32ef('0x3e')](respondWithResult(_0x36a65c,null))[_0x32ef('0x42')](handleError(_0x36a65c,null));};exports[_0x32ef('0x4a')]=function(_0x272377,_0x326445,_0x307ac8){return db[_0x32ef('0x3d')][_0x32ef('0x41')]({'raw':![],'where':{'VoiceQueueId':_0x272377[_0x32ef('0x44')]['id']},'attributes':[[db['sequelize']['fn']('COUNT',db[_0x32ef('0x4b')]['fn']('IF',db[_0x32ef('0x4b')][_0x32ef('0x4c')](_0x32ef('0x4d')))),_0x32ef('0x4e')],[db[_0x32ef('0x4b')]['fn'](_0x32ef('0x4f'),db[_0x32ef('0x4b')]['fn']('IF',db[_0x32ef('0x4b')][_0x32ef('0x4c')](_0x32ef('0x50')))),'noAnswerContacts'],[db[_0x32ef('0x4b')]['fn'](_0x32ef('0x4f'),db[_0x32ef('0x4b')]['fn']('IF',db[_0x32ef('0x4b')][_0x32ef('0x4c')](_0x32ef('0x51')))),'busyContacts'],[db[_0x32ef('0x4b')]['fn'](_0x32ef('0x4f'),db[_0x32ef('0x4b')]['fn']('IF',db['sequelize'][_0x32ef('0x4c')]('`state`\x20=\x208,\x201,\x20null'))),_0x32ef('0x52')],[db[_0x32ef('0x4b')]['fn']('COUNT',db[_0x32ef('0x4b')]['fn']('IF',db['sequelize'][_0x32ef('0x4c')](_0x32ef('0x53')))),_0x32ef('0x54')],[db[_0x32ef('0x4b')]['fn'](_0x32ef('0x4f'),db[_0x32ef('0x4b')]['fn']('IF',db[_0x32ef('0x4b')]['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x32ef('0x55')],[db['sequelize']['fn']('COUNT',db[_0x32ef('0x4b')]['fn']('IF',db[_0x32ef('0x4b')][_0x32ef('0x4c')](_0x32ef('0x56')))),_0x32ef('0x57')],[db[_0x32ef('0x4b')]['fn'](_0x32ef('0x4f'),db[_0x32ef('0x4b')]['fn']('IF',db[_0x32ef('0x4b')][_0x32ef('0x4c')]('`state`\x20=\x2019,\x201,\x20null'))),'answeringMachine']]})[_0x32ef('0x3e')](handleEntityNotFound(_0x326445,null))[_0x32ef('0x3e')](respondWithResult(_0x326445,null))['catch'](handleError(_0x326445,null));};exports[_0x32ef('0x58')]=function(_0x12e1ef,_0x2b5703,_0x49c245){return db[_0x32ef('0x3d')][_0x32ef('0x41')]({'raw':![],'where':{'CampaignId':_0x12e1ef[_0x32ef('0x44')]['id']},'attributes':[[db['sequelize']['fn']('COUNT',db[_0x32ef('0x4b')]['fn']('IF',db['sequelize'][_0x32ef('0x4c')]('`state`\x20=\x200,\x201,\x20null'))),'noSuchContacts'],[db[_0x32ef('0x4b')]['fn'](_0x32ef('0x4f'),db[_0x32ef('0x4b')]['fn']('IF',db['sequelize'][_0x32ef('0x4c')](_0x32ef('0x50')))),_0x32ef('0x59')],[db['sequelize']['fn'](_0x32ef('0x4f'),db[_0x32ef('0x4b')]['fn']('IF',db['sequelize']['literal'](_0x32ef('0x51')))),_0x32ef('0x5a')],[db[_0x32ef('0x4b')]['fn'](_0x32ef('0x4f'),db[_0x32ef('0x4b')]['fn']('IF',db[_0x32ef('0x4b')]['literal'](_0x32ef('0x5b')))),_0x32ef('0x52')],[db[_0x32ef('0x4b')]['fn'](_0x32ef('0x4f'),db[_0x32ef('0x4b')]['fn']('IF',db[_0x32ef('0x4b')][_0x32ef('0x4c')](_0x32ef('0x53')))),_0x32ef('0x54')],[db['sequelize']['fn'](_0x32ef('0x4f'),db[_0x32ef('0x4b')]['fn']('IF',db[_0x32ef('0x4b')][_0x32ef('0x4c')](_0x32ef('0x5c')))),'abandonedContacts'],[db['sequelize']['fn'](_0x32ef('0x4f'),db[_0x32ef('0x4b')]['fn']('IF',db[_0x32ef('0x4b')][_0x32ef('0x4c')](_0x32ef('0x56')))),'reCallContacts'],[db[_0x32ef('0x4b')]['fn']('COUNT',db[_0x32ef('0x4b')]['fn']('IF',db[_0x32ef('0x4b')]['literal']('`state`\x20=\x2019,\x201,\x20null'))),_0x32ef('0x5d')]]})[_0x32ef('0x3e')](handleEntityNotFound(_0x2b5703,null))[_0x32ef('0x3e')](respondWithResult(_0x2b5703,null))['catch'](handleError(_0x2b5703,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x3b4a8e,_0x5edd29,_0x7d2c3a){return db[_0x32ef('0x5e')]['find']({'where':{'id':_0x3b4a8e[_0x32ef('0x44')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x5edd29,null))[_0x32ef('0x3e')](function(_0xd7a78){var _0x9df27c;if(_0xd7a78){_0x9df27c=squel[_0x32ef('0x5f')]()[_0x32ef('0x60')](_0x32ef('0x61'))[_0x32ef('0x62')]([_0x32ef('0x63'),_0x32ef('0x64'),_0x32ef('0x65'),'ListId','VoiceQueueId',_0x32ef('0x66'),_0x32ef('0x67')],squel['select']()[_0x32ef('0x68')]('ANY_VALUE(calleridnum)',_0x32ef('0x63'))[_0x32ef('0x68')](_0x32ef('0x69'),'scheduledAt')[_0x32ef('0x68')]('ANY_VALUE(ContactId)',_0x32ef('0x65'))[_0x32ef('0x68')]('ANY_VALUE(ListId)','ListId')[_0x32ef('0x68')]('ANY_VALUE(VoiceQueueId)',_0x32ef('0x6a'))['field'](_0x32ef('0x69'),_0x32ef('0x66'))[_0x32ef('0x68')]('NOW()','updatedAt')['from'](_0x32ef('0x6b'))['where'](_0x32ef('0x6c'),_0x3b4a8e[_0x32ef('0x44')]['id'][_0x32ef('0x6d')]())[_0x32ef('0x38')](_0x32ef('0x6e'),_0x3b4a8e[_0x32ef('0x48')]['state'][_0x32ef('0x6d')]())['where']('calleridnum\x20IS\x20NOT\x20NULL')[_0x32ef('0x38')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x32ef('0x6f')]()[_0x32ef('0x68')]('phone')[_0x32ef('0x70')](_0x32ef('0x61'))[_0x32ef('0x38')](_0x32ef('0x6c'),_0x3b4a8e[_0x32ef('0x44')]['id'][_0x32ef('0x6d')]()))['where']('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x32ef('0x6f')]()['field'](_0x32ef('0x71'))[_0x32ef('0x70')](_0x32ef('0x6b'))[_0x32ef('0x38')](_0x32ef('0x6c'),_0x3b4a8e[_0x32ef('0x44')]['id']['toString']())[_0x32ef('0x38')](_0x32ef('0x72')))[_0x32ef('0x73')](_0x32ef('0x65')))[_0x32ef('0x6d')]();return db['sequelize']['query'](_0x9df27c);}return[];})[_0x32ef('0x3e')](respondWithResult(_0x5edd29,null))[_0x32ef('0x42')](handleError(_0x5edd29,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x211fb1,_0x2e333d,_0x338578){return db[_0x32ef('0x74')][_0x32ef('0x49')]({'where':{'id':_0x211fb1[_0x32ef('0x44')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x2e333d,null))[_0x32ef('0x3e')](function(_0x353641){var _0x54e65d;if(_0x353641){_0x54e65d=squel[_0x32ef('0x5f')]()[_0x32ef('0x60')]('cm_hopper')[_0x32ef('0x62')](['phone',_0x32ef('0x64'),'ContactId',_0x32ef('0x75'),_0x32ef('0x76'),_0x32ef('0x66'),_0x32ef('0x67')],squel['select']()[_0x32ef('0x68')](_0x32ef('0x77'),_0x32ef('0x63'))['field']('NOW()','scheduledAt')[_0x32ef('0x68')](_0x32ef('0x78'),_0x32ef('0x65'))[_0x32ef('0x68')](_0x32ef('0x79'),'ListId')[_0x32ef('0x68')]('ANY_VALUE(CampaignId)',_0x32ef('0x76'))[_0x32ef('0x68')](_0x32ef('0x69'),'createdAt')[_0x32ef('0x68')](_0x32ef('0x69'),_0x32ef('0x67'))[_0x32ef('0x70')](_0x32ef('0x6b'))['where'](_0x32ef('0x7a'),_0x211fb1['params']['id'][_0x32ef('0x6d')]())[_0x32ef('0x38')]('state\x20=\x20?',_0x211fb1['body'][_0x32ef('0x7b')][_0x32ef('0x6d')]())[_0x32ef('0x38')](_0x32ef('0x7c'))['where'](_0x32ef('0x7d'),squel['select']()['field'](_0x32ef('0x63'))['from'](_0x32ef('0x61'))[_0x32ef('0x38')](_0x32ef('0x7a'),_0x211fb1['params']['id']['toString']()))[_0x32ef('0x38')](_0x32ef('0x7d'),squel[_0x32ef('0x6f')]()[_0x32ef('0x68')](_0x32ef('0x71'))[_0x32ef('0x70')](_0x32ef('0x6b'))['where'](_0x32ef('0x7a'),_0x211fb1[_0x32ef('0x44')]['id'][_0x32ef('0x6d')]())[_0x32ef('0x38')]('state\x20=\x204'))['group'](_0x32ef('0x65')))['toString']();return db[_0x32ef('0x4b')][_0x32ef('0x2f')](_0x54e65d);}return[];})['then'](respondWithResult(_0x2e333d,null))['catch'](handleError(_0x2e333d,null));};exports['checkContactHopper']=function(_0x201675,_0x33f6c3,_0xa53375){return db[_0x32ef('0x7e')]['findOne']({'where':{'VoiceQueueId':_0x201675[_0x32ef('0x48')][_0x32ef('0x6a')],'CampaignId':_0x201675[_0x32ef('0x48')]['CampaignId'],'ContactId':_0x201675[_0x32ef('0x48')]['ContactId']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x33f6c3,null))[_0x32ef('0x3e')](function(_0x5f4890){if(_0x5f4890){return _0x5f4890;}return null;})['then'](respondWithResult(_0x33f6c3,null))[_0x32ef('0x42')](handleError(_0x33f6c3,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 5b55437..3a1efb4 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 _0x14e4=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./cmHopperFinal.attributes','exports','define','CmHopperFinal','calleridnum','uniqueid'];(function(_0x15bae1,_0x5b6b10){var _0x30b043=function(_0x4c9607){while(--_0x4c9607){_0x15bae1['push'](_0x15bae1['shift']());}};_0x30b043(++_0x5b6b10);}(_0x14e4,0x11d));var _0x414e=function(_0x3b7c8b,_0x2d4027){_0x3b7c8b=_0x3b7c8b-0x0;var _0x5055ff=_0x14e4[_0x3b7c8b];return _0x5055ff;};'use strict';var _=require(_0x414e('0x0'));var util=require(_0x414e('0x1'));var logger=require(_0x414e('0x2'))(_0x414e('0x3'));var moment=require(_0x414e('0x4'));var BPromise=require(_0x414e('0x5'));var rp=require(_0x414e('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x414e('0x7'));var config=require(_0x414e('0x8'));var attributes=require(_0x414e('0x9'));module[_0x414e('0xa')]=function(_0x5bba41,_0x2a7b84){return _0x5bba41[_0x414e('0xb')](_0x414e('0xc'),attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':_0x414e('0xd'),'fields':[_0x414e('0xd')]},{'name':_0x414e('0xe'),'fields':[_0x414e('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8442=['util','../../config/logger','request-promise','rimraf','../../config/environment','exports','define','cm_hopper_final','calleridnum','uniqueid','lodash'];(function(_0x223aef,_0x166283){var _0x2c4b17=function(_0x385c10){while(--_0x385c10){_0x223aef['push'](_0x223aef['shift']());}};_0x2c4b17(++_0x166283);}(_0x8442,0xfc));var _0x2844=function(_0x4a5668,_0x14c9a7){_0x4a5668=_0x4a5668-0x0;var _0x5ce0b3=_0x8442[_0x4a5668];return _0x5ce0b3;};'use strict';var _=require(_0x2844('0x0'));var util=require(_0x2844('0x1'));var logger=require(_0x2844('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2844('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2844('0x4'));var config=require(_0x2844('0x5'));var attributes=require('./cmHopperFinal.attributes');module[_0x2844('0x6')]=function(_0x20c428,_0x16a73a){return _0x20c428[_0x2844('0x7')]('CmHopperFinal',attributes,{'tableName':_0x2844('0x8'),'paranoid':![],'indexes':[{'name':_0x2844('0x9'),'fields':[_0x2844('0x9')]},{'name':_0x2844('0xa'),'fields':[_0x2844('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index bb4e8b4..4792c79 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(_0x4b512b,_0x599ece){var _0x2d4fb2=function(_0x554ea6){while(--_0x554ea6){_0x4b512b['push'](_0x4b512b['shift']());}};_0x2d4fb2(++_0x599ece);}(_0xb10b,0x12a));var _0xbb10=function(_0x43cba5,_0x4a2f83){_0x43cba5=_0x43cba5-0x0;var _0x359d1a=_0xb10b[_0x43cba5];return _0x359d1a;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file +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(_0x355ccb,_0x28f17e){var _0x3085a4=function(_0x1e7cc0){while(--_0x1e7cc0){_0x355ccb['push'](_0x355ccb['shift']());}};_0x3085a4(++_0x28f17e);}(_0xb10b,0x12a));var _0xbb10=function(_0x3f807d,_0x32a3b1){_0x3f807d=_0x3f807d-0x0;var _0x45ad62=_0xb10b[_0x3f807d];return _0x45ad62;};'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 970475d..5b16c4d 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 _0xb728=['countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','/voice/campaign/moveContacts/:id','checkContactHopper','put','update','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/voice/queue/countAttributes/:id'];(function(_0x1e6e48,_0x560970){var _0x2bba7f=function(_0x2bf481){while(--_0x2bf481){_0x1e6e48['push'](_0x1e6e48['shift']());}};_0x2bba7f(++_0x560970);}(_0xb728,0xe2));var _0x8b72=function(_0x3e83b8,_0x48e291){_0x3e83b8=_0x3e83b8-0x0;var _0x834930=_0xb728[_0x3e83b8];return _0x834930;};'use strict';var multer=require(_0x8b72('0x0'));var util=require(_0x8b72('0x1'));var path=require(_0x8b72('0x2'));var timeout=require(_0x8b72('0x3'));var express=require('express');var router=express[_0x8b72('0x4')]();var fs_extra=require(_0x8b72('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8b72('0x6'));var config=require(_0x8b72('0x7'));var controller=require(_0x8b72('0x8'));router[_0x8b72('0x9')]('/',auth[_0x8b72('0xa')](),controller[_0x8b72('0xb')]);router[_0x8b72('0x9')](_0x8b72('0xc'),auth[_0x8b72('0xa')](),controller[_0x8b72('0xd')]);router['get'](_0x8b72('0xe'),auth[_0x8b72('0xa')](),controller[_0x8b72('0xf')]);router[_0x8b72('0x9')](_0x8b72('0x10'),auth[_0x8b72('0xa')](),controller[_0x8b72('0x11')]);router[_0x8b72('0x9')](_0x8b72('0x12'),auth[_0x8b72('0xa')](),controller[_0x8b72('0x13')]);router[_0x8b72('0x14')](_0x8b72('0x15'),auth[_0x8b72('0xa')](),controller['moveContactsQueueCampaignHopperFinal']);router['post'](_0x8b72('0x16'),auth[_0x8b72('0xa')](),controller['moveContactsIvrCampaignHopperFinal']);router[_0x8b72('0x14')]('/checkContactHopper',auth[_0x8b72('0xa')](),controller[_0x8b72('0x17')]);router[_0x8b72('0x18')]('/:id',auth[_0x8b72('0xa')](),controller[_0x8b72('0x19')]);module[_0x8b72('0x1a')]=router; \ No newline at end of file +var _0x3e58=['../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','describe','/:id','countContactsQueueCampaignHopperFinal','countContactsIvrCampaignHopperFinal','post','/voice/campaign/moveContacts/:id','checkContactHopper','put','update','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x245a1b,_0x4ed794){var _0x2a9438=function(_0x45f077){while(--_0x45f077){_0x245a1b['push'](_0x245a1b['shift']());}};_0x2a9438(++_0x4ed794);}(_0x3e58,0x1dc));var _0x83e5=function(_0x5de214,_0x107e9d){_0x5de214=_0x5de214-0x0;var _0x4df627=_0x3e58[_0x5de214];return _0x4df627;};'use strict';var multer=require(_0x83e5('0x0'));var util=require(_0x83e5('0x1'));var path=require(_0x83e5('0x2'));var timeout=require('connect-timeout');var express=require(_0x83e5('0x3'));var router=express[_0x83e5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x83e5('0x5'));var interaction=require(_0x83e5('0x6'));var config=require(_0x83e5('0x7'));var controller=require(_0x83e5('0x8'));router[_0x83e5('0x9')]('/',auth[_0x83e5('0xa')](),controller['index']);router[_0x83e5('0x9')]('/describe',auth[_0x83e5('0xa')](),controller[_0x83e5('0xb')]);router[_0x83e5('0x9')](_0x83e5('0xc'),auth[_0x83e5('0xa')](),controller['show']);router[_0x83e5('0x9')]('/voice/queue/countAttributes/:id',auth['isAuthenticated'](),controller[_0x83e5('0xd')]);router[_0x83e5('0x9')]('/campaign/countAttributes/:id',auth['isAuthenticated'](),controller[_0x83e5('0xe')]);router[_0x83e5('0xf')]('/voice/queue/moveContacts/:id',auth[_0x83e5('0xa')](),controller['moveContactsQueueCampaignHopperFinal']);router[_0x83e5('0xf')](_0x83e5('0x10'),auth['isAuthenticated'](),controller['moveContactsIvrCampaignHopperFinal']);router['post']('/checkContactHopper',auth[_0x83e5('0xa')](),controller[_0x83e5('0x11')]);router[_0x83e5('0x12')]('/:id',auth[_0x83e5('0xa')](),controller[_0x83e5('0x13')]);module[_0x83e5('0x14')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 9e7b627..591db55 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 _0x3c50=['BOOLEAN','sequelize','INTEGER','DATE','STRING'];(function(_0x42179f,_0x421858){var _0x3b3ccd=function(_0x3e45a4){while(--_0x3e45a4){_0x42179f['push'](_0x42179f['shift']());}};_0x3b3ccd(++_0x421858);}(_0x3c50,0x132));var _0x03c5=function(_0x4477c9,_0x14b3cb){_0x4477c9=_0x4477c9-0x0;var _0x2bf7b3=_0x3c50[_0x4477c9];return _0x2bf7b3;};'use strict';var Sequelize=require(_0x03c5('0x0'));module['exports']={'state':{'type':Sequelize[_0x03c5('0x1')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x03c5('0x2')]},'countbusyretry':{'type':Sequelize[_0x03c5('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x03c5('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x03c5('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x03c5('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x03c5('0x3')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x03c5('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x03c5('0x3')]},'starttime':{'type':Sequelize[_0x03c5('0x2')]},'responsetime':{'type':Sequelize[_0x03c5('0x2')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x03c5('0x2')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x03c5('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x03c5('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x03c5('0x3')]},'campaigntype':{'type':Sequelize[_0x03c5('0x3')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x03c5('0x3')]},'amd':{'type':Sequelize[_0x03c5('0x4')],'defaultValue':![]},'fax':{'type':Sequelize[_0x03c5('0x4')],'defaultValue':![]},'callback':{'type':Sequelize[_0x03c5('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x03c5('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x03c5('0x2')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize[_0x03c5('0x2')]},'edited':{'type':Sequelize[_0x03c5('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x03c5('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x03c5('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x03c5('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x03c5('0x1')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x682b=['BOOLEAN','sequelize','exports','STRING','INTEGER','DATE'];(function(_0x322682,_0x343b96){var _0x239466=function(_0x4382a6){while(--_0x4382a6){_0x322682['push'](_0x322682['shift']());}};_0x239466(++_0x343b96);}(_0x682b,0x1e1));var _0xb682=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0x682b[_0x36eaaa];return _0x461349;};'use strict';var Sequelize=require(_0xb682('0x0'));module[_0xb682('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0xb682('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0xb682('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xb682('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xb682('0x2')]},'originatecalleridnum':{'type':Sequelize[_0xb682('0x2')]},'originatecalleridname':{'type':Sequelize[_0xb682('0x2')]},'calleridnum':{'type':Sequelize[_0xb682('0x2')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xb682('0x4')]},'responsetime':{'type':Sequelize[_0xb682('0x4')]},'answertime':{'type':Sequelize[_0xb682('0x4')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xb682('0x4')]},'ringtime':{'type':Sequelize[_0xb682('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xb682('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0xb682('0x2')]},'campaigntype':{'type':Sequelize[_0xb682('0x2')]},'membername':{'type':Sequelize[_0xb682('0x2')]},'reason':{'type':Sequelize[_0xb682('0x2')]},'amd':{'type':Sequelize[_0xb682('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0xb682('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0xb682('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xb682('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xb682('0x4')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize[_0xb682('0x4')]},'edited':{'type':Sequelize[_0xb682('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xb682('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xb682('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xb682('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xb682('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xb682('0x3')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xb682('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 81fa1c7..97b7eb7 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 _0x3012=['name','send','index','CmHopperHistory','rawAttributes','type','key','map','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','keys','options','find','create','describe','body','uniqueid','eml-format','rimraf','fast-json-patch','request-promise','mustache','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','json','offset','undefined','count','limit','set','reject','save','update','then','destroy','error','stack'];(function(_0x555dc8,_0x466aa7){var _0xd41589=function(_0x528d22){while(--_0x528d22){_0x555dc8['push'](_0x555dc8['shift']());}};_0xd41589(++_0x466aa7);}(_0x3012,0x1e1));var _0x2301=function(_0x487ed4,_0x312026){_0x487ed4=_0x487ed4-0x0;var _0xa1193e=_0x3012[_0x487ed4];return _0xa1193e;};'use strict';var emlformat=require(_0x2301('0x0'));var rimraf=require(_0x2301('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2301('0x2'));var rp=require(_0x2301('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2301('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x2301('0x5'));var ejs=require(_0x2301('0x6'));var fs=require('fs');var fs_extra=require(_0x2301('0x7'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x2301('0x8'));var jsforce=require(_0x2301('0x9'));var deskjs=require(_0x2301('0xa'));var toCsv=require(_0x2301('0x5'));var querystring=require(_0x2301('0xb'));var Papa=require(_0x2301('0xc'));var Redis=require(_0x2301('0xd'));var authService=require(_0x2301('0xe'));var qs=require(_0x2301('0xf'));var as=require(_0x2301('0x10'));var hardwareService=require(_0x2301('0x11'));var logger=require(_0x2301('0x12'))(_0x2301('0x13'));var utils=require('../../config/utils');var config=require(_0x2301('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5111e0,_0x114e46){_0x114e46=_0x114e46||0xcc;return function(_0x35f69e){if(_0x35f69e){return _0x5111e0[_0x2301('0x15')](_0x114e46);}return _0x5111e0[_0x2301('0x16')](_0x114e46)[_0x2301('0x17')]();};}function respondWithResult(_0x141eb4,_0x359c69){_0x359c69=_0x359c69||0xc8;return function(_0x342c31){if(_0x342c31){return _0x141eb4[_0x2301('0x16')](_0x359c69)[_0x2301('0x18')](_0x342c31);}};}function respondWithFilteredResult(_0x4f7d89,_0x9cd73e){return function(_0x2362b4){if(_0x2362b4){var _0x1d06a5=typeof _0x9cd73e[_0x2301('0x19')]===_0x2301('0x1a')&&typeof _0x9cd73e['limit']===_0x2301('0x1a');var _0x2505c6=_0x2362b4[_0x2301('0x1b')];var _0x191318=_0x1d06a5?0x0:_0x9cd73e['offset'];var _0x2faf74=_0x1d06a5?_0x2362b4['count']:_0x9cd73e['offset']+_0x9cd73e[_0x2301('0x1c')];var _0x3ec712;if(_0x2faf74>=_0x2505c6){_0x2faf74=_0x2505c6;_0x3ec712=0xc8;}else{_0x3ec712=0xce;}_0x4f7d89[_0x2301('0x16')](_0x3ec712);return _0x4f7d89[_0x2301('0x1d')]('Content-Range',_0x191318+'-'+_0x2faf74+'/'+_0x2505c6)[_0x2301('0x18')](_0x2362b4);}return null;};}function patchUpdates(_0xbdfe31){return function(_0x246363){try{jsonpatch['apply'](_0x246363,_0xbdfe31,!![]);}catch(_0x35677a){return BPromise[_0x2301('0x1e')](_0x35677a);}return _0x246363[_0x2301('0x1f')]();};}function saveUpdates(_0x3b219a,_0x18fd0b){return function(_0x532891){if(_0x532891){return _0x532891[_0x2301('0x20')](_0x3b219a)[_0x2301('0x21')](function(_0x36fdf7){return _0x36fdf7;});}return null;};}function removeEntity(_0x55638f,_0x1feaf1){return function(_0x21d8e7){if(_0x21d8e7){return _0x21d8e7[_0x2301('0x22')]()[_0x2301('0x21')](function(){_0x55638f[_0x2301('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b9ba0,_0x2db20a){return function(_0x5a0bdc){if(!_0x5a0bdc){_0x2b9ba0[_0x2301('0x15')](0x194);}return _0x5a0bdc;};}function handleError(_0x1f6c46,_0x272a53){_0x272a53=_0x272a53||0x1f4;return function(_0x12bcae){logger[_0x2301('0x23')](_0x12bcae[_0x2301('0x24')]);if(_0x12bcae[_0x2301('0x25')]){delete _0x12bcae[_0x2301('0x25')];}_0x1f6c46['status'](_0x272a53)[_0x2301('0x26')](_0x12bcae);};}exports[_0x2301('0x27')]=function(_0x33d320,_0x4e0439){var _0x2c2e31={},_0x5078ad={},_0x597e12={'count':0x0,'rows':[]};var _0x163134=_['map'](db[_0x2301('0x28')][_0x2301('0x29')],function(_0x10d5b5){return{'name':_0x10d5b5['fieldName'],'type':_0x10d5b5[_0x2301('0x2a')][_0x2301('0x2b')]};});_0x5078ad['model']=_[_0x2301('0x2c')](_0x163134,'name');_0x5078ad[_0x2301('0x2d')]=_['keys'](_0x33d320[_0x2301('0x2d')]);_0x5078ad[_0x2301('0x2e')]=_['intersection'](_0x5078ad[_0x2301('0x2f')],_0x5078ad['query']);_0x2c2e31[_0x2301('0x30')]=_[_0x2301('0x31')](_0x5078ad[_0x2301('0x2f')],qs[_0x2301('0x32')](_0x33d320[_0x2301('0x2d')]['fields']));_0x2c2e31['attributes']=_0x2c2e31[_0x2301('0x30')][_0x2301('0x33')]?_0x2c2e31[_0x2301('0x30')]:_0x5078ad['model'];if(!_0x33d320[_0x2301('0x2d')][_0x2301('0x34')](_0x2301('0x35'))){_0x2c2e31[_0x2301('0x1c')]=qs['limit'](_0x33d320[_0x2301('0x2d')][_0x2301('0x1c')]);_0x2c2e31['offset']=qs['offset'](_0x33d320['query'][_0x2301('0x19')]);}_0x2c2e31[_0x2301('0x36')]=qs['sort'](_0x33d320['query'][_0x2301('0x37')]);_0x2c2e31[_0x2301('0x38')]=qs['filters'](_[_0x2301('0x39')](_0x33d320['query'],_0x5078ad[_0x2301('0x2e')]),_0x163134);if(_0x33d320[_0x2301('0x2d')][_0x2301('0x3a')]){_0x2c2e31['where']=_[_0x2301('0x3b')](_0x2c2e31[_0x2301('0x38')],{'$or':_['map'](_0x163134,function(_0x3c1a56){if(_0x3c1a56[_0x2301('0x2a')]!==_0x2301('0x3c')){var _0xafba9f={};_0xafba9f[_0x3c1a56[_0x2301('0x25')]]={'$like':'%'+_0x33d320[_0x2301('0x2d')][_0x2301('0x3a')]+'%'};return _0xafba9f;}})});}_0x2c2e31=_[_0x2301('0x3b')]({},_0x2c2e31,_0x33d320['options']);var _0x457e87={'where':_0x2c2e31[_0x2301('0x38')]};return db[_0x2301('0x28')][_0x2301('0x1b')](_0x457e87)[_0x2301('0x21')](function(_0x34034c){_0x597e12[_0x2301('0x1b')]=_0x34034c;if(_0x33d320['query'][_0x2301('0x3d')]){_0x2c2e31[_0x2301('0x3e')]=[{'all':!![]}];}return db[_0x2301('0x28')][_0x2301('0x3f')](_0x2c2e31);})['then'](function(_0x35eb25){_0x597e12['rows']=_0x35eb25;return _0x597e12;})[_0x2301('0x21')](respondWithFilteredResult(_0x4e0439,_0x2c2e31))[_0x2301('0x40')](handleError(_0x4e0439,null));};exports[_0x2301('0x41')]=function(_0x3df80e,_0x4795a3){var _0x28ae30={'raw':!![],'where':{'id':_0x3df80e[_0x2301('0x42')]['id']}},_0x33aaa2={};_0x33aaa2[_0x2301('0x2f')]=_[_0x2301('0x43')](db[_0x2301('0x28')][_0x2301('0x29')]);_0x33aaa2[_0x2301('0x2d')]=_[_0x2301('0x43')](_0x3df80e[_0x2301('0x2d')]);_0x33aaa2[_0x2301('0x2e')]=_[_0x2301('0x31')](_0x33aaa2[_0x2301('0x2f')],_0x33aaa2[_0x2301('0x2d')]);_0x28ae30[_0x2301('0x30')]=_['intersection'](_0x33aaa2[_0x2301('0x2f')],qs[_0x2301('0x32')](_0x3df80e[_0x2301('0x2d')]['fields']));_0x28ae30[_0x2301('0x30')]=_0x28ae30[_0x2301('0x30')][_0x2301('0x33')]?_0x28ae30[_0x2301('0x30')]:_0x33aaa2[_0x2301('0x2f')];if(_0x3df80e[_0x2301('0x2d')][_0x2301('0x3d')]){_0x28ae30[_0x2301('0x3e')]=[{'all':!![]}];}_0x28ae30=_[_0x2301('0x3b')]({},_0x28ae30,_0x3df80e[_0x2301('0x44')]);return db[_0x2301('0x28')][_0x2301('0x45')](_0x28ae30)[_0x2301('0x21')](handleEntityNotFound(_0x4795a3,null))[_0x2301('0x21')](respondWithResult(_0x4795a3,null))[_0x2301('0x40')](handleError(_0x4795a3,null));};exports[_0x2301('0x46')]=function(_0x1f38f0,_0x4f16fa){return db[_0x2301('0x28')]['create'](_0x1f38f0['body'],{})[_0x2301('0x21')](respondWithResult(_0x4f16fa,0xc9))[_0x2301('0x40')](handleError(_0x4f16fa,null));};exports['describe']=function(_0x1cef54,_0x49abdc){return db['CmHopperHistory'][_0x2301('0x47')]()[_0x2301('0x21')](respondWithResult(_0x49abdc,null))[_0x2301('0x40')](handleError(_0x49abdc,null));};exports[_0x2301('0x20')]=function(_0x551750,_0x40e164){if(_0x551750[_0x2301('0x48')][_0x2301('0x49')]){delete _0x551750['body'][_0x2301('0x49')];}return db[_0x2301('0x28')][_0x2301('0x45')]({'where':{'uniqueid':_0x551750[_0x2301('0x42')]['id']}})[_0x2301('0x21')](handleEntityNotFound(_0x40e164,null))['then'](saveUpdates(_0x551750[_0x2301('0x48')],null))['then'](respondWithResult(_0x40e164,null))[_0x2301('0x40')](handleError(_0x40e164,null));}; \ No newline at end of file +var _0xd280=['options','includeAll','include','findAll','rows','catch','params','rawAttributes','fields','length','find','create','body','describe','uniqueid','eml-format','zip-dir','fast-json-patch','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','end','error','index','map','CmHopperHistory','type','key','name','query','keys','filters','intersection','model','attributes','hasOwnProperty','sort','where','filter','merge','VIRTUAL'];(function(_0x27fe26,_0x3b8ca7){var _0x4fcb35=function(_0x35e0ae){while(--_0x35e0ae){_0x27fe26['push'](_0x27fe26['shift']());}};_0x4fcb35(++_0x3b8ca7);}(_0xd280,0xe4));var _0x0d28=function(_0x55decc,_0x112aa4){_0x55decc=_0x55decc-0x0;var _0x10ec8a=_0xd280[_0x55decc];return _0x10ec8a;};'use strict';var emlformat=require(_0x0d28('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0d28('0x1'));var jsonpatch=require(_0x0d28('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0d28('0x3'));var Mustache=require(_0x0d28('0x4'));var util=require('util');var path=require(_0x0d28('0x5'));var sox=require('sox');var csv=require(_0x0d28('0x6'));var ejs=require(_0x0d28('0x7'));var fs=require('fs');var fs_extra=require(_0x0d28('0x8'));var _=require(_0x0d28('0x9'));var squel=require('squel');var crypto=require(_0x0d28('0xa'));var jsforce=require(_0x0d28('0xb'));var deskjs=require(_0x0d28('0xc'));var toCsv=require(_0x0d28('0x6'));var querystring=require('querystring');var Papa=require(_0x0d28('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x0d28('0xe'));var as=require(_0x0d28('0xf'));var hardwareService=require(_0x0d28('0x10'));var logger=require(_0x0d28('0x11'))('api');var utils=require(_0x0d28('0x12'));var config=require(_0x0d28('0x13'));var licenseUtil=require(_0x0d28('0x14'));var db=require(_0x0d28('0x15'))['db'];function respondWithStatusCode(_0x489cb1,_0x5636e5){_0x5636e5=_0x5636e5||0xcc;return function(_0x1dc505){if(_0x1dc505){return _0x489cb1[_0x0d28('0x16')](_0x5636e5);}return _0x489cb1[_0x0d28('0x17')](_0x5636e5)['end']();};}function respondWithResult(_0x371ad8,_0x5af013){_0x5af013=_0x5af013||0xc8;return function(_0x4e84fd){if(_0x4e84fd){return _0x371ad8[_0x0d28('0x17')](_0x5af013)[_0x0d28('0x18')](_0x4e84fd);}};}function respondWithFilteredResult(_0x552dc4,_0x29b543){return function(_0x50c37a){if(_0x50c37a){var _0xe4fe59=typeof _0x29b543['offset']===_0x0d28('0x19')&&typeof _0x29b543['limit']===_0x0d28('0x19');var _0x2dcc02=_0x50c37a[_0x0d28('0x1a')];var _0x44b827=_0xe4fe59?0x0:_0x29b543['offset'];var _0x22aec8=_0xe4fe59?_0x50c37a['count']:_0x29b543[_0x0d28('0x1b')]+_0x29b543[_0x0d28('0x1c')];var _0xe5c17d;if(_0x22aec8>=_0x2dcc02){_0x22aec8=_0x2dcc02;_0xe5c17d=0xc8;}else{_0xe5c17d=0xce;}_0x552dc4[_0x0d28('0x17')](_0xe5c17d);return _0x552dc4[_0x0d28('0x1d')](_0x0d28('0x1e'),_0x44b827+'-'+_0x22aec8+'/'+_0x2dcc02)[_0x0d28('0x18')](_0x50c37a);}return null;};}function patchUpdates(_0x12704c){return function(_0xfd9a26){try{jsonpatch[_0x0d28('0x1f')](_0xfd9a26,_0x12704c,!![]);}catch(_0x2f9d8c){return BPromise[_0x0d28('0x20')](_0x2f9d8c);}return _0xfd9a26[_0x0d28('0x21')]();};}function saveUpdates(_0x4b48a6,_0x3ed5ab){return function(_0x498dd2){if(_0x498dd2){return _0x498dd2['update'](_0x4b48a6)[_0x0d28('0x22')](function(_0x2fd9a1){return _0x2fd9a1;});}return null;};}function removeEntity(_0x158d46,_0x4e9d50){return function(_0x1353f2){if(_0x1353f2){return _0x1353f2[_0x0d28('0x23')]()[_0x0d28('0x22')](function(){_0x158d46[_0x0d28('0x17')](0xcc)[_0x0d28('0x24')]();});}};}function handleEntityNotFound(_0x4daf99,_0x17f340){return function(_0x507709){if(!_0x507709){_0x4daf99[_0x0d28('0x16')](0x194);}return _0x507709;};}function handleError(_0x3a2029,_0x3b6eeb){_0x3b6eeb=_0x3b6eeb||0x1f4;return function(_0x33cf7e){logger[_0x0d28('0x25')](_0x33cf7e['stack']);if(_0x33cf7e['name']){delete _0x33cf7e['name'];}_0x3a2029['status'](_0x3b6eeb)['send'](_0x33cf7e);};}exports[_0x0d28('0x26')]=function(_0x60563f,_0x575e1c){var _0x438b48={},_0x2863fa={},_0x2fa3a4={'count':0x0,'rows':[]};var _0x5a9a72=_[_0x0d28('0x27')](db[_0x0d28('0x28')]['rawAttributes'],function(_0x123ab5){return{'name':_0x123ab5['fieldName'],'type':_0x123ab5[_0x0d28('0x29')][_0x0d28('0x2a')]};});_0x2863fa['model']=_[_0x0d28('0x27')](_0x5a9a72,_0x0d28('0x2b'));_0x2863fa[_0x0d28('0x2c')]=_[_0x0d28('0x2d')](_0x60563f['query']);_0x2863fa[_0x0d28('0x2e')]=_[_0x0d28('0x2f')](_0x2863fa[_0x0d28('0x30')],_0x2863fa[_0x0d28('0x2c')]);_0x438b48[_0x0d28('0x31')]=_[_0x0d28('0x2f')](_0x2863fa[_0x0d28('0x30')],qs['fields'](_0x60563f[_0x0d28('0x2c')]['fields']));_0x438b48[_0x0d28('0x31')]=_0x438b48[_0x0d28('0x31')]['length']?_0x438b48['attributes']:_0x2863fa[_0x0d28('0x30')];if(!_0x60563f[_0x0d28('0x2c')][_0x0d28('0x32')]('nolimit')){_0x438b48[_0x0d28('0x1c')]=qs[_0x0d28('0x1c')](_0x60563f['query'][_0x0d28('0x1c')]);_0x438b48['offset']=qs[_0x0d28('0x1b')](_0x60563f[_0x0d28('0x2c')][_0x0d28('0x1b')]);}_0x438b48['order']=qs['sort'](_0x60563f[_0x0d28('0x2c')][_0x0d28('0x33')]);_0x438b48[_0x0d28('0x34')]=qs[_0x0d28('0x2e')](_['pick'](_0x60563f[_0x0d28('0x2c')],_0x2863fa[_0x0d28('0x2e')]),_0x5a9a72);if(_0x60563f['query'][_0x0d28('0x35')]){_0x438b48[_0x0d28('0x34')]=_[_0x0d28('0x36')](_0x438b48[_0x0d28('0x34')],{'$or':_[_0x0d28('0x27')](_0x5a9a72,function(_0x3d12b3){if(_0x3d12b3[_0x0d28('0x29')]!==_0x0d28('0x37')){var _0x5beafb={};_0x5beafb[_0x3d12b3[_0x0d28('0x2b')]]={'$like':'%'+_0x60563f[_0x0d28('0x2c')][_0x0d28('0x35')]+'%'};return _0x5beafb;}})});}_0x438b48=_[_0x0d28('0x36')]({},_0x438b48,_0x60563f[_0x0d28('0x38')]);var _0x1dc0a6={'where':_0x438b48[_0x0d28('0x34')]};return db['CmHopperHistory'][_0x0d28('0x1a')](_0x1dc0a6)[_0x0d28('0x22')](function(_0x4e8661){_0x2fa3a4['count']=_0x4e8661;if(_0x60563f[_0x0d28('0x2c')][_0x0d28('0x39')]){_0x438b48[_0x0d28('0x3a')]=[{'all':!![]}];}return db[_0x0d28('0x28')][_0x0d28('0x3b')](_0x438b48);})[_0x0d28('0x22')](function(_0x39d97b){_0x2fa3a4[_0x0d28('0x3c')]=_0x39d97b;return _0x2fa3a4;})[_0x0d28('0x22')](respondWithFilteredResult(_0x575e1c,_0x438b48))[_0x0d28('0x3d')](handleError(_0x575e1c,null));};exports['show']=function(_0x2dc644,_0x1df728){var _0x574e91={'raw':!![],'where':{'id':_0x2dc644[_0x0d28('0x3e')]['id']}},_0x2eb494={};_0x2eb494['model']=_['keys'](db[_0x0d28('0x28')][_0x0d28('0x3f')]);_0x2eb494['query']=_[_0x0d28('0x2d')](_0x2dc644[_0x0d28('0x2c')]);_0x2eb494[_0x0d28('0x2e')]=_[_0x0d28('0x2f')](_0x2eb494[_0x0d28('0x30')],_0x2eb494['query']);_0x574e91[_0x0d28('0x31')]=_[_0x0d28('0x2f')](_0x2eb494[_0x0d28('0x30')],qs['fields'](_0x2dc644['query'][_0x0d28('0x40')]));_0x574e91['attributes']=_0x574e91[_0x0d28('0x31')][_0x0d28('0x41')]?_0x574e91[_0x0d28('0x31')]:_0x2eb494[_0x0d28('0x30')];if(_0x2dc644[_0x0d28('0x2c')][_0x0d28('0x39')]){_0x574e91[_0x0d28('0x3a')]=[{'all':!![]}];}_0x574e91=_[_0x0d28('0x36')]({},_0x574e91,_0x2dc644[_0x0d28('0x38')]);return db['CmHopperHistory'][_0x0d28('0x42')](_0x574e91)[_0x0d28('0x22')](handleEntityNotFound(_0x1df728,null))[_0x0d28('0x22')](respondWithResult(_0x1df728,null))[_0x0d28('0x3d')](handleError(_0x1df728,null));};exports[_0x0d28('0x43')]=function(_0x5c9f45,_0x32468f){return db[_0x0d28('0x28')]['create'](_0x5c9f45[_0x0d28('0x44')],{})[_0x0d28('0x22')](respondWithResult(_0x32468f,0xc9))[_0x0d28('0x3d')](handleError(_0x32468f,null));};exports[_0x0d28('0x45')]=function(_0x4fa9b4,_0x417937){return db[_0x0d28('0x28')]['describe']()[_0x0d28('0x22')](respondWithResult(_0x417937,null))[_0x0d28('0x3d')](handleError(_0x417937,null));};exports['update']=function(_0x3cd3f5,_0x385048){if(_0x3cd3f5['body'][_0x0d28('0x46')]){delete _0x3cd3f5[_0x0d28('0x44')][_0x0d28('0x46')];}return db['CmHopperHistory'][_0x0d28('0x42')]({'where':{'uniqueid':_0x3cd3f5[_0x0d28('0x3e')]['id']}})[_0x0d28('0x22')](handleEntityNotFound(_0x385048,null))[_0x0d28('0x22')](saveUpdates(_0x3cd3f5[_0x0d28('0x44')],null))[_0x0d28('0x22')](respondWithResult(_0x385048,null))[_0x0d28('0x3d')](handleError(_0x385048,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 81f0d56..c3434da 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 _0xc5df=['rimraf','../../config/environment','./cmHopperHistory.attributes','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','../../config/logger','api','request-promise','path'];(function(_0x4f217f,_0x313163){var _0x3b583a=function(_0x334971){while(--_0x334971){_0x4f217f['push'](_0x4f217f['shift']());}};_0x3b583a(++_0x313163);}(_0xc5df,0x80));var _0xfc5d=function(_0x5ee925,_0x5041f6){_0x5ee925=_0x5ee925-0x0;var _0x1cb2a2=_0xc5df[_0x5ee925];return _0x1cb2a2;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xfc5d('0x0'))(_0xfc5d('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xfc5d('0x2'));var fs=require('fs');var path=require(_0xfc5d('0x3'));var rimraf=require(_0xfc5d('0x4'));var config=require(_0xfc5d('0x5'));var attributes=require(_0xfc5d('0x6'));module['exports']=function(_0x1c8057,_0x2df24e){return _0x1c8057[_0xfc5d('0x7')](_0xfc5d('0x8'),attributes,{'tableName':_0xfc5d('0x9'),'paranoid':![],'indexes':[{'name':_0xfc5d('0xa'),'fields':['endtime']},{'name':_0xfc5d('0xb'),'fields':[_0xfc5d('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc113=['path','rimraf','./cmHopperHistory.attributes','exports','define','CmHopperHistory','endtime','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x5037ab,_0x43209e){var _0x512adb=function(_0x261783){while(--_0x261783){_0x5037ab['push'](_0x5037ab['shift']());}};_0x512adb(++_0x43209e);}(_0xc113,0x1ab));var _0x3c11=function(_0x599f6b,_0x32d98e){_0x599f6b=_0x599f6b-0x0;var _0x42aaea=_0xc113[_0x599f6b];return _0x42aaea;};'use strict';var _=require(_0x3c11('0x0'));var util=require(_0x3c11('0x1'));var logger=require(_0x3c11('0x2'))(_0x3c11('0x3'));var moment=require(_0x3c11('0x4'));var BPromise=require(_0x3c11('0x5'));var rp=require(_0x3c11('0x6'));var fs=require('fs');var path=require(_0x3c11('0x7'));var rimraf=require(_0x3c11('0x8'));var config=require('../../config/environment');var attributes=require(_0x3c11('0x9'));module[_0x3c11('0xa')]=function(_0x595e66,_0x3dd753){return _0x595e66[_0x3c11('0xb')](_0x3c11('0xc'),attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':_0x3c11('0xd'),'fields':['endtime']},{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 947822b..5d47970 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 _0x0b96=['stringify','AvgHandleTime','CmHopperHistory','findAll','where','COUNT','sequelize','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','AVG','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','campaign','GetCampaignHopperHistory','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','request\x20sent','CmHopperHistory,\x20%s,\x20%s','error','message','result','catch','CreateCmHopperHistory','create','body','options','raw'];(function(_0xbc4241,_0x362f9e){var _0x3c32eb=function(_0x38242b){while(--_0x38242b){_0xbc4241['push'](_0xbc4241['shift']());}};_0x3c32eb(++_0x362f9e);}(_0x0b96,0xc2));var _0x60b9=function(_0x1ebb10,_0x156b3e){_0x1ebb10=_0x1ebb10-0x0;var _0x20d709=_0x0b96[_0x1ebb10];return _0x20d709;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x60b9('0x0'));var BPromise=require(_0x60b9('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x60b9('0x2'));var db=require(_0x60b9('0x3'))['db'];var utils=require(_0x60b9('0x4'));var logger=require(_0x60b9('0x5'))('rpc');var config=require(_0x60b9('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x60b9('0x7')][_0x60b9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x122342,_0x57e464,_0x5e71f0){return new BPromise(function(_0x51d50a,_0x3162cc){return client[_0x60b9('0x9')](_0x122342,_0x5e71f0)[_0x60b9('0xa')](function(_0x54ef39){logger[_0x60b9('0xb')]('CmHopperHistory,\x20%s,\x20%s',_0x57e464,'request\x20sent');logger[_0x60b9('0xc')](_0x60b9('0xd'),_0x57e464,_0x60b9('0xe'),JSON['stringify'](_0x54ef39));if(_0x54ef39['error']){if(_0x54ef39['error']['code']===0x1f4){logger['error'](_0x60b9('0xf'),_0x57e464,_0x54ef39['error']['message']);return _0x3162cc(_0x54ef39['error']['message']);}logger[_0x60b9('0x10')]('CmHopperHistory,\x20%s,\x20%s',_0x57e464,_0x54ef39['error']['message']);return _0x51d50a(_0x54ef39[_0x60b9('0x10')][_0x60b9('0x11')]);}else{logger['info']('CmHopperHistory,\x20%s,\x20%s',_0x57e464,_0x60b9('0xe'));_0x51d50a(_0x54ef39[_0x60b9('0x12')][_0x60b9('0x11')]);}})[_0x60b9('0x13')](function(_0x341e49){logger[_0x60b9('0x10')](_0x60b9('0xf'),_0x57e464,_0x341e49);_0x3162cc(_0x341e49);});});}exports[_0x60b9('0x14')]=function(_0x767b4f){var _0x16a7c7=this;return new Promise(function(_0xe62516,_0x51e84b){return db['CmHopperHistory'][_0x60b9('0x15')](_0x767b4f[_0x60b9('0x16')],{'raw':_0x767b4f[_0x60b9('0x17')]?_0x767b4f[_0x60b9('0x17')][_0x60b9('0x18')]===undefined?!![]:![]:!![]})[_0x60b9('0xa')](function(_0x155c87){logger['info'](_0x60b9('0x14'),_0x767b4f);logger[_0x60b9('0xc')]('CreateCmHopperHistory',_0x767b4f,JSON[_0x60b9('0x19')](_0x155c87));_0xe62516(_0x155c87);})[_0x60b9('0x13')](function(_0x37e4df){logger['error'](_0x60b9('0x14'),_0x37e4df[_0x60b9('0x11')],_0x767b4f);_0x51e84b(_0x16a7c7[_0x60b9('0x10')](0x1f4,_0x37e4df[_0x60b9('0x11')]));});});};exports[_0x60b9('0x1a')]=function(_0xb39049){var _0x1e2658=this;return new Promise(function(_0x6ab6c6,_0x503b73){return db[_0x60b9('0x1b')][_0x60b9('0x1c')]({'raw':_0xb39049['options']?_0xb39049['options']['raw']===undefined?!![]:![]:!![],'where':_0xb39049[_0x60b9('0x17')]?_0xb39049[_0x60b9('0x17')][_0x60b9('0x1d')]||null:null,'attributes':[[db['sequelize']['fn'](_0x60b9('0x1e'),db[_0x60b9('0x1f')][_0x60b9('0x20')]('id')),_0x60b9('0x21')],[db['sequelize']['fn'](_0x60b9('0x1e'),db[_0x60b9('0x1f')]['fn']('IF',db[_0x60b9('0x1f')][_0x60b9('0x22')](_0x60b9('0x23')))),_0x60b9('0x24')],[db['sequelize']['fn']('COUNT',db[_0x60b9('0x1f')]['fn']('IF',db[_0x60b9('0x1f')][_0x60b9('0x22')](_0x60b9('0x25')))),_0x60b9('0x26')],[db['sequelize']['fn'](_0x60b9('0x1e'),db[_0x60b9('0x1f')]['fn']('IF',db[_0x60b9('0x1f')][_0x60b9('0x22')](_0x60b9('0x27')))),_0x60b9('0x28')],[db['sequelize']['fn']('AVG',db[_0x60b9('0x1f')]['fn']('IF',db['sequelize'][_0x60b9('0x22')](_0x60b9('0x29')))),_0x60b9('0x2a')],[db['sequelize']['fn'](_0x60b9('0x2b'),db[_0x60b9('0x1f')]['fn']('IF',db[_0x60b9('0x1f')][_0x60b9('0x22')](_0x60b9('0x2c')))),_0x60b9('0x2d')]]})[_0x60b9('0xa')](function(_0x6c38ba){logger[_0x60b9('0xb')](_0x60b9('0x1a'),_0xb39049);logger['debug'](_0x60b9('0x1a'),_0xb39049,JSON[_0x60b9('0x19')](_0x6c38ba));_0x6ab6c6(_0x6c38ba);})[_0x60b9('0x13')](function(_0x3ce5cd){logger[_0x60b9('0x10')](_0x60b9('0x1a'),_0x3ce5cd[_0x60b9('0x11')],_0xb39049);_0x503b73(_0x1e2658['error'](0x1f4,_0x3ce5cd[_0x60b9('0x11')]));});});};exports[_0x60b9('0x2e')]=function(_0x211c50){var _0x603491=this;return new Promise(function(_0x47d6c8,_0xf41f50){return db['CmHopperHistory']['findAll']({'raw':_0x211c50[_0x60b9('0x17')]?_0x211c50[_0x60b9('0x17')][_0x60b9('0x18')]===undefined?!![]:![]:!![],'where':_0x211c50['options']?_0x211c50[_0x60b9('0x17')][_0x60b9('0x1d')]||null:null,'attributes':[['campaign',_0x60b9('0x2f')],[db['sequelize']['fn'](_0x60b9('0x1e'),db[_0x60b9('0x1f')]['fn']('IF',db[_0x60b9('0x1f')]['literal'](_0x60b9('0x30')))),_0x60b9('0x31')],[db['sequelize']['fn'](_0x60b9('0x1e'),db[_0x60b9('0x1f')]['fn']('IF',db[_0x60b9('0x1f')][_0x60b9('0x22')](_0x60b9('0x32')))),_0x60b9('0x33')],[db['sequelize']['fn'](_0x60b9('0x1e'),db['sequelize']['fn']('IF',db[_0x60b9('0x1f')]['literal']('`state`\x20=\x204,\x201,\x20null'))),_0x60b9('0x34')],[db[_0x60b9('0x1f')]['fn'](_0x60b9('0x1e'),db[_0x60b9('0x1f')]['fn']('IF',db['sequelize'][_0x60b9('0x22')](_0x60b9('0x35')))),'outboundBusyCallsDay'],[db[_0x60b9('0x1f')]['fn'](_0x60b9('0x1e'),db[_0x60b9('0x1f')]['fn']('IF',db[_0x60b9('0x1f')][_0x60b9('0x22')](_0x60b9('0x36')))),_0x60b9('0x37')],[db[_0x60b9('0x1f')]['fn'](_0x60b9('0x1e'),db[_0x60b9('0x1f')]['fn']('IF',db[_0x60b9('0x1f')][_0x60b9('0x22')](_0x60b9('0x38')))),_0x60b9('0x39')],[db[_0x60b9('0x1f')]['fn'](_0x60b9('0x1e'),db['sequelize']['fn']('IF',db[_0x60b9('0x1f')][_0x60b9('0x22')](_0x60b9('0x3a')))),'outboundDropCallsDayCallersExit'],[db[_0x60b9('0x1f')]['fn'](_0x60b9('0x1e'),db[_0x60b9('0x1f')]['fn']('IF',db['sequelize']['literal'](_0x60b9('0x3b')))),_0x60b9('0x3c')],[db[_0x60b9('0x1f')]['fn'](_0x60b9('0x1e'),db[_0x60b9('0x1f')]['fn']('IF',db[_0x60b9('0x1f')][_0x60b9('0x22')]('`state`\x20=\x2013,\x201,\x20null'))),_0x60b9('0x3d')],[db['sequelize']['fn']('COUNT',db[_0x60b9('0x1f')]['fn']('IF',db['sequelize']['literal'](_0x60b9('0x3e')))),_0x60b9('0x3f')],[db[_0x60b9('0x1f')]['fn'](_0x60b9('0x1e'),db[_0x60b9('0x1f')]['fn']('IF',db[_0x60b9('0x1f')][_0x60b9('0x22')](_0x60b9('0x40')))),_0x60b9('0x41')],[db[_0x60b9('0x1f')]['fn']('COUNT',db[_0x60b9('0x1f')]['fn']('IF',db[_0x60b9('0x1f')][_0x60b9('0x22')](_0x60b9('0x42')))),_0x60b9('0x43')],[db[_0x60b9('0x1f')]['fn'](_0x60b9('0x1e'),db[_0x60b9('0x1f')]['fn']('IF',db[_0x60b9('0x1f')]['literal'](_0x60b9('0x44')))),_0x60b9('0x41')],[db[_0x60b9('0x1f')]['fn'](_0x60b9('0x1e'),db['sequelize']['fn']('IF',db[_0x60b9('0x1f')][_0x60b9('0x22')](_0x60b9('0x45')))),_0x60b9('0x46')]],'group':[_0x60b9('0x47')]})[_0x60b9('0xa')](function(_0x2ec1cf){logger[_0x60b9('0xb')]('GetVoiceQueueHopperHistory',_0x211c50);logger[_0x60b9('0xc')](_0x60b9('0x2e'),_0x211c50,JSON[_0x60b9('0x19')](_0x2ec1cf));_0x47d6c8(_0x2ec1cf);})['catch'](function(_0x29be83){logger[_0x60b9('0x10')]('GetVoiceQueueHopperHistory',_0x29be83[_0x60b9('0x11')],_0x211c50);_0xf41f50(_0x603491[_0x60b9('0x10')](0x1f4,_0x29be83[_0x60b9('0x11')]));});});};exports[_0x60b9('0x48')]=function(_0xbfb79f){var _0x5c3eae=this;return new Promise(function(_0xba48d5,_0x583d2e){return db['CmHopperHistory'][_0x60b9('0x1c')]({'raw':_0xbfb79f['options']?_0xbfb79f[_0x60b9('0x17')][_0x60b9('0x18')]===undefined?!![]:![]:!![],'where':_0xbfb79f[_0x60b9('0x17')]?_0xbfb79f[_0x60b9('0x17')]['where']||null:null,'attributes':[['campaign',_0x60b9('0x2f')],[db[_0x60b9('0x1f')]['fn'](_0x60b9('0x1e'),db[_0x60b9('0x1f')]['col']('id')),'ivrTotalCallsDays'],[db['sequelize']['fn']('COUNT',db[_0x60b9('0x1f')]['fn']('IF',db[_0x60b9('0x1f')]['literal'](_0x60b9('0x23')))),'ivrAnswerCallsDay']],'group':[_0x60b9('0x47')]})[_0x60b9('0xa')](function(_0x97676d){logger[_0x60b9('0xb')](_0x60b9('0x48'),_0xbfb79f);logger[_0x60b9('0xc')]('GetCampaignHopperHistory',_0xbfb79f,JSON[_0x60b9('0x19')](_0x97676d));_0xba48d5(_0x97676d);})['catch'](function(_0x5ad249){logger[_0x60b9('0x10')](_0x60b9('0x48'),_0x5ad249[_0x60b9('0x11')],_0xbfb79f);_0x583d2e(_0x5c3eae['error'](0x1f4,_0x5ad249[_0x60b9('0x11')]));});});}; \ No newline at end of file +var _0x5fbd=['where','COUNT','sequelize','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','raw','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundUnknownCallsDay','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','outboundReCallsDay','campaign','GetVoiceQueueHopperHistory','GetCampaignHopperHistory','col','ivrAnswerCallsDay','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','info','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','CmHopperHistory,\x20%s,\x20%s','message','result','catch','CmHopperHistory','create','options','then','CreateCmHopperHistory','AvgHandleTime','findAll'];(function(_0x19f061,_0x3f77a5){var _0x799486=function(_0x3243ae){while(--_0x3243ae){_0x19f061['push'](_0x19f061['shift']());}};_0x799486(++_0x3f77a5);}(_0x5fbd,0xea));var _0xd5fb=function(_0x24ccda,_0x1c3018){_0x24ccda=_0x24ccda-0x0;var _0x383213=_0x5fbd[_0x24ccda];return _0x383213;};'use strict';var _=require(_0xd5fb('0x0'));var util=require(_0xd5fb('0x1'));var moment=require(_0xd5fb('0x2'));var BPromise=require(_0xd5fb('0x3'));var rs=require(_0xd5fb('0x4'));var fs=require('fs');var Redis=require(_0xd5fb('0x5'));var db=require(_0xd5fb('0x6'))['db'];var utils=require(_0xd5fb('0x7'));var logger=require(_0xd5fb('0x8'))('rpc');var config=require(_0xd5fb('0x9'));var jayson=require(_0xd5fb('0xa'));var client=jayson[_0xd5fb('0xb')][_0xd5fb('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1f278d,_0x210c1c,_0x43c5d4){return new BPromise(function(_0x557a4d,_0x877a3f){return client['request'](_0x1f278d,_0x43c5d4)['then'](function(_0x57453b){logger[_0xd5fb('0xd')]('CmHopperHistory,\x20%s,\x20%s',_0x210c1c,_0xd5fb('0xe'));logger[_0xd5fb('0xf')](_0xd5fb('0x10'),_0x210c1c,_0xd5fb('0xe'),JSON[_0xd5fb('0x11')](_0x57453b));if(_0x57453b[_0xd5fb('0x12')]){if(_0x57453b['error']['code']===0x1f4){logger[_0xd5fb('0x12')](_0xd5fb('0x13'),_0x210c1c,_0x57453b[_0xd5fb('0x12')]['message']);return _0x877a3f(_0x57453b[_0xd5fb('0x12')][_0xd5fb('0x14')]);}logger[_0xd5fb('0x12')]('CmHopperHistory,\x20%s,\x20%s',_0x210c1c,_0x57453b[_0xd5fb('0x12')]['message']);return _0x557a4d(_0x57453b['error']['message']);}else{logger[_0xd5fb('0xd')]('CmHopperHistory,\x20%s,\x20%s',_0x210c1c,_0xd5fb('0xe'));_0x557a4d(_0x57453b[_0xd5fb('0x15')]['message']);}})[_0xd5fb('0x16')](function(_0x5e5450){logger[_0xd5fb('0x12')](_0xd5fb('0x13'),_0x210c1c,_0x5e5450);_0x877a3f(_0x5e5450);});});}exports['CreateCmHopperHistory']=function(_0x5d7d1e){var _0x38b209=this;return new Promise(function(_0x10a655,_0x524a24){return db[_0xd5fb('0x17')][_0xd5fb('0x18')](_0x5d7d1e['body'],{'raw':_0x5d7d1e[_0xd5fb('0x19')]?_0x5d7d1e[_0xd5fb('0x19')]['raw']===undefined?!![]:![]:!![]})[_0xd5fb('0x1a')](function(_0x4083b3){logger['info'](_0xd5fb('0x1b'),_0x5d7d1e);logger[_0xd5fb('0xf')]('CreateCmHopperHistory',_0x5d7d1e,JSON[_0xd5fb('0x11')](_0x4083b3));_0x10a655(_0x4083b3);})[_0xd5fb('0x16')](function(_0x51d417){logger[_0xd5fb('0x12')]('CreateCmHopperHistory',_0x51d417[_0xd5fb('0x14')],_0x5d7d1e);_0x524a24(_0x38b209['error'](0x1f4,_0x51d417[_0xd5fb('0x14')]));});});};exports[_0xd5fb('0x1c')]=function(_0x10926c){var _0x5a9e52=this;return new Promise(function(_0x3ad4fd,_0x3ef78d){return db[_0xd5fb('0x17')][_0xd5fb('0x1d')]({'raw':_0x10926c[_0xd5fb('0x19')]?_0x10926c[_0xd5fb('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x10926c[_0xd5fb('0x19')]?_0x10926c['options'][_0xd5fb('0x1e')]||null:null,'attributes':[[db['sequelize']['fn'](_0xd5fb('0x1f'),db[_0xd5fb('0x20')]['col']('id')),_0xd5fb('0x21')],[db[_0xd5fb('0x20')]['fn']('COUNT',db[_0xd5fb('0x20')]['fn']('IF',db[_0xd5fb('0x20')][_0xd5fb('0x22')](_0xd5fb('0x23')))),_0xd5fb('0x24')],[db[_0xd5fb('0x20')]['fn'](_0xd5fb('0x1f'),db[_0xd5fb('0x20')]['fn']('IF',db[_0xd5fb('0x20')][_0xd5fb('0x22')](_0xd5fb('0x25')))),_0xd5fb('0x26')],[db[_0xd5fb('0x20')]['fn'](_0xd5fb('0x1f'),db['sequelize']['fn']('IF',db[_0xd5fb('0x20')][_0xd5fb('0x22')]('`state`\x20=\x2011,\x201,\x20null'))),'predictiveIntervalDroppedCallsCallersExit'],[db['sequelize']['fn'](_0xd5fb('0x27'),db['sequelize']['fn']('IF',db['sequelize'][_0xd5fb('0x22')](_0xd5fb('0x28')))),_0xd5fb('0x29')],[db[_0xd5fb('0x20')]['fn'](_0xd5fb('0x27'),db['sequelize']['fn']('IF',db[_0xd5fb('0x20')][_0xd5fb('0x22')](_0xd5fb('0x2a')))),_0xd5fb('0x2b')]]})[_0xd5fb('0x1a')](function(_0x43f887){logger[_0xd5fb('0xd')](_0xd5fb('0x1c'),_0x10926c);logger[_0xd5fb('0xf')](_0xd5fb('0x1c'),_0x10926c,JSON['stringify'](_0x43f887));_0x3ad4fd(_0x43f887);})[_0xd5fb('0x16')](function(_0x22ff7d){logger['error'](_0xd5fb('0x1c'),_0x22ff7d['message'],_0x10926c);_0x3ef78d(_0x5a9e52[_0xd5fb('0x12')](0x1f4,_0x22ff7d[_0xd5fb('0x14')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x25db47){var _0x4cff2b=this;return new Promise(function(_0x1bca5c,_0x5144c6){return db['CmHopperHistory'][_0xd5fb('0x1d')]({'raw':_0x25db47[_0xd5fb('0x19')]?_0x25db47[_0xd5fb('0x19')][_0xd5fb('0x2c')]===undefined?!![]:![]:!![],'where':_0x25db47[_0xd5fb('0x19')]?_0x25db47[_0xd5fb('0x19')][_0xd5fb('0x1e')]||null:null,'attributes':[['campaign',_0xd5fb('0x2d')],[db['sequelize']['fn'](_0xd5fb('0x1f'),db[_0xd5fb('0x20')]['fn']('IF',db[_0xd5fb('0x20')][_0xd5fb('0x22')](_0xd5fb('0x2e')))),_0xd5fb('0x2f')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xd5fb('0x20')][_0xd5fb('0x22')]('`state`\x20=\x203,\x201,\x20null'))),_0xd5fb('0x30')],[db['sequelize']['fn']('COUNT',db[_0xd5fb('0x20')]['fn']('IF',db[_0xd5fb('0x20')]['literal'](_0xd5fb('0x23')))),_0xd5fb('0x31')],[db[_0xd5fb('0x20')]['fn'](_0xd5fb('0x1f'),db[_0xd5fb('0x20')]['fn']('IF',db[_0xd5fb('0x20')]['literal']('`state`\x20=\x205,\x201,\x20null'))),'outboundBusyCallsDay'],[db['sequelize']['fn'](_0xd5fb('0x1f'),db[_0xd5fb('0x20')]['fn']('IF',db['sequelize']['literal'](_0xd5fb('0x32')))),_0xd5fb('0x33')],[db[_0xd5fb('0x20')]['fn'](_0xd5fb('0x1f'),db[_0xd5fb('0x20')]['fn']('IF',db['sequelize'][_0xd5fb('0x22')](_0xd5fb('0x34')))),_0xd5fb('0x35')],[db['sequelize']['fn'](_0xd5fb('0x1f'),db[_0xd5fb('0x20')]['fn']('IF',db[_0xd5fb('0x20')][_0xd5fb('0x22')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0xd5fb('0x36')],[db[_0xd5fb('0x20')]['fn'](_0xd5fb('0x1f'),db[_0xd5fb('0x20')]['fn']('IF',db[_0xd5fb('0x20')][_0xd5fb('0x22')]('`state`\x20=\x2012,\x201,\x20null'))),_0xd5fb('0x37')],[db[_0xd5fb('0x20')]['fn'](_0xd5fb('0x1f'),db[_0xd5fb('0x20')]['fn']('IF',db[_0xd5fb('0x20')]['literal']('`state`\x20=\x2013,\x201,\x20null'))),'outboundBlacklistCallsDay'],[db['sequelize']['fn'](_0xd5fb('0x1f'),db[_0xd5fb('0x20')]['fn']('IF',db[_0xd5fb('0x20')]['literal']('`state`\x20=\x2014,\x201,\x20null'))),'outboundOriginateFailureCallsDay'],[db['sequelize']['fn'](_0xd5fb('0x1f'),db[_0xd5fb('0x20')]['fn']('IF',db[_0xd5fb('0x20')][_0xd5fb('0x22')]('`state`\x20=\x2018,\x201,\x20null'))),_0xd5fb('0x38')],[db[_0xd5fb('0x20')]['fn'](_0xd5fb('0x1f'),db[_0xd5fb('0x20')]['fn']('IF',db['sequelize'][_0xd5fb('0x22')](_0xd5fb('0x39')))),_0xd5fb('0x3a')],[db[_0xd5fb('0x20')]['fn']('COUNT',db[_0xd5fb('0x20')]['fn']('IF',db['sequelize'][_0xd5fb('0x22')](_0xd5fb('0x3b')))),_0xd5fb('0x38')],[db[_0xd5fb('0x20')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0xd5fb('0x22')]('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),_0xd5fb('0x3c')]],'group':[_0xd5fb('0x3d')]})['then'](function(_0x13cd7c){logger[_0xd5fb('0xd')](_0xd5fb('0x3e'),_0x25db47);logger[_0xd5fb('0xf')](_0xd5fb('0x3e'),_0x25db47,JSON[_0xd5fb('0x11')](_0x13cd7c));_0x1bca5c(_0x13cd7c);})[_0xd5fb('0x16')](function(_0x1e8d24){logger[_0xd5fb('0x12')](_0xd5fb('0x3e'),_0x1e8d24['message'],_0x25db47);_0x5144c6(_0x4cff2b[_0xd5fb('0x12')](0x1f4,_0x1e8d24[_0xd5fb('0x14')]));});});};exports[_0xd5fb('0x3f')]=function(_0x750c99){var _0x165114=this;return new Promise(function(_0x42155d,_0x38d77a){return db[_0xd5fb('0x17')]['findAll']({'raw':_0x750c99[_0xd5fb('0x19')]?_0x750c99[_0xd5fb('0x19')][_0xd5fb('0x2c')]===undefined?!![]:![]:!![],'where':_0x750c99[_0xd5fb('0x19')]?_0x750c99[_0xd5fb('0x19')][_0xd5fb('0x1e')]||null:null,'attributes':[['campaign',_0xd5fb('0x2d')],[db['sequelize']['fn']('COUNT',db['sequelize'][_0xd5fb('0x40')]('id')),'ivrTotalCallsDays'],[db[_0xd5fb('0x20')]['fn'](_0xd5fb('0x1f'),db[_0xd5fb('0x20')]['fn']('IF',db[_0xd5fb('0x20')]['literal']('`state`\x20=\x204,\x201,\x20null'))),_0xd5fb('0x41')]],'group':['campaign']})['then'](function(_0x1f4b57){logger[_0xd5fb('0xd')](_0xd5fb('0x3f'),_0x750c99);logger['debug'](_0xd5fb('0x3f'),_0x750c99,JSON['stringify'](_0x1f4b57));_0x42155d(_0x1f4b57);})[_0xd5fb('0x16')](function(_0x44e242){logger[_0xd5fb('0x12')](_0xd5fb('0x3f'),_0x44e242['message'],_0x750c99);_0x38d77a(_0x165114[_0xd5fb('0x12')](0x1f4,_0x44e242[_0xd5fb('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 66588d3..64a90cb 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 _0x477d=['util','path','connect-timeout','express','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','index','/:id','post','put'];(function(_0x40906f,_0x3fe187){var _0x4f612e=function(_0x1819df){while(--_0x1819df){_0x40906f['push'](_0x40906f['shift']());}};_0x4f612e(++_0x3fe187);}(_0x477d,0x138));var _0xd477=function(_0x1ebbce,_0x42ee90){_0x1ebbce=_0x1ebbce-0x0;var _0x3f8638=_0x477d[_0x1ebbce];return _0x3f8638;};'use strict';var multer=require('multer');var util=require(_0xd477('0x0'));var path=require(_0xd477('0x1'));var timeout=require(_0xd477('0x2'));var express=require(_0xd477('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd477('0x4'));var controller=require(_0xd477('0x5'));router[_0xd477('0x6')]('/',auth[_0xd477('0x7')](),controller[_0xd477('0x8')]);router[_0xd477('0x6')]('/describe',auth[_0xd477('0x7')](),controller['describe']);router[_0xd477('0x6')](_0xd477('0x9'),auth[_0xd477('0x7')](),controller['show']);router[_0xd477('0xa')]('/',auth[_0xd477('0x7')](),controller['create']);router[_0xd477('0xb')](_0xd477('0x9'),auth[_0xd477('0x7')](),controller['update']);module['exports']=router; \ No newline at end of file +var _0xe425=['create','put','update','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','index','describe','/:id','show'];(function(_0x288d38,_0x6e6623){var _0x25cb55=function(_0x316f1d){while(--_0x316f1d){_0x288d38['push'](_0x288d38['shift']());}};_0x25cb55(++_0x6e6623);}(_0xe425,0xbe));var _0x5e42=function(_0x27c201,_0xd947bf){_0x27c201=_0x27c201-0x0;var _0x3cabde=_0xe425[_0x27c201];return _0x3cabde;};'use strict';var multer=require('multer');var util=require(_0x5e42('0x0'));var path=require(_0x5e42('0x1'));var timeout=require('connect-timeout');var express=require(_0x5e42('0x2'));var router=express['Router']();var fs_extra=require(_0x5e42('0x3'));var auth=require(_0x5e42('0x4'));var interaction=require(_0x5e42('0x5'));var config=require(_0x5e42('0x6'));var controller=require(_0x5e42('0x7'));router[_0x5e42('0x8')]('/',auth[_0x5e42('0x9')](),controller[_0x5e42('0xa')]);router[_0x5e42('0x8')]('/describe',auth[_0x5e42('0x9')](),controller[_0x5e42('0xb')]);router[_0x5e42('0x8')](_0x5e42('0xc'),auth[_0x5e42('0x9')](),controller[_0x5e42('0xd')]);router['post']('/',auth[_0x5e42('0x9')](),controller[_0x5e42('0xe')]);router[_0x5e42('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x5e42('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 7c4e7c8..1607418 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 _0x448b=['name','sequelize','exports','STRING'];(function(_0x44b7d6,_0x4a3f3f){var _0x5346f0=function(_0x35ac17){while(--_0x35ac17){_0x44b7d6['push'](_0x44b7d6['shift']());}};_0x5346f0(++_0x4a3f3f);}(_0x448b,0x125));var _0xb448=function(_0x17e109,_0x4881a8){_0x17e109=_0x17e109-0x0;var _0x4c0657=_0x448b[_0x17e109];return _0x4c0657;};'use strict';var Sequelize=require(_0xb448('0x0'));module[_0xb448('0x1')]={'name':{'type':Sequelize[_0xb448('0x2')],'unique':_0xb448('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xb448('0x2')]},'dialPrefix':{'type':Sequelize[_0xb448('0x2')]}}; \ No newline at end of file +var _0x3de0=['STRING','name','sequelize'];(function(_0x3ce71c,_0x2dee52){var _0xa256a1=function(_0x564101){while(--_0x564101){_0x3ce71c['push'](_0x3ce71c['shift']());}};_0xa256a1(++_0x2dee52);}(_0x3de0,0x143));var _0x03de=function(_0x43cc94,_0x5e7f07){_0x43cc94=_0x43cc94-0x0;var _0x4da82e=_0x3de0[_0x43cc94];return _0x4da82e;};'use strict';var Sequelize=require(_0x03de('0x0'));module['exports']={'name':{'type':Sequelize[_0x03de('0x1')],'unique':_0x03de('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize[_0x03de('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index b08055d..24e5799 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 _0x2cb6=['distinct','field','c.cf_','customField_','select','item','cm_contact_has_items','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','additionalPhone_','description_additionalPhone_','toString','now','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','sequelize','addCustomFields','TEXT','text','number','INTEGER','switch','Sequelize','BOOLEAN','defaultValue','queryInterface','cf_%s','getCustomFields','findAndCountAll','getGlobalCustomFields','addAgents','userCmList:save','removeAgents','userCmList:remove','getAgents','info','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','UserProfileResource','destroy','end','error','name','send','map','CmList','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','filter','merge','type','options','where','includeAll','include','findAll','rows','catch','show','params','keys','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Lists','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','Disposition','getDispositions','findOne','nolimit','pick','ListId','removeDispositions','ids','addContacts','CmContact','tags','isArray','join','push','each','omit','success','dataValues','errors','message','Malformed\x20request\x20syntax','CmCustomField','concat','CustomFields','format','raw','getContacts','OrderBy','alias','from','cm_contacts','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null'];(function(_0x94c91b,_0x2267cf){var _0x1a01b8=function(_0x2a3917){while(--_0x2a3917){_0x94c91b['push'](_0x94c91b['shift']());}};_0x1a01b8(++_0x2267cf);}(_0x2cb6,0xce));var _0x62cb=function(_0x2866c0,_0x3eb131){_0x2866c0=_0x2866c0-0x0;var _0x45d798=_0x2cb6[_0x2866c0];return _0x45d798;};'use strict';var emlformat=require(_0x62cb('0x0'));var rimraf=require(_0x62cb('0x1'));var zipdir=require(_0x62cb('0x2'));var jsonpatch=require(_0x62cb('0x3'));var rp=require(_0x62cb('0x4'));var moment=require('moment');var BPromise=require(_0x62cb('0x5'));var Mustache=require(_0x62cb('0x6'));var util=require(_0x62cb('0x7'));var path=require(_0x62cb('0x8'));var sox=require(_0x62cb('0x9'));var csv=require(_0x62cb('0xa'));var ejs=require(_0x62cb('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x62cb('0xc'));var squel=require(_0x62cb('0xd'));var crypto=require(_0x62cb('0xe'));var jsforce=require(_0x62cb('0xf'));var deskjs=require(_0x62cb('0x10'));var toCsv=require(_0x62cb('0xa'));var querystring=require('querystring');var Papa=require(_0x62cb('0x11'));var Redis=require(_0x62cb('0x12'));var authService=require(_0x62cb('0x13'));var qs=require(_0x62cb('0x14'));var as=require(_0x62cb('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x62cb('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x62cb('0x17'));var db=require('../../mysqldb')['db'];var csv_results;config[_0x62cb('0x18')]=_[_0x62cb('0x19')](config[_0x62cb('0x18')],{'host':_0x62cb('0x1a'),'port':0x18eb});var socket=require(_0x62cb('0x1b'))(new Redis(config[_0x62cb('0x18')]));require(_0x62cb('0x1c'))[_0x62cb('0x1d')](socket);function respondWithStatusCode(_0x45cfd7,_0x13c412){_0x13c412=_0x13c412||0xcc;return function(_0x252141){if(_0x252141){return _0x45cfd7[_0x62cb('0x1e')](_0x13c412);}return _0x45cfd7[_0x62cb('0x1f')](_0x13c412)['end']();};}function respondWithResult(_0x23ae25,_0x70ffe1){_0x70ffe1=_0x70ffe1||0xc8;return function(_0x1f8eb2){if(_0x1f8eb2){return _0x23ae25[_0x62cb('0x1f')](_0x70ffe1)[_0x62cb('0x20')](_0x1f8eb2);}};}function respondWithFilteredResult(_0x19bdb3,_0x26bd89){return function(_0x595770){if(_0x595770){var _0x1d520e=typeof _0x26bd89[_0x62cb('0x21')]===_0x62cb('0x22')&&typeof _0x26bd89[_0x62cb('0x23')]===_0x62cb('0x22');var _0x441fc9=_0x595770[_0x62cb('0x24')];var _0x4fb7ae=_0x1d520e?0x0:_0x26bd89['offset'];var _0x13aa02=_0x1d520e?_0x595770[_0x62cb('0x24')]:_0x26bd89[_0x62cb('0x21')]+_0x26bd89[_0x62cb('0x23')];var _0x4c8321;if(_0x13aa02>=_0x441fc9){_0x13aa02=_0x441fc9;_0x4c8321=0xc8;}else{_0x4c8321=0xce;}_0x19bdb3['status'](_0x4c8321);return _0x19bdb3[_0x62cb('0x25')](_0x62cb('0x26'),_0x4fb7ae+'-'+_0x13aa02+'/'+_0x441fc9)[_0x62cb('0x20')](_0x595770);}return null;};}function patchUpdates(_0x1bfd65){return function(_0x1c3243){try{jsonpatch[_0x62cb('0x27')](_0x1c3243,_0x1bfd65,!![]);}catch(_0x2b2c76){return BPromise[_0x62cb('0x28')](_0x2b2c76);}return _0x1c3243[_0x62cb('0x29')]();};}function saveUpdates(_0x570ad9,_0x468d70){return function(_0x2614e6){if(_0x2614e6){return _0x2614e6[_0x62cb('0x2a')](_0x570ad9)['then'](function(_0x1a3cb5){return _0x1a3cb5;});}return null;};}function removeEntity(_0x487890,_0x16e5a7){return function(_0x542fbe){if(_0x542fbe){return _0x542fbe['destroy']()[_0x62cb('0x2b')](function(){var _0x433c88=_0x542fbe['get']({'plain':!![]});var _0x470030='Lists';return db[_0x62cb('0x2c')][_0x62cb('0x2d')]({'where':{'type':_0x470030,'resourceId':_0x433c88['id']}})[_0x62cb('0x2b')](function(){return _0x542fbe;});})[_0x62cb('0x2b')](function(){_0x487890['status'](0xcc)[_0x62cb('0x2e')]();});}};}function handleEntityNotFound(_0xa818ef,_0x28ea8b){return function(_0x1f0c69){if(!_0x1f0c69){_0xa818ef[_0x62cb('0x1e')](0x194);}return _0x1f0c69;};}function handleError(_0x23b8bd,_0x4bd286){_0x4bd286=_0x4bd286||0x1f4;return function(_0x525b0d){logger[_0x62cb('0x2f')](_0x525b0d['stack']);if(_0x525b0d['name']){delete _0x525b0d[_0x62cb('0x30')];}_0x23b8bd[_0x62cb('0x1f')](_0x4bd286)[_0x62cb('0x31')](_0x525b0d);};}exports['index']=function(_0x1aa3f5,_0x4f1150){var _0x3e2448={},_0x5f36ad={},_0xef3d96={'count':0x0,'rows':[]};var _0x2b2211=_[_0x62cb('0x32')](db[_0x62cb('0x33')][_0x62cb('0x34')],function(_0x2ca34a){return{'name':_0x2ca34a[_0x62cb('0x35')],'type':_0x2ca34a['type'][_0x62cb('0x36')]};});_0x5f36ad[_0x62cb('0x37')]=_[_0x62cb('0x32')](_0x2b2211,_0x62cb('0x30'));_0x5f36ad[_0x62cb('0x38')]=_['keys'](_0x1aa3f5[_0x62cb('0x38')]);_0x5f36ad[_0x62cb('0x39')]=_[_0x62cb('0x3a')](_0x5f36ad[_0x62cb('0x37')],_0x5f36ad[_0x62cb('0x38')]);_0x3e2448[_0x62cb('0x3b')]=_[_0x62cb('0x3a')](_0x5f36ad['model'],qs['fields'](_0x1aa3f5['query'][_0x62cb('0x3c')]));_0x3e2448[_0x62cb('0x3b')]=_0x3e2448[_0x62cb('0x3b')][_0x62cb('0x3d')]?_0x3e2448[_0x62cb('0x3b')]:_0x5f36ad['model'];if(!_0x1aa3f5['query'][_0x62cb('0x3e')]('nolimit')){_0x3e2448[_0x62cb('0x23')]=qs[_0x62cb('0x23')](_0x1aa3f5[_0x62cb('0x38')][_0x62cb('0x23')]);_0x3e2448[_0x62cb('0x21')]=qs[_0x62cb('0x21')](_0x1aa3f5[_0x62cb('0x38')][_0x62cb('0x21')]);}_0x3e2448[_0x62cb('0x3f')]=qs['sort'](_0x1aa3f5['query'][_0x62cb('0x40')]);_0x3e2448['where']=qs[_0x62cb('0x39')](_['pick'](_0x1aa3f5[_0x62cb('0x38')],_0x5f36ad[_0x62cb('0x39')]),_0x2b2211);if(_0x1aa3f5[_0x62cb('0x38')][_0x62cb('0x41')]){_0x3e2448['where']=_[_0x62cb('0x42')](_0x3e2448['where'],{'$or':_[_0x62cb('0x32')](_0x2b2211,function(_0x36c237){if(_0x36c237[_0x62cb('0x43')]!=='VIRTUAL'){var _0x2a8181={};_0x2a8181[_0x36c237[_0x62cb('0x30')]]={'$like':'%'+_0x1aa3f5[_0x62cb('0x38')][_0x62cb('0x41')]+'%'};return _0x2a8181;}})});}_0x3e2448=_[_0x62cb('0x42')]({},_0x3e2448,_0x1aa3f5[_0x62cb('0x44')]);var _0x33ca1d={'where':_0x3e2448[_0x62cb('0x45')]};return db['CmList'][_0x62cb('0x24')](_0x33ca1d)['then'](function(_0x4571a4){_0xef3d96[_0x62cb('0x24')]=_0x4571a4;if(_0x1aa3f5[_0x62cb('0x38')][_0x62cb('0x46')]){_0x3e2448[_0x62cb('0x47')]=[{'all':!![]}];}return db['CmList'][_0x62cb('0x48')](_0x3e2448);})['then'](function(_0x228f40){_0xef3d96[_0x62cb('0x49')]=_0x228f40;return _0xef3d96;})['then'](respondWithFilteredResult(_0x4f1150,_0x3e2448))[_0x62cb('0x4a')](handleError(_0x4f1150,null));};exports[_0x62cb('0x4b')]=function(_0x58e8bc,_0x55ffba){var _0x5540d5={'raw':![],'where':{'id':_0x58e8bc[_0x62cb('0x4c')]['id']}},_0xc5dd0e={};_0xc5dd0e[_0x62cb('0x37')]=_[_0x62cb('0x4d')](db[_0x62cb('0x33')][_0x62cb('0x34')]);_0xc5dd0e[_0x62cb('0x38')]=_[_0x62cb('0x4d')](_0x58e8bc[_0x62cb('0x38')]);_0xc5dd0e['filters']=_[_0x62cb('0x3a')](_0xc5dd0e[_0x62cb('0x37')],_0xc5dd0e[_0x62cb('0x38')]);_0x5540d5[_0x62cb('0x3b')]=_[_0x62cb('0x3a')](_0xc5dd0e[_0x62cb('0x37')],qs[_0x62cb('0x3c')](_0x58e8bc[_0x62cb('0x38')][_0x62cb('0x3c')]));_0x5540d5[_0x62cb('0x3b')]=_0x5540d5[_0x62cb('0x3b')][_0x62cb('0x3d')]?_0x5540d5[_0x62cb('0x3b')]:_0xc5dd0e[_0x62cb('0x37')];if(_0x58e8bc[_0x62cb('0x38')][_0x62cb('0x46')]){_0x5540d5[_0x62cb('0x47')]=[{'all':!![]}];}_0x5540d5=_[_0x62cb('0x42')]({},_0x5540d5,_0x58e8bc['options']);return db[_0x62cb('0x33')][_0x62cb('0x4e')](_0x5540d5)['then'](handleEntityNotFound(_0x55ffba,null))['then'](respondWithResult(_0x55ffba,null))[_0x62cb('0x4a')](handleError(_0x55ffba,null));};exports[_0x62cb('0x4f')]=function(_0x34863d,_0x479bfe){return db[_0x62cb('0x33')][_0x62cb('0x4f')](_0x34863d['body'],{})['then'](function(_0x4af93e){var _0x518935=_0x34863d[_0x62cb('0x50')][_0x62cb('0x51')]({'plain':!![]});if(!_0x518935)throw new Error(_0x62cb('0x52'));if(_0x518935[_0x62cb('0x53')]==='user'){var _0x355cdb=_0x4af93e[_0x62cb('0x51')]({'plain':!![]});var _0x486fb8=_0x62cb('0x54');return db[_0x62cb('0x55')][_0x62cb('0x4e')]({'where':{'name':_0x486fb8,'userProfileId':_0x518935['userProfileId']},'raw':!![]})[_0x62cb('0x2b')](function(_0xf929a1){if(_0xf929a1&&_0xf929a1[_0x62cb('0x56')]===0x0){return db[_0x62cb('0x2c')][_0x62cb('0x4f')]({'name':_0x355cdb['name'],'resourceId':_0x355cdb['id'],'type':_0xf929a1[_0x62cb('0x30')],'sectionId':_0xf929a1['id']},{})['then'](function(){return _0x4af93e;});}else{return _0x4af93e;}})['catch'](function(_0x41356f){logger['error'](_0x62cb('0x57'),_0x41356f);throw _0x41356f;});}return _0x4af93e;})[_0x62cb('0x2b')](respondWithResult(_0x479bfe,0xc9))[_0x62cb('0x4a')](handleError(_0x479bfe,null));};exports[_0x62cb('0x2a')]=function(_0x3dfb04,_0x4a424d){if(_0x3dfb04[_0x62cb('0x58')]['id']){delete _0x3dfb04[_0x62cb('0x58')]['id'];}return db['CmList'][_0x62cb('0x4e')]({'where':{'id':_0x3dfb04[_0x62cb('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4a424d,null))['then'](saveUpdates(_0x3dfb04['body'],null))[_0x62cb('0x2b')](respondWithResult(_0x4a424d,null))[_0x62cb('0x4a')](handleError(_0x4a424d,null));};exports[_0x62cb('0x2d')]=function(_0x5062aa,_0x59e77f){return db[_0x62cb('0x33')][_0x62cb('0x4e')]({'where':{'id':_0x5062aa[_0x62cb('0x4c')]['id']}})[_0x62cb('0x2b')](handleEntityNotFound(_0x59e77f,null))[_0x62cb('0x2b')](removeEntity(_0x59e77f,null))[_0x62cb('0x4a')](handleError(_0x59e77f,null));};exports['describe']=function(_0x188b63,_0x457bad){return db[_0x62cb('0x33')][_0x62cb('0x59')]()[_0x62cb('0x2b')](respondWithResult(_0x457bad,null))[_0x62cb('0x4a')](handleError(_0x457bad,null));};exports[_0x62cb('0x5a')]=function(_0x5a590f,_0xbb6ca1,_0x241fd2){if(_0x5a590f[_0x62cb('0x58')]['id']){delete _0x5a590f[_0x62cb('0x58')]['id'];}return db['CmList'][_0x62cb('0x4e')]({'where':{'id':_0x5a590f[_0x62cb('0x4c')]['id']}})[_0x62cb('0x2b')](handleEntityNotFound(_0xbb6ca1,null))[_0x62cb('0x2b')](function(_0x25116c){if(_0x25116c){_0x5a590f[_0x62cb('0x58')]['ListId']=_0x25116c['id'];return db[_0x62cb('0x5b')]['create'](_0x5a590f[_0x62cb('0x58')]);}})[_0x62cb('0x2b')](respondWithResult(_0xbb6ca1,null))[_0x62cb('0x4a')](handleError(_0xbb6ca1,null));};exports[_0x62cb('0x5c')]=function(_0x32f085,_0x11bf97,_0x414b63){var _0x4fc2f9={'raw':![],'where':{}};var _0x524977={};var _0x349131={'count':0x0,'rows':[]};return db['CmList'][_0x62cb('0x5d')]({'where':{'id':_0x32f085['params']['id']}})[_0x62cb('0x2b')](handleEntityNotFound(_0x11bf97,null))[_0x62cb('0x2b')](function(_0x2e15ca){if(_0x2e15ca){_0x524977[_0x62cb('0x37')]=_[_0x62cb('0x4d')](db['Disposition'][_0x62cb('0x34')]);_0x524977[_0x62cb('0x38')]=_['keys'](_0x32f085[_0x62cb('0x38')]);_0x524977['filters']=_[_0x62cb('0x3a')](_0x524977[_0x62cb('0x37')],_0x524977[_0x62cb('0x38')]);_0x4fc2f9[_0x62cb('0x3b')]=_['intersection'](_0x524977['model'],qs[_0x62cb('0x3c')](_0x32f085[_0x62cb('0x38')]['fields']));_0x4fc2f9[_0x62cb('0x3b')]=_0x4fc2f9[_0x62cb('0x3b')][_0x62cb('0x3d')]?_0x4fc2f9[_0x62cb('0x3b')]:_0x524977[_0x62cb('0x37')];if(!_0x32f085[_0x62cb('0x38')][_0x62cb('0x3e')](_0x62cb('0x5e'))){_0x4fc2f9[_0x62cb('0x23')]=qs[_0x62cb('0x23')](_0x32f085['query'][_0x62cb('0x23')]);_0x4fc2f9['offset']=qs[_0x62cb('0x21')](_0x32f085['query'][_0x62cb('0x21')]);}_0x4fc2f9[_0x62cb('0x3f')]=qs[_0x62cb('0x40')](_0x32f085[_0x62cb('0x38')][_0x62cb('0x40')]);_0x4fc2f9[_0x62cb('0x45')]=qs['filters'](_[_0x62cb('0x5f')](_0x32f085[_0x62cb('0x38')],_0x524977[_0x62cb('0x39')]));_0x4fc2f9[_0x62cb('0x45')][_0x62cb('0x60')]=_0x2e15ca['id'];if(_0x32f085[_0x62cb('0x38')][_0x62cb('0x41')]){_0x4fc2f9[_0x62cb('0x45')]=_[_0x62cb('0x42')](_0x4fc2f9[_0x62cb('0x45')],{'$or':_[_0x62cb('0x32')](_0x4fc2f9[_0x62cb('0x3b')],function(_0x3e206a){var _0x1b7de3={};_0x1b7de3[_0x3e206a]={'$like':'%'+_0x32f085[_0x62cb('0x38')][_0x62cb('0x41')]+'%'};return _0x1b7de3;})});}_0x4fc2f9=_[_0x62cb('0x42')]({},_0x4fc2f9,_0x32f085['options']);return db['Disposition'][_0x62cb('0x24')]({'where':_0x4fc2f9[_0x62cb('0x45')]})[_0x62cb('0x2b')](function(_0x5abedb){_0x349131[_0x62cb('0x24')]=_0x5abedb;if(_0x32f085[_0x62cb('0x38')]['includeAll']){_0x4fc2f9[_0x62cb('0x47')]=[{'all':!![]}];}return db[_0x62cb('0x5b')][_0x62cb('0x48')](_0x4fc2f9);})[_0x62cb('0x2b')](function(_0x307817){_0x349131[_0x62cb('0x49')]=_0x307817;return _0x349131;});}})['then'](respondWithFilteredResult(_0x11bf97,_0x4fc2f9))[_0x62cb('0x4a')](handleError(_0x11bf97,null));};exports[_0x62cb('0x61')]=function(_0x1489ec,_0x375882,_0xf66e4d){return db[_0x62cb('0x33')]['find']({'where':{'id':_0x1489ec[_0x62cb('0x4c')]['id']}})[_0x62cb('0x2b')](handleEntityNotFound(_0x375882,null))[_0x62cb('0x2b')](function(_0x132785){if(_0x132785){return _0x132785[_0x62cb('0x61')](_0x1489ec[_0x62cb('0x38')][_0x62cb('0x62')]);}})[_0x62cb('0x2b')](respondWithStatusCode(_0x375882,null))[_0x62cb('0x4a')](handleError(_0x375882,null));};exports[_0x62cb('0x63')]=function(_0x2e71ce,_0x3c9c91,_0x354e2c){return db[_0x62cb('0x33')][_0x62cb('0x4e')]({'where':{'id':_0x2e71ce[_0x62cb('0x4c')]['id']}})[_0x62cb('0x2b')](handleEntityNotFound(_0x3c9c91,null))[_0x62cb('0x2b')](function(_0x2ebd47){if(_0x2ebd47){var _0x1ccc88=[];var _0x63659b={'success':[],'errors':[]};return db[_0x62cb('0x64')][_0x62cb('0x59')]()[_0x62cb('0x2b')](function(_0x4ebc6c){if(_0x2e71ce[_0x62cb('0x58')][_0x62cb('0x65')]&&_[_0x62cb('0x66')](_0x2e71ce['body'][_0x62cb('0x65')])){if(_0x2e71ce['body'][_0x62cb('0x65')][_0x62cb('0x3d')]){_0x2e71ce[_0x62cb('0x58')][_0x62cb('0x65')]=_0x2e71ce[_0x62cb('0x58')][_0x62cb('0x65')][_0x62cb('0x67')](';')+';';}else{_0x2e71ce[_0x62cb('0x58')][_0x62cb('0x65')]=null;}}else{_0x2e71ce[_0x62cb('0x58')][_0x62cb('0x65')]=null;}if(_0x2e71ce[_0x62cb('0x58')]&&_[_0x62cb('0x66')](_0x2e71ce[_0x62cb('0x58')])){for(var _0x5ceffc=0x0;_0x5ceffc<_0x2e71ce[_0x62cb('0x58')][_0x62cb('0x3d')];_0x5ceffc+=0x1){_0x2e71ce['body'][_0x5ceffc]['ListId']=_0x2e71ce['params']['id'];_0x1ccc88[_0x62cb('0x68')](_0x2e71ce['body'][_0x5ceffc]);}return BPromise[_0x62cb('0x69')](_0x1ccc88,function(_0x110246){return db[_0x62cb('0x64')][_0x62cb('0x4f')](_[_0x62cb('0x6a')](_0x110246,[_0x62cb('0x62'),'id'])||{},{'fields':_[_0x62cb('0x4d')](_0x4ebc6c),'raw':!![]})[_0x62cb('0x2b')](function(_0x3b06c6){_0x63659b[_0x62cb('0x6b')]['push'](_0x3b06c6[_0x62cb('0x6c')]);})[_0x62cb('0x4a')](function(_0x430f5e){_0x63659b[_0x62cb('0x6d')][_0x62cb('0x68')]({'data':_0x110246,'error':_0x430f5e[_0x62cb('0x6e')]});});})[_0x62cb('0x2b')](function(_0xf7ba04){return _0x63659b;})[_0x62cb('0x4a')](function(_0x1ae0b7){return _0x1ae0b7;});}else{_0x3c9c91['status'](0x190)[_0x62cb('0x20')]({'message':_0x62cb('0x6f')});}});}})[_0x62cb('0x2b')](respondWithResult(_0x3c9c91,null))[_0x62cb('0x4a')](handleError(_0x3c9c91,null));};exports['getContacts']=function(_0x5d67a2,_0x1a3ff3,_0x213041){var _0x5287fc;return db[_0x62cb('0x33')][_0x62cb('0x4e')]({'where':{'id':_0x5d67a2['params']['id']},'include':[{'model':db[_0x62cb('0x70')],'as':'CustomFields'}]})[_0x62cb('0x2b')](handleEntityNotFound(_0x1a3ff3,null))[_0x62cb('0x2b')](function(_0x2832d2){if(_0x2832d2){_0x5287fc=_0x2832d2;return db[_0x62cb('0x64')][_0x62cb('0x34')];}})[_0x62cb('0x2b')](function(_0x4a1ba9){if(_0x4a1ba9){var _0x18263c={};var _0xbbe86a={};_0xbbe86a[_0x62cb('0x37')]=_[_0x62cb('0x71')](_['keys'](_0x4a1ba9),_['map'](_0x5287fc[_0x62cb('0x72')],function(_0x4e762a){return util[_0x62cb('0x73')]('cf_%d',_0x4e762a['id']);}));_0xbbe86a[_0x62cb('0x38')]=_[_0x62cb('0x4d')](_0x5d67a2['query']);_0xbbe86a['filters']=_[_0x62cb('0x3a')](_0xbbe86a['model'],_0xbbe86a['query']);_0x18263c[_0x62cb('0x3b')]=_[_0x62cb('0x3a')](_0xbbe86a[_0x62cb('0x37')],qs[_0x62cb('0x3c')](_0x5d67a2[_0x62cb('0x38')][_0x62cb('0x3c')]));_0x18263c[_0x62cb('0x3b')]=_0x18263c[_0x62cb('0x3b')][_0x62cb('0x3d')]?_0x18263c[_0x62cb('0x3b')]:_0xbbe86a[_0x62cb('0x37')];if(!_0x5d67a2[_0x62cb('0x38')][_0x62cb('0x3e')](_0x62cb('0x5e'))){_0x18263c[_0x62cb('0x23')]=qs[_0x62cb('0x23')](_0x5d67a2[_0x62cb('0x38')][_0x62cb('0x23')]);_0x18263c['offset']=qs[_0x62cb('0x21')](_0x5d67a2[_0x62cb('0x38')][_0x62cb('0x21')]);}_0x18263c[_0x62cb('0x3f')]=qs['sort'](_0x5d67a2[_0x62cb('0x38')][_0x62cb('0x40')]);_0x18263c[_0x62cb('0x45')]=qs[_0x62cb('0x39')](_[_0x62cb('0x5f')](_0x5d67a2[_0x62cb('0x38')],_0xbbe86a[_0x62cb('0x39')]));_0x18263c[_0x62cb('0x74')]=!![];if(_0x5d67a2[_0x62cb('0x38')][_0x62cb('0x41')]){_0x18263c['where']=_['merge'](_0x18263c[_0x62cb('0x45')],{'$or':_['map'](_0x18263c['attributes'],function(_0x3270b6){var _0xeff238={};_0xeff238[_0x3270b6]={'$like':'%'+_0x5d67a2['query'][_0x62cb('0x41')]+'%'};return _0xeff238;})});}_0x18263c=_[_0x62cb('0x42')]({},_0x18263c,_0x5d67a2[_0x62cb('0x44')]);return _0x5287fc[_0x62cb('0x75')](_0x18263c);}})['then'](respondWithResult(_0x1a3ff3,null))[_0x62cb('0x4a')](handleError(_0x1a3ff3,null));};exports['getContactsCsv']=function(_0x4ecc43,_0xe63bf3,_0x50c852){var _0x217789;var _0x474a6f;var _0x139555;var _0x28ede3=_0x4ecc43['params']['id'];csv_results=[];return db['ContactItemType']['findAll']({'attributes':['id',_0x62cb('0x30')],'raw':!![],'order':[_0x62cb('0x76')]})[_0x62cb('0x2b')](function(_0x4057d4){_0x217789=_0x4057d4;var _0x3e235d=_[_0x62cb('0x4d')](db[_0x62cb('0x64')]['rawAttributes']);return db[_0x62cb('0x70')][_0x62cb('0x48')]({'raw':!![],'attributes':['id',_0x62cb('0x77')]})[_0x62cb('0x2b')](function(_0x574ca6){_0x474a6f=_0x574ca6;var _0xf7d7c7=squel['select']()[_0x62cb('0x3c')](_0x3e235d)[_0x62cb('0x78')](_0x62cb('0x79'),'c')[_0x62cb('0x45')](_0x62cb('0x7a'),_0x28ede3)[_0x62cb('0x45')](_0x62cb('0x7b'))[_0x62cb('0x7c')]();for(var _0x5df4e6=0x0;_0x5df4e6<_0x474a6f[_0x62cb('0x3d')];_0x5df4e6++){_0xf7d7c7[_0x62cb('0x7d')](_0x62cb('0x7e')+_0x474a6f[_0x5df4e6]['id'],_0x62cb('0x7f')+_0x474a6f[_0x5df4e6][_0x62cb('0x77')]);}for(var _0x5df4e6=0x0;_0x5df4e6<_0x217789['length'];_0x5df4e6++){_0xf7d7c7['field'](squel[_0x62cb('0x80')]()[_0x62cb('0x7d')](_0x62cb('0x81'))[_0x62cb('0x78')](_0x62cb('0x82'))[_0x62cb('0x45')](_0x62cb('0x83'),_0x217789[_0x5df4e6]['id'])[_0x62cb('0x45')](_0x62cb('0x84')),_0x62cb('0x85')+_0x217789[_0x5df4e6][_0x62cb('0x30')]);_0xf7d7c7['field'](squel[_0x62cb('0x80')]()[_0x62cb('0x7d')]('description')[_0x62cb('0x78')](_0x62cb('0x82'))[_0x62cb('0x45')](_0x62cb('0x83'),_0x217789[_0x5df4e6]['id'])[_0x62cb('0x45')](_0x62cb('0x84')),_0x62cb('0x86')+_0x217789[_0x5df4e6]['name']);}var _0x311a40=[];_0x311a40[_0x62cb('0x68')](_0xf7d7c7[_0x62cb('0x87')]());BPromise['each'](_0x311a40,handleQuery)[_0x62cb('0x2b')](function(_0x1f45bb){handleQuery(_0xf7d7c7[_0x62cb('0x87')]());var _0x4c2eb5=csv_results[0x0];if(!_['isEmpty'](_0x4c2eb5)){var _0x1c56db=toCsv(_0x4c2eb5);var _0x476335=Date[_0x62cb('0x88')]();fs['writeFileSync'](util['format'](_0x62cb('0x89'),_0x28ede3,_0x476335),_0x1c56db);_0xe63bf3[_0x62cb('0x8a')](_0x62cb('0x8b'),_0x62cb('0x8c')+util[_0x62cb('0x73')](_0x62cb('0x8d'),_0x28ede3,_0x476335));_0xe63bf3[_0x62cb('0x8a')](_0x62cb('0x8e'),_0x62cb('0x8f'));return _0xe63bf3['download'](util[_0x62cb('0x73')](_0x62cb('0x89'),_0x28ede3,_0x476335));}else{return _0xe63bf3[_0x62cb('0x1e')](0xcc);}});});});};exports['addCustomField']=function(_0x15ffb8,_0x33424e,_0x554b30){var _0x218777;delete _0x15ffb8[_0x62cb('0x58')]['id'];return db['CmList'][_0x62cb('0x5d')]({'where':{'id':_0x15ffb8[_0x62cb('0x4c')]['id']}})[_0x62cb('0x2b')](handleEntityNotFound(_0x33424e,null))[_0x62cb('0x2b')](function(_0x33b86a){if(_0x33b86a){return db[_0x62cb('0x90')]['transaction'](function(_0x591fbd){return db[_0x62cb('0x70')][_0x62cb('0x4f')](_0x15ffb8['body'],{'transaction':_0x591fbd})['then'](function(_0x5ea886){_0x218777=_0x5ea886;return _0x33b86a[_0x62cb('0x91')](_0x5ea886,{'transaction':_0x591fbd});})[_0x62cb('0x2b')](function(){var _0x167fc9={'type':db['Sequelize'][_0x62cb('0x92')],'transaction':_0x591fbd};switch(_0x15ffb8['body'][_0x62cb('0x43')]){case _0x62cb('0x93'):_0x167fc9[_0x62cb('0x43')]=db['Sequelize']['TEXT'];break;case _0x62cb('0x94'):_0x167fc9[_0x62cb('0x43')]=db['Sequelize'][_0x62cb('0x95')];break;case _0x62cb('0x96'):_0x167fc9[_0x62cb('0x43')]=db[_0x62cb('0x97')][_0x62cb('0x98')];_0x167fc9[_0x62cb('0x99')]=![];break;default:}return db['sequelize'][_0x62cb('0x9a')]['addColumn'](_0x62cb('0x79'),util[_0x62cb('0x73')](_0x62cb('0x9b'),_0x218777['id']),_0x167fc9);})['then'](function(){return _0x218777;});});}})[_0x62cb('0x2b')](respondWithResult(_0x33424e,null))[_0x62cb('0x4a')](handleError(_0x33424e,null));};exports[_0x62cb('0x9c')]=function(_0x1dc021,_0x1badb1,_0x6d4bf){var _0xb87245={};var _0x418e69={};var _0x2fc10d;var _0x3828c9;return db[_0x62cb('0x33')]['findOne']({'where':{'id':_0x1dc021[_0x62cb('0x4c')]['id']}})[_0x62cb('0x2b')](handleEntityNotFound(_0x1badb1,null))[_0x62cb('0x2b')](function(_0xe627c3){if(_0xe627c3){_0x2fc10d=_0xe627c3;_0x418e69[_0x62cb('0x37')]=_[_0x62cb('0x4d')](db[_0x62cb('0x70')][_0x62cb('0x34')]);_0x418e69[_0x62cb('0x38')]=_[_0x62cb('0x4d')](_0x1dc021[_0x62cb('0x38')]);_0x418e69[_0x62cb('0x39')]=_[_0x62cb('0x3a')](_0x418e69[_0x62cb('0x37')],_0x418e69[_0x62cb('0x38')]);_0xb87245[_0x62cb('0x3b')]=_['intersection'](_0x418e69[_0x62cb('0x37')],qs['fields'](_0x1dc021[_0x62cb('0x38')][_0x62cb('0x3c')]));_0xb87245['attributes']=_0xb87245['attributes'][_0x62cb('0x3d')]?_0xb87245['attributes']:_0x418e69['model'];_0xb87245[_0x62cb('0x3f')]=qs['sort'](_0x1dc021['query']['sort']);_0xb87245[_0x62cb('0x45')]=qs[_0x62cb('0x39')](_['pick'](_0x1dc021[_0x62cb('0x38')],_0x418e69[_0x62cb('0x39')]));_0xb87245[_0x62cb('0x45')]=_[_0x62cb('0x42')](_0xb87245['where'],{'$or':[{'ListId':_0xe627c3['id']},{'ListId':null}]});if(_0x1dc021[_0x62cb('0x38')]['filter']){_0xb87245[_0x62cb('0x45')]=_['merge'](_0xb87245[_0x62cb('0x45')],{'$or':_['map'](_0xb87245[_0x62cb('0x3b')],function(_0x22c078){var _0x30f82f={};_0x30f82f[_0x22c078]={'$like':'%'+_0x1dc021[_0x62cb('0x38')][_0x62cb('0x41')]+'%'};return _0x30f82f;})});}_0xb87245=_[_0x62cb('0x42')]({},_0xb87245,_0x1dc021[_0x62cb('0x44')]);return db['CmCustomField'][_0x62cb('0x9d')](_0xb87245);}})[_0x62cb('0x2b')](respondWithResult(_0x1badb1,null))['catch'](handleError(_0x1badb1,null));};exports[_0x62cb('0x9e')]=function(_0x256226,_0x1ddbd2){return db[_0x62cb('0x70')][_0x62cb('0x9d')]({'where':{'ListId':null}})[_0x62cb('0x2b')](handleEntityNotFound(_0x1ddbd2,null))[_0x62cb('0x2b')](function(_0x426485){return _0x426485;})[_0x62cb('0x2b')](respondWithResult(_0x1ddbd2,null))['catch'](handleError(_0x1ddbd2,null));};exports[_0x62cb('0x9f')]=function(_0x55a2eb,_0x370d60,_0x48a5ec){return db['CmList'][_0x62cb('0x4e')]({'where':{'id':_0x55a2eb['params']['id']}})[_0x62cb('0x2b')](handleEntityNotFound(_0x370d60,null))[_0x62cb('0x2b')](function(_0x5221b9){if(_0x5221b9){return _0x5221b9[_0x62cb('0x9f')](_0x55a2eb['body'][_0x62cb('0x62')],_['omit'](_0x55a2eb[_0x62cb('0x58')],[_0x62cb('0x62'),'id'])||{})['spread'](function(_0x508e29){for(var _0x160edc=0x0;_0x160edc<_0x55a2eb['body'][_0x62cb('0x62')][_0x62cb('0x3d')];_0x160edc+=0x1){socket['emit'](_0x62cb('0xa0'),{'UserId':Number(_0x55a2eb[_0x62cb('0x58')][_0x62cb('0x62')][_0x160edc]),'CmListId':Number(_0x55a2eb['params']['id'])});}return _0x508e29;});}})['then'](respondWithResult(_0x370d60,null))[_0x62cb('0x4a')](handleError(_0x370d60,null));};exports[_0x62cb('0xa1')]=function(_0xf07cc3,_0x3b5273,_0x5d96a9){return db[_0x62cb('0x33')][_0x62cb('0x4e')]({'where':{'id':_0xf07cc3[_0x62cb('0x4c')]['id']}})[_0x62cb('0x2b')](handleEntityNotFound(_0x3b5273,null))[_0x62cb('0x2b')](function(_0x5c5bea){if(_0x5c5bea){return _0x5c5bea['removeAgents'](_0xf07cc3['query']['ids'])[_0x62cb('0x2b')](function(){if(_[_0x62cb('0x66')](_0xf07cc3[_0x62cb('0x38')][_0x62cb('0x62')])){for(var _0x3bbe9c=0x0;_0x3bbe9c<_0xf07cc3['query'][_0x62cb('0x62')][_0x62cb('0x3d')];_0x3bbe9c+=0x1){socket['emit'](_0x62cb('0xa2'),{'UserId':Number(_0xf07cc3[_0x62cb('0x38')]['ids'][_0x3bbe9c]),'CmListId':Number(_0xf07cc3['params']['id'])});}}else{socket['emit'](_0x62cb('0xa2'),{'UserId':Number(_0xf07cc3[_0x62cb('0x38')]['ids']),'CmListId':Number(_0xf07cc3[_0x62cb('0x4c')]['id'])});}});}})[_0x62cb('0x2b')](respondWithStatusCode(_0x3b5273,null))['catch'](handleError(_0x3b5273,null));};exports[_0x62cb('0xa3')]=function(_0x157136,_0x11b24c,_0x490809){var _0x31cb26={};var _0x2feb4d={};var _0x4cccb3;var _0x54bd41;return db['CmList'][_0x62cb('0x5d')]({'where':{'id':_0x157136['params']['id']}})[_0x62cb('0x2b')](handleEntityNotFound(_0x11b24c,null))[_0x62cb('0x2b')](function(_0x1e4f37){if(_0x1e4f37){_0x4cccb3=_0x1e4f37;_0x2feb4d[_0x62cb('0x37')]=_[_0x62cb('0x4d')](db['User'][_0x62cb('0x34')]);_0x2feb4d[_0x62cb('0x38')]=_['keys'](_0x157136[_0x62cb('0x38')]);_0x2feb4d[_0x62cb('0x39')]=_[_0x62cb('0x3a')](_0x2feb4d[_0x62cb('0x37')],_0x2feb4d[_0x62cb('0x38')]);_0x31cb26[_0x62cb('0x3b')]=_[_0x62cb('0x3a')](_0x2feb4d[_0x62cb('0x37')],qs[_0x62cb('0x3c')](_0x157136[_0x62cb('0x38')][_0x62cb('0x3c')]));_0x31cb26[_0x62cb('0x3b')]=_0x31cb26[_0x62cb('0x3b')][_0x62cb('0x3d')]?_0x31cb26[_0x62cb('0x3b')]:_0x2feb4d[_0x62cb('0x37')];_0x31cb26[_0x62cb('0x3f')]=qs['sort'](_0x157136[_0x62cb('0x38')][_0x62cb('0x40')]);_0x31cb26[_0x62cb('0x45')]=qs[_0x62cb('0x39')](_['pick'](_0x157136[_0x62cb('0x38')],_0x2feb4d[_0x62cb('0x39')]));if(_0x157136['query']['filter']){_0x31cb26[_0x62cb('0x45')]=_['merge'](_0x31cb26[_0x62cb('0x45')],{'$or':_[_0x62cb('0x32')](_0x31cb26['attributes'],function(_0x561473){var _0x14721a={};_0x14721a[_0x561473]={'$like':'%'+_0x157136[_0x62cb('0x38')][_0x62cb('0x41')]+'%'};return _0x14721a;})});}_0x31cb26=_[_0x62cb('0x42')]({},_0x31cb26,_0x157136[_0x62cb('0x44')]);return _0x4cccb3[_0x62cb('0xa3')](_0x31cb26);}})[_0x62cb('0x2b')](function(_0x4c7b53){if(_0x4c7b53){_0x54bd41=_0x4c7b53[_0x62cb('0x3d')];if(!_0x157136['query'][_0x62cb('0x3e')](_0x62cb('0x5e'))){_0x31cb26[_0x62cb('0x23')]=qs[_0x62cb('0x23')](_0x157136[_0x62cb('0x38')][_0x62cb('0x23')]);_0x31cb26[_0x62cb('0x21')]=qs[_0x62cb('0x21')](_0x157136['query'][_0x62cb('0x21')]);}return _0x4cccb3[_0x62cb('0xa3')](_0x31cb26);}})['then'](function(_0x336e93){if(_0x336e93){return _0x336e93?{'count':_0x54bd41,'rows':_0x336e93}:null;}})[_0x62cb('0x2b')](respondWithResult(_0x11b24c,null))[_0x62cb('0x4a')](handleError(_0x11b24c,null));};function handleQuery(_0x14e4bc){logger[_0x62cb('0xa4')](_0x14e4bc);return db[_0x62cb('0x90')][_0x62cb('0x38')](_0x14e4bc)['spread'](function(_0x5b41b5){csv_results[_0x62cb('0x68')](_0x5b41b5);})[_0x62cb('0x4a')](function(_0x47ecbd){logger['error'](_0x47ecbd[_0x62cb('0x6e')]);});} \ No newline at end of file +var _0xdd52=['getContactsCsv','ContactItemType','OrderBy','alias','select','from','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','distinct','field','c.cf_','customField_','item','cm_contact_has_items','CmContactId\x20=\x20c.id','additionalPhone_','ItemTypeId\x20=\x20?','description_additionalPhone_','toString','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','download','addCustomField','findOne','sequelize','addCustomFields','text','Sequelize','TEXT','INTEGER','switch','defaultValue','queryInterface','addColumn','cm_contacts','cf_%s','getCustomFields','getGlobalCustomFields','findAndCountAll','addAgents','ids','spread','userCmList:save','removeAgents','emit','userCmList:remove','getAgents','User','info','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./cmList.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','then','destroy','get','Lists','UserProfileResource','name','send','index','CmList','rawAttributes','fieldName','type','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','map','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','addDisposition','ListId','getDispositions','nolimit','merge','Disposition','rows','removeDispositions','addContacts','CmContact','describe','tags','isArray','join','push','each','omit','success','dataValues','errors','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','format','cf_%d','raw'];(function(_0x3412e0,_0x5c4e4f){var _0x479b68=function(_0x23028d){while(--_0x23028d){_0x3412e0['push'](_0x3412e0['shift']());}};_0x479b68(++_0x5c4e4f);}(_0xdd52,0xe2));var _0x2dd5=function(_0x505f3d,_0x11dede){_0x505f3d=_0x505f3d-0x0;var _0x2de304=_0xdd52[_0x505f3d];return _0x2de304;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2dd5('0x0'));var rp=require(_0x2dd5('0x1'));var moment=require(_0x2dd5('0x2'));var BPromise=require(_0x2dd5('0x3'));var Mustache=require(_0x2dd5('0x4'));var util=require('util');var path=require(_0x2dd5('0x5'));var sox=require(_0x2dd5('0x6'));var csv=require(_0x2dd5('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2dd5('0x8'));var _=require(_0x2dd5('0x9'));var squel=require(_0x2dd5('0xa'));var crypto=require(_0x2dd5('0xb'));var jsforce=require(_0x2dd5('0xc'));var deskjs=require(_0x2dd5('0xd'));var toCsv=require(_0x2dd5('0x7'));var querystring=require(_0x2dd5('0xe'));var Papa=require(_0x2dd5('0xf'));var Redis=require(_0x2dd5('0x10'));var authService=require(_0x2dd5('0x11'));var qs=require(_0x2dd5('0x12'));var as=require(_0x2dd5('0x13'));var hardwareService=require(_0x2dd5('0x14'));var logger=require(_0x2dd5('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x2dd5('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x2dd5('0x17'))['db'];var csv_results;config['redis']=_[_0x2dd5('0x18')](config['redis'],{'host':_0x2dd5('0x19'),'port':0x18eb});var socket=require(_0x2dd5('0x1a'))(new Redis(config[_0x2dd5('0x1b')]));require(_0x2dd5('0x1c'))[_0x2dd5('0x1d')](socket);function respondWithStatusCode(_0x2600d3,_0x320ba6){_0x320ba6=_0x320ba6||0xcc;return function(_0x31828c){if(_0x31828c){return _0x2600d3[_0x2dd5('0x1e')](_0x320ba6);}return _0x2600d3[_0x2dd5('0x1f')](_0x320ba6)[_0x2dd5('0x20')]();};}function respondWithResult(_0x1106a8,_0x1a64b4){_0x1a64b4=_0x1a64b4||0xc8;return function(_0x51ade1){if(_0x51ade1){return _0x1106a8[_0x2dd5('0x1f')](_0x1a64b4)[_0x2dd5('0x21')](_0x51ade1);}};}function respondWithFilteredResult(_0x1bfc49,_0x39170a){return function(_0x2384d3){if(_0x2384d3){var _0x585f36=typeof _0x39170a[_0x2dd5('0x22')]===_0x2dd5('0x23')&&typeof _0x39170a['limit']==='undefined';var _0x3b4899=_0x2384d3[_0x2dd5('0x24')];var _0x4054c0=_0x585f36?0x0:_0x39170a[_0x2dd5('0x22')];var _0x25750e=_0x585f36?_0x2384d3['count']:_0x39170a[_0x2dd5('0x22')]+_0x39170a[_0x2dd5('0x25')];var _0x3b3c50;if(_0x25750e>=_0x3b4899){_0x25750e=_0x3b4899;_0x3b3c50=0xc8;}else{_0x3b3c50=0xce;}_0x1bfc49['status'](_0x3b3c50);return _0x1bfc49[_0x2dd5('0x26')](_0x2dd5('0x27'),_0x4054c0+'-'+_0x25750e+'/'+_0x3b4899)[_0x2dd5('0x21')](_0x2384d3);}return null;};}function patchUpdates(_0x1e6b06){return function(_0x11f1a7){try{jsonpatch['apply'](_0x11f1a7,_0x1e6b06,!![]);}catch(_0x469aa2){return BPromise[_0x2dd5('0x28')](_0x469aa2);}return _0x11f1a7[_0x2dd5('0x29')]();};}function saveUpdates(_0x431bf3,_0x180fa5){return function(_0x19b42b){if(_0x19b42b){return _0x19b42b['update'](_0x431bf3)[_0x2dd5('0x2a')](function(_0x13dc2c){return _0x13dc2c;});}return null;};}function removeEntity(_0x50d75d,_0x8bcc0){return function(_0x560cd2){if(_0x560cd2){return _0x560cd2[_0x2dd5('0x2b')]()[_0x2dd5('0x2a')](function(){var _0x1c191f=_0x560cd2[_0x2dd5('0x2c')]({'plain':!![]});var _0x5e2aad=_0x2dd5('0x2d');return db[_0x2dd5('0x2e')][_0x2dd5('0x2b')]({'where':{'type':_0x5e2aad,'resourceId':_0x1c191f['id']}})[_0x2dd5('0x2a')](function(){return _0x560cd2;});})[_0x2dd5('0x2a')](function(){_0x50d75d[_0x2dd5('0x1f')](0xcc)[_0x2dd5('0x20')]();});}};}function handleEntityNotFound(_0x367082,_0x2c864e){return function(_0x4b2c14){if(!_0x4b2c14){_0x367082['sendStatus'](0x194);}return _0x4b2c14;};}function handleError(_0x50094a,_0x354a28){_0x354a28=_0x354a28||0x1f4;return function(_0x3fe42b){logger['error'](_0x3fe42b['stack']);if(_0x3fe42b['name']){delete _0x3fe42b[_0x2dd5('0x2f')];}_0x50094a['status'](_0x354a28)[_0x2dd5('0x30')](_0x3fe42b);};}exports[_0x2dd5('0x31')]=function(_0x51af94,_0x569b78){var _0x34d604={},_0x306f6a={},_0x5d38ff={'count':0x0,'rows':[]};var _0x7c4bff=_['map'](db[_0x2dd5('0x32')][_0x2dd5('0x33')],function(_0x42bb86){return{'name':_0x42bb86[_0x2dd5('0x34')],'type':_0x42bb86[_0x2dd5('0x35')]['key']};});_0x306f6a[_0x2dd5('0x36')]=_['map'](_0x7c4bff,'name');_0x306f6a[_0x2dd5('0x37')]=_[_0x2dd5('0x38')](_0x51af94[_0x2dd5('0x37')]);_0x306f6a['filters']=_[_0x2dd5('0x39')](_0x306f6a['model'],_0x306f6a[_0x2dd5('0x37')]);_0x34d604['attributes']=_[_0x2dd5('0x39')](_0x306f6a[_0x2dd5('0x36')],qs[_0x2dd5('0x3a')](_0x51af94[_0x2dd5('0x37')][_0x2dd5('0x3a')]));_0x34d604[_0x2dd5('0x3b')]=_0x34d604[_0x2dd5('0x3b')][_0x2dd5('0x3c')]?_0x34d604['attributes']:_0x306f6a[_0x2dd5('0x36')];if(!_0x51af94[_0x2dd5('0x37')][_0x2dd5('0x3d')]('nolimit')){_0x34d604['limit']=qs[_0x2dd5('0x25')](_0x51af94[_0x2dd5('0x37')][_0x2dd5('0x25')]);_0x34d604['offset']=qs[_0x2dd5('0x22')](_0x51af94[_0x2dd5('0x37')][_0x2dd5('0x22')]);}_0x34d604[_0x2dd5('0x3e')]=qs[_0x2dd5('0x3f')](_0x51af94[_0x2dd5('0x37')][_0x2dd5('0x3f')]);_0x34d604[_0x2dd5('0x40')]=qs[_0x2dd5('0x41')](_[_0x2dd5('0x42')](_0x51af94['query'],_0x306f6a[_0x2dd5('0x41')]),_0x7c4bff);if(_0x51af94[_0x2dd5('0x37')]['filter']){_0x34d604[_0x2dd5('0x40')]=_['merge'](_0x34d604[_0x2dd5('0x40')],{'$or':_[_0x2dd5('0x43')](_0x7c4bff,function(_0x2f5ad6){if(_0x2f5ad6[_0x2dd5('0x35')]!==_0x2dd5('0x44')){var _0x4dcf6d={};_0x4dcf6d[_0x2f5ad6[_0x2dd5('0x2f')]]={'$like':'%'+_0x51af94[_0x2dd5('0x37')][_0x2dd5('0x45')]+'%'};return _0x4dcf6d;}})});}_0x34d604=_['merge']({},_0x34d604,_0x51af94[_0x2dd5('0x46')]);var _0x783879={'where':_0x34d604[_0x2dd5('0x40')]};return db[_0x2dd5('0x32')][_0x2dd5('0x24')](_0x783879)[_0x2dd5('0x2a')](function(_0x1ab3ad){_0x5d38ff[_0x2dd5('0x24')]=_0x1ab3ad;if(_0x51af94[_0x2dd5('0x37')][_0x2dd5('0x47')]){_0x34d604[_0x2dd5('0x48')]=[{'all':!![]}];}return db[_0x2dd5('0x32')][_0x2dd5('0x49')](_0x34d604);})[_0x2dd5('0x2a')](function(_0x25edd2){_0x5d38ff['rows']=_0x25edd2;return _0x5d38ff;})[_0x2dd5('0x2a')](respondWithFilteredResult(_0x569b78,_0x34d604))[_0x2dd5('0x4a')](handleError(_0x569b78,null));};exports[_0x2dd5('0x4b')]=function(_0x56420d,_0x6af0ca){var _0x431fad={'raw':![],'where':{'id':_0x56420d['params']['id']}},_0x5140d8={};_0x5140d8[_0x2dd5('0x36')]=_['keys'](db[_0x2dd5('0x32')]['rawAttributes']);_0x5140d8[_0x2dd5('0x37')]=_[_0x2dd5('0x38')](_0x56420d[_0x2dd5('0x37')]);_0x5140d8['filters']=_[_0x2dd5('0x39')](_0x5140d8[_0x2dd5('0x36')],_0x5140d8['query']);_0x431fad[_0x2dd5('0x3b')]=_[_0x2dd5('0x39')](_0x5140d8[_0x2dd5('0x36')],qs[_0x2dd5('0x3a')](_0x56420d[_0x2dd5('0x37')][_0x2dd5('0x3a')]));_0x431fad['attributes']=_0x431fad['attributes'][_0x2dd5('0x3c')]?_0x431fad[_0x2dd5('0x3b')]:_0x5140d8[_0x2dd5('0x36')];if(_0x56420d[_0x2dd5('0x37')][_0x2dd5('0x47')]){_0x431fad[_0x2dd5('0x48')]=[{'all':!![]}];}_0x431fad=_['merge']({},_0x431fad,_0x56420d['options']);return db['CmList'][_0x2dd5('0x4c')](_0x431fad)['then'](handleEntityNotFound(_0x6af0ca,null))[_0x2dd5('0x2a')](respondWithResult(_0x6af0ca,null))[_0x2dd5('0x4a')](handleError(_0x6af0ca,null));};exports[_0x2dd5('0x4d')]=function(_0xa9369b,_0x2ba5e9){return db[_0x2dd5('0x32')][_0x2dd5('0x4d')](_0xa9369b[_0x2dd5('0x4e')],{})['then'](function(_0xee1140){var _0x5ab91b=_0xa9369b[_0x2dd5('0x4f')]['get']({'plain':!![]});if(!_0x5ab91b)throw new Error(_0x2dd5('0x50'));if(_0x5ab91b['role']==='user'){var _0xbeea70=_0xee1140[_0x2dd5('0x2c')]({'plain':!![]});var _0x22f3e7='Lists';return db[_0x2dd5('0x51')][_0x2dd5('0x4c')]({'where':{'name':_0x22f3e7,'userProfileId':_0x5ab91b['userProfileId']},'raw':!![]})[_0x2dd5('0x2a')](function(_0x1aebd6){if(_0x1aebd6&&_0x1aebd6['autoAssociation']===0x0){return db[_0x2dd5('0x2e')][_0x2dd5('0x4d')]({'name':_0xbeea70[_0x2dd5('0x2f')],'resourceId':_0xbeea70['id'],'type':_0x1aebd6[_0x2dd5('0x2f')],'sectionId':_0x1aebd6['id']},{})[_0x2dd5('0x2a')](function(){return _0xee1140;});}else{return _0xee1140;}})[_0x2dd5('0x4a')](function(_0x2ad09b){logger[_0x2dd5('0x52')](_0x2dd5('0x53'),_0x2ad09b);throw _0x2ad09b;});}return _0xee1140;})[_0x2dd5('0x2a')](respondWithResult(_0x2ba5e9,0xc9))[_0x2dd5('0x4a')](handleError(_0x2ba5e9,null));};exports[_0x2dd5('0x54')]=function(_0x455c06,_0x4a87eb){if(_0x455c06[_0x2dd5('0x4e')]['id']){delete _0x455c06[_0x2dd5('0x4e')]['id'];}return db['CmList'][_0x2dd5('0x4c')]({'where':{'id':_0x455c06[_0x2dd5('0x55')]['id']}})[_0x2dd5('0x2a')](handleEntityNotFound(_0x4a87eb,null))[_0x2dd5('0x2a')](saveUpdates(_0x455c06['body'],null))[_0x2dd5('0x2a')](respondWithResult(_0x4a87eb,null))[_0x2dd5('0x4a')](handleError(_0x4a87eb,null));};exports[_0x2dd5('0x2b')]=function(_0x50fa0b,_0x18eac8){return db['CmList'][_0x2dd5('0x4c')]({'where':{'id':_0x50fa0b['params']['id']}})[_0x2dd5('0x2a')](handleEntityNotFound(_0x18eac8,null))[_0x2dd5('0x2a')](removeEntity(_0x18eac8,null))[_0x2dd5('0x4a')](handleError(_0x18eac8,null));};exports['describe']=function(_0x161a4e,_0x5a010b){return db[_0x2dd5('0x32')]['describe']()[_0x2dd5('0x2a')](respondWithResult(_0x5a010b,null))[_0x2dd5('0x4a')](handleError(_0x5a010b,null));};exports[_0x2dd5('0x56')]=function(_0x249945,_0x39b3ca,_0x530806){if(_0x249945[_0x2dd5('0x4e')]['id']){delete _0x249945[_0x2dd5('0x4e')]['id'];}return db[_0x2dd5('0x32')]['find']({'where':{'id':_0x249945[_0x2dd5('0x55')]['id']}})[_0x2dd5('0x2a')](handleEntityNotFound(_0x39b3ca,null))[_0x2dd5('0x2a')](function(_0x316156){if(_0x316156){_0x249945[_0x2dd5('0x4e')][_0x2dd5('0x57')]=_0x316156['id'];return db['Disposition'][_0x2dd5('0x4d')](_0x249945[_0x2dd5('0x4e')]);}})[_0x2dd5('0x2a')](respondWithResult(_0x39b3ca,null))['catch'](handleError(_0x39b3ca,null));};exports[_0x2dd5('0x58')]=function(_0x21823f,_0x2cfdc3,_0x1bf904){var _0x548008={'raw':![],'where':{}};var _0x4dc1c1={};var _0xd11648={'count':0x0,'rows':[]};return db[_0x2dd5('0x32')]['findOne']({'where':{'id':_0x21823f[_0x2dd5('0x55')]['id']}})[_0x2dd5('0x2a')](handleEntityNotFound(_0x2cfdc3,null))['then'](function(_0x402293){if(_0x402293){_0x4dc1c1[_0x2dd5('0x36')]=_[_0x2dd5('0x38')](db['Disposition'][_0x2dd5('0x33')]);_0x4dc1c1[_0x2dd5('0x37')]=_[_0x2dd5('0x38')](_0x21823f['query']);_0x4dc1c1[_0x2dd5('0x41')]=_[_0x2dd5('0x39')](_0x4dc1c1[_0x2dd5('0x36')],_0x4dc1c1['query']);_0x548008[_0x2dd5('0x3b')]=_[_0x2dd5('0x39')](_0x4dc1c1[_0x2dd5('0x36')],qs[_0x2dd5('0x3a')](_0x21823f[_0x2dd5('0x37')]['fields']));_0x548008[_0x2dd5('0x3b')]=_0x548008['attributes'][_0x2dd5('0x3c')]?_0x548008[_0x2dd5('0x3b')]:_0x4dc1c1['model'];if(!_0x21823f[_0x2dd5('0x37')][_0x2dd5('0x3d')](_0x2dd5('0x59'))){_0x548008[_0x2dd5('0x25')]=qs[_0x2dd5('0x25')](_0x21823f['query']['limit']);_0x548008[_0x2dd5('0x22')]=qs[_0x2dd5('0x22')](_0x21823f[_0x2dd5('0x37')][_0x2dd5('0x22')]);}_0x548008['order']=qs[_0x2dd5('0x3f')](_0x21823f['query']['sort']);_0x548008[_0x2dd5('0x40')]=qs['filters'](_[_0x2dd5('0x42')](_0x21823f[_0x2dd5('0x37')],_0x4dc1c1[_0x2dd5('0x41')]));_0x548008[_0x2dd5('0x40')][_0x2dd5('0x57')]=_0x402293['id'];if(_0x21823f[_0x2dd5('0x37')][_0x2dd5('0x45')]){_0x548008[_0x2dd5('0x40')]=_[_0x2dd5('0x5a')](_0x548008['where'],{'$or':_[_0x2dd5('0x43')](_0x548008[_0x2dd5('0x3b')],function(_0x386ee8){var _0x45d726={};_0x45d726[_0x386ee8]={'$like':'%'+_0x21823f['query'][_0x2dd5('0x45')]+'%'};return _0x45d726;})});}_0x548008=_['merge']({},_0x548008,_0x21823f[_0x2dd5('0x46')]);return db[_0x2dd5('0x5b')]['count']({'where':_0x548008[_0x2dd5('0x40')]})[_0x2dd5('0x2a')](function(_0x1e7e43){_0xd11648[_0x2dd5('0x24')]=_0x1e7e43;if(_0x21823f[_0x2dd5('0x37')][_0x2dd5('0x47')]){_0x548008[_0x2dd5('0x48')]=[{'all':!![]}];}return db[_0x2dd5('0x5b')][_0x2dd5('0x49')](_0x548008);})['then'](function(_0x1b1c56){_0xd11648[_0x2dd5('0x5c')]=_0x1b1c56;return _0xd11648;});}})['then'](respondWithFilteredResult(_0x2cfdc3,_0x548008))[_0x2dd5('0x4a')](handleError(_0x2cfdc3,null));};exports[_0x2dd5('0x5d')]=function(_0x30b6d7,_0x395f74,_0x252803){return db[_0x2dd5('0x32')][_0x2dd5('0x4c')]({'where':{'id':_0x30b6d7[_0x2dd5('0x55')]['id']}})[_0x2dd5('0x2a')](handleEntityNotFound(_0x395f74,null))['then'](function(_0x4ef20d){if(_0x4ef20d){return _0x4ef20d[_0x2dd5('0x5d')](_0x30b6d7[_0x2dd5('0x37')]['ids']);}})['then'](respondWithStatusCode(_0x395f74,null))[_0x2dd5('0x4a')](handleError(_0x395f74,null));};exports[_0x2dd5('0x5e')]=function(_0x1c97e0,_0x55ae51,_0x15d68e){return db[_0x2dd5('0x32')][_0x2dd5('0x4c')]({'where':{'id':_0x1c97e0[_0x2dd5('0x55')]['id']}})['then'](handleEntityNotFound(_0x55ae51,null))[_0x2dd5('0x2a')](function(_0x3c2d1c){if(_0x3c2d1c){var _0x268f49=[];var _0x1ebf89={'success':[],'errors':[]};return db[_0x2dd5('0x5f')][_0x2dd5('0x60')]()[_0x2dd5('0x2a')](function(_0x5d6275){if(_0x1c97e0[_0x2dd5('0x4e')][_0x2dd5('0x61')]&&_[_0x2dd5('0x62')](_0x1c97e0[_0x2dd5('0x4e')][_0x2dd5('0x61')])){if(_0x1c97e0[_0x2dd5('0x4e')]['tags'][_0x2dd5('0x3c')]){_0x1c97e0[_0x2dd5('0x4e')][_0x2dd5('0x61')]=_0x1c97e0['body'][_0x2dd5('0x61')][_0x2dd5('0x63')](';')+';';}else{_0x1c97e0[_0x2dd5('0x4e')][_0x2dd5('0x61')]=null;}}else{_0x1c97e0[_0x2dd5('0x4e')][_0x2dd5('0x61')]=null;}if(_0x1c97e0['body']&&_['isArray'](_0x1c97e0[_0x2dd5('0x4e')])){for(var _0x24b297=0x0;_0x24b297<_0x1c97e0['body'][_0x2dd5('0x3c')];_0x24b297+=0x1){_0x1c97e0['body'][_0x24b297]['ListId']=_0x1c97e0['params']['id'];_0x268f49[_0x2dd5('0x64')](_0x1c97e0[_0x2dd5('0x4e')][_0x24b297]);}return BPromise[_0x2dd5('0x65')](_0x268f49,function(_0x4eeb1a){return db[_0x2dd5('0x5f')]['create'](_[_0x2dd5('0x66')](_0x4eeb1a,['ids','id'])||{},{'fields':_[_0x2dd5('0x38')](_0x5d6275),'raw':!![]})[_0x2dd5('0x2a')](function(_0x21d963){_0x1ebf89[_0x2dd5('0x67')][_0x2dd5('0x64')](_0x21d963[_0x2dd5('0x68')]);})['catch'](function(_0x44a299){_0x1ebf89[_0x2dd5('0x69')]['push']({'data':_0x4eeb1a,'error':_0x44a299[_0x2dd5('0x6a')]});});})['then'](function(_0x228332){return _0x1ebf89;})[_0x2dd5('0x4a')](function(_0x3a6269){return _0x3a6269;});}else{_0x55ae51[_0x2dd5('0x1f')](0x190)[_0x2dd5('0x21')]({'message':_0x2dd5('0x6b')});}});}})[_0x2dd5('0x2a')](respondWithResult(_0x55ae51,null))[_0x2dd5('0x4a')](handleError(_0x55ae51,null));};exports[_0x2dd5('0x6c')]=function(_0x38f97f,_0x1252e2,_0x35ce9f){var _0xb77f4b;return db[_0x2dd5('0x32')][_0x2dd5('0x4c')]({'where':{'id':_0x38f97f['params']['id']},'include':[{'model':db[_0x2dd5('0x6d')],'as':_0x2dd5('0x6e')}]})[_0x2dd5('0x2a')](handleEntityNotFound(_0x1252e2,null))['then'](function(_0x4ad6d4){if(_0x4ad6d4){_0xb77f4b=_0x4ad6d4;return db[_0x2dd5('0x5f')][_0x2dd5('0x33')];}})['then'](function(_0x395f37){if(_0x395f37){var _0x34ee15={};var _0x1c3ab9={};_0x1c3ab9[_0x2dd5('0x36')]=_['concat'](_[_0x2dd5('0x38')](_0x395f37),_['map'](_0xb77f4b['CustomFields'],function(_0x1beccb){return util[_0x2dd5('0x6f')](_0x2dd5('0x70'),_0x1beccb['id']);}));_0x1c3ab9[_0x2dd5('0x37')]=_[_0x2dd5('0x38')](_0x38f97f[_0x2dd5('0x37')]);_0x1c3ab9[_0x2dd5('0x41')]=_['intersection'](_0x1c3ab9['model'],_0x1c3ab9[_0x2dd5('0x37')]);_0x34ee15[_0x2dd5('0x3b')]=_[_0x2dd5('0x39')](_0x1c3ab9['model'],qs['fields'](_0x38f97f[_0x2dd5('0x37')][_0x2dd5('0x3a')]));_0x34ee15[_0x2dd5('0x3b')]=_0x34ee15[_0x2dd5('0x3b')][_0x2dd5('0x3c')]?_0x34ee15['attributes']:_0x1c3ab9['model'];if(!_0x38f97f[_0x2dd5('0x37')][_0x2dd5('0x3d')](_0x2dd5('0x59'))){_0x34ee15[_0x2dd5('0x25')]=qs['limit'](_0x38f97f[_0x2dd5('0x37')]['limit']);_0x34ee15[_0x2dd5('0x22')]=qs[_0x2dd5('0x22')](_0x38f97f['query'][_0x2dd5('0x22')]);}_0x34ee15['order']=qs[_0x2dd5('0x3f')](_0x38f97f['query']['sort']);_0x34ee15['where']=qs[_0x2dd5('0x41')](_[_0x2dd5('0x42')](_0x38f97f[_0x2dd5('0x37')],_0x1c3ab9['filters']));_0x34ee15[_0x2dd5('0x71')]=!![];if(_0x38f97f['query'][_0x2dd5('0x45')]){_0x34ee15[_0x2dd5('0x40')]=_[_0x2dd5('0x5a')](_0x34ee15[_0x2dd5('0x40')],{'$or':_['map'](_0x34ee15[_0x2dd5('0x3b')],function(_0x4a4cc1){var _0x49f976={};_0x49f976[_0x4a4cc1]={'$like':'%'+_0x38f97f[_0x2dd5('0x37')][_0x2dd5('0x45')]+'%'};return _0x49f976;})});}_0x34ee15=_[_0x2dd5('0x5a')]({},_0x34ee15,_0x38f97f[_0x2dd5('0x46')]);return _0xb77f4b['getContacts'](_0x34ee15);}})[_0x2dd5('0x2a')](respondWithResult(_0x1252e2,null))[_0x2dd5('0x4a')](handleError(_0x1252e2,null));};exports[_0x2dd5('0x72')]=function(_0x393f15,_0x5d9a22,_0x3e0a52){var _0x4af41f;var _0x4de8bb;var _0x1543fd;var _0x543f45=_0x393f15['params']['id'];csv_results=[];return db[_0x2dd5('0x73')][_0x2dd5('0x49')]({'attributes':['id',_0x2dd5('0x2f')],'raw':!![],'order':[_0x2dd5('0x74')]})[_0x2dd5('0x2a')](function(_0x160268){_0x4af41f=_0x160268;var _0x36a22d=_[_0x2dd5('0x38')](db['CmContact'][_0x2dd5('0x33')]);return db[_0x2dd5('0x6d')]['findAll']({'raw':!![],'attributes':['id',_0x2dd5('0x75')]})[_0x2dd5('0x2a')](function(_0x2f7408){_0x4de8bb=_0x2f7408;var _0x572175=squel[_0x2dd5('0x76')]()[_0x2dd5('0x3a')](_0x36a22d)[_0x2dd5('0x77')]('cm_contacts','c')[_0x2dd5('0x40')](_0x2dd5('0x78'),_0x543f45)['where'](_0x2dd5('0x79'))[_0x2dd5('0x7a')]();for(var _0x11da34=0x0;_0x11da34<_0x4de8bb[_0x2dd5('0x3c')];_0x11da34++){_0x572175[_0x2dd5('0x7b')](_0x2dd5('0x7c')+_0x4de8bb[_0x11da34]['id'],_0x2dd5('0x7d')+_0x4de8bb[_0x11da34][_0x2dd5('0x75')]);}for(var _0x11da34=0x0;_0x11da34<_0x4af41f[_0x2dd5('0x3c')];_0x11da34++){_0x572175['field'](squel[_0x2dd5('0x76')]()[_0x2dd5('0x7b')](_0x2dd5('0x7e'))[_0x2dd5('0x77')](_0x2dd5('0x7f'))[_0x2dd5('0x40')]('ItemTypeId\x20=\x20?',_0x4af41f[_0x11da34]['id'])[_0x2dd5('0x40')](_0x2dd5('0x80')),_0x2dd5('0x81')+_0x4af41f[_0x11da34][_0x2dd5('0x2f')]);_0x572175[_0x2dd5('0x7b')](squel[_0x2dd5('0x76')]()[_0x2dd5('0x7b')]('description')[_0x2dd5('0x77')](_0x2dd5('0x7f'))[_0x2dd5('0x40')](_0x2dd5('0x82'),_0x4af41f[_0x11da34]['id'])[_0x2dd5('0x40')](_0x2dd5('0x80')),_0x2dd5('0x83')+_0x4af41f[_0x11da34]['name']);}var _0x3395e1=[];_0x3395e1[_0x2dd5('0x64')](_0x572175[_0x2dd5('0x84')]());BPromise['each'](_0x3395e1,handleQuery)['then'](function(_0x3d9775){handleQuery(_0x572175[_0x2dd5('0x84')]());var _0x4d324d=csv_results[0x0];if(!_['isEmpty'](_0x4d324d)){var _0x2974e7=toCsv(_0x4d324d);var _0x22df70=Date[_0x2dd5('0x85')]();fs[_0x2dd5('0x86')](util[_0x2dd5('0x6f')](_0x2dd5('0x87'),_0x543f45,_0x22df70),_0x2974e7);_0x5d9a22[_0x2dd5('0x88')](_0x2dd5('0x89'),_0x2dd5('0x8a')+util['format'](_0x2dd5('0x8b'),_0x543f45,_0x22df70));_0x5d9a22[_0x2dd5('0x88')](_0x2dd5('0x8c'),_0x2dd5('0x8d'));return _0x5d9a22[_0x2dd5('0x8e')](util['format'](_0x2dd5('0x87'),_0x543f45,_0x22df70));}else{return _0x5d9a22[_0x2dd5('0x1e')](0xcc);}});});});};exports[_0x2dd5('0x8f')]=function(_0x111221,_0x19c22b,_0xd55f54){var _0x4e4c89;delete _0x111221[_0x2dd5('0x4e')]['id'];return db[_0x2dd5('0x32')][_0x2dd5('0x90')]({'where':{'id':_0x111221[_0x2dd5('0x55')]['id']}})[_0x2dd5('0x2a')](handleEntityNotFound(_0x19c22b,null))['then'](function(_0x54f8fa){if(_0x54f8fa){return db[_0x2dd5('0x91')]['transaction'](function(_0x1d56bc){return db[_0x2dd5('0x6d')][_0x2dd5('0x4d')](_0x111221[_0x2dd5('0x4e')],{'transaction':_0x1d56bc})[_0x2dd5('0x2a')](function(_0x8b263b){_0x4e4c89=_0x8b263b;return _0x54f8fa[_0x2dd5('0x92')](_0x8b263b,{'transaction':_0x1d56bc});})['then'](function(){var _0x47c25c={'type':db['Sequelize']['TEXT'],'transaction':_0x1d56bc};switch(_0x111221['body'][_0x2dd5('0x35')]){case _0x2dd5('0x93'):_0x47c25c[_0x2dd5('0x35')]=db[_0x2dd5('0x94')][_0x2dd5('0x95')];break;case'number':_0x47c25c[_0x2dd5('0x35')]=db['Sequelize'][_0x2dd5('0x96')];break;case _0x2dd5('0x97'):_0x47c25c[_0x2dd5('0x35')]=db['Sequelize']['BOOLEAN'];_0x47c25c[_0x2dd5('0x98')]=![];break;default:}return db[_0x2dd5('0x91')][_0x2dd5('0x99')][_0x2dd5('0x9a')](_0x2dd5('0x9b'),util['format'](_0x2dd5('0x9c'),_0x4e4c89['id']),_0x47c25c);})[_0x2dd5('0x2a')](function(){return _0x4e4c89;});});}})[_0x2dd5('0x2a')](respondWithResult(_0x19c22b,null))[_0x2dd5('0x4a')](handleError(_0x19c22b,null));};exports[_0x2dd5('0x9d')]=function(_0x163212,_0x40d1ed,_0x1e22e9){var _0x24cff6={};var _0x1b11f6={};var _0x2fb7e8;var _0x1e5df4;return db[_0x2dd5('0x32')][_0x2dd5('0x90')]({'where':{'id':_0x163212[_0x2dd5('0x55')]['id']}})['then'](handleEntityNotFound(_0x40d1ed,null))[_0x2dd5('0x2a')](function(_0x6810a1){if(_0x6810a1){_0x2fb7e8=_0x6810a1;_0x1b11f6[_0x2dd5('0x36')]=_[_0x2dd5('0x38')](db[_0x2dd5('0x6d')][_0x2dd5('0x33')]);_0x1b11f6['query']=_['keys'](_0x163212[_0x2dd5('0x37')]);_0x1b11f6[_0x2dd5('0x41')]=_[_0x2dd5('0x39')](_0x1b11f6['model'],_0x1b11f6[_0x2dd5('0x37')]);_0x24cff6[_0x2dd5('0x3b')]=_[_0x2dd5('0x39')](_0x1b11f6[_0x2dd5('0x36')],qs['fields'](_0x163212['query']['fields']));_0x24cff6['attributes']=_0x24cff6['attributes'][_0x2dd5('0x3c')]?_0x24cff6[_0x2dd5('0x3b')]:_0x1b11f6[_0x2dd5('0x36')];_0x24cff6[_0x2dd5('0x3e')]=qs[_0x2dd5('0x3f')](_0x163212[_0x2dd5('0x37')][_0x2dd5('0x3f')]);_0x24cff6[_0x2dd5('0x40')]=qs[_0x2dd5('0x41')](_['pick'](_0x163212['query'],_0x1b11f6[_0x2dd5('0x41')]));_0x24cff6['where']=_['merge'](_0x24cff6[_0x2dd5('0x40')],{'$or':[{'ListId':_0x6810a1['id']},{'ListId':null}]});if(_0x163212[_0x2dd5('0x37')][_0x2dd5('0x45')]){_0x24cff6[_0x2dd5('0x40')]=_[_0x2dd5('0x5a')](_0x24cff6[_0x2dd5('0x40')],{'$or':_[_0x2dd5('0x43')](_0x24cff6['attributes'],function(_0x438a26){var _0x2913e9={};_0x2913e9[_0x438a26]={'$like':'%'+_0x163212[_0x2dd5('0x37')][_0x2dd5('0x45')]+'%'};return _0x2913e9;})});}_0x24cff6=_[_0x2dd5('0x5a')]({},_0x24cff6,_0x163212[_0x2dd5('0x46')]);return db[_0x2dd5('0x6d')]['findAndCountAll'](_0x24cff6);}})[_0x2dd5('0x2a')](respondWithResult(_0x40d1ed,null))['catch'](handleError(_0x40d1ed,null));};exports[_0x2dd5('0x9e')]=function(_0x4faa4b,_0x57e4c7){return db[_0x2dd5('0x6d')][_0x2dd5('0x9f')]({'where':{'ListId':null}})['then'](handleEntityNotFound(_0x57e4c7,null))[_0x2dd5('0x2a')](function(_0x2a6d3a){return _0x2a6d3a;})[_0x2dd5('0x2a')](respondWithResult(_0x57e4c7,null))[_0x2dd5('0x4a')](handleError(_0x57e4c7,null));};exports[_0x2dd5('0xa0')]=function(_0x177759,_0x55ea88,_0x3b3754){return db['CmList'][_0x2dd5('0x4c')]({'where':{'id':_0x177759[_0x2dd5('0x55')]['id']}})[_0x2dd5('0x2a')](handleEntityNotFound(_0x55ea88,null))['then'](function(_0x22f2bc){if(_0x22f2bc){return _0x22f2bc[_0x2dd5('0xa0')](_0x177759[_0x2dd5('0x4e')]['ids'],_['omit'](_0x177759[_0x2dd5('0x4e')],[_0x2dd5('0xa1'),'id'])||{})[_0x2dd5('0xa2')](function(_0x5ca61e){for(var _0x4695d8=0x0;_0x4695d8<_0x177759[_0x2dd5('0x4e')][_0x2dd5('0xa1')]['length'];_0x4695d8+=0x1){socket['emit'](_0x2dd5('0xa3'),{'UserId':Number(_0x177759[_0x2dd5('0x4e')][_0x2dd5('0xa1')][_0x4695d8]),'CmListId':Number(_0x177759['params']['id'])});}return _0x5ca61e;});}})[_0x2dd5('0x2a')](respondWithResult(_0x55ea88,null))['catch'](handleError(_0x55ea88,null));};exports[_0x2dd5('0xa4')]=function(_0x353b4e,_0x5b6411,_0x57c101){return db['CmList']['find']({'where':{'id':_0x353b4e[_0x2dd5('0x55')]['id']}})[_0x2dd5('0x2a')](handleEntityNotFound(_0x5b6411,null))['then'](function(_0x448065){if(_0x448065){return _0x448065[_0x2dd5('0xa4')](_0x353b4e[_0x2dd5('0x37')]['ids'])[_0x2dd5('0x2a')](function(){if(_['isArray'](_0x353b4e[_0x2dd5('0x37')]['ids'])){for(var _0x21181d=0x0;_0x21181d<_0x353b4e['query'][_0x2dd5('0xa1')][_0x2dd5('0x3c')];_0x21181d+=0x1){socket[_0x2dd5('0xa5')](_0x2dd5('0xa6'),{'UserId':Number(_0x353b4e['query']['ids'][_0x21181d]),'CmListId':Number(_0x353b4e[_0x2dd5('0x55')]['id'])});}}else{socket[_0x2dd5('0xa5')](_0x2dd5('0xa6'),{'UserId':Number(_0x353b4e[_0x2dd5('0x37')][_0x2dd5('0xa1')]),'CmListId':Number(_0x353b4e[_0x2dd5('0x55')]['id'])});}});}})[_0x2dd5('0x2a')](respondWithStatusCode(_0x5b6411,null))['catch'](handleError(_0x5b6411,null));};exports[_0x2dd5('0xa7')]=function(_0xf66b0b,_0x2aebe8,_0x544739){var _0x31a218={};var _0x28b7df={};var _0x174ae6;var _0x14e8c8;return db[_0x2dd5('0x32')][_0x2dd5('0x90')]({'where':{'id':_0xf66b0b[_0x2dd5('0x55')]['id']}})[_0x2dd5('0x2a')](handleEntityNotFound(_0x2aebe8,null))[_0x2dd5('0x2a')](function(_0x299a56){if(_0x299a56){_0x174ae6=_0x299a56;_0x28b7df['model']=_[_0x2dd5('0x38')](db[_0x2dd5('0xa8')][_0x2dd5('0x33')]);_0x28b7df['query']=_[_0x2dd5('0x38')](_0xf66b0b['query']);_0x28b7df[_0x2dd5('0x41')]=_[_0x2dd5('0x39')](_0x28b7df[_0x2dd5('0x36')],_0x28b7df['query']);_0x31a218[_0x2dd5('0x3b')]=_['intersection'](_0x28b7df[_0x2dd5('0x36')],qs[_0x2dd5('0x3a')](_0xf66b0b[_0x2dd5('0x37')][_0x2dd5('0x3a')]));_0x31a218['attributes']=_0x31a218[_0x2dd5('0x3b')]['length']?_0x31a218[_0x2dd5('0x3b')]:_0x28b7df[_0x2dd5('0x36')];_0x31a218[_0x2dd5('0x3e')]=qs[_0x2dd5('0x3f')](_0xf66b0b[_0x2dd5('0x37')][_0x2dd5('0x3f')]);_0x31a218['where']=qs[_0x2dd5('0x41')](_[_0x2dd5('0x42')](_0xf66b0b[_0x2dd5('0x37')],_0x28b7df[_0x2dd5('0x41')]));if(_0xf66b0b[_0x2dd5('0x37')][_0x2dd5('0x45')]){_0x31a218[_0x2dd5('0x40')]=_[_0x2dd5('0x5a')](_0x31a218[_0x2dd5('0x40')],{'$or':_['map'](_0x31a218[_0x2dd5('0x3b')],function(_0x130328){var _0x20f88a={};_0x20f88a[_0x130328]={'$like':'%'+_0xf66b0b[_0x2dd5('0x37')][_0x2dd5('0x45')]+'%'};return _0x20f88a;})});}_0x31a218=_[_0x2dd5('0x5a')]({},_0x31a218,_0xf66b0b[_0x2dd5('0x46')]);return _0x174ae6[_0x2dd5('0xa7')](_0x31a218);}})[_0x2dd5('0x2a')](function(_0x125573){if(_0x125573){_0x14e8c8=_0x125573[_0x2dd5('0x3c')];if(!_0xf66b0b[_0x2dd5('0x37')][_0x2dd5('0x3d')](_0x2dd5('0x59'))){_0x31a218['limit']=qs[_0x2dd5('0x25')](_0xf66b0b[_0x2dd5('0x37')][_0x2dd5('0x25')]);_0x31a218[_0x2dd5('0x22')]=qs[_0x2dd5('0x22')](_0xf66b0b[_0x2dd5('0x37')]['offset']);}return _0x174ae6[_0x2dd5('0xa7')](_0x31a218);}})[_0x2dd5('0x2a')](function(_0x1446d7){if(_0x1446d7){return _0x1446d7?{'count':_0x14e8c8,'rows':_0x1446d7}:null;}})['then'](respondWithResult(_0x2aebe8,null))[_0x2dd5('0x4a')](handleError(_0x2aebe8,null));};function handleQuery(_0x427b3d){logger[_0x2dd5('0xa9')](_0x427b3d);return db[_0x2dd5('0x91')][_0x2dd5('0x37')](_0x427b3d)[_0x2dd5('0xa2')](function(_0x351b66){csv_results[_0x2dd5('0x64')](_0x351b66);})[_0x2dd5('0x4a')](function(_0x1f0042){logger[_0x2dd5('0x52')](_0x1f0042[_0x2dd5('0x6a')]);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 102a4c9..4eeabf7 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 _0x3e74=['hasOwnProperty','exports','events','CmList','setMaxListeners','save','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3e74,0x175));var _0x43e7=function(_0x2e59e7,_0x138dc1){_0x2e59e7=_0x2e59e7-0x0;var _0x3b64e3=_0x3e74[_0x2e59e7];return _0x3b64e3;};'use strict';var EventEmitter=require(_0x43e7('0x0'));var CmList=require('../../mysqldb')['db'][_0x43e7('0x1')];var CmListEvents=new EventEmitter();CmListEvents[_0x43e7('0x2')](0x0);var events={'afterCreate':_0x43e7('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xc58479){return function(_0x4f9bbe,_0x128b0f,_0xe838b4){CmListEvents[_0x43e7('0x4')](_0xc58479+':'+_0x4f9bbe['id'],_0x4f9bbe);CmListEvents[_0x43e7('0x4')](_0xc58479,_0x4f9bbe);_0xe838b4(null);};}for(var e in events){if(events[_0x43e7('0x5')](e)){var event=events[e];CmList['hook'](e,emitEvent(event));}}module[_0x43e7('0x6')]=CmListEvents; \ No newline at end of file +var _0x814b=['update','emit','hook','exports','events','../../mysqldb','CmList','setMaxListeners','save'];(function(_0x1946ec,_0x27c21b){var _0x2e3bb3=function(_0x51023d){while(--_0x51023d){_0x1946ec['push'](_0x1946ec['shift']());}};_0x2e3bb3(++_0x27c21b);}(_0x814b,0x1a2));var _0xb814=function(_0x5cf3c0,_0x4363c1){_0x5cf3c0=_0x5cf3c0-0x0;var _0x39a680=_0x814b[_0x5cf3c0];return _0x39a680;};'use strict';var EventEmitter=require(_0xb814('0x0'));var CmList=require(_0xb814('0x1'))['db'][_0xb814('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0xb814('0x3')](0x0);var events={'afterCreate':_0xb814('0x4'),'afterUpdate':_0xb814('0x5'),'afterDestroy':'remove'};function emitEvent(_0x38c21a){return function(_0x3e1e9,_0x258866,_0x4237bc){CmListEvents[_0xb814('0x6')](_0x38c21a+':'+_0x3e1e9['id'],_0x3e1e9);CmListEvents[_0xb814('0x6')](_0x38c21a,_0x3e1e9);_0x4237bc(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0xb814('0x7')](e,emitEvent(event));}}module[_0xb814('0x8')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 71b79ba..bde7a26 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 _0xa8a8=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./cmList.attributes','exports','define','CmList','cm_lists','lodash','util'];(function(_0x3e5304,_0x17887f){var _0x4b4e65=function(_0x4bdd73){while(--_0x4bdd73){_0x3e5304['push'](_0x3e5304['shift']());}};_0x4b4e65(++_0x17887f);}(_0xa8a8,0xec));var _0x8a8a=function(_0x4b9392,_0xe7d36e){_0x4b9392=_0x4b9392-0x0;var _0x21a7c8=_0xa8a8[_0x4b9392];return _0x21a7c8;};'use strict';var _=require(_0x8a8a('0x0'));var util=require(_0x8a8a('0x1'));var logger=require(_0x8a8a('0x2'))(_0x8a8a('0x3'));var moment=require('moment');var BPromise=require(_0x8a8a('0x4'));var rp=require(_0x8a8a('0x5'));var fs=require('fs');var path=require(_0x8a8a('0x6'));var rimraf=require(_0x8a8a('0x7'));var config=require(_0x8a8a('0x8'));var attributes=require(_0x8a8a('0x9'));module[_0x8a8a('0xa')]=function(_0x12db82,_0x2e8193){return _0x12db82[_0x8a8a('0xb')](_0x8a8a('0xc'),attributes,{'tableName':_0x8a8a('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0bb5=['define','CmList','cm_lists','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmList.attributes','exports'];(function(_0x231473,_0x33b93e){var _0x16d666=function(_0x35ed3a){while(--_0x35ed3a){_0x231473['push'](_0x231473['shift']());}};_0x16d666(++_0x33b93e);}(_0x0bb5,0x148));var _0x50bb=function(_0x295e79,_0x3f1d1e){_0x295e79=_0x295e79-0x0;var _0xdf11ea=_0x0bb5[_0x295e79];return _0xdf11ea;};'use strict';var _=require(_0x50bb('0x0'));var util=require(_0x50bb('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x50bb('0x2'));var BPromise=require(_0x50bb('0x3'));var rp=require(_0x50bb('0x4'));var fs=require('fs');var path=require(_0x50bb('0x5'));var rimraf=require(_0x50bb('0x6'));var config=require(_0x50bb('0x7'));var attributes=require(_0x50bb('0x8'));module[_0x50bb('0x9')]=function(_0x4e6093,_0x4a105c){return _0x4e6093[_0x50bb('0xa')](_0x50bb('0xb'),attributes,{'tableName':_0x50bb('0xc'),'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 fb5487b..28ba329 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 _0xff52=['message','CmList,\x20%s,\x20%s','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','request','then','CmList,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xff52,0x1b8));var _0x2ff5=function(_0x47ea50,_0x4f713f){_0x47ea50=_0x47ea50-0x0;var _0x4986bb=_0xff52[_0x47ea50];return _0x4986bb;};'use strict';var _=require(_0x2ff5('0x0'));var util=require(_0x2ff5('0x1'));var moment=require(_0x2ff5('0x2'));var BPromise=require(_0x2ff5('0x3'));var rs=require(_0x2ff5('0x4'));var fs=require('fs');var Redis=require(_0x2ff5('0x5'));var db=require(_0x2ff5('0x6'))['db'];var utils=require(_0x2ff5('0x7'));var logger=require(_0x2ff5('0x8'))('rpc');var config=require(_0x2ff5('0x9'));var jayson=require(_0x2ff5('0xa'));var client=jayson[_0x2ff5('0xb')]['http']({'port':0x232a});config[_0x2ff5('0xc')]=_[_0x2ff5('0xd')](config[_0x2ff5('0xc')],{'host':_0x2ff5('0xe'),'port':0x18eb});var socket=require(_0x2ff5('0xf'))(new Redis(config[_0x2ff5('0xc')]));require('./cmList.socket')[_0x2ff5('0x10')](socket);function respondWithRpcPromise(_0x4c8e90,_0x5ba5eb,_0x17c6be){return new BPromise(function(_0x3da567,_0x396f29){return client[_0x2ff5('0x11')](_0x4c8e90,_0x17c6be)[_0x2ff5('0x12')](function(_0x1ba270){logger['info']('CmList,\x20%s,\x20%s',_0x5ba5eb,'request\x20sent');logger['debug'](_0x2ff5('0x13'),_0x5ba5eb,_0x2ff5('0x14'),JSON[_0x2ff5('0x15')](_0x1ba270));if(_0x1ba270[_0x2ff5('0x16')]){if(_0x1ba270[_0x2ff5('0x16')][_0x2ff5('0x17')]===0x1f4){logger[_0x2ff5('0x16')]('CmList,\x20%s,\x20%s',_0x5ba5eb,_0x1ba270[_0x2ff5('0x16')][_0x2ff5('0x18')]);return _0x396f29(_0x1ba270[_0x2ff5('0x16')][_0x2ff5('0x18')]);}logger[_0x2ff5('0x16')](_0x2ff5('0x19'),_0x5ba5eb,_0x1ba270[_0x2ff5('0x16')][_0x2ff5('0x18')]);return _0x3da567(_0x1ba270[_0x2ff5('0x16')][_0x2ff5('0x18')]);}else{logger[_0x2ff5('0x1a')]('CmList,\x20%s,\x20%s',_0x5ba5eb,_0x2ff5('0x14'));_0x3da567(_0x1ba270[_0x2ff5('0x1b')][_0x2ff5('0x18')]);}})[_0x2ff5('0x1c')](function(_0x97e8f1){logger[_0x2ff5('0x16')]('CmList,\x20%s,\x20%s',_0x5ba5eb,_0x97e8f1);_0x396f29(_0x97e8f1);});});} \ No newline at end of file +var _0x8773=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','request','info','request\x20sent','stringify','error','CmList,\x20%s,\x20%s','message','catch','lodash','util'];(function(_0x139c81,_0x23ad5e){var _0x218480=function(_0x4978a6){while(--_0x4978a6){_0x139c81['push'](_0x139c81['shift']());}};_0x218480(++_0x23ad5e);}(_0x8773,0x193));var _0x3877=function(_0x32b954,_0x4b6b16){_0x32b954=_0x32b954-0x0;var _0x66d5ca=_0x8773[_0x32b954];return _0x66d5ca;};'use strict';var _=require(_0x3877('0x0'));var util=require(_0x3877('0x1'));var moment=require(_0x3877('0x2'));var BPromise=require(_0x3877('0x3'));var rs=require(_0x3877('0x4'));var fs=require('fs');var Redis=require(_0x3877('0x5'));var db=require(_0x3877('0x6'))['db'];var utils=require(_0x3877('0x7'));var logger=require(_0x3877('0x8'))(_0x3877('0x9'));var config=require(_0x3877('0xa'));var jayson=require(_0x3877('0xb'));var client=jayson[_0x3877('0xc')]['http']({'port':0x232a});config[_0x3877('0xd')]=_[_0x3877('0xe')](config[_0x3877('0xd')],{'host':_0x3877('0xf'),'port':0x18eb});var socket=require(_0x3877('0x10'))(new Redis(config[_0x3877('0xd')]));require(_0x3877('0x11'))[_0x3877('0x12')](socket);function respondWithRpcPromise(_0x399f14,_0xb2adde,_0x26e4f9){return new BPromise(function(_0x813e4,_0x142689){return client[_0x3877('0x13')](_0x399f14,_0x26e4f9)['then'](function(_0xf3c9db){logger[_0x3877('0x14')]('CmList,\x20%s,\x20%s',_0xb2adde,_0x3877('0x15'));logger['debug']('CmList,\x20%s,\x20%s,\x20%s',_0xb2adde,_0x3877('0x15'),JSON[_0x3877('0x16')](_0xf3c9db));if(_0xf3c9db[_0x3877('0x17')]){if(_0xf3c9db[_0x3877('0x17')]['code']===0x1f4){logger[_0x3877('0x17')](_0x3877('0x18'),_0xb2adde,_0xf3c9db['error'][_0x3877('0x19')]);return _0x142689(_0xf3c9db[_0x3877('0x17')][_0x3877('0x19')]);}logger[_0x3877('0x17')]('CmList,\x20%s,\x20%s',_0xb2adde,_0xf3c9db[_0x3877('0x17')]['message']);return _0x813e4(_0xf3c9db['error'][_0x3877('0x19')]);}else{logger[_0x3877('0x14')]('CmList,\x20%s,\x20%s',_0xb2adde,'request\x20sent');_0x813e4(_0xf3c9db['result']['message']);}})[_0x3877('0x1a')](function(_0xbc8a68){logger[_0x3877('0x17')](_0x3877('0x18'),_0xb2adde,_0xbc8a68);_0x142689(_0xbc8a68);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index e695697..36d39a6 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 _0x9bdd=['register','length','cmList:','./cmList.events','save','remove','emit','removeListener'];(function(_0x3eadb9,_0xbea0a5){var _0x3c23d2=function(_0x4f7746){while(--_0x4f7746){_0x3eadb9['push'](_0x3eadb9['shift']());}};_0x3c23d2(++_0xbea0a5);}(_0x9bdd,0x1eb));var _0xd9bd=function(_0xc7fe79,_0x1fcf3a){_0xc7fe79=_0xc7fe79-0x0;var _0x1bc377=_0x9bdd[_0xc7fe79];return _0x1bc377;};'use strict';var CmListEvents=require(_0xd9bd('0x0'));var events=[_0xd9bd('0x1'),_0xd9bd('0x2'),'update'];function createListener(_0x12b4d8,_0x275811){return function(_0x49206f){_0x275811[_0xd9bd('0x3')](_0x12b4d8,_0x49206f);};}function removeListener(_0x1f8c94,_0x307c04){return function(){CmListEvents[_0xd9bd('0x4')](_0x1f8c94,_0x307c04);};}exports[_0xd9bd('0x5')]=function(_0x1e3912){for(var _0x506759=0x0,_0x2a5b0a=events[_0xd9bd('0x6')];_0x506759<_0x2a5b0a;_0x506759++){var _0x5952c4=events[_0x506759];var _0x108599=createListener(_0xd9bd('0x7')+_0x5952c4,_0x1e3912);CmListEvents['on'](_0x5952c4,_0x108599);}}; \ No newline at end of file +var _0x5496=['update','emit','removeListener','register','cmList:','./cmList.events','save','remove'];(function(_0xcc7e73,_0x157288){var _0x2914bf=function(_0x7fda5c){while(--_0x7fda5c){_0xcc7e73['push'](_0xcc7e73['shift']());}};_0x2914bf(++_0x157288);}(_0x5496,0x185));var _0x6549=function(_0x3b20ff,_0x1d5ae7){_0x3b20ff=_0x3b20ff-0x0;var _0x4a6d51=_0x5496[_0x3b20ff];return _0x4a6d51;};'use strict';var CmListEvents=require(_0x6549('0x0'));var events=[_0x6549('0x1'),_0x6549('0x2'),_0x6549('0x3')];function createListener(_0x38d1a4,_0x15543e){return function(_0x12f65e){_0x15543e[_0x6549('0x4')](_0x38d1a4,_0x12f65e);};}function removeListener(_0x4f600e,_0x1480e9){return function(){CmListEvents[_0x6549('0x5')](_0x4f600e,_0x1480e9);};}exports[_0x6549('0x6')]=function(_0x230e63){for(var _0x28bba3=0x0,_0x3a106c=events['length'];_0x28bba3<_0x3a106c;_0x28bba3++){var _0x5431d4=events[_0x28bba3];var _0x15c580=createListener(_0x6549('0x7')+_0x5431d4,_0x230e63);CmListEvents['on'](_0x5431d4,_0x15c580);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 9699011..9e2f0ff 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 _0x56ce=['addAgents','put','/:id','delete','destroy','removeDispositions','removeAgents','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/describe','describe','/global_fields','getGlobalCustomFields','show','/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','getCustomFields','/:id/users','post','addDisposition','addContacts','/:id/fields','addCustomField'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x56ce,0x1e9));var _0xe56c=function(_0x4573ce,_0x93d5b8){_0x4573ce=_0x4573ce-0x0;var _0xfa8d1e=_0x56ce[_0x4573ce];return _0xfa8d1e;};'use strict';var multer=require(_0xe56c('0x0'));var util=require('util');var path=require(_0xe56c('0x1'));var timeout=require(_0xe56c('0x2'));var express=require(_0xe56c('0x3'));var router=express[_0xe56c('0x4')]();var fs_extra=require(_0xe56c('0x5'));var auth=require(_0xe56c('0x6'));var interaction=require(_0xe56c('0x7'));var config=require(_0xe56c('0x8'));var controller=require('./cmList.controller');router['get']('/',auth[_0xe56c('0x9')](),controller['index']);router[_0xe56c('0xa')](_0xe56c('0xb'),auth[_0xe56c('0x9')](),controller[_0xe56c('0xc')]);router[_0xe56c('0xa')](_0xe56c('0xd'),auth[_0xe56c('0x9')](),controller[_0xe56c('0xe')]);router[_0xe56c('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xe56c('0xf')]);router[_0xe56c('0xa')](_0xe56c('0x10'),auth[_0xe56c('0x9')](),controller[_0xe56c('0x11')]);router[_0xe56c('0xa')](_0xe56c('0x12'),auth[_0xe56c('0x9')](),controller[_0xe56c('0x13')]);router[_0xe56c('0xa')](_0xe56c('0x14'),auth[_0xe56c('0x9')](),controller[_0xe56c('0x15')]);router[_0xe56c('0xa')]('/:id/fields',auth['isAuthenticated'](),controller[_0xe56c('0x16')]);router[_0xe56c('0xa')](_0xe56c('0x17'),auth[_0xe56c('0x9')](),controller['getAgents']);router['post']('/',auth[_0xe56c('0x9')](),controller['create']);router[_0xe56c('0x18')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xe56c('0x19')]);router['post'](_0xe56c('0x12'),auth[_0xe56c('0x9')](),controller[_0xe56c('0x1a')]);router[_0xe56c('0x18')](_0xe56c('0x1b'),auth[_0xe56c('0x9')](),controller[_0xe56c('0x1c')]);router[_0xe56c('0x18')](_0xe56c('0x17'),auth['isAuthenticated'](),controller[_0xe56c('0x1d')]);router[_0xe56c('0x1e')](_0xe56c('0x1f'),auth[_0xe56c('0x9')](),controller['update']);router[_0xe56c('0x20')](_0xe56c('0x1f'),auth['isAuthenticated'](),controller[_0xe56c('0x21')]);router[_0xe56c('0x20')](_0xe56c('0x10'),auth['isAuthenticated'](),controller[_0xe56c('0x22')]);router['delete'](_0xe56c('0x17'),auth['isAuthenticated'](),controller[_0xe56c('0x23')]);module[_0xe56c('0x24')]=router; \ No newline at end of file +var _0xe0e7=['addContacts','addCustomField','addAgents','put','/:id','update','delete','destroy','removeDispositions','removeAgents','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmList.controller','get','index','/describe','describe','/global_fields','getGlobalCustomFields','isAuthenticated','show','/:id/dispositions','/:id/contacts','/:id/contacts/csv','getContactsCsv','/:id/fields','/:id/users','getAgents','create','post'];(function(_0x93bdcb,_0x3812fa){var _0x3affd9=function(_0x3f8b8e){while(--_0x3f8b8e){_0x93bdcb['push'](_0x93bdcb['shift']());}};_0x3affd9(++_0x3812fa);}(_0xe0e7,0x1a2));var _0x7e0e=function(_0x1fb6ff,_0x474709){_0x1fb6ff=_0x1fb6ff-0x0;var _0x339f61=_0xe0e7[_0x1fb6ff];return _0x339f61;};'use strict';var multer=require('multer');var util=require(_0x7e0e('0x0'));var path=require(_0x7e0e('0x1'));var timeout=require(_0x7e0e('0x2'));var express=require(_0x7e0e('0x3'));var router=express[_0x7e0e('0x4')]();var fs_extra=require(_0x7e0e('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x7e0e('0x6'));var config=require(_0x7e0e('0x7'));var controller=require(_0x7e0e('0x8'));router[_0x7e0e('0x9')]('/',auth['isAuthenticated'](),controller[_0x7e0e('0xa')]);router[_0x7e0e('0x9')](_0x7e0e('0xb'),auth['isAuthenticated'](),controller[_0x7e0e('0xc')]);router['get'](_0x7e0e('0xd'),auth['isAuthenticated'](),controller[_0x7e0e('0xe')]);router['get']('/:id',auth[_0x7e0e('0xf')](),controller[_0x7e0e('0x10')]);router[_0x7e0e('0x9')](_0x7e0e('0x11'),auth['isAuthenticated'](),controller['getDispositions']);router[_0x7e0e('0x9')](_0x7e0e('0x12'),auth[_0x7e0e('0xf')](),controller['getContacts']);router[_0x7e0e('0x9')](_0x7e0e('0x13'),auth['isAuthenticated'](),controller[_0x7e0e('0x14')]);router[_0x7e0e('0x9')](_0x7e0e('0x15'),auth[_0x7e0e('0xf')](),controller['getCustomFields']);router[_0x7e0e('0x9')](_0x7e0e('0x16'),auth[_0x7e0e('0xf')](),controller[_0x7e0e('0x17')]);router['post']('/',auth['isAuthenticated'](),controller[_0x7e0e('0x18')]);router[_0x7e0e('0x19')](_0x7e0e('0x11'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x7e0e('0x19')](_0x7e0e('0x12'),auth[_0x7e0e('0xf')](),controller[_0x7e0e('0x1a')]);router[_0x7e0e('0x19')]('/:id/fields',auth[_0x7e0e('0xf')](),controller[_0x7e0e('0x1b')]);router[_0x7e0e('0x19')](_0x7e0e('0x16'),auth[_0x7e0e('0xf')](),controller[_0x7e0e('0x1c')]);router[_0x7e0e('0x1d')](_0x7e0e('0x1e'),auth[_0x7e0e('0xf')](),controller[_0x7e0e('0x1f')]);router[_0x7e0e('0x20')](_0x7e0e('0x1e'),auth[_0x7e0e('0xf')](),controller[_0x7e0e('0x21')]);router[_0x7e0e('0x20')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x7e0e('0x22')]);router[_0x7e0e('0x20')]('/:id/users',auth[_0x7e0e('0xf')](),controller[_0x7e0e('0x23')]);module[_0x7e0e('0x24')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index d960e29..a400e03 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 _0x5300=['getDataValue','field','STRING','sequelize'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0x5300,0x1bb));var _0x0530=function(_0x42a709,_0x265571){_0x42a709=_0x42a709-0x0;var _0x1195d5=_0x5300[_0x42a709];return _0x1195d5;};'use strict';var Sequelize=require(_0x0530('0x0'));module['exports']={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x1232b9){return this[_0x0530('0x1')](_0x0530('0x2'));}},'field':{'type':Sequelize[_0x0530('0x3')],'allowNull':![]},'operator':{'type':Sequelize[_0x0530('0x3')],'allowNull':![]},'value':{'type':Sequelize[_0x0530('0x3')],'allowNull':![]}}; \ No newline at end of file +var _0xce77=['STRING','sequelize','exports','VIRTUAL','field'];(function(_0x30cd40,_0x1c9839){var _0x3d173b=function(_0x2e4562){while(--_0x2e4562){_0x30cd40['push'](_0x30cd40['shift']());}};_0x3d173b(++_0x1c9839);}(_0xce77,0x97));var _0x7ce7=function(_0x2552fa,_0x4c8c20){_0x2552fa=_0x2552fa-0x0;var _0x345f00=_0xce77[_0x2552fa];return _0x345f00;};'use strict';var Sequelize=require(_0x7ce7('0x0'));module[_0x7ce7('0x1')]={'name':{'type':Sequelize[_0x7ce7('0x2')],'get':function(_0x2174ea){return this['getDataValue'](_0x7ce7('0x3'));}},'field':{'type':Sequelize[_0x7ce7('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0x7ce7('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x7ce7('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 0a257db..b0beb87 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(_0x131b45,_0x216c87){var _0x29da8a=function(_0x23c4ad){while(--_0x23c4ad){_0x131b45['push'](_0x131b45['shift']());}};_0x29da8a(++_0x216c87);}(_0x7a54,0x106));var _0x47a5=function(_0x2a1446,_0x258cb6){_0x2a1446=_0x2a1446-0x0;var _0x32cf07=_0x7a54[_0x2a1446];return _0x32cf07;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file +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(_0x407194,_0x3a6c2c){var _0x1b9946=function(_0x2c234b){while(--_0x2c234b){_0x407194['push'](_0x407194['shift']());}};_0x1b9946(++_0x3a6c2c);}(_0x7a54,0x106));var _0x47a5=function(_0x493067,_0x46895c){_0x493067=_0x493067-0x0;var _0x4dbbc7=_0x7a54[_0x493067];return _0x4dbbc7;};'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 39138b3..47a11f7 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 _0xcea8=['Condition','tools_conditions','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./condition.attributes','exports','define'];(function(_0x3cd025,_0x1e2adf){var _0xaa86eb=function(_0x1029d0){while(--_0x1029d0){_0x3cd025['push'](_0x3cd025['shift']());}};_0xaa86eb(++_0x1e2adf);}(_0xcea8,0x113));var _0x8cea=function(_0x2201e1,_0x50ba88){_0x2201e1=_0x2201e1-0x0;var _0x5a063f=_0xcea8[_0x2201e1];return _0x5a063f;};'use strict';var _=require(_0x8cea('0x0'));var util=require(_0x8cea('0x1'));var logger=require(_0x8cea('0x2'))(_0x8cea('0x3'));var moment=require('moment');var BPromise=require(_0x8cea('0x4'));var rp=require(_0x8cea('0x5'));var fs=require('fs');var path=require(_0x8cea('0x6'));var rimraf=require(_0x8cea('0x7'));var config=require('../../config/environment');var attributes=require(_0x8cea('0x8'));module[_0x8cea('0x9')]=function(_0x26b28e,_0x32cd2b){return _0x26b28e[_0x8cea('0xa')](_0x8cea('0xb'),attributes,{'tableName':_0x8cea('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x03e3=['rimraf','./condition.attributes','exports','define','Condition','tools_conditions','util','api','moment','bluebird','path'];(function(_0x593564,_0x43583f){var _0x211a89=function(_0x40afd6){while(--_0x40afd6){_0x593564['push'](_0x593564['shift']());}};_0x211a89(++_0x43583f);}(_0x03e3,0x192));var _0x303e=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x03e3[_0x16b9ed];return _0x66b1f8;};'use strict';var _=require('lodash');var util=require(_0x303e('0x0'));var logger=require('../../config/logger')(_0x303e('0x1'));var moment=require(_0x303e('0x2'));var BPromise=require(_0x303e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x303e('0x4'));var rimraf=require(_0x303e('0x5'));var config=require('../../config/environment');var attributes=require(_0x303e('0x6'));module[_0x303e('0x7')]=function(_0x4a6b8f,_0x279f2c){return _0x4a6b8f[_0x303e('0x8')](_0x303e('0x9'),attributes,{'tableName':_0x303e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/condition/condition.rpc.js b/server/api/condition/condition.rpc.js index b2df8c3..a3e63d3 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 _0x89cf=['../../config/logger','rpc','../../config/environment','client','then','Condition,\x20%s,\x20%s','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x19a206,_0x1d7556){var _0x7514ac=function(_0xaddeaa){while(--_0xaddeaa){_0x19a206['push'](_0x19a206['shift']());}};_0x7514ac(++_0x1d7556);}(_0x89cf,0x19d));var _0xf89c=function(_0x34cc23,_0x4517aa){_0x34cc23=_0x34cc23-0x0;var _0xd26cf0=_0x89cf[_0x34cc23];return _0xd26cf0;};'use strict';var _=require(_0xf89c('0x0'));var util=require(_0xf89c('0x1'));var moment=require('moment');var BPromise=require(_0xf89c('0x2'));var rs=require(_0xf89c('0x3'));var fs=require('fs');var Redis=require(_0xf89c('0x4'));var db=require(_0xf89c('0x5'))['db'];var utils=require(_0xf89c('0x6'));var logger=require(_0xf89c('0x7'))(_0xf89c('0x8'));var config=require(_0xf89c('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xf89c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2f3fa4,_0x3d5c05,_0x151609){return new BPromise(function(_0x132785,_0x5d3e4b){return client['request'](_0x2f3fa4,_0x151609)[_0xf89c('0xb')](function(_0x26f2a4){logger['info'](_0xf89c('0xc'),_0x3d5c05,'request\x20sent');logger['debug'](_0xf89c('0xd'),_0x3d5c05,'request\x20sent',JSON[_0xf89c('0xe')](_0x26f2a4));if(_0x26f2a4[_0xf89c('0xf')]){if(_0x26f2a4[_0xf89c('0xf')][_0xf89c('0x10')]===0x1f4){logger[_0xf89c('0xf')](_0xf89c('0xc'),_0x3d5c05,_0x26f2a4['error'][_0xf89c('0x11')]);return _0x5d3e4b(_0x26f2a4['error'][_0xf89c('0x11')]);}logger[_0xf89c('0xf')](_0xf89c('0xc'),_0x3d5c05,_0x26f2a4[_0xf89c('0xf')][_0xf89c('0x11')]);return _0x132785(_0x26f2a4['error'][_0xf89c('0x11')]);}else{logger[_0xf89c('0x12')](_0xf89c('0xc'),_0x3d5c05,'request\x20sent');_0x132785(_0x26f2a4[_0xf89c('0x13')][_0xf89c('0x11')]);}})[_0xf89c('0x14')](function(_0x3c5c35){logger[_0xf89c('0xf')](_0xf89c('0xc'),_0x3d5c05,_0x3c5c35);_0x5d3e4b(_0x3c5c35);});});} \ No newline at end of file +var _0xca4e=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','request','then','request\x20sent','debug','error','code','Condition,\x20%s,\x20%s','message','info','result'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0xca4e,0x69));var _0xeca4=function(_0x2bf3a1,_0xdeadbd){_0x2bf3a1=_0x2bf3a1-0x0;var _0x57d6d8=_0xca4e[_0x2bf3a1];return _0x57d6d8;};'use strict';var _=require(_0xeca4('0x0'));var util=require(_0xeca4('0x1'));var moment=require(_0xeca4('0x2'));var BPromise=require(_0xeca4('0x3'));var rs=require(_0xeca4('0x4'));var fs=require('fs');var Redis=require(_0xeca4('0x5'));var db=require(_0xeca4('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xeca4('0x7'));var config=require(_0xeca4('0x8'));var jayson=require(_0xeca4('0x9'));var client=jayson['client'][_0xeca4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5b92b1,_0x2525ff,_0x5e6bdd){return new BPromise(function(_0x193eb9,_0x586475){return client[_0xeca4('0xb')](_0x5b92b1,_0x5e6bdd)[_0xeca4('0xc')](function(_0x4e93c1){logger['info']('Condition,\x20%s,\x20%s',_0x2525ff,_0xeca4('0xd'));logger[_0xeca4('0xe')]('Condition,\x20%s,\x20%s,\x20%s',_0x2525ff,_0xeca4('0xd'),JSON['stringify'](_0x4e93c1));if(_0x4e93c1[_0xeca4('0xf')]){if(_0x4e93c1[_0xeca4('0xf')][_0xeca4('0x10')]===0x1f4){logger['error'](_0xeca4('0x11'),_0x2525ff,_0x4e93c1['error']['message']);return _0x586475(_0x4e93c1[_0xeca4('0xf')]['message']);}logger[_0xeca4('0xf')](_0xeca4('0x11'),_0x2525ff,_0x4e93c1[_0xeca4('0xf')][_0xeca4('0x12')]);return _0x193eb9(_0x4e93c1[_0xeca4('0xf')][_0xeca4('0x12')]);}else{logger[_0xeca4('0x13')](_0xeca4('0x11'),_0x2525ff,'request\x20sent');_0x193eb9(_0x4e93c1[_0xeca4('0x14')][_0xeca4('0x12')]);}})['catch'](function(_0xe46842){logger[_0xeca4('0xf')](_0xeca4('0x11'),_0x2525ff,_0xe46842);_0x586475(_0xe46842);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index a8af9b2..7357826 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 _0x39f3=['exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./condition.controller','put','/:id','isAuthenticated','update','delete','destroy'];(function(_0x3d0f49,_0x5bd8da){var _0x243e2a=function(_0x2e8696){while(--_0x2e8696){_0x3d0f49['push'](_0x3d0f49['shift']());}};_0x243e2a(++_0x5bd8da);}(_0x39f3,0x181));var _0x339f=function(_0xfe1e05,_0x303484){_0xfe1e05=_0xfe1e05-0x0;var _0x4dec2a=_0x39f3[_0xfe1e05];return _0x4dec2a;};'use strict';var multer=require(_0x339f('0x0'));var util=require(_0x339f('0x1'));var path=require(_0x339f('0x2'));var timeout=require('connect-timeout');var express=require(_0x339f('0x3'));var router=express[_0x339f('0x4')]();var fs_extra=require(_0x339f('0x5'));var auth=require(_0x339f('0x6'));var interaction=require(_0x339f('0x7'));var config=require('../../config/environment');var controller=require(_0x339f('0x8'));router[_0x339f('0x9')](_0x339f('0xa'),auth[_0x339f('0xb')](),controller[_0x339f('0xc')]);router[_0x339f('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x339f('0xe')]);module[_0x339f('0xf')]=router; \ No newline at end of file +var _0xe3bf=['put','isAuthenticated','update','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller'];(function(_0x12d6c8,_0x5b82dd){var _0x5c7d04=function(_0x22a3e9){while(--_0x22a3e9){_0x12d6c8['push'](_0x12d6c8['shift']());}};_0x5c7d04(++_0x5b82dd);}(_0xe3bf,0xb9));var _0xfe3b=function(_0x1e3638,_0x29ae62){_0x1e3638=_0x1e3638-0x0;var _0x48430e=_0xe3bf[_0x1e3638];return _0x48430e;};'use strict';var multer=require(_0xfe3b('0x0'));var util=require(_0xfe3b('0x1'));var path=require('path');var timeout=require(_0xfe3b('0x2'));var express=require(_0xfe3b('0x3'));var router=express[_0xfe3b('0x4')]();var fs_extra=require(_0xfe3b('0x5'));var auth=require(_0xfe3b('0x6'));var interaction=require(_0xfe3b('0x7'));var config=require(_0xfe3b('0x8'));var controller=require(_0xfe3b('0x9'));router[_0xfe3b('0xa')]('/:id',auth[_0xfe3b('0xb')](),controller[_0xfe3b('0xc')]);router[_0xfe3b('0xd')]('/:id',auth[_0xfe3b('0xb')](),controller[_0xfe3b('0xe')]);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 69615c5..e4dd852 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 _0x2f7c=['STRING','name','sequelize'];(function(_0x3261ff,_0x25bc60){var _0x3e4bb1=function(_0x72138){while(--_0x72138){_0x3261ff['push'](_0x3261ff['shift']());}};_0x3e4bb1(++_0x25bc60);}(_0x2f7c,0x107));var _0xc2f7=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x2f7c[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0xc2f7('0x0'));module['exports']={'name':{'type':Sequelize[_0xc2f7('0x1')],'allowNull':![],'unique':_0xc2f7('0x2')},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0xc2f7('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0x3d76=['INTEGER','sequelize','exports','STRING','name'];(function(_0x384447,_0x41669a){var _0x3810db=function(_0x3f1288){while(--_0x3f1288){_0x384447['push'](_0x384447['shift']());}};_0x3810db(++_0x41669a);}(_0x3d76,0x13c));var _0x63d7=function(_0x3b8f2e,_0x5a99a8){_0x3b8f2e=_0x3b8f2e-0x0;var _0x1433d5=_0x3d76[_0x3b8f2e];return _0x1433d5;};'use strict';var Sequelize=require(_0x63d7('0x0'));module[_0x63d7('0x1')]={'name':{'type':Sequelize[_0x63d7('0x2')],'allowNull':![],'unique':_0x63d7('0x3')},'OrderBy':{'type':Sequelize[_0x63d7('0x4')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x63d7('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 c098156..bb585b5 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 _0xfcbb=['find','create','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','CmContactHasItem','params','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','reject','save','update','then','destroy','get','ContactItemTypes','UserProfileResource','error','stack','name','index','map','ContactItemType','fieldName','type','key','query','keys','filters','intersection','model','fields','length','attributes','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','rawAttributes'];(function(_0x1d21fb,_0x2d605c){var _0x3cc514=function(_0x552c5){while(--_0x552c5){_0x1d21fb['push'](_0x1d21fb['shift']());}};_0x3cc514(++_0x2d605c);}(_0xfcbb,0x10d));var _0xbfcb=function(_0xd18e6a,_0x4ce51c){_0xd18e6a=_0xd18e6a-0x0;var _0x4cc0e2=_0xfcbb[_0xd18e6a];return _0x4cc0e2;};'use strict';var emlformat=require(_0xbfcb('0x0'));var rimraf=require(_0xbfcb('0x1'));var zipdir=require(_0xbfcb('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xbfcb('0x3'));var BPromise=require(_0xbfcb('0x4'));var Mustache=require(_0xbfcb('0x5'));var util=require(_0xbfcb('0x6'));var path=require(_0xbfcb('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xbfcb('0x8'));var fs=require('fs');var fs_extra=require(_0xbfcb('0x9'));var _=require(_0xbfcb('0xa'));var squel=require(_0xbfcb('0xb'));var crypto=require(_0xbfcb('0xc'));var jsforce=require(_0xbfcb('0xd'));var deskjs=require(_0xbfcb('0xe'));var toCsv=require('to-csv');var querystring=require(_0xbfcb('0xf'));var Papa=require(_0xbfcb('0x10'));var Redis=require(_0xbfcb('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xbfcb('0x12'));var as=require(_0xbfcb('0x13'));var hardwareService=require(_0xbfcb('0x14'));var logger=require(_0xbfcb('0x15'))(_0xbfcb('0x16'));var utils=require(_0xbfcb('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xbfcb('0x18'));var db=require(_0xbfcb('0x19'))['db'];function respondWithStatusCode(_0xb2f601,_0x2268da){_0x2268da=_0x2268da||0xcc;return function(_0x4ba4f1){if(_0x4ba4f1){return _0xb2f601[_0xbfcb('0x1a')](_0x2268da);}return _0xb2f601['status'](_0x2268da)[_0xbfcb('0x1b')]();};}function respondWithResult(_0x1c52df,_0x44ad6c){_0x44ad6c=_0x44ad6c||0xc8;return function(_0x1047c4){if(_0x1047c4){return _0x1c52df[_0xbfcb('0x1c')](_0x44ad6c)[_0xbfcb('0x1d')](_0x1047c4);}};}function respondWithFilteredResult(_0x71304e,_0x2d314a){return function(_0x90ed8c){if(_0x90ed8c){var _0x339347=typeof _0x2d314a[_0xbfcb('0x1e')]===_0xbfcb('0x1f')&&typeof _0x2d314a[_0xbfcb('0x20')]===_0xbfcb('0x1f');var _0x318d07=_0x90ed8c[_0xbfcb('0x21')];var _0xba1d6=_0x339347?0x0:_0x2d314a[_0xbfcb('0x1e')];var _0x3404aa=_0x339347?_0x90ed8c[_0xbfcb('0x21')]:_0x2d314a[_0xbfcb('0x1e')]+_0x2d314a[_0xbfcb('0x20')];var _0x53c9e0;if(_0x3404aa>=_0x318d07){_0x3404aa=_0x318d07;_0x53c9e0=0xc8;}else{_0x53c9e0=0xce;}_0x71304e[_0xbfcb('0x1c')](_0x53c9e0);return _0x71304e[_0xbfcb('0x22')]('Content-Range',_0xba1d6+'-'+_0x3404aa+'/'+_0x318d07)[_0xbfcb('0x1d')](_0x90ed8c);}return null;};}function patchUpdates(_0x1a7225){return function(_0x48c3c8){try{jsonpatch['apply'](_0x48c3c8,_0x1a7225,!![]);}catch(_0x4199c5){return BPromise[_0xbfcb('0x23')](_0x4199c5);}return _0x48c3c8[_0xbfcb('0x24')]();};}function saveUpdates(_0x45661a,_0x1c5924){return function(_0x56c158){if(_0x56c158){return _0x56c158[_0xbfcb('0x25')](_0x45661a)[_0xbfcb('0x26')](function(_0x2d9288){return _0x2d9288;});}return null;};}function removeEntity(_0xd4d29,_0x1651e5){return function(_0x19616c){if(_0x19616c){return _0x19616c[_0xbfcb('0x27')]()[_0xbfcb('0x26')](function(){var _0x11f6f7=_0x19616c[_0xbfcb('0x28')]({'plain':!![]});var _0x1ca8c3=_0xbfcb('0x29');return db[_0xbfcb('0x2a')][_0xbfcb('0x27')]({'where':{'type':_0x1ca8c3,'resourceId':_0x11f6f7['id']}})[_0xbfcb('0x26')](function(){return _0x19616c;});})[_0xbfcb('0x26')](function(){_0xd4d29['status'](0xcc)[_0xbfcb('0x1b')]();});}};}function handleEntityNotFound(_0x2881f8,_0x4cf7ca){return function(_0x64a69){if(!_0x64a69){_0x2881f8[_0xbfcb('0x1a')](0x194);}return _0x64a69;};}function handleError(_0x781773,_0xa57d71){_0xa57d71=_0xa57d71||0x1f4;return function(_0xf4b944){logger[_0xbfcb('0x2b')](_0xf4b944[_0xbfcb('0x2c')]);if(_0xf4b944[_0xbfcb('0x2d')]){delete _0xf4b944[_0xbfcb('0x2d')];}_0x781773[_0xbfcb('0x1c')](_0xa57d71)['send'](_0xf4b944);};}exports[_0xbfcb('0x2e')]=function(_0x3aa3cd,_0x43c3c3){var _0x43de3c={},_0x1f45fc={},_0x14f6f5={'count':0x0,'rows':[]};var _0x286fb7=_[_0xbfcb('0x2f')](db[_0xbfcb('0x30')]['rawAttributes'],function(_0x297f72){return{'name':_0x297f72[_0xbfcb('0x31')],'type':_0x297f72[_0xbfcb('0x32')][_0xbfcb('0x33')]};});_0x1f45fc['model']=_['map'](_0x286fb7,_0xbfcb('0x2d'));_0x1f45fc[_0xbfcb('0x34')]=_[_0xbfcb('0x35')](_0x3aa3cd[_0xbfcb('0x34')]);_0x1f45fc[_0xbfcb('0x36')]=_[_0xbfcb('0x37')](_0x1f45fc[_0xbfcb('0x38')],_0x1f45fc['query']);_0x43de3c['attributes']=_['intersection'](_0x1f45fc[_0xbfcb('0x38')],qs['fields'](_0x3aa3cd[_0xbfcb('0x34')][_0xbfcb('0x39')]));_0x43de3c['attributes']=_0x43de3c['attributes'][_0xbfcb('0x3a')]?_0x43de3c[_0xbfcb('0x3b')]:_0x1f45fc[_0xbfcb('0x38')];if(!_0x3aa3cd[_0xbfcb('0x34')]['hasOwnProperty'](_0xbfcb('0x3c'))){_0x43de3c[_0xbfcb('0x20')]=qs['limit'](_0x3aa3cd['query'][_0xbfcb('0x20')]);_0x43de3c['offset']=qs['offset'](_0x3aa3cd[_0xbfcb('0x34')][_0xbfcb('0x1e')]);}_0x43de3c[_0xbfcb('0x3d')]=qs[_0xbfcb('0x3e')](_0x3aa3cd['query'][_0xbfcb('0x3e')]);_0x43de3c[_0xbfcb('0x3f')]=qs[_0xbfcb('0x36')](_[_0xbfcb('0x40')](_0x3aa3cd[_0xbfcb('0x34')],_0x1f45fc[_0xbfcb('0x36')]),_0x286fb7);if(_0x3aa3cd['query'][_0xbfcb('0x41')]){_0x43de3c['where']=_[_0xbfcb('0x42')](_0x43de3c['where'],{'$or':_[_0xbfcb('0x2f')](_0x286fb7,function(_0x2e4406){if(_0x2e4406[_0xbfcb('0x32')]!==_0xbfcb('0x43')){var _0x434fcd={};_0x434fcd[_0x2e4406[_0xbfcb('0x2d')]]={'$like':'%'+_0x3aa3cd[_0xbfcb('0x34')][_0xbfcb('0x41')]+'%'};return _0x434fcd;}})});}_0x43de3c=_[_0xbfcb('0x42')]({},_0x43de3c,_0x3aa3cd[_0xbfcb('0x44')]);var _0x55a95f={'where':_0x43de3c[_0xbfcb('0x3f')]};return db[_0xbfcb('0x30')]['count'](_0x55a95f)[_0xbfcb('0x26')](function(_0x306ea4){_0x14f6f5[_0xbfcb('0x21')]=_0x306ea4;if(_0x3aa3cd[_0xbfcb('0x34')][_0xbfcb('0x45')]){_0x43de3c[_0xbfcb('0x46')]=[{'all':!![]}];}return db['ContactItemType'][_0xbfcb('0x47')](_0x43de3c);})[_0xbfcb('0x26')](function(_0x10ea4f){_0x14f6f5['rows']=_0x10ea4f;return _0x14f6f5;})[_0xbfcb('0x26')](respondWithFilteredResult(_0x43c3c3,_0x43de3c))[_0xbfcb('0x48')](handleError(_0x43c3c3,null));};exports[_0xbfcb('0x49')]=function(_0x542d90,_0x5aa9c9){var _0xd7cb39={'raw':!![],'where':{'id':_0x542d90['params']['id']}},_0x58337d={};_0x58337d[_0xbfcb('0x38')]=_[_0xbfcb('0x35')](db['ContactItemType'][_0xbfcb('0x4a')]);_0x58337d[_0xbfcb('0x34')]=_['keys'](_0x542d90[_0xbfcb('0x34')]);_0x58337d[_0xbfcb('0x36')]=_[_0xbfcb('0x37')](_0x58337d[_0xbfcb('0x38')],_0x58337d[_0xbfcb('0x34')]);_0xd7cb39[_0xbfcb('0x3b')]=_[_0xbfcb('0x37')](_0x58337d[_0xbfcb('0x38')],qs[_0xbfcb('0x39')](_0x542d90[_0xbfcb('0x34')][_0xbfcb('0x39')]));_0xd7cb39[_0xbfcb('0x3b')]=_0xd7cb39['attributes'][_0xbfcb('0x3a')]?_0xd7cb39[_0xbfcb('0x3b')]:_0x58337d[_0xbfcb('0x38')];if(_0x542d90['query'][_0xbfcb('0x45')]){_0xd7cb39['include']=[{'all':!![]}];}_0xd7cb39=_['merge']({},_0xd7cb39,_0x542d90[_0xbfcb('0x44')]);return db[_0xbfcb('0x30')][_0xbfcb('0x4b')](_0xd7cb39)['then'](handleEntityNotFound(_0x5aa9c9,null))[_0xbfcb('0x26')](respondWithResult(_0x5aa9c9,null))['catch'](handleError(_0x5aa9c9,null));};exports['create']=function(_0x33725a,_0x588d32){return db[_0xbfcb('0x30')][_0xbfcb('0x4c')](_0x33725a['body'],{})[_0xbfcb('0x26')](function(_0x5d942f){var _0x8347be=_0x33725a['user'][_0xbfcb('0x28')]({'plain':!![]});if(!_0x8347be)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x8347be[_0xbfcb('0x4d')]===_0xbfcb('0x4e')){var _0x5efbe1=_0x5d942f[_0xbfcb('0x28')]({'plain':!![]});var _0x547169='ContactItemTypes';return db[_0xbfcb('0x4f')][_0xbfcb('0x4b')]({'where':{'name':_0x547169,'userProfileId':_0x8347be[_0xbfcb('0x50')]},'raw':!![]})['then'](function(_0x495c34){if(_0x495c34&&_0x495c34[_0xbfcb('0x51')]===0x0){return db[_0xbfcb('0x2a')][_0xbfcb('0x4c')]({'name':_0x5efbe1[_0xbfcb('0x2d')],'resourceId':_0x5efbe1['id'],'type':_0x495c34[_0xbfcb('0x2d')],'sectionId':_0x495c34['id']},{})['then'](function(){return _0x5d942f;});}else{return _0x5d942f;}})[_0xbfcb('0x48')](function(_0x37a7e8){logger[_0xbfcb('0x2b')](_0xbfcb('0x52'),_0x37a7e8);throw _0x37a7e8;});}return _0x5d942f;})['then'](respondWithResult(_0x588d32,0xc9))['catch'](handleError(_0x588d32,null));};exports[_0xbfcb('0x25')]=function(_0x50f9f7,_0x9cc2bd){if(_0x50f9f7['body']['id']){delete _0x50f9f7['body']['id'];}return db[_0xbfcb('0x30')]['find']({'where':{'id':_0x50f9f7['params']['id']}})[_0xbfcb('0x26')](handleEntityNotFound(_0x9cc2bd,null))['then'](saveUpdates(_0x50f9f7[_0xbfcb('0x53')],null))['then'](respondWithResult(_0x9cc2bd,null))[_0xbfcb('0x48')](handleError(_0x9cc2bd,null));};exports[_0xbfcb('0x27')]=function(_0x593f4e,_0x35cd27){return db[_0xbfcb('0x30')][_0xbfcb('0x4b')]({'where':{'id':_0x593f4e['params']['id']}})[_0xbfcb('0x26')](handleEntityNotFound(_0x35cd27,null))[_0xbfcb('0x26')](db[_0xbfcb('0x54')][_0xbfcb('0x25')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x593f4e[_0xbfcb('0x55')]['id']}}))[_0xbfcb('0x26')](removeEntity(_0x35cd27,null))[_0xbfcb('0x48')](handleError(_0x35cd27,null));}; \ No newline at end of file +var _0x2032=['limit','count','set','Content-Range','apply','save','then','destroy','get','ContactItemTypes','sendStatus','error','stack','name','send','index','map','ContactItemType','fieldName','model','query','keys','filters','intersection','attributes','fields','nolimit','order','where','pick','merge','type','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','offset','undefined'];(function(_0x2810af,_0x336b0a){var _0x2be61b=function(_0x50c323){while(--_0x50c323){_0x2810af['push'](_0x2810af['shift']());}};_0x2be61b(++_0x336b0a);}(_0x2032,0xd9));var _0x2203=function(_0x114646,_0x2bdaaf){_0x114646=_0x114646-0x0;var _0x25e6e4=_0x2032[_0x114646];return _0x25e6e4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2203('0x0'));var zipdir=require(_0x2203('0x1'));var jsonpatch=require(_0x2203('0x2'));var rp=require('request-promise');var moment=require(_0x2203('0x3'));var BPromise=require(_0x2203('0x4'));var Mustache=require('mustache');var util=require(_0x2203('0x5'));var path=require(_0x2203('0x6'));var sox=require(_0x2203('0x7'));var csv=require(_0x2203('0x8'));var ejs=require(_0x2203('0x9'));var fs=require('fs');var fs_extra=require(_0x2203('0xa'));var _=require(_0x2203('0xb'));var squel=require(_0x2203('0xc'));var crypto=require(_0x2203('0xd'));var jsforce=require(_0x2203('0xe'));var deskjs=require(_0x2203('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2203('0x10'));var Redis=require('ioredis');var authService=require(_0x2203('0x11'));var qs=require(_0x2203('0x12'));var as=require(_0x2203('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2203('0x14'))('api');var utils=require(_0x2203('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x2203('0x16'));var db=require(_0x2203('0x17'))['db'];function respondWithStatusCode(_0x4b9376,_0x583bc7){_0x583bc7=_0x583bc7||0xcc;return function(_0x585c76){if(_0x585c76){return _0x4b9376['sendStatus'](_0x583bc7);}return _0x4b9376['status'](_0x583bc7)[_0x2203('0x18')]();};}function respondWithResult(_0x538b30,_0x592e47){_0x592e47=_0x592e47||0xc8;return function(_0x21a3af){if(_0x21a3af){return _0x538b30[_0x2203('0x19')](_0x592e47)[_0x2203('0x1a')](_0x21a3af);}};}function respondWithFilteredResult(_0x41af85,_0x226209){return function(_0x3fe0a8){if(_0x3fe0a8){var _0x2c36e6=typeof _0x226209[_0x2203('0x1b')]===_0x2203('0x1c')&&typeof _0x226209[_0x2203('0x1d')]==='undefined';var _0x280eda=_0x3fe0a8[_0x2203('0x1e')];var _0x4893ff=_0x2c36e6?0x0:_0x226209[_0x2203('0x1b')];var _0x8906e1=_0x2c36e6?_0x3fe0a8['count']:_0x226209[_0x2203('0x1b')]+_0x226209['limit'];var _0x2904ba;if(_0x8906e1>=_0x280eda){_0x8906e1=_0x280eda;_0x2904ba=0xc8;}else{_0x2904ba=0xce;}_0x41af85[_0x2203('0x19')](_0x2904ba);return _0x41af85[_0x2203('0x1f')](_0x2203('0x20'),_0x4893ff+'-'+_0x8906e1+'/'+_0x280eda)[_0x2203('0x1a')](_0x3fe0a8);}return null;};}function patchUpdates(_0x449039){return function(_0x538c23){try{jsonpatch[_0x2203('0x21')](_0x538c23,_0x449039,!![]);}catch(_0x50822b){return BPromise['reject'](_0x50822b);}return _0x538c23[_0x2203('0x22')]();};}function saveUpdates(_0x496d82,_0x3b8ef9){return function(_0x5bfe61){if(_0x5bfe61){return _0x5bfe61['update'](_0x496d82)[_0x2203('0x23')](function(_0x5e29cd){return _0x5e29cd;});}return null;};}function removeEntity(_0x5c8da9,_0x226374){return function(_0x2718f5){if(_0x2718f5){return _0x2718f5[_0x2203('0x24')]()[_0x2203('0x23')](function(){var _0x1244f4=_0x2718f5[_0x2203('0x25')]({'plain':!![]});var _0x49c12=_0x2203('0x26');return db['UserProfileResource'][_0x2203('0x24')]({'where':{'type':_0x49c12,'resourceId':_0x1244f4['id']}})[_0x2203('0x23')](function(){return _0x2718f5;});})[_0x2203('0x23')](function(){_0x5c8da9['status'](0xcc)[_0x2203('0x18')]();});}};}function handleEntityNotFound(_0x1cec17,_0x5c5fd3){return function(_0xd6e109){if(!_0xd6e109){_0x1cec17[_0x2203('0x27')](0x194);}return _0xd6e109;};}function handleError(_0x1c6a77,_0x46b8b9){_0x46b8b9=_0x46b8b9||0x1f4;return function(_0x28ae02){logger[_0x2203('0x28')](_0x28ae02[_0x2203('0x29')]);if(_0x28ae02['name']){delete _0x28ae02[_0x2203('0x2a')];}_0x1c6a77[_0x2203('0x19')](_0x46b8b9)[_0x2203('0x2b')](_0x28ae02);};}exports[_0x2203('0x2c')]=function(_0x52a426,_0x3a8e23){var _0x21ff0d={},_0x287c95={},_0xf59954={'count':0x0,'rows':[]};var _0x520602=_[_0x2203('0x2d')](db[_0x2203('0x2e')]['rawAttributes'],function(_0x5c0157){return{'name':_0x5c0157[_0x2203('0x2f')],'type':_0x5c0157['type']['key']};});_0x287c95[_0x2203('0x30')]=_[_0x2203('0x2d')](_0x520602,_0x2203('0x2a'));_0x287c95[_0x2203('0x31')]=_[_0x2203('0x32')](_0x52a426['query']);_0x287c95[_0x2203('0x33')]=_[_0x2203('0x34')](_0x287c95['model'],_0x287c95[_0x2203('0x31')]);_0x21ff0d[_0x2203('0x35')]=_[_0x2203('0x34')](_0x287c95[_0x2203('0x30')],qs[_0x2203('0x36')](_0x52a426[_0x2203('0x31')][_0x2203('0x36')]));_0x21ff0d[_0x2203('0x35')]=_0x21ff0d[_0x2203('0x35')]['length']?_0x21ff0d[_0x2203('0x35')]:_0x287c95[_0x2203('0x30')];if(!_0x52a426['query']['hasOwnProperty'](_0x2203('0x37'))){_0x21ff0d['limit']=qs[_0x2203('0x1d')](_0x52a426[_0x2203('0x31')][_0x2203('0x1d')]);_0x21ff0d['offset']=qs['offset'](_0x52a426[_0x2203('0x31')]['offset']);}_0x21ff0d[_0x2203('0x38')]=qs['sort'](_0x52a426[_0x2203('0x31')]['sort']);_0x21ff0d[_0x2203('0x39')]=qs[_0x2203('0x33')](_[_0x2203('0x3a')](_0x52a426[_0x2203('0x31')],_0x287c95[_0x2203('0x33')]),_0x520602);if(_0x52a426['query']['filter']){_0x21ff0d['where']=_[_0x2203('0x3b')](_0x21ff0d[_0x2203('0x39')],{'$or':_[_0x2203('0x2d')](_0x520602,function(_0x3b0c7a){if(_0x3b0c7a[_0x2203('0x3c')]!==_0x2203('0x3d')){var _0x1c7e3d={};_0x1c7e3d[_0x3b0c7a['name']]={'$like':'%'+_0x52a426[_0x2203('0x31')][_0x2203('0x3e')]+'%'};return _0x1c7e3d;}})});}_0x21ff0d=_[_0x2203('0x3b')]({},_0x21ff0d,_0x52a426[_0x2203('0x3f')]);var _0x493d12={'where':_0x21ff0d['where']};return db[_0x2203('0x2e')]['count'](_0x493d12)[_0x2203('0x23')](function(_0x446209){_0xf59954[_0x2203('0x1e')]=_0x446209;if(_0x52a426['query']['includeAll']){_0x21ff0d[_0x2203('0x40')]=[{'all':!![]}];}return db[_0x2203('0x2e')][_0x2203('0x41')](_0x21ff0d);})[_0x2203('0x23')](function(_0x372709){_0xf59954[_0x2203('0x42')]=_0x372709;return _0xf59954;})['then'](respondWithFilteredResult(_0x3a8e23,_0x21ff0d))[_0x2203('0x43')](handleError(_0x3a8e23,null));};exports[_0x2203('0x44')]=function(_0x3a866c,_0x266076){var _0x16b452={'raw':!![],'where':{'id':_0x3a866c[_0x2203('0x45')]['id']}},_0x36b99f={};_0x36b99f[_0x2203('0x30')]=_[_0x2203('0x32')](db[_0x2203('0x2e')]['rawAttributes']);_0x36b99f[_0x2203('0x31')]=_[_0x2203('0x32')](_0x3a866c[_0x2203('0x31')]);_0x36b99f[_0x2203('0x33')]=_['intersection'](_0x36b99f['model'],_0x36b99f[_0x2203('0x31')]);_0x16b452['attributes']=_[_0x2203('0x34')](_0x36b99f[_0x2203('0x30')],qs[_0x2203('0x36')](_0x3a866c[_0x2203('0x31')]['fields']));_0x16b452[_0x2203('0x35')]=_0x16b452[_0x2203('0x35')]['length']?_0x16b452[_0x2203('0x35')]:_0x36b99f[_0x2203('0x30')];if(_0x3a866c[_0x2203('0x31')][_0x2203('0x46')]){_0x16b452['include']=[{'all':!![]}];}_0x16b452=_['merge']({},_0x16b452,_0x3a866c[_0x2203('0x3f')]);return db['ContactItemType']['find'](_0x16b452)[_0x2203('0x23')](handleEntityNotFound(_0x266076,null))[_0x2203('0x23')](respondWithResult(_0x266076,null))[_0x2203('0x43')](handleError(_0x266076,null));};exports['create']=function(_0x4c1496,_0x131aec){return db[_0x2203('0x2e')][_0x2203('0x47')](_0x4c1496[_0x2203('0x48')],{})[_0x2203('0x23')](function(_0x21fd78){var _0x4a7f4e=_0x4c1496[_0x2203('0x49')]['get']({'plain':!![]});if(!_0x4a7f4e)throw new Error(_0x2203('0x4a'));if(_0x4a7f4e[_0x2203('0x4b')]===_0x2203('0x49')){var _0x1e49dd=_0x21fd78['get']({'plain':!![]});var _0x506795=_0x2203('0x26');return db[_0x2203('0x4c')][_0x2203('0x4d')]({'where':{'name':_0x506795,'userProfileId':_0x4a7f4e[_0x2203('0x4e')]},'raw':!![]})['then'](function(_0x4de47a){if(_0x4de47a&&_0x4de47a['autoAssociation']===0x0){return db[_0x2203('0x4f')][_0x2203('0x47')]({'name':_0x1e49dd['name'],'resourceId':_0x1e49dd['id'],'type':_0x4de47a[_0x2203('0x2a')],'sectionId':_0x4de47a['id']},{})[_0x2203('0x23')](function(){return _0x21fd78;});}else{return _0x21fd78;}})['catch'](function(_0x32b1db){logger[_0x2203('0x28')](_0x2203('0x50'),_0x32b1db);throw _0x32b1db;});}return _0x21fd78;})[_0x2203('0x23')](respondWithResult(_0x131aec,0xc9))['catch'](handleError(_0x131aec,null));};exports[_0x2203('0x51')]=function(_0x5268d6,_0x3858f0){if(_0x5268d6[_0x2203('0x48')]['id']){delete _0x5268d6['body']['id'];}return db[_0x2203('0x2e')][_0x2203('0x4d')]({'where':{'id':_0x5268d6[_0x2203('0x45')]['id']}})[_0x2203('0x23')](handleEntityNotFound(_0x3858f0,null))[_0x2203('0x23')](saveUpdates(_0x5268d6[_0x2203('0x48')],null))['then'](respondWithResult(_0x3858f0,null))['catch'](handleError(_0x3858f0,null));};exports[_0x2203('0x24')]=function(_0x524356,_0x56e881){return db[_0x2203('0x2e')][_0x2203('0x4d')]({'where':{'id':_0x524356[_0x2203('0x45')]['id']}})['then'](handleEntityNotFound(_0x56e881,null))[_0x2203('0x23')](db['CmContactHasItem']['update']({'ItemTypeId':null},{'where':{'ItemTypeId':_0x524356[_0x2203('0x45')]['id']}}))['then'](removeEntity(_0x56e881,null))['catch'](handleError(_0x56e881,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index 2682fe9..5e54411 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 _0xcf8a=['moment','bluebird','path','rimraf','../../config/environment','./contactItemType.attributes','exports','define','ContactItemType','tools_contact_item_types','util','../../config/logger','api'];(function(_0x1fe8a4,_0xd9c7a7){var _0x5703e4=function(_0x5c0901){while(--_0x5c0901){_0x1fe8a4['push'](_0x1fe8a4['shift']());}};_0x5703e4(++_0xd9c7a7);}(_0xcf8a,0x142));var _0xacf8=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xcf8a[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0xacf8('0x0'));var logger=require(_0xacf8('0x1'))(_0xacf8('0x2'));var moment=require(_0xacf8('0x3'));var BPromise=require(_0xacf8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xacf8('0x5'));var rimraf=require(_0xacf8('0x6'));var config=require(_0xacf8('0x7'));var attributes=require(_0xacf8('0x8'));module[_0xacf8('0x9')]=function(_0x4c37f5,_0x554988){return _0x4c37f5[_0xacf8('0xa')](_0xacf8('0xb'),attributes,{'tableName':_0xacf8('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe7ae=['util','../../config/logger','bluebird','path','rimraf','../../config/environment','./contactItemType.attributes','exports','define','ContactItemType','tools_contact_item_types','lodash'];(function(_0x4901a2,_0x5bc071){var _0x6aaa0e=function(_0x2c5328){while(--_0x2c5328){_0x4901a2['push'](_0x4901a2['shift']());}};_0x6aaa0e(++_0x5bc071);}(_0xe7ae,0xd7));var _0xee7a=function(_0x14fd8d,_0x2619a8){_0x14fd8d=_0x14fd8d-0x0;var _0x4b3548=_0xe7ae[_0x14fd8d];return _0x4b3548;};'use strict';var _=require(_0xee7a('0x0'));var util=require(_0xee7a('0x1'));var logger=require(_0xee7a('0x2'))('api');var moment=require('moment');var BPromise=require(_0xee7a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xee7a('0x4'));var rimraf=require(_0xee7a('0x5'));var config=require(_0xee7a('0x6'));var attributes=require(_0xee7a('0x7'));module[_0xee7a('0x8')]=function(_0x1d5e41,_0x31cb64){return _0x1d5e41[_0xee7a('0x9')](_0xee7a('0xa'),attributes,{'tableName':_0xee7a('0xb'),'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 c0dbc24..6553b24 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 _0x0d90=['stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','ContactItemType,\x20%s,\x20%s','request\x20sent','debug'];(function(_0xa5f840,_0x188587){var _0x4cb50e=function(_0x2e6e07){while(--_0x2e6e07){_0xa5f840['push'](_0xa5f840['shift']());}};_0x4cb50e(++_0x188587);}(_0x0d90,0xa0));var _0x00d9=function(_0x1a9cd0,_0x1c8859){_0x1a9cd0=_0x1a9cd0-0x0;var _0x517c1a=_0x0d90[_0x1a9cd0];return _0x517c1a;};'use strict';var _=require(_0x00d9('0x0'));var util=require(_0x00d9('0x1'));var moment=require(_0x00d9('0x2'));var BPromise=require('bluebird');var rs=require(_0x00d9('0x3'));var fs=require('fs');var Redis=require(_0x00d9('0x4'));var db=require(_0x00d9('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x00d9('0x6'))(_0x00d9('0x7'));var config=require(_0x00d9('0x8'));var jayson=require(_0x00d9('0x9'));var client=jayson[_0x00d9('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x39b71b,_0x1f6457,_0x3935cd){return new BPromise(function(_0x5cedd0,_0x215dbd){return client[_0x00d9('0xb')](_0x39b71b,_0x3935cd)['then'](function(_0x214015){logger[_0x00d9('0xc')](_0x00d9('0xd'),_0x1f6457,_0x00d9('0xe'));logger[_0x00d9('0xf')]('ContactItemType,\x20%s,\x20%s,\x20%s',_0x1f6457,_0x00d9('0xe'),JSON[_0x00d9('0x10')](_0x214015));if(_0x214015[_0x00d9('0x11')]){if(_0x214015[_0x00d9('0x11')][_0x00d9('0x12')]===0x1f4){logger[_0x00d9('0x11')](_0x00d9('0xd'),_0x1f6457,_0x214015[_0x00d9('0x11')]['message']);return _0x215dbd(_0x214015['error']['message']);}logger[_0x00d9('0x11')](_0x00d9('0xd'),_0x1f6457,_0x214015['error'][_0x00d9('0x13')]);return _0x5cedd0(_0x214015['error']['message']);}else{logger[_0x00d9('0xc')](_0x00d9('0xd'),_0x1f6457,_0x00d9('0xe'));_0x5cedd0(_0x214015[_0x00d9('0x14')][_0x00d9('0x13')]);}})[_0x00d9('0x15')](function(_0x4e8e2b){logger[_0x00d9('0x11')](_0x00d9('0xd'),_0x1f6457,_0x4e8e2b);_0x215dbd(_0x4e8e2b);});});} \ No newline at end of file +var _0xd0eb=['util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','error','code','message','info','catch'];(function(_0x26d96d,_0xf6ef52){var _0x457578=function(_0x4ca946){while(--_0x4ca946){_0x26d96d['push'](_0x26d96d['shift']());}};_0x457578(++_0xf6ef52);}(_0xd0eb,0x73));var _0xbd0e=function(_0x52666e,_0x5b3776){_0x52666e=_0x52666e-0x0;var _0x515330=_0xd0eb[_0x52666e];return _0x515330;};'use strict';var _=require('lodash');var util=require(_0xbd0e('0x0'));var moment=require(_0xbd0e('0x1'));var BPromise=require(_0xbd0e('0x2'));var rs=require(_0xbd0e('0x3'));var fs=require('fs');var Redis=require(_0xbd0e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbd0e('0x5'));var logger=require(_0xbd0e('0x6'))(_0xbd0e('0x7'));var config=require(_0xbd0e('0x8'));var jayson=require(_0xbd0e('0x9'));var client=jayson[_0xbd0e('0xa')][_0xbd0e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3c6455,_0x58934b,_0x41a663){return new BPromise(function(_0x4ff5b7,_0x143de5){return client[_0xbd0e('0xc')](_0x3c6455,_0x41a663)[_0xbd0e('0xd')](function(_0x59b5e8){logger['info'](_0xbd0e('0xe'),_0x58934b,_0xbd0e('0xf'));logger[_0xbd0e('0x10')](_0xbd0e('0x11'),_0x58934b,_0xbd0e('0xf'),JSON['stringify'](_0x59b5e8));if(_0x59b5e8[_0xbd0e('0x12')]){if(_0x59b5e8[_0xbd0e('0x12')][_0xbd0e('0x13')]===0x1f4){logger[_0xbd0e('0x12')](_0xbd0e('0xe'),_0x58934b,_0x59b5e8[_0xbd0e('0x12')]['message']);return _0x143de5(_0x59b5e8[_0xbd0e('0x12')][_0xbd0e('0x14')]);}logger[_0xbd0e('0x12')](_0xbd0e('0xe'),_0x58934b,_0x59b5e8[_0xbd0e('0x12')][_0xbd0e('0x14')]);return _0x4ff5b7(_0x59b5e8[_0xbd0e('0x12')][_0xbd0e('0x14')]);}else{logger[_0xbd0e('0x15')](_0xbd0e('0xe'),_0x58934b,'request\x20sent');_0x4ff5b7(_0x59b5e8['result']['message']);}})[_0xbd0e('0x16')](function(_0x1568d7){logger[_0xbd0e('0x12')]('ContactItemType,\x20%s,\x20%s',_0x58934b,_0x1568d7);_0x143de5(_0x1568d7);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index 495ce1f..1f642d3 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 _0x547b=['isAuthenticated','show','post','create','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','get','index','/:id'];(function(_0x239b76,_0x5cf0b1){var _0x581bf3=function(_0xeb856a){while(--_0xeb856a){_0x239b76['push'](_0x239b76['shift']());}};_0x581bf3(++_0x5cf0b1);}(_0x547b,0x17d));var _0xb547=function(_0x22ac22,_0x2b5738){_0x22ac22=_0x22ac22-0x0;var _0x330651=_0x547b[_0x22ac22];return _0x330651;};'use strict';var multer=require(_0xb547('0x0'));var util=require(_0xb547('0x1'));var path=require(_0xb547('0x2'));var timeout=require(_0xb547('0x3'));var express=require(_0xb547('0x4'));var router=express[_0xb547('0x5')]();var fs_extra=require(_0xb547('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./contactItemType.controller');router[_0xb547('0x7')]('/',auth['isAuthenticated'](),controller[_0xb547('0x8')]);router[_0xb547('0x7')](_0xb547('0x9'),auth[_0xb547('0xa')](),controller[_0xb547('0xb')]);router[_0xb547('0xc')]('/',auth[_0xb547('0xa')](),controller[_0xb547('0xd')]);router['put'](_0xb547('0x9'),auth[_0xb547('0xa')](),controller[_0xb547('0xe')]);router[_0xb547('0xf')](_0xb547('0x9'),auth[_0xb547('0xa')](),controller['destroy']);module[_0xb547('0x10')]=router; \ No newline at end of file +var _0x2420=['destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','post','create','update'];(function(_0x58a049,_0x3782e3){var _0x5674cd=function(_0x1e4668){while(--_0x1e4668){_0x58a049['push'](_0x58a049['shift']());}};_0x5674cd(++_0x3782e3);}(_0x2420,0xd2));var _0x0242=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x2420[_0x3bf83f];return _0x22c4a9;};'use strict';var multer=require(_0x0242('0x0'));var util=require(_0x0242('0x1'));var path=require(_0x0242('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0242('0x3')]();var fs_extra=require(_0x0242('0x4'));var auth=require(_0x0242('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0242('0x6'));var controller=require('./contactItemType.controller');router[_0x0242('0x7')]('/',auth[_0x0242('0x8')](),controller[_0x0242('0x9')]);router[_0x0242('0x7')](_0x0242('0xa'),auth[_0x0242('0x8')](),controller['show']);router[_0x0242('0xb')]('/',auth[_0x0242('0x8')](),controller[_0x0242('0xc')]);router['put']('/:id',auth[_0x0242('0x8')](),controller[_0x0242('0xd')]);router['delete'](_0x0242('0xa'),auth[_0x0242('0x8')](),controller[_0x0242('0xe')]);module[_0x0242('0xf')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index fa5bc74..5207bf2 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(_0x419b07,_0x1522f7){var _0x14f677=function(_0x401e3c){while(--_0x401e3c){_0x419b07['push'](_0x419b07['shift']());}};_0x14f677(++_0x1522f7);}(_0xb10b,0x12a));var _0xbb10=function(_0x6c0b0a,_0x496391){_0x6c0b0a=_0x6c0b0a-0x0;var _0x5f456a=_0xb10b[_0x6c0b0a];return _0x5f456a;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'name':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![],'unique':_0xbb10('0x2')},'description':{'type':Sequelize[_0xbb10('0x1')]}}; \ No newline at end of file +var _0xb7e7=['STRING','sequelize'];(function(_0x58afd5,_0x534a48){var _0x3e503b=function(_0x27ba44){while(--_0x27ba44){_0x58afd5['push'](_0x58afd5['shift']());}};_0x3e503b(++_0x534a48);}(_0xb7e7,0x121));var _0x7b7e=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xb7e7[_0x502c7d];return _0x30b7ed;};'use strict';var Sequelize=require(_0x7b7e('0x0'));module['exports']={'name':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x7b7e('0x1')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index cbb4c0f..593a24a 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 _0x25bc=['redis','defaults','localhost','socket.io-emitter','./dashboard.socket','sendStatus','status','end','json','offset','limit','count','apply','reject','update','then','destroy','get','UserProfileResource','error','stack','name','send','map','Dashboard','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','CustomDashboards','userProfileId','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','stringify','addItem','DashboardId','DashboardItem','getItems','filter','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','ejs','fs-extra','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x16af6f,_0x18ba0a){var _0x37e1d3=function(_0x3173c7){while(--_0x3173c7){_0x16af6f['push'](_0x16af6f['shift']());}};_0x37e1d3(++_0x18ba0a);}(_0x25bc,0x16e));var _0xc25b=function(_0x589414,_0x43b57a){_0x589414=_0x589414-0x0;var _0x17f55=_0x25bc[_0x589414];return _0x17f55;};'use strict';var emlformat=require(_0xc25b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc25b('0x1'));var jsonpatch=require(_0xc25b('0x2'));var rp=require(_0xc25b('0x3'));var moment=require(_0xc25b('0x4'));var BPromise=require(_0xc25b('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xc25b('0x6'));var csv=require('to-csv');var ejs=require(_0xc25b('0x7'));var fs=require('fs');var fs_extra=require(_0xc25b('0x8'));var _=require(_0xc25b('0x9'));var squel=require('squel');var crypto=require(_0xc25b('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xc25b('0xb'));var toCsv=require(_0xc25b('0xc'));var querystring=require(_0xc25b('0xd'));var Papa=require(_0xc25b('0xe'));var Redis=require(_0xc25b('0xf'));var authService=require(_0xc25b('0x10'));var qs=require(_0xc25b('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc25b('0x12'));var logger=require(_0xc25b('0x13'))(_0xc25b('0x14'));var utils=require(_0xc25b('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xc25b('0x16'));var db=require(_0xc25b('0x17'))['db'];config[_0xc25b('0x18')]=_[_0xc25b('0x19')](config[_0xc25b('0x18')],{'host':_0xc25b('0x1a'),'port':0x18eb});var socket=require(_0xc25b('0x1b'))(new Redis(config['redis']));require(_0xc25b('0x1c'))['register'](socket);function respondWithStatusCode(_0x5c5fc5,_0x4c10fd){_0x4c10fd=_0x4c10fd||0xcc;return function(_0x4b7b76){if(_0x4b7b76){return _0x5c5fc5[_0xc25b('0x1d')](_0x4c10fd);}return _0x5c5fc5[_0xc25b('0x1e')](_0x4c10fd)[_0xc25b('0x1f')]();};}function respondWithResult(_0xc47398,_0x2d5286){_0x2d5286=_0x2d5286||0xc8;return function(_0x34a321){if(_0x34a321){return _0xc47398[_0xc25b('0x1e')](_0x2d5286)[_0xc25b('0x20')](_0x34a321);}};}function respondWithFilteredResult(_0x32ad5f,_0x3bb669){return function(_0x267da1){if(_0x267da1){var _0x119286=typeof _0x3bb669[_0xc25b('0x21')]==='undefined'&&typeof _0x3bb669[_0xc25b('0x22')]==='undefined';var _0x1fa94f=_0x267da1[_0xc25b('0x23')];var _0x2681d6=_0x119286?0x0:_0x3bb669['offset'];var _0x40f2d9=_0x119286?_0x267da1[_0xc25b('0x23')]:_0x3bb669[_0xc25b('0x21')]+_0x3bb669[_0xc25b('0x22')];var _0x271220;if(_0x40f2d9>=_0x1fa94f){_0x40f2d9=_0x1fa94f;_0x271220=0xc8;}else{_0x271220=0xce;}_0x32ad5f[_0xc25b('0x1e')](_0x271220);return _0x32ad5f['set']('Content-Range',_0x2681d6+'-'+_0x40f2d9+'/'+_0x1fa94f)[_0xc25b('0x20')](_0x267da1);}return null;};}function patchUpdates(_0xf41c56){return function(_0x4b3ab4){try{jsonpatch[_0xc25b('0x24')](_0x4b3ab4,_0xf41c56,!![]);}catch(_0x1f9b6d){return BPromise[_0xc25b('0x25')](_0x1f9b6d);}return _0x4b3ab4['save']();};}function saveUpdates(_0x1cf162,_0x919a79){return function(_0x3e44af){if(_0x3e44af){return _0x3e44af[_0xc25b('0x26')](_0x1cf162)[_0xc25b('0x27')](function(_0x30b2f3){return _0x30b2f3;});}return null;};}function removeEntity(_0x1c902e,_0x44d55f){return function(_0x25d366){if(_0x25d366){return _0x25d366[_0xc25b('0x28')]()[_0xc25b('0x27')](function(){var _0x3f3d18=_0x25d366[_0xc25b('0x29')]({'plain':!![]});var _0x4e09ed='CustomDashboards';return db[_0xc25b('0x2a')]['destroy']({'where':{'type':_0x4e09ed,'resourceId':_0x3f3d18['id']}})[_0xc25b('0x27')](function(){return _0x25d366;});})[_0xc25b('0x27')](function(){_0x1c902e[_0xc25b('0x1e')](0xcc)[_0xc25b('0x1f')]();});}};}function handleEntityNotFound(_0x634bd3,_0x54e881){return function(_0x47886d){if(!_0x47886d){_0x634bd3['sendStatus'](0x194);}return _0x47886d;};}function handleError(_0x2262df,_0x3bc049){_0x3bc049=_0x3bc049||0x1f4;return function(_0x1ddd51){logger[_0xc25b('0x2b')](_0x1ddd51[_0xc25b('0x2c')]);if(_0x1ddd51[_0xc25b('0x2d')]){delete _0x1ddd51['name'];}_0x2262df['status'](_0x3bc049)[_0xc25b('0x2e')](_0x1ddd51);};}exports['index']=function(_0x505496,_0x1a53d5){var _0x3b2fdb={},_0x449b79={},_0x2cd3e4={'count':0x0,'rows':[]};var _0x142d1e=_[_0xc25b('0x2f')](db[_0xc25b('0x30')][_0xc25b('0x31')],function(_0xeb36d){return{'name':_0xeb36d[_0xc25b('0x32')],'type':_0xeb36d[_0xc25b('0x33')][_0xc25b('0x34')]};});_0x449b79[_0xc25b('0x35')]=_[_0xc25b('0x2f')](_0x142d1e,_0xc25b('0x2d'));_0x449b79[_0xc25b('0x36')]=_[_0xc25b('0x37')](_0x505496[_0xc25b('0x36')]);_0x449b79[_0xc25b('0x38')]=_[_0xc25b('0x39')](_0x449b79[_0xc25b('0x35')],_0x449b79['query']);_0x3b2fdb[_0xc25b('0x3a')]=_[_0xc25b('0x39')](_0x449b79[_0xc25b('0x35')],qs[_0xc25b('0x3b')](_0x505496[_0xc25b('0x36')][_0xc25b('0x3b')]));_0x3b2fdb[_0xc25b('0x3a')]=_0x3b2fdb[_0xc25b('0x3a')][_0xc25b('0x3c')]?_0x3b2fdb[_0xc25b('0x3a')]:_0x449b79[_0xc25b('0x35')];if(!_0x505496[_0xc25b('0x36')][_0xc25b('0x3d')](_0xc25b('0x3e'))){_0x3b2fdb[_0xc25b('0x22')]=qs['limit'](_0x505496['query'][_0xc25b('0x22')]);_0x3b2fdb[_0xc25b('0x21')]=qs[_0xc25b('0x21')](_0x505496[_0xc25b('0x36')][_0xc25b('0x21')]);}_0x3b2fdb['order']=qs['sort'](_0x505496[_0xc25b('0x36')][_0xc25b('0x3f')]);_0x3b2fdb[_0xc25b('0x40')]=qs[_0xc25b('0x38')](_[_0xc25b('0x41')](_0x505496[_0xc25b('0x36')],_0x449b79[_0xc25b('0x38')]),_0x142d1e);if(_0x505496[_0xc25b('0x36')]['filter']){_0x3b2fdb[_0xc25b('0x40')]=_[_0xc25b('0x42')](_0x3b2fdb['where'],{'$or':_[_0xc25b('0x2f')](_0x142d1e,function(_0x13243f){if(_0x13243f[_0xc25b('0x33')]!==_0xc25b('0x43')){var _0x56a4bd={};_0x56a4bd[_0x13243f[_0xc25b('0x2d')]]={'$like':'%'+_0x505496[_0xc25b('0x36')]['filter']+'%'};return _0x56a4bd;}})});}_0x3b2fdb=_['merge']({},_0x3b2fdb,_0x505496['options']);var _0x5b99fc={'where':_0x3b2fdb[_0xc25b('0x40')]};return db[_0xc25b('0x30')][_0xc25b('0x23')](_0x5b99fc)[_0xc25b('0x27')](function(_0x2dfe6e){_0x2cd3e4['count']=_0x2dfe6e;if(_0x505496['query'][_0xc25b('0x44')]){_0x3b2fdb[_0xc25b('0x45')]=[{'all':!![]}];}return db[_0xc25b('0x30')][_0xc25b('0x46')](_0x3b2fdb);})['then'](function(_0x57db7c){_0x2cd3e4[_0xc25b('0x47')]=_0x57db7c;return _0x2cd3e4;})[_0xc25b('0x27')](respondWithFilteredResult(_0x1a53d5,_0x3b2fdb))[_0xc25b('0x48')](handleError(_0x1a53d5,null));};exports[_0xc25b('0x49')]=function(_0xf36f2f,_0x5374c5){var _0x3d0d9c={'raw':![],'where':{'id':_0xf36f2f[_0xc25b('0x4a')]['id']}},_0xae144a={};_0xae144a['model']=_['keys'](db['Dashboard'][_0xc25b('0x31')]);_0xae144a[_0xc25b('0x36')]=_['keys'](_0xf36f2f[_0xc25b('0x36')]);_0xae144a[_0xc25b('0x38')]=_[_0xc25b('0x39')](_0xae144a['model'],_0xae144a['query']);_0x3d0d9c['attributes']=_[_0xc25b('0x39')](_0xae144a[_0xc25b('0x35')],qs[_0xc25b('0x3b')](_0xf36f2f['query'][_0xc25b('0x3b')]));_0x3d0d9c[_0xc25b('0x3a')]=_0x3d0d9c[_0xc25b('0x3a')]['length']?_0x3d0d9c[_0xc25b('0x3a')]:_0xae144a[_0xc25b('0x35')];if(_0xf36f2f[_0xc25b('0x36')][_0xc25b('0x44')]){_0x3d0d9c[_0xc25b('0x45')]=[{'all':!![]}];}_0x3d0d9c=_[_0xc25b('0x42')]({},_0x3d0d9c,_0xf36f2f[_0xc25b('0x4b')]);return db['Dashboard'][_0xc25b('0x4c')](_0x3d0d9c)[_0xc25b('0x27')](handleEntityNotFound(_0x5374c5,null))[_0xc25b('0x27')](respondWithResult(_0x5374c5,null))[_0xc25b('0x48')](handleError(_0x5374c5,null));};exports[_0xc25b('0x4d')]=function(_0x4de3c8,_0x5e4e60){return db[_0xc25b('0x30')][_0xc25b('0x4d')](_0x4de3c8[_0xc25b('0x4e')],{})['then'](function(_0x20528e){var _0x332afa=_0x4de3c8[_0xc25b('0x4f')][_0xc25b('0x29')]({'plain':!![]});if(!_0x332afa)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x332afa[_0xc25b('0x50')]==='user'){var _0x12d0a4=_0x20528e[_0xc25b('0x29')]({'plain':!![]});var _0x2bdbb1='CustomDashboards';return db[_0xc25b('0x51')][_0xc25b('0x4c')]({'where':{'name':_0x2bdbb1,'userProfileId':_0x332afa['userProfileId']},'raw':!![]})['then'](function(_0x3d82d2){if(_0x3d82d2&&_0x3d82d2[_0xc25b('0x52')]===0x0){return db[_0xc25b('0x2a')][_0xc25b('0x4d')]({'name':_0x12d0a4[_0xc25b('0x2d')],'resourceId':_0x12d0a4['id'],'type':_0x3d82d2[_0xc25b('0x2d')],'sectionId':_0x3d82d2['id']},{})[_0xc25b('0x27')](function(){return _0x20528e;});}else{return _0x20528e;}})[_0xc25b('0x48')](function(_0x4bf393){logger[_0xc25b('0x2b')](_0xc25b('0x53'),_0x4bf393);throw _0x4bf393;});}return _0x20528e;})['then'](respondWithResult(_0x5e4e60,0xc9))['catch'](handleError(_0x5e4e60,null));};exports[_0xc25b('0x54')]=function(_0x336644,_0x6dba24){var _0xdb140a={'where':{'id':_0x336644[_0xc25b('0x4a')]['id']}},_0x4d0efd={};_0x4d0efd['model']=_[_0xc25b('0x37')](db[_0xc25b('0x30')][_0xc25b('0x31')]);_0xdb140a['attributes']=_[_0xc25b('0x39')](_0x4d0efd[_0xc25b('0x35')],qs[_0xc25b('0x3b')](_0x336644[_0xc25b('0x36')][_0xc25b('0x3b')]));_0xdb140a[_0xc25b('0x3a')]=_0xdb140a[_0xc25b('0x3a')][_0xc25b('0x3c')]?_0xdb140a[_0xc25b('0x3a')]:_0x4d0efd[_0xc25b('0x35')];if(_0x336644[_0xc25b('0x36')][_0xc25b('0x44')]){_0xdb140a['include']=[{'all':!![]}];}_0xdb140a=_[_0xc25b('0x42')]({},_0xdb140a,_0x336644[_0xc25b('0x4b')]);return db['Dashboard'][_0xc25b('0x4c')](_0xdb140a)[_0xc25b('0x27')](handleEntityNotFound(_0x6dba24,null))[_0xc25b('0x27')](function(_0x4a41d0){if(_0x4a41d0){var _0x3a0e52=_0x4a41d0[_0xc25b('0x29')]({'plain':!![]});_0x3a0e52=qs[_0xc25b('0x55')](_0x3a0e52,['id',_0xc25b('0x56'),'updatedAt']);_0x336644[_0xc25b('0x4e')]=_['omit'](_0x336644[_0xc25b('0x4e')],['id',_0xc25b('0x56'),_0xc25b('0x57')]);return db['Dashboard'][_0xc25b('0x4d')](_[_0xc25b('0x42')](_0x3a0e52,_0x336644[_0xc25b('0x4e')]),{'include':_0x336644[_0xc25b('0x36')][_0xc25b('0x44')]?[{'all':!![]}]:undefined})[_0xc25b('0x27')](function(_0x3c9146){var _0x41f2d5=_0x336644[_0xc25b('0x4f')]['get']({'plain':!![]});if(!_0x41f2d5)throw new Error(_0xc25b('0x58'));if(_0x41f2d5[_0xc25b('0x50')]==='user'){var _0x4815d2=_0x3c9146[_0xc25b('0x29')]({'plain':!![]});var _0x2338ec=_0xc25b('0x59');return db[_0xc25b('0x51')][_0xc25b('0x4c')]({'where':{'name':_0x2338ec,'userProfileId':_0x41f2d5[_0xc25b('0x5a')]},'raw':!![]})[_0xc25b('0x27')](function(_0x48645e){if(_0x48645e&&_0x48645e[_0xc25b('0x52')]===0x0){return db[_0xc25b('0x2a')][_0xc25b('0x4d')]({'name':_0x4815d2[_0xc25b('0x2d')],'resourceId':_0x4815d2['id'],'type':_0x48645e[_0xc25b('0x2d')],'sectionId':_0x48645e['id']},{})[_0xc25b('0x27')](function(){return _0x3c9146;});}else{return _0x3c9146;}})[_0xc25b('0x48')](function(_0x3576de){logger[_0xc25b('0x2b')](_0xc25b('0x53'),_0x3576de);throw _0x3576de;});}return _0x3c9146;});}})[_0xc25b('0x27')](respondWithResult(_0x6dba24,0xc9))['catch'](handleError(_0x6dba24,null));};exports[_0xc25b('0x26')]=function(_0x3595bb,_0x2fcfbf){if(_0x3595bb[_0xc25b('0x4e')]['id']){delete _0x3595bb[_0xc25b('0x4e')]['id'];}return db[_0xc25b('0x30')][_0xc25b('0x4c')]({'where':{'id':_0x3595bb[_0xc25b('0x4a')]['id']}})[_0xc25b('0x27')](handleEntityNotFound(_0x2fcfbf,null))[_0xc25b('0x27')](saveUpdates(_0x3595bb['body'],null))[_0xc25b('0x27')](respondWithResult(_0x2fcfbf,null))[_0xc25b('0x48')](handleError(_0x2fcfbf,null));};exports[_0xc25b('0x28')]=function(_0xf9eb23,_0x54f07e){return db[_0xc25b('0x30')][_0xc25b('0x4c')]({'where':{'id':_0xf9eb23[_0xc25b('0x4a')]['id']}})[_0xc25b('0x27')](handleEntityNotFound(_0x54f07e,null))[_0xc25b('0x27')](removeEntity(_0x54f07e,null))['catch'](handleError(_0x54f07e,null));};function widgetAttributes(_0x49498f){try{switch(_0x49498f['type']){case _0xc25b('0x5b'):return[{'name':_0xc25b('0x5c'),'value':_0x49498f[_0xc25b('0x5c')]||(_0x49498f['attrs']&&_0x49498f[_0xc25b('0x5d')][0x0]?_0x49498f[_0xc25b('0x5d')][0x0][_0xc25b('0x5e')]:undefined)||_0xc25b('0x5f')}];case _0xc25b('0x60'):return[{'name':_0xc25b('0x61'),'value':_0x49498f[_0xc25b('0x61')]||(_0x49498f['attrs']&&_0x49498f[_0xc25b('0x5d')][0x0]?_0x49498f[_0xc25b('0x5d')][0x0][_0xc25b('0x5e')]:undefined)||''}];case _0xc25b('0x62'):return[{'name':_0xc25b('0x63'),'value':_0x49498f[_0xc25b('0x63')]||(_0x49498f[_0xc25b('0x5d')]&&_0x49498f[_0xc25b('0x5d')][0x0]?_0x49498f['attrs'][0x0]['value']:undefined)||_0xc25b('0x64')},{'name':_0xc25b('0x65'),'value':_0x49498f[_0xc25b('0x65')]||(_0x49498f['attrs']&&_0x49498f['attrs'][0x1]?_0x49498f[_0xc25b('0x5d')][0x1][_0xc25b('0x5e')]:undefined)||_0xc25b('0x66')},{'name':_0xc25b('0x67'),'value':_0x49498f[_0xc25b('0x67')]||(_0x49498f[_0xc25b('0x5d')]&&_0x49498f[_0xc25b('0x5d')][0x2]?_0x49498f[_0xc25b('0x5d')][0x2][_0xc25b('0x5e')]:undefined)||0xc}];case _0xc25b('0x68'):return[{'name':_0xc25b('0x69'),'value':_0x49498f[_0xc25b('0x69')]||(_0x49498f[_0xc25b('0x5d')]&&_0x49498f['attrs'][0x0]?_0x49498f[_0xc25b('0x5d')][0x0][_0xc25b('0x5e')]:undefined)||'total'},{'name':_0xc25b('0x6a'),'value':_0x49498f[_0xc25b('0x6a')]||(_0x49498f['attrs']&&_0x49498f[_0xc25b('0x5d')][0x1]?_0x49498f['attrs'][0x1][_0xc25b('0x5e')]:undefined)||[]},{'name':_0xc25b('0x67'),'value':_0x49498f[_0xc25b('0x67')]||(_0x49498f['attrs']&&_0x49498f['attrs'][0x2]?_0x49498f[_0xc25b('0x5d')][0x2][_0xc25b('0x5e')]:undefined)||0x14},{'name':'attrChannel','value':_0x49498f[_0xc25b('0x6b')]||(_0x49498f[_0xc25b('0x5d')]&&_0x49498f[_0xc25b('0x5d')][0x3]?_0x49498f[_0xc25b('0x5d')][0x3][_0xc25b('0x5e')]:undefined)||_0xc25b('0x6c')},{'name':'attrEmailAccounts','value':_0x49498f[_0xc25b('0x6d')]||(_0x49498f[_0xc25b('0x5d')]&&_0x49498f['attrs'][0x4]?_0x49498f['attrs'][0x4]['value']:undefined)||''},{'name':_0xc25b('0x6e'),'value':_0x49498f['attrFaxAccounts']||(_0x49498f[_0xc25b('0x5d')]&&_0x49498f[_0xc25b('0x5d')][0x5]?_0x49498f[_0xc25b('0x5d')][0x5][_0xc25b('0x5e')]:undefined)||''},{'name':_0xc25b('0x6f'),'value':_0x49498f[_0xc25b('0x6f')]||(_0x49498f[_0xc25b('0x5d')]&&_0x49498f[_0xc25b('0x5d')][0x6]?_0x49498f[_0xc25b('0x5d')][0x6][_0xc25b('0x5e')]:undefined)||''},{'name':_0xc25b('0x70'),'value':_0x49498f[_0xc25b('0x70')]||(_0x49498f[_0xc25b('0x5d')]&&_0x49498f[_0xc25b('0x5d')][0x7]?_0x49498f[_0xc25b('0x5d')][0x7][_0xc25b('0x5e')]:undefined)||''},{'name':_0xc25b('0x71'),'value':_0x49498f['attrWhatsappAccounts']||(_0x49498f[_0xc25b('0x5d')]&&_0x49498f['attrs'][0x8]?_0x49498f[_0xc25b('0x5d')][0x8][_0xc25b('0x5e')]:undefined)||''},{'name':_0xc25b('0x72'),'value':_0x49498f[_0xc25b('0x72')]||(_0x49498f[_0xc25b('0x5d')]&&_0x49498f['attrs'][0x9]?_0x49498f['attrs'][0x9][_0xc25b('0x5e')]:undefined)||''}];case _0xc25b('0x73'):case _0xc25b('0x74'):return[{'name':_0xc25b('0x75'),'value':_0x49498f[_0xc25b('0x75')]||(_0x49498f['attrs']&&_0x49498f[_0xc25b('0x5d')][0x0]?_0x49498f[_0xc25b('0x5d')][0x0]['value']:undefined)||'total'},{'name':_0xc25b('0x76'),'value':_0x49498f[_0xc25b('0x76')]||(_0x49498f['attrs']&&_0x49498f['attrs'][0x1]?_0x49498f[_0xc25b('0x5d')][0x1][_0xc25b('0x5e')]:undefined)||null},{'name':_0xc25b('0x77'),'value':_0x49498f[_0xc25b('0x77')]||(_0x49498f['attrs']&&_0x49498f['attrs'][0x2]?_0x49498f[_0xc25b('0x5d')][0x2][_0xc25b('0x5e')]:undefined)||null},{'name':_0xc25b('0x6a'),'value':_0x49498f['attrVoiceQueues']||(_0x49498f[_0xc25b('0x5d')]&&_0x49498f['attrs'][0x3]?_0x49498f[_0xc25b('0x5d')][0x3][_0xc25b('0x5e')]:undefined)||[]},{'name':'attrChannel','value':_0x49498f[_0xc25b('0x6b')]||(_0x49498f[_0xc25b('0x5d')]&&_0x49498f[_0xc25b('0x5d')][0x4]?_0x49498f[_0xc25b('0x5d')][0x4]['value']:undefined)||'voice'},{'name':_0xc25b('0x6d'),'value':_0x49498f['attrEmailAccounts']||(_0x49498f[_0xc25b('0x5d')]&&_0x49498f['attrs'][0x5]?_0x49498f['attrs'][0x5][_0xc25b('0x5e')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x49498f['attrFaxAccounts']||(_0x49498f[_0xc25b('0x5d')]&&_0x49498f[_0xc25b('0x5d')][0x6]?_0x49498f[_0xc25b('0x5d')][0x6][_0xc25b('0x5e')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x49498f[_0xc25b('0x6f')]||(_0x49498f['attrs']&&_0x49498f['attrs'][0x7]?_0x49498f[_0xc25b('0x5d')][0x7]['value']:undefined)||''},{'name':_0xc25b('0x70'),'value':_0x49498f[_0xc25b('0x70')]||(_0x49498f[_0xc25b('0x5d')]&&_0x49498f[_0xc25b('0x5d')][0x8]?_0x49498f[_0xc25b('0x5d')][0x8][_0xc25b('0x5e')]:undefined)||''},{'name':_0xc25b('0x71'),'value':_0x49498f[_0xc25b('0x71')]||(_0x49498f['attrs']&&_0x49498f[_0xc25b('0x5d')][0x9]?_0x49498f[_0xc25b('0x5d')][0x9][_0xc25b('0x5e')]:undefined)||''},{'name':_0xc25b('0x72'),'value':_0x49498f[_0xc25b('0x72')]||(_0x49498f[_0xc25b('0x5d')]&&_0x49498f[_0xc25b('0x5d')][0xa]?_0x49498f['attrs'][0xa][_0xc25b('0x5e')]:undefined)||''}];case _0xc25b('0x78'):return[{'name':_0xc25b('0x79'),'type':_0x49498f[_0xc25b('0x7a')]||(_0x49498f[_0xc25b('0x5d')]&&_0x49498f[_0xc25b('0x5d')][0x0]?_0x49498f[_0xc25b('0x5d')][0x0][_0xc25b('0x33')]:undefined)||null,'value':_0x49498f[_0xc25b('0x79')]||(_0x49498f[_0xc25b('0x5d')]&&_0x49498f[_0xc25b('0x5d')][0x0]?_0x49498f[_0xc25b('0x5d')][0x0][_0xc25b('0x5e')]:undefined)||null},{'name':_0xc25b('0x7b'),'value':_0x49498f['attrRefresh']||(_0x49498f[_0xc25b('0x5d')]&&_0x49498f[_0xc25b('0x5d')][0x1]?_0x49498f[_0xc25b('0x5d')][0x1][_0xc25b('0x5e')]:undefined)||0x0}];default:return[];}}catch(_0x49c5b5){logger[_0xc25b('0x2b')]('widgetAttributes:\x20%s',JSON[_0xc25b('0x7c')](_0x49c5b5));return[];}}exports[_0xc25b('0x7d')]=function(_0x33f65c,_0x1cbf13,_0x5c4ce2){if(_0x33f65c[_0xc25b('0x4e')]['id']){delete _0x33f65c[_0xc25b('0x4e')]['id'];}return db[_0xc25b('0x30')]['find']({'where':{'id':_0x33f65c[_0xc25b('0x4a')]['id']}})[_0xc25b('0x27')](handleEntityNotFound(_0x1cbf13,null))[_0xc25b('0x27')](function(_0x5edcd2){if(_0x5edcd2){_0x33f65c['body'][_0xc25b('0x7e')]=_0x5edcd2['id'];_0x33f65c[_0xc25b('0x4e')][_0xc25b('0x5d')]=widgetAttributes(_0x33f65c[_0xc25b('0x4e')]);return db[_0xc25b('0x7f')][_0xc25b('0x4d')](_0x33f65c[_0xc25b('0x4e')]);}})[_0xc25b('0x27')](respondWithResult(_0x1cbf13,null))[_0xc25b('0x48')](handleError(_0x1cbf13,null));};exports[_0xc25b('0x80')]=function(_0x4b3307,_0x51da69,_0x46d6e9){var _0x3f7e27={};var _0x1d0645={};var _0x486a6d;var _0x2a1aad;return db[_0xc25b('0x30')]['findOne']({'where':{'id':_0x4b3307[_0xc25b('0x4a')]['id']}})['then'](handleEntityNotFound(_0x51da69,null))['then'](function(_0x17556b){if(_0x17556b){_0x486a6d=_0x17556b;_0x1d0645[_0xc25b('0x35')]=_[_0xc25b('0x37')](db[_0xc25b('0x7f')]['rawAttributes']);_0x1d0645['query']=_['keys'](_0x4b3307[_0xc25b('0x36')]);_0x1d0645['filters']=_['intersection'](_0x1d0645[_0xc25b('0x35')],_0x1d0645[_0xc25b('0x36')]);_0x3f7e27[_0xc25b('0x3a')]=_['intersection'](_0x1d0645[_0xc25b('0x35')],qs[_0xc25b('0x3b')](_0x4b3307[_0xc25b('0x36')][_0xc25b('0x3b')]));_0x3f7e27[_0xc25b('0x3a')]=_0x3f7e27[_0xc25b('0x3a')][_0xc25b('0x3c')]?_0x3f7e27[_0xc25b('0x3a')]:_0x1d0645['model'];_0x3f7e27['order']=qs['sort'](_0x4b3307[_0xc25b('0x36')]['sort']);_0x3f7e27['where']=qs[_0xc25b('0x38')](_[_0xc25b('0x41')](_0x4b3307[_0xc25b('0x36')],_0x1d0645[_0xc25b('0x38')]));if(_0x4b3307[_0xc25b('0x36')][_0xc25b('0x81')]){_0x3f7e27[_0xc25b('0x40')]=_['merge'](_0x3f7e27[_0xc25b('0x40')],{'$or':_[_0xc25b('0x2f')](_0x3f7e27[_0xc25b('0x3a')],function(_0x2e320b){var _0x8b01a0={};_0x8b01a0[_0x2e320b]={'$like':'%'+_0x4b3307[_0xc25b('0x36')][_0xc25b('0x81')]+'%'};return _0x8b01a0;})});}_0x3f7e27=_[_0xc25b('0x42')]({},_0x3f7e27,_0x4b3307[_0xc25b('0x4b')]);return _0x486a6d[_0xc25b('0x80')](_0x3f7e27);}})[_0xc25b('0x27')](function(_0x989aa4){if(_0x989aa4){_0x2a1aad=_0x989aa4[_0xc25b('0x3c')];if(!_0x4b3307[_0xc25b('0x36')]['hasOwnProperty'](_0xc25b('0x3e'))){_0x3f7e27[_0xc25b('0x22')]=qs[_0xc25b('0x22')](_0x4b3307[_0xc25b('0x36')]['limit']);_0x3f7e27[_0xc25b('0x21')]=qs['offset'](_0x4b3307[_0xc25b('0x36')][_0xc25b('0x21')]);}return _0x486a6d[_0xc25b('0x80')](_0x3f7e27);}})[_0xc25b('0x27')](function(_0x3bf5b7){if(_0x3bf5b7){return _0x3bf5b7?{'count':_0x2a1aad,'rows':_0x3bf5b7}:null;}})[_0xc25b('0x27')](respondWithResult(_0x51da69,null))[_0xc25b('0x48')](handleError(_0x51da69,null));}; \ No newline at end of file +var _0xb382=['api','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./dashboard.socket','register','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','save','update','then','CustomDashboards','destroy','error','stack','name','send','index','map','Dashboard','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','catch','show','params','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','clone','omit','createdAt','updatedAt','iframe','attrUrl','attrs','value','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrSmsAccounts','reportType','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','getItems','zip-dir','fast-json-patch','moment','util','path','to-csv','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb382,0x6c));var _0x2b38=function(_0x1e484a,_0x1bb40a){_0x1e484a=_0x1e484a-0x0;var _0x419b03=_0xb382[_0x1e484a];return _0x419b03;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x2b38('0x0'));var jsonpatch=require(_0x2b38('0x1'));var rp=require('request-promise');var moment=require(_0x2b38('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2b38('0x3'));var path=require(_0x2b38('0x4'));var sox=require('sox');var csv=require(_0x2b38('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2b38('0x6'));var _=require(_0x2b38('0x7'));var squel=require(_0x2b38('0x8'));var crypto=require('crypto');var jsforce=require(_0x2b38('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x2b38('0x5'));var querystring=require(_0x2b38('0xa'));var Papa=require(_0x2b38('0xb'));var Redis=require(_0x2b38('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x2b38('0xd'));var as=require(_0x2b38('0xe'));var hardwareService=require(_0x2b38('0xf'));var logger=require(_0x2b38('0x10'))(_0x2b38('0x11'));var utils=require('../../config/utils');var config=require(_0x2b38('0x12'));var licenseUtil=require(_0x2b38('0x13'));var db=require('../../mysqldb')['db'];config[_0x2b38('0x14')]=_[_0x2b38('0x15')](config[_0x2b38('0x14')],{'host':'localhost','port':0x18eb});var socket=require(_0x2b38('0x16'))(new Redis(config[_0x2b38('0x14')]));require(_0x2b38('0x17'))[_0x2b38('0x18')](socket);function respondWithStatusCode(_0x5c7ebb,_0x48adb8){_0x48adb8=_0x48adb8||0xcc;return function(_0x4aa7fd){if(_0x4aa7fd){return _0x5c7ebb[_0x2b38('0x19')](_0x48adb8);}return _0x5c7ebb[_0x2b38('0x1a')](_0x48adb8)[_0x2b38('0x1b')]();};}function respondWithResult(_0x3a5080,_0x5782dd){_0x5782dd=_0x5782dd||0xc8;return function(_0x167f16){if(_0x167f16){return _0x3a5080['status'](_0x5782dd)['json'](_0x167f16);}};}function respondWithFilteredResult(_0x11f67c,_0x1286a2){return function(_0x57d14f){if(_0x57d14f){var _0xc88645=typeof _0x1286a2[_0x2b38('0x1c')]===_0x2b38('0x1d')&&typeof _0x1286a2['limit']==='undefined';var _0x457c24=_0x57d14f[_0x2b38('0x1e')];var _0x3e8bac=_0xc88645?0x0:_0x1286a2['offset'];var _0x378b28=_0xc88645?_0x57d14f[_0x2b38('0x1e')]:_0x1286a2['offset']+_0x1286a2[_0x2b38('0x1f')];var _0x32ddd9;if(_0x378b28>=_0x457c24){_0x378b28=_0x457c24;_0x32ddd9=0xc8;}else{_0x32ddd9=0xce;}_0x11f67c[_0x2b38('0x1a')](_0x32ddd9);return _0x11f67c[_0x2b38('0x20')](_0x2b38('0x21'),_0x3e8bac+'-'+_0x378b28+'/'+_0x457c24)[_0x2b38('0x22')](_0x57d14f);}return null;};}function patchUpdates(_0x5d475c){return function(_0xd0b7f1){try{jsonpatch['apply'](_0xd0b7f1,_0x5d475c,!![]);}catch(_0x46b25d){return BPromise['reject'](_0x46b25d);}return _0xd0b7f1[_0x2b38('0x23')]();};}function saveUpdates(_0x4e8f40,_0x209f97){return function(_0x27c257){if(_0x27c257){return _0x27c257[_0x2b38('0x24')](_0x4e8f40)['then'](function(_0x5124c3){return _0x5124c3;});}return null;};}function removeEntity(_0x265619,_0x86ed0e){return function(_0x5e4d70){if(_0x5e4d70){return _0x5e4d70['destroy']()[_0x2b38('0x25')](function(){var _0x48f413=_0x5e4d70['get']({'plain':!![]});var _0x1403a3=_0x2b38('0x26');return db['UserProfileResource'][_0x2b38('0x27')]({'where':{'type':_0x1403a3,'resourceId':_0x48f413['id']}})[_0x2b38('0x25')](function(){return _0x5e4d70;});})[_0x2b38('0x25')](function(){_0x265619['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xeefb6,_0x1ac187){return function(_0x1213e5){if(!_0x1213e5){_0xeefb6[_0x2b38('0x19')](0x194);}return _0x1213e5;};}function handleError(_0x37ff4f,_0x540dcd){_0x540dcd=_0x540dcd||0x1f4;return function(_0xac3a6e){logger[_0x2b38('0x28')](_0xac3a6e[_0x2b38('0x29')]);if(_0xac3a6e['name']){delete _0xac3a6e[_0x2b38('0x2a')];}_0x37ff4f['status'](_0x540dcd)[_0x2b38('0x2b')](_0xac3a6e);};}exports[_0x2b38('0x2c')]=function(_0x3cc033,_0xf66a36){var _0x31d34e={},_0x42ffa3={},_0x29427a={'count':0x0,'rows':[]};var _0x28b4cd=_[_0x2b38('0x2d')](db[_0x2b38('0x2e')][_0x2b38('0x2f')],function(_0x3e1257){return{'name':_0x3e1257[_0x2b38('0x30')],'type':_0x3e1257[_0x2b38('0x31')][_0x2b38('0x32')]};});_0x42ffa3[_0x2b38('0x33')]=_[_0x2b38('0x2d')](_0x28b4cd,'name');_0x42ffa3[_0x2b38('0x34')]=_[_0x2b38('0x35')](_0x3cc033['query']);_0x42ffa3[_0x2b38('0x36')]=_[_0x2b38('0x37')](_0x42ffa3[_0x2b38('0x33')],_0x42ffa3[_0x2b38('0x34')]);_0x31d34e[_0x2b38('0x38')]=_[_0x2b38('0x37')](_0x42ffa3[_0x2b38('0x33')],qs[_0x2b38('0x39')](_0x3cc033[_0x2b38('0x34')]['fields']));_0x31d34e['attributes']=_0x31d34e[_0x2b38('0x38')][_0x2b38('0x3a')]?_0x31d34e[_0x2b38('0x38')]:_0x42ffa3['model'];if(!_0x3cc033[_0x2b38('0x34')][_0x2b38('0x3b')](_0x2b38('0x3c'))){_0x31d34e['limit']=qs[_0x2b38('0x1f')](_0x3cc033[_0x2b38('0x34')][_0x2b38('0x1f')]);_0x31d34e[_0x2b38('0x1c')]=qs[_0x2b38('0x1c')](_0x3cc033['query'][_0x2b38('0x1c')]);}_0x31d34e['order']=qs[_0x2b38('0x3d')](_0x3cc033[_0x2b38('0x34')]['sort']);_0x31d34e[_0x2b38('0x3e')]=qs[_0x2b38('0x36')](_[_0x2b38('0x3f')](_0x3cc033[_0x2b38('0x34')],_0x42ffa3[_0x2b38('0x36')]),_0x28b4cd);if(_0x3cc033[_0x2b38('0x34')][_0x2b38('0x40')]){_0x31d34e['where']=_[_0x2b38('0x41')](_0x31d34e[_0x2b38('0x3e')],{'$or':_[_0x2b38('0x2d')](_0x28b4cd,function(_0x4f4a20){if(_0x4f4a20[_0x2b38('0x31')]!=='VIRTUAL'){var _0x316468={};_0x316468[_0x4f4a20[_0x2b38('0x2a')]]={'$like':'%'+_0x3cc033[_0x2b38('0x34')][_0x2b38('0x40')]+'%'};return _0x316468;}})});}_0x31d34e=_[_0x2b38('0x41')]({},_0x31d34e,_0x3cc033[_0x2b38('0x42')]);var _0x464270={'where':_0x31d34e[_0x2b38('0x3e')]};return db['Dashboard'][_0x2b38('0x1e')](_0x464270)[_0x2b38('0x25')](function(_0x5497b9){_0x29427a['count']=_0x5497b9;if(_0x3cc033[_0x2b38('0x34')][_0x2b38('0x43')]){_0x31d34e[_0x2b38('0x44')]=[{'all':!![]}];}return db[_0x2b38('0x2e')]['findAll'](_0x31d34e);})['then'](function(_0x148e1e){_0x29427a['rows']=_0x148e1e;return _0x29427a;})[_0x2b38('0x25')](respondWithFilteredResult(_0xf66a36,_0x31d34e))[_0x2b38('0x45')](handleError(_0xf66a36,null));};exports[_0x2b38('0x46')]=function(_0x38e3e6,_0x2bebeb){var _0x39dffb={'raw':![],'where':{'id':_0x38e3e6[_0x2b38('0x47')]['id']}},_0x5599e1={};_0x5599e1['model']=_['keys'](db[_0x2b38('0x2e')][_0x2b38('0x2f')]);_0x5599e1[_0x2b38('0x34')]=_[_0x2b38('0x35')](_0x38e3e6['query']);_0x5599e1[_0x2b38('0x36')]=_[_0x2b38('0x37')](_0x5599e1[_0x2b38('0x33')],_0x5599e1[_0x2b38('0x34')]);_0x39dffb[_0x2b38('0x38')]=_['intersection'](_0x5599e1[_0x2b38('0x33')],qs[_0x2b38('0x39')](_0x38e3e6[_0x2b38('0x34')][_0x2b38('0x39')]));_0x39dffb['attributes']=_0x39dffb[_0x2b38('0x38')]['length']?_0x39dffb[_0x2b38('0x38')]:_0x5599e1['model'];if(_0x38e3e6[_0x2b38('0x34')][_0x2b38('0x43')]){_0x39dffb[_0x2b38('0x44')]=[{'all':!![]}];}_0x39dffb=_[_0x2b38('0x41')]({},_0x39dffb,_0x38e3e6[_0x2b38('0x42')]);return db[_0x2b38('0x2e')][_0x2b38('0x48')](_0x39dffb)[_0x2b38('0x25')](handleEntityNotFound(_0x2bebeb,null))[_0x2b38('0x25')](respondWithResult(_0x2bebeb,null))[_0x2b38('0x45')](handleError(_0x2bebeb,null));};exports['create']=function(_0x10baa3,_0x5439fb){return db[_0x2b38('0x2e')][_0x2b38('0x49')](_0x10baa3[_0x2b38('0x4a')],{})[_0x2b38('0x25')](function(_0x123e11){var _0x14db77=_0x10baa3[_0x2b38('0x4b')][_0x2b38('0x4c')]({'plain':!![]});if(!_0x14db77)throw new Error(_0x2b38('0x4d'));if(_0x14db77[_0x2b38('0x4e')]==='user'){var _0x570989=_0x123e11[_0x2b38('0x4c')]({'plain':!![]});var _0x1ca592='CustomDashboards';return db[_0x2b38('0x4f')][_0x2b38('0x48')]({'where':{'name':_0x1ca592,'userProfileId':_0x14db77[_0x2b38('0x50')]},'raw':!![]})['then'](function(_0xa6b323){if(_0xa6b323&&_0xa6b323[_0x2b38('0x51')]===0x0){return db[_0x2b38('0x52')][_0x2b38('0x49')]({'name':_0x570989['name'],'resourceId':_0x570989['id'],'type':_0xa6b323[_0x2b38('0x2a')],'sectionId':_0xa6b323['id']},{})[_0x2b38('0x25')](function(){return _0x123e11;});}else{return _0x123e11;}})[_0x2b38('0x45')](function(_0x2ba978){logger[_0x2b38('0x28')](_0x2b38('0x53'),_0x2ba978);throw _0x2ba978;});}return _0x123e11;})[_0x2b38('0x25')](respondWithResult(_0x5439fb,0xc9))[_0x2b38('0x45')](handleError(_0x5439fb,null));};exports[_0x2b38('0x54')]=function(_0x4c86cd,_0x33af38){var _0x56a3f8={'where':{'id':_0x4c86cd[_0x2b38('0x47')]['id']}},_0x3988e2={};_0x3988e2[_0x2b38('0x33')]=_[_0x2b38('0x35')](db[_0x2b38('0x2e')][_0x2b38('0x2f')]);_0x56a3f8[_0x2b38('0x38')]=_[_0x2b38('0x37')](_0x3988e2[_0x2b38('0x33')],qs[_0x2b38('0x39')](_0x4c86cd[_0x2b38('0x34')][_0x2b38('0x39')]));_0x56a3f8['attributes']=_0x56a3f8['attributes'][_0x2b38('0x3a')]?_0x56a3f8[_0x2b38('0x38')]:_0x3988e2[_0x2b38('0x33')];if(_0x4c86cd[_0x2b38('0x34')]['includeAll']){_0x56a3f8[_0x2b38('0x44')]=[{'all':!![]}];}_0x56a3f8=_[_0x2b38('0x41')]({},_0x56a3f8,_0x4c86cd[_0x2b38('0x42')]);return db[_0x2b38('0x2e')][_0x2b38('0x48')](_0x56a3f8)[_0x2b38('0x25')](handleEntityNotFound(_0x33af38,null))['then'](function(_0x5b09d3){if(_0x5b09d3){var _0x1727a3=_0x5b09d3[_0x2b38('0x4c')]({'plain':!![]});_0x1727a3=qs[_0x2b38('0x55')](_0x1727a3,['id',_0x2b38('0x56'),_0x2b38('0x57')]);_0x4c86cd[_0x2b38('0x4a')]=_[_0x2b38('0x55')](_0x4c86cd[_0x2b38('0x4a')],['id','createdAt',_0x2b38('0x57')]);return db['Dashboard'][_0x2b38('0x49')](_['merge'](_0x1727a3,_0x4c86cd[_0x2b38('0x4a')]),{'include':_0x4c86cd['query'][_0x2b38('0x43')]?[{'all':!![]}]:undefined})[_0x2b38('0x25')](function(_0x13a235){var _0x233888=_0x4c86cd[_0x2b38('0x4b')][_0x2b38('0x4c')]({'plain':!![]});if(!_0x233888)throw new Error(_0x2b38('0x4d'));if(_0x233888[_0x2b38('0x4e')]==='user'){var _0x283abd=_0x13a235[_0x2b38('0x4c')]({'plain':!![]});var _0x403413=_0x2b38('0x26');return db[_0x2b38('0x4f')][_0x2b38('0x48')]({'where':{'name':_0x403413,'userProfileId':_0x233888[_0x2b38('0x50')]},'raw':!![]})[_0x2b38('0x25')](function(_0x12884e){if(_0x12884e&&_0x12884e['autoAssociation']===0x0){return db[_0x2b38('0x52')][_0x2b38('0x49')]({'name':_0x283abd[_0x2b38('0x2a')],'resourceId':_0x283abd['id'],'type':_0x12884e[_0x2b38('0x2a')],'sectionId':_0x12884e['id']},{})['then'](function(){return _0x13a235;});}else{return _0x13a235;}})[_0x2b38('0x45')](function(_0x27b31c){logger[_0x2b38('0x28')](_0x2b38('0x53'),_0x27b31c);throw _0x27b31c;});}return _0x13a235;});}})[_0x2b38('0x25')](respondWithResult(_0x33af38,0xc9))[_0x2b38('0x45')](handleError(_0x33af38,null));};exports[_0x2b38('0x24')]=function(_0x51917f,_0x51caa2){if(_0x51917f[_0x2b38('0x4a')]['id']){delete _0x51917f[_0x2b38('0x4a')]['id'];}return db[_0x2b38('0x2e')][_0x2b38('0x48')]({'where':{'id':_0x51917f['params']['id']}})[_0x2b38('0x25')](handleEntityNotFound(_0x51caa2,null))[_0x2b38('0x25')](saveUpdates(_0x51917f[_0x2b38('0x4a')],null))[_0x2b38('0x25')](respondWithResult(_0x51caa2,null))[_0x2b38('0x45')](handleError(_0x51caa2,null));};exports[_0x2b38('0x27')]=function(_0x19f783,_0x2dc934){return db[_0x2b38('0x2e')]['find']({'where':{'id':_0x19f783['params']['id']}})[_0x2b38('0x25')](handleEntityNotFound(_0x2dc934,null))[_0x2b38('0x25')](removeEntity(_0x2dc934,null))[_0x2b38('0x45')](handleError(_0x2dc934,null));};function widgetAttributes(_0x32b957){try{switch(_0x32b957[_0x2b38('0x31')]){case _0x2b38('0x58'):return[{'name':'attrUrl','value':_0x32b957[_0x2b38('0x59')]||(_0x32b957[_0x2b38('0x5a')]&&_0x32b957[_0x2b38('0x5a')][0x0]?_0x32b957[_0x2b38('0x5a')][0x0][_0x2b38('0x5b')]:undefined)||'https://'}];case _0x2b38('0x5c'):return[{'name':_0x2b38('0x5d'),'value':_0x32b957[_0x2b38('0x5d')]||(_0x32b957['attrs']&&_0x32b957[_0x2b38('0x5a')][0x0]?_0x32b957[_0x2b38('0x5a')][0x0][_0x2b38('0x5b')]:undefined)||''}];case _0x2b38('0x5e'):return[{'name':'attrHourFormat','value':_0x32b957[_0x2b38('0x5f')]||(_0x32b957[_0x2b38('0x5a')]&&_0x32b957[_0x2b38('0x5a')][0x0]?_0x32b957[_0x2b38('0x5a')][0x0][_0x2b38('0x5b')]:undefined)||_0x2b38('0x60')},{'name':'attrTimezone','value':_0x32b957[_0x2b38('0x61')]||(_0x32b957[_0x2b38('0x5a')]&&_0x32b957['attrs'][0x1]?_0x32b957[_0x2b38('0x5a')][0x1][_0x2b38('0x5b')]:undefined)||_0x2b38('0x62')},{'name':'attrFontSize','value':_0x32b957[_0x2b38('0x63')]||(_0x32b957[_0x2b38('0x5a')]&&_0x32b957[_0x2b38('0x5a')][0x2]?_0x32b957[_0x2b38('0x5a')][0x2][_0x2b38('0x5b')]:undefined)||0xc}];case _0x2b38('0x64'):return[{'name':_0x2b38('0x65'),'value':_0x32b957[_0x2b38('0x65')]||(_0x32b957[_0x2b38('0x5a')]&&_0x32b957[_0x2b38('0x5a')][0x0]?_0x32b957[_0x2b38('0x5a')][0x0]['value']:undefined)||_0x2b38('0x66')},{'name':_0x2b38('0x67'),'value':_0x32b957[_0x2b38('0x67')]||(_0x32b957[_0x2b38('0x5a')]&&_0x32b957['attrs'][0x1]?_0x32b957[_0x2b38('0x5a')][0x1][_0x2b38('0x5b')]:undefined)||[]},{'name':_0x2b38('0x63'),'value':_0x32b957['attrFontSize']||(_0x32b957[_0x2b38('0x5a')]&&_0x32b957[_0x2b38('0x5a')][0x2]?_0x32b957[_0x2b38('0x5a')][0x2][_0x2b38('0x5b')]:undefined)||0x14},{'name':_0x2b38('0x68'),'value':_0x32b957[_0x2b38('0x68')]||(_0x32b957['attrs']&&_0x32b957[_0x2b38('0x5a')][0x3]?_0x32b957[_0x2b38('0x5a')][0x3]['value']:undefined)||_0x2b38('0x69')},{'name':_0x2b38('0x6a'),'value':_0x32b957[_0x2b38('0x6a')]||(_0x32b957[_0x2b38('0x5a')]&&_0x32b957[_0x2b38('0x5a')][0x4]?_0x32b957[_0x2b38('0x5a')][0x4][_0x2b38('0x5b')]:undefined)||''},{'name':_0x2b38('0x6b'),'value':_0x32b957[_0x2b38('0x6b')]||(_0x32b957[_0x2b38('0x5a')]&&_0x32b957[_0x2b38('0x5a')][0x5]?_0x32b957['attrs'][0x5]['value']:undefined)||''},{'name':'attrSmsAccounts','value':_0x32b957['attrSmsAccounts']||(_0x32b957['attrs']&&_0x32b957['attrs'][0x6]?_0x32b957['attrs'][0x6][_0x2b38('0x5b')]:undefined)||''},{'name':_0x2b38('0x6c'),'value':_0x32b957['attrOpenchannelAccounts']||(_0x32b957[_0x2b38('0x5a')]&&_0x32b957[_0x2b38('0x5a')][0x7]?_0x32b957[_0x2b38('0x5a')][0x7]['value']:undefined)||''},{'name':_0x2b38('0x6d'),'value':_0x32b957[_0x2b38('0x6d')]||(_0x32b957[_0x2b38('0x5a')]&&_0x32b957['attrs'][0x8]?_0x32b957[_0x2b38('0x5a')][0x8][_0x2b38('0x5b')]:undefined)||''},{'name':_0x2b38('0x6e'),'value':_0x32b957[_0x2b38('0x6e')]||(_0x32b957[_0x2b38('0x5a')]&&_0x32b957['attrs'][0x9]?_0x32b957['attrs'][0x9][_0x2b38('0x5b')]:undefined)||''}];case'multibar-chart':case _0x2b38('0x6f'):return[{'name':_0x2b38('0x70'),'value':_0x32b957[_0x2b38('0x70')]||(_0x32b957['attrs']&&_0x32b957['attrs'][0x0]?_0x32b957[_0x2b38('0x5a')][0x0][_0x2b38('0x5b')]:undefined)||'total'},{'name':_0x2b38('0x71'),'value':_0x32b957[_0x2b38('0x71')]||(_0x32b957[_0x2b38('0x5a')]&&_0x32b957[_0x2b38('0x5a')][0x1]?_0x32b957[_0x2b38('0x5a')][0x1][_0x2b38('0x5b')]:undefined)||null},{'name':_0x2b38('0x72'),'value':_0x32b957[_0x2b38('0x72')]||(_0x32b957[_0x2b38('0x5a')]&&_0x32b957[_0x2b38('0x5a')][0x2]?_0x32b957[_0x2b38('0x5a')][0x2][_0x2b38('0x5b')]:undefined)||null},{'name':_0x2b38('0x67'),'value':_0x32b957[_0x2b38('0x67')]||(_0x32b957[_0x2b38('0x5a')]&&_0x32b957[_0x2b38('0x5a')][0x3]?_0x32b957['attrs'][0x3]['value']:undefined)||[]},{'name':_0x2b38('0x68'),'value':_0x32b957[_0x2b38('0x68')]||(_0x32b957[_0x2b38('0x5a')]&&_0x32b957[_0x2b38('0x5a')][0x4]?_0x32b957[_0x2b38('0x5a')][0x4][_0x2b38('0x5b')]:undefined)||_0x2b38('0x69')},{'name':_0x2b38('0x6a'),'value':_0x32b957[_0x2b38('0x6a')]||(_0x32b957[_0x2b38('0x5a')]&&_0x32b957[_0x2b38('0x5a')][0x5]?_0x32b957['attrs'][0x5]['value']:undefined)||''},{'name':'attrFaxAccounts','value':_0x32b957['attrFaxAccounts']||(_0x32b957[_0x2b38('0x5a')]&&_0x32b957[_0x2b38('0x5a')][0x6]?_0x32b957[_0x2b38('0x5a')][0x6][_0x2b38('0x5b')]:undefined)||''},{'name':_0x2b38('0x73'),'value':_0x32b957[_0x2b38('0x73')]||(_0x32b957[_0x2b38('0x5a')]&&_0x32b957[_0x2b38('0x5a')][0x7]?_0x32b957[_0x2b38('0x5a')][0x7][_0x2b38('0x5b')]:undefined)||''},{'name':_0x2b38('0x6c'),'value':_0x32b957['attrOpenchannelAccounts']||(_0x32b957[_0x2b38('0x5a')]&&_0x32b957[_0x2b38('0x5a')][0x8]?_0x32b957[_0x2b38('0x5a')][0x8][_0x2b38('0x5b')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x32b957[_0x2b38('0x6d')]||(_0x32b957['attrs']&&_0x32b957['attrs'][0x9]?_0x32b957[_0x2b38('0x5a')][0x9][_0x2b38('0x5b')]:undefined)||''},{'name':'attrChatWebsites','value':_0x32b957[_0x2b38('0x6e')]||(_0x32b957[_0x2b38('0x5a')]&&_0x32b957[_0x2b38('0x5a')][0xa]?_0x32b957[_0x2b38('0x5a')][0xa][_0x2b38('0x5b')]:undefined)||''}];case'web-report':return[{'name':'attrReport','type':_0x32b957[_0x2b38('0x74')]||(_0x32b957[_0x2b38('0x5a')]&&_0x32b957['attrs'][0x0]?_0x32b957['attrs'][0x0][_0x2b38('0x31')]:undefined)||null,'value':_0x32b957[_0x2b38('0x75')]||(_0x32b957['attrs']&&_0x32b957[_0x2b38('0x5a')][0x0]?_0x32b957[_0x2b38('0x5a')][0x0][_0x2b38('0x5b')]:undefined)||null},{'name':'attrRefresh','value':_0x32b957[_0x2b38('0x76')]||(_0x32b957[_0x2b38('0x5a')]&&_0x32b957[_0x2b38('0x5a')][0x1]?_0x32b957[_0x2b38('0x5a')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x48ddea){logger['error'](_0x2b38('0x77'),JSON[_0x2b38('0x78')](_0x48ddea));return[];}}exports[_0x2b38('0x79')]=function(_0x79267f,_0x25481a,_0x42a439){if(_0x79267f[_0x2b38('0x4a')]['id']){delete _0x79267f[_0x2b38('0x4a')]['id'];}return db[_0x2b38('0x2e')][_0x2b38('0x48')]({'where':{'id':_0x79267f[_0x2b38('0x47')]['id']}})[_0x2b38('0x25')](handleEntityNotFound(_0x25481a,null))[_0x2b38('0x25')](function(_0x12be6c){if(_0x12be6c){_0x79267f[_0x2b38('0x4a')][_0x2b38('0x7a')]=_0x12be6c['id'];_0x79267f[_0x2b38('0x4a')][_0x2b38('0x5a')]=widgetAttributes(_0x79267f[_0x2b38('0x4a')]);return db[_0x2b38('0x7b')][_0x2b38('0x49')](_0x79267f[_0x2b38('0x4a')]);}})[_0x2b38('0x25')](respondWithResult(_0x25481a,null))['catch'](handleError(_0x25481a,null));};exports['getItems']=function(_0x2d3111,_0x92790b,_0xb5bc04){var _0x2d34df={};var _0x2fe62e={};var _0x35edfc;var _0x5262d4;return db['Dashboard']['findOne']({'where':{'id':_0x2d3111[_0x2b38('0x47')]['id']}})[_0x2b38('0x25')](handleEntityNotFound(_0x92790b,null))[_0x2b38('0x25')](function(_0x2f63db){if(_0x2f63db){_0x35edfc=_0x2f63db;_0x2fe62e[_0x2b38('0x33')]=_['keys'](db[_0x2b38('0x7b')]['rawAttributes']);_0x2fe62e['query']=_['keys'](_0x2d3111[_0x2b38('0x34')]);_0x2fe62e['filters']=_[_0x2b38('0x37')](_0x2fe62e[_0x2b38('0x33')],_0x2fe62e[_0x2b38('0x34')]);_0x2d34df['attributes']=_[_0x2b38('0x37')](_0x2fe62e[_0x2b38('0x33')],qs[_0x2b38('0x39')](_0x2d3111['query']['fields']));_0x2d34df[_0x2b38('0x38')]=_0x2d34df[_0x2b38('0x38')][_0x2b38('0x3a')]?_0x2d34df[_0x2b38('0x38')]:_0x2fe62e['model'];_0x2d34df['order']=qs[_0x2b38('0x3d')](_0x2d3111['query'][_0x2b38('0x3d')]);_0x2d34df[_0x2b38('0x3e')]=qs['filters'](_['pick'](_0x2d3111['query'],_0x2fe62e[_0x2b38('0x36')]));if(_0x2d3111['query'][_0x2b38('0x40')]){_0x2d34df[_0x2b38('0x3e')]=_[_0x2b38('0x41')](_0x2d34df[_0x2b38('0x3e')],{'$or':_['map'](_0x2d34df['attributes'],function(_0x40a78a){var _0x55103e={};_0x55103e[_0x40a78a]={'$like':'%'+_0x2d3111[_0x2b38('0x34')]['filter']+'%'};return _0x55103e;})});}_0x2d34df=_[_0x2b38('0x41')]({},_0x2d34df,_0x2d3111[_0x2b38('0x42')]);return _0x35edfc[_0x2b38('0x7c')](_0x2d34df);}})['then'](function(_0x4d7d19){if(_0x4d7d19){_0x5262d4=_0x4d7d19[_0x2b38('0x3a')];if(!_0x2d3111[_0x2b38('0x34')][_0x2b38('0x3b')](_0x2b38('0x3c'))){_0x2d34df[_0x2b38('0x1f')]=qs[_0x2b38('0x1f')](_0x2d3111[_0x2b38('0x34')][_0x2b38('0x1f')]);_0x2d34df[_0x2b38('0x1c')]=qs['offset'](_0x2d3111[_0x2b38('0x34')]['offset']);}return _0x35edfc[_0x2b38('0x7c')](_0x2d34df);}})['then'](function(_0x38375b){if(_0x38375b){return _0x38375b?{'count':_0x5262d4,'rows':_0x38375b}:null;}})[_0x2b38('0x25')](respondWithResult(_0x92790b,null))[_0x2b38('0x45')](handleError(_0x92790b,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 38a3155..59e7c1a 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 _0x6cb2=['Dashboard','setMaxListeners','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x2df507,_0x553862){var _0x1f7167=function(_0x11319e){while(--_0x11319e){_0x2df507['push'](_0x2df507['shift']());}};_0x1f7167(++_0x553862);}(_0x6cb2,0xfa));var _0x26cb=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x6cb2[_0x19950b];return _0x3c6b41;};'use strict';var EventEmitter=require(_0x26cb('0x0'));var Dashboard=require(_0x26cb('0x1'))['db'][_0x26cb('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x26cb('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x26cb('0x4'),'afterDestroy':_0x26cb('0x5')};function emitEvent(_0x40a63d){return function(_0x5daebc,_0x4044f3,_0x3a86b5){DashboardEvents[_0x26cb('0x6')](_0x40a63d+':'+_0x5daebc['id'],_0x5daebc);DashboardEvents[_0x26cb('0x6')](_0x40a63d,_0x5daebc);_0x3a86b5(null);};}for(var e in events){if(events[_0x26cb('0x7')](e)){var event=events[e];Dashboard[_0x26cb('0x8')](e,emitEvent(event));}}module['exports']=DashboardEvents; \ No newline at end of file +var _0x394d=['update','emit','hook','events','save'];(function(_0x2aec43,_0x2d7071){var _0x426785=function(_0x4e5a0c){while(--_0x4e5a0c){_0x2aec43['push'](_0x2aec43['shift']());}};_0x426785(++_0x2d7071);}(_0x394d,0x12a));var _0xd394=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0x394d[_0x1928c9];return _0x51b5fb;};'use strict';var EventEmitter=require(_0xd394('0x0'));var Dashboard=require('../../mysqldb')['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd394('0x1'),'afterUpdate':_0xd394('0x2'),'afterDestroy':'remove'};function emitEvent(_0x410368){return function(_0x499c7c,_0x278b36,_0x5c765b){DashboardEvents['emit'](_0x410368+':'+_0x499c7c['id'],_0x499c7c);DashboardEvents[_0xd394('0x3')](_0x410368,_0x499c7c);_0x5c765b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard[_0xd394('0x4')](e,emitEvent(event));}}module['exports']=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 2b090f8..a0de992 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 _0xca0a=['../../config/environment','./dashboard.attributes','exports','Dashboard','dashboards','lodash','api','moment','request-promise','path'];(function(_0x14457b,_0x55cb3d){var _0x4a9ed8=function(_0x2bbbf0){while(--_0x2bbbf0){_0x14457b['push'](_0x14457b['shift']());}};_0x4a9ed8(++_0x55cb3d);}(_0xca0a,0xf5));var _0xaca0=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xca0a[_0x9df060];return _0x338dfe;};'use strict';var _=require(_0xaca0('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xaca0('0x1'));var moment=require(_0xaca0('0x2'));var BPromise=require('bluebird');var rp=require(_0xaca0('0x3'));var fs=require('fs');var path=require(_0xaca0('0x4'));var rimraf=require('rimraf');var config=require(_0xaca0('0x5'));var attributes=require(_0xaca0('0x6'));module[_0xaca0('0x7')]=function(_0x56541f,_0x1f8510){return _0x56541f['define'](_0xaca0('0x8'),attributes,{'tableName':_0xaca0('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdb59=['define','Dashboard','lodash','util','api','moment','bluebird','path','../../config/environment','./dashboard.attributes','exports'];(function(_0x576666,_0x4a1273){var _0x46ff5b=function(_0x55eb41){while(--_0x55eb41){_0x576666['push'](_0x576666['shift']());}};_0x46ff5b(++_0x4a1273);}(_0xdb59,0x9c));var _0x9db5=function(_0x412faa,_0x6d5ea8){_0x412faa=_0x412faa-0x0;var _0x204402=_0xdb59[_0x412faa];return _0x204402;};'use strict';var _=require(_0x9db5('0x0'));var util=require(_0x9db5('0x1'));var logger=require('../../config/logger')(_0x9db5('0x2'));var moment=require(_0x9db5('0x3'));var BPromise=require(_0x9db5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9db5('0x5'));var rimraf=require('rimraf');var config=require(_0x9db5('0x6'));var attributes=require(_0x9db5('0x7'));module[_0x9db5('0x8')]=function(_0xf2b5f2,_0x47f101){return _0xf2b5f2[_0x9db5('0x9')](_0x9db5('0xa'),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 882042f..9792367 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 _0xc156=['util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','register','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0xc156,0xa2));var _0x6c15=function(_0x32d07c,_0x266921){_0x32d07c=_0x32d07c-0x0;var _0x53c25b=_0xc156[_0x32d07c];return _0x53c25b;};'use strict';var _=require('lodash');var util=require(_0x6c15('0x0'));var moment=require(_0x6c15('0x1'));var BPromise=require(_0x6c15('0x2'));var rs=require(_0x6c15('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6c15('0x4'))['db'];var utils=require(_0x6c15('0x5'));var logger=require('../../config/logger')(_0x6c15('0x6'));var config=require(_0x6c15('0x7'));var jayson=require(_0x6c15('0x8'));var client=jayson[_0x6c15('0x9')][_0x6c15('0xa')]({'port':0x232a});config[_0x6c15('0xb')]=_[_0x6c15('0xc')](config[_0x6c15('0xb')],{'host':_0x6c15('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./dashboard.socket')[_0x6c15('0xe')](socket);function respondWithRpcPromise(_0x1beed1,_0x1743dc,_0x13420f){return new BPromise(function(_0x11e129,_0x301809){return client['request'](_0x1beed1,_0x13420f)[_0x6c15('0xf')](function(_0x9c6d70){logger[_0x6c15('0x10')](_0x6c15('0x11'),_0x1743dc,_0x6c15('0x12'));logger[_0x6c15('0x13')](_0x6c15('0x14'),_0x1743dc,_0x6c15('0x12'),JSON[_0x6c15('0x15')](_0x9c6d70));if(_0x9c6d70[_0x6c15('0x16')]){if(_0x9c6d70[_0x6c15('0x16')][_0x6c15('0x17')]===0x1f4){logger[_0x6c15('0x16')](_0x6c15('0x11'),_0x1743dc,_0x9c6d70[_0x6c15('0x16')][_0x6c15('0x18')]);return _0x301809(_0x9c6d70[_0x6c15('0x16')][_0x6c15('0x18')]);}logger['error'](_0x6c15('0x11'),_0x1743dc,_0x9c6d70[_0x6c15('0x16')][_0x6c15('0x18')]);return _0x11e129(_0x9c6d70[_0x6c15('0x16')][_0x6c15('0x18')]);}else{logger[_0x6c15('0x10')](_0x6c15('0x11'),_0x1743dc,_0x6c15('0x12'));_0x11e129(_0x9c6d70[_0x6c15('0x19')][_0x6c15('0x18')]);}})[_0x6c15('0x1a')](function(_0x1704e2){logger['error']('Dashboard,\x20%s,\x20%s',_0x1743dc,_0x1704e2);_0x301809(_0x1704e2);});});} \ No newline at end of file +var _0x901a=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','request','then','info','Dashboard,\x20%s,\x20%s','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment'];(function(_0xb96f30,_0x1ec6a1){var _0xd8d174=function(_0x10bb33){while(--_0x10bb33){_0xb96f30['push'](_0xb96f30['shift']());}};_0xd8d174(++_0x1ec6a1);}(_0x901a,0x19d));var _0xa901=function(_0x4b039d,_0x55b356){_0x4b039d=_0x4b039d-0x0;var _0x4497ce=_0x901a[_0x4b039d];return _0x4497ce;};'use strict';var _=require(_0xa901('0x0'));var util=require(_0xa901('0x1'));var moment=require(_0xa901('0x2'));var BPromise=require(_0xa901('0x3'));var rs=require(_0xa901('0x4'));var fs=require('fs');var Redis=require(_0xa901('0x5'));var db=require(_0xa901('0x6'))['db'];var utils=require(_0xa901('0x7'));var logger=require(_0xa901('0x8'))(_0xa901('0x9'));var config=require(_0xa901('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xa901('0xb')][_0xa901('0xc')]({'port':0x232a});config[_0xa901('0xd')]=_[_0xa901('0xe')](config[_0xa901('0xd')],{'host':_0xa901('0xf'),'port':0x18eb});var socket=require(_0xa901('0x10'))(new Redis(config[_0xa901('0xd')]));require(_0xa901('0x11'))[_0xa901('0x12')](socket);function respondWithRpcPromise(_0x763676,_0x3fbc3e,_0x57cb04){return new BPromise(function(_0x505157,_0x40f21a){return client[_0xa901('0x13')](_0x763676,_0x57cb04)[_0xa901('0x14')](function(_0x5debf9){logger[_0xa901('0x15')](_0xa901('0x16'),_0x3fbc3e,'request\x20sent');logger[_0xa901('0x17')](_0xa901('0x18'),_0x3fbc3e,'request\x20sent',JSON[_0xa901('0x19')](_0x5debf9));if(_0x5debf9[_0xa901('0x1a')]){if(_0x5debf9['error'][_0xa901('0x1b')]===0x1f4){logger[_0xa901('0x1a')](_0xa901('0x16'),_0x3fbc3e,_0x5debf9[_0xa901('0x1a')][_0xa901('0x1c')]);return _0x40f21a(_0x5debf9['error'][_0xa901('0x1c')]);}logger[_0xa901('0x1a')]('Dashboard,\x20%s,\x20%s',_0x3fbc3e,_0x5debf9[_0xa901('0x1a')][_0xa901('0x1c')]);return _0x505157(_0x5debf9['error'][_0xa901('0x1c')]);}else{logger[_0xa901('0x15')](_0xa901('0x16'),_0x3fbc3e,_0xa901('0x1d'));_0x505157(_0x5debf9[_0xa901('0x1e')][_0xa901('0x1c')]);}})[_0xa901('0x1f')](function(_0xc34a0a){logger[_0xa901('0x1a')]('Dashboard,\x20%s,\x20%s',_0x3fbc3e,_0xc34a0a);_0x40f21a(_0xc34a0a);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index bd29b4a..975808e 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 _0xd4bd=['register','length','remove','update'];(function(_0x2537a2,_0x28e184){var _0x31c55e=function(_0x42f55b){while(--_0x42f55b){_0x2537a2['push'](_0x2537a2['shift']());}};_0x31c55e(++_0x28e184);}(_0xd4bd,0x1ee));var _0xdd4b=function(_0x55cd82,_0x111a93){_0x55cd82=_0x55cd82-0x0;var _0x59aee1=_0xd4bd[_0x55cd82];return _0x59aee1;};'use strict';var DashboardEvents=require('./dashboard.events');var events=['save',_0xdd4b('0x0'),_0xdd4b('0x1')];function createListener(_0x34f8dd,_0x4cf62e){return function(_0x295094){_0x4cf62e['emit'](_0x34f8dd,_0x295094);};}function removeListener(_0x36ee29,_0x26b3ee){return function(){DashboardEvents['removeListener'](_0x36ee29,_0x26b3ee);};}exports[_0xdd4b('0x2')]=function(_0x570ea9){for(var _0xa087f7=0x0,_0x33eb39=events[_0xdd4b('0x3')];_0xa087f7<_0x33eb39;_0xa087f7++){var _0x3eb63b=events[_0xa087f7];var _0x2f80b4=createListener('dashboard:'+_0x3eb63b,_0x570ea9);DashboardEvents['on'](_0x3eb63b,_0x2f80b4);}}; \ No newline at end of file +var _0x748f=['./dashboard.events','remove','update','emit','register'];(function(_0x38734b,_0x2edc9a){var _0xd62647=function(_0x5d4c37){while(--_0x5d4c37){_0x38734b['push'](_0x38734b['shift']());}};_0xd62647(++_0x2edc9a);}(_0x748f,0x1e5));var _0xf748=function(_0x5cc0e8,_0x5c68dd){_0x5cc0e8=_0x5cc0e8-0x0;var _0x5a81f8=_0x748f[_0x5cc0e8];return _0x5a81f8;};'use strict';var DashboardEvents=require(_0xf748('0x0'));var events=['save',_0xf748('0x1'),_0xf748('0x2')];function createListener(_0x590202,_0x1bdd26){return function(_0x141e81){_0x1bdd26[_0xf748('0x3')](_0x590202,_0x141e81);};}function removeListener(_0x59a838,_0x2b23a4){return function(){DashboardEvents['removeListener'](_0x59a838,_0x2b23a4);};}exports[_0xf748('0x4')]=function(_0x207911){for(var _0x311d19=0x0,_0x4534d4=events['length'];_0x311d19<_0x4534d4;_0x311d19++){var _0x426706=events[_0x311d19];var _0x45ca01=createListener('dashboard:'+_0x426706,_0x207911);DashboardEvents['on'](_0x426706,_0x45ca01);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 80c07ef..ad2d10e 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 _0xe152=['isAuthenticated','index','get','/:id','show','getItems','post','/:id/clone','clone','/:id/items','put','update','delete','destroy','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3d4f0a,_0x122ff2){var _0x4ab64e=function(_0x665450){while(--_0x665450){_0x3d4f0a['push'](_0x3d4f0a['shift']());}};_0x4ab64e(++_0x122ff2);}(_0xe152,0x118));var _0x2e15=function(_0x3977dc,_0x53d367){_0x3977dc=_0x3977dc-0x0;var _0x417846=_0xe152[_0x3977dc];return _0x417846;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2e15('0x0')]();var fs_extra=require(_0x2e15('0x1'));var auth=require(_0x2e15('0x2'));var interaction=require(_0x2e15('0x3'));var config=require(_0x2e15('0x4'));var controller=require('./dashboard.controller');router['get']('/',auth[_0x2e15('0x5')](),controller[_0x2e15('0x6')]);router[_0x2e15('0x7')](_0x2e15('0x8'),auth['isAuthenticated'](),controller[_0x2e15('0x9')]);router[_0x2e15('0x7')]('/:id/items',auth['isAuthenticated'](),controller[_0x2e15('0xa')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x2e15('0xb')](_0x2e15('0xc'),auth['isAuthenticated'](),controller[_0x2e15('0xd')]);router[_0x2e15('0xb')](_0x2e15('0xe'),auth[_0x2e15('0x5')](),controller['addItem']);router[_0x2e15('0xf')](_0x2e15('0x8'),auth[_0x2e15('0x5')](),controller[_0x2e15('0x10')]);router[_0x2e15('0x11')]('/:id',auth[_0x2e15('0x5')](),controller[_0x2e15('0x12')]);module['exports']=router; \ No newline at end of file +var _0x0b22=['isAuthenticated','index','show','/:id/items','post','create','/:id/clone','clone','addItem','put','/:id','delete','exports','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get'];(function(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0x0b22,0x76));var _0x20b2=function(_0x4f52cd,_0x8f8a62){_0x4f52cd=_0x4f52cd-0x0;var _0x4d1c3f=_0x0b22[_0x4f52cd];return _0x4d1c3f;};'use strict';var multer=require('multer');var util=require(_0x20b2('0x0'));var path=require(_0x20b2('0x1'));var timeout=require('connect-timeout');var express=require(_0x20b2('0x2'));var router=express[_0x20b2('0x3')]();var fs_extra=require(_0x20b2('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x20b2('0x5'));var config=require(_0x20b2('0x6'));var controller=require('./dashboard.controller');router[_0x20b2('0x7')]('/',auth[_0x20b2('0x8')](),controller[_0x20b2('0x9')]);router[_0x20b2('0x7')]('/:id',auth[_0x20b2('0x8')](),controller[_0x20b2('0xa')]);router[_0x20b2('0x7')](_0x20b2('0xb'),auth[_0x20b2('0x8')](),controller['getItems']);router[_0x20b2('0xc')]('/',auth[_0x20b2('0x8')](),controller[_0x20b2('0xd')]);router[_0x20b2('0xc')](_0x20b2('0xe'),auth[_0x20b2('0x8')](),controller[_0x20b2('0xf')]);router[_0x20b2('0xc')](_0x20b2('0xb'),auth['isAuthenticated'](),controller[_0x20b2('0x10')]);router[_0x20b2('0x11')](_0x20b2('0x12'),auth[_0x20b2('0x8')](),controller['update']);router[_0x20b2('0x13')](_0x20b2('0x12'),auth[_0x20b2('0x8')](),controller['destroy']);module[_0x20b2('0x14')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 8eca14e..82fbc20 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 _0x5496=['#ffffff','sequelize','squel','lodash','exports','STRING','TEXT','parse','getDataValue','attrs','setDataValue','INTEGER'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5496,0x175));var _0x6549=function(_0x1c1f31,_0x18330f){_0x1c1f31=_0x1c1f31-0x0;var _0x417fb6=_0x5496[_0x1c1f31];return _0x417fb6;};'use strict';var Sequelize=require(_0x6549('0x0'));var squel=require(_0x6549('0x1'));var _=require(_0x6549('0x2'));module[_0x6549('0x3')]={'title':{'type':Sequelize[_0x6549('0x4')],'allowNull':![]},'type':{'type':Sequelize['STRING'](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x6549('0x5')]('long'),'get':function(){try{return JSON[_0x6549('0x6')](this[_0x6549('0x7')](_0x6549('0x8')));}catch(_0x4d0473){return[];}},'set':function(_0x5a4658){try{this[_0x6549('0x9')](_0x6549('0x8'),JSON['stringify'](_0x5a4658));}catch(_0x1ca8fc){this[_0x6549('0x9')](_0x6549('0x8'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize[_0x6549('0xa')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x6549('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x6549('0xa')]},'col':{'type':Sequelize[_0x6549('0xa')]},'background':{'type':Sequelize[_0x6549('0x4')],'allowNull':![],'defaultValue':_0x6549('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x6549('0x4')]},'titleFontSize':{'type':Sequelize[_0x6549('0xa')],'defaultValue':0xc}}; \ No newline at end of file +var _0x0295=['#ffffff','sequelize','exports','TEXT','long','parse','getDataValue','attrs','setDataValue','INTEGER','STRING'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x0295,0x1f0));var _0x5029=function(_0x161341,_0x1c054d){_0x161341=_0x161341-0x0;var _0x5e06c3=_0x0295[_0x161341];return _0x5e06c3;};'use strict';var Sequelize=require(_0x5029('0x0'));var squel=require('squel');var _=require('lodash');module[_0x5029('0x1')]={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['STRING'](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x5029('0x2')](_0x5029('0x3')),'get':function(){try{return JSON[_0x5029('0x4')](this[_0x5029('0x5')](_0x5029('0x6')));}catch(_0x69a497){return[];}},'set':function(_0x200217){try{this[_0x5029('0x7')](_0x5029('0x6'),JSON['stringify'](_0x200217));}catch(_0x54978f){this['setDataValue'](_0x5029('0x6'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize[_0x5029('0x8')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x5029('0x8')]},'col':{'type':Sequelize['INTEGER']},'background':{'type':Sequelize[_0x5029('0x9')],'allowNull':![],'defaultValue':_0x5029('0xa'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x5029('0x9')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x5029('0x9')]},'titleFontSize':{'type':Sequelize[_0x5029('0x8')],'defaultValue':0xc}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index 65a7233..82df0af 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 _0x9d76=['attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','voice','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','body','create','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','json','offset','limit','undefined','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','show','params','model','DashboardItem','rawAttributes','keys','query','filters','intersection','fields','attributes','length','includeAll','merge','options','find','catch','type','iframe','attrUrl','attrs','value','custom','attrPath','attrHourFormat','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','attrEmailAccounts','attrFaxAccounts'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0x9d76,0x76));var _0x69d7=function(_0x366248,_0x263507){_0x366248=_0x366248-0x0;var _0xc39d81=_0x9d76[_0x366248];return _0xc39d81;};'use strict';var emlformat=require(_0x69d7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x69d7('0x1'));var jsonpatch=require(_0x69d7('0x2'));var rp=require(_0x69d7('0x3'));var moment=require(_0x69d7('0x4'));var BPromise=require(_0x69d7('0x5'));var Mustache=require(_0x69d7('0x6'));var util=require('util');var path=require('path');var sox=require(_0x69d7('0x7'));var csv=require(_0x69d7('0x8'));var ejs=require(_0x69d7('0x9'));var fs=require('fs');var fs_extra=require(_0x69d7('0xa'));var _=require('lodash');var squel=require(_0x69d7('0xb'));var crypto=require(_0x69d7('0xc'));var jsforce=require(_0x69d7('0xd'));var deskjs=require(_0x69d7('0xe'));var toCsv=require(_0x69d7('0x8'));var querystring=require(_0x69d7('0xf'));var Papa=require(_0x69d7('0x10'));var Redis=require(_0x69d7('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x69d7('0x12'));var as=require(_0x69d7('0x13'));var hardwareService=require(_0x69d7('0x14'));var logger=require(_0x69d7('0x15'))(_0x69d7('0x16'));var utils=require(_0x69d7('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x69d7('0x18'))['db'];config[_0x69d7('0x19')]=_['defaults'](config[_0x69d7('0x19')],{'host':_0x69d7('0x1a'),'port':0x18eb});var socket=require(_0x69d7('0x1b'))(new Redis(config[_0x69d7('0x19')]));require(_0x69d7('0x1c'))[_0x69d7('0x1d')](socket);function respondWithStatusCode(_0x5aa44c,_0xa49c1e){_0xa49c1e=_0xa49c1e||0xcc;return function(_0x1269b7){if(_0x1269b7){return _0x5aa44c[_0x69d7('0x1e')](_0xa49c1e);}return _0x5aa44c[_0x69d7('0x1f')](_0xa49c1e)['end']();};}function respondWithResult(_0x545c85,_0x3f2937){_0x3f2937=_0x3f2937||0xc8;return function(_0xb6b940){if(_0xb6b940){return _0x545c85[_0x69d7('0x1f')](_0x3f2937)[_0x69d7('0x20')](_0xb6b940);}};}function respondWithFilteredResult(_0x215715,_0x392b64){return function(_0x1056de){if(_0x1056de){var _0x162c9f=typeof _0x392b64[_0x69d7('0x21')]==='undefined'&&typeof _0x392b64[_0x69d7('0x22')]===_0x69d7('0x23');var _0x1edfd2=_0x1056de['count'];var _0x46d908=_0x162c9f?0x0:_0x392b64[_0x69d7('0x21')];var _0x5832d6=_0x162c9f?_0x1056de['count']:_0x392b64[_0x69d7('0x21')]+_0x392b64[_0x69d7('0x22')];var _0x1c9c1f;if(_0x5832d6>=_0x1edfd2){_0x5832d6=_0x1edfd2;_0x1c9c1f=0xc8;}else{_0x1c9c1f=0xce;}_0x215715[_0x69d7('0x1f')](_0x1c9c1f);return _0x215715['set'](_0x69d7('0x24'),_0x46d908+'-'+_0x5832d6+'/'+_0x1edfd2)[_0x69d7('0x20')](_0x1056de);}return null;};}function patchUpdates(_0x229e8e){return function(_0x14af4b){try{jsonpatch[_0x69d7('0x25')](_0x14af4b,_0x229e8e,!![]);}catch(_0x1218d8){return BPromise[_0x69d7('0x26')](_0x1218d8);}return _0x14af4b[_0x69d7('0x27')]();};}function saveUpdates(_0x393613,_0x4da434){return function(_0x1a7cf9){if(_0x1a7cf9){return _0x1a7cf9[_0x69d7('0x28')](_0x393613)[_0x69d7('0x29')](function(_0x4b8cbe){return _0x4b8cbe;});}return null;};}function removeEntity(_0x2b188c,_0x52435a){return function(_0xee939c){if(_0xee939c){return _0xee939c[_0x69d7('0x2a')]()[_0x69d7('0x29')](function(){_0x2b188c['status'](0xcc)[_0x69d7('0x2b')]();});}};}function handleEntityNotFound(_0x2b44d9,_0x3c261e){return function(_0x182153){if(!_0x182153){_0x2b44d9[_0x69d7('0x1e')](0x194);}return _0x182153;};}function handleError(_0x118c61,_0x2e0f99){_0x2e0f99=_0x2e0f99||0x1f4;return function(_0x285922){logger[_0x69d7('0x2c')](_0x285922[_0x69d7('0x2d')]);if(_0x285922[_0x69d7('0x2e')]){delete _0x285922['name'];}_0x118c61['status'](_0x2e0f99)['send'](_0x285922);};}exports[_0x69d7('0x2f')]=function(_0x5d602e,_0x3d5b7c){var _0x7d86b={'raw':![],'where':{'id':_0x5d602e[_0x69d7('0x30')]['id']}},_0x5d9ae0={};_0x5d9ae0[_0x69d7('0x31')]=_['keys'](db[_0x69d7('0x32')][_0x69d7('0x33')]);_0x5d9ae0['query']=_[_0x69d7('0x34')](_0x5d602e[_0x69d7('0x35')]);_0x5d9ae0[_0x69d7('0x36')]=_[_0x69d7('0x37')](_0x5d9ae0[_0x69d7('0x31')],_0x5d9ae0['query']);_0x7d86b['attributes']=_[_0x69d7('0x37')](_0x5d9ae0[_0x69d7('0x31')],qs[_0x69d7('0x38')](_0x5d602e[_0x69d7('0x35')]['fields']));_0x7d86b['attributes']=_0x7d86b[_0x69d7('0x39')][_0x69d7('0x3a')]?_0x7d86b[_0x69d7('0x39')]:_0x5d9ae0[_0x69d7('0x31')];if(_0x5d602e[_0x69d7('0x35')][_0x69d7('0x3b')]){_0x7d86b['include']=[{'all':!![]}];}_0x7d86b=_[_0x69d7('0x3c')]({},_0x7d86b,_0x5d602e[_0x69d7('0x3d')]);return db[_0x69d7('0x32')][_0x69d7('0x3e')](_0x7d86b)[_0x69d7('0x29')](handleEntityNotFound(_0x3d5b7c,null))[_0x69d7('0x29')](respondWithResult(_0x3d5b7c,null))[_0x69d7('0x3f')](handleError(_0x3d5b7c,null));};exports['destroy']=function(_0x51823e,_0x2d88d1){return db['DashboardItem']['find']({'where':{'id':_0x51823e['params']['id']}})[_0x69d7('0x29')](handleEntityNotFound(_0x2d88d1,null))[_0x69d7('0x29')](removeEntity(_0x2d88d1,null))[_0x69d7('0x3f')](handleError(_0x2d88d1,null));};function widgetAttributes(_0x18d68b){try{switch(_0x18d68b[_0x69d7('0x40')]){case _0x69d7('0x41'):return[{'name':_0x69d7('0x42'),'value':_0x18d68b[_0x69d7('0x42')]||(_0x18d68b[_0x69d7('0x43')]&&_0x18d68b[_0x69d7('0x43')][0x0]?_0x18d68b[_0x69d7('0x43')][0x0][_0x69d7('0x44')]:undefined)||'https://'}];case _0x69d7('0x45'):return[{'name':_0x69d7('0x46'),'value':_0x18d68b[_0x69d7('0x46')]||(_0x18d68b[_0x69d7('0x43')]&&_0x18d68b['attrs'][0x0]?_0x18d68b[_0x69d7('0x43')][0x0][_0x69d7('0x44')]:undefined)||''}];case'clock':return[{'name':_0x69d7('0x47'),'value':_0x18d68b[_0x69d7('0x47')]||(_0x18d68b[_0x69d7('0x43')]&&_0x18d68b[_0x69d7('0x43')][0x0]?_0x18d68b[_0x69d7('0x43')][0x0][_0x69d7('0x44')]:undefined)||'HH:mm:ss'},{'name':_0x69d7('0x48'),'value':_0x18d68b['attrTimezone']||(_0x18d68b[_0x69d7('0x43')]&&_0x18d68b[_0x69d7('0x43')][0x1]?_0x18d68b[_0x69d7('0x43')][0x1][_0x69d7('0x44')]:undefined)||_0x69d7('0x49')},{'name':_0x69d7('0x4a'),'value':_0x18d68b[_0x69d7('0x4a')]||(_0x18d68b[_0x69d7('0x43')]&&_0x18d68b['attrs'][0x2]?_0x18d68b['attrs'][0x2][_0x69d7('0x44')]:undefined)||0xc}];case _0x69d7('0x4b'):return[{'name':_0x69d7('0x4c'),'value':_0x18d68b[_0x69d7('0x4c')]||(_0x18d68b[_0x69d7('0x43')]&&_0x18d68b['attrs'][0x0]?_0x18d68b['attrs'][0x0]['value']:undefined)||_0x69d7('0x4d')},{'name':'attrVoiceQueues','value':_0x18d68b[_0x69d7('0x4e')]||(_0x18d68b[_0x69d7('0x43')]&&_0x18d68b[_0x69d7('0x43')][0x1]?_0x18d68b[_0x69d7('0x43')][0x1][_0x69d7('0x44')]:undefined)||[]},{'name':_0x69d7('0x4a'),'value':_0x18d68b['attrFontSize']||(_0x18d68b[_0x69d7('0x43')]&&_0x18d68b[_0x69d7('0x43')][0x2]?_0x18d68b[_0x69d7('0x43')][0x2][_0x69d7('0x44')]:undefined)||0x14},{'name':_0x69d7('0x4f'),'value':_0x18d68b[_0x69d7('0x4f')]||(_0x18d68b[_0x69d7('0x43')]&&_0x18d68b[_0x69d7('0x43')][0x3]?_0x18d68b[_0x69d7('0x43')][0x3][_0x69d7('0x44')]:undefined)||'voice'},{'name':_0x69d7('0x50'),'value':_0x18d68b[_0x69d7('0x50')]||(_0x18d68b['attrs']&&_0x18d68b[_0x69d7('0x43')][0x4]?_0x18d68b[_0x69d7('0x43')][0x4][_0x69d7('0x44')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x18d68b[_0x69d7('0x51')]||(_0x18d68b[_0x69d7('0x43')]&&_0x18d68b[_0x69d7('0x43')][0x5]?_0x18d68b[_0x69d7('0x43')][0x5]['value']:undefined)||''},{'name':_0x69d7('0x52'),'value':_0x18d68b[_0x69d7('0x52')]||(_0x18d68b['attrs']&&_0x18d68b[_0x69d7('0x43')][0x6]?_0x18d68b[_0x69d7('0x43')][0x6][_0x69d7('0x44')]:undefined)||''},{'name':_0x69d7('0x53'),'value':_0x18d68b['attrOpenchannelAccounts']||(_0x18d68b[_0x69d7('0x43')]&&_0x18d68b[_0x69d7('0x43')][0x7]?_0x18d68b[_0x69d7('0x43')][0x7][_0x69d7('0x44')]:undefined)||''},{'name':_0x69d7('0x54'),'value':_0x18d68b['attrWhatsappAccounts']||(_0x18d68b[_0x69d7('0x43')]&&_0x18d68b[_0x69d7('0x43')][0x8]?_0x18d68b[_0x69d7('0x43')][0x8][_0x69d7('0x44')]:undefined)||''},{'name':_0x69d7('0x55'),'value':_0x18d68b[_0x69d7('0x55')]||(_0x18d68b[_0x69d7('0x43')]&&_0x18d68b[_0x69d7('0x43')][0x9]?_0x18d68b[_0x69d7('0x43')][0x9][_0x69d7('0x44')]:undefined)||''}];case _0x69d7('0x56'):case _0x69d7('0x57'):return[{'name':_0x69d7('0x58'),'value':_0x18d68b[_0x69d7('0x58')]||(_0x18d68b[_0x69d7('0x43')]&&_0x18d68b[_0x69d7('0x43')][0x0]?_0x18d68b[_0x69d7('0x43')][0x0][_0x69d7('0x44')]:undefined)||_0x69d7('0x4d')},{'name':_0x69d7('0x59'),'value':_0x18d68b[_0x69d7('0x59')]||(_0x18d68b['attrs']&&_0x18d68b[_0x69d7('0x43')][0x1]?_0x18d68b['attrs'][0x1][_0x69d7('0x44')]:undefined)||null},{'name':_0x69d7('0x5a'),'value':_0x18d68b[_0x69d7('0x5a')]||(_0x18d68b[_0x69d7('0x43')]&&_0x18d68b[_0x69d7('0x43')][0x2]?_0x18d68b[_0x69d7('0x43')][0x2]['value']:undefined)||null},{'name':'attrVoiceQueues','value':_0x18d68b['attrVoiceQueues']||(_0x18d68b['attrs']&&_0x18d68b[_0x69d7('0x43')][0x3]?_0x18d68b[_0x69d7('0x43')][0x3][_0x69d7('0x44')]:undefined)||[]},{'name':'attrChannel','value':_0x18d68b[_0x69d7('0x4f')]||(_0x18d68b['attrs']&&_0x18d68b[_0x69d7('0x43')][0x4]?_0x18d68b[_0x69d7('0x43')][0x4]['value']:undefined)||_0x69d7('0x5b')},{'name':'attrEmailAccounts','value':_0x18d68b[_0x69d7('0x50')]||(_0x18d68b[_0x69d7('0x43')]&&_0x18d68b[_0x69d7('0x43')][0x5]?_0x18d68b[_0x69d7('0x43')][0x5][_0x69d7('0x44')]:undefined)||''},{'name':_0x69d7('0x51'),'value':_0x18d68b['attrFaxAccounts']||(_0x18d68b['attrs']&&_0x18d68b[_0x69d7('0x43')][0x6]?_0x18d68b[_0x69d7('0x43')][0x6][_0x69d7('0x44')]:undefined)||''},{'name':_0x69d7('0x52'),'value':_0x18d68b['attrSmsAccounts']||(_0x18d68b[_0x69d7('0x43')]&&_0x18d68b[_0x69d7('0x43')][0x7]?_0x18d68b[_0x69d7('0x43')][0x7]['value']:undefined)||''},{'name':_0x69d7('0x53'),'value':_0x18d68b[_0x69d7('0x53')]||(_0x18d68b[_0x69d7('0x43')]&&_0x18d68b[_0x69d7('0x43')][0x8]?_0x18d68b['attrs'][0x8][_0x69d7('0x44')]:undefined)||''},{'name':_0x69d7('0x54'),'value':_0x18d68b['attrWhatsappAccounts']||(_0x18d68b['attrs']&&_0x18d68b['attrs'][0x9]?_0x18d68b[_0x69d7('0x43')][0x9][_0x69d7('0x44')]:undefined)||''},{'name':_0x69d7('0x55'),'value':_0x18d68b[_0x69d7('0x55')]||(_0x18d68b[_0x69d7('0x43')]&&_0x18d68b[_0x69d7('0x43')][0xa]?_0x18d68b[_0x69d7('0x43')][0xa][_0x69d7('0x44')]:undefined)||''}];case _0x69d7('0x5c'):return[{'name':_0x69d7('0x5d'),'type':_0x18d68b[_0x69d7('0x5e')]||(_0x18d68b[_0x69d7('0x43')]&&_0x18d68b[_0x69d7('0x43')][0x0]?_0x18d68b['attrs'][0x0][_0x69d7('0x40')]:undefined)||null,'value':_0x18d68b[_0x69d7('0x5d')]||(_0x18d68b[_0x69d7('0x43')]&&_0x18d68b[_0x69d7('0x43')][0x0]?_0x18d68b[_0x69d7('0x43')][0x0][_0x69d7('0x44')]:undefined)||null},{'name':'attrRefresh','value':_0x18d68b[_0x69d7('0x5f')]||(_0x18d68b[_0x69d7('0x43')]&&_0x18d68b[_0x69d7('0x43')][0x1]?_0x18d68b[_0x69d7('0x43')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x364f94){logger[_0x69d7('0x2c')](_0x69d7('0x60'),JSON[_0x69d7('0x61')](_0x364f94));return[];}}exports['create']=function(_0x1d33ab,_0x5bacf5){if(_0x1d33ab[_0x69d7('0x62')]){_0x1d33ab[_0x69d7('0x62')][_0x69d7('0x43')]=widgetAttributes(_0x1d33ab[_0x69d7('0x62')]);}return db[_0x69d7('0x32')][_0x69d7('0x63')](_0x1d33ab[_0x69d7('0x62')],{})[_0x69d7('0x29')](respondWithResult(_0x5bacf5,0xc9))['catch'](handleError(_0x5bacf5,null));};exports[_0x69d7('0x28')]=function(_0x301f29,_0x219421){if(_0x301f29[_0x69d7('0x62')]['id']){delete _0x301f29[_0x69d7('0x62')]['id'];}_0x301f29[_0x69d7('0x62')][_0x69d7('0x43')]=widgetAttributes(_0x301f29['body']);return db[_0x69d7('0x32')][_0x69d7('0x3e')]({'where':{'id':_0x301f29['params']['id']}})['then'](handleEntityNotFound(_0x219421,null))[_0x69d7('0x29')](saveUpdates(_0x301f29[_0x69d7('0x62')],null))['then'](respondWithResult(_0x219421,null))['catch'](handleError(_0x219421,null));}; \ No newline at end of file +var _0x176c=['request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','show','params','DashboardItem','rawAttributes','query','filters','intersection','model','attributes','fields','length','include','merge','options','find','catch','type','iframe','attrUrl','attrs','https://','custom','attrPath','value','clock','attrHourFormat','attrTimezone','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','body','create','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x21dc33,_0x2472be){var _0x5c765e=function(_0x31ce51){while(--_0x31ce51){_0x21dc33['push'](_0x21dc33['shift']());}};_0x5c765e(++_0x2472be);}(_0x176c,0x134));var _0xc176=function(_0x5dce18,_0x51854c){_0x5dce18=_0x5dce18-0x0;var _0x5c2a22=_0x176c[_0x5dce18];return _0x5c2a22;};'use strict';var emlformat=require(_0xc176('0x0'));var rimraf=require(_0xc176('0x1'));var zipdir=require(_0xc176('0x2'));var jsonpatch=require(_0xc176('0x3'));var rp=require(_0xc176('0x4'));var moment=require(_0xc176('0x5'));var BPromise=require(_0xc176('0x6'));var Mustache=require('mustache');var util=require(_0xc176('0x7'));var path=require(_0xc176('0x8'));var sox=require('sox');var csv=require(_0xc176('0x9'));var ejs=require(_0xc176('0xa'));var fs=require('fs');var fs_extra=require(_0xc176('0xb'));var _=require('lodash');var squel=require(_0xc176('0xc'));var crypto=require(_0xc176('0xd'));var jsforce=require(_0xc176('0xe'));var deskjs=require(_0xc176('0xf'));var toCsv=require(_0xc176('0x9'));var querystring=require('querystring');var Papa=require(_0xc176('0x10'));var Redis=require(_0xc176('0x11'));var authService=require(_0xc176('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xc176('0x13'));var hardwareService=require(_0xc176('0x14'));var logger=require(_0xc176('0x15'))(_0xc176('0x16'));var utils=require(_0xc176('0x17'));var config=require(_0xc176('0x18'));var licenseUtil=require(_0xc176('0x19'));var db=require(_0xc176('0x1a'))['db'];config['redis']=_[_0xc176('0x1b')](config[_0xc176('0x1c')],{'host':_0xc176('0x1d'),'port':0x18eb});var socket=require(_0xc176('0x1e'))(new Redis(config[_0xc176('0x1c')]));require('./dashboardItem.socket')[_0xc176('0x1f')](socket);function respondWithStatusCode(_0x3ba62e,_0x27ded2){_0x27ded2=_0x27ded2||0xcc;return function(_0x4b8af0){if(_0x4b8af0){return _0x3ba62e[_0xc176('0x20')](_0x27ded2);}return _0x3ba62e['status'](_0x27ded2)[_0xc176('0x21')]();};}function respondWithResult(_0x246e9f,_0x4fdbd5){_0x4fdbd5=_0x4fdbd5||0xc8;return function(_0xfc47b4){if(_0xfc47b4){return _0x246e9f[_0xc176('0x22')](_0x4fdbd5)[_0xc176('0x23')](_0xfc47b4);}};}function respondWithFilteredResult(_0x1b9b5b,_0x33b528){return function(_0x284bb8){if(_0x284bb8){var _0x5e081a=typeof _0x33b528[_0xc176('0x24')]==='undefined'&&typeof _0x33b528[_0xc176('0x25')]===_0xc176('0x26');var _0x1c40bf=_0x284bb8[_0xc176('0x27')];var _0x261680=_0x5e081a?0x0:_0x33b528[_0xc176('0x24')];var _0x5526da=_0x5e081a?_0x284bb8['count']:_0x33b528[_0xc176('0x24')]+_0x33b528['limit'];var _0x179994;if(_0x5526da>=_0x1c40bf){_0x5526da=_0x1c40bf;_0x179994=0xc8;}else{_0x179994=0xce;}_0x1b9b5b['status'](_0x179994);return _0x1b9b5b[_0xc176('0x28')](_0xc176('0x29'),_0x261680+'-'+_0x5526da+'/'+_0x1c40bf)[_0xc176('0x23')](_0x284bb8);}return null;};}function patchUpdates(_0x580149){return function(_0x583c16){try{jsonpatch[_0xc176('0x2a')](_0x583c16,_0x580149,!![]);}catch(_0xdb4e6f){return BPromise[_0xc176('0x2b')](_0xdb4e6f);}return _0x583c16[_0xc176('0x2c')]();};}function saveUpdates(_0x5670da,_0x2e264d){return function(_0x5b71e6){if(_0x5b71e6){return _0x5b71e6[_0xc176('0x2d')](_0x5670da)['then'](function(_0x5049f8){return _0x5049f8;});}return null;};}function removeEntity(_0x39ee9b,_0x12ab18){return function(_0x3e4ecb){if(_0x3e4ecb){return _0x3e4ecb[_0xc176('0x2e')]()[_0xc176('0x2f')](function(){_0x39ee9b[_0xc176('0x22')](0xcc)[_0xc176('0x21')]();});}};}function handleEntityNotFound(_0x3d9fbf,_0x2cbdfa){return function(_0x3f5509){if(!_0x3f5509){_0x3d9fbf[_0xc176('0x20')](0x194);}return _0x3f5509;};}function handleError(_0x93f53c,_0x4628ad){_0x4628ad=_0x4628ad||0x1f4;return function(_0x449d76){logger[_0xc176('0x30')](_0x449d76[_0xc176('0x31')]);if(_0x449d76[_0xc176('0x32')]){delete _0x449d76['name'];}_0x93f53c['status'](_0x4628ad)[_0xc176('0x33')](_0x449d76);};}exports[_0xc176('0x34')]=function(_0x56a1bd,_0x17e111){var _0x3c7c1b={'raw':![],'where':{'id':_0x56a1bd[_0xc176('0x35')]['id']}},_0x2034fe={};_0x2034fe['model']=_['keys'](db[_0xc176('0x36')][_0xc176('0x37')]);_0x2034fe[_0xc176('0x38')]=_['keys'](_0x56a1bd[_0xc176('0x38')]);_0x2034fe[_0xc176('0x39')]=_[_0xc176('0x3a')](_0x2034fe[_0xc176('0x3b')],_0x2034fe[_0xc176('0x38')]);_0x3c7c1b[_0xc176('0x3c')]=_[_0xc176('0x3a')](_0x2034fe[_0xc176('0x3b')],qs['fields'](_0x56a1bd['query'][_0xc176('0x3d')]));_0x3c7c1b[_0xc176('0x3c')]=_0x3c7c1b[_0xc176('0x3c')][_0xc176('0x3e')]?_0x3c7c1b[_0xc176('0x3c')]:_0x2034fe[_0xc176('0x3b')];if(_0x56a1bd[_0xc176('0x38')]['includeAll']){_0x3c7c1b[_0xc176('0x3f')]=[{'all':!![]}];}_0x3c7c1b=_[_0xc176('0x40')]({},_0x3c7c1b,_0x56a1bd[_0xc176('0x41')]);return db['DashboardItem'][_0xc176('0x42')](_0x3c7c1b)[_0xc176('0x2f')](handleEntityNotFound(_0x17e111,null))[_0xc176('0x2f')](respondWithResult(_0x17e111,null))[_0xc176('0x43')](handleError(_0x17e111,null));};exports[_0xc176('0x2e')]=function(_0x38875c,_0xcaa2ad){return db[_0xc176('0x36')]['find']({'where':{'id':_0x38875c[_0xc176('0x35')]['id']}})[_0xc176('0x2f')](handleEntityNotFound(_0xcaa2ad,null))['then'](removeEntity(_0xcaa2ad,null))[_0xc176('0x43')](handleError(_0xcaa2ad,null));};function widgetAttributes(_0x196cb0){try{switch(_0x196cb0[_0xc176('0x44')]){case _0xc176('0x45'):return[{'name':_0xc176('0x46'),'value':_0x196cb0[_0xc176('0x46')]||(_0x196cb0['attrs']&&_0x196cb0['attrs'][0x0]?_0x196cb0[_0xc176('0x47')][0x0]['value']:undefined)||_0xc176('0x48')}];case _0xc176('0x49'):return[{'name':_0xc176('0x4a'),'value':_0x196cb0[_0xc176('0x4a')]||(_0x196cb0[_0xc176('0x47')]&&_0x196cb0[_0xc176('0x47')][0x0]?_0x196cb0[_0xc176('0x47')][0x0][_0xc176('0x4b')]:undefined)||''}];case _0xc176('0x4c'):return[{'name':_0xc176('0x4d'),'value':_0x196cb0['attrHourFormat']||(_0x196cb0['attrs']&&_0x196cb0[_0xc176('0x47')][0x0]?_0x196cb0[_0xc176('0x47')][0x0]['value']:undefined)||'HH:mm:ss'},{'name':_0xc176('0x4e'),'value':_0x196cb0[_0xc176('0x4e')]||(_0x196cb0[_0xc176('0x47')]&&_0x196cb0[_0xc176('0x47')][0x1]?_0x196cb0['attrs'][0x1]['value']:undefined)||'0.00'},{'name':_0xc176('0x4f'),'value':_0x196cb0[_0xc176('0x4f')]||(_0x196cb0[_0xc176('0x47')]&&_0x196cb0['attrs'][0x2]?_0x196cb0[_0xc176('0x47')][0x2][_0xc176('0x4b')]:undefined)||0xc}];case _0xc176('0x50'):return[{'name':_0xc176('0x51'),'value':_0x196cb0[_0xc176('0x51')]||(_0x196cb0[_0xc176('0x47')]&&_0x196cb0[_0xc176('0x47')][0x0]?_0x196cb0['attrs'][0x0][_0xc176('0x4b')]:undefined)||_0xc176('0x52')},{'name':_0xc176('0x53'),'value':_0x196cb0[_0xc176('0x53')]||(_0x196cb0[_0xc176('0x47')]&&_0x196cb0[_0xc176('0x47')][0x1]?_0x196cb0[_0xc176('0x47')][0x1]['value']:undefined)||[]},{'name':_0xc176('0x4f'),'value':_0x196cb0['attrFontSize']||(_0x196cb0[_0xc176('0x47')]&&_0x196cb0[_0xc176('0x47')][0x2]?_0x196cb0[_0xc176('0x47')][0x2][_0xc176('0x4b')]:undefined)||0x14},{'name':'attrChannel','value':_0x196cb0[_0xc176('0x54')]||(_0x196cb0[_0xc176('0x47')]&&_0x196cb0[_0xc176('0x47')][0x3]?_0x196cb0['attrs'][0x3][_0xc176('0x4b')]:undefined)||_0xc176('0x55')},{'name':_0xc176('0x56'),'value':_0x196cb0[_0xc176('0x56')]||(_0x196cb0[_0xc176('0x47')]&&_0x196cb0[_0xc176('0x47')][0x4]?_0x196cb0[_0xc176('0x47')][0x4][_0xc176('0x4b')]:undefined)||''},{'name':_0xc176('0x57'),'value':_0x196cb0[_0xc176('0x57')]||(_0x196cb0[_0xc176('0x47')]&&_0x196cb0[_0xc176('0x47')][0x5]?_0x196cb0[_0xc176('0x47')][0x5][_0xc176('0x4b')]:undefined)||''},{'name':_0xc176('0x58'),'value':_0x196cb0[_0xc176('0x58')]||(_0x196cb0['attrs']&&_0x196cb0['attrs'][0x6]?_0x196cb0['attrs'][0x6]['value']:undefined)||''},{'name':_0xc176('0x59'),'value':_0x196cb0[_0xc176('0x59')]||(_0x196cb0[_0xc176('0x47')]&&_0x196cb0[_0xc176('0x47')][0x7]?_0x196cb0['attrs'][0x7][_0xc176('0x4b')]:undefined)||''},{'name':_0xc176('0x5a'),'value':_0x196cb0[_0xc176('0x5a')]||(_0x196cb0[_0xc176('0x47')]&&_0x196cb0[_0xc176('0x47')][0x8]?_0x196cb0[_0xc176('0x47')][0x8][_0xc176('0x4b')]:undefined)||''},{'name':'attrChatWebsites','value':_0x196cb0[_0xc176('0x5b')]||(_0x196cb0['attrs']&&_0x196cb0[_0xc176('0x47')][0x9]?_0x196cb0[_0xc176('0x47')][0x9][_0xc176('0x4b')]:undefined)||''}];case _0xc176('0x5c'):case _0xc176('0x5d'):return[{'name':_0xc176('0x5e'),'value':_0x196cb0[_0xc176('0x5e')]||(_0x196cb0['attrs']&&_0x196cb0[_0xc176('0x47')][0x0]?_0x196cb0[_0xc176('0x47')][0x0]['value']:undefined)||_0xc176('0x52')},{'name':_0xc176('0x5f'),'value':_0x196cb0[_0xc176('0x5f')]||(_0x196cb0[_0xc176('0x47')]&&_0x196cb0[_0xc176('0x47')][0x1]?_0x196cb0[_0xc176('0x47')][0x1][_0xc176('0x4b')]:undefined)||null},{'name':'attrSerie3','value':_0x196cb0[_0xc176('0x60')]||(_0x196cb0[_0xc176('0x47')]&&_0x196cb0[_0xc176('0x47')][0x2]?_0x196cb0['attrs'][0x2]['value']:undefined)||null},{'name':_0xc176('0x53'),'value':_0x196cb0[_0xc176('0x53')]||(_0x196cb0[_0xc176('0x47')]&&_0x196cb0['attrs'][0x3]?_0x196cb0['attrs'][0x3][_0xc176('0x4b')]:undefined)||[]},{'name':_0xc176('0x54'),'value':_0x196cb0[_0xc176('0x54')]||(_0x196cb0[_0xc176('0x47')]&&_0x196cb0['attrs'][0x4]?_0x196cb0[_0xc176('0x47')][0x4]['value']:undefined)||'voice'},{'name':'attrEmailAccounts','value':_0x196cb0[_0xc176('0x56')]||(_0x196cb0[_0xc176('0x47')]&&_0x196cb0[_0xc176('0x47')][0x5]?_0x196cb0[_0xc176('0x47')][0x5][_0xc176('0x4b')]:undefined)||''},{'name':_0xc176('0x57'),'value':_0x196cb0[_0xc176('0x57')]||(_0x196cb0['attrs']&&_0x196cb0[_0xc176('0x47')][0x6]?_0x196cb0['attrs'][0x6][_0xc176('0x4b')]:undefined)||''},{'name':_0xc176('0x58'),'value':_0x196cb0[_0xc176('0x58')]||(_0x196cb0[_0xc176('0x47')]&&_0x196cb0['attrs'][0x7]?_0x196cb0[_0xc176('0x47')][0x7]['value']:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x196cb0[_0xc176('0x59')]||(_0x196cb0[_0xc176('0x47')]&&_0x196cb0[_0xc176('0x47')][0x8]?_0x196cb0[_0xc176('0x47')][0x8][_0xc176('0x4b')]:undefined)||''},{'name':_0xc176('0x5a'),'value':_0x196cb0[_0xc176('0x5a')]||(_0x196cb0['attrs']&&_0x196cb0[_0xc176('0x47')][0x9]?_0x196cb0[_0xc176('0x47')][0x9][_0xc176('0x4b')]:undefined)||''},{'name':'attrChatWebsites','value':_0x196cb0[_0xc176('0x5b')]||(_0x196cb0['attrs']&&_0x196cb0['attrs'][0xa]?_0x196cb0[_0xc176('0x47')][0xa]['value']:undefined)||''}];case'web-report':return[{'name':_0xc176('0x61'),'type':_0x196cb0[_0xc176('0x62')]||(_0x196cb0[_0xc176('0x47')]&&_0x196cb0[_0xc176('0x47')][0x0]?_0x196cb0[_0xc176('0x47')][0x0][_0xc176('0x44')]:undefined)||null,'value':_0x196cb0[_0xc176('0x61')]||(_0x196cb0[_0xc176('0x47')]&&_0x196cb0['attrs'][0x0]?_0x196cb0['attrs'][0x0][_0xc176('0x4b')]:undefined)||null},{'name':_0xc176('0x63'),'value':_0x196cb0[_0xc176('0x63')]||(_0x196cb0[_0xc176('0x47')]&&_0x196cb0['attrs'][0x1]?_0x196cb0[_0xc176('0x47')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x209ca6){logger[_0xc176('0x30')](_0xc176('0x64'),JSON[_0xc176('0x65')](_0x209ca6));return[];}}exports['create']=function(_0x1580fe,_0x1ce264){if(_0x1580fe[_0xc176('0x66')]){_0x1580fe[_0xc176('0x66')][_0xc176('0x47')]=widgetAttributes(_0x1580fe[_0xc176('0x66')]);}return db[_0xc176('0x36')][_0xc176('0x67')](_0x1580fe[_0xc176('0x66')],{})[_0xc176('0x2f')](respondWithResult(_0x1ce264,0xc9))[_0xc176('0x43')](handleError(_0x1ce264,null));};exports[_0xc176('0x2d')]=function(_0x55ccd7,_0x20ff1f){if(_0x55ccd7[_0xc176('0x66')]['id']){delete _0x55ccd7[_0xc176('0x66')]['id'];}_0x55ccd7['body'][_0xc176('0x47')]=widgetAttributes(_0x55ccd7[_0xc176('0x66')]);return db[_0xc176('0x36')][_0xc176('0x42')]({'where':{'id':_0x55ccd7[_0xc176('0x35')]['id']}})[_0xc176('0x2f')](handleEntityNotFound(_0x20ff1f,null))[_0xc176('0x2f')](saveUpdates(_0x55ccd7[_0xc176('0x66')],null))['then'](respondWithResult(_0x20ff1f,null))[_0xc176('0x43')](handleError(_0x20ff1f,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 95d9900..8a6e1ee 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 _0xaaee=['save','update','remove','emit','hook','exports','events','setMaxListeners'];(function(_0x1e90f9,_0xae6d06){var _0xc272e1=function(_0x1d253d){while(--_0x1d253d){_0x1e90f9['push'](_0x1e90f9['shift']());}};_0xc272e1(++_0xae6d06);}(_0xaaee,0x1be));var _0xeaae=function(_0x10f474,_0x5c3ff0){_0x10f474=_0x10f474-0x0;var _0x1d38c5=_0xaaee[_0x10f474];return _0x1d38c5;};'use strict';var EventEmitter=require(_0xeaae('0x0'));var DashboardItem=require('../../mysqldb')['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xeaae('0x1')](0x0);var events={'afterCreate':_0xeaae('0x2'),'afterUpdate':_0xeaae('0x3'),'afterDestroy':_0xeaae('0x4')};function emitEvent(_0x40ac77){return function(_0x5a9956,_0x27af19,_0x208458){DashboardItemEvents[_0xeaae('0x5')](_0x40ac77+':'+_0x5a9956['id'],_0x5a9956);DashboardItemEvents['emit'](_0x40ac77,_0x5a9956);_0x208458(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem[_0xeaae('0x6')](e,emitEvent(event));}}module[_0xeaae('0x7')]=DashboardItemEvents; \ No newline at end of file +var _0xcac5=['hasOwnProperty','hook','DashboardItem','setMaxListeners','save','update','remove'];(function(_0x129d36,_0x28147f){var _0xfd9793=function(_0x24bc91){while(--_0x24bc91){_0x129d36['push'](_0x129d36['shift']());}};_0xfd9793(++_0x28147f);}(_0xcac5,0xb8));var _0x5cac=function(_0x42f98b,_0x2ab798){_0x42f98b=_0x42f98b-0x0;var _0x9d4c8d=_0xcac5[_0x42f98b];return _0x9d4c8d;};'use strict';var EventEmitter=require('events');var DashboardItem=require('../../mysqldb')['db'][_0x5cac('0x0')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x5cac('0x1')](0x0);var events={'afterCreate':_0x5cac('0x2'),'afterUpdate':_0x5cac('0x3'),'afterDestroy':_0x5cac('0x4')};function emitEvent(_0x5722ed){return function(_0x1824ee,_0x20eeff,_0xcf5f0){DashboardItemEvents['emit'](_0x5722ed+':'+_0x1824ee['id'],_0x1824ee);DashboardItemEvents['emit'](_0x5722ed,_0x1824ee);_0xcf5f0(null);};}for(var e in events){if(events[_0x5cac('0x5')](e)){var event=events[e];DashboardItem[_0x5cac('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 aed38b9..d847dc3 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 _0x1502=['bluebird','path','rimraf','../../config/environment','./dashboardItem.attributes','DashboardItem','dashboard_items','lodash','util','../../config/logger','api','moment'];(function(_0x1b99eb,_0x3904e9){var _0x273e88=function(_0x36ab0d){while(--_0x36ab0d){_0x1b99eb['push'](_0x1b99eb['shift']());}};_0x273e88(++_0x3904e9);}(_0x1502,0x1c3));var _0x2150=function(_0x1b5032,_0x2a7e0e){_0x1b5032=_0x1b5032-0x0;var _0x3cb991=_0x1502[_0x1b5032];return _0x3cb991;};'use strict';var _=require(_0x2150('0x0'));var util=require(_0x2150('0x1'));var logger=require(_0x2150('0x2'))(_0x2150('0x3'));var moment=require(_0x2150('0x4'));var BPromise=require(_0x2150('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2150('0x6'));var rimraf=require(_0x2150('0x7'));var config=require(_0x2150('0x8'));var attributes=require(_0x2150('0x9'));module['exports']=function(_0x2e34e9,_0x38dbdf){return _0x2e34e9['define'](_0x2150('0xa'),attributes,{'tableName':_0x2150('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x081e=['exports','define','DashboardItem','dashboard_items','lodash','../../config/logger','api','moment','request-promise','path','../../config/environment','./dashboardItem.attributes'];(function(_0x167d8f,_0x1ef533){var _0x1d0fd3=function(_0x4854ec){while(--_0x4854ec){_0x167d8f['push'](_0x167d8f['shift']());}};_0x1d0fd3(++_0x1ef533);}(_0x081e,0x160));var _0xe081=function(_0x35eb94,_0x2e78a8){_0x35eb94=_0x35eb94-0x0;var _0x593add=_0x081e[_0x35eb94];return _0x593add;};'use strict';var _=require(_0xe081('0x0'));var util=require('util');var logger=require(_0xe081('0x1'))(_0xe081('0x2'));var moment=require(_0xe081('0x3'));var BPromise=require('bluebird');var rp=require(_0xe081('0x4'));var fs=require('fs');var path=require(_0xe081('0x5'));var rimraf=require('rimraf');var config=require(_0xe081('0x6'));var attributes=require(_0xe081('0x7'));module[_0xe081('0x8')]=function(_0x345108,_0x3c446c){return _0x345108[_0xe081('0x9')](_0xe081('0xa'),attributes,{'tableName':_0xe081('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 c70938b..2af9ecd 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 _0x66ae=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','request','request\x20sent','debug','stringify','error','code','DashboardItem,\x20%s,\x20%s','message','info','result','catch'];(function(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0x66ae,0x91));var _0xe66a=function(_0x1fea66,_0x621fdb){_0x1fea66=_0x1fea66-0x0;var _0x112af3=_0x66ae[_0x1fea66];return _0x112af3;};'use strict';var _=require(_0xe66a('0x0'));var util=require('util');var moment=require(_0xe66a('0x1'));var BPromise=require(_0xe66a('0x2'));var rs=require(_0xe66a('0x3'));var fs=require('fs');var Redis=require(_0xe66a('0x4'));var db=require(_0xe66a('0x5'))['db'];var utils=require(_0xe66a('0x6'));var logger=require(_0xe66a('0x7'))(_0xe66a('0x8'));var config=require(_0xe66a('0x9'));var jayson=require(_0xe66a('0xa'));var client=jayson[_0xe66a('0xb')][_0xe66a('0xc')]({'port':0x232a});config['redis']=_[_0xe66a('0xd')](config['redis'],{'host':_0xe66a('0xe'),'port':0x18eb});var socket=require(_0xe66a('0xf'))(new Redis(config['redis']));require(_0xe66a('0x10'))[_0xe66a('0x11')](socket);function respondWithRpcPromise(_0x3383b3,_0x1a373b,_0x3dbca7){return new BPromise(function(_0x38d33d,_0x459e95){return client[_0xe66a('0x12')](_0x3383b3,_0x3dbca7)['then'](function(_0x2bee53){logger['info']('DashboardItem,\x20%s,\x20%s',_0x1a373b,_0xe66a('0x13'));logger[_0xe66a('0x14')]('DashboardItem,\x20%s,\x20%s,\x20%s',_0x1a373b,_0xe66a('0x13'),JSON[_0xe66a('0x15')](_0x2bee53));if(_0x2bee53[_0xe66a('0x16')]){if(_0x2bee53[_0xe66a('0x16')][_0xe66a('0x17')]===0x1f4){logger[_0xe66a('0x16')](_0xe66a('0x18'),_0x1a373b,_0x2bee53['error'][_0xe66a('0x19')]);return _0x459e95(_0x2bee53['error'][_0xe66a('0x19')]);}logger[_0xe66a('0x16')]('DashboardItem,\x20%s,\x20%s',_0x1a373b,_0x2bee53['error'][_0xe66a('0x19')]);return _0x38d33d(_0x2bee53[_0xe66a('0x16')][_0xe66a('0x19')]);}else{logger[_0xe66a('0x1a')]('DashboardItem,\x20%s,\x20%s',_0x1a373b,_0xe66a('0x13'));_0x38d33d(_0x2bee53[_0xe66a('0x1b')][_0xe66a('0x19')]);}})[_0xe66a('0x1c')](function(_0x183fd8){logger['error'](_0xe66a('0x18'),_0x1a373b,_0x183fd8);_0x459e95(_0x183fd8);});});} \ No newline at end of file +var _0xd6d2=['redis','localhost','socket.io-emitter','./dashboardItem.socket','register','request','DashboardItem,\x20%s,\x20%s','debug','DashboardItem,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','http','defaults'];(function(_0x32e74,_0xe869ab){var _0x1d3dda=function(_0x2f81f3){while(--_0x2f81f3){_0x32e74['push'](_0x32e74['shift']());}};_0x1d3dda(++_0xe869ab);}(_0xd6d2,0x11e));var _0x2d6d=function(_0x114738,_0x2b1942){_0x114738=_0x114738-0x0;var _0x46cf7e=_0xd6d2[_0x114738];return _0x46cf7e;};'use strict';var _=require(_0x2d6d('0x0'));var util=require(_0x2d6d('0x1'));var moment=require('moment');var BPromise=require(_0x2d6d('0x2'));var rs=require(_0x2d6d('0x3'));var fs=require('fs');var Redis=require(_0x2d6d('0x4'));var db=require(_0x2d6d('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2d6d('0x6'));var config=require('../../config/environment');var jayson=require(_0x2d6d('0x7'));var client=jayson[_0x2d6d('0x8')][_0x2d6d('0x9')]({'port':0x232a});config['redis']=_[_0x2d6d('0xa')](config[_0x2d6d('0xb')],{'host':_0x2d6d('0xc'),'port':0x18eb});var socket=require(_0x2d6d('0xd'))(new Redis(config[_0x2d6d('0xb')]));require(_0x2d6d('0xe'))[_0x2d6d('0xf')](socket);function respondWithRpcPromise(_0xa79c86,_0x5d91cc,_0x229bab){return new BPromise(function(_0x2b592b,_0x287e9d){return client[_0x2d6d('0x10')](_0xa79c86,_0x229bab)['then'](function(_0x2f00fc){logger['info'](_0x2d6d('0x11'),_0x5d91cc,'request\x20sent');logger[_0x2d6d('0x12')](_0x2d6d('0x13'),_0x5d91cc,_0x2d6d('0x14'),JSON[_0x2d6d('0x15')](_0x2f00fc));if(_0x2f00fc[_0x2d6d('0x16')]){if(_0x2f00fc[_0x2d6d('0x16')][_0x2d6d('0x17')]===0x1f4){logger[_0x2d6d('0x16')](_0x2d6d('0x11'),_0x5d91cc,_0x2f00fc[_0x2d6d('0x16')][_0x2d6d('0x18')]);return _0x287e9d(_0x2f00fc['error']['message']);}logger[_0x2d6d('0x16')](_0x2d6d('0x11'),_0x5d91cc,_0x2f00fc[_0x2d6d('0x16')]['message']);return _0x2b592b(_0x2f00fc['error']['message']);}else{logger[_0x2d6d('0x19')]('DashboardItem,\x20%s,\x20%s',_0x5d91cc,_0x2d6d('0x14'));_0x2b592b(_0x2f00fc['result'][_0x2d6d('0x18')]);}})[_0x2d6d('0x1a')](function(_0x1c1daa){logger[_0x2d6d('0x16')](_0x2d6d('0x11'),_0x5d91cc,_0x1c1daa);_0x287e9d(_0x1c1daa);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 6e95f98..9b2087b 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 _0xe5d7=['dashboardItem:','./dashboardItem.events','remove','update','register'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0xe5d7,0x7e));var _0x7e5d=function(_0x7a6f6f,_0x201cb9){_0x7a6f6f=_0x7a6f6f-0x0;var _0x404b3e=_0xe5d7[_0x7a6f6f];return _0x404b3e;};'use strict';var DashboardItemEvents=require(_0x7e5d('0x0'));var events=['save',_0x7e5d('0x1'),_0x7e5d('0x2')];function createListener(_0x2b43cb,_0x50a057){return function(_0x49c8bc){_0x50a057['emit'](_0x2b43cb,_0x49c8bc);};}function removeListener(_0x29fce9,_0x2d1a96){return function(){DashboardItemEvents['removeListener'](_0x29fce9,_0x2d1a96);};}exports[_0x7e5d('0x3')]=function(_0x53646e){for(var _0x3feeb7=0x0,_0x265189=events['length'];_0x3feeb7<_0x265189;_0x3feeb7++){var _0x39068b=events[_0x3feeb7];var _0x4cd133=createListener(_0x7e5d('0x4')+_0x39068b,_0x53646e);DashboardItemEvents['on'](_0x39068b,_0x4cd133);}}; \ No newline at end of file +var _0x27a5=['./dashboardItem.events','remove','update','emit','removeListener','register','length','dashboardItem:'];(function(_0x4fb299,_0x29b701){var _0x351765=function(_0x4f126a){while(--_0x4f126a){_0x4fb299['push'](_0x4fb299['shift']());}};_0x351765(++_0x29b701);}(_0x27a5,0xa0));var _0x527a=function(_0x3cddcb,_0x5e0bbd){_0x3cddcb=_0x3cddcb-0x0;var _0x3878e8=_0x27a5[_0x3cddcb];return _0x3878e8;};'use strict';var DashboardItemEvents=require(_0x527a('0x0'));var events=['save',_0x527a('0x1'),_0x527a('0x2')];function createListener(_0x4c4340,_0x46dc62){return function(_0x249d76){_0x46dc62[_0x527a('0x3')](_0x4c4340,_0x249d76);};}function removeListener(_0xabcad0,_0x335a65){return function(){DashboardItemEvents[_0x527a('0x4')](_0xabcad0,_0x335a65);};}exports[_0x527a('0x5')]=function(_0x498804){for(var _0x5bc043=0x0,_0x41d7b3=events[_0x527a('0x6')];_0x5bc043<_0x41d7b3;_0x5bc043++){var _0x5aec2d=events[_0x5bc043];var _0x559c24=createListener(_0x527a('0x7')+_0x5aec2d,_0x498804);DashboardItemEvents['on'](_0x5aec2d,_0x559c24);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 9fc0464..216335f 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 _0xe419=['update','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./dashboardItem.controller','isAuthenticated','show','post','create','put','/:id'];(function(_0x35470d,_0x17c425){var _0x1b243a=function(_0x5a786c){while(--_0x5a786c){_0x35470d['push'](_0x35470d['shift']());}};_0x1b243a(++_0x17c425);}(_0xe419,0x69));var _0x9e41=function(_0x2de593,_0x56ff10){_0x2de593=_0x2de593-0x0;var _0x2b5492=_0xe419[_0x2de593];return _0x2b5492;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9e41('0x0'));var timeout=require(_0x9e41('0x1'));var express=require(_0x9e41('0x2'));var router=express[_0x9e41('0x3')]();var fs_extra=require(_0x9e41('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x9e41('0x5'));var config=require(_0x9e41('0x6'));var controller=require(_0x9e41('0x7'));router['get']('/:id',auth[_0x9e41('0x8')](),controller[_0x9e41('0x9')]);router[_0x9e41('0xa')]('/',auth[_0x9e41('0x8')](),controller[_0x9e41('0xb')]);router[_0x9e41('0xc')](_0x9e41('0xd'),auth['isAuthenticated'](),controller[_0x9e41('0xe')]);router['delete']('/:id',auth[_0x9e41('0x8')](),controller[_0x9e41('0xf')]);module[_0x9e41('0x10')]=router; \ No newline at end of file +var _0xcd0e=['post','isAuthenticated','create','put','update','delete','exports','multer','util','path','express','../../config/environment','./dashboardItem.controller','get','/:id','show'];(function(_0x3e16fa,_0x266062){var _0x5f3666=function(_0x19c2c7){while(--_0x19c2c7){_0x3e16fa['push'](_0x3e16fa['shift']());}};_0x5f3666(++_0x266062);}(_0xcd0e,0x77));var _0xecd0=function(_0x25248b,_0x3c8491){_0x25248b=_0x25248b-0x0;var _0x509939=_0xcd0e[_0x25248b];return _0x509939;};'use strict';var multer=require(_0xecd0('0x0'));var util=require(_0xecd0('0x1'));var path=require(_0xecd0('0x2'));var timeout=require('connect-timeout');var express=require(_0xecd0('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(_0xecd0('0x4'));var controller=require(_0xecd0('0x5'));router[_0xecd0('0x6')](_0xecd0('0x7'),auth['isAuthenticated'](),controller[_0xecd0('0x8')]);router[_0xecd0('0x9')]('/',auth[_0xecd0('0xa')](),controller[_0xecd0('0xb')]);router[_0xecd0('0xc')](_0xecd0('0x7'),auth[_0xecd0('0xa')](),controller[_0xecd0('0xd')]);router[_0xecd0('0xe')](_0xecd0('0x7'),auth[_0xecd0('0xa')](),controller['destroy']);module[_0xecd0('0xf')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index eed7b26..b57e982 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 _0x57ed=['ENUM','first','second','STRING','sequelize','exports'];(function(_0x384dfd,_0x54bc76){var _0x5e232c=function(_0x218405){while(--_0x218405){_0x384dfd['push'](_0x384dfd['shift']());}};_0x5e232c(++_0x54bc76);}(_0x57ed,0xfa));var _0xd57e=function(_0x59de83,_0x6fa077){_0x59de83=_0x59de83-0x0;var _0x2bbf39=_0x57ed[_0x59de83];return _0x2bbf39;};'use strict';var Sequelize=require(_0xd57e('0x0'));module[_0xd57e('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'level':{'type':Sequelize[_0xd57e('0x2')](_0xd57e('0x3'),_0xd57e('0x4'),'third'),'allowNull':![],'defaultValue':'first'},'description':{'type':Sequelize[_0xd57e('0x5')]}}; \ No newline at end of file +var _0x6324=['STRING','sequelize','exports','ENUM','first','second','third'];(function(_0x337bee,_0x53cbca){var _0x24c37d=function(_0x535b06){while(--_0x535b06){_0x337bee['push'](_0x337bee['shift']());}};_0x24c37d(++_0x53cbca);}(_0x6324,0xe1));var _0x4632=function(_0x42653f,_0x531aed){_0x42653f=_0x42653f-0x0;var _0x55185f=_0x6324[_0x42653f];return _0x55185f;};'use strict';var Sequelize=require(_0x4632('0x0'));module[_0x4632('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'level':{'type':Sequelize[_0x4632('0x2')](_0x4632('0x3'),_0x4632('0x4'),_0x4632('0x5')),'allowNull':![],'defaultValue':'first'},'description':{'type':Sequelize[_0x4632('0x6')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 55584e0..e04a6f7 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 _0x975a=['path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','offset','undefined','count','set','Content-Range','json','apply','save','update','then','destroy','get','Dispositions','UserProfileResource','error','stack','name','send','map','Disposition','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','sort','where','pick','filter','VIRTUAL','options','include','findAll','catch','params','includeAll','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache'];(function(_0x5bda2b,_0xe30db7){var _0x18e8dc=function(_0x51d82d){while(--_0x51d82d){_0x5bda2b['push'](_0x5bda2b['shift']());}};_0x18e8dc(++_0xe30db7);}(_0x975a,0x142));var _0xa975=function(_0xb46401,_0xfa6588){_0xb46401=_0xb46401-0x0;var _0x2d40be=_0x975a[_0xb46401];return _0x2d40be;};'use strict';var emlformat=require(_0xa975('0x0'));var rimraf=require(_0xa975('0x1'));var zipdir=require(_0xa975('0x2'));var jsonpatch=require(_0xa975('0x3'));var rp=require('request-promise');var moment=require(_0xa975('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa975('0x5'));var util=require('util');var path=require(_0xa975('0x6'));var sox=require(_0xa975('0x7'));var csv=require(_0xa975('0x8'));var ejs=require(_0xa975('0x9'));var fs=require('fs');var fs_extra=require(_0xa975('0xa'));var _=require(_0xa975('0xb'));var squel=require(_0xa975('0xc'));var crypto=require(_0xa975('0xd'));var jsforce=require(_0xa975('0xe'));var deskjs=require(_0xa975('0xf'));var toCsv=require(_0xa975('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xa975('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xa975('0x11'));var as=require(_0xa975('0x12'));var hardwareService=require(_0xa975('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xa975('0x14'));var config=require(_0xa975('0x15'));var licenseUtil=require(_0xa975('0x16'));var db=require(_0xa975('0x17'))['db'];function respondWithStatusCode(_0x4f9626,_0x19b451){_0x19b451=_0x19b451||0xcc;return function(_0x3ed765){if(_0x3ed765){return _0x4f9626['sendStatus'](_0x19b451);}return _0x4f9626['status'](_0x19b451)[_0xa975('0x18')]();};}function respondWithResult(_0x427102,_0xb7d0b3){_0xb7d0b3=_0xb7d0b3||0xc8;return function(_0x4f0c75){if(_0x4f0c75){return _0x427102[_0xa975('0x19')](_0xb7d0b3)['json'](_0x4f0c75);}};}function respondWithFilteredResult(_0x4f9b61,_0x3e0972){return function(_0x34cd3b){if(_0x34cd3b){var _0xdd0415=typeof _0x3e0972[_0xa975('0x1a')]===_0xa975('0x1b')&&typeof _0x3e0972['limit']===_0xa975('0x1b');var _0x3fd5bd=_0x34cd3b[_0xa975('0x1c')];var _0x43d3b5=_0xdd0415?0x0:_0x3e0972[_0xa975('0x1a')];var _0xc5a6f3=_0xdd0415?_0x34cd3b[_0xa975('0x1c')]:_0x3e0972[_0xa975('0x1a')]+_0x3e0972['limit'];var _0x14550a;if(_0xc5a6f3>=_0x3fd5bd){_0xc5a6f3=_0x3fd5bd;_0x14550a=0xc8;}else{_0x14550a=0xce;}_0x4f9b61['status'](_0x14550a);return _0x4f9b61[_0xa975('0x1d')](_0xa975('0x1e'),_0x43d3b5+'-'+_0xc5a6f3+'/'+_0x3fd5bd)[_0xa975('0x1f')](_0x34cd3b);}return null;};}function patchUpdates(_0x589dae){return function(_0x3f2404){try{jsonpatch[_0xa975('0x20')](_0x3f2404,_0x589dae,!![]);}catch(_0x2d2e63){return BPromise['reject'](_0x2d2e63);}return _0x3f2404[_0xa975('0x21')]();};}function saveUpdates(_0x5434a1,_0x1ce90b){return function(_0x2c0773){if(_0x2c0773){return _0x2c0773[_0xa975('0x22')](_0x5434a1)[_0xa975('0x23')](function(_0x35e486){return _0x35e486;});}return null;};}function removeEntity(_0xebc0a,_0x403faa){return function(_0x2dcc8e){if(_0x2dcc8e){return _0x2dcc8e[_0xa975('0x24')]()[_0xa975('0x23')](function(){var _0x561d9b=_0x2dcc8e[_0xa975('0x25')]({'plain':!![]});var _0x2de4c4=_0xa975('0x26');return db[_0xa975('0x27')]['destroy']({'where':{'type':_0x2de4c4,'resourceId':_0x561d9b['id']}})[_0xa975('0x23')](function(){return _0x2dcc8e;});})[_0xa975('0x23')](function(){_0xebc0a[_0xa975('0x19')](0xcc)[_0xa975('0x18')]();});}};}function handleEntityNotFound(_0x406cd5,_0x384fad){return function(_0x1b7ced){if(!_0x1b7ced){_0x406cd5['sendStatus'](0x194);}return _0x1b7ced;};}function handleError(_0x56a780,_0x5d4479){_0x5d4479=_0x5d4479||0x1f4;return function(_0x1d0359){logger[_0xa975('0x28')](_0x1d0359[_0xa975('0x29')]);if(_0x1d0359[_0xa975('0x2a')]){delete _0x1d0359[_0xa975('0x2a')];}_0x56a780[_0xa975('0x19')](_0x5d4479)[_0xa975('0x2b')](_0x1d0359);};}exports['index']=function(_0x3c5777,_0x1600f5){var _0x2138a3={},_0xa5aba4={},_0x2752e0={'count':0x0,'rows':[]};var _0x3aeab7=_[_0xa975('0x2c')](db[_0xa975('0x2d')][_0xa975('0x2e')],function(_0x1559a6){return{'name':_0x1559a6[_0xa975('0x2f')],'type':_0x1559a6[_0xa975('0x30')][_0xa975('0x31')]};});_0xa5aba4[_0xa975('0x32')]=_[_0xa975('0x2c')](_0x3aeab7,_0xa975('0x2a'));_0xa5aba4[_0xa975('0x33')]=_[_0xa975('0x34')](_0x3c5777['query']);_0xa5aba4[_0xa975('0x35')]=_[_0xa975('0x36')](_0xa5aba4[_0xa975('0x32')],_0xa5aba4[_0xa975('0x33')]);_0x2138a3['attributes']=_[_0xa975('0x36')](_0xa5aba4[_0xa975('0x32')],qs[_0xa975('0x37')](_0x3c5777[_0xa975('0x33')][_0xa975('0x37')]));_0x2138a3[_0xa975('0x38')]=_0x2138a3[_0xa975('0x38')]['length']?_0x2138a3[_0xa975('0x38')]:_0xa5aba4[_0xa975('0x32')];if(!_0x3c5777['query'][_0xa975('0x39')](_0xa975('0x3a'))){_0x2138a3[_0xa975('0x3b')]=qs[_0xa975('0x3b')](_0x3c5777[_0xa975('0x33')]['limit']);_0x2138a3['offset']=qs[_0xa975('0x1a')](_0x3c5777['query']['offset']);}_0x2138a3['order']=qs[_0xa975('0x3c')](_0x3c5777[_0xa975('0x33')][_0xa975('0x3c')]);_0x2138a3[_0xa975('0x3d')]=qs[_0xa975('0x35')](_[_0xa975('0x3e')](_0x3c5777[_0xa975('0x33')],_0xa5aba4[_0xa975('0x35')]),_0x3aeab7);if(_0x3c5777[_0xa975('0x33')][_0xa975('0x3f')]){_0x2138a3[_0xa975('0x3d')]=_['merge'](_0x2138a3[_0xa975('0x3d')],{'$or':_['map'](_0x3aeab7,function(_0x3ebc5d){if(_0x3ebc5d['type']!==_0xa975('0x40')){var _0x51f774={};_0x51f774[_0x3ebc5d[_0xa975('0x2a')]]={'$like':'%'+_0x3c5777[_0xa975('0x33')][_0xa975('0x3f')]+'%'};return _0x51f774;}})});}_0x2138a3=_['merge']({},_0x2138a3,_0x3c5777[_0xa975('0x41')]);var _0x3b082e={'where':_0x2138a3[_0xa975('0x3d')]};return db[_0xa975('0x2d')][_0xa975('0x1c')](_0x3b082e)[_0xa975('0x23')](function(_0x4a67d2){_0x2752e0[_0xa975('0x1c')]=_0x4a67d2;if(_0x3c5777[_0xa975('0x33')]['includeAll']){_0x2138a3[_0xa975('0x42')]=[{'all':!![]}];}return db[_0xa975('0x2d')][_0xa975('0x43')](_0x2138a3);})['then'](function(_0x4daf1e){_0x2752e0['rows']=_0x4daf1e;return _0x2752e0;})[_0xa975('0x23')](respondWithFilteredResult(_0x1600f5,_0x2138a3))[_0xa975('0x44')](handleError(_0x1600f5,null));};exports['show']=function(_0x4df9c2,_0x3f4815){var _0x395f29={'raw':!![],'where':{'id':_0x4df9c2[_0xa975('0x45')]['id']}},_0x2bcbda={};_0x2bcbda[_0xa975('0x32')]=_[_0xa975('0x34')](db[_0xa975('0x2d')][_0xa975('0x2e')]);_0x2bcbda['query']=_[_0xa975('0x34')](_0x4df9c2[_0xa975('0x33')]);_0x2bcbda[_0xa975('0x35')]=_['intersection'](_0x2bcbda[_0xa975('0x32')],_0x2bcbda[_0xa975('0x33')]);_0x395f29[_0xa975('0x38')]=_['intersection'](_0x2bcbda[_0xa975('0x32')],qs[_0xa975('0x37')](_0x4df9c2[_0xa975('0x33')]['fields']));_0x395f29[_0xa975('0x38')]=_0x395f29['attributes']['length']?_0x395f29[_0xa975('0x38')]:_0x2bcbda[_0xa975('0x32')];if(_0x4df9c2[_0xa975('0x33')][_0xa975('0x46')]){_0x395f29[_0xa975('0x42')]=[{'all':!![]}];}_0x395f29=_[_0xa975('0x47')]({},_0x395f29,_0x4df9c2[_0xa975('0x41')]);return db['Disposition'][_0xa975('0x48')](_0x395f29)[_0xa975('0x23')](handleEntityNotFound(_0x3f4815,null))[_0xa975('0x23')](respondWithResult(_0x3f4815,null))[_0xa975('0x44')](handleError(_0x3f4815,null));};exports[_0xa975('0x49')]=function(_0xb6c8a8,_0x2ecb31){return db[_0xa975('0x2d')][_0xa975('0x49')](_0xb6c8a8[_0xa975('0x4a')],{})[_0xa975('0x23')](function(_0xf9cfb3){var _0x462244=_0xb6c8a8[_0xa975('0x4b')][_0xa975('0x25')]({'plain':!![]});if(!_0x462244)throw new Error(_0xa975('0x4c'));if(_0x462244[_0xa975('0x4d')]===_0xa975('0x4b')){var _0x203411=_0xf9cfb3[_0xa975('0x25')]({'plain':!![]});var _0x3129e8=_0xa975('0x26');return db[_0xa975('0x4e')][_0xa975('0x48')]({'where':{'name':_0x3129e8,'userProfileId':_0x462244[_0xa975('0x4f')]},'raw':!![]})[_0xa975('0x23')](function(_0x385363){if(_0x385363&&_0x385363[_0xa975('0x50')]===0x0){return db['UserProfileResource'][_0xa975('0x49')]({'name':_0x203411[_0xa975('0x2a')],'resourceId':_0x203411['id'],'type':_0x385363[_0xa975('0x2a')],'sectionId':_0x385363['id']},{})[_0xa975('0x23')](function(){return _0xf9cfb3;});}else{return _0xf9cfb3;}})[_0xa975('0x44')](function(_0x4de7c7){logger[_0xa975('0x28')](_0xa975('0x51'),_0x4de7c7);throw _0x4de7c7;});}return _0xf9cfb3;})['then'](respondWithResult(_0x2ecb31,0xc9))['catch'](handleError(_0x2ecb31,null));};exports[_0xa975('0x22')]=function(_0x547992,_0x2a4cfa){if(_0x547992[_0xa975('0x4a')]['id']){delete _0x547992[_0xa975('0x4a')]['id'];}return db[_0xa975('0x2d')][_0xa975('0x48')]({'where':{'id':_0x547992['params']['id']}})[_0xa975('0x23')](handleEntityNotFound(_0x2a4cfa,null))['then'](saveUpdates(_0x547992['body'],null))[_0xa975('0x23')](respondWithResult(_0x2a4cfa,null))[_0xa975('0x44')](handleError(_0x2a4cfa,null));};exports[_0xa975('0x24')]=function(_0x38c0f5,_0x41c520){return db['Disposition']['find']({'where':{'id':_0x38c0f5[_0xa975('0x45')]['id']}})[_0xa975('0x23')](handleEntityNotFound(_0x41c520,null))[_0xa975('0x23')](removeEntity(_0x41c520,null))[_0xa975('0x44')](handleError(_0x41c520,null));}; \ No newline at end of file +var _0xb957=['filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','rawAttributes','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','get','Dispositions','UserProfileResource','sendStatus','error','stack','name','send','index','map','Disposition','type','key','query','keys'];(function(_0x197ae6,_0x1430d2){var _0x36cd78=function(_0x13b4ed){while(--_0x13b4ed){_0x197ae6['push'](_0x197ae6['shift']());}};_0x36cd78(++_0x1430d2);}(_0xb957,0x6d));var _0x7b95=function(_0x18e902,_0x4cb003){_0x18e902=_0x18e902-0x0;var _0x6110e0=_0xb957[_0x18e902];return _0x6110e0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7b95('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7b95('0x1'));var moment=require(_0x7b95('0x2'));var BPromise=require(_0x7b95('0x3'));var Mustache=require('mustache');var util=require(_0x7b95('0x4'));var path=require(_0x7b95('0x5'));var sox=require(_0x7b95('0x6'));var csv=require(_0x7b95('0x7'));var ejs=require(_0x7b95('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7b95('0x9'));var squel=require(_0x7b95('0xa'));var crypto=require(_0x7b95('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x7b95('0x7'));var querystring=require(_0x7b95('0xc'));var Papa=require(_0x7b95('0xd'));var Redis=require(_0x7b95('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7b95('0xf'));var logger=require(_0x7b95('0x10'))('api');var utils=require('../../config/utils');var config=require(_0x7b95('0x11'));var licenseUtil=require(_0x7b95('0x12'));var db=require(_0x7b95('0x13'))['db'];function respondWithStatusCode(_0x534650,_0x5df477){_0x5df477=_0x5df477||0xcc;return function(_0x399542){if(_0x399542){return _0x534650['sendStatus'](_0x5df477);}return _0x534650[_0x7b95('0x14')](_0x5df477)[_0x7b95('0x15')]();};}function respondWithResult(_0x7e63d3,_0x3818bd){_0x3818bd=_0x3818bd||0xc8;return function(_0x5dedf2){if(_0x5dedf2){return _0x7e63d3['status'](_0x3818bd)[_0x7b95('0x16')](_0x5dedf2);}};}function respondWithFilteredResult(_0x1fd4e5,_0x241ccf){return function(_0x1fa5ad){if(_0x1fa5ad){var _0x87f9c1=typeof _0x241ccf[_0x7b95('0x17')]===_0x7b95('0x18')&&typeof _0x241ccf[_0x7b95('0x19')]===_0x7b95('0x18');var _0x4251d5=_0x1fa5ad[_0x7b95('0x1a')];var _0x4eea43=_0x87f9c1?0x0:_0x241ccf[_0x7b95('0x17')];var _0xed383=_0x87f9c1?_0x1fa5ad[_0x7b95('0x1a')]:_0x241ccf[_0x7b95('0x17')]+_0x241ccf[_0x7b95('0x19')];var _0xc26a6e;if(_0xed383>=_0x4251d5){_0xed383=_0x4251d5;_0xc26a6e=0xc8;}else{_0xc26a6e=0xce;}_0x1fd4e5[_0x7b95('0x14')](_0xc26a6e);return _0x1fd4e5[_0x7b95('0x1b')]('Content-Range',_0x4eea43+'-'+_0xed383+'/'+_0x4251d5)[_0x7b95('0x16')](_0x1fa5ad);}return null;};}function patchUpdates(_0x342ecc){return function(_0x32fe1c){try{jsonpatch[_0x7b95('0x1c')](_0x32fe1c,_0x342ecc,!![]);}catch(_0x311a40){return BPromise[_0x7b95('0x1d')](_0x311a40);}return _0x32fe1c[_0x7b95('0x1e')]();};}function saveUpdates(_0x1657bd,_0x2144c1){return function(_0x3deae3){if(_0x3deae3){return _0x3deae3[_0x7b95('0x1f')](_0x1657bd)[_0x7b95('0x20')](function(_0x20c0d9){return _0x20c0d9;});}return null;};}function removeEntity(_0x41d7cf,_0x4acc74){return function(_0x1c0a41){if(_0x1c0a41){return _0x1c0a41[_0x7b95('0x21')]()['then'](function(){var _0x2e7795=_0x1c0a41[_0x7b95('0x22')]({'plain':!![]});var _0x184d4f=_0x7b95('0x23');return db[_0x7b95('0x24')][_0x7b95('0x21')]({'where':{'type':_0x184d4f,'resourceId':_0x2e7795['id']}})[_0x7b95('0x20')](function(){return _0x1c0a41;});})['then'](function(){_0x41d7cf[_0x7b95('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2fdc2d,_0x41d863){return function(_0x1b6e6b){if(!_0x1b6e6b){_0x2fdc2d[_0x7b95('0x25')](0x194);}return _0x1b6e6b;};}function handleError(_0x43504f,_0xaa3991){_0xaa3991=_0xaa3991||0x1f4;return function(_0x492752){logger[_0x7b95('0x26')](_0x492752[_0x7b95('0x27')]);if(_0x492752['name']){delete _0x492752[_0x7b95('0x28')];}_0x43504f[_0x7b95('0x14')](_0xaa3991)[_0x7b95('0x29')](_0x492752);};}exports[_0x7b95('0x2a')]=function(_0x4bcd35,_0x3be0ae){var _0x2a9b6e={},_0x45ffb5={},_0x5a9488={'count':0x0,'rows':[]};var _0x4fe17e=_[_0x7b95('0x2b')](db[_0x7b95('0x2c')]['rawAttributes'],function(_0x324f02){return{'name':_0x324f02['fieldName'],'type':_0x324f02[_0x7b95('0x2d')][_0x7b95('0x2e')]};});_0x45ffb5['model']=_['map'](_0x4fe17e,_0x7b95('0x28'));_0x45ffb5[_0x7b95('0x2f')]=_[_0x7b95('0x30')](_0x4bcd35[_0x7b95('0x2f')]);_0x45ffb5[_0x7b95('0x31')]=_[_0x7b95('0x32')](_0x45ffb5['model'],_0x45ffb5[_0x7b95('0x2f')]);_0x2a9b6e[_0x7b95('0x33')]=_[_0x7b95('0x32')](_0x45ffb5[_0x7b95('0x34')],qs['fields'](_0x4bcd35['query'][_0x7b95('0x35')]));_0x2a9b6e[_0x7b95('0x33')]=_0x2a9b6e[_0x7b95('0x33')][_0x7b95('0x36')]?_0x2a9b6e[_0x7b95('0x33')]:_0x45ffb5[_0x7b95('0x34')];if(!_0x4bcd35[_0x7b95('0x2f')][_0x7b95('0x37')](_0x7b95('0x38'))){_0x2a9b6e[_0x7b95('0x19')]=qs[_0x7b95('0x19')](_0x4bcd35[_0x7b95('0x2f')][_0x7b95('0x19')]);_0x2a9b6e['offset']=qs[_0x7b95('0x17')](_0x4bcd35[_0x7b95('0x2f')][_0x7b95('0x17')]);}_0x2a9b6e[_0x7b95('0x39')]=qs[_0x7b95('0x3a')](_0x4bcd35[_0x7b95('0x2f')][_0x7b95('0x3a')]);_0x2a9b6e[_0x7b95('0x3b')]=qs['filters'](_['pick'](_0x4bcd35[_0x7b95('0x2f')],_0x45ffb5[_0x7b95('0x31')]),_0x4fe17e);if(_0x4bcd35[_0x7b95('0x2f')][_0x7b95('0x3c')]){_0x2a9b6e[_0x7b95('0x3b')]=_['merge'](_0x2a9b6e[_0x7b95('0x3b')],{'$or':_[_0x7b95('0x2b')](_0x4fe17e,function(_0x5c3b1c){if(_0x5c3b1c['type']!==_0x7b95('0x3d')){var _0x8b6fd9={};_0x8b6fd9[_0x5c3b1c['name']]={'$like':'%'+_0x4bcd35[_0x7b95('0x2f')][_0x7b95('0x3c')]+'%'};return _0x8b6fd9;}})});}_0x2a9b6e=_[_0x7b95('0x3e')]({},_0x2a9b6e,_0x4bcd35[_0x7b95('0x3f')]);var _0x4f355d={'where':_0x2a9b6e['where']};return db[_0x7b95('0x2c')][_0x7b95('0x1a')](_0x4f355d)['then'](function(_0x3ccdb8){_0x5a9488['count']=_0x3ccdb8;if(_0x4bcd35[_0x7b95('0x2f')][_0x7b95('0x40')]){_0x2a9b6e[_0x7b95('0x41')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x2a9b6e);})['then'](function(_0x3515ea){_0x5a9488[_0x7b95('0x42')]=_0x3515ea;return _0x5a9488;})[_0x7b95('0x20')](respondWithFilteredResult(_0x3be0ae,_0x2a9b6e))[_0x7b95('0x43')](handleError(_0x3be0ae,null));};exports[_0x7b95('0x44')]=function(_0x223d9b,_0x16871b){var _0x31c2b8={'raw':!![],'where':{'id':_0x223d9b[_0x7b95('0x45')]['id']}},_0x1cce36={};_0x1cce36[_0x7b95('0x34')]=_['keys'](db['Disposition'][_0x7b95('0x46')]);_0x1cce36[_0x7b95('0x2f')]=_[_0x7b95('0x30')](_0x223d9b['query']);_0x1cce36[_0x7b95('0x31')]=_[_0x7b95('0x32')](_0x1cce36[_0x7b95('0x34')],_0x1cce36['query']);_0x31c2b8[_0x7b95('0x33')]=_['intersection'](_0x1cce36[_0x7b95('0x34')],qs[_0x7b95('0x35')](_0x223d9b[_0x7b95('0x2f')][_0x7b95('0x35')]));_0x31c2b8[_0x7b95('0x33')]=_0x31c2b8[_0x7b95('0x33')][_0x7b95('0x36')]?_0x31c2b8[_0x7b95('0x33')]:_0x1cce36[_0x7b95('0x34')];if(_0x223d9b[_0x7b95('0x2f')][_0x7b95('0x40')]){_0x31c2b8[_0x7b95('0x41')]=[{'all':!![]}];}_0x31c2b8=_['merge']({},_0x31c2b8,_0x223d9b[_0x7b95('0x3f')]);return db[_0x7b95('0x2c')]['find'](_0x31c2b8)[_0x7b95('0x20')](handleEntityNotFound(_0x16871b,null))[_0x7b95('0x20')](respondWithResult(_0x16871b,null))['catch'](handleError(_0x16871b,null));};exports['create']=function(_0x13e25c,_0x30d7e3){return db[_0x7b95('0x2c')][_0x7b95('0x47')](_0x13e25c[_0x7b95('0x48')],{})[_0x7b95('0x20')](function(_0x363a0a){var _0x3a1406=_0x13e25c[_0x7b95('0x49')][_0x7b95('0x22')]({'plain':!![]});if(!_0x3a1406)throw new Error(_0x7b95('0x4a'));if(_0x3a1406[_0x7b95('0x4b')]==='user'){var _0x1e1c56=_0x363a0a[_0x7b95('0x22')]({'plain':!![]});var _0x4a9540=_0x7b95('0x23');return db[_0x7b95('0x4c')][_0x7b95('0x4d')]({'where':{'name':_0x4a9540,'userProfileId':_0x3a1406['userProfileId']},'raw':!![]})[_0x7b95('0x20')](function(_0x573a23){if(_0x573a23&&_0x573a23[_0x7b95('0x4e')]===0x0){return db[_0x7b95('0x24')][_0x7b95('0x47')]({'name':_0x1e1c56[_0x7b95('0x28')],'resourceId':_0x1e1c56['id'],'type':_0x573a23[_0x7b95('0x28')],'sectionId':_0x573a23['id']},{})[_0x7b95('0x20')](function(){return _0x363a0a;});}else{return _0x363a0a;}})[_0x7b95('0x43')](function(_0x1f41c8){logger[_0x7b95('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1f41c8);throw _0x1f41c8;});}return _0x363a0a;})[_0x7b95('0x20')](respondWithResult(_0x30d7e3,0xc9))[_0x7b95('0x43')](handleError(_0x30d7e3,null));};exports[_0x7b95('0x1f')]=function(_0x4893a0,_0x2a27d0){if(_0x4893a0[_0x7b95('0x48')]['id']){delete _0x4893a0[_0x7b95('0x48')]['id'];}return db[_0x7b95('0x2c')][_0x7b95('0x4d')]({'where':{'id':_0x4893a0[_0x7b95('0x45')]['id']}})['then'](handleEntityNotFound(_0x2a27d0,null))[_0x7b95('0x20')](saveUpdates(_0x4893a0['body'],null))[_0x7b95('0x20')](respondWithResult(_0x2a27d0,null))[_0x7b95('0x43')](handleError(_0x2a27d0,null));};exports[_0x7b95('0x21')]=function(_0x523549,_0x207a10){return db[_0x7b95('0x2c')][_0x7b95('0x4d')]({'where':{'id':_0x523549[_0x7b95('0x45')]['id']}})['then'](handleEntityNotFound(_0x207a10,null))[_0x7b95('0x20')](removeEntity(_0x207a10,null))[_0x7b95('0x43')](handleError(_0x207a10,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 7ed92d8..04384b3 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 _0x5c75=['exports','define','Disposition','tools_dispositions','name','name_chat','ChatWebsiteId','MailAccountId','name_sms','name_fax','FaxAccountId','OpenchannelAccountId','WhatsappAccountId','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x5a0383,_0x312ffe){var _0x1adda7=function(_0x1a0cf5){while(--_0x1a0cf5){_0x5a0383['push'](_0x5a0383['shift']());}};_0x1adda7(++_0x312ffe);}(_0x5c75,0xca));var _0x55c7=function(_0x111c6c,_0x5ac573){_0x111c6c=_0x111c6c-0x0;var _0x2e983a=_0x5c75[_0x111c6c];return _0x2e983a;};'use strict';var _=require(_0x55c7('0x0'));var util=require(_0x55c7('0x1'));var logger=require(_0x55c7('0x2'))('api');var moment=require(_0x55c7('0x3'));var BPromise=require(_0x55c7('0x4'));var rp=require(_0x55c7('0x5'));var fs=require('fs');var path=require(_0x55c7('0x6'));var rimraf=require(_0x55c7('0x7'));var config=require('../../config/environment');var attributes=require('./disposition.attributes');module[_0x55c7('0x8')]=function(_0x3093cf,_0x5be4c3){return _0x3093cf[_0x55c7('0x9')](_0x55c7('0xa'),attributes,{'tableName':_0x55c7('0xb'),'paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':[_0x55c7('0xc'),'ListId']},{'unique':!![],'name':_0x55c7('0xd'),'fields':[_0x55c7('0xc'),_0x55c7('0xe')]},{'unique':!![],'name':'name_mail','fields':['name',_0x55c7('0xf')]},{'unique':!![],'name':_0x55c7('0x10'),'fields':[_0x55c7('0xc'),'SmsAccountId']},{'unique':!![],'name':_0x55c7('0x11'),'fields':['name',_0x55c7('0x12')]},{'unique':!![],'name':'name_openchannel','fields':[_0x55c7('0xc'),_0x55c7('0x13')]},{'unique':!![],'name':'name_whatsapp','fields':['name',_0x55c7('0x14')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0064=['bluebird','request-promise','path','../../config/environment','exports','define','Disposition','tools_dispositions','ListId','name_chat','ChatWebsiteId','name_mail','name','name_sms','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','../../config/logger','api'];(function(_0x18d9a5,_0x362bc2){var _0x58553d=function(_0x5f50f5){while(--_0x5f50f5){_0x18d9a5['push'](_0x18d9a5['shift']());}};_0x58553d(++_0x362bc2);}(_0x0064,0x87));var _0x4006=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0064[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4006('0x0'));var util=require('util');var logger=require(_0x4006('0x1'))(_0x4006('0x2'));var moment=require('moment');var BPromise=require(_0x4006('0x3'));var rp=require(_0x4006('0x4'));var fs=require('fs');var path=require(_0x4006('0x5'));var rimraf=require('rimraf');var config=require(_0x4006('0x6'));var attributes=require('./disposition.attributes');module[_0x4006('0x7')]=function(_0x3df569,_0x384d88){return _0x3df569[_0x4006('0x8')](_0x4006('0x9'),attributes,{'tableName':_0x4006('0xa'),'paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':['name',_0x4006('0xb')]},{'unique':!![],'name':_0x4006('0xc'),'fields':['name',_0x4006('0xd')]},{'unique':!![],'name':_0x4006('0xe'),'fields':[_0x4006('0xf'),'MailAccountId']},{'unique':!![],'name':_0x4006('0x10'),'fields':[_0x4006('0xf'),'SmsAccountId']},{'unique':!![],'name':_0x4006('0x11'),'fields':[_0x4006('0xf'),_0x4006('0x12')]},{'unique':!![],'name':_0x4006('0x13'),'fields':[_0x4006('0xf'),_0x4006('0x14')]},{'unique':!![],'name':_0x4006('0x15'),'fields':['name',_0x4006('0x16')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index dbb7a75..847937f 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(_0x15faae,_0x4bfb0f){var _0x4cfa11=function(_0x56f404){while(--_0x56f404){_0x15faae['push'](_0x15faae['shift']());}};_0x4cfa11(++_0x4bfb0f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa9e0[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +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(_0x139ac5,_0x1f3718){var _0xadec59=function(_0xc0f177){while(--_0xc0f177){_0x139ac5['push'](_0x139ac5['shift']());}};_0xadec59(++_0x1f3718);}(_0xa9e0,0x123));var _0x0a9e=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0xa9e0[_0x220dbb];return _0x2b77de;};'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 470d8ca..06818e8 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 _0x833e=['../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x49cdd0,_0x2508f9){var _0x13daaa=function(_0x341627){while(--_0x341627){_0x49cdd0['push'](_0x49cdd0['shift']());}};_0x13daaa(++_0x2508f9);}(_0x833e,0x189));var _0xe833=function(_0x50aacc,_0x219e8b){_0x50aacc=_0x50aacc-0x0;var _0x2d9d6b=_0x833e[_0x50aacc];return _0x2d9d6b;};'use strict';var multer=require(_0xe833('0x0'));var util=require(_0xe833('0x1'));var path=require(_0xe833('0x2'));var timeout=require(_0xe833('0x3'));var express=require(_0xe833('0x4'));var router=express[_0xe833('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xe833('0x6'));var interaction=require(_0xe833('0x7'));var config=require(_0xe833('0x8'));var controller=require(_0xe833('0x9'));router[_0xe833('0xa')]('/',auth[_0xe833('0xb')](),controller[_0xe833('0xc')]);router[_0xe833('0xa')](_0xe833('0xd'),auth[_0xe833('0xb')](),controller[_0xe833('0xe')]);router[_0xe833('0xf')]('/',auth[_0xe833('0xb')](),controller[_0xe833('0x10')]);router[_0xe833('0x11')](_0xe833('0xd'),auth[_0xe833('0xb')](),controller[_0xe833('0x12')]);router[_0xe833('0x13')]('/:id',auth[_0xe833('0xb')](),controller['destroy']);module[_0xe833('0x14')]=router; \ No newline at end of file +var _0x1595=['post','create','put','/:id','update','delete','destroy','util','path','connect-timeout','express','fs-extra','../../components/auth/service','index','isAuthenticated','show'];(function(_0x2c4fef,_0x37feb3){var _0x49fdb1=function(_0x34e69c){while(--_0x34e69c){_0x2c4fef['push'](_0x2c4fef['shift']());}};_0x49fdb1(++_0x37feb3);}(_0x1595,0xd7));var _0x5159=function(_0x5761bb,_0x2a5c9f){_0x5761bb=_0x5761bb-0x0;var _0x1d7563=_0x1595[_0x5761bb];return _0x1d7563;};'use strict';var multer=require('multer');var util=require(_0x5159('0x0'));var path=require(_0x5159('0x1'));var timeout=require(_0x5159('0x2'));var express=require(_0x5159('0x3'));var router=express['Router']();var fs_extra=require(_0x5159('0x4'));var auth=require(_0x5159('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./disposition.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x5159('0x6')]);router['get']('/:id',auth[_0x5159('0x7')](),controller[_0x5159('0x8')]);router[_0x5159('0x9')]('/',auth[_0x5159('0x7')](),controller[_0x5159('0xa')]);router[_0x5159('0xb')](_0x5159('0xc'),auth[_0x5159('0x7')](),controller[_0x5159('0xd')]);router[_0x5159('0xe')](_0x5159('0xc'),auth['isAuthenticated'](),controller[_0x5159('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 1afa998..22d01d9 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 _0xbff5=['v17,v27,v29','INTEGER','SIP','DADHI','KHOMP','TEXT','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','2400','4800','7200','9600','12000','14400'];(function(_0x30d54e,_0x4ed409){var _0x23e334=function(_0xe51c0a){while(--_0xe51c0a){_0x30d54e['push'](_0x30d54e['shift']());}};_0x23e334(++_0x4ed409);}(_0xbff5,0x1bc));var _0x5bff=function(_0x2e8795,_0x3b86dd){_0x2e8795=_0x2e8795-0x0;var _0x27ee08=_0xbff5[_0x2e8795];return _0x27ee08;};'use strict';var Sequelize=require(_0x5bff('0x0'));module[_0x5bff('0x1')]={'name':{'type':Sequelize[_0x5bff('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x5bff('0x2')]},'ecm':{'type':Sequelize[_0x5bff('0x3')](_0x5bff('0x4'),'no'),'defaultValue':_0x5bff('0x4')},'headerinfo':{'type':Sequelize['STRING'],'defaultValue':_0x5bff('0x5')},'localstationid':{'type':Sequelize['STRING'],'unique':'localstationid'},'minrate':{'type':Sequelize[_0x5bff('0x3')](_0x5bff('0x6'),_0x5bff('0x7'),_0x5bff('0x8'),_0x5bff('0x9'),_0x5bff('0xa'),_0x5bff('0xb')),'defaultValue':_0x5bff('0x7')},'maxrate':{'type':Sequelize[_0x5bff('0x3')]('2400',_0x5bff('0x7'),'7200',_0x5bff('0x9'),_0x5bff('0xa'),'14400'),'defaultValue':_0x5bff('0xb')},'modem':{'type':Sequelize['STRING'],'defaultValue':_0x5bff('0xc')},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x5bff('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x5bff('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize['ENUM'](_0x5bff('0xe'),'IAX',_0x5bff('0xf'),_0x5bff('0x10')),'defaultValue':'SIP'},'key':{'type':Sequelize[_0x5bff('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x5bff('0x11')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x5bff('0x12')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x5bff('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x5bff('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x5bff('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x5bff('0x12')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x5bff('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x5bff('0x13')},'mandatoryDisposition':{'type':Sequelize[_0x5bff('0x12')],'defaultValue':![],'comment':_0x5bff('0x14'),'set':function(_0x546351){if(!_0x546351)this[_0x5bff('0x15')](_0x5bff('0x16'),null);this[_0x5bff('0x15')](_0x5bff('0x17'),_0x546351);}}}; \ No newline at end of file +var _0x8506=['mandatoryDispositionPauseId','mandatoryDisposition','exports','STRING','yes','xCALLY\x20Motion\x20Fax','ENUM','2400','4800','7200','9600','12000','14400','INTEGER','SIP','IAX','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue'];(function(_0x3edbea,_0x31cc8d){var _0x5e249f=function(_0x32770b){while(--_0x32770b){_0x3edbea['push'](_0x3edbea['shift']());}};_0x5e249f(++_0x31cc8d);}(_0x8506,0xe8));var _0x6850=function(_0x1ee2d3,_0x3ea267){_0x1ee2d3=_0x1ee2d3-0x0;var _0xf275e3=_0x8506[_0x1ee2d3];return _0xf275e3;};'use strict';var Sequelize=require('sequelize');module[_0x6850('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x6850('0x1')]},'ecm':{'type':Sequelize['ENUM'](_0x6850('0x2'),'no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize[_0x6850('0x1')],'defaultValue':_0x6850('0x3')},'localstationid':{'type':Sequelize[_0x6850('0x1')],'unique':'localstationid'},'minrate':{'type':Sequelize[_0x6850('0x4')](_0x6850('0x5'),_0x6850('0x6'),_0x6850('0x7'),'9600','12000','14400'),'defaultValue':_0x6850('0x6')},'maxrate':{'type':Sequelize[_0x6850('0x4')](_0x6850('0x5'),'4800','7200',_0x6850('0x8'),_0x6850('0x9'),_0x6850('0xa')),'defaultValue':_0x6850('0xa')},'modem':{'type':Sequelize[_0x6850('0x1')],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize[_0x6850('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x6850('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x6850('0xb')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x6850('0x4')](_0x6850('0xc'),_0x6850('0xd'),'DADHI',_0x6850('0xe')),'defaultValue':_0x6850('0xc')},'key':{'type':Sequelize[_0x6850('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x6850('0xf')],'defaultValue':function(){return _0x6850('0x10');}},'notificationSound':{'type':Sequelize[_0x6850('0x11')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x6850('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x6850('0x11')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x6850('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x6850('0x11')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6850('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6850('0xb')],'allowNull':!![],'defaultValue':null,'comment':_0x6850('0x12')},'mandatoryDisposition':{'type':Sequelize[_0x6850('0x11')],'defaultValue':![],'comment':_0x6850('0x13'),'set':function(_0x426c0a){if(!_0x426c0a)this[_0x6850('0x14')](_0x6850('0x15'),null);this[_0x6850('0x14')](_0x6850('0x16'),_0x426c0a);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 5cffb04..52e9a83 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 _0x4d01=['stack','name','send','index','mandatoryDispositionPause','map','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','offset','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','FaxAccount','findAll','rows','show','Pause','find','catch','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','Disposition','getDispositions','findOne','nolimit','FaxAccountId','removeDispositions','getAnswers','CannedAnswer','removeAnswers','ids','FaxInteraction','addInteraction','omit','getInteractions','CmContact','Contact','User','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','from-voip-provider','exten','localstationid','app','description','Fax\x20Extension','appdata','Answer','push','CDR(type)=inbound-fax','Set','ecm','gateway','faxdetect','headerinfo','maxrate','minrate','t38timeout','FAXOPT(','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','VoiceExtension','updateAccountApplications','transaction','tech','createdAt','updatedAt','TrunkId','ListId','findById','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','Contacts','DESC','attachments','join','root','server/files/attachments','basename','isNil','from','\x22%s\x22\x20<%s>','fax','out','filename','Contact\x20not\x20found','spread','ContactId','dataValues','Messages','SendFax','SendFaxRpc,\x20%s','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','jayson/promise','http','client','then','FaxAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','sendStatus','status','json','limit','undefined','count','Content-Range','apply','reject','save','update','destroy','end'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0x4d01,0x15d));var _0x14d0=function(_0x4f4d19,_0x574245){_0x4f4d19=_0x4f4d19-0x0;var _0x27a258=_0x4d01[_0x4f4d19];return _0x27a258;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x14d0('0x0'));var zipdir=require(_0x14d0('0x1'));var jsonpatch=require(_0x14d0('0x2'));var rp=require(_0x14d0('0x3'));var moment=require('moment');var BPromise=require(_0x14d0('0x4'));var Mustache=require(_0x14d0('0x5'));var util=require(_0x14d0('0x6'));var path=require(_0x14d0('0x7'));var sox=require(_0x14d0('0x8'));var csv=require('to-csv');var ejs=require(_0x14d0('0x9'));var fs=require('fs');var fs_extra=require(_0x14d0('0xa'));var _=require(_0x14d0('0xb'));var squel=require(_0x14d0('0xc'));var crypto=require(_0x14d0('0xd'));var jsforce=require(_0x14d0('0xe'));var deskjs=require(_0x14d0('0xf'));var toCsv=require(_0x14d0('0x10'));var querystring=require('querystring');var Papa=require(_0x14d0('0x11'));var Redis=require(_0x14d0('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x14d0('0x13'));var hardwareService=require(_0x14d0('0x14'));var logger=require(_0x14d0('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x14d0('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x14d0('0x17'))['db'];config[_0x14d0('0x18')]=_[_0x14d0('0x19')](config[_0x14d0('0x18')],{'host':_0x14d0('0x1a'),'port':0x18eb});var socket=require(_0x14d0('0x1b'))(new Redis(config[_0x14d0('0x18')]));require(_0x14d0('0x1c'))['register'](socket);var jayson=require(_0x14d0('0x1d'));var client=jayson['client'][_0x14d0('0x1e')]({'port':0x232c});var client9002=jayson[_0x14d0('0x1f')][_0x14d0('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x5e884f,_0x14eece,_0x45b365,_0x593060){return new BPromise(function(_0x9d20d5,_0x5117cf){var _0x101d94=_0x593060||client;return _0x101d94['request'](_0x5e884f,_0x45b365)[_0x14d0('0x20')](function(_0x3e3b73){logger['info'](_0x14d0('0x21'),_0x14eece,_0x14d0('0x22'));logger['debug']('FaxAccount,\x20%s,\x20%s,\x20%s',_0x14eece,_0x14d0('0x22'),JSON[_0x14d0('0x23')](_0x3e3b73));if(_0x3e3b73[_0x14d0('0x24')]){if(_0x3e3b73[_0x14d0('0x24')][_0x14d0('0x25')]===0x1f4){logger[_0x14d0('0x24')](_0x14d0('0x21'),_0x14eece,_0x3e3b73['error'][_0x14d0('0x26')]);return _0x5117cf(_0x3e3b73[_0x14d0('0x24')][_0x14d0('0x26')]);}logger['error']('FaxAccount,\x20%s,\x20%s',_0x14eece,_0x3e3b73[_0x14d0('0x24')][_0x14d0('0x26')]);return _0x9d20d5(_0x3e3b73[_0x14d0('0x24')][_0x14d0('0x26')]);}else{logger['info']('FaxAccount,\x20%s,\x20%s',_0x14eece,'request\x20sent');_0x9d20d5(_0x3e3b73[_0x14d0('0x27')][_0x14d0('0x26')]);}})['catch'](function(_0x5f77a6){logger[_0x14d0('0x24')](_0x14d0('0x21'),_0x14eece,_0x5f77a6);_0x5117cf(_0x5f77a6);});});}function respondWithStatusCode(_0x5dafbd,_0x50cd17){_0x50cd17=_0x50cd17||0xcc;return function(_0x2bb049){if(_0x2bb049){return _0x5dafbd[_0x14d0('0x28')](_0x50cd17);}return _0x5dafbd[_0x14d0('0x29')](_0x50cd17)['end']();};}function respondWithResult(_0x58919c,_0x58d949){_0x58d949=_0x58d949||0xc8;return function(_0x209858){if(_0x209858){return _0x58919c['status'](_0x58d949)[_0x14d0('0x2a')](_0x209858);}};}function respondWithFilteredResult(_0x435ca0,_0x21a7b9){return function(_0x53d5ff){if(_0x53d5ff){var _0x425401=typeof _0x21a7b9['offset']==='undefined'&&typeof _0x21a7b9[_0x14d0('0x2b')]===_0x14d0('0x2c');var _0xfb55ff=_0x53d5ff[_0x14d0('0x2d')];var _0x38c0aa=_0x425401?0x0:_0x21a7b9['offset'];var _0x261da4=_0x425401?_0x53d5ff[_0x14d0('0x2d')]:_0x21a7b9['offset']+_0x21a7b9[_0x14d0('0x2b')];var _0x573e42;if(_0x261da4>=_0xfb55ff){_0x261da4=_0xfb55ff;_0x573e42=0xc8;}else{_0x573e42=0xce;}_0x435ca0[_0x14d0('0x29')](_0x573e42);return _0x435ca0['set'](_0x14d0('0x2e'),_0x38c0aa+'-'+_0x261da4+'/'+_0xfb55ff)[_0x14d0('0x2a')](_0x53d5ff);}return null;};}function patchUpdates(_0x2cf22b){return function(_0x4cc867){try{jsonpatch[_0x14d0('0x2f')](_0x4cc867,_0x2cf22b,!![]);}catch(_0x58fe29){return BPromise[_0x14d0('0x30')](_0x58fe29);}return _0x4cc867[_0x14d0('0x31')]();};}function saveUpdates(_0xe17c90,_0x10f739){return function(_0xb54efe){if(_0xb54efe){return _0xb54efe[_0x14d0('0x32')](_0xe17c90)[_0x14d0('0x20')](function(_0x70883e){return _0x70883e;});}return null;};}function removeEntity(_0x493f92,_0x7d001f){return function(_0x39c0ae){if(_0x39c0ae){return _0x39c0ae[_0x14d0('0x33')]()['then'](function(){var _0x31b2ea=_0x39c0ae['get']({'plain':!![]});var _0x1eaf8f='FaxAccounts';return db['UserProfileResource']['destroy']({'where':{'type':_0x1eaf8f,'resourceId':_0x31b2ea['id']}})['then'](function(){return _0x39c0ae;});})[_0x14d0('0x20')](function(){_0x493f92[_0x14d0('0x29')](0xcc)[_0x14d0('0x34')]();});}};}function handleEntityNotFound(_0x38547c,_0x1fbe16){return function(_0x41fd23){if(!_0x41fd23){_0x38547c[_0x14d0('0x28')](0x194);}return _0x41fd23;};}function handleError(_0x2c6bf8,_0x3ae994){_0x3ae994=_0x3ae994||0x1f4;return function(_0x181b0b){logger[_0x14d0('0x24')](_0x181b0b[_0x14d0('0x35')]);if(_0x181b0b[_0x14d0('0x36')]){delete _0x181b0b[_0x14d0('0x36')];}_0x2c6bf8[_0x14d0('0x29')](_0x3ae994)[_0x14d0('0x37')](_0x181b0b);};}exports[_0x14d0('0x38')]=function(_0x41a60d,_0x4a063b){var _0x469fee={'include':[{'model':db['Pause'],'as':_0x14d0('0x39')}]},_0x1f179f={},_0x509b22={'count':0x0,'rows':[]};var _0x4c5abe=_[_0x14d0('0x3a')](db['FaxAccount'][_0x14d0('0x3b')],function(_0x16ca3a){return{'name':_0x16ca3a[_0x14d0('0x3c')],'type':_0x16ca3a['type'][_0x14d0('0x3d')]};});_0x1f179f[_0x14d0('0x3e')]=_[_0x14d0('0x3a')](_0x4c5abe,_0x14d0('0x36'));_0x1f179f[_0x14d0('0x3f')]=_[_0x14d0('0x40')](_0x41a60d['query']);_0x1f179f[_0x14d0('0x41')]=_['intersection'](_0x1f179f[_0x14d0('0x3e')],_0x1f179f[_0x14d0('0x3f')]);_0x469fee[_0x14d0('0x42')]=_[_0x14d0('0x43')](_0x1f179f[_0x14d0('0x3e')],qs[_0x14d0('0x44')](_0x41a60d[_0x14d0('0x3f')][_0x14d0('0x44')]));_0x469fee[_0x14d0('0x42')]=_0x469fee[_0x14d0('0x42')][_0x14d0('0x45')]?_0x469fee[_0x14d0('0x42')]:_0x1f179f[_0x14d0('0x3e')];if(!_0x41a60d[_0x14d0('0x3f')][_0x14d0('0x46')]('nolimit')){_0x469fee['limit']=qs[_0x14d0('0x2b')](_0x41a60d[_0x14d0('0x3f')][_0x14d0('0x2b')]);_0x469fee[_0x14d0('0x47')]=qs[_0x14d0('0x47')](_0x41a60d[_0x14d0('0x3f')][_0x14d0('0x47')]);}_0x469fee[_0x14d0('0x48')]=qs[_0x14d0('0x49')](_0x41a60d[_0x14d0('0x3f')][_0x14d0('0x49')]);_0x469fee[_0x14d0('0x4a')]=qs[_0x14d0('0x41')](_[_0x14d0('0x4b')](_0x41a60d['query'],_0x1f179f[_0x14d0('0x41')]),_0x4c5abe);if(_0x41a60d[_0x14d0('0x3f')][_0x14d0('0x4c')]){_0x469fee['where']=_[_0x14d0('0x4d')](_0x469fee[_0x14d0('0x4a')],{'$or':_[_0x14d0('0x3a')](_0x4c5abe,function(_0x33e2e6){if(_0x33e2e6['type']!==_0x14d0('0x4e')){var _0x5e4192={};_0x5e4192[_0x33e2e6[_0x14d0('0x36')]]={'$like':'%'+_0x41a60d[_0x14d0('0x3f')][_0x14d0('0x4c')]+'%'};return _0x5e4192;}})});}_0x469fee=_[_0x14d0('0x4d')]({},_0x469fee,_0x41a60d[_0x14d0('0x4f')]);var _0x4fe731={'where':_0x469fee[_0x14d0('0x4a')]};return db['FaxAccount']['count'](_0x4fe731)[_0x14d0('0x20')](function(_0x2e6ce6){_0x509b22[_0x14d0('0x2d')]=_0x2e6ce6;if(_0x41a60d[_0x14d0('0x3f')][_0x14d0('0x50')]){_0x469fee[_0x14d0('0x51')]=[{'all':!![]}];}return db[_0x14d0('0x52')][_0x14d0('0x53')](_0x469fee);})['then'](function(_0x5f12b7){_0x509b22[_0x14d0('0x54')]=_0x5f12b7;return _0x509b22;})[_0x14d0('0x20')](respondWithFilteredResult(_0x4a063b,_0x469fee))['catch'](handleError(_0x4a063b,null));};exports[_0x14d0('0x55')]=function(_0x306ba7,_0x554385){var _0x5d684f={'raw':![],'where':{'id':_0x306ba7['params']['id']},'include':[{'model':db[_0x14d0('0x56')],'as':_0x14d0('0x39')}]},_0x4d9f01={};_0x4d9f01[_0x14d0('0x3e')]=_['keys'](db[_0x14d0('0x52')][_0x14d0('0x3b')]);_0x4d9f01['query']=_[_0x14d0('0x40')](_0x306ba7[_0x14d0('0x3f')]);_0x4d9f01['filters']=_['intersection'](_0x4d9f01[_0x14d0('0x3e')],_0x4d9f01[_0x14d0('0x3f')]);_0x5d684f[_0x14d0('0x42')]=_['intersection'](_0x4d9f01[_0x14d0('0x3e')],qs[_0x14d0('0x44')](_0x306ba7['query'][_0x14d0('0x44')]));_0x5d684f[_0x14d0('0x42')]=_0x5d684f[_0x14d0('0x42')][_0x14d0('0x45')]?_0x5d684f['attributes']:_0x4d9f01['model'];if(_0x306ba7['query'][_0x14d0('0x50')]){_0x5d684f['include']=[{'all':!![]}];}_0x5d684f=_[_0x14d0('0x4d')]({},_0x5d684f,_0x306ba7[_0x14d0('0x4f')]);return db['FaxAccount'][_0x14d0('0x57')](_0x5d684f)[_0x14d0('0x20')](handleEntityNotFound(_0x554385,null))[_0x14d0('0x20')](respondWithResult(_0x554385,null))[_0x14d0('0x58')](handleError(_0x554385,null));};exports['create']=function(_0x4b31a4,_0x38afb6){return db[_0x14d0('0x52')][_0x14d0('0x59')](_0x4b31a4[_0x14d0('0x5a')],{})[_0x14d0('0x20')](function(_0x3c3f51){var _0x2c3e9f=_0x4b31a4['user'][_0x14d0('0x5b')]({'plain':!![]});if(!_0x2c3e9f)throw new Error(_0x14d0('0x5c'));if(_0x2c3e9f[_0x14d0('0x5d')]===_0x14d0('0x5e')){var _0x71b858=_0x3c3f51[_0x14d0('0x5b')]({'plain':!![]});var _0x5ae4b9='FaxAccounts';return db['UserProfileSection'][_0x14d0('0x57')]({'where':{'name':_0x5ae4b9,'userProfileId':_0x2c3e9f[_0x14d0('0x5f')]},'raw':!![]})[_0x14d0('0x20')](function(_0x4c9522){if(_0x4c9522&&_0x4c9522[_0x14d0('0x60')]===0x0){return db[_0x14d0('0x61')][_0x14d0('0x59')]({'name':_0x71b858[_0x14d0('0x36')],'resourceId':_0x71b858['id'],'type':_0x4c9522['name'],'sectionId':_0x4c9522['id']},{})['then'](function(){return _0x3c3f51;});}else{return _0x3c3f51;}})['catch'](function(_0x8fb82f){logger['error'](_0x14d0('0x62'),_0x8fb82f);throw _0x8fb82f;});}return _0x3c3f51;})[_0x14d0('0x20')](respondWithResult(_0x38afb6,0xc9))[_0x14d0('0x58')](handleError(_0x38afb6,null));};exports[_0x14d0('0x32')]=function(_0x3bd62a,_0x148b59){if(_0x3bd62a[_0x14d0('0x5a')]['id']){delete _0x3bd62a[_0x14d0('0x5a')]['id'];}return db[_0x14d0('0x52')][_0x14d0('0x57')]({'where':{'id':_0x3bd62a['params']['id']},'include':[{'model':db[_0x14d0('0x56')],'as':_0x14d0('0x39')}]})['then'](handleEntityNotFound(_0x148b59,null))['then'](saveUpdates(_0x3bd62a['body'],null))[_0x14d0('0x20')](respondWithResult(_0x148b59,null))['catch'](handleError(_0x148b59,null));};exports[_0x14d0('0x33')]=function(_0xc818e4,_0x402dd5){return db[_0x14d0('0x52')][_0x14d0('0x57')]({'where':{'id':_0xc818e4[_0x14d0('0x63')]['id']}})[_0x14d0('0x20')](handleEntityNotFound(_0x402dd5,null))[_0x14d0('0x20')](removeEntity(_0x402dd5,null))[_0x14d0('0x58')](handleError(_0x402dd5,null));};exports[_0x14d0('0x64')]=function(_0x581f1a,_0xe76e30){return db[_0x14d0('0x52')]['describe']()['then'](respondWithResult(_0xe76e30,null))['catch'](handleError(_0xe76e30,null));};exports[_0x14d0('0x65')]=function(_0x5d28fd,_0x3a399a,_0x49ff1b){if(_0x5d28fd[_0x14d0('0x5a')]['id']){delete _0x5d28fd[_0x14d0('0x5a')]['id'];}return db['FaxAccount'][_0x14d0('0x57')]({'where':{'id':_0x5d28fd['params']['id']}})[_0x14d0('0x20')](handleEntityNotFound(_0x3a399a,null))[_0x14d0('0x20')](function(_0x324f7f){if(_0x324f7f){_0x5d28fd[_0x14d0('0x5a')]['FaxAccountId']=_0x324f7f['id'];return db[_0x14d0('0x66')][_0x14d0('0x59')](_0x5d28fd['body']);}})[_0x14d0('0x20')](respondWithResult(_0x3a399a,null))[_0x14d0('0x58')](handleError(_0x3a399a,null));};exports[_0x14d0('0x67')]=function(_0x208d1b,_0x2be460,_0x180306){var _0x838ed5={'raw':![],'where':{}};var _0x57602a={};var _0x59ce43={'count':0x0,'rows':[]};return db[_0x14d0('0x52')][_0x14d0('0x68')]({'where':{'id':_0x208d1b['params']['id']}})['then'](handleEntityNotFound(_0x2be460,null))[_0x14d0('0x20')](function(_0x1b041a){if(_0x1b041a){_0x57602a[_0x14d0('0x3e')]=_[_0x14d0('0x40')](db[_0x14d0('0x66')][_0x14d0('0x3b')]);_0x57602a[_0x14d0('0x3f')]=_[_0x14d0('0x40')](_0x208d1b[_0x14d0('0x3f')]);_0x57602a['filters']=_[_0x14d0('0x43')](_0x57602a[_0x14d0('0x3e')],_0x57602a[_0x14d0('0x3f')]);_0x838ed5['attributes']=_[_0x14d0('0x43')](_0x57602a[_0x14d0('0x3e')],qs[_0x14d0('0x44')](_0x208d1b[_0x14d0('0x3f')][_0x14d0('0x44')]));_0x838ed5[_0x14d0('0x42')]=_0x838ed5[_0x14d0('0x42')][_0x14d0('0x45')]?_0x838ed5['attributes']:_0x57602a[_0x14d0('0x3e')];if(!_0x208d1b[_0x14d0('0x3f')][_0x14d0('0x46')](_0x14d0('0x69'))){_0x838ed5[_0x14d0('0x2b')]=qs[_0x14d0('0x2b')](_0x208d1b[_0x14d0('0x3f')][_0x14d0('0x2b')]);_0x838ed5[_0x14d0('0x47')]=qs[_0x14d0('0x47')](_0x208d1b['query']['offset']);}_0x838ed5['order']=qs['sort'](_0x208d1b['query'][_0x14d0('0x49')]);_0x838ed5[_0x14d0('0x4a')]=qs[_0x14d0('0x41')](_[_0x14d0('0x4b')](_0x208d1b['query'],_0x57602a[_0x14d0('0x41')]));_0x838ed5['where'][_0x14d0('0x6a')]=_0x1b041a['id'];if(_0x208d1b[_0x14d0('0x3f')][_0x14d0('0x4c')]){_0x838ed5[_0x14d0('0x4a')]=_[_0x14d0('0x4d')](_0x838ed5[_0x14d0('0x4a')],{'$or':_[_0x14d0('0x3a')](_0x838ed5[_0x14d0('0x42')],function(_0x4c3aad){var _0x4e9729={};_0x4e9729[_0x4c3aad]={'$like':'%'+_0x208d1b[_0x14d0('0x3f')]['filter']+'%'};return _0x4e9729;})});}_0x838ed5=_['merge']({},_0x838ed5,_0x208d1b[_0x14d0('0x4f')]);return db[_0x14d0('0x66')][_0x14d0('0x2d')]({'where':_0x838ed5[_0x14d0('0x4a')]})['then'](function(_0x4de1db){_0x59ce43[_0x14d0('0x2d')]=_0x4de1db;if(_0x208d1b[_0x14d0('0x3f')][_0x14d0('0x50')]){_0x838ed5[_0x14d0('0x51')]=[{'all':!![]}];}return db[_0x14d0('0x66')][_0x14d0('0x53')](_0x838ed5);})[_0x14d0('0x20')](function(_0x113cf4){_0x59ce43[_0x14d0('0x54')]=_0x113cf4;return _0x59ce43;});}})['then'](respondWithFilteredResult(_0x2be460,_0x838ed5))[_0x14d0('0x58')](handleError(_0x2be460,null));};exports[_0x14d0('0x6b')]=function(_0x2e07f1,_0x1b9187,_0x5d1371){return db['FaxAccount'][_0x14d0('0x57')]({'where':{'id':_0x2e07f1[_0x14d0('0x63')]['id']}})['then'](handleEntityNotFound(_0x1b9187,null))[_0x14d0('0x20')](function(_0x16b995){if(_0x16b995){return _0x16b995[_0x14d0('0x6b')](_0x2e07f1[_0x14d0('0x3f')]['ids']);}})[_0x14d0('0x20')](respondWithStatusCode(_0x1b9187,null))[_0x14d0('0x58')](handleError(_0x1b9187,null));};exports['addAnswer']=function(_0x5451a9,_0x415c95,_0x6252d2){if(_0x5451a9[_0x14d0('0x5a')]['id']){delete _0x5451a9[_0x14d0('0x5a')]['id'];}return db['FaxAccount'][_0x14d0('0x57')]({'where':{'id':_0x5451a9[_0x14d0('0x63')]['id']}})[_0x14d0('0x20')](handleEntityNotFound(_0x415c95,null))[_0x14d0('0x20')](function(_0x13c499){if(_0x13c499){_0x5451a9[_0x14d0('0x5a')][_0x14d0('0x6a')]=_0x13c499['id'];return db['CannedAnswer'][_0x14d0('0x59')](_0x5451a9[_0x14d0('0x5a')]);}})[_0x14d0('0x20')](respondWithResult(_0x415c95,null))[_0x14d0('0x58')](handleError(_0x415c95,null));};exports[_0x14d0('0x6c')]=function(_0x27d45b,_0x49b153,_0x3de209){var _0x113725={'raw':![],'where':{}};var _0x5db329={};var _0xbcfeb8={'count':0x0,'rows':[]};return db[_0x14d0('0x52')][_0x14d0('0x68')]({'where':{'id':_0x27d45b[_0x14d0('0x63')]['id']}})[_0x14d0('0x20')](handleEntityNotFound(_0x49b153,null))[_0x14d0('0x20')](function(_0x179ca9){if(_0x179ca9){_0x5db329[_0x14d0('0x3e')]=_[_0x14d0('0x40')](db[_0x14d0('0x6d')]['rawAttributes']);_0x5db329['query']=_[_0x14d0('0x40')](_0x27d45b[_0x14d0('0x3f')]);_0x5db329[_0x14d0('0x41')]=_[_0x14d0('0x43')](_0x5db329[_0x14d0('0x3e')],_0x5db329['query']);_0x113725['attributes']=_[_0x14d0('0x43')](_0x5db329[_0x14d0('0x3e')],qs['fields'](_0x27d45b[_0x14d0('0x3f')][_0x14d0('0x44')]));_0x113725[_0x14d0('0x42')]=_0x113725[_0x14d0('0x42')]['length']?_0x113725[_0x14d0('0x42')]:_0x5db329[_0x14d0('0x3e')];if(!_0x27d45b[_0x14d0('0x3f')][_0x14d0('0x46')](_0x14d0('0x69'))){_0x113725[_0x14d0('0x2b')]=qs[_0x14d0('0x2b')](_0x27d45b[_0x14d0('0x3f')]['limit']);_0x113725['offset']=qs[_0x14d0('0x47')](_0x27d45b[_0x14d0('0x3f')][_0x14d0('0x47')]);}_0x113725[_0x14d0('0x48')]=qs[_0x14d0('0x49')](_0x27d45b[_0x14d0('0x3f')]['sort']);_0x113725['where']=qs['filters'](_[_0x14d0('0x4b')](_0x27d45b[_0x14d0('0x3f')],_0x5db329['filters']));_0x113725[_0x14d0('0x4a')][_0x14d0('0x6a')]=_0x179ca9['id'];if(_0x27d45b[_0x14d0('0x3f')]['filter']){_0x113725[_0x14d0('0x4a')]=_[_0x14d0('0x4d')](_0x113725['where'],{'$or':_['map'](_0x113725[_0x14d0('0x42')],function(_0x506684){var _0x43fe64={};_0x43fe64[_0x506684]={'$like':'%'+_0x27d45b[_0x14d0('0x3f')][_0x14d0('0x4c')]+'%'};return _0x43fe64;})});}_0x113725=_[_0x14d0('0x4d')]({},_0x113725,_0x27d45b['options']);return db[_0x14d0('0x6d')][_0x14d0('0x2d')]({'where':_0x113725['where']})[_0x14d0('0x20')](function(_0x596787){_0xbcfeb8[_0x14d0('0x2d')]=_0x596787;if(_0x27d45b[_0x14d0('0x3f')][_0x14d0('0x50')]){_0x113725[_0x14d0('0x51')]=[{'all':!![]}];}return db[_0x14d0('0x6d')]['findAll'](_0x113725);})[_0x14d0('0x20')](function(_0x3c1727){_0xbcfeb8[_0x14d0('0x54')]=_0x3c1727;return _0xbcfeb8;});}})[_0x14d0('0x20')](respondWithFilteredResult(_0x49b153,_0x113725))[_0x14d0('0x58')](handleError(_0x49b153,null));};exports[_0x14d0('0x6e')]=function(_0x2d1b26,_0x43bcf0,_0x4e1604){return db['FaxAccount']['find']({'where':{'id':_0x2d1b26[_0x14d0('0x63')]['id']}})[_0x14d0('0x20')](handleEntityNotFound(_0x43bcf0,null))[_0x14d0('0x20')](function(_0x236163){if(_0x236163){return _0x236163[_0x14d0('0x6e')](_0x2d1b26[_0x14d0('0x3f')][_0x14d0('0x6f')]);}})['then'](respondWithStatusCode(_0x43bcf0,null))['catch'](handleError(_0x43bcf0,null));};exports['addInteraction']=function(_0x479802,_0x30190a,_0x2663af){return db[_0x14d0('0x70')][_0x14d0('0x57')]({'where':{'id':_0x479802[_0x14d0('0x63')]['id']}})[_0x14d0('0x20')](handleEntityNotFound(_0x30190a,null))[_0x14d0('0x20')](function(_0x277396){if(_0x277396){return _0x277396[_0x14d0('0x71')](_0x479802[_0x14d0('0x5a')][_0x14d0('0x6f')],_[_0x14d0('0x72')](_0x479802['body'],['ids','id'])||{});}})[_0x14d0('0x20')](respondWithResult(_0x30190a,null))[_0x14d0('0x58')](handleError(_0x30190a,null));};exports[_0x14d0('0x73')]=function(_0x2a56ec,_0x235fea,_0x52ee6f){var _0x46d7ac={'raw':![],'where':{}};var _0x2245d5={};var _0x4ff608={'count':0x0,'rows':[]};return db[_0x14d0('0x52')][_0x14d0('0x68')]({'where':{'id':_0x2a56ec[_0x14d0('0x63')]['id']}})[_0x14d0('0x20')](handleEntityNotFound(_0x235fea,null))[_0x14d0('0x20')](function(_0x59b87a){if(_0x59b87a){_0x2245d5['model']=_['keys'](db[_0x14d0('0x70')]['rawAttributes']);_0x2245d5[_0x14d0('0x3f')]=_[_0x14d0('0x40')](_0x2a56ec['query']);_0x2245d5[_0x14d0('0x41')]=_['intersection'](_0x2245d5[_0x14d0('0x3e')],_0x2245d5['query']);_0x46d7ac['attributes']=_[_0x14d0('0x43')](_0x2245d5[_0x14d0('0x3e')],qs[_0x14d0('0x44')](_0x2a56ec[_0x14d0('0x3f')][_0x14d0('0x44')]));_0x46d7ac[_0x14d0('0x42')]=_0x46d7ac[_0x14d0('0x42')][_0x14d0('0x45')]?_0x46d7ac['attributes']:_0x2245d5[_0x14d0('0x3e')];if(!_0x2a56ec[_0x14d0('0x3f')][_0x14d0('0x46')](_0x14d0('0x69'))){_0x46d7ac[_0x14d0('0x2b')]=qs['limit'](_0x2a56ec[_0x14d0('0x3f')][_0x14d0('0x2b')]);_0x46d7ac['offset']=qs[_0x14d0('0x47')](_0x2a56ec[_0x14d0('0x3f')][_0x14d0('0x47')]);}_0x46d7ac[_0x14d0('0x48')]=qs[_0x14d0('0x49')](_0x2a56ec[_0x14d0('0x3f')][_0x14d0('0x49')]);_0x46d7ac[_0x14d0('0x4a')]=qs[_0x14d0('0x41')](_['pick'](_0x2a56ec['query'],_0x2245d5[_0x14d0('0x41')]));_0x46d7ac[_0x14d0('0x4a')][_0x14d0('0x6a')]=_0x59b87a['id'];if(_0x2a56ec['query'][_0x14d0('0x4c')]){_0x46d7ac[_0x14d0('0x4a')]=_[_0x14d0('0x4d')](_0x46d7ac[_0x14d0('0x4a')],{'$or':_[_0x14d0('0x3a')](_0x46d7ac[_0x14d0('0x42')],function(_0x5bbbca){var _0x3fbd29={};_0x3fbd29[_0x5bbbca]={'$like':'%'+_0x2a56ec['query'][_0x14d0('0x4c')]+'%'};return _0x3fbd29;})});}_0x46d7ac=_['merge']({},_0x46d7ac,_0x2a56ec['options']);return db['FaxInteraction'][_0x14d0('0x2d')]({'where':_0x46d7ac[_0x14d0('0x4a')]})[_0x14d0('0x20')](function(_0x3c804d){_0x4ff608[_0x14d0('0x2d')]=_0x3c804d;if(_0x2a56ec[_0x14d0('0x3f')][_0x14d0('0x50')]){_0x46d7ac[_0x14d0('0x51')]=[{'model':db[_0x14d0('0x74')],'as':_0x14d0('0x75'),'required':![]},{'model':db[_0x14d0('0x76')],'as':'Owner','attributes':[_0x14d0('0x36'),_0x14d0('0x77'),_0x14d0('0x78')],'required':![]},{'model':db[_0x14d0('0x79')],'as':_0x14d0('0x7a'),'attributes':['id',_0x14d0('0x36'),_0x14d0('0x7b')],'where':_0x2a56ec['query']['tag']?{'id':_0x2a56ec[_0x14d0('0x3f')][_0x14d0('0x7c')]}:undefined,'required':_0x2a56ec['query'][_0x14d0('0x7c')]?!![]:![]}];}return db[_0x14d0('0x70')][_0x14d0('0x53')](_0x46d7ac);})[_0x14d0('0x20')](function(_0x2c0a56){_0x4ff608[_0x14d0('0x54')]=_0x2c0a56;return _0x4ff608;});}})[_0x14d0('0x20')](respondWithFilteredResult(_0x235fea,_0x46d7ac))[_0x14d0('0x58')](handleError(_0x235fea,null));};exports[_0x14d0('0x7d')]=function(_0x2cff5a,_0x3a848e){var _0x117b82=_0x2cff5a['params']['id'];var _0x28e1d1=_0x2cff5a[_0x14d0('0x5a')];var _0x1151a8=0xc8;var _0x57db5c=null;return db[_0x14d0('0x7e')]['transaction']({'isolationLevel':db['sequelize'][_0x14d0('0x7f')][_0x14d0('0x80')][_0x14d0('0x81')]},function(_0x4c51fc){return db[_0x14d0('0x52')]['findOne']({'where':{'id':_0x117b82},'transaction':_0x4c51fc})['then'](function(_0x1e70c4){if(_0x1e70c4){return db[_0x14d0('0x82')][_0x14d0('0x33')]({'where':{'FaxAccountId':_0x117b82},'transaction':_0x4c51fc})[_0x14d0('0x20')](function(){var _0x54031d=_['map'](_0x28e1d1,function(_0x3a6aca){_0x3a6aca[_0x14d0('0x6a')]=_0x117b82;return _0x3a6aca;});return db[_0x14d0('0x82')][_0x14d0('0x83')](_0x54031d,{'transaction':_0x4c51fc});});}else{_0x1151a8=0x194;_0x57db5c=[];}});})['then'](function(){if(_0x1151a8!==0x194){return db[_0x14d0('0x82')][_0x14d0('0x84')]({'where':{'FaxAccountId':_0x117b82},'order':_0x14d0('0x85')})[_0x14d0('0x20')](function(_0x321a93){_0x57db5c=_0x321a93;});}})['catch'](function(_0x2a4e40){_0x1151a8=0x1f4;logger[_0x14d0('0x24')](_0x2a4e40[_0x14d0('0x35')]);if(_0x2a4e40['name']){delete _0x2a4e40[_0x14d0('0x36')];}_0x57db5c=_0x2a4e40;})[_0x14d0('0x86')](function(){if(_0x57db5c===null){_0x3a848e['sendStatus'](_0x1151a8);}else{if(_0x1151a8===0x1f4){_0x3a848e[_0x14d0('0x29')](_0x1151a8)[_0x14d0('0x37')](_0x57db5c);}else{_0x3a848e[_0x14d0('0x29')](_0x1151a8)[_0x14d0('0x2a')](_0x57db5c);}}});};exports[_0x14d0('0x87')]=function(_0x3e0d7a,_0xcfd75e,_0x292451){var _0xe187a0={};var _0xbe2042={};var _0x2bb3e4;var _0x4d68fe;return db['FaxAccount'][_0x14d0('0x68')]({'where':{'id':_0x3e0d7a['params']['id']}})['then'](handleEntityNotFound(_0xcfd75e,null))[_0x14d0('0x20')](function(_0xa2567c){if(_0xa2567c){_0x2bb3e4=_0xa2567c;_0xbe2042['model']=_[_0x14d0('0x40')](db[_0x14d0('0x82')][_0x14d0('0x3b')]);_0xbe2042[_0x14d0('0x3f')]=_[_0x14d0('0x40')](_0x3e0d7a[_0x14d0('0x3f')]);_0xbe2042[_0x14d0('0x41')]=_[_0x14d0('0x43')](_0xbe2042[_0x14d0('0x3e')],_0xbe2042['query']);_0xe187a0['attributes']=_[_0x14d0('0x43')](_0xbe2042[_0x14d0('0x3e')],qs[_0x14d0('0x44')](_0x3e0d7a[_0x14d0('0x3f')]['fields']));_0xe187a0[_0x14d0('0x42')]=_0xe187a0[_0x14d0('0x42')][_0x14d0('0x45')]?_0xe187a0[_0x14d0('0x42')]:_0xbe2042[_0x14d0('0x3e')];_0xe187a0[_0x14d0('0x48')]=qs[_0x14d0('0x49')](_0x3e0d7a['query']['sort']);_0xe187a0['where']=qs[_0x14d0('0x41')](_[_0x14d0('0x4b')](_0x3e0d7a['query'],_0xbe2042[_0x14d0('0x41')]));if(_0x3e0d7a[_0x14d0('0x3f')][_0x14d0('0x4c')]){_0xe187a0[_0x14d0('0x4a')]=_[_0x14d0('0x4d')](_0xe187a0['where'],{'$or':_[_0x14d0('0x3a')](_0xe187a0[_0x14d0('0x42')],function(_0x5baab8){var _0x336f39={};_0x336f39[_0x5baab8]={'$like':'%'+_0x3e0d7a['query'][_0x14d0('0x4c')]+'%'};return _0x336f39;})});}_0xe187a0=_[_0x14d0('0x4d')]({},_0xe187a0,_0x3e0d7a[_0x14d0('0x4f')]);return _0x2bb3e4[_0x14d0('0x87')](_0xe187a0);}})[_0x14d0('0x20')](function(_0x42e896){if(_0x42e896){_0x4d68fe=_0x42e896['length'];if(!_0x3e0d7a[_0x14d0('0x3f')][_0x14d0('0x46')]('nolimit')){_0xe187a0[_0x14d0('0x2b')]=qs[_0x14d0('0x2b')](_0x3e0d7a[_0x14d0('0x3f')][_0x14d0('0x2b')]);_0xe187a0[_0x14d0('0x47')]=qs['offset'](_0x3e0d7a['query'][_0x14d0('0x47')]);}return _0x2bb3e4[_0x14d0('0x87')](_0xe187a0);}})[_0x14d0('0x20')](function(_0x40ea82){if(_0x40ea82){return _0x40ea82?{'count':_0x4d68fe,'rows':_0x40ea82}:null;}})['then'](respondWithResult(_0xcfd75e,null))[_0x14d0('0x58')](handleError(_0xcfd75e,null));};function Extension(_0x5919fc,_0x583ba0,_0x49c0b6,_0x5c51e3){this['context']=_0x14d0('0x88');this[_0x14d0('0x89')]=_0x5919fc[_0x14d0('0x8a')];this[_0x14d0('0x8b')]=_0x5c51e3;this['type']='system';this[_0x14d0('0x8c')]=_0x14d0('0x8d');this[_0x14d0('0x6a')]=_0x5919fc['id'];this[_0x14d0('0x85')]=_0x583ba0;this[_0x14d0('0x8e')]=_0x49c0b6;}function createExtensionsReciveFax(_0x59aeba){var _0x23c3c6=0x1;var _0x195339=[];_0x195339['push'](new Extension(_0x59aeba,_0x23c3c6,'',_0x14d0('0x8f')));_0x23c3c6+=0x1;_0x195339[_0x14d0('0x90')](new Extension(_0x59aeba,_0x23c3c6,_0x14d0('0x91'),_0x14d0('0x92')));_0x23c3c6+=0x1;for(var _0x53d3b0 in _0x59aeba){if(_0x59aeba[_0x14d0('0x46')](_0x53d3b0)&&(_0x53d3b0===_0x14d0('0x93')||_0x53d3b0===_0x14d0('0x8a')||_0x53d3b0===_0x14d0('0x94')||_0x53d3b0===_0x14d0('0x95')||_0x53d3b0===_0x14d0('0x96')||_0x53d3b0===_0x14d0('0x97')||_0x53d3b0===_0x14d0('0x98')||_0x53d3b0==='modem'||_0x53d3b0===_0x14d0('0x99'))){_0x195339['push'](new Extension(_0x59aeba,_0x23c3c6,_0x14d0('0x9a')+_0x53d3b0+')='+_0x59aeba[_0x53d3b0],'Set'));_0x23c3c6+=0x1;}}_0x195339[_0x14d0('0x90')](new Extension(_0x59aeba,_0x23c3c6,'6',_0x14d0('0x9b')));_0x23c3c6+=0x1;_0x195339['push'](new Extension(_0x59aeba,_0x23c3c6,_0x14d0('0x9c'),_0x14d0('0x9d')));_0x23c3c6=0x0;return _0x195339;}exports[_0x14d0('0x9e')]=function(_0x555ef1,_0x1c27c0,_0x5e8395){var _0x44e673;return db['sequelize']['transaction'](function(_0x435fb4){return db[_0x14d0('0x52')]['create'](_0x555ef1[_0x14d0('0x5a')],{'transaction':_0x435fb4})[_0x14d0('0x20')](function(_0xadf728){_0x44e673=_0xadf728[_0x14d0('0x5b')]({'plain':!![]});return db[_0x14d0('0x9f')][_0x14d0('0x83')](createExtensionsReciveFax(_0x44e673),{'transaction':_0x435fb4});});})[_0x14d0('0x20')](function(){return _0x44e673;})[_0x14d0('0x20')](respondWithResult(_0x1c27c0,null))['catch'](handleError(_0x1c27c0,null));};exports[_0x14d0('0xa0')]=function(_0x54b3ac,_0x1d18ca,_0xd8ebe7){var _0x31d129;return db[_0x14d0('0x7e')][_0x14d0('0xa1')](function(_0x442c68){return db['FaxAccount']['update'](_0x54b3ac['body'],{'where':{'id':_0x54b3ac[_0x14d0('0x5a')]['id']},'transaction':_0x442c68})[_0x14d0('0x20')](function(_0x5a2c84){return db[_0x14d0('0x9f')][_0x14d0('0x33')]({'where':{'FaxAccountId':_0x54b3ac[_0x14d0('0x5a')]['id']},'transaction':_0x442c68})[_0x14d0('0x20')](function(_0x1f4a80){return db[_0x14d0('0x9f')][_0x14d0('0x83')](createExtensionsReciveFax(_[_0x14d0('0x72')](_0x54b3ac[_0x14d0('0x5a')],[_0x14d0('0xa2'),_0x14d0('0x3d'),_0x14d0('0xa3'),_0x14d0('0xa4'),_0x14d0('0xa5'),_0x14d0('0xa6')])),{'transaction':_0x442c68});});});})[_0x14d0('0x20')](function(){return db[_0x14d0('0x52')][_0x14d0('0xa7')](_0x54b3ac[_0x14d0('0x5a')]['id']);})[_0x14d0('0x20')](respondWithResult(_0x1d18ca,null))['catch'](handleError(_0x1d18ca,null));};exports['getMessages']=function(_0x1e2826,_0xf30955,_0x221078){var _0x191989={'raw':!![],'where':{}};var _0x307b8e={};var _0x5261a9={'count':0x0,'rows':[]};return db[_0x14d0('0x52')][_0x14d0('0x68')]({'where':{'id':_0x1e2826[_0x14d0('0x63')]['id']}})[_0x14d0('0x20')](handleEntityNotFound(_0xf30955,null))[_0x14d0('0x20')](function(_0xb5c6a4){if(_0xb5c6a4){_0x307b8e[_0x14d0('0x3e')]=_[_0x14d0('0x40')](db[_0x14d0('0xa8')][_0x14d0('0x3b')]);_0x307b8e[_0x14d0('0x3f')]=_[_0x14d0('0x40')](_0x1e2826['query']);_0x307b8e['filters']=_[_0x14d0('0x43')](_0x307b8e['model'],_0x307b8e[_0x14d0('0x3f')]);_0x191989[_0x14d0('0x42')]=_[_0x14d0('0x43')](_0x307b8e[_0x14d0('0x3e')],qs[_0x14d0('0x44')](_0x1e2826[_0x14d0('0x3f')][_0x14d0('0x44')]));_0x191989[_0x14d0('0x42')]=_0x191989[_0x14d0('0x42')]['length']?_0x191989['attributes']:_0x307b8e[_0x14d0('0x3e')];if(!_0x1e2826[_0x14d0('0x3f')][_0x14d0('0x46')](_0x14d0('0x69'))){_0x191989['limit']=qs['limit'](_0x1e2826[_0x14d0('0x3f')]['limit']);_0x191989[_0x14d0('0x47')]=qs[_0x14d0('0x47')](_0x1e2826['query']['offset']);}_0x191989[_0x14d0('0x48')]=qs[_0x14d0('0x49')](_0x1e2826[_0x14d0('0x3f')][_0x14d0('0x49')]);_0x191989[_0x14d0('0x4a')]=qs[_0x14d0('0x41')](_[_0x14d0('0x4b')](_0x1e2826['query'],_0x307b8e[_0x14d0('0x41')]));_0x191989[_0x14d0('0x4a')][_0x14d0('0x6a')]=_0xb5c6a4['id'];if(_0x1e2826[_0x14d0('0x3f')][_0x14d0('0x4c')]){_0x191989[_0x14d0('0x4a')]=_[_0x14d0('0x4d')](_0x191989['where'],{'$or':_[_0x14d0('0x3a')](_0x191989[_0x14d0('0x42')],function(_0x5b6871){var _0x292ba2={};_0x292ba2[_0x5b6871]={'$like':'%'+_0x1e2826[_0x14d0('0x3f')][_0x14d0('0x4c')]+'%'};return _0x292ba2;})});}if(_0x1e2826[_0x14d0('0x3f')][_0x14d0('0xa9')]){var _0x5b1809=_0x1e2826['query']['$gte'][_0x14d0('0xaa')](',');var _0x107992={};_0x107992[_0x5b1809[0x0]]={'$gte':moment(_0x5b1809[0x1])[_0x14d0('0xab')](_0x14d0('0xac'))};_0x191989[_0x14d0('0x4a')]=_[_0x14d0('0x4d')](_0x191989[_0x14d0('0x4a')],_0x107992);}_0x191989=_[_0x14d0('0x4d')]({},_0x191989,_0x1e2826['options']);return db[_0x14d0('0xa8')][_0x14d0('0x2d')]({'where':_0x191989[_0x14d0('0x4a')]})['then'](function(_0x375004){_0x5261a9[_0x14d0('0x2d')]=_0x375004;if(_0x1e2826[_0x14d0('0x3f')][_0x14d0('0x50')]){_0x191989[_0x14d0('0x51')]=[{'all':!![]}];}return db['FaxMessage'][_0x14d0('0x53')](_0x191989);})[_0x14d0('0x20')](function(_0x4dad95){_0x5261a9[_0x14d0('0x54')]=_0x4dad95;return _0x5261a9;});}})[_0x14d0('0x20')](respondWithFilteredResult(_0xf30955,_0x191989))['catch'](handleError(_0xf30955,null));};exports[_0x14d0('0x37')]=function(_0x18e255,_0x485870,_0x140255){var _0x406cd7,_0x54aeb7={},_0x3d03fb;if(_0x18e255['body']['to']){_0x3d03fb=_0x18e255['body']['to'][0x0];}return db[_0x14d0('0x52')][_0x14d0('0x57')]({'where':{'id':_0x18e255['params']['id']},'include':[{'model':db[_0x14d0('0xad')],'as':_0x14d0('0xae'),'include':[{'model':db[_0x14d0('0x74')],'as':_0x14d0('0xaf'),'where':{'fax':_0x3d03fb},'limit':0x1,'order':[[_0x14d0('0xa4'),_0x14d0('0xb0')]]}]}]})[_0x14d0('0x20')](handleEntityNotFound(_0x485870,null))[_0x14d0('0x20')](function(_0x598b3d){_0x406cd7=_0x598b3d;if(_0x18e255[_0x14d0('0x5a')][_0x14d0('0xb1')]&&_0x18e255[_0x14d0('0x5a')][_0x14d0('0xb1')][_0x14d0('0x45')]){for(var _0xd77d3f=0x0;_0xd77d3f<_0x18e255['body'][_0x14d0('0xb1')][_0x14d0('0x45')];_0xd77d3f+=0x1){_0x18e255['body'][_0x14d0('0xb1')][_0xd77d3f]={'filename':_0x18e255['body']['attachments'][_0xd77d3f][_0x14d0('0x36')],'id':_0x18e255[_0x14d0('0x5a')][_0x14d0('0xb1')][_0xd77d3f]['id'],'path':path[_0x14d0('0xb2')](config[_0x14d0('0xb3')],_0x14d0('0xb4'),_0x18e255['body'][_0x14d0('0xb1')][_0xd77d3f][_0x14d0('0xb5')])};}}return respondWithRpcPromise('CheckAfterSend','CheckAfterSend',{'FaxAccountId':_[_0x14d0('0xb6')](_0x18e255[_0x14d0('0x63')]['id'])?undefined:_0x18e255[_0x14d0('0x63')]['id'],'path':_[_0x14d0('0xb6')](_0x18e255[_0x14d0('0x5a')]['attachments'][0x0][_0x14d0('0x7')])?undefined:_0x18e255[_0x14d0('0x5a')][_0x14d0('0xb1')][0x0][_0x14d0('0x7')],'fax':_[_0x14d0('0xb6')](_0x18e255[_0x14d0('0x5a')]['to'][0x0])?undefined:_0x18e255[_0x14d0('0x5a')]['to'][0x0]},client9002);})[_0x14d0('0x20')](function(){if(_0x406cd7){if(_[_0x14d0('0xb6')](_0x18e255['body'][_0x14d0('0xb7')])){_0x18e255['body'][_0x14d0('0xb7')]=util[_0x14d0('0xab')](_0x14d0('0xb8'),_0x406cd7[_0x14d0('0x36')],_0x406cd7[_0x14d0('0xb9')]);}if(_0x406cd7['List']){if(_0x406cd7[_0x14d0('0xae')][_0x14d0('0xaf')][_0x14d0('0x45')]){return _0x406cd7[_0x14d0('0xae')][_0x14d0('0xaf')][0x0];}else{return db[_0x14d0('0x74')][_0x14d0('0x59')](_[_0x14d0('0x19')](_0x18e255[_0x14d0('0x5a')],{'firstName':_0x18e255[_0x14d0('0x5a')]['to'][0x0],'phone':_0x18e255[_0x14d0('0x5a')]['to'][0x0],'fax':_0x18e255[_0x14d0('0x5a')]['to'][0x0],'ListId':_0x406cd7['ListId']}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error('Send\x20Fax\x20failed');}})[_0x14d0('0x20')](function(_0x50cfe7){if(_0x50cfe7){return db[_0x14d0('0x70')][_0x14d0('0x57')]({'where':{'ContactId':_0x50cfe7['id'],'closed':![],'FaxAccountId':_0x406cd7['id']}})['then'](function(_0x3446b7){if(_0x3446b7){return[_0x3446b7,![]];}return db['FaxInteraction'][_0x14d0('0x59')]({'UserId':_0x18e255['user']['id'],'ContactId':_0x50cfe7['id'],'FaxAccountId':_0x406cd7['id'],'fax':_0x18e255[_0x14d0('0x5a')]['to'][0x0],'firstMsgDirection':_0x14d0('0xba'),'Messages':[_['merge'](_0x18e255[_0x14d0('0x5a')],{'read':![],'body':_0x18e255[_0x14d0('0x5a')][_0x14d0('0xb1')][0x0][_0x14d0('0xbb')],'FaxAccountId':_0x406cd7['id'],'UserId':_0x18e255[_0x14d0('0x5e')]['id'],'ContactId':_0x50cfe7['id'],'AttachmentId':_0x18e255[_0x14d0('0x5a')][_0x14d0('0xb1')][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':'Messages'}]})[_0x14d0('0x20')](function(_0x1b6312){return[_0x1b6312,!![]];});});}else{throw new Error(_0x14d0('0xbc'));}})[_0x14d0('0xbd')](function(_0x798f35,_0x5235a8){if(_0x5235a8){return _0x798f35;}return db['FaxMessage'][_0x14d0('0x59')]({'direction':_0x14d0('0xba'),'read':![],'body':_0x18e255[_0x14d0('0x5a')]['attachments'][0x0][_0x14d0('0xbb')],'FaxAccountId':_0x406cd7['id'],'FaxInteractionId':_0x798f35['id'],'UserId':_0x18e255[_0x14d0('0x5e')]['id'],'ContactId':_0x798f35[_0x14d0('0xbe')],'AttachmentId':_0x18e255[_0x14d0('0x5a')][_0x14d0('0xb1')][0x0]['id']})[_0x14d0('0x20')](function(_0x135d2a){_0x798f35[_0x14d0('0xbf')][_0x14d0('0xc0')]=[];_0x798f35[_0x14d0('0xbf')]['Messages']['push'](_0x135d2a[_0x14d0('0xbf')]);return _0x798f35;});})[_0x14d0('0x20')](function(_0x35aa78){respondWithRpcPromise('SendFax',_0x14d0('0xc1'),{'FaxAccountId':_[_0x14d0('0xb6')](_0x18e255[_0x14d0('0x63')]['id'])?undefined:_0x18e255[_0x14d0('0x63')]['id'],'path':_[_0x14d0('0xb6')](_0x18e255[_0x14d0('0x5a')]['attachments'][0x0][_0x14d0('0x7')])?undefined:_0x18e255['body'][_0x14d0('0xb1')][0x0][_0x14d0('0x7')],'fax':_[_0x14d0('0xb6')](_0x18e255[_0x14d0('0x5a')]['to'][0x0])?undefined:_0x18e255[_0x14d0('0x5a')]['to'][0x0],'AttachmentId':_0x18e255[_0x14d0('0x5a')][_0x14d0('0xb1')][0x0]['id']},client9002)[_0x14d0('0x20')](function(_0x5a305f){logger['info'](_0x14d0('0xc2'),_0x5a305f);})[_0x14d0('0x58')](function(_0x5586e7){logger['info'](_0x14d0('0xc2'),_0x5586e7);});return _0x35aa78;})['then'](respondWithResult(_0x485870,null))[_0x14d0('0x58')](handleError(_0x485870,null));};exports['addAgents']=function(_0x4e3961,_0x3ee58a,_0xbaee9f){return db['FaxAccount'][_0x14d0('0x57')]({'where':{'id':_0x4e3961['params']['id']}})[_0x14d0('0x20')](handleEntityNotFound(_0x3ee58a,null))[_0x14d0('0x20')](function(_0x1a4c46){if(_0x1a4c46){return _0x1a4c46['addAgents'](_0x4e3961[_0x14d0('0x5a')][_0x14d0('0x6f')],_['omit'](_0x4e3961[_0x14d0('0x5a')],[_0x14d0('0x6f'),'id'])||{})['spread'](function(_0x3edbd2){for(var _0x3b4c1a=0x0;_0x3b4c1a<_0x4e3961[_0x14d0('0x5a')]['ids'][_0x14d0('0x45')];_0x3b4c1a+=0x1){socket[_0x14d0('0xc3')](_0x14d0('0xc4'),{'UserId':Number(_0x4e3961[_0x14d0('0x5a')][_0x14d0('0x6f')][_0x3b4c1a]),'FaxAccountId':Number(_0x4e3961[_0x14d0('0x63')]['id'])});}return _0x3edbd2;});}})[_0x14d0('0x20')](respondWithResult(_0x3ee58a,null))[_0x14d0('0x58')](handleError(_0x3ee58a,null));};exports[_0x14d0('0xc5')]=function(_0x2dd67d,_0x1c83fa,_0x54a20d){return db[_0x14d0('0x52')]['find']({'where':{'id':_0x2dd67d[_0x14d0('0x63')]['id']}})[_0x14d0('0x20')](handleEntityNotFound(_0x1c83fa,null))[_0x14d0('0x20')](function(_0x4ac2bd){if(_0x4ac2bd){return _0x4ac2bd['removeAgents'](_0x2dd67d[_0x14d0('0x3f')][_0x14d0('0x6f')])[_0x14d0('0x20')](function(){if(_[_0x14d0('0xc6')](_0x2dd67d[_0x14d0('0x3f')][_0x14d0('0x6f')])){for(var _0x36725c=0x0;_0x36725c<_0x2dd67d[_0x14d0('0x3f')]['ids'][_0x14d0('0x45')];_0x36725c+=0x1){socket['emit'](_0x14d0('0xc7'),{'UserId':Number(_0x2dd67d[_0x14d0('0x3f')][_0x14d0('0x6f')][_0x36725c]),'FaxAccountId':Number(_0x2dd67d[_0x14d0('0x63')]['id'])});}}else{socket['emit'](_0x14d0('0xc7'),{'UserId':Number(_0x2dd67d[_0x14d0('0x3f')]['ids']),'FaxAccountId':Number(_0x2dd67d[_0x14d0('0x63')]['id'])});}});}})[_0x14d0('0x20')](respondWithStatusCode(_0x1c83fa,null))[_0x14d0('0x58')](handleError(_0x1c83fa,null));};exports[_0x14d0('0xc8')]=function(_0x197bb2,_0x25951d,_0x423818){var _0x1270dd={};var _0x4de661={};var _0x3f843c;var _0x4af78e;return db[_0x14d0('0x52')][_0x14d0('0x68')]({'where':{'id':_0x197bb2['params']['id']}})[_0x14d0('0x20')](handleEntityNotFound(_0x25951d,null))[_0x14d0('0x20')](function(_0x409404){if(_0x409404){_0x3f843c=_0x409404;_0x4de661[_0x14d0('0x3e')]=_['keys'](db['User'][_0x14d0('0x3b')]);_0x4de661[_0x14d0('0x3f')]=_[_0x14d0('0x40')](_0x197bb2[_0x14d0('0x3f')]);_0x4de661[_0x14d0('0x41')]=_['intersection'](_0x4de661['model'],_0x4de661[_0x14d0('0x3f')]);_0x1270dd[_0x14d0('0x42')]=_[_0x14d0('0x43')](_0x4de661['model'],qs['fields'](_0x197bb2[_0x14d0('0x3f')][_0x14d0('0x44')]));_0x1270dd['attributes']=_0x1270dd[_0x14d0('0x42')][_0x14d0('0x45')]?_0x1270dd[_0x14d0('0x42')]:_0x4de661['model'];_0x1270dd['order']=qs[_0x14d0('0x49')](_0x197bb2[_0x14d0('0x3f')][_0x14d0('0x49')]);_0x1270dd[_0x14d0('0x4a')]=qs['filters'](_['pick'](_0x197bb2[_0x14d0('0x3f')],_0x4de661[_0x14d0('0x41')]));if(_0x197bb2[_0x14d0('0x3f')]['filter']){_0x1270dd[_0x14d0('0x4a')]=_[_0x14d0('0x4d')](_0x1270dd[_0x14d0('0x4a')],{'$or':_[_0x14d0('0x3a')](_0x1270dd[_0x14d0('0x42')],function(_0x58daa8){var _0x22bc55={};_0x22bc55[_0x58daa8]={'$like':'%'+_0x197bb2[_0x14d0('0x3f')]['filter']+'%'};return _0x22bc55;})});}_0x1270dd=_['merge']({},_0x1270dd,_0x197bb2['options']);return _0x3f843c['getAgents'](_0x1270dd);}})[_0x14d0('0x20')](function(_0x3c1377){if(_0x3c1377){_0x4af78e=_0x3c1377[_0x14d0('0x45')];if(!_0x197bb2[_0x14d0('0x3f')][_0x14d0('0x46')](_0x14d0('0x69'))){_0x1270dd[_0x14d0('0x2b')]=qs[_0x14d0('0x2b')](_0x197bb2[_0x14d0('0x3f')]['limit']);_0x1270dd[_0x14d0('0x47')]=qs['offset'](_0x197bb2[_0x14d0('0x3f')][_0x14d0('0x47')]);}return _0x3f843c[_0x14d0('0xc8')](_0x1270dd);}})[_0x14d0('0x20')](function(_0x5aec1a){if(_0x5aec1a){return _0x5aec1a?{'count':_0x4af78e,'rows':_0x5aec1a}:null;}})['then'](respondWithResult(_0x25951d,null))['catch'](handleError(_0x25951d,null));}; \ No newline at end of file +var _0x55e1=['hasOwnProperty','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','show','params','mandatoryDispositionPause','find','create','body','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','describe','FaxAccountId','Disposition','findOne','nolimit','order','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addInteraction','omit','getInteractions','FaxInteraction','CmContact','Contact','Owner','fullname','Tag','color','tag','addApplications','sequelize','transaction','READ_COMMITTED','bulkCreate','FaxApplication','finally','getApplications','context','from-voip-provider','exten','localstationid','app','Fax\x20Extension','Answer','push','CDR(type)=inbound-fax','ecm','gateway','faxdetect','headerinfo','maxrate','minrate','modem','t38timeout','Set','/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','VoiceExtension','updateAccountApplications','tech','updatedAt','TrunkId','findById','getMessages','FaxMessage','$gte','split','YYYY-MM-DD\x20HH:mm:ss','CmList','List','Contacts','DESC','attachments','server/files/attachments','basename','CheckAfterSend','isNil','from','format','fax','ListId','List\x20not\x20found','out','filename','Messages','Contact\x20not\x20found','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','spread','emit','userFaxAccount:save','removeAgents','isArray','getAgents','User','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./faxAccount.socket','register','jayson/promise','client','http','request','then','info','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','error','code','FaxAccount,\x20%s,\x20%s','message','catch','sendStatus','status','json','undefined','limit','offset','count','Content-Range','reject','save','update','destroy','get','FaxAccounts','stack','name','index','Pause','map','FaxAccount','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length'];(function(_0x510047,_0x123d51){var _0xe2418b=function(_0x40ae9f){while(--_0x40ae9f){_0x510047['push'](_0x510047['shift']());}};_0xe2418b(++_0x123d51);}(_0x55e1,0x1f3));var _0x155e=function(_0x4b2975,_0x2be462){_0x4b2975=_0x4b2975-0x0;var _0x3bc9e8=_0x55e1[_0x4b2975];return _0x3bc9e8;};'use strict';var emlformat=require(_0x155e('0x0'));var rimraf=require(_0x155e('0x1'));var zipdir=require(_0x155e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x155e('0x3'));var moment=require(_0x155e('0x4'));var BPromise=require(_0x155e('0x5'));var Mustache=require(_0x155e('0x6'));var util=require(_0x155e('0x7'));var path=require(_0x155e('0x8'));var sox=require(_0x155e('0x9'));var csv=require(_0x155e('0xa'));var ejs=require(_0x155e('0xb'));var fs=require('fs');var fs_extra=require(_0x155e('0xc'));var _=require(_0x155e('0xd'));var squel=require('squel');var crypto=require(_0x155e('0xe'));var jsforce=require(_0x155e('0xf'));var deskjs=require(_0x155e('0x10'));var toCsv=require(_0x155e('0xa'));var querystring=require(_0x155e('0x11'));var Papa=require(_0x155e('0x12'));var Redis=require(_0x155e('0x13'));var authService=require(_0x155e('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x155e('0x15'));var hardwareService=require(_0x155e('0x16'));var logger=require(_0x155e('0x17'))(_0x155e('0x18'));var utils=require(_0x155e('0x19'));var config=require(_0x155e('0x1a'));var licenseUtil=require(_0x155e('0x1b'));var db=require('../../mysqldb')['db'];config[_0x155e('0x1c')]=_['defaults'](config['redis'],{'host':_0x155e('0x1d'),'port':0x18eb});var socket=require(_0x155e('0x1e'))(new Redis(config[_0x155e('0x1c')]));require(_0x155e('0x1f'))[_0x155e('0x20')](socket);var jayson=require(_0x155e('0x21'));var client=jayson[_0x155e('0x22')][_0x155e('0x23')]({'port':0x232c});var client9002=jayson[_0x155e('0x22')][_0x155e('0x23')]({'port':0x232a});function respondWithRpcPromise(_0x16b2e2,_0x197452,_0x217bec,_0x1bc26f){return new BPromise(function(_0x598588,_0x219548){var _0x3877bc=_0x1bc26f||client;return _0x3877bc[_0x155e('0x24')](_0x16b2e2,_0x217bec)[_0x155e('0x25')](function(_0x4c31c4){logger[_0x155e('0x26')]('FaxAccount,\x20%s,\x20%s',_0x197452,_0x155e('0x27'));logger['debug'](_0x155e('0x28'),_0x197452,'request\x20sent',JSON['stringify'](_0x4c31c4));if(_0x4c31c4[_0x155e('0x29')]){if(_0x4c31c4[_0x155e('0x29')][_0x155e('0x2a')]===0x1f4){logger['error'](_0x155e('0x2b'),_0x197452,_0x4c31c4[_0x155e('0x29')][_0x155e('0x2c')]);return _0x219548(_0x4c31c4[_0x155e('0x29')]['message']);}logger[_0x155e('0x29')]('FaxAccount,\x20%s,\x20%s',_0x197452,_0x4c31c4[_0x155e('0x29')][_0x155e('0x2c')]);return _0x598588(_0x4c31c4[_0x155e('0x29')]['message']);}else{logger[_0x155e('0x26')](_0x155e('0x2b'),_0x197452,_0x155e('0x27'));_0x598588(_0x4c31c4['result']['message']);}})[_0x155e('0x2d')](function(_0x50a425){logger['error'](_0x155e('0x2b'),_0x197452,_0x50a425);_0x219548(_0x50a425);});});}function respondWithStatusCode(_0x127d0b,_0x547f16){_0x547f16=_0x547f16||0xcc;return function(_0x2f702a){if(_0x2f702a){return _0x127d0b[_0x155e('0x2e')](_0x547f16);}return _0x127d0b[_0x155e('0x2f')](_0x547f16)['end']();};}function respondWithResult(_0x81ffc5,_0x1d86ed){_0x1d86ed=_0x1d86ed||0xc8;return function(_0x496b84){if(_0x496b84){return _0x81ffc5[_0x155e('0x2f')](_0x1d86ed)[_0x155e('0x30')](_0x496b84);}};}function respondWithFilteredResult(_0x147385,_0x1ad439){return function(_0x5320a4){if(_0x5320a4){var _0x2102fb=typeof _0x1ad439['offset']===_0x155e('0x31')&&typeof _0x1ad439[_0x155e('0x32')]===_0x155e('0x31');var _0x29e502=_0x5320a4['count'];var _0x2e6016=_0x2102fb?0x0:_0x1ad439[_0x155e('0x33')];var _0xc82c95=_0x2102fb?_0x5320a4[_0x155e('0x34')]:_0x1ad439['offset']+_0x1ad439[_0x155e('0x32')];var _0x2d7ca4;if(_0xc82c95>=_0x29e502){_0xc82c95=_0x29e502;_0x2d7ca4=0xc8;}else{_0x2d7ca4=0xce;}_0x147385[_0x155e('0x2f')](_0x2d7ca4);return _0x147385['set'](_0x155e('0x35'),_0x2e6016+'-'+_0xc82c95+'/'+_0x29e502)[_0x155e('0x30')](_0x5320a4);}return null;};}function patchUpdates(_0x20d109){return function(_0x1cd631){try{jsonpatch['apply'](_0x1cd631,_0x20d109,!![]);}catch(_0x5efc3d){return BPromise[_0x155e('0x36')](_0x5efc3d);}return _0x1cd631[_0x155e('0x37')]();};}function saveUpdates(_0x26375f,_0xd51108){return function(_0x57373e){if(_0x57373e){return _0x57373e[_0x155e('0x38')](_0x26375f)[_0x155e('0x25')](function(_0xa0fd61){return _0xa0fd61;});}return null;};}function removeEntity(_0x353940,_0x492289){return function(_0x166c67){if(_0x166c67){return _0x166c67[_0x155e('0x39')]()[_0x155e('0x25')](function(){var _0x16bd15=_0x166c67[_0x155e('0x3a')]({'plain':!![]});var _0x5671f7=_0x155e('0x3b');return db['UserProfileResource'][_0x155e('0x39')]({'where':{'type':_0x5671f7,'resourceId':_0x16bd15['id']}})[_0x155e('0x25')](function(){return _0x166c67;});})['then'](function(){_0x353940['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e0ede,_0x389e8a){return function(_0x2512a3){if(!_0x2512a3){_0x3e0ede[_0x155e('0x2e')](0x194);}return _0x2512a3;};}function handleError(_0x4d9aec,_0xc1f961){_0xc1f961=_0xc1f961||0x1f4;return function(_0x2c4d5c){logger['error'](_0x2c4d5c[_0x155e('0x3c')]);if(_0x2c4d5c[_0x155e('0x3d')]){delete _0x2c4d5c[_0x155e('0x3d')];}_0x4d9aec[_0x155e('0x2f')](_0xc1f961)['send'](_0x2c4d5c);};}exports[_0x155e('0x3e')]=function(_0x15b397,_0x294cc4){var _0x5803fd={'include':[{'model':db[_0x155e('0x3f')],'as':'mandatoryDispositionPause'}]},_0x292da3={},_0x5d5709={'count':0x0,'rows':[]};var _0x1d1caf=_[_0x155e('0x40')](db[_0x155e('0x41')][_0x155e('0x42')],function(_0x5b1b23){return{'name':_0x5b1b23[_0x155e('0x43')],'type':_0x5b1b23['type'][_0x155e('0x44')]};});_0x292da3[_0x155e('0x45')]=_[_0x155e('0x40')](_0x1d1caf,_0x155e('0x3d'));_0x292da3[_0x155e('0x46')]=_[_0x155e('0x47')](_0x15b397[_0x155e('0x46')]);_0x292da3[_0x155e('0x48')]=_['intersection'](_0x292da3[_0x155e('0x45')],_0x292da3[_0x155e('0x46')]);_0x5803fd[_0x155e('0x49')]=_[_0x155e('0x4a')](_0x292da3[_0x155e('0x45')],qs['fields'](_0x15b397[_0x155e('0x46')][_0x155e('0x4b')]));_0x5803fd[_0x155e('0x49')]=_0x5803fd[_0x155e('0x49')][_0x155e('0x4c')]?_0x5803fd[_0x155e('0x49')]:_0x292da3[_0x155e('0x45')];if(!_0x15b397[_0x155e('0x46')][_0x155e('0x4d')]('nolimit')){_0x5803fd['limit']=qs['limit'](_0x15b397['query']['limit']);_0x5803fd[_0x155e('0x33')]=qs[_0x155e('0x33')](_0x15b397[_0x155e('0x46')][_0x155e('0x33')]);}_0x5803fd['order']=qs[_0x155e('0x4e')](_0x15b397[_0x155e('0x46')]['sort']);_0x5803fd['where']=qs[_0x155e('0x48')](_[_0x155e('0x4f')](_0x15b397['query'],_0x292da3['filters']),_0x1d1caf);if(_0x15b397[_0x155e('0x46')][_0x155e('0x50')]){_0x5803fd[_0x155e('0x51')]=_[_0x155e('0x52')](_0x5803fd[_0x155e('0x51')],{'$or':_['map'](_0x1d1caf,function(_0x599b5b){if(_0x599b5b[_0x155e('0x53')]!==_0x155e('0x54')){var _0x38e192={};_0x38e192[_0x599b5b[_0x155e('0x3d')]]={'$like':'%'+_0x15b397[_0x155e('0x46')][_0x155e('0x50')]+'%'};return _0x38e192;}})});}_0x5803fd=_[_0x155e('0x52')]({},_0x5803fd,_0x15b397[_0x155e('0x55')]);var _0x50805d={'where':_0x5803fd[_0x155e('0x51')]};return db[_0x155e('0x41')][_0x155e('0x34')](_0x50805d)[_0x155e('0x25')](function(_0x14927f){_0x5d5709['count']=_0x14927f;if(_0x15b397[_0x155e('0x46')][_0x155e('0x56')]){_0x5803fd[_0x155e('0x57')]=[{'all':!![]}];}return db[_0x155e('0x41')][_0x155e('0x58')](_0x5803fd);})[_0x155e('0x25')](function(_0x319719){_0x5d5709['rows']=_0x319719;return _0x5d5709;})[_0x155e('0x25')](respondWithFilteredResult(_0x294cc4,_0x5803fd))[_0x155e('0x2d')](handleError(_0x294cc4,null));};exports[_0x155e('0x59')]=function(_0x54fbed,_0x1d1187){var _0x3d08c5={'raw':![],'where':{'id':_0x54fbed[_0x155e('0x5a')]['id']},'include':[{'model':db['Pause'],'as':_0x155e('0x5b')}]},_0x5bbdaa={};_0x5bbdaa['model']=_['keys'](db[_0x155e('0x41')]['rawAttributes']);_0x5bbdaa[_0x155e('0x46')]=_[_0x155e('0x47')](_0x54fbed[_0x155e('0x46')]);_0x5bbdaa[_0x155e('0x48')]=_['intersection'](_0x5bbdaa[_0x155e('0x45')],_0x5bbdaa[_0x155e('0x46')]);_0x3d08c5[_0x155e('0x49')]=_['intersection'](_0x5bbdaa['model'],qs[_0x155e('0x4b')](_0x54fbed[_0x155e('0x46')]['fields']));_0x3d08c5[_0x155e('0x49')]=_0x3d08c5['attributes'][_0x155e('0x4c')]?_0x3d08c5[_0x155e('0x49')]:_0x5bbdaa[_0x155e('0x45')];if(_0x54fbed['query'][_0x155e('0x56')]){_0x3d08c5[_0x155e('0x57')]=[{'all':!![]}];}_0x3d08c5=_[_0x155e('0x52')]({},_0x3d08c5,_0x54fbed[_0x155e('0x55')]);return db[_0x155e('0x41')][_0x155e('0x5c')](_0x3d08c5)[_0x155e('0x25')](handleEntityNotFound(_0x1d1187,null))['then'](respondWithResult(_0x1d1187,null))[_0x155e('0x2d')](handleError(_0x1d1187,null));};exports['create']=function(_0x1cb1e6,_0x95c160){return db[_0x155e('0x41')][_0x155e('0x5d')](_0x1cb1e6[_0x155e('0x5e')],{})['then'](function(_0x3b553b){var _0x383eea=_0x1cb1e6[_0x155e('0x5f')][_0x155e('0x3a')]({'plain':!![]});if(!_0x383eea)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x383eea['role']===_0x155e('0x5f')){var _0x5d15ca=_0x3b553b[_0x155e('0x3a')]({'plain':!![]});var _0x35a760=_0x155e('0x3b');return db[_0x155e('0x60')][_0x155e('0x5c')]({'where':{'name':_0x35a760,'userProfileId':_0x383eea[_0x155e('0x61')]},'raw':!![]})[_0x155e('0x25')](function(_0x557d4e){if(_0x557d4e&&_0x557d4e[_0x155e('0x62')]===0x0){return db[_0x155e('0x63')][_0x155e('0x5d')]({'name':_0x5d15ca[_0x155e('0x3d')],'resourceId':_0x5d15ca['id'],'type':_0x557d4e[_0x155e('0x3d')],'sectionId':_0x557d4e['id']},{})[_0x155e('0x25')](function(){return _0x3b553b;});}else{return _0x3b553b;}})[_0x155e('0x2d')](function(_0x64a996){logger[_0x155e('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x64a996);throw _0x64a996;});}return _0x3b553b;})['then'](respondWithResult(_0x95c160,0xc9))['catch'](handleError(_0x95c160,null));};exports[_0x155e('0x38')]=function(_0x4d7c13,_0x25a658){if(_0x4d7c13[_0x155e('0x5e')]['id']){delete _0x4d7c13[_0x155e('0x5e')]['id'];}return db[_0x155e('0x41')]['find']({'where':{'id':_0x4d7c13[_0x155e('0x5a')]['id']},'include':[{'model':db['Pause'],'as':_0x155e('0x5b')}]})['then'](handleEntityNotFound(_0x25a658,null))[_0x155e('0x25')](saveUpdates(_0x4d7c13['body'],null))['then'](respondWithResult(_0x25a658,null))[_0x155e('0x2d')](handleError(_0x25a658,null));};exports['destroy']=function(_0x5b250c,_0x143052){return db[_0x155e('0x41')]['find']({'where':{'id':_0x5b250c[_0x155e('0x5a')]['id']}})[_0x155e('0x25')](handleEntityNotFound(_0x143052,null))[_0x155e('0x25')](removeEntity(_0x143052,null))['catch'](handleError(_0x143052,null));};exports[_0x155e('0x64')]=function(_0x4bcb0b,_0x1b100d){return db[_0x155e('0x41')]['describe']()[_0x155e('0x25')](respondWithResult(_0x1b100d,null))[_0x155e('0x2d')](handleError(_0x1b100d,null));};exports['addDisposition']=function(_0x2f5cbe,_0xc5c6f7,_0x507a93){if(_0x2f5cbe['body']['id']){delete _0x2f5cbe[_0x155e('0x5e')]['id'];}return db[_0x155e('0x41')]['find']({'where':{'id':_0x2f5cbe[_0x155e('0x5a')]['id']}})[_0x155e('0x25')](handleEntityNotFound(_0xc5c6f7,null))[_0x155e('0x25')](function(_0x5c492b){if(_0x5c492b){_0x2f5cbe[_0x155e('0x5e')][_0x155e('0x65')]=_0x5c492b['id'];return db[_0x155e('0x66')][_0x155e('0x5d')](_0x2f5cbe[_0x155e('0x5e')]);}})[_0x155e('0x25')](respondWithResult(_0xc5c6f7,null))['catch'](handleError(_0xc5c6f7,null));};exports['getDispositions']=function(_0xca020b,_0x137f72,_0x5d1355){var _0x2efced={'raw':![],'where':{}};var _0x58924d={};var _0x59ad51={'count':0x0,'rows':[]};return db['FaxAccount'][_0x155e('0x67')]({'where':{'id':_0xca020b[_0x155e('0x5a')]['id']}})[_0x155e('0x25')](handleEntityNotFound(_0x137f72,null))['then'](function(_0x3d21f4){if(_0x3d21f4){_0x58924d[_0x155e('0x45')]=_[_0x155e('0x47')](db[_0x155e('0x66')][_0x155e('0x42')]);_0x58924d[_0x155e('0x46')]=_[_0x155e('0x47')](_0xca020b[_0x155e('0x46')]);_0x58924d[_0x155e('0x48')]=_[_0x155e('0x4a')](_0x58924d['model'],_0x58924d[_0x155e('0x46')]);_0x2efced['attributes']=_[_0x155e('0x4a')](_0x58924d[_0x155e('0x45')],qs[_0x155e('0x4b')](_0xca020b[_0x155e('0x46')][_0x155e('0x4b')]));_0x2efced[_0x155e('0x49')]=_0x2efced['attributes'][_0x155e('0x4c')]?_0x2efced[_0x155e('0x49')]:_0x58924d[_0x155e('0x45')];if(!_0xca020b[_0x155e('0x46')]['hasOwnProperty'](_0x155e('0x68'))){_0x2efced[_0x155e('0x32')]=qs[_0x155e('0x32')](_0xca020b[_0x155e('0x46')][_0x155e('0x32')]);_0x2efced[_0x155e('0x33')]=qs['offset'](_0xca020b[_0x155e('0x46')][_0x155e('0x33')]);}_0x2efced[_0x155e('0x69')]=qs[_0x155e('0x4e')](_0xca020b[_0x155e('0x46')][_0x155e('0x4e')]);_0x2efced[_0x155e('0x51')]=qs[_0x155e('0x48')](_['pick'](_0xca020b[_0x155e('0x46')],_0x58924d[_0x155e('0x48')]));_0x2efced[_0x155e('0x51')][_0x155e('0x65')]=_0x3d21f4['id'];if(_0xca020b['query']['filter']){_0x2efced[_0x155e('0x51')]=_['merge'](_0x2efced['where'],{'$or':_[_0x155e('0x40')](_0x2efced['attributes'],function(_0x6c3dbd){var _0x2a2ef1={};_0x2a2ef1[_0x6c3dbd]={'$like':'%'+_0xca020b[_0x155e('0x46')][_0x155e('0x50')]+'%'};return _0x2a2ef1;})});}_0x2efced=_[_0x155e('0x52')]({},_0x2efced,_0xca020b[_0x155e('0x55')]);return db[_0x155e('0x66')][_0x155e('0x34')]({'where':_0x2efced[_0x155e('0x51')]})[_0x155e('0x25')](function(_0x863842){_0x59ad51[_0x155e('0x34')]=_0x863842;if(_0xca020b[_0x155e('0x46')]['includeAll']){_0x2efced['include']=[{'all':!![]}];}return db[_0x155e('0x66')][_0x155e('0x58')](_0x2efced);})['then'](function(_0x2eca1a){_0x59ad51[_0x155e('0x6a')]=_0x2eca1a;return _0x59ad51;});}})[_0x155e('0x25')](respondWithFilteredResult(_0x137f72,_0x2efced))[_0x155e('0x2d')](handleError(_0x137f72,null));};exports['removeDispositions']=function(_0x19cc2c,_0xe0403e,_0x1bb7f9){return db[_0x155e('0x41')][_0x155e('0x5c')]({'where':{'id':_0x19cc2c['params']['id']}})[_0x155e('0x25')](handleEntityNotFound(_0xe0403e,null))[_0x155e('0x25')](function(_0x49cd60){if(_0x49cd60){return _0x49cd60[_0x155e('0x6b')](_0x19cc2c['query'][_0x155e('0x6c')]);}})['then'](respondWithStatusCode(_0xe0403e,null))[_0x155e('0x2d')](handleError(_0xe0403e,null));};exports[_0x155e('0x6d')]=function(_0x22ac76,_0x315396,_0x42bffa){if(_0x22ac76[_0x155e('0x5e')]['id']){delete _0x22ac76['body']['id'];}return db[_0x155e('0x41')][_0x155e('0x5c')]({'where':{'id':_0x22ac76[_0x155e('0x5a')]['id']}})['then'](handleEntityNotFound(_0x315396,null))['then'](function(_0x259486){if(_0x259486){_0x22ac76['body'][_0x155e('0x65')]=_0x259486['id'];return db[_0x155e('0x6e')][_0x155e('0x5d')](_0x22ac76[_0x155e('0x5e')]);}})[_0x155e('0x25')](respondWithResult(_0x315396,null))[_0x155e('0x2d')](handleError(_0x315396,null));};exports[_0x155e('0x6f')]=function(_0x1c287d,_0x254a4f,_0x5ced6a){var _0x4074ad={'raw':![],'where':{}};var _0x2115d1={};var _0x41cda4={'count':0x0,'rows':[]};return db[_0x155e('0x41')][_0x155e('0x67')]({'where':{'id':_0x1c287d['params']['id']}})['then'](handleEntityNotFound(_0x254a4f,null))['then'](function(_0x495185){if(_0x495185){_0x2115d1['model']=_[_0x155e('0x47')](db[_0x155e('0x6e')][_0x155e('0x42')]);_0x2115d1[_0x155e('0x46')]=_[_0x155e('0x47')](_0x1c287d['query']);_0x2115d1[_0x155e('0x48')]=_[_0x155e('0x4a')](_0x2115d1['model'],_0x2115d1[_0x155e('0x46')]);_0x4074ad[_0x155e('0x49')]=_[_0x155e('0x4a')](_0x2115d1[_0x155e('0x45')],qs[_0x155e('0x4b')](_0x1c287d[_0x155e('0x46')]['fields']));_0x4074ad[_0x155e('0x49')]=_0x4074ad[_0x155e('0x49')][_0x155e('0x4c')]?_0x4074ad[_0x155e('0x49')]:_0x2115d1[_0x155e('0x45')];if(!_0x1c287d[_0x155e('0x46')]['hasOwnProperty']('nolimit')){_0x4074ad[_0x155e('0x32')]=qs[_0x155e('0x32')](_0x1c287d[_0x155e('0x46')][_0x155e('0x32')]);_0x4074ad[_0x155e('0x33')]=qs['offset'](_0x1c287d['query'][_0x155e('0x33')]);}_0x4074ad['order']=qs['sort'](_0x1c287d[_0x155e('0x46')][_0x155e('0x4e')]);_0x4074ad['where']=qs['filters'](_['pick'](_0x1c287d['query'],_0x2115d1['filters']));_0x4074ad[_0x155e('0x51')][_0x155e('0x65')]=_0x495185['id'];if(_0x1c287d[_0x155e('0x46')][_0x155e('0x50')]){_0x4074ad['where']=_[_0x155e('0x52')](_0x4074ad[_0x155e('0x51')],{'$or':_['map'](_0x4074ad[_0x155e('0x49')],function(_0x55b448){var _0x263482={};_0x263482[_0x55b448]={'$like':'%'+_0x1c287d[_0x155e('0x46')][_0x155e('0x50')]+'%'};return _0x263482;})});}_0x4074ad=_[_0x155e('0x52')]({},_0x4074ad,_0x1c287d['options']);return db['CannedAnswer']['count']({'where':_0x4074ad[_0x155e('0x51')]})[_0x155e('0x25')](function(_0x5eb8c7){_0x41cda4[_0x155e('0x34')]=_0x5eb8c7;if(_0x1c287d['query'][_0x155e('0x56')]){_0x4074ad[_0x155e('0x57')]=[{'all':!![]}];}return db['CannedAnswer'][_0x155e('0x58')](_0x4074ad);})[_0x155e('0x25')](function(_0x32df4f){_0x41cda4[_0x155e('0x6a')]=_0x32df4f;return _0x41cda4;});}})[_0x155e('0x25')](respondWithFilteredResult(_0x254a4f,_0x4074ad))[_0x155e('0x2d')](handleError(_0x254a4f,null));};exports['removeAnswers']=function(_0x2502d8,_0x1f614a,_0x4c3128){return db[_0x155e('0x41')][_0x155e('0x5c')]({'where':{'id':_0x2502d8[_0x155e('0x5a')]['id']}})[_0x155e('0x25')](handleEntityNotFound(_0x1f614a,null))['then'](function(_0x9dda04){if(_0x9dda04){return _0x9dda04[_0x155e('0x70')](_0x2502d8[_0x155e('0x46')][_0x155e('0x6c')]);}})[_0x155e('0x25')](respondWithStatusCode(_0x1f614a,null))[_0x155e('0x2d')](handleError(_0x1f614a,null));};exports[_0x155e('0x71')]=function(_0xbe4513,_0xbbd143,_0x2063b2){return db['FaxInteraction']['find']({'where':{'id':_0xbe4513['params']['id']}})['then'](handleEntityNotFound(_0xbbd143,null))[_0x155e('0x25')](function(_0x3797f2){if(_0x3797f2){return _0x3797f2[_0x155e('0x71')](_0xbe4513[_0x155e('0x5e')][_0x155e('0x6c')],_[_0x155e('0x72')](_0xbe4513['body'],[_0x155e('0x6c'),'id'])||{});}})['then'](respondWithResult(_0xbbd143,null))[_0x155e('0x2d')](handleError(_0xbbd143,null));};exports[_0x155e('0x73')]=function(_0x50a91c,_0x454297,_0xa2c043){var _0xd1917b={'raw':![],'where':{}};var _0x2c8f27={};var _0x32012c={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x50a91c[_0x155e('0x5a')]['id']}})[_0x155e('0x25')](handleEntityNotFound(_0x454297,null))[_0x155e('0x25')](function(_0x1cbab0){if(_0x1cbab0){_0x2c8f27[_0x155e('0x45')]=_['keys'](db[_0x155e('0x74')][_0x155e('0x42')]);_0x2c8f27[_0x155e('0x46')]=_[_0x155e('0x47')](_0x50a91c[_0x155e('0x46')]);_0x2c8f27[_0x155e('0x48')]=_[_0x155e('0x4a')](_0x2c8f27[_0x155e('0x45')],_0x2c8f27[_0x155e('0x46')]);_0xd1917b[_0x155e('0x49')]=_[_0x155e('0x4a')](_0x2c8f27[_0x155e('0x45')],qs[_0x155e('0x4b')](_0x50a91c[_0x155e('0x46')][_0x155e('0x4b')]));_0xd1917b[_0x155e('0x49')]=_0xd1917b['attributes']['length']?_0xd1917b[_0x155e('0x49')]:_0x2c8f27['model'];if(!_0x50a91c[_0x155e('0x46')][_0x155e('0x4d')](_0x155e('0x68'))){_0xd1917b[_0x155e('0x32')]=qs[_0x155e('0x32')](_0x50a91c['query']['limit']);_0xd1917b['offset']=qs[_0x155e('0x33')](_0x50a91c[_0x155e('0x46')][_0x155e('0x33')]);}_0xd1917b[_0x155e('0x69')]=qs[_0x155e('0x4e')](_0x50a91c['query'][_0x155e('0x4e')]);_0xd1917b[_0x155e('0x51')]=qs[_0x155e('0x48')](_['pick'](_0x50a91c[_0x155e('0x46')],_0x2c8f27[_0x155e('0x48')]));_0xd1917b[_0x155e('0x51')][_0x155e('0x65')]=_0x1cbab0['id'];if(_0x50a91c[_0x155e('0x46')][_0x155e('0x50')]){_0xd1917b[_0x155e('0x51')]=_['merge'](_0xd1917b[_0x155e('0x51')],{'$or':_['map'](_0xd1917b[_0x155e('0x49')],function(_0x4f4662){var _0x2d790b={};_0x2d790b[_0x4f4662]={'$like':'%'+_0x50a91c[_0x155e('0x46')][_0x155e('0x50')]+'%'};return _0x2d790b;})});}_0xd1917b=_[_0x155e('0x52')]({},_0xd1917b,_0x50a91c[_0x155e('0x55')]);return db[_0x155e('0x74')]['count']({'where':_0xd1917b[_0x155e('0x51')]})[_0x155e('0x25')](function(_0x50ef0){_0x32012c[_0x155e('0x34')]=_0x50ef0;if(_0x50a91c['query'][_0x155e('0x56')]){_0xd1917b[_0x155e('0x57')]=[{'model':db[_0x155e('0x75')],'as':_0x155e('0x76'),'required':![]},{'model':db['User'],'as':_0x155e('0x77'),'attributes':[_0x155e('0x3d'),_0x155e('0x78'),'internal'],'required':![]},{'model':db[_0x155e('0x79')],'as':'Tags','attributes':['id',_0x155e('0x3d'),_0x155e('0x7a')],'where':_0x50a91c[_0x155e('0x46')][_0x155e('0x7b')]?{'id':_0x50a91c['query'][_0x155e('0x7b')]}:undefined,'required':_0x50a91c['query'][_0x155e('0x7b')]?!![]:![]}];}return db[_0x155e('0x74')][_0x155e('0x58')](_0xd1917b);})[_0x155e('0x25')](function(_0xa9293e){_0x32012c[_0x155e('0x6a')]=_0xa9293e;return _0x32012c;});}})[_0x155e('0x25')](respondWithFilteredResult(_0x454297,_0xd1917b))[_0x155e('0x2d')](handleError(_0x454297,null));};exports[_0x155e('0x7c')]=function(_0x1a868c,_0x50fe5f){var _0x45774d=_0x1a868c[_0x155e('0x5a')]['id'];var _0x22a704=_0x1a868c[_0x155e('0x5e')];var _0x15ac0b=0xc8;var _0x306c7e=null;return db[_0x155e('0x7d')][_0x155e('0x7e')]({'isolationLevel':db[_0x155e('0x7d')]['Transaction']['ISOLATION_LEVELS'][_0x155e('0x7f')]},function(_0x3fcc37){return db[_0x155e('0x41')][_0x155e('0x67')]({'where':{'id':_0x45774d},'transaction':_0x3fcc37})['then'](function(_0x5c23e2){if(_0x5c23e2){return db['FaxApplication']['destroy']({'where':{'FaxAccountId':_0x45774d},'transaction':_0x3fcc37})['then'](function(){var _0x4ac128=_['map'](_0x22a704,function(_0x352807){_0x352807[_0x155e('0x65')]=_0x45774d;return _0x352807;});return db['FaxApplication'][_0x155e('0x80')](_0x4ac128,{'transaction':_0x3fcc37});});}else{_0x15ac0b=0x194;_0x306c7e=[];}});})[_0x155e('0x25')](function(){if(_0x15ac0b!==0x194){return db[_0x155e('0x81')]['findAndCountAll']({'where':{'FaxAccountId':_0x45774d},'order':'priority'})[_0x155e('0x25')](function(_0xcaacf1){_0x306c7e=_0xcaacf1;});}})['catch'](function(_0x56e57b){_0x15ac0b=0x1f4;logger[_0x155e('0x29')](_0x56e57b[_0x155e('0x3c')]);if(_0x56e57b['name']){delete _0x56e57b[_0x155e('0x3d')];}_0x306c7e=_0x56e57b;})[_0x155e('0x82')](function(){if(_0x306c7e===null){_0x50fe5f[_0x155e('0x2e')](_0x15ac0b);}else{if(_0x15ac0b===0x1f4){_0x50fe5f[_0x155e('0x2f')](_0x15ac0b)['send'](_0x306c7e);}else{_0x50fe5f[_0x155e('0x2f')](_0x15ac0b)[_0x155e('0x30')](_0x306c7e);}}});};exports['getApplications']=function(_0x53a687,_0x203cf3,_0x599626){var _0x31059f={};var _0x3d75fb={};var _0x3001f3;var _0x1d02d7;return db[_0x155e('0x41')][_0x155e('0x67')]({'where':{'id':_0x53a687[_0x155e('0x5a')]['id']}})['then'](handleEntityNotFound(_0x203cf3,null))['then'](function(_0x3d11c5){if(_0x3d11c5){_0x3001f3=_0x3d11c5;_0x3d75fb[_0x155e('0x45')]=_['keys'](db['FaxApplication'][_0x155e('0x42')]);_0x3d75fb[_0x155e('0x46')]=_[_0x155e('0x47')](_0x53a687['query']);_0x3d75fb[_0x155e('0x48')]=_[_0x155e('0x4a')](_0x3d75fb['model'],_0x3d75fb['query']);_0x31059f[_0x155e('0x49')]=_['intersection'](_0x3d75fb[_0x155e('0x45')],qs['fields'](_0x53a687['query']['fields']));_0x31059f['attributes']=_0x31059f[_0x155e('0x49')]['length']?_0x31059f['attributes']:_0x3d75fb[_0x155e('0x45')];_0x31059f[_0x155e('0x69')]=qs[_0x155e('0x4e')](_0x53a687[_0x155e('0x46')]['sort']);_0x31059f[_0x155e('0x51')]=qs[_0x155e('0x48')](_[_0x155e('0x4f')](_0x53a687[_0x155e('0x46')],_0x3d75fb[_0x155e('0x48')]));if(_0x53a687[_0x155e('0x46')][_0x155e('0x50')]){_0x31059f[_0x155e('0x51')]=_[_0x155e('0x52')](_0x31059f[_0x155e('0x51')],{'$or':_[_0x155e('0x40')](_0x31059f['attributes'],function(_0x13bf6f){var _0x7c6a33={};_0x7c6a33[_0x13bf6f]={'$like':'%'+_0x53a687[_0x155e('0x46')][_0x155e('0x50')]+'%'};return _0x7c6a33;})});}_0x31059f=_['merge']({},_0x31059f,_0x53a687[_0x155e('0x55')]);return _0x3001f3['getApplications'](_0x31059f);}})[_0x155e('0x25')](function(_0x32d9ca){if(_0x32d9ca){_0x1d02d7=_0x32d9ca[_0x155e('0x4c')];if(!_0x53a687[_0x155e('0x46')][_0x155e('0x4d')](_0x155e('0x68'))){_0x31059f[_0x155e('0x32')]=qs[_0x155e('0x32')](_0x53a687['query'][_0x155e('0x32')]);_0x31059f[_0x155e('0x33')]=qs[_0x155e('0x33')](_0x53a687[_0x155e('0x46')][_0x155e('0x33')]);}return _0x3001f3[_0x155e('0x83')](_0x31059f);}})[_0x155e('0x25')](function(_0x24019d){if(_0x24019d){return _0x24019d?{'count':_0x1d02d7,'rows':_0x24019d}:null;}})[_0x155e('0x25')](respondWithResult(_0x203cf3,null))[_0x155e('0x2d')](handleError(_0x203cf3,null));};function Extension(_0x4efbb5,_0x1432db,_0x5d7576,_0x36558b){this[_0x155e('0x84')]=_0x155e('0x85');this[_0x155e('0x86')]=_0x4efbb5[_0x155e('0x87')];this[_0x155e('0x88')]=_0x36558b;this[_0x155e('0x53')]='system';this['description']=_0x155e('0x89');this['FaxAccountId']=_0x4efbb5['id'];this['priority']=_0x1432db;this['appdata']=_0x5d7576;}function createExtensionsReciveFax(_0x16fdbc){var _0x1bb46e=0x1;var _0xca9f97=[];_0xca9f97['push'](new Extension(_0x16fdbc,_0x1bb46e,'',_0x155e('0x8a')));_0x1bb46e+=0x1;_0xca9f97[_0x155e('0x8b')](new Extension(_0x16fdbc,_0x1bb46e,_0x155e('0x8c'),'Set'));_0x1bb46e+=0x1;for(var _0x1e1716 in _0x16fdbc){if(_0x16fdbc[_0x155e('0x4d')](_0x1e1716)&&(_0x1e1716===_0x155e('0x8d')||_0x1e1716==='localstationid'||_0x1e1716===_0x155e('0x8e')||_0x1e1716===_0x155e('0x8f')||_0x1e1716===_0x155e('0x90')||_0x1e1716===_0x155e('0x91')||_0x1e1716===_0x155e('0x92')||_0x1e1716===_0x155e('0x93')||_0x1e1716===_0x155e('0x94'))){_0xca9f97['push'](new Extension(_0x16fdbc,_0x1bb46e,'FAXOPT('+_0x1e1716+')='+_0x16fdbc[_0x1e1716],_0x155e('0x95')));_0x1bb46e+=0x1;}}_0xca9f97['push'](new Extension(_0x16fdbc,_0x1bb46e,'6','Wait'));_0x1bb46e+=0x1;_0xca9f97['push'](new Extension(_0x16fdbc,_0x1bb46e,_0x155e('0x96'),'ReceiveFax'));_0x1bb46e=0x0;return _0xca9f97;}exports['addAccountApplications']=function(_0x40da9f,_0x57b84d,_0x509335){var _0x44da48;return db[_0x155e('0x7d')][_0x155e('0x7e')](function(_0x18ead6){return db['FaxAccount'][_0x155e('0x5d')](_0x40da9f['body'],{'transaction':_0x18ead6})[_0x155e('0x25')](function(_0x2db097){_0x44da48=_0x2db097[_0x155e('0x3a')]({'plain':!![]});return db[_0x155e('0x97')]['bulkCreate'](createExtensionsReciveFax(_0x44da48),{'transaction':_0x18ead6});});})[_0x155e('0x25')](function(){return _0x44da48;})[_0x155e('0x25')](respondWithResult(_0x57b84d,null))[_0x155e('0x2d')](handleError(_0x57b84d,null));};exports[_0x155e('0x98')]=function(_0x50f159,_0x4e767a,_0xbe2972){var _0x3da4b2;return db[_0x155e('0x7d')][_0x155e('0x7e')](function(_0x5a59c5){return db[_0x155e('0x41')][_0x155e('0x38')](_0x50f159[_0x155e('0x5e')],{'where':{'id':_0x50f159[_0x155e('0x5e')]['id']},'transaction':_0x5a59c5})[_0x155e('0x25')](function(_0xc410d4){return db[_0x155e('0x97')]['destroy']({'where':{'FaxAccountId':_0x50f159['body']['id']},'transaction':_0x5a59c5})[_0x155e('0x25')](function(_0x59ade2){return db[_0x155e('0x97')][_0x155e('0x80')](createExtensionsReciveFax(_[_0x155e('0x72')](_0x50f159[_0x155e('0x5e')],[_0x155e('0x99'),_0x155e('0x44'),'createdAt',_0x155e('0x9a'),_0x155e('0x9b'),'ListId'])),{'transaction':_0x5a59c5});});});})[_0x155e('0x25')](function(){return db[_0x155e('0x41')][_0x155e('0x9c')](_0x50f159[_0x155e('0x5e')]['id']);})[_0x155e('0x25')](respondWithResult(_0x4e767a,null))[_0x155e('0x2d')](handleError(_0x4e767a,null));};exports[_0x155e('0x9d')]=function(_0x4aba0f,_0x17b04a,_0x4ac4f6){var _0x2d27f2={'raw':!![],'where':{}};var _0x3b6beb={};var _0x19ef0c={'count':0x0,'rows':[]};return db[_0x155e('0x41')][_0x155e('0x67')]({'where':{'id':_0x4aba0f[_0x155e('0x5a')]['id']}})[_0x155e('0x25')](handleEntityNotFound(_0x17b04a,null))[_0x155e('0x25')](function(_0x115542){if(_0x115542){_0x3b6beb[_0x155e('0x45')]=_[_0x155e('0x47')](db[_0x155e('0x9e')][_0x155e('0x42')]);_0x3b6beb[_0x155e('0x46')]=_['keys'](_0x4aba0f[_0x155e('0x46')]);_0x3b6beb[_0x155e('0x48')]=_[_0x155e('0x4a')](_0x3b6beb[_0x155e('0x45')],_0x3b6beb[_0x155e('0x46')]);_0x2d27f2[_0x155e('0x49')]=_[_0x155e('0x4a')](_0x3b6beb['model'],qs[_0x155e('0x4b')](_0x4aba0f[_0x155e('0x46')][_0x155e('0x4b')]));_0x2d27f2['attributes']=_0x2d27f2[_0x155e('0x49')][_0x155e('0x4c')]?_0x2d27f2[_0x155e('0x49')]:_0x3b6beb[_0x155e('0x45')];if(!_0x4aba0f[_0x155e('0x46')][_0x155e('0x4d')](_0x155e('0x68'))){_0x2d27f2[_0x155e('0x32')]=qs[_0x155e('0x32')](_0x4aba0f[_0x155e('0x46')][_0x155e('0x32')]);_0x2d27f2[_0x155e('0x33')]=qs[_0x155e('0x33')](_0x4aba0f[_0x155e('0x46')][_0x155e('0x33')]);}_0x2d27f2[_0x155e('0x69')]=qs[_0x155e('0x4e')](_0x4aba0f[_0x155e('0x46')][_0x155e('0x4e')]);_0x2d27f2[_0x155e('0x51')]=qs['filters'](_['pick'](_0x4aba0f[_0x155e('0x46')],_0x3b6beb[_0x155e('0x48')]));_0x2d27f2[_0x155e('0x51')][_0x155e('0x65')]=_0x115542['id'];if(_0x4aba0f[_0x155e('0x46')][_0x155e('0x50')]){_0x2d27f2[_0x155e('0x51')]=_['merge'](_0x2d27f2['where'],{'$or':_[_0x155e('0x40')](_0x2d27f2['attributes'],function(_0x1a66fa){var _0x3a16ac={};_0x3a16ac[_0x1a66fa]={'$like':'%'+_0x4aba0f['query'][_0x155e('0x50')]+'%'};return _0x3a16ac;})});}if(_0x4aba0f[_0x155e('0x46')][_0x155e('0x9f')]){var _0x4f29e8=_0x4aba0f[_0x155e('0x46')][_0x155e('0x9f')][_0x155e('0xa0')](',');var _0xc41d8a={};_0xc41d8a[_0x4f29e8[0x0]]={'$gte':moment(_0x4f29e8[0x1])['format'](_0x155e('0xa1'))};_0x2d27f2[_0x155e('0x51')]=_[_0x155e('0x52')](_0x2d27f2[_0x155e('0x51')],_0xc41d8a);}_0x2d27f2=_[_0x155e('0x52')]({},_0x2d27f2,_0x4aba0f[_0x155e('0x55')]);return db[_0x155e('0x9e')]['count']({'where':_0x2d27f2[_0x155e('0x51')]})['then'](function(_0x118f35){_0x19ef0c['count']=_0x118f35;if(_0x4aba0f[_0x155e('0x46')][_0x155e('0x56')]){_0x2d27f2[_0x155e('0x57')]=[{'all':!![]}];}return db[_0x155e('0x9e')][_0x155e('0x58')](_0x2d27f2);})[_0x155e('0x25')](function(_0x1e04a8){_0x19ef0c[_0x155e('0x6a')]=_0x1e04a8;return _0x19ef0c;});}})['then'](respondWithFilteredResult(_0x17b04a,_0x2d27f2))['catch'](handleError(_0x17b04a,null));};exports['send']=function(_0x5ffed9,_0x1504b0,_0x58ad4c){var _0xf157f1,_0x46f54c={},_0x119f77;if(_0x5ffed9['body']['to']){_0x119f77=_0x5ffed9[_0x155e('0x5e')]['to'][0x0];}return db['FaxAccount'][_0x155e('0x5c')]({'where':{'id':_0x5ffed9['params']['id']},'include':[{'model':db[_0x155e('0xa2')],'as':_0x155e('0xa3'),'include':[{'model':db[_0x155e('0x75')],'as':_0x155e('0xa4'),'where':{'fax':_0x119f77},'limit':0x1,'order':[['updatedAt',_0x155e('0xa5')]]}]}]})[_0x155e('0x25')](handleEntityNotFound(_0x1504b0,null))[_0x155e('0x25')](function(_0x17298a){_0xf157f1=_0x17298a;if(_0x5ffed9['body'][_0x155e('0xa6')]&&_0x5ffed9[_0x155e('0x5e')][_0x155e('0xa6')][_0x155e('0x4c')]){for(var _0x2d7d92=0x0;_0x2d7d92<_0x5ffed9[_0x155e('0x5e')][_0x155e('0xa6')][_0x155e('0x4c')];_0x2d7d92+=0x1){_0x5ffed9['body']['attachments'][_0x2d7d92]={'filename':_0x5ffed9[_0x155e('0x5e')][_0x155e('0xa6')][_0x2d7d92]['name'],'id':_0x5ffed9[_0x155e('0x5e')][_0x155e('0xa6')][_0x2d7d92]['id'],'path':path['join'](config['root'],_0x155e('0xa7'),_0x5ffed9['body'][_0x155e('0xa6')][_0x2d7d92][_0x155e('0xa8')])};}}return respondWithRpcPromise(_0x155e('0xa9'),_0x155e('0xa9'),{'FaxAccountId':_['isNil'](_0x5ffed9['params']['id'])?undefined:_0x5ffed9[_0x155e('0x5a')]['id'],'path':_['isNil'](_0x5ffed9[_0x155e('0x5e')][_0x155e('0xa6')][0x0]['path'])?undefined:_0x5ffed9[_0x155e('0x5e')]['attachments'][0x0][_0x155e('0x8')],'fax':_[_0x155e('0xaa')](_0x5ffed9[_0x155e('0x5e')]['to'][0x0])?undefined:_0x5ffed9[_0x155e('0x5e')]['to'][0x0]},client9002);})[_0x155e('0x25')](function(){if(_0xf157f1){if(_['isNil'](_0x5ffed9[_0x155e('0x5e')][_0x155e('0xab')])){_0x5ffed9[_0x155e('0x5e')]['from']=util[_0x155e('0xac')]('\x22%s\x22\x20<%s>',_0xf157f1[_0x155e('0x3d')],_0xf157f1[_0x155e('0xad')]);}if(_0xf157f1[_0x155e('0xa3')]){if(_0xf157f1[_0x155e('0xa3')][_0x155e('0xa4')][_0x155e('0x4c')]){return _0xf157f1['List'][_0x155e('0xa4')][0x0];}else{return db[_0x155e('0x75')]['create'](_['defaults'](_0x5ffed9[_0x155e('0x5e')],{'firstName':_0x5ffed9[_0x155e('0x5e')]['to'][0x0],'phone':_0x5ffed9[_0x155e('0x5e')]['to'][0x0],'fax':_0x5ffed9['body']['to'][0x0],'ListId':_0xf157f1[_0x155e('0xae')]}));}}else{throw new Error(_0x155e('0xaf'));}}else{throw new Error('Send\x20Fax\x20failed');}})[_0x155e('0x25')](function(_0x380398){if(_0x380398){return db[_0x155e('0x74')][_0x155e('0x5c')]({'where':{'ContactId':_0x380398['id'],'closed':![],'FaxAccountId':_0xf157f1['id']}})[_0x155e('0x25')](function(_0x354e1f){if(_0x354e1f){return[_0x354e1f,![]];}return db[_0x155e('0x74')][_0x155e('0x5d')]({'UserId':_0x5ffed9['user']['id'],'ContactId':_0x380398['id'],'FaxAccountId':_0xf157f1['id'],'fax':_0x5ffed9[_0x155e('0x5e')]['to'][0x0],'firstMsgDirection':_0x155e('0xb0'),'Messages':[_['merge'](_0x5ffed9[_0x155e('0x5e')],{'read':![],'body':_0x5ffed9[_0x155e('0x5e')][_0x155e('0xa6')][0x0][_0x155e('0xb1')],'FaxAccountId':_0xf157f1['id'],'UserId':_0x5ffed9[_0x155e('0x5f')]['id'],'ContactId':_0x380398['id'],'AttachmentId':_0x5ffed9[_0x155e('0x5e')][_0x155e('0xa6')][0x0]['id']})]},{'include':[{'model':db[_0x155e('0x9e')],'as':_0x155e('0xb2')}]})[_0x155e('0x25')](function(_0x14b14e){return[_0x14b14e,!![]];});});}else{throw new Error(_0x155e('0xb3'));}})['spread'](function(_0x1653ca,_0x4a5c2e){if(_0x4a5c2e){return _0x1653ca;}return db[_0x155e('0x9e')]['create']({'direction':_0x155e('0xb0'),'read':![],'body':_0x5ffed9[_0x155e('0x5e')][_0x155e('0xa6')][0x0][_0x155e('0xb1')],'FaxAccountId':_0xf157f1['id'],'FaxInteractionId':_0x1653ca['id'],'UserId':_0x5ffed9['user']['id'],'ContactId':_0x1653ca[_0x155e('0xb4')],'AttachmentId':_0x5ffed9[_0x155e('0x5e')][_0x155e('0xa6')][0x0]['id']})[_0x155e('0x25')](function(_0x1b105e){_0x1653ca[_0x155e('0xb5')][_0x155e('0xb2')]=[];_0x1653ca[_0x155e('0xb5')]['Messages'][_0x155e('0x8b')](_0x1b105e['dataValues']);return _0x1653ca;});})[_0x155e('0x25')](function(_0x4435f9){respondWithRpcPromise(_0x155e('0xb6'),_0x155e('0xb6'),{'FaxAccountId':_[_0x155e('0xaa')](_0x5ffed9[_0x155e('0x5a')]['id'])?undefined:_0x5ffed9[_0x155e('0x5a')]['id'],'path':_[_0x155e('0xaa')](_0x5ffed9[_0x155e('0x5e')][_0x155e('0xa6')][0x0][_0x155e('0x8')])?undefined:_0x5ffed9[_0x155e('0x5e')]['attachments'][0x0][_0x155e('0x8')],'fax':_[_0x155e('0xaa')](_0x5ffed9['body']['to'][0x0])?undefined:_0x5ffed9['body']['to'][0x0],'AttachmentId':_0x5ffed9[_0x155e('0x5e')]['attachments'][0x0]['id']},client9002)[_0x155e('0x25')](function(_0x159f0e){logger[_0x155e('0x26')](_0x155e('0xb7'),_0x159f0e);})[_0x155e('0x2d')](function(_0x1ad8a1){logger[_0x155e('0x26')](_0x155e('0xb7'),_0x1ad8a1);});return _0x4435f9;})[_0x155e('0x25')](respondWithResult(_0x1504b0,null))['catch'](handleError(_0x1504b0,null));};exports[_0x155e('0xb8')]=function(_0x40a7cb,_0x37e970,_0x546b55){return db[_0x155e('0x41')][_0x155e('0x5c')]({'where':{'id':_0x40a7cb['params']['id']}})[_0x155e('0x25')](handleEntityNotFound(_0x37e970,null))[_0x155e('0x25')](function(_0x2c416e){if(_0x2c416e){return _0x2c416e[_0x155e('0xb8')](_0x40a7cb[_0x155e('0x5e')][_0x155e('0x6c')],_[_0x155e('0x72')](_0x40a7cb[_0x155e('0x5e')],[_0x155e('0x6c'),'id'])||{})[_0x155e('0xb9')](function(_0x2f31c8){for(var _0xfbbcd6=0x0;_0xfbbcd6<_0x40a7cb[_0x155e('0x5e')][_0x155e('0x6c')][_0x155e('0x4c')];_0xfbbcd6+=0x1){socket[_0x155e('0xba')](_0x155e('0xbb'),{'UserId':Number(_0x40a7cb['body'][_0x155e('0x6c')][_0xfbbcd6]),'FaxAccountId':Number(_0x40a7cb[_0x155e('0x5a')]['id'])});}return _0x2f31c8;});}})[_0x155e('0x25')](respondWithResult(_0x37e970,null))['catch'](handleError(_0x37e970,null));};exports[_0x155e('0xbc')]=function(_0x399820,_0x682a10,_0x568b0a){return db['FaxAccount']['find']({'where':{'id':_0x399820[_0x155e('0x5a')]['id']}})[_0x155e('0x25')](handleEntityNotFound(_0x682a10,null))[_0x155e('0x25')](function(_0x4a5f9b){if(_0x4a5f9b){return _0x4a5f9b[_0x155e('0xbc')](_0x399820[_0x155e('0x46')]['ids'])[_0x155e('0x25')](function(){if(_[_0x155e('0xbd')](_0x399820[_0x155e('0x46')][_0x155e('0x6c')])){for(var _0x31eedc=0x0;_0x31eedc<_0x399820['query'][_0x155e('0x6c')][_0x155e('0x4c')];_0x31eedc+=0x1){socket[_0x155e('0xba')]('userFaxAccount:remove',{'UserId':Number(_0x399820[_0x155e('0x46')]['ids'][_0x31eedc]),'FaxAccountId':Number(_0x399820[_0x155e('0x5a')]['id'])});}}else{socket['emit']('userFaxAccount:remove',{'UserId':Number(_0x399820[_0x155e('0x46')][_0x155e('0x6c')]),'FaxAccountId':Number(_0x399820[_0x155e('0x5a')]['id'])});}});}})[_0x155e('0x25')](respondWithStatusCode(_0x682a10,null))['catch'](handleError(_0x682a10,null));};exports[_0x155e('0xbe')]=function(_0x1220ed,_0x166723,_0x3382c0){var _0x2c3d65={};var _0x3c1057={};var _0x36e3e4;var _0x21d2fa;return db[_0x155e('0x41')][_0x155e('0x67')]({'where':{'id':_0x1220ed[_0x155e('0x5a')]['id']}})[_0x155e('0x25')](handleEntityNotFound(_0x166723,null))[_0x155e('0x25')](function(_0x1ce4d5){if(_0x1ce4d5){_0x36e3e4=_0x1ce4d5;_0x3c1057['model']=_['keys'](db[_0x155e('0xbf')][_0x155e('0x42')]);_0x3c1057[_0x155e('0x46')]=_[_0x155e('0x47')](_0x1220ed[_0x155e('0x46')]);_0x3c1057[_0x155e('0x48')]=_['intersection'](_0x3c1057[_0x155e('0x45')],_0x3c1057[_0x155e('0x46')]);_0x2c3d65[_0x155e('0x49')]=_[_0x155e('0x4a')](_0x3c1057[_0x155e('0x45')],qs[_0x155e('0x4b')](_0x1220ed['query'][_0x155e('0x4b')]));_0x2c3d65[_0x155e('0x49')]=_0x2c3d65[_0x155e('0x49')][_0x155e('0x4c')]?_0x2c3d65[_0x155e('0x49')]:_0x3c1057[_0x155e('0x45')];_0x2c3d65[_0x155e('0x69')]=qs['sort'](_0x1220ed['query'][_0x155e('0x4e')]);_0x2c3d65['where']=qs[_0x155e('0x48')](_[_0x155e('0x4f')](_0x1220ed[_0x155e('0x46')],_0x3c1057[_0x155e('0x48')]));if(_0x1220ed[_0x155e('0x46')]['filter']){_0x2c3d65[_0x155e('0x51')]=_[_0x155e('0x52')](_0x2c3d65[_0x155e('0x51')],{'$or':_['map'](_0x2c3d65[_0x155e('0x49')],function(_0x5851c5){var _0xff9100={};_0xff9100[_0x5851c5]={'$like':'%'+_0x1220ed[_0x155e('0x46')][_0x155e('0x50')]+'%'};return _0xff9100;})});}_0x2c3d65=_[_0x155e('0x52')]({},_0x2c3d65,_0x1220ed[_0x155e('0x55')]);return _0x36e3e4[_0x155e('0xbe')](_0x2c3d65);}})[_0x155e('0x25')](function(_0x3df521){if(_0x3df521){_0x21d2fa=_0x3df521[_0x155e('0x4c')];if(!_0x1220ed[_0x155e('0x46')][_0x155e('0x4d')](_0x155e('0x68'))){_0x2c3d65[_0x155e('0x32')]=qs[_0x155e('0x32')](_0x1220ed['query'][_0x155e('0x32')]);_0x2c3d65[_0x155e('0x33')]=qs['offset'](_0x1220ed[_0x155e('0x46')][_0x155e('0x33')]);}return _0x36e3e4[_0x155e('0xbe')](_0x2c3d65);}})['then'](function(_0x3f139a){if(_0x3f139a){return _0x3f139a?{'count':_0x21d2fa,'rows':_0x3f139a}:null;}})[_0x155e('0x25')](respondWithResult(_0x166723,null))[_0x155e('0x2d')](handleError(_0x166723,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 7cd5532..60e7884 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 _0x664b=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','events','FaxAccount'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x664b,0x66));var _0xb664=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x664b[_0x2641f9];return _0x585741;};'use strict';var EventEmitter=require(_0xb664('0x0'));var FaxAccount=require('../../mysqldb')['db'][_0xb664('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xb664('0x2')](0x0);var events={'afterCreate':_0xb664('0x3'),'afterUpdate':'update','afterDestroy':_0xb664('0x4')};function emitEvent(_0x45d86b){return function(_0x3937cb,_0x45efee,_0x208fa0){FaxAccountEvents[_0xb664('0x5')](_0x45d86b+':'+_0x3937cb['id'],_0x3937cb);FaxAccountEvents['emit'](_0x45d86b,_0x3937cb);_0x208fa0(null);};}for(var e in events){if(events[_0xb664('0x6')](e)){var event=events[e];FaxAccount[_0xb664('0x7')](e,emitEvent(event));}}module['exports']=FaxAccountEvents; \ No newline at end of file +var _0x57e4=['FaxAccount','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x10dfdf,_0x36b623){var _0x4d857d=function(_0x4683ee){while(--_0x4683ee){_0x10dfdf['push'](_0x10dfdf['shift']());}};_0x4d857d(++_0x36b623);}(_0x57e4,0x1e5));var _0x457e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x57e4[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require(_0x457e('0x0'));var FaxAccount=require('../../mysqldb')['db'][_0x457e('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x457e('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x457e('0x3'),'afterDestroy':_0x457e('0x4')};function emitEvent(_0xcc16f4){return function(_0x572329,_0x45173e,_0x46393f){FaxAccountEvents[_0x457e('0x5')](_0xcc16f4+':'+_0x572329['id'],_0x572329);FaxAccountEvents[_0x457e('0x5')](_0xcc16f4,_0x572329);_0x46393f(null);};}for(var e in events){if(events[_0x457e('0x6')](e)){var event=events[e];FaxAccount[_0x457e('0x7')](e,emitEvent(event));}}module[_0x457e('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 a70988b..fa03cf7 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 _0xa73e=['../../config/logger','moment','bluebird','request-promise','path','rimraf','./faxAccount.attributes','exports','define','fax_accounts','lodash','util'];(function(_0x1c546c,_0x5c57cb){var _0x2cc384=function(_0x4dee11){while(--_0x4dee11){_0x1c546c['push'](_0x1c546c['shift']());}};_0x2cc384(++_0x5c57cb);}(_0xa73e,0x106));var _0xea73=function(_0x33749c,_0x26f380){_0x33749c=_0x33749c-0x0;var _0x4865a0=_0xa73e[_0x33749c];return _0x4865a0;};'use strict';var _=require(_0xea73('0x0'));var util=require(_0xea73('0x1'));var logger=require(_0xea73('0x2'))('api');var moment=require(_0xea73('0x3'));var BPromise=require(_0xea73('0x4'));var rp=require(_0xea73('0x5'));var fs=require('fs');var path=require(_0xea73('0x6'));var rimraf=require(_0xea73('0x7'));var config=require('../../config/environment');var attributes=require(_0xea73('0x8'));module[_0xea73('0x9')]=function(_0x49e489,_0x4bc525){return _0x49e489[_0xea73('0xa')]('FaxAccount',attributes,{'tableName':_0xea73('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3b8e=['./faxAccount.attributes','define','FaxAccount','fax_accounts','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x5ec626,_0x59d1dc){var _0x5b8e24=function(_0x548b55){while(--_0x548b55){_0x5ec626['push'](_0x5ec626['shift']());}};_0x5b8e24(++_0x59d1dc);}(_0x3b8e,0x1f0));var _0xe3b8=function(_0x1f994c,_0x10db25){_0x1f994c=_0x1f994c-0x0;var _0x307377=_0x3b8e[_0x1f994c];return _0x307377;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe3b8('0x0'))(_0xe3b8('0x1'));var moment=require(_0xe3b8('0x2'));var BPromise=require(_0xe3b8('0x3'));var rp=require(_0xe3b8('0x4'));var fs=require('fs');var path=require(_0xe3b8('0x5'));var rimraf=require(_0xe3b8('0x6'));var config=require(_0xe3b8('0x7'));var attributes=require(_0xe3b8('0x8'));module['exports']=function(_0x4bd4b1,_0x15e0a7){return _0x4bd4b1[_0xe3b8('0x9')](_0xe3b8('0xa'),attributes,{'tableName':_0xe3b8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.rpc.js b/server/api/faxAccount/faxAccount.rpc.js index e12a022..3474025 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 _0x5847=['Contact\x20not\x20found','autoclose','length','close','unmanaged','*,*,*,*','created','interaction','FaxMessage','ContactId','AttachmentId','User','UserId','unshift','waitForTheAssignedAgent','queueId','FaxQueue','name','queue','waitForTheAssignedQueue','Start','startRouting','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','findAll','options','raw','where','attributes','limit','include','map','model','GetFaxAccount','catch','NotifyFaxAccount','body','fax','ValidationError','no\x20available\x20attributes','keys','createdAt','updatedAt','difference','CompanyId','from','Sequelize','from\x20is\x20mandatory','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','FaxAccount','find','account','CmList','List','CmContact','Contacts','Applications','get','list','applications','orderBy','priority','ListId','create','contact'];(function(_0x35d537,_0x660101){var _0x1c6b31=function(_0x44ca96){while(--_0x44ca96){_0x35d537['push'](_0x35d537['shift']());}};_0x1c6b31(++_0x660101);}(_0x5847,0x196));var _0x7584=function(_0x578cd4,_0x359493){_0x578cd4=_0x578cd4-0x0;var _0x53606b=_0x5847[_0x578cd4];return _0x53606b;};'use strict';var _=require(_0x7584('0x0'));var util=require('util');var moment=require(_0x7584('0x1'));var BPromise=require(_0x7584('0x2'));var rs=require(_0x7584('0x3'));var fs=require('fs');var Redis=require(_0x7584('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7584('0x5'));var logger=require(_0x7584('0x6'))(_0x7584('0x7'));var config=require(_0x7584('0x8'));var jayson=require(_0x7584('0x9'));var client=jayson[_0x7584('0xa')][_0x7584('0xb')]({'port':0x232c});config[_0x7584('0xc')]=_[_0x7584('0xd')](config[_0x7584('0xc')],{'host':_0x7584('0xe'),'port':0x18eb});var socket=require(_0x7584('0xf'))(new Redis(config[_0x7584('0xc')]));require(_0x7584('0x10'))[_0x7584('0x11')](socket);function respondWithRpcPromise(_0x4dadfb,_0x2caa0e,_0x35cc0c){return new BPromise(function(_0xd957b7,_0x45034a){return client['request'](_0x4dadfb,_0x35cc0c)[_0x7584('0x12')](function(_0xc7bda2){logger[_0x7584('0x13')](_0x7584('0x14'),_0x2caa0e,_0x7584('0x15'));logger[_0x7584('0x16')](_0x7584('0x17'),_0x2caa0e,_0x7584('0x15'),JSON[_0x7584('0x18')](_0xc7bda2));if(_0xc7bda2['error']){if(_0xc7bda2[_0x7584('0x19')][_0x7584('0x1a')]===0x1f4){logger[_0x7584('0x19')](_0x7584('0x14'),_0x2caa0e,_0xc7bda2[_0x7584('0x19')]['message']);return _0x45034a(_0xc7bda2[_0x7584('0x19')]['message']);}logger[_0x7584('0x19')](_0x7584('0x14'),_0x2caa0e,_0xc7bda2['error'][_0x7584('0x1b')]);return _0xd957b7(_0xc7bda2['error'][_0x7584('0x1b')]);}else{logger[_0x7584('0x13')](_0x7584('0x14'),_0x2caa0e,'request\x20sent');_0xd957b7(_0xc7bda2[_0x7584('0x1c')][_0x7584('0x1b')]);}})['catch'](function(_0x4881db){logger[_0x7584('0x19')](_0x7584('0x14'),_0x2caa0e,_0x4881db);_0x45034a(_0x4881db);});});}exports['GetFaxAccount']=function(_0x1148ff){var _0x400b58=this;return new Promise(function(_0x47ed15,_0x260ffb){return db['FaxAccount'][_0x7584('0x1d')]({'raw':_0x1148ff[_0x7584('0x1e')]?_0x1148ff['options'][_0x7584('0x1f')]===undefined?!![]:![]:!![],'where':_0x1148ff[_0x7584('0x1e')]?_0x1148ff[_0x7584('0x1e')][_0x7584('0x20')]||null:null,'attributes':_0x1148ff[_0x7584('0x1e')]?_0x1148ff['options'][_0x7584('0x21')]||null:null,'limit':_0x1148ff[_0x7584('0x1e')]?_0x1148ff['options'][_0x7584('0x22')]||null:null,'include':_0x1148ff[_0x7584('0x1e')]?_0x1148ff['options'][_0x7584('0x23')]?_[_0x7584('0x24')](_0x1148ff[_0x7584('0x1e')][_0x7584('0x23')],function(_0x2e8e74){return{'model':db[_0x2e8e74[_0x7584('0x25')]],'as':_0x2e8e74['as'],'attributes':_0x2e8e74[_0x7584('0x21')],'include':_0x2e8e74[_0x7584('0x23')]?_[_0x7584('0x24')](_0x2e8e74['include'],function(_0x25e979){return{'model':db[_0x25e979[_0x7584('0x25')]],'as':_0x25e979['as'],'attributes':_0x25e979[_0x7584('0x21')],'include':_0x25e979[_0x7584('0x23')]?_['map'](_0x25e979[_0x7584('0x23')],function(_0x373574){return{'model':db[_0x373574[_0x7584('0x25')]],'as':_0x373574['as'],'attributes':_0x373574[_0x7584('0x21')]};}):[]};}):[]};}):[]:[]})[_0x7584('0x12')](function(_0x1f4a84){logger[_0x7584('0x13')]('GetFaxAccount',_0x1148ff);logger[_0x7584('0x16')](_0x7584('0x26'),_0x1148ff,JSON[_0x7584('0x18')](_0x1f4a84));_0x47ed15(_0x1f4a84);})[_0x7584('0x27')](function(_0x330d78){logger[_0x7584('0x19')](_0x7584('0x26'),_0x330d78['message'],_0x1148ff);_0x260ffb(_0x400b58[_0x7584('0x19')](0x1f4,_0x330d78[_0x7584('0x1b')]));});});};exports[_0x7584('0x28')]=function(_0x5ee3f0,_0x30fe73,_0x2588e0){var _0x54cee6=this;return new Promise(function(_0x116aef,_0xcc1ef7){var _0xf5f4e4={'body':_0x5ee3f0[_0x7584('0x29')],'channel':_0x7584('0x2a')};var _0x3bc4d0=[];var _0xd72206=[];var _0x515bd3={};return db['CmContact']['describe']()[_0x7584('0x12')](function(_0x5a7e9b){if(!_0x5a7e9b){throw new db['Sequelize'][(_0x7584('0x2b'))](_0x7584('0x2c'));}_0x3bc4d0=_['difference'](_[_0x7584('0x2d')](_0x5a7e9b),[_0x7584('0x2e'),_0x7584('0x2f')]);_0xd72206=_[_0x7584('0x30')](_[_0x7584('0x2d')](_0x5a7e9b),[_0x7584('0x2e'),'updatedAt',_0x7584('0x31'),'ListId']);if(_0x5ee3f0[_0x7584('0x29')]['id']){delete _0x5ee3f0[_0x7584('0x29')]['id'];}if(_['isNil'](_0x5ee3f0[_0x7584('0x29')][_0x7584('0x32')])){throw new db[(_0x7584('0x33'))][(_0x7584('0x2b'))](_0x7584('0x34'));}if(_[_0x7584('0x35')](_0x5ee3f0[_0x7584('0x29')]['body'])||_0x5ee3f0[_0x7584('0x29')]['body']===''){throw new db['Sequelize']['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x5ee3f0[_0x7584('0x29')][_0x7584('0x36')])){throw new db['Sequelize']['ValidationError'](_0x7584('0x37')+_0xd72206);}if(!_[_0x7584('0x38')](_0xd72206,_0x5ee3f0[_0x7584('0x29')][_0x7584('0x36')])){throw new db['Sequelize'][(_0x7584('0x2b'))](_0x7584('0x39')+_0xd72206);}_0x515bd3[_0x5ee3f0[_0x7584('0x29')][_0x7584('0x36')]]=_0x5ee3f0[_0x7584('0x29')]['from'];})['then'](function(){return db[_0x7584('0x3a')][_0x7584('0x3b')]({'where':{'id':_0x5ee3f0[_0x7584('0x3c')]['id']},'include':[{'model':db[_0x7584('0x3d')],'as':_0x7584('0x3e'),'include':[{'model':db[_0x7584('0x3f')],'as':_0x7584('0x40'),'where':_0x515bd3,'limit':0x1,'order':[[_0x7584('0x2f'),'DESC']]}]},{'model':db['FaxApplication'],'as':_0x7584('0x41')}]});})[_0x7584('0x12')](function(_0x5bc962){if(_0x5bc962&&_0x5bc962[_0x7584('0x3e')]){var _0x3f2ed9=_0x5bc962[_0x7584('0x42')]({'plain':!![]});_0xf5f4e4[_0x7584('0x3c')]=_0x3f2ed9;_0xf5f4e4['applications']=_0x3f2ed9[_0x7584('0x41')];_0xf5f4e4[_0x7584('0x43')]=_0x3f2ed9[_0x7584('0x3e')];_0xf5f4e4[_0x7584('0x44')]=_[_0x7584('0x45')](_0xf5f4e4[_0x7584('0x44')],[_0x7584('0x46')],['asc']);if(_0xf5f4e4['account'][_0x7584('0x41')]){delete _0xf5f4e4[_0x7584('0x3c')]['Applications'];}if(_0xf5f4e4[_0x7584('0x3c')][_0x7584('0x3e')]&&_0xf5f4e4[_0x7584('0x3c')][_0x7584('0x3e')][_0x7584('0x40')]['length']){return _0xf5f4e4[_0x7584('0x3c')]['List']['Contacts'][0x0];}var _0x460ab4=_[_0x7584('0xd')](_0x5ee3f0[_0x7584('0x29')],{'firstName':_0x5ee3f0[_0x7584('0x29')]['from'],'ListId':_0x3f2ed9[_0x7584('0x47')]});_0x460ab4[_0x5ee3f0['body'][_0x7584('0x36')]]=_0x5ee3f0[_0x7584('0x29')][_0x7584('0x32')];return db[_0x7584('0x3f')][_0x7584('0x48')](_0x460ab4,{'fields':_0x3bc4d0,'raw':!![]});}})['then'](function(_0x3656cc){_0xf5f4e4[_0x7584('0x49')]=_0x3656cc;if(_0x3656cc){var _0x8f3aa4={'ContactId':_0x3656cc['id'],'FaxAccountId':_0x5ee3f0['account']['id'],'fax':_0x3656cc[_0x7584('0x2a')]};return db['FaxInteraction'][_0x7584('0x3b')]({'where':{'ContactId':_0x3656cc['id'],'closed':![],'FaxAccountId':_0x5ee3f0[_0x7584('0x3c')]['id']}})[_0x7584('0x12')](function(_0x5bc5fa){if(_0x5bc5fa){return[_0x5bc5fa,![]];}return db['FaxInteraction'][_0x7584('0x48')](_0x8f3aa4)['then'](function(_0xa3f12){return[_0xa3f12,!![]];});});}else{throw new Error(_0x7584('0x4a'));}})['spread'](function(_0x12f5ca,_0x3688e2){var _0x455142=_0x12f5ca[_0x7584('0x42')]({'plain':!![]});if(_0x3688e2){if(_0xf5f4e4[_0x7584('0x3c')][_0x7584('0x4b')]){_0xf5f4e4[_0x7584('0x44')]['push']({'id':0x0,'priority':_0xf5f4e4[_0x7584('0x44')][_0x7584('0x4c')]+0x1,'app':_0x7584('0x4d'),'appdata':_0x7584('0x4e'),'interval':_0x7584('0x4f')});}_0x455142[_0x7584('0x50')]=!![];}else{_0x455142[_0x7584('0x50')]=![];}_0xf5f4e4[_0x7584('0x51')]=_0x455142;return db[_0x7584('0x52')][_0x7584('0x48')]({'body':_0x5ee3f0[_0x7584('0x29')][_0x7584('0x29')],'FaxAccountId':_0x5ee3f0[_0x7584('0x3c')]['id'],'FaxInteractionId':_0x12f5ca['id'],'direction':'in','ContactId':_0x12f5ca[_0x7584('0x53')],'AttachmentId':_0x5ee3f0['body'][_0x7584('0x54')]});})['then'](function(_0x16003d){_0xf5f4e4[_0x7584('0x1b')]=_0x16003d;if(!_0xf5f4e4[_0x7584('0x51')]['UserId'])return;return db[_0x7584('0x55')][_0x7584('0x3b')]({'attributes':['id','name'],'where':{'id':_0xf5f4e4[_0x7584('0x51')][_0x7584('0x56')]}});})[_0x7584('0x12')](function(_0xe3f167){if(_0xe3f167){_0xf5f4e4['applications'][_0x7584('0x57')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0xe3f167['name']+','+(_0xf5f4e4['account'][_0x7584('0x58')]||0xa),'interval':_0x7584('0x4f')});}if(!_0xf5f4e4[_0x7584('0x51')][_0x7584('0x59')])return;return db[_0x7584('0x5a')]['find']({'attributes':['id',_0x7584('0x5b')],'where':{'id':_0xf5f4e4['interaction'][_0x7584('0x59')]}});})[_0x7584('0x12')](function(_0x488527){if(_0x488527){_0xf5f4e4[_0x7584('0x44')][_0x7584('0x57')]({'id':0x0,'priority':0x1,'app':_0x7584('0x5c'),'appdata':_0x488527[_0x7584('0x5b')]+','+(_0xf5f4e4[_0x7584('0x3c')][_0x7584('0x5d')]||0x12c),'interval':_0x7584('0x4f')});}return respondWithRpcPromise(_0x7584('0x5e'),_0x7584('0x5f'),_0xf5f4e4);})[_0x7584('0x12')](function(_0x22ea5e){_0x116aef(_0x22ea5e);})[_0x7584('0x27')](function(_0x9316c3){_0xcc1ef7(_0x54cee6['error'](0x1f4,_0x9316c3[_0x7584('0x1b')]));});});}; \ No newline at end of file +var _0x3bc4=['unmanaged','*,*,*,*','created','ContactId','AttachmentId','UserId','name','interaction','agent','waitForTheAssignedAgent','FaxQueue','queueId','unshift','queue','waitForTheAssignedQueue','Start','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./faxAccount.socket','register','request','info','FaxAccount,\x20%s,\x20%s','debug','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetFaxAccount','FaxAccount','options','raw','where','attributes','limit','include','map','model','body','fax','CmContact','then','Sequelize','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','CompanyId','ListId','isNil','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','from','CmList','Contacts','DESC','FaxApplication','Applications','List','account','applications','list','asc','create','contact','FaxInteraction','find','Contact\x20not\x20found','spread','get','autoclose','push'];(function(_0x48b784,_0x2999e9){var _0x17f563=function(_0x50c7d2){while(--_0x50c7d2){_0x48b784['push'](_0x48b784['shift']());}};_0x17f563(++_0x2999e9);}(_0x3bc4,0x12a));var _0x43bc=function(_0x154192,_0x2d360f){_0x154192=_0x154192-0x0;var _0x3c2792=_0x3bc4[_0x154192];return _0x3c2792;};'use strict';var _=require(_0x43bc('0x0'));var util=require(_0x43bc('0x1'));var moment=require(_0x43bc('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x43bc('0x3'));var db=require(_0x43bc('0x4'))['db'];var utils=require(_0x43bc('0x5'));var logger=require(_0x43bc('0x6'))(_0x43bc('0x7'));var config=require(_0x43bc('0x8'));var jayson=require(_0x43bc('0x9'));var client=jayson[_0x43bc('0xa')][_0x43bc('0xb')]({'port':0x232c});config[_0x43bc('0xc')]=_[_0x43bc('0xd')](config[_0x43bc('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x43bc('0xe'))(new Redis(config['redis']));require(_0x43bc('0xf'))[_0x43bc('0x10')](socket);function respondWithRpcPromise(_0x1492fa,_0x45a73e,_0x2c79e1){return new BPromise(function(_0x3aa1ed,_0x180458){return client[_0x43bc('0x11')](_0x1492fa,_0x2c79e1)['then'](function(_0x1990b0){logger[_0x43bc('0x12')](_0x43bc('0x13'),_0x45a73e,'request\x20sent');logger[_0x43bc('0x14')](_0x43bc('0x15'),_0x45a73e,_0x43bc('0x16'),JSON[_0x43bc('0x17')](_0x1990b0));if(_0x1990b0[_0x43bc('0x18')]){if(_0x1990b0[_0x43bc('0x18')][_0x43bc('0x19')]===0x1f4){logger[_0x43bc('0x18')](_0x43bc('0x13'),_0x45a73e,_0x1990b0['error']['message']);return _0x180458(_0x1990b0[_0x43bc('0x18')][_0x43bc('0x1a')]);}logger[_0x43bc('0x18')](_0x43bc('0x13'),_0x45a73e,_0x1990b0[_0x43bc('0x18')][_0x43bc('0x1a')]);return _0x3aa1ed(_0x1990b0[_0x43bc('0x18')][_0x43bc('0x1a')]);}else{logger[_0x43bc('0x12')](_0x43bc('0x13'),_0x45a73e,_0x43bc('0x16'));_0x3aa1ed(_0x1990b0['result']['message']);}})[_0x43bc('0x1b')](function(_0x957a47){logger[_0x43bc('0x18')](_0x43bc('0x13'),_0x45a73e,_0x957a47);_0x180458(_0x957a47);});});}exports[_0x43bc('0x1c')]=function(_0x3da597){var _0xc5c5ce=this;return new Promise(function(_0x501552,_0x27f7fd){return db[_0x43bc('0x1d')]['findAll']({'raw':_0x3da597[_0x43bc('0x1e')]?_0x3da597['options'][_0x43bc('0x1f')]===undefined?!![]:![]:!![],'where':_0x3da597['options']?_0x3da597[_0x43bc('0x1e')][_0x43bc('0x20')]||null:null,'attributes':_0x3da597[_0x43bc('0x1e')]?_0x3da597[_0x43bc('0x1e')][_0x43bc('0x21')]||null:null,'limit':_0x3da597[_0x43bc('0x1e')]?_0x3da597['options'][_0x43bc('0x22')]||null:null,'include':_0x3da597[_0x43bc('0x1e')]?_0x3da597[_0x43bc('0x1e')][_0x43bc('0x23')]?_[_0x43bc('0x24')](_0x3da597['options']['include'],function(_0x726dee){return{'model':db[_0x726dee[_0x43bc('0x25')]],'as':_0x726dee['as'],'attributes':_0x726dee['attributes'],'include':_0x726dee['include']?_[_0x43bc('0x24')](_0x726dee[_0x43bc('0x23')],function(_0x464f8e){return{'model':db[_0x464f8e[_0x43bc('0x25')]],'as':_0x464f8e['as'],'attributes':_0x464f8e[_0x43bc('0x21')],'include':_0x464f8e[_0x43bc('0x23')]?_['map'](_0x464f8e['include'],function(_0x3d31a6){return{'model':db[_0x3d31a6[_0x43bc('0x25')]],'as':_0x3d31a6['as'],'attributes':_0x3d31a6['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3a86e2){logger[_0x43bc('0x12')](_0x43bc('0x1c'),_0x3da597);logger['debug']('GetFaxAccount',_0x3da597,JSON[_0x43bc('0x17')](_0x3a86e2));_0x501552(_0x3a86e2);})[_0x43bc('0x1b')](function(_0xcfcca7){logger[_0x43bc('0x18')](_0x43bc('0x1c'),_0xcfcca7['message'],_0x3da597);_0x27f7fd(_0xc5c5ce[_0x43bc('0x18')](0x1f4,_0xcfcca7[_0x43bc('0x1a')]));});});};exports['NotifyFaxAccount']=function(_0x251d07,_0x5aa868,_0x3184b0){var _0x359ec1=this;return new Promise(function(_0x45b411,_0x2a0fdb){var _0x35cc5b={'body':_0x251d07[_0x43bc('0x26')],'channel':_0x43bc('0x27')};var _0x50233b=[];var _0x537189=[];var _0x5b79e6={};return db[_0x43bc('0x28')]['describe']()[_0x43bc('0x29')](function(_0x4d7587){if(!_0x4d7587){throw new db[(_0x43bc('0x2a'))]['ValidationError'](_0x43bc('0x2b'));}_0x50233b=_[_0x43bc('0x2c')](_[_0x43bc('0x2d')](_0x4d7587),[_0x43bc('0x2e'),_0x43bc('0x2f')]);_0x537189=_[_0x43bc('0x2c')](_['keys'](_0x4d7587),['createdAt',_0x43bc('0x2f'),_0x43bc('0x30'),_0x43bc('0x31')]);if(_0x251d07[_0x43bc('0x26')]['id']){delete _0x251d07[_0x43bc('0x26')]['id'];}if(_[_0x43bc('0x32')](_0x251d07['body']['from'])){throw new db[(_0x43bc('0x2a'))][(_0x43bc('0x33'))](_0x43bc('0x34'));}if(_['isNil'](_0x251d07[_0x43bc('0x26')]['body'])||_0x251d07['body']['body']===''){throw new db[(_0x43bc('0x2a'))][(_0x43bc('0x33'))](_0x43bc('0x35'));}if(_['isNil'](_0x251d07[_0x43bc('0x26')][_0x43bc('0x36')])){throw new db['Sequelize'][(_0x43bc('0x33'))](_0x43bc('0x37')+_0x537189);}if(!_[_0x43bc('0x38')](_0x537189,_0x251d07[_0x43bc('0x26')]['mapKey'])){throw new db[(_0x43bc('0x2a'))][(_0x43bc('0x33'))](_0x43bc('0x39')+_0x537189);}_0x5b79e6[_0x251d07[_0x43bc('0x26')]['mapKey']]=_0x251d07[_0x43bc('0x26')][_0x43bc('0x3a')];})[_0x43bc('0x29')](function(){return db[_0x43bc('0x1d')]['find']({'where':{'id':_0x251d07['account']['id']},'include':[{'model':db[_0x43bc('0x3b')],'as':'List','include':[{'model':db[_0x43bc('0x28')],'as':_0x43bc('0x3c'),'where':_0x5b79e6,'limit':0x1,'order':[['updatedAt',_0x43bc('0x3d')]]}]},{'model':db[_0x43bc('0x3e')],'as':_0x43bc('0x3f')}]});})[_0x43bc('0x29')](function(_0x57cb85){if(_0x57cb85&&_0x57cb85[_0x43bc('0x40')]){var _0x5ae83a=_0x57cb85['get']({'plain':!![]});_0x35cc5b[_0x43bc('0x41')]=_0x5ae83a;_0x35cc5b[_0x43bc('0x42')]=_0x5ae83a[_0x43bc('0x3f')];_0x35cc5b[_0x43bc('0x43')]=_0x5ae83a[_0x43bc('0x40')];_0x35cc5b[_0x43bc('0x42')]=_['orderBy'](_0x35cc5b[_0x43bc('0x42')],['priority'],[_0x43bc('0x44')]);if(_0x35cc5b[_0x43bc('0x41')][_0x43bc('0x3f')]){delete _0x35cc5b[_0x43bc('0x41')][_0x43bc('0x3f')];}if(_0x35cc5b['account']['List']&&_0x35cc5b['account'][_0x43bc('0x40')][_0x43bc('0x3c')]['length']){return _0x35cc5b[_0x43bc('0x41')][_0x43bc('0x40')][_0x43bc('0x3c')][0x0];}var _0x210b23=_[_0x43bc('0xd')](_0x251d07[_0x43bc('0x26')],{'firstName':_0x251d07[_0x43bc('0x26')][_0x43bc('0x3a')],'ListId':_0x5ae83a['ListId']});_0x210b23[_0x251d07[_0x43bc('0x26')][_0x43bc('0x36')]]=_0x251d07['body'][_0x43bc('0x3a')];return db[_0x43bc('0x28')][_0x43bc('0x45')](_0x210b23,{'fields':_0x50233b,'raw':!![]});}})[_0x43bc('0x29')](function(_0x15cc63){_0x35cc5b[_0x43bc('0x46')]=_0x15cc63;if(_0x15cc63){var _0x4708e1={'ContactId':_0x15cc63['id'],'FaxAccountId':_0x251d07['account']['id'],'fax':_0x15cc63[_0x43bc('0x27')]};return db[_0x43bc('0x47')][_0x43bc('0x48')]({'where':{'ContactId':_0x15cc63['id'],'closed':![],'FaxAccountId':_0x251d07[_0x43bc('0x41')]['id']}})[_0x43bc('0x29')](function(_0x3e1965){if(_0x3e1965){return[_0x3e1965,![]];}return db[_0x43bc('0x47')]['create'](_0x4708e1)[_0x43bc('0x29')](function(_0x382519){return[_0x382519,!![]];});});}else{throw new Error(_0x43bc('0x49'));}})[_0x43bc('0x4a')](function(_0x3b461f,_0x2e8c25){var _0x118fa7=_0x3b461f[_0x43bc('0x4b')]({'plain':!![]});if(_0x2e8c25){if(_0x35cc5b[_0x43bc('0x41')][_0x43bc('0x4c')]){_0x35cc5b['applications'][_0x43bc('0x4d')]({'id':0x0,'priority':_0x35cc5b[_0x43bc('0x42')]['length']+0x1,'app':'close','appdata':_0x43bc('0x4e'),'interval':_0x43bc('0x4f')});}_0x118fa7['created']=!![];}else{_0x118fa7[_0x43bc('0x50')]=![];}_0x35cc5b['interaction']=_0x118fa7;return db['FaxMessage'][_0x43bc('0x45')]({'body':_0x251d07[_0x43bc('0x26')][_0x43bc('0x26')],'FaxAccountId':_0x251d07['account']['id'],'FaxInteractionId':_0x3b461f['id'],'direction':'in','ContactId':_0x3b461f[_0x43bc('0x51')],'AttachmentId':_0x251d07[_0x43bc('0x26')][_0x43bc('0x52')]});})[_0x43bc('0x29')](function(_0x1b5595){_0x35cc5b['message']=_0x1b5595;if(!_0x35cc5b['interaction'][_0x43bc('0x53')])return;return db['User'][_0x43bc('0x48')]({'attributes':['id',_0x43bc('0x54')],'where':{'id':_0x35cc5b[_0x43bc('0x55')]['UserId']}});})[_0x43bc('0x29')](function(_0x58e355){if(_0x58e355){_0x35cc5b[_0x43bc('0x42')]['unshift']({'id':0x0,'priority':0x0,'app':_0x43bc('0x56'),'appdata':_0x58e355['name']+','+(_0x35cc5b[_0x43bc('0x41')][_0x43bc('0x57')]||0xa),'interval':_0x43bc('0x4f')});}if(!_0x35cc5b[_0x43bc('0x55')]['queueId'])return;return db[_0x43bc('0x58')][_0x43bc('0x48')]({'attributes':['id',_0x43bc('0x54')],'where':{'id':_0x35cc5b['interaction'][_0x43bc('0x59')]}});})['then'](function(_0x5afc1b){if(_0x5afc1b){_0x35cc5b[_0x43bc('0x42')][_0x43bc('0x5a')]({'id':0x0,'priority':0x1,'app':_0x43bc('0x5b'),'appdata':_0x5afc1b['name']+','+(_0x35cc5b[_0x43bc('0x41')][_0x43bc('0x5c')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x43bc('0x5d'),'startRouting',_0x35cc5b);})[_0x43bc('0x29')](function(_0x1d1bff){_0x45b411(_0x1d1bff);})['catch'](function(_0x27df9f){_0x2a0fdb(_0x359ec1[_0x43bc('0x18')](0x1f4,_0x27df9f[_0x43bc('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 519457d..08c247b 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 _0x54e6=['length','faxAccount:','./faxAccount.events','remove','update','register'];(function(_0x23bf67,_0x564d3d){var _0x8f2df5=function(_0x5e31b1){while(--_0x5e31b1){_0x23bf67['push'](_0x23bf67['shift']());}};_0x8f2df5(++_0x564d3d);}(_0x54e6,0x9e));var _0x654e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x54e6[_0x20a584];return _0x4b41a8;};'use strict';var FaxAccountEvents=require(_0x654e('0x0'));var events=['save',_0x654e('0x1'),_0x654e('0x2')];function createListener(_0x4e5771,_0xa81aec){return function(_0x4d300d){_0xa81aec['emit'](_0x4e5771,_0x4d300d);};}function removeListener(_0x114412,_0x42cd5d){return function(){FaxAccountEvents['removeListener'](_0x114412,_0x42cd5d);};}exports[_0x654e('0x3')]=function(_0x27a76e){for(var _0x3942ba=0x0,_0x47c9a2=events[_0x654e('0x4')];_0x3942ba<_0x47c9a2;_0x3942ba++){var _0x3cb9a0=events[_0x3942ba];var _0x34f9ea=createListener(_0x654e('0x5')+_0x3cb9a0,_0x27a76e);FaxAccountEvents['on'](_0x3cb9a0,_0x34f9ea);}}; \ No newline at end of file +var _0xe21f=['update','emit','length','save','remove'];(function(_0x4b281a,_0x1733de){var _0x3149a7=function(_0x3a6b40){while(--_0x3a6b40){_0x4b281a['push'](_0x4b281a['shift']());}};_0x3149a7(++_0x1733de);}(_0xe21f,0xe9));var _0xfe21=function(_0x3af04e,_0x32fe73){_0x3af04e=_0x3af04e-0x0;var _0x22c466=_0xe21f[_0x3af04e];return _0x22c466;};'use strict';var FaxAccountEvents=require('./faxAccount.events');var events=[_0xfe21('0x0'),_0xfe21('0x1'),_0xfe21('0x2')];function createListener(_0x2e1679,_0x58c568){return function(_0x512495){_0x58c568[_0xfe21('0x3')](_0x2e1679,_0x512495);};}function removeListener(_0x43b74b,_0x48a911){return function(){FaxAccountEvents['removeListener'](_0x43b74b,_0x48a911);};}exports['register']=function(_0x59c873){for(var _0x406166=0x0,_0x22fa0a=events[_0xfe21('0x4')];_0x406166<_0x22fa0a;_0x406166++){var _0x3566bb=events[_0x406166];var _0x103a14=createListener('faxAccount:'+_0x3566bb,_0x59c873);FaxAccountEvents['on'](_0x3566bb,_0x103a14);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 0f3ada9..79e47bc 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 _0x0651=['get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/interactions','getInteractions','/:id/applications','getApplications','getMessages','/:id/users','post','addDisposition','addAnswer','addApplications','/addaccountapplications','addAccountApplications','updateAccountApplications','/:id/send','send','put','update','delete','destroy','removeDispositions','removeAnswers','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2a19e7,_0x53aa4d){var _0xdb7b37=function(_0x13396c){while(--_0x13396c){_0x2a19e7['push'](_0x2a19e7['shift']());}};_0xdb7b37(++_0x53aa4d);}(_0x0651,0x1d8));var _0x1065=function(_0x153db7,_0x270de5){_0x153db7=_0x153db7-0x0;var _0x4116e1=_0x0651[_0x153db7];return _0x4116e1;};'use strict';var multer=require(_0x1065('0x0'));var util=require(_0x1065('0x1'));var path=require(_0x1065('0x2'));var timeout=require(_0x1065('0x3'));var express=require(_0x1065('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x1065('0x5'));var interaction=require(_0x1065('0x6'));var config=require(_0x1065('0x7'));var controller=require('./faxAccount.controller');router[_0x1065('0x8')]('/',auth[_0x1065('0x9')](),controller[_0x1065('0xa')]);router['get'](_0x1065('0xb'),auth[_0x1065('0x9')](),controller[_0x1065('0xc')]);router[_0x1065('0x8')](_0x1065('0xd'),auth['isAuthenticated'](),controller[_0x1065('0xe')]);router[_0x1065('0x8')](_0x1065('0xf'),auth[_0x1065('0x9')](),controller['getDispositions']);router[_0x1065('0x8')](_0x1065('0x10'),auth[_0x1065('0x9')](),controller[_0x1065('0x11')]);router[_0x1065('0x8')](_0x1065('0x12'),auth['isAuthenticated'](),controller[_0x1065('0x13')]);router[_0x1065('0x8')](_0x1065('0x14'),auth[_0x1065('0x9')](),controller[_0x1065('0x15')]);router[_0x1065('0x8')]('/:id/messages',auth[_0x1065('0x9')](),controller[_0x1065('0x16')]);router[_0x1065('0x8')](_0x1065('0x17'),auth[_0x1065('0x9')](),controller['getAgents']);router[_0x1065('0x18')]('/',auth[_0x1065('0x9')](),controller['create']);router[_0x1065('0x18')]('/:id/dispositions',auth[_0x1065('0x9')](),controller[_0x1065('0x19')]);router[_0x1065('0x18')](_0x1065('0x10'),auth[_0x1065('0x9')](),controller[_0x1065('0x1a')]);router[_0x1065('0x18')]('/:id/interactions',auth[_0x1065('0x9')](),controller['addInteraction']);router['post'](_0x1065('0x14'),auth[_0x1065('0x9')](),controller[_0x1065('0x1b')]);router[_0x1065('0x18')](_0x1065('0x1c'),auth[_0x1065('0x9')](),controller[_0x1065('0x1d')]);router[_0x1065('0x18')]('/updateaccountapplications',auth['isAuthenticated'](),controller[_0x1065('0x1e')]);router['post'](_0x1065('0x1f'),auth[_0x1065('0x9')](),controller[_0x1065('0x20')]);router[_0x1065('0x18')]('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router[_0x1065('0x21')](_0x1065('0xd'),auth['isAuthenticated'](),controller[_0x1065('0x22')]);router[_0x1065('0x23')]('/:id',auth[_0x1065('0x9')](),controller[_0x1065('0x24')]);router['delete']('/:id/dispositions',auth[_0x1065('0x9')](),controller[_0x1065('0x25')]);router[_0x1065('0x23')](_0x1065('0x10'),auth['isAuthenticated'](),controller[_0x1065('0x26')]);router[_0x1065('0x23')]('/:id/users',auth[_0x1065('0x9')](),controller['removeAgents']);module[_0x1065('0x27')]=router; \ No newline at end of file +var _0xf5ea=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getAgents','post','addDisposition','addAnswer','addInteraction','addApplications','/addaccountapplications','/:id/send','/:id/users','addAgents','put','update','delete','removeAnswers','removeAgents','exports','util','express','Router'];(function(_0x375768,_0x453064){var _0x4a49f5=function(_0x276b31){while(--_0x276b31){_0x375768['push'](_0x375768['shift']());}};_0x4a49f5(++_0x453064);}(_0xf5ea,0xc0));var _0xaf5e=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xf5ea[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require('multer');var util=require(_0xaf5e('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xaf5e('0x1'));var router=express[_0xaf5e('0x2')]();var fs_extra=require(_0xaf5e('0x3'));var auth=require(_0xaf5e('0x4'));var interaction=require(_0xaf5e('0x5'));var config=require(_0xaf5e('0x6'));var controller=require(_0xaf5e('0x7'));router[_0xaf5e('0x8')]('/',auth[_0xaf5e('0x9')](),controller[_0xaf5e('0xa')]);router[_0xaf5e('0x8')](_0xaf5e('0xb'),auth[_0xaf5e('0x9')](),controller['describe']);router[_0xaf5e('0x8')](_0xaf5e('0xc'),auth[_0xaf5e('0x9')](),controller[_0xaf5e('0xd')]);router[_0xaf5e('0x8')](_0xaf5e('0xe'),auth['isAuthenticated'](),controller[_0xaf5e('0xf')]);router[_0xaf5e('0x8')](_0xaf5e('0x10'),auth['isAuthenticated'](),controller[_0xaf5e('0x11')]);router[_0xaf5e('0x8')](_0xaf5e('0x12'),auth[_0xaf5e('0x9')](),controller[_0xaf5e('0x13')]);router['get'](_0xaf5e('0x14'),auth[_0xaf5e('0x9')](),controller[_0xaf5e('0x15')]);router[_0xaf5e('0x8')](_0xaf5e('0x16'),auth[_0xaf5e('0x9')](),controller['getMessages']);router['get']('/:id/users',auth[_0xaf5e('0x9')](),controller[_0xaf5e('0x17')]);router[_0xaf5e('0x18')]('/',auth[_0xaf5e('0x9')](),controller['create']);router['post'](_0xaf5e('0xe'),auth[_0xaf5e('0x9')](),controller[_0xaf5e('0x19')]);router[_0xaf5e('0x18')](_0xaf5e('0x10'),auth[_0xaf5e('0x9')](),controller[_0xaf5e('0x1a')]);router['post']('/:id/interactions',auth[_0xaf5e('0x9')](),controller[_0xaf5e('0x1b')]);router['post'](_0xaf5e('0x14'),auth[_0xaf5e('0x9')](),controller[_0xaf5e('0x1c')]);router[_0xaf5e('0x18')](_0xaf5e('0x1d'),auth[_0xaf5e('0x9')](),controller['addAccountApplications']);router['post']('/updateaccountapplications',auth[_0xaf5e('0x9')](),controller['updateAccountApplications']);router[_0xaf5e('0x18')](_0xaf5e('0x1e'),auth[_0xaf5e('0x9')](),controller['send']);router[_0xaf5e('0x18')](_0xaf5e('0x1f'),auth[_0xaf5e('0x9')](),controller[_0xaf5e('0x20')]);router[_0xaf5e('0x21')](_0xaf5e('0xc'),auth[_0xaf5e('0x9')](),controller[_0xaf5e('0x22')]);router[_0xaf5e('0x23')](_0xaf5e('0xc'),auth[_0xaf5e('0x9')](),controller['destroy']);router['delete'](_0xaf5e('0xe'),auth['isAuthenticated'](),controller['removeDispositions']);router[_0xaf5e('0x23')](_0xaf5e('0x10'),auth[_0xaf5e('0x9')](),controller[_0xaf5e('0x24')]);router['delete'](_0xaf5e('0x1f'),auth[_0xaf5e('0x9')](),controller[_0xaf5e('0x25')]);module[_0xaf5e('0x26')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index 8fee4b9..e9023d9 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 _0x43ed=['*,*,*,*','STRING','TEXT'];(function(_0x45ac0c,_0x2f8a58){var _0x4b4074=function(_0x1ddc53){while(--_0x1ddc53){_0x45ac0c['push'](_0x45ac0c['shift']());}};_0x4b4074(++_0x2f8a58);}(_0x43ed,0xd0));var _0xd43e=function(_0x487b0c,_0x14ff74){_0x487b0c=_0x487b0c-0x0;var _0x1adbdc=_0x43ed[_0x487b0c];return _0x1adbdc;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xd43e('0x0')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xd43e('0x1')]()},'description':{'type':Sequelize[_0xd43e('0x0')]},'interval':{'type':Sequelize[_0xd43e('0x0')],'defaultValue':_0xd43e('0x2')}}; \ No newline at end of file +var _0xd224=['INTEGER','STRING','noop','TEXT','*,*,*,*','exports'];(function(_0x3cba93,_0x5c2fd8){var _0x4a2991=function(_0x3cf95b){while(--_0x3cf95b){_0x3cba93['push'](_0x3cba93['shift']());}};_0x4a2991(++_0x5c2fd8);}(_0xd224,0x1a9));var _0x4d22=function(_0x120b45,_0x3d5c8e){_0x120b45=_0x120b45-0x0;var _0x5162db=_0xd224[_0x120b45];return _0x5162db;};'use strict';var Sequelize=require('sequelize');module[_0x4d22('0x0')]={'priority':{'type':Sequelize[_0x4d22('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x4d22('0x2')],'allowNull':![],'defaultValue':_0x4d22('0x3')},'appdata':{'type':Sequelize[_0x4d22('0x4')]()},'description':{'type':Sequelize[_0x4d22('0x2')]},'interval':{'type':Sequelize[_0x4d22('0x2')],'defaultValue':_0x4d22('0x5')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index fa82b79..6322beb 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 _0xfea6=['crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','name','send','index','FaxApplication','rawAttributes','type','key','model','map','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','filter','merge','VIRTUAL','includeAll','findAll','rows','show','params','create','body','catch','find','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x395127,_0x12c853){var _0x2092da=function(_0x3ed91f){while(--_0x3ed91f){_0x395127['push'](_0x395127['shift']());}};_0x2092da(++_0x12c853);}(_0xfea6,0x12c));var _0x6fea=function(_0x90b017,_0x54bdeb){_0x90b017=_0x90b017-0x0;var _0x4cf8d8=_0xfea6[_0x90b017];return _0x4cf8d8;};'use strict';var emlformat=require(_0x6fea('0x0'));var rimraf=require(_0x6fea('0x1'));var zipdir=require(_0x6fea('0x2'));var jsonpatch=require(_0x6fea('0x3'));var rp=require(_0x6fea('0x4'));var moment=require(_0x6fea('0x5'));var BPromise=require(_0x6fea('0x6'));var Mustache=require(_0x6fea('0x7'));var util=require(_0x6fea('0x8'));var path=require(_0x6fea('0x9'));var sox=require(_0x6fea('0xa'));var csv=require(_0x6fea('0xb'));var ejs=require(_0x6fea('0xc'));var fs=require('fs');var fs_extra=require(_0x6fea('0xd'));var _=require(_0x6fea('0xe'));var squel=require(_0x6fea('0xf'));var crypto=require(_0x6fea('0x10'));var jsforce=require(_0x6fea('0x11'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x6fea('0x12'));var Redis=require(_0x6fea('0x13'));var authService=require(_0x6fea('0x14'));var qs=require(_0x6fea('0x15'));var as=require(_0x6fea('0x16'));var hardwareService=require(_0x6fea('0x17'));var logger=require(_0x6fea('0x18'))(_0x6fea('0x19'));var utils=require(_0x6fea('0x1a'));var config=require(_0x6fea('0x1b'));var licenseUtil=require(_0x6fea('0x1c'));var db=require(_0x6fea('0x1d'))['db'];function respondWithStatusCode(_0xec4228,_0x27f1a7){_0x27f1a7=_0x27f1a7||0xcc;return function(_0x3b8bba){if(_0x3b8bba){return _0xec4228[_0x6fea('0x1e')](_0x27f1a7);}return _0xec4228[_0x6fea('0x1f')](_0x27f1a7)[_0x6fea('0x20')]();};}function respondWithResult(_0xd39f90,_0x2c041f){_0x2c041f=_0x2c041f||0xc8;return function(_0xf57c39){if(_0xf57c39){return _0xd39f90['status'](_0x2c041f)[_0x6fea('0x21')](_0xf57c39);}};}function respondWithFilteredResult(_0x1cd05c,_0x4226f5){return function(_0x3accaa){if(_0x3accaa){var _0x2410b5=typeof _0x4226f5[_0x6fea('0x22')]===_0x6fea('0x23')&&typeof _0x4226f5[_0x6fea('0x24')]===_0x6fea('0x23');var _0x2ccd92=_0x3accaa['count'];var _0x370e93=_0x2410b5?0x0:_0x4226f5[_0x6fea('0x22')];var _0x29327e=_0x2410b5?_0x3accaa[_0x6fea('0x25')]:_0x4226f5[_0x6fea('0x22')]+_0x4226f5['limit'];var _0x6846a1;if(_0x29327e>=_0x2ccd92){_0x29327e=_0x2ccd92;_0x6846a1=0xc8;}else{_0x6846a1=0xce;}_0x1cd05c['status'](_0x6846a1);return _0x1cd05c[_0x6fea('0x26')](_0x6fea('0x27'),_0x370e93+'-'+_0x29327e+'/'+_0x2ccd92)[_0x6fea('0x21')](_0x3accaa);}return null;};}function patchUpdates(_0x34c423){return function(_0x1a930d){try{jsonpatch[_0x6fea('0x28')](_0x1a930d,_0x34c423,!![]);}catch(_0x189f54){return BPromise[_0x6fea('0x29')](_0x189f54);}return _0x1a930d[_0x6fea('0x2a')]();};}function saveUpdates(_0x5575b2,_0x449c6f){return function(_0x5db16f){if(_0x5db16f){return _0x5db16f[_0x6fea('0x2b')](_0x5575b2)[_0x6fea('0x2c')](function(_0x2bdb84){return _0x2bdb84;});}return null;};}function removeEntity(_0x123872,_0x1e59d8){return function(_0x46de04){if(_0x46de04){return _0x46de04['destroy']()[_0x6fea('0x2c')](function(){_0x123872[_0x6fea('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x386e23,_0x26e77a){return function(_0x11e16e){if(!_0x11e16e){_0x386e23[_0x6fea('0x1e')](0x194);}return _0x11e16e;};}function handleError(_0x4a3822,_0x3f1926){_0x3f1926=_0x3f1926||0x1f4;return function(_0x3f9960){logger[_0x6fea('0x2d')](_0x3f9960['stack']);if(_0x3f9960[_0x6fea('0x2e')]){delete _0x3f9960[_0x6fea('0x2e')];}_0x4a3822['status'](_0x3f1926)[_0x6fea('0x2f')](_0x3f9960);};}exports[_0x6fea('0x30')]=function(_0x512c4b,_0x5e58d1){var _0x38c9d5={},_0xe38f48={},_0x165892={'count':0x0,'rows':[]};var _0x36e6ed=_['map'](db[_0x6fea('0x31')][_0x6fea('0x32')],function(_0x3bb10c){return{'name':_0x3bb10c['fieldName'],'type':_0x3bb10c[_0x6fea('0x33')][_0x6fea('0x34')]};});_0xe38f48[_0x6fea('0x35')]=_[_0x6fea('0x36')](_0x36e6ed,_0x6fea('0x2e'));_0xe38f48['query']=_[_0x6fea('0x37')](_0x512c4b[_0x6fea('0x38')]);_0xe38f48['filters']=_[_0x6fea('0x39')](_0xe38f48[_0x6fea('0x35')],_0xe38f48[_0x6fea('0x38')]);_0x38c9d5[_0x6fea('0x3a')]=_['intersection'](_0xe38f48[_0x6fea('0x35')],qs[_0x6fea('0x3b')](_0x512c4b[_0x6fea('0x38')][_0x6fea('0x3b')]));_0x38c9d5['attributes']=_0x38c9d5[_0x6fea('0x3a')][_0x6fea('0x3c')]?_0x38c9d5['attributes']:_0xe38f48[_0x6fea('0x35')];if(!_0x512c4b[_0x6fea('0x38')][_0x6fea('0x3d')](_0x6fea('0x3e'))){_0x38c9d5[_0x6fea('0x24')]=qs[_0x6fea('0x24')](_0x512c4b[_0x6fea('0x38')]['limit']);_0x38c9d5[_0x6fea('0x22')]=qs[_0x6fea('0x22')](_0x512c4b['query']['offset']);}_0x38c9d5['order']=qs[_0x6fea('0x3f')](_0x512c4b[_0x6fea('0x38')][_0x6fea('0x3f')]);_0x38c9d5[_0x6fea('0x40')]=qs[_0x6fea('0x41')](_['pick'](_0x512c4b[_0x6fea('0x38')],_0xe38f48[_0x6fea('0x41')]),_0x36e6ed);if(_0x512c4b[_0x6fea('0x38')][_0x6fea('0x42')]){_0x38c9d5[_0x6fea('0x40')]=_[_0x6fea('0x43')](_0x38c9d5[_0x6fea('0x40')],{'$or':_[_0x6fea('0x36')](_0x36e6ed,function(_0x30e9c1){if(_0x30e9c1[_0x6fea('0x33')]!==_0x6fea('0x44')){var _0x472959={};_0x472959[_0x30e9c1[_0x6fea('0x2e')]]={'$like':'%'+_0x512c4b['query']['filter']+'%'};return _0x472959;}})});}_0x38c9d5=_[_0x6fea('0x43')]({},_0x38c9d5,_0x512c4b['options']);var _0x499910={'where':_0x38c9d5[_0x6fea('0x40')]};return db[_0x6fea('0x31')]['count'](_0x499910)[_0x6fea('0x2c')](function(_0x105cad){_0x165892[_0x6fea('0x25')]=_0x105cad;if(_0x512c4b[_0x6fea('0x38')][_0x6fea('0x45')]){_0x38c9d5['include']=[{'all':!![]}];}return db['FaxApplication'][_0x6fea('0x46')](_0x38c9d5);})['then'](function(_0x19b311){_0x165892[_0x6fea('0x47')]=_0x19b311;return _0x165892;})[_0x6fea('0x2c')](respondWithFilteredResult(_0x5e58d1,_0x38c9d5))['catch'](handleError(_0x5e58d1,null));};exports[_0x6fea('0x48')]=function(_0x26ed42,_0x697d86){var _0x6c8b95={'raw':!![],'where':{'id':_0x26ed42[_0x6fea('0x49')]['id']}},_0x3b9944={};_0x3b9944[_0x6fea('0x35')]=_[_0x6fea('0x37')](db[_0x6fea('0x31')]['rawAttributes']);_0x3b9944['query']=_[_0x6fea('0x37')](_0x26ed42[_0x6fea('0x38')]);_0x3b9944[_0x6fea('0x41')]=_[_0x6fea('0x39')](_0x3b9944[_0x6fea('0x35')],_0x3b9944['query']);_0x6c8b95['attributes']=_['intersection'](_0x3b9944['model'],qs[_0x6fea('0x3b')](_0x26ed42[_0x6fea('0x38')][_0x6fea('0x3b')]));_0x6c8b95[_0x6fea('0x3a')]=_0x6c8b95['attributes'][_0x6fea('0x3c')]?_0x6c8b95[_0x6fea('0x3a')]:_0x3b9944[_0x6fea('0x35')];if(_0x26ed42[_0x6fea('0x38')][_0x6fea('0x45')]){_0x6c8b95['include']=[{'all':!![]}];}_0x6c8b95=_[_0x6fea('0x43')]({},_0x6c8b95,_0x26ed42['options']);return db[_0x6fea('0x31')]['find'](_0x6c8b95)[_0x6fea('0x2c')](handleEntityNotFound(_0x697d86,null))[_0x6fea('0x2c')](respondWithResult(_0x697d86,null))['catch'](handleError(_0x697d86,null));};exports[_0x6fea('0x4a')]=function(_0x561774,_0x1ae71b){return db[_0x6fea('0x31')][_0x6fea('0x4a')](_0x561774[_0x6fea('0x4b')],{})[_0x6fea('0x2c')](respondWithResult(_0x1ae71b,0xc9))[_0x6fea('0x4c')](handleError(_0x1ae71b,null));};exports[_0x6fea('0x2b')]=function(_0x485677,_0x42e503){if(_0x485677[_0x6fea('0x4b')]['id']){delete _0x485677[_0x6fea('0x4b')]['id'];}return db[_0x6fea('0x31')][_0x6fea('0x4d')]({'where':{'id':_0x485677[_0x6fea('0x49')]['id']}})[_0x6fea('0x2c')](handleEntityNotFound(_0x42e503,null))[_0x6fea('0x2c')](saveUpdates(_0x485677[_0x6fea('0x4b')],null))[_0x6fea('0x2c')](respondWithResult(_0x42e503,null))[_0x6fea('0x4c')](handleError(_0x42e503,null));};exports[_0x6fea('0x4e')]=function(_0x5d0a6a,_0x20f92b){return db[_0x6fea('0x31')][_0x6fea('0x4d')]({'where':{'id':_0x5d0a6a[_0x6fea('0x49')]['id']}})[_0x6fea('0x2c')](handleEntityNotFound(_0x20f92b,null))[_0x6fea('0x2c')](removeEntity(_0x20f92b,null))[_0x6fea('0x4c')](handleError(_0x20f92b,null));}; \ No newline at end of file +var _0x290d=['rimraf','fast-json-patch','request-promise','moment','util','path','sox','to-csv','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','json','offset','undefined','count','reject','save','update','destroy','error','stack','name','send','FaxApplication','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','then','includeAll','include','findAll','catch','find','create','body','params'];(function(_0x3bef36,_0x43009f){var _0x4838c9=function(_0x292b3a){while(--_0x292b3a){_0x3bef36['push'](_0x3bef36['shift']());}};_0x4838c9(++_0x43009f);}(_0x290d,0xdb));var _0xd290=function(_0x37f614,_0xc94b50){_0x37f614=_0x37f614-0x0;var _0x487bac=_0x290d[_0x37f614];return _0x487bac;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd290('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd290('0x1'));var rp=require(_0xd290('0x2'));var moment=require(_0xd290('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd290('0x4'));var path=require(_0xd290('0x5'));var sox=require(_0xd290('0x6'));var csv=require(_0xd290('0x7'));var ejs=require(_0xd290('0x8'));var fs=require('fs');var fs_extra=require(_0xd290('0x9'));var _=require(_0xd290('0xa'));var squel=require(_0xd290('0xb'));var crypto=require('crypto');var jsforce=require(_0xd290('0xc'));var deskjs=require(_0xd290('0xd'));var toCsv=require(_0xd290('0x7'));var querystring=require(_0xd290('0xe'));var Papa=require(_0xd290('0xf'));var Redis=require(_0xd290('0x10'));var authService=require(_0xd290('0x11'));var qs=require(_0xd290('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd290('0x13'));var logger=require(_0xd290('0x14'))('api');var utils=require(_0xd290('0x15'));var config=require(_0xd290('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xd290('0x17'))['db'];function respondWithStatusCode(_0x9a288c,_0x48dacd){_0x48dacd=_0x48dacd||0xcc;return function(_0x4fec1e){if(_0x4fec1e){return _0x9a288c[_0xd290('0x18')](_0x48dacd);}return _0x9a288c[_0xd290('0x19')](_0x48dacd)[_0xd290('0x1a')]();};}function respondWithResult(_0x3eb629,_0xfa2f1a){_0xfa2f1a=_0xfa2f1a||0xc8;return function(_0x290b2d){if(_0x290b2d){return _0x3eb629[_0xd290('0x19')](_0xfa2f1a)[_0xd290('0x1b')](_0x290b2d);}};}function respondWithFilteredResult(_0x572b45,_0x1072e3){return function(_0x178864){if(_0x178864){var _0x3d4490=typeof _0x1072e3[_0xd290('0x1c')]===_0xd290('0x1d')&&typeof _0x1072e3['limit']===_0xd290('0x1d');var _0x4807d6=_0x178864[_0xd290('0x1e')];var _0x158604=_0x3d4490?0x0:_0x1072e3[_0xd290('0x1c')];var _0x4e984c=_0x3d4490?_0x178864['count']:_0x1072e3[_0xd290('0x1c')]+_0x1072e3['limit'];var _0x1d20fb;if(_0x4e984c>=_0x4807d6){_0x4e984c=_0x4807d6;_0x1d20fb=0xc8;}else{_0x1d20fb=0xce;}_0x572b45['status'](_0x1d20fb);return _0x572b45['set']('Content-Range',_0x158604+'-'+_0x4e984c+'/'+_0x4807d6)[_0xd290('0x1b')](_0x178864);}return null;};}function patchUpdates(_0x48a67f){return function(_0x170601){try{jsonpatch['apply'](_0x170601,_0x48a67f,!![]);}catch(_0x12fe78){return BPromise[_0xd290('0x1f')](_0x12fe78);}return _0x170601[_0xd290('0x20')]();};}function saveUpdates(_0x9aa24e,_0x144837){return function(_0xd3149a){if(_0xd3149a){return _0xd3149a[_0xd290('0x21')](_0x9aa24e)['then'](function(_0x119c37){return _0x119c37;});}return null;};}function removeEntity(_0x383ec9,_0x2bca70){return function(_0x483a18){if(_0x483a18){return _0x483a18[_0xd290('0x22')]()['then'](function(){_0x383ec9[_0xd290('0x19')](0xcc)[_0xd290('0x1a')]();});}};}function handleEntityNotFound(_0x55c4b0,_0x24db07){return function(_0x4a5eb1){if(!_0x4a5eb1){_0x55c4b0[_0xd290('0x18')](0x194);}return _0x4a5eb1;};}function handleError(_0x55b7d8,_0x590b37){_0x590b37=_0x590b37||0x1f4;return function(_0x5b3344){logger[_0xd290('0x23')](_0x5b3344[_0xd290('0x24')]);if(_0x5b3344[_0xd290('0x25')]){delete _0x5b3344[_0xd290('0x25')];}_0x55b7d8['status'](_0x590b37)[_0xd290('0x26')](_0x5b3344);};}exports['index']=function(_0x1a8272,_0x26ce5f){var _0x5beefe={},_0x47ce85={},_0x38e6a7={'count':0x0,'rows':[]};var _0x5d53ff=_['map'](db[_0xd290('0x27')][_0xd290('0x28')],function(_0x49f3bd){return{'name':_0x49f3bd[_0xd290('0x29')],'type':_0x49f3bd[_0xd290('0x2a')][_0xd290('0x2b')]};});_0x47ce85[_0xd290('0x2c')]=_[_0xd290('0x2d')](_0x5d53ff,'name');_0x47ce85[_0xd290('0x2e')]=_[_0xd290('0x2f')](_0x1a8272[_0xd290('0x2e')]);_0x47ce85[_0xd290('0x30')]=_[_0xd290('0x31')](_0x47ce85[_0xd290('0x2c')],_0x47ce85[_0xd290('0x2e')]);_0x5beefe[_0xd290('0x32')]=_['intersection'](_0x47ce85[_0xd290('0x2c')],qs['fields'](_0x1a8272['query'][_0xd290('0x33')]));_0x5beefe[_0xd290('0x32')]=_0x5beefe[_0xd290('0x32')][_0xd290('0x34')]?_0x5beefe[_0xd290('0x32')]:_0x47ce85[_0xd290('0x2c')];if(!_0x1a8272[_0xd290('0x2e')][_0xd290('0x35')](_0xd290('0x36'))){_0x5beefe[_0xd290('0x37')]=qs['limit'](_0x1a8272[_0xd290('0x2e')][_0xd290('0x37')]);_0x5beefe[_0xd290('0x1c')]=qs[_0xd290('0x1c')](_0x1a8272[_0xd290('0x2e')][_0xd290('0x1c')]);}_0x5beefe[_0xd290('0x38')]=qs['sort'](_0x1a8272[_0xd290('0x2e')][_0xd290('0x39')]);_0x5beefe[_0xd290('0x3a')]=qs[_0xd290('0x30')](_[_0xd290('0x3b')](_0x1a8272[_0xd290('0x2e')],_0x47ce85[_0xd290('0x30')]),_0x5d53ff);if(_0x1a8272[_0xd290('0x2e')][_0xd290('0x3c')]){_0x5beefe['where']=_[_0xd290('0x3d')](_0x5beefe[_0xd290('0x3a')],{'$or':_[_0xd290('0x2d')](_0x5d53ff,function(_0x45c351){if(_0x45c351['type']!==_0xd290('0x3e')){var _0x452d8c={};_0x452d8c[_0x45c351['name']]={'$like':'%'+_0x1a8272['query'][_0xd290('0x3c')]+'%'};return _0x452d8c;}})});}_0x5beefe=_[_0xd290('0x3d')]({},_0x5beefe,_0x1a8272[_0xd290('0x3f')]);var _0x5515fd={'where':_0x5beefe[_0xd290('0x3a')]};return db['FaxApplication'][_0xd290('0x1e')](_0x5515fd)[_0xd290('0x40')](function(_0x2d9fc7){_0x38e6a7['count']=_0x2d9fc7;if(_0x1a8272['query'][_0xd290('0x41')]){_0x5beefe[_0xd290('0x42')]=[{'all':!![]}];}return db[_0xd290('0x27')][_0xd290('0x43')](_0x5beefe);})[_0xd290('0x40')](function(_0x320531){_0x38e6a7['rows']=_0x320531;return _0x38e6a7;})[_0xd290('0x40')](respondWithFilteredResult(_0x26ce5f,_0x5beefe))[_0xd290('0x44')](handleError(_0x26ce5f,null));};exports['show']=function(_0xc3aa29,_0x4f8ad4){var _0x2c7212={'raw':!![],'where':{'id':_0xc3aa29['params']['id']}},_0x13da59={};_0x13da59[_0xd290('0x2c')]=_[_0xd290('0x2f')](db[_0xd290('0x27')][_0xd290('0x28')]);_0x13da59[_0xd290('0x2e')]=_[_0xd290('0x2f')](_0xc3aa29[_0xd290('0x2e')]);_0x13da59[_0xd290('0x30')]=_['intersection'](_0x13da59[_0xd290('0x2c')],_0x13da59[_0xd290('0x2e')]);_0x2c7212[_0xd290('0x32')]=_['intersection'](_0x13da59[_0xd290('0x2c')],qs['fields'](_0xc3aa29['query'][_0xd290('0x33')]));_0x2c7212[_0xd290('0x32')]=_0x2c7212[_0xd290('0x32')]['length']?_0x2c7212[_0xd290('0x32')]:_0x13da59[_0xd290('0x2c')];if(_0xc3aa29[_0xd290('0x2e')][_0xd290('0x41')]){_0x2c7212[_0xd290('0x42')]=[{'all':!![]}];}_0x2c7212=_[_0xd290('0x3d')]({},_0x2c7212,_0xc3aa29[_0xd290('0x3f')]);return db[_0xd290('0x27')][_0xd290('0x45')](_0x2c7212)['then'](handleEntityNotFound(_0x4f8ad4,null))[_0xd290('0x40')](respondWithResult(_0x4f8ad4,null))['catch'](handleError(_0x4f8ad4,null));};exports[_0xd290('0x46')]=function(_0x277fb6,_0x4aaac4){return db[_0xd290('0x27')]['create'](_0x277fb6[_0xd290('0x47')],{})['then'](respondWithResult(_0x4aaac4,0xc9))[_0xd290('0x44')](handleError(_0x4aaac4,null));};exports[_0xd290('0x21')]=function(_0x28d434,_0x87a665){if(_0x28d434['body']['id']){delete _0x28d434['body']['id'];}return db['FaxApplication']['find']({'where':{'id':_0x28d434[_0xd290('0x48')]['id']}})[_0xd290('0x40')](handleEntityNotFound(_0x87a665,null))[_0xd290('0x40')](saveUpdates(_0x28d434[_0xd290('0x47')],null))['then'](respondWithResult(_0x87a665,null))[_0xd290('0x44')](handleError(_0x87a665,null));};exports[_0xd290('0x22')]=function(_0x20ad4b,_0x221ef5){return db['FaxApplication'][_0xd290('0x45')]({'where':{'id':_0x20ad4b[_0xd290('0x48')]['id']}})[_0xd290('0x40')](handleEntityNotFound(_0x221ef5,null))['then'](removeEntity(_0x221ef5,null))['catch'](handleError(_0x221ef5,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 5fa1ca8..4b537b4 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 _0x19cc=['path','rimraf','../../config/environment','./faxApplication.attributes','exports','FaxApplication','fax_applications','utf8mb4_unicode_ci','lodash','api','bluebird','request-promise'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x19cc,0xbc));var _0xc19c=function(_0x446208,_0xb483fb){_0x446208=_0x446208-0x0;var _0xe49563=_0x19cc[_0x446208];return _0xe49563;};'use strict';var _=require(_0xc19c('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc19c('0x1'));var moment=require('moment');var BPromise=require(_0xc19c('0x2'));var rp=require(_0xc19c('0x3'));var fs=require('fs');var path=require(_0xc19c('0x4'));var rimraf=require(_0xc19c('0x5'));var config=require(_0xc19c('0x6'));var attributes=require(_0xc19c('0x7'));module[_0xc19c('0x8')]=function(_0x355ba9,_0x2c725b){return _0x355ba9['define'](_0xc19c('0x9'),attributes,{'tableName':_0xc19c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xc19c('0xb')});}; \ No newline at end of file +var _0x9754=['request-promise','rimraf','../../config/environment','exports','define','FaxApplication','utf8mb4_unicode_ci','util','../../config/logger','moment','bluebird'];(function(_0x43576f,_0x1356ed){var _0x4d2466=function(_0x865deb){while(--_0x865deb){_0x43576f['push'](_0x43576f['shift']());}};_0x4d2466(++_0x1356ed);}(_0x9754,0x1d5));var _0x4975=function(_0x54a02c,_0x5944d1){_0x54a02c=_0x54a02c-0x0;var _0x5ca521=_0x9754[_0x54a02c];return _0x5ca521;};'use strict';var _=require('lodash');var util=require(_0x4975('0x0'));var logger=require(_0x4975('0x1'))('api');var moment=require(_0x4975('0x2'));var BPromise=require(_0x4975('0x3'));var rp=require(_0x4975('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4975('0x5'));var config=require(_0x4975('0x6'));var attributes=require('./faxApplication.attributes');module[_0x4975('0x7')]=function(_0x42fa0c,_0xd77bee){return _0x42fa0c[_0x4975('0x8')](_0x4975('0x9'),attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x4975('0xa')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 417074c..adf97d1 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 _0x7378=['FaxApplication,\x20%s,\x20%s','debug','FaxApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','UpdateFaxApplication','FaxApplication','body','options','raw','catch','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info'];(function(_0x3549c4,_0x159994){var _0x1bf9b4=function(_0x795ccd){while(--_0x795ccd){_0x3549c4['push'](_0x3549c4['shift']());}};_0x1bf9b4(++_0x159994);}(_0x7378,0xbd));var _0x8737=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x7378[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var util=require(_0x8737('0x0'));var moment=require(_0x8737('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8737('0x2'));var db=require(_0x8737('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x8737('0x4'))(_0x8737('0x5'));var config=require(_0x8737('0x6'));var jayson=require(_0x8737('0x7'));var client=jayson[_0x8737('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1b1cdd,_0x2d536c,_0x4de10b){return new BPromise(function(_0x10530a,_0xfc04dc){return client[_0x8737('0x9')](_0x1b1cdd,_0x4de10b)['then'](function(_0x3a1fbc){logger[_0x8737('0xa')](_0x8737('0xb'),_0x2d536c,'request\x20sent');logger[_0x8737('0xc')](_0x8737('0xd'),_0x2d536c,_0x8737('0xe'),JSON[_0x8737('0xf')](_0x3a1fbc));if(_0x3a1fbc['error']){if(_0x3a1fbc[_0x8737('0x10')]['code']===0x1f4){logger[_0x8737('0x10')](_0x8737('0xb'),_0x2d536c,_0x3a1fbc[_0x8737('0x10')][_0x8737('0x11')]);return _0xfc04dc(_0x3a1fbc[_0x8737('0x10')]['message']);}logger['error'](_0x8737('0xb'),_0x2d536c,_0x3a1fbc['error'][_0x8737('0x11')]);return _0x10530a(_0x3a1fbc['error'][_0x8737('0x11')]);}else{logger[_0x8737('0xa')](_0x8737('0xb'),_0x2d536c,_0x8737('0xe'));_0x10530a(_0x3a1fbc[_0x8737('0x12')][_0x8737('0x11')]);}})['catch'](function(_0x2b27ac){logger['error']('FaxApplication,\x20%s,\x20%s',_0x2d536c,_0x2b27ac);_0xfc04dc(_0x2b27ac);});});}exports[_0x8737('0x13')]=function(_0x522d5e){var _0x1873e4=this;return new Promise(function(_0xa0c78d,_0x237843){return db[_0x8737('0x14')]['update'](_0x522d5e[_0x8737('0x15')],{'raw':_0x522d5e[_0x8737('0x16')]?_0x522d5e[_0x8737('0x16')][_0x8737('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x522d5e[_0x8737('0x16')]?_0x522d5e[_0x8737('0x16')]['where']||null:null,'attributes':_0x522d5e[_0x8737('0x16')]?_0x522d5e[_0x8737('0x16')]['attributes']||null:null,'limit':_0x522d5e[_0x8737('0x16')]?_0x522d5e[_0x8737('0x16')]['limit']||null:null})['then'](function(_0x4ebfe5){logger[_0x8737('0xa')]('UpdateFaxApplication',_0x522d5e);logger[_0x8737('0xc')]('UpdateFaxApplication',_0x522d5e,JSON['stringify'](_0x4ebfe5));_0xa0c78d(_0x4ebfe5);})[_0x8737('0x18')](function(_0x281593){logger[_0x8737('0x10')](_0x8737('0x13'),_0x281593[_0x8737('0x11')],_0x522d5e);_0x237843(_0x1873e4[_0x8737('0x10')](0x1f4,_0x281593[_0x8737('0x11')]));});});}; \ No newline at end of file +var _0xe93b=['limit','stringify','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','error','code','FaxApplication,\x20%s,\x20%s','message','info','result','catch','UpdateFaxApplication','FaxApplication','update','body','options','where'];(function(_0x29a29f,_0x155ce7){var _0x443ea3=function(_0xe0dd24){while(--_0xe0dd24){_0x29a29f['push'](_0x29a29f['shift']());}};_0x443ea3(++_0x155ce7);}(_0xe93b,0x16a));var _0xbe93=function(_0x47dc5d,_0x1c1055){_0x47dc5d=_0x47dc5d-0x0;var _0x120c38=_0xe93b[_0x47dc5d];return _0x120c38;};'use strict';var _=require(_0xbe93('0x0'));var util=require(_0xbe93('0x1'));var moment=require(_0xbe93('0x2'));var BPromise=require(_0xbe93('0x3'));var rs=require(_0xbe93('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xbe93('0x5'));var logger=require(_0xbe93('0x6'))(_0xbe93('0x7'));var config=require(_0xbe93('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xbe93('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2dd8aa,_0x2d5f9a,_0x3ab63c){return new BPromise(function(_0x396b8c,_0x1edee5){return client[_0xbe93('0xa')](_0x2dd8aa,_0x3ab63c)[_0xbe93('0xb')](function(_0x35ac7f){logger['info']('FaxApplication,\x20%s,\x20%s',_0x2d5f9a,_0xbe93('0xc'));logger[_0xbe93('0xd')](_0xbe93('0xe'),_0x2d5f9a,_0xbe93('0xc'),JSON['stringify'](_0x35ac7f));if(_0x35ac7f[_0xbe93('0xf')]){if(_0x35ac7f[_0xbe93('0xf')][_0xbe93('0x10')]===0x1f4){logger[_0xbe93('0xf')](_0xbe93('0x11'),_0x2d5f9a,_0x35ac7f[_0xbe93('0xf')]['message']);return _0x1edee5(_0x35ac7f['error'][_0xbe93('0x12')]);}logger['error']('FaxApplication,\x20%s,\x20%s',_0x2d5f9a,_0x35ac7f[_0xbe93('0xf')]['message']);return _0x396b8c(_0x35ac7f['error'][_0xbe93('0x12')]);}else{logger[_0xbe93('0x13')](_0xbe93('0x11'),_0x2d5f9a,_0xbe93('0xc'));_0x396b8c(_0x35ac7f[_0xbe93('0x14')][_0xbe93('0x12')]);}})[_0xbe93('0x15')](function(_0x4c159d){logger[_0xbe93('0xf')](_0xbe93('0x11'),_0x2d5f9a,_0x4c159d);_0x1edee5(_0x4c159d);});});}exports[_0xbe93('0x16')]=function(_0x473c98){var _0x45ca1d=this;return new Promise(function(_0xd79b70,_0xcf665d){return db[_0xbe93('0x17')][_0xbe93('0x18')](_0x473c98[_0xbe93('0x19')],{'raw':_0x473c98[_0xbe93('0x1a')]?_0x473c98[_0xbe93('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x473c98[_0xbe93('0x1a')]?_0x473c98[_0xbe93('0x1a')][_0xbe93('0x1b')]||null:null,'attributes':_0x473c98[_0xbe93('0x1a')]?_0x473c98[_0xbe93('0x1a')]['attributes']||null:null,'limit':_0x473c98[_0xbe93('0x1a')]?_0x473c98['options'][_0xbe93('0x1c')]||null:null})[_0xbe93('0xb')](function(_0x5233c7){logger[_0xbe93('0x13')](_0xbe93('0x16'),_0x473c98);logger[_0xbe93('0xd')]('UpdateFaxApplication',_0x473c98,JSON[_0xbe93('0x1d')](_0x5233c7));_0xd79b70(_0x5233c7);})['catch'](function(_0x37178f){logger['error'](_0xbe93('0x16'),_0x37178f['message'],_0x473c98);_0xcf665d(_0x45ca1d[_0xbe93('0xf')](0x1f4,_0x37178f[_0xbe93('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 95f9f28..c97bbd7 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 _0xed3c=['index','show','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','./faxApplication.controller','get','isAuthenticated'];(function(_0x47ee1b,_0x2114db){var _0x8077a0=function(_0x20962c){while(--_0x20962c){_0x47ee1b['push'](_0x47ee1b['shift']());}};_0x8077a0(++_0x2114db);}(_0xed3c,0x1a6));var _0xced3=function(_0x470bfb,_0x389787){_0x470bfb=_0x470bfb-0x0;var _0x2f5d97=_0xed3c[_0x470bfb];return _0x2f5d97;};'use strict';var multer=require(_0xced3('0x0'));var util=require(_0xced3('0x1'));var path=require(_0xced3('0x2'));var timeout=require(_0xced3('0x3'));var express=require('express');var router=express[_0xced3('0x4')]();var fs_extra=require(_0xced3('0x5'));var auth=require(_0xced3('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xced3('0x7'));router[_0xced3('0x8')]('/',auth[_0xced3('0x9')](),controller[_0xced3('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xced3('0xb')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xced3('0xc')](_0xced3('0xd'),auth[_0xced3('0x9')](),controller[_0xced3('0xe')]);router[_0xced3('0xf')]('/:id',auth[_0xced3('0x9')](),controller[_0xced3('0x10')]);module[_0xced3('0x11')]=router; \ No newline at end of file +var _0x955f=['path','connect-timeout','express','fs-extra','../../config/environment','get','isAuthenticated','index','/:id','post','create','put','update','destroy','exports','multer','util'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x955f,0x1eb));var _0xf955=function(_0x5f372b,_0x1819d9){_0x5f372b=_0x5f372b-0x0;var _0x3dbe9c=_0x955f[_0x5f372b];return _0x3dbe9c;};'use strict';var multer=require(_0xf955('0x0'));var util=require(_0xf955('0x1'));var path=require(_0xf955('0x2'));var timeout=require(_0xf955('0x3'));var express=require(_0xf955('0x4'));var router=express['Router']();var fs_extra=require(_0xf955('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf955('0x6'));var controller=require('./faxApplication.controller');router[_0xf955('0x7')]('/',auth[_0xf955('0x8')](),controller[_0xf955('0x9')]);router['get'](_0xf955('0xa'),auth[_0xf955('0x8')](),controller['show']);router[_0xf955('0xb')]('/',auth[_0xf955('0x8')](),controller[_0xf955('0xc')]);router[_0xf955('0xd')](_0xf955('0xa'),auth[_0xf955('0x8')](),controller[_0xf955('0xe')]);router['delete'](_0xf955('0xa'),auth['isAuthenticated'](),controller[_0xf955('0xf')]);module[_0xf955('0x10')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index d6bbc7c..33c7e23 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 _0xed1c=['DATE','ENUM','out','INTEGER','sequelize','exports','STRING'];(function(_0x315b5a,_0x35a000){var _0x4047a5=function(_0x3b25f1){while(--_0x3b25f1){_0x315b5a['push'](_0x315b5a['shift']());}};_0x4047a5(++_0x35a000);}(_0xed1c,0xe4));var _0xced1=function(_0x35a008,_0x475984){_0x35a008=_0x35a008-0x0;var _0x5d9db1=_0xed1c[_0x35a008];return _0x5d9db1;};'use strict';var Sequelize=require(_0xced1('0x0'));module[_0xced1('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xced1('0x2')]},'note':{'type':Sequelize[_0xced1('0x2')]},'read1stAt':{'type':Sequelize[_0xced1('0x3')]},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize[_0xced1('0x4')]('in',_0xced1('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xced1('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xced1('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0xced1('0x6')]}}; \ No newline at end of file +var _0xe3da=['DATE','STRING','ENUM','out','INTEGER','sequelize','exports','BOOLEAN'];(function(_0x4bb2d6,_0x574fe3){var _0xfa04ff=function(_0x14d1a4){while(--_0x14d1a4){_0x4bb2d6['push'](_0x4bb2d6['shift']());}};_0xfa04ff(++_0x574fe3);}(_0xe3da,0x1cd));var _0xae3d=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xe3da[_0x57b54c];return _0x59cc19;};'use strict';var Sequelize=require(_0xae3d('0x0'));module[_0xae3d('0x1')]={'closed':{'type':Sequelize[_0xae3d('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xae3d('0x3')]},'disposition':{'type':Sequelize[_0xae3d('0x4')]},'secondDisposition':{'type':Sequelize[_0xae3d('0x4')]},'thirdDisposition':{'type':Sequelize[_0xae3d('0x4')]},'note':{'type':Sequelize[_0xae3d('0x4')]},'read1stAt':{'type':Sequelize[_0xae3d('0x3')]},'fax':{'type':Sequelize[_0xae3d('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xae3d('0x5')]('in',_0xae3d('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xae3d('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xae3d('0x5')]('in',_0xae3d('0x6')),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0xae3d('0x7')]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index 188c447..b949ad1 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 _0x4b70=['tmp','push','Attachment','Messages','basename','existsSync','createReadStream','pipe','resolve','log','err','rimraf','moment','bluebird','util','lodash','ioredis','../../components/interaction/service','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','end','offset','undefined','limit','count','Content-Range','update','then','destroy','error','stack','name','send','index','map','FaxInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','fax','query','user','show','model','keys','filters','intersection','fields','attributes','length','includeAll','include','options','find','catch','create','body','params','describe','addMessage','omit','ids','getMessages','FaxMessage','hasOwnProperty','nolimit','order','sort','where','pick','FaxInteractionId','filter','merge','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','setTags','spread','Tag','color','emit','faxInteractionTags:save','removeTags','download','join','root','server','files'];(function(_0x481df5,_0x216652){var _0x32726e=function(_0x2133f4){while(--_0x2133f4){_0x481df5['push'](_0x481df5['shift']());}};_0x32726e(++_0x216652);}(_0x4b70,0x19f));var _0x04b7=function(_0x25a762,_0x101bb8){_0x25a762=_0x25a762-0x0;var _0x2e24e4=_0x4b70[_0x25a762];return _0x2e24e4;};'use strict';var rimraf=require(_0x04b7('0x0'));var zipdir=require('zip-dir');var moment=require(_0x04b7('0x1'));var BPromise=require(_0x04b7('0x2'));var util=require(_0x04b7('0x3'));var path=require('path');var fs=require('fs');var _=require(_0x04b7('0x4'));var Redis=require(_0x04b7('0x5'));var interaction=require(_0x04b7('0x6'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x04b7('0x7'));var config=require(_0x04b7('0x8'));var db=require(_0x04b7('0x9'))['db'];config['redis']=_['defaults'](config[_0x04b7('0xa')],{'host':_0x04b7('0xb'),'port':0x18eb});var socket=require(_0x04b7('0xc'))(new Redis(config[_0x04b7('0xa')]));require(_0x04b7('0xd'))[_0x04b7('0xe')](socket);function respondWithStatusCode(_0x59130e,_0x10cea2){_0x10cea2=_0x10cea2||0xcc;return function(_0x205992){if(_0x205992){return _0x59130e[_0x04b7('0xf')](_0x10cea2);}return _0x59130e[_0x04b7('0x10')](_0x10cea2)[_0x04b7('0x11')]();};}function respondWithResult(_0x15627f,_0x242915){_0x242915=_0x242915||0xc8;return function(_0x416eb3){if(_0x416eb3){return _0x15627f[_0x04b7('0x10')](_0x242915)['json'](_0x416eb3);}};}function respondWithFilteredResult(_0x55c864,_0x4ff150){return function(_0x549e7f){if(_0x549e7f){var _0x33a7e4=typeof _0x4ff150[_0x04b7('0x12')]===_0x04b7('0x13')&&typeof _0x4ff150[_0x04b7('0x14')]==='undefined';var _0x2dfe48=_0x549e7f[_0x04b7('0x15')];var _0x37248f=_0x33a7e4?0x0:_0x4ff150[_0x04b7('0x12')];var _0x5f1e50=_0x33a7e4?_0x549e7f['count']:_0x4ff150[_0x04b7('0x12')]+_0x4ff150[_0x04b7('0x14')];var _0x905e9f;if(_0x5f1e50>=_0x2dfe48){_0x5f1e50=_0x2dfe48;_0x905e9f=0xc8;}else{_0x905e9f=0xce;}_0x55c864[_0x04b7('0x10')](_0x905e9f);return _0x55c864['set'](_0x04b7('0x16'),_0x37248f+'-'+_0x5f1e50+'/'+_0x2dfe48)['json'](_0x549e7f);}return null;};}function saveUpdates(_0x3b06e4){return function(_0x1d4362){if(_0x1d4362){return _0x1d4362[_0x04b7('0x17')](_0x3b06e4)[_0x04b7('0x18')](function(_0x4fee61){return _0x4fee61;});}return null;};}function removeEntity(_0x2d69d7){return function(_0x413f0c){if(_0x413f0c){return _0x413f0c[_0x04b7('0x19')]()['then'](function(){_0x2d69d7[_0x04b7('0x10')](0xcc)[_0x04b7('0x11')]();});}};}function handleEntityNotFound(_0x2adb6c){return function(_0x3ed86a){if(!_0x3ed86a){_0x2adb6c['sendStatus'](0x194);}return _0x3ed86a;};}function handleError(_0x15f5ef,_0x1a5c23){_0x1a5c23=_0x1a5c23||0x1f4;return function(_0x2cf119){logger[_0x04b7('0x1a')](_0x2cf119[_0x04b7('0x1b')]);if(_0x2cf119[_0x04b7('0x1c')]){delete _0x2cf119[_0x04b7('0x1c')];}_0x15f5ef['status'](_0x1a5c23)[_0x04b7('0x1d')](_0x2cf119);};}exports[_0x04b7('0x1e')]=function(_0x54ac20,_0x545f7c){var _0x2677e5={};var _0x29704d=_[_0x04b7('0x1f')](db[_0x04b7('0x20')][_0x04b7('0x21')],function(_0x23407b){return{'name':_0x23407b[_0x04b7('0x22')],'type':_0x23407b[_0x04b7('0x23')][_0x04b7('0x24')]};});_0x2677e5=qs[_0x04b7('0x25')](_0x29704d,_0x54ac20);return interaction[_0x04b7('0x26')](_0x04b7('0x27'),_0x54ac20[_0x04b7('0x28')],_0x54ac20[_0x04b7('0x29')],_0x2677e5,_0x29704d)['then'](respondWithFilteredResult(_0x545f7c,_0x2677e5))['catch'](handleError(_0x545f7c,null));};exports[_0x04b7('0x2a')]=function(_0x1bd8fb,_0x40f634){var _0x30af16={'raw':![],'where':{'id':_0x1bd8fb['params']['id']}},_0x16b765={};_0x16b765[_0x04b7('0x2b')]=_[_0x04b7('0x2c')](db[_0x04b7('0x20')][_0x04b7('0x21')]);_0x16b765[_0x04b7('0x28')]=_[_0x04b7('0x2c')](_0x1bd8fb[_0x04b7('0x28')]);_0x16b765[_0x04b7('0x2d')]=_[_0x04b7('0x2e')](_0x16b765[_0x04b7('0x2b')],_0x16b765[_0x04b7('0x28')]);_0x30af16['attributes']=_[_0x04b7('0x2e')](_0x16b765[_0x04b7('0x2b')],qs[_0x04b7('0x2f')](_0x1bd8fb[_0x04b7('0x28')][_0x04b7('0x2f')]));_0x30af16[_0x04b7('0x30')]=_0x30af16['attributes'][_0x04b7('0x31')]?_0x30af16[_0x04b7('0x30')]:_0x16b765['model'];if(_0x1bd8fb[_0x04b7('0x28')][_0x04b7('0x32')]){_0x30af16[_0x04b7('0x33')]=[{'all':!![]}];}_0x30af16=_['merge']({},_0x30af16,_0x1bd8fb[_0x04b7('0x34')]);return db[_0x04b7('0x20')][_0x04b7('0x35')](_0x30af16)[_0x04b7('0x18')](handleEntityNotFound(_0x40f634,null))[_0x04b7('0x18')](respondWithResult(_0x40f634,null))[_0x04b7('0x36')](handleError(_0x40f634,null));};exports[_0x04b7('0x37')]=function(_0x423bf4,_0x4bb11a){return db['FaxInteraction'][_0x04b7('0x37')](_0x423bf4['body'],{})['then'](respondWithResult(_0x4bb11a,0xc9))[_0x04b7('0x36')](handleError(_0x4bb11a,null));};exports[_0x04b7('0x17')]=function(_0x39e433,_0x570f50){if(_0x39e433[_0x04b7('0x38')]['id']){delete _0x39e433[_0x04b7('0x38')]['id'];}return db[_0x04b7('0x20')][_0x04b7('0x35')]({'where':{'id':_0x39e433[_0x04b7('0x39')]['id']}})[_0x04b7('0x18')](handleEntityNotFound(_0x570f50,null))[_0x04b7('0x18')](saveUpdates(_0x39e433[_0x04b7('0x38')],null))[_0x04b7('0x18')](respondWithResult(_0x570f50,null))['catch'](handleError(_0x570f50,null));};exports['destroy']=function(_0x27e9aa,_0x287183){return db[_0x04b7('0x20')][_0x04b7('0x35')]({'where':{'id':_0x27e9aa[_0x04b7('0x39')]['id']}})[_0x04b7('0x18')](handleEntityNotFound(_0x287183,null))[_0x04b7('0x18')](removeEntity(_0x287183,null))[_0x04b7('0x36')](handleError(_0x287183,null));};exports[_0x04b7('0x3a')]=function(_0x59ecb1,_0x2a7845){return db[_0x04b7('0x20')][_0x04b7('0x3a')]()['then'](respondWithResult(_0x2a7845,null))[_0x04b7('0x36')](handleError(_0x2a7845,null));};exports['addMessage']=function(_0x4dc353,_0x2342de){return db['FaxMessage'][_0x04b7('0x35')]({'where':{'id':_0x4dc353[_0x04b7('0x39')]['id']}})[_0x04b7('0x18')](handleEntityNotFound(_0x2342de,null))[_0x04b7('0x18')](function(_0x57b8a6){if(_0x57b8a6){return _0x57b8a6[_0x04b7('0x3b')](_0x4dc353[_0x04b7('0x38')]['ids'],_[_0x04b7('0x3c')](_0x4dc353['body'],[_0x04b7('0x3d'),'id'])||{});}})[_0x04b7('0x18')](respondWithResult(_0x2342de,null))['catch'](handleError(_0x2342de,null));};exports[_0x04b7('0x3e')]=function(_0x30943a,_0x42f2d8){var _0x4283b4={'raw':![],'where':{}};var _0x380d16={};var _0x357111={'count':0x0,'rows':[]};return db['FaxInteraction']['findOne']({'where':{'id':_0x30943a[_0x04b7('0x39')]['id']}})[_0x04b7('0x18')](handleEntityNotFound(_0x42f2d8,null))[_0x04b7('0x18')](function(_0x2e9717){if(_0x2e9717){_0x380d16[_0x04b7('0x2b')]=_[_0x04b7('0x2c')](db[_0x04b7('0x3f')][_0x04b7('0x21')]);_0x380d16[_0x04b7('0x28')]=_['keys'](_0x30943a[_0x04b7('0x28')]);_0x380d16[_0x04b7('0x2d')]=_[_0x04b7('0x2e')](_0x380d16[_0x04b7('0x2b')],_0x380d16['query']);_0x4283b4[_0x04b7('0x30')]=_['intersection'](_0x380d16['model'],qs[_0x04b7('0x2f')](_0x30943a[_0x04b7('0x28')][_0x04b7('0x2f')]));_0x4283b4[_0x04b7('0x30')]=_0x4283b4[_0x04b7('0x30')][_0x04b7('0x31')]?_0x4283b4['attributes']:_0x380d16['model'];if(!_0x30943a[_0x04b7('0x28')][_0x04b7('0x40')](_0x04b7('0x41'))){_0x4283b4[_0x04b7('0x14')]=qs[_0x04b7('0x14')](_0x30943a['query']['limit']);_0x4283b4[_0x04b7('0x12')]=qs['offset'](_0x30943a[_0x04b7('0x28')]['offset']);}_0x4283b4[_0x04b7('0x42')]=qs[_0x04b7('0x43')](_0x30943a[_0x04b7('0x28')][_0x04b7('0x43')]);_0x4283b4[_0x04b7('0x44')]=qs[_0x04b7('0x2d')](_[_0x04b7('0x45')](_0x30943a[_0x04b7('0x28')],_0x380d16[_0x04b7('0x2d')]));_0x4283b4['where'][_0x04b7('0x46')]=_0x2e9717['id'];if(_0x30943a[_0x04b7('0x28')][_0x04b7('0x47')]){_0x4283b4[_0x04b7('0x44')]=_[_0x04b7('0x48')](_0x4283b4[_0x04b7('0x44')],{'$or':_[_0x04b7('0x1f')](_0x4283b4[_0x04b7('0x30')],function(_0x21c8fc){var _0x2cd34a={};_0x2cd34a[_0x21c8fc]={'$like':'%'+_0x30943a[_0x04b7('0x28')]['filter']+'%'};return _0x2cd34a;})});}if(_0x30943a['query'][_0x04b7('0x49')]){var _0x5ae90e=_0x30943a['query'][_0x04b7('0x49')][_0x04b7('0x4a')](',');var _0x1dbef1={};_0x1dbef1[_0x5ae90e[0x0]]={'$gte':moment(_0x5ae90e[0x1])[_0x04b7('0x4b')](_0x04b7('0x4c'))};_0x4283b4['where']=_[_0x04b7('0x48')](_0x4283b4['where'],_0x1dbef1);}_0x4283b4=_[_0x04b7('0x48')]({},_0x4283b4,_0x30943a[_0x04b7('0x34')]);return db[_0x04b7('0x3f')][_0x04b7('0x15')]({'where':_0x4283b4[_0x04b7('0x44')]})[_0x04b7('0x18')](function(_0x3ec505){_0x357111[_0x04b7('0x15')]=_0x3ec505;if(_0x30943a['query']['includeAll']){_0x4283b4[_0x04b7('0x33')]=[{'all':!![]}];}return db[_0x04b7('0x3f')][_0x04b7('0x26')](_0x4283b4);})[_0x04b7('0x18')](function(_0x672c01){_0x357111[_0x04b7('0x4d')]=_0x672c01;return _0x357111;});}})[_0x04b7('0x18')](respondWithFilteredResult(_0x42f2d8,_0x4283b4))[_0x04b7('0x36')](handleError(_0x42f2d8,null));};exports['addTags']=function(_0x50c6e2,_0x3ddc79){return db[_0x04b7('0x20')][_0x04b7('0x35')]({'where':{'id':_0x50c6e2[_0x04b7('0x39')]['id']}})[_0x04b7('0x18')](handleEntityNotFound(_0x3ddc79,null))[_0x04b7('0x18')](function(_0x4bd20f){if(_0x4bd20f){return _0x4bd20f[_0x04b7('0x4e')](_0x50c6e2['body']['ids'],_['omit'](_0x50c6e2[_0x04b7('0x38')],[_0x04b7('0x3d'),'id'])||{})[_0x04b7('0x4f')](function(){return db[_0x04b7('0x50')][_0x04b7('0x26')]({'attributes':['id',_0x04b7('0x1c'),_0x04b7('0x51')],'where':{'id':_0x50c6e2[_0x04b7('0x38')]['ids']}});})['then'](function(_0x2b32fa){socket[_0x04b7('0x52')](_0x04b7('0x53'),{'id':Number(_0x50c6e2[_0x04b7('0x39')]['id']),'tags':_0x2b32fa||[]});return{'id':Number(_0x50c6e2['params']['id']),'tags':_0x2b32fa||[]};});}})['then'](respondWithResult(_0x3ddc79,null))[_0x04b7('0x36')](handleError(_0x3ddc79,null));};exports[_0x04b7('0x54')]=function(_0x72a409,_0x47a687){return db['FaxInteraction'][_0x04b7('0x35')]({'where':{'id':_0x72a409[_0x04b7('0x39')]['id']}})[_0x04b7('0x18')](handleEntityNotFound(_0x47a687,null))[_0x04b7('0x18')](function(_0xd52c16){if(_0xd52c16){return _0xd52c16['removeTags'](_0x72a409['query'][_0x04b7('0x3d')]);}})[_0x04b7('0x18')](respondWithStatusCode(_0x47a687,null))[_0x04b7('0x36')](handleError(_0x47a687,null));};exports[_0x04b7('0x55')]=function(_0xdc778f,_0x46cc2a){var _0x43c078=moment()['unix']()['toString']();var _0x1643b4=path[_0x04b7('0x56')](config[_0x04b7('0x57')],_0x04b7('0x58'),_0x04b7('0x59'),_0x04b7('0x5a'));var _0x287675=path['join'](config['root'],_0x04b7('0x58'),_0x04b7('0x59'),'attachments');var _0x1e5106=path[_0x04b7('0x56')](_0x1643b4,_0x43c078);var _0x3ffe1d=util['format']('transcript-%d-%s.zip',_0xdc778f[_0x04b7('0x39')]['id'],_0x43c078);var _0x44f0c3=path[_0x04b7('0x56')](_0x1643b4,_0x3ffe1d);var _0xd3707d=[];_0xd3707d[_0x04b7('0x5b')]({'model':db[_0x04b7('0x5c')],'as':_0x04b7('0x5c'),'raw':!![]});var _0x333161=[{'model':db[_0x04b7('0x3f')],'as':_0x04b7('0x5d'),'attributes':['id',_0x04b7('0x38'),'createdAt'],'include':_0xd3707d}];return db[_0x04b7('0x20')]['find']({'where':{'id':_0xdc778f[_0x04b7('0x39')]['id']},'include':_0x333161})['then'](handleEntityNotFound(_0x46cc2a,null))[_0x04b7('0x18')](function(_0x2012ca){if(_0x2012ca&&_0x2012ca[_0x04b7('0x5d')]){var _0xc4d720=_0x2012ca['get']({'plain':!![]});fs['mkdirSync'](_0x1e5106);for(var _0x12f92b=0x0;_0x12f92b<_0xc4d720[_0x04b7('0x5d')][_0x04b7('0x31')];_0x12f92b++){var _0x425963=_0xc4d720[_0x04b7('0x5d')][_0x12f92b][_0x04b7('0x5c')];if(_0x425963){var _0xdc5b3=path[_0x04b7('0x56')](_0x287675,_0x425963[_0x04b7('0x5e')]);if(fs[_0x04b7('0x5f')](_0xdc5b3)){fs[_0x04b7('0x60')](_0xdc5b3)[_0x04b7('0x61')](fs['createWriteStream'](path['join'](_0x1e5106,_0x425963[_0x04b7('0x5e')])));}}}return BPromise[_0x04b7('0x62')]()[_0x04b7('0x18')](function(){return new BPromise(function(_0x5729a6,_0x5ae11e){zipdir(_0x1e5106,{'saveTo':_0x44f0c3},function(_0x3f17fc,_0x549500){if(_0x3f17fc)return _0x5ae11e(_0x3f17fc);return _0x5729a6(_0x549500);});})[_0x04b7('0x18')](function(){return new BPromise(function(_0x31b9bf,_0xdb5e12){rimraf(_0x1e5106,function(_0xc93f8b){if(_0xc93f8b)_0xdb5e12(_0xc93f8b);return _0x31b9bf();});});})[_0x04b7('0x18')](function(){return _0x46cc2a[_0x04b7('0x55')](_0x44f0c3,_0x3ffe1d,function(_0x44f4a1){if(_0x44f4a1){console[_0x04b7('0x63')](_0x04b7('0x64'),_0x44f4a1);}else{fs['unlinkSync'](_0x44f0c3);}});});});}else{return _0x46cc2a[_0x04b7('0xf')](0xc8);}})[_0x04b7('0x36')](handleError(_0x46cc2a,null));}; \ No newline at end of file +var _0x7e2c=['index','map','FaxInteraction','rawAttributes','type','getOptions','findAll','query','user','catch','show','params','keys','filters','model','attributes','intersection','fields','length','includeAll','include','merge','options','find','create','body','describe','FaxMessage','addMessage','ids','omit','getMessages','findOne','hasOwnProperty','order','sort','pick','where','FaxInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','spread','faxInteractionTags:save','removeTags','download','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','Attachment','Messages','createdAt','get','mkdirSync','basename','existsSync','createReadStream','createWriteStream','resolve','err','unlinkSync','rimraf','zip-dir','moment','bluebird','util','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','update','then','error','stack','name','send'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x7e2c,0x171));var _0xc7e2=function(_0x46cd90,_0x25b41a){_0x46cd90=_0x46cd90-0x0;var _0x3320b8=_0x7e2c[_0x46cd90];return _0x3320b8;};'use strict';var rimraf=require(_0xc7e2('0x0'));var zipdir=require(_0xc7e2('0x1'));var moment=require(_0xc7e2('0x2'));var BPromise=require(_0xc7e2('0x3'));var util=require(_0xc7e2('0x4'));var path=require('path');var fs=require('fs');var _=require(_0xc7e2('0x5'));var Redis=require(_0xc7e2('0x6'));var interaction=require('../../components/interaction/service');var qs=require(_0xc7e2('0x7'));var logger=require(_0xc7e2('0x8'))(_0xc7e2('0x9'));var config=require('../../config/environment');var db=require(_0xc7e2('0xa'))['db'];config[_0xc7e2('0xb')]=_[_0xc7e2('0xc')](config[_0xc7e2('0xb')],{'host':_0xc7e2('0xd'),'port':0x18eb});var socket=require(_0xc7e2('0xe'))(new Redis(config['redis']));require(_0xc7e2('0xf'))[_0xc7e2('0x10')](socket);function respondWithStatusCode(_0x131e8e,_0x5ea74c){_0x5ea74c=_0x5ea74c||0xcc;return function(_0x43035c){if(_0x43035c){return _0x131e8e[_0xc7e2('0x11')](_0x5ea74c);}return _0x131e8e[_0xc7e2('0x12')](_0x5ea74c)[_0xc7e2('0x13')]();};}function respondWithResult(_0x2cdb4d,_0x4f961c){_0x4f961c=_0x4f961c||0xc8;return function(_0x4e50c0){if(_0x4e50c0){return _0x2cdb4d[_0xc7e2('0x12')](_0x4f961c)[_0xc7e2('0x14')](_0x4e50c0);}};}function respondWithFilteredResult(_0x3db445,_0x3b8895){return function(_0x4c64bc){if(_0x4c64bc){var _0x5733cf=typeof _0x3b8895[_0xc7e2('0x15')]===_0xc7e2('0x16')&&typeof _0x3b8895['limit']==='undefined';var _0x3cbbc8=_0x4c64bc['count'];var _0x7d5258=_0x5733cf?0x0:_0x3b8895[_0xc7e2('0x15')];var _0x29ecd8=_0x5733cf?_0x4c64bc[_0xc7e2('0x17')]:_0x3b8895[_0xc7e2('0x15')]+_0x3b8895[_0xc7e2('0x18')];var _0x3da516;if(_0x29ecd8>=_0x3cbbc8){_0x29ecd8=_0x3cbbc8;_0x3da516=0xc8;}else{_0x3da516=0xce;}_0x3db445[_0xc7e2('0x12')](_0x3da516);return _0x3db445['set']('Content-Range',_0x7d5258+'-'+_0x29ecd8+'/'+_0x3cbbc8)[_0xc7e2('0x14')](_0x4c64bc);}return null;};}function saveUpdates(_0x2c3fb9){return function(_0x20b217){if(_0x20b217){return _0x20b217[_0xc7e2('0x19')](_0x2c3fb9)[_0xc7e2('0x1a')](function(_0x3f70e3){return _0x3f70e3;});}return null;};}function removeEntity(_0x268285){return function(_0x32e815){if(_0x32e815){return _0x32e815['destroy']()[_0xc7e2('0x1a')](function(){_0x268285['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2c23cf){return function(_0x278720){if(!_0x278720){_0x2c23cf[_0xc7e2('0x11')](0x194);}return _0x278720;};}function handleError(_0x2e8d06,_0x11e844){_0x11e844=_0x11e844||0x1f4;return function(_0x27f2de){logger[_0xc7e2('0x1b')](_0x27f2de[_0xc7e2('0x1c')]);if(_0x27f2de[_0xc7e2('0x1d')]){delete _0x27f2de[_0xc7e2('0x1d')];}_0x2e8d06[_0xc7e2('0x12')](_0x11e844)[_0xc7e2('0x1e')](_0x27f2de);};}exports[_0xc7e2('0x1f')]=function(_0xafe89f,_0x12b2a6){var _0x14fb7b={};var _0x207212=_[_0xc7e2('0x20')](db[_0xc7e2('0x21')][_0xc7e2('0x22')],function(_0x1b9d22){return{'name':_0x1b9d22['fieldName'],'type':_0x1b9d22[_0xc7e2('0x23')]['key']};});_0x14fb7b=qs[_0xc7e2('0x24')](_0x207212,_0xafe89f);return interaction[_0xc7e2('0x25')]('fax',_0xafe89f[_0xc7e2('0x26')],_0xafe89f[_0xc7e2('0x27')],_0x14fb7b,_0x207212)['then'](respondWithFilteredResult(_0x12b2a6,_0x14fb7b))[_0xc7e2('0x28')](handleError(_0x12b2a6,null));};exports[_0xc7e2('0x29')]=function(_0x4a6d1b,_0x2f8cb7){var _0x54ba9c={'raw':![],'where':{'id':_0x4a6d1b[_0xc7e2('0x2a')]['id']}},_0x290d9f={};_0x290d9f['model']=_[_0xc7e2('0x2b')](db[_0xc7e2('0x21')][_0xc7e2('0x22')]);_0x290d9f[_0xc7e2('0x26')]=_[_0xc7e2('0x2b')](_0x4a6d1b[_0xc7e2('0x26')]);_0x290d9f[_0xc7e2('0x2c')]=_['intersection'](_0x290d9f[_0xc7e2('0x2d')],_0x290d9f[_0xc7e2('0x26')]);_0x54ba9c[_0xc7e2('0x2e')]=_[_0xc7e2('0x2f')](_0x290d9f[_0xc7e2('0x2d')],qs['fields'](_0x4a6d1b[_0xc7e2('0x26')][_0xc7e2('0x30')]));_0x54ba9c[_0xc7e2('0x2e')]=_0x54ba9c[_0xc7e2('0x2e')][_0xc7e2('0x31')]?_0x54ba9c['attributes']:_0x290d9f[_0xc7e2('0x2d')];if(_0x4a6d1b[_0xc7e2('0x26')][_0xc7e2('0x32')]){_0x54ba9c[_0xc7e2('0x33')]=[{'all':!![]}];}_0x54ba9c=_[_0xc7e2('0x34')]({},_0x54ba9c,_0x4a6d1b[_0xc7e2('0x35')]);return db[_0xc7e2('0x21')][_0xc7e2('0x36')](_0x54ba9c)[_0xc7e2('0x1a')](handleEntityNotFound(_0x2f8cb7,null))[_0xc7e2('0x1a')](respondWithResult(_0x2f8cb7,null))[_0xc7e2('0x28')](handleError(_0x2f8cb7,null));};exports[_0xc7e2('0x37')]=function(_0x58f525,_0x40d7ae){return db['FaxInteraction'][_0xc7e2('0x37')](_0x58f525['body'],{})[_0xc7e2('0x1a')](respondWithResult(_0x40d7ae,0xc9))[_0xc7e2('0x28')](handleError(_0x40d7ae,null));};exports['update']=function(_0x54b1e0,_0x239c4d){if(_0x54b1e0[_0xc7e2('0x38')]['id']){delete _0x54b1e0['body']['id'];}return db['FaxInteraction'][_0xc7e2('0x36')]({'where':{'id':_0x54b1e0['params']['id']}})[_0xc7e2('0x1a')](handleEntityNotFound(_0x239c4d,null))[_0xc7e2('0x1a')](saveUpdates(_0x54b1e0[_0xc7e2('0x38')],null))[_0xc7e2('0x1a')](respondWithResult(_0x239c4d,null))[_0xc7e2('0x28')](handleError(_0x239c4d,null));};exports['destroy']=function(_0x434271,_0xe58ba){return db[_0xc7e2('0x21')]['find']({'where':{'id':_0x434271['params']['id']}})[_0xc7e2('0x1a')](handleEntityNotFound(_0xe58ba,null))[_0xc7e2('0x1a')](removeEntity(_0xe58ba,null))[_0xc7e2('0x28')](handleError(_0xe58ba,null));};exports[_0xc7e2('0x39')]=function(_0x1c5ed1,_0x286180){return db[_0xc7e2('0x21')]['describe']()['then'](respondWithResult(_0x286180,null))[_0xc7e2('0x28')](handleError(_0x286180,null));};exports['addMessage']=function(_0x336152,_0x423a1c){return db[_0xc7e2('0x3a')][_0xc7e2('0x36')]({'where':{'id':_0x336152[_0xc7e2('0x2a')]['id']}})[_0xc7e2('0x1a')](handleEntityNotFound(_0x423a1c,null))[_0xc7e2('0x1a')](function(_0x4d6db4){if(_0x4d6db4){return _0x4d6db4[_0xc7e2('0x3b')](_0x336152[_0xc7e2('0x38')][_0xc7e2('0x3c')],_[_0xc7e2('0x3d')](_0x336152['body'],[_0xc7e2('0x3c'),'id'])||{});}})[_0xc7e2('0x1a')](respondWithResult(_0x423a1c,null))[_0xc7e2('0x28')](handleError(_0x423a1c,null));};exports[_0xc7e2('0x3e')]=function(_0x1a42fd,_0x3a2fcd){var _0x1a193c={'raw':![],'where':{}};var _0x22139b={};var _0x997a={'count':0x0,'rows':[]};return db[_0xc7e2('0x21')][_0xc7e2('0x3f')]({'where':{'id':_0x1a42fd[_0xc7e2('0x2a')]['id']}})[_0xc7e2('0x1a')](handleEntityNotFound(_0x3a2fcd,null))['then'](function(_0x3058c2){if(_0x3058c2){_0x22139b[_0xc7e2('0x2d')]=_[_0xc7e2('0x2b')](db[_0xc7e2('0x3a')][_0xc7e2('0x22')]);_0x22139b[_0xc7e2('0x26')]=_[_0xc7e2('0x2b')](_0x1a42fd[_0xc7e2('0x26')]);_0x22139b[_0xc7e2('0x2c')]=_[_0xc7e2('0x2f')](_0x22139b[_0xc7e2('0x2d')],_0x22139b[_0xc7e2('0x26')]);_0x1a193c[_0xc7e2('0x2e')]=_[_0xc7e2('0x2f')](_0x22139b['model'],qs[_0xc7e2('0x30')](_0x1a42fd[_0xc7e2('0x26')]['fields']));_0x1a193c[_0xc7e2('0x2e')]=_0x1a193c[_0xc7e2('0x2e')][_0xc7e2('0x31')]?_0x1a193c[_0xc7e2('0x2e')]:_0x22139b['model'];if(!_0x1a42fd[_0xc7e2('0x26')][_0xc7e2('0x40')]('nolimit')){_0x1a193c[_0xc7e2('0x18')]=qs['limit'](_0x1a42fd[_0xc7e2('0x26')][_0xc7e2('0x18')]);_0x1a193c[_0xc7e2('0x15')]=qs['offset'](_0x1a42fd['query'][_0xc7e2('0x15')]);}_0x1a193c[_0xc7e2('0x41')]=qs[_0xc7e2('0x42')](_0x1a42fd[_0xc7e2('0x26')][_0xc7e2('0x42')]);_0x1a193c['where']=qs[_0xc7e2('0x2c')](_[_0xc7e2('0x43')](_0x1a42fd['query'],_0x22139b['filters']));_0x1a193c[_0xc7e2('0x44')][_0xc7e2('0x45')]=_0x3058c2['id'];if(_0x1a42fd[_0xc7e2('0x26')][_0xc7e2('0x46')]){_0x1a193c['where']=_[_0xc7e2('0x34')](_0x1a193c['where'],{'$or':_[_0xc7e2('0x20')](_0x1a193c[_0xc7e2('0x2e')],function(_0x5c2e74){var _0x239b82={};_0x239b82[_0x5c2e74]={'$like':'%'+_0x1a42fd[_0xc7e2('0x26')][_0xc7e2('0x46')]+'%'};return _0x239b82;})});}if(_0x1a42fd[_0xc7e2('0x26')][_0xc7e2('0x47')]){var _0x151b71=_0x1a42fd[_0xc7e2('0x26')][_0xc7e2('0x47')][_0xc7e2('0x48')](',');var _0x293fbc={};_0x293fbc[_0x151b71[0x0]]={'$gte':moment(_0x151b71[0x1])[_0xc7e2('0x49')](_0xc7e2('0x4a'))};_0x1a193c[_0xc7e2('0x44')]=_[_0xc7e2('0x34')](_0x1a193c[_0xc7e2('0x44')],_0x293fbc);}_0x1a193c=_[_0xc7e2('0x34')]({},_0x1a193c,_0x1a42fd[_0xc7e2('0x35')]);return db[_0xc7e2('0x3a')][_0xc7e2('0x17')]({'where':_0x1a193c[_0xc7e2('0x44')]})[_0xc7e2('0x1a')](function(_0x4c711e){_0x997a[_0xc7e2('0x17')]=_0x4c711e;if(_0x1a42fd['query']['includeAll']){_0x1a193c['include']=[{'all':!![]}];}return db[_0xc7e2('0x3a')][_0xc7e2('0x25')](_0x1a193c);})[_0xc7e2('0x1a')](function(_0x130f49){_0x997a[_0xc7e2('0x4b')]=_0x130f49;return _0x997a;});}})['then'](respondWithFilteredResult(_0x3a2fcd,_0x1a193c))[_0xc7e2('0x28')](handleError(_0x3a2fcd,null));};exports[_0xc7e2('0x4c')]=function(_0x2c9df6,_0x303a7a){return db['FaxInteraction'][_0xc7e2('0x36')]({'where':{'id':_0x2c9df6[_0xc7e2('0x2a')]['id']}})[_0xc7e2('0x1a')](handleEntityNotFound(_0x303a7a,null))[_0xc7e2('0x1a')](function(_0x1ff955){if(_0x1ff955){return _0x1ff955['setTags'](_0x2c9df6[_0xc7e2('0x38')][_0xc7e2('0x3c')],_[_0xc7e2('0x3d')](_0x2c9df6[_0xc7e2('0x38')],['ids','id'])||{})[_0xc7e2('0x4d')](function(){return db['Tag'][_0xc7e2('0x25')]({'attributes':['id',_0xc7e2('0x1d'),'color'],'where':{'id':_0x2c9df6[_0xc7e2('0x38')][_0xc7e2('0x3c')]}});})[_0xc7e2('0x1a')](function(_0x117f1e){socket['emit'](_0xc7e2('0x4e'),{'id':Number(_0x2c9df6['params']['id']),'tags':_0x117f1e||[]});return{'id':Number(_0x2c9df6[_0xc7e2('0x2a')]['id']),'tags':_0x117f1e||[]};});}})['then'](respondWithResult(_0x303a7a,null))[_0xc7e2('0x28')](handleError(_0x303a7a,null));};exports[_0xc7e2('0x4f')]=function(_0x516eff,_0xd312c5){return db[_0xc7e2('0x21')][_0xc7e2('0x36')]({'where':{'id':_0x516eff[_0xc7e2('0x2a')]['id']}})[_0xc7e2('0x1a')](handleEntityNotFound(_0xd312c5,null))[_0xc7e2('0x1a')](function(_0x3ae99d){if(_0x3ae99d){return _0x3ae99d[_0xc7e2('0x4f')](_0x516eff[_0xc7e2('0x26')][_0xc7e2('0x3c')]);}})[_0xc7e2('0x1a')](respondWithStatusCode(_0xd312c5,null))[_0xc7e2('0x28')](handleError(_0xd312c5,null));};exports[_0xc7e2('0x50')]=function(_0x476151,_0x59f5ea){var _0xa2daaf=moment()['unix']()['toString']();var _0x5a1946=path[_0xc7e2('0x51')](config[_0xc7e2('0x52')],_0xc7e2('0x53'),_0xc7e2('0x54'),_0xc7e2('0x55'));var _0x5a830c=path['join'](config[_0xc7e2('0x52')],_0xc7e2('0x53'),_0xc7e2('0x54'),_0xc7e2('0x56'));var _0x19e4ba=path[_0xc7e2('0x51')](_0x5a1946,_0xa2daaf);var _0x26461b=util[_0xc7e2('0x49')](_0xc7e2('0x57'),_0x476151[_0xc7e2('0x2a')]['id'],_0xa2daaf);var _0x55ebda=path[_0xc7e2('0x51')](_0x5a1946,_0x26461b);var _0x1da9c1=[];_0x1da9c1['push']({'model':db['Attachment'],'as':_0xc7e2('0x58'),'raw':!![]});var _0x5a56d8=[{'model':db['FaxMessage'],'as':_0xc7e2('0x59'),'attributes':['id',_0xc7e2('0x38'),_0xc7e2('0x5a')],'include':_0x1da9c1}];return db[_0xc7e2('0x21')][_0xc7e2('0x36')]({'where':{'id':_0x476151[_0xc7e2('0x2a')]['id']},'include':_0x5a56d8})['then'](handleEntityNotFound(_0x59f5ea,null))[_0xc7e2('0x1a')](function(_0x3f5a7b){if(_0x3f5a7b&&_0x3f5a7b[_0xc7e2('0x59')]){var _0x50e1ec=_0x3f5a7b[_0xc7e2('0x5b')]({'plain':!![]});fs[_0xc7e2('0x5c')](_0x19e4ba);for(var _0x5699b9=0x0;_0x5699b9<_0x50e1ec['Messages'][_0xc7e2('0x31')];_0x5699b9++){var _0x1d11c2=_0x50e1ec['Messages'][_0x5699b9][_0xc7e2('0x58')];if(_0x1d11c2){var _0x27fdc5=path['join'](_0x5a830c,_0x1d11c2[_0xc7e2('0x5d')]);if(fs[_0xc7e2('0x5e')](_0x27fdc5)){fs[_0xc7e2('0x5f')](_0x27fdc5)['pipe'](fs[_0xc7e2('0x60')](path[_0xc7e2('0x51')](_0x19e4ba,_0x1d11c2['basename'])));}}}return BPromise[_0xc7e2('0x61')]()[_0xc7e2('0x1a')](function(){return new BPromise(function(_0x368087,_0x2a420a){zipdir(_0x19e4ba,{'saveTo':_0x55ebda},function(_0x1c47e1,_0x2edbb1){if(_0x1c47e1)return _0x2a420a(_0x1c47e1);return _0x368087(_0x2edbb1);});})[_0xc7e2('0x1a')](function(){return new BPromise(function(_0x453403,_0x176563){rimraf(_0x19e4ba,function(_0x2c1f24){if(_0x2c1f24)_0x176563(_0x2c1f24);return _0x453403();});});})['then'](function(){return _0x59f5ea['download'](_0x55ebda,_0x26461b,function(_0x5e8679){if(_0x5e8679){console['log'](_0xc7e2('0x62'),_0x5e8679);}else{fs[_0xc7e2('0x63')](_0x55ebda);}});});});}else{return _0x59f5ea[_0xc7e2('0x11')](0xc8);}})[_0xc7e2('0x28')](handleError(_0x59f5ea,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 31592a0..10cc861 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 _0x5089=['../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','save','update','getUsers','then','setDataValue','Users','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook'];(function(_0x218a4d,_0x10a963){var _0x594420=function(_0x17c36e){while(--_0x17c36e){_0x218a4d['push'](_0x218a4d['shift']());}};_0x594420(++_0x10a963);}(_0x5089,0x88));var _0x9508=function(_0x2bb66c,_0x36c6c6){_0x2bb66c=_0x2bb66c-0x0;var _0x1e0f98=_0x5089[_0x2bb66c];return _0x1e0f98;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0x9508('0x0'))['db'][_0x9508('0x1')];var FaxMessage=require(_0x9508('0x0'))['db'][_0x9508('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x9508('0x3')](0x0);var events={'afterCreate':_0x9508('0x4'),'afterUpdate':_0x9508('0x5'),'afterDestroy':'remove'};function emitEvent(_0xfdc26c){return function(_0x5aedaa,_0x448dd9,_0x561625){_0x5aedaa[_0x9508('0x6')]({'attributes':['id'],'raw':!![]})[_0x9508('0x7')](function(_0x2af98d){_0x5aedaa[_0x9508('0x8')](_0x9508('0x9'),_0x2af98d['map'](function(_0x1fe073){return{'id':_0x1fe073['id']};}));return FaxMessage[_0x9508('0xa')]({'where':{'FaxInteractionId':_0x5aedaa['id'],'direction':'in','read':![]},'raw':!![]});})[_0x9508('0x7')](function(_0x1529b5){_0x5aedaa[_0x9508('0x8')](_0x9508('0xb'),_0x1529b5[_0x9508('0xc')]);FaxInteractionEvents[_0x9508('0xd')](_0xfdc26c+':'+_0x5aedaa['id'],_0x5aedaa);FaxInteractionEvents[_0x9508('0xd')](_0xfdc26c,_0x5aedaa);_0x561625(null);})[_0x9508('0xe')](_0x561625(null));};}for(var e in events){if(events[_0x9508('0xf')](e)){var event=events[e];FaxInteraction[_0x9508('0x10')](e,emitEvent(event));}}module['exports']=FaxInteractionEvents; \ No newline at end of file +var _0x089f=['setDataValue','map','findAll','unreadMessages','emit','catch','hasOwnProperty','events','../../mysqldb','FaxInteraction','setMaxListeners','update','getUsers','then'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x089f,0x111));var _0xf089=function(_0x2852a6,_0x3c9a60){_0x2852a6=_0x2852a6-0x0;var _0x30239c=_0x089f[_0x2852a6];return _0x30239c;};'use strict';var EventEmitter=require(_0xf089('0x0'));var FaxInteraction=require(_0xf089('0x1'))['db'][_0xf089('0x2')];var FaxMessage=require(_0xf089('0x1'))['db']['FaxMessage'];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xf089('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xf089('0x4'),'afterDestroy':'remove'};function emitEvent(_0x48d09e){return function(_0x2bc713,_0x106bf2,_0x181ccd){_0x2bc713[_0xf089('0x5')]({'attributes':['id'],'raw':!![]})[_0xf089('0x6')](function(_0x28fd83){_0x2bc713[_0xf089('0x7')]('Users',_0x28fd83[_0xf089('0x8')](function(_0x44666c){return{'id':_0x44666c['id']};}));return FaxMessage[_0xf089('0x9')]({'where':{'FaxInteractionId':_0x2bc713['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf089('0x6')](function(_0x2acee8){_0x2bc713['setDataValue'](_0xf089('0xa'),_0x2acee8['length']);FaxInteractionEvents[_0xf089('0xb')](_0x48d09e+':'+_0x2bc713['id'],_0x2bc713);FaxInteractionEvents['emit'](_0x48d09e,_0x2bc713);_0x181ccd(null);})[_0xf089('0xc')](_0x181ccd(null));};}for(var e in events){if(events[_0xf089('0xd')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module['exports']=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 450d714..88f8b32 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 _0xb1fc=['format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','moment','request-promise','rimraf','../../config/environment','./faxInteraction.attributes','define','FaxInteraction','fax_interactions','changed','closed','closedAt'];(function(_0x471b69,_0x38e3b6){var _0x3e1854=function(_0x2dab9d){while(--_0x2dab9d){_0x471b69['push'](_0x471b69['shift']());}};_0x3e1854(++_0x38e3b6);}(_0xb1fc,0xf2));var _0xcb1f=function(_0x4fbb78,_0x273eae){_0x4fbb78=_0x4fbb78-0x0;var _0x5eb3a3=_0xb1fc[_0x4fbb78];return _0x5eb3a3;};'use strict';var _=require(_0xcb1f('0x0'));var util=require(_0xcb1f('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xcb1f('0x2'));var BPromise=require('bluebird');var rp=require(_0xcb1f('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcb1f('0x4'));var config=require(_0xcb1f('0x5'));var attributes=require(_0xcb1f('0x6'));module['exports']=function(_0x48f9c5,_0xede29c){return _0x48f9c5[_0xcb1f('0x7')](_0xcb1f('0x8'),attributes,{'tableName':_0xcb1f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xd21c9e,_0x1849e0,_0xe62505){if(_0xd21c9e[_0xcb1f('0xa')](_0xcb1f('0xb'))){_0xd21c9e[_0xcb1f('0xc')]=moment()[_0xcb1f('0xd')](_0xcb1f('0xe'));}_0xe62505(null,_0xd21c9e);}}});}; \ No newline at end of file +var _0xa8d5=['exports','define','FaxInteraction','changed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x4e2861,_0x199be0){var _0x2265e3=function(_0x469693){while(--_0x469693){_0x4e2861['push'](_0x4e2861['shift']());}};_0x2265e3(++_0x199be0);}(_0xa8d5,0x1b3));var _0x5a8d=function(_0x2ca2b6,_0x1d9b76){_0x2ca2b6=_0x2ca2b6-0x0;var _0x1ea293=_0xa8d5[_0x2ca2b6];return _0x1ea293;};'use strict';var _=require(_0x5a8d('0x0'));var util=require(_0x5a8d('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x5a8d('0x2'));var BPromise=require(_0x5a8d('0x3'));var rp=require(_0x5a8d('0x4'));var fs=require('fs');var path=require(_0x5a8d('0x5'));var rimraf=require('rimraf');var config=require(_0x5a8d('0x6'));var attributes=require('./faxInteraction.attributes');module[_0x5a8d('0x7')]=function(_0x5ee8f0,_0x44e479){return _0x5ee8f0[_0x5a8d('0x8')](_0x5a8d('0x9'),attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x46c6dd,_0x30f53c,_0x4c5977){if(_0x46c6dd[_0x5a8d('0xa')]('closed')){_0x46c6dd[_0x5a8d('0xb')]=moment()['format'](_0x5a8d('0xc'));}_0x4c5977(null,_0x46c6dd);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 48a206b..690c380 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 _0x76cc=['result','catch','UpdateFaxInteraction','FaxInteraction','update','body','options','raw','where','attributes','limit','find','then','ids','omit','spread','AddTags','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxInteraction,\x20%s,\x20%s','message','info'];(function(_0x35e33c,_0x16dd60){var _0x2f854c=function(_0x71410f){while(--_0x71410f){_0x35e33c['push'](_0x35e33c['shift']());}};_0x2f854c(++_0x16dd60);}(_0x76cc,0x130));var _0xc76c=function(_0x5794db,_0x2ee0d4){_0x5794db=_0x5794db-0x0;var _0x1dbfd6=_0x76cc[_0x5794db];return _0x1dbfd6;};'use strict';var _=require(_0xc76c('0x0'));var util=require('util');var moment=require(_0xc76c('0x1'));var BPromise=require('bluebird');var rs=require(_0xc76c('0x2'));var fs=require('fs');var Redis=require(_0xc76c('0x3'));var db=require(_0xc76c('0x4'))['db'];var utils=require(_0xc76c('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xc76c('0x6'));var jayson=require(_0xc76c('0x7'));var client=jayson[_0xc76c('0x8')][_0xc76c('0x9')]({'port':0x232a});config[_0xc76c('0xa')]=_['defaults'](config['redis'],{'host':_0xc76c('0xb'),'port':0x18eb});var socket=require(_0xc76c('0xc'))(new Redis(config[_0xc76c('0xa')]));require(_0xc76c('0xd'))[_0xc76c('0xe')](socket);function respondWithRpcPromise(_0x1bce86,_0x120c68,_0x3c65d4){return new BPromise(function(_0x3a395f,_0x185c8e){return client['request'](_0x1bce86,_0x3c65d4)['then'](function(_0x3fde55){logger['info']('FaxInteraction,\x20%s,\x20%s',_0x120c68,_0xc76c('0xf'));logger[_0xc76c('0x10')](_0xc76c('0x11'),_0x120c68,_0xc76c('0xf'),JSON[_0xc76c('0x12')](_0x3fde55));if(_0x3fde55[_0xc76c('0x13')]){if(_0x3fde55[_0xc76c('0x13')][_0xc76c('0x14')]===0x1f4){logger[_0xc76c('0x13')](_0xc76c('0x15'),_0x120c68,_0x3fde55[_0xc76c('0x13')][_0xc76c('0x16')]);return _0x185c8e(_0x3fde55[_0xc76c('0x13')]['message']);}logger[_0xc76c('0x13')](_0xc76c('0x15'),_0x120c68,_0x3fde55['error']['message']);return _0x3a395f(_0x3fde55[_0xc76c('0x13')][_0xc76c('0x16')]);}else{logger[_0xc76c('0x17')](_0xc76c('0x15'),_0x120c68,_0xc76c('0xf'));_0x3a395f(_0x3fde55[_0xc76c('0x18')]['message']);}})[_0xc76c('0x19')](function(_0x1177f3){logger[_0xc76c('0x13')](_0xc76c('0x15'),_0x120c68,_0x1177f3);_0x185c8e(_0x1177f3);});});}exports[_0xc76c('0x1a')]=function(_0x34c031){var _0x4b8c9c=this;return new Promise(function(_0x47f55f,_0x349abb){return db[_0xc76c('0x1b')][_0xc76c('0x1c')](_0x34c031[_0xc76c('0x1d')],{'raw':_0x34c031[_0xc76c('0x1e')]?_0x34c031['options'][_0xc76c('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x34c031[_0xc76c('0x1e')]?_0x34c031[_0xc76c('0x1e')][_0xc76c('0x20')]||null:null,'attributes':_0x34c031[_0xc76c('0x1e')]?_0x34c031[_0xc76c('0x1e')][_0xc76c('0x21')]||null:null,'limit':_0x34c031['options']?_0x34c031['options'][_0xc76c('0x22')]||null:null})['then'](function(_0x5e5ccf){logger[_0xc76c('0x17')](_0xc76c('0x1a'),_0x34c031);logger[_0xc76c('0x10')](_0xc76c('0x1a'),_0x34c031,JSON[_0xc76c('0x12')](_0x5e5ccf));_0x47f55f(_0x5e5ccf);})[_0xc76c('0x19')](function(_0x5c27cf){logger[_0xc76c('0x13')](_0xc76c('0x1a'),_0x5c27cf[_0xc76c('0x16')],_0x34c031);_0x349abb(_0x4b8c9c[_0xc76c('0x13')](0x1f4,_0x5c27cf['message']));});});};exports['AddTagsToFaxInteraction']=function(_0x102ab4){return new Promise(function(_0x26fce0,_0x665f37){return db[_0xc76c('0x1b')][_0xc76c('0x23')]({'where':_0x102ab4[_0xc76c('0x1e')]?_0x102ab4[_0xc76c('0x1e')][_0xc76c('0x20')]||null:null})[_0xc76c('0x24')](function(_0x34d3b2){if(_0x34d3b2){return _0x34d3b2['addTags'](_0x102ab4[_0xc76c('0x1d')][_0xc76c('0x25')],_[_0xc76c('0x26')](_0x102ab4[_0xc76c('0x1d')],[_0xc76c('0x25'),'id'])||{});}})[_0xc76c('0x27')](function(_0x2a629d){logger[_0xc76c('0x17')](_0xc76c('0x28'),_0x102ab4);logger[_0xc76c('0x10')](_0xc76c('0x28'),_0x102ab4,JSON[_0xc76c('0x12')](_0x2a629d));_0x26fce0(_0x2a629d);})[_0xc76c('0x19')](function(_0xc4f208){logger[_0xc76c('0x13')](_0xc76c('0x28'),_0xc4f208[_0xc76c('0x16')],_0x102ab4);_0x665f37(_this[_0xc76c('0x13')](0x1f4,_0xc4f208[_0xc76c('0x16')]));});});}; \ No newline at end of file +var _0x5a77=['then','addTags','body','ids','omit','AddTags','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','client','http','redis','defaults','localhost','./faxInteraction.socket','FaxInteraction,\x20%s,\x20%s','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','FaxInteraction','update','options','raw','where','UpdateFaxInteraction','AddTagsToFaxInteraction','find'];(function(_0x90ea50,_0x4f896e){var _0x305664=function(_0x1d15b9){while(--_0x1d15b9){_0x90ea50['push'](_0x90ea50['shift']());}};_0x305664(++_0x4f896e);}(_0x5a77,0x9a));var _0x75a7=function(_0xadbfe3,_0x1dc94e){_0xadbfe3=_0xadbfe3-0x0;var _0x569c26=_0x5a77[_0xadbfe3];return _0x569c26;};'use strict';var _=require(_0x75a7('0x0'));var util=require(_0x75a7('0x1'));var moment=require(_0x75a7('0x2'));var BPromise=require('bluebird');var rs=require(_0x75a7('0x3'));var fs=require('fs');var Redis=require(_0x75a7('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x75a7('0x5'));var logger=require(_0x75a7('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x75a7('0x7')][_0x75a7('0x8')]({'port':0x232a});config[_0x75a7('0x9')]=_[_0x75a7('0xa')](config[_0x75a7('0x9')],{'host':_0x75a7('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x75a7('0x9')]));require(_0x75a7('0xc'))['register'](socket);function respondWithRpcPromise(_0xc0cf16,_0x4cbae1,_0x467653){return new BPromise(function(_0x8d7287,_0x4c7c6c){return client['request'](_0xc0cf16,_0x467653)['then'](function(_0x315a9d){logger['info'](_0x75a7('0xd'),_0x4cbae1,'request\x20sent');logger[_0x75a7('0xe')](_0x75a7('0xf'),_0x4cbae1,'request\x20sent',JSON[_0x75a7('0x10')](_0x315a9d));if(_0x315a9d[_0x75a7('0x11')]){if(_0x315a9d[_0x75a7('0x11')][_0x75a7('0x12')]===0x1f4){logger['error'](_0x75a7('0xd'),_0x4cbae1,_0x315a9d['error']['message']);return _0x4c7c6c(_0x315a9d['error'][_0x75a7('0x13')]);}logger['error'](_0x75a7('0xd'),_0x4cbae1,_0x315a9d[_0x75a7('0x11')][_0x75a7('0x13')]);return _0x8d7287(_0x315a9d[_0x75a7('0x11')][_0x75a7('0x13')]);}else{logger[_0x75a7('0x14')](_0x75a7('0xd'),_0x4cbae1,'request\x20sent');_0x8d7287(_0x315a9d[_0x75a7('0x15')][_0x75a7('0x13')]);}})[_0x75a7('0x16')](function(_0x3d0fdd){logger['error']('FaxInteraction,\x20%s,\x20%s',_0x4cbae1,_0x3d0fdd);_0x4c7c6c(_0x3d0fdd);});});}exports['UpdateFaxInteraction']=function(_0x672c4){var _0x279abd=this;return new Promise(function(_0x5e4545,_0x3f5380){return db[_0x75a7('0x17')][_0x75a7('0x18')](_0x672c4['body'],{'raw':_0x672c4[_0x75a7('0x19')]?_0x672c4[_0x75a7('0x19')][_0x75a7('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x672c4[_0x75a7('0x19')]?_0x672c4[_0x75a7('0x19')][_0x75a7('0x1b')]||null:null,'attributes':_0x672c4[_0x75a7('0x19')]?_0x672c4['options']['attributes']||null:null,'limit':_0x672c4[_0x75a7('0x19')]?_0x672c4[_0x75a7('0x19')]['limit']||null:null})['then'](function(_0x226460){logger[_0x75a7('0x14')]('UpdateFaxInteraction',_0x672c4);logger[_0x75a7('0xe')](_0x75a7('0x1c'),_0x672c4,JSON[_0x75a7('0x10')](_0x226460));_0x5e4545(_0x226460);})[_0x75a7('0x16')](function(_0x416e1a){logger['error'](_0x75a7('0x1c'),_0x416e1a[_0x75a7('0x13')],_0x672c4);_0x3f5380(_0x279abd['error'](0x1f4,_0x416e1a[_0x75a7('0x13')]));});});};exports[_0x75a7('0x1d')]=function(_0x466179){return new Promise(function(_0x40cd1d,_0x4fea43){return db['FaxInteraction'][_0x75a7('0x1e')]({'where':_0x466179[_0x75a7('0x19')]?_0x466179[_0x75a7('0x19')][_0x75a7('0x1b')]||null:null})[_0x75a7('0x1f')](function(_0x3b9804){if(_0x3b9804){return _0x3b9804[_0x75a7('0x20')](_0x466179[_0x75a7('0x21')][_0x75a7('0x22')],_[_0x75a7('0x23')](_0x466179[_0x75a7('0x21')],['ids','id'])||{});}})['spread'](function(_0x5b4eab){logger[_0x75a7('0x14')]('AddTags',_0x466179);logger[_0x75a7('0xe')](_0x75a7('0x24'),_0x466179,JSON[_0x75a7('0x10')](_0x5b4eab));_0x40cd1d(_0x5b4eab);})[_0x75a7('0x16')](function(_0x458c54){logger[_0x75a7('0x11')](_0x75a7('0x24'),_0x458c54[_0x75a7('0x13')],_0x466179);_0x4fea43(_this[_0x75a7('0x11')](0x1f4,_0x458c54['message']));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 9ded1dc..319f5bc 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 _0xf105=['update','removeListener','register','length','./faxInteraction.events','save','remove'];(function(_0x1754db,_0x3e32f7){var _0x273e77=function(_0x2c71c3){while(--_0x2c71c3){_0x1754db['push'](_0x1754db['shift']());}};_0x273e77(++_0x3e32f7);}(_0xf105,0x185));var _0x5f10=function(_0x3a955f,_0x1a57f6){_0x3a955f=_0x3a955f-0x0;var _0x4dccc9=_0xf105[_0x3a955f];return _0x4dccc9;};'use strict';var FaxInteractionEvents=require(_0x5f10('0x0'));var events=[_0x5f10('0x1'),_0x5f10('0x2'),_0x5f10('0x3')];function createListener(_0x4e05cb,_0x4cd87c){return function(_0x4029e6){_0x4cd87c['emit'](_0x4e05cb,_0x4029e6);};}function removeListener(_0x1ace41,_0x15b59d){return function(){FaxInteractionEvents[_0x5f10('0x4')](_0x1ace41,_0x15b59d);};}exports[_0x5f10('0x5')]=function(_0x31a4d5){for(var _0x444dc4=0x0,_0x54a3e8=events[_0x5f10('0x6')];_0x444dc4<_0x54a3e8;_0x444dc4++){var _0x1109cb=events[_0x444dc4];var _0x325831=createListener('faxInteraction:'+_0x1109cb,_0x31a4d5);FaxInteractionEvents['on'](_0x1109cb,_0x325831);}}; \ No newline at end of file +var _0x6a2b=['remove','update','emit','register','length','faxInteraction:','./faxInteraction.events','save'];(function(_0x3f5dce,_0x4ec6ca){var _0x110567=function(_0x2ff55c){while(--_0x2ff55c){_0x3f5dce['push'](_0x3f5dce['shift']());}};_0x110567(++_0x4ec6ca);}(_0x6a2b,0x1b6));var _0xb6a2=function(_0x2847d0,_0x10a787){_0x2847d0=_0x2847d0-0x0;var _0x1cc209=_0x6a2b[_0x2847d0];return _0x1cc209;};'use strict';var FaxInteractionEvents=require(_0xb6a2('0x0'));var events=[_0xb6a2('0x1'),_0xb6a2('0x2'),_0xb6a2('0x3')];function createListener(_0x2807f3,_0x43d786){return function(_0x1248ce){_0x43d786[_0xb6a2('0x4')](_0x2807f3,_0x1248ce);};}function removeListener(_0x187363,_0x260014){return function(){FaxInteractionEvents['removeListener'](_0x187363,_0x260014);};}exports[_0xb6a2('0x5')]=function(_0x3e2778){for(var _0x87f80c=0x0,_0x1df8b6=events[_0xb6a2('0x6')];_0x87f80c<_0x1df8b6;_0x87f80c++){var _0x4d31f5=events[_0x87f80c];var _0x5a01f2=createListener(_0xb6a2('0x7')+_0x4d31f5,_0x3e2778);FaxInteractionEvents['on'](_0x4d31f5,_0x5a01f2);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 2d61f77..ee64e9b 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 _0xe594=['../../components/auth/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','/:id','show','/:id/messages','/:id/download','post','create','addMessage','/:id/tags','tracked','addTags','put','faxinteraction:update','update','fax','destroy','removeTags','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x458d79,_0x5c8a15){var _0x516b05=function(_0xb2f030){while(--_0xb2f030){_0x458d79['push'](_0x458d79['shift']());}};_0x516b05(++_0x5c8a15);}(_0xe594,0x66));var _0x4e59=function(_0x15a6e7,_0x25ca23){_0x15a6e7=_0x15a6e7-0x0;var _0x242f62=_0xe594[_0x15a6e7];return _0x242f62;};'use strict';var multer=require(_0x4e59('0x0'));var util=require('util');var path=require(_0x4e59('0x1'));var timeout=require(_0x4e59('0x2'));var express=require(_0x4e59('0x3'));var router=express[_0x4e59('0x4')]();var fs_extra=require(_0x4e59('0x5'));var auth=require(_0x4e59('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x4e59('0x7'));var controller=require(_0x4e59('0x8'));router[_0x4e59('0x9')]('/',auth[_0x4e59('0xa')](),controller['index']);router[_0x4e59('0x9')]('/describe',auth[_0x4e59('0xa')](),controller['describe']);router[_0x4e59('0x9')](_0x4e59('0xb'),auth[_0x4e59('0xa')](),controller[_0x4e59('0xc')]);router[_0x4e59('0x9')](_0x4e59('0xd'),auth[_0x4e59('0xa')](),controller['getMessages']);router[_0x4e59('0x9')](_0x4e59('0xe'),auth[_0x4e59('0xa')](),controller['download']);router[_0x4e59('0xf')]('/',auth['isAuthenticated'](),controller[_0x4e59('0x10')]);router['post'](_0x4e59('0xd'),auth[_0x4e59('0xa')](),controller[_0x4e59('0x11')]);router['post'](_0x4e59('0x12'),auth['isAuthenticated'](),interaction[_0x4e59('0x13')]('fax','faxinteraction:addtags'),controller[_0x4e59('0x14')]);router[_0x4e59('0x15')](_0x4e59('0xb'),auth[_0x4e59('0xa')](),interaction[_0x4e59('0x13')]('fax',_0x4e59('0x16')),controller[_0x4e59('0x17')]);router['delete'](_0x4e59('0xb'),auth[_0x4e59('0xa')](),interaction[_0x4e59('0x13')](_0x4e59('0x18'),'faxinteraction:destroy'),controller[_0x4e59('0x19')]);router['delete']('/:id/tags',auth[_0x4e59('0xa')](),controller[_0x4e59('0x1a')]);module['exports']=router; \ No newline at end of file +var _0xa61d=['/:id/tags','removeTags','exports','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/messages','getMessages','download','post','addMessage','fax','faxinteraction:addtags','addTags','put','tracked','faxinteraction:update','update','faxinteraction:destroy','destroy'];(function(_0x478bc3,_0x4864b7){var _0x216cd8=function(_0x17d0ef){while(--_0x17d0ef){_0x478bc3['push'](_0x478bc3['shift']());}};_0x216cd8(++_0x4864b7);}(_0xa61d,0x7f));var _0xda61=function(_0x5668db,_0x149b9a){_0x5668db=_0x5668db-0x0;var _0x9335dc=_0xa61d[_0x5668db];return _0x9335dc;};'use strict';var multer=require(_0xda61('0x0'));var util=require(_0xda61('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xda61('0x2'));var router=express['Router']();var fs_extra=require(_0xda61('0x3'));var auth=require(_0xda61('0x4'));var interaction=require(_0xda61('0x5'));var config=require(_0xda61('0x6'));var controller=require(_0xda61('0x7'));router[_0xda61('0x8')]('/',auth[_0xda61('0x9')](),controller[_0xda61('0xa')]);router[_0xda61('0x8')](_0xda61('0xb'),auth[_0xda61('0x9')](),controller['describe']);router[_0xda61('0x8')](_0xda61('0xc'),auth[_0xda61('0x9')](),controller[_0xda61('0xd')]);router[_0xda61('0x8')](_0xda61('0xe'),auth[_0xda61('0x9')](),controller[_0xda61('0xf')]);router[_0xda61('0x8')]('/:id/download',auth[_0xda61('0x9')](),controller[_0xda61('0x10')]);router[_0xda61('0x11')]('/',auth[_0xda61('0x9')](),controller['create']);router[_0xda61('0x11')](_0xda61('0xe'),auth['isAuthenticated'](),controller[_0xda61('0x12')]);router[_0xda61('0x11')]('/:id/tags',auth[_0xda61('0x9')](),interaction['tracked'](_0xda61('0x13'),_0xda61('0x14')),controller[_0xda61('0x15')]);router[_0xda61('0x16')]('/:id',auth[_0xda61('0x9')](),interaction[_0xda61('0x17')]('fax',_0xda61('0x18')),controller[_0xda61('0x19')]);router['delete'](_0xda61('0xc'),auth['isAuthenticated'](),interaction['tracked']('fax',_0xda61('0x1a')),controller[_0xda61('0x1b')]);router['delete'](_0xda61('0x1c'),auth[_0xda61('0x9')](),controller[_0xda61('0x1d')]);module[_0xda61('0x1e')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 22e58d5..b9e516b 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 _0x3248=['exports','BOOLEAN','ENUM','out','TEXT','DATE'];(function(_0x33dd5f,_0x4cbe7c){var _0x5c3713=function(_0x1093d3){while(--_0x1093d3){_0x33dd5f['push'](_0x33dd5f['shift']());}};_0x5c3713(++_0x4cbe7c);}(_0x3248,0x1bc));var _0x8324=function(_0x4ab1ba,_0x161a41){_0x4ab1ba=_0x4ab1ba-0x0;var _0x1042c9=_0x3248[_0x4ab1ba];return _0x1042c9;};'use strict';var Sequelize=require('sequelize');module[_0x8324('0x0')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x8324('0x1')],'defaultValue':![]},'direction':{'type':Sequelize[_0x8324('0x2')]('in',_0x8324('0x3')),'defaultValue':_0x8324('0x3'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x8324('0x4')],'defaultValue':null},'readAt':{'type':Sequelize[_0x8324('0x5')]}}; \ No newline at end of file +var _0xc831=['exports','TEXT','medium','BOOLEAN','ENUM','out','DATE'];(function(_0x1466ba,_0x4cd93e){var _0x56a71b=function(_0x1eb2d3){while(--_0x1eb2d3){_0x1466ba['push'](_0x1466ba['shift']());}};_0x56a71b(++_0x4cd93e);}(_0xc831,0x103));var _0x1c83=function(_0x383cfe,_0x4b8cdb){_0x383cfe=_0x383cfe-0x0;var _0x57925f=_0xc831[_0x383cfe];return _0x57925f;};'use strict';var Sequelize=require('sequelize');module[_0x1c83('0x0')]={'body':{'type':Sequelize[_0x1c83('0x1')](_0x1c83('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x1c83('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x1c83('0x4')]('in',_0x1c83('0x5')),'defaultValue':_0x1c83('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x1c83('0x1')],'defaultValue':null},'readAt':{'type':Sequelize[_0x1c83('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 753c209..6dc1d9d 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 _0x158a=['isNil','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','download','join','root','server','files','attachments','Attachment','util','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','jayson/promise','client','http','then','FaxMessage,\x20%s,\x20%s','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','json','undefined','offset','count','status','set','Content-Range','update','destroy','end','stack','name','send','index','FaxMessage','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','show','params','rawAttributes','find','body','describe','accept','sms','acceptMessage','fax','reject','UserId','user','agent','get','FaxInteraction','FaxInteractionId','interaction','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','ContactId','sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','interface','format','SIP/%s','channel','motionChannel','event','EventManager','rejectmessage','create','findOne','AttachmentId','SendFax'];(function(_0xd34c38,_0x455c59){var _0xd180d6=function(_0x4a9cd4){while(--_0x4a9cd4){_0xd34c38['push'](_0xd34c38['shift']());}};_0xd180d6(++_0x455c59);}(_0x158a,0x7c));var _0xa158=function(_0x277651,_0x22fb4f){_0x277651=_0x277651-0x0;var _0x4a3eb1=_0x158a[_0x277651];return _0x4a3eb1;};'use strict';var util=require(_0xa158('0x0'));var path=require('path');var _=require('lodash');var Redis=require('ioredis');var interactionService=require('../../components/interaction/service');var qs=require('../../components/parsers/qs');var logger=require(_0xa158('0x1'))('api');var config=require(_0xa158('0x2'));var db=require(_0xa158('0x3'))['db'];config[_0xa158('0x4')]=_[_0xa158('0x5')](config['redis'],{'host':_0xa158('0x6'),'port':0x18eb});var socket=require(_0xa158('0x7'))(new Redis(config[_0xa158('0x4')]));require(_0xa158('0x8'))['register'](socket);var jayson=require(_0xa158('0x9'));var client=jayson[_0xa158('0xa')]['http']({'port':0x232c});var client9002=jayson['client'][_0xa158('0xb')]({'port':0x232a});var interaction_log=require(_0xa158('0x1'))('fax-interactions');function respondWithRpcPromise(_0x6a2c7b,_0x29d575,_0x36e490,_0x486f18){return new Promise(function(_0x1fc7f1,_0x42dc68){var _0x1277bd=_0x486f18||client;return _0x1277bd['request'](_0x6a2c7b,_0x36e490)[_0xa158('0xc')](function(_0x1f727e){logger['info'](_0xa158('0xd'),_0x29d575,_0xa158('0xe'));logger['debug'](_0xa158('0xf'),_0x29d575,_0xa158('0xe'),JSON[_0xa158('0x10')](_0x1f727e));if(_0x1f727e[_0xa158('0x11')]){if(_0x1f727e[_0xa158('0x11')][_0xa158('0x12')]===0x1f4){logger[_0xa158('0x11')]('FaxMessage,\x20%s,\x20%s',_0x29d575,_0x1f727e[_0xa158('0x11')][_0xa158('0x13')]);return _0x42dc68(_0x1f727e[_0xa158('0x11')][_0xa158('0x13')]);}logger[_0xa158('0x11')]('FaxMessage,\x20%s,\x20%s',_0x29d575,_0x1f727e[_0xa158('0x11')][_0xa158('0x13')]);return _0x1fc7f1(_0x1f727e[_0xa158('0x11')][_0xa158('0x13')]);}else{logger[_0xa158('0x14')](_0xa158('0xd'),_0x29d575,_0xa158('0xe'));_0x1fc7f1(_0x1f727e[_0xa158('0x15')]['message']);}})[_0xa158('0x16')](function(_0x4835e5){logger[_0xa158('0x11')]('FaxMessage,\x20%s,\x20%s',_0x29d575,_0x4835e5);_0x42dc68(_0x4835e5);});});}function respondWithResult(_0x1c4bb2,_0x372bc5){_0x372bc5=_0x372bc5||0xc8;return function(_0x58125c){if(_0x58125c){return _0x1c4bb2['status'](_0x372bc5)[_0xa158('0x17')](_0x58125c);}};}function respondWithFilteredResult(_0x1dd414,_0x44823d){return function(_0x21c8ed){if(_0x21c8ed){var _0x104d04=typeof _0x44823d['offset']===_0xa158('0x18')&&typeof _0x44823d['limit']===_0xa158('0x18');var _0x853475=_0x21c8ed['count'];var _0x22f251=_0x104d04?0x0:_0x44823d[_0xa158('0x19')];var _0x443dbf=_0x104d04?_0x21c8ed[_0xa158('0x1a')]:_0x44823d[_0xa158('0x19')]+_0x44823d['limit'];var _0x344492;if(_0x443dbf>=_0x853475){_0x443dbf=_0x853475;_0x344492=0xc8;}else{_0x344492=0xce;}_0x1dd414[_0xa158('0x1b')](_0x344492);return _0x1dd414[_0xa158('0x1c')](_0xa158('0x1d'),_0x22f251+'-'+_0x443dbf+'/'+_0x853475)[_0xa158('0x17')](_0x21c8ed);}return null;};}function saveUpdates(_0xa8b5d){return function(_0x14e470){if(_0x14e470){return _0x14e470[_0xa158('0x1e')](_0xa8b5d)[_0xa158('0xc')](function(_0x469944){return _0x469944;});}return null;};}function removeEntity(_0x1b1bd3){return function(_0x1aa606){if(_0x1aa606){return _0x1aa606[_0xa158('0x1f')]()[_0xa158('0xc')](function(){_0x1b1bd3[_0xa158('0x1b')](0xcc)[_0xa158('0x20')]();});}};}function handleEntityNotFound(_0x49ebf1){return function(_0xcafedc){if(!_0xcafedc){_0x49ebf1['sendStatus'](0x194);}return _0xcafedc;};}function handleError(_0x4ccf3f,_0x3a18a5){_0x3a18a5=_0x3a18a5||0x1f4;return function(_0x3c716f){logger[_0xa158('0x11')](_0x3c716f[_0xa158('0x21')]);if(_0x3c716f[_0xa158('0x22')]){delete _0x3c716f['name'];}_0x4ccf3f['status'](_0x3a18a5)[_0xa158('0x23')](_0x3c716f);};}exports[_0xa158('0x24')]=function(_0x510437,_0x5a4a82){var _0x42fe6e={},_0x5a5dee={},_0x54e1e0={'count':0x0,'rows':[]};var _0x51aee2=_['map'](db[_0xa158('0x25')]['rawAttributes'],function(_0x4066c9){return{'name':_0x4066c9['fieldName'],'type':_0x4066c9[_0xa158('0x26')]['key']};});_0x5a5dee[_0xa158('0x27')]=_['map'](_0x51aee2,'name');_0x5a5dee[_0xa158('0x28')]=_[_0xa158('0x29')](_0x510437[_0xa158('0x28')]);_0x5a5dee[_0xa158('0x2a')]=_[_0xa158('0x2b')](_0x5a5dee['model'],_0x5a5dee[_0xa158('0x28')]);_0x42fe6e['attributes']=_[_0xa158('0x2b')](_0x5a5dee[_0xa158('0x27')],qs['fields'](_0x510437[_0xa158('0x28')][_0xa158('0x2c')]));_0x42fe6e[_0xa158('0x2d')]=_0x42fe6e[_0xa158('0x2d')][_0xa158('0x2e')]?_0x42fe6e[_0xa158('0x2d')]:_0x5a5dee[_0xa158('0x27')];if(!_0x510437[_0xa158('0x28')][_0xa158('0x2f')](_0xa158('0x30'))){_0x42fe6e[_0xa158('0x31')]=qs[_0xa158('0x31')](_0x510437[_0xa158('0x28')][_0xa158('0x31')]);_0x42fe6e['offset']=qs['offset'](_0x510437[_0xa158('0x28')]['offset']);}_0x42fe6e[_0xa158('0x32')]=qs[_0xa158('0x33')](_0x510437[_0xa158('0x28')]['sort']);_0x42fe6e['where']=qs[_0xa158('0x2a')](_['pick'](_0x510437['query'],_0x5a5dee[_0xa158('0x2a')]),_0x51aee2);if(_0x510437[_0xa158('0x28')]['filter']){_0x42fe6e[_0xa158('0x34')]=_[_0xa158('0x35')](_0x42fe6e[_0xa158('0x34')],{'$or':_['map'](_0x51aee2,function(_0x653f4){if(_0x653f4[_0xa158('0x26')]!==_0xa158('0x36')){var _0x6047e={};_0x6047e[_0x653f4[_0xa158('0x22')]]={'$like':'%'+_0x510437['query'][_0xa158('0x37')]+'%'};return _0x6047e;}})});}_0x42fe6e=_[_0xa158('0x35')]({},_0x42fe6e,_0x510437[_0xa158('0x38')]);var _0x197847={'where':_0x42fe6e[_0xa158('0x34')]};return db['FaxMessage'][_0xa158('0x1a')](_0x197847)[_0xa158('0xc')](function(_0x590f18){_0x54e1e0[_0xa158('0x1a')]=_0x590f18;if(_0x510437[_0xa158('0x28')][_0xa158('0x39')]){_0x42fe6e['include']=[{'all':!![]}];}return db[_0xa158('0x25')][_0xa158('0x3a')](_0x42fe6e);})[_0xa158('0xc')](function(_0x54f3b7){_0x54e1e0[_0xa158('0x3b')]=_0x54f3b7;return _0x54e1e0;})[_0xa158('0xc')](respondWithFilteredResult(_0x5a4a82,_0x42fe6e))[_0xa158('0x16')](handleError(_0x5a4a82,null));};exports[_0xa158('0x3c')]=function(_0x4db40e,_0xd44f3e){var _0xf8e5d8={'raw':!![],'where':{'id':_0x4db40e[_0xa158('0x3d')]['id']}},_0x2020f3={};_0x2020f3['model']=_[_0xa158('0x29')](db[_0xa158('0x25')][_0xa158('0x3e')]);_0x2020f3['query']=_['keys'](_0x4db40e['query']);_0x2020f3['filters']=_[_0xa158('0x2b')](_0x2020f3[_0xa158('0x27')],_0x2020f3[_0xa158('0x28')]);_0xf8e5d8[_0xa158('0x2d')]=_[_0xa158('0x2b')](_0x2020f3[_0xa158('0x27')],qs['fields'](_0x4db40e[_0xa158('0x28')]['fields']));_0xf8e5d8[_0xa158('0x2d')]=_0xf8e5d8[_0xa158('0x2d')][_0xa158('0x2e')]?_0xf8e5d8[_0xa158('0x2d')]:_0x2020f3[_0xa158('0x27')];if(_0x4db40e[_0xa158('0x28')][_0xa158('0x39')]){_0xf8e5d8['include']=[{'all':!![]}];}_0xf8e5d8=_['merge']({},_0xf8e5d8,_0x4db40e[_0xa158('0x38')]);return db[_0xa158('0x25')][_0xa158('0x3f')](_0xf8e5d8)['then'](handleEntityNotFound(_0xd44f3e,null))[_0xa158('0xc')](respondWithResult(_0xd44f3e,null))[_0xa158('0x16')](handleError(_0xd44f3e,null));};exports[_0xa158('0x1e')]=function(_0x2f8d28,_0xeefd81){if(_0x2f8d28[_0xa158('0x40')]['id']){delete _0x2f8d28[_0xa158('0x40')]['id'];}return db['FaxMessage'][_0xa158('0x3f')]({'where':{'id':_0x2f8d28[_0xa158('0x3d')]['id']}})[_0xa158('0xc')](handleEntityNotFound(_0xeefd81,null))['then'](saveUpdates(_0x2f8d28[_0xa158('0x40')],null))[_0xa158('0xc')](respondWithResult(_0xeefd81,null))[_0xa158('0x16')](handleError(_0xeefd81,null));};exports[_0xa158('0x1f')]=function(_0x14f754,_0x5aa72f){return db[_0xa158('0x25')]['find']({'where':{'id':_0x14f754[_0xa158('0x3d')]['id']}})[_0xa158('0xc')](handleEntityNotFound(_0x5aa72f,null))[_0xa158('0xc')](removeEntity(_0x5aa72f,null))['catch'](handleError(_0x5aa72f,null));};exports[_0xa158('0x41')]=function(_0x305c31,_0x5ec2ff){return db[_0xa158('0x25')]['describe']()[_0xa158('0xc')](respondWithResult(_0x5ec2ff,null))[_0xa158('0x16')](handleError(_0x5ec2ff,null));};exports[_0xa158('0x42')]=function(_0x4205ec,_0x435a11){var _0x49f338=_0xa158('0x43');return interactionService[_0xa158('0x44')](_0x4205ec,_0x49f338)['then'](respondWithResult(_0x435a11,null))[_0xa158('0x16')](handleError(_0x435a11,null));};exports[_0xa158('0x42')]=function(_0x10cbc2,_0x46029b){var _0x3b81f5=_0xa158('0x45');return interactionService[_0xa158('0x44')](_0x10cbc2,_0x3b81f5)['then'](respondWithResult(_0x46029b,null))[_0xa158('0x16')](handleError(_0x46029b,null));};exports[_0xa158('0x46')]=function(_0x17f06c,_0x2c5997){var _0x50d50d={'agent':{},'channel':'fax'};if(_0x17f06c[_0xa158('0x40')]['id']){delete _0x17f06c[_0xa158('0x40')]['id'];}_0x17f06c[_0xa158('0x40')][_0xa158('0x47')]=_0x17f06c['body']['UserId']||_0x17f06c[_0xa158('0x48')]['id'];_0x50d50d[_0xa158('0x49')]['id']=_0x17f06c[_0xa158('0x40')][_0xa158('0x47')];return db[_0xa158('0x25')][_0xa158('0x3f')]({'where':{'id':_0x17f06c['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x2c5997,null))[_0xa158('0xc')](function(_0x3ef98a){if(_0x3ef98a){_0x50d50d[_0xa158('0x13')]=_0x3ef98a[_0xa158('0x4a')]({'plain':!![]});return db[_0xa158('0x4b')][_0xa158('0x3f')]({'where':{'id':_0x3ef98a[_0xa158('0x4c')]}});}return null;})[_0xa158('0xc')](handleEntityNotFound(_0x2c5997,null))['then'](function(_0x4ccc76){if(_0x4ccc76){_0x50d50d[_0xa158('0x4d')]=_0x4ccc76[_0xa158('0x4a')]({'plain':!![]});interaction_log[_0xa158('0x14')](_0xa158('0x4e'),_0x17f06c[_0xa158('0x48')]['id'],_0x17f06c['user']['name'],_0x17f06c['user'][_0xa158('0x4f')],_0x50d50d[_0xa158('0x4d')]['id'],_0x17f06c[_0xa158('0x40')]?JSON[_0xa158('0x10')](_0x17f06c['body']):'null');return respondWithRpcPromise(_0xa158('0x50'),'rejectMessage',_0x50d50d);}return null;})[_0xa158('0xc')](function(_0x2c68fc){var _0x2b8fe1='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x2c68fc['message'][_0xa158('0x51')];return db[_0xa158('0x52')]['query'](_0x2b8fe1,{'type':db['Sequelize'][_0xa158('0x53')][_0xa158('0x54')],'raw':!![]})[_0xa158('0xc')](function(_0x3db176){return _0x3db176;});})[_0xa158('0xc')](function(_0x32b937){if(_0x32b937){_0x50d50d[_0xa158('0x13')][_0xa158('0x55')]=_0x32b937[0x0];if(!_0x17f06c['body'][_0xa158('0x47')])return;return db[_0xa158('0x56')][_0xa158('0x3f')]({'where':{'id':_0x17f06c[_0xa158('0x40')]['UserId'],'role':_0xa158('0x49')},'attributes':['id',_0xa158('0x22'),_0xa158('0x57'),_0xa158('0x58'),_0xa158('0x59')],'raw':!![]});}return null;})['then'](function(_0xa409ac){if(!_0xa409ac)return null;_0x50d50d[_0xa158('0x13')][_0xa158('0x49')]=_0xa409ac;return _0x50d50d;})[_0xa158('0xc')](function(_0x51c598){if(_0x51c598){_0x51c598[_0xa158('0x13')][_0xa158('0x5a')]=util[_0xa158('0x5b')](_0xa158('0x5c'),_0x17f06c['user']['name']);_0x51c598[_0xa158('0x13')][_0xa158('0x5d')]=_0x50d50d['channel'];_0x51c598[_0xa158('0x13')][_0xa158('0x5e')]=_0x50d50d[_0xa158('0x5d')];_0x51c598[_0xa158('0x13')][_0xa158('0x5f')]=_0xa158('0x46');respondWithRpcPromise(_0xa158('0x60'),'EventManager',{'event':_0xa158('0x61'),'message':_0x51c598[_0xa158('0x13')]},client9002);return _0x50d50d;}return null;})[_0xa158('0xc')](respondWithResult(_0x2c5997,null))[_0xa158('0x16')](handleError(_0x2c5997,null));};exports[_0xa158('0x62')]=function(_0x4e4067,_0x5a7a66){var _0xcd5704;return db[_0xa158('0x25')][_0xa158('0x62')](_0x4e4067[_0xa158('0x40')],{})[_0xa158('0xc')](function(_0x52c161){_0xcd5704=_0x52c161;return db['CmContact'][_0xa158('0x63')]({'where':{'id':_0xcd5704[_0xa158('0x51')]}});})['then'](function(_0x132aa7){if(_['isNil'](_0x132aa7)){return;}else{_0xcd5704[_0xa158('0x45')]=_0x132aa7['fax'];return db['Attachment'][_0xa158('0x63')]({'where':{'id':_0xcd5704[_0xa158('0x64')]}});}})[_0xa158('0xc')](function(_0x323d33){return respondWithRpcPromise(_0xa158('0x65'),_0xa158('0x65'),{'FaxAccountId':_[_0xa158('0x66')](_0x4e4067[_0xa158('0x40')])?undefined:_0x4e4067[_0xa158('0x40')][_0xa158('0x67')],'path':_[_0xa158('0x66')](_0x323d33)?undefined:util['format'](_0xa158('0x68'),_0x323d33[_0xa158('0x69')]),'fax':_[_0xa158('0x66')](_0xcd5704[_0xa158('0x45')])?undefined:_0xcd5704[_0xa158('0x45')],'AttachmentId':_0xcd5704[_0xa158('0x64')]},client9002);})[_0xa158('0xc')](respondWithResult(_0x5a7a66,0xc9))[_0xa158('0x16')](handleError(_0x5a7a66,null));};exports[_0xa158('0x6a')]=function(_0x2f8103,_0x5d6ca1){var _0x575d40=path[_0xa158('0x6b')](config[_0xa158('0x6c')],_0xa158('0x6d'),_0xa158('0x6e'),_0xa158('0x6f'));return db[_0xa158('0x25')][_0xa158('0x3f')]({'where':{'id':_0x2f8103[_0xa158('0x3d')]['id']},'include':[{'model':db[_0xa158('0x70')],'as':_0xa158('0x70')}]})[_0xa158('0xc')](handleEntityNotFound(_0x5d6ca1,null))['then'](function(_0x33dd30){if(_0x33dd30){return _0x5d6ca1[_0xa158('0x6a')](path['join'](_0x575d40,_0x33dd30[_0xa158('0x70')][_0xa158('0x69')]));}})['catch'](handleError(_0x5d6ca1,null));}; \ No newline at end of file +var _0x5ca3=['code','message','catch','status','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','sendStatus','stack','name','send','index','map','FaxMessage','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','VIRTUAL','filter','options','includeAll','include','rows','show','find','body','params','describe','accept','sms','acceptMessage','fax','reject','UserId','FaxInteraction','FaxInteractionId','interaction','get','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','contact','User','agent','fullname','email','internal','format','SIP/%s','channel','motionChannel','event','EventManager','rejectmessage','create','CmContact','ContactId','Attachment','AttachmentId','SendFax','isNil','/var/opt/motion2/server/files/attachments/%s','join','root','files','attachments','basename','util','path','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','defaults','socket.io-emitter','redis','./faxMessage.socket','register','jayson/promise','client','request','info','FaxMessage,\x20%s,\x20%s','debug','FaxMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x5a0806,_0x5cb366){var _0x479b9c=function(_0x34920c){while(--_0x34920c){_0x5a0806['push'](_0x5a0806['shift']());}};_0x479b9c(++_0x5cb366);}(_0x5ca3,0xd1));var _0x35ca=function(_0x1855a8,_0x28aa7c){_0x1855a8=_0x1855a8-0x0;var _0x211756=_0x5ca3[_0x1855a8];return _0x211756;};'use strict';var util=require(_0x35ca('0x0'));var path=require(_0x35ca('0x1'));var _=require('lodash');var Redis=require(_0x35ca('0x2'));var interactionService=require(_0x35ca('0x3'));var qs=require(_0x35ca('0x4'));var logger=require(_0x35ca('0x5'))(_0x35ca('0x6'));var config=require(_0x35ca('0x7'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x35ca('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x35ca('0x9'))(new Redis(config[_0x35ca('0xa')]));require(_0x35ca('0xb'))[_0x35ca('0xc')](socket);var jayson=require(_0x35ca('0xd'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0x35ca('0xe')]['http']({'port':0x232a});var interaction_log=require(_0x35ca('0x5'))('fax-interactions');function respondWithRpcPromise(_0x583830,_0x244496,_0x33b239,_0x360355){return new Promise(function(_0x434d50,_0xca5fe0){var _0x156e8a=_0x360355||client;return _0x156e8a[_0x35ca('0xf')](_0x583830,_0x33b239)['then'](function(_0x45e53f){logger[_0x35ca('0x10')](_0x35ca('0x11'),_0x244496,'request\x20sent');logger[_0x35ca('0x12')](_0x35ca('0x13'),_0x244496,_0x35ca('0x14'),JSON[_0x35ca('0x15')](_0x45e53f));if(_0x45e53f[_0x35ca('0x16')]){if(_0x45e53f[_0x35ca('0x16')][_0x35ca('0x17')]===0x1f4){logger[_0x35ca('0x16')](_0x35ca('0x11'),_0x244496,_0x45e53f[_0x35ca('0x16')]['message']);return _0xca5fe0(_0x45e53f[_0x35ca('0x16')][_0x35ca('0x18')]);}logger['error'](_0x35ca('0x11'),_0x244496,_0x45e53f[_0x35ca('0x16')][_0x35ca('0x18')]);return _0x434d50(_0x45e53f['error'][_0x35ca('0x18')]);}else{logger[_0x35ca('0x10')](_0x35ca('0x11'),_0x244496,'request\x20sent');_0x434d50(_0x45e53f['result'][_0x35ca('0x18')]);}})[_0x35ca('0x19')](function(_0x5204f5){logger[_0x35ca('0x16')]('FaxMessage,\x20%s,\x20%s',_0x244496,_0x5204f5);_0xca5fe0(_0x5204f5);});});}function respondWithResult(_0x206b69,_0x37dd38){_0x37dd38=_0x37dd38||0xc8;return function(_0x34b5af){if(_0x34b5af){return _0x206b69[_0x35ca('0x1a')](_0x37dd38)['json'](_0x34b5af);}};}function respondWithFilteredResult(_0x4e8915,_0x1baabb){return function(_0x25bb08){if(_0x25bb08){var _0x178fb1=typeof _0x1baabb[_0x35ca('0x1b')]===_0x35ca('0x1c')&&typeof _0x1baabb[_0x35ca('0x1d')]===_0x35ca('0x1c');var _0x2de060=_0x25bb08[_0x35ca('0x1e')];var _0x4b3a1a=_0x178fb1?0x0:_0x1baabb[_0x35ca('0x1b')];var _0x2800e2=_0x178fb1?_0x25bb08[_0x35ca('0x1e')]:_0x1baabb['offset']+_0x1baabb[_0x35ca('0x1d')];var _0x399acf;if(_0x2800e2>=_0x2de060){_0x2800e2=_0x2de060;_0x399acf=0xc8;}else{_0x399acf=0xce;}_0x4e8915[_0x35ca('0x1a')](_0x399acf);return _0x4e8915[_0x35ca('0x1f')](_0x35ca('0x20'),_0x4b3a1a+'-'+_0x2800e2+'/'+_0x2de060)['json'](_0x25bb08);}return null;};}function saveUpdates(_0xf68550){return function(_0xd0e2c1){if(_0xd0e2c1){return _0xd0e2c1[_0x35ca('0x21')](_0xf68550)[_0x35ca('0x22')](function(_0x1bc6ad){return _0x1bc6ad;});}return null;};}function removeEntity(_0x47bed7){return function(_0x487a0f){if(_0x487a0f){return _0x487a0f[_0x35ca('0x23')]()['then'](function(){_0x47bed7[_0x35ca('0x1a')](0xcc)[_0x35ca('0x24')]();});}};}function handleEntityNotFound(_0x4e12ed){return function(_0x377185){if(!_0x377185){_0x4e12ed[_0x35ca('0x25')](0x194);}return _0x377185;};}function handleError(_0x52d173,_0x57c42a){_0x57c42a=_0x57c42a||0x1f4;return function(_0x582d42){logger[_0x35ca('0x16')](_0x582d42[_0x35ca('0x26')]);if(_0x582d42[_0x35ca('0x27')]){delete _0x582d42['name'];}_0x52d173['status'](_0x57c42a)[_0x35ca('0x28')](_0x582d42);};}exports[_0x35ca('0x29')]=function(_0x30a629,_0x41c595){var _0x1f651f={},_0x41280e={},_0x430a09={'count':0x0,'rows':[]};var _0x5a4419=_[_0x35ca('0x2a')](db[_0x35ca('0x2b')]['rawAttributes'],function(_0x3d9a83){return{'name':_0x3d9a83[_0x35ca('0x2c')],'type':_0x3d9a83[_0x35ca('0x2d')][_0x35ca('0x2e')]};});_0x41280e[_0x35ca('0x2f')]=_[_0x35ca('0x2a')](_0x5a4419,_0x35ca('0x27'));_0x41280e[_0x35ca('0x30')]=_[_0x35ca('0x31')](_0x30a629[_0x35ca('0x30')]);_0x41280e[_0x35ca('0x32')]=_[_0x35ca('0x33')](_0x41280e['model'],_0x41280e['query']);_0x1f651f[_0x35ca('0x34')]=_[_0x35ca('0x33')](_0x41280e[_0x35ca('0x2f')],qs[_0x35ca('0x35')](_0x30a629[_0x35ca('0x30')][_0x35ca('0x35')]));_0x1f651f['attributes']=_0x1f651f[_0x35ca('0x34')][_0x35ca('0x36')]?_0x1f651f[_0x35ca('0x34')]:_0x41280e[_0x35ca('0x2f')];if(!_0x30a629[_0x35ca('0x30')][_0x35ca('0x37')](_0x35ca('0x38'))){_0x1f651f[_0x35ca('0x1d')]=qs[_0x35ca('0x1d')](_0x30a629[_0x35ca('0x30')]['limit']);_0x1f651f[_0x35ca('0x1b')]=qs[_0x35ca('0x1b')](_0x30a629['query']['offset']);}_0x1f651f[_0x35ca('0x39')]=qs[_0x35ca('0x3a')](_0x30a629[_0x35ca('0x30')][_0x35ca('0x3a')]);_0x1f651f['where']=qs[_0x35ca('0x32')](_[_0x35ca('0x3b')](_0x30a629[_0x35ca('0x30')],_0x41280e[_0x35ca('0x32')]),_0x5a4419);if(_0x30a629['query']['filter']){_0x1f651f[_0x35ca('0x3c')]=_['merge'](_0x1f651f[_0x35ca('0x3c')],{'$or':_['map'](_0x5a4419,function(_0x5e1702){if(_0x5e1702[_0x35ca('0x2d')]!==_0x35ca('0x3d')){var _0x120ffa={};_0x120ffa[_0x5e1702[_0x35ca('0x27')]]={'$like':'%'+_0x30a629[_0x35ca('0x30')][_0x35ca('0x3e')]+'%'};return _0x120ffa;}})});}_0x1f651f=_['merge']({},_0x1f651f,_0x30a629[_0x35ca('0x3f')]);var _0x51ebeb={'where':_0x1f651f['where']};return db[_0x35ca('0x2b')][_0x35ca('0x1e')](_0x51ebeb)[_0x35ca('0x22')](function(_0x5f0f3c){_0x430a09[_0x35ca('0x1e')]=_0x5f0f3c;if(_0x30a629[_0x35ca('0x30')][_0x35ca('0x40')]){_0x1f651f[_0x35ca('0x41')]=[{'all':!![]}];}return db[_0x35ca('0x2b')]['findAll'](_0x1f651f);})['then'](function(_0x467aa4){_0x430a09[_0x35ca('0x42')]=_0x467aa4;return _0x430a09;})[_0x35ca('0x22')](respondWithFilteredResult(_0x41c595,_0x1f651f))['catch'](handleError(_0x41c595,null));};exports[_0x35ca('0x43')]=function(_0x3a767c,_0x1097dd){var _0x2714ae={'raw':!![],'where':{'id':_0x3a767c['params']['id']}},_0x414de9={};_0x414de9[_0x35ca('0x2f')]=_[_0x35ca('0x31')](db['FaxMessage']['rawAttributes']);_0x414de9['query']=_[_0x35ca('0x31')](_0x3a767c['query']);_0x414de9[_0x35ca('0x32')]=_['intersection'](_0x414de9['model'],_0x414de9[_0x35ca('0x30')]);_0x2714ae[_0x35ca('0x34')]=_[_0x35ca('0x33')](_0x414de9[_0x35ca('0x2f')],qs[_0x35ca('0x35')](_0x3a767c[_0x35ca('0x30')][_0x35ca('0x35')]));_0x2714ae[_0x35ca('0x34')]=_0x2714ae[_0x35ca('0x34')][_0x35ca('0x36')]?_0x2714ae[_0x35ca('0x34')]:_0x414de9[_0x35ca('0x2f')];if(_0x3a767c[_0x35ca('0x30')][_0x35ca('0x40')]){_0x2714ae[_0x35ca('0x41')]=[{'all':!![]}];}_0x2714ae=_['merge']({},_0x2714ae,_0x3a767c['options']);return db[_0x35ca('0x2b')][_0x35ca('0x44')](_0x2714ae)[_0x35ca('0x22')](handleEntityNotFound(_0x1097dd,null))[_0x35ca('0x22')](respondWithResult(_0x1097dd,null))['catch'](handleError(_0x1097dd,null));};exports[_0x35ca('0x21')]=function(_0x5bbf59,_0x2247b0){if(_0x5bbf59[_0x35ca('0x45')]['id']){delete _0x5bbf59['body']['id'];}return db[_0x35ca('0x2b')]['find']({'where':{'id':_0x5bbf59[_0x35ca('0x46')]['id']}})[_0x35ca('0x22')](handleEntityNotFound(_0x2247b0,null))[_0x35ca('0x22')](saveUpdates(_0x5bbf59[_0x35ca('0x45')],null))[_0x35ca('0x22')](respondWithResult(_0x2247b0,null))[_0x35ca('0x19')](handleError(_0x2247b0,null));};exports['destroy']=function(_0x14e800,_0x4d390d){return db[_0x35ca('0x2b')][_0x35ca('0x44')]({'where':{'id':_0x14e800[_0x35ca('0x46')]['id']}})[_0x35ca('0x22')](handleEntityNotFound(_0x4d390d,null))[_0x35ca('0x22')](removeEntity(_0x4d390d,null))[_0x35ca('0x19')](handleError(_0x4d390d,null));};exports['describe']=function(_0x43eab1,_0x320c4e){return db['FaxMessage'][_0x35ca('0x47')]()[_0x35ca('0x22')](respondWithResult(_0x320c4e,null))[_0x35ca('0x19')](handleError(_0x320c4e,null));};exports[_0x35ca('0x48')]=function(_0x5086e0,_0x3be3fc){var _0x30b7ff=_0x35ca('0x49');return interactionService[_0x35ca('0x4a')](_0x5086e0,_0x30b7ff)[_0x35ca('0x22')](respondWithResult(_0x3be3fc,null))[_0x35ca('0x19')](handleError(_0x3be3fc,null));};exports[_0x35ca('0x48')]=function(_0x4d77a,_0x2a7df1){var _0x125863=_0x35ca('0x4b');return interactionService[_0x35ca('0x4a')](_0x4d77a,_0x125863)[_0x35ca('0x22')](respondWithResult(_0x2a7df1,null))[_0x35ca('0x19')](handleError(_0x2a7df1,null));};exports[_0x35ca('0x4c')]=function(_0x318f0b,_0x3dbde7){var _0x304a4f={'agent':{},'channel':'fax'};if(_0x318f0b[_0x35ca('0x45')]['id']){delete _0x318f0b['body']['id'];}_0x318f0b[_0x35ca('0x45')][_0x35ca('0x4d')]=_0x318f0b[_0x35ca('0x45')]['UserId']||_0x318f0b['user']['id'];_0x304a4f['agent']['id']=_0x318f0b[_0x35ca('0x45')][_0x35ca('0x4d')];return db['FaxMessage']['find']({'where':{'id':_0x318f0b[_0x35ca('0x46')]['id'],'UserId':null}})[_0x35ca('0x22')](handleEntityNotFound(_0x3dbde7,null))[_0x35ca('0x22')](function(_0xb0aac8){if(_0xb0aac8){_0x304a4f[_0x35ca('0x18')]=_0xb0aac8['get']({'plain':!![]});return db[_0x35ca('0x4e')]['find']({'where':{'id':_0xb0aac8[_0x35ca('0x4f')]}});}return null;})[_0x35ca('0x22')](handleEntityNotFound(_0x3dbde7,null))[_0x35ca('0x22')](function(_0x22fc3f){if(_0x22fc3f){_0x304a4f[_0x35ca('0x50')]=_0x22fc3f[_0x35ca('0x51')]({'plain':!![]});interaction_log[_0x35ca('0x10')](_0x35ca('0x52'),_0x318f0b[_0x35ca('0x53')]['id'],_0x318f0b[_0x35ca('0x53')][_0x35ca('0x27')],_0x318f0b[_0x35ca('0x53')][_0x35ca('0x54')],_0x304a4f[_0x35ca('0x50')]['id'],_0x318f0b['body']?JSON[_0x35ca('0x15')](_0x318f0b[_0x35ca('0x45')]):'null');return respondWithRpcPromise(_0x35ca('0x55'),_0x35ca('0x56'),_0x304a4f);}return null;})[_0x35ca('0x22')](function(_0x375a9e){var _0x1f2d7e=_0x35ca('0x57')+_0x375a9e[_0x35ca('0x18')]['ContactId'];return db[_0x35ca('0x58')][_0x35ca('0x30')](_0x1f2d7e,{'type':db[_0x35ca('0x59')]['QueryTypes']['SELECT'],'raw':!![]})[_0x35ca('0x22')](function(_0x1c1ea1){return _0x1c1ea1;});})[_0x35ca('0x22')](function(_0x5becf0){if(_0x5becf0){_0x304a4f[_0x35ca('0x18')][_0x35ca('0x5a')]=_0x5becf0[0x0];if(!_0x318f0b[_0x35ca('0x45')]['UserId'])return;return db[_0x35ca('0x5b')][_0x35ca('0x44')]({'where':{'id':_0x318f0b[_0x35ca('0x45')][_0x35ca('0x4d')],'role':_0x35ca('0x5c')},'attributes':['id',_0x35ca('0x27'),_0x35ca('0x5d'),_0x35ca('0x5e'),_0x35ca('0x5f')],'raw':!![]});}return null;})[_0x35ca('0x22')](function(_0x1ac2ea){if(!_0x1ac2ea)return null;_0x304a4f['message'][_0x35ca('0x5c')]=_0x1ac2ea;return _0x304a4f;})['then'](function(_0x1a7951){if(_0x1a7951){_0x1a7951[_0x35ca('0x18')]['interface']=util[_0x35ca('0x60')](_0x35ca('0x61'),_0x318f0b['user'][_0x35ca('0x27')]);_0x1a7951[_0x35ca('0x18')]['channel']=_0x304a4f[_0x35ca('0x62')];_0x1a7951['message'][_0x35ca('0x63')]=_0x304a4f[_0x35ca('0x62')];_0x1a7951[_0x35ca('0x18')][_0x35ca('0x64')]=_0x35ca('0x4c');respondWithRpcPromise('EventManager',_0x35ca('0x65'),{'event':_0x35ca('0x66'),'message':_0x1a7951[_0x35ca('0x18')]},client9002);return _0x304a4f;}return null;})['then'](respondWithResult(_0x3dbde7,null))['catch'](handleError(_0x3dbde7,null));};exports['create']=function(_0x37f757,_0x502778){var _0x36c3ad;return db[_0x35ca('0x2b')][_0x35ca('0x67')](_0x37f757['body'],{})[_0x35ca('0x22')](function(_0x7f04fe){_0x36c3ad=_0x7f04fe;return db[_0x35ca('0x68')]['findOne']({'where':{'id':_0x36c3ad[_0x35ca('0x69')]}});})[_0x35ca('0x22')](function(_0x40b605){if(_['isNil'](_0x40b605)){return;}else{_0x36c3ad[_0x35ca('0x4b')]=_0x40b605[_0x35ca('0x4b')];return db[_0x35ca('0x6a')]['findOne']({'where':{'id':_0x36c3ad[_0x35ca('0x6b')]}});}})['then'](function(_0x2daa30){return respondWithRpcPromise('SendFax',_0x35ca('0x6c'),{'FaxAccountId':_[_0x35ca('0x6d')](_0x37f757[_0x35ca('0x45')])?undefined:_0x37f757[_0x35ca('0x45')]['FaxAccountId'],'path':_['isNil'](_0x2daa30)?undefined:util[_0x35ca('0x60')](_0x35ca('0x6e'),_0x2daa30['basename']),'fax':_[_0x35ca('0x6d')](_0x36c3ad[_0x35ca('0x4b')])?undefined:_0x36c3ad[_0x35ca('0x4b')],'AttachmentId':_0x36c3ad[_0x35ca('0x6b')]},client9002);})[_0x35ca('0x22')](respondWithResult(_0x502778,0xc9))[_0x35ca('0x19')](handleError(_0x502778,null));};exports['download']=function(_0x4544a3,_0xb14b0){var _0x2ee8a7=path[_0x35ca('0x6f')](config[_0x35ca('0x70')],'server',_0x35ca('0x71'),_0x35ca('0x72'));return db[_0x35ca('0x2b')][_0x35ca('0x44')]({'where':{'id':_0x4544a3[_0x35ca('0x46')]['id']},'include':[{'model':db[_0x35ca('0x6a')],'as':_0x35ca('0x6a')}]})[_0x35ca('0x22')](handleEntityNotFound(_0xb14b0,null))['then'](function(_0x132212){if(_0x132212){return _0xb14b0['download'](path[_0x35ca('0x6f')](_0x2ee8a7,_0x132212[_0x35ca('0x6a')][_0x35ca('0x73')]));}})[_0x35ca('0x19')](handleError(_0xb14b0,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index ef51a9d..9b5ad53 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 _0x8d0a=['exports','events','../../mysqldb','FaxMessage','save','update','emit','hasOwnProperty','hook'];(function(_0x4053a4,_0x476631){var _0x14a6e1=function(_0x4a9438){while(--_0x4a9438){_0x4053a4['push'](_0x4053a4['shift']());}};_0x14a6e1(++_0x476631);}(_0x8d0a,0x172));var _0xa8d0=function(_0x514cae,_0x36be87){_0x514cae=_0x514cae-0x0;var _0x4299d5=_0x8d0a[_0x514cae];return _0x4299d5;};'use strict';var EventEmitter=require(_0xa8d0('0x0'));var FaxMessage=require(_0xa8d0('0x1'))['db'][_0xa8d0('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa8d0('0x3'),'afterUpdate':_0xa8d0('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3c8cc4){return function(_0x3812b4,_0x33c4b1,_0x55bc97){FaxMessageEvents[_0xa8d0('0x5')](_0x3c8cc4+':'+_0x3812b4['id'],_0x3812b4);FaxMessageEvents[_0xa8d0('0x5')](_0x3c8cc4,_0x3812b4);_0x55bc97(null);};}for(var e in events){if(events[_0xa8d0('0x6')](e)){var event=events[e];FaxMessage[_0xa8d0('0x7')](e,emitEvent(event));}}module[_0xa8d0('0x8')]=FaxMessageEvents; \ No newline at end of file +var _0xf470=['hasOwnProperty','hook','exports','events','../../mysqldb','FaxMessage','setMaxListeners','save','update','emit'];(function(_0x21ebbc,_0x1ec54a){var _0xb25add=function(_0x437c38){while(--_0x437c38){_0x21ebbc['push'](_0x21ebbc['shift']());}};_0xb25add(++_0x1ec54a);}(_0xf470,0xfd));var _0x0f47=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0xf470[_0x209941];return _0x1e8729;};'use strict';var EventEmitter=require(_0x0f47('0x0'));var FaxMessage=require(_0x0f47('0x1'))['db'][_0x0f47('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x0f47('0x3')](0x0);var events={'afterCreate':_0x0f47('0x4'),'afterUpdate':_0x0f47('0x5'),'afterDestroy':'remove'};function emitEvent(_0x8fd765){return function(_0x3e20a3,_0x493828,_0x1b6cfc){FaxMessageEvents[_0x0f47('0x6')](_0x8fd765+':'+_0x3e20a3['id'],_0x3e20a3);FaxMessageEvents[_0x0f47('0x6')](_0x8fd765,_0x3e20a3);_0x1b6cfc(null);};}for(var e in events){if(events[_0x0f47('0x7')](e)){var event=events[e];FaxMessage[_0x0f47('0x8')](e,emitEvent(event));}}module[_0x0f47('0x9')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 28e65b0..309383e 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 _0x4b5a=['toLowerCase','out','secret','UserId','FaxInteraction','findOne','then','update','createdAt','catch','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./faxMessage.attributes','define','FaxMessage','fti_fax_messages','models','direction'];(function(_0x1c2e8e,_0x168e8a){var _0x3db1ab=function(_0x2c285b){while(--_0x2c285b){_0x1c2e8e['push'](_0x1c2e8e['shift']());}};_0x3db1ab(++_0x168e8a);}(_0x4b5a,0x1bf));var _0xa4b5=function(_0x59e641,_0x12be10){_0x59e641=_0x59e641-0x0;var _0x292422=_0x4b5a[_0x59e641];return _0x292422;};'use strict';var _=require(_0xa4b5('0x0'));var util=require(_0xa4b5('0x1'));var logger=require(_0xa4b5('0x2'))('api');var moment=require('moment');var BPromise=require(_0xa4b5('0x3'));var rp=require(_0xa4b5('0x4'));var fs=require('fs');var path=require(_0xa4b5('0x5'));var rimraf=require(_0xa4b5('0x6'));var config=require('../../config/environment');var attributes=require(_0xa4b5('0x7'));module['exports']=function(_0x1f4f07,_0x45071a){return _0x1f4f07[_0xa4b5('0x8')](_0xa4b5('0x9'),attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':_0xa4b5('0xa'),'fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0xbe91cc,_0x5ace5c,_0x1d316c){var _0x166aaf=_0x1f4f07[_0xa4b5('0xb')];var _0x4a6d29=_0xbe91cc['get']({'plain':!![]});if(_0x4a6d29[_0xa4b5('0xc')][_0xa4b5('0xd')]()==='in'||_0x4a6d29[_0xa4b5('0xc')][_0xa4b5('0xd')]()===_0xa4b5('0xe')&&!_0x4a6d29[_0xa4b5('0xf')]&&!_['isNil'](_0x4a6d29[_0xa4b5('0x10')])){_0x166aaf[_0xa4b5('0x11')][_0xa4b5('0x12')]({'where':{'id':_0x4a6d29['FaxInteractionId']}})[_0xa4b5('0x13')](function(_0x1f4f03){if(_0x1f4f03){_0x1f4f03[_0xa4b5('0x14')]({'lastMsgAt':_0x4a6d29[_0xa4b5('0x15')],'lastMsgDirection':_0x4a6d29[_0xa4b5('0xc')][_0xa4b5('0xd')]()});}})[_0xa4b5('0x16')](function(_0x5b6419){console['error'](_0x5b6419);});}_0x1d316c();}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xd8fb=['api','moment','bluebird','request-promise','path','rimraf','exports','define','FaxMessage','fax_messages','body','FULLTEXT','get','direction','toLowerCase','out','secret','isNil','UserId','FaxInteraction','findOne','FaxInteractionId','then','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0xecd4be,_0x37db25){var _0x4e4b4e=function(_0x12787c){while(--_0x12787c){_0xecd4be['push'](_0xecd4be['shift']());}};_0x4e4b4e(++_0x37db25);}(_0xd8fb,0x133));var _0xbd8f=function(_0x35b5b3,_0x5df9e8){_0x35b5b3=_0x35b5b3-0x0;var _0x45f35c=_0xd8fb[_0x35b5b3];return _0x45f35c;};'use strict';var _=require(_0xbd8f('0x0'));var util=require(_0xbd8f('0x1'));var logger=require(_0xbd8f('0x2'))(_0xbd8f('0x3'));var moment=require(_0xbd8f('0x4'));var BPromise=require(_0xbd8f('0x5'));var rp=require(_0xbd8f('0x6'));var fs=require('fs');var path=require(_0xbd8f('0x7'));var rimraf=require(_0xbd8f('0x8'));var config=require('../../config/environment');var attributes=require('./faxMessage.attributes');module[_0xbd8f('0x9')]=function(_0x186978,_0x3871f5){return _0x186978[_0xbd8f('0xa')](_0xbd8f('0xb'),attributes,{'tableName':_0xbd8f('0xc'),'paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':[_0xbd8f('0xd')],'type':_0xbd8f('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4c44fb,_0x9568b9,_0x13c875){var _0x4acba7=_0x186978['models'];var _0x317082=_0x4c44fb[_0xbd8f('0xf')]({'plain':!![]});if(_0x317082[_0xbd8f('0x10')][_0xbd8f('0x11')]()==='in'||_0x317082[_0xbd8f('0x10')][_0xbd8f('0x11')]()===_0xbd8f('0x12')&&!_0x317082[_0xbd8f('0x13')]&&!_[_0xbd8f('0x14')](_0x317082[_0xbd8f('0x15')])){_0x4acba7[_0xbd8f('0x16')][_0xbd8f('0x17')]({'where':{'id':_0x317082[_0xbd8f('0x18')]}})[_0xbd8f('0x19')](function(_0x1836a2){if(_0x1836a2){_0x1836a2['update']({'lastMsgAt':_0x317082[_0xbd8f('0x1a')],'lastMsgDirection':_0x317082[_0xbd8f('0x10')]['toLowerCase']()});}})[_0xbd8f('0x1b')](function(_0x5c7771){console[_0xbd8f('0x1c')](_0x5c7771);});}_0x13c875();}},'charset':_0xbd8f('0x1d'),'collate':_0xbd8f('0x1e')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 7bcf6df..f97733d 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 _0x54ef=['../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','./faxMessage.socket','request','then','info','request\x20sent','stringify','error','FaxMessage,\x20%s,\x20%s','message','result','catch','FaxMessage','create','body','options','raw','CreateFaxMessage','UpdateFaxMessage','where','attributes','debug','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x317382,_0x50ffc8){var _0x34a5f8=function(_0x5c3b92){while(--_0x5c3b92){_0x317382['push'](_0x317382['shift']());}};_0x34a5f8(++_0x50ffc8);}(_0x54ef,0x112));var _0xf54e=function(_0x3cc22b,_0x4e8a1e){_0x3cc22b=_0x3cc22b-0x0;var _0x3d6383=_0x54ef[_0x3cc22b];return _0x3d6383;};'use strict';var _=require(_0xf54e('0x0'));var util=require(_0xf54e('0x1'));var moment=require(_0xf54e('0x2'));var BPromise=require('bluebird');var rs=require(_0xf54e('0x3'));var fs=require('fs');var Redis=require(_0xf54e('0x4'));var db=require(_0xf54e('0x5'))['db'];var utils=require(_0xf54e('0x6'));var logger=require(_0xf54e('0x7'))(_0xf54e('0x8'));var config=require(_0xf54e('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf54e('0xa')]({'port':0x232a});config[_0xf54e('0xb')]=_[_0xf54e('0xc')](config['redis'],{'host':_0xf54e('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf54e('0xb')]));require(_0xf54e('0xe'))['register'](socket);function respondWithRpcPromise(_0x26fc3e,_0xefa1c0,_0x6b9e61){return new BPromise(function(_0x3ecfb3,_0x5f232a){return client[_0xf54e('0xf')](_0x26fc3e,_0x6b9e61)[_0xf54e('0x10')](function(_0x143d66){logger[_0xf54e('0x11')]('FaxMessage,\x20%s,\x20%s',_0xefa1c0,_0xf54e('0x12'));logger['debug']('FaxMessage,\x20%s,\x20%s,\x20%s',_0xefa1c0,_0xf54e('0x12'),JSON[_0xf54e('0x13')](_0x143d66));if(_0x143d66[_0xf54e('0x14')]){if(_0x143d66[_0xf54e('0x14')]['code']===0x1f4){logger[_0xf54e('0x14')](_0xf54e('0x15'),_0xefa1c0,_0x143d66[_0xf54e('0x14')][_0xf54e('0x16')]);return _0x5f232a(_0x143d66['error'][_0xf54e('0x16')]);}logger[_0xf54e('0x14')](_0xf54e('0x15'),_0xefa1c0,_0x143d66['error']['message']);return _0x3ecfb3(_0x143d66[_0xf54e('0x14')][_0xf54e('0x16')]);}else{logger[_0xf54e('0x11')](_0xf54e('0x15'),_0xefa1c0,_0xf54e('0x12'));_0x3ecfb3(_0x143d66[_0xf54e('0x17')][_0xf54e('0x16')]);}})[_0xf54e('0x18')](function(_0x1dcc04){logger[_0xf54e('0x14')](_0xf54e('0x15'),_0xefa1c0,_0x1dcc04);_0x5f232a(_0x1dcc04);});});}exports['CreateFaxMessage']=function(_0x48a7e1){var _0x23e14=this;return new Promise(function(_0x59f338,_0x3e1556){return db[_0xf54e('0x19')][_0xf54e('0x1a')](_0x48a7e1[_0xf54e('0x1b')],{'raw':_0x48a7e1[_0xf54e('0x1c')]?_0x48a7e1[_0xf54e('0x1c')][_0xf54e('0x1d')]===undefined?!![]:![]:!![]})[_0xf54e('0x10')](function(_0x3c0169){logger[_0xf54e('0x11')](_0xf54e('0x1e'),_0x48a7e1);logger['debug'](_0xf54e('0x1e'),_0x48a7e1,JSON['stringify'](_0x3c0169));_0x59f338(_0x3c0169);})[_0xf54e('0x18')](function(_0x272df6){logger[_0xf54e('0x14')](_0xf54e('0x1e'),_0x272df6[_0xf54e('0x16')],_0x48a7e1);_0x3e1556(_0x23e14[_0xf54e('0x14')](0x1f4,_0x272df6[_0xf54e('0x16')]));});});};exports[_0xf54e('0x1f')]=function(_0x2342a9){var _0x33457f=this;return new Promise(function(_0xf6cdd7,_0x39c0ae){return db[_0xf54e('0x19')]['update'](_0x2342a9[_0xf54e('0x1b')],{'raw':_0x2342a9['options']?_0x2342a9[_0xf54e('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2342a9[_0xf54e('0x1c')]?_0x2342a9[_0xf54e('0x1c')][_0xf54e('0x20')]||null:null,'attributes':_0x2342a9[_0xf54e('0x1c')]?_0x2342a9[_0xf54e('0x1c')][_0xf54e('0x21')]||null:null,'limit':_0x2342a9[_0xf54e('0x1c')]?_0x2342a9['options']['limit']||null:null})[_0xf54e('0x10')](function(_0x258d29){logger[_0xf54e('0x11')](_0xf54e('0x1f'),_0x2342a9);logger[_0xf54e('0x22')](_0xf54e('0x1f'),_0x2342a9,JSON[_0xf54e('0x13')](_0x258d29));_0xf6cdd7(_0x258d29);})[_0xf54e('0x18')](function(_0x3ae704){logger[_0xf54e('0x14')]('UpdateFaxMessage',_0x3ae704['message'],_0x2342a9);_0x39c0ae(_0x33457f[_0xf54e('0x14')](0x1f4,_0x3ae704[_0xf54e('0x16')]));});});}; \ No newline at end of file +var _0x9f62=['util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','request','info','request\x20sent','stringify','error','code','FaxMessage,\x20%s,\x20%s','message','result','CreateFaxMessage','FaxMessage','body','raw','then','debug','catch','UpdateFaxMessage','update','options','where','attributes','limit'];(function(_0x422634,_0x1488a0){var _0x2dcf79=function(_0x180dfb){while(--_0x180dfb){_0x422634['push'](_0x422634['shift']());}};_0x2dcf79(++_0x1488a0);}(_0x9f62,0x154));var _0x29f6=function(_0x22bfb5,_0x51761d){_0x22bfb5=_0x22bfb5-0x0;var _0x12b87e=_0x9f62[_0x22bfb5];return _0x12b87e;};'use strict';var _=require('lodash');var util=require(_0x29f6('0x0'));var moment=require('moment');var BPromise=require(_0x29f6('0x1'));var rs=require(_0x29f6('0x2'));var fs=require('fs');var Redis=require(_0x29f6('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x29f6('0x4'))(_0x29f6('0x5'));var config=require(_0x29f6('0x6'));var jayson=require(_0x29f6('0x7'));var client=jayson['client'][_0x29f6('0x8')]({'port':0x232a});config[_0x29f6('0x9')]=_[_0x29f6('0xa')](config[_0x29f6('0x9')],{'host':_0x29f6('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./faxMessage.socket')['register'](socket);function respondWithRpcPromise(_0xe25841,_0x44db16,_0x4fb455){return new BPromise(function(_0x5a0724,_0x29b3f5){return client[_0x29f6('0xc')](_0xe25841,_0x4fb455)['then'](function(_0x17b69c){logger[_0x29f6('0xd')]('FaxMessage,\x20%s,\x20%s',_0x44db16,'request\x20sent');logger['debug']('FaxMessage,\x20%s,\x20%s,\x20%s',_0x44db16,_0x29f6('0xe'),JSON[_0x29f6('0xf')](_0x17b69c));if(_0x17b69c[_0x29f6('0x10')]){if(_0x17b69c[_0x29f6('0x10')][_0x29f6('0x11')]===0x1f4){logger[_0x29f6('0x10')](_0x29f6('0x12'),_0x44db16,_0x17b69c[_0x29f6('0x10')][_0x29f6('0x13')]);return _0x29b3f5(_0x17b69c[_0x29f6('0x10')][_0x29f6('0x13')]);}logger[_0x29f6('0x10')](_0x29f6('0x12'),_0x44db16,_0x17b69c[_0x29f6('0x10')][_0x29f6('0x13')]);return _0x5a0724(_0x17b69c[_0x29f6('0x10')][_0x29f6('0x13')]);}else{logger['info']('FaxMessage,\x20%s,\x20%s',_0x44db16,_0x29f6('0xe'));_0x5a0724(_0x17b69c[_0x29f6('0x14')][_0x29f6('0x13')]);}})['catch'](function(_0xcb90){logger[_0x29f6('0x10')]('FaxMessage,\x20%s,\x20%s',_0x44db16,_0xcb90);_0x29b3f5(_0xcb90);});});}exports[_0x29f6('0x15')]=function(_0x3e81af){var _0x42a8fa=this;return new Promise(function(_0x41b9f0,_0xb6e7a9){return db[_0x29f6('0x16')]['create'](_0x3e81af[_0x29f6('0x17')],{'raw':_0x3e81af['options']?_0x3e81af['options'][_0x29f6('0x18')]===undefined?!![]:![]:!![]})[_0x29f6('0x19')](function(_0x39c6b3){logger[_0x29f6('0xd')]('CreateFaxMessage',_0x3e81af);logger[_0x29f6('0x1a')]('CreateFaxMessage',_0x3e81af,JSON[_0x29f6('0xf')](_0x39c6b3));_0x41b9f0(_0x39c6b3);})[_0x29f6('0x1b')](function(_0x4200cc){logger[_0x29f6('0x10')]('CreateFaxMessage',_0x4200cc[_0x29f6('0x13')],_0x3e81af);_0xb6e7a9(_0x42a8fa[_0x29f6('0x10')](0x1f4,_0x4200cc['message']));});});};exports[_0x29f6('0x1c')]=function(_0x45f792){var _0x2519ac=this;return new Promise(function(_0x342038,_0x84ccb7){return db[_0x29f6('0x16')][_0x29f6('0x1d')](_0x45f792['body'],{'raw':_0x45f792[_0x29f6('0x1e')]?_0x45f792[_0x29f6('0x1e')][_0x29f6('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x45f792[_0x29f6('0x1e')]?_0x45f792[_0x29f6('0x1e')][_0x29f6('0x1f')]||null:null,'attributes':_0x45f792[_0x29f6('0x1e')]?_0x45f792[_0x29f6('0x1e')][_0x29f6('0x20')]||null:null,'limit':_0x45f792[_0x29f6('0x1e')]?_0x45f792[_0x29f6('0x1e')][_0x29f6('0x21')]||null:null})[_0x29f6('0x19')](function(_0x304c28){logger[_0x29f6('0xd')](_0x29f6('0x1c'),_0x45f792);logger[_0x29f6('0x1a')]('UpdateFaxMessage',_0x45f792,JSON['stringify'](_0x304c28));_0x342038(_0x304c28);})[_0x29f6('0x1b')](function(_0x489897){logger[_0x29f6('0x10')](_0x29f6('0x1c'),_0x489897[_0x29f6('0x13')],_0x45f792);_0x84ccb7(_0x2519ac[_0x29f6('0x10')](0x1f4,_0x489897['message']));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 753a33c..094e373 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 _0xb151=['removeListener','register','length','./faxMessage.events','remove','update','emit'];(function(_0x424458,_0x45ec38){var _0x4610cf=function(_0x55a2f5){while(--_0x55a2f5){_0x424458['push'](_0x424458['shift']());}};_0x4610cf(++_0x45ec38);}(_0xb151,0xb2));var _0x1b15=function(_0x86cce3,_0x5ed5ff){_0x86cce3=_0x86cce3-0x0;var _0x2fca37=_0xb151[_0x86cce3];return _0x2fca37;};'use strict';var FaxMessageEvents=require(_0x1b15('0x0'));var events=['save',_0x1b15('0x1'),_0x1b15('0x2')];function createListener(_0x395793,_0x46ade5){return function(_0x19e65f){_0x46ade5[_0x1b15('0x3')](_0x395793,_0x19e65f);};}function removeListener(_0x4c0499,_0x58b851){return function(){FaxMessageEvents[_0x1b15('0x4')](_0x4c0499,_0x58b851);};}exports[_0x1b15('0x5')]=function(_0xcb8371){for(var _0x3d5905=0x0,_0x571ac8=events[_0x1b15('0x6')];_0x3d5905<_0x571ac8;_0x3d5905++){var _0x48fe3b=events[_0x3d5905];var _0x416d62=createListener('faxMessage:'+_0x48fe3b,_0xcb8371);FaxMessageEvents['on'](_0x48fe3b,_0x416d62);}}; \ No newline at end of file +var _0x014b=['length','remove','update','emit','removeListener','register'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0x014b,0x109));var _0xb014=function(_0x3eb7c4,_0x33127c){_0x3eb7c4=_0x3eb7c4-0x0;var _0x4fd396=_0x014b[_0x3eb7c4];return _0x4fd396;};'use strict';var FaxMessageEvents=require('./faxMessage.events');var events=['save',_0xb014('0x0'),_0xb014('0x1')];function createListener(_0xf9ce70,_0x2254f5){return function(_0x2682f6){_0x2254f5[_0xb014('0x2')](_0xf9ce70,_0x2682f6);};}function removeListener(_0x41c18e,_0x1c39d6){return function(){FaxMessageEvents[_0xb014('0x3')](_0x41c18e,_0x1c39d6);};}exports[_0xb014('0x4')]=function(_0x423594){for(var _0x1053c9=0x0,_0x2a2b7d=events[_0xb014('0x5')];_0x1053c9<_0x2a2b7d;_0x1053c9++){var _0x4f7c07=events[_0x1053c9];var _0x39e33f=createListener('faxMessage:'+_0x4f7c07,_0x423594);FaxMessageEvents['on'](_0x4f7c07,_0x39e33f);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 8a9789c..fe5482c 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 _0x0102=['show','/:id/download','download','post','tracked','fax','faxmessage:create','create','put','/:id','update','accept','/:id/reject','reject','exports','util','path','connect-timeout','express','./faxMessage.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x31cb5f,_0x2df766){var _0x586042=function(_0x53c807){while(--_0x53c807){_0x31cb5f['push'](_0x31cb5f['shift']());}};_0x586042(++_0x2df766);}(_0x0102,0x186));var _0x2010=function(_0x2fa3cb,_0x4a57fa){_0x2fa3cb=_0x2fa3cb-0x0;var _0x29f704=_0x0102[_0x2fa3cb];return _0x29f704;};'use strict';var multer=require('multer');var util=require(_0x2010('0x0'));var path=require(_0x2010('0x1'));var timeout=require(_0x2010('0x2'));var express=require(_0x2010('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x2010('0x4'));router[_0x2010('0x5')]('/',auth[_0x2010('0x6')](),controller[_0x2010('0x7')]);router['get'](_0x2010('0x8'),auth['isAuthenticated'](),controller[_0x2010('0x9')]);router[_0x2010('0x5')]('/:id',auth[_0x2010('0x6')](),controller[_0x2010('0xa')]);router[_0x2010('0x5')](_0x2010('0xb'),auth[_0x2010('0x6')](),controller[_0x2010('0xc')]);router[_0x2010('0xd')]('/',auth[_0x2010('0x6')](),interaction[_0x2010('0xe')](_0x2010('0xf'),_0x2010('0x10')),controller[_0x2010('0x11')]);router[_0x2010('0x12')](_0x2010('0x13'),auth[_0x2010('0x6')](),controller[_0x2010('0x14')]);router['put']('/:id/accept',auth[_0x2010('0x6')](),controller[_0x2010('0x15')]);router[_0x2010('0x12')](_0x2010('0x16'),auth[_0x2010('0x6')](),controller[_0x2010('0x17')]);router['delete'](_0x2010('0x13'),auth[_0x2010('0x6')](),controller['destroy']);module[_0x2010('0x18')]=router; \ No newline at end of file +var _0xf72b=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/download','post','tracked','fax','faxmessage:create','create','put','update','/:id/accept','accept','reject','delete','destroy','exports','multer','path','express'];(function(_0x165270,_0x34b93e){var _0x56dc19=function(_0x4eba9f){while(--_0x4eba9f){_0x165270['push'](_0x165270['shift']());}};_0x56dc19(++_0x34b93e);}(_0xf72b,0x1d9));var _0xbf72=function(_0x3d1289,_0xb17e79){_0x3d1289=_0x3d1289-0x0;var _0x1b5f88=_0xf72b[_0x3d1289];return _0x1b5f88;};'use strict';var multer=require(_0xbf72('0x0'));var util=require('util');var path=require(_0xbf72('0x1'));var timeout=require('connect-timeout');var express=require(_0xbf72('0x2'));var router=express[_0xbf72('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbf72('0x4'));var interaction=require(_0xbf72('0x5'));var config=require(_0xbf72('0x6'));var controller=require(_0xbf72('0x7'));router[_0xbf72('0x8')]('/',auth[_0xbf72('0x9')](),controller['index']);router[_0xbf72('0x8')](_0xbf72('0xa'),auth[_0xbf72('0x9')](),controller[_0xbf72('0xb')]);router[_0xbf72('0x8')](_0xbf72('0xc'),auth['isAuthenticated'](),controller[_0xbf72('0xd')]);router['get'](_0xbf72('0xe'),auth[_0xbf72('0x9')](),controller['download']);router[_0xbf72('0xf')]('/',auth[_0xbf72('0x9')](),interaction[_0xbf72('0x10')](_0xbf72('0x11'),_0xbf72('0x12')),controller[_0xbf72('0x13')]);router[_0xbf72('0x14')](_0xbf72('0xc'),auth['isAuthenticated'](),controller[_0xbf72('0x15')]);router[_0xbf72('0x14')](_0xbf72('0x16'),auth['isAuthenticated'](),controller[_0xbf72('0x17')]);router['put']('/:id/reject',auth['isAuthenticated'](),controller[_0xbf72('0x18')]);router[_0xbf72('0x19')](_0xbf72('0xc'),auth[_0xbf72('0x9')](),controller[_0xbf72('0x1a')]);module[_0xbf72('0x1b')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index fc59691..201e436 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 _0x7726=['exports','STRING','name','INTEGER','ENUM','beepall','roundrobin','sequelize'];(function(_0x9307ea,_0x38968a){var _0x295554=function(_0x342dcf){while(--_0x342dcf){_0x9307ea['push'](_0x9307ea['shift']());}};_0x295554(++_0x38968a);}(_0x7726,0x107));var _0x6772=function(_0x5967df,_0x4c334f){_0x5967df=_0x5967df-0x0;var _0x43d062=_0x7726[_0x5967df];return _0x43d062;};'use strict';var Sequelize=require(_0x6772('0x0'));module[_0x6772('0x1')]={'name':{'type':Sequelize[_0x6772('0x2')],'unique':_0x6772('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x6772('0x2')]},'timeout':{'type':Sequelize[_0x6772('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x6772('0x5')]('rrmemory',_0x6772('0x6'),_0x6772('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x6772('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x9f53=['exports','STRING','INTEGER','rrmemory','beepall','roundrobin','sequelize'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0x9f53,0xfb));var _0x39f5=function(_0x465daa,_0x558b2b){_0x465daa=_0x465daa-0x0;var _0xaa5a37=_0x9f53[_0x465daa];return _0xaa5a37;};'use strict';var Sequelize=require(_0x39f5('0x0'));module[_0x39f5('0x1')]={'name':{'type':Sequelize[_0x39f5('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x39f5('0x2')]},'timeout':{'type':Sequelize[_0x39f5('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x39f5('0x4'),_0x39f5('0x5'),_0x39f5('0x6')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x39f5('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index b493593..a8272ab 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 _0x68b3=['FaxQueue','rawAttributes','fieldName','type','key','getOptions','where','include','query','findAll','rows','catch','show','params','keys','filters','model','intersection','fields','attributes','includeAll','merge','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserFaxQueue','hasOwnProperty','nolimit','order','sort','pick','User','UserId','agent','updatedAt','createdAt','%s/%s','SIP','faxPause','Team','filter','getTeams','length','ids','online','voicePause','interface','flatMap','sequelize','transaction','addTeams','each','emit','userFaxQueue:save','removeTeams','Agents','select','field','tq.TeamId','from','team_has_fax_queues','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','push','toString','QueryTypes','every','TeamId','all','union','compact','isEmpty','addAgents','omit','spread','removeAgents','isArray','userFaxQueue:remove','getAgents','bluebird','util','lodash','squel','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','update','then','destroy','get','FaxQueues','UserProfileResource','error','name','send','index','map'];(function(_0x40069a,_0x23a64a){var _0x1f45e2=function(_0x367c56){while(--_0x367c56){_0x40069a['push'](_0x40069a['shift']());}};_0x1f45e2(++_0x23a64a);}(_0x68b3,0x1d8));var _0x368b=function(_0x501dae,_0x377a9d){_0x501dae=_0x501dae-0x0;var _0x36b040=_0x68b3[_0x501dae];return _0x36b040;};'use strict';var BPromise=require(_0x368b('0x0'));var util=require(_0x368b('0x1'));var _=require(_0x368b('0x2'));var squel=require(_0x368b('0x3'));var Redis=require(_0x368b('0x4'));var qs=require('../../components/parsers/qs');var logger=require(_0x368b('0x5'))(_0x368b('0x6'));var config=require(_0x368b('0x7'));var db=require(_0x368b('0x8'))['db'];config['redis']=_[_0x368b('0x9')](config[_0x368b('0xa')],{'host':_0x368b('0xb'),'port':0x18eb});var socket=require(_0x368b('0xc'))(new Redis(config[_0x368b('0xa')]));require(_0x368b('0xd'))[_0x368b('0xe')](socket);function respondWithStatusCode(_0x142d05,_0x23622f){_0x23622f=_0x23622f||0xcc;return function(_0x1f64d8){if(_0x1f64d8){return _0x142d05[_0x368b('0xf')](_0x23622f);}return _0x142d05['status'](_0x23622f)[_0x368b('0x10')]();};}function respondWithResult(_0xdbd344,_0x34a110){_0x34a110=_0x34a110||0xc8;return function(_0x51d513){if(_0x51d513){return _0xdbd344[_0x368b('0x11')](_0x34a110)[_0x368b('0x12')](_0x51d513);}};}function respondWithFilteredResult(_0x253e4b,_0x5924a6){return function(_0x41fbfd){if(_0x41fbfd){var _0x847dcb=typeof _0x5924a6['offset']===_0x368b('0x13')&&typeof _0x5924a6[_0x368b('0x14')]===_0x368b('0x13');var _0x4015fe=_0x41fbfd[_0x368b('0x15')];var _0x4fffe5=_0x847dcb?0x0:_0x5924a6[_0x368b('0x16')];var _0x40faa0=_0x847dcb?_0x41fbfd['count']:_0x5924a6[_0x368b('0x16')]+_0x5924a6[_0x368b('0x14')];var _0x30c245;if(_0x40faa0>=_0x4015fe){_0x40faa0=_0x4015fe;_0x30c245=0xc8;}else{_0x30c245=0xce;}_0x253e4b['status'](_0x30c245);return _0x253e4b[_0x368b('0x17')](_0x368b('0x18'),_0x4fffe5+'-'+_0x40faa0+'/'+_0x4015fe)[_0x368b('0x12')](_0x41fbfd);}return null;};}function saveUpdates(_0x4d6d9d){return function(_0x102407){if(_0x102407){return _0x102407[_0x368b('0x19')](_0x4d6d9d)[_0x368b('0x1a')](function(_0x540f57){return _0x540f57;});}return null;};}function removeEntity(_0x5d543e){return function(_0x3e2e9f){if(_0x3e2e9f){return _0x3e2e9f[_0x368b('0x1b')]()[_0x368b('0x1a')](function(){var _0x1e632a=_0x3e2e9f[_0x368b('0x1c')]({'plain':!![]});var _0x4b8fb7=_0x368b('0x1d');return db[_0x368b('0x1e')][_0x368b('0x1b')]({'where':{'type':_0x4b8fb7,'resourceId':_0x1e632a['id']}})[_0x368b('0x1a')](function(){return _0x3e2e9f;});})[_0x368b('0x1a')](function(){_0x5d543e[_0x368b('0x11')](0xcc)[_0x368b('0x10')]();});}};}function handleEntityNotFound(_0x1d8066){return function(_0x508e48){if(!_0x508e48){_0x1d8066[_0x368b('0xf')](0x194);}return _0x508e48;};}function handleError(_0x2f08d9,_0x18869a){_0x18869a=_0x18869a||0x1f4;return function(_0xc0f7af){logger[_0x368b('0x1f')](_0xc0f7af['stack']);if(_0xc0f7af[_0x368b('0x20')]){delete _0xc0f7af[_0x368b('0x20')];}_0x2f08d9[_0x368b('0x11')](_0x18869a)[_0x368b('0x21')](_0xc0f7af);};}exports[_0x368b('0x22')]=function(_0x85515f,_0x430e16){var _0x11ea2d={};var _0x3123c1={'count':0x0,'rows':[]};var _0x3f7f89=_[_0x368b('0x23')](db[_0x368b('0x24')][_0x368b('0x25')],function(_0x376e61){return{'name':_0x376e61[_0x368b('0x26')],'type':_0x376e61[_0x368b('0x27')][_0x368b('0x28')]};});_0x11ea2d=qs[_0x368b('0x29')](_0x3f7f89,_0x85515f);var _0x39ef94={'where':_0x11ea2d[_0x368b('0x2a')]};return db[_0x368b('0x24')][_0x368b('0x15')](_0x39ef94)[_0x368b('0x1a')](function(_0x3c80b5){_0x3123c1['count']=_0x3c80b5;_0x11ea2d['include']=qs[_0x368b('0x2b')](_0x85515f[_0x368b('0x2c')]);return db[_0x368b('0x24')][_0x368b('0x2d')](_0x11ea2d);})['then'](function(_0x12ae59){_0x3123c1[_0x368b('0x2e')]=_0x12ae59;return _0x3123c1;})[_0x368b('0x1a')](respondWithFilteredResult(_0x430e16,_0x11ea2d))[_0x368b('0x2f')](handleError(_0x430e16,null));};exports[_0x368b('0x30')]=function(_0x4d8410,_0x22ada9){var _0x424fab={'raw':!![],'where':{'id':_0x4d8410[_0x368b('0x31')]['id']}},_0x239536={};_0x239536['model']=_['keys'](db['FaxQueue'][_0x368b('0x25')]);_0x239536[_0x368b('0x2c')]=_[_0x368b('0x32')](_0x4d8410[_0x368b('0x2c')]);_0x239536[_0x368b('0x33')]=_['intersection'](_0x239536[_0x368b('0x34')],_0x239536[_0x368b('0x2c')]);_0x424fab['attributes']=_[_0x368b('0x35')](_0x239536[_0x368b('0x34')],qs['fields'](_0x4d8410[_0x368b('0x2c')][_0x368b('0x36')]));_0x424fab['attributes']=_0x424fab[_0x368b('0x37')]['length']?_0x424fab['attributes']:_0x239536['model'];if(_0x4d8410[_0x368b('0x2c')][_0x368b('0x38')]){_0x424fab[_0x368b('0x2b')]=[{'all':!![]}];}_0x424fab=_[_0x368b('0x39')]({},_0x424fab,_0x4d8410[_0x368b('0x3a')]);return db[_0x368b('0x24')][_0x368b('0x3b')](_0x424fab)[_0x368b('0x1a')](handleEntityNotFound(_0x22ada9,null))[_0x368b('0x1a')](respondWithResult(_0x22ada9,null))[_0x368b('0x2f')](handleError(_0x22ada9,null));};exports['create']=function(_0x204c52,_0x1f60ea){return db['FaxQueue'][_0x368b('0x3c')](_0x204c52[_0x368b('0x3d')],{})[_0x368b('0x1a')](function(_0x231d84){var _0x248b2b=_0x204c52['user'][_0x368b('0x1c')]({'plain':!![]});if(!_0x248b2b)throw new Error(_0x368b('0x3e'));if(_0x248b2b[_0x368b('0x3f')]===_0x368b('0x40')){var _0x4e44d0=_0x231d84['get']({'plain':!![]});var _0x7ba60d=_0x368b('0x1d');return db[_0x368b('0x41')][_0x368b('0x3b')]({'where':{'name':_0x7ba60d,'userProfileId':_0x248b2b[_0x368b('0x42')]},'raw':!![]})[_0x368b('0x1a')](function(_0x1d990c){if(_0x1d990c&&_0x1d990c[_0x368b('0x43')]===0x0){return db[_0x368b('0x1e')][_0x368b('0x3c')]({'name':_0x4e44d0['name'],'resourceId':_0x4e44d0['id'],'type':_0x1d990c[_0x368b('0x20')],'sectionId':_0x1d990c['id']},{})[_0x368b('0x1a')](function(){return _0x231d84;});}else{return _0x231d84;}})['catch'](function(_0x25e713){logger[_0x368b('0x1f')](_0x368b('0x44'),_0x25e713);throw _0x25e713;});}return _0x231d84;})[_0x368b('0x1a')](respondWithResult(_0x1f60ea,0xc9))['catch'](handleError(_0x1f60ea,null));};exports[_0x368b('0x19')]=function(_0x151711,_0x4a0275){if(_0x151711[_0x368b('0x3d')]['id']){delete _0x151711[_0x368b('0x3d')]['id'];}return db[_0x368b('0x24')]['find']({'where':{'id':_0x151711[_0x368b('0x31')]['id']}})[_0x368b('0x1a')](handleEntityNotFound(_0x4a0275,null))[_0x368b('0x1a')](saveUpdates(_0x151711['body'],null))['then'](respondWithResult(_0x4a0275,null))[_0x368b('0x2f')](handleError(_0x4a0275,null));};exports[_0x368b('0x1b')]=function(_0x568ee5,_0x2bb15a){return db[_0x368b('0x24')][_0x368b('0x3b')]({'where':{'id':_0x568ee5[_0x368b('0x31')]['id']}})[_0x368b('0x1a')](handleEntityNotFound(_0x2bb15a,null))[_0x368b('0x1a')](removeEntity(_0x2bb15a,null))[_0x368b('0x2f')](handleError(_0x2bb15a,null));};exports[_0x368b('0x45')]=function(_0x5db559,_0x33914c){return db[_0x368b('0x24')][_0x368b('0x45')]()[_0x368b('0x1a')](respondWithResult(_0x33914c,null))['catch'](handleError(_0x33914c,null));};exports[_0x368b('0x46')]=function(_0x1fff8e,_0xe79f4c){var _0xf95817={'raw':!![],'where':{}},_0x2d59fe={},_0x5a827e;return db['FaxQueue'][_0x368b('0x47')]({'where':{'id':_0x1fff8e[_0x368b('0x31')]['id']}})[_0x368b('0x1a')](handleEntityNotFound(_0xe79f4c,null))['then'](function(_0x378510){if(_0x378510){_0x5a827e=_0x378510[_0x368b('0x1c')]({'plain':!![]});_0x2d59fe[_0x368b('0x34')]=_[_0x368b('0x32')](db[_0x368b('0x48')][_0x368b('0x25')]);_0x2d59fe[_0x368b('0x2c')]=_[_0x368b('0x32')](_0x1fff8e[_0x368b('0x2c')]);_0x2d59fe[_0x368b('0x33')]=_['intersection'](_0x2d59fe[_0x368b('0x34')],_0x2d59fe['query']);_0xf95817[_0x368b('0x37')]=_['intersection'](_0x2d59fe[_0x368b('0x34')],qs['fields'](_0x1fff8e[_0x368b('0x2c')][_0x368b('0x36')]));_0xf95817[_0x368b('0x37')]=_0xf95817[_0x368b('0x37')]['length']?_0xf95817[_0x368b('0x37')]:_0x2d59fe[_0x368b('0x34')];if(!_0x1fff8e[_0x368b('0x2c')][_0x368b('0x49')](_0x368b('0x4a'))){_0xf95817[_0x368b('0x14')]=qs[_0x368b('0x14')](_0x1fff8e[_0x368b('0x2c')][_0x368b('0x14')]);_0xf95817['offset']=qs[_0x368b('0x16')](_0x1fff8e[_0x368b('0x2c')][_0x368b('0x16')]);}_0xf95817[_0x368b('0x4b')]=qs[_0x368b('0x4c')](_0x1fff8e['query'][_0x368b('0x4c')]);_0xf95817[_0x368b('0x2a')]=qs[_0x368b('0x33')](_[_0x368b('0x4d')](_0x1fff8e[_0x368b('0x2c')],_0x2d59fe[_0x368b('0x33')]));_0xf95817[_0x368b('0x2a')]['FaxQueueId']=_0x378510['id'];if(_0x1fff8e['query']['filter']){_0xf95817['where']=_[_0x368b('0x39')](_0xf95817['where'],{'$or':_[_0x368b('0x23')](_0xf95817[_0x368b('0x37')],function(_0x509dd4){var _0x5711ee={};_0x5711ee[_0x509dd4]={'$like':'%'+_0x1fff8e[_0x368b('0x2c')]['filter']+'%'};return _0x5711ee;})});}_0xf95817=_[_0x368b('0x39')]({},_0xf95817,_0x1fff8e[_0x368b('0x3a')]);return db['UserFaxQueue'][_0x368b('0x2d')](_0xf95817);}})[_0x368b('0x1a')](function(_0x58eb4a){if(_0x58eb4a){return db[_0x368b('0x4e')]['findAndCountAll']({'where':{'id':_[_0x368b('0x23')](_0x58eb4a,_0x368b('0x4f')),'role':_0x368b('0x50')},'attributes':['id',_0x368b('0x20'),'faxPause',_0x368b('0x51'),_0x368b('0x52')]});}})[_0x368b('0x1a')](function(_0x14974e){if(_0x14974e){return{'count':_0x14974e['count'],'rows':_[_0x368b('0x23')](_0x14974e['rows'],function(_0xa320cc){return{'membername':_0xa320cc[_0x368b('0x20')],'UserId':_0xa320cc['id'],'queue_name':_0x5a827e['name'],'FaxQueueId':_0x5a827e['id'],'interface':util['format'](_0x368b('0x53'),_0x368b('0x54'),_0xa320cc[_0x368b('0x20')]),'penalty':0x0,'paused':_0xa320cc[_0x368b('0x55')],'createdAt':_0xa320cc[_0x368b('0x52')],'updatedAt':_0xa320cc['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x368b('0x1a')](respondWithFilteredResult(_0xe79f4c,_0xf95817))[_0x368b('0x2f')](handleError(_0xe79f4c,null));};exports['getTeams']=function(_0x2e5827,_0x19d5cc){var _0x472507={};var _0x302b06={};var _0x5ef40c;var _0x3d66fe;return db[_0x368b('0x24')][_0x368b('0x47')]({'where':{'id':_0x2e5827[_0x368b('0x31')]['id']}})['then'](handleEntityNotFound(_0x19d5cc,null))['then'](function(_0x5c8438){if(_0x5c8438){_0x5ef40c=_0x5c8438;_0x302b06['model']=_[_0x368b('0x32')](db[_0x368b('0x56')]['rawAttributes']);_0x302b06['query']=_['keys'](_0x2e5827['query']);_0x302b06['filters']=_[_0x368b('0x35')](_0x302b06[_0x368b('0x34')],_0x302b06[_0x368b('0x2c')]);_0x472507['attributes']=_[_0x368b('0x35')](_0x302b06['model'],qs['fields'](_0x2e5827[_0x368b('0x2c')][_0x368b('0x36')]));_0x472507[_0x368b('0x37')]=_0x472507[_0x368b('0x37')]['length']?_0x472507[_0x368b('0x37')]:_0x302b06[_0x368b('0x34')];_0x472507[_0x368b('0x4b')]=qs['sort'](_0x2e5827[_0x368b('0x2c')][_0x368b('0x4c')]);_0x472507['where']=qs[_0x368b('0x33')](_[_0x368b('0x4d')](_0x2e5827['query'],_0x302b06[_0x368b('0x33')]));if(_0x2e5827['query'][_0x368b('0x57')]){_0x472507[_0x368b('0x2a')]=_['merge'](_0x472507[_0x368b('0x2a')],{'$or':_[_0x368b('0x23')](_0x472507[_0x368b('0x37')],function(_0x46d394){var _0x281023={};_0x281023[_0x46d394]={'$like':'%'+_0x2e5827['query'][_0x368b('0x57')]+'%'};return _0x281023;})});}_0x472507=_[_0x368b('0x39')]({},_0x472507,_0x2e5827[_0x368b('0x3a')]);return _0x5ef40c[_0x368b('0x58')](_0x472507);}})[_0x368b('0x1a')](function(_0x1c9cce){if(_0x1c9cce){_0x3d66fe=_0x1c9cce[_0x368b('0x59')];if(!_0x2e5827[_0x368b('0x2c')]['hasOwnProperty'](_0x368b('0x4a'))){_0x472507[_0x368b('0x14')]=qs['limit'](_0x2e5827[_0x368b('0x2c')][_0x368b('0x14')]);_0x472507[_0x368b('0x16')]=qs['offset'](_0x2e5827['query'][_0x368b('0x16')]);}return _0x5ef40c[_0x368b('0x58')](_0x472507);}})[_0x368b('0x1a')](function(_0xb7cef7){if(_0xb7cef7){return _0xb7cef7?{'count':_0x3d66fe,'rows':_0xb7cef7}:null;}})['then'](respondWithResult(_0x19d5cc,null))[_0x368b('0x2f')](handleError(_0x19d5cc,null));};exports['addTeams']=function(_0x19d3b4,_0x2af914){var _0x3eb462=_0x19d3b4['body'][_0x368b('0x5a')];return db[_0x368b('0x56')][_0x368b('0x2d')]({'where':{'id':_0x3eb462},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id','name',_0x368b('0x5b'),_0x368b('0x5c'),_0x368b('0x5d')],'raw':!![]}]})[_0x368b('0x1a')](function(_0x321112){if(_0x321112){var _0x5c338d=_[_0x368b('0x5e')](_0x321112,function(_0x3abf65){var _0x49e2fc=_0x3abf65[_0x368b('0x1c')]({'plain':!![]});return _0x49e2fc['Agents'];});return db['FaxQueue'][_0x368b('0x3b')]({'where':{'id':_0x19d3b4[_0x368b('0x31')]['id']}})[_0x368b('0x1a')](function(_0x21bfb3){return db[_0x368b('0x5f')][_0x368b('0x60')](function(_0x4921b0){return _0x21bfb3[_0x368b('0x61')](_0x3eb462,{'transaction':_0x4921b0})[_0x368b('0x1a')](function(){return BPromise[_0x368b('0x62')](_0x5c338d,function(_0x5d4179){return db['UserFaxQueue']['findOrCreate']({'where':{'UserId':_0x5d4179['id'],'FaxQueueId':_0x19d3b4['params']['id']},'transaction':_0x4921b0});});})[_0x368b('0x1a')](function(){_0x5c338d['forEach'](function(_0x5ab241){socket[_0x368b('0x63')](_0x368b('0x64'),{'UserId':_0x5ab241['id'],'FaxQueueId':_0x21bfb3['id']});});});});});}})[_0x368b('0x1a')](respondWithStatusCode(_0x2af914,null))[_0x368b('0x2f')](handleError(_0x2af914,null));};exports[_0x368b('0x65')]=function(_0xbfdde2,_0x67794e){return db[_0x368b('0x56')]['findAll']({'where':{'id':_0xbfdde2[_0x368b('0x2c')][_0x368b('0x5a')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x368b('0x66'),'attributes':['id'],'raw':!![]}]})[_0x368b('0x1a')](handleEntityNotFound(_0x67794e,null))[_0x368b('0x1a')](function(_0xb49743){var _0x152962=_[_0x368b('0x23')](_0xb49743,'id');var _0x1ac79c=[];var _0x41e848=[];var _0x26013b=squel[_0x368b('0x67')]();_0x26013b[_0x368b('0x68')](_0x368b('0x69'))[_0x368b('0x6a')](_0x368b('0x6b'),'tq')['join']('user_has_teams','ut',_0x368b('0x6c'))[_0x368b('0x2a')](_0x368b('0x6d'),_0xbfdde2['params']['id']);for(var _0x208cbb=0x0;_0x208cbb<_0xb49743[_0x368b('0x59')];_0x208cbb+=0x1){let _0x2350b5=_0xb49743[_0x208cbb];for(var _0x480af7=0x0;_0x480af7<_0x2350b5[_0x368b('0x66')][_0x368b('0x59')];_0x480af7+=0x1){let _0x5053b3=_0x2350b5[_0x368b('0x66')][_0x480af7];var _0x318be2=_0x26013b[_0x368b('0x6e')]();_0x318be2['where']('ut.UserId\x20=\x20?',_0x5053b3['id']);_0x41e848[_0x368b('0x6f')](db['sequelize'][_0x368b('0x2c')](_0x318be2[_0x368b('0x70')](),{'type':db[_0x368b('0x5f')][_0x368b('0x71')]['SELECT']})[_0x368b('0x1a')](function(_0x1a35c9){if(_0x1a35c9[_0x368b('0x59')]===0x1){return _0x5053b3['id'];}else{var _0x54c95a=_[_0x368b('0x72')](_[_0x368b('0x23')](_0x1a35c9,_0x368b('0x73')),function(_0x252bbd){return _['includes'](_0x152962,_0x252bbd);});if(_0x54c95a){return _0x5053b3['id'];}}}));}}return BPromise[_0x368b('0x74')](_0x41e848)['then'](function(_0x1740a6){_0x1ac79c=_(_0x1ac79c)[_0x368b('0x75')](_0x1740a6)[_0x368b('0x76')]()['value']();return db['FaxQueue']['find']({'where':{'id':_0xbfdde2['params']['id']}})[_0x368b('0x1a')](function(_0x3146a9){return db['sequelize']['transaction'](function(_0x1bde0a){return _0x3146a9['removeTeams'](_0xbfdde2[_0x368b('0x2c')][_0x368b('0x5a')],{'transaction':_0x1bde0a})['then'](function(){if(!_[_0x368b('0x77')](_0x1ac79c)){return _0x3146a9['removeAgents'](_0x1ac79c,{'transaction':_0x1bde0a});}})[_0x368b('0x1a')](function(){_0x1ac79c['forEach'](function(_0x1dd4a7){socket[_0x368b('0x63')]('userFaxQueue:remove',{'UserId':_0x1dd4a7,'FaxQueueId':_0x3146a9['id']});});});});});});})[_0x368b('0x1a')](respondWithStatusCode(_0x67794e,null))['catch'](handleError(_0x67794e,null));};exports[_0x368b('0x78')]=function(_0x2798e1,_0x51c695){return db['FaxQueue'][_0x368b('0x3b')]({'where':{'id':_0x2798e1['params']['id']}})['then'](handleEntityNotFound(_0x51c695,null))[_0x368b('0x1a')](function(_0x54c442){if(_0x54c442){return _0x54c442['addAgents'](_0x2798e1['body']['ids'],_[_0x368b('0x79')](_0x2798e1['body'],[_0x368b('0x5a'),'id'])||{})[_0x368b('0x7a')](function(_0x4861d9){for(var _0x302d6d=0x0;_0x302d6d<_0x2798e1[_0x368b('0x3d')]['ids'][_0x368b('0x59')];_0x302d6d+=0x1){socket['emit']('userFaxQueue:save',{'UserId':Number(_0x2798e1[_0x368b('0x3d')][_0x368b('0x5a')][_0x302d6d]),'FaxQueueId':Number(_0x2798e1['params']['id'])});}return _0x4861d9;});}})[_0x368b('0x1a')](respondWithResult(_0x51c695,null))['catch'](handleError(_0x51c695,null));};exports['removeAgents']=function(_0x379dc9,_0x4d7151){return db[_0x368b('0x24')]['find']({'where':{'id':_0x379dc9['params']['id']}})[_0x368b('0x1a')](handleEntityNotFound(_0x4d7151,null))['then'](function(_0x30235b){if(_0x30235b){return _0x30235b[_0x368b('0x7b')](_0x379dc9[_0x368b('0x2c')][_0x368b('0x5a')])[_0x368b('0x1a')](function(){if(_[_0x368b('0x7c')](_0x379dc9['query'][_0x368b('0x5a')])){for(var _0x11ed4b=0x0;_0x11ed4b<_0x379dc9[_0x368b('0x2c')][_0x368b('0x5a')][_0x368b('0x59')];_0x11ed4b+=0x1){socket['emit'](_0x368b('0x7d'),{'UserId':Number(_0x379dc9[_0x368b('0x2c')][_0x368b('0x5a')][_0x11ed4b]),'FaxQueueId':Number(_0x379dc9[_0x368b('0x31')]['id'])});}}else{socket[_0x368b('0x63')](_0x368b('0x7d'),{'UserId':Number(_0x379dc9[_0x368b('0x2c')][_0x368b('0x5a')]),'FaxQueueId':Number(_0x379dc9[_0x368b('0x31')]['id'])});}});}})[_0x368b('0x1a')](respondWithStatusCode(_0x4d7151,null))[_0x368b('0x2f')](handleError(_0x4d7151,null));};exports[_0x368b('0x7e')]=function(_0x14f666,_0x509092){var _0x4136e6={};var _0x42d423={};var _0x142868;var _0x179c33;return db[_0x368b('0x24')][_0x368b('0x47')]({'where':{'id':_0x14f666[_0x368b('0x31')]['id']}})[_0x368b('0x1a')](handleEntityNotFound(_0x509092,null))[_0x368b('0x1a')](function(_0x30e6c3){if(_0x30e6c3){_0x142868=_0x30e6c3;_0x42d423[_0x368b('0x34')]=_[_0x368b('0x32')](db[_0x368b('0x4e')]['rawAttributes']);_0x42d423[_0x368b('0x2c')]=_[_0x368b('0x32')](_0x14f666['query']);_0x42d423['filters']=_['intersection'](_0x42d423[_0x368b('0x34')],_0x42d423['query']);_0x4136e6['attributes']=_[_0x368b('0x35')](_0x42d423[_0x368b('0x34')],qs[_0x368b('0x36')](_0x14f666[_0x368b('0x2c')]['fields']));_0x4136e6[_0x368b('0x37')]=_0x4136e6[_0x368b('0x37')][_0x368b('0x59')]?_0x4136e6[_0x368b('0x37')]:_0x42d423[_0x368b('0x34')];_0x4136e6[_0x368b('0x4b')]=qs['sort'](_0x14f666[_0x368b('0x2c')][_0x368b('0x4c')]);_0x4136e6[_0x368b('0x2a')]=qs[_0x368b('0x33')](_[_0x368b('0x4d')](_0x14f666['query'],_0x42d423[_0x368b('0x33')]));if(_0x14f666['query'][_0x368b('0x57')]){_0x4136e6['where']=_[_0x368b('0x39')](_0x4136e6['where'],{'$or':_[_0x368b('0x23')](_0x4136e6['attributes'],function(_0x381226){var _0x145cf5={};_0x145cf5[_0x381226]={'$like':'%'+_0x14f666['query'][_0x368b('0x57')]+'%'};return _0x145cf5;})});}_0x4136e6=_[_0x368b('0x39')]({},_0x4136e6,_0x14f666[_0x368b('0x3a')]);return _0x142868[_0x368b('0x7e')](_0x4136e6);}})[_0x368b('0x1a')](function(_0x3273ae){if(_0x3273ae){_0x179c33=_0x3273ae[_0x368b('0x59')];if(!_0x14f666[_0x368b('0x2c')][_0x368b('0x49')](_0x368b('0x4a'))){_0x4136e6[_0x368b('0x14')]=qs[_0x368b('0x14')](_0x14f666[_0x368b('0x2c')]['limit']);_0x4136e6[_0x368b('0x16')]=qs['offset'](_0x14f666[_0x368b('0x2c')]['offset']);}return _0x142868[_0x368b('0x7e')](_0x4136e6);}})[_0x368b('0x1a')](function(_0x37ecf7){if(_0x37ecf7){return _0x37ecf7?{'count':_0x179c33,'rows':_0x37ecf7}:null;}})['then'](respondWithResult(_0x509092,null))[_0x368b('0x2f')](handleError(_0x509092,null));}; \ No newline at end of file +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(_0x1c6ef2,_0x8d926a){var _0x404b8c=function(_0x4fdf1e){while(--_0x4fdf1e){_0x1c6ef2['push'](_0x1c6ef2['shift']());}};_0x404b8c(++_0x8d926a);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x2bea98,_0x158b40){_0x2bea98=_0x2bea98-0x0;var _0x335552=_0xb4c7[_0x2bea98];return _0x335552;};'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 diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index c84b773..e405ed5 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 _0xeb27=['events','../../mysqldb','FaxQueue','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports'];(function(_0x20f7d2,_0x41678d){var _0x3c6e14=function(_0x183896){while(--_0x183896){_0x20f7d2['push'](_0x20f7d2['shift']());}};_0x3c6e14(++_0x41678d);}(_0xeb27,0x78));var _0x7eb2=function(_0x3d0942,_0x5771c7){_0x3d0942=_0x3d0942-0x0;var _0x337d47=_0xeb27[_0x3d0942];return _0x337d47;};'use strict';var EventEmitter=require(_0x7eb2('0x0'));var FaxQueue=require(_0x7eb2('0x1'))['db'][_0x7eb2('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x7eb2('0x3')](0x0);var events={'afterCreate':_0x7eb2('0x4'),'afterUpdate':_0x7eb2('0x5'),'afterDestroy':'remove'};function emitEvent(_0x3e6144){return function(_0xa2a368,_0x16aebb,_0x17e713){FaxQueueEvents['emit'](_0x3e6144+':'+_0xa2a368['id'],_0xa2a368);FaxQueueEvents[_0x7eb2('0x6')](_0x3e6144,_0xa2a368);_0x17e713(null);};}for(var e in events){if(events[_0x7eb2('0x7')](e)){var event=events[e];FaxQueue[_0x7eb2('0x8')](e,emitEvent(event));}}module[_0x7eb2('0x9')]=FaxQueueEvents; \ No newline at end of file +var _0xbe6f=['hasOwnProperty','hook','exports','events','../../mysqldb','FaxQueue','setMaxListeners','save','update','emit'];(function(_0x2f00e9,_0x1797bf){var _0x1c874c=function(_0x52208d){while(--_0x52208d){_0x2f00e9['push'](_0x2f00e9['shift']());}};_0x1c874c(++_0x1797bf);}(_0xbe6f,0x189));var _0xfbe6=function(_0x5f556e,_0xc918bb){_0x5f556e=_0x5f556e-0x0;var _0x2fab39=_0xbe6f[_0x5f556e];return _0x2fab39;};'use strict';var EventEmitter=require(_0xfbe6('0x0'));var FaxQueue=require(_0xfbe6('0x1'))['db'][_0xfbe6('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xfbe6('0x3')](0x0);var events={'afterCreate':_0xfbe6('0x4'),'afterUpdate':_0xfbe6('0x5'),'afterDestroy':'remove'};function emitEvent(_0x4eec14){return function(_0x2944d8,_0x2f2a49,_0x1f43ff){FaxQueueEvents[_0xfbe6('0x6')](_0x4eec14+':'+_0x2944d8['id'],_0x2944d8);FaxQueueEvents[_0xfbe6('0x6')](_0x4eec14,_0x2944d8);_0x1f43ff(null);};}for(var e in events){if(events[_0xfbe6('0x7')](e)){var event=events[e];FaxQueue[_0xfbe6('0x8')](e,emitEvent(event));}}module[_0xfbe6('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 a90d1c5..2a6b132 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 _0x69cd=['fax_queues','api','moment','bluebird','path','rimraf','../../config/environment','./faxQueue.attributes','exports','define','FaxQueue'];(function(_0x2c2d99,_0x1a61ce){var _0xc9af40=function(_0x4bc502){while(--_0x4bc502){_0x2c2d99['push'](_0x2c2d99['shift']());}};_0xc9af40(++_0x1a61ce);}(_0x69cd,0x16c));var _0xd69c=function(_0x64aff8,_0x106082){_0x64aff8=_0x64aff8-0x0;var _0x5488a3=_0x69cd[_0x64aff8];return _0x5488a3;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xd69c('0x0'));var moment=require(_0xd69c('0x1'));var BPromise=require(_0xd69c('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd69c('0x3'));var rimraf=require(_0xd69c('0x4'));var config=require(_0xd69c('0x5'));var attributes=require(_0xd69c('0x6'));module[_0xd69c('0x7')]=function(_0x47560c,_0x4cedca){return _0x47560c[_0xd69c('0x8')](_0xd69c('0x9'),attributes,{'tableName':_0xd69c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xecc4=['bluebird','path','rimraf','../../config/environment','exports','../../config/logger','api','moment'];(function(_0x370b20,_0xae065c){var _0x5bc5fb=function(_0x5b8e87){while(--_0x5b8e87){_0x370b20['push'](_0x370b20['shift']());}};_0x5bc5fb(++_0xae065c);}(_0xecc4,0x1ad));var _0x4ecc=function(_0x363240,_0x230d4e){_0x363240=_0x363240-0x0;var _0x937893=_0xecc4[_0x363240];return _0x937893;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4ecc('0x0'))(_0x4ecc('0x1'));var moment=require(_0x4ecc('0x2'));var BPromise=require(_0x4ecc('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4ecc('0x4'));var rimraf=require(_0x4ecc('0x5'));var config=require(_0x4ecc('0x6'));var attributes=require('./faxQueue.attributes');module[_0x4ecc('0x7')]=function(_0x307efb,_0x5aa5a6){return _0x307efb['define']('FaxQueue',attributes,{'tableName':'fax_queues','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 7763a4e..96f1921 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 _0x67de=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','./faxQueue.socket','request','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetFaxQueue','findAll','options','raw','attributes','include','map','model','then','ShowFaxQueue','FaxQueue','find'];(function(_0x4cc198,_0x11a598){var _0x3e8858=function(_0x226554){while(--_0x226554){_0x4cc198['push'](_0x4cc198['shift']());}};_0x3e8858(++_0x11a598);}(_0x67de,0xa0));var _0xe67d=function(_0x213919,_0x31ca13){_0x213919=_0x213919-0x0;var _0x1cb2c3=_0x67de[_0x213919];return _0x1cb2c3;};'use strict';var _=require(_0xe67d('0x0'));var util=require(_0xe67d('0x1'));var moment=require(_0xe67d('0x2'));var BPromise=require(_0xe67d('0x3'));var rs=require(_0xe67d('0x4'));var fs=require('fs');var Redis=require(_0xe67d('0x5'));var db=require(_0xe67d('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xe67d('0x7'))(_0xe67d('0x8'));var config=require('../../config/environment');var jayson=require(_0xe67d('0x9'));var client=jayson[_0xe67d('0xa')][_0xe67d('0xb')]({'port':0x232a});config[_0xe67d('0xc')]=_[_0xe67d('0xd')](config[_0xe67d('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xe67d('0xe'))(new Redis(config['redis']));require(_0xe67d('0xf'))['register'](socket);function respondWithRpcPromise(_0x12f4c9,_0x3b1a20,_0x4e4b78){return new BPromise(function(_0x4bb57b,_0xce10df){return client[_0xe67d('0x10')](_0x12f4c9,_0x4e4b78)['then'](function(_0x4338fc){logger[_0xe67d('0x11')](_0xe67d('0x12'),_0x3b1a20,_0xe67d('0x13'));logger[_0xe67d('0x14')](_0xe67d('0x15'),_0x3b1a20,_0xe67d('0x13'),JSON[_0xe67d('0x16')](_0x4338fc));if(_0x4338fc[_0xe67d('0x17')]){if(_0x4338fc[_0xe67d('0x17')][_0xe67d('0x18')]===0x1f4){logger[_0xe67d('0x17')](_0xe67d('0x12'),_0x3b1a20,_0x4338fc[_0xe67d('0x17')][_0xe67d('0x19')]);return _0xce10df(_0x4338fc[_0xe67d('0x17')]['message']);}logger[_0xe67d('0x17')](_0xe67d('0x12'),_0x3b1a20,_0x4338fc['error'][_0xe67d('0x19')]);return _0x4bb57b(_0x4338fc[_0xe67d('0x17')][_0xe67d('0x19')]);}else{logger[_0xe67d('0x11')](_0xe67d('0x12'),_0x3b1a20,_0xe67d('0x13'));_0x4bb57b(_0x4338fc[_0xe67d('0x1a')][_0xe67d('0x19')]);}})[_0xe67d('0x1b')](function(_0x3ec7e7){logger[_0xe67d('0x17')](_0xe67d('0x12'),_0x3b1a20,_0x3ec7e7);_0xce10df(_0x3ec7e7);});});}exports[_0xe67d('0x1c')]=function(_0x14e098){var _0x3c2ca4=this;return new Promise(function(_0x5cb23f,_0x4f2b62){return db['FaxQueue'][_0xe67d('0x1d')]({'raw':_0x14e098[_0xe67d('0x1e')]?_0x14e098[_0xe67d('0x1e')][_0xe67d('0x1f')]===undefined?!![]:![]:!![],'where':_0x14e098[_0xe67d('0x1e')]?_0x14e098[_0xe67d('0x1e')]['where']||null:null,'attributes':_0x14e098[_0xe67d('0x1e')]?_0x14e098[_0xe67d('0x1e')][_0xe67d('0x20')]||null:null,'limit':_0x14e098['options']?_0x14e098[_0xe67d('0x1e')]['limit']||null:null,'include':_0x14e098[_0xe67d('0x1e')]?_0x14e098[_0xe67d('0x1e')][_0xe67d('0x21')]?_[_0xe67d('0x22')](_0x14e098[_0xe67d('0x1e')][_0xe67d('0x21')],function(_0x1d14eb){return{'model':db[_0x1d14eb[_0xe67d('0x23')]],'as':_0x1d14eb['as'],'attributes':_0x1d14eb[_0xe67d('0x20')],'include':_0x1d14eb['include']?_['map'](_0x1d14eb[_0xe67d('0x21')],function(_0x4740e0){return{'model':db[_0x4740e0[_0xe67d('0x23')]],'as':_0x4740e0['as'],'attributes':_0x4740e0['attributes'],'include':_0x4740e0['include']?_['map'](_0x4740e0[_0xe67d('0x21')],function(_0x5de1e4){return{'model':db[_0x5de1e4[_0xe67d('0x23')]],'as':_0x5de1e4['as'],'attributes':_0x5de1e4[_0xe67d('0x20')]};}):[]};}):[]};}):[]:[]})[_0xe67d('0x24')](function(_0x5ace22){logger['info']('GetFaxQueue',_0x14e098);logger[_0xe67d('0x14')](_0xe67d('0x1c'),_0x14e098,JSON[_0xe67d('0x16')](_0x5ace22));_0x5cb23f(_0x5ace22);})[_0xe67d('0x1b')](function(_0x2cc1b4){logger[_0xe67d('0x17')](_0xe67d('0x1c'),_0x2cc1b4[_0xe67d('0x19')],_0x14e098);_0x4f2b62(_0x3c2ca4['error'](0x1f4,_0x2cc1b4[_0xe67d('0x19')]));});});};exports[_0xe67d('0x25')]=function(_0x42f259){var _0x2d0050=this;return new Promise(function(_0x44e4ec,_0x37ed28){return db[_0xe67d('0x26')][_0xe67d('0x27')]({'raw':_0x42f259['options']?_0x42f259[_0xe67d('0x1e')][_0xe67d('0x1f')]===undefined?!![]:![]:!![],'where':_0x42f259[_0xe67d('0x1e')]?_0x42f259[_0xe67d('0x1e')]['where']||null:null,'attributes':_0x42f259[_0xe67d('0x1e')]?_0x42f259['options'][_0xe67d('0x20')]||null:null,'include':_0x42f259['options']?_0x42f259['options'][_0xe67d('0x21')]?_[_0xe67d('0x22')](_0x42f259[_0xe67d('0x1e')][_0xe67d('0x21')],function(_0x285fd9){return{'model':db[_0x285fd9[_0xe67d('0x23')]],'as':_0x285fd9['as'],'attributes':_0x285fd9[_0xe67d('0x20')],'include':_0x285fd9['include']?_[_0xe67d('0x22')](_0x285fd9[_0xe67d('0x21')],function(_0x5021f7){return{'model':db[_0x5021f7[_0xe67d('0x23')]],'as':_0x5021f7['as'],'attributes':_0x5021f7['attributes'],'include':_0x5021f7[_0xe67d('0x21')]?_[_0xe67d('0x22')](_0x5021f7[_0xe67d('0x21')],function(_0x1b62a9){return{'model':db[_0x1b62a9[_0xe67d('0x23')]],'as':_0x1b62a9['as'],'attributes':_0x1b62a9[_0xe67d('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fe10a){logger['info'](_0xe67d('0x25'),_0x42f259);logger[_0xe67d('0x14')](_0xe67d('0x25'),_0x42f259,JSON['stringify'](_0x2fe10a));_0x44e4ec(_0x2fe10a);})[_0xe67d('0x1b')](function(_0x8151b7){logger[_0xe67d('0x17')](_0xe67d('0x25'),_0x8151b7[_0xe67d('0x19')],_0x42f259);_0x37ed28(_0x2d0050[_0xe67d('0x17')](0x1f4,_0x8151b7['message']));});});}; \ No newline at end of file +var _0x3c5b=['attributes','stringify','ShowFaxQueue','then','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','request','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','GetFaxQueue','FaxQueue','findAll','options','raw','where','limit','include','map','model'];(function(_0x7e7cb4,_0x18106e){var _0x3577aa=function(_0x52f92e){while(--_0x52f92e){_0x7e7cb4['push'](_0x7e7cb4['shift']());}};_0x3577aa(++_0x18106e);}(_0x3c5b,0xe8));var _0xb3c5=function(_0x16df72,_0x540c04){_0x16df72=_0x16df72-0x0;var _0x1480e9=_0x3c5b[_0x16df72];return _0x1480e9;};'use strict';var _=require(_0xb3c5('0x0'));var util=require(_0xb3c5('0x1'));var moment=require(_0xb3c5('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb3c5('0x3'));var db=require(_0xb3c5('0x4'))['db'];var utils=require(_0xb3c5('0x5'));var logger=require(_0xb3c5('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xb3c5('0x7'));var client=jayson['client']['http']({'port':0x232a});config[_0xb3c5('0x8')]=_[_0xb3c5('0x9')](config[_0xb3c5('0x8')],{'host':_0xb3c5('0xa'),'port':0x18eb});var socket=require(_0xb3c5('0xb'))(new Redis(config['redis']));require(_0xb3c5('0xc'))[_0xb3c5('0xd')](socket);function respondWithRpcPromise(_0x77963d,_0x4d9fbe,_0xbf1319){return new BPromise(function(_0x32fc20,_0x19eff4){return client[_0xb3c5('0xe')](_0x77963d,_0xbf1319)['then'](function(_0x537675){logger['info'](_0xb3c5('0xf'),_0x4d9fbe,_0xb3c5('0x10'));logger[_0xb3c5('0x11')](_0xb3c5('0x12'),_0x4d9fbe,_0xb3c5('0x10'),JSON['stringify'](_0x537675));if(_0x537675[_0xb3c5('0x13')]){if(_0x537675[_0xb3c5('0x13')]['code']===0x1f4){logger[_0xb3c5('0x13')]('FaxQueue,\x20%s,\x20%s',_0x4d9fbe,_0x537675[_0xb3c5('0x13')][_0xb3c5('0x14')]);return _0x19eff4(_0x537675[_0xb3c5('0x13')]['message']);}logger[_0xb3c5('0x13')](_0xb3c5('0xf'),_0x4d9fbe,_0x537675[_0xb3c5('0x13')][_0xb3c5('0x14')]);return _0x32fc20(_0x537675[_0xb3c5('0x13')]['message']);}else{logger[_0xb3c5('0x15')](_0xb3c5('0xf'),_0x4d9fbe,'request\x20sent');_0x32fc20(_0x537675[_0xb3c5('0x16')][_0xb3c5('0x14')]);}})[_0xb3c5('0x17')](function(_0xa91d7e){logger[_0xb3c5('0x13')](_0xb3c5('0xf'),_0x4d9fbe,_0xa91d7e);_0x19eff4(_0xa91d7e);});});}exports[_0xb3c5('0x18')]=function(_0x938af5){var _0x3b92a9=this;return new Promise(function(_0x3aa22d,_0x251620){return db[_0xb3c5('0x19')][_0xb3c5('0x1a')]({'raw':_0x938af5[_0xb3c5('0x1b')]?_0x938af5[_0xb3c5('0x1b')][_0xb3c5('0x1c')]===undefined?!![]:![]:!![],'where':_0x938af5['options']?_0x938af5[_0xb3c5('0x1b')][_0xb3c5('0x1d')]||null:null,'attributes':_0x938af5[_0xb3c5('0x1b')]?_0x938af5[_0xb3c5('0x1b')]['attributes']||null:null,'limit':_0x938af5[_0xb3c5('0x1b')]?_0x938af5[_0xb3c5('0x1b')][_0xb3c5('0x1e')]||null:null,'include':_0x938af5[_0xb3c5('0x1b')]?_0x938af5[_0xb3c5('0x1b')][_0xb3c5('0x1f')]?_[_0xb3c5('0x20')](_0x938af5[_0xb3c5('0x1b')]['include'],function(_0x29062){return{'model':db[_0x29062[_0xb3c5('0x21')]],'as':_0x29062['as'],'attributes':_0x29062['attributes'],'include':_0x29062[_0xb3c5('0x1f')]?_[_0xb3c5('0x20')](_0x29062[_0xb3c5('0x1f')],function(_0x292c2d){return{'model':db[_0x292c2d[_0xb3c5('0x21')]],'as':_0x292c2d['as'],'attributes':_0x292c2d[_0xb3c5('0x22')],'include':_0x292c2d[_0xb3c5('0x1f')]?_[_0xb3c5('0x20')](_0x292c2d[_0xb3c5('0x1f')],function(_0x156dbb){return{'model':db[_0x156dbb[_0xb3c5('0x21')]],'as':_0x156dbb['as'],'attributes':_0x156dbb['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x108b7e){logger[_0xb3c5('0x15')](_0xb3c5('0x18'),_0x938af5);logger[_0xb3c5('0x11')](_0xb3c5('0x18'),_0x938af5,JSON[_0xb3c5('0x23')](_0x108b7e));_0x3aa22d(_0x108b7e);})[_0xb3c5('0x17')](function(_0xd198c2){logger[_0xb3c5('0x13')](_0xb3c5('0x18'),_0xd198c2[_0xb3c5('0x14')],_0x938af5);_0x251620(_0x3b92a9[_0xb3c5('0x13')](0x1f4,_0xd198c2[_0xb3c5('0x14')]));});});};exports[_0xb3c5('0x24')]=function(_0x5dba6e){var _0x1adfb6=this;return new Promise(function(_0x31a167,_0x5dd284){return db[_0xb3c5('0x19')]['find']({'raw':_0x5dba6e[_0xb3c5('0x1b')]?_0x5dba6e[_0xb3c5('0x1b')][_0xb3c5('0x1c')]===undefined?!![]:![]:!![],'where':_0x5dba6e[_0xb3c5('0x1b')]?_0x5dba6e['options']['where']||null:null,'attributes':_0x5dba6e[_0xb3c5('0x1b')]?_0x5dba6e['options'][_0xb3c5('0x22')]||null:null,'include':_0x5dba6e[_0xb3c5('0x1b')]?_0x5dba6e['options'][_0xb3c5('0x1f')]?_['map'](_0x5dba6e[_0xb3c5('0x1b')][_0xb3c5('0x1f')],function(_0x243f33){return{'model':db[_0x243f33['model']],'as':_0x243f33['as'],'attributes':_0x243f33[_0xb3c5('0x22')],'include':_0x243f33[_0xb3c5('0x1f')]?_[_0xb3c5('0x20')](_0x243f33['include'],function(_0x44eb18){return{'model':db[_0x44eb18['model']],'as':_0x44eb18['as'],'attributes':_0x44eb18['attributes'],'include':_0x44eb18[_0xb3c5('0x1f')]?_['map'](_0x44eb18['include'],function(_0x163fcb){return{'model':db[_0x163fcb[_0xb3c5('0x21')]],'as':_0x163fcb['as'],'attributes':_0x163fcb[_0xb3c5('0x22')]};}):[]};}):[]};}):[]:[]})[_0xb3c5('0x25')](function(_0x56eb79){logger['info'](_0xb3c5('0x24'),_0x5dba6e);logger['debug'](_0xb3c5('0x24'),_0x5dba6e,JSON[_0xb3c5('0x23')](_0x56eb79));_0x31a167(_0x56eb79);})[_0xb3c5('0x17')](function(_0x5dd122){logger['error'](_0xb3c5('0x24'),_0x5dd122[_0xb3c5('0x14')],_0x5dba6e);_0x5dd284(_0x1adfb6[_0xb3c5('0x13')](0x1f4,_0x5dd122[_0xb3c5('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index ee4e26b..c3c85bf 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 _0xf897=['emit','removeListener','register','length','./faxQueue.events','save','remove','update'];(function(_0x5770dc,_0x3da745){var _0x425e9a=function(_0x9ffb99){while(--_0x9ffb99){_0x5770dc['push'](_0x5770dc['shift']());}};_0x425e9a(++_0x3da745);}(_0xf897,0xe4));var _0x7f89=function(_0x827744,_0x23b9c0){_0x827744=_0x827744-0x0;var _0x8b1d96=_0xf897[_0x827744];return _0x8b1d96;};'use strict';var FaxQueueEvents=require(_0x7f89('0x0'));var events=[_0x7f89('0x1'),_0x7f89('0x2'),_0x7f89('0x3')];function createListener(_0x27c0e4,_0x192b44){return function(_0x1f8d54){_0x192b44[_0x7f89('0x4')](_0x27c0e4,_0x1f8d54);};}function removeListener(_0x1b4c56,_0x3b5e37){return function(){FaxQueueEvents[_0x7f89('0x5')](_0x1b4c56,_0x3b5e37);};}exports[_0x7f89('0x6')]=function(_0x338dae){for(var _0x47f87d=0x0,_0x2d14d2=events[_0x7f89('0x7')];_0x47f87d<_0x2d14d2;_0x47f87d++){var _0x5ef009=events[_0x47f87d];var _0x48e30a=createListener('faxQueue:'+_0x5ef009,_0x338dae);FaxQueueEvents['on'](_0x5ef009,_0x48e30a);}}; \ No newline at end of file +var _0x038b=['removeListener','register','length','save','remove','update','emit'];(function(_0x434804,_0x415f68){var _0x573fc8=function(_0x3ce265){while(--_0x3ce265){_0x434804['push'](_0x434804['shift']());}};_0x573fc8(++_0x415f68);}(_0x038b,0x114));var _0xb038=function(_0x56970f,_0x504480){_0x56970f=_0x56970f-0x0;var _0x2a6951=_0x038b[_0x56970f];return _0x2a6951;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=[_0xb038('0x0'),_0xb038('0x1'),_0xb038('0x2')];function createListener(_0x5623c3,_0x3d7dfe){return function(_0x5ed31a){_0x3d7dfe[_0xb038('0x3')](_0x5623c3,_0x5ed31a);};}function removeListener(_0x3d090b,_0x4a8a30){return function(){FaxQueueEvents[_0xb038('0x4')](_0x3d090b,_0x4a8a30);};}exports[_0xb038('0x5')]=function(_0x4fe092){for(var _0x54e1e7=0x0,_0x2e3e64=events[_0xb038('0x6')];_0x54e1e7<_0x2e3e64;_0x54e1e7++){var _0x1534a9=events[_0x54e1e7];var _0x4b4085=createListener('faxQueue:'+_0x1534a9,_0x4fe092);FaxQueueEvents['on'](_0x1534a9,_0x4b4085);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index f9ac1b5..7133ffd 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 _0x27a0=['/:id/users','getAgents','post','addTeams','addAgents','update','destroy','delete','exports','util','path','connect-timeout','express','Router','./faxQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x27a0,0xbf));var _0x027a=function(_0x3e67c7,_0x33fb73){_0x3e67c7=_0x3e67c7-0x0;var _0x4a20b2=_0x27a0[_0x3e67c7];return _0x4a20b2;};'use strict';var multer=require('multer');var util=require(_0x027a('0x0'));var path=require(_0x027a('0x1'));var timeout=require(_0x027a('0x2'));var express=require(_0x027a('0x3'));var router=express[_0x027a('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x027a('0x5'));router[_0x027a('0x6')]('/',auth[_0x027a('0x7')](),controller[_0x027a('0x8')]);router[_0x027a('0x6')](_0x027a('0x9'),auth['isAuthenticated'](),controller[_0x027a('0xa')]);router[_0x027a('0x6')](_0x027a('0xb'),auth['isAuthenticated'](),controller[_0x027a('0xc')]);router[_0x027a('0x6')](_0x027a('0xd'),auth['isAuthenticated'](),controller[_0x027a('0xe')]);router[_0x027a('0x6')](_0x027a('0xf'),auth[_0x027a('0x7')](),controller[_0x027a('0x10')]);router[_0x027a('0x6')](_0x027a('0x11'),auth[_0x027a('0x7')](),controller[_0x027a('0x12')]);router[_0x027a('0x13')]('/',auth[_0x027a('0x7')](),controller['create']);router[_0x027a('0x13')](_0x027a('0xf'),auth[_0x027a('0x7')](),controller[_0x027a('0x14')]);router[_0x027a('0x13')]('/:id/users',auth['isAuthenticated'](),controller[_0x027a('0x15')]);router['put'](_0x027a('0xb'),auth['isAuthenticated'](),controller[_0x027a('0x16')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x027a('0x17')]);router[_0x027a('0x18')](_0x027a('0xf'),auth[_0x027a('0x7')](),controller['removeTeams']);router[_0x027a('0x18')](_0x027a('0x11'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x027a('0x19')]=router; \ No newline at end of file +var _0xbd10=['path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','update','destroy','delete','removeTeams','multer','util'];(function(_0x49eaac,_0x429484){var _0x326559=function(_0x55340d){while(--_0x55340d){_0x49eaac['push'](_0x49eaac['shift']());}};_0x326559(++_0x429484);}(_0xbd10,0x85));var _0x0bd1=function(_0x3eb61f,_0x392042){_0x3eb61f=_0x3eb61f-0x0;var _0x5f1e4d=_0xbd10[_0x3eb61f];return _0x5f1e4d;};'use strict';var multer=require(_0x0bd1('0x0'));var util=require(_0x0bd1('0x1'));var path=require(_0x0bd1('0x2'));var timeout=require('connect-timeout');var express=require(_0x0bd1('0x3'));var router=express[_0x0bd1('0x4')]();var fs_extra=require(_0x0bd1('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0bd1('0x6'));var config=require(_0x0bd1('0x7'));var controller=require(_0x0bd1('0x8'));router[_0x0bd1('0x9')]('/',auth[_0x0bd1('0xa')](),controller[_0x0bd1('0xb')]);router['get'](_0x0bd1('0xc'),auth['isAuthenticated'](),controller[_0x0bd1('0xd')]);router[_0x0bd1('0x9')](_0x0bd1('0xe'),auth[_0x0bd1('0xa')](),controller['show']);router[_0x0bd1('0x9')](_0x0bd1('0xf'),auth[_0x0bd1('0xa')](),controller[_0x0bd1('0x10')]);router[_0x0bd1('0x9')](_0x0bd1('0x11'),auth['isAuthenticated'](),controller[_0x0bd1('0x12')]);router[_0x0bd1('0x9')](_0x0bd1('0x13'),auth[_0x0bd1('0xa')](),controller[_0x0bd1('0x14')]);router[_0x0bd1('0x15')]('/',auth['isAuthenticated'](),controller[_0x0bd1('0x16')]);router[_0x0bd1('0x15')](_0x0bd1('0x11'),auth['isAuthenticated'](),controller['addTeams']);router[_0x0bd1('0x15')](_0x0bd1('0x13'),auth[_0x0bd1('0xa')](),controller['addAgents']);router['put'](_0x0bd1('0xe'),auth[_0x0bd1('0xa')](),controller[_0x0bd1('0x17')]);router['delete'](_0x0bd1('0xe'),auth[_0x0bd1('0xa')](),controller[_0x0bd1('0x18')]);router[_0x0bd1('0x19')]('/:id/teams',auth[_0x0bd1('0xa')](),controller[_0x0bd1('0x1a')]);router['delete'](_0x0bd1('0x13'),auth[_0x0bd1('0xa')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 35d3ebb..83e7a0c 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 _0xac03=['DATE','exports','STRING'];(function(_0x3815c2,_0x1f54e3){var _0x271f88=function(_0x53963c){while(--_0x53963c){_0x3815c2['push'](_0x3815c2['shift']());}};_0x271f88(++_0x1f54e3);}(_0xac03,0x181));var _0x3ac0=function(_0x1c01d8,_0x2ff6d3){_0x1c01d8=_0x1c01d8-0x0;var _0x1a368d=_0xac03[_0x1c01d8];return _0x1a368d;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x3ac0('0x0')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x3ac0('0x1')]},'joinAt':{'type':Sequelize[_0x3ac0('0x2')]},'leaveAt':{'type':Sequelize[_0x3ac0('0x2')]},'acceptAt':{'type':Sequelize[_0x3ac0('0x2')]},'exitAt':{'type':Sequelize[_0x3ac0('0x2')]},'reason':{'type':Sequelize[_0x3ac0('0x1')]}}; \ No newline at end of file +var _0x89bf=['DATE','moment','exports','STRING'];(function(_0x44295c,_0x41e434){var _0x342694=function(_0x1ea187){while(--_0x1ea187){_0x44295c['push'](_0x44295c['shift']());}};_0x342694(++_0x41e434);}(_0x89bf,0x11d));var _0xf89b=function(_0x394bf2,_0x331e93){_0x394bf2=_0x394bf2-0x0;var _0x562d39=_0x89bf[_0x394bf2];return _0x562d39;};'use strict';var moment=require(_0xf89b('0x0'));var Sequelize=require('sequelize');module[_0xf89b('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xf89b('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xf89b('0x3')]},'acceptAt':{'type':Sequelize[_0xf89b('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xf89b('0x2')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 8d7f4d4..f113dc1 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 _0xf996=['limit','set','Content-Range','reject','save','update','then','destroy','stack','name','send','map','FaxQueueReport','rawAttributes','fieldName','type','query','keys','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','catch','options','find','create','body','params','describe','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','json','offset','undefined','count'];(function(_0x1f5458,_0x3d32a0){var _0x5d05b6=function(_0x1ffa32){while(--_0x1ffa32){_0x1f5458['push'](_0x1f5458['shift']());}};_0x5d05b6(++_0x3d32a0);}(_0xf996,0x74));var _0x6f99=function(_0xdad312,_0x46fdb7){_0xdad312=_0xdad312-0x0;var _0x196872=_0xf996[_0xdad312];return _0x196872;};'use strict';var emlformat=require(_0x6f99('0x0'));var rimraf=require(_0x6f99('0x1'));var zipdir=require(_0x6f99('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6f99('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x6f99('0x4'));var util=require(_0x6f99('0x5'));var path=require(_0x6f99('0x6'));var sox=require(_0x6f99('0x7'));var csv=require(_0x6f99('0x8'));var ejs=require(_0x6f99('0x9'));var fs=require('fs');var fs_extra=require(_0x6f99('0xa'));var _=require(_0x6f99('0xb'));var squel=require(_0x6f99('0xc'));var crypto=require(_0x6f99('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x6f99('0xe'));var toCsv=require('to-csv');var querystring=require(_0x6f99('0xf'));var Papa=require(_0x6f99('0x10'));var Redis=require(_0x6f99('0x11'));var authService=require(_0x6f99('0x12'));var qs=require(_0x6f99('0x13'));var as=require(_0x6f99('0x14'));var hardwareService=require(_0x6f99('0x15'));var logger=require(_0x6f99('0x16'))(_0x6f99('0x17'));var utils=require('../../config/utils');var config=require(_0x6f99('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x55e7f0,_0x12081d){_0x12081d=_0x12081d||0xcc;return function(_0xa1af95){if(_0xa1af95){return _0x55e7f0[_0x6f99('0x19')](_0x12081d);}return _0x55e7f0[_0x6f99('0x1a')](_0x12081d)[_0x6f99('0x1b')]();};}function respondWithResult(_0x7aea00,_0xf5d4df){_0xf5d4df=_0xf5d4df||0xc8;return function(_0xb9874a){if(_0xb9874a){return _0x7aea00[_0x6f99('0x1a')](_0xf5d4df)[_0x6f99('0x1c')](_0xb9874a);}};}function respondWithFilteredResult(_0x1534e9,_0x1c7733){return function(_0x537f3d){if(_0x537f3d){var _0x293937=typeof _0x1c7733[_0x6f99('0x1d')]==='undefined'&&typeof _0x1c7733['limit']===_0x6f99('0x1e');var _0x5b3638=_0x537f3d[_0x6f99('0x1f')];var _0x210360=_0x293937?0x0:_0x1c7733[_0x6f99('0x1d')];var _0x25d50b=_0x293937?_0x537f3d[_0x6f99('0x1f')]:_0x1c7733['offset']+_0x1c7733[_0x6f99('0x20')];var _0x5377cb;if(_0x25d50b>=_0x5b3638){_0x25d50b=_0x5b3638;_0x5377cb=0xc8;}else{_0x5377cb=0xce;}_0x1534e9[_0x6f99('0x1a')](_0x5377cb);return _0x1534e9[_0x6f99('0x21')](_0x6f99('0x22'),_0x210360+'-'+_0x25d50b+'/'+_0x5b3638)[_0x6f99('0x1c')](_0x537f3d);}return null;};}function patchUpdates(_0x1dc9e5){return function(_0xf66bde){try{jsonpatch['apply'](_0xf66bde,_0x1dc9e5,!![]);}catch(_0x4c4d00){return BPromise[_0x6f99('0x23')](_0x4c4d00);}return _0xf66bde[_0x6f99('0x24')]();};}function saveUpdates(_0x4974ff,_0x497fd7){return function(_0x1d4dc3){if(_0x1d4dc3){return _0x1d4dc3[_0x6f99('0x25')](_0x4974ff)[_0x6f99('0x26')](function(_0xe3e6ab){return _0xe3e6ab;});}return null;};}function removeEntity(_0x290c88,_0x1174a2){return function(_0x2e7b94){if(_0x2e7b94){return _0x2e7b94[_0x6f99('0x27')]()[_0x6f99('0x26')](function(){_0x290c88[_0x6f99('0x1a')](0xcc)[_0x6f99('0x1b')]();});}};}function handleEntityNotFound(_0x1f8078,_0x21a5c8){return function(_0x381e92){if(!_0x381e92){_0x1f8078['sendStatus'](0x194);}return _0x381e92;};}function handleError(_0x1aff24,_0x201070){_0x201070=_0x201070||0x1f4;return function(_0x4c9572){logger['error'](_0x4c9572[_0x6f99('0x28')]);if(_0x4c9572[_0x6f99('0x29')]){delete _0x4c9572['name'];}_0x1aff24[_0x6f99('0x1a')](_0x201070)[_0x6f99('0x2a')](_0x4c9572);};}exports['index']=function(_0x45fe22,_0x3c1012){var _0x513519={},_0x21eb46={},_0x3ef6c5={'count':0x0,'rows':[]};var _0x5e10e2=_[_0x6f99('0x2b')](db[_0x6f99('0x2c')][_0x6f99('0x2d')],function(_0x4aa40c){return{'name':_0x4aa40c[_0x6f99('0x2e')],'type':_0x4aa40c[_0x6f99('0x2f')]['key']};});_0x21eb46['model']=_[_0x6f99('0x2b')](_0x5e10e2,_0x6f99('0x29'));_0x21eb46[_0x6f99('0x30')]=_[_0x6f99('0x31')](_0x45fe22[_0x6f99('0x30')]);_0x21eb46[_0x6f99('0x32')]=_['intersection'](_0x21eb46['model'],_0x21eb46[_0x6f99('0x30')]);_0x513519[_0x6f99('0x33')]=_[_0x6f99('0x34')](_0x21eb46[_0x6f99('0x35')],qs[_0x6f99('0x36')](_0x45fe22[_0x6f99('0x30')][_0x6f99('0x36')]));_0x513519[_0x6f99('0x33')]=_0x513519[_0x6f99('0x33')][_0x6f99('0x37')]?_0x513519[_0x6f99('0x33')]:_0x21eb46['model'];if(!_0x45fe22[_0x6f99('0x30')][_0x6f99('0x38')](_0x6f99('0x39'))){_0x513519[_0x6f99('0x20')]=qs[_0x6f99('0x20')](_0x45fe22['query'][_0x6f99('0x20')]);_0x513519[_0x6f99('0x1d')]=qs['offset'](_0x45fe22[_0x6f99('0x30')][_0x6f99('0x1d')]);}_0x513519[_0x6f99('0x3a')]=qs[_0x6f99('0x3b')](_0x45fe22[_0x6f99('0x30')][_0x6f99('0x3b')]);_0x513519[_0x6f99('0x3c')]=qs[_0x6f99('0x32')](_['pick'](_0x45fe22[_0x6f99('0x30')],_0x21eb46['filters']),_0x5e10e2);if(_0x45fe22[_0x6f99('0x30')][_0x6f99('0x3d')]){_0x513519[_0x6f99('0x3c')]=_[_0x6f99('0x3e')](_0x513519['where'],{'$or':_[_0x6f99('0x2b')](_0x5e10e2,function(_0x4ee7ce){if(_0x4ee7ce[_0x6f99('0x2f')]!==_0x6f99('0x3f')){var _0x2c26a1={};_0x2c26a1[_0x4ee7ce[_0x6f99('0x29')]]={'$like':'%'+_0x45fe22[_0x6f99('0x30')][_0x6f99('0x3d')]+'%'};return _0x2c26a1;}})});}_0x513519=_[_0x6f99('0x3e')]({},_0x513519,_0x45fe22['options']);var _0x35fb0a={'where':_0x513519[_0x6f99('0x3c')]};return db[_0x6f99('0x2c')]['count'](_0x35fb0a)[_0x6f99('0x26')](function(_0x327e98){_0x3ef6c5[_0x6f99('0x1f')]=_0x327e98;if(_0x45fe22[_0x6f99('0x30')][_0x6f99('0x40')]){_0x513519[_0x6f99('0x41')]=[{'all':!![]}];}return db[_0x6f99('0x2c')][_0x6f99('0x42')](_0x513519);})['then'](function(_0x206bc8){_0x3ef6c5['rows']=_0x206bc8;return _0x3ef6c5;})[_0x6f99('0x26')](respondWithFilteredResult(_0x3c1012,_0x513519))[_0x6f99('0x43')](handleError(_0x3c1012,null));};exports['show']=function(_0x26e091,_0x27ae7f){var _0x1934c4={'raw':!![],'where':{'id':_0x26e091['params']['id']}},_0x1fd388={};_0x1fd388[_0x6f99('0x35')]=_[_0x6f99('0x31')](db[_0x6f99('0x2c')]['rawAttributes']);_0x1fd388[_0x6f99('0x30')]=_[_0x6f99('0x31')](_0x26e091[_0x6f99('0x30')]);_0x1fd388[_0x6f99('0x32')]=_[_0x6f99('0x34')](_0x1fd388[_0x6f99('0x35')],_0x1fd388[_0x6f99('0x30')]);_0x1934c4[_0x6f99('0x33')]=_['intersection'](_0x1fd388[_0x6f99('0x35')],qs['fields'](_0x26e091[_0x6f99('0x30')]['fields']));_0x1934c4[_0x6f99('0x33')]=_0x1934c4[_0x6f99('0x33')][_0x6f99('0x37')]?_0x1934c4[_0x6f99('0x33')]:_0x1fd388[_0x6f99('0x35')];if(_0x26e091[_0x6f99('0x30')][_0x6f99('0x40')]){_0x1934c4['include']=[{'all':!![]}];}_0x1934c4=_[_0x6f99('0x3e')]({},_0x1934c4,_0x26e091[_0x6f99('0x44')]);return db['FaxQueueReport'][_0x6f99('0x45')](_0x1934c4)[_0x6f99('0x26')](handleEntityNotFound(_0x27ae7f,null))[_0x6f99('0x26')](respondWithResult(_0x27ae7f,null))[_0x6f99('0x43')](handleError(_0x27ae7f,null));};exports[_0x6f99('0x46')]=function(_0x51fd93,_0x118e87){return db[_0x6f99('0x2c')][_0x6f99('0x46')](_0x51fd93[_0x6f99('0x47')],{})[_0x6f99('0x26')](respondWithResult(_0x118e87,0xc9))[_0x6f99('0x43')](handleError(_0x118e87,null));};exports[_0x6f99('0x25')]=function(_0x20c80d,_0x2c6cd8){if(_0x20c80d[_0x6f99('0x47')]['id']){delete _0x20c80d[_0x6f99('0x47')]['id'];}return db[_0x6f99('0x2c')]['find']({'where':{'id':_0x20c80d[_0x6f99('0x48')]['id']}})[_0x6f99('0x26')](handleEntityNotFound(_0x2c6cd8,null))[_0x6f99('0x26')](saveUpdates(_0x20c80d[_0x6f99('0x47')],null))[_0x6f99('0x26')](respondWithResult(_0x2c6cd8,null))[_0x6f99('0x43')](handleError(_0x2c6cd8,null));};exports['destroy']=function(_0x321944,_0x2ee25e){return db['FaxQueueReport'][_0x6f99('0x45')]({'where':{'id':_0x321944[_0x6f99('0x48')]['id']}})[_0x6f99('0x26')](handleEntityNotFound(_0x2ee25e,null))[_0x6f99('0x26')](removeEntity(_0x2ee25e,null))[_0x6f99('0x43')](handleError(_0x2ee25e,null));};exports['describe']=function(_0x572aea,_0x3d82c4){return db['FaxQueueReport'][_0x6f99('0x49')]()[_0x6f99('0x26')](respondWithResult(_0x3d82c4,null))[_0x6f99('0x43')](handleError(_0x3d82c4,null));}; \ No newline at end of file +var _0x96a2=['fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','count','limit','Content-Range','apply','update','then','destroy','error','stack','name','map','FaxQueueReport','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','keys','filters','find','catch','create','body','describe','eml-format','zip-dir'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0x96a2,0x96));var _0x296a=function(_0x63d3c7,_0x4bae01){_0x63d3c7=_0x63d3c7-0x0;var _0x23a9f7=_0x96a2[_0x63d3c7];return _0x23a9f7;};'use strict';var emlformat=require(_0x296a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x296a('0x1'));var jsonpatch=require(_0x296a('0x2'));var rp=require(_0x296a('0x3'));var moment=require(_0x296a('0x4'));var BPromise=require(_0x296a('0x5'));var Mustache=require(_0x296a('0x6'));var util=require(_0x296a('0x7'));var path=require(_0x296a('0x8'));var sox=require(_0x296a('0x9'));var csv=require(_0x296a('0xa'));var ejs=require(_0x296a('0xb'));var fs=require('fs');var fs_extra=require(_0x296a('0xc'));var _=require(_0x296a('0xd'));var squel=require(_0x296a('0xe'));var crypto=require(_0x296a('0xf'));var jsforce=require(_0x296a('0x10'));var deskjs=require(_0x296a('0x11'));var toCsv=require(_0x296a('0xa'));var querystring=require('querystring');var Papa=require(_0x296a('0x12'));var Redis=require(_0x296a('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x296a('0x14'));var as=require(_0x296a('0x15'));var hardwareService=require(_0x296a('0x16'));var logger=require(_0x296a('0x17'))(_0x296a('0x18'));var utils=require(_0x296a('0x19'));var config=require(_0x296a('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x296a('0x1b'))['db'];function respondWithStatusCode(_0x9fd86a,_0x507a4c){_0x507a4c=_0x507a4c||0xcc;return function(_0x4574bd){if(_0x4574bd){return _0x9fd86a[_0x296a('0x1c')](_0x507a4c);}return _0x9fd86a['status'](_0x507a4c)[_0x296a('0x1d')]();};}function respondWithResult(_0xba0fe9,_0x495be8){_0x495be8=_0x495be8||0xc8;return function(_0xc1f766){if(_0xc1f766){return _0xba0fe9[_0x296a('0x1e')](_0x495be8)[_0x296a('0x1f')](_0xc1f766);}};}function respondWithFilteredResult(_0x1d7815,_0x99b163){return function(_0x164e80){if(_0x164e80){var _0x5c1f54=typeof _0x99b163[_0x296a('0x20')]==='undefined'&&typeof _0x99b163['limit']==='undefined';var _0x463b66=_0x164e80[_0x296a('0x21')];var _0x2b82d6=_0x5c1f54?0x0:_0x99b163['offset'];var _0x51ba98=_0x5c1f54?_0x164e80[_0x296a('0x21')]:_0x99b163['offset']+_0x99b163[_0x296a('0x22')];var _0x2c1ea4;if(_0x51ba98>=_0x463b66){_0x51ba98=_0x463b66;_0x2c1ea4=0xc8;}else{_0x2c1ea4=0xce;}_0x1d7815[_0x296a('0x1e')](_0x2c1ea4);return _0x1d7815['set'](_0x296a('0x23'),_0x2b82d6+'-'+_0x51ba98+'/'+_0x463b66)[_0x296a('0x1f')](_0x164e80);}return null;};}function patchUpdates(_0x334844){return function(_0x5aad3e){try{jsonpatch[_0x296a('0x24')](_0x5aad3e,_0x334844,!![]);}catch(_0x71fbc6){return BPromise['reject'](_0x71fbc6);}return _0x5aad3e['save']();};}function saveUpdates(_0x2a2971,_0x3750c7){return function(_0x3be956){if(_0x3be956){return _0x3be956[_0x296a('0x25')](_0x2a2971)[_0x296a('0x26')](function(_0x16f287){return _0x16f287;});}return null;};}function removeEntity(_0x2cff01,_0x2cf007){return function(_0x37f6d4){if(_0x37f6d4){return _0x37f6d4[_0x296a('0x27')]()[_0x296a('0x26')](function(){_0x2cff01[_0x296a('0x1e')](0xcc)[_0x296a('0x1d')]();});}};}function handleEntityNotFound(_0xf6b922,_0x2177df){return function(_0x529eb8){if(!_0x529eb8){_0xf6b922[_0x296a('0x1c')](0x194);}return _0x529eb8;};}function handleError(_0x43911b,_0x526ac5){_0x526ac5=_0x526ac5||0x1f4;return function(_0x2c4bed){logger[_0x296a('0x28')](_0x2c4bed[_0x296a('0x29')]);if(_0x2c4bed['name']){delete _0x2c4bed[_0x296a('0x2a')];}_0x43911b[_0x296a('0x1e')](_0x526ac5)['send'](_0x2c4bed);};}exports['index']=function(_0x15e9ac,_0x2c0644){var _0x2d7209={},_0x583548={},_0x571c26={'count':0x0,'rows':[]};var _0x18d372=_[_0x296a('0x2b')](db[_0x296a('0x2c')][_0x296a('0x2d')],function(_0x11278b){return{'name':_0x11278b[_0x296a('0x2e')],'type':_0x11278b[_0x296a('0x2f')][_0x296a('0x30')]};});_0x583548[_0x296a('0x31')]=_[_0x296a('0x2b')](_0x18d372,'name');_0x583548[_0x296a('0x32')]=_['keys'](_0x15e9ac[_0x296a('0x32')]);_0x583548['filters']=_[_0x296a('0x33')](_0x583548[_0x296a('0x31')],_0x583548[_0x296a('0x32')]);_0x2d7209[_0x296a('0x34')]=_[_0x296a('0x33')](_0x583548['model'],qs[_0x296a('0x35')](_0x15e9ac[_0x296a('0x32')][_0x296a('0x35')]));_0x2d7209[_0x296a('0x34')]=_0x2d7209['attributes'][_0x296a('0x36')]?_0x2d7209['attributes']:_0x583548['model'];if(!_0x15e9ac['query'][_0x296a('0x37')](_0x296a('0x38'))){_0x2d7209[_0x296a('0x22')]=qs[_0x296a('0x22')](_0x15e9ac['query'][_0x296a('0x22')]);_0x2d7209[_0x296a('0x20')]=qs[_0x296a('0x20')](_0x15e9ac[_0x296a('0x32')]['offset']);}_0x2d7209['order']=qs['sort'](_0x15e9ac[_0x296a('0x32')][_0x296a('0x39')]);_0x2d7209[_0x296a('0x3a')]=qs['filters'](_[_0x296a('0x3b')](_0x15e9ac['query'],_0x583548['filters']),_0x18d372);if(_0x15e9ac[_0x296a('0x32')][_0x296a('0x3c')]){_0x2d7209[_0x296a('0x3a')]=_[_0x296a('0x3d')](_0x2d7209['where'],{'$or':_[_0x296a('0x2b')](_0x18d372,function(_0x3641f7){if(_0x3641f7['type']!==_0x296a('0x3e')){var _0x4b296c={};_0x4b296c[_0x3641f7['name']]={'$like':'%'+_0x15e9ac['query'][_0x296a('0x3c')]+'%'};return _0x4b296c;}})});}_0x2d7209=_[_0x296a('0x3d')]({},_0x2d7209,_0x15e9ac['options']);var _0x1bfcf={'where':_0x2d7209[_0x296a('0x3a')]};return db[_0x296a('0x2c')][_0x296a('0x21')](_0x1bfcf)[_0x296a('0x26')](function(_0x7e7b0f){_0x571c26[_0x296a('0x21')]=_0x7e7b0f;if(_0x15e9ac[_0x296a('0x32')][_0x296a('0x3f')]){_0x2d7209[_0x296a('0x40')]=[{'all':!![]}];}return db['FaxQueueReport'][_0x296a('0x41')](_0x2d7209);})[_0x296a('0x26')](function(_0x547bda){_0x571c26[_0x296a('0x42')]=_0x547bda;return _0x571c26;})['then'](respondWithFilteredResult(_0x2c0644,_0x2d7209))['catch'](handleError(_0x2c0644,null));};exports[_0x296a('0x43')]=function(_0xb4d70b,_0x7e2f25){var _0x2255bc={'raw':!![],'where':{'id':_0xb4d70b[_0x296a('0x44')]['id']}},_0x1c58d3={};_0x1c58d3[_0x296a('0x31')]=_[_0x296a('0x45')](db[_0x296a('0x2c')][_0x296a('0x2d')]);_0x1c58d3[_0x296a('0x32')]=_[_0x296a('0x45')](_0xb4d70b[_0x296a('0x32')]);_0x1c58d3[_0x296a('0x46')]=_[_0x296a('0x33')](_0x1c58d3[_0x296a('0x31')],_0x1c58d3['query']);_0x2255bc['attributes']=_[_0x296a('0x33')](_0x1c58d3['model'],qs[_0x296a('0x35')](_0xb4d70b['query'][_0x296a('0x35')]));_0x2255bc[_0x296a('0x34')]=_0x2255bc['attributes'][_0x296a('0x36')]?_0x2255bc['attributes']:_0x1c58d3[_0x296a('0x31')];if(_0xb4d70b[_0x296a('0x32')]['includeAll']){_0x2255bc[_0x296a('0x40')]=[{'all':!![]}];}_0x2255bc=_[_0x296a('0x3d')]({},_0x2255bc,_0xb4d70b['options']);return db[_0x296a('0x2c')][_0x296a('0x47')](_0x2255bc)[_0x296a('0x26')](handleEntityNotFound(_0x7e2f25,null))[_0x296a('0x26')](respondWithResult(_0x7e2f25,null))[_0x296a('0x48')](handleError(_0x7e2f25,null));};exports[_0x296a('0x49')]=function(_0x22473f,_0x3fcb86){return db[_0x296a('0x2c')][_0x296a('0x49')](_0x22473f[_0x296a('0x4a')],{})[_0x296a('0x26')](respondWithResult(_0x3fcb86,0xc9))[_0x296a('0x48')](handleError(_0x3fcb86,null));};exports[_0x296a('0x25')]=function(_0x23aefa,_0x3d1115){if(_0x23aefa['body']['id']){delete _0x23aefa[_0x296a('0x4a')]['id'];}return db[_0x296a('0x2c')][_0x296a('0x47')]({'where':{'id':_0x23aefa[_0x296a('0x44')]['id']}})[_0x296a('0x26')](handleEntityNotFound(_0x3d1115,null))[_0x296a('0x26')](saveUpdates(_0x23aefa[_0x296a('0x4a')],null))[_0x296a('0x26')](respondWithResult(_0x3d1115,null))['catch'](handleError(_0x3d1115,null));};exports[_0x296a('0x27')]=function(_0xcb620a,_0x162b91){return db[_0x296a('0x2c')][_0x296a('0x47')]({'where':{'id':_0xcb620a['params']['id']}})['then'](handleEntityNotFound(_0x162b91,null))[_0x296a('0x26')](removeEntity(_0x162b91,null))[_0x296a('0x48')](handleError(_0x162b91,null));};exports[_0x296a('0x4b')]=function(_0xe19e05,_0x3a79ae){return db[_0x296a('0x2c')][_0x296a('0x4b')]()[_0x296a('0x26')](respondWithResult(_0x3a79ae,null))[_0x296a('0x48')](handleError(_0x3a79ae,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 663c2dc..350ff1a 100644 --- a/server/api/faxQueueReport/faxQueueReport.model.js +++ b/server/api/faxQueueReport/faxQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['bluebird','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','report_fax_queue','lodash','util','../../config/logger','api','moment'];(function(_0x26bfd5,_0x7801fb){var _0xc8e3=function(_0x5c5998){while(--_0x5c5998){_0x26bfd5['push'](_0x26bfd5['shift']());}};_0xc8e3(++_0x7801fb);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0xc4aa[_0x1694f5];return _0x5b4321;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var logger=require(_0xac4a('0x2'))(_0xac4a('0x3'));var moment=require(_0xac4a('0x4'));var BPromise=require(_0xac4a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xac4a('0x6'));var attributes=require(_0xac4a('0x7'));module[_0xac4a('0x8')]=function(_0x215f39,_0x96be2b){return _0x215f39[_0xac4a('0x9')](_0xac4a('0xa'),attributes,{'tableName':_0xac4a('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x5fab=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','FaxQueueReport','report_fax_queue','uniqueid','lodash','util','api'];(function(_0x11c72b,_0x4fe3af){var _0xad9ef=function(_0xb9579b){while(--_0xb9579b){_0x11c72b['push'](_0x11c72b['shift']());}};_0xad9ef(++_0x4fe3af);}(_0x5fab,0x177));var _0xb5fa=function(_0x4a1e96,_0x143e6b){_0x4a1e96=_0x4a1e96-0x0;var _0x5acea9=_0x5fab[_0x4a1e96];return _0x5acea9;};'use strict';var _=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var logger=require('../../config/logger')(_0xb5fa('0x2'));var moment=require(_0xb5fa('0x3'));var BPromise=require(_0xb5fa('0x4'));var rp=require(_0xb5fa('0x5'));var fs=require('fs');var path=require(_0xb5fa('0x6'));var rimraf=require(_0xb5fa('0x7'));var config=require(_0xb5fa('0x8'));var attributes=require(_0xb5fa('0x9'));module[_0xb5fa('0xa')]=function(_0x44df89,_0x4a0249){return _0x44df89['define'](_0xb5fa('0xb'),attributes,{'tableName':_0xb5fa('0xc'),'paranoid':![],'indexes':[{'name':_0xb5fa('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index fdef048..63c15b8 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 _0xccf6=['update','body','options','raw','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateFaxQueueReport','create','UpdateFaxQueueReport','FaxQueueReport'];(function(_0x124b12,_0x50a849){var _0x4ba566=function(_0x4a778a){while(--_0x4a778a){_0x124b12['push'](_0x124b12['shift']());}};_0x4ba566(++_0x50a849);}(_0xccf6,0x19e));var _0x6ccf=function(_0x4c0622,_0x5dacaf){_0x4c0622=_0x4c0622-0x0;var _0x1799d8=_0xccf6[_0x4c0622];return _0x1799d8;};'use strict';var _=require(_0x6ccf('0x0'));var util=require(_0x6ccf('0x1'));var moment=require(_0x6ccf('0x2'));var BPromise=require(_0x6ccf('0x3'));var rs=require(_0x6ccf('0x4'));var fs=require('fs');var Redis=require(_0x6ccf('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x6ccf('0x6'));var logger=require(_0x6ccf('0x7'))(_0x6ccf('0x8'));var config=require(_0x6ccf('0x9'));var jayson=require(_0x6ccf('0xa'));var client=jayson[_0x6ccf('0xb')][_0x6ccf('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x29f0e3,_0x3a5188,_0x5680c5){return new BPromise(function(_0x54437b,_0x3831bb){return client[_0x6ccf('0xd')](_0x29f0e3,_0x5680c5)[_0x6ccf('0xe')](function(_0x4aaa29){logger[_0x6ccf('0xf')](_0x6ccf('0x10'),_0x3a5188,_0x6ccf('0x11'));logger[_0x6ccf('0x12')](_0x6ccf('0x13'),_0x3a5188,_0x6ccf('0x11'),JSON[_0x6ccf('0x14')](_0x4aaa29));if(_0x4aaa29[_0x6ccf('0x15')]){if(_0x4aaa29[_0x6ccf('0x15')][_0x6ccf('0x16')]===0x1f4){logger[_0x6ccf('0x15')](_0x6ccf('0x10'),_0x3a5188,_0x4aaa29[_0x6ccf('0x15')][_0x6ccf('0x17')]);return _0x3831bb(_0x4aaa29[_0x6ccf('0x15')]['message']);}logger[_0x6ccf('0x15')](_0x6ccf('0x10'),_0x3a5188,_0x4aaa29[_0x6ccf('0x15')][_0x6ccf('0x17')]);return _0x54437b(_0x4aaa29[_0x6ccf('0x15')][_0x6ccf('0x17')]);}else{logger['info'](_0x6ccf('0x10'),_0x3a5188,_0x6ccf('0x11'));_0x54437b(_0x4aaa29[_0x6ccf('0x18')][_0x6ccf('0x17')]);}})[_0x6ccf('0x19')](function(_0xe39454){logger['error']('FaxQueueReport,\x20%s,\x20%s',_0x3a5188,_0xe39454);_0x3831bb(_0xe39454);});});}exports[_0x6ccf('0x1a')]=function(_0x54bed0){var _0xfa7a05=this;return new Promise(function(_0x59cf08,_0xd1bf5f){return db['FaxQueueReport'][_0x6ccf('0x1b')](_0x54bed0['body'],{'raw':_0x54bed0['options']?_0x54bed0['options']['raw']===undefined?!![]:![]:!![]})[_0x6ccf('0xe')](function(_0x299ba0){logger[_0x6ccf('0xf')](_0x6ccf('0x1a'),_0x54bed0);logger[_0x6ccf('0x12')](_0x6ccf('0x1a'),_0x54bed0,JSON[_0x6ccf('0x14')](_0x299ba0));_0x59cf08(_0x299ba0);})['catch'](function(_0x24b9f3){logger[_0x6ccf('0x15')](_0x6ccf('0x1a'),_0x24b9f3['message'],_0x54bed0);_0xd1bf5f(_0xfa7a05[_0x6ccf('0x15')](0x1f4,_0x24b9f3['message']));});});};exports[_0x6ccf('0x1c')]=function(_0x1985b2){var _0x3a9553=this;return new Promise(function(_0x323d0b,_0x53b4b0){return db[_0x6ccf('0x1d')][_0x6ccf('0x1e')](_0x1985b2[_0x6ccf('0x1f')],{'raw':_0x1985b2[_0x6ccf('0x20')]?_0x1985b2['options'][_0x6ccf('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1985b2[_0x6ccf('0x20')]?_0x1985b2['options'][_0x6ccf('0x22')]||null:null,'attributes':_0x1985b2[_0x6ccf('0x20')]?_0x1985b2[_0x6ccf('0x20')][_0x6ccf('0x23')]||null:null,'limit':_0x1985b2[_0x6ccf('0x20')]?_0x1985b2[_0x6ccf('0x20')][_0x6ccf('0x24')]||null:null})['then'](function(_0x5553e8){logger[_0x6ccf('0xf')]('UpdateFaxQueueReport',_0x1985b2);logger['debug'](_0x6ccf('0x1c'),_0x1985b2,JSON['stringify'](_0x5553e8));_0x323d0b(_0x5553e8);})['catch'](function(_0x347298){logger[_0x6ccf('0x15')](_0x6ccf('0x1c'),_0x347298[_0x6ccf('0x17')],_0x1985b2);_0x53b4b0(_0x3a9553[_0x6ccf('0x15')](0x1f4,_0x347298[_0x6ccf('0x17')]));});});}; \ No newline at end of file +var _0x27b0=['UpdateFaxQueueReport','update','body','where','attributes','limit','util','ioredis','rpc','../../config/environment','jayson/promise','client','http','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','FaxQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateFaxQueueReport','FaxQueueReport','create','options','raw','then'];(function(_0x52a6b8,_0x5f3978){var _0x5d4ac3=function(_0x5c2ce6){while(--_0x5c2ce6){_0x52a6b8['push'](_0x52a6b8['shift']());}};_0x5d4ac3(++_0x5f3978);}(_0x27b0,0x18e));var _0x027b=function(_0x2653ac,_0x338212){_0x2653ac=_0x2653ac-0x0;var _0x14a4ba=_0x27b0[_0x2653ac];return _0x14a4ba;};'use strict';var _=require('lodash');var util=require(_0x027b('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x027b('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x027b('0x2'));var config=require(_0x027b('0x3'));var jayson=require(_0x027b('0x4'));var client=jayson[_0x027b('0x5')][_0x027b('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x5c4337,_0x356fee,_0x4ed082){return new BPromise(function(_0x540eb5,_0x3cc47d){return client['request'](_0x5c4337,_0x4ed082)['then'](function(_0x441f97){logger[_0x027b('0x7')](_0x027b('0x8'),_0x356fee,_0x027b('0x9'));logger['debug'](_0x027b('0xa'),_0x356fee,_0x027b('0x9'),JSON['stringify'](_0x441f97));if(_0x441f97[_0x027b('0xb')]){if(_0x441f97[_0x027b('0xb')][_0x027b('0xc')]===0x1f4){logger['error'](_0x027b('0x8'),_0x356fee,_0x441f97['error'][_0x027b('0xd')]);return _0x3cc47d(_0x441f97['error'][_0x027b('0xd')]);}logger['error'](_0x027b('0x8'),_0x356fee,_0x441f97[_0x027b('0xb')][_0x027b('0xd')]);return _0x540eb5(_0x441f97[_0x027b('0xb')][_0x027b('0xd')]);}else{logger[_0x027b('0x7')](_0x027b('0x8'),_0x356fee,_0x027b('0x9'));_0x540eb5(_0x441f97[_0x027b('0xe')][_0x027b('0xd')]);}})[_0x027b('0xf')](function(_0x5a9210){logger['error'](_0x027b('0x8'),_0x356fee,_0x5a9210);_0x3cc47d(_0x5a9210);});});}exports[_0x027b('0x10')]=function(_0x4ff893){var _0x4f6926=this;return new Promise(function(_0xd7636a,_0xcd2c27){return db[_0x027b('0x11')][_0x027b('0x12')](_0x4ff893['body'],{'raw':_0x4ff893['options']?_0x4ff893[_0x027b('0x13')][_0x027b('0x14')]===undefined?!![]:![]:!![]})[_0x027b('0x15')](function(_0x593a50){logger[_0x027b('0x7')](_0x027b('0x10'),_0x4ff893);logger['debug'](_0x027b('0x10'),_0x4ff893,JSON['stringify'](_0x593a50));_0xd7636a(_0x593a50);})[_0x027b('0xf')](function(_0x743399){logger[_0x027b('0xb')](_0x027b('0x10'),_0x743399[_0x027b('0xd')],_0x4ff893);_0xcd2c27(_0x4f6926[_0x027b('0xb')](0x1f4,_0x743399[_0x027b('0xd')]));});});};exports[_0x027b('0x16')]=function(_0x238753){var _0x4d79d0=this;return new Promise(function(_0x59fbb8,_0x2ba608){return db[_0x027b('0x11')][_0x027b('0x17')](_0x238753[_0x027b('0x18')],{'raw':_0x238753['options']?_0x238753['options'][_0x027b('0x14')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x238753['options']?_0x238753[_0x027b('0x13')][_0x027b('0x19')]||null:null,'attributes':_0x238753['options']?_0x238753[_0x027b('0x13')][_0x027b('0x1a')]||null:null,'limit':_0x238753[_0x027b('0x13')]?_0x238753['options'][_0x027b('0x1b')]||null:null})[_0x027b('0x15')](function(_0x374d47){logger[_0x027b('0x7')](_0x027b('0x16'),_0x238753);logger['debug'](_0x027b('0x16'),_0x238753,JSON['stringify'](_0x374d47));_0x59fbb8(_0x374d47);})['catch'](function(_0x5814b1){logger['error']('UpdateFaxQueueReport',_0x5814b1[_0x027b('0xd')],_0x238753);_0x2ba608(_0x4d79d0[_0x027b('0xb')](0x1f4,_0x5814b1[_0x027b('0xd')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 137c3c0..a9ec2f3 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 _0x7dcd=['util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','create','put','delete','destroy','multer'];(function(_0x40fdc6,_0x2b2b60){var _0x59c30c=function(_0x5404e0){while(--_0x5404e0){_0x40fdc6['push'](_0x40fdc6['shift']());}};_0x59c30c(++_0x2b2b60);}(_0x7dcd,0x143));var _0xd7dc=function(_0x300b26,_0x3a9b67){_0x300b26=_0x300b26-0x0;var _0x5cb1ae=_0x7dcd[_0x300b26];return _0x5cb1ae;};'use strict';var multer=require(_0xd7dc('0x0'));var util=require(_0xd7dc('0x1'));var path=require(_0xd7dc('0x2'));var timeout=require(_0xd7dc('0x3'));var express=require(_0xd7dc('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xd7dc('0x5'));var interaction=require(_0xd7dc('0x6'));var config=require(_0xd7dc('0x7'));var controller=require('./faxQueueReport.controller');router[_0xd7dc('0x8')]('/',auth[_0xd7dc('0x9')](),controller['index']);router[_0xd7dc('0x8')](_0xd7dc('0xa'),auth[_0xd7dc('0x9')](),controller[_0xd7dc('0xb')]);router['get'](_0xd7dc('0xc'),auth[_0xd7dc('0x9')](),controller[_0xd7dc('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xd7dc('0xe')]);router[_0xd7dc('0xf')](_0xd7dc('0xc'),auth[_0xd7dc('0x9')](),controller['update']);router[_0xd7dc('0x10')](_0xd7dc('0xc'),auth['isAuthenticated'](),controller[_0xd7dc('0x11')]);module['exports']=router; \ No newline at end of file +var _0x7fd1=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','index','/describe','isAuthenticated','/:id','show','post','put','delete','multer','util','path'];(function(_0x3fe393,_0x234a3a){var _0x534d14=function(_0x277fab){while(--_0x277fab){_0x3fe393['push'](_0x3fe393['shift']());}};_0x534d14(++_0x234a3a);}(_0x7fd1,0x18c));var _0x17fd=function(_0x425fda,_0x454d6d){_0x425fda=_0x425fda-0x0;var _0x4b50d4=_0x7fd1[_0x425fda];return _0x4b50d4;};'use strict';var multer=require(_0x17fd('0x0'));var util=require(_0x17fd('0x1'));var path=require(_0x17fd('0x2'));var timeout=require(_0x17fd('0x3'));var express=require(_0x17fd('0x4'));var router=express['Router']();var fs_extra=require(_0x17fd('0x5'));var auth=require(_0x17fd('0x6'));var interaction=require(_0x17fd('0x7'));var config=require(_0x17fd('0x8'));var controller=require(_0x17fd('0x9'));router[_0x17fd('0xa')]('/',auth['isAuthenticated'](),controller[_0x17fd('0xb')]);router['get'](_0x17fd('0xc'),auth[_0x17fd('0xd')](),controller['describe']);router[_0x17fd('0xa')](_0x17fd('0xe'),auth[_0x17fd('0xd')](),controller[_0x17fd('0xf')]);router[_0x17fd('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x17fd('0x11')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x17fd('0x12')](_0x17fd('0xe'),auth[_0x17fd('0xd')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index e0729b6..83c00b6 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 _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0x41e0b0,_0x3c454f){var _0x48f801=function(_0x560535){while(--_0x560535){_0x41e0b0['push'](_0x41e0b0['shift']());}};_0x48f801(++_0x3c454f);}(_0x70e0,0x17b));var _0x070e=function(_0x14b71f,_0x2a51ee){_0x14b71f=_0x14b71f-0x0;var _0x569e51=_0x70e0[_0x14b71f];return _0x569e51;};'use strict';var moment=require(_0x070e('0x0'));var Sequelize=require(_0x070e('0x1'));module[_0x070e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5')),'allowNull':![],'defaultValue':_0x070e('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x070e('0x6')]}}; \ No newline at end of file +var _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x5f3de3,_0x40f0f5){var _0x287e0d=function(_0x3189dc){while(--_0x3189dc){_0x5f3de3['push'](_0x5f3de3['shift']());}};_0x287e0d(++_0x40f0f5);}(_0xb43b,0x1b2));var _0xbb43=function(_0x5e499b,_0x587329){_0x5e499b=_0x5e499b-0x0;var _0x1b05bc=_0xb43b[_0x5e499b];return _0x1b05bc;};'use strict';var moment=require(_0xbb43('0x0'));var Sequelize=require(_0xbb43('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xbb43('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbb43('0x3')](_0xbb43('0x4'),'agent',_0xbb43('0x5')),'allowNull':![],'defaultValue':_0xbb43('0x5')},'transferredAt':{'type':Sequelize[_0xbb43('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xbb43('0x7')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 5128164..a8d0008 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 _0x23d2=['VIRTUAL','filter','then','include','findAll','catch','show','params','includeAll','find','create','body','update','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','limit','count','set','reject','save','destroy','sendStatus','stack','name','send','index','map','FaxTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0x23d2,0x13a));var _0x223d=function(_0x15939a,_0x51d592){_0x15939a=_0x15939a-0x0;var _0x22f7ba=_0x23d2[_0x15939a];return _0x22f7ba;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x223d('0x0'));var zipdir=require(_0x223d('0x1'));var jsonpatch=require(_0x223d('0x2'));var rp=require(_0x223d('0x3'));var moment=require(_0x223d('0x4'));var BPromise=require(_0x223d('0x5'));var Mustache=require(_0x223d('0x6'));var util=require(_0x223d('0x7'));var path=require(_0x223d('0x8'));var sox=require('sox');var csv=require(_0x223d('0x9'));var ejs=require(_0x223d('0xa'));var fs=require('fs');var fs_extra=require(_0x223d('0xb'));var _=require('lodash');var squel=require(_0x223d('0xc'));var crypto=require(_0x223d('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x223d('0xe'));var toCsv=require(_0x223d('0x9'));var querystring=require('querystring');var Papa=require(_0x223d('0xf'));var Redis=require('ioredis');var authService=require(_0x223d('0x10'));var qs=require(_0x223d('0x11'));var as=require(_0x223d('0x12'));var hardwareService=require(_0x223d('0x13'));var logger=require(_0x223d('0x14'))(_0x223d('0x15'));var utils=require(_0x223d('0x16'));var config=require(_0x223d('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x223d('0x18'))['db'];function respondWithStatusCode(_0x523aa2,_0x27c484){_0x27c484=_0x27c484||0xcc;return function(_0x1af9eb){if(_0x1af9eb){return _0x523aa2['sendStatus'](_0x27c484);}return _0x523aa2[_0x223d('0x19')](_0x27c484)[_0x223d('0x1a')]();};}function respondWithResult(_0xf9ccef,_0x2d0a97){_0x2d0a97=_0x2d0a97||0xc8;return function(_0x1e0dbb){if(_0x1e0dbb){return _0xf9ccef[_0x223d('0x19')](_0x2d0a97)[_0x223d('0x1b')](_0x1e0dbb);}};}function respondWithFilteredResult(_0x104f0a,_0x43c58d){return function(_0x33b212){if(_0x33b212){var _0x5c8eaa=typeof _0x43c58d[_0x223d('0x1c')]==='undefined'&&typeof _0x43c58d[_0x223d('0x1d')]==='undefined';var _0xeb1a28=_0x33b212['count'];var _0xe6a3f8=_0x5c8eaa?0x0:_0x43c58d[_0x223d('0x1c')];var _0xe65ef3=_0x5c8eaa?_0x33b212[_0x223d('0x1e')]:_0x43c58d['offset']+_0x43c58d[_0x223d('0x1d')];var _0x44caf3;if(_0xe65ef3>=_0xeb1a28){_0xe65ef3=_0xeb1a28;_0x44caf3=0xc8;}else{_0x44caf3=0xce;}_0x104f0a['status'](_0x44caf3);return _0x104f0a[_0x223d('0x1f')]('Content-Range',_0xe6a3f8+'-'+_0xe65ef3+'/'+_0xeb1a28)[_0x223d('0x1b')](_0x33b212);}return null;};}function patchUpdates(_0x466bc3){return function(_0x2a05a3){try{jsonpatch['apply'](_0x2a05a3,_0x466bc3,!![]);}catch(_0x2ff22f){return BPromise[_0x223d('0x20')](_0x2ff22f);}return _0x2a05a3[_0x223d('0x21')]();};}function saveUpdates(_0x59e071,_0x466620){return function(_0x431f07){if(_0x431f07){return _0x431f07['update'](_0x59e071)['then'](function(_0x4b7058){return _0x4b7058;});}return null;};}function removeEntity(_0x453a1b,_0x2bcbd1){return function(_0x4c5376){if(_0x4c5376){return _0x4c5376[_0x223d('0x22')]()['then'](function(){_0x453a1b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x55d374,_0x45f66f){return function(_0x2558f3){if(!_0x2558f3){_0x55d374[_0x223d('0x23')](0x194);}return _0x2558f3;};}function handleError(_0x8c9c86,_0x1e1cf2){_0x1e1cf2=_0x1e1cf2||0x1f4;return function(_0x22dc31){logger['error'](_0x22dc31[_0x223d('0x24')]);if(_0x22dc31[_0x223d('0x25')]){delete _0x22dc31[_0x223d('0x25')];}_0x8c9c86[_0x223d('0x19')](_0x1e1cf2)[_0x223d('0x26')](_0x22dc31);};}exports[_0x223d('0x27')]=function(_0x14a964,_0x46852c){var _0x53e983={},_0x35d099={},_0x2d3ea5={'count':0x0,'rows':[]};var _0xaee4b6=_[_0x223d('0x28')](db[_0x223d('0x29')][_0x223d('0x2a')],function(_0x5cab3f){return{'name':_0x5cab3f[_0x223d('0x2b')],'type':_0x5cab3f[_0x223d('0x2c')][_0x223d('0x2d')]};});_0x35d099[_0x223d('0x2e')]=_['map'](_0xaee4b6,_0x223d('0x25'));_0x35d099[_0x223d('0x2f')]=_[_0x223d('0x30')](_0x14a964[_0x223d('0x2f')]);_0x35d099[_0x223d('0x31')]=_[_0x223d('0x32')](_0x35d099[_0x223d('0x2e')],_0x35d099[_0x223d('0x2f')]);_0x53e983[_0x223d('0x33')]=_[_0x223d('0x32')](_0x35d099['model'],qs[_0x223d('0x34')](_0x14a964[_0x223d('0x2f')]['fields']));_0x53e983[_0x223d('0x33')]=_0x53e983[_0x223d('0x33')][_0x223d('0x35')]?_0x53e983['attributes']:_0x35d099['model'];if(!_0x14a964[_0x223d('0x2f')][_0x223d('0x36')](_0x223d('0x37'))){_0x53e983['limit']=qs[_0x223d('0x1d')](_0x14a964['query'][_0x223d('0x1d')]);_0x53e983['offset']=qs[_0x223d('0x1c')](_0x14a964[_0x223d('0x2f')][_0x223d('0x1c')]);}_0x53e983[_0x223d('0x38')]=qs['sort'](_0x14a964[_0x223d('0x2f')][_0x223d('0x39')]);_0x53e983[_0x223d('0x3a')]=qs[_0x223d('0x31')](_[_0x223d('0x3b')](_0x14a964[_0x223d('0x2f')],_0x35d099['filters']),_0xaee4b6);if(_0x14a964['query']['filter']){_0x53e983[_0x223d('0x3a')]=_[_0x223d('0x3c')](_0x53e983['where'],{'$or':_['map'](_0xaee4b6,function(_0x4ece24){if(_0x4ece24['type']!==_0x223d('0x3d')){var _0x198258={};_0x198258[_0x4ece24[_0x223d('0x25')]]={'$like':'%'+_0x14a964[_0x223d('0x2f')][_0x223d('0x3e')]+'%'};return _0x198258;}})});}_0x53e983=_[_0x223d('0x3c')]({},_0x53e983,_0x14a964['options']);var _0x3cfe9d={'where':_0x53e983[_0x223d('0x3a')]};return db['FaxTransferReport'][_0x223d('0x1e')](_0x3cfe9d)[_0x223d('0x3f')](function(_0x33394d){_0x2d3ea5[_0x223d('0x1e')]=_0x33394d;if(_0x14a964['query']['includeAll']){_0x53e983[_0x223d('0x40')]=[{'all':!![]}];}return db[_0x223d('0x29')][_0x223d('0x41')](_0x53e983);})[_0x223d('0x3f')](function(_0x24f638){_0x2d3ea5['rows']=_0x24f638;return _0x2d3ea5;})[_0x223d('0x3f')](respondWithFilteredResult(_0x46852c,_0x53e983))[_0x223d('0x42')](handleError(_0x46852c,null));};exports[_0x223d('0x43')]=function(_0x48fb39,_0x58b5d7){var _0x2eb8be={'raw':!![],'where':{'id':_0x48fb39[_0x223d('0x44')]['id']}},_0x396ab4={};_0x396ab4[_0x223d('0x2e')]=_[_0x223d('0x30')](db[_0x223d('0x29')][_0x223d('0x2a')]);_0x396ab4[_0x223d('0x2f')]=_[_0x223d('0x30')](_0x48fb39[_0x223d('0x2f')]);_0x396ab4['filters']=_[_0x223d('0x32')](_0x396ab4[_0x223d('0x2e')],_0x396ab4['query']);_0x2eb8be[_0x223d('0x33')]=_[_0x223d('0x32')](_0x396ab4['model'],qs[_0x223d('0x34')](_0x48fb39[_0x223d('0x2f')][_0x223d('0x34')]));_0x2eb8be[_0x223d('0x33')]=_0x2eb8be[_0x223d('0x33')][_0x223d('0x35')]?_0x2eb8be[_0x223d('0x33')]:_0x396ab4[_0x223d('0x2e')];if(_0x48fb39[_0x223d('0x2f')][_0x223d('0x45')]){_0x2eb8be[_0x223d('0x40')]=[{'all':!![]}];}_0x2eb8be=_[_0x223d('0x3c')]({},_0x2eb8be,_0x48fb39['options']);return db['FaxTransferReport'][_0x223d('0x46')](_0x2eb8be)[_0x223d('0x3f')](handleEntityNotFound(_0x58b5d7,null))[_0x223d('0x3f')](respondWithResult(_0x58b5d7,null))[_0x223d('0x42')](handleError(_0x58b5d7,null));};exports['create']=function(_0x58b702,_0x48641f){return db['FaxTransferReport'][_0x223d('0x47')](_0x58b702[_0x223d('0x48')],{})['then'](respondWithResult(_0x48641f,0xc9))[_0x223d('0x42')](handleError(_0x48641f,null));};exports[_0x223d('0x49')]=function(_0x5141ae,_0x2215ea){if(_0x5141ae['body']['id']){delete _0x5141ae['body']['id'];}return db[_0x223d('0x29')][_0x223d('0x46')]({'where':{'id':_0x5141ae[_0x223d('0x44')]['id']}})[_0x223d('0x3f')](handleEntityNotFound(_0x2215ea,null))[_0x223d('0x3f')](saveUpdates(_0x5141ae[_0x223d('0x48')],null))['then'](respondWithResult(_0x2215ea,null))[_0x223d('0x42')](handleError(_0x2215ea,null));};exports[_0x223d('0x22')]=function(_0x55b4e3,_0x5512ac){return db[_0x223d('0x29')]['find']({'where':{'id':_0x55b4e3[_0x223d('0x44')]['id']}})[_0x223d('0x3f')](handleEntityNotFound(_0x5512ac,null))[_0x223d('0x3f')](removeEntity(_0x5512ac,null))[_0x223d('0x42')](handleError(_0x5512ac,null));};exports[_0x223d('0x4a')]=function(_0x507c63,_0xdd9698){return db['FaxTransferReport']['describe']()['then'](respondWithResult(_0xdd9698,null))[_0x223d('0x42')](handleError(_0xdd9698,null));}; \ No newline at end of file +var _0xd6f7=['params','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','apply','reject','save','then','destroy','end','error','name','index','map','FaxTransferReport','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','findAll','rows','catch','show','rawAttributes','includeAll','find','create','body'];(function(_0x16667f,_0x53d251){var _0x411a5c=function(_0x328d19){while(--_0x328d19){_0x16667f['push'](_0x16667f['shift']());}};_0x411a5c(++_0x53d251);}(_0xd6f7,0x174));var _0x7d6f=function(_0x272d90,_0x5e70ff){_0x272d90=_0x272d90-0x0;var _0x2bf4a2=_0xd6f7[_0x272d90];return _0x2bf4a2;};'use strict';var emlformat=require(_0x7d6f('0x0'));var rimraf=require(_0x7d6f('0x1'));var zipdir=require(_0x7d6f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7d6f('0x3'));var moment=require(_0x7d6f('0x4'));var BPromise=require(_0x7d6f('0x5'));var Mustache=require('mustache');var util=require(_0x7d6f('0x6'));var path=require(_0x7d6f('0x7'));var sox=require('sox');var csv=require(_0x7d6f('0x8'));var ejs=require(_0x7d6f('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7d6f('0xa'));var squel=require(_0x7d6f('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x7d6f('0xc'));var toCsv=require(_0x7d6f('0x8'));var querystring=require(_0x7d6f('0xd'));var Papa=require(_0x7d6f('0xe'));var Redis=require(_0x7d6f('0xf'));var authService=require(_0x7d6f('0x10'));var qs=require(_0x7d6f('0x11'));var as=require(_0x7d6f('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7d6f('0x13'))(_0x7d6f('0x14'));var utils=require(_0x7d6f('0x15'));var config=require(_0x7d6f('0x16'));var licenseUtil=require(_0x7d6f('0x17'));var db=require(_0x7d6f('0x18'))['db'];function respondWithStatusCode(_0x5009ed,_0x2817c4){_0x2817c4=_0x2817c4||0xcc;return function(_0x1a839f){if(_0x1a839f){return _0x5009ed[_0x7d6f('0x19')](_0x2817c4);}return _0x5009ed[_0x7d6f('0x1a')](_0x2817c4)['end']();};}function respondWithResult(_0x50abb2,_0x20aed7){_0x20aed7=_0x20aed7||0xc8;return function(_0x559c59){if(_0x559c59){return _0x50abb2[_0x7d6f('0x1a')](_0x20aed7)[_0x7d6f('0x1b')](_0x559c59);}};}function respondWithFilteredResult(_0x11b6f7,_0x1305ef){return function(_0x30c600){if(_0x30c600){var _0x2b50b3=typeof _0x1305ef[_0x7d6f('0x1c')]===_0x7d6f('0x1d')&&typeof _0x1305ef[_0x7d6f('0x1e')]===_0x7d6f('0x1d');var _0x55334c=_0x30c600[_0x7d6f('0x1f')];var _0x193024=_0x2b50b3?0x0:_0x1305ef[_0x7d6f('0x1c')];var _0x68d98c=_0x2b50b3?_0x30c600[_0x7d6f('0x1f')]:_0x1305ef[_0x7d6f('0x1c')]+_0x1305ef[_0x7d6f('0x1e')];var _0x704d5e;if(_0x68d98c>=_0x55334c){_0x68d98c=_0x55334c;_0x704d5e=0xc8;}else{_0x704d5e=0xce;}_0x11b6f7[_0x7d6f('0x1a')](_0x704d5e);return _0x11b6f7['set']('Content-Range',_0x193024+'-'+_0x68d98c+'/'+_0x55334c)[_0x7d6f('0x1b')](_0x30c600);}return null;};}function patchUpdates(_0xf3f52a){return function(_0x26158b){try{jsonpatch[_0x7d6f('0x20')](_0x26158b,_0xf3f52a,!![]);}catch(_0x5a8462){return BPromise[_0x7d6f('0x21')](_0x5a8462);}return _0x26158b[_0x7d6f('0x22')]();};}function saveUpdates(_0x57d625,_0x227413){return function(_0xc12ee4){if(_0xc12ee4){return _0xc12ee4['update'](_0x57d625)[_0x7d6f('0x23')](function(_0x43553e){return _0x43553e;});}return null;};}function removeEntity(_0x56a1bc,_0xd59f7b){return function(_0x13be40){if(_0x13be40){return _0x13be40[_0x7d6f('0x24')]()[_0x7d6f('0x23')](function(){_0x56a1bc['status'](0xcc)[_0x7d6f('0x25')]();});}};}function handleEntityNotFound(_0x32e545,_0xac248c){return function(_0x49051c){if(!_0x49051c){_0x32e545[_0x7d6f('0x19')](0x194);}return _0x49051c;};}function handleError(_0x10743d,_0x5c83bd){_0x5c83bd=_0x5c83bd||0x1f4;return function(_0x2fb9cc){logger[_0x7d6f('0x26')](_0x2fb9cc['stack']);if(_0x2fb9cc[_0x7d6f('0x27')]){delete _0x2fb9cc[_0x7d6f('0x27')];}_0x10743d['status'](_0x5c83bd)['send'](_0x2fb9cc);};}exports[_0x7d6f('0x28')]=function(_0x1b6a63,_0x3ecd13){var _0x4859b8={},_0x4d0c99={},_0x114d86={'count':0x0,'rows':[]};var _0x55a6e5=_[_0x7d6f('0x29')](db[_0x7d6f('0x2a')]['rawAttributes'],function(_0xe21ec0){return{'name':_0xe21ec0['fieldName'],'type':_0xe21ec0[_0x7d6f('0x2b')][_0x7d6f('0x2c')]};});_0x4d0c99[_0x7d6f('0x2d')]=_['map'](_0x55a6e5,'name');_0x4d0c99[_0x7d6f('0x2e')]=_[_0x7d6f('0x2f')](_0x1b6a63['query']);_0x4d0c99[_0x7d6f('0x30')]=_['intersection'](_0x4d0c99[_0x7d6f('0x2d')],_0x4d0c99[_0x7d6f('0x2e')]);_0x4859b8[_0x7d6f('0x31')]=_[_0x7d6f('0x32')](_0x4d0c99[_0x7d6f('0x2d')],qs['fields'](_0x1b6a63[_0x7d6f('0x2e')][_0x7d6f('0x33')]));_0x4859b8[_0x7d6f('0x31')]=_0x4859b8[_0x7d6f('0x31')][_0x7d6f('0x34')]?_0x4859b8['attributes']:_0x4d0c99[_0x7d6f('0x2d')];if(!_0x1b6a63['query'][_0x7d6f('0x35')](_0x7d6f('0x36'))){_0x4859b8[_0x7d6f('0x1e')]=qs[_0x7d6f('0x1e')](_0x1b6a63[_0x7d6f('0x2e')][_0x7d6f('0x1e')]);_0x4859b8[_0x7d6f('0x1c')]=qs[_0x7d6f('0x1c')](_0x1b6a63[_0x7d6f('0x2e')][_0x7d6f('0x1c')]);}_0x4859b8[_0x7d6f('0x37')]=qs[_0x7d6f('0x38')](_0x1b6a63[_0x7d6f('0x2e')][_0x7d6f('0x38')]);_0x4859b8[_0x7d6f('0x39')]=qs[_0x7d6f('0x30')](_[_0x7d6f('0x3a')](_0x1b6a63['query'],_0x4d0c99[_0x7d6f('0x30')]),_0x55a6e5);if(_0x1b6a63[_0x7d6f('0x2e')][_0x7d6f('0x3b')]){_0x4859b8[_0x7d6f('0x39')]=_['merge'](_0x4859b8['where'],{'$or':_[_0x7d6f('0x29')](_0x55a6e5,function(_0x529cb3){if(_0x529cb3[_0x7d6f('0x2b')]!==_0x7d6f('0x3c')){var _0xd93b16={};_0xd93b16[_0x529cb3[_0x7d6f('0x27')]]={'$like':'%'+_0x1b6a63['query']['filter']+'%'};return _0xd93b16;}})});}_0x4859b8=_[_0x7d6f('0x3d')]({},_0x4859b8,_0x1b6a63[_0x7d6f('0x3e')]);var _0x1b0ebb={'where':_0x4859b8[_0x7d6f('0x39')]};return db['FaxTransferReport'][_0x7d6f('0x1f')](_0x1b0ebb)['then'](function(_0xfc73d6){_0x114d86[_0x7d6f('0x1f')]=_0xfc73d6;if(_0x1b6a63[_0x7d6f('0x2e')]['includeAll']){_0x4859b8['include']=[{'all':!![]}];}return db['FaxTransferReport'][_0x7d6f('0x3f')](_0x4859b8);})[_0x7d6f('0x23')](function(_0x5f5760){_0x114d86[_0x7d6f('0x40')]=_0x5f5760;return _0x114d86;})[_0x7d6f('0x23')](respondWithFilteredResult(_0x3ecd13,_0x4859b8))[_0x7d6f('0x41')](handleError(_0x3ecd13,null));};exports[_0x7d6f('0x42')]=function(_0x3a7184,_0x534dac){var _0x36f0d8={'raw':!![],'where':{'id':_0x3a7184['params']['id']}},_0x18914f={};_0x18914f[_0x7d6f('0x2d')]=_[_0x7d6f('0x2f')](db[_0x7d6f('0x2a')][_0x7d6f('0x43')]);_0x18914f[_0x7d6f('0x2e')]=_[_0x7d6f('0x2f')](_0x3a7184['query']);_0x18914f[_0x7d6f('0x30')]=_[_0x7d6f('0x32')](_0x18914f[_0x7d6f('0x2d')],_0x18914f[_0x7d6f('0x2e')]);_0x36f0d8[_0x7d6f('0x31')]=_[_0x7d6f('0x32')](_0x18914f[_0x7d6f('0x2d')],qs[_0x7d6f('0x33')](_0x3a7184[_0x7d6f('0x2e')][_0x7d6f('0x33')]));_0x36f0d8[_0x7d6f('0x31')]=_0x36f0d8['attributes'][_0x7d6f('0x34')]?_0x36f0d8[_0x7d6f('0x31')]:_0x18914f['model'];if(_0x3a7184['query'][_0x7d6f('0x44')]){_0x36f0d8['include']=[{'all':!![]}];}_0x36f0d8=_[_0x7d6f('0x3d')]({},_0x36f0d8,_0x3a7184[_0x7d6f('0x3e')]);return db[_0x7d6f('0x2a')][_0x7d6f('0x45')](_0x36f0d8)[_0x7d6f('0x23')](handleEntityNotFound(_0x534dac,null))[_0x7d6f('0x23')](respondWithResult(_0x534dac,null))[_0x7d6f('0x41')](handleError(_0x534dac,null));};exports[_0x7d6f('0x46')]=function(_0x1b5412,_0x32940f){return db[_0x7d6f('0x2a')]['create'](_0x1b5412[_0x7d6f('0x47')],{})[_0x7d6f('0x23')](respondWithResult(_0x32940f,0xc9))['catch'](handleError(_0x32940f,null));};exports['update']=function(_0x1d4dc3,_0x63ef44){if(_0x1d4dc3[_0x7d6f('0x47')]['id']){delete _0x1d4dc3['body']['id'];}return db[_0x7d6f('0x2a')]['find']({'where':{'id':_0x1d4dc3[_0x7d6f('0x48')]['id']}})[_0x7d6f('0x23')](handleEntityNotFound(_0x63ef44,null))[_0x7d6f('0x23')](saveUpdates(_0x1d4dc3[_0x7d6f('0x47')],null))[_0x7d6f('0x23')](respondWithResult(_0x63ef44,null))['catch'](handleError(_0x63ef44,null));};exports[_0x7d6f('0x24')]=function(_0x5b2741,_0x2773fd){return db[_0x7d6f('0x2a')][_0x7d6f('0x45')]({'where':{'id':_0x5b2741[_0x7d6f('0x48')]['id']}})[_0x7d6f('0x23')](handleEntityNotFound(_0x2773fd,null))[_0x7d6f('0x23')](removeEntity(_0x2773fd,null))['catch'](handleError(_0x2773fd,null));};exports[_0x7d6f('0x49')]=function(_0xd853d2,_0x126883){return db['FaxTransferReport']['describe']()[_0x7d6f('0x23')](respondWithResult(_0x126883,null))[_0x7d6f('0x41')](handleError(_0x126883,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 063e5b0..d6a1903 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 _0x63f4=['../../config/environment','define','FaxTransferReport','report_fax_transfer','uniqueid','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x401f9d,_0x72b876){var _0x42ed00=function(_0x2ddf0d){while(--_0x2ddf0d){_0x401f9d['push'](_0x401f9d['shift']());}};_0x42ed00(++_0x72b876);}(_0x63f4,0xcb));var _0x463f=function(_0x4ef673,_0x223308){_0x4ef673=_0x4ef673-0x0;var _0x3574d7=_0x63f4[_0x4ef673];return _0x3574d7;};'use strict';var _=require(_0x463f('0x0'));var util=require(_0x463f('0x1'));var logger=require(_0x463f('0x2'))('api');var moment=require('moment');var BPromise=require(_0x463f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x463f('0x4'));var rimraf=require(_0x463f('0x5'));var config=require(_0x463f('0x6'));var attributes=require('./faxTransferReport.attributes');module['exports']=function(_0x5703d4,_0x4f468e){return _0x5703d4[_0x463f('0x7')](_0x463f('0x8'),attributes,{'tableName':_0x463f('0x9'),'paranoid':![],'indexes':[{'name':_0x463f('0xa'),'fields':[_0x463f('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x04e7=['rimraf','../../config/environment','exports','define','report_fax_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x4e8b98,_0x13eda9){var _0x319712=function(_0x80da19){while(--_0x80da19){_0x4e8b98['push'](_0x4e8b98['shift']());}};_0x319712(++_0x13eda9);}(_0x04e7,0x6e));var _0x704e=function(_0x5af97c,_0x24a49f){_0x5af97c=_0x5af97c-0x0;var _0x3472ae=_0x04e7[_0x5af97c];return _0x3472ae;};'use strict';var _=require(_0x704e('0x0'));var util=require(_0x704e('0x1'));var logger=require(_0x704e('0x2'))(_0x704e('0x3'));var moment=require(_0x704e('0x4'));var BPromise=require(_0x704e('0x5'));var rp=require(_0x704e('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x704e('0x7'));var config=require(_0x704e('0x8'));var attributes=require('./faxTransferReport.attributes');module[_0x704e('0x9')]=function(_0x471eff,_0x460b6e){return _0x471eff[_0x704e('0xa')]('FaxTransferReport',attributes,{'tableName':_0x704e('0xb'),'paranoid':![],'indexes':[{'name':_0x704e('0xc'),'fields':[_0x704e('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 2b9c512..dc464e4 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 _0x8582=['rpc','../../config/environment','jayson/promise','request','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x11503f,_0x30de86){var _0x34caab=function(_0x16e6a6){while(--_0x16e6a6){_0x11503f['push'](_0x11503f['shift']());}};_0x34caab(++_0x30de86);}(_0x8582,0x149));var _0x2858=function(_0x4b71ff,_0x5a1802){_0x4b71ff=_0x4b71ff-0x0;var _0x3791bc=_0x8582[_0x4b71ff];return _0x3791bc;};'use strict';var _=require(_0x2858('0x0'));var util=require(_0x2858('0x1'));var moment=require(_0x2858('0x2'));var BPromise=require('bluebird');var rs=require(_0x2858('0x3'));var fs=require('fs');var Redis=require(_0x2858('0x4'));var db=require(_0x2858('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2858('0x6'))(_0x2858('0x7'));var config=require(_0x2858('0x8'));var jayson=require(_0x2858('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1797fc,_0xd83c25,_0x5a5d21){return new BPromise(function(_0x2bde02,_0x372553){return client[_0x2858('0xa')](_0x1797fc,_0x5a5d21)[_0x2858('0xb')](function(_0x494f1b){logger[_0x2858('0xc')](_0x2858('0xd'),_0xd83c25,_0x2858('0xe'));logger['debug'](_0x2858('0xf'),_0xd83c25,'request\x20sent',JSON[_0x2858('0x10')](_0x494f1b));if(_0x494f1b[_0x2858('0x11')]){if(_0x494f1b[_0x2858('0x11')]['code']===0x1f4){logger['error'](_0x2858('0xd'),_0xd83c25,_0x494f1b['error']['message']);return _0x372553(_0x494f1b[_0x2858('0x11')][_0x2858('0x12')]);}logger[_0x2858('0x11')](_0x2858('0xd'),_0xd83c25,_0x494f1b['error']['message']);return _0x2bde02(_0x494f1b[_0x2858('0x11')][_0x2858('0x12')]);}else{logger['info']('FaxTransferReport,\x20%s,\x20%s',_0xd83c25,_0x2858('0xe'));_0x2bde02(_0x494f1b[_0x2858('0x13')]['message']);}})[_0x2858('0x14')](function(_0x7f516d){logger['error']('FaxTransferReport,\x20%s,\x20%s',_0xd83c25,_0x7f516d);_0x372553(_0x7f516d);});});} \ No newline at end of file +var _0xeb1d=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','FaxTransferReport,\x20%s,\x20%s','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x174237,_0x34dec3){var _0x22cd8d=function(_0x472999){while(--_0x472999){_0x174237['push'](_0x174237['shift']());}};_0x22cd8d(++_0x34dec3);}(_0xeb1d,0x96));var _0xdeb1=function(_0x350681,_0x4f86f4){_0x350681=_0x350681-0x0;var _0x34ac0e=_0xeb1d[_0x350681];return _0x34ac0e;};'use strict';var _=require(_0xdeb1('0x0'));var util=require(_0xdeb1('0x1'));var moment=require(_0xdeb1('0x2'));var BPromise=require(_0xdeb1('0x3'));var rs=require(_0xdeb1('0x4'));var fs=require('fs');var Redis=require(_0xdeb1('0x5'));var db=require(_0xdeb1('0x6'))['db'];var utils=require(_0xdeb1('0x7'));var logger=require(_0xdeb1('0x8'))(_0xdeb1('0x9'));var config=require('../../config/environment');var jayson=require(_0xdeb1('0xa'));var client=jayson[_0xdeb1('0xb')][_0xdeb1('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x418ff3,_0x209806,_0x53092d){return new BPromise(function(_0x5334a2,_0x410460){return client[_0xdeb1('0xd')](_0x418ff3,_0x53092d)[_0xdeb1('0xe')](function(_0x2cacb4){logger[_0xdeb1('0xf')](_0xdeb1('0x10'),_0x209806,'request\x20sent');logger[_0xdeb1('0x11')](_0xdeb1('0x12'),_0x209806,_0xdeb1('0x13'),JSON[_0xdeb1('0x14')](_0x2cacb4));if(_0x2cacb4[_0xdeb1('0x15')]){if(_0x2cacb4[_0xdeb1('0x15')][_0xdeb1('0x16')]===0x1f4){logger[_0xdeb1('0x15')](_0xdeb1('0x10'),_0x209806,_0x2cacb4[_0xdeb1('0x15')][_0xdeb1('0x17')]);return _0x410460(_0x2cacb4[_0xdeb1('0x15')][_0xdeb1('0x17')]);}logger[_0xdeb1('0x15')](_0xdeb1('0x10'),_0x209806,_0x2cacb4['error'][_0xdeb1('0x17')]);return _0x5334a2(_0x2cacb4[_0xdeb1('0x15')][_0xdeb1('0x17')]);}else{logger[_0xdeb1('0xf')](_0xdeb1('0x10'),_0x209806,_0xdeb1('0x13'));_0x5334a2(_0x2cacb4[_0xdeb1('0x18')][_0xdeb1('0x17')]);}})['catch'](function(_0xca047b){logger[_0xdeb1('0x15')](_0xdeb1('0x10'),_0x209806,_0xca047b);_0x410460(_0xca047b);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 206ce71..f5b6772 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 _0x537f=['isAuthenticated','/describe','/:id','show','post','put','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get'];(function(_0x114c38,_0x2c6970){var _0x53e6bb=function(_0x2e1c37){while(--_0x2e1c37){_0x114c38['push'](_0x114c38['shift']());}};_0x53e6bb(++_0x2c6970);}(_0x537f,0x1db));var _0xf537=function(_0x414491,_0x14f4e9){_0x414491=_0x414491-0x0;var _0x5cda0d=_0x537f[_0x414491];return _0x5cda0d;};'use strict';var multer=require('multer');var util=require(_0xf537('0x0'));var path=require(_0xf537('0x1'));var timeout=require(_0xf537('0x2'));var express=require(_0xf537('0x3'));var router=express[_0xf537('0x4')]();var fs_extra=require(_0xf537('0x5'));var auth=require(_0xf537('0x6'));var interaction=require(_0xf537('0x7'));var config=require(_0xf537('0x8'));var controller=require(_0xf537('0x9'));router[_0xf537('0xa')]('/',auth[_0xf537('0xb')](),controller['index']);router['get'](_0xf537('0xc'),auth[_0xf537('0xb')](),controller['describe']);router[_0xf537('0xa')](_0xf537('0xd'),auth['isAuthenticated'](),controller[_0xf537('0xe')]);router[_0xf537('0xf')]('/',auth[_0xf537('0xb')](),controller['create']);router[_0xf537('0x10')](_0xf537('0xd'),auth[_0xf537('0xb')](),controller['update']);router['delete']('/:id',auth[_0xf537('0xb')](),controller['destroy']);module[_0xf537('0x11')]=router; \ No newline at end of file +var _0x543c=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','isAuthenticated','/describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0x86dee8,_0x11b14f){var _0x5cda1f=function(_0x16caaa){while(--_0x16caaa){_0x86dee8['push'](_0x86dee8['shift']());}};_0x5cda1f(++_0x11b14f);}(_0x543c,0xef));var _0xc543=function(_0x27604f,_0x5ae336){_0x27604f=_0x27604f-0x0;var _0x40d189=_0x543c[_0x27604f];return _0x40d189;};'use strict';var multer=require(_0xc543('0x0'));var util=require(_0xc543('0x1'));var path=require(_0xc543('0x2'));var timeout=require(_0xc543('0x3'));var express=require('express');var router=express[_0xc543('0x4')]();var fs_extra=require(_0xc543('0x5'));var auth=require(_0xc543('0x6'));var interaction=require(_0xc543('0x7'));var config=require(_0xc543('0x8'));var controller=require(_0xc543('0x9'));router[_0xc543('0xa')]('/',auth[_0xc543('0xb')](),controller['index']);router['get'](_0xc543('0xc'),auth[_0xc543('0xb')](),controller['describe']);router[_0xc543('0xa')](_0xc543('0xd'),auth[_0xc543('0xb')](),controller[_0xc543('0xe')]);router[_0xc543('0xf')]('/',auth[_0xc543('0xb')](),controller[_0xc543('0x10')]);router[_0xc543('0x11')]('/:id',auth[_0xc543('0xb')](),controller[_0xc543('0x12')]);router[_0xc543('0x13')]('/:id',auth[_0xc543('0xb')](),controller[_0xc543('0x14')]);module[_0xc543('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 1ccbd8f..ff0675b 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 _0x33d4=['/:id/configurations','getConfigurations','/:id/fields','post','put','update','/:id','destroy','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','index','show'];(function(_0xa56f49,_0x2056fc){var _0x5eba32=function(_0xc1e00a){while(--_0xc1e00a){_0xa56f49['push'](_0xa56f49['shift']());}};_0x5eba32(++_0x2056fc);}(_0x33d4,0x120));var _0x433d=function(_0x1f1908,_0x4ef383){_0x1f1908=_0x1f1908-0x0;var _0x9ff033=_0x33d4[_0x1f1908];return _0x9ff033;};'use strict';var multer=require('multer');var util=require(_0x433d('0x0'));var path=require(_0x433d('0x1'));var timeout=require(_0x433d('0x2'));var express=require('express');var router=express[_0x433d('0x3')]();var fs_extra=require(_0x433d('0x4'));var auth=require(_0x433d('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x433d('0x6'));var controller=require(_0x433d('0x7'));router[_0x433d('0x8')]('/',auth[_0x433d('0x9')](),controller[_0x433d('0xa')]);router[_0x433d('0x8')]('/:id',auth[_0x433d('0x9')](),controller[_0x433d('0xb')]);router[_0x433d('0x8')](_0x433d('0xc'),auth[_0x433d('0x9')](),controller[_0x433d('0xd')]);router[_0x433d('0x8')](_0x433d('0xe'),auth[_0x433d('0x9')](),controller['getFields']);router[_0x433d('0xf')]('/',auth[_0x433d('0x9')](),controller['create']);router[_0x433d('0xf')](_0x433d('0xc'),auth[_0x433d('0x9')](),controller['addConfiguration']);router[_0x433d('0x10')]('/:id',auth[_0x433d('0x9')](),controller[_0x433d('0x11')]);router['delete'](_0x433d('0x12'),auth[_0x433d('0x9')](),controller[_0x433d('0x13')]);module['exports']=router; \ No newline at end of file +var _0xf354=['put','update','delete','destroy','util','path','express','Router','../../components/auth/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration'];(function(_0x78db5e,_0x3b9804){var _0x250b88=function(_0x20a40f){while(--_0x20a40f){_0x78db5e['push'](_0x78db5e['shift']());}};_0x250b88(++_0x3b9804);}(_0xf354,0x9e));var _0x4f35=function(_0x518761,_0x35785e){_0x518761=_0x518761-0x0;var _0x1e5a23=_0xf354[_0x518761];return _0x1e5a23;};'use strict';var multer=require('multer');var util=require(_0x4f35('0x0'));var path=require(_0x4f35('0x1'));var timeout=require('connect-timeout');var express=require(_0x4f35('0x2'));var router=express[_0x4f35('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x4f35('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x4f35('0x5'));var controller=require(_0x4f35('0x6'));router[_0x4f35('0x7')]('/',auth[_0x4f35('0x8')](),controller[_0x4f35('0x9')]);router[_0x4f35('0x7')](_0x4f35('0xa'),auth[_0x4f35('0x8')](),controller[_0x4f35('0xb')]);router[_0x4f35('0x7')](_0x4f35('0xc'),auth[_0x4f35('0x8')](),controller['getConfigurations']);router['get'](_0x4f35('0xd'),auth[_0x4f35('0x8')](),controller[_0x4f35('0xe')]);router[_0x4f35('0xf')]('/',auth['isAuthenticated'](),controller[_0x4f35('0x10')]);router[_0x4f35('0xf')](_0x4f35('0xc'),auth[_0x4f35('0x8')](),controller[_0x4f35('0x11')]);router[_0x4f35('0x12')](_0x4f35('0xa'),auth['isAuthenticated'](),controller[_0x4f35('0x13')]);router[_0x4f35('0x14')](_0x4f35('0xa'),auth[_0x4f35('0x8')](),controller[_0x4f35('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 1cf7c2e..0841372 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 _0xfd01=['STRING','ENUM','integrationTab','newTab','sequelize','exports'];(function(_0x26a984,_0x5cfec4){var _0x4254e9=function(_0xb1502f){while(--_0xb1502f){_0x26a984['push'](_0x26a984['shift']());}};_0x4254e9(++_0x5cfec4);}(_0xfd01,0x196));var _0x1fd0=function(_0x192a34,_0x4ab66d){_0x192a34=_0x192a34-0x0;var _0x19ed42=_0xfd01[_0x192a34];return _0x19ed42;};'use strict';var Sequelize=require(_0x1fd0('0x0'));module[_0x1fd0('0x1')]={'name':{'type':Sequelize[_0x1fd0('0x2')]},'description':{'type':Sequelize[_0x1fd0('0x2')]},'username':{'type':Sequelize[_0x1fd0('0x2')]},'remoteUri':{'type':Sequelize[_0x1fd0('0x2')]},'authType':{'type':Sequelize[_0x1fd0('0x3')]('basic'),'defaultValue':'basic'},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize[_0x1fd0('0x2')]},'token':{'type':Sequelize[_0x1fd0('0x2')]},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x1fd0('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x1fd0('0x3')](_0x1fd0('0x4'),_0x1fd0('0x5')),'defaultValue':_0x1fd0('0x4')}}; \ No newline at end of file +var _0x53e9=['newTab','sequelize','STRING','ENUM','basic','integrationTab'];(function(_0x46a3ff,_0x470b9a){var _0x404bc2=function(_0x20f25f){while(--_0x20f25f){_0x46a3ff['push'](_0x46a3ff['shift']());}};_0x404bc2(++_0x470b9a);}(_0x53e9,0xb5));var _0x953e=function(_0x4def8b,_0x546bfe){_0x4def8b=_0x4def8b-0x0;var _0x4769fc=_0x53e9[_0x4def8b];return _0x4769fc;};'use strict';var Sequelize=require(_0x953e('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x953e('0x1')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x953e('0x1')]},'authType':{'type':Sequelize[_0x953e('0x2')]('basic'),'defaultValue':_0x953e('0x3')},'password':{'type':Sequelize[_0x953e('0x1')]},'consumerKey':{'type':Sequelize[_0x953e('0x1')]},'consumerSecret':{'type':Sequelize[_0x953e('0x1')]},'token':{'type':Sequelize[_0x953e('0x1')]},'tokenSecret':{'type':Sequelize[_0x953e('0x1')]},'serverUrl':{'type':Sequelize[_0x953e('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x953e('0x2')](_0x953e('0x4'),_0x953e('0x5')),'defaultValue':_0x953e('0x4')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index bdd8b21..53ad32b 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 _0x7c67=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','limit','count','set','reject','save','then','destroy','end','error','stack','name','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','sort','where','pick','filter','type','VIRTUAL','DeskAccount','include','rows','catch','show','includeAll','merge','options','find','create','update','body','params','getConfigurations','DeskConfiguration','order','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','channel','getFields','priority','findOne','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','slice','substring','GET','format','%s/custom_fields','application/json','headers','Authorization','Basic\x20%s','base64','_embedded','active','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','eml-format','rimraf','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x1e1434,_0x4950e6){var _0x57b6ae=function(_0x9ea757){while(--_0x9ea757){_0x1e1434['push'](_0x1e1434['shift']());}};_0x57b6ae(++_0x4950e6);}(_0x7c67,0x1b2));var _0x77c6=function(_0x57f622,_0x3fee36){_0x57f622=_0x57f622-0x0;var _0x348911=_0x7c67[_0x57f622];return _0x348911;};'use strict';var emlformat=require(_0x77c6('0x0'));var rimraf=require(_0x77c6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x77c6('0x2'));var BPromise=require(_0x77c6('0x3'));var Mustache=require(_0x77c6('0x4'));var util=require(_0x77c6('0x5'));var path=require(_0x77c6('0x6'));var sox=require(_0x77c6('0x7'));var csv=require('to-csv');var ejs=require(_0x77c6('0x8'));var fs=require('fs');var fs_extra=require(_0x77c6('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x77c6('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x77c6('0xb'));var toCsv=require('to-csv');var querystring=require(_0x77c6('0xc'));var Papa=require(_0x77c6('0xd'));var Redis=require(_0x77c6('0xe'));var authService=require(_0x77c6('0xf'));var qs=require(_0x77c6('0x10'));var as=require(_0x77c6('0x11'));var hardwareService=require(_0x77c6('0x12'));var logger=require(_0x77c6('0x13'))(_0x77c6('0x14'));var utils=require(_0x77c6('0x15'));var config=require(_0x77c6('0x16'));var licenseUtil=require(_0x77c6('0x17'));var db=require(_0x77c6('0x18'))['db'];var integrations=require(_0x77c6('0x19'));function respondWithStatusCode(_0x39cf07,_0x20dc58){_0x20dc58=_0x20dc58||0xcc;return function(_0x20d992){if(_0x20d992){return _0x39cf07[_0x77c6('0x1a')](_0x20dc58);}return _0x39cf07[_0x77c6('0x1b')](_0x20dc58)['end']();};}function respondWithResult(_0x41d3f6,_0x445bda){_0x445bda=_0x445bda||0xc8;return function(_0x3b87c9){if(_0x3b87c9){return _0x41d3f6[_0x77c6('0x1b')](_0x445bda)[_0x77c6('0x1c')](_0x3b87c9);}};}function respondWithFilteredResult(_0x42a59d,_0x3bae5d){return function(_0x1713d4){if(_0x1713d4){var _0x5cbbb0=typeof _0x3bae5d[_0x77c6('0x1d')]===_0x77c6('0x1e')&&typeof _0x3bae5d[_0x77c6('0x1f')]===_0x77c6('0x1e');var _0x44b3ce=_0x1713d4[_0x77c6('0x20')];var _0x16e5ea=_0x5cbbb0?0x0:_0x3bae5d['offset'];var _0x548bcd=_0x5cbbb0?_0x1713d4[_0x77c6('0x20')]:_0x3bae5d['offset']+_0x3bae5d[_0x77c6('0x1f')];var _0x55d721;if(_0x548bcd>=_0x44b3ce){_0x548bcd=_0x44b3ce;_0x55d721=0xc8;}else{_0x55d721=0xce;}_0x42a59d['status'](_0x55d721);return _0x42a59d[_0x77c6('0x21')]('Content-Range',_0x16e5ea+'-'+_0x548bcd+'/'+_0x44b3ce)['json'](_0x1713d4);}return null;};}function patchUpdates(_0x36d5b4){return function(_0x21cc38){try{jsonpatch['apply'](_0x21cc38,_0x36d5b4,!![]);}catch(_0x3b108b){return BPromise[_0x77c6('0x22')](_0x3b108b);}return _0x21cc38[_0x77c6('0x23')]();};}function saveUpdates(_0xbb8dc5,_0x14d6da){return function(_0x30d179){if(_0x30d179){return _0x30d179['update'](_0xbb8dc5)[_0x77c6('0x24')](function(_0x30d604){return _0x30d604;});}return null;};}function removeEntity(_0x42c4c0,_0xc827d1){return function(_0x387621){if(_0x387621){return _0x387621[_0x77c6('0x25')]()[_0x77c6('0x24')](function(){_0x42c4c0['status'](0xcc)[_0x77c6('0x26')]();});}};}function handleEntityNotFound(_0x3bc254,_0x457439){return function(_0x12d930){if(!_0x12d930){_0x3bc254[_0x77c6('0x1a')](0x194);}return _0x12d930;};}function handleError(_0x40c642,_0x2959c4){_0x2959c4=_0x2959c4||0x1f4;return function(_0x468f55){logger[_0x77c6('0x27')](_0x468f55[_0x77c6('0x28')]);if(_0x468f55[_0x77c6('0x29')]){delete _0x468f55['name'];}_0x40c642[_0x77c6('0x1b')](_0x2959c4)['send'](_0x468f55);};}exports[_0x77c6('0x2a')]=function(_0x33416e,_0x523143){var _0x4317b6={},_0x59c84a={},_0x44a57b={'count':0x0,'rows':[]};var _0x17ed5d=_[_0x77c6('0x2b')](db['DeskAccount'][_0x77c6('0x2c')],function(_0x56d06a){return{'name':_0x56d06a[_0x77c6('0x2d')],'type':_0x56d06a['type'][_0x77c6('0x2e')]};});_0x59c84a[_0x77c6('0x2f')]=_['map'](_0x17ed5d,_0x77c6('0x29'));_0x59c84a[_0x77c6('0x30')]=_[_0x77c6('0x31')](_0x33416e[_0x77c6('0x30')]);_0x59c84a[_0x77c6('0x32')]=_[_0x77c6('0x33')](_0x59c84a[_0x77c6('0x2f')],_0x59c84a['query']);_0x4317b6[_0x77c6('0x34')]=_[_0x77c6('0x33')](_0x59c84a[_0x77c6('0x2f')],qs[_0x77c6('0x35')](_0x33416e[_0x77c6('0x30')][_0x77c6('0x35')]));_0x4317b6[_0x77c6('0x34')]=_0x4317b6[_0x77c6('0x34')][_0x77c6('0x36')]?_0x4317b6[_0x77c6('0x34')]:_0x59c84a[_0x77c6('0x2f')];if(!_0x33416e['query']['hasOwnProperty']('nolimit')){_0x4317b6['limit']=qs['limit'](_0x33416e[_0x77c6('0x30')][_0x77c6('0x1f')]);_0x4317b6[_0x77c6('0x1d')]=qs[_0x77c6('0x1d')](_0x33416e[_0x77c6('0x30')][_0x77c6('0x1d')]);}_0x4317b6['order']=qs[_0x77c6('0x37')](_0x33416e[_0x77c6('0x30')]['sort']);_0x4317b6[_0x77c6('0x38')]=qs[_0x77c6('0x32')](_[_0x77c6('0x39')](_0x33416e[_0x77c6('0x30')],_0x59c84a[_0x77c6('0x32')]),_0x17ed5d);if(_0x33416e[_0x77c6('0x30')][_0x77c6('0x3a')]){_0x4317b6[_0x77c6('0x38')]=_['merge'](_0x4317b6[_0x77c6('0x38')],{'$or':_[_0x77c6('0x2b')](_0x17ed5d,function(_0x4a48ec){if(_0x4a48ec[_0x77c6('0x3b')]!==_0x77c6('0x3c')){var _0x371308={};_0x371308[_0x4a48ec[_0x77c6('0x29')]]={'$like':'%'+_0x33416e[_0x77c6('0x30')][_0x77c6('0x3a')]+'%'};return _0x371308;}})});}_0x4317b6=_['merge']({},_0x4317b6,_0x33416e['options']);var _0x4e4339={'where':_0x4317b6[_0x77c6('0x38')]};return db[_0x77c6('0x3d')][_0x77c6('0x20')](_0x4e4339)['then'](function(_0x5b25ca){_0x44a57b['count']=_0x5b25ca;if(_0x33416e[_0x77c6('0x30')]['includeAll']){_0x4317b6[_0x77c6('0x3e')]=[{'all':!![]}];}return db[_0x77c6('0x3d')]['findAll'](_0x4317b6);})['then'](function(_0x398be9){_0x44a57b[_0x77c6('0x3f')]=_0x398be9;return _0x44a57b;})['then'](respondWithFilteredResult(_0x523143,_0x4317b6))[_0x77c6('0x40')](handleError(_0x523143,null));};exports[_0x77c6('0x41')]=function(_0x31f00a,_0x3750a3){var _0x4cb6b2={'raw':![],'where':{'id':_0x31f00a['params']['id']}},_0x56a837={};_0x56a837[_0x77c6('0x2f')]=_[_0x77c6('0x31')](db[_0x77c6('0x3d')][_0x77c6('0x2c')]);_0x56a837[_0x77c6('0x30')]=_[_0x77c6('0x31')](_0x31f00a[_0x77c6('0x30')]);_0x56a837['filters']=_[_0x77c6('0x33')](_0x56a837[_0x77c6('0x2f')],_0x56a837[_0x77c6('0x30')]);_0x4cb6b2[_0x77c6('0x34')]=_[_0x77c6('0x33')](_0x56a837[_0x77c6('0x2f')],qs[_0x77c6('0x35')](_0x31f00a[_0x77c6('0x30')][_0x77c6('0x35')]));_0x4cb6b2[_0x77c6('0x34')]=_0x4cb6b2[_0x77c6('0x34')][_0x77c6('0x36')]?_0x4cb6b2[_0x77c6('0x34')]:_0x56a837['model'];if(_0x31f00a[_0x77c6('0x30')][_0x77c6('0x42')]){_0x4cb6b2[_0x77c6('0x3e')]=[{'all':!![]}];}_0x4cb6b2=_[_0x77c6('0x43')]({},_0x4cb6b2,_0x31f00a[_0x77c6('0x44')]);return db[_0x77c6('0x3d')][_0x77c6('0x45')](_0x4cb6b2)[_0x77c6('0x24')](handleEntityNotFound(_0x3750a3,null))[_0x77c6('0x24')](respondWithResult(_0x3750a3,null))[_0x77c6('0x40')](handleError(_0x3750a3,null));};exports[_0x77c6('0x46')]=function(_0x7a571a,_0x25324b){return db[_0x77c6('0x3d')][_0x77c6('0x46')](_0x7a571a['body'],{})[_0x77c6('0x24')](respondWithResult(_0x25324b,0xc9))[_0x77c6('0x40')](handleError(_0x25324b,null));};exports[_0x77c6('0x47')]=function(_0x4c783a,_0xc191a9){if(_0x4c783a[_0x77c6('0x48')]['id']){delete _0x4c783a[_0x77c6('0x48')]['id'];}return db[_0x77c6('0x3d')][_0x77c6('0x45')]({'where':{'id':_0x4c783a['params']['id']}})[_0x77c6('0x24')](handleEntityNotFound(_0xc191a9,null))[_0x77c6('0x24')](saveUpdates(_0x4c783a['body'],null))[_0x77c6('0x24')](respondWithResult(_0xc191a9,null))[_0x77c6('0x40')](handleError(_0xc191a9,null));};exports['destroy']=function(_0x50a5bf,_0x82c8fb){return db[_0x77c6('0x3d')][_0x77c6('0x45')]({'where':{'id':_0x50a5bf[_0x77c6('0x49')]['id']}})['then'](handleEntityNotFound(_0x82c8fb,null))[_0x77c6('0x24')](removeEntity(_0x82c8fb,null))[_0x77c6('0x40')](handleError(_0x82c8fb,null));};exports[_0x77c6('0x4a')]=function(_0xd9803f,_0x57e346,_0x266d3d){var _0x57d276={};var _0x836dc7={};var _0x4c8a6e;var _0x36a747;return db[_0x77c6('0x3d')]['findOne']({'where':{'id':_0xd9803f['params']['id']}})[_0x77c6('0x24')](handleEntityNotFound(_0x57e346,null))[_0x77c6('0x24')](function(_0x4c797f){if(_0x4c797f){_0x4c8a6e=_0x4c797f;_0x836dc7[_0x77c6('0x2f')]=_[_0x77c6('0x31')](db[_0x77c6('0x4b')]['rawAttributes']);_0x836dc7[_0x77c6('0x30')]=_[_0x77c6('0x31')](_0xd9803f[_0x77c6('0x30')]);_0x836dc7[_0x77c6('0x32')]=_[_0x77c6('0x33')](_0x836dc7[_0x77c6('0x2f')],_0x836dc7[_0x77c6('0x30')]);_0x57d276[_0x77c6('0x34')]=_[_0x77c6('0x33')](_0x836dc7[_0x77c6('0x2f')],qs['fields'](_0xd9803f['query']['fields']));_0x57d276[_0x77c6('0x34')]=_0x57d276[_0x77c6('0x34')][_0x77c6('0x36')]?_0x57d276[_0x77c6('0x34')]:_0x836dc7[_0x77c6('0x2f')];_0x57d276[_0x77c6('0x4c')]=qs[_0x77c6('0x37')](_0xd9803f[_0x77c6('0x30')][_0x77c6('0x37')]);_0x57d276[_0x77c6('0x38')]=qs[_0x77c6('0x32')](_[_0x77c6('0x39')](_0xd9803f[_0x77c6('0x30')],_0x836dc7[_0x77c6('0x32')]));if(_0xd9803f[_0x77c6('0x30')][_0x77c6('0x3a')]){_0x57d276[_0x77c6('0x38')]=_[_0x77c6('0x43')](_0x57d276['where'],{'$or':_[_0x77c6('0x2b')](_0x57d276['attributes'],function(_0x28dc98){var _0x5c810c={};_0x5c810c[_0x28dc98]={'$like':'%'+_0xd9803f[_0x77c6('0x30')][_0x77c6('0x3a')]+'%'};return _0x5c810c;})});}_0x57d276=_['merge']({},_0x57d276,_0xd9803f['options']);return _0x4c8a6e[_0x77c6('0x4a')](_0x57d276);}})['then'](function(_0x3304ef){if(_0x3304ef){_0x36a747=_0x3304ef['length'];if(!_0xd9803f['query'][_0x77c6('0x4d')]('nolimit')){_0x57d276[_0x77c6('0x1f')]=qs[_0x77c6('0x1f')](_0xd9803f[_0x77c6('0x30')]['limit']);_0x57d276[_0x77c6('0x1d')]=qs[_0x77c6('0x1d')](_0xd9803f[_0x77c6('0x30')]['offset']);}return _0x4c8a6e[_0x77c6('0x4a')](_0x57d276);}})[_0x77c6('0x24')](function(_0x29982d){if(_0x29982d){return _0x29982d?{'count':_0x36a747,'rows':_0x29982d}:null;}})[_0x77c6('0x24')](respondWithResult(_0x57e346,null))['catch'](handleError(_0x57e346,null));};exports[_0x77c6('0x4e')]=function(_0x6939f4,_0x2e315e,_0x444124){if(_0x6939f4['body']['id']){delete _0x6939f4[_0x77c6('0x48')]['id'];}return db[_0x77c6('0x3d')]['findOne']({'where':{'id':_0x6939f4['params']['id']}})['then'](handleEntityNotFound(_0x2e315e,null))[_0x77c6('0x24')](function(_0x1a7703){if(_0x1a7703){_0x6939f4['body'][_0x77c6('0x4f')]=_0x1a7703['id'];_0x6939f4['body'][_0x77c6('0x50')]=integrations[_0x77c6('0x51')](_0x6939f4[_0x77c6('0x48')]['channel'],_0x6939f4[_0x77c6('0x48')]['type']);_0x6939f4[_0x77c6('0x48')][_0x77c6('0x52')]=integrations['getDescriptions'](_0x6939f4[_0x77c6('0x48')][_0x77c6('0x53')],_0x6939f4[_0x77c6('0x48')][_0x77c6('0x3b')]);return db[_0x77c6('0x4b')][_0x77c6('0x46')](_0x6939f4[_0x77c6('0x48')],{'include':[{'model':db['DeskField'],'as':'Subjects'},{'model':db['DeskField'],'as':'Descriptions'}]});}return null;})[_0x77c6('0x24')](respondWithResult(_0x2e315e,null))[_0x77c6('0x40')](handleError(_0x2e315e,null));};exports[_0x77c6('0x54')]=function(_0x3712bf,_0x206449,_0x37adba){var _0x49d89a=[{'name':_0x77c6('0x55'),'label':_0x77c6('0x55'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x4d303c='';return db[_0x77c6('0x3d')][_0x77c6('0x56')]({'where':{'id':_0x3712bf[_0x77c6('0x49')]['id']},'attributes':['id',_0x77c6('0x57'),_0x77c6('0x58'),'username',_0x77c6('0x59'),_0x77c6('0x5a'),_0x77c6('0x5b'),_0x77c6('0x5c'),_0x77c6('0x5d')]})[_0x77c6('0x24')](handleEntityNotFound(_0x206449,null))['then'](function(_0xe85649){if(_0xe85649){_0x4d303c=_0xe85649[_0x77c6('0x57')];var _0x6e0d1f=_0x4d303c[_0x77c6('0x5e')](-0x1);if(_0x6e0d1f==='/'){_0x4d303c=_0x4d303c[_0x77c6('0x5f')](0x0,_0x4d303c['lastIndexOf'](_0x6e0d1f));}var _0xa3c828={'method':_0x77c6('0x60'),'uri':util[_0x77c6('0x61')](_0x77c6('0x62'),_0x4d303c),'headers':{'Content-Type':_0x77c6('0x63'),'Accept':_0x77c6('0x63')},'json':!![]};if(_0xe85649['authType']==='basic'){_0xa3c828[_0x77c6('0x64')][_0x77c6('0x65')]=util[_0x77c6('0x61')](_0x77c6('0x66'),new Buffer(util[_0x77c6('0x61')]('%s:%s',_0xe85649['username'],_0xe85649['password']))['toString'](_0x77c6('0x67')));}return rp(_0xa3c828)[_0x77c6('0x24')](function(_0x1ce68d){return _0x49d89a['concat'](_[_0x77c6('0x2b')](_0x1ce68d[_0x77c6('0x68')]['entries'],function(_0x56426c){return{'id':_0x56426c[_0x77c6('0x29')],'name':_0x56426c[_0x77c6('0x29')],'type':_0x56426c[_0x77c6('0x3b')],'active':_0x56426c[_0x77c6('0x69')],'label':_0x56426c[_0x77c6('0x6a')],'custom':!![]};}));});}})[_0x77c6('0x24')](function(_0x22b4cc){return{'count':_0x22b4cc[_0x77c6('0x36')],'rows':_0x22b4cc};})[_0x77c6('0x24')](respondWithResult(_0x206449,null))['catch'](function(_0x39c9c1){var _0x55ce68=_0x3712bf[_0x77c6('0x30')][_0x77c6('0x6b')]?0x1f4:_0x39c9c1[_0x77c6('0x6c')]||0x1f4;logger['error'](_0x77c6('0x6d'),'getFields',_0x55ce68,JSON[_0x77c6('0x6e')](_0x39c9c1));delete _0x39c9c1[_0x77c6('0x29')];if(_0x55ce68===0x191){_0x55ce68=0x190;}_0x206449['status'](_0x55ce68)[_0x77c6('0x6f')](_0x3712bf[_0x77c6('0x30')][_0x77c6('0x6b')]?{'message':_0x77c6('0x70'),'statusCode':_0x39c9c1[_0x77c6('0x6c')]}:_0x39c9c1);});}; \ No newline at end of file +var _0x0f6a=['slice','substring','lastIndexOf','format','%s/custom_fields','application/json','basic','Basic\x20%s','base64','concat','_embedded','entries','test','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','statusCode','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','destroy','end','error','stack','index','DeskAccount','rawAttributes','key','map','query','keys','filters','model','intersection','fields','attributes','length','nolimit','sort','where','pick','filter','merge','type','name','options','includeAll','include','findAll','catch','show','params','create','body','findOne','DeskConfiguration','order','getConfigurations','hasOwnProperty','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','DeskField','getFields','priority','remoteUri','authType','username','password','consumerSecret','token','tokenSecret'];(function(_0x533050,_0xe05ec){var _0x25812f=function(_0x26dd52){while(--_0x26dd52){_0x533050['push'](_0x533050['shift']());}};_0x25812f(++_0xe05ec);}(_0x0f6a,0x1d6));var _0xa0f6=function(_0x4f2da9,_0x1ea50c){_0x4f2da9=_0x4f2da9-0x0;var _0x2dca8a=_0x0f6a[_0x4f2da9];return _0x2dca8a;};'use strict';var emlformat=require(_0xa0f6('0x0'));var rimraf=require(_0xa0f6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa0f6('0x2'));var rp=require(_0xa0f6('0x3'));var moment=require(_0xa0f6('0x4'));var BPromise=require(_0xa0f6('0x5'));var Mustache=require(_0xa0f6('0x6'));var util=require(_0xa0f6('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xa0f6('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa0f6('0x9'));var squel=require(_0xa0f6('0xa'));var crypto=require(_0xa0f6('0xb'));var jsforce=require(_0xa0f6('0xc'));var deskjs=require(_0xa0f6('0xd'));var toCsv=require(_0xa0f6('0x8'));var querystring=require(_0xa0f6('0xe'));var Papa=require(_0xa0f6('0xf'));var Redis=require(_0xa0f6('0x10'));var authService=require(_0xa0f6('0x11'));var qs=require(_0xa0f6('0x12'));var as=require(_0xa0f6('0x13'));var hardwareService=require(_0xa0f6('0x14'));var logger=require(_0xa0f6('0x15'))(_0xa0f6('0x16'));var utils=require(_0xa0f6('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xa0f6('0x18'));var db=require(_0xa0f6('0x19'))['db'];var integrations=require(_0xa0f6('0x1a'));function respondWithStatusCode(_0x1fa2db,_0x1bd716){_0x1bd716=_0x1bd716||0xcc;return function(_0x11e248){if(_0x11e248){return _0x1fa2db[_0xa0f6('0x1b')](_0x1bd716);}return _0x1fa2db[_0xa0f6('0x1c')](_0x1bd716)['end']();};}function respondWithResult(_0x2417ef,_0x44a160){_0x44a160=_0x44a160||0xc8;return function(_0x3eb04b){if(_0x3eb04b){return _0x2417ef['status'](_0x44a160)[_0xa0f6('0x1d')](_0x3eb04b);}};}function respondWithFilteredResult(_0x5040d0,_0x2a06e3){return function(_0x6d6350){if(_0x6d6350){var _0x2ba942=typeof _0x2a06e3[_0xa0f6('0x1e')]==='undefined'&&typeof _0x2a06e3[_0xa0f6('0x1f')]===_0xa0f6('0x20');var _0x812618=_0x6d6350[_0xa0f6('0x21')];var _0x58f548=_0x2ba942?0x0:_0x2a06e3[_0xa0f6('0x1e')];var _0x44e7ab=_0x2ba942?_0x6d6350[_0xa0f6('0x21')]:_0x2a06e3['offset']+_0x2a06e3['limit'];var _0xc0dbb1;if(_0x44e7ab>=_0x812618){_0x44e7ab=_0x812618;_0xc0dbb1=0xc8;}else{_0xc0dbb1=0xce;}_0x5040d0[_0xa0f6('0x1c')](_0xc0dbb1);return _0x5040d0[_0xa0f6('0x22')](_0xa0f6('0x23'),_0x58f548+'-'+_0x44e7ab+'/'+_0x812618)[_0xa0f6('0x1d')](_0x6d6350);}return null;};}function patchUpdates(_0x42cff9){return function(_0x2fc4c0){try{jsonpatch[_0xa0f6('0x24')](_0x2fc4c0,_0x42cff9,!![]);}catch(_0x1603b4){return BPromise['reject'](_0x1603b4);}return _0x2fc4c0[_0xa0f6('0x25')]();};}function saveUpdates(_0xeb6384,_0x47d4b4){return function(_0x30d34c){if(_0x30d34c){return _0x30d34c[_0xa0f6('0x26')](_0xeb6384)[_0xa0f6('0x27')](function(_0x252840){return _0x252840;});}return null;};}function removeEntity(_0x1fded6,_0x365b95){return function(_0x2604ec){if(_0x2604ec){return _0x2604ec[_0xa0f6('0x28')]()[_0xa0f6('0x27')](function(){_0x1fded6[_0xa0f6('0x1c')](0xcc)[_0xa0f6('0x29')]();});}};}function handleEntityNotFound(_0x1a413f,_0xdeb419){return function(_0x47d165){if(!_0x47d165){_0x1a413f[_0xa0f6('0x1b')](0x194);}return _0x47d165;};}function handleError(_0x48adde,_0xcd2c56){_0xcd2c56=_0xcd2c56||0x1f4;return function(_0x129b3e){logger[_0xa0f6('0x2a')](_0x129b3e[_0xa0f6('0x2b')]);if(_0x129b3e['name']){delete _0x129b3e['name'];}_0x48adde['status'](_0xcd2c56)['send'](_0x129b3e);};}exports[_0xa0f6('0x2c')]=function(_0x438905,_0xd13389){var _0x188639={},_0x5644ce={},_0x5715a1={'count':0x0,'rows':[]};var _0x2367cb=_['map'](db[_0xa0f6('0x2d')][_0xa0f6('0x2e')],function(_0x5006da){return{'name':_0x5006da['fieldName'],'type':_0x5006da['type'][_0xa0f6('0x2f')]};});_0x5644ce['model']=_[_0xa0f6('0x30')](_0x2367cb,'name');_0x5644ce[_0xa0f6('0x31')]=_[_0xa0f6('0x32')](_0x438905['query']);_0x5644ce[_0xa0f6('0x33')]=_['intersection'](_0x5644ce[_0xa0f6('0x34')],_0x5644ce['query']);_0x188639['attributes']=_[_0xa0f6('0x35')](_0x5644ce[_0xa0f6('0x34')],qs[_0xa0f6('0x36')](_0x438905[_0xa0f6('0x31')]['fields']));_0x188639[_0xa0f6('0x37')]=_0x188639[_0xa0f6('0x37')][_0xa0f6('0x38')]?_0x188639[_0xa0f6('0x37')]:_0x5644ce['model'];if(!_0x438905['query']['hasOwnProperty'](_0xa0f6('0x39'))){_0x188639[_0xa0f6('0x1f')]=qs[_0xa0f6('0x1f')](_0x438905[_0xa0f6('0x31')][_0xa0f6('0x1f')]);_0x188639[_0xa0f6('0x1e')]=qs[_0xa0f6('0x1e')](_0x438905[_0xa0f6('0x31')][_0xa0f6('0x1e')]);}_0x188639['order']=qs[_0xa0f6('0x3a')](_0x438905[_0xa0f6('0x31')][_0xa0f6('0x3a')]);_0x188639[_0xa0f6('0x3b')]=qs[_0xa0f6('0x33')](_[_0xa0f6('0x3c')](_0x438905[_0xa0f6('0x31')],_0x5644ce['filters']),_0x2367cb);if(_0x438905[_0xa0f6('0x31')][_0xa0f6('0x3d')]){_0x188639[_0xa0f6('0x3b')]=_[_0xa0f6('0x3e')](_0x188639[_0xa0f6('0x3b')],{'$or':_[_0xa0f6('0x30')](_0x2367cb,function(_0xbde94f){if(_0xbde94f[_0xa0f6('0x3f')]!=='VIRTUAL'){var _0x53a5af={};_0x53a5af[_0xbde94f[_0xa0f6('0x40')]]={'$like':'%'+_0x438905['query'][_0xa0f6('0x3d')]+'%'};return _0x53a5af;}})});}_0x188639=_[_0xa0f6('0x3e')]({},_0x188639,_0x438905[_0xa0f6('0x41')]);var _0x40b350={'where':_0x188639[_0xa0f6('0x3b')]};return db[_0xa0f6('0x2d')]['count'](_0x40b350)[_0xa0f6('0x27')](function(_0x1bb6ea){_0x5715a1[_0xa0f6('0x21')]=_0x1bb6ea;if(_0x438905[_0xa0f6('0x31')][_0xa0f6('0x42')]){_0x188639[_0xa0f6('0x43')]=[{'all':!![]}];}return db[_0xa0f6('0x2d')][_0xa0f6('0x44')](_0x188639);})[_0xa0f6('0x27')](function(_0xfdbf7a){_0x5715a1['rows']=_0xfdbf7a;return _0x5715a1;})[_0xa0f6('0x27')](respondWithFilteredResult(_0xd13389,_0x188639))[_0xa0f6('0x45')](handleError(_0xd13389,null));};exports[_0xa0f6('0x46')]=function(_0x4717f7,_0x113c9a){var _0xed6c71={'raw':![],'where':{'id':_0x4717f7[_0xa0f6('0x47')]['id']}},_0x4b7ae1={};_0x4b7ae1['model']=_[_0xa0f6('0x32')](db[_0xa0f6('0x2d')][_0xa0f6('0x2e')]);_0x4b7ae1[_0xa0f6('0x31')]=_[_0xa0f6('0x32')](_0x4717f7['query']);_0x4b7ae1[_0xa0f6('0x33')]=_['intersection'](_0x4b7ae1['model'],_0x4b7ae1[_0xa0f6('0x31')]);_0xed6c71[_0xa0f6('0x37')]=_[_0xa0f6('0x35')](_0x4b7ae1[_0xa0f6('0x34')],qs['fields'](_0x4717f7[_0xa0f6('0x31')][_0xa0f6('0x36')]));_0xed6c71['attributes']=_0xed6c71[_0xa0f6('0x37')]['length']?_0xed6c71[_0xa0f6('0x37')]:_0x4b7ae1[_0xa0f6('0x34')];if(_0x4717f7[_0xa0f6('0x31')][_0xa0f6('0x42')]){_0xed6c71['include']=[{'all':!![]}];}_0xed6c71=_[_0xa0f6('0x3e')]({},_0xed6c71,_0x4717f7[_0xa0f6('0x41')]);return db[_0xa0f6('0x2d')]['find'](_0xed6c71)[_0xa0f6('0x27')](handleEntityNotFound(_0x113c9a,null))[_0xa0f6('0x27')](respondWithResult(_0x113c9a,null))[_0xa0f6('0x45')](handleError(_0x113c9a,null));};exports[_0xa0f6('0x48')]=function(_0x268fb4,_0x1f5fc2){return db[_0xa0f6('0x2d')]['create'](_0x268fb4[_0xa0f6('0x49')],{})[_0xa0f6('0x27')](respondWithResult(_0x1f5fc2,0xc9))['catch'](handleError(_0x1f5fc2,null));};exports[_0xa0f6('0x26')]=function(_0x5eebf3,_0x2121fe){if(_0x5eebf3['body']['id']){delete _0x5eebf3[_0xa0f6('0x49')]['id'];}return db[_0xa0f6('0x2d')]['find']({'where':{'id':_0x5eebf3[_0xa0f6('0x47')]['id']}})['then'](handleEntityNotFound(_0x2121fe,null))[_0xa0f6('0x27')](saveUpdates(_0x5eebf3[_0xa0f6('0x49')],null))[_0xa0f6('0x27')](respondWithResult(_0x2121fe,null))['catch'](handleError(_0x2121fe,null));};exports['destroy']=function(_0x1e19bc,_0x228dad){return db[_0xa0f6('0x2d')]['find']({'where':{'id':_0x1e19bc[_0xa0f6('0x47')]['id']}})[_0xa0f6('0x27')](handleEntityNotFound(_0x228dad,null))[_0xa0f6('0x27')](removeEntity(_0x228dad,null))[_0xa0f6('0x45')](handleError(_0x228dad,null));};exports['getConfigurations']=function(_0x2ac783,_0x50cd0e,_0x5203b9){var _0x476dcf={};var _0x5d0480={};var _0xb1d56f;var _0xd4f99e;return db['DeskAccount'][_0xa0f6('0x4a')]({'where':{'id':_0x2ac783[_0xa0f6('0x47')]['id']}})[_0xa0f6('0x27')](handleEntityNotFound(_0x50cd0e,null))[_0xa0f6('0x27')](function(_0x517d68){if(_0x517d68){_0xb1d56f=_0x517d68;_0x5d0480[_0xa0f6('0x34')]=_['keys'](db[_0xa0f6('0x4b')][_0xa0f6('0x2e')]);_0x5d0480['query']=_['keys'](_0x2ac783[_0xa0f6('0x31')]);_0x5d0480[_0xa0f6('0x33')]=_[_0xa0f6('0x35')](_0x5d0480[_0xa0f6('0x34')],_0x5d0480[_0xa0f6('0x31')]);_0x476dcf[_0xa0f6('0x37')]=_[_0xa0f6('0x35')](_0x5d0480['model'],qs[_0xa0f6('0x36')](_0x2ac783[_0xa0f6('0x31')][_0xa0f6('0x36')]));_0x476dcf['attributes']=_0x476dcf['attributes']['length']?_0x476dcf[_0xa0f6('0x37')]:_0x5d0480['model'];_0x476dcf[_0xa0f6('0x4c')]=qs[_0xa0f6('0x3a')](_0x2ac783['query'][_0xa0f6('0x3a')]);_0x476dcf['where']=qs['filters'](_[_0xa0f6('0x3c')](_0x2ac783[_0xa0f6('0x31')],_0x5d0480[_0xa0f6('0x33')]));if(_0x2ac783['query'][_0xa0f6('0x3d')]){_0x476dcf['where']=_[_0xa0f6('0x3e')](_0x476dcf[_0xa0f6('0x3b')],{'$or':_[_0xa0f6('0x30')](_0x476dcf[_0xa0f6('0x37')],function(_0x487f00){var _0x1304c7={};_0x1304c7[_0x487f00]={'$like':'%'+_0x2ac783[_0xa0f6('0x31')]['filter']+'%'};return _0x1304c7;})});}_0x476dcf=_[_0xa0f6('0x3e')]({},_0x476dcf,_0x2ac783[_0xa0f6('0x41')]);return _0xb1d56f[_0xa0f6('0x4d')](_0x476dcf);}})[_0xa0f6('0x27')](function(_0x2792dd){if(_0x2792dd){_0xd4f99e=_0x2792dd[_0xa0f6('0x38')];if(!_0x2ac783[_0xa0f6('0x31')][_0xa0f6('0x4e')](_0xa0f6('0x39'))){_0x476dcf['limit']=qs[_0xa0f6('0x1f')](_0x2ac783[_0xa0f6('0x31')][_0xa0f6('0x1f')]);_0x476dcf[_0xa0f6('0x1e')]=qs[_0xa0f6('0x1e')](_0x2ac783['query']['offset']);}return _0xb1d56f['getConfigurations'](_0x476dcf);}})[_0xa0f6('0x27')](function(_0x51bb9f){if(_0x51bb9f){return _0x51bb9f?{'count':_0xd4f99e,'rows':_0x51bb9f}:null;}})[_0xa0f6('0x27')](respondWithResult(_0x50cd0e,null))[_0xa0f6('0x45')](handleError(_0x50cd0e,null));};exports['addConfiguration']=function(_0x1246c1,_0x3d98b9,_0x8cfe52){if(_0x1246c1[_0xa0f6('0x49')]['id']){delete _0x1246c1['body']['id'];}return db['DeskAccount']['findOne']({'where':{'id':_0x1246c1[_0xa0f6('0x47')]['id']}})[_0xa0f6('0x27')](handleEntityNotFound(_0x3d98b9,null))[_0xa0f6('0x27')](function(_0x460817){if(_0x460817){_0x1246c1[_0xa0f6('0x49')][_0xa0f6('0x4f')]=_0x460817['id'];_0x1246c1[_0xa0f6('0x49')][_0xa0f6('0x50')]=integrations[_0xa0f6('0x51')](_0x1246c1[_0xa0f6('0x49')][_0xa0f6('0x52')],_0x1246c1[_0xa0f6('0x49')]['type']);_0x1246c1['body'][_0xa0f6('0x53')]=integrations[_0xa0f6('0x54')](_0x1246c1['body'][_0xa0f6('0x52')],_0x1246c1[_0xa0f6('0x49')][_0xa0f6('0x3f')]);return db['DeskConfiguration'][_0xa0f6('0x48')](_0x1246c1[_0xa0f6('0x49')],{'include':[{'model':db[_0xa0f6('0x55')],'as':_0xa0f6('0x50')},{'model':db[_0xa0f6('0x55')],'as':_0xa0f6('0x53')}]});}return null;})[_0xa0f6('0x27')](respondWithResult(_0x3d98b9,null))[_0xa0f6('0x45')](handleError(_0x3d98b9,null));};exports[_0xa0f6('0x56')]=function(_0x382f77,_0x2df25b,_0x3bf7e0){var _0x47281d=[{'name':_0xa0f6('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 _0x4776af='';return db[_0xa0f6('0x2d')][_0xa0f6('0x4a')]({'where':{'id':_0x382f77[_0xa0f6('0x47')]['id']},'attributes':['id',_0xa0f6('0x58'),_0xa0f6('0x59'),_0xa0f6('0x5a'),_0xa0f6('0x5b'),'consumerKey',_0xa0f6('0x5c'),_0xa0f6('0x5d'),_0xa0f6('0x5e')]})[_0xa0f6('0x27')](handleEntityNotFound(_0x2df25b,null))[_0xa0f6('0x27')](function(_0x5d156b){if(_0x5d156b){_0x4776af=_0x5d156b['remoteUri'];var _0xf98070=_0x4776af[_0xa0f6('0x5f')](-0x1);if(_0xf98070==='/'){_0x4776af=_0x4776af[_0xa0f6('0x60')](0x0,_0x4776af[_0xa0f6('0x61')](_0xf98070));}var _0x2f020d={'method':'GET','uri':util[_0xa0f6('0x62')](_0xa0f6('0x63'),_0x4776af),'headers':{'Content-Type':_0xa0f6('0x64'),'Accept':_0xa0f6('0x64')},'json':!![]};if(_0x5d156b[_0xa0f6('0x59')]===_0xa0f6('0x65')){_0x2f020d['headers']['Authorization']=util[_0xa0f6('0x62')](_0xa0f6('0x66'),new Buffer(util['format']('%s:%s',_0x5d156b[_0xa0f6('0x5a')],_0x5d156b['password']))['toString'](_0xa0f6('0x67')));}return rp(_0x2f020d)[_0xa0f6('0x27')](function(_0xcf4d9c){return _0x47281d[_0xa0f6('0x68')](_[_0xa0f6('0x30')](_0xcf4d9c[_0xa0f6('0x69')][_0xa0f6('0x6a')],function(_0x62dac3){return{'id':_0x62dac3[_0xa0f6('0x40')],'name':_0x62dac3['name'],'type':_0x62dac3[_0xa0f6('0x3f')],'active':_0x62dac3['active'],'label':_0x62dac3['label'],'custom':!![]};}));});}})[_0xa0f6('0x27')](function(_0x465bf1){return{'count':_0x465bf1[_0xa0f6('0x38')],'rows':_0x465bf1};})[_0xa0f6('0x27')](respondWithResult(_0x2df25b,null))[_0xa0f6('0x45')](function(_0x26aa46){var _0x2ebe3d=_0x382f77[_0xa0f6('0x31')][_0xa0f6('0x6b')]?0x1f4:_0x26aa46['statusCode']||0x1f4;logger[_0xa0f6('0x2a')](_0xa0f6('0x6c'),_0xa0f6('0x56'),_0x2ebe3d,JSON[_0xa0f6('0x6d')](_0x26aa46));delete _0x26aa46[_0xa0f6('0x40')];if(_0x2ebe3d===0x191){_0x2ebe3d=0x190;}_0x2df25b[_0xa0f6('0x1c')](_0x2ebe3d)[_0xa0f6('0x6e')](_0x382f77['query']['test']?{'message':_0xa0f6('0x6f'),'statusCode':_0x26aa46[_0xa0f6('0x70')]}:_0x26aa46);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index f70e9cb..643812e 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 _0x8632=['request-promise','path','./intDeskAccount.attributes','exports','define','DeskAccount','int_desk_accounts','lodash','../../config/logger','moment','bluebird'];(function(_0x38d4ce,_0x2988dd){var _0x73330e=function(_0x32a14e){while(--_0x32a14e){_0x38d4ce['push'](_0x38d4ce['shift']());}};_0x73330e(++_0x2988dd);}(_0x8632,0x193));var _0x2863=function(_0x47b15f,_0x103e93){_0x47b15f=_0x47b15f-0x0;var _0x55bf25=_0x8632[_0x47b15f];return _0x55bf25;};'use strict';var _=require(_0x2863('0x0'));var util=require('util');var logger=require(_0x2863('0x1'))('api');var moment=require(_0x2863('0x2'));var BPromise=require(_0x2863('0x3'));var rp=require(_0x2863('0x4'));var fs=require('fs');var path=require(_0x2863('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2863('0x6'));var integrations=require('../../components/integrations/configuration');module[_0x2863('0x7')]=function(_0x2b967d,_0x56133e){return _0x2b967d[_0x2863('0x8')](_0x2863('0x9'),attributes,{'tableName':_0x2863('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3b64=['util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports','DeskAccount','lodash'];(function(_0x4644c7,_0x3188a7){var _0x4bfd9e=function(_0x3d4b3a){while(--_0x3d4b3a){_0x4644c7['push'](_0x4644c7['shift']());}};_0x4bfd9e(++_0x3188a7);}(_0x3b64,0x1af));var _0x43b6=function(_0x1b47e4,_0x1666e4){_0x1b47e4=_0x1b47e4-0x0;var _0x217544=_0x3b64[_0x1b47e4];return _0x217544;};'use strict';var _=require(_0x43b6('0x0'));var util=require(_0x43b6('0x1'));var logger=require(_0x43b6('0x2'))('api');var moment=require(_0x43b6('0x3'));var BPromise=require(_0x43b6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x43b6('0x5'));var rimraf=require(_0x43b6('0x6'));var config=require(_0x43b6('0x7'));var attributes=require(_0x43b6('0x8'));var integrations=require(_0x43b6('0x9'));module[_0x43b6('0xa')]=function(_0x46061e,_0xc55a41){return _0x46061e['define'](_0x43b6('0xb'),attributes,{'tableName':'int_desk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.rpc.js b/server/api/intDeskAccount/intDeskAccount.rpc.js index 457021b..62dba84 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 _0x937d=['code','DeskAccount,\x20%s,\x20%s','message','result','GetDeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','catch','ShowDeskAccount','find','lodash','util','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x421b14,_0xee05a0){var _0x4b7b57=function(_0x433da3){while(--_0x433da3){_0x421b14['push'](_0x421b14['shift']());}};_0x4b7b57(++_0xee05a0);}(_0x937d,0x74));var _0xd937=function(_0x92107d,_0x581552){_0x92107d=_0x92107d-0x0;var _0x4cb9d8=_0x937d[_0x92107d];return _0x4cb9d8;};'use strict';var _=require(_0xd937('0x0'));var util=require(_0xd937('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd937('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd937('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd937('0x4'));var config=require(_0xd937('0x5'));var jayson=require(_0xd937('0x6'));var client=jayson['client'][_0xd937('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x170165,_0x363a91,_0x2c82eb){return new BPromise(function(_0x40b034,_0x39e7f6){return client[_0xd937('0x8')](_0x170165,_0x2c82eb)[_0xd937('0x9')](function(_0x39d912){logger[_0xd937('0xa')]('DeskAccount,\x20%s,\x20%s',_0x363a91,_0xd937('0xb'));logger[_0xd937('0xc')](_0xd937('0xd'),_0x363a91,_0xd937('0xb'),JSON[_0xd937('0xe')](_0x39d912));if(_0x39d912[_0xd937('0xf')]){if(_0x39d912['error'][_0xd937('0x10')]===0x1f4){logger[_0xd937('0xf')](_0xd937('0x11'),_0x363a91,_0x39d912['error'][_0xd937('0x12')]);return _0x39e7f6(_0x39d912[_0xd937('0xf')]['message']);}logger[_0xd937('0xf')](_0xd937('0x11'),_0x363a91,_0x39d912['error']['message']);return _0x40b034(_0x39d912[_0xd937('0xf')][_0xd937('0x12')]);}else{logger['info'](_0xd937('0x11'),_0x363a91,_0xd937('0xb'));_0x40b034(_0x39d912[_0xd937('0x13')][_0xd937('0x12')]);}})['catch'](function(_0x3edaf4){logger[_0xd937('0xf')](_0xd937('0x11'),_0x363a91,_0x3edaf4);_0x39e7f6(_0x3edaf4);});});}exports[_0xd937('0x14')]=function(_0x246aa4){var _0x1472b1=this;return new Promise(function(_0xc3c4d7,_0x30060d){return db['DeskAccount'][_0xd937('0x15')]({'raw':_0x246aa4[_0xd937('0x16')]?_0x246aa4[_0xd937('0x16')][_0xd937('0x17')]===undefined?!![]:![]:!![],'where':_0x246aa4[_0xd937('0x16')]?_0x246aa4[_0xd937('0x16')][_0xd937('0x18')]||null:null,'attributes':_0x246aa4['options']?_0x246aa4['options'][_0xd937('0x19')]||null:null,'limit':_0x246aa4['options']?_0x246aa4[_0xd937('0x16')][_0xd937('0x1a')]||null:null,'include':_0x246aa4[_0xd937('0x16')]?_0x246aa4[_0xd937('0x16')][_0xd937('0x1b')]?_[_0xd937('0x1c')](_0x246aa4['options'][_0xd937('0x1b')],function(_0xdb8724){return{'model':db[_0xdb8724[_0xd937('0x1d')]],'as':_0xdb8724['as'],'attributes':_0xdb8724[_0xd937('0x19')],'include':_0xdb8724[_0xd937('0x1b')]?_[_0xd937('0x1c')](_0xdb8724[_0xd937('0x1b')],function(_0xffd629){return{'model':db[_0xffd629['model']],'as':_0xffd629['as'],'attributes':_0xffd629['attributes'],'include':_0xffd629[_0xd937('0x1b')]?_[_0xd937('0x1c')](_0xffd629[_0xd937('0x1b')],function(_0x544ab6){return{'model':db[_0x544ab6['model']],'as':_0x544ab6['as'],'attributes':_0x544ab6[_0xd937('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x54a8ed){logger[_0xd937('0xa')]('GetDeskAccount',_0x246aa4);logger['debug'](_0xd937('0x14'),_0x246aa4,JSON[_0xd937('0xe')](_0x54a8ed));_0xc3c4d7(_0x54a8ed);})[_0xd937('0x1e')](function(_0x2ca83d){logger['error'](_0xd937('0x14'),_0x2ca83d['message'],_0x246aa4);_0x30060d(_0x1472b1[_0xd937('0xf')](0x1f4,_0x2ca83d[_0xd937('0x12')]));});});};exports[_0xd937('0x1f')]=function(_0x23ad83){var _0x1997a4=this;return new Promise(function(_0x3d03d3,_0x59a5cc){return db['DeskAccount'][_0xd937('0x20')]({'raw':_0x23ad83[_0xd937('0x16')]?_0x23ad83[_0xd937('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x23ad83[_0xd937('0x16')]?_0x23ad83[_0xd937('0x16')][_0xd937('0x18')]||null:null,'attributes':_0x23ad83[_0xd937('0x16')]?_0x23ad83[_0xd937('0x16')][_0xd937('0x19')]||null:null,'include':_0x23ad83[_0xd937('0x16')]?_0x23ad83[_0xd937('0x16')]['include']?_[_0xd937('0x1c')](_0x23ad83[_0xd937('0x16')][_0xd937('0x1b')],function(_0x3f7b55){return{'model':db[_0x3f7b55['model']],'as':_0x3f7b55['as'],'attributes':_0x3f7b55[_0xd937('0x19')],'include':_0x3f7b55[_0xd937('0x1b')]?_['map'](_0x3f7b55['include'],function(_0x75ed5b){return{'model':db[_0x75ed5b['model']],'as':_0x75ed5b['as'],'attributes':_0x75ed5b['attributes'],'include':_0x75ed5b[_0xd937('0x1b')]?_[_0xd937('0x1c')](_0x75ed5b[_0xd937('0x1b')],function(_0xff550e){return{'model':db[_0xff550e[_0xd937('0x1d')]],'as':_0xff550e['as'],'attributes':_0xff550e['attributes']};}):[]};}):[]};}):[]:[]})[_0xd937('0x9')](function(_0x490e22){logger[_0xd937('0xa')](_0xd937('0x1f'),_0x23ad83);logger[_0xd937('0xc')](_0xd937('0x1f'),_0x23ad83,JSON['stringify'](_0x490e22));_0x3d03d3(_0x490e22);})['catch'](function(_0x5acfb1){logger[_0xd937('0xf')]('ShowDeskAccount',_0x5acfb1[_0xd937('0x12')],_0x23ad83);_0x59a5cc(_0x1997a4[_0xd937('0xf')](0x1f4,_0x5acfb1[_0xd937('0x12')]));});});}; \ No newline at end of file +var _0x6ded=['debug','DeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetDeskAccount','findAll','options','raw','where','attributes','limit','include','model','stringify','ShowDeskAccount','DeskAccount','find','map','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x28014d,_0x383e2f){var _0x2572cc=function(_0x17aabd){while(--_0x17aabd){_0x28014d['push'](_0x28014d['shift']());}};_0x2572cc(++_0x383e2f);}(_0x6ded,0xff));var _0xd6de=function(_0x506dd1,_0x4532a0){_0x506dd1=_0x506dd1-0x0;var _0x110493=_0x6ded[_0x506dd1];return _0x110493;};'use strict';var _=require(_0xd6de('0x0'));var util=require(_0xd6de('0x1'));var moment=require(_0xd6de('0x2'));var BPromise=require(_0xd6de('0x3'));var rs=require(_0xd6de('0x4'));var fs=require('fs');var Redis=require(_0xd6de('0x5'));var db=require(_0xd6de('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xd6de('0x7'))(_0xd6de('0x8'));var config=require(_0xd6de('0x9'));var jayson=require(_0xd6de('0xa'));var client=jayson[_0xd6de('0xb')][_0xd6de('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xcb3770,_0x10894b,_0x23cb87){return new BPromise(function(_0x111f99,_0x26e6c7){return client[_0xd6de('0xd')](_0xcb3770,_0x23cb87)[_0xd6de('0xe')](function(_0x8378ac){logger[_0xd6de('0xf')](_0xd6de('0x10'),_0x10894b,_0xd6de('0x11'));logger[_0xd6de('0x12')](_0xd6de('0x13'),_0x10894b,_0xd6de('0x11'),JSON['stringify'](_0x8378ac));if(_0x8378ac[_0xd6de('0x14')]){if(_0x8378ac[_0xd6de('0x14')][_0xd6de('0x15')]===0x1f4){logger[_0xd6de('0x14')](_0xd6de('0x10'),_0x10894b,_0x8378ac[_0xd6de('0x14')][_0xd6de('0x16')]);return _0x26e6c7(_0x8378ac[_0xd6de('0x14')]['message']);}logger[_0xd6de('0x14')](_0xd6de('0x10'),_0x10894b,_0x8378ac[_0xd6de('0x14')][_0xd6de('0x16')]);return _0x111f99(_0x8378ac['error'][_0xd6de('0x16')]);}else{logger['info']('DeskAccount,\x20%s,\x20%s',_0x10894b,_0xd6de('0x11'));_0x111f99(_0x8378ac[_0xd6de('0x17')][_0xd6de('0x16')]);}})[_0xd6de('0x18')](function(_0x1ccd73){logger[_0xd6de('0x14')](_0xd6de('0x10'),_0x10894b,_0x1ccd73);_0x26e6c7(_0x1ccd73);});});}exports[_0xd6de('0x19')]=function(_0x5b45a4){var _0x403042=this;return new Promise(function(_0x333fe8,_0x3a0e21){return db['DeskAccount'][_0xd6de('0x1a')]({'raw':_0x5b45a4[_0xd6de('0x1b')]?_0x5b45a4[_0xd6de('0x1b')][_0xd6de('0x1c')]===undefined?!![]:![]:!![],'where':_0x5b45a4[_0xd6de('0x1b')]?_0x5b45a4[_0xd6de('0x1b')][_0xd6de('0x1d')]||null:null,'attributes':_0x5b45a4['options']?_0x5b45a4[_0xd6de('0x1b')][_0xd6de('0x1e')]||null:null,'limit':_0x5b45a4[_0xd6de('0x1b')]?_0x5b45a4[_0xd6de('0x1b')][_0xd6de('0x1f')]||null:null,'include':_0x5b45a4[_0xd6de('0x1b')]?_0x5b45a4[_0xd6de('0x1b')][_0xd6de('0x20')]?_['map'](_0x5b45a4[_0xd6de('0x1b')][_0xd6de('0x20')],function(_0x23b669){return{'model':db[_0x23b669[_0xd6de('0x21')]],'as':_0x23b669['as'],'attributes':_0x23b669[_0xd6de('0x1e')],'include':_0x23b669[_0xd6de('0x20')]?_['map'](_0x23b669[_0xd6de('0x20')],function(_0x23565b){return{'model':db[_0x23565b['model']],'as':_0x23565b['as'],'attributes':_0x23565b['attributes'],'include':_0x23565b[_0xd6de('0x20')]?_['map'](_0x23565b[_0xd6de('0x20')],function(_0xf5b0c5){return{'model':db[_0xf5b0c5[_0xd6de('0x21')]],'as':_0xf5b0c5['as'],'attributes':_0xf5b0c5[_0xd6de('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xd6de('0xe')](function(_0x3eabc7){logger[_0xd6de('0xf')](_0xd6de('0x19'),_0x5b45a4);logger[_0xd6de('0x12')](_0xd6de('0x19'),_0x5b45a4,JSON[_0xd6de('0x22')](_0x3eabc7));_0x333fe8(_0x3eabc7);})[_0xd6de('0x18')](function(_0x3b1a50){logger[_0xd6de('0x14')]('GetDeskAccount',_0x3b1a50[_0xd6de('0x16')],_0x5b45a4);_0x3a0e21(_0x403042[_0xd6de('0x14')](0x1f4,_0x3b1a50[_0xd6de('0x16')]));});});};exports[_0xd6de('0x23')]=function(_0x51a22a){var _0x357fdd=this;return new Promise(function(_0x289b7a,_0x3ee0e3){return db[_0xd6de('0x24')][_0xd6de('0x25')]({'raw':_0x51a22a[_0xd6de('0x1b')]?_0x51a22a[_0xd6de('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x51a22a[_0xd6de('0x1b')]?_0x51a22a[_0xd6de('0x1b')][_0xd6de('0x1d')]||null:null,'attributes':_0x51a22a[_0xd6de('0x1b')]?_0x51a22a[_0xd6de('0x1b')][_0xd6de('0x1e')]||null:null,'include':_0x51a22a[_0xd6de('0x1b')]?_0x51a22a[_0xd6de('0x1b')][_0xd6de('0x20')]?_[_0xd6de('0x26')](_0x51a22a['options'][_0xd6de('0x20')],function(_0x428d54){return{'model':db[_0x428d54[_0xd6de('0x21')]],'as':_0x428d54['as'],'attributes':_0x428d54['attributes'],'include':_0x428d54[_0xd6de('0x20')]?_[_0xd6de('0x26')](_0x428d54[_0xd6de('0x20')],function(_0x1b5579){return{'model':db[_0x1b5579[_0xd6de('0x21')]],'as':_0x1b5579['as'],'attributes':_0x1b5579[_0xd6de('0x1e')],'include':_0x1b5579[_0xd6de('0x20')]?_[_0xd6de('0x26')](_0x1b5579['include'],function(_0xce2f46){return{'model':db[_0xce2f46[_0xd6de('0x21')]],'as':_0xce2f46['as'],'attributes':_0xce2f46['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5d5af8){logger[_0xd6de('0xf')]('ShowDeskAccount',_0x51a22a);logger[_0xd6de('0x12')](_0xd6de('0x23'),_0x51a22a,JSON[_0xd6de('0x22')](_0x5d5af8));_0x289b7a(_0x5d5af8);})['catch'](function(_0x4be772){logger[_0xd6de('0x14')](_0xd6de('0x23'),_0x4be772[_0xd6de('0x16')],_0x51a22a);_0x3ee0e3(_0x357fdd[_0xd6de('0x14')](0x1f4,_0x4be772['message']));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 4e26d3c..e63e626 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(_0x5d00f7,_0x38d2c1){var _0x4b58a2=function(_0x5e12f5){while(--_0x5e12f5){_0x5d00f7['push'](_0x5d00f7['shift']());}};_0x4b58a2(++_0x38d2c1);}(_0x34e8,0x12c));var _0x834e=function(_0x1652fe,_0x489231){_0x1652fe=_0x1652fe-0x0;var _0x49cea1=_0x34e8[_0x1652fe];return _0x49cea1;};'use strict';var multer=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var path=require(_0x834e('0x2'));var timeout=require(_0x834e('0x3'));var express=require('express');var router=express[_0x834e('0x4')]();var fs_extra=require(_0x834e('0x5'));var auth=require(_0x834e('0x6'));var interaction=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var controller=require(_0x834e('0x9'));router[_0x834e('0xa')]('/',auth['isAuthenticated'](),controller[_0x834e('0xb')]);router['get'](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0xe')]);router[_0x834e('0xa')](_0x834e('0xf'),auth[_0x834e('0xd')](),controller[_0x834e('0x10')]);router[_0x834e('0xa')](_0x834e('0x11'),auth[_0x834e('0xd')](),controller[_0x834e('0x12')]);router[_0x834e('0xa')](_0x834e('0x13'),auth[_0x834e('0xd')](),controller[_0x834e('0x14')]);router[_0x834e('0xa')](_0x834e('0x15'),auth['isAuthenticated'](),controller[_0x834e('0x16')]);router[_0x834e('0x17')]('/',auth['isAuthenticated'](),controller[_0x834e('0x18')]);router[_0x834e('0x17')](_0x834e('0x15'),auth[_0x834e('0xd')](),controller['setTags']);router[_0x834e('0x19')](_0x834e('0xc'),auth['isAuthenticated'](),controller[_0x834e('0x1a')]);router['delete'](_0x834e('0xc'),auth[_0x834e('0xd')](),controller['destroy']);module[_0x834e('0x1b')]=router; \ No newline at end of file +var _0x008c=['../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','getFields','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','setTags','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x5bb4cb,_0x4b9b79){var _0x1d7aee=function(_0x17ffaa){while(--_0x17ffaa){_0x5bb4cb['push'](_0x5bb4cb['shift']());}};_0x1d7aee(++_0x4b9b79);}(_0x008c,0x188));var _0xc008=function(_0x4b8212,_0x37d755){_0x4b8212=_0x4b8212-0x0;var _0x54de6e=_0x008c[_0x4b8212];return _0x54de6e;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/:id',auth[_0xc008('0xb')](),controller['show']);router[_0xc008('0xa')]('/:id/fields',auth['isAuthenticated'](),controller[_0xc008('0xd')]);router[_0xc008('0xa')]('/:id/subjects',auth['isAuthenticated'](),controller['getSubjects']);router[_0xc008('0xa')](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0xf')]);router[_0xc008('0xa')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x11')]);router[_0xc008('0x12')]('/',auth[_0xc008('0xb')](),controller['create']);router['post'](_0xc008('0x10'),auth['isAuthenticated'](),controller[_0xc008('0x13')]);router[_0xc008('0x14')](_0xc008('0x15'),auth[_0xc008('0xb')](),controller[_0xc008('0x16')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xc008('0x17')]);module[_0xc008('0x18')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index 9ee48ad..be3cd27 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 _0xe848=['sequelize','exports','STRING'];(function(_0x5058eb,_0x3e6668){var _0x1a6fb2=function(_0x2de6bd){while(--_0x2de6bd){_0x5058eb['push'](_0x5058eb['shift']());}};_0x1a6fb2(++_0x3e6668);}(_0xe848,0x1c5));var _0x8e84=function(_0x3b52f8,_0x8ffcc9){_0x3b52f8=_0x3b52f8-0x0;var _0x55e0b3=_0xe848[_0x3b52f8];return _0x55e0b3;};'use strict';var Sequelize=require(_0x8e84('0x0'));module[_0x8e84('0x1')]={'name':{'type':Sequelize[_0x8e84('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9ff1=['sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9ff1,0x180));var _0x19ff=function(_0x1f73e6,_0x3e8e99){_0x1f73e6=_0x1f73e6-0x0;var _0x33b417=_0x9ff1[_0x1f73e6];return _0x33b417;};'use strict';var Sequelize=require(_0x19ff('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 3b0761b..b18c564 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 _0x6112=['include','findAll','rows','catch','show','params','options','find','create','body','getFields','getSubjects','findOne','DeskField','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','fs-extra','squel','jsforce','querystring','ioredis','../../components/auth/service','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','index','map','DeskConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll'];(function(_0x5a3cfe,_0x100847){var _0x5960d5=function(_0x2728fc){while(--_0x2728fc){_0x5a3cfe['push'](_0x5a3cfe['shift']());}};_0x5960d5(++_0x100847);}(_0x6112,0x153));var _0x2611=function(_0xb5ba89,_0x15691a){_0xb5ba89=_0xb5ba89-0x0;var _0x52a19a=_0x6112[_0xb5ba89];return _0x52a19a;};'use strict';var emlformat=require(_0x2611('0x0'));var rimraf=require(_0x2611('0x1'));var zipdir=require(_0x2611('0x2'));var jsonpatch=require(_0x2611('0x3'));var rp=require(_0x2611('0x4'));var moment=require('moment');var BPromise=require(_0x2611('0x5'));var Mustache=require(_0x2611('0x6'));var util=require('util');var path=require('path');var sox=require(_0x2611('0x7'));var csv=require(_0x2611('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2611('0x9'));var _=require('lodash');var squel=require(_0x2611('0xa'));var crypto=require('crypto');var jsforce=require(_0x2611('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x2611('0x8'));var querystring=require(_0x2611('0xc'));var Papa=require('papaparse');var Redis=require(_0x2611('0xd'));var authService=require(_0x2611('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x2611('0xf'))('api');var utils=require('../../config/utils');var config=require(_0x2611('0x10'));var licenseUtil=require(_0x2611('0x11'));var db=require(_0x2611('0x12'))['db'];function respondWithStatusCode(_0x351d30,_0x585af4){_0x585af4=_0x585af4||0xcc;return function(_0x457749){if(_0x457749){return _0x351d30[_0x2611('0x13')](_0x585af4);}return _0x351d30['status'](_0x585af4)['end']();};}function respondWithResult(_0x575e1,_0x5a3a4b){_0x5a3a4b=_0x5a3a4b||0xc8;return function(_0x149bf1){if(_0x149bf1){return _0x575e1[_0x2611('0x14')](_0x5a3a4b)[_0x2611('0x15')](_0x149bf1);}};}function respondWithFilteredResult(_0x4a06ca,_0x1f2f31){return function(_0x341b5f){if(_0x341b5f){var _0x519485=typeof _0x1f2f31[_0x2611('0x16')]===_0x2611('0x17')&&typeof _0x1f2f31['limit']==='undefined';var _0x1e6141=_0x341b5f[_0x2611('0x18')];var _0x2c8835=_0x519485?0x0:_0x1f2f31[_0x2611('0x16')];var _0x281090=_0x519485?_0x341b5f[_0x2611('0x18')]:_0x1f2f31[_0x2611('0x16')]+_0x1f2f31['limit'];var _0x194daa;if(_0x281090>=_0x1e6141){_0x281090=_0x1e6141;_0x194daa=0xc8;}else{_0x194daa=0xce;}_0x4a06ca[_0x2611('0x14')](_0x194daa);return _0x4a06ca[_0x2611('0x19')](_0x2611('0x1a'),_0x2c8835+'-'+_0x281090+'/'+_0x1e6141)[_0x2611('0x15')](_0x341b5f);}return null;};}function patchUpdates(_0x2d4885){return function(_0x5aa716){try{jsonpatch[_0x2611('0x1b')](_0x5aa716,_0x2d4885,!![]);}catch(_0x4f2e9d){return BPromise[_0x2611('0x1c')](_0x4f2e9d);}return _0x5aa716[_0x2611('0x1d')]();};}function saveUpdates(_0x4547bb,_0x411098){return function(_0x1226d0){if(_0x1226d0){return _0x1226d0[_0x2611('0x1e')](_0x4547bb)[_0x2611('0x1f')](function(_0x1a739f){return _0x1a739f;});}return null;};}function removeEntity(_0x4f3710,_0x4d4bf0){return function(_0x36a58c){if(_0x36a58c){return _0x36a58c[_0x2611('0x20')]()['then'](function(){_0x4f3710[_0x2611('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1a6a49,_0x151370){return function(_0x4909ca){if(!_0x4909ca){_0x1a6a49[_0x2611('0x13')](0x194);}return _0x4909ca;};}function handleError(_0x2f1fe2,_0x1fcb52){_0x1fcb52=_0x1fcb52||0x1f4;return function(_0x5958a4){logger['error'](_0x5958a4[_0x2611('0x21')]);if(_0x5958a4['name']){delete _0x5958a4[_0x2611('0x22')];}_0x2f1fe2[_0x2611('0x14')](_0x1fcb52)['send'](_0x5958a4);};}exports[_0x2611('0x23')]=function(_0x43337d,_0x245b90){var _0x1cb75d={},_0x36ef82={},_0x22ca6d={'count':0x0,'rows':[]};var _0x534e18=_[_0x2611('0x24')](db[_0x2611('0x25')][_0x2611('0x26')],function(_0x19b712){return{'name':_0x19b712[_0x2611('0x27')],'type':_0x19b712[_0x2611('0x28')][_0x2611('0x29')]};});_0x36ef82[_0x2611('0x2a')]=_[_0x2611('0x24')](_0x534e18,_0x2611('0x22'));_0x36ef82[_0x2611('0x2b')]=_[_0x2611('0x2c')](_0x43337d[_0x2611('0x2b')]);_0x36ef82[_0x2611('0x2d')]=_[_0x2611('0x2e')](_0x36ef82[_0x2611('0x2a')],_0x36ef82['query']);_0x1cb75d[_0x2611('0x2f')]=_[_0x2611('0x2e')](_0x36ef82[_0x2611('0x2a')],qs[_0x2611('0x30')](_0x43337d['query']['fields']));_0x1cb75d[_0x2611('0x2f')]=_0x1cb75d[_0x2611('0x2f')][_0x2611('0x31')]?_0x1cb75d[_0x2611('0x2f')]:_0x36ef82[_0x2611('0x2a')];if(!_0x43337d[_0x2611('0x2b')][_0x2611('0x32')](_0x2611('0x33'))){_0x1cb75d[_0x2611('0x34')]=qs['limit'](_0x43337d[_0x2611('0x2b')]['limit']);_0x1cb75d['offset']=qs[_0x2611('0x16')](_0x43337d[_0x2611('0x2b')]['offset']);}_0x1cb75d[_0x2611('0x35')]=qs[_0x2611('0x36')](_0x43337d['query']['sort']);_0x1cb75d[_0x2611('0x37')]=qs[_0x2611('0x2d')](_[_0x2611('0x38')](_0x43337d[_0x2611('0x2b')],_0x36ef82[_0x2611('0x2d')]),_0x534e18);if(_0x43337d[_0x2611('0x2b')]['filter']){_0x1cb75d[_0x2611('0x37')]=_[_0x2611('0x39')](_0x1cb75d['where'],{'$or':_[_0x2611('0x24')](_0x534e18,function(_0x2d85e9){if(_0x2d85e9[_0x2611('0x28')]!==_0x2611('0x3a')){var _0x3a3cfe={};_0x3a3cfe[_0x2d85e9[_0x2611('0x22')]]={'$like':'%'+_0x43337d['query'][_0x2611('0x3b')]+'%'};return _0x3a3cfe;}})});}_0x1cb75d=_[_0x2611('0x39')]({},_0x1cb75d,_0x43337d['options']);var _0x4f6a2e={'where':_0x1cb75d[_0x2611('0x37')]};return db[_0x2611('0x25')][_0x2611('0x18')](_0x4f6a2e)[_0x2611('0x1f')](function(_0x3ed951){_0x22ca6d['count']=_0x3ed951;if(_0x43337d[_0x2611('0x2b')][_0x2611('0x3c')]){_0x1cb75d[_0x2611('0x3d')]=[{'all':!![]}];}return db[_0x2611('0x25')][_0x2611('0x3e')](_0x1cb75d);})[_0x2611('0x1f')](function(_0x22271d){_0x22ca6d[_0x2611('0x3f')]=_0x22271d;return _0x22ca6d;})[_0x2611('0x1f')](respondWithFilteredResult(_0x245b90,_0x1cb75d))[_0x2611('0x40')](handleError(_0x245b90,null));};exports[_0x2611('0x41')]=function(_0x5b155e,_0x4d3e43){var _0x3a4c00={'raw':![],'where':{'id':_0x5b155e[_0x2611('0x42')]['id']}},_0x516b36={};_0x516b36['model']=_[_0x2611('0x2c')](db['DeskConfiguration'][_0x2611('0x26')]);_0x516b36[_0x2611('0x2b')]=_[_0x2611('0x2c')](_0x5b155e[_0x2611('0x2b')]);_0x516b36['filters']=_[_0x2611('0x2e')](_0x516b36[_0x2611('0x2a')],_0x516b36[_0x2611('0x2b')]);_0x3a4c00[_0x2611('0x2f')]=_[_0x2611('0x2e')](_0x516b36[_0x2611('0x2a')],qs[_0x2611('0x30')](_0x5b155e[_0x2611('0x2b')]['fields']));_0x3a4c00[_0x2611('0x2f')]=_0x3a4c00['attributes'][_0x2611('0x31')]?_0x3a4c00[_0x2611('0x2f')]:_0x516b36[_0x2611('0x2a')];if(_0x5b155e[_0x2611('0x2b')]['includeAll']){_0x3a4c00['include']=[{'all':!![]}];}_0x3a4c00=_['merge']({},_0x3a4c00,_0x5b155e[_0x2611('0x43')]);return db[_0x2611('0x25')][_0x2611('0x44')](_0x3a4c00)[_0x2611('0x1f')](handleEntityNotFound(_0x4d3e43,null))[_0x2611('0x1f')](respondWithResult(_0x4d3e43,null))[_0x2611('0x40')](handleError(_0x4d3e43,null));};exports['create']=function(_0xdbc3bf,_0x10ba5a){return db[_0x2611('0x25')][_0x2611('0x45')](_0xdbc3bf[_0x2611('0x46')],{})[_0x2611('0x1f')](respondWithResult(_0x10ba5a,0xc9))[_0x2611('0x40')](handleError(_0x10ba5a,null));};exports[_0x2611('0x1e')]=function(_0x318a9a,_0xda0843){if(_0x318a9a[_0x2611('0x46')]['id']){delete _0x318a9a[_0x2611('0x46')]['id'];}return db[_0x2611('0x25')][_0x2611('0x44')]({'where':{'id':_0x318a9a[_0x2611('0x42')]['id']}})[_0x2611('0x1f')](handleEntityNotFound(_0xda0843,null))[_0x2611('0x1f')](saveUpdates(_0x318a9a['body'],null))[_0x2611('0x1f')](respondWithResult(_0xda0843,null))['catch'](handleError(_0xda0843,null));};exports[_0x2611('0x20')]=function(_0x1b4321,_0x416256){return db['DeskConfiguration']['find']({'where':{'id':_0x1b4321[_0x2611('0x42')]['id']}})[_0x2611('0x1f')](handleEntityNotFound(_0x416256,null))[_0x2611('0x1f')](removeEntity(_0x416256,null))[_0x2611('0x40')](handleError(_0x416256,null));};exports[_0x2611('0x47')]=function(_0x1d8ea3,_0x31c0ed,_0x24846e){var _0x3b4869={};var _0x42cde0={};var _0x499a33;var _0x162109;return db['DeskConfiguration']['findOne']({'where':{'id':_0x1d8ea3[_0x2611('0x42')]['id']}})[_0x2611('0x1f')](handleEntityNotFound(_0x31c0ed,null))[_0x2611('0x1f')](function(_0x28d04e){if(_0x28d04e){_0x499a33=_0x28d04e;_0x42cde0[_0x2611('0x2a')]=_[_0x2611('0x2c')](db['DeskField']['rawAttributes']);_0x42cde0[_0x2611('0x2b')]=_[_0x2611('0x2c')](_0x1d8ea3[_0x2611('0x2b')]);_0x42cde0['filters']=_[_0x2611('0x2e')](_0x42cde0[_0x2611('0x2a')],_0x42cde0[_0x2611('0x2b')]);_0x3b4869['attributes']=_[_0x2611('0x2e')](_0x42cde0[_0x2611('0x2a')],qs[_0x2611('0x30')](_0x1d8ea3[_0x2611('0x2b')][_0x2611('0x30')]));_0x3b4869[_0x2611('0x2f')]=_0x3b4869['attributes'][_0x2611('0x31')]?_0x3b4869[_0x2611('0x2f')]:_0x42cde0[_0x2611('0x2a')];_0x3b4869[_0x2611('0x35')]=qs['sort'](_0x1d8ea3[_0x2611('0x2b')]['sort']);_0x3b4869[_0x2611('0x37')]=qs['filters'](_[_0x2611('0x38')](_0x1d8ea3['query'],_0x42cde0['filters']));if(_0x1d8ea3['query'][_0x2611('0x3b')]){_0x3b4869[_0x2611('0x37')]=_['merge'](_0x3b4869[_0x2611('0x37')],{'$or':_[_0x2611('0x24')](_0x3b4869[_0x2611('0x2f')],function(_0x2a151e){var _0x5d9ec8={};_0x5d9ec8[_0x2a151e]={'$like':'%'+_0x1d8ea3[_0x2611('0x2b')][_0x2611('0x3b')]+'%'};return _0x5d9ec8;})});}_0x3b4869=_[_0x2611('0x39')]({},_0x3b4869,_0x1d8ea3['options']);return _0x499a33['getFields'](_0x3b4869);}})[_0x2611('0x1f')](function(_0x3d4707){if(_0x3d4707){_0x162109=_0x3d4707[_0x2611('0x31')];if(!_0x1d8ea3[_0x2611('0x2b')]['hasOwnProperty'](_0x2611('0x33'))){_0x3b4869[_0x2611('0x34')]=qs[_0x2611('0x34')](_0x1d8ea3['query'][_0x2611('0x34')]);_0x3b4869['offset']=qs[_0x2611('0x16')](_0x1d8ea3['query'][_0x2611('0x16')]);}return _0x499a33['getFields'](_0x3b4869);}})['then'](function(_0x39c77d){if(_0x39c77d){return _0x39c77d?{'count':_0x162109,'rows':_0x39c77d}:null;}})[_0x2611('0x1f')](respondWithResult(_0x31c0ed,null))[_0x2611('0x40')](handleError(_0x31c0ed,null));};exports[_0x2611('0x48')]=function(_0x5d12a0,_0x1dc43f,_0x5a732a){var _0x2c229e={};var _0x245016={};var _0x39018b;var _0x1f56c6;return db[_0x2611('0x25')][_0x2611('0x49')]({'where':{'id':_0x5d12a0['params']['id']}})[_0x2611('0x1f')](handleEntityNotFound(_0x1dc43f,null))[_0x2611('0x1f')](function(_0x58d4a6){if(_0x58d4a6){_0x39018b=_0x58d4a6;_0x245016[_0x2611('0x2a')]=_[_0x2611('0x2c')](db[_0x2611('0x4a')][_0x2611('0x26')]);_0x245016[_0x2611('0x2b')]=_[_0x2611('0x2c')](_0x5d12a0[_0x2611('0x2b')]);_0x245016[_0x2611('0x2d')]=_['intersection'](_0x245016[_0x2611('0x2a')],_0x245016[_0x2611('0x2b')]);_0x2c229e[_0x2611('0x2f')]=_[_0x2611('0x2e')](_0x245016['model'],qs[_0x2611('0x30')](_0x5d12a0[_0x2611('0x2b')][_0x2611('0x30')]));_0x2c229e[_0x2611('0x2f')]=_0x2c229e[_0x2611('0x2f')][_0x2611('0x31')]?_0x2c229e[_0x2611('0x2f')]:_0x245016['model'];_0x2c229e[_0x2611('0x35')]=qs[_0x2611('0x36')](_0x5d12a0['query'][_0x2611('0x36')]);_0x2c229e[_0x2611('0x37')]=qs[_0x2611('0x2d')](_['pick'](_0x5d12a0[_0x2611('0x2b')],_0x245016[_0x2611('0x2d')]));if(_0x5d12a0[_0x2611('0x2b')]['filter']){_0x2c229e[_0x2611('0x37')]=_[_0x2611('0x39')](_0x2c229e['where'],{'$or':_[_0x2611('0x24')](_0x2c229e[_0x2611('0x2f')],function(_0x4341fd){var _0x2774aa={};_0x2774aa[_0x4341fd]={'$like':'%'+_0x5d12a0[_0x2611('0x2b')][_0x2611('0x3b')]+'%'};return _0x2774aa;})});}_0x2c229e=_[_0x2611('0x39')]({},_0x2c229e,_0x5d12a0[_0x2611('0x43')]);return _0x39018b[_0x2611('0x48')](_0x2c229e);}})[_0x2611('0x1f')](function(_0x3bed8e){if(_0x3bed8e){_0x1f56c6=_0x3bed8e[_0x2611('0x31')];if(!_0x5d12a0[_0x2611('0x2b')][_0x2611('0x32')](_0x2611('0x33'))){_0x2c229e[_0x2611('0x34')]=qs['limit'](_0x5d12a0[_0x2611('0x2b')][_0x2611('0x34')]);_0x2c229e[_0x2611('0x16')]=qs[_0x2611('0x16')](_0x5d12a0[_0x2611('0x2b')][_0x2611('0x16')]);}return _0x39018b['getSubjects'](_0x2c229e);}})[_0x2611('0x1f')](function(_0x3c01e8){if(_0x3c01e8){return _0x3c01e8?{'count':_0x1f56c6,'rows':_0x3c01e8}:null;}})[_0x2611('0x1f')](respondWithResult(_0x1dc43f,null))['catch'](handleError(_0x1dc43f,null));};exports[_0x2611('0x4b')]=function(_0x19fcdd,_0x3cfeb2,_0x52fe45){var _0x50a4fc={};var _0x339816={};var _0x3bab45;var _0x10197c;return db[_0x2611('0x25')][_0x2611('0x49')]({'where':{'id':_0x19fcdd['params']['id']}})['then'](handleEntityNotFound(_0x3cfeb2,null))['then'](function(_0xfb2efd){if(_0xfb2efd){_0x3bab45=_0xfb2efd;_0x339816[_0x2611('0x2a')]=_[_0x2611('0x2c')](db[_0x2611('0x4a')][_0x2611('0x26')]);_0x339816[_0x2611('0x2b')]=_[_0x2611('0x2c')](_0x19fcdd[_0x2611('0x2b')]);_0x339816[_0x2611('0x2d')]=_['intersection'](_0x339816[_0x2611('0x2a')],_0x339816[_0x2611('0x2b')]);_0x50a4fc[_0x2611('0x2f')]=_[_0x2611('0x2e')](_0x339816[_0x2611('0x2a')],qs['fields'](_0x19fcdd[_0x2611('0x2b')][_0x2611('0x30')]));_0x50a4fc[_0x2611('0x2f')]=_0x50a4fc[_0x2611('0x2f')]['length']?_0x50a4fc[_0x2611('0x2f')]:_0x339816[_0x2611('0x2a')];_0x50a4fc[_0x2611('0x35')]=qs[_0x2611('0x36')](_0x19fcdd[_0x2611('0x2b')][_0x2611('0x36')]);_0x50a4fc[_0x2611('0x37')]=qs[_0x2611('0x2d')](_[_0x2611('0x38')](_0x19fcdd['query'],_0x339816[_0x2611('0x2d')]));if(_0x19fcdd[_0x2611('0x2b')][_0x2611('0x3b')]){_0x50a4fc[_0x2611('0x37')]=_[_0x2611('0x39')](_0x50a4fc[_0x2611('0x37')],{'$or':_[_0x2611('0x24')](_0x50a4fc[_0x2611('0x2f')],function(_0x2ad777){var _0x8b8342={};_0x8b8342[_0x2ad777]={'$like':'%'+_0x19fcdd[_0x2611('0x2b')][_0x2611('0x3b')]+'%'};return _0x8b8342;})});}_0x50a4fc=_[_0x2611('0x39')]({},_0x50a4fc,_0x19fcdd['options']);return _0x3bab45[_0x2611('0x4b')](_0x50a4fc);}})[_0x2611('0x1f')](function(_0x249c87){if(_0x249c87){_0x10197c=_0x249c87['length'];if(!_0x19fcdd[_0x2611('0x2b')][_0x2611('0x32')](_0x2611('0x33'))){_0x50a4fc['limit']=qs[_0x2611('0x34')](_0x19fcdd[_0x2611('0x2b')][_0x2611('0x34')]);_0x50a4fc[_0x2611('0x16')]=qs['offset'](_0x19fcdd[_0x2611('0x2b')][_0x2611('0x16')]);}return _0x3bab45[_0x2611('0x4b')](_0x50a4fc);}})[_0x2611('0x1f')](function(_0x131ae5){if(_0x131ae5){return _0x131ae5?{'count':_0x10197c,'rows':_0x131ae5}:null;}})[_0x2611('0x1f')](respondWithResult(_0x3cfeb2,null))['catch'](handleError(_0x3cfeb2,null));};exports[_0x2611('0x4c')]=function(_0x39a3d2,_0x2c0525,_0x3d0c3f){var _0x42a792={};var _0x2a50d1={};var _0x56f7ec;var _0x571c29;return db[_0x2611('0x25')][_0x2611('0x49')]({'where':{'id':_0x39a3d2[_0x2611('0x42')]['id']}})[_0x2611('0x1f')](handleEntityNotFound(_0x2c0525,null))[_0x2611('0x1f')](function(_0x4f00ec){if(_0x4f00ec){_0x56f7ec=_0x4f00ec;_0x2a50d1[_0x2611('0x2a')]=_[_0x2611('0x2c')](db[_0x2611('0x4d')][_0x2611('0x26')]);_0x2a50d1[_0x2611('0x2b')]=_[_0x2611('0x2c')](_0x39a3d2[_0x2611('0x2b')]);_0x2a50d1[_0x2611('0x2d')]=_[_0x2611('0x2e')](_0x2a50d1[_0x2611('0x2a')],_0x2a50d1[_0x2611('0x2b')]);_0x42a792['attributes']=_[_0x2611('0x2e')](_0x2a50d1[_0x2611('0x2a')],qs[_0x2611('0x30')](_0x39a3d2[_0x2611('0x2b')][_0x2611('0x30')]));_0x42a792['attributes']=_0x42a792[_0x2611('0x2f')][_0x2611('0x31')]?_0x42a792[_0x2611('0x2f')]:_0x2a50d1[_0x2611('0x2a')];_0x42a792[_0x2611('0x35')]=qs[_0x2611('0x36')](_0x39a3d2[_0x2611('0x2b')][_0x2611('0x36')]);_0x42a792[_0x2611('0x37')]=qs[_0x2611('0x2d')](_[_0x2611('0x38')](_0x39a3d2[_0x2611('0x2b')],_0x2a50d1['filters']));if(_0x39a3d2[_0x2611('0x2b')][_0x2611('0x3b')]){_0x42a792[_0x2611('0x37')]=_[_0x2611('0x39')](_0x42a792[_0x2611('0x37')],{'$or':_[_0x2611('0x24')](_0x42a792[_0x2611('0x2f')],function(_0x5a00a7){var _0x2b6be4={};_0x2b6be4[_0x5a00a7]={'$like':'%'+_0x39a3d2[_0x2611('0x2b')][_0x2611('0x3b')]+'%'};return _0x2b6be4;})});}_0x42a792=_[_0x2611('0x39')]({},_0x42a792,_0x39a3d2[_0x2611('0x43')]);return _0x56f7ec[_0x2611('0x4c')](_0x42a792);}})[_0x2611('0x1f')](function(_0x44254e){if(_0x44254e){_0x571c29=_0x44254e[_0x2611('0x31')];if(!_0x39a3d2['query'][_0x2611('0x32')]('nolimit')){_0x42a792[_0x2611('0x34')]=qs['limit'](_0x39a3d2[_0x2611('0x2b')][_0x2611('0x34')]);_0x42a792['offset']=qs[_0x2611('0x16')](_0x39a3d2['query'][_0x2611('0x16')]);}return _0x56f7ec['getTags'](_0x42a792);}})[_0x2611('0x1f')](function(_0xf92eb5){if(_0xf92eb5){return _0xf92eb5?{'count':_0x571c29,'rows':_0xf92eb5}:null;}})[_0x2611('0x1f')](respondWithResult(_0x2c0525,null))[_0x2611('0x40')](handleError(_0x2c0525,null));};exports[_0x2611('0x4e')]=function(_0x24d929,_0x392c4e,_0x1628f3){if(_0x24d929['body']['id']){delete _0x24d929[_0x2611('0x46')]['id'];}return db[_0x2611('0x25')][_0x2611('0x49')]({'where':{'id':_0x24d929[_0x2611('0x42')]['id']}})[_0x2611('0x1f')](handleEntityNotFound(_0x392c4e,null))['then'](function(_0x2e4620){if(_0x2e4620){return _0x2e4620[_0x2611('0x4e')](_0x24d929[_0x2611('0x46')][_0x2611('0x4f')]||[]);}return null;})[_0x2611('0x1f')](respondWithResult(_0x392c4e,null))[_0x2611('0x40')](handleError(_0x392c4e,null));}; \ No newline at end of file +var _0x23b4=['getTags','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','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/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','destroy','error','stack','name','send','map','DeskConfiguration','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','params','find','create','update','body','DeskField','order','pick','getFields','getSubjects','findOne','getDescriptions'];(function(_0x23f877,_0x3494f3){var _0x39f573=function(_0x16b815){while(--_0x16b815){_0x23f877['push'](_0x23f877['shift']());}};_0x39f573(++_0x3494f3);}(_0x23b4,0x1ac));var _0x423b=function(_0xac151d,_0x4ea1d2){_0xac151d=_0xac151d-0x0;var _0x111dba=_0x23b4[_0xac151d];return _0x111dba;};'use strict';var emlformat=require(_0x423b('0x0'));var rimraf=require(_0x423b('0x1'));var zipdir=require(_0x423b('0x2'));var jsonpatch=require(_0x423b('0x3'));var rp=require(_0x423b('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x423b('0x5'));var util=require(_0x423b('0x6'));var path=require('path');var sox=require(_0x423b('0x7'));var csv=require(_0x423b('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x423b('0x9'));var _=require('lodash');var squel=require(_0x423b('0xa'));var crypto=require(_0x423b('0xb'));var jsforce=require(_0x423b('0xc'));var deskjs=require(_0x423b('0xd'));var toCsv=require(_0x423b('0x8'));var querystring=require(_0x423b('0xe'));var Papa=require(_0x423b('0xf'));var Redis=require(_0x423b('0x10'));var authService=require(_0x423b('0x11'));var qs=require(_0x423b('0x12'));var as=require(_0x423b('0x13'));var hardwareService=require(_0x423b('0x14'));var logger=require(_0x423b('0x15'))(_0x423b('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x423b('0x17'));var db=require(_0x423b('0x18'))['db'];function respondWithStatusCode(_0x347429,_0x38e782){_0x38e782=_0x38e782||0xcc;return function(_0x6c392a){if(_0x6c392a){return _0x347429[_0x423b('0x19')](_0x38e782);}return _0x347429[_0x423b('0x1a')](_0x38e782)[_0x423b('0x1b')]();};}function respondWithResult(_0x1b059f,_0x1ced6d){_0x1ced6d=_0x1ced6d||0xc8;return function(_0x329a47){if(_0x329a47){return _0x1b059f['status'](_0x1ced6d)[_0x423b('0x1c')](_0x329a47);}};}function respondWithFilteredResult(_0x583945,_0x5cf3c5){return function(_0xea0e6b){if(_0xea0e6b){var _0x4980ea=typeof _0x5cf3c5[_0x423b('0x1d')]===_0x423b('0x1e')&&typeof _0x5cf3c5[_0x423b('0x1f')]===_0x423b('0x1e');var _0x35a8d0=_0xea0e6b[_0x423b('0x20')];var _0xc02890=_0x4980ea?0x0:_0x5cf3c5['offset'];var _0x5e76d2=_0x4980ea?_0xea0e6b[_0x423b('0x20')]:_0x5cf3c5[_0x423b('0x1d')]+_0x5cf3c5[_0x423b('0x1f')];var _0x44b2e0;if(_0x5e76d2>=_0x35a8d0){_0x5e76d2=_0x35a8d0;_0x44b2e0=0xc8;}else{_0x44b2e0=0xce;}_0x583945[_0x423b('0x1a')](_0x44b2e0);return _0x583945[_0x423b('0x21')](_0x423b('0x22'),_0xc02890+'-'+_0x5e76d2+'/'+_0x35a8d0)[_0x423b('0x1c')](_0xea0e6b);}return null;};}function patchUpdates(_0x1a1f53){return function(_0x2faa7f){try{jsonpatch['apply'](_0x2faa7f,_0x1a1f53,!![]);}catch(_0x257f43){return BPromise[_0x423b('0x23')](_0x257f43);}return _0x2faa7f[_0x423b('0x24')]();};}function saveUpdates(_0x31d790,_0xbac8c8){return function(_0x4757a1){if(_0x4757a1){return _0x4757a1['update'](_0x31d790)[_0x423b('0x25')](function(_0x22375f){return _0x22375f;});}return null;};}function removeEntity(_0xcd5897,_0x4bbfc0){return function(_0x184a9f){if(_0x184a9f){return _0x184a9f[_0x423b('0x26')]()[_0x423b('0x25')](function(){_0xcd5897[_0x423b('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3b2fb8,_0x2dd57e){return function(_0x42962f){if(!_0x42962f){_0x3b2fb8[_0x423b('0x19')](0x194);}return _0x42962f;};}function handleError(_0x126c05,_0x4dc378){_0x4dc378=_0x4dc378||0x1f4;return function(_0x3605cd){logger[_0x423b('0x27')](_0x3605cd[_0x423b('0x28')]);if(_0x3605cd[_0x423b('0x29')]){delete _0x3605cd['name'];}_0x126c05[_0x423b('0x1a')](_0x4dc378)[_0x423b('0x2a')](_0x3605cd);};}exports['index']=function(_0x3a1c24,_0x4d7f8e){var _0x63d44c={},_0x1765d7={},_0x1a97ae={'count':0x0,'rows':[]};var _0x1dcf1c=_[_0x423b('0x2b')](db[_0x423b('0x2c')][_0x423b('0x2d')],function(_0x5835b7){return{'name':_0x5835b7[_0x423b('0x2e')],'type':_0x5835b7[_0x423b('0x2f')][_0x423b('0x30')]};});_0x1765d7['model']=_[_0x423b('0x2b')](_0x1dcf1c,_0x423b('0x29'));_0x1765d7[_0x423b('0x31')]=_[_0x423b('0x32')](_0x3a1c24['query']);_0x1765d7[_0x423b('0x33')]=_[_0x423b('0x34')](_0x1765d7[_0x423b('0x35')],_0x1765d7[_0x423b('0x31')]);_0x63d44c[_0x423b('0x36')]=_[_0x423b('0x34')](_0x1765d7[_0x423b('0x35')],qs['fields'](_0x3a1c24['query'][_0x423b('0x37')]));_0x63d44c['attributes']=_0x63d44c['attributes'][_0x423b('0x38')]?_0x63d44c[_0x423b('0x36')]:_0x1765d7[_0x423b('0x35')];if(!_0x3a1c24[_0x423b('0x31')][_0x423b('0x39')](_0x423b('0x3a'))){_0x63d44c[_0x423b('0x1f')]=qs['limit'](_0x3a1c24[_0x423b('0x31')][_0x423b('0x1f')]);_0x63d44c[_0x423b('0x1d')]=qs[_0x423b('0x1d')](_0x3a1c24[_0x423b('0x31')][_0x423b('0x1d')]);}_0x63d44c['order']=qs[_0x423b('0x3b')](_0x3a1c24[_0x423b('0x31')][_0x423b('0x3b')]);_0x63d44c['where']=qs[_0x423b('0x33')](_['pick'](_0x3a1c24[_0x423b('0x31')],_0x1765d7['filters']),_0x1dcf1c);if(_0x3a1c24[_0x423b('0x31')]['filter']){_0x63d44c[_0x423b('0x3c')]=_[_0x423b('0x3d')](_0x63d44c[_0x423b('0x3c')],{'$or':_['map'](_0x1dcf1c,function(_0x2efbf9){if(_0x2efbf9[_0x423b('0x2f')]!==_0x423b('0x3e')){var _0x477814={};_0x477814[_0x2efbf9[_0x423b('0x29')]]={'$like':'%'+_0x3a1c24[_0x423b('0x31')][_0x423b('0x3f')]+'%'};return _0x477814;}})});}_0x63d44c=_['merge']({},_0x63d44c,_0x3a1c24[_0x423b('0x40')]);var _0x2627ff={'where':_0x63d44c[_0x423b('0x3c')]};return db[_0x423b('0x2c')][_0x423b('0x20')](_0x2627ff)['then'](function(_0x4b52eb){_0x1a97ae[_0x423b('0x20')]=_0x4b52eb;if(_0x3a1c24[_0x423b('0x31')][_0x423b('0x41')]){_0x63d44c[_0x423b('0x42')]=[{'all':!![]}];}return db[_0x423b('0x2c')][_0x423b('0x43')](_0x63d44c);})[_0x423b('0x25')](function(_0x9249de){_0x1a97ae[_0x423b('0x44')]=_0x9249de;return _0x1a97ae;})[_0x423b('0x25')](respondWithFilteredResult(_0x4d7f8e,_0x63d44c))[_0x423b('0x45')](handleError(_0x4d7f8e,null));};exports['show']=function(_0x29cdc5,_0x2a28d7){var _0x3c40f5={'raw':![],'where':{'id':_0x29cdc5[_0x423b('0x46')]['id']}},_0x22460b={};_0x22460b[_0x423b('0x35')]=_[_0x423b('0x32')](db[_0x423b('0x2c')][_0x423b('0x2d')]);_0x22460b['query']=_[_0x423b('0x32')](_0x29cdc5[_0x423b('0x31')]);_0x22460b['filters']=_['intersection'](_0x22460b['model'],_0x22460b['query']);_0x3c40f5['attributes']=_[_0x423b('0x34')](_0x22460b[_0x423b('0x35')],qs[_0x423b('0x37')](_0x29cdc5['query']['fields']));_0x3c40f5[_0x423b('0x36')]=_0x3c40f5[_0x423b('0x36')]['length']?_0x3c40f5[_0x423b('0x36')]:_0x22460b[_0x423b('0x35')];if(_0x29cdc5[_0x423b('0x31')]['includeAll']){_0x3c40f5[_0x423b('0x42')]=[{'all':!![]}];}_0x3c40f5=_[_0x423b('0x3d')]({},_0x3c40f5,_0x29cdc5[_0x423b('0x40')]);return db['DeskConfiguration'][_0x423b('0x47')](_0x3c40f5)[_0x423b('0x25')](handleEntityNotFound(_0x2a28d7,null))['then'](respondWithResult(_0x2a28d7,null))[_0x423b('0x45')](handleError(_0x2a28d7,null));};exports['create']=function(_0x4e47ab,_0x3d66c7){return db[_0x423b('0x2c')][_0x423b('0x48')](_0x4e47ab['body'],{})[_0x423b('0x25')](respondWithResult(_0x3d66c7,0xc9))[_0x423b('0x45')](handleError(_0x3d66c7,null));};exports[_0x423b('0x49')]=function(_0x46af8f,_0x14f2af){if(_0x46af8f[_0x423b('0x4a')]['id']){delete _0x46af8f[_0x423b('0x4a')]['id'];}return db[_0x423b('0x2c')][_0x423b('0x47')]({'where':{'id':_0x46af8f[_0x423b('0x46')]['id']}})['then'](handleEntityNotFound(_0x14f2af,null))[_0x423b('0x25')](saveUpdates(_0x46af8f[_0x423b('0x4a')],null))[_0x423b('0x25')](respondWithResult(_0x14f2af,null))[_0x423b('0x45')](handleError(_0x14f2af,null));};exports[_0x423b('0x26')]=function(_0x191656,_0x2549c5){return db['DeskConfiguration'][_0x423b('0x47')]({'where':{'id':_0x191656[_0x423b('0x46')]['id']}})['then'](handleEntityNotFound(_0x2549c5,null))[_0x423b('0x25')](removeEntity(_0x2549c5,null))[_0x423b('0x45')](handleError(_0x2549c5,null));};exports['getFields']=function(_0x5325b4,_0x501e2c,_0x4e2bf9){var _0x25f44b={};var _0x2cac66={};var _0x39f88b;var _0x516771;return db['DeskConfiguration']['findOne']({'where':{'id':_0x5325b4['params']['id']}})['then'](handleEntityNotFound(_0x501e2c,null))[_0x423b('0x25')](function(_0x236347){if(_0x236347){_0x39f88b=_0x236347;_0x2cac66['model']=_[_0x423b('0x32')](db[_0x423b('0x4b')][_0x423b('0x2d')]);_0x2cac66['query']=_[_0x423b('0x32')](_0x5325b4[_0x423b('0x31')]);_0x2cac66[_0x423b('0x33')]=_['intersection'](_0x2cac66[_0x423b('0x35')],_0x2cac66[_0x423b('0x31')]);_0x25f44b[_0x423b('0x36')]=_['intersection'](_0x2cac66[_0x423b('0x35')],qs['fields'](_0x5325b4[_0x423b('0x31')][_0x423b('0x37')]));_0x25f44b['attributes']=_0x25f44b[_0x423b('0x36')]['length']?_0x25f44b[_0x423b('0x36')]:_0x2cac66[_0x423b('0x35')];_0x25f44b[_0x423b('0x4c')]=qs[_0x423b('0x3b')](_0x5325b4[_0x423b('0x31')][_0x423b('0x3b')]);_0x25f44b['where']=qs[_0x423b('0x33')](_[_0x423b('0x4d')](_0x5325b4[_0x423b('0x31')],_0x2cac66[_0x423b('0x33')]));if(_0x5325b4[_0x423b('0x31')][_0x423b('0x3f')]){_0x25f44b[_0x423b('0x3c')]=_[_0x423b('0x3d')](_0x25f44b[_0x423b('0x3c')],{'$or':_[_0x423b('0x2b')](_0x25f44b[_0x423b('0x36')],function(_0x1015b0){var _0xf9b285={};_0xf9b285[_0x1015b0]={'$like':'%'+_0x5325b4[_0x423b('0x31')][_0x423b('0x3f')]+'%'};return _0xf9b285;})});}_0x25f44b=_['merge']({},_0x25f44b,_0x5325b4[_0x423b('0x40')]);return _0x39f88b[_0x423b('0x4e')](_0x25f44b);}})[_0x423b('0x25')](function(_0x1e85ba){if(_0x1e85ba){_0x516771=_0x1e85ba[_0x423b('0x38')];if(!_0x5325b4[_0x423b('0x31')][_0x423b('0x39')](_0x423b('0x3a'))){_0x25f44b[_0x423b('0x1f')]=qs['limit'](_0x5325b4['query'][_0x423b('0x1f')]);_0x25f44b['offset']=qs['offset'](_0x5325b4['query'][_0x423b('0x1d')]);}return _0x39f88b[_0x423b('0x4e')](_0x25f44b);}})[_0x423b('0x25')](function(_0x2a794e){if(_0x2a794e){return _0x2a794e?{'count':_0x516771,'rows':_0x2a794e}:null;}})[_0x423b('0x25')](respondWithResult(_0x501e2c,null))[_0x423b('0x45')](handleError(_0x501e2c,null));};exports[_0x423b('0x4f')]=function(_0x16d289,_0x340ade,_0x2ffaf9){var _0x1a9ebf={};var _0x51a1ed={};var _0x581500;var _0x172ec9;return db[_0x423b('0x2c')][_0x423b('0x50')]({'where':{'id':_0x16d289[_0x423b('0x46')]['id']}})['then'](handleEntityNotFound(_0x340ade,null))[_0x423b('0x25')](function(_0x5f3f14){if(_0x5f3f14){_0x581500=_0x5f3f14;_0x51a1ed[_0x423b('0x35')]=_[_0x423b('0x32')](db[_0x423b('0x4b')]['rawAttributes']);_0x51a1ed[_0x423b('0x31')]=_[_0x423b('0x32')](_0x16d289[_0x423b('0x31')]);_0x51a1ed['filters']=_[_0x423b('0x34')](_0x51a1ed[_0x423b('0x35')],_0x51a1ed['query']);_0x1a9ebf['attributes']=_[_0x423b('0x34')](_0x51a1ed['model'],qs[_0x423b('0x37')](_0x16d289['query']['fields']));_0x1a9ebf[_0x423b('0x36')]=_0x1a9ebf[_0x423b('0x36')]['length']?_0x1a9ebf[_0x423b('0x36')]:_0x51a1ed[_0x423b('0x35')];_0x1a9ebf[_0x423b('0x4c')]=qs[_0x423b('0x3b')](_0x16d289[_0x423b('0x31')][_0x423b('0x3b')]);_0x1a9ebf[_0x423b('0x3c')]=qs[_0x423b('0x33')](_[_0x423b('0x4d')](_0x16d289[_0x423b('0x31')],_0x51a1ed[_0x423b('0x33')]));if(_0x16d289[_0x423b('0x31')][_0x423b('0x3f')]){_0x1a9ebf[_0x423b('0x3c')]=_[_0x423b('0x3d')](_0x1a9ebf[_0x423b('0x3c')],{'$or':_[_0x423b('0x2b')](_0x1a9ebf['attributes'],function(_0x54bc6e){var _0x3c8b21={};_0x3c8b21[_0x54bc6e]={'$like':'%'+_0x16d289[_0x423b('0x31')][_0x423b('0x3f')]+'%'};return _0x3c8b21;})});}_0x1a9ebf=_[_0x423b('0x3d')]({},_0x1a9ebf,_0x16d289['options']);return _0x581500['getSubjects'](_0x1a9ebf);}})['then'](function(_0x183c1d){if(_0x183c1d){_0x172ec9=_0x183c1d['length'];if(!_0x16d289['query'][_0x423b('0x39')](_0x423b('0x3a'))){_0x1a9ebf[_0x423b('0x1f')]=qs[_0x423b('0x1f')](_0x16d289[_0x423b('0x31')][_0x423b('0x1f')]);_0x1a9ebf[_0x423b('0x1d')]=qs[_0x423b('0x1d')](_0x16d289[_0x423b('0x31')][_0x423b('0x1d')]);}return _0x581500[_0x423b('0x4f')](_0x1a9ebf);}})[_0x423b('0x25')](function(_0x39adda){if(_0x39adda){return _0x39adda?{'count':_0x172ec9,'rows':_0x39adda}:null;}})[_0x423b('0x25')](respondWithResult(_0x340ade,null))[_0x423b('0x45')](handleError(_0x340ade,null));};exports[_0x423b('0x51')]=function(_0x578dde,_0x86f26a,_0x390869){var _0x5259f3={};var _0x38f92d={};var _0x533ef0;var _0x49e3ec;return db[_0x423b('0x2c')][_0x423b('0x50')]({'where':{'id':_0x578dde[_0x423b('0x46')]['id']}})[_0x423b('0x25')](handleEntityNotFound(_0x86f26a,null))[_0x423b('0x25')](function(_0x237cb2){if(_0x237cb2){_0x533ef0=_0x237cb2;_0x38f92d[_0x423b('0x35')]=_[_0x423b('0x32')](db[_0x423b('0x4b')][_0x423b('0x2d')]);_0x38f92d[_0x423b('0x31')]=_[_0x423b('0x32')](_0x578dde['query']);_0x38f92d[_0x423b('0x33')]=_['intersection'](_0x38f92d[_0x423b('0x35')],_0x38f92d[_0x423b('0x31')]);_0x5259f3[_0x423b('0x36')]=_[_0x423b('0x34')](_0x38f92d['model'],qs[_0x423b('0x37')](_0x578dde[_0x423b('0x31')][_0x423b('0x37')]));_0x5259f3['attributes']=_0x5259f3['attributes']['length']?_0x5259f3[_0x423b('0x36')]:_0x38f92d[_0x423b('0x35')];_0x5259f3[_0x423b('0x4c')]=qs['sort'](_0x578dde[_0x423b('0x31')][_0x423b('0x3b')]);_0x5259f3[_0x423b('0x3c')]=qs[_0x423b('0x33')](_['pick'](_0x578dde['query'],_0x38f92d[_0x423b('0x33')]));if(_0x578dde[_0x423b('0x31')][_0x423b('0x3f')]){_0x5259f3[_0x423b('0x3c')]=_[_0x423b('0x3d')](_0x5259f3[_0x423b('0x3c')],{'$or':_['map'](_0x5259f3['attributes'],function(_0x23508f){var _0x1156bc={};_0x1156bc[_0x23508f]={'$like':'%'+_0x578dde[_0x423b('0x31')]['filter']+'%'};return _0x1156bc;})});}_0x5259f3=_['merge']({},_0x5259f3,_0x578dde[_0x423b('0x40')]);return _0x533ef0['getDescriptions'](_0x5259f3);}})[_0x423b('0x25')](function(_0x5eb1d2){if(_0x5eb1d2){_0x49e3ec=_0x5eb1d2[_0x423b('0x38')];if(!_0x578dde[_0x423b('0x31')]['hasOwnProperty'](_0x423b('0x3a'))){_0x5259f3[_0x423b('0x1f')]=qs[_0x423b('0x1f')](_0x578dde['query']['limit']);_0x5259f3[_0x423b('0x1d')]=qs[_0x423b('0x1d')](_0x578dde[_0x423b('0x31')]['offset']);}return _0x533ef0['getDescriptions'](_0x5259f3);}})['then'](function(_0x4f37e1){if(_0x4f37e1){return _0x4f37e1?{'count':_0x49e3ec,'rows':_0x4f37e1}:null;}})[_0x423b('0x25')](respondWithResult(_0x86f26a,null))['catch'](handleError(_0x86f26a,null));};exports[_0x423b('0x52')]=function(_0x5777e5,_0x2af8b5,_0x5b31d1){var _0x1bfd84={};var _0x21db2b={};var _0x380c78;var _0x52fa08;return db[_0x423b('0x2c')][_0x423b('0x50')]({'where':{'id':_0x5777e5[_0x423b('0x46')]['id']}})[_0x423b('0x25')](handleEntityNotFound(_0x2af8b5,null))[_0x423b('0x25')](function(_0x111f21){if(_0x111f21){_0x380c78=_0x111f21;_0x21db2b[_0x423b('0x35')]=_[_0x423b('0x32')](db['Tag'][_0x423b('0x2d')]);_0x21db2b[_0x423b('0x31')]=_[_0x423b('0x32')](_0x5777e5['query']);_0x21db2b['filters']=_['intersection'](_0x21db2b['model'],_0x21db2b[_0x423b('0x31')]);_0x1bfd84[_0x423b('0x36')]=_[_0x423b('0x34')](_0x21db2b['model'],qs[_0x423b('0x37')](_0x5777e5[_0x423b('0x31')][_0x423b('0x37')]));_0x1bfd84[_0x423b('0x36')]=_0x1bfd84[_0x423b('0x36')]['length']?_0x1bfd84['attributes']:_0x21db2b['model'];_0x1bfd84[_0x423b('0x4c')]=qs['sort'](_0x5777e5['query'][_0x423b('0x3b')]);_0x1bfd84[_0x423b('0x3c')]=qs[_0x423b('0x33')](_[_0x423b('0x4d')](_0x5777e5['query'],_0x21db2b[_0x423b('0x33')]));if(_0x5777e5['query']['filter']){_0x1bfd84[_0x423b('0x3c')]=_['merge'](_0x1bfd84['where'],{'$or':_['map'](_0x1bfd84[_0x423b('0x36')],function(_0x1efb4c){var _0x377d34={};_0x377d34[_0x1efb4c]={'$like':'%'+_0x5777e5[_0x423b('0x31')][_0x423b('0x3f')]+'%'};return _0x377d34;})});}_0x1bfd84=_[_0x423b('0x3d')]({},_0x1bfd84,_0x5777e5[_0x423b('0x40')]);return _0x380c78['getTags'](_0x1bfd84);}})['then'](function(_0x5b227d){if(_0x5b227d){_0x52fa08=_0x5b227d[_0x423b('0x38')];if(!_0x5777e5[_0x423b('0x31')][_0x423b('0x39')](_0x423b('0x3a'))){_0x1bfd84[_0x423b('0x1f')]=qs['limit'](_0x5777e5[_0x423b('0x31')]['limit']);_0x1bfd84[_0x423b('0x1d')]=qs['offset'](_0x5777e5[_0x423b('0x31')][_0x423b('0x1d')]);}return _0x380c78[_0x423b('0x52')](_0x1bfd84);}})[_0x423b('0x25')](function(_0x374a64){if(_0x374a64){return _0x374a64?{'count':_0x52fa08,'rows':_0x374a64}:null;}})[_0x423b('0x25')](respondWithResult(_0x2af8b5,null))[_0x423b('0x45')](handleError(_0x2af8b5,null));};exports['setTags']=function(_0x46029d,_0x4900c8,_0x3f4633){if(_0x46029d[_0x423b('0x4a')]['id']){delete _0x46029d[_0x423b('0x4a')]['id'];}return db[_0x423b('0x2c')][_0x423b('0x50')]({'where':{'id':_0x46029d['params']['id']}})[_0x423b('0x25')](handleEntityNotFound(_0x4900c8,null))['then'](function(_0x31c861){if(_0x31c861){return _0x31c861[_0x423b('0x53')](_0x46029d['body'][_0x423b('0x54')]||[]);}return null;})[_0x423b('0x25')](respondWithResult(_0x4900c8,null))[_0x423b('0x45')](handleError(_0x4900c8,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 4862389..b61cfd6 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 _0xc86f=['../../config/logger','api','moment','bluebird','path','../../config/environment','exports','DeskConfiguration','int_desk_configurations','util'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0xc86f,0xb3));var _0xfc86=function(_0x1ff171,_0x4012af){_0x1ff171=_0x1ff171-0x0;var _0x456656=_0xc86f[_0x1ff171];return _0x456656;};'use strict';var _=require('lodash');var util=require(_0xfc86('0x0'));var logger=require(_0xfc86('0x1'))(_0xfc86('0x2'));var moment=require(_0xfc86('0x3'));var BPromise=require(_0xfc86('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfc86('0x5'));var rimraf=require('rimraf');var config=require(_0xfc86('0x6'));var attributes=require('./intDeskConfiguration.attributes');module[_0xfc86('0x7')]=function(_0x419040,_0x487c9e){return _0x419040['define'](_0xfc86('0x8'),attributes,{'tableName':_0xfc86('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2ba6=['api','moment','bluebird','request-promise','path','rimraf','./intDeskConfiguration.attributes','define','DeskConfiguration','lodash','util','../../config/logger'];(function(_0x53a301,_0x5343b7){var _0x3889ca=function(_0x1c73e0){while(--_0x1c73e0){_0x53a301['push'](_0x53a301['shift']());}};_0x3889ca(++_0x5343b7);}(_0x2ba6,0x135));var _0x62ba=function(_0x5f288f,_0x242129){_0x5f288f=_0x5f288f-0x0;var _0x29df11=_0x2ba6[_0x5f288f];return _0x29df11;};'use strict';var _=require(_0x62ba('0x0'));var util=require(_0x62ba('0x1'));var logger=require(_0x62ba('0x2'))(_0x62ba('0x3'));var moment=require(_0x62ba('0x4'));var BPromise=require(_0x62ba('0x5'));var rp=require(_0x62ba('0x6'));var fs=require('fs');var path=require(_0x62ba('0x7'));var rimraf=require(_0x62ba('0x8'));var config=require('../../config/environment');var attributes=require(_0x62ba('0x9'));module['exports']=function(_0x4ac882,_0x525da9){return _0x4ac882[_0x62ba('0xa')](_0x62ba('0xb'),attributes,{'tableName':'int_desk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js b/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js index 3568593..db82549 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 _0x2d08=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','request','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment'];(function(_0x516ffb,_0x5b5b42){var _0x319667=function(_0x250098){while(--_0x250098){_0x516ffb['push'](_0x516ffb['shift']());}};_0x319667(++_0x5b5b42);}(_0x2d08,0x129));var _0x82d0=function(_0x41382c,_0xc3ffd1){_0x41382c=_0x41382c-0x0;var _0x4da35b=_0x2d08[_0x41382c];return _0x4da35b;};'use strict';var _=require(_0x82d0('0x0'));var util=require(_0x82d0('0x1'));var moment=require(_0x82d0('0x2'));var BPromise=require(_0x82d0('0x3'));var rs=require(_0x82d0('0x4'));var fs=require('fs');var Redis=require(_0x82d0('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x82d0('0x6'));var logger=require(_0x82d0('0x7'))('rpc');var config=require(_0x82d0('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2715c7,_0x38d8bf,_0x4ef5ec){return new BPromise(function(_0x503cc3,_0x259f8f){return client[_0x82d0('0x9')](_0x2715c7,_0x4ef5ec)['then'](function(_0x1bb0ca){logger[_0x82d0('0xa')](_0x82d0('0xb'),_0x38d8bf,_0x82d0('0xc'));logger[_0x82d0('0xd')](_0x82d0('0xe'),_0x38d8bf,_0x82d0('0xc'),JSON[_0x82d0('0xf')](_0x1bb0ca));if(_0x1bb0ca[_0x82d0('0x10')]){if(_0x1bb0ca['error']['code']===0x1f4){logger[_0x82d0('0x10')]('DeskConfiguration,\x20%s,\x20%s',_0x38d8bf,_0x1bb0ca[_0x82d0('0x10')]['message']);return _0x259f8f(_0x1bb0ca['error'][_0x82d0('0x11')]);}logger[_0x82d0('0x10')](_0x82d0('0xb'),_0x38d8bf,_0x1bb0ca[_0x82d0('0x10')]['message']);return _0x503cc3(_0x1bb0ca[_0x82d0('0x10')][_0x82d0('0x11')]);}else{logger['info'](_0x82d0('0xb'),_0x38d8bf,_0x82d0('0xc'));_0x503cc3(_0x1bb0ca[_0x82d0('0x12')]['message']);}})[_0x82d0('0x13')](function(_0x59e46d){logger[_0x82d0('0x10')]('DeskConfiguration,\x20%s,\x20%s',_0x38d8bf,_0x59e46d);_0x259f8f(_0x59e46d);});});} \ No newline at end of file +var _0x6b06=['lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','catch'];(function(_0x5a95fa,_0x4a2fc9){var _0x1a61b8=function(_0x59f119){while(--_0x59f119){_0x5a95fa['push'](_0x5a95fa['shift']());}};_0x1a61b8(++_0x4a2fc9);}(_0x6b06,0x1e4));var _0x66b0=function(_0x311abc,_0x29e921){_0x311abc=_0x311abc-0x0;var _0x239aa5=_0x6b06[_0x311abc];return _0x239aa5;};'use strict';var _=require(_0x66b0('0x0'));var util=require(_0x66b0('0x1'));var moment=require(_0x66b0('0x2'));var BPromise=require('bluebird');var rs=require(_0x66b0('0x3'));var fs=require('fs');var Redis=require(_0x66b0('0x4'));var db=require(_0x66b0('0x5'))['db'];var utils=require(_0x66b0('0x6'));var logger=require(_0x66b0('0x7'))(_0x66b0('0x8'));var config=require(_0x66b0('0x9'));var jayson=require(_0x66b0('0xa'));var client=jayson['client'][_0x66b0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2fafa4,_0x52036c,_0xaab24d){return new BPromise(function(_0x1a3440,_0x47f0c4){return client[_0x66b0('0xc')](_0x2fafa4,_0xaab24d)[_0x66b0('0xd')](function(_0x1cf27a){logger[_0x66b0('0xe')](_0x66b0('0xf'),_0x52036c,_0x66b0('0x10'));logger['debug']('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x52036c,_0x66b0('0x10'),JSON[_0x66b0('0x11')](_0x1cf27a));if(_0x1cf27a['error']){if(_0x1cf27a['error'][_0x66b0('0x12')]===0x1f4){logger[_0x66b0('0x13')](_0x66b0('0xf'),_0x52036c,_0x1cf27a['error'][_0x66b0('0x14')]);return _0x47f0c4(_0x1cf27a[_0x66b0('0x13')][_0x66b0('0x14')]);}logger['error'](_0x66b0('0xf'),_0x52036c,_0x1cf27a[_0x66b0('0x13')][_0x66b0('0x14')]);return _0x1a3440(_0x1cf27a['error']['message']);}else{logger[_0x66b0('0xe')](_0x66b0('0xf'),_0x52036c,_0x66b0('0x10'));_0x1a3440(_0x1cf27a['result'][_0x66b0('0x14')]);}})[_0x66b0('0x15')](function(_0x4f0d75){logger[_0x66b0('0x13')](_0x66b0('0xf'),_0x52036c,_0x4f0d75);_0x47f0c4(_0x4f0d75);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index b7d3ec2..3a08e3a 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 _0xf5b6=['delete','/:id','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','index','get','show','isAuthenticated','create','put'];(function(_0x1637e0,_0x1c956b){var _0x46ce9c=function(_0x44e0a1){while(--_0x44e0a1){_0x1637e0['push'](_0x1637e0['shift']());}};_0x46ce9c(++_0x1c956b);}(_0xf5b6,0x1b4));var _0x6f5b=function(_0x5ded4c,_0x2e3cb7){_0x5ded4c=_0x5ded4c-0x0;var _0xe188f5=_0xf5b6[_0x5ded4c];return _0xe188f5;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6f5b('0x0'));var timeout=require(_0x6f5b('0x1'));var express=require(_0x6f5b('0x2'));var router=express[_0x6f5b('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x6f5b('0x4'));var interaction=require(_0x6f5b('0x5'));var config=require(_0x6f5b('0x6'));var controller=require(_0x6f5b('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x6f5b('0x8')]);router[_0x6f5b('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x6f5b('0xa')]);router['post']('/',auth[_0x6f5b('0xb')](),controller[_0x6f5b('0xc')]);router[_0x6f5b('0xd')]('/:id',auth[_0x6f5b('0xb')](),controller['update']);router[_0x6f5b('0xe')](_0x6f5b('0xf'),auth[_0x6f5b('0xb')](),controller[_0x6f5b('0x10')]);module[_0x6f5b('0x11')]=router; \ No newline at end of file +var _0x0e5a=['multer','util','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intDeskField.controller','get','/:id','isAuthenticated','show','post','create','put','delete'];(function(_0x20beae,_0x5eac6d){var _0xf5725=function(_0x926a3b){while(--_0x926a3b){_0x20beae['push'](_0x20beae['shift']());}};_0xf5725(++_0x5eac6d);}(_0x0e5a,0x70));var _0xa0e5=function(_0x2c0626,_0x26fd30){_0x2c0626=_0x2c0626-0x0;var _0x1317ea=_0x0e5a[_0x2c0626];return _0x1317ea;};'use strict';var multer=require(_0xa0e5('0x0'));var util=require(_0xa0e5('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa0e5('0x2'));var router=express[_0xa0e5('0x3')]();var fs_extra=require(_0xa0e5('0x4'));var auth=require(_0xa0e5('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xa0e5('0x6'));var controller=require(_0xa0e5('0x7'));router[_0xa0e5('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xa0e5('0x8')](_0xa0e5('0x9'),auth[_0xa0e5('0xa')](),controller[_0xa0e5('0xb')]);router[_0xa0e5('0xc')]('/',auth[_0xa0e5('0xa')](),controller[_0xa0e5('0xd')]);router[_0xa0e5('0xe')](_0xa0e5('0x9'),auth[_0xa0e5('0xa')](),controller['update']);router[_0xa0e5('0xf')](_0xa0e5('0x9'),auth[_0xa0e5('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 7c93717..7baf631 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 _0xa18a=['customVariable','keyValue','picklist','STRING','sequelize','ENUM','string','variable'];(function(_0x1b6c6d,_0x2983b0){var _0x290d9d=function(_0x5b9779){while(--_0x5b9779){_0x1b6c6d['push'](_0x1b6c6d['shift']());}};_0x290d9d(++_0x2983b0);}(_0xa18a,0xfc));var _0xaa18=function(_0x513629,_0x2757a9){_0x513629=_0x513629-0x0;var _0x475bc7=_0xa18a[_0x513629];return _0x475bc7;};'use strict';var Sequelize=require(_0xaa18('0x0'));module['exports']={'type':{'type':Sequelize[_0xaa18('0x1')](_0xaa18('0x2'),_0xaa18('0x3'),_0xaa18('0x4'),_0xaa18('0x5'),_0xaa18('0x6')),'defaultValue':_0xaa18('0x2')},'content':{'type':Sequelize[_0xaa18('0x7')]},'key':{'type':Sequelize[_0xaa18('0x7')]},'keyType':{'type':Sequelize[_0xaa18('0x1')](_0xaa18('0x2'),_0xaa18('0x3'),_0xaa18('0x4'))},'keyContent':{'type':Sequelize[_0xaa18('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xaa18('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xaa18('0x7')]}}; \ No newline at end of file +var _0xa74a=['customVariable','keyValue','picklist','STRING','sequelize','exports','ENUM','string','variable'];(function(_0x55b885,_0x15f7f1){var _0x4cb16d=function(_0x3b4667){while(--_0x3b4667){_0x55b885['push'](_0x55b885['shift']());}};_0x4cb16d(++_0x15f7f1);}(_0xa74a,0x1c6));var _0xaa74=function(_0x57c746,_0x3c75dc){_0x57c746=_0x57c746-0x0;var _0x3a953c=_0xa74a[_0x57c746];return _0x3a953c;};'use strict';var Sequelize=require(_0xaa74('0x0'));module[_0xaa74('0x1')]={'type':{'type':Sequelize[_0xaa74('0x2')](_0xaa74('0x3'),_0xaa74('0x4'),_0xaa74('0x5'),_0xaa74('0x6'),_0xaa74('0x7')),'defaultValue':_0xaa74('0x3')},'content':{'type':Sequelize[_0xaa74('0x8')]},'key':{'type':Sequelize[_0xaa74('0x8')]},'keyType':{'type':Sequelize[_0xaa74('0x2')](_0xaa74('0x3'),'variable',_0xaa74('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xaa74('0x8')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 681d82b..a76cf10 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 _0x3f96=['includeAll','create','body','params','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','DeskField','fieldName','type','key','model','query','keys','filters','attributes','intersection','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','catch','show','rawAttributes','fields'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x3f96,0x1d3));var _0x63f9=function(_0x4c9fc2,_0x3dd29e){_0x4c9fc2=_0x4c9fc2-0x0;var _0x234f26=_0x3f96[_0x4c9fc2];return _0x234f26;};'use strict';var emlformat=require(_0x63f9('0x0'));var rimraf=require(_0x63f9('0x1'));var zipdir=require(_0x63f9('0x2'));var jsonpatch=require(_0x63f9('0x3'));var rp=require(_0x63f9('0x4'));var moment=require('moment');var BPromise=require(_0x63f9('0x5'));var Mustache=require(_0x63f9('0x6'));var util=require(_0x63f9('0x7'));var path=require(_0x63f9('0x8'));var sox=require(_0x63f9('0x9'));var csv=require('to-csv');var ejs=require(_0x63f9('0xa'));var fs=require('fs');var fs_extra=require(_0x63f9('0xb'));var _=require(_0x63f9('0xc'));var squel=require(_0x63f9('0xd'));var crypto=require('crypto');var jsforce=require(_0x63f9('0xe'));var deskjs=require(_0x63f9('0xf'));var toCsv=require(_0x63f9('0x10'));var querystring=require(_0x63f9('0x11'));var Papa=require(_0x63f9('0x12'));var Redis=require(_0x63f9('0x13'));var authService=require(_0x63f9('0x14'));var qs=require(_0x63f9('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x63f9('0x16'));var logger=require(_0x63f9('0x17'))('api');var utils=require(_0x63f9('0x18'));var config=require(_0x63f9('0x19'));var licenseUtil=require(_0x63f9('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x45881b,_0x376780){_0x376780=_0x376780||0xcc;return function(_0x7025cc){if(_0x7025cc){return _0x45881b[_0x63f9('0x1b')](_0x376780);}return _0x45881b[_0x63f9('0x1c')](_0x376780)[_0x63f9('0x1d')]();};}function respondWithResult(_0x31997c,_0x51ec79){_0x51ec79=_0x51ec79||0xc8;return function(_0x19b409){if(_0x19b409){return _0x31997c['status'](_0x51ec79)[_0x63f9('0x1e')](_0x19b409);}};}function respondWithFilteredResult(_0x52be5e,_0x47050b){return function(_0x1fa6dd){if(_0x1fa6dd){var _0x37fc43=typeof _0x47050b[_0x63f9('0x1f')]===_0x63f9('0x20')&&typeof _0x47050b[_0x63f9('0x21')]===_0x63f9('0x20');var _0x5e25ae=_0x1fa6dd[_0x63f9('0x22')];var _0x4475d9=_0x37fc43?0x0:_0x47050b[_0x63f9('0x1f')];var _0x41d3a3=_0x37fc43?_0x1fa6dd[_0x63f9('0x22')]:_0x47050b['offset']+_0x47050b[_0x63f9('0x21')];var _0x30aa4d;if(_0x41d3a3>=_0x5e25ae){_0x41d3a3=_0x5e25ae;_0x30aa4d=0xc8;}else{_0x30aa4d=0xce;}_0x52be5e[_0x63f9('0x1c')](_0x30aa4d);return _0x52be5e['set'](_0x63f9('0x23'),_0x4475d9+'-'+_0x41d3a3+'/'+_0x5e25ae)[_0x63f9('0x1e')](_0x1fa6dd);}return null;};}function patchUpdates(_0x170f4){return function(_0x262b43){try{jsonpatch[_0x63f9('0x24')](_0x262b43,_0x170f4,!![]);}catch(_0x537a11){return BPromise['reject'](_0x537a11);}return _0x262b43[_0x63f9('0x25')]();};}function saveUpdates(_0x3926a2,_0x3c0589){return function(_0x39c2d4){if(_0x39c2d4){return _0x39c2d4[_0x63f9('0x26')](_0x3926a2)[_0x63f9('0x27')](function(_0x3720c9){return _0x3720c9;});}return null;};}function removeEntity(_0x549454,_0x5994c1){return function(_0x33092b){if(_0x33092b){return _0x33092b[_0x63f9('0x28')]()[_0x63f9('0x27')](function(){_0x549454[_0x63f9('0x1c')](0xcc)[_0x63f9('0x1d')]();});}};}function handleEntityNotFound(_0x62c363,_0x3e3c14){return function(_0xbb9716){if(!_0xbb9716){_0x62c363['sendStatus'](0x194);}return _0xbb9716;};}function handleError(_0x4abbf2,_0x5cf43d){_0x5cf43d=_0x5cf43d||0x1f4;return function(_0x1fcb7c){logger[_0x63f9('0x29')](_0x1fcb7c[_0x63f9('0x2a')]);if(_0x1fcb7c['name']){delete _0x1fcb7c[_0x63f9('0x2b')];}_0x4abbf2['status'](_0x5cf43d)[_0x63f9('0x2c')](_0x1fcb7c);};}exports[_0x63f9('0x2d')]=function(_0x25f5f0,_0x51c84b){var _0x1b56bd={},_0x3e6728={},_0x271872={'count':0x0,'rows':[]};var _0x22a82a=_[_0x63f9('0x2e')](db[_0x63f9('0x2f')]['rawAttributes'],function(_0x32f2d5){return{'name':_0x32f2d5[_0x63f9('0x30')],'type':_0x32f2d5[_0x63f9('0x31')][_0x63f9('0x32')]};});_0x3e6728[_0x63f9('0x33')]=_[_0x63f9('0x2e')](_0x22a82a,_0x63f9('0x2b'));_0x3e6728[_0x63f9('0x34')]=_[_0x63f9('0x35')](_0x25f5f0['query']);_0x3e6728[_0x63f9('0x36')]=_['intersection'](_0x3e6728[_0x63f9('0x33')],_0x3e6728[_0x63f9('0x34')]);_0x1b56bd[_0x63f9('0x37')]=_[_0x63f9('0x38')](_0x3e6728[_0x63f9('0x33')],qs['fields'](_0x25f5f0[_0x63f9('0x34')]['fields']));_0x1b56bd['attributes']=_0x1b56bd[_0x63f9('0x37')][_0x63f9('0x39')]?_0x1b56bd[_0x63f9('0x37')]:_0x3e6728['model'];if(!_0x25f5f0[_0x63f9('0x34')]['hasOwnProperty'](_0x63f9('0x3a'))){_0x1b56bd[_0x63f9('0x21')]=qs[_0x63f9('0x21')](_0x25f5f0['query']['limit']);_0x1b56bd[_0x63f9('0x1f')]=qs[_0x63f9('0x1f')](_0x25f5f0[_0x63f9('0x34')][_0x63f9('0x1f')]);}_0x1b56bd['order']=qs[_0x63f9('0x3b')](_0x25f5f0[_0x63f9('0x34')][_0x63f9('0x3b')]);_0x1b56bd[_0x63f9('0x3c')]=qs['filters'](_[_0x63f9('0x3d')](_0x25f5f0[_0x63f9('0x34')],_0x3e6728[_0x63f9('0x36')]),_0x22a82a);if(_0x25f5f0[_0x63f9('0x34')][_0x63f9('0x3e')]){_0x1b56bd[_0x63f9('0x3c')]=_[_0x63f9('0x3f')](_0x1b56bd[_0x63f9('0x3c')],{'$or':_[_0x63f9('0x2e')](_0x22a82a,function(_0x54f4d0){if(_0x54f4d0[_0x63f9('0x31')]!==_0x63f9('0x40')){var _0x110aa1={};_0x110aa1[_0x54f4d0[_0x63f9('0x2b')]]={'$like':'%'+_0x25f5f0[_0x63f9('0x34')][_0x63f9('0x3e')]+'%'};return _0x110aa1;}})});}_0x1b56bd=_['merge']({},_0x1b56bd,_0x25f5f0[_0x63f9('0x41')]);var _0x2f1202={'where':_0x1b56bd[_0x63f9('0x3c')]};return db[_0x63f9('0x2f')][_0x63f9('0x22')](_0x2f1202)[_0x63f9('0x27')](function(_0x1d733a){_0x271872[_0x63f9('0x22')]=_0x1d733a;if(_0x25f5f0['query']['includeAll']){_0x1b56bd['include']=[{'all':!![]}];}return db['DeskField'][_0x63f9('0x42')](_0x1b56bd);})[_0x63f9('0x27')](function(_0x19a603){_0x271872[_0x63f9('0x43')]=_0x19a603;return _0x271872;})[_0x63f9('0x27')](respondWithFilteredResult(_0x51c84b,_0x1b56bd))[_0x63f9('0x44')](handleError(_0x51c84b,null));};exports[_0x63f9('0x45')]=function(_0x16a1f3,_0x388261){var _0x5f53ab={'raw':!![],'where':{'id':_0x16a1f3['params']['id']}},_0x23ee18={};_0x23ee18[_0x63f9('0x33')]=_['keys'](db[_0x63f9('0x2f')][_0x63f9('0x46')]);_0x23ee18[_0x63f9('0x34')]=_['keys'](_0x16a1f3[_0x63f9('0x34')]);_0x23ee18[_0x63f9('0x36')]=_[_0x63f9('0x38')](_0x23ee18['model'],_0x23ee18['query']);_0x5f53ab[_0x63f9('0x37')]=_[_0x63f9('0x38')](_0x23ee18[_0x63f9('0x33')],qs[_0x63f9('0x47')](_0x16a1f3[_0x63f9('0x34')][_0x63f9('0x47')]));_0x5f53ab['attributes']=_0x5f53ab[_0x63f9('0x37')][_0x63f9('0x39')]?_0x5f53ab['attributes']:_0x23ee18[_0x63f9('0x33')];if(_0x16a1f3[_0x63f9('0x34')][_0x63f9('0x48')]){_0x5f53ab['include']=[{'all':!![]}];}_0x5f53ab=_['merge']({},_0x5f53ab,_0x16a1f3[_0x63f9('0x41')]);return db[_0x63f9('0x2f')]['find'](_0x5f53ab)[_0x63f9('0x27')](handleEntityNotFound(_0x388261,null))[_0x63f9('0x27')](respondWithResult(_0x388261,null))[_0x63f9('0x44')](handleError(_0x388261,null));};exports[_0x63f9('0x49')]=function(_0x119b8e,_0x51d818){return db[_0x63f9('0x2f')][_0x63f9('0x49')](_0x119b8e[_0x63f9('0x4a')],{})['then'](respondWithResult(_0x51d818,0xc9))['catch'](handleError(_0x51d818,null));};exports['update']=function(_0x4e6466,_0x13803d){if(_0x4e6466[_0x63f9('0x4a')]['id']){delete _0x4e6466[_0x63f9('0x4a')]['id'];}return db['DeskField']['find']({'where':{'id':_0x4e6466[_0x63f9('0x4b')]['id']}})[_0x63f9('0x27')](handleEntityNotFound(_0x13803d,null))[_0x63f9('0x27')](saveUpdates(_0x4e6466[_0x63f9('0x4a')],null))[_0x63f9('0x27')](respondWithResult(_0x13803d,null))[_0x63f9('0x44')](handleError(_0x13803d,null));};exports[_0x63f9('0x28')]=function(_0x387aa5,_0x53f06f){return db[_0x63f9('0x2f')][_0x63f9('0x4c')]({'where':{'id':_0x387aa5['params']['id']}})[_0x63f9('0x27')](handleEntityNotFound(_0x53f06f,null))[_0x63f9('0x27')](removeEntity(_0x53f06f,null))['catch'](handleError(_0x53f06f,null));}; \ No newline at end of file +var _0x7b92=['update','then','destroy','sendStatus','stack','name','send','index','map','DeskField','fieldName','type','key','model','query','keys','filters','attributes','fields','nolimit','order','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','rawAttributes','intersection','length','find','catch','create','body','eml-format','zip-dir','fast-json-patch','bluebird','path','sox','ejs','fs-extra','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','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save'];(function(_0x231e16,_0x67347b){var _0x570a7c=function(_0x2c35b4){while(--_0x2c35b4){_0x231e16['push'](_0x231e16['shift']());}};_0x570a7c(++_0x67347b);}(_0x7b92,0x1e3));var _0x27b9=function(_0xe4d6c6,_0x3bdbf2){_0xe4d6c6=_0xe4d6c6-0x0;var _0x3a8935=_0x7b92[_0xe4d6c6];return _0x3a8935;};'use strict';var emlformat=require(_0x27b9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x27b9('0x1'));var jsonpatch=require(_0x27b9('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x27b9('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x27b9('0x4'));var sox=require(_0x27b9('0x5'));var csv=require('to-csv');var ejs=require(_0x27b9('0x6'));var fs=require('fs');var fs_extra=require(_0x27b9('0x7'));var _=require('lodash');var squel=require(_0x27b9('0x8'));var crypto=require(_0x27b9('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x27b9('0xa'));var toCsv=require(_0x27b9('0xb'));var querystring=require(_0x27b9('0xc'));var Papa=require(_0x27b9('0xd'));var Redis=require(_0x27b9('0xe'));var authService=require(_0x27b9('0xf'));var qs=require(_0x27b9('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x27b9('0x11'));var logger=require(_0x27b9('0x12'))(_0x27b9('0x13'));var utils=require(_0x27b9('0x14'));var config=require(_0x27b9('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x27b9('0x16'))['db'];function respondWithStatusCode(_0x2e469b,_0x540690){_0x540690=_0x540690||0xcc;return function(_0x25b7cd){if(_0x25b7cd){return _0x2e469b['sendStatus'](_0x540690);}return _0x2e469b['status'](_0x540690)[_0x27b9('0x17')]();};}function respondWithResult(_0x4f8c9e,_0x4b3270){_0x4b3270=_0x4b3270||0xc8;return function(_0x594b22){if(_0x594b22){return _0x4f8c9e[_0x27b9('0x18')](_0x4b3270)[_0x27b9('0x19')](_0x594b22);}};}function respondWithFilteredResult(_0x36036b,_0x4347e5){return function(_0x5c227c){if(_0x5c227c){var _0x76af1e=typeof _0x4347e5[_0x27b9('0x1a')]===_0x27b9('0x1b')&&typeof _0x4347e5[_0x27b9('0x1c')]==='undefined';var _0x570b41=_0x5c227c[_0x27b9('0x1d')];var _0x26bc0f=_0x76af1e?0x0:_0x4347e5[_0x27b9('0x1a')];var _0xa0a9f9=_0x76af1e?_0x5c227c[_0x27b9('0x1d')]:_0x4347e5[_0x27b9('0x1a')]+_0x4347e5['limit'];var _0x4c0842;if(_0xa0a9f9>=_0x570b41){_0xa0a9f9=_0x570b41;_0x4c0842=0xc8;}else{_0x4c0842=0xce;}_0x36036b['status'](_0x4c0842);return _0x36036b[_0x27b9('0x1e')](_0x27b9('0x1f'),_0x26bc0f+'-'+_0xa0a9f9+'/'+_0x570b41)[_0x27b9('0x19')](_0x5c227c);}return null;};}function patchUpdates(_0x443e4b){return function(_0x263369){try{jsonpatch[_0x27b9('0x20')](_0x263369,_0x443e4b,!![]);}catch(_0x3013a9){return BPromise[_0x27b9('0x21')](_0x3013a9);}return _0x263369[_0x27b9('0x22')]();};}function saveUpdates(_0x58ab54,_0x43b28a){return function(_0x3cfd93){if(_0x3cfd93){return _0x3cfd93[_0x27b9('0x23')](_0x58ab54)[_0x27b9('0x24')](function(_0xf69565){return _0xf69565;});}return null;};}function removeEntity(_0x2b27e9,_0x123be1){return function(_0x8803db){if(_0x8803db){return _0x8803db[_0x27b9('0x25')]()['then'](function(){_0x2b27e9['status'](0xcc)[_0x27b9('0x17')]();});}};}function handleEntityNotFound(_0x58a3ea,_0x2bbc42){return function(_0x4bdc08){if(!_0x4bdc08){_0x58a3ea[_0x27b9('0x26')](0x194);}return _0x4bdc08;};}function handleError(_0x3998a0,_0x4d09f0){_0x4d09f0=_0x4d09f0||0x1f4;return function(_0x5d32c9){logger['error'](_0x5d32c9[_0x27b9('0x27')]);if(_0x5d32c9[_0x27b9('0x28')]){delete _0x5d32c9[_0x27b9('0x28')];}_0x3998a0[_0x27b9('0x18')](_0x4d09f0)[_0x27b9('0x29')](_0x5d32c9);};}exports[_0x27b9('0x2a')]=function(_0x36ae8b,_0x7713c1){var _0x114b37={},_0x292833={},_0x12e7eb={'count':0x0,'rows':[]};var _0x311225=_[_0x27b9('0x2b')](db[_0x27b9('0x2c')]['rawAttributes'],function(_0x2b2744){return{'name':_0x2b2744[_0x27b9('0x2d')],'type':_0x2b2744[_0x27b9('0x2e')][_0x27b9('0x2f')]};});_0x292833[_0x27b9('0x30')]=_[_0x27b9('0x2b')](_0x311225,_0x27b9('0x28'));_0x292833[_0x27b9('0x31')]=_[_0x27b9('0x32')](_0x36ae8b[_0x27b9('0x31')]);_0x292833[_0x27b9('0x33')]=_['intersection'](_0x292833[_0x27b9('0x30')],_0x292833['query']);_0x114b37[_0x27b9('0x34')]=_['intersection'](_0x292833[_0x27b9('0x30')],qs[_0x27b9('0x35')](_0x36ae8b['query'][_0x27b9('0x35')]));_0x114b37[_0x27b9('0x34')]=_0x114b37[_0x27b9('0x34')]['length']?_0x114b37['attributes']:_0x292833[_0x27b9('0x30')];if(!_0x36ae8b[_0x27b9('0x31')]['hasOwnProperty'](_0x27b9('0x36'))){_0x114b37[_0x27b9('0x1c')]=qs[_0x27b9('0x1c')](_0x36ae8b[_0x27b9('0x31')][_0x27b9('0x1c')]);_0x114b37[_0x27b9('0x1a')]=qs[_0x27b9('0x1a')](_0x36ae8b[_0x27b9('0x31')][_0x27b9('0x1a')]);}_0x114b37[_0x27b9('0x37')]=qs['sort'](_0x36ae8b['query']['sort']);_0x114b37[_0x27b9('0x38')]=qs['filters'](_[_0x27b9('0x39')](_0x36ae8b[_0x27b9('0x31')],_0x292833[_0x27b9('0x33')]),_0x311225);if(_0x36ae8b[_0x27b9('0x31')][_0x27b9('0x3a')]){_0x114b37[_0x27b9('0x38')]=_[_0x27b9('0x3b')](_0x114b37[_0x27b9('0x38')],{'$or':_[_0x27b9('0x2b')](_0x311225,function(_0x388118){if(_0x388118['type']!==_0x27b9('0x3c')){var _0xa44f05={};_0xa44f05[_0x388118['name']]={'$like':'%'+_0x36ae8b[_0x27b9('0x31')]['filter']+'%'};return _0xa44f05;}})});}_0x114b37=_[_0x27b9('0x3b')]({},_0x114b37,_0x36ae8b['options']);var _0x4e2035={'where':_0x114b37[_0x27b9('0x38')]};return db[_0x27b9('0x2c')][_0x27b9('0x1d')](_0x4e2035)['then'](function(_0x4cfefa){_0x12e7eb['count']=_0x4cfefa;if(_0x36ae8b[_0x27b9('0x31')][_0x27b9('0x3d')]){_0x114b37[_0x27b9('0x3e')]=[{'all':!![]}];}return db[_0x27b9('0x2c')][_0x27b9('0x3f')](_0x114b37);})[_0x27b9('0x24')](function(_0x1e83bd){_0x12e7eb[_0x27b9('0x40')]=_0x1e83bd;return _0x12e7eb;})[_0x27b9('0x24')](respondWithFilteredResult(_0x7713c1,_0x114b37))['catch'](handleError(_0x7713c1,null));};exports[_0x27b9('0x41')]=function(_0x15ec21,_0x462729){var _0x456c48={'raw':!![],'where':{'id':_0x15ec21[_0x27b9('0x42')]['id']}},_0x1e2f9f={};_0x1e2f9f[_0x27b9('0x30')]=_[_0x27b9('0x32')](db['DeskField'][_0x27b9('0x43')]);_0x1e2f9f['query']=_['keys'](_0x15ec21['query']);_0x1e2f9f[_0x27b9('0x33')]=_[_0x27b9('0x44')](_0x1e2f9f[_0x27b9('0x30')],_0x1e2f9f[_0x27b9('0x31')]);_0x456c48[_0x27b9('0x34')]=_[_0x27b9('0x44')](_0x1e2f9f['model'],qs[_0x27b9('0x35')](_0x15ec21[_0x27b9('0x31')][_0x27b9('0x35')]));_0x456c48[_0x27b9('0x34')]=_0x456c48[_0x27b9('0x34')][_0x27b9('0x45')]?_0x456c48['attributes']:_0x1e2f9f[_0x27b9('0x30')];if(_0x15ec21[_0x27b9('0x31')][_0x27b9('0x3d')]){_0x456c48[_0x27b9('0x3e')]=[{'all':!![]}];}_0x456c48=_[_0x27b9('0x3b')]({},_0x456c48,_0x15ec21['options']);return db[_0x27b9('0x2c')][_0x27b9('0x46')](_0x456c48)[_0x27b9('0x24')](handleEntityNotFound(_0x462729,null))[_0x27b9('0x24')](respondWithResult(_0x462729,null))[_0x27b9('0x47')](handleError(_0x462729,null));};exports[_0x27b9('0x48')]=function(_0x8413b1,_0x3c2879){return db[_0x27b9('0x2c')][_0x27b9('0x48')](_0x8413b1[_0x27b9('0x49')],{})[_0x27b9('0x24')](respondWithResult(_0x3c2879,0xc9))[_0x27b9('0x47')](handleError(_0x3c2879,null));};exports[_0x27b9('0x23')]=function(_0x1e58b6,_0xad64d1){if(_0x1e58b6['body']['id']){delete _0x1e58b6[_0x27b9('0x49')]['id'];}return db[_0x27b9('0x2c')]['find']({'where':{'id':_0x1e58b6['params']['id']}})['then'](handleEntityNotFound(_0xad64d1,null))['then'](saveUpdates(_0x1e58b6[_0x27b9('0x49')],null))['then'](respondWithResult(_0xad64d1,null))['catch'](handleError(_0xad64d1,null));};exports[_0x27b9('0x25')]=function(_0x2e817a,_0x3d6fc8){return db[_0x27b9('0x2c')][_0x27b9('0x46')]({'where':{'id':_0x2e817a[_0x27b9('0x42')]['id']}})[_0x27b9('0x24')](handleEntityNotFound(_0x3d6fc8,null))[_0x27b9('0x24')](removeEntity(_0x3d6fc8,null))[_0x27b9('0x47')](handleError(_0x3d6fc8,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index f04f104..6ce86eb 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 _0xe11c=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskField.attributes','exports','define','DeskField','desk_unique_index','idField','FieldId','lodash','util','../../config/logger','api'];(function(_0x269463,_0x100559){var _0x46fbe9=function(_0x5511e8){while(--_0x5511e8){_0x269463['push'](_0x269463['shift']());}};_0x46fbe9(++_0x100559);}(_0xe11c,0x161));var _0xce11=function(_0x5156b9,_0x415e08){_0x5156b9=_0x5156b9-0x0;var _0x227fd7=_0xe11c[_0x5156b9];return _0x227fd7;};'use strict';var _=require(_0xce11('0x0'));var util=require(_0xce11('0x1'));var logger=require(_0xce11('0x2'))(_0xce11('0x3'));var moment=require(_0xce11('0x4'));var BPromise=require(_0xce11('0x5'));var rp=require(_0xce11('0x6'));var fs=require('fs');var path=require(_0xce11('0x7'));var rimraf=require(_0xce11('0x8'));var config=require(_0xce11('0x9'));var attributes=require(_0xce11('0xa'));module[_0xce11('0xb')]=function(_0x54c12f,_0xee7777){return _0x54c12f[_0xce11('0xc')](_0xce11('0xd'),attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':_0xce11('0xe'),'fields':[_0xce11('0xf'),_0xce11('0x10')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x02a6=['define','DeskField','int_desk_fields','desk_unique_index','idField','FieldId','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskField.attributes','exports'];(function(_0x4d41a5,_0x1732a7){var _0x5852f3=function(_0x505e4d){while(--_0x505e4d){_0x4d41a5['push'](_0x4d41a5['shift']());}};_0x5852f3(++_0x1732a7);}(_0x02a6,0xb0));var _0x602a=function(_0x133014,_0x6bd8ac){_0x133014=_0x133014-0x0;var _0x444bad=_0x02a6[_0x133014];return _0x444bad;};'use strict';var _=require(_0x602a('0x0'));var util=require(_0x602a('0x1'));var logger=require('../../config/logger')(_0x602a('0x2'));var moment=require(_0x602a('0x3'));var BPromise=require(_0x602a('0x4'));var rp=require(_0x602a('0x5'));var fs=require('fs');var path=require(_0x602a('0x6'));var rimraf=require(_0x602a('0x7'));var config=require(_0x602a('0x8'));var attributes=require(_0x602a('0x9'));module[_0x602a('0xa')]=function(_0x412dfd,_0xf33b60){return _0x412dfd[_0x602a('0xb')](_0x602a('0xc'),attributes,{'tableName':_0x602a('0xd'),'paranoid':![],'indexes':[{'name':_0x602a('0xe'),'fields':[_0x602a('0xf'),_0x602a('0x10')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.rpc.js b/server/api/intDeskField/intDeskField.rpc.js index a45d555..4d6b5ec 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 _0x7d36=['../../config/utils','../../config/logger','rpc','../../config/environment','client','request','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x2fad50,_0x2fd2a6){var _0x314179=function(_0x50b284){while(--_0x50b284){_0x2fad50['push'](_0x2fad50['shift']());}};_0x314179(++_0x2fd2a6);}(_0x7d36,0x6c));var _0x67d3=function(_0x4fdf54,_0x38d439){_0x4fdf54=_0x4fdf54-0x0;var _0x3610cd=_0x7d36[_0x4fdf54];return _0x3610cd;};'use strict';var _=require(_0x67d3('0x0'));var util=require(_0x67d3('0x1'));var moment=require(_0x67d3('0x2'));var BPromise=require(_0x67d3('0x3'));var rs=require(_0x67d3('0x4'));var fs=require('fs');var Redis=require(_0x67d3('0x5'));var db=require(_0x67d3('0x6'))['db'];var utils=require(_0x67d3('0x7'));var logger=require(_0x67d3('0x8'))(_0x67d3('0x9'));var config=require(_0x67d3('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x67d3('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x53c426,_0x539fa2,_0x450dbe){return new BPromise(function(_0x593e97,_0x5417a3){return client[_0x67d3('0xc')](_0x53c426,_0x450dbe)['then'](function(_0x5616d8){logger['info'](_0x67d3('0xd'),_0x539fa2,_0x67d3('0xe'));logger[_0x67d3('0xf')](_0x67d3('0x10'),_0x539fa2,_0x67d3('0xe'),JSON[_0x67d3('0x11')](_0x5616d8));if(_0x5616d8[_0x67d3('0x12')]){if(_0x5616d8[_0x67d3('0x12')][_0x67d3('0x13')]===0x1f4){logger[_0x67d3('0x12')](_0x67d3('0xd'),_0x539fa2,_0x5616d8[_0x67d3('0x12')][_0x67d3('0x14')]);return _0x5417a3(_0x5616d8[_0x67d3('0x12')][_0x67d3('0x14')]);}logger[_0x67d3('0x12')](_0x67d3('0xd'),_0x539fa2,_0x5616d8[_0x67d3('0x12')][_0x67d3('0x14')]);return _0x593e97(_0x5616d8[_0x67d3('0x12')][_0x67d3('0x14')]);}else{logger['info']('DeskField,\x20%s,\x20%s',_0x539fa2,_0x67d3('0xe'));_0x593e97(_0x5616d8[_0x67d3('0x15')][_0x67d3('0x14')]);}})[_0x67d3('0x16')](function(_0x24f4ed){logger[_0x67d3('0x12')](_0x67d3('0xd'),_0x539fa2,_0x24f4ed);_0x5417a3(_0x24f4ed);});});} \ No newline at end of file +var _0x85af=['jayson/promise','client','http','info','request\x20sent','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','DeskField,\x20%s,\x20%s','message','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x333803,_0x5d16cc){var _0x2b04b4=function(_0xad9765){while(--_0xad9765){_0x333803['push'](_0x333803['shift']());}};_0x2b04b4(++_0x5d16cc);}(_0x85af,0xc0));var _0xf85a=function(_0x4b7a2e,_0xfec93b){_0x4b7a2e=_0x4b7a2e-0x0;var _0x48c612=_0x85af[_0x4b7a2e];return _0x48c612;};'use strict';var _=require('lodash');var util=require(_0xf85a('0x0'));var moment=require('moment');var BPromise=require(_0xf85a('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf85a('0x2'));var db=require(_0xf85a('0x3'))['db'];var utils=require(_0xf85a('0x4'));var logger=require(_0xf85a('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xf85a('0x6'));var client=jayson[_0xf85a('0x7')][_0xf85a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x386ee3,_0x4cd0a5,_0x19f917){return new BPromise(function(_0x4e85c3,_0xa3fe15){return client['request'](_0x386ee3,_0x19f917)['then'](function(_0x31045f){logger[_0xf85a('0x9')]('DeskField,\x20%s,\x20%s',_0x4cd0a5,_0xf85a('0xa'));logger['debug'](_0xf85a('0xb'),_0x4cd0a5,_0xf85a('0xa'),JSON[_0xf85a('0xc')](_0x31045f));if(_0x31045f[_0xf85a('0xd')]){if(_0x31045f[_0xf85a('0xd')]['code']===0x1f4){logger['error'](_0xf85a('0xe'),_0x4cd0a5,_0x31045f[_0xf85a('0xd')][_0xf85a('0xf')]);return _0xa3fe15(_0x31045f[_0xf85a('0xd')][_0xf85a('0xf')]);}logger[_0xf85a('0xd')](_0xf85a('0xe'),_0x4cd0a5,_0x31045f['error'][_0xf85a('0xf')]);return _0x4e85c3(_0x31045f['error'][_0xf85a('0xf')]);}else{logger[_0xf85a('0x9')](_0xf85a('0xe'),_0x4cd0a5,_0xf85a('0xa'));_0x4e85c3(_0x31045f[_0xf85a('0x10')][_0xf85a('0xf')]);}})[_0xf85a('0x11')](function(_0x33c115){logger[_0xf85a('0xd')](_0xf85a('0xe'),_0x4cd0a5,_0x33c115);_0xa3fe15(_0x33c115);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 1a397cb..0d6b6de 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 _0x4748=['addConfiguration','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDynamics365Account.controller','index','get','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','post'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4748,0x14e));var _0x8474=function(_0x2ebe8d,_0x4150a3){_0x2ebe8d=_0x2ebe8d-0x0;var _0x2c8de4=_0x4748[_0x2ebe8d];return _0x2c8de4;};'use strict';var multer=require(_0x8474('0x0'));var util=require('util');var path=require(_0x8474('0x1'));var timeout=require(_0x8474('0x2'));var express=require(_0x8474('0x3'));var router=express[_0x8474('0x4')]();var fs_extra=require(_0x8474('0x5'));var auth=require(_0x8474('0x6'));var interaction=require(_0x8474('0x7'));var config=require('../../config/environment');var controller=require(_0x8474('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x8474('0x9')]);router[_0x8474('0xa')](_0x8474('0xb'),auth[_0x8474('0xc')](),controller[_0x8474('0xd')]);router['get'](_0x8474('0xe'),auth[_0x8474('0xc')](),controller[_0x8474('0xf')]);router['get'](_0x8474('0x10'),auth[_0x8474('0xc')](),controller['getFields']);router[_0x8474('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0x8474('0x11')](_0x8474('0xe'),auth[_0x8474('0xc')](),controller[_0x8474('0x12')]);router['put'](_0x8474('0xb'),auth[_0x8474('0xc')](),controller['update']);router[_0x8474('0x13')](_0x8474('0xb'),auth[_0x8474('0xc')](),controller[_0x8474('0x14')]);module[_0x8474('0x15')]=router; \ No newline at end of file +var _0xa5c1=['./intDynamics365Account.controller','get','isAuthenticated','/:id','show','/:id/configurations','getFields','post','create','put','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x367aff,_0x3a83b3){var _0x50b3fa=function(_0x133c32){while(--_0x133c32){_0x367aff['push'](_0x367aff['shift']());}};_0x50b3fa(++_0x3a83b3);}(_0xa5c1,0xa5));var _0x1a5c=function(_0x12bd82,_0x2f89ca){_0x12bd82=_0x12bd82-0x0;var _0x1c8039=_0xa5c1[_0x12bd82];return _0x1c8039;};'use strict';var multer=require(_0x1a5c('0x0'));var util=require('util');var path=require(_0x1a5c('0x1'));var timeout=require(_0x1a5c('0x2'));var express=require(_0x1a5c('0x3'));var router=express[_0x1a5c('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x1a5c('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1a5c('0x6'));router[_0x1a5c('0x7')]('/',auth[_0x1a5c('0x8')](),controller['index']);router['get'](_0x1a5c('0x9'),auth['isAuthenticated'](),controller[_0x1a5c('0xa')]);router[_0x1a5c('0x7')](_0x1a5c('0xb'),auth[_0x1a5c('0x8')](),controller['getConfigurations']);router[_0x1a5c('0x7')]('/:id/fields',auth[_0x1a5c('0x8')](),controller[_0x1a5c('0xc')]);router[_0x1a5c('0xd')]('/',auth[_0x1a5c('0x8')](),controller[_0x1a5c('0xe')]);router[_0x1a5c('0xd')](_0x1a5c('0xb'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0x1a5c('0xf')]('/:id',auth[_0x1a5c('0x8')](),controller['update']);router[_0x1a5c('0x10')](_0x1a5c('0x9'),auth['isAuthenticated'](),controller[_0x1a5c('0x11')]);module[_0x1a5c('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index d837341..6f1c7e0 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 _0x6808=['BOOLEAN','sequelize','exports','STRING'];(function(_0x41d432,_0x20e878){var _0x1650f9=function(_0x27f177){while(--_0x27f177){_0x41d432['push'](_0x41d432['shift']());}};_0x1650f9(++_0x20e878);}(_0x6808,0xd1));var _0x8680=function(_0x3451ce,_0x4463ac){_0x3451ce=_0x3451ce-0x0;var _0xb78cfd=_0x6808[_0x3451ce];return _0xb78cfd;};'use strict';var Sequelize=require(_0x8680('0x0'));module[_0x8680('0x1')]={'name':{'type':Sequelize[_0x8680('0x2')]},'username':{'type':Sequelize[_0x8680('0x2')]},'password':{'type':Sequelize[_0x8680('0x2')]},'remoteUri':{'type':Sequelize[_0x8680('0x2')]},'tenantId':{'type':Sequelize[_0x8680('0x2')]},'clientId':{'type':Sequelize[_0x8680('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x8680('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x8680('0x2')]},'modernAuthentication':{'type':Sequelize[_0x8680('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0xae24=['STRING','BOOLEAN','sequelize'];(function(_0x5a6bd3,_0x1b50f3){var _0x1c8b2a=function(_0x3ee7d2){while(--_0x3ee7d2){_0x5a6bd3['push'](_0x5a6bd3['shift']());}};_0x1c8b2a(++_0x1b50f3);}(_0xae24,0x182));var _0x4ae2=function(_0x3eda75,_0x3f9bad){_0x3eda75=_0x3eda75-0x0;var _0xf47dc3=_0xae24[_0x3eda75];return _0xf47dc3;};'use strict';var Sequelize=require(_0x4ae2('0x0'));module['exports']={'name':{'type':Sequelize[_0x4ae2('0x1')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x4ae2('0x1')]},'remoteUri':{'type':Sequelize[_0x4ae2('0x1')]},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x4ae2('0x1')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x4ae2('0x1')]},'modernAuthentication':{'type':Sequelize[_0x4ae2('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 317a7b4..2ddcdff 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 _0xb0cb=['accountidyominame','actualserviceunits','contactidname','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entityimage_timestamp','entityimage_url','escalatedon','followupby','kbarticleidname','masteridname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','onholdtime','owneridname','owneridtype','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statecode','statuscode','timezoneruleversionnumber','transactioncurrencyidname','utcconversiontimezonecode','versionnumber','username','password','clientId','clientSecret','modernAuthentication','CloudProvider','data5','data7','remoteUri','https://login.microsoftonline.com/','tenantId','access_token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','4.0','MetadataId','EntityDefinitions(','Bearer\x20','Attributes','remove','LogicalName','forEach','@odata.type','substring','PicklistAttributeMetadata','push','all','isNil','lastIndexOf','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','DateTimeAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','concat','test','statusCode','error',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','OptionSet','Label','UserLocalizedLabel',')/Attributes(',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','FalseOption','false','DisplayName',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','request-promise','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','status','json','offset','undefined','count','limit','update','then','destroy','end','sendStatus','stack','name','map','Dynamics365Account','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','pick','where','merge','type','VIRTUAL','filter','includeAll','include','rows','catch','show','params','options','find','create','body','getConfigurations','findOne','Dynamics365Configuration','addConfiguration','AccountId','channel','Descriptions','getDescriptions','Dynamics365Field','slice','format','%s/api/data/v9.0/','getFields','ticketType','incident','title','description','customerid','ownerid','caseorigincode','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties'];(function(_0x24853d,_0x16931f){var _0x4c5cff=function(_0x5cdd14){while(--_0x5cdd14){_0x24853d['push'](_0x24853d['shift']());}};_0x4c5cff(++_0x16931f);}(_0xb0cb,0x1d0));var _0xbb0c=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xb0cb[_0x5d6456];return _0x4d66c1;};'use strict';var rp=require(_0xbb0c('0x0'));var util=require('util');var _=require(_0xbb0c('0x1'));var qs=require(_0xbb0c('0x2'));var logger=require(_0xbb0c('0x3'))(_0xbb0c('0x4'));var db=require(_0xbb0c('0x5'))['db'];var integrations=require(_0xbb0c('0x6'));function respondWithResult(_0x41f616,_0x22784f){_0x22784f=_0x22784f||0xc8;return function(_0xedba45){if(_0xedba45){return _0x41f616[_0xbb0c('0x7')](_0x22784f)[_0xbb0c('0x8')](_0xedba45);}};}function respondWithFilteredResult(_0x10a1f3,_0x2cdeae){return function(_0x3c6062){if(_0x3c6062){var _0x5c02ad=typeof _0x2cdeae[_0xbb0c('0x9')]===_0xbb0c('0xa')&&typeof _0x2cdeae['limit']===_0xbb0c('0xa');var _0x41f9bb=_0x3c6062[_0xbb0c('0xb')];var _0x5e8169=_0x5c02ad?0x0:_0x2cdeae[_0xbb0c('0x9')];var _0x716f71=_0x5c02ad?_0x3c6062['count']:_0x2cdeae[_0xbb0c('0x9')]+_0x2cdeae[_0xbb0c('0xc')];var _0x4701a9;if(_0x716f71>=_0x41f9bb){_0x716f71=_0x41f9bb;_0x4701a9=0xc8;}else{_0x4701a9=0xce;}_0x10a1f3[_0xbb0c('0x7')](_0x4701a9);return _0x10a1f3['set']('Content-Range',_0x5e8169+'-'+_0x716f71+'/'+_0x41f9bb)[_0xbb0c('0x8')](_0x3c6062);}return null;};}function saveUpdates(_0x22ca6c){return function(_0x2a2a89){if(_0x2a2a89){return _0x2a2a89[_0xbb0c('0xd')](_0x22ca6c)[_0xbb0c('0xe')](function(_0xcbe86b){return _0xcbe86b;});}return null;};}function removeEntity(_0x5c1262){return function(_0x13ff65){if(_0x13ff65){return _0x13ff65[_0xbb0c('0xf')]()[_0xbb0c('0xe')](function(){_0x5c1262[_0xbb0c('0x7')](0xcc)[_0xbb0c('0x10')]();});}};}function handleEntityNotFound(_0x5176c9){return function(_0x2d9ad5){if(!_0x2d9ad5){_0x5176c9[_0xbb0c('0x11')](0x194);}return _0x2d9ad5;};}function handleError(_0xf52e84,_0x1ecbfe){_0x1ecbfe=_0x1ecbfe||0x1f4;return function(_0x2987e9){logger['error'](_0x2987e9[_0xbb0c('0x12')]);if(_0x2987e9[_0xbb0c('0x13')]){delete _0x2987e9['name'];}_0xf52e84['status'](_0x1ecbfe)['send'](_0x2987e9);};}exports['index']=function(_0x19c53c,_0x3b9982){var _0x5460b1={},_0x5e6d75={},_0x1f9d90={'count':0x0,'rows':[]};var _0x5cef56=_[_0xbb0c('0x14')](db[_0xbb0c('0x15')][_0xbb0c('0x16')],function(_0x42ba2e){return{'name':_0x42ba2e[_0xbb0c('0x17')],'type':_0x42ba2e['type'][_0xbb0c('0x18')]};});_0x5e6d75[_0xbb0c('0x19')]=_['map'](_0x5cef56,_0xbb0c('0x13'));_0x5e6d75[_0xbb0c('0x1a')]=_[_0xbb0c('0x1b')](_0x19c53c[_0xbb0c('0x1a')]);_0x5e6d75[_0xbb0c('0x1c')]=_['intersection'](_0x5e6d75['model'],_0x5e6d75['query']);_0x5460b1[_0xbb0c('0x1d')]=_[_0xbb0c('0x1e')](_0x5e6d75['model'],qs['fields'](_0x19c53c[_0xbb0c('0x1a')][_0xbb0c('0x1f')]));_0x5460b1[_0xbb0c('0x1d')]=_0x5460b1[_0xbb0c('0x1d')][_0xbb0c('0x20')]?_0x5460b1['attributes']:_0x5e6d75[_0xbb0c('0x19')];if(!_0x19c53c[_0xbb0c('0x1a')]['hasOwnProperty'](_0xbb0c('0x21'))){_0x5460b1['limit']=qs['limit'](_0x19c53c[_0xbb0c('0x1a')][_0xbb0c('0xc')]);_0x5460b1[_0xbb0c('0x9')]=qs[_0xbb0c('0x9')](_0x19c53c[_0xbb0c('0x1a')][_0xbb0c('0x9')]);}_0x5460b1[_0xbb0c('0x22')]=qs[_0xbb0c('0x23')](_0x19c53c[_0xbb0c('0x1a')][_0xbb0c('0x23')]);_0x5460b1['where']=qs[_0xbb0c('0x1c')](_[_0xbb0c('0x24')](_0x19c53c['query'],_0x5e6d75[_0xbb0c('0x1c')]),_0x5cef56);if(_0x19c53c[_0xbb0c('0x1a')]['filter']){_0x5460b1[_0xbb0c('0x25')]=_[_0xbb0c('0x26')](_0x5460b1['where'],{'$or':_[_0xbb0c('0x14')](_0x5cef56,function(_0x52eb5b){if(_0x52eb5b[_0xbb0c('0x27')]!==_0xbb0c('0x28')){var _0x1ba82f={};_0x1ba82f[_0x52eb5b[_0xbb0c('0x13')]]={'$like':'%'+_0x19c53c[_0xbb0c('0x1a')][_0xbb0c('0x29')]+'%'};return _0x1ba82f;}})});}_0x5460b1=_[_0xbb0c('0x26')]({},_0x5460b1,_0x19c53c['options']);var _0x156d78={'where':_0x5460b1[_0xbb0c('0x25')]};return db[_0xbb0c('0x15')][_0xbb0c('0xb')](_0x156d78)[_0xbb0c('0xe')](function(_0x2ebc5c){_0x1f9d90[_0xbb0c('0xb')]=_0x2ebc5c;if(_0x19c53c[_0xbb0c('0x1a')][_0xbb0c('0x2a')]){_0x5460b1[_0xbb0c('0x2b')]=[{'all':!![]}];}return db[_0xbb0c('0x15')]['findAll'](_0x5460b1);})[_0xbb0c('0xe')](function(_0x42e818){_0x1f9d90[_0xbb0c('0x2c')]=_0x42e818;return _0x1f9d90;})['then'](respondWithFilteredResult(_0x3b9982,_0x5460b1))[_0xbb0c('0x2d')](handleError(_0x3b9982,null));};exports[_0xbb0c('0x2e')]=function(_0x284dc0,_0x2d4f87){var _0x558fa4={'raw':![],'where':{'id':_0x284dc0[_0xbb0c('0x2f')]['id']}},_0x56883e={};_0x56883e['model']=_[_0xbb0c('0x1b')](db[_0xbb0c('0x15')][_0xbb0c('0x16')]);_0x56883e['query']=_[_0xbb0c('0x1b')](_0x284dc0[_0xbb0c('0x1a')]);_0x56883e[_0xbb0c('0x1c')]=_[_0xbb0c('0x1e')](_0x56883e[_0xbb0c('0x19')],_0x56883e['query']);_0x558fa4['attributes']=_[_0xbb0c('0x1e')](_0x56883e['model'],qs[_0xbb0c('0x1f')](_0x284dc0['query']['fields']));_0x558fa4[_0xbb0c('0x1d')]=_0x558fa4['attributes'][_0xbb0c('0x20')]?_0x558fa4[_0xbb0c('0x1d')]:_0x56883e[_0xbb0c('0x19')];if(_0x284dc0[_0xbb0c('0x1a')][_0xbb0c('0x2a')]){_0x558fa4['include']=[{'all':!![]}];}_0x558fa4=_[_0xbb0c('0x26')]({},_0x558fa4,_0x284dc0[_0xbb0c('0x30')]);return db['Dynamics365Account'][_0xbb0c('0x31')](_0x558fa4)[_0xbb0c('0xe')](handleEntityNotFound(_0x2d4f87,null))[_0xbb0c('0xe')](respondWithResult(_0x2d4f87,null))[_0xbb0c('0x2d')](handleError(_0x2d4f87,null));};exports['create']=function(_0x3c595f,_0x481a21){return db[_0xbb0c('0x15')][_0xbb0c('0x32')](_0x3c595f[_0xbb0c('0x33')],{})['then'](respondWithResult(_0x481a21,0xc9))[_0xbb0c('0x2d')](handleError(_0x481a21,null));};exports[_0xbb0c('0xd')]=function(_0x2eaa01,_0x399069){if(_0x2eaa01[_0xbb0c('0x33')]['id']){delete _0x2eaa01[_0xbb0c('0x33')]['id'];}return db[_0xbb0c('0x15')]['find']({'where':{'id':_0x2eaa01[_0xbb0c('0x2f')]['id']}})['then'](handleEntityNotFound(_0x399069,null))[_0xbb0c('0xe')](saveUpdates(_0x2eaa01['body'],null))[_0xbb0c('0xe')](respondWithResult(_0x399069,null))[_0xbb0c('0x2d')](handleError(_0x399069,null));};exports['destroy']=function(_0x42e87f,_0x446596){return db['Dynamics365Account'][_0xbb0c('0x31')]({'where':{'id':_0x42e87f[_0xbb0c('0x2f')]['id']}})[_0xbb0c('0xe')](handleEntityNotFound(_0x446596,null))[_0xbb0c('0xe')](removeEntity(_0x446596,null))[_0xbb0c('0x2d')](handleError(_0x446596,null));};exports[_0xbb0c('0x34')]=function(_0x5cdedd,_0x5b842a){var _0x1a1577={};var _0x235789={};var _0x2d1440;var _0x114814;return db[_0xbb0c('0x15')][_0xbb0c('0x35')]({'where':{'id':_0x5cdedd['params']['id']}})[_0xbb0c('0xe')](handleEntityNotFound(_0x5b842a,null))[_0xbb0c('0xe')](function(_0x51007c){if(_0x51007c){_0x2d1440=_0x51007c;_0x235789[_0xbb0c('0x19')]=_[_0xbb0c('0x1b')](db[_0xbb0c('0x36')]['rawAttributes']);_0x235789[_0xbb0c('0x1a')]=_[_0xbb0c('0x1b')](_0x5cdedd[_0xbb0c('0x1a')]);_0x235789['filters']=_[_0xbb0c('0x1e')](_0x235789['model'],_0x235789[_0xbb0c('0x1a')]);_0x1a1577['attributes']=_['intersection'](_0x235789[_0xbb0c('0x19')],qs[_0xbb0c('0x1f')](_0x5cdedd[_0xbb0c('0x1a')]['fields']));_0x1a1577[_0xbb0c('0x1d')]=_0x1a1577[_0xbb0c('0x1d')][_0xbb0c('0x20')]?_0x1a1577[_0xbb0c('0x1d')]:_0x235789[_0xbb0c('0x19')];_0x1a1577['order']=qs[_0xbb0c('0x23')](_0x5cdedd['query']['sort']);_0x1a1577[_0xbb0c('0x25')]=qs['filters'](_[_0xbb0c('0x24')](_0x5cdedd[_0xbb0c('0x1a')],_0x235789[_0xbb0c('0x1c')]));if(_0x5cdedd[_0xbb0c('0x1a')][_0xbb0c('0x29')]){_0x1a1577[_0xbb0c('0x25')]=_[_0xbb0c('0x26')](_0x1a1577['where'],{'$or':_[_0xbb0c('0x14')](_0x1a1577[_0xbb0c('0x1d')],function(_0x55a825){var _0x493b2f={};_0x493b2f[_0x55a825]={'$like':'%'+_0x5cdedd[_0xbb0c('0x1a')][_0xbb0c('0x29')]+'%'};return _0x493b2f;})});}_0x1a1577=_['merge']({},_0x1a1577,_0x5cdedd[_0xbb0c('0x30')]);return _0x2d1440[_0xbb0c('0x34')](_0x1a1577);}})['then'](function(_0x33201f){if(_0x33201f){_0x114814=_0x33201f[_0xbb0c('0x20')];if(!_0x5cdedd[_0xbb0c('0x1a')]['hasOwnProperty'](_0xbb0c('0x21'))){_0x1a1577[_0xbb0c('0xc')]=qs[_0xbb0c('0xc')](_0x5cdedd[_0xbb0c('0x1a')][_0xbb0c('0xc')]);_0x1a1577[_0xbb0c('0x9')]=qs[_0xbb0c('0x9')](_0x5cdedd[_0xbb0c('0x1a')][_0xbb0c('0x9')]);}return _0x2d1440[_0xbb0c('0x34')](_0x1a1577);}})[_0xbb0c('0xe')](function(_0x33a718){if(_0x33a718){return _0x33a718?{'count':_0x114814,'rows':_0x33a718}:null;}})[_0xbb0c('0xe')](respondWithResult(_0x5b842a,null))[_0xbb0c('0x2d')](handleError(_0x5b842a,null));};exports[_0xbb0c('0x37')]=function(_0x264312,_0x58a94e){if(_0x264312[_0xbb0c('0x33')]['id']){delete _0x264312['body']['id'];}return db[_0xbb0c('0x15')]['findOne']({'where':{'id':_0x264312[_0xbb0c('0x2f')]['id']}})[_0xbb0c('0xe')](handleEntityNotFound(_0x58a94e,null))['then'](function(_0x166b35){if(_0x166b35){_0x264312[_0xbb0c('0x33')][_0xbb0c('0x38')]=_0x166b35['id'];_0x264312[_0xbb0c('0x33')]['Subjects']=integrations['getSubjects'](_0x264312[_0xbb0c('0x33')][_0xbb0c('0x39')],_0x264312[_0xbb0c('0x33')][_0xbb0c('0x27')]);_0x264312[_0xbb0c('0x33')][_0xbb0c('0x3a')]=integrations[_0xbb0c('0x3b')](_0x264312[_0xbb0c('0x33')][_0xbb0c('0x39')],_0x264312[_0xbb0c('0x33')][_0xbb0c('0x27')]);return db[_0xbb0c('0x36')]['create'](_0x264312[_0xbb0c('0x33')],{'include':[{'model':db[_0xbb0c('0x3c')],'as':'Subjects'},{'model':db[_0xbb0c('0x3c')],'as':_0xbb0c('0x3a')}]});}return null;})['then'](respondWithResult(_0x58a94e,null))[_0xbb0c('0x2d')](handleError(_0x58a94e,null));};function sanitizeRemoteUri(_0x565e17){var _0x332b90=_0x565e17[_0xbb0c('0x3d')](-0x1);if(_0x332b90==='/')return _0x565e17['substring'](0x0,_0x565e17['lastIndexOf'](_0x332b90));return _0x565e17;}function getWebApiUrl(_0xb997bf){return util[_0xbb0c('0x3e')](_0xbb0c('0x3f'),_0xb997bf);}exports[_0xbb0c('0x40')]=function(_0x5f3f12,_0x166984){var _0x1bc471=_0x5f3f12[_0xbb0c('0x1a')][_0xbb0c('0x41')];var _0x2454ce=_0x1bc471===_0xbb0c('0x42')?'Incident':'PhoneCall';var _0x199a8e='';var _0x104a3d='';var _0x3bf2f0='';var _0x467990='';var _0x90b48f='';var _0x2de891='';var _0x4655d8='';var _0x2b5954='';var _0x57f4a2=[_0xbb0c('0x43'),_0xbb0c('0x44'),_0xbb0c('0x45'),_0xbb0c('0x46'),_0xbb0c('0x47'),'subject',_0xbb0c('0x48'),_0xbb0c('0x49'),_0xbb0c('0x4a'),_0xbb0c('0x4b')];var _0x3b8235=['accountidname',_0xbb0c('0x4c'),_0xbb0c('0x4d'),'billedserviceunits',_0xbb0c('0x4e'),'contactidyominame',_0xbb0c('0x4f'),_0xbb0c('0x50'),_0xbb0c('0x51'),_0xbb0c('0x52'),_0xbb0c('0x53'),'createdbyyominame',_0xbb0c('0x54'),_0xbb0c('0x55'),_0xbb0c('0x56'),_0xbb0c('0x57'),_0xbb0c('0x58'),_0xbb0c('0x59'),_0xbb0c('0x5a'),'entitlementidname',_0xbb0c('0x5b'),_0xbb0c('0x5c'),_0xbb0c('0x5d'),'exchangerate','firstresponsebykpiidname',_0xbb0c('0x5e'),'importsequencenumber','influencescore',_0xbb0c('0x5f'),'lastonholdtime',_0xbb0c('0x60'),'modifiedbyexternalpartyname',_0xbb0c('0x61'),_0xbb0c('0x62'),_0xbb0c('0x63'),_0xbb0c('0x64'),_0xbb0c('0x65'),_0xbb0c('0x66'),_0xbb0c('0x67'),_0xbb0c('0x68'),'numberofchildincidents',_0xbb0c('0x69'),'overriddencreatedon',_0xbb0c('0x6a'),_0xbb0c('0x6b'),'owneridyominame',_0xbb0c('0x6c'),_0xbb0c('0x6d'),_0xbb0c('0x6e'),_0xbb0c('0x6f'),_0xbb0c('0x70'),_0xbb0c('0x71'),_0xbb0c('0x72'),_0xbb0c('0x73'),_0xbb0c('0x74'),'responsiblecontactidname',_0xbb0c('0x75'),_0xbb0c('0x76'),_0xbb0c('0x77'),_0xbb0c('0x78'),_0xbb0c('0x79'),_0xbb0c('0x7a'),_0xbb0c('0x7b'),'subjectidname','ticketnumber',_0xbb0c('0x7c'),_0xbb0c('0x7d'),'traversedpath',_0xbb0c('0x7e'),_0xbb0c('0x7f')];var _0x33bdc7=_0x57f4a2['concat'](_0x3b8235);return db['Dynamics365Account'][_0xbb0c('0x35')]({'where':{'id':_0x5f3f12['params']['id']},'attributes':['id',_0xbb0c('0x80'),_0xbb0c('0x81'),'remoteUri','tenantId',_0xbb0c('0x82'),_0xbb0c('0x83'),_0xbb0c('0x84')],'include':[{'model':db[_0xbb0c('0x85')],'as':_0xbb0c('0x85'),'attributes':['id',_0xbb0c('0x86'),_0xbb0c('0x87')]}]})[_0xbb0c('0xe')](handleEntityNotFound(_0x166984,null))[_0xbb0c('0xe')](function(_0x99417c){if(_0x99417c){if(_0x99417c[_0xbb0c('0x84')]){_0x99417c['access_token']=_0x99417c[_0xbb0c('0x85')]['data5'];_0x2b5954=sanitizeRemoteUri(_0x99417c['CloudProvider'][_0xbb0c('0x87')]);_0x4655d8=getWebApiUrl(_0x2b5954);return _0x99417c;}_0x2b5954=sanitizeRemoteUri(_0x99417c[_0xbb0c('0x88')]);_0x4655d8=getWebApiUrl(_0x2b5954);var _0x1aad06={'method':'POST','uri':_0xbb0c('0x89')+_0x99417c[_0xbb0c('0x8a')]+'/oauth2/token','form':{'client_id':_0x99417c[_0xbb0c('0x82')],'resource':_0x2b5954,'username':_0x99417c[_0xbb0c('0x80')],'password':_0x99417c['password'],'grant_type':'password','client_secret':_0x99417c[_0xbb0c('0x83')]},'json':!![]};return rp(_0x1aad06);}})[_0xbb0c('0xe')](function(_0xeb99db){_0x2de891=_0xeb99db[_0xbb0c('0x8b')];var _0x132cb5={'method':_0xbb0c('0x8c'),'uri':encodeURI(_0x4655d8+_0xbb0c('0x8d')+_0x2454ce+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x2de891,'If-None-Match':null,'OData-Version':_0xbb0c('0x8e')},'json':!![]};return rp(_0x132cb5);})[_0xbb0c('0xe')](function(_0x124956){var _0x9369f=_0x124956['value'][0x0];var _0x379d44=_0x9369f[_0xbb0c('0x8f')];var _0x21375a={'method':_0xbb0c('0x8c'),'uri':_0x4655d8+_0xbb0c('0x90')+_0x379d44+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':_0xbb0c('0x91')+_0x2de891,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x21375a);})[_0xbb0c('0xe')](function(_0x4fad06){_0x199a8e=_0x4fad06;_0x104a3d=_0x199a8e[_0xbb0c('0x92')];_0x104a3d=_[_0xbb0c('0x93')](_0x104a3d,function(_0x2e8102){return!_0x33bdc7['includes'](_0x2e8102[_0xbb0c('0x94')]);});var _0x330591=[];var _0x37b924=[];_0x104a3d[_0xbb0c('0x95')](function(_0x359f25){if(_0x359f25[_0xbb0c('0x96')]){var _0x1ef8ed=_0x359f25['@odata.type'][_0xbb0c('0x97')](_0x359f25['@odata.type']['lastIndexOf']('.')+0x1);if(_0x1ef8ed===_0xbb0c('0x98')){_0x330591[_0xbb0c('0x99')](getSelectList(_0x4655d8,_0x1bc471,_0x37b924,_0x199a8e['MetadataId'],_0x359f25[_0xbb0c('0x8f')],_0x2de891));}}});return Promise[_0xbb0c('0x9a')](_0x330591);})['then'](function(_0x3ec26f){_0x3bf2f0=_0x3ec26f[0x0];var _0x1d7016=[];var _0xa9910d=[];_0x104a3d['forEach'](function(_0xa1ee27){if(!_[_0xbb0c('0x9b')](_0xa1ee27[_0xbb0c('0x96')])){var _0x245ef1=_0xa1ee27[_0xbb0c('0x96')][_0xbb0c('0x97')](_0xa1ee27['@odata.type']['lastIndexOf']('.')+0x1);if(_0x245ef1==='BooleanAttributeMetadata'){_0x1d7016['push'](getBooleanList(_0x4655d8,_0x1bc471,_0xa9910d,_0x199a8e[_0xbb0c('0x8f')],_0xa1ee27['MetadataId'],_0x2de891));}}});return Promise['all'](_0x1d7016);})[_0xbb0c('0xe')](function(_0x3f500c){_0x467990=_0x3f500c[0x0];var _0x526e05=[];var _0x10c2e0=[];_0x104a3d[_0xbb0c('0x95')](function(_0x11d814){if(_0x11d814[_0xbb0c('0x96')]){var _0x1e702f=_0x11d814[_0xbb0c('0x96')]['substring'](_0x11d814[_0xbb0c('0x96')][_0xbb0c('0x9c')]('.')+0x1);if(_0x1e702f===_0xbb0c('0x9d')||_0x1e702f===_0xbb0c('0x9e')||_0x1e702f===_0xbb0c('0x9f')||_0x1e702f==='IntegerAttributeMetadata'||_0x1e702f==='MemoAttributeMetadata'||_0x1e702f===_0xbb0c('0xa0')||_0x1e702f==='StatusAttributeMetadata'||_0x1e702f===_0xbb0c('0xa1')||_0x1e702f===_0xbb0c('0xa2')||_0x1e702f==='DecimalAttributeMetadata'){_0x526e05[_0xbb0c('0x99')](getInputList(_0x4655d8,_0x1bc471,_0x1e702f,_0x10c2e0,_0x199a8e[_0xbb0c('0x8f')],_0x11d814['MetadataId'],_0x2de891));}}});return Promise[_0xbb0c('0x9a')](_0x526e05);})[_0xbb0c('0xe')](function(_0x5433fd){_0x90b48f=_0x5433fd[0x0];var _0xd3e82b=_0x3bf2f0[_0xbb0c('0xa3')](_0x467990)[_0xbb0c('0xa3')](_0x90b48f);var _0x4851f6={'count':_0xd3e82b['length'],'rows':_0xd3e82b};return _0x4851f6;})['then'](respondWithResult(_0x166984,null))[_0xbb0c('0x2d')](function(_0x2a381c){var _0x15b8f8=_0x5f3f12['query'][_0xbb0c('0xa4')]?0x1f4:_0x2a381c[_0xbb0c('0xa5')]||0x1f4;logger[_0xbb0c('0xa6')](_0x2a381c[_0xbb0c('0x12')]);delete _0x2a381c[_0xbb0c('0x13')];if(_0x15b8f8===0x191){_0x15b8f8=0x190;}_0x166984[_0xbb0c('0x7')](_0x15b8f8)['send'](_0x5f3f12[_0xbb0c('0x1a')][_0xbb0c('0xa4')]?{'message':'Wrong\x20credentials','statusCode':_0x2a381c[_0xbb0c('0xa5')]}:_0x2a381c);});};function getSelectList(_0x4a657b,_0x485bb4,_0x2590ce,_0x16e129,_0x5ed15c,_0x1a807e){var _0x166514={'method':_0xbb0c('0x8c'),'uri':_0x4a657b+'EntityDefinitions('+_0x16e129+')/Attributes('+_0x5ed15c+_0xbb0c('0xa7')+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':'Bearer\x20'+_0x1a807e,'If-None-Match':null,'OData-Version':_0xbb0c('0x8e')},'json':!![]};return rp(_0x166514)[_0xbb0c('0xe')](function(_0x9b0fc2){var _0x2edea9=[];var _0x99a4ef=_0x9b0fc2[_0xbb0c('0xa8')]['Options'];_0x99a4ef[_0xbb0c('0x95')](function(_0x1673c8){_0x2edea9['push']({'name':_0x1673c8[_0xbb0c('0xa9')][_0xbb0c('0xaa')][_0xbb0c('0xa9')],'value':String(_0x1673c8['Value'])});});var _0x5c444a={'id':_0x485bb4+'_'+_0x9b0fc2[_0xbb0c('0x94')],'name':_0x9b0fc2['DisplayName']['UserLocalizedLabel'][_0xbb0c('0xa9')],'custom':![],'options':_0x2edea9};_0x2590ce[_0xbb0c('0x99')](_0x5c444a);return _0x2590ce;});}function getBooleanList(_0x570ee1,_0x9e4254,_0x5cb773,_0x2270b2,_0x2446cc,_0x187af3){var _0x32ad14={'method':_0xbb0c('0x8c'),'uri':_0x570ee1+'EntityDefinitions('+_0x2270b2+_0xbb0c('0xab')+_0x2446cc+_0xbb0c('0xac'),'headers':{'Authorization':_0xbb0c('0x91')+_0x187af3,'If-None-Match':null,'OData-Version':_0xbb0c('0x8e')},'json':!![]};return rp(_0x32ad14)['then'](function(_0x3edc1e){var _0x396e2b=[];_0x396e2b[_0xbb0c('0x99')]({'name':_0x3edc1e[_0xbb0c('0xa8')][_0xbb0c('0xad')][_0xbb0c('0xa9')][_0xbb0c('0xaa')][_0xbb0c('0xa9')],'value':_0xbb0c('0xae')},{'name':_0x3edc1e['OptionSet'][_0xbb0c('0xaf')][_0xbb0c('0xa9')][_0xbb0c('0xaa')][_0xbb0c('0xa9')],'value':_0xbb0c('0xb0')});var _0x3fdd48={'id':_0x9e4254+'_'+_0x3edc1e[_0xbb0c('0x94')],'name':_0x3edc1e[_0xbb0c('0xb1')][_0xbb0c('0xaa')]['Label'],'custom':![],'options':_0x396e2b};_0x5cb773['push'](_0x3fdd48);return _0x5cb773;});}function getInputList(_0x21cd51,_0x59f75e,_0x317d2a,_0x268cbb,_0x412eea,_0x1a7fd3,_0x2bb7ce){var _0x7b9da1={'method':_0xbb0c('0x8c'),'uri':_0x21cd51+_0xbb0c('0x90')+_0x412eea+_0xbb0c('0xab')+_0x1a7fd3+_0xbb0c('0xb2')+_0x317d2a+_0xbb0c('0xb3'),'headers':{'Authorization':_0xbb0c('0x91')+_0x2bb7ce,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x7b9da1)[_0xbb0c('0xe')](function(_0x44f609){var _0x58e497={'id':_0x59f75e+'_'+_0x44f609[_0xbb0c('0x94')],'name':_0x44f609[_0xbb0c('0xb1')][_0xbb0c('0xaa')]?_0x44f609['DisplayName']['UserLocalizedLabel']['Label']:_0x44f609[_0xbb0c('0x94')],'custom':![],'options':[]};_0x268cbb['push'](_0x58e497);return _0x268cbb;});} \ No newline at end of file +var _0xbee7=['exchangerate','firstresponsebykpiidname','followupby','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyname','modifiedbyyominame','modifiedonbehalfbyname','msdyn_iotalertname','numberofchildincidents','onholdtime','owneridname','owneridtype','parentcaseidname','primarycontactidname','primarycontactidyominame','productidname','productserialnumber','resolveby','resolvebykpiidname','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','utcconversiontimezonecode','versionnumber','concat','username','password','remoteUri','tenantId','clientId','clientSecret','modernAuthentication','CloudProvider','data7','access_token','data5','POST','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','value',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','4.0','Attributes','includes','LogicalName','@odata.type','PicklistAttributeMetadata','push','MetadataId','all','forEach','isNil','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','DecimalAttributeMetadata','test','statusCode','Wrong\x20credentials','GET','EntityDefinitions(',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel','Value',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','FalseOption','DisplayName','?$select=DisplayName,LogicalName','request-promise','util','lodash','../../components/parsers/qs','../../config/logger','api','status','offset','undefined','limit','count','set','Content-Range','destroy','then','sendStatus','error','stack','name','send','index','Dynamics365Account','rawAttributes','key','query','keys','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','map','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','filters','length','find','create','body','getConfigurations','Dynamics365Configuration','findOne','AccountId','Subjects','channel','Descriptions','getDescriptions','Dynamics365Field','substring','lastIndexOf','format','%s/api/data/v9.0/','getFields','ticketType','incident','title','customerid','ownerid','caseorigincode','subject','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon'];(function(_0x461a54,_0x4fcd3d){var _0x234455=function(_0x229330){while(--_0x229330){_0x461a54['push'](_0x461a54['shift']());}};_0x234455(++_0x4fcd3d);}(_0xbee7,0x1c6));var _0x7bee=function(_0x195601,_0xdae54f){_0x195601=_0x195601-0x0;var _0x5263d6=_0xbee7[_0x195601];return _0x5263d6;};'use strict';var rp=require(_0x7bee('0x0'));var util=require(_0x7bee('0x1'));var _=require(_0x7bee('0x2'));var qs=require(_0x7bee('0x3'));var logger=require(_0x7bee('0x4'))(_0x7bee('0x5'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithResult(_0x46c318,_0x40605b){_0x40605b=_0x40605b||0xc8;return function(_0x376a66){if(_0x376a66){return _0x46c318[_0x7bee('0x6')](_0x40605b)['json'](_0x376a66);}};}function respondWithFilteredResult(_0x379003,_0x432253){return function(_0x14c133){if(_0x14c133){var _0x11d084=typeof _0x432253[_0x7bee('0x7')]===_0x7bee('0x8')&&typeof _0x432253[_0x7bee('0x9')]===_0x7bee('0x8');var _0x3f3a7b=_0x14c133[_0x7bee('0xa')];var _0x5b04c5=_0x11d084?0x0:_0x432253[_0x7bee('0x7')];var _0x7d7b25=_0x11d084?_0x14c133[_0x7bee('0xa')]:_0x432253[_0x7bee('0x7')]+_0x432253[_0x7bee('0x9')];var _0x3dc251;if(_0x7d7b25>=_0x3f3a7b){_0x7d7b25=_0x3f3a7b;_0x3dc251=0xc8;}else{_0x3dc251=0xce;}_0x379003[_0x7bee('0x6')](_0x3dc251);return _0x379003[_0x7bee('0xb')](_0x7bee('0xc'),_0x5b04c5+'-'+_0x7d7b25+'/'+_0x3f3a7b)['json'](_0x14c133);}return null;};}function saveUpdates(_0x4fd947){return function(_0x100ac9){if(_0x100ac9){return _0x100ac9['update'](_0x4fd947)['then'](function(_0x50159a){return _0x50159a;});}return null;};}function removeEntity(_0x2c0db4){return function(_0x47a8c1){if(_0x47a8c1){return _0x47a8c1[_0x7bee('0xd')]()[_0x7bee('0xe')](function(){_0x2c0db4[_0x7bee('0x6')](0xcc)['end']();});}};}function handleEntityNotFound(_0x342178){return function(_0x33a0e4){if(!_0x33a0e4){_0x342178[_0x7bee('0xf')](0x194);}return _0x33a0e4;};}function handleError(_0x6088b8,_0x46016c){_0x46016c=_0x46016c||0x1f4;return function(_0x36cb0e){logger[_0x7bee('0x10')](_0x36cb0e[_0x7bee('0x11')]);if(_0x36cb0e['name']){delete _0x36cb0e[_0x7bee('0x12')];}_0x6088b8[_0x7bee('0x6')](_0x46016c)[_0x7bee('0x13')](_0x36cb0e);};}exports[_0x7bee('0x14')]=function(_0x375944,_0x7a577){var _0x583d5b={},_0x49d74b={},_0x9bb08d={'count':0x0,'rows':[]};var _0x69c44d=_['map'](db[_0x7bee('0x15')][_0x7bee('0x16')],function(_0x443a0a){return{'name':_0x443a0a['fieldName'],'type':_0x443a0a['type'][_0x7bee('0x17')]};});_0x49d74b['model']=_['map'](_0x69c44d,_0x7bee('0x12'));_0x49d74b[_0x7bee('0x18')]=_[_0x7bee('0x19')](_0x375944[_0x7bee('0x18')]);_0x49d74b['filters']=_['intersection'](_0x49d74b[_0x7bee('0x1a')],_0x49d74b[_0x7bee('0x18')]);_0x583d5b[_0x7bee('0x1b')]=_[_0x7bee('0x1c')](_0x49d74b[_0x7bee('0x1a')],qs[_0x7bee('0x1d')](_0x375944[_0x7bee('0x18')][_0x7bee('0x1d')]));_0x583d5b[_0x7bee('0x1b')]=_0x583d5b[_0x7bee('0x1b')]['length']?_0x583d5b['attributes']:_0x49d74b[_0x7bee('0x1a')];if(!_0x375944[_0x7bee('0x18')][_0x7bee('0x1e')](_0x7bee('0x1f'))){_0x583d5b[_0x7bee('0x9')]=qs[_0x7bee('0x9')](_0x375944[_0x7bee('0x18')]['limit']);_0x583d5b[_0x7bee('0x7')]=qs[_0x7bee('0x7')](_0x375944[_0x7bee('0x18')]['offset']);}_0x583d5b[_0x7bee('0x20')]=qs['sort'](_0x375944[_0x7bee('0x18')][_0x7bee('0x21')]);_0x583d5b['where']=qs['filters'](_[_0x7bee('0x22')](_0x375944[_0x7bee('0x18')],_0x49d74b['filters']),_0x69c44d);if(_0x375944[_0x7bee('0x18')][_0x7bee('0x23')]){_0x583d5b[_0x7bee('0x24')]=_[_0x7bee('0x25')](_0x583d5b[_0x7bee('0x24')],{'$or':_[_0x7bee('0x26')](_0x69c44d,function(_0x4fb5ab){if(_0x4fb5ab[_0x7bee('0x27')]!==_0x7bee('0x28')){var _0x55373c={};_0x55373c[_0x4fb5ab[_0x7bee('0x12')]]={'$like':'%'+_0x375944[_0x7bee('0x18')][_0x7bee('0x23')]+'%'};return _0x55373c;}})});}_0x583d5b=_[_0x7bee('0x25')]({},_0x583d5b,_0x375944[_0x7bee('0x29')]);var _0x300f13={'where':_0x583d5b[_0x7bee('0x24')]};return db[_0x7bee('0x15')]['count'](_0x300f13)[_0x7bee('0xe')](function(_0x4d5211){_0x9bb08d[_0x7bee('0xa')]=_0x4d5211;if(_0x375944['query'][_0x7bee('0x2a')]){_0x583d5b[_0x7bee('0x2b')]=[{'all':!![]}];}return db[_0x7bee('0x15')][_0x7bee('0x2c')](_0x583d5b);})['then'](function(_0x22bf0a){_0x9bb08d[_0x7bee('0x2d')]=_0x22bf0a;return _0x9bb08d;})['then'](respondWithFilteredResult(_0x7a577,_0x583d5b))[_0x7bee('0x2e')](handleError(_0x7a577,null));};exports[_0x7bee('0x2f')]=function(_0x1f2753,_0x41ec85){var _0x109f50={'raw':![],'where':{'id':_0x1f2753[_0x7bee('0x30')]['id']}},_0x191400={};_0x191400['model']=_[_0x7bee('0x19')](db[_0x7bee('0x15')]['rawAttributes']);_0x191400[_0x7bee('0x18')]=_[_0x7bee('0x19')](_0x1f2753[_0x7bee('0x18')]);_0x191400[_0x7bee('0x31')]=_[_0x7bee('0x1c')](_0x191400[_0x7bee('0x1a')],_0x191400[_0x7bee('0x18')]);_0x109f50[_0x7bee('0x1b')]=_[_0x7bee('0x1c')](_0x191400[_0x7bee('0x1a')],qs[_0x7bee('0x1d')](_0x1f2753[_0x7bee('0x18')]['fields']));_0x109f50[_0x7bee('0x1b')]=_0x109f50[_0x7bee('0x1b')][_0x7bee('0x32')]?_0x109f50[_0x7bee('0x1b')]:_0x191400[_0x7bee('0x1a')];if(_0x1f2753['query'][_0x7bee('0x2a')]){_0x109f50[_0x7bee('0x2b')]=[{'all':!![]}];}_0x109f50=_['merge']({},_0x109f50,_0x1f2753[_0x7bee('0x29')]);return db[_0x7bee('0x15')][_0x7bee('0x33')](_0x109f50)[_0x7bee('0xe')](handleEntityNotFound(_0x41ec85,null))[_0x7bee('0xe')](respondWithResult(_0x41ec85,null))['catch'](handleError(_0x41ec85,null));};exports[_0x7bee('0x34')]=function(_0x36d06d,_0x418d5f){return db[_0x7bee('0x15')]['create'](_0x36d06d['body'],{})[_0x7bee('0xe')](respondWithResult(_0x418d5f,0xc9))[_0x7bee('0x2e')](handleError(_0x418d5f,null));};exports['update']=function(_0x53c3d4,_0x20b976){if(_0x53c3d4[_0x7bee('0x35')]['id']){delete _0x53c3d4[_0x7bee('0x35')]['id'];}return db[_0x7bee('0x15')][_0x7bee('0x33')]({'where':{'id':_0x53c3d4[_0x7bee('0x30')]['id']}})[_0x7bee('0xe')](handleEntityNotFound(_0x20b976,null))[_0x7bee('0xe')](saveUpdates(_0x53c3d4[_0x7bee('0x35')],null))[_0x7bee('0xe')](respondWithResult(_0x20b976,null))[_0x7bee('0x2e')](handleError(_0x20b976,null));};exports[_0x7bee('0xd')]=function(_0x3a25be,_0x4005b8){return db['Dynamics365Account'][_0x7bee('0x33')]({'where':{'id':_0x3a25be[_0x7bee('0x30')]['id']}})['then'](handleEntityNotFound(_0x4005b8,null))['then'](removeEntity(_0x4005b8,null))[_0x7bee('0x2e')](handleError(_0x4005b8,null));};exports[_0x7bee('0x36')]=function(_0x4fa567,_0x5b74dc){var _0x593078={};var _0x2ef84b={};var _0x18e723;var _0xedca5b;return db[_0x7bee('0x15')]['findOne']({'where':{'id':_0x4fa567[_0x7bee('0x30')]['id']}})[_0x7bee('0xe')](handleEntityNotFound(_0x5b74dc,null))[_0x7bee('0xe')](function(_0x51fede){if(_0x51fede){_0x18e723=_0x51fede;_0x2ef84b['model']=_[_0x7bee('0x19')](db[_0x7bee('0x37')][_0x7bee('0x16')]);_0x2ef84b[_0x7bee('0x18')]=_[_0x7bee('0x19')](_0x4fa567[_0x7bee('0x18')]);_0x2ef84b['filters']=_[_0x7bee('0x1c')](_0x2ef84b[_0x7bee('0x1a')],_0x2ef84b['query']);_0x593078[_0x7bee('0x1b')]=_[_0x7bee('0x1c')](_0x2ef84b[_0x7bee('0x1a')],qs[_0x7bee('0x1d')](_0x4fa567['query']['fields']));_0x593078[_0x7bee('0x1b')]=_0x593078[_0x7bee('0x1b')]['length']?_0x593078[_0x7bee('0x1b')]:_0x2ef84b[_0x7bee('0x1a')];_0x593078['order']=qs[_0x7bee('0x21')](_0x4fa567[_0x7bee('0x18')][_0x7bee('0x21')]);_0x593078[_0x7bee('0x24')]=qs['filters'](_[_0x7bee('0x22')](_0x4fa567['query'],_0x2ef84b[_0x7bee('0x31')]));if(_0x4fa567[_0x7bee('0x18')][_0x7bee('0x23')]){_0x593078[_0x7bee('0x24')]=_[_0x7bee('0x25')](_0x593078['where'],{'$or':_[_0x7bee('0x26')](_0x593078[_0x7bee('0x1b')],function(_0x595f25){var _0x51177c={};_0x51177c[_0x595f25]={'$like':'%'+_0x4fa567['query']['filter']+'%'};return _0x51177c;})});}_0x593078=_[_0x7bee('0x25')]({},_0x593078,_0x4fa567[_0x7bee('0x29')]);return _0x18e723[_0x7bee('0x36')](_0x593078);}})[_0x7bee('0xe')](function(_0x2e0509){if(_0x2e0509){_0xedca5b=_0x2e0509[_0x7bee('0x32')];if(!_0x4fa567['query']['hasOwnProperty'](_0x7bee('0x1f'))){_0x593078[_0x7bee('0x9')]=qs[_0x7bee('0x9')](_0x4fa567[_0x7bee('0x18')][_0x7bee('0x9')]);_0x593078['offset']=qs[_0x7bee('0x7')](_0x4fa567[_0x7bee('0x18')][_0x7bee('0x7')]);}return _0x18e723[_0x7bee('0x36')](_0x593078);}})['then'](function(_0x56b8d4){if(_0x56b8d4){return _0x56b8d4?{'count':_0xedca5b,'rows':_0x56b8d4}:null;}})[_0x7bee('0xe')](respondWithResult(_0x5b74dc,null))[_0x7bee('0x2e')](handleError(_0x5b74dc,null));};exports['addConfiguration']=function(_0x165743,_0x2e72f1){if(_0x165743[_0x7bee('0x35')]['id']){delete _0x165743[_0x7bee('0x35')]['id'];}return db[_0x7bee('0x15')][_0x7bee('0x38')]({'where':{'id':_0x165743[_0x7bee('0x30')]['id']}})[_0x7bee('0xe')](handleEntityNotFound(_0x2e72f1,null))[_0x7bee('0xe')](function(_0x2ac1c9){if(_0x2ac1c9){_0x165743[_0x7bee('0x35')][_0x7bee('0x39')]=_0x2ac1c9['id'];_0x165743[_0x7bee('0x35')][_0x7bee('0x3a')]=integrations['getSubjects'](_0x165743[_0x7bee('0x35')][_0x7bee('0x3b')],_0x165743['body'][_0x7bee('0x27')]);_0x165743[_0x7bee('0x35')][_0x7bee('0x3c')]=integrations[_0x7bee('0x3d')](_0x165743[_0x7bee('0x35')]['channel'],_0x165743['body'][_0x7bee('0x27')]);return db[_0x7bee('0x37')][_0x7bee('0x34')](_0x165743[_0x7bee('0x35')],{'include':[{'model':db[_0x7bee('0x3e')],'as':_0x7bee('0x3a')},{'model':db[_0x7bee('0x3e')],'as':_0x7bee('0x3c')}]});}return null;})['then'](respondWithResult(_0x2e72f1,null))[_0x7bee('0x2e')](handleError(_0x2e72f1,null));};function sanitizeRemoteUri(_0x2a5c46){var _0xd70cd8=_0x2a5c46['slice'](-0x1);if(_0xd70cd8==='/')return _0x2a5c46[_0x7bee('0x3f')](0x0,_0x2a5c46[_0x7bee('0x40')](_0xd70cd8));return _0x2a5c46;}function getWebApiUrl(_0x58b78d){return util[_0x7bee('0x41')](_0x7bee('0x42'),_0x58b78d);}exports[_0x7bee('0x43')]=function(_0x460ea6,_0x3a9910){var _0x18c521=_0x460ea6[_0x7bee('0x18')][_0x7bee('0x44')];var _0x1f7b31=_0x18c521===_0x7bee('0x45')?'Incident':'PhoneCall';var _0x30a0a9='';var _0x4cabd8='';var _0x505ded='';var _0x10fecc='';var _0x87729b='';var _0x5c9020='';var _0x550cdd='';var _0x1334b0='';var _0xe3ba7=[_0x7bee('0x46'),'description',_0x7bee('0x47'),_0x7bee('0x48'),_0x7bee('0x49'),_0x7bee('0x4a'),'phonenumber',_0x7bee('0x4b'),_0x7bee('0x4c'),_0x7bee('0x4d')];var _0x401dbc=[_0x7bee('0x4e'),_0x7bee('0x4f'),_0x7bee('0x50'),_0x7bee('0x51'),'contactidname','contactidyominame','contractdetailidname','contractidname',_0x7bee('0x52'),_0x7bee('0x53'),_0x7bee('0x54'),_0x7bee('0x55'),_0x7bee('0x56'),_0x7bee('0x57'),'createdonbehalfbyyominame','customeridname',_0x7bee('0x58'),_0x7bee('0x59'),_0x7bee('0x5a'),_0x7bee('0x5b'),_0x7bee('0x5c'),_0x7bee('0x5d'),_0x7bee('0x5e'),_0x7bee('0x5f'),_0x7bee('0x60'),_0x7bee('0x61'),'importsequencenumber','influencescore',_0x7bee('0x62'),_0x7bee('0x63'),_0x7bee('0x64'),_0x7bee('0x65'),'modifiedbyexternalpartyyominame',_0x7bee('0x66'),_0x7bee('0x67'),'modifiedon',_0x7bee('0x68'),'modifiedonbehalfbyyominame','msdyn_incidenttypename',_0x7bee('0x69'),_0x7bee('0x6a'),_0x7bee('0x6b'),'overriddencreatedon',_0x7bee('0x6c'),_0x7bee('0x6d'),'owneridyominame',_0x7bee('0x6e'),_0x7bee('0x6f'),_0x7bee('0x70'),'prioritycodename',_0x7bee('0x71'),_0x7bee('0x72'),_0x7bee('0x73'),_0x7bee('0x74'),'responseby',_0x7bee('0x75'),_0x7bee('0x76'),_0x7bee('0x77'),_0x7bee('0x78'),'slaname','socialprofileidname',_0x7bee('0x79'),_0x7bee('0x7a'),_0x7bee('0x7b'),_0x7bee('0x7c'),_0x7bee('0x7d'),_0x7bee('0x7e'),'traversedpath',_0x7bee('0x7f'),_0x7bee('0x80')];var _0x47ce5d=_0xe3ba7[_0x7bee('0x81')](_0x401dbc);return db[_0x7bee('0x15')]['findOne']({'where':{'id':_0x460ea6['params']['id']},'attributes':['id',_0x7bee('0x82'),_0x7bee('0x83'),_0x7bee('0x84'),_0x7bee('0x85'),_0x7bee('0x86'),_0x7bee('0x87'),_0x7bee('0x88')],'include':[{'model':db[_0x7bee('0x89')],'as':_0x7bee('0x89'),'attributes':['id','data5',_0x7bee('0x8a')]}]})[_0x7bee('0xe')](handleEntityNotFound(_0x3a9910,null))[_0x7bee('0xe')](function(_0x471310){if(_0x471310){if(_0x471310['modernAuthentication']){_0x471310[_0x7bee('0x8b')]=_0x471310[_0x7bee('0x89')][_0x7bee('0x8c')];_0x1334b0=sanitizeRemoteUri(_0x471310[_0x7bee('0x89')]['data7']);_0x550cdd=getWebApiUrl(_0x1334b0);return _0x471310;}_0x1334b0=sanitizeRemoteUri(_0x471310['remoteUri']);_0x550cdd=getWebApiUrl(_0x1334b0);var _0xe8bc82={'method':_0x7bee('0x8d'),'uri':'https://login.microsoftonline.com/'+_0x471310[_0x7bee('0x85')]+'/oauth2/token','form':{'client_id':_0x471310[_0x7bee('0x86')],'resource':_0x1334b0,'username':_0x471310[_0x7bee('0x82')],'password':_0x471310[_0x7bee('0x83')],'grant_type':_0x7bee('0x83'),'client_secret':_0x471310['clientSecret']},'json':!![]};return rp(_0xe8bc82);}})[_0x7bee('0xe')](function(_0x59eeff){_0x5c9020=_0x59eeff[_0x7bee('0x8b')];var _0x49a28b={'method':'GET','uri':encodeURI(_0x550cdd+_0x7bee('0x8e')+_0x1f7b31+'\x27'),'headers':{'Authorization':_0x7bee('0x8f')+_0x5c9020,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x49a28b);})[_0x7bee('0xe')](function(_0x5c770e){var _0x3b7094=_0x5c770e[_0x7bee('0x90')][0x0];var _0x431abe=_0x3b7094['MetadataId'];var _0x2289e2={'method':'GET','uri':_0x550cdd+'EntityDefinitions('+_0x431abe+_0x7bee('0x91'),'headers':{'Authorization':_0x7bee('0x8f')+_0x5c9020,'If-None-Match':null,'OData-Version':_0x7bee('0x92')},'json':!![]};return rp(_0x2289e2);})[_0x7bee('0xe')](function(_0x2eab87){_0x30a0a9=_0x2eab87;_0x4cabd8=_0x30a0a9[_0x7bee('0x93')];_0x4cabd8=_['remove'](_0x4cabd8,function(_0x39b6fc){return!_0x47ce5d[_0x7bee('0x94')](_0x39b6fc[_0x7bee('0x95')]);});var _0x29aa5=[];var _0x55c5f9=[];_0x4cabd8['forEach'](function(_0x3212f9){if(_0x3212f9[_0x7bee('0x96')]){var _0x1339ea=_0x3212f9[_0x7bee('0x96')][_0x7bee('0x3f')](_0x3212f9[_0x7bee('0x96')][_0x7bee('0x40')]('.')+0x1);if(_0x1339ea===_0x7bee('0x97')){_0x29aa5[_0x7bee('0x98')](getSelectList(_0x550cdd,_0x18c521,_0x55c5f9,_0x30a0a9[_0x7bee('0x99')],_0x3212f9[_0x7bee('0x99')],_0x5c9020));}}});return Promise[_0x7bee('0x9a')](_0x29aa5);})['then'](function(_0x580b47){_0x505ded=_0x580b47[0x0];var _0x47d4d9=[];var _0x518b65=[];_0x4cabd8[_0x7bee('0x9b')](function(_0x250881){if(!_[_0x7bee('0x9c')](_0x250881[_0x7bee('0x96')])){var _0x2acc22=_0x250881[_0x7bee('0x96')][_0x7bee('0x3f')](_0x250881[_0x7bee('0x96')][_0x7bee('0x40')]('.')+0x1);if(_0x2acc22==='BooleanAttributeMetadata'){_0x47d4d9[_0x7bee('0x98')](getBooleanList(_0x550cdd,_0x18c521,_0x518b65,_0x30a0a9[_0x7bee('0x99')],_0x250881[_0x7bee('0x99')],_0x5c9020));}}});return Promise['all'](_0x47d4d9);})['then'](function(_0x1e205c){_0x10fecc=_0x1e205c[0x0];var _0x21f6af=[];var _0x157aec=[];_0x4cabd8['forEach'](function(_0x5deaa3){if(_0x5deaa3['@odata.type']){var _0x457c16=_0x5deaa3[_0x7bee('0x96')][_0x7bee('0x3f')](_0x5deaa3[_0x7bee('0x96')][_0x7bee('0x40')]('.')+0x1);if(_0x457c16==='StringAttributeMetadata'||_0x457c16===_0x7bee('0x9d')||_0x457c16===_0x7bee('0x9e')||_0x457c16===_0x7bee('0x9f')||_0x457c16===_0x7bee('0xa0')||_0x457c16===_0x7bee('0xa1')||_0x457c16===_0x7bee('0xa2')||_0x457c16===_0x7bee('0xa3')||_0x457c16==='StateAttributeMetadata'||_0x457c16===_0x7bee('0xa4')){_0x21f6af[_0x7bee('0x98')](getInputList(_0x550cdd,_0x18c521,_0x457c16,_0x157aec,_0x30a0a9[_0x7bee('0x99')],_0x5deaa3[_0x7bee('0x99')],_0x5c9020));}}});return Promise[_0x7bee('0x9a')](_0x21f6af);})['then'](function(_0x21a7a9){_0x87729b=_0x21a7a9[0x0];var _0x3a62b6=_0x505ded[_0x7bee('0x81')](_0x10fecc)[_0x7bee('0x81')](_0x87729b);var _0x263331={'count':_0x3a62b6[_0x7bee('0x32')],'rows':_0x3a62b6};return _0x263331;})['then'](respondWithResult(_0x3a9910,null))[_0x7bee('0x2e')](function(_0x26d1e3){var _0x5bdf88=_0x460ea6['query'][_0x7bee('0xa5')]?0x1f4:_0x26d1e3[_0x7bee('0xa6')]||0x1f4;logger[_0x7bee('0x10')](_0x26d1e3[_0x7bee('0x11')]);delete _0x26d1e3[_0x7bee('0x12')];if(_0x5bdf88===0x191){_0x5bdf88=0x190;}_0x3a9910['status'](_0x5bdf88)['send'](_0x460ea6['query'][_0x7bee('0xa5')]?{'message':_0x7bee('0xa7'),'statusCode':_0x26d1e3[_0x7bee('0xa6')]}:_0x26d1e3);});};function getSelectList(_0x2edd0f,_0x26b846,_0x2da50f,_0x289e77,_0x4a4a8e,_0x512bd1){var _0x21b1d2={'method':_0x7bee('0xa8'),'uri':_0x2edd0f+_0x7bee('0xa9')+_0x289e77+_0x7bee('0xaa')+_0x4a4a8e+_0x7bee('0xab')+_0x7bee('0xac'),'headers':{'Authorization':'Bearer\x20'+_0x512bd1,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x21b1d2)[_0x7bee('0xe')](function(_0x277a9e){var _0x7cbb8b=[];var _0x3f91bd=_0x277a9e[_0x7bee('0xad')][_0x7bee('0xae')];_0x3f91bd[_0x7bee('0x9b')](function(_0x2f75a){_0x7cbb8b[_0x7bee('0x98')]({'name':_0x2f75a[_0x7bee('0xaf')][_0x7bee('0xb0')][_0x7bee('0xaf')],'value':String(_0x2f75a[_0x7bee('0xb1')])});});var _0x1f2e41={'id':_0x26b846+'_'+_0x277a9e[_0x7bee('0x95')],'name':_0x277a9e['DisplayName'][_0x7bee('0xb0')][_0x7bee('0xaf')],'custom':![],'options':_0x7cbb8b};_0x2da50f[_0x7bee('0x98')](_0x1f2e41);return _0x2da50f;});}function getBooleanList(_0x54115,_0x192b3e,_0x4af7b3,_0x27c824,_0xc440b6,_0x4cd56f){var _0x453be9={'method':_0x7bee('0xa8'),'uri':_0x54115+'EntityDefinitions('+_0x27c824+')/Attributes('+_0xc440b6+_0x7bee('0xb2'),'headers':{'Authorization':_0x7bee('0x8f')+_0x4cd56f,'If-None-Match':null,'OData-Version':_0x7bee('0x92')},'json':!![]};return rp(_0x453be9)[_0x7bee('0xe')](function(_0x216cc5){var _0x40a68a=[];_0x40a68a[_0x7bee('0x98')]({'name':_0x216cc5['OptionSet'][_0x7bee('0xb3')][_0x7bee('0xaf')]['UserLocalizedLabel'][_0x7bee('0xaf')],'value':'true'},{'name':_0x216cc5[_0x7bee('0xad')][_0x7bee('0xb4')][_0x7bee('0xaf')][_0x7bee('0xb0')][_0x7bee('0xaf')],'value':'false'});var _0x3b3e1d={'id':_0x192b3e+'_'+_0x216cc5['LogicalName'],'name':_0x216cc5[_0x7bee('0xb5')][_0x7bee('0xb0')][_0x7bee('0xaf')],'custom':![],'options':_0x40a68a};_0x4af7b3[_0x7bee('0x98')](_0x3b3e1d);return _0x4af7b3;});}function getInputList(_0xddd628,_0xd9fb33,_0x589507,_0x414a8b,_0x4627cd,_0x3988d9,_0x47f0c6){var _0x37863a={'method':_0x7bee('0xa8'),'uri':_0xddd628+_0x7bee('0xa9')+_0x4627cd+_0x7bee('0xaa')+_0x3988d9+')/Microsoft.Dynamics.CRM.'+_0x589507+_0x7bee('0xb6'),'headers':{'Authorization':_0x7bee('0x8f')+_0x47f0c6,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x37863a)[_0x7bee('0xe')](function(_0x1f3309){var _0x459606={'id':_0xd9fb33+'_'+_0x1f3309[_0x7bee('0x95')],'name':_0x1f3309['DisplayName'][_0x7bee('0xb0')]?_0x1f3309[_0x7bee('0xb5')][_0x7bee('0xb0')][_0x7bee('0xaf')]:_0x1f3309['LogicalName'],'custom':![],'options':[]};_0x414a8b[_0x7bee('0x98')](_0x459606);return _0x414a8b;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 7b2324c..a838889 100644 --- a/server/api/intDynamics365Account/intDynamics365Account.model.js +++ b/server/api/intDynamics365Account/intDynamics365Account.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['exports','Dynamics365Account','int_dynamics365_accounts','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x1e8094,_0x30333e){var _0x5cc14d=function(_0xa15352){while(--_0xa15352){_0x1e8094['push'](_0x1e8094['shift']());}};_0x5cc14d(++_0x30333e);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./intDynamics365Account.attributes');var integrations=require('../../components/integrations/configuration');module[_0x0d8b('0x7')]=function(_0x227c63,_0x39f43a){return _0x227c63['define'](_0x0d8b('0x8'),attributes,{'tableName':_0x0d8b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb7e7=['int_dynamics365_accounts','lodash','../../config/logger','moment','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','define'];(function(_0x50a790,_0xcf6f3d){var _0x23c34a=function(_0x200e68){while(--_0x200e68){_0x50a790['push'](_0x50a790['shift']());}};_0x23c34a(++_0xcf6f3d);}(_0xb7e7,0x121));var _0x7b7e=function(_0x55abd9,_0x1148af){_0x55abd9=_0x55abd9-0x0;var _0x3e5669=_0xb7e7[_0x55abd9];return _0x3e5669;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x333fa4,_0x372bde){return _0x333fa4[_0x7b7e('0x7')]('Dynamics365Account',attributes,{'tableName':_0x7b7e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index 9d6472b..4a669c5 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 _0xfc5b=['stringify','error','code','message','result','catch','GetDynamics365Account','Dynamics365Account','findAll','options','raw','where','limit','map','include','model','attributes','ShowDynamics365Account','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s'];(function(_0xfeb6b8,_0x516beb){var _0x37e8ed=function(_0x1aefa5){while(--_0x1aefa5){_0xfeb6b8['push'](_0xfeb6b8['shift']());}};_0x37e8ed(++_0x516beb);}(_0xfc5b,0x1f3));var _0xbfc5=function(_0x447726,_0x499774){_0x447726=_0x447726-0x0;var _0x4f17ec=_0xfc5b[_0x447726];return _0x4f17ec;};'use strict';var _=require(_0xbfc5('0x0'));var util=require(_0xbfc5('0x1'));var moment=require(_0xbfc5('0x2'));var BPromise=require(_0xbfc5('0x3'));var rs=require(_0xbfc5('0x4'));var fs=require('fs');var Redis=require(_0xbfc5('0x5'));var db=require(_0xbfc5('0x6'))['db'];var utils=require(_0xbfc5('0x7'));var logger=require(_0xbfc5('0x8'))(_0xbfc5('0x9'));var config=require(_0xbfc5('0xa'));var jayson=require(_0xbfc5('0xb'));var client=jayson[_0xbfc5('0xc')][_0xbfc5('0xd')]({'port':0x232a});function respondWithRpcPromise(_0xfd3ab8,_0x56ca42,_0x16f342){return new BPromise(function(_0x4b15e6,_0x25e5d6){return client[_0xbfc5('0xe')](_0xfd3ab8,_0x16f342)[_0xbfc5('0xf')](function(_0x248490){logger[_0xbfc5('0x10')](_0xbfc5('0x11'),_0x56ca42,_0xbfc5('0x12'));logger[_0xbfc5('0x13')](_0xbfc5('0x14'),_0x56ca42,_0xbfc5('0x12'),JSON[_0xbfc5('0x15')](_0x248490));if(_0x248490[_0xbfc5('0x16')]){if(_0x248490[_0xbfc5('0x16')][_0xbfc5('0x17')]===0x1f4){logger['error'](_0xbfc5('0x11'),_0x56ca42,_0x248490[_0xbfc5('0x16')][_0xbfc5('0x18')]);return _0x25e5d6(_0x248490[_0xbfc5('0x16')][_0xbfc5('0x18')]);}logger[_0xbfc5('0x16')](_0xbfc5('0x11'),_0x56ca42,_0x248490[_0xbfc5('0x16')][_0xbfc5('0x18')]);return _0x4b15e6(_0x248490['error']['message']);}else{logger[_0xbfc5('0x10')]('Dynamics365Account,\x20%s,\x20%s',_0x56ca42,'request\x20sent');_0x4b15e6(_0x248490[_0xbfc5('0x19')][_0xbfc5('0x18')]);}})[_0xbfc5('0x1a')](function(_0x2b7e8c){logger[_0xbfc5('0x16')](_0xbfc5('0x11'),_0x56ca42,_0x2b7e8c);_0x25e5d6(_0x2b7e8c);});});}exports[_0xbfc5('0x1b')]=function(_0x417c2d){var _0x97e01c=this;return new Promise(function(_0x17f9ae,_0x41e4f6){return db[_0xbfc5('0x1c')][_0xbfc5('0x1d')]({'raw':_0x417c2d[_0xbfc5('0x1e')]?_0x417c2d[_0xbfc5('0x1e')][_0xbfc5('0x1f')]===undefined?!![]:![]:!![],'where':_0x417c2d[_0xbfc5('0x1e')]?_0x417c2d[_0xbfc5('0x1e')][_0xbfc5('0x20')]||null:null,'attributes':_0x417c2d['options']?_0x417c2d[_0xbfc5('0x1e')]['attributes']||null:null,'limit':_0x417c2d['options']?_0x417c2d['options'][_0xbfc5('0x21')]||null:null,'include':_0x417c2d['options']?_0x417c2d[_0xbfc5('0x1e')]['include']?_[_0xbfc5('0x22')](_0x417c2d[_0xbfc5('0x1e')][_0xbfc5('0x23')],function(_0x54b374){return{'model':db[_0x54b374[_0xbfc5('0x24')]],'as':_0x54b374['as'],'attributes':_0x54b374[_0xbfc5('0x25')],'include':_0x54b374[_0xbfc5('0x23')]?_[_0xbfc5('0x22')](_0x54b374['include'],function(_0x5abf6d){return{'model':db[_0x5abf6d[_0xbfc5('0x24')]],'as':_0x5abf6d['as'],'attributes':_0x5abf6d[_0xbfc5('0x25')],'include':_0x5abf6d[_0xbfc5('0x23')]?_[_0xbfc5('0x22')](_0x5abf6d[_0xbfc5('0x23')],function(_0x40bd2d){return{'model':db[_0x40bd2d[_0xbfc5('0x24')]],'as':_0x40bd2d['as'],'attributes':_0x40bd2d['attributes']};}):[]};}):[]};}):[]:[]})[_0xbfc5('0xf')](function(_0x2664d3){logger[_0xbfc5('0x10')]('GetDynamics365Account',_0x417c2d);logger[_0xbfc5('0x13')](_0xbfc5('0x1b'),_0x417c2d,JSON['stringify'](_0x2664d3));_0x17f9ae(_0x2664d3);})[_0xbfc5('0x1a')](function(_0x1ef5d2){logger['error'](_0xbfc5('0x1b'),_0x1ef5d2[_0xbfc5('0x18')],_0x417c2d);_0x41e4f6(_0x97e01c['error'](0x1f4,_0x1ef5d2[_0xbfc5('0x18')]));});});};exports[_0xbfc5('0x26')]=function(_0x458a9b){var _0x5e543d=this;return new Promise(function(_0x409950,_0x1eeb48){return db[_0xbfc5('0x1c')][_0xbfc5('0x27')]({'raw':_0x458a9b[_0xbfc5('0x1e')]?_0x458a9b['options'][_0xbfc5('0x1f')]===undefined?!![]:![]:!![],'where':_0x458a9b[_0xbfc5('0x1e')]?_0x458a9b[_0xbfc5('0x1e')][_0xbfc5('0x20')]||null:null,'attributes':_0x458a9b[_0xbfc5('0x1e')]?_0x458a9b[_0xbfc5('0x1e')][_0xbfc5('0x25')]||null:null,'include':_0x458a9b[_0xbfc5('0x1e')]?_0x458a9b[_0xbfc5('0x1e')][_0xbfc5('0x23')]?_['map'](_0x458a9b[_0xbfc5('0x1e')][_0xbfc5('0x23')],function(_0x575096){return{'model':db[_0x575096[_0xbfc5('0x24')]],'as':_0x575096['as'],'attributes':_0x575096['attributes'],'include':_0x575096['include']?_['map'](_0x575096[_0xbfc5('0x23')],function(_0x2f0144){return{'model':db[_0x2f0144[_0xbfc5('0x24')]],'as':_0x2f0144['as'],'attributes':_0x2f0144['attributes'],'include':_0x2f0144[_0xbfc5('0x23')]?_['map'](_0x2f0144[_0xbfc5('0x23')],function(_0x5ac4b3){return{'model':db[_0x5ac4b3[_0xbfc5('0x24')]],'as':_0x5ac4b3['as'],'attributes':_0x5ac4b3[_0xbfc5('0x25')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x40cbfb){logger[_0xbfc5('0x10')](_0xbfc5('0x26'),_0x458a9b);logger[_0xbfc5('0x13')](_0xbfc5('0x26'),_0x458a9b,JSON[_0xbfc5('0x15')](_0x40cbfb));_0x409950(_0x40cbfb);})['catch'](function(_0x21237e){logger[_0xbfc5('0x16')]('ShowDynamics365Account',_0x21237e[_0xbfc5('0x18')],_0x458a9b);_0x1eeb48(_0x5e543d['error'](0x1f4,_0x21237e[_0xbfc5('0x18')]));});});}; \ No newline at end of file +var _0xd295=['model','catch','ShowDynamics365Account','find','raw','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','then','info','Dynamics365Account,\x20%s,\x20%s','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetDynamics365Account','Dynamics365Account','findAll','options','where','attributes','include','map'];(function(_0x442c2e,_0x5681ab){var _0x1c8ef3=function(_0x445faa){while(--_0x445faa){_0x442c2e['push'](_0x442c2e['shift']());}};_0x1c8ef3(++_0x5681ab);}(_0xd295,0x68));var _0x5d29=function(_0x2d7e84,_0x5c9dd6){_0x2d7e84=_0x2d7e84-0x0;var _0x3a8729=_0xd295[_0x2d7e84];return _0x3a8729;};'use strict';var _=require(_0x5d29('0x0'));var util=require(_0x5d29('0x1'));var moment=require(_0x5d29('0x2'));var BPromise=require(_0x5d29('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5d29('0x4'))['db'];var utils=require(_0x5d29('0x5'));var logger=require('../../config/logger')(_0x5d29('0x6'));var config=require(_0x5d29('0x7'));var jayson=require(_0x5d29('0x8'));var client=jayson['client'][_0x5d29('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x12d775,_0x7eabca,_0x35f431){return new BPromise(function(_0x29f10c,_0x451ade){return client['request'](_0x12d775,_0x35f431)[_0x5d29('0xa')](function(_0x3afe3f){logger[_0x5d29('0xb')](_0x5d29('0xc'),_0x7eabca,'request\x20sent');logger[_0x5d29('0xd')](_0x5d29('0xe'),_0x7eabca,'request\x20sent',JSON[_0x5d29('0xf')](_0x3afe3f));if(_0x3afe3f[_0x5d29('0x10')]){if(_0x3afe3f[_0x5d29('0x10')][_0x5d29('0x11')]===0x1f4){logger[_0x5d29('0x10')](_0x5d29('0xc'),_0x7eabca,_0x3afe3f[_0x5d29('0x10')][_0x5d29('0x12')]);return _0x451ade(_0x3afe3f[_0x5d29('0x10')][_0x5d29('0x12')]);}logger[_0x5d29('0x10')](_0x5d29('0xc'),_0x7eabca,_0x3afe3f['error'][_0x5d29('0x12')]);return _0x29f10c(_0x3afe3f[_0x5d29('0x10')]['message']);}else{logger[_0x5d29('0xb')]('Dynamics365Account,\x20%s,\x20%s',_0x7eabca,'request\x20sent');_0x29f10c(_0x3afe3f[_0x5d29('0x13')]['message']);}})['catch'](function(_0x5f5c3f){logger[_0x5d29('0x10')](_0x5d29('0xc'),_0x7eabca,_0x5f5c3f);_0x451ade(_0x5f5c3f);});});}exports[_0x5d29('0x14')]=function(_0x2aaed0){var _0x4d8400=this;return new Promise(function(_0x41ec88,_0x3b8552){return db[_0x5d29('0x15')][_0x5d29('0x16')]({'raw':_0x2aaed0[_0x5d29('0x17')]?_0x2aaed0[_0x5d29('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x2aaed0['options']?_0x2aaed0[_0x5d29('0x17')][_0x5d29('0x18')]||null:null,'attributes':_0x2aaed0[_0x5d29('0x17')]?_0x2aaed0[_0x5d29('0x17')][_0x5d29('0x19')]||null:null,'limit':_0x2aaed0[_0x5d29('0x17')]?_0x2aaed0[_0x5d29('0x17')]['limit']||null:null,'include':_0x2aaed0[_0x5d29('0x17')]?_0x2aaed0[_0x5d29('0x17')][_0x5d29('0x1a')]?_[_0x5d29('0x1b')](_0x2aaed0[_0x5d29('0x17')][_0x5d29('0x1a')],function(_0x507b16){return{'model':db[_0x507b16['model']],'as':_0x507b16['as'],'attributes':_0x507b16[_0x5d29('0x19')],'include':_0x507b16[_0x5d29('0x1a')]?_[_0x5d29('0x1b')](_0x507b16[_0x5d29('0x1a')],function(_0x33aa16){return{'model':db[_0x33aa16['model']],'as':_0x33aa16['as'],'attributes':_0x33aa16[_0x5d29('0x19')],'include':_0x33aa16[_0x5d29('0x1a')]?_['map'](_0x33aa16[_0x5d29('0x1a')],function(_0x38c417){return{'model':db[_0x38c417[_0x5d29('0x1c')]],'as':_0x38c417['as'],'attributes':_0x38c417[_0x5d29('0x19')]};}):[]};}):[]};}):[]:[]})[_0x5d29('0xa')](function(_0x106d3e){logger[_0x5d29('0xb')](_0x5d29('0x14'),_0x2aaed0);logger[_0x5d29('0xd')]('GetDynamics365Account',_0x2aaed0,JSON[_0x5d29('0xf')](_0x106d3e));_0x41ec88(_0x106d3e);})[_0x5d29('0x1d')](function(_0x16710a){logger[_0x5d29('0x10')]('GetDynamics365Account',_0x16710a['message'],_0x2aaed0);_0x3b8552(_0x4d8400[_0x5d29('0x10')](0x1f4,_0x16710a[_0x5d29('0x12')]));});});};exports[_0x5d29('0x1e')]=function(_0x545412){var _0x3c203d=this;return new Promise(function(_0x3b76f6,_0xd0381e){return db['Dynamics365Account'][_0x5d29('0x1f')]({'raw':_0x545412['options']?_0x545412[_0x5d29('0x17')][_0x5d29('0x20')]===undefined?!![]:![]:!![],'where':_0x545412[_0x5d29('0x17')]?_0x545412[_0x5d29('0x17')][_0x5d29('0x18')]||null:null,'attributes':_0x545412[_0x5d29('0x17')]?_0x545412[_0x5d29('0x17')][_0x5d29('0x19')]||null:null,'include':_0x545412[_0x5d29('0x17')]?_0x545412[_0x5d29('0x17')][_0x5d29('0x1a')]?_['map'](_0x545412[_0x5d29('0x17')][_0x5d29('0x1a')],function(_0x5c713f){return{'model':db[_0x5c713f[_0x5d29('0x1c')]],'as':_0x5c713f['as'],'attributes':_0x5c713f[_0x5d29('0x19')],'include':_0x5c713f[_0x5d29('0x1a')]?_[_0x5d29('0x1b')](_0x5c713f[_0x5d29('0x1a')],function(_0x5ba120){return{'model':db[_0x5ba120[_0x5d29('0x1c')]],'as':_0x5ba120['as'],'attributes':_0x5ba120[_0x5d29('0x19')],'include':_0x5ba120[_0x5d29('0x1a')]?_['map'](_0x5ba120[_0x5d29('0x1a')],function(_0x111640){return{'model':db[_0x111640[_0x5d29('0x1c')]],'as':_0x111640['as'],'attributes':_0x111640[_0x5d29('0x19')]};}):[]};}):[]};}):[]:[]})[_0x5d29('0xa')](function(_0x2687b0){logger[_0x5d29('0xb')](_0x5d29('0x1e'),_0x545412);logger[_0x5d29('0xd')]('ShowDynamics365Account',_0x545412,JSON[_0x5d29('0xf')](_0x2687b0));_0x3b76f6(_0x2687b0);})['catch'](function(_0x3c3c46){logger[_0x5d29('0x10')](_0x5d29('0x1e'),_0x3c3c46[_0x5d29('0x12')],_0x545412);_0xd0381e(_0x3c203d[_0x5d29('0x10')](0x1f4,_0x3c3c46['message']));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 9b84738..5c471d2 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 _0x0b70=['util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./intDynamics365Configuration.controller','isAuthenticated','get','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','/:id','update','delete','destroy','exports'];(function(_0x3ca7a9,_0x4fc0c7){var _0x399428=function(_0x3f30b2){while(--_0x3f30b2){_0x3ca7a9['push'](_0x3ca7a9['shift']());}};_0x399428(++_0x4fc0c7);}(_0x0b70,0x159));var _0x00b7=function(_0x21faf8,_0x3cae65){_0x21faf8=_0x21faf8-0x0;var _0x265ebc=_0x0b70[_0x21faf8];return _0x265ebc;};'use strict';var multer=require('multer');var util=require(_0x00b7('0x0'));var path=require('path');var timeout=require(_0x00b7('0x1'));var express=require(_0x00b7('0x2'));var router=express['Router']();var fs_extra=require(_0x00b7('0x3'));var auth=require(_0x00b7('0x4'));var interaction=require(_0x00b7('0x5'));var config=require('../../config/environment');var controller=require(_0x00b7('0x6'));router['get']('/',auth[_0x00b7('0x7')](),controller['index']);router[_0x00b7('0x8')]('/:id',auth[_0x00b7('0x7')](),controller['show']);router[_0x00b7('0x8')](_0x00b7('0x9'),auth[_0x00b7('0x7')](),controller[_0x00b7('0xa')]);router['get'](_0x00b7('0xb'),auth[_0x00b7('0x7')](),controller[_0x00b7('0xc')]);router['get'](_0x00b7('0xd'),auth['isAuthenticated'](),controller[_0x00b7('0xe')]);router[_0x00b7('0xf')]('/',auth[_0x00b7('0x7')](),controller[_0x00b7('0x10')]);router[_0x00b7('0x11')](_0x00b7('0x12'),auth[_0x00b7('0x7')](),controller[_0x00b7('0x13')]);router[_0x00b7('0x14')](_0x00b7('0x12'),auth['isAuthenticated'](),controller[_0x00b7('0x15')]);module[_0x00b7('0x16')]=router; \ No newline at end of file +var _0x97c1=['./intDynamics365Configuration.controller','index','get','/:id','isAuthenticated','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','put','delete','destroy','exports','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x97c1,0xdf));var _0x197c=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x97c1[_0x59ee6f];return _0x4c0979;};'use strict';var multer=require(_0x197c('0x0'));var util=require(_0x197c('0x1'));var path=require('path');var timeout=require(_0x197c('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x197c('0x3'));var auth=require(_0x197c('0x4'));var interaction=require(_0x197c('0x5'));var config=require(_0x197c('0x6'));var controller=require(_0x197c('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x197c('0x8')]);router[_0x197c('0x9')](_0x197c('0xa'),auth[_0x197c('0xb')](),controller['show']);router['get'](_0x197c('0xc'),auth['isAuthenticated'](),controller[_0x197c('0xd')]);router[_0x197c('0x9')](_0x197c('0xe'),auth[_0x197c('0xb')](),controller['getSubjects']);router[_0x197c('0x9')](_0x197c('0xf'),auth[_0x197c('0xb')](),controller[_0x197c('0x10')]);router[_0x197c('0x11')]('/',auth['isAuthenticated'](),controller[_0x197c('0x12')]);router[_0x197c('0x13')](_0x197c('0xa'),auth[_0x197c('0xb')](),controller['update']);router[_0x197c('0x14')](_0x197c('0xa'),auth[_0x197c('0xb')](),controller[_0x197c('0x15')]);module[_0x197c('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 7be56f8..7883641 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 _0x5567=['nothing','BOOLEAN','sequelize','exports','STRING','incident','phonecall','ENUM','contact'];(function(_0x47c1e9,_0x5026c9){var _0x2227c0=function(_0x2053a2){while(--_0x2053a2){_0x47c1e9['push'](_0x47c1e9['shift']());}};_0x2227c0(++_0x5026c9);}(_0x5567,0x16a));var _0x7556=function(_0x31af51,_0x256874){_0x31af51=_0x31af51-0x0;var _0x505c77=_0x5567[_0x31af51];return _0x505c77;};'use strict';var Sequelize=require(_0x7556('0x0'));module[_0x7556('0x1')]={'name':{'type':Sequelize[_0x7556('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize['ENUM'](_0x7556('0x3'),_0x7556('0x4')),'defaultValue':_0x7556('0x3')},'moduleCreate':{'type':Sequelize[_0x7556('0x5')](_0x7556('0x6'),_0x7556('0x7')),'defaultValue':'contact','allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x7556('0x2')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x7556('0x8')],'defaultValue':!![]}}; \ No newline at end of file +var _0xb3a0=['contact','nothing','BOOLEAN','exports','STRING','ENUM','incident','phonecall'];(function(_0x30864c,_0x49789b){var _0x5569cf=function(_0x1ccfa7){while(--_0x1ccfa7){_0x30864c['push'](_0x30864c['shift']());}};_0x5569cf(++_0x49789b);}(_0xb3a0,0x1cb));var _0x0b3a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xb3a0[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module[_0x0b3a('0x0')]={'name':{'type':Sequelize[_0x0b3a('0x1')]},'description':{'type':Sequelize[_0x0b3a('0x1')]},'ticketType':{'type':Sequelize[_0x0b3a('0x2')](_0x0b3a('0x3'),_0x0b3a('0x4')),'defaultValue':'incident'},'moduleCreate':{'type':Sequelize[_0x0b3a('0x2')](_0x0b3a('0x5'),_0x0b3a('0x6')),'defaultValue':_0x0b3a('0x5'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize['STRING'],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x0b3a('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 c9228f3..5e36280 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 _0xc4eb=['json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','name','send','index','map','Dynamics365Configuration','rawAttributes','fieldName','type','key','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','includeAll','catch','include','options','find','create','body','params','getFields','Dynamics365Field','getSubjects','findOne','pick','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','end'];(function(_0x2c4bc3,_0x34f08b){var _0x31ca59=function(_0x2190f0){while(--_0x2190f0){_0x2c4bc3['push'](_0x2c4bc3['shift']());}};_0x31ca59(++_0x34f08b);}(_0xc4eb,0xd4));var _0xbc4e=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xc4eb[_0x167cc1];return _0x10bc4b;};'use strict';var emlformat=require(_0xbc4e('0x0'));var rimraf=require(_0xbc4e('0x1'));var zipdir=require(_0xbc4e('0x2'));var jsonpatch=require(_0xbc4e('0x3'));var rp=require(_0xbc4e('0x4'));var moment=require(_0xbc4e('0x5'));var BPromise=require(_0xbc4e('0x6'));var Mustache=require(_0xbc4e('0x7'));var util=require('util');var path=require(_0xbc4e('0x8'));var sox=require(_0xbc4e('0x9'));var csv=require(_0xbc4e('0xa'));var ejs=require(_0xbc4e('0xb'));var fs=require('fs');var fs_extra=require(_0xbc4e('0xc'));var _=require(_0xbc4e('0xd'));var squel=require(_0xbc4e('0xe'));var crypto=require(_0xbc4e('0xf'));var jsforce=require(_0xbc4e('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xbc4e('0xa'));var querystring=require(_0xbc4e('0x11'));var Papa=require(_0xbc4e('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xbc4e('0x13'));var as=require(_0xbc4e('0x14'));var hardwareService=require(_0xbc4e('0x15'));var logger=require(_0xbc4e('0x16'))(_0xbc4e('0x17'));var utils=require(_0xbc4e('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x458694,_0x501081){_0x501081=_0x501081||0xcc;return function(_0x51c79b){if(_0x51c79b){return _0x458694[_0xbc4e('0x19')](_0x501081);}return _0x458694[_0xbc4e('0x1a')](_0x501081)[_0xbc4e('0x1b')]();};}function respondWithResult(_0x17a6b5,_0x57316a){_0x57316a=_0x57316a||0xc8;return function(_0x514c50){if(_0x514c50){return _0x17a6b5['status'](_0x57316a)[_0xbc4e('0x1c')](_0x514c50);}};}function respondWithFilteredResult(_0x4eb486,_0x29555d){return function(_0x3d8bd8){if(_0x3d8bd8){var _0xb12edb=typeof _0x29555d[_0xbc4e('0x1d')]===_0xbc4e('0x1e')&&typeof _0x29555d[_0xbc4e('0x1f')]===_0xbc4e('0x1e');var _0x1d884d=_0x3d8bd8[_0xbc4e('0x20')];var _0x2320e0=_0xb12edb?0x0:_0x29555d[_0xbc4e('0x1d')];var _0x44d0de=_0xb12edb?_0x3d8bd8['count']:_0x29555d[_0xbc4e('0x1d')]+_0x29555d['limit'];var _0x5a56c9;if(_0x44d0de>=_0x1d884d){_0x44d0de=_0x1d884d;_0x5a56c9=0xc8;}else{_0x5a56c9=0xce;}_0x4eb486[_0xbc4e('0x1a')](_0x5a56c9);return _0x4eb486[_0xbc4e('0x21')](_0xbc4e('0x22'),_0x2320e0+'-'+_0x44d0de+'/'+_0x1d884d)[_0xbc4e('0x1c')](_0x3d8bd8);}return null;};}function patchUpdates(_0x47497e){return function(_0x231f52){try{jsonpatch[_0xbc4e('0x23')](_0x231f52,_0x47497e,!![]);}catch(_0x58133a){return BPromise[_0xbc4e('0x24')](_0x58133a);}return _0x231f52['save']();};}function saveUpdates(_0x331f9a,_0x2874e6){return function(_0x45bfe2){if(_0x45bfe2){return _0x45bfe2[_0xbc4e('0x25')](_0x331f9a)[_0xbc4e('0x26')](function(_0x43705f){return _0x43705f;});}return null;};}function removeEntity(_0x482355,_0x4c7d19){return function(_0x3fe0ca){if(_0x3fe0ca){return _0x3fe0ca[_0xbc4e('0x27')]()[_0xbc4e('0x26')](function(){_0x482355['status'](0xcc)[_0xbc4e('0x1b')]();});}};}function handleEntityNotFound(_0x4038f4,_0x272ddc){return function(_0x54124e){if(!_0x54124e){_0x4038f4['sendStatus'](0x194);}return _0x54124e;};}function handleError(_0x1169cf,_0xc3e42a){_0xc3e42a=_0xc3e42a||0x1f4;return function(_0x3b9193){logger[_0xbc4e('0x28')](_0x3b9193['stack']);if(_0x3b9193['name']){delete _0x3b9193[_0xbc4e('0x29')];}_0x1169cf[_0xbc4e('0x1a')](_0xc3e42a)[_0xbc4e('0x2a')](_0x3b9193);};}exports[_0xbc4e('0x2b')]=function(_0x3f58ad,_0x250eaf){var _0x25a3c7={},_0x131f75={},_0x2b1e27={'count':0x0,'rows':[]};var _0x11fad3=_[_0xbc4e('0x2c')](db[_0xbc4e('0x2d')][_0xbc4e('0x2e')],function(_0xcf581d){return{'name':_0xcf581d[_0xbc4e('0x2f')],'type':_0xcf581d[_0xbc4e('0x30')][_0xbc4e('0x31')]};});_0x131f75[_0xbc4e('0x32')]=_[_0xbc4e('0x2c')](_0x11fad3,_0xbc4e('0x29'));_0x131f75['query']=_[_0xbc4e('0x33')](_0x3f58ad[_0xbc4e('0x34')]);_0x131f75['filters']=_[_0xbc4e('0x35')](_0x131f75[_0xbc4e('0x32')],_0x131f75[_0xbc4e('0x34')]);_0x25a3c7['attributes']=_['intersection'](_0x131f75[_0xbc4e('0x32')],qs[_0xbc4e('0x36')](_0x3f58ad[_0xbc4e('0x34')][_0xbc4e('0x36')]));_0x25a3c7[_0xbc4e('0x37')]=_0x25a3c7[_0xbc4e('0x37')][_0xbc4e('0x38')]?_0x25a3c7['attributes']:_0x131f75[_0xbc4e('0x32')];if(!_0x3f58ad['query'][_0xbc4e('0x39')](_0xbc4e('0x3a'))){_0x25a3c7['limit']=qs['limit'](_0x3f58ad['query']['limit']);_0x25a3c7[_0xbc4e('0x1d')]=qs['offset'](_0x3f58ad[_0xbc4e('0x34')][_0xbc4e('0x1d')]);}_0x25a3c7[_0xbc4e('0x3b')]=qs[_0xbc4e('0x3c')](_0x3f58ad[_0xbc4e('0x34')][_0xbc4e('0x3c')]);_0x25a3c7['where']=qs[_0xbc4e('0x3d')](_['pick'](_0x3f58ad[_0xbc4e('0x34')],_0x131f75[_0xbc4e('0x3d')]),_0x11fad3);if(_0x3f58ad[_0xbc4e('0x34')][_0xbc4e('0x3e')]){_0x25a3c7[_0xbc4e('0x3f')]=_[_0xbc4e('0x40')](_0x25a3c7[_0xbc4e('0x3f')],{'$or':_[_0xbc4e('0x2c')](_0x11fad3,function(_0x2a3b89){if(_0x2a3b89[_0xbc4e('0x30')]!==_0xbc4e('0x41')){var _0x5d7903={};_0x5d7903[_0x2a3b89[_0xbc4e('0x29')]]={'$like':'%'+_0x3f58ad['query'][_0xbc4e('0x3e')]+'%'};return _0x5d7903;}})});}_0x25a3c7=_[_0xbc4e('0x40')]({},_0x25a3c7,_0x3f58ad['options']);var _0x1a3b99={'where':_0x25a3c7[_0xbc4e('0x3f')]};return db[_0xbc4e('0x2d')][_0xbc4e('0x20')](_0x1a3b99)[_0xbc4e('0x26')](function(_0x298fa7){_0x2b1e27[_0xbc4e('0x20')]=_0x298fa7;if(_0x3f58ad[_0xbc4e('0x34')][_0xbc4e('0x42')]){_0x25a3c7['include']=[{'all':!![]}];}return db[_0xbc4e('0x2d')]['findAll'](_0x25a3c7);})[_0xbc4e('0x26')](function(_0x607c2e){_0x2b1e27['rows']=_0x607c2e;return _0x2b1e27;})[_0xbc4e('0x26')](respondWithFilteredResult(_0x250eaf,_0x25a3c7))[_0xbc4e('0x43')](handleError(_0x250eaf,null));};exports['show']=function(_0x4949c7,_0x397d2d){var _0x556530={'raw':![],'where':{'id':_0x4949c7['params']['id']}},_0x54a02b={};_0x54a02b[_0xbc4e('0x32')]=_['keys'](db[_0xbc4e('0x2d')][_0xbc4e('0x2e')]);_0x54a02b[_0xbc4e('0x34')]=_['keys'](_0x4949c7[_0xbc4e('0x34')]);_0x54a02b[_0xbc4e('0x3d')]=_[_0xbc4e('0x35')](_0x54a02b['model'],_0x54a02b[_0xbc4e('0x34')]);_0x556530['attributes']=_[_0xbc4e('0x35')](_0x54a02b[_0xbc4e('0x32')],qs[_0xbc4e('0x36')](_0x4949c7[_0xbc4e('0x34')][_0xbc4e('0x36')]));_0x556530[_0xbc4e('0x37')]=_0x556530[_0xbc4e('0x37')][_0xbc4e('0x38')]?_0x556530[_0xbc4e('0x37')]:_0x54a02b[_0xbc4e('0x32')];if(_0x4949c7[_0xbc4e('0x34')][_0xbc4e('0x42')]){_0x556530[_0xbc4e('0x44')]=[{'all':!![]}];}_0x556530=_[_0xbc4e('0x40')]({},_0x556530,_0x4949c7[_0xbc4e('0x45')]);return db[_0xbc4e('0x2d')][_0xbc4e('0x46')](_0x556530)['then'](handleEntityNotFound(_0x397d2d,null))[_0xbc4e('0x26')](respondWithResult(_0x397d2d,null))['catch'](handleError(_0x397d2d,null));};exports[_0xbc4e('0x47')]=function(_0x3ebe4b,_0x343626){return db[_0xbc4e('0x2d')][_0xbc4e('0x47')](_0x3ebe4b[_0xbc4e('0x48')],{})[_0xbc4e('0x26')](respondWithResult(_0x343626,0xc9))['catch'](handleError(_0x343626,null));};exports['update']=function(_0x125d0b,_0x5e29d5){if(_0x125d0b[_0xbc4e('0x48')]['id']){delete _0x125d0b[_0xbc4e('0x48')]['id'];}return db['Dynamics365Configuration']['find']({'where':{'id':_0x125d0b[_0xbc4e('0x49')]['id']}})[_0xbc4e('0x26')](handleEntityNotFound(_0x5e29d5,null))[_0xbc4e('0x26')](saveUpdates(_0x125d0b[_0xbc4e('0x48')],null))[_0xbc4e('0x26')](respondWithResult(_0x5e29d5,null))[_0xbc4e('0x43')](handleError(_0x5e29d5,null));};exports[_0xbc4e('0x27')]=function(_0x522a46,_0x1ddb92){return db[_0xbc4e('0x2d')][_0xbc4e('0x46')]({'where':{'id':_0x522a46[_0xbc4e('0x49')]['id']}})[_0xbc4e('0x26')](handleEntityNotFound(_0x1ddb92,null))['then'](removeEntity(_0x1ddb92,null))['catch'](handleError(_0x1ddb92,null));};exports[_0xbc4e('0x4a')]=function(_0x457c98,_0x365180,_0x2e5184){var _0x399a0a={};var _0x576a38={};var _0x34d3ff;var _0x41a875;return db[_0xbc4e('0x2d')]['findOne']({'where':{'id':_0x457c98[_0xbc4e('0x49')]['id']}})[_0xbc4e('0x26')](handleEntityNotFound(_0x365180,null))[_0xbc4e('0x26')](function(_0x32933f){if(_0x32933f){_0x34d3ff=_0x32933f;_0x576a38[_0xbc4e('0x32')]=_[_0xbc4e('0x33')](db[_0xbc4e('0x4b')][_0xbc4e('0x2e')]);_0x576a38[_0xbc4e('0x34')]=_[_0xbc4e('0x33')](_0x457c98[_0xbc4e('0x34')]);_0x576a38[_0xbc4e('0x3d')]=_['intersection'](_0x576a38[_0xbc4e('0x32')],_0x576a38[_0xbc4e('0x34')]);_0x399a0a['attributes']=_[_0xbc4e('0x35')](_0x576a38[_0xbc4e('0x32')],qs[_0xbc4e('0x36')](_0x457c98[_0xbc4e('0x34')][_0xbc4e('0x36')]));_0x399a0a['attributes']=_0x399a0a['attributes'][_0xbc4e('0x38')]?_0x399a0a['attributes']:_0x576a38[_0xbc4e('0x32')];_0x399a0a[_0xbc4e('0x3b')]=qs[_0xbc4e('0x3c')](_0x457c98[_0xbc4e('0x34')][_0xbc4e('0x3c')]);_0x399a0a[_0xbc4e('0x3f')]=qs[_0xbc4e('0x3d')](_['pick'](_0x457c98[_0xbc4e('0x34')],_0x576a38[_0xbc4e('0x3d')]));if(_0x457c98[_0xbc4e('0x34')][_0xbc4e('0x3e')]){_0x399a0a[_0xbc4e('0x3f')]=_['merge'](_0x399a0a[_0xbc4e('0x3f')],{'$or':_[_0xbc4e('0x2c')](_0x399a0a[_0xbc4e('0x37')],function(_0x356d86){var _0x527197={};_0x527197[_0x356d86]={'$like':'%'+_0x457c98[_0xbc4e('0x34')][_0xbc4e('0x3e')]+'%'};return _0x527197;})});}_0x399a0a=_[_0xbc4e('0x40')]({},_0x399a0a,_0x457c98[_0xbc4e('0x45')]);return _0x34d3ff[_0xbc4e('0x4a')](_0x399a0a);}})['then'](function(_0x259b4f){if(_0x259b4f){_0x41a875=_0x259b4f[_0xbc4e('0x38')];if(!_0x457c98[_0xbc4e('0x34')][_0xbc4e('0x39')]('nolimit')){_0x399a0a['limit']=qs[_0xbc4e('0x1f')](_0x457c98[_0xbc4e('0x34')]['limit']);_0x399a0a['offset']=qs['offset'](_0x457c98[_0xbc4e('0x34')][_0xbc4e('0x1d')]);}return _0x34d3ff['getFields'](_0x399a0a);}})[_0xbc4e('0x26')](function(_0x27ab37){if(_0x27ab37){return _0x27ab37?{'count':_0x41a875,'rows':_0x27ab37}:null;}})[_0xbc4e('0x26')](respondWithResult(_0x365180,null))[_0xbc4e('0x43')](handleError(_0x365180,null));};exports[_0xbc4e('0x4c')]=function(_0x432a19,_0x2b6fc8,_0x50eb51){var _0x279e91={};var _0xf2deae={};var _0x88700f;var _0x1b4918;return db[_0xbc4e('0x2d')][_0xbc4e('0x4d')]({'where':{'id':_0x432a19[_0xbc4e('0x49')]['id']}})[_0xbc4e('0x26')](handleEntityNotFound(_0x2b6fc8,null))['then'](function(_0x42aac9){if(_0x42aac9){_0x88700f=_0x42aac9;_0xf2deae[_0xbc4e('0x32')]=_[_0xbc4e('0x33')](db[_0xbc4e('0x4b')]['rawAttributes']);_0xf2deae['query']=_['keys'](_0x432a19[_0xbc4e('0x34')]);_0xf2deae['filters']=_[_0xbc4e('0x35')](_0xf2deae[_0xbc4e('0x32')],_0xf2deae['query']);_0x279e91['attributes']=_[_0xbc4e('0x35')](_0xf2deae[_0xbc4e('0x32')],qs[_0xbc4e('0x36')](_0x432a19[_0xbc4e('0x34')][_0xbc4e('0x36')]));_0x279e91['attributes']=_0x279e91['attributes'][_0xbc4e('0x38')]?_0x279e91['attributes']:_0xf2deae[_0xbc4e('0x32')];_0x279e91[_0xbc4e('0x3b')]=qs[_0xbc4e('0x3c')](_0x432a19[_0xbc4e('0x34')][_0xbc4e('0x3c')]);_0x279e91[_0xbc4e('0x3f')]=qs[_0xbc4e('0x3d')](_[_0xbc4e('0x4e')](_0x432a19[_0xbc4e('0x34')],_0xf2deae['filters']));if(_0x432a19[_0xbc4e('0x34')][_0xbc4e('0x3e')]){_0x279e91[_0xbc4e('0x3f')]=_[_0xbc4e('0x40')](_0x279e91[_0xbc4e('0x3f')],{'$or':_[_0xbc4e('0x2c')](_0x279e91[_0xbc4e('0x37')],function(_0x2e9295){var _0x2ccce6={};_0x2ccce6[_0x2e9295]={'$like':'%'+_0x432a19['query'][_0xbc4e('0x3e')]+'%'};return _0x2ccce6;})});}_0x279e91=_[_0xbc4e('0x40')]({},_0x279e91,_0x432a19['options']);return _0x88700f['getSubjects'](_0x279e91);}})['then'](function(_0x1c57e1){if(_0x1c57e1){_0x1b4918=_0x1c57e1['length'];if(!_0x432a19[_0xbc4e('0x34')][_0xbc4e('0x39')](_0xbc4e('0x3a'))){_0x279e91[_0xbc4e('0x1f')]=qs[_0xbc4e('0x1f')](_0x432a19[_0xbc4e('0x34')]['limit']);_0x279e91[_0xbc4e('0x1d')]=qs[_0xbc4e('0x1d')](_0x432a19[_0xbc4e('0x34')][_0xbc4e('0x1d')]);}return _0x88700f[_0xbc4e('0x4c')](_0x279e91);}})[_0xbc4e('0x26')](function(_0x2c9660){if(_0x2c9660){return _0x2c9660?{'count':_0x1b4918,'rows':_0x2c9660}:null;}})[_0xbc4e('0x26')](respondWithResult(_0x2b6fc8,null))['catch'](handleError(_0x2b6fc8,null));};exports[_0xbc4e('0x4f')]=function(_0x41c90b,_0x2241a4,_0x46039f){var _0x5f3196={};var _0x1e959a={};var _0x33a28d;var _0x5e0e6e;return db['Dynamics365Configuration'][_0xbc4e('0x4d')]({'where':{'id':_0x41c90b[_0xbc4e('0x49')]['id']}})[_0xbc4e('0x26')](handleEntityNotFound(_0x2241a4,null))[_0xbc4e('0x26')](function(_0x3ea9ee){if(_0x3ea9ee){_0x33a28d=_0x3ea9ee;_0x1e959a['model']=_[_0xbc4e('0x33')](db[_0xbc4e('0x4b')]['rawAttributes']);_0x1e959a['query']=_['keys'](_0x41c90b[_0xbc4e('0x34')]);_0x1e959a['filters']=_[_0xbc4e('0x35')](_0x1e959a[_0xbc4e('0x32')],_0x1e959a[_0xbc4e('0x34')]);_0x5f3196[_0xbc4e('0x37')]=_['intersection'](_0x1e959a[_0xbc4e('0x32')],qs[_0xbc4e('0x36')](_0x41c90b[_0xbc4e('0x34')][_0xbc4e('0x36')]));_0x5f3196['attributes']=_0x5f3196[_0xbc4e('0x37')]['length']?_0x5f3196[_0xbc4e('0x37')]:_0x1e959a['model'];_0x5f3196['order']=qs[_0xbc4e('0x3c')](_0x41c90b[_0xbc4e('0x34')][_0xbc4e('0x3c')]);_0x5f3196[_0xbc4e('0x3f')]=qs[_0xbc4e('0x3d')](_[_0xbc4e('0x4e')](_0x41c90b[_0xbc4e('0x34')],_0x1e959a[_0xbc4e('0x3d')]));if(_0x41c90b[_0xbc4e('0x34')][_0xbc4e('0x3e')]){_0x5f3196[_0xbc4e('0x3f')]=_[_0xbc4e('0x40')](_0x5f3196[_0xbc4e('0x3f')],{'$or':_[_0xbc4e('0x2c')](_0x5f3196[_0xbc4e('0x37')],function(_0x23d981){var _0x5e1490={};_0x5e1490[_0x23d981]={'$like':'%'+_0x41c90b[_0xbc4e('0x34')][_0xbc4e('0x3e')]+'%'};return _0x5e1490;})});}_0x5f3196=_[_0xbc4e('0x40')]({},_0x5f3196,_0x41c90b[_0xbc4e('0x45')]);return _0x33a28d[_0xbc4e('0x4f')](_0x5f3196);}})[_0xbc4e('0x26')](function(_0x390c0a){if(_0x390c0a){_0x5e0e6e=_0x390c0a['length'];if(!_0x41c90b[_0xbc4e('0x34')]['hasOwnProperty']('nolimit')){_0x5f3196[_0xbc4e('0x1f')]=qs[_0xbc4e('0x1f')](_0x41c90b[_0xbc4e('0x34')][_0xbc4e('0x1f')]);_0x5f3196[_0xbc4e('0x1d')]=qs[_0xbc4e('0x1d')](_0x41c90b[_0xbc4e('0x34')][_0xbc4e('0x1d')]);}return _0x33a28d[_0xbc4e('0x4f')](_0x5f3196);}})[_0xbc4e('0x26')](function(_0x3960d8){if(_0x3960d8){return _0x3960d8?{'count':_0x5e0e6e,'rows':_0x3960d8}:null;}})[_0xbc4e('0x26')](respondWithResult(_0x2241a4,null))[_0xbc4e('0x43')](handleError(_0x2241a4,null));}; \ No newline at end of file +var _0x2fd5=['include','findAll','rows','catch','params','keys','rawAttributes','find','create','body','getFields','findOne','getSubjects','getDescriptions','Dynamics365Field','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','Dynamics365Configuration','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll'];(function(_0x18f294,_0x4726d9){var _0x2841a6=function(_0xb07309){while(--_0xb07309){_0x18f294['push'](_0x18f294['shift']());}};_0x2841a6(++_0x4726d9);}(_0x2fd5,0x147));var _0x52fd=function(_0x21dbf9,_0x293351){_0x21dbf9=_0x21dbf9-0x0;var _0xb5cfd4=_0x2fd5[_0x21dbf9];return _0xb5cfd4;};'use strict';var emlformat=require(_0x52fd('0x0'));var rimraf=require(_0x52fd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x52fd('0x2'));var moment=require(_0x52fd('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x52fd('0x4'));var util=require(_0x52fd('0x5'));var path=require(_0x52fd('0x6'));var sox=require(_0x52fd('0x7'));var csv=require(_0x52fd('0x8'));var ejs=require(_0x52fd('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x52fd('0xa'));var squel=require(_0x52fd('0xb'));var crypto=require(_0x52fd('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x52fd('0xd'));var toCsv=require(_0x52fd('0x8'));var querystring=require('querystring');var Papa=require(_0x52fd('0xe'));var Redis=require(_0x52fd('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x52fd('0x10'));var hardwareService=require(_0x52fd('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x52fd('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x52fd('0x13'));var db=require(_0x52fd('0x14'))['db'];function respondWithStatusCode(_0x3ba6e5,_0x19dd8a){_0x19dd8a=_0x19dd8a||0xcc;return function(_0x43ef9c){if(_0x43ef9c){return _0x3ba6e5['sendStatus'](_0x19dd8a);}return _0x3ba6e5[_0x52fd('0x15')](_0x19dd8a)[_0x52fd('0x16')]();};}function respondWithResult(_0x206485,_0xd4f314){_0xd4f314=_0xd4f314||0xc8;return function(_0x30ddee){if(_0x30ddee){return _0x206485[_0x52fd('0x15')](_0xd4f314)[_0x52fd('0x17')](_0x30ddee);}};}function respondWithFilteredResult(_0x4325c7,_0x1a4442){return function(_0x5b480c){if(_0x5b480c){var _0x59e413=typeof _0x1a4442[_0x52fd('0x18')]===_0x52fd('0x19')&&typeof _0x1a4442[_0x52fd('0x1a')]===_0x52fd('0x19');var _0x5b05fb=_0x5b480c['count'];var _0x1364c6=_0x59e413?0x0:_0x1a4442[_0x52fd('0x18')];var _0x4ccdcc=_0x59e413?_0x5b480c[_0x52fd('0x1b')]:_0x1a4442[_0x52fd('0x18')]+_0x1a4442['limit'];var _0x3ee35e;if(_0x4ccdcc>=_0x5b05fb){_0x4ccdcc=_0x5b05fb;_0x3ee35e=0xc8;}else{_0x3ee35e=0xce;}_0x4325c7[_0x52fd('0x15')](_0x3ee35e);return _0x4325c7['set'](_0x52fd('0x1c'),_0x1364c6+'-'+_0x4ccdcc+'/'+_0x5b05fb)[_0x52fd('0x17')](_0x5b480c);}return null;};}function patchUpdates(_0x22e0cb){return function(_0x43d49f){try{jsonpatch[_0x52fd('0x1d')](_0x43d49f,_0x22e0cb,!![]);}catch(_0x3ba6bb){return BPromise[_0x52fd('0x1e')](_0x3ba6bb);}return _0x43d49f[_0x52fd('0x1f')]();};}function saveUpdates(_0x121799,_0x141233){return function(_0x5ab5f6){if(_0x5ab5f6){return _0x5ab5f6[_0x52fd('0x20')](_0x121799)[_0x52fd('0x21')](function(_0x594265){return _0x594265;});}return null;};}function removeEntity(_0xd98f3a,_0x4e8ea5){return function(_0x538877){if(_0x538877){return _0x538877[_0x52fd('0x22')]()[_0x52fd('0x21')](function(){_0xd98f3a[_0x52fd('0x15')](0xcc)[_0x52fd('0x16')]();});}};}function handleEntityNotFound(_0x13fd5e,_0x187502){return function(_0x2bb89e){if(!_0x2bb89e){_0x13fd5e[_0x52fd('0x23')](0x194);}return _0x2bb89e;};}function handleError(_0x5654ad,_0x556991){_0x556991=_0x556991||0x1f4;return function(_0x11b994){logger[_0x52fd('0x24')](_0x11b994[_0x52fd('0x25')]);if(_0x11b994[_0x52fd('0x26')]){delete _0x11b994[_0x52fd('0x26')];}_0x5654ad[_0x52fd('0x15')](_0x556991)[_0x52fd('0x27')](_0x11b994);};}exports[_0x52fd('0x28')]=function(_0x637be7,_0x3c3d9e){var _0x3ef505={},_0x3c9a82={},_0x199aa9={'count':0x0,'rows':[]};var _0x4bad91=_[_0x52fd('0x29')](db[_0x52fd('0x2a')]['rawAttributes'],function(_0x50302b){return{'name':_0x50302b[_0x52fd('0x2b')],'type':_0x50302b[_0x52fd('0x2c')][_0x52fd('0x2d')]};});_0x3c9a82[_0x52fd('0x2e')]=_['map'](_0x4bad91,_0x52fd('0x26'));_0x3c9a82[_0x52fd('0x2f')]=_['keys'](_0x637be7[_0x52fd('0x2f')]);_0x3c9a82[_0x52fd('0x30')]=_[_0x52fd('0x31')](_0x3c9a82[_0x52fd('0x2e')],_0x3c9a82[_0x52fd('0x2f')]);_0x3ef505[_0x52fd('0x32')]=_[_0x52fd('0x31')](_0x3c9a82[_0x52fd('0x2e')],qs[_0x52fd('0x33')](_0x637be7[_0x52fd('0x2f')][_0x52fd('0x33')]));_0x3ef505[_0x52fd('0x32')]=_0x3ef505[_0x52fd('0x32')][_0x52fd('0x34')]?_0x3ef505[_0x52fd('0x32')]:_0x3c9a82[_0x52fd('0x2e')];if(!_0x637be7[_0x52fd('0x2f')][_0x52fd('0x35')](_0x52fd('0x36'))){_0x3ef505['limit']=qs['limit'](_0x637be7[_0x52fd('0x2f')][_0x52fd('0x1a')]);_0x3ef505[_0x52fd('0x18')]=qs['offset'](_0x637be7[_0x52fd('0x2f')][_0x52fd('0x18')]);}_0x3ef505[_0x52fd('0x37')]=qs[_0x52fd('0x38')](_0x637be7[_0x52fd('0x2f')][_0x52fd('0x38')]);_0x3ef505[_0x52fd('0x39')]=qs[_0x52fd('0x30')](_[_0x52fd('0x3a')](_0x637be7[_0x52fd('0x2f')],_0x3c9a82[_0x52fd('0x30')]),_0x4bad91);if(_0x637be7[_0x52fd('0x2f')][_0x52fd('0x3b')]){_0x3ef505[_0x52fd('0x39')]=_[_0x52fd('0x3c')](_0x3ef505[_0x52fd('0x39')],{'$or':_[_0x52fd('0x29')](_0x4bad91,function(_0x58ee5f){if(_0x58ee5f[_0x52fd('0x2c')]!=='VIRTUAL'){var _0x20058a={};_0x20058a[_0x58ee5f[_0x52fd('0x26')]]={'$like':'%'+_0x637be7[_0x52fd('0x2f')][_0x52fd('0x3b')]+'%'};return _0x20058a;}})});}_0x3ef505=_['merge']({},_0x3ef505,_0x637be7[_0x52fd('0x3d')]);var _0x55e72f={'where':_0x3ef505['where']};return db['Dynamics365Configuration'][_0x52fd('0x1b')](_0x55e72f)[_0x52fd('0x21')](function(_0x5e72c9){_0x199aa9[_0x52fd('0x1b')]=_0x5e72c9;if(_0x637be7['query'][_0x52fd('0x3e')]){_0x3ef505[_0x52fd('0x3f')]=[{'all':!![]}];}return db[_0x52fd('0x2a')][_0x52fd('0x40')](_0x3ef505);})[_0x52fd('0x21')](function(_0x958e3){_0x199aa9[_0x52fd('0x41')]=_0x958e3;return _0x199aa9;})[_0x52fd('0x21')](respondWithFilteredResult(_0x3c3d9e,_0x3ef505))[_0x52fd('0x42')](handleError(_0x3c3d9e,null));};exports['show']=function(_0x570490,_0x6d37d5){var _0x57ac1d={'raw':![],'where':{'id':_0x570490[_0x52fd('0x43')]['id']}},_0x3df30f={};_0x3df30f[_0x52fd('0x2e')]=_[_0x52fd('0x44')](db[_0x52fd('0x2a')][_0x52fd('0x45')]);_0x3df30f[_0x52fd('0x2f')]=_[_0x52fd('0x44')](_0x570490[_0x52fd('0x2f')]);_0x3df30f[_0x52fd('0x30')]=_[_0x52fd('0x31')](_0x3df30f[_0x52fd('0x2e')],_0x3df30f[_0x52fd('0x2f')]);_0x57ac1d[_0x52fd('0x32')]=_[_0x52fd('0x31')](_0x3df30f['model'],qs[_0x52fd('0x33')](_0x570490['query'][_0x52fd('0x33')]));_0x57ac1d[_0x52fd('0x32')]=_0x57ac1d[_0x52fd('0x32')][_0x52fd('0x34')]?_0x57ac1d[_0x52fd('0x32')]:_0x3df30f['model'];if(_0x570490[_0x52fd('0x2f')]['includeAll']){_0x57ac1d[_0x52fd('0x3f')]=[{'all':!![]}];}_0x57ac1d=_[_0x52fd('0x3c')]({},_0x57ac1d,_0x570490[_0x52fd('0x3d')]);return db[_0x52fd('0x2a')][_0x52fd('0x46')](_0x57ac1d)[_0x52fd('0x21')](handleEntityNotFound(_0x6d37d5,null))[_0x52fd('0x21')](respondWithResult(_0x6d37d5,null))['catch'](handleError(_0x6d37d5,null));};exports[_0x52fd('0x47')]=function(_0x345ae9,_0x569733){return db['Dynamics365Configuration']['create'](_0x345ae9[_0x52fd('0x48')],{})[_0x52fd('0x21')](respondWithResult(_0x569733,0xc9))[_0x52fd('0x42')](handleError(_0x569733,null));};exports['update']=function(_0x13e47d,_0x39133c){if(_0x13e47d[_0x52fd('0x48')]['id']){delete _0x13e47d[_0x52fd('0x48')]['id'];}return db[_0x52fd('0x2a')]['find']({'where':{'id':_0x13e47d[_0x52fd('0x43')]['id']}})[_0x52fd('0x21')](handleEntityNotFound(_0x39133c,null))[_0x52fd('0x21')](saveUpdates(_0x13e47d[_0x52fd('0x48')],null))[_0x52fd('0x21')](respondWithResult(_0x39133c,null))[_0x52fd('0x42')](handleError(_0x39133c,null));};exports[_0x52fd('0x22')]=function(_0x3f7ff1,_0x5c051e){return db[_0x52fd('0x2a')][_0x52fd('0x46')]({'where':{'id':_0x3f7ff1['params']['id']}})[_0x52fd('0x21')](handleEntityNotFound(_0x5c051e,null))[_0x52fd('0x21')](removeEntity(_0x5c051e,null))[_0x52fd('0x42')](handleError(_0x5c051e,null));};exports[_0x52fd('0x49')]=function(_0x24213f,_0x44f682,_0x209a4b){var _0x348844={};var _0x4a9b43={};var _0xb737ef;var _0x16d047;return db[_0x52fd('0x2a')][_0x52fd('0x4a')]({'where':{'id':_0x24213f['params']['id']}})[_0x52fd('0x21')](handleEntityNotFound(_0x44f682,null))[_0x52fd('0x21')](function(_0x580264){if(_0x580264){_0xb737ef=_0x580264;_0x4a9b43[_0x52fd('0x2e')]=_[_0x52fd('0x44')](db['Dynamics365Field']['rawAttributes']);_0x4a9b43[_0x52fd('0x2f')]=_[_0x52fd('0x44')](_0x24213f['query']);_0x4a9b43[_0x52fd('0x30')]=_[_0x52fd('0x31')](_0x4a9b43[_0x52fd('0x2e')],_0x4a9b43[_0x52fd('0x2f')]);_0x348844[_0x52fd('0x32')]=_['intersection'](_0x4a9b43[_0x52fd('0x2e')],qs[_0x52fd('0x33')](_0x24213f[_0x52fd('0x2f')][_0x52fd('0x33')]));_0x348844[_0x52fd('0x32')]=_0x348844[_0x52fd('0x32')][_0x52fd('0x34')]?_0x348844['attributes']:_0x4a9b43[_0x52fd('0x2e')];_0x348844[_0x52fd('0x37')]=qs[_0x52fd('0x38')](_0x24213f[_0x52fd('0x2f')][_0x52fd('0x38')]);_0x348844[_0x52fd('0x39')]=qs[_0x52fd('0x30')](_[_0x52fd('0x3a')](_0x24213f[_0x52fd('0x2f')],_0x4a9b43[_0x52fd('0x30')]));if(_0x24213f['query']['filter']){_0x348844[_0x52fd('0x39')]=_[_0x52fd('0x3c')](_0x348844[_0x52fd('0x39')],{'$or':_[_0x52fd('0x29')](_0x348844[_0x52fd('0x32')],function(_0x3a66b8){var _0xa15ca={};_0xa15ca[_0x3a66b8]={'$like':'%'+_0x24213f[_0x52fd('0x2f')][_0x52fd('0x3b')]+'%'};return _0xa15ca;})});}_0x348844=_[_0x52fd('0x3c')]({},_0x348844,_0x24213f[_0x52fd('0x3d')]);return _0xb737ef['getFields'](_0x348844);}})[_0x52fd('0x21')](function(_0x4002c5){if(_0x4002c5){_0x16d047=_0x4002c5[_0x52fd('0x34')];if(!_0x24213f['query'][_0x52fd('0x35')](_0x52fd('0x36'))){_0x348844[_0x52fd('0x1a')]=qs[_0x52fd('0x1a')](_0x24213f[_0x52fd('0x2f')][_0x52fd('0x1a')]);_0x348844['offset']=qs[_0x52fd('0x18')](_0x24213f[_0x52fd('0x2f')]['offset']);}return _0xb737ef['getFields'](_0x348844);}})[_0x52fd('0x21')](function(_0x3c5966){if(_0x3c5966){return _0x3c5966?{'count':_0x16d047,'rows':_0x3c5966}:null;}})[_0x52fd('0x21')](respondWithResult(_0x44f682,null))[_0x52fd('0x42')](handleError(_0x44f682,null));};exports['getSubjects']=function(_0x47ffbb,_0x4f309e,_0x25e4ee){var _0x2c5eda={};var _0x148a8a={};var _0x5da5d2;var _0x52d94d;return db[_0x52fd('0x2a')]['findOne']({'where':{'id':_0x47ffbb['params']['id']}})['then'](handleEntityNotFound(_0x4f309e,null))[_0x52fd('0x21')](function(_0x24a3d8){if(_0x24a3d8){_0x5da5d2=_0x24a3d8;_0x148a8a[_0x52fd('0x2e')]=_['keys'](db['Dynamics365Field']['rawAttributes']);_0x148a8a['query']=_['keys'](_0x47ffbb[_0x52fd('0x2f')]);_0x148a8a[_0x52fd('0x30')]=_['intersection'](_0x148a8a[_0x52fd('0x2e')],_0x148a8a['query']);_0x2c5eda['attributes']=_[_0x52fd('0x31')](_0x148a8a[_0x52fd('0x2e')],qs[_0x52fd('0x33')](_0x47ffbb[_0x52fd('0x2f')][_0x52fd('0x33')]));_0x2c5eda[_0x52fd('0x32')]=_0x2c5eda[_0x52fd('0x32')][_0x52fd('0x34')]?_0x2c5eda[_0x52fd('0x32')]:_0x148a8a['model'];_0x2c5eda[_0x52fd('0x37')]=qs[_0x52fd('0x38')](_0x47ffbb[_0x52fd('0x2f')]['sort']);_0x2c5eda[_0x52fd('0x39')]=qs[_0x52fd('0x30')](_[_0x52fd('0x3a')](_0x47ffbb[_0x52fd('0x2f')],_0x148a8a[_0x52fd('0x30')]));if(_0x47ffbb[_0x52fd('0x2f')][_0x52fd('0x3b')]){_0x2c5eda[_0x52fd('0x39')]=_[_0x52fd('0x3c')](_0x2c5eda[_0x52fd('0x39')],{'$or':_['map'](_0x2c5eda[_0x52fd('0x32')],function(_0x83edb6){var _0x3540e1={};_0x3540e1[_0x83edb6]={'$like':'%'+_0x47ffbb[_0x52fd('0x2f')][_0x52fd('0x3b')]+'%'};return _0x3540e1;})});}_0x2c5eda=_[_0x52fd('0x3c')]({},_0x2c5eda,_0x47ffbb['options']);return _0x5da5d2[_0x52fd('0x4b')](_0x2c5eda);}})[_0x52fd('0x21')](function(_0x4b83a2){if(_0x4b83a2){_0x52d94d=_0x4b83a2[_0x52fd('0x34')];if(!_0x47ffbb['query'][_0x52fd('0x35')](_0x52fd('0x36'))){_0x2c5eda[_0x52fd('0x1a')]=qs[_0x52fd('0x1a')](_0x47ffbb[_0x52fd('0x2f')]['limit']);_0x2c5eda[_0x52fd('0x18')]=qs[_0x52fd('0x18')](_0x47ffbb['query'][_0x52fd('0x18')]);}return _0x5da5d2['getSubjects'](_0x2c5eda);}})[_0x52fd('0x21')](function(_0x15021b){if(_0x15021b){return _0x15021b?{'count':_0x52d94d,'rows':_0x15021b}:null;}})[_0x52fd('0x21')](respondWithResult(_0x4f309e,null))['catch'](handleError(_0x4f309e,null));};exports[_0x52fd('0x4c')]=function(_0x99628,_0x5a9bca,_0x29ff4e){var _0x13b040={};var _0x5ae645={};var _0x567556;var _0x4e44c5;return db[_0x52fd('0x2a')][_0x52fd('0x4a')]({'where':{'id':_0x99628['params']['id']}})[_0x52fd('0x21')](handleEntityNotFound(_0x5a9bca,null))[_0x52fd('0x21')](function(_0x5569fc){if(_0x5569fc){_0x567556=_0x5569fc;_0x5ae645[_0x52fd('0x2e')]=_[_0x52fd('0x44')](db[_0x52fd('0x4d')][_0x52fd('0x45')]);_0x5ae645['query']=_[_0x52fd('0x44')](_0x99628[_0x52fd('0x2f')]);_0x5ae645[_0x52fd('0x30')]=_['intersection'](_0x5ae645[_0x52fd('0x2e')],_0x5ae645[_0x52fd('0x2f')]);_0x13b040[_0x52fd('0x32')]=_[_0x52fd('0x31')](_0x5ae645[_0x52fd('0x2e')],qs[_0x52fd('0x33')](_0x99628['query'][_0x52fd('0x33')]));_0x13b040[_0x52fd('0x32')]=_0x13b040[_0x52fd('0x32')][_0x52fd('0x34')]?_0x13b040[_0x52fd('0x32')]:_0x5ae645[_0x52fd('0x2e')];_0x13b040[_0x52fd('0x37')]=qs[_0x52fd('0x38')](_0x99628[_0x52fd('0x2f')][_0x52fd('0x38')]);_0x13b040[_0x52fd('0x39')]=qs[_0x52fd('0x30')](_[_0x52fd('0x3a')](_0x99628[_0x52fd('0x2f')],_0x5ae645[_0x52fd('0x30')]));if(_0x99628[_0x52fd('0x2f')][_0x52fd('0x3b')]){_0x13b040[_0x52fd('0x39')]=_[_0x52fd('0x3c')](_0x13b040[_0x52fd('0x39')],{'$or':_[_0x52fd('0x29')](_0x13b040[_0x52fd('0x32')],function(_0x5567dd){var _0x598135={};_0x598135[_0x5567dd]={'$like':'%'+_0x99628['query'][_0x52fd('0x3b')]+'%'};return _0x598135;})});}_0x13b040=_[_0x52fd('0x3c')]({},_0x13b040,_0x99628[_0x52fd('0x3d')]);return _0x567556[_0x52fd('0x4c')](_0x13b040);}})[_0x52fd('0x21')](function(_0x59e51f){if(_0x59e51f){_0x4e44c5=_0x59e51f[_0x52fd('0x34')];if(!_0x99628[_0x52fd('0x2f')][_0x52fd('0x35')](_0x52fd('0x36'))){_0x13b040[_0x52fd('0x1a')]=qs['limit'](_0x99628['query']['limit']);_0x13b040[_0x52fd('0x18')]=qs[_0x52fd('0x18')](_0x99628[_0x52fd('0x2f')][_0x52fd('0x18')]);}return _0x567556[_0x52fd('0x4c')](_0x13b040);}})['then'](function(_0x1d4b93){if(_0x1d4b93){return _0x1d4b93?{'count':_0x4e44c5,'rows':_0x1d4b93}:null;}})[_0x52fd('0x21')](respondWithResult(_0x5a9bca,null))[_0x52fd('0x42')](handleError(_0x5a9bca,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 15b9a6f..13b43ab 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 _0xf3cd=['path','rimraf','../../config/environment','exports','define','Dynamics365Configuration','int_dynamics365_configurations','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x40ccb2,_0x393b29){var _0x40d81a=function(_0x562ff5){while(--_0x562ff5){_0x40ccb2['push'](_0x40ccb2['shift']());}};_0x40d81a(++_0x393b29);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x2595a6,_0x48fc45){_0x2595a6=_0x2595a6-0x0;var _0x460197=_0xf3cd[_0x2595a6];return _0x460197;};'use strict';var _=require(_0xdf3c('0x0'));var util=require(_0xdf3c('0x1'));var logger=require(_0xdf3c('0x2'))(_0xdf3c('0x3'));var moment=require(_0xdf3c('0x4'));var BPromise=require(_0xdf3c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdf3c('0x6'));var rimraf=require(_0xdf3c('0x7'));var config=require(_0xdf3c('0x8'));var attributes=require('./intDynamics365Configuration.attributes');module[_0xdf3c('0x9')]=function(_0x17d42a,_0x1313d5){return _0x17d42a[_0xdf3c('0xa')](_0xdf3c('0xb'),attributes,{'tableName':_0xdf3c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8d0e=['define','Dynamics365Configuration','int_dynamics365_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intDynamics365Configuration.attributes'];(function(_0x469f93,_0x2a2c71){var _0x465f36=function(_0x49e22a){while(--_0x49e22a){_0x469f93['push'](_0x469f93['shift']());}};_0x465f36(++_0x2a2c71);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x59ef40,_0x5eaa46){_0x59ef40=_0x59ef40-0x0;var _0x282ed7=_0x8d0e[_0x59ef40];return _0x282ed7;};'use strict';var _=require(_0xe8d0('0x0'));var util=require(_0xe8d0('0x1'));var logger=require(_0xe8d0('0x2'))(_0xe8d0('0x3'));var moment=require(_0xe8d0('0x4'));var BPromise=require(_0xe8d0('0x5'));var rp=require(_0xe8d0('0x6'));var fs=require('fs');var path=require(_0xe8d0('0x7'));var rimraf=require(_0xe8d0('0x8'));var config=require('../../config/environment');var attributes=require(_0xe8d0('0x9'));module['exports']=function(_0x560dab,_0x2e2985){return _0x560dab[_0xe8d0('0xa')](_0xe8d0('0xb'),attributes,{'tableName':_0xe8d0('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index 03d812a..faa5485 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 _0xc44b=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util'];(function(_0x5dec5d,_0x3e9854){var _0x335653=function(_0x543b37){while(--_0x543b37){_0x5dec5d['push'](_0x5dec5d['shift']());}};_0x335653(++_0x3e9854);}(_0xc44b,0xb4));var _0xbc44=function(_0x1477ef,_0x54a5d6){_0x1477ef=_0x1477ef-0x0;var _0x164acd=_0xc44b[_0x1477ef];return _0x164acd;};'use strict';var _=require(_0xbc44('0x0'));var util=require(_0xbc44('0x1'));var moment=require(_0xbc44('0x2'));var BPromise=require(_0xbc44('0x3'));var rs=require(_0xbc44('0x4'));var fs=require('fs');var Redis=require(_0xbc44('0x5'));var db=require(_0xbc44('0x6'))['db'];var utils=require(_0xbc44('0x7'));var logger=require(_0xbc44('0x8'))(_0xbc44('0x9'));var config=require(_0xbc44('0xa'));var jayson=require(_0xbc44('0xb'));var client=jayson[_0xbc44('0xc')][_0xbc44('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x50327f,_0xc1acd7,_0x18aa36){return new BPromise(function(_0x24de1d,_0x243b50){return client['request'](_0x50327f,_0x18aa36)[_0xbc44('0xe')](function(_0x420424){logger[_0xbc44('0xf')](_0xbc44('0x10'),_0xc1acd7,_0xbc44('0x11'));logger[_0xbc44('0x12')](_0xbc44('0x13'),_0xc1acd7,'request\x20sent',JSON[_0xbc44('0x14')](_0x420424));if(_0x420424[_0xbc44('0x15')]){if(_0x420424[_0xbc44('0x15')][_0xbc44('0x16')]===0x1f4){logger['error'](_0xbc44('0x10'),_0xc1acd7,_0x420424[_0xbc44('0x15')][_0xbc44('0x17')]);return _0x243b50(_0x420424[_0xbc44('0x15')][_0xbc44('0x17')]);}logger['error']('Dynamics365Configuration,\x20%s,\x20%s',_0xc1acd7,_0x420424[_0xbc44('0x15')][_0xbc44('0x17')]);return _0x24de1d(_0x420424[_0xbc44('0x15')][_0xbc44('0x17')]);}else{logger[_0xbc44('0xf')](_0xbc44('0x10'),_0xc1acd7,'request\x20sent');_0x24de1d(_0x420424[_0xbc44('0x18')]['message']);}})[_0xbc44('0x19')](function(_0xf9d041){logger[_0xbc44('0x15')](_0xbc44('0x10'),_0xc1acd7,_0xf9d041);_0x243b50(_0xf9d041);});});} \ No newline at end of file +var _0xfdf9=['jayson/promise','client','http','request','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0xfdf9,0x1c6));var _0x9fdf=function(_0x501ba3,_0x23b3e3){_0x501ba3=_0x501ba3-0x0;var _0x2ed213=_0xfdf9[_0x501ba3];return _0x2ed213;};'use strict';var _=require(_0x9fdf('0x0'));var util=require(_0x9fdf('0x1'));var moment=require('moment');var BPromise=require(_0x9fdf('0x2'));var rs=require(_0x9fdf('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9fdf('0x4'))['db'];var utils=require(_0x9fdf('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x9fdf('0x6'));var client=jayson[_0x9fdf('0x7')][_0x9fdf('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x174dfb,_0x196f1d,_0x146e44){return new BPromise(function(_0x5a2e0b,_0x367dfb){return client[_0x9fdf('0x9')](_0x174dfb,_0x146e44)['then'](function(_0x5d0997){logger['info'](_0x9fdf('0xa'),_0x196f1d,_0x9fdf('0xb'));logger[_0x9fdf('0xc')](_0x9fdf('0xd'),_0x196f1d,_0x9fdf('0xb'),JSON[_0x9fdf('0xe')](_0x5d0997));if(_0x5d0997['error']){if(_0x5d0997['error'][_0x9fdf('0xf')]===0x1f4){logger['error'](_0x9fdf('0xa'),_0x196f1d,_0x5d0997[_0x9fdf('0x10')][_0x9fdf('0x11')]);return _0x367dfb(_0x5d0997[_0x9fdf('0x10')]['message']);}logger['error'](_0x9fdf('0xa'),_0x196f1d,_0x5d0997[_0x9fdf('0x10')][_0x9fdf('0x11')]);return _0x5a2e0b(_0x5d0997['error'][_0x9fdf('0x11')]);}else{logger[_0x9fdf('0x12')]('Dynamics365Configuration,\x20%s,\x20%s',_0x196f1d,_0x9fdf('0xb'));_0x5a2e0b(_0x5d0997['result']['message']);}})[_0x9fdf('0x13')](function(_0x53c484){logger[_0x9fdf('0x10')](_0x9fdf('0xa'),_0x196f1d,_0x53c484);_0x367dfb(_0x53c484);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 71b53d1..327586f 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 _0x0714=['/:id','isAuthenticated','show','post','update','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../config/environment','./intDynamics365Field.controller','get','index'];(function(_0xceee14,_0x445318){var _0x5139df=function(_0x5b7727){while(--_0x5b7727){_0xceee14['push'](_0xceee14['shift']());}};_0x5139df(++_0x445318);}(_0x0714,0x177));var _0x4071=function(_0x144ba0,_0x1e7b98){_0x144ba0=_0x144ba0-0x0;var _0x3b95c1=_0x0714[_0x144ba0];return _0x3b95c1;};'use strict';var multer=require(_0x4071('0x0'));var util=require(_0x4071('0x1'));var path=require(_0x4071('0x2'));var timeout=require(_0x4071('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x4071('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4071('0x5'));var controller=require(_0x4071('0x6'));router[_0x4071('0x7')]('/',auth['isAuthenticated'](),controller[_0x4071('0x8')]);router[_0x4071('0x7')](_0x4071('0x9'),auth[_0x4071('0xa')](),controller[_0x4071('0xb')]);router[_0x4071('0xc')]('/',auth[_0x4071('0xa')](),controller['create']);router['put'](_0x4071('0x9'),auth[_0x4071('0xa')](),controller[_0x4071('0xd')]);router['delete'](_0x4071('0x9'),auth['isAuthenticated'](),controller[_0x4071('0xe')]);module[_0x4071('0xf')]=router; \ No newline at end of file +var _0xe20c=['../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','/:id','show','create','put','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x27c1fb,_0x5a124d){var _0x159eb0=function(_0x4b6877){while(--_0x4b6877){_0x27c1fb['push'](_0x27c1fb['shift']());}};_0x159eb0(++_0x5a124d);}(_0xe20c,0x91));var _0xce20=function(_0x4c764c,_0x4b456c){_0x4c764c=_0x4c764c-0x0;var _0x563316=_0xe20c[_0x4c764c];return _0x563316;};'use strict';var multer=require(_0xce20('0x0'));var util=require(_0xce20('0x1'));var path=require('path');var timeout=require(_0xce20('0x2'));var express=require(_0xce20('0x3'));var router=express[_0xce20('0x4')]();var fs_extra=require(_0xce20('0x5'));var auth=require(_0xce20('0x6'));var interaction=require(_0xce20('0x7'));var config=require(_0xce20('0x8'));var controller=require(_0xce20('0x9'));router[_0xce20('0xa')]('/',auth[_0xce20('0xb')](),controller['index']);router[_0xce20('0xa')](_0xce20('0xc'),auth['isAuthenticated'](),controller[_0xce20('0xd')]);router['post']('/',auth[_0xce20('0xb')](),controller[_0xce20('0xe')]);router[_0xce20('0xf')](_0xce20('0xc'),auth[_0xce20('0xb')](),controller[_0xce20('0x10')]);router[_0xce20('0x11')](_0xce20('0xc'),auth[_0xce20('0xb')](),controller['destroy']);module[_0xce20('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 34eee1d..3371ac8 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 _0x6cbc=['customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM','variable'];(function(_0x5a7de2,_0x2c0c67){var _0x4c5a8e=function(_0x123d79){while(--_0x123d79){_0x5a7de2['push'](_0x5a7de2['shift']());}};_0x4c5a8e(++_0x2c0c67);}(_0x6cbc,0x1d0));var _0xc6cb=function(_0x42693d,_0x434c1c){_0x42693d=_0x42693d-0x0;var _0x57f95f=_0x6cbc[_0x42693d];return _0x57f95f;};'use strict';var Sequelize=require(_0xc6cb('0x0'));module[_0xc6cb('0x1')]={'type':{'type':Sequelize[_0xc6cb('0x2')]('string',_0xc6cb('0x3'),_0xc6cb('0x4'),_0xc6cb('0x5'),_0xc6cb('0x6')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xc6cb('0x7')]},'keyType':{'type':Sequelize[_0xc6cb('0x2')]('string',_0xc6cb('0x3'),_0xc6cb('0x4'))},'keyContent':{'type':Sequelize[_0xc6cb('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xc6cb('0x7')]},'customField':{'type':Sequelize[_0xc6cb('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc6cb('0x7')]}}; \ No newline at end of file +var _0x6390=['customVariable','BOOLEAN','sequelize','exports','ENUM','string','variable','keyValue','STRING'];(function(_0xd12c51,_0x5107de){var _0x29177d=function(_0x52876c){while(--_0x52876c){_0xd12c51['push'](_0xd12c51['shift']());}};_0x29177d(++_0x5107de);}(_0x6390,0x119));var _0x0639=function(_0x1ac971,_0x21f635){_0x1ac971=_0x1ac971-0x0;var _0x3509e9=_0x6390[_0x1ac971];return _0x3509e9;};'use strict';var Sequelize=require(_0x0639('0x0'));module[_0x0639('0x1')]={'type':{'type':Sequelize[_0x0639('0x2')](_0x0639('0x3'),_0x0639('0x4'),'customVariable',_0x0639('0x5'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x0639('0x6')]},'key':{'type':Sequelize[_0x0639('0x6')]},'keyType':{'type':Sequelize[_0x0639('0x2')](_0x0639('0x3'),_0x0639('0x4'),_0x0639('0x7'))},'keyContent':{'type':Sequelize[_0x0639('0x6')]},'idField':{'type':Sequelize[_0x0639('0x6')]},'nameField':{'type':Sequelize[_0x0639('0x6')]},'customField':{'type':Sequelize[_0x0639('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0639('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 487236c..ddf1a1c 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 _0xd853=['sort','where','pick','filter','merge','options','includeAll','include','Dynamics365Field','findAll','catch','params','find','create','body','destroy','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','offset','limit','count','status','set','json','apply','reject','update','then','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit'];(function(_0x476341,_0x498228){var _0x27b6d5=function(_0x192d23){while(--_0x192d23){_0x476341['push'](_0x476341['shift']());}};_0x27b6d5(++_0x498228);}(_0xd853,0xd9));var _0x3d85=function(_0x54d52,_0x2473ba){_0x54d52=_0x54d52-0x0;var _0x968345=_0xd853[_0x54d52];return _0x968345;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3d85('0x0'));var jsonpatch=require(_0x3d85('0x1'));var rp=require('request-promise');var moment=require(_0x3d85('0x2'));var BPromise=require(_0x3d85('0x3'));var Mustache=require(_0x3d85('0x4'));var util=require('util');var path=require(_0x3d85('0x5'));var sox=require('sox');var csv=require(_0x3d85('0x6'));var ejs=require(_0x3d85('0x7'));var fs=require('fs');var fs_extra=require(_0x3d85('0x8'));var _=require(_0x3d85('0x9'));var squel=require('squel');var crypto=require(_0x3d85('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x3d85('0xb'));var toCsv=require('to-csv');var querystring=require(_0x3d85('0xc'));var Papa=require('papaparse');var Redis=require(_0x3d85('0xd'));var authService=require(_0x3d85('0xe'));var qs=require(_0x3d85('0xf'));var as=require(_0x3d85('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3d85('0x11'))(_0x3d85('0x12'));var utils=require(_0x3d85('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x3d85('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x7efef9,_0x1476b6){_0x1476b6=_0x1476b6||0xcc;return function(_0x4903bd){if(_0x4903bd){return _0x7efef9[_0x3d85('0x15')](_0x1476b6);}return _0x7efef9['status'](_0x1476b6)['end']();};}function respondWithResult(_0x29f1e2,_0x487422){_0x487422=_0x487422||0xc8;return function(_0x48afa6){if(_0x48afa6){return _0x29f1e2['status'](_0x487422)['json'](_0x48afa6);}};}function respondWithFilteredResult(_0x203755,_0x41dd35){return function(_0x43bcb1){if(_0x43bcb1){var _0x7f4847=typeof _0x41dd35[_0x3d85('0x16')]==='undefined'&&typeof _0x41dd35[_0x3d85('0x17')]==='undefined';var _0x4eb11f=_0x43bcb1[_0x3d85('0x18')];var _0x11e040=_0x7f4847?0x0:_0x41dd35[_0x3d85('0x16')];var _0x19225a=_0x7f4847?_0x43bcb1[_0x3d85('0x18')]:_0x41dd35[_0x3d85('0x16')]+_0x41dd35['limit'];var _0x45a872;if(_0x19225a>=_0x4eb11f){_0x19225a=_0x4eb11f;_0x45a872=0xc8;}else{_0x45a872=0xce;}_0x203755[_0x3d85('0x19')](_0x45a872);return _0x203755[_0x3d85('0x1a')]('Content-Range',_0x11e040+'-'+_0x19225a+'/'+_0x4eb11f)[_0x3d85('0x1b')](_0x43bcb1);}return null;};}function patchUpdates(_0x48b100){return function(_0x4515c6){try{jsonpatch[_0x3d85('0x1c')](_0x4515c6,_0x48b100,!![]);}catch(_0x428ab7){return BPromise[_0x3d85('0x1d')](_0x428ab7);}return _0x4515c6['save']();};}function saveUpdates(_0x130e66,_0x1cda9e){return function(_0x4e57d8){if(_0x4e57d8){return _0x4e57d8[_0x3d85('0x1e')](_0x130e66)[_0x3d85('0x1f')](function(_0x63e108){return _0x63e108;});}return null;};}function removeEntity(_0x48a761,_0x2964e6){return function(_0x4621c2){if(_0x4621c2){return _0x4621c2['destroy']()[_0x3d85('0x1f')](function(){_0x48a761[_0x3d85('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x37489a,_0xbad17f){return function(_0x36c299){if(!_0x36c299){_0x37489a[_0x3d85('0x15')](0x194);}return _0x36c299;};}function handleError(_0x37569c,_0x4f785d){_0x4f785d=_0x4f785d||0x1f4;return function(_0x3315f1){logger[_0x3d85('0x20')](_0x3315f1[_0x3d85('0x21')]);if(_0x3315f1[_0x3d85('0x22')]){delete _0x3315f1['name'];}_0x37569c[_0x3d85('0x19')](_0x4f785d)['send'](_0x3315f1);};}exports[_0x3d85('0x23')]=function(_0x2cc11d,_0x16df29){var _0x2250fc={},_0x2a7d2f={},_0x1c9b7d={'count':0x0,'rows':[]};var _0x3549dc=_[_0x3d85('0x24')](db['Dynamics365Field'][_0x3d85('0x25')],function(_0x5896c5){return{'name':_0x5896c5[_0x3d85('0x26')],'type':_0x5896c5[_0x3d85('0x27')][_0x3d85('0x28')]};});_0x2a7d2f[_0x3d85('0x29')]=_['map'](_0x3549dc,_0x3d85('0x22'));_0x2a7d2f[_0x3d85('0x2a')]=_[_0x3d85('0x2b')](_0x2cc11d[_0x3d85('0x2a')]);_0x2a7d2f[_0x3d85('0x2c')]=_['intersection'](_0x2a7d2f[_0x3d85('0x29')],_0x2a7d2f[_0x3d85('0x2a')]);_0x2250fc[_0x3d85('0x2d')]=_[_0x3d85('0x2e')](_0x2a7d2f[_0x3d85('0x29')],qs[_0x3d85('0x2f')](_0x2cc11d['query']['fields']));_0x2250fc[_0x3d85('0x2d')]=_0x2250fc['attributes'][_0x3d85('0x30')]?_0x2250fc['attributes']:_0x2a7d2f['model'];if(!_0x2cc11d['query'][_0x3d85('0x31')](_0x3d85('0x32'))){_0x2250fc['limit']=qs[_0x3d85('0x17')](_0x2cc11d[_0x3d85('0x2a')][_0x3d85('0x17')]);_0x2250fc[_0x3d85('0x16')]=qs[_0x3d85('0x16')](_0x2cc11d[_0x3d85('0x2a')]['offset']);}_0x2250fc['order']=qs[_0x3d85('0x33')](_0x2cc11d[_0x3d85('0x2a')]['sort']);_0x2250fc[_0x3d85('0x34')]=qs['filters'](_[_0x3d85('0x35')](_0x2cc11d['query'],_0x2a7d2f[_0x3d85('0x2c')]),_0x3549dc);if(_0x2cc11d['query'][_0x3d85('0x36')]){_0x2250fc[_0x3d85('0x34')]=_['merge'](_0x2250fc['where'],{'$or':_[_0x3d85('0x24')](_0x3549dc,function(_0x21d32e){if(_0x21d32e[_0x3d85('0x27')]!=='VIRTUAL'){var _0x4318e2={};_0x4318e2[_0x21d32e[_0x3d85('0x22')]]={'$like':'%'+_0x2cc11d['query'][_0x3d85('0x36')]+'%'};return _0x4318e2;}})});}_0x2250fc=_[_0x3d85('0x37')]({},_0x2250fc,_0x2cc11d[_0x3d85('0x38')]);var _0x2cbf4b={'where':_0x2250fc['where']};return db['Dynamics365Field'][_0x3d85('0x18')](_0x2cbf4b)[_0x3d85('0x1f')](function(_0x481697){_0x1c9b7d['count']=_0x481697;if(_0x2cc11d[_0x3d85('0x2a')][_0x3d85('0x39')]){_0x2250fc[_0x3d85('0x3a')]=[{'all':!![]}];}return db[_0x3d85('0x3b')][_0x3d85('0x3c')](_0x2250fc);})[_0x3d85('0x1f')](function(_0x448545){_0x1c9b7d['rows']=_0x448545;return _0x1c9b7d;})['then'](respondWithFilteredResult(_0x16df29,_0x2250fc))[_0x3d85('0x3d')](handleError(_0x16df29,null));};exports['show']=function(_0x7ad832,_0x3c31d8){var _0x169570={'raw':!![],'where':{'id':_0x7ad832[_0x3d85('0x3e')]['id']}},_0x497bfc={};_0x497bfc[_0x3d85('0x29')]=_[_0x3d85('0x2b')](db[_0x3d85('0x3b')][_0x3d85('0x25')]);_0x497bfc[_0x3d85('0x2a')]=_[_0x3d85('0x2b')](_0x7ad832[_0x3d85('0x2a')]);_0x497bfc['filters']=_[_0x3d85('0x2e')](_0x497bfc[_0x3d85('0x29')],_0x497bfc[_0x3d85('0x2a')]);_0x169570['attributes']=_['intersection'](_0x497bfc['model'],qs[_0x3d85('0x2f')](_0x7ad832['query'][_0x3d85('0x2f')]));_0x169570[_0x3d85('0x2d')]=_0x169570['attributes'][_0x3d85('0x30')]?_0x169570[_0x3d85('0x2d')]:_0x497bfc[_0x3d85('0x29')];if(_0x7ad832[_0x3d85('0x2a')][_0x3d85('0x39')]){_0x169570['include']=[{'all':!![]}];}_0x169570=_['merge']({},_0x169570,_0x7ad832['options']);return db['Dynamics365Field'][_0x3d85('0x3f')](_0x169570)[_0x3d85('0x1f')](handleEntityNotFound(_0x3c31d8,null))[_0x3d85('0x1f')](respondWithResult(_0x3c31d8,null))[_0x3d85('0x3d')](handleError(_0x3c31d8,null));};exports['create']=function(_0x20e0c1,_0x24a012){return db[_0x3d85('0x3b')][_0x3d85('0x40')](_0x20e0c1[_0x3d85('0x41')],{})[_0x3d85('0x1f')](respondWithResult(_0x24a012,0xc9))[_0x3d85('0x3d')](handleError(_0x24a012,null));};exports[_0x3d85('0x1e')]=function(_0x3495ba,_0x4a445c){if(_0x3495ba[_0x3d85('0x41')]['id']){delete _0x3495ba['body']['id'];}return db[_0x3d85('0x3b')][_0x3d85('0x3f')]({'where':{'id':_0x3495ba[_0x3d85('0x3e')]['id']}})['then'](handleEntityNotFound(_0x4a445c,null))['then'](saveUpdates(_0x3495ba[_0x3d85('0x41')],null))['then'](respondWithResult(_0x4a445c,null))[_0x3d85('0x3d')](handleError(_0x4a445c,null));};exports[_0x3d85('0x42')]=function(_0x2ea40b,_0x4938d7){return db[_0x3d85('0x3b')]['find']({'where':{'id':_0x2ea40b[_0x3d85('0x3e')]['id']}})['then'](handleEntityNotFound(_0x4938d7,null))['then'](removeEntity(_0x4938d7,null))[_0x3d85('0x3d')](handleError(_0x4938d7,null));}; \ No newline at end of file +var _0x45b7=['end','status','limit','undefined','count','offset','set','json','apply','reject','save','update','then','stack','name','send','index','map','Dynamics365Field','fieldName','type','key','model','query','intersection','attributes','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','params','keys','rawAttributes','fields','length','find','create','body','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x45b7,0x1a2));var _0x745b=function(_0x2c48eb,_0x123733){_0x2c48eb=_0x2c48eb-0x0;var _0x32ce87=_0x45b7[_0x2c48eb];return _0x32ce87;};'use strict';var emlformat=require(_0x745b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x745b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x745b('0x2'));var moment=require(_0x745b('0x3'));var BPromise=require(_0x745b('0x4'));var Mustache=require(_0x745b('0x5'));var util=require(_0x745b('0x6'));var path=require(_0x745b('0x7'));var sox=require(_0x745b('0x8'));var csv=require('to-csv');var ejs=require(_0x745b('0x9'));var fs=require('fs');var fs_extra=require(_0x745b('0xa'));var _=require(_0x745b('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x745b('0xc'));var deskjs=require(_0x745b('0xd'));var toCsv=require(_0x745b('0xe'));var querystring=require(_0x745b('0xf'));var Papa=require(_0x745b('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x745b('0x11'));var hardwareService=require(_0x745b('0x12'));var logger=require(_0x745b('0x13'))(_0x745b('0x14'));var utils=require(_0x745b('0x15'));var config=require(_0x745b('0x16'));var licenseUtil=require(_0x745b('0x17'));var db=require(_0x745b('0x18'))['db'];function respondWithStatusCode(_0x1303b4,_0x5c5d1c){_0x5c5d1c=_0x5c5d1c||0xcc;return function(_0x3a0915){if(_0x3a0915){return _0x1303b4[_0x745b('0x19')](_0x5c5d1c);}return _0x1303b4['status'](_0x5c5d1c)[_0x745b('0x1a')]();};}function respondWithResult(_0x2a150b,_0x45fccb){_0x45fccb=_0x45fccb||0xc8;return function(_0xa3c984){if(_0xa3c984){return _0x2a150b[_0x745b('0x1b')](_0x45fccb)['json'](_0xa3c984);}};}function respondWithFilteredResult(_0x19f29c,_0x3b36d9){return function(_0x594244){if(_0x594244){var _0x1ea65e=typeof _0x3b36d9['offset']==='undefined'&&typeof _0x3b36d9[_0x745b('0x1c')]===_0x745b('0x1d');var _0x59c729=_0x594244[_0x745b('0x1e')];var _0xa1c298=_0x1ea65e?0x0:_0x3b36d9[_0x745b('0x1f')];var _0x289ccb=_0x1ea65e?_0x594244[_0x745b('0x1e')]:_0x3b36d9[_0x745b('0x1f')]+_0x3b36d9['limit'];var _0x545983;if(_0x289ccb>=_0x59c729){_0x289ccb=_0x59c729;_0x545983=0xc8;}else{_0x545983=0xce;}_0x19f29c[_0x745b('0x1b')](_0x545983);return _0x19f29c[_0x745b('0x20')]('Content-Range',_0xa1c298+'-'+_0x289ccb+'/'+_0x59c729)[_0x745b('0x21')](_0x594244);}return null;};}function patchUpdates(_0x1053dc){return function(_0x2b7200){try{jsonpatch[_0x745b('0x22')](_0x2b7200,_0x1053dc,!![]);}catch(_0x477232){return BPromise[_0x745b('0x23')](_0x477232);}return _0x2b7200[_0x745b('0x24')]();};}function saveUpdates(_0x45bb3f,_0x4b1be5){return function(_0x143a03){if(_0x143a03){return _0x143a03[_0x745b('0x25')](_0x45bb3f)[_0x745b('0x26')](function(_0xd58212){return _0xd58212;});}return null;};}function removeEntity(_0xaee61f,_0x2131cf){return function(_0x3d8cb7){if(_0x3d8cb7){return _0x3d8cb7['destroy']()[_0x745b('0x26')](function(){_0xaee61f[_0x745b('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x70fdce,_0x1b6d8c){return function(_0x216517){if(!_0x216517){_0x70fdce[_0x745b('0x19')](0x194);}return _0x216517;};}function handleError(_0x109139,_0x51ab26){_0x51ab26=_0x51ab26||0x1f4;return function(_0x5c807a){logger['error'](_0x5c807a[_0x745b('0x27')]);if(_0x5c807a[_0x745b('0x28')]){delete _0x5c807a[_0x745b('0x28')];}_0x109139[_0x745b('0x1b')](_0x51ab26)[_0x745b('0x29')](_0x5c807a);};}exports[_0x745b('0x2a')]=function(_0x4c93e4,_0x24461c){var _0x5b6bdd={},_0x32f345={},_0x4af296={'count':0x0,'rows':[]};var _0x24fe4a=_[_0x745b('0x2b')](db[_0x745b('0x2c')]['rawAttributes'],function(_0x25e323){return{'name':_0x25e323[_0x745b('0x2d')],'type':_0x25e323[_0x745b('0x2e')][_0x745b('0x2f')]};});_0x32f345[_0x745b('0x30')]=_[_0x745b('0x2b')](_0x24fe4a,_0x745b('0x28'));_0x32f345[_0x745b('0x31')]=_['keys'](_0x4c93e4['query']);_0x32f345['filters']=_[_0x745b('0x32')](_0x32f345[_0x745b('0x30')],_0x32f345[_0x745b('0x31')]);_0x5b6bdd['attributes']=_[_0x745b('0x32')](_0x32f345[_0x745b('0x30')],qs['fields'](_0x4c93e4[_0x745b('0x31')]['fields']));_0x5b6bdd[_0x745b('0x33')]=_0x5b6bdd[_0x745b('0x33')]['length']?_0x5b6bdd[_0x745b('0x33')]:_0x32f345[_0x745b('0x30')];if(!_0x4c93e4[_0x745b('0x31')][_0x745b('0x34')](_0x745b('0x35'))){_0x5b6bdd[_0x745b('0x1c')]=qs[_0x745b('0x1c')](_0x4c93e4[_0x745b('0x31')][_0x745b('0x1c')]);_0x5b6bdd['offset']=qs[_0x745b('0x1f')](_0x4c93e4[_0x745b('0x31')][_0x745b('0x1f')]);}_0x5b6bdd['order']=qs[_0x745b('0x36')](_0x4c93e4['query'][_0x745b('0x36')]);_0x5b6bdd[_0x745b('0x37')]=qs[_0x745b('0x38')](_[_0x745b('0x39')](_0x4c93e4[_0x745b('0x31')],_0x32f345['filters']),_0x24fe4a);if(_0x4c93e4[_0x745b('0x31')][_0x745b('0x3a')]){_0x5b6bdd[_0x745b('0x37')]=_[_0x745b('0x3b')](_0x5b6bdd[_0x745b('0x37')],{'$or':_[_0x745b('0x2b')](_0x24fe4a,function(_0x293578){if(_0x293578[_0x745b('0x2e')]!==_0x745b('0x3c')){var _0x2342ef={};_0x2342ef[_0x293578[_0x745b('0x28')]]={'$like':'%'+_0x4c93e4['query'][_0x745b('0x3a')]+'%'};return _0x2342ef;}})});}_0x5b6bdd=_['merge']({},_0x5b6bdd,_0x4c93e4[_0x745b('0x3d')]);var _0x3b4f6e={'where':_0x5b6bdd[_0x745b('0x37')]};return db['Dynamics365Field'][_0x745b('0x1e')](_0x3b4f6e)['then'](function(_0x2e5420){_0x4af296[_0x745b('0x1e')]=_0x2e5420;if(_0x4c93e4[_0x745b('0x31')][_0x745b('0x3e')]){_0x5b6bdd[_0x745b('0x3f')]=[{'all':!![]}];}return db[_0x745b('0x2c')]['findAll'](_0x5b6bdd);})[_0x745b('0x26')](function(_0x47655b){_0x4af296[_0x745b('0x40')]=_0x47655b;return _0x4af296;})[_0x745b('0x26')](respondWithFilteredResult(_0x24461c,_0x5b6bdd))[_0x745b('0x41')](handleError(_0x24461c,null));};exports['show']=function(_0x1609f4,_0x117d10){var _0x2544fc={'raw':!![],'where':{'id':_0x1609f4[_0x745b('0x42')]['id']}},_0x4ca5d9={};_0x4ca5d9[_0x745b('0x30')]=_[_0x745b('0x43')](db[_0x745b('0x2c')][_0x745b('0x44')]);_0x4ca5d9[_0x745b('0x31')]=_[_0x745b('0x43')](_0x1609f4[_0x745b('0x31')]);_0x4ca5d9[_0x745b('0x38')]=_[_0x745b('0x32')](_0x4ca5d9[_0x745b('0x30')],_0x4ca5d9[_0x745b('0x31')]);_0x2544fc['attributes']=_['intersection'](_0x4ca5d9[_0x745b('0x30')],qs[_0x745b('0x45')](_0x1609f4['query'][_0x745b('0x45')]));_0x2544fc[_0x745b('0x33')]=_0x2544fc[_0x745b('0x33')][_0x745b('0x46')]?_0x2544fc[_0x745b('0x33')]:_0x4ca5d9[_0x745b('0x30')];if(_0x1609f4['query'][_0x745b('0x3e')]){_0x2544fc['include']=[{'all':!![]}];}_0x2544fc=_[_0x745b('0x3b')]({},_0x2544fc,_0x1609f4[_0x745b('0x3d')]);return db[_0x745b('0x2c')][_0x745b('0x47')](_0x2544fc)[_0x745b('0x26')](handleEntityNotFound(_0x117d10,null))['then'](respondWithResult(_0x117d10,null))['catch'](handleError(_0x117d10,null));};exports['create']=function(_0xe70101,_0xf44bd3){return db['Dynamics365Field'][_0x745b('0x48')](_0xe70101[_0x745b('0x49')],{})[_0x745b('0x26')](respondWithResult(_0xf44bd3,0xc9))[_0x745b('0x41')](handleError(_0xf44bd3,null));};exports[_0x745b('0x25')]=function(_0x44d935,_0x57431e){if(_0x44d935['body']['id']){delete _0x44d935[_0x745b('0x49')]['id'];}return db[_0x745b('0x2c')]['find']({'where':{'id':_0x44d935[_0x745b('0x42')]['id']}})[_0x745b('0x26')](handleEntityNotFound(_0x57431e,null))['then'](saveUpdates(_0x44d935[_0x745b('0x49')],null))['then'](respondWithResult(_0x57431e,null))['catch'](handleError(_0x57431e,null));};exports['destroy']=function(_0x19da62,_0x2b05f7){return db[_0x745b('0x2c')][_0x745b('0x47')]({'where':{'id':_0x19da62[_0x745b('0x42')]['id']}})['then'](handleEntityNotFound(_0x2b05f7,null))['then'](removeEntity(_0x2b05f7,null))[_0x745b('0x41')](handleError(_0x2b05f7,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 5dd7385..2e432fd 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 _0x3f88=['exports','define','Dynamics365Field','idField','FieldId','lodash','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Field.attributes'];(function(_0x494c32,_0x26498e){var _0x520865=function(_0x4cdb2f){while(--_0x4cdb2f){_0x494c32['push'](_0x494c32['shift']());}};_0x520865(++_0x26498e);}(_0x3f88,0x14a));var _0x83f8=function(_0x499ea6,_0x105051){_0x499ea6=_0x499ea6-0x0;var _0x43cdc8=_0x3f88[_0x499ea6];return _0x43cdc8;};'use strict';var _=require(_0x83f8('0x0'));var util=require('util');var logger=require(_0x83f8('0x1'))(_0x83f8('0x2'));var moment=require('moment');var BPromise=require(_0x83f8('0x3'));var rp=require(_0x83f8('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x83f8('0x5'));var config=require(_0x83f8('0x6'));var attributes=require(_0x83f8('0x7'));module[_0x83f8('0x8')]=function(_0x2304d4,_0x28a5fe){return _0x2304d4[_0x83f8('0x9')](_0x83f8('0xa'),attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':[_0x83f8('0xb'),_0x83f8('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0430=['path','rimraf','./intDynamics365Field.attributes','exports','define','Dynamics365Field','int_dynamics365_fields','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x290f21,_0x5dbf3d){var _0x24614b=function(_0x5bfbac){while(--_0x5bfbac){_0x290f21['push'](_0x290f21['shift']());}};_0x24614b(++_0x5dbf3d);}(_0x0430,0x1d9));var _0x0043=function(_0x4318ce,_0x5af3d6){_0x4318ce=_0x4318ce-0x0;var _0x267b3c=_0x0430[_0x4318ce];return _0x267b3c;};'use strict';var _=require(_0x0043('0x0'));var util=require(_0x0043('0x1'));var logger=require(_0x0043('0x2'))(_0x0043('0x3'));var moment=require(_0x0043('0x4'));var BPromise=require(_0x0043('0x5'));var rp=require(_0x0043('0x6'));var fs=require('fs');var path=require(_0x0043('0x7'));var rimraf=require(_0x0043('0x8'));var config=require('../../config/environment');var attributes=require(_0x0043('0x9'));module[_0x0043('0xa')]=function(_0x2b3ecf,_0x4dfaed){return _0x2b3ecf[_0x0043('0xb')](_0x0043('0xc'),attributes,{'tableName':_0x0043('0xd'),'paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':['idField',_0x0043('0xe')],'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 6f9daa6..0634c5a 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 _0xd4d9=['Dynamics365Field,\x20%s,\x20%s','debug','request\x20sent','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x4aad6c,_0x52dd30){var _0x304519=function(_0x2468ea){while(--_0x2468ea){_0x4aad6c['push'](_0x4aad6c['shift']());}};_0x304519(++_0x52dd30);}(_0xd4d9,0x1a6));var _0x9d4d=function(_0x42a13c,_0xd252c1){_0x42a13c=_0x42a13c-0x0;var _0x3e6ca8=_0xd4d9[_0x42a13c];return _0x3e6ca8;};'use strict';var _=require(_0x9d4d('0x0'));var util=require(_0x9d4d('0x1'));var moment=require(_0x9d4d('0x2'));var BPromise=require(_0x9d4d('0x3'));var rs=require(_0x9d4d('0x4'));var fs=require('fs');var Redis=require(_0x9d4d('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x9d4d('0x6'));var logger=require(_0x9d4d('0x7'))(_0x9d4d('0x8'));var config=require(_0x9d4d('0x9'));var jayson=require(_0x9d4d('0xa'));var client=jayson[_0x9d4d('0xb')][_0x9d4d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x405bd9,_0x54a638,_0x4ea11d){return new BPromise(function(_0x27b816,_0x26c239){return client[_0x9d4d('0xd')](_0x405bd9,_0x4ea11d)[_0x9d4d('0xe')](function(_0x2a3f27){logger['info'](_0x9d4d('0xf'),_0x54a638,'request\x20sent');logger[_0x9d4d('0x10')]('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0x54a638,_0x9d4d('0x11'),JSON['stringify'](_0x2a3f27));if(_0x2a3f27[_0x9d4d('0x12')]){if(_0x2a3f27[_0x9d4d('0x12')][_0x9d4d('0x13')]===0x1f4){logger[_0x9d4d('0x12')]('Dynamics365Field,\x20%s,\x20%s',_0x54a638,_0x2a3f27['error']['message']);return _0x26c239(_0x2a3f27[_0x9d4d('0x12')]['message']);}logger[_0x9d4d('0x12')](_0x9d4d('0xf'),_0x54a638,_0x2a3f27[_0x9d4d('0x12')][_0x9d4d('0x14')]);return _0x27b816(_0x2a3f27[_0x9d4d('0x12')][_0x9d4d('0x14')]);}else{logger[_0x9d4d('0x15')](_0x9d4d('0xf'),_0x54a638,'request\x20sent');_0x27b816(_0x2a3f27['result'][_0x9d4d('0x14')]);}})[_0x9d4d('0x16')](function(_0x4953b8){logger[_0x9d4d('0x12')](_0x9d4d('0xf'),_0x54a638,_0x4953b8);_0x26c239(_0x4953b8);});});} \ No newline at end of file +var _0x3050=['jayson/promise','client','request','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x4e2ac6,_0x5770c5){var _0x26886f=function(_0x8184ba){while(--_0x8184ba){_0x4e2ac6['push'](_0x4e2ac6['shift']());}};_0x26886f(++_0x5770c5);}(_0x3050,0x149));var _0x0305=function(_0x2d8545,_0x4f542f){_0x2d8545=_0x2d8545-0x0;var _0x5f3cf4=_0x3050[_0x2d8545];return _0x5f3cf4;};'use strict';var _=require(_0x0305('0x0'));var util=require(_0x0305('0x1'));var moment=require('moment');var BPromise=require(_0x0305('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0305('0x3'));var db=require(_0x0305('0x4'))['db'];var utils=require(_0x0305('0x5'));var logger=require(_0x0305('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0305('0x7'));var client=jayson[_0x0305('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5431f5,_0x3bb425,_0xb9d2da){return new BPromise(function(_0x514de2,_0x2ff29d){return client[_0x0305('0x9')](_0x5431f5,_0xb9d2da)[_0x0305('0xa')](function(_0x149034){logger[_0x0305('0xb')](_0x0305('0xc'),_0x3bb425,_0x0305('0xd'));logger[_0x0305('0xe')](_0x0305('0xf'),_0x3bb425,_0x0305('0xd'),JSON[_0x0305('0x10')](_0x149034));if(_0x149034[_0x0305('0x11')]){if(_0x149034[_0x0305('0x11')][_0x0305('0x12')]===0x1f4){logger[_0x0305('0x11')](_0x0305('0xc'),_0x3bb425,_0x149034['error'][_0x0305('0x13')]);return _0x2ff29d(_0x149034['error']['message']);}logger['error'](_0x0305('0xc'),_0x3bb425,_0x149034[_0x0305('0x11')][_0x0305('0x13')]);return _0x514de2(_0x149034['error'][_0x0305('0x13')]);}else{logger[_0x0305('0xb')](_0x0305('0xc'),_0x3bb425,'request\x20sent');_0x514de2(_0x149034['result'][_0x0305('0x13')]);}})[_0x0305('0x14')](function(_0x4eef29){logger[_0x0305('0x11')](_0x0305('0xc'),_0x3bb425,_0x4eef29);_0x2ff29d(_0x4eef29);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index f7e4fe8..7331ea2 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 _0x2bab=['./intFreshdeskAccount.controller','isAuthenticated','index','/:id','show','getConfigurations','get','/:id/fields','post','create','put','update','destroy','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3d22e5,_0x4a72a6){var _0x2a6aa2=function(_0x16a3bd){while(--_0x16a3bd){_0x3d22e5['push'](_0x3d22e5['shift']());}};_0x2a6aa2(++_0x4a72a6);}(_0x2bab,0x189));var _0xb2ba=function(_0x365f08,_0x542bb8){_0x365f08=_0x365f08-0x0;var _0x516494=_0x2bab[_0x365f08];return _0x516494;};'use strict';var multer=require(_0xb2ba('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xb2ba('0x1'));var express=require(_0xb2ba('0x2'));var router=express['Router']();var fs_extra=require(_0xb2ba('0x3'));var auth=require(_0xb2ba('0x4'));var interaction=require(_0xb2ba('0x5'));var config=require(_0xb2ba('0x6'));var controller=require(_0xb2ba('0x7'));router['get']('/',auth[_0xb2ba('0x8')](),controller[_0xb2ba('0x9')]);router['get'](_0xb2ba('0xa'),auth[_0xb2ba('0x8')](),controller[_0xb2ba('0xb')]);router['get']('/:id/configurations',auth['isAuthenticated'](),controller[_0xb2ba('0xc')]);router[_0xb2ba('0xd')](_0xb2ba('0xe'),auth[_0xb2ba('0x8')](),controller['getFields']);router[_0xb2ba('0xf')]('/',auth[_0xb2ba('0x8')](),controller[_0xb2ba('0x10')]);router[_0xb2ba('0xf')]('/:id/configurations',auth[_0xb2ba('0x8')](),controller['addConfiguration']);router[_0xb2ba('0x11')](_0xb2ba('0xa'),auth['isAuthenticated'](),controller[_0xb2ba('0x12')]);router['delete'](_0xb2ba('0xa'),auth[_0xb2ba('0x8')](),controller[_0xb2ba('0x13')]);module['exports']=router; \ No newline at end of file +var _0xc2d9=['./intFreshdeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','post','create','addConfiguration','put','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc2d9,0x1dd));var _0x9c2d=function(_0xc066e3,_0xdbc21c){_0xc066e3=_0xc066e3-0x0;var _0x364318=_0xc2d9[_0xc066e3];return _0x364318;};'use strict';var multer=require(_0x9c2d('0x0'));var util=require(_0x9c2d('0x1'));var path=require('path');var timeout=require(_0x9c2d('0x2'));var express=require(_0x9c2d('0x3'));var router=express[_0x9c2d('0x4')]();var fs_extra=require(_0x9c2d('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9c2d('0x6'));var controller=require(_0x9c2d('0x7'));router[_0x9c2d('0x8')]('/',auth[_0x9c2d('0x9')](),controller[_0x9c2d('0xa')]);router[_0x9c2d('0x8')](_0x9c2d('0xb'),auth['isAuthenticated'](),controller[_0x9c2d('0xc')]);router[_0x9c2d('0x8')](_0x9c2d('0xd'),auth['isAuthenticated'](),controller[_0x9c2d('0xe')]);router['get']('/:id/fields',auth[_0x9c2d('0x9')](),controller['getFields']);router[_0x9c2d('0xf')]('/',auth['isAuthenticated'](),controller[_0x9c2d('0x10')]);router[_0x9c2d('0xf')](_0x9c2d('0xd'),auth['isAuthenticated'](),controller[_0x9c2d('0x11')]);router[_0x9c2d('0x12')](_0x9c2d('0xb'),auth['isAuthenticated'](),controller[_0x9c2d('0x13')]);router[_0x9c2d('0x14')](_0x9c2d('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x9c2d('0x15')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 186753c..09a2942 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 _0xb10b=['remoteUri','sequelize','STRING'];(function(_0x44e577,_0x16a38d){var _0x2ff124=function(_0x266893){while(--_0x266893){_0x44e577['push'](_0x44e577['shift']());}};_0x2ff124(++_0x16a38d);}(_0xb10b,0x12a));var _0xbb10=function(_0x3cad1a,_0x4a92c5){_0x3cad1a=_0x3cad1a-0x0;var _0x4b768d=_0xb10b[_0x3cad1a];return _0x4b768d;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'name':{'type':Sequelize[_0xbb10('0x1')]},'description':{'type':Sequelize[_0xbb10('0x1')]},'username':{'type':Sequelize[_0xbb10('0x1')],'unique':'username'},'apiKey':{'type':Sequelize[_0xbb10('0x1')]},'remoteUri':{'type':Sequelize[_0xbb10('0x1')],'unique':_0xbb10('0x2')},'serverUrl':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x4888=['exports','STRING','username'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x4888,0x198));var _0x8488=function(_0x16da8f,_0x4ddb80){_0x16da8f=_0x16da8f-0x0;var _0xd5dca8=_0x4888[_0x16da8f];return _0xd5dca8;};'use strict';var Sequelize=require('sequelize');module[_0x8488('0x0')]={'name':{'type':Sequelize[_0x8488('0x1')]},'description':{'type':Sequelize[_0x8488('0x1')]},'username':{'type':Sequelize[_0x8488('0x1')],'unique':_0x8488('0x2')},'apiKey':{'type':Sequelize[_0x8488('0x1')]},'remoteUri':{'type':Sequelize[_0x8488('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x8488('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 6ba9b6b..1d7f743 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 _0xb43b=['Content-Range','json','save','then','end','sendStatus','stack','name','send','index','map','FreshdeskAccount','rawAttributes','fieldName','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','filters','pick','filter','type','VIRTUAL','merge','options','include','findAll','rows','show','params','catch','create','body','update','find','destroy','getConfigurations','findOne','order','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','FreshdeskConfiguration','FreshdeskField','getFields','remoteUri','apiKey','slice','substring','GET','format','%s/%s','api/v2/ticket_fields','%s:X','base64','requester','subject','agent','description','priority','group','ticket_type','company','remove','custom_text','custom_dropdown','label','default','choices','capitalize','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','offset','undefined','count','set'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb43b,0x1b2));var _0xbb43=function(_0x31250b,_0x44b7a3){_0x31250b=_0x31250b-0x0;var _0x4ac9c8=_0xb43b[_0x31250b];return _0x4ac9c8;};'use strict';var emlformat=require(_0xbb43('0x0'));var rimraf=require(_0xbb43('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbb43('0x2'));var rp=require(_0xbb43('0x3'));var moment=require(_0xbb43('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xbb43('0x5'));var util=require(_0xbb43('0x6'));var path=require(_0xbb43('0x7'));var sox=require(_0xbb43('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbb43('0x9'));var _=require('lodash');var squel=require(_0xbb43('0xa'));var crypto=require(_0xbb43('0xb'));var jsforce=require(_0xbb43('0xc'));var deskjs=require(_0xbb43('0xd'));var toCsv=require(_0xbb43('0xe'));var querystring=require('querystring');var Papa=require(_0xbb43('0xf'));var Redis=require(_0xbb43('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xbb43('0x11'));var as=require(_0xbb43('0x12'));var hardwareService=require(_0xbb43('0x13'));var logger=require(_0xbb43('0x14'))(_0xbb43('0x15'));var utils=require(_0xbb43('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xbb43('0x17'));var db=require(_0xbb43('0x18'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x578392,_0x41e7e5){_0x41e7e5=_0x41e7e5||0xcc;return function(_0x4a3714){if(_0x4a3714){return _0x578392['sendStatus'](_0x41e7e5);}return _0x578392[_0xbb43('0x19')](_0x41e7e5)['end']();};}function respondWithResult(_0x68d45d,_0x43021d){_0x43021d=_0x43021d||0xc8;return function(_0x55926f){if(_0x55926f){return _0x68d45d['status'](_0x43021d)['json'](_0x55926f);}};}function respondWithFilteredResult(_0x338120,_0x2abce0){return function(_0x57bd1d){if(_0x57bd1d){var _0x526330=typeof _0x2abce0[_0xbb43('0x1a')]==='undefined'&&typeof _0x2abce0['limit']===_0xbb43('0x1b');var _0x8242ab=_0x57bd1d[_0xbb43('0x1c')];var _0x55dd73=_0x526330?0x0:_0x2abce0[_0xbb43('0x1a')];var _0x4f28b8=_0x526330?_0x57bd1d[_0xbb43('0x1c')]:_0x2abce0[_0xbb43('0x1a')]+_0x2abce0['limit'];var _0x5d765b;if(_0x4f28b8>=_0x8242ab){_0x4f28b8=_0x8242ab;_0x5d765b=0xc8;}else{_0x5d765b=0xce;}_0x338120[_0xbb43('0x19')](_0x5d765b);return _0x338120[_0xbb43('0x1d')](_0xbb43('0x1e'),_0x55dd73+'-'+_0x4f28b8+'/'+_0x8242ab)[_0xbb43('0x1f')](_0x57bd1d);}return null;};}function patchUpdates(_0x5bcce7){return function(_0x40a650){try{jsonpatch['apply'](_0x40a650,_0x5bcce7,!![]);}catch(_0x3a257d){return BPromise['reject'](_0x3a257d);}return _0x40a650[_0xbb43('0x20')]();};}function saveUpdates(_0x565256,_0x3f323e){return function(_0x451cbd){if(_0x451cbd){return _0x451cbd['update'](_0x565256)[_0xbb43('0x21')](function(_0x4dfb7f){return _0x4dfb7f;});}return null;};}function removeEntity(_0xf24e60,_0x298ce2){return function(_0x16384e){if(_0x16384e){return _0x16384e['destroy']()['then'](function(){_0xf24e60['status'](0xcc)[_0xbb43('0x22')]();});}};}function handleEntityNotFound(_0x32d7f0,_0x5d8310){return function(_0x3b3083){if(!_0x3b3083){_0x32d7f0[_0xbb43('0x23')](0x194);}return _0x3b3083;};}function handleError(_0x226827,_0x3874fb){_0x3874fb=_0x3874fb||0x1f4;return function(_0x4ed43f){logger['error'](_0x4ed43f[_0xbb43('0x24')]);if(_0x4ed43f[_0xbb43('0x25')]){delete _0x4ed43f[_0xbb43('0x25')];}_0x226827[_0xbb43('0x19')](_0x3874fb)[_0xbb43('0x26')](_0x4ed43f);};}exports[_0xbb43('0x27')]=function(_0x21d386,_0x473828){var _0x539730={},_0x2ad6da={},_0x56fe33={'count':0x0,'rows':[]};var _0x31fbc8=_[_0xbb43('0x28')](db[_0xbb43('0x29')][_0xbb43('0x2a')],function(_0x555b99){return{'name':_0x555b99[_0xbb43('0x2b')],'type':_0x555b99['type']['key']};});_0x2ad6da['model']=_[_0xbb43('0x28')](_0x31fbc8,'name');_0x2ad6da[_0xbb43('0x2c')]=_[_0xbb43('0x2d')](_0x21d386[_0xbb43('0x2c')]);_0x2ad6da['filters']=_[_0xbb43('0x2e')](_0x2ad6da[_0xbb43('0x2f')],_0x2ad6da[_0xbb43('0x2c')]);_0x539730[_0xbb43('0x30')]=_[_0xbb43('0x2e')](_0x2ad6da[_0xbb43('0x2f')],qs[_0xbb43('0x31')](_0x21d386[_0xbb43('0x2c')]['fields']));_0x539730[_0xbb43('0x30')]=_0x539730[_0xbb43('0x30')][_0xbb43('0x32')]?_0x539730[_0xbb43('0x30')]:_0x2ad6da[_0xbb43('0x2f')];if(!_0x21d386[_0xbb43('0x2c')][_0xbb43('0x33')](_0xbb43('0x34'))){_0x539730[_0xbb43('0x35')]=qs[_0xbb43('0x35')](_0x21d386[_0xbb43('0x2c')][_0xbb43('0x35')]);_0x539730[_0xbb43('0x1a')]=qs[_0xbb43('0x1a')](_0x21d386[_0xbb43('0x2c')][_0xbb43('0x1a')]);}_0x539730['order']=qs[_0xbb43('0x36')](_0x21d386[_0xbb43('0x2c')]['sort']);_0x539730[_0xbb43('0x37')]=qs[_0xbb43('0x38')](_[_0xbb43('0x39')](_0x21d386['query'],_0x2ad6da['filters']),_0x31fbc8);if(_0x21d386['query'][_0xbb43('0x3a')]){_0x539730[_0xbb43('0x37')]=_['merge'](_0x539730['where'],{'$or':_[_0xbb43('0x28')](_0x31fbc8,function(_0x275425){if(_0x275425[_0xbb43('0x3b')]!==_0xbb43('0x3c')){var _0x3f9e7f={};_0x3f9e7f[_0x275425['name']]={'$like':'%'+_0x21d386[_0xbb43('0x2c')][_0xbb43('0x3a')]+'%'};return _0x3f9e7f;}})});}_0x539730=_[_0xbb43('0x3d')]({},_0x539730,_0x21d386[_0xbb43('0x3e')]);var _0x22fccc={'where':_0x539730['where']};return db[_0xbb43('0x29')]['count'](_0x22fccc)[_0xbb43('0x21')](function(_0x93aa1c){_0x56fe33['count']=_0x93aa1c;if(_0x21d386[_0xbb43('0x2c')]['includeAll']){_0x539730[_0xbb43('0x3f')]=[{'all':!![]}];}return db[_0xbb43('0x29')][_0xbb43('0x40')](_0x539730);})[_0xbb43('0x21')](function(_0x5d864a){_0x56fe33[_0xbb43('0x41')]=_0x5d864a;return _0x56fe33;})[_0xbb43('0x21')](respondWithFilteredResult(_0x473828,_0x539730))['catch'](handleError(_0x473828,null));};exports[_0xbb43('0x42')]=function(_0x5198a2,_0x42b965){var _0x14285d={'raw':![],'where':{'id':_0x5198a2[_0xbb43('0x43')]['id']}},_0xcb5000={};_0xcb5000[_0xbb43('0x2f')]=_[_0xbb43('0x2d')](db['FreshdeskAccount'][_0xbb43('0x2a')]);_0xcb5000['query']=_[_0xbb43('0x2d')](_0x5198a2[_0xbb43('0x2c')]);_0xcb5000[_0xbb43('0x38')]=_[_0xbb43('0x2e')](_0xcb5000['model'],_0xcb5000[_0xbb43('0x2c')]);_0x14285d[_0xbb43('0x30')]=_[_0xbb43('0x2e')](_0xcb5000[_0xbb43('0x2f')],qs[_0xbb43('0x31')](_0x5198a2[_0xbb43('0x2c')][_0xbb43('0x31')]));_0x14285d[_0xbb43('0x30')]=_0x14285d['attributes'][_0xbb43('0x32')]?_0x14285d[_0xbb43('0x30')]:_0xcb5000['model'];if(_0x5198a2[_0xbb43('0x2c')]['includeAll']){_0x14285d['include']=[{'all':!![]}];}_0x14285d=_['merge']({},_0x14285d,_0x5198a2['options']);return db[_0xbb43('0x29')]['find'](_0x14285d)[_0xbb43('0x21')](handleEntityNotFound(_0x42b965,null))['then'](respondWithResult(_0x42b965,null))[_0xbb43('0x44')](handleError(_0x42b965,null));};exports[_0xbb43('0x45')]=function(_0x1f3fb4,_0x4a0755){return db[_0xbb43('0x29')]['create'](_0x1f3fb4[_0xbb43('0x46')],{})[_0xbb43('0x21')](respondWithResult(_0x4a0755,0xc9))[_0xbb43('0x44')](handleError(_0x4a0755,null));};exports[_0xbb43('0x47')]=function(_0x417ad9,_0x13d0a5){if(_0x417ad9[_0xbb43('0x46')]['id']){delete _0x417ad9['body']['id'];}return db[_0xbb43('0x29')][_0xbb43('0x48')]({'where':{'id':_0x417ad9[_0xbb43('0x43')]['id']}})[_0xbb43('0x21')](handleEntityNotFound(_0x13d0a5,null))['then'](saveUpdates(_0x417ad9[_0xbb43('0x46')],null))[_0xbb43('0x21')](respondWithResult(_0x13d0a5,null))[_0xbb43('0x44')](handleError(_0x13d0a5,null));};exports[_0xbb43('0x49')]=function(_0x4b7712,_0x3206c0){return db[_0xbb43('0x29')][_0xbb43('0x48')]({'where':{'id':_0x4b7712['params']['id']}})[_0xbb43('0x21')](handleEntityNotFound(_0x3206c0,null))[_0xbb43('0x21')](removeEntity(_0x3206c0,null))[_0xbb43('0x44')](handleError(_0x3206c0,null));};exports[_0xbb43('0x4a')]=function(_0x3402f2,_0x59c805,_0x4cd4cd){var _0xb44557={};var _0x5c75ba={};var _0xf5d5c;var _0xe0cdba;return db['FreshdeskAccount'][_0xbb43('0x4b')]({'where':{'id':_0x3402f2[_0xbb43('0x43')]['id']}})[_0xbb43('0x21')](handleEntityNotFound(_0x59c805,null))[_0xbb43('0x21')](function(_0x1dfbb9){if(_0x1dfbb9){_0xf5d5c=_0x1dfbb9;_0x5c75ba['model']=_[_0xbb43('0x2d')](db['FreshdeskConfiguration']['rawAttributes']);_0x5c75ba[_0xbb43('0x2c')]=_[_0xbb43('0x2d')](_0x3402f2[_0xbb43('0x2c')]);_0x5c75ba[_0xbb43('0x38')]=_[_0xbb43('0x2e')](_0x5c75ba['model'],_0x5c75ba['query']);_0xb44557[_0xbb43('0x30')]=_[_0xbb43('0x2e')](_0x5c75ba[_0xbb43('0x2f')],qs[_0xbb43('0x31')](_0x3402f2[_0xbb43('0x2c')][_0xbb43('0x31')]));_0xb44557[_0xbb43('0x30')]=_0xb44557[_0xbb43('0x30')][_0xbb43('0x32')]?_0xb44557['attributes']:_0x5c75ba[_0xbb43('0x2f')];_0xb44557[_0xbb43('0x4c')]=qs[_0xbb43('0x36')](_0x3402f2[_0xbb43('0x2c')][_0xbb43('0x36')]);_0xb44557[_0xbb43('0x37')]=qs[_0xbb43('0x38')](_[_0xbb43('0x39')](_0x3402f2[_0xbb43('0x2c')],_0x5c75ba['filters']));if(_0x3402f2['query'][_0xbb43('0x3a')]){_0xb44557[_0xbb43('0x37')]=_[_0xbb43('0x3d')](_0xb44557[_0xbb43('0x37')],{'$or':_[_0xbb43('0x28')](_0xb44557[_0xbb43('0x30')],function(_0x2e01fb){var _0x51d702={};_0x51d702[_0x2e01fb]={'$like':'%'+_0x3402f2[_0xbb43('0x2c')]['filter']+'%'};return _0x51d702;})});}_0xb44557=_['merge']({},_0xb44557,_0x3402f2[_0xbb43('0x3e')]);return _0xf5d5c[_0xbb43('0x4a')](_0xb44557);}})[_0xbb43('0x21')](function(_0x22ce17){if(_0x22ce17){_0xe0cdba=_0x22ce17[_0xbb43('0x32')];if(!_0x3402f2[_0xbb43('0x2c')][_0xbb43('0x33')](_0xbb43('0x34'))){_0xb44557['limit']=qs['limit'](_0x3402f2[_0xbb43('0x2c')][_0xbb43('0x35')]);_0xb44557[_0xbb43('0x1a')]=qs[_0xbb43('0x1a')](_0x3402f2[_0xbb43('0x2c')][_0xbb43('0x1a')]);}return _0xf5d5c[_0xbb43('0x4a')](_0xb44557);}})[_0xbb43('0x21')](function(_0x3ca6ad){if(_0x3ca6ad){return _0x3ca6ad?{'count':_0xe0cdba,'rows':_0x3ca6ad}:null;}})['then'](respondWithResult(_0x59c805,null))[_0xbb43('0x44')](handleError(_0x59c805,null));};exports[_0xbb43('0x4d')]=function(_0x234bc7,_0x8aaf33,_0x2612be){if(_0x234bc7[_0xbb43('0x46')]['id']){delete _0x234bc7['body']['id'];}return db[_0xbb43('0x29')][_0xbb43('0x4b')]({'where':{'id':_0x234bc7[_0xbb43('0x43')]['id']}})[_0xbb43('0x21')](handleEntityNotFound(_0x8aaf33,null))[_0xbb43('0x21')](function(_0x4ec63a){if(_0x4ec63a){_0x234bc7[_0xbb43('0x46')][_0xbb43('0x4e')]=_0x4ec63a['id'];_0x234bc7[_0xbb43('0x46')][_0xbb43('0x4f')]=integrations[_0xbb43('0x50')](_0x234bc7[_0xbb43('0x46')][_0xbb43('0x51')],_0x234bc7[_0xbb43('0x46')][_0xbb43('0x3b')]);_0x234bc7[_0xbb43('0x46')]['Descriptions']=integrations[_0xbb43('0x52')](_0x234bc7['body'][_0xbb43('0x51')],_0x234bc7[_0xbb43('0x46')][_0xbb43('0x3b')]);return db[_0xbb43('0x53')][_0xbb43('0x45')](_0x234bc7['body'],{'include':[{'model':db['FreshdeskField'],'as':_0xbb43('0x4f')},{'model':db[_0xbb43('0x54')],'as':'Descriptions'}]});}return null;})[_0xbb43('0x21')](respondWithResult(_0x8aaf33,null))[_0xbb43('0x44')](handleError(_0x8aaf33,null));};exports[_0xbb43('0x55')]=function(_0x52ca51,_0x333ded,_0x298a77){var _0x3b89ec='';return db[_0xbb43('0x29')][_0xbb43('0x4b')]({'where':{'id':_0x52ca51[_0xbb43('0x43')]['id']},'attributes':['id',_0xbb43('0x56'),_0xbb43('0x57')]})[_0xbb43('0x21')](handleEntityNotFound(_0x333ded,null))[_0xbb43('0x21')](function(_0x566268){if(_0x566268){_0x3b89ec=_0x566268['remoteUri'];var _0x21d610=_0x3b89ec[_0xbb43('0x58')](-0x1);if(_0x21d610==='/'){_0x3b89ec=_0x3b89ec[_0xbb43('0x59')](0x0,_0x3b89ec['lastIndexOf'](_0x21d610));}return rp({'method':_0xbb43('0x5a'),'uri':util[_0xbb43('0x5b')](_0xbb43('0x5c'),_0x3b89ec,_0xbb43('0x5d')),'headers':{'Authorization':util[_0xbb43('0x5b')]('Basic\x20%s',new Buffer(util[_0xbb43('0x5b')](_0xbb43('0x5e'),_0x566268[_0xbb43('0x57')]))['toString'](_0xbb43('0x5f')))},'json':!![]});}})[_0xbb43('0x21')](function(_0x3e4619){if(_0x3e4619){var _0x38f301=[_0xbb43('0x60'),_0xbb43('0x61'),_0xbb43('0x62'),_0xbb43('0x63'),_0xbb43('0x19'),_0xbb43('0x64'),_0xbb43('0x65'),'source',_0xbb43('0x66'),_0xbb43('0x65'),_0xbb43('0x67')];_[_0xbb43('0x68')](_0x3e4619,function(_0x34c1cd){return _0x38f301['includes'](_0x34c1cd['name'])||!_0x34c1cd['default']&&_0x34c1cd[_0xbb43('0x3b')]!==_0xbb43('0x69')&&_0x34c1cd[_0xbb43('0x3b')]!==_0xbb43('0x6a');});return{'count':_0x3e4619[_0xbb43('0x32')],'rows':_[_0xbb43('0x28')](_0x3e4619,function(_0x53cd0b){return{'id':_0x53cd0b['name'],'name':_0x53cd0b[_0xbb43('0x6b')],'custom':!_0x53cd0b[_0xbb43('0x6c')],'options':_0x53cd0b[_0xbb43('0x6d')]?_['map'](_0x53cd0b[_0xbb43('0x6d')],function(_0x5e43b4){return{'name':_[_0xbb43('0x6e')](_0x5e43b4),'value':_0x5e43b4};}):[]};})};}})['then'](respondWithResult(_0x333ded,null))[_0xbb43('0x44')](function(_0x17e939){var _0x41b9cd=_0x52ca51[_0xbb43('0x2c')][_0xbb43('0x6f')]?0x1f4:_0x17e939[_0xbb43('0x70')]||0x1f4;logger[_0xbb43('0x71')](_0xbb43('0x72'),'getFields',_0x41b9cd,JSON[_0xbb43('0x73')](_0x17e939));delete _0x17e939[_0xbb43('0x25')];if(_0x41b9cd===0x191){_0x41b9cd=0x190;}_0x333ded['status'](_0x41b9cd)[_0xbb43('0x26')](_0x52ca51[_0xbb43('0x2c')][_0xbb43('0x6f')]?{'message':'Wrong\x20credentials','statusCode':_0x17e939[_0xbb43('0x70')]}:_0x17e939);});}; \ No newline at end of file +var _0x1c8a=['rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','offset','limit','count','set','json','apply','reject','save','update','then','destroy','stack','name','index','FreshdeskAccount','rawAttributes','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','includeAll','include','catch','show','find','create','body','params','getConfigurations','findOne','FreshdeskConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshdeskField','getFields','apiKey','substring','lastIndexOf','GET','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','toString','base64','requester','subject','agent','description','group','source','default','custom_dropdown','label','choices','map','capitalize','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','send','eml-format'];(function(_0x393d69,_0x3a8c83){var _0x3cee37=function(_0x462682){while(--_0x462682){_0x393d69['push'](_0x393d69['shift']());}};_0x3cee37(++_0x3a8c83);}(_0x1c8a,0x140));var _0xa1c8=function(_0x3874b0,_0xca85bb){_0x3874b0=_0x3874b0-0x0;var _0x2f567e=_0x1c8a[_0x3874b0];return _0x2f567e;};'use strict';var emlformat=require(_0xa1c8('0x0'));var rimraf=require(_0xa1c8('0x1'));var zipdir=require(_0xa1c8('0x2'));var jsonpatch=require(_0xa1c8('0x3'));var rp=require(_0xa1c8('0x4'));var moment=require('moment');var BPromise=require(_0xa1c8('0x5'));var Mustache=require('mustache');var util=require(_0xa1c8('0x6'));var path=require(_0xa1c8('0x7'));var sox=require(_0xa1c8('0x8'));var csv=require('to-csv');var ejs=require(_0xa1c8('0x9'));var fs=require('fs');var fs_extra=require(_0xa1c8('0xa'));var _=require(_0xa1c8('0xb'));var squel=require('squel');var crypto=require(_0xa1c8('0xc'));var jsforce=require(_0xa1c8('0xd'));var deskjs=require(_0xa1c8('0xe'));var toCsv=require('to-csv');var querystring=require(_0xa1c8('0xf'));var Papa=require(_0xa1c8('0x10'));var Redis=require(_0xa1c8('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa1c8('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa1c8('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xa1c8('0x14'));var db=require(_0xa1c8('0x15'))['db'];var integrations=require(_0xa1c8('0x16'));function respondWithStatusCode(_0x707249,_0x644e9c){_0x644e9c=_0x644e9c||0xcc;return function(_0x4097bf){if(_0x4097bf){return _0x707249['sendStatus'](_0x644e9c);}return _0x707249[_0xa1c8('0x17')](_0x644e9c)[_0xa1c8('0x18')]();};}function respondWithResult(_0xcccc7b,_0x3797fe){_0x3797fe=_0x3797fe||0xc8;return function(_0xcb9223){if(_0xcb9223){return _0xcccc7b[_0xa1c8('0x17')](_0x3797fe)['json'](_0xcb9223);}};}function respondWithFilteredResult(_0x7f1128,_0x51b1c3){return function(_0x17d4d2){if(_0x17d4d2){var _0x2ef438=typeof _0x51b1c3[_0xa1c8('0x19')]==='undefined'&&typeof _0x51b1c3[_0xa1c8('0x1a')]==='undefined';var _0x55caa7=_0x17d4d2[_0xa1c8('0x1b')];var _0x112ab0=_0x2ef438?0x0:_0x51b1c3['offset'];var _0x3c66c3=_0x2ef438?_0x17d4d2[_0xa1c8('0x1b')]:_0x51b1c3[_0xa1c8('0x19')]+_0x51b1c3['limit'];var _0x35cd08;if(_0x3c66c3>=_0x55caa7){_0x3c66c3=_0x55caa7;_0x35cd08=0xc8;}else{_0x35cd08=0xce;}_0x7f1128[_0xa1c8('0x17')](_0x35cd08);return _0x7f1128[_0xa1c8('0x1c')]('Content-Range',_0x112ab0+'-'+_0x3c66c3+'/'+_0x55caa7)[_0xa1c8('0x1d')](_0x17d4d2);}return null;};}function patchUpdates(_0x874b1f){return function(_0x520ec1){try{jsonpatch[_0xa1c8('0x1e')](_0x520ec1,_0x874b1f,!![]);}catch(_0x34d526){return BPromise[_0xa1c8('0x1f')](_0x34d526);}return _0x520ec1[_0xa1c8('0x20')]();};}function saveUpdates(_0x19fe5a,_0x23ff11){return function(_0x198400){if(_0x198400){return _0x198400[_0xa1c8('0x21')](_0x19fe5a)[_0xa1c8('0x22')](function(_0x193077){return _0x193077;});}return null;};}function removeEntity(_0x28473c,_0x125047){return function(_0x2827ed){if(_0x2827ed){return _0x2827ed[_0xa1c8('0x23')]()[_0xa1c8('0x22')](function(){_0x28473c[_0xa1c8('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e9a50,_0x550b68){return function(_0x63eb4c){if(!_0x63eb4c){_0x1e9a50['sendStatus'](0x194);}return _0x63eb4c;};}function handleError(_0x404cb8,_0x508742){_0x508742=_0x508742||0x1f4;return function(_0x22eec1){logger['error'](_0x22eec1[_0xa1c8('0x24')]);if(_0x22eec1[_0xa1c8('0x25')]){delete _0x22eec1[_0xa1c8('0x25')];}_0x404cb8[_0xa1c8('0x17')](_0x508742)['send'](_0x22eec1);};}exports[_0xa1c8('0x26')]=function(_0x404fa1,_0x28b9e5){var _0x4d0a4f={},_0x5f43bc={},_0x1a44de={'count':0x0,'rows':[]};var _0x473a62=_['map'](db[_0xa1c8('0x27')][_0xa1c8('0x28')],function(_0xeadfdd){return{'name':_0xeadfdd['fieldName'],'type':_0xeadfdd['type']['key']};});_0x5f43bc[_0xa1c8('0x29')]=_['map'](_0x473a62,_0xa1c8('0x25'));_0x5f43bc[_0xa1c8('0x2a')]=_[_0xa1c8('0x2b')](_0x404fa1[_0xa1c8('0x2a')]);_0x5f43bc[_0xa1c8('0x2c')]=_[_0xa1c8('0x2d')](_0x5f43bc['model'],_0x5f43bc[_0xa1c8('0x2a')]);_0x4d0a4f[_0xa1c8('0x2e')]=_[_0xa1c8('0x2d')](_0x5f43bc[_0xa1c8('0x29')],qs['fields'](_0x404fa1['query'][_0xa1c8('0x2f')]));_0x4d0a4f['attributes']=_0x4d0a4f[_0xa1c8('0x2e')][_0xa1c8('0x30')]?_0x4d0a4f[_0xa1c8('0x2e')]:_0x5f43bc[_0xa1c8('0x29')];if(!_0x404fa1[_0xa1c8('0x2a')][_0xa1c8('0x31')](_0xa1c8('0x32'))){_0x4d0a4f[_0xa1c8('0x1a')]=qs['limit'](_0x404fa1[_0xa1c8('0x2a')][_0xa1c8('0x1a')]);_0x4d0a4f[_0xa1c8('0x19')]=qs[_0xa1c8('0x19')](_0x404fa1[_0xa1c8('0x2a')][_0xa1c8('0x19')]);}_0x4d0a4f[_0xa1c8('0x33')]=qs[_0xa1c8('0x34')](_0x404fa1[_0xa1c8('0x2a')][_0xa1c8('0x34')]);_0x4d0a4f[_0xa1c8('0x35')]=qs[_0xa1c8('0x2c')](_[_0xa1c8('0x36')](_0x404fa1[_0xa1c8('0x2a')],_0x5f43bc['filters']),_0x473a62);if(_0x404fa1['query'][_0xa1c8('0x37')]){_0x4d0a4f[_0xa1c8('0x35')]=_[_0xa1c8('0x38')](_0x4d0a4f['where'],{'$or':_['map'](_0x473a62,function(_0x4c0b92){if(_0x4c0b92[_0xa1c8('0x39')]!=='VIRTUAL'){var _0x580963={};_0x580963[_0x4c0b92[_0xa1c8('0x25')]]={'$like':'%'+_0x404fa1[_0xa1c8('0x2a')][_0xa1c8('0x37')]+'%'};return _0x580963;}})});}_0x4d0a4f=_['merge']({},_0x4d0a4f,_0x404fa1[_0xa1c8('0x3a')]);var _0x3fe148={'where':_0x4d0a4f['where']};return db[_0xa1c8('0x27')][_0xa1c8('0x1b')](_0x3fe148)[_0xa1c8('0x22')](function(_0x4bad1e){_0x1a44de[_0xa1c8('0x1b')]=_0x4bad1e;if(_0x404fa1[_0xa1c8('0x2a')][_0xa1c8('0x3b')]){_0x4d0a4f[_0xa1c8('0x3c')]=[{'all':!![]}];}return db[_0xa1c8('0x27')]['findAll'](_0x4d0a4f);})[_0xa1c8('0x22')](function(_0x57c24c){_0x1a44de['rows']=_0x57c24c;return _0x1a44de;})['then'](respondWithFilteredResult(_0x28b9e5,_0x4d0a4f))[_0xa1c8('0x3d')](handleError(_0x28b9e5,null));};exports[_0xa1c8('0x3e')]=function(_0x15e9fe,_0x26289d){var _0x3a5cd4={'raw':![],'where':{'id':_0x15e9fe['params']['id']}},_0x5a82ca={};_0x5a82ca[_0xa1c8('0x29')]=_[_0xa1c8('0x2b')](db[_0xa1c8('0x27')]['rawAttributes']);_0x5a82ca['query']=_[_0xa1c8('0x2b')](_0x15e9fe[_0xa1c8('0x2a')]);_0x5a82ca[_0xa1c8('0x2c')]=_[_0xa1c8('0x2d')](_0x5a82ca[_0xa1c8('0x29')],_0x5a82ca[_0xa1c8('0x2a')]);_0x3a5cd4[_0xa1c8('0x2e')]=_['intersection'](_0x5a82ca[_0xa1c8('0x29')],qs['fields'](_0x15e9fe[_0xa1c8('0x2a')][_0xa1c8('0x2f')]));_0x3a5cd4[_0xa1c8('0x2e')]=_0x3a5cd4['attributes'][_0xa1c8('0x30')]?_0x3a5cd4['attributes']:_0x5a82ca[_0xa1c8('0x29')];if(_0x15e9fe[_0xa1c8('0x2a')][_0xa1c8('0x3b')]){_0x3a5cd4['include']=[{'all':!![]}];}_0x3a5cd4=_[_0xa1c8('0x38')]({},_0x3a5cd4,_0x15e9fe[_0xa1c8('0x3a')]);return db['FreshdeskAccount'][_0xa1c8('0x3f')](_0x3a5cd4)[_0xa1c8('0x22')](handleEntityNotFound(_0x26289d,null))[_0xa1c8('0x22')](respondWithResult(_0x26289d,null))[_0xa1c8('0x3d')](handleError(_0x26289d,null));};exports[_0xa1c8('0x40')]=function(_0x43616f,_0x258d46){return db[_0xa1c8('0x27')][_0xa1c8('0x40')](_0x43616f['body'],{})[_0xa1c8('0x22')](respondWithResult(_0x258d46,0xc9))[_0xa1c8('0x3d')](handleError(_0x258d46,null));};exports[_0xa1c8('0x21')]=function(_0xf29fc,_0x4f0909){if(_0xf29fc[_0xa1c8('0x41')]['id']){delete _0xf29fc[_0xa1c8('0x41')]['id'];}return db[_0xa1c8('0x27')][_0xa1c8('0x3f')]({'where':{'id':_0xf29fc[_0xa1c8('0x42')]['id']}})['then'](handleEntityNotFound(_0x4f0909,null))[_0xa1c8('0x22')](saveUpdates(_0xf29fc[_0xa1c8('0x41')],null))[_0xa1c8('0x22')](respondWithResult(_0x4f0909,null))[_0xa1c8('0x3d')](handleError(_0x4f0909,null));};exports[_0xa1c8('0x23')]=function(_0x50a90f,_0x5bbef3){return db[_0xa1c8('0x27')][_0xa1c8('0x3f')]({'where':{'id':_0x50a90f[_0xa1c8('0x42')]['id']}})['then'](handleEntityNotFound(_0x5bbef3,null))[_0xa1c8('0x22')](removeEntity(_0x5bbef3,null))[_0xa1c8('0x3d')](handleError(_0x5bbef3,null));};exports[_0xa1c8('0x43')]=function(_0xda6bd9,_0x443b94,_0x2e083e){var _0x3fd9b7={};var _0x423429={};var _0x18dac8;var _0xf13fa3;return db[_0xa1c8('0x27')][_0xa1c8('0x44')]({'where':{'id':_0xda6bd9[_0xa1c8('0x42')]['id']}})['then'](handleEntityNotFound(_0x443b94,null))[_0xa1c8('0x22')](function(_0x1a117a){if(_0x1a117a){_0x18dac8=_0x1a117a;_0x423429[_0xa1c8('0x29')]=_[_0xa1c8('0x2b')](db[_0xa1c8('0x45')][_0xa1c8('0x28')]);_0x423429[_0xa1c8('0x2a')]=_[_0xa1c8('0x2b')](_0xda6bd9['query']);_0x423429[_0xa1c8('0x2c')]=_[_0xa1c8('0x2d')](_0x423429[_0xa1c8('0x29')],_0x423429[_0xa1c8('0x2a')]);_0x3fd9b7['attributes']=_['intersection'](_0x423429[_0xa1c8('0x29')],qs['fields'](_0xda6bd9[_0xa1c8('0x2a')][_0xa1c8('0x2f')]));_0x3fd9b7[_0xa1c8('0x2e')]=_0x3fd9b7[_0xa1c8('0x2e')][_0xa1c8('0x30')]?_0x3fd9b7[_0xa1c8('0x2e')]:_0x423429['model'];_0x3fd9b7[_0xa1c8('0x33')]=qs['sort'](_0xda6bd9[_0xa1c8('0x2a')]['sort']);_0x3fd9b7[_0xa1c8('0x35')]=qs[_0xa1c8('0x2c')](_[_0xa1c8('0x36')](_0xda6bd9[_0xa1c8('0x2a')],_0x423429['filters']));if(_0xda6bd9[_0xa1c8('0x2a')][_0xa1c8('0x37')]){_0x3fd9b7[_0xa1c8('0x35')]=_[_0xa1c8('0x38')](_0x3fd9b7[_0xa1c8('0x35')],{'$or':_['map'](_0x3fd9b7['attributes'],function(_0x30ed79){var _0x3d4873={};_0x3d4873[_0x30ed79]={'$like':'%'+_0xda6bd9['query'][_0xa1c8('0x37')]+'%'};return _0x3d4873;})});}_0x3fd9b7=_['merge']({},_0x3fd9b7,_0xda6bd9['options']);return _0x18dac8['getConfigurations'](_0x3fd9b7);}})[_0xa1c8('0x22')](function(_0x4df225){if(_0x4df225){_0xf13fa3=_0x4df225['length'];if(!_0xda6bd9[_0xa1c8('0x2a')]['hasOwnProperty'](_0xa1c8('0x32'))){_0x3fd9b7['limit']=qs['limit'](_0xda6bd9[_0xa1c8('0x2a')][_0xa1c8('0x1a')]);_0x3fd9b7[_0xa1c8('0x19')]=qs['offset'](_0xda6bd9[_0xa1c8('0x2a')][_0xa1c8('0x19')]);}return _0x18dac8[_0xa1c8('0x43')](_0x3fd9b7);}})['then'](function(_0x458579){if(_0x458579){return _0x458579?{'count':_0xf13fa3,'rows':_0x458579}:null;}})[_0xa1c8('0x22')](respondWithResult(_0x443b94,null))['catch'](handleError(_0x443b94,null));};exports[_0xa1c8('0x46')]=function(_0x380926,_0x670db6,_0x511b19){if(_0x380926[_0xa1c8('0x41')]['id']){delete _0x380926[_0xa1c8('0x41')]['id'];}return db['FreshdeskAccount'][_0xa1c8('0x44')]({'where':{'id':_0x380926['params']['id']}})[_0xa1c8('0x22')](handleEntityNotFound(_0x670db6,null))['then'](function(_0x125cfb){if(_0x125cfb){_0x380926[_0xa1c8('0x41')][_0xa1c8('0x47')]=_0x125cfb['id'];_0x380926[_0xa1c8('0x41')][_0xa1c8('0x48')]=integrations[_0xa1c8('0x49')](_0x380926[_0xa1c8('0x41')][_0xa1c8('0x4a')],_0x380926['body'][_0xa1c8('0x39')]);_0x380926[_0xa1c8('0x41')][_0xa1c8('0x4b')]=integrations[_0xa1c8('0x4c')](_0x380926[_0xa1c8('0x41')][_0xa1c8('0x4a')],_0x380926[_0xa1c8('0x41')][_0xa1c8('0x39')]);return db[_0xa1c8('0x45')][_0xa1c8('0x40')](_0x380926[_0xa1c8('0x41')],{'include':[{'model':db[_0xa1c8('0x4d')],'as':_0xa1c8('0x48')},{'model':db[_0xa1c8('0x4d')],'as':_0xa1c8('0x4b')}]});}return null;})[_0xa1c8('0x22')](respondWithResult(_0x670db6,null))[_0xa1c8('0x3d')](handleError(_0x670db6,null));};exports[_0xa1c8('0x4e')]=function(_0x376f19,_0x3eda58,_0x71af88){var _0xc75ecd='';return db[_0xa1c8('0x27')][_0xa1c8('0x44')]({'where':{'id':_0x376f19[_0xa1c8('0x42')]['id']},'attributes':['id','remoteUri',_0xa1c8('0x4f')]})[_0xa1c8('0x22')](handleEntityNotFound(_0x3eda58,null))[_0xa1c8('0x22')](function(_0x42feab){if(_0x42feab){_0xc75ecd=_0x42feab['remoteUri'];var _0x3d3e13=_0xc75ecd['slice'](-0x1);if(_0x3d3e13==='/'){_0xc75ecd=_0xc75ecd[_0xa1c8('0x50')](0x0,_0xc75ecd[_0xa1c8('0x51')](_0x3d3e13));}return rp({'method':_0xa1c8('0x52'),'uri':util[_0xa1c8('0x53')](_0xa1c8('0x54'),_0xc75ecd,_0xa1c8('0x55')),'headers':{'Authorization':util[_0xa1c8('0x53')](_0xa1c8('0x56'),new Buffer(util[_0xa1c8('0x53')](_0xa1c8('0x57'),_0x42feab['apiKey']))[_0xa1c8('0x58')](_0xa1c8('0x59')))},'json':!![]});}})[_0xa1c8('0x22')](function(_0x12ef5c){if(_0x12ef5c){var _0x142a14=[_0xa1c8('0x5a'),_0xa1c8('0x5b'),_0xa1c8('0x5c'),_0xa1c8('0x5d'),'status','priority',_0xa1c8('0x5e'),_0xa1c8('0x5f'),'ticket_type',_0xa1c8('0x5e'),'company'];_['remove'](_0x12ef5c,function(_0x25afae){return _0x142a14['includes'](_0x25afae[_0xa1c8('0x25')])||!_0x25afae[_0xa1c8('0x60')]&&_0x25afae['type']!=='custom_text'&&_0x25afae[_0xa1c8('0x39')]!==_0xa1c8('0x61');});return{'count':_0x12ef5c['length'],'rows':_['map'](_0x12ef5c,function(_0xeb16fc){return{'id':_0xeb16fc[_0xa1c8('0x25')],'name':_0xeb16fc[_0xa1c8('0x62')],'custom':!_0xeb16fc[_0xa1c8('0x60')],'options':_0xeb16fc[_0xa1c8('0x63')]?_[_0xa1c8('0x64')](_0xeb16fc[_0xa1c8('0x63')],function(_0x513962){return{'name':_[_0xa1c8('0x65')](_0x513962),'value':_0x513962};}):[]};})};}})[_0xa1c8('0x22')](respondWithResult(_0x3eda58,null))[_0xa1c8('0x3d')](function(_0x154d17){var _0x471f8e=_0x376f19[_0xa1c8('0x2a')][_0xa1c8('0x66')]?0x1f4:_0x154d17[_0xa1c8('0x67')]||0x1f4;logger[_0xa1c8('0x68')](_0xa1c8('0x69'),_0xa1c8('0x4e'),_0x471f8e,JSON['stringify'](_0x154d17));delete _0x154d17['name'];if(_0x471f8e===0x191){_0x471f8e=0x190;}_0x3eda58[_0xa1c8('0x17')](_0x471f8e)[_0xa1c8('0x6a')](_0x376f19[_0xa1c8('0x2a')][_0xa1c8('0x66')]?{'message':'Wrong\x20credentials','statusCode':_0x154d17[_0xa1c8('0x67')]}:_0x154d17);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 4ef724e..041af6e 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 _0x15dd=['exports','define','FreshdeskAccount','int_freshdesk_accounts','lodash','util','moment','bluebird','path','rimraf','./intFreshdeskAccount.attributes'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x15dd,0x72));var _0xd15d=function(_0x14f959,_0x47f64d){_0x14f959=_0x14f959-0x0;var _0x31de4c=_0x15dd[_0x14f959];return _0x31de4c;};'use strict';var _=require(_0xd15d('0x0'));var util=require(_0xd15d('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xd15d('0x2'));var BPromise=require(_0xd15d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd15d('0x4'));var rimraf=require(_0xd15d('0x5'));var config=require('../../config/environment');var attributes=require(_0xd15d('0x6'));var integrations=require('../../components/integrations/configuration');module[_0xd15d('0x7')]=function(_0x24f061,_0x507a87){return _0x24f061[_0xd15d('0x8')](_0xd15d('0x9'),attributes,{'tableName':_0xd15d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf3a5=['exports','FreshdeskAccount','int_freshdesk_accounts','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./intFreshdeskAccount.attributes'];(function(_0x4ec524,_0x15b5c0){var _0x3f72a0=function(_0x1e5410){while(--_0x1e5410){_0x4ec524['push'](_0x4ec524['shift']());}};_0x3f72a0(++_0x15b5c0);}(_0xf3a5,0xea));var _0x5f3a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf3a5[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x5f3a('0x0'));var logger=require(_0x5f3a('0x1'))(_0x5f3a('0x2'));var moment=require('moment');var BPromise=require(_0x5f3a('0x3'));var rp=require(_0x5f3a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5f3a('0x5'));var config=require(_0x5f3a('0x6'));var attributes=require(_0x5f3a('0x7'));var integrations=require('../../components/integrations/configuration');module[_0x5f3a('0x8')]=function(_0x2430f5,_0x12bc57){return _0x2430f5['define'](_0x5f3a('0x9'),attributes,{'tableName':_0x5f3a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js index f72dd6a..dc393b8 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 _0x385f=['attributes','limit','include','model','map','ShowFreshdeskAccount','find','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','where'];(function(_0xb3c4bb,_0x26d57d){var _0x2a575f=function(_0x29d834){while(--_0x29d834){_0xb3c4bb['push'](_0xb3c4bb['shift']());}};_0x2a575f(++_0x26d57d);}(_0x385f,0x7d));var _0xf385=function(_0x39f34f,_0x298f45){_0x39f34f=_0x39f34f-0x0;var _0x59fee1=_0x385f[_0x39f34f];return _0x59fee1;};'use strict';var _=require(_0xf385('0x0'));var util=require(_0xf385('0x1'));var moment=require(_0xf385('0x2'));var BPromise=require(_0xf385('0x3'));var rs=require(_0xf385('0x4'));var fs=require('fs');var Redis=require(_0xf385('0x5'));var db=require(_0xf385('0x6'))['db'];var utils=require(_0xf385('0x7'));var logger=require(_0xf385('0x8'))(_0xf385('0x9'));var config=require(_0xf385('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xf385('0xb')][_0xf385('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x53e4e5,_0x55b4fc,_0x216e4b){return new BPromise(function(_0x4d9036,_0x4c2332){return client[_0xf385('0xd')](_0x53e4e5,_0x216e4b)[_0xf385('0xe')](function(_0xc57701){logger['info'](_0xf385('0xf'),_0x55b4fc,_0xf385('0x10'));logger[_0xf385('0x11')](_0xf385('0x12'),_0x55b4fc,_0xf385('0x10'),JSON[_0xf385('0x13')](_0xc57701));if(_0xc57701['error']){if(_0xc57701[_0xf385('0x14')][_0xf385('0x15')]===0x1f4){logger[_0xf385('0x14')](_0xf385('0xf'),_0x55b4fc,_0xc57701[_0xf385('0x14')][_0xf385('0x16')]);return _0x4c2332(_0xc57701['error'][_0xf385('0x16')]);}logger[_0xf385('0x14')]('FreshdeskAccount,\x20%s,\x20%s',_0x55b4fc,_0xc57701[_0xf385('0x14')][_0xf385('0x16')]);return _0x4d9036(_0xc57701['error'][_0xf385('0x16')]);}else{logger[_0xf385('0x17')]('FreshdeskAccount,\x20%s,\x20%s',_0x55b4fc,_0xf385('0x10'));_0x4d9036(_0xc57701[_0xf385('0x18')][_0xf385('0x16')]);}})[_0xf385('0x19')](function(_0x275464){logger[_0xf385('0x14')]('FreshdeskAccount,\x20%s,\x20%s',_0x55b4fc,_0x275464);_0x4c2332(_0x275464);});});}exports[_0xf385('0x1a')]=function(_0x1c3286){var _0x52dd83=this;return new Promise(function(_0x18727f,_0x5bbd8b){return db[_0xf385('0x1b')][_0xf385('0x1c')]({'raw':_0x1c3286[_0xf385('0x1d')]?_0x1c3286['options']['raw']===undefined?!![]:![]:!![],'where':_0x1c3286['options']?_0x1c3286[_0xf385('0x1d')][_0xf385('0x1e')]||null:null,'attributes':_0x1c3286[_0xf385('0x1d')]?_0x1c3286[_0xf385('0x1d')][_0xf385('0x1f')]||null:null,'limit':_0x1c3286[_0xf385('0x1d')]?_0x1c3286[_0xf385('0x1d')][_0xf385('0x20')]||null:null,'include':_0x1c3286['options']?_0x1c3286[_0xf385('0x1d')][_0xf385('0x21')]?_['map'](_0x1c3286[_0xf385('0x1d')][_0xf385('0x21')],function(_0x12ea7c){return{'model':db[_0x12ea7c[_0xf385('0x22')]],'as':_0x12ea7c['as'],'attributes':_0x12ea7c[_0xf385('0x1f')],'include':_0x12ea7c[_0xf385('0x21')]?_[_0xf385('0x23')](_0x12ea7c[_0xf385('0x21')],function(_0x542460){return{'model':db[_0x542460['model']],'as':_0x542460['as'],'attributes':_0x542460['attributes'],'include':_0x542460[_0xf385('0x21')]?_['map'](_0x542460[_0xf385('0x21')],function(_0x4f9d68){return{'model':db[_0x4f9d68[_0xf385('0x22')]],'as':_0x4f9d68['as'],'attributes':_0x4f9d68[_0xf385('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x47af36){logger['info']('GetFreshdeskAccount',_0x1c3286);logger[_0xf385('0x11')]('GetFreshdeskAccount',_0x1c3286,JSON[_0xf385('0x13')](_0x47af36));_0x18727f(_0x47af36);})[_0xf385('0x19')](function(_0x244121){logger[_0xf385('0x14')](_0xf385('0x1a'),_0x244121['message'],_0x1c3286);_0x5bbd8b(_0x52dd83[_0xf385('0x14')](0x1f4,_0x244121['message']));});});};exports[_0xf385('0x24')]=function(_0x477c11){var _0x13de9e=this;return new Promise(function(_0x5d1f63,_0x533a61){return db[_0xf385('0x1b')][_0xf385('0x25')]({'raw':_0x477c11[_0xf385('0x1d')]?_0x477c11[_0xf385('0x1d')][_0xf385('0x26')]===undefined?!![]:![]:!![],'where':_0x477c11[_0xf385('0x1d')]?_0x477c11['options'][_0xf385('0x1e')]||null:null,'attributes':_0x477c11[_0xf385('0x1d')]?_0x477c11[_0xf385('0x1d')]['attributes']||null:null,'include':_0x477c11[_0xf385('0x1d')]?_0x477c11['options']['include']?_[_0xf385('0x23')](_0x477c11[_0xf385('0x1d')][_0xf385('0x21')],function(_0x5eef9a){return{'model':db[_0x5eef9a[_0xf385('0x22')]],'as':_0x5eef9a['as'],'attributes':_0x5eef9a[_0xf385('0x1f')],'include':_0x5eef9a['include']?_[_0xf385('0x23')](_0x5eef9a[_0xf385('0x21')],function(_0x3015cb){return{'model':db[_0x3015cb['model']],'as':_0x3015cb['as'],'attributes':_0x3015cb[_0xf385('0x1f')],'include':_0x3015cb[_0xf385('0x21')]?_['map'](_0x3015cb[_0xf385('0x21')],function(_0x19fa0e){return{'model':db[_0x19fa0e[_0xf385('0x22')]],'as':_0x19fa0e['as'],'attributes':_0x19fa0e[_0xf385('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x21bbe5){logger[_0xf385('0x17')](_0xf385('0x24'),_0x477c11);logger[_0xf385('0x11')](_0xf385('0x24'),_0x477c11,JSON[_0xf385('0x13')](_0x21bbe5));_0x5d1f63(_0x21bbe5);})[_0xf385('0x19')](function(_0x308e77){logger[_0xf385('0x14')](_0xf385('0x24'),_0x308e77[_0xf385('0x16')],_0x477c11);_0x533a61(_0x13de9e[_0xf385('0x14')](0x1f4,_0x308e77[_0xf385('0x16')]));});});}; \ No newline at end of file +var _0xa7eb=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','attributes','limit','include','map','model','debug','ShowFreshdeskAccount','where','lodash','util','moment','randomstring'];(function(_0xbfcb9a,_0x4f1bcc){var _0xc0697b=function(_0x16ea99){while(--_0x16ea99){_0xbfcb9a['push'](_0xbfcb9a['shift']());}};_0xc0697b(++_0x4f1bcc);}(_0xa7eb,0x1b6));var _0xba7e=function(_0x451078,_0xc12bf){_0x451078=_0x451078-0x0;var _0x5336e2=_0xa7eb[_0x451078];return _0x5336e2;};'use strict';var _=require(_0xba7e('0x0'));var util=require(_0xba7e('0x1'));var moment=require(_0xba7e('0x2'));var BPromise=require('bluebird');var rs=require(_0xba7e('0x3'));var fs=require('fs');var Redis=require(_0xba7e('0x4'));var db=require(_0xba7e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xba7e('0x6'))(_0xba7e('0x7'));var config=require(_0xba7e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xba7e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x244db9,_0x234bbe,_0x1072fa){return new BPromise(function(_0x4d9ce3,_0x36edf9){return client[_0xba7e('0xa')](_0x244db9,_0x1072fa)[_0xba7e('0xb')](function(_0x5c9fc0){logger[_0xba7e('0xc')](_0xba7e('0xd'),_0x234bbe,_0xba7e('0xe'));logger['debug'](_0xba7e('0xf'),_0x234bbe,_0xba7e('0xe'),JSON[_0xba7e('0x10')](_0x5c9fc0));if(_0x5c9fc0['error']){if(_0x5c9fc0[_0xba7e('0x11')]['code']===0x1f4){logger['error'](_0xba7e('0xd'),_0x234bbe,_0x5c9fc0[_0xba7e('0x11')][_0xba7e('0x12')]);return _0x36edf9(_0x5c9fc0[_0xba7e('0x11')][_0xba7e('0x12')]);}logger[_0xba7e('0x11')]('FreshdeskAccount,\x20%s,\x20%s',_0x234bbe,_0x5c9fc0[_0xba7e('0x11')][_0xba7e('0x12')]);return _0x4d9ce3(_0x5c9fc0[_0xba7e('0x11')][_0xba7e('0x12')]);}else{logger['info'](_0xba7e('0xd'),_0x234bbe,'request\x20sent');_0x4d9ce3(_0x5c9fc0[_0xba7e('0x13')][_0xba7e('0x12')]);}})[_0xba7e('0x14')](function(_0x28e298){logger[_0xba7e('0x11')]('FreshdeskAccount,\x20%s,\x20%s',_0x234bbe,_0x28e298);_0x36edf9(_0x28e298);});});}exports[_0xba7e('0x15')]=function(_0x142b2a){var _0x58a511=this;return new Promise(function(_0x2525bb,_0xf42a40){return db[_0xba7e('0x16')][_0xba7e('0x17')]({'raw':_0x142b2a[_0xba7e('0x18')]?_0x142b2a[_0xba7e('0x18')][_0xba7e('0x19')]===undefined?!![]:![]:!![],'where':_0x142b2a[_0xba7e('0x18')]?_0x142b2a['options']['where']||null:null,'attributes':_0x142b2a[_0xba7e('0x18')]?_0x142b2a[_0xba7e('0x18')][_0xba7e('0x1a')]||null:null,'limit':_0x142b2a[_0xba7e('0x18')]?_0x142b2a[_0xba7e('0x18')][_0xba7e('0x1b')]||null:null,'include':_0x142b2a['options']?_0x142b2a[_0xba7e('0x18')][_0xba7e('0x1c')]?_[_0xba7e('0x1d')](_0x142b2a[_0xba7e('0x18')][_0xba7e('0x1c')],function(_0x3c1682){return{'model':db[_0x3c1682[_0xba7e('0x1e')]],'as':_0x3c1682['as'],'attributes':_0x3c1682['attributes'],'include':_0x3c1682[_0xba7e('0x1c')]?_['map'](_0x3c1682[_0xba7e('0x1c')],function(_0x5156d7){return{'model':db[_0x5156d7['model']],'as':_0x5156d7['as'],'attributes':_0x5156d7[_0xba7e('0x1a')],'include':_0x5156d7[_0xba7e('0x1c')]?_[_0xba7e('0x1d')](_0x5156d7[_0xba7e('0x1c')],function(_0x3dee82){return{'model':db[_0x3dee82[_0xba7e('0x1e')]],'as':_0x3dee82['as'],'attributes':_0x3dee82[_0xba7e('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xba7e('0xb')](function(_0xbb691a){logger[_0xba7e('0xc')]('GetFreshdeskAccount',_0x142b2a);logger[_0xba7e('0x1f')](_0xba7e('0x15'),_0x142b2a,JSON['stringify'](_0xbb691a));_0x2525bb(_0xbb691a);})[_0xba7e('0x14')](function(_0xe1f4ff){logger[_0xba7e('0x11')]('GetFreshdeskAccount',_0xe1f4ff[_0xba7e('0x12')],_0x142b2a);_0xf42a40(_0x58a511['error'](0x1f4,_0xe1f4ff[_0xba7e('0x12')]));});});};exports[_0xba7e('0x20')]=function(_0x439881){var _0x9ecc34=this;return new Promise(function(_0x53bf78,_0x408a13){return db[_0xba7e('0x16')]['find']({'raw':_0x439881['options']?_0x439881[_0xba7e('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x439881[_0xba7e('0x18')]?_0x439881['options'][_0xba7e('0x21')]||null:null,'attributes':_0x439881[_0xba7e('0x18')]?_0x439881['options'][_0xba7e('0x1a')]||null:null,'include':_0x439881[_0xba7e('0x18')]?_0x439881[_0xba7e('0x18')][_0xba7e('0x1c')]?_[_0xba7e('0x1d')](_0x439881[_0xba7e('0x18')]['include'],function(_0x2a7585){return{'model':db[_0x2a7585[_0xba7e('0x1e')]],'as':_0x2a7585['as'],'attributes':_0x2a7585[_0xba7e('0x1a')],'include':_0x2a7585['include']?_[_0xba7e('0x1d')](_0x2a7585[_0xba7e('0x1c')],function(_0x2d321c){return{'model':db[_0x2d321c['model']],'as':_0x2d321c['as'],'attributes':_0x2d321c['attributes'],'include':_0x2d321c[_0xba7e('0x1c')]?_[_0xba7e('0x1d')](_0x2d321c[_0xba7e('0x1c')],function(_0x14efe3){return{'model':db[_0x14efe3[_0xba7e('0x1e')]],'as':_0x14efe3['as'],'attributes':_0x14efe3[_0xba7e('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xba7e('0xb')](function(_0x49e815){logger[_0xba7e('0xc')]('ShowFreshdeskAccount',_0x439881);logger[_0xba7e('0x1f')](_0xba7e('0x20'),_0x439881,JSON['stringify'](_0x49e815));_0x53bf78(_0x49e815);})[_0xba7e('0x14')](function(_0x508975){logger[_0xba7e('0x11')](_0xba7e('0x20'),_0x508975['message'],_0x439881);_0x408a13(_0x9ecc34['error'](0x1f4,_0x508975[_0xba7e('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index c517709..cba62bd 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 _0x828b=['isAuthenticated','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','post','create','setTags','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./intFreshdeskConfiguration.controller','get'];(function(_0x1b9326,_0x238147){var _0x554927=function(_0x33eea1){while(--_0x33eea1){_0x1b9326['push'](_0x1b9326['shift']());}};_0x554927(++_0x238147);}(_0x828b,0x147));var _0xb828=function(_0x2bb82d,_0x42c7f8){_0x2bb82d=_0x2bb82d-0x0;var _0x5e0b92=_0x828b[_0x2bb82d];return _0x5e0b92;};'use strict';var multer=require('multer');var util=require(_0xb828('0x0'));var path=require(_0xb828('0x1'));var timeout=require(_0xb828('0x2'));var express=require(_0xb828('0x3'));var router=express['Router']();var fs_extra=require(_0xb828('0x4'));var auth=require(_0xb828('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xb828('0x6'));var controller=require(_0xb828('0x7'));router[_0xb828('0x8')]('/',auth[_0xb828('0x9')](),controller['index']);router[_0xb828('0x8')]('/:id',auth[_0xb828('0x9')](),controller[_0xb828('0xa')]);router['get']('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router['get'](_0xb828('0xb'),auth[_0xb828('0x9')](),controller[_0xb828('0xc')]);router[_0xb828('0x8')](_0xb828('0xd'),auth[_0xb828('0x9')](),controller[_0xb828('0xe')]);router[_0xb828('0x8')](_0xb828('0xf'),auth['isAuthenticated'](),controller['getTags']);router[_0xb828('0x10')]('/',auth[_0xb828('0x9')](),controller[_0xb828('0x11')]);router[_0xb828('0x10')](_0xb828('0xf'),auth[_0xb828('0x9')](),controller[_0xb828('0x12')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0xb828('0x9')](),controller[_0xb828('0x13')]);module[_0xb828('0x14')]=router; \ No newline at end of file +var _0x2143=['setTags','update','delete','destroy','exports','util','path','express','Router','fs-extra','isAuthenticated','index','get','/:id','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','getTags','post','create','/:id/tags'];(function(_0x3c6ee1,_0x2795c2){var _0x1ac4ec=function(_0x3e8eab){while(--_0x3e8eab){_0x3c6ee1['push'](_0x3c6ee1['shift']());}};_0x1ac4ec(++_0x2795c2);}(_0x2143,0x1e8));var _0x3214=function(_0x56d1f3,_0x530a88){_0x56d1f3=_0x56d1f3-0x0;var _0x5b4e4f=_0x2143[_0x56d1f3];return _0x5b4e4f;};'use strict';var multer=require('multer');var util=require(_0x3214('0x0'));var path=require(_0x3214('0x1'));var timeout=require('connect-timeout');var express=require(_0x3214('0x2'));var router=express[_0x3214('0x3')]();var fs_extra=require(_0x3214('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intFreshdeskConfiguration.controller');router['get']('/',auth[_0x3214('0x5')](),controller[_0x3214('0x6')]);router[_0x3214('0x7')](_0x3214('0x8'),auth[_0x3214('0x5')](),controller['show']);router[_0x3214('0x7')](_0x3214('0x9'),auth[_0x3214('0x5')](),controller[_0x3214('0xa')]);router[_0x3214('0x7')]('/:id/subjects',auth[_0x3214('0x5')](),controller[_0x3214('0xb')]);router[_0x3214('0x7')](_0x3214('0xc'),auth[_0x3214('0x5')](),controller[_0x3214('0xd')]);router['get']('/:id/tags',auth['isAuthenticated'](),controller[_0x3214('0xe')]);router[_0x3214('0xf')]('/',auth[_0x3214('0x5')](),controller[_0x3214('0x10')]);router[_0x3214('0xf')](_0x3214('0x11'),auth[_0x3214('0x5')](),controller[_0x3214('0x12')]);router['put'](_0x3214('0x8'),auth[_0x3214('0x5')](),controller[_0x3214('0x13')]);router[_0x3214('0x14')](_0x3214('0x8'),auth[_0x3214('0x5')](),controller[_0x3214('0x15')]);module[_0x3214('0x16')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 48c6b6d..1990048 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 _0x9892=['STRING','sequelize'];(function(_0x4ded65,_0xc8d7c1){var _0x5864fb=function(_0x40df9d){while(--_0x40df9d){_0x4ded65['push'](_0x4ded65['shift']());}};_0x5864fb(++_0xc8d7c1);}(_0x9892,0xf7));var _0x2989=function(_0x77ed4b,_0x507f99){_0x77ed4b=_0x77ed4b-0x0;var _0x448455=_0x9892[_0x77ed4b];return _0x448455;};'use strict';var Sequelize=require(_0x2989('0x0'));module['exports']={'name':{'type':Sequelize[_0x2989('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa143=['exports','STRING','sequelize'];(function(_0x56cf62,_0x1d69a3){var _0x523526=function(_0x527edc){while(--_0x527edc){_0x56cf62['push'](_0x56cf62['shift']());}};_0x523526(++_0x1d69a3);}(_0xa143,0x143));var _0x3a14=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xa143[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x3a14('0x0'));module[_0x3a14('0x1')]={'name':{'type':Sequelize[_0x3a14('0x2')]},'description':{'type':Sequelize[_0x3a14('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 401d8ea..eb4fa11 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 _0xbc5d=['fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','count','limit','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','map','FreshdeskConfiguration','fieldName','type','model','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','filters','where','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','length','merge','find','create','body','params','getFields','findOne','FreshdeskField','pick','getSubjects','rawAttributes','getDescriptions','getTags','setTags','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox'];(function(_0x504c88,_0x1c3016){var _0xb5611e=function(_0x2beaf8){while(--_0x2beaf8){_0x504c88['push'](_0x504c88['shift']());}};_0xb5611e(++_0x1c3016);}(_0xbc5d,0x1ef));var _0xdbc5=function(_0x3eb7d5,_0x244971){_0x3eb7d5=_0x3eb7d5-0x0;var _0x512416=_0xbc5d[_0x3eb7d5];return _0x512416;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdbc5('0x0'));var zipdir=require(_0xdbc5('0x1'));var jsonpatch=require(_0xdbc5('0x2'));var rp=require(_0xdbc5('0x3'));var moment=require(_0xdbc5('0x4'));var BPromise=require(_0xdbc5('0x5'));var Mustache=require('mustache');var util=require(_0xdbc5('0x6'));var path=require(_0xdbc5('0x7'));var sox=require(_0xdbc5('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdbc5('0x9'));var _=require(_0xdbc5('0xa'));var squel=require(_0xdbc5('0xb'));var crypto=require(_0xdbc5('0xc'));var jsforce=require(_0xdbc5('0xd'));var deskjs=require(_0xdbc5('0xe'));var toCsv=require(_0xdbc5('0xf'));var querystring=require(_0xdbc5('0x10'));var Papa=require(_0xdbc5('0x11'));var Redis=require('ioredis');var authService=require(_0xdbc5('0x12'));var qs=require(_0xdbc5('0x13'));var as=require(_0xdbc5('0x14'));var hardwareService=require(_0xdbc5('0x15'));var logger=require(_0xdbc5('0x16'))(_0xdbc5('0x17'));var utils=require(_0xdbc5('0x18'));var config=require(_0xdbc5('0x19'));var licenseUtil=require(_0xdbc5('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x17d163,_0xb07066){_0xb07066=_0xb07066||0xcc;return function(_0x3db7b5){if(_0x3db7b5){return _0x17d163[_0xdbc5('0x1b')](_0xb07066);}return _0x17d163[_0xdbc5('0x1c')](_0xb07066)[_0xdbc5('0x1d')]();};}function respondWithResult(_0xbabb15,_0xfbf2b8){_0xfbf2b8=_0xfbf2b8||0xc8;return function(_0x3b37c5){if(_0x3b37c5){return _0xbabb15[_0xdbc5('0x1c')](_0xfbf2b8)['json'](_0x3b37c5);}};}function respondWithFilteredResult(_0x1cf387,_0x58bf8c){return function(_0x3110f3){if(_0x3110f3){var _0x3da042=typeof _0x58bf8c[_0xdbc5('0x1e')]===_0xdbc5('0x1f')&&typeof _0x58bf8c['limit']===_0xdbc5('0x1f');var _0x489874=_0x3110f3[_0xdbc5('0x20')];var _0x42ff3a=_0x3da042?0x0:_0x58bf8c[_0xdbc5('0x1e')];var _0x36cc76=_0x3da042?_0x3110f3[_0xdbc5('0x20')]:_0x58bf8c[_0xdbc5('0x1e')]+_0x58bf8c[_0xdbc5('0x21')];var _0x19b0a6;if(_0x36cc76>=_0x489874){_0x36cc76=_0x489874;_0x19b0a6=0xc8;}else{_0x19b0a6=0xce;}_0x1cf387[_0xdbc5('0x1c')](_0x19b0a6);return _0x1cf387['set'](_0xdbc5('0x22'),_0x42ff3a+'-'+_0x36cc76+'/'+_0x489874)[_0xdbc5('0x23')](_0x3110f3);}return null;};}function patchUpdates(_0x3f82eb){return function(_0x4fbc7a){try{jsonpatch[_0xdbc5('0x24')](_0x4fbc7a,_0x3f82eb,!![]);}catch(_0x21dbf5){return BPromise[_0xdbc5('0x25')](_0x21dbf5);}return _0x4fbc7a[_0xdbc5('0x26')]();};}function saveUpdates(_0x45c444,_0x221d07){return function(_0x5e38b1){if(_0x5e38b1){return _0x5e38b1[_0xdbc5('0x27')](_0x45c444)[_0xdbc5('0x28')](function(_0x1b78bb){return _0x1b78bb;});}return null;};}function removeEntity(_0xa69b33,_0x48b892){return function(_0x142308){if(_0x142308){return _0x142308[_0xdbc5('0x29')]()[_0xdbc5('0x28')](function(){_0xa69b33[_0xdbc5('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x41ae0a,_0x39d28a){return function(_0xf1bc8f){if(!_0xf1bc8f){_0x41ae0a['sendStatus'](0x194);}return _0xf1bc8f;};}function handleError(_0x4b27b6,_0x27dac6){_0x27dac6=_0x27dac6||0x1f4;return function(_0x4cb1f5){logger[_0xdbc5('0x2a')](_0x4cb1f5[_0xdbc5('0x2b')]);if(_0x4cb1f5[_0xdbc5('0x2c')]){delete _0x4cb1f5['name'];}_0x4b27b6[_0xdbc5('0x1c')](_0x27dac6)['send'](_0x4cb1f5);};}exports['index']=function(_0x47ae15,_0xfec24b){var _0x264052={},_0x2fb350={},_0x15e58b={'count':0x0,'rows':[]};var _0x585f80=_[_0xdbc5('0x2d')](db[_0xdbc5('0x2e')]['rawAttributes'],function(_0x19551d){return{'name':_0x19551d[_0xdbc5('0x2f')],'type':_0x19551d[_0xdbc5('0x30')]['key']};});_0x2fb350[_0xdbc5('0x31')]=_[_0xdbc5('0x2d')](_0x585f80,_0xdbc5('0x2c'));_0x2fb350[_0xdbc5('0x32')]=_[_0xdbc5('0x33')](_0x47ae15['query']);_0x2fb350['filters']=_['intersection'](_0x2fb350[_0xdbc5('0x31')],_0x2fb350[_0xdbc5('0x32')]);_0x264052[_0xdbc5('0x34')]=_[_0xdbc5('0x35')](_0x2fb350[_0xdbc5('0x31')],qs[_0xdbc5('0x36')](_0x47ae15[_0xdbc5('0x32')][_0xdbc5('0x36')]));_0x264052[_0xdbc5('0x34')]=_0x264052[_0xdbc5('0x34')]['length']?_0x264052[_0xdbc5('0x34')]:_0x2fb350[_0xdbc5('0x31')];if(!_0x47ae15['query'][_0xdbc5('0x37')](_0xdbc5('0x38'))){_0x264052['limit']=qs['limit'](_0x47ae15[_0xdbc5('0x32')]['limit']);_0x264052[_0xdbc5('0x1e')]=qs[_0xdbc5('0x1e')](_0x47ae15[_0xdbc5('0x32')]['offset']);}_0x264052[_0xdbc5('0x39')]=qs['sort'](_0x47ae15[_0xdbc5('0x32')][_0xdbc5('0x3a')]);_0x264052['where']=qs[_0xdbc5('0x3b')](_['pick'](_0x47ae15[_0xdbc5('0x32')],_0x2fb350[_0xdbc5('0x3b')]),_0x585f80);if(_0x47ae15['query']['filter']){_0x264052[_0xdbc5('0x3c')]=_['merge'](_0x264052[_0xdbc5('0x3c')],{'$or':_[_0xdbc5('0x2d')](_0x585f80,function(_0x3861a3){if(_0x3861a3[_0xdbc5('0x30')]!==_0xdbc5('0x3d')){var _0x21fac3={};_0x21fac3[_0x3861a3['name']]={'$like':'%'+_0x47ae15[_0xdbc5('0x32')][_0xdbc5('0x3e')]+'%'};return _0x21fac3;}})});}_0x264052=_['merge']({},_0x264052,_0x47ae15[_0xdbc5('0x3f')]);var _0x104a0e={'where':_0x264052[_0xdbc5('0x3c')]};return db[_0xdbc5('0x2e')][_0xdbc5('0x20')](_0x104a0e)[_0xdbc5('0x28')](function(_0xfc1722){_0x15e58b['count']=_0xfc1722;if(_0x47ae15[_0xdbc5('0x32')][_0xdbc5('0x40')]){_0x264052[_0xdbc5('0x41')]=[{'all':!![]}];}return db[_0xdbc5('0x2e')][_0xdbc5('0x42')](_0x264052);})[_0xdbc5('0x28')](function(_0x161b5c){_0x15e58b[_0xdbc5('0x43')]=_0x161b5c;return _0x15e58b;})['then'](respondWithFilteredResult(_0xfec24b,_0x264052))[_0xdbc5('0x44')](handleError(_0xfec24b,null));};exports['show']=function(_0x490a13,_0x1541e9){var _0x4d70b7={'raw':![],'where':{'id':_0x490a13['params']['id']}},_0x465b96={};_0x465b96[_0xdbc5('0x31')]=_[_0xdbc5('0x33')](db['FreshdeskConfiguration']['rawAttributes']);_0x465b96['query']=_['keys'](_0x490a13[_0xdbc5('0x32')]);_0x465b96[_0xdbc5('0x3b')]=_['intersection'](_0x465b96[_0xdbc5('0x31')],_0x465b96[_0xdbc5('0x32')]);_0x4d70b7[_0xdbc5('0x34')]=_[_0xdbc5('0x35')](_0x465b96[_0xdbc5('0x31')],qs[_0xdbc5('0x36')](_0x490a13['query'][_0xdbc5('0x36')]));_0x4d70b7[_0xdbc5('0x34')]=_0x4d70b7[_0xdbc5('0x34')][_0xdbc5('0x45')]?_0x4d70b7['attributes']:_0x465b96[_0xdbc5('0x31')];if(_0x490a13[_0xdbc5('0x32')][_0xdbc5('0x40')]){_0x4d70b7['include']=[{'all':!![]}];}_0x4d70b7=_[_0xdbc5('0x46')]({},_0x4d70b7,_0x490a13[_0xdbc5('0x3f')]);return db[_0xdbc5('0x2e')][_0xdbc5('0x47')](_0x4d70b7)['then'](handleEntityNotFound(_0x1541e9,null))['then'](respondWithResult(_0x1541e9,null))['catch'](handleError(_0x1541e9,null));};exports[_0xdbc5('0x48')]=function(_0x3207e7,_0x17078c){return db[_0xdbc5('0x2e')]['create'](_0x3207e7[_0xdbc5('0x49')],{})['then'](respondWithResult(_0x17078c,0xc9))[_0xdbc5('0x44')](handleError(_0x17078c,null));};exports[_0xdbc5('0x27')]=function(_0x5f2a72,_0xfb2537){if(_0x5f2a72[_0xdbc5('0x49')]['id']){delete _0x5f2a72['body']['id'];}return db[_0xdbc5('0x2e')][_0xdbc5('0x47')]({'where':{'id':_0x5f2a72[_0xdbc5('0x4a')]['id']}})[_0xdbc5('0x28')](handleEntityNotFound(_0xfb2537,null))[_0xdbc5('0x28')](saveUpdates(_0x5f2a72[_0xdbc5('0x49')],null))[_0xdbc5('0x28')](respondWithResult(_0xfb2537,null))['catch'](handleError(_0xfb2537,null));};exports[_0xdbc5('0x29')]=function(_0x353d4b,_0xacc0cf){return db[_0xdbc5('0x2e')]['find']({'where':{'id':_0x353d4b['params']['id']}})[_0xdbc5('0x28')](handleEntityNotFound(_0xacc0cf,null))[_0xdbc5('0x28')](removeEntity(_0xacc0cf,null))['catch'](handleError(_0xacc0cf,null));};exports[_0xdbc5('0x4b')]=function(_0x4833b4,_0x19691b,_0x5a7d55){var _0x10f3d1={};var _0x3f8662={};var _0x372d3e;var _0xd92241;return db[_0xdbc5('0x2e')][_0xdbc5('0x4c')]({'where':{'id':_0x4833b4[_0xdbc5('0x4a')]['id']}})[_0xdbc5('0x28')](handleEntityNotFound(_0x19691b,null))[_0xdbc5('0x28')](function(_0x11e6c6){if(_0x11e6c6){_0x372d3e=_0x11e6c6;_0x3f8662[_0xdbc5('0x31')]=_['keys'](db[_0xdbc5('0x4d')]['rawAttributes']);_0x3f8662['query']=_[_0xdbc5('0x33')](_0x4833b4[_0xdbc5('0x32')]);_0x3f8662[_0xdbc5('0x3b')]=_[_0xdbc5('0x35')](_0x3f8662['model'],_0x3f8662[_0xdbc5('0x32')]);_0x10f3d1[_0xdbc5('0x34')]=_['intersection'](_0x3f8662[_0xdbc5('0x31')],qs['fields'](_0x4833b4[_0xdbc5('0x32')][_0xdbc5('0x36')]));_0x10f3d1[_0xdbc5('0x34')]=_0x10f3d1['attributes'][_0xdbc5('0x45')]?_0x10f3d1[_0xdbc5('0x34')]:_0x3f8662[_0xdbc5('0x31')];_0x10f3d1[_0xdbc5('0x39')]=qs['sort'](_0x4833b4['query'][_0xdbc5('0x3a')]);_0x10f3d1['where']=qs[_0xdbc5('0x3b')](_[_0xdbc5('0x4e')](_0x4833b4['query'],_0x3f8662['filters']));if(_0x4833b4[_0xdbc5('0x32')][_0xdbc5('0x3e')]){_0x10f3d1[_0xdbc5('0x3c')]=_[_0xdbc5('0x46')](_0x10f3d1['where'],{'$or':_[_0xdbc5('0x2d')](_0x10f3d1['attributes'],function(_0x5dc9d7){var _0x3cfd98={};_0x3cfd98[_0x5dc9d7]={'$like':'%'+_0x4833b4[_0xdbc5('0x32')][_0xdbc5('0x3e')]+'%'};return _0x3cfd98;})});}_0x10f3d1=_[_0xdbc5('0x46')]({},_0x10f3d1,_0x4833b4[_0xdbc5('0x3f')]);return _0x372d3e[_0xdbc5('0x4b')](_0x10f3d1);}})[_0xdbc5('0x28')](function(_0xd336a2){if(_0xd336a2){_0xd92241=_0xd336a2[_0xdbc5('0x45')];if(!_0x4833b4[_0xdbc5('0x32')][_0xdbc5('0x37')](_0xdbc5('0x38'))){_0x10f3d1[_0xdbc5('0x21')]=qs[_0xdbc5('0x21')](_0x4833b4['query'][_0xdbc5('0x21')]);_0x10f3d1['offset']=qs['offset'](_0x4833b4['query'][_0xdbc5('0x1e')]);}return _0x372d3e['getFields'](_0x10f3d1);}})['then'](function(_0x53ce37){if(_0x53ce37){return _0x53ce37?{'count':_0xd92241,'rows':_0x53ce37}:null;}})[_0xdbc5('0x28')](respondWithResult(_0x19691b,null))[_0xdbc5('0x44')](handleError(_0x19691b,null));};exports[_0xdbc5('0x4f')]=function(_0x5b7e61,_0x137f29,_0x574e2d){var _0x618b3={};var _0x30216f={};var _0x3e482f;var _0x26137c;return db[_0xdbc5('0x2e')][_0xdbc5('0x4c')]({'where':{'id':_0x5b7e61[_0xdbc5('0x4a')]['id']}})['then'](handleEntityNotFound(_0x137f29,null))['then'](function(_0x3fdd89){if(_0x3fdd89){_0x3e482f=_0x3fdd89;_0x30216f[_0xdbc5('0x31')]=_[_0xdbc5('0x33')](db[_0xdbc5('0x4d')][_0xdbc5('0x50')]);_0x30216f[_0xdbc5('0x32')]=_['keys'](_0x5b7e61['query']);_0x30216f[_0xdbc5('0x3b')]=_['intersection'](_0x30216f[_0xdbc5('0x31')],_0x30216f[_0xdbc5('0x32')]);_0x618b3[_0xdbc5('0x34')]=_[_0xdbc5('0x35')](_0x30216f[_0xdbc5('0x31')],qs[_0xdbc5('0x36')](_0x5b7e61[_0xdbc5('0x32')]['fields']));_0x618b3[_0xdbc5('0x34')]=_0x618b3[_0xdbc5('0x34')][_0xdbc5('0x45')]?_0x618b3[_0xdbc5('0x34')]:_0x30216f[_0xdbc5('0x31')];_0x618b3[_0xdbc5('0x39')]=qs[_0xdbc5('0x3a')](_0x5b7e61[_0xdbc5('0x32')][_0xdbc5('0x3a')]);_0x618b3['where']=qs[_0xdbc5('0x3b')](_[_0xdbc5('0x4e')](_0x5b7e61[_0xdbc5('0x32')],_0x30216f[_0xdbc5('0x3b')]));if(_0x5b7e61[_0xdbc5('0x32')]['filter']){_0x618b3[_0xdbc5('0x3c')]=_[_0xdbc5('0x46')](_0x618b3[_0xdbc5('0x3c')],{'$or':_[_0xdbc5('0x2d')](_0x618b3[_0xdbc5('0x34')],function(_0x5a5cc8){var _0x2589b3={};_0x2589b3[_0x5a5cc8]={'$like':'%'+_0x5b7e61[_0xdbc5('0x32')][_0xdbc5('0x3e')]+'%'};return _0x2589b3;})});}_0x618b3=_['merge']({},_0x618b3,_0x5b7e61[_0xdbc5('0x3f')]);return _0x3e482f['getSubjects'](_0x618b3);}})['then'](function(_0x19b2e9){if(_0x19b2e9){_0x26137c=_0x19b2e9[_0xdbc5('0x45')];if(!_0x5b7e61['query'][_0xdbc5('0x37')](_0xdbc5('0x38'))){_0x618b3[_0xdbc5('0x21')]=qs[_0xdbc5('0x21')](_0x5b7e61[_0xdbc5('0x32')][_0xdbc5('0x21')]);_0x618b3['offset']=qs[_0xdbc5('0x1e')](_0x5b7e61[_0xdbc5('0x32')][_0xdbc5('0x1e')]);}return _0x3e482f[_0xdbc5('0x4f')](_0x618b3);}})[_0xdbc5('0x28')](function(_0x343518){if(_0x343518){return _0x343518?{'count':_0x26137c,'rows':_0x343518}:null;}})['then'](respondWithResult(_0x137f29,null))[_0xdbc5('0x44')](handleError(_0x137f29,null));};exports[_0xdbc5('0x51')]=function(_0x179602,_0x15eb10,_0x14f285){var _0xe32f9b={};var _0x8741ff={};var _0x23ec27;var _0x4a13ab;return db['FreshdeskConfiguration'][_0xdbc5('0x4c')]({'where':{'id':_0x179602[_0xdbc5('0x4a')]['id']}})[_0xdbc5('0x28')](handleEntityNotFound(_0x15eb10,null))[_0xdbc5('0x28')](function(_0x45fce5){if(_0x45fce5){_0x23ec27=_0x45fce5;_0x8741ff[_0xdbc5('0x31')]=_[_0xdbc5('0x33')](db[_0xdbc5('0x4d')][_0xdbc5('0x50')]);_0x8741ff[_0xdbc5('0x32')]=_['keys'](_0x179602['query']);_0x8741ff['filters']=_[_0xdbc5('0x35')](_0x8741ff['model'],_0x8741ff['query']);_0xe32f9b['attributes']=_[_0xdbc5('0x35')](_0x8741ff[_0xdbc5('0x31')],qs[_0xdbc5('0x36')](_0x179602[_0xdbc5('0x32')][_0xdbc5('0x36')]));_0xe32f9b[_0xdbc5('0x34')]=_0xe32f9b['attributes'][_0xdbc5('0x45')]?_0xe32f9b['attributes']:_0x8741ff['model'];_0xe32f9b[_0xdbc5('0x39')]=qs[_0xdbc5('0x3a')](_0x179602[_0xdbc5('0x32')][_0xdbc5('0x3a')]);_0xe32f9b[_0xdbc5('0x3c')]=qs[_0xdbc5('0x3b')](_[_0xdbc5('0x4e')](_0x179602[_0xdbc5('0x32')],_0x8741ff['filters']));if(_0x179602[_0xdbc5('0x32')][_0xdbc5('0x3e')]){_0xe32f9b['where']=_[_0xdbc5('0x46')](_0xe32f9b[_0xdbc5('0x3c')],{'$or':_[_0xdbc5('0x2d')](_0xe32f9b[_0xdbc5('0x34')],function(_0x311bed){var _0x5abcf8={};_0x5abcf8[_0x311bed]={'$like':'%'+_0x179602['query'][_0xdbc5('0x3e')]+'%'};return _0x5abcf8;})});}_0xe32f9b=_[_0xdbc5('0x46')]({},_0xe32f9b,_0x179602[_0xdbc5('0x3f')]);return _0x23ec27[_0xdbc5('0x51')](_0xe32f9b);}})[_0xdbc5('0x28')](function(_0xd2ca6a){if(_0xd2ca6a){_0x4a13ab=_0xd2ca6a[_0xdbc5('0x45')];if(!_0x179602[_0xdbc5('0x32')][_0xdbc5('0x37')]('nolimit')){_0xe32f9b[_0xdbc5('0x21')]=qs[_0xdbc5('0x21')](_0x179602['query'][_0xdbc5('0x21')]);_0xe32f9b['offset']=qs[_0xdbc5('0x1e')](_0x179602[_0xdbc5('0x32')][_0xdbc5('0x1e')]);}return _0x23ec27[_0xdbc5('0x51')](_0xe32f9b);}})[_0xdbc5('0x28')](function(_0x38b504){if(_0x38b504){return _0x38b504?{'count':_0x4a13ab,'rows':_0x38b504}:null;}})[_0xdbc5('0x28')](respondWithResult(_0x15eb10,null))[_0xdbc5('0x44')](handleError(_0x15eb10,null));};exports['getTags']=function(_0x287ff7,_0x883bd9,_0x4b029a){var _0x136a67={};var _0x2e9144={};var _0x1aa204;var _0xa61ef3;return db[_0xdbc5('0x2e')][_0xdbc5('0x4c')]({'where':{'id':_0x287ff7[_0xdbc5('0x4a')]['id']}})[_0xdbc5('0x28')](handleEntityNotFound(_0x883bd9,null))[_0xdbc5('0x28')](function(_0x32e2dd){if(_0x32e2dd){_0x1aa204=_0x32e2dd;_0x2e9144['model']=_['keys'](db['Tag'][_0xdbc5('0x50')]);_0x2e9144[_0xdbc5('0x32')]=_[_0xdbc5('0x33')](_0x287ff7[_0xdbc5('0x32')]);_0x2e9144[_0xdbc5('0x3b')]=_[_0xdbc5('0x35')](_0x2e9144[_0xdbc5('0x31')],_0x2e9144[_0xdbc5('0x32')]);_0x136a67[_0xdbc5('0x34')]=_['intersection'](_0x2e9144[_0xdbc5('0x31')],qs[_0xdbc5('0x36')](_0x287ff7[_0xdbc5('0x32')][_0xdbc5('0x36')]));_0x136a67[_0xdbc5('0x34')]=_0x136a67['attributes'][_0xdbc5('0x45')]?_0x136a67['attributes']:_0x2e9144[_0xdbc5('0x31')];_0x136a67[_0xdbc5('0x39')]=qs[_0xdbc5('0x3a')](_0x287ff7[_0xdbc5('0x32')][_0xdbc5('0x3a')]);_0x136a67['where']=qs[_0xdbc5('0x3b')](_[_0xdbc5('0x4e')](_0x287ff7[_0xdbc5('0x32')],_0x2e9144[_0xdbc5('0x3b')]));if(_0x287ff7['query'][_0xdbc5('0x3e')]){_0x136a67['where']=_['merge'](_0x136a67[_0xdbc5('0x3c')],{'$or':_[_0xdbc5('0x2d')](_0x136a67['attributes'],function(_0x174b82){var _0x5cba36={};_0x5cba36[_0x174b82]={'$like':'%'+_0x287ff7[_0xdbc5('0x32')][_0xdbc5('0x3e')]+'%'};return _0x5cba36;})});}_0x136a67=_[_0xdbc5('0x46')]({},_0x136a67,_0x287ff7[_0xdbc5('0x3f')]);return _0x1aa204[_0xdbc5('0x52')](_0x136a67);}})['then'](function(_0x98ea06){if(_0x98ea06){_0xa61ef3=_0x98ea06['length'];if(!_0x287ff7[_0xdbc5('0x32')][_0xdbc5('0x37')](_0xdbc5('0x38'))){_0x136a67[_0xdbc5('0x21')]=qs['limit'](_0x287ff7['query'][_0xdbc5('0x21')]);_0x136a67['offset']=qs['offset'](_0x287ff7[_0xdbc5('0x32')][_0xdbc5('0x1e')]);}return _0x1aa204['getTags'](_0x136a67);}})['then'](function(_0x4d9aa8){if(_0x4d9aa8){return _0x4d9aa8?{'count':_0xa61ef3,'rows':_0x4d9aa8}:null;}})[_0xdbc5('0x28')](respondWithResult(_0x883bd9,null))[_0xdbc5('0x44')](handleError(_0x883bd9,null));};exports[_0xdbc5('0x53')]=function(_0x4b734a,_0x3a52af,_0x1acfb4){if(_0x4b734a[_0xdbc5('0x49')]['id']){delete _0x4b734a[_0xdbc5('0x49')]['id'];}return db[_0xdbc5('0x2e')]['findOne']({'where':{'id':_0x4b734a['params']['id']}})['then'](handleEntityNotFound(_0x3a52af,null))['then'](function(_0x111fb0){if(_0x111fb0){return _0x111fb0['setTags'](_0x4b734a[_0xdbc5('0x49')]['ids']||[]);}return null;})[_0xdbc5('0x28')](respondWithResult(_0x3a52af,null))[_0xdbc5('0x44')](handleError(_0x3a52af,null));}; \ No newline at end of file +var _0x9077=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','end','error','stack','send','index','FreshdeskConfiguration','rawAttributes','type','key','model','map','name','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','filter','merge','options','includeAll','findAll','rows','catch','params','include','find','create','body','destroy','getFields','FreshdeskField','order','pick','hasOwnProperty','getSubjects','findOne','getDescriptions','getTags','setTags','ids','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','squel','crypto','querystring','papaparse','ioredis'];(function(_0x4fc1e3,_0x52f995){var _0x1ce4e4=function(_0x27e2b0){while(--_0x27e2b0){_0x4fc1e3['push'](_0x4fc1e3['shift']());}};_0x1ce4e4(++_0x52f995);}(_0x9077,0x94));var _0x7907=function(_0x73a84b,_0x23d3bb){_0x73a84b=_0x73a84b-0x0;var _0x9e2a66=_0x9077[_0x73a84b];return _0x9e2a66;};'use strict';var emlformat=require(_0x7907('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7907('0x1'));var jsonpatch=require(_0x7907('0x2'));var rp=require(_0x7907('0x3'));var moment=require(_0x7907('0x4'));var BPromise=require(_0x7907('0x5'));var Mustache=require(_0x7907('0x6'));var util=require('util');var path=require(_0x7907('0x7'));var sox=require(_0x7907('0x8'));var csv=require(_0x7907('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7907('0xa'));var _=require('lodash');var squel=require(_0x7907('0xb'));var crypto=require(_0x7907('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x7907('0x9'));var querystring=require(_0x7907('0xd'));var Papa=require(_0x7907('0xe'));var Redis=require(_0x7907('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x7907('0x10'));var as=require(_0x7907('0x11'));var hardwareService=require(_0x7907('0x12'));var logger=require('../../config/logger')(_0x7907('0x13'));var utils=require('../../config/utils');var config=require(_0x7907('0x14'));var licenseUtil=require(_0x7907('0x15'));var db=require(_0x7907('0x16'))['db'];function respondWithStatusCode(_0x130d84,_0x41dd4b){_0x41dd4b=_0x41dd4b||0xcc;return function(_0x972448){if(_0x972448){return _0x130d84[_0x7907('0x17')](_0x41dd4b);}return _0x130d84['status'](_0x41dd4b)['end']();};}function respondWithResult(_0x573c8f,_0x3e4187){_0x3e4187=_0x3e4187||0xc8;return function(_0x4adcf3){if(_0x4adcf3){return _0x573c8f[_0x7907('0x18')](_0x3e4187)[_0x7907('0x19')](_0x4adcf3);}};}function respondWithFilteredResult(_0x3f12f8,_0x26629f){return function(_0x486176){if(_0x486176){var _0x2bac10=typeof _0x26629f[_0x7907('0x1a')]===_0x7907('0x1b')&&typeof _0x26629f[_0x7907('0x1c')]===_0x7907('0x1b');var _0x28f0aa=_0x486176[_0x7907('0x1d')];var _0x50f5b0=_0x2bac10?0x0:_0x26629f[_0x7907('0x1a')];var _0x783df2=_0x2bac10?_0x486176['count']:_0x26629f['offset']+_0x26629f[_0x7907('0x1c')];var _0x6dd372;if(_0x783df2>=_0x28f0aa){_0x783df2=_0x28f0aa;_0x6dd372=0xc8;}else{_0x6dd372=0xce;}_0x3f12f8[_0x7907('0x18')](_0x6dd372);return _0x3f12f8[_0x7907('0x1e')](_0x7907('0x1f'),_0x50f5b0+'-'+_0x783df2+'/'+_0x28f0aa)[_0x7907('0x19')](_0x486176);}return null;};}function patchUpdates(_0xb00ce9){return function(_0xf28914){try{jsonpatch[_0x7907('0x20')](_0xf28914,_0xb00ce9,!![]);}catch(_0x5dca7e){return BPromise[_0x7907('0x21')](_0x5dca7e);}return _0xf28914['save']();};}function saveUpdates(_0x2c7b1a,_0x2ce9fb){return function(_0x536746){if(_0x536746){return _0x536746[_0x7907('0x22')](_0x2c7b1a)[_0x7907('0x23')](function(_0x4c325c){return _0x4c325c;});}return null;};}function removeEntity(_0x307cc0,_0x3b0273){return function(_0x5e27f8){if(_0x5e27f8){return _0x5e27f8['destroy']()[_0x7907('0x23')](function(){_0x307cc0[_0x7907('0x18')](0xcc)[_0x7907('0x24')]();});}};}function handleEntityNotFound(_0x48ba17,_0x18bf3a){return function(_0x1f764c){if(!_0x1f764c){_0x48ba17[_0x7907('0x17')](0x194);}return _0x1f764c;};}function handleError(_0x546513,_0x4c9094){_0x4c9094=_0x4c9094||0x1f4;return function(_0x4aa328){logger[_0x7907('0x25')](_0x4aa328[_0x7907('0x26')]);if(_0x4aa328['name']){delete _0x4aa328['name'];}_0x546513[_0x7907('0x18')](_0x4c9094)[_0x7907('0x27')](_0x4aa328);};}exports[_0x7907('0x28')]=function(_0x406739,_0x5a5ffa){var _0x233057={},_0x1305f0={},_0x579c1a={'count':0x0,'rows':[]};var _0xf0e4dd=_['map'](db[_0x7907('0x29')][_0x7907('0x2a')],function(_0x4cee71){return{'name':_0x4cee71['fieldName'],'type':_0x4cee71[_0x7907('0x2b')][_0x7907('0x2c')]};});_0x1305f0[_0x7907('0x2d')]=_[_0x7907('0x2e')](_0xf0e4dd,_0x7907('0x2f'));_0x1305f0[_0x7907('0x30')]=_[_0x7907('0x31')](_0x406739['query']);_0x1305f0[_0x7907('0x32')]=_[_0x7907('0x33')](_0x1305f0['model'],_0x1305f0[_0x7907('0x30')]);_0x233057[_0x7907('0x34')]=_[_0x7907('0x33')](_0x1305f0[_0x7907('0x2d')],qs[_0x7907('0x35')](_0x406739[_0x7907('0x30')]['fields']));_0x233057[_0x7907('0x34')]=_0x233057[_0x7907('0x34')][_0x7907('0x36')]?_0x233057[_0x7907('0x34')]:_0x1305f0['model'];if(!_0x406739[_0x7907('0x30')]['hasOwnProperty'](_0x7907('0x37'))){_0x233057['limit']=qs['limit'](_0x406739[_0x7907('0x30')]['limit']);_0x233057[_0x7907('0x1a')]=qs[_0x7907('0x1a')](_0x406739[_0x7907('0x30')][_0x7907('0x1a')]);}_0x233057['order']=qs[_0x7907('0x38')](_0x406739[_0x7907('0x30')][_0x7907('0x38')]);_0x233057[_0x7907('0x39')]=qs[_0x7907('0x32')](_['pick'](_0x406739['query'],_0x1305f0[_0x7907('0x32')]),_0xf0e4dd);if(_0x406739[_0x7907('0x30')][_0x7907('0x3a')]){_0x233057['where']=_[_0x7907('0x3b')](_0x233057[_0x7907('0x39')],{'$or':_['map'](_0xf0e4dd,function(_0x3b44fc){if(_0x3b44fc[_0x7907('0x2b')]!=='VIRTUAL'){var _0x5098b5={};_0x5098b5[_0x3b44fc[_0x7907('0x2f')]]={'$like':'%'+_0x406739[_0x7907('0x30')]['filter']+'%'};return _0x5098b5;}})});}_0x233057=_['merge']({},_0x233057,_0x406739[_0x7907('0x3c')]);var _0x58291f={'where':_0x233057[_0x7907('0x39')]};return db['FreshdeskConfiguration'][_0x7907('0x1d')](_0x58291f)['then'](function(_0x52e5fd){_0x579c1a[_0x7907('0x1d')]=_0x52e5fd;if(_0x406739[_0x7907('0x30')][_0x7907('0x3d')]){_0x233057['include']=[{'all':!![]}];}return db[_0x7907('0x29')][_0x7907('0x3e')](_0x233057);})[_0x7907('0x23')](function(_0x5f5533){_0x579c1a[_0x7907('0x3f')]=_0x5f5533;return _0x579c1a;})[_0x7907('0x23')](respondWithFilteredResult(_0x5a5ffa,_0x233057))[_0x7907('0x40')](handleError(_0x5a5ffa,null));};exports['show']=function(_0x36b457,_0x15ce31){var _0x22dfe6={'raw':![],'where':{'id':_0x36b457[_0x7907('0x41')]['id']}},_0x3c71b3={};_0x3c71b3['model']=_[_0x7907('0x31')](db[_0x7907('0x29')][_0x7907('0x2a')]);_0x3c71b3[_0x7907('0x30')]=_[_0x7907('0x31')](_0x36b457['query']);_0x3c71b3[_0x7907('0x32')]=_['intersection'](_0x3c71b3['model'],_0x3c71b3[_0x7907('0x30')]);_0x22dfe6[_0x7907('0x34')]=_[_0x7907('0x33')](_0x3c71b3[_0x7907('0x2d')],qs[_0x7907('0x35')](_0x36b457[_0x7907('0x30')][_0x7907('0x35')]));_0x22dfe6[_0x7907('0x34')]=_0x22dfe6[_0x7907('0x34')][_0x7907('0x36')]?_0x22dfe6[_0x7907('0x34')]:_0x3c71b3[_0x7907('0x2d')];if(_0x36b457[_0x7907('0x30')][_0x7907('0x3d')]){_0x22dfe6[_0x7907('0x42')]=[{'all':!![]}];}_0x22dfe6=_[_0x7907('0x3b')]({},_0x22dfe6,_0x36b457[_0x7907('0x3c')]);return db[_0x7907('0x29')][_0x7907('0x43')](_0x22dfe6)[_0x7907('0x23')](handleEntityNotFound(_0x15ce31,null))[_0x7907('0x23')](respondWithResult(_0x15ce31,null))[_0x7907('0x40')](handleError(_0x15ce31,null));};exports[_0x7907('0x44')]=function(_0x1b44c5,_0x4b7130){return db['FreshdeskConfiguration']['create'](_0x1b44c5[_0x7907('0x45')],{})[_0x7907('0x23')](respondWithResult(_0x4b7130,0xc9))[_0x7907('0x40')](handleError(_0x4b7130,null));};exports[_0x7907('0x22')]=function(_0x4ca53a,_0x30c34a){if(_0x4ca53a[_0x7907('0x45')]['id']){delete _0x4ca53a[_0x7907('0x45')]['id'];}return db[_0x7907('0x29')][_0x7907('0x43')]({'where':{'id':_0x4ca53a[_0x7907('0x41')]['id']}})['then'](handleEntityNotFound(_0x30c34a,null))[_0x7907('0x23')](saveUpdates(_0x4ca53a[_0x7907('0x45')],null))[_0x7907('0x23')](respondWithResult(_0x30c34a,null))[_0x7907('0x40')](handleError(_0x30c34a,null));};exports[_0x7907('0x46')]=function(_0x370a87,_0x48ab6a){return db[_0x7907('0x29')][_0x7907('0x43')]({'where':{'id':_0x370a87['params']['id']}})[_0x7907('0x23')](handleEntityNotFound(_0x48ab6a,null))[_0x7907('0x23')](removeEntity(_0x48ab6a,null))[_0x7907('0x40')](handleError(_0x48ab6a,null));};exports[_0x7907('0x47')]=function(_0x23fd61,_0x407ec1,_0x19165b){var _0x4ed3c8={};var _0x9380f3={};var _0x51bbec;var _0x24908d;return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x23fd61[_0x7907('0x41')]['id']}})[_0x7907('0x23')](handleEntityNotFound(_0x407ec1,null))['then'](function(_0x54ef3a){if(_0x54ef3a){_0x51bbec=_0x54ef3a;_0x9380f3[_0x7907('0x2d')]=_[_0x7907('0x31')](db[_0x7907('0x48')]['rawAttributes']);_0x9380f3[_0x7907('0x30')]=_['keys'](_0x23fd61['query']);_0x9380f3['filters']=_['intersection'](_0x9380f3['model'],_0x9380f3[_0x7907('0x30')]);_0x4ed3c8[_0x7907('0x34')]=_['intersection'](_0x9380f3[_0x7907('0x2d')],qs['fields'](_0x23fd61['query'][_0x7907('0x35')]));_0x4ed3c8['attributes']=_0x4ed3c8['attributes'][_0x7907('0x36')]?_0x4ed3c8[_0x7907('0x34')]:_0x9380f3['model'];_0x4ed3c8[_0x7907('0x49')]=qs[_0x7907('0x38')](_0x23fd61['query'][_0x7907('0x38')]);_0x4ed3c8[_0x7907('0x39')]=qs[_0x7907('0x32')](_[_0x7907('0x4a')](_0x23fd61[_0x7907('0x30')],_0x9380f3[_0x7907('0x32')]));if(_0x23fd61[_0x7907('0x30')][_0x7907('0x3a')]){_0x4ed3c8[_0x7907('0x39')]=_[_0x7907('0x3b')](_0x4ed3c8[_0x7907('0x39')],{'$or':_[_0x7907('0x2e')](_0x4ed3c8[_0x7907('0x34')],function(_0x5730f0){var _0x11fb9a={};_0x11fb9a[_0x5730f0]={'$like':'%'+_0x23fd61['query'][_0x7907('0x3a')]+'%'};return _0x11fb9a;})});}_0x4ed3c8=_['merge']({},_0x4ed3c8,_0x23fd61[_0x7907('0x3c')]);return _0x51bbec[_0x7907('0x47')](_0x4ed3c8);}})[_0x7907('0x23')](function(_0x41ffff){if(_0x41ffff){_0x24908d=_0x41ffff[_0x7907('0x36')];if(!_0x23fd61[_0x7907('0x30')][_0x7907('0x4b')](_0x7907('0x37'))){_0x4ed3c8['limit']=qs[_0x7907('0x1c')](_0x23fd61['query'][_0x7907('0x1c')]);_0x4ed3c8[_0x7907('0x1a')]=qs[_0x7907('0x1a')](_0x23fd61['query']['offset']);}return _0x51bbec[_0x7907('0x47')](_0x4ed3c8);}})['then'](function(_0x111cfa){if(_0x111cfa){return _0x111cfa?{'count':_0x24908d,'rows':_0x111cfa}:null;}})[_0x7907('0x23')](respondWithResult(_0x407ec1,null))[_0x7907('0x40')](handleError(_0x407ec1,null));};exports[_0x7907('0x4c')]=function(_0x1b6756,_0x277cf9,_0x6d5929){var _0x40bfeb={};var _0xb2cb26={};var _0x3a5fcb;var _0x278f0c;return db[_0x7907('0x29')][_0x7907('0x4d')]({'where':{'id':_0x1b6756['params']['id']}})[_0x7907('0x23')](handleEntityNotFound(_0x277cf9,null))[_0x7907('0x23')](function(_0x22813a){if(_0x22813a){_0x3a5fcb=_0x22813a;_0xb2cb26[_0x7907('0x2d')]=_[_0x7907('0x31')](db[_0x7907('0x48')][_0x7907('0x2a')]);_0xb2cb26['query']=_[_0x7907('0x31')](_0x1b6756[_0x7907('0x30')]);_0xb2cb26[_0x7907('0x32')]=_[_0x7907('0x33')](_0xb2cb26[_0x7907('0x2d')],_0xb2cb26[_0x7907('0x30')]);_0x40bfeb['attributes']=_['intersection'](_0xb2cb26['model'],qs[_0x7907('0x35')](_0x1b6756[_0x7907('0x30')][_0x7907('0x35')]));_0x40bfeb['attributes']=_0x40bfeb[_0x7907('0x34')]['length']?_0x40bfeb[_0x7907('0x34')]:_0xb2cb26[_0x7907('0x2d')];_0x40bfeb['order']=qs['sort'](_0x1b6756[_0x7907('0x30')][_0x7907('0x38')]);_0x40bfeb[_0x7907('0x39')]=qs[_0x7907('0x32')](_[_0x7907('0x4a')](_0x1b6756[_0x7907('0x30')],_0xb2cb26[_0x7907('0x32')]));if(_0x1b6756[_0x7907('0x30')]['filter']){_0x40bfeb['where']=_['merge'](_0x40bfeb[_0x7907('0x39')],{'$or':_[_0x7907('0x2e')](_0x40bfeb['attributes'],function(_0x3caee8){var _0x3336a3={};_0x3336a3[_0x3caee8]={'$like':'%'+_0x1b6756[_0x7907('0x30')]['filter']+'%'};return _0x3336a3;})});}_0x40bfeb=_['merge']({},_0x40bfeb,_0x1b6756[_0x7907('0x3c')]);return _0x3a5fcb[_0x7907('0x4c')](_0x40bfeb);}})['then'](function(_0x5903d9){if(_0x5903d9){_0x278f0c=_0x5903d9['length'];if(!_0x1b6756[_0x7907('0x30')]['hasOwnProperty'](_0x7907('0x37'))){_0x40bfeb['limit']=qs['limit'](_0x1b6756[_0x7907('0x30')][_0x7907('0x1c')]);_0x40bfeb[_0x7907('0x1a')]=qs[_0x7907('0x1a')](_0x1b6756[_0x7907('0x30')][_0x7907('0x1a')]);}return _0x3a5fcb[_0x7907('0x4c')](_0x40bfeb);}})[_0x7907('0x23')](function(_0x8d417e){if(_0x8d417e){return _0x8d417e?{'count':_0x278f0c,'rows':_0x8d417e}:null;}})['then'](respondWithResult(_0x277cf9,null))[_0x7907('0x40')](handleError(_0x277cf9,null));};exports[_0x7907('0x4e')]=function(_0x17f32d,_0x44ba94,_0x288455){var _0x1ae1ec={};var _0x7e54b6={};var _0x2c0a89;var _0x2e6f83;return db['FreshdeskConfiguration'][_0x7907('0x4d')]({'where':{'id':_0x17f32d[_0x7907('0x41')]['id']}})[_0x7907('0x23')](handleEntityNotFound(_0x44ba94,null))[_0x7907('0x23')](function(_0x4a9c99){if(_0x4a9c99){_0x2c0a89=_0x4a9c99;_0x7e54b6[_0x7907('0x2d')]=_[_0x7907('0x31')](db[_0x7907('0x48')][_0x7907('0x2a')]);_0x7e54b6['query']=_[_0x7907('0x31')](_0x17f32d['query']);_0x7e54b6[_0x7907('0x32')]=_[_0x7907('0x33')](_0x7e54b6[_0x7907('0x2d')],_0x7e54b6['query']);_0x1ae1ec[_0x7907('0x34')]=_['intersection'](_0x7e54b6[_0x7907('0x2d')],qs[_0x7907('0x35')](_0x17f32d[_0x7907('0x30')][_0x7907('0x35')]));_0x1ae1ec[_0x7907('0x34')]=_0x1ae1ec['attributes'][_0x7907('0x36')]?_0x1ae1ec['attributes']:_0x7e54b6['model'];_0x1ae1ec['order']=qs['sort'](_0x17f32d[_0x7907('0x30')][_0x7907('0x38')]);_0x1ae1ec[_0x7907('0x39')]=qs[_0x7907('0x32')](_[_0x7907('0x4a')](_0x17f32d['query'],_0x7e54b6[_0x7907('0x32')]));if(_0x17f32d[_0x7907('0x30')][_0x7907('0x3a')]){_0x1ae1ec[_0x7907('0x39')]=_['merge'](_0x1ae1ec[_0x7907('0x39')],{'$or':_[_0x7907('0x2e')](_0x1ae1ec[_0x7907('0x34')],function(_0x2d87b9){var _0x1973b9={};_0x1973b9[_0x2d87b9]={'$like':'%'+_0x17f32d['query']['filter']+'%'};return _0x1973b9;})});}_0x1ae1ec=_[_0x7907('0x3b')]({},_0x1ae1ec,_0x17f32d[_0x7907('0x3c')]);return _0x2c0a89[_0x7907('0x4e')](_0x1ae1ec);}})['then'](function(_0x2da2f9){if(_0x2da2f9){_0x2e6f83=_0x2da2f9[_0x7907('0x36')];if(!_0x17f32d[_0x7907('0x30')][_0x7907('0x4b')]('nolimit')){_0x1ae1ec['limit']=qs[_0x7907('0x1c')](_0x17f32d['query']['limit']);_0x1ae1ec[_0x7907('0x1a')]=qs[_0x7907('0x1a')](_0x17f32d[_0x7907('0x30')][_0x7907('0x1a')]);}return _0x2c0a89[_0x7907('0x4e')](_0x1ae1ec);}})[_0x7907('0x23')](function(_0x124de4){if(_0x124de4){return _0x124de4?{'count':_0x2e6f83,'rows':_0x124de4}:null;}})[_0x7907('0x23')](respondWithResult(_0x44ba94,null))[_0x7907('0x40')](handleError(_0x44ba94,null));};exports[_0x7907('0x4f')]=function(_0x4d2567,_0x2349a6,_0x4a70d0){var _0x835b35={};var _0x579db9={};var _0x26b511;var _0xeb7e76;return db[_0x7907('0x29')][_0x7907('0x4d')]({'where':{'id':_0x4d2567[_0x7907('0x41')]['id']}})[_0x7907('0x23')](handleEntityNotFound(_0x2349a6,null))[_0x7907('0x23')](function(_0x5351eb){if(_0x5351eb){_0x26b511=_0x5351eb;_0x579db9[_0x7907('0x2d')]=_[_0x7907('0x31')](db['Tag'][_0x7907('0x2a')]);_0x579db9[_0x7907('0x30')]=_[_0x7907('0x31')](_0x4d2567[_0x7907('0x30')]);_0x579db9[_0x7907('0x32')]=_[_0x7907('0x33')](_0x579db9[_0x7907('0x2d')],_0x579db9[_0x7907('0x30')]);_0x835b35[_0x7907('0x34')]=_[_0x7907('0x33')](_0x579db9[_0x7907('0x2d')],qs[_0x7907('0x35')](_0x4d2567[_0x7907('0x30')][_0x7907('0x35')]));_0x835b35[_0x7907('0x34')]=_0x835b35[_0x7907('0x34')][_0x7907('0x36')]?_0x835b35['attributes']:_0x579db9[_0x7907('0x2d')];_0x835b35[_0x7907('0x49')]=qs[_0x7907('0x38')](_0x4d2567[_0x7907('0x30')][_0x7907('0x38')]);_0x835b35[_0x7907('0x39')]=qs[_0x7907('0x32')](_[_0x7907('0x4a')](_0x4d2567[_0x7907('0x30')],_0x579db9[_0x7907('0x32')]));if(_0x4d2567['query'][_0x7907('0x3a')]){_0x835b35[_0x7907('0x39')]=_[_0x7907('0x3b')](_0x835b35[_0x7907('0x39')],{'$or':_['map'](_0x835b35[_0x7907('0x34')],function(_0x4ba2f5){var _0x2275ca={};_0x2275ca[_0x4ba2f5]={'$like':'%'+_0x4d2567[_0x7907('0x30')]['filter']+'%'};return _0x2275ca;})});}_0x835b35=_[_0x7907('0x3b')]({},_0x835b35,_0x4d2567[_0x7907('0x3c')]);return _0x26b511[_0x7907('0x4f')](_0x835b35);}})['then'](function(_0x46a136){if(_0x46a136){_0xeb7e76=_0x46a136[_0x7907('0x36')];if(!_0x4d2567[_0x7907('0x30')][_0x7907('0x4b')](_0x7907('0x37'))){_0x835b35[_0x7907('0x1c')]=qs[_0x7907('0x1c')](_0x4d2567[_0x7907('0x30')][_0x7907('0x1c')]);_0x835b35[_0x7907('0x1a')]=qs[_0x7907('0x1a')](_0x4d2567[_0x7907('0x30')]['offset']);}return _0x26b511[_0x7907('0x4f')](_0x835b35);}})[_0x7907('0x23')](function(_0x2a67e9){if(_0x2a67e9){return _0x2a67e9?{'count':_0xeb7e76,'rows':_0x2a67e9}:null;}})[_0x7907('0x23')](respondWithResult(_0x2349a6,null))[_0x7907('0x40')](handleError(_0x2349a6,null));};exports[_0x7907('0x50')]=function(_0x39d1f1,_0x4edd13,_0x158255){if(_0x39d1f1[_0x7907('0x45')]['id']){delete _0x39d1f1[_0x7907('0x45')]['id'];}return db[_0x7907('0x29')][_0x7907('0x4d')]({'where':{'id':_0x39d1f1['params']['id']}})[_0x7907('0x23')](handleEntityNotFound(_0x4edd13,null))['then'](function(_0x12ef8a){if(_0x12ef8a){return _0x12ef8a[_0x7907('0x50')](_0x39d1f1[_0x7907('0x45')][_0x7907('0x51')]||[]);}return null;})['then'](respondWithResult(_0x4edd13,null))[_0x7907('0x40')](handleError(_0x4edd13,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 98b1f84..ccfedab 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 _0x1c1d=['api','bluebird','request-promise','path','../../config/environment','define','FreshdeskConfiguration','lodash','util','../../config/logger'];(function(_0x27beea,_0x3bc9f4){var _0x122645=function(_0x2c848){while(--_0x2c848){_0x27beea['push'](_0x27beea['shift']());}};_0x122645(++_0x3bc9f4);}(_0x1c1d,0x13d));var _0xd1c1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1c1d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd1c1('0x0'));var util=require(_0xd1c1('0x1'));var logger=require(_0xd1c1('0x2'))(_0xd1c1('0x3'));var moment=require('moment');var BPromise=require(_0xd1c1('0x4'));var rp=require(_0xd1c1('0x5'));var fs=require('fs');var path=require(_0xd1c1('0x6'));var rimraf=require('rimraf');var config=require(_0xd1c1('0x7'));var attributes=require('./intFreshdeskConfiguration.attributes');module['exports']=function(_0x4d5e32,_0x56b0b0){return _0x4d5e32[_0xd1c1('0x8')](_0xd1c1('0x9'),attributes,{'tableName':'int_freshdesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc862=['exports','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','util','../../config/logger','moment','request-promise','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes'];(function(_0x3f8aa6,_0x5ab4d6){var _0x25da45=function(_0x4bc4d6){while(--_0x4bc4d6){_0x3f8aa6['push'](_0x3f8aa6['shift']());}};_0x25da45(++_0x5ab4d6);}(_0xc862,0xd0));var _0x2c86=function(_0x405a4a,_0x36acf4){_0x405a4a=_0x405a4a-0x0;var _0x58b0de=_0xc862[_0x405a4a];return _0x58b0de;};'use strict';var _=require(_0x2c86('0x0'));var util=require(_0x2c86('0x1'));var logger=require(_0x2c86('0x2'))('api');var moment=require(_0x2c86('0x3'));var BPromise=require('bluebird');var rp=require(_0x2c86('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2c86('0x5'));var config=require(_0x2c86('0x6'));var attributes=require(_0x2c86('0x7'));module[_0x2c86('0x8')]=function(_0x59f1f2,_0x173530){return _0x59f1f2[_0x2c86('0x9')](_0x2c86('0xa'),attributes,{'tableName':_0x2c86('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js index ba7fb20..65903db 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 _0x857f=['error','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','client','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','message'];(function(_0xada87a,_0x16223c){var _0x7ad44c=function(_0x341535){while(--_0x341535){_0xada87a['push'](_0xada87a['shift']());}};_0x7ad44c(++_0x16223c);}(_0x857f,0xad));var _0xf857=function(_0xf7ee71,_0x786ff4){_0xf7ee71=_0xf7ee71-0x0;var _0x2341d3=_0x857f[_0xf7ee71];return _0x2341d3;};'use strict';var _=require(_0xf857('0x0'));var util=require(_0xf857('0x1'));var moment=require(_0xf857('0x2'));var BPromise=require(_0xf857('0x3'));var rs=require(_0xf857('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf857('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf857('0x6'))(_0xf857('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf857('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e1ce1,_0x5d5498,_0x341092){return new BPromise(function(_0x5602fb,_0x46fe97){return client[_0xf857('0x9')](_0x4e1ce1,_0x341092)[_0xf857('0xa')](function(_0x2c754c){logger[_0xf857('0xb')](_0xf857('0xc'),_0x5d5498,_0xf857('0xd'));logger[_0xf857('0xe')](_0xf857('0xf'),_0x5d5498,_0xf857('0xd'),JSON['stringify'](_0x2c754c));if(_0x2c754c['error']){if(_0x2c754c['error']['code']===0x1f4){logger['error'](_0xf857('0xc'),_0x5d5498,_0x2c754c['error'][_0xf857('0x10')]);return _0x46fe97(_0x2c754c[_0xf857('0x11')][_0xf857('0x10')]);}logger[_0xf857('0x11')](_0xf857('0xc'),_0x5d5498,_0x2c754c[_0xf857('0x11')]['message']);return _0x5602fb(_0x2c754c[_0xf857('0x11')][_0xf857('0x10')]);}else{logger[_0xf857('0xb')](_0xf857('0xc'),_0x5d5498,_0xf857('0xd'));_0x5602fb(_0x2c754c['result'][_0xf857('0x10')]);}})[_0xf857('0x12')](function(_0xfd003e){logger[_0xf857('0x11')](_0xf857('0xc'),_0x5d5498,_0xfd003e);_0x46fe97(_0xfd003e);});});} \ No newline at end of file +var _0x9ef4=['http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x2ab977,_0x5cc91e){var _0x12de0=function(_0x554636){while(--_0x554636){_0x2ab977['push'](_0x2ab977['shift']());}};_0x12de0(++_0x5cc91e);}(_0x9ef4,0xc4));var _0x49ef=function(_0x447f5a,_0x122b09){_0x447f5a=_0x447f5a-0x0;var _0x571867=_0x9ef4[_0x447f5a];return _0x571867;};'use strict';var _=require(_0x49ef('0x0'));var util=require(_0x49ef('0x1'));var moment=require(_0x49ef('0x2'));var BPromise=require(_0x49ef('0x3'));var rs=require(_0x49ef('0x4'));var fs=require('fs');var Redis=require(_0x49ef('0x5'));var db=require(_0x49ef('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x49ef('0x7'))(_0x49ef('0x8'));var config=require(_0x49ef('0x9'));var jayson=require(_0x49ef('0xa'));var client=jayson[_0x49ef('0xb')][_0x49ef('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5a0feb,_0x49822d,_0xb26c82){return new BPromise(function(_0x5b854c,_0x5aecf0){return client[_0x49ef('0xd')](_0x5a0feb,_0xb26c82)[_0x49ef('0xe')](function(_0x17f8d6){logger[_0x49ef('0xf')](_0x49ef('0x10'),_0x49822d,_0x49ef('0x11'));logger[_0x49ef('0x12')](_0x49ef('0x13'),_0x49822d,_0x49ef('0x11'),JSON[_0x49ef('0x14')](_0x17f8d6));if(_0x17f8d6[_0x49ef('0x15')]){if(_0x17f8d6['error'][_0x49ef('0x16')]===0x1f4){logger[_0x49ef('0x15')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x49822d,_0x17f8d6['error'][_0x49ef('0x17')]);return _0x5aecf0(_0x17f8d6[_0x49ef('0x15')][_0x49ef('0x17')]);}logger[_0x49ef('0x15')](_0x49ef('0x10'),_0x49822d,_0x17f8d6['error']['message']);return _0x5b854c(_0x17f8d6['error'][_0x49ef('0x17')]);}else{logger['info'](_0x49ef('0x10'),_0x49822d,_0x49ef('0x11'));_0x5b854c(_0x17f8d6[_0x49ef('0x18')][_0x49ef('0x17')]);}})[_0x49ef('0x19')](function(_0x4894da){logger[_0x49ef('0x15')](_0x49ef('0x10'),_0x49822d,_0x4894da);_0x5aecf0(_0x4894da);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 796608f..6c7e604 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 _0xf744=['update','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','isAuthenticated','/:id','show','post','create','put'];(function(_0x49192,_0x2fc6fb){var _0x57d8e8=function(_0xc4ed8d){while(--_0xc4ed8d){_0x49192['push'](_0x49192['shift']());}};_0x57d8e8(++_0x2fc6fb);}(_0xf744,0x1a5));var _0x4f74=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xf744[_0x3e5086];return _0xfeb102;};'use strict';var multer=require(_0x4f74('0x0'));var util=require(_0x4f74('0x1'));var path=require(_0x4f74('0x2'));var timeout=require(_0x4f74('0x3'));var express=require(_0x4f74('0x4'));var router=express['Router']();var fs_extra=require(_0x4f74('0x5'));var auth=require(_0x4f74('0x6'));var interaction=require(_0x4f74('0x7'));var config=require(_0x4f74('0x8'));var controller=require(_0x4f74('0x9'));router['get']('/',auth[_0x4f74('0xa')](),controller['index']);router['get'](_0x4f74('0xb'),auth['isAuthenticated'](),controller[_0x4f74('0xc')]);router[_0x4f74('0xd')]('/',auth[_0x4f74('0xa')](),controller[_0x4f74('0xe')]);router[_0x4f74('0xf')](_0x4f74('0xb'),auth['isAuthenticated'](),controller[_0x4f74('0x10')]);router[_0x4f74('0x11')]('/:id',auth[_0x4f74('0xa')](),controller[_0x4f74('0x12')]);module['exports']=router; \ No newline at end of file +var _0x55fa=['delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','put'];(function(_0x1a36a5,_0x746928){var _0x746243=function(_0x481966){while(--_0x481966){_0x1a36a5['push'](_0x1a36a5['shift']());}};_0x746243(++_0x746928);}(_0x55fa,0xff));var _0xa55f=function(_0x46de85,_0x24f65c){_0x46de85=_0x46de85-0x0;var _0x4055c9=_0x55fa[_0x46de85];return _0x4055c9;};'use strict';var multer=require(_0xa55f('0x0'));var util=require('util');var path=require(_0xa55f('0x1'));var timeout=require(_0xa55f('0x2'));var express=require(_0xa55f('0x3'));var router=express['Router']();var fs_extra=require(_0xa55f('0x4'));var auth=require(_0xa55f('0x5'));var interaction=require(_0xa55f('0x6'));var config=require(_0xa55f('0x7'));var controller=require('./intFreshdeskField.controller');router[_0xa55f('0x8')]('/',auth[_0xa55f('0x9')](),controller[_0xa55f('0xa')]);router[_0xa55f('0x8')](_0xa55f('0xb'),auth[_0xa55f('0x9')](),controller[_0xa55f('0xc')]);router[_0xa55f('0xd')]('/',auth[_0xa55f('0x9')](),controller['create']);router[_0xa55f('0xe')]('/:id',auth[_0xa55f('0x9')](),controller['update']);router[_0xa55f('0xf')](_0xa55f('0xb'),auth[_0xa55f('0x9')](),controller[_0xa55f('0x10')]);module[_0xa55f('0x11')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index d946e63..bdd0567 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 _0xf277=['picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','keyValue'];(function(_0xb3cc02,_0x21f195){var _0x1fe499=function(_0x2891f4){while(--_0x2891f4){_0xb3cc02['push'](_0xb3cc02['shift']());}};_0x1fe499(++_0x21f195);}(_0xf277,0xe9));var _0x7f27=function(_0x4c094e,_0x5c790f){_0x4c094e=_0x4c094e-0x0;var _0x13a283=_0xf277[_0x4c094e];return _0x13a283;};'use strict';var Sequelize=require(_0x7f27('0x0'));module[_0x7f27('0x1')]={'type':{'type':Sequelize[_0x7f27('0x2')](_0x7f27('0x3'),_0x7f27('0x4'),_0x7f27('0x5'),_0x7f27('0x6'),_0x7f27('0x7')),'defaultValue':_0x7f27('0x3')},'content':{'type':Sequelize[_0x7f27('0x8')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x7f27('0x2')](_0x7f27('0x3'),_0x7f27('0x4'),_0x7f27('0x5'))},'keyContent':{'type':Sequelize[_0x7f27('0x8')]},'idField':{'type':Sequelize[_0x7f27('0x8')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x7f27('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7f27('0x8')]}}; \ No newline at end of file +var _0x1d5e=['string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','exports','ENUM'];(function(_0x3e0b47,_0x34334f){var _0x2683f0=function(_0x31fe38){while(--_0x31fe38){_0x3e0b47['push'](_0x3e0b47['shift']());}};_0x2683f0(++_0x34334f);}(_0x1d5e,0xc4));var _0xe1d5=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x1d5e[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module[_0xe1d5('0x0')]={'type':{'type':Sequelize[_0xe1d5('0x1')](_0xe1d5('0x2'),_0xe1d5('0x3'),_0xe1d5('0x4'),_0xe1d5('0x5'),_0xe1d5('0x6')),'defaultValue':_0xe1d5('0x2')},'content':{'type':Sequelize[_0xe1d5('0x7')]},'key':{'type':Sequelize[_0xe1d5('0x7')]},'keyType':{'type':Sequelize[_0xe1d5('0x1')](_0xe1d5('0x2'),_0xe1d5('0x3'),_0xe1d5('0x4'))},'keyContent':{'type':Sequelize[_0xe1d5('0x7')]},'idField':{'type':Sequelize[_0xe1d5('0x7')]},'nameField':{'type':Sequelize[_0xe1d5('0x7')]},'customField':{'type':Sequelize[_0xe1d5('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe1d5('0x7')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index cc3bca7..88d0d9a 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 _0x7d98=['pick','filter','merge','where','include','FreshdeskField','findAll','rows','show','rawAttributes','create','body','catch','find','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','Content-Range','json','reject','save','update','then','destroy','error','name','send','fieldName','key','map','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort'];(function(_0x1ddedd,_0x485606){var _0xa3e1ac=function(_0x580444){while(--_0x580444){_0x1ddedd['push'](_0x1ddedd['shift']());}};_0xa3e1ac(++_0x485606);}(_0x7d98,0xe7));var _0x87d9=function(_0x39cf70,_0x3ec55b){_0x39cf70=_0x39cf70-0x0;var _0x580424=_0x7d98[_0x39cf70];return _0x580424;};'use strict';var emlformat=require(_0x87d9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x87d9('0x1'));var jsonpatch=require(_0x87d9('0x2'));var rp=require(_0x87d9('0x3'));var moment=require(_0x87d9('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x87d9('0x5'));var util=require(_0x87d9('0x6'));var path=require('path');var sox=require(_0x87d9('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x87d9('0x8'));var squel=require(_0x87d9('0x9'));var crypto=require(_0x87d9('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x87d9('0xb'));var toCsv=require(_0x87d9('0xc'));var querystring=require(_0x87d9('0xd'));var Papa=require('papaparse');var Redis=require(_0x87d9('0xe'));var authService=require(_0x87d9('0xf'));var qs=require(_0x87d9('0x10'));var as=require(_0x87d9('0x11'));var hardwareService=require(_0x87d9('0x12'));var logger=require(_0x87d9('0x13'))(_0x87d9('0x14'));var utils=require(_0x87d9('0x15'));var config=require(_0x87d9('0x16'));var licenseUtil=require(_0x87d9('0x17'));var db=require(_0x87d9('0x18'))['db'];function respondWithStatusCode(_0x22f32d,_0x38f33e){_0x38f33e=_0x38f33e||0xcc;return function(_0x22758){if(_0x22758){return _0x22f32d[_0x87d9('0x19')](_0x38f33e);}return _0x22f32d[_0x87d9('0x1a')](_0x38f33e)[_0x87d9('0x1b')]();};}function respondWithResult(_0x185401,_0x380836){_0x380836=_0x380836||0xc8;return function(_0x27d61d){if(_0x27d61d){return _0x185401['status'](_0x380836)['json'](_0x27d61d);}};}function respondWithFilteredResult(_0x9e9e53,_0xaa910c){return function(_0x3231e7){if(_0x3231e7){var _0x501d32=typeof _0xaa910c['offset']===_0x87d9('0x1c')&&typeof _0xaa910c[_0x87d9('0x1d')]===_0x87d9('0x1c');var _0x23ae47=_0x3231e7[_0x87d9('0x1e')];var _0xebc1eb=_0x501d32?0x0:_0xaa910c[_0x87d9('0x1f')];var _0x1f33a3=_0x501d32?_0x3231e7[_0x87d9('0x1e')]:_0xaa910c[_0x87d9('0x1f')]+_0xaa910c[_0x87d9('0x1d')];var _0x5d6da1;if(_0x1f33a3>=_0x23ae47){_0x1f33a3=_0x23ae47;_0x5d6da1=0xc8;}else{_0x5d6da1=0xce;}_0x9e9e53[_0x87d9('0x1a')](_0x5d6da1);return _0x9e9e53['set'](_0x87d9('0x20'),_0xebc1eb+'-'+_0x1f33a3+'/'+_0x23ae47)[_0x87d9('0x21')](_0x3231e7);}return null;};}function patchUpdates(_0x334d31){return function(_0x57bef6){try{jsonpatch['apply'](_0x57bef6,_0x334d31,!![]);}catch(_0x545241){return BPromise[_0x87d9('0x22')](_0x545241);}return _0x57bef6[_0x87d9('0x23')]();};}function saveUpdates(_0x28aaaa,_0x6ab839){return function(_0xc82b02){if(_0xc82b02){return _0xc82b02[_0x87d9('0x24')](_0x28aaaa)[_0x87d9('0x25')](function(_0x3b24e7){return _0x3b24e7;});}return null;};}function removeEntity(_0x1c550c,_0x4c0f7a){return function(_0x31e1b2){if(_0x31e1b2){return _0x31e1b2[_0x87d9('0x26')]()[_0x87d9('0x25')](function(){_0x1c550c[_0x87d9('0x1a')](0xcc)[_0x87d9('0x1b')]();});}};}function handleEntityNotFound(_0x340462,_0x3641c8){return function(_0x32b83f){if(!_0x32b83f){_0x340462['sendStatus'](0x194);}return _0x32b83f;};}function handleError(_0x8b1ab7,_0x600404){_0x600404=_0x600404||0x1f4;return function(_0x2f63fa){logger[_0x87d9('0x27')](_0x2f63fa['stack']);if(_0x2f63fa[_0x87d9('0x28')]){delete _0x2f63fa[_0x87d9('0x28')];}_0x8b1ab7[_0x87d9('0x1a')](_0x600404)[_0x87d9('0x29')](_0x2f63fa);};}exports['index']=function(_0x21916a,_0x3c0283){var _0x501c5={},_0x5e1b55={},_0x1d04a9={'count':0x0,'rows':[]};var _0x22a401=_['map'](db['FreshdeskField']['rawAttributes'],function(_0x31122b){return{'name':_0x31122b[_0x87d9('0x2a')],'type':_0x31122b['type'][_0x87d9('0x2b')]};});_0x5e1b55['model']=_[_0x87d9('0x2c')](_0x22a401,'name');_0x5e1b55[_0x87d9('0x2d')]=_[_0x87d9('0x2e')](_0x21916a['query']);_0x5e1b55[_0x87d9('0x2f')]=_['intersection'](_0x5e1b55[_0x87d9('0x30')],_0x5e1b55[_0x87d9('0x2d')]);_0x501c5[_0x87d9('0x31')]=_[_0x87d9('0x32')](_0x5e1b55[_0x87d9('0x30')],qs[_0x87d9('0x33')](_0x21916a['query'][_0x87d9('0x33')]));_0x501c5[_0x87d9('0x31')]=_0x501c5[_0x87d9('0x31')][_0x87d9('0x34')]?_0x501c5[_0x87d9('0x31')]:_0x5e1b55[_0x87d9('0x30')];if(!_0x21916a[_0x87d9('0x2d')][_0x87d9('0x35')](_0x87d9('0x36'))){_0x501c5['limit']=qs[_0x87d9('0x1d')](_0x21916a[_0x87d9('0x2d')][_0x87d9('0x1d')]);_0x501c5[_0x87d9('0x1f')]=qs[_0x87d9('0x1f')](_0x21916a['query'][_0x87d9('0x1f')]);}_0x501c5[_0x87d9('0x37')]=qs[_0x87d9('0x38')](_0x21916a['query'][_0x87d9('0x38')]);_0x501c5['where']=qs[_0x87d9('0x2f')](_[_0x87d9('0x39')](_0x21916a[_0x87d9('0x2d')],_0x5e1b55[_0x87d9('0x2f')]),_0x22a401);if(_0x21916a['query'][_0x87d9('0x3a')]){_0x501c5['where']=_[_0x87d9('0x3b')](_0x501c5[_0x87d9('0x3c')],{'$or':_[_0x87d9('0x2c')](_0x22a401,function(_0x1af8eb){if(_0x1af8eb['type']!=='VIRTUAL'){var _0x2063de={};_0x2063de[_0x1af8eb['name']]={'$like':'%'+_0x21916a[_0x87d9('0x2d')]['filter']+'%'};return _0x2063de;}})});}_0x501c5=_[_0x87d9('0x3b')]({},_0x501c5,_0x21916a['options']);var _0xdf56e8={'where':_0x501c5[_0x87d9('0x3c')]};return db['FreshdeskField'][_0x87d9('0x1e')](_0xdf56e8)['then'](function(_0x4bc1ba){_0x1d04a9['count']=_0x4bc1ba;if(_0x21916a[_0x87d9('0x2d')]['includeAll']){_0x501c5[_0x87d9('0x3d')]=[{'all':!![]}];}return db[_0x87d9('0x3e')][_0x87d9('0x3f')](_0x501c5);})['then'](function(_0x915f05){_0x1d04a9[_0x87d9('0x40')]=_0x915f05;return _0x1d04a9;})[_0x87d9('0x25')](respondWithFilteredResult(_0x3c0283,_0x501c5))['catch'](handleError(_0x3c0283,null));};exports[_0x87d9('0x41')]=function(_0x58ec85,_0x5c2db5){var _0x59338e={'raw':!![],'where':{'id':_0x58ec85['params']['id']}},_0x39e807={};_0x39e807['model']=_[_0x87d9('0x2e')](db[_0x87d9('0x3e')][_0x87d9('0x42')]);_0x39e807[_0x87d9('0x2d')]=_[_0x87d9('0x2e')](_0x58ec85['query']);_0x39e807[_0x87d9('0x2f')]=_[_0x87d9('0x32')](_0x39e807['model'],_0x39e807['query']);_0x59338e[_0x87d9('0x31')]=_[_0x87d9('0x32')](_0x39e807[_0x87d9('0x30')],qs[_0x87d9('0x33')](_0x58ec85[_0x87d9('0x2d')][_0x87d9('0x33')]));_0x59338e[_0x87d9('0x31')]=_0x59338e[_0x87d9('0x31')]['length']?_0x59338e[_0x87d9('0x31')]:_0x39e807[_0x87d9('0x30')];if(_0x58ec85['query']['includeAll']){_0x59338e[_0x87d9('0x3d')]=[{'all':!![]}];}_0x59338e=_[_0x87d9('0x3b')]({},_0x59338e,_0x58ec85['options']);return db[_0x87d9('0x3e')]['find'](_0x59338e)['then'](handleEntityNotFound(_0x5c2db5,null))['then'](respondWithResult(_0x5c2db5,null))['catch'](handleError(_0x5c2db5,null));};exports[_0x87d9('0x43')]=function(_0x101446,_0x533a74){return db[_0x87d9('0x3e')][_0x87d9('0x43')](_0x101446[_0x87d9('0x44')],{})['then'](respondWithResult(_0x533a74,0xc9))[_0x87d9('0x45')](handleError(_0x533a74,null));};exports[_0x87d9('0x24')]=function(_0x2d4766,_0x384273){if(_0x2d4766[_0x87d9('0x44')]['id']){delete _0x2d4766[_0x87d9('0x44')]['id'];}return db['FreshdeskField'][_0x87d9('0x46')]({'where':{'id':_0x2d4766['params']['id']}})['then'](handleEntityNotFound(_0x384273,null))[_0x87d9('0x25')](saveUpdates(_0x2d4766[_0x87d9('0x44')],null))[_0x87d9('0x25')](respondWithResult(_0x384273,null))[_0x87d9('0x45')](handleError(_0x384273,null));};exports[_0x87d9('0x26')]=function(_0x4fdfa9,_0x4558f5){return db[_0x87d9('0x3e')][_0x87d9('0x46')]({'where':{'id':_0x4fdfa9[_0x87d9('0x47')]['id']}})['then'](handleEntityNotFound(_0x4558f5,null))[_0x87d9('0x25')](removeEntity(_0x4558f5,null))[_0x87d9('0x45')](handleError(_0x4558f5,null));}; \ No newline at end of file +var _0xc36d=['desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','status','end','json','limit','undefined','count','offset','Content-Range','apply','save','update','then','destroy','stack','name','send','index','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','options','includeAll','include','rows','catch','show','params','FreshdeskField','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce'];(function(_0x284b43,_0x5212d6){var _0x1550cd=function(_0x11620a){while(--_0x11620a){_0x284b43['push'](_0x284b43['shift']());}};_0x1550cd(++_0x5212d6);}(_0xc36d,0x7d));var _0xdc36=function(_0x53b199,_0x38ff21){_0x53b199=_0x53b199-0x0;var _0x1ba42d=_0xc36d[_0x53b199];return _0x1ba42d;};'use strict';var emlformat=require(_0xdc36('0x0'));var rimraf=require(_0xdc36('0x1'));var zipdir=require(_0xdc36('0x2'));var jsonpatch=require(_0xdc36('0x3'));var rp=require(_0xdc36('0x4'));var moment=require(_0xdc36('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xdc36('0x6'));var util=require(_0xdc36('0x7'));var path=require('path');var sox=require(_0xdc36('0x8'));var csv=require(_0xdc36('0x9'));var ejs=require(_0xdc36('0xa'));var fs=require('fs');var fs_extra=require(_0xdc36('0xb'));var _=require(_0xdc36('0xc'));var squel=require('squel');var crypto=require(_0xdc36('0xd'));var jsforce=require(_0xdc36('0xe'));var deskjs=require(_0xdc36('0xf'));var toCsv=require(_0xdc36('0x9'));var querystring=require('querystring');var Papa=require(_0xdc36('0x10'));var Redis=require(_0xdc36('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xdc36('0x12'));var as=require(_0xdc36('0x13'));var hardwareService=require(_0xdc36('0x14'));var logger=require('../../config/logger')(_0xdc36('0x15'));var utils=require(_0xdc36('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xdc36('0x17'))['db'];function respondWithStatusCode(_0x276692,_0x519fa5){_0x519fa5=_0x519fa5||0xcc;return function(_0x5d62ee){if(_0x5d62ee){return _0x276692['sendStatus'](_0x519fa5);}return _0x276692[_0xdc36('0x18')](_0x519fa5)[_0xdc36('0x19')]();};}function respondWithResult(_0x243d54,_0xae6ad3){_0xae6ad3=_0xae6ad3||0xc8;return function(_0x30803d){if(_0x30803d){return _0x243d54[_0xdc36('0x18')](_0xae6ad3)[_0xdc36('0x1a')](_0x30803d);}};}function respondWithFilteredResult(_0x809cf0,_0x57ebde){return function(_0x155cce){if(_0x155cce){var _0x526ac8=typeof _0x57ebde['offset']==='undefined'&&typeof _0x57ebde[_0xdc36('0x1b')]===_0xdc36('0x1c');var _0x5a498f=_0x155cce[_0xdc36('0x1d')];var _0x219a73=_0x526ac8?0x0:_0x57ebde[_0xdc36('0x1e')];var _0x225878=_0x526ac8?_0x155cce[_0xdc36('0x1d')]:_0x57ebde[_0xdc36('0x1e')]+_0x57ebde['limit'];var _0x3d4c4c;if(_0x225878>=_0x5a498f){_0x225878=_0x5a498f;_0x3d4c4c=0xc8;}else{_0x3d4c4c=0xce;}_0x809cf0[_0xdc36('0x18')](_0x3d4c4c);return _0x809cf0['set'](_0xdc36('0x1f'),_0x219a73+'-'+_0x225878+'/'+_0x5a498f)[_0xdc36('0x1a')](_0x155cce);}return null;};}function patchUpdates(_0x3f25f0){return function(_0x5f15ef){try{jsonpatch[_0xdc36('0x20')](_0x5f15ef,_0x3f25f0,!![]);}catch(_0x235a39){return BPromise['reject'](_0x235a39);}return _0x5f15ef[_0xdc36('0x21')]();};}function saveUpdates(_0x480277,_0x5a6e35){return function(_0x12f9d8){if(_0x12f9d8){return _0x12f9d8[_0xdc36('0x22')](_0x480277)[_0xdc36('0x23')](function(_0xda916b){return _0xda916b;});}return null;};}function removeEntity(_0x2d83c0,_0x34d261){return function(_0x14b595){if(_0x14b595){return _0x14b595[_0xdc36('0x24')]()['then'](function(){_0x2d83c0[_0xdc36('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2338d7,_0x38bd73){return function(_0x15e686){if(!_0x15e686){_0x2338d7['sendStatus'](0x194);}return _0x15e686;};}function handleError(_0xbc4322,_0x6e3906){_0x6e3906=_0x6e3906||0x1f4;return function(_0x337091){logger['error'](_0x337091[_0xdc36('0x25')]);if(_0x337091[_0xdc36('0x26')]){delete _0x337091[_0xdc36('0x26')];}_0xbc4322['status'](_0x6e3906)[_0xdc36('0x27')](_0x337091);};}exports[_0xdc36('0x28')]=function(_0x4b15b4,_0x3fe57f){var _0x12fed2={},_0x4ea2ad={},_0x21151b={'count':0x0,'rows':[]};var _0x5bba0b=_['map'](db['FreshdeskField'][_0xdc36('0x29')],function(_0x2f2bb4){return{'name':_0x2f2bb4['fieldName'],'type':_0x2f2bb4[_0xdc36('0x2a')][_0xdc36('0x2b')]};});_0x4ea2ad[_0xdc36('0x2c')]=_['map'](_0x5bba0b,_0xdc36('0x26'));_0x4ea2ad[_0xdc36('0x2d')]=_[_0xdc36('0x2e')](_0x4b15b4[_0xdc36('0x2d')]);_0x4ea2ad[_0xdc36('0x2f')]=_[_0xdc36('0x30')](_0x4ea2ad[_0xdc36('0x2c')],_0x4ea2ad['query']);_0x12fed2[_0xdc36('0x31')]=_[_0xdc36('0x30')](_0x4ea2ad['model'],qs['fields'](_0x4b15b4[_0xdc36('0x2d')][_0xdc36('0x32')]));_0x12fed2[_0xdc36('0x31')]=_0x12fed2['attributes']['length']?_0x12fed2[_0xdc36('0x31')]:_0x4ea2ad[_0xdc36('0x2c')];if(!_0x4b15b4[_0xdc36('0x2d')][_0xdc36('0x33')](_0xdc36('0x34'))){_0x12fed2[_0xdc36('0x1b')]=qs[_0xdc36('0x1b')](_0x4b15b4[_0xdc36('0x2d')][_0xdc36('0x1b')]);_0x12fed2[_0xdc36('0x1e')]=qs[_0xdc36('0x1e')](_0x4b15b4['query'][_0xdc36('0x1e')]);}_0x12fed2[_0xdc36('0x35')]=qs[_0xdc36('0x36')](_0x4b15b4[_0xdc36('0x2d')]['sort']);_0x12fed2[_0xdc36('0x37')]=qs[_0xdc36('0x2f')](_[_0xdc36('0x38')](_0x4b15b4[_0xdc36('0x2d')],_0x4ea2ad['filters']),_0x5bba0b);if(_0x4b15b4[_0xdc36('0x2d')]['filter']){_0x12fed2['where']=_[_0xdc36('0x39')](_0x12fed2[_0xdc36('0x37')],{'$or':_[_0xdc36('0x3a')](_0x5bba0b,function(_0x54c45d){if(_0x54c45d[_0xdc36('0x2a')]!=='VIRTUAL'){var _0x45760b={};_0x45760b[_0x54c45d[_0xdc36('0x26')]]={'$like':'%'+_0x4b15b4[_0xdc36('0x2d')]['filter']+'%'};return _0x45760b;}})});}_0x12fed2=_[_0xdc36('0x39')]({},_0x12fed2,_0x4b15b4[_0xdc36('0x3b')]);var _0xd98d42={'where':_0x12fed2[_0xdc36('0x37')]};return db['FreshdeskField'][_0xdc36('0x1d')](_0xd98d42)[_0xdc36('0x23')](function(_0x68816d){_0x21151b['count']=_0x68816d;if(_0x4b15b4['query'][_0xdc36('0x3c')]){_0x12fed2[_0xdc36('0x3d')]=[{'all':!![]}];}return db['FreshdeskField']['findAll'](_0x12fed2);})[_0xdc36('0x23')](function(_0x8f4c80){_0x21151b[_0xdc36('0x3e')]=_0x8f4c80;return _0x21151b;})[_0xdc36('0x23')](respondWithFilteredResult(_0x3fe57f,_0x12fed2))[_0xdc36('0x3f')](handleError(_0x3fe57f,null));};exports[_0xdc36('0x40')]=function(_0x932213,_0x2a83ee){var _0x2f4c89={'raw':!![],'where':{'id':_0x932213[_0xdc36('0x41')]['id']}},_0x125f0e={};_0x125f0e[_0xdc36('0x2c')]=_[_0xdc36('0x2e')](db[_0xdc36('0x42')][_0xdc36('0x29')]);_0x125f0e[_0xdc36('0x2d')]=_[_0xdc36('0x2e')](_0x932213[_0xdc36('0x2d')]);_0x125f0e[_0xdc36('0x2f')]=_[_0xdc36('0x30')](_0x125f0e[_0xdc36('0x2c')],_0x125f0e[_0xdc36('0x2d')]);_0x2f4c89[_0xdc36('0x31')]=_[_0xdc36('0x30')](_0x125f0e[_0xdc36('0x2c')],qs[_0xdc36('0x32')](_0x932213['query'][_0xdc36('0x32')]));_0x2f4c89[_0xdc36('0x31')]=_0x2f4c89['attributes']['length']?_0x2f4c89[_0xdc36('0x31')]:_0x125f0e['model'];if(_0x932213[_0xdc36('0x2d')]['includeAll']){_0x2f4c89[_0xdc36('0x3d')]=[{'all':!![]}];}_0x2f4c89=_[_0xdc36('0x39')]({},_0x2f4c89,_0x932213[_0xdc36('0x3b')]);return db[_0xdc36('0x42')][_0xdc36('0x43')](_0x2f4c89)[_0xdc36('0x23')](handleEntityNotFound(_0x2a83ee,null))[_0xdc36('0x23')](respondWithResult(_0x2a83ee,null))[_0xdc36('0x3f')](handleError(_0x2a83ee,null));};exports[_0xdc36('0x44')]=function(_0x38c24b,_0x3c27c7){return db[_0xdc36('0x42')][_0xdc36('0x44')](_0x38c24b[_0xdc36('0x45')],{})[_0xdc36('0x23')](respondWithResult(_0x3c27c7,0xc9))[_0xdc36('0x3f')](handleError(_0x3c27c7,null));};exports[_0xdc36('0x22')]=function(_0x3399cc,_0x562c86){if(_0x3399cc['body']['id']){delete _0x3399cc[_0xdc36('0x45')]['id'];}return db[_0xdc36('0x42')][_0xdc36('0x43')]({'where':{'id':_0x3399cc[_0xdc36('0x41')]['id']}})[_0xdc36('0x23')](handleEntityNotFound(_0x562c86,null))[_0xdc36('0x23')](saveUpdates(_0x3399cc['body'],null))[_0xdc36('0x23')](respondWithResult(_0x562c86,null))[_0xdc36('0x3f')](handleError(_0x562c86,null));};exports[_0xdc36('0x24')]=function(_0x49f456,_0x2c6856){return db[_0xdc36('0x42')][_0xdc36('0x43')]({'where':{'id':_0x49f456[_0xdc36('0x41')]['id']}})[_0xdc36('0x23')](handleEntityNotFound(_0x2c6856,null))[_0xdc36('0x23')](removeEntity(_0x2c6856,null))['catch'](handleError(_0x2c6856,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 0392774..961909a 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 _0xd0b5=['exports','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','FieldId','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskField.attributes'];(function(_0x483c8a,_0x56dfed){var _0x305cb2=function(_0x350147){while(--_0x350147){_0x483c8a['push'](_0x483c8a['shift']());}};_0x305cb2(++_0x56dfed);}(_0xd0b5,0x1b8));var _0x5d0b=function(_0x14835f,_0x2fb8ce){_0x14835f=_0x14835f-0x0;var _0x1958ce=_0xd0b5[_0x14835f];return _0x1958ce;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5d0b('0x0'))(_0x5d0b('0x1'));var moment=require('moment');var BPromise=require(_0x5d0b('0x2'));var rp=require(_0x5d0b('0x3'));var fs=require('fs');var path=require(_0x5d0b('0x4'));var rimraf=require(_0x5d0b('0x5'));var config=require(_0x5d0b('0x6'));var attributes=require(_0x5d0b('0x7'));module[_0x5d0b('0x8')]=function(_0x41b7c1,_0xd514d0){return _0x41b7c1[_0x5d0b('0x9')](_0x5d0b('0xa'),attributes,{'tableName':_0x5d0b('0xb'),'paranoid':![],'indexes':[{'name':_0x5d0b('0xc'),'fields':['idField',_0x5d0b('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1f71=['exports','define','FreshdeskField','freshdesk_unique_index','FieldId','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskField.attributes'];(function(_0x7b173,_0x539d7f){var _0x1c598c=function(_0xe1e1e0){while(--_0xe1e1e0){_0x7b173['push'](_0x7b173['shift']());}};_0x1c598c(++_0x539d7f);}(_0x1f71,0xaa));var _0x11f7=function(_0x19857f,_0x48afa0){_0x19857f=_0x19857f-0x0;var _0x500131=_0x1f71[_0x19857f];return _0x500131;};'use strict';var _=require('lodash');var util=require(_0x11f7('0x0'));var logger=require(_0x11f7('0x1'))(_0x11f7('0x2'));var moment=require(_0x11f7('0x3'));var BPromise=require(_0x11f7('0x4'));var rp=require(_0x11f7('0x5'));var fs=require('fs');var path=require(_0x11f7('0x6'));var rimraf=require(_0x11f7('0x7'));var config=require(_0x11f7('0x8'));var attributes=require(_0x11f7('0x9'));module[_0x11f7('0xa')]=function(_0x5110aa,_0x48f717){return _0x5110aa[_0x11f7('0xb')](_0x11f7('0xc'),attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':_0x11f7('0xd'),'fields':['idField',_0x11f7('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 ac1e65a..4006a6d 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 _0x6333=['FreshdeskField,\x20%s,\x20%s','request\x20sent','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then'];(function(_0x4f803c,_0x42ca79){var _0x2227f3=function(_0x1a580b){while(--_0x1a580b){_0x4f803c['push'](_0x4f803c['shift']());}};_0x2227f3(++_0x42ca79);}(_0x6333,0x159));var _0x3633=function(_0x4e38a3,_0x33419d){_0x4e38a3=_0x4e38a3-0x0;var _0x5ba931=_0x6333[_0x4e38a3];return _0x5ba931;};'use strict';var _=require(_0x3633('0x0'));var util=require(_0x3633('0x1'));var moment=require(_0x3633('0x2'));var BPromise=require(_0x3633('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3633('0x4'));var db=require(_0x3633('0x5'))['db'];var utils=require(_0x3633('0x6'));var logger=require(_0x3633('0x7'))(_0x3633('0x8'));var config=require(_0x3633('0x9'));var jayson=require(_0x3633('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x34c4fc,_0xbd74db,_0x536895){return new BPromise(function(_0x66477e,_0x828361){return client['request'](_0x34c4fc,_0x536895)[_0x3633('0xb')](function(_0x12d461){logger['info'](_0x3633('0xc'),_0xbd74db,_0x3633('0xd'));logger['debug'](_0x3633('0xe'),_0xbd74db,_0x3633('0xd'),JSON[_0x3633('0xf')](_0x12d461));if(_0x12d461['error']){if(_0x12d461[_0x3633('0x10')][_0x3633('0x11')]===0x1f4){logger['error'](_0x3633('0xc'),_0xbd74db,_0x12d461[_0x3633('0x10')][_0x3633('0x12')]);return _0x828361(_0x12d461[_0x3633('0x10')][_0x3633('0x12')]);}logger[_0x3633('0x10')](_0x3633('0xc'),_0xbd74db,_0x12d461[_0x3633('0x10')]['message']);return _0x66477e(_0x12d461[_0x3633('0x10')][_0x3633('0x12')]);}else{logger[_0x3633('0x13')](_0x3633('0xc'),_0xbd74db,_0x3633('0xd'));_0x66477e(_0x12d461['result'][_0x3633('0x12')]);}})[_0x3633('0x14')](function(_0x2cc77d){logger[_0x3633('0x10')]('FreshdeskField,\x20%s,\x20%s',_0xbd74db,_0x2cc77d);_0x828361(_0x2cc77d);});});} \ No newline at end of file +var _0x6bcb=['result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','FreshdeskField,\x20%s,\x20%s','debug','request\x20sent','error','message','info'];(function(_0x34cb00,_0x51c716){var _0x26d606=function(_0x467f35){while(--_0x467f35){_0x34cb00['push'](_0x34cb00['shift']());}};_0x26d606(++_0x51c716);}(_0x6bcb,0x132));var _0xb6bc=function(_0x47242d,_0x13f993){_0x47242d=_0x47242d-0x0;var _0x30273a=_0x6bcb[_0x47242d];return _0x30273a;};'use strict';var _=require('lodash');var util=require(_0xb6bc('0x0'));var moment=require(_0xb6bc('0x1'));var BPromise=require(_0xb6bc('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb6bc('0x3'));var db=require(_0xb6bc('0x4'))['db'];var utils=require(_0xb6bc('0x5'));var logger=require('../../config/logger')(_0xb6bc('0x6'));var config=require('../../config/environment');var jayson=require(_0xb6bc('0x7'));var client=jayson[_0xb6bc('0x8')][_0xb6bc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x510ed6,_0x34f55b,_0x367b35){return new BPromise(function(_0x29b51e,_0x2c375f){return client[_0xb6bc('0xa')](_0x510ed6,_0x367b35)['then'](function(_0xb68571){logger['info'](_0xb6bc('0xb'),_0x34f55b,'request\x20sent');logger[_0xb6bc('0xc')]('FreshdeskField,\x20%s,\x20%s,\x20%s',_0x34f55b,_0xb6bc('0xd'),JSON['stringify'](_0xb68571));if(_0xb68571['error']){if(_0xb68571[_0xb6bc('0xe')]['code']===0x1f4){logger[_0xb6bc('0xe')](_0xb6bc('0xb'),_0x34f55b,_0xb68571[_0xb6bc('0xe')]['message']);return _0x2c375f(_0xb68571[_0xb6bc('0xe')]['message']);}logger[_0xb6bc('0xe')](_0xb6bc('0xb'),_0x34f55b,_0xb68571[_0xb6bc('0xe')][_0xb6bc('0xf')]);return _0x29b51e(_0xb68571[_0xb6bc('0xe')]['message']);}else{logger[_0xb6bc('0x10')](_0xb6bc('0xb'),_0x34f55b,_0xb6bc('0xd'));_0x29b51e(_0xb68571[_0xb6bc('0x11')][_0xb6bc('0xf')]);}})[_0xb6bc('0x12')](function(_0x50b897){logger[_0xb6bc('0xe')](_0xb6bc('0xb'),_0x34f55b,_0x50b897);_0x2c375f(_0x50b897);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index dd291d2..31be1ee 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 _0xb9a7=['addConfiguration','delete','destroy','exports','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','/:id/fields','post','create'];(function(_0x35f1bd,_0x405be7){var _0x27e215=function(_0x2a6201){while(--_0x2a6201){_0x35f1bd['push'](_0x35f1bd['shift']());}};_0x27e215(++_0x405be7);}(_0xb9a7,0x112));var _0x7b9a=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0xb9a7[_0xaa1b3e];return _0x454d7d;};'use strict';var multer=require('multer');var util=require(_0x7b9a('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x7b9a('0x1')]();var fs_extra=require('fs-extra');var auth=require(_0x7b9a('0x2'));var interaction=require(_0x7b9a('0x3'));var config=require(_0x7b9a('0x4'));var controller=require(_0x7b9a('0x5'));router[_0x7b9a('0x6')]('/',auth[_0x7b9a('0x7')](),controller[_0x7b9a('0x8')]);router[_0x7b9a('0x6')](_0x7b9a('0x9'),auth[_0x7b9a('0x7')](),controller['show']);router[_0x7b9a('0x6')](_0x7b9a('0xa'),auth['isAuthenticated'](),controller['getConfigurations']);router['get'](_0x7b9a('0xb'),auth[_0x7b9a('0x7')](),controller['getFields']);router[_0x7b9a('0xc')]('/',auth['isAuthenticated'](),controller[_0x7b9a('0xd')]);router['post'](_0x7b9a('0xa'),auth[_0x7b9a('0x7')](),controller[_0x7b9a('0xe')]);router['put'](_0x7b9a('0x9'),auth[_0x7b9a('0x7')](),controller['update']);router[_0x7b9a('0xf')](_0x7b9a('0x9'),auth['isAuthenticated'](),controller[_0x7b9a('0x10')]);module[_0x7b9a('0x11')]=router; \ No newline at end of file +var _0x2e54=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','update','delete','destroy','exports','multer','connect-timeout','express'];(function(_0x421f66,_0x2c65c4){var _0x229969=function(_0x3a89b2){while(--_0x3a89b2){_0x421f66['push'](_0x421f66['shift']());}};_0x229969(++_0x2c65c4);}(_0x2e54,0x1dd));var _0x42e5=function(_0x572133,_0x755f22){_0x572133=_0x572133-0x0;var _0x29ebdf=_0x2e54[_0x572133];return _0x29ebdf;};'use strict';var multer=require(_0x42e5('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x42e5('0x1'));var express=require(_0x42e5('0x2'));var router=express[_0x42e5('0x3')]();var fs_extra=require(_0x42e5('0x4'));var auth=require(_0x42e5('0x5'));var interaction=require(_0x42e5('0x6'));var config=require(_0x42e5('0x7'));var controller=require('./intFreshsalesAccount.controller');router[_0x42e5('0x8')]('/',auth[_0x42e5('0x9')](),controller[_0x42e5('0xa')]);router['get'](_0x42e5('0xb'),auth['isAuthenticated'](),controller[_0x42e5('0xc')]);router['get'](_0x42e5('0xd'),auth[_0x42e5('0x9')](),controller[_0x42e5('0xe')]);router[_0x42e5('0x8')](_0x42e5('0xf'),auth[_0x42e5('0x9')](),controller[_0x42e5('0x10')]);router[_0x42e5('0x11')]('/',auth[_0x42e5('0x9')](),controller['create']);router[_0x42e5('0x11')](_0x42e5('0xd'),auth['isAuthenticated'](),controller[_0x42e5('0x12')]);router[_0x42e5('0x13')](_0x42e5('0xb'),auth[_0x42e5('0x9')](),controller[_0x42e5('0x14')]);router[_0x42e5('0x15')](_0x42e5('0xb'),auth[_0x42e5('0x9')](),controller[_0x42e5('0x16')]);module[_0x42e5('0x17')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 5ae64b2..aa6d3f4 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 _0x5b12=['STRING','sequelize','exports'];(function(_0x101e7b,_0x4ef05b){var _0x4995c0=function(_0x1a6488){while(--_0x1a6488){_0x101e7b['push'](_0x101e7b['shift']());}};_0x4995c0(++_0x4ef05b);}(_0x5b12,0xa3));var _0x25b1=function(_0x5d1c85,_0x4a56eb){_0x5d1c85=_0x5d1c85-0x0;var _0xe6d2bd=_0x5b12[_0x5d1c85];return _0xe6d2bd;};'use strict';var Sequelize=require(_0x25b1('0x0'));module[_0x25b1('0x1')]={'name':{'type':Sequelize[_0x25b1('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x25b1('0x2')],'unique':'username'},'apiKey':{'type':Sequelize[_0x25b1('0x2')]},'remoteUri':{'type':Sequelize[_0x25b1('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x25b1('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x583c=['exports','STRING','username','sequelize'];(function(_0xa186c,_0x5e2ea6){var _0x333dd2=function(_0x2b80c0){while(--_0x2b80c0){_0xa186c['push'](_0xa186c['shift']());}};_0x333dd2(++_0x5e2ea6);}(_0x583c,0x12b));var _0xc583=function(_0x57fa33,_0x2b8222){_0x57fa33=_0x57fa33-0x0;var _0x12e724=_0x583c[_0x57fa33];return _0x12e724;};'use strict';var Sequelize=require(_0xc583('0x0'));module[_0xc583('0x1')]={'name':{'type':Sequelize[_0xc583('0x2')]},'description':{'type':Sequelize[_0xc583('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0xc583('0x3')},'apiKey':{'type':Sequelize[_0xc583('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0xc583('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index 8755500..bb740b6 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 _0xf933=['error','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','stack','name','index','FreshsalesAccount','rawAttributes','fieldName','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','type','filter','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','getConfigurations','FreshsalesConfiguration','addConfiguration','findOne','Subjects','getSubjects','channel','FreshsalesField','Descriptions','getFields','remoteUri','apiKey','username','slice','lastIndexOf','GET','format','Token\x20token=','email','Requested\x20Resource\x20not\x20Found','test'];(function(_0x3dd23c,_0x18c32f){var _0x520bf8=function(_0x462f87){while(--_0x462f87){_0x3dd23c['push'](_0x3dd23c['shift']());}};_0x520bf8(++_0x18c32f);}(_0xf933,0x136));var _0x3f93=function(_0xd0cd0b,_0x490956){_0xd0cd0b=_0xd0cd0b-0x0;var _0x59cced=_0xf933[_0xd0cd0b];return _0x59cced;};'use strict';var emlformat=require(_0x3f93('0x0'));var rimraf=require(_0x3f93('0x1'));var zipdir=require(_0x3f93('0x2'));var jsonpatch=require(_0x3f93('0x3'));var rp=require('request-promise');var moment=require(_0x3f93('0x4'));var BPromise=require(_0x3f93('0x5'));var Mustache=require(_0x3f93('0x6'));var util=require(_0x3f93('0x7'));var path=require(_0x3f93('0x8'));var sox=require(_0x3f93('0x9'));var csv=require(_0x3f93('0xa'));var ejs=require(_0x3f93('0xb'));var fs=require('fs');var fs_extra=require(_0x3f93('0xc'));var _=require(_0x3f93('0xd'));var squel=require('squel');var crypto=require(_0x3f93('0xe'));var jsforce=require(_0x3f93('0xf'));var deskjs=require(_0x3f93('0x10'));var toCsv=require('to-csv');var querystring=require(_0x3f93('0x11'));var Papa=require('papaparse');var Redis=require(_0x3f93('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x3f93('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3f93('0x14'));var logger=require(_0x3f93('0x15'))('api');var utils=require(_0x3f93('0x16'));var config=require(_0x3f93('0x17'));var licenseUtil=require(_0x3f93('0x18'));var db=require(_0x3f93('0x19'))['db'];var integrations=require(_0x3f93('0x1a'));function respondWithStatusCode(_0x28fa04,_0x2b2efc){_0x2b2efc=_0x2b2efc||0xcc;return function(_0x1f0529){if(_0x1f0529){return _0x28fa04[_0x3f93('0x1b')](_0x2b2efc);}return _0x28fa04[_0x3f93('0x1c')](_0x2b2efc)[_0x3f93('0x1d')]();};}function respondWithResult(_0x4537c6,_0x203294){_0x203294=_0x203294||0xc8;return function(_0x4597a5){if(_0x4597a5){return _0x4537c6['status'](_0x203294)[_0x3f93('0x1e')](_0x4597a5);}};}function respondWithFilteredResult(_0xf97d8c,_0x36ab6f){return function(_0x3488ba){if(_0x3488ba){var _0xcb88d4=typeof _0x36ab6f[_0x3f93('0x1f')]===_0x3f93('0x20')&&typeof _0x36ab6f[_0x3f93('0x21')]===_0x3f93('0x20');var _0x15272c=_0x3488ba[_0x3f93('0x22')];var _0x15c451=_0xcb88d4?0x0:_0x36ab6f[_0x3f93('0x1f')];var _0x4f2ac5=_0xcb88d4?_0x3488ba['count']:_0x36ab6f[_0x3f93('0x1f')]+_0x36ab6f[_0x3f93('0x21')];var _0x19a4da;if(_0x4f2ac5>=_0x15272c){_0x4f2ac5=_0x15272c;_0x19a4da=0xc8;}else{_0x19a4da=0xce;}_0xf97d8c['status'](_0x19a4da);return _0xf97d8c[_0x3f93('0x23')](_0x3f93('0x24'),_0x15c451+'-'+_0x4f2ac5+'/'+_0x15272c)[_0x3f93('0x1e')](_0x3488ba);}return null;};}function patchUpdates(_0x2c033a){return function(_0x1954dc){try{jsonpatch[_0x3f93('0x25')](_0x1954dc,_0x2c033a,!![]);}catch(_0x57a3f9){return BPromise['reject'](_0x57a3f9);}return _0x1954dc[_0x3f93('0x26')]();};}function saveUpdates(_0x5f5482,_0x17c2fa){return function(_0x28a83c){if(_0x28a83c){return _0x28a83c[_0x3f93('0x27')](_0x5f5482)[_0x3f93('0x28')](function(_0x1c781d){return _0x1c781d;});}return null;};}function removeEntity(_0x2b5f35,_0xafd0cd){return function(_0x45c74a){if(_0x45c74a){return _0x45c74a[_0x3f93('0x29')]()[_0x3f93('0x28')](function(){_0x2b5f35['status'](0xcc)[_0x3f93('0x1d')]();});}};}function handleEntityNotFound(_0x36db5b,_0x1c4a1b){return function(_0x1c0ef0){if(!_0x1c0ef0){_0x36db5b[_0x3f93('0x1b')](0x194);}return _0x1c0ef0;};}function handleError(_0x17a59f,_0x1d8b3b){_0x1d8b3b=_0x1d8b3b||0x1f4;return function(_0x2ea0b7){logger['error'](_0x2ea0b7[_0x3f93('0x2a')]);if(_0x2ea0b7[_0x3f93('0x2b')]){delete _0x2ea0b7[_0x3f93('0x2b')];}_0x17a59f[_0x3f93('0x1c')](_0x1d8b3b)['send'](_0x2ea0b7);};}exports[_0x3f93('0x2c')]=function(_0x3021e4,_0x76800d){var _0x38550c={},_0x8180d4={},_0x5e9d7a={'count':0x0,'rows':[]};var _0x56c043=_['map'](db[_0x3f93('0x2d')][_0x3f93('0x2e')],function(_0x52f859){return{'name':_0x52f859[_0x3f93('0x2f')],'type':_0x52f859['type'][_0x3f93('0x30')]};});_0x8180d4[_0x3f93('0x31')]=_[_0x3f93('0x32')](_0x56c043,_0x3f93('0x2b'));_0x8180d4[_0x3f93('0x33')]=_[_0x3f93('0x34')](_0x3021e4[_0x3f93('0x33')]);_0x8180d4[_0x3f93('0x35')]=_['intersection'](_0x8180d4['model'],_0x8180d4[_0x3f93('0x33')]);_0x38550c[_0x3f93('0x36')]=_[_0x3f93('0x37')](_0x8180d4[_0x3f93('0x31')],qs['fields'](_0x3021e4[_0x3f93('0x33')][_0x3f93('0x38')]));_0x38550c[_0x3f93('0x36')]=_0x38550c['attributes'][_0x3f93('0x39')]?_0x38550c[_0x3f93('0x36')]:_0x8180d4['model'];if(!_0x3021e4['query'][_0x3f93('0x3a')](_0x3f93('0x3b'))){_0x38550c[_0x3f93('0x21')]=qs[_0x3f93('0x21')](_0x3021e4[_0x3f93('0x33')]['limit']);_0x38550c[_0x3f93('0x1f')]=qs[_0x3f93('0x1f')](_0x3021e4[_0x3f93('0x33')]['offset']);}_0x38550c[_0x3f93('0x3c')]=qs[_0x3f93('0x3d')](_0x3021e4[_0x3f93('0x33')][_0x3f93('0x3d')]);_0x38550c['where']=qs[_0x3f93('0x35')](_['pick'](_0x3021e4[_0x3f93('0x33')],_0x8180d4[_0x3f93('0x35')]),_0x56c043);if(_0x3021e4[_0x3f93('0x33')]['filter']){_0x38550c[_0x3f93('0x3e')]=_[_0x3f93('0x3f')](_0x38550c[_0x3f93('0x3e')],{'$or':_[_0x3f93('0x32')](_0x56c043,function(_0x1b1323){if(_0x1b1323[_0x3f93('0x40')]!=='VIRTUAL'){var _0x5503cd={};_0x5503cd[_0x1b1323['name']]={'$like':'%'+_0x3021e4['query'][_0x3f93('0x41')]+'%'};return _0x5503cd;}})});}_0x38550c=_[_0x3f93('0x3f')]({},_0x38550c,_0x3021e4[_0x3f93('0x42')]);var _0x56d5a9={'where':_0x38550c[_0x3f93('0x3e')]};return db[_0x3f93('0x2d')]['count'](_0x56d5a9)[_0x3f93('0x28')](function(_0x310ab9){_0x5e9d7a[_0x3f93('0x22')]=_0x310ab9;if(_0x3021e4['query'][_0x3f93('0x43')]){_0x38550c[_0x3f93('0x44')]=[{'all':!![]}];}return db[_0x3f93('0x2d')][_0x3f93('0x45')](_0x38550c);})[_0x3f93('0x28')](function(_0x3d3138){_0x5e9d7a[_0x3f93('0x46')]=_0x3d3138;return _0x5e9d7a;})[_0x3f93('0x28')](respondWithFilteredResult(_0x76800d,_0x38550c))[_0x3f93('0x47')](handleError(_0x76800d,null));};exports[_0x3f93('0x48')]=function(_0x840712,_0x302126){var _0xf00b13={'raw':![],'where':{'id':_0x840712[_0x3f93('0x49')]['id']}},_0x3ab71c={};_0x3ab71c[_0x3f93('0x31')]=_[_0x3f93('0x34')](db[_0x3f93('0x2d')][_0x3f93('0x2e')]);_0x3ab71c[_0x3f93('0x33')]=_[_0x3f93('0x34')](_0x840712[_0x3f93('0x33')]);_0x3ab71c[_0x3f93('0x35')]=_[_0x3f93('0x37')](_0x3ab71c['model'],_0x3ab71c[_0x3f93('0x33')]);_0xf00b13['attributes']=_['intersection'](_0x3ab71c[_0x3f93('0x31')],qs[_0x3f93('0x38')](_0x840712[_0x3f93('0x33')][_0x3f93('0x38')]));_0xf00b13[_0x3f93('0x36')]=_0xf00b13['attributes']['length']?_0xf00b13[_0x3f93('0x36')]:_0x3ab71c[_0x3f93('0x31')];if(_0x840712['query'][_0x3f93('0x43')]){_0xf00b13[_0x3f93('0x44')]=[{'all':!![]}];}_0xf00b13=_[_0x3f93('0x3f')]({},_0xf00b13,_0x840712[_0x3f93('0x42')]);return db[_0x3f93('0x2d')]['find'](_0xf00b13)['then'](handleEntityNotFound(_0x302126,null))[_0x3f93('0x28')](respondWithResult(_0x302126,null))[_0x3f93('0x47')](handleError(_0x302126,null));};exports['create']=function(_0x1d1722,_0x5bd31c){return db[_0x3f93('0x2d')][_0x3f93('0x4a')](_0x1d1722[_0x3f93('0x4b')],{})['then'](respondWithResult(_0x5bd31c,0xc9))['catch'](handleError(_0x5bd31c,null));};exports[_0x3f93('0x27')]=function(_0x444982,_0x39a901){if(_0x444982[_0x3f93('0x4b')]['id']){delete _0x444982['body']['id'];}return db[_0x3f93('0x2d')][_0x3f93('0x4c')]({'where':{'id':_0x444982[_0x3f93('0x49')]['id']}})[_0x3f93('0x28')](handleEntityNotFound(_0x39a901,null))[_0x3f93('0x28')](saveUpdates(_0x444982[_0x3f93('0x4b')],null))['then'](respondWithResult(_0x39a901,null))[_0x3f93('0x47')](handleError(_0x39a901,null));};exports[_0x3f93('0x29')]=function(_0x32db2f,_0x50ccaa){return db[_0x3f93('0x2d')]['find']({'where':{'id':_0x32db2f[_0x3f93('0x49')]['id']}})[_0x3f93('0x28')](handleEntityNotFound(_0x50ccaa,null))[_0x3f93('0x28')](removeEntity(_0x50ccaa,null))[_0x3f93('0x47')](handleError(_0x50ccaa,null));};exports[_0x3f93('0x4d')]=function(_0x12a4a1,_0x4ffa6e,_0x5d3b43){var _0x25bbea={};var _0x72c587={};var _0x41b32c;var _0x55104e;return db['FreshsalesAccount']['findOne']({'where':{'id':_0x12a4a1[_0x3f93('0x49')]['id']}})[_0x3f93('0x28')](handleEntityNotFound(_0x4ffa6e,null))['then'](function(_0x54cb8a){if(_0x54cb8a){_0x41b32c=_0x54cb8a;_0x72c587['model']=_[_0x3f93('0x34')](db[_0x3f93('0x4e')][_0x3f93('0x2e')]);_0x72c587[_0x3f93('0x33')]=_[_0x3f93('0x34')](_0x12a4a1[_0x3f93('0x33')]);_0x72c587['filters']=_['intersection'](_0x72c587[_0x3f93('0x31')],_0x72c587[_0x3f93('0x33')]);_0x25bbea[_0x3f93('0x36')]=_['intersection'](_0x72c587[_0x3f93('0x31')],qs['fields'](_0x12a4a1[_0x3f93('0x33')]['fields']));_0x25bbea[_0x3f93('0x36')]=_0x25bbea['attributes'][_0x3f93('0x39')]?_0x25bbea['attributes']:_0x72c587[_0x3f93('0x31')];_0x25bbea[_0x3f93('0x3c')]=qs[_0x3f93('0x3d')](_0x12a4a1[_0x3f93('0x33')][_0x3f93('0x3d')]);_0x25bbea[_0x3f93('0x3e')]=qs[_0x3f93('0x35')](_['pick'](_0x12a4a1[_0x3f93('0x33')],_0x72c587[_0x3f93('0x35')]));if(_0x12a4a1[_0x3f93('0x33')][_0x3f93('0x41')]){_0x25bbea['where']=_[_0x3f93('0x3f')](_0x25bbea['where'],{'$or':_[_0x3f93('0x32')](_0x25bbea[_0x3f93('0x36')],function(_0x37a0d4){var _0x31d2c7={};_0x31d2c7[_0x37a0d4]={'$like':'%'+_0x12a4a1[_0x3f93('0x33')][_0x3f93('0x41')]+'%'};return _0x31d2c7;})});}_0x25bbea=_[_0x3f93('0x3f')]({},_0x25bbea,_0x12a4a1[_0x3f93('0x42')]);return _0x41b32c[_0x3f93('0x4d')](_0x25bbea);}})[_0x3f93('0x28')](function(_0x3f1fa7){if(_0x3f1fa7){_0x55104e=_0x3f1fa7[_0x3f93('0x39')];if(!_0x12a4a1[_0x3f93('0x33')]['hasOwnProperty'](_0x3f93('0x3b'))){_0x25bbea[_0x3f93('0x21')]=qs[_0x3f93('0x21')](_0x12a4a1[_0x3f93('0x33')]['limit']);_0x25bbea[_0x3f93('0x1f')]=qs['offset'](_0x12a4a1[_0x3f93('0x33')][_0x3f93('0x1f')]);}return _0x41b32c[_0x3f93('0x4d')](_0x25bbea);}})['then'](function(_0x5878ed){if(_0x5878ed){return _0x5878ed?{'count':_0x55104e,'rows':_0x5878ed}:null;}})[_0x3f93('0x28')](respondWithResult(_0x4ffa6e,null))[_0x3f93('0x47')](handleError(_0x4ffa6e,null));};exports[_0x3f93('0x4f')]=function(_0x422a80,_0x591787,_0x1ff1ef){if(_0x422a80[_0x3f93('0x4b')]['id']){delete _0x422a80[_0x3f93('0x4b')]['id'];}return db['FreshsalesAccount'][_0x3f93('0x50')]({'where':{'id':_0x422a80[_0x3f93('0x49')]['id']}})['then'](handleEntityNotFound(_0x591787,null))[_0x3f93('0x28')](function(_0x1996e0){if(_0x1996e0){_0x422a80[_0x3f93('0x4b')]['AccountId']=_0x1996e0['id'];_0x422a80[_0x3f93('0x4b')][_0x3f93('0x51')]=integrations[_0x3f93('0x52')](_0x422a80[_0x3f93('0x4b')][_0x3f93('0x53')],_0x422a80[_0x3f93('0x4b')]['type']);_0x422a80['body']['Descriptions']=integrations['getDescriptions'](_0x422a80['body'][_0x3f93('0x53')],_0x422a80[_0x3f93('0x4b')][_0x3f93('0x40')]);return db[_0x3f93('0x4e')]['create'](_0x422a80[_0x3f93('0x4b')],{'include':[{'model':db[_0x3f93('0x54')],'as':_0x3f93('0x51')},{'model':db[_0x3f93('0x54')],'as':_0x3f93('0x55')}]});}return null;})[_0x3f93('0x28')](respondWithResult(_0x591787,null))['catch'](handleError(_0x591787,null));};exports[_0x3f93('0x56')]=function(_0x34f817,_0x1597be,_0x1cbde9){var _0x3ca185='';var _0x41f1a4='';return db[_0x3f93('0x2d')][_0x3f93('0x50')]({'where':{'id':_0x34f817[_0x3f93('0x49')]['id']},'attributes':['id','username',_0x3f93('0x57'),_0x3f93('0x58')]})[_0x3f93('0x28')](handleEntityNotFound(_0x1597be,null))[_0x3f93('0x28')](function(_0x21e045){if(_0x21e045){_0x41f1a4=_0x21e045[_0x3f93('0x59')];_0x3ca185=_0x21e045[_0x3f93('0x57')];var _0x1dba95=_0x21e045[_0x3f93('0x57')][_0x3f93('0x5a')](-0x1);if(_0x1dba95==='/'){_0x3ca185=_0x3ca185['substring'](0x0,_0x3ca185[_0x3f93('0x5b')](_0x1dba95));}return rp({'method':_0x3f93('0x5c'),'uri':util[_0x3f93('0x5d')]('%s%s',_0x3ca185,'/api/selector/owners'),'headers':{'Authorization':_0x3f93('0x5e')+_0x21e045[_0x3f93('0x58')]},'json':!![]});}})[_0x3f93('0x28')](function(_0x2532c5){if(_0x2532c5){var _0x36eaad=_0x2532c5['users'];var _0x1572b8=![];var _0x34b074=null;for(_0x34b074=0x0;_0x34b074<_0x36eaad[_0x3f93('0x39')];_0x34b074++){if(_0x36eaad[_0x34b074][_0x3f93('0x5f')]===_0x41f1a4){_0x1572b8=!![];}}if(_0x1572b8){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x3f93('0x60')});}}})[_0x3f93('0x28')](respondWithResult(_0x1597be,null))['catch'](function(_0x7fc218){var _0x2f8d02=_0x34f817[_0x3f93('0x33')][_0x3f93('0x61')]?0x1f4:_0x7fc218['statusCode']||0x1f4;logger[_0x3f93('0x62')](_0x3f93('0x63'),_0x3f93('0x56'),_0x2f8d02,JSON['stringify'](_0x7fc218));delete _0x7fc218[_0x3f93('0x2b')];if(_0x2f8d02===0x191){_0x2f8d02=0x190;}_0x1597be[_0x3f93('0x1c')](_0x2f8d02)[_0x3f93('0x64')](_0x34f817[_0x3f93('0x33')][_0x3f93('0x61')]?{'message':_0x3f93('0x65'),'statusCode':_0x7fc218['statusCode']}:_0x7fc218);});}; \ No newline at end of file +var _0xa674=['end','status','json','offset','undefined','count','set','apply','save','update','destroy','then','error','stack','name','send','index','map','FreshsalesAccount','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','filter','merge','includeAll','include','findAll','show','rawAttributes','options','find','create','body','params','getConfigurations','findOne','FreshsalesConfiguration','pick','hasOwnProperty','limit','addConfiguration','Subjects','getSubjects','channel','type','Descriptions','getDescriptions','FreshsalesField','getFields','username','remoteUri','apiKey','slice','substring','GET','format','users','email','Requested\x20Resource\x20not\x20Found','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','sendStatus'];(function(_0x4898e1,_0x208a2b){var _0x1c9424=function(_0x2564d3){while(--_0x2564d3){_0x4898e1['push'](_0x4898e1['shift']());}};_0x1c9424(++_0x208a2b);}(_0xa674,0xa9));var _0x4a67=function(_0x1f29e8,_0x320b53){_0x1f29e8=_0x1f29e8-0x0;var _0x5b4338=_0xa674[_0x1f29e8];return _0x5b4338;};'use strict';var emlformat=require(_0x4a67('0x0'));var rimraf=require(_0x4a67('0x1'));var zipdir=require(_0x4a67('0x2'));var jsonpatch=require(_0x4a67('0x3'));var rp=require(_0x4a67('0x4'));var moment=require(_0x4a67('0x5'));var BPromise=require(_0x4a67('0x6'));var Mustache=require(_0x4a67('0x7'));var util=require(_0x4a67('0x8'));var path=require(_0x4a67('0x9'));var sox=require(_0x4a67('0xa'));var csv=require(_0x4a67('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4a67('0xc'));var _=require(_0x4a67('0xd'));var squel=require('squel');var crypto=require(_0x4a67('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4a67('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x4a67('0xf'));var qs=require(_0x4a67('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4a67('0x11'));var logger=require(_0x4a67('0x12'))(_0x4a67('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x3bf36b,_0x9c0db7){_0x9c0db7=_0x9c0db7||0xcc;return function(_0x3b9867){if(_0x3b9867){return _0x3bf36b[_0x4a67('0x14')](_0x9c0db7);}return _0x3bf36b['status'](_0x9c0db7)[_0x4a67('0x15')]();};}function respondWithResult(_0x2e12d3,_0xfb7466){_0xfb7466=_0xfb7466||0xc8;return function(_0x54b556){if(_0x54b556){return _0x2e12d3[_0x4a67('0x16')](_0xfb7466)[_0x4a67('0x17')](_0x54b556);}};}function respondWithFilteredResult(_0x50b7e6,_0xdcaa25){return function(_0x43b5f2){if(_0x43b5f2){var _0x162339=typeof _0xdcaa25[_0x4a67('0x18')]===_0x4a67('0x19')&&typeof _0xdcaa25['limit']==='undefined';var _0x2e545e=_0x43b5f2['count'];var _0xca3e26=_0x162339?0x0:_0xdcaa25[_0x4a67('0x18')];var _0x393599=_0x162339?_0x43b5f2[_0x4a67('0x1a')]:_0xdcaa25[_0x4a67('0x18')]+_0xdcaa25['limit'];var _0x33bc9f;if(_0x393599>=_0x2e545e){_0x393599=_0x2e545e;_0x33bc9f=0xc8;}else{_0x33bc9f=0xce;}_0x50b7e6['status'](_0x33bc9f);return _0x50b7e6[_0x4a67('0x1b')]('Content-Range',_0xca3e26+'-'+_0x393599+'/'+_0x2e545e)[_0x4a67('0x17')](_0x43b5f2);}return null;};}function patchUpdates(_0x4a6f65){return function(_0x394542){try{jsonpatch[_0x4a67('0x1c')](_0x394542,_0x4a6f65,!![]);}catch(_0x3aa39d){return BPromise['reject'](_0x3aa39d);}return _0x394542[_0x4a67('0x1d')]();};}function saveUpdates(_0x1b9e24,_0x8c6c00){return function(_0x425df5){if(_0x425df5){return _0x425df5[_0x4a67('0x1e')](_0x1b9e24)['then'](function(_0x16a05e){return _0x16a05e;});}return null;};}function removeEntity(_0x20640e,_0x50c488){return function(_0xa4166){if(_0xa4166){return _0xa4166[_0x4a67('0x1f')]()[_0x4a67('0x20')](function(){_0x20640e[_0x4a67('0x16')](0xcc)[_0x4a67('0x15')]();});}};}function handleEntityNotFound(_0x3006b7,_0x2f27b2){return function(_0x86d08d){if(!_0x86d08d){_0x3006b7[_0x4a67('0x14')](0x194);}return _0x86d08d;};}function handleError(_0x60402,_0x2d80f3){_0x2d80f3=_0x2d80f3||0x1f4;return function(_0x26e239){logger[_0x4a67('0x21')](_0x26e239[_0x4a67('0x22')]);if(_0x26e239[_0x4a67('0x23')]){delete _0x26e239[_0x4a67('0x23')];}_0x60402[_0x4a67('0x16')](_0x2d80f3)[_0x4a67('0x24')](_0x26e239);};}exports[_0x4a67('0x25')]=function(_0x3f4516,_0x125773){var _0x348201={},_0x85da30={},_0x5c9782={'count':0x0,'rows':[]};var _0x4d33b6=_[_0x4a67('0x26')](db[_0x4a67('0x27')]['rawAttributes'],function(_0x3a5e8f){return{'name':_0x3a5e8f[_0x4a67('0x28')],'type':_0x3a5e8f['type'][_0x4a67('0x29')]};});_0x85da30[_0x4a67('0x2a')]=_['map'](_0x4d33b6,_0x4a67('0x23'));_0x85da30[_0x4a67('0x2b')]=_[_0x4a67('0x2c')](_0x3f4516['query']);_0x85da30[_0x4a67('0x2d')]=_[_0x4a67('0x2e')](_0x85da30[_0x4a67('0x2a')],_0x85da30[_0x4a67('0x2b')]);_0x348201[_0x4a67('0x2f')]=_[_0x4a67('0x2e')](_0x85da30[_0x4a67('0x2a')],qs[_0x4a67('0x30')](_0x3f4516[_0x4a67('0x2b')][_0x4a67('0x30')]));_0x348201['attributes']=_0x348201[_0x4a67('0x2f')][_0x4a67('0x31')]?_0x348201[_0x4a67('0x2f')]:_0x85da30['model'];if(!_0x3f4516[_0x4a67('0x2b')]['hasOwnProperty'](_0x4a67('0x32'))){_0x348201['limit']=qs['limit'](_0x3f4516[_0x4a67('0x2b')]['limit']);_0x348201[_0x4a67('0x18')]=qs[_0x4a67('0x18')](_0x3f4516[_0x4a67('0x2b')]['offset']);}_0x348201['order']=qs[_0x4a67('0x33')](_0x3f4516[_0x4a67('0x2b')]['sort']);_0x348201[_0x4a67('0x34')]=qs[_0x4a67('0x2d')](_['pick'](_0x3f4516[_0x4a67('0x2b')],_0x85da30[_0x4a67('0x2d')]),_0x4d33b6);if(_0x3f4516[_0x4a67('0x2b')][_0x4a67('0x35')]){_0x348201[_0x4a67('0x34')]=_[_0x4a67('0x36')](_0x348201['where'],{'$or':_['map'](_0x4d33b6,function(_0x259069){if(_0x259069['type']!=='VIRTUAL'){var _0x5bea02={};_0x5bea02[_0x259069[_0x4a67('0x23')]]={'$like':'%'+_0x3f4516['query']['filter']+'%'};return _0x5bea02;}})});}_0x348201=_[_0x4a67('0x36')]({},_0x348201,_0x3f4516['options']);var _0x3937f6={'where':_0x348201[_0x4a67('0x34')]};return db[_0x4a67('0x27')]['count'](_0x3937f6)['then'](function(_0x2417fb){_0x5c9782['count']=_0x2417fb;if(_0x3f4516['query'][_0x4a67('0x37')]){_0x348201[_0x4a67('0x38')]=[{'all':!![]}];}return db['FreshsalesAccount'][_0x4a67('0x39')](_0x348201);})['then'](function(_0x710233){_0x5c9782['rows']=_0x710233;return _0x5c9782;})[_0x4a67('0x20')](respondWithFilteredResult(_0x125773,_0x348201))['catch'](handleError(_0x125773,null));};exports[_0x4a67('0x3a')]=function(_0x135780,_0x318800){var _0x3a3a52={'raw':![],'where':{'id':_0x135780['params']['id']}},_0x496772={};_0x496772[_0x4a67('0x2a')]=_[_0x4a67('0x2c')](db[_0x4a67('0x27')][_0x4a67('0x3b')]);_0x496772[_0x4a67('0x2b')]=_[_0x4a67('0x2c')](_0x135780[_0x4a67('0x2b')]);_0x496772[_0x4a67('0x2d')]=_[_0x4a67('0x2e')](_0x496772['model'],_0x496772[_0x4a67('0x2b')]);_0x3a3a52[_0x4a67('0x2f')]=_[_0x4a67('0x2e')](_0x496772[_0x4a67('0x2a')],qs[_0x4a67('0x30')](_0x135780[_0x4a67('0x2b')]['fields']));_0x3a3a52[_0x4a67('0x2f')]=_0x3a3a52['attributes'][_0x4a67('0x31')]?_0x3a3a52[_0x4a67('0x2f')]:_0x496772[_0x4a67('0x2a')];if(_0x135780[_0x4a67('0x2b')]['includeAll']){_0x3a3a52['include']=[{'all':!![]}];}_0x3a3a52=_[_0x4a67('0x36')]({},_0x3a3a52,_0x135780[_0x4a67('0x3c')]);return db['FreshsalesAccount'][_0x4a67('0x3d')](_0x3a3a52)[_0x4a67('0x20')](handleEntityNotFound(_0x318800,null))[_0x4a67('0x20')](respondWithResult(_0x318800,null))['catch'](handleError(_0x318800,null));};exports[_0x4a67('0x3e')]=function(_0x173428,_0x118e75){return db[_0x4a67('0x27')][_0x4a67('0x3e')](_0x173428[_0x4a67('0x3f')],{})[_0x4a67('0x20')](respondWithResult(_0x118e75,0xc9))['catch'](handleError(_0x118e75,null));};exports[_0x4a67('0x1e')]=function(_0x5910d8,_0xc27d82){if(_0x5910d8[_0x4a67('0x3f')]['id']){delete _0x5910d8[_0x4a67('0x3f')]['id'];}return db[_0x4a67('0x27')][_0x4a67('0x3d')]({'where':{'id':_0x5910d8[_0x4a67('0x40')]['id']}})['then'](handleEntityNotFound(_0xc27d82,null))[_0x4a67('0x20')](saveUpdates(_0x5910d8[_0x4a67('0x3f')],null))[_0x4a67('0x20')](respondWithResult(_0xc27d82,null))['catch'](handleError(_0xc27d82,null));};exports[_0x4a67('0x1f')]=function(_0x23d5f7,_0x11b655){return db['FreshsalesAccount'][_0x4a67('0x3d')]({'where':{'id':_0x23d5f7[_0x4a67('0x40')]['id']}})[_0x4a67('0x20')](handleEntityNotFound(_0x11b655,null))[_0x4a67('0x20')](removeEntity(_0x11b655,null))['catch'](handleError(_0x11b655,null));};exports[_0x4a67('0x41')]=function(_0x254778,_0x1701ce,_0x3cbf07){var _0x4497de={};var _0x2aafc={};var _0x1783fa;var _0x4e453a;return db[_0x4a67('0x27')][_0x4a67('0x42')]({'where':{'id':_0x254778[_0x4a67('0x40')]['id']}})[_0x4a67('0x20')](handleEntityNotFound(_0x1701ce,null))['then'](function(_0x3f5ddd){if(_0x3f5ddd){_0x1783fa=_0x3f5ddd;_0x2aafc[_0x4a67('0x2a')]=_[_0x4a67('0x2c')](db[_0x4a67('0x43')][_0x4a67('0x3b')]);_0x2aafc[_0x4a67('0x2b')]=_[_0x4a67('0x2c')](_0x254778[_0x4a67('0x2b')]);_0x2aafc['filters']=_[_0x4a67('0x2e')](_0x2aafc['model'],_0x2aafc[_0x4a67('0x2b')]);_0x4497de[_0x4a67('0x2f')]=_[_0x4a67('0x2e')](_0x2aafc[_0x4a67('0x2a')],qs['fields'](_0x254778[_0x4a67('0x2b')][_0x4a67('0x30')]));_0x4497de['attributes']=_0x4497de[_0x4a67('0x2f')][_0x4a67('0x31')]?_0x4497de[_0x4a67('0x2f')]:_0x2aafc[_0x4a67('0x2a')];_0x4497de['order']=qs[_0x4a67('0x33')](_0x254778['query'][_0x4a67('0x33')]);_0x4497de[_0x4a67('0x34')]=qs[_0x4a67('0x2d')](_[_0x4a67('0x44')](_0x254778[_0x4a67('0x2b')],_0x2aafc[_0x4a67('0x2d')]));if(_0x254778['query'][_0x4a67('0x35')]){_0x4497de['where']=_['merge'](_0x4497de[_0x4a67('0x34')],{'$or':_[_0x4a67('0x26')](_0x4497de[_0x4a67('0x2f')],function(_0x1937f6){var _0x591999={};_0x591999[_0x1937f6]={'$like':'%'+_0x254778[_0x4a67('0x2b')][_0x4a67('0x35')]+'%'};return _0x591999;})});}_0x4497de=_['merge']({},_0x4497de,_0x254778[_0x4a67('0x3c')]);return _0x1783fa[_0x4a67('0x41')](_0x4497de);}})[_0x4a67('0x20')](function(_0x35a109){if(_0x35a109){_0x4e453a=_0x35a109[_0x4a67('0x31')];if(!_0x254778[_0x4a67('0x2b')][_0x4a67('0x45')](_0x4a67('0x32'))){_0x4497de['limit']=qs[_0x4a67('0x46')](_0x254778['query'][_0x4a67('0x46')]);_0x4497de[_0x4a67('0x18')]=qs[_0x4a67('0x18')](_0x254778[_0x4a67('0x2b')]['offset']);}return _0x1783fa['getConfigurations'](_0x4497de);}})['then'](function(_0x1920a6){if(_0x1920a6){return _0x1920a6?{'count':_0x4e453a,'rows':_0x1920a6}:null;}})[_0x4a67('0x20')](respondWithResult(_0x1701ce,null))['catch'](handleError(_0x1701ce,null));};exports[_0x4a67('0x47')]=function(_0x26f3b3,_0x4dedf7,_0x5f5713){if(_0x26f3b3[_0x4a67('0x3f')]['id']){delete _0x26f3b3['body']['id'];}return db[_0x4a67('0x27')][_0x4a67('0x42')]({'where':{'id':_0x26f3b3[_0x4a67('0x40')]['id']}})['then'](handleEntityNotFound(_0x4dedf7,null))[_0x4a67('0x20')](function(_0x536943){if(_0x536943){_0x26f3b3[_0x4a67('0x3f')]['AccountId']=_0x536943['id'];_0x26f3b3[_0x4a67('0x3f')][_0x4a67('0x48')]=integrations[_0x4a67('0x49')](_0x26f3b3[_0x4a67('0x3f')][_0x4a67('0x4a')],_0x26f3b3['body'][_0x4a67('0x4b')]);_0x26f3b3[_0x4a67('0x3f')][_0x4a67('0x4c')]=integrations[_0x4a67('0x4d')](_0x26f3b3['body'][_0x4a67('0x4a')],_0x26f3b3['body']['type']);return db['FreshsalesConfiguration'][_0x4a67('0x3e')](_0x26f3b3['body'],{'include':[{'model':db[_0x4a67('0x4e')],'as':'Subjects'},{'model':db[_0x4a67('0x4e')],'as':_0x4a67('0x4c')}]});}return null;})['then'](respondWithResult(_0x4dedf7,null))['catch'](handleError(_0x4dedf7,null));};exports[_0x4a67('0x4f')]=function(_0x3fe54e,_0x15a58e,_0x29cff2){var _0x3935c0='';var _0x5a66b7='';return db['FreshsalesAccount'][_0x4a67('0x42')]({'where':{'id':_0x3fe54e[_0x4a67('0x40')]['id']},'attributes':['id',_0x4a67('0x50'),_0x4a67('0x51'),_0x4a67('0x52')]})[_0x4a67('0x20')](handleEntityNotFound(_0x15a58e,null))[_0x4a67('0x20')](function(_0x428a53){if(_0x428a53){_0x5a66b7=_0x428a53[_0x4a67('0x50')];_0x3935c0=_0x428a53['remoteUri'];var _0x1ba00c=_0x428a53[_0x4a67('0x51')][_0x4a67('0x53')](-0x1);if(_0x1ba00c==='/'){_0x3935c0=_0x3935c0[_0x4a67('0x54')](0x0,_0x3935c0['lastIndexOf'](_0x1ba00c));}return rp({'method':_0x4a67('0x55'),'uri':util[_0x4a67('0x56')]('%s%s',_0x3935c0,'/api/selector/owners'),'headers':{'Authorization':'Token\x20token='+_0x428a53[_0x4a67('0x52')]},'json':!![]});}})[_0x4a67('0x20')](function(_0x273ad2){if(_0x273ad2){var _0x40b28a=_0x273ad2[_0x4a67('0x57')];var _0xe86034=![];var _0x4d1905=null;for(_0x4d1905=0x0;_0x4d1905<_0x40b28a[_0x4a67('0x31')];_0x4d1905++){if(_0x40b28a[_0x4d1905][_0x4a67('0x58')]===_0x5a66b7){_0xe86034=!![];}}if(_0xe86034){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x4a67('0x59')});}}})['then'](respondWithResult(_0x15a58e,null))['catch'](function(_0x339ae5){var _0x218f4d=_0x3fe54e[_0x4a67('0x2b')][_0x4a67('0x5a')]?0x1f4:_0x339ae5[_0x4a67('0x5b')]||0x1f4;logger['error'](_0x4a67('0x5c'),_0x4a67('0x4f'),_0x218f4d,JSON[_0x4a67('0x5d')](_0x339ae5));delete _0x339ae5['name'];if(_0x218f4d===0x191){_0x218f4d=0x190;}_0x15a58e['status'](_0x218f4d)[_0x4a67('0x24')](_0x3fe54e[_0x4a67('0x2b')][_0x4a67('0x5a')]?{'message':_0x4a67('0x5e'),'statusCode':_0x339ae5['statusCode']}:_0x339ae5);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 2310edf..8fb3ae5 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 _0x323f=['exports','define','FreshsalesAccount','int_freshsales_accounts','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration'];(function(_0x1ed2e4,_0xa4238a){var _0xea070c=function(_0x56746f){while(--_0x56746f){_0x1ed2e4['push'](_0x1ed2e4['shift']());}};_0xea070c(++_0xa4238a);}(_0x323f,0x1ee));var _0xf323=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x323f[_0xbca1b1];return _0x4e1686;};'use strict';var _=require('lodash');var util=require(_0xf323('0x0'));var logger=require('../../config/logger')(_0xf323('0x1'));var moment=require(_0xf323('0x2'));var BPromise=require(_0xf323('0x3'));var rp=require(_0xf323('0x4'));var fs=require('fs');var path=require(_0xf323('0x5'));var rimraf=require(_0xf323('0x6'));var config=require(_0xf323('0x7'));var attributes=require(_0xf323('0x8'));var integrations=require(_0xf323('0x9'));module[_0xf323('0xa')]=function(_0x5d7d60,_0xb9a667){return _0x5d7d60[_0xf323('0xb')](_0xf323('0xc'),attributes,{'tableName':_0xf323('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe5af=['FreshsalesAccount','int_freshsales_accounts','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../components/integrations/configuration','exports','define'];(function(_0x12de61,_0x4b56a4){var _0xb3684f=function(_0x27fa50){while(--_0x27fa50){_0x12de61['push'](_0x12de61['shift']());}};_0xb3684f(++_0x4b56a4);}(_0xe5af,0x9c));var _0xfe5a=function(_0x588945,_0x4af238){_0x588945=_0x588945-0x0;var _0x509466=_0xe5af[_0x588945];return _0x509466;};'use strict';var _=require('lodash');var util=require(_0xfe5a('0x0'));var logger=require(_0xfe5a('0x1'))('api');var moment=require(_0xfe5a('0x2'));var BPromise=require(_0xfe5a('0x3'));var rp=require(_0xfe5a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfe5a('0x5'));var config=require('../../config/environment');var attributes=require('./intFreshsalesAccount.attributes');var integrations=require(_0xfe5a('0x6'));module[_0xfe5a('0x7')]=function(_0x4e418f,_0x5eea2e){return _0x4e418f[_0xfe5a('0x8')](_0xfe5a('0x9'),attributes,{'tableName':_0xfe5a('0xa'),'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 92db6d5..cd5c1bf 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 _0x5464=['FreshsalesAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','where','attributes','limit','include','map','model','find','ShowFreshsalesAccount','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','FreshsalesAccount,\x20%s,\x20%s','debug'];(function(_0x21643c,_0x230532){var _0x58bfb6=function(_0x60c8eb){while(--_0x60c8eb){_0x21643c['push'](_0x21643c['shift']());}};_0x58bfb6(++_0x230532);}(_0x5464,0x15d));var _0x4546=function(_0x2ff5d5,_0x3b7db5){_0x2ff5d5=_0x2ff5d5-0x0;var _0x47be60=_0x5464[_0x2ff5d5];return _0x47be60;};'use strict';var _=require(_0x4546('0x0'));var util=require(_0x4546('0x1'));var moment=require(_0x4546('0x2'));var BPromise=require('bluebird');var rs=require(_0x4546('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4546('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4546('0x5'))(_0x4546('0x6'));var config=require(_0x4546('0x7'));var jayson=require(_0x4546('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5c5e09,_0x224c7c,_0x36c875){return new BPromise(function(_0x1a76c1,_0x2e860a){return client[_0x4546('0x9')](_0x5c5e09,_0x36c875)[_0x4546('0xa')](function(_0x11d63e){logger[_0x4546('0xb')](_0x4546('0xc'),_0x224c7c,'request\x20sent');logger[_0x4546('0xd')](_0x4546('0xe'),_0x224c7c,_0x4546('0xf'),JSON['stringify'](_0x11d63e));if(_0x11d63e[_0x4546('0x10')]){if(_0x11d63e[_0x4546('0x10')][_0x4546('0x11')]===0x1f4){logger[_0x4546('0x10')]('FreshsalesAccount,\x20%s,\x20%s',_0x224c7c,_0x11d63e['error'][_0x4546('0x12')]);return _0x2e860a(_0x11d63e['error']['message']);}logger['error']('FreshsalesAccount,\x20%s,\x20%s',_0x224c7c,_0x11d63e['error']['message']);return _0x1a76c1(_0x11d63e[_0x4546('0x10')]['message']);}else{logger[_0x4546('0xb')]('FreshsalesAccount,\x20%s,\x20%s',_0x224c7c,_0x4546('0xf'));_0x1a76c1(_0x11d63e['result'][_0x4546('0x12')]);}})[_0x4546('0x13')](function(_0x24b32a){logger[_0x4546('0x10')](_0x4546('0xc'),_0x224c7c,_0x24b32a);_0x2e860a(_0x24b32a);});});}exports[_0x4546('0x14')]=function(_0x57d8de){var _0x4ffd6b=this;return new Promise(function(_0x5780a7,_0x330235){return db[_0x4546('0x15')][_0x4546('0x16')]({'raw':_0x57d8de[_0x4546('0x17')]?_0x57d8de[_0x4546('0x17')][_0x4546('0x18')]===undefined?!![]:![]:!![],'where':_0x57d8de[_0x4546('0x17')]?_0x57d8de[_0x4546('0x17')][_0x4546('0x19')]||null:null,'attributes':_0x57d8de[_0x4546('0x17')]?_0x57d8de['options'][_0x4546('0x1a')]||null:null,'limit':_0x57d8de[_0x4546('0x17')]?_0x57d8de['options'][_0x4546('0x1b')]||null:null,'include':_0x57d8de[_0x4546('0x17')]?_0x57d8de[_0x4546('0x17')][_0x4546('0x1c')]?_[_0x4546('0x1d')](_0x57d8de[_0x4546('0x17')]['include'],function(_0x3dab5c){return{'model':db[_0x3dab5c[_0x4546('0x1e')]],'as':_0x3dab5c['as'],'attributes':_0x3dab5c['attributes'],'include':_0x3dab5c[_0x4546('0x1c')]?_[_0x4546('0x1d')](_0x3dab5c[_0x4546('0x1c')],function(_0x4467ee){return{'model':db[_0x4467ee[_0x4546('0x1e')]],'as':_0x4467ee['as'],'attributes':_0x4467ee['attributes'],'include':_0x4467ee[_0x4546('0x1c')]?_[_0x4546('0x1d')](_0x4467ee[_0x4546('0x1c')],function(_0x48fc36){return{'model':db[_0x48fc36['model']],'as':_0x48fc36['as'],'attributes':_0x48fc36[_0x4546('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x4546('0xa')](function(_0x15611c){logger[_0x4546('0xb')](_0x4546('0x14'),_0x57d8de);logger[_0x4546('0xd')](_0x4546('0x14'),_0x57d8de,JSON['stringify'](_0x15611c));_0x5780a7(_0x15611c);})[_0x4546('0x13')](function(_0x52c546){logger[_0x4546('0x10')](_0x4546('0x14'),_0x52c546['message'],_0x57d8de);_0x330235(_0x4ffd6b['error'](0x1f4,_0x52c546[_0x4546('0x12')]));});});};exports['ShowFreshsalesAccount']=function(_0x3c7c7d){var _0x58b69=this;return new Promise(function(_0x480d8e,_0x5f0226){return db[_0x4546('0x15')][_0x4546('0x1f')]({'raw':_0x3c7c7d[_0x4546('0x17')]?_0x3c7c7d['options'][_0x4546('0x18')]===undefined?!![]:![]:!![],'where':_0x3c7c7d[_0x4546('0x17')]?_0x3c7c7d['options'][_0x4546('0x19')]||null:null,'attributes':_0x3c7c7d['options']?_0x3c7c7d[_0x4546('0x17')][_0x4546('0x1a')]||null:null,'include':_0x3c7c7d[_0x4546('0x17')]?_0x3c7c7d[_0x4546('0x17')]['include']?_[_0x4546('0x1d')](_0x3c7c7d[_0x4546('0x17')][_0x4546('0x1c')],function(_0x298bef){return{'model':db[_0x298bef[_0x4546('0x1e')]],'as':_0x298bef['as'],'attributes':_0x298bef[_0x4546('0x1a')],'include':_0x298bef['include']?_[_0x4546('0x1d')](_0x298bef[_0x4546('0x1c')],function(_0x549f48){return{'model':db[_0x549f48['model']],'as':_0x549f48['as'],'attributes':_0x549f48[_0x4546('0x1a')],'include':_0x549f48[_0x4546('0x1c')]?_['map'](_0x549f48[_0x4546('0x1c')],function(_0x25066c){return{'model':db[_0x25066c['model']],'as':_0x25066c['as'],'attributes':_0x25066c['attributes']};}):[]};}):[]};}):[]:[]})[_0x4546('0xa')](function(_0x141fe8){logger[_0x4546('0xb')](_0x4546('0x20'),_0x3c7c7d);logger[_0x4546('0xd')](_0x4546('0x20'),_0x3c7c7d,JSON['stringify'](_0x141fe8));_0x480d8e(_0x141fe8);})[_0x4546('0x13')](function(_0x33307f){logger['error'](_0x4546('0x20'),_0x33307f['message'],_0x3c7c7d);_0x5f0226(_0x58b69[_0x4546('0x10')](0x1f4,_0x33307f[_0x4546('0x12')]));});});}; \ No newline at end of file +var _0x32b6=['raw','where','attributes','limit','include','map','model','catch','ShowFreshsalesAccount','find','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','debug','request\x20sent','stringify','error','code','FreshsalesAccount,\x20%s,\x20%s','message','info','GetFreshsalesAccount','FreshsalesAccount','findAll','options'];(function(_0x1aef6b,_0x5b8c20){var _0x4302e2=function(_0x2a4f4b){while(--_0x2a4f4b){_0x1aef6b['push'](_0x1aef6b['shift']());}};_0x4302e2(++_0x5b8c20);}(_0x32b6,0x1d1));var _0x632b=function(_0x231057,_0x253d43){_0x231057=_0x231057-0x0;var _0x1222cc=_0x32b6[_0x231057];return _0x1222cc;};'use strict';var _=require(_0x632b('0x0'));var util=require(_0x632b('0x1'));var moment=require('moment');var BPromise=require(_0x632b('0x2'));var rs=require(_0x632b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x632b('0x4'));var logger=require(_0x632b('0x5'))(_0x632b('0x6'));var config=require(_0x632b('0x7'));var jayson=require(_0x632b('0x8'));var client=jayson[_0x632b('0x9')][_0x632b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x10458a,_0x3bbf43,_0x43d6c7){return new BPromise(function(_0x5128f5,_0x33d711){return client[_0x632b('0xb')](_0x10458a,_0x43d6c7)[_0x632b('0xc')](function(_0x174201){logger['info']('FreshsalesAccount,\x20%s,\x20%s',_0x3bbf43,'request\x20sent');logger[_0x632b('0xd')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x3bbf43,_0x632b('0xe'),JSON[_0x632b('0xf')](_0x174201));if(_0x174201[_0x632b('0x10')]){if(_0x174201[_0x632b('0x10')][_0x632b('0x11')]===0x1f4){logger[_0x632b('0x10')](_0x632b('0x12'),_0x3bbf43,_0x174201[_0x632b('0x10')][_0x632b('0x13')]);return _0x33d711(_0x174201['error'][_0x632b('0x13')]);}logger[_0x632b('0x10')](_0x632b('0x12'),_0x3bbf43,_0x174201['error'][_0x632b('0x13')]);return _0x5128f5(_0x174201[_0x632b('0x10')][_0x632b('0x13')]);}else{logger[_0x632b('0x14')](_0x632b('0x12'),_0x3bbf43,_0x632b('0xe'));_0x5128f5(_0x174201['result'][_0x632b('0x13')]);}})['catch'](function(_0x4fdef2){logger[_0x632b('0x10')]('FreshsalesAccount,\x20%s,\x20%s',_0x3bbf43,_0x4fdef2);_0x33d711(_0x4fdef2);});});}exports[_0x632b('0x15')]=function(_0x3bb27f){var _0x28c472=this;return new Promise(function(_0x51c894,_0x2f3e88){return db[_0x632b('0x16')][_0x632b('0x17')]({'raw':_0x3bb27f[_0x632b('0x18')]?_0x3bb27f['options'][_0x632b('0x19')]===undefined?!![]:![]:!![],'where':_0x3bb27f[_0x632b('0x18')]?_0x3bb27f['options'][_0x632b('0x1a')]||null:null,'attributes':_0x3bb27f['options']?_0x3bb27f['options'][_0x632b('0x1b')]||null:null,'limit':_0x3bb27f['options']?_0x3bb27f[_0x632b('0x18')][_0x632b('0x1c')]||null:null,'include':_0x3bb27f[_0x632b('0x18')]?_0x3bb27f['options'][_0x632b('0x1d')]?_[_0x632b('0x1e')](_0x3bb27f['options'][_0x632b('0x1d')],function(_0x379dc2){return{'model':db[_0x379dc2[_0x632b('0x1f')]],'as':_0x379dc2['as'],'attributes':_0x379dc2[_0x632b('0x1b')],'include':_0x379dc2[_0x632b('0x1d')]?_[_0x632b('0x1e')](_0x379dc2['include'],function(_0x5e7b20){return{'model':db[_0x5e7b20[_0x632b('0x1f')]],'as':_0x5e7b20['as'],'attributes':_0x5e7b20['attributes'],'include':_0x5e7b20[_0x632b('0x1d')]?_[_0x632b('0x1e')](_0x5e7b20['include'],function(_0x273e89){return{'model':db[_0x273e89[_0x632b('0x1f')]],'as':_0x273e89['as'],'attributes':_0x273e89[_0x632b('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x632b('0xc')](function(_0x4728a8){logger[_0x632b('0x14')](_0x632b('0x15'),_0x3bb27f);logger[_0x632b('0xd')](_0x632b('0x15'),_0x3bb27f,JSON['stringify'](_0x4728a8));_0x51c894(_0x4728a8);})[_0x632b('0x20')](function(_0x35348e){logger[_0x632b('0x10')](_0x632b('0x15'),_0x35348e[_0x632b('0x13')],_0x3bb27f);_0x2f3e88(_0x28c472[_0x632b('0x10')](0x1f4,_0x35348e[_0x632b('0x13')]));});});};exports[_0x632b('0x21')]=function(_0x1ace1b){var _0x319df3=this;return new Promise(function(_0x417793,_0x35584f){return db[_0x632b('0x16')][_0x632b('0x22')]({'raw':_0x1ace1b[_0x632b('0x18')]?_0x1ace1b[_0x632b('0x18')][_0x632b('0x19')]===undefined?!![]:![]:!![],'where':_0x1ace1b[_0x632b('0x18')]?_0x1ace1b[_0x632b('0x18')][_0x632b('0x1a')]||null:null,'attributes':_0x1ace1b['options']?_0x1ace1b[_0x632b('0x18')][_0x632b('0x1b')]||null:null,'include':_0x1ace1b[_0x632b('0x18')]?_0x1ace1b[_0x632b('0x18')]['include']?_[_0x632b('0x1e')](_0x1ace1b['options'][_0x632b('0x1d')],function(_0x15b22d){return{'model':db[_0x15b22d['model']],'as':_0x15b22d['as'],'attributes':_0x15b22d[_0x632b('0x1b')],'include':_0x15b22d[_0x632b('0x1d')]?_[_0x632b('0x1e')](_0x15b22d[_0x632b('0x1d')],function(_0x27bbf5){return{'model':db[_0x27bbf5[_0x632b('0x1f')]],'as':_0x27bbf5['as'],'attributes':_0x27bbf5[_0x632b('0x1b')],'include':_0x27bbf5[_0x632b('0x1d')]?_['map'](_0x27bbf5['include'],function(_0x22ae6a){return{'model':db[_0x22ae6a[_0x632b('0x1f')]],'as':_0x22ae6a['as'],'attributes':_0x22ae6a[_0x632b('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x632b('0xc')](function(_0x384420){logger[_0x632b('0x14')](_0x632b('0x21'),_0x1ace1b);logger[_0x632b('0xd')]('ShowFreshsalesAccount',_0x1ace1b,JSON['stringify'](_0x384420));_0x417793(_0x384420);})[_0x632b('0x20')](function(_0x581b92){logger[_0x632b('0x10')](_0x632b('0x21'),_0x581b92[_0x632b('0x13')],_0x1ace1b);_0x35584f(_0x319df3[_0x632b('0x10')](0x1f4,_0x581b92[_0x632b('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index a5ea1eb..d36a9c9 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 _0xab96=['../../components/auth/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','/:id','show','/:id/subjects','getSubjects','getDescriptions','/:id/fields','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x53ed2a,_0x1721a9){var _0x4a2c6e=function(_0x2d215c){while(--_0x2d215c){_0x53ed2a['push'](_0x53ed2a['shift']());}};_0x4a2c6e(++_0x1721a9);}(_0xab96,0x15a));var _0x6ab9=function(_0xded1e4,_0x55da9c){_0xded1e4=_0xded1e4-0x0;var _0x29dc2b=_0xab96[_0xded1e4];return _0x29dc2b;};'use strict';var multer=require(_0x6ab9('0x0'));var util=require(_0x6ab9('0x1'));var path=require(_0x6ab9('0x2'));var timeout=require(_0x6ab9('0x3'));var express=require(_0x6ab9('0x4'));var router=express['Router']();var fs_extra=require(_0x6ab9('0x5'));var auth=require(_0x6ab9('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x6ab9('0x7'));var controller=require(_0x6ab9('0x8'));router[_0x6ab9('0x9')]('/',auth[_0x6ab9('0xa')](),controller['index']);router['get'](_0x6ab9('0xb'),auth[_0x6ab9('0xa')](),controller[_0x6ab9('0xc')]);router[_0x6ab9('0x9')](_0x6ab9('0xd'),auth[_0x6ab9('0xa')](),controller[_0x6ab9('0xe')]);router[_0x6ab9('0x9')]('/:id/descriptions',auth[_0x6ab9('0xa')](),controller[_0x6ab9('0xf')]);router[_0x6ab9('0x9')](_0x6ab9('0x10'),auth[_0x6ab9('0xa')](),controller['getFields']);router['post']('/',auth['isAuthenticated'](),controller[_0x6ab9('0x11')]);router[_0x6ab9('0x12')](_0x6ab9('0xb'),auth[_0x6ab9('0xa')](),controller[_0x6ab9('0x13')]);router['delete'](_0x6ab9('0xb'),auth[_0x6ab9('0xa')](),controller[_0x6ab9('0x14')]);module[_0x6ab9('0x15')]=router; \ No newline at end of file +var _0xcbe8=['getFields','post','create','put','delete','destroy','exports','multer','express','../../config/environment','./intFreshsalesConfiguration.controller','isAuthenticated','/:id','show','get','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/fields'];(function(_0x1fc080,_0xadb20d){var _0x15f3e6=function(_0x3d3eb8){while(--_0x3d3eb8){_0x1fc080['push'](_0x1fc080['shift']());}};_0x15f3e6(++_0xadb20d);}(_0xcbe8,0xf7));var _0x8cbe=function(_0x1c6865,_0x51bfbd){_0x1c6865=_0x1c6865-0x0;var _0x48bf38=_0xcbe8[_0x1c6865];return _0x48bf38;};'use strict';var multer=require(_0x8cbe('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x8cbe('0x1'));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(_0x8cbe('0x2'));var controller=require(_0x8cbe('0x3'));router['get']('/',auth[_0x8cbe('0x4')](),controller['index']);router['get'](_0x8cbe('0x5'),auth[_0x8cbe('0x4')](),controller[_0x8cbe('0x6')]);router[_0x8cbe('0x7')](_0x8cbe('0x8'),auth[_0x8cbe('0x4')](),controller[_0x8cbe('0x9')]);router['get'](_0x8cbe('0xa'),auth[_0x8cbe('0x4')](),controller[_0x8cbe('0xb')]);router['get'](_0x8cbe('0xc'),auth['isAuthenticated'](),controller[_0x8cbe('0xd')]);router[_0x8cbe('0xe')]('/',auth['isAuthenticated'](),controller[_0x8cbe('0xf')]);router[_0x8cbe('0x10')](_0x8cbe('0x5'),auth[_0x8cbe('0x4')](),controller['update']);router[_0x8cbe('0x11')](_0x8cbe('0x5'),auth[_0x8cbe('0x4')](),controller[_0x8cbe('0x12')]);module[_0x8cbe('0x13')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 6439d9c..96b0068 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 _0x301a=['sequelize'];(function(_0x57c82b,_0x508042){var _0x3bec5c=function(_0x6fefc4){while(--_0x6fefc4){_0x57c82b['push'](_0x57c82b['shift']());}};_0x3bec5c(++_0x508042);}(_0x301a,0x1cf));var _0xa301=function(_0x261b5c,_0x16c5ae){_0x261b5c=_0x261b5c-0x0;var _0x4e0eab=_0x301a[_0x261b5c];return _0x4e0eab;};'use strict';var Sequelize=require(_0xa301('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2a9e=['exports','STRING'];(function(_0x795091,_0x4c5bc0){var _0x689e6=function(_0x5060ee){while(--_0x5060ee){_0x795091['push'](_0x795091['shift']());}};_0x689e6(++_0x4c5bc0);}(_0x2a9e,0x14c));var _0xe2a9=function(_0x5e0894,_0x9d17b2){_0x5e0894=_0x5e0894-0x0;var _0xaa7229=_0x2a9e[_0x5e0894];return _0xaa7229;};'use strict';var Sequelize=require('sequelize');module[_0xe2a9('0x0')]={'name':{'type':Sequelize[_0xe2a9('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 2dcee38..7eb4c5b 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 _0x7112=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','type','VIRTUAL','merge','options','include','rows','catch','show','FreshsalesConfiguration','includeAll','find','create','body','params','getSubjects','findOne','FreshsalesField','order','getDescriptions','getFields','eml-format','zip-dir','fast-json-patch','bluebird','mustache','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api'];(function(_0x7f0f0e,_0x41c39b){var _0x5a3ac8=function(_0x50b86e){while(--_0x50b86e){_0x7f0f0e['push'](_0x7f0f0e['shift']());}};_0x5a3ac8(++_0x41c39b);}(_0x7112,0x1d3));var _0x2711=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x7112[_0x502c7d];return _0x30b7ed;};'use strict';var emlformat=require(_0x2711('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2711('0x1'));var jsonpatch=require(_0x2711('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2711('0x3'));var Mustache=require(_0x2711('0x4'));var util=require('util');var path=require(_0x2711('0x5'));var sox=require('sox');var csv=require(_0x2711('0x6'));var ejs=require(_0x2711('0x7'));var fs=require('fs');var fs_extra=require(_0x2711('0x8'));var _=require('lodash');var squel=require(_0x2711('0x9'));var crypto=require(_0x2711('0xa'));var jsforce=require(_0x2711('0xb'));var deskjs=require(_0x2711('0xc'));var toCsv=require('to-csv');var querystring=require(_0x2711('0xd'));var Papa=require(_0x2711('0xe'));var Redis=require('ioredis');var authService=require(_0x2711('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2711('0x10'));var logger=require(_0x2711('0x11'))(_0x2711('0x12'));var utils=require(_0x2711('0x13'));var config=require(_0x2711('0x14'));var licenseUtil=require(_0x2711('0x15'));var db=require(_0x2711('0x16'))['db'];function respondWithStatusCode(_0x3a94fd,_0x3936d2){_0x3936d2=_0x3936d2||0xcc;return function(_0x3d62f0){if(_0x3d62f0){return _0x3a94fd[_0x2711('0x17')](_0x3936d2);}return _0x3a94fd[_0x2711('0x18')](_0x3936d2)[_0x2711('0x19')]();};}function respondWithResult(_0x5eeac9,_0x1594e2){_0x1594e2=_0x1594e2||0xc8;return function(_0x7c2d6d){if(_0x7c2d6d){return _0x5eeac9[_0x2711('0x18')](_0x1594e2)[_0x2711('0x1a')](_0x7c2d6d);}};}function respondWithFilteredResult(_0x9ec76d,_0x648aab){return function(_0x2544fe){if(_0x2544fe){var _0x3c2f02=typeof _0x648aab[_0x2711('0x1b')]===_0x2711('0x1c')&&typeof _0x648aab[_0x2711('0x1d')]===_0x2711('0x1c');var _0x2fc7a6=_0x2544fe[_0x2711('0x1e')];var _0x2aecc7=_0x3c2f02?0x0:_0x648aab[_0x2711('0x1b')];var _0x21885d=_0x3c2f02?_0x2544fe[_0x2711('0x1e')]:_0x648aab[_0x2711('0x1b')]+_0x648aab[_0x2711('0x1d')];var _0x29454a;if(_0x21885d>=_0x2fc7a6){_0x21885d=_0x2fc7a6;_0x29454a=0xc8;}else{_0x29454a=0xce;}_0x9ec76d[_0x2711('0x18')](_0x29454a);return _0x9ec76d[_0x2711('0x1f')](_0x2711('0x20'),_0x2aecc7+'-'+_0x21885d+'/'+_0x2fc7a6)[_0x2711('0x1a')](_0x2544fe);}return null;};}function patchUpdates(_0x1ee9df){return function(_0x14cf6c){try{jsonpatch[_0x2711('0x21')](_0x14cf6c,_0x1ee9df,!![]);}catch(_0xc0b4ec){return BPromise[_0x2711('0x22')](_0xc0b4ec);}return _0x14cf6c[_0x2711('0x23')]();};}function saveUpdates(_0x3bc5f8,_0x398cf8){return function(_0x15e5f3){if(_0x15e5f3){return _0x15e5f3[_0x2711('0x24')](_0x3bc5f8)[_0x2711('0x25')](function(_0x3fa4b6){return _0x3fa4b6;});}return null;};}function removeEntity(_0x3c231c,_0x155255){return function(_0xa898e4){if(_0xa898e4){return _0xa898e4[_0x2711('0x26')]()[_0x2711('0x25')](function(){_0x3c231c[_0x2711('0x18')](0xcc)[_0x2711('0x19')]();});}};}function handleEntityNotFound(_0x5c91f3,_0x1d4c69){return function(_0x4f0f24){if(!_0x4f0f24){_0x5c91f3[_0x2711('0x17')](0x194);}return _0x4f0f24;};}function handleError(_0x1f04ad,_0x4677ea){_0x4677ea=_0x4677ea||0x1f4;return function(_0xdc5a19){logger['error'](_0xdc5a19[_0x2711('0x27')]);if(_0xdc5a19[_0x2711('0x28')]){delete _0xdc5a19[_0x2711('0x28')];}_0x1f04ad[_0x2711('0x18')](_0x4677ea)[_0x2711('0x29')](_0xdc5a19);};}exports[_0x2711('0x2a')]=function(_0x5c0f63,_0x5e7285){var _0x120497={},_0x38d9bd={},_0x5bca6f={'count':0x0,'rows':[]};var _0x9e836c=_[_0x2711('0x2b')](db['FreshsalesConfiguration'][_0x2711('0x2c')],function(_0x2e1893){return{'name':_0x2e1893[_0x2711('0x2d')],'type':_0x2e1893['type'][_0x2711('0x2e')]};});_0x38d9bd[_0x2711('0x2f')]=_[_0x2711('0x2b')](_0x9e836c,_0x2711('0x28'));_0x38d9bd[_0x2711('0x30')]=_[_0x2711('0x31')](_0x5c0f63[_0x2711('0x30')]);_0x38d9bd[_0x2711('0x32')]=_['intersection'](_0x38d9bd[_0x2711('0x2f')],_0x38d9bd[_0x2711('0x30')]);_0x120497[_0x2711('0x33')]=_[_0x2711('0x34')](_0x38d9bd[_0x2711('0x2f')],qs[_0x2711('0x35')](_0x5c0f63[_0x2711('0x30')]['fields']));_0x120497[_0x2711('0x33')]=_0x120497[_0x2711('0x33')][_0x2711('0x36')]?_0x120497[_0x2711('0x33')]:_0x38d9bd[_0x2711('0x2f')];if(!_0x5c0f63[_0x2711('0x30')][_0x2711('0x37')](_0x2711('0x38'))){_0x120497[_0x2711('0x1d')]=qs[_0x2711('0x1d')](_0x5c0f63[_0x2711('0x30')][_0x2711('0x1d')]);_0x120497['offset']=qs[_0x2711('0x1b')](_0x5c0f63[_0x2711('0x30')]['offset']);}_0x120497['order']=qs[_0x2711('0x39')](_0x5c0f63['query'][_0x2711('0x39')]);_0x120497['where']=qs[_0x2711('0x32')](_[_0x2711('0x3a')](_0x5c0f63[_0x2711('0x30')],_0x38d9bd[_0x2711('0x32')]),_0x9e836c);if(_0x5c0f63[_0x2711('0x30')][_0x2711('0x3b')]){_0x120497[_0x2711('0x3c')]=_['merge'](_0x120497[_0x2711('0x3c')],{'$or':_[_0x2711('0x2b')](_0x9e836c,function(_0x54e31b){if(_0x54e31b[_0x2711('0x3d')]!==_0x2711('0x3e')){var _0x4b4ae3={};_0x4b4ae3[_0x54e31b[_0x2711('0x28')]]={'$like':'%'+_0x5c0f63[_0x2711('0x30')][_0x2711('0x3b')]+'%'};return _0x4b4ae3;}})});}_0x120497=_[_0x2711('0x3f')]({},_0x120497,_0x5c0f63[_0x2711('0x40')]);var _0x169a09={'where':_0x120497[_0x2711('0x3c')]};return db['FreshsalesConfiguration']['count'](_0x169a09)[_0x2711('0x25')](function(_0x31f0af){_0x5bca6f[_0x2711('0x1e')]=_0x31f0af;if(_0x5c0f63[_0x2711('0x30')]['includeAll']){_0x120497[_0x2711('0x41')]=[{'all':!![]}];}return db['FreshsalesConfiguration']['findAll'](_0x120497);})['then'](function(_0x1d15bf){_0x5bca6f[_0x2711('0x42')]=_0x1d15bf;return _0x5bca6f;})[_0x2711('0x25')](respondWithFilteredResult(_0x5e7285,_0x120497))[_0x2711('0x43')](handleError(_0x5e7285,null));};exports[_0x2711('0x44')]=function(_0x45ad67,_0x5403e6){var _0x5a851d={'raw':![],'where':{'id':_0x45ad67['params']['id']}},_0x2e18a5={};_0x2e18a5[_0x2711('0x2f')]=_['keys'](db[_0x2711('0x45')]['rawAttributes']);_0x2e18a5[_0x2711('0x30')]=_[_0x2711('0x31')](_0x45ad67[_0x2711('0x30')]);_0x2e18a5[_0x2711('0x32')]=_[_0x2711('0x34')](_0x2e18a5['model'],_0x2e18a5[_0x2711('0x30')]);_0x5a851d['attributes']=_[_0x2711('0x34')](_0x2e18a5[_0x2711('0x2f')],qs[_0x2711('0x35')](_0x45ad67['query'][_0x2711('0x35')]));_0x5a851d['attributes']=_0x5a851d[_0x2711('0x33')]['length']?_0x5a851d[_0x2711('0x33')]:_0x2e18a5['model'];if(_0x45ad67[_0x2711('0x30')][_0x2711('0x46')]){_0x5a851d[_0x2711('0x41')]=[{'all':!![]}];}_0x5a851d=_[_0x2711('0x3f')]({},_0x5a851d,_0x45ad67[_0x2711('0x40')]);return db[_0x2711('0x45')][_0x2711('0x47')](_0x5a851d)['then'](handleEntityNotFound(_0x5403e6,null))[_0x2711('0x25')](respondWithResult(_0x5403e6,null))[_0x2711('0x43')](handleError(_0x5403e6,null));};exports['create']=function(_0x350e5f,_0x4b7b1e){return db[_0x2711('0x45')][_0x2711('0x48')](_0x350e5f[_0x2711('0x49')],{})['then'](respondWithResult(_0x4b7b1e,0xc9))[_0x2711('0x43')](handleError(_0x4b7b1e,null));};exports[_0x2711('0x24')]=function(_0x2f8f55,_0x455744){if(_0x2f8f55[_0x2711('0x49')]['id']){delete _0x2f8f55[_0x2711('0x49')]['id'];}return db[_0x2711('0x45')]['find']({'where':{'id':_0x2f8f55['params']['id']}})['then'](handleEntityNotFound(_0x455744,null))['then'](saveUpdates(_0x2f8f55[_0x2711('0x49')],null))['then'](respondWithResult(_0x455744,null))[_0x2711('0x43')](handleError(_0x455744,null));};exports[_0x2711('0x26')]=function(_0x4b7c0c,_0x1f2308){return db[_0x2711('0x45')][_0x2711('0x47')]({'where':{'id':_0x4b7c0c[_0x2711('0x4a')]['id']}})[_0x2711('0x25')](handleEntityNotFound(_0x1f2308,null))[_0x2711('0x25')](removeEntity(_0x1f2308,null))[_0x2711('0x43')](handleError(_0x1f2308,null));};exports[_0x2711('0x4b')]=function(_0x174830,_0x269039,_0x3b890d){var _0x49ffac={};var _0x1bdbfb={};var _0x1ddee6;var _0x3f4ab3;return db[_0x2711('0x45')][_0x2711('0x4c')]({'where':{'id':_0x174830[_0x2711('0x4a')]['id']}})[_0x2711('0x25')](handleEntityNotFound(_0x269039,null))['then'](function(_0xe4a2ad){if(_0xe4a2ad){_0x1ddee6=_0xe4a2ad;_0x1bdbfb[_0x2711('0x2f')]=_['keys'](db[_0x2711('0x4d')]['rawAttributes']);_0x1bdbfb[_0x2711('0x30')]=_[_0x2711('0x31')](_0x174830['query']);_0x1bdbfb[_0x2711('0x32')]=_[_0x2711('0x34')](_0x1bdbfb['model'],_0x1bdbfb[_0x2711('0x30')]);_0x49ffac['attributes']=_[_0x2711('0x34')](_0x1bdbfb[_0x2711('0x2f')],qs[_0x2711('0x35')](_0x174830['query']['fields']));_0x49ffac[_0x2711('0x33')]=_0x49ffac[_0x2711('0x33')]['length']?_0x49ffac[_0x2711('0x33')]:_0x1bdbfb[_0x2711('0x2f')];_0x49ffac[_0x2711('0x4e')]=qs[_0x2711('0x39')](_0x174830[_0x2711('0x30')]['sort']);_0x49ffac['where']=qs[_0x2711('0x32')](_[_0x2711('0x3a')](_0x174830[_0x2711('0x30')],_0x1bdbfb[_0x2711('0x32')]));if(_0x174830[_0x2711('0x30')][_0x2711('0x3b')]){_0x49ffac['where']=_[_0x2711('0x3f')](_0x49ffac[_0x2711('0x3c')],{'$or':_['map'](_0x49ffac[_0x2711('0x33')],function(_0x1c0a2a){var _0x454030={};_0x454030[_0x1c0a2a]={'$like':'%'+_0x174830['query'][_0x2711('0x3b')]+'%'};return _0x454030;})});}_0x49ffac=_[_0x2711('0x3f')]({},_0x49ffac,_0x174830[_0x2711('0x40')]);return _0x1ddee6[_0x2711('0x4b')](_0x49ffac);}})[_0x2711('0x25')](function(_0x10bb72){if(_0x10bb72){_0x3f4ab3=_0x10bb72[_0x2711('0x36')];if(!_0x174830[_0x2711('0x30')][_0x2711('0x37')]('nolimit')){_0x49ffac[_0x2711('0x1d')]=qs[_0x2711('0x1d')](_0x174830[_0x2711('0x30')][_0x2711('0x1d')]);_0x49ffac['offset']=qs['offset'](_0x174830[_0x2711('0x30')][_0x2711('0x1b')]);}return _0x1ddee6[_0x2711('0x4b')](_0x49ffac);}})[_0x2711('0x25')](function(_0x2f0578){if(_0x2f0578){return _0x2f0578?{'count':_0x3f4ab3,'rows':_0x2f0578}:null;}})[_0x2711('0x25')](respondWithResult(_0x269039,null))[_0x2711('0x43')](handleError(_0x269039,null));};exports['getDescriptions']=function(_0x1e8df8,_0x2ec374,_0x540006){var _0x5e82b9={};var _0x48510d={};var _0x4a427e;var _0x121d1e;return db[_0x2711('0x45')][_0x2711('0x4c')]({'where':{'id':_0x1e8df8[_0x2711('0x4a')]['id']}})[_0x2711('0x25')](handleEntityNotFound(_0x2ec374,null))[_0x2711('0x25')](function(_0x430c51){if(_0x430c51){_0x4a427e=_0x430c51;_0x48510d['model']=_[_0x2711('0x31')](db[_0x2711('0x4d')]['rawAttributes']);_0x48510d[_0x2711('0x30')]=_['keys'](_0x1e8df8[_0x2711('0x30')]);_0x48510d[_0x2711('0x32')]=_[_0x2711('0x34')](_0x48510d[_0x2711('0x2f')],_0x48510d[_0x2711('0x30')]);_0x5e82b9[_0x2711('0x33')]=_[_0x2711('0x34')](_0x48510d[_0x2711('0x2f')],qs[_0x2711('0x35')](_0x1e8df8[_0x2711('0x30')][_0x2711('0x35')]));_0x5e82b9[_0x2711('0x33')]=_0x5e82b9['attributes']['length']?_0x5e82b9['attributes']:_0x48510d[_0x2711('0x2f')];_0x5e82b9[_0x2711('0x4e')]=qs[_0x2711('0x39')](_0x1e8df8[_0x2711('0x30')][_0x2711('0x39')]);_0x5e82b9[_0x2711('0x3c')]=qs[_0x2711('0x32')](_[_0x2711('0x3a')](_0x1e8df8[_0x2711('0x30')],_0x48510d[_0x2711('0x32')]));if(_0x1e8df8[_0x2711('0x30')][_0x2711('0x3b')]){_0x5e82b9[_0x2711('0x3c')]=_[_0x2711('0x3f')](_0x5e82b9[_0x2711('0x3c')],{'$or':_[_0x2711('0x2b')](_0x5e82b9[_0x2711('0x33')],function(_0x27d901){var _0x215542={};_0x215542[_0x27d901]={'$like':'%'+_0x1e8df8[_0x2711('0x30')][_0x2711('0x3b')]+'%'};return _0x215542;})});}_0x5e82b9=_[_0x2711('0x3f')]({},_0x5e82b9,_0x1e8df8[_0x2711('0x40')]);return _0x4a427e[_0x2711('0x4f')](_0x5e82b9);}})[_0x2711('0x25')](function(_0x5a996d){if(_0x5a996d){_0x121d1e=_0x5a996d[_0x2711('0x36')];if(!_0x1e8df8['query'][_0x2711('0x37')]('nolimit')){_0x5e82b9[_0x2711('0x1d')]=qs[_0x2711('0x1d')](_0x1e8df8[_0x2711('0x30')][_0x2711('0x1d')]);_0x5e82b9[_0x2711('0x1b')]=qs[_0x2711('0x1b')](_0x1e8df8[_0x2711('0x30')][_0x2711('0x1b')]);}return _0x4a427e[_0x2711('0x4f')](_0x5e82b9);}})['then'](function(_0x14e08a){if(_0x14e08a){return _0x14e08a?{'count':_0x121d1e,'rows':_0x14e08a}:null;}})[_0x2711('0x25')](respondWithResult(_0x2ec374,null))[_0x2711('0x43')](handleError(_0x2ec374,null));};exports[_0x2711('0x50')]=function(_0x33420e,_0x3605c2,_0x721e16){var _0x40bdd7={};var _0x2ad33e={};var _0x540a5a;var _0x41d968;return db['FreshsalesConfiguration']['findOne']({'where':{'id':_0x33420e['params']['id']}})[_0x2711('0x25')](handleEntityNotFound(_0x3605c2,null))[_0x2711('0x25')](function(_0xd69448){if(_0xd69448){_0x540a5a=_0xd69448;_0x2ad33e[_0x2711('0x2f')]=_['keys'](db['FreshsalesField'][_0x2711('0x2c')]);_0x2ad33e[_0x2711('0x30')]=_[_0x2711('0x31')](_0x33420e[_0x2711('0x30')]);_0x2ad33e[_0x2711('0x32')]=_['intersection'](_0x2ad33e[_0x2711('0x2f')],_0x2ad33e[_0x2711('0x30')]);_0x40bdd7[_0x2711('0x33')]=_[_0x2711('0x34')](_0x2ad33e['model'],qs[_0x2711('0x35')](_0x33420e[_0x2711('0x30')][_0x2711('0x35')]));_0x40bdd7[_0x2711('0x33')]=_0x40bdd7[_0x2711('0x33')]['length']?_0x40bdd7[_0x2711('0x33')]:_0x2ad33e[_0x2711('0x2f')];_0x40bdd7['order']=qs[_0x2711('0x39')](_0x33420e['query'][_0x2711('0x39')]);_0x40bdd7[_0x2711('0x3c')]=qs[_0x2711('0x32')](_[_0x2711('0x3a')](_0x33420e[_0x2711('0x30')],_0x2ad33e['filters']));if(_0x33420e[_0x2711('0x30')][_0x2711('0x3b')]){_0x40bdd7['where']=_[_0x2711('0x3f')](_0x40bdd7[_0x2711('0x3c')],{'$or':_[_0x2711('0x2b')](_0x40bdd7[_0x2711('0x33')],function(_0x44bff4){var _0x286669={};_0x286669[_0x44bff4]={'$like':'%'+_0x33420e[_0x2711('0x30')][_0x2711('0x3b')]+'%'};return _0x286669;})});}_0x40bdd7=_['merge']({},_0x40bdd7,_0x33420e[_0x2711('0x40')]);return _0x540a5a[_0x2711('0x50')](_0x40bdd7);}})[_0x2711('0x25')](function(_0x5bd974){if(_0x5bd974){_0x41d968=_0x5bd974['length'];if(!_0x33420e['query']['hasOwnProperty']('nolimit')){_0x40bdd7[_0x2711('0x1d')]=qs[_0x2711('0x1d')](_0x33420e[_0x2711('0x30')]['limit']);_0x40bdd7[_0x2711('0x1b')]=qs[_0x2711('0x1b')](_0x33420e[_0x2711('0x30')][_0x2711('0x1b')]);}return _0x540a5a[_0x2711('0x50')](_0x40bdd7);}})[_0x2711('0x25')](function(_0x4827fd){if(_0x4827fd){return _0x4827fd?{'count':_0x41d968,'rows':_0x4827fd}:null;}})[_0x2711('0x25')](respondWithResult(_0x3605c2,null))['catch'](handleError(_0x3605c2,null));}; \ No newline at end of file +var _0x882c=['options','includeAll','include','rows','catch','show','rawAttributes','find','create','body','update','getSubjects','findOne','params','FreshsalesField','pick','nolimit','getDescriptions','getFields','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','Content-Range','json','apply','reject','save','then','destroy','error','stack','name','send','index','map','FreshsalesConfiguration','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','VIRTUAL','merge'];(function(_0xf79774,_0x2d4d4e){var _0x3bd76d=function(_0x390ad1){while(--_0x390ad1){_0xf79774['push'](_0xf79774['shift']());}};_0x3bd76d(++_0x2d4d4e);}(_0x882c,0xfd));var _0xc882=function(_0x37f212,_0x9bf1b2){_0x37f212=_0x37f212-0x0;var _0x57ba32=_0x882c[_0x37f212];return _0x57ba32;};'use strict';var emlformat=require(_0xc882('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc882('0x1'));var rp=require(_0xc882('0x2'));var moment=require('moment');var BPromise=require(_0xc882('0x3'));var Mustache=require(_0xc882('0x4'));var util=require(_0xc882('0x5'));var path=require(_0xc882('0x6'));var sox=require(_0xc882('0x7'));var csv=require(_0xc882('0x8'));var ejs=require(_0xc882('0x9'));var fs=require('fs');var fs_extra=require(_0xc882('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xc882('0x8'));var querystring=require(_0xc882('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xc882('0xc'));var qs=require(_0xc882('0xd'));var as=require(_0xc882('0xe'));var hardwareService=require(_0xc882('0xf'));var logger=require(_0xc882('0x10'))('api');var utils=require(_0xc882('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0xc882('0x12'));var db=require(_0xc882('0x13'))['db'];function respondWithStatusCode(_0x333cdb,_0x10d0ad){_0x10d0ad=_0x10d0ad||0xcc;return function(_0x12ebc4){if(_0x12ebc4){return _0x333cdb[_0xc882('0x14')](_0x10d0ad);}return _0x333cdb[_0xc882('0x15')](_0x10d0ad)[_0xc882('0x16')]();};}function respondWithResult(_0x5d1370,_0x19541f){_0x19541f=_0x19541f||0xc8;return function(_0x48ddb2){if(_0x48ddb2){return _0x5d1370[_0xc882('0x15')](_0x19541f)['json'](_0x48ddb2);}};}function respondWithFilteredResult(_0x2bcaeb,_0x4e41d0){return function(_0x6a3def){if(_0x6a3def){var _0x1046ed=typeof _0x4e41d0[_0xc882('0x17')]==='undefined'&&typeof _0x4e41d0[_0xc882('0x18')]===_0xc882('0x19');var _0x252e94=_0x6a3def['count'];var _0x1449f6=_0x1046ed?0x0:_0x4e41d0['offset'];var _0x3b499e=_0x1046ed?_0x6a3def[_0xc882('0x1a')]:_0x4e41d0[_0xc882('0x17')]+_0x4e41d0[_0xc882('0x18')];var _0x38389d;if(_0x3b499e>=_0x252e94){_0x3b499e=_0x252e94;_0x38389d=0xc8;}else{_0x38389d=0xce;}_0x2bcaeb['status'](_0x38389d);return _0x2bcaeb['set'](_0xc882('0x1b'),_0x1449f6+'-'+_0x3b499e+'/'+_0x252e94)[_0xc882('0x1c')](_0x6a3def);}return null;};}function patchUpdates(_0x11ba3f){return function(_0x5524b8){try{jsonpatch[_0xc882('0x1d')](_0x5524b8,_0x11ba3f,!![]);}catch(_0x46fbcd){return BPromise[_0xc882('0x1e')](_0x46fbcd);}return _0x5524b8[_0xc882('0x1f')]();};}function saveUpdates(_0x3873f5,_0xe572a9){return function(_0x278952){if(_0x278952){return _0x278952['update'](_0x3873f5)[_0xc882('0x20')](function(_0x52b144){return _0x52b144;});}return null;};}function removeEntity(_0x65fd38,_0x4373dc){return function(_0x4bb2fa){if(_0x4bb2fa){return _0x4bb2fa[_0xc882('0x21')]()['then'](function(){_0x65fd38[_0xc882('0x15')](0xcc)[_0xc882('0x16')]();});}};}function handleEntityNotFound(_0x5ca8d6,_0x4278d2){return function(_0x2b0059){if(!_0x2b0059){_0x5ca8d6[_0xc882('0x14')](0x194);}return _0x2b0059;};}function handleError(_0x5c01ed,_0x5e5ab5){_0x5e5ab5=_0x5e5ab5||0x1f4;return function(_0x2d3359){logger[_0xc882('0x22')](_0x2d3359[_0xc882('0x23')]);if(_0x2d3359[_0xc882('0x24')]){delete _0x2d3359[_0xc882('0x24')];}_0x5c01ed[_0xc882('0x15')](_0x5e5ab5)[_0xc882('0x25')](_0x2d3359);};}exports[_0xc882('0x26')]=function(_0x1cc62c,_0x3d9828){var _0x30f86a={},_0x3642ba={},_0x25eb21={'count':0x0,'rows':[]};var _0x572faf=_[_0xc882('0x27')](db[_0xc882('0x28')]['rawAttributes'],function(_0x33f25b){return{'name':_0x33f25b[_0xc882('0x29')],'type':_0x33f25b[_0xc882('0x2a')][_0xc882('0x2b')]};});_0x3642ba[_0xc882('0x2c')]=_[_0xc882('0x27')](_0x572faf,_0xc882('0x24'));_0x3642ba['query']=_[_0xc882('0x2d')](_0x1cc62c[_0xc882('0x2e')]);_0x3642ba[_0xc882('0x2f')]=_[_0xc882('0x30')](_0x3642ba['model'],_0x3642ba['query']);_0x30f86a[_0xc882('0x31')]=_['intersection'](_0x3642ba[_0xc882('0x2c')],qs[_0xc882('0x32')](_0x1cc62c[_0xc882('0x2e')][_0xc882('0x32')]));_0x30f86a[_0xc882('0x31')]=_0x30f86a['attributes'][_0xc882('0x33')]?_0x30f86a[_0xc882('0x31')]:_0x3642ba[_0xc882('0x2c')];if(!_0x1cc62c['query'][_0xc882('0x34')]('nolimit')){_0x30f86a[_0xc882('0x18')]=qs[_0xc882('0x18')](_0x1cc62c[_0xc882('0x2e')]['limit']);_0x30f86a[_0xc882('0x17')]=qs[_0xc882('0x17')](_0x1cc62c[_0xc882('0x2e')]['offset']);}_0x30f86a[_0xc882('0x35')]=qs[_0xc882('0x36')](_0x1cc62c['query'][_0xc882('0x36')]);_0x30f86a[_0xc882('0x37')]=qs[_0xc882('0x2f')](_['pick'](_0x1cc62c['query'],_0x3642ba[_0xc882('0x2f')]),_0x572faf);if(_0x1cc62c[_0xc882('0x2e')][_0xc882('0x38')]){_0x30f86a[_0xc882('0x37')]=_['merge'](_0x30f86a[_0xc882('0x37')],{'$or':_[_0xc882('0x27')](_0x572faf,function(_0x4f0cb0){if(_0x4f0cb0['type']!==_0xc882('0x39')){var _0x511dfd={};_0x511dfd[_0x4f0cb0[_0xc882('0x24')]]={'$like':'%'+_0x1cc62c['query'][_0xc882('0x38')]+'%'};return _0x511dfd;}})});}_0x30f86a=_[_0xc882('0x3a')]({},_0x30f86a,_0x1cc62c[_0xc882('0x3b')]);var _0x54c6cf={'where':_0x30f86a[_0xc882('0x37')]};return db[_0xc882('0x28')][_0xc882('0x1a')](_0x54c6cf)[_0xc882('0x20')](function(_0x130f20){_0x25eb21[_0xc882('0x1a')]=_0x130f20;if(_0x1cc62c[_0xc882('0x2e')][_0xc882('0x3c')]){_0x30f86a[_0xc882('0x3d')]=[{'all':!![]}];}return db[_0xc882('0x28')]['findAll'](_0x30f86a);})[_0xc882('0x20')](function(_0x1ee1c8){_0x25eb21[_0xc882('0x3e')]=_0x1ee1c8;return _0x25eb21;})[_0xc882('0x20')](respondWithFilteredResult(_0x3d9828,_0x30f86a))[_0xc882('0x3f')](handleError(_0x3d9828,null));};exports[_0xc882('0x40')]=function(_0x1aaa04,_0x73868e){var _0x3934f7={'raw':![],'where':{'id':_0x1aaa04['params']['id']}},_0x1b0239={};_0x1b0239[_0xc882('0x2c')]=_[_0xc882('0x2d')](db['FreshsalesConfiguration'][_0xc882('0x41')]);_0x1b0239[_0xc882('0x2e')]=_[_0xc882('0x2d')](_0x1aaa04[_0xc882('0x2e')]);_0x1b0239[_0xc882('0x2f')]=_[_0xc882('0x30')](_0x1b0239['model'],_0x1b0239['query']);_0x3934f7[_0xc882('0x31')]=_[_0xc882('0x30')](_0x1b0239[_0xc882('0x2c')],qs[_0xc882('0x32')](_0x1aaa04[_0xc882('0x2e')]['fields']));_0x3934f7['attributes']=_0x3934f7[_0xc882('0x31')]['length']?_0x3934f7['attributes']:_0x1b0239['model'];if(_0x1aaa04[_0xc882('0x2e')][_0xc882('0x3c')]){_0x3934f7[_0xc882('0x3d')]=[{'all':!![]}];}_0x3934f7=_[_0xc882('0x3a')]({},_0x3934f7,_0x1aaa04[_0xc882('0x3b')]);return db[_0xc882('0x28')][_0xc882('0x42')](_0x3934f7)[_0xc882('0x20')](handleEntityNotFound(_0x73868e,null))[_0xc882('0x20')](respondWithResult(_0x73868e,null))[_0xc882('0x3f')](handleError(_0x73868e,null));};exports[_0xc882('0x43')]=function(_0x2c722e,_0x3fc7a6){return db[_0xc882('0x28')][_0xc882('0x43')](_0x2c722e[_0xc882('0x44')],{})[_0xc882('0x20')](respondWithResult(_0x3fc7a6,0xc9))[_0xc882('0x3f')](handleError(_0x3fc7a6,null));};exports[_0xc882('0x45')]=function(_0x346d15,_0x1adc7c){if(_0x346d15[_0xc882('0x44')]['id']){delete _0x346d15[_0xc882('0x44')]['id'];}return db[_0xc882('0x28')][_0xc882('0x42')]({'where':{'id':_0x346d15['params']['id']}})['then'](handleEntityNotFound(_0x1adc7c,null))[_0xc882('0x20')](saveUpdates(_0x346d15[_0xc882('0x44')],null))[_0xc882('0x20')](respondWithResult(_0x1adc7c,null))[_0xc882('0x3f')](handleError(_0x1adc7c,null));};exports[_0xc882('0x21')]=function(_0x437302,_0x51cf8d){return db[_0xc882('0x28')]['find']({'where':{'id':_0x437302['params']['id']}})['then'](handleEntityNotFound(_0x51cf8d,null))[_0xc882('0x20')](removeEntity(_0x51cf8d,null))[_0xc882('0x3f')](handleError(_0x51cf8d,null));};exports[_0xc882('0x46')]=function(_0xdeab83,_0x445103,_0x2b7801){var _0x522111={};var _0x5c9b32={};var _0x46253e;var _0x215523;return db[_0xc882('0x28')][_0xc882('0x47')]({'where':{'id':_0xdeab83[_0xc882('0x48')]['id']}})[_0xc882('0x20')](handleEntityNotFound(_0x445103,null))['then'](function(_0x4468d3){if(_0x4468d3){_0x46253e=_0x4468d3;_0x5c9b32[_0xc882('0x2c')]=_[_0xc882('0x2d')](db[_0xc882('0x49')][_0xc882('0x41')]);_0x5c9b32['query']=_['keys'](_0xdeab83['query']);_0x5c9b32[_0xc882('0x2f')]=_[_0xc882('0x30')](_0x5c9b32[_0xc882('0x2c')],_0x5c9b32[_0xc882('0x2e')]);_0x522111[_0xc882('0x31')]=_['intersection'](_0x5c9b32[_0xc882('0x2c')],qs[_0xc882('0x32')](_0xdeab83[_0xc882('0x2e')]['fields']));_0x522111[_0xc882('0x31')]=_0x522111[_0xc882('0x31')][_0xc882('0x33')]?_0x522111['attributes']:_0x5c9b32['model'];_0x522111[_0xc882('0x35')]=qs[_0xc882('0x36')](_0xdeab83[_0xc882('0x2e')][_0xc882('0x36')]);_0x522111[_0xc882('0x37')]=qs['filters'](_[_0xc882('0x4a')](_0xdeab83[_0xc882('0x2e')],_0x5c9b32[_0xc882('0x2f')]));if(_0xdeab83[_0xc882('0x2e')][_0xc882('0x38')]){_0x522111['where']=_[_0xc882('0x3a')](_0x522111[_0xc882('0x37')],{'$or':_['map'](_0x522111[_0xc882('0x31')],function(_0x3baa51){var _0x41bf67={};_0x41bf67[_0x3baa51]={'$like':'%'+_0xdeab83[_0xc882('0x2e')][_0xc882('0x38')]+'%'};return _0x41bf67;})});}_0x522111=_[_0xc882('0x3a')]({},_0x522111,_0xdeab83['options']);return _0x46253e[_0xc882('0x46')](_0x522111);}})[_0xc882('0x20')](function(_0x37732a){if(_0x37732a){_0x215523=_0x37732a[_0xc882('0x33')];if(!_0xdeab83[_0xc882('0x2e')][_0xc882('0x34')](_0xc882('0x4b'))){_0x522111['limit']=qs['limit'](_0xdeab83[_0xc882('0x2e')][_0xc882('0x18')]);_0x522111['offset']=qs['offset'](_0xdeab83[_0xc882('0x2e')][_0xc882('0x17')]);}return _0x46253e['getSubjects'](_0x522111);}})[_0xc882('0x20')](function(_0x5ea4f5){if(_0x5ea4f5){return _0x5ea4f5?{'count':_0x215523,'rows':_0x5ea4f5}:null;}})[_0xc882('0x20')](respondWithResult(_0x445103,null))[_0xc882('0x3f')](handleError(_0x445103,null));};exports[_0xc882('0x4c')]=function(_0x5e080f,_0x1b634e,_0x35d6b5){var _0x202c1d={};var _0x49a2f8={};var _0x59b78b;var _0x182947;return db[_0xc882('0x28')]['findOne']({'where':{'id':_0x5e080f[_0xc882('0x48')]['id']}})[_0xc882('0x20')](handleEntityNotFound(_0x1b634e,null))[_0xc882('0x20')](function(_0xd30623){if(_0xd30623){_0x59b78b=_0xd30623;_0x49a2f8[_0xc882('0x2c')]=_[_0xc882('0x2d')](db[_0xc882('0x49')][_0xc882('0x41')]);_0x49a2f8[_0xc882('0x2e')]=_[_0xc882('0x2d')](_0x5e080f[_0xc882('0x2e')]);_0x49a2f8[_0xc882('0x2f')]=_[_0xc882('0x30')](_0x49a2f8['model'],_0x49a2f8[_0xc882('0x2e')]);_0x202c1d[_0xc882('0x31')]=_[_0xc882('0x30')](_0x49a2f8[_0xc882('0x2c')],qs[_0xc882('0x32')](_0x5e080f['query'][_0xc882('0x32')]));_0x202c1d[_0xc882('0x31')]=_0x202c1d[_0xc882('0x31')]['length']?_0x202c1d[_0xc882('0x31')]:_0x49a2f8[_0xc882('0x2c')];_0x202c1d[_0xc882('0x35')]=qs[_0xc882('0x36')](_0x5e080f[_0xc882('0x2e')][_0xc882('0x36')]);_0x202c1d['where']=qs[_0xc882('0x2f')](_[_0xc882('0x4a')](_0x5e080f[_0xc882('0x2e')],_0x49a2f8[_0xc882('0x2f')]));if(_0x5e080f[_0xc882('0x2e')][_0xc882('0x38')]){_0x202c1d[_0xc882('0x37')]=_[_0xc882('0x3a')](_0x202c1d[_0xc882('0x37')],{'$or':_[_0xc882('0x27')](_0x202c1d['attributes'],function(_0x135092){var _0x1a18b9={};_0x1a18b9[_0x135092]={'$like':'%'+_0x5e080f[_0xc882('0x2e')][_0xc882('0x38')]+'%'};return _0x1a18b9;})});}_0x202c1d=_[_0xc882('0x3a')]({},_0x202c1d,_0x5e080f['options']);return _0x59b78b[_0xc882('0x4c')](_0x202c1d);}})[_0xc882('0x20')](function(_0x711dce){if(_0x711dce){_0x182947=_0x711dce[_0xc882('0x33')];if(!_0x5e080f[_0xc882('0x2e')][_0xc882('0x34')](_0xc882('0x4b'))){_0x202c1d[_0xc882('0x18')]=qs[_0xc882('0x18')](_0x5e080f[_0xc882('0x2e')][_0xc882('0x18')]);_0x202c1d[_0xc882('0x17')]=qs[_0xc882('0x17')](_0x5e080f['query']['offset']);}return _0x59b78b[_0xc882('0x4c')](_0x202c1d);}})[_0xc882('0x20')](function(_0x226fd7){if(_0x226fd7){return _0x226fd7?{'count':_0x182947,'rows':_0x226fd7}:null;}})['then'](respondWithResult(_0x1b634e,null))[_0xc882('0x3f')](handleError(_0x1b634e,null));};exports['getFields']=function(_0x52288d,_0x42478f,_0x1ddada){var _0x56f21c={};var _0x531f31={};var _0x5cecba;var _0x5303e0;return db[_0xc882('0x28')][_0xc882('0x47')]({'where':{'id':_0x52288d[_0xc882('0x48')]['id']}})[_0xc882('0x20')](handleEntityNotFound(_0x42478f,null))[_0xc882('0x20')](function(_0x2f26d8){if(_0x2f26d8){_0x5cecba=_0x2f26d8;_0x531f31[_0xc882('0x2c')]=_['keys'](db[_0xc882('0x49')][_0xc882('0x41')]);_0x531f31[_0xc882('0x2e')]=_[_0xc882('0x2d')](_0x52288d[_0xc882('0x2e')]);_0x531f31[_0xc882('0x2f')]=_[_0xc882('0x30')](_0x531f31[_0xc882('0x2c')],_0x531f31['query']);_0x56f21c[_0xc882('0x31')]=_[_0xc882('0x30')](_0x531f31['model'],qs[_0xc882('0x32')](_0x52288d['query'][_0xc882('0x32')]));_0x56f21c[_0xc882('0x31')]=_0x56f21c[_0xc882('0x31')]['length']?_0x56f21c['attributes']:_0x531f31['model'];_0x56f21c[_0xc882('0x35')]=qs[_0xc882('0x36')](_0x52288d[_0xc882('0x2e')][_0xc882('0x36')]);_0x56f21c[_0xc882('0x37')]=qs['filters'](_[_0xc882('0x4a')](_0x52288d[_0xc882('0x2e')],_0x531f31[_0xc882('0x2f')]));if(_0x52288d[_0xc882('0x2e')][_0xc882('0x38')]){_0x56f21c[_0xc882('0x37')]=_[_0xc882('0x3a')](_0x56f21c['where'],{'$or':_[_0xc882('0x27')](_0x56f21c['attributes'],function(_0x1cea29){var _0x398d4f={};_0x398d4f[_0x1cea29]={'$like':'%'+_0x52288d[_0xc882('0x2e')][_0xc882('0x38')]+'%'};return _0x398d4f;})});}_0x56f21c=_[_0xc882('0x3a')]({},_0x56f21c,_0x52288d['options']);return _0x5cecba['getFields'](_0x56f21c);}})[_0xc882('0x20')](function(_0x44114c){if(_0x44114c){_0x5303e0=_0x44114c['length'];if(!_0x52288d[_0xc882('0x2e')][_0xc882('0x34')]('nolimit')){_0x56f21c[_0xc882('0x18')]=qs[_0xc882('0x18')](_0x52288d[_0xc882('0x2e')][_0xc882('0x18')]);_0x56f21c[_0xc882('0x17')]=qs[_0xc882('0x17')](_0x52288d[_0xc882('0x2e')][_0xc882('0x17')]);}return _0x5cecba[_0xc882('0x4d')](_0x56f21c);}})[_0xc882('0x20')](function(_0x27b975){if(_0x27b975){return _0x27b975?{'count':_0x5303e0,'rows':_0x27b975}:null;}})[_0xc882('0x20')](respondWithResult(_0x42478f,null))['catch'](handleError(_0x42478f,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 44b643e..f922916 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 _0x9493=['request-promise','path','rimraf','./intFreshsalesConfiguration.attributes','exports','FreshsalesConfiguration','int_freshsales_configurations','lodash','api','moment','bluebird'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0x9493,0xee));var _0x3949=function(_0x1e5631,_0x2fe6f2){_0x1e5631=_0x1e5631-0x0;var _0x3e1c7d=_0x9493[_0x1e5631];return _0x3e1c7d;};'use strict';var _=require(_0x3949('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3949('0x1'));var moment=require(_0x3949('0x2'));var BPromise=require(_0x3949('0x3'));var rp=require(_0x3949('0x4'));var fs=require('fs');var path=require(_0x3949('0x5'));var rimraf=require(_0x3949('0x6'));var config=require('../../config/environment');var attributes=require(_0x3949('0x7'));module[_0x3949('0x8')]=function(_0x11de4c,_0x4bca10){return _0x11de4c['define'](_0x3949('0x9'),attributes,{'tableName':_0x3949('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfccf=['int_freshsales_configurations','lodash','util','api','bluebird','request-promise','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration'];(function(_0x4f34d8,_0x40f022){var _0xc97536=function(_0xef9dfc){while(--_0xef9dfc){_0x4f34d8['push'](_0x4f34d8['shift']());}};_0xc97536(++_0x40f022);}(_0xfccf,0x115));var _0xffcc=function(_0x5ad51e,_0x3aec2f){_0x5ad51e=_0x5ad51e-0x0;var _0xbbec83=_0xfccf[_0x5ad51e];return _0xbbec83;};'use strict';var _=require(_0xffcc('0x0'));var util=require(_0xffcc('0x1'));var logger=require('../../config/logger')(_0xffcc('0x2'));var moment=require('moment');var BPromise=require(_0xffcc('0x3'));var rp=require(_0xffcc('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xffcc('0x5'));var config=require(_0xffcc('0x6'));var attributes=require(_0xffcc('0x7'));module[_0xffcc('0x8')]=function(_0x2b8d2d,_0x5ee326){return _0x2b8d2d[_0xffcc('0x9')](_0xffcc('0xa'),attributes,{'tableName':_0xffcc('0xb'),'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 68830aa..075c737 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 _0x86a7=['rpc','jayson/promise','client','request','then','FreshsalesConfiguration,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x86a7,0x6b));var _0x786a=function(_0x371b64,_0x67b4bb){_0x371b64=_0x371b64-0x0;var _0x3cf3b1=_0x86a7[_0x371b64];return _0x3cf3b1;};'use strict';var _=require(_0x786a('0x0'));var util=require(_0x786a('0x1'));var moment=require(_0x786a('0x2'));var BPromise=require(_0x786a('0x3'));var rs=require(_0x786a('0x4'));var fs=require('fs');var Redis=require(_0x786a('0x5'));var db=require(_0x786a('0x6'))['db'];var utils=require(_0x786a('0x7'));var logger=require('../../config/logger')(_0x786a('0x8'));var config=require('../../config/environment');var jayson=require(_0x786a('0x9'));var client=jayson[_0x786a('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41f987,_0x2f1be8,_0x4f39d6){return new BPromise(function(_0xad5d68,_0x4e8c4a){return client[_0x786a('0xb')](_0x41f987,_0x4f39d6)[_0x786a('0xc')](function(_0x3f1416){logger['info'](_0x786a('0xd'),_0x2f1be8,'request\x20sent');logger[_0x786a('0xe')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x2f1be8,_0x786a('0xf'),JSON[_0x786a('0x10')](_0x3f1416));if(_0x3f1416[_0x786a('0x11')]){if(_0x3f1416[_0x786a('0x11')][_0x786a('0x12')]===0x1f4){logger[_0x786a('0x11')](_0x786a('0xd'),_0x2f1be8,_0x3f1416['error'][_0x786a('0x13')]);return _0x4e8c4a(_0x3f1416['error']['message']);}logger['error'](_0x786a('0xd'),_0x2f1be8,_0x3f1416[_0x786a('0x11')][_0x786a('0x13')]);return _0xad5d68(_0x3f1416[_0x786a('0x11')]['message']);}else{logger[_0x786a('0x14')](_0x786a('0xd'),_0x2f1be8,_0x786a('0xf'));_0xad5d68(_0x3f1416[_0x786a('0x15')][_0x786a('0x13')]);}})[_0x786a('0x16')](function(_0x106692){logger['error'](_0x786a('0xd'),_0x2f1be8,_0x106692);_0x4e8c4a(_0x106692);});});} \ No newline at end of file +var _0x0ad1=['debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x1133c0,_0x3483a9){var _0x514993=function(_0x390762){while(--_0x390762){_0x1133c0['push'](_0x1133c0['shift']());}};_0x514993(++_0x3483a9);}(_0x0ad1,0x1bd));var _0x10ad=function(_0x17bfd6,_0xfb2a1e){_0x17bfd6=_0x17bfd6-0x0;var _0x25cabf=_0x0ad1[_0x17bfd6];return _0x25cabf;};'use strict';var _=require(_0x10ad('0x0'));var util=require('util');var moment=require(_0x10ad('0x1'));var BPromise=require(_0x10ad('0x2'));var rs=require(_0x10ad('0x3'));var fs=require('fs');var Redis=require(_0x10ad('0x4'));var db=require(_0x10ad('0x5'))['db'];var utils=require(_0x10ad('0x6'));var logger=require(_0x10ad('0x7'))('rpc');var config=require(_0x10ad('0x8'));var jayson=require(_0x10ad('0x9'));var client=jayson[_0x10ad('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5f47c7,_0x23d136,_0x333e06){return new BPromise(function(_0x189670,_0x9082e8){return client[_0x10ad('0xb')](_0x5f47c7,_0x333e06)[_0x10ad('0xc')](function(_0x5b59d8){logger['info'](_0x10ad('0xd'),_0x23d136,_0x10ad('0xe'));logger[_0x10ad('0xf')](_0x10ad('0x10'),_0x23d136,_0x10ad('0xe'),JSON['stringify'](_0x5b59d8));if(_0x5b59d8[_0x10ad('0x11')]){if(_0x5b59d8[_0x10ad('0x11')][_0x10ad('0x12')]===0x1f4){logger[_0x10ad('0x11')](_0x10ad('0xd'),_0x23d136,_0x5b59d8[_0x10ad('0x11')]['message']);return _0x9082e8(_0x5b59d8['error']['message']);}logger[_0x10ad('0x11')](_0x10ad('0xd'),_0x23d136,_0x5b59d8[_0x10ad('0x11')][_0x10ad('0x13')]);return _0x189670(_0x5b59d8[_0x10ad('0x11')][_0x10ad('0x13')]);}else{logger[_0x10ad('0x14')](_0x10ad('0xd'),_0x23d136,'request\x20sent');_0x189670(_0x5b59d8[_0x10ad('0x15')][_0x10ad('0x13')]);}})[_0x10ad('0x16')](function(_0xfe12d9){logger[_0x10ad('0x11')](_0x10ad('0xd'),_0x23d136,_0xfe12d9);_0x9082e8(_0xfe12d9);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index b57aa33..ca2d889 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 _0x063c=['/:id','show','post','create','put','update','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','isAuthenticated','index'];(function(_0x40dc59,_0x542c9b){var _0x4b7854=function(_0x2f67b8){while(--_0x2f67b8){_0x40dc59['push'](_0x40dc59['shift']());}};_0x4b7854(++_0x542c9b);}(_0x063c,0xba));var _0xc063=function(_0x256e76,_0x2486ac){_0x256e76=_0x256e76-0x0;var _0x5adecf=_0x063c[_0x256e76];return _0x5adecf;};'use strict';var multer=require('multer');var util=require(_0xc063('0x0'));var path=require(_0xc063('0x1'));var timeout=require(_0xc063('0x2'));var express=require(_0xc063('0x3'));var router=express[_0xc063('0x4')]();var fs_extra=require(_0xc063('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc063('0x6'));var config=require('../../config/environment');var controller=require('./intFreshsalesField.controller');router['get']('/',auth[_0xc063('0x7')](),controller[_0xc063('0x8')]);router['get'](_0xc063('0x9'),auth[_0xc063('0x7')](),controller[_0xc063('0xa')]);router[_0xc063('0xb')]('/',auth['isAuthenticated'](),controller[_0xc063('0xc')]);router[_0xc063('0xd')]('/:id',auth[_0xc063('0x7')](),controller[_0xc063('0xe')]);router['delete'](_0xc063('0x9'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x4ea3=['multer','util','path','connect-timeout','Router','../../components/auth/service','./intFreshsalesField.controller','get','isAuthenticated','index','/:id','post','create','destroy'];(function(_0x562362,_0x5d54f4){var _0x3a18ce=function(_0x4b96ed){while(--_0x4b96ed){_0x562362['push'](_0x562362['shift']());}};_0x3a18ce(++_0x5d54f4);}(_0x4ea3,0x70));var _0x34ea=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x4ea3[_0x5ddb1c];return _0x354adc;};'use strict';var multer=require(_0x34ea('0x0'));var util=require(_0x34ea('0x1'));var path=require(_0x34ea('0x2'));var timeout=require(_0x34ea('0x3'));var express=require('express');var router=express[_0x34ea('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x34ea('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x34ea('0x6'));router[_0x34ea('0x7')]('/',auth[_0x34ea('0x8')](),controller[_0x34ea('0x9')]);router[_0x34ea('0x7')](_0x34ea('0xa'),auth[_0x34ea('0x8')](),controller['show']);router[_0x34ea('0xb')]('/',auth[_0x34ea('0x8')](),controller[_0x34ea('0xc')]);router['put'](_0x34ea('0xa'),auth[_0x34ea('0x8')](),controller['update']);router['delete'](_0x34ea('0xa'),auth[_0x34ea('0x8')](),controller[_0x34ea('0xd')]);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 db2d1b9..18ad0f0 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 _0x9b0b=['keyValue','picklist','STRING','variable','exports','ENUM','string','customVariable'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0x9b0b,0x144));var _0xb9b0=function(_0x8e8ca7,_0x5a5e07){_0x8e8ca7=_0x8e8ca7-0x0;var _0x561381=_0x9b0b[_0x8e8ca7];return _0x561381;};'use strict';var Sequelize=require('sequelize');module[_0xb9b0('0x0')]={'type':{'type':Sequelize[_0xb9b0('0x1')](_0xb9b0('0x2'),'variable',_0xb9b0('0x3'),_0xb9b0('0x4'),_0xb9b0('0x5')),'defaultValue':_0xb9b0('0x2')},'content':{'type':Sequelize[_0xb9b0('0x6')]},'key':{'type':Sequelize[_0xb9b0('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0xb9b0('0x2'),_0xb9b0('0x7'),_0xb9b0('0x3'))},'keyContent':{'type':Sequelize[_0xb9b0('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xb9b0('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb9b0('0x6')]}}; \ No newline at end of file +var _0x0d1a=['variable','sequelize','customVariable','keyValue','STRING','ENUM'];(function(_0x7e2c6,_0x3e72e3){var _0x22a736=function(_0x159fd5){while(--_0x159fd5){_0x7e2c6['push'](_0x7e2c6['shift']());}};_0x22a736(++_0x3e72e3);}(_0x0d1a,0x7f));var _0xa0d1=function(_0x588a8d,_0x25e69c){_0x588a8d=_0x588a8d-0x0;var _0x19e67e=_0x0d1a[_0x588a8d];return _0x19e67e;};'use strict';var Sequelize=require(_0xa0d1('0x0'));module['exports']={'type':{'type':Sequelize['ENUM']('string','variable',_0xa0d1('0x1'),_0xa0d1('0x2'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xa0d1('0x3')]},'keyType':{'type':Sequelize[_0xa0d1('0x4')]('string',_0xa0d1('0x5'),_0xa0d1('0x1'))},'keyContent':{'type':Sequelize[_0xa0d1('0x3')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xa0d1('0x3')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index a9994d3..6edce5b 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 _0x116c=['index','map','FreshsalesField','rawAttributes','fieldName','key','keys','query','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','sort','pick','filters','filter','where','merge','type','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','destroy','then','error','stack','name','send'];(function(_0x4c1777,_0x36722e){var _0xe1c938=function(_0x56cbb5){while(--_0x56cbb5){_0x4c1777['push'](_0x4c1777['shift']());}};_0xe1c938(++_0x36722e);}(_0x116c,0x73));var _0xc116=function(_0x1c15bc,_0x22a6af){_0x1c15bc=_0x1c15bc-0x0;var _0x1cfa66=_0x116c[_0x1c15bc];return _0x1cfa66;};'use strict';var emlformat=require(_0xc116('0x0'));var rimraf=require(_0xc116('0x1'));var zipdir=require(_0xc116('0x2'));var jsonpatch=require(_0xc116('0x3'));var rp=require(_0xc116('0x4'));var moment=require(_0xc116('0x5'));var BPromise=require(_0xc116('0x6'));var Mustache=require('mustache');var util=require(_0xc116('0x7'));var path=require('path');var sox=require(_0xc116('0x8'));var csv=require(_0xc116('0x9'));var ejs=require(_0xc116('0xa'));var fs=require('fs');var fs_extra=require(_0xc116('0xb'));var _=require(_0xc116('0xc'));var squel=require(_0xc116('0xd'));var crypto=require('crypto');var jsforce=require(_0xc116('0xe'));var deskjs=require(_0xc116('0xf'));var toCsv=require(_0xc116('0x9'));var querystring=require(_0xc116('0x10'));var Papa=require(_0xc116('0x11'));var Redis=require('ioredis');var authService=require(_0xc116('0x12'));var qs=require(_0xc116('0x13'));var as=require(_0xc116('0x14'));var hardwareService=require(_0xc116('0x15'));var logger=require(_0xc116('0x16'))(_0xc116('0x17'));var utils=require(_0xc116('0x18'));var config=require(_0xc116('0x19'));var licenseUtil=require(_0xc116('0x1a'));var db=require(_0xc116('0x1b'))['db'];function respondWithStatusCode(_0x108424,_0x3c002b){_0x3c002b=_0x3c002b||0xcc;return function(_0x9da3ac){if(_0x9da3ac){return _0x108424[_0xc116('0x1c')](_0x3c002b);}return _0x108424[_0xc116('0x1d')](_0x3c002b)[_0xc116('0x1e')]();};}function respondWithResult(_0x572284,_0x269b22){_0x269b22=_0x269b22||0xc8;return function(_0xfe8c8d){if(_0xfe8c8d){return _0x572284[_0xc116('0x1d')](_0x269b22)[_0xc116('0x1f')](_0xfe8c8d);}};}function respondWithFilteredResult(_0x25d2f3,_0xaf37cf){return function(_0x458e27){if(_0x458e27){var _0x167848=typeof _0xaf37cf['offset']===_0xc116('0x20')&&typeof _0xaf37cf[_0xc116('0x21')]===_0xc116('0x20');var _0x1624f9=_0x458e27[_0xc116('0x22')];var _0x15501a=_0x167848?0x0:_0xaf37cf[_0xc116('0x23')];var _0x152a1e=_0x167848?_0x458e27[_0xc116('0x22')]:_0xaf37cf[_0xc116('0x23')]+_0xaf37cf[_0xc116('0x21')];var _0x2413a;if(_0x152a1e>=_0x1624f9){_0x152a1e=_0x1624f9;_0x2413a=0xc8;}else{_0x2413a=0xce;}_0x25d2f3[_0xc116('0x1d')](_0x2413a);return _0x25d2f3[_0xc116('0x24')](_0xc116('0x25'),_0x15501a+'-'+_0x152a1e+'/'+_0x1624f9)['json'](_0x458e27);}return null;};}function patchUpdates(_0xdd027b){return function(_0x5650d8){try{jsonpatch[_0xc116('0x26')](_0x5650d8,_0xdd027b,!![]);}catch(_0x5559f9){return BPromise[_0xc116('0x27')](_0x5559f9);}return _0x5650d8[_0xc116('0x28')]();};}function saveUpdates(_0x53eaeb,_0x1093a8){return function(_0x3a240d){if(_0x3a240d){return _0x3a240d['update'](_0x53eaeb)['then'](function(_0x3a4fb0){return _0x3a4fb0;});}return null;};}function removeEntity(_0x55268a,_0xb85607){return function(_0x5e7bef){if(_0x5e7bef){return _0x5e7bef[_0xc116('0x29')]()[_0xc116('0x2a')](function(){_0x55268a[_0xc116('0x1d')](0xcc)[_0xc116('0x1e')]();});}};}function handleEntityNotFound(_0x42ad65,_0x10011e){return function(_0x4e877f){if(!_0x4e877f){_0x42ad65[_0xc116('0x1c')](0x194);}return _0x4e877f;};}function handleError(_0x4e5b09,_0x4ca614){_0x4ca614=_0x4ca614||0x1f4;return function(_0x4cb21b){logger[_0xc116('0x2b')](_0x4cb21b[_0xc116('0x2c')]);if(_0x4cb21b[_0xc116('0x2d')]){delete _0x4cb21b[_0xc116('0x2d')];}_0x4e5b09[_0xc116('0x1d')](_0x4ca614)[_0xc116('0x2e')](_0x4cb21b);};}exports[_0xc116('0x2f')]=function(_0x4a0d11,_0x3a0050){var _0x514c29={},_0x427b4f={},_0x394d24={'count':0x0,'rows':[]};var _0x20243a=_[_0xc116('0x30')](db[_0xc116('0x31')][_0xc116('0x32')],function(_0x12fcf8){return{'name':_0x12fcf8[_0xc116('0x33')],'type':_0x12fcf8['type'][_0xc116('0x34')]};});_0x427b4f['model']=_['map'](_0x20243a,_0xc116('0x2d'));_0x427b4f['query']=_[_0xc116('0x35')](_0x4a0d11[_0xc116('0x36')]);_0x427b4f['filters']=_[_0xc116('0x37')](_0x427b4f['model'],_0x427b4f['query']);_0x514c29[_0xc116('0x38')]=_[_0xc116('0x37')](_0x427b4f[_0xc116('0x39')],qs[_0xc116('0x3a')](_0x4a0d11[_0xc116('0x36')][_0xc116('0x3a')]));_0x514c29[_0xc116('0x38')]=_0x514c29[_0xc116('0x38')][_0xc116('0x3b')]?_0x514c29['attributes']:_0x427b4f['model'];if(!_0x4a0d11[_0xc116('0x36')][_0xc116('0x3c')](_0xc116('0x3d'))){_0x514c29['limit']=qs[_0xc116('0x21')](_0x4a0d11[_0xc116('0x36')][_0xc116('0x21')]);_0x514c29[_0xc116('0x23')]=qs[_0xc116('0x23')](_0x4a0d11[_0xc116('0x36')][_0xc116('0x23')]);}_0x514c29['order']=qs[_0xc116('0x3e')](_0x4a0d11[_0xc116('0x36')]['sort']);_0x514c29['where']=qs['filters'](_[_0xc116('0x3f')](_0x4a0d11[_0xc116('0x36')],_0x427b4f[_0xc116('0x40')]),_0x20243a);if(_0x4a0d11['query'][_0xc116('0x41')]){_0x514c29[_0xc116('0x42')]=_[_0xc116('0x43')](_0x514c29[_0xc116('0x42')],{'$or':_['map'](_0x20243a,function(_0x34f5d1){if(_0x34f5d1[_0xc116('0x44')]!=='VIRTUAL'){var _0x1a6d4d={};_0x1a6d4d[_0x34f5d1[_0xc116('0x2d')]]={'$like':'%'+_0x4a0d11[_0xc116('0x36')][_0xc116('0x41')]+'%'};return _0x1a6d4d;}})});}_0x514c29=_[_0xc116('0x43')]({},_0x514c29,_0x4a0d11[_0xc116('0x45')]);var _0x28c3dc={'where':_0x514c29[_0xc116('0x42')]};return db[_0xc116('0x31')][_0xc116('0x22')](_0x28c3dc)[_0xc116('0x2a')](function(_0x3824aa){_0x394d24[_0xc116('0x22')]=_0x3824aa;if(_0x4a0d11[_0xc116('0x36')][_0xc116('0x46')]){_0x514c29[_0xc116('0x47')]=[{'all':!![]}];}return db[_0xc116('0x31')][_0xc116('0x48')](_0x514c29);})[_0xc116('0x2a')](function(_0x13b76d){_0x394d24[_0xc116('0x49')]=_0x13b76d;return _0x394d24;})['then'](respondWithFilteredResult(_0x3a0050,_0x514c29))[_0xc116('0x4a')](handleError(_0x3a0050,null));};exports[_0xc116('0x4b')]=function(_0x3fc989,_0x463b7c){var _0x5754a3={'raw':!![],'where':{'id':_0x3fc989[_0xc116('0x4c')]['id']}},_0x3fabe5={};_0x3fabe5['model']=_['keys'](db[_0xc116('0x31')][_0xc116('0x32')]);_0x3fabe5[_0xc116('0x36')]=_['keys'](_0x3fc989[_0xc116('0x36')]);_0x3fabe5['filters']=_[_0xc116('0x37')](_0x3fabe5['model'],_0x3fabe5[_0xc116('0x36')]);_0x5754a3['attributes']=_[_0xc116('0x37')](_0x3fabe5[_0xc116('0x39')],qs[_0xc116('0x3a')](_0x3fc989[_0xc116('0x36')]['fields']));_0x5754a3[_0xc116('0x38')]=_0x5754a3[_0xc116('0x38')][_0xc116('0x3b')]?_0x5754a3[_0xc116('0x38')]:_0x3fabe5[_0xc116('0x39')];if(_0x3fc989[_0xc116('0x36')][_0xc116('0x46')]){_0x5754a3[_0xc116('0x47')]=[{'all':!![]}];}_0x5754a3=_[_0xc116('0x43')]({},_0x5754a3,_0x3fc989[_0xc116('0x45')]);return db[_0xc116('0x31')][_0xc116('0x4d')](_0x5754a3)[_0xc116('0x2a')](handleEntityNotFound(_0x463b7c,null))['then'](respondWithResult(_0x463b7c,null))['catch'](handleError(_0x463b7c,null));};exports[_0xc116('0x4e')]=function(_0x368a59,_0xf4e8c7){return db[_0xc116('0x31')][_0xc116('0x4e')](_0x368a59[_0xc116('0x4f')],{})[_0xc116('0x2a')](respondWithResult(_0xf4e8c7,0xc9))[_0xc116('0x4a')](handleError(_0xf4e8c7,null));};exports[_0xc116('0x50')]=function(_0x37cfbd,_0x2596a9){if(_0x37cfbd['body']['id']){delete _0x37cfbd[_0xc116('0x4f')]['id'];}return db[_0xc116('0x31')][_0xc116('0x4d')]({'where':{'id':_0x37cfbd[_0xc116('0x4c')]['id']}})[_0xc116('0x2a')](handleEntityNotFound(_0x2596a9,null))[_0xc116('0x2a')](saveUpdates(_0x37cfbd[_0xc116('0x4f')],null))[_0xc116('0x2a')](respondWithResult(_0x2596a9,null))[_0xc116('0x4a')](handleError(_0x2596a9,null));};exports[_0xc116('0x29')]=function(_0x7eafdf,_0x4ab340){return db[_0xc116('0x31')]['find']({'where':{'id':_0x7eafdf[_0xc116('0x4c')]['id']}})[_0xc116('0x2a')](handleEntityNotFound(_0x4ab340,null))[_0xc116('0x2a')](removeEntity(_0x4ab340,null))[_0xc116('0x4a')](handleError(_0x4ab340,null));}; \ No newline at end of file +var _0x1b2e=['include','findAll','rows','catch','show','params','length','find','body','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','offset','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','send','map','FreshsalesField','rawAttributes','fieldName','key','model','name','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','pick','filters','filter','where','merge','type','count','includeAll'];(function(_0x293274,_0x1f9041){var _0x21730e=function(_0x56fc27){while(--_0x56fc27){_0x293274['push'](_0x293274['shift']());}};_0x21730e(++_0x1f9041);}(_0x1b2e,0x131));var _0xe1b2=function(_0x42c8d6,_0x4513e7){_0x42c8d6=_0x42c8d6-0x0;var _0x4a0319=_0x1b2e[_0x42c8d6];return _0x4a0319;};'use strict';var emlformat=require(_0xe1b2('0x0'));var rimraf=require(_0xe1b2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe1b2('0x2'));var rp=require(_0xe1b2('0x3'));var moment=require(_0xe1b2('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xe1b2('0x5'));var util=require(_0xe1b2('0x6'));var path=require(_0xe1b2('0x7'));var sox=require('sox');var csv=require(_0xe1b2('0x8'));var ejs=require(_0xe1b2('0x9'));var fs=require('fs');var fs_extra=require(_0xe1b2('0xa'));var _=require(_0xe1b2('0xb'));var squel=require(_0xe1b2('0xc'));var crypto=require(_0xe1b2('0xd'));var jsforce=require(_0xe1b2('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xe1b2('0x8'));var querystring=require('querystring');var Papa=require(_0xe1b2('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe1b2('0x10'));var hardwareService=require(_0xe1b2('0x11'));var logger=require(_0xe1b2('0x12'))(_0xe1b2('0x13'));var utils=require(_0xe1b2('0x14'));var config=require(_0xe1b2('0x15'));var licenseUtil=require(_0xe1b2('0x16'));var db=require(_0xe1b2('0x17'))['db'];function respondWithStatusCode(_0x3df8b4,_0xc22b32){_0xc22b32=_0xc22b32||0xcc;return function(_0x5bbfd4){if(_0x5bbfd4){return _0x3df8b4['sendStatus'](_0xc22b32);}return _0x3df8b4[_0xe1b2('0x18')](_0xc22b32)[_0xe1b2('0x19')]();};}function respondWithResult(_0x3f527d,_0x275401){_0x275401=_0x275401||0xc8;return function(_0x3a9940){if(_0x3a9940){return _0x3f527d['status'](_0x275401)[_0xe1b2('0x1a')](_0x3a9940);}};}function respondWithFilteredResult(_0x5c2c11,_0x1bf311){return function(_0x2ba6dd){if(_0x2ba6dd){var _0x3dcc0c=typeof _0x1bf311['offset']===_0xe1b2('0x1b')&&typeof _0x1bf311[_0xe1b2('0x1c')]==='undefined';var _0x316b9f=_0x2ba6dd['count'];var _0x4d3e91=_0x3dcc0c?0x0:_0x1bf311[_0xe1b2('0x1d')];var _0x182b6b=_0x3dcc0c?_0x2ba6dd['count']:_0x1bf311[_0xe1b2('0x1d')]+_0x1bf311[_0xe1b2('0x1c')];var _0x28197f;if(_0x182b6b>=_0x316b9f){_0x182b6b=_0x316b9f;_0x28197f=0xc8;}else{_0x28197f=0xce;}_0x5c2c11[_0xe1b2('0x18')](_0x28197f);return _0x5c2c11[_0xe1b2('0x1e')](_0xe1b2('0x1f'),_0x4d3e91+'-'+_0x182b6b+'/'+_0x316b9f)['json'](_0x2ba6dd);}return null;};}function patchUpdates(_0x47c693){return function(_0x176078){try{jsonpatch[_0xe1b2('0x20')](_0x176078,_0x47c693,!![]);}catch(_0x305116){return BPromise[_0xe1b2('0x21')](_0x305116);}return _0x176078[_0xe1b2('0x22')]();};}function saveUpdates(_0xeab6d2,_0x17c27b){return function(_0x1e31e8){if(_0x1e31e8){return _0x1e31e8[_0xe1b2('0x23')](_0xeab6d2)[_0xe1b2('0x24')](function(_0x3fdce0){return _0x3fdce0;});}return null;};}function removeEntity(_0x49e459,_0x9bc965){return function(_0x5b2e9d){if(_0x5b2e9d){return _0x5b2e9d[_0xe1b2('0x25')]()['then'](function(){_0x49e459[_0xe1b2('0x18')](0xcc)[_0xe1b2('0x19')]();});}};}function handleEntityNotFound(_0x42ca90,_0x2fefb3){return function(_0x275dfb){if(!_0x275dfb){_0x42ca90[_0xe1b2('0x26')](0x194);}return _0x275dfb;};}function handleError(_0x34c2b2,_0x372384){_0x372384=_0x372384||0x1f4;return function(_0x12207e){logger[_0xe1b2('0x27')](_0x12207e[_0xe1b2('0x28')]);if(_0x12207e['name']){delete _0x12207e['name'];}_0x34c2b2[_0xe1b2('0x18')](_0x372384)[_0xe1b2('0x29')](_0x12207e);};}exports['index']=function(_0x25499a,_0x20e015){var _0xf0e2c2={},_0x122c6b={},_0x167ddf={'count':0x0,'rows':[]};var _0x59306e=_[_0xe1b2('0x2a')](db[_0xe1b2('0x2b')][_0xe1b2('0x2c')],function(_0x320f87){return{'name':_0x320f87[_0xe1b2('0x2d')],'type':_0x320f87['type'][_0xe1b2('0x2e')]};});_0x122c6b[_0xe1b2('0x2f')]=_[_0xe1b2('0x2a')](_0x59306e,_0xe1b2('0x30'));_0x122c6b[_0xe1b2('0x31')]=_[_0xe1b2('0x32')](_0x25499a[_0xe1b2('0x31')]);_0x122c6b['filters']=_[_0xe1b2('0x33')](_0x122c6b['model'],_0x122c6b['query']);_0xf0e2c2[_0xe1b2('0x34')]=_['intersection'](_0x122c6b[_0xe1b2('0x2f')],qs[_0xe1b2('0x35')](_0x25499a[_0xe1b2('0x31')]['fields']));_0xf0e2c2[_0xe1b2('0x34')]=_0xf0e2c2[_0xe1b2('0x34')]['length']?_0xf0e2c2[_0xe1b2('0x34')]:_0x122c6b[_0xe1b2('0x2f')];if(!_0x25499a[_0xe1b2('0x31')][_0xe1b2('0x36')]('nolimit')){_0xf0e2c2['limit']=qs[_0xe1b2('0x1c')](_0x25499a['query'][_0xe1b2('0x1c')]);_0xf0e2c2['offset']=qs['offset'](_0x25499a[_0xe1b2('0x31')]['offset']);}_0xf0e2c2[_0xe1b2('0x37')]=qs[_0xe1b2('0x38')](_0x25499a[_0xe1b2('0x31')][_0xe1b2('0x38')]);_0xf0e2c2['where']=qs['filters'](_[_0xe1b2('0x39')](_0x25499a[_0xe1b2('0x31')],_0x122c6b[_0xe1b2('0x3a')]),_0x59306e);if(_0x25499a[_0xe1b2('0x31')][_0xe1b2('0x3b')]){_0xf0e2c2[_0xe1b2('0x3c')]=_[_0xe1b2('0x3d')](_0xf0e2c2[_0xe1b2('0x3c')],{'$or':_['map'](_0x59306e,function(_0x5cd2f9){if(_0x5cd2f9[_0xe1b2('0x3e')]!=='VIRTUAL'){var _0x46abc6={};_0x46abc6[_0x5cd2f9[_0xe1b2('0x30')]]={'$like':'%'+_0x25499a['query']['filter']+'%'};return _0x46abc6;}})});}_0xf0e2c2=_['merge']({},_0xf0e2c2,_0x25499a['options']);var _0x23c4ae={'where':_0xf0e2c2['where']};return db[_0xe1b2('0x2b')][_0xe1b2('0x3f')](_0x23c4ae)['then'](function(_0x44e3d){_0x167ddf['count']=_0x44e3d;if(_0x25499a[_0xe1b2('0x31')][_0xe1b2('0x40')]){_0xf0e2c2[_0xe1b2('0x41')]=[{'all':!![]}];}return db[_0xe1b2('0x2b')][_0xe1b2('0x42')](_0xf0e2c2);})['then'](function(_0x2f7352){_0x167ddf[_0xe1b2('0x43')]=_0x2f7352;return _0x167ddf;})['then'](respondWithFilteredResult(_0x20e015,_0xf0e2c2))[_0xe1b2('0x44')](handleError(_0x20e015,null));};exports[_0xe1b2('0x45')]=function(_0x4a9017,_0x5542e4){var _0x4bf49b={'raw':!![],'where':{'id':_0x4a9017[_0xe1b2('0x46')]['id']}},_0x5cdfb6={};_0x5cdfb6[_0xe1b2('0x2f')]=_['keys'](db[_0xe1b2('0x2b')]['rawAttributes']);_0x5cdfb6[_0xe1b2('0x31')]=_[_0xe1b2('0x32')](_0x4a9017[_0xe1b2('0x31')]);_0x5cdfb6[_0xe1b2('0x3a')]=_[_0xe1b2('0x33')](_0x5cdfb6['model'],_0x5cdfb6[_0xe1b2('0x31')]);_0x4bf49b[_0xe1b2('0x34')]=_[_0xe1b2('0x33')](_0x5cdfb6['model'],qs['fields'](_0x4a9017[_0xe1b2('0x31')]['fields']));_0x4bf49b[_0xe1b2('0x34')]=_0x4bf49b[_0xe1b2('0x34')][_0xe1b2('0x47')]?_0x4bf49b['attributes']:_0x5cdfb6[_0xe1b2('0x2f')];if(_0x4a9017[_0xe1b2('0x31')][_0xe1b2('0x40')]){_0x4bf49b[_0xe1b2('0x41')]=[{'all':!![]}];}_0x4bf49b=_[_0xe1b2('0x3d')]({},_0x4bf49b,_0x4a9017['options']);return db[_0xe1b2('0x2b')][_0xe1b2('0x48')](_0x4bf49b)[_0xe1b2('0x24')](handleEntityNotFound(_0x5542e4,null))[_0xe1b2('0x24')](respondWithResult(_0x5542e4,null))[_0xe1b2('0x44')](handleError(_0x5542e4,null));};exports['create']=function(_0x485690,_0x562642){return db[_0xe1b2('0x2b')]['create'](_0x485690[_0xe1b2('0x49')],{})[_0xe1b2('0x24')](respondWithResult(_0x562642,0xc9))['catch'](handleError(_0x562642,null));};exports[_0xe1b2('0x23')]=function(_0x47fe11,_0x516400){if(_0x47fe11['body']['id']){delete _0x47fe11['body']['id'];}return db[_0xe1b2('0x2b')]['find']({'where':{'id':_0x47fe11[_0xe1b2('0x46')]['id']}})[_0xe1b2('0x24')](handleEntityNotFound(_0x516400,null))[_0xe1b2('0x24')](saveUpdates(_0x47fe11['body'],null))[_0xe1b2('0x24')](respondWithResult(_0x516400,null))['catch'](handleError(_0x516400,null));};exports[_0xe1b2('0x25')]=function(_0xa25ac2,_0xf97653){return db[_0xe1b2('0x2b')][_0xe1b2('0x48')]({'where':{'id':_0xa25ac2[_0xe1b2('0x46')]['id']}})['then'](handleEntityNotFound(_0xf97653,null))[_0xe1b2('0x24')](removeEntity(_0xf97653,null))[_0xe1b2('0x44')](handleError(_0xf97653,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 42059a3..7952752 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 _0x7fea=['FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0xf79bae,_0x263b2a){var _0x5d2cb7=function(_0x27c86b){while(--_0x27c86b){_0xf79bae['push'](_0xf79bae['shift']());}};_0x5d2cb7(++_0x263b2a);}(_0x7fea,0x149));var _0xa7fe=function(_0x47c11f,_0x325d7c){_0x47c11f=_0x47c11f-0x0;var _0x1cf0ed=_0x7fea[_0x47c11f];return _0x1cf0ed;};'use strict';var _=require('lodash');var util=require(_0xa7fe('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xa7fe('0x1'));var BPromise=require(_0xa7fe('0x2'));var rp=require(_0xa7fe('0x3'));var fs=require('fs');var path=require(_0xa7fe('0x4'));var rimraf=require(_0xa7fe('0x5'));var config=require(_0xa7fe('0x6'));var attributes=require('./intFreshsalesField.attributes');module[_0xa7fe('0x7')]=function(_0x2bcfad,_0x1fbc99){return _0x2bcfad[_0xa7fe('0x8')](_0xa7fe('0x9'),attributes,{'tableName':_0xa7fe('0xa'),'paranoid':![],'indexes':[{'name':_0xa7fe('0xb'),'fields':[_0xa7fe('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9e6b=['../../config/environment','exports','FreshsalesField','FieldId','lodash','util','api','request-promise','path','rimraf'];(function(_0x18edd7,_0x21192e){var _0x51d8be=function(_0x1bbd37){while(--_0x1bbd37){_0x18edd7['push'](_0x18edd7['shift']());}};_0x51d8be(++_0x21192e);}(_0x9e6b,0x11c));var _0xb9e6=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x9e6b[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0xb9e6('0x0'));var util=require(_0xb9e6('0x1'));var logger=require('../../config/logger')(_0xb9e6('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb9e6('0x3'));var fs=require('fs');var path=require(_0xb9e6('0x4'));var rimraf=require(_0xb9e6('0x5'));var config=require(_0xb9e6('0x6'));var attributes=require('./intFreshsalesField.attributes');module[_0xb9e6('0x7')]=function(_0x1a6a4f,_0x1b9eed){return _0x1a6a4f['define'](_0xb9e6('0x8'),attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':['idField',_0xb9e6('0x9')],'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 fd91da0..c30ad03 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 _0x71ab=['http','request','then','info','request\x20sent','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','message','FreshsalesField,\x20%s,\x20%s','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x410830,_0x1554a7){var _0x496bfc=function(_0x30494b){while(--_0x30494b){_0x410830['push'](_0x410830['shift']());}};_0x496bfc(++_0x1554a7);}(_0x71ab,0x64));var _0xb71a=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x71ab[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require('lodash');var util=require(_0xb71a('0x0'));var moment=require('moment');var BPromise=require(_0xb71a('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb71a('0x2'));var db=require(_0xb71a('0x3'))['db'];var utils=require(_0xb71a('0x4'));var logger=require(_0xb71a('0x5'))(_0xb71a('0x6'));var config=require(_0xb71a('0x7'));var jayson=require(_0xb71a('0x8'));var client=jayson[_0xb71a('0x9')][_0xb71a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x35a84e,_0x4358ce,_0x2a4c86){return new BPromise(function(_0x43ca14,_0x471ab6){return client[_0xb71a('0xb')](_0x35a84e,_0x2a4c86)[_0xb71a('0xc')](function(_0x378c96){logger[_0xb71a('0xd')]('FreshsalesField,\x20%s,\x20%s',_0x4358ce,_0xb71a('0xe'));logger['debug'](_0xb71a('0xf'),_0x4358ce,_0xb71a('0xe'),JSON[_0xb71a('0x10')](_0x378c96));if(_0x378c96['error']){if(_0x378c96[_0xb71a('0x11')]['code']===0x1f4){logger[_0xb71a('0x11')]('FreshsalesField,\x20%s,\x20%s',_0x4358ce,_0x378c96['error'][_0xb71a('0x12')]);return _0x471ab6(_0x378c96[_0xb71a('0x11')][_0xb71a('0x12')]);}logger[_0xb71a('0x11')]('FreshsalesField,\x20%s,\x20%s',_0x4358ce,_0x378c96['error']['message']);return _0x43ca14(_0x378c96[_0xb71a('0x11')][_0xb71a('0x12')]);}else{logger[_0xb71a('0xd')](_0xb71a('0x13'),_0x4358ce,_0xb71a('0xe'));_0x43ca14(_0x378c96[_0xb71a('0x14')][_0xb71a('0x12')]);}})[_0xb71a('0x15')](function(_0x7710a8){logger['error'](_0xb71a('0x13'),_0x4358ce,_0x7710a8);_0x471ab6(_0x7710a8);});});} \ No newline at end of file +var _0x6d38=['request','then','FreshsalesField,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x3969e9,_0x2f9378){var _0x42818e=function(_0x229b0d){while(--_0x229b0d){_0x3969e9['push'](_0x3969e9['shift']());}};_0x42818e(++_0x2f9378);}(_0x6d38,0x1ef));var _0x86d3=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x6d38[_0x19e35c];return _0x3e1fe8;};'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']('FreshsalesField,\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 diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 00fb107..e0d398c 100644 --- a/server/api/intSalesforceAccount/index.js +++ b/server/api/intSalesforceAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x1314fa,_0x12447e){var _0x59a9b0=function(_0x59ad9c){while(--_0x59ad9c){_0x1314fa['push'](_0x1314fa['shift']());}};_0x59a9b0(++_0x12447e);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xa9e0[_0xf71120];return _0xbe2fd3;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file +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(_0x52c284,_0x274830){var _0xf0d742=function(_0x2a8593){while(--_0x2a8593){_0x52c284['push'](_0x52c284['shift']());}};_0xf0d742(++_0x274830);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'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/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index ae69c54..cb803d9 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 _0xbaef=['ENUM','newTab','STRING','username'];(function(_0x2b17cf,_0x3e620e){var _0x1feeb5=function(_0x2ee26d){while(--_0x2ee26d){_0x2b17cf['push'](_0x2b17cf['shift']());}};_0x1feeb5(++_0x3e620e);}(_0xbaef,0xae));var _0xfbae=function(_0x19d920,_0x4300b4){_0x19d920=_0x19d920-0x0;var _0x7ad1d5=_0xbaef[_0x19d920];return _0x7ad1d5;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xfbae('0x0')]},'description':{'type':Sequelize[_0xfbae('0x0')]},'username':{'type':Sequelize['STRING'],'unique':_0xfbae('0x1')},'remoteUri':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xfbae('0x0')]},'clientId':{'type':Sequelize[_0xfbae('0x0')]},'clientSecret':{'type':Sequelize[_0xfbae('0x0')]},'securityToken':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xfbae('0x0')],'allowNull':![]},'type':{'type':Sequelize[_0xfbae('0x2')]('integrationTab',_0xfbae('0x3')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0xb4b6=['newTab','exports','STRING','username','integrationTab'];(function(_0x5c6994,_0x19ad9a){var _0x1d5c84=function(_0x4a385a){while(--_0x4a385a){_0x5c6994['push'](_0x5c6994['shift']());}};_0x1d5c84(++_0x19ad9a);}(_0xb4b6,0x7e));var _0x6b4b=function(_0x2f5024,_0xe5994e){_0x2f5024=_0x2f5024-0x0;var _0x372a6e=_0xb4b6[_0x2f5024];return _0x372a6e;};'use strict';var Sequelize=require('sequelize');module[_0x6b4b('0x0')]={'name':{'type':Sequelize[_0x6b4b('0x1')]},'description':{'type':Sequelize[_0x6b4b('0x1')]},'username':{'type':Sequelize[_0x6b4b('0x1')],'unique':_0x6b4b('0x2')},'remoteUri':{'type':Sequelize[_0x6b4b('0x1')]},'password':{'type':Sequelize[_0x6b4b('0x1')]},'clientId':{'type':Sequelize[_0x6b4b('0x1')]},'clientSecret':{'type':Sequelize[_0x6b4b('0x1')]},'securityToken':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x6b4b('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x6b4b('0x3'),_0x6b4b('0x4')),'defaultValue':_0x6b4b('0x3')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 746d820..4c17382 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 _0xa00d=['True','False','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../components/integrations/configuration','status','end','json','offset','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','order','where','filter','merge','VIRTUAL','options','SalesforceAccount','includeAll','include','findAll','rows','catch','show','params','create','body','find','findOne','sort','pick','getConfigurations','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','SalesforceConfiguration','getFields','Task','remoteUri','clientId','clientSecret','username','password','slice','substring','lastIndexOf','Connection','login','concat','ticketType','describe','OwnerId','ActivityDate','IsRecurrence','Subject','string','picklist','boolean','email','phone','includes','label','custom','picklistValues','value'];(function(_0x18bdef,_0xd178e0){var _0x17fe81=function(_0x5db684){while(--_0x5db684){_0x18bdef['push'](_0x18bdef['shift']());}};_0x17fe81(++_0xd178e0);}(_0xa00d,0x16c));var _0xda00=function(_0x325e9b,_0x33e076){_0x325e9b=_0x325e9b-0x0;var _0x8b1f6=_0xa00d[_0x325e9b];return _0x8b1f6;};'use strict';var emlformat=require(_0xda00('0x0'));var rimraf=require(_0xda00('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xda00('0x2'));var rp=require(_0xda00('0x3'));var moment=require('moment');var BPromise=require(_0xda00('0x4'));var Mustache=require(_0xda00('0x5'));var util=require(_0xda00('0x6'));var path=require(_0xda00('0x7'));var sox=require(_0xda00('0x8'));var csv=require(_0xda00('0x9'));var ejs=require(_0xda00('0xa'));var fs=require('fs');var fs_extra=require(_0xda00('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xda00('0xc'));var jsforce=require(_0xda00('0xd'));var deskjs=require(_0xda00('0xe'));var toCsv=require('to-csv');var querystring=require(_0xda00('0xf'));var Papa=require(_0xda00('0x10'));var Redis=require(_0xda00('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xda00('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xda00('0x13'))(_0xda00('0x14'));var utils=require('../../config/utils');var config=require(_0xda00('0x15'));var licenseUtil=require(_0xda00('0x16'));var db=require('../../mysqldb')['db'];var integrations=require(_0xda00('0x17'));function respondWithStatusCode(_0x39eee2,_0x4265db){_0x4265db=_0x4265db||0xcc;return function(_0x213af2){if(_0x213af2){return _0x39eee2['sendStatus'](_0x4265db);}return _0x39eee2[_0xda00('0x18')](_0x4265db)[_0xda00('0x19')]();};}function respondWithResult(_0x3cc950,_0x2e7561){_0x2e7561=_0x2e7561||0xc8;return function(_0x135b36){if(_0x135b36){return _0x3cc950[_0xda00('0x18')](_0x2e7561)[_0xda00('0x1a')](_0x135b36);}};}function respondWithFilteredResult(_0x27e94e,_0x430b3e){return function(_0x383390){if(_0x383390){var _0xc1d268=typeof _0x430b3e[_0xda00('0x1b')]==='undefined'&&typeof _0x430b3e[_0xda00('0x1c')]==='undefined';var _0x32ed50=_0x383390[_0xda00('0x1d')];var _0x1a5367=_0xc1d268?0x0:_0x430b3e[_0xda00('0x1b')];var _0x305499=_0xc1d268?_0x383390[_0xda00('0x1d')]:_0x430b3e[_0xda00('0x1b')]+_0x430b3e['limit'];var _0x41494b;if(_0x305499>=_0x32ed50){_0x305499=_0x32ed50;_0x41494b=0xc8;}else{_0x41494b=0xce;}_0x27e94e[_0xda00('0x18')](_0x41494b);return _0x27e94e[_0xda00('0x1e')](_0xda00('0x1f'),_0x1a5367+'-'+_0x305499+'/'+_0x32ed50)[_0xda00('0x1a')](_0x383390);}return null;};}function patchUpdates(_0x30ea48){return function(_0xc57607){try{jsonpatch[_0xda00('0x20')](_0xc57607,_0x30ea48,!![]);}catch(_0x38bac8){return BPromise[_0xda00('0x21')](_0x38bac8);}return _0xc57607['save']();};}function saveUpdates(_0x4ef0c8,_0x2e0174){return function(_0x537e48){if(_0x537e48){return _0x537e48[_0xda00('0x22')](_0x4ef0c8)[_0xda00('0x23')](function(_0x4a6e17){return _0x4a6e17;});}return null;};}function removeEntity(_0xf5d199,_0x301ff9){return function(_0x339531){if(_0x339531){return _0x339531[_0xda00('0x24')]()[_0xda00('0x23')](function(){_0xf5d199[_0xda00('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e5a5e,_0x5c3d76){return function(_0x1e74e1){if(!_0x1e74e1){_0x4e5a5e['sendStatus'](0x194);}return _0x1e74e1;};}function handleError(_0x55cca8,_0x769eb9){_0x769eb9=_0x769eb9||0x1f4;return function(_0xf60e37){logger[_0xda00('0x25')](_0xf60e37[_0xda00('0x26')]);if(_0xf60e37['name']){delete _0xf60e37[_0xda00('0x27')];}_0x55cca8['status'](_0x769eb9)[_0xda00('0x28')](_0xf60e37);};}exports['index']=function(_0x10434d,_0x45a459){var _0x1fd28c={},_0x3fd18c={},_0x53ff5c={'count':0x0,'rows':[]};var _0x49e301=_['map'](db['SalesforceAccount'][_0xda00('0x29')],function(_0x1a2e0d){return{'name':_0x1a2e0d[_0xda00('0x2a')],'type':_0x1a2e0d[_0xda00('0x2b')][_0xda00('0x2c')]};});_0x3fd18c['model']=_[_0xda00('0x2d')](_0x49e301,'name');_0x3fd18c[_0xda00('0x2e')]=_[_0xda00('0x2f')](_0x10434d[_0xda00('0x2e')]);_0x3fd18c[_0xda00('0x30')]=_[_0xda00('0x31')](_0x3fd18c['model'],_0x3fd18c['query']);_0x1fd28c[_0xda00('0x32')]=_[_0xda00('0x31')](_0x3fd18c[_0xda00('0x33')],qs['fields'](_0x10434d[_0xda00('0x2e')][_0xda00('0x34')]));_0x1fd28c[_0xda00('0x32')]=_0x1fd28c[_0xda00('0x32')][_0xda00('0x35')]?_0x1fd28c[_0xda00('0x32')]:_0x3fd18c[_0xda00('0x33')];if(!_0x10434d['query'][_0xda00('0x36')]('nolimit')){_0x1fd28c[_0xda00('0x1c')]=qs['limit'](_0x10434d['query'][_0xda00('0x1c')]);_0x1fd28c[_0xda00('0x1b')]=qs['offset'](_0x10434d[_0xda00('0x2e')][_0xda00('0x1b')]);}_0x1fd28c[_0xda00('0x37')]=qs['sort'](_0x10434d[_0xda00('0x2e')]['sort']);_0x1fd28c[_0xda00('0x38')]=qs[_0xda00('0x30')](_['pick'](_0x10434d[_0xda00('0x2e')],_0x3fd18c[_0xda00('0x30')]),_0x49e301);if(_0x10434d[_0xda00('0x2e')][_0xda00('0x39')]){_0x1fd28c['where']=_[_0xda00('0x3a')](_0x1fd28c['where'],{'$or':_[_0xda00('0x2d')](_0x49e301,function(_0x23c475){if(_0x23c475[_0xda00('0x2b')]!==_0xda00('0x3b')){var _0x133842={};_0x133842[_0x23c475[_0xda00('0x27')]]={'$like':'%'+_0x10434d['query'][_0xda00('0x39')]+'%'};return _0x133842;}})});}_0x1fd28c=_[_0xda00('0x3a')]({},_0x1fd28c,_0x10434d[_0xda00('0x3c')]);var _0x1b69d1={'where':_0x1fd28c['where']};return db[_0xda00('0x3d')][_0xda00('0x1d')](_0x1b69d1)[_0xda00('0x23')](function(_0xbb60c9){_0x53ff5c['count']=_0xbb60c9;if(_0x10434d[_0xda00('0x2e')][_0xda00('0x3e')]){_0x1fd28c[_0xda00('0x3f')]=[{'all':!![]}];}return db['SalesforceAccount'][_0xda00('0x40')](_0x1fd28c);})[_0xda00('0x23')](function(_0x32172c){_0x53ff5c[_0xda00('0x41')]=_0x32172c;return _0x53ff5c;})[_0xda00('0x23')](respondWithFilteredResult(_0x45a459,_0x1fd28c))[_0xda00('0x42')](handleError(_0x45a459,null));};exports[_0xda00('0x43')]=function(_0x3bbaad,_0x53cad5){var _0x2e864d={'raw':![],'where':{'id':_0x3bbaad[_0xda00('0x44')]['id']}},_0x43b874={};_0x43b874[_0xda00('0x33')]=_['keys'](db[_0xda00('0x3d')][_0xda00('0x29')]);_0x43b874[_0xda00('0x2e')]=_[_0xda00('0x2f')](_0x3bbaad[_0xda00('0x2e')]);_0x43b874[_0xda00('0x30')]=_[_0xda00('0x31')](_0x43b874[_0xda00('0x33')],_0x43b874[_0xda00('0x2e')]);_0x2e864d[_0xda00('0x32')]=_[_0xda00('0x31')](_0x43b874[_0xda00('0x33')],qs[_0xda00('0x34')](_0x3bbaad[_0xda00('0x2e')][_0xda00('0x34')]));_0x2e864d['attributes']=_0x2e864d[_0xda00('0x32')]['length']?_0x2e864d[_0xda00('0x32')]:_0x43b874['model'];if(_0x3bbaad[_0xda00('0x2e')][_0xda00('0x3e')]){_0x2e864d[_0xda00('0x3f')]=[{'all':!![]}];}_0x2e864d=_[_0xda00('0x3a')]({},_0x2e864d,_0x3bbaad[_0xda00('0x3c')]);return db['SalesforceAccount']['find'](_0x2e864d)[_0xda00('0x23')](handleEntityNotFound(_0x53cad5,null))[_0xda00('0x23')](respondWithResult(_0x53cad5,null))[_0xda00('0x42')](handleError(_0x53cad5,null));};exports[_0xda00('0x45')]=function(_0x542885,_0x79622b){return db[_0xda00('0x3d')][_0xda00('0x45')](_0x542885[_0xda00('0x46')],{})[_0xda00('0x23')](respondWithResult(_0x79622b,0xc9))[_0xda00('0x42')](handleError(_0x79622b,null));};exports['update']=function(_0x12facc,_0x514523){if(_0x12facc['body']['id']){delete _0x12facc['body']['id'];}return db[_0xda00('0x3d')]['find']({'where':{'id':_0x12facc[_0xda00('0x44')]['id']}})['then'](handleEntityNotFound(_0x514523,null))[_0xda00('0x23')](saveUpdates(_0x12facc[_0xda00('0x46')],null))[_0xda00('0x23')](respondWithResult(_0x514523,null))[_0xda00('0x42')](handleError(_0x514523,null));};exports[_0xda00('0x24')]=function(_0x4c429b,_0x243930){return db['SalesforceAccount'][_0xda00('0x47')]({'where':{'id':_0x4c429b[_0xda00('0x44')]['id']}})[_0xda00('0x23')](handleEntityNotFound(_0x243930,null))[_0xda00('0x23')](removeEntity(_0x243930,null))[_0xda00('0x42')](handleError(_0x243930,null));};exports['getConfigurations']=function(_0x4562f1,_0x1af522,_0xa74099){var _0x29f273={};var _0x2d4c6d={};var _0x488015;var _0xc73313;return db[_0xda00('0x3d')][_0xda00('0x48')]({'where':{'id':_0x4562f1[_0xda00('0x44')]['id']}})[_0xda00('0x23')](handleEntityNotFound(_0x1af522,null))[_0xda00('0x23')](function(_0x28d0e3){if(_0x28d0e3){_0x488015=_0x28d0e3;_0x2d4c6d['model']=_[_0xda00('0x2f')](db['SalesforceConfiguration']['rawAttributes']);_0x2d4c6d[_0xda00('0x2e')]=_['keys'](_0x4562f1[_0xda00('0x2e')]);_0x2d4c6d[_0xda00('0x30')]=_['intersection'](_0x2d4c6d[_0xda00('0x33')],_0x2d4c6d[_0xda00('0x2e')]);_0x29f273[_0xda00('0x32')]=_[_0xda00('0x31')](_0x2d4c6d[_0xda00('0x33')],qs[_0xda00('0x34')](_0x4562f1[_0xda00('0x2e')][_0xda00('0x34')]));_0x29f273[_0xda00('0x32')]=_0x29f273[_0xda00('0x32')][_0xda00('0x35')]?_0x29f273[_0xda00('0x32')]:_0x2d4c6d[_0xda00('0x33')];_0x29f273[_0xda00('0x37')]=qs[_0xda00('0x49')](_0x4562f1[_0xda00('0x2e')]['sort']);_0x29f273[_0xda00('0x38')]=qs[_0xda00('0x30')](_[_0xda00('0x4a')](_0x4562f1[_0xda00('0x2e')],_0x2d4c6d[_0xda00('0x30')]));if(_0x4562f1['query'][_0xda00('0x39')]){_0x29f273['where']=_[_0xda00('0x3a')](_0x29f273['where'],{'$or':_[_0xda00('0x2d')](_0x29f273['attributes'],function(_0x471a2c){var _0xd8003f={};_0xd8003f[_0x471a2c]={'$like':'%'+_0x4562f1[_0xda00('0x2e')]['filter']+'%'};return _0xd8003f;})});}_0x29f273=_['merge']({},_0x29f273,_0x4562f1[_0xda00('0x3c')]);return _0x488015[_0xda00('0x4b')](_0x29f273);}})['then'](function(_0x314605){if(_0x314605){_0xc73313=_0x314605['length'];if(!_0x4562f1[_0xda00('0x2e')][_0xda00('0x36')]('nolimit')){_0x29f273[_0xda00('0x1c')]=qs[_0xda00('0x1c')](_0x4562f1[_0xda00('0x2e')][_0xda00('0x1c')]);_0x29f273[_0xda00('0x1b')]=qs[_0xda00('0x1b')](_0x4562f1[_0xda00('0x2e')][_0xda00('0x1b')]);}return _0x488015[_0xda00('0x4b')](_0x29f273);}})['then'](function(_0x26be94){if(_0x26be94){return _0x26be94?{'count':_0xc73313,'rows':_0x26be94}:null;}})[_0xda00('0x23')](respondWithResult(_0x1af522,null))[_0xda00('0x42')](handleError(_0x1af522,null));};exports[_0xda00('0x4c')]=function(_0x7d3601,_0x4717b4,_0x5d02b3){if(_0x7d3601[_0xda00('0x46')]['id']){delete _0x7d3601[_0xda00('0x46')]['id'];}return db[_0xda00('0x3d')][_0xda00('0x48')]({'where':{'id':_0x7d3601[_0xda00('0x44')]['id']}})[_0xda00('0x23')](handleEntityNotFound(_0x4717b4,null))['then'](function(_0x68dfe2){if(_0x68dfe2){_0x7d3601['body']['AccountId']=_0x68dfe2['id'];_0x7d3601[_0xda00('0x46')][_0xda00('0x4d')]=integrations[_0xda00('0x4e')](_0x7d3601[_0xda00('0x46')][_0xda00('0x4f')],_0x7d3601[_0xda00('0x46')][_0xda00('0x2b')]);_0x7d3601[_0xda00('0x46')][_0xda00('0x50')]=integrations[_0xda00('0x51')](_0x7d3601[_0xda00('0x46')]['channel'],_0x7d3601[_0xda00('0x46')][_0xda00('0x2b')]);return db[_0xda00('0x52')][_0xda00('0x45')](_0x7d3601['body'],{'include':[{'model':db['SalesforceField'],'as':_0xda00('0x4d')},{'model':db['SalesforceField'],'as':_0xda00('0x50')}]});}return null;})[_0xda00('0x23')](respondWithResult(_0x4717b4,null))[_0xda00('0x42')](handleError(_0x4717b4,null));};exports[_0xda00('0x53')]=function(_0x36cc6c,_0x5bffa1,_0x4966ed){var _0x324094;var _0x1684b7='';var _0x15ff29=_0xda00('0x54');return db['SalesforceAccount'][_0xda00('0x48')]({'where':{'id':_0x36cc6c[_0xda00('0x44')]['id']},'attributes':['id',_0xda00('0x55'),_0xda00('0x56'),_0xda00('0x57'),_0xda00('0x58'),_0xda00('0x59'),'securityToken']})[_0xda00('0x23')](handleEntityNotFound(_0x5bffa1,null))[_0xda00('0x23')](function(_0x57c5b2){if(_0x57c5b2){_0x1684b7=_0x57c5b2[_0xda00('0x55')];var _0x2c4d45=_0x1684b7[_0xda00('0x5a')](-0x1);if(_0x2c4d45==='/'){_0x1684b7=_0x1684b7[_0xda00('0x5b')](0x0,_0x1684b7[_0xda00('0x5c')](_0x2c4d45));}_0x324094=new jsforce[(_0xda00('0x5d'))]({'oauth2':{'loginUrl':_0x1684b7,'clientId':_0x57c5b2[_0xda00('0x56')],'clientSecret':_0x57c5b2[_0xda00('0x57')]}});return _0x324094[_0xda00('0x5e')](_0x57c5b2['username'],_0x57c5b2[_0xda00('0x59')][_0xda00('0x5f')](_0x57c5b2['securityToken']));}})['then'](function(_0x37c505){if(_0x37c505){if(!_['isNil'](_0x36cc6c[_0xda00('0x2e')][_0xda00('0x60')])){_0x15ff29=_0x36cc6c[_0xda00('0x2e')][_0xda00('0x60')];}return _0x324094['sobject'](_0x15ff29)[_0xda00('0x61')]();}})['then'](function(_0x20b1d4){var _0x372491=[_0xda00('0x62'),_0xda00('0x63'),'IsReminderSet',_0xda00('0x64'),_0xda00('0x65'),'Description'];var _0x35defc=[_0xda00('0x66'),'int',_0xda00('0x67'),_0xda00('0x68'),_0xda00('0x69'),'textarea',_0xda00('0x6a')];if(_0x20b1d4){_['remove'](_0x20b1d4['fields'],function(_0x530a47){return _0x372491[_0xda00('0x6b')](_0x530a47['name'])||!_0x35defc[_0xda00('0x6b')](_0x530a47[_0xda00('0x2b')]);});return{'count':_0x20b1d4[_0xda00('0x34')][_0xda00('0x35')],'rows':_['map'](_0x20b1d4[_0xda00('0x34')],function(_0x26ef6b){return{'id':_0x26ef6b['name'],'name':_0x26ef6b[_0xda00('0x6c')],'custom':_0x26ef6b[_0xda00('0x6d')],'options':_0x26ef6b[_0xda00('0x6e')][_0xda00('0x35')]>0x0?_['map'](_0x26ef6b[_0xda00('0x6e')],function(_0x3dc9a7){return{'name':_0x3dc9a7['label'],'value':_0x3dc9a7[_0xda00('0x6f')]};}):_0x26ef6b[_0xda00('0x2b')]=='boolean'?[{'name':_0xda00('0x70'),'value':'true'},{'name':_0xda00('0x71'),'value':_0xda00('0x72')}]:[]};})};}})['then'](respondWithResult(_0x5bffa1,null))[_0xda00('0x42')](function(_0x32dfa7){var _0x4fdb02=_0x36cc6c['query'][_0xda00('0x73')]?0x1f4:_0x32dfa7[_0xda00('0x74')]||0x1f4;logger[_0xda00('0x25')](_0xda00('0x75'),_0xda00('0x53'),_0x4fdb02,JSON['stringify'](_0x32dfa7));delete _0x32dfa7[_0xda00('0x27')];if(_0x4fdb02===0x191){_0x4fdb02=0x190;}_0x5bffa1[_0xda00('0x18')](_0x4fdb02)[_0xda00('0x28')](_0x36cc6c[_0xda00('0x2e')][_0xda00('0x73')]?{'message':_0xda00('0x76'),'statusCode':_0x32dfa7[_0xda00('0x74')]}:_0x32dfa7);});}; \ No newline at end of file +var _0xff8a=['email','phone','remove','includes','label','custom','picklistValues','value','true','False','false','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','test','eml-format','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','save','update','then','error','name','send','index','SalesforceAccount','fieldName','type','key','query','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','map','VIRTUAL','include','findAll','rows','catch','params','keys','rawAttributes','length','includeAll','find','create','body','destroy','getConfigurations','SalesforceConfiguration','options','nolimit','addConfiguration','findOne','AccountId','Subjects','channel','Descriptions','getDescriptions','SalesforceField','Task','remoteUri','clientId','clientSecret','username','password','securityToken','slice','login','concat','isNil','ticketType','sobject','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Subject','Description','picklist','boolean'];(function(_0x44bcb6,_0x16e9a3){var _0x49ac0f=function(_0x418622){while(--_0x418622){_0x44bcb6['push'](_0x44bcb6['shift']());}};_0x49ac0f(++_0x16e9a3);}(_0xff8a,0x86));var _0xaff8=function(_0xc8f794,_0x1c8170){_0xc8f794=_0xc8f794-0x0;var _0xb2b464=_0xff8a[_0xc8f794];return _0xb2b464;};'use strict';var emlformat=require(_0xaff8('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xaff8('0x1'));var rp=require(_0xaff8('0x2'));var moment=require(_0xaff8('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xaff8('0x4'));var util=require('util');var path=require('path');var sox=require(_0xaff8('0x5'));var csv=require(_0xaff8('0x6'));var ejs=require(_0xaff8('0x7'));var fs=require('fs');var fs_extra=require(_0xaff8('0x8'));var _=require('lodash');var squel=require(_0xaff8('0x9'));var crypto=require(_0xaff8('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xaff8('0x6'));var querystring=require(_0xaff8('0xb'));var Papa=require('papaparse');var Redis=require(_0xaff8('0xc'));var authService=require(_0xaff8('0xd'));var qs=require(_0xaff8('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaff8('0xf'));var logger=require('../../config/logger')(_0xaff8('0x10'));var utils=require(_0xaff8('0x11'));var config=require(_0xaff8('0x12'));var licenseUtil=require(_0xaff8('0x13'));var db=require('../../mysqldb')['db'];var integrations=require(_0xaff8('0x14'));function respondWithStatusCode(_0x4f930d,_0xc1afc6){_0xc1afc6=_0xc1afc6||0xcc;return function(_0x421038){if(_0x421038){return _0x4f930d[_0xaff8('0x15')](_0xc1afc6);}return _0x4f930d[_0xaff8('0x16')](_0xc1afc6)['end']();};}function respondWithResult(_0x1457e2,_0x53c17b){_0x53c17b=_0x53c17b||0xc8;return function(_0x2707d8){if(_0x2707d8){return _0x1457e2['status'](_0x53c17b)[_0xaff8('0x17')](_0x2707d8);}};}function respondWithFilteredResult(_0x6f9553,_0x237429){return function(_0x33ee08){if(_0x33ee08){var _0x3825af=typeof _0x237429['offset']==='undefined'&&typeof _0x237429['limit']==='undefined';var _0x85112a=_0x33ee08[_0xaff8('0x18')];var _0x18be85=_0x3825af?0x0:_0x237429[_0xaff8('0x19')];var _0x78a715=_0x3825af?_0x33ee08[_0xaff8('0x18')]:_0x237429[_0xaff8('0x19')]+_0x237429[_0xaff8('0x1a')];var _0x4d5e53;if(_0x78a715>=_0x85112a){_0x78a715=_0x85112a;_0x4d5e53=0xc8;}else{_0x4d5e53=0xce;}_0x6f9553['status'](_0x4d5e53);return _0x6f9553[_0xaff8('0x1b')](_0xaff8('0x1c'),_0x18be85+'-'+_0x78a715+'/'+_0x85112a)[_0xaff8('0x17')](_0x33ee08);}return null;};}function patchUpdates(_0x16be00){return function(_0x8fd55c){try{jsonpatch['apply'](_0x8fd55c,_0x16be00,!![]);}catch(_0x5c52e8){return BPromise[_0xaff8('0x1d')](_0x5c52e8);}return _0x8fd55c[_0xaff8('0x1e')]();};}function saveUpdates(_0xa9ca05,_0xbd79b9){return function(_0x553b7d){if(_0x553b7d){return _0x553b7d[_0xaff8('0x1f')](_0xa9ca05)[_0xaff8('0x20')](function(_0x650e1e){return _0x650e1e;});}return null;};}function removeEntity(_0x25dda3,_0x1eb6f3){return function(_0x12b6a8){if(_0x12b6a8){return _0x12b6a8['destroy']()[_0xaff8('0x20')](function(){_0x25dda3[_0xaff8('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x339f3f,_0x11a722){return function(_0x300af7){if(!_0x300af7){_0x339f3f[_0xaff8('0x15')](0x194);}return _0x300af7;};}function handleError(_0x4f7a79,_0x3aa140){_0x3aa140=_0x3aa140||0x1f4;return function(_0x5241cb){logger[_0xaff8('0x21')](_0x5241cb['stack']);if(_0x5241cb[_0xaff8('0x22')]){delete _0x5241cb[_0xaff8('0x22')];}_0x4f7a79[_0xaff8('0x16')](_0x3aa140)[_0xaff8('0x23')](_0x5241cb);};}exports[_0xaff8('0x24')]=function(_0x5dec6c,_0x4fce88){var _0x4fcdaa={},_0x47cf27={},_0x191fb8={'count':0x0,'rows':[]};var _0x5bd63f=_['map'](db[_0xaff8('0x25')]['rawAttributes'],function(_0x3b155d){return{'name':_0x3b155d[_0xaff8('0x26')],'type':_0x3b155d[_0xaff8('0x27')][_0xaff8('0x28')]};});_0x47cf27['model']=_['map'](_0x5bd63f,_0xaff8('0x22'));_0x47cf27[_0xaff8('0x29')]=_['keys'](_0x5dec6c['query']);_0x47cf27[_0xaff8('0x2a')]=_[_0xaff8('0x2b')](_0x47cf27[_0xaff8('0x2c')],_0x47cf27['query']);_0x4fcdaa[_0xaff8('0x2d')]=_[_0xaff8('0x2b')](_0x47cf27[_0xaff8('0x2c')],qs[_0xaff8('0x2e')](_0x5dec6c[_0xaff8('0x29')][_0xaff8('0x2e')]));_0x4fcdaa[_0xaff8('0x2d')]=_0x4fcdaa[_0xaff8('0x2d')]['length']?_0x4fcdaa[_0xaff8('0x2d')]:_0x47cf27[_0xaff8('0x2c')];if(!_0x5dec6c[_0xaff8('0x29')][_0xaff8('0x2f')]('nolimit')){_0x4fcdaa[_0xaff8('0x1a')]=qs[_0xaff8('0x1a')](_0x5dec6c[_0xaff8('0x29')][_0xaff8('0x1a')]);_0x4fcdaa[_0xaff8('0x19')]=qs[_0xaff8('0x19')](_0x5dec6c['query'][_0xaff8('0x19')]);}_0x4fcdaa[_0xaff8('0x30')]=qs['sort'](_0x5dec6c[_0xaff8('0x29')][_0xaff8('0x31')]);_0x4fcdaa[_0xaff8('0x32')]=qs[_0xaff8('0x2a')](_[_0xaff8('0x33')](_0x5dec6c[_0xaff8('0x29')],_0x47cf27[_0xaff8('0x2a')]),_0x5bd63f);if(_0x5dec6c['query'][_0xaff8('0x34')]){_0x4fcdaa[_0xaff8('0x32')]=_[_0xaff8('0x35')](_0x4fcdaa[_0xaff8('0x32')],{'$or':_[_0xaff8('0x36')](_0x5bd63f,function(_0x5da5d9){if(_0x5da5d9[_0xaff8('0x27')]!==_0xaff8('0x37')){var _0x258f4c={};_0x258f4c[_0x5da5d9[_0xaff8('0x22')]]={'$like':'%'+_0x5dec6c[_0xaff8('0x29')][_0xaff8('0x34')]+'%'};return _0x258f4c;}})});}_0x4fcdaa=_[_0xaff8('0x35')]({},_0x4fcdaa,_0x5dec6c['options']);var _0x51cdbc={'where':_0x4fcdaa[_0xaff8('0x32')]};return db[_0xaff8('0x25')]['count'](_0x51cdbc)[_0xaff8('0x20')](function(_0x1dd934){_0x191fb8[_0xaff8('0x18')]=_0x1dd934;if(_0x5dec6c[_0xaff8('0x29')]['includeAll']){_0x4fcdaa[_0xaff8('0x38')]=[{'all':!![]}];}return db[_0xaff8('0x25')][_0xaff8('0x39')](_0x4fcdaa);})[_0xaff8('0x20')](function(_0x48cfd2){_0x191fb8[_0xaff8('0x3a')]=_0x48cfd2;return _0x191fb8;})[_0xaff8('0x20')](respondWithFilteredResult(_0x4fce88,_0x4fcdaa))[_0xaff8('0x3b')](handleError(_0x4fce88,null));};exports['show']=function(_0x1f41ba,_0x3e7347){var _0x579c0d={'raw':![],'where':{'id':_0x1f41ba[_0xaff8('0x3c')]['id']}},_0x5e4265={};_0x5e4265['model']=_[_0xaff8('0x3d')](db['SalesforceAccount'][_0xaff8('0x3e')]);_0x5e4265[_0xaff8('0x29')]=_['keys'](_0x1f41ba[_0xaff8('0x29')]);_0x5e4265[_0xaff8('0x2a')]=_['intersection'](_0x5e4265[_0xaff8('0x2c')],_0x5e4265['query']);_0x579c0d['attributes']=_['intersection'](_0x5e4265[_0xaff8('0x2c')],qs[_0xaff8('0x2e')](_0x1f41ba['query'][_0xaff8('0x2e')]));_0x579c0d[_0xaff8('0x2d')]=_0x579c0d[_0xaff8('0x2d')][_0xaff8('0x3f')]?_0x579c0d[_0xaff8('0x2d')]:_0x5e4265[_0xaff8('0x2c')];if(_0x1f41ba[_0xaff8('0x29')][_0xaff8('0x40')]){_0x579c0d[_0xaff8('0x38')]=[{'all':!![]}];}_0x579c0d=_[_0xaff8('0x35')]({},_0x579c0d,_0x1f41ba['options']);return db[_0xaff8('0x25')][_0xaff8('0x41')](_0x579c0d)[_0xaff8('0x20')](handleEntityNotFound(_0x3e7347,null))[_0xaff8('0x20')](respondWithResult(_0x3e7347,null))[_0xaff8('0x3b')](handleError(_0x3e7347,null));};exports[_0xaff8('0x42')]=function(_0x2786c0,_0x2e1e52){return db[_0xaff8('0x25')]['create'](_0x2786c0[_0xaff8('0x43')],{})[_0xaff8('0x20')](respondWithResult(_0x2e1e52,0xc9))['catch'](handleError(_0x2e1e52,null));};exports[_0xaff8('0x1f')]=function(_0x3bb5ab,_0x38a337){if(_0x3bb5ab[_0xaff8('0x43')]['id']){delete _0x3bb5ab[_0xaff8('0x43')]['id'];}return db[_0xaff8('0x25')][_0xaff8('0x41')]({'where':{'id':_0x3bb5ab[_0xaff8('0x3c')]['id']}})[_0xaff8('0x20')](handleEntityNotFound(_0x38a337,null))['then'](saveUpdates(_0x3bb5ab[_0xaff8('0x43')],null))[_0xaff8('0x20')](respondWithResult(_0x38a337,null))[_0xaff8('0x3b')](handleError(_0x38a337,null));};exports[_0xaff8('0x44')]=function(_0x48fc15,_0x39ee48){return db['SalesforceAccount'][_0xaff8('0x41')]({'where':{'id':_0x48fc15['params']['id']}})['then'](handleEntityNotFound(_0x39ee48,null))[_0xaff8('0x20')](removeEntity(_0x39ee48,null))[_0xaff8('0x3b')](handleError(_0x39ee48,null));};exports[_0xaff8('0x45')]=function(_0xbe0880,_0x6789c9,_0xe8c6da){var _0x2d4983={};var _0x3ca901={};var _0x18a0b4;var _0x5aa79e;return db[_0xaff8('0x25')]['findOne']({'where':{'id':_0xbe0880[_0xaff8('0x3c')]['id']}})[_0xaff8('0x20')](handleEntityNotFound(_0x6789c9,null))['then'](function(_0x3e2074){if(_0x3e2074){_0x18a0b4=_0x3e2074;_0x3ca901[_0xaff8('0x2c')]=_['keys'](db[_0xaff8('0x46')][_0xaff8('0x3e')]);_0x3ca901[_0xaff8('0x29')]=_['keys'](_0xbe0880[_0xaff8('0x29')]);_0x3ca901[_0xaff8('0x2a')]=_['intersection'](_0x3ca901[_0xaff8('0x2c')],_0x3ca901[_0xaff8('0x29')]);_0x2d4983[_0xaff8('0x2d')]=_[_0xaff8('0x2b')](_0x3ca901[_0xaff8('0x2c')],qs[_0xaff8('0x2e')](_0xbe0880[_0xaff8('0x29')][_0xaff8('0x2e')]));_0x2d4983[_0xaff8('0x2d')]=_0x2d4983[_0xaff8('0x2d')][_0xaff8('0x3f')]?_0x2d4983['attributes']:_0x3ca901['model'];_0x2d4983[_0xaff8('0x30')]=qs[_0xaff8('0x31')](_0xbe0880['query'][_0xaff8('0x31')]);_0x2d4983[_0xaff8('0x32')]=qs[_0xaff8('0x2a')](_[_0xaff8('0x33')](_0xbe0880['query'],_0x3ca901[_0xaff8('0x2a')]));if(_0xbe0880['query'][_0xaff8('0x34')]){_0x2d4983[_0xaff8('0x32')]=_[_0xaff8('0x35')](_0x2d4983[_0xaff8('0x32')],{'$or':_[_0xaff8('0x36')](_0x2d4983[_0xaff8('0x2d')],function(_0xc360f8){var _0x2a6516={};_0x2a6516[_0xc360f8]={'$like':'%'+_0xbe0880[_0xaff8('0x29')][_0xaff8('0x34')]+'%'};return _0x2a6516;})});}_0x2d4983=_[_0xaff8('0x35')]({},_0x2d4983,_0xbe0880[_0xaff8('0x47')]);return _0x18a0b4[_0xaff8('0x45')](_0x2d4983);}})[_0xaff8('0x20')](function(_0x315031){if(_0x315031){_0x5aa79e=_0x315031[_0xaff8('0x3f')];if(!_0xbe0880[_0xaff8('0x29')][_0xaff8('0x2f')](_0xaff8('0x48'))){_0x2d4983[_0xaff8('0x1a')]=qs[_0xaff8('0x1a')](_0xbe0880['query'][_0xaff8('0x1a')]);_0x2d4983[_0xaff8('0x19')]=qs[_0xaff8('0x19')](_0xbe0880[_0xaff8('0x29')][_0xaff8('0x19')]);}return _0x18a0b4[_0xaff8('0x45')](_0x2d4983);}})[_0xaff8('0x20')](function(_0x288813){if(_0x288813){return _0x288813?{'count':_0x5aa79e,'rows':_0x288813}:null;}})['then'](respondWithResult(_0x6789c9,null))['catch'](handleError(_0x6789c9,null));};exports[_0xaff8('0x49')]=function(_0x4d748a,_0x75d316,_0x53784a){if(_0x4d748a[_0xaff8('0x43')]['id']){delete _0x4d748a['body']['id'];}return db[_0xaff8('0x25')][_0xaff8('0x4a')]({'where':{'id':_0x4d748a[_0xaff8('0x3c')]['id']}})['then'](handleEntityNotFound(_0x75d316,null))['then'](function(_0x2a03da){if(_0x2a03da){_0x4d748a['body'][_0xaff8('0x4b')]=_0x2a03da['id'];_0x4d748a[_0xaff8('0x43')][_0xaff8('0x4c')]=integrations['getSubjects'](_0x4d748a['body'][_0xaff8('0x4d')],_0x4d748a['body'][_0xaff8('0x27')]);_0x4d748a['body'][_0xaff8('0x4e')]=integrations[_0xaff8('0x4f')](_0x4d748a['body'][_0xaff8('0x4d')],_0x4d748a[_0xaff8('0x43')]['type']);return db[_0xaff8('0x46')][_0xaff8('0x42')](_0x4d748a['body'],{'include':[{'model':db[_0xaff8('0x50')],'as':'Subjects'},{'model':db[_0xaff8('0x50')],'as':'Descriptions'}]});}return null;})[_0xaff8('0x20')](respondWithResult(_0x75d316,null))['catch'](handleError(_0x75d316,null));};exports['getFields']=function(_0x244c95,_0x34d7ac,_0x4d525b){var _0x4bedc2;var _0x145ebf='';var _0x30af7a=_0xaff8('0x51');return db[_0xaff8('0x25')][_0xaff8('0x4a')]({'where':{'id':_0x244c95[_0xaff8('0x3c')]['id']},'attributes':['id',_0xaff8('0x52'),_0xaff8('0x53'),_0xaff8('0x54'),_0xaff8('0x55'),_0xaff8('0x56'),_0xaff8('0x57')]})[_0xaff8('0x20')](handleEntityNotFound(_0x34d7ac,null))['then'](function(_0x29886c){if(_0x29886c){_0x145ebf=_0x29886c['remoteUri'];var _0x36d582=_0x145ebf[_0xaff8('0x58')](-0x1);if(_0x36d582==='/'){_0x145ebf=_0x145ebf['substring'](0x0,_0x145ebf['lastIndexOf'](_0x36d582));}_0x4bedc2=new jsforce['Connection']({'oauth2':{'loginUrl':_0x145ebf,'clientId':_0x29886c[_0xaff8('0x53')],'clientSecret':_0x29886c[_0xaff8('0x54')]}});return _0x4bedc2[_0xaff8('0x59')](_0x29886c[_0xaff8('0x55')],_0x29886c['password'][_0xaff8('0x5a')](_0x29886c[_0xaff8('0x57')]));}})['then'](function(_0x26a3ef){if(_0x26a3ef){if(!_[_0xaff8('0x5b')](_0x244c95[_0xaff8('0x29')][_0xaff8('0x5c')])){_0x30af7a=_0x244c95[_0xaff8('0x29')][_0xaff8('0x5c')];}return _0x4bedc2[_0xaff8('0x5d')](_0x30af7a)['describe']();}})[_0xaff8('0x20')](function(_0x35bf36){var _0x1d92ae=[_0xaff8('0x5e'),_0xaff8('0x5f'),_0xaff8('0x60'),_0xaff8('0x61'),_0xaff8('0x62'),_0xaff8('0x63')];var _0x7670e6=['string','int',_0xaff8('0x64'),_0xaff8('0x65'),_0xaff8('0x66'),'textarea',_0xaff8('0x67')];if(_0x35bf36){_[_0xaff8('0x68')](_0x35bf36[_0xaff8('0x2e')],function(_0x155651){return _0x1d92ae[_0xaff8('0x69')](_0x155651[_0xaff8('0x22')])||!_0x7670e6['includes'](_0x155651[_0xaff8('0x27')]);});return{'count':_0x35bf36[_0xaff8('0x2e')][_0xaff8('0x3f')],'rows':_[_0xaff8('0x36')](_0x35bf36[_0xaff8('0x2e')],function(_0x3f87fb){return{'id':_0x3f87fb[_0xaff8('0x22')],'name':_0x3f87fb[_0xaff8('0x6a')],'custom':_0x3f87fb[_0xaff8('0x6b')],'options':_0x3f87fb[_0xaff8('0x6c')]['length']>0x0?_['map'](_0x3f87fb[_0xaff8('0x6c')],function(_0x15fff8){return{'name':_0x15fff8[_0xaff8('0x6a')],'value':_0x15fff8[_0xaff8('0x6d')]};}):_0x3f87fb[_0xaff8('0x27')]==_0xaff8('0x65')?[{'name':'True','value':_0xaff8('0x6e')},{'name':_0xaff8('0x6f'),'value':_0xaff8('0x70')}]:[]};})};}})[_0xaff8('0x20')](respondWithResult(_0x34d7ac,null))[_0xaff8('0x3b')](function(_0x1720a7){var _0xfbb7b5=_0x244c95[_0xaff8('0x29')]['test']?0x1f4:_0x1720a7[_0xaff8('0x71')]||0x1f4;logger['error'](_0xaff8('0x72'),_0xaff8('0x73'),_0xfbb7b5,JSON[_0xaff8('0x74')](_0x1720a7));delete _0x1720a7[_0xaff8('0x22')];if(_0xfbb7b5===0x191){_0xfbb7b5=0x190;}_0x34d7ac['status'](_0xfbb7b5)['send'](_0x244c95[_0xaff8('0x29')][_0xaff8('0x75')]?{'message':'Wrong\x20credentials','statusCode':_0x1720a7[_0xaff8('0x71')]}:_0x1720a7);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index ee7e27d..ac5ad4a 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 _0x1b70=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','define','int_salesforce_accounts','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1b70,0xa7));var _0x01b7=function(_0x2adbeb,_0x5581be){_0x2adbeb=_0x2adbeb-0x0;var _0x5e18a6=_0x1b70[_0x2adbeb];return _0x5e18a6;};'use strict';var _=require(_0x01b7('0x0'));var util=require(_0x01b7('0x1'));var logger=require(_0x01b7('0x2'))(_0x01b7('0x3'));var moment=require(_0x01b7('0x4'));var BPromise=require(_0x01b7('0x5'));var rp=require(_0x01b7('0x6'));var fs=require('fs');var path=require(_0x01b7('0x7'));var rimraf=require(_0x01b7('0x8'));var config=require(_0x01b7('0x9'));var attributes=require('./intSalesforceAccount.attributes');var integrations=require(_0x01b7('0xa'));module[_0x01b7('0xb')]=function(_0x13564b,_0x5a2976){return _0x13564b[_0x01b7('0xc')]('SalesforceAccount',attributes,{'tableName':_0x01b7('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0a70=['request-promise','path','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','define','SalesforceAccount','int_salesforce_accounts','lodash','util','api','moment','bluebird'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x0a70,0x1c2));var _0x00a7=function(_0x589056,_0x102f9f){_0x589056=_0x589056-0x0;var _0x805f55=_0x0a70[_0x589056];return _0x805f55;};'use strict';var _=require(_0x00a7('0x0'));var util=require(_0x00a7('0x1'));var logger=require('../../config/logger')(_0x00a7('0x2'));var moment=require(_0x00a7('0x3'));var BPromise=require(_0x00a7('0x4'));var rp=require(_0x00a7('0x5'));var fs=require('fs');var path=require(_0x00a7('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x00a7('0x7'));var integrations=require(_0x00a7('0x8'));module[_0x00a7('0x9')]=function(_0xe868e4,_0x213741){return _0xe868e4[_0x00a7('0xa')](_0x00a7('0xb'),attributes,{'tableName':_0x00a7('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js b/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js index 4c66f68..d7af914 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 _0xb2d2=['util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','GetSalesforceAccount','SalesforceAccount','options','where','limit','include','model','map','attributes','ShowSalesforceAccount','find','raw'];(function(_0x499cfe,_0x439165){var _0x549efb=function(_0x41ea79){while(--_0x41ea79){_0x499cfe['push'](_0x499cfe['shift']());}};_0x549efb(++_0x439165);}(_0xb2d2,0x1ef));var _0x2b2d=function(_0x1d9442,_0x5dc3ea){_0x1d9442=_0x1d9442-0x0;var _0x326649=_0xb2d2[_0x1d9442];return _0x326649;};'use strict';var _=require('lodash');var util=require(_0x2b2d('0x0'));var moment=require('moment');var BPromise=require(_0x2b2d('0x1'));var rs=require(_0x2b2d('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2b2d('0x3'))['db'];var utils=require(_0x2b2d('0x4'));var logger=require('../../config/logger')(_0x2b2d('0x5'));var config=require(_0x2b2d('0x6'));var jayson=require(_0x2b2d('0x7'));var client=jayson['client'][_0x2b2d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x546a1f,_0x102950,_0x419ef5){return new BPromise(function(_0x5776f6,_0x2d5692){return client[_0x2b2d('0x9')](_0x546a1f,_0x419ef5)[_0x2b2d('0xa')](function(_0x3d92da){logger[_0x2b2d('0xb')](_0x2b2d('0xc'),_0x102950,'request\x20sent');logger[_0x2b2d('0xd')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x102950,_0x2b2d('0xe'),JSON[_0x2b2d('0xf')](_0x3d92da));if(_0x3d92da[_0x2b2d('0x10')]){if(_0x3d92da[_0x2b2d('0x10')][_0x2b2d('0x11')]===0x1f4){logger[_0x2b2d('0x10')](_0x2b2d('0xc'),_0x102950,_0x3d92da[_0x2b2d('0x10')][_0x2b2d('0x12')]);return _0x2d5692(_0x3d92da[_0x2b2d('0x10')][_0x2b2d('0x12')]);}logger[_0x2b2d('0x10')](_0x2b2d('0xc'),_0x102950,_0x3d92da['error']['message']);return _0x5776f6(_0x3d92da[_0x2b2d('0x10')][_0x2b2d('0x12')]);}else{logger[_0x2b2d('0xb')](_0x2b2d('0xc'),_0x102950,_0x2b2d('0xe'));_0x5776f6(_0x3d92da[_0x2b2d('0x13')]['message']);}})[_0x2b2d('0x14')](function(_0x5d8e6e){logger[_0x2b2d('0x10')](_0x2b2d('0xc'),_0x102950,_0x5d8e6e);_0x2d5692(_0x5d8e6e);});});}exports[_0x2b2d('0x15')]=function(_0x18501d){var _0x515363=this;return new Promise(function(_0x2a49be,_0x2c482f){return db[_0x2b2d('0x16')]['findAll']({'raw':_0x18501d[_0x2b2d('0x17')]?_0x18501d[_0x2b2d('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x18501d[_0x2b2d('0x17')]?_0x18501d[_0x2b2d('0x17')][_0x2b2d('0x18')]||null:null,'attributes':_0x18501d[_0x2b2d('0x17')]?_0x18501d[_0x2b2d('0x17')]['attributes']||null:null,'limit':_0x18501d[_0x2b2d('0x17')]?_0x18501d['options'][_0x2b2d('0x19')]||null:null,'include':_0x18501d['options']?_0x18501d[_0x2b2d('0x17')][_0x2b2d('0x1a')]?_['map'](_0x18501d[_0x2b2d('0x17')][_0x2b2d('0x1a')],function(_0x55c0b7){return{'model':db[_0x55c0b7[_0x2b2d('0x1b')]],'as':_0x55c0b7['as'],'attributes':_0x55c0b7['attributes'],'include':_0x55c0b7[_0x2b2d('0x1a')]?_['map'](_0x55c0b7[_0x2b2d('0x1a')],function(_0x5ea1ca){return{'model':db[_0x5ea1ca[_0x2b2d('0x1b')]],'as':_0x5ea1ca['as'],'attributes':_0x5ea1ca['attributes'],'include':_0x5ea1ca[_0x2b2d('0x1a')]?_[_0x2b2d('0x1c')](_0x5ea1ca[_0x2b2d('0x1a')],function(_0x1e125e){return{'model':db[_0x1e125e[_0x2b2d('0x1b')]],'as':_0x1e125e['as'],'attributes':_0x1e125e[_0x2b2d('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x2b2d('0xa')](function(_0x2a3898){logger[_0x2b2d('0xb')](_0x2b2d('0x15'),_0x18501d);logger['debug']('GetSalesforceAccount',_0x18501d,JSON[_0x2b2d('0xf')](_0x2a3898));_0x2a49be(_0x2a3898);})[_0x2b2d('0x14')](function(_0xd672f9){logger[_0x2b2d('0x10')](_0x2b2d('0x15'),_0xd672f9[_0x2b2d('0x12')],_0x18501d);_0x2c482f(_0x515363['error'](0x1f4,_0xd672f9[_0x2b2d('0x12')]));});});};exports[_0x2b2d('0x1e')]=function(_0x449e8c){var _0xbb12aa=this;return new Promise(function(_0x12ceaf,_0x138cfc){return db[_0x2b2d('0x16')][_0x2b2d('0x1f')]({'raw':_0x449e8c[_0x2b2d('0x17')]?_0x449e8c[_0x2b2d('0x17')][_0x2b2d('0x20')]===undefined?!![]:![]:!![],'where':_0x449e8c[_0x2b2d('0x17')]?_0x449e8c['options'][_0x2b2d('0x18')]||null:null,'attributes':_0x449e8c[_0x2b2d('0x17')]?_0x449e8c['options']['attributes']||null:null,'include':_0x449e8c[_0x2b2d('0x17')]?_0x449e8c['options'][_0x2b2d('0x1a')]?_[_0x2b2d('0x1c')](_0x449e8c['options'][_0x2b2d('0x1a')],function(_0x9c4dae){return{'model':db[_0x9c4dae[_0x2b2d('0x1b')]],'as':_0x9c4dae['as'],'attributes':_0x9c4dae[_0x2b2d('0x1d')],'include':_0x9c4dae['include']?_[_0x2b2d('0x1c')](_0x9c4dae[_0x2b2d('0x1a')],function(_0x1d73ea){return{'model':db[_0x1d73ea[_0x2b2d('0x1b')]],'as':_0x1d73ea['as'],'attributes':_0x1d73ea[_0x2b2d('0x1d')],'include':_0x1d73ea['include']?_[_0x2b2d('0x1c')](_0x1d73ea[_0x2b2d('0x1a')],function(_0x3e4cb4){return{'model':db[_0x3e4cb4[_0x2b2d('0x1b')]],'as':_0x3e4cb4['as'],'attributes':_0x3e4cb4['attributes']};}):[]};}):[]};}):[]:[]})[_0x2b2d('0xa')](function(_0x1b3fa5){logger[_0x2b2d('0xb')](_0x2b2d('0x1e'),_0x449e8c);logger[_0x2b2d('0xd')](_0x2b2d('0x1e'),_0x449e8c,JSON[_0x2b2d('0xf')](_0x1b3fa5));_0x12ceaf(_0x1b3fa5);})[_0x2b2d('0x14')](function(_0x2f590c){logger['error'](_0x2b2d('0x1e'),_0x2f590c[_0x2b2d('0x12')],_0x449e8c);_0x138cfc(_0xbb12aa[_0x2b2d('0x10')](0x1f4,_0x2f590c['message']));});});}; \ No newline at end of file +var _0x07e8=['util','moment','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetSalesforceAccount','SalesforceAccount','findAll','options','raw','where','attributes','limit','include','map','model','ShowSalesforceAccount','find','lodash'];(function(_0x590b61,_0x4c4335){var _0x1a14dc=function(_0x2ff4f6){while(--_0x2ff4f6){_0x590b61['push'](_0x590b61['shift']());}};_0x1a14dc(++_0x4c4335);}(_0x07e8,0x10f));var _0x807e=function(_0x2149e0,_0xc80990){_0x2149e0=_0x2149e0-0x0;var _0x2a0d7a=_0x07e8[_0x2149e0];return _0x2a0d7a;};'use strict';var _=require(_0x807e('0x0'));var util=require(_0x807e('0x1'));var moment=require(_0x807e('0x2'));var BPromise=require('bluebird');var rs=require(_0x807e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x807e('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x807e('0x5'));var config=require(_0x807e('0x6'));var jayson=require(_0x807e('0x7'));var client=jayson['client'][_0x807e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xa12efd,_0x30766c,_0x178efb){return new BPromise(function(_0x1845b3,_0x54e3cb){return client[_0x807e('0x9')](_0xa12efd,_0x178efb)[_0x807e('0xa')](function(_0x400374){logger[_0x807e('0xb')](_0x807e('0xc'),_0x30766c,_0x807e('0xd'));logger[_0x807e('0xe')](_0x807e('0xf'),_0x30766c,_0x807e('0xd'),JSON[_0x807e('0x10')](_0x400374));if(_0x400374[_0x807e('0x11')]){if(_0x400374[_0x807e('0x11')][_0x807e('0x12')]===0x1f4){logger[_0x807e('0x11')]('SalesforceAccount,\x20%s,\x20%s',_0x30766c,_0x400374[_0x807e('0x11')][_0x807e('0x13')]);return _0x54e3cb(_0x400374[_0x807e('0x11')][_0x807e('0x13')]);}logger[_0x807e('0x11')](_0x807e('0xc'),_0x30766c,_0x400374[_0x807e('0x11')]['message']);return _0x1845b3(_0x400374['error'][_0x807e('0x13')]);}else{logger[_0x807e('0xb')](_0x807e('0xc'),_0x30766c,_0x807e('0xd'));_0x1845b3(_0x400374['result'][_0x807e('0x13')]);}})[_0x807e('0x14')](function(_0x1ffc81){logger[_0x807e('0x11')](_0x807e('0xc'),_0x30766c,_0x1ffc81);_0x54e3cb(_0x1ffc81);});});}exports[_0x807e('0x15')]=function(_0x535987){var _0x81676e=this;return new Promise(function(_0x57af7a,_0x3ce49b){return db[_0x807e('0x16')][_0x807e('0x17')]({'raw':_0x535987[_0x807e('0x18')]?_0x535987[_0x807e('0x18')][_0x807e('0x19')]===undefined?!![]:![]:!![],'where':_0x535987[_0x807e('0x18')]?_0x535987[_0x807e('0x18')][_0x807e('0x1a')]||null:null,'attributes':_0x535987['options']?_0x535987['options'][_0x807e('0x1b')]||null:null,'limit':_0x535987[_0x807e('0x18')]?_0x535987[_0x807e('0x18')][_0x807e('0x1c')]||null:null,'include':_0x535987[_0x807e('0x18')]?_0x535987[_0x807e('0x18')][_0x807e('0x1d')]?_[_0x807e('0x1e')](_0x535987['options'][_0x807e('0x1d')],function(_0x2a0a70){return{'model':db[_0x2a0a70[_0x807e('0x1f')]],'as':_0x2a0a70['as'],'attributes':_0x2a0a70[_0x807e('0x1b')],'include':_0x2a0a70[_0x807e('0x1d')]?_[_0x807e('0x1e')](_0x2a0a70['include'],function(_0x277560){return{'model':db[_0x277560['model']],'as':_0x277560['as'],'attributes':_0x277560[_0x807e('0x1b')],'include':_0x277560[_0x807e('0x1d')]?_[_0x807e('0x1e')](_0x277560['include'],function(_0x36bb30){return{'model':db[_0x36bb30[_0x807e('0x1f')]],'as':_0x36bb30['as'],'attributes':_0x36bb30[_0x807e('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x807e('0xa')](function(_0x395754){logger[_0x807e('0xb')]('GetSalesforceAccount',_0x535987);logger[_0x807e('0xe')]('GetSalesforceAccount',_0x535987,JSON[_0x807e('0x10')](_0x395754));_0x57af7a(_0x395754);})[_0x807e('0x14')](function(_0x146112){logger['error'](_0x807e('0x15'),_0x146112[_0x807e('0x13')],_0x535987);_0x3ce49b(_0x81676e['error'](0x1f4,_0x146112[_0x807e('0x13')]));});});};exports[_0x807e('0x20')]=function(_0x57af90){var _0x344eec=this;return new Promise(function(_0x525061,_0x3b9249){return db[_0x807e('0x16')][_0x807e('0x21')]({'raw':_0x57af90[_0x807e('0x18')]?_0x57af90['options']['raw']===undefined?!![]:![]:!![],'where':_0x57af90[_0x807e('0x18')]?_0x57af90[_0x807e('0x18')][_0x807e('0x1a')]||null:null,'attributes':_0x57af90[_0x807e('0x18')]?_0x57af90[_0x807e('0x18')]['attributes']||null:null,'include':_0x57af90['options']?_0x57af90[_0x807e('0x18')][_0x807e('0x1d')]?_['map'](_0x57af90[_0x807e('0x18')][_0x807e('0x1d')],function(_0x3bb392){return{'model':db[_0x3bb392[_0x807e('0x1f')]],'as':_0x3bb392['as'],'attributes':_0x3bb392[_0x807e('0x1b')],'include':_0x3bb392[_0x807e('0x1d')]?_[_0x807e('0x1e')](_0x3bb392[_0x807e('0x1d')],function(_0x1632a7){return{'model':db[_0x1632a7[_0x807e('0x1f')]],'as':_0x1632a7['as'],'attributes':_0x1632a7['attributes'],'include':_0x1632a7[_0x807e('0x1d')]?_[_0x807e('0x1e')](_0x1632a7[_0x807e('0x1d')],function(_0x498301){return{'model':db[_0x498301[_0x807e('0x1f')]],'as':_0x498301['as'],'attributes':_0x498301[_0x807e('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x807e('0xa')](function(_0x546370){logger['info'](_0x807e('0x20'),_0x57af90);logger['debug']('ShowSalesforceAccount',_0x57af90,JSON[_0x807e('0x10')](_0x546370));_0x525061(_0x546370);})[_0x807e('0x14')](function(_0x33c75f){logger[_0x807e('0x11')](_0x807e('0x20'),_0x33c75f[_0x807e('0x13')],_0x57af90);_0x3b9249(_0x344eec[_0x807e('0x11')](0x1f4,_0x33c75f[_0x807e('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index feab32e..2e55408 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 _0x0b0e=['post','create','put','/:id','update','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','/:id/subjects','getSubjects','getDescriptions'];(function(_0x18b5e8,_0x51e875){var _0x25baed=function(_0x3fcdf9){while(--_0x3fcdf9){_0x18b5e8['push'](_0x18b5e8['shift']());}};_0x25baed(++_0x51e875);}(_0x0b0e,0x187));var _0xe0b0=function(_0x3712e2,_0x32d752){_0x3712e2=_0x3712e2-0x0;var _0x1faff4=_0x0b0e[_0x3712e2];return _0x1faff4;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var fs_extra=require(_0xe0b0('0x4'));var auth=require(_0xe0b0('0x5'));var interaction=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var controller=require(_0xe0b0('0x8'));router[_0xe0b0('0x9')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xb')]);router[_0xe0b0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0x9')](_0xe0b0('0xd'),auth[_0xe0b0('0xa')](),controller['getFields']);router[_0xe0b0('0x9')](_0xe0b0('0xe'),auth['isAuthenticated'](),controller[_0xe0b0('0xf')]);router[_0xe0b0('0x9')]('/:id/descriptions',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x10')]);router[_0xe0b0('0x11')]('/',auth['isAuthenticated'](),controller[_0xe0b0('0x12')]);router[_0xe0b0('0x13')](_0xe0b0('0x14'),auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x15')]);router['delete'](_0xe0b0('0x14'),auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x16')]);module[_0xe0b0('0x17')]=router; \ No newline at end of file +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(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0xdb28,0x106));var _0x8db2=function(_0x406957,_0x5b33d3){_0x406957=_0x406957-0x0;var _0x144be8=_0xdb28[_0x406957];return _0x144be8;};'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 7e81c37..c7386f0 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 _0x4d3b=['ENUM','Task','Case','contact_lead','lead','account_contact_lead','nothing','contact','account','exports','STRING'];(function(_0xcd0918,_0x56bdf9){var _0x250704=function(_0x56788e){while(--_0x56788e){_0xcd0918['push'](_0xcd0918['shift']());}};_0x250704(++_0x56bdf9);}(_0x4d3b,0x1ab));var _0xb4d3=function(_0x15b64c,_0x439a5d){_0x15b64c=_0x15b64c-0x0;var _0x3318ce=_0x4d3b[_0x15b64c];return _0x3318ce;};'use strict';var Sequelize=require('sequelize');module[_0xb4d3('0x0')]={'name':{'type':Sequelize[_0xb4d3('0x1')]},'description':{'type':Sequelize[_0xb4d3('0x1')]},'ticketType':{'type':Sequelize[_0xb4d3('0x2')](_0xb4d3('0x3'),_0xb4d3('0x4')),'defaultValue':_0xb4d3('0x3')},'moduleSearch':{'type':Sequelize[_0xb4d3('0x2')](_0xb4d3('0x5'),'contact',_0xb4d3('0x6'),_0xb4d3('0x7'),'account'),'defaultValue':_0xb4d3('0x5')},'moduleCreate':{'type':Sequelize[_0xb4d3('0x2')](_0xb4d3('0x8'),_0xb4d3('0x9'),_0xb4d3('0x6'),_0xb4d3('0xa')),'defaultValue':_0xb4d3('0x6')},'leadId':{'type':Sequelize['STRING']},'additionalSearchAccount':{'type':Sequelize[_0xb4d3('0x1')]},'additionalSearchContact':{'type':Sequelize[_0xb4d3('0x1')]},'additionalSearchLead':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6f62=['account','contact_lead','contact','sequelize','exports','STRING','ENUM','Task','Case','lead','account_contact_lead'];(function(_0x5205f9,_0x5c3a15){var _0x1e3361=function(_0x18895a){while(--_0x18895a){_0x5205f9['push'](_0x5205f9['shift']());}};_0x1e3361(++_0x5c3a15);}(_0x6f62,0x12c));var _0x26f6=function(_0x8a969d,_0x339d9f){_0x8a969d=_0x8a969d-0x0;var _0x1d8dc7=_0x6f62[_0x8a969d];return _0x1d8dc7;};'use strict';var Sequelize=require(_0x26f6('0x0'));module[_0x26f6('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x26f6('0x2')]},'ticketType':{'type':Sequelize[_0x26f6('0x3')](_0x26f6('0x4'),_0x26f6('0x5')),'defaultValue':_0x26f6('0x4')},'moduleSearch':{'type':Sequelize[_0x26f6('0x3')]('contact_lead','contact',_0x26f6('0x6'),_0x26f6('0x7'),_0x26f6('0x8')),'defaultValue':_0x26f6('0x9')},'moduleCreate':{'type':Sequelize[_0x26f6('0x3')]('nothing',_0x26f6('0xa'),_0x26f6('0x6'),_0x26f6('0x8')),'defaultValue':_0x26f6('0x6')},'leadId':{'type':Sequelize['STRING']},'additionalSearchAccount':{'type':Sequelize[_0x26f6('0x2')]},'additionalSearchContact':{'type':Sequelize[_0x26f6('0x2')]},'additionalSearchLead':{'type':Sequelize[_0x26f6('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 4042522..a2d21d3 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 _0xdb15=['querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','then','destroy','sendStatus','error','name','index','map','rawAttributes','fieldName','type','key','keys','query','intersection','attributes','model','fields','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','SalesforceConfiguration','includeAll','include','findAll','catch','show','params','length','options','find','create','body','update','getFields','findOne','SalesforceField','filter','getSubjects','hasOwnProperty','getDescriptions','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js'];(function(_0x46b932,_0x55a512){var _0x3489b0=function(_0x5a1cb3){while(--_0x5a1cb3){_0x46b932['push'](_0x46b932['shift']());}};_0x3489b0(++_0x55a512);}(_0xdb15,0x94));var _0x5db1=function(_0x466f5d,_0x1bd5ba){_0x466f5d=_0x466f5d-0x0;var _0x383b2b=_0xdb15[_0x466f5d];return _0x383b2b;};'use strict';var emlformat=require(_0x5db1('0x0'));var rimraf=require(_0x5db1('0x1'));var zipdir=require(_0x5db1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5db1('0x3'));var moment=require(_0x5db1('0x4'));var BPromise=require(_0x5db1('0x5'));var Mustache=require(_0x5db1('0x6'));var util=require('util');var path=require(_0x5db1('0x7'));var sox=require(_0x5db1('0x8'));var csv=require(_0x5db1('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5db1('0xa'));var _=require(_0x5db1('0xb'));var squel=require(_0x5db1('0xc'));var crypto=require(_0x5db1('0xd'));var jsforce=require(_0x5db1('0xe'));var deskjs=require(_0x5db1('0xf'));var toCsv=require(_0x5db1('0x9'));var querystring=require(_0x5db1('0x10'));var Papa=require(_0x5db1('0x11'));var Redis=require('ioredis');var authService=require(_0x5db1('0x12'));var qs=require(_0x5db1('0x13'));var as=require(_0x5db1('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5db1('0x15'));var utils=require(_0x5db1('0x16'));var config=require(_0x5db1('0x17'));var licenseUtil=require(_0x5db1('0x18'));var db=require(_0x5db1('0x19'))['db'];function respondWithStatusCode(_0x5141a1,_0x1c696f){_0x1c696f=_0x1c696f||0xcc;return function(_0x1ad17d){if(_0x1ad17d){return _0x5141a1['sendStatus'](_0x1c696f);}return _0x5141a1[_0x5db1('0x1a')](_0x1c696f)[_0x5db1('0x1b')]();};}function respondWithResult(_0x52acd3,_0x30867b){_0x30867b=_0x30867b||0xc8;return function(_0x59cf6d){if(_0x59cf6d){return _0x52acd3[_0x5db1('0x1a')](_0x30867b)[_0x5db1('0x1c')](_0x59cf6d);}};}function respondWithFilteredResult(_0x3c7115,_0x30d7a){return function(_0x315f9e){if(_0x315f9e){var _0x1e660e=typeof _0x30d7a['offset']===_0x5db1('0x1d')&&typeof _0x30d7a[_0x5db1('0x1e')]===_0x5db1('0x1d');var _0x382a3a=_0x315f9e[_0x5db1('0x1f')];var _0x5d40e6=_0x1e660e?0x0:_0x30d7a[_0x5db1('0x20')];var _0x5c4f82=_0x1e660e?_0x315f9e[_0x5db1('0x1f')]:_0x30d7a[_0x5db1('0x20')]+_0x30d7a[_0x5db1('0x1e')];var _0x2154db;if(_0x5c4f82>=_0x382a3a){_0x5c4f82=_0x382a3a;_0x2154db=0xc8;}else{_0x2154db=0xce;}_0x3c7115[_0x5db1('0x1a')](_0x2154db);return _0x3c7115[_0x5db1('0x21')](_0x5db1('0x22'),_0x5d40e6+'-'+_0x5c4f82+'/'+_0x382a3a)[_0x5db1('0x1c')](_0x315f9e);}return null;};}function patchUpdates(_0x443afe){return function(_0x4f7ea8){try{jsonpatch['apply'](_0x4f7ea8,_0x443afe,!![]);}catch(_0x257a91){return BPromise[_0x5db1('0x23')](_0x257a91);}return _0x4f7ea8[_0x5db1('0x24')]();};}function saveUpdates(_0x5486b3,_0x2e9590){return function(_0x252393){if(_0x252393){return _0x252393['update'](_0x5486b3)[_0x5db1('0x25')](function(_0x1ea2ff){return _0x1ea2ff;});}return null;};}function removeEntity(_0x1a5728,_0x59e18e){return function(_0x508a69){if(_0x508a69){return _0x508a69[_0x5db1('0x26')]()[_0x5db1('0x25')](function(){_0x1a5728[_0x5db1('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b5f61,_0x3c8aca){return function(_0x5d16ca){if(!_0x5d16ca){_0x5b5f61[_0x5db1('0x27')](0x194);}return _0x5d16ca;};}function handleError(_0x463675,_0x487a6d){_0x487a6d=_0x487a6d||0x1f4;return function(_0x536329){logger[_0x5db1('0x28')](_0x536329['stack']);if(_0x536329[_0x5db1('0x29')]){delete _0x536329[_0x5db1('0x29')];}_0x463675[_0x5db1('0x1a')](_0x487a6d)['send'](_0x536329);};}exports[_0x5db1('0x2a')]=function(_0x58aabb,_0x5cc5dc){var _0x36b7d6={},_0x3d2338={},_0x8eb242={'count':0x0,'rows':[]};var _0x229a63=_[_0x5db1('0x2b')](db['SalesforceConfiguration'][_0x5db1('0x2c')],function(_0x5e395c){return{'name':_0x5e395c[_0x5db1('0x2d')],'type':_0x5e395c[_0x5db1('0x2e')][_0x5db1('0x2f')]};});_0x3d2338['model']=_[_0x5db1('0x2b')](_0x229a63,_0x5db1('0x29'));_0x3d2338['query']=_[_0x5db1('0x30')](_0x58aabb[_0x5db1('0x31')]);_0x3d2338['filters']=_[_0x5db1('0x32')](_0x3d2338['model'],_0x3d2338[_0x5db1('0x31')]);_0x36b7d6[_0x5db1('0x33')]=_[_0x5db1('0x32')](_0x3d2338[_0x5db1('0x34')],qs[_0x5db1('0x35')](_0x58aabb[_0x5db1('0x31')][_0x5db1('0x35')]));_0x36b7d6[_0x5db1('0x33')]=_0x36b7d6[_0x5db1('0x33')]['length']?_0x36b7d6[_0x5db1('0x33')]:_0x3d2338['model'];if(!_0x58aabb['query']['hasOwnProperty'](_0x5db1('0x36'))){_0x36b7d6[_0x5db1('0x1e')]=qs[_0x5db1('0x1e')](_0x58aabb['query']['limit']);_0x36b7d6['offset']=qs[_0x5db1('0x20')](_0x58aabb[_0x5db1('0x31')][_0x5db1('0x20')]);}_0x36b7d6[_0x5db1('0x37')]=qs[_0x5db1('0x38')](_0x58aabb[_0x5db1('0x31')][_0x5db1('0x38')]);_0x36b7d6[_0x5db1('0x39')]=qs[_0x5db1('0x3a')](_[_0x5db1('0x3b')](_0x58aabb['query'],_0x3d2338[_0x5db1('0x3a')]),_0x229a63);if(_0x58aabb[_0x5db1('0x31')]['filter']){_0x36b7d6[_0x5db1('0x39')]=_[_0x5db1('0x3c')](_0x36b7d6[_0x5db1('0x39')],{'$or':_[_0x5db1('0x2b')](_0x229a63,function(_0x3505e5){if(_0x3505e5[_0x5db1('0x2e')]!==_0x5db1('0x3d')){var _0x5373e1={};_0x5373e1[_0x3505e5[_0x5db1('0x29')]]={'$like':'%'+_0x58aabb[_0x5db1('0x31')]['filter']+'%'};return _0x5373e1;}})});}_0x36b7d6=_[_0x5db1('0x3c')]({},_0x36b7d6,_0x58aabb['options']);var _0x5eb389={'where':_0x36b7d6[_0x5db1('0x39')]};return db[_0x5db1('0x3e')][_0x5db1('0x1f')](_0x5eb389)[_0x5db1('0x25')](function(_0x4fe7d7){_0x8eb242[_0x5db1('0x1f')]=_0x4fe7d7;if(_0x58aabb['query'][_0x5db1('0x3f')]){_0x36b7d6[_0x5db1('0x40')]=[{'all':!![]}];}return db['SalesforceConfiguration'][_0x5db1('0x41')](_0x36b7d6);})[_0x5db1('0x25')](function(_0x14769b){_0x8eb242['rows']=_0x14769b;return _0x8eb242;})[_0x5db1('0x25')](respondWithFilteredResult(_0x5cc5dc,_0x36b7d6))[_0x5db1('0x42')](handleError(_0x5cc5dc,null));};exports[_0x5db1('0x43')]=function(_0x4e0848,_0x16f0b6){var _0xf6ea1={'raw':![],'where':{'id':_0x4e0848[_0x5db1('0x44')]['id']}},_0xa347ab={};_0xa347ab[_0x5db1('0x34')]=_[_0x5db1('0x30')](db[_0x5db1('0x3e')][_0x5db1('0x2c')]);_0xa347ab['query']=_['keys'](_0x4e0848['query']);_0xa347ab['filters']=_['intersection'](_0xa347ab[_0x5db1('0x34')],_0xa347ab[_0x5db1('0x31')]);_0xf6ea1[_0x5db1('0x33')]=_[_0x5db1('0x32')](_0xa347ab['model'],qs[_0x5db1('0x35')](_0x4e0848[_0x5db1('0x31')][_0x5db1('0x35')]));_0xf6ea1['attributes']=_0xf6ea1['attributes'][_0x5db1('0x45')]?_0xf6ea1['attributes']:_0xa347ab[_0x5db1('0x34')];if(_0x4e0848[_0x5db1('0x31')]['includeAll']){_0xf6ea1[_0x5db1('0x40')]=[{'all':!![]}];}_0xf6ea1=_[_0x5db1('0x3c')]({},_0xf6ea1,_0x4e0848[_0x5db1('0x46')]);return db['SalesforceConfiguration'][_0x5db1('0x47')](_0xf6ea1)[_0x5db1('0x25')](handleEntityNotFound(_0x16f0b6,null))[_0x5db1('0x25')](respondWithResult(_0x16f0b6,null))[_0x5db1('0x42')](handleError(_0x16f0b6,null));};exports[_0x5db1('0x48')]=function(_0x5853e2,_0x4020f3){return db[_0x5db1('0x3e')][_0x5db1('0x48')](_0x5853e2[_0x5db1('0x49')],{})['then'](respondWithResult(_0x4020f3,0xc9))['catch'](handleError(_0x4020f3,null));};exports[_0x5db1('0x4a')]=function(_0x3c164c,_0xb1a473){if(_0x3c164c['body']['id']){delete _0x3c164c[_0x5db1('0x49')]['id'];}return db[_0x5db1('0x3e')][_0x5db1('0x47')]({'where':{'id':_0x3c164c['params']['id']}})[_0x5db1('0x25')](handleEntityNotFound(_0xb1a473,null))['then'](saveUpdates(_0x3c164c[_0x5db1('0x49')],null))['then'](respondWithResult(_0xb1a473,null))[_0x5db1('0x42')](handleError(_0xb1a473,null));};exports['destroy']=function(_0x4b0654,_0x16da4e){return db['SalesforceConfiguration'][_0x5db1('0x47')]({'where':{'id':_0x4b0654[_0x5db1('0x44')]['id']}})[_0x5db1('0x25')](handleEntityNotFound(_0x16da4e,null))[_0x5db1('0x25')](removeEntity(_0x16da4e,null))[_0x5db1('0x42')](handleError(_0x16da4e,null));};exports[_0x5db1('0x4b')]=function(_0x4cc53f,_0x1bee12,_0x2f6a20){var _0x247835={};var _0x2fdf79={};var _0x2e4e81;var _0x155348;return db[_0x5db1('0x3e')][_0x5db1('0x4c')]({'where':{'id':_0x4cc53f[_0x5db1('0x44')]['id']}})['then'](handleEntityNotFound(_0x1bee12,null))[_0x5db1('0x25')](function(_0x25ace6){if(_0x25ace6){_0x2e4e81=_0x25ace6;_0x2fdf79[_0x5db1('0x34')]=_[_0x5db1('0x30')](db[_0x5db1('0x4d')][_0x5db1('0x2c')]);_0x2fdf79[_0x5db1('0x31')]=_['keys'](_0x4cc53f['query']);_0x2fdf79[_0x5db1('0x3a')]=_[_0x5db1('0x32')](_0x2fdf79['model'],_0x2fdf79[_0x5db1('0x31')]);_0x247835[_0x5db1('0x33')]=_[_0x5db1('0x32')](_0x2fdf79[_0x5db1('0x34')],qs[_0x5db1('0x35')](_0x4cc53f['query'][_0x5db1('0x35')]));_0x247835[_0x5db1('0x33')]=_0x247835[_0x5db1('0x33')][_0x5db1('0x45')]?_0x247835[_0x5db1('0x33')]:_0x2fdf79[_0x5db1('0x34')];_0x247835[_0x5db1('0x37')]=qs[_0x5db1('0x38')](_0x4cc53f[_0x5db1('0x31')][_0x5db1('0x38')]);_0x247835[_0x5db1('0x39')]=qs[_0x5db1('0x3a')](_[_0x5db1('0x3b')](_0x4cc53f[_0x5db1('0x31')],_0x2fdf79[_0x5db1('0x3a')]));if(_0x4cc53f[_0x5db1('0x31')][_0x5db1('0x4e')]){_0x247835['where']=_['merge'](_0x247835[_0x5db1('0x39')],{'$or':_[_0x5db1('0x2b')](_0x247835['attributes'],function(_0x2cfd06){var _0x49afcb={};_0x49afcb[_0x2cfd06]={'$like':'%'+_0x4cc53f[_0x5db1('0x31')][_0x5db1('0x4e')]+'%'};return _0x49afcb;})});}_0x247835=_['merge']({},_0x247835,_0x4cc53f[_0x5db1('0x46')]);return _0x2e4e81['getFields'](_0x247835);}})[_0x5db1('0x25')](function(_0x5e3d3a){if(_0x5e3d3a){_0x155348=_0x5e3d3a['length'];if(!_0x4cc53f['query']['hasOwnProperty'](_0x5db1('0x36'))){_0x247835['limit']=qs[_0x5db1('0x1e')](_0x4cc53f[_0x5db1('0x31')][_0x5db1('0x1e')]);_0x247835[_0x5db1('0x20')]=qs[_0x5db1('0x20')](_0x4cc53f[_0x5db1('0x31')]['offset']);}return _0x2e4e81['getFields'](_0x247835);}})[_0x5db1('0x25')](function(_0x2cf4aa){if(_0x2cf4aa){return _0x2cf4aa?{'count':_0x155348,'rows':_0x2cf4aa}:null;}})[_0x5db1('0x25')](respondWithResult(_0x1bee12,null))['catch'](handleError(_0x1bee12,null));};exports[_0x5db1('0x4f')]=function(_0x190135,_0x32c6df,_0x1f7076){var _0x447e25={};var _0x1650be={};var _0x42ec5a;var _0x41bb68;return db['SalesforceConfiguration'][_0x5db1('0x4c')]({'where':{'id':_0x190135[_0x5db1('0x44')]['id']}})['then'](handleEntityNotFound(_0x32c6df,null))[_0x5db1('0x25')](function(_0x262a4a){if(_0x262a4a){_0x42ec5a=_0x262a4a;_0x1650be[_0x5db1('0x34')]=_[_0x5db1('0x30')](db['SalesforceField'][_0x5db1('0x2c')]);_0x1650be['query']=_[_0x5db1('0x30')](_0x190135['query']);_0x1650be[_0x5db1('0x3a')]=_[_0x5db1('0x32')](_0x1650be['model'],_0x1650be[_0x5db1('0x31')]);_0x447e25['attributes']=_[_0x5db1('0x32')](_0x1650be[_0x5db1('0x34')],qs[_0x5db1('0x35')](_0x190135[_0x5db1('0x31')][_0x5db1('0x35')]));_0x447e25[_0x5db1('0x33')]=_0x447e25[_0x5db1('0x33')][_0x5db1('0x45')]?_0x447e25[_0x5db1('0x33')]:_0x1650be[_0x5db1('0x34')];_0x447e25[_0x5db1('0x37')]=qs[_0x5db1('0x38')](_0x190135[_0x5db1('0x31')][_0x5db1('0x38')]);_0x447e25[_0x5db1('0x39')]=qs[_0x5db1('0x3a')](_['pick'](_0x190135[_0x5db1('0x31')],_0x1650be[_0x5db1('0x3a')]));if(_0x190135['query'][_0x5db1('0x4e')]){_0x447e25[_0x5db1('0x39')]=_[_0x5db1('0x3c')](_0x447e25[_0x5db1('0x39')],{'$or':_[_0x5db1('0x2b')](_0x447e25['attributes'],function(_0x475f0e){var _0x1bbe4={};_0x1bbe4[_0x475f0e]={'$like':'%'+_0x190135[_0x5db1('0x31')]['filter']+'%'};return _0x1bbe4;})});}_0x447e25=_[_0x5db1('0x3c')]({},_0x447e25,_0x190135[_0x5db1('0x46')]);return _0x42ec5a['getSubjects'](_0x447e25);}})[_0x5db1('0x25')](function(_0x18e0b6){if(_0x18e0b6){_0x41bb68=_0x18e0b6[_0x5db1('0x45')];if(!_0x190135[_0x5db1('0x31')][_0x5db1('0x50')]('nolimit')){_0x447e25[_0x5db1('0x1e')]=qs[_0x5db1('0x1e')](_0x190135[_0x5db1('0x31')]['limit']);_0x447e25['offset']=qs['offset'](_0x190135[_0x5db1('0x31')]['offset']);}return _0x42ec5a['getSubjects'](_0x447e25);}})['then'](function(_0x19f32b){if(_0x19f32b){return _0x19f32b?{'count':_0x41bb68,'rows':_0x19f32b}:null;}})[_0x5db1('0x25')](respondWithResult(_0x32c6df,null))['catch'](handleError(_0x32c6df,null));};exports['getDescriptions']=function(_0x21893d,_0x113f7e,_0x3513d9){var _0x3fe5eb={};var _0x23dd1c={};var _0x2b8cf0;var _0x277b41;return db[_0x5db1('0x3e')][_0x5db1('0x4c')]({'where':{'id':_0x21893d[_0x5db1('0x44')]['id']}})[_0x5db1('0x25')](handleEntityNotFound(_0x113f7e,null))[_0x5db1('0x25')](function(_0x507553){if(_0x507553){_0x2b8cf0=_0x507553;_0x23dd1c[_0x5db1('0x34')]=_[_0x5db1('0x30')](db[_0x5db1('0x4d')][_0x5db1('0x2c')]);_0x23dd1c[_0x5db1('0x31')]=_['keys'](_0x21893d['query']);_0x23dd1c['filters']=_[_0x5db1('0x32')](_0x23dd1c['model'],_0x23dd1c[_0x5db1('0x31')]);_0x3fe5eb['attributes']=_[_0x5db1('0x32')](_0x23dd1c[_0x5db1('0x34')],qs['fields'](_0x21893d[_0x5db1('0x31')]['fields']));_0x3fe5eb['attributes']=_0x3fe5eb[_0x5db1('0x33')][_0x5db1('0x45')]?_0x3fe5eb['attributes']:_0x23dd1c[_0x5db1('0x34')];_0x3fe5eb['order']=qs['sort'](_0x21893d[_0x5db1('0x31')][_0x5db1('0x38')]);_0x3fe5eb[_0x5db1('0x39')]=qs[_0x5db1('0x3a')](_['pick'](_0x21893d['query'],_0x23dd1c['filters']));if(_0x21893d[_0x5db1('0x31')][_0x5db1('0x4e')]){_0x3fe5eb[_0x5db1('0x39')]=_[_0x5db1('0x3c')](_0x3fe5eb['where'],{'$or':_['map'](_0x3fe5eb[_0x5db1('0x33')],function(_0x150c9d){var _0x436316={};_0x436316[_0x150c9d]={'$like':'%'+_0x21893d[_0x5db1('0x31')][_0x5db1('0x4e')]+'%'};return _0x436316;})});}_0x3fe5eb=_[_0x5db1('0x3c')]({},_0x3fe5eb,_0x21893d[_0x5db1('0x46')]);return _0x2b8cf0[_0x5db1('0x51')](_0x3fe5eb);}})['then'](function(_0x33ba7f){if(_0x33ba7f){_0x277b41=_0x33ba7f[_0x5db1('0x45')];if(!_0x21893d['query'][_0x5db1('0x50')](_0x5db1('0x36'))){_0x3fe5eb['limit']=qs[_0x5db1('0x1e')](_0x21893d[_0x5db1('0x31')][_0x5db1('0x1e')]);_0x3fe5eb[_0x5db1('0x20')]=qs[_0x5db1('0x20')](_0x21893d[_0x5db1('0x31')][_0x5db1('0x20')]);}return _0x2b8cf0[_0x5db1('0x51')](_0x3fe5eb);}})[_0x5db1('0x25')](function(_0x15297c){if(_0x15297c){return _0x15297c?{'count':_0x277b41,'rows':_0x15297c}:null;}})[_0x5db1('0x25')](respondWithResult(_0x113f7e,null))[_0x5db1('0x42')](handleError(_0x113f7e,null));}; \ No newline at end of file +var _0x1daf=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','sendStatus','error','stack','name','SalesforceConfiguration','rawAttributes','fieldName','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','body','findOne','SalesforceField','getFields','nolimit','getSubjects','getDescriptions','eml-format','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x5a87fb,_0x2c2d6d){var _0x5c1ac5=function(_0x23183c){while(--_0x23183c){_0x5a87fb['push'](_0x5a87fb['shift']());}};_0x5c1ac5(++_0x2c2d6d);}(_0x1daf,0x17c));var _0xf1da=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x1daf[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require(_0xf1da('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf1da('0x1'));var rp=require(_0xf1da('0x2'));var moment=require(_0xf1da('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xf1da('0x4'));var util=require(_0xf1da('0x5'));var path=require(_0xf1da('0x6'));var sox=require(_0xf1da('0x7'));var csv=require('to-csv');var ejs=require(_0xf1da('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xf1da('0x9'));var crypto=require(_0xf1da('0xa'));var jsforce=require(_0xf1da('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf1da('0xc'));var Papa=require(_0xf1da('0xd'));var Redis=require(_0xf1da('0xe'));var authService=require(_0xf1da('0xf'));var qs=require(_0xf1da('0x10'));var as=require(_0xf1da('0x11'));var hardwareService=require(_0xf1da('0x12'));var logger=require(_0xf1da('0x13'))(_0xf1da('0x14'));var utils=require(_0xf1da('0x15'));var config=require(_0xf1da('0x16'));var licenseUtil=require(_0xf1da('0x17'));var db=require(_0xf1da('0x18'))['db'];function respondWithStatusCode(_0x315c67,_0x4de893){_0x4de893=_0x4de893||0xcc;return function(_0x5cdc90){if(_0x5cdc90){return _0x315c67['sendStatus'](_0x4de893);}return _0x315c67[_0xf1da('0x19')](_0x4de893)[_0xf1da('0x1a')]();};}function respondWithResult(_0xe6d535,_0x1a9740){_0x1a9740=_0x1a9740||0xc8;return function(_0x191b05){if(_0x191b05){return _0xe6d535[_0xf1da('0x19')](_0x1a9740)[_0xf1da('0x1b')](_0x191b05);}};}function respondWithFilteredResult(_0x183a1e,_0x84e1cd){return function(_0x4dbb89){if(_0x4dbb89){var _0x159618=typeof _0x84e1cd[_0xf1da('0x1c')]===_0xf1da('0x1d')&&typeof _0x84e1cd[_0xf1da('0x1e')]==='undefined';var _0xa1e805=_0x4dbb89[_0xf1da('0x1f')];var _0xc20ec0=_0x159618?0x0:_0x84e1cd[_0xf1da('0x1c')];var _0x7f11ac=_0x159618?_0x4dbb89[_0xf1da('0x1f')]:_0x84e1cd[_0xf1da('0x1c')]+_0x84e1cd[_0xf1da('0x1e')];var _0x2b2f38;if(_0x7f11ac>=_0xa1e805){_0x7f11ac=_0xa1e805;_0x2b2f38=0xc8;}else{_0x2b2f38=0xce;}_0x183a1e[_0xf1da('0x19')](_0x2b2f38);return _0x183a1e[_0xf1da('0x20')](_0xf1da('0x21'),_0xc20ec0+'-'+_0x7f11ac+'/'+_0xa1e805)[_0xf1da('0x1b')](_0x4dbb89);}return null;};}function patchUpdates(_0x484a39){return function(_0x15c82){try{jsonpatch[_0xf1da('0x22')](_0x15c82,_0x484a39,!![]);}catch(_0x4f560e){return BPromise['reject'](_0x4f560e);}return _0x15c82[_0xf1da('0x23')]();};}function saveUpdates(_0x26d83c,_0x580721){return function(_0x25c928){if(_0x25c928){return _0x25c928[_0xf1da('0x24')](_0x26d83c)[_0xf1da('0x25')](function(_0x14c03e){return _0x14c03e;});}return null;};}function removeEntity(_0x499acc,_0x388541){return function(_0x4cc73b){if(_0x4cc73b){return _0x4cc73b[_0xf1da('0x26')]()['then'](function(){_0x499acc['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x54f6c2,_0x39cb39){return function(_0x444882){if(!_0x444882){_0x54f6c2[_0xf1da('0x27')](0x194);}return _0x444882;};}function handleError(_0x383e38,_0x1649c3){_0x1649c3=_0x1649c3||0x1f4;return function(_0x6bc464){logger[_0xf1da('0x28')](_0x6bc464[_0xf1da('0x29')]);if(_0x6bc464[_0xf1da('0x2a')]){delete _0x6bc464[_0xf1da('0x2a')];}_0x383e38['status'](_0x1649c3)['send'](_0x6bc464);};}exports['index']=function(_0xd9522f,_0x13dc66){var _0x5c71de={},_0x97cd6d={},_0x236df4={'count':0x0,'rows':[]};var _0x24158c=_['map'](db[_0xf1da('0x2b')][_0xf1da('0x2c')],function(_0x2c34e8){return{'name':_0x2c34e8[_0xf1da('0x2d')],'type':_0x2c34e8['type'][_0xf1da('0x2e')]};});_0x97cd6d[_0xf1da('0x2f')]=_[_0xf1da('0x30')](_0x24158c,_0xf1da('0x2a'));_0x97cd6d['query']=_[_0xf1da('0x31')](_0xd9522f[_0xf1da('0x32')]);_0x97cd6d[_0xf1da('0x33')]=_[_0xf1da('0x34')](_0x97cd6d[_0xf1da('0x2f')],_0x97cd6d[_0xf1da('0x32')]);_0x5c71de[_0xf1da('0x35')]=_[_0xf1da('0x34')](_0x97cd6d['model'],qs['fields'](_0xd9522f[_0xf1da('0x32')][_0xf1da('0x36')]));_0x5c71de[_0xf1da('0x35')]=_0x5c71de[_0xf1da('0x35')][_0xf1da('0x37')]?_0x5c71de[_0xf1da('0x35')]:_0x97cd6d[_0xf1da('0x2f')];if(!_0xd9522f['query'][_0xf1da('0x38')]('nolimit')){_0x5c71de[_0xf1da('0x1e')]=qs[_0xf1da('0x1e')](_0xd9522f['query']['limit']);_0x5c71de['offset']=qs[_0xf1da('0x1c')](_0xd9522f[_0xf1da('0x32')][_0xf1da('0x1c')]);}_0x5c71de[_0xf1da('0x39')]=qs[_0xf1da('0x3a')](_0xd9522f[_0xf1da('0x32')]['sort']);_0x5c71de['where']=qs[_0xf1da('0x33')](_[_0xf1da('0x3b')](_0xd9522f[_0xf1da('0x32')],_0x97cd6d[_0xf1da('0x33')]),_0x24158c);if(_0xd9522f[_0xf1da('0x32')][_0xf1da('0x3c')]){_0x5c71de[_0xf1da('0x3d')]=_[_0xf1da('0x3e')](_0x5c71de[_0xf1da('0x3d')],{'$or':_[_0xf1da('0x30')](_0x24158c,function(_0x57c17b){if(_0x57c17b[_0xf1da('0x3f')]!==_0xf1da('0x40')){var _0x342f0f={};_0x342f0f[_0x57c17b[_0xf1da('0x2a')]]={'$like':'%'+_0xd9522f[_0xf1da('0x32')][_0xf1da('0x3c')]+'%'};return _0x342f0f;}})});}_0x5c71de=_['merge']({},_0x5c71de,_0xd9522f[_0xf1da('0x41')]);var _0x4633a9={'where':_0x5c71de['where']};return db[_0xf1da('0x2b')]['count'](_0x4633a9)[_0xf1da('0x25')](function(_0x2b6684){_0x236df4[_0xf1da('0x1f')]=_0x2b6684;if(_0xd9522f['query'][_0xf1da('0x42')]){_0x5c71de[_0xf1da('0x43')]=[{'all':!![]}];}return db[_0xf1da('0x2b')][_0xf1da('0x44')](_0x5c71de);})[_0xf1da('0x25')](function(_0x350ef2){_0x236df4[_0xf1da('0x45')]=_0x350ef2;return _0x236df4;})[_0xf1da('0x25')](respondWithFilteredResult(_0x13dc66,_0x5c71de))[_0xf1da('0x46')](handleError(_0x13dc66,null));};exports['show']=function(_0x45ca81,_0x478892){var _0x2a2dba={'raw':![],'where':{'id':_0x45ca81[_0xf1da('0x47')]['id']}},_0x285c1f={};_0x285c1f[_0xf1da('0x2f')]=_[_0xf1da('0x31')](db['SalesforceConfiguration']['rawAttributes']);_0x285c1f['query']=_[_0xf1da('0x31')](_0x45ca81[_0xf1da('0x32')]);_0x285c1f[_0xf1da('0x33')]=_['intersection'](_0x285c1f[_0xf1da('0x2f')],_0x285c1f[_0xf1da('0x32')]);_0x2a2dba[_0xf1da('0x35')]=_[_0xf1da('0x34')](_0x285c1f[_0xf1da('0x2f')],qs[_0xf1da('0x36')](_0x45ca81[_0xf1da('0x32')][_0xf1da('0x36')]));_0x2a2dba[_0xf1da('0x35')]=_0x2a2dba[_0xf1da('0x35')][_0xf1da('0x37')]?_0x2a2dba[_0xf1da('0x35')]:_0x285c1f['model'];if(_0x45ca81[_0xf1da('0x32')][_0xf1da('0x42')]){_0x2a2dba[_0xf1da('0x43')]=[{'all':!![]}];}_0x2a2dba=_[_0xf1da('0x3e')]({},_0x2a2dba,_0x45ca81['options']);return db['SalesforceConfiguration'][_0xf1da('0x48')](_0x2a2dba)['then'](handleEntityNotFound(_0x478892,null))['then'](respondWithResult(_0x478892,null))[_0xf1da('0x46')](handleError(_0x478892,null));};exports['create']=function(_0x54448c,_0x5ad769){return db[_0xf1da('0x2b')]['create'](_0x54448c[_0xf1da('0x49')],{})['then'](respondWithResult(_0x5ad769,0xc9))['catch'](handleError(_0x5ad769,null));};exports[_0xf1da('0x24')]=function(_0xf69f79,_0x4baa08){if(_0xf69f79['body']['id']){delete _0xf69f79['body']['id'];}return db[_0xf1da('0x2b')][_0xf1da('0x48')]({'where':{'id':_0xf69f79['params']['id']}})[_0xf1da('0x25')](handleEntityNotFound(_0x4baa08,null))[_0xf1da('0x25')](saveUpdates(_0xf69f79[_0xf1da('0x49')],null))[_0xf1da('0x25')](respondWithResult(_0x4baa08,null))[_0xf1da('0x46')](handleError(_0x4baa08,null));};exports[_0xf1da('0x26')]=function(_0x13e8ff,_0x57eb14){return db[_0xf1da('0x2b')][_0xf1da('0x48')]({'where':{'id':_0x13e8ff['params']['id']}})[_0xf1da('0x25')](handleEntityNotFound(_0x57eb14,null))[_0xf1da('0x25')](removeEntity(_0x57eb14,null))[_0xf1da('0x46')](handleError(_0x57eb14,null));};exports['getFields']=function(_0x3f4f83,_0x130096,_0x32bd30){var _0x5b89e8={};var _0x39ff53={};var _0x380a84;var _0x5ee05b;return db[_0xf1da('0x2b')][_0xf1da('0x4a')]({'where':{'id':_0x3f4f83[_0xf1da('0x47')]['id']}})['then'](handleEntityNotFound(_0x130096,null))['then'](function(_0x5e2fa3){if(_0x5e2fa3){_0x380a84=_0x5e2fa3;_0x39ff53[_0xf1da('0x2f')]=_[_0xf1da('0x31')](db[_0xf1da('0x4b')][_0xf1da('0x2c')]);_0x39ff53[_0xf1da('0x32')]=_[_0xf1da('0x31')](_0x3f4f83[_0xf1da('0x32')]);_0x39ff53[_0xf1da('0x33')]=_[_0xf1da('0x34')](_0x39ff53[_0xf1da('0x2f')],_0x39ff53[_0xf1da('0x32')]);_0x5b89e8[_0xf1da('0x35')]=_[_0xf1da('0x34')](_0x39ff53[_0xf1da('0x2f')],qs[_0xf1da('0x36')](_0x3f4f83[_0xf1da('0x32')][_0xf1da('0x36')]));_0x5b89e8[_0xf1da('0x35')]=_0x5b89e8[_0xf1da('0x35')]['length']?_0x5b89e8['attributes']:_0x39ff53[_0xf1da('0x2f')];_0x5b89e8[_0xf1da('0x39')]=qs['sort'](_0x3f4f83[_0xf1da('0x32')][_0xf1da('0x3a')]);_0x5b89e8['where']=qs[_0xf1da('0x33')](_['pick'](_0x3f4f83['query'],_0x39ff53[_0xf1da('0x33')]));if(_0x3f4f83[_0xf1da('0x32')][_0xf1da('0x3c')]){_0x5b89e8[_0xf1da('0x3d')]=_[_0xf1da('0x3e')](_0x5b89e8['where'],{'$or':_[_0xf1da('0x30')](_0x5b89e8[_0xf1da('0x35')],function(_0x1dbcb5){var _0x21e04e={};_0x21e04e[_0x1dbcb5]={'$like':'%'+_0x3f4f83[_0xf1da('0x32')][_0xf1da('0x3c')]+'%'};return _0x21e04e;})});}_0x5b89e8=_['merge']({},_0x5b89e8,_0x3f4f83[_0xf1da('0x41')]);return _0x380a84[_0xf1da('0x4c')](_0x5b89e8);}})['then'](function(_0x19bd79){if(_0x19bd79){_0x5ee05b=_0x19bd79[_0xf1da('0x37')];if(!_0x3f4f83['query'][_0xf1da('0x38')](_0xf1da('0x4d'))){_0x5b89e8[_0xf1da('0x1e')]=qs['limit'](_0x3f4f83[_0xf1da('0x32')]['limit']);_0x5b89e8[_0xf1da('0x1c')]=qs[_0xf1da('0x1c')](_0x3f4f83[_0xf1da('0x32')][_0xf1da('0x1c')]);}return _0x380a84['getFields'](_0x5b89e8);}})[_0xf1da('0x25')](function(_0x181619){if(_0x181619){return _0x181619?{'count':_0x5ee05b,'rows':_0x181619}:null;}})[_0xf1da('0x25')](respondWithResult(_0x130096,null))['catch'](handleError(_0x130096,null));};exports[_0xf1da('0x4e')]=function(_0x18100c,_0x43fe59,_0x1f192f){var _0x2d98bd={};var _0x435517={};var _0x4a37e1;var _0xdaa8e8;return db[_0xf1da('0x2b')]['findOne']({'where':{'id':_0x18100c['params']['id']}})[_0xf1da('0x25')](handleEntityNotFound(_0x43fe59,null))['then'](function(_0x2388ed){if(_0x2388ed){_0x4a37e1=_0x2388ed;_0x435517['model']=_[_0xf1da('0x31')](db['SalesforceField'][_0xf1da('0x2c')]);_0x435517[_0xf1da('0x32')]=_['keys'](_0x18100c[_0xf1da('0x32')]);_0x435517['filters']=_['intersection'](_0x435517[_0xf1da('0x2f')],_0x435517[_0xf1da('0x32')]);_0x2d98bd[_0xf1da('0x35')]=_[_0xf1da('0x34')](_0x435517[_0xf1da('0x2f')],qs[_0xf1da('0x36')](_0x18100c[_0xf1da('0x32')][_0xf1da('0x36')]));_0x2d98bd[_0xf1da('0x35')]=_0x2d98bd['attributes'][_0xf1da('0x37')]?_0x2d98bd[_0xf1da('0x35')]:_0x435517['model'];_0x2d98bd['order']=qs['sort'](_0x18100c[_0xf1da('0x32')]['sort']);_0x2d98bd[_0xf1da('0x3d')]=qs['filters'](_[_0xf1da('0x3b')](_0x18100c[_0xf1da('0x32')],_0x435517[_0xf1da('0x33')]));if(_0x18100c[_0xf1da('0x32')][_0xf1da('0x3c')]){_0x2d98bd['where']=_[_0xf1da('0x3e')](_0x2d98bd['where'],{'$or':_['map'](_0x2d98bd['attributes'],function(_0x5c1dfc){var _0x3acca7={};_0x3acca7[_0x5c1dfc]={'$like':'%'+_0x18100c['query'][_0xf1da('0x3c')]+'%'};return _0x3acca7;})});}_0x2d98bd=_[_0xf1da('0x3e')]({},_0x2d98bd,_0x18100c[_0xf1da('0x41')]);return _0x4a37e1[_0xf1da('0x4e')](_0x2d98bd);}})[_0xf1da('0x25')](function(_0x1020c0){if(_0x1020c0){_0xdaa8e8=_0x1020c0[_0xf1da('0x37')];if(!_0x18100c['query'][_0xf1da('0x38')](_0xf1da('0x4d'))){_0x2d98bd['limit']=qs[_0xf1da('0x1e')](_0x18100c[_0xf1da('0x32')][_0xf1da('0x1e')]);_0x2d98bd['offset']=qs[_0xf1da('0x1c')](_0x18100c[_0xf1da('0x32')][_0xf1da('0x1c')]);}return _0x4a37e1['getSubjects'](_0x2d98bd);}})[_0xf1da('0x25')](function(_0xa642d9){if(_0xa642d9){return _0xa642d9?{'count':_0xdaa8e8,'rows':_0xa642d9}:null;}})[_0xf1da('0x25')](respondWithResult(_0x43fe59,null))['catch'](handleError(_0x43fe59,null));};exports['getDescriptions']=function(_0x2ce4ec,_0x681618,_0x492cec){var _0x49c3c0={};var _0x4ad78a={};var _0x47a5db;var _0x29befd;return db[_0xf1da('0x2b')]['findOne']({'where':{'id':_0x2ce4ec[_0xf1da('0x47')]['id']}})[_0xf1da('0x25')](handleEntityNotFound(_0x681618,null))['then'](function(_0x38bf6a){if(_0x38bf6a){_0x47a5db=_0x38bf6a;_0x4ad78a[_0xf1da('0x2f')]=_[_0xf1da('0x31')](db['SalesforceField'][_0xf1da('0x2c')]);_0x4ad78a[_0xf1da('0x32')]=_[_0xf1da('0x31')](_0x2ce4ec[_0xf1da('0x32')]);_0x4ad78a['filters']=_[_0xf1da('0x34')](_0x4ad78a[_0xf1da('0x2f')],_0x4ad78a['query']);_0x49c3c0['attributes']=_[_0xf1da('0x34')](_0x4ad78a['model'],qs[_0xf1da('0x36')](_0x2ce4ec[_0xf1da('0x32')][_0xf1da('0x36')]));_0x49c3c0[_0xf1da('0x35')]=_0x49c3c0['attributes'][_0xf1da('0x37')]?_0x49c3c0[_0xf1da('0x35')]:_0x4ad78a[_0xf1da('0x2f')];_0x49c3c0[_0xf1da('0x39')]=qs[_0xf1da('0x3a')](_0x2ce4ec[_0xf1da('0x32')][_0xf1da('0x3a')]);_0x49c3c0[_0xf1da('0x3d')]=qs[_0xf1da('0x33')](_[_0xf1da('0x3b')](_0x2ce4ec['query'],_0x4ad78a[_0xf1da('0x33')]));if(_0x2ce4ec[_0xf1da('0x32')][_0xf1da('0x3c')]){_0x49c3c0[_0xf1da('0x3d')]=_[_0xf1da('0x3e')](_0x49c3c0[_0xf1da('0x3d')],{'$or':_[_0xf1da('0x30')](_0x49c3c0['attributes'],function(_0x2f45a2){var _0x53c0d8={};_0x53c0d8[_0x2f45a2]={'$like':'%'+_0x2ce4ec[_0xf1da('0x32')][_0xf1da('0x3c')]+'%'};return _0x53c0d8;})});}_0x49c3c0=_['merge']({},_0x49c3c0,_0x2ce4ec[_0xf1da('0x41')]);return _0x47a5db['getDescriptions'](_0x49c3c0);}})[_0xf1da('0x25')](function(_0x5f3585){if(_0x5f3585){_0x29befd=_0x5f3585[_0xf1da('0x37')];if(!_0x2ce4ec[_0xf1da('0x32')][_0xf1da('0x38')](_0xf1da('0x4d'))){_0x49c3c0['limit']=qs[_0xf1da('0x1e')](_0x2ce4ec['query'][_0xf1da('0x1e')]);_0x49c3c0[_0xf1da('0x1c')]=qs[_0xf1da('0x1c')](_0x2ce4ec[_0xf1da('0x32')][_0xf1da('0x1c')]);}return _0x47a5db[_0xf1da('0x4f')](_0x49c3c0);}})['then'](function(_0x17e558){if(_0x17e558){return _0x17e558?{'count':_0x29befd,'rows':_0x17e558}:null;}})['then'](respondWithResult(_0x681618,null))['catch'](handleError(_0x681618,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 99bd717..0325fc9 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 _0xa767=['api','moment','request-promise','path','rimraf','../../config/environment','exports','define','SalesforceConfiguration','int_salesforce_configurations','util','../../config/logger'];(function(_0x381ffb,_0x396e53){var _0x1ca01f=function(_0x43a41e){while(--_0x43a41e){_0x381ffb['push'](_0x381ffb['shift']());}};_0x1ca01f(++_0x396e53);}(_0xa767,0x12a));var _0x7a76=function(_0x3fb289,_0x1029ae){_0x3fb289=_0x3fb289-0x0;var _0x2dd044=_0xa767[_0x3fb289];return _0x2dd044;};'use strict';var _=require('lodash');var util=require(_0x7a76('0x0'));var logger=require(_0x7a76('0x1'))(_0x7a76('0x2'));var moment=require(_0x7a76('0x3'));var BPromise=require('bluebird');var rp=require(_0x7a76('0x4'));var fs=require('fs');var path=require(_0x7a76('0x5'));var rimraf=require(_0x7a76('0x6'));var config=require(_0x7a76('0x7'));var attributes=require('./intSalesforceConfiguration.attributes');module[_0x7a76('0x8')]=function(_0x2c9de4,_0x439cb6){return _0x2c9de4[_0x7a76('0x9')](_0x7a76('0xa'),attributes,{'tableName':_0x7a76('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe9ef=['request-promise','path','rimraf','../../config/environment','exports','define','SalesforceConfiguration','int_salesforce_configurations','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x18959a,_0x39f48d){var _0x3a4a2f=function(_0x364a9b){while(--_0x364a9b){_0x18959a['push'](_0x18959a['shift']());}};_0x3a4a2f(++_0x39f48d);}(_0xe9ef,0x166));var _0xfe9e=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xe9ef[_0x413feb];return _0x40ee88;};'use strict';var _=require(_0xfe9e('0x0'));var util=require(_0xfe9e('0x1'));var logger=require(_0xfe9e('0x2'))(_0xfe9e('0x3'));var moment=require(_0xfe9e('0x4'));var BPromise=require(_0xfe9e('0x5'));var rp=require(_0xfe9e('0x6'));var fs=require('fs');var path=require(_0xfe9e('0x7'));var rimraf=require(_0xfe9e('0x8'));var config=require(_0xfe9e('0x9'));var attributes=require('./intSalesforceConfiguration.attributes');module[_0xfe9e('0xa')]=function(_0x545d06,_0x298bee){return _0x545d06[_0xfe9e('0xb')](_0xfe9e('0xc'),attributes,{'tableName':_0xfe9e('0xd'),'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 bf77f9e..abdd296 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 _0x3737=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x16f590,_0xf51f45){var _0x32f4ea=function(_0x486e3e){while(--_0x486e3e){_0x16f590['push'](_0x16f590['shift']());}};_0x32f4ea(++_0xf51f45);}(_0x3737,0x162));var _0x7373=function(_0x29f716,_0x4c551e){_0x29f716=_0x29f716-0x0;var _0x1ae1e1=_0x3737[_0x29f716];return _0x1ae1e1;};'use strict';var _=require('lodash');var util=require(_0x7373('0x0'));var moment=require(_0x7373('0x1'));var BPromise=require(_0x7373('0x2'));var rs=require(_0x7373('0x3'));var fs=require('fs');var Redis=require(_0x7373('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7373('0x5'));var logger=require(_0x7373('0x6'))(_0x7373('0x7'));var config=require(_0x7373('0x8'));var jayson=require(_0x7373('0x9'));var client=jayson[_0x7373('0xa')][_0x7373('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3eb138,_0x1bd10b,_0x252a9c){return new BPromise(function(_0x4c5055,_0x279126){return client[_0x7373('0xc')](_0x3eb138,_0x252a9c)[_0x7373('0xd')](function(_0x1d6d49){logger['info'](_0x7373('0xe'),_0x1bd10b,_0x7373('0xf'));logger[_0x7373('0x10')](_0x7373('0x11'),_0x1bd10b,_0x7373('0xf'),JSON[_0x7373('0x12')](_0x1d6d49));if(_0x1d6d49[_0x7373('0x13')]){if(_0x1d6d49[_0x7373('0x13')][_0x7373('0x14')]===0x1f4){logger[_0x7373('0x13')](_0x7373('0xe'),_0x1bd10b,_0x1d6d49[_0x7373('0x13')]['message']);return _0x279126(_0x1d6d49['error'][_0x7373('0x15')]);}logger[_0x7373('0x13')](_0x7373('0xe'),_0x1bd10b,_0x1d6d49[_0x7373('0x13')][_0x7373('0x15')]);return _0x4c5055(_0x1d6d49[_0x7373('0x13')][_0x7373('0x15')]);}else{logger[_0x7373('0x16')](_0x7373('0xe'),_0x1bd10b,_0x7373('0xf'));_0x4c5055(_0x1d6d49['result']['message']);}})[_0x7373('0x17')](function(_0x306f1a){logger[_0x7373('0x13')](_0x7373('0xe'),_0x1bd10b,_0x306f1a);_0x279126(_0x306f1a);});});} \ No newline at end of file +var _0xd595=['rpc','../../config/environment','jayson/promise','client','http','request','then','SalesforceConfiguration,\x20%s,\x20%s','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x401314,_0x25ba22){var _0x2ae4b7=function(_0x329538){while(--_0x329538){_0x401314['push'](_0x401314['shift']());}};_0x2ae4b7(++_0x25ba22);}(_0xd595,0xc8));var _0x5d59=function(_0xf6a160,_0xcb53d2){_0xf6a160=_0xf6a160-0x0;var _0x5ab234=_0xd595[_0xf6a160];return _0x5ab234;};'use strict';var _=require(_0x5d59('0x0'));var util=require('util');var moment=require(_0x5d59('0x1'));var BPromise=require(_0x5d59('0x2'));var rs=require(_0x5d59('0x3'));var fs=require('fs');var Redis=require(_0x5d59('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5d59('0x5'));var logger=require(_0x5d59('0x6'))(_0x5d59('0x7'));var config=require(_0x5d59('0x8'));var jayson=require(_0x5d59('0x9'));var client=jayson[_0x5d59('0xa')][_0x5d59('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x7f8ae2,_0x1883b4,_0x18d25b){return new BPromise(function(_0x19fa14,_0x4bedbf){return client[_0x5d59('0xc')](_0x7f8ae2,_0x18d25b)[_0x5d59('0xd')](function(_0x5d75b8){logger['info'](_0x5d59('0xe'),_0x1883b4,'request\x20sent');logger[_0x5d59('0xf')](_0x5d59('0x10'),_0x1883b4,_0x5d59('0x11'),JSON['stringify'](_0x5d75b8));if(_0x5d75b8[_0x5d59('0x12')]){if(_0x5d75b8[_0x5d59('0x12')]['code']===0x1f4){logger[_0x5d59('0x12')]('SalesforceConfiguration,\x20%s,\x20%s',_0x1883b4,_0x5d75b8['error'][_0x5d59('0x13')]);return _0x4bedbf(_0x5d75b8[_0x5d59('0x12')][_0x5d59('0x13')]);}logger[_0x5d59('0x12')]('SalesforceConfiguration,\x20%s,\x20%s',_0x1883b4,_0x5d75b8[_0x5d59('0x12')][_0x5d59('0x13')]);return _0x19fa14(_0x5d75b8[_0x5d59('0x12')][_0x5d59('0x13')]);}else{logger[_0x5d59('0x14')]('SalesforceConfiguration,\x20%s,\x20%s',_0x1883b4,'request\x20sent');_0x19fa14(_0x5d75b8[_0x5d59('0x15')][_0x5d59('0x13')]);}})[_0x5d59('0x16')](function(_0x40928c){logger[_0x5d59('0x12')](_0x5d59('0xe'),_0x1883b4,_0x40928c);_0x4bedbf(_0x40928c);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 9583340..68d675d 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 _0x8425=['create','update','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0x4c6a55,_0x773327){var _0xdfd921=function(_0x5d3e51){while(--_0x5d3e51){_0x4c6a55['push'](_0x4c6a55['shift']());}};_0xdfd921(++_0x773327);}(_0x8425,0x147));var _0x5842=function(_0x175485,_0x47ca08){_0x175485=_0x175485-0x0;var _0x5c205f=_0x8425[_0x175485];return _0x5c205f;};'use strict';var multer=require(_0x5842('0x0'));var util=require(_0x5842('0x1'));var path=require('path');var timeout=require(_0x5842('0x2'));var express=require(_0x5842('0x3'));var router=express[_0x5842('0x4')]();var fs_extra=require(_0x5842('0x5'));var auth=require(_0x5842('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5842('0x7'));var controller=require(_0x5842('0x8'));router[_0x5842('0x9')]('/',auth[_0x5842('0xa')](),controller[_0x5842('0xb')]);router[_0x5842('0x9')](_0x5842('0xc'),auth[_0x5842('0xa')](),controller[_0x5842('0xd')]);router[_0x5842('0xe')]('/',auth[_0x5842('0xa')](),controller[_0x5842('0xf')]);router['put'](_0x5842('0xc'),auth[_0x5842('0xa')](),controller[_0x5842('0x10')]);router['delete'](_0x5842('0xc'),auth[_0x5842('0xa')](),controller['destroy']);module[_0x5842('0x11')]=router; \ No newline at end of file +var _0x4165=['put','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./intSalesforceField.controller','get','isAuthenticated','/:id','show','post','create'];(function(_0x3379e1,_0x257870){var _0x48116a=function(_0xfb88ce){while(--_0xfb88ce){_0x3379e1['push'](_0x3379e1['shift']());}};_0x48116a(++_0x257870);}(_0x4165,0xcf));var _0x5416=function(_0x215580,_0x73e9cb){_0x215580=_0x215580-0x0;var _0x5829f9=_0x4165[_0x215580];return _0x5829f9;};'use strict';var multer=require(_0x5416('0x0'));var util=require('util');var path=require(_0x5416('0x1'));var timeout=require(_0x5416('0x2'));var express=require(_0x5416('0x3'));var router=express[_0x5416('0x4')]();var fs_extra=require(_0x5416('0x5'));var auth=require(_0x5416('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5416('0x7'));router[_0x5416('0x8')]('/',auth[_0x5416('0x9')](),controller['index']);router[_0x5416('0x8')](_0x5416('0xa'),auth[_0x5416('0x9')](),controller[_0x5416('0xb')]);router[_0x5416('0xc')]('/',auth[_0x5416('0x9')](),controller[_0x5416('0xd')]);router[_0x5416('0xe')](_0x5416('0xa'),auth[_0x5416('0x9')](),controller['update']);router[_0x5416('0xf')](_0x5416('0xa'),auth[_0x5416('0x9')](),controller['destroy']);module[_0x5416('0x10')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 473b281..eff4dc6 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 _0x9848=['STRING','exports','ENUM','string','variable','customVariable','keyValue','picklist'];(function(_0x178824,_0x47690d){var _0x35e45c=function(_0x4f67b2){while(--_0x4f67b2){_0x178824['push'](_0x178824['shift']());}};_0x35e45c(++_0x47690d);}(_0x9848,0x139));var _0x8984=function(_0x3e462f,_0x3c35ac){_0x3e462f=_0x3e462f-0x0;var _0x1213bf=_0x9848[_0x3e462f];return _0x1213bf;};'use strict';var Sequelize=require('sequelize');module[_0x8984('0x0')]={'type':{'type':Sequelize[_0x8984('0x1')](_0x8984('0x2'),_0x8984('0x3'),_0x8984('0x4'),_0x8984('0x5'),_0x8984('0x6')),'defaultValue':_0x8984('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x8984('0x7')]},'keyType':{'type':Sequelize[_0x8984('0x1')]('string',_0x8984('0x3'),_0x8984('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x8984('0x7')]},'variableName':{'type':Sequelize[_0x8984('0x7')]}}; \ No newline at end of file +var _0xf339=['exports','ENUM','variable','customVariable','keyValue','string','STRING','sequelize'];(function(_0x3875b1,_0x47cf1a){var _0x1e9c55=function(_0xc8e89b){while(--_0xc8e89b){_0x3875b1['push'](_0x3875b1['shift']());}};_0x1e9c55(++_0x47cf1a);}(_0xf339,0x87));var _0x9f33=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0xf339[_0x2be8c2];return _0x97f531;};'use strict';var Sequelize=require(_0x9f33('0x0'));module[_0x9f33('0x1')]={'type':{'type':Sequelize[_0x9f33('0x2')]('string',_0x9f33('0x3'),_0x9f33('0x4'),_0x9f33('0x5'),'picklist'),'defaultValue':_0x9f33('0x6')},'content':{'type':Sequelize[_0x9f33('0x7')]},'key':{'type':Sequelize[_0x9f33('0x7')]},'keyType':{'type':Sequelize[_0x9f33('0x2')](_0x9f33('0x6'),_0x9f33('0x3'),_0x9f33('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x9f33('0x7')]},'variableName':{'type':Sequelize[_0x9f33('0x7')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index ac5e029..63422e5 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 _0xf229=['error','stack','name','send','index','SalesforceField','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','options','includeAll','include','catch','show','params','find','create','body','destroy','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','update','then'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xf229,0xb1));var _0x9f22=function(_0x4f712b,_0x5688ed){_0x4f712b=_0x4f712b-0x0;var _0x35370a=_0xf229[_0x4f712b];return _0x35370a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x9f22('0x0'));var rp=require(_0x9f22('0x1'));var moment=require('moment');var BPromise=require(_0x9f22('0x2'));var Mustache=require(_0x9f22('0x3'));var util=require(_0x9f22('0x4'));var path=require(_0x9f22('0x5'));var sox=require('sox');var csv=require(_0x9f22('0x6'));var ejs=require(_0x9f22('0x7'));var fs=require('fs');var fs_extra=require(_0x9f22('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x9f22('0x9'));var jsforce=require(_0x9f22('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x9f22('0x6'));var querystring=require(_0x9f22('0xb'));var Papa=require(_0x9f22('0xc'));var Redis=require(_0x9f22('0xd'));var authService=require(_0x9f22('0xe'));var qs=require(_0x9f22('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9f22('0x10'));var logger=require(_0x9f22('0x11'))(_0x9f22('0x12'));var utils=require(_0x9f22('0x13'));var config=require(_0x9f22('0x14'));var licenseUtil=require(_0x9f22('0x15'));var db=require(_0x9f22('0x16'))['db'];function respondWithStatusCode(_0x4ed461,_0x387cf6){_0x387cf6=_0x387cf6||0xcc;return function(_0x55f769){if(_0x55f769){return _0x4ed461[_0x9f22('0x17')](_0x387cf6);}return _0x4ed461[_0x9f22('0x18')](_0x387cf6)[_0x9f22('0x19')]();};}function respondWithResult(_0x416a86,_0x5ddd9b){_0x5ddd9b=_0x5ddd9b||0xc8;return function(_0x1d3a9c){if(_0x1d3a9c){return _0x416a86[_0x9f22('0x18')](_0x5ddd9b)[_0x9f22('0x1a')](_0x1d3a9c);}};}function respondWithFilteredResult(_0x28f650,_0x1ae8fa){return function(_0x2c9d4f){if(_0x2c9d4f){var _0x4110eb=typeof _0x1ae8fa[_0x9f22('0x1b')]===_0x9f22('0x1c')&&typeof _0x1ae8fa[_0x9f22('0x1d')]===_0x9f22('0x1c');var _0x4a84db=_0x2c9d4f[_0x9f22('0x1e')];var _0x204628=_0x4110eb?0x0:_0x1ae8fa[_0x9f22('0x1b')];var _0x4044bc=_0x4110eb?_0x2c9d4f[_0x9f22('0x1e')]:_0x1ae8fa[_0x9f22('0x1b')]+_0x1ae8fa[_0x9f22('0x1d')];var _0x362b3f;if(_0x4044bc>=_0x4a84db){_0x4044bc=_0x4a84db;_0x362b3f=0xc8;}else{_0x362b3f=0xce;}_0x28f650[_0x9f22('0x18')](_0x362b3f);return _0x28f650[_0x9f22('0x1f')]('Content-Range',_0x204628+'-'+_0x4044bc+'/'+_0x4a84db)[_0x9f22('0x1a')](_0x2c9d4f);}return null;};}function patchUpdates(_0x2f4377){return function(_0x3c592b){try{jsonpatch['apply'](_0x3c592b,_0x2f4377,!![]);}catch(_0x2cbf6d){return BPromise[_0x9f22('0x20')](_0x2cbf6d);}return _0x3c592b[_0x9f22('0x21')]();};}function saveUpdates(_0x487374,_0x2e8035){return function(_0x48633c){if(_0x48633c){return _0x48633c[_0x9f22('0x22')](_0x487374)[_0x9f22('0x23')](function(_0x2f527b){return _0x2f527b;});}return null;};}function removeEntity(_0x431153,_0x22293a){return function(_0x344c82){if(_0x344c82){return _0x344c82['destroy']()[_0x9f22('0x23')](function(){_0x431153[_0x9f22('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x237288,_0x2ed18b){return function(_0x7f706d){if(!_0x7f706d){_0x237288[_0x9f22('0x17')](0x194);}return _0x7f706d;};}function handleError(_0x2f7603,_0x319518){_0x319518=_0x319518||0x1f4;return function(_0x30f78a){logger[_0x9f22('0x24')](_0x30f78a[_0x9f22('0x25')]);if(_0x30f78a[_0x9f22('0x26')]){delete _0x30f78a[_0x9f22('0x26')];}_0x2f7603[_0x9f22('0x18')](_0x319518)[_0x9f22('0x27')](_0x30f78a);};}exports[_0x9f22('0x28')]=function(_0x25c66b,_0xf2cf36){var _0x4409a4={},_0x1beab8={},_0x29371b={'count':0x0,'rows':[]};var _0x480904=_['map'](db[_0x9f22('0x29')][_0x9f22('0x2a')],function(_0x2d7b86){return{'name':_0x2d7b86[_0x9f22('0x2b')],'type':_0x2d7b86[_0x9f22('0x2c')][_0x9f22('0x2d')]};});_0x1beab8['model']=_[_0x9f22('0x2e')](_0x480904,'name');_0x1beab8[_0x9f22('0x2f')]=_[_0x9f22('0x30')](_0x25c66b['query']);_0x1beab8[_0x9f22('0x31')]=_[_0x9f22('0x32')](_0x1beab8[_0x9f22('0x33')],_0x1beab8['query']);_0x4409a4[_0x9f22('0x34')]=_[_0x9f22('0x32')](_0x1beab8['model'],qs[_0x9f22('0x35')](_0x25c66b[_0x9f22('0x2f')][_0x9f22('0x35')]));_0x4409a4['attributes']=_0x4409a4[_0x9f22('0x34')][_0x9f22('0x36')]?_0x4409a4[_0x9f22('0x34')]:_0x1beab8['model'];if(!_0x25c66b['query'][_0x9f22('0x37')]('nolimit')){_0x4409a4[_0x9f22('0x1d')]=qs['limit'](_0x25c66b[_0x9f22('0x2f')][_0x9f22('0x1d')]);_0x4409a4[_0x9f22('0x1b')]=qs[_0x9f22('0x1b')](_0x25c66b[_0x9f22('0x2f')][_0x9f22('0x1b')]);}_0x4409a4[_0x9f22('0x38')]=qs[_0x9f22('0x39')](_0x25c66b[_0x9f22('0x2f')][_0x9f22('0x39')]);_0x4409a4[_0x9f22('0x3a')]=qs[_0x9f22('0x31')](_['pick'](_0x25c66b[_0x9f22('0x2f')],_0x1beab8[_0x9f22('0x31')]),_0x480904);if(_0x25c66b[_0x9f22('0x2f')][_0x9f22('0x3b')]){_0x4409a4[_0x9f22('0x3a')]=_[_0x9f22('0x3c')](_0x4409a4['where'],{'$or':_[_0x9f22('0x2e')](_0x480904,function(_0xa8478f){if(_0xa8478f[_0x9f22('0x2c')]!=='VIRTUAL'){var _0x43efd7={};_0x43efd7[_0xa8478f[_0x9f22('0x26')]]={'$like':'%'+_0x25c66b[_0x9f22('0x2f')][_0x9f22('0x3b')]+'%'};return _0x43efd7;}})});}_0x4409a4=_[_0x9f22('0x3c')]({},_0x4409a4,_0x25c66b[_0x9f22('0x3d')]);var _0x3c6f7c={'where':_0x4409a4[_0x9f22('0x3a')]};return db[_0x9f22('0x29')][_0x9f22('0x1e')](_0x3c6f7c)[_0x9f22('0x23')](function(_0x55c759){_0x29371b[_0x9f22('0x1e')]=_0x55c759;if(_0x25c66b['query'][_0x9f22('0x3e')]){_0x4409a4[_0x9f22('0x3f')]=[{'all':!![]}];}return db['SalesforceField']['findAll'](_0x4409a4);})['then'](function(_0x4a1b61){_0x29371b['rows']=_0x4a1b61;return _0x29371b;})[_0x9f22('0x23')](respondWithFilteredResult(_0xf2cf36,_0x4409a4))[_0x9f22('0x40')](handleError(_0xf2cf36,null));};exports[_0x9f22('0x41')]=function(_0x90ea82,_0x5a2a6e){var _0x89892f={'raw':!![],'where':{'id':_0x90ea82[_0x9f22('0x42')]['id']}},_0x2edbfa={};_0x2edbfa['model']=_[_0x9f22('0x30')](db[_0x9f22('0x29')][_0x9f22('0x2a')]);_0x2edbfa['query']=_[_0x9f22('0x30')](_0x90ea82[_0x9f22('0x2f')]);_0x2edbfa[_0x9f22('0x31')]=_[_0x9f22('0x32')](_0x2edbfa[_0x9f22('0x33')],_0x2edbfa[_0x9f22('0x2f')]);_0x89892f[_0x9f22('0x34')]=_['intersection'](_0x2edbfa['model'],qs[_0x9f22('0x35')](_0x90ea82[_0x9f22('0x2f')]['fields']));_0x89892f[_0x9f22('0x34')]=_0x89892f[_0x9f22('0x34')][_0x9f22('0x36')]?_0x89892f[_0x9f22('0x34')]:_0x2edbfa[_0x9f22('0x33')];if(_0x90ea82[_0x9f22('0x2f')][_0x9f22('0x3e')]){_0x89892f[_0x9f22('0x3f')]=[{'all':!![]}];}_0x89892f=_[_0x9f22('0x3c')]({},_0x89892f,_0x90ea82[_0x9f22('0x3d')]);return db[_0x9f22('0x29')][_0x9f22('0x43')](_0x89892f)[_0x9f22('0x23')](handleEntityNotFound(_0x5a2a6e,null))['then'](respondWithResult(_0x5a2a6e,null))[_0x9f22('0x40')](handleError(_0x5a2a6e,null));};exports[_0x9f22('0x44')]=function(_0x5e9ad1,_0x1b61fb){return db[_0x9f22('0x29')]['create'](_0x5e9ad1[_0x9f22('0x45')],{})['then'](respondWithResult(_0x1b61fb,0xc9))[_0x9f22('0x40')](handleError(_0x1b61fb,null));};exports[_0x9f22('0x22')]=function(_0x1bfa7d,_0x487c51){if(_0x1bfa7d[_0x9f22('0x45')]['id']){delete _0x1bfa7d[_0x9f22('0x45')]['id'];}return db[_0x9f22('0x29')][_0x9f22('0x43')]({'where':{'id':_0x1bfa7d[_0x9f22('0x42')]['id']}})['then'](handleEntityNotFound(_0x487c51,null))[_0x9f22('0x23')](saveUpdates(_0x1bfa7d[_0x9f22('0x45')],null))[_0x9f22('0x23')](respondWithResult(_0x487c51,null))[_0x9f22('0x40')](handleError(_0x487c51,null));};exports[_0x9f22('0x46')]=function(_0x390d22,_0x45acc6){return db[_0x9f22('0x29')][_0x9f22('0x43')]({'where':{'id':_0x390d22['params']['id']}})[_0x9f22('0x23')](handleEntityNotFound(_0x45acc6,null))[_0x9f22('0x23')](removeEntity(_0x45acc6,null))[_0x9f22('0x40')](handleError(_0x45acc6,null));}; \ No newline at end of file +var _0xa846=['intersection','model','attributes','fields','length','order','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','keys','find','create','body','eml-format','rimraf','fast-json-patch','bluebird','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','json','undefined','count','offset','limit','status','Content-Range','reject','save','update','destroy','then','error','stack','name','send','index','map','SalesforceField','rawAttributes','type','query','filters'];(function(_0x50aa2e,_0xfbd6f0){var _0x5e07f0=function(_0x3ed540){while(--_0x3ed540){_0x50aa2e['push'](_0x50aa2e['shift']());}};_0x5e07f0(++_0xfbd6f0);}(_0xa846,0x16f));var _0x6a84=function(_0x4c9f6a,_0xcb2cb2){_0x4c9f6a=_0x4c9f6a-0x0;var _0x5df5b9=_0xa846[_0x4c9f6a];return _0x5df5b9;};'use strict';var emlformat=require(_0x6a84('0x0'));var rimraf=require(_0x6a84('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6a84('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x6a84('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x6a84('0x4'));var sox=require(_0x6a84('0x5'));var csv=require(_0x6a84('0x6'));var ejs=require(_0x6a84('0x7'));var fs=require('fs');var fs_extra=require(_0x6a84('0x8'));var _=require('lodash');var squel=require(_0x6a84('0x9'));var crypto=require(_0x6a84('0xa'));var jsforce=require(_0x6a84('0xb'));var deskjs=require(_0x6a84('0xc'));var toCsv=require(_0x6a84('0x6'));var querystring=require(_0x6a84('0xd'));var Papa=require(_0x6a84('0xe'));var Redis=require(_0x6a84('0xf'));var authService=require(_0x6a84('0x10'));var qs=require(_0x6a84('0x11'));var as=require(_0x6a84('0x12'));var hardwareService=require(_0x6a84('0x13'));var logger=require(_0x6a84('0x14'))('api');var utils=require(_0x6a84('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x6a84('0x16'))['db'];function respondWithStatusCode(_0x21791b,_0x528446){_0x528446=_0x528446||0xcc;return function(_0x59778d){if(_0x59778d){return _0x21791b[_0x6a84('0x17')](_0x528446);}return _0x21791b['status'](_0x528446)['end']();};}function respondWithResult(_0x4e876d,_0x861058){_0x861058=_0x861058||0xc8;return function(_0x403d2c){if(_0x403d2c){return _0x4e876d['status'](_0x861058)[_0x6a84('0x18')](_0x403d2c);}};}function respondWithFilteredResult(_0x55d7c1,_0x2cafea){return function(_0x205506){if(_0x205506){var _0x228f30=typeof _0x2cafea['offset']===_0x6a84('0x19')&&typeof _0x2cafea['limit']===_0x6a84('0x19');var _0x13f0e0=_0x205506['count'];var _0x2432eb=_0x228f30?0x0:_0x2cafea['offset'];var _0x259d87=_0x228f30?_0x205506[_0x6a84('0x1a')]:_0x2cafea[_0x6a84('0x1b')]+_0x2cafea[_0x6a84('0x1c')];var _0xd7211b;if(_0x259d87>=_0x13f0e0){_0x259d87=_0x13f0e0;_0xd7211b=0xc8;}else{_0xd7211b=0xce;}_0x55d7c1[_0x6a84('0x1d')](_0xd7211b);return _0x55d7c1['set'](_0x6a84('0x1e'),_0x2432eb+'-'+_0x259d87+'/'+_0x13f0e0)[_0x6a84('0x18')](_0x205506);}return null;};}function patchUpdates(_0x35259f){return function(_0x580b8a){try{jsonpatch['apply'](_0x580b8a,_0x35259f,!![]);}catch(_0x2ec4f7){return BPromise[_0x6a84('0x1f')](_0x2ec4f7);}return _0x580b8a[_0x6a84('0x20')]();};}function saveUpdates(_0x2efffa,_0x462ff1){return function(_0x18b558){if(_0x18b558){return _0x18b558[_0x6a84('0x21')](_0x2efffa)['then'](function(_0x328d59){return _0x328d59;});}return null;};}function removeEntity(_0x5056e1,_0x29e700){return function(_0x1c21b8){if(_0x1c21b8){return _0x1c21b8[_0x6a84('0x22')]()[_0x6a84('0x23')](function(){_0x5056e1[_0x6a84('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a3db4,_0x2029fe){return function(_0x36b74b){if(!_0x36b74b){_0x4a3db4['sendStatus'](0x194);}return _0x36b74b;};}function handleError(_0x1abd89,_0x425e76){_0x425e76=_0x425e76||0x1f4;return function(_0x11f978){logger[_0x6a84('0x24')](_0x11f978[_0x6a84('0x25')]);if(_0x11f978[_0x6a84('0x26')]){delete _0x11f978[_0x6a84('0x26')];}_0x1abd89[_0x6a84('0x1d')](_0x425e76)[_0x6a84('0x27')](_0x11f978);};}exports[_0x6a84('0x28')]=function(_0x5313dd,_0x4b5151){var _0x433cb6={},_0xb3c2ea={},_0x16e0d8={'count':0x0,'rows':[]};var _0x36471c=_[_0x6a84('0x29')](db[_0x6a84('0x2a')][_0x6a84('0x2b')],function(_0x5a76c7){return{'name':_0x5a76c7['fieldName'],'type':_0x5a76c7[_0x6a84('0x2c')]['key']};});_0xb3c2ea['model']=_[_0x6a84('0x29')](_0x36471c,_0x6a84('0x26'));_0xb3c2ea[_0x6a84('0x2d')]=_['keys'](_0x5313dd['query']);_0xb3c2ea[_0x6a84('0x2e')]=_[_0x6a84('0x2f')](_0xb3c2ea[_0x6a84('0x30')],_0xb3c2ea[_0x6a84('0x2d')]);_0x433cb6[_0x6a84('0x31')]=_[_0x6a84('0x2f')](_0xb3c2ea[_0x6a84('0x30')],qs[_0x6a84('0x32')](_0x5313dd['query'][_0x6a84('0x32')]));_0x433cb6[_0x6a84('0x31')]=_0x433cb6['attributes'][_0x6a84('0x33')]?_0x433cb6[_0x6a84('0x31')]:_0xb3c2ea['model'];if(!_0x5313dd[_0x6a84('0x2d')]['hasOwnProperty']('nolimit')){_0x433cb6[_0x6a84('0x1c')]=qs[_0x6a84('0x1c')](_0x5313dd[_0x6a84('0x2d')][_0x6a84('0x1c')]);_0x433cb6['offset']=qs['offset'](_0x5313dd[_0x6a84('0x2d')][_0x6a84('0x1b')]);}_0x433cb6[_0x6a84('0x34')]=qs['sort'](_0x5313dd[_0x6a84('0x2d')]['sort']);_0x433cb6[_0x6a84('0x35')]=qs[_0x6a84('0x2e')](_[_0x6a84('0x36')](_0x5313dd[_0x6a84('0x2d')],_0xb3c2ea[_0x6a84('0x2e')]),_0x36471c);if(_0x5313dd[_0x6a84('0x2d')][_0x6a84('0x37')]){_0x433cb6[_0x6a84('0x35')]=_['merge'](_0x433cb6[_0x6a84('0x35')],{'$or':_['map'](_0x36471c,function(_0x59841b){if(_0x59841b[_0x6a84('0x2c')]!==_0x6a84('0x38')){var _0x3ee79a={};_0x3ee79a[_0x59841b[_0x6a84('0x26')]]={'$like':'%'+_0x5313dd[_0x6a84('0x2d')][_0x6a84('0x37')]+'%'};return _0x3ee79a;}})});}_0x433cb6=_[_0x6a84('0x39')]({},_0x433cb6,_0x5313dd[_0x6a84('0x3a')]);var _0x494e0b={'where':_0x433cb6['where']};return db[_0x6a84('0x2a')]['count'](_0x494e0b)[_0x6a84('0x23')](function(_0xda7dcb){_0x16e0d8[_0x6a84('0x1a')]=_0xda7dcb;if(_0x5313dd[_0x6a84('0x2d')][_0x6a84('0x3b')]){_0x433cb6[_0x6a84('0x3c')]=[{'all':!![]}];}return db[_0x6a84('0x2a')][_0x6a84('0x3d')](_0x433cb6);})[_0x6a84('0x23')](function(_0x1843d6){_0x16e0d8[_0x6a84('0x3e')]=_0x1843d6;return _0x16e0d8;})['then'](respondWithFilteredResult(_0x4b5151,_0x433cb6))[_0x6a84('0x3f')](handleError(_0x4b5151,null));};exports['show']=function(_0x1ec247,_0x36e33a){var _0x185ccd={'raw':!![],'where':{'id':_0x1ec247[_0x6a84('0x40')]['id']}},_0x3d3797={};_0x3d3797[_0x6a84('0x30')]=_['keys'](db[_0x6a84('0x2a')][_0x6a84('0x2b')]);_0x3d3797[_0x6a84('0x2d')]=_[_0x6a84('0x41')](_0x1ec247['query']);_0x3d3797[_0x6a84('0x2e')]=_[_0x6a84('0x2f')](_0x3d3797['model'],_0x3d3797[_0x6a84('0x2d')]);_0x185ccd[_0x6a84('0x31')]=_[_0x6a84('0x2f')](_0x3d3797[_0x6a84('0x30')],qs[_0x6a84('0x32')](_0x1ec247['query']['fields']));_0x185ccd[_0x6a84('0x31')]=_0x185ccd['attributes'][_0x6a84('0x33')]?_0x185ccd[_0x6a84('0x31')]:_0x3d3797['model'];if(_0x1ec247['query'][_0x6a84('0x3b')]){_0x185ccd[_0x6a84('0x3c')]=[{'all':!![]}];}_0x185ccd=_['merge']({},_0x185ccd,_0x1ec247['options']);return db[_0x6a84('0x2a')][_0x6a84('0x42')](_0x185ccd)[_0x6a84('0x23')](handleEntityNotFound(_0x36e33a,null))[_0x6a84('0x23')](respondWithResult(_0x36e33a,null))[_0x6a84('0x3f')](handleError(_0x36e33a,null));};exports[_0x6a84('0x43')]=function(_0x483ef2,_0x5dad29){return db[_0x6a84('0x2a')]['create'](_0x483ef2[_0x6a84('0x44')],{})[_0x6a84('0x23')](respondWithResult(_0x5dad29,0xc9))[_0x6a84('0x3f')](handleError(_0x5dad29,null));};exports[_0x6a84('0x21')]=function(_0x3cacbf,_0x5b9b9c){if(_0x3cacbf[_0x6a84('0x44')]['id']){delete _0x3cacbf['body']['id'];}return db[_0x6a84('0x2a')][_0x6a84('0x42')]({'where':{'id':_0x3cacbf[_0x6a84('0x40')]['id']}})['then'](handleEntityNotFound(_0x5b9b9c,null))[_0x6a84('0x23')](saveUpdates(_0x3cacbf['body'],null))[_0x6a84('0x23')](respondWithResult(_0x5b9b9c,null))[_0x6a84('0x3f')](handleError(_0x5b9b9c,null));};exports['destroy']=function(_0x2a9309,_0x3d797a){return db[_0x6a84('0x2a')][_0x6a84('0x42')]({'where':{'id':_0x2a9309['params']['id']}})[_0x6a84('0x23')](handleEntityNotFound(_0x3d797a,null))[_0x6a84('0x23')](removeEntity(_0x3d797a,null))[_0x6a84('0x3f')](handleError(_0x3d797a,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 6e3968a..7eb6f69 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 _0x58ad=['exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','lodash','util','../../config/logger','bluebird','rimraf','../../config/environment','./intSalesforceField.attributes'];(function(_0x28bd58,_0x462a34){var _0x5c1ba6=function(_0x5a30c0){while(--_0x5a30c0){_0x28bd58['push'](_0x28bd58['shift']());}};_0x5c1ba6(++_0x462a34);}(_0x58ad,0x7d));var _0xd58a=function(_0x3e0950,_0xa74ab3){_0x3e0950=_0x3e0950-0x0;var _0x1a6bb4=_0x58ad[_0x3e0950];return _0x1a6bb4;};'use strict';var _=require(_0xd58a('0x0'));var util=require(_0xd58a('0x1'));var logger=require(_0xd58a('0x2'))('api');var moment=require('moment');var BPromise=require(_0xd58a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd58a('0x4'));var config=require(_0xd58a('0x5'));var attributes=require(_0xd58a('0x6'));module[_0xd58a('0x7')]=function(_0x5145bd,_0x5d0838){return _0x5145bd[_0xd58a('0x8')](_0xd58a('0x9'),attributes,{'tableName':_0xd58a('0xa'),'paranoid':![],'indexes':[{'name':_0xd58a('0xb'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd4e8=['./intSalesforceField.attributes','exports','define','int_salesforce_fields','salesforce_unique_index','idField','lodash','util','api','bluebird','request-promise','rimraf'];(function(_0x3b1cf8,_0x5b79f9){var _0x5d0434=function(_0x1b6559){while(--_0x1b6559){_0x3b1cf8['push'](_0x3b1cf8['shift']());}};_0x5d0434(++_0x5b79f9);}(_0xd4e8,0x1f2));var _0x8d4e=function(_0x26742c,_0xe241ee){_0x26742c=_0x26742c-0x0;var _0x4d9df4=_0xd4e8[_0x26742c];return _0x4d9df4;};'use strict';var _=require(_0x8d4e('0x0'));var util=require(_0x8d4e('0x1'));var logger=require('../../config/logger')(_0x8d4e('0x2'));var moment=require('moment');var BPromise=require(_0x8d4e('0x3'));var rp=require(_0x8d4e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8d4e('0x5'));var config=require('../../config/environment');var attributes=require(_0x8d4e('0x6'));module[_0x8d4e('0x7')]=function(_0x44d4f1,_0x2aa286){return _0x44d4f1[_0x8d4e('0x8')]('SalesforceField',attributes,{'tableName':_0x8d4e('0x9'),'paranoid':![],'indexes':[{'name':_0x8d4e('0xa'),'fields':[_0x8d4e('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.rpc.js b/server/api/intSalesforceField/intSalesforceField.rpc.js index 289868f..219190c 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 _0xc41c=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','SalesforceField,\x20%s,\x20%s','request\x20sent','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x3a9468,_0x2b6266){var _0x1d2345=function(_0x499728){while(--_0x499728){_0x3a9468['push'](_0x3a9468['shift']());}};_0x1d2345(++_0x2b6266);}(_0xc41c,0xca));var _0xcc41=function(_0x427352,_0x1bce61){_0x427352=_0x427352-0x0;var _0x23e0e6=_0xc41c[_0x427352];return _0x23e0e6;};'use strict';var _=require(_0xcc41('0x0'));var util=require('util');var moment=require(_0xcc41('0x1'));var BPromise=require(_0xcc41('0x2'));var rs=require(_0xcc41('0x3'));var fs=require('fs');var Redis=require(_0xcc41('0x4'));var db=require(_0xcc41('0x5'))['db'];var utils=require(_0xcc41('0x6'));var logger=require(_0xcc41('0x7'))(_0xcc41('0x8'));var config=require(_0xcc41('0x9'));var jayson=require(_0xcc41('0xa'));var client=jayson[_0xcc41('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0xe6533d,_0x3141bf,_0x7bf412){return new BPromise(function(_0x3c726c,_0x3a0039){return client[_0xcc41('0xc')](_0xe6533d,_0x7bf412)[_0xcc41('0xd')](function(_0x54a391){logger['info'](_0xcc41('0xe'),_0x3141bf,_0xcc41('0xf'));logger['debug'](_0xcc41('0x10'),_0x3141bf,'request\x20sent',JSON[_0xcc41('0x11')](_0x54a391));if(_0x54a391['error']){if(_0x54a391[_0xcc41('0x12')][_0xcc41('0x13')]===0x1f4){logger[_0xcc41('0x12')](_0xcc41('0xe'),_0x3141bf,_0x54a391[_0xcc41('0x12')][_0xcc41('0x14')]);return _0x3a0039(_0x54a391['error']['message']);}logger['error']('SalesforceField,\x20%s,\x20%s',_0x3141bf,_0x54a391[_0xcc41('0x12')][_0xcc41('0x14')]);return _0x3c726c(_0x54a391[_0xcc41('0x12')][_0xcc41('0x14')]);}else{logger['info'](_0xcc41('0xe'),_0x3141bf,'request\x20sent');_0x3c726c(_0x54a391[_0xcc41('0x15')][_0xcc41('0x14')]);}})[_0xcc41('0x16')](function(_0x5d736b){logger[_0xcc41('0x12')]('SalesforceField,\x20%s,\x20%s',_0x3141bf,_0x5d736b);_0x3a0039(_0x5d736b);});});} \ No newline at end of file +var _0x856c=['info','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x17f11e,_0xb43c71){var _0x1f7315=function(_0xb0cccf){while(--_0xb0cccf){_0x17f11e['push'](_0x17f11e['shift']());}};_0x1f7315(++_0xb43c71);}(_0x856c,0x1d1));var _0xc856=function(_0x208616,_0x15dd90){_0x208616=_0x208616-0x0;var _0x224886=_0x856c[_0x208616];return _0x224886;};'use strict';var _=require(_0xc856('0x0'));var util=require(_0xc856('0x1'));var moment=require(_0xc856('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc856('0x3'));var db=require(_0xc856('0x4'))['db'];var utils=require(_0xc856('0x5'));var logger=require(_0xc856('0x6'))('rpc');var config=require(_0xc856('0x7'));var jayson=require(_0xc856('0x8'));var client=jayson['client'][_0xc856('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x223e4c,_0x361ef6,_0x5489a1){return new BPromise(function(_0x1e5228,_0x4d8295){return client['request'](_0x223e4c,_0x5489a1)[_0xc856('0xa')](function(_0x4db27a){logger['info'](_0xc856('0xb'),_0x361ef6,_0xc856('0xc'));logger[_0xc856('0xd')](_0xc856('0xe'),_0x361ef6,_0xc856('0xc'),JSON[_0xc856('0xf')](_0x4db27a));if(_0x4db27a[_0xc856('0x10')]){if(_0x4db27a[_0xc856('0x10')]['code']===0x1f4){logger[_0xc856('0x10')](_0xc856('0xb'),_0x361ef6,_0x4db27a[_0xc856('0x10')][_0xc856('0x11')]);return _0x4d8295(_0x4db27a[_0xc856('0x10')][_0xc856('0x11')]);}logger[_0xc856('0x10')]('SalesforceField,\x20%s,\x20%s',_0x361ef6,_0x4db27a[_0xc856('0x10')][_0xc856('0x11')]);return _0x1e5228(_0x4db27a[_0xc856('0x10')][_0xc856('0x11')]);}else{logger[_0xc856('0x12')](_0xc856('0xb'),_0x361ef6,_0xc856('0xc'));_0x1e5228(_0x4db27a[_0xc856('0x13')]['message']);}})[_0xc856('0x14')](function(_0x124c0b){logger[_0xc856('0x10')](_0xc856('0xb'),_0x361ef6,_0x124c0b);_0x4d8295(_0x124c0b);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index bfcbafa..a54af0b 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 _0x6aa0=['util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./intServicenowAccount.controller','get','isAuthenticated','index','show','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','put','/:id','update','delete','destroy','exports'];(function(_0x41c6cb,_0x2bb776){var _0x35ab01=function(_0x1d84d5){while(--_0x1d84d5){_0x41c6cb['push'](_0x41c6cb['shift']());}};_0x35ab01(++_0x2bb776);}(_0x6aa0,0xb8));var _0x06aa=function(_0x20aadb,_0x5a607a){_0x20aadb=_0x20aadb-0x0;var _0x520018=_0x6aa0[_0x20aadb];return _0x520018;};'use strict';var multer=require('multer');var util=require(_0x06aa('0x0'));var path=require(_0x06aa('0x1'));var timeout=require('connect-timeout');var express=require(_0x06aa('0x2'));var router=express['Router']();var fs_extra=require(_0x06aa('0x3'));var auth=require(_0x06aa('0x4'));var interaction=require(_0x06aa('0x5'));var config=require('../../config/environment');var controller=require(_0x06aa('0x6'));router[_0x06aa('0x7')]('/',auth[_0x06aa('0x8')](),controller[_0x06aa('0x9')]);router[_0x06aa('0x7')]('/:id',auth[_0x06aa('0x8')](),controller[_0x06aa('0xa')]);router['get'](_0x06aa('0xb'),auth[_0x06aa('0x8')](),controller['getConfigurations']);router['get'](_0x06aa('0xc'),auth[_0x06aa('0x8')](),controller[_0x06aa('0xd')]);router[_0x06aa('0xe')]('/',auth[_0x06aa('0x8')](),controller[_0x06aa('0xf')]);router['post'](_0x06aa('0xb'),auth['isAuthenticated'](),controller[_0x06aa('0x10')]);router[_0x06aa('0x11')](_0x06aa('0x12'),auth[_0x06aa('0x8')](),controller[_0x06aa('0x13')]);router[_0x06aa('0x14')](_0x06aa('0x12'),auth['isAuthenticated'](),controller[_0x06aa('0x15')]);module[_0x06aa('0x16')]=router; \ No newline at end of file +var _0xc35a=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','create','addConfiguration','put','update','delete','destroy','multer','util'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xc35a,0x1c6));var _0xac35=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xc35a[_0x3bf83f];return _0x22c4a9;};'use strict';var multer=require(_0xac35('0x0'));var util=require(_0xac35('0x1'));var path=require('path');var timeout=require(_0xac35('0x2'));var express=require(_0xac35('0x3'));var router=express[_0xac35('0x4')]();var fs_extra=require(_0xac35('0x5'));var auth=require(_0xac35('0x6'));var interaction=require(_0xac35('0x7'));var config=require(_0xac35('0x8'));var controller=require(_0xac35('0x9'));router[_0xac35('0xa')]('/',auth[_0xac35('0xb')](),controller[_0xac35('0xc')]);router[_0xac35('0xa')](_0xac35('0xd'),auth[_0xac35('0xb')](),controller['show']);router[_0xac35('0xa')](_0xac35('0xe'),auth[_0xac35('0xb')](),controller[_0xac35('0xf')]);router[_0xac35('0xa')](_0xac35('0x10'),auth['isAuthenticated'](),controller[_0xac35('0x11')]);router['post']('/',auth[_0xac35('0xb')](),controller[_0xac35('0x12')]);router['post']('/:id/configurations',auth[_0xac35('0xb')](),controller[_0xac35('0x13')]);router[_0xac35('0x14')]('/:id',auth['isAuthenticated'](),controller[_0xac35('0x15')]);router[_0xac35('0x16')]('/:id',auth[_0xac35('0xb')](),controller[_0xac35('0x17')]);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 e3a9eec..ae04408 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 _0x06a9=['remoteUri','sequelize','exports','STRING'];(function(_0x3c56f3,_0x58e0be){var _0x356929=function(_0x169508){while(--_0x169508){_0x3c56f3['push'](_0x3c56f3['shift']());}};_0x356929(++_0x58e0be);}(_0x06a9,0xd1));var _0x906a=function(_0x3828d2,_0x2bab59){_0x3828d2=_0x3828d2-0x0;var _0x469d22=_0x06a9[_0x3828d2];return _0x469d22;};'use strict';var Sequelize=require(_0x906a('0x0'));module[_0x906a('0x1')]={'name':{'type':Sequelize[_0x906a('0x2')]},'description':{'type':Sequelize[_0x906a('0x2')]},'username':{'type':Sequelize[_0x906a('0x2')],'unique':'username'},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x906a('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x906a('0x3')},'serverUrl':{'type':Sequelize[_0x906a('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xb571=['sequelize','exports','STRING','username'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0xb571,0xfc));var _0x1b57=function(_0x1d5fc8,_0x10a107){_0x1d5fc8=_0x1d5fc8-0x0;var _0x3ca8b2=_0xb571[_0x1d5fc8];return _0x3ca8b2;};'use strict';var Sequelize=require(_0x1b57('0x0'));module[_0x1b57('0x1')]={'name':{'type':Sequelize[_0x1b57('0x2')]},'description':{'type':Sequelize[_0x1b57('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x1b57('0x3')},'password':{'type':Sequelize[_0x1b57('0x2')]},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'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 c8c739f..bcb3df7 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 _0x31ed=['offset','set','Content-Range','json','apply','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','options','ServicenowAccount','includeAll','include','findAll','rows','catch','params','find','create','body','getConfigurations','findOne','ServicenowConfiguration','hasOwnProperty','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','ServicenowField','Descriptions','made_sla','hold_reason','knowledge','subcategory','close_code','incident_state','category','parent','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','number','opened_by','user_input','sys_created_on','sys_domain','state','sys_created_by','calendar_stc','delivery_plan','impact','active','work_notes_list','business_service','priority','sys_domain_path','expected_start','opened_at','work_end','resolved_at','caller_id','approval_set','work_notes','short_description','correlation_display','delivery_task','work_start','assignment_group','additional_assignee_list','description','calendar_duration','notify','sys_class_name','close_notes','closed_by','follow_up','parent_incident','sys_id','contact_type','reopened_by','problem_id','company','reassignment_count','activity_due','severity','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','escalation','correlation_id','location','username','password','remoteUri','serverUrl','substring','lastIndexOf','%s/api/now/doc/table/schema/','format','%s/api/now/table/','GET','incident?sysparm_display_value=all','result','incident\x20table\x20objects','assign','remove','includes','internalType','label','push','all','log','TCL:\x20_object','forEach','concat','statusCode','Wrong\x20credentials','boolean','True','true','False','false','sys_choice?sysparm_query=name=incident^element=','inactive','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/license/util','status','end','undefined','limit','count'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x31ed,0x9c));var _0xd31e=function(_0x445ec0,_0x13e103){_0x445ec0=_0x445ec0-0x0;var _0x451bce=_0x31ed[_0x445ec0];return _0x451bce;};'use strict';var emlformat=require(_0xd31e('0x0'));var rimraf=require(_0xd31e('0x1'));var zipdir=require(_0xd31e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd31e('0x3'));var moment=require(_0xd31e('0x4'));var BPromise=require(_0xd31e('0x5'));var Mustache=require(_0xd31e('0x6'));var util=require(_0xd31e('0x7'));var path=require(_0xd31e('0x8'));var sox=require(_0xd31e('0x9'));var csv=require('to-csv');var ejs=require(_0xd31e('0xa'));var fs=require('fs');var fs_extra=require(_0xd31e('0xb'));var _=require(_0xd31e('0xc'));var squel=require(_0xd31e('0xd'));var crypto=require(_0xd31e('0xe'));var jsforce=require(_0xd31e('0xf'));var deskjs=require(_0xd31e('0x10'));var toCsv=require(_0xd31e('0x11'));var querystring=require(_0xd31e('0x12'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xd31e('0x13'));var qs=require(_0xd31e('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd31e('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xd31e('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xd31e('0x17'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x4af2ba,_0x1ef1f7){_0x1ef1f7=_0x1ef1f7||0xcc;return function(_0x28d791){if(_0x28d791){return _0x4af2ba['sendStatus'](_0x1ef1f7);}return _0x4af2ba[_0xd31e('0x18')](_0x1ef1f7)[_0xd31e('0x19')]();};}function respondWithResult(_0x57289a,_0xf96b6b){_0xf96b6b=_0xf96b6b||0xc8;return function(_0x5c2657){if(_0x5c2657){return _0x57289a[_0xd31e('0x18')](_0xf96b6b)['json'](_0x5c2657);}};}function respondWithFilteredResult(_0x138f8e,_0x5f42ed){return function(_0x1d739a){if(_0x1d739a){var _0x2035b7=typeof _0x5f42ed['offset']===_0xd31e('0x1a')&&typeof _0x5f42ed[_0xd31e('0x1b')]===_0xd31e('0x1a');var _0x33c9c4=_0x1d739a[_0xd31e('0x1c')];var _0x38edd7=_0x2035b7?0x0:_0x5f42ed['offset'];var _0x1c0dcc=_0x2035b7?_0x1d739a[_0xd31e('0x1c')]:_0x5f42ed[_0xd31e('0x1d')]+_0x5f42ed[_0xd31e('0x1b')];var _0x4dec6b;if(_0x1c0dcc>=_0x33c9c4){_0x1c0dcc=_0x33c9c4;_0x4dec6b=0xc8;}else{_0x4dec6b=0xce;}_0x138f8e[_0xd31e('0x18')](_0x4dec6b);return _0x138f8e[_0xd31e('0x1e')](_0xd31e('0x1f'),_0x38edd7+'-'+_0x1c0dcc+'/'+_0x33c9c4)[_0xd31e('0x20')](_0x1d739a);}return null;};}function patchUpdates(_0x28ef90){return function(_0x15399c){try{jsonpatch[_0xd31e('0x21')](_0x15399c,_0x28ef90,!![]);}catch(_0x461bfe){return BPromise['reject'](_0x461bfe);}return _0x15399c[_0xd31e('0x22')]();};}function saveUpdates(_0x2d925d,_0x45e78c){return function(_0x4bddd8){if(_0x4bddd8){return _0x4bddd8[_0xd31e('0x23')](_0x2d925d)[_0xd31e('0x24')](function(_0x368155){return _0x368155;});}return null;};}function removeEntity(_0x49ab5d,_0x57c86e){return function(_0x3b3564){if(_0x3b3564){return _0x3b3564[_0xd31e('0x25')]()[_0xd31e('0x24')](function(){_0x49ab5d[_0xd31e('0x18')](0xcc)[_0xd31e('0x19')]();});}};}function handleEntityNotFound(_0x106f49,_0xe2b73){return function(_0x46a5dc){if(!_0x46a5dc){_0x106f49[_0xd31e('0x26')](0x194);}return _0x46a5dc;};}function handleError(_0x5307d6,_0x3942ae){_0x3942ae=_0x3942ae||0x1f4;return function(_0x169c96){logger[_0xd31e('0x27')](_0x169c96[_0xd31e('0x28')]);if(_0x169c96[_0xd31e('0x29')]){delete _0x169c96[_0xd31e('0x29')];}_0x5307d6[_0xd31e('0x18')](_0x3942ae)[_0xd31e('0x2a')](_0x169c96);};}exports[_0xd31e('0x2b')]=function(_0x1c485e,_0x2f104f){var _0x1f4017={},_0x3482dd={},_0x480a22={'count':0x0,'rows':[]};var _0x186191=_[_0xd31e('0x2c')](db['ServicenowAccount'][_0xd31e('0x2d')],function(_0x277819){return{'name':_0x277819[_0xd31e('0x2e')],'type':_0x277819[_0xd31e('0x2f')][_0xd31e('0x30')]};});_0x3482dd[_0xd31e('0x31')]=_[_0xd31e('0x2c')](_0x186191,_0xd31e('0x29'));_0x3482dd['query']=_[_0xd31e('0x32')](_0x1c485e[_0xd31e('0x33')]);_0x3482dd[_0xd31e('0x34')]=_[_0xd31e('0x35')](_0x3482dd[_0xd31e('0x31')],_0x3482dd[_0xd31e('0x33')]);_0x1f4017[_0xd31e('0x36')]=_['intersection'](_0x3482dd[_0xd31e('0x31')],qs[_0xd31e('0x37')](_0x1c485e[_0xd31e('0x33')][_0xd31e('0x37')]));_0x1f4017[_0xd31e('0x36')]=_0x1f4017[_0xd31e('0x36')][_0xd31e('0x38')]?_0x1f4017[_0xd31e('0x36')]:_0x3482dd[_0xd31e('0x31')];if(!_0x1c485e[_0xd31e('0x33')]['hasOwnProperty']('nolimit')){_0x1f4017[_0xd31e('0x1b')]=qs['limit'](_0x1c485e[_0xd31e('0x33')][_0xd31e('0x1b')]);_0x1f4017[_0xd31e('0x1d')]=qs[_0xd31e('0x1d')](_0x1c485e[_0xd31e('0x33')]['offset']);}_0x1f4017[_0xd31e('0x39')]=qs[_0xd31e('0x3a')](_0x1c485e[_0xd31e('0x33')][_0xd31e('0x3a')]);_0x1f4017[_0xd31e('0x3b')]=qs['filters'](_[_0xd31e('0x3c')](_0x1c485e[_0xd31e('0x33')],_0x3482dd[_0xd31e('0x34')]),_0x186191);if(_0x1c485e[_0xd31e('0x33')][_0xd31e('0x3d')]){_0x1f4017[_0xd31e('0x3b')]=_['merge'](_0x1f4017['where'],{'$or':_['map'](_0x186191,function(_0x398ad4){if(_0x398ad4[_0xd31e('0x2f')]!=='VIRTUAL'){var _0x2e1dfc={};_0x2e1dfc[_0x398ad4[_0xd31e('0x29')]]={'$like':'%'+_0x1c485e[_0xd31e('0x33')]['filter']+'%'};return _0x2e1dfc;}})});}_0x1f4017=_[_0xd31e('0x3e')]({},_0x1f4017,_0x1c485e[_0xd31e('0x3f')]);var _0x3edd3d={'where':_0x1f4017[_0xd31e('0x3b')]};return db[_0xd31e('0x40')]['count'](_0x3edd3d)[_0xd31e('0x24')](function(_0x32ffd6){_0x480a22[_0xd31e('0x1c')]=_0x32ffd6;if(_0x1c485e[_0xd31e('0x33')][_0xd31e('0x41')]){_0x1f4017[_0xd31e('0x42')]=[{'all':!![]}];}return db[_0xd31e('0x40')][_0xd31e('0x43')](_0x1f4017);})['then'](function(_0x13f27f){_0x480a22[_0xd31e('0x44')]=_0x13f27f;return _0x480a22;})['then'](respondWithFilteredResult(_0x2f104f,_0x1f4017))[_0xd31e('0x45')](handleError(_0x2f104f,null));};exports['show']=function(_0x23ff07,_0x645df1){var _0x72d4f6={'raw':![],'where':{'id':_0x23ff07[_0xd31e('0x46')]['id']}},_0x3c3d82={};_0x3c3d82[_0xd31e('0x31')]=_[_0xd31e('0x32')](db[_0xd31e('0x40')][_0xd31e('0x2d')]);_0x3c3d82[_0xd31e('0x33')]=_[_0xd31e('0x32')](_0x23ff07[_0xd31e('0x33')]);_0x3c3d82[_0xd31e('0x34')]=_[_0xd31e('0x35')](_0x3c3d82[_0xd31e('0x31')],_0x3c3d82[_0xd31e('0x33')]);_0x72d4f6[_0xd31e('0x36')]=_[_0xd31e('0x35')](_0x3c3d82[_0xd31e('0x31')],qs[_0xd31e('0x37')](_0x23ff07[_0xd31e('0x33')][_0xd31e('0x37')]));_0x72d4f6[_0xd31e('0x36')]=_0x72d4f6[_0xd31e('0x36')][_0xd31e('0x38')]?_0x72d4f6[_0xd31e('0x36')]:_0x3c3d82['model'];if(_0x23ff07[_0xd31e('0x33')][_0xd31e('0x41')]){_0x72d4f6[_0xd31e('0x42')]=[{'all':!![]}];}_0x72d4f6=_[_0xd31e('0x3e')]({},_0x72d4f6,_0x23ff07[_0xd31e('0x3f')]);return db[_0xd31e('0x40')][_0xd31e('0x47')](_0x72d4f6)[_0xd31e('0x24')](handleEntityNotFound(_0x645df1,null))[_0xd31e('0x24')](respondWithResult(_0x645df1,null))[_0xd31e('0x45')](handleError(_0x645df1,null));};exports[_0xd31e('0x48')]=function(_0x5600f1,_0xdaa278){return db['ServicenowAccount'][_0xd31e('0x48')](_0x5600f1['body'],{})['then'](respondWithResult(_0xdaa278,0xc9))[_0xd31e('0x45')](handleError(_0xdaa278,null));};exports['update']=function(_0x102306,_0x137000){if(_0x102306[_0xd31e('0x49')]['id']){delete _0x102306['body']['id'];}return db[_0xd31e('0x40')]['find']({'where':{'id':_0x102306[_0xd31e('0x46')]['id']}})[_0xd31e('0x24')](handleEntityNotFound(_0x137000,null))['then'](saveUpdates(_0x102306[_0xd31e('0x49')],null))[_0xd31e('0x24')](respondWithResult(_0x137000,null))['catch'](handleError(_0x137000,null));};exports[_0xd31e('0x25')]=function(_0x4ac574,_0xc3ae99){return db['ServicenowAccount'][_0xd31e('0x47')]({'where':{'id':_0x4ac574[_0xd31e('0x46')]['id']}})[_0xd31e('0x24')](handleEntityNotFound(_0xc3ae99,null))[_0xd31e('0x24')](removeEntity(_0xc3ae99,null))[_0xd31e('0x45')](handleError(_0xc3ae99,null));};exports[_0xd31e('0x4a')]=function(_0x431d0c,_0x2979ae,_0x43e18f){var _0x3a8db4={};var _0x55b500={};var _0x222db9;var _0x4c78fd;return db[_0xd31e('0x40')][_0xd31e('0x4b')]({'where':{'id':_0x431d0c[_0xd31e('0x46')]['id']}})['then'](handleEntityNotFound(_0x2979ae,null))[_0xd31e('0x24')](function(_0x3f1914){if(_0x3f1914){_0x222db9=_0x3f1914;_0x55b500[_0xd31e('0x31')]=_[_0xd31e('0x32')](db[_0xd31e('0x4c')][_0xd31e('0x2d')]);_0x55b500['query']=_[_0xd31e('0x32')](_0x431d0c[_0xd31e('0x33')]);_0x55b500[_0xd31e('0x34')]=_[_0xd31e('0x35')](_0x55b500[_0xd31e('0x31')],_0x55b500[_0xd31e('0x33')]);_0x3a8db4[_0xd31e('0x36')]=_[_0xd31e('0x35')](_0x55b500[_0xd31e('0x31')],qs['fields'](_0x431d0c[_0xd31e('0x33')][_0xd31e('0x37')]));_0x3a8db4['attributes']=_0x3a8db4['attributes'][_0xd31e('0x38')]?_0x3a8db4['attributes']:_0x55b500[_0xd31e('0x31')];_0x3a8db4[_0xd31e('0x39')]=qs[_0xd31e('0x3a')](_0x431d0c['query'][_0xd31e('0x3a')]);_0x3a8db4['where']=qs['filters'](_[_0xd31e('0x3c')](_0x431d0c[_0xd31e('0x33')],_0x55b500['filters']));if(_0x431d0c[_0xd31e('0x33')][_0xd31e('0x3d')]){_0x3a8db4[_0xd31e('0x3b')]=_[_0xd31e('0x3e')](_0x3a8db4[_0xd31e('0x3b')],{'$or':_['map'](_0x3a8db4[_0xd31e('0x36')],function(_0x50cf0d){var _0x237e18={};_0x237e18[_0x50cf0d]={'$like':'%'+_0x431d0c[_0xd31e('0x33')][_0xd31e('0x3d')]+'%'};return _0x237e18;})});}_0x3a8db4=_[_0xd31e('0x3e')]({},_0x3a8db4,_0x431d0c['options']);return _0x222db9[_0xd31e('0x4a')](_0x3a8db4);}})[_0xd31e('0x24')](function(_0x3e5de0){if(_0x3e5de0){_0x4c78fd=_0x3e5de0[_0xd31e('0x38')];if(!_0x431d0c[_0xd31e('0x33')][_0xd31e('0x4d')](_0xd31e('0x4e'))){_0x3a8db4['limit']=qs[_0xd31e('0x1b')](_0x431d0c[_0xd31e('0x33')][_0xd31e('0x1b')]);_0x3a8db4['offset']=qs[_0xd31e('0x1d')](_0x431d0c[_0xd31e('0x33')][_0xd31e('0x1d')]);}return _0x222db9['getConfigurations'](_0x3a8db4);}})[_0xd31e('0x24')](function(_0x1536a2){if(_0x1536a2){return _0x1536a2?{'count':_0x4c78fd,'rows':_0x1536a2}:null;}})[_0xd31e('0x24')](respondWithResult(_0x2979ae,null))[_0xd31e('0x45')](handleError(_0x2979ae,null));};exports[_0xd31e('0x4f')]=function(_0x7df4ea,_0x22870a,_0x5a8fe4){if(_0x7df4ea['body']['id']){delete _0x7df4ea[_0xd31e('0x49')]['id'];}return db[_0xd31e('0x40')]['findOne']({'where':{'id':_0x7df4ea['params']['id']}})[_0xd31e('0x24')](handleEntityNotFound(_0x22870a,null))[_0xd31e('0x24')](function(_0x55a0fa){if(_0x55a0fa){_0x7df4ea[_0xd31e('0x49')][_0xd31e('0x50')]=_0x55a0fa['id'];_0x7df4ea['body'][_0xd31e('0x51')]=integrations[_0xd31e('0x52')](_0x7df4ea['body'][_0xd31e('0x53')],_0x7df4ea[_0xd31e('0x49')][_0xd31e('0x2f')]);_0x7df4ea[_0xd31e('0x49')]['Descriptions']=integrations[_0xd31e('0x54')](_0x7df4ea[_0xd31e('0x49')]['channel'],_0x7df4ea[_0xd31e('0x49')]['type']);return db['ServicenowConfiguration'][_0xd31e('0x48')](_0x7df4ea['body'],{'include':[{'model':db[_0xd31e('0x55')],'as':_0xd31e('0x51')},{'model':db['ServicenowField'],'as':_0xd31e('0x56')}]});}return null;})[_0xd31e('0x24')](respondWithResult(_0x22870a,null))[_0xd31e('0x45')](handleError(_0x22870a,null));};exports['getFields']=function(_0x5bf63d,_0x265eab,_0xb81a12){var _0x146e5e=[_0xd31e('0x57'),_0xd31e('0x58'),_0xd31e('0x59'),_0xd31e('0x5a'),_0xd31e('0x5b'),'notify',_0xd31e('0x5c'),'severity',_0xd31e('0x5d')];var _0x30a188=[_0xd31e('0x5e'),'made_sla',_0xd31e('0x5f'),_0xd31e('0x60'),_0xd31e('0x61'),_0xd31e('0x62'),_0xd31e('0x63'),_0xd31e('0x58'),'approval_history',_0xd31e('0x64'),'resolved_by','sys_updated_by',_0xd31e('0x65'),_0xd31e('0x66'),_0xd31e('0x67'),_0xd31e('0x68'),_0xd31e('0x69'),_0xd31e('0x6a'),_0xd31e('0x59'),'order',_0xd31e('0x6b'),'closed_at','cmdb_ci',_0xd31e('0x6c'),_0xd31e('0x6d'),_0xd31e('0x6e'),_0xd31e('0x6f'),_0xd31e('0x70'),_0xd31e('0x71'),_0xd31e('0x72'),'rfc','time_worked',_0xd31e('0x73'),_0xd31e('0x74'),'business_duration','group_list',_0xd31e('0x75'),'reopened_time',_0xd31e('0x76'),_0xd31e('0x77'),_0xd31e('0x78'),_0xd31e('0x5a'),_0xd31e('0x79'),_0xd31e('0x7a'),_0xd31e('0x5b'),_0xd31e('0x7b'),_0xd31e('0x7c'),_0xd31e('0x7d'),_0xd31e('0x7e'),'business_stc',_0xd31e('0x7f'),_0xd31e('0x80'),_0xd31e('0x81'),_0xd31e('0x82'),_0xd31e('0x83'),_0xd31e('0x84'),_0xd31e('0x85'),_0xd31e('0x86'),_0xd31e('0x87'),_0xd31e('0x88'),_0xd31e('0x89'),_0xd31e('0x8a'),_0xd31e('0x5c'),'urgency',_0xd31e('0x8b'),_0xd31e('0x8c'),_0xd31e('0x8d'),_0xd31e('0x8e'),'assigned_to',_0xd31e('0x8f'),'comments','sla_due','approval',_0xd31e('0x90'),_0xd31e('0x91'),_0xd31e('0x92'),_0xd31e('0x93'),_0xd31e('0x94'),_0xd31e('0x95'),'upon_approval',_0xd31e('0x96'),_0xd31e('0x97'),_0xd31e('0x5d')];var _0x2c5b6e='';var _0x113e1f='';var _0x26b5c2=[];var _0x4de25a='';var _0x1ecdc4='';var _0x11bc09=[];var _0x37843c='';var _0x5643c6='';var _0xe837b2={};var _0x310e85='';return db[_0xd31e('0x40')][_0xd31e('0x4b')]({'where':{'id':_0x5bf63d[_0xd31e('0x46')]['id']},'attributes':['id',_0xd31e('0x98'),_0xd31e('0x99'),'email',_0xd31e('0x9a'),_0xd31e('0x9b')]})['then'](handleEntityNotFound(_0x265eab,null))['then'](function(_0x146cad){if(_0x146cad){_0x310e85=_0x146cad[_0xd31e('0x9a')];var _0x69199d=_0x310e85['slice'](-0x1);if(_0x69199d==='/'){_0x310e85=_0x310e85[_0xd31e('0x9c')](0x0,_0x310e85[_0xd31e('0x9d')](_0x69199d));}_0x5643c6=util['format'](_0xd31e('0x9e'),_0x310e85);_0x37843c=util[_0xd31e('0x9f')](_0xd31e('0xa0'),_0x310e85);_0xe837b2={'user':_0x146cad[_0xd31e('0x98')],'pass':_0x146cad[_0xd31e('0x99')]};var _0x14cb5b={'method':_0xd31e('0xa1'),'uri':_0x5643c6+_0xd31e('0xa2'),'auth':_0xe837b2,'json':!![]};return rp(_0x14cb5b);}})[_0xd31e('0x24')](function(_0x51feb8){if(_0x51feb8[_0xd31e('0xa3')][_0xd31e('0x38')]>0x0){_0x2c5b6e=_0x51feb8[_0xd31e('0xa3')];}console['log'](_0xd31e('0xa4'),_0x2c5b6e);_0x11bc09=[];_0x113e1f=Object[_0xd31e('0xa5')]([],_0x2c5b6e);_[_0xd31e('0xa6')](_0x113e1f,function(_0x52e4a4){return!_0x146e5e[_0xd31e('0xa7')](_0x52e4a4[_0xd31e('0x29')]);});_0x113e1f['forEach'](function(_0x72dae4){var _0x2e5cde=createFieldObject(_0x37843c,_0xe837b2,_0x72dae4[_0xd31e('0xa8')],_0x72dae4['name'],_0x72dae4[_0xd31e('0xa9')],![]);_0x11bc09[_0xd31e('0xaa')](_0x2e5cde);});return Promise[_0xd31e('0xab')](_0x11bc09);})[_0xd31e('0x24')](function(_0x140242){_0x26b5c2=_0x140242;_0x4de25a=Object['assign']([],_0x2c5b6e);console[_0xd31e('0xac')](_0xd31e('0xad'),_0x2c5b6e);_['remove'](_0x4de25a,function(_0x32653b){return _0x30a188['includes'](_0x32653b['name']);});console[_0xd31e('0xac')]('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x4de25a);_0x11bc09=[];_0x4de25a[_0xd31e('0xae')](function(_0x59bb74){var _0x14c7fe=createFieldObject(_0x37843c,_0xe837b2,_0x59bb74[_0xd31e('0xa8')],_0x59bb74[_0xd31e('0x29')],_0x59bb74[_0xd31e('0xa9')],!![]);_0x11bc09[_0xd31e('0xaa')](_0x14c7fe);});return Promise[_0xd31e('0xab')](_0x11bc09);})[_0xd31e('0x24')](function(_0x327708){_0x1ecdc4=_0x327708;var _0x566a92=_0x26b5c2[_0xd31e('0xaf')](_0x1ecdc4);return{'count':_0x566a92['length'],'rows':_0x566a92};})[_0xd31e('0x24')](respondWithResult(_0x265eab,null))['catch'](function(_0xcb150d){console[_0xd31e('0xac')]('ServiceNow\x20error:\x20'+_0xcb150d);var _0xb2831b=_0x5bf63d[_0xd31e('0x33')]['test']?0x1f4:_0xcb150d[_0xd31e('0xb0')]||0x1f4;logger[_0xd31e('0x27')](_0xcb150d[_0xd31e('0x28')]);delete _0xcb150d[_0xd31e('0x29')];if(_0xb2831b===0x191){_0xb2831b=0x190;}_0x265eab[_0xd31e('0x18')](_0xb2831b)[_0xd31e('0x2a')](_0x5bf63d[_0xd31e('0x33')]['test']?{'message':_0xd31e('0xb1'),'statusCode':_0xcb150d[_0xd31e('0xb0')]}:_0xcb150d);});};function createFieldObject(_0x2a9172,_0x24d497,_0x41fec4,_0x4f812a,_0x125d4f,_0x294760){return new Promise(function(_0x4ccc61,_0x45f72e){var _0x6527e1={'id':_0x4f812a,'name':_0x125d4f,'custom':_0x294760};if(_0x41fec4===_0xd31e('0xb2')){_0x6527e1['options']=[{'name':_0xd31e('0xb3'),'value':_0xd31e('0xb4')},{'name':_0xd31e('0xb5'),'value':_0xd31e('0xb6')}];_0x4ccc61(_0x6527e1);}else{var _0x1a02bb={'method':_0xd31e('0xa1'),'uri':_0x2a9172+_0xd31e('0xb7')+_0x4f812a,'auth':_0x24d497,'json':!![]};return rp(_0x1a02bb)[_0xd31e('0x24')](function(_0xbf39cb){var _0x1f45a6=[];if(_0xbf39cb[_0xd31e('0xa3')]['length']>0x0){_0xbf39cb[_0xd31e('0xa3')][_0xd31e('0xae')](function(_0x4292eb){if(_0x4292eb[_0xd31e('0xb8')]===_0xd31e('0xb6')){var _0x122b95={'name':_0x4292eb[_0xd31e('0xa9')],'value':_0x4292eb['value']};_0x1f45a6[_0xd31e('0xaa')](_0x122b95);}});}_0x6527e1[_0xd31e('0x3f')]=_0x1f45a6;if(_0x6527e1[_0xd31e('0x3f')][_0xd31e('0x38')]>0x0){_0x4ccc61(_0x6527e1);}else{if(_0x294760==![]){_0x4ccc61();}else{_0x4ccc61(_0x6527e1);}}});}});} \ No newline at end of file +var _0xffd8=['incident?sysparm_display_value=all','result','log','assign','includes','forEach','internalType','label','push','all','TCL:\x20_object','remove','ServiceNow\x20error:\x20','test','statusCode','Wrong\x20credentials','true','False','false','inactive','value','rimraf','zip-dir','request-promise','moment','bluebird','util','sox','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','include','ServicenowAccount','findAll','catch','params','includeAll','options','create','body','find','getConfigurations','findOne','ServicenowConfiguration','order','Subjects','getSubjects','Descriptions','ServicenowField','getFields','hold_reason','notify','incident_state','severity','category','parent','made_sla','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','approval_history','number','resolved_by','sys_updated_by','user_input','sys_created_on','sys_domain','sys_created_by','calendar_stc','closed_at','cmdb_ci','delivery_plan','active','work_notes_list','priority','rfc','time_worked','expected_start','opened_at','business_duration','group_list','work_end','reopened_time','caller_id','approval_set','subcategory','work_notes','close_code','correlation_display','delivery_task','work_start','assignment_group','business_stc','calendar_duration','sys_class_name','close_notes','follow_up','parent_incident','contact_type','reopened_by','company','reassignment_count','activity_due','assigned_to','comments','sla_due','approval','sys_mod_count','reopen_count','sys_tags','upon_approval','correlation_id','location','email','remoteUri','slice','substring','lastIndexOf','%s/api/now/doc/table/schema/','format','%s/api/now/table/','username','password','GET'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xffd8,0xc8));var _0x8ffd=function(_0x4a372d,_0x3bd91f){_0x4a372d=_0x4a372d-0x0;var _0x546ac0=_0xffd8[_0x4a372d];return _0x546ac0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8ffd('0x0'));var zipdir=require(_0x8ffd('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8ffd('0x2'));var moment=require(_0x8ffd('0x3'));var BPromise=require(_0x8ffd('0x4'));var Mustache=require('mustache');var util=require(_0x8ffd('0x5'));var path=require('path');var sox=require(_0x8ffd('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8ffd('0x7'));var _=require('lodash');var squel=require(_0x8ffd('0x8'));var crypto=require(_0x8ffd('0x9'));var jsforce=require(_0x8ffd('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x8ffd('0xb'));var Papa=require(_0x8ffd('0xc'));var Redis=require(_0x8ffd('0xd'));var authService=require(_0x8ffd('0xe'));var qs=require(_0x8ffd('0xf'));var as=require(_0x8ffd('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8ffd('0x11'))('api');var utils=require(_0x8ffd('0x12'));var config=require(_0x8ffd('0x13'));var licenseUtil=require(_0x8ffd('0x14'));var db=require(_0x8ffd('0x15'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x19c264,_0x3cf6d2){_0x3cf6d2=_0x3cf6d2||0xcc;return function(_0xed49ac){if(_0xed49ac){return _0x19c264[_0x8ffd('0x16')](_0x3cf6d2);}return _0x19c264[_0x8ffd('0x17')](_0x3cf6d2)[_0x8ffd('0x18')]();};}function respondWithResult(_0x455053,_0x236570){_0x236570=_0x236570||0xc8;return function(_0xd68a78){if(_0xd68a78){return _0x455053[_0x8ffd('0x17')](_0x236570)[_0x8ffd('0x19')](_0xd68a78);}};}function respondWithFilteredResult(_0x37064f,_0x171aa4){return function(_0xca915f){if(_0xca915f){var _0x325341=typeof _0x171aa4[_0x8ffd('0x1a')]==='undefined'&&typeof _0x171aa4[_0x8ffd('0x1b')]===_0x8ffd('0x1c');var _0x5b5bb7=_0xca915f['count'];var _0x189816=_0x325341?0x0:_0x171aa4[_0x8ffd('0x1a')];var _0x4dd07e=_0x325341?_0xca915f[_0x8ffd('0x1d')]:_0x171aa4[_0x8ffd('0x1a')]+_0x171aa4[_0x8ffd('0x1b')];var _0xd39da;if(_0x4dd07e>=_0x5b5bb7){_0x4dd07e=_0x5b5bb7;_0xd39da=0xc8;}else{_0xd39da=0xce;}_0x37064f[_0x8ffd('0x17')](_0xd39da);return _0x37064f[_0x8ffd('0x1e')]('Content-Range',_0x189816+'-'+_0x4dd07e+'/'+_0x5b5bb7)[_0x8ffd('0x19')](_0xca915f);}return null;};}function patchUpdates(_0x30d247){return function(_0xfe2783){try{jsonpatch[_0x8ffd('0x1f')](_0xfe2783,_0x30d247,!![]);}catch(_0x53ca43){return BPromise[_0x8ffd('0x20')](_0x53ca43);}return _0xfe2783[_0x8ffd('0x21')]();};}function saveUpdates(_0x38559c,_0x5289d9){return function(_0x48788a){if(_0x48788a){return _0x48788a[_0x8ffd('0x22')](_0x38559c)[_0x8ffd('0x23')](function(_0x11e317){return _0x11e317;});}return null;};}function removeEntity(_0x23d50c,_0x25c1d4){return function(_0x55a283){if(_0x55a283){return _0x55a283[_0x8ffd('0x24')]()[_0x8ffd('0x23')](function(){_0x23d50c[_0x8ffd('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x175f7f,_0xfbee79){return function(_0xeefb17){if(!_0xeefb17){_0x175f7f[_0x8ffd('0x16')](0x194);}return _0xeefb17;};}function handleError(_0x170675,_0x3d17d9){_0x3d17d9=_0x3d17d9||0x1f4;return function(_0x37a25f){logger[_0x8ffd('0x25')](_0x37a25f[_0x8ffd('0x26')]);if(_0x37a25f[_0x8ffd('0x27')]){delete _0x37a25f[_0x8ffd('0x27')];}_0x170675[_0x8ffd('0x17')](_0x3d17d9)[_0x8ffd('0x28')](_0x37a25f);};}exports[_0x8ffd('0x29')]=function(_0x22a4e4,_0x3741d6){var _0x48d0ee={},_0x12bf03={},_0x5315ad={'count':0x0,'rows':[]};var _0x1276a7=_[_0x8ffd('0x2a')](db['ServicenowAccount'][_0x8ffd('0x2b')],function(_0x5c8a65){return{'name':_0x5c8a65[_0x8ffd('0x2c')],'type':_0x5c8a65[_0x8ffd('0x2d')][_0x8ffd('0x2e')]};});_0x12bf03['model']=_[_0x8ffd('0x2a')](_0x1276a7,_0x8ffd('0x27'));_0x12bf03[_0x8ffd('0x2f')]=_[_0x8ffd('0x30')](_0x22a4e4[_0x8ffd('0x2f')]);_0x12bf03[_0x8ffd('0x31')]=_[_0x8ffd('0x32')](_0x12bf03['model'],_0x12bf03[_0x8ffd('0x2f')]);_0x48d0ee[_0x8ffd('0x33')]=_[_0x8ffd('0x32')](_0x12bf03[_0x8ffd('0x34')],qs[_0x8ffd('0x35')](_0x22a4e4['query'][_0x8ffd('0x35')]));_0x48d0ee['attributes']=_0x48d0ee[_0x8ffd('0x33')][_0x8ffd('0x36')]?_0x48d0ee['attributes']:_0x12bf03[_0x8ffd('0x34')];if(!_0x22a4e4[_0x8ffd('0x2f')][_0x8ffd('0x37')](_0x8ffd('0x38'))){_0x48d0ee[_0x8ffd('0x1b')]=qs[_0x8ffd('0x1b')](_0x22a4e4['query'][_0x8ffd('0x1b')]);_0x48d0ee[_0x8ffd('0x1a')]=qs[_0x8ffd('0x1a')](_0x22a4e4[_0x8ffd('0x2f')]['offset']);}_0x48d0ee['order']=qs['sort'](_0x22a4e4[_0x8ffd('0x2f')][_0x8ffd('0x39')]);_0x48d0ee[_0x8ffd('0x3a')]=qs[_0x8ffd('0x31')](_[_0x8ffd('0x3b')](_0x22a4e4[_0x8ffd('0x2f')],_0x12bf03[_0x8ffd('0x31')]),_0x1276a7);if(_0x22a4e4[_0x8ffd('0x2f')][_0x8ffd('0x3c')]){_0x48d0ee['where']=_[_0x8ffd('0x3d')](_0x48d0ee['where'],{'$or':_[_0x8ffd('0x2a')](_0x1276a7,function(_0x3aa527){if(_0x3aa527[_0x8ffd('0x2d')]!==_0x8ffd('0x3e')){var _0x2405e1={};_0x2405e1[_0x3aa527[_0x8ffd('0x27')]]={'$like':'%'+_0x22a4e4[_0x8ffd('0x2f')][_0x8ffd('0x3c')]+'%'};return _0x2405e1;}})});}_0x48d0ee=_[_0x8ffd('0x3d')]({},_0x48d0ee,_0x22a4e4['options']);var _0x20d10c={'where':_0x48d0ee[_0x8ffd('0x3a')]};return db['ServicenowAccount'][_0x8ffd('0x1d')](_0x20d10c)[_0x8ffd('0x23')](function(_0x15b211){_0x5315ad[_0x8ffd('0x1d')]=_0x15b211;if(_0x22a4e4['query']['includeAll']){_0x48d0ee[_0x8ffd('0x3f')]=[{'all':!![]}];}return db[_0x8ffd('0x40')][_0x8ffd('0x41')](_0x48d0ee);})[_0x8ffd('0x23')](function(_0x2444fb){_0x5315ad['rows']=_0x2444fb;return _0x5315ad;})[_0x8ffd('0x23')](respondWithFilteredResult(_0x3741d6,_0x48d0ee))[_0x8ffd('0x42')](handleError(_0x3741d6,null));};exports['show']=function(_0x40b3d9,_0x15c7b4){var _0x1224ab={'raw':![],'where':{'id':_0x40b3d9[_0x8ffd('0x43')]['id']}},_0x1db29e={};_0x1db29e[_0x8ffd('0x34')]=_[_0x8ffd('0x30')](db[_0x8ffd('0x40')]['rawAttributes']);_0x1db29e[_0x8ffd('0x2f')]=_[_0x8ffd('0x30')](_0x40b3d9[_0x8ffd('0x2f')]);_0x1db29e[_0x8ffd('0x31')]=_[_0x8ffd('0x32')](_0x1db29e[_0x8ffd('0x34')],_0x1db29e[_0x8ffd('0x2f')]);_0x1224ab[_0x8ffd('0x33')]=_[_0x8ffd('0x32')](_0x1db29e[_0x8ffd('0x34')],qs[_0x8ffd('0x35')](_0x40b3d9[_0x8ffd('0x2f')][_0x8ffd('0x35')]));_0x1224ab[_0x8ffd('0x33')]=_0x1224ab[_0x8ffd('0x33')]['length']?_0x1224ab[_0x8ffd('0x33')]:_0x1db29e[_0x8ffd('0x34')];if(_0x40b3d9['query'][_0x8ffd('0x44')]){_0x1224ab['include']=[{'all':!![]}];}_0x1224ab=_[_0x8ffd('0x3d')]({},_0x1224ab,_0x40b3d9[_0x8ffd('0x45')]);return db[_0x8ffd('0x40')]['find'](_0x1224ab)[_0x8ffd('0x23')](handleEntityNotFound(_0x15c7b4,null))[_0x8ffd('0x23')](respondWithResult(_0x15c7b4,null))[_0x8ffd('0x42')](handleError(_0x15c7b4,null));};exports[_0x8ffd('0x46')]=function(_0xa7dd0,_0x204e52){return db[_0x8ffd('0x40')][_0x8ffd('0x46')](_0xa7dd0[_0x8ffd('0x47')],{})[_0x8ffd('0x23')](respondWithResult(_0x204e52,0xc9))[_0x8ffd('0x42')](handleError(_0x204e52,null));};exports[_0x8ffd('0x22')]=function(_0x4c818e,_0x56507){if(_0x4c818e['body']['id']){delete _0x4c818e[_0x8ffd('0x47')]['id'];}return db[_0x8ffd('0x40')]['find']({'where':{'id':_0x4c818e[_0x8ffd('0x43')]['id']}})['then'](handleEntityNotFound(_0x56507,null))['then'](saveUpdates(_0x4c818e[_0x8ffd('0x47')],null))[_0x8ffd('0x23')](respondWithResult(_0x56507,null))[_0x8ffd('0x42')](handleError(_0x56507,null));};exports['destroy']=function(_0x2e4ffe,_0x2038bc){return db[_0x8ffd('0x40')][_0x8ffd('0x48')]({'where':{'id':_0x2e4ffe[_0x8ffd('0x43')]['id']}})[_0x8ffd('0x23')](handleEntityNotFound(_0x2038bc,null))['then'](removeEntity(_0x2038bc,null))['catch'](handleError(_0x2038bc,null));};exports[_0x8ffd('0x49')]=function(_0x179ed0,_0x2f3f67,_0x33c3bd){var _0x448bce={};var _0xef08e8={};var _0x7c6eee;var _0x458a46;return db[_0x8ffd('0x40')][_0x8ffd('0x4a')]({'where':{'id':_0x179ed0['params']['id']}})['then'](handleEntityNotFound(_0x2f3f67,null))[_0x8ffd('0x23')](function(_0x24a875){if(_0x24a875){_0x7c6eee=_0x24a875;_0xef08e8[_0x8ffd('0x34')]=_[_0x8ffd('0x30')](db[_0x8ffd('0x4b')][_0x8ffd('0x2b')]);_0xef08e8[_0x8ffd('0x2f')]=_[_0x8ffd('0x30')](_0x179ed0[_0x8ffd('0x2f')]);_0xef08e8[_0x8ffd('0x31')]=_[_0x8ffd('0x32')](_0xef08e8[_0x8ffd('0x34')],_0xef08e8[_0x8ffd('0x2f')]);_0x448bce['attributes']=_['intersection'](_0xef08e8['model'],qs[_0x8ffd('0x35')](_0x179ed0[_0x8ffd('0x2f')][_0x8ffd('0x35')]));_0x448bce[_0x8ffd('0x33')]=_0x448bce[_0x8ffd('0x33')][_0x8ffd('0x36')]?_0x448bce['attributes']:_0xef08e8[_0x8ffd('0x34')];_0x448bce[_0x8ffd('0x4c')]=qs['sort'](_0x179ed0['query'][_0x8ffd('0x39')]);_0x448bce[_0x8ffd('0x3a')]=qs[_0x8ffd('0x31')](_['pick'](_0x179ed0[_0x8ffd('0x2f')],_0xef08e8['filters']));if(_0x179ed0[_0x8ffd('0x2f')][_0x8ffd('0x3c')]){_0x448bce[_0x8ffd('0x3a')]=_[_0x8ffd('0x3d')](_0x448bce[_0x8ffd('0x3a')],{'$or':_[_0x8ffd('0x2a')](_0x448bce[_0x8ffd('0x33')],function(_0x52fa5b){var _0x2275bf={};_0x2275bf[_0x52fa5b]={'$like':'%'+_0x179ed0[_0x8ffd('0x2f')]['filter']+'%'};return _0x2275bf;})});}_0x448bce=_[_0x8ffd('0x3d')]({},_0x448bce,_0x179ed0['options']);return _0x7c6eee[_0x8ffd('0x49')](_0x448bce);}})['then'](function(_0x400719){if(_0x400719){_0x458a46=_0x400719['length'];if(!_0x179ed0[_0x8ffd('0x2f')][_0x8ffd('0x37')](_0x8ffd('0x38'))){_0x448bce['limit']=qs[_0x8ffd('0x1b')](_0x179ed0['query'][_0x8ffd('0x1b')]);_0x448bce['offset']=qs[_0x8ffd('0x1a')](_0x179ed0[_0x8ffd('0x2f')][_0x8ffd('0x1a')]);}return _0x7c6eee[_0x8ffd('0x49')](_0x448bce);}})['then'](function(_0x4f965a){if(_0x4f965a){return _0x4f965a?{'count':_0x458a46,'rows':_0x4f965a}:null;}})[_0x8ffd('0x23')](respondWithResult(_0x2f3f67,null))[_0x8ffd('0x42')](handleError(_0x2f3f67,null));};exports['addConfiguration']=function(_0x3a4dba,_0x18a23d,_0x22edf5){if(_0x3a4dba[_0x8ffd('0x47')]['id']){delete _0x3a4dba[_0x8ffd('0x47')]['id'];}return db[_0x8ffd('0x40')][_0x8ffd('0x4a')]({'where':{'id':_0x3a4dba[_0x8ffd('0x43')]['id']}})[_0x8ffd('0x23')](handleEntityNotFound(_0x18a23d,null))[_0x8ffd('0x23')](function(_0x249630){if(_0x249630){_0x3a4dba[_0x8ffd('0x47')]['AccountId']=_0x249630['id'];_0x3a4dba[_0x8ffd('0x47')][_0x8ffd('0x4d')]=integrations[_0x8ffd('0x4e')](_0x3a4dba[_0x8ffd('0x47')]['channel'],_0x3a4dba[_0x8ffd('0x47')][_0x8ffd('0x2d')]);_0x3a4dba['body'][_0x8ffd('0x4f')]=integrations['getDescriptions'](_0x3a4dba[_0x8ffd('0x47')]['channel'],_0x3a4dba[_0x8ffd('0x47')]['type']);return db[_0x8ffd('0x4b')][_0x8ffd('0x46')](_0x3a4dba['body'],{'include':[{'model':db[_0x8ffd('0x50')],'as':_0x8ffd('0x4d')},{'model':db[_0x8ffd('0x50')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x18a23d,null))['catch'](handleError(_0x18a23d,null));};exports[_0x8ffd('0x51')]=function(_0xdd66a6,_0x21119e,_0x49bb3f){var _0x34c84b=['made_sla',_0x8ffd('0x52'),'knowledge','subcategory','close_code',_0x8ffd('0x53'),_0x8ffd('0x54'),_0x8ffd('0x55'),_0x8ffd('0x56')];var _0x46d220=[_0x8ffd('0x57'),_0x8ffd('0x58'),_0x8ffd('0x59'),_0x8ffd('0x5a'),_0x8ffd('0x5b'),_0x8ffd('0x5c'),_0x8ffd('0x5d'),_0x8ffd('0x52'),_0x8ffd('0x5e'),_0x8ffd('0x5f'),_0x8ffd('0x60'),_0x8ffd('0x61'),'opened_by',_0x8ffd('0x62'),_0x8ffd('0x63'),_0x8ffd('0x64'),'state',_0x8ffd('0x65'),'knowledge',_0x8ffd('0x4c'),_0x8ffd('0x66'),_0x8ffd('0x67'),_0x8ffd('0x68'),_0x8ffd('0x69'),'impact',_0x8ffd('0x6a'),_0x8ffd('0x6b'),'business_service',_0x8ffd('0x6c'),'sys_domain_path',_0x8ffd('0x6d'),_0x8ffd('0x6e'),_0x8ffd('0x6f'),_0x8ffd('0x70'),_0x8ffd('0x71'),_0x8ffd('0x72'),_0x8ffd('0x73'),_0x8ffd('0x74'),'resolved_at',_0x8ffd('0x75'),_0x8ffd('0x76'),_0x8ffd('0x77'),_0x8ffd('0x78'),'short_description',_0x8ffd('0x79'),_0x8ffd('0x7a'),_0x8ffd('0x7b'),_0x8ffd('0x7c'),_0x8ffd('0x7d'),_0x8ffd('0x7e'),'additional_assignee_list','description',_0x8ffd('0x7f'),'notify',_0x8ffd('0x80'),_0x8ffd('0x81'),'closed_by',_0x8ffd('0x82'),_0x8ffd('0x83'),'sys_id',_0x8ffd('0x84'),_0x8ffd('0x85'),'incident_state','urgency','problem_id',_0x8ffd('0x86'),_0x8ffd('0x87'),_0x8ffd('0x88'),_0x8ffd('0x89'),_0x8ffd('0x55'),_0x8ffd('0x8a'),_0x8ffd('0x8b'),_0x8ffd('0x8c'),'comments_and_work_notes','due_date',_0x8ffd('0x8d'),_0x8ffd('0x8e'),_0x8ffd('0x8f'),'escalation',_0x8ffd('0x90'),_0x8ffd('0x91'),_0x8ffd('0x92'),_0x8ffd('0x56')];var _0xc17a5a='';var _0x3ee14d='';var _0x373075=[];var _0x438007='';var _0x52baea='';var _0x213662=[];var _0x4b7e44='';var _0xfb7cc7='';var _0x264981={};var _0x1a06be='';return db['ServicenowAccount'][_0x8ffd('0x4a')]({'where':{'id':_0xdd66a6[_0x8ffd('0x43')]['id']},'attributes':['id','username','password',_0x8ffd('0x93'),_0x8ffd('0x94'),'serverUrl']})['then'](handleEntityNotFound(_0x21119e,null))[_0x8ffd('0x23')](function(_0x25b603){if(_0x25b603){_0x1a06be=_0x25b603[_0x8ffd('0x94')];var _0x1c4870=_0x1a06be[_0x8ffd('0x95')](-0x1);if(_0x1c4870==='/'){_0x1a06be=_0x1a06be[_0x8ffd('0x96')](0x0,_0x1a06be[_0x8ffd('0x97')](_0x1c4870));}_0xfb7cc7=util['format'](_0x8ffd('0x98'),_0x1a06be);_0x4b7e44=util[_0x8ffd('0x99')](_0x8ffd('0x9a'),_0x1a06be);_0x264981={'user':_0x25b603[_0x8ffd('0x9b')],'pass':_0x25b603[_0x8ffd('0x9c')]};var _0x5c1d55={'method':_0x8ffd('0x9d'),'uri':_0xfb7cc7+_0x8ffd('0x9e'),'auth':_0x264981,'json':!![]};return rp(_0x5c1d55);}})[_0x8ffd('0x23')](function(_0xba8add){if(_0xba8add[_0x8ffd('0x9f')][_0x8ffd('0x36')]>0x0){_0xc17a5a=_0xba8add[_0x8ffd('0x9f')];}console[_0x8ffd('0xa0')]('incident\x20table\x20objects',_0xc17a5a);_0x213662=[];_0x3ee14d=Object[_0x8ffd('0xa1')]([],_0xc17a5a);_['remove'](_0x3ee14d,function(_0xc929a3){return!_0x34c84b[_0x8ffd('0xa2')](_0xc929a3[_0x8ffd('0x27')]);});_0x3ee14d[_0x8ffd('0xa3')](function(_0x45ee33){var _0x16ff55=createFieldObject(_0x4b7e44,_0x264981,_0x45ee33[_0x8ffd('0xa4')],_0x45ee33['name'],_0x45ee33[_0x8ffd('0xa5')],![]);_0x213662[_0x8ffd('0xa6')](_0x16ff55);});return Promise[_0x8ffd('0xa7')](_0x213662);})[_0x8ffd('0x23')](function(_0x159b06){_0x373075=_0x159b06;_0x438007=Object[_0x8ffd('0xa1')]([],_0xc17a5a);console[_0x8ffd('0xa0')](_0x8ffd('0xa8'),_0xc17a5a);_[_0x8ffd('0xa9')](_0x438007,function(_0x305784){return _0x46d220[_0x8ffd('0xa2')](_0x305784[_0x8ffd('0x27')]);});console[_0x8ffd('0xa0')]('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x438007);_0x213662=[];_0x438007['forEach'](function(_0x332cb1){var _0x5504db=createFieldObject(_0x4b7e44,_0x264981,_0x332cb1['internalType'],_0x332cb1['name'],_0x332cb1[_0x8ffd('0xa5')],!![]);_0x213662[_0x8ffd('0xa6')](_0x5504db);});return Promise[_0x8ffd('0xa7')](_0x213662);})[_0x8ffd('0x23')](function(_0x51f9b6){_0x52baea=_0x51f9b6;var _0x41be8f=_0x373075['concat'](_0x52baea);return{'count':_0x41be8f[_0x8ffd('0x36')],'rows':_0x41be8f};})[_0x8ffd('0x23')](respondWithResult(_0x21119e,null))[_0x8ffd('0x42')](function(_0x40d183){console[_0x8ffd('0xa0')](_0x8ffd('0xaa')+_0x40d183);var _0x3aa1a6=_0xdd66a6[_0x8ffd('0x2f')][_0x8ffd('0xab')]?0x1f4:_0x40d183[_0x8ffd('0xac')]||0x1f4;logger[_0x8ffd('0x25')](_0x40d183[_0x8ffd('0x26')]);delete _0x40d183[_0x8ffd('0x27')];if(_0x3aa1a6===0x191){_0x3aa1a6=0x190;}_0x21119e[_0x8ffd('0x17')](_0x3aa1a6)[_0x8ffd('0x28')](_0xdd66a6[_0x8ffd('0x2f')][_0x8ffd('0xab')]?{'message':_0x8ffd('0xad'),'statusCode':_0x40d183['statusCode']}:_0x40d183);});};function createFieldObject(_0xb66230,_0x4dda2e,_0x53d35c,_0x345c5e,_0x1a12f2,_0x2e7f63){return new Promise(function(_0x48ee3e,_0x2cb1b3){var _0x4da23b={'id':_0x345c5e,'name':_0x1a12f2,'custom':_0x2e7f63};if(_0x53d35c==='boolean'){_0x4da23b[_0x8ffd('0x45')]=[{'name':'True','value':_0x8ffd('0xae')},{'name':_0x8ffd('0xaf'),'value':_0x8ffd('0xb0')}];_0x48ee3e(_0x4da23b);}else{var _0x251798={'method':'GET','uri':_0xb66230+'sys_choice?sysparm_query=name=incident^element='+_0x345c5e,'auth':_0x4dda2e,'json':!![]};return rp(_0x251798)[_0x8ffd('0x23')](function(_0x555a2a){var _0x862c6d=[];if(_0x555a2a[_0x8ffd('0x9f')][_0x8ffd('0x36')]>0x0){_0x555a2a[_0x8ffd('0x9f')]['forEach'](function(_0x284da9){if(_0x284da9[_0x8ffd('0xb1')]===_0x8ffd('0xb0')){var _0xaa6094={'name':_0x284da9[_0x8ffd('0xa5')],'value':_0x284da9[_0x8ffd('0xb2')]};_0x862c6d['push'](_0xaa6094);}});}_0x4da23b['options']=_0x862c6d;if(_0x4da23b[_0x8ffd('0x45')][_0x8ffd('0x36')]>0x0){_0x48ee3e(_0x4da23b);}else{if(_0x2e7f63==![]){_0x48ee3e();}else{_0x48ee3e(_0x4da23b);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index b15d69c..a80ecb4 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 _0xe2fe=['define','int_servicenow_accounts','lodash','api','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports'];(function(_0xe11c54,_0x389280){var _0x476a3f=function(_0x1f25b7){while(--_0x1f25b7){_0xe11c54['push'](_0xe11c54['shift']());}};_0x476a3f(++_0x389280);}(_0xe2fe,0x86));var _0xee2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe2fe[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xee2f('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xee2f('0x1'));var moment=require('moment');var BPromise=require(_0xee2f('0x2'));var rp=require(_0xee2f('0x3'));var fs=require('fs');var path=require(_0xee2f('0x4'));var rimraf=require(_0xee2f('0x5'));var config=require(_0xee2f('0x6'));var attributes=require('./intServicenowAccount.attributes');var integrations=require(_0xee2f('0x7'));module[_0xee2f('0x8')]=function(_0x49926b,_0x1533a0){return _0x49926b[_0xee2f('0x9')]('ServicenowAccount',attributes,{'tableName':_0xee2f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5fab=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','ServicenowAccount','int_servicenow_accounts'];(function(_0x33f750,_0x3a0638){var _0xd2186a=function(_0x20b011){while(--_0x20b011){_0x33f750['push'](_0x33f750['shift']());}};_0xd2186a(++_0x3a0638);}(_0x5fab,0x177));var _0xb5fa=function(_0x2c7516,_0x2ca7f1){_0x2c7516=_0x2c7516-0x0;var _0x1d76a2=_0x5fab[_0x2c7516];return _0x1d76a2;};'use strict';var _=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var logger=require('../../config/logger')(_0xb5fa('0x2'));var moment=require(_0xb5fa('0x3'));var BPromise=require(_0xb5fa('0x4'));var rp=require(_0xb5fa('0x5'));var fs=require('fs');var path=require(_0xb5fa('0x6'));var rimraf=require(_0xb5fa('0x7'));var config=require(_0xb5fa('0x8'));var attributes=require(_0xb5fa('0x9'));var integrations=require(_0xb5fa('0xa'));module[_0xb5fa('0xb')]=function(_0x4a0249,_0x5d70f6){return _0x4a0249[_0xb5fa('0xc')](_0xb5fa('0xd'),attributes,{'tableName':_0xb5fa('0xe'),'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 e53c2ee..ed3a62e 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 _0x86e5=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetServicenowAccount','ServicenowAccount','options','where','attributes','include','model','map','then','ShowServicenowAccount','find','raw','util'];(function(_0x51bd64,_0x1c8850){var _0x2c7ee4=function(_0x20d60e){while(--_0x20d60e){_0x51bd64['push'](_0x51bd64['shift']());}};_0x2c7ee4(++_0x1c8850);}(_0x86e5,0x15d));var _0x586e=function(_0x472862,_0x56d13d){_0x472862=_0x472862-0x0;var _0x2db55f=_0x86e5[_0x472862];return _0x2db55f;};'use strict';var _=require('lodash');var util=require(_0x586e('0x0'));var moment=require(_0x586e('0x1'));var BPromise=require(_0x586e('0x2'));var rs=require(_0x586e('0x3'));var fs=require('fs');var Redis=require(_0x586e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x586e('0x5'));var logger=require(_0x586e('0x6'))(_0x586e('0x7'));var config=require('../../config/environment');var jayson=require(_0x586e('0x8'));var client=jayson[_0x586e('0x9')][_0x586e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5916c9,_0x18727a,_0x664dac){return new BPromise(function(_0x35578e,_0x4a6b15){return client[_0x586e('0xb')](_0x5916c9,_0x664dac)['then'](function(_0x1617bb){logger[_0x586e('0xc')](_0x586e('0xd'),_0x18727a,_0x586e('0xe'));logger[_0x586e('0xf')](_0x586e('0x10'),_0x18727a,_0x586e('0xe'),JSON[_0x586e('0x11')](_0x1617bb));if(_0x1617bb[_0x586e('0x12')]){if(_0x1617bb['error'][_0x586e('0x13')]===0x1f4){logger[_0x586e('0x12')](_0x586e('0xd'),_0x18727a,_0x1617bb[_0x586e('0x12')]['message']);return _0x4a6b15(_0x1617bb[_0x586e('0x12')][_0x586e('0x14')]);}logger[_0x586e('0x12')](_0x586e('0xd'),_0x18727a,_0x1617bb[_0x586e('0x12')][_0x586e('0x14')]);return _0x35578e(_0x1617bb['error']['message']);}else{logger[_0x586e('0xc')](_0x586e('0xd'),_0x18727a,_0x586e('0xe'));_0x35578e(_0x1617bb[_0x586e('0x15')][_0x586e('0x14')]);}})[_0x586e('0x16')](function(_0x2aeeac){logger[_0x586e('0x12')](_0x586e('0xd'),_0x18727a,_0x2aeeac);_0x4a6b15(_0x2aeeac);});});}exports[_0x586e('0x17')]=function(_0x1f739a){var _0x100fc1=this;return new Promise(function(_0x2a8c43,_0x2e1bc1){return db[_0x586e('0x18')]['findAll']({'raw':_0x1f739a[_0x586e('0x19')]?_0x1f739a[_0x586e('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x1f739a['options']?_0x1f739a[_0x586e('0x19')][_0x586e('0x1a')]||null:null,'attributes':_0x1f739a[_0x586e('0x19')]?_0x1f739a[_0x586e('0x19')][_0x586e('0x1b')]||null:null,'limit':_0x1f739a['options']?_0x1f739a[_0x586e('0x19')]['limit']||null:null,'include':_0x1f739a['options']?_0x1f739a[_0x586e('0x19')][_0x586e('0x1c')]?_['map'](_0x1f739a['options']['include'],function(_0x2eebad){return{'model':db[_0x2eebad[_0x586e('0x1d')]],'as':_0x2eebad['as'],'attributes':_0x2eebad[_0x586e('0x1b')],'include':_0x2eebad['include']?_[_0x586e('0x1e')](_0x2eebad['include'],function(_0xa5a5c3){return{'model':db[_0xa5a5c3[_0x586e('0x1d')]],'as':_0xa5a5c3['as'],'attributes':_0xa5a5c3[_0x586e('0x1b')],'include':_0xa5a5c3[_0x586e('0x1c')]?_[_0x586e('0x1e')](_0xa5a5c3[_0x586e('0x1c')],function(_0x5eeb34){return{'model':db[_0x5eeb34[_0x586e('0x1d')]],'as':_0x5eeb34['as'],'attributes':_0x5eeb34[_0x586e('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x586e('0x1f')](function(_0x2f5687){logger[_0x586e('0xc')](_0x586e('0x17'),_0x1f739a);logger[_0x586e('0xf')](_0x586e('0x17'),_0x1f739a,JSON[_0x586e('0x11')](_0x2f5687));_0x2a8c43(_0x2f5687);})[_0x586e('0x16')](function(_0x586cd8){logger[_0x586e('0x12')](_0x586e('0x17'),_0x586cd8[_0x586e('0x14')],_0x1f739a);_0x2e1bc1(_0x100fc1['error'](0x1f4,_0x586cd8[_0x586e('0x14')]));});});};exports[_0x586e('0x20')]=function(_0x2c35b8){var _0x5a26c0=this;return new Promise(function(_0x37665f,_0x53a437){return db[_0x586e('0x18')][_0x586e('0x21')]({'raw':_0x2c35b8[_0x586e('0x19')]?_0x2c35b8[_0x586e('0x19')][_0x586e('0x22')]===undefined?!![]:![]:!![],'where':_0x2c35b8['options']?_0x2c35b8[_0x586e('0x19')][_0x586e('0x1a')]||null:null,'attributes':_0x2c35b8[_0x586e('0x19')]?_0x2c35b8['options'][_0x586e('0x1b')]||null:null,'include':_0x2c35b8[_0x586e('0x19')]?_0x2c35b8['options'][_0x586e('0x1c')]?_[_0x586e('0x1e')](_0x2c35b8['options'][_0x586e('0x1c')],function(_0x3785fb){return{'model':db[_0x3785fb[_0x586e('0x1d')]],'as':_0x3785fb['as'],'attributes':_0x3785fb[_0x586e('0x1b')],'include':_0x3785fb[_0x586e('0x1c')]?_['map'](_0x3785fb[_0x586e('0x1c')],function(_0x5842fe){return{'model':db[_0x5842fe[_0x586e('0x1d')]],'as':_0x5842fe['as'],'attributes':_0x5842fe[_0x586e('0x1b')],'include':_0x5842fe['include']?_[_0x586e('0x1e')](_0x5842fe[_0x586e('0x1c')],function(_0x2514b0){return{'model':db[_0x2514b0[_0x586e('0x1d')]],'as':_0x2514b0['as'],'attributes':_0x2514b0[_0x586e('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x586e('0x1f')](function(_0x372af4){logger[_0x586e('0xc')](_0x586e('0x20'),_0x2c35b8);logger[_0x586e('0xf')]('ShowServicenowAccount',_0x2c35b8,JSON[_0x586e('0x11')](_0x372af4));_0x37665f(_0x372af4);})[_0x586e('0x16')](function(_0x5bf2ec){logger['error'](_0x586e('0x20'),_0x5bf2ec[_0x586e('0x14')],_0x2c35b8);_0x53a437(_0x5a26c0[_0x586e('0x12')](0x1f4,_0x5bf2ec['message']));});});}; \ No newline at end of file +var _0xed33=['moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','GetServicenowAccount','ServicenowAccount','findAll','options','raw','where','attributes','limit','include','map','model','ShowServicenowAccount','find','debug','catch','lodash','util'];(function(_0x222a1b,_0x393ca1){var _0x392a7b=function(_0x3e0583){while(--_0x3e0583){_0x222a1b['push'](_0x222a1b['shift']());}};_0x392a7b(++_0x393ca1);}(_0xed33,0xfa));var _0x3ed3=function(_0x5af361,_0x416f6a){_0x5af361=_0x5af361-0x0;var _0x32dc35=_0xed33[_0x5af361];return _0x32dc35;};'use strict';var _=require(_0x3ed3('0x0'));var util=require(_0x3ed3('0x1'));var moment=require(_0x3ed3('0x2'));var BPromise=require(_0x3ed3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3ed3('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3ed3('0x5'));var logger=require(_0x3ed3('0x6'))(_0x3ed3('0x7'));var config=require(_0x3ed3('0x8'));var jayson=require(_0x3ed3('0x9'));var client=jayson[_0x3ed3('0xa')][_0x3ed3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3811d2,_0x365656,_0x1a39c4){return new BPromise(function(_0x203f24,_0x1ed99e){return client[_0x3ed3('0xc')](_0x3811d2,_0x1a39c4)[_0x3ed3('0xd')](function(_0x3b67c6){logger[_0x3ed3('0xe')](_0x3ed3('0xf'),_0x365656,_0x3ed3('0x10'));logger['debug'](_0x3ed3('0x11'),_0x365656,_0x3ed3('0x10'),JSON[_0x3ed3('0x12')](_0x3b67c6));if(_0x3b67c6['error']){if(_0x3b67c6[_0x3ed3('0x13')]['code']===0x1f4){logger[_0x3ed3('0x13')](_0x3ed3('0xf'),_0x365656,_0x3b67c6[_0x3ed3('0x13')]['message']);return _0x1ed99e(_0x3b67c6[_0x3ed3('0x13')][_0x3ed3('0x14')]);}logger[_0x3ed3('0x13')]('ServicenowAccount,\x20%s,\x20%s',_0x365656,_0x3b67c6[_0x3ed3('0x13')][_0x3ed3('0x14')]);return _0x203f24(_0x3b67c6[_0x3ed3('0x13')][_0x3ed3('0x14')]);}else{logger[_0x3ed3('0xe')](_0x3ed3('0xf'),_0x365656,_0x3ed3('0x10'));_0x203f24(_0x3b67c6['result'][_0x3ed3('0x14')]);}})['catch'](function(_0x250d8f){logger[_0x3ed3('0x13')](_0x3ed3('0xf'),_0x365656,_0x250d8f);_0x1ed99e(_0x250d8f);});});}exports[_0x3ed3('0x15')]=function(_0x1b121d){var _0x7647ca=this;return new Promise(function(_0x2149e4,_0x22cfbd){return db[_0x3ed3('0x16')][_0x3ed3('0x17')]({'raw':_0x1b121d[_0x3ed3('0x18')]?_0x1b121d[_0x3ed3('0x18')][_0x3ed3('0x19')]===undefined?!![]:![]:!![],'where':_0x1b121d['options']?_0x1b121d[_0x3ed3('0x18')][_0x3ed3('0x1a')]||null:null,'attributes':_0x1b121d[_0x3ed3('0x18')]?_0x1b121d[_0x3ed3('0x18')][_0x3ed3('0x1b')]||null:null,'limit':_0x1b121d['options']?_0x1b121d[_0x3ed3('0x18')][_0x3ed3('0x1c')]||null:null,'include':_0x1b121d[_0x3ed3('0x18')]?_0x1b121d[_0x3ed3('0x18')][_0x3ed3('0x1d')]?_[_0x3ed3('0x1e')](_0x1b121d['options'][_0x3ed3('0x1d')],function(_0x5c9475){return{'model':db[_0x5c9475[_0x3ed3('0x1f')]],'as':_0x5c9475['as'],'attributes':_0x5c9475[_0x3ed3('0x1b')],'include':_0x5c9475[_0x3ed3('0x1d')]?_[_0x3ed3('0x1e')](_0x5c9475[_0x3ed3('0x1d')],function(_0x1d40a1){return{'model':db[_0x1d40a1['model']],'as':_0x1d40a1['as'],'attributes':_0x1d40a1[_0x3ed3('0x1b')],'include':_0x1d40a1[_0x3ed3('0x1d')]?_[_0x3ed3('0x1e')](_0x1d40a1[_0x3ed3('0x1d')],function(_0x357ae7){return{'model':db[_0x357ae7['model']],'as':_0x357ae7['as'],'attributes':_0x357ae7['attributes']};}):[]};}):[]};}):[]:[]})[_0x3ed3('0xd')](function(_0x555c05){logger[_0x3ed3('0xe')](_0x3ed3('0x15'),_0x1b121d);logger['debug'](_0x3ed3('0x15'),_0x1b121d,JSON[_0x3ed3('0x12')](_0x555c05));_0x2149e4(_0x555c05);})['catch'](function(_0x2f3645){logger[_0x3ed3('0x13')]('GetServicenowAccount',_0x2f3645['message'],_0x1b121d);_0x22cfbd(_0x7647ca[_0x3ed3('0x13')](0x1f4,_0x2f3645['message']));});});};exports[_0x3ed3('0x20')]=function(_0x1d3970){var _0x398dec=this;return new Promise(function(_0x5add93,_0x11e56d){return db[_0x3ed3('0x16')][_0x3ed3('0x21')]({'raw':_0x1d3970['options']?_0x1d3970[_0x3ed3('0x18')][_0x3ed3('0x19')]===undefined?!![]:![]:!![],'where':_0x1d3970[_0x3ed3('0x18')]?_0x1d3970[_0x3ed3('0x18')][_0x3ed3('0x1a')]||null:null,'attributes':_0x1d3970[_0x3ed3('0x18')]?_0x1d3970['options']['attributes']||null:null,'include':_0x1d3970[_0x3ed3('0x18')]?_0x1d3970[_0x3ed3('0x18')][_0x3ed3('0x1d')]?_[_0x3ed3('0x1e')](_0x1d3970[_0x3ed3('0x18')]['include'],function(_0x1be3cf){return{'model':db[_0x1be3cf[_0x3ed3('0x1f')]],'as':_0x1be3cf['as'],'attributes':_0x1be3cf[_0x3ed3('0x1b')],'include':_0x1be3cf['include']?_[_0x3ed3('0x1e')](_0x1be3cf['include'],function(_0x3c7b8d){return{'model':db[_0x3c7b8d[_0x3ed3('0x1f')]],'as':_0x3c7b8d['as'],'attributes':_0x3c7b8d['attributes'],'include':_0x3c7b8d['include']?_[_0x3ed3('0x1e')](_0x3c7b8d[_0x3ed3('0x1d')],function(_0x4cb713){return{'model':db[_0x4cb713[_0x3ed3('0x1f')]],'as':_0x4cb713['as'],'attributes':_0x4cb713[_0x3ed3('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x3ed3('0xd')](function(_0x3f9858){logger['info'](_0x3ed3('0x20'),_0x1d3970);logger[_0x3ed3('0x22')](_0x3ed3('0x20'),_0x1d3970,JSON[_0x3ed3('0x12')](_0x3f9858));_0x5add93(_0x3f9858);})[_0x3ed3('0x23')](function(_0x5c8b0c){logger[_0x3ed3('0x13')]('ShowServicenowAccount',_0x5c8b0c[_0x3ed3('0x14')],_0x1d3970);_0x11e56d(_0x398dec[_0x3ed3('0x13')](0x1f4,_0x5c8b0c[_0x3ed3('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 74af9fe..35d75ba 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 _0xf818=['getDescriptions','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions'];(function(_0x44ae0b,_0x3e9865){var _0x69232a=function(_0x5ae588){while(--_0x5ae588){_0x44ae0b['push'](_0x44ae0b['shift']());}};_0x69232a(++_0x3e9865);}(_0xf818,0xa7));var _0x8f81=function(_0xdcdcf5,_0x4ed0d6){_0xdcdcf5=_0xdcdcf5-0x0;var _0x17e2ce=_0xf818[_0xdcdcf5];return _0x17e2ce;};'use strict';var multer=require(_0x8f81('0x0'));var util=require('util');var path=require(_0x8f81('0x1'));var timeout=require(_0x8f81('0x2'));var express=require(_0x8f81('0x3'));var router=express[_0x8f81('0x4')]();var fs_extra=require(_0x8f81('0x5'));var auth=require(_0x8f81('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intServicenowConfiguration.controller');router[_0x8f81('0x7')]('/',auth[_0x8f81('0x8')](),controller[_0x8f81('0x9')]);router['get'](_0x8f81('0xa'),auth[_0x8f81('0x8')](),controller[_0x8f81('0xb')]);router['get'](_0x8f81('0xc'),auth[_0x8f81('0x8')](),controller[_0x8f81('0xd')]);router[_0x8f81('0x7')](_0x8f81('0xe'),auth['isAuthenticated'](),controller[_0x8f81('0xf')]);router[_0x8f81('0x7')](_0x8f81('0x10'),auth[_0x8f81('0x8')](),controller[_0x8f81('0x11')]);router['post']('/',auth[_0x8f81('0x8')](),controller['create']);router[_0x8f81('0x12')](_0x8f81('0xa'),auth[_0x8f81('0x8')](),controller[_0x8f81('0x13')]);router[_0x8f81('0x14')](_0x8f81('0xa'),auth[_0x8f81('0x8')](),controller[_0x8f81('0x15')]);module[_0x8f81('0x16')]=router; \ No newline at end of file +var _0xd0a7=['Router','fs-extra','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','index','/:id','isAuthenticated','get','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','exports','util','path','connect-timeout'];(function(_0x2bf678,_0x2670f0){var _0x4d98a9=function(_0x505a13){while(--_0x505a13){_0x2bf678['push'](_0x2bf678['shift']());}};_0x4d98a9(++_0x2670f0);}(_0xd0a7,0xc5));var _0x7d0a=function(_0x55ba55,_0x958914){_0x55ba55=_0x55ba55-0x0;var _0x40e853=_0xd0a7[_0x55ba55];return _0x40e853;};'use strict';var multer=require('multer');var util=require(_0x7d0a('0x0'));var path=require(_0x7d0a('0x1'));var timeout=require(_0x7d0a('0x2'));var express=require('express');var router=express[_0x7d0a('0x3')]();var fs_extra=require(_0x7d0a('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x7d0a('0x5'));var config=require(_0x7d0a('0x6'));var controller=require(_0x7d0a('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x7d0a('0x8')]);router['get'](_0x7d0a('0x9'),auth[_0x7d0a('0xa')](),controller['show']);router[_0x7d0a('0xb')](_0x7d0a('0xc'),auth[_0x7d0a('0xa')](),controller[_0x7d0a('0xd')]);router[_0x7d0a('0xb')](_0x7d0a('0xe'),auth[_0x7d0a('0xa')](),controller[_0x7d0a('0xf')]);router[_0x7d0a('0xb')](_0x7d0a('0x10'),auth[_0x7d0a('0xa')](),controller[_0x7d0a('0x11')]);router[_0x7d0a('0x12')]('/',auth[_0x7d0a('0xa')](),controller[_0x7d0a('0x13')]);router[_0x7d0a('0x14')](_0x7d0a('0x9'),auth['isAuthenticated'](),controller[_0x7d0a('0x15')]);router[_0x7d0a('0x16')](_0x7d0a('0x9'),auth[_0x7d0a('0xa')](),controller[_0x7d0a('0x17')]);module[_0x7d0a('0x18')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 1566f7b..45badea 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 _0x7229=['sequelize','exports','STRING'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0x7229,0xd2));var _0x9722=function(_0x4ae625,_0xf396d0){_0x4ae625=_0x4ae625-0x0;var _0x31accf=_0x7229[_0x4ae625];return _0x31accf;};'use strict';var Sequelize=require(_0x9722('0x0'));module[_0x9722('0x1')]={'name':{'type':Sequelize[_0x9722('0x2')]},'description':{'type':Sequelize[_0x9722('0x2')]}}; \ No newline at end of file +var _0xe3ec=['exports','STRING','sequelize'];(function(_0x53139c,_0x2d8206){var _0x433c84=function(_0x17bcc0){while(--_0x17bcc0){_0x53139c['push'](_0x53139c['shift']());}};_0x433c84(++_0x2d8206);}(_0xe3ec,0x149));var _0xce3e=function(_0x543fa7,_0x466240){_0x543fa7=_0x543fa7-0x0;var _0x50bb05=_0xe3ec[_0x543fa7];return _0x50bb05;};'use strict';var Sequelize=require(_0xce3e('0x0'));module[_0xce3e('0x1')]={'name':{'type':Sequelize[_0xce3e('0x2')]},'description':{'type':Sequelize[_0xce3e('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 90b249d..952df71 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 _0x8241=['stack','name','send','index','map','rawAttributes','type','model','keys','filters','intersection','query','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','ServicenowConfiguration','includeAll','findAll','catch','show','params','fields','include','options','find','create','body','destroy','getFields','findOne','ServicenowField','getSubjects','getDescriptions','eml-format','rimraf','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','reject','save','update','then','error'];(function(_0x3d30e9,_0x1482dc){var _0x536a7=function(_0x37b0cd){while(--_0x37b0cd){_0x3d30e9['push'](_0x3d30e9['shift']());}};_0x536a7(++_0x1482dc);}(_0x8241,0x116));var _0x1824=function(_0x1fadc9,_0x4dc488){_0x1fadc9=_0x1fadc9-0x0;var _0x516b58=_0x8241[_0x1fadc9];return _0x516b58;};'use strict';var emlformat=require(_0x1824('0x0'));var rimraf=require(_0x1824('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x1824('0x2'));var moment=require(_0x1824('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x1824('0x4'));var util=require(_0x1824('0x5'));var path=require('path');var sox=require(_0x1824('0x6'));var csv=require(_0x1824('0x7'));var ejs=require(_0x1824('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1824('0x9'));var squel=require('squel');var crypto=require(_0x1824('0xa'));var jsforce=require(_0x1824('0xb'));var deskjs=require(_0x1824('0xc'));var toCsv=require(_0x1824('0x7'));var querystring=require(_0x1824('0xd'));var Papa=require(_0x1824('0xe'));var Redis=require(_0x1824('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1824('0x10'));var hardwareService=require(_0x1824('0x11'));var logger=require(_0x1824('0x12'))(_0x1824('0x13'));var utils=require('../../config/utils');var config=require(_0x1824('0x14'));var licenseUtil=require(_0x1824('0x15'));var db=require(_0x1824('0x16'))['db'];function respondWithStatusCode(_0x546866,_0x5a87bd){_0x5a87bd=_0x5a87bd||0xcc;return function(_0x13bd21){if(_0x13bd21){return _0x546866[_0x1824('0x17')](_0x5a87bd);}return _0x546866[_0x1824('0x18')](_0x5a87bd)[_0x1824('0x19')]();};}function respondWithResult(_0x2e4441,_0x2a5dfa){_0x2a5dfa=_0x2a5dfa||0xc8;return function(_0x3fa4fc){if(_0x3fa4fc){return _0x2e4441['status'](_0x2a5dfa)[_0x1824('0x1a')](_0x3fa4fc);}};}function respondWithFilteredResult(_0x32ff1c,_0xaa17dc){return function(_0x52762d){if(_0x52762d){var _0x50bd9c=typeof _0xaa17dc['offset']==='undefined'&&typeof _0xaa17dc[_0x1824('0x1b')]===_0x1824('0x1c');var _0x2c88a5=_0x52762d[_0x1824('0x1d')];var _0x4ffd6e=_0x50bd9c?0x0:_0xaa17dc['offset'];var _0x26640a=_0x50bd9c?_0x52762d[_0x1824('0x1d')]:_0xaa17dc[_0x1824('0x1e')]+_0xaa17dc[_0x1824('0x1b')];var _0x4ca85b;if(_0x26640a>=_0x2c88a5){_0x26640a=_0x2c88a5;_0x4ca85b=0xc8;}else{_0x4ca85b=0xce;}_0x32ff1c[_0x1824('0x18')](_0x4ca85b);return _0x32ff1c[_0x1824('0x1f')](_0x1824('0x20'),_0x4ffd6e+'-'+_0x26640a+'/'+_0x2c88a5)[_0x1824('0x1a')](_0x52762d);}return null;};}function patchUpdates(_0x3a5c35){return function(_0x55a2fe){try{jsonpatch['apply'](_0x55a2fe,_0x3a5c35,!![]);}catch(_0x18a40c){return BPromise[_0x1824('0x21')](_0x18a40c);}return _0x55a2fe[_0x1824('0x22')]();};}function saveUpdates(_0xe6525a,_0x31238c){return function(_0x4a338b){if(_0x4a338b){return _0x4a338b[_0x1824('0x23')](_0xe6525a)[_0x1824('0x24')](function(_0x108287){return _0x108287;});}return null;};}function removeEntity(_0x237f6c,_0x38d83c){return function(_0x35d115){if(_0x35d115){return _0x35d115['destroy']()['then'](function(){_0x237f6c[_0x1824('0x18')](0xcc)[_0x1824('0x19')]();});}};}function handleEntityNotFound(_0xd66394,_0x5a36aa){return function(_0x1075b7){if(!_0x1075b7){_0xd66394[_0x1824('0x17')](0x194);}return _0x1075b7;};}function handleError(_0x59b15d,_0xcce7c9){_0xcce7c9=_0xcce7c9||0x1f4;return function(_0x5b061b){logger[_0x1824('0x25')](_0x5b061b[_0x1824('0x26')]);if(_0x5b061b[_0x1824('0x27')]){delete _0x5b061b['name'];}_0x59b15d[_0x1824('0x18')](_0xcce7c9)[_0x1824('0x28')](_0x5b061b);};}exports[_0x1824('0x29')]=function(_0x4f5ef7,_0x570c6b){var _0x3b57a4={},_0x1eb6c3={},_0xa059af={'count':0x0,'rows':[]};var _0x3d376e=_[_0x1824('0x2a')](db['ServicenowConfiguration'][_0x1824('0x2b')],function(_0x56d61f){return{'name':_0x56d61f['fieldName'],'type':_0x56d61f[_0x1824('0x2c')]['key']};});_0x1eb6c3[_0x1824('0x2d')]=_['map'](_0x3d376e,_0x1824('0x27'));_0x1eb6c3['query']=_[_0x1824('0x2e')](_0x4f5ef7['query']);_0x1eb6c3[_0x1824('0x2f')]=_[_0x1824('0x30')](_0x1eb6c3['model'],_0x1eb6c3[_0x1824('0x31')]);_0x3b57a4[_0x1824('0x32')]=_[_0x1824('0x30')](_0x1eb6c3[_0x1824('0x2d')],qs['fields'](_0x4f5ef7[_0x1824('0x31')]['fields']));_0x3b57a4[_0x1824('0x32')]=_0x3b57a4[_0x1824('0x32')][_0x1824('0x33')]?_0x3b57a4['attributes']:_0x1eb6c3[_0x1824('0x2d')];if(!_0x4f5ef7[_0x1824('0x31')][_0x1824('0x34')](_0x1824('0x35'))){_0x3b57a4['limit']=qs[_0x1824('0x1b')](_0x4f5ef7[_0x1824('0x31')]['limit']);_0x3b57a4[_0x1824('0x1e')]=qs[_0x1824('0x1e')](_0x4f5ef7[_0x1824('0x31')][_0x1824('0x1e')]);}_0x3b57a4[_0x1824('0x36')]=qs[_0x1824('0x37')](_0x4f5ef7[_0x1824('0x31')][_0x1824('0x37')]);_0x3b57a4[_0x1824('0x38')]=qs[_0x1824('0x2f')](_[_0x1824('0x39')](_0x4f5ef7[_0x1824('0x31')],_0x1eb6c3['filters']),_0x3d376e);if(_0x4f5ef7['query'][_0x1824('0x3a')]){_0x3b57a4[_0x1824('0x38')]=_[_0x1824('0x3b')](_0x3b57a4['where'],{'$or':_[_0x1824('0x2a')](_0x3d376e,function(_0x2a5258){if(_0x2a5258['type']!==_0x1824('0x3c')){var _0x16f24c={};_0x16f24c[_0x2a5258[_0x1824('0x27')]]={'$like':'%'+_0x4f5ef7[_0x1824('0x31')][_0x1824('0x3a')]+'%'};return _0x16f24c;}})});}_0x3b57a4=_[_0x1824('0x3b')]({},_0x3b57a4,_0x4f5ef7['options']);var _0x2467e1={'where':_0x3b57a4[_0x1824('0x38')]};return db[_0x1824('0x3d')][_0x1824('0x1d')](_0x2467e1)[_0x1824('0x24')](function(_0xf737ca){_0xa059af[_0x1824('0x1d')]=_0xf737ca;if(_0x4f5ef7[_0x1824('0x31')][_0x1824('0x3e')]){_0x3b57a4['include']=[{'all':!![]}];}return db[_0x1824('0x3d')][_0x1824('0x3f')](_0x3b57a4);})[_0x1824('0x24')](function(_0x22c8e2){_0xa059af['rows']=_0x22c8e2;return _0xa059af;})['then'](respondWithFilteredResult(_0x570c6b,_0x3b57a4))[_0x1824('0x40')](handleError(_0x570c6b,null));};exports[_0x1824('0x41')]=function(_0x1ff17c,_0x2be2f8){var _0x1880c9={'raw':![],'where':{'id':_0x1ff17c[_0x1824('0x42')]['id']}},_0x40e43b={};_0x40e43b['model']=_[_0x1824('0x2e')](db[_0x1824('0x3d')][_0x1824('0x2b')]);_0x40e43b[_0x1824('0x31')]=_[_0x1824('0x2e')](_0x1ff17c[_0x1824('0x31')]);_0x40e43b[_0x1824('0x2f')]=_[_0x1824('0x30')](_0x40e43b[_0x1824('0x2d')],_0x40e43b[_0x1824('0x31')]);_0x1880c9['attributes']=_[_0x1824('0x30')](_0x40e43b[_0x1824('0x2d')],qs[_0x1824('0x43')](_0x1ff17c[_0x1824('0x31')][_0x1824('0x43')]));_0x1880c9[_0x1824('0x32')]=_0x1880c9['attributes'][_0x1824('0x33')]?_0x1880c9[_0x1824('0x32')]:_0x40e43b[_0x1824('0x2d')];if(_0x1ff17c[_0x1824('0x31')][_0x1824('0x3e')]){_0x1880c9[_0x1824('0x44')]=[{'all':!![]}];}_0x1880c9=_[_0x1824('0x3b')]({},_0x1880c9,_0x1ff17c[_0x1824('0x45')]);return db[_0x1824('0x3d')][_0x1824('0x46')](_0x1880c9)[_0x1824('0x24')](handleEntityNotFound(_0x2be2f8,null))[_0x1824('0x24')](respondWithResult(_0x2be2f8,null))[_0x1824('0x40')](handleError(_0x2be2f8,null));};exports[_0x1824('0x47')]=function(_0x43731d,_0x34b378){return db[_0x1824('0x3d')]['create'](_0x43731d[_0x1824('0x48')],{})[_0x1824('0x24')](respondWithResult(_0x34b378,0xc9))[_0x1824('0x40')](handleError(_0x34b378,null));};exports[_0x1824('0x23')]=function(_0x4d0f32,_0x4df08c){if(_0x4d0f32[_0x1824('0x48')]['id']){delete _0x4d0f32[_0x1824('0x48')]['id'];}return db[_0x1824('0x3d')][_0x1824('0x46')]({'where':{'id':_0x4d0f32[_0x1824('0x42')]['id']}})['then'](handleEntityNotFound(_0x4df08c,null))[_0x1824('0x24')](saveUpdates(_0x4d0f32['body'],null))[_0x1824('0x24')](respondWithResult(_0x4df08c,null))[_0x1824('0x40')](handleError(_0x4df08c,null));};exports[_0x1824('0x49')]=function(_0x437a77,_0x5650b6){return db[_0x1824('0x3d')][_0x1824('0x46')]({'where':{'id':_0x437a77[_0x1824('0x42')]['id']}})[_0x1824('0x24')](handleEntityNotFound(_0x5650b6,null))['then'](removeEntity(_0x5650b6,null))['catch'](handleError(_0x5650b6,null));};exports[_0x1824('0x4a')]=function(_0x236683,_0x5da7df,_0x277081){var _0x1eefcd={};var _0x231a5b={};var _0x10346a;var _0x33e7c2;return db[_0x1824('0x3d')][_0x1824('0x4b')]({'where':{'id':_0x236683[_0x1824('0x42')]['id']}})[_0x1824('0x24')](handleEntityNotFound(_0x5da7df,null))[_0x1824('0x24')](function(_0x2c77dc){if(_0x2c77dc){_0x10346a=_0x2c77dc;_0x231a5b[_0x1824('0x2d')]=_[_0x1824('0x2e')](db[_0x1824('0x4c')][_0x1824('0x2b')]);_0x231a5b[_0x1824('0x31')]=_[_0x1824('0x2e')](_0x236683['query']);_0x231a5b['filters']=_[_0x1824('0x30')](_0x231a5b[_0x1824('0x2d')],_0x231a5b[_0x1824('0x31')]);_0x1eefcd[_0x1824('0x32')]=_[_0x1824('0x30')](_0x231a5b[_0x1824('0x2d')],qs[_0x1824('0x43')](_0x236683[_0x1824('0x31')][_0x1824('0x43')]));_0x1eefcd[_0x1824('0x32')]=_0x1eefcd[_0x1824('0x32')]['length']?_0x1eefcd[_0x1824('0x32')]:_0x231a5b[_0x1824('0x2d')];_0x1eefcd[_0x1824('0x36')]=qs[_0x1824('0x37')](_0x236683[_0x1824('0x31')][_0x1824('0x37')]);_0x1eefcd[_0x1824('0x38')]=qs[_0x1824('0x2f')](_[_0x1824('0x39')](_0x236683[_0x1824('0x31')],_0x231a5b[_0x1824('0x2f')]));if(_0x236683['query'][_0x1824('0x3a')]){_0x1eefcd[_0x1824('0x38')]=_[_0x1824('0x3b')](_0x1eefcd[_0x1824('0x38')],{'$or':_['map'](_0x1eefcd[_0x1824('0x32')],function(_0x5484ad){var _0x3ddfc1={};_0x3ddfc1[_0x5484ad]={'$like':'%'+_0x236683[_0x1824('0x31')][_0x1824('0x3a')]+'%'};return _0x3ddfc1;})});}_0x1eefcd=_[_0x1824('0x3b')]({},_0x1eefcd,_0x236683[_0x1824('0x45')]);return _0x10346a[_0x1824('0x4a')](_0x1eefcd);}})[_0x1824('0x24')](function(_0x174659){if(_0x174659){_0x33e7c2=_0x174659[_0x1824('0x33')];if(!_0x236683[_0x1824('0x31')]['hasOwnProperty']('nolimit')){_0x1eefcd[_0x1824('0x1b')]=qs[_0x1824('0x1b')](_0x236683[_0x1824('0x31')]['limit']);_0x1eefcd[_0x1824('0x1e')]=qs[_0x1824('0x1e')](_0x236683[_0x1824('0x31')][_0x1824('0x1e')]);}return _0x10346a[_0x1824('0x4a')](_0x1eefcd);}})[_0x1824('0x24')](function(_0x432e56){if(_0x432e56){return _0x432e56?{'count':_0x33e7c2,'rows':_0x432e56}:null;}})['then'](respondWithResult(_0x5da7df,null))[_0x1824('0x40')](handleError(_0x5da7df,null));};exports[_0x1824('0x4d')]=function(_0x35d1ef,_0x320a69,_0x380150){var _0x5363d5={};var _0x457783={};var _0x24b617;var _0x385298;return db[_0x1824('0x3d')][_0x1824('0x4b')]({'where':{'id':_0x35d1ef[_0x1824('0x42')]['id']}})[_0x1824('0x24')](handleEntityNotFound(_0x320a69,null))[_0x1824('0x24')](function(_0x1eb53d){if(_0x1eb53d){_0x24b617=_0x1eb53d;_0x457783[_0x1824('0x2d')]=_[_0x1824('0x2e')](db['ServicenowField']['rawAttributes']);_0x457783[_0x1824('0x31')]=_[_0x1824('0x2e')](_0x35d1ef[_0x1824('0x31')]);_0x457783[_0x1824('0x2f')]=_[_0x1824('0x30')](_0x457783[_0x1824('0x2d')],_0x457783['query']);_0x5363d5['attributes']=_['intersection'](_0x457783[_0x1824('0x2d')],qs[_0x1824('0x43')](_0x35d1ef[_0x1824('0x31')]['fields']));_0x5363d5['attributes']=_0x5363d5['attributes'][_0x1824('0x33')]?_0x5363d5[_0x1824('0x32')]:_0x457783[_0x1824('0x2d')];_0x5363d5['order']=qs[_0x1824('0x37')](_0x35d1ef['query']['sort']);_0x5363d5[_0x1824('0x38')]=qs['filters'](_['pick'](_0x35d1ef[_0x1824('0x31')],_0x457783[_0x1824('0x2f')]));if(_0x35d1ef[_0x1824('0x31')][_0x1824('0x3a')]){_0x5363d5[_0x1824('0x38')]=_[_0x1824('0x3b')](_0x5363d5[_0x1824('0x38')],{'$or':_['map'](_0x5363d5[_0x1824('0x32')],function(_0x21ac3c){var _0x5d5f91={};_0x5d5f91[_0x21ac3c]={'$like':'%'+_0x35d1ef[_0x1824('0x31')][_0x1824('0x3a')]+'%'};return _0x5d5f91;})});}_0x5363d5=_['merge']({},_0x5363d5,_0x35d1ef['options']);return _0x24b617[_0x1824('0x4d')](_0x5363d5);}})[_0x1824('0x24')](function(_0x5d3520){if(_0x5d3520){_0x385298=_0x5d3520['length'];if(!_0x35d1ef[_0x1824('0x31')]['hasOwnProperty'](_0x1824('0x35'))){_0x5363d5[_0x1824('0x1b')]=qs[_0x1824('0x1b')](_0x35d1ef['query'][_0x1824('0x1b')]);_0x5363d5[_0x1824('0x1e')]=qs[_0x1824('0x1e')](_0x35d1ef['query'][_0x1824('0x1e')]);}return _0x24b617[_0x1824('0x4d')](_0x5363d5);}})[_0x1824('0x24')](function(_0x4f3832){if(_0x4f3832){return _0x4f3832?{'count':_0x385298,'rows':_0x4f3832}:null;}})[_0x1824('0x24')](respondWithResult(_0x320a69,null))[_0x1824('0x40')](handleError(_0x320a69,null));};exports[_0x1824('0x4e')]=function(_0x21a21d,_0x14ff72,_0x3072d5){var _0x4a61ca={};var _0x54ff42={};var _0x1371bd;var _0x12195f;return db[_0x1824('0x3d')][_0x1824('0x4b')]({'where':{'id':_0x21a21d['params']['id']}})[_0x1824('0x24')](handleEntityNotFound(_0x14ff72,null))['then'](function(_0x1c3f92){if(_0x1c3f92){_0x1371bd=_0x1c3f92;_0x54ff42[_0x1824('0x2d')]=_[_0x1824('0x2e')](db[_0x1824('0x4c')][_0x1824('0x2b')]);_0x54ff42[_0x1824('0x31')]=_[_0x1824('0x2e')](_0x21a21d[_0x1824('0x31')]);_0x54ff42[_0x1824('0x2f')]=_[_0x1824('0x30')](_0x54ff42[_0x1824('0x2d')],_0x54ff42[_0x1824('0x31')]);_0x4a61ca['attributes']=_[_0x1824('0x30')](_0x54ff42[_0x1824('0x2d')],qs[_0x1824('0x43')](_0x21a21d[_0x1824('0x31')]['fields']));_0x4a61ca[_0x1824('0x32')]=_0x4a61ca['attributes'][_0x1824('0x33')]?_0x4a61ca[_0x1824('0x32')]:_0x54ff42['model'];_0x4a61ca[_0x1824('0x36')]=qs[_0x1824('0x37')](_0x21a21d[_0x1824('0x31')][_0x1824('0x37')]);_0x4a61ca[_0x1824('0x38')]=qs[_0x1824('0x2f')](_[_0x1824('0x39')](_0x21a21d['query'],_0x54ff42[_0x1824('0x2f')]));if(_0x21a21d['query'][_0x1824('0x3a')]){_0x4a61ca[_0x1824('0x38')]=_['merge'](_0x4a61ca['where'],{'$or':_['map'](_0x4a61ca['attributes'],function(_0xf952fe){var _0x53a111={};_0x53a111[_0xf952fe]={'$like':'%'+_0x21a21d[_0x1824('0x31')]['filter']+'%'};return _0x53a111;})});}_0x4a61ca=_[_0x1824('0x3b')]({},_0x4a61ca,_0x21a21d[_0x1824('0x45')]);return _0x1371bd['getDescriptions'](_0x4a61ca);}})[_0x1824('0x24')](function(_0x1fe6cb){if(_0x1fe6cb){_0x12195f=_0x1fe6cb[_0x1824('0x33')];if(!_0x21a21d[_0x1824('0x31')]['hasOwnProperty'](_0x1824('0x35'))){_0x4a61ca[_0x1824('0x1b')]=qs[_0x1824('0x1b')](_0x21a21d[_0x1824('0x31')][_0x1824('0x1b')]);_0x4a61ca[_0x1824('0x1e')]=qs['offset'](_0x21a21d[_0x1824('0x31')][_0x1824('0x1e')]);}return _0x1371bd[_0x1824('0x4e')](_0x4a61ca);}})[_0x1824('0x24')](function(_0xb776b5){if(_0xb776b5){return _0xb776b5?{'count':_0x12195f,'rows':_0xb776b5}:null;}})[_0x1824('0x24')](respondWithResult(_0x14ff72,null))[_0x1824('0x40')](handleError(_0x14ff72,null));}; \ No newline at end of file +var _0xb368=['hasOwnProperty','order','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','find','catch','create','body','params','getFields','findOne','nolimit','getSubjects','ServicenowField','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','ServicenowConfiguration','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length'];(function(_0x44cf9c,_0x393610){var _0x2997ae=function(_0x1e826f){while(--_0x1e826f){_0x44cf9c['push'](_0x44cf9c['shift']());}};_0x2997ae(++_0x393610);}(_0xb368,0x68));var _0x8b36=function(_0x59a6e6,_0x32addd){_0x59a6e6=_0x59a6e6-0x0;var _0x8b5310=_0xb368[_0x59a6e6];return _0x8b5310;};'use strict';var emlformat=require(_0x8b36('0x0'));var rimraf=require(_0x8b36('0x1'));var zipdir=require(_0x8b36('0x2'));var jsonpatch=require(_0x8b36('0x3'));var rp=require(_0x8b36('0x4'));var moment=require(_0x8b36('0x5'));var BPromise=require(_0x8b36('0x6'));var Mustache=require(_0x8b36('0x7'));var util=require(_0x8b36('0x8'));var path=require(_0x8b36('0x9'));var sox=require('sox');var csv=require(_0x8b36('0xa'));var ejs=require(_0x8b36('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8b36('0xc'));var crypto=require('crypto');var jsforce=require(_0x8b36('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x8b36('0xa'));var querystring=require(_0x8b36('0xe'));var Papa=require(_0x8b36('0xf'));var Redis=require('ioredis');var authService=require(_0x8b36('0x10'));var qs=require(_0x8b36('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8b36('0x12'))(_0x8b36('0x13'));var utils=require(_0x8b36('0x14'));var config=require(_0x8b36('0x15'));var licenseUtil=require(_0x8b36('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5ef596,_0x583785){_0x583785=_0x583785||0xcc;return function(_0xb1b00c){if(_0xb1b00c){return _0x5ef596[_0x8b36('0x17')](_0x583785);}return _0x5ef596[_0x8b36('0x18')](_0x583785)[_0x8b36('0x19')]();};}function respondWithResult(_0x11e0d7,_0x39f4be){_0x39f4be=_0x39f4be||0xc8;return function(_0x8c9ce0){if(_0x8c9ce0){return _0x11e0d7[_0x8b36('0x18')](_0x39f4be)[_0x8b36('0x1a')](_0x8c9ce0);}};}function respondWithFilteredResult(_0x36e515,_0xf2bd38){return function(_0x470cbb){if(_0x470cbb){var _0x46f5d2=typeof _0xf2bd38['offset']===_0x8b36('0x1b')&&typeof _0xf2bd38[_0x8b36('0x1c')]===_0x8b36('0x1b');var _0x4d7154=_0x470cbb[_0x8b36('0x1d')];var _0x37805f=_0x46f5d2?0x0:_0xf2bd38[_0x8b36('0x1e')];var _0x2759c3=_0x46f5d2?_0x470cbb[_0x8b36('0x1d')]:_0xf2bd38[_0x8b36('0x1e')]+_0xf2bd38[_0x8b36('0x1c')];var _0x547260;if(_0x2759c3>=_0x4d7154){_0x2759c3=_0x4d7154;_0x547260=0xc8;}else{_0x547260=0xce;}_0x36e515[_0x8b36('0x18')](_0x547260);return _0x36e515[_0x8b36('0x1f')](_0x8b36('0x20'),_0x37805f+'-'+_0x2759c3+'/'+_0x4d7154)[_0x8b36('0x1a')](_0x470cbb);}return null;};}function patchUpdates(_0xf8b2fe){return function(_0xf8b906){try{jsonpatch[_0x8b36('0x21')](_0xf8b906,_0xf8b2fe,!![]);}catch(_0x3e3852){return BPromise[_0x8b36('0x22')](_0x3e3852);}return _0xf8b906['save']();};}function saveUpdates(_0x302271,_0x46d39a){return function(_0x59a543){if(_0x59a543){return _0x59a543[_0x8b36('0x23')](_0x302271)[_0x8b36('0x24')](function(_0x28b111){return _0x28b111;});}return null;};}function removeEntity(_0x159e18,_0x2c1a96){return function(_0x2d3ab5){if(_0x2d3ab5){return _0x2d3ab5[_0x8b36('0x25')]()[_0x8b36('0x24')](function(){_0x159e18['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x26926d,_0x2c9cf4){return function(_0x17be9d){if(!_0x17be9d){_0x26926d['sendStatus'](0x194);}return _0x17be9d;};}function handleError(_0x500682,_0x16ad4c){_0x16ad4c=_0x16ad4c||0x1f4;return function(_0x3952ad){logger[_0x8b36('0x26')](_0x3952ad[_0x8b36('0x27')]);if(_0x3952ad[_0x8b36('0x28')]){delete _0x3952ad[_0x8b36('0x28')];}_0x500682[_0x8b36('0x18')](_0x16ad4c)[_0x8b36('0x29')](_0x3952ad);};}exports[_0x8b36('0x2a')]=function(_0xdebb78,_0x5920b0){var _0x1bca58={},_0x4c6f70={},_0x3426cc={'count':0x0,'rows':[]};var _0x30f388=_['map'](db[_0x8b36('0x2b')][_0x8b36('0x2c')],function(_0x4b403c){return{'name':_0x4b403c[_0x8b36('0x2d')],'type':_0x4b403c[_0x8b36('0x2e')][_0x8b36('0x2f')]};});_0x4c6f70[_0x8b36('0x30')]=_['map'](_0x30f388,_0x8b36('0x28'));_0x4c6f70['query']=_[_0x8b36('0x31')](_0xdebb78[_0x8b36('0x32')]);_0x4c6f70[_0x8b36('0x33')]=_[_0x8b36('0x34')](_0x4c6f70['model'],_0x4c6f70[_0x8b36('0x32')]);_0x1bca58[_0x8b36('0x35')]=_[_0x8b36('0x34')](_0x4c6f70['model'],qs['fields'](_0xdebb78[_0x8b36('0x32')][_0x8b36('0x36')]));_0x1bca58[_0x8b36('0x35')]=_0x1bca58[_0x8b36('0x35')][_0x8b36('0x37')]?_0x1bca58[_0x8b36('0x35')]:_0x4c6f70[_0x8b36('0x30')];if(!_0xdebb78[_0x8b36('0x32')][_0x8b36('0x38')]('nolimit')){_0x1bca58[_0x8b36('0x1c')]=qs[_0x8b36('0x1c')](_0xdebb78[_0x8b36('0x32')][_0x8b36('0x1c')]);_0x1bca58[_0x8b36('0x1e')]=qs[_0x8b36('0x1e')](_0xdebb78[_0x8b36('0x32')]['offset']);}_0x1bca58[_0x8b36('0x39')]=qs[_0x8b36('0x3a')](_0xdebb78[_0x8b36('0x32')]['sort']);_0x1bca58[_0x8b36('0x3b')]=qs[_0x8b36('0x33')](_[_0x8b36('0x3c')](_0xdebb78[_0x8b36('0x32')],_0x4c6f70[_0x8b36('0x33')]),_0x30f388);if(_0xdebb78['query'][_0x8b36('0x3d')]){_0x1bca58['where']=_[_0x8b36('0x3e')](_0x1bca58[_0x8b36('0x3b')],{'$or':_[_0x8b36('0x3f')](_0x30f388,function(_0x5953bc){if(_0x5953bc['type']!==_0x8b36('0x40')){var _0x5dd1e0={};_0x5dd1e0[_0x5953bc[_0x8b36('0x28')]]={'$like':'%'+_0xdebb78['query']['filter']+'%'};return _0x5dd1e0;}})});}_0x1bca58=_['merge']({},_0x1bca58,_0xdebb78[_0x8b36('0x41')]);var _0x5b3eab={'where':_0x1bca58[_0x8b36('0x3b')]};return db[_0x8b36('0x2b')]['count'](_0x5b3eab)[_0x8b36('0x24')](function(_0x34e9a7){_0x3426cc[_0x8b36('0x1d')]=_0x34e9a7;if(_0xdebb78[_0x8b36('0x32')][_0x8b36('0x42')]){_0x1bca58[_0x8b36('0x43')]=[{'all':!![]}];}return db['ServicenowConfiguration'][_0x8b36('0x44')](_0x1bca58);})[_0x8b36('0x24')](function(_0x45c23d){_0x3426cc['rows']=_0x45c23d;return _0x3426cc;})[_0x8b36('0x24')](respondWithFilteredResult(_0x5920b0,_0x1bca58))['catch'](handleError(_0x5920b0,null));};exports['show']=function(_0x499cd5,_0x5f5638){var _0x5039f0={'raw':![],'where':{'id':_0x499cd5['params']['id']}},_0x550d61={};_0x550d61[_0x8b36('0x30')]=_[_0x8b36('0x31')](db[_0x8b36('0x2b')][_0x8b36('0x2c')]);_0x550d61[_0x8b36('0x32')]=_[_0x8b36('0x31')](_0x499cd5['query']);_0x550d61[_0x8b36('0x33')]=_[_0x8b36('0x34')](_0x550d61[_0x8b36('0x30')],_0x550d61[_0x8b36('0x32')]);_0x5039f0[_0x8b36('0x35')]=_[_0x8b36('0x34')](_0x550d61[_0x8b36('0x30')],qs[_0x8b36('0x36')](_0x499cd5[_0x8b36('0x32')]['fields']));_0x5039f0[_0x8b36('0x35')]=_0x5039f0[_0x8b36('0x35')][_0x8b36('0x37')]?_0x5039f0[_0x8b36('0x35')]:_0x550d61[_0x8b36('0x30')];if(_0x499cd5[_0x8b36('0x32')]['includeAll']){_0x5039f0[_0x8b36('0x43')]=[{'all':!![]}];}_0x5039f0=_[_0x8b36('0x3e')]({},_0x5039f0,_0x499cd5[_0x8b36('0x41')]);return db[_0x8b36('0x2b')][_0x8b36('0x45')](_0x5039f0)[_0x8b36('0x24')](handleEntityNotFound(_0x5f5638,null))['then'](respondWithResult(_0x5f5638,null))[_0x8b36('0x46')](handleError(_0x5f5638,null));};exports[_0x8b36('0x47')]=function(_0x44af3e,_0x7d0380){return db[_0x8b36('0x2b')][_0x8b36('0x47')](_0x44af3e['body'],{})[_0x8b36('0x24')](respondWithResult(_0x7d0380,0xc9))[_0x8b36('0x46')](handleError(_0x7d0380,null));};exports['update']=function(_0x3859eb,_0x5ba2e8){if(_0x3859eb['body']['id']){delete _0x3859eb[_0x8b36('0x48')]['id'];}return db['ServicenowConfiguration'][_0x8b36('0x45')]({'where':{'id':_0x3859eb[_0x8b36('0x49')]['id']}})[_0x8b36('0x24')](handleEntityNotFound(_0x5ba2e8,null))[_0x8b36('0x24')](saveUpdates(_0x3859eb[_0x8b36('0x48')],null))[_0x8b36('0x24')](respondWithResult(_0x5ba2e8,null))[_0x8b36('0x46')](handleError(_0x5ba2e8,null));};exports[_0x8b36('0x25')]=function(_0x5b2c0f,_0x14b04c){return db[_0x8b36('0x2b')][_0x8b36('0x45')]({'where':{'id':_0x5b2c0f[_0x8b36('0x49')]['id']}})[_0x8b36('0x24')](handleEntityNotFound(_0x14b04c,null))[_0x8b36('0x24')](removeEntity(_0x14b04c,null))[_0x8b36('0x46')](handleError(_0x14b04c,null));};exports[_0x8b36('0x4a')]=function(_0x322ea1,_0x219a5d,_0x1ee30f){var _0x4cd7ba={};var _0x301097={};var _0x478c74;var _0x547e4a;return db['ServicenowConfiguration'][_0x8b36('0x4b')]({'where':{'id':_0x322ea1[_0x8b36('0x49')]['id']}})[_0x8b36('0x24')](handleEntityNotFound(_0x219a5d,null))[_0x8b36('0x24')](function(_0x2e327b){if(_0x2e327b){_0x478c74=_0x2e327b;_0x301097[_0x8b36('0x30')]=_['keys'](db['ServicenowField'][_0x8b36('0x2c')]);_0x301097[_0x8b36('0x32')]=_[_0x8b36('0x31')](_0x322ea1['query']);_0x301097[_0x8b36('0x33')]=_['intersection'](_0x301097[_0x8b36('0x30')],_0x301097['query']);_0x4cd7ba[_0x8b36('0x35')]=_[_0x8b36('0x34')](_0x301097['model'],qs['fields'](_0x322ea1[_0x8b36('0x32')][_0x8b36('0x36')]));_0x4cd7ba[_0x8b36('0x35')]=_0x4cd7ba['attributes'][_0x8b36('0x37')]?_0x4cd7ba[_0x8b36('0x35')]:_0x301097[_0x8b36('0x30')];_0x4cd7ba['order']=qs[_0x8b36('0x3a')](_0x322ea1[_0x8b36('0x32')]['sort']);_0x4cd7ba[_0x8b36('0x3b')]=qs[_0x8b36('0x33')](_[_0x8b36('0x3c')](_0x322ea1[_0x8b36('0x32')],_0x301097[_0x8b36('0x33')]));if(_0x322ea1[_0x8b36('0x32')][_0x8b36('0x3d')]){_0x4cd7ba['where']=_['merge'](_0x4cd7ba['where'],{'$or':_[_0x8b36('0x3f')](_0x4cd7ba[_0x8b36('0x35')],function(_0x15cffb){var _0x10ec33={};_0x10ec33[_0x15cffb]={'$like':'%'+_0x322ea1[_0x8b36('0x32')][_0x8b36('0x3d')]+'%'};return _0x10ec33;})});}_0x4cd7ba=_[_0x8b36('0x3e')]({},_0x4cd7ba,_0x322ea1[_0x8b36('0x41')]);return _0x478c74['getFields'](_0x4cd7ba);}})[_0x8b36('0x24')](function(_0x2193c2){if(_0x2193c2){_0x547e4a=_0x2193c2['length'];if(!_0x322ea1[_0x8b36('0x32')]['hasOwnProperty'](_0x8b36('0x4c'))){_0x4cd7ba[_0x8b36('0x1c')]=qs[_0x8b36('0x1c')](_0x322ea1[_0x8b36('0x32')][_0x8b36('0x1c')]);_0x4cd7ba[_0x8b36('0x1e')]=qs[_0x8b36('0x1e')](_0x322ea1['query']['offset']);}return _0x478c74['getFields'](_0x4cd7ba);}})[_0x8b36('0x24')](function(_0x4c2843){if(_0x4c2843){return _0x4c2843?{'count':_0x547e4a,'rows':_0x4c2843}:null;}})[_0x8b36('0x24')](respondWithResult(_0x219a5d,null))[_0x8b36('0x46')](handleError(_0x219a5d,null));};exports[_0x8b36('0x4d')]=function(_0x509e14,_0x22ded3,_0x24cb2d){var _0x4498de={};var _0x3e05f7={};var _0x2f1812;var _0xd589b4;return db[_0x8b36('0x2b')][_0x8b36('0x4b')]({'where':{'id':_0x509e14[_0x8b36('0x49')]['id']}})[_0x8b36('0x24')](handleEntityNotFound(_0x22ded3,null))['then'](function(_0x565d0e){if(_0x565d0e){_0x2f1812=_0x565d0e;_0x3e05f7[_0x8b36('0x30')]=_['keys'](db[_0x8b36('0x4e')][_0x8b36('0x2c')]);_0x3e05f7[_0x8b36('0x32')]=_[_0x8b36('0x31')](_0x509e14[_0x8b36('0x32')]);_0x3e05f7['filters']=_[_0x8b36('0x34')](_0x3e05f7[_0x8b36('0x30')],_0x3e05f7[_0x8b36('0x32')]);_0x4498de[_0x8b36('0x35')]=_[_0x8b36('0x34')](_0x3e05f7[_0x8b36('0x30')],qs['fields'](_0x509e14[_0x8b36('0x32')][_0x8b36('0x36')]));_0x4498de[_0x8b36('0x35')]=_0x4498de['attributes'][_0x8b36('0x37')]?_0x4498de[_0x8b36('0x35')]:_0x3e05f7[_0x8b36('0x30')];_0x4498de[_0x8b36('0x39')]=qs[_0x8b36('0x3a')](_0x509e14[_0x8b36('0x32')]['sort']);_0x4498de[_0x8b36('0x3b')]=qs[_0x8b36('0x33')](_[_0x8b36('0x3c')](_0x509e14[_0x8b36('0x32')],_0x3e05f7[_0x8b36('0x33')]));if(_0x509e14[_0x8b36('0x32')]['filter']){_0x4498de[_0x8b36('0x3b')]=_[_0x8b36('0x3e')](_0x4498de[_0x8b36('0x3b')],{'$or':_['map'](_0x4498de['attributes'],function(_0x173436){var _0x2bb62c={};_0x2bb62c[_0x173436]={'$like':'%'+_0x509e14['query'][_0x8b36('0x3d')]+'%'};return _0x2bb62c;})});}_0x4498de=_[_0x8b36('0x3e')]({},_0x4498de,_0x509e14['options']);return _0x2f1812[_0x8b36('0x4d')](_0x4498de);}})[_0x8b36('0x24')](function(_0x6c575c){if(_0x6c575c){_0xd589b4=_0x6c575c['length'];if(!_0x509e14[_0x8b36('0x32')][_0x8b36('0x38')]('nolimit')){_0x4498de['limit']=qs[_0x8b36('0x1c')](_0x509e14[_0x8b36('0x32')][_0x8b36('0x1c')]);_0x4498de[_0x8b36('0x1e')]=qs['offset'](_0x509e14['query']['offset']);}return _0x2f1812[_0x8b36('0x4d')](_0x4498de);}})['then'](function(_0x4231d5){if(_0x4231d5){return _0x4231d5?{'count':_0xd589b4,'rows':_0x4231d5}:null;}})[_0x8b36('0x24')](respondWithResult(_0x22ded3,null))['catch'](handleError(_0x22ded3,null));};exports[_0x8b36('0x4f')]=function(_0xbce155,_0x1807e3,_0x5f51a2){var _0xb872e={};var _0x42dc97={};var _0x15522e;var _0x185848;return db[_0x8b36('0x2b')][_0x8b36('0x4b')]({'where':{'id':_0xbce155[_0x8b36('0x49')]['id']}})[_0x8b36('0x24')](handleEntityNotFound(_0x1807e3,null))[_0x8b36('0x24')](function(_0xb22d42){if(_0xb22d42){_0x15522e=_0xb22d42;_0x42dc97[_0x8b36('0x30')]=_['keys'](db[_0x8b36('0x4e')][_0x8b36('0x2c')]);_0x42dc97[_0x8b36('0x32')]=_[_0x8b36('0x31')](_0xbce155[_0x8b36('0x32')]);_0x42dc97[_0x8b36('0x33')]=_[_0x8b36('0x34')](_0x42dc97[_0x8b36('0x30')],_0x42dc97[_0x8b36('0x32')]);_0xb872e[_0x8b36('0x35')]=_[_0x8b36('0x34')](_0x42dc97[_0x8b36('0x30')],qs[_0x8b36('0x36')](_0xbce155[_0x8b36('0x32')][_0x8b36('0x36')]));_0xb872e[_0x8b36('0x35')]=_0xb872e[_0x8b36('0x35')]['length']?_0xb872e[_0x8b36('0x35')]:_0x42dc97['model'];_0xb872e[_0x8b36('0x39')]=qs[_0x8b36('0x3a')](_0xbce155[_0x8b36('0x32')]['sort']);_0xb872e[_0x8b36('0x3b')]=qs['filters'](_[_0x8b36('0x3c')](_0xbce155[_0x8b36('0x32')],_0x42dc97[_0x8b36('0x33')]));if(_0xbce155[_0x8b36('0x32')][_0x8b36('0x3d')]){_0xb872e['where']=_[_0x8b36('0x3e')](_0xb872e[_0x8b36('0x3b')],{'$or':_['map'](_0xb872e[_0x8b36('0x35')],function(_0x569849){var _0x283908={};_0x283908[_0x569849]={'$like':'%'+_0xbce155[_0x8b36('0x32')][_0x8b36('0x3d')]+'%'};return _0x283908;})});}_0xb872e=_['merge']({},_0xb872e,_0xbce155[_0x8b36('0x41')]);return _0x15522e[_0x8b36('0x4f')](_0xb872e);}})[_0x8b36('0x24')](function(_0xc8f06e){if(_0xc8f06e){_0x185848=_0xc8f06e[_0x8b36('0x37')];if(!_0xbce155[_0x8b36('0x32')][_0x8b36('0x38')](_0x8b36('0x4c'))){_0xb872e[_0x8b36('0x1c')]=qs[_0x8b36('0x1c')](_0xbce155['query']['limit']);_0xb872e['offset']=qs['offset'](_0xbce155[_0x8b36('0x32')][_0x8b36('0x1e')]);}return _0x15522e[_0x8b36('0x4f')](_0xb872e);}})[_0x8b36('0x24')](function(_0x25754e){if(_0x25754e){return _0x25754e?{'count':_0x185848,'rows':_0x25754e}:null;}})['then'](respondWithResult(_0x1807e3,null))[_0x8b36('0x46')](handleError(_0x1807e3,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 0c60edd..c4be045 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 _0x6d2d=['int_servicenow_configurations','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports','ServicenowConfiguration'];(function(_0x438446,_0x320e62){var _0x485211=function(_0x5c245f){while(--_0x5c245f){_0x438446['push'](_0x438446['shift']());}};_0x485211(++_0x320e62);}(_0x6d2d,0xbc));var _0xd6d2=function(_0x28ee93,_0x4fd48c){_0x28ee93=_0x28ee93-0x0;var _0x8a9703=_0x6d2d[_0x28ee93];return _0x8a9703;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd6d2('0x0'))(_0xd6d2('0x1'));var moment=require(_0xd6d2('0x2'));var BPromise=require('bluebird');var rp=require(_0xd6d2('0x3'));var fs=require('fs');var path=require(_0xd6d2('0x4'));var rimraf=require(_0xd6d2('0x5'));var config=require(_0xd6d2('0x6'));var attributes=require(_0xd6d2('0x7'));module[_0xd6d2('0x8')]=function(_0x32ebf,_0x2265d5){return _0x32ebf['define'](_0xd6d2('0x9'),attributes,{'tableName':_0xd6d2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd5fc=['../../config/environment','exports','define','lodash','moment','bluebird','request-promise','path','rimraf'];(function(_0x7f4dbc,_0x344984){var _0x3229c9=function(_0x4589c6){while(--_0x4589c6){_0x7f4dbc['push'](_0x7f4dbc['shift']());}};_0x3229c9(++_0x344984);}(_0xd5fc,0xae));var _0xcd5f=function(_0x495172,_0x38a35f){_0x495172=_0x495172-0x0;var _0x3051cc=_0xd5fc[_0x495172];return _0x3051cc;};'use strict';var _=require(_0xcd5f('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xcd5f('0x1'));var BPromise=require(_0xcd5f('0x2'));var rp=require(_0xcd5f('0x3'));var fs=require('fs');var path=require(_0xcd5f('0x4'));var rimraf=require(_0xcd5f('0x5'));var config=require(_0xcd5f('0x6'));var attributes=require('./intServicenowConfiguration.attributes');module[_0xcd5f('0x7')]=function(_0x4b4ca8,_0x95b8bb){return _0x4b4ca8[_0xcd5f('0x8')]('ServicenowConfiguration',attributes,{'tableName':'int_servicenow_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js index e8b33cc..c50eef4 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 _0x9d67=['client','then','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash','util','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x1c8c28,_0x3ee093){var _0x1f59b4=function(_0x29bcc0){while(--_0x29bcc0){_0x1c8c28['push'](_0x1c8c28['shift']());}};_0x1f59b4(++_0x3ee093);}(_0x9d67,0xe8));var _0x79d6=function(_0x5a44b2,_0x285bee){_0x5a44b2=_0x5a44b2-0x0;var _0x147ab9=_0x9d67[_0x5a44b2];return _0x147ab9;};'use strict';var _=require(_0x79d6('0x0'));var util=require(_0x79d6('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x79d6('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x79d6('0x3'));var logger=require(_0x79d6('0x4'))(_0x79d6('0x5'));var config=require(_0x79d6('0x6'));var jayson=require(_0x79d6('0x7'));var client=jayson[_0x79d6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x351205,_0x4ee47,_0x35e5cf){return new BPromise(function(_0x293343,_0x538c8e){return client['request'](_0x351205,_0x35e5cf)[_0x79d6('0x9')](function(_0x423cf9){logger['info'](_0x79d6('0xa'),_0x4ee47,_0x79d6('0xb'));logger[_0x79d6('0xc')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x4ee47,_0x79d6('0xb'),JSON[_0x79d6('0xd')](_0x423cf9));if(_0x423cf9[_0x79d6('0xe')]){if(_0x423cf9[_0x79d6('0xe')][_0x79d6('0xf')]===0x1f4){logger[_0x79d6('0xe')]('ServicenowConfiguration,\x20%s,\x20%s',_0x4ee47,_0x423cf9[_0x79d6('0xe')]['message']);return _0x538c8e(_0x423cf9['error']['message']);}logger[_0x79d6('0xe')](_0x79d6('0xa'),_0x4ee47,_0x423cf9['error'][_0x79d6('0x10')]);return _0x293343(_0x423cf9['error'][_0x79d6('0x10')]);}else{logger[_0x79d6('0x11')]('ServicenowConfiguration,\x20%s,\x20%s',_0x4ee47,_0x79d6('0xb'));_0x293343(_0x423cf9[_0x79d6('0x12')][_0x79d6('0x10')]);}})[_0x79d6('0x13')](function(_0x468cc1){logger[_0x79d6('0xe')](_0x79d6('0xa'),_0x4ee47,_0x468cc1);_0x538c8e(_0x468cc1);});});} \ No newline at end of file +var _0xfd4c=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','ServicenowConfiguration,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis'];(function(_0x5e6838,_0x39ea15){var _0x11700d=function(_0x435c83){while(--_0x435c83){_0x5e6838['push'](_0x5e6838['shift']());}};_0x11700d(++_0x39ea15);}(_0xfd4c,0x17b));var _0xcfd4=function(_0x238bf6,_0x2c2f11){_0x238bf6=_0x238bf6-0x0;var _0xb3e16d=_0xfd4c[_0x238bf6];return _0xb3e16d;};'use strict';var _=require(_0xcfd4('0x0'));var util=require(_0xcfd4('0x1'));var moment=require('moment');var BPromise=require(_0xcfd4('0x2'));var rs=require(_0xcfd4('0x3'));var fs=require('fs');var Redis=require(_0xcfd4('0x4'));var db=require(_0xcfd4('0x5'))['db'];var utils=require(_0xcfd4('0x6'));var logger=require('../../config/logger')(_0xcfd4('0x7'));var config=require(_0xcfd4('0x8'));var jayson=require(_0xcfd4('0x9'));var client=jayson[_0xcfd4('0xa')][_0xcfd4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xc70bf4,_0xfd0644,_0x28fc02){return new BPromise(function(_0x8ff051,_0x575808){return client[_0xcfd4('0xc')](_0xc70bf4,_0x28fc02)[_0xcfd4('0xd')](function(_0x39d7a0){logger[_0xcfd4('0xe')]('ServicenowConfiguration,\x20%s,\x20%s',_0xfd0644,'request\x20sent');logger[_0xcfd4('0xf')](_0xcfd4('0x10'),_0xfd0644,_0xcfd4('0x11'),JSON[_0xcfd4('0x12')](_0x39d7a0));if(_0x39d7a0[_0xcfd4('0x13')]){if(_0x39d7a0['error']['code']===0x1f4){logger[_0xcfd4('0x13')]('ServicenowConfiguration,\x20%s,\x20%s',_0xfd0644,_0x39d7a0['error']['message']);return _0x575808(_0x39d7a0[_0xcfd4('0x13')][_0xcfd4('0x14')]);}logger['error'](_0xcfd4('0x15'),_0xfd0644,_0x39d7a0[_0xcfd4('0x13')][_0xcfd4('0x14')]);return _0x8ff051(_0x39d7a0[_0xcfd4('0x13')][_0xcfd4('0x14')]);}else{logger[_0xcfd4('0xe')](_0xcfd4('0x15'),_0xfd0644,_0xcfd4('0x11'));_0x8ff051(_0x39d7a0[_0xcfd4('0x16')]['message']);}})[_0xcfd4('0x17')](function(_0x4508b9){logger['error'](_0xcfd4('0x15'),_0xfd0644,_0x4508b9);_0x575808(_0x4508b9);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index a0fcde3..801d73b 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 _0x17d9=['isAuthenticated','index','show','post','create','put','update','/:id','exports','multer','util','path','express','Router','fs-extra','./intServicenowField.controller','get'];(function(_0x5ba380,_0x1a5f46){var _0xac5b1=function(_0x239f3d){while(--_0x239f3d){_0x5ba380['push'](_0x5ba380['shift']());}};_0xac5b1(++_0x1a5f46);}(_0x17d9,0x6f));var _0x917d=function(_0xbec8e6,_0x2841b5){_0xbec8e6=_0xbec8e6-0x0;var _0x4aa6f2=_0x17d9[_0xbec8e6];return _0x4aa6f2;};'use strict';var multer=require(_0x917d('0x0'));var util=require(_0x917d('0x1'));var path=require(_0x917d('0x2'));var timeout=require('connect-timeout');var express=require(_0x917d('0x3'));var router=express[_0x917d('0x4')]();var fs_extra=require(_0x917d('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x917d('0x6'));router[_0x917d('0x7')]('/',auth[_0x917d('0x8')](),controller[_0x917d('0x9')]);router[_0x917d('0x7')]('/:id',auth[_0x917d('0x8')](),controller[_0x917d('0xa')]);router[_0x917d('0xb')]('/',auth['isAuthenticated'](),controller[_0x917d('0xc')]);router[_0x917d('0xd')]('/:id',auth[_0x917d('0x8')](),controller[_0x917d('0xe')]);router['delete'](_0x917d('0xf'),auth[_0x917d('0x8')](),controller['destroy']);module[_0x917d('0x10')]=router; \ No newline at end of file +var _0x583b=['put','/:id','update','delete','destroy','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','isAuthenticated','show','post','create'];(function(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0x583b,0x113));var _0xb583=function(_0x30e634,_0x3493d4){_0x30e634=_0x30e634-0x0;var _0x43ccaf=_0x583b[_0x30e634];return _0x43ccaf;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb583('0x0'));var timeout=require('connect-timeout');var express=require(_0xb583('0x1'));var router=express[_0xb583('0x2')]();var fs_extra=require(_0xb583('0x3'));var auth=require(_0xb583('0x4'));var interaction=require(_0xb583('0x5'));var config=require(_0xb583('0x6'));var controller=require(_0xb583('0x7'));router[_0xb583('0x8')]('/',auth[_0xb583('0x9')](),controller['index']);router[_0xb583('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xb583('0xa')]);router[_0xb583('0xb')]('/',auth['isAuthenticated'](),controller[_0xb583('0xc')]);router[_0xb583('0xd')](_0xb583('0xe'),auth[_0xb583('0x9')](),controller[_0xb583('0xf')]);router[_0xb583('0x10')](_0xb583('0xe'),auth[_0xb583('0x9')](),controller[_0xb583('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 34b3d7b..a48a268 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 _0xa5ae=['exports','ENUM','variable','picklist','STRING','string','customVariable','BOOLEAN'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0xa5ae,0x1f0));var _0xea5a=function(_0x2de9de,_0xd46ad){_0x2de9de=_0x2de9de-0x0;var _0x34be8c=_0xa5ae[_0x2de9de];return _0x34be8c;};'use strict';var Sequelize=require('sequelize');module[_0xea5a('0x0')]={'type':{'type':Sequelize[_0xea5a('0x1')]('string',_0xea5a('0x2'),'customVariable','keyValue',_0xea5a('0x3')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xea5a('0x4')]},'keyType':{'type':Sequelize[_0xea5a('0x1')](_0xea5a('0x5'),_0xea5a('0x2'),_0xea5a('0x6'))},'keyContent':{'type':Sequelize[_0xea5a('0x4')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xea5a('0x4')]},'customField':{'type':Sequelize[_0xea5a('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3189=['sequelize','exports','string','customVariable','picklist','STRING','variable','BOOLEAN'];(function(_0x480f68,_0x266efa){var _0x671946=function(_0x301e89){while(--_0x301e89){_0x480f68['push'](_0x480f68['shift']());}};_0x671946(++_0x266efa);}(_0x3189,0x188));var _0x9318=function(_0xe2253b,_0x2dbcb6){_0xe2253b=_0xe2253b-0x0;var _0x338115=_0x3189[_0xe2253b];return _0x338115;};'use strict';var Sequelize=require(_0x9318('0x0'));module[_0x9318('0x1')]={'type':{'type':Sequelize['ENUM'](_0x9318('0x2'),'variable',_0x9318('0x3'),'keyValue',_0x9318('0x4')),'defaultValue':_0x9318('0x2')},'content':{'type':Sequelize[_0x9318('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x9318('0x2'),_0x9318('0x6'),_0x9318('0x3'))},'keyContent':{'type':Sequelize[_0x9318('0x5')]},'idField':{'type':Sequelize[_0x9318('0x5')]},'nameField':{'type':Sequelize[_0x9318('0x5')]},'customField':{'type':Sequelize[_0x9318('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9318('0x5')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 6b0d4dd..e6d1c27 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 _0xcf0e=['count','reject','update','then','end','sendStatus','error','name','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','VIRTUAL','filter','merge','options','ServicenowField','includeAll','include','findAll','catch','show','params','keys','find','create','body','destroy','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit'];(function(_0x3e534d,_0x34ebe6){var _0x5666c8=function(_0x1187b3){while(--_0x1187b3){_0x3e534d['push'](_0x3e534d['shift']());}};_0x5666c8(++_0x34ebe6);}(_0xcf0e,0x70));var _0xecf0=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xcf0e[_0x13ea00];return _0x1f7347;};'use strict';var emlformat=require(_0xecf0('0x0'));var rimraf=require(_0xecf0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xecf0('0x2'));var rp=require('request-promise');var moment=require(_0xecf0('0x3'));var BPromise=require(_0xecf0('0x4'));var Mustache=require(_0xecf0('0x5'));var util=require(_0xecf0('0x6'));var path=require(_0xecf0('0x7'));var sox=require('sox');var csv=require(_0xecf0('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xecf0('0x9'));var _=require(_0xecf0('0xa'));var squel=require(_0xecf0('0xb'));var crypto=require(_0xecf0('0xc'));var jsforce=require(_0xecf0('0xd'));var deskjs=require(_0xecf0('0xe'));var toCsv=require(_0xecf0('0x8'));var querystring=require('querystring');var Papa=require(_0xecf0('0xf'));var Redis=require(_0xecf0('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xecf0('0x11'));var as=require(_0xecf0('0x12'));var hardwareService=require(_0xecf0('0x13'));var logger=require('../../config/logger')(_0xecf0('0x14'));var utils=require(_0xecf0('0x15'));var config=require(_0xecf0('0x16'));var licenseUtil=require(_0xecf0('0x17'));var db=require(_0xecf0('0x18'))['db'];function respondWithStatusCode(_0x48d9e4,_0x266f93){_0x266f93=_0x266f93||0xcc;return function(_0x324897){if(_0x324897){return _0x48d9e4['sendStatus'](_0x266f93);}return _0x48d9e4[_0xecf0('0x19')](_0x266f93)['end']();};}function respondWithResult(_0x19f288,_0x4f3174){_0x4f3174=_0x4f3174||0xc8;return function(_0x1b08a0){if(_0x1b08a0){return _0x19f288[_0xecf0('0x19')](_0x4f3174)[_0xecf0('0x1a')](_0x1b08a0);}};}function respondWithFilteredResult(_0x88b7c,_0xd1ff1b){return function(_0x1f1af1){if(_0x1f1af1){var _0x4ffab2=typeof _0xd1ff1b[_0xecf0('0x1b')]===_0xecf0('0x1c')&&typeof _0xd1ff1b[_0xecf0('0x1d')]===_0xecf0('0x1c');var _0x58c184=_0x1f1af1['count'];var _0x5317b3=_0x4ffab2?0x0:_0xd1ff1b['offset'];var _0x2e490b=_0x4ffab2?_0x1f1af1[_0xecf0('0x1e')]:_0xd1ff1b['offset']+_0xd1ff1b[_0xecf0('0x1d')];var _0x4ff00c;if(_0x2e490b>=_0x58c184){_0x2e490b=_0x58c184;_0x4ff00c=0xc8;}else{_0x4ff00c=0xce;}_0x88b7c[_0xecf0('0x19')](_0x4ff00c);return _0x88b7c['set']('Content-Range',_0x5317b3+'-'+_0x2e490b+'/'+_0x58c184)[_0xecf0('0x1a')](_0x1f1af1);}return null;};}function patchUpdates(_0x1448f8){return function(_0x8890c5){try{jsonpatch['apply'](_0x8890c5,_0x1448f8,!![]);}catch(_0x1cb00){return BPromise[_0xecf0('0x1f')](_0x1cb00);}return _0x8890c5['save']();};}function saveUpdates(_0x35138f,_0x5c4fd7){return function(_0x4f724e){if(_0x4f724e){return _0x4f724e[_0xecf0('0x20')](_0x35138f)['then'](function(_0x32b77f){return _0x32b77f;});}return null;};}function removeEntity(_0x21d433,_0xdf5991){return function(_0x51f88b){if(_0x51f88b){return _0x51f88b['destroy']()[_0xecf0('0x21')](function(){_0x21d433['status'](0xcc)[_0xecf0('0x22')]();});}};}function handleEntityNotFound(_0x2c6f0b,_0xeb3784){return function(_0x430812){if(!_0x430812){_0x2c6f0b[_0xecf0('0x23')](0x194);}return _0x430812;};}function handleError(_0x551720,_0x1febba){_0x1febba=_0x1febba||0x1f4;return function(_0xc7631){logger[_0xecf0('0x24')](_0xc7631['stack']);if(_0xc7631['name']){delete _0xc7631[_0xecf0('0x25')];}_0x551720['status'](_0x1febba)['send'](_0xc7631);};}exports[_0xecf0('0x26')]=function(_0x41d36b,_0x3c1c7c){var _0x2a6afd={},_0xe61273={},_0x581e6d={'count':0x0,'rows':[]};var _0xa02551=_[_0xecf0('0x27')](db['ServicenowField'][_0xecf0('0x28')],function(_0x3b24e3){return{'name':_0x3b24e3[_0xecf0('0x29')],'type':_0x3b24e3[_0xecf0('0x2a')][_0xecf0('0x2b')]};});_0xe61273[_0xecf0('0x2c')]=_[_0xecf0('0x27')](_0xa02551,'name');_0xe61273[_0xecf0('0x2d')]=_['keys'](_0x41d36b[_0xecf0('0x2d')]);_0xe61273[_0xecf0('0x2e')]=_[_0xecf0('0x2f')](_0xe61273['model'],_0xe61273[_0xecf0('0x2d')]);_0x2a6afd[_0xecf0('0x30')]=_['intersection'](_0xe61273[_0xecf0('0x2c')],qs[_0xecf0('0x31')](_0x41d36b[_0xecf0('0x2d')][_0xecf0('0x31')]));_0x2a6afd[_0xecf0('0x30')]=_0x2a6afd[_0xecf0('0x30')][_0xecf0('0x32')]?_0x2a6afd[_0xecf0('0x30')]:_0xe61273[_0xecf0('0x2c')];if(!_0x41d36b[_0xecf0('0x2d')][_0xecf0('0x33')]('nolimit')){_0x2a6afd[_0xecf0('0x1d')]=qs[_0xecf0('0x1d')](_0x41d36b[_0xecf0('0x2d')]['limit']);_0x2a6afd['offset']=qs[_0xecf0('0x1b')](_0x41d36b[_0xecf0('0x2d')][_0xecf0('0x1b')]);}_0x2a6afd['order']=qs[_0xecf0('0x34')](_0x41d36b[_0xecf0('0x2d')][_0xecf0('0x34')]);_0x2a6afd[_0xecf0('0x35')]=qs[_0xecf0('0x2e')](_[_0xecf0('0x36')](_0x41d36b[_0xecf0('0x2d')],_0xe61273['filters']),_0xa02551);if(_0x41d36b[_0xecf0('0x2d')]['filter']){_0x2a6afd[_0xecf0('0x35')]=_['merge'](_0x2a6afd[_0xecf0('0x35')],{'$or':_[_0xecf0('0x27')](_0xa02551,function(_0x548b5a){if(_0x548b5a['type']!==_0xecf0('0x37')){var _0xb95d5c={};_0xb95d5c[_0x548b5a[_0xecf0('0x25')]]={'$like':'%'+_0x41d36b[_0xecf0('0x2d')][_0xecf0('0x38')]+'%'};return _0xb95d5c;}})});}_0x2a6afd=_[_0xecf0('0x39')]({},_0x2a6afd,_0x41d36b[_0xecf0('0x3a')]);var _0x462a2d={'where':_0x2a6afd[_0xecf0('0x35')]};return db[_0xecf0('0x3b')][_0xecf0('0x1e')](_0x462a2d)[_0xecf0('0x21')](function(_0x261c35){_0x581e6d['count']=_0x261c35;if(_0x41d36b[_0xecf0('0x2d')][_0xecf0('0x3c')]){_0x2a6afd[_0xecf0('0x3d')]=[{'all':!![]}];}return db[_0xecf0('0x3b')][_0xecf0('0x3e')](_0x2a6afd);})[_0xecf0('0x21')](function(_0x559d35){_0x581e6d['rows']=_0x559d35;return _0x581e6d;})[_0xecf0('0x21')](respondWithFilteredResult(_0x3c1c7c,_0x2a6afd))[_0xecf0('0x3f')](handleError(_0x3c1c7c,null));};exports[_0xecf0('0x40')]=function(_0x4f0464,_0x3dc441){var _0x487003={'raw':!![],'where':{'id':_0x4f0464[_0xecf0('0x41')]['id']}},_0x54d4e9={};_0x54d4e9['model']=_['keys'](db[_0xecf0('0x3b')][_0xecf0('0x28')]);_0x54d4e9['query']=_[_0xecf0('0x42')](_0x4f0464[_0xecf0('0x2d')]);_0x54d4e9['filters']=_['intersection'](_0x54d4e9[_0xecf0('0x2c')],_0x54d4e9['query']);_0x487003[_0xecf0('0x30')]=_[_0xecf0('0x2f')](_0x54d4e9[_0xecf0('0x2c')],qs[_0xecf0('0x31')](_0x4f0464[_0xecf0('0x2d')]['fields']));_0x487003[_0xecf0('0x30')]=_0x487003[_0xecf0('0x30')]['length']?_0x487003[_0xecf0('0x30')]:_0x54d4e9[_0xecf0('0x2c')];if(_0x4f0464[_0xecf0('0x2d')]['includeAll']){_0x487003[_0xecf0('0x3d')]=[{'all':!![]}];}_0x487003=_['merge']({},_0x487003,_0x4f0464['options']);return db['ServicenowField'][_0xecf0('0x43')](_0x487003)[_0xecf0('0x21')](handleEntityNotFound(_0x3dc441,null))[_0xecf0('0x21')](respondWithResult(_0x3dc441,null))[_0xecf0('0x3f')](handleError(_0x3dc441,null));};exports['create']=function(_0x4fc5a0,_0x531e6d){return db['ServicenowField'][_0xecf0('0x44')](_0x4fc5a0[_0xecf0('0x45')],{})[_0xecf0('0x21')](respondWithResult(_0x531e6d,0xc9))[_0xecf0('0x3f')](handleError(_0x531e6d,null));};exports['update']=function(_0x320eed,_0x1c9158){if(_0x320eed[_0xecf0('0x45')]['id']){delete _0x320eed['body']['id'];}return db[_0xecf0('0x3b')][_0xecf0('0x43')]({'where':{'id':_0x320eed[_0xecf0('0x41')]['id']}})[_0xecf0('0x21')](handleEntityNotFound(_0x1c9158,null))[_0xecf0('0x21')](saveUpdates(_0x320eed['body'],null))[_0xecf0('0x21')](respondWithResult(_0x1c9158,null))[_0xecf0('0x3f')](handleError(_0x1c9158,null));};exports[_0xecf0('0x46')]=function(_0x3d5c4e,_0x48eb04){return db[_0xecf0('0x3b')][_0xecf0('0x43')]({'where':{'id':_0x3d5c4e[_0xecf0('0x41')]['id']}})[_0xecf0('0x21')](handleEntityNotFound(_0x48eb04,null))[_0xecf0('0x21')](removeEntity(_0x48eb04,null))[_0xecf0('0x3f')](handleError(_0x48eb04,null));}; \ No newline at end of file +var _0xb4f7=['../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','save','update','then','destroy','stack','name','send','index','map','ServicenowField','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','nolimit','sort','where','pick','VIRTUAL','filter','merge','options','include','findAll','catch','show','includeAll','find','create','body','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x210727,_0x220396){var _0x1f40ef=function(_0x4a6780){while(--_0x4a6780){_0x210727['push'](_0x210727['shift']());}};_0x1f40ef(++_0x220396);}(_0xb4f7,0x7e));var _0x7b4f=function(_0xcaaec0,_0x253fb3){_0xcaaec0=_0xcaaec0-0x0;var _0x1e6ae4=_0xb4f7[_0xcaaec0];return _0x1e6ae4;};'use strict';var emlformat=require(_0x7b4f('0x0'));var rimraf=require(_0x7b4f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7b4f('0x2'));var rp=require(_0x7b4f('0x3'));var moment=require(_0x7b4f('0x4'));var BPromise=require(_0x7b4f('0x5'));var Mustache=require(_0x7b4f('0x6'));var util=require('util');var path=require(_0x7b4f('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7b4f('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x7b4f('0x9'));var crypto=require(_0x7b4f('0xa'));var jsforce=require(_0x7b4f('0xb'));var deskjs=require(_0x7b4f('0xc'));var toCsv=require('to-csv');var querystring=require(_0x7b4f('0xd'));var Papa=require(_0x7b4f('0xe'));var Redis=require(_0x7b4f('0xf'));var authService=require(_0x7b4f('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x7b4f('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7b4f('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x7b4f('0x13'));var licenseUtil=require(_0x7b4f('0x14'));var db=require(_0x7b4f('0x15'))['db'];function respondWithStatusCode(_0x1668ec,_0x388559){_0x388559=_0x388559||0xcc;return function(_0x568d40){if(_0x568d40){return _0x1668ec[_0x7b4f('0x16')](_0x388559);}return _0x1668ec[_0x7b4f('0x17')](_0x388559)[_0x7b4f('0x18')]();};}function respondWithResult(_0x146d31,_0x1715eb){_0x1715eb=_0x1715eb||0xc8;return function(_0x4e80d5){if(_0x4e80d5){return _0x146d31[_0x7b4f('0x17')](_0x1715eb)[_0x7b4f('0x19')](_0x4e80d5);}};}function respondWithFilteredResult(_0x48ffdf,_0x4536e3){return function(_0x7a8bc3){if(_0x7a8bc3){var _0x3c6f9a=typeof _0x4536e3[_0x7b4f('0x1a')]===_0x7b4f('0x1b')&&typeof _0x4536e3['limit']===_0x7b4f('0x1b');var _0x509520=_0x7a8bc3[_0x7b4f('0x1c')];var _0x31c13f=_0x3c6f9a?0x0:_0x4536e3[_0x7b4f('0x1a')];var _0x329e99=_0x3c6f9a?_0x7a8bc3[_0x7b4f('0x1c')]:_0x4536e3[_0x7b4f('0x1a')]+_0x4536e3[_0x7b4f('0x1d')];var _0x53cf9c;if(_0x329e99>=_0x509520){_0x329e99=_0x509520;_0x53cf9c=0xc8;}else{_0x53cf9c=0xce;}_0x48ffdf['status'](_0x53cf9c);return _0x48ffdf[_0x7b4f('0x1e')]('Content-Range',_0x31c13f+'-'+_0x329e99+'/'+_0x509520)['json'](_0x7a8bc3);}return null;};}function patchUpdates(_0x320dbe){return function(_0xae0bd1){try{jsonpatch[_0x7b4f('0x1f')](_0xae0bd1,_0x320dbe,!![]);}catch(_0x3b5e8a){return BPromise['reject'](_0x3b5e8a);}return _0xae0bd1[_0x7b4f('0x20')]();};}function saveUpdates(_0x1de13a,_0x1e821f){return function(_0x2e2d0d){if(_0x2e2d0d){return _0x2e2d0d[_0x7b4f('0x21')](_0x1de13a)[_0x7b4f('0x22')](function(_0x1cd4fa){return _0x1cd4fa;});}return null;};}function removeEntity(_0x3a351c,_0xc7bdab){return function(_0x5e0e9b){if(_0x5e0e9b){return _0x5e0e9b[_0x7b4f('0x23')]()[_0x7b4f('0x22')](function(){_0x3a351c['status'](0xcc)[_0x7b4f('0x18')]();});}};}function handleEntityNotFound(_0x18cd2c,_0x1cdb52){return function(_0x1be8a1){if(!_0x1be8a1){_0x18cd2c[_0x7b4f('0x16')](0x194);}return _0x1be8a1;};}function handleError(_0x662126,_0xedd051){_0xedd051=_0xedd051||0x1f4;return function(_0x33f0b1){logger['error'](_0x33f0b1[_0x7b4f('0x24')]);if(_0x33f0b1[_0x7b4f('0x25')]){delete _0x33f0b1['name'];}_0x662126['status'](_0xedd051)[_0x7b4f('0x26')](_0x33f0b1);};}exports[_0x7b4f('0x27')]=function(_0x136f9f,_0x132bc){var _0x3ce2d7={},_0x45ab10={},_0x3eb260={'count':0x0,'rows':[]};var _0x221357=_[_0x7b4f('0x28')](db[_0x7b4f('0x29')][_0x7b4f('0x2a')],function(_0x527a0a){return{'name':_0x527a0a[_0x7b4f('0x2b')],'type':_0x527a0a[_0x7b4f('0x2c')][_0x7b4f('0x2d')]};});_0x45ab10['model']=_[_0x7b4f('0x28')](_0x221357,_0x7b4f('0x25'));_0x45ab10[_0x7b4f('0x2e')]=_[_0x7b4f('0x2f')](_0x136f9f[_0x7b4f('0x2e')]);_0x45ab10[_0x7b4f('0x30')]=_[_0x7b4f('0x31')](_0x45ab10['model'],_0x45ab10[_0x7b4f('0x2e')]);_0x3ce2d7[_0x7b4f('0x32')]=_[_0x7b4f('0x31')](_0x45ab10[_0x7b4f('0x33')],qs[_0x7b4f('0x34')](_0x136f9f[_0x7b4f('0x2e')][_0x7b4f('0x34')]));_0x3ce2d7[_0x7b4f('0x32')]=_0x3ce2d7[_0x7b4f('0x32')][_0x7b4f('0x35')]?_0x3ce2d7['attributes']:_0x45ab10[_0x7b4f('0x33')];if(!_0x136f9f[_0x7b4f('0x2e')]['hasOwnProperty'](_0x7b4f('0x36'))){_0x3ce2d7['limit']=qs[_0x7b4f('0x1d')](_0x136f9f[_0x7b4f('0x2e')][_0x7b4f('0x1d')]);_0x3ce2d7[_0x7b4f('0x1a')]=qs['offset'](_0x136f9f[_0x7b4f('0x2e')][_0x7b4f('0x1a')]);}_0x3ce2d7['order']=qs['sort'](_0x136f9f[_0x7b4f('0x2e')][_0x7b4f('0x37')]);_0x3ce2d7[_0x7b4f('0x38')]=qs[_0x7b4f('0x30')](_[_0x7b4f('0x39')](_0x136f9f[_0x7b4f('0x2e')],_0x45ab10[_0x7b4f('0x30')]),_0x221357);if(_0x136f9f[_0x7b4f('0x2e')]['filter']){_0x3ce2d7[_0x7b4f('0x38')]=_['merge'](_0x3ce2d7['where'],{'$or':_['map'](_0x221357,function(_0x202c97){if(_0x202c97[_0x7b4f('0x2c')]!==_0x7b4f('0x3a')){var _0xbc7364={};_0xbc7364[_0x202c97[_0x7b4f('0x25')]]={'$like':'%'+_0x136f9f['query'][_0x7b4f('0x3b')]+'%'};return _0xbc7364;}})});}_0x3ce2d7=_[_0x7b4f('0x3c')]({},_0x3ce2d7,_0x136f9f[_0x7b4f('0x3d')]);var _0x3aedcb={'where':_0x3ce2d7[_0x7b4f('0x38')]};return db[_0x7b4f('0x29')]['count'](_0x3aedcb)[_0x7b4f('0x22')](function(_0x1e7dbc){_0x3eb260[_0x7b4f('0x1c')]=_0x1e7dbc;if(_0x136f9f['query']['includeAll']){_0x3ce2d7[_0x7b4f('0x3e')]=[{'all':!![]}];}return db[_0x7b4f('0x29')][_0x7b4f('0x3f')](_0x3ce2d7);})[_0x7b4f('0x22')](function(_0x44a024){_0x3eb260['rows']=_0x44a024;return _0x3eb260;})['then'](respondWithFilteredResult(_0x132bc,_0x3ce2d7))[_0x7b4f('0x40')](handleError(_0x132bc,null));};exports[_0x7b4f('0x41')]=function(_0x48ff73,_0x413f61){var _0x271814={'raw':!![],'where':{'id':_0x48ff73['params']['id']}},_0x4ad0ee={};_0x4ad0ee[_0x7b4f('0x33')]=_[_0x7b4f('0x2f')](db[_0x7b4f('0x29')]['rawAttributes']);_0x4ad0ee[_0x7b4f('0x2e')]=_['keys'](_0x48ff73['query']);_0x4ad0ee[_0x7b4f('0x30')]=_['intersection'](_0x4ad0ee[_0x7b4f('0x33')],_0x4ad0ee[_0x7b4f('0x2e')]);_0x271814[_0x7b4f('0x32')]=_[_0x7b4f('0x31')](_0x4ad0ee[_0x7b4f('0x33')],qs['fields'](_0x48ff73['query'][_0x7b4f('0x34')]));_0x271814['attributes']=_0x271814[_0x7b4f('0x32')][_0x7b4f('0x35')]?_0x271814[_0x7b4f('0x32')]:_0x4ad0ee[_0x7b4f('0x33')];if(_0x48ff73[_0x7b4f('0x2e')][_0x7b4f('0x42')]){_0x271814[_0x7b4f('0x3e')]=[{'all':!![]}];}_0x271814=_[_0x7b4f('0x3c')]({},_0x271814,_0x48ff73[_0x7b4f('0x3d')]);return db[_0x7b4f('0x29')][_0x7b4f('0x43')](_0x271814)[_0x7b4f('0x22')](handleEntityNotFound(_0x413f61,null))[_0x7b4f('0x22')](respondWithResult(_0x413f61,null))[_0x7b4f('0x40')](handleError(_0x413f61,null));};exports['create']=function(_0x25bc2c,_0x527ced){return db['ServicenowField'][_0x7b4f('0x44')](_0x25bc2c['body'],{})[_0x7b4f('0x22')](respondWithResult(_0x527ced,0xc9))[_0x7b4f('0x40')](handleError(_0x527ced,null));};exports[_0x7b4f('0x21')]=function(_0x52a188,_0x2f4794){if(_0x52a188[_0x7b4f('0x45')]['id']){delete _0x52a188[_0x7b4f('0x45')]['id'];}return db[_0x7b4f('0x29')][_0x7b4f('0x43')]({'where':{'id':_0x52a188[_0x7b4f('0x46')]['id']}})['then'](handleEntityNotFound(_0x2f4794,null))[_0x7b4f('0x22')](saveUpdates(_0x52a188[_0x7b4f('0x45')],null))[_0x7b4f('0x22')](respondWithResult(_0x2f4794,null))[_0x7b4f('0x40')](handleError(_0x2f4794,null));};exports['destroy']=function(_0x3ba768,_0x3906ec){return db[_0x7b4f('0x29')][_0x7b4f('0x43')]({'where':{'id':_0x3ba768[_0x7b4f('0x46')]['id']}})['then'](handleEntityNotFound(_0x3906ec,null))[_0x7b4f('0x22')](removeEntity(_0x3906ec,null))[_0x7b4f('0x40')](handleError(_0x3906ec,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index a3a9e05..f460035 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 _0xa54c=['bluebird','request-promise','path','rimraf','./intServicenowField.attributes','exports','ServicenowField','servicenow_unique_index','idField','FieldId','../../config/logger','moment'];(function(_0x305473,_0x392471){var _0x4de111=function(_0x354e46){while(--_0x354e46){_0x305473['push'](_0x305473['shift']());}};_0x4de111(++_0x392471);}(_0xa54c,0x172));var _0xca54=function(_0x235482,_0x14b833){_0x235482=_0x235482-0x0;var _0x5f5bea=_0xa54c[_0x235482];return _0x5f5bea;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xca54('0x0'))('api');var moment=require(_0xca54('0x1'));var BPromise=require(_0xca54('0x2'));var rp=require(_0xca54('0x3'));var fs=require('fs');var path=require(_0xca54('0x4'));var rimraf=require(_0xca54('0x5'));var config=require('../../config/environment');var attributes=require(_0xca54('0x6'));module[_0xca54('0x7')]=function(_0x27d7a5,_0x26927c){return _0x27d7a5['define'](_0xca54('0x8'),attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':_0xca54('0x9'),'fields':[_0xca54('0xa'),_0xca54('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4160=['ServicenowField','servicenow_unique_index','idField','FieldId','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define'];(function(_0x557214,_0x346207){var _0x502630=function(_0x24800f){while(--_0x24800f){_0x557214['push'](_0x557214['shift']());}};_0x502630(++_0x346207);}(_0x4160,0xa9));var _0x0416=function(_0x4e04c0,_0x2b7048){_0x4e04c0=_0x4e04c0-0x0;var _0x1c0230=_0x4160[_0x4e04c0];return _0x1c0230;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x0416('0x0'));var BPromise=require(_0x0416('0x1'));var rp=require(_0x0416('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0416('0x3'));var config=require(_0x0416('0x4'));var attributes=require('./intServicenowField.attributes');module[_0x0416('0x5')]=function(_0x211e08,_0x4c9024){return _0x211e08[_0x0416('0x6')](_0x0416('0x7'),attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':_0x0416('0x8'),'fields':[_0x0416('0x9'),_0x0416('0xa')],'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 c9730a1..9cae9f1 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 _0x70e0=['code','ServicenowField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','ServicenowField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x5a3a40,_0x7d5c99){var _0x362cb9=function(_0x4c510c){while(--_0x4c510c){_0x5a3a40['push'](_0x5a3a40['shift']());}};_0x362cb9(++_0x7d5c99);}(_0x70e0,0x17b));var _0x070e=function(_0xc3c45a,_0x15d1da){_0xc3c45a=_0xc3c45a-0x0;var _0x4b5829=_0x70e0[_0xc3c45a];return _0x4b5829;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x070e('0x3'));var db=require(_0x070e('0x4'))['db'];var utils=require(_0x070e('0x5'));var logger=require(_0x070e('0x6'))('rpc');var config=require(_0x070e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x070e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56e420,_0x5032e5,_0x35ab0c){return new BPromise(function(_0x1e11f0,_0x604664){return client[_0x070e('0x9')](_0x56e420,_0x35ab0c)[_0x070e('0xa')](function(_0x68a09e){logger[_0x070e('0xb')]('ServicenowField,\x20%s,\x20%s',_0x5032e5,'request\x20sent');logger[_0x070e('0xc')](_0x070e('0xd'),_0x5032e5,_0x070e('0xe'),JSON[_0x070e('0xf')](_0x68a09e));if(_0x68a09e[_0x070e('0x10')]){if(_0x68a09e[_0x070e('0x10')][_0x070e('0x11')]===0x1f4){logger[_0x070e('0x10')](_0x070e('0x12'),_0x5032e5,_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);return _0x604664(_0x68a09e['error']['message']);}logger[_0x070e('0x10')]('ServicenowField,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('ServicenowField,\x20%s,\x20%s',_0x5032e5,_0x070e('0xe'));_0x1e11f0(_0x68a09e[_0x070e('0x14')][_0x070e('0x13')]);}})[_0x070e('0x15')](function(_0x5bc71e){logger['error'](_0x070e('0x12'),_0x5032e5,_0x5bc71e);_0x604664(_0x5bc71e);});});} \ No newline at end of file +var _0xda3f=['rpc','jayson/promise','client','request','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','../../mysqldb','../../config/logger'];(function(_0xf4666e,_0x571140){var _0x1853f1=function(_0x5160a5){while(--_0x5160a5){_0xf4666e['push'](_0xf4666e['shift']());}};_0x1853f1(++_0x571140);}(_0xda3f,0xec));var _0xfda3=function(_0x5e657e,_0x3d7d2c){_0x5e657e=_0x5e657e-0x0;var _0x28230c=_0xda3f[_0x5e657e];return _0x28230c;};'use strict';var _=require('lodash');var util=require(_0xfda3('0x0'));var moment=require(_0xfda3('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfda3('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xfda3('0x3'))(_0xfda3('0x4'));var config=require('../../config/environment');var jayson=require(_0xfda3('0x5'));var client=jayson[_0xfda3('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e72d1,_0x316792,_0x42476a){return new BPromise(function(_0x125e2a,_0x4018c0){return client[_0xfda3('0x7')](_0x4e72d1,_0x42476a)[_0xfda3('0x8')](function(_0x46655c){logger[_0xfda3('0x9')](_0xfda3('0xa'),_0x316792,_0xfda3('0xb'));logger[_0xfda3('0xc')](_0xfda3('0xd'),_0x316792,'request\x20sent',JSON[_0xfda3('0xe')](_0x46655c));if(_0x46655c[_0xfda3('0xf')]){if(_0x46655c[_0xfda3('0xf')][_0xfda3('0x10')]===0x1f4){logger[_0xfda3('0xf')]('ServicenowField,\x20%s,\x20%s',_0x316792,_0x46655c[_0xfda3('0xf')]['message']);return _0x4018c0(_0x46655c[_0xfda3('0xf')][_0xfda3('0x11')]);}logger['error']('ServicenowField,\x20%s,\x20%s',_0x316792,_0x46655c['error'][_0xfda3('0x11')]);return _0x125e2a(_0x46655c[_0xfda3('0xf')]['message']);}else{logger['info']('ServicenowField,\x20%s,\x20%s',_0x316792,_0xfda3('0xb'));_0x125e2a(_0x46655c[_0xfda3('0x12')][_0xfda3('0x11')]);}})[_0xfda3('0x13')](function(_0x34900d){logger[_0xfda3('0xf')](_0xfda3('0xa'),_0x316792,_0x34900d);_0x4018c0(_0x34900d);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 810030b..680862a 100644 --- a/server/api/intSugarcrmAccount/index.js +++ b/server/api/intSugarcrmAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x4c01fd,_0x178a95){var _0x159d41=function(_0x2ee3e1){while(--_0x2ee3e1){_0x4c01fd['push'](_0x4c01fd['shift']());}};_0x159d41(++_0x178a95);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +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(_0x786af0,_0x22b795){var _0x3f9b63=function(_0xd21f73){while(--_0xd21f73){_0x786af0['push'](_0x786af0['shift']());}};_0x3f9b63(++_0x22b795);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'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 d222fb6..f7ad335 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(_0x46dde1,_0x2e7e0c){var _0x2db19f=function(_0x32be00){while(--_0x32be00){_0x46dde1['push'](_0x46dde1['shift']());}};_0x2db19f(++_0x2e7e0c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xa9e0[_0x3c4737];return _0x2bb926;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x0a9e('0x3')},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x0a9e('0x2')],'unique':_0x0a9e('0x4')},'serverUrl':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xa9e0=['remoteUri','sequelize','exports','STRING','username'];(function(_0x5e276d,_0x2c8885){var _0x2a677b=function(_0x4dccd8){while(--_0x4dccd8){_0x5e276d['push'](_0x5e276d['shift']());}};_0x2a677b(++_0x2c8885);}(_0xa9e0,0x123));var _0x0a9e=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xa9e0[_0x54d4fe];return _0x1ab5bb;};'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 4ffd5b4..b305b6d 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 _0x801e=['../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','end','stack','name','send','index','map','SugarcrmAccount','rawAttributes','fieldName','key','keys','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','pick','filter','where','merge','type','includeAll','include','findAll','rows','catch','params','length','options','find','create','body','destroy','getConfigurations','findOne','SugarcrmConfiguration','order','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','SugarcrmField','getFields','assigned_user_id','description','date_start','duration_hours','parent_name','direction','username','password','remoteUri','slice','substring','lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','login','JSON','stringify','PLAIN','Invalid\x20Login','Password\x20Expired','Calls','module_fields','remove','includes','label','endsWith','values','value','test','statusCode','error','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x816b8d,_0x38a0c6){var _0x55e47c=function(_0x5c9769){while(--_0x5c9769){_0x816b8d['push'](_0x816b8d['shift']());}};_0x55e47c(++_0x38a0c6);}(_0x801e,0x15d));var _0xe801=function(_0x5c3a6b,_0x2a0d95){_0x5c3a6b=_0x5c3a6b-0x0;var _0x1cadef=_0x801e[_0x5c3a6b];return _0x1cadef;};'use strict';var emlformat=require(_0xe801('0x0'));var rimraf=require(_0xe801('0x1'));var zipdir=require(_0xe801('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe801('0x3'));var moment=require('moment');var BPromise=require(_0xe801('0x4'));var Mustache=require(_0xe801('0x5'));var util=require(_0xe801('0x6'));var path=require(_0xe801('0x7'));var sox=require(_0xe801('0x8'));var csv=require(_0xe801('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe801('0xa'));var _=require('lodash');var squel=require(_0xe801('0xb'));var crypto=require(_0xe801('0xc'));var jsforce=require(_0xe801('0xd'));var deskjs=require(_0xe801('0xe'));var toCsv=require(_0xe801('0x9'));var querystring=require(_0xe801('0xf'));var Papa=require('papaparse');var Redis=require(_0xe801('0x10'));var authService=require(_0xe801('0x11'));var qs=require(_0xe801('0x12'));var as=require(_0xe801('0x13'));var hardwareService=require(_0xe801('0x14'));var logger=require('../../config/logger')(_0xe801('0x15'));var utils=require('../../config/utils');var config=require(_0xe801('0x16'));var licenseUtil=require(_0xe801('0x17'));var db=require(_0xe801('0x18'))['db'];var integrations=require(_0xe801('0x19'));function respondWithStatusCode(_0x131757,_0x51847e){_0x51847e=_0x51847e||0xcc;return function(_0x266eff){if(_0x266eff){return _0x131757[_0xe801('0x1a')](_0x51847e);}return _0x131757[_0xe801('0x1b')](_0x51847e)['end']();};}function respondWithResult(_0x2f0879,_0x30418a){_0x30418a=_0x30418a||0xc8;return function(_0xa9bc48){if(_0xa9bc48){return _0x2f0879[_0xe801('0x1b')](_0x30418a)[_0xe801('0x1c')](_0xa9bc48);}};}function respondWithFilteredResult(_0x203256,_0x5a68fc){return function(_0x473935){if(_0x473935){var _0x45f49a=typeof _0x5a68fc[_0xe801('0x1d')]===_0xe801('0x1e')&&typeof _0x5a68fc[_0xe801('0x1f')]===_0xe801('0x1e');var _0x51bb06=_0x473935[_0xe801('0x20')];var _0x111ba9=_0x45f49a?0x0:_0x5a68fc[_0xe801('0x1d')];var _0x326519=_0x45f49a?_0x473935['count']:_0x5a68fc[_0xe801('0x1d')]+_0x5a68fc[_0xe801('0x1f')];var _0x1a5c29;if(_0x326519>=_0x51bb06){_0x326519=_0x51bb06;_0x1a5c29=0xc8;}else{_0x1a5c29=0xce;}_0x203256[_0xe801('0x1b')](_0x1a5c29);return _0x203256[_0xe801('0x21')](_0xe801('0x22'),_0x111ba9+'-'+_0x326519+'/'+_0x51bb06)['json'](_0x473935);}return null;};}function patchUpdates(_0x531510){return function(_0x48cf27){try{jsonpatch[_0xe801('0x23')](_0x48cf27,_0x531510,!![]);}catch(_0xb86fb6){return BPromise['reject'](_0xb86fb6);}return _0x48cf27[_0xe801('0x24')]();};}function saveUpdates(_0x5aca07,_0x33a2d4){return function(_0x57e3a4){if(_0x57e3a4){return _0x57e3a4[_0xe801('0x25')](_0x5aca07)[_0xe801('0x26')](function(_0x57dfa8){return _0x57dfa8;});}return null;};}function removeEntity(_0x47ad1b,_0x15d713){return function(_0x308f00){if(_0x308f00){return _0x308f00['destroy']()[_0xe801('0x26')](function(){_0x47ad1b[_0xe801('0x1b')](0xcc)[_0xe801('0x27')]();});}};}function handleEntityNotFound(_0x5ec908,_0x514c5e){return function(_0x3dbf64){if(!_0x3dbf64){_0x5ec908[_0xe801('0x1a')](0x194);}return _0x3dbf64;};}function handleError(_0x385a3c,_0x120134){_0x120134=_0x120134||0x1f4;return function(_0x3680f6){logger['error'](_0x3680f6[_0xe801('0x28')]);if(_0x3680f6['name']){delete _0x3680f6[_0xe801('0x29')];}_0x385a3c[_0xe801('0x1b')](_0x120134)[_0xe801('0x2a')](_0x3680f6);};}exports[_0xe801('0x2b')]=function(_0x4be325,_0x1b8a9a){var _0x4b12ea={},_0x21f0d5={},_0x547625={'count':0x0,'rows':[]};var _0x57d813=_[_0xe801('0x2c')](db[_0xe801('0x2d')][_0xe801('0x2e')],function(_0x4d2d1f){return{'name':_0x4d2d1f[_0xe801('0x2f')],'type':_0x4d2d1f['type'][_0xe801('0x30')]};});_0x21f0d5['model']=_[_0xe801('0x2c')](_0x57d813,_0xe801('0x29'));_0x21f0d5['query']=_[_0xe801('0x31')](_0x4be325[_0xe801('0x32')]);_0x21f0d5[_0xe801('0x33')]=_[_0xe801('0x34')](_0x21f0d5[_0xe801('0x35')],_0x21f0d5[_0xe801('0x32')]);_0x4b12ea[_0xe801('0x36')]=_[_0xe801('0x34')](_0x21f0d5[_0xe801('0x35')],qs[_0xe801('0x37')](_0x4be325[_0xe801('0x32')][_0xe801('0x37')]));_0x4b12ea[_0xe801('0x36')]=_0x4b12ea[_0xe801('0x36')]['length']?_0x4b12ea[_0xe801('0x36')]:_0x21f0d5[_0xe801('0x35')];if(!_0x4be325[_0xe801('0x32')][_0xe801('0x38')](_0xe801('0x39'))){_0x4b12ea['limit']=qs[_0xe801('0x1f')](_0x4be325['query'][_0xe801('0x1f')]);_0x4b12ea[_0xe801('0x1d')]=qs[_0xe801('0x1d')](_0x4be325[_0xe801('0x32')][_0xe801('0x1d')]);}_0x4b12ea['order']=qs[_0xe801('0x3a')](_0x4be325[_0xe801('0x32')][_0xe801('0x3a')]);_0x4b12ea['where']=qs['filters'](_[_0xe801('0x3b')](_0x4be325[_0xe801('0x32')],_0x21f0d5[_0xe801('0x33')]),_0x57d813);if(_0x4be325['query'][_0xe801('0x3c')]){_0x4b12ea[_0xe801('0x3d')]=_[_0xe801('0x3e')](_0x4b12ea['where'],{'$or':_[_0xe801('0x2c')](_0x57d813,function(_0x57a368){if(_0x57a368[_0xe801('0x3f')]!=='VIRTUAL'){var _0x475798={};_0x475798[_0x57a368[_0xe801('0x29')]]={'$like':'%'+_0x4be325[_0xe801('0x32')][_0xe801('0x3c')]+'%'};return _0x475798;}})});}_0x4b12ea=_['merge']({},_0x4b12ea,_0x4be325['options']);var _0x82d256={'where':_0x4b12ea['where']};return db[_0xe801('0x2d')]['count'](_0x82d256)['then'](function(_0x164763){_0x547625[_0xe801('0x20')]=_0x164763;if(_0x4be325[_0xe801('0x32')][_0xe801('0x40')]){_0x4b12ea[_0xe801('0x41')]=[{'all':!![]}];}return db[_0xe801('0x2d')][_0xe801('0x42')](_0x4b12ea);})['then'](function(_0x4fcaf6){_0x547625[_0xe801('0x43')]=_0x4fcaf6;return _0x547625;})['then'](respondWithFilteredResult(_0x1b8a9a,_0x4b12ea))[_0xe801('0x44')](handleError(_0x1b8a9a,null));};exports['show']=function(_0x33b9e8,_0x231095){var _0x17e56c={'raw':![],'where':{'id':_0x33b9e8[_0xe801('0x45')]['id']}},_0x22fe7f={};_0x22fe7f[_0xe801('0x35')]=_[_0xe801('0x31')](db[_0xe801('0x2d')][_0xe801('0x2e')]);_0x22fe7f[_0xe801('0x32')]=_[_0xe801('0x31')](_0x33b9e8[_0xe801('0x32')]);_0x22fe7f[_0xe801('0x33')]=_[_0xe801('0x34')](_0x22fe7f[_0xe801('0x35')],_0x22fe7f[_0xe801('0x32')]);_0x17e56c[_0xe801('0x36')]=_[_0xe801('0x34')](_0x22fe7f[_0xe801('0x35')],qs[_0xe801('0x37')](_0x33b9e8[_0xe801('0x32')][_0xe801('0x37')]));_0x17e56c[_0xe801('0x36')]=_0x17e56c['attributes'][_0xe801('0x46')]?_0x17e56c[_0xe801('0x36')]:_0x22fe7f[_0xe801('0x35')];if(_0x33b9e8[_0xe801('0x32')][_0xe801('0x40')]){_0x17e56c['include']=[{'all':!![]}];}_0x17e56c=_[_0xe801('0x3e')]({},_0x17e56c,_0x33b9e8[_0xe801('0x47')]);return db[_0xe801('0x2d')][_0xe801('0x48')](_0x17e56c)['then'](handleEntityNotFound(_0x231095,null))[_0xe801('0x26')](respondWithResult(_0x231095,null))['catch'](handleError(_0x231095,null));};exports['create']=function(_0x3a6ed9,_0x19db7d){return db[_0xe801('0x2d')][_0xe801('0x49')](_0x3a6ed9[_0xe801('0x4a')],{})[_0xe801('0x26')](respondWithResult(_0x19db7d,0xc9))[_0xe801('0x44')](handleError(_0x19db7d,null));};exports[_0xe801('0x25')]=function(_0x1d2a3e,_0x148442){if(_0x1d2a3e[_0xe801('0x4a')]['id']){delete _0x1d2a3e[_0xe801('0x4a')]['id'];}return db[_0xe801('0x2d')][_0xe801('0x48')]({'where':{'id':_0x1d2a3e['params']['id']}})[_0xe801('0x26')](handleEntityNotFound(_0x148442,null))['then'](saveUpdates(_0x1d2a3e[_0xe801('0x4a')],null))['then'](respondWithResult(_0x148442,null))[_0xe801('0x44')](handleError(_0x148442,null));};exports[_0xe801('0x4b')]=function(_0x51a25c,_0x321f35){return db[_0xe801('0x2d')]['find']({'where':{'id':_0x51a25c[_0xe801('0x45')]['id']}})[_0xe801('0x26')](handleEntityNotFound(_0x321f35,null))['then'](removeEntity(_0x321f35,null))['catch'](handleError(_0x321f35,null));};exports[_0xe801('0x4c')]=function(_0x4672ad,_0x3347a4,_0x1e4ded){var _0x362ca7={};var _0x4aac45={};var _0x1628ee;var _0x279e92;return db[_0xe801('0x2d')][_0xe801('0x4d')]({'where':{'id':_0x4672ad[_0xe801('0x45')]['id']}})[_0xe801('0x26')](handleEntityNotFound(_0x3347a4,null))[_0xe801('0x26')](function(_0x5123a5){if(_0x5123a5){_0x1628ee=_0x5123a5;_0x4aac45[_0xe801('0x35')]=_[_0xe801('0x31')](db[_0xe801('0x4e')][_0xe801('0x2e')]);_0x4aac45['query']=_[_0xe801('0x31')](_0x4672ad[_0xe801('0x32')]);_0x4aac45[_0xe801('0x33')]=_[_0xe801('0x34')](_0x4aac45['model'],_0x4aac45[_0xe801('0x32')]);_0x362ca7[_0xe801('0x36')]=_[_0xe801('0x34')](_0x4aac45['model'],qs[_0xe801('0x37')](_0x4672ad[_0xe801('0x32')][_0xe801('0x37')]));_0x362ca7[_0xe801('0x36')]=_0x362ca7[_0xe801('0x36')][_0xe801('0x46')]?_0x362ca7[_0xe801('0x36')]:_0x4aac45[_0xe801('0x35')];_0x362ca7[_0xe801('0x4f')]=qs[_0xe801('0x3a')](_0x4672ad[_0xe801('0x32')][_0xe801('0x3a')]);_0x362ca7[_0xe801('0x3d')]=qs['filters'](_[_0xe801('0x3b')](_0x4672ad[_0xe801('0x32')],_0x4aac45[_0xe801('0x33')]));if(_0x4672ad[_0xe801('0x32')]['filter']){_0x362ca7['where']=_[_0xe801('0x3e')](_0x362ca7[_0xe801('0x3d')],{'$or':_[_0xe801('0x2c')](_0x362ca7[_0xe801('0x36')],function(_0x3a553f){var _0x10077c={};_0x10077c[_0x3a553f]={'$like':'%'+_0x4672ad[_0xe801('0x32')][_0xe801('0x3c')]+'%'};return _0x10077c;})});}_0x362ca7=_['merge']({},_0x362ca7,_0x4672ad[_0xe801('0x47')]);return _0x1628ee[_0xe801('0x4c')](_0x362ca7);}})[_0xe801('0x26')](function(_0x374520){if(_0x374520){_0x279e92=_0x374520[_0xe801('0x46')];if(!_0x4672ad['query']['hasOwnProperty'](_0xe801('0x39'))){_0x362ca7[_0xe801('0x1f')]=qs[_0xe801('0x1f')](_0x4672ad[_0xe801('0x32')]['limit']);_0x362ca7['offset']=qs['offset'](_0x4672ad['query']['offset']);}return _0x1628ee[_0xe801('0x4c')](_0x362ca7);}})[_0xe801('0x26')](function(_0x9d635e){if(_0x9d635e){return _0x9d635e?{'count':_0x279e92,'rows':_0x9d635e}:null;}})[_0xe801('0x26')](respondWithResult(_0x3347a4,null))[_0xe801('0x44')](handleError(_0x3347a4,null));};exports[_0xe801('0x50')]=function(_0x317ca1,_0x536390,_0x3f5218){if(_0x317ca1[_0xe801('0x4a')]['id']){delete _0x317ca1[_0xe801('0x4a')]['id'];}return db[_0xe801('0x2d')][_0xe801('0x4d')]({'where':{'id':_0x317ca1[_0xe801('0x45')]['id']}})[_0xe801('0x26')](handleEntityNotFound(_0x536390,null))[_0xe801('0x26')](function(_0x352668){if(_0x352668){_0x317ca1['body'][_0xe801('0x51')]=_0x352668['id'];_0x317ca1[_0xe801('0x4a')][_0xe801('0x52')]=integrations[_0xe801('0x53')](_0x317ca1[_0xe801('0x4a')]['channel'],_0x317ca1[_0xe801('0x4a')][_0xe801('0x3f')]);_0x317ca1[_0xe801('0x4a')][_0xe801('0x54')]=integrations[_0xe801('0x55')](_0x317ca1[_0xe801('0x4a')][_0xe801('0x56')],_0x317ca1[_0xe801('0x4a')][_0xe801('0x3f')]);return db[_0xe801('0x4e')][_0xe801('0x49')](_0x317ca1[_0xe801('0x4a')],{'include':[{'model':db['SugarcrmField'],'as':_0xe801('0x52')},{'model':db[_0xe801('0x57')],'as':_0xe801('0x54')}]});}return null;})[_0xe801('0x26')](respondWithResult(_0x536390,null))[_0xe801('0x44')](handleError(_0x536390,null));};exports[_0xe801('0x58')]=function(_0x1fb222,_0xe3de4e,_0x3f8f3e){var _0x2ac71c='';var _0x5359a5=['id',_0xe801('0x29'),_0xe801('0x59'),'created_by',_0xe801('0x5a'),_0xe801('0x5b'),_0xe801('0x5c'),'duration_minutes','parent_id','parent_type',_0xe801('0x5d'),_0xe801('0x5e')];return db[_0xe801('0x2d')][_0xe801('0x4d')]({'where':{'id':_0x1fb222['params']['id']},'attributes':['id',_0xe801('0x5f'),_0xe801('0x60'),_0xe801('0x61')]})[_0xe801('0x26')](handleEntityNotFound(_0xe3de4e,null))['then'](function(_0x2a39c1){if(_0x2a39c1){_0x2ac71c=_0x2a39c1[_0xe801('0x61')];var _0x215501=_0x2ac71c[_0xe801('0x62')](-0x1);if(_0x215501==='/'){_0x2ac71c=_0x2ac71c[_0xe801('0x63')](0x0,_0x2ac71c[_0xe801('0x64')](_0x215501));}return rp({'method':_0xe801('0x65'),'uri':util[_0xe801('0x66')](_0xe801('0x67'),_0x2ac71c,_0xe801('0x68')),'json':!![],'form':{'method':_0xe801('0x69'),'input_type':'JSON','response_type':_0xe801('0x6a'),'rest_data':JSON[_0xe801('0x6b')]({'user_auth':{'user_name':_0x2a39c1[_0xe801('0x5f')],'password':_0x2a39c1[_0xe801('0x60')],'encryption':_0xe801('0x6c')},'application':'xCALLY\x20Motion\x20Integration'})}});}})[_0xe801('0x26')](function(_0x48017c){if(_0x48017c&&_0x48017c['name']!==_0xe801('0x6d')&&_0x48017c['name']!==_0xe801('0x6e')){return rp({'method':_0xe801('0x65'),'uri':util['format'](_0xe801('0x67'),_0x2ac71c,_0xe801('0x68')),'json':!![],'form':{'method':'get_module_fields','input_type':_0xe801('0x6a'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x48017c['id'],'module_name':_0xe801('0x6f')})}})[_0xe801('0x26')](function(_0x276907){if(_0x276907){var _0x39f19e=_['values'](_0x276907[_0xe801('0x70')]);_[_0xe801('0x71')](_0x39f19e,function(_0x39d86f){return _0x5359a5[_0xe801('0x72')](_0x39d86f[_0xe801('0x29')]);});return{'count':_0x39f19e[_0xe801('0x46')],'rows':_['map'](_0x39f19e,function(_0x1b8ec3){return{'id':_0x1b8ec3[_0xe801('0x29')],'name':_0x1b8ec3[_0xe801('0x73')],'custom':_[_0xe801('0x74')](_0x1b8ec3[_0xe801('0x29')],'_c')?!![]:![],'options':_0x1b8ec3['options']?_['map'](_[_0xe801('0x75')](_0x1b8ec3[_0xe801('0x47')]),function(_0x1025b8){return{'name':_0x1025b8[_0xe801('0x76')],'value':_0x1025b8[_0xe801('0x29')]};}):[]};})};}})['then'](respondWithResult(_0xe3de4e,null))[_0xe801('0x44')](function(_0x1dff54){var _0x440f4d=_0x1fb222[_0xe801('0x32')][_0xe801('0x77')]?0x1f4:_0x1dff54[_0xe801('0x78')]||0x1f4;logger[_0xe801('0x79')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x440f4d,JSON[_0xe801('0x6b')](_0x1dff54));delete _0x1dff54[_0xe801('0x29')];if(_0x440f4d===0x191){_0x440f4d=0x190;}_0xe3de4e['status'](_0x440f4d)['send'](_0x1fb222[_0xe801('0x32')][_0xe801('0x77')]?{'message':_0xe801('0x7a'),'statusCode':_0x1dff54[_0xe801('0x78')]}:_0x1dff54);});}else{var _0x376a58=0x1f4;_0xe3de4e['status'](_0x376a58)[_0xe801('0x2a')]({'message':_0xe801('0x7a'),'statusCode':0x190});}});}; \ No newline at end of file +var _0xbe4e=['request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','save','then','destroy','error','stack','name','send','map','SugarcrmAccount','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','include','findAll','catch','show','params','create','body','update','find','getConfigurations','findOne','SugarcrmConfiguration','order','options','AccountId','Subjects','channel','Descriptions','getDescriptions','SugarcrmField','getFields','assigned_user_id','created_by','description','date_start','duration_hours','duration_minutes','parent_id','parent_type','parent_name','direction','username','remoteUri','slice','substring','lastIndexOf','format','%s%s','/service/v4_1/rest.php','login','JSON','stringify','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','POST','Calls','values','module_fields','remove','includes','label','endsWith','test','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','fast-json-patch'];(function(_0x5df66e,_0x4ec5bb){var _0x8c0a8f=function(_0x1c8062){while(--_0x1c8062){_0x5df66e['push'](_0x5df66e['shift']());}};_0x8c0a8f(++_0x4ec5bb);}(_0xbe4e,0xf1));var _0xebe4=function(_0x11b24f,_0x39a7e3){_0x11b24f=_0x11b24f-0x0;var _0x1b4798=_0xbe4e[_0x11b24f];return _0x1b4798;};'use strict';var emlformat=require(_0xebe4('0x0'));var rimraf=require(_0xebe4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xebe4('0x2'));var rp=require(_0xebe4('0x3'));var moment=require(_0xebe4('0x4'));var BPromise=require(_0xebe4('0x5'));var Mustache=require(_0xebe4('0x6'));var util=require(_0xebe4('0x7'));var path=require(_0xebe4('0x8'));var sox=require(_0xebe4('0x9'));var csv=require('to-csv');var ejs=require(_0xebe4('0xa'));var fs=require('fs');var fs_extra=require(_0xebe4('0xb'));var _=require(_0xebe4('0xc'));var squel=require(_0xebe4('0xd'));var crypto=require(_0xebe4('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xebe4('0xf'));var toCsv=require('to-csv');var querystring=require(_0xebe4('0x10'));var Papa=require('papaparse');var Redis=require(_0xebe4('0x11'));var authService=require(_0xebe4('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xebe4('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xebe4('0x14'))(_0xebe4('0x15'));var utils=require(_0xebe4('0x16'));var config=require(_0xebe4('0x17'));var licenseUtil=require(_0xebe4('0x18'));var db=require(_0xebe4('0x19'))['db'];var integrations=require(_0xebe4('0x1a'));function respondWithStatusCode(_0x552450,_0x1141d0){_0x1141d0=_0x1141d0||0xcc;return function(_0x40ae58){if(_0x40ae58){return _0x552450[_0xebe4('0x1b')](_0x1141d0);}return _0x552450[_0xebe4('0x1c')](_0x1141d0)[_0xebe4('0x1d')]();};}function respondWithResult(_0x506a51,_0x4b3d3a){_0x4b3d3a=_0x4b3d3a||0xc8;return function(_0x44a54a){if(_0x44a54a){return _0x506a51[_0xebe4('0x1c')](_0x4b3d3a)[_0xebe4('0x1e')](_0x44a54a);}};}function respondWithFilteredResult(_0x5a4ea1,_0x5433ed){return function(_0x49a73c){if(_0x49a73c){var _0x767706=typeof _0x5433ed['offset']===_0xebe4('0x1f')&&typeof _0x5433ed[_0xebe4('0x20')]===_0xebe4('0x1f');var _0x42144c=_0x49a73c[_0xebe4('0x21')];var _0xac291a=_0x767706?0x0:_0x5433ed[_0xebe4('0x22')];var _0xd3390c=_0x767706?_0x49a73c['count']:_0x5433ed['offset']+_0x5433ed[_0xebe4('0x20')];var _0x5498e6;if(_0xd3390c>=_0x42144c){_0xd3390c=_0x42144c;_0x5498e6=0xc8;}else{_0x5498e6=0xce;}_0x5a4ea1['status'](_0x5498e6);return _0x5a4ea1[_0xebe4('0x23')]('Content-Range',_0xac291a+'-'+_0xd3390c+'/'+_0x42144c)[_0xebe4('0x1e')](_0x49a73c);}return null;};}function patchUpdates(_0x2b4f35){return function(_0x31ec4e){try{jsonpatch[_0xebe4('0x24')](_0x31ec4e,_0x2b4f35,!![]);}catch(_0x129649){return BPromise[_0xebe4('0x25')](_0x129649);}return _0x31ec4e[_0xebe4('0x26')]();};}function saveUpdates(_0x4771ef,_0x5421c3){return function(_0x88e081){if(_0x88e081){return _0x88e081['update'](_0x4771ef)[_0xebe4('0x27')](function(_0x21300a){return _0x21300a;});}return null;};}function removeEntity(_0x3f4be4,_0x5eebb8){return function(_0x57ced6){if(_0x57ced6){return _0x57ced6[_0xebe4('0x28')]()['then'](function(){_0x3f4be4['status'](0xcc)[_0xebe4('0x1d')]();});}};}function handleEntityNotFound(_0x5bb877,_0x932a94){return function(_0x4504e9){if(!_0x4504e9){_0x5bb877[_0xebe4('0x1b')](0x194);}return _0x4504e9;};}function handleError(_0x427465,_0x4300e2){_0x4300e2=_0x4300e2||0x1f4;return function(_0x2a275d){logger[_0xebe4('0x29')](_0x2a275d[_0xebe4('0x2a')]);if(_0x2a275d[_0xebe4('0x2b')]){delete _0x2a275d[_0xebe4('0x2b')];}_0x427465[_0xebe4('0x1c')](_0x4300e2)[_0xebe4('0x2c')](_0x2a275d);};}exports['index']=function(_0x2e6c05,_0x5b0c10){var _0x11cf5a={},_0x4b6aad={},_0x5d1f39={'count':0x0,'rows':[]};var _0x5902f5=_[_0xebe4('0x2d')](db[_0xebe4('0x2e')]['rawAttributes'],function(_0x242813){return{'name':_0x242813[_0xebe4('0x2f')],'type':_0x242813[_0xebe4('0x30')][_0xebe4('0x31')]};});_0x4b6aad['model']=_[_0xebe4('0x2d')](_0x5902f5,_0xebe4('0x2b'));_0x4b6aad[_0xebe4('0x32')]=_[_0xebe4('0x33')](_0x2e6c05['query']);_0x4b6aad[_0xebe4('0x34')]=_[_0xebe4('0x35')](_0x4b6aad[_0xebe4('0x36')],_0x4b6aad[_0xebe4('0x32')]);_0x11cf5a['attributes']=_[_0xebe4('0x35')](_0x4b6aad[_0xebe4('0x36')],qs[_0xebe4('0x37')](_0x2e6c05['query']['fields']));_0x11cf5a[_0xebe4('0x38')]=_0x11cf5a[_0xebe4('0x38')][_0xebe4('0x39')]?_0x11cf5a[_0xebe4('0x38')]:_0x4b6aad[_0xebe4('0x36')];if(!_0x2e6c05[_0xebe4('0x32')][_0xebe4('0x3a')](_0xebe4('0x3b'))){_0x11cf5a[_0xebe4('0x20')]=qs[_0xebe4('0x20')](_0x2e6c05[_0xebe4('0x32')][_0xebe4('0x20')]);_0x11cf5a['offset']=qs[_0xebe4('0x22')](_0x2e6c05['query'][_0xebe4('0x22')]);}_0x11cf5a['order']=qs['sort'](_0x2e6c05[_0xebe4('0x32')][_0xebe4('0x3c')]);_0x11cf5a[_0xebe4('0x3d')]=qs[_0xebe4('0x34')](_[_0xebe4('0x3e')](_0x2e6c05[_0xebe4('0x32')],_0x4b6aad['filters']),_0x5902f5);if(_0x2e6c05[_0xebe4('0x32')][_0xebe4('0x3f')]){_0x11cf5a['where']=_[_0xebe4('0x40')](_0x11cf5a[_0xebe4('0x3d')],{'$or':_[_0xebe4('0x2d')](_0x5902f5,function(_0x3e272f){if(_0x3e272f[_0xebe4('0x30')]!==_0xebe4('0x41')){var _0xb43bbe={};_0xb43bbe[_0x3e272f[_0xebe4('0x2b')]]={'$like':'%'+_0x2e6c05[_0xebe4('0x32')][_0xebe4('0x3f')]+'%'};return _0xb43bbe;}})});}_0x11cf5a=_[_0xebe4('0x40')]({},_0x11cf5a,_0x2e6c05['options']);var _0x5c1904={'where':_0x11cf5a[_0xebe4('0x3d')]};return db['SugarcrmAccount'][_0xebe4('0x21')](_0x5c1904)[_0xebe4('0x27')](function(_0x2c65d8){_0x5d1f39[_0xebe4('0x21')]=_0x2c65d8;if(_0x2e6c05[_0xebe4('0x32')]['includeAll']){_0x11cf5a[_0xebe4('0x42')]=[{'all':!![]}];}return db[_0xebe4('0x2e')][_0xebe4('0x43')](_0x11cf5a);})['then'](function(_0x5bb589){_0x5d1f39['rows']=_0x5bb589;return _0x5d1f39;})[_0xebe4('0x27')](respondWithFilteredResult(_0x5b0c10,_0x11cf5a))[_0xebe4('0x44')](handleError(_0x5b0c10,null));};exports[_0xebe4('0x45')]=function(_0x1711bf,_0xdbcc23){var _0xb604f3={'raw':![],'where':{'id':_0x1711bf[_0xebe4('0x46')]['id']}},_0x5a81be={};_0x5a81be['model']=_[_0xebe4('0x33')](db[_0xebe4('0x2e')]['rawAttributes']);_0x5a81be['query']=_[_0xebe4('0x33')](_0x1711bf['query']);_0x5a81be[_0xebe4('0x34')]=_['intersection'](_0x5a81be['model'],_0x5a81be[_0xebe4('0x32')]);_0xb604f3['attributes']=_[_0xebe4('0x35')](_0x5a81be['model'],qs[_0xebe4('0x37')](_0x1711bf['query'][_0xebe4('0x37')]));_0xb604f3[_0xebe4('0x38')]=_0xb604f3[_0xebe4('0x38')][_0xebe4('0x39')]?_0xb604f3[_0xebe4('0x38')]:_0x5a81be[_0xebe4('0x36')];if(_0x1711bf[_0xebe4('0x32')]['includeAll']){_0xb604f3[_0xebe4('0x42')]=[{'all':!![]}];}_0xb604f3=_['merge']({},_0xb604f3,_0x1711bf['options']);return db['SugarcrmAccount']['find'](_0xb604f3)[_0xebe4('0x27')](handleEntityNotFound(_0xdbcc23,null))[_0xebe4('0x27')](respondWithResult(_0xdbcc23,null))[_0xebe4('0x44')](handleError(_0xdbcc23,null));};exports[_0xebe4('0x47')]=function(_0xb0525a,_0x4366cf){return db[_0xebe4('0x2e')][_0xebe4('0x47')](_0xb0525a[_0xebe4('0x48')],{})['then'](respondWithResult(_0x4366cf,0xc9))[_0xebe4('0x44')](handleError(_0x4366cf,null));};exports[_0xebe4('0x49')]=function(_0x307505,_0x46bba6){if(_0x307505[_0xebe4('0x48')]['id']){delete _0x307505[_0xebe4('0x48')]['id'];}return db[_0xebe4('0x2e')]['find']({'where':{'id':_0x307505['params']['id']}})[_0xebe4('0x27')](handleEntityNotFound(_0x46bba6,null))['then'](saveUpdates(_0x307505['body'],null))[_0xebe4('0x27')](respondWithResult(_0x46bba6,null))[_0xebe4('0x44')](handleError(_0x46bba6,null));};exports[_0xebe4('0x28')]=function(_0x2f4e58,_0x37fc5d){return db['SugarcrmAccount'][_0xebe4('0x4a')]({'where':{'id':_0x2f4e58['params']['id']}})[_0xebe4('0x27')](handleEntityNotFound(_0x37fc5d,null))[_0xebe4('0x27')](removeEntity(_0x37fc5d,null))['catch'](handleError(_0x37fc5d,null));};exports[_0xebe4('0x4b')]=function(_0xd92e64,_0x12eca1,_0x1bcfb0){var _0x1a6142={};var _0x581ab0={};var _0x108a4d;var _0x4a194c;return db[_0xebe4('0x2e')][_0xebe4('0x4c')]({'where':{'id':_0xd92e64['params']['id']}})['then'](handleEntityNotFound(_0x12eca1,null))[_0xebe4('0x27')](function(_0x2f0410){if(_0x2f0410){_0x108a4d=_0x2f0410;_0x581ab0['model']=_[_0xebe4('0x33')](db[_0xebe4('0x4d')]['rawAttributes']);_0x581ab0['query']=_[_0xebe4('0x33')](_0xd92e64['query']);_0x581ab0[_0xebe4('0x34')]=_[_0xebe4('0x35')](_0x581ab0[_0xebe4('0x36')],_0x581ab0['query']);_0x1a6142['attributes']=_[_0xebe4('0x35')](_0x581ab0[_0xebe4('0x36')],qs[_0xebe4('0x37')](_0xd92e64[_0xebe4('0x32')][_0xebe4('0x37')]));_0x1a6142[_0xebe4('0x38')]=_0x1a6142[_0xebe4('0x38')][_0xebe4('0x39')]?_0x1a6142[_0xebe4('0x38')]:_0x581ab0[_0xebe4('0x36')];_0x1a6142[_0xebe4('0x4e')]=qs[_0xebe4('0x3c')](_0xd92e64[_0xebe4('0x32')][_0xebe4('0x3c')]);_0x1a6142[_0xebe4('0x3d')]=qs[_0xebe4('0x34')](_[_0xebe4('0x3e')](_0xd92e64[_0xebe4('0x32')],_0x581ab0[_0xebe4('0x34')]));if(_0xd92e64['query'][_0xebe4('0x3f')]){_0x1a6142['where']=_[_0xebe4('0x40')](_0x1a6142[_0xebe4('0x3d')],{'$or':_[_0xebe4('0x2d')](_0x1a6142['attributes'],function(_0x22fdbd){var _0x23cb6a={};_0x23cb6a[_0x22fdbd]={'$like':'%'+_0xd92e64[_0xebe4('0x32')][_0xebe4('0x3f')]+'%'};return _0x23cb6a;})});}_0x1a6142=_[_0xebe4('0x40')]({},_0x1a6142,_0xd92e64[_0xebe4('0x4f')]);return _0x108a4d['getConfigurations'](_0x1a6142);}})['then'](function(_0x30bfcc){if(_0x30bfcc){_0x4a194c=_0x30bfcc[_0xebe4('0x39')];if(!_0xd92e64[_0xebe4('0x32')]['hasOwnProperty'](_0xebe4('0x3b'))){_0x1a6142['limit']=qs['limit'](_0xd92e64[_0xebe4('0x32')][_0xebe4('0x20')]);_0x1a6142[_0xebe4('0x22')]=qs[_0xebe4('0x22')](_0xd92e64['query']['offset']);}return _0x108a4d[_0xebe4('0x4b')](_0x1a6142);}})[_0xebe4('0x27')](function(_0x3bb966){if(_0x3bb966){return _0x3bb966?{'count':_0x4a194c,'rows':_0x3bb966}:null;}})[_0xebe4('0x27')](respondWithResult(_0x12eca1,null))[_0xebe4('0x44')](handleError(_0x12eca1,null));};exports['addConfiguration']=function(_0x24e0d1,_0x378a1d,_0x47eb77){if(_0x24e0d1[_0xebe4('0x48')]['id']){delete _0x24e0d1['body']['id'];}return db[_0xebe4('0x2e')][_0xebe4('0x4c')]({'where':{'id':_0x24e0d1[_0xebe4('0x46')]['id']}})[_0xebe4('0x27')](handleEntityNotFound(_0x378a1d,null))[_0xebe4('0x27')](function(_0x9075f){if(_0x9075f){_0x24e0d1[_0xebe4('0x48')][_0xebe4('0x50')]=_0x9075f['id'];_0x24e0d1[_0xebe4('0x48')][_0xebe4('0x51')]=integrations['getSubjects'](_0x24e0d1['body'][_0xebe4('0x52')],_0x24e0d1[_0xebe4('0x48')][_0xebe4('0x30')]);_0x24e0d1[_0xebe4('0x48')][_0xebe4('0x53')]=integrations[_0xebe4('0x54')](_0x24e0d1[_0xebe4('0x48')][_0xebe4('0x52')],_0x24e0d1[_0xebe4('0x48')][_0xebe4('0x30')]);return db['SugarcrmConfiguration'][_0xebe4('0x47')](_0x24e0d1['body'],{'include':[{'model':db[_0xebe4('0x55')],'as':_0xebe4('0x51')},{'model':db['SugarcrmField'],'as':_0xebe4('0x53')}]});}return null;})['then'](respondWithResult(_0x378a1d,null))[_0xebe4('0x44')](handleError(_0x378a1d,null));};exports[_0xebe4('0x56')]=function(_0x19a6fc,_0x5ec055,_0x48ae81){var _0x3eeb3d='';var _0x3f33a3=['id',_0xebe4('0x2b'),_0xebe4('0x57'),_0xebe4('0x58'),_0xebe4('0x59'),_0xebe4('0x5a'),_0xebe4('0x5b'),_0xebe4('0x5c'),_0xebe4('0x5d'),_0xebe4('0x5e'),_0xebe4('0x5f'),_0xebe4('0x60')];return db[_0xebe4('0x2e')]['findOne']({'where':{'id':_0x19a6fc['params']['id']},'attributes':['id',_0xebe4('0x61'),'password',_0xebe4('0x62')]})['then'](handleEntityNotFound(_0x5ec055,null))[_0xebe4('0x27')](function(_0xe1ad29){if(_0xe1ad29){_0x3eeb3d=_0xe1ad29[_0xebe4('0x62')];var _0x4b05a1=_0x3eeb3d[_0xebe4('0x63')](-0x1);if(_0x4b05a1==='/'){_0x3eeb3d=_0x3eeb3d[_0xebe4('0x64')](0x0,_0x3eeb3d[_0xebe4('0x65')](_0x4b05a1));}return rp({'method':'POST','uri':util[_0xebe4('0x66')](_0xebe4('0x67'),_0x3eeb3d,_0xebe4('0x68')),'json':!![],'form':{'method':_0xebe4('0x69'),'input_type':_0xebe4('0x6a'),'response_type':_0xebe4('0x6a'),'rest_data':JSON[_0xebe4('0x6b')]({'user_auth':{'user_name':_0xe1ad29['username'],'password':_0xe1ad29['password'],'encryption':_0xebe4('0x6c')},'application':_0xebe4('0x6d')})}});}})[_0xebe4('0x27')](function(_0x2723d2){if(_0x2723d2&&_0x2723d2[_0xebe4('0x2b')]!==_0xebe4('0x6e')&&_0x2723d2[_0xebe4('0x2b')]!=='Password\x20Expired'){return rp({'method':_0xebe4('0x6f'),'uri':util[_0xebe4('0x66')](_0xebe4('0x67'),_0x3eeb3d,_0xebe4('0x68')),'json':!![],'form':{'method':'get_module_fields','input_type':_0xebe4('0x6a'),'response_type':_0xebe4('0x6a'),'rest_data':JSON[_0xebe4('0x6b')]({'session':_0x2723d2['id'],'module_name':_0xebe4('0x70')})}})[_0xebe4('0x27')](function(_0x277584){if(_0x277584){var _0x5975fa=_[_0xebe4('0x71')](_0x277584[_0xebe4('0x72')]);_[_0xebe4('0x73')](_0x5975fa,function(_0x333fe1){return _0x3f33a3[_0xebe4('0x74')](_0x333fe1['name']);});return{'count':_0x5975fa['length'],'rows':_[_0xebe4('0x2d')](_0x5975fa,function(_0x3edd03){return{'id':_0x3edd03['name'],'name':_0x3edd03[_0xebe4('0x75')],'custom':_[_0xebe4('0x76')](_0x3edd03['name'],'_c')?!![]:![],'options':_0x3edd03[_0xebe4('0x4f')]?_['map'](_[_0xebe4('0x71')](_0x3edd03[_0xebe4('0x4f')]),function(_0x17ec1b){return{'name':_0x17ec1b['value'],'value':_0x17ec1b['name']};}):[]};})};}})[_0xebe4('0x27')](respondWithResult(_0x5ec055,null))[_0xebe4('0x44')](function(_0x495270){var _0x3f64f7=_0x19a6fc[_0xebe4('0x32')][_0xebe4('0x77')]?0x1f4:_0x495270['statusCode']||0x1f4;logger[_0xebe4('0x29')](_0xebe4('0x78'),'getFields',_0x3f64f7,JSON[_0xebe4('0x6b')](_0x495270));delete _0x495270[_0xebe4('0x2b')];if(_0x3f64f7===0x191){_0x3f64f7=0x190;}_0x5ec055[_0xebe4('0x1c')](_0x3f64f7)[_0xebe4('0x2c')](_0x19a6fc[_0xebe4('0x32')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x495270['statusCode']}:_0x495270);});}else{var _0x2fe2d5=0x1f4;_0x5ec055[_0xebe4('0x1c')](_0x2fe2d5)['send']({'message':_0xebe4('0x79'),'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 7a26ef5..0aa4b6e 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 _0x66d4=['bluebird','request-promise','path','./intSugarcrmAccount.attributes','exports','define','util','api','moment'];(function(_0x306481,_0x20527a){var _0x33d816=function(_0x4fee0e){while(--_0x4fee0e){_0x306481['push'](_0x306481['shift']());}};_0x33d816(++_0x20527a);}(_0x66d4,0x10b));var _0x466d=function(_0x54c9dd,_0x233a86){_0x54c9dd=_0x54c9dd-0x0;var _0x855156=_0x66d4[_0x54c9dd];return _0x855156;};'use strict';var _=require('lodash');var util=require(_0x466d('0x0'));var logger=require('../../config/logger')(_0x466d('0x1'));var moment=require(_0x466d('0x2'));var BPromise=require(_0x466d('0x3'));var rp=require(_0x466d('0x4'));var fs=require('fs');var path=require(_0x466d('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x466d('0x6'));var integrations=require('../../components/integrations/configuration');module[_0x466d('0x7')]=function(_0x201317,_0x3c00e6){return _0x201317[_0x466d('0x8')]('SugarcrmAccount',attributes,{'tableName':'int_sugarcrm_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x758a=['exports','SugarcrmAccount','int_sugarcrm_accounts','lodash','util','../../config/logger','api','moment','bluebird','../../config/environment','../../components/integrations/configuration'];(function(_0x15ebd0,_0x5354df){var _0x239bf3=function(_0x250ac9){while(--_0x250ac9){_0x15ebd0['push'](_0x15ebd0['shift']());}};_0x239bf3(++_0x5354df);}(_0x758a,0x1d1));var _0xa758=function(_0x383461,_0x21eadc){_0x383461=_0x383461-0x0;var _0x298be9=_0x758a[_0x383461];return _0x298be9;};'use strict';var _=require(_0xa758('0x0'));var util=require(_0xa758('0x1'));var logger=require(_0xa758('0x2'))(_0xa758('0x3'));var moment=require(_0xa758('0x4'));var BPromise=require(_0xa758('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa758('0x6'));var attributes=require('./intSugarcrmAccount.attributes');var integrations=require(_0xa758('0x7'));module[_0xa758('0x8')]=function(_0x1c13d4,_0x57bdd1){return _0x1c13d4['define'](_0xa758('0x9'),attributes,{'tableName':_0xa758('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 3e0a727..432e2ee 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 _0x047b=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','options','raw','attributes','limit','model','include','map','GetSugarcrmAccount','ShowSugarcrmAccount','SugarcrmAccount','find','where','lodash','randomstring'];(function(_0x19a54f,_0x1429df){var _0x22729f=function(_0x2f3f2a){while(--_0x2f3f2a){_0x19a54f['push'](_0x19a54f['shift']());}};_0x22729f(++_0x1429df);}(_0x047b,0x64));var _0xb047=function(_0x381589,_0x27a707){_0x381589=_0x381589-0x0;var _0x2a075d=_0x047b[_0x381589];return _0x2a075d;};'use strict';var _=require(_0xb047('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb047('0x1'));var fs=require('fs');var Redis=require(_0xb047('0x2'));var db=require(_0xb047('0x3'))['db'];var utils=require(_0xb047('0x4'));var logger=require(_0xb047('0x5'))(_0xb047('0x6'));var config=require(_0xb047('0x7'));var jayson=require(_0xb047('0x8'));var client=jayson[_0xb047('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32a32b,_0x27bd7b,_0x508766){return new BPromise(function(_0x215dc8,_0x2a9df1){return client[_0xb047('0xa')](_0x32a32b,_0x508766)[_0xb047('0xb')](function(_0x3f5947){logger[_0xb047('0xc')](_0xb047('0xd'),_0x27bd7b,_0xb047('0xe'));logger[_0xb047('0xf')](_0xb047('0x10'),_0x27bd7b,'request\x20sent',JSON[_0xb047('0x11')](_0x3f5947));if(_0x3f5947[_0xb047('0x12')]){if(_0x3f5947[_0xb047('0x12')][_0xb047('0x13')]===0x1f4){logger[_0xb047('0x12')](_0xb047('0xd'),_0x27bd7b,_0x3f5947[_0xb047('0x12')]['message']);return _0x2a9df1(_0x3f5947[_0xb047('0x12')]['message']);}logger[_0xb047('0x12')]('SugarcrmAccount,\x20%s,\x20%s',_0x27bd7b,_0x3f5947[_0xb047('0x12')]['message']);return _0x215dc8(_0x3f5947[_0xb047('0x12')][_0xb047('0x14')]);}else{logger[_0xb047('0xc')](_0xb047('0xd'),_0x27bd7b,_0xb047('0xe'));_0x215dc8(_0x3f5947['result'][_0xb047('0x14')]);}})[_0xb047('0x15')](function(_0x2cd3ae){logger[_0xb047('0x12')](_0xb047('0xd'),_0x27bd7b,_0x2cd3ae);_0x2a9df1(_0x2cd3ae);});});}exports['GetSugarcrmAccount']=function(_0x35c01f){var _0x49bd0d=this;return new Promise(function(_0x1cf1c7,_0x337abc){return db['SugarcrmAccount']['findAll']({'raw':_0x35c01f['options']?_0x35c01f[_0xb047('0x16')][_0xb047('0x17')]===undefined?!![]:![]:!![],'where':_0x35c01f[_0xb047('0x16')]?_0x35c01f['options']['where']||null:null,'attributes':_0x35c01f[_0xb047('0x16')]?_0x35c01f['options'][_0xb047('0x18')]||null:null,'limit':_0x35c01f[_0xb047('0x16')]?_0x35c01f['options'][_0xb047('0x19')]||null:null,'include':_0x35c01f['options']?_0x35c01f['options']['include']?_['map'](_0x35c01f[_0xb047('0x16')]['include'],function(_0x2dd628){return{'model':db[_0x2dd628[_0xb047('0x1a')]],'as':_0x2dd628['as'],'attributes':_0x2dd628[_0xb047('0x18')],'include':_0x2dd628[_0xb047('0x1b')]?_[_0xb047('0x1c')](_0x2dd628[_0xb047('0x1b')],function(_0xee53fe){return{'model':db[_0xee53fe[_0xb047('0x1a')]],'as':_0xee53fe['as'],'attributes':_0xee53fe[_0xb047('0x18')],'include':_0xee53fe[_0xb047('0x1b')]?_[_0xb047('0x1c')](_0xee53fe[_0xb047('0x1b')],function(_0x427b74){return{'model':db[_0x427b74[_0xb047('0x1a')]],'as':_0x427b74['as'],'attributes':_0x427b74[_0xb047('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xa4b3ad){logger[_0xb047('0xc')](_0xb047('0x1d'),_0x35c01f);logger[_0xb047('0xf')]('GetSugarcrmAccount',_0x35c01f,JSON['stringify'](_0xa4b3ad));_0x1cf1c7(_0xa4b3ad);})[_0xb047('0x15')](function(_0x4c13eb){logger[_0xb047('0x12')]('GetSugarcrmAccount',_0x4c13eb[_0xb047('0x14')],_0x35c01f);_0x337abc(_0x49bd0d[_0xb047('0x12')](0x1f4,_0x4c13eb[_0xb047('0x14')]));});});};exports[_0xb047('0x1e')]=function(_0xa803e1){var _0x4dd620=this;return new Promise(function(_0x3adc4c,_0x46919a){return db[_0xb047('0x1f')][_0xb047('0x20')]({'raw':_0xa803e1['options']?_0xa803e1['options'][_0xb047('0x17')]===undefined?!![]:![]:!![],'where':_0xa803e1['options']?_0xa803e1[_0xb047('0x16')][_0xb047('0x21')]||null:null,'attributes':_0xa803e1[_0xb047('0x16')]?_0xa803e1[_0xb047('0x16')]['attributes']||null:null,'include':_0xa803e1[_0xb047('0x16')]?_0xa803e1[_0xb047('0x16')][_0xb047('0x1b')]?_[_0xb047('0x1c')](_0xa803e1[_0xb047('0x16')][_0xb047('0x1b')],function(_0x2ee5ea){return{'model':db[_0x2ee5ea[_0xb047('0x1a')]],'as':_0x2ee5ea['as'],'attributes':_0x2ee5ea['attributes'],'include':_0x2ee5ea[_0xb047('0x1b')]?_[_0xb047('0x1c')](_0x2ee5ea[_0xb047('0x1b')],function(_0x591582){return{'model':db[_0x591582['model']],'as':_0x591582['as'],'attributes':_0x591582[_0xb047('0x18')],'include':_0x591582[_0xb047('0x1b')]?_['map'](_0x591582[_0xb047('0x1b')],function(_0x55f056){return{'model':db[_0x55f056[_0xb047('0x1a')]],'as':_0x55f056['as'],'attributes':_0x55f056['attributes']};}):[]};}):[]};}):[]:[]})[_0xb047('0xb')](function(_0x46d06){logger[_0xb047('0xc')](_0xb047('0x1e'),_0xa803e1);logger['debug'](_0xb047('0x1e'),_0xa803e1,JSON[_0xb047('0x11')](_0x46d06));_0x3adc4c(_0x46d06);})[_0xb047('0x15')](function(_0x3a3e00){logger[_0xb047('0x12')](_0xb047('0x1e'),_0x3a3e00[_0xb047('0x14')],_0xa803e1);_0x46919a(_0x4dd620['error'](0x1f4,_0x3a3e00['message']));});});}; \ No newline at end of file +var _0x437a=['limit','include','attributes','model','map','ShowSugarcrmAccount','find','raw','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SugarcrmAccount,\x20%s,\x20%s','message','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','where'];(function(_0x24cdba,_0x6725ba){var _0x21c413=function(_0x46051a){while(--_0x46051a){_0x24cdba['push'](_0x24cdba['shift']());}};_0x21c413(++_0x6725ba);}(_0x437a,0x1f2));var _0xa437=function(_0x229f8d,_0x48402c){_0x229f8d=_0x229f8d-0x0;var _0x3e193c=_0x437a[_0x229f8d];return _0x3e193c;};'use strict';var _=require(_0xa437('0x0'));var util=require('util');var moment=require(_0xa437('0x1'));var BPromise=require(_0xa437('0x2'));var rs=require(_0xa437('0x3'));var fs=require('fs');var Redis=require(_0xa437('0x4'));var db=require(_0xa437('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xa437('0x6'));var jayson=require(_0xa437('0x7'));var client=jayson[_0xa437('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1a5801,_0x48aeb1,_0x2af7dd){return new BPromise(function(_0x116145,_0x536aa3){return client[_0xa437('0x9')](_0x1a5801,_0x2af7dd)[_0xa437('0xa')](function(_0x5b7793){logger[_0xa437('0xb')]('SugarcrmAccount,\x20%s,\x20%s',_0x48aeb1,_0xa437('0xc'));logger[_0xa437('0xd')](_0xa437('0xe'),_0x48aeb1,_0xa437('0xc'),JSON[_0xa437('0xf')](_0x5b7793));if(_0x5b7793[_0xa437('0x10')]){if(_0x5b7793['error'][_0xa437('0x11')]===0x1f4){logger[_0xa437('0x10')](_0xa437('0x12'),_0x48aeb1,_0x5b7793[_0xa437('0x10')][_0xa437('0x13')]);return _0x536aa3(_0x5b7793[_0xa437('0x10')][_0xa437('0x13')]);}logger[_0xa437('0x10')](_0xa437('0x12'),_0x48aeb1,_0x5b7793[_0xa437('0x10')]['message']);return _0x116145(_0x5b7793[_0xa437('0x10')]['message']);}else{logger[_0xa437('0xb')](_0xa437('0x12'),_0x48aeb1,_0xa437('0xc'));_0x116145(_0x5b7793[_0xa437('0x14')][_0xa437('0x13')]);}})[_0xa437('0x15')](function(_0x3d9839){logger[_0xa437('0x10')](_0xa437('0x12'),_0x48aeb1,_0x3d9839);_0x536aa3(_0x3d9839);});});}exports[_0xa437('0x16')]=function(_0x4d82a8){var _0x4756ca=this;return new Promise(function(_0x2efd5a,_0x5c5648){return db[_0xa437('0x17')][_0xa437('0x18')]({'raw':_0x4d82a8[_0xa437('0x19')]?_0x4d82a8['options']['raw']===undefined?!![]:![]:!![],'where':_0x4d82a8[_0xa437('0x19')]?_0x4d82a8[_0xa437('0x19')][_0xa437('0x1a')]||null:null,'attributes':_0x4d82a8['options']?_0x4d82a8[_0xa437('0x19')]['attributes']||null:null,'limit':_0x4d82a8[_0xa437('0x19')]?_0x4d82a8[_0xa437('0x19')][_0xa437('0x1b')]||null:null,'include':_0x4d82a8['options']?_0x4d82a8[_0xa437('0x19')][_0xa437('0x1c')]?_['map'](_0x4d82a8[_0xa437('0x19')][_0xa437('0x1c')],function(_0x58aa00){return{'model':db[_0x58aa00['model']],'as':_0x58aa00['as'],'attributes':_0x58aa00[_0xa437('0x1d')],'include':_0x58aa00[_0xa437('0x1c')]?_['map'](_0x58aa00[_0xa437('0x1c')],function(_0x94aaba){return{'model':db[_0x94aaba[_0xa437('0x1e')]],'as':_0x94aaba['as'],'attributes':_0x94aaba[_0xa437('0x1d')],'include':_0x94aaba['include']?_[_0xa437('0x1f')](_0x94aaba[_0xa437('0x1c')],function(_0x3da1e0){return{'model':db[_0x3da1e0[_0xa437('0x1e')]],'as':_0x3da1e0['as'],'attributes':_0x3da1e0[_0xa437('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xa437('0xa')](function(_0x1ddee8){logger[_0xa437('0xb')](_0xa437('0x16'),_0x4d82a8);logger['debug'](_0xa437('0x16'),_0x4d82a8,JSON[_0xa437('0xf')](_0x1ddee8));_0x2efd5a(_0x1ddee8);})[_0xa437('0x15')](function(_0x3c0417){logger[_0xa437('0x10')](_0xa437('0x16'),_0x3c0417['message'],_0x4d82a8);_0x5c5648(_0x4756ca[_0xa437('0x10')](0x1f4,_0x3c0417[_0xa437('0x13')]));});});};exports[_0xa437('0x20')]=function(_0x28182b){var _0x299f4f=this;return new Promise(function(_0x17e385,_0x48fa05){return db[_0xa437('0x17')][_0xa437('0x21')]({'raw':_0x28182b['options']?_0x28182b[_0xa437('0x19')][_0xa437('0x22')]===undefined?!![]:![]:!![],'where':_0x28182b['options']?_0x28182b[_0xa437('0x19')]['where']||null:null,'attributes':_0x28182b['options']?_0x28182b[_0xa437('0x19')]['attributes']||null:null,'include':_0x28182b[_0xa437('0x19')]?_0x28182b['options'][_0xa437('0x1c')]?_[_0xa437('0x1f')](_0x28182b[_0xa437('0x19')]['include'],function(_0x5daf9c){return{'model':db[_0x5daf9c[_0xa437('0x1e')]],'as':_0x5daf9c['as'],'attributes':_0x5daf9c[_0xa437('0x1d')],'include':_0x5daf9c[_0xa437('0x1c')]?_[_0xa437('0x1f')](_0x5daf9c[_0xa437('0x1c')],function(_0x29a8c1){return{'model':db[_0x29a8c1[_0xa437('0x1e')]],'as':_0x29a8c1['as'],'attributes':_0x29a8c1[_0xa437('0x1d')],'include':_0x29a8c1[_0xa437('0x1c')]?_[_0xa437('0x1f')](_0x29a8c1[_0xa437('0x1c')],function(_0x38f1ea){return{'model':db[_0x38f1ea[_0xa437('0x1e')]],'as':_0x38f1ea['as'],'attributes':_0x38f1ea['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x47109f){logger['info'](_0xa437('0x20'),_0x28182b);logger['debug'](_0xa437('0x20'),_0x28182b,JSON[_0xa437('0xf')](_0x47109f));_0x17e385(_0x47109f);})[_0xa437('0x15')](function(_0x5013cd){logger[_0xa437('0x10')](_0xa437('0x20'),_0x5013cd['message'],_0x28182b);_0x48fa05(_0x299f4f[_0xa437('0x10')](0x1f4,_0x5013cd[_0xa437('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index bba6d3c..3807993 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 _0xefe2=['show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','update','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id'];(function(_0x37b9ab,_0x8cdef0){var _0x2b2115=function(_0x19f6b9){while(--_0x19f6b9){_0x37b9ab['push'](_0x37b9ab['shift']());}};_0x2b2115(++_0x8cdef0);}(_0xefe2,0xe6));var _0x2efe=function(_0x3bb942,_0xd54c44){_0x3bb942=_0x3bb942-0x0;var _0x2c9be2=_0xefe2[_0x3bb942];return _0x2c9be2;};'use strict';var multer=require(_0x2efe('0x0'));var util=require(_0x2efe('0x1'));var path=require(_0x2efe('0x2'));var timeout=require('connect-timeout');var express=require(_0x2efe('0x3'));var router=express[_0x2efe('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2efe('0x5'));var interaction=require(_0x2efe('0x6'));var config=require(_0x2efe('0x7'));var controller=require('./intSugarcrmConfiguration.controller');router[_0x2efe('0x8')]('/',auth[_0x2efe('0x9')](),controller[_0x2efe('0xa')]);router[_0x2efe('0x8')](_0x2efe('0xb'),auth[_0x2efe('0x9')](),controller[_0x2efe('0xc')]);router[_0x2efe('0x8')]('/:id/fields',auth[_0x2efe('0x9')](),controller[_0x2efe('0xd')]);router['get'](_0x2efe('0xe'),auth[_0x2efe('0x9')](),controller[_0x2efe('0xf')]);router[_0x2efe('0x8')](_0x2efe('0x10'),auth[_0x2efe('0x9')](),controller[_0x2efe('0x11')]);router[_0x2efe('0x12')]('/',auth[_0x2efe('0x9')](),controller[_0x2efe('0x13')]);router['put'](_0x2efe('0xb'),auth[_0x2efe('0x9')](),controller[_0x2efe('0x14')]);router['delete'](_0x2efe('0xb'),auth[_0x2efe('0x9')](),controller['destroy']);module[_0x2efe('0x15')]=router; \ No newline at end of file +var _0x047f=['isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','create','put','update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id'];(function(_0x32d124,_0x4d7a1d){var _0x613e0b=function(_0x5998ec){while(--_0x5998ec){_0x32d124['push'](_0x32d124['shift']());}};_0x613e0b(++_0x4d7a1d);}(_0x047f,0xfc));var _0xf047=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x047f[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xf047('0x0'));var util=require(_0xf047('0x1'));var path=require(_0xf047('0x2'));var timeout=require(_0xf047('0x3'));var express=require('express');var router=express[_0xf047('0x4')]();var fs_extra=require(_0xf047('0x5'));var auth=require(_0xf047('0x6'));var interaction=require(_0xf047('0x7'));var config=require(_0xf047('0x8'));var controller=require('./intSugarcrmConfiguration.controller');router[_0xf047('0x9')]('/',auth['isAuthenticated'](),controller[_0xf047('0xa')]);router[_0xf047('0x9')](_0xf047('0xb'),auth[_0xf047('0xc')](),controller[_0xf047('0xd')]);router[_0xf047('0x9')](_0xf047('0xe'),auth['isAuthenticated'](),controller[_0xf047('0xf')]);router['get'](_0xf047('0x10'),auth[_0xf047('0xc')](),controller[_0xf047('0x11')]);router[_0xf047('0x9')]('/:id/descriptions',auth[_0xf047('0xc')](),controller[_0xf047('0x12')]);router['post']('/',auth['isAuthenticated'](),controller[_0xf047('0x13')]);router[_0xf047('0x14')]('/:id',auth[_0xf047('0xc')](),controller[_0xf047('0x15')]);router['delete'](_0xf047('0xb'),auth[_0xf047('0xc')](),controller[_0xf047('0x16')]);module[_0xf047('0x17')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 04f9560..b9f076e 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 _0xa09b=['STRING','sequelize','exports'];(function(_0x18a79d,_0x57bd2c){var _0x4f8848=function(_0x28af80){while(--_0x28af80){_0x18a79d['push'](_0x18a79d['shift']());}};_0x4f8848(++_0x57bd2c);}(_0xa09b,0x1c6));var _0xba09=function(_0x5d8ef7,_0x5373aa){_0x5d8ef7=_0x5d8ef7-0x0;var _0x5c35d6=_0xa09b[_0x5d8ef7];return _0x5c35d6;};'use strict';var Sequelize=require(_0xba09('0x0'));module[_0xba09('0x1')]={'name':{'type':Sequelize[_0xba09('0x2')]},'description':{'type':Sequelize[_0xba09('0x2')]}}; \ No newline at end of file +var _0x3e26=['exports','STRING','sequelize'];(function(_0x20b504,_0x329d95){var _0x2cf438=function(_0x122f75){while(--_0x122f75){_0x20b504['push'](_0x20b504['shift']());}};_0x2cf438(++_0x329d95);}(_0x3e26,0xd4));var _0x63e2=function(_0x570729,_0x16789c){_0x570729=_0x570729-0x0;var _0x1da797=_0x3e26[_0x570729];return _0x1da797;};'use strict';var Sequelize=require(_0x63e2('0x0'));module[_0x63e2('0x1')]={'name':{'type':Sequelize[_0x63e2('0x2')]},'description':{'type':Sequelize[_0x63e2('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 117b0f8..6a41443 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 _0x3c1c=['map','SugarcrmConfiguration','rawAttributes','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','keys','includeAll','find','create','body','destroy','getFields','findOne','order','getSubjects','SugarcrmField','getDescriptions','rimraf','zip-dir','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','Content-Range','apply','reject','update','then','stack','name','send','index'];(function(_0x1c691e,_0xa229){var _0x1eb9e3=function(_0x4b9bc2){while(--_0x4b9bc2){_0x1c691e['push'](_0x1c691e['shift']());}};_0x1eb9e3(++_0xa229);}(_0x3c1c,0x1ef));var _0xc3c1=function(_0x1caf3f,_0x1b4800){_0x1caf3f=_0x1caf3f-0x0;var _0x1905f0=_0x3c1c[_0x1caf3f];return _0x1905f0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc3c1('0x0'));var zipdir=require(_0xc3c1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xc3c1('0x2'));var BPromise=require(_0xc3c1('0x3'));var Mustache=require(_0xc3c1('0x4'));var util=require(_0xc3c1('0x5'));var path=require(_0xc3c1('0x6'));var sox=require('sox');var csv=require(_0xc3c1('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc3c1('0x8'));var _=require(_0xc3c1('0x9'));var squel=require(_0xc3c1('0xa'));var crypto=require(_0xc3c1('0xb'));var jsforce=require(_0xc3c1('0xc'));var deskjs=require(_0xc3c1('0xd'));var toCsv=require(_0xc3c1('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xc3c1('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xc3c1('0xf'));var hardwareService=require(_0xc3c1('0x10'));var logger=require(_0xc3c1('0x11'))('api');var utils=require(_0xc3c1('0x12'));var config=require(_0xc3c1('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xc3c1('0x14'))['db'];function respondWithStatusCode(_0xe84f07,_0x1f807d){_0x1f807d=_0x1f807d||0xcc;return function(_0x2ea93c){if(_0x2ea93c){return _0xe84f07[_0xc3c1('0x15')](_0x1f807d);}return _0xe84f07['status'](_0x1f807d)['end']();};}function respondWithResult(_0x3c003e,_0x56e38a){_0x56e38a=_0x56e38a||0xc8;return function(_0x9c636d){if(_0x9c636d){return _0x3c003e[_0xc3c1('0x16')](_0x56e38a)[_0xc3c1('0x17')](_0x9c636d);}};}function respondWithFilteredResult(_0x143d9a,_0x5372c7){return function(_0x16f697){if(_0x16f697){var _0x3b4548=typeof _0x5372c7[_0xc3c1('0x18')]===_0xc3c1('0x19')&&typeof _0x5372c7['limit']===_0xc3c1('0x19');var _0x5382f1=_0x16f697[_0xc3c1('0x1a')];var _0x182899=_0x3b4548?0x0:_0x5372c7[_0xc3c1('0x18')];var _0x33f481=_0x3b4548?_0x16f697['count']:_0x5372c7[_0xc3c1('0x18')]+_0x5372c7[_0xc3c1('0x1b')];var _0x178793;if(_0x33f481>=_0x5382f1){_0x33f481=_0x5382f1;_0x178793=0xc8;}else{_0x178793=0xce;}_0x143d9a['status'](_0x178793);return _0x143d9a['set'](_0xc3c1('0x1c'),_0x182899+'-'+_0x33f481+'/'+_0x5382f1)[_0xc3c1('0x17')](_0x16f697);}return null;};}function patchUpdates(_0x5b0bf7){return function(_0x439b19){try{jsonpatch[_0xc3c1('0x1d')](_0x439b19,_0x5b0bf7,!![]);}catch(_0x25c389){return BPromise[_0xc3c1('0x1e')](_0x25c389);}return _0x439b19['save']();};}function saveUpdates(_0x193a6f,_0x346853){return function(_0x3bae43){if(_0x3bae43){return _0x3bae43[_0xc3c1('0x1f')](_0x193a6f)[_0xc3c1('0x20')](function(_0x1f745b){return _0x1f745b;});}return null;};}function removeEntity(_0x242680,_0x458a4f){return function(_0x5cca1d){if(_0x5cca1d){return _0x5cca1d['destroy']()[_0xc3c1('0x20')](function(){_0x242680['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x31caf0,_0x1852e2){return function(_0x490af5){if(!_0x490af5){_0x31caf0[_0xc3c1('0x15')](0x194);}return _0x490af5;};}function handleError(_0x388989,_0x2d61b2){_0x2d61b2=_0x2d61b2||0x1f4;return function(_0xb9e5ad){logger['error'](_0xb9e5ad[_0xc3c1('0x21')]);if(_0xb9e5ad[_0xc3c1('0x22')]){delete _0xb9e5ad[_0xc3c1('0x22')];}_0x388989['status'](_0x2d61b2)[_0xc3c1('0x23')](_0xb9e5ad);};}exports[_0xc3c1('0x24')]=function(_0x29f00b,_0x12f1ed){var _0x13c451={},_0x424507={},_0x5390bd={'count':0x0,'rows':[]};var _0x21e324=_[_0xc3c1('0x25')](db[_0xc3c1('0x26')][_0xc3c1('0x27')],function(_0x32185a){return{'name':_0x32185a['fieldName'],'type':_0x32185a[_0xc3c1('0x28')][_0xc3c1('0x29')]};});_0x424507['model']=_[_0xc3c1('0x25')](_0x21e324,_0xc3c1('0x22'));_0x424507[_0xc3c1('0x2a')]=_['keys'](_0x29f00b[_0xc3c1('0x2a')]);_0x424507[_0xc3c1('0x2b')]=_[_0xc3c1('0x2c')](_0x424507[_0xc3c1('0x2d')],_0x424507['query']);_0x13c451['attributes']=_[_0xc3c1('0x2c')](_0x424507['model'],qs[_0xc3c1('0x2e')](_0x29f00b['query'][_0xc3c1('0x2e')]));_0x13c451[_0xc3c1('0x2f')]=_0x13c451[_0xc3c1('0x2f')][_0xc3c1('0x30')]?_0x13c451[_0xc3c1('0x2f')]:_0x424507[_0xc3c1('0x2d')];if(!_0x29f00b[_0xc3c1('0x2a')][_0xc3c1('0x31')](_0xc3c1('0x32'))){_0x13c451[_0xc3c1('0x1b')]=qs['limit'](_0x29f00b['query'][_0xc3c1('0x1b')]);_0x13c451[_0xc3c1('0x18')]=qs[_0xc3c1('0x18')](_0x29f00b[_0xc3c1('0x2a')][_0xc3c1('0x18')]);}_0x13c451['order']=qs[_0xc3c1('0x33')](_0x29f00b['query'][_0xc3c1('0x33')]);_0x13c451[_0xc3c1('0x34')]=qs['filters'](_[_0xc3c1('0x35')](_0x29f00b[_0xc3c1('0x2a')],_0x424507[_0xc3c1('0x2b')]),_0x21e324);if(_0x29f00b['query'][_0xc3c1('0x36')]){_0x13c451[_0xc3c1('0x34')]=_[_0xc3c1('0x37')](_0x13c451[_0xc3c1('0x34')],{'$or':_[_0xc3c1('0x25')](_0x21e324,function(_0x383253){if(_0x383253[_0xc3c1('0x28')]!==_0xc3c1('0x38')){var _0xb972ad={};_0xb972ad[_0x383253[_0xc3c1('0x22')]]={'$like':'%'+_0x29f00b['query'][_0xc3c1('0x36')]+'%'};return _0xb972ad;}})});}_0x13c451=_['merge']({},_0x13c451,_0x29f00b[_0xc3c1('0x39')]);var _0x2ec82c={'where':_0x13c451[_0xc3c1('0x34')]};return db['SugarcrmConfiguration'][_0xc3c1('0x1a')](_0x2ec82c)[_0xc3c1('0x20')](function(_0x1de98b){_0x5390bd[_0xc3c1('0x1a')]=_0x1de98b;if(_0x29f00b[_0xc3c1('0x2a')]['includeAll']){_0x13c451[_0xc3c1('0x3a')]=[{'all':!![]}];}return db[_0xc3c1('0x26')][_0xc3c1('0x3b')](_0x13c451);})[_0xc3c1('0x20')](function(_0x1ec3e7){_0x5390bd[_0xc3c1('0x3c')]=_0x1ec3e7;return _0x5390bd;})[_0xc3c1('0x20')](respondWithFilteredResult(_0x12f1ed,_0x13c451))[_0xc3c1('0x3d')](handleError(_0x12f1ed,null));};exports[_0xc3c1('0x3e')]=function(_0x31e822,_0x2eb607){var _0x514107={'raw':![],'where':{'id':_0x31e822[_0xc3c1('0x3f')]['id']}},_0x8f4ac1={};_0x8f4ac1['model']=_[_0xc3c1('0x40')](db[_0xc3c1('0x26')][_0xc3c1('0x27')]);_0x8f4ac1[_0xc3c1('0x2a')]=_[_0xc3c1('0x40')](_0x31e822[_0xc3c1('0x2a')]);_0x8f4ac1[_0xc3c1('0x2b')]=_[_0xc3c1('0x2c')](_0x8f4ac1[_0xc3c1('0x2d')],_0x8f4ac1[_0xc3c1('0x2a')]);_0x514107[_0xc3c1('0x2f')]=_['intersection'](_0x8f4ac1[_0xc3c1('0x2d')],qs[_0xc3c1('0x2e')](_0x31e822[_0xc3c1('0x2a')][_0xc3c1('0x2e')]));_0x514107[_0xc3c1('0x2f')]=_0x514107[_0xc3c1('0x2f')][_0xc3c1('0x30')]?_0x514107['attributes']:_0x8f4ac1[_0xc3c1('0x2d')];if(_0x31e822[_0xc3c1('0x2a')][_0xc3c1('0x41')]){_0x514107[_0xc3c1('0x3a')]=[{'all':!![]}];}_0x514107=_[_0xc3c1('0x37')]({},_0x514107,_0x31e822[_0xc3c1('0x39')]);return db['SugarcrmConfiguration'][_0xc3c1('0x42')](_0x514107)[_0xc3c1('0x20')](handleEntityNotFound(_0x2eb607,null))[_0xc3c1('0x20')](respondWithResult(_0x2eb607,null))[_0xc3c1('0x3d')](handleError(_0x2eb607,null));};exports[_0xc3c1('0x43')]=function(_0x273e19,_0xc8aebb){return db['SugarcrmConfiguration'][_0xc3c1('0x43')](_0x273e19[_0xc3c1('0x44')],{})[_0xc3c1('0x20')](respondWithResult(_0xc8aebb,0xc9))[_0xc3c1('0x3d')](handleError(_0xc8aebb,null));};exports[_0xc3c1('0x1f')]=function(_0x7ad4d7,_0xce8e6a){if(_0x7ad4d7[_0xc3c1('0x44')]['id']){delete _0x7ad4d7[_0xc3c1('0x44')]['id'];}return db[_0xc3c1('0x26')][_0xc3c1('0x42')]({'where':{'id':_0x7ad4d7[_0xc3c1('0x3f')]['id']}})['then'](handleEntityNotFound(_0xce8e6a,null))['then'](saveUpdates(_0x7ad4d7[_0xc3c1('0x44')],null))[_0xc3c1('0x20')](respondWithResult(_0xce8e6a,null))['catch'](handleError(_0xce8e6a,null));};exports[_0xc3c1('0x45')]=function(_0x2bc9f5,_0x3e54f5){return db[_0xc3c1('0x26')][_0xc3c1('0x42')]({'where':{'id':_0x2bc9f5[_0xc3c1('0x3f')]['id']}})[_0xc3c1('0x20')](handleEntityNotFound(_0x3e54f5,null))[_0xc3c1('0x20')](removeEntity(_0x3e54f5,null))['catch'](handleError(_0x3e54f5,null));};exports[_0xc3c1('0x46')]=function(_0x66dc03,_0x3129b5,_0x393e49){var _0x467689={};var _0x207bd7={};var _0x40edaa;var _0x25610c;return db[_0xc3c1('0x26')][_0xc3c1('0x47')]({'where':{'id':_0x66dc03[_0xc3c1('0x3f')]['id']}})['then'](handleEntityNotFound(_0x3129b5,null))[_0xc3c1('0x20')](function(_0x229dd0){if(_0x229dd0){_0x40edaa=_0x229dd0;_0x207bd7[_0xc3c1('0x2d')]=_[_0xc3c1('0x40')](db['SugarcrmField']['rawAttributes']);_0x207bd7['query']=_['keys'](_0x66dc03[_0xc3c1('0x2a')]);_0x207bd7[_0xc3c1('0x2b')]=_[_0xc3c1('0x2c')](_0x207bd7[_0xc3c1('0x2d')],_0x207bd7['query']);_0x467689[_0xc3c1('0x2f')]=_['intersection'](_0x207bd7['model'],qs[_0xc3c1('0x2e')](_0x66dc03['query'][_0xc3c1('0x2e')]));_0x467689[_0xc3c1('0x2f')]=_0x467689[_0xc3c1('0x2f')][_0xc3c1('0x30')]?_0x467689[_0xc3c1('0x2f')]:_0x207bd7[_0xc3c1('0x2d')];_0x467689[_0xc3c1('0x48')]=qs[_0xc3c1('0x33')](_0x66dc03[_0xc3c1('0x2a')][_0xc3c1('0x33')]);_0x467689[_0xc3c1('0x34')]=qs[_0xc3c1('0x2b')](_[_0xc3c1('0x35')](_0x66dc03[_0xc3c1('0x2a')],_0x207bd7[_0xc3c1('0x2b')]));if(_0x66dc03[_0xc3c1('0x2a')][_0xc3c1('0x36')]){_0x467689[_0xc3c1('0x34')]=_[_0xc3c1('0x37')](_0x467689[_0xc3c1('0x34')],{'$or':_[_0xc3c1('0x25')](_0x467689[_0xc3c1('0x2f')],function(_0x330c8f){var _0x2c27ea={};_0x2c27ea[_0x330c8f]={'$like':'%'+_0x66dc03['query'][_0xc3c1('0x36')]+'%'};return _0x2c27ea;})});}_0x467689=_[_0xc3c1('0x37')]({},_0x467689,_0x66dc03['options']);return _0x40edaa['getFields'](_0x467689);}})[_0xc3c1('0x20')](function(_0x33b6c7){if(_0x33b6c7){_0x25610c=_0x33b6c7[_0xc3c1('0x30')];if(!_0x66dc03[_0xc3c1('0x2a')][_0xc3c1('0x31')](_0xc3c1('0x32'))){_0x467689[_0xc3c1('0x1b')]=qs[_0xc3c1('0x1b')](_0x66dc03[_0xc3c1('0x2a')]['limit']);_0x467689[_0xc3c1('0x18')]=qs['offset'](_0x66dc03[_0xc3c1('0x2a')]['offset']);}return _0x40edaa[_0xc3c1('0x46')](_0x467689);}})[_0xc3c1('0x20')](function(_0x2f1aa9){if(_0x2f1aa9){return _0x2f1aa9?{'count':_0x25610c,'rows':_0x2f1aa9}:null;}})[_0xc3c1('0x20')](respondWithResult(_0x3129b5,null))['catch'](handleError(_0x3129b5,null));};exports[_0xc3c1('0x49')]=function(_0x1e4698,_0x80b706,_0x9f93dd){var _0x34f4d8={};var _0x1d9794={};var _0x679df3;var _0x4c5b49;return db[_0xc3c1('0x26')][_0xc3c1('0x47')]({'where':{'id':_0x1e4698['params']['id']}})[_0xc3c1('0x20')](handleEntityNotFound(_0x80b706,null))[_0xc3c1('0x20')](function(_0x4a9eb6){if(_0x4a9eb6){_0x679df3=_0x4a9eb6;_0x1d9794['model']=_['keys'](db[_0xc3c1('0x4a')][_0xc3c1('0x27')]);_0x1d9794['query']=_[_0xc3c1('0x40')](_0x1e4698[_0xc3c1('0x2a')]);_0x1d9794[_0xc3c1('0x2b')]=_[_0xc3c1('0x2c')](_0x1d9794[_0xc3c1('0x2d')],_0x1d9794['query']);_0x34f4d8[_0xc3c1('0x2f')]=_[_0xc3c1('0x2c')](_0x1d9794['model'],qs[_0xc3c1('0x2e')](_0x1e4698[_0xc3c1('0x2a')][_0xc3c1('0x2e')]));_0x34f4d8[_0xc3c1('0x2f')]=_0x34f4d8[_0xc3c1('0x2f')][_0xc3c1('0x30')]?_0x34f4d8[_0xc3c1('0x2f')]:_0x1d9794[_0xc3c1('0x2d')];_0x34f4d8[_0xc3c1('0x48')]=qs[_0xc3c1('0x33')](_0x1e4698[_0xc3c1('0x2a')][_0xc3c1('0x33')]);_0x34f4d8[_0xc3c1('0x34')]=qs['filters'](_['pick'](_0x1e4698['query'],_0x1d9794[_0xc3c1('0x2b')]));if(_0x1e4698[_0xc3c1('0x2a')][_0xc3c1('0x36')]){_0x34f4d8[_0xc3c1('0x34')]=_[_0xc3c1('0x37')](_0x34f4d8[_0xc3c1('0x34')],{'$or':_[_0xc3c1('0x25')](_0x34f4d8[_0xc3c1('0x2f')],function(_0x2be4ec){var _0x3612f5={};_0x3612f5[_0x2be4ec]={'$like':'%'+_0x1e4698[_0xc3c1('0x2a')][_0xc3c1('0x36')]+'%'};return _0x3612f5;})});}_0x34f4d8=_[_0xc3c1('0x37')]({},_0x34f4d8,_0x1e4698[_0xc3c1('0x39')]);return _0x679df3['getSubjects'](_0x34f4d8);}})[_0xc3c1('0x20')](function(_0x1c66e9){if(_0x1c66e9){_0x4c5b49=_0x1c66e9[_0xc3c1('0x30')];if(!_0x1e4698[_0xc3c1('0x2a')][_0xc3c1('0x31')](_0xc3c1('0x32'))){_0x34f4d8[_0xc3c1('0x1b')]=qs[_0xc3c1('0x1b')](_0x1e4698[_0xc3c1('0x2a')][_0xc3c1('0x1b')]);_0x34f4d8['offset']=qs['offset'](_0x1e4698['query'][_0xc3c1('0x18')]);}return _0x679df3[_0xc3c1('0x49')](_0x34f4d8);}})[_0xc3c1('0x20')](function(_0x4e0208){if(_0x4e0208){return _0x4e0208?{'count':_0x4c5b49,'rows':_0x4e0208}:null;}})[_0xc3c1('0x20')](respondWithResult(_0x80b706,null))[_0xc3c1('0x3d')](handleError(_0x80b706,null));};exports[_0xc3c1('0x4b')]=function(_0x525837,_0x2b1293,_0x10a585){var _0x34772e={};var _0x1ee7e8={};var _0x460612;var _0x16a24f;return db[_0xc3c1('0x26')][_0xc3c1('0x47')]({'where':{'id':_0x525837[_0xc3c1('0x3f')]['id']}})[_0xc3c1('0x20')](handleEntityNotFound(_0x2b1293,null))[_0xc3c1('0x20')](function(_0x5a1e87){if(_0x5a1e87){_0x460612=_0x5a1e87;_0x1ee7e8[_0xc3c1('0x2d')]=_[_0xc3c1('0x40')](db['SugarcrmField'][_0xc3c1('0x27')]);_0x1ee7e8[_0xc3c1('0x2a')]=_[_0xc3c1('0x40')](_0x525837[_0xc3c1('0x2a')]);_0x1ee7e8[_0xc3c1('0x2b')]=_[_0xc3c1('0x2c')](_0x1ee7e8[_0xc3c1('0x2d')],_0x1ee7e8[_0xc3c1('0x2a')]);_0x34772e[_0xc3c1('0x2f')]=_[_0xc3c1('0x2c')](_0x1ee7e8[_0xc3c1('0x2d')],qs[_0xc3c1('0x2e')](_0x525837[_0xc3c1('0x2a')][_0xc3c1('0x2e')]));_0x34772e[_0xc3c1('0x2f')]=_0x34772e['attributes'][_0xc3c1('0x30')]?_0x34772e['attributes']:_0x1ee7e8[_0xc3c1('0x2d')];_0x34772e[_0xc3c1('0x48')]=qs[_0xc3c1('0x33')](_0x525837[_0xc3c1('0x2a')][_0xc3c1('0x33')]);_0x34772e[_0xc3c1('0x34')]=qs[_0xc3c1('0x2b')](_['pick'](_0x525837[_0xc3c1('0x2a')],_0x1ee7e8[_0xc3c1('0x2b')]));if(_0x525837[_0xc3c1('0x2a')]['filter']){_0x34772e[_0xc3c1('0x34')]=_[_0xc3c1('0x37')](_0x34772e[_0xc3c1('0x34')],{'$or':_[_0xc3c1('0x25')](_0x34772e[_0xc3c1('0x2f')],function(_0x2d49af){var _0x2de2e6={};_0x2de2e6[_0x2d49af]={'$like':'%'+_0x525837[_0xc3c1('0x2a')][_0xc3c1('0x36')]+'%'};return _0x2de2e6;})});}_0x34772e=_[_0xc3c1('0x37')]({},_0x34772e,_0x525837[_0xc3c1('0x39')]);return _0x460612[_0xc3c1('0x4b')](_0x34772e);}})['then'](function(_0x155eb3){if(_0x155eb3){_0x16a24f=_0x155eb3[_0xc3c1('0x30')];if(!_0x525837[_0xc3c1('0x2a')]['hasOwnProperty'](_0xc3c1('0x32'))){_0x34772e[_0xc3c1('0x1b')]=qs[_0xc3c1('0x1b')](_0x525837[_0xc3c1('0x2a')]['limit']);_0x34772e['offset']=qs['offset'](_0x525837[_0xc3c1('0x2a')]['offset']);}return _0x460612[_0xc3c1('0x4b')](_0x34772e);}})[_0xc3c1('0x20')](function(_0x5bd915){if(_0x5bd915){return _0x5bd915?{'count':_0x16a24f,'rows':_0x5bd915}:null;}})[_0xc3c1('0x20')](respondWithResult(_0x2b1293,null))['catch'](handleError(_0x2b1293,null));}; \ No newline at end of file +var _0xe48b=['name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','SugarcrmConfiguration','includeAll','include','findAll','rows','catch','show','params','keys','create','body','find','getFields','findOne','SugarcrmField','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error'];(function(_0xd2b873,_0xc29a0b){var _0x588ff5=function(_0x56331f){while(--_0x56331f){_0xd2b873['push'](_0xd2b873['shift']());}};_0x588ff5(++_0xc29a0b);}(_0xe48b,0xcd));var _0xbe48=function(_0x44e208,_0x1d9689){_0x44e208=_0x44e208-0x0;var _0x43ca9a=_0xe48b[_0x44e208];return _0x43ca9a;};'use strict';var emlformat=require(_0xbe48('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbe48('0x1'));var jsonpatch=require(_0xbe48('0x2'));var rp=require('request-promise');var moment=require(_0xbe48('0x3'));var BPromise=require(_0xbe48('0x4'));var Mustache=require('mustache');var util=require(_0xbe48('0x5'));var path=require(_0xbe48('0x6'));var sox=require('sox');var csv=require(_0xbe48('0x7'));var ejs=require(_0xbe48('0x8'));var fs=require('fs');var fs_extra=require(_0xbe48('0x9'));var _=require(_0xbe48('0xa'));var squel=require(_0xbe48('0xb'));var crypto=require(_0xbe48('0xc'));var jsforce=require(_0xbe48('0xd'));var deskjs=require(_0xbe48('0xe'));var toCsv=require(_0xbe48('0x7'));var querystring=require(_0xbe48('0xf'));var Papa=require(_0xbe48('0x10'));var Redis=require(_0xbe48('0x11'));var authService=require(_0xbe48('0x12'));var qs=require(_0xbe48('0x13'));var as=require(_0xbe48('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xbe48('0x15'));var utils=require(_0xbe48('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xbe48('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3ef12c,_0x226416){_0x226416=_0x226416||0xcc;return function(_0x50c5f3){if(_0x50c5f3){return _0x3ef12c[_0xbe48('0x18')](_0x226416);}return _0x3ef12c[_0xbe48('0x19')](_0x226416)['end']();};}function respondWithResult(_0x139630,_0x16ffe3){_0x16ffe3=_0x16ffe3||0xc8;return function(_0x129801){if(_0x129801){return _0x139630[_0xbe48('0x19')](_0x16ffe3)[_0xbe48('0x1a')](_0x129801);}};}function respondWithFilteredResult(_0x1c23f0,_0x166758){return function(_0x763848){if(_0x763848){var _0x314f66=typeof _0x166758[_0xbe48('0x1b')]===_0xbe48('0x1c')&&typeof _0x166758[_0xbe48('0x1d')]===_0xbe48('0x1c');var _0x384c89=_0x763848['count'];var _0x5b2909=_0x314f66?0x0:_0x166758[_0xbe48('0x1b')];var _0x9a01e1=_0x314f66?_0x763848[_0xbe48('0x1e')]:_0x166758[_0xbe48('0x1b')]+_0x166758['limit'];var _0x33143e;if(_0x9a01e1>=_0x384c89){_0x9a01e1=_0x384c89;_0x33143e=0xc8;}else{_0x33143e=0xce;}_0x1c23f0[_0xbe48('0x19')](_0x33143e);return _0x1c23f0[_0xbe48('0x1f')](_0xbe48('0x20'),_0x5b2909+'-'+_0x9a01e1+'/'+_0x384c89)[_0xbe48('0x1a')](_0x763848);}return null;};}function patchUpdates(_0x1b99d5){return function(_0x3b3882){try{jsonpatch[_0xbe48('0x21')](_0x3b3882,_0x1b99d5,!![]);}catch(_0x5687c1){return BPromise[_0xbe48('0x22')](_0x5687c1);}return _0x3b3882[_0xbe48('0x23')]();};}function saveUpdates(_0x2af666,_0x147895){return function(_0xd400f8){if(_0xd400f8){return _0xd400f8[_0xbe48('0x24')](_0x2af666)[_0xbe48('0x25')](function(_0x8c44be){return _0x8c44be;});}return null;};}function removeEntity(_0x4d4673,_0x2bb627){return function(_0x4bffe5){if(_0x4bffe5){return _0x4bffe5[_0xbe48('0x26')]()[_0xbe48('0x25')](function(){_0x4d4673[_0xbe48('0x19')](0xcc)[_0xbe48('0x27')]();});}};}function handleEntityNotFound(_0x4f851b,_0x282734){return function(_0x35d031){if(!_0x35d031){_0x4f851b[_0xbe48('0x18')](0x194);}return _0x35d031;};}function handleError(_0x8e6c74,_0x404520){_0x404520=_0x404520||0x1f4;return function(_0x295801){logger[_0xbe48('0x28')](_0x295801['stack']);if(_0x295801[_0xbe48('0x29')]){delete _0x295801[_0xbe48('0x29')];}_0x8e6c74[_0xbe48('0x19')](_0x404520)[_0xbe48('0x2a')](_0x295801);};}exports[_0xbe48('0x2b')]=function(_0x121c9e,_0x29ab96){var _0x5cb864={},_0x6d2006={},_0x34d468={'count':0x0,'rows':[]};var _0x3023cd=_[_0xbe48('0x2c')](db['SugarcrmConfiguration'][_0xbe48('0x2d')],function(_0x3d3da1){return{'name':_0x3d3da1[_0xbe48('0x2e')],'type':_0x3d3da1[_0xbe48('0x2f')][_0xbe48('0x30')]};});_0x6d2006[_0xbe48('0x31')]=_[_0xbe48('0x2c')](_0x3023cd,_0xbe48('0x29'));_0x6d2006[_0xbe48('0x32')]=_['keys'](_0x121c9e['query']);_0x6d2006[_0xbe48('0x33')]=_[_0xbe48('0x34')](_0x6d2006[_0xbe48('0x31')],_0x6d2006['query']);_0x5cb864[_0xbe48('0x35')]=_[_0xbe48('0x34')](_0x6d2006['model'],qs[_0xbe48('0x36')](_0x121c9e[_0xbe48('0x32')][_0xbe48('0x36')]));_0x5cb864[_0xbe48('0x35')]=_0x5cb864[_0xbe48('0x35')][_0xbe48('0x37')]?_0x5cb864[_0xbe48('0x35')]:_0x6d2006['model'];if(!_0x121c9e[_0xbe48('0x32')][_0xbe48('0x38')](_0xbe48('0x39'))){_0x5cb864[_0xbe48('0x1d')]=qs[_0xbe48('0x1d')](_0x121c9e[_0xbe48('0x32')]['limit']);_0x5cb864[_0xbe48('0x1b')]=qs[_0xbe48('0x1b')](_0x121c9e[_0xbe48('0x32')][_0xbe48('0x1b')]);}_0x5cb864[_0xbe48('0x3a')]=qs[_0xbe48('0x3b')](_0x121c9e['query'][_0xbe48('0x3b')]);_0x5cb864[_0xbe48('0x3c')]=qs[_0xbe48('0x33')](_[_0xbe48('0x3d')](_0x121c9e[_0xbe48('0x32')],_0x6d2006[_0xbe48('0x33')]),_0x3023cd);if(_0x121c9e[_0xbe48('0x32')]['filter']){_0x5cb864[_0xbe48('0x3c')]=_[_0xbe48('0x3e')](_0x5cb864[_0xbe48('0x3c')],{'$or':_[_0xbe48('0x2c')](_0x3023cd,function(_0x39f909){if(_0x39f909['type']!=='VIRTUAL'){var _0x394ab2={};_0x394ab2[_0x39f909[_0xbe48('0x29')]]={'$like':'%'+_0x121c9e[_0xbe48('0x32')][_0xbe48('0x3f')]+'%'};return _0x394ab2;}})});}_0x5cb864=_[_0xbe48('0x3e')]({},_0x5cb864,_0x121c9e[_0xbe48('0x40')]);var _0x12ad24={'where':_0x5cb864['where']};return db[_0xbe48('0x41')][_0xbe48('0x1e')](_0x12ad24)[_0xbe48('0x25')](function(_0x29e183){_0x34d468[_0xbe48('0x1e')]=_0x29e183;if(_0x121c9e[_0xbe48('0x32')][_0xbe48('0x42')]){_0x5cb864[_0xbe48('0x43')]=[{'all':!![]}];}return db[_0xbe48('0x41')][_0xbe48('0x44')](_0x5cb864);})[_0xbe48('0x25')](function(_0x11edfa){_0x34d468[_0xbe48('0x45')]=_0x11edfa;return _0x34d468;})[_0xbe48('0x25')](respondWithFilteredResult(_0x29ab96,_0x5cb864))[_0xbe48('0x46')](handleError(_0x29ab96,null));};exports[_0xbe48('0x47')]=function(_0x5400c7,_0x1b01f9){var _0xe52f34={'raw':![],'where':{'id':_0x5400c7[_0xbe48('0x48')]['id']}},_0x2a983d={};_0x2a983d['model']=_[_0xbe48('0x49')](db[_0xbe48('0x41')][_0xbe48('0x2d')]);_0x2a983d[_0xbe48('0x32')]=_[_0xbe48('0x49')](_0x5400c7[_0xbe48('0x32')]);_0x2a983d[_0xbe48('0x33')]=_[_0xbe48('0x34')](_0x2a983d[_0xbe48('0x31')],_0x2a983d[_0xbe48('0x32')]);_0xe52f34['attributes']=_['intersection'](_0x2a983d['model'],qs[_0xbe48('0x36')](_0x5400c7[_0xbe48('0x32')][_0xbe48('0x36')]));_0xe52f34[_0xbe48('0x35')]=_0xe52f34[_0xbe48('0x35')][_0xbe48('0x37')]?_0xe52f34[_0xbe48('0x35')]:_0x2a983d['model'];if(_0x5400c7['query']['includeAll']){_0xe52f34[_0xbe48('0x43')]=[{'all':!![]}];}_0xe52f34=_['merge']({},_0xe52f34,_0x5400c7[_0xbe48('0x40')]);return db[_0xbe48('0x41')]['find'](_0xe52f34)[_0xbe48('0x25')](handleEntityNotFound(_0x1b01f9,null))[_0xbe48('0x25')](respondWithResult(_0x1b01f9,null))[_0xbe48('0x46')](handleError(_0x1b01f9,null));};exports[_0xbe48('0x4a')]=function(_0x3fdc5a,_0x4ebb5c){return db['SugarcrmConfiguration'][_0xbe48('0x4a')](_0x3fdc5a[_0xbe48('0x4b')],{})['then'](respondWithResult(_0x4ebb5c,0xc9))[_0xbe48('0x46')](handleError(_0x4ebb5c,null));};exports[_0xbe48('0x24')]=function(_0x49f817,_0x2313a6){if(_0x49f817[_0xbe48('0x4b')]['id']){delete _0x49f817[_0xbe48('0x4b')]['id'];}return db['SugarcrmConfiguration']['find']({'where':{'id':_0x49f817['params']['id']}})[_0xbe48('0x25')](handleEntityNotFound(_0x2313a6,null))[_0xbe48('0x25')](saveUpdates(_0x49f817['body'],null))[_0xbe48('0x25')](respondWithResult(_0x2313a6,null))['catch'](handleError(_0x2313a6,null));};exports[_0xbe48('0x26')]=function(_0x42c53c,_0x22abe9){return db[_0xbe48('0x41')][_0xbe48('0x4c')]({'where':{'id':_0x42c53c[_0xbe48('0x48')]['id']}})[_0xbe48('0x25')](handleEntityNotFound(_0x22abe9,null))['then'](removeEntity(_0x22abe9,null))[_0xbe48('0x46')](handleError(_0x22abe9,null));};exports[_0xbe48('0x4d')]=function(_0x38d369,_0x511778,_0x3d7894){var _0x2d9a5f={};var _0x545e5b={};var _0x2718a6;var _0x7152b0;return db[_0xbe48('0x41')][_0xbe48('0x4e')]({'where':{'id':_0x38d369[_0xbe48('0x48')]['id']}})[_0xbe48('0x25')](handleEntityNotFound(_0x511778,null))[_0xbe48('0x25')](function(_0xcc3a85){if(_0xcc3a85){_0x2718a6=_0xcc3a85;_0x545e5b[_0xbe48('0x31')]=_[_0xbe48('0x49')](db[_0xbe48('0x4f')][_0xbe48('0x2d')]);_0x545e5b[_0xbe48('0x32')]=_['keys'](_0x38d369[_0xbe48('0x32')]);_0x545e5b['filters']=_[_0xbe48('0x34')](_0x545e5b['model'],_0x545e5b[_0xbe48('0x32')]);_0x2d9a5f[_0xbe48('0x35')]=_[_0xbe48('0x34')](_0x545e5b[_0xbe48('0x31')],qs[_0xbe48('0x36')](_0x38d369[_0xbe48('0x32')][_0xbe48('0x36')]));_0x2d9a5f['attributes']=_0x2d9a5f[_0xbe48('0x35')][_0xbe48('0x37')]?_0x2d9a5f[_0xbe48('0x35')]:_0x545e5b[_0xbe48('0x31')];_0x2d9a5f[_0xbe48('0x3a')]=qs['sort'](_0x38d369['query'][_0xbe48('0x3b')]);_0x2d9a5f[_0xbe48('0x3c')]=qs['filters'](_[_0xbe48('0x3d')](_0x38d369[_0xbe48('0x32')],_0x545e5b['filters']));if(_0x38d369[_0xbe48('0x32')][_0xbe48('0x3f')]){_0x2d9a5f[_0xbe48('0x3c')]=_[_0xbe48('0x3e')](_0x2d9a5f['where'],{'$or':_[_0xbe48('0x2c')](_0x2d9a5f[_0xbe48('0x35')],function(_0x2d9875){var _0x23c356={};_0x23c356[_0x2d9875]={'$like':'%'+_0x38d369[_0xbe48('0x32')][_0xbe48('0x3f')]+'%'};return _0x23c356;})});}_0x2d9a5f=_[_0xbe48('0x3e')]({},_0x2d9a5f,_0x38d369[_0xbe48('0x40')]);return _0x2718a6['getFields'](_0x2d9a5f);}})[_0xbe48('0x25')](function(_0x53cb87){if(_0x53cb87){_0x7152b0=_0x53cb87[_0xbe48('0x37')];if(!_0x38d369[_0xbe48('0x32')][_0xbe48('0x38')](_0xbe48('0x39'))){_0x2d9a5f['limit']=qs[_0xbe48('0x1d')](_0x38d369['query'][_0xbe48('0x1d')]);_0x2d9a5f[_0xbe48('0x1b')]=qs['offset'](_0x38d369['query'][_0xbe48('0x1b')]);}return _0x2718a6[_0xbe48('0x4d')](_0x2d9a5f);}})[_0xbe48('0x25')](function(_0x5751bd){if(_0x5751bd){return _0x5751bd?{'count':_0x7152b0,'rows':_0x5751bd}:null;}})[_0xbe48('0x25')](respondWithResult(_0x511778,null))[_0xbe48('0x46')](handleError(_0x511778,null));};exports[_0xbe48('0x50')]=function(_0x2151c9,_0x4d74cb,_0x161452){var _0x371626={};var _0x269b6d={};var _0x944eb6;var _0x2b0aeb;return db[_0xbe48('0x41')]['findOne']({'where':{'id':_0x2151c9[_0xbe48('0x48')]['id']}})['then'](handleEntityNotFound(_0x4d74cb,null))[_0xbe48('0x25')](function(_0x17e655){if(_0x17e655){_0x944eb6=_0x17e655;_0x269b6d['model']=_[_0xbe48('0x49')](db[_0xbe48('0x4f')]['rawAttributes']);_0x269b6d[_0xbe48('0x32')]=_['keys'](_0x2151c9['query']);_0x269b6d[_0xbe48('0x33')]=_[_0xbe48('0x34')](_0x269b6d[_0xbe48('0x31')],_0x269b6d[_0xbe48('0x32')]);_0x371626[_0xbe48('0x35')]=_[_0xbe48('0x34')](_0x269b6d[_0xbe48('0x31')],qs[_0xbe48('0x36')](_0x2151c9[_0xbe48('0x32')][_0xbe48('0x36')]));_0x371626['attributes']=_0x371626[_0xbe48('0x35')][_0xbe48('0x37')]?_0x371626[_0xbe48('0x35')]:_0x269b6d[_0xbe48('0x31')];_0x371626[_0xbe48('0x3a')]=qs['sort'](_0x2151c9['query'][_0xbe48('0x3b')]);_0x371626['where']=qs[_0xbe48('0x33')](_['pick'](_0x2151c9['query'],_0x269b6d[_0xbe48('0x33')]));if(_0x2151c9['query']['filter']){_0x371626[_0xbe48('0x3c')]=_[_0xbe48('0x3e')](_0x371626[_0xbe48('0x3c')],{'$or':_[_0xbe48('0x2c')](_0x371626[_0xbe48('0x35')],function(_0x57f3b8){var _0x18a818={};_0x18a818[_0x57f3b8]={'$like':'%'+_0x2151c9[_0xbe48('0x32')][_0xbe48('0x3f')]+'%'};return _0x18a818;})});}_0x371626=_[_0xbe48('0x3e')]({},_0x371626,_0x2151c9[_0xbe48('0x40')]);return _0x944eb6[_0xbe48('0x50')](_0x371626);}})[_0xbe48('0x25')](function(_0x11fbf6){if(_0x11fbf6){_0x2b0aeb=_0x11fbf6['length'];if(!_0x2151c9[_0xbe48('0x32')][_0xbe48('0x38')]('nolimit')){_0x371626['limit']=qs[_0xbe48('0x1d')](_0x2151c9[_0xbe48('0x32')][_0xbe48('0x1d')]);_0x371626[_0xbe48('0x1b')]=qs[_0xbe48('0x1b')](_0x2151c9[_0xbe48('0x32')]['offset']);}return _0x944eb6[_0xbe48('0x50')](_0x371626);}})[_0xbe48('0x25')](function(_0x48ecf8){if(_0x48ecf8){return _0x48ecf8?{'count':_0x2b0aeb,'rows':_0x48ecf8}:null;}})[_0xbe48('0x25')](respondWithResult(_0x4d74cb,null))['catch'](handleError(_0x4d74cb,null));};exports[_0xbe48('0x51')]=function(_0x2589d5,_0x4bf72e,_0x27bedd){var _0x4011f1={};var _0x329065={};var _0x31259e;var _0x38d05d;return db[_0xbe48('0x41')][_0xbe48('0x4e')]({'where':{'id':_0x2589d5[_0xbe48('0x48')]['id']}})[_0xbe48('0x25')](handleEntityNotFound(_0x4bf72e,null))['then'](function(_0x19ad88){if(_0x19ad88){_0x31259e=_0x19ad88;_0x329065['model']=_[_0xbe48('0x49')](db[_0xbe48('0x4f')][_0xbe48('0x2d')]);_0x329065[_0xbe48('0x32')]=_[_0xbe48('0x49')](_0x2589d5[_0xbe48('0x32')]);_0x329065[_0xbe48('0x33')]=_[_0xbe48('0x34')](_0x329065[_0xbe48('0x31')],_0x329065[_0xbe48('0x32')]);_0x4011f1[_0xbe48('0x35')]=_[_0xbe48('0x34')](_0x329065[_0xbe48('0x31')],qs[_0xbe48('0x36')](_0x2589d5['query'][_0xbe48('0x36')]));_0x4011f1['attributes']=_0x4011f1[_0xbe48('0x35')][_0xbe48('0x37')]?_0x4011f1[_0xbe48('0x35')]:_0x329065['model'];_0x4011f1['order']=qs['sort'](_0x2589d5[_0xbe48('0x32')][_0xbe48('0x3b')]);_0x4011f1[_0xbe48('0x3c')]=qs['filters'](_[_0xbe48('0x3d')](_0x2589d5['query'],_0x329065[_0xbe48('0x33')]));if(_0x2589d5[_0xbe48('0x32')][_0xbe48('0x3f')]){_0x4011f1[_0xbe48('0x3c')]=_[_0xbe48('0x3e')](_0x4011f1[_0xbe48('0x3c')],{'$or':_[_0xbe48('0x2c')](_0x4011f1['attributes'],function(_0x39b190){var _0x19a5c8={};_0x19a5c8[_0x39b190]={'$like':'%'+_0x2589d5[_0xbe48('0x32')][_0xbe48('0x3f')]+'%'};return _0x19a5c8;})});}_0x4011f1=_['merge']({},_0x4011f1,_0x2589d5['options']);return _0x31259e['getDescriptions'](_0x4011f1);}})[_0xbe48('0x25')](function(_0x6d766a){if(_0x6d766a){_0x38d05d=_0x6d766a[_0xbe48('0x37')];if(!_0x2589d5[_0xbe48('0x32')][_0xbe48('0x38')](_0xbe48('0x39'))){_0x4011f1[_0xbe48('0x1d')]=qs['limit'](_0x2589d5[_0xbe48('0x32')][_0xbe48('0x1d')]);_0x4011f1[_0xbe48('0x1b')]=qs[_0xbe48('0x1b')](_0x2589d5[_0xbe48('0x32')][_0xbe48('0x1b')]);}return _0x31259e[_0xbe48('0x51')](_0x4011f1);}})[_0xbe48('0x25')](function(_0x574263){if(_0x574263){return _0x574263?{'count':_0x38d05d,'rows':_0x574263}:null;}})['then'](respondWithResult(_0x4bf72e,null))[_0xbe48('0x46')](handleError(_0x4bf72e,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 2c5b291..7906da1 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 _0xb915=['path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x6bb814,_0x17196b){var _0x3c4bf6=function(_0x5bf6b9){while(--_0x5bf6b9){_0x6bb814['push'](_0x6bb814['shift']());}};_0x3c4bf6(++_0x17196b);}(_0xb915,0x166));var _0x5b91=function(_0x119d5a,_0x19b457){_0x119d5a=_0x119d5a-0x0;var _0x15bff4=_0xb915[_0x119d5a];return _0x15bff4;};'use strict';var _=require(_0x5b91('0x0'));var util=require(_0x5b91('0x1'));var logger=require(_0x5b91('0x2'))(_0x5b91('0x3'));var moment=require(_0x5b91('0x4'));var BPromise=require('bluebird');var rp=require(_0x5b91('0x5'));var fs=require('fs');var path=require(_0x5b91('0x6'));var rimraf=require(_0x5b91('0x7'));var config=require(_0x5b91('0x8'));var attributes=require(_0x5b91('0x9'));module[_0x5b91('0xa')]=function(_0xd7ef41,_0x540a16){return _0xd7ef41[_0x5b91('0xb')](_0x5b91('0xc'),attributes,{'tableName':_0x5b91('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0523=['path','rimraf','./intSugarcrmConfiguration.attributes','exports','define','util','api','bluebird'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x0523,0xa5));var _0x3052=function(_0x3d8bbd,_0x3f8c34){_0x3d8bbd=_0x3d8bbd-0x0;var _0xf17a80=_0x0523[_0x3d8bbd];return _0xf17a80;};'use strict';var _=require('lodash');var util=require(_0x3052('0x0'));var logger=require('../../config/logger')(_0x3052('0x1'));var moment=require('moment');var BPromise=require(_0x3052('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3052('0x3'));var rimraf=require(_0x3052('0x4'));var config=require('../../config/environment');var attributes=require(_0x3052('0x5'));module[_0x3052('0x6')]=function(_0x175feb,_0x480927){return _0x175feb[_0x3052('0x7')]('SugarcrmConfiguration',attributes,{'tableName':'int_sugarcrm_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js index 47f0c47..731e50a 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 _0x8bbc=['http','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x3bb6f6,_0x1e642c){var _0x53f34e=function(_0x31c4de){while(--_0x31c4de){_0x3bb6f6['push'](_0x3bb6f6['shift']());}};_0x53f34e(++_0x1e642c);}(_0x8bbc,0x1c4));var _0xc8bb=function(_0x44a3b0,_0x352810){_0x44a3b0=_0x44a3b0-0x0;var _0x39e6f6=_0x8bbc[_0x44a3b0];return _0x39e6f6;};'use strict';var _=require(_0xc8bb('0x0'));var util=require(_0xc8bb('0x1'));var moment=require('moment');var BPromise=require(_0xc8bb('0x2'));var rs=require(_0xc8bb('0x3'));var fs=require('fs');var Redis=require(_0xc8bb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc8bb('0x5'));var logger=require(_0xc8bb('0x6'))(_0xc8bb('0x7'));var config=require(_0xc8bb('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc8bb('0x9')][_0xc8bb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x287006,_0x320328,_0x11363e){return new BPromise(function(_0x4ddfda,_0x4c3a71){return client['request'](_0x287006,_0x11363e)[_0xc8bb('0xb')](function(_0x4146fd){logger[_0xc8bb('0xc')](_0xc8bb('0xd'),_0x320328,_0xc8bb('0xe'));logger[_0xc8bb('0xf')](_0xc8bb('0x10'),_0x320328,_0xc8bb('0xe'),JSON['stringify'](_0x4146fd));if(_0x4146fd[_0xc8bb('0x11')]){if(_0x4146fd[_0xc8bb('0x11')][_0xc8bb('0x12')]===0x1f4){logger[_0xc8bb('0x11')](_0xc8bb('0xd'),_0x320328,_0x4146fd[_0xc8bb('0x11')]['message']);return _0x4c3a71(_0x4146fd[_0xc8bb('0x11')][_0xc8bb('0x13')]);}logger['error'](_0xc8bb('0xd'),_0x320328,_0x4146fd[_0xc8bb('0x11')][_0xc8bb('0x13')]);return _0x4ddfda(_0x4146fd['error'][_0xc8bb('0x13')]);}else{logger['info']('SugarcrmConfiguration,\x20%s,\x20%s',_0x320328,_0xc8bb('0xe'));_0x4ddfda(_0x4146fd[_0xc8bb('0x14')][_0xc8bb('0x13')]);}})[_0xc8bb('0x15')](function(_0x4b38b3){logger[_0xc8bb('0x11')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x320328,_0x4b38b3);_0x4c3a71(_0x4b38b3);});});} \ No newline at end of file +var _0xccfb=['request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s'];(function(_0x1d4981,_0xb68096){var _0x30c0bb=function(_0x29af50){while(--_0x29af50){_0x1d4981['push'](_0x1d4981['shift']());}};_0x30c0bb(++_0xb68096);}(_0xccfb,0x118));var _0xbccf=function(_0x56b50d,_0x2f4d83){_0x56b50d=_0x56b50d-0x0;var _0x1a732d=_0xccfb[_0x56b50d];return _0x1a732d;};'use strict';var _=require(_0xbccf('0x0'));var util=require(_0xbccf('0x1'));var moment=require(_0xbccf('0x2'));var BPromise=require(_0xbccf('0x3'));var rs=require(_0xbccf('0x4'));var fs=require('fs');var Redis=require(_0xbccf('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbccf('0x6'))(_0xbccf('0x7'));var config=require(_0xbccf('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xbccf('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xd6b58d,_0x5d9a69,_0x3c35ea){return new BPromise(function(_0x7fa5a8,_0x50d028){return client[_0xbccf('0xa')](_0xd6b58d,_0x3c35ea)[_0xbccf('0xb')](function(_0x16a572){logger[_0xbccf('0xc')](_0xbccf('0xd'),_0x5d9a69,_0xbccf('0xe'));logger[_0xbccf('0xf')](_0xbccf('0x10'),_0x5d9a69,_0xbccf('0xe'),JSON[_0xbccf('0x11')](_0x16a572));if(_0x16a572[_0xbccf('0x12')]){if(_0x16a572[_0xbccf('0x12')]['code']===0x1f4){logger[_0xbccf('0x12')](_0xbccf('0xd'),_0x5d9a69,_0x16a572['error'][_0xbccf('0x13')]);return _0x50d028(_0x16a572['error'][_0xbccf('0x13')]);}logger[_0xbccf('0x12')](_0xbccf('0xd'),_0x5d9a69,_0x16a572[_0xbccf('0x12')][_0xbccf('0x13')]);return _0x7fa5a8(_0x16a572[_0xbccf('0x12')][_0xbccf('0x13')]);}else{logger[_0xbccf('0xc')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x5d9a69,_0xbccf('0xe'));_0x7fa5a8(_0x16a572['result'][_0xbccf('0x13')]);}})[_0xbccf('0x14')](function(_0x34dfa1){logger[_0xbccf('0x12')](_0xbccf('0xd'),_0x5d9a69,_0x34dfa1);_0x50d028(_0x34dfa1);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 25ed630..cc4e3d4 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 _0x48f2=['show','create','put','update','delete','destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmField.controller','get','isAuthenticated','/:id'];(function(_0x1a9881,_0x177c92){var _0x5838cc=function(_0x25f20e){while(--_0x25f20e){_0x1a9881['push'](_0x1a9881['shift']());}};_0x5838cc(++_0x177c92);}(_0x48f2,0xc2));var _0x248f=function(_0x349535,_0x1b13ce){_0x349535=_0x349535-0x0;var _0x31dcda=_0x48f2[_0x349535];return _0x31dcda;};'use strict';var multer=require(_0x248f('0x0'));var util=require(_0x248f('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x248f('0x2')]();var fs_extra=require(_0x248f('0x3'));var auth=require(_0x248f('0x4'));var interaction=require(_0x248f('0x5'));var config=require('../../config/environment');var controller=require(_0x248f('0x6'));router[_0x248f('0x7')]('/',auth[_0x248f('0x8')](),controller['index']);router['get'](_0x248f('0x9'),auth['isAuthenticated'](),controller[_0x248f('0xa')]);router['post']('/',auth[_0x248f('0x8')](),controller[_0x248f('0xb')]);router[_0x248f('0xc')]('/:id',auth[_0x248f('0x8')](),controller[_0x248f('0xd')]);router[_0x248f('0xe')](_0x248f('0x9'),auth[_0x248f('0x8')](),controller[_0x248f('0xf')]);module[_0x248f('0x10')]=router; \ No newline at end of file +var _0x2888=['post','create','put','update','destroy','exports','multer','path','express','Router','fs-extra','../../config/environment','./intSugarcrmField.controller','get','index','/:id','isAuthenticated'];(function(_0x456a72,_0x38875f){var _0x1ea548=function(_0x42aed1){while(--_0x42aed1){_0x456a72['push'](_0x456a72['shift']());}};_0x1ea548(++_0x38875f);}(_0x2888,0x116));var _0x8288=function(_0x367acc,_0x49b154){_0x367acc=_0x367acc-0x0;var _0x51d0a9=_0x2888[_0x367acc];return _0x51d0a9;};'use strict';var multer=require(_0x8288('0x0'));var util=require('util');var path=require(_0x8288('0x1'));var timeout=require('connect-timeout');var express=require(_0x8288('0x2'));var router=express[_0x8288('0x3')]();var fs_extra=require(_0x8288('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8288('0x5'));var controller=require(_0x8288('0x6'));router[_0x8288('0x7')]('/',auth['isAuthenticated'](),controller[_0x8288('0x8')]);router['get'](_0x8288('0x9'),auth[_0x8288('0xa')](),controller['show']);router[_0x8288('0xb')]('/',auth['isAuthenticated'](),controller[_0x8288('0xc')]);router[_0x8288('0xd')](_0x8288('0x9'),auth[_0x8288('0xa')](),controller[_0x8288('0xe')]);router['delete'](_0x8288('0x9'),auth[_0x8288('0xa')](),controller[_0x8288('0xf')]);module[_0x8288('0x10')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 694ae6d..0c76452 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 _0xa7a6=['ENUM','customVariable','keyValue','string','STRING','variable','BOOLEAN','sequelize'];(function(_0x5f3065,_0x3327fd){var _0x2aed2b=function(_0x2975b9){while(--_0x2975b9){_0x5f3065['push'](_0x5f3065['shift']());}};_0x2aed2b(++_0x3327fd);}(_0xa7a6,0xa7));var _0x6a7a=function(_0x28f0dd,_0x4cddd2){_0x28f0dd=_0x28f0dd-0x0;var _0x4f73cd=_0xa7a6[_0x28f0dd];return _0x4f73cd;};'use strict';var Sequelize=require(_0x6a7a('0x0'));module['exports']={'type':{'type':Sequelize[_0x6a7a('0x1')]('string','variable',_0x6a7a('0x2'),_0x6a7a('0x3'),'picklist'),'defaultValue':_0x6a7a('0x4')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x6a7a('0x5')]},'keyType':{'type':Sequelize[_0x6a7a('0x1')](_0x6a7a('0x4'),_0x6a7a('0x6'),_0x6a7a('0x2'))},'keyContent':{'type':Sequelize[_0x6a7a('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x6a7a('0x5')]},'customField':{'type':Sequelize[_0x6a7a('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6a7a('0x5')]}}; \ No newline at end of file +var _0xd455=['string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','exports','ENUM'];(function(_0x18506f,_0x5957b1){var _0x589670=function(_0x225f82){while(--_0x225f82){_0x18506f['push'](_0x18506f['shift']());}};_0x589670(++_0x5957b1);}(_0xd455,0x11e));var _0x5d45=function(_0x34f235,_0x4cb723){_0x34f235=_0x34f235-0x0;var _0xe2ef1=_0xd455[_0x34f235];return _0xe2ef1;};'use strict';var Sequelize=require('sequelize');module[_0x5d45('0x0')]={'type':{'type':Sequelize[_0x5d45('0x1')](_0x5d45('0x2'),_0x5d45('0x3'),_0x5d45('0x4'),_0x5d45('0x5'),_0x5d45('0x6')),'defaultValue':_0x5d45('0x2')},'content':{'type':Sequelize[_0x5d45('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x5d45('0x1')]('string','variable','customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x5d45('0x7')]},'customField':{'type':Sequelize[_0x5d45('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5d45('0x7')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 3b9f3d3..5a4cb5c 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 _0xabe9=['querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','destroy','sendStatus','error','stack','name','send','index','map','SugarcrmField','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','where','pick','merge','VIRTUAL','filter','then','include','findAll','rows','catch','show','params','keys','includeAll','options','create','body','find','eml-format','rimraf','moment','mustache','util','sox','ejs','lodash','crypto','jsforce','desk.js'];(function(_0x565889,_0x5825ab){var _0x2e24c8=function(_0x639718){while(--_0x639718){_0x565889['push'](_0x565889['shift']());}};_0x2e24c8(++_0x5825ab);}(_0xabe9,0x1b1));var _0x9abe=function(_0x2c7918,_0x464fd0){_0x2c7918=_0x2c7918-0x0;var _0x55a141=_0xabe9[_0x2c7918];return _0x55a141;};'use strict';var emlformat=require(_0x9abe('0x0'));var rimraf=require(_0x9abe('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9abe('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x9abe('0x3'));var util=require(_0x9abe('0x4'));var path=require('path');var sox=require(_0x9abe('0x5'));var csv=require('to-csv');var ejs=require(_0x9abe('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9abe('0x7'));var squel=require('squel');var crypto=require(_0x9abe('0x8'));var jsforce=require(_0x9abe('0x9'));var deskjs=require(_0x9abe('0xa'));var toCsv=require('to-csv');var querystring=require(_0x9abe('0xb'));var Papa=require(_0x9abe('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x9abe('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9abe('0xe'));var logger=require(_0x9abe('0xf'))('api');var utils=require(_0x9abe('0x10'));var config=require(_0x9abe('0x11'));var licenseUtil=require(_0x9abe('0x12'));var db=require(_0x9abe('0x13'))['db'];function respondWithStatusCode(_0x548379,_0xe7f9ed){_0xe7f9ed=_0xe7f9ed||0xcc;return function(_0x495720){if(_0x495720){return _0x548379['sendStatus'](_0xe7f9ed);}return _0x548379['status'](_0xe7f9ed)[_0x9abe('0x14')]();};}function respondWithResult(_0x4bc6ef,_0xfee143){_0xfee143=_0xfee143||0xc8;return function(_0x1b0c95){if(_0x1b0c95){return _0x4bc6ef[_0x9abe('0x15')](_0xfee143)[_0x9abe('0x16')](_0x1b0c95);}};}function respondWithFilteredResult(_0x4d9e68,_0x8b32e3){return function(_0x2cb4ae){if(_0x2cb4ae){var _0x29b2da=typeof _0x8b32e3[_0x9abe('0x17')]===_0x9abe('0x18')&&typeof _0x8b32e3['limit']==='undefined';var _0x78e74f=_0x2cb4ae[_0x9abe('0x19')];var _0x297d94=_0x29b2da?0x0:_0x8b32e3[_0x9abe('0x17')];var _0x1b0845=_0x29b2da?_0x2cb4ae[_0x9abe('0x19')]:_0x8b32e3['offset']+_0x8b32e3['limit'];var _0x394c11;if(_0x1b0845>=_0x78e74f){_0x1b0845=_0x78e74f;_0x394c11=0xc8;}else{_0x394c11=0xce;}_0x4d9e68[_0x9abe('0x15')](_0x394c11);return _0x4d9e68[_0x9abe('0x1a')](_0x9abe('0x1b'),_0x297d94+'-'+_0x1b0845+'/'+_0x78e74f)[_0x9abe('0x16')](_0x2cb4ae);}return null;};}function patchUpdates(_0x68906e){return function(_0x5aca9c){try{jsonpatch[_0x9abe('0x1c')](_0x5aca9c,_0x68906e,!![]);}catch(_0x315544){return BPromise[_0x9abe('0x1d')](_0x315544);}return _0x5aca9c[_0x9abe('0x1e')]();};}function saveUpdates(_0x2dd389,_0x1ffc21){return function(_0x476471){if(_0x476471){return _0x476471[_0x9abe('0x1f')](_0x2dd389)['then'](function(_0xbf1a13){return _0xbf1a13;});}return null;};}function removeEntity(_0x39c7be,_0x3a25f2){return function(_0x58ace7){if(_0x58ace7){return _0x58ace7[_0x9abe('0x20')]()['then'](function(){_0x39c7be['status'](0xcc)[_0x9abe('0x14')]();});}};}function handleEntityNotFound(_0x3c3f1e,_0x2f6409){return function(_0x3577bc){if(!_0x3577bc){_0x3c3f1e[_0x9abe('0x21')](0x194);}return _0x3577bc;};}function handleError(_0x1fd973,_0x19e2a2){_0x19e2a2=_0x19e2a2||0x1f4;return function(_0x202bd2){logger[_0x9abe('0x22')](_0x202bd2[_0x9abe('0x23')]);if(_0x202bd2[_0x9abe('0x24')]){delete _0x202bd2[_0x9abe('0x24')];}_0x1fd973['status'](_0x19e2a2)[_0x9abe('0x25')](_0x202bd2);};}exports[_0x9abe('0x26')]=function(_0x54495f,_0x35850a){var _0x3942dd={},_0x3d5208={},_0x3c23d7={'count':0x0,'rows':[]};var _0x4a9fef=_[_0x9abe('0x27')](db[_0x9abe('0x28')][_0x9abe('0x29')],function(_0x562c49){return{'name':_0x562c49[_0x9abe('0x2a')],'type':_0x562c49[_0x9abe('0x2b')][_0x9abe('0x2c')]};});_0x3d5208[_0x9abe('0x2d')]=_[_0x9abe('0x27')](_0x4a9fef,_0x9abe('0x24'));_0x3d5208[_0x9abe('0x2e')]=_['keys'](_0x54495f[_0x9abe('0x2e')]);_0x3d5208[_0x9abe('0x2f')]=_[_0x9abe('0x30')](_0x3d5208[_0x9abe('0x2d')],_0x3d5208[_0x9abe('0x2e')]);_0x3942dd['attributes']=_['intersection'](_0x3d5208[_0x9abe('0x2d')],qs[_0x9abe('0x31')](_0x54495f[_0x9abe('0x2e')][_0x9abe('0x31')]));_0x3942dd[_0x9abe('0x32')]=_0x3942dd['attributes'][_0x9abe('0x33')]?_0x3942dd[_0x9abe('0x32')]:_0x3d5208[_0x9abe('0x2d')];if(!_0x54495f[_0x9abe('0x2e')][_0x9abe('0x34')](_0x9abe('0x35'))){_0x3942dd[_0x9abe('0x36')]=qs[_0x9abe('0x36')](_0x54495f[_0x9abe('0x2e')]['limit']);_0x3942dd[_0x9abe('0x17')]=qs['offset'](_0x54495f[_0x9abe('0x2e')]['offset']);}_0x3942dd[_0x9abe('0x37')]=qs['sort'](_0x54495f[_0x9abe('0x2e')]['sort']);_0x3942dd[_0x9abe('0x38')]=qs[_0x9abe('0x2f')](_[_0x9abe('0x39')](_0x54495f[_0x9abe('0x2e')],_0x3d5208[_0x9abe('0x2f')]),_0x4a9fef);if(_0x54495f[_0x9abe('0x2e')]['filter']){_0x3942dd[_0x9abe('0x38')]=_[_0x9abe('0x3a')](_0x3942dd[_0x9abe('0x38')],{'$or':_[_0x9abe('0x27')](_0x4a9fef,function(_0x52d0fa){if(_0x52d0fa[_0x9abe('0x2b')]!==_0x9abe('0x3b')){var _0x26f67b={};_0x26f67b[_0x52d0fa[_0x9abe('0x24')]]={'$like':'%'+_0x54495f['query'][_0x9abe('0x3c')]+'%'};return _0x26f67b;}})});}_0x3942dd=_[_0x9abe('0x3a')]({},_0x3942dd,_0x54495f['options']);var _0x28aec4={'where':_0x3942dd['where']};return db['SugarcrmField']['count'](_0x28aec4)[_0x9abe('0x3d')](function(_0x37f901){_0x3c23d7[_0x9abe('0x19')]=_0x37f901;if(_0x54495f[_0x9abe('0x2e')]['includeAll']){_0x3942dd[_0x9abe('0x3e')]=[{'all':!![]}];}return db[_0x9abe('0x28')][_0x9abe('0x3f')](_0x3942dd);})[_0x9abe('0x3d')](function(_0x84c101){_0x3c23d7[_0x9abe('0x40')]=_0x84c101;return _0x3c23d7;})[_0x9abe('0x3d')](respondWithFilteredResult(_0x35850a,_0x3942dd))[_0x9abe('0x41')](handleError(_0x35850a,null));};exports[_0x9abe('0x42')]=function(_0x3cf6ec,_0x50524a){var _0x149c53={'raw':!![],'where':{'id':_0x3cf6ec[_0x9abe('0x43')]['id']}},_0x178034={};_0x178034[_0x9abe('0x2d')]=_['keys'](db[_0x9abe('0x28')][_0x9abe('0x29')]);_0x178034[_0x9abe('0x2e')]=_[_0x9abe('0x44')](_0x3cf6ec[_0x9abe('0x2e')]);_0x178034[_0x9abe('0x2f')]=_[_0x9abe('0x30')](_0x178034[_0x9abe('0x2d')],_0x178034[_0x9abe('0x2e')]);_0x149c53[_0x9abe('0x32')]=_['intersection'](_0x178034[_0x9abe('0x2d')],qs[_0x9abe('0x31')](_0x3cf6ec['query']['fields']));_0x149c53[_0x9abe('0x32')]=_0x149c53[_0x9abe('0x32')][_0x9abe('0x33')]?_0x149c53['attributes']:_0x178034['model'];if(_0x3cf6ec['query'][_0x9abe('0x45')]){_0x149c53[_0x9abe('0x3e')]=[{'all':!![]}];}_0x149c53=_[_0x9abe('0x3a')]({},_0x149c53,_0x3cf6ec[_0x9abe('0x46')]);return db[_0x9abe('0x28')]['find'](_0x149c53)[_0x9abe('0x3d')](handleEntityNotFound(_0x50524a,null))[_0x9abe('0x3d')](respondWithResult(_0x50524a,null))[_0x9abe('0x41')](handleError(_0x50524a,null));};exports['create']=function(_0x53cbd5,_0x36c9eb){return db[_0x9abe('0x28')][_0x9abe('0x47')](_0x53cbd5[_0x9abe('0x48')],{})['then'](respondWithResult(_0x36c9eb,0xc9))[_0x9abe('0x41')](handleError(_0x36c9eb,null));};exports[_0x9abe('0x1f')]=function(_0x43154d,_0x361026){if(_0x43154d[_0x9abe('0x48')]['id']){delete _0x43154d[_0x9abe('0x48')]['id'];}return db[_0x9abe('0x28')][_0x9abe('0x49')]({'where':{'id':_0x43154d[_0x9abe('0x43')]['id']}})[_0x9abe('0x3d')](handleEntityNotFound(_0x361026,null))[_0x9abe('0x3d')](saveUpdates(_0x43154d[_0x9abe('0x48')],null))[_0x9abe('0x3d')](respondWithResult(_0x361026,null))[_0x9abe('0x41')](handleError(_0x361026,null));};exports[_0x9abe('0x20')]=function(_0x1f1462,_0x1bd9eb){return db[_0x9abe('0x28')][_0x9abe('0x49')]({'where':{'id':_0x1f1462[_0x9abe('0x43')]['id']}})[_0x9abe('0x3d')](handleEntityNotFound(_0x1bd9eb,null))[_0x9abe('0x3d')](removeEntity(_0x1bd9eb,null))[_0x9abe('0x41')](handleError(_0x1bd9eb,null));}; \ No newline at end of file +var _0x2248=['filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','find','catch','create','body','params','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','then','end','error','stack','name','index','SugarcrmField','rawAttributes','fieldName','type','key','model','map','keys','intersection','query','fields','attributes','length','nolimit','order','sort','where','pick','filters'];(function(_0x12889e,_0x696fbe){var _0x21d316=function(_0x4a0d65){while(--_0x4a0d65){_0x12889e['push'](_0x12889e['shift']());}};_0x21d316(++_0x696fbe);}(_0x2248,0xfb));var _0x8224=function(_0x3381ba,_0x4ccb5a){_0x3381ba=_0x3381ba-0x0;var _0x2827ee=_0x2248[_0x3381ba];return _0x2827ee;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x8224('0x0'));var jsonpatch=require(_0x8224('0x1'));var rp=require(_0x8224('0x2'));var moment=require(_0x8224('0x3'));var BPromise=require(_0x8224('0x4'));var Mustache=require(_0x8224('0x5'));var util=require(_0x8224('0x6'));var path=require(_0x8224('0x7'));var sox=require(_0x8224('0x8'));var csv=require(_0x8224('0x9'));var ejs=require(_0x8224('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8224('0xb'));var squel=require(_0x8224('0xc'));var crypto=require(_0x8224('0xd'));var jsforce=require(_0x8224('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x8224('0x9'));var querystring=require('querystring');var Papa=require(_0x8224('0xf'));var Redis=require(_0x8224('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x8224('0x11'));var as=require(_0x8224('0x12'));var hardwareService=require(_0x8224('0x13'));var logger=require(_0x8224('0x14'))(_0x8224('0x15'));var utils=require(_0x8224('0x16'));var config=require(_0x8224('0x17'));var licenseUtil=require(_0x8224('0x18'));var db=require(_0x8224('0x19'))['db'];function respondWithStatusCode(_0x3bad56,_0xf98e97){_0xf98e97=_0xf98e97||0xcc;return function(_0x11bf09){if(_0x11bf09){return _0x3bad56[_0x8224('0x1a')](_0xf98e97);}return _0x3bad56[_0x8224('0x1b')](_0xf98e97)['end']();};}function respondWithResult(_0x423c1b,_0x1431c7){_0x1431c7=_0x1431c7||0xc8;return function(_0x4c8147){if(_0x4c8147){return _0x423c1b[_0x8224('0x1b')](_0x1431c7)['json'](_0x4c8147);}};}function respondWithFilteredResult(_0x3c4049,_0x4b8453){return function(_0x59e32c){if(_0x59e32c){var _0x261632=typeof _0x4b8453[_0x8224('0x1c')]===_0x8224('0x1d')&&typeof _0x4b8453[_0x8224('0x1e')]==='undefined';var _0x4409b5=_0x59e32c[_0x8224('0x1f')];var _0x554dd6=_0x261632?0x0:_0x4b8453[_0x8224('0x1c')];var _0x25b0c1=_0x261632?_0x59e32c[_0x8224('0x1f')]:_0x4b8453['offset']+_0x4b8453[_0x8224('0x1e')];var _0x384ddb;if(_0x25b0c1>=_0x4409b5){_0x25b0c1=_0x4409b5;_0x384ddb=0xc8;}else{_0x384ddb=0xce;}_0x3c4049['status'](_0x384ddb);return _0x3c4049[_0x8224('0x20')](_0x8224('0x21'),_0x554dd6+'-'+_0x25b0c1+'/'+_0x4409b5)[_0x8224('0x22')](_0x59e32c);}return null;};}function patchUpdates(_0x54b232){return function(_0x8d90d8){try{jsonpatch[_0x8224('0x23')](_0x8d90d8,_0x54b232,!![]);}catch(_0x39b094){return BPromise[_0x8224('0x24')](_0x39b094);}return _0x8d90d8[_0x8224('0x25')]();};}function saveUpdates(_0x982fb7,_0x564a8f){return function(_0x39805c){if(_0x39805c){return _0x39805c[_0x8224('0x26')](_0x982fb7)['then'](function(_0x1394b6){return _0x1394b6;});}return null;};}function removeEntity(_0x9c7aa7,_0x3e3803){return function(_0xfdf918){if(_0xfdf918){return _0xfdf918[_0x8224('0x27')]()[_0x8224('0x28')](function(){_0x9c7aa7[_0x8224('0x1b')](0xcc)[_0x8224('0x29')]();});}};}function handleEntityNotFound(_0x40e410,_0x2cfa54){return function(_0x34c5ff){if(!_0x34c5ff){_0x40e410[_0x8224('0x1a')](0x194);}return _0x34c5ff;};}function handleError(_0x4eefe9,_0x5f3ea5){_0x5f3ea5=_0x5f3ea5||0x1f4;return function(_0x1a55b0){logger[_0x8224('0x2a')](_0x1a55b0[_0x8224('0x2b')]);if(_0x1a55b0[_0x8224('0x2c')]){delete _0x1a55b0[_0x8224('0x2c')];}_0x4eefe9['status'](_0x5f3ea5)['send'](_0x1a55b0);};}exports[_0x8224('0x2d')]=function(_0x6de39d,_0x380ef1){var _0x20fe4d={},_0x4dd90b={},_0x303b99={'count':0x0,'rows':[]};var _0xeb59dc=_['map'](db[_0x8224('0x2e')][_0x8224('0x2f')],function(_0x566c62){return{'name':_0x566c62[_0x8224('0x30')],'type':_0x566c62[_0x8224('0x31')][_0x8224('0x32')]};});_0x4dd90b[_0x8224('0x33')]=_[_0x8224('0x34')](_0xeb59dc,'name');_0x4dd90b['query']=_[_0x8224('0x35')](_0x6de39d['query']);_0x4dd90b['filters']=_[_0x8224('0x36')](_0x4dd90b[_0x8224('0x33')],_0x4dd90b[_0x8224('0x37')]);_0x20fe4d['attributes']=_['intersection'](_0x4dd90b[_0x8224('0x33')],qs[_0x8224('0x38')](_0x6de39d['query'][_0x8224('0x38')]));_0x20fe4d[_0x8224('0x39')]=_0x20fe4d[_0x8224('0x39')][_0x8224('0x3a')]?_0x20fe4d[_0x8224('0x39')]:_0x4dd90b[_0x8224('0x33')];if(!_0x6de39d['query']['hasOwnProperty'](_0x8224('0x3b'))){_0x20fe4d[_0x8224('0x1e')]=qs[_0x8224('0x1e')](_0x6de39d[_0x8224('0x37')][_0x8224('0x1e')]);_0x20fe4d['offset']=qs[_0x8224('0x1c')](_0x6de39d[_0x8224('0x37')][_0x8224('0x1c')]);}_0x20fe4d[_0x8224('0x3c')]=qs[_0x8224('0x3d')](_0x6de39d[_0x8224('0x37')]['sort']);_0x20fe4d[_0x8224('0x3e')]=qs['filters'](_[_0x8224('0x3f')](_0x6de39d['query'],_0x4dd90b[_0x8224('0x40')]),_0xeb59dc);if(_0x6de39d[_0x8224('0x37')][_0x8224('0x41')]){_0x20fe4d['where']=_[_0x8224('0x42')](_0x20fe4d['where'],{'$or':_['map'](_0xeb59dc,function(_0x4652e9){if(_0x4652e9[_0x8224('0x31')]!==_0x8224('0x43')){var _0x39ad7f={};_0x39ad7f[_0x4652e9[_0x8224('0x2c')]]={'$like':'%'+_0x6de39d[_0x8224('0x37')][_0x8224('0x41')]+'%'};return _0x39ad7f;}})});}_0x20fe4d=_[_0x8224('0x42')]({},_0x20fe4d,_0x6de39d[_0x8224('0x44')]);var _0x2d9132={'where':_0x20fe4d[_0x8224('0x3e')]};return db[_0x8224('0x2e')]['count'](_0x2d9132)[_0x8224('0x28')](function(_0x2b1c09){_0x303b99['count']=_0x2b1c09;if(_0x6de39d[_0x8224('0x37')][_0x8224('0x45')]){_0x20fe4d[_0x8224('0x46')]=[{'all':!![]}];}return db['SugarcrmField'][_0x8224('0x47')](_0x20fe4d);})['then'](function(_0x4185e2){_0x303b99[_0x8224('0x48')]=_0x4185e2;return _0x303b99;})[_0x8224('0x28')](respondWithFilteredResult(_0x380ef1,_0x20fe4d))['catch'](handleError(_0x380ef1,null));};exports[_0x8224('0x49')]=function(_0x43000f,_0x3cbfee){var _0x2f940e={'raw':!![],'where':{'id':_0x43000f['params']['id']}},_0x1bd935={};_0x1bd935[_0x8224('0x33')]=_[_0x8224('0x35')](db[_0x8224('0x2e')]['rawAttributes']);_0x1bd935[_0x8224('0x37')]=_['keys'](_0x43000f[_0x8224('0x37')]);_0x1bd935[_0x8224('0x40')]=_['intersection'](_0x1bd935[_0x8224('0x33')],_0x1bd935['query']);_0x2f940e[_0x8224('0x39')]=_[_0x8224('0x36')](_0x1bd935[_0x8224('0x33')],qs[_0x8224('0x38')](_0x43000f[_0x8224('0x37')][_0x8224('0x38')]));_0x2f940e[_0x8224('0x39')]=_0x2f940e['attributes'][_0x8224('0x3a')]?_0x2f940e['attributes']:_0x1bd935[_0x8224('0x33')];if(_0x43000f['query'][_0x8224('0x45')]){_0x2f940e[_0x8224('0x46')]=[{'all':!![]}];}_0x2f940e=_[_0x8224('0x42')]({},_0x2f940e,_0x43000f[_0x8224('0x44')]);return db[_0x8224('0x2e')][_0x8224('0x4a')](_0x2f940e)['then'](handleEntityNotFound(_0x3cbfee,null))[_0x8224('0x28')](respondWithResult(_0x3cbfee,null))[_0x8224('0x4b')](handleError(_0x3cbfee,null));};exports[_0x8224('0x4c')]=function(_0x43cfdb,_0x5ae887){return db[_0x8224('0x2e')][_0x8224('0x4c')](_0x43cfdb[_0x8224('0x4d')],{})[_0x8224('0x28')](respondWithResult(_0x5ae887,0xc9))[_0x8224('0x4b')](handleError(_0x5ae887,null));};exports[_0x8224('0x26')]=function(_0x38da5e,_0x4de607){if(_0x38da5e[_0x8224('0x4d')]['id']){delete _0x38da5e[_0x8224('0x4d')]['id'];}return db['SugarcrmField']['find']({'where':{'id':_0x38da5e[_0x8224('0x4e')]['id']}})[_0x8224('0x28')](handleEntityNotFound(_0x4de607,null))[_0x8224('0x28')](saveUpdates(_0x38da5e[_0x8224('0x4d')],null))[_0x8224('0x28')](respondWithResult(_0x4de607,null))[_0x8224('0x4b')](handleError(_0x4de607,null));};exports['destroy']=function(_0xa7df93,_0x2156ac){return db[_0x8224('0x2e')]['find']({'where':{'id':_0xa7df93[_0x8224('0x4e')]['id']}})[_0x8224('0x28')](handleEntityNotFound(_0x2156ac,null))[_0x8224('0x28')](removeEntity(_0x2156ac,null))[_0x8224('0x4b')](handleError(_0x2156ac,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 16e5299..eab940e 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 _0x692f=['moment','bluebird','request-promise','../../config/environment','./intSugarcrmField.attributes','exports','define','int_sugarcrm_fields','sugarcrm_unique_index','FieldId','util','../../config/logger'];(function(_0x1c05d,_0x116e78){var _0x1968d4=function(_0x3dd58b){while(--_0x3dd58b){_0x1c05d['push'](_0x1c05d['shift']());}};_0x1968d4(++_0x116e78);}(_0x692f,0x196));var _0xf692=function(_0xd1b4d7,_0x28b2c1){_0xd1b4d7=_0xd1b4d7-0x0;var _0x3002ec=_0x692f[_0xd1b4d7];return _0x3002ec;};'use strict';var _=require('lodash');var util=require(_0xf692('0x0'));var logger=require(_0xf692('0x1'))('api');var moment=require(_0xf692('0x2'));var BPromise=require(_0xf692('0x3'));var rp=require(_0xf692('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xf692('0x5'));var attributes=require(_0xf692('0x6'));module[_0xf692('0x7')]=function(_0x3f0e08,_0x2e0ae0){return _0x3f0e08[_0xf692('0x8')]('SugarcrmField',attributes,{'tableName':_0xf692('0x9'),'paranoid':![],'indexes':[{'name':_0xf692('0xa'),'fields':['idField',_0xf692('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5554=['exports','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','idField','util','api','moment','bluebird','request-promise','rimraf','./intSugarcrmField.attributes'];(function(_0x3970cf,_0x36f9a0){var _0x4ac432=function(_0x58cf15){while(--_0x58cf15){_0x3970cf['push'](_0x3970cf['shift']());}};_0x4ac432(++_0x36f9a0);}(_0x5554,0x19d));var _0x4555=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x5554[_0x110c3d];return _0x226d67;};'use strict';var _=require('lodash');var util=require(_0x4555('0x0'));var logger=require('../../config/logger')(_0x4555('0x1'));var moment=require(_0x4555('0x2'));var BPromise=require(_0x4555('0x3'));var rp=require(_0x4555('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4555('0x5'));var config=require('../../config/environment');var attributes=require(_0x4555('0x6'));module[_0x4555('0x7')]=function(_0x1b468d,_0x4d6059){return _0x1b468d['define'](_0x4555('0x8'),attributes,{'tableName':_0x4555('0x9'),'paranoid':![],'indexes':[{'name':_0x4555('0xa'),'fields':[_0x4555('0xb'),'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 926fb5d..a95acc0 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 _0x1ee1=['../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','lodash','moment','randomstring','ioredis','../../mysqldb'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0x1ee1,0xa6));var _0x11ee=function(_0x4722d8,_0xb14907){_0x4722d8=_0x4722d8-0x0;var _0x38b2d4=_0x1ee1[_0x4722d8];return _0x38b2d4;};'use strict';var _=require(_0x11ee('0x0'));var util=require('util');var moment=require(_0x11ee('0x1'));var BPromise=require('bluebird');var rs=require(_0x11ee('0x2'));var fs=require('fs');var Redis=require(_0x11ee('0x3'));var db=require(_0x11ee('0x4'))['db'];var utils=require(_0x11ee('0x5'));var logger=require('../../config/logger')(_0x11ee('0x6'));var config=require(_0x11ee('0x7'));var jayson=require(_0x11ee('0x8'));var client=jayson['client'][_0x11ee('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5f1b2b,_0x4f15f8,_0x5d8cb9){return new BPromise(function(_0x38de62,_0x9f4420){return client[_0x11ee('0xa')](_0x5f1b2b,_0x5d8cb9)[_0x11ee('0xb')](function(_0x1110d8){logger[_0x11ee('0xc')](_0x11ee('0xd'),_0x4f15f8,_0x11ee('0xe'));logger['debug']('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x4f15f8,_0x11ee('0xe'),JSON[_0x11ee('0xf')](_0x1110d8));if(_0x1110d8['error']){if(_0x1110d8[_0x11ee('0x10')]['code']===0x1f4){logger[_0x11ee('0x10')](_0x11ee('0xd'),_0x4f15f8,_0x1110d8[_0x11ee('0x10')][_0x11ee('0x11')]);return _0x9f4420(_0x1110d8[_0x11ee('0x10')][_0x11ee('0x11')]);}logger['error'](_0x11ee('0xd'),_0x4f15f8,_0x1110d8[_0x11ee('0x10')][_0x11ee('0x11')]);return _0x38de62(_0x1110d8[_0x11ee('0x10')][_0x11ee('0x11')]);}else{logger[_0x11ee('0xc')]('SugarcrmField,\x20%s,\x20%s',_0x4f15f8,'request\x20sent');_0x38de62(_0x1110d8['result'][_0x11ee('0x11')]);}})[_0x11ee('0x12')](function(_0x3f2128){logger[_0x11ee('0x10')]('SugarcrmField,\x20%s,\x20%s',_0x4f15f8,_0x3f2128);_0x9f4420(_0x3f2128);});});} \ No newline at end of file +var _0x392a=['stringify','error','code','message','result','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','SugarcrmField,\x20%s,\x20%s,\x20%s'];(function(_0x4051be,_0x4e30dc){var _0x10d8e5=function(_0x1ae1c2){while(--_0x1ae1c2){_0x4051be['push'](_0x4051be['shift']());}};_0x10d8e5(++_0x4e30dc);}(_0x392a,0x83));var _0xa392=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x392a[_0x199572];return _0x13cfa3;};'use strict';var _=require(_0xa392('0x0'));var util=require(_0xa392('0x1'));var moment=require('moment');var BPromise=require(_0xa392('0x2'));var rs=require(_0xa392('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa392('0x4'))['db'];var utils=require(_0xa392('0x5'));var logger=require(_0xa392('0x6'))(_0xa392('0x7'));var config=require('../../config/environment');var jayson=require(_0xa392('0x8'));var client=jayson[_0xa392('0x9')][_0xa392('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2b50cf,_0x44ccaf,_0x267fa6){return new BPromise(function(_0x28864b,_0x25b908){return client[_0xa392('0xb')](_0x2b50cf,_0x267fa6)['then'](function(_0x570339){logger[_0xa392('0xc')](_0xa392('0xd'),_0x44ccaf,_0xa392('0xe'));logger['debug'](_0xa392('0xf'),_0x44ccaf,_0xa392('0xe'),JSON[_0xa392('0x10')](_0x570339));if(_0x570339[_0xa392('0x11')]){if(_0x570339['error'][_0xa392('0x12')]===0x1f4){logger['error'](_0xa392('0xd'),_0x44ccaf,_0x570339[_0xa392('0x11')][_0xa392('0x13')]);return _0x25b908(_0x570339[_0xa392('0x11')][_0xa392('0x13')]);}logger['error'](_0xa392('0xd'),_0x44ccaf,_0x570339[_0xa392('0x11')]['message']);return _0x28864b(_0x570339['error']['message']);}else{logger['info'](_0xa392('0xd'),_0x44ccaf,_0xa392('0xe'));_0x28864b(_0x570339[_0xa392('0x14')][_0xa392('0x13')]);}})['catch'](function(_0x1dcee2){logger[_0xa392('0x11')]('SugarcrmField,\x20%s,\x20%s',_0x44ccaf,_0x1dcee2);_0x25b908(_0x1dcee2);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index f301c62..2d39bcb 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 _0x4780=['get','isAuthenticated','index','/:id/configurations','getConfigurations','getFields','post','addConfiguration','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller'];(function(_0x4d7379,_0x4b4e63){var _0x46d7cf=function(_0x53f5f0){while(--_0x53f5f0){_0x4d7379['push'](_0x4d7379['shift']());}};_0x46d7cf(++_0x4b4e63);}(_0x4780,0xbe));var _0x0478=function(_0x4a8da8,_0x362222){_0x4a8da8=_0x4a8da8-0x0;var _0x326719=_0x4780[_0x4a8da8];return _0x326719;};'use strict';var multer=require(_0x0478('0x0'));var util=require(_0x0478('0x1'));var path=require('path');var timeout=require(_0x0478('0x2'));var express=require(_0x0478('0x3'));var router=express['Router']();var fs_extra=require(_0x0478('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x0478('0x5'));var config=require(_0x0478('0x6'));var controller=require(_0x0478('0x7'));router[_0x0478('0x8')]('/',auth[_0x0478('0x9')](),controller[_0x0478('0xa')]);router[_0x0478('0x8')]('/:id',auth[_0x0478('0x9')](),controller['show']);router[_0x0478('0x8')](_0x0478('0xb'),auth[_0x0478('0x9')](),controller[_0x0478('0xc')]);router['get']('/:id/fields',auth['isAuthenticated'](),controller[_0x0478('0xd')]);router[_0x0478('0xe')]('/',auth[_0x0478('0x9')](),controller['create']);router['post']('/:id/configurations',auth[_0x0478('0x9')](),controller[_0x0478('0xf')]);router[_0x0478('0x10')](_0x0478('0x11'),auth['isAuthenticated'](),controller[_0x0478('0x12')]);router[_0x0478('0x13')](_0x0478('0x11'),auth['isAuthenticated'](),controller[_0x0478('0x14')]);module[_0x0478('0x15')]=router; \ No newline at end of file +var _0xbbcb=['create','addConfiguration','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','/:id','getConfigurations','/:id/fields','getFields','post'];(function(_0x1633a0,_0x3cdfc1){var _0x523846=function(_0x564b28){while(--_0x564b28){_0x1633a0['push'](_0x1633a0['shift']());}};_0x523846(++_0x3cdfc1);}(_0xbbcb,0x16e));var _0xbbbc=function(_0x155843,_0x43404e){_0x155843=_0x155843-0x0;var _0x2dd29f=_0xbbcb[_0x155843];return _0x2dd29f;};'use strict';var multer=require(_0xbbbc('0x0'));var util=require(_0xbbbc('0x1'));var path=require(_0xbbbc('0x2'));var timeout=require(_0xbbbc('0x3'));var express=require(_0xbbbc('0x4'));var router=express[_0xbbbc('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xbbbc('0x6'));var interaction=require(_0xbbbc('0x7'));var config=require(_0xbbbc('0x8'));var controller=require(_0xbbbc('0x9'));router[_0xbbbc('0xa')]('/',auth[_0xbbbc('0xb')](),controller[_0xbbbc('0xc')]);router[_0xbbbc('0xa')](_0xbbbc('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xbbbc('0xa')]('/:id/configurations',auth['isAuthenticated'](),controller[_0xbbbc('0xe')]);router[_0xbbbc('0xa')](_0xbbbc('0xf'),auth[_0xbbbc('0xb')](),controller[_0xbbbc('0x10')]);router[_0xbbbc('0x11')]('/',auth['isAuthenticated'](),controller[_0xbbbc('0x12')]);router[_0xbbbc('0x11')]('/:id/configurations',auth[_0xbbbc('0xb')](),controller[_0xbbbc('0x13')]);router[_0xbbbc('0x14')]('/:id',auth[_0xbbbc('0xb')](),controller[_0xbbbc('0x15')]);router['delete'](_0xbbbc('0xd'),auth[_0xbbbc('0xb')](),controller[_0xbbbc('0x16')]);module[_0xbbbc('0x17')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 97b19c3..a5bc7e9 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 _0xdc00=['STRING','HelpDesk','exports'];(function(_0x652911,_0x3b8615){var _0xb34610=function(_0x56a350){while(--_0x56a350){_0x652911['push'](_0x652911['shift']());}};_0xb34610(++_0x3b8615);}(_0xdc00,0x1ac));var _0x0dc0=function(_0x59e7d5,_0x209fca){_0x59e7d5=_0x59e7d5-0x0;var _0x4eaa4f=_0xdc00[_0x59e7d5];return _0x4eaa4f;};'use strict';var Sequelize=require('sequelize');module[_0x0dc0('0x0')]={'name':{'type':Sequelize[_0x0dc0('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x0dc0('0x1')]},'username':{'type':Sequelize[_0x0dc0('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x0dc0('0x2')},'remoteUri':{'type':Sequelize[_0x0dc0('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'accessKey':{'type':Sequelize[_0x0dc0('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xc7b3=['exports','STRING','sequelize'];(function(_0xf6be2d,_0x30101e){var _0x58e4fa=function(_0x2f444b){while(--_0x2f444b){_0xf6be2d['push'](_0xf6be2d['shift']());}};_0x58e4fa(++_0x30101e);}(_0xc7b3,0xc8));var _0x3c7b=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0xc7b3[_0x1694f5];return _0x5b4321;};'use strict';var Sequelize=require(_0x3c7b('0x0'));module[_0x3c7b('0x1')]={'name':{'type':Sequelize[_0x3c7b('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x3c7b('0x2')]},'username':{'type':Sequelize[_0x3c7b('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x3c7b('0x2')],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize[_0x3c7b('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'accessKey':{'type':Sequelize[_0x3c7b('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 795db1e..70673c9 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 _0x622f=['vTiger\x20error:\x20','test','getFields,\x20%s,\x20%s,\x20%s','statusCode','eml-format','rimraf','request-promise','moment','bluebird','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','json','offset','undefined','limit','count','status','apply','reject','save','update','then','destroy','error','stack','name','VtigerAccount','rawAttributes','type','key','map','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','length','options','find','create','body','VtigerConfiguration','getConfigurations','addConfiguration','findOne','AccountId','Subjects','channel','Descriptions','getDescriptions','VtigerField','md5','getFields','username','description','moduleName','remoteUri','serverUrl','accessKey','slice','substring','%s/webservice.php','getchallenge','success','POST','login','result','GET','describe','sessionName','autogenerated','owner','includes','remove','false','label','startsWith','cf_','picklistValues','value','log'];(function(_0x44fa9d,_0x22010f){var _0x3bacab=function(_0x244765){while(--_0x244765){_0x44fa9d['push'](_0x44fa9d['shift']());}};_0x3bacab(++_0x22010f);}(_0x622f,0x16f));var _0xf622=function(_0x3ef180,_0x4fd7f8){_0x3ef180=_0x3ef180-0x0;var _0x3c78f5=_0x622f[_0x3ef180];return _0x3c78f5;};'use strict';var emlformat=require(_0xf622('0x0'));var rimraf=require(_0xf622('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf622('0x2'));var moment=require(_0xf622('0x3'));var BPromise=require(_0xf622('0x4'));var Mustache=require('mustache');var util=require(_0xf622('0x5'));var path=require(_0xf622('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf622('0x7'));var fs=require('fs');var fs_extra=require(_0xf622('0x8'));var _=require(_0xf622('0x9'));var squel=require(_0xf622('0xa'));var crypto=require(_0xf622('0xb'));var jsforce=require(_0xf622('0xc'));var deskjs=require(_0xf622('0xd'));var toCsv=require(_0xf622('0xe'));var querystring=require('querystring');var Papa=require(_0xf622('0xf'));var Redis=require(_0xf622('0x10'));var authService=require(_0xf622('0x11'));var qs=require(_0xf622('0x12'));var as=require(_0xf622('0x13'));var hardwareService=require(_0xf622('0x14'));var logger=require(_0xf622('0x15'))(_0xf622('0x16'));var utils=require(_0xf622('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xf622('0x18'));var db=require(_0xf622('0x19'))['db'];var integrations=require(_0xf622('0x1a'));function respondWithStatusCode(_0x32331d,_0x176616){_0x176616=_0x176616||0xcc;return function(_0x1122cf){if(_0x1122cf){return _0x32331d[_0xf622('0x1b')](_0x176616);}return _0x32331d['status'](_0x176616)[_0xf622('0x1c')]();};}function respondWithResult(_0x4aa35a,_0x53d922){_0x53d922=_0x53d922||0xc8;return function(_0xe58c9c){if(_0xe58c9c){return _0x4aa35a['status'](_0x53d922)[_0xf622('0x1d')](_0xe58c9c);}};}function respondWithFilteredResult(_0x4ef915,_0x51b10a){return function(_0x256167){if(_0x256167){var _0x2c61cb=typeof _0x51b10a[_0xf622('0x1e')]===_0xf622('0x1f')&&typeof _0x51b10a[_0xf622('0x20')]===_0xf622('0x1f');var _0x23065f=_0x256167['count'];var _0x563ec4=_0x2c61cb?0x0:_0x51b10a['offset'];var _0x2cf62c=_0x2c61cb?_0x256167[_0xf622('0x21')]:_0x51b10a[_0xf622('0x1e')]+_0x51b10a['limit'];var _0x5eb4d6;if(_0x2cf62c>=_0x23065f){_0x2cf62c=_0x23065f;_0x5eb4d6=0xc8;}else{_0x5eb4d6=0xce;}_0x4ef915[_0xf622('0x22')](_0x5eb4d6);return _0x4ef915['set']('Content-Range',_0x563ec4+'-'+_0x2cf62c+'/'+_0x23065f)[_0xf622('0x1d')](_0x256167);}return null;};}function patchUpdates(_0x1fbb1d){return function(_0x2cfe1d){try{jsonpatch[_0xf622('0x23')](_0x2cfe1d,_0x1fbb1d,!![]);}catch(_0x59b916){return BPromise[_0xf622('0x24')](_0x59b916);}return _0x2cfe1d[_0xf622('0x25')]();};}function saveUpdates(_0x331b29,_0x5ddbd7){return function(_0x488597){if(_0x488597){return _0x488597[_0xf622('0x26')](_0x331b29)[_0xf622('0x27')](function(_0x2fc894){return _0x2fc894;});}return null;};}function removeEntity(_0x48910e,_0x22d13c){return function(_0x41cb63){if(_0x41cb63){return _0x41cb63[_0xf622('0x28')]()[_0xf622('0x27')](function(){_0x48910e[_0xf622('0x22')](0xcc)[_0xf622('0x1c')]();});}};}function handleEntityNotFound(_0x2ba92a,_0x3935ff){return function(_0x5088d1){if(!_0x5088d1){_0x2ba92a[_0xf622('0x1b')](0x194);}return _0x5088d1;};}function handleError(_0x90281,_0x31170c){_0x31170c=_0x31170c||0x1f4;return function(_0x3aea6c){logger[_0xf622('0x29')](_0x3aea6c[_0xf622('0x2a')]);if(_0x3aea6c['name']){delete _0x3aea6c[_0xf622('0x2b')];}_0x90281[_0xf622('0x22')](_0x31170c)['send'](_0x3aea6c);};}exports['index']=function(_0x512156,_0x648ee7){var _0x148bd9={},_0x4d0462={},_0x125cb2={'count':0x0,'rows':[]};var _0x4febc3=_['map'](db[_0xf622('0x2c')][_0xf622('0x2d')],function(_0xb95f90){return{'name':_0xb95f90['fieldName'],'type':_0xb95f90[_0xf622('0x2e')][_0xf622('0x2f')]};});_0x4d0462['model']=_[_0xf622('0x30')](_0x4febc3,'name');_0x4d0462[_0xf622('0x31')]=_['keys'](_0x512156[_0xf622('0x31')]);_0x4d0462[_0xf622('0x32')]=_[_0xf622('0x33')](_0x4d0462[_0xf622('0x34')],_0x4d0462['query']);_0x148bd9[_0xf622('0x35')]=_[_0xf622('0x33')](_0x4d0462[_0xf622('0x34')],qs[_0xf622('0x36')](_0x512156['query'][_0xf622('0x36')]));_0x148bd9[_0xf622('0x35')]=_0x148bd9[_0xf622('0x35')]['length']?_0x148bd9['attributes']:_0x4d0462['model'];if(!_0x512156[_0xf622('0x31')][_0xf622('0x37')](_0xf622('0x38'))){_0x148bd9[_0xf622('0x20')]=qs[_0xf622('0x20')](_0x512156[_0xf622('0x31')][_0xf622('0x20')]);_0x148bd9[_0xf622('0x1e')]=qs[_0xf622('0x1e')](_0x512156[_0xf622('0x31')][_0xf622('0x1e')]);}_0x148bd9[_0xf622('0x39')]=qs['sort'](_0x512156['query'][_0xf622('0x3a')]);_0x148bd9['where']=qs[_0xf622('0x32')](_[_0xf622('0x3b')](_0x512156[_0xf622('0x31')],_0x4d0462[_0xf622('0x32')]),_0x4febc3);if(_0x512156[_0xf622('0x31')][_0xf622('0x3c')]){_0x148bd9[_0xf622('0x3d')]=_[_0xf622('0x3e')](_0x148bd9[_0xf622('0x3d')],{'$or':_['map'](_0x4febc3,function(_0x1cc428){if(_0x1cc428[_0xf622('0x2e')]!==_0xf622('0x3f')){var _0x28c597={};_0x28c597[_0x1cc428['name']]={'$like':'%'+_0x512156['query'][_0xf622('0x3c')]+'%'};return _0x28c597;}})});}_0x148bd9=_[_0xf622('0x3e')]({},_0x148bd9,_0x512156['options']);var _0x1bf3bc={'where':_0x148bd9['where']};return db['VtigerAccount'][_0xf622('0x21')](_0x1bf3bc)['then'](function(_0x2d954b){_0x125cb2[_0xf622('0x21')]=_0x2d954b;if(_0x512156[_0xf622('0x31')][_0xf622('0x40')]){_0x148bd9[_0xf622('0x41')]=[{'all':!![]}];}return db[_0xf622('0x2c')][_0xf622('0x42')](_0x148bd9);})[_0xf622('0x27')](function(_0x56d01e){_0x125cb2[_0xf622('0x43')]=_0x56d01e;return _0x125cb2;})['then'](respondWithFilteredResult(_0x648ee7,_0x148bd9))[_0xf622('0x44')](handleError(_0x648ee7,null));};exports[_0xf622('0x45')]=function(_0x2769ea,_0x3d7cb5){var _0x58ef78={'raw':![],'where':{'id':_0x2769ea[_0xf622('0x46')]['id']}},_0x3df207={};_0x3df207[_0xf622('0x34')]=_['keys'](db['VtigerAccount'][_0xf622('0x2d')]);_0x3df207[_0xf622('0x31')]=_[_0xf622('0x47')](_0x2769ea[_0xf622('0x31')]);_0x3df207[_0xf622('0x32')]=_[_0xf622('0x33')](_0x3df207[_0xf622('0x34')],_0x3df207['query']);_0x58ef78[_0xf622('0x35')]=_[_0xf622('0x33')](_0x3df207['model'],qs[_0xf622('0x36')](_0x2769ea[_0xf622('0x31')][_0xf622('0x36')]));_0x58ef78['attributes']=_0x58ef78['attributes'][_0xf622('0x48')]?_0x58ef78['attributes']:_0x3df207['model'];if(_0x2769ea[_0xf622('0x31')][_0xf622('0x40')]){_0x58ef78[_0xf622('0x41')]=[{'all':!![]}];}_0x58ef78=_['merge']({},_0x58ef78,_0x2769ea[_0xf622('0x49')]);return db['VtigerAccount'][_0xf622('0x4a')](_0x58ef78)[_0xf622('0x27')](handleEntityNotFound(_0x3d7cb5,null))[_0xf622('0x27')](respondWithResult(_0x3d7cb5,null))[_0xf622('0x44')](handleError(_0x3d7cb5,null));};exports[_0xf622('0x4b')]=function(_0x33aaa2,_0x25da23){return db[_0xf622('0x2c')][_0xf622('0x4b')](_0x33aaa2['body'],{})['then'](respondWithResult(_0x25da23,0xc9))[_0xf622('0x44')](handleError(_0x25da23,null));};exports['update']=function(_0x99ed84,_0x291300){if(_0x99ed84['body']['id']){delete _0x99ed84[_0xf622('0x4c')]['id'];}return db[_0xf622('0x2c')][_0xf622('0x4a')]({'where':{'id':_0x99ed84[_0xf622('0x46')]['id']}})['then'](handleEntityNotFound(_0x291300,null))['then'](saveUpdates(_0x99ed84[_0xf622('0x4c')],null))['then'](respondWithResult(_0x291300,null))[_0xf622('0x44')](handleError(_0x291300,null));};exports[_0xf622('0x28')]=function(_0x12f373,_0x144821){return db[_0xf622('0x2c')][_0xf622('0x4a')]({'where':{'id':_0x12f373[_0xf622('0x46')]['id']}})['then'](handleEntityNotFound(_0x144821,null))['then'](removeEntity(_0x144821,null))[_0xf622('0x44')](handleError(_0x144821,null));};exports['getConfigurations']=function(_0x1feaca,_0x5aeb41,_0x418dd1){var _0x4b0539={};var _0x50be5d={};var _0x57f432;var _0x27198c;return db[_0xf622('0x2c')]['findOne']({'where':{'id':_0x1feaca[_0xf622('0x46')]['id']}})['then'](handleEntityNotFound(_0x5aeb41,null))[_0xf622('0x27')](function(_0x447e92){if(_0x447e92){_0x57f432=_0x447e92;_0x50be5d[_0xf622('0x34')]=_['keys'](db[_0xf622('0x4d')][_0xf622('0x2d')]);_0x50be5d[_0xf622('0x31')]=_[_0xf622('0x47')](_0x1feaca[_0xf622('0x31')]);_0x50be5d['filters']=_['intersection'](_0x50be5d[_0xf622('0x34')],_0x50be5d[_0xf622('0x31')]);_0x4b0539[_0xf622('0x35')]=_[_0xf622('0x33')](_0x50be5d['model'],qs[_0xf622('0x36')](_0x1feaca[_0xf622('0x31')][_0xf622('0x36')]));_0x4b0539[_0xf622('0x35')]=_0x4b0539[_0xf622('0x35')][_0xf622('0x48')]?_0x4b0539['attributes']:_0x50be5d[_0xf622('0x34')];_0x4b0539['order']=qs[_0xf622('0x3a')](_0x1feaca[_0xf622('0x31')][_0xf622('0x3a')]);_0x4b0539['where']=qs[_0xf622('0x32')](_['pick'](_0x1feaca[_0xf622('0x31')],_0x50be5d[_0xf622('0x32')]));if(_0x1feaca[_0xf622('0x31')][_0xf622('0x3c')]){_0x4b0539[_0xf622('0x3d')]=_['merge'](_0x4b0539[_0xf622('0x3d')],{'$or':_['map'](_0x4b0539[_0xf622('0x35')],function(_0xa8a47a){var _0x589962={};_0x589962[_0xa8a47a]={'$like':'%'+_0x1feaca[_0xf622('0x31')]['filter']+'%'};return _0x589962;})});}_0x4b0539=_[_0xf622('0x3e')]({},_0x4b0539,_0x1feaca[_0xf622('0x49')]);return _0x57f432[_0xf622('0x4e')](_0x4b0539);}})[_0xf622('0x27')](function(_0x29084c){if(_0x29084c){_0x27198c=_0x29084c[_0xf622('0x48')];if(!_0x1feaca[_0xf622('0x31')][_0xf622('0x37')](_0xf622('0x38'))){_0x4b0539[_0xf622('0x20')]=qs[_0xf622('0x20')](_0x1feaca[_0xf622('0x31')][_0xf622('0x20')]);_0x4b0539[_0xf622('0x1e')]=qs[_0xf622('0x1e')](_0x1feaca['query'][_0xf622('0x1e')]);}return _0x57f432[_0xf622('0x4e')](_0x4b0539);}})[_0xf622('0x27')](function(_0x2a155c){if(_0x2a155c){return _0x2a155c?{'count':_0x27198c,'rows':_0x2a155c}:null;}})[_0xf622('0x27')](respondWithResult(_0x5aeb41,null))[_0xf622('0x44')](handleError(_0x5aeb41,null));};exports[_0xf622('0x4f')]=function(_0x5831e0,_0x5544b8,_0x125101){if(_0x5831e0[_0xf622('0x4c')]['id']){delete _0x5831e0[_0xf622('0x4c')]['id'];}return db[_0xf622('0x2c')][_0xf622('0x50')]({'where':{'id':_0x5831e0['params']['id']}})[_0xf622('0x27')](handleEntityNotFound(_0x5544b8,null))['then'](function(_0x4c622d){if(_0x4c622d){_0x5831e0[_0xf622('0x4c')][_0xf622('0x51')]=_0x4c622d['id'];_0x5831e0[_0xf622('0x4c')][_0xf622('0x52')]=integrations['getSubjects'](_0x5831e0[_0xf622('0x4c')][_0xf622('0x53')],_0x5831e0['body'][_0xf622('0x2e')]);_0x5831e0['body'][_0xf622('0x54')]=integrations[_0xf622('0x55')](_0x5831e0[_0xf622('0x4c')][_0xf622('0x53')],_0x5831e0[_0xf622('0x4c')][_0xf622('0x2e')]);return db[_0xf622('0x4d')][_0xf622('0x4b')](_0x5831e0[_0xf622('0x4c')],{'include':[{'model':db[_0xf622('0x56')],'as':_0xf622('0x52')},{'model':db[_0xf622('0x56')],'as':_0xf622('0x54')}]});}return null;})[_0xf622('0x27')](respondWithResult(_0x5544b8,null))[_0xf622('0x44')](handleError(_0x5544b8,null));};var md5=require(_0xf622('0x57'));exports[_0xf622('0x58')]=function(_0x3473c5,_0x47ac7e,_0x443512){var _0x25939d=null;var _0x7e58e8=null;var _0x325e03=null;var _0x1cdcb6=null;var _0x2a125f='';return db['VtigerAccount'][_0xf622('0x50')]({'where':{'id':_0x3473c5[_0xf622('0x46')]['id']},'attributes':['id',_0xf622('0x2b'),_0xf622('0x59'),_0xf622('0x5a'),_0xf622('0x5b'),_0xf622('0x5c'),_0xf622('0x5d'),_0xf622('0x5e')]})[_0xf622('0x27')](handleEntityNotFound(_0x47ac7e,null))['then'](function(_0x30a57c){if(_0x30a57c){_0x25939d=_0x30a57c[_0xf622('0x59')];_0x7e58e8=_0x30a57c['accessKey'];_0x325e03=_0x30a57c[_0xf622('0x5b')];_0x2a125f=_0x30a57c[_0xf622('0x5c')];var _0x549287=_0x2a125f[_0xf622('0x5f')](-0x1);if(_0x549287==='/'){_0x2a125f=_0x2a125f[_0xf622('0x60')](0x0,_0x2a125f['lastIndexOf'](_0x549287));}_0x1cdcb6=util['format'](_0xf622('0x61'),_0x2a125f);var _0x49399a={'method':'GET','uri':_0x1cdcb6,'qs':{'operation':_0xf622('0x62'),'username':_0x30a57c[_0xf622('0x59')]},'json':!![]};return rp(_0x49399a);}})[_0xf622('0x27')](function(_0x3643dc){if(_0x3643dc[_0xf622('0x63')]){var _0x15bbf5={'method':_0xf622('0x64'),'uri':_0x1cdcb6,'form':{'operation':_0xf622('0x65'),'username':_0x25939d,'accessKey':md5(_0x3643dc[_0xf622('0x66')]['token']+_0x7e58e8)},'json':!![]};return rp(_0x15bbf5);}})[_0xf622('0x27')](function(_0x12e548){if(_0x12e548[_0xf622('0x63')]){var _0x1e1ecd={'method':_0xf622('0x67'),'uri':_0x1cdcb6,'qs':{'operation':_0xf622('0x68'),'username':_0x25939d,'sessionName':_0x12e548[_0xf622('0x66')][_0xf622('0x69')],'elementType':_0x325e03},'json':!![]};return rp(_0x1e1ecd);}})[_0xf622('0x27')](function(_0x59ba0c){if(_0x59ba0c[_0xf622('0x63')]){var _0x356b6a=[_0xf622('0x6a'),'reference',_0xf622('0x6b')];_['remove'](_0x59ba0c[_0xf622('0x66')]['fields'],function(_0x442247){return _0x356b6a[_0xf622('0x6c')](_0x442247[_0xf622('0x2e')]['name']);});_[_0xf622('0x6d')](_0x59ba0c[_0xf622('0x66')]['fields'],function(_0x552bd1){return _0x552bd1['editable']===_0xf622('0x6e');});return{'count':_0x59ba0c[_0xf622('0x66')][_0xf622('0x36')][_0xf622('0x48')],'rows':_[_0xf622('0x30')](_0x59ba0c[_0xf622('0x66')][_0xf622('0x36')],function(_0x16fb1a){return{'id':_0x16fb1a['name'],'name':_0x16fb1a[_0xf622('0x6f')],'custom':_[_0xf622('0x70')](_0x16fb1a[_0xf622('0x2b')],_0xf622('0x71'))?!![]:![],'options':_0x16fb1a['type'][_0xf622('0x2b')]==='picklist'&&_0x16fb1a[_0xf622('0x2e')][_0xf622('0x72')][_0xf622('0x48')]>0x0?_[_0xf622('0x30')](_0x16fb1a['type']['picklistValues'],function(_0x4b1af8){return{'name':_0x4b1af8[_0xf622('0x6f')],'value':_0x4b1af8[_0xf622('0x73')]};}):[]};})};}})[_0xf622('0x27')](respondWithResult(_0x47ac7e,null))['catch'](function(_0x386b0e){console[_0xf622('0x74')](_0xf622('0x75')+_0x386b0e);var _0x23bfd4=_0x3473c5['query'][_0xf622('0x76')]?0x1f4:_0x386b0e['statusCode']||0x1f4;logger[_0xf622('0x29')](_0xf622('0x77'),_0xf622('0x58'),_0x23bfd4,JSON['stringify'](_0x386b0e));delete _0x386b0e[_0xf622('0x2b')];if(_0x23bfd4===0x191){_0x23bfd4=0x190;}_0x47ac7e[_0xf622('0x22')](_0x23bfd4)['send'](_0x3473c5['query'][_0xf622('0x76')]?{'message':'Wrong\x20credentials','statusCode':_0x386b0e[_0xf622('0x78')]}:_0x386b0e);});}; \ No newline at end of file +var _0x2072=['then','destroy','error','stack','name','index','map','VtigerAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','merge','where','VIRTUAL','includeAll','include','findAll','rows','show','params','options','find','catch','create','body','update','getConfigurations','VtigerConfiguration','nolimit','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','VtigerField','getFields','username','moduleName','remoteUri','serverUrl','accessKey','slice','substring','lastIndexOf','format','getchallenge','success','login','result','token','GET','describe','sessionName','autogenerated','reference','remove','includes','editable','false','label','startsWith','picklist','picklistValues','value','log','vTiger\x20error:\x20','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','test','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../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','apply','save'];(function(_0x1adb96,_0x5c8a81){var _0x13ab64=function(_0x4d031a){while(--_0x4d031a){_0x1adb96['push'](_0x1adb96['shift']());}};_0x13ab64(++_0x5c8a81);}(_0x2072,0xd0));var _0x2207=function(_0x3d57f5,_0x58043f){_0x3d57f5=_0x3d57f5-0x0;var _0x1b6ef3=_0x2072[_0x3d57f5];return _0x1b6ef3;};'use strict';var emlformat=require(_0x2207('0x0'));var rimraf=require(_0x2207('0x1'));var zipdir=require(_0x2207('0x2'));var jsonpatch=require(_0x2207('0x3'));var rp=require(_0x2207('0x4'));var moment=require(_0x2207('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x2207('0x6'));var util=require('util');var path=require('path');var sox=require(_0x2207('0x7'));var csv=require(_0x2207('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2207('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x2207('0xa'));var jsforce=require(_0x2207('0xb'));var deskjs=require(_0x2207('0xc'));var toCsv=require(_0x2207('0x8'));var querystring=require(_0x2207('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x2207('0xe'));var qs=require(_0x2207('0xf'));var as=require(_0x2207('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2207('0x11'))(_0x2207('0x12'));var utils=require(_0x2207('0x13'));var config=require(_0x2207('0x14'));var licenseUtil=require(_0x2207('0x15'));var db=require(_0x2207('0x16'))['db'];var integrations=require(_0x2207('0x17'));function respondWithStatusCode(_0x279f7e,_0xceeb8d){_0xceeb8d=_0xceeb8d||0xcc;return function(_0x3cd2b1){if(_0x3cd2b1){return _0x279f7e[_0x2207('0x18')](_0xceeb8d);}return _0x279f7e[_0x2207('0x19')](_0xceeb8d)[_0x2207('0x1a')]();};}function respondWithResult(_0x256a02,_0x2bfea2){_0x2bfea2=_0x2bfea2||0xc8;return function(_0x239a21){if(_0x239a21){return _0x256a02['status'](_0x2bfea2)['json'](_0x239a21);}};}function respondWithFilteredResult(_0xf39205,_0x19a826){return function(_0x3e769f){if(_0x3e769f){var _0x155c8b=typeof _0x19a826[_0x2207('0x1b')]===_0x2207('0x1c')&&typeof _0x19a826[_0x2207('0x1d')]==='undefined';var _0x490843=_0x3e769f[_0x2207('0x1e')];var _0x16d671=_0x155c8b?0x0:_0x19a826['offset'];var _0x5558ec=_0x155c8b?_0x3e769f[_0x2207('0x1e')]:_0x19a826[_0x2207('0x1b')]+_0x19a826['limit'];var _0x4a7cdb;if(_0x5558ec>=_0x490843){_0x5558ec=_0x490843;_0x4a7cdb=0xc8;}else{_0x4a7cdb=0xce;}_0xf39205[_0x2207('0x19')](_0x4a7cdb);return _0xf39205[_0x2207('0x1f')](_0x2207('0x20'),_0x16d671+'-'+_0x5558ec+'/'+_0x490843)[_0x2207('0x21')](_0x3e769f);}return null;};}function patchUpdates(_0x530bd7){return function(_0x2033d3){try{jsonpatch[_0x2207('0x22')](_0x2033d3,_0x530bd7,!![]);}catch(_0x3a7523){return BPromise['reject'](_0x3a7523);}return _0x2033d3[_0x2207('0x23')]();};}function saveUpdates(_0x4a0c40,_0x5111a6){return function(_0x21b7f1){if(_0x21b7f1){return _0x21b7f1['update'](_0x4a0c40)[_0x2207('0x24')](function(_0x143717){return _0x143717;});}return null;};}function removeEntity(_0xe6410c,_0x2e5866){return function(_0x53c8bc){if(_0x53c8bc){return _0x53c8bc[_0x2207('0x25')]()[_0x2207('0x24')](function(){_0xe6410c[_0x2207('0x19')](0xcc)[_0x2207('0x1a')]();});}};}function handleEntityNotFound(_0x2efca6,_0x4c1658){return function(_0x3f6118){if(!_0x3f6118){_0x2efca6[_0x2207('0x18')](0x194);}return _0x3f6118;};}function handleError(_0x1f0525,_0x411442){_0x411442=_0x411442||0x1f4;return function(_0x51c102){logger[_0x2207('0x26')](_0x51c102[_0x2207('0x27')]);if(_0x51c102[_0x2207('0x28')]){delete _0x51c102[_0x2207('0x28')];}_0x1f0525[_0x2207('0x19')](_0x411442)['send'](_0x51c102);};}exports[_0x2207('0x29')]=function(_0x28c12d,_0x31233c){var _0x396def={},_0x48d8ba={},_0x586468={'count':0x0,'rows':[]};var _0x1e100f=_[_0x2207('0x2a')](db[_0x2207('0x2b')][_0x2207('0x2c')],function(_0xf022e7){return{'name':_0xf022e7[_0x2207('0x2d')],'type':_0xf022e7[_0x2207('0x2e')][_0x2207('0x2f')]};});_0x48d8ba[_0x2207('0x30')]=_[_0x2207('0x2a')](_0x1e100f,_0x2207('0x28'));_0x48d8ba[_0x2207('0x31')]=_[_0x2207('0x32')](_0x28c12d[_0x2207('0x31')]);_0x48d8ba[_0x2207('0x33')]=_[_0x2207('0x34')](_0x48d8ba['model'],_0x48d8ba[_0x2207('0x31')]);_0x396def[_0x2207('0x35')]=_[_0x2207('0x34')](_0x48d8ba[_0x2207('0x30')],qs['fields'](_0x28c12d[_0x2207('0x31')][_0x2207('0x36')]));_0x396def['attributes']=_0x396def['attributes'][_0x2207('0x37')]?_0x396def[_0x2207('0x35')]:_0x48d8ba[_0x2207('0x30')];if(!_0x28c12d['query'][_0x2207('0x38')]('nolimit')){_0x396def[_0x2207('0x1d')]=qs[_0x2207('0x1d')](_0x28c12d[_0x2207('0x31')]['limit']);_0x396def['offset']=qs['offset'](_0x28c12d[_0x2207('0x31')]['offset']);}_0x396def[_0x2207('0x39')]=qs['sort'](_0x28c12d[_0x2207('0x31')][_0x2207('0x3a')]);_0x396def['where']=qs[_0x2207('0x33')](_[_0x2207('0x3b')](_0x28c12d['query'],_0x48d8ba[_0x2207('0x33')]),_0x1e100f);if(_0x28c12d[_0x2207('0x31')][_0x2207('0x3c')]){_0x396def['where']=_[_0x2207('0x3d')](_0x396def[_0x2207('0x3e')],{'$or':_[_0x2207('0x2a')](_0x1e100f,function(_0x5e3446){if(_0x5e3446[_0x2207('0x2e')]!==_0x2207('0x3f')){var _0x4e6d6f={};_0x4e6d6f[_0x5e3446['name']]={'$like':'%'+_0x28c12d[_0x2207('0x31')][_0x2207('0x3c')]+'%'};return _0x4e6d6f;}})});}_0x396def=_[_0x2207('0x3d')]({},_0x396def,_0x28c12d['options']);var _0x707e5c={'where':_0x396def[_0x2207('0x3e')]};return db['VtigerAccount'][_0x2207('0x1e')](_0x707e5c)['then'](function(_0x5d86bf){_0x586468[_0x2207('0x1e')]=_0x5d86bf;if(_0x28c12d[_0x2207('0x31')][_0x2207('0x40')]){_0x396def[_0x2207('0x41')]=[{'all':!![]}];}return db[_0x2207('0x2b')][_0x2207('0x42')](_0x396def);})['then'](function(_0x4b09fe){_0x586468[_0x2207('0x43')]=_0x4b09fe;return _0x586468;})[_0x2207('0x24')](respondWithFilteredResult(_0x31233c,_0x396def))['catch'](handleError(_0x31233c,null));};exports[_0x2207('0x44')]=function(_0x146b53,_0x25d424){var _0x1e31b7={'raw':![],'where':{'id':_0x146b53[_0x2207('0x45')]['id']}},_0x36a76f={};_0x36a76f[_0x2207('0x30')]=_['keys'](db[_0x2207('0x2b')]['rawAttributes']);_0x36a76f[_0x2207('0x31')]=_[_0x2207('0x32')](_0x146b53[_0x2207('0x31')]);_0x36a76f[_0x2207('0x33')]=_[_0x2207('0x34')](_0x36a76f['model'],_0x36a76f['query']);_0x1e31b7[_0x2207('0x35')]=_[_0x2207('0x34')](_0x36a76f['model'],qs[_0x2207('0x36')](_0x146b53[_0x2207('0x31')][_0x2207('0x36')]));_0x1e31b7[_0x2207('0x35')]=_0x1e31b7[_0x2207('0x35')]['length']?_0x1e31b7['attributes']:_0x36a76f[_0x2207('0x30')];if(_0x146b53[_0x2207('0x31')]['includeAll']){_0x1e31b7[_0x2207('0x41')]=[{'all':!![]}];}_0x1e31b7=_[_0x2207('0x3d')]({},_0x1e31b7,_0x146b53[_0x2207('0x46')]);return db[_0x2207('0x2b')][_0x2207('0x47')](_0x1e31b7)[_0x2207('0x24')](handleEntityNotFound(_0x25d424,null))[_0x2207('0x24')](respondWithResult(_0x25d424,null))[_0x2207('0x48')](handleError(_0x25d424,null));};exports['create']=function(_0xe71fbb,_0x1c9e5c){return db[_0x2207('0x2b')][_0x2207('0x49')](_0xe71fbb[_0x2207('0x4a')],{})[_0x2207('0x24')](respondWithResult(_0x1c9e5c,0xc9))[_0x2207('0x48')](handleError(_0x1c9e5c,null));};exports[_0x2207('0x4b')]=function(_0x43672c,_0x131e18){if(_0x43672c['body']['id']){delete _0x43672c['body']['id'];}return db['VtigerAccount'][_0x2207('0x47')]({'where':{'id':_0x43672c[_0x2207('0x45')]['id']}})['then'](handleEntityNotFound(_0x131e18,null))[_0x2207('0x24')](saveUpdates(_0x43672c[_0x2207('0x4a')],null))[_0x2207('0x24')](respondWithResult(_0x131e18,null))['catch'](handleError(_0x131e18,null));};exports[_0x2207('0x25')]=function(_0x1d5ef3,_0x2e301d){return db[_0x2207('0x2b')][_0x2207('0x47')]({'where':{'id':_0x1d5ef3[_0x2207('0x45')]['id']}})[_0x2207('0x24')](handleEntityNotFound(_0x2e301d,null))[_0x2207('0x24')](removeEntity(_0x2e301d,null))['catch'](handleError(_0x2e301d,null));};exports[_0x2207('0x4c')]=function(_0x2f68c0,_0x985687,_0x5af613){var _0x1cacbe={};var _0x3094af={};var _0x84baf6;var _0xe21003;return db[_0x2207('0x2b')]['findOne']({'where':{'id':_0x2f68c0[_0x2207('0x45')]['id']}})[_0x2207('0x24')](handleEntityNotFound(_0x985687,null))[_0x2207('0x24')](function(_0x340a6c){if(_0x340a6c){_0x84baf6=_0x340a6c;_0x3094af[_0x2207('0x30')]=_['keys'](db[_0x2207('0x4d')][_0x2207('0x2c')]);_0x3094af[_0x2207('0x31')]=_[_0x2207('0x32')](_0x2f68c0['query']);_0x3094af[_0x2207('0x33')]=_[_0x2207('0x34')](_0x3094af['model'],_0x3094af[_0x2207('0x31')]);_0x1cacbe[_0x2207('0x35')]=_[_0x2207('0x34')](_0x3094af[_0x2207('0x30')],qs[_0x2207('0x36')](_0x2f68c0[_0x2207('0x31')][_0x2207('0x36')]));_0x1cacbe[_0x2207('0x35')]=_0x1cacbe[_0x2207('0x35')][_0x2207('0x37')]?_0x1cacbe['attributes']:_0x3094af[_0x2207('0x30')];_0x1cacbe[_0x2207('0x39')]=qs[_0x2207('0x3a')](_0x2f68c0[_0x2207('0x31')][_0x2207('0x3a')]);_0x1cacbe['where']=qs[_0x2207('0x33')](_['pick'](_0x2f68c0[_0x2207('0x31')],_0x3094af[_0x2207('0x33')]));if(_0x2f68c0['query'][_0x2207('0x3c')]){_0x1cacbe[_0x2207('0x3e')]=_['merge'](_0x1cacbe[_0x2207('0x3e')],{'$or':_[_0x2207('0x2a')](_0x1cacbe[_0x2207('0x35')],function(_0x398972){var _0x83bec5={};_0x83bec5[_0x398972]={'$like':'%'+_0x2f68c0[_0x2207('0x31')][_0x2207('0x3c')]+'%'};return _0x83bec5;})});}_0x1cacbe=_[_0x2207('0x3d')]({},_0x1cacbe,_0x2f68c0[_0x2207('0x46')]);return _0x84baf6[_0x2207('0x4c')](_0x1cacbe);}})[_0x2207('0x24')](function(_0x2a63f9){if(_0x2a63f9){_0xe21003=_0x2a63f9['length'];if(!_0x2f68c0[_0x2207('0x31')][_0x2207('0x38')](_0x2207('0x4e'))){_0x1cacbe[_0x2207('0x1d')]=qs[_0x2207('0x1d')](_0x2f68c0[_0x2207('0x31')][_0x2207('0x1d')]);_0x1cacbe[_0x2207('0x1b')]=qs['offset'](_0x2f68c0[_0x2207('0x31')]['offset']);}return _0x84baf6[_0x2207('0x4c')](_0x1cacbe);}})['then'](function(_0x1c80f0){if(_0x1c80f0){return _0x1c80f0?{'count':_0xe21003,'rows':_0x1c80f0}:null;}})['then'](respondWithResult(_0x985687,null))['catch'](handleError(_0x985687,null));};exports[_0x2207('0x4f')]=function(_0x1cd67c,_0x1aeb27,_0x794603){if(_0x1cd67c[_0x2207('0x4a')]['id']){delete _0x1cd67c[_0x2207('0x4a')]['id'];}return db[_0x2207('0x2b')][_0x2207('0x50')]({'where':{'id':_0x1cd67c['params']['id']}})['then'](handleEntityNotFound(_0x1aeb27,null))['then'](function(_0x232aab){if(_0x232aab){_0x1cd67c['body'][_0x2207('0x51')]=_0x232aab['id'];_0x1cd67c[_0x2207('0x4a')][_0x2207('0x52')]=integrations[_0x2207('0x53')](_0x1cd67c[_0x2207('0x4a')][_0x2207('0x54')],_0x1cd67c[_0x2207('0x4a')][_0x2207('0x2e')]);_0x1cd67c['body'][_0x2207('0x55')]=integrations['getDescriptions'](_0x1cd67c[_0x2207('0x4a')][_0x2207('0x54')],_0x1cd67c['body']['type']);return db[_0x2207('0x4d')]['create'](_0x1cd67c[_0x2207('0x4a')],{'include':[{'model':db['VtigerField'],'as':_0x2207('0x52')},{'model':db[_0x2207('0x56')],'as':_0x2207('0x55')}]});}return null;})['then'](respondWithResult(_0x1aeb27,null))[_0x2207('0x48')](handleError(_0x1aeb27,null));};var md5=require('md5');exports[_0x2207('0x57')]=function(_0x2f5c7d,_0x1dfa3f,_0x1dfe6e){var _0x58190d=null;var _0x7ea826=null;var _0x353859=null;var _0x276d95=null;var _0x320489='';return db[_0x2207('0x2b')][_0x2207('0x50')]({'where':{'id':_0x2f5c7d[_0x2207('0x45')]['id']},'attributes':['id',_0x2207('0x28'),_0x2207('0x58'),'description',_0x2207('0x59'),_0x2207('0x5a'),_0x2207('0x5b'),_0x2207('0x5c')]})[_0x2207('0x24')](handleEntityNotFound(_0x1dfa3f,null))[_0x2207('0x24')](function(_0x1c6e09){if(_0x1c6e09){_0x58190d=_0x1c6e09['username'];_0x7ea826=_0x1c6e09['accessKey'];_0x353859=_0x1c6e09[_0x2207('0x59')];_0x320489=_0x1c6e09[_0x2207('0x5a')];var _0x4f1a24=_0x320489[_0x2207('0x5d')](-0x1);if(_0x4f1a24==='/'){_0x320489=_0x320489[_0x2207('0x5e')](0x0,_0x320489[_0x2207('0x5f')](_0x4f1a24));}_0x276d95=util[_0x2207('0x60')]('%s/webservice.php',_0x320489);var _0x15dc7d={'method':'GET','uri':_0x276d95,'qs':{'operation':_0x2207('0x61'),'username':_0x1c6e09[_0x2207('0x58')]},'json':!![]};return rp(_0x15dc7d);}})[_0x2207('0x24')](function(_0x137ee8){if(_0x137ee8[_0x2207('0x62')]){var _0x26d34e={'method':'POST','uri':_0x276d95,'form':{'operation':_0x2207('0x63'),'username':_0x58190d,'accessKey':md5(_0x137ee8[_0x2207('0x64')][_0x2207('0x65')]+_0x7ea826)},'json':!![]};return rp(_0x26d34e);}})[_0x2207('0x24')](function(_0x38767a){if(_0x38767a[_0x2207('0x62')]){var _0x31bba0={'method':_0x2207('0x66'),'uri':_0x276d95,'qs':{'operation':_0x2207('0x67'),'username':_0x58190d,'sessionName':_0x38767a[_0x2207('0x64')][_0x2207('0x68')],'elementType':_0x353859},'json':!![]};return rp(_0x31bba0);}})['then'](function(_0x58a615){if(_0x58a615[_0x2207('0x62')]){var _0x2559e5=[_0x2207('0x69'),_0x2207('0x6a'),'owner'];_[_0x2207('0x6b')](_0x58a615[_0x2207('0x64')][_0x2207('0x36')],function(_0x2e2186){return _0x2559e5[_0x2207('0x6c')](_0x2e2186[_0x2207('0x2e')][_0x2207('0x28')]);});_[_0x2207('0x6b')](_0x58a615[_0x2207('0x64')][_0x2207('0x36')],function(_0x1a1c71){return _0x1a1c71[_0x2207('0x6d')]===_0x2207('0x6e');});return{'count':_0x58a615[_0x2207('0x64')]['fields'][_0x2207('0x37')],'rows':_[_0x2207('0x2a')](_0x58a615['result'][_0x2207('0x36')],function(_0xbcc0e9){return{'id':_0xbcc0e9[_0x2207('0x28')],'name':_0xbcc0e9[_0x2207('0x6f')],'custom':_[_0x2207('0x70')](_0xbcc0e9[_0x2207('0x28')],'cf_')?!![]:![],'options':_0xbcc0e9[_0x2207('0x2e')][_0x2207('0x28')]===_0x2207('0x71')&&_0xbcc0e9['type'][_0x2207('0x72')][_0x2207('0x37')]>0x0?_[_0x2207('0x2a')](_0xbcc0e9[_0x2207('0x2e')][_0x2207('0x72')],function(_0x1adad8){return{'name':_0x1adad8['label'],'value':_0x1adad8[_0x2207('0x73')]};}):[]};})};}})[_0x2207('0x24')](respondWithResult(_0x1dfa3f,null))[_0x2207('0x48')](function(_0x46afe6){console[_0x2207('0x74')](_0x2207('0x75')+_0x46afe6);var _0x167b00=_0x2f5c7d['query']['test']?0x1f4:_0x46afe6[_0x2207('0x76')]||0x1f4;logger[_0x2207('0x26')](_0x2207('0x77'),_0x2207('0x57'),_0x167b00,JSON['stringify'](_0x46afe6));delete _0x46afe6[_0x2207('0x28')];if(_0x167b00===0x191){_0x167b00=0x190;}_0x1dfa3f['status'](_0x167b00)[_0x2207('0x78')](_0x2f5c7d['query'][_0x2207('0x79')]?{'message':'Wrong\x20credentials','statusCode':_0x46afe6[_0x2207('0x76')]}:_0x46afe6);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index e37e88a..600449e 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 _0xa4f0=['int_vtiger_accounts','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','VtigerAccount'];(function(_0x567cca,_0x416716){var _0x408b16=function(_0x32a220){while(--_0x32a220){_0x567cca['push'](_0x567cca['shift']());}};_0x408b16(++_0x416716);}(_0xa4f0,0x119));var _0x0a4f=function(_0x2f4b13,_0x1193b2){_0x2f4b13=_0x2f4b13-0x0;var _0x3bff04=_0xa4f0[_0x2f4b13];return _0x3bff04;};'use strict';var _=require('lodash');var util=require(_0x0a4f('0x0'));var logger=require(_0x0a4f('0x1'))(_0x0a4f('0x2'));var moment=require('moment');var BPromise=require(_0x0a4f('0x3'));var rp=require(_0x0a4f('0x4'));var fs=require('fs');var path=require(_0x0a4f('0x5'));var rimraf=require(_0x0a4f('0x6'));var config=require(_0x0a4f('0x7'));var attributes=require(_0x0a4f('0x8'));var integrations=require(_0x0a4f('0x9'));module[_0x0a4f('0xa')]=function(_0x4ce0f9,_0x12b4c6){return _0x4ce0f9[_0x0a4f('0xb')](_0x0a4f('0xc'),attributes,{'tableName':_0x0a4f('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc0fb=['define','VtigerAccount','int_vtiger_accounts','lodash','util','../../config/logger','api','moment','bluebird','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x279a4c,_0x46c4a5){var _0x460ea7=function(_0x238956){while(--_0x238956){_0x279a4c['push'](_0x279a4c['shift']());}};_0x460ea7(++_0x46c4a5);}(_0xc0fb,0xe0));var _0xbc0f=function(_0x288ed3,_0x42b1d2){_0x288ed3=_0x288ed3-0x0;var _0x80475=_0xc0fb[_0x288ed3];return _0x80475;};'use strict';var _=require(_0xbc0f('0x0'));var util=require(_0xbc0f('0x1'));var logger=require(_0xbc0f('0x2'))(_0xbc0f('0x3'));var moment=require(_0xbc0f('0x4'));var BPromise=require(_0xbc0f('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xbc0f('0x6'));var attributes=require(_0xbc0f('0x7'));var integrations=require(_0xbc0f('0x8'));module[_0xbc0f('0x9')]=function(_0x53fa1e,_0x5a3800){return _0x53fa1e[_0xbc0f('0xa')](_0xbc0f('0xb'),attributes,{'tableName':_0xbc0f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.rpc.js b/server/api/intVtigerAccount/intVtigerAccount.rpc.js index 0067382..053cc3e 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(_0x4fdf74,_0x14cc37){var _0x5dd711=function(_0x3d2754){while(--_0x3d2754){_0x4fdf74['push'](_0x4fdf74['shift']());}};_0x5dd711(++_0x14cc37);}(_0x2e54,0x1dd));var _0x42e5=function(_0x4658ec,_0x6744b8){_0x4658ec=_0x4658ec-0x0;var _0x1bb2ba=_0x2e54[_0x4658ec];return _0x1bb2ba;};'use strict';var _=require(_0x42e5('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x42e5('0x1'));var rs=require(_0x42e5('0x2'));var fs=require('fs');var Redis=require(_0x42e5('0x3'));var db=require(_0x42e5('0x4'))['db'];var utils=require(_0x42e5('0x5'));var logger=require(_0x42e5('0x6'))(_0x42e5('0x7'));var config=require('../../config/environment');var jayson=require(_0x42e5('0x8'));var client=jayson[_0x42e5('0x9')][_0x42e5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4bed10,_0x2af5bb,_0x56be20){return new BPromise(function(_0x335b92,_0x490b99){return client[_0x42e5('0xb')](_0x4bed10,_0x56be20)[_0x42e5('0xc')](function(_0x10ee5a){logger[_0x42e5('0xd')](_0x42e5('0xe'),_0x2af5bb,_0x42e5('0xf'));logger[_0x42e5('0x10')](_0x42e5('0x11'),_0x2af5bb,_0x42e5('0xf'),JSON['stringify'](_0x10ee5a));if(_0x10ee5a[_0x42e5('0x12')]){if(_0x10ee5a[_0x42e5('0x12')]['code']===0x1f4){logger[_0x42e5('0x12')](_0x42e5('0xe'),_0x2af5bb,_0x10ee5a[_0x42e5('0x12')][_0x42e5('0x13')]);return _0x490b99(_0x10ee5a[_0x42e5('0x12')][_0x42e5('0x13')]);}logger[_0x42e5('0x12')](_0x42e5('0xe'),_0x2af5bb,_0x10ee5a[_0x42e5('0x12')][_0x42e5('0x13')]);return _0x335b92(_0x10ee5a['error'][_0x42e5('0x13')]);}else{logger[_0x42e5('0xd')](_0x42e5('0xe'),_0x2af5bb,_0x42e5('0xf'));_0x335b92(_0x10ee5a[_0x42e5('0x14')][_0x42e5('0x13')]);}})[_0x42e5('0x15')](function(_0x3abe3d){logger[_0x42e5('0x12')](_0x42e5('0xe'),_0x2af5bb,_0x3abe3d);_0x490b99(_0x3abe3d);});});}exports[_0x42e5('0x16')]=function(_0x38282d){var _0x11550e=this;return new Promise(function(_0x23fe09,_0x54fcfc){return db[_0x42e5('0x17')]['findAll']({'raw':_0x38282d['options']?_0x38282d[_0x42e5('0x18')][_0x42e5('0x19')]===undefined?!![]:![]:!![],'where':_0x38282d['options']?_0x38282d[_0x42e5('0x18')][_0x42e5('0x1a')]||null:null,'attributes':_0x38282d[_0x42e5('0x18')]?_0x38282d[_0x42e5('0x18')][_0x42e5('0x1b')]||null:null,'limit':_0x38282d[_0x42e5('0x18')]?_0x38282d[_0x42e5('0x18')]['limit']||null:null,'include':_0x38282d['options']?_0x38282d[_0x42e5('0x18')]['include']?_[_0x42e5('0x1c')](_0x38282d[_0x42e5('0x18')][_0x42e5('0x1d')],function(_0x49490f){return{'model':db[_0x49490f[_0x42e5('0x1e')]],'as':_0x49490f['as'],'attributes':_0x49490f['attributes'],'include':_0x49490f[_0x42e5('0x1d')]?_[_0x42e5('0x1c')](_0x49490f[_0x42e5('0x1d')],function(_0x275c80){return{'model':db[_0x275c80[_0x42e5('0x1e')]],'as':_0x275c80['as'],'attributes':_0x275c80['attributes'],'include':_0x275c80['include']?_[_0x42e5('0x1c')](_0x275c80['include'],function(_0x56f812){return{'model':db[_0x56f812[_0x42e5('0x1e')]],'as':_0x56f812['as'],'attributes':_0x56f812['attributes']};}):[]};}):[]};}):[]:[]})[_0x42e5('0xc')](function(_0x2d9e65){logger[_0x42e5('0xd')](_0x42e5('0x16'),_0x38282d);logger[_0x42e5('0x10')](_0x42e5('0x16'),_0x38282d,JSON['stringify'](_0x2d9e65));_0x23fe09(_0x2d9e65);})[_0x42e5('0x15')](function(_0x201d9e){logger[_0x42e5('0x12')](_0x42e5('0x16'),_0x201d9e[_0x42e5('0x13')],_0x38282d);_0x54fcfc(_0x11550e[_0x42e5('0x12')](0x1f4,_0x201d9e[_0x42e5('0x13')]));});});};exports[_0x42e5('0x1f')]=function(_0x5a4930){var _0x2ba9ef=this;return new Promise(function(_0x2c7542,_0x3d9e8b){return db[_0x42e5('0x17')]['find']({'raw':_0x5a4930[_0x42e5('0x18')]?_0x5a4930[_0x42e5('0x18')][_0x42e5('0x19')]===undefined?!![]:![]:!![],'where':_0x5a4930[_0x42e5('0x18')]?_0x5a4930['options']['where']||null:null,'attributes':_0x5a4930[_0x42e5('0x18')]?_0x5a4930['options'][_0x42e5('0x1b')]||null:null,'include':_0x5a4930['options']?_0x5a4930[_0x42e5('0x18')][_0x42e5('0x1d')]?_[_0x42e5('0x1c')](_0x5a4930['options'][_0x42e5('0x1d')],function(_0x3a8d1c){return{'model':db[_0x3a8d1c['model']],'as':_0x3a8d1c['as'],'attributes':_0x3a8d1c[_0x42e5('0x1b')],'include':_0x3a8d1c['include']?_[_0x42e5('0x1c')](_0x3a8d1c[_0x42e5('0x1d')],function(_0x25a040){return{'model':db[_0x25a040[_0x42e5('0x1e')]],'as':_0x25a040['as'],'attributes':_0x25a040[_0x42e5('0x1b')],'include':_0x25a040[_0x42e5('0x1d')]?_[_0x42e5('0x1c')](_0x25a040['include'],function(_0x5a18cc){return{'model':db[_0x5a18cc[_0x42e5('0x1e')]],'as':_0x5a18cc['as'],'attributes':_0x5a18cc[_0x42e5('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x42e5('0xc')](function(_0x4a1a8a){logger['info']('ShowVtigerAccount',_0x5a4930);logger['debug'](_0x42e5('0x1f'),_0x5a4930,JSON[_0x42e5('0x20')](_0x4a1a8a));_0x2c7542(_0x4a1a8a);})[_0x42e5('0x15')](function(_0xedb7bc){logger[_0x42e5('0x12')](_0x42e5('0x1f'),_0xedb7bc[_0x42e5('0x13')],_0x5a4930);_0x3d9e8b(_0x2ba9ef[_0x42e5('0x12')](0x1f4,_0xedb7bc['message']));});});}; \ No newline at end of file +var _0x593e=['findAll','options','raw','where','attributes','limit','include','model','map','stringify','ShowVtigerAccount','VtigerAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','VtigerAccount,\x20%s,\x20%s','message','result','catch','GetVtigerAccount'];(function(_0x408fa7,_0x303486){var _0x1bceea=function(_0x4641ca){while(--_0x4641ca){_0x408fa7['push'](_0x408fa7['shift']());}};_0x1bceea(++_0x303486);}(_0x593e,0xcb));var _0xe593=function(_0x328198,_0x3da0aa){_0x328198=_0x328198-0x0;var _0x59ab32=_0x593e[_0x328198];return _0x59ab32;};'use strict';var _=require(_0xe593('0x0'));var util=require(_0xe593('0x1'));var moment=require(_0xe593('0x2'));var BPromise=require(_0xe593('0x3'));var rs=require(_0xe593('0x4'));var fs=require('fs');var Redis=require(_0xe593('0x5'));var db=require(_0xe593('0x6'))['db'];var utils=require(_0xe593('0x7'));var logger=require('../../config/logger')(_0xe593('0x8'));var config=require(_0xe593('0x9'));var jayson=require(_0xe593('0xa'));var client=jayson[_0xe593('0xb')][_0xe593('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x14cff3,_0x1cda29,_0x307dad){return new BPromise(function(_0x169c08,_0x265099){return client['request'](_0x14cff3,_0x307dad)[_0xe593('0xd')](function(_0x4091db){logger[_0xe593('0xe')]('VtigerAccount,\x20%s,\x20%s',_0x1cda29,'request\x20sent');logger[_0xe593('0xf')](_0xe593('0x10'),_0x1cda29,_0xe593('0x11'),JSON['stringify'](_0x4091db));if(_0x4091db[_0xe593('0x12')]){if(_0x4091db[_0xe593('0x12')][_0xe593('0x13')]===0x1f4){logger[_0xe593('0x12')](_0xe593('0x14'),_0x1cda29,_0x4091db[_0xe593('0x12')][_0xe593('0x15')]);return _0x265099(_0x4091db[_0xe593('0x12')][_0xe593('0x15')]);}logger[_0xe593('0x12')]('VtigerAccount,\x20%s,\x20%s',_0x1cda29,_0x4091db[_0xe593('0x12')][_0xe593('0x15')]);return _0x169c08(_0x4091db['error'][_0xe593('0x15')]);}else{logger[_0xe593('0xe')]('VtigerAccount,\x20%s,\x20%s',_0x1cda29,_0xe593('0x11'));_0x169c08(_0x4091db[_0xe593('0x16')][_0xe593('0x15')]);}})[_0xe593('0x17')](function(_0x3408ec){logger[_0xe593('0x12')]('VtigerAccount,\x20%s,\x20%s',_0x1cda29,_0x3408ec);_0x265099(_0x3408ec);});});}exports[_0xe593('0x18')]=function(_0x470d07){var _0x5f57ce=this;return new Promise(function(_0xd1020e,_0x28b5ed){return db['VtigerAccount'][_0xe593('0x19')]({'raw':_0x470d07[_0xe593('0x1a')]?_0x470d07[_0xe593('0x1a')][_0xe593('0x1b')]===undefined?!![]:![]:!![],'where':_0x470d07[_0xe593('0x1a')]?_0x470d07[_0xe593('0x1a')][_0xe593('0x1c')]||null:null,'attributes':_0x470d07['options']?_0x470d07['options'][_0xe593('0x1d')]||null:null,'limit':_0x470d07['options']?_0x470d07['options'][_0xe593('0x1e')]||null:null,'include':_0x470d07[_0xe593('0x1a')]?_0x470d07['options'][_0xe593('0x1f')]?_['map'](_0x470d07[_0xe593('0x1a')][_0xe593('0x1f')],function(_0x185cea){return{'model':db[_0x185cea[_0xe593('0x20')]],'as':_0x185cea['as'],'attributes':_0x185cea[_0xe593('0x1d')],'include':_0x185cea[_0xe593('0x1f')]?_[_0xe593('0x21')](_0x185cea[_0xe593('0x1f')],function(_0x4fc483){return{'model':db[_0x4fc483[_0xe593('0x20')]],'as':_0x4fc483['as'],'attributes':_0x4fc483[_0xe593('0x1d')],'include':_0x4fc483['include']?_['map'](_0x4fc483[_0xe593('0x1f')],function(_0x25238f){return{'model':db[_0x25238f[_0xe593('0x20')]],'as':_0x25238f['as'],'attributes':_0x25238f[_0xe593('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xe593('0xd')](function(_0x27a3d2){logger['info'](_0xe593('0x18'),_0x470d07);logger['debug'](_0xe593('0x18'),_0x470d07,JSON[_0xe593('0x22')](_0x27a3d2));_0xd1020e(_0x27a3d2);})['catch'](function(_0x337ee0){logger['error'](_0xe593('0x18'),_0x337ee0[_0xe593('0x15')],_0x470d07);_0x28b5ed(_0x5f57ce[_0xe593('0x12')](0x1f4,_0x337ee0['message']));});});};exports[_0xe593('0x23')]=function(_0x13f44){var _0x3066ed=this;return new Promise(function(_0x338222,_0x2588be){return db[_0xe593('0x24')][_0xe593('0x25')]({'raw':_0x13f44['options']?_0x13f44[_0xe593('0x1a')][_0xe593('0x1b')]===undefined?!![]:![]:!![],'where':_0x13f44['options']?_0x13f44[_0xe593('0x1a')]['where']||null:null,'attributes':_0x13f44[_0xe593('0x1a')]?_0x13f44[_0xe593('0x1a')][_0xe593('0x1d')]||null:null,'include':_0x13f44[_0xe593('0x1a')]?_0x13f44[_0xe593('0x1a')][_0xe593('0x1f')]?_[_0xe593('0x21')](_0x13f44[_0xe593('0x1a')][_0xe593('0x1f')],function(_0x4305de){return{'model':db[_0x4305de['model']],'as':_0x4305de['as'],'attributes':_0x4305de[_0xe593('0x1d')],'include':_0x4305de[_0xe593('0x1f')]?_[_0xe593('0x21')](_0x4305de['include'],function(_0x4fefb3){return{'model':db[_0x4fefb3[_0xe593('0x20')]],'as':_0x4fefb3['as'],'attributes':_0x4fefb3['attributes'],'include':_0x4fefb3[_0xe593('0x1f')]?_[_0xe593('0x21')](_0x4fefb3[_0xe593('0x1f')],function(_0x30511c){return{'model':db[_0x30511c[_0xe593('0x20')]],'as':_0x30511c['as'],'attributes':_0x30511c[_0xe593('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xe593('0xd')](function(_0x4889cc){logger['info'](_0xe593('0x23'),_0x13f44);logger['debug'](_0xe593('0x23'),_0x13f44,JSON['stringify'](_0x4889cc));_0x338222(_0x4889cc);})[_0xe593('0x17')](function(_0x5b9589){logger['error'](_0xe593('0x23'),_0x5b9589[_0xe593('0x15')],_0x13f44);_0x2588be(_0x3066ed[_0xe593('0x12')](0x1f4,_0x5b9589['message']));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 682a191..ecc44d9 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 _0xde2d=['Router','fs-extra','../../components/interaction/service','./intVtigerConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x1f60ed,_0x3fa9d8){var _0x3ccb8d=function(_0x2d1840){while(--_0x2d1840){_0x1f60ed['push'](_0x1f60ed['shift']());}};_0x3ccb8d(++_0x3fa9d8);}(_0xde2d,0x67));var _0xdde2=function(_0x5b3c61,_0x3eb2aa){_0x5b3c61=_0x5b3c61-0x0;var _0x153389=_0xde2d[_0x5b3c61];return _0x153389;};'use strict';var multer=require(_0xdde2('0x0'));var util=require(_0xdde2('0x1'));var path=require(_0xdde2('0x2'));var timeout=require(_0xdde2('0x3'));var express=require(_0xdde2('0x4'));var router=express[_0xdde2('0x5')]();var fs_extra=require(_0xdde2('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xdde2('0x7'));var config=require('../../config/environment');var controller=require(_0xdde2('0x8'));router[_0xdde2('0x9')]('/',auth[_0xdde2('0xa')](),controller[_0xdde2('0xb')]);router['get'](_0xdde2('0xc'),auth['isAuthenticated'](),controller[_0xdde2('0xd')]);router[_0xdde2('0x9')](_0xdde2('0xe'),auth['isAuthenticated'](),controller[_0xdde2('0xf')]);router[_0xdde2('0x9')](_0xdde2('0x10'),auth[_0xdde2('0xa')](),controller[_0xdde2('0x11')]);router[_0xdde2('0x9')](_0xdde2('0x12'),auth['isAuthenticated'](),controller[_0xdde2('0x13')]);router[_0xdde2('0x14')]('/',auth[_0xdde2('0xa')](),controller[_0xdde2('0x15')]);router[_0xdde2('0x16')]('/:id',auth[_0xdde2('0xa')](),controller[_0xdde2('0x17')]);router[_0xdde2('0x18')]('/:id',auth[_0xdde2('0xa')](),controller[_0xdde2('0x19')]);module[_0xdde2('0x1a')]=router; \ No newline at end of file +var _0x01c9=['get','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','post','create','put','/:id','update','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','isAuthenticated','index','show'];(function(_0xb9622e,_0x91225d){var _0x12969e=function(_0x5e8b52){while(--_0x5e8b52){_0xb9622e['push'](_0xb9622e['shift']());}};_0x12969e(++_0x91225d);}(_0x01c9,0xb3));var _0x901c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x01c9[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x901c('0x0'));var util=require(_0x901c('0x1'));var path=require(_0x901c('0x2'));var timeout=require(_0x901c('0x3'));var express=require(_0x901c('0x4'));var router=express[_0x901c('0x5')]();var fs_extra=require(_0x901c('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x901c('0x7'));var config=require(_0x901c('0x8'));var controller=require(_0x901c('0x9'));router['get']('/',auth[_0x901c('0xa')](),controller[_0x901c('0xb')]);router['get']('/:id',auth[_0x901c('0xa')](),controller[_0x901c('0xc')]);router[_0x901c('0xd')](_0x901c('0xe'),auth[_0x901c('0xa')](),controller['getFields']);router[_0x901c('0xd')](_0x901c('0xf'),auth[_0x901c('0xa')](),controller[_0x901c('0x10')]);router[_0x901c('0xd')](_0x901c('0x11'),auth[_0x901c('0xa')](),controller['getDescriptions']);router[_0x901c('0x12')]('/',auth[_0x901c('0xa')](),controller[_0x901c('0x13')]);router[_0x901c('0x14')](_0x901c('0x15'),auth[_0x901c('0xa')](),controller[_0x901c('0x16')]);router['delete']('/:id',auth[_0x901c('0xa')](),controller[_0x901c('0x17')]);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 cc05c22..9cbfe9b 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 _0xe83c=['STRING','sequelize','exports'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0xe83c,0x91));var _0xce83=function(_0x580a59,_0x21266c){_0x580a59=_0x580a59-0x0;var _0x19da51=_0xe83c[_0x580a59];return _0x19da51;};'use strict';var Sequelize=require(_0xce83('0x0'));module[_0xce83('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xce83('0x2')]}}; \ No newline at end of file +var _0x7215=['STRING','sequelize'];(function(_0x2a1296,_0x4e325a){var _0x1caeb9=function(_0xc12d0f){while(--_0xc12d0f){_0x2a1296['push'](_0x2a1296['shift']());}};_0x1caeb9(++_0x4e325a);}(_0x7215,0x161));var _0x5721=function(_0x31e26c,_0x2afe26){_0x31e26c=_0x31e26c-0x0;var _0xec208f=_0x7215[_0x31e26c];return _0xec208f;};'use strict';var Sequelize=require(_0x5721('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x5721('0x1')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index b2c0261..f20e766 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 _0xd82a=['merge','VIRTUAL','filter','includeAll','include','rows','catch','show','params','keys','length','options','find','create','body','update','getFields','findOne','VtigerField','sort','getSubjects','nolimit','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','error','name','index','map','VtigerConfiguration','rawAttributes','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','order','where','pick'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xd82a,0xbd));var _0xad82=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0xd82a[_0x5d2803];return _0xdcad2c;};'use strict';var emlformat=require(_0xad82('0x0'));var rimraf=require(_0xad82('0x1'));var zipdir=require(_0xad82('0x2'));var jsonpatch=require(_0xad82('0x3'));var rp=require('request-promise');var moment=require(_0xad82('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xad82('0x5'));var util=require(_0xad82('0x6'));var path=require(_0xad82('0x7'));var sox=require(_0xad82('0x8'));var csv=require(_0xad82('0x9'));var ejs=require(_0xad82('0xa'));var fs=require('fs');var fs_extra=require(_0xad82('0xb'));var _=require(_0xad82('0xc'));var squel=require(_0xad82('0xd'));var crypto=require(_0xad82('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xad82('0xf'));var toCsv=require(_0xad82('0x9'));var querystring=require(_0xad82('0x10'));var Papa=require(_0xad82('0x11'));var Redis=require(_0xad82('0x12'));var authService=require(_0xad82('0x13'));var qs=require(_0xad82('0x14'));var as=require(_0xad82('0x15'));var hardwareService=require(_0xad82('0x16'));var logger=require(_0xad82('0x17'))(_0xad82('0x18'));var utils=require(_0xad82('0x19'));var config=require(_0xad82('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xad82('0x1b'))['db'];function respondWithStatusCode(_0x557bc9,_0x21cc8d){_0x21cc8d=_0x21cc8d||0xcc;return function(_0x5b265f){if(_0x5b265f){return _0x557bc9[_0xad82('0x1c')](_0x21cc8d);}return _0x557bc9[_0xad82('0x1d')](_0x21cc8d)[_0xad82('0x1e')]();};}function respondWithResult(_0x26921d,_0xb6c3ab){_0xb6c3ab=_0xb6c3ab||0xc8;return function(_0x1646e4){if(_0x1646e4){return _0x26921d['status'](_0xb6c3ab)[_0xad82('0x1f')](_0x1646e4);}};}function respondWithFilteredResult(_0x4cc267,_0x6871ec){return function(_0x433f8a){if(_0x433f8a){var _0x37cb6a=typeof _0x6871ec[_0xad82('0x20')]===_0xad82('0x21')&&typeof _0x6871ec[_0xad82('0x22')]===_0xad82('0x21');var _0x3f682d=_0x433f8a[_0xad82('0x23')];var _0x3c95d8=_0x37cb6a?0x0:_0x6871ec[_0xad82('0x20')];var _0x130aa3=_0x37cb6a?_0x433f8a[_0xad82('0x23')]:_0x6871ec[_0xad82('0x20')]+_0x6871ec[_0xad82('0x22')];var _0x1d0218;if(_0x130aa3>=_0x3f682d){_0x130aa3=_0x3f682d;_0x1d0218=0xc8;}else{_0x1d0218=0xce;}_0x4cc267['status'](_0x1d0218);return _0x4cc267[_0xad82('0x24')](_0xad82('0x25'),_0x3c95d8+'-'+_0x130aa3+'/'+_0x3f682d)['json'](_0x433f8a);}return null;};}function patchUpdates(_0x43c86e){return function(_0x5080dd){try{jsonpatch[_0xad82('0x26')](_0x5080dd,_0x43c86e,!![]);}catch(_0x11ab07){return BPromise['reject'](_0x11ab07);}return _0x5080dd[_0xad82('0x27')]();};}function saveUpdates(_0x1ab491,_0x261bb4){return function(_0x5bb38b){if(_0x5bb38b){return _0x5bb38b['update'](_0x1ab491)[_0xad82('0x28')](function(_0x1857d7){return _0x1857d7;});}return null;};}function removeEntity(_0x4be179,_0x19de41){return function(_0x822821){if(_0x822821){return _0x822821[_0xad82('0x29')]()[_0xad82('0x28')](function(){_0x4be179['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3661ca,_0x1630a7){return function(_0x4157d5){if(!_0x4157d5){_0x3661ca[_0xad82('0x1c')](0x194);}return _0x4157d5;};}function handleError(_0xad7f3b,_0x531bce){_0x531bce=_0x531bce||0x1f4;return function(_0xac5104){logger[_0xad82('0x2a')](_0xac5104['stack']);if(_0xac5104[_0xad82('0x2b')]){delete _0xac5104['name'];}_0xad7f3b[_0xad82('0x1d')](_0x531bce)['send'](_0xac5104);};}exports[_0xad82('0x2c')]=function(_0x3443f4,_0x9ddc72){var _0x4036dd={},_0x5b127e={},_0x1fcb5f={'count':0x0,'rows':[]};var _0x54891b=_[_0xad82('0x2d')](db[_0xad82('0x2e')][_0xad82('0x2f')],function(_0x858e8){return{'name':_0x858e8['fieldName'],'type':_0x858e8[_0xad82('0x30')][_0xad82('0x31')]};});_0x5b127e[_0xad82('0x32')]=_[_0xad82('0x2d')](_0x54891b,_0xad82('0x2b'));_0x5b127e[_0xad82('0x33')]=_['keys'](_0x3443f4[_0xad82('0x33')]);_0x5b127e[_0xad82('0x34')]=_['intersection'](_0x5b127e[_0xad82('0x32')],_0x5b127e['query']);_0x4036dd['attributes']=_[_0xad82('0x35')](_0x5b127e[_0xad82('0x32')],qs[_0xad82('0x36')](_0x3443f4['query'][_0xad82('0x36')]));_0x4036dd[_0xad82('0x37')]=_0x4036dd[_0xad82('0x37')]['length']?_0x4036dd['attributes']:_0x5b127e[_0xad82('0x32')];if(!_0x3443f4[_0xad82('0x33')][_0xad82('0x38')]('nolimit')){_0x4036dd[_0xad82('0x22')]=qs['limit'](_0x3443f4[_0xad82('0x33')][_0xad82('0x22')]);_0x4036dd[_0xad82('0x20')]=qs['offset'](_0x3443f4['query'][_0xad82('0x20')]);}_0x4036dd[_0xad82('0x39')]=qs['sort'](_0x3443f4[_0xad82('0x33')]['sort']);_0x4036dd[_0xad82('0x3a')]=qs['filters'](_[_0xad82('0x3b')](_0x3443f4[_0xad82('0x33')],_0x5b127e[_0xad82('0x34')]),_0x54891b);if(_0x3443f4[_0xad82('0x33')]['filter']){_0x4036dd['where']=_[_0xad82('0x3c')](_0x4036dd[_0xad82('0x3a')],{'$or':_[_0xad82('0x2d')](_0x54891b,function(_0x29ab7b){if(_0x29ab7b[_0xad82('0x30')]!==_0xad82('0x3d')){var _0x333528={};_0x333528[_0x29ab7b[_0xad82('0x2b')]]={'$like':'%'+_0x3443f4[_0xad82('0x33')][_0xad82('0x3e')]+'%'};return _0x333528;}})});}_0x4036dd=_['merge']({},_0x4036dd,_0x3443f4['options']);var _0x5d16dd={'where':_0x4036dd['where']};return db['VtigerConfiguration'][_0xad82('0x23')](_0x5d16dd)[_0xad82('0x28')](function(_0x3aa4e0){_0x1fcb5f[_0xad82('0x23')]=_0x3aa4e0;if(_0x3443f4[_0xad82('0x33')][_0xad82('0x3f')]){_0x4036dd[_0xad82('0x40')]=[{'all':!![]}];}return db['VtigerConfiguration']['findAll'](_0x4036dd);})[_0xad82('0x28')](function(_0x5ee57c){_0x1fcb5f[_0xad82('0x41')]=_0x5ee57c;return _0x1fcb5f;})[_0xad82('0x28')](respondWithFilteredResult(_0x9ddc72,_0x4036dd))[_0xad82('0x42')](handleError(_0x9ddc72,null));};exports[_0xad82('0x43')]=function(_0x4809ad,_0x402314){var _0x7bd093={'raw':![],'where':{'id':_0x4809ad[_0xad82('0x44')]['id']}},_0x3d1f6f={};_0x3d1f6f['model']=_['keys'](db[_0xad82('0x2e')]['rawAttributes']);_0x3d1f6f[_0xad82('0x33')]=_[_0xad82('0x45')](_0x4809ad[_0xad82('0x33')]);_0x3d1f6f['filters']=_['intersection'](_0x3d1f6f[_0xad82('0x32')],_0x3d1f6f[_0xad82('0x33')]);_0x7bd093['attributes']=_[_0xad82('0x35')](_0x3d1f6f[_0xad82('0x32')],qs[_0xad82('0x36')](_0x4809ad['query']['fields']));_0x7bd093['attributes']=_0x7bd093[_0xad82('0x37')][_0xad82('0x46')]?_0x7bd093['attributes']:_0x3d1f6f[_0xad82('0x32')];if(_0x4809ad[_0xad82('0x33')][_0xad82('0x3f')]){_0x7bd093[_0xad82('0x40')]=[{'all':!![]}];}_0x7bd093=_['merge']({},_0x7bd093,_0x4809ad[_0xad82('0x47')]);return db[_0xad82('0x2e')][_0xad82('0x48')](_0x7bd093)['then'](handleEntityNotFound(_0x402314,null))[_0xad82('0x28')](respondWithResult(_0x402314,null))[_0xad82('0x42')](handleError(_0x402314,null));};exports[_0xad82('0x49')]=function(_0x472f12,_0x373ef0){return db[_0xad82('0x2e')]['create'](_0x472f12[_0xad82('0x4a')],{})[_0xad82('0x28')](respondWithResult(_0x373ef0,0xc9))[_0xad82('0x42')](handleError(_0x373ef0,null));};exports[_0xad82('0x4b')]=function(_0x4bf2e3,_0x1433d9){if(_0x4bf2e3[_0xad82('0x4a')]['id']){delete _0x4bf2e3[_0xad82('0x4a')]['id'];}return db[_0xad82('0x2e')][_0xad82('0x48')]({'where':{'id':_0x4bf2e3[_0xad82('0x44')]['id']}})[_0xad82('0x28')](handleEntityNotFound(_0x1433d9,null))[_0xad82('0x28')](saveUpdates(_0x4bf2e3['body'],null))[_0xad82('0x28')](respondWithResult(_0x1433d9,null))[_0xad82('0x42')](handleError(_0x1433d9,null));};exports[_0xad82('0x29')]=function(_0x1b91b3,_0x360407){return db[_0xad82('0x2e')][_0xad82('0x48')]({'where':{'id':_0x1b91b3[_0xad82('0x44')]['id']}})['then'](handleEntityNotFound(_0x360407,null))['then'](removeEntity(_0x360407,null))[_0xad82('0x42')](handleError(_0x360407,null));};exports[_0xad82('0x4c')]=function(_0x251455,_0x4b1a36,_0x265361){var _0x58b7c3={};var _0x625aab={};var _0x3ca594;var _0xae8a3a;return db[_0xad82('0x2e')][_0xad82('0x4d')]({'where':{'id':_0x251455['params']['id']}})['then'](handleEntityNotFound(_0x4b1a36,null))[_0xad82('0x28')](function(_0xc708c9){if(_0xc708c9){_0x3ca594=_0xc708c9;_0x625aab[_0xad82('0x32')]=_['keys'](db[_0xad82('0x4e')]['rawAttributes']);_0x625aab['query']=_[_0xad82('0x45')](_0x251455[_0xad82('0x33')]);_0x625aab[_0xad82('0x34')]=_[_0xad82('0x35')](_0x625aab['model'],_0x625aab['query']);_0x58b7c3['attributes']=_[_0xad82('0x35')](_0x625aab[_0xad82('0x32')],qs[_0xad82('0x36')](_0x251455[_0xad82('0x33')][_0xad82('0x36')]));_0x58b7c3[_0xad82('0x37')]=_0x58b7c3[_0xad82('0x37')]['length']?_0x58b7c3[_0xad82('0x37')]:_0x625aab['model'];_0x58b7c3['order']=qs[_0xad82('0x4f')](_0x251455[_0xad82('0x33')][_0xad82('0x4f')]);_0x58b7c3[_0xad82('0x3a')]=qs['filters'](_[_0xad82('0x3b')](_0x251455[_0xad82('0x33')],_0x625aab[_0xad82('0x34')]));if(_0x251455[_0xad82('0x33')][_0xad82('0x3e')]){_0x58b7c3[_0xad82('0x3a')]=_[_0xad82('0x3c')](_0x58b7c3[_0xad82('0x3a')],{'$or':_['map'](_0x58b7c3[_0xad82('0x37')],function(_0x4b8b37){var _0x5421d8={};_0x5421d8[_0x4b8b37]={'$like':'%'+_0x251455[_0xad82('0x33')][_0xad82('0x3e')]+'%'};return _0x5421d8;})});}_0x58b7c3=_[_0xad82('0x3c')]({},_0x58b7c3,_0x251455['options']);return _0x3ca594['getFields'](_0x58b7c3);}})[_0xad82('0x28')](function(_0x5ea297){if(_0x5ea297){_0xae8a3a=_0x5ea297[_0xad82('0x46')];if(!_0x251455[_0xad82('0x33')][_0xad82('0x38')]('nolimit')){_0x58b7c3[_0xad82('0x22')]=qs[_0xad82('0x22')](_0x251455['query']['limit']);_0x58b7c3[_0xad82('0x20')]=qs[_0xad82('0x20')](_0x251455[_0xad82('0x33')][_0xad82('0x20')]);}return _0x3ca594[_0xad82('0x4c')](_0x58b7c3);}})[_0xad82('0x28')](function(_0x71d804){if(_0x71d804){return _0x71d804?{'count':_0xae8a3a,'rows':_0x71d804}:null;}})[_0xad82('0x28')](respondWithResult(_0x4b1a36,null))[_0xad82('0x42')](handleError(_0x4b1a36,null));};exports[_0xad82('0x50')]=function(_0x29b7dd,_0x259593,_0xf6154c){var _0x126d58={};var _0x45efae={};var _0x4d34eb;var _0x3bc004;return db[_0xad82('0x2e')][_0xad82('0x4d')]({'where':{'id':_0x29b7dd['params']['id']}})[_0xad82('0x28')](handleEntityNotFound(_0x259593,null))['then'](function(_0x5c9b98){if(_0x5c9b98){_0x4d34eb=_0x5c9b98;_0x45efae[_0xad82('0x32')]=_[_0xad82('0x45')](db[_0xad82('0x4e')][_0xad82('0x2f')]);_0x45efae[_0xad82('0x33')]=_[_0xad82('0x45')](_0x29b7dd[_0xad82('0x33')]);_0x45efae[_0xad82('0x34')]=_[_0xad82('0x35')](_0x45efae[_0xad82('0x32')],_0x45efae[_0xad82('0x33')]);_0x126d58[_0xad82('0x37')]=_[_0xad82('0x35')](_0x45efae[_0xad82('0x32')],qs['fields'](_0x29b7dd['query']['fields']));_0x126d58[_0xad82('0x37')]=_0x126d58[_0xad82('0x37')][_0xad82('0x46')]?_0x126d58['attributes']:_0x45efae[_0xad82('0x32')];_0x126d58[_0xad82('0x39')]=qs[_0xad82('0x4f')](_0x29b7dd['query'][_0xad82('0x4f')]);_0x126d58['where']=qs[_0xad82('0x34')](_[_0xad82('0x3b')](_0x29b7dd['query'],_0x45efae[_0xad82('0x34')]));if(_0x29b7dd['query'][_0xad82('0x3e')]){_0x126d58[_0xad82('0x3a')]=_[_0xad82('0x3c')](_0x126d58[_0xad82('0x3a')],{'$or':_['map'](_0x126d58[_0xad82('0x37')],function(_0xb36926){var _0x46c059={};_0x46c059[_0xb36926]={'$like':'%'+_0x29b7dd['query'][_0xad82('0x3e')]+'%'};return _0x46c059;})});}_0x126d58=_[_0xad82('0x3c')]({},_0x126d58,_0x29b7dd['options']);return _0x4d34eb[_0xad82('0x50')](_0x126d58);}})[_0xad82('0x28')](function(_0x19d177){if(_0x19d177){_0x3bc004=_0x19d177[_0xad82('0x46')];if(!_0x29b7dd[_0xad82('0x33')][_0xad82('0x38')](_0xad82('0x51'))){_0x126d58[_0xad82('0x22')]=qs[_0xad82('0x22')](_0x29b7dd['query'][_0xad82('0x22')]);_0x126d58['offset']=qs[_0xad82('0x20')](_0x29b7dd[_0xad82('0x33')]['offset']);}return _0x4d34eb[_0xad82('0x50')](_0x126d58);}})['then'](function(_0x1d7698){if(_0x1d7698){return _0x1d7698?{'count':_0x3bc004,'rows':_0x1d7698}:null;}})['then'](respondWithResult(_0x259593,null))[_0xad82('0x42')](handleError(_0x259593,null));};exports[_0xad82('0x52')]=function(_0x3ecee3,_0x59e5a7,_0x127cdb){var _0x1a2ca7={};var _0x570fae={};var _0x5d23fe;var _0x248f6c;return db[_0xad82('0x2e')]['findOne']({'where':{'id':_0x3ecee3['params']['id']}})[_0xad82('0x28')](handleEntityNotFound(_0x59e5a7,null))[_0xad82('0x28')](function(_0x45ddca){if(_0x45ddca){_0x5d23fe=_0x45ddca;_0x570fae['model']=_['keys'](db[_0xad82('0x4e')][_0xad82('0x2f')]);_0x570fae['query']=_[_0xad82('0x45')](_0x3ecee3[_0xad82('0x33')]);_0x570fae[_0xad82('0x34')]=_[_0xad82('0x35')](_0x570fae[_0xad82('0x32')],_0x570fae[_0xad82('0x33')]);_0x1a2ca7[_0xad82('0x37')]=_[_0xad82('0x35')](_0x570fae[_0xad82('0x32')],qs[_0xad82('0x36')](_0x3ecee3['query'][_0xad82('0x36')]));_0x1a2ca7[_0xad82('0x37')]=_0x1a2ca7[_0xad82('0x37')][_0xad82('0x46')]?_0x1a2ca7[_0xad82('0x37')]:_0x570fae[_0xad82('0x32')];_0x1a2ca7[_0xad82('0x39')]=qs[_0xad82('0x4f')](_0x3ecee3[_0xad82('0x33')][_0xad82('0x4f')]);_0x1a2ca7[_0xad82('0x3a')]=qs[_0xad82('0x34')](_[_0xad82('0x3b')](_0x3ecee3[_0xad82('0x33')],_0x570fae[_0xad82('0x34')]));if(_0x3ecee3[_0xad82('0x33')][_0xad82('0x3e')]){_0x1a2ca7[_0xad82('0x3a')]=_[_0xad82('0x3c')](_0x1a2ca7['where'],{'$or':_[_0xad82('0x2d')](_0x1a2ca7[_0xad82('0x37')],function(_0x4c9e6f){var _0x394f73={};_0x394f73[_0x4c9e6f]={'$like':'%'+_0x3ecee3[_0xad82('0x33')][_0xad82('0x3e')]+'%'};return _0x394f73;})});}_0x1a2ca7=_[_0xad82('0x3c')]({},_0x1a2ca7,_0x3ecee3['options']);return _0x5d23fe[_0xad82('0x52')](_0x1a2ca7);}})[_0xad82('0x28')](function(_0x237115){if(_0x237115){_0x248f6c=_0x237115[_0xad82('0x46')];if(!_0x3ecee3['query'][_0xad82('0x38')](_0xad82('0x51'))){_0x1a2ca7['limit']=qs[_0xad82('0x22')](_0x3ecee3[_0xad82('0x33')][_0xad82('0x22')]);_0x1a2ca7[_0xad82('0x20')]=qs[_0xad82('0x20')](_0x3ecee3['query']['offset']);}return _0x5d23fe[_0xad82('0x52')](_0x1a2ca7);}})[_0xad82('0x28')](function(_0xe1b688){if(_0xe1b688){return _0xe1b688?{'count':_0x248f6c,'rows':_0xe1b688}:null;}})[_0xad82('0x28')](respondWithResult(_0x59e5a7,null))[_0xad82('0x42')](handleError(_0x59e5a7,null));}; \ No newline at end of file +var _0x0ea9=['end','json','offset','undefined','limit','count','status','set','apply','reject','save','update','then','destroy','stack','name','send','VtigerConfiguration','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','sort','where','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','find','getFields','findOne','VtigerField','order','pick','hasOwnProperty','nolimit','getSubjects','filter','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x15703e,_0x5d9908){var _0x30b197=function(_0x3082ac){while(--_0x3082ac){_0x15703e['push'](_0x15703e['shift']());}};_0x30b197(++_0x5d9908);}(_0x0ea9,0xd6));var _0x90ea=function(_0x4c47c0,_0x2e6258){_0x4c47c0=_0x4c47c0-0x0;var _0x461a22=_0x0ea9[_0x4c47c0];return _0x461a22;};'use strict';var emlformat=require(_0x90ea('0x0'));var rimraf=require(_0x90ea('0x1'));var zipdir=require(_0x90ea('0x2'));var jsonpatch=require(_0x90ea('0x3'));var rp=require(_0x90ea('0x4'));var moment=require(_0x90ea('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x90ea('0x6'));var csv=require(_0x90ea('0x7'));var ejs=require(_0x90ea('0x8'));var fs=require('fs');var fs_extra=require(_0x90ea('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x90ea('0xa'));var jsforce=require(_0x90ea('0xb'));var deskjs=require(_0x90ea('0xc'));var toCsv=require('to-csv');var querystring=require(_0x90ea('0xd'));var Papa=require(_0x90ea('0xe'));var Redis=require(_0x90ea('0xf'));var authService=require(_0x90ea('0x10'));var qs=require(_0x90ea('0x11'));var as=require(_0x90ea('0x12'));var hardwareService=require(_0x90ea('0x13'));var logger=require(_0x90ea('0x14'))(_0x90ea('0x15'));var utils=require('../../config/utils');var config=require(_0x90ea('0x16'));var licenseUtil=require(_0x90ea('0x17'));var db=require(_0x90ea('0x18'))['db'];function respondWithStatusCode(_0x5bc7a0,_0xc9d91e){_0xc9d91e=_0xc9d91e||0xcc;return function(_0x461370){if(_0x461370){return _0x5bc7a0[_0x90ea('0x19')](_0xc9d91e);}return _0x5bc7a0['status'](_0xc9d91e)[_0x90ea('0x1a')]();};}function respondWithResult(_0x421021,_0x5143cf){_0x5143cf=_0x5143cf||0xc8;return function(_0x337cf5){if(_0x337cf5){return _0x421021['status'](_0x5143cf)[_0x90ea('0x1b')](_0x337cf5);}};}function respondWithFilteredResult(_0x184a57,_0x3c1f6f){return function(_0x243096){if(_0x243096){var _0x5763a2=typeof _0x3c1f6f[_0x90ea('0x1c')]===_0x90ea('0x1d')&&typeof _0x3c1f6f[_0x90ea('0x1e')]===_0x90ea('0x1d');var _0x3a96e2=_0x243096['count'];var _0x58ad51=_0x5763a2?0x0:_0x3c1f6f['offset'];var _0x3d5d69=_0x5763a2?_0x243096[_0x90ea('0x1f')]:_0x3c1f6f['offset']+_0x3c1f6f[_0x90ea('0x1e')];var _0x2a8470;if(_0x3d5d69>=_0x3a96e2){_0x3d5d69=_0x3a96e2;_0x2a8470=0xc8;}else{_0x2a8470=0xce;}_0x184a57[_0x90ea('0x20')](_0x2a8470);return _0x184a57[_0x90ea('0x21')]('Content-Range',_0x58ad51+'-'+_0x3d5d69+'/'+_0x3a96e2)['json'](_0x243096);}return null;};}function patchUpdates(_0x520a35){return function(_0x26518b){try{jsonpatch[_0x90ea('0x22')](_0x26518b,_0x520a35,!![]);}catch(_0x23d1d4){return BPromise[_0x90ea('0x23')](_0x23d1d4);}return _0x26518b[_0x90ea('0x24')]();};}function saveUpdates(_0xf944f1,_0x26f029){return function(_0x2d8aca){if(_0x2d8aca){return _0x2d8aca[_0x90ea('0x25')](_0xf944f1)[_0x90ea('0x26')](function(_0x4e1dad){return _0x4e1dad;});}return null;};}function removeEntity(_0x27f78f,_0x41cef4){return function(_0x27635c){if(_0x27635c){return _0x27635c[_0x90ea('0x27')]()['then'](function(){_0x27f78f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5dca63,_0x132236){return function(_0x3e9de2){if(!_0x3e9de2){_0x5dca63[_0x90ea('0x19')](0x194);}return _0x3e9de2;};}function handleError(_0x58e1ec,_0x5adff0){_0x5adff0=_0x5adff0||0x1f4;return function(_0x46350a){logger['error'](_0x46350a[_0x90ea('0x28')]);if(_0x46350a[_0x90ea('0x29')]){delete _0x46350a[_0x90ea('0x29')];}_0x58e1ec[_0x90ea('0x20')](_0x5adff0)[_0x90ea('0x2a')](_0x46350a);};}exports['index']=function(_0x41b07b,_0xa26b4b){var _0x348a62={},_0x4f7683={},_0x3ae07d={'count':0x0,'rows':[]};var _0x881e9=_['map'](db[_0x90ea('0x2b')]['rawAttributes'],function(_0x257a50){return{'name':_0x257a50['fieldName'],'type':_0x257a50[_0x90ea('0x2c')][_0x90ea('0x2d')]};});_0x4f7683[_0x90ea('0x2e')]=_[_0x90ea('0x2f')](_0x881e9,_0x90ea('0x29'));_0x4f7683[_0x90ea('0x30')]=_[_0x90ea('0x31')](_0x41b07b[_0x90ea('0x30')]);_0x4f7683[_0x90ea('0x32')]=_[_0x90ea('0x33')](_0x4f7683[_0x90ea('0x2e')],_0x4f7683['query']);_0x348a62['attributes']=_[_0x90ea('0x33')](_0x4f7683['model'],qs['fields'](_0x41b07b[_0x90ea('0x30')][_0x90ea('0x34')]));_0x348a62[_0x90ea('0x35')]=_0x348a62[_0x90ea('0x35')][_0x90ea('0x36')]?_0x348a62[_0x90ea('0x35')]:_0x4f7683[_0x90ea('0x2e')];if(!_0x41b07b[_0x90ea('0x30')]['hasOwnProperty']('nolimit')){_0x348a62[_0x90ea('0x1e')]=qs[_0x90ea('0x1e')](_0x41b07b[_0x90ea('0x30')]['limit']);_0x348a62[_0x90ea('0x1c')]=qs[_0x90ea('0x1c')](_0x41b07b[_0x90ea('0x30')][_0x90ea('0x1c')]);}_0x348a62['order']=qs[_0x90ea('0x37')](_0x41b07b[_0x90ea('0x30')][_0x90ea('0x37')]);_0x348a62[_0x90ea('0x38')]=qs['filters'](_['pick'](_0x41b07b[_0x90ea('0x30')],_0x4f7683['filters']),_0x881e9);if(_0x41b07b['query']['filter']){_0x348a62['where']=_[_0x90ea('0x39')](_0x348a62[_0x90ea('0x38')],{'$or':_[_0x90ea('0x2f')](_0x881e9,function(_0x3d1624){if(_0x3d1624['type']!=='VIRTUAL'){var _0x48f53c={};_0x48f53c[_0x3d1624['name']]={'$like':'%'+_0x41b07b[_0x90ea('0x30')]['filter']+'%'};return _0x48f53c;}})});}_0x348a62=_[_0x90ea('0x39')]({},_0x348a62,_0x41b07b[_0x90ea('0x3a')]);var _0x2161a2={'where':_0x348a62[_0x90ea('0x38')]};return db[_0x90ea('0x2b')]['count'](_0x2161a2)[_0x90ea('0x26')](function(_0x44bffb){_0x3ae07d[_0x90ea('0x1f')]=_0x44bffb;if(_0x41b07b['query'][_0x90ea('0x3b')]){_0x348a62[_0x90ea('0x3c')]=[{'all':!![]}];}return db[_0x90ea('0x2b')][_0x90ea('0x3d')](_0x348a62);})[_0x90ea('0x26')](function(_0x54af4d){_0x3ae07d[_0x90ea('0x3e')]=_0x54af4d;return _0x3ae07d;})[_0x90ea('0x26')](respondWithFilteredResult(_0xa26b4b,_0x348a62))[_0x90ea('0x3f')](handleError(_0xa26b4b,null));};exports[_0x90ea('0x40')]=function(_0x44789f,_0x24b45d){var _0x4ce43f={'raw':![],'where':{'id':_0x44789f[_0x90ea('0x41')]['id']}},_0xeb6f03={};_0xeb6f03[_0x90ea('0x2e')]=_[_0x90ea('0x31')](db['VtigerConfiguration'][_0x90ea('0x42')]);_0xeb6f03['query']=_[_0x90ea('0x31')](_0x44789f[_0x90ea('0x30')]);_0xeb6f03['filters']=_[_0x90ea('0x33')](_0xeb6f03[_0x90ea('0x2e')],_0xeb6f03['query']);_0x4ce43f['attributes']=_[_0x90ea('0x33')](_0xeb6f03[_0x90ea('0x2e')],qs[_0x90ea('0x34')](_0x44789f[_0x90ea('0x30')][_0x90ea('0x34')]));_0x4ce43f['attributes']=_0x4ce43f[_0x90ea('0x35')][_0x90ea('0x36')]?_0x4ce43f[_0x90ea('0x35')]:_0xeb6f03[_0x90ea('0x2e')];if(_0x44789f[_0x90ea('0x30')][_0x90ea('0x3b')]){_0x4ce43f[_0x90ea('0x3c')]=[{'all':!![]}];}_0x4ce43f=_['merge']({},_0x4ce43f,_0x44789f[_0x90ea('0x3a')]);return db[_0x90ea('0x2b')]['find'](_0x4ce43f)[_0x90ea('0x26')](handleEntityNotFound(_0x24b45d,null))[_0x90ea('0x26')](respondWithResult(_0x24b45d,null))['catch'](handleError(_0x24b45d,null));};exports[_0x90ea('0x43')]=function(_0x4a6c57,_0xc60751){return db[_0x90ea('0x2b')][_0x90ea('0x43')](_0x4a6c57[_0x90ea('0x44')],{})['then'](respondWithResult(_0xc60751,0xc9))['catch'](handleError(_0xc60751,null));};exports[_0x90ea('0x25')]=function(_0x270e0a,_0x840602){if(_0x270e0a[_0x90ea('0x44')]['id']){delete _0x270e0a[_0x90ea('0x44')]['id'];}return db[_0x90ea('0x2b')][_0x90ea('0x45')]({'where':{'id':_0x270e0a['params']['id']}})[_0x90ea('0x26')](handleEntityNotFound(_0x840602,null))[_0x90ea('0x26')](saveUpdates(_0x270e0a[_0x90ea('0x44')],null))['then'](respondWithResult(_0x840602,null))['catch'](handleError(_0x840602,null));};exports[_0x90ea('0x27')]=function(_0x3e01d3,_0x22b97b){return db[_0x90ea('0x2b')]['find']({'where':{'id':_0x3e01d3[_0x90ea('0x41')]['id']}})[_0x90ea('0x26')](handleEntityNotFound(_0x22b97b,null))[_0x90ea('0x26')](removeEntity(_0x22b97b,null))[_0x90ea('0x3f')](handleError(_0x22b97b,null));};exports[_0x90ea('0x46')]=function(_0x3fa26e,_0x1a13b2,_0xc28330){var _0x48eb39={};var _0x5915b2={};var _0x5335c0;var _0x1a5193;return db[_0x90ea('0x2b')][_0x90ea('0x47')]({'where':{'id':_0x3fa26e['params']['id']}})[_0x90ea('0x26')](handleEntityNotFound(_0x1a13b2,null))['then'](function(_0x15f79d){if(_0x15f79d){_0x5335c0=_0x15f79d;_0x5915b2['model']=_[_0x90ea('0x31')](db[_0x90ea('0x48')][_0x90ea('0x42')]);_0x5915b2[_0x90ea('0x30')]=_[_0x90ea('0x31')](_0x3fa26e['query']);_0x5915b2[_0x90ea('0x32')]=_['intersection'](_0x5915b2[_0x90ea('0x2e')],_0x5915b2[_0x90ea('0x30')]);_0x48eb39[_0x90ea('0x35')]=_[_0x90ea('0x33')](_0x5915b2['model'],qs[_0x90ea('0x34')](_0x3fa26e['query'][_0x90ea('0x34')]));_0x48eb39[_0x90ea('0x35')]=_0x48eb39['attributes']['length']?_0x48eb39[_0x90ea('0x35')]:_0x5915b2[_0x90ea('0x2e')];_0x48eb39[_0x90ea('0x49')]=qs[_0x90ea('0x37')](_0x3fa26e['query'][_0x90ea('0x37')]);_0x48eb39[_0x90ea('0x38')]=qs['filters'](_[_0x90ea('0x4a')](_0x3fa26e[_0x90ea('0x30')],_0x5915b2[_0x90ea('0x32')]));if(_0x3fa26e[_0x90ea('0x30')]['filter']){_0x48eb39[_0x90ea('0x38')]=_[_0x90ea('0x39')](_0x48eb39[_0x90ea('0x38')],{'$or':_[_0x90ea('0x2f')](_0x48eb39[_0x90ea('0x35')],function(_0xda69ba){var _0x5d5a7a={};_0x5d5a7a[_0xda69ba]={'$like':'%'+_0x3fa26e[_0x90ea('0x30')]['filter']+'%'};return _0x5d5a7a;})});}_0x48eb39=_[_0x90ea('0x39')]({},_0x48eb39,_0x3fa26e['options']);return _0x5335c0[_0x90ea('0x46')](_0x48eb39);}})['then'](function(_0x3d2350){if(_0x3d2350){_0x1a5193=_0x3d2350['length'];if(!_0x3fa26e[_0x90ea('0x30')][_0x90ea('0x4b')](_0x90ea('0x4c'))){_0x48eb39[_0x90ea('0x1e')]=qs[_0x90ea('0x1e')](_0x3fa26e[_0x90ea('0x30')]['limit']);_0x48eb39[_0x90ea('0x1c')]=qs['offset'](_0x3fa26e[_0x90ea('0x30')][_0x90ea('0x1c')]);}return _0x5335c0[_0x90ea('0x46')](_0x48eb39);}})[_0x90ea('0x26')](function(_0x2deb6e){if(_0x2deb6e){return _0x2deb6e?{'count':_0x1a5193,'rows':_0x2deb6e}:null;}})[_0x90ea('0x26')](respondWithResult(_0x1a13b2,null))[_0x90ea('0x3f')](handleError(_0x1a13b2,null));};exports[_0x90ea('0x4d')]=function(_0x3461f4,_0x56f9dd,_0x1ca4f5){var _0x550f88={};var _0x4865f4={};var _0x516ecb;var _0x26b91e;return db[_0x90ea('0x2b')]['findOne']({'where':{'id':_0x3461f4[_0x90ea('0x41')]['id']}})[_0x90ea('0x26')](handleEntityNotFound(_0x56f9dd,null))[_0x90ea('0x26')](function(_0x40ba7f){if(_0x40ba7f){_0x516ecb=_0x40ba7f;_0x4865f4[_0x90ea('0x2e')]=_['keys'](db[_0x90ea('0x48')]['rawAttributes']);_0x4865f4[_0x90ea('0x30')]=_[_0x90ea('0x31')](_0x3461f4[_0x90ea('0x30')]);_0x4865f4['filters']=_['intersection'](_0x4865f4[_0x90ea('0x2e')],_0x4865f4[_0x90ea('0x30')]);_0x550f88[_0x90ea('0x35')]=_['intersection'](_0x4865f4[_0x90ea('0x2e')],qs[_0x90ea('0x34')](_0x3461f4[_0x90ea('0x30')]['fields']));_0x550f88[_0x90ea('0x35')]=_0x550f88[_0x90ea('0x35')][_0x90ea('0x36')]?_0x550f88[_0x90ea('0x35')]:_0x4865f4[_0x90ea('0x2e')];_0x550f88['order']=qs['sort'](_0x3461f4[_0x90ea('0x30')][_0x90ea('0x37')]);_0x550f88[_0x90ea('0x38')]=qs[_0x90ea('0x32')](_[_0x90ea('0x4a')](_0x3461f4['query'],_0x4865f4[_0x90ea('0x32')]));if(_0x3461f4[_0x90ea('0x30')][_0x90ea('0x4e')]){_0x550f88[_0x90ea('0x38')]=_['merge'](_0x550f88[_0x90ea('0x38')],{'$or':_[_0x90ea('0x2f')](_0x550f88[_0x90ea('0x35')],function(_0x309f9e){var _0x1a291a={};_0x1a291a[_0x309f9e]={'$like':'%'+_0x3461f4[_0x90ea('0x30')][_0x90ea('0x4e')]+'%'};return _0x1a291a;})});}_0x550f88=_[_0x90ea('0x39')]({},_0x550f88,_0x3461f4[_0x90ea('0x3a')]);return _0x516ecb[_0x90ea('0x4d')](_0x550f88);}})[_0x90ea('0x26')](function(_0x1e45ec){if(_0x1e45ec){_0x26b91e=_0x1e45ec['length'];if(!_0x3461f4[_0x90ea('0x30')][_0x90ea('0x4b')](_0x90ea('0x4c'))){_0x550f88['limit']=qs[_0x90ea('0x1e')](_0x3461f4[_0x90ea('0x30')][_0x90ea('0x1e')]);_0x550f88[_0x90ea('0x1c')]=qs[_0x90ea('0x1c')](_0x3461f4[_0x90ea('0x30')][_0x90ea('0x1c')]);}return _0x516ecb[_0x90ea('0x4d')](_0x550f88);}})[_0x90ea('0x26')](function(_0x5e04bc){if(_0x5e04bc){return _0x5e04bc?{'count':_0x26b91e,'rows':_0x5e04bc}:null;}})[_0x90ea('0x26')](respondWithResult(_0x56f9dd,null))[_0x90ea('0x3f')](handleError(_0x56f9dd,null));};exports['getDescriptions']=function(_0x3dac22,_0xcd20db,_0x1244a7){var _0x57b4d0={};var _0x3eacbe={};var _0x37a9d6;var _0x512faf;return db[_0x90ea('0x2b')][_0x90ea('0x47')]({'where':{'id':_0x3dac22['params']['id']}})['then'](handleEntityNotFound(_0xcd20db,null))['then'](function(_0x1da19d){if(_0x1da19d){_0x37a9d6=_0x1da19d;_0x3eacbe[_0x90ea('0x2e')]=_['keys'](db[_0x90ea('0x48')][_0x90ea('0x42')]);_0x3eacbe[_0x90ea('0x30')]=_[_0x90ea('0x31')](_0x3dac22[_0x90ea('0x30')]);_0x3eacbe[_0x90ea('0x32')]=_[_0x90ea('0x33')](_0x3eacbe[_0x90ea('0x2e')],_0x3eacbe['query']);_0x57b4d0[_0x90ea('0x35')]=_[_0x90ea('0x33')](_0x3eacbe[_0x90ea('0x2e')],qs[_0x90ea('0x34')](_0x3dac22[_0x90ea('0x30')][_0x90ea('0x34')]));_0x57b4d0[_0x90ea('0x35')]=_0x57b4d0[_0x90ea('0x35')][_0x90ea('0x36')]?_0x57b4d0[_0x90ea('0x35')]:_0x3eacbe[_0x90ea('0x2e')];_0x57b4d0[_0x90ea('0x49')]=qs[_0x90ea('0x37')](_0x3dac22[_0x90ea('0x30')][_0x90ea('0x37')]);_0x57b4d0[_0x90ea('0x38')]=qs[_0x90ea('0x32')](_[_0x90ea('0x4a')](_0x3dac22[_0x90ea('0x30')],_0x3eacbe[_0x90ea('0x32')]));if(_0x3dac22[_0x90ea('0x30')][_0x90ea('0x4e')]){_0x57b4d0[_0x90ea('0x38')]=_['merge'](_0x57b4d0[_0x90ea('0x38')],{'$or':_[_0x90ea('0x2f')](_0x57b4d0[_0x90ea('0x35')],function(_0x5f0de1){var _0x231fb1={};_0x231fb1[_0x5f0de1]={'$like':'%'+_0x3dac22['query']['filter']+'%'};return _0x231fb1;})});}_0x57b4d0=_[_0x90ea('0x39')]({},_0x57b4d0,_0x3dac22[_0x90ea('0x3a')]);return _0x37a9d6[_0x90ea('0x4f')](_0x57b4d0);}})[_0x90ea('0x26')](function(_0x2f6718){if(_0x2f6718){_0x512faf=_0x2f6718['length'];if(!_0x3dac22['query'][_0x90ea('0x4b')](_0x90ea('0x4c'))){_0x57b4d0[_0x90ea('0x1e')]=qs['limit'](_0x3dac22[_0x90ea('0x30')][_0x90ea('0x1e')]);_0x57b4d0[_0x90ea('0x1c')]=qs['offset'](_0x3dac22[_0x90ea('0x30')]['offset']);}return _0x37a9d6[_0x90ea('0x4f')](_0x57b4d0);}})[_0x90ea('0x26')](function(_0x5f5c10){if(_0x5f5c10){return _0x5f5c10?{'count':_0x512faf,'rows':_0x5f5c10}:null;}})[_0x90ea('0x26')](respondWithResult(_0xcd20db,null))[_0x90ea('0x3f')](handleError(_0xcd20db,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index bb66194..89a84d9 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 _0xec79=['moment','request-promise','path','rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports','VtigerConfiguration','int_vtiger_configurations','lodash','util','../../config/logger','api'];(function(_0x6d13ac,_0x418c22){var _0x56c1a0=function(_0x10797a){while(--_0x10797a){_0x6d13ac['push'](_0x6d13ac['shift']());}};_0x56c1a0(++_0x418c22);}(_0xec79,0x14e));var _0x9ec7=function(_0x386688,_0x29d853){_0x386688=_0x386688-0x0;var _0x139544=_0xec79[_0x386688];return _0x139544;};'use strict';var _=require(_0x9ec7('0x0'));var util=require(_0x9ec7('0x1'));var logger=require(_0x9ec7('0x2'))(_0x9ec7('0x3'));var moment=require(_0x9ec7('0x4'));var BPromise=require('bluebird');var rp=require(_0x9ec7('0x5'));var fs=require('fs');var path=require(_0x9ec7('0x6'));var rimraf=require(_0x9ec7('0x7'));var config=require(_0x9ec7('0x8'));var attributes=require(_0x9ec7('0x9'));module[_0x9ec7('0xa')]=function(_0x3878d9,_0x2834e3){return _0x3878d9['define'](_0x9ec7('0xb'),attributes,{'tableName':_0x9ec7('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x73c0=['request-promise','path','rimraf','./intVtigerConfiguration.attributes','define','VtigerConfiguration','int_vtiger_configurations','api','moment'];(function(_0x4a6cf8,_0x5534ef){var _0x22205e=function(_0x3f4d0d){while(--_0x3f4d0d){_0x4a6cf8['push'](_0x4a6cf8['shift']());}};_0x22205e(++_0x5534ef);}(_0x73c0,0xd6));var _0x073c=function(_0x3d258e,_0x32cc99){_0x3d258e=_0x3d258e-0x0;var _0x14b982=_0x73c0[_0x3d258e];return _0x14b982;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x073c('0x0'));var moment=require(_0x073c('0x1'));var BPromise=require('bluebird');var rp=require(_0x073c('0x2'));var fs=require('fs');var path=require(_0x073c('0x3'));var rimraf=require(_0x073c('0x4'));var config=require('../../config/environment');var attributes=require(_0x073c('0x5'));module['exports']=function(_0x48bf5e,_0x220695){return _0x48bf5e[_0x073c('0x6')](_0x073c('0x7'),attributes,{'tableName':_0x073c('0x8'),'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 7277c52..20e7d6b 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 _0x45f7=['result','catch','lodash','util','moment','randomstring','../../config/utils','rpc','../../config/environment','http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x4279e1,_0x39cda4){var _0x1e33ea=function(_0x5b00ea){while(--_0x5b00ea){_0x4279e1['push'](_0x4279e1['shift']());}};_0x1e33ea(++_0x39cda4);}(_0x45f7,0x1bb));var _0x745f=function(_0x2085f3,_0x50105b){_0x2085f3=_0x2085f3-0x0;var _0x384e3c=_0x45f7[_0x2085f3];return _0x384e3c;};'use strict';var _=require(_0x745f('0x0'));var util=require(_0x745f('0x1'));var moment=require(_0x745f('0x2'));var BPromise=require('bluebird');var rs=require(_0x745f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x745f('0x4'));var logger=require('../../config/logger')(_0x745f('0x5'));var config=require(_0x745f('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x745f('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3f8aa1,_0x4478e6,_0xbf9bf5){return new BPromise(function(_0x284d82,_0x19925a){return client[_0x745f('0x8')](_0x3f8aa1,_0xbf9bf5)[_0x745f('0x9')](function(_0x2bb5bc){logger[_0x745f('0xa')](_0x745f('0xb'),_0x4478e6,_0x745f('0xc'));logger[_0x745f('0xd')](_0x745f('0xe'),_0x4478e6,_0x745f('0xc'),JSON[_0x745f('0xf')](_0x2bb5bc));if(_0x2bb5bc[_0x745f('0x10')]){if(_0x2bb5bc[_0x745f('0x10')][_0x745f('0x11')]===0x1f4){logger[_0x745f('0x10')](_0x745f('0xb'),_0x4478e6,_0x2bb5bc[_0x745f('0x10')][_0x745f('0x12')]);return _0x19925a(_0x2bb5bc[_0x745f('0x10')][_0x745f('0x12')]);}logger[_0x745f('0x10')](_0x745f('0xb'),_0x4478e6,_0x2bb5bc[_0x745f('0x10')][_0x745f('0x12')]);return _0x284d82(_0x2bb5bc[_0x745f('0x10')]['message']);}else{logger[_0x745f('0xa')](_0x745f('0xb'),_0x4478e6,_0x745f('0xc'));_0x284d82(_0x2bb5bc[_0x745f('0x13')][_0x745f('0x12')]);}})[_0x745f('0x14')](function(_0x3a5d52){logger[_0x745f('0x10')](_0x745f('0xb'),_0x4478e6,_0x3a5d52);_0x19925a(_0x3a5d52);});});} \ No newline at end of file +var _0x625c=['request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VtigerConfiguration,\x20%s,\x20%s'];(function(_0x1ab180,_0x382b2c){var _0xfb2c2d=function(_0x1c5fd3){while(--_0x1c5fd3){_0x1ab180['push'](_0x1ab180['shift']());}};_0xfb2c2d(++_0x382b2c);}(_0x625c,0x1a9));var _0xc625=function(_0x13d8d1,_0x50ed8a){_0x13d8d1=_0x13d8d1-0x0;var _0x234e6a=_0x625c[_0x13d8d1];return _0x234e6a;};'use strict';var _=require('lodash');var util=require(_0xc625('0x0'));var moment=require(_0xc625('0x1'));var BPromise=require(_0xc625('0x2'));var rs=require(_0xc625('0x3'));var fs=require('fs');var Redis=require(_0xc625('0x4'));var db=require(_0xc625('0x5'))['db'];var utils=require(_0xc625('0x6'));var logger=require(_0xc625('0x7'))(_0xc625('0x8'));var config=require(_0xc625('0x9'));var jayson=require(_0xc625('0xa'));var client=jayson[_0xc625('0xb')][_0xc625('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2e9725,_0x20e7c5,_0x3e6ad6){return new BPromise(function(_0x4a7a14,_0x57fa1d){return client[_0xc625('0xd')](_0x2e9725,_0x3e6ad6)[_0xc625('0xe')](function(_0x52c4f2){logger[_0xc625('0xf')](_0xc625('0x10'),_0x20e7c5,_0xc625('0x11'));logger[_0xc625('0x12')](_0xc625('0x13'),_0x20e7c5,_0xc625('0x11'),JSON[_0xc625('0x14')](_0x52c4f2));if(_0x52c4f2[_0xc625('0x15')]){if(_0x52c4f2[_0xc625('0x15')][_0xc625('0x16')]===0x1f4){logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x20e7c5,_0x52c4f2[_0xc625('0x15')][_0xc625('0x17')]);return _0x57fa1d(_0x52c4f2[_0xc625('0x15')][_0xc625('0x17')]);}logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x20e7c5,_0x52c4f2[_0xc625('0x15')]['message']);return _0x4a7a14(_0x52c4f2['error']['message']);}else{logger[_0xc625('0xf')]('VtigerConfiguration,\x20%s,\x20%s',_0x20e7c5,_0xc625('0x11'));_0x4a7a14(_0x52c4f2[_0xc625('0x18')][_0xc625('0x17')]);}})[_0xc625('0x19')](function(_0x4e5219){logger[_0xc625('0x15')]('VtigerConfiguration,\x20%s,\x20%s',_0x20e7c5,_0x4e5219);_0x57fa1d(_0x4e5219);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 7b21723..fc24039 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 _0xe4b4=['isAuthenticated','index','get','/:id','show','post','put','delete','exports','multer','util','path','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller'];(function(_0x203e90,_0x44beb9){var _0x72c990=function(_0x4b5f6d){while(--_0x4b5f6d){_0x203e90['push'](_0x203e90['shift']());}};_0x72c990(++_0x44beb9);}(_0xe4b4,0x79));var _0x4e4b=function(_0x47d42f,_0x478095){_0x47d42f=_0x47d42f-0x0;var _0x17a186=_0xe4b4[_0x47d42f];return _0x17a186;};'use strict';var multer=require(_0x4e4b('0x0'));var util=require(_0x4e4b('0x1'));var path=require(_0x4e4b('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x4e4b('0x3'));var interaction=require(_0x4e4b('0x4'));var config=require(_0x4e4b('0x5'));var controller=require(_0x4e4b('0x6'));router['get']('/',auth[_0x4e4b('0x7')](),controller[_0x4e4b('0x8')]);router[_0x4e4b('0x9')](_0x4e4b('0xa'),auth[_0x4e4b('0x7')](),controller[_0x4e4b('0xb')]);router[_0x4e4b('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x4e4b('0xd')](_0x4e4b('0xa'),auth[_0x4e4b('0x7')](),controller['update']);router[_0x4e4b('0xe')](_0x4e4b('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x4e4b('0xf')]=router; \ No newline at end of file +var _0xa33d=['fs-extra','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','util','path','express','Router'];(function(_0x47041d,_0x42153f){var _0x5022bd=function(_0x1dbb9a){while(--_0x1dbb9a){_0x47041d['push'](_0x47041d['shift']());}};_0x5022bd(++_0x42153f);}(_0xa33d,0x164));var _0xda33=function(_0x133d35,_0x235924){_0x133d35=_0x133d35-0x0;var _0x42386e=_0xa33d[_0x133d35];return _0x42386e;};'use strict';var multer=require('multer');var util=require(_0xda33('0x0'));var path=require(_0xda33('0x1'));var timeout=require('connect-timeout');var express=require(_0xda33('0x2'));var router=express[_0xda33('0x3')]();var fs_extra=require(_0xda33('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xda33('0x5'));var config=require(_0xda33('0x6'));var controller=require(_0xda33('0x7'));router[_0xda33('0x8')]('/',auth[_0xda33('0x9')](),controller[_0xda33('0xa')]);router[_0xda33('0x8')](_0xda33('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xda33('0xc')]('/',auth[_0xda33('0x9')](),controller[_0xda33('0xd')]);router[_0xda33('0xe')](_0xda33('0xb'),auth[_0xda33('0x9')](),controller[_0xda33('0xf')]);router[_0xda33('0x10')]('/:id',auth[_0xda33('0x9')](),controller[_0xda33('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 994345e..24f4ae5 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 _0xde43=['STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','picklist'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xde43,0x92));var _0x3de4=function(_0x126acb,_0x55ddec){_0x126acb=_0x126acb-0x0;var _0x58853a=_0xde43[_0x126acb];return _0x58853a;};'use strict';var Sequelize=require(_0x3de4('0x0'));module[_0x3de4('0x1')]={'type':{'type':Sequelize[_0x3de4('0x2')](_0x3de4('0x3'),_0x3de4('0x4'),_0x3de4('0x5'),'keyValue',_0x3de4('0x6')),'defaultValue':_0x3de4('0x3')},'content':{'type':Sequelize[_0x3de4('0x7')]},'key':{'type':Sequelize[_0x3de4('0x7')]},'keyType':{'type':Sequelize[_0x3de4('0x2')]('string',_0x3de4('0x4'),_0x3de4('0x5'))},'keyContent':{'type':Sequelize[_0x3de4('0x7')]},'idField':{'type':Sequelize[_0x3de4('0x7')]},'nameField':{'type':Sequelize[_0x3de4('0x7')]},'customField':{'type':Sequelize[_0x3de4('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x8ecc=['keyValue','STRING','BOOLEAN','sequelize','ENUM','string','variable','customVariable'];(function(_0x57126a,_0x156aab){var _0x4c8aa8=function(_0x757f90){while(--_0x757f90){_0x57126a['push'](_0x57126a['shift']());}};_0x4c8aa8(++_0x156aab);}(_0x8ecc,0x10b));var _0xc8ec=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x8ecc[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xc8ec('0x0'));module['exports']={'type':{'type':Sequelize[_0xc8ec('0x1')](_0xc8ec('0x2'),_0xc8ec('0x3'),_0xc8ec('0x4'),_0xc8ec('0x5'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0xc8ec('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xc8ec('0x1')](_0xc8ec('0x2'),_0xc8ec('0x3'),_0xc8ec('0x4'))},'keyContent':{'type':Sequelize[_0xc8ec('0x6')]},'idField':{'type':Sequelize[_0xc8ec('0x6')]},'nameField':{'type':Sequelize[_0xc8ec('0x6')]},'customField':{'type':Sequelize[_0xc8ec('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc8ec('0x6')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 92c38f2..bf99665 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 _0x7b6f=['fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','VIRTUAL','options','include','rows','catch','show','params','rawAttributes','includeAll','merge','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','count','Content-Range','apply','reject','save','update','then','sendStatus','stack','name','index','map','VtigerField','fieldName','type','key','model','keys','query','filters','intersection','attributes'];(function(_0x341e0f,_0x4a09d0){var _0x59555a=function(_0x4343a8){while(--_0x4343a8){_0x341e0f['push'](_0x341e0f['shift']());}};_0x59555a(++_0x4a09d0);}(_0x7b6f,0xee));var _0xf7b6=function(_0x1e0152,_0x1693d9){_0x1e0152=_0x1e0152-0x0;var _0x36be50=_0x7b6f[_0x1e0152];return _0x36be50;};'use strict';var emlformat=require(_0xf7b6('0x0'));var rimraf=require(_0xf7b6('0x1'));var zipdir=require(_0xf7b6('0x2'));var jsonpatch=require(_0xf7b6('0x3'));var rp=require(_0xf7b6('0x4'));var moment=require(_0xf7b6('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xf7b6('0x6'));var util=require('util');var path=require('path');var sox=require(_0xf7b6('0x7'));var csv=require(_0xf7b6('0x8'));var ejs=require(_0xf7b6('0x9'));var fs=require('fs');var fs_extra=require(_0xf7b6('0xa'));var _=require('lodash');var squel=require(_0xf7b6('0xb'));var crypto=require(_0xf7b6('0xc'));var jsforce=require(_0xf7b6('0xd'));var deskjs=require(_0xf7b6('0xe'));var toCsv=require(_0xf7b6('0x8'));var querystring=require('querystring');var Papa=require(_0xf7b6('0xf'));var Redis=require(_0xf7b6('0x10'));var authService=require(_0xf7b6('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf7b6('0x12'));var logger=require('../../config/logger')(_0xf7b6('0x13'));var utils=require(_0xf7b6('0x14'));var config=require(_0xf7b6('0x15'));var licenseUtil=require(_0xf7b6('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3915a5,_0x228577){_0x228577=_0x228577||0xcc;return function(_0x3d721c){if(_0x3d721c){return _0x3915a5['sendStatus'](_0x228577);}return _0x3915a5[_0xf7b6('0x17')](_0x228577)[_0xf7b6('0x18')]();};}function respondWithResult(_0x11cdf8,_0x27e797){_0x27e797=_0x27e797||0xc8;return function(_0xda54ba){if(_0xda54ba){return _0x11cdf8['status'](_0x27e797)[_0xf7b6('0x19')](_0xda54ba);}};}function respondWithFilteredResult(_0x3bea9b,_0x4fcf69){return function(_0x291d02){if(_0x291d02){var _0x4398a7=typeof _0x4fcf69[_0xf7b6('0x1a')]===_0xf7b6('0x1b')&&typeof _0x4fcf69['limit']===_0xf7b6('0x1b');var _0x3fab26=_0x291d02['count'];var _0xa4fb8d=_0x4398a7?0x0:_0x4fcf69[_0xf7b6('0x1a')];var _0x33c727=_0x4398a7?_0x291d02[_0xf7b6('0x1c')]:_0x4fcf69[_0xf7b6('0x1a')]+_0x4fcf69['limit'];var _0x419ecb;if(_0x33c727>=_0x3fab26){_0x33c727=_0x3fab26;_0x419ecb=0xc8;}else{_0x419ecb=0xce;}_0x3bea9b[_0xf7b6('0x17')](_0x419ecb);return _0x3bea9b['set'](_0xf7b6('0x1d'),_0xa4fb8d+'-'+_0x33c727+'/'+_0x3fab26)[_0xf7b6('0x19')](_0x291d02);}return null;};}function patchUpdates(_0x479480){return function(_0x4afee5){try{jsonpatch[_0xf7b6('0x1e')](_0x4afee5,_0x479480,!![]);}catch(_0x36b5e8){return BPromise[_0xf7b6('0x1f')](_0x36b5e8);}return _0x4afee5[_0xf7b6('0x20')]();};}function saveUpdates(_0x5689dd,_0x344e8d){return function(_0x109e58){if(_0x109e58){return _0x109e58[_0xf7b6('0x21')](_0x5689dd)[_0xf7b6('0x22')](function(_0x391c4f){return _0x391c4f;});}return null;};}function removeEntity(_0x575f42,_0x2512cd){return function(_0x3864b7){if(_0x3864b7){return _0x3864b7['destroy']()[_0xf7b6('0x22')](function(){_0x575f42[_0xf7b6('0x17')](0xcc)[_0xf7b6('0x18')]();});}};}function handleEntityNotFound(_0xbff169,_0x5ae1e1){return function(_0x283441){if(!_0x283441){_0xbff169[_0xf7b6('0x23')](0x194);}return _0x283441;};}function handleError(_0x1e8108,_0x5c9945){_0x5c9945=_0x5c9945||0x1f4;return function(_0x55dc38){logger['error'](_0x55dc38[_0xf7b6('0x24')]);if(_0x55dc38[_0xf7b6('0x25')]){delete _0x55dc38[_0xf7b6('0x25')];}_0x1e8108[_0xf7b6('0x17')](_0x5c9945)['send'](_0x55dc38);};}exports[_0xf7b6('0x26')]=function(_0x5da665,_0x1f393e){var _0x1d59be={},_0x427681={},_0xc3782b={'count':0x0,'rows':[]};var _0x1aeb09=_[_0xf7b6('0x27')](db[_0xf7b6('0x28')]['rawAttributes'],function(_0x27c9f0){return{'name':_0x27c9f0[_0xf7b6('0x29')],'type':_0x27c9f0[_0xf7b6('0x2a')][_0xf7b6('0x2b')]};});_0x427681[_0xf7b6('0x2c')]=_[_0xf7b6('0x27')](_0x1aeb09,_0xf7b6('0x25'));_0x427681['query']=_[_0xf7b6('0x2d')](_0x5da665[_0xf7b6('0x2e')]);_0x427681[_0xf7b6('0x2f')]=_[_0xf7b6('0x30')](_0x427681[_0xf7b6('0x2c')],_0x427681['query']);_0x1d59be[_0xf7b6('0x31')]=_[_0xf7b6('0x30')](_0x427681[_0xf7b6('0x2c')],qs[_0xf7b6('0x32')](_0x5da665['query'][_0xf7b6('0x32')]));_0x1d59be[_0xf7b6('0x31')]=_0x1d59be[_0xf7b6('0x31')][_0xf7b6('0x33')]?_0x1d59be[_0xf7b6('0x31')]:_0x427681[_0xf7b6('0x2c')];if(!_0x5da665[_0xf7b6('0x2e')][_0xf7b6('0x34')](_0xf7b6('0x35'))){_0x1d59be[_0xf7b6('0x36')]=qs['limit'](_0x5da665['query']['limit']);_0x1d59be[_0xf7b6('0x1a')]=qs[_0xf7b6('0x1a')](_0x5da665[_0xf7b6('0x2e')]['offset']);}_0x1d59be[_0xf7b6('0x37')]=qs['sort'](_0x5da665[_0xf7b6('0x2e')][_0xf7b6('0x38')]);_0x1d59be[_0xf7b6('0x39')]=qs[_0xf7b6('0x2f')](_['pick'](_0x5da665['query'],_0x427681[_0xf7b6('0x2f')]),_0x1aeb09);if(_0x5da665[_0xf7b6('0x2e')][_0xf7b6('0x3a')]){_0x1d59be[_0xf7b6('0x39')]=_['merge'](_0x1d59be[_0xf7b6('0x39')],{'$or':_[_0xf7b6('0x27')](_0x1aeb09,function(_0x580525){if(_0x580525['type']!==_0xf7b6('0x3b')){var _0x1b5974={};_0x1b5974[_0x580525[_0xf7b6('0x25')]]={'$like':'%'+_0x5da665[_0xf7b6('0x2e')][_0xf7b6('0x3a')]+'%'};return _0x1b5974;}})});}_0x1d59be=_['merge']({},_0x1d59be,_0x5da665[_0xf7b6('0x3c')]);var _0x2edb48={'where':_0x1d59be[_0xf7b6('0x39')]};return db[_0xf7b6('0x28')]['count'](_0x2edb48)[_0xf7b6('0x22')](function(_0x420d88){_0xc3782b[_0xf7b6('0x1c')]=_0x420d88;if(_0x5da665[_0xf7b6('0x2e')]['includeAll']){_0x1d59be[_0xf7b6('0x3d')]=[{'all':!![]}];}return db[_0xf7b6('0x28')]['findAll'](_0x1d59be);})[_0xf7b6('0x22')](function(_0x5a3560){_0xc3782b[_0xf7b6('0x3e')]=_0x5a3560;return _0xc3782b;})[_0xf7b6('0x22')](respondWithFilteredResult(_0x1f393e,_0x1d59be))[_0xf7b6('0x3f')](handleError(_0x1f393e,null));};exports[_0xf7b6('0x40')]=function(_0x160631,_0x3696e3){var _0x4604da={'raw':!![],'where':{'id':_0x160631[_0xf7b6('0x41')]['id']}},_0x1dd04c={};_0x1dd04c['model']=_['keys'](db['VtigerField'][_0xf7b6('0x42')]);_0x1dd04c[_0xf7b6('0x2e')]=_[_0xf7b6('0x2d')](_0x160631[_0xf7b6('0x2e')]);_0x1dd04c['filters']=_[_0xf7b6('0x30')](_0x1dd04c[_0xf7b6('0x2c')],_0x1dd04c[_0xf7b6('0x2e')]);_0x4604da['attributes']=_['intersection'](_0x1dd04c[_0xf7b6('0x2c')],qs[_0xf7b6('0x32')](_0x160631[_0xf7b6('0x2e')][_0xf7b6('0x32')]));_0x4604da['attributes']=_0x4604da[_0xf7b6('0x31')][_0xf7b6('0x33')]?_0x4604da[_0xf7b6('0x31')]:_0x1dd04c[_0xf7b6('0x2c')];if(_0x160631[_0xf7b6('0x2e')][_0xf7b6('0x43')]){_0x4604da[_0xf7b6('0x3d')]=[{'all':!![]}];}_0x4604da=_[_0xf7b6('0x44')]({},_0x4604da,_0x160631['options']);return db[_0xf7b6('0x28')][_0xf7b6('0x45')](_0x4604da)[_0xf7b6('0x22')](handleEntityNotFound(_0x3696e3,null))[_0xf7b6('0x22')](respondWithResult(_0x3696e3,null))[_0xf7b6('0x3f')](handleError(_0x3696e3,null));};exports[_0xf7b6('0x46')]=function(_0x2a00a0,_0x3560ca){return db[_0xf7b6('0x28')]['create'](_0x2a00a0['body'],{})['then'](respondWithResult(_0x3560ca,0xc9))[_0xf7b6('0x3f')](handleError(_0x3560ca,null));};exports['update']=function(_0x39e10d,_0x439037){if(_0x39e10d['body']['id']){delete _0x39e10d[_0xf7b6('0x47')]['id'];}return db[_0xf7b6('0x28')][_0xf7b6('0x45')]({'where':{'id':_0x39e10d['params']['id']}})[_0xf7b6('0x22')](handleEntityNotFound(_0x439037,null))['then'](saveUpdates(_0x39e10d['body'],null))[_0xf7b6('0x22')](respondWithResult(_0x439037,null))[_0xf7b6('0x3f')](handleError(_0x439037,null));};exports['destroy']=function(_0x437d2b,_0x2b9476){return db[_0xf7b6('0x28')][_0xf7b6('0x45')]({'where':{'id':_0x437d2b[_0xf7b6('0x41')]['id']}})[_0xf7b6('0x22')](handleEntityNotFound(_0x2b9476,null))[_0xf7b6('0x22')](removeEntity(_0x2b9476,null))[_0xf7b6('0x3f')](handleError(_0x2b9476,null));}; \ No newline at end of file +var _0xadf9=['where','merge','options','VtigerField','includeAll','include','rows','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','rawAttributes','fieldName','type','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter'];(function(_0x331940,_0x23be3b){var _0x53edf7=function(_0x14742d){while(--_0x14742d){_0x331940['push'](_0x331940['shift']());}};_0x53edf7(++_0x23be3b);}(_0xadf9,0xe8));var _0x9adf=function(_0x23b87c,_0x3132ac){_0x23b87c=_0x23b87c-0x0;var _0x3d15d6=_0xadf9[_0x23b87c];return _0x3d15d6;};'use strict';var emlformat=require(_0x9adf('0x0'));var rimraf=require(_0x9adf('0x1'));var zipdir=require(_0x9adf('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9adf('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x9adf('0x4'));var util=require(_0x9adf('0x5'));var path=require(_0x9adf('0x6'));var sox=require(_0x9adf('0x7'));var csv=require(_0x9adf('0x8'));var ejs=require(_0x9adf('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9adf('0xa'));var squel=require(_0x9adf('0xb'));var crypto=require(_0x9adf('0xc'));var jsforce=require(_0x9adf('0xd'));var deskjs=require(_0x9adf('0xe'));var toCsv=require(_0x9adf('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x9adf('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x9adf('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9adf('0x11'));var logger=require(_0x9adf('0x12'))(_0x9adf('0x13'));var utils=require(_0x9adf('0x14'));var config=require(_0x9adf('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x9adf('0x16'))['db'];function respondWithStatusCode(_0x1d377a,_0x2477f4){_0x2477f4=_0x2477f4||0xcc;return function(_0x35010f){if(_0x35010f){return _0x1d377a[_0x9adf('0x17')](_0x2477f4);}return _0x1d377a[_0x9adf('0x18')](_0x2477f4)[_0x9adf('0x19')]();};}function respondWithResult(_0x4e3e50,_0x2833a5){_0x2833a5=_0x2833a5||0xc8;return function(_0x6d384c){if(_0x6d384c){return _0x4e3e50[_0x9adf('0x18')](_0x2833a5)[_0x9adf('0x1a')](_0x6d384c);}};}function respondWithFilteredResult(_0x5c633e,_0x2e60f3){return function(_0x4b85a2){if(_0x4b85a2){var _0x4aee77=typeof _0x2e60f3[_0x9adf('0x1b')]==='undefined'&&typeof _0x2e60f3[_0x9adf('0x1c')]===_0x9adf('0x1d');var _0x230951=_0x4b85a2[_0x9adf('0x1e')];var _0x5889e1=_0x4aee77?0x0:_0x2e60f3[_0x9adf('0x1b')];var _0x58818d=_0x4aee77?_0x4b85a2[_0x9adf('0x1e')]:_0x2e60f3['offset']+_0x2e60f3[_0x9adf('0x1c')];var _0x500e81;if(_0x58818d>=_0x230951){_0x58818d=_0x230951;_0x500e81=0xc8;}else{_0x500e81=0xce;}_0x5c633e[_0x9adf('0x18')](_0x500e81);return _0x5c633e[_0x9adf('0x1f')](_0x9adf('0x20'),_0x5889e1+'-'+_0x58818d+'/'+_0x230951)[_0x9adf('0x1a')](_0x4b85a2);}return null;};}function patchUpdates(_0x20aa2f){return function(_0xdbbebc){try{jsonpatch[_0x9adf('0x21')](_0xdbbebc,_0x20aa2f,!![]);}catch(_0x145f13){return BPromise['reject'](_0x145f13);}return _0xdbbebc[_0x9adf('0x22')]();};}function saveUpdates(_0x2b4240,_0x2ffc51){return function(_0x40282e){if(_0x40282e){return _0x40282e[_0x9adf('0x23')](_0x2b4240)[_0x9adf('0x24')](function(_0x11b162){return _0x11b162;});}return null;};}function removeEntity(_0x26bbc2,_0x181770){return function(_0x4a7e5f){if(_0x4a7e5f){return _0x4a7e5f[_0x9adf('0x25')]()[_0x9adf('0x24')](function(){_0x26bbc2[_0x9adf('0x18')](0xcc)[_0x9adf('0x19')]();});}};}function handleEntityNotFound(_0x545aeb,_0x423aa9){return function(_0x23f299){if(!_0x23f299){_0x545aeb[_0x9adf('0x17')](0x194);}return _0x23f299;};}function handleError(_0x1a9cb0,_0x57459e){_0x57459e=_0x57459e||0x1f4;return function(_0x488680){logger[_0x9adf('0x26')](_0x488680[_0x9adf('0x27')]);if(_0x488680[_0x9adf('0x28')]){delete _0x488680['name'];}_0x1a9cb0[_0x9adf('0x18')](_0x57459e)[_0x9adf('0x29')](_0x488680);};}exports[_0x9adf('0x2a')]=function(_0x280404,_0x4b8ea6){var _0x451675={},_0x1bcc8f={},_0xfb3a2f={'count':0x0,'rows':[]};var _0x40a26b=_['map'](db['VtigerField'][_0x9adf('0x2b')],function(_0x1ae744){return{'name':_0x1ae744[_0x9adf('0x2c')],'type':_0x1ae744[_0x9adf('0x2d')]['key']};});_0x1bcc8f[_0x9adf('0x2e')]=_[_0x9adf('0x2f')](_0x40a26b,_0x9adf('0x28'));_0x1bcc8f['query']=_[_0x9adf('0x30')](_0x280404['query']);_0x1bcc8f[_0x9adf('0x31')]=_[_0x9adf('0x32')](_0x1bcc8f[_0x9adf('0x2e')],_0x1bcc8f[_0x9adf('0x33')]);_0x451675[_0x9adf('0x34')]=_[_0x9adf('0x32')](_0x1bcc8f[_0x9adf('0x2e')],qs[_0x9adf('0x35')](_0x280404[_0x9adf('0x33')][_0x9adf('0x35')]));_0x451675[_0x9adf('0x34')]=_0x451675[_0x9adf('0x34')][_0x9adf('0x36')]?_0x451675['attributes']:_0x1bcc8f[_0x9adf('0x2e')];if(!_0x280404[_0x9adf('0x33')][_0x9adf('0x37')](_0x9adf('0x38'))){_0x451675[_0x9adf('0x1c')]=qs[_0x9adf('0x1c')](_0x280404[_0x9adf('0x33')][_0x9adf('0x1c')]);_0x451675['offset']=qs['offset'](_0x280404[_0x9adf('0x33')][_0x9adf('0x1b')]);}_0x451675['order']=qs['sort'](_0x280404[_0x9adf('0x33')][_0x9adf('0x39')]);_0x451675['where']=qs[_0x9adf('0x31')](_[_0x9adf('0x3a')](_0x280404['query'],_0x1bcc8f[_0x9adf('0x31')]),_0x40a26b);if(_0x280404[_0x9adf('0x33')][_0x9adf('0x3b')]){_0x451675[_0x9adf('0x3c')]=_[_0x9adf('0x3d')](_0x451675[_0x9adf('0x3c')],{'$or':_[_0x9adf('0x2f')](_0x40a26b,function(_0x5c6c65){if(_0x5c6c65['type']!=='VIRTUAL'){var _0x82b6e0={};_0x82b6e0[_0x5c6c65[_0x9adf('0x28')]]={'$like':'%'+_0x280404['query'][_0x9adf('0x3b')]+'%'};return _0x82b6e0;}})});}_0x451675=_[_0x9adf('0x3d')]({},_0x451675,_0x280404[_0x9adf('0x3e')]);var _0xfd30d9={'where':_0x451675[_0x9adf('0x3c')]};return db[_0x9adf('0x3f')][_0x9adf('0x1e')](_0xfd30d9)[_0x9adf('0x24')](function(_0xd323d0){_0xfb3a2f['count']=_0xd323d0;if(_0x280404['query'][_0x9adf('0x40')]){_0x451675[_0x9adf('0x41')]=[{'all':!![]}];}return db['VtigerField']['findAll'](_0x451675);})[_0x9adf('0x24')](function(_0x1155e9){_0xfb3a2f[_0x9adf('0x42')]=_0x1155e9;return _0xfb3a2f;})[_0x9adf('0x24')](respondWithFilteredResult(_0x4b8ea6,_0x451675))[_0x9adf('0x43')](handleError(_0x4b8ea6,null));};exports[_0x9adf('0x44')]=function(_0x2e0ab0,_0x12efd7){var _0x41d8cd={'raw':!![],'where':{'id':_0x2e0ab0[_0x9adf('0x45')]['id']}},_0x13788e={};_0x13788e[_0x9adf('0x2e')]=_[_0x9adf('0x30')](db[_0x9adf('0x3f')][_0x9adf('0x2b')]);_0x13788e['query']=_['keys'](_0x2e0ab0[_0x9adf('0x33')]);_0x13788e[_0x9adf('0x31')]=_['intersection'](_0x13788e[_0x9adf('0x2e')],_0x13788e[_0x9adf('0x33')]);_0x41d8cd[_0x9adf('0x34')]=_['intersection'](_0x13788e[_0x9adf('0x2e')],qs[_0x9adf('0x35')](_0x2e0ab0['query']['fields']));_0x41d8cd['attributes']=_0x41d8cd[_0x9adf('0x34')][_0x9adf('0x36')]?_0x41d8cd['attributes']:_0x13788e['model'];if(_0x2e0ab0[_0x9adf('0x33')][_0x9adf('0x40')]){_0x41d8cd[_0x9adf('0x41')]=[{'all':!![]}];}_0x41d8cd=_[_0x9adf('0x3d')]({},_0x41d8cd,_0x2e0ab0[_0x9adf('0x3e')]);return db[_0x9adf('0x3f')][_0x9adf('0x46')](_0x41d8cd)['then'](handleEntityNotFound(_0x12efd7,null))[_0x9adf('0x24')](respondWithResult(_0x12efd7,null))['catch'](handleError(_0x12efd7,null));};exports[_0x9adf('0x47')]=function(_0x13e08d,_0xac99c6){return db[_0x9adf('0x3f')][_0x9adf('0x47')](_0x13e08d[_0x9adf('0x48')],{})[_0x9adf('0x24')](respondWithResult(_0xac99c6,0xc9))[_0x9adf('0x43')](handleError(_0xac99c6,null));};exports[_0x9adf('0x23')]=function(_0x2804c4,_0x3194c8){if(_0x2804c4['body']['id']){delete _0x2804c4[_0x9adf('0x48')]['id'];}return db['VtigerField'][_0x9adf('0x46')]({'where':{'id':_0x2804c4[_0x9adf('0x45')]['id']}})['then'](handleEntityNotFound(_0x3194c8,null))['then'](saveUpdates(_0x2804c4['body'],null))[_0x9adf('0x24')](respondWithResult(_0x3194c8,null))[_0x9adf('0x43')](handleError(_0x3194c8,null));};exports[_0x9adf('0x25')]=function(_0xe297f7,_0x4de327){return db['VtigerField'][_0x9adf('0x46')]({'where':{'id':_0xe297f7[_0x9adf('0x45')]['id']}})[_0x9adf('0x24')](handleEntityNotFound(_0x4de327,null))[_0x9adf('0x24')](removeEntity(_0x4de327,null))[_0x9adf('0x43')](handleError(_0x4de327,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 68f2b40..a47be49 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 _0x79c1=['FieldId','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./intVtigerField.attributes','exports','idField'];(function(_0xfa634c,_0x414e0e){var _0x73e478=function(_0xac2a51){while(--_0xac2a51){_0xfa634c['push'](_0xfa634c['shift']());}};_0x73e478(++_0x414e0e);}(_0x79c1,0x169));var _0x179c=function(_0x450678,_0x2b6600){_0x450678=_0x450678-0x0;var _0xb0d108=_0x79c1[_0x450678];return _0xb0d108;};'use strict';var _=require(_0x179c('0x0'));var util=require(_0x179c('0x1'));var logger=require(_0x179c('0x2'))(_0x179c('0x3'));var moment=require(_0x179c('0x4'));var BPromise=require('bluebird');var rp=require(_0x179c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x179c('0x6'));var config=require(_0x179c('0x7'));var attributes=require(_0x179c('0x8'));module[_0x179c('0x9')]=function(_0xda7420,_0x3209c5){return _0xda7420['define']('VtigerField',attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':[_0x179c('0xa'),_0x179c('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x682b=['./intVtigerField.attributes','exports','VtigerField','int_vtiger_fields','FieldId','lodash','util','api','bluebird','path','rimraf'];(function(_0x567926,_0x132177){var _0x55c6ec=function(_0x7f2903){while(--_0x7f2903){_0x567926['push'](_0x567926['shift']());}};_0x55c6ec(++_0x132177);}(_0x682b,0x10d));var _0xb682=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0x682b[_0x263a74];return _0x2aa86c;};'use strict';var _=require(_0xb682('0x0'));var util=require(_0xb682('0x1'));var logger=require('../../config/logger')(_0xb682('0x2'));var moment=require('moment');var BPromise=require(_0xb682('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb682('0x4'));var rimraf=require(_0xb682('0x5'));var config=require('../../config/environment');var attributes=require(_0xb682('0x6'));module[_0xb682('0x7')]=function(_0x1c3b6e,_0x214cc5){return _0x1c3b6e['define'](_0xb682('0x8'),attributes,{'tableName':_0xb682('0x9'),'paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':['idField',_0xb682('0xa')],'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 cda10a8..8ae7097 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 _0xc0d8=['request','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','http'];(function(_0xf2fa19,_0x1fdd4f){var _0x1e1366=function(_0x396e7a){while(--_0x396e7a){_0xf2fa19['push'](_0xf2fa19['shift']());}};_0x1e1366(++_0x1fdd4f);}(_0xc0d8,0x131));var _0x8c0d=function(_0x3ae2cc,_0x4c8e57){_0x3ae2cc=_0x3ae2cc-0x0;var _0x49bed5=_0xc0d8[_0x3ae2cc];return _0x49bed5;};'use strict';var _=require(_0x8c0d('0x0'));var util=require(_0x8c0d('0x1'));var moment=require(_0x8c0d('0x2'));var BPromise=require(_0x8c0d('0x3'));var rs=require(_0x8c0d('0x4'));var fs=require('fs');var Redis=require(_0x8c0d('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8c0d('0x6'));var config=require(_0x8c0d('0x7'));var jayson=require(_0x8c0d('0x8'));var client=jayson['client'][_0x8c0d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2f8c89,_0x3f008f,_0x1ebd91){return new BPromise(function(_0x4c5c54,_0x1b18d5){return client[_0x8c0d('0xa')](_0x2f8c89,_0x1ebd91)[_0x8c0d('0xb')](function(_0x390f30){logger[_0x8c0d('0xc')](_0x8c0d('0xd'),_0x3f008f,_0x8c0d('0xe'));logger[_0x8c0d('0xf')](_0x8c0d('0x10'),_0x3f008f,_0x8c0d('0xe'),JSON['stringify'](_0x390f30));if(_0x390f30['error']){if(_0x390f30['error']['code']===0x1f4){logger[_0x8c0d('0x11')]('VtigerField,\x20%s,\x20%s',_0x3f008f,_0x390f30[_0x8c0d('0x11')][_0x8c0d('0x12')]);return _0x1b18d5(_0x390f30[_0x8c0d('0x11')][_0x8c0d('0x12')]);}logger['error']('VtigerField,\x20%s,\x20%s',_0x3f008f,_0x390f30[_0x8c0d('0x11')]['message']);return _0x4c5c54(_0x390f30['error']['message']);}else{logger[_0x8c0d('0xc')]('VtigerField,\x20%s,\x20%s',_0x3f008f,_0x8c0d('0xe'));_0x4c5c54(_0x390f30[_0x8c0d('0x13')]['message']);}})[_0x8c0d('0x14')](function(_0x32fc75){logger[_0x8c0d('0x11')](_0x8c0d('0xd'),_0x3f008f,_0x32fc75);_0x1b18d5(_0x32fc75);});});} \ No newline at end of file +var _0x659b=['http','then','VtigerField,\x20%s,\x20%s','request\x20sent','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x5edfb4,_0x2c938c){var _0x3daf93=function(_0x119da8){while(--_0x119da8){_0x5edfb4['push'](_0x5edfb4['shift']());}};_0x3daf93(++_0x2c938c);}(_0x659b,0x100));var _0xb659=function(_0xa84f90,_0x325b39){_0xa84f90=_0xa84f90-0x0;var _0x3d5ec3=_0x659b[_0xa84f90];return _0x3d5ec3;};'use strict';var _=require('lodash');var util=require(_0xb659('0x0'));var moment=require(_0xb659('0x1'));var BPromise=require(_0xb659('0x2'));var rs=require(_0xb659('0x3'));var fs=require('fs');var Redis=require(_0xb659('0x4'));var db=require(_0xb659('0x5'))['db'];var utils=require(_0xb659('0x6'));var logger=require(_0xb659('0x7'))('rpc');var config=require(_0xb659('0x8'));var jayson=require(_0xb659('0x9'));var client=jayson['client'][_0xb659('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5de4ed,_0xf30b0,_0x17dedb){return new BPromise(function(_0xb48bdd,_0x52640d){return client['request'](_0x5de4ed,_0x17dedb)[_0xb659('0xb')](function(_0x3daf1b){logger['info'](_0xb659('0xc'),_0xf30b0,_0xb659('0xd'));logger['debug'](_0xb659('0xe'),_0xf30b0,_0xb659('0xd'),JSON[_0xb659('0xf')](_0x3daf1b));if(_0x3daf1b[_0xb659('0x10')]){if(_0x3daf1b['error'][_0xb659('0x11')]===0x1f4){logger[_0xb659('0x10')]('VtigerField,\x20%s,\x20%s',_0xf30b0,_0x3daf1b[_0xb659('0x10')][_0xb659('0x12')]);return _0x52640d(_0x3daf1b[_0xb659('0x10')][_0xb659('0x12')]);}logger[_0xb659('0x10')]('VtigerField,\x20%s,\x20%s',_0xf30b0,_0x3daf1b['error'][_0xb659('0x12')]);return _0xb48bdd(_0x3daf1b[_0xb659('0x10')]['message']);}else{logger['info'](_0xb659('0xc'),_0xf30b0,_0xb659('0xd'));_0xb48bdd(_0x3daf1b['result']['message']);}})['catch'](function(_0x51c065){logger[_0xb659('0x10')](_0xb659('0xc'),_0xf30b0,_0x51c065);_0x52640d(_0x51c065);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index f717cb6..e8a55f6 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 _0x69d2=['index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','update','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x34e5f8,_0x7b17f7){var _0x2d9b29=function(_0x51ce83){while(--_0x51ce83){_0x34e5f8['push'](_0x34e5f8['shift']());}};_0x2d9b29(++_0x7b17f7);}(_0x69d2,0x1a6));var _0x269d=function(_0xdaef52,_0x5269a2){_0xdaef52=_0xdaef52-0x0;var _0x55208c=_0x69d2[_0xdaef52];return _0x55208c;};'use strict';var multer=require(_0x269d('0x0'));var util=require(_0x269d('0x1'));var path=require('path');var timeout=require(_0x269d('0x2'));var express=require(_0x269d('0x3'));var router=express['Router']();var fs_extra=require(_0x269d('0x4'));var auth=require(_0x269d('0x5'));var interaction=require(_0x269d('0x6'));var config=require(_0x269d('0x7'));var controller=require('./intZendeskAccount.controller');router[_0x269d('0x8')]('/',auth[_0x269d('0x9')](),controller[_0x269d('0xa')]);router[_0x269d('0x8')](_0x269d('0xb'),auth[_0x269d('0x9')](),controller[_0x269d('0xc')]);router[_0x269d('0x8')](_0x269d('0xd'),auth['isAuthenticated'](),controller[_0x269d('0xe')]);router[_0x269d('0x8')](_0x269d('0xf'),auth[_0x269d('0x9')](),controller[_0x269d('0x10')]);router[_0x269d('0x11')]('/',auth[_0x269d('0x9')](),controller['create']);router[_0x269d('0x11')](_0x269d('0xd'),auth[_0x269d('0x9')](),controller[_0x269d('0x12')]);router[_0x269d('0x13')](_0x269d('0xb'),auth['isAuthenticated'](),controller[_0x269d('0x14')]);router[_0x269d('0x15')](_0x269d('0xb'),auth[_0x269d('0x9')](),controller[_0x269d('0x16')]);module[_0x269d('0x17')]=router; \ No newline at end of file +var _0x0271=['util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','/:id','getConfigurations','getFields','create','/:id/configurations','addConfiguration','put','update','delete','destroy','exports','multer'];(function(_0xfabd7c,_0x153e5d){var _0x40ae44=function(_0x4c58ee){while(--_0x4c58ee){_0xfabd7c['push'](_0xfabd7c['shift']());}};_0x40ae44(++_0x153e5d);}(_0x0271,0xdb));var _0x1027=function(_0x11c5c2,_0x263405){_0x11c5c2=_0x11c5c2-0x0;var _0x59cc34=_0x0271[_0x11c5c2];return _0x59cc34;};'use strict';var multer=require(_0x1027('0x0'));var util=require(_0x1027('0x1'));var path=require(_0x1027('0x2'));var timeout=require(_0x1027('0x3'));var express=require(_0x1027('0x4'));var router=express[_0x1027('0x5')]();var fs_extra=require(_0x1027('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1027('0x7'));var controller=require(_0x1027('0x8'));router[_0x1027('0x9')]('/',auth[_0x1027('0xa')](),controller['index']);router[_0x1027('0x9')](_0x1027('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x1027('0x9')]('/:id/configurations',auth[_0x1027('0xa')](),controller[_0x1027('0xc')]);router[_0x1027('0x9')]('/:id/fields',auth[_0x1027('0xa')](),controller[_0x1027('0xd')]);router['post']('/',auth[_0x1027('0xa')](),controller[_0x1027('0xe')]);router['post'](_0x1027('0xf'),auth['isAuthenticated'](),controller[_0x1027('0x10')]);router[_0x1027('0x11')](_0x1027('0xb'),auth[_0x1027('0xa')](),controller[_0x1027('0x12')]);router[_0x1027('0x13')](_0x1027('0xb'),auth[_0x1027('0xa')](),controller[_0x1027('0x14')]);module[_0x1027('0x15')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index e7e1562..32d29bd 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 _0x8aad=['integrationTab','newTab','sequelize','exports','STRING','username','remoteUri','token','password'];(function(_0x4b0418,_0x317d48){var _0x195071=function(_0x36ca91){while(--_0x36ca91){_0x4b0418['push'](_0x4b0418['shift']());}};_0x195071(++_0x317d48);}(_0x8aad,0x146));var _0xd8aa=function(_0x111304,_0x5356d1){_0x111304=_0x111304-0x0;var _0x2c7c07=_0x8aad[_0x111304];return _0x2c7c07;};'use strict';var Sequelize=require(_0xd8aa('0x0'));module[_0xd8aa('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xd8aa('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0xd8aa('0x3')},'password':{'type':Sequelize[_0xd8aa('0x2')]},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xd8aa('0x4')},'authType':{'type':Sequelize['ENUM']('password',_0xd8aa('0x5')),'defaultValue':_0xd8aa('0x6')},'serverUrl':{'type':Sequelize[_0xd8aa('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xd8aa('0x7'),_0xd8aa('0x8')),'defaultValue':_0xd8aa('0x7')}}; \ No newline at end of file +var _0x553a=['exports','STRING','username','password','ENUM','integrationTab'];(function(_0x4f2488,_0x37f267){var _0x5b6ebe=function(_0x22b12c){while(--_0x22b12c){_0x4f2488['push'](_0x4f2488['shift']());}};_0x5b6ebe(++_0x37f267);}(_0x553a,0x192));var _0xa553=function(_0x232e7a,_0x19997){_0x232e7a=_0x232e7a-0x0;var _0x445ddd=_0x553a[_0x232e7a];return _0x445ddd;};'use strict';var Sequelize=require('sequelize');module[_0xa553('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa553('0x1')]},'username':{'type':Sequelize[_0xa553('0x1')],'unique':_0xa553('0x2')},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xa553('0x1')],'unique':'remoteUri'},'authType':{'type':Sequelize['ENUM'](_0xa553('0x3'),'token'),'defaultValue':'password'},'serverUrl':{'type':Sequelize[_0xa553('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xa553('0x4')](_0xa553('0x5'),'newTab'),'defaultValue':_0xa553('0x5')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index f99b5cf..a5fca5e 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 _0x58a4=['model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','ZendeskAccount','include','findAll','rows','catch','params','rawAttributes','includeAll','find','create','body','getConfigurations','findOne','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZendeskConfiguration','ZendeskField','getFields','password','token','remoteUri','slice','substring','lastIndexOf','format','authType','headers','Basic\x20%s','%s:%s','username','toString','base64','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','description','assignee','ticket_fields','includes','position','title','system_field_options','custom_field_options','test','error','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','then','end','sendStatus','stack','name','send','map','type'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0x58a4,0xbf));var _0x458a=function(_0x39092c,_0x167f0c){_0x39092c=_0x39092c-0x0;var _0x7e47a=_0x58a4[_0x39092c];return _0x7e47a;};'use strict';var emlformat=require(_0x458a('0x0'));var rimraf=require(_0x458a('0x1'));var zipdir=require(_0x458a('0x2'));var jsonpatch=require(_0x458a('0x3'));var rp=require(_0x458a('0x4'));var moment=require(_0x458a('0x5'));var BPromise=require(_0x458a('0x6'));var Mustache=require(_0x458a('0x7'));var util=require(_0x458a('0x8'));var path=require(_0x458a('0x9'));var sox=require(_0x458a('0xa'));var csv=require(_0x458a('0xb'));var ejs=require(_0x458a('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x458a('0xd'));var crypto=require(_0x458a('0xe'));var jsforce=require(_0x458a('0xf'));var deskjs=require(_0x458a('0x10'));var toCsv=require(_0x458a('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x458a('0x11'));var authService=require(_0x458a('0x12'));var qs=require(_0x458a('0x13'));var as=require(_0x458a('0x14'));var hardwareService=require(_0x458a('0x15'));var logger=require('../../config/logger')(_0x458a('0x16'));var utils=require(_0x458a('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x458a('0x18'));var db=require(_0x458a('0x19'))['db'];var integrations=require(_0x458a('0x1a'));function respondWithStatusCode(_0x2a4934,_0x2e788b){_0x2e788b=_0x2e788b||0xcc;return function(_0x5bd09e){if(_0x5bd09e){return _0x2a4934['sendStatus'](_0x2e788b);}return _0x2a4934[_0x458a('0x1b')](_0x2e788b)['end']();};}function respondWithResult(_0x2c7528,_0x44f683){_0x44f683=_0x44f683||0xc8;return function(_0x10133b){if(_0x10133b){return _0x2c7528[_0x458a('0x1b')](_0x44f683)[_0x458a('0x1c')](_0x10133b);}};}function respondWithFilteredResult(_0x29acee,_0x507b0f){return function(_0x4b26be){if(_0x4b26be){var _0x5c7993=typeof _0x507b0f[_0x458a('0x1d')]===_0x458a('0x1e')&&typeof _0x507b0f[_0x458a('0x1f')]==='undefined';var _0x310569=_0x4b26be[_0x458a('0x20')];var _0x18504d=_0x5c7993?0x0:_0x507b0f[_0x458a('0x1d')];var _0xa91473=_0x5c7993?_0x4b26be['count']:_0x507b0f['offset']+_0x507b0f[_0x458a('0x1f')];var _0x4d07a7;if(_0xa91473>=_0x310569){_0xa91473=_0x310569;_0x4d07a7=0xc8;}else{_0x4d07a7=0xce;}_0x29acee[_0x458a('0x1b')](_0x4d07a7);return _0x29acee[_0x458a('0x21')]('Content-Range',_0x18504d+'-'+_0xa91473+'/'+_0x310569)[_0x458a('0x1c')](_0x4b26be);}return null;};}function patchUpdates(_0x55a588){return function(_0x200213){try{jsonpatch[_0x458a('0x22')](_0x200213,_0x55a588,!![]);}catch(_0x59f44c){return BPromise[_0x458a('0x23')](_0x59f44c);}return _0x200213[_0x458a('0x24')]();};}function saveUpdates(_0x5a2bcb,_0xa6b8ff){return function(_0x5ad95a){if(_0x5ad95a){return _0x5ad95a[_0x458a('0x25')](_0x5a2bcb)['then'](function(_0x4080fc){return _0x4080fc;});}return null;};}function removeEntity(_0x5dfc6c,_0x36b08e){return function(_0x911eaf){if(_0x911eaf){return _0x911eaf[_0x458a('0x26')]()[_0x458a('0x27')](function(){_0x5dfc6c[_0x458a('0x1b')](0xcc)[_0x458a('0x28')]();});}};}function handleEntityNotFound(_0x340375,_0x3012c7){return function(_0x1f2d0){if(!_0x1f2d0){_0x340375[_0x458a('0x29')](0x194);}return _0x1f2d0;};}function handleError(_0x52efed,_0x327fcb){_0x327fcb=_0x327fcb||0x1f4;return function(_0x21ec38){logger['error'](_0x21ec38[_0x458a('0x2a')]);if(_0x21ec38[_0x458a('0x2b')]){delete _0x21ec38['name'];}_0x52efed['status'](_0x327fcb)[_0x458a('0x2c')](_0x21ec38);};}exports['index']=function(_0x33c5d8,_0x29f9b5){var _0x223f73={},_0x4a49e4={},_0xa6fdf={'count':0x0,'rows':[]};var _0x2531f7=_[_0x458a('0x2d')](db['ZendeskAccount']['rawAttributes'],function(_0x18c890){return{'name':_0x18c890['fieldName'],'type':_0x18c890[_0x458a('0x2e')]['key']};});_0x4a49e4[_0x458a('0x2f')]=_[_0x458a('0x2d')](_0x2531f7,'name');_0x4a49e4[_0x458a('0x30')]=_[_0x458a('0x31')](_0x33c5d8[_0x458a('0x30')]);_0x4a49e4['filters']=_[_0x458a('0x32')](_0x4a49e4[_0x458a('0x2f')],_0x4a49e4[_0x458a('0x30')]);_0x223f73[_0x458a('0x33')]=_[_0x458a('0x32')](_0x4a49e4['model'],qs[_0x458a('0x34')](_0x33c5d8[_0x458a('0x30')][_0x458a('0x34')]));_0x223f73[_0x458a('0x33')]=_0x223f73[_0x458a('0x33')][_0x458a('0x35')]?_0x223f73['attributes']:_0x4a49e4[_0x458a('0x2f')];if(!_0x33c5d8[_0x458a('0x30')][_0x458a('0x36')](_0x458a('0x37'))){_0x223f73[_0x458a('0x1f')]=qs[_0x458a('0x1f')](_0x33c5d8[_0x458a('0x30')][_0x458a('0x1f')]);_0x223f73[_0x458a('0x1d')]=qs['offset'](_0x33c5d8[_0x458a('0x30')][_0x458a('0x1d')]);}_0x223f73[_0x458a('0x38')]=qs[_0x458a('0x39')](_0x33c5d8[_0x458a('0x30')][_0x458a('0x39')]);_0x223f73[_0x458a('0x3a')]=qs[_0x458a('0x3b')](_[_0x458a('0x3c')](_0x33c5d8[_0x458a('0x30')],_0x4a49e4[_0x458a('0x3b')]),_0x2531f7);if(_0x33c5d8[_0x458a('0x30')][_0x458a('0x3d')]){_0x223f73[_0x458a('0x3a')]=_[_0x458a('0x3e')](_0x223f73['where'],{'$or':_[_0x458a('0x2d')](_0x2531f7,function(_0x397a41){if(_0x397a41[_0x458a('0x2e')]!==_0x458a('0x3f')){var _0x3c5840={};_0x3c5840[_0x397a41[_0x458a('0x2b')]]={'$like':'%'+_0x33c5d8[_0x458a('0x30')][_0x458a('0x3d')]+'%'};return _0x3c5840;}})});}_0x223f73=_[_0x458a('0x3e')]({},_0x223f73,_0x33c5d8[_0x458a('0x40')]);var _0x20cf10={'where':_0x223f73['where']};return db[_0x458a('0x41')][_0x458a('0x20')](_0x20cf10)['then'](function(_0x430bda){_0xa6fdf[_0x458a('0x20')]=_0x430bda;if(_0x33c5d8[_0x458a('0x30')]['includeAll']){_0x223f73[_0x458a('0x42')]=[{'all':!![]}];}return db[_0x458a('0x41')][_0x458a('0x43')](_0x223f73);})[_0x458a('0x27')](function(_0xbcd632){_0xa6fdf[_0x458a('0x44')]=_0xbcd632;return _0xa6fdf;})[_0x458a('0x27')](respondWithFilteredResult(_0x29f9b5,_0x223f73))[_0x458a('0x45')](handleError(_0x29f9b5,null));};exports['show']=function(_0x296385,_0x145e3c){var _0x2b9030={'raw':![],'where':{'id':_0x296385[_0x458a('0x46')]['id']}},_0x5180ae={};_0x5180ae[_0x458a('0x2f')]=_['keys'](db[_0x458a('0x41')][_0x458a('0x47')]);_0x5180ae[_0x458a('0x30')]=_[_0x458a('0x31')](_0x296385[_0x458a('0x30')]);_0x5180ae['filters']=_['intersection'](_0x5180ae[_0x458a('0x2f')],_0x5180ae[_0x458a('0x30')]);_0x2b9030[_0x458a('0x33')]=_[_0x458a('0x32')](_0x5180ae['model'],qs[_0x458a('0x34')](_0x296385[_0x458a('0x30')]['fields']));_0x2b9030[_0x458a('0x33')]=_0x2b9030['attributes'][_0x458a('0x35')]?_0x2b9030[_0x458a('0x33')]:_0x5180ae[_0x458a('0x2f')];if(_0x296385['query'][_0x458a('0x48')]){_0x2b9030[_0x458a('0x42')]=[{'all':!![]}];}_0x2b9030=_[_0x458a('0x3e')]({},_0x2b9030,_0x296385['options']);return db['ZendeskAccount'][_0x458a('0x49')](_0x2b9030)[_0x458a('0x27')](handleEntityNotFound(_0x145e3c,null))[_0x458a('0x27')](respondWithResult(_0x145e3c,null))['catch'](handleError(_0x145e3c,null));};exports['create']=function(_0x3a7005,_0xf362b5){return db[_0x458a('0x41')][_0x458a('0x4a')](_0x3a7005[_0x458a('0x4b')],{})[_0x458a('0x27')](respondWithResult(_0xf362b5,0xc9))[_0x458a('0x45')](handleError(_0xf362b5,null));};exports[_0x458a('0x25')]=function(_0xb22232,_0x213f86){if(_0xb22232[_0x458a('0x4b')]['id']){delete _0xb22232[_0x458a('0x4b')]['id'];}return db[_0x458a('0x41')][_0x458a('0x49')]({'where':{'id':_0xb22232[_0x458a('0x46')]['id']}})[_0x458a('0x27')](handleEntityNotFound(_0x213f86,null))['then'](saveUpdates(_0xb22232[_0x458a('0x4b')],null))[_0x458a('0x27')](respondWithResult(_0x213f86,null))[_0x458a('0x45')](handleError(_0x213f86,null));};exports[_0x458a('0x26')]=function(_0x44670a,_0x5630cf){return db['ZendeskAccount']['find']({'where':{'id':_0x44670a[_0x458a('0x46')]['id']}})['then'](handleEntityNotFound(_0x5630cf,null))[_0x458a('0x27')](removeEntity(_0x5630cf,null))[_0x458a('0x45')](handleError(_0x5630cf,null));};exports[_0x458a('0x4c')]=function(_0x649553,_0xfa6e65,_0x5f0151){var _0x48f68e={};var _0x3d7616={};var _0x2d8b77;var _0x2587a1;return db[_0x458a('0x41')][_0x458a('0x4d')]({'where':{'id':_0x649553['params']['id']}})[_0x458a('0x27')](handleEntityNotFound(_0xfa6e65,null))['then'](function(_0xa51e28){if(_0xa51e28){_0x2d8b77=_0xa51e28;_0x3d7616['model']=_[_0x458a('0x31')](db['ZendeskConfiguration']['rawAttributes']);_0x3d7616['query']=_[_0x458a('0x31')](_0x649553[_0x458a('0x30')]);_0x3d7616['filters']=_[_0x458a('0x32')](_0x3d7616[_0x458a('0x2f')],_0x3d7616[_0x458a('0x30')]);_0x48f68e['attributes']=_[_0x458a('0x32')](_0x3d7616[_0x458a('0x2f')],qs[_0x458a('0x34')](_0x649553[_0x458a('0x30')][_0x458a('0x34')]));_0x48f68e[_0x458a('0x33')]=_0x48f68e['attributes'][_0x458a('0x35')]?_0x48f68e[_0x458a('0x33')]:_0x3d7616[_0x458a('0x2f')];_0x48f68e[_0x458a('0x38')]=qs[_0x458a('0x39')](_0x649553[_0x458a('0x30')][_0x458a('0x39')]);_0x48f68e[_0x458a('0x3a')]=qs['filters'](_[_0x458a('0x3c')](_0x649553['query'],_0x3d7616[_0x458a('0x3b')]));if(_0x649553[_0x458a('0x30')][_0x458a('0x3d')]){_0x48f68e[_0x458a('0x3a')]=_['merge'](_0x48f68e['where'],{'$or':_[_0x458a('0x2d')](_0x48f68e[_0x458a('0x33')],function(_0x2b9aac){var _0x156a22={};_0x156a22[_0x2b9aac]={'$like':'%'+_0x649553[_0x458a('0x30')][_0x458a('0x3d')]+'%'};return _0x156a22;})});}_0x48f68e=_['merge']({},_0x48f68e,_0x649553[_0x458a('0x40')]);return _0x2d8b77[_0x458a('0x4c')](_0x48f68e);}})['then'](function(_0x18d83a){if(_0x18d83a){_0x2587a1=_0x18d83a['length'];if(!_0x649553[_0x458a('0x30')][_0x458a('0x36')](_0x458a('0x37'))){_0x48f68e[_0x458a('0x1f')]=qs[_0x458a('0x1f')](_0x649553[_0x458a('0x30')][_0x458a('0x1f')]);_0x48f68e[_0x458a('0x1d')]=qs['offset'](_0x649553[_0x458a('0x30')][_0x458a('0x1d')]);}return _0x2d8b77['getConfigurations'](_0x48f68e);}})[_0x458a('0x27')](function(_0x3da617){if(_0x3da617){return _0x3da617?{'count':_0x2587a1,'rows':_0x3da617}:null;}})['then'](respondWithResult(_0xfa6e65,null))[_0x458a('0x45')](handleError(_0xfa6e65,null));};exports[_0x458a('0x4e')]=function(_0x47cbcf,_0x17b611,_0x180df0){if(_0x47cbcf['body']['id']){delete _0x47cbcf[_0x458a('0x4b')]['id'];}return db[_0x458a('0x41')][_0x458a('0x4d')]({'where':{'id':_0x47cbcf[_0x458a('0x46')]['id']}})[_0x458a('0x27')](handleEntityNotFound(_0x17b611,null))[_0x458a('0x27')](function(_0x4199a7){if(_0x4199a7){_0x47cbcf[_0x458a('0x4b')]['AccountId']=_0x4199a7['id'];_0x47cbcf[_0x458a('0x4b')][_0x458a('0x4f')]=integrations[_0x458a('0x50')](_0x47cbcf[_0x458a('0x4b')][_0x458a('0x51')],_0x47cbcf[_0x458a('0x4b')][_0x458a('0x2e')]);_0x47cbcf[_0x458a('0x4b')][_0x458a('0x52')]=integrations[_0x458a('0x53')](_0x47cbcf['body'][_0x458a('0x51')],_0x47cbcf['body'][_0x458a('0x2e')]);return db[_0x458a('0x54')][_0x458a('0x4a')](_0x47cbcf[_0x458a('0x4b')],{'include':[{'model':db[_0x458a('0x55')],'as':_0x458a('0x4f')},{'model':db[_0x458a('0x55')],'as':_0x458a('0x52')}]});}return null;})[_0x458a('0x27')](respondWithResult(_0x17b611,null))[_0x458a('0x45')](handleError(_0x17b611,null));};exports[_0x458a('0x56')]=function(_0x448cbc,_0x11bbba,_0x435884){var _0x3948aa='';return db[_0x458a('0x41')]['findOne']({'where':{'id':_0x448cbc[_0x458a('0x46')]['id']},'attributes':['id','username',_0x458a('0x57'),_0x458a('0x58'),'authType',_0x458a('0x59')]})[_0x458a('0x27')](handleEntityNotFound(_0x11bbba,null))[_0x458a('0x27')](function(_0x494710){if(_0x494710){_0x3948aa=_0x494710[_0x458a('0x59')];var _0xed002=_0x3948aa[_0x458a('0x5a')](-0x1);if(_0xed002==='/'){_0x3948aa=_0x3948aa[_0x458a('0x5b')](0x0,_0x3948aa[_0x458a('0x5c')](_0xed002));}var _0x42f213={'method':'GET','uri':util[_0x458a('0x5d')]('%s/%s',_0x3948aa,'ticket_fields'),'json':!![]};switch(_0x494710[_0x458a('0x5e')]){case _0x458a('0x57'):_0x42f213[_0x458a('0x5f')]={'Authorization':util[_0x458a('0x5d')](_0x458a('0x60'),new Buffer(util[_0x458a('0x5d')](_0x458a('0x61'),_0x494710[_0x458a('0x62')],_0x494710[_0x458a('0x57')]))[_0x458a('0x63')](_0x458a('0x64')))};break;case _0x458a('0x58'):_0x42f213[_0x458a('0x5f')]={'Authorization':util[_0x458a('0x5d')]('Basic\x20%s',new Buffer(util['format']('%s/token:%s',_0x494710[_0x458a('0x62')],_0x494710['token']))[_0x458a('0x63')](_0x458a('0x64')))};break;default:throw new db[(_0x458a('0x65'))][(_0x458a('0x66'))](_0x458a('0x67'));}return rp(_0x42f213);}})[_0x458a('0x27')](function(_0x46df7c){if(_0x46df7c){var _0x49f3ee=[_0x458a('0x68'),_0x458a('0x69'),'group',_0x458a('0x6a')];_['remove'](_0x46df7c[_0x458a('0x6b')],function(_0x58d29d){return _0x49f3ee[_0x458a('0x6c')](_0x58d29d[_0x458a('0x2e')]);});return{'count':_0x46df7c[_0x458a('0x6b')][_0x458a('0x35')],'rows':_['map'](_0x46df7c[_0x458a('0x6b')],function(_0x14b95e){return{'id':_0x14b95e['id'],'name':_0x14b95e[_0x458a('0x6d')]>0x7?_0x14b95e[_0x458a('0x6e')]:_0x14b95e[_0x458a('0x2e')],'custom':_0x14b95e[_0x458a('0x6d')]>0x7?!![]:![],'options':_0x14b95e[_0x458a('0x6f')]?_0x14b95e[_0x458a('0x6f')]:_0x14b95e['custom_field_options']?_0x14b95e[_0x458a('0x70')]:[]};})};}})[_0x458a('0x27')](respondWithResult(_0x11bbba,null))[_0x458a('0x45')](function(_0x4212af){var _0x591dbb=_0x448cbc[_0x458a('0x30')][_0x458a('0x71')]?0x1f4:_0x4212af['statusCode']||0x1f4;logger[_0x458a('0x72')](_0x458a('0x73'),_0x458a('0x56'),_0x591dbb,JSON[_0x458a('0x74')](_0x4212af));delete _0x4212af[_0x458a('0x2b')];if(_0x591dbb===0x191){_0x591dbb=0x190;}_0x11bbba['status'](_0x591dbb)[_0x458a('0x2c')](_0x448cbc[_0x458a('0x30')][_0x458a('0x71')]?{'message':_0x458a('0x75'),'statusCode':_0x4212af[_0x458a('0x76')]}:_0x4212af);});}; \ No newline at end of file +var _0xf4eb=['includes','position','title','system_field_options','custom_field_options','test','statusCode','error','getFields','stringify','send','Wrong\x20credentials','eml-format','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','index','map','ZendeskAccount','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','merge','filter','options','includeAll','include','catch','show','params','find','create','body','getConfigurations','order','nolimit','addConfiguration','Subjects','getSubjects','channel','getDescriptions','ZendeskConfiguration','ZendeskField','findOne','username','password','authType','remoteUri','slice','substring','lastIndexOf','GET','format','%s/%s','headers','Basic\x20%s','%s:%s','toString','base64','%s/token:%s','token','ValidationError','description','assignee','remove','ticket_fields'];(function(_0x42f370,_0xaa01c7){var _0x2fee7d=function(_0x56a08a){while(--_0x56a08a){_0x42f370['push'](_0x42f370['shift']());}};_0x2fee7d(++_0xaa01c7);}(_0xf4eb,0xec));var _0xbf4e=function(_0x148dc4,_0x764f75){_0x148dc4=_0x148dc4-0x0;var _0x2c9aa5=_0xf4eb[_0x148dc4];return _0x2c9aa5;};'use strict';var emlformat=require(_0xbf4e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xbf4e('0x1'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xbf4e('0x2'));var path=require(_0xbf4e('0x3'));var sox=require(_0xbf4e('0x4'));var csv=require(_0xbf4e('0x5'));var ejs=require(_0xbf4e('0x6'));var fs=require('fs');var fs_extra=require(_0xbf4e('0x7'));var _=require(_0xbf4e('0x8'));var squel=require('squel');var crypto=require(_0xbf4e('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xbf4e('0x5'));var querystring=require(_0xbf4e('0xa'));var Papa=require(_0xbf4e('0xb'));var Redis=require(_0xbf4e('0xc'));var authService=require(_0xbf4e('0xd'));var qs=require(_0xbf4e('0xe'));var as=require(_0xbf4e('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xbf4e('0x10'));var utils=require('../../config/utils');var config=require(_0xbf4e('0x11'));var licenseUtil=require(_0xbf4e('0x12'));var db=require('../../mysqldb')['db'];var integrations=require(_0xbf4e('0x13'));function respondWithStatusCode(_0x5a3035,_0x56d185){_0x56d185=_0x56d185||0xcc;return function(_0x209b25){if(_0x209b25){return _0x5a3035[_0xbf4e('0x14')](_0x56d185);}return _0x5a3035[_0xbf4e('0x15')](_0x56d185)[_0xbf4e('0x16')]();};}function respondWithResult(_0x3b74bd,_0x61bd54){_0x61bd54=_0x61bd54||0xc8;return function(_0x4984b4){if(_0x4984b4){return _0x3b74bd['status'](_0x61bd54)[_0xbf4e('0x17')](_0x4984b4);}};}function respondWithFilteredResult(_0x1735ae,_0x28fc6b){return function(_0x542909){if(_0x542909){var _0x14110b=typeof _0x28fc6b[_0xbf4e('0x18')]===_0xbf4e('0x19')&&typeof _0x28fc6b[_0xbf4e('0x1a')]==='undefined';var _0x247322=_0x542909['count'];var _0x5db03f=_0x14110b?0x0:_0x28fc6b['offset'];var _0x4f8762=_0x14110b?_0x542909[_0xbf4e('0x1b')]:_0x28fc6b[_0xbf4e('0x18')]+_0x28fc6b[_0xbf4e('0x1a')];var _0x4d9c2a;if(_0x4f8762>=_0x247322){_0x4f8762=_0x247322;_0x4d9c2a=0xc8;}else{_0x4d9c2a=0xce;}_0x1735ae['status'](_0x4d9c2a);return _0x1735ae[_0xbf4e('0x1c')](_0xbf4e('0x1d'),_0x5db03f+'-'+_0x4f8762+'/'+_0x247322)[_0xbf4e('0x17')](_0x542909);}return null;};}function patchUpdates(_0x3a875b){return function(_0x344727){try{jsonpatch[_0xbf4e('0x1e')](_0x344727,_0x3a875b,!![]);}catch(_0x415963){return BPromise[_0xbf4e('0x1f')](_0x415963);}return _0x344727[_0xbf4e('0x20')]();};}function saveUpdates(_0x376832,_0x30539b){return function(_0x59bd84){if(_0x59bd84){return _0x59bd84[_0xbf4e('0x21')](_0x376832)[_0xbf4e('0x22')](function(_0x51648c){return _0x51648c;});}return null;};}function removeEntity(_0x31e3f5,_0x30994d){return function(_0x114412){if(_0x114412){return _0x114412[_0xbf4e('0x23')]()[_0xbf4e('0x22')](function(){_0x31e3f5['status'](0xcc)[_0xbf4e('0x16')]();});}};}function handleEntityNotFound(_0x36688a,_0x3d6863){return function(_0x5766d4){if(!_0x5766d4){_0x36688a[_0xbf4e('0x14')](0x194);}return _0x5766d4;};}function handleError(_0x5e08b1,_0x5bcf71){_0x5bcf71=_0x5bcf71||0x1f4;return function(_0x2bfccf){logger['error'](_0x2bfccf[_0xbf4e('0x24')]);if(_0x2bfccf[_0xbf4e('0x25')]){delete _0x2bfccf[_0xbf4e('0x25')];}_0x5e08b1[_0xbf4e('0x15')](_0x5bcf71)['send'](_0x2bfccf);};}exports[_0xbf4e('0x26')]=function(_0x8e0ab5,_0x43879d){var _0x4cd4a1={},_0x681c3b={},_0x590c85={'count':0x0,'rows':[]};var _0x1dfa81=_[_0xbf4e('0x27')](db[_0xbf4e('0x28')]['rawAttributes'],function(_0x1d12e2){return{'name':_0x1d12e2[_0xbf4e('0x29')],'type':_0x1d12e2[_0xbf4e('0x2a')][_0xbf4e('0x2b')]};});_0x681c3b[_0xbf4e('0x2c')]=_[_0xbf4e('0x27')](_0x1dfa81,'name');_0x681c3b[_0xbf4e('0x2d')]=_[_0xbf4e('0x2e')](_0x8e0ab5['query']);_0x681c3b[_0xbf4e('0x2f')]=_[_0xbf4e('0x30')](_0x681c3b['model'],_0x681c3b[_0xbf4e('0x2d')]);_0x4cd4a1['attributes']=_[_0xbf4e('0x30')](_0x681c3b['model'],qs[_0xbf4e('0x31')](_0x8e0ab5[_0xbf4e('0x2d')][_0xbf4e('0x31')]));_0x4cd4a1['attributes']=_0x4cd4a1[_0xbf4e('0x32')][_0xbf4e('0x33')]?_0x4cd4a1[_0xbf4e('0x32')]:_0x681c3b[_0xbf4e('0x2c')];if(!_0x8e0ab5[_0xbf4e('0x2d')][_0xbf4e('0x34')]('nolimit')){_0x4cd4a1[_0xbf4e('0x1a')]=qs[_0xbf4e('0x1a')](_0x8e0ab5[_0xbf4e('0x2d')][_0xbf4e('0x1a')]);_0x4cd4a1[_0xbf4e('0x18')]=qs['offset'](_0x8e0ab5['query']['offset']);}_0x4cd4a1['order']=qs[_0xbf4e('0x35')](_0x8e0ab5[_0xbf4e('0x2d')][_0xbf4e('0x35')]);_0x4cd4a1[_0xbf4e('0x36')]=qs[_0xbf4e('0x2f')](_[_0xbf4e('0x37')](_0x8e0ab5[_0xbf4e('0x2d')],_0x681c3b[_0xbf4e('0x2f')]),_0x1dfa81);if(_0x8e0ab5[_0xbf4e('0x2d')]['filter']){_0x4cd4a1['where']=_[_0xbf4e('0x38')](_0x4cd4a1[_0xbf4e('0x36')],{'$or':_[_0xbf4e('0x27')](_0x1dfa81,function(_0x4ae676){if(_0x4ae676[_0xbf4e('0x2a')]!=='VIRTUAL'){var _0x370d90={};_0x370d90[_0x4ae676[_0xbf4e('0x25')]]={'$like':'%'+_0x8e0ab5[_0xbf4e('0x2d')][_0xbf4e('0x39')]+'%'};return _0x370d90;}})});}_0x4cd4a1=_['merge']({},_0x4cd4a1,_0x8e0ab5[_0xbf4e('0x3a')]);var _0x78ab2d={'where':_0x4cd4a1[_0xbf4e('0x36')]};return db[_0xbf4e('0x28')]['count'](_0x78ab2d)[_0xbf4e('0x22')](function(_0x44e96b){_0x590c85[_0xbf4e('0x1b')]=_0x44e96b;if(_0x8e0ab5[_0xbf4e('0x2d')][_0xbf4e('0x3b')]){_0x4cd4a1[_0xbf4e('0x3c')]=[{'all':!![]}];}return db[_0xbf4e('0x28')]['findAll'](_0x4cd4a1);})[_0xbf4e('0x22')](function(_0x7b3a94){_0x590c85['rows']=_0x7b3a94;return _0x590c85;})['then'](respondWithFilteredResult(_0x43879d,_0x4cd4a1))[_0xbf4e('0x3d')](handleError(_0x43879d,null));};exports[_0xbf4e('0x3e')]=function(_0x495e53,_0x5bfc4d){var _0x2b1bf4={'raw':![],'where':{'id':_0x495e53[_0xbf4e('0x3f')]['id']}},_0x150224={};_0x150224[_0xbf4e('0x2c')]=_[_0xbf4e('0x2e')](db[_0xbf4e('0x28')]['rawAttributes']);_0x150224[_0xbf4e('0x2d')]=_[_0xbf4e('0x2e')](_0x495e53['query']);_0x150224['filters']=_['intersection'](_0x150224['model'],_0x150224[_0xbf4e('0x2d')]);_0x2b1bf4['attributes']=_[_0xbf4e('0x30')](_0x150224[_0xbf4e('0x2c')],qs['fields'](_0x495e53['query'][_0xbf4e('0x31')]));_0x2b1bf4[_0xbf4e('0x32')]=_0x2b1bf4[_0xbf4e('0x32')][_0xbf4e('0x33')]?_0x2b1bf4[_0xbf4e('0x32')]:_0x150224['model'];if(_0x495e53[_0xbf4e('0x2d')][_0xbf4e('0x3b')]){_0x2b1bf4[_0xbf4e('0x3c')]=[{'all':!![]}];}_0x2b1bf4=_[_0xbf4e('0x38')]({},_0x2b1bf4,_0x495e53[_0xbf4e('0x3a')]);return db[_0xbf4e('0x28')][_0xbf4e('0x40')](_0x2b1bf4)[_0xbf4e('0x22')](handleEntityNotFound(_0x5bfc4d,null))['then'](respondWithResult(_0x5bfc4d,null))[_0xbf4e('0x3d')](handleError(_0x5bfc4d,null));};exports[_0xbf4e('0x41')]=function(_0x1833c1,_0x32bed6){return db[_0xbf4e('0x28')][_0xbf4e('0x41')](_0x1833c1[_0xbf4e('0x42')],{})[_0xbf4e('0x22')](respondWithResult(_0x32bed6,0xc9))[_0xbf4e('0x3d')](handleError(_0x32bed6,null));};exports[_0xbf4e('0x21')]=function(_0x2fdba9,_0x6fd78d){if(_0x2fdba9[_0xbf4e('0x42')]['id']){delete _0x2fdba9[_0xbf4e('0x42')]['id'];}return db[_0xbf4e('0x28')][_0xbf4e('0x40')]({'where':{'id':_0x2fdba9[_0xbf4e('0x3f')]['id']}})['then'](handleEntityNotFound(_0x6fd78d,null))[_0xbf4e('0x22')](saveUpdates(_0x2fdba9[_0xbf4e('0x42')],null))[_0xbf4e('0x22')](respondWithResult(_0x6fd78d,null))['catch'](handleError(_0x6fd78d,null));};exports[_0xbf4e('0x23')]=function(_0x5ed838,_0x4a050e){return db[_0xbf4e('0x28')][_0xbf4e('0x40')]({'where':{'id':_0x5ed838['params']['id']}})[_0xbf4e('0x22')](handleEntityNotFound(_0x4a050e,null))[_0xbf4e('0x22')](removeEntity(_0x4a050e,null))[_0xbf4e('0x3d')](handleError(_0x4a050e,null));};exports[_0xbf4e('0x43')]=function(_0x42eef6,_0x2ac2c8,_0x419969){var _0x1cdd8c={};var _0x3cd61b={};var _0xc058e1;var _0x271ad2;return db['ZendeskAccount']['findOne']({'where':{'id':_0x42eef6[_0xbf4e('0x3f')]['id']}})[_0xbf4e('0x22')](handleEntityNotFound(_0x2ac2c8,null))[_0xbf4e('0x22')](function(_0x586f5d){if(_0x586f5d){_0xc058e1=_0x586f5d;_0x3cd61b[_0xbf4e('0x2c')]=_[_0xbf4e('0x2e')](db['ZendeskConfiguration']['rawAttributes']);_0x3cd61b[_0xbf4e('0x2d')]=_['keys'](_0x42eef6['query']);_0x3cd61b[_0xbf4e('0x2f')]=_[_0xbf4e('0x30')](_0x3cd61b[_0xbf4e('0x2c')],_0x3cd61b[_0xbf4e('0x2d')]);_0x1cdd8c[_0xbf4e('0x32')]=_['intersection'](_0x3cd61b[_0xbf4e('0x2c')],qs['fields'](_0x42eef6[_0xbf4e('0x2d')]['fields']));_0x1cdd8c[_0xbf4e('0x32')]=_0x1cdd8c['attributes'][_0xbf4e('0x33')]?_0x1cdd8c[_0xbf4e('0x32')]:_0x3cd61b[_0xbf4e('0x2c')];_0x1cdd8c[_0xbf4e('0x44')]=qs[_0xbf4e('0x35')](_0x42eef6['query']['sort']);_0x1cdd8c['where']=qs['filters'](_[_0xbf4e('0x37')](_0x42eef6[_0xbf4e('0x2d')],_0x3cd61b['filters']));if(_0x42eef6[_0xbf4e('0x2d')][_0xbf4e('0x39')]){_0x1cdd8c[_0xbf4e('0x36')]=_[_0xbf4e('0x38')](_0x1cdd8c[_0xbf4e('0x36')],{'$or':_[_0xbf4e('0x27')](_0x1cdd8c[_0xbf4e('0x32')],function(_0x48682c){var _0x25c254={};_0x25c254[_0x48682c]={'$like':'%'+_0x42eef6[_0xbf4e('0x2d')][_0xbf4e('0x39')]+'%'};return _0x25c254;})});}_0x1cdd8c=_['merge']({},_0x1cdd8c,_0x42eef6['options']);return _0xc058e1[_0xbf4e('0x43')](_0x1cdd8c);}})[_0xbf4e('0x22')](function(_0x2e8a62){if(_0x2e8a62){_0x271ad2=_0x2e8a62['length'];if(!_0x42eef6[_0xbf4e('0x2d')][_0xbf4e('0x34')](_0xbf4e('0x45'))){_0x1cdd8c[_0xbf4e('0x1a')]=qs[_0xbf4e('0x1a')](_0x42eef6[_0xbf4e('0x2d')][_0xbf4e('0x1a')]);_0x1cdd8c[_0xbf4e('0x18')]=qs[_0xbf4e('0x18')](_0x42eef6[_0xbf4e('0x2d')][_0xbf4e('0x18')]);}return _0xc058e1[_0xbf4e('0x43')](_0x1cdd8c);}})['then'](function(_0x21cbd2){if(_0x21cbd2){return _0x21cbd2?{'count':_0x271ad2,'rows':_0x21cbd2}:null;}})['then'](respondWithResult(_0x2ac2c8,null))[_0xbf4e('0x3d')](handleError(_0x2ac2c8,null));};exports[_0xbf4e('0x46')]=function(_0x400fa5,_0x180b13,_0x2080ec){if(_0x400fa5[_0xbf4e('0x42')]['id']){delete _0x400fa5[_0xbf4e('0x42')]['id'];}return db[_0xbf4e('0x28')]['findOne']({'where':{'id':_0x400fa5[_0xbf4e('0x3f')]['id']}})[_0xbf4e('0x22')](handleEntityNotFound(_0x180b13,null))[_0xbf4e('0x22')](function(_0x33f9c4){if(_0x33f9c4){_0x400fa5[_0xbf4e('0x42')]['AccountId']=_0x33f9c4['id'];_0x400fa5[_0xbf4e('0x42')][_0xbf4e('0x47')]=integrations[_0xbf4e('0x48')](_0x400fa5[_0xbf4e('0x42')][_0xbf4e('0x49')],_0x400fa5[_0xbf4e('0x42')]['type']);_0x400fa5[_0xbf4e('0x42')]['Descriptions']=integrations[_0xbf4e('0x4a')](_0x400fa5[_0xbf4e('0x42')][_0xbf4e('0x49')],_0x400fa5[_0xbf4e('0x42')]['type']);return db[_0xbf4e('0x4b')]['create'](_0x400fa5['body'],{'include':[{'model':db[_0xbf4e('0x4c')],'as':_0xbf4e('0x47')},{'model':db[_0xbf4e('0x4c')],'as':'Descriptions'}]});}return null;})[_0xbf4e('0x22')](respondWithResult(_0x180b13,null))[_0xbf4e('0x3d')](handleError(_0x180b13,null));};exports['getFields']=function(_0x19c5b4,_0x42df5f,_0x4405b9){var _0x137224='';return db[_0xbf4e('0x28')][_0xbf4e('0x4d')]({'where':{'id':_0x19c5b4[_0xbf4e('0x3f')]['id']},'attributes':['id',_0xbf4e('0x4e'),_0xbf4e('0x4f'),'token',_0xbf4e('0x50'),_0xbf4e('0x51')]})[_0xbf4e('0x22')](handleEntityNotFound(_0x42df5f,null))[_0xbf4e('0x22')](function(_0x54f450){if(_0x54f450){_0x137224=_0x54f450[_0xbf4e('0x51')];var _0x667836=_0x137224[_0xbf4e('0x52')](-0x1);if(_0x667836==='/'){_0x137224=_0x137224[_0xbf4e('0x53')](0x0,_0x137224[_0xbf4e('0x54')](_0x667836));}var _0x3448f5={'method':_0xbf4e('0x55'),'uri':util[_0xbf4e('0x56')](_0xbf4e('0x57'),_0x137224,'ticket_fields'),'json':!![]};switch(_0x54f450[_0xbf4e('0x50')]){case'password':_0x3448f5[_0xbf4e('0x58')]={'Authorization':util[_0xbf4e('0x56')](_0xbf4e('0x59'),new Buffer(util[_0xbf4e('0x56')](_0xbf4e('0x5a'),_0x54f450['username'],_0x54f450[_0xbf4e('0x4f')]))[_0xbf4e('0x5b')](_0xbf4e('0x5c')))};break;case'token':_0x3448f5[_0xbf4e('0x58')]={'Authorization':util[_0xbf4e('0x56')](_0xbf4e('0x59'),new Buffer(util['format'](_0xbf4e('0x5d'),_0x54f450[_0xbf4e('0x4e')],_0x54f450[_0xbf4e('0x5e')]))[_0xbf4e('0x5b')](_0xbf4e('0x5c')))};break;default:throw new db['Sequelize'][(_0xbf4e('0x5f'))]('Unknown\x20authentication\x20type');}return rp(_0x3448f5);}})[_0xbf4e('0x22')](function(_0x504723){if(_0x504723){var _0x19a7e9=['subject',_0xbf4e('0x60'),'group',_0xbf4e('0x61')];_[_0xbf4e('0x62')](_0x504723[_0xbf4e('0x63')],function(_0x23de82){return _0x19a7e9[_0xbf4e('0x64')](_0x23de82[_0xbf4e('0x2a')]);});return{'count':_0x504723[_0xbf4e('0x63')]['length'],'rows':_[_0xbf4e('0x27')](_0x504723[_0xbf4e('0x63')],function(_0x2a242b){return{'id':_0x2a242b['id'],'name':_0x2a242b[_0xbf4e('0x65')]>0x7?_0x2a242b[_0xbf4e('0x66')]:_0x2a242b[_0xbf4e('0x2a')],'custom':_0x2a242b['position']>0x7?!![]:![],'options':_0x2a242b[_0xbf4e('0x67')]?_0x2a242b[_0xbf4e('0x67')]:_0x2a242b['custom_field_options']?_0x2a242b[_0xbf4e('0x68')]:[]};})};}})[_0xbf4e('0x22')](respondWithResult(_0x42df5f,null))[_0xbf4e('0x3d')](function(_0xb6d122){var _0x19ec7e=_0x19c5b4[_0xbf4e('0x2d')][_0xbf4e('0x69')]?0x1f4:_0xb6d122[_0xbf4e('0x6a')]||0x1f4;logger[_0xbf4e('0x6b')]('getFields,\x20%s,\x20%s,\x20%s',_0xbf4e('0x6c'),_0x19ec7e,JSON[_0xbf4e('0x6d')](_0xb6d122));delete _0xb6d122[_0xbf4e('0x25')];if(_0x19ec7e===0x191){_0x19ec7e=0x190;}_0x42df5f['status'](_0x19ec7e)[_0xbf4e('0x6e')](_0x19c5b4[_0xbf4e('0x2d')]['test']?{'message':_0xbf4e('0x6f'),'statusCode':_0xb6d122[_0xbf4e('0x6a')]}:_0xb6d122);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index bfcf195..2df7f78 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 _0x88fa=['exports','define','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration'];(function(_0x566168,_0x4c39af){var _0x4e1f7a=function(_0x5ec3ee){while(--_0x5ec3ee){_0x566168['push'](_0x566168['shift']());}};_0x4e1f7a(++_0x4c39af);}(_0x88fa,0x18e));var _0xa88f=function(_0x2f6b21,_0x2f8725){_0x2f6b21=_0x2f6b21-0x0;var _0x5c74b0=_0x88fa[_0x2f6b21];return _0x5c74b0;};'use strict';var _=require(_0xa88f('0x0'));var util=require(_0xa88f('0x1'));var logger=require(_0xa88f('0x2'))('api');var moment=require(_0xa88f('0x3'));var BPromise=require(_0xa88f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa88f('0x5'));var rimraf=require(_0xa88f('0x6'));var config=require(_0xa88f('0x7'));var attributes=require(_0xa88f('0x8'));var integrations=require(_0xa88f('0x9'));module[_0xa88f('0xa')]=function(_0x2a44c7,_0x5f22cc){return _0x2a44c7[_0xa88f('0xb')]('ZendeskAccount',attributes,{'tableName':'int_zendesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe98b=['bluebird','request-promise','path','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','ZendeskAccount','lodash','util','api','moment'];(function(_0x308213,_0x224541){var _0x2e1619=function(_0x972b51){while(--_0x972b51){_0x308213['push'](_0x308213['shift']());}};_0x2e1619(++_0x224541);}(_0xe98b,0x140));var _0xbe98=function(_0x4ea1f1,_0x4700d9){_0x4ea1f1=_0x4ea1f1-0x0;var _0x42367c=_0xe98b[_0x4ea1f1];return _0x42367c;};'use strict';var _=require(_0xbe98('0x0'));var util=require(_0xbe98('0x1'));var logger=require('../../config/logger')(_0xbe98('0x2'));var moment=require(_0xbe98('0x3'));var BPromise=require(_0xbe98('0x4'));var rp=require(_0xbe98('0x5'));var fs=require('fs');var path=require(_0xbe98('0x6'));var rimraf=require('rimraf');var config=require(_0xbe98('0x7'));var attributes=require(_0xbe98('0x8'));var integrations=require(_0xbe98('0x9'));module[_0xbe98('0xa')]=function(_0x131934,_0x5f0d58){return _0x131934['define'](_0xbe98('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 06070a4..3c32c7b 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 _0xf4b6=['raw','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','GetZendeskAccount','ZendeskAccount','options','where','attributes','limit','include','map','model','ShowZendeskAccount'];(function(_0x47ffd8,_0xa610e8){var _0x2e4c7f=function(_0x4a25af){while(--_0x4a25af){_0x47ffd8['push'](_0x47ffd8['shift']());}};_0x2e4c7f(++_0xa610e8);}(_0xf4b6,0x85));var _0x6f4b=function(_0x509b10,_0x2058ac){_0x509b10=_0x509b10-0x0;var _0x38cf01=_0xf4b6[_0x509b10];return _0x38cf01;};'use strict';var _=require('lodash');var util=require(_0x6f4b('0x0'));var moment=require(_0x6f4b('0x1'));var BPromise=require('bluebird');var rs=require(_0x6f4b('0x2'));var fs=require('fs');var Redis=require(_0x6f4b('0x3'));var db=require(_0x6f4b('0x4'))['db'];var utils=require(_0x6f4b('0x5'));var logger=require(_0x6f4b('0x6'))('rpc');var config=require(_0x6f4b('0x7'));var jayson=require(_0x6f4b('0x8'));var client=jayson[_0x6f4b('0x9')][_0x6f4b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2b6061,_0x22e83b,_0xc84edc){return new BPromise(function(_0x464f59,_0x478123){return client['request'](_0x2b6061,_0xc84edc)[_0x6f4b('0xb')](function(_0x27e429){logger['info'](_0x6f4b('0xc'),_0x22e83b,_0x6f4b('0xd'));logger[_0x6f4b('0xe')]('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x22e83b,_0x6f4b('0xd'),JSON[_0x6f4b('0xf')](_0x27e429));if(_0x27e429['error']){if(_0x27e429[_0x6f4b('0x10')][_0x6f4b('0x11')]===0x1f4){logger[_0x6f4b('0x10')](_0x6f4b('0xc'),_0x22e83b,_0x27e429[_0x6f4b('0x10')][_0x6f4b('0x12')]);return _0x478123(_0x27e429[_0x6f4b('0x10')]['message']);}logger[_0x6f4b('0x10')](_0x6f4b('0xc'),_0x22e83b,_0x27e429[_0x6f4b('0x10')]['message']);return _0x464f59(_0x27e429['error'][_0x6f4b('0x12')]);}else{logger[_0x6f4b('0x13')](_0x6f4b('0xc'),_0x22e83b,_0x6f4b('0xd'));_0x464f59(_0x27e429[_0x6f4b('0x14')][_0x6f4b('0x12')]);}})[_0x6f4b('0x15')](function(_0x26b4f0){logger['error'](_0x6f4b('0xc'),_0x22e83b,_0x26b4f0);_0x478123(_0x26b4f0);});});}exports[_0x6f4b('0x16')]=function(_0x444ea4){var _0xaf3000=this;return new Promise(function(_0x5e6ed3,_0x56bf4a){return db[_0x6f4b('0x17')]['findAll']({'raw':_0x444ea4[_0x6f4b('0x18')]?_0x444ea4['options']['raw']===undefined?!![]:![]:!![],'where':_0x444ea4['options']?_0x444ea4[_0x6f4b('0x18')][_0x6f4b('0x19')]||null:null,'attributes':_0x444ea4[_0x6f4b('0x18')]?_0x444ea4[_0x6f4b('0x18')][_0x6f4b('0x1a')]||null:null,'limit':_0x444ea4[_0x6f4b('0x18')]?_0x444ea4[_0x6f4b('0x18')][_0x6f4b('0x1b')]||null:null,'include':_0x444ea4[_0x6f4b('0x18')]?_0x444ea4[_0x6f4b('0x18')][_0x6f4b('0x1c')]?_[_0x6f4b('0x1d')](_0x444ea4[_0x6f4b('0x18')]['include'],function(_0x1f9717){return{'model':db[_0x1f9717['model']],'as':_0x1f9717['as'],'attributes':_0x1f9717['attributes'],'include':_0x1f9717[_0x6f4b('0x1c')]?_[_0x6f4b('0x1d')](_0x1f9717[_0x6f4b('0x1c')],function(_0x38d413){return{'model':db[_0x38d413[_0x6f4b('0x1e')]],'as':_0x38d413['as'],'attributes':_0x38d413[_0x6f4b('0x1a')],'include':_0x38d413[_0x6f4b('0x1c')]?_['map'](_0x38d413[_0x6f4b('0x1c')],function(_0x545c77){return{'model':db[_0x545c77[_0x6f4b('0x1e')]],'as':_0x545c77['as'],'attributes':_0x545c77['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x26bbf1){logger[_0x6f4b('0x13')]('GetZendeskAccount',_0x444ea4);logger['debug'](_0x6f4b('0x16'),_0x444ea4,JSON[_0x6f4b('0xf')](_0x26bbf1));_0x5e6ed3(_0x26bbf1);})[_0x6f4b('0x15')](function(_0x50117f){logger[_0x6f4b('0x10')](_0x6f4b('0x16'),_0x50117f[_0x6f4b('0x12')],_0x444ea4);_0x56bf4a(_0xaf3000[_0x6f4b('0x10')](0x1f4,_0x50117f[_0x6f4b('0x12')]));});});};exports[_0x6f4b('0x1f')]=function(_0x5094af){var _0x35bd04=this;return new Promise(function(_0x34310d,_0x1321a8){return db['ZendeskAccount']['find']({'raw':_0x5094af['options']?_0x5094af[_0x6f4b('0x18')][_0x6f4b('0x20')]===undefined?!![]:![]:!![],'where':_0x5094af['options']?_0x5094af['options'][_0x6f4b('0x19')]||null:null,'attributes':_0x5094af[_0x6f4b('0x18')]?_0x5094af[_0x6f4b('0x18')][_0x6f4b('0x1a')]||null:null,'include':_0x5094af[_0x6f4b('0x18')]?_0x5094af['options'][_0x6f4b('0x1c')]?_[_0x6f4b('0x1d')](_0x5094af[_0x6f4b('0x18')][_0x6f4b('0x1c')],function(_0x3dbc8b){return{'model':db[_0x3dbc8b[_0x6f4b('0x1e')]],'as':_0x3dbc8b['as'],'attributes':_0x3dbc8b['attributes'],'include':_0x3dbc8b[_0x6f4b('0x1c')]?_['map'](_0x3dbc8b[_0x6f4b('0x1c')],function(_0x2b3c0a){return{'model':db[_0x2b3c0a[_0x6f4b('0x1e')]],'as':_0x2b3c0a['as'],'attributes':_0x2b3c0a['attributes'],'include':_0x2b3c0a[_0x6f4b('0x1c')]?_[_0x6f4b('0x1d')](_0x2b3c0a[_0x6f4b('0x1c')],function(_0x1cdd9f){return{'model':db[_0x1cdd9f[_0x6f4b('0x1e')]],'as':_0x1cdd9f['as'],'attributes':_0x1cdd9f[_0x6f4b('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x6f4b('0xb')](function(_0x2dd32e){logger['info']('ShowZendeskAccount',_0x5094af);logger[_0x6f4b('0xe')](_0x6f4b('0x1f'),_0x5094af,JSON[_0x6f4b('0xf')](_0x2dd32e));_0x34310d(_0x2dd32e);})['catch'](function(_0x5b72be){logger[_0x6f4b('0x10')](_0x6f4b('0x1f'),_0x5b72be[_0x6f4b('0x12')],_0x5094af);_0x1321a8(_0x35bd04['error'](0x1f4,_0x5b72be[_0x6f4b('0x12')]));});});}; \ No newline at end of file +var _0x76cc=['ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetZendeskAccount','ZendeskAccount','options','raw','attributes','include','map','model','catch','ShowZendeskAccount','find','where','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x482b83,_0x270c4e){var _0x2f51ab=function(_0x16e756){while(--_0x16e756){_0x482b83['push'](_0x482b83['shift']());}};_0x2f51ab(++_0x270c4e);}(_0x76cc,0x7e));var _0xc76c=function(_0x1576a6,_0x32e5e0){_0x1576a6=_0x1576a6-0x0;var _0x43d079=_0x76cc[_0x1576a6];return _0x43d079;};'use strict';var _=require(_0xc76c('0x0'));var util=require(_0xc76c('0x1'));var moment=require('moment');var BPromise=require(_0xc76c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc76c('0x3'));var db=require(_0xc76c('0x4'))['db'];var utils=require(_0xc76c('0x5'));var logger=require(_0xc76c('0x6'))(_0xc76c('0x7'));var config=require(_0xc76c('0x8'));var jayson=require(_0xc76c('0x9'));var client=jayson[_0xc76c('0xa')][_0xc76c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1e7674,_0x583e5c,_0x237a46){return new BPromise(function(_0x43cc4e,_0xbc9cde){return client[_0xc76c('0xc')](_0x1e7674,_0x237a46)[_0xc76c('0xd')](function(_0x48c706){logger[_0xc76c('0xe')](_0xc76c('0xf'),_0x583e5c,_0xc76c('0x10'));logger[_0xc76c('0x11')](_0xc76c('0x12'),_0x583e5c,_0xc76c('0x10'),JSON[_0xc76c('0x13')](_0x48c706));if(_0x48c706[_0xc76c('0x14')]){if(_0x48c706['error'][_0xc76c('0x15')]===0x1f4){logger[_0xc76c('0x14')](_0xc76c('0xf'),_0x583e5c,_0x48c706['error'][_0xc76c('0x16')]);return _0xbc9cde(_0x48c706[_0xc76c('0x14')][_0xc76c('0x16')]);}logger[_0xc76c('0x14')](_0xc76c('0xf'),_0x583e5c,_0x48c706[_0xc76c('0x14')][_0xc76c('0x16')]);return _0x43cc4e(_0x48c706[_0xc76c('0x14')][_0xc76c('0x16')]);}else{logger[_0xc76c('0xe')]('ZendeskAccount,\x20%s,\x20%s',_0x583e5c,_0xc76c('0x10'));_0x43cc4e(_0x48c706[_0xc76c('0x17')][_0xc76c('0x16')]);}})['catch'](function(_0x5e7c2e){logger[_0xc76c('0x14')]('ZendeskAccount,\x20%s,\x20%s',_0x583e5c,_0x5e7c2e);_0xbc9cde(_0x5e7c2e);});});}exports[_0xc76c('0x18')]=function(_0x535c0f){var _0x5e7473=this;return new Promise(function(_0x18f159,_0xf851ac){return db[_0xc76c('0x19')]['findAll']({'raw':_0x535c0f[_0xc76c('0x1a')]?_0x535c0f['options'][_0xc76c('0x1b')]===undefined?!![]:![]:!![],'where':_0x535c0f[_0xc76c('0x1a')]?_0x535c0f[_0xc76c('0x1a')]['where']||null:null,'attributes':_0x535c0f[_0xc76c('0x1a')]?_0x535c0f['options'][_0xc76c('0x1c')]||null:null,'limit':_0x535c0f[_0xc76c('0x1a')]?_0x535c0f[_0xc76c('0x1a')]['limit']||null:null,'include':_0x535c0f['options']?_0x535c0f[_0xc76c('0x1a')][_0xc76c('0x1d')]?_[_0xc76c('0x1e')](_0x535c0f[_0xc76c('0x1a')][_0xc76c('0x1d')],function(_0x52cd9b){return{'model':db[_0x52cd9b[_0xc76c('0x1f')]],'as':_0x52cd9b['as'],'attributes':_0x52cd9b['attributes'],'include':_0x52cd9b[_0xc76c('0x1d')]?_[_0xc76c('0x1e')](_0x52cd9b['include'],function(_0x3772d4){return{'model':db[_0x3772d4['model']],'as':_0x3772d4['as'],'attributes':_0x3772d4[_0xc76c('0x1c')],'include':_0x3772d4[_0xc76c('0x1d')]?_['map'](_0x3772d4[_0xc76c('0x1d')],function(_0x5bf463){return{'model':db[_0x5bf463[_0xc76c('0x1f')]],'as':_0x5bf463['as'],'attributes':_0x5bf463['attributes']};}):[]};}):[]};}):[]:[]})[_0xc76c('0xd')](function(_0x407d8a){logger[_0xc76c('0xe')](_0xc76c('0x18'),_0x535c0f);logger[_0xc76c('0x11')](_0xc76c('0x18'),_0x535c0f,JSON['stringify'](_0x407d8a));_0x18f159(_0x407d8a);})[_0xc76c('0x20')](function(_0x36bbe3){logger[_0xc76c('0x14')]('GetZendeskAccount',_0x36bbe3[_0xc76c('0x16')],_0x535c0f);_0xf851ac(_0x5e7473[_0xc76c('0x14')](0x1f4,_0x36bbe3[_0xc76c('0x16')]));});});};exports[_0xc76c('0x21')]=function(_0x1a9672){var _0x1a74cf=this;return new Promise(function(_0x499627,_0x1716af){return db['ZendeskAccount'][_0xc76c('0x22')]({'raw':_0x1a9672[_0xc76c('0x1a')]?_0x1a9672[_0xc76c('0x1a')][_0xc76c('0x1b')]===undefined?!![]:![]:!![],'where':_0x1a9672[_0xc76c('0x1a')]?_0x1a9672[_0xc76c('0x1a')][_0xc76c('0x23')]||null:null,'attributes':_0x1a9672[_0xc76c('0x1a')]?_0x1a9672['options'][_0xc76c('0x1c')]||null:null,'include':_0x1a9672['options']?_0x1a9672['options'][_0xc76c('0x1d')]?_[_0xc76c('0x1e')](_0x1a9672[_0xc76c('0x1a')][_0xc76c('0x1d')],function(_0x4aa0ca){return{'model':db[_0x4aa0ca[_0xc76c('0x1f')]],'as':_0x4aa0ca['as'],'attributes':_0x4aa0ca[_0xc76c('0x1c')],'include':_0x4aa0ca[_0xc76c('0x1d')]?_[_0xc76c('0x1e')](_0x4aa0ca['include'],function(_0x2ba595){return{'model':db[_0x2ba595['model']],'as':_0x2ba595['as'],'attributes':_0x2ba595[_0xc76c('0x1c')],'include':_0x2ba595[_0xc76c('0x1d')]?_['map'](_0x2ba595['include'],function(_0x45203e){return{'model':db[_0x45203e[_0xc76c('0x1f')]],'as':_0x45203e['as'],'attributes':_0x45203e[_0xc76c('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x7b6842){logger[_0xc76c('0xe')](_0xc76c('0x21'),_0x1a9672);logger[_0xc76c('0x11')](_0xc76c('0x21'),_0x1a9672,JSON[_0xc76c('0x13')](_0x7b6842));_0x499627(_0x7b6842);})[_0xc76c('0x20')](function(_0x46f8fe){logger[_0xc76c('0x14')]('ShowZendeskAccount',_0x46f8fe[_0xc76c('0x16')],_0x1a9672);_0x1716af(_0x1a74cf[_0xc76c('0x14')](0x1f4,_0x46f8fe[_0xc76c('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 68aa9e2..19b3d3f 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 _0x0bb5=['put','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','/:id','isAuthenticated','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','create','post','setTags'];(function(_0x28806e,_0x5ee1ff){var _0x21362f=function(_0x4adbcc){while(--_0x4adbcc){_0x28806e['push'](_0x28806e['shift']());}};_0x21362f(++_0x5ee1ff);}(_0x0bb5,0x148));var _0x50bb=function(_0x46c648,_0x597f1c){_0x46c648=_0x46c648-0x0;var _0x12bbb0=_0x0bb5[_0x46c648];return _0x12bbb0;};'use strict';var multer=require(_0x50bb('0x0'));var util=require(_0x50bb('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x50bb('0x2'));var router=express[_0x50bb('0x3')]();var fs_extra=require(_0x50bb('0x4'));var auth=require(_0x50bb('0x5'));var interaction=require(_0x50bb('0x6'));var config=require(_0x50bb('0x7'));var controller=require(_0x50bb('0x8'));router[_0x50bb('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x50bb('0x9')](_0x50bb('0xa'),auth[_0x50bb('0xb')](),controller[_0x50bb('0xc')]);router['get']('/:id/fields',auth[_0x50bb('0xb')](),controller[_0x50bb('0xd')]);router[_0x50bb('0x9')](_0x50bb('0xe'),auth['isAuthenticated'](),controller[_0x50bb('0xf')]);router[_0x50bb('0x9')](_0x50bb('0x10'),auth[_0x50bb('0xb')](),controller[_0x50bb('0x11')]);router[_0x50bb('0x9')](_0x50bb('0x12'),auth['isAuthenticated'](),controller[_0x50bb('0x13')]);router['post']('/',auth[_0x50bb('0xb')](),controller[_0x50bb('0x14')]);router[_0x50bb('0x15')]('/:id/tags',auth[_0x50bb('0xb')](),controller[_0x50bb('0x16')]);router[_0x50bb('0x17')]('/:id',auth[_0x50bb('0xb')](),controller['update']);router[_0x50bb('0x18')](_0x50bb('0xa'),auth[_0x50bb('0xb')](),controller[_0x50bb('0x19')]);module[_0x50bb('0x1a')]=router; \ No newline at end of file +var _0xbaf0=['isAuthenticated','index','/:id','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','getTags','post','create','/:id/tags','setTags','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get'];(function(_0x399934,_0x21f972){var _0x4bb027=function(_0x2f5cff){while(--_0x2f5cff){_0x399934['push'](_0x399934['shift']());}};_0x4bb027(++_0x21f972);}(_0xbaf0,0x12a));var _0x0baf=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xbaf0[_0x14add3];return _0x4a174f;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['show']);router[_0x0baf('0x9')]('/:id/fields',auth[_0x0baf('0xa')](),controller[_0x0baf('0xd')]);router[_0x0baf('0x9')](_0x0baf('0xe'),auth[_0x0baf('0xa')](),controller[_0x0baf('0xf')]);router[_0x0baf('0x9')](_0x0baf('0x10'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x11')]);router[_0x0baf('0x9')]('/:id/tags',auth['isAuthenticated'](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0x14')]);router['post'](_0x0baf('0x15'),auth['isAuthenticated'](),controller[_0x0baf('0x16')]);router[_0x0baf('0x17')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x18')]);router[_0x0baf('0x19')]('/:id',auth['isAuthenticated'](),controller[_0x0baf('0x1a')]);module[_0x0baf('0x1b')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 29ba455..2789f54 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 _0xbab8=['exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbab8,0x154));var _0x8bab=function(_0x5b1394,_0x17f08d){_0x5b1394=_0x5b1394-0x0;var _0x483150=_0xbab8[_0x5b1394];return _0x483150;};'use strict';var Sequelize=require('sequelize');module[_0x8bab('0x0')]={'name':{'type':Sequelize[_0x8bab('0x1')]},'description':{'type':Sequelize[_0x8bab('0x1')]}}; \ No newline at end of file +var _0x68d2=['sequelize','exports','STRING'];(function(_0x3a6523,_0x520593){var _0x2614bb=function(_0x50e583){while(--_0x50e583){_0x3a6523['push'](_0x3a6523['shift']());}};_0x2614bb(++_0x520593);}(_0x68d2,0xab));var _0x268d=function(_0x1aa402,_0x5761f5){_0x1aa402=_0x1aa402-0x0;var _0xd31b9e=_0x68d2[_0x1aa402];return _0xd31b9e;};'use strict';var Sequelize=require(_0x268d('0x0'));module[_0x268d('0x1')]={'name':{'type':Sequelize[_0x268d('0x2')]},'description':{'type':Sequelize[_0x268d('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index e4429fe..be84eb2 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 _0x30ea=['include','catch','create','body','find','params','ZendeskField','order','pick','merge','getFields','getSubjects','findOne','nolimit','getDescriptions','getTags','setTags','rimraf','zip-dir','moment','util','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','reject','save','then','destroy','sendStatus','stack','name','send','map','ZendeskConfiguration','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','length','attributes','hasOwnProperty','sort','where','filter','VIRTUAL','options','show','includeAll'];(function(_0xa8090b,_0x3f0cdd){var _0x30dd72=function(_0x13534c){while(--_0x13534c){_0xa8090b['push'](_0xa8090b['shift']());}};_0x30dd72(++_0x3f0cdd);}(_0x30ea,0x188));var _0xa30e=function(_0x5d4a34,_0x22e791){_0x5d4a34=_0x5d4a34-0x0;var _0x45279b=_0x30ea[_0x5d4a34];return _0x45279b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa30e('0x0'));var zipdir=require(_0xa30e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa30e('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa30e('0x3'));var path=require('path');var sox=require('sox');var csv=require(_0xa30e('0x4'));var ejs=require(_0xa30e('0x5'));var fs=require('fs');var fs_extra=require(_0xa30e('0x6'));var _=require('lodash');var squel=require(_0xa30e('0x7'));var crypto=require('crypto');var jsforce=require(_0xa30e('0x8'));var deskjs=require(_0xa30e('0x9'));var toCsv=require(_0xa30e('0x4'));var querystring=require(_0xa30e('0xa'));var Papa=require(_0xa30e('0xb'));var Redis=require(_0xa30e('0xc'));var authService=require(_0xa30e('0xd'));var qs=require(_0xa30e('0xe'));var as=require(_0xa30e('0xf'));var hardwareService=require(_0xa30e('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0xa30e('0x11'));var config=require(_0xa30e('0x12'));var licenseUtil=require(_0xa30e('0x13'));var db=require(_0xa30e('0x14'))['db'];function respondWithStatusCode(_0x2087db,_0x2af378){_0x2af378=_0x2af378||0xcc;return function(_0x56c9b7){if(_0x56c9b7){return _0x2087db['sendStatus'](_0x2af378);}return _0x2087db[_0xa30e('0x15')](_0x2af378)[_0xa30e('0x16')]();};}function respondWithResult(_0x17c24c,_0xa56699){_0xa56699=_0xa56699||0xc8;return function(_0x338bf9){if(_0x338bf9){return _0x17c24c[_0xa30e('0x15')](_0xa56699)[_0xa30e('0x17')](_0x338bf9);}};}function respondWithFilteredResult(_0x17b99b,_0x30eff5){return function(_0x1dfd22){if(_0x1dfd22){var _0x13b4c3=typeof _0x30eff5[_0xa30e('0x18')]===_0xa30e('0x19')&&typeof _0x30eff5['limit']===_0xa30e('0x19');var _0x5ac607=_0x1dfd22[_0xa30e('0x1a')];var _0x573e14=_0x13b4c3?0x0:_0x30eff5[_0xa30e('0x18')];var _0x3e78fb=_0x13b4c3?_0x1dfd22[_0xa30e('0x1a')]:_0x30eff5[_0xa30e('0x18')]+_0x30eff5[_0xa30e('0x1b')];var _0x3cc93d;if(_0x3e78fb>=_0x5ac607){_0x3e78fb=_0x5ac607;_0x3cc93d=0xc8;}else{_0x3cc93d=0xce;}_0x17b99b['status'](_0x3cc93d);return _0x17b99b['set']('Content-Range',_0x573e14+'-'+_0x3e78fb+'/'+_0x5ac607)[_0xa30e('0x17')](_0x1dfd22);}return null;};}function patchUpdates(_0x2b8df4){return function(_0x1b2f25){try{jsonpatch['apply'](_0x1b2f25,_0x2b8df4,!![]);}catch(_0x46f68d){return BPromise[_0xa30e('0x1c')](_0x46f68d);}return _0x1b2f25[_0xa30e('0x1d')]();};}function saveUpdates(_0x5f319a,_0x59ed14){return function(_0x278696){if(_0x278696){return _0x278696['update'](_0x5f319a)[_0xa30e('0x1e')](function(_0x4c3a04){return _0x4c3a04;});}return null;};}function removeEntity(_0xff5f0a,_0x5dca94){return function(_0x4eddc0){if(_0x4eddc0){return _0x4eddc0[_0xa30e('0x1f')]()[_0xa30e('0x1e')](function(){_0xff5f0a[_0xa30e('0x15')](0xcc)[_0xa30e('0x16')]();});}};}function handleEntityNotFound(_0x1d0df8,_0x13fece){return function(_0x4fe0b6){if(!_0x4fe0b6){_0x1d0df8[_0xa30e('0x20')](0x194);}return _0x4fe0b6;};}function handleError(_0x4ac00a,_0x2e142d){_0x2e142d=_0x2e142d||0x1f4;return function(_0x244782){logger['error'](_0x244782[_0xa30e('0x21')]);if(_0x244782['name']){delete _0x244782[_0xa30e('0x22')];}_0x4ac00a[_0xa30e('0x15')](_0x2e142d)[_0xa30e('0x23')](_0x244782);};}exports['index']=function(_0x463826,_0x40025e){var _0x115d95={},_0x1f64af={},_0x1e800b={'count':0x0,'rows':[]};var _0x3ea3ba=_[_0xa30e('0x24')](db[_0xa30e('0x25')][_0xa30e('0x26')],function(_0x4d944a){return{'name':_0x4d944a[_0xa30e('0x27')],'type':_0x4d944a[_0xa30e('0x28')][_0xa30e('0x29')]};});_0x1f64af[_0xa30e('0x2a')]=_[_0xa30e('0x24')](_0x3ea3ba,_0xa30e('0x22'));_0x1f64af['query']=_[_0xa30e('0x2b')](_0x463826[_0xa30e('0x2c')]);_0x1f64af[_0xa30e('0x2d')]=_['intersection'](_0x1f64af[_0xa30e('0x2a')],_0x1f64af['query']);_0x115d95['attributes']=_[_0xa30e('0x2e')](_0x1f64af['model'],qs['fields'](_0x463826['query'][_0xa30e('0x2f')]));_0x115d95['attributes']=_0x115d95['attributes'][_0xa30e('0x30')]?_0x115d95[_0xa30e('0x31')]:_0x1f64af[_0xa30e('0x2a')];if(!_0x463826[_0xa30e('0x2c')][_0xa30e('0x32')]('nolimit')){_0x115d95[_0xa30e('0x1b')]=qs[_0xa30e('0x1b')](_0x463826['query']['limit']);_0x115d95[_0xa30e('0x18')]=qs[_0xa30e('0x18')](_0x463826[_0xa30e('0x2c')]['offset']);}_0x115d95['order']=qs[_0xa30e('0x33')](_0x463826['query'][_0xa30e('0x33')]);_0x115d95[_0xa30e('0x34')]=qs[_0xa30e('0x2d')](_['pick'](_0x463826[_0xa30e('0x2c')],_0x1f64af['filters']),_0x3ea3ba);if(_0x463826['query'][_0xa30e('0x35')]){_0x115d95[_0xa30e('0x34')]=_['merge'](_0x115d95[_0xa30e('0x34')],{'$or':_[_0xa30e('0x24')](_0x3ea3ba,function(_0x77459a){if(_0x77459a[_0xa30e('0x28')]!==_0xa30e('0x36')){var _0x578fd4={};_0x578fd4[_0x77459a[_0xa30e('0x22')]]={'$like':'%'+_0x463826[_0xa30e('0x2c')][_0xa30e('0x35')]+'%'};return _0x578fd4;}})});}_0x115d95=_['merge']({},_0x115d95,_0x463826[_0xa30e('0x37')]);var _0x66fb={'where':_0x115d95[_0xa30e('0x34')]};return db[_0xa30e('0x25')]['count'](_0x66fb)[_0xa30e('0x1e')](function(_0x203072){_0x1e800b['count']=_0x203072;if(_0x463826[_0xa30e('0x2c')]['includeAll']){_0x115d95['include']=[{'all':!![]}];}return db['ZendeskConfiguration']['findAll'](_0x115d95);})[_0xa30e('0x1e')](function(_0x48de91){_0x1e800b['rows']=_0x48de91;return _0x1e800b;})[_0xa30e('0x1e')](respondWithFilteredResult(_0x40025e,_0x115d95))['catch'](handleError(_0x40025e,null));};exports[_0xa30e('0x38')]=function(_0x22be4c,_0x44508f){var _0x520f9a={'raw':![],'where':{'id':_0x22be4c['params']['id']}},_0x3d7a85={};_0x3d7a85[_0xa30e('0x2a')]=_[_0xa30e('0x2b')](db[_0xa30e('0x25')][_0xa30e('0x26')]);_0x3d7a85[_0xa30e('0x2c')]=_[_0xa30e('0x2b')](_0x22be4c[_0xa30e('0x2c')]);_0x3d7a85[_0xa30e('0x2d')]=_[_0xa30e('0x2e')](_0x3d7a85[_0xa30e('0x2a')],_0x3d7a85['query']);_0x520f9a[_0xa30e('0x31')]=_[_0xa30e('0x2e')](_0x3d7a85['model'],qs[_0xa30e('0x2f')](_0x22be4c['query'][_0xa30e('0x2f')]));_0x520f9a[_0xa30e('0x31')]=_0x520f9a[_0xa30e('0x31')]['length']?_0x520f9a['attributes']:_0x3d7a85[_0xa30e('0x2a')];if(_0x22be4c[_0xa30e('0x2c')][_0xa30e('0x39')]){_0x520f9a[_0xa30e('0x3a')]=[{'all':!![]}];}_0x520f9a=_['merge']({},_0x520f9a,_0x22be4c[_0xa30e('0x37')]);return db[_0xa30e('0x25')]['find'](_0x520f9a)[_0xa30e('0x1e')](handleEntityNotFound(_0x44508f,null))['then'](respondWithResult(_0x44508f,null))[_0xa30e('0x3b')](handleError(_0x44508f,null));};exports[_0xa30e('0x3c')]=function(_0x38f690,_0x578549){return db[_0xa30e('0x25')][_0xa30e('0x3c')](_0x38f690[_0xa30e('0x3d')],{})[_0xa30e('0x1e')](respondWithResult(_0x578549,0xc9))[_0xa30e('0x3b')](handleError(_0x578549,null));};exports['update']=function(_0x55d1cb,_0x39fe06){if(_0x55d1cb[_0xa30e('0x3d')]['id']){delete _0x55d1cb[_0xa30e('0x3d')]['id'];}return db[_0xa30e('0x25')][_0xa30e('0x3e')]({'where':{'id':_0x55d1cb[_0xa30e('0x3f')]['id']}})['then'](handleEntityNotFound(_0x39fe06,null))['then'](saveUpdates(_0x55d1cb[_0xa30e('0x3d')],null))[_0xa30e('0x1e')](respondWithResult(_0x39fe06,null))[_0xa30e('0x3b')](handleError(_0x39fe06,null));};exports[_0xa30e('0x1f')]=function(_0x503690,_0x1d1f01){return db['ZendeskConfiguration'][_0xa30e('0x3e')]({'where':{'id':_0x503690[_0xa30e('0x3f')]['id']}})[_0xa30e('0x1e')](handleEntityNotFound(_0x1d1f01,null))['then'](removeEntity(_0x1d1f01,null))[_0xa30e('0x3b')](handleError(_0x1d1f01,null));};exports['getFields']=function(_0x872c9a,_0x58252b,_0x56ef8c){var _0x19337b={};var _0x404940={};var _0x4e5d0b;var _0x2945cc;return db[_0xa30e('0x25')]['findOne']({'where':{'id':_0x872c9a[_0xa30e('0x3f')]['id']}})[_0xa30e('0x1e')](handleEntityNotFound(_0x58252b,null))[_0xa30e('0x1e')](function(_0x2fae6e){if(_0x2fae6e){_0x4e5d0b=_0x2fae6e;_0x404940['model']=_[_0xa30e('0x2b')](db[_0xa30e('0x40')][_0xa30e('0x26')]);_0x404940[_0xa30e('0x2c')]=_[_0xa30e('0x2b')](_0x872c9a[_0xa30e('0x2c')]);_0x404940[_0xa30e('0x2d')]=_['intersection'](_0x404940[_0xa30e('0x2a')],_0x404940['query']);_0x19337b['attributes']=_[_0xa30e('0x2e')](_0x404940[_0xa30e('0x2a')],qs[_0xa30e('0x2f')](_0x872c9a[_0xa30e('0x2c')]['fields']));_0x19337b['attributes']=_0x19337b['attributes'][_0xa30e('0x30')]?_0x19337b['attributes']:_0x404940[_0xa30e('0x2a')];_0x19337b[_0xa30e('0x41')]=qs[_0xa30e('0x33')](_0x872c9a[_0xa30e('0x2c')][_0xa30e('0x33')]);_0x19337b[_0xa30e('0x34')]=qs[_0xa30e('0x2d')](_[_0xa30e('0x42')](_0x872c9a['query'],_0x404940[_0xa30e('0x2d')]));if(_0x872c9a[_0xa30e('0x2c')][_0xa30e('0x35')]){_0x19337b[_0xa30e('0x34')]=_[_0xa30e('0x43')](_0x19337b['where'],{'$or':_[_0xa30e('0x24')](_0x19337b['attributes'],function(_0x286947){var _0x5026b9={};_0x5026b9[_0x286947]={'$like':'%'+_0x872c9a[_0xa30e('0x2c')][_0xa30e('0x35')]+'%'};return _0x5026b9;})});}_0x19337b=_['merge']({},_0x19337b,_0x872c9a[_0xa30e('0x37')]);return _0x4e5d0b[_0xa30e('0x44')](_0x19337b);}})[_0xa30e('0x1e')](function(_0x331435){if(_0x331435){_0x2945cc=_0x331435[_0xa30e('0x30')];if(!_0x872c9a['query'][_0xa30e('0x32')]('nolimit')){_0x19337b[_0xa30e('0x1b')]=qs[_0xa30e('0x1b')](_0x872c9a['query'][_0xa30e('0x1b')]);_0x19337b[_0xa30e('0x18')]=qs[_0xa30e('0x18')](_0x872c9a[_0xa30e('0x2c')][_0xa30e('0x18')]);}return _0x4e5d0b[_0xa30e('0x44')](_0x19337b);}})[_0xa30e('0x1e')](function(_0x5940be){if(_0x5940be){return _0x5940be?{'count':_0x2945cc,'rows':_0x5940be}:null;}})[_0xa30e('0x1e')](respondWithResult(_0x58252b,null))[_0xa30e('0x3b')](handleError(_0x58252b,null));};exports[_0xa30e('0x45')]=function(_0xa4986d,_0x55be73,_0x165b30){var _0x25ded9={};var _0x5345a3={};var _0x4ef4ec;var _0x47ce90;return db[_0xa30e('0x25')][_0xa30e('0x46')]({'where':{'id':_0xa4986d[_0xa30e('0x3f')]['id']}})[_0xa30e('0x1e')](handleEntityNotFound(_0x55be73,null))[_0xa30e('0x1e')](function(_0x1a0c6b){if(_0x1a0c6b){_0x4ef4ec=_0x1a0c6b;_0x5345a3['model']=_[_0xa30e('0x2b')](db['ZendeskField']['rawAttributes']);_0x5345a3[_0xa30e('0x2c')]=_[_0xa30e('0x2b')](_0xa4986d[_0xa30e('0x2c')]);_0x5345a3[_0xa30e('0x2d')]=_[_0xa30e('0x2e')](_0x5345a3[_0xa30e('0x2a')],_0x5345a3['query']);_0x25ded9[_0xa30e('0x31')]=_[_0xa30e('0x2e')](_0x5345a3[_0xa30e('0x2a')],qs[_0xa30e('0x2f')](_0xa4986d[_0xa30e('0x2c')][_0xa30e('0x2f')]));_0x25ded9[_0xa30e('0x31')]=_0x25ded9[_0xa30e('0x31')][_0xa30e('0x30')]?_0x25ded9[_0xa30e('0x31')]:_0x5345a3[_0xa30e('0x2a')];_0x25ded9[_0xa30e('0x41')]=qs[_0xa30e('0x33')](_0xa4986d['query'][_0xa30e('0x33')]);_0x25ded9['where']=qs[_0xa30e('0x2d')](_[_0xa30e('0x42')](_0xa4986d[_0xa30e('0x2c')],_0x5345a3[_0xa30e('0x2d')]));if(_0xa4986d[_0xa30e('0x2c')][_0xa30e('0x35')]){_0x25ded9['where']=_[_0xa30e('0x43')](_0x25ded9[_0xa30e('0x34')],{'$or':_[_0xa30e('0x24')](_0x25ded9[_0xa30e('0x31')],function(_0x1ec0c6){var _0x4045ed={};_0x4045ed[_0x1ec0c6]={'$like':'%'+_0xa4986d[_0xa30e('0x2c')][_0xa30e('0x35')]+'%'};return _0x4045ed;})});}_0x25ded9=_[_0xa30e('0x43')]({},_0x25ded9,_0xa4986d[_0xa30e('0x37')]);return _0x4ef4ec[_0xa30e('0x45')](_0x25ded9);}})[_0xa30e('0x1e')](function(_0x2261be){if(_0x2261be){_0x47ce90=_0x2261be['length'];if(!_0xa4986d[_0xa30e('0x2c')][_0xa30e('0x32')](_0xa30e('0x47'))){_0x25ded9[_0xa30e('0x1b')]=qs[_0xa30e('0x1b')](_0xa4986d[_0xa30e('0x2c')][_0xa30e('0x1b')]);_0x25ded9[_0xa30e('0x18')]=qs[_0xa30e('0x18')](_0xa4986d['query'][_0xa30e('0x18')]);}return _0x4ef4ec[_0xa30e('0x45')](_0x25ded9);}})['then'](function(_0x1075a2){if(_0x1075a2){return _0x1075a2?{'count':_0x47ce90,'rows':_0x1075a2}:null;}})[_0xa30e('0x1e')](respondWithResult(_0x55be73,null))[_0xa30e('0x3b')](handleError(_0x55be73,null));};exports[_0xa30e('0x48')]=function(_0xf4b7d5,_0x388307,_0x34d054){var _0x33918c={};var _0x1c4786={};var _0x42f9b5;var _0x3082ed;return db[_0xa30e('0x25')]['findOne']({'where':{'id':_0xf4b7d5['params']['id']}})['then'](handleEntityNotFound(_0x388307,null))[_0xa30e('0x1e')](function(_0x50f792){if(_0x50f792){_0x42f9b5=_0x50f792;_0x1c4786['model']=_[_0xa30e('0x2b')](db[_0xa30e('0x40')][_0xa30e('0x26')]);_0x1c4786[_0xa30e('0x2c')]=_['keys'](_0xf4b7d5[_0xa30e('0x2c')]);_0x1c4786['filters']=_[_0xa30e('0x2e')](_0x1c4786[_0xa30e('0x2a')],_0x1c4786['query']);_0x33918c[_0xa30e('0x31')]=_[_0xa30e('0x2e')](_0x1c4786[_0xa30e('0x2a')],qs[_0xa30e('0x2f')](_0xf4b7d5[_0xa30e('0x2c')]['fields']));_0x33918c[_0xa30e('0x31')]=_0x33918c['attributes'][_0xa30e('0x30')]?_0x33918c[_0xa30e('0x31')]:_0x1c4786[_0xa30e('0x2a')];_0x33918c[_0xa30e('0x41')]=qs[_0xa30e('0x33')](_0xf4b7d5[_0xa30e('0x2c')][_0xa30e('0x33')]);_0x33918c[_0xa30e('0x34')]=qs[_0xa30e('0x2d')](_[_0xa30e('0x42')](_0xf4b7d5['query'],_0x1c4786['filters']));if(_0xf4b7d5[_0xa30e('0x2c')][_0xa30e('0x35')]){_0x33918c['where']=_[_0xa30e('0x43')](_0x33918c[_0xa30e('0x34')],{'$or':_[_0xa30e('0x24')](_0x33918c[_0xa30e('0x31')],function(_0x36f17b){var _0x155a2e={};_0x155a2e[_0x36f17b]={'$like':'%'+_0xf4b7d5[_0xa30e('0x2c')][_0xa30e('0x35')]+'%'};return _0x155a2e;})});}_0x33918c=_[_0xa30e('0x43')]({},_0x33918c,_0xf4b7d5[_0xa30e('0x37')]);return _0x42f9b5['getDescriptions'](_0x33918c);}})[_0xa30e('0x1e')](function(_0x1aca13){if(_0x1aca13){_0x3082ed=_0x1aca13[_0xa30e('0x30')];if(!_0xf4b7d5[_0xa30e('0x2c')][_0xa30e('0x32')](_0xa30e('0x47'))){_0x33918c['limit']=qs['limit'](_0xf4b7d5[_0xa30e('0x2c')][_0xa30e('0x1b')]);_0x33918c[_0xa30e('0x18')]=qs[_0xa30e('0x18')](_0xf4b7d5['query'][_0xa30e('0x18')]);}return _0x42f9b5['getDescriptions'](_0x33918c);}})[_0xa30e('0x1e')](function(_0x1fcd8c){if(_0x1fcd8c){return _0x1fcd8c?{'count':_0x3082ed,'rows':_0x1fcd8c}:null;}})['then'](respondWithResult(_0x388307,null))[_0xa30e('0x3b')](handleError(_0x388307,null));};exports[_0xa30e('0x49')]=function(_0x603545,_0x32a460,_0x294325){var _0x9cea2={};var _0x38200e={};var _0x30d5ce;var _0x5cd577;return db['ZendeskConfiguration'][_0xa30e('0x46')]({'where':{'id':_0x603545[_0xa30e('0x3f')]['id']}})[_0xa30e('0x1e')](handleEntityNotFound(_0x32a460,null))[_0xa30e('0x1e')](function(_0x20bf3c){if(_0x20bf3c){_0x30d5ce=_0x20bf3c;_0x38200e[_0xa30e('0x2a')]=_[_0xa30e('0x2b')](db['Tag'][_0xa30e('0x26')]);_0x38200e[_0xa30e('0x2c')]=_[_0xa30e('0x2b')](_0x603545['query']);_0x38200e[_0xa30e('0x2d')]=_[_0xa30e('0x2e')](_0x38200e[_0xa30e('0x2a')],_0x38200e[_0xa30e('0x2c')]);_0x9cea2['attributes']=_[_0xa30e('0x2e')](_0x38200e[_0xa30e('0x2a')],qs['fields'](_0x603545['query'][_0xa30e('0x2f')]));_0x9cea2[_0xa30e('0x31')]=_0x9cea2[_0xa30e('0x31')][_0xa30e('0x30')]?_0x9cea2[_0xa30e('0x31')]:_0x38200e[_0xa30e('0x2a')];_0x9cea2[_0xa30e('0x41')]=qs[_0xa30e('0x33')](_0x603545[_0xa30e('0x2c')][_0xa30e('0x33')]);_0x9cea2[_0xa30e('0x34')]=qs[_0xa30e('0x2d')](_[_0xa30e('0x42')](_0x603545['query'],_0x38200e['filters']));if(_0x603545[_0xa30e('0x2c')][_0xa30e('0x35')]){_0x9cea2[_0xa30e('0x34')]=_[_0xa30e('0x43')](_0x9cea2[_0xa30e('0x34')],{'$or':_['map'](_0x9cea2[_0xa30e('0x31')],function(_0xc136c3){var _0x5855ea={};_0x5855ea[_0xc136c3]={'$like':'%'+_0x603545['query'][_0xa30e('0x35')]+'%'};return _0x5855ea;})});}_0x9cea2=_['merge']({},_0x9cea2,_0x603545[_0xa30e('0x37')]);return _0x30d5ce[_0xa30e('0x49')](_0x9cea2);}})[_0xa30e('0x1e')](function(_0x4f9e7b){if(_0x4f9e7b){_0x5cd577=_0x4f9e7b[_0xa30e('0x30')];if(!_0x603545[_0xa30e('0x2c')]['hasOwnProperty']('nolimit')){_0x9cea2[_0xa30e('0x1b')]=qs['limit'](_0x603545[_0xa30e('0x2c')]['limit']);_0x9cea2[_0xa30e('0x18')]=qs[_0xa30e('0x18')](_0x603545[_0xa30e('0x2c')][_0xa30e('0x18')]);}return _0x30d5ce['getTags'](_0x9cea2);}})[_0xa30e('0x1e')](function(_0x4b6c2c){if(_0x4b6c2c){return _0x4b6c2c?{'count':_0x5cd577,'rows':_0x4b6c2c}:null;}})['then'](respondWithResult(_0x32a460,null))[_0xa30e('0x3b')](handleError(_0x32a460,null));};exports['setTags']=function(_0x2265f2,_0x1c333c,_0xf5a344){if(_0x2265f2[_0xa30e('0x3d')]['id']){delete _0x2265f2[_0xa30e('0x3d')]['id'];}return db[_0xa30e('0x25')][_0xa30e('0x46')]({'where':{'id':_0x2265f2[_0xa30e('0x3f')]['id']}})[_0xa30e('0x1e')](handleEntityNotFound(_0x1c333c,null))[_0xa30e('0x1e')](function(_0x44f8bc){if(_0x44f8bc){return _0x44f8bc[_0xa30e('0x4a')](_0x2265f2[_0xa30e('0x3d')]['ids']||[]);}return null;})[_0xa30e('0x1e')](respondWithResult(_0x1c333c,null))[_0xa30e('0x3b')](handleError(_0x1c333c,null));}; \ No newline at end of file +var _0xe904=['where','pick','filter','merge','VIRTUAL','options','ZendeskConfiguration','includeAll','findAll','rows','catch','show','rawAttributes','include','find','create','body','params','findOne','ZendeskField','getFields','getSubjects','hasOwnProperty','getDescriptions','getTags','setTags','ids','rimraf','fast-json-patch','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/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort'];(function(_0x5a95fa,_0x4a2fc9){var _0x1a61b8=function(_0x59f119){while(--_0x59f119){_0x5a95fa['push'](_0x5a95fa['shift']());}};_0x1a61b8(++_0x4a2fc9);}(_0xe904,0x16f));var _0x4e90=function(_0x3a45b3,_0x300baf){_0x3a45b3=_0x3a45b3-0x0;var _0x4aba5b=_0xe904[_0x3a45b3];return _0x4aba5b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4e90('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4e90('0x1'));var rp=require(_0x4e90('0x2'));var moment=require(_0x4e90('0x3'));var BPromise=require(_0x4e90('0x4'));var Mustache=require(_0x4e90('0x5'));var util=require(_0x4e90('0x6'));var path=require(_0x4e90('0x7'));var sox=require('sox');var csv=require(_0x4e90('0x8'));var ejs=require(_0x4e90('0x9'));var fs=require('fs');var fs_extra=require(_0x4e90('0xa'));var _=require(_0x4e90('0xb'));var squel=require(_0x4e90('0xc'));var crypto=require('crypto');var jsforce=require(_0x4e90('0xd'));var deskjs=require(_0x4e90('0xe'));var toCsv=require(_0x4e90('0x8'));var querystring=require(_0x4e90('0xf'));var Papa=require(_0x4e90('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4e90('0x11'));var as=require(_0x4e90('0x12'));var hardwareService=require(_0x4e90('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x4e90('0x14'));var config=require(_0x4e90('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x4e90('0x16'))['db'];function respondWithStatusCode(_0x207c56,_0x3512dc){_0x3512dc=_0x3512dc||0xcc;return function(_0x4ede23){if(_0x4ede23){return _0x207c56[_0x4e90('0x17')](_0x3512dc);}return _0x207c56['status'](_0x3512dc)[_0x4e90('0x18')]();};}function respondWithResult(_0x4dea69,_0x302b9f){_0x302b9f=_0x302b9f||0xc8;return function(_0x3d0ebf){if(_0x3d0ebf){return _0x4dea69[_0x4e90('0x19')](_0x302b9f)[_0x4e90('0x1a')](_0x3d0ebf);}};}function respondWithFilteredResult(_0x156147,_0x118211){return function(_0x4e95b6){if(_0x4e95b6){var _0x249c09=typeof _0x118211[_0x4e90('0x1b')]===_0x4e90('0x1c')&&typeof _0x118211[_0x4e90('0x1d')]===_0x4e90('0x1c');var _0x47e498=_0x4e95b6[_0x4e90('0x1e')];var _0x264199=_0x249c09?0x0:_0x118211['offset'];var _0x1b2ab5=_0x249c09?_0x4e95b6['count']:_0x118211[_0x4e90('0x1b')]+_0x118211[_0x4e90('0x1d')];var _0x25ff6b;if(_0x1b2ab5>=_0x47e498){_0x1b2ab5=_0x47e498;_0x25ff6b=0xc8;}else{_0x25ff6b=0xce;}_0x156147['status'](_0x25ff6b);return _0x156147[_0x4e90('0x1f')](_0x4e90('0x20'),_0x264199+'-'+_0x1b2ab5+'/'+_0x47e498)[_0x4e90('0x1a')](_0x4e95b6);}return null;};}function patchUpdates(_0x4f2a6c){return function(_0x412124){try{jsonpatch[_0x4e90('0x21')](_0x412124,_0x4f2a6c,!![]);}catch(_0x3608c1){return BPromise[_0x4e90('0x22')](_0x3608c1);}return _0x412124['save']();};}function saveUpdates(_0x4d8931,_0x5f2578){return function(_0x4f2b70){if(_0x4f2b70){return _0x4f2b70[_0x4e90('0x23')](_0x4d8931)[_0x4e90('0x24')](function(_0x2a72d4){return _0x2a72d4;});}return null;};}function removeEntity(_0x5f3d16,_0x20ed9a){return function(_0x46f2c2){if(_0x46f2c2){return _0x46f2c2[_0x4e90('0x25')]()['then'](function(){_0x5f3d16[_0x4e90('0x19')](0xcc)[_0x4e90('0x18')]();});}};}function handleEntityNotFound(_0x1b9c30,_0x266671){return function(_0x3e5f7f){if(!_0x3e5f7f){_0x1b9c30[_0x4e90('0x17')](0x194);}return _0x3e5f7f;};}function handleError(_0x5c0c8a,_0x96562a){_0x96562a=_0x96562a||0x1f4;return function(_0x419cd8){logger[_0x4e90('0x26')](_0x419cd8[_0x4e90('0x27')]);if(_0x419cd8[_0x4e90('0x28')]){delete _0x419cd8[_0x4e90('0x28')];}_0x5c0c8a[_0x4e90('0x19')](_0x96562a)[_0x4e90('0x29')](_0x419cd8);};}exports[_0x4e90('0x2a')]=function(_0x57f657,_0x2ece94){var _0x3e94e2={},_0x1f4da4={},_0x3ad3d4={'count':0x0,'rows':[]};var _0x5d02b3=_[_0x4e90('0x2b')](db['ZendeskConfiguration']['rawAttributes'],function(_0x4f1da5){return{'name':_0x4f1da5[_0x4e90('0x2c')],'type':_0x4f1da5[_0x4e90('0x2d')][_0x4e90('0x2e')]};});_0x1f4da4['model']=_[_0x4e90('0x2b')](_0x5d02b3,_0x4e90('0x28'));_0x1f4da4[_0x4e90('0x2f')]=_[_0x4e90('0x30')](_0x57f657[_0x4e90('0x2f')]);_0x1f4da4[_0x4e90('0x31')]=_[_0x4e90('0x32')](_0x1f4da4[_0x4e90('0x33')],_0x1f4da4[_0x4e90('0x2f')]);_0x3e94e2[_0x4e90('0x34')]=_[_0x4e90('0x32')](_0x1f4da4[_0x4e90('0x33')],qs[_0x4e90('0x35')](_0x57f657[_0x4e90('0x2f')]['fields']));_0x3e94e2[_0x4e90('0x34')]=_0x3e94e2[_0x4e90('0x34')][_0x4e90('0x36')]?_0x3e94e2['attributes']:_0x1f4da4[_0x4e90('0x33')];if(!_0x57f657[_0x4e90('0x2f')]['hasOwnProperty'](_0x4e90('0x37'))){_0x3e94e2[_0x4e90('0x1d')]=qs['limit'](_0x57f657[_0x4e90('0x2f')][_0x4e90('0x1d')]);_0x3e94e2[_0x4e90('0x1b')]=qs[_0x4e90('0x1b')](_0x57f657[_0x4e90('0x2f')][_0x4e90('0x1b')]);}_0x3e94e2[_0x4e90('0x38')]=qs[_0x4e90('0x39')](_0x57f657[_0x4e90('0x2f')][_0x4e90('0x39')]);_0x3e94e2[_0x4e90('0x3a')]=qs[_0x4e90('0x31')](_[_0x4e90('0x3b')](_0x57f657[_0x4e90('0x2f')],_0x1f4da4['filters']),_0x5d02b3);if(_0x57f657[_0x4e90('0x2f')][_0x4e90('0x3c')]){_0x3e94e2['where']=_[_0x4e90('0x3d')](_0x3e94e2[_0x4e90('0x3a')],{'$or':_['map'](_0x5d02b3,function(_0x24cf42){if(_0x24cf42[_0x4e90('0x2d')]!==_0x4e90('0x3e')){var _0x2b0123={};_0x2b0123[_0x24cf42[_0x4e90('0x28')]]={'$like':'%'+_0x57f657[_0x4e90('0x2f')][_0x4e90('0x3c')]+'%'};return _0x2b0123;}})});}_0x3e94e2=_[_0x4e90('0x3d')]({},_0x3e94e2,_0x57f657[_0x4e90('0x3f')]);var _0x4058e3={'where':_0x3e94e2[_0x4e90('0x3a')]};return db[_0x4e90('0x40')][_0x4e90('0x1e')](_0x4058e3)[_0x4e90('0x24')](function(_0x10459e){_0x3ad3d4[_0x4e90('0x1e')]=_0x10459e;if(_0x57f657['query'][_0x4e90('0x41')]){_0x3e94e2['include']=[{'all':!![]}];}return db[_0x4e90('0x40')][_0x4e90('0x42')](_0x3e94e2);})[_0x4e90('0x24')](function(_0x42d99a){_0x3ad3d4[_0x4e90('0x43')]=_0x42d99a;return _0x3ad3d4;})[_0x4e90('0x24')](respondWithFilteredResult(_0x2ece94,_0x3e94e2))[_0x4e90('0x44')](handleError(_0x2ece94,null));};exports[_0x4e90('0x45')]=function(_0x3e563b,_0x1033d2){var _0xb6d567={'raw':![],'where':{'id':_0x3e563b['params']['id']}},_0x1a92ca={};_0x1a92ca[_0x4e90('0x33')]=_[_0x4e90('0x30')](db[_0x4e90('0x40')][_0x4e90('0x46')]);_0x1a92ca[_0x4e90('0x2f')]=_['keys'](_0x3e563b[_0x4e90('0x2f')]);_0x1a92ca[_0x4e90('0x31')]=_[_0x4e90('0x32')](_0x1a92ca[_0x4e90('0x33')],_0x1a92ca[_0x4e90('0x2f')]);_0xb6d567[_0x4e90('0x34')]=_[_0x4e90('0x32')](_0x1a92ca[_0x4e90('0x33')],qs[_0x4e90('0x35')](_0x3e563b['query']['fields']));_0xb6d567['attributes']=_0xb6d567[_0x4e90('0x34')][_0x4e90('0x36')]?_0xb6d567['attributes']:_0x1a92ca[_0x4e90('0x33')];if(_0x3e563b[_0x4e90('0x2f')][_0x4e90('0x41')]){_0xb6d567[_0x4e90('0x47')]=[{'all':!![]}];}_0xb6d567=_[_0x4e90('0x3d')]({},_0xb6d567,_0x3e563b[_0x4e90('0x3f')]);return db[_0x4e90('0x40')][_0x4e90('0x48')](_0xb6d567)[_0x4e90('0x24')](handleEntityNotFound(_0x1033d2,null))[_0x4e90('0x24')](respondWithResult(_0x1033d2,null))[_0x4e90('0x44')](handleError(_0x1033d2,null));};exports[_0x4e90('0x49')]=function(_0x299b2a,_0x4db6a0){return db[_0x4e90('0x40')][_0x4e90('0x49')](_0x299b2a[_0x4e90('0x4a')],{})['then'](respondWithResult(_0x4db6a0,0xc9))[_0x4e90('0x44')](handleError(_0x4db6a0,null));};exports['update']=function(_0x6bb1ea,_0x18b44b){if(_0x6bb1ea[_0x4e90('0x4a')]['id']){delete _0x6bb1ea['body']['id'];}return db[_0x4e90('0x40')]['find']({'where':{'id':_0x6bb1ea['params']['id']}})[_0x4e90('0x24')](handleEntityNotFound(_0x18b44b,null))[_0x4e90('0x24')](saveUpdates(_0x6bb1ea[_0x4e90('0x4a')],null))[_0x4e90('0x24')](respondWithResult(_0x18b44b,null))['catch'](handleError(_0x18b44b,null));};exports[_0x4e90('0x25')]=function(_0xb02a8,_0x1527bf){return db[_0x4e90('0x40')][_0x4e90('0x48')]({'where':{'id':_0xb02a8[_0x4e90('0x4b')]['id']}})[_0x4e90('0x24')](handleEntityNotFound(_0x1527bf,null))['then'](removeEntity(_0x1527bf,null))[_0x4e90('0x44')](handleError(_0x1527bf,null));};exports['getFields']=function(_0xaf189,_0x19980d,_0x263a54){var _0x36d1d6={};var _0x2176bf={};var _0x34a4f5;var _0x1c4ae5;return db['ZendeskConfiguration'][_0x4e90('0x4c')]({'where':{'id':_0xaf189[_0x4e90('0x4b')]['id']}})[_0x4e90('0x24')](handleEntityNotFound(_0x19980d,null))[_0x4e90('0x24')](function(_0x110211){if(_0x110211){_0x34a4f5=_0x110211;_0x2176bf[_0x4e90('0x33')]=_[_0x4e90('0x30')](db[_0x4e90('0x4d')][_0x4e90('0x46')]);_0x2176bf['query']=_['keys'](_0xaf189[_0x4e90('0x2f')]);_0x2176bf[_0x4e90('0x31')]=_[_0x4e90('0x32')](_0x2176bf[_0x4e90('0x33')],_0x2176bf['query']);_0x36d1d6[_0x4e90('0x34')]=_[_0x4e90('0x32')](_0x2176bf[_0x4e90('0x33')],qs[_0x4e90('0x35')](_0xaf189[_0x4e90('0x2f')]['fields']));_0x36d1d6[_0x4e90('0x34')]=_0x36d1d6['attributes'][_0x4e90('0x36')]?_0x36d1d6[_0x4e90('0x34')]:_0x2176bf['model'];_0x36d1d6[_0x4e90('0x38')]=qs[_0x4e90('0x39')](_0xaf189[_0x4e90('0x2f')]['sort']);_0x36d1d6[_0x4e90('0x3a')]=qs[_0x4e90('0x31')](_[_0x4e90('0x3b')](_0xaf189['query'],_0x2176bf[_0x4e90('0x31')]));if(_0xaf189[_0x4e90('0x2f')]['filter']){_0x36d1d6['where']=_[_0x4e90('0x3d')](_0x36d1d6[_0x4e90('0x3a')],{'$or':_[_0x4e90('0x2b')](_0x36d1d6[_0x4e90('0x34')],function(_0x235f0e){var _0x46f23a={};_0x46f23a[_0x235f0e]={'$like':'%'+_0xaf189[_0x4e90('0x2f')][_0x4e90('0x3c')]+'%'};return _0x46f23a;})});}_0x36d1d6=_['merge']({},_0x36d1d6,_0xaf189['options']);return _0x34a4f5[_0x4e90('0x4e')](_0x36d1d6);}})[_0x4e90('0x24')](function(_0x1a23ae){if(_0x1a23ae){_0x1c4ae5=_0x1a23ae[_0x4e90('0x36')];if(!_0xaf189[_0x4e90('0x2f')]['hasOwnProperty'](_0x4e90('0x37'))){_0x36d1d6[_0x4e90('0x1d')]=qs['limit'](_0xaf189[_0x4e90('0x2f')][_0x4e90('0x1d')]);_0x36d1d6['offset']=qs['offset'](_0xaf189['query'][_0x4e90('0x1b')]);}return _0x34a4f5[_0x4e90('0x4e')](_0x36d1d6);}})[_0x4e90('0x24')](function(_0x23f14e){if(_0x23f14e){return _0x23f14e?{'count':_0x1c4ae5,'rows':_0x23f14e}:null;}})[_0x4e90('0x24')](respondWithResult(_0x19980d,null))[_0x4e90('0x44')](handleError(_0x19980d,null));};exports['getSubjects']=function(_0x1f715b,_0x58b2a7,_0x265308){var _0x105230={};var _0x2b53f7={};var _0x15feb1;var _0x295f79;return db[_0x4e90('0x40')][_0x4e90('0x4c')]({'where':{'id':_0x1f715b[_0x4e90('0x4b')]['id']}})[_0x4e90('0x24')](handleEntityNotFound(_0x58b2a7,null))['then'](function(_0x4c3b6e){if(_0x4c3b6e){_0x15feb1=_0x4c3b6e;_0x2b53f7[_0x4e90('0x33')]=_[_0x4e90('0x30')](db[_0x4e90('0x4d')]['rawAttributes']);_0x2b53f7[_0x4e90('0x2f')]=_[_0x4e90('0x30')](_0x1f715b[_0x4e90('0x2f')]);_0x2b53f7[_0x4e90('0x31')]=_['intersection'](_0x2b53f7['model'],_0x2b53f7[_0x4e90('0x2f')]);_0x105230[_0x4e90('0x34')]=_['intersection'](_0x2b53f7[_0x4e90('0x33')],qs[_0x4e90('0x35')](_0x1f715b[_0x4e90('0x2f')][_0x4e90('0x35')]));_0x105230[_0x4e90('0x34')]=_0x105230[_0x4e90('0x34')][_0x4e90('0x36')]?_0x105230['attributes']:_0x2b53f7[_0x4e90('0x33')];_0x105230[_0x4e90('0x38')]=qs[_0x4e90('0x39')](_0x1f715b[_0x4e90('0x2f')][_0x4e90('0x39')]);_0x105230[_0x4e90('0x3a')]=qs[_0x4e90('0x31')](_[_0x4e90('0x3b')](_0x1f715b[_0x4e90('0x2f')],_0x2b53f7[_0x4e90('0x31')]));if(_0x1f715b['query'][_0x4e90('0x3c')]){_0x105230['where']=_['merge'](_0x105230[_0x4e90('0x3a')],{'$or':_['map'](_0x105230[_0x4e90('0x34')],function(_0x4c973f){var _0xd2f4f={};_0xd2f4f[_0x4c973f]={'$like':'%'+_0x1f715b['query'][_0x4e90('0x3c')]+'%'};return _0xd2f4f;})});}_0x105230=_[_0x4e90('0x3d')]({},_0x105230,_0x1f715b['options']);return _0x15feb1[_0x4e90('0x4f')](_0x105230);}})[_0x4e90('0x24')](function(_0x299e7e){if(_0x299e7e){_0x295f79=_0x299e7e[_0x4e90('0x36')];if(!_0x1f715b[_0x4e90('0x2f')][_0x4e90('0x50')](_0x4e90('0x37'))){_0x105230['limit']=qs['limit'](_0x1f715b[_0x4e90('0x2f')]['limit']);_0x105230[_0x4e90('0x1b')]=qs[_0x4e90('0x1b')](_0x1f715b[_0x4e90('0x2f')][_0x4e90('0x1b')]);}return _0x15feb1[_0x4e90('0x4f')](_0x105230);}})[_0x4e90('0x24')](function(_0x20d8b){if(_0x20d8b){return _0x20d8b?{'count':_0x295f79,'rows':_0x20d8b}:null;}})[_0x4e90('0x24')](respondWithResult(_0x58b2a7,null))['catch'](handleError(_0x58b2a7,null));};exports[_0x4e90('0x51')]=function(_0x2db62c,_0x146188,_0x1689a7){var _0x5d631f={};var _0x2141be={};var _0x2cc8c1;var _0x2e7aed;return db['ZendeskConfiguration'][_0x4e90('0x4c')]({'where':{'id':_0x2db62c[_0x4e90('0x4b')]['id']}})[_0x4e90('0x24')](handleEntityNotFound(_0x146188,null))[_0x4e90('0x24')](function(_0x4c72af){if(_0x4c72af){_0x2cc8c1=_0x4c72af;_0x2141be[_0x4e90('0x33')]=_['keys'](db[_0x4e90('0x4d')][_0x4e90('0x46')]);_0x2141be[_0x4e90('0x2f')]=_[_0x4e90('0x30')](_0x2db62c[_0x4e90('0x2f')]);_0x2141be[_0x4e90('0x31')]=_[_0x4e90('0x32')](_0x2141be[_0x4e90('0x33')],_0x2141be[_0x4e90('0x2f')]);_0x5d631f[_0x4e90('0x34')]=_[_0x4e90('0x32')](_0x2141be[_0x4e90('0x33')],qs['fields'](_0x2db62c[_0x4e90('0x2f')][_0x4e90('0x35')]));_0x5d631f[_0x4e90('0x34')]=_0x5d631f[_0x4e90('0x34')][_0x4e90('0x36')]?_0x5d631f['attributes']:_0x2141be[_0x4e90('0x33')];_0x5d631f[_0x4e90('0x38')]=qs[_0x4e90('0x39')](_0x2db62c[_0x4e90('0x2f')][_0x4e90('0x39')]);_0x5d631f[_0x4e90('0x3a')]=qs['filters'](_[_0x4e90('0x3b')](_0x2db62c[_0x4e90('0x2f')],_0x2141be[_0x4e90('0x31')]));if(_0x2db62c['query'][_0x4e90('0x3c')]){_0x5d631f['where']=_[_0x4e90('0x3d')](_0x5d631f[_0x4e90('0x3a')],{'$or':_[_0x4e90('0x2b')](_0x5d631f['attributes'],function(_0xd09e02){var _0x4aba32={};_0x4aba32[_0xd09e02]={'$like':'%'+_0x2db62c[_0x4e90('0x2f')]['filter']+'%'};return _0x4aba32;})});}_0x5d631f=_[_0x4e90('0x3d')]({},_0x5d631f,_0x2db62c['options']);return _0x2cc8c1[_0x4e90('0x51')](_0x5d631f);}})[_0x4e90('0x24')](function(_0x4ee0eb){if(_0x4ee0eb){_0x2e7aed=_0x4ee0eb[_0x4e90('0x36')];if(!_0x2db62c[_0x4e90('0x2f')][_0x4e90('0x50')](_0x4e90('0x37'))){_0x5d631f[_0x4e90('0x1d')]=qs[_0x4e90('0x1d')](_0x2db62c[_0x4e90('0x2f')][_0x4e90('0x1d')]);_0x5d631f[_0x4e90('0x1b')]=qs[_0x4e90('0x1b')](_0x2db62c[_0x4e90('0x2f')]['offset']);}return _0x2cc8c1[_0x4e90('0x51')](_0x5d631f);}})[_0x4e90('0x24')](function(_0x19ed19){if(_0x19ed19){return _0x19ed19?{'count':_0x2e7aed,'rows':_0x19ed19}:null;}})[_0x4e90('0x24')](respondWithResult(_0x146188,null))['catch'](handleError(_0x146188,null));};exports[_0x4e90('0x52')]=function(_0x4b2710,_0x3e4d7e,_0x26ad80){var _0x481016={};var _0x50cbe9={};var _0x111f01;var _0x4d4ea2;return db['ZendeskConfiguration'][_0x4e90('0x4c')]({'where':{'id':_0x4b2710[_0x4e90('0x4b')]['id']}})[_0x4e90('0x24')](handleEntityNotFound(_0x3e4d7e,null))[_0x4e90('0x24')](function(_0x1d7a01){if(_0x1d7a01){_0x111f01=_0x1d7a01;_0x50cbe9[_0x4e90('0x33')]=_[_0x4e90('0x30')](db['Tag'][_0x4e90('0x46')]);_0x50cbe9[_0x4e90('0x2f')]=_['keys'](_0x4b2710[_0x4e90('0x2f')]);_0x50cbe9[_0x4e90('0x31')]=_[_0x4e90('0x32')](_0x50cbe9[_0x4e90('0x33')],_0x50cbe9['query']);_0x481016['attributes']=_[_0x4e90('0x32')](_0x50cbe9[_0x4e90('0x33')],qs[_0x4e90('0x35')](_0x4b2710[_0x4e90('0x2f')][_0x4e90('0x35')]));_0x481016[_0x4e90('0x34')]=_0x481016[_0x4e90('0x34')][_0x4e90('0x36')]?_0x481016[_0x4e90('0x34')]:_0x50cbe9[_0x4e90('0x33')];_0x481016[_0x4e90('0x38')]=qs[_0x4e90('0x39')](_0x4b2710[_0x4e90('0x2f')][_0x4e90('0x39')]);_0x481016[_0x4e90('0x3a')]=qs['filters'](_[_0x4e90('0x3b')](_0x4b2710['query'],_0x50cbe9[_0x4e90('0x31')]));if(_0x4b2710[_0x4e90('0x2f')][_0x4e90('0x3c')]){_0x481016[_0x4e90('0x3a')]=_['merge'](_0x481016[_0x4e90('0x3a')],{'$or':_[_0x4e90('0x2b')](_0x481016[_0x4e90('0x34')],function(_0x175014){var _0xce12ca={};_0xce12ca[_0x175014]={'$like':'%'+_0x4b2710['query']['filter']+'%'};return _0xce12ca;})});}_0x481016=_[_0x4e90('0x3d')]({},_0x481016,_0x4b2710[_0x4e90('0x3f')]);return _0x111f01['getTags'](_0x481016);}})[_0x4e90('0x24')](function(_0x2049a4){if(_0x2049a4){_0x4d4ea2=_0x2049a4[_0x4e90('0x36')];if(!_0x4b2710[_0x4e90('0x2f')][_0x4e90('0x50')](_0x4e90('0x37'))){_0x481016[_0x4e90('0x1d')]=qs[_0x4e90('0x1d')](_0x4b2710[_0x4e90('0x2f')][_0x4e90('0x1d')]);_0x481016[_0x4e90('0x1b')]=qs['offset'](_0x4b2710[_0x4e90('0x2f')]['offset']);}return _0x111f01['getTags'](_0x481016);}})['then'](function(_0x2f354b){if(_0x2f354b){return _0x2f354b?{'count':_0x4d4ea2,'rows':_0x2f354b}:null;}})['then'](respondWithResult(_0x3e4d7e,null))[_0x4e90('0x44')](handleError(_0x3e4d7e,null));};exports['setTags']=function(_0x3920ce,_0x458270,_0x1b3f4a){if(_0x3920ce['body']['id']){delete _0x3920ce['body']['id'];}return db[_0x4e90('0x40')]['findOne']({'where':{'id':_0x3920ce[_0x4e90('0x4b')]['id']}})[_0x4e90('0x24')](handleEntityNotFound(_0x458270,null))[_0x4e90('0x24')](function(_0x34d353){if(_0x34d353){return _0x34d353[_0x4e90('0x53')](_0x3920ce[_0x4e90('0x4a')][_0x4e90('0x54')]||[]);}return null;})[_0x4e90('0x24')](respondWithResult(_0x458270,null))[_0x4e90('0x44')](handleError(_0x458270,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index e40e886..079ee30 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 _0xe820=['exports','define','ZendeskConfiguration','lodash','../../config/logger','bluebird','request-promise','path','../../config/environment'];(function(_0x52d14a,_0x34d93b){var _0x62585c=function(_0x5098b8){while(--_0x5098b8){_0x52d14a['push'](_0x52d14a['shift']());}};_0x62585c(++_0x34d93b);}(_0xe820,0xd2));var _0x0e82=function(_0x935e60,_0x26870d){_0x935e60=_0x935e60-0x0;var _0x4430bd=_0xe820[_0x935e60];return _0x4430bd;};'use strict';var _=require(_0x0e82('0x0'));var util=require('util');var logger=require(_0x0e82('0x1'))('api');var moment=require('moment');var BPromise=require(_0x0e82('0x2'));var rp=require(_0x0e82('0x3'));var fs=require('fs');var path=require(_0x0e82('0x4'));var rimraf=require('rimraf');var config=require(_0x0e82('0x5'));var attributes=require('./intZendeskConfiguration.attributes');module[_0x0e82('0x6')]=function(_0x105e3c,_0x69e27f){return _0x105e3c[_0x0e82('0x7')](_0x0e82('0x8'),attributes,{'tableName':'int_zendesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8f4c=['lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','ZendeskConfiguration'];(function(_0x12a5b8,_0x3ba542){var _0x24542c=function(_0x222ff2){while(--_0x222ff2){_0x12a5b8['push'](_0x12a5b8['shift']());}};_0x24542c(++_0x3ba542);}(_0x8f4c,0x113));var _0xc8f4=function(_0x32113d,_0x185cc4){_0x32113d=_0x32113d-0x0;var _0x270024=_0x8f4c[_0x32113d];return _0x270024;};'use strict';var _=require(_0xc8f4('0x0'));var util=require(_0xc8f4('0x1'));var logger=require(_0xc8f4('0x2'))(_0xc8f4('0x3'));var moment=require(_0xc8f4('0x4'));var BPromise=require(_0xc8f4('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc8f4('0x6'));var rimraf=require(_0xc8f4('0x7'));var config=require(_0xc8f4('0x8'));var attributes=require('./intZendeskConfiguration.attributes');module[_0xc8f4('0x9')]=function(_0x5208da,_0x4c86f8){return _0x5208da['define'](_0xc8f4('0xa'),attributes,{'tableName':'int_zendesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js index ccb1b9b..0bb1373 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 _0x9254=['jayson/promise','http','then','info','ZendeskConfiguration,\x20%s,\x20%s','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x1c0ea0,_0x13adda){var _0x5384d3=function(_0x29fea6){while(--_0x29fea6){_0x1c0ea0['push'](_0x1c0ea0['shift']());}};_0x5384d3(++_0x13adda);}(_0x9254,0xfd));var _0x4925=function(_0x159e29,_0x53d9ca){_0x159e29=_0x159e29-0x0;var _0x429903=_0x9254[_0x159e29];return _0x429903;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4925('0x0'));var BPromise=require(_0x4925('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4925('0x2'));var db=require(_0x4925('0x3'))['db'];var utils=require(_0x4925('0x4'));var logger=require('../../config/logger')(_0x4925('0x5'));var config=require(_0x4925('0x6'));var jayson=require(_0x4925('0x7'));var client=jayson['client'][_0x4925('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4eb20f,_0x45e5f6,_0x499796){return new BPromise(function(_0x480fa1,_0x2abbb8){return client['request'](_0x4eb20f,_0x499796)[_0x4925('0x9')](function(_0x598ce3){logger[_0x4925('0xa')](_0x4925('0xb'),_0x45e5f6,'request\x20sent');logger[_0x4925('0xc')](_0x4925('0xd'),_0x45e5f6,_0x4925('0xe'),JSON[_0x4925('0xf')](_0x598ce3));if(_0x598ce3[_0x4925('0x10')]){if(_0x598ce3['error']['code']===0x1f4){logger[_0x4925('0x10')](_0x4925('0xb'),_0x45e5f6,_0x598ce3['error'][_0x4925('0x11')]);return _0x2abbb8(_0x598ce3[_0x4925('0x10')][_0x4925('0x11')]);}logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x45e5f6,_0x598ce3[_0x4925('0x10')][_0x4925('0x11')]);return _0x480fa1(_0x598ce3[_0x4925('0x10')][_0x4925('0x11')]);}else{logger['info'](_0x4925('0xb'),_0x45e5f6,'request\x20sent');_0x480fa1(_0x598ce3[_0x4925('0x12')]['message']);}})[_0x4925('0x13')](function(_0x1d20dc){logger[_0x4925('0x10')](_0x4925('0xb'),_0x45e5f6,_0x1d20dc);_0x2abbb8(_0x1d20dc);});});} \ No newline at end of file +var _0x699f=['then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','http','request'];(function(_0x43dcb6,_0x24cf04){var _0x58385a=function(_0x33f079){while(--_0x33f079){_0x43dcb6['push'](_0x43dcb6['shift']());}};_0x58385a(++_0x24cf04);}(_0x699f,0xbc));var _0xf699=function(_0x3a2a3c,_0x37bd31){_0x3a2a3c=_0x3a2a3c-0x0;var _0x50ac9a=_0x699f[_0x3a2a3c];return _0x50ac9a;};'use strict';var _=require(_0xf699('0x0'));var util=require(_0xf699('0x1'));var moment=require(_0xf699('0x2'));var BPromise=require('bluebird');var rs=require(_0xf699('0x3'));var fs=require('fs');var Redis=require(_0xf699('0x4'));var db=require(_0xf699('0x5'))['db'];var utils=require(_0xf699('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xf699('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf699('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x52e097,_0x1d8bae,_0x5bdaae){return new BPromise(function(_0x59eea4,_0x1fdd00){return client[_0xf699('0x9')](_0x52e097,_0x5bdaae)[_0xf699('0xa')](function(_0x2edb55){logger[_0xf699('0xb')](_0xf699('0xc'),_0x1d8bae,_0xf699('0xd'));logger[_0xf699('0xe')](_0xf699('0xf'),_0x1d8bae,_0xf699('0xd'),JSON[_0xf699('0x10')](_0x2edb55));if(_0x2edb55['error']){if(_0x2edb55[_0xf699('0x11')][_0xf699('0x12')]===0x1f4){logger[_0xf699('0x11')](_0xf699('0xc'),_0x1d8bae,_0x2edb55[_0xf699('0x11')][_0xf699('0x13')]);return _0x1fdd00(_0x2edb55[_0xf699('0x11')][_0xf699('0x13')]);}logger[_0xf699('0x11')](_0xf699('0xc'),_0x1d8bae,_0x2edb55['error'][_0xf699('0x13')]);return _0x59eea4(_0x2edb55['error']['message']);}else{logger['info'](_0xf699('0xc'),_0x1d8bae,_0xf699('0xd'));_0x59eea4(_0x2edb55[_0xf699('0x14')][_0xf699('0x13')]);}})[_0xf699('0x15')](function(_0x37ee84){logger[_0xf699('0x11')]('ZendeskConfiguration,\x20%s,\x20%s',_0x1d8bae,_0x37ee84);_0x1fdd00(_0x37ee84);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 327154c..8e960bc 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 _0x4dfb=['isAuthenticated','index','get','/:id','show','post','create','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x4dfb,0x19a));var _0xb4df=function(_0x28d56e,_0x2a1935){_0x28d56e=_0x28d56e-0x0;var _0x2dc10d=_0x4dfb[_0x28d56e];return _0x2dc10d;};'use strict';var multer=require(_0xb4df('0x0'));var util=require('util');var path=require(_0xb4df('0x1'));var timeout=require(_0xb4df('0x2'));var express=require(_0xb4df('0x3'));var router=express[_0xb4df('0x4')]();var fs_extra=require(_0xb4df('0x5'));var auth=require(_0xb4df('0x6'));var interaction=require(_0xb4df('0x7'));var config=require(_0xb4df('0x8'));var controller=require(_0xb4df('0x9'));router['get']('/',auth[_0xb4df('0xa')](),controller[_0xb4df('0xb')]);router[_0xb4df('0xc')](_0xb4df('0xd'),auth['isAuthenticated'](),controller[_0xb4df('0xe')]);router[_0xb4df('0xf')]('/',auth[_0xb4df('0xa')](),controller[_0xb4df('0x10')]);router['put'](_0xb4df('0xd'),auth[_0xb4df('0xa')](),controller['update']);router[_0xb4df('0x11')](_0xb4df('0xd'),auth[_0xb4df('0xa')](),controller[_0xb4df('0x12')]);module[_0xb4df('0x13')]=router; \ No newline at end of file +var _0x2c00=['show','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated','index','/:id'];(function(_0x1f582e,_0xf71df4){var _0x3f1462=function(_0x23ccdf){while(--_0x23ccdf){_0x1f582e['push'](_0x1f582e['shift']());}};_0x3f1462(++_0xf71df4);}(_0x2c00,0x12e));var _0x02c0=function(_0x582274,_0x2cbd9c){_0x582274=_0x582274-0x0;var _0x8f14d3=_0x2c00[_0x582274];return _0x8f14d3;};'use strict';var multer=require(_0x02c0('0x0'));var util=require(_0x02c0('0x1'));var path=require(_0x02c0('0x2'));var timeout=require('connect-timeout');var express=require(_0x02c0('0x3'));var router=express[_0x02c0('0x4')]();var fs_extra=require(_0x02c0('0x5'));var auth=require(_0x02c0('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x02c0('0x7'));var controller=require(_0x02c0('0x8'));router[_0x02c0('0x9')]('/',auth[_0x02c0('0xa')](),controller[_0x02c0('0xb')]);router[_0x02c0('0x9')](_0x02c0('0xc'),auth[_0x02c0('0xa')](),controller[_0x02c0('0xd')]);router[_0x02c0('0xe')]('/',auth[_0x02c0('0xa')](),controller[_0x02c0('0xf')]);router[_0x02c0('0x10')](_0x02c0('0xc'),auth[_0x02c0('0xa')](),controller[_0x02c0('0x11')]);router[_0x02c0('0x12')]('/:id',auth[_0x02c0('0xa')](),controller[_0x02c0('0x13')]);module[_0x02c0('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 2366a0a..fc014d7 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 _0xcd78=['exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize'];(function(_0x2ccb91,_0xa2c1b4){var _0x4136ca=function(_0x4326f0){while(--_0x4326f0){_0x2ccb91['push'](_0x2ccb91['shift']());}};_0x4136ca(++_0xa2c1b4);}(_0xcd78,0xf9));var _0x8cd7=function(_0x3b90ab,_0x174a22){_0x3b90ab=_0x3b90ab-0x0;var _0x206e92=_0xcd78[_0x3b90ab];return _0x206e92;};'use strict';var Sequelize=require(_0x8cd7('0x0'));module[_0x8cd7('0x1')]={'type':{'type':Sequelize[_0x8cd7('0x2')](_0x8cd7('0x3'),_0x8cd7('0x4'),_0x8cd7('0x5'),_0x8cd7('0x6'),_0x8cd7('0x7')),'defaultValue':_0x8cd7('0x3')},'content':{'type':Sequelize[_0x8cd7('0x8')]},'key':{'type':Sequelize[_0x8cd7('0x8')]},'keyType':{'type':Sequelize[_0x8cd7('0x2')](_0x8cd7('0x3'),_0x8cd7('0x4'),_0x8cd7('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x8cd7('0x8')]},'nameField':{'type':Sequelize[_0x8cd7('0x8')]},'customField':{'type':Sequelize[_0x8cd7('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8cd7('0x8')]}}; \ No newline at end of file +var _0xcecd=['keyValue','picklist','string','STRING','customVariable','BOOLEAN','sequelize','exports','ENUM','variable'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xcecd,0x1e6));var _0xdcec=function(_0x197b63,_0x4ffdfb){_0x197b63=_0x197b63-0x0;var _0x476965=_0xcecd[_0x197b63];return _0x476965;};'use strict';var Sequelize=require(_0xdcec('0x0'));module[_0xdcec('0x1')]={'type':{'type':Sequelize[_0xdcec('0x2')]('string',_0xdcec('0x3'),'customVariable',_0xdcec('0x4'),_0xdcec('0x5')),'defaultValue':_0xdcec('0x6')},'content':{'type':Sequelize[_0xdcec('0x7')]},'key':{'type':Sequelize[_0xdcec('0x7')]},'keyType':{'type':Sequelize[_0xdcec('0x2')]('string',_0xdcec('0x3'),_0xdcec('0x8'))},'keyContent':{'type':Sequelize[_0xdcec('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xdcec('0x7')]},'customField':{'type':Sequelize[_0xdcec('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xdcec('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 1ce715a..59da5c7 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 _0xa080=['create','body','update','params','eml-format','rimraf','zip-dir','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','end','error','stack','name','send','map','ZendeskField','key','keys','query','filters','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','rawAttributes','intersection','length','find'];(function(_0x3c3712,_0x4cdd0d){var _0x51e3fc=function(_0x1926a5){while(--_0x1926a5){_0x3c3712['push'](_0x3c3712['shift']());}};_0x51e3fc(++_0x4cdd0d);}(_0xa080,0x12c));var _0x0a08=function(_0x4713fe,_0x24caa0){_0x4713fe=_0x4713fe-0x0;var _0x14cc0a=_0xa080[_0x4713fe];return _0x14cc0a;};'use strict';var emlformat=require(_0x0a08('0x0'));var rimraf=require(_0x0a08('0x1'));var zipdir=require(_0x0a08('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a08('0x3'));var BPromise=require(_0x0a08('0x4'));var Mustache=require('mustache');var util=require(_0x0a08('0x5'));var path=require('path');var sox=require(_0x0a08('0x6'));var csv=require(_0x0a08('0x7'));var ejs=require(_0x0a08('0x8'));var fs=require('fs');var fs_extra=require(_0x0a08('0x9'));var _=require(_0x0a08('0xa'));var squel=require(_0x0a08('0xb'));var crypto=require(_0x0a08('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x0a08('0xd'));var toCsv=require(_0x0a08('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x0a08('0xe'));var authService=require(_0x0a08('0xf'));var qs=require(_0x0a08('0x10'));var as=require(_0x0a08('0x11'));var hardwareService=require(_0x0a08('0x12'));var logger=require(_0x0a08('0x13'))('api');var utils=require(_0x0a08('0x14'));var config=require(_0x0a08('0x15'));var licenseUtil=require(_0x0a08('0x16'));var db=require(_0x0a08('0x17'))['db'];function respondWithStatusCode(_0x48fd8d,_0x3c047b){_0x3c047b=_0x3c047b||0xcc;return function(_0x4e7f87){if(_0x4e7f87){return _0x48fd8d['sendStatus'](_0x3c047b);}return _0x48fd8d[_0x0a08('0x18')](_0x3c047b)['end']();};}function respondWithResult(_0x49265e,_0x20a11b){_0x20a11b=_0x20a11b||0xc8;return function(_0x76e5ee){if(_0x76e5ee){return _0x49265e['status'](_0x20a11b)['json'](_0x76e5ee);}};}function respondWithFilteredResult(_0x5c420f,_0x16f9e6){return function(_0x43e26f){if(_0x43e26f){var _0x1ddfb3=typeof _0x16f9e6[_0x0a08('0x19')]===_0x0a08('0x1a')&&typeof _0x16f9e6[_0x0a08('0x1b')]===_0x0a08('0x1a');var _0x50d61c=_0x43e26f[_0x0a08('0x1c')];var _0x12ebbb=_0x1ddfb3?0x0:_0x16f9e6[_0x0a08('0x19')];var _0x482675=_0x1ddfb3?_0x43e26f['count']:_0x16f9e6[_0x0a08('0x19')]+_0x16f9e6[_0x0a08('0x1b')];var _0x33756c;if(_0x482675>=_0x50d61c){_0x482675=_0x50d61c;_0x33756c=0xc8;}else{_0x33756c=0xce;}_0x5c420f['status'](_0x33756c);return _0x5c420f[_0x0a08('0x1d')](_0x0a08('0x1e'),_0x12ebbb+'-'+_0x482675+'/'+_0x50d61c)['json'](_0x43e26f);}return null;};}function patchUpdates(_0x12524a){return function(_0x35fb76){try{jsonpatch[_0x0a08('0x1f')](_0x35fb76,_0x12524a,!![]);}catch(_0x3018f2){return BPromise[_0x0a08('0x20')](_0x3018f2);}return _0x35fb76[_0x0a08('0x21')]();};}function saveUpdates(_0x2dcba7,_0x7c5738){return function(_0x20808b){if(_0x20808b){return _0x20808b['update'](_0x2dcba7)[_0x0a08('0x22')](function(_0x3b7adc){return _0x3b7adc;});}return null;};}function removeEntity(_0x17cf25,_0x15634a){return function(_0x4fe986){if(_0x4fe986){return _0x4fe986[_0x0a08('0x23')]()[_0x0a08('0x22')](function(){_0x17cf25['status'](0xcc)[_0x0a08('0x24')]();});}};}function handleEntityNotFound(_0x33e06d,_0x45170f){return function(_0x4c5e2b){if(!_0x4c5e2b){_0x33e06d['sendStatus'](0x194);}return _0x4c5e2b;};}function handleError(_0x566451,_0x378a5e){_0x378a5e=_0x378a5e||0x1f4;return function(_0x16ea10){logger[_0x0a08('0x25')](_0x16ea10[_0x0a08('0x26')]);if(_0x16ea10[_0x0a08('0x27')]){delete _0x16ea10[_0x0a08('0x27')];}_0x566451[_0x0a08('0x18')](_0x378a5e)[_0x0a08('0x28')](_0x16ea10);};}exports['index']=function(_0x2b8c51,_0x20ef3d){var _0x53f82c={},_0x525344={},_0x3acad7={'count':0x0,'rows':[]};var _0x3816e2=_[_0x0a08('0x29')](db[_0x0a08('0x2a')]['rawAttributes'],function(_0x1b0cca){return{'name':_0x1b0cca['fieldName'],'type':_0x1b0cca['type'][_0x0a08('0x2b')]};});_0x525344['model']=_[_0x0a08('0x29')](_0x3816e2,_0x0a08('0x27'));_0x525344['query']=_[_0x0a08('0x2c')](_0x2b8c51[_0x0a08('0x2d')]);_0x525344[_0x0a08('0x2e')]=_['intersection'](_0x525344[_0x0a08('0x2f')],_0x525344[_0x0a08('0x2d')]);_0x53f82c['attributes']=_['intersection'](_0x525344['model'],qs[_0x0a08('0x30')](_0x2b8c51[_0x0a08('0x2d')][_0x0a08('0x30')]));_0x53f82c[_0x0a08('0x31')]=_0x53f82c[_0x0a08('0x31')]['length']?_0x53f82c[_0x0a08('0x31')]:_0x525344[_0x0a08('0x2f')];if(!_0x2b8c51[_0x0a08('0x2d')][_0x0a08('0x32')](_0x0a08('0x33'))){_0x53f82c['limit']=qs[_0x0a08('0x1b')](_0x2b8c51[_0x0a08('0x2d')][_0x0a08('0x1b')]);_0x53f82c[_0x0a08('0x19')]=qs['offset'](_0x2b8c51[_0x0a08('0x2d')]['offset']);}_0x53f82c[_0x0a08('0x34')]=qs[_0x0a08('0x35')](_0x2b8c51['query'][_0x0a08('0x35')]);_0x53f82c[_0x0a08('0x36')]=qs[_0x0a08('0x2e')](_[_0x0a08('0x37')](_0x2b8c51[_0x0a08('0x2d')],_0x525344[_0x0a08('0x2e')]),_0x3816e2);if(_0x2b8c51[_0x0a08('0x2d')]['filter']){_0x53f82c['where']=_[_0x0a08('0x38')](_0x53f82c[_0x0a08('0x36')],{'$or':_[_0x0a08('0x29')](_0x3816e2,function(_0x40df18){if(_0x40df18[_0x0a08('0x39')]!==_0x0a08('0x3a')){var _0x560686={};_0x560686[_0x40df18['name']]={'$like':'%'+_0x2b8c51[_0x0a08('0x2d')][_0x0a08('0x3b')]+'%'};return _0x560686;}})});}_0x53f82c=_['merge']({},_0x53f82c,_0x2b8c51[_0x0a08('0x3c')]);var _0x1bcedc={'where':_0x53f82c[_0x0a08('0x36')]};return db[_0x0a08('0x2a')][_0x0a08('0x1c')](_0x1bcedc)[_0x0a08('0x22')](function(_0x5a4790){_0x3acad7['count']=_0x5a4790;if(_0x2b8c51[_0x0a08('0x2d')][_0x0a08('0x3d')]){_0x53f82c[_0x0a08('0x3e')]=[{'all':!![]}];}return db[_0x0a08('0x2a')][_0x0a08('0x3f')](_0x53f82c);})['then'](function(_0x115f9e){_0x3acad7['rows']=_0x115f9e;return _0x3acad7;})[_0x0a08('0x22')](respondWithFilteredResult(_0x20ef3d,_0x53f82c))[_0x0a08('0x40')](handleError(_0x20ef3d,null));};exports[_0x0a08('0x41')]=function(_0x3d6c15,_0x17633d){var _0x4b6cc7={'raw':!![],'where':{'id':_0x3d6c15['params']['id']}},_0x3e63de={};_0x3e63de['model']=_[_0x0a08('0x2c')](db[_0x0a08('0x2a')][_0x0a08('0x42')]);_0x3e63de[_0x0a08('0x2d')]=_[_0x0a08('0x2c')](_0x3d6c15[_0x0a08('0x2d')]);_0x3e63de[_0x0a08('0x2e')]=_[_0x0a08('0x43')](_0x3e63de['model'],_0x3e63de['query']);_0x4b6cc7['attributes']=_[_0x0a08('0x43')](_0x3e63de[_0x0a08('0x2f')],qs[_0x0a08('0x30')](_0x3d6c15['query'][_0x0a08('0x30')]));_0x4b6cc7[_0x0a08('0x31')]=_0x4b6cc7[_0x0a08('0x31')][_0x0a08('0x44')]?_0x4b6cc7[_0x0a08('0x31')]:_0x3e63de[_0x0a08('0x2f')];if(_0x3d6c15[_0x0a08('0x2d')]['includeAll']){_0x4b6cc7[_0x0a08('0x3e')]=[{'all':!![]}];}_0x4b6cc7=_[_0x0a08('0x38')]({},_0x4b6cc7,_0x3d6c15[_0x0a08('0x3c')]);return db[_0x0a08('0x2a')][_0x0a08('0x45')](_0x4b6cc7)[_0x0a08('0x22')](handleEntityNotFound(_0x17633d,null))[_0x0a08('0x22')](respondWithResult(_0x17633d,null))[_0x0a08('0x40')](handleError(_0x17633d,null));};exports[_0x0a08('0x46')]=function(_0x1079ad,_0x55dd61){return db['ZendeskField'][_0x0a08('0x46')](_0x1079ad[_0x0a08('0x47')],{})[_0x0a08('0x22')](respondWithResult(_0x55dd61,0xc9))[_0x0a08('0x40')](handleError(_0x55dd61,null));};exports[_0x0a08('0x48')]=function(_0x170e63,_0xdb62bc){if(_0x170e63[_0x0a08('0x47')]['id']){delete _0x170e63[_0x0a08('0x47')]['id'];}return db[_0x0a08('0x2a')]['find']({'where':{'id':_0x170e63[_0x0a08('0x49')]['id']}})[_0x0a08('0x22')](handleEntityNotFound(_0xdb62bc,null))[_0x0a08('0x22')](saveUpdates(_0x170e63[_0x0a08('0x47')],null))[_0x0a08('0x22')](respondWithResult(_0xdb62bc,null))[_0x0a08('0x40')](handleError(_0xdb62bc,null));};exports[_0x0a08('0x23')]=function(_0x51b74f,_0x3f5b25){return db[_0x0a08('0x2a')]['find']({'where':{'id':_0x51b74f[_0x0a08('0x49')]['id']}})[_0x0a08('0x22')](handleEntityNotFound(_0x3f5b25,null))[_0x0a08('0x22')](removeEntity(_0x3f5b25,null))[_0x0a08('0x40')](handleError(_0x3f5b25,null));}; \ No newline at end of file +var _0xf01b=['reject','save','update','then','destroy','error','stack','send','map','rawAttributes','fieldName','type','key','name','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','ZendeskField','includeAll','include','findAll','rows','show','params','model','options','find','create','body','catch','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply'];(function(_0x485f35,_0x45a0fc){var _0x2ad118=function(_0x296650){while(--_0x296650){_0x485f35['push'](_0x485f35['shift']());}};_0x2ad118(++_0x45a0fc);}(_0xf01b,0x167));var _0xbf01=function(_0x1842bc,_0x1aa1db){_0x1842bc=_0x1842bc-0x0;var _0x4020f4=_0xf01b[_0x1842bc];return _0x4020f4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbf01('0x0'));var zipdir=require(_0xbf01('0x1'));var jsonpatch=require(_0xbf01('0x2'));var rp=require(_0xbf01('0x3'));var moment=require(_0xbf01('0x4'));var BPromise=require(_0xbf01('0x5'));var Mustache=require(_0xbf01('0x6'));var util=require(_0xbf01('0x7'));var path=require('path');var sox=require(_0xbf01('0x8'));var csv=require(_0xbf01('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbf01('0xa'));var _=require('lodash');var squel=require(_0xbf01('0xb'));var crypto=require(_0xbf01('0xc'));var jsforce=require(_0xbf01('0xd'));var deskjs=require(_0xbf01('0xe'));var toCsv=require(_0xbf01('0x9'));var querystring=require(_0xbf01('0xf'));var Papa=require('papaparse');var Redis=require(_0xbf01('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xbf01('0x11'));var as=require(_0xbf01('0x12'));var hardwareService=require(_0xbf01('0x13'));var logger=require(_0xbf01('0x14'))('api');var utils=require(_0xbf01('0x15'));var config=require(_0xbf01('0x16'));var licenseUtil=require(_0xbf01('0x17'));var db=require(_0xbf01('0x18'))['db'];function respondWithStatusCode(_0x53274b,_0x40ca5d){_0x40ca5d=_0x40ca5d||0xcc;return function(_0x1b5561){if(_0x1b5561){return _0x53274b[_0xbf01('0x19')](_0x40ca5d);}return _0x53274b[_0xbf01('0x1a')](_0x40ca5d)[_0xbf01('0x1b')]();};}function respondWithResult(_0x539f29,_0x637368){_0x637368=_0x637368||0xc8;return function(_0x27a191){if(_0x27a191){return _0x539f29[_0xbf01('0x1a')](_0x637368)[_0xbf01('0x1c')](_0x27a191);}};}function respondWithFilteredResult(_0x5bd59c,_0x4e86a3){return function(_0x7081ef){if(_0x7081ef){var _0x130d38=typeof _0x4e86a3[_0xbf01('0x1d')]===_0xbf01('0x1e')&&typeof _0x4e86a3[_0xbf01('0x1f')]==='undefined';var _0x56c7cf=_0x7081ef[_0xbf01('0x20')];var _0x2a08ce=_0x130d38?0x0:_0x4e86a3[_0xbf01('0x1d')];var _0x2f8717=_0x130d38?_0x7081ef[_0xbf01('0x20')]:_0x4e86a3['offset']+_0x4e86a3[_0xbf01('0x1f')];var _0x177a60;if(_0x2f8717>=_0x56c7cf){_0x2f8717=_0x56c7cf;_0x177a60=0xc8;}else{_0x177a60=0xce;}_0x5bd59c[_0xbf01('0x1a')](_0x177a60);return _0x5bd59c[_0xbf01('0x21')](_0xbf01('0x22'),_0x2a08ce+'-'+_0x2f8717+'/'+_0x56c7cf)[_0xbf01('0x1c')](_0x7081ef);}return null;};}function patchUpdates(_0x4ef93d){return function(_0x1bd803){try{jsonpatch[_0xbf01('0x23')](_0x1bd803,_0x4ef93d,!![]);}catch(_0x3c1d53){return BPromise[_0xbf01('0x24')](_0x3c1d53);}return _0x1bd803[_0xbf01('0x25')]();};}function saveUpdates(_0x195f17,_0x5c50a5){return function(_0x9aa599){if(_0x9aa599){return _0x9aa599[_0xbf01('0x26')](_0x195f17)[_0xbf01('0x27')](function(_0x37dfee){return _0x37dfee;});}return null;};}function removeEntity(_0x22b6b8,_0x4614a5){return function(_0x158c7d){if(_0x158c7d){return _0x158c7d[_0xbf01('0x28')]()[_0xbf01('0x27')](function(){_0x22b6b8[_0xbf01('0x1a')](0xcc)[_0xbf01('0x1b')]();});}};}function handleEntityNotFound(_0x580d90,_0x15bf92){return function(_0x488c17){if(!_0x488c17){_0x580d90[_0xbf01('0x19')](0x194);}return _0x488c17;};}function handleError(_0x41d174,_0x446b8b){_0x446b8b=_0x446b8b||0x1f4;return function(_0xcb7d74){logger[_0xbf01('0x29')](_0xcb7d74[_0xbf01('0x2a')]);if(_0xcb7d74['name']){delete _0xcb7d74['name'];}_0x41d174[_0xbf01('0x1a')](_0x446b8b)[_0xbf01('0x2b')](_0xcb7d74);};}exports['index']=function(_0x78f103,_0x279932){var _0x3ef668={},_0x396a8f={},_0xd42467={'count':0x0,'rows':[]};var _0x3a5f15=_[_0xbf01('0x2c')](db['ZendeskField'][_0xbf01('0x2d')],function(_0x427672){return{'name':_0x427672[_0xbf01('0x2e')],'type':_0x427672[_0xbf01('0x2f')][_0xbf01('0x30')]};});_0x396a8f['model']=_[_0xbf01('0x2c')](_0x3a5f15,_0xbf01('0x31'));_0x396a8f['query']=_[_0xbf01('0x32')](_0x78f103[_0xbf01('0x33')]);_0x396a8f['filters']=_[_0xbf01('0x34')](_0x396a8f['model'],_0x396a8f[_0xbf01('0x33')]);_0x3ef668[_0xbf01('0x35')]=_[_0xbf01('0x34')](_0x396a8f['model'],qs['fields'](_0x78f103[_0xbf01('0x33')][_0xbf01('0x36')]));_0x3ef668[_0xbf01('0x35')]=_0x3ef668[_0xbf01('0x35')][_0xbf01('0x37')]?_0x3ef668['attributes']:_0x396a8f['model'];if(!_0x78f103[_0xbf01('0x33')][_0xbf01('0x38')](_0xbf01('0x39'))){_0x3ef668['limit']=qs['limit'](_0x78f103[_0xbf01('0x33')]['limit']);_0x3ef668['offset']=qs[_0xbf01('0x1d')](_0x78f103[_0xbf01('0x33')]['offset']);}_0x3ef668[_0xbf01('0x3a')]=qs[_0xbf01('0x3b')](_0x78f103[_0xbf01('0x33')]['sort']);_0x3ef668[_0xbf01('0x3c')]=qs[_0xbf01('0x3d')](_[_0xbf01('0x3e')](_0x78f103['query'],_0x396a8f[_0xbf01('0x3d')]),_0x3a5f15);if(_0x78f103[_0xbf01('0x33')][_0xbf01('0x3f')]){_0x3ef668[_0xbf01('0x3c')]=_[_0xbf01('0x40')](_0x3ef668[_0xbf01('0x3c')],{'$or':_[_0xbf01('0x2c')](_0x3a5f15,function(_0x2ce190){if(_0x2ce190[_0xbf01('0x2f')]!==_0xbf01('0x41')){var _0x21be82={};_0x21be82[_0x2ce190[_0xbf01('0x31')]]={'$like':'%'+_0x78f103['query'][_0xbf01('0x3f')]+'%'};return _0x21be82;}})});}_0x3ef668=_[_0xbf01('0x40')]({},_0x3ef668,_0x78f103['options']);var _0x5296d0={'where':_0x3ef668[_0xbf01('0x3c')]};return db[_0xbf01('0x42')][_0xbf01('0x20')](_0x5296d0)[_0xbf01('0x27')](function(_0x3c9608){_0xd42467['count']=_0x3c9608;if(_0x78f103[_0xbf01('0x33')][_0xbf01('0x43')]){_0x3ef668[_0xbf01('0x44')]=[{'all':!![]}];}return db[_0xbf01('0x42')][_0xbf01('0x45')](_0x3ef668);})['then'](function(_0x3c8f51){_0xd42467[_0xbf01('0x46')]=_0x3c8f51;return _0xd42467;})[_0xbf01('0x27')](respondWithFilteredResult(_0x279932,_0x3ef668))['catch'](handleError(_0x279932,null));};exports[_0xbf01('0x47')]=function(_0x5a9a65,_0x39242a){var _0x1134e7={'raw':!![],'where':{'id':_0x5a9a65[_0xbf01('0x48')]['id']}},_0x4089c4={};_0x4089c4[_0xbf01('0x49')]=_[_0xbf01('0x32')](db[_0xbf01('0x42')][_0xbf01('0x2d')]);_0x4089c4[_0xbf01('0x33')]=_[_0xbf01('0x32')](_0x5a9a65[_0xbf01('0x33')]);_0x4089c4[_0xbf01('0x3d')]=_[_0xbf01('0x34')](_0x4089c4[_0xbf01('0x49')],_0x4089c4[_0xbf01('0x33')]);_0x1134e7[_0xbf01('0x35')]=_[_0xbf01('0x34')](_0x4089c4[_0xbf01('0x49')],qs['fields'](_0x5a9a65[_0xbf01('0x33')][_0xbf01('0x36')]));_0x1134e7[_0xbf01('0x35')]=_0x1134e7['attributes'][_0xbf01('0x37')]?_0x1134e7['attributes']:_0x4089c4['model'];if(_0x5a9a65[_0xbf01('0x33')][_0xbf01('0x43')]){_0x1134e7[_0xbf01('0x44')]=[{'all':!![]}];}_0x1134e7=_['merge']({},_0x1134e7,_0x5a9a65[_0xbf01('0x4a')]);return db[_0xbf01('0x42')][_0xbf01('0x4b')](_0x1134e7)[_0xbf01('0x27')](handleEntityNotFound(_0x39242a,null))[_0xbf01('0x27')](respondWithResult(_0x39242a,null))['catch'](handleError(_0x39242a,null));};exports[_0xbf01('0x4c')]=function(_0x29c3d0,_0x123f3a){return db['ZendeskField'][_0xbf01('0x4c')](_0x29c3d0[_0xbf01('0x4d')],{})[_0xbf01('0x27')](respondWithResult(_0x123f3a,0xc9))[_0xbf01('0x4e')](handleError(_0x123f3a,null));};exports[_0xbf01('0x26')]=function(_0x480819,_0x43b7c1){if(_0x480819['body']['id']){delete _0x480819['body']['id'];}return db[_0xbf01('0x42')][_0xbf01('0x4b')]({'where':{'id':_0x480819[_0xbf01('0x48')]['id']}})[_0xbf01('0x27')](handleEntityNotFound(_0x43b7c1,null))[_0xbf01('0x27')](saveUpdates(_0x480819[_0xbf01('0x4d')],null))[_0xbf01('0x27')](respondWithResult(_0x43b7c1,null))['catch'](handleError(_0x43b7c1,null));};exports['destroy']=function(_0x2b9bfd,_0x1cd506){return db['ZendeskField'][_0xbf01('0x4b')]({'where':{'id':_0x2b9bfd[_0xbf01('0x48')]['id']}})[_0xbf01('0x27')](handleEntityNotFound(_0x1cd506,null))[_0xbf01('0x27')](removeEntity(_0x1cd506,null))[_0xbf01('0x4e')](handleError(_0x1cd506,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index a1b6bc9..7687ab5 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 _0x43ed=['define','ZendeskField','int_zendesk_fields','zendesk_unique_index','lodash','util','api','bluebird','path','rimraf','./intZendeskField.attributes','exports'];(function(_0x11cad2,_0x12034b){var _0x1f142f=function(_0xa0d2d9){while(--_0xa0d2d9){_0x11cad2['push'](_0x11cad2['shift']());}};_0x1f142f(++_0x12034b);}(_0x43ed,0xc4));var _0xd43e=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x43ed[_0x31e29a];return _0x32d892;};'use strict';var _=require(_0xd43e('0x0'));var util=require(_0xd43e('0x1'));var logger=require('../../config/logger')(_0xd43e('0x2'));var moment=require('moment');var BPromise=require(_0xd43e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd43e('0x4'));var rimraf=require(_0xd43e('0x5'));var config=require('../../config/environment');var attributes=require(_0xd43e('0x6'));module[_0xd43e('0x7')]=function(_0x368bfa,_0x466e36){return _0x368bfa[_0xd43e('0x8')](_0xd43e('0x9'),attributes,{'tableName':_0xd43e('0xa'),'paranoid':![],'indexes':[{'name':_0xd43e('0xb'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5aa7=['../../config/logger','api','bluebird','request-promise','path','../../config/environment','./intZendeskField.attributes','exports','define','ZendeskField','zendesk_unique_index','idField','FieldId','lodash','util'];(function(_0x551630,_0x571bb9){var _0x5312fa=function(_0x1e0a22){while(--_0x1e0a22){_0x551630['push'](_0x551630['shift']());}};_0x5312fa(++_0x571bb9);}(_0x5aa7,0x94));var _0x75aa=function(_0x477361,_0x450ebc){_0x477361=_0x477361-0x0;var _0x2bd912=_0x5aa7[_0x477361];return _0x2bd912;};'use strict';var _=require(_0x75aa('0x0'));var util=require(_0x75aa('0x1'));var logger=require(_0x75aa('0x2'))(_0x75aa('0x3'));var moment=require('moment');var BPromise=require(_0x75aa('0x4'));var rp=require(_0x75aa('0x5'));var fs=require('fs');var path=require(_0x75aa('0x6'));var rimraf=require('rimraf');var config=require(_0x75aa('0x7'));var attributes=require(_0x75aa('0x8'));module[_0x75aa('0x9')]=function(_0x40f898,_0x186428){return _0x40f898[_0x75aa('0xa')](_0x75aa('0xb'),attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':_0x75aa('0xc'),'fields':[_0x75aa('0xd'),_0x75aa('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.rpc.js b/server/api/intZendeskField/intZendeskField.rpc.js index 0c0ca94..a3badbf 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 _0xb4c9=['message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x459b74,_0x5773bd){var _0x46cb16=function(_0x97867f){while(--_0x97867f){_0x459b74['push'](_0x459b74['shift']());}};_0x46cb16(++_0x5773bd);}(_0xb4c9,0x124));var _0x9b4c=function(_0x58fba2,_0xca1fdb){_0x58fba2=_0x58fba2-0x0;var _0x36a16f=_0xb4c9[_0x58fba2];return _0x36a16f;};'use strict';var _=require(_0x9b4c('0x0'));var util=require(_0x9b4c('0x1'));var moment=require(_0x9b4c('0x2'));var BPromise=require(_0x9b4c('0x3'));var rs=require(_0x9b4c('0x4'));var fs=require('fs');var Redis=require(_0x9b4c('0x5'));var db=require(_0x9b4c('0x6'))['db'];var utils=require(_0x9b4c('0x7'));var logger=require(_0x9b4c('0x8'))('rpc');var config=require(_0x9b4c('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x9b4c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2a49cd,_0x26696f,_0x49ca4d){return new BPromise(function(_0x2418a2,_0x219830){return client[_0x9b4c('0xb')](_0x2a49cd,_0x49ca4d)[_0x9b4c('0xc')](function(_0x5b85bf){logger['info'](_0x9b4c('0xd'),_0x26696f,_0x9b4c('0xe'));logger[_0x9b4c('0xf')](_0x9b4c('0x10'),_0x26696f,_0x9b4c('0xe'),JSON[_0x9b4c('0x11')](_0x5b85bf));if(_0x5b85bf[_0x9b4c('0x12')]){if(_0x5b85bf[_0x9b4c('0x12')][_0x9b4c('0x13')]===0x1f4){logger[_0x9b4c('0x12')](_0x9b4c('0xd'),_0x26696f,_0x5b85bf[_0x9b4c('0x12')]['message']);return _0x219830(_0x5b85bf['error']['message']);}logger[_0x9b4c('0x12')](_0x9b4c('0xd'),_0x26696f,_0x5b85bf['error'][_0x9b4c('0x14')]);return _0x2418a2(_0x5b85bf[_0x9b4c('0x12')][_0x9b4c('0x14')]);}else{logger[_0x9b4c('0x15')](_0x9b4c('0xd'),_0x26696f,_0x9b4c('0xe'));_0x2418a2(_0x5b85bf[_0x9b4c('0x16')][_0x9b4c('0x14')]);}})[_0x9b4c('0x17')](function(_0xf17197){logger['error'](_0x9b4c('0xd'),_0x26696f,_0xf17197);_0x219830(_0xf17197);});});} \ No newline at end of file +var _0x3745=['request','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http'];(function(_0x47df54,_0x1aeb61){var _0x261b87=function(_0x54bc77){while(--_0x54bc77){_0x47df54['push'](_0x47df54['shift']());}};_0x261b87(++_0x1aeb61);}(_0x3745,0x1e6));var _0x5374=function(_0x34725a,_0x443114){_0x34725a=_0x34725a-0x0;var _0x1739ef=_0x3745[_0x34725a];return _0x1739ef;};'use strict';var _=require('lodash');var util=require(_0x5374('0x0'));var moment=require(_0x5374('0x1'));var BPromise=require(_0x5374('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5374('0x3'))['db'];var utils=require(_0x5374('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x5374('0x5'));var jayson=require(_0x5374('0x6'));var client=jayson['client'][_0x5374('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x21ad86,_0x565a0b,_0x11bfb8){return new BPromise(function(_0xae743,_0x5717b){return client[_0x5374('0x8')](_0x21ad86,_0x11bfb8)[_0x5374('0x9')](function(_0x175448){logger[_0x5374('0xa')](_0x5374('0xb'),_0x565a0b,_0x5374('0xc'));logger[_0x5374('0xd')](_0x5374('0xe'),_0x565a0b,_0x5374('0xc'),JSON['stringify'](_0x175448));if(_0x175448['error']){if(_0x175448[_0x5374('0xf')][_0x5374('0x10')]===0x1f4){logger['error'](_0x5374('0xb'),_0x565a0b,_0x175448[_0x5374('0xf')][_0x5374('0x11')]);return _0x5717b(_0x175448['error'][_0x5374('0x11')]);}logger[_0x5374('0xf')](_0x5374('0xb'),_0x565a0b,_0x175448[_0x5374('0xf')][_0x5374('0x11')]);return _0xae743(_0x175448['error']['message']);}else{logger[_0x5374('0xa')](_0x5374('0xb'),_0x565a0b,_0x5374('0xc'));_0xae743(_0x175448['result']['message']);}})[_0x5374('0x12')](function(_0x28a4d8){logger[_0x5374('0xf')](_0x5374('0xb'),_0x565a0b,_0x28a4d8);_0x5717b(_0x28a4d8);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index c4b1cf8..dc8f538 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 _0x1a52=['post','create','addConfiguration','update','delete','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','isAuthenticated','get','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields'];(function(_0x810e4d,_0x909ef4){var _0x13f01c=function(_0x12fd89){while(--_0x12fd89){_0x810e4d['push'](_0x810e4d['shift']());}};_0x13f01c(++_0x909ef4);}(_0x1a52,0x127));var _0x21a5=function(_0x5b027e,_0x96d5bc){_0x5b027e=_0x5b027e-0x0;var _0x4f96c4=_0x1a52[_0x5b027e];return _0x4f96c4;};'use strict';var multer=require(_0x21a5('0x0'));var util=require(_0x21a5('0x1'));var path=require(_0x21a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x21a5('0x3'));var router=express['Router']();var fs_extra=require(_0x21a5('0x4'));var auth=require(_0x21a5('0x5'));var interaction=require(_0x21a5('0x6'));var config=require(_0x21a5('0x7'));var controller=require(_0x21a5('0x8'));router['get']('/',auth[_0x21a5('0x9')](),controller['index']);router[_0x21a5('0xa')](_0x21a5('0xb'),auth[_0x21a5('0x9')](),controller[_0x21a5('0xc')]);router[_0x21a5('0xa')](_0x21a5('0xd'),auth[_0x21a5('0x9')](),controller[_0x21a5('0xe')]);router['get'](_0x21a5('0xf'),auth[_0x21a5('0x9')](),controller[_0x21a5('0x10')]);router[_0x21a5('0x11')]('/',auth[_0x21a5('0x9')](),controller[_0x21a5('0x12')]);router[_0x21a5('0x11')]('/:id/configurations',auth[_0x21a5('0x9')](),controller[_0x21a5('0x13')]);router['put'](_0x21a5('0xb'),auth['isAuthenticated'](),controller[_0x21a5('0x14')]);router[_0x21a5('0x15')](_0x21a5('0xb'),auth[_0x21a5('0x9')](),controller[_0x21a5('0x16')]);module[_0x21a5('0x17')]=router; \ No newline at end of file +var _0x80e5=['multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','getFields','create','post','addConfiguration','delete','destroy','exports'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x80e5,0x7e));var _0x580e=function(_0x5ff517,_0x3e4ee0){_0x5ff517=_0x5ff517-0x0;var _0x19a245=_0x80e5[_0x5ff517];return _0x19a245;};'use strict';var multer=require(_0x580e('0x0'));var util=require('util');var path=require(_0x580e('0x1'));var timeout=require(_0x580e('0x2'));var express=require('express');var router=express[_0x580e('0x3')]();var fs_extra=require(_0x580e('0x4'));var auth=require(_0x580e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x580e('0x6'));var controller=require('./intZohoAccount.controller');router[_0x580e('0x7')]('/',auth[_0x580e('0x8')](),controller[_0x580e('0x9')]);router[_0x580e('0x7')](_0x580e('0xa'),auth['isAuthenticated'](),controller[_0x580e('0xb')]);router['get'](_0x580e('0xc'),auth[_0x580e('0x8')](),controller[_0x580e('0xd')]);router[_0x580e('0x7')]('/:id/fields',auth[_0x580e('0x8')](),controller[_0x580e('0xe')]);router['post']('/',auth[_0x580e('0x8')](),controller[_0x580e('0xf')]);router[_0x580e('0x10')](_0x580e('0xc'),auth[_0x580e('0x8')](),controller[_0x580e('0x11')]);router['put'](_0x580e('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x580e('0x12')](_0x580e('0xa'),auth['isAuthenticated'](),controller[_0x580e('0x13')]);module[_0x580e('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 0280f65..ae86f6d 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 _0xdace=['STRING','sequelize'];(function(_0xbbdfcb,_0x262d85){var _0x4e047b=function(_0x30a153){while(--_0x30a153){_0xbbdfcb['push'](_0xbbdfcb['shift']());}};_0x4e047b(++_0x262d85);}(_0xdace,0xc5));var _0xedac=function(_0x5b740b,_0x381833){_0x5b740b=_0x5b740b-0x0;var _0x6f8f4e=_0xdace[_0x5b740b];return _0x6f8f4e;};'use strict';var Sequelize=require(_0xedac('0x0'));module['exports']={'name':{'type':Sequelize[_0xedac('0x1')]},'description':{'type':Sequelize[_0xedac('0x1')]},'host':{'type':Sequelize[_0xedac('0x1')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xedac('0x1')]},'clientSecret':{'type':Sequelize[_0xedac('0x1')]},'serverUrl':{'type':Sequelize[_0xedac('0x1')],'allowNull':![]},'code':{'type':Sequelize[_0xedac('0x1')]},'refreshToken':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xdace=['STRING','sequelize'];(function(_0x255917,_0x1e17be){var _0x21b02f=function(_0x38e019){while(--_0x38e019){_0x255917['push'](_0x255917['shift']());}};_0x21b02f(++_0x1e17be);}(_0xdace,0xc5));var _0xedac=function(_0x571a17,_0x63fb3d){_0x571a17=_0x571a17-0x0;var _0x3ef337=_0xdace[_0x571a17];return _0x3ef337;};'use strict';var Sequelize=require(_0xedac('0x0'));module['exports']={'name':{'type':Sequelize[_0xedac('0x1')]},'description':{'type':Sequelize[_0xedac('0x1')]},'host':{'type':Sequelize[_0xedac('0x1')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xedac('0x1')]},'clientSecret':{'type':Sequelize[_0xedac('0x1')]},'serverUrl':{'type':Sequelize[_0xedac('0x1')],'allowNull':![]},'code':{'type':Sequelize[_0xedac('0x1')]},'refreshToken':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 854cacb..5cbbfdb 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 _0x5725=['com','serverUrl','lastIndexOf','refreshToken','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','Calls','response','message','Owner','Subject','Description','Call_Duration','Call_Result','Call_Start_Time','Call_Type','remove','includes','api_name','system_mandatory','push','display_label','custom_field','picklist','pick_list_values','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','../../components/integrations/configuration','end','json','offset','undefined','limit','count','status','set','Content-Range','reject','update','then','destroy','error','stack','name','send','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','map','VIRTUAL','merge','options','ZohoAccount','includeAll','include','rows','catch','show','find','create','body','params','findOne','ZohoConfiguration','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','ZohoField','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','clientId','clientSecret','refresh_token','access_token','code','host','zoho.eu'];(function(_0x9f7bfd,_0x2fc934){var _0x5680bd=function(_0x3135cd){while(--_0x3135cd){_0x9f7bfd['push'](_0x9f7bfd['shift']());}};_0x5680bd(++_0x2fc934);}(_0x5725,0xa1));var _0x5572=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x5725[_0x2be8c2];return _0x97f531;};'use strict';var emlformat=require(_0x5572('0x0'));var rimraf=require(_0x5572('0x1'));var zipdir=require(_0x5572('0x2'));var jsonpatch=require(_0x5572('0x3'));var rp=require(_0x5572('0x4'));var moment=require(_0x5572('0x5'));var BPromise=require(_0x5572('0x6'));var Mustache=require(_0x5572('0x7'));var util=require(_0x5572('0x8'));var path=require(_0x5572('0x9'));var sox=require(_0x5572('0xa'));var csv=require(_0x5572('0xb'));var ejs=require(_0x5572('0xc'));var fs=require('fs');var fs_extra=require(_0x5572('0xd'));var _=require(_0x5572('0xe'));var squel=require(_0x5572('0xf'));var crypto=require(_0x5572('0x10'));var jsforce=require(_0x5572('0x11'));var deskjs=require(_0x5572('0x12'));var toCsv=require(_0x5572('0xb'));var querystring=require(_0x5572('0x13'));var Papa=require(_0x5572('0x14'));var Redis=require('ioredis');var authService=require(_0x5572('0x15'));var qs=require(_0x5572('0x16'));var as=require(_0x5572('0x17'));var hardwareService=require(_0x5572('0x18'));var logger=require(_0x5572('0x19'))(_0x5572('0x1a'));var utils=require('../../config/utils');var config=require(_0x5572('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0x5572('0x1c'))['db'];var integrations=require(_0x5572('0x1d'));function respondWithStatusCode(_0x4bd501,_0x4aca4c){_0x4aca4c=_0x4aca4c||0xcc;return function(_0x209c17){if(_0x209c17){return _0x4bd501['sendStatus'](_0x4aca4c);}return _0x4bd501['status'](_0x4aca4c)[_0x5572('0x1e')]();};}function respondWithResult(_0x148bd9,_0x13ad11){_0x13ad11=_0x13ad11||0xc8;return function(_0x374002){if(_0x374002){return _0x148bd9['status'](_0x13ad11)[_0x5572('0x1f')](_0x374002);}};}function respondWithFilteredResult(_0xd02bcc,_0x5a8230){return function(_0x3a761f){if(_0x3a761f){var _0x53fc14=typeof _0x5a8230[_0x5572('0x20')]===_0x5572('0x21')&&typeof _0x5a8230[_0x5572('0x22')]===_0x5572('0x21');var _0x45728a=_0x3a761f[_0x5572('0x23')];var _0x2af5e3=_0x53fc14?0x0:_0x5a8230[_0x5572('0x20')];var _0x47f257=_0x53fc14?_0x3a761f['count']:_0x5a8230[_0x5572('0x20')]+_0x5a8230['limit'];var _0x5bcfd9;if(_0x47f257>=_0x45728a){_0x47f257=_0x45728a;_0x5bcfd9=0xc8;}else{_0x5bcfd9=0xce;}_0xd02bcc[_0x5572('0x24')](_0x5bcfd9);return _0xd02bcc[_0x5572('0x25')](_0x5572('0x26'),_0x2af5e3+'-'+_0x47f257+'/'+_0x45728a)[_0x5572('0x1f')](_0x3a761f);}return null;};}function patchUpdates(_0x208eb3){return function(_0x3b88a2){try{jsonpatch['apply'](_0x3b88a2,_0x208eb3,!![]);}catch(_0x5971fa){return BPromise[_0x5572('0x27')](_0x5971fa);}return _0x3b88a2['save']();};}function saveUpdates(_0x63bb8d,_0x3b5395){return function(_0x293039){if(_0x293039){return _0x293039[_0x5572('0x28')](_0x63bb8d)[_0x5572('0x29')](function(_0x5c1e30){return _0x5c1e30;});}return null;};}function removeEntity(_0x19cc2b,_0x51f693){return function(_0x1955a4){if(_0x1955a4){return _0x1955a4[_0x5572('0x2a')]()['then'](function(){_0x19cc2b['status'](0xcc)[_0x5572('0x1e')]();});}};}function handleEntityNotFound(_0x104743,_0x588a62){return function(_0xc5449d){if(!_0xc5449d){_0x104743['sendStatus'](0x194);}return _0xc5449d;};}function handleError(_0x276f02,_0x52675b){_0x52675b=_0x52675b||0x1f4;return function(_0x3d4524){logger[_0x5572('0x2b')](_0x3d4524[_0x5572('0x2c')]);if(_0x3d4524[_0x5572('0x2d')]){delete _0x3d4524[_0x5572('0x2d')];}_0x276f02['status'](_0x52675b)[_0x5572('0x2e')](_0x3d4524);};}exports['index']=function(_0x26b388,_0x466513){var _0x14d265={},_0x3ae448={},_0x34f512={'count':0x0,'rows':[]};var _0x5e3a47=_['map'](db['ZohoAccount'][_0x5572('0x2f')],function(_0x5e6412){return{'name':_0x5e6412[_0x5572('0x30')],'type':_0x5e6412[_0x5572('0x31')][_0x5572('0x32')]};});_0x3ae448[_0x5572('0x33')]=_['map'](_0x5e3a47,'name');_0x3ae448['query']=_[_0x5572('0x34')](_0x26b388[_0x5572('0x35')]);_0x3ae448[_0x5572('0x36')]=_['intersection'](_0x3ae448['model'],_0x3ae448[_0x5572('0x35')]);_0x14d265[_0x5572('0x37')]=_[_0x5572('0x38')](_0x3ae448[_0x5572('0x33')],qs[_0x5572('0x39')](_0x26b388[_0x5572('0x35')][_0x5572('0x39')]));_0x14d265[_0x5572('0x37')]=_0x14d265[_0x5572('0x37')][_0x5572('0x3a')]?_0x14d265[_0x5572('0x37')]:_0x3ae448[_0x5572('0x33')];if(!_0x26b388[_0x5572('0x35')][_0x5572('0x3b')](_0x5572('0x3c'))){_0x14d265[_0x5572('0x22')]=qs[_0x5572('0x22')](_0x26b388[_0x5572('0x35')][_0x5572('0x22')]);_0x14d265[_0x5572('0x20')]=qs[_0x5572('0x20')](_0x26b388[_0x5572('0x35')][_0x5572('0x20')]);}_0x14d265['order']=qs[_0x5572('0x3d')](_0x26b388[_0x5572('0x35')][_0x5572('0x3d')]);_0x14d265[_0x5572('0x3e')]=qs['filters'](_[_0x5572('0x3f')](_0x26b388[_0x5572('0x35')],_0x3ae448[_0x5572('0x36')]),_0x5e3a47);if(_0x26b388['query'][_0x5572('0x40')]){_0x14d265[_0x5572('0x3e')]=_['merge'](_0x14d265[_0x5572('0x3e')],{'$or':_[_0x5572('0x41')](_0x5e3a47,function(_0x17adc4){if(_0x17adc4[_0x5572('0x31')]!==_0x5572('0x42')){var _0x5a6a06={};_0x5a6a06[_0x17adc4['name']]={'$like':'%'+_0x26b388[_0x5572('0x35')][_0x5572('0x40')]+'%'};return _0x5a6a06;}})});}_0x14d265=_[_0x5572('0x43')]({},_0x14d265,_0x26b388[_0x5572('0x44')]);var _0x40ad05={'where':_0x14d265[_0x5572('0x3e')]};return db[_0x5572('0x45')][_0x5572('0x23')](_0x40ad05)[_0x5572('0x29')](function(_0xe65e2b){_0x34f512['count']=_0xe65e2b;if(_0x26b388[_0x5572('0x35')][_0x5572('0x46')]){_0x14d265[_0x5572('0x47')]=[{'all':!![]}];}return db['ZohoAccount']['findAll'](_0x14d265);})['then'](function(_0x3aa99f){_0x34f512[_0x5572('0x48')]=_0x3aa99f;return _0x34f512;})['then'](respondWithFilteredResult(_0x466513,_0x14d265))[_0x5572('0x49')](handleError(_0x466513,null));};exports[_0x5572('0x4a')]=function(_0x54b307,_0x633bc3){var _0x3278cf={'raw':![],'where':{'id':_0x54b307['params']['id']}},_0x3114f5={};_0x3114f5[_0x5572('0x33')]=_[_0x5572('0x34')](db[_0x5572('0x45')]['rawAttributes']);_0x3114f5[_0x5572('0x35')]=_['keys'](_0x54b307[_0x5572('0x35')]);_0x3114f5[_0x5572('0x36')]=_[_0x5572('0x38')](_0x3114f5[_0x5572('0x33')],_0x3114f5['query']);_0x3278cf[_0x5572('0x37')]=_[_0x5572('0x38')](_0x3114f5[_0x5572('0x33')],qs[_0x5572('0x39')](_0x54b307[_0x5572('0x35')][_0x5572('0x39')]));_0x3278cf[_0x5572('0x37')]=_0x3278cf['attributes'][_0x5572('0x3a')]?_0x3278cf[_0x5572('0x37')]:_0x3114f5[_0x5572('0x33')];if(_0x54b307[_0x5572('0x35')][_0x5572('0x46')]){_0x3278cf['include']=[{'all':!![]}];}_0x3278cf=_[_0x5572('0x43')]({},_0x3278cf,_0x54b307[_0x5572('0x44')]);return db[_0x5572('0x45')][_0x5572('0x4b')](_0x3278cf)['then'](handleEntityNotFound(_0x633bc3,null))['then'](respondWithResult(_0x633bc3,null))['catch'](handleError(_0x633bc3,null));};exports[_0x5572('0x4c')]=function(_0x409f01,_0x4547f1){return db[_0x5572('0x45')][_0x5572('0x4c')](_0x409f01[_0x5572('0x4d')],{})['then'](respondWithResult(_0x4547f1,0xc9))[_0x5572('0x49')](handleError(_0x4547f1,null));};exports['update']=function(_0x358488,_0x345df0){if(_0x358488[_0x5572('0x4d')]['id']){delete _0x358488['body']['id'];}return db['ZohoAccount'][_0x5572('0x4b')]({'where':{'id':_0x358488[_0x5572('0x4e')]['id']}})[_0x5572('0x29')](handleEntityNotFound(_0x345df0,null))[_0x5572('0x29')](saveUpdates(_0x358488[_0x5572('0x4d')],null))[_0x5572('0x29')](respondWithResult(_0x345df0,null))[_0x5572('0x49')](handleError(_0x345df0,null));};exports['destroy']=function(_0x5b3214,_0x57f4e0){return db['ZohoAccount']['find']({'where':{'id':_0x5b3214[_0x5572('0x4e')]['id']}})[_0x5572('0x29')](handleEntityNotFound(_0x57f4e0,null))[_0x5572('0x29')](removeEntity(_0x57f4e0,null))[_0x5572('0x49')](handleError(_0x57f4e0,null));};exports['getConfigurations']=function(_0x5d0c5f,_0x16e9fd,_0x3bf735){var _0x5c4789={};var _0x1f6e6c={};var _0x3037ba;var _0xb41520;return db[_0x5572('0x45')][_0x5572('0x4f')]({'where':{'id':_0x5d0c5f[_0x5572('0x4e')]['id']}})[_0x5572('0x29')](handleEntityNotFound(_0x16e9fd,null))[_0x5572('0x29')](function(_0x32f389){if(_0x32f389){_0x3037ba=_0x32f389;_0x1f6e6c['model']=_[_0x5572('0x34')](db[_0x5572('0x50')]['rawAttributes']);_0x1f6e6c[_0x5572('0x35')]=_[_0x5572('0x34')](_0x5d0c5f[_0x5572('0x35')]);_0x1f6e6c[_0x5572('0x36')]=_[_0x5572('0x38')](_0x1f6e6c[_0x5572('0x33')],_0x1f6e6c[_0x5572('0x35')]);_0x5c4789[_0x5572('0x37')]=_[_0x5572('0x38')](_0x1f6e6c[_0x5572('0x33')],qs[_0x5572('0x39')](_0x5d0c5f[_0x5572('0x35')]['fields']));_0x5c4789[_0x5572('0x37')]=_0x5c4789['attributes'][_0x5572('0x3a')]?_0x5c4789[_0x5572('0x37')]:_0x1f6e6c[_0x5572('0x33')];_0x5c4789['order']=qs[_0x5572('0x3d')](_0x5d0c5f[_0x5572('0x35')][_0x5572('0x3d')]);_0x5c4789[_0x5572('0x3e')]=qs[_0x5572('0x36')](_[_0x5572('0x3f')](_0x5d0c5f[_0x5572('0x35')],_0x1f6e6c['filters']));if(_0x5d0c5f['query'][_0x5572('0x40')]){_0x5c4789['where']=_[_0x5572('0x43')](_0x5c4789[_0x5572('0x3e')],{'$or':_['map'](_0x5c4789['attributes'],function(_0x1f152f){var _0x81ab58={};_0x81ab58[_0x1f152f]={'$like':'%'+_0x5d0c5f[_0x5572('0x35')]['filter']+'%'};return _0x81ab58;})});}_0x5c4789=_[_0x5572('0x43')]({},_0x5c4789,_0x5d0c5f['options']);return _0x3037ba[_0x5572('0x51')](_0x5c4789);}})[_0x5572('0x29')](function(_0xfda743){if(_0xfda743){_0xb41520=_0xfda743[_0x5572('0x3a')];if(!_0x5d0c5f['query']['hasOwnProperty'](_0x5572('0x3c'))){_0x5c4789[_0x5572('0x22')]=qs[_0x5572('0x22')](_0x5d0c5f[_0x5572('0x35')][_0x5572('0x22')]);_0x5c4789[_0x5572('0x20')]=qs[_0x5572('0x20')](_0x5d0c5f[_0x5572('0x35')]['offset']);}return _0x3037ba[_0x5572('0x51')](_0x5c4789);}})[_0x5572('0x29')](function(_0x263f47){if(_0x263f47){return _0x263f47?{'count':_0xb41520,'rows':_0x263f47}:null;}})[_0x5572('0x29')](respondWithResult(_0x16e9fd,null))[_0x5572('0x49')](handleError(_0x16e9fd,null));};exports[_0x5572('0x52')]=function(_0x2617bf,_0x23ec99,_0x1ca628){if(_0x2617bf[_0x5572('0x4d')]['id']){delete _0x2617bf[_0x5572('0x4d')]['id'];}return db[_0x5572('0x45')][_0x5572('0x4f')]({'where':{'id':_0x2617bf['params']['id']}})[_0x5572('0x29')](handleEntityNotFound(_0x23ec99,null))[_0x5572('0x29')](function(_0x176c41){if(_0x176c41){_0x2617bf[_0x5572('0x4d')][_0x5572('0x53')]=_0x176c41['id'];_0x2617bf['body'][_0x5572('0x54')]=integrations[_0x5572('0x55')](_0x2617bf[_0x5572('0x4d')][_0x5572('0x56')],_0x2617bf[_0x5572('0x4d')][_0x5572('0x31')]);_0x2617bf['body'][_0x5572('0x57')]=integrations['getDescriptions'](_0x2617bf[_0x5572('0x4d')]['channel'],_0x2617bf[_0x5572('0x4d')][_0x5572('0x31')]);return db[_0x5572('0x50')][_0x5572('0x4c')](_0x2617bf[_0x5572('0x4d')],{'include':[{'model':db[_0x5572('0x58')],'as':'Subjects'},{'model':db['ZohoField'],'as':_0x5572('0x57')}]});}return null;})[_0x5572('0x29')](respondWithResult(_0x23ec99,null))[_0x5572('0x49')](handleError(_0x23ec99,null));};function getAccessToken(_0x9db04e){return new Promise(function(_0x2fa4c7,_0x55ccb6){var _0x38ce72;switch(_0x9db04e['zone']){case'US':_0x38ce72=_0x5572('0x59');break;case'AU':_0x38ce72=_0x5572('0x5a');break;case'EU':_0x38ce72=_0x5572('0x5b');break;case'IN':_0x38ce72=_0x5572('0x5c');break;case'CN':_0x38ce72=_0x5572('0x5d');break;default:_0x38ce72='https://accounts.zoho.eu';break;}var _0xbb3b4e={'method':'POST','uri':_0x38ce72+'/oauth/v2/token','qs':{'refresh_token':_0x9db04e['refreshToken'],'client_id':_0x9db04e[_0x5572('0x5e')],'client_secret':_0x9db04e[_0x5572('0x5f')],'grant_type':_0x5572('0x60')},'json':!![]};return rp(_0xbb3b4e)[_0x5572('0x29')](function(_0x49dcb4){if(_0x49dcb4[_0x5572('0x61')]){_0x2fa4c7(_0x49dcb4[_0x5572('0x61')]);}else{_0x55ccb6('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})['catch'](function(_0x27c001){_0x55ccb6(_0x27c001);});});}exports['getFields']=function(_0x501c86,_0x4005a0,_0x21d37c){var _0x1bf32b,_0x52a593,_0x22e8eb,_0x49f4d2,_0x4a2e76;return db[_0x5572('0x45')][_0x5572('0x4f')]({'where':{'id':_0x501c86['params']['id']},'attributes':['id','host','zone',_0x5572('0x5e'),_0x5572('0x5f'),'serverUrl',_0x5572('0x62'),'refreshToken']})[_0x5572('0x29')](handleEntityNotFound(_0x4005a0,null))[_0x5572('0x29')](function(_0x2dab62){_0x4a2e76=_0x2dab62;_0x1bf32b=_0x4a2e76[_0x5572('0x63')];_0x52a593=_0x1bf32b===_0x5572('0x64')?'eu':_0x5572('0x65');_0x22e8eb=_0x4a2e76[_0x5572('0x66')];var _0x4991eb=_0x22e8eb['slice'](-0x1);if(_0x4991eb==='/'||_0x4991eb==='\x5c'||_0x4991eb===':'){_0x22e8eb=_0x22e8eb['substring'](0x0,_0x22e8eb[_0x5572('0x67')](_0x4991eb));}if(!_0x4a2e76[_0x5572('0x68')]){throw new Error(_0x5572('0x69'));}return getAccessToken(_0x4a2e76);})[_0x5572('0x29')](function(_0x222777){if(_0x222777){return rp({'method':_0x5572('0x6a'),'uri':util[_0x5572('0x6b')]('https://www.zohoapis.%s/crm/v2/settings/fields',_0x52a593),'qs':{'module':_0x5572('0x6c')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x222777},'json':!![]});}})[_0x5572('0x29')](function(_0x49156b){if(_0x49156b){if(_0x49156b[_0x5572('0x6d')]&&_0x49156b[_0x5572('0x6d')][_0x5572('0x2b')]){throw new Error(_0x49156b[_0x5572('0x6d')]['error'][_0x5572('0x6e')]);}var _0x1aad74=[];var _0x4022b3=[];var _0x384de4=[_0x5572('0x6f'),_0x5572('0x70'),_0x5572('0x71'),'WhoId',_0x5572('0x72'),_0x5572('0x73'),_0x5572('0x74'),_0x5572('0x75')];_0x4022b3=_[_0x5572('0x76')](_0x49156b[_0x5572('0x39')],function(_0x162d62){return _0x384de4[_0x5572('0x77')](_0x162d62[_0x5572('0x78')]);});for(var _0x254348=0x0;_0x254348<_0x4022b3[_0x5572('0x3a')];_0x254348++){if(_0x4022b3[_0x254348][_0x5572('0x79')]===![]){_0x1aad74[_0x5572('0x7a')]({'id':_0x4022b3[_0x254348]['id'],'name':_0x4022b3[_0x254348][_0x5572('0x7b')],'custom':_0x4022b3[_0x254348][_0x5572('0x7c')],'options':_0x4022b3[_0x254348]['data_type']===_0x5572('0x7d')&&_0x4022b3[_0x254348][_0x5572('0x7e')][_0x5572('0x3a')]>-0x1?_['map'](_0x4022b3[_0x254348][_0x5572('0x7e')],function(_0x17cd28){return{'name':_0x17cd28,'value':_0x17cd28};}):[]});}}return{'count':_0x1aad74[_0x5572('0x3a')],'rows':_0x1aad74};}else{return{'count':0x0,'rows':[]};}})[_0x5572('0x29')](respondWithResult(_0x4005a0,null))[_0x5572('0x49')](function(_0x4f514d){var _0x33f231=_0x501c86[_0x5572('0x35')]['test']?0x1f4:_0x4f514d[_0x5572('0x7f')]||0x1f4;logger['error'](_0x5572('0x80'),_0x5572('0x81'),_0x33f231,JSON['stringify'](_0x4f514d));delete _0x4f514d[_0x5572('0x2d')];if(_0x33f231===0x191){_0x33f231=0x190;}_0x4005a0[_0x5572('0x24')](_0x33f231)[_0x5572('0x2e')](_0x501c86['query']['test']?{'message':_0x5572('0x82'),'statusCode':_0x4f514d[_0x5572('0x7f')]}:_0x4f514d);});}; \ No newline at end of file +var _0xd5dc=['ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','ZohoAccount','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','sort','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','params','find','create','body','getConfigurations','findOne','ZohoConfiguration','pick','options','hasOwnProperty','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','/oauth/v2/token','refreshToken','clientSecret','refresh_token','access_token','getFields','host','clientId','code','com','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','Zoho-oauthtoken\x20','response','message','Description','WhoId','Call_Result','Call_Start_Time','Call_Type','remove','includes','api_name','system_mandatory','push','display_label','custom_field','data_type','picklist','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','querystring','papaparse'];(function(_0x1c8c28,_0x3ee093){var _0x1f59b4=function(_0x29bcc0){while(--_0x29bcc0){_0x1c8c28['push'](_0x1c8c28['shift']());}};_0x1f59b4(++_0x3ee093);}(_0xd5dc,0x178));var _0xcd5d=function(_0x441070,_0x56479d){_0x441070=_0x441070-0x0;var _0x162254=_0xd5dc[_0x441070];return _0x162254;};'use strict';var emlformat=require(_0xcd5d('0x0'));var rimraf=require(_0xcd5d('0x1'));var zipdir=require(_0xcd5d('0x2'));var jsonpatch=require(_0xcd5d('0x3'));var rp=require(_0xcd5d('0x4'));var moment=require(_0xcd5d('0x5'));var BPromise=require(_0xcd5d('0x6'));var Mustache=require(_0xcd5d('0x7'));var util=require(_0xcd5d('0x8'));var path=require('path');var sox=require(_0xcd5d('0x9'));var csv=require(_0xcd5d('0xa'));var ejs=require(_0xcd5d('0xb'));var fs=require('fs');var fs_extra=require(_0xcd5d('0xc'));var _=require('lodash');var squel=require(_0xcd5d('0xd'));var crypto=require('crypto');var jsforce=require(_0xcd5d('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xcd5d('0xa'));var querystring=require(_0xcd5d('0xf'));var Papa=require(_0xcd5d('0x10'));var Redis=require(_0xcd5d('0x11'));var authService=require(_0xcd5d('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xcd5d('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcd5d('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xcd5d('0x15'));var licenseUtil=require(_0xcd5d('0x16'));var db=require(_0xcd5d('0x17'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x5f0c4d,_0x4b9c53){_0x4b9c53=_0x4b9c53||0xcc;return function(_0x3bafe5){if(_0x3bafe5){return _0x5f0c4d[_0xcd5d('0x18')](_0x4b9c53);}return _0x5f0c4d[_0xcd5d('0x19')](_0x4b9c53)[_0xcd5d('0x1a')]();};}function respondWithResult(_0x4f1dcb,_0x2b6e5f){_0x2b6e5f=_0x2b6e5f||0xc8;return function(_0x47de85){if(_0x47de85){return _0x4f1dcb[_0xcd5d('0x19')](_0x2b6e5f)['json'](_0x47de85);}};}function respondWithFilteredResult(_0x5dcb53,_0x4ba369){return function(_0x56861a){if(_0x56861a){var _0x2cfc7c=typeof _0x4ba369['offset']===_0xcd5d('0x1b')&&typeof _0x4ba369[_0xcd5d('0x1c')]==='undefined';var _0x471920=_0x56861a[_0xcd5d('0x1d')];var _0x4c5800=_0x2cfc7c?0x0:_0x4ba369[_0xcd5d('0x1e')];var _0x35c064=_0x2cfc7c?_0x56861a['count']:_0x4ba369[_0xcd5d('0x1e')]+_0x4ba369[_0xcd5d('0x1c')];var _0x486f1a;if(_0x35c064>=_0x471920){_0x35c064=_0x471920;_0x486f1a=0xc8;}else{_0x486f1a=0xce;}_0x5dcb53[_0xcd5d('0x19')](_0x486f1a);return _0x5dcb53[_0xcd5d('0x1f')](_0xcd5d('0x20'),_0x4c5800+'-'+_0x35c064+'/'+_0x471920)[_0xcd5d('0x21')](_0x56861a);}return null;};}function patchUpdates(_0x2b3fec){return function(_0x3b8717){try{jsonpatch[_0xcd5d('0x22')](_0x3b8717,_0x2b3fec,!![]);}catch(_0x2c6228){return BPromise[_0xcd5d('0x23')](_0x2c6228);}return _0x3b8717[_0xcd5d('0x24')]();};}function saveUpdates(_0x10d830,_0x299346){return function(_0x4cb5ed){if(_0x4cb5ed){return _0x4cb5ed[_0xcd5d('0x25')](_0x10d830)[_0xcd5d('0x26')](function(_0x433139){return _0x433139;});}return null;};}function removeEntity(_0x2dfa75,_0x91a191){return function(_0x1034a3){if(_0x1034a3){return _0x1034a3[_0xcd5d('0x27')]()['then'](function(){_0x2dfa75['status'](0xcc)[_0xcd5d('0x1a')]();});}};}function handleEntityNotFound(_0x27e9dc,_0x13fdd4){return function(_0x2a9f72){if(!_0x2a9f72){_0x27e9dc[_0xcd5d('0x18')](0x194);}return _0x2a9f72;};}function handleError(_0x425020,_0x39a4ec){_0x39a4ec=_0x39a4ec||0x1f4;return function(_0x29b991){logger[_0xcd5d('0x28')](_0x29b991[_0xcd5d('0x29')]);if(_0x29b991[_0xcd5d('0x2a')]){delete _0x29b991[_0xcd5d('0x2a')];}_0x425020['status'](_0x39a4ec)[_0xcd5d('0x2b')](_0x29b991);};}exports[_0xcd5d('0x2c')]=function(_0x107279,_0x2c7c63){var _0x349138={},_0x5bf55b={},_0x4fb75b={'count':0x0,'rows':[]};var _0x26920a=_[_0xcd5d('0x2d')](db[_0xcd5d('0x2e')][_0xcd5d('0x2f')],function(_0x7f02f9){return{'name':_0x7f02f9[_0xcd5d('0x30')],'type':_0x7f02f9[_0xcd5d('0x31')][_0xcd5d('0x32')]};});_0x5bf55b[_0xcd5d('0x33')]=_[_0xcd5d('0x2d')](_0x26920a,_0xcd5d('0x2a'));_0x5bf55b['query']=_[_0xcd5d('0x34')](_0x107279[_0xcd5d('0x35')]);_0x5bf55b[_0xcd5d('0x36')]=_[_0xcd5d('0x37')](_0x5bf55b[_0xcd5d('0x33')],_0x5bf55b[_0xcd5d('0x35')]);_0x349138[_0xcd5d('0x38')]=_[_0xcd5d('0x37')](_0x5bf55b[_0xcd5d('0x33')],qs[_0xcd5d('0x39')](_0x107279[_0xcd5d('0x35')][_0xcd5d('0x39')]));_0x349138['attributes']=_0x349138[_0xcd5d('0x38')][_0xcd5d('0x3a')]?_0x349138['attributes']:_0x5bf55b['model'];if(!_0x107279['query']['hasOwnProperty'](_0xcd5d('0x3b'))){_0x349138['limit']=qs[_0xcd5d('0x1c')](_0x107279[_0xcd5d('0x35')]['limit']);_0x349138[_0xcd5d('0x1e')]=qs[_0xcd5d('0x1e')](_0x107279[_0xcd5d('0x35')]['offset']);}_0x349138['order']=qs[_0xcd5d('0x3c')](_0x107279[_0xcd5d('0x35')][_0xcd5d('0x3c')]);_0x349138['where']=qs[_0xcd5d('0x36')](_['pick'](_0x107279[_0xcd5d('0x35')],_0x5bf55b[_0xcd5d('0x36')]),_0x26920a);if(_0x107279[_0xcd5d('0x35')][_0xcd5d('0x3d')]){_0x349138[_0xcd5d('0x3e')]=_[_0xcd5d('0x3f')](_0x349138[_0xcd5d('0x3e')],{'$or':_[_0xcd5d('0x2d')](_0x26920a,function(_0x4efb87){if(_0x4efb87['type']!==_0xcd5d('0x40')){var _0x189ee3={};_0x189ee3[_0x4efb87[_0xcd5d('0x2a')]]={'$like':'%'+_0x107279[_0xcd5d('0x35')][_0xcd5d('0x3d')]+'%'};return _0x189ee3;}})});}_0x349138=_[_0xcd5d('0x3f')]({},_0x349138,_0x107279['options']);var _0x146b63={'where':_0x349138[_0xcd5d('0x3e')]};return db[_0xcd5d('0x2e')][_0xcd5d('0x1d')](_0x146b63)['then'](function(_0x1b8b5b){_0x4fb75b[_0xcd5d('0x1d')]=_0x1b8b5b;if(_0x107279[_0xcd5d('0x35')][_0xcd5d('0x41')]){_0x349138[_0xcd5d('0x42')]=[{'all':!![]}];}return db[_0xcd5d('0x2e')][_0xcd5d('0x43')](_0x349138);})[_0xcd5d('0x26')](function(_0x29fad1){_0x4fb75b[_0xcd5d('0x44')]=_0x29fad1;return _0x4fb75b;})[_0xcd5d('0x26')](respondWithFilteredResult(_0x2c7c63,_0x349138))[_0xcd5d('0x45')](handleError(_0x2c7c63,null));};exports['show']=function(_0x51bf0b,_0x59b01c){var _0x467d1f={'raw':![],'where':{'id':_0x51bf0b[_0xcd5d('0x46')]['id']}},_0x89e592={};_0x89e592[_0xcd5d('0x33')]=_[_0xcd5d('0x34')](db[_0xcd5d('0x2e')]['rawAttributes']);_0x89e592[_0xcd5d('0x35')]=_[_0xcd5d('0x34')](_0x51bf0b[_0xcd5d('0x35')]);_0x89e592[_0xcd5d('0x36')]=_[_0xcd5d('0x37')](_0x89e592['model'],_0x89e592['query']);_0x467d1f['attributes']=_['intersection'](_0x89e592[_0xcd5d('0x33')],qs[_0xcd5d('0x39')](_0x51bf0b[_0xcd5d('0x35')][_0xcd5d('0x39')]));_0x467d1f[_0xcd5d('0x38')]=_0x467d1f[_0xcd5d('0x38')][_0xcd5d('0x3a')]?_0x467d1f[_0xcd5d('0x38')]:_0x89e592[_0xcd5d('0x33')];if(_0x51bf0b[_0xcd5d('0x35')][_0xcd5d('0x41')]){_0x467d1f['include']=[{'all':!![]}];}_0x467d1f=_[_0xcd5d('0x3f')]({},_0x467d1f,_0x51bf0b['options']);return db[_0xcd5d('0x2e')][_0xcd5d('0x47')](_0x467d1f)[_0xcd5d('0x26')](handleEntityNotFound(_0x59b01c,null))[_0xcd5d('0x26')](respondWithResult(_0x59b01c,null))[_0xcd5d('0x45')](handleError(_0x59b01c,null));};exports[_0xcd5d('0x48')]=function(_0x4c169f,_0x57d7be){return db[_0xcd5d('0x2e')][_0xcd5d('0x48')](_0x4c169f[_0xcd5d('0x49')],{})[_0xcd5d('0x26')](respondWithResult(_0x57d7be,0xc9))['catch'](handleError(_0x57d7be,null));};exports['update']=function(_0x8dcde7,_0x478425){if(_0x8dcde7[_0xcd5d('0x49')]['id']){delete _0x8dcde7['body']['id'];}return db['ZohoAccount'][_0xcd5d('0x47')]({'where':{'id':_0x8dcde7['params']['id']}})['then'](handleEntityNotFound(_0x478425,null))[_0xcd5d('0x26')](saveUpdates(_0x8dcde7[_0xcd5d('0x49')],null))[_0xcd5d('0x26')](respondWithResult(_0x478425,null))[_0xcd5d('0x45')](handleError(_0x478425,null));};exports[_0xcd5d('0x27')]=function(_0x1605e8,_0x39e446){return db['ZohoAccount']['find']({'where':{'id':_0x1605e8[_0xcd5d('0x46')]['id']}})[_0xcd5d('0x26')](handleEntityNotFound(_0x39e446,null))[_0xcd5d('0x26')](removeEntity(_0x39e446,null))[_0xcd5d('0x45')](handleError(_0x39e446,null));};exports[_0xcd5d('0x4a')]=function(_0x101dc3,_0x42989d,_0x3bb6b2){var _0x3336e7={};var _0x3b37da={};var _0x524452;var _0x445b1c;return db[_0xcd5d('0x2e')][_0xcd5d('0x4b')]({'where':{'id':_0x101dc3['params']['id']}})[_0xcd5d('0x26')](handleEntityNotFound(_0x42989d,null))[_0xcd5d('0x26')](function(_0x1efe7c){if(_0x1efe7c){_0x524452=_0x1efe7c;_0x3b37da[_0xcd5d('0x33')]=_['keys'](db[_0xcd5d('0x4c')][_0xcd5d('0x2f')]);_0x3b37da['query']=_['keys'](_0x101dc3['query']);_0x3b37da[_0xcd5d('0x36')]=_['intersection'](_0x3b37da[_0xcd5d('0x33')],_0x3b37da[_0xcd5d('0x35')]);_0x3336e7[_0xcd5d('0x38')]=_['intersection'](_0x3b37da[_0xcd5d('0x33')],qs[_0xcd5d('0x39')](_0x101dc3[_0xcd5d('0x35')][_0xcd5d('0x39')]));_0x3336e7[_0xcd5d('0x38')]=_0x3336e7['attributes'][_0xcd5d('0x3a')]?_0x3336e7[_0xcd5d('0x38')]:_0x3b37da[_0xcd5d('0x33')];_0x3336e7['order']=qs['sort'](_0x101dc3[_0xcd5d('0x35')]['sort']);_0x3336e7[_0xcd5d('0x3e')]=qs['filters'](_[_0xcd5d('0x4d')](_0x101dc3[_0xcd5d('0x35')],_0x3b37da['filters']));if(_0x101dc3['query'][_0xcd5d('0x3d')]){_0x3336e7[_0xcd5d('0x3e')]=_['merge'](_0x3336e7['where'],{'$or':_[_0xcd5d('0x2d')](_0x3336e7['attributes'],function(_0x1e392b){var _0x1a55ad={};_0x1a55ad[_0x1e392b]={'$like':'%'+_0x101dc3['query'][_0xcd5d('0x3d')]+'%'};return _0x1a55ad;})});}_0x3336e7=_['merge']({},_0x3336e7,_0x101dc3[_0xcd5d('0x4e')]);return _0x524452[_0xcd5d('0x4a')](_0x3336e7);}})[_0xcd5d('0x26')](function(_0x22372e){if(_0x22372e){_0x445b1c=_0x22372e[_0xcd5d('0x3a')];if(!_0x101dc3[_0xcd5d('0x35')][_0xcd5d('0x4f')]('nolimit')){_0x3336e7[_0xcd5d('0x1c')]=qs[_0xcd5d('0x1c')](_0x101dc3['query'][_0xcd5d('0x1c')]);_0x3336e7[_0xcd5d('0x1e')]=qs[_0xcd5d('0x1e')](_0x101dc3[_0xcd5d('0x35')][_0xcd5d('0x1e')]);}return _0x524452[_0xcd5d('0x4a')](_0x3336e7);}})['then'](function(_0x25e369){if(_0x25e369){return _0x25e369?{'count':_0x445b1c,'rows':_0x25e369}:null;}})[_0xcd5d('0x26')](respondWithResult(_0x42989d,null))[_0xcd5d('0x45')](handleError(_0x42989d,null));};exports[_0xcd5d('0x50')]=function(_0x1e393c,_0x11bd42,_0x418987){if(_0x1e393c['body']['id']){delete _0x1e393c[_0xcd5d('0x49')]['id'];}return db[_0xcd5d('0x2e')][_0xcd5d('0x4b')]({'where':{'id':_0x1e393c[_0xcd5d('0x46')]['id']}})[_0xcd5d('0x26')](handleEntityNotFound(_0x11bd42,null))[_0xcd5d('0x26')](function(_0x233089){if(_0x233089){_0x1e393c['body'][_0xcd5d('0x51')]=_0x233089['id'];_0x1e393c[_0xcd5d('0x49')][_0xcd5d('0x52')]=integrations['getSubjects'](_0x1e393c[_0xcd5d('0x49')][_0xcd5d('0x53')],_0x1e393c[_0xcd5d('0x49')][_0xcd5d('0x31')]);_0x1e393c[_0xcd5d('0x49')][_0xcd5d('0x54')]=integrations[_0xcd5d('0x55')](_0x1e393c[_0xcd5d('0x49')]['channel'],_0x1e393c[_0xcd5d('0x49')][_0xcd5d('0x31')]);return db[_0xcd5d('0x4c')][_0xcd5d('0x48')](_0x1e393c['body'],{'include':[{'model':db['ZohoField'],'as':_0xcd5d('0x52')},{'model':db[_0xcd5d('0x56')],'as':'Descriptions'}]});}return null;})[_0xcd5d('0x26')](respondWithResult(_0x11bd42,null))[_0xcd5d('0x45')](handleError(_0x11bd42,null));};function getAccessToken(_0x4c7276){return new Promise(function(_0x76eb87,_0x531722){var _0x16ac63;switch(_0x4c7276[_0xcd5d('0x57')]){case'US':_0x16ac63=_0xcd5d('0x58');break;case'AU':_0x16ac63=_0xcd5d('0x59');break;case'EU':_0x16ac63='https://accounts.zoho.eu';break;case'IN':_0x16ac63=_0xcd5d('0x5a');break;case'CN':_0x16ac63=_0xcd5d('0x5b');break;default:_0x16ac63=_0xcd5d('0x5c');break;}var _0x4c27e7={'method':'POST','uri':_0x16ac63+_0xcd5d('0x5d'),'qs':{'refresh_token':_0x4c7276[_0xcd5d('0x5e')],'client_id':_0x4c7276['clientId'],'client_secret':_0x4c7276[_0xcd5d('0x5f')],'grant_type':_0xcd5d('0x60')},'json':!![]};return rp(_0x4c27e7)[_0xcd5d('0x26')](function(_0x4223d2){if(_0x4223d2[_0xcd5d('0x61')]){_0x76eb87(_0x4223d2[_0xcd5d('0x61')]);}else{_0x531722('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})[_0xcd5d('0x45')](function(_0x3233cb){_0x531722(_0x3233cb);});});}exports[_0xcd5d('0x62')]=function(_0x32e55a,_0x2d1c0f,_0x5997ab){var _0x280ce7,_0x85373,_0x1c9631,_0x289a66,_0x342af9;return db[_0xcd5d('0x2e')][_0xcd5d('0x4b')]({'where':{'id':_0x32e55a[_0xcd5d('0x46')]['id']},'attributes':['id',_0xcd5d('0x63'),_0xcd5d('0x57'),_0xcd5d('0x64'),_0xcd5d('0x5f'),'serverUrl',_0xcd5d('0x65'),_0xcd5d('0x5e')]})[_0xcd5d('0x26')](handleEntityNotFound(_0x2d1c0f,null))['then'](function(_0x53409f){_0x342af9=_0x53409f;_0x280ce7=_0x342af9[_0xcd5d('0x63')];_0x85373=_0x280ce7==='zoho.eu'?'eu':_0xcd5d('0x66');_0x1c9631=_0x342af9['serverUrl'];var _0x19b956=_0x1c9631[_0xcd5d('0x67')](-0x1);if(_0x19b956==='/'||_0x19b956==='\x5c'||_0x19b956===':'){_0x1c9631=_0x1c9631[_0xcd5d('0x68')](0x0,_0x1c9631[_0xcd5d('0x69')](_0x19b956));}if(!_0x342af9[_0xcd5d('0x5e')]){throw new Error(_0xcd5d('0x6a'));}return getAccessToken(_0x342af9);})['then'](function(_0x34901b){if(_0x34901b){return rp({'method':_0xcd5d('0x6b'),'uri':util[_0xcd5d('0x6c')]('https://www.zohoapis.%s/crm/v2/settings/fields',_0x85373),'qs':{'module':'Calls'},'headers':{'Authorization':_0xcd5d('0x6d')+_0x34901b},'json':!![]});}})[_0xcd5d('0x26')](function(_0x5da291){if(_0x5da291){if(_0x5da291[_0xcd5d('0x6e')]&&_0x5da291[_0xcd5d('0x6e')][_0xcd5d('0x28')]){throw new Error(_0x5da291[_0xcd5d('0x6e')]['error'][_0xcd5d('0x6f')]);}var _0x2c24ac=[];var _0x3ee02d=[];var _0x1fc50d=['Owner','Subject',_0xcd5d('0x70'),_0xcd5d('0x71'),'Call_Duration',_0xcd5d('0x72'),_0xcd5d('0x73'),_0xcd5d('0x74')];_0x3ee02d=_[_0xcd5d('0x75')](_0x5da291[_0xcd5d('0x39')],function(_0x346a23){return _0x1fc50d[_0xcd5d('0x76')](_0x346a23[_0xcd5d('0x77')]);});for(var _0x4bb048=0x0;_0x4bb048<_0x3ee02d[_0xcd5d('0x3a')];_0x4bb048++){if(_0x3ee02d[_0x4bb048][_0xcd5d('0x78')]===![]){_0x2c24ac[_0xcd5d('0x79')]({'id':_0x3ee02d[_0x4bb048]['id'],'name':_0x3ee02d[_0x4bb048][_0xcd5d('0x7a')],'custom':_0x3ee02d[_0x4bb048][_0xcd5d('0x7b')],'options':_0x3ee02d[_0x4bb048][_0xcd5d('0x7c')]===_0xcd5d('0x7d')&&_0x3ee02d[_0x4bb048][_0xcd5d('0x7e')][_0xcd5d('0x3a')]>-0x1?_[_0xcd5d('0x2d')](_0x3ee02d[_0x4bb048][_0xcd5d('0x7e')],function(_0x7e562d){return{'name':_0x7e562d,'value':_0x7e562d};}):[]});}}return{'count':_0x2c24ac['length'],'rows':_0x2c24ac};}else{return{'count':0x0,'rows':[]};}})[_0xcd5d('0x26')](respondWithResult(_0x2d1c0f,null))[_0xcd5d('0x45')](function(_0x24c2a5){var _0x225db8=_0x32e55a[_0xcd5d('0x35')][_0xcd5d('0x7f')]?0x1f4:_0x24c2a5[_0xcd5d('0x80')]||0x1f4;logger['error'](_0xcd5d('0x81'),_0xcd5d('0x62'),_0x225db8,JSON['stringify'](_0x24c2a5));delete _0x24c2a5[_0xcd5d('0x2a')];if(_0x225db8===0x191){_0x225db8=0x190;}_0x2d1c0f[_0xcd5d('0x19')](_0x225db8)[_0xcd5d('0x2b')](_0x32e55a['query'][_0xcd5d('0x7f')]?{'message':_0xcd5d('0x82'),'statusCode':_0x24c2a5[_0xcd5d('0x80')]}:_0x24c2a5);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index b09c772..7438eb8 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 _0xdaf0=['inspect','slice','/oauth/v2/token','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','ZohoAccount','int_zoho_accounts','changed','zone','serverUrl','clientId','clientSecret','code','host','substring','lastIndexOf','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','authorization_code','application/x-www-form-urlencoded','then','parse','refresh_token','refreshToken','info','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','format'];(function(_0x430c06,_0x554ad6){var _0x5c8e8d=function(_0x41a6b3){while(--_0x41a6b3){_0x430c06['push'](_0x430c06['shift']());}};_0x5c8e8d(++_0x554ad6);}(_0xdaf0,0xfa));var _0x0daf=function(_0x5992bc,_0x459818){_0x5992bc=_0x5992bc-0x0;var _0x5dae8c=_0xdaf0[_0x5992bc];return _0x5dae8c;};'use strict';var _=require('lodash');var util=require(_0x0daf('0x0'));var logger=require('../../config/logger')(_0x0daf('0x1'));var moment=require(_0x0daf('0x2'));var BPromise=require(_0x0daf('0x3'));var rp=require(_0x0daf('0x4'));var fs=require('fs');var path=require(_0x0daf('0x5'));var rimraf=require(_0x0daf('0x6'));var config=require(_0x0daf('0x7'));var attributes=require(_0x0daf('0x8'));var integrations=require(_0x0daf('0x9'));module[_0x0daf('0xa')]=function(_0x51c744,_0x247ff0){return _0x51c744['define'](_0x0daf('0xb'),attributes,{'tableName':_0x0daf('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x345216,_0x545bb9,_0x5db94e){if(_0x345216[_0x0daf('0xd')](_0x0daf('0xe'))||_0x345216[_0x0daf('0xd')](_0x0daf('0xf'))||_0x345216['changed'](_0x0daf('0x10'))||_0x345216[_0x0daf('0xd')](_0x0daf('0x11'))||_0x345216[_0x0daf('0xd')](_0x0daf('0x12'))||_0x345216[_0x0daf('0xd')](_0x0daf('0x13'))){var _0xb48400,_0x468240;_0xb48400=_0x345216[_0x0daf('0xf')];var _0x456328=_0xb48400['slice'](-0x1);if(_0x456328==='/'||_0x456328==='\x5c'||_0x456328===':'){_0xb48400=_0xb48400[_0x0daf('0x14')](0x0,_0xb48400[_0x0daf('0x15')](_0x456328));}switch(_0x345216[_0x0daf('0xe')]){case'US':_0x468240='https://accounts.zoho.com';break;case'AU':_0x468240=_0x0daf('0x16');break;case'IN':_0x468240=_0x0daf('0x17');break;case'CN':_0x468240=_0x0daf('0x18');break;default:_0x468240=_0x0daf('0x19');break;}var _0x26fe9d={'method':'POST','uri':_0x468240+'/oauth/v2/token','form':{'grant_type':_0x0daf('0x1a'),'client_id':_0x345216['clientId'],'client_secret':_0x345216[_0x0daf('0x11')],'redirect_uri':_0x345216[_0x0daf('0xf')],'code':_0x345216[_0x0daf('0x12')]},'headers':{'Content-Type':_0x0daf('0x1b')}};return rp(_0x26fe9d)[_0x0daf('0x1c')](function(_0x2b35f9){var _0xcf9576=JSON[_0x0daf('0x1d')](_0x2b35f9);if(_0xcf9576[_0x0daf('0x1e')]){_0x345216[_0x0daf('0x1f')]=_0xcf9576[_0x0daf('0x1e')];logger[_0x0daf('0x20')](util['format'](_0x0daf('0x21'),_0x345216[_0x0daf('0x22')],_0x345216['id']));}else{logger[_0x0daf('0x23')](util[_0x0daf('0x24')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x345216[_0x0daf('0x22')],_0x345216['id']),util[_0x0daf('0x25')](_0xcf9576,{'showHidden':![],'depth':null}));}return _0x5db94e(null,_0x545bb9);})['catch'](function(_0x3b815c){logger[_0x0daf('0x23')](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x345216['name'],_0x345216['id']),util[_0x0daf('0x25')](parsedResult,{'showHidden':![],'depth':null}));return _0x5db94e(_0x3b815c);});}else{return _0x5db94e(null,_0x545bb9);}},'beforeUpdate':function(_0x63704e,_0x218e75,_0x3fe934){if(_0x63704e[_0x0daf('0xd')]('zone')||_0x63704e[_0x0daf('0xd')](_0x0daf('0xf'))||_0x63704e[_0x0daf('0xd')]('clientId')||_0x63704e[_0x0daf('0xd')](_0x0daf('0x11'))||_0x63704e[_0x0daf('0xd')]('code')||_0x63704e[_0x0daf('0xd')](_0x0daf('0x13'))){var _0x51f560,_0x2bacde;_0x51f560=_0x63704e[_0x0daf('0xf')];var _0x31c876=_0x51f560[_0x0daf('0x26')](-0x1);if(_0x31c876==='/'||_0x31c876==='\x5c'||_0x31c876===':'){_0x51f560=_0x51f560[_0x0daf('0x14')](0x0,_0x51f560[_0x0daf('0x15')](_0x31c876));}switch(_0x63704e[_0x0daf('0xe')]){case'US':_0x2bacde='https://accounts.zoho.com';break;case'AU':_0x2bacde='https://accounts.zoho.com.au';break;case'IN':_0x2bacde=_0x0daf('0x17');break;case'CN':_0x2bacde='https://accounts.zoho.com.cn';break;default:_0x2bacde=_0x0daf('0x19');break;}var _0x30e330={'method':'POST','uri':_0x2bacde+_0x0daf('0x27'),'form':{'grant_type':_0x0daf('0x1a'),'client_id':_0x63704e[_0x0daf('0x10')],'client_secret':_0x63704e['clientSecret'],'redirect_uri':_0x63704e[_0x0daf('0xf')],'code':_0x63704e['code']},'headers':{'Content-Type':_0x0daf('0x1b')}};return rp(_0x30e330)[_0x0daf('0x1c')](function(_0x18c5d0){var _0x17c000=JSON['parse'](_0x18c5d0);if(_0x17c000[_0x0daf('0x1e')]){_0x63704e[_0x0daf('0x1f')]=_0x17c000[_0x0daf('0x1e')];logger[_0x0daf('0x20')](util[_0x0daf('0x24')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x63704e[_0x0daf('0x22')],_0x63704e['id']));}else{logger[_0x0daf('0x23')](util[_0x0daf('0x24')](_0x0daf('0x28'),_0x63704e[_0x0daf('0x22')],_0x63704e['id']),util[_0x0daf('0x25')](_0x17c000,{'showHidden':![],'depth':null}));}return _0x3fe934(null,_0x218e75);})['catch'](function(_0x39a010){logger['error'](util[_0x0daf('0x24')](_0x0daf('0x28'),_0x63704e['name'],_0x63704e['id']),util[_0x0daf('0x25')](parsedResult,{'showHidden':![],'depth':null}));return _0x3fe934(_0x39a010);});}else{return _0x3fe934(null,_0x218e75);}}}});}; \ No newline at end of file +var _0x47a9=['bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','define','ZohoAccount','int_zoho_accounts','zone','serverUrl','clientId','changed','clientSecret','code','host','substring','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','then','parse','refreshToken','refresh_token','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','inspect','catch','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','lastIndexOf','application/x-www-form-urlencoded','info','lodash','util','../../config/logger','api','moment'];(function(_0x425f04,_0x277745){var _0x42fb05=function(_0x43f35a){while(--_0x43f35a){_0x425f04['push'](_0x425f04['shift']());}};_0x42fb05(++_0x277745);}(_0x47a9,0x190));var _0x947a=function(_0x1084f6,_0x4bd28c){_0x1084f6=_0x1084f6-0x0;var _0x14ffba=_0x47a9[_0x1084f6];return _0x14ffba;};'use strict';var _=require(_0x947a('0x0'));var util=require(_0x947a('0x1'));var logger=require(_0x947a('0x2'))(_0x947a('0x3'));var moment=require(_0x947a('0x4'));var BPromise=require(_0x947a('0x5'));var rp=require(_0x947a('0x6'));var fs=require('fs');var path=require(_0x947a('0x7'));var rimraf=require(_0x947a('0x8'));var config=require(_0x947a('0x9'));var attributes=require('./intZohoAccount.attributes');var integrations=require(_0x947a('0xa'));module[_0x947a('0xb')]=function(_0x4c88ac,_0x1df909){return _0x4c88ac[_0x947a('0xc')](_0x947a('0xd'),attributes,{'tableName':_0x947a('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0xeb0308,_0x286b73,_0x42d6ff){if(_0xeb0308['changed'](_0x947a('0xf'))||_0xeb0308['changed'](_0x947a('0x10'))||_0xeb0308['changed'](_0x947a('0x11'))||_0xeb0308[_0x947a('0x12')](_0x947a('0x13'))||_0xeb0308['changed'](_0x947a('0x14'))||_0xeb0308[_0x947a('0x12')](_0x947a('0x15'))){var _0x3ffc2a,_0x2a5040;_0x3ffc2a=_0xeb0308[_0x947a('0x10')];var _0x790af8=_0x3ffc2a['slice'](-0x1);if(_0x790af8==='/'||_0x790af8==='\x5c'||_0x790af8===':'){_0x3ffc2a=_0x3ffc2a[_0x947a('0x16')](0x0,_0x3ffc2a['lastIndexOf'](_0x790af8));}switch(_0xeb0308[_0x947a('0xf')]){case'US':_0x2a5040=_0x947a('0x17');break;case'AU':_0x2a5040=_0x947a('0x18');break;case'IN':_0x2a5040=_0x947a('0x19');break;case'CN':_0x2a5040=_0x947a('0x1a');break;default:_0x2a5040=_0x947a('0x1b');break;}var _0x2c7f0a={'method':_0x947a('0x1c'),'uri':_0x2a5040+_0x947a('0x1d'),'form':{'grant_type':_0x947a('0x1e'),'client_id':_0xeb0308['clientId'],'client_secret':_0xeb0308['clientSecret'],'redirect_uri':_0xeb0308[_0x947a('0x10')],'code':_0xeb0308['code']},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x2c7f0a)[_0x947a('0x1f')](function(_0x349859){var _0x25c3e6=JSON[_0x947a('0x20')](_0x349859);if(_0x25c3e6['refresh_token']){_0xeb0308[_0x947a('0x21')]=_0x25c3e6[_0x947a('0x22')];logger['info'](util[_0x947a('0x23')](_0x947a('0x24'),_0xeb0308[_0x947a('0x25')],_0xeb0308['id']));}else{logger[_0x947a('0x26')](util[_0x947a('0x23')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0xeb0308[_0x947a('0x25')],_0xeb0308['id']),util[_0x947a('0x27')](_0x25c3e6,{'showHidden':![],'depth':null}));}return _0x42d6ff(null,_0x286b73);})[_0x947a('0x28')](function(_0x18cb00){logger[_0x947a('0x26')](util[_0x947a('0x23')](_0x947a('0x29'),_0xeb0308[_0x947a('0x25')],_0xeb0308['id']),util[_0x947a('0x27')](parsedResult,{'showHidden':![],'depth':null}));return _0x42d6ff(_0x18cb00);});}else{return _0x42d6ff(null,_0x286b73);}},'beforeUpdate':function(_0x30bdce,_0x3612cb,_0x1591a2){if(_0x30bdce[_0x947a('0x12')](_0x947a('0xf'))||_0x30bdce['changed']('serverUrl')||_0x30bdce[_0x947a('0x12')]('clientId')||_0x30bdce[_0x947a('0x12')](_0x947a('0x13'))||_0x30bdce[_0x947a('0x12')](_0x947a('0x14'))||_0x30bdce[_0x947a('0x12')](_0x947a('0x15'))){var _0x3dfc5d,_0x528e12;_0x3dfc5d=_0x30bdce[_0x947a('0x10')];var _0x1f3d99=_0x3dfc5d['slice'](-0x1);if(_0x1f3d99==='/'||_0x1f3d99==='\x5c'||_0x1f3d99===':'){_0x3dfc5d=_0x3dfc5d['substring'](0x0,_0x3dfc5d[_0x947a('0x2a')](_0x1f3d99));}switch(_0x30bdce[_0x947a('0xf')]){case'US':_0x528e12=_0x947a('0x17');break;case'AU':_0x528e12=_0x947a('0x18');break;case'IN':_0x528e12=_0x947a('0x19');break;case'CN':_0x528e12=_0x947a('0x1a');break;default:_0x528e12=_0x947a('0x1b');break;}var _0x2ca6e6={'method':_0x947a('0x1c'),'uri':_0x528e12+_0x947a('0x1d'),'form':{'grant_type':'authorization_code','client_id':_0x30bdce[_0x947a('0x11')],'client_secret':_0x30bdce['clientSecret'],'redirect_uri':_0x30bdce[_0x947a('0x10')],'code':_0x30bdce[_0x947a('0x14')]},'headers':{'Content-Type':_0x947a('0x2b')}};return rp(_0x2ca6e6)[_0x947a('0x1f')](function(_0x28d7ab){var _0x41902f=JSON['parse'](_0x28d7ab);if(_0x41902f[_0x947a('0x22')]){_0x30bdce['refreshToken']=_0x41902f[_0x947a('0x22')];logger[_0x947a('0x2c')](util[_0x947a('0x23')](_0x947a('0x24'),_0x30bdce[_0x947a('0x25')],_0x30bdce['id']));}else{logger['error'](util[_0x947a('0x23')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x30bdce['name'],_0x30bdce['id']),util[_0x947a('0x27')](_0x41902f,{'showHidden':![],'depth':null}));}return _0x1591a2(null,_0x3612cb);})['catch'](function(_0x5bf967){logger['error'](util[_0x947a('0x23')](_0x947a('0x29'),_0x30bdce[_0x947a('0x25')],_0x30bdce['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x1591a2(_0x5bf967);});}else{return _0x1591a2(null,_0x3612cb);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index b346cd1..791a216 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 _0xf61e=['include','map','then','ShowZohoAccount','ZohoAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetZohoAccount','findAll','options','raw','where','attributes','limit','model'];(function(_0x38a035,_0x117208){var _0x246052=function(_0x833020){while(--_0x833020){_0x38a035['push'](_0x38a035['shift']());}};_0x246052(++_0x117208);}(_0xf61e,0x191));var _0xef61=function(_0x5cbf1a,_0x52fa2e){_0x5cbf1a=_0x5cbf1a-0x0;var _0x25fc20=_0xf61e[_0x5cbf1a];return _0x25fc20;};'use strict';var _=require(_0xef61('0x0'));var util=require(_0xef61('0x1'));var moment=require(_0xef61('0x2'));var BPromise=require(_0xef61('0x3'));var rs=require(_0xef61('0x4'));var fs=require('fs');var Redis=require(_0xef61('0x5'));var db=require(_0xef61('0x6'))['db'];var utils=require(_0xef61('0x7'));var logger=require(_0xef61('0x8'))(_0xef61('0x9'));var config=require(_0xef61('0xa'));var jayson=require(_0xef61('0xb'));var client=jayson['client'][_0xef61('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3e2f79,_0x4f0cc5,_0x2242a7){return new BPromise(function(_0x277fa1,_0x106e7f){return client['request'](_0x3e2f79,_0x2242a7)['then'](function(_0x188894){logger[_0xef61('0xd')](_0xef61('0xe'),_0x4f0cc5,_0xef61('0xf'));logger[_0xef61('0x10')](_0xef61('0x11'),_0x4f0cc5,_0xef61('0xf'),JSON[_0xef61('0x12')](_0x188894));if(_0x188894[_0xef61('0x13')]){if(_0x188894[_0xef61('0x13')][_0xef61('0x14')]===0x1f4){logger[_0xef61('0x13')](_0xef61('0xe'),_0x4f0cc5,_0x188894[_0xef61('0x13')]['message']);return _0x106e7f(_0x188894[_0xef61('0x13')]['message']);}logger[_0xef61('0x13')](_0xef61('0xe'),_0x4f0cc5,_0x188894[_0xef61('0x13')][_0xef61('0x15')]);return _0x277fa1(_0x188894['error'][_0xef61('0x15')]);}else{logger[_0xef61('0xd')](_0xef61('0xe'),_0x4f0cc5,_0xef61('0xf'));_0x277fa1(_0x188894['result'][_0xef61('0x15')]);}})[_0xef61('0x16')](function(_0x4f7a62){logger[_0xef61('0x13')](_0xef61('0xe'),_0x4f0cc5,_0x4f7a62);_0x106e7f(_0x4f7a62);});});}exports[_0xef61('0x17')]=function(_0x22dc1b){var _0xfc36d6=this;return new Promise(function(_0x28315a,_0xdd5e38){return db['ZohoAccount'][_0xef61('0x18')]({'raw':_0x22dc1b[_0xef61('0x19')]?_0x22dc1b['options'][_0xef61('0x1a')]===undefined?!![]:![]:!![],'where':_0x22dc1b[_0xef61('0x19')]?_0x22dc1b[_0xef61('0x19')][_0xef61('0x1b')]||null:null,'attributes':_0x22dc1b[_0xef61('0x19')]?_0x22dc1b[_0xef61('0x19')][_0xef61('0x1c')]||null:null,'limit':_0x22dc1b['options']?_0x22dc1b['options'][_0xef61('0x1d')]||null:null,'include':_0x22dc1b['options']?_0x22dc1b[_0xef61('0x19')]['include']?_['map'](_0x22dc1b[_0xef61('0x19')]['include'],function(_0x53181b){return{'model':db[_0x53181b[_0xef61('0x1e')]],'as':_0x53181b['as'],'attributes':_0x53181b[_0xef61('0x1c')],'include':_0x53181b[_0xef61('0x1f')]?_[_0xef61('0x20')](_0x53181b['include'],function(_0x16b144){return{'model':db[_0x16b144['model']],'as':_0x16b144['as'],'attributes':_0x16b144[_0xef61('0x1c')],'include':_0x16b144[_0xef61('0x1f')]?_[_0xef61('0x20')](_0x16b144[_0xef61('0x1f')],function(_0x2155f1){return{'model':db[_0x2155f1[_0xef61('0x1e')]],'as':_0x2155f1['as'],'attributes':_0x2155f1[_0xef61('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xef61('0x21')](function(_0x297df7){logger[_0xef61('0xd')](_0xef61('0x17'),_0x22dc1b);logger[_0xef61('0x10')](_0xef61('0x17'),_0x22dc1b,JSON[_0xef61('0x12')](_0x297df7));_0x28315a(_0x297df7);})[_0xef61('0x16')](function(_0x85978){logger[_0xef61('0x13')](_0xef61('0x17'),_0x85978[_0xef61('0x15')],_0x22dc1b);_0xdd5e38(_0xfc36d6[_0xef61('0x13')](0x1f4,_0x85978[_0xef61('0x15')]));});});};exports[_0xef61('0x22')]=function(_0x4f35ad){var _0x51d5d1=this;return new Promise(function(_0x38b522,_0x36713e){return db[_0xef61('0x23')]['find']({'raw':_0x4f35ad[_0xef61('0x19')]?_0x4f35ad[_0xef61('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x4f35ad[_0xef61('0x19')]?_0x4f35ad['options']['where']||null:null,'attributes':_0x4f35ad[_0xef61('0x19')]?_0x4f35ad['options'][_0xef61('0x1c')]||null:null,'include':_0x4f35ad['options']?_0x4f35ad[_0xef61('0x19')][_0xef61('0x1f')]?_[_0xef61('0x20')](_0x4f35ad[_0xef61('0x19')][_0xef61('0x1f')],function(_0x1bdcb9){return{'model':db[_0x1bdcb9[_0xef61('0x1e')]],'as':_0x1bdcb9['as'],'attributes':_0x1bdcb9[_0xef61('0x1c')],'include':_0x1bdcb9[_0xef61('0x1f')]?_[_0xef61('0x20')](_0x1bdcb9['include'],function(_0x569db6){return{'model':db[_0x569db6[_0xef61('0x1e')]],'as':_0x569db6['as'],'attributes':_0x569db6[_0xef61('0x1c')],'include':_0x569db6[_0xef61('0x1f')]?_[_0xef61('0x20')](_0x569db6['include'],function(_0x1c38dc){return{'model':db[_0x1c38dc[_0xef61('0x1e')]],'as':_0x1c38dc['as'],'attributes':_0x1c38dc[_0xef61('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x59b97b){logger['info'](_0xef61('0x22'),_0x4f35ad);logger['debug']('ShowZohoAccount',_0x4f35ad,JSON['stringify'](_0x59b97b));_0x38b522(_0x59b97b);})[_0xef61('0x16')](function(_0x294063){logger[_0xef61('0x13')]('ShowZohoAccount',_0x294063['message'],_0x4f35ad);_0x36713e(_0x51d5d1['error'](0x1f4,_0x294063[_0xef61('0x15')]));});});}; \ No newline at end of file +var _0x8cda=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','ZohoAccount,\x20%s,\x20%s','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','request\x20sent','catch','findAll','options','raw','where','attributes','limit','include','model','map','GetZohoAccount','ShowZohoAccount','find','then','util'];(function(_0xa1e3ca,_0x559022){var _0x5005ab=function(_0x12f90e){while(--_0x12f90e){_0xa1e3ca['push'](_0xa1e3ca['shift']());}};_0x5005ab(++_0x559022);}(_0x8cda,0x1db));var _0xa8cd=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8cda[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0xa8cd('0x0'));var moment=require(_0xa8cd('0x1'));var BPromise=require(_0xa8cd('0x2'));var rs=require(_0xa8cd('0x3'));var fs=require('fs');var Redis=require(_0xa8cd('0x4'));var db=require(_0xa8cd('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa8cd('0x6'))(_0xa8cd('0x7'));var config=require(_0xa8cd('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xa8cd('0x9')][_0xa8cd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1362c3,_0x273d2f,_0x2b9b51){return new BPromise(function(_0x2481ba,_0x13f394){return client[_0xa8cd('0xb')](_0x1362c3,_0x2b9b51)['then'](function(_0x50b8ee){logger['info'](_0xa8cd('0xc'),_0x273d2f,'request\x20sent');logger[_0xa8cd('0xd')](_0xa8cd('0xe'),_0x273d2f,'request\x20sent',JSON[_0xa8cd('0xf')](_0x50b8ee));if(_0x50b8ee[_0xa8cd('0x10')]){if(_0x50b8ee['error']['code']===0x1f4){logger[_0xa8cd('0x10')](_0xa8cd('0xc'),_0x273d2f,_0x50b8ee[_0xa8cd('0x10')][_0xa8cd('0x11')]);return _0x13f394(_0x50b8ee[_0xa8cd('0x10')]['message']);}logger[_0xa8cd('0x10')]('ZohoAccount,\x20%s,\x20%s',_0x273d2f,_0x50b8ee[_0xa8cd('0x10')]['message']);return _0x2481ba(_0x50b8ee[_0xa8cd('0x10')]['message']);}else{logger[_0xa8cd('0x12')](_0xa8cd('0xc'),_0x273d2f,_0xa8cd('0x13'));_0x2481ba(_0x50b8ee['result']['message']);}})[_0xa8cd('0x14')](function(_0x6d5f40){logger[_0xa8cd('0x10')](_0xa8cd('0xc'),_0x273d2f,_0x6d5f40);_0x13f394(_0x6d5f40);});});}exports['GetZohoAccount']=function(_0x128a90){var _0x52252b=this;return new Promise(function(_0x1cacd5,_0x2ef224){return db['ZohoAccount'][_0xa8cd('0x15')]({'raw':_0x128a90[_0xa8cd('0x16')]?_0x128a90['options'][_0xa8cd('0x17')]===undefined?!![]:![]:!![],'where':_0x128a90[_0xa8cd('0x16')]?_0x128a90[_0xa8cd('0x16')][_0xa8cd('0x18')]||null:null,'attributes':_0x128a90[_0xa8cd('0x16')]?_0x128a90['options'][_0xa8cd('0x19')]||null:null,'limit':_0x128a90[_0xa8cd('0x16')]?_0x128a90[_0xa8cd('0x16')][_0xa8cd('0x1a')]||null:null,'include':_0x128a90['options']?_0x128a90[_0xa8cd('0x16')]['include']?_['map'](_0x128a90[_0xa8cd('0x16')][_0xa8cd('0x1b')],function(_0x4ec3cc){return{'model':db[_0x4ec3cc[_0xa8cd('0x1c')]],'as':_0x4ec3cc['as'],'attributes':_0x4ec3cc[_0xa8cd('0x19')],'include':_0x4ec3cc[_0xa8cd('0x1b')]?_[_0xa8cd('0x1d')](_0x4ec3cc[_0xa8cd('0x1b')],function(_0x2d1ef5){return{'model':db[_0x2d1ef5[_0xa8cd('0x1c')]],'as':_0x2d1ef5['as'],'attributes':_0x2d1ef5['attributes'],'include':_0x2d1ef5[_0xa8cd('0x1b')]?_[_0xa8cd('0x1d')](_0x2d1ef5[_0xa8cd('0x1b')],function(_0x393e5a){return{'model':db[_0x393e5a[_0xa8cd('0x1c')]],'as':_0x393e5a['as'],'attributes':_0x393e5a[_0xa8cd('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x38946b){logger[_0xa8cd('0x12')](_0xa8cd('0x1e'),_0x128a90);logger[_0xa8cd('0xd')](_0xa8cd('0x1e'),_0x128a90,JSON[_0xa8cd('0xf')](_0x38946b));_0x1cacd5(_0x38946b);})[_0xa8cd('0x14')](function(_0x3e1770){logger[_0xa8cd('0x10')](_0xa8cd('0x1e'),_0x3e1770[_0xa8cd('0x11')],_0x128a90);_0x2ef224(_0x52252b[_0xa8cd('0x10')](0x1f4,_0x3e1770[_0xa8cd('0x11')]));});});};exports[_0xa8cd('0x1f')]=function(_0x2b4c53){var _0x3c188f=this;return new Promise(function(_0x4b7671,_0x4cca4b){return db['ZohoAccount'][_0xa8cd('0x20')]({'raw':_0x2b4c53[_0xa8cd('0x16')]?_0x2b4c53[_0xa8cd('0x16')][_0xa8cd('0x17')]===undefined?!![]:![]:!![],'where':_0x2b4c53[_0xa8cd('0x16')]?_0x2b4c53[_0xa8cd('0x16')]['where']||null:null,'attributes':_0x2b4c53['options']?_0x2b4c53['options'][_0xa8cd('0x19')]||null:null,'include':_0x2b4c53[_0xa8cd('0x16')]?_0x2b4c53[_0xa8cd('0x16')][_0xa8cd('0x1b')]?_[_0xa8cd('0x1d')](_0x2b4c53[_0xa8cd('0x16')][_0xa8cd('0x1b')],function(_0x572862){return{'model':db[_0x572862[_0xa8cd('0x1c')]],'as':_0x572862['as'],'attributes':_0x572862[_0xa8cd('0x19')],'include':_0x572862['include']?_[_0xa8cd('0x1d')](_0x572862[_0xa8cd('0x1b')],function(_0x2ae8ed){return{'model':db[_0x2ae8ed[_0xa8cd('0x1c')]],'as':_0x2ae8ed['as'],'attributes':_0x2ae8ed['attributes'],'include':_0x2ae8ed[_0xa8cd('0x1b')]?_[_0xa8cd('0x1d')](_0x2ae8ed['include'],function(_0x3dc528){return{'model':db[_0x3dc528[_0xa8cd('0x1c')]],'as':_0x3dc528['as'],'attributes':_0x3dc528[_0xa8cd('0x19')]};}):[]};}):[]};}):[]:[]})[_0xa8cd('0x21')](function(_0x5b1245){logger['info'](_0xa8cd('0x1f'),_0x2b4c53);logger['debug'](_0xa8cd('0x1f'),_0x2b4c53,JSON['stringify'](_0x5b1245));_0x4b7671(_0x5b1245);})[_0xa8cd('0x14')](function(_0x32bad6){logger['error'](_0xa8cd('0x1f'),_0x32bad6[_0xa8cd('0x11')],_0x2b4c53);_0x4cca4b(_0x3c188f[_0xa8cd('0x10')](0x1f4,_0x32bad6[_0xa8cd('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index cecd9cb..82d467b 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 _0x9a36=['/:id','isAuthenticated','show','/:id/descriptions','create','put','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','index'];(function(_0x1a21ff,_0x4a7550){var _0x25afc1=function(_0x4a66ec){while(--_0x4a66ec){_0x1a21ff['push'](_0x1a21ff['shift']());}};_0x25afc1(++_0x4a7550);}(_0x9a36,0x9c));var _0x69a3=function(_0xcc7ae9,_0x246c42){_0xcc7ae9=_0xcc7ae9-0x0;var _0x47719f=_0x9a36[_0xcc7ae9];return _0x47719f;};'use strict';var multer=require(_0x69a3('0x0'));var util=require('util');var path=require(_0x69a3('0x1'));var timeout=require(_0x69a3('0x2'));var express=require(_0x69a3('0x3'));var router=express[_0x69a3('0x4')]();var fs_extra=require(_0x69a3('0x5'));var auth=require(_0x69a3('0x6'));var interaction=require(_0x69a3('0x7'));var config=require(_0x69a3('0x8'));var controller=require(_0x69a3('0x9'));router[_0x69a3('0xa')]('/',auth['isAuthenticated'](),controller[_0x69a3('0xb')]);router[_0x69a3('0xa')](_0x69a3('0xc'),auth[_0x69a3('0xd')](),controller[_0x69a3('0xe')]);router[_0x69a3('0xa')]('/:id/fields',auth[_0x69a3('0xd')](),controller['getFields']);router['get']('/:id/subjects',auth['isAuthenticated'](),controller['getSubjects']);router[_0x69a3('0xa')](_0x69a3('0xf'),auth[_0x69a3('0xd')](),controller['getDescriptions']);router['post']('/',auth['isAuthenticated'](),controller[_0x69a3('0x10')]);router[_0x69a3('0x11')](_0x69a3('0xc'),auth[_0x69a3('0xd')](),controller['update']);router[_0x69a3('0x12')](_0x69a3('0xc'),auth[_0x69a3('0xd')](),controller[_0x69a3('0x13')]);module[_0x69a3('0x14')]=router; \ No newline at end of file +var _0x422c=['/:id','/:id/subjects','getSubjects','/:id/descriptions','post','put','update','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x1f13ee,_0x59217b){var _0x16b0ce=function(_0x4c8fac){while(--_0x4c8fac){_0x1f13ee['push'](_0x1f13ee['shift']());}};_0x16b0ce(++_0x59217b);}(_0x422c,0x14a));var _0xc422=function(_0x39e147,_0x2e86d6){_0x39e147=_0x39e147-0x0;var _0x52250d=_0x422c[_0x39e147];return _0x52250d;};'use strict';var multer=require(_0xc422('0x0'));var util=require('util');var path=require(_0xc422('0x1'));var timeout=require('connect-timeout');var express=require(_0xc422('0x2'));var router=express[_0xc422('0x3')]();var fs_extra=require(_0xc422('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xc422('0x5'));var config=require(_0xc422('0x6'));var controller=require('./intZohoConfiguration.controller');router[_0xc422('0x7')]('/',auth[_0xc422('0x8')](),controller[_0xc422('0x9')]);router[_0xc422('0x7')](_0xc422('0xa'),auth[_0xc422('0x8')](),controller['show']);router[_0xc422('0x7')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0xc422('0x7')](_0xc422('0xb'),auth[_0xc422('0x8')](),controller[_0xc422('0xc')]);router[_0xc422('0x7')](_0xc422('0xd'),auth[_0xc422('0x8')](),controller['getDescriptions']);router[_0xc422('0xe')]('/',auth[_0xc422('0x8')](),controller['create']);router[_0xc422('0xf')](_0xc422('0xa'),auth['isAuthenticated'](),controller[_0xc422('0x10')]);router[_0xc422('0x11')]('/:id',auth[_0xc422('0x8')](),controller[_0xc422('0x12')]);module[_0xc422('0x13')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 15ad6fd..852745a 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 _0x3754=['contact_lead','contact','sequelize','exports','STRING','ENUM','lead'];(function(_0x1e7e07,_0x31634a){var _0x550c35=function(_0x348706){while(--_0x348706){_0x1e7e07['push'](_0x1e7e07['shift']());}};_0x550c35(++_0x31634a);}(_0x3754,0x72));var _0x4375=function(_0x339e7d,_0x290717){_0x339e7d=_0x339e7d-0x0;var _0x2414a9=_0x3754[_0x339e7d];return _0x2414a9;};'use strict';var Sequelize=require(_0x4375('0x0'));module[_0x4375('0x1')]={'name':{'type':Sequelize[_0x4375('0x2')]},'moduleCreate':{'type':Sequelize[_0x4375('0x3')]('lead','contact','nothing'),'defaultValue':_0x4375('0x4')},'moduleSearch':{'type':Sequelize[_0x4375('0x3')](_0x4375('0x5'),_0x4375('0x6'),_0x4375('0x4')),'defaultValue':_0x4375('0x5')},'description':{'type':Sequelize[_0x4375('0x2')]}}; \ No newline at end of file +var _0x20c4=['sequelize','exports','lead','contact','nothing','ENUM','contact_lead','STRING'];(function(_0x1f2f7d,_0x379c04){var _0x45841c=function(_0x31814b){while(--_0x31814b){_0x1f2f7d['push'](_0x1f2f7d['shift']());}};_0x45841c(++_0x379c04);}(_0x20c4,0x88));var _0x420c=function(_0x2645bf,_0xed791d){_0x2645bf=_0x2645bf-0x0;var _0x414fcb=_0x20c4[_0x2645bf];return _0x414fcb;};'use strict';var Sequelize=require(_0x420c('0x0'));module[_0x420c('0x1')]={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize['ENUM'](_0x420c('0x2'),_0x420c('0x3'),_0x420c('0x4')),'defaultValue':_0x420c('0x2')},'moduleSearch':{'type':Sequelize[_0x420c('0x5')]('contact_lead',_0x420c('0x3'),_0x420c('0x2')),'defaultValue':_0x420c('0x6')},'description':{'type':Sequelize[_0x420c('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 5dee0dd..3bd19ac 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 _0x1ec4=['json','offset','undefined','limit','count','status','set','apply','reject','update','then','destroy','error','stack','name','send','map','type','key','model','keys','query','filters','intersection','attributes','fields','length','sort','where','pick','filter','merge','VIRTUAL','ZohoConfiguration','include','findAll','rows','catch','show','includeAll','find','create','body','params','getFields','order','options','hasOwnProperty','nolimit','getSubjects','ZohoField','rawAttributes','getDescriptions','findOne','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end'];(function(_0x5846b8,_0x2983a7){var _0x2c2e27=function(_0x129cc5){while(--_0x129cc5){_0x5846b8['push'](_0x5846b8['shift']());}};_0x2c2e27(++_0x2983a7);}(_0x1ec4,0xd6));var _0x41ec=function(_0x2dbfa3,_0x3c4261){_0x2dbfa3=_0x2dbfa3-0x0;var _0x1f6e73=_0x1ec4[_0x2dbfa3];return _0x1f6e73;};'use strict';var emlformat=require(_0x41ec('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x41ec('0x1'));var jsonpatch=require(_0x41ec('0x2'));var rp=require('request-promise');var moment=require(_0x41ec('0x3'));var BPromise=require(_0x41ec('0x4'));var Mustache=require(_0x41ec('0x5'));var util=require(_0x41ec('0x6'));var path=require(_0x41ec('0x7'));var sox=require(_0x41ec('0x8'));var csv=require(_0x41ec('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x41ec('0xa'));var _=require(_0x41ec('0xb'));var squel=require(_0x41ec('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x41ec('0xd'));var toCsv=require(_0x41ec('0x9'));var querystring=require(_0x41ec('0xe'));var Papa=require(_0x41ec('0xf'));var Redis=require(_0x41ec('0x10'));var authService=require(_0x41ec('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x41ec('0x12'));var hardwareService=require(_0x41ec('0x13'));var logger=require('../../config/logger')(_0x41ec('0x14'));var utils=require('../../config/utils');var config=require(_0x41ec('0x15'));var licenseUtil=require(_0x41ec('0x16'));var db=require(_0x41ec('0x17'))['db'];function respondWithStatusCode(_0x3c0a76,_0x44c02a){_0x44c02a=_0x44c02a||0xcc;return function(_0x4a9c6f){if(_0x4a9c6f){return _0x3c0a76[_0x41ec('0x18')](_0x44c02a);}return _0x3c0a76['status'](_0x44c02a)[_0x41ec('0x19')]();};}function respondWithResult(_0x39e828,_0x308e7a){_0x308e7a=_0x308e7a||0xc8;return function(_0x3f6505){if(_0x3f6505){return _0x39e828['status'](_0x308e7a)[_0x41ec('0x1a')](_0x3f6505);}};}function respondWithFilteredResult(_0x3f6c8e,_0x5ec1c8){return function(_0xe3c8be){if(_0xe3c8be){var _0x2cae5b=typeof _0x5ec1c8[_0x41ec('0x1b')]===_0x41ec('0x1c')&&typeof _0x5ec1c8[_0x41ec('0x1d')]===_0x41ec('0x1c');var _0x52b3b3=_0xe3c8be[_0x41ec('0x1e')];var _0x48184c=_0x2cae5b?0x0:_0x5ec1c8[_0x41ec('0x1b')];var _0x49f143=_0x2cae5b?_0xe3c8be[_0x41ec('0x1e')]:_0x5ec1c8[_0x41ec('0x1b')]+_0x5ec1c8[_0x41ec('0x1d')];var _0x3443bf;if(_0x49f143>=_0x52b3b3){_0x49f143=_0x52b3b3;_0x3443bf=0xc8;}else{_0x3443bf=0xce;}_0x3f6c8e[_0x41ec('0x1f')](_0x3443bf);return _0x3f6c8e[_0x41ec('0x20')]('Content-Range',_0x48184c+'-'+_0x49f143+'/'+_0x52b3b3)[_0x41ec('0x1a')](_0xe3c8be);}return null;};}function patchUpdates(_0x582852){return function(_0x55c65f){try{jsonpatch[_0x41ec('0x21')](_0x55c65f,_0x582852,!![]);}catch(_0x1c7cf2){return BPromise[_0x41ec('0x22')](_0x1c7cf2);}return _0x55c65f['save']();};}function saveUpdates(_0x445a2a,_0x1bf010){return function(_0x3c260c){if(_0x3c260c){return _0x3c260c[_0x41ec('0x23')](_0x445a2a)[_0x41ec('0x24')](function(_0x2db89f){return _0x2db89f;});}return null;};}function removeEntity(_0x5e8aec,_0x558e7d){return function(_0x32fc16){if(_0x32fc16){return _0x32fc16[_0x41ec('0x25')]()[_0x41ec('0x24')](function(){_0x5e8aec['status'](0xcc)[_0x41ec('0x19')]();});}};}function handleEntityNotFound(_0x5590c7,_0x58d6fe){return function(_0x279646){if(!_0x279646){_0x5590c7[_0x41ec('0x18')](0x194);}return _0x279646;};}function handleError(_0x24cd5f,_0x370a3b){_0x370a3b=_0x370a3b||0x1f4;return function(_0x447b28){logger[_0x41ec('0x26')](_0x447b28[_0x41ec('0x27')]);if(_0x447b28[_0x41ec('0x28')]){delete _0x447b28[_0x41ec('0x28')];}_0x24cd5f[_0x41ec('0x1f')](_0x370a3b)[_0x41ec('0x29')](_0x447b28);};}exports['index']=function(_0x1b6d88,_0x5289aa){var _0x572a0f={},_0x3c020b={},_0x1ffc16={'count':0x0,'rows':[]};var _0x1451ec=_[_0x41ec('0x2a')](db['ZohoConfiguration']['rawAttributes'],function(_0xb4cb){return{'name':_0xb4cb['fieldName'],'type':_0xb4cb[_0x41ec('0x2b')][_0x41ec('0x2c')]};});_0x3c020b[_0x41ec('0x2d')]=_['map'](_0x1451ec,_0x41ec('0x28'));_0x3c020b['query']=_[_0x41ec('0x2e')](_0x1b6d88[_0x41ec('0x2f')]);_0x3c020b[_0x41ec('0x30')]=_[_0x41ec('0x31')](_0x3c020b[_0x41ec('0x2d')],_0x3c020b[_0x41ec('0x2f')]);_0x572a0f[_0x41ec('0x32')]=_[_0x41ec('0x31')](_0x3c020b[_0x41ec('0x2d')],qs[_0x41ec('0x33')](_0x1b6d88[_0x41ec('0x2f')][_0x41ec('0x33')]));_0x572a0f[_0x41ec('0x32')]=_0x572a0f['attributes'][_0x41ec('0x34')]?_0x572a0f[_0x41ec('0x32')]:_0x3c020b['model'];if(!_0x1b6d88[_0x41ec('0x2f')]['hasOwnProperty']('nolimit')){_0x572a0f[_0x41ec('0x1d')]=qs[_0x41ec('0x1d')](_0x1b6d88[_0x41ec('0x2f')][_0x41ec('0x1d')]);_0x572a0f['offset']=qs[_0x41ec('0x1b')](_0x1b6d88['query'][_0x41ec('0x1b')]);}_0x572a0f['order']=qs[_0x41ec('0x35')](_0x1b6d88[_0x41ec('0x2f')][_0x41ec('0x35')]);_0x572a0f[_0x41ec('0x36')]=qs['filters'](_[_0x41ec('0x37')](_0x1b6d88[_0x41ec('0x2f')],_0x3c020b['filters']),_0x1451ec);if(_0x1b6d88['query'][_0x41ec('0x38')]){_0x572a0f[_0x41ec('0x36')]=_[_0x41ec('0x39')](_0x572a0f['where'],{'$or':_[_0x41ec('0x2a')](_0x1451ec,function(_0x4198c4){if(_0x4198c4[_0x41ec('0x2b')]!==_0x41ec('0x3a')){var _0x5c17b1={};_0x5c17b1[_0x4198c4['name']]={'$like':'%'+_0x1b6d88[_0x41ec('0x2f')]['filter']+'%'};return _0x5c17b1;}})});}_0x572a0f=_[_0x41ec('0x39')]({},_0x572a0f,_0x1b6d88['options']);var _0x9fd6f0={'where':_0x572a0f[_0x41ec('0x36')]};return db[_0x41ec('0x3b')][_0x41ec('0x1e')](_0x9fd6f0)[_0x41ec('0x24')](function(_0xc95ad3){_0x1ffc16['count']=_0xc95ad3;if(_0x1b6d88[_0x41ec('0x2f')]['includeAll']){_0x572a0f[_0x41ec('0x3c')]=[{'all':!![]}];}return db['ZohoConfiguration'][_0x41ec('0x3d')](_0x572a0f);})[_0x41ec('0x24')](function(_0x3b3fdd){_0x1ffc16[_0x41ec('0x3e')]=_0x3b3fdd;return _0x1ffc16;})['then'](respondWithFilteredResult(_0x5289aa,_0x572a0f))[_0x41ec('0x3f')](handleError(_0x5289aa,null));};exports[_0x41ec('0x40')]=function(_0x2c65ea,_0x2e9138){var _0x400304={'raw':![],'where':{'id':_0x2c65ea['params']['id']}},_0x172c6e={};_0x172c6e[_0x41ec('0x2d')]=_[_0x41ec('0x2e')](db[_0x41ec('0x3b')]['rawAttributes']);_0x172c6e[_0x41ec('0x2f')]=_[_0x41ec('0x2e')](_0x2c65ea[_0x41ec('0x2f')]);_0x172c6e[_0x41ec('0x30')]=_['intersection'](_0x172c6e[_0x41ec('0x2d')],_0x172c6e[_0x41ec('0x2f')]);_0x400304[_0x41ec('0x32')]=_[_0x41ec('0x31')](_0x172c6e[_0x41ec('0x2d')],qs[_0x41ec('0x33')](_0x2c65ea['query'][_0x41ec('0x33')]));_0x400304['attributes']=_0x400304['attributes'][_0x41ec('0x34')]?_0x400304[_0x41ec('0x32')]:_0x172c6e[_0x41ec('0x2d')];if(_0x2c65ea[_0x41ec('0x2f')][_0x41ec('0x41')]){_0x400304['include']=[{'all':!![]}];}_0x400304=_[_0x41ec('0x39')]({},_0x400304,_0x2c65ea['options']);return db[_0x41ec('0x3b')][_0x41ec('0x42')](_0x400304)[_0x41ec('0x24')](handleEntityNotFound(_0x2e9138,null))[_0x41ec('0x24')](respondWithResult(_0x2e9138,null))[_0x41ec('0x3f')](handleError(_0x2e9138,null));};exports[_0x41ec('0x43')]=function(_0x2022c9,_0x19b326){return db[_0x41ec('0x3b')]['create'](_0x2022c9[_0x41ec('0x44')],{})[_0x41ec('0x24')](respondWithResult(_0x19b326,0xc9))[_0x41ec('0x3f')](handleError(_0x19b326,null));};exports[_0x41ec('0x23')]=function(_0x371479,_0x4f1ef5){if(_0x371479['body']['id']){delete _0x371479[_0x41ec('0x44')]['id'];}return db[_0x41ec('0x3b')][_0x41ec('0x42')]({'where':{'id':_0x371479[_0x41ec('0x45')]['id']}})[_0x41ec('0x24')](handleEntityNotFound(_0x4f1ef5,null))[_0x41ec('0x24')](saveUpdates(_0x371479['body'],null))['then'](respondWithResult(_0x4f1ef5,null))[_0x41ec('0x3f')](handleError(_0x4f1ef5,null));};exports[_0x41ec('0x25')]=function(_0x464e11,_0x5433e6){return db['ZohoConfiguration'][_0x41ec('0x42')]({'where':{'id':_0x464e11['params']['id']}})[_0x41ec('0x24')](handleEntityNotFound(_0x5433e6,null))[_0x41ec('0x24')](removeEntity(_0x5433e6,null))[_0x41ec('0x3f')](handleError(_0x5433e6,null));};exports[_0x41ec('0x46')]=function(_0x1bf3e1,_0xbea4fa,_0x5167e1){var _0x2506b2={};var _0x179426={};var _0x562e7b;var _0x292aa6;return db[_0x41ec('0x3b')]['findOne']({'where':{'id':_0x1bf3e1['params']['id']}})['then'](handleEntityNotFound(_0xbea4fa,null))[_0x41ec('0x24')](function(_0x3c3621){if(_0x3c3621){_0x562e7b=_0x3c3621;_0x179426[_0x41ec('0x2d')]=_[_0x41ec('0x2e')](db['ZohoField']['rawAttributes']);_0x179426['query']=_[_0x41ec('0x2e')](_0x1bf3e1['query']);_0x179426['filters']=_[_0x41ec('0x31')](_0x179426[_0x41ec('0x2d')],_0x179426[_0x41ec('0x2f')]);_0x2506b2[_0x41ec('0x32')]=_[_0x41ec('0x31')](_0x179426['model'],qs[_0x41ec('0x33')](_0x1bf3e1[_0x41ec('0x2f')][_0x41ec('0x33')]));_0x2506b2[_0x41ec('0x32')]=_0x2506b2[_0x41ec('0x32')][_0x41ec('0x34')]?_0x2506b2[_0x41ec('0x32')]:_0x179426[_0x41ec('0x2d')];_0x2506b2[_0x41ec('0x47')]=qs[_0x41ec('0x35')](_0x1bf3e1['query'][_0x41ec('0x35')]);_0x2506b2[_0x41ec('0x36')]=qs['filters'](_['pick'](_0x1bf3e1[_0x41ec('0x2f')],_0x179426[_0x41ec('0x30')]));if(_0x1bf3e1[_0x41ec('0x2f')]['filter']){_0x2506b2['where']=_[_0x41ec('0x39')](_0x2506b2['where'],{'$or':_[_0x41ec('0x2a')](_0x2506b2['attributes'],function(_0x5d0174){var _0x5b73ed={};_0x5b73ed[_0x5d0174]={'$like':'%'+_0x1bf3e1[_0x41ec('0x2f')][_0x41ec('0x38')]+'%'};return _0x5b73ed;})});}_0x2506b2=_[_0x41ec('0x39')]({},_0x2506b2,_0x1bf3e1[_0x41ec('0x48')]);return _0x562e7b[_0x41ec('0x46')](_0x2506b2);}})[_0x41ec('0x24')](function(_0x55a451){if(_0x55a451){_0x292aa6=_0x55a451[_0x41ec('0x34')];if(!_0x1bf3e1['query'][_0x41ec('0x49')](_0x41ec('0x4a'))){_0x2506b2['limit']=qs[_0x41ec('0x1d')](_0x1bf3e1[_0x41ec('0x2f')]['limit']);_0x2506b2[_0x41ec('0x1b')]=qs[_0x41ec('0x1b')](_0x1bf3e1[_0x41ec('0x2f')][_0x41ec('0x1b')]);}return _0x562e7b[_0x41ec('0x46')](_0x2506b2);}})['then'](function(_0x351f3e){if(_0x351f3e){return _0x351f3e?{'count':_0x292aa6,'rows':_0x351f3e}:null;}})[_0x41ec('0x24')](respondWithResult(_0xbea4fa,null))['catch'](handleError(_0xbea4fa,null));};exports[_0x41ec('0x4b')]=function(_0x451a25,_0x268bcd,_0x33a607){var _0x39c801={};var _0xa7f724={};var _0x4a36cb;var _0x3f193a;return db[_0x41ec('0x3b')]['findOne']({'where':{'id':_0x451a25[_0x41ec('0x45')]['id']}})['then'](handleEntityNotFound(_0x268bcd,null))[_0x41ec('0x24')](function(_0x22851f){if(_0x22851f){_0x4a36cb=_0x22851f;_0xa7f724[_0x41ec('0x2d')]=_[_0x41ec('0x2e')](db[_0x41ec('0x4c')][_0x41ec('0x4d')]);_0xa7f724['query']=_['keys'](_0x451a25[_0x41ec('0x2f')]);_0xa7f724[_0x41ec('0x30')]=_['intersection'](_0xa7f724[_0x41ec('0x2d')],_0xa7f724[_0x41ec('0x2f')]);_0x39c801[_0x41ec('0x32')]=_[_0x41ec('0x31')](_0xa7f724[_0x41ec('0x2d')],qs[_0x41ec('0x33')](_0x451a25[_0x41ec('0x2f')][_0x41ec('0x33')]));_0x39c801[_0x41ec('0x32')]=_0x39c801[_0x41ec('0x32')][_0x41ec('0x34')]?_0x39c801['attributes']:_0xa7f724[_0x41ec('0x2d')];_0x39c801[_0x41ec('0x47')]=qs[_0x41ec('0x35')](_0x451a25['query']['sort']);_0x39c801[_0x41ec('0x36')]=qs[_0x41ec('0x30')](_[_0x41ec('0x37')](_0x451a25[_0x41ec('0x2f')],_0xa7f724[_0x41ec('0x30')]));if(_0x451a25[_0x41ec('0x2f')]['filter']){_0x39c801[_0x41ec('0x36')]=_[_0x41ec('0x39')](_0x39c801[_0x41ec('0x36')],{'$or':_[_0x41ec('0x2a')](_0x39c801[_0x41ec('0x32')],function(_0xfb9434){var _0x2e43de={};_0x2e43de[_0xfb9434]={'$like':'%'+_0x451a25[_0x41ec('0x2f')]['filter']+'%'};return _0x2e43de;})});}_0x39c801=_[_0x41ec('0x39')]({},_0x39c801,_0x451a25[_0x41ec('0x48')]);return _0x4a36cb[_0x41ec('0x4b')](_0x39c801);}})[_0x41ec('0x24')](function(_0x4b6e72){if(_0x4b6e72){_0x3f193a=_0x4b6e72['length'];if(!_0x451a25['query'][_0x41ec('0x49')](_0x41ec('0x4a'))){_0x39c801['limit']=qs[_0x41ec('0x1d')](_0x451a25[_0x41ec('0x2f')][_0x41ec('0x1d')]);_0x39c801[_0x41ec('0x1b')]=qs['offset'](_0x451a25[_0x41ec('0x2f')][_0x41ec('0x1b')]);}return _0x4a36cb['getSubjects'](_0x39c801);}})[_0x41ec('0x24')](function(_0x4e1071){if(_0x4e1071){return _0x4e1071?{'count':_0x3f193a,'rows':_0x4e1071}:null;}})[_0x41ec('0x24')](respondWithResult(_0x268bcd,null))['catch'](handleError(_0x268bcd,null));};exports[_0x41ec('0x4e')]=function(_0x2be5a5,_0x29856a,_0x45d679){var _0xcd32d5={};var _0x3e37fa={};var _0x5b1780;var _0x1721ff;return db[_0x41ec('0x3b')][_0x41ec('0x4f')]({'where':{'id':_0x2be5a5[_0x41ec('0x45')]['id']}})[_0x41ec('0x24')](handleEntityNotFound(_0x29856a,null))[_0x41ec('0x24')](function(_0x1aa4b9){if(_0x1aa4b9){_0x5b1780=_0x1aa4b9;_0x3e37fa[_0x41ec('0x2d')]=_[_0x41ec('0x2e')](db[_0x41ec('0x4c')][_0x41ec('0x4d')]);_0x3e37fa[_0x41ec('0x2f')]=_[_0x41ec('0x2e')](_0x2be5a5['query']);_0x3e37fa[_0x41ec('0x30')]=_['intersection'](_0x3e37fa['model'],_0x3e37fa[_0x41ec('0x2f')]);_0xcd32d5[_0x41ec('0x32')]=_['intersection'](_0x3e37fa['model'],qs['fields'](_0x2be5a5[_0x41ec('0x2f')][_0x41ec('0x33')]));_0xcd32d5[_0x41ec('0x32')]=_0xcd32d5[_0x41ec('0x32')][_0x41ec('0x34')]?_0xcd32d5['attributes']:_0x3e37fa[_0x41ec('0x2d')];_0xcd32d5[_0x41ec('0x47')]=qs[_0x41ec('0x35')](_0x2be5a5[_0x41ec('0x2f')]['sort']);_0xcd32d5[_0x41ec('0x36')]=qs[_0x41ec('0x30')](_['pick'](_0x2be5a5[_0x41ec('0x2f')],_0x3e37fa[_0x41ec('0x30')]));if(_0x2be5a5[_0x41ec('0x2f')]['filter']){_0xcd32d5['where']=_[_0x41ec('0x39')](_0xcd32d5[_0x41ec('0x36')],{'$or':_[_0x41ec('0x2a')](_0xcd32d5[_0x41ec('0x32')],function(_0x395a45){var _0x280eb0={};_0x280eb0[_0x395a45]={'$like':'%'+_0x2be5a5['query']['filter']+'%'};return _0x280eb0;})});}_0xcd32d5=_[_0x41ec('0x39')]({},_0xcd32d5,_0x2be5a5[_0x41ec('0x48')]);return _0x5b1780[_0x41ec('0x4e')](_0xcd32d5);}})['then'](function(_0x21fb12){if(_0x21fb12){_0x1721ff=_0x21fb12[_0x41ec('0x34')];if(!_0x2be5a5['query'][_0x41ec('0x49')](_0x41ec('0x4a'))){_0xcd32d5['limit']=qs[_0x41ec('0x1d')](_0x2be5a5[_0x41ec('0x2f')]['limit']);_0xcd32d5[_0x41ec('0x1b')]=qs[_0x41ec('0x1b')](_0x2be5a5['query'][_0x41ec('0x1b')]);}return _0x5b1780[_0x41ec('0x4e')](_0xcd32d5);}})[_0x41ec('0x24')](function(_0x53efab){if(_0x53efab){return _0x53efab?{'count':_0x1721ff,'rows':_0x53efab}:null;}})['then'](respondWithResult(_0x29856a,null))['catch'](handleError(_0x29856a,null));}; \ No newline at end of file +var _0xce69=['apply','reject','save','update','then','sendStatus','error','stack','name','send','index','map','ZohoConfiguration','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','params','rawAttributes','find','create','body','findOne','ZohoField','pick','getFields','getSubjects','options','getDescriptions','eml-format','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','end','offset','undefined','limit','count','status','set','json'];(function(_0x829616,_0x5d9318){var _0x35857a=function(_0x502cb9){while(--_0x502cb9){_0x829616['push'](_0x829616['shift']());}};_0x35857a(++_0x5d9318);}(_0xce69,0x158));var _0x9ce6=function(_0x3c8e9a,_0x384306){_0x3c8e9a=_0x3c8e9a-0x0;var _0x2d4c57=_0xce69[_0x3c8e9a];return _0x2d4c57;};'use strict';var emlformat=require(_0x9ce6('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x9ce6('0x1'));var rp=require(_0x9ce6('0x2'));var moment=require(_0x9ce6('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x9ce6('0x4'));var sox=require(_0x9ce6('0x5'));var csv=require(_0x9ce6('0x6'));var ejs=require(_0x9ce6('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9ce6('0x8'));var squel=require('squel');var crypto=require(_0x9ce6('0x9'));var jsforce=require(_0x9ce6('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9ce6('0xb'));var Papa=require(_0x9ce6('0xc'));var Redis=require(_0x9ce6('0xd'));var authService=require(_0x9ce6('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x9ce6('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9ce6('0x10'))(_0x9ce6('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5870ee,_0x5f0436){_0x5f0436=_0x5f0436||0xcc;return function(_0x9eb9a7){if(_0x9eb9a7){return _0x5870ee['sendStatus'](_0x5f0436);}return _0x5870ee['status'](_0x5f0436)[_0x9ce6('0x12')]();};}function respondWithResult(_0x4d0be4,_0x1f7c45){_0x1f7c45=_0x1f7c45||0xc8;return function(_0x32aed2){if(_0x32aed2){return _0x4d0be4['status'](_0x1f7c45)['json'](_0x32aed2);}};}function respondWithFilteredResult(_0x34eadd,_0x4059cc){return function(_0xac3335){if(_0xac3335){var _0x478f80=typeof _0x4059cc[_0x9ce6('0x13')]===_0x9ce6('0x14')&&typeof _0x4059cc[_0x9ce6('0x15')]===_0x9ce6('0x14');var _0x224b35=_0xac3335['count'];var _0x1ca4a5=_0x478f80?0x0:_0x4059cc['offset'];var _0x425208=_0x478f80?_0xac3335[_0x9ce6('0x16')]:_0x4059cc[_0x9ce6('0x13')]+_0x4059cc[_0x9ce6('0x15')];var _0x1b7439;if(_0x425208>=_0x224b35){_0x425208=_0x224b35;_0x1b7439=0xc8;}else{_0x1b7439=0xce;}_0x34eadd[_0x9ce6('0x17')](_0x1b7439);return _0x34eadd[_0x9ce6('0x18')]('Content-Range',_0x1ca4a5+'-'+_0x425208+'/'+_0x224b35)[_0x9ce6('0x19')](_0xac3335);}return null;};}function patchUpdates(_0xa3796f){return function(_0x4c89a1){try{jsonpatch[_0x9ce6('0x1a')](_0x4c89a1,_0xa3796f,!![]);}catch(_0x460ea9){return BPromise[_0x9ce6('0x1b')](_0x460ea9);}return _0x4c89a1[_0x9ce6('0x1c')]();};}function saveUpdates(_0x1706d6,_0x3c68f4){return function(_0x57b24a){if(_0x57b24a){return _0x57b24a[_0x9ce6('0x1d')](_0x1706d6)[_0x9ce6('0x1e')](function(_0x469d02){return _0x469d02;});}return null;};}function removeEntity(_0x5ac39e,_0xa4765d){return function(_0x136b79){if(_0x136b79){return _0x136b79['destroy']()[_0x9ce6('0x1e')](function(){_0x5ac39e['status'](0xcc)[_0x9ce6('0x12')]();});}};}function handleEntityNotFound(_0x1efa03,_0x4c60e5){return function(_0x2df510){if(!_0x2df510){_0x1efa03[_0x9ce6('0x1f')](0x194);}return _0x2df510;};}function handleError(_0x3ae91e,_0x1faac7){_0x1faac7=_0x1faac7||0x1f4;return function(_0x35c486){logger[_0x9ce6('0x20')](_0x35c486[_0x9ce6('0x21')]);if(_0x35c486['name']){delete _0x35c486[_0x9ce6('0x22')];}_0x3ae91e[_0x9ce6('0x17')](_0x1faac7)[_0x9ce6('0x23')](_0x35c486);};}exports[_0x9ce6('0x24')]=function(_0x58c552,_0x34d3bc){var _0x25f2a1={},_0x32e99f={},_0x16032a={'count':0x0,'rows':[]};var _0x556b6f=_[_0x9ce6('0x25')](db[_0x9ce6('0x26')]['rawAttributes'],function(_0x598863){return{'name':_0x598863['fieldName'],'type':_0x598863[_0x9ce6('0x27')][_0x9ce6('0x28')]};});_0x32e99f[_0x9ce6('0x29')]=_[_0x9ce6('0x25')](_0x556b6f,_0x9ce6('0x22'));_0x32e99f[_0x9ce6('0x2a')]=_[_0x9ce6('0x2b')](_0x58c552[_0x9ce6('0x2a')]);_0x32e99f['filters']=_['intersection'](_0x32e99f[_0x9ce6('0x29')],_0x32e99f[_0x9ce6('0x2a')]);_0x25f2a1['attributes']=_[_0x9ce6('0x2c')](_0x32e99f[_0x9ce6('0x29')],qs[_0x9ce6('0x2d')](_0x58c552[_0x9ce6('0x2a')]['fields']));_0x25f2a1[_0x9ce6('0x2e')]=_0x25f2a1[_0x9ce6('0x2e')][_0x9ce6('0x2f')]?_0x25f2a1[_0x9ce6('0x2e')]:_0x32e99f['model'];if(!_0x58c552['query'][_0x9ce6('0x30')](_0x9ce6('0x31'))){_0x25f2a1[_0x9ce6('0x15')]=qs[_0x9ce6('0x15')](_0x58c552[_0x9ce6('0x2a')]['limit']);_0x25f2a1[_0x9ce6('0x13')]=qs[_0x9ce6('0x13')](_0x58c552[_0x9ce6('0x2a')][_0x9ce6('0x13')]);}_0x25f2a1[_0x9ce6('0x32')]=qs['sort'](_0x58c552[_0x9ce6('0x2a')][_0x9ce6('0x33')]);_0x25f2a1[_0x9ce6('0x34')]=qs[_0x9ce6('0x35')](_['pick'](_0x58c552[_0x9ce6('0x2a')],_0x32e99f[_0x9ce6('0x35')]),_0x556b6f);if(_0x58c552['query'][_0x9ce6('0x36')]){_0x25f2a1[_0x9ce6('0x34')]=_[_0x9ce6('0x37')](_0x25f2a1['where'],{'$or':_['map'](_0x556b6f,function(_0xb55333){if(_0xb55333[_0x9ce6('0x27')]!==_0x9ce6('0x38')){var _0x9c3f32={};_0x9c3f32[_0xb55333[_0x9ce6('0x22')]]={'$like':'%'+_0x58c552[_0x9ce6('0x2a')]['filter']+'%'};return _0x9c3f32;}})});}_0x25f2a1=_[_0x9ce6('0x37')]({},_0x25f2a1,_0x58c552['options']);var _0x4b5e17={'where':_0x25f2a1[_0x9ce6('0x34')]};return db['ZohoConfiguration'][_0x9ce6('0x16')](_0x4b5e17)['then'](function(_0x4a0f8f){_0x16032a[_0x9ce6('0x16')]=_0x4a0f8f;if(_0x58c552[_0x9ce6('0x2a')][_0x9ce6('0x39')]){_0x25f2a1[_0x9ce6('0x3a')]=[{'all':!![]}];}return db[_0x9ce6('0x26')]['findAll'](_0x25f2a1);})[_0x9ce6('0x1e')](function(_0x2046dd){_0x16032a[_0x9ce6('0x3b')]=_0x2046dd;return _0x16032a;})[_0x9ce6('0x1e')](respondWithFilteredResult(_0x34d3bc,_0x25f2a1))[_0x9ce6('0x3c')](handleError(_0x34d3bc,null));};exports[_0x9ce6('0x3d')]=function(_0x91d72f,_0xf2982a){var _0x2a7069={'raw':![],'where':{'id':_0x91d72f[_0x9ce6('0x3e')]['id']}},_0x11ec12={};_0x11ec12[_0x9ce6('0x29')]=_[_0x9ce6('0x2b')](db[_0x9ce6('0x26')][_0x9ce6('0x3f')]);_0x11ec12[_0x9ce6('0x2a')]=_[_0x9ce6('0x2b')](_0x91d72f[_0x9ce6('0x2a')]);_0x11ec12[_0x9ce6('0x35')]=_['intersection'](_0x11ec12[_0x9ce6('0x29')],_0x11ec12[_0x9ce6('0x2a')]);_0x2a7069[_0x9ce6('0x2e')]=_[_0x9ce6('0x2c')](_0x11ec12[_0x9ce6('0x29')],qs[_0x9ce6('0x2d')](_0x91d72f[_0x9ce6('0x2a')][_0x9ce6('0x2d')]));_0x2a7069[_0x9ce6('0x2e')]=_0x2a7069[_0x9ce6('0x2e')][_0x9ce6('0x2f')]?_0x2a7069[_0x9ce6('0x2e')]:_0x11ec12[_0x9ce6('0x29')];if(_0x91d72f[_0x9ce6('0x2a')][_0x9ce6('0x39')]){_0x2a7069[_0x9ce6('0x3a')]=[{'all':!![]}];}_0x2a7069=_[_0x9ce6('0x37')]({},_0x2a7069,_0x91d72f['options']);return db[_0x9ce6('0x26')][_0x9ce6('0x40')](_0x2a7069)['then'](handleEntityNotFound(_0xf2982a,null))[_0x9ce6('0x1e')](respondWithResult(_0xf2982a,null))[_0x9ce6('0x3c')](handleError(_0xf2982a,null));};exports[_0x9ce6('0x41')]=function(_0x5bcc4d,_0x5877e1){return db['ZohoConfiguration'][_0x9ce6('0x41')](_0x5bcc4d[_0x9ce6('0x42')],{})[_0x9ce6('0x1e')](respondWithResult(_0x5877e1,0xc9))[_0x9ce6('0x3c')](handleError(_0x5877e1,null));};exports['update']=function(_0x31441a,_0xc527b6){if(_0x31441a[_0x9ce6('0x42')]['id']){delete _0x31441a['body']['id'];}return db[_0x9ce6('0x26')][_0x9ce6('0x40')]({'where':{'id':_0x31441a[_0x9ce6('0x3e')]['id']}})[_0x9ce6('0x1e')](handleEntityNotFound(_0xc527b6,null))[_0x9ce6('0x1e')](saveUpdates(_0x31441a['body'],null))[_0x9ce6('0x1e')](respondWithResult(_0xc527b6,null))[_0x9ce6('0x3c')](handleError(_0xc527b6,null));};exports['destroy']=function(_0x264584,_0x538371){return db[_0x9ce6('0x26')][_0x9ce6('0x40')]({'where':{'id':_0x264584[_0x9ce6('0x3e')]['id']}})[_0x9ce6('0x1e')](handleEntityNotFound(_0x538371,null))[_0x9ce6('0x1e')](removeEntity(_0x538371,null))[_0x9ce6('0x3c')](handleError(_0x538371,null));};exports['getFields']=function(_0x3d62c3,_0x39f573,_0x227080){var _0xc3e0fb={};var _0x5ccafc={};var _0x62c1a7;var _0xa9b9bf;return db['ZohoConfiguration'][_0x9ce6('0x43')]({'where':{'id':_0x3d62c3[_0x9ce6('0x3e')]['id']}})[_0x9ce6('0x1e')](handleEntityNotFound(_0x39f573,null))['then'](function(_0x4aa68e){if(_0x4aa68e){_0x62c1a7=_0x4aa68e;_0x5ccafc[_0x9ce6('0x29')]=_[_0x9ce6('0x2b')](db[_0x9ce6('0x44')][_0x9ce6('0x3f')]);_0x5ccafc[_0x9ce6('0x2a')]=_['keys'](_0x3d62c3['query']);_0x5ccafc[_0x9ce6('0x35')]=_[_0x9ce6('0x2c')](_0x5ccafc[_0x9ce6('0x29')],_0x5ccafc[_0x9ce6('0x2a')]);_0xc3e0fb[_0x9ce6('0x2e')]=_[_0x9ce6('0x2c')](_0x5ccafc[_0x9ce6('0x29')],qs[_0x9ce6('0x2d')](_0x3d62c3[_0x9ce6('0x2a')]['fields']));_0xc3e0fb[_0x9ce6('0x2e')]=_0xc3e0fb['attributes'][_0x9ce6('0x2f')]?_0xc3e0fb[_0x9ce6('0x2e')]:_0x5ccafc[_0x9ce6('0x29')];_0xc3e0fb['order']=qs['sort'](_0x3d62c3[_0x9ce6('0x2a')]['sort']);_0xc3e0fb[_0x9ce6('0x34')]=qs[_0x9ce6('0x35')](_[_0x9ce6('0x45')](_0x3d62c3[_0x9ce6('0x2a')],_0x5ccafc[_0x9ce6('0x35')]));if(_0x3d62c3[_0x9ce6('0x2a')][_0x9ce6('0x36')]){_0xc3e0fb[_0x9ce6('0x34')]=_['merge'](_0xc3e0fb['where'],{'$or':_[_0x9ce6('0x25')](_0xc3e0fb[_0x9ce6('0x2e')],function(_0x5ede5f){var _0x54bfff={};_0x54bfff[_0x5ede5f]={'$like':'%'+_0x3d62c3[_0x9ce6('0x2a')][_0x9ce6('0x36')]+'%'};return _0x54bfff;})});}_0xc3e0fb=_['merge']({},_0xc3e0fb,_0x3d62c3['options']);return _0x62c1a7['getFields'](_0xc3e0fb);}})['then'](function(_0x5993c2){if(_0x5993c2){_0xa9b9bf=_0x5993c2['length'];if(!_0x3d62c3[_0x9ce6('0x2a')][_0x9ce6('0x30')](_0x9ce6('0x31'))){_0xc3e0fb[_0x9ce6('0x15')]=qs['limit'](_0x3d62c3[_0x9ce6('0x2a')][_0x9ce6('0x15')]);_0xc3e0fb[_0x9ce6('0x13')]=qs[_0x9ce6('0x13')](_0x3d62c3[_0x9ce6('0x2a')][_0x9ce6('0x13')]);}return _0x62c1a7[_0x9ce6('0x46')](_0xc3e0fb);}})[_0x9ce6('0x1e')](function(_0x4a8493){if(_0x4a8493){return _0x4a8493?{'count':_0xa9b9bf,'rows':_0x4a8493}:null;}})['then'](respondWithResult(_0x39f573,null))[_0x9ce6('0x3c')](handleError(_0x39f573,null));};exports[_0x9ce6('0x47')]=function(_0x38ff5a,_0x1ed362,_0x4d60e9){var _0x37090a={};var _0x2dc200={};var _0x2febf3;var _0xa329ee;return db[_0x9ce6('0x26')][_0x9ce6('0x43')]({'where':{'id':_0x38ff5a[_0x9ce6('0x3e')]['id']}})[_0x9ce6('0x1e')](handleEntityNotFound(_0x1ed362,null))['then'](function(_0x285135){if(_0x285135){_0x2febf3=_0x285135;_0x2dc200[_0x9ce6('0x29')]=_['keys'](db['ZohoField'][_0x9ce6('0x3f')]);_0x2dc200[_0x9ce6('0x2a')]=_[_0x9ce6('0x2b')](_0x38ff5a[_0x9ce6('0x2a')]);_0x2dc200['filters']=_[_0x9ce6('0x2c')](_0x2dc200[_0x9ce6('0x29')],_0x2dc200[_0x9ce6('0x2a')]);_0x37090a[_0x9ce6('0x2e')]=_[_0x9ce6('0x2c')](_0x2dc200['model'],qs[_0x9ce6('0x2d')](_0x38ff5a[_0x9ce6('0x2a')]['fields']));_0x37090a[_0x9ce6('0x2e')]=_0x37090a[_0x9ce6('0x2e')]['length']?_0x37090a[_0x9ce6('0x2e')]:_0x2dc200[_0x9ce6('0x29')];_0x37090a['order']=qs[_0x9ce6('0x33')](_0x38ff5a[_0x9ce6('0x2a')]['sort']);_0x37090a[_0x9ce6('0x34')]=qs[_0x9ce6('0x35')](_[_0x9ce6('0x45')](_0x38ff5a[_0x9ce6('0x2a')],_0x2dc200[_0x9ce6('0x35')]));if(_0x38ff5a['query'][_0x9ce6('0x36')]){_0x37090a['where']=_['merge'](_0x37090a[_0x9ce6('0x34')],{'$or':_['map'](_0x37090a[_0x9ce6('0x2e')],function(_0x315748){var _0x53c9d2={};_0x53c9d2[_0x315748]={'$like':'%'+_0x38ff5a[_0x9ce6('0x2a')][_0x9ce6('0x36')]+'%'};return _0x53c9d2;})});}_0x37090a=_[_0x9ce6('0x37')]({},_0x37090a,_0x38ff5a[_0x9ce6('0x48')]);return _0x2febf3[_0x9ce6('0x47')](_0x37090a);}})[_0x9ce6('0x1e')](function(_0x80bcec){if(_0x80bcec){_0xa329ee=_0x80bcec[_0x9ce6('0x2f')];if(!_0x38ff5a['query'][_0x9ce6('0x30')]('nolimit')){_0x37090a[_0x9ce6('0x15')]=qs[_0x9ce6('0x15')](_0x38ff5a[_0x9ce6('0x2a')][_0x9ce6('0x15')]);_0x37090a[_0x9ce6('0x13')]=qs[_0x9ce6('0x13')](_0x38ff5a[_0x9ce6('0x2a')]['offset']);}return _0x2febf3[_0x9ce6('0x47')](_0x37090a);}})[_0x9ce6('0x1e')](function(_0x1e50ef){if(_0x1e50ef){return _0x1e50ef?{'count':_0xa329ee,'rows':_0x1e50ef}:null;}})['then'](respondWithResult(_0x1ed362,null))[_0x9ce6('0x3c')](handleError(_0x1ed362,null));};exports['getDescriptions']=function(_0x24297a,_0x3eaeed,_0x4a0c9f){var _0x10e43c={};var _0x775034={};var _0x1d35c4;var _0x182e98;return db[_0x9ce6('0x26')]['findOne']({'where':{'id':_0x24297a[_0x9ce6('0x3e')]['id']}})[_0x9ce6('0x1e')](handleEntityNotFound(_0x3eaeed,null))[_0x9ce6('0x1e')](function(_0x56224d){if(_0x56224d){_0x1d35c4=_0x56224d;_0x775034['model']=_[_0x9ce6('0x2b')](db[_0x9ce6('0x44')][_0x9ce6('0x3f')]);_0x775034['query']=_[_0x9ce6('0x2b')](_0x24297a[_0x9ce6('0x2a')]);_0x775034[_0x9ce6('0x35')]=_[_0x9ce6('0x2c')](_0x775034[_0x9ce6('0x29')],_0x775034[_0x9ce6('0x2a')]);_0x10e43c[_0x9ce6('0x2e')]=_[_0x9ce6('0x2c')](_0x775034[_0x9ce6('0x29')],qs[_0x9ce6('0x2d')](_0x24297a[_0x9ce6('0x2a')]['fields']));_0x10e43c[_0x9ce6('0x2e')]=_0x10e43c[_0x9ce6('0x2e')][_0x9ce6('0x2f')]?_0x10e43c['attributes']:_0x775034[_0x9ce6('0x29')];_0x10e43c[_0x9ce6('0x32')]=qs[_0x9ce6('0x33')](_0x24297a[_0x9ce6('0x2a')][_0x9ce6('0x33')]);_0x10e43c['where']=qs[_0x9ce6('0x35')](_['pick'](_0x24297a['query'],_0x775034[_0x9ce6('0x35')]));if(_0x24297a[_0x9ce6('0x2a')][_0x9ce6('0x36')]){_0x10e43c[_0x9ce6('0x34')]=_[_0x9ce6('0x37')](_0x10e43c[_0x9ce6('0x34')],{'$or':_[_0x9ce6('0x25')](_0x10e43c[_0x9ce6('0x2e')],function(_0x399c6d){var _0x47029c={};_0x47029c[_0x399c6d]={'$like':'%'+_0x24297a[_0x9ce6('0x2a')][_0x9ce6('0x36')]+'%'};return _0x47029c;})});}_0x10e43c=_['merge']({},_0x10e43c,_0x24297a[_0x9ce6('0x48')]);return _0x1d35c4['getDescriptions'](_0x10e43c);}})[_0x9ce6('0x1e')](function(_0x62a4f1){if(_0x62a4f1){_0x182e98=_0x62a4f1[_0x9ce6('0x2f')];if(!_0x24297a['query'][_0x9ce6('0x30')]('nolimit')){_0x10e43c[_0x9ce6('0x15')]=qs['limit'](_0x24297a[_0x9ce6('0x2a')][_0x9ce6('0x15')]);_0x10e43c[_0x9ce6('0x13')]=qs[_0x9ce6('0x13')](_0x24297a['query'][_0x9ce6('0x13')]);}return _0x1d35c4[_0x9ce6('0x49')](_0x10e43c);}})['then'](function(_0x245b80){if(_0x245b80){return _0x245b80?{'count':_0x182e98,'rows':_0x245b80}:null;}})['then'](respondWithResult(_0x3eaeed,null))[_0x9ce6('0x3c')](handleError(_0x3eaeed,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index e150bd2..d95a699 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 _0xc10b=['../../config/logger','api','bluebird','request-promise','../../config/environment','./intZohoConfiguration.attributes','exports','int_zoho_configurations'];(function(_0x4b903f,_0x3e3acf){var _0x47385a=function(_0x573075){while(--_0x573075){_0x4b903f['push'](_0x4b903f['shift']());}};_0x47385a(++_0x3e3acf);}(_0xc10b,0x108));var _0xbc10=function(_0x220f3f,_0x11c540){_0x220f3f=_0x220f3f-0x0;var _0x1f170e=_0xc10b[_0x220f3f];return _0x1f170e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xbc10('0x0'))(_0xbc10('0x1'));var moment=require('moment');var BPromise=require(_0xbc10('0x2'));var rp=require(_0xbc10('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xbc10('0x4'));var attributes=require(_0xbc10('0x5'));module[_0xbc10('0x6')]=function(_0x4cd5c9,_0x3b94a0){return _0x4cd5c9['define']('ZohoConfiguration',attributes,{'tableName':_0xbc10('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x537c=['bluebird','request-promise','rimraf','../../config/environment','exports','define','ZohoConfiguration','lodash','../../config/logger','api','moment'];(function(_0x5ccf67,_0x303ec8){var _0x350dd4=function(_0x195946){while(--_0x195946){_0x5ccf67['push'](_0x5ccf67['shift']());}};_0x350dd4(++_0x303ec8);}(_0x537c,0x1bf));var _0xc537=function(_0xc95abe,_0x4d51fd){_0xc95abe=_0xc95abe-0x0;var _0xe7edc7=_0x537c[_0xc95abe];return _0xe7edc7;};'use strict';var _=require(_0xc537('0x0'));var util=require('util');var logger=require(_0xc537('0x1'))(_0xc537('0x2'));var moment=require(_0xc537('0x3'));var BPromise=require(_0xc537('0x4'));var rp=require(_0xc537('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc537('0x6'));var config=require(_0xc537('0x7'));var attributes=require('./intZohoConfiguration.attributes');module[_0xc537('0x8')]=function(_0x300462,_0x2f496a){return _0x300462[_0xc537('0x9')](_0xc537('0xa'),attributes,{'tableName':'int_zoho_configurations','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 964ef48..0c30b29 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 _0x81ce=['ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x40bcf4,_0x33383b){var _0x2a3e25=function(_0x224e88){while(--_0x224e88){_0x40bcf4['push'](_0x40bcf4['shift']());}};_0x2a3e25(++_0x33383b);}(_0x81ce,0x11a));var _0xe81c=function(_0x366408,_0x247b31){_0x366408=_0x366408-0x0;var _0x2435ee=_0x81ce[_0x366408];return _0x2435ee;};'use strict';var _=require(_0xe81c('0x0'));var util=require(_0xe81c('0x1'));var moment=require('moment');var BPromise=require(_0xe81c('0x2'));var rs=require(_0xe81c('0x3'));var fs=require('fs');var Redis=require(_0xe81c('0x4'));var db=require(_0xe81c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe81c('0x6'))(_0xe81c('0x7'));var config=require(_0xe81c('0x8'));var jayson=require(_0xe81c('0x9'));var client=jayson[_0xe81c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x23e856,_0x509131,_0x56be04){return new BPromise(function(_0x1d6a53,_0x1f56d9){return client[_0xe81c('0xb')](_0x23e856,_0x56be04)[_0xe81c('0xc')](function(_0x35e698){logger[_0xe81c('0xd')](_0xe81c('0xe'),_0x509131,_0xe81c('0xf'));logger[_0xe81c('0x10')](_0xe81c('0x11'),_0x509131,_0xe81c('0xf'),JSON[_0xe81c('0x12')](_0x35e698));if(_0x35e698[_0xe81c('0x13')]){if(_0x35e698[_0xe81c('0x13')][_0xe81c('0x14')]===0x1f4){logger[_0xe81c('0x13')](_0xe81c('0xe'),_0x509131,_0x35e698[_0xe81c('0x13')][_0xe81c('0x15')]);return _0x1f56d9(_0x35e698[_0xe81c('0x13')]['message']);}logger[_0xe81c('0x13')](_0xe81c('0xe'),_0x509131,_0x35e698['error'][_0xe81c('0x15')]);return _0x1d6a53(_0x35e698['error']['message']);}else{logger[_0xe81c('0xd')]('ZohoConfiguration,\x20%s,\x20%s',_0x509131,_0xe81c('0xf'));_0x1d6a53(_0x35e698[_0xe81c('0x16')][_0xe81c('0x15')]);}})['catch'](function(_0x56094e){logger[_0xe81c('0x13')](_0xe81c('0xe'),_0x509131,_0x56094e);_0x1f56d9(_0x56094e);});});} \ No newline at end of file +var _0xea19=['http','request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','client'];(function(_0x25945a,_0x24e1bc){var _0x14d9f1=function(_0x445ff3){while(--_0x445ff3){_0x25945a['push'](_0x25945a['shift']());}};_0x14d9f1(++_0x24e1bc);}(_0xea19,0x1dc));var _0x9ea1=function(_0x1abb09,_0x18ee91){_0x1abb09=_0x1abb09-0x0;var _0xea1c07=_0xea19[_0x1abb09];return _0xea1c07;};'use strict';var _=require(_0x9ea1('0x0'));var util=require('util');var moment=require(_0x9ea1('0x1'));var BPromise=require(_0x9ea1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9ea1('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x9ea1('0x4'))(_0x9ea1('0x5'));var config=require(_0x9ea1('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x9ea1('0x7')][_0x9ea1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3c60bc,_0x5dedec,_0x357dbe){return new BPromise(function(_0x53f835,_0x5f2121){return client[_0x9ea1('0x9')](_0x3c60bc,_0x357dbe)[_0x9ea1('0xa')](function(_0xe1c932){logger[_0x9ea1('0xb')](_0x9ea1('0xc'),_0x5dedec,_0x9ea1('0xd'));logger[_0x9ea1('0xe')](_0x9ea1('0xf'),_0x5dedec,_0x9ea1('0xd'),JSON[_0x9ea1('0x10')](_0xe1c932));if(_0xe1c932['error']){if(_0xe1c932['error'][_0x9ea1('0x11')]===0x1f4){logger['error'](_0x9ea1('0xc'),_0x5dedec,_0xe1c932[_0x9ea1('0x12')][_0x9ea1('0x13')]);return _0x5f2121(_0xe1c932[_0x9ea1('0x12')][_0x9ea1('0x13')]);}logger[_0x9ea1('0x12')]('ZohoConfiguration,\x20%s,\x20%s',_0x5dedec,_0xe1c932[_0x9ea1('0x12')][_0x9ea1('0x13')]);return _0x53f835(_0xe1c932['error']['message']);}else{logger[_0x9ea1('0xb')]('ZohoConfiguration,\x20%s,\x20%s',_0x5dedec,_0x9ea1('0xd'));_0x53f835(_0xe1c932[_0x9ea1('0x14')][_0x9ea1('0x13')]);}})[_0x9ea1('0x15')](function(_0x5d8aaa){logger[_0x9ea1('0x12')](_0x9ea1('0xc'),_0x5dedec,_0x5d8aaa);_0x5f2121(_0x5d8aaa);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 340ba5a..1886a59 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 _0xaa73=['update','delete','multer','util','path','express','Router','fs-extra','../../components/auth/service','./intZohoField.controller','get','index','/:id','isAuthenticated','post','put'];(function(_0x55cd28,_0x13830a){var _0x2e6506=function(_0xcf08a1){while(--_0xcf08a1){_0x55cd28['push'](_0x55cd28['shift']());}};_0x2e6506(++_0x13830a);}(_0xaa73,0xe2));var _0x3aa7=function(_0x43f104,_0x5320cb){_0x43f104=_0x43f104-0x0;var _0x2435e4=_0xaa73[_0x43f104];return _0x2435e4;};'use strict';var multer=require(_0x3aa7('0x0'));var util=require(_0x3aa7('0x1'));var path=require(_0x3aa7('0x2'));var timeout=require('connect-timeout');var express=require(_0x3aa7('0x3'));var router=express[_0x3aa7('0x4')]();var fs_extra=require(_0x3aa7('0x5'));var auth=require(_0x3aa7('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3aa7('0x7'));router[_0x3aa7('0x8')]('/',auth['isAuthenticated'](),controller[_0x3aa7('0x9')]);router['get'](_0x3aa7('0xa'),auth[_0x3aa7('0xb')](),controller['show']);router[_0x3aa7('0xc')]('/',auth[_0x3aa7('0xb')](),controller['create']);router[_0x3aa7('0xd')]('/:id',auth[_0x3aa7('0xb')](),controller[_0x3aa7('0xe')]);router[_0x3aa7('0xf')](_0x3aa7('0xa'),auth[_0x3aa7('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xd646=['../../components/auth/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','show','post','create','put','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0xd646,0x1dc));var _0x6d64=function(_0x41dcdb,_0x4e1a2f){_0x41dcdb=_0x41dcdb-0x0;var _0xce4042=_0xd646[_0x41dcdb];return _0xce4042;};'use strict';var multer=require(_0x6d64('0x0'));var util=require(_0x6d64('0x1'));var path=require(_0x6d64('0x2'));var timeout=require(_0x6d64('0x3'));var express=require(_0x6d64('0x4'));var router=express[_0x6d64('0x5')]();var fs_extra=require(_0x6d64('0x6'));var auth=require(_0x6d64('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x6d64('0x8'));var controller=require(_0x6d64('0x9'));router[_0x6d64('0xa')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/:id',auth[_0x6d64('0xb')](),controller[_0x6d64('0xc')]);router[_0x6d64('0xd')]('/',auth[_0x6d64('0xb')](),controller[_0x6d64('0xe')]);router[_0x6d64('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x6d64('0x10')]);router[_0x6d64('0x11')](_0x6d64('0x12'),auth['isAuthenticated'](),controller[_0x6d64('0x13')]);module[_0x6d64('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 12cf745..96b33fd 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 _0xd24c=['BOOLEAN','sequelize','exports','ENUM','string','keyValue','picklist','STRING','customVariable'];(function(_0x441db3,_0x10f359){var _0x16c05d=function(_0x4c0d4e){while(--_0x4c0d4e){_0x441db3['push'](_0x441db3['shift']());}};_0x16c05d(++_0x10f359);}(_0xd24c,0x106));var _0xcd24=function(_0xda3d33,_0x19aaee){_0xda3d33=_0xda3d33-0x0;var _0x5eba77=_0xd24c[_0xda3d33];return _0x5eba77;};'use strict';var Sequelize=require(_0xcd24('0x0'));module[_0xcd24('0x1')]={'type':{'type':Sequelize[_0xcd24('0x2')](_0xcd24('0x3'),'variable','customVariable',_0xcd24('0x4'),_0xcd24('0x5')),'defaultValue':_0xcd24('0x3')},'content':{'type':Sequelize[_0xcd24('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xcd24('0x2')]('string','variable',_0xcd24('0x7'))},'keyContent':{'type':Sequelize[_0xcd24('0x6')]},'idField':{'type':Sequelize[_0xcd24('0x6')]},'nameField':{'type':Sequelize[_0xcd24('0x6')]},'customField':{'type':Sequelize[_0xcd24('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xcd24('0x6')]}}; \ No newline at end of file +var _0xbb32=['keyValue','picklist','STRING','ENUM','variable','sequelize','exports','string','customVariable'];(function(_0x42f6b1,_0x560c04){var _0x39b69f=function(_0x38df3c){while(--_0x38df3c){_0x42f6b1['push'](_0x42f6b1['shift']());}};_0x39b69f(++_0x560c04);}(_0xbb32,0x1e2));var _0x2bb3=function(_0x56c313,_0x4acb15){_0x56c313=_0x56c313-0x0;var _0x12987d=_0xbb32[_0x56c313];return _0x12987d;};'use strict';var Sequelize=require(_0x2bb3('0x0'));module[_0x2bb3('0x1')]={'type':{'type':Sequelize['ENUM'](_0x2bb3('0x2'),'variable',_0x2bb3('0x3'),_0x2bb3('0x4'),_0x2bb3('0x5')),'defaultValue':_0x2bb3('0x2')},'content':{'type':Sequelize[_0x2bb3('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x2bb3('0x7')](_0x2bb3('0x2'),_0x2bb3('0x8'),'customVariable')},'keyContent':{'type':Sequelize[_0x2bb3('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x2bb3('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2bb3('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 7d362fb..813e43e 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 _0x1f0b=['error','stack','name','send','index','map','ZohoField','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','params','keys','find','create','body','update','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','Content-Range','apply','reject','destroy','then','sendStatus'];(function(_0x242cb9,_0x1ef332){var _0x58737f=function(_0x6bf943){while(--_0x6bf943){_0x242cb9['push'](_0x242cb9['shift']());}};_0x58737f(++_0x1ef332);}(_0x1f0b,0x100));var _0xb1f0=function(_0x4a1b3c,_0x20aa97){_0x4a1b3c=_0x4a1b3c-0x0;var _0xe314d7=_0x1f0b[_0x4a1b3c];return _0xe314d7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb1f0('0x0'));var zipdir=require(_0xb1f0('0x1'));var jsonpatch=require(_0xb1f0('0x2'));var rp=require(_0xb1f0('0x3'));var moment=require(_0xb1f0('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb1f0('0x5'));var util=require(_0xb1f0('0x6'));var path=require('path');var sox=require(_0xb1f0('0x7'));var csv=require(_0xb1f0('0x8'));var ejs=require(_0xb1f0('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb1f0('0xa'));var squel=require('squel');var crypto=require(_0xb1f0('0xb'));var jsforce=require(_0xb1f0('0xc'));var deskjs=require(_0xb1f0('0xd'));var toCsv=require(_0xb1f0('0x8'));var querystring=require(_0xb1f0('0xe'));var Papa=require('papaparse');var Redis=require(_0xb1f0('0xf'));var authService=require(_0xb1f0('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xb1f0('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb1f0('0x12'))(_0xb1f0('0x13'));var utils=require(_0xb1f0('0x14'));var config=require(_0xb1f0('0x15'));var licenseUtil=require(_0xb1f0('0x16'));var db=require(_0xb1f0('0x17'))['db'];function respondWithStatusCode(_0x3f7a3c,_0x3bc9dd){_0x3bc9dd=_0x3bc9dd||0xcc;return function(_0x25e8d1){if(_0x25e8d1){return _0x3f7a3c['sendStatus'](_0x3bc9dd);}return _0x3f7a3c[_0xb1f0('0x18')](_0x3bc9dd)['end']();};}function respondWithResult(_0x52c46f,_0x5f0362){_0x5f0362=_0x5f0362||0xc8;return function(_0x516e04){if(_0x516e04){return _0x52c46f[_0xb1f0('0x18')](_0x5f0362)[_0xb1f0('0x19')](_0x516e04);}};}function respondWithFilteredResult(_0x3f4b2f,_0x45140a){return function(_0x4f2180){if(_0x4f2180){var _0xfc2271=typeof _0x45140a[_0xb1f0('0x1a')]===_0xb1f0('0x1b')&&typeof _0x45140a[_0xb1f0('0x1c')]===_0xb1f0('0x1b');var _0x2a41a0=_0x4f2180['count'];var _0x851c0c=_0xfc2271?0x0:_0x45140a[_0xb1f0('0x1a')];var _0x39f687=_0xfc2271?_0x4f2180[_0xb1f0('0x1d')]:_0x45140a[_0xb1f0('0x1a')]+_0x45140a[_0xb1f0('0x1c')];var _0x42d31b;if(_0x39f687>=_0x2a41a0){_0x39f687=_0x2a41a0;_0x42d31b=0xc8;}else{_0x42d31b=0xce;}_0x3f4b2f[_0xb1f0('0x18')](_0x42d31b);return _0x3f4b2f['set'](_0xb1f0('0x1e'),_0x851c0c+'-'+_0x39f687+'/'+_0x2a41a0)[_0xb1f0('0x19')](_0x4f2180);}return null;};}function patchUpdates(_0x20bc21){return function(_0x1b4477){try{jsonpatch[_0xb1f0('0x1f')](_0x1b4477,_0x20bc21,!![]);}catch(_0x5bb3c3){return BPromise[_0xb1f0('0x20')](_0x5bb3c3);}return _0x1b4477['save']();};}function saveUpdates(_0x49a8f3,_0x447493){return function(_0x1218f1){if(_0x1218f1){return _0x1218f1['update'](_0x49a8f3)['then'](function(_0x47899e){return _0x47899e;});}return null;};}function removeEntity(_0x2be2fe,_0xafaefc){return function(_0x402309){if(_0x402309){return _0x402309[_0xb1f0('0x21')]()[_0xb1f0('0x22')](function(){_0x2be2fe[_0xb1f0('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5707da,_0x3b0dc5){return function(_0x2f12d0){if(!_0x2f12d0){_0x5707da[_0xb1f0('0x23')](0x194);}return _0x2f12d0;};}function handleError(_0xbb9169,_0x12e06f){_0x12e06f=_0x12e06f||0x1f4;return function(_0x2c6c71){logger[_0xb1f0('0x24')](_0x2c6c71[_0xb1f0('0x25')]);if(_0x2c6c71['name']){delete _0x2c6c71[_0xb1f0('0x26')];}_0xbb9169['status'](_0x12e06f)[_0xb1f0('0x27')](_0x2c6c71);};}exports[_0xb1f0('0x28')]=function(_0x2b224c,_0x268671){var _0x2a8b58={},_0x2c989e={},_0x4c309a={'count':0x0,'rows':[]};var _0x3dc4e8=_[_0xb1f0('0x29')](db[_0xb1f0('0x2a')][_0xb1f0('0x2b')],function(_0x268998){return{'name':_0x268998[_0xb1f0('0x2c')],'type':_0x268998[_0xb1f0('0x2d')][_0xb1f0('0x2e')]};});_0x2c989e[_0xb1f0('0x2f')]=_['map'](_0x3dc4e8,_0xb1f0('0x26'));_0x2c989e[_0xb1f0('0x30')]=_['keys'](_0x2b224c[_0xb1f0('0x30')]);_0x2c989e[_0xb1f0('0x31')]=_[_0xb1f0('0x32')](_0x2c989e[_0xb1f0('0x2f')],_0x2c989e[_0xb1f0('0x30')]);_0x2a8b58['attributes']=_[_0xb1f0('0x32')](_0x2c989e['model'],qs['fields'](_0x2b224c[_0xb1f0('0x30')][_0xb1f0('0x33')]));_0x2a8b58[_0xb1f0('0x34')]=_0x2a8b58['attributes'][_0xb1f0('0x35')]?_0x2a8b58[_0xb1f0('0x34')]:_0x2c989e[_0xb1f0('0x2f')];if(!_0x2b224c[_0xb1f0('0x30')][_0xb1f0('0x36')](_0xb1f0('0x37'))){_0x2a8b58[_0xb1f0('0x1c')]=qs[_0xb1f0('0x1c')](_0x2b224c[_0xb1f0('0x30')]['limit']);_0x2a8b58[_0xb1f0('0x1a')]=qs[_0xb1f0('0x1a')](_0x2b224c['query'][_0xb1f0('0x1a')]);}_0x2a8b58['order']=qs[_0xb1f0('0x38')](_0x2b224c[_0xb1f0('0x30')][_0xb1f0('0x38')]);_0x2a8b58[_0xb1f0('0x39')]=qs[_0xb1f0('0x31')](_[_0xb1f0('0x3a')](_0x2b224c[_0xb1f0('0x30')],_0x2c989e[_0xb1f0('0x31')]),_0x3dc4e8);if(_0x2b224c['query'][_0xb1f0('0x3b')]){_0x2a8b58[_0xb1f0('0x39')]=_[_0xb1f0('0x3c')](_0x2a8b58[_0xb1f0('0x39')],{'$or':_[_0xb1f0('0x29')](_0x3dc4e8,function(_0x32bacc){if(_0x32bacc[_0xb1f0('0x2d')]!=='VIRTUAL'){var _0x5b8beb={};_0x5b8beb[_0x32bacc['name']]={'$like':'%'+_0x2b224c['query'][_0xb1f0('0x3b')]+'%'};return _0x5b8beb;}})});}_0x2a8b58=_[_0xb1f0('0x3c')]({},_0x2a8b58,_0x2b224c[_0xb1f0('0x3d')]);var _0x31f01b={'where':_0x2a8b58['where']};return db[_0xb1f0('0x2a')][_0xb1f0('0x1d')](_0x31f01b)[_0xb1f0('0x22')](function(_0x39fc50){_0x4c309a['count']=_0x39fc50;if(_0x2b224c[_0xb1f0('0x30')][_0xb1f0('0x3e')]){_0x2a8b58[_0xb1f0('0x3f')]=[{'all':!![]}];}return db[_0xb1f0('0x2a')][_0xb1f0('0x40')](_0x2a8b58);})[_0xb1f0('0x22')](function(_0x2ba6fc){_0x4c309a[_0xb1f0('0x41')]=_0x2ba6fc;return _0x4c309a;})[_0xb1f0('0x22')](respondWithFilteredResult(_0x268671,_0x2a8b58))[_0xb1f0('0x42')](handleError(_0x268671,null));};exports['show']=function(_0x5dce81,_0x33b3da){var _0x1b5042={'raw':!![],'where':{'id':_0x5dce81[_0xb1f0('0x43')]['id']}},_0x2b5af5={};_0x2b5af5['model']=_[_0xb1f0('0x44')](db['ZohoField'][_0xb1f0('0x2b')]);_0x2b5af5[_0xb1f0('0x30')]=_['keys'](_0x5dce81[_0xb1f0('0x30')]);_0x2b5af5[_0xb1f0('0x31')]=_[_0xb1f0('0x32')](_0x2b5af5['model'],_0x2b5af5[_0xb1f0('0x30')]);_0x1b5042[_0xb1f0('0x34')]=_[_0xb1f0('0x32')](_0x2b5af5[_0xb1f0('0x2f')],qs[_0xb1f0('0x33')](_0x5dce81['query'][_0xb1f0('0x33')]));_0x1b5042[_0xb1f0('0x34')]=_0x1b5042[_0xb1f0('0x34')]['length']?_0x1b5042[_0xb1f0('0x34')]:_0x2b5af5[_0xb1f0('0x2f')];if(_0x5dce81['query'][_0xb1f0('0x3e')]){_0x1b5042['include']=[{'all':!![]}];}_0x1b5042=_[_0xb1f0('0x3c')]({},_0x1b5042,_0x5dce81[_0xb1f0('0x3d')]);return db[_0xb1f0('0x2a')][_0xb1f0('0x45')](_0x1b5042)[_0xb1f0('0x22')](handleEntityNotFound(_0x33b3da,null))[_0xb1f0('0x22')](respondWithResult(_0x33b3da,null))['catch'](handleError(_0x33b3da,null));};exports[_0xb1f0('0x46')]=function(_0x2d76c3,_0x43159b){return db[_0xb1f0('0x2a')][_0xb1f0('0x46')](_0x2d76c3[_0xb1f0('0x47')],{})[_0xb1f0('0x22')](respondWithResult(_0x43159b,0xc9))['catch'](handleError(_0x43159b,null));};exports[_0xb1f0('0x48')]=function(_0x208a9f,_0x32e883){if(_0x208a9f[_0xb1f0('0x47')]['id']){delete _0x208a9f[_0xb1f0('0x47')]['id'];}return db[_0xb1f0('0x2a')][_0xb1f0('0x45')]({'where':{'id':_0x208a9f[_0xb1f0('0x43')]['id']}})['then'](handleEntityNotFound(_0x32e883,null))[_0xb1f0('0x22')](saveUpdates(_0x208a9f[_0xb1f0('0x47')],null))['then'](respondWithResult(_0x32e883,null))[_0xb1f0('0x42')](handleError(_0x32e883,null));};exports[_0xb1f0('0x21')]=function(_0x6f7a6d,_0x6e9b92){return db['ZohoField'][_0xb1f0('0x45')]({'where':{'id':_0x6f7a6d[_0xb1f0('0x43')]['id']}})['then'](handleEntityNotFound(_0x6e9b92,null))[_0xb1f0('0x22')](removeEntity(_0x6e9b92,null))[_0xb1f0('0x42')](handleError(_0x6e9b92,null));}; \ No newline at end of file +var _0x5ac8=['ZohoField','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','includeAll','include','findAll','catch','show','find','create','body','params','zip-dir','request-promise','moment','bluebird','util','path','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/logger','api','../../config/utils','../../config/environment','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','end','sendStatus','error','stack','name','index'];(function(_0x339eaa,_0xbc2f72){var _0x4985b6=function(_0x10e65b){while(--_0x10e65b){_0x339eaa['push'](_0x339eaa['shift']());}};_0x4985b6(++_0xbc2f72);}(_0x5ac8,0x18b));var _0x85ac=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5ac8[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x85ac('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x85ac('0x1'));var moment=require(_0x85ac('0x2'));var BPromise=require(_0x85ac('0x3'));var Mustache=require('mustache');var util=require(_0x85ac('0x4'));var path=require(_0x85ac('0x5'));var sox=require(_0x85ac('0x6'));var csv=require(_0x85ac('0x7'));var ejs=require(_0x85ac('0x8'));var fs=require('fs');var fs_extra=require(_0x85ac('0x9'));var _=require(_0x85ac('0xa'));var squel=require('squel');var crypto=require(_0x85ac('0xb'));var jsforce=require(_0x85ac('0xc'));var deskjs=require(_0x85ac('0xd'));var toCsv=require(_0x85ac('0x7'));var querystring=require(_0x85ac('0xe'));var Papa=require('papaparse');var Redis=require(_0x85ac('0xf'));var authService=require(_0x85ac('0x10'));var qs=require(_0x85ac('0x11'));var as=require(_0x85ac('0x12'));var hardwareService=require(_0x85ac('0x13'));var logger=require(_0x85ac('0x14'))(_0x85ac('0x15'));var utils=require(_0x85ac('0x16'));var config=require(_0x85ac('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xff7df3,_0x6e435d){_0x6e435d=_0x6e435d||0xcc;return function(_0x367a24){if(_0x367a24){return _0xff7df3['sendStatus'](_0x6e435d);}return _0xff7df3[_0x85ac('0x18')](_0x6e435d)['end']();};}function respondWithResult(_0x489e4c,_0x492150){_0x492150=_0x492150||0xc8;return function(_0x26da6b){if(_0x26da6b){return _0x489e4c[_0x85ac('0x18')](_0x492150)[_0x85ac('0x19')](_0x26da6b);}};}function respondWithFilteredResult(_0x4187e0,_0x33fb45){return function(_0x44f427){if(_0x44f427){var _0x1e6898=typeof _0x33fb45[_0x85ac('0x1a')]==='undefined'&&typeof _0x33fb45[_0x85ac('0x1b')]===_0x85ac('0x1c');var _0x27acc0=_0x44f427[_0x85ac('0x1d')];var _0x1b0db0=_0x1e6898?0x0:_0x33fb45[_0x85ac('0x1a')];var _0x3c76e5=_0x1e6898?_0x44f427[_0x85ac('0x1d')]:_0x33fb45[_0x85ac('0x1a')]+_0x33fb45[_0x85ac('0x1b')];var _0x1dc778;if(_0x3c76e5>=_0x27acc0){_0x3c76e5=_0x27acc0;_0x1dc778=0xc8;}else{_0x1dc778=0xce;}_0x4187e0[_0x85ac('0x18')](_0x1dc778);return _0x4187e0[_0x85ac('0x1e')](_0x85ac('0x1f'),_0x1b0db0+'-'+_0x3c76e5+'/'+_0x27acc0)[_0x85ac('0x19')](_0x44f427);}return null;};}function patchUpdates(_0x56927b){return function(_0x7fdb13){try{jsonpatch[_0x85ac('0x20')](_0x7fdb13,_0x56927b,!![]);}catch(_0x6f3bfb){return BPromise[_0x85ac('0x21')](_0x6f3bfb);}return _0x7fdb13[_0x85ac('0x22')]();};}function saveUpdates(_0x4afa5e,_0x5ef210){return function(_0x1f7485){if(_0x1f7485){return _0x1f7485[_0x85ac('0x23')](_0x4afa5e)[_0x85ac('0x24')](function(_0xce600b){return _0xce600b;});}return null;};}function removeEntity(_0x3aa850,_0x7a2b19){return function(_0x1351cb){if(_0x1351cb){return _0x1351cb['destroy']()[_0x85ac('0x24')](function(){_0x3aa850[_0x85ac('0x18')](0xcc)[_0x85ac('0x25')]();});}};}function handleEntityNotFound(_0x563215,_0x525715){return function(_0x31b6cb){if(!_0x31b6cb){_0x563215[_0x85ac('0x26')](0x194);}return _0x31b6cb;};}function handleError(_0x48ab6e,_0x8fe66e){_0x8fe66e=_0x8fe66e||0x1f4;return function(_0xaf17f8){logger[_0x85ac('0x27')](_0xaf17f8[_0x85ac('0x28')]);if(_0xaf17f8[_0x85ac('0x29')]){delete _0xaf17f8['name'];}_0x48ab6e[_0x85ac('0x18')](_0x8fe66e)['send'](_0xaf17f8);};}exports[_0x85ac('0x2a')]=function(_0x16b569,_0xfa6129){var _0x31760a={},_0x1208fc={},_0x240070={'count':0x0,'rows':[]};var _0x42767b=_['map'](db[_0x85ac('0x2b')][_0x85ac('0x2c')],function(_0x1e2d9c){return{'name':_0x1e2d9c[_0x85ac('0x2d')],'type':_0x1e2d9c[_0x85ac('0x2e')][_0x85ac('0x2f')]};});_0x1208fc[_0x85ac('0x30')]=_[_0x85ac('0x31')](_0x42767b,_0x85ac('0x29'));_0x1208fc[_0x85ac('0x32')]=_[_0x85ac('0x33')](_0x16b569['query']);_0x1208fc[_0x85ac('0x34')]=_['intersection'](_0x1208fc[_0x85ac('0x30')],_0x1208fc[_0x85ac('0x32')]);_0x31760a[_0x85ac('0x35')]=_[_0x85ac('0x36')](_0x1208fc['model'],qs[_0x85ac('0x37')](_0x16b569[_0x85ac('0x32')][_0x85ac('0x37')]));_0x31760a[_0x85ac('0x35')]=_0x31760a[_0x85ac('0x35')][_0x85ac('0x38')]?_0x31760a[_0x85ac('0x35')]:_0x1208fc[_0x85ac('0x30')];if(!_0x16b569[_0x85ac('0x32')][_0x85ac('0x39')]('nolimit')){_0x31760a[_0x85ac('0x1b')]=qs[_0x85ac('0x1b')](_0x16b569[_0x85ac('0x32')]['limit']);_0x31760a[_0x85ac('0x1a')]=qs[_0x85ac('0x1a')](_0x16b569[_0x85ac('0x32')][_0x85ac('0x1a')]);}_0x31760a[_0x85ac('0x3a')]=qs['sort'](_0x16b569[_0x85ac('0x32')][_0x85ac('0x3b')]);_0x31760a[_0x85ac('0x3c')]=qs['filters'](_[_0x85ac('0x3d')](_0x16b569[_0x85ac('0x32')],_0x1208fc[_0x85ac('0x34')]),_0x42767b);if(_0x16b569[_0x85ac('0x32')]['filter']){_0x31760a[_0x85ac('0x3c')]=_['merge'](_0x31760a[_0x85ac('0x3c')],{'$or':_[_0x85ac('0x31')](_0x42767b,function(_0x4cd657){if(_0x4cd657['type']!=='VIRTUAL'){var _0x2bebea={};_0x2bebea[_0x4cd657['name']]={'$like':'%'+_0x16b569[_0x85ac('0x32')][_0x85ac('0x3e')]+'%'};return _0x2bebea;}})});}_0x31760a=_[_0x85ac('0x3f')]({},_0x31760a,_0x16b569['options']);var _0x3e7b18={'where':_0x31760a['where']};return db[_0x85ac('0x2b')]['count'](_0x3e7b18)[_0x85ac('0x24')](function(_0x53021d){_0x240070[_0x85ac('0x1d')]=_0x53021d;if(_0x16b569['query'][_0x85ac('0x40')]){_0x31760a[_0x85ac('0x41')]=[{'all':!![]}];}return db[_0x85ac('0x2b')][_0x85ac('0x42')](_0x31760a);})[_0x85ac('0x24')](function(_0x19243c){_0x240070['rows']=_0x19243c;return _0x240070;})[_0x85ac('0x24')](respondWithFilteredResult(_0xfa6129,_0x31760a))[_0x85ac('0x43')](handleError(_0xfa6129,null));};exports[_0x85ac('0x44')]=function(_0x4c517b,_0x4600a8){var _0x32e6c0={'raw':!![],'where':{'id':_0x4c517b['params']['id']}},_0x3753fb={};_0x3753fb['model']=_[_0x85ac('0x33')](db[_0x85ac('0x2b')][_0x85ac('0x2c')]);_0x3753fb[_0x85ac('0x32')]=_[_0x85ac('0x33')](_0x4c517b[_0x85ac('0x32')]);_0x3753fb[_0x85ac('0x34')]=_[_0x85ac('0x36')](_0x3753fb[_0x85ac('0x30')],_0x3753fb['query']);_0x32e6c0['attributes']=_[_0x85ac('0x36')](_0x3753fb['model'],qs[_0x85ac('0x37')](_0x4c517b[_0x85ac('0x32')][_0x85ac('0x37')]));_0x32e6c0[_0x85ac('0x35')]=_0x32e6c0[_0x85ac('0x35')][_0x85ac('0x38')]?_0x32e6c0[_0x85ac('0x35')]:_0x3753fb['model'];if(_0x4c517b[_0x85ac('0x32')][_0x85ac('0x40')]){_0x32e6c0[_0x85ac('0x41')]=[{'all':!![]}];}_0x32e6c0=_[_0x85ac('0x3f')]({},_0x32e6c0,_0x4c517b['options']);return db['ZohoField'][_0x85ac('0x45')](_0x32e6c0)['then'](handleEntityNotFound(_0x4600a8,null))[_0x85ac('0x24')](respondWithResult(_0x4600a8,null))[_0x85ac('0x43')](handleError(_0x4600a8,null));};exports[_0x85ac('0x46')]=function(_0x4c2b1f,_0x3de1e9){return db['ZohoField']['create'](_0x4c2b1f[_0x85ac('0x47')],{})[_0x85ac('0x24')](respondWithResult(_0x3de1e9,0xc9))['catch'](handleError(_0x3de1e9,null));};exports[_0x85ac('0x23')]=function(_0x4bd67c,_0x1fbd85){if(_0x4bd67c[_0x85ac('0x47')]['id']){delete _0x4bd67c[_0x85ac('0x47')]['id'];}return db['ZohoField'][_0x85ac('0x45')]({'where':{'id':_0x4bd67c[_0x85ac('0x48')]['id']}})[_0x85ac('0x24')](handleEntityNotFound(_0x1fbd85,null))[_0x85ac('0x24')](saveUpdates(_0x4bd67c[_0x85ac('0x47')],null))['then'](respondWithResult(_0x1fbd85,null))[_0x85ac('0x43')](handleError(_0x1fbd85,null));};exports['destroy']=function(_0x185a97,_0x877da6){return db['ZohoField'][_0x85ac('0x45')]({'where':{'id':_0x185a97[_0x85ac('0x48')]['id']}})[_0x85ac('0x24')](handleEntityNotFound(_0x877da6,null))['then'](removeEntity(_0x877da6,null))[_0x85ac('0x43')](handleError(_0x877da6,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 236c713..1ec8698 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 _0xcaf2=['rimraf','./intZohoField.attributes','exports','define','ZohoField','int_zoho_fields','zoho_unique_index','FieldId','lodash','../../config/logger','api','bluebird','request-promise'];(function(_0x124e0f,_0x474f63){var _0x54c56b=function(_0xf57d3e){while(--_0xf57d3e){_0x124e0f['push'](_0x124e0f['shift']());}};_0x54c56b(++_0x474f63);}(_0xcaf2,0x8a));var _0x2caf=function(_0x2dd628,_0x3c22e4){_0x2dd628=_0x2dd628-0x0;var _0x2e138c=_0xcaf2[_0x2dd628];return _0x2e138c;};'use strict';var _=require(_0x2caf('0x0'));var util=require('util');var logger=require(_0x2caf('0x1'))(_0x2caf('0x2'));var moment=require('moment');var BPromise=require(_0x2caf('0x3'));var rp=require(_0x2caf('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2caf('0x5'));var config=require('../../config/environment');var attributes=require(_0x2caf('0x6'));module[_0x2caf('0x7')]=function(_0x249a4b,_0x599ce7){return _0x249a4b[_0x2caf('0x8')](_0x2caf('0x9'),attributes,{'tableName':_0x2caf('0xa'),'paranoid':![],'indexes':[{'name':_0x2caf('0xb'),'fields':['idField',_0x2caf('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1a37=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','ZohoField','int_zoho_fields','lodash','util'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0x1a37,0xb4));var _0x71a3=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0x1a37[_0x4f9b18];return _0x29f20c;};'use strict';var _=require(_0x71a3('0x0'));var util=require(_0x71a3('0x1'));var logger=require(_0x71a3('0x2'))(_0x71a3('0x3'));var moment=require(_0x71a3('0x4'));var BPromise=require(_0x71a3('0x5'));var rp=require(_0x71a3('0x6'));var fs=require('fs');var path=require(_0x71a3('0x7'));var rimraf=require(_0x71a3('0x8'));var config=require(_0x71a3('0x9'));var attributes=require('./intZohoField.attributes');module[_0x71a3('0xa')]=function(_0x4f6b7a,_0xd09f7){return _0x4f6b7a[_0x71a3('0xb')](_0x71a3('0xc'),attributes,{'tableName':_0x71a3('0xd'),'paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':['idField','FieldId'],'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 bb97fc2..8239ff3 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 _0x403f=['../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','ZohoField,\x20%s,\x20%s','request\x20sent','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring'];(function(_0x34d9d6,_0x181fbe){var _0x307d84=function(_0x538ea4){while(--_0x538ea4){_0x34d9d6['push'](_0x34d9d6['shift']());}};_0x307d84(++_0x181fbe);}(_0x403f,0xe3));var _0xf403=function(_0x2ea601,_0x4c3eaf){_0x2ea601=_0x2ea601-0x0;var _0x24b31c=_0x403f[_0x2ea601];return _0x24b31c;};'use strict';var _=require(_0xf403('0x0'));var util=require(_0xf403('0x1'));var moment=require('moment');var BPromise=require(_0xf403('0x2'));var rs=require(_0xf403('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf403('0x4'))['db'];var utils=require(_0xf403('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xf403('0x6'));var jayson=require(_0xf403('0x7'));var client=jayson[_0xf403('0x8')][_0xf403('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x15b7af,_0xce5740,_0x47a34d){return new BPromise(function(_0x489415,_0x3270eb){return client[_0xf403('0xa')](_0x15b7af,_0x47a34d)['then'](function(_0x4fc5dc){logger[_0xf403('0xb')](_0xf403('0xc'),_0xce5740,_0xf403('0xd'));logger['debug'](_0xf403('0xe'),_0xce5740,_0xf403('0xd'),JSON[_0xf403('0xf')](_0x4fc5dc));if(_0x4fc5dc['error']){if(_0x4fc5dc[_0xf403('0x10')][_0xf403('0x11')]===0x1f4){logger[_0xf403('0x10')]('ZohoField,\x20%s,\x20%s',_0xce5740,_0x4fc5dc[_0xf403('0x10')][_0xf403('0x12')]);return _0x3270eb(_0x4fc5dc[_0xf403('0x10')][_0xf403('0x12')]);}logger['error'](_0xf403('0xc'),_0xce5740,_0x4fc5dc[_0xf403('0x10')]['message']);return _0x489415(_0x4fc5dc[_0xf403('0x10')][_0xf403('0x12')]);}else{logger[_0xf403('0xb')](_0xf403('0xc'),_0xce5740,_0xf403('0xd'));_0x489415(_0x4fc5dc[_0xf403('0x13')][_0xf403('0x12')]);}})[_0xf403('0x14')](function(_0x27745b){logger[_0xf403('0x10')](_0xf403('0xc'),_0xce5740,_0x27745b);_0x3270eb(_0x27745b);});});} \ No newline at end of file +var _0xee96=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util'];(function(_0x508338,_0xcf1f4d){var _0x1ccd1b=function(_0x3b4525){while(--_0x3b4525){_0x508338['push'](_0x508338['shift']());}};_0x1ccd1b(++_0xcf1f4d);}(_0xee96,0x17e));var _0x6ee9=function(_0x5167e9,_0x59c597){_0x5167e9=_0x5167e9-0x0;var _0x5e599e=_0xee96[_0x5167e9];return _0x5e599e;};'use strict';var _=require(_0x6ee9('0x0'));var util=require(_0x6ee9('0x1'));var moment=require('moment');var BPromise=require(_0x6ee9('0x2'));var rs=require(_0x6ee9('0x3'));var fs=require('fs');var Redis=require(_0x6ee9('0x4'));var db=require(_0x6ee9('0x5'))['db'];var utils=require(_0x6ee9('0x6'));var logger=require(_0x6ee9('0x7'))('rpc');var config=require(_0x6ee9('0x8'));var jayson=require(_0x6ee9('0x9'));var client=jayson[_0x6ee9('0xa')][_0x6ee9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4468fd,_0xddf5f4,_0xe00fd3){return new BPromise(function(_0x38afbc,_0x4ffc7c){return client[_0x6ee9('0xc')](_0x4468fd,_0xe00fd3)[_0x6ee9('0xd')](function(_0x4c5098){logger[_0x6ee9('0xe')](_0x6ee9('0xf'),_0xddf5f4,_0x6ee9('0x10'));logger[_0x6ee9('0x11')](_0x6ee9('0x12'),_0xddf5f4,'request\x20sent',JSON[_0x6ee9('0x13')](_0x4c5098));if(_0x4c5098[_0x6ee9('0x14')]){if(_0x4c5098['error']['code']===0x1f4){logger[_0x6ee9('0x14')](_0x6ee9('0xf'),_0xddf5f4,_0x4c5098['error'][_0x6ee9('0x15')]);return _0x4ffc7c(_0x4c5098['error'][_0x6ee9('0x15')]);}logger[_0x6ee9('0x14')]('ZohoField,\x20%s,\x20%s',_0xddf5f4,_0x4c5098[_0x6ee9('0x14')][_0x6ee9('0x15')]);return _0x38afbc(_0x4c5098['error'][_0x6ee9('0x15')]);}else{logger[_0x6ee9('0xe')](_0x6ee9('0xf'),_0xddf5f4,_0x6ee9('0x10'));_0x38afbc(_0x4c5098[_0x6ee9('0x16')][_0x6ee9('0x15')]);}})[_0x6ee9('0x17')](function(_0xfca4d9){logger['error']('ZohoField,\x20%s,\x20%s',_0xddf5f4,_0xfca4d9);_0x4ffc7c(_0xfca4d9);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 7f18e1c..69eb739 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(_0x4dec26,_0x1357ce){var _0x23a93a=function(_0xbb67f9){while(--_0xbb67f9){_0x4dec26['push'](_0x4dec26['shift']());}};_0x23a93a(++_0x1357ce);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2ae2ad,_0xac5b0c){_0x2ae2ad=_0x2ae2ad-0x0;var _0x26dbd7=_0xcb91[_0x2ae2ad];return _0x26dbd7;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0xeffcc,_0xbe4475){var _0x3c0822=function(_0x3a80c9){while(--_0x3a80c9){_0xeffcc['push'](_0xeffcc['shift']());}};_0x3c0822(++_0xbe4475);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 250d548..f8c3fe3 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 _0xf3f9=['state','sequelize','STRING','unique_name_and_version','app.js','INTEGER','BOOLEAN'];(function(_0x430795,_0x35d23d){var _0x2c5a86=function(_0x1e7eed){while(--_0x1e7eed){_0x430795['push'](_0x430795['shift']());}};_0x2c5a86(++_0x35d23d);}(_0xf3f9,0x14a));var _0x9f3f=function(_0x1736bf,_0x21ff3b){_0x1736bf=_0x1736bf-0x0;var _0x9cc7b3=_0xf3f9[_0x1736bf];return _0x9cc7b3;};'use strict';var Sequelize=require(_0x9f3f('0x0'));module['exports']={'name':{'type':Sequelize[_0x9f3f('0x1')],'allowNull':![],'unique':_0x9f3f('0x2')},'version':{'type':Sequelize[_0x9f3f('0x1')],'allowNull':![],'unique':_0x9f3f('0x2')},'main':{'type':Sequelize[_0x9f3f('0x1')],'defaultValue':_0x9f3f('0x3')},'filename':{'type':Sequelize[_0x9f3f('0x1')]},'path':{'type':Sequelize[_0x9f3f('0x1')]},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize[_0x9f3f('0x4')]},'active':{'type':Sequelize[_0x9f3f('0x5')],'defaultValue':![]},'author':{'type':Sequelize[_0x9f3f('0x1')]},'logo':{'type':Sequelize[_0x9f3f('0x1')]},'state':{'type':Sequelize[_0x9f3f('0x1')],'unique':_0x9f3f('0x6')},'description':{'type':Sequelize[_0x9f3f('0x1')]},'title':{'type':Sequelize[_0x9f3f('0x1')]},'remoteUri':{'type':Sequelize[_0x9f3f('0x1')]},'link':{'type':Sequelize[_0x9f3f('0x1')],'defaultValue':'#'}}; \ No newline at end of file +var _0x8ae1=['state','sequelize','exports','STRING','unique_name_and_version','app.js','INTEGER'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x8ae1,0x1c8));var _0x18ae=function(_0x14d2a2,_0x478f51){_0x14d2a2=_0x14d2a2-0x0;var _0x2b4f8f=_0x8ae1[_0x14d2a2];return _0x2b4f8f;};'use strict';var Sequelize=require(_0x18ae('0x0'));module[_0x18ae('0x1')]={'name':{'type':Sequelize[_0x18ae('0x2')],'allowNull':![],'unique':_0x18ae('0x3')},'version':{'type':Sequelize[_0x18ae('0x2')],'allowNull':![],'unique':_0x18ae('0x3')},'main':{'type':Sequelize[_0x18ae('0x2')],'defaultValue':_0x18ae('0x4')},'filename':{'type':Sequelize[_0x18ae('0x2')]},'path':{'type':Sequelize[_0x18ae('0x2')]},'type':{'type':Sequelize[_0x18ae('0x2')]},'size':{'type':Sequelize[_0x18ae('0x5')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize[_0x18ae('0x2')]},'state':{'type':Sequelize[_0x18ae('0x2')],'unique':_0x18ae('0x6')},'description':{'type':Sequelize[_0x18ae('0x2')]},'title':{'type':Sequelize[_0x18ae('0x2')]},'remoteUri':{'type':Sequelize[_0x18ae('0x2')]},'link':{'type':Sequelize[_0x18ae('0x2')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index c4209a4..ee74980 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 _0x5496=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','index','Integration','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','offset','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','rows','catch','show','params','keys','fields','include','options','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x4ae625,_0xf396d0){var _0x31accf=function(_0x3ded6b){while(--_0x3ded6b){_0x4ae625['push'](_0x4ae625['shift']());}};_0x31accf(++_0xf396d0);}(_0x5496,0x175));var _0x6549=function(_0x449a76,_0x5eff44){_0x449a76=_0x449a76-0x0;var _0x26c604=_0x5496[_0x449a76];return _0x26c604;};'use strict';var emlformat=require(_0x6549('0x0'));var rimraf=require(_0x6549('0x1'));var zipdir=require(_0x6549('0x2'));var jsonpatch=require(_0x6549('0x3'));var rp=require(_0x6549('0x4'));var moment=require('moment');var BPromise=require(_0x6549('0x5'));var Mustache=require('mustache');var util=require(_0x6549('0x6'));var path=require(_0x6549('0x7'));var sox=require(_0x6549('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6549('0x9'));var _=require(_0x6549('0xa'));var squel=require('squel');var crypto=require(_0x6549('0xb'));var jsforce=require(_0x6549('0xc'));var deskjs=require(_0x6549('0xd'));var toCsv=require('to-csv');var querystring=require(_0x6549('0xe'));var Papa=require(_0x6549('0xf'));var Redis=require(_0x6549('0x10'));var authService=require(_0x6549('0x11'));var qs=require(_0x6549('0x12'));var as=require(_0x6549('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6549('0x14'));var utils=require(_0x6549('0x15'));var config=require(_0x6549('0x16'));var licenseUtil=require(_0x6549('0x17'));var db=require(_0x6549('0x18'))['db'];function respondWithStatusCode(_0x5bc018,_0x4dfb06){_0x4dfb06=_0x4dfb06||0xcc;return function(_0x3f844f){if(_0x3f844f){return _0x5bc018[_0x6549('0x19')](_0x4dfb06);}return _0x5bc018['status'](_0x4dfb06)[_0x6549('0x1a')]();};}function respondWithResult(_0x150fc8,_0x195d25){_0x195d25=_0x195d25||0xc8;return function(_0x12b068){if(_0x12b068){return _0x150fc8[_0x6549('0x1b')](_0x195d25)[_0x6549('0x1c')](_0x12b068);}};}function respondWithFilteredResult(_0x55c112,_0x5db86d){return function(_0x384f75){if(_0x384f75){var _0x25da29=typeof _0x5db86d['offset']===_0x6549('0x1d')&&typeof _0x5db86d[_0x6549('0x1e')]===_0x6549('0x1d');var _0x387e60=_0x384f75[_0x6549('0x1f')];var _0x53b12b=_0x25da29?0x0:_0x5db86d['offset'];var _0x26a212=_0x25da29?_0x384f75['count']:_0x5db86d['offset']+_0x5db86d[_0x6549('0x1e')];var _0x1e5079;if(_0x26a212>=_0x387e60){_0x26a212=_0x387e60;_0x1e5079=0xc8;}else{_0x1e5079=0xce;}_0x55c112[_0x6549('0x1b')](_0x1e5079);return _0x55c112[_0x6549('0x20')](_0x6549('0x21'),_0x53b12b+'-'+_0x26a212+'/'+_0x387e60)['json'](_0x384f75);}return null;};}function patchUpdates(_0x228117){return function(_0x4b40c1){try{jsonpatch[_0x6549('0x22')](_0x4b40c1,_0x228117,!![]);}catch(_0x72322b){return BPromise[_0x6549('0x23')](_0x72322b);}return _0x4b40c1[_0x6549('0x24')]();};}function saveUpdates(_0x22bcf8,_0x12d547){return function(_0x427b47){if(_0x427b47){return _0x427b47[_0x6549('0x25')](_0x22bcf8)[_0x6549('0x26')](function(_0x6ae00c){return _0x6ae00c;});}return null;};}function removeEntity(_0x40d3f9,_0x1fbfa4){return function(_0x23c0ba){if(_0x23c0ba){return _0x23c0ba['destroy']()[_0x6549('0x26')](function(){_0x40d3f9[_0x6549('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x126967,_0x29f89e){return function(_0x3768cb){if(!_0x3768cb){_0x126967['sendStatus'](0x194);}return _0x3768cb;};}function handleError(_0x31a95,_0xfb51a1){_0xfb51a1=_0xfb51a1||0x1f4;return function(_0x14de1f){logger[_0x6549('0x27')](_0x14de1f[_0x6549('0x28')]);if(_0x14de1f[_0x6549('0x29')]){delete _0x14de1f[_0x6549('0x29')];}_0x31a95[_0x6549('0x1b')](_0xfb51a1)['send'](_0x14de1f);};}exports[_0x6549('0x2a')]=function(_0x136518,_0x17fdfb){var _0x4c605c={},_0x3f1502={},_0x4acaf5={'count':0x0,'rows':[]};var _0x4f0ad1=_['map'](db[_0x6549('0x2b')][_0x6549('0x2c')],function(_0x4f3069){return{'name':_0x4f3069[_0x6549('0x2d')],'type':_0x4f3069[_0x6549('0x2e')][_0x6549('0x2f')]};});_0x3f1502[_0x6549('0x30')]=_[_0x6549('0x31')](_0x4f0ad1,_0x6549('0x29'));_0x3f1502[_0x6549('0x32')]=_['keys'](_0x136518[_0x6549('0x32')]);_0x3f1502[_0x6549('0x33')]=_[_0x6549('0x34')](_0x3f1502[_0x6549('0x30')],_0x3f1502[_0x6549('0x32')]);_0x4c605c[_0x6549('0x35')]=_['intersection'](_0x3f1502[_0x6549('0x30')],qs['fields'](_0x136518[_0x6549('0x32')]['fields']));_0x4c605c[_0x6549('0x35')]=_0x4c605c[_0x6549('0x35')][_0x6549('0x36')]?_0x4c605c['attributes']:_0x3f1502[_0x6549('0x30')];if(!_0x136518[_0x6549('0x32')][_0x6549('0x37')](_0x6549('0x38'))){_0x4c605c['limit']=qs['limit'](_0x136518['query'][_0x6549('0x1e')]);_0x4c605c[_0x6549('0x39')]=qs['offset'](_0x136518[_0x6549('0x32')][_0x6549('0x39')]);}_0x4c605c[_0x6549('0x3a')]=qs[_0x6549('0x3b')](_0x136518[_0x6549('0x32')]['sort']);_0x4c605c['where']=qs[_0x6549('0x33')](_[_0x6549('0x3c')](_0x136518[_0x6549('0x32')],_0x3f1502[_0x6549('0x33')]),_0x4f0ad1);if(_0x136518[_0x6549('0x32')][_0x6549('0x3d')]){_0x4c605c[_0x6549('0x3e')]=_[_0x6549('0x3f')](_0x4c605c[_0x6549('0x3e')],{'$or':_[_0x6549('0x31')](_0x4f0ad1,function(_0x525f82){if(_0x525f82[_0x6549('0x2e')]!==_0x6549('0x40')){var _0x2ea977={};_0x2ea977[_0x525f82[_0x6549('0x29')]]={'$like':'%'+_0x136518[_0x6549('0x32')]['filter']+'%'};return _0x2ea977;}})});}_0x4c605c=_['merge']({},_0x4c605c,_0x136518['options']);var _0x22b919={'where':_0x4c605c[_0x6549('0x3e')]};return db[_0x6549('0x2b')][_0x6549('0x1f')](_0x22b919)['then'](function(_0x56ce9f){_0x4acaf5[_0x6549('0x1f')]=_0x56ce9f;if(_0x136518[_0x6549('0x32')][_0x6549('0x41')]){_0x4c605c['include']=[{'all':!![]}];}return db[_0x6549('0x2b')]['findAll'](_0x4c605c);})[_0x6549('0x26')](function(_0x2ec614){_0x4acaf5[_0x6549('0x42')]=_0x2ec614;return _0x4acaf5;})[_0x6549('0x26')](respondWithFilteredResult(_0x17fdfb,_0x4c605c))[_0x6549('0x43')](handleError(_0x17fdfb,null));};exports[_0x6549('0x44')]=function(_0xbbfdc9,_0x4deaab){var _0x132625={'raw':![],'where':{'id':_0xbbfdc9[_0x6549('0x45')]['id']}},_0x309f45={};_0x309f45[_0x6549('0x30')]=_[_0x6549('0x46')](db[_0x6549('0x2b')][_0x6549('0x2c')]);_0x309f45[_0x6549('0x32')]=_[_0x6549('0x46')](_0xbbfdc9[_0x6549('0x32')]);_0x309f45[_0x6549('0x33')]=_[_0x6549('0x34')](_0x309f45[_0x6549('0x30')],_0x309f45[_0x6549('0x32')]);_0x132625[_0x6549('0x35')]=_[_0x6549('0x34')](_0x309f45['model'],qs[_0x6549('0x47')](_0xbbfdc9[_0x6549('0x32')][_0x6549('0x47')]));_0x132625[_0x6549('0x35')]=_0x132625['attributes'][_0x6549('0x36')]?_0x132625['attributes']:_0x309f45[_0x6549('0x30')];if(_0xbbfdc9[_0x6549('0x32')]['includeAll']){_0x132625[_0x6549('0x48')]=[{'all':!![]}];}_0x132625=_[_0x6549('0x3f')]({},_0x132625,_0xbbfdc9[_0x6549('0x49')]);return db[_0x6549('0x2b')][_0x6549('0x4a')](_0x132625)['then'](handleEntityNotFound(_0x4deaab,null))['then'](respondWithResult(_0x4deaab,null))[_0x6549('0x43')](handleError(_0x4deaab,null));};exports[_0x6549('0x4b')]=function(_0x41d675,_0x1712f3){return db[_0x6549('0x2b')]['create'](_0x41d675[_0x6549('0x4c')],{})[_0x6549('0x26')](respondWithResult(_0x1712f3,0xc9))[_0x6549('0x43')](handleError(_0x1712f3,null));};exports[_0x6549('0x25')]=function(_0xa4c650,_0x25a6ee){if(_0xa4c650[_0x6549('0x4c')]['id']){delete _0xa4c650[_0x6549('0x4c')]['id'];}return db['Integration'][_0x6549('0x4a')]({'where':{'id':_0xa4c650['params']['id']}})[_0x6549('0x26')](handleEntityNotFound(_0x25a6ee,null))[_0x6549('0x26')](saveUpdates(_0xa4c650[_0x6549('0x4c')],null))['then'](respondWithResult(_0x25a6ee,null))[_0x6549('0x43')](handleError(_0x25a6ee,null));};exports[_0x6549('0x4d')]=function(_0x2ef4d2,_0x5300c8){return db[_0x6549('0x2b')][_0x6549('0x4a')]({'where':{'id':_0x2ef4d2[_0x6549('0x45')]['id']}})[_0x6549('0x26')](handleEntityNotFound(_0x5300c8,null))[_0x6549('0x26')](removeEntity(_0x5300c8,null))[_0x6549('0x43')](handleError(_0x5300c8,null));}; \ No newline at end of file +var _0x1623=['model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','pick','filter','where','merge','options','Integration','findAll','rows','catch','show','params','length','find','create','body','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','apply','save','update','then','destroy','sendStatus','error','name','send','index','map','rawAttributes','fieldName','type','key'];(function(_0xdc37a1,_0x53ebb9){var _0x99b4fe=function(_0x2811e3){while(--_0x2811e3){_0xdc37a1['push'](_0xdc37a1['shift']());}};_0x99b4fe(++_0x53ebb9);}(_0x1623,0xab));var _0x3162=function(_0x1f4a27,_0x736224){_0x1f4a27=_0x1f4a27-0x0;var _0x54f7f7=_0x1623[_0x1f4a27];return _0x54f7f7;};'use strict';var emlformat=require(_0x3162('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3162('0x1'));var rp=require(_0x3162('0x2'));var moment=require(_0x3162('0x3'));var BPromise=require(_0x3162('0x4'));var Mustache=require(_0x3162('0x5'));var util=require('util');var path=require('path');var sox=require(_0x3162('0x6'));var csv=require('to-csv');var ejs=require(_0x3162('0x7'));var fs=require('fs');var fs_extra=require(_0x3162('0x8'));var _=require('lodash');var squel=require(_0x3162('0x9'));var crypto=require(_0x3162('0xa'));var jsforce=require(_0x3162('0xb'));var deskjs=require(_0x3162('0xc'));var toCsv=require(_0x3162('0xd'));var querystring=require(_0x3162('0xe'));var Papa=require(_0x3162('0xf'));var Redis=require(_0x3162('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3162('0x11'));var hardwareService=require(_0x3162('0x12'));var logger=require(_0x3162('0x13'))(_0x3162('0x14'));var utils=require(_0x3162('0x15'));var config=require(_0x3162('0x16'));var licenseUtil=require(_0x3162('0x17'));var db=require(_0x3162('0x18'))['db'];function respondWithStatusCode(_0x157ab8,_0x4c3625){_0x4c3625=_0x4c3625||0xcc;return function(_0x2d11c5){if(_0x2d11c5){return _0x157ab8['sendStatus'](_0x4c3625);}return _0x157ab8[_0x3162('0x19')](_0x4c3625)[_0x3162('0x1a')]();};}function respondWithResult(_0x49d1ad,_0x4a393a){_0x4a393a=_0x4a393a||0xc8;return function(_0x198764){if(_0x198764){return _0x49d1ad[_0x3162('0x19')](_0x4a393a)[_0x3162('0x1b')](_0x198764);}};}function respondWithFilteredResult(_0x4b8a3b,_0x15e348){return function(_0x3d0bea){if(_0x3d0bea){var _0x2705d1=typeof _0x15e348['offset']===_0x3162('0x1c')&&typeof _0x15e348[_0x3162('0x1d')]===_0x3162('0x1c');var _0xc3ee06=_0x3d0bea[_0x3162('0x1e')];var _0x1eed46=_0x2705d1?0x0:_0x15e348[_0x3162('0x1f')];var _0x4b2bf3=_0x2705d1?_0x3d0bea[_0x3162('0x1e')]:_0x15e348[_0x3162('0x1f')]+_0x15e348[_0x3162('0x1d')];var _0x36ca97;if(_0x4b2bf3>=_0xc3ee06){_0x4b2bf3=_0xc3ee06;_0x36ca97=0xc8;}else{_0x36ca97=0xce;}_0x4b8a3b['status'](_0x36ca97);return _0x4b8a3b[_0x3162('0x20')]('Content-Range',_0x1eed46+'-'+_0x4b2bf3+'/'+_0xc3ee06)['json'](_0x3d0bea);}return null;};}function patchUpdates(_0xa5c62b){return function(_0x3e4d23){try{jsonpatch[_0x3162('0x21')](_0x3e4d23,_0xa5c62b,!![]);}catch(_0x523fab){return BPromise['reject'](_0x523fab);}return _0x3e4d23[_0x3162('0x22')]();};}function saveUpdates(_0x396372,_0x32c051){return function(_0x26c90d){if(_0x26c90d){return _0x26c90d[_0x3162('0x23')](_0x396372)[_0x3162('0x24')](function(_0x52ae25){return _0x52ae25;});}return null;};}function removeEntity(_0x1b2713,_0x5a4994){return function(_0xd283d6){if(_0xd283d6){return _0xd283d6[_0x3162('0x25')]()[_0x3162('0x24')](function(){_0x1b2713[_0x3162('0x19')](0xcc)[_0x3162('0x1a')]();});}};}function handleEntityNotFound(_0x3c543e,_0x30552f){return function(_0x5f8f7){if(!_0x5f8f7){_0x3c543e[_0x3162('0x26')](0x194);}return _0x5f8f7;};}function handleError(_0x356c5d,_0x8fa09f){_0x8fa09f=_0x8fa09f||0x1f4;return function(_0x2f62d7){logger[_0x3162('0x27')](_0x2f62d7['stack']);if(_0x2f62d7[_0x3162('0x28')]){delete _0x2f62d7['name'];}_0x356c5d[_0x3162('0x19')](_0x8fa09f)[_0x3162('0x29')](_0x2f62d7);};}exports[_0x3162('0x2a')]=function(_0x57f567,_0x4903e7){var _0xda0389={},_0xaa1f35={},_0x14df16={'count':0x0,'rows':[]};var _0x399148=_[_0x3162('0x2b')](db['Integration'][_0x3162('0x2c')],function(_0x4e3cc2){return{'name':_0x4e3cc2[_0x3162('0x2d')],'type':_0x4e3cc2[_0x3162('0x2e')][_0x3162('0x2f')]};});_0xaa1f35[_0x3162('0x30')]=_[_0x3162('0x2b')](_0x399148,_0x3162('0x28'));_0xaa1f35[_0x3162('0x31')]=_[_0x3162('0x32')](_0x57f567['query']);_0xaa1f35[_0x3162('0x33')]=_[_0x3162('0x34')](_0xaa1f35['model'],_0xaa1f35[_0x3162('0x31')]);_0xda0389[_0x3162('0x35')]=_['intersection'](_0xaa1f35['model'],qs[_0x3162('0x36')](_0x57f567['query'][_0x3162('0x36')]));_0xda0389[_0x3162('0x35')]=_0xda0389[_0x3162('0x35')]['length']?_0xda0389['attributes']:_0xaa1f35[_0x3162('0x30')];if(!_0x57f567[_0x3162('0x31')]['hasOwnProperty'](_0x3162('0x37'))){_0xda0389['limit']=qs[_0x3162('0x1d')](_0x57f567[_0x3162('0x31')][_0x3162('0x1d')]);_0xda0389[_0x3162('0x1f')]=qs[_0x3162('0x1f')](_0x57f567[_0x3162('0x31')][_0x3162('0x1f')]);}_0xda0389[_0x3162('0x38')]=qs[_0x3162('0x39')](_0x57f567[_0x3162('0x31')][_0x3162('0x39')]);_0xda0389['where']=qs[_0x3162('0x33')](_[_0x3162('0x3a')](_0x57f567[_0x3162('0x31')],_0xaa1f35['filters']),_0x399148);if(_0x57f567['query'][_0x3162('0x3b')]){_0xda0389[_0x3162('0x3c')]=_[_0x3162('0x3d')](_0xda0389[_0x3162('0x3c')],{'$or':_['map'](_0x399148,function(_0x4186b6){if(_0x4186b6['type']!=='VIRTUAL'){var _0x5dee49={};_0x5dee49[_0x4186b6[_0x3162('0x28')]]={'$like':'%'+_0x57f567[_0x3162('0x31')][_0x3162('0x3b')]+'%'};return _0x5dee49;}})});}_0xda0389=_['merge']({},_0xda0389,_0x57f567[_0x3162('0x3e')]);var _0x2ce9c6={'where':_0xda0389[_0x3162('0x3c')]};return db[_0x3162('0x3f')][_0x3162('0x1e')](_0x2ce9c6)['then'](function(_0x5447d6){_0x14df16[_0x3162('0x1e')]=_0x5447d6;if(_0x57f567[_0x3162('0x31')]['includeAll']){_0xda0389['include']=[{'all':!![]}];}return db[_0x3162('0x3f')][_0x3162('0x40')](_0xda0389);})[_0x3162('0x24')](function(_0x4883ac){_0x14df16[_0x3162('0x41')]=_0x4883ac;return _0x14df16;})[_0x3162('0x24')](respondWithFilteredResult(_0x4903e7,_0xda0389))[_0x3162('0x42')](handleError(_0x4903e7,null));};exports[_0x3162('0x43')]=function(_0x534708,_0x2617d3){var _0x282e3e={'raw':![],'where':{'id':_0x534708[_0x3162('0x44')]['id']}},_0x522cce={};_0x522cce[_0x3162('0x30')]=_['keys'](db[_0x3162('0x3f')][_0x3162('0x2c')]);_0x522cce['query']=_[_0x3162('0x32')](_0x534708['query']);_0x522cce[_0x3162('0x33')]=_[_0x3162('0x34')](_0x522cce[_0x3162('0x30')],_0x522cce[_0x3162('0x31')]);_0x282e3e[_0x3162('0x35')]=_[_0x3162('0x34')](_0x522cce['model'],qs[_0x3162('0x36')](_0x534708[_0x3162('0x31')][_0x3162('0x36')]));_0x282e3e['attributes']=_0x282e3e[_0x3162('0x35')][_0x3162('0x45')]?_0x282e3e['attributes']:_0x522cce[_0x3162('0x30')];if(_0x534708['query']['includeAll']){_0x282e3e['include']=[{'all':!![]}];}_0x282e3e=_[_0x3162('0x3d')]({},_0x282e3e,_0x534708[_0x3162('0x3e')]);return db[_0x3162('0x3f')][_0x3162('0x46')](_0x282e3e)[_0x3162('0x24')](handleEntityNotFound(_0x2617d3,null))[_0x3162('0x24')](respondWithResult(_0x2617d3,null))[_0x3162('0x42')](handleError(_0x2617d3,null));};exports[_0x3162('0x47')]=function(_0x3d2958,_0x28865c){return db[_0x3162('0x3f')][_0x3162('0x47')](_0x3d2958[_0x3162('0x48')],{})['then'](respondWithResult(_0x28865c,0xc9))[_0x3162('0x42')](handleError(_0x28865c,null));};exports['update']=function(_0x4f1dde,_0x12d791){if(_0x4f1dde[_0x3162('0x48')]['id']){delete _0x4f1dde[_0x3162('0x48')]['id'];}return db[_0x3162('0x3f')]['find']({'where':{'id':_0x4f1dde[_0x3162('0x44')]['id']}})['then'](handleEntityNotFound(_0x12d791,null))[_0x3162('0x24')](saveUpdates(_0x4f1dde[_0x3162('0x48')],null))['then'](respondWithResult(_0x12d791,null))[_0x3162('0x42')](handleError(_0x12d791,null));};exports['destroy']=function(_0x516599,_0x13e7c4){return db[_0x3162('0x3f')][_0x3162('0x46')]({'where':{'id':_0x516599[_0x3162('0x44')]['id']}})[_0x3162('0x24')](handleEntityNotFound(_0x13e7c4,null))[_0x3162('0x24')](removeEntity(_0x13e7c4,null))[_0x3162('0x42')](handleError(_0x13e7c4,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 1a1f0aa..0293dd0 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 _0xcf47=['../../config/logger','api','bluebird','request-promise','path','../../config/environment','./integration.attributes','exports','define','Integration','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcf47,0x175));var _0x7cf4=function(_0x4e5a73,_0xb07f56){_0x4e5a73=_0x4e5a73-0x0;var _0x548c2d=_0xcf47[_0x4e5a73];return _0x548c2d;};'use strict';var _=require('lodash');var util=require(_0x7cf4('0x0'));var logger=require(_0x7cf4('0x1'))(_0x7cf4('0x2'));var moment=require('moment');var BPromise=require(_0x7cf4('0x3'));var rp=require(_0x7cf4('0x4'));var fs=require('fs');var path=require(_0x7cf4('0x5'));var rimraf=require('rimraf');var config=require(_0x7cf4('0x6'));var attributes=require(_0x7cf4('0x7'));module[_0x7cf4('0x8')]=function(_0x57ad4f,_0x1262b6){return _0x57ad4f[_0x7cf4('0x9')](_0x7cf4('0xa'),attributes,{'tableName':'integrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8ed5=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./integration.attributes','exports','integrations','lodash','util'];(function(_0x2c34ff,_0x1e8bee){var _0x476508=function(_0x3e50db){while(--_0x3e50db){_0x2c34ff['push'](_0x2c34ff['shift']());}};_0x476508(++_0x1e8bee);}(_0x8ed5,0x136));var _0x58ed=function(_0x478b0d,_0x228579){_0x478b0d=_0x478b0d-0x0;var _0x1d10f5=_0x8ed5[_0x478b0d];return _0x1d10f5;};'use strict';var _=require(_0x58ed('0x0'));var util=require(_0x58ed('0x1'));var logger=require(_0x58ed('0x2'))(_0x58ed('0x3'));var moment=require(_0x58ed('0x4'));var BPromise=require(_0x58ed('0x5'));var rp=require(_0x58ed('0x6'));var fs=require('fs');var path=require(_0x58ed('0x7'));var rimraf=require(_0x58ed('0x8'));var config=require(_0x58ed('0x9'));var attributes=require(_0x58ed('0xa'));module[_0x58ed('0xb')]=function(_0x5e60e5,_0x4e966d){return _0x5e60e5['define']('Integration',attributes,{'tableName':_0x58ed('0xc'),'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 01776d2..2241207 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 _0x57ca=['client','http','request','info','request\x20sent','Integration,\x20%s,\x20%s,\x20%s','error','code','Integration,\x20%s,\x20%s','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x2baa28,_0x30ea5e){var _0x909465=function(_0xebc686){while(--_0xebc686){_0x2baa28['push'](_0x2baa28['shift']());}};_0x909465(++_0x30ea5e);}(_0x57ca,0x108));var _0xa57c=function(_0x2f145c,_0x1667ae){_0x2f145c=_0x2f145c-0x0;var _0x54f781=_0x57ca[_0x2f145c];return _0x54f781;};'use strict';var _=require('lodash');var util=require(_0xa57c('0x0'));var moment=require(_0xa57c('0x1'));var BPromise=require('bluebird');var rs=require(_0xa57c('0x2'));var fs=require('fs');var Redis=require(_0xa57c('0x3'));var db=require(_0xa57c('0x4'))['db'];var utils=require(_0xa57c('0x5'));var logger=require(_0xa57c('0x6'))('rpc');var config=require(_0xa57c('0x7'));var jayson=require(_0xa57c('0x8'));var client=jayson[_0xa57c('0x9')][_0xa57c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xbdfffb,_0x314574,_0x19e28e){return new BPromise(function(_0x271ccc,_0x5e3962){return client[_0xa57c('0xb')](_0xbdfffb,_0x19e28e)['then'](function(_0x46ba92){logger[_0xa57c('0xc')]('Integration,\x20%s,\x20%s',_0x314574,_0xa57c('0xd'));logger['debug'](_0xa57c('0xe'),_0x314574,_0xa57c('0xd'),JSON['stringify'](_0x46ba92));if(_0x46ba92[_0xa57c('0xf')]){if(_0x46ba92['error'][_0xa57c('0x10')]===0x1f4){logger[_0xa57c('0xf')](_0xa57c('0x11'),_0x314574,_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);return _0x5e3962(_0x46ba92['error'][_0xa57c('0x12')]);}logger['error'](_0xa57c('0x11'),_0x314574,_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);return _0x271ccc(_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);}else{logger[_0xa57c('0xc')](_0xa57c('0x11'),_0x314574,'request\x20sent');_0x271ccc(_0x46ba92[_0xa57c('0x13')][_0xa57c('0x12')]);}})[_0xa57c('0x14')](function(_0x5a6024){logger[_0xa57c('0xf')]('Integration,\x20%s,\x20%s',_0x314574,_0x5a6024);_0x5e3962(_0x5a6024);});});} \ No newline at end of file +var _0xc6ac=['http','request','then','info','Integration,\x20%s,\x20%s','debug','Integration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x272b62,_0x5a0a97){var _0x22e753=function(_0x267f04){while(--_0x267f04){_0x272b62['push'](_0x272b62['shift']());}};_0x22e753(++_0x5a0a97);}(_0xc6ac,0x15b));var _0xcc6a=function(_0xb7bd2d,_0x236857){_0xb7bd2d=_0xb7bd2d-0x0;var _0x3dda07=_0xc6ac[_0xb7bd2d];return _0x3dda07;};'use strict';var _=require(_0xcc6a('0x0'));var util=require(_0xcc6a('0x1'));var moment=require(_0xcc6a('0x2'));var BPromise=require(_0xcc6a('0x3'));var rs=require(_0xcc6a('0x4'));var fs=require('fs');var Redis=require(_0xcc6a('0x5'));var db=require(_0xcc6a('0x6'))['db'];var utils=require(_0xcc6a('0x7'));var logger=require(_0xcc6a('0x8'))(_0xcc6a('0x9'));var config=require(_0xcc6a('0xa'));var jayson=require(_0xcc6a('0xb'));var client=jayson[_0xcc6a('0xc')][_0xcc6a('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x5f3887,_0x3dd497,_0x11b919){return new BPromise(function(_0xf02261,_0x560cc4){return client[_0xcc6a('0xe')](_0x5f3887,_0x11b919)[_0xcc6a('0xf')](function(_0x7806a0){logger[_0xcc6a('0x10')](_0xcc6a('0x11'),_0x3dd497,'request\x20sent');logger[_0xcc6a('0x12')](_0xcc6a('0x13'),_0x3dd497,_0xcc6a('0x14'),JSON['stringify'](_0x7806a0));if(_0x7806a0[_0xcc6a('0x15')]){if(_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x16')]===0x1f4){logger['error']('Integration,\x20%s,\x20%s',_0x3dd497,_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x17')]);return _0x560cc4(_0x7806a0[_0xcc6a('0x15')]['message']);}logger['error'](_0xcc6a('0x11'),_0x3dd497,_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x17')]);return _0xf02261(_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x17')]);}else{logger[_0xcc6a('0x10')](_0xcc6a('0x11'),_0x3dd497,_0xcc6a('0x14'));_0xf02261(_0x7806a0['result']['message']);}})['catch'](function(_0x395a55){logger[_0xcc6a('0x15')](_0xcc6a('0x11'),_0x3dd497,_0x395a55);_0x560cc4(_0x395a55);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 6aca91e..ba01b5b 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 _0x9f0e=['path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','/describe','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','multer','util'];(function(_0x2755fb,_0x5970f1){var _0x293f12=function(_0x4c629d){while(--_0x4c629d){_0x2755fb['push'](_0x2755fb['shift']());}};_0x293f12(++_0x5970f1);}(_0x9f0e,0x116));var _0xe9f0=function(_0x1fcae9,_0x4ae6f8){_0x1fcae9=_0x1fcae9-0x0;var _0x400596=_0x9f0e[_0x1fcae9];return _0x400596;};'use strict';var multer=require(_0xe9f0('0x0'));var util=require(_0xe9f0('0x1'));var path=require(_0xe9f0('0x2'));var timeout=require(_0xe9f0('0x3'));var express=require(_0xe9f0('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe9f0('0x5'));var interaction=require(_0xe9f0('0x6'));var config=require(_0xe9f0('0x7'));var controller=require(_0xe9f0('0x8'));router[_0xe9f0('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xe9f0('0x9')](_0xe9f0('0xa'),auth[_0xe9f0('0xb')](),controller['describe']);router[_0xe9f0('0x9')](_0xe9f0('0xc'),auth[_0xe9f0('0xb')](),controller[_0xe9f0('0xd')]);router[_0xe9f0('0xe')]('/',auth[_0xe9f0('0xb')](),controller[_0xe9f0('0xf')]);router[_0xe9f0('0x10')](_0xe9f0('0xc'),auth['isAuthenticated'](),controller[_0xe9f0('0x11')]);router[_0xe9f0('0x12')](_0xe9f0('0xc'),auth['isAuthenticated'](),controller[_0xe9f0('0x13')]);module['exports']=router; \ No newline at end of file +var _0x1a85=['../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','show','post','create','put','/:id','update','delete','destroy','exports','path','connect-timeout','express','../../components/auth/service'];(function(_0x37dbbb,_0x1909de){var _0x10068f=function(_0x2464b0){while(--_0x2464b0){_0x37dbbb['push'](_0x37dbbb['shift']());}};_0x10068f(++_0x1909de);}(_0x1a85,0x178));var _0x51a8=function(_0x2d67b4,_0x4ca8fe){_0x2d67b4=_0x2d67b4-0x0;var _0x4cd582=_0x1a85[_0x2d67b4];return _0x4cd582;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x51a8('0x0'));var timeout=require(_0x51a8('0x1'));var express=require(_0x51a8('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x51a8('0x3'));var interaction=require(_0x51a8('0x4'));var config=require(_0x51a8('0x5'));var controller=require('./integrationReport.controller');router[_0x51a8('0x6')]('/',auth['isAuthenticated'](),controller[_0x51a8('0x7')]);router['get'](_0x51a8('0x8'),auth[_0x51a8('0x9')](),controller['describe']);router[_0x51a8('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x51a8('0xa')]);router[_0x51a8('0xb')]('/',auth[_0x51a8('0x9')](),controller[_0x51a8('0xc')]);router[_0x51a8('0xd')](_0x51a8('0xe'),auth[_0x51a8('0x9')](),controller[_0x51a8('0xf')]);router[_0x51a8('0x10')](_0x51a8('0xe'),auth[_0x51a8('0x9')](),controller[_0x51a8('0x11')]);module[_0x51a8('0x12')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 0b0239b..bee3742 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 _0x7552=['INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENDING','RECEIVED','FAILED','sequelize','exports','STRING'];(function(_0x20191f,_0x23ad69){var _0x4d0294=function(_0x48b127){while(--_0x48b127){_0x20191f['push'](_0x20191f['shift']());}};_0x4d0294(++_0x23ad69);}(_0x7552,0xe4));var _0x2755=function(_0x399a4f,_0x28d3f8){_0x399a4f=_0x399a4f-0x0;var _0x806c48=_0x7552[_0x399a4f];return _0x806c48;};'use strict';var Sequelize=require(_0x2755('0x0'));module[_0x2755('0x1')]={'integration':{'type':Sequelize[_0x2755('0x2')]},'eventChannel':{'type':Sequelize[_0x2755('0x2')]},'exitStatus':{'type':Sequelize[_0x2755('0x2')]},'ticketId':{'type':Sequelize[_0x2755('0x2')]},'integrationId':{'type':Sequelize[_0x2755('0x3')]},'contacts':{'type':Sequelize[_0x2755('0x2')]},'uniqueid':{'type':Sequelize[_0x2755('0x2')]},'calleridnum':{'type':Sequelize[_0x2755('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x2755('0x4')]},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0x2755('0x3')]},'agentcomplete':{'type':Sequelize[_0x2755('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x2755('0x4')]},'talktime':{'type':Sequelize[_0x2755('0x3')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x2755('0x3')]},'reason':{'type':Sequelize[_0x2755('0x2')]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize[_0x2755('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x2755('0x4')]},'lastevent':{'type':Sequelize[_0x2755('0x2')]},'channel':{'type':Sequelize[_0x2755('0x2')]},'channelstate':{'type':Sequelize[_0x2755('0x3')]},'channelstatedesc':{'type':Sequelize[_0x2755('0x2')]},'connectedlinenum':{'type':Sequelize[_0x2755('0x2')]},'connectedlinename':{'type':Sequelize[_0x2755('0x2')]},'language':{'type':Sequelize[_0x2755('0x2')]},'accountcode':{'type':Sequelize[_0x2755('0x2')]},'context':{'type':Sequelize[_0x2755('0x2')]},'exten':{'type':Sequelize[_0x2755('0x2')]},'priority':{'type':Sequelize[_0x2755('0x2')]},'destchannel':{'type':Sequelize[_0x2755('0x2')]},'destchannelstate':{'type':Sequelize[_0x2755('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x2755('0x2')]},'destcalleridname':{'type':Sequelize[_0x2755('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x2755('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x2755('0x2')]},'destaccountcode':{'type':Sequelize[_0x2755('0x2')]},'destcontext':{'type':Sequelize[_0x2755('0x2')]},'destexten':{'type':Sequelize[_0x2755('0x2')]},'destpriority':{'type':Sequelize[_0x2755('0x2')]},'destuniqueid':{'type':Sequelize[_0x2755('0x2')]},'messageId':{'type':Sequelize[_0x2755('0x2')]},'inReplyTo':{'type':Sequelize[_0x2755('0x2')]},'subject':{'type':Sequelize[_0x2755('0x2')]},'from':{'type':Sequelize[_0x2755('0x2')]},'to':{'type':Sequelize[_0x2755('0x2')]},'cc':{'type':Sequelize[_0x2755('0x2')]},'attachment':{'type':Sequelize[_0x2755('0x6')]},'html':{'type':Sequelize[_0x2755('0x6')]},'text':{'type':Sequelize[_0x2755('0x6')]},'status':{'type':Sequelize[_0x2755('0x7')]('SENT',_0x2755('0x8'),_0x2755('0x9'),_0x2755('0xa'))},'url':{'type':Sequelize[_0x2755('0x2')]},'app':{'type':Sequelize[_0x2755('0x2')]},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize[_0x2755('0x3')]}}; \ No newline at end of file +var _0xe446=['STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENDING','RECEIVED','FAILED','exports'];(function(_0x1d7037,_0x57dd95){var _0x4d6568=function(_0x5c64c5){while(--_0x5c64c5){_0x1d7037['push'](_0x1d7037['shift']());}};_0x4d6568(++_0x57dd95);}(_0xe446,0x1df));var _0x6e44=function(_0x3655e5,_0x469eae){_0x3655e5=_0x3655e5-0x0;var _0x37dfac=_0xe446[_0x3655e5];return _0x37dfac;};'use strict';var Sequelize=require('sequelize');module[_0x6e44('0x0')]={'integration':{'type':Sequelize[_0x6e44('0x1')]},'eventChannel':{'type':Sequelize[_0x6e44('0x1')]},'exitStatus':{'type':Sequelize[_0x6e44('0x1')]},'ticketId':{'type':Sequelize[_0x6e44('0x1')]},'integrationId':{'type':Sequelize[_0x6e44('0x2')]},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x6e44('0x1')]},'calleridnum':{'type':Sequelize[_0x6e44('0x1')]},'calleridname':{'type':Sequelize[_0x6e44('0x1')]},'queue':{'type':Sequelize[_0x6e44('0x1')]},'interface':{'type':Sequelize[_0x6e44('0x1')]},'membername':{'type':Sequelize[_0x6e44('0x1')]},'agentcalledAt':{'type':Sequelize[_0x6e44('0x3')]},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0x6e44('0x2')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x6e44('0x3')]},'talktime':{'type':Sequelize[_0x6e44('0x2')]},'agentacw':{'type':Sequelize[_0x6e44('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x6e44('0x2')]},'reason':{'type':Sequelize[_0x6e44('0x1')]},'agentringnoanswer':{'type':Sequelize[_0x6e44('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize[_0x6e44('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x6e44('0x3')]},'lastevent':{'type':Sequelize[_0x6e44('0x1')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x6e44('0x2')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x6e44('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x6e44('0x1')]},'exten':{'type':Sequelize[_0x6e44('0x1')]},'priority':{'type':Sequelize[_0x6e44('0x1')]},'destchannel':{'type':Sequelize[_0x6e44('0x1')]},'destchannelstate':{'type':Sequelize[_0x6e44('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x6e44('0x1')]},'destcalleridnum':{'type':Sequelize[_0x6e44('0x1')]},'destcalleridname':{'type':Sequelize[_0x6e44('0x1')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x6e44('0x1')]},'destlanguage':{'type':Sequelize[_0x6e44('0x1')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x6e44('0x1')]},'destexten':{'type':Sequelize[_0x6e44('0x1')]},'destpriority':{'type':Sequelize[_0x6e44('0x1')]},'destuniqueid':{'type':Sequelize[_0x6e44('0x1')]},'messageId':{'type':Sequelize[_0x6e44('0x1')]},'inReplyTo':{'type':Sequelize[_0x6e44('0x1')]},'subject':{'type':Sequelize[_0x6e44('0x1')]},'from':{'type':Sequelize[_0x6e44('0x1')]},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize[_0x6e44('0x5')]},'html':{'type':Sequelize[_0x6e44('0x5')]},'text':{'type':Sequelize['TEXT']},'status':{'type':Sequelize[_0x6e44('0x6')]('SENT',_0x6e44('0x7'),_0x6e44('0x8'),_0x6e44('0x9'))},'url':{'type':Sequelize[_0x6e44('0x1')]},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize[_0x6e44('0x1')]},'projectId':{'type':Sequelize[_0x6e44('0x2')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 36cf274..ffee873 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 _0xa32e=['to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','sendStatus','error','stack','name','map','IntegrationReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','order','sort','where','filters','pick','VIRTUAL','filter','merge','options','includeAll','findAll','rows','catch','show','params','length','include','create','body','update','find','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0xa32e,0x95));var _0xea32=function(_0xaf326d,_0xc3a37c){_0xaf326d=_0xaf326d-0x0;var _0x4aacda=_0xa32e[_0xaf326d];return _0x4aacda;};'use strict';var emlformat=require(_0xea32('0x0'));var rimraf=require(_0xea32('0x1'));var zipdir=require(_0xea32('0x2'));var jsonpatch=require(_0xea32('0x3'));var rp=require(_0xea32('0x4'));var moment=require(_0xea32('0x5'));var BPromise=require(_0xea32('0x6'));var Mustache=require(_0xea32('0x7'));var util=require(_0xea32('0x8'));var path=require(_0xea32('0x9'));var sox=require(_0xea32('0xa'));var csv=require(_0xea32('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xea32('0xc'));var _=require(_0xea32('0xd'));var squel=require(_0xea32('0xe'));var crypto=require(_0xea32('0xf'));var jsforce=require(_0xea32('0x10'));var deskjs=require(_0xea32('0x11'));var toCsv=require(_0xea32('0xb'));var querystring=require(_0xea32('0x12'));var Papa=require(_0xea32('0x13'));var Redis=require(_0xea32('0x14'));var authService=require(_0xea32('0x15'));var qs=require(_0xea32('0x16'));var as=require(_0xea32('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xea32('0x18'));var utils=require(_0xea32('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xea32('0x1a'));var db=require(_0xea32('0x1b'))['db'];function respondWithStatusCode(_0x2229f3,_0x1c0ebb){_0x1c0ebb=_0x1c0ebb||0xcc;return function(_0x5f1aae){if(_0x5f1aae){return _0x2229f3['sendStatus'](_0x1c0ebb);}return _0x2229f3[_0xea32('0x1c')](_0x1c0ebb)[_0xea32('0x1d')]();};}function respondWithResult(_0x58200a,_0x1bf3eb){_0x1bf3eb=_0x1bf3eb||0xc8;return function(_0x59006d){if(_0x59006d){return _0x58200a[_0xea32('0x1c')](_0x1bf3eb)[_0xea32('0x1e')](_0x59006d);}};}function respondWithFilteredResult(_0x180b9e,_0x4f9fb7){return function(_0x2e52f0){if(_0x2e52f0){var _0x397385=typeof _0x4f9fb7[_0xea32('0x1f')]===_0xea32('0x20')&&typeof _0x4f9fb7[_0xea32('0x21')]==='undefined';var _0x4ea20e=_0x2e52f0[_0xea32('0x22')];var _0x248ba4=_0x397385?0x0:_0x4f9fb7[_0xea32('0x1f')];var _0x3d1b63=_0x397385?_0x2e52f0['count']:_0x4f9fb7[_0xea32('0x1f')]+_0x4f9fb7['limit'];var _0x1b1fc5;if(_0x3d1b63>=_0x4ea20e){_0x3d1b63=_0x4ea20e;_0x1b1fc5=0xc8;}else{_0x1b1fc5=0xce;}_0x180b9e['status'](_0x1b1fc5);return _0x180b9e[_0xea32('0x23')](_0xea32('0x24'),_0x248ba4+'-'+_0x3d1b63+'/'+_0x4ea20e)[_0xea32('0x1e')](_0x2e52f0);}return null;};}function patchUpdates(_0x2ba5bb){return function(_0x2af315){try{jsonpatch[_0xea32('0x25')](_0x2af315,_0x2ba5bb,!![]);}catch(_0x1cca36){return BPromise[_0xea32('0x26')](_0x1cca36);}return _0x2af315[_0xea32('0x27')]();};}function saveUpdates(_0xcfc2c,_0x2fd430){return function(_0x433315){if(_0x433315){return _0x433315['update'](_0xcfc2c)[_0xea32('0x28')](function(_0x51f1f1){return _0x51f1f1;});}return null;};}function removeEntity(_0x4d9890,_0x49a2fa){return function(_0x3a08c7){if(_0x3a08c7){return _0x3a08c7['destroy']()[_0xea32('0x28')](function(){_0x4d9890[_0xea32('0x1c')](0xcc)[_0xea32('0x1d')]();});}};}function handleEntityNotFound(_0x388d39,_0x114bf1){return function(_0x348442){if(!_0x348442){_0x388d39[_0xea32('0x29')](0x194);}return _0x348442;};}function handleError(_0xdac2da,_0x44c0ab){_0x44c0ab=_0x44c0ab||0x1f4;return function(_0x51ad89){logger[_0xea32('0x2a')](_0x51ad89[_0xea32('0x2b')]);if(_0x51ad89[_0xea32('0x2c')]){delete _0x51ad89[_0xea32('0x2c')];}_0xdac2da[_0xea32('0x1c')](_0x44c0ab)['send'](_0x51ad89);};}exports['index']=function(_0x3e8cc8,_0x162df6){var _0x39fb12={},_0x235efe={},_0x1b4c58={'count':0x0,'rows':[]};var _0x41023d=_[_0xea32('0x2d')](db[_0xea32('0x2e')][_0xea32('0x2f')],function(_0x584e3e){return{'name':_0x584e3e[_0xea32('0x30')],'type':_0x584e3e[_0xea32('0x31')][_0xea32('0x32')]};});_0x235efe[_0xea32('0x33')]=_[_0xea32('0x2d')](_0x41023d,_0xea32('0x2c'));_0x235efe[_0xea32('0x34')]=_[_0xea32('0x35')](_0x3e8cc8['query']);_0x235efe['filters']=_[_0xea32('0x36')](_0x235efe[_0xea32('0x33')],_0x235efe['query']);_0x39fb12[_0xea32('0x37')]=_[_0xea32('0x36')](_0x235efe['model'],qs[_0xea32('0x38')](_0x3e8cc8[_0xea32('0x34')][_0xea32('0x38')]));_0x39fb12[_0xea32('0x37')]=_0x39fb12[_0xea32('0x37')]['length']?_0x39fb12['attributes']:_0x235efe[_0xea32('0x33')];if(!_0x3e8cc8[_0xea32('0x34')]['hasOwnProperty']('nolimit')){_0x39fb12['limit']=qs[_0xea32('0x21')](_0x3e8cc8['query']['limit']);_0x39fb12[_0xea32('0x1f')]=qs[_0xea32('0x1f')](_0x3e8cc8[_0xea32('0x34')][_0xea32('0x1f')]);}_0x39fb12[_0xea32('0x39')]=qs[_0xea32('0x3a')](_0x3e8cc8[_0xea32('0x34')][_0xea32('0x3a')]);_0x39fb12[_0xea32('0x3b')]=qs[_0xea32('0x3c')](_[_0xea32('0x3d')](_0x3e8cc8[_0xea32('0x34')],_0x235efe[_0xea32('0x3c')]),_0x41023d);if(_0x3e8cc8[_0xea32('0x34')]['filter']){_0x39fb12[_0xea32('0x3b')]=_['merge'](_0x39fb12[_0xea32('0x3b')],{'$or':_[_0xea32('0x2d')](_0x41023d,function(_0x20c096){if(_0x20c096[_0xea32('0x31')]!==_0xea32('0x3e')){var _0x18ac44={};_0x18ac44[_0x20c096[_0xea32('0x2c')]]={'$like':'%'+_0x3e8cc8[_0xea32('0x34')][_0xea32('0x3f')]+'%'};return _0x18ac44;}})});}_0x39fb12=_[_0xea32('0x40')]({},_0x39fb12,_0x3e8cc8[_0xea32('0x41')]);var _0x5f4409={'where':_0x39fb12[_0xea32('0x3b')]};return db[_0xea32('0x2e')][_0xea32('0x22')](_0x5f4409)[_0xea32('0x28')](function(_0x1cbf27){_0x1b4c58['count']=_0x1cbf27;if(_0x3e8cc8[_0xea32('0x34')][_0xea32('0x42')]){_0x39fb12['include']=[{'all':!![]}];}return db[_0xea32('0x2e')][_0xea32('0x43')](_0x39fb12);})[_0xea32('0x28')](function(_0x3c61eb){_0x1b4c58[_0xea32('0x44')]=_0x3c61eb;return _0x1b4c58;})[_0xea32('0x28')](respondWithFilteredResult(_0x162df6,_0x39fb12))[_0xea32('0x45')](handleError(_0x162df6,null));};exports[_0xea32('0x46')]=function(_0x5e792e,_0x3a82e6){var _0x4d5f35={'raw':![],'where':{'id':_0x5e792e[_0xea32('0x47')]['id']}},_0x2726bc={};_0x2726bc['model']=_[_0xea32('0x35')](db[_0xea32('0x2e')][_0xea32('0x2f')]);_0x2726bc[_0xea32('0x34')]=_['keys'](_0x5e792e['query']);_0x2726bc[_0xea32('0x3c')]=_[_0xea32('0x36')](_0x2726bc[_0xea32('0x33')],_0x2726bc[_0xea32('0x34')]);_0x4d5f35[_0xea32('0x37')]=_[_0xea32('0x36')](_0x2726bc[_0xea32('0x33')],qs[_0xea32('0x38')](_0x5e792e[_0xea32('0x34')]['fields']));_0x4d5f35[_0xea32('0x37')]=_0x4d5f35['attributes'][_0xea32('0x48')]?_0x4d5f35[_0xea32('0x37')]:_0x2726bc['model'];if(_0x5e792e['query'][_0xea32('0x42')]){_0x4d5f35[_0xea32('0x49')]=[{'all':!![]}];}_0x4d5f35=_[_0xea32('0x40')]({},_0x4d5f35,_0x5e792e[_0xea32('0x41')]);return db[_0xea32('0x2e')]['find'](_0x4d5f35)[_0xea32('0x28')](handleEntityNotFound(_0x3a82e6,null))[_0xea32('0x28')](respondWithResult(_0x3a82e6,null))[_0xea32('0x45')](handleError(_0x3a82e6,null));};exports[_0xea32('0x4a')]=function(_0x2c82fa,_0x334d84){return db[_0xea32('0x2e')][_0xea32('0x4a')](_0x2c82fa[_0xea32('0x4b')],{})[_0xea32('0x28')](respondWithResult(_0x334d84,0xc9))[_0xea32('0x45')](handleError(_0x334d84,null));};exports[_0xea32('0x4c')]=function(_0x4df22f,_0x3028d3){if(_0x4df22f[_0xea32('0x4b')]['id']){delete _0x4df22f[_0xea32('0x4b')]['id'];}return db['IntegrationReport'][_0xea32('0x4d')]({'where':{'id':_0x4df22f['params']['id']}})[_0xea32('0x28')](handleEntityNotFound(_0x3028d3,null))[_0xea32('0x28')](saveUpdates(_0x4df22f[_0xea32('0x4b')],null))[_0xea32('0x28')](respondWithResult(_0x3028d3,null))[_0xea32('0x45')](handleError(_0x3028d3,null));};exports[_0xea32('0x4e')]=function(_0x366268,_0x491ff0){return db['IntegrationReport'][_0xea32('0x4d')]({'where':{'id':_0x366268[_0xea32('0x47')]['id']}})[_0xea32('0x28')](handleEntityNotFound(_0x491ff0,null))[_0xea32('0x28')](removeEntity(_0x491ff0,null))[_0xea32('0x45')](handleError(_0x491ff0,null));};exports[_0xea32('0x4f')]=function(_0x52ae9a,_0x1ba86c){return db[_0xea32('0x2e')][_0xea32('0x4f')]()['then'](respondWithResult(_0x1ba86c,null))['catch'](handleError(_0x1ba86c,null));}; \ No newline at end of file +var _0x6df3=['undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','then','error','name','send','type','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','IntegrationReport','include','findAll','catch','params','rawAttributes','find','create','body','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','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','end','status','offset'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x6df3,0xbe));var _0x36df=function(_0x5c8f7c,_0x2c8676){_0x5c8f7c=_0x5c8f7c-0x0;var _0x5be745=_0x6df3[_0x5c8f7c];return _0x5be745;};'use strict';var emlformat=require(_0x36df('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x36df('0x1'));var rp=require(_0x36df('0x2'));var moment=require(_0x36df('0x3'));var BPromise=require(_0x36df('0x4'));var Mustache=require('mustache');var util=require(_0x36df('0x5'));var path=require(_0x36df('0x6'));var sox=require(_0x36df('0x7'));var csv=require(_0x36df('0x8'));var ejs=require(_0x36df('0x9'));var fs=require('fs');var fs_extra=require(_0x36df('0xa'));var _=require(_0x36df('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x36df('0xc'));var deskjs=require(_0x36df('0xd'));var toCsv=require('to-csv');var querystring=require(_0x36df('0xe'));var Papa=require('papaparse');var Redis=require(_0x36df('0xf'));var authService=require(_0x36df('0x10'));var qs=require(_0x36df('0x11'));var as=require(_0x36df('0x12'));var hardwareService=require(_0x36df('0x13'));var logger=require(_0x36df('0x14'))(_0x36df('0x15'));var utils=require(_0x36df('0x16'));var config=require(_0x36df('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x36df('0x18'))['db'];function respondWithStatusCode(_0x565c69,_0x5a1325){_0x5a1325=_0x5a1325||0xcc;return function(_0x14f1e0){if(_0x14f1e0){return _0x565c69[_0x36df('0x19')](_0x5a1325);}return _0x565c69['status'](_0x5a1325)[_0x36df('0x1a')]();};}function respondWithResult(_0x24504e,_0x542c58){_0x542c58=_0x542c58||0xc8;return function(_0x3ee445){if(_0x3ee445){return _0x24504e[_0x36df('0x1b')](_0x542c58)['json'](_0x3ee445);}};}function respondWithFilteredResult(_0x3620a8,_0x145794){return function(_0x56e9c7){if(_0x56e9c7){var _0xe4efd4=typeof _0x145794[_0x36df('0x1c')]===_0x36df('0x1d')&&typeof _0x145794[_0x36df('0x1e')]===_0x36df('0x1d');var _0x56e1b7=_0x56e9c7[_0x36df('0x1f')];var _0x2fa8a5=_0xe4efd4?0x0:_0x145794[_0x36df('0x1c')];var _0x3d7aa4=_0xe4efd4?_0x56e9c7[_0x36df('0x1f')]:_0x145794['offset']+_0x145794[_0x36df('0x1e')];var _0x4eda0f;if(_0x3d7aa4>=_0x56e1b7){_0x3d7aa4=_0x56e1b7;_0x4eda0f=0xc8;}else{_0x4eda0f=0xce;}_0x3620a8[_0x36df('0x1b')](_0x4eda0f);return _0x3620a8[_0x36df('0x20')](_0x36df('0x21'),_0x2fa8a5+'-'+_0x3d7aa4+'/'+_0x56e1b7)[_0x36df('0x22')](_0x56e9c7);}return null;};}function patchUpdates(_0x44905d){return function(_0x55d82d){try{jsonpatch[_0x36df('0x23')](_0x55d82d,_0x44905d,!![]);}catch(_0x5ed6b7){return BPromise[_0x36df('0x24')](_0x5ed6b7);}return _0x55d82d[_0x36df('0x25')]();};}function saveUpdates(_0x254289,_0x27d564){return function(_0x5a9a03){if(_0x5a9a03){return _0x5a9a03[_0x36df('0x26')](_0x254289)['then'](function(_0x8fff56){return _0x8fff56;});}return null;};}function removeEntity(_0x3b3650,_0x103404){return function(_0x1ff446){if(_0x1ff446){return _0x1ff446[_0x36df('0x27')]()[_0x36df('0x28')](function(){_0x3b3650[_0x36df('0x1b')](0xcc)[_0x36df('0x1a')]();});}};}function handleEntityNotFound(_0x4d997a,_0x48ab53){return function(_0x4e958c){if(!_0x4e958c){_0x4d997a['sendStatus'](0x194);}return _0x4e958c;};}function handleError(_0x33e20f,_0x3fb10b){_0x3fb10b=_0x3fb10b||0x1f4;return function(_0x5180a5){logger[_0x36df('0x29')](_0x5180a5['stack']);if(_0x5180a5[_0x36df('0x2a')]){delete _0x5180a5[_0x36df('0x2a')];}_0x33e20f[_0x36df('0x1b')](_0x3fb10b)[_0x36df('0x2b')](_0x5180a5);};}exports['index']=function(_0x21a93a,_0x4d3b57){var _0x3c641d={},_0x5c5c6e={},_0x21e6c2={'count':0x0,'rows':[]};var _0x25047b=_['map'](db['IntegrationReport']['rawAttributes'],function(_0x2a4e86){return{'name':_0x2a4e86['fieldName'],'type':_0x2a4e86[_0x36df('0x2c')]['key']};});_0x5c5c6e[_0x36df('0x2d')]=_[_0x36df('0x2e')](_0x25047b,'name');_0x5c5c6e[_0x36df('0x2f')]=_[_0x36df('0x30')](_0x21a93a[_0x36df('0x2f')]);_0x5c5c6e['filters']=_[_0x36df('0x31')](_0x5c5c6e[_0x36df('0x2d')],_0x5c5c6e[_0x36df('0x2f')]);_0x3c641d['attributes']=_[_0x36df('0x31')](_0x5c5c6e[_0x36df('0x2d')],qs[_0x36df('0x32')](_0x21a93a[_0x36df('0x2f')][_0x36df('0x32')]));_0x3c641d['attributes']=_0x3c641d[_0x36df('0x33')][_0x36df('0x34')]?_0x3c641d[_0x36df('0x33')]:_0x5c5c6e[_0x36df('0x2d')];if(!_0x21a93a['query'][_0x36df('0x35')](_0x36df('0x36'))){_0x3c641d[_0x36df('0x1e')]=qs[_0x36df('0x1e')](_0x21a93a['query']['limit']);_0x3c641d[_0x36df('0x1c')]=qs[_0x36df('0x1c')](_0x21a93a[_0x36df('0x2f')][_0x36df('0x1c')]);}_0x3c641d[_0x36df('0x37')]=qs[_0x36df('0x38')](_0x21a93a[_0x36df('0x2f')][_0x36df('0x38')]);_0x3c641d[_0x36df('0x39')]=qs[_0x36df('0x3a')](_[_0x36df('0x3b')](_0x21a93a['query'],_0x5c5c6e[_0x36df('0x3a')]),_0x25047b);if(_0x21a93a[_0x36df('0x2f')][_0x36df('0x3c')]){_0x3c641d[_0x36df('0x39')]=_[_0x36df('0x3d')](_0x3c641d[_0x36df('0x39')],{'$or':_[_0x36df('0x2e')](_0x25047b,function(_0x29e19b){if(_0x29e19b['type']!=='VIRTUAL'){var _0x51baa5={};_0x51baa5[_0x29e19b['name']]={'$like':'%'+_0x21a93a[_0x36df('0x2f')][_0x36df('0x3c')]+'%'};return _0x51baa5;}})});}_0x3c641d=_['merge']({},_0x3c641d,_0x21a93a[_0x36df('0x3e')]);var _0x3a4ea1={'where':_0x3c641d[_0x36df('0x39')]};return db[_0x36df('0x3f')][_0x36df('0x1f')](_0x3a4ea1)[_0x36df('0x28')](function(_0xd7f7ef){_0x21e6c2[_0x36df('0x1f')]=_0xd7f7ef;if(_0x21a93a[_0x36df('0x2f')]['includeAll']){_0x3c641d[_0x36df('0x40')]=[{'all':!![]}];}return db['IntegrationReport'][_0x36df('0x41')](_0x3c641d);})[_0x36df('0x28')](function(_0x4af6a5){_0x21e6c2['rows']=_0x4af6a5;return _0x21e6c2;})[_0x36df('0x28')](respondWithFilteredResult(_0x4d3b57,_0x3c641d))[_0x36df('0x42')](handleError(_0x4d3b57,null));};exports['show']=function(_0x1447e5,_0x3055da){var _0x224a12={'raw':![],'where':{'id':_0x1447e5[_0x36df('0x43')]['id']}},_0x4295f9={};_0x4295f9[_0x36df('0x2d')]=_[_0x36df('0x30')](db[_0x36df('0x3f')][_0x36df('0x44')]);_0x4295f9[_0x36df('0x2f')]=_[_0x36df('0x30')](_0x1447e5[_0x36df('0x2f')]);_0x4295f9[_0x36df('0x3a')]=_[_0x36df('0x31')](_0x4295f9[_0x36df('0x2d')],_0x4295f9[_0x36df('0x2f')]);_0x224a12[_0x36df('0x33')]=_[_0x36df('0x31')](_0x4295f9[_0x36df('0x2d')],qs[_0x36df('0x32')](_0x1447e5[_0x36df('0x2f')][_0x36df('0x32')]));_0x224a12[_0x36df('0x33')]=_0x224a12[_0x36df('0x33')][_0x36df('0x34')]?_0x224a12['attributes']:_0x4295f9[_0x36df('0x2d')];if(_0x1447e5[_0x36df('0x2f')]['includeAll']){_0x224a12['include']=[{'all':!![]}];}_0x224a12=_['merge']({},_0x224a12,_0x1447e5[_0x36df('0x3e')]);return db[_0x36df('0x3f')][_0x36df('0x45')](_0x224a12)[_0x36df('0x28')](handleEntityNotFound(_0x3055da,null))[_0x36df('0x28')](respondWithResult(_0x3055da,null))[_0x36df('0x42')](handleError(_0x3055da,null));};exports[_0x36df('0x46')]=function(_0x18d00a,_0x25eb46){return db['IntegrationReport'][_0x36df('0x46')](_0x18d00a[_0x36df('0x47')],{})[_0x36df('0x28')](respondWithResult(_0x25eb46,0xc9))['catch'](handleError(_0x25eb46,null));};exports[_0x36df('0x26')]=function(_0x355a0c,_0x40a3f6){if(_0x355a0c[_0x36df('0x47')]['id']){delete _0x355a0c[_0x36df('0x47')]['id'];}return db[_0x36df('0x3f')][_0x36df('0x45')]({'where':{'id':_0x355a0c[_0x36df('0x43')]['id']}})[_0x36df('0x28')](handleEntityNotFound(_0x40a3f6,null))['then'](saveUpdates(_0x355a0c[_0x36df('0x47')],null))['then'](respondWithResult(_0x40a3f6,null))['catch'](handleError(_0x40a3f6,null));};exports[_0x36df('0x27')]=function(_0x42cf49,_0x49a17b){return db['IntegrationReport'][_0x36df('0x45')]({'where':{'id':_0x42cf49['params']['id']}})['then'](handleEntityNotFound(_0x49a17b,null))[_0x36df('0x28')](removeEntity(_0x49a17b,null))['catch'](handleError(_0x49a17b,null));};exports['describe']=function(_0x31fba0,_0xa5679b){return db[_0x36df('0x3f')][_0x36df('0x48')]()[_0x36df('0x28')](respondWithResult(_0xa5679b,null))[_0x36df('0x42')](handleError(_0xa5679b,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 7c44d9c..9b58c4b 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 _0x568f=['report_integration','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./integrationReport.attributes','exports','define','IntegrationReport'];(function(_0x3db82,_0xc56e5b){var _0x1e21cf=function(_0x16202c){while(--_0x16202c){_0x3db82['push'](_0x3db82['shift']());}};_0x1e21cf(++_0xc56e5b);}(_0x568f,0x187));var _0xf568=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x568f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xf568('0x0'));var logger=require(_0xf568('0x1'))(_0xf568('0x2'));var moment=require('moment');var BPromise=require(_0xf568('0x3'));var rp=require(_0xf568('0x4'));var fs=require('fs');var path=require(_0xf568('0x5'));var rimraf=require(_0xf568('0x6'));var config=require(_0xf568('0x7'));var attributes=require(_0xf568('0x8'));module[_0xf568('0x9')]=function(_0x2ed43f,_0x54ef7d){return _0x2ed43f[_0xf568('0xa')](_0xf568('0xb'),attributes,{'tableName':_0xf568('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6e9f=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./integrationReport.attributes','exports','define','IntegrationReport','report_integration','lodash','util','../../config/logger'];(function(_0x369f62,_0x17a354){var _0x323a6d=function(_0x4fc5cf){while(--_0x4fc5cf){_0x369f62['push'](_0x369f62['shift']());}};_0x323a6d(++_0x17a354);}(_0x6e9f,0xa5));var _0xf6e9=function(_0x3e8b83,_0x5a3809){_0x3e8b83=_0x3e8b83-0x0;var _0x4ae7d7=_0x6e9f[_0x3e8b83];return _0x4ae7d7;};'use strict';var _=require(_0xf6e9('0x0'));var util=require(_0xf6e9('0x1'));var logger=require(_0xf6e9('0x2'))(_0xf6e9('0x3'));var moment=require(_0xf6e9('0x4'));var BPromise=require(_0xf6e9('0x5'));var rp=require(_0xf6e9('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf6e9('0x7'));var config=require(_0xf6e9('0x8'));var attributes=require(_0xf6e9('0x9'));module[_0xf6e9('0xa')]=function(_0xe200cc,_0x6b248f){return _0xe200cc[_0xf6e9('0xb')](_0xf6e9('0xc'),attributes,{'tableName':_0xf6e9('0xd'),'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 66c7ab9..0b19bcc 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 _0xf494=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','IntegrationReport,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x5c9307,_0x5b97e4){var _0x373e29=function(_0xefebbd){while(--_0xefebbd){_0x5c9307['push'](_0x5c9307['shift']());}};_0x373e29(++_0x5b97e4);}(_0xf494,0x1c6));var _0x4f49=function(_0x2c8823,_0xf4e892){_0x2c8823=_0x2c8823-0x0;var _0x2ea1a4=_0xf494[_0x2c8823];return _0x2ea1a4;};'use strict';var _=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var moment=require(_0x4f49('0x2'));var BPromise=require('bluebird');var rs=require(_0x4f49('0x3'));var fs=require('fs');var Redis=require(_0x4f49('0x4'));var db=require(_0x4f49('0x5'))['db'];var utils=require(_0x4f49('0x6'));var logger=require(_0x4f49('0x7'))(_0x4f49('0x8'));var config=require(_0x4f49('0x9'));var jayson=require(_0x4f49('0xa'));var client=jayson[_0x4f49('0xb')][_0x4f49('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x42b0e8,_0x5eb186,_0x58e9a0){return new BPromise(function(_0x169c95,_0x327bd5){return client[_0x4f49('0xd')](_0x42b0e8,_0x58e9a0)[_0x4f49('0xe')](function(_0x185174){logger[_0x4f49('0xf')](_0x4f49('0x10'),_0x5eb186,_0x4f49('0x11'));logger['debug'](_0x4f49('0x12'),_0x5eb186,_0x4f49('0x11'),JSON['stringify'](_0x185174));if(_0x185174[_0x4f49('0x13')]){if(_0x185174['error']['code']===0x1f4){logger[_0x4f49('0x13')](_0x4f49('0x10'),_0x5eb186,_0x185174['error'][_0x4f49('0x14')]);return _0x327bd5(_0x185174[_0x4f49('0x13')][_0x4f49('0x14')]);}logger[_0x4f49('0x13')](_0x4f49('0x10'),_0x5eb186,_0x185174[_0x4f49('0x13')][_0x4f49('0x14')]);return _0x169c95(_0x185174['error'][_0x4f49('0x14')]);}else{logger[_0x4f49('0xf')](_0x4f49('0x10'),_0x5eb186,'request\x20sent');_0x169c95(_0x185174['result'][_0x4f49('0x14')]);}})[_0x4f49('0x15')](function(_0x74886e){logger['error'](_0x4f49('0x10'),_0x5eb186,_0x74886e);_0x327bd5(_0x74886e);});});} \ No newline at end of file +var _0x3f8a=['catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x2bfa86,_0x34bb3c){_0x2bfa86=_0x2bfa86-0x0;var _0xf15627=_0x3f8a[_0x2bfa86];return _0xf15627;};'use strict';var _=require(_0xa3f8('0x0'));var util=require(_0xa3f8('0x1'));var moment=require(_0xa3f8('0x2'));var BPromise=require(_0xa3f8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa3f8('0x4'));var db=require(_0xa3f8('0x5'))['db'];var utils=require(_0xa3f8('0x6'));var logger=require(_0xa3f8('0x7'))(_0xa3f8('0x8'));var config=require(_0xa3f8('0x9'));var jayson=require(_0xa3f8('0xa'));var client=jayson[_0xa3f8('0xb')][_0xa3f8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xf895d9,_0xcfea5,_0x268332){return new BPromise(function(_0x2faf2e,_0x2448de){return client[_0xa3f8('0xd')](_0xf895d9,_0x268332)[_0xa3f8('0xe')](function(_0xcdb0d4){logger['info'](_0xa3f8('0xf'),_0xcfea5,_0xa3f8('0x10'));logger[_0xa3f8('0x11')](_0xa3f8('0x12'),_0xcfea5,'request\x20sent',JSON[_0xa3f8('0x13')](_0xcdb0d4));if(_0xcdb0d4[_0xa3f8('0x14')]){if(_0xcdb0d4[_0xa3f8('0x14')][_0xa3f8('0x15')]===0x1f4){logger[_0xa3f8('0x14')](_0xa3f8('0xf'),_0xcfea5,_0xcdb0d4[_0xa3f8('0x14')][_0xa3f8('0x16')]);return _0x2448de(_0xcdb0d4[_0xa3f8('0x14')][_0xa3f8('0x16')]);}logger[_0xa3f8('0x14')](_0xa3f8('0xf'),_0xcfea5,_0xcdb0d4['error'][_0xa3f8('0x16')]);return _0x2faf2e(_0xcdb0d4[_0xa3f8('0x14')][_0xa3f8('0x16')]);}else{logger[_0xa3f8('0x17')]('IntegrationReport,\x20%s,\x20%s',_0xcfea5,_0xa3f8('0x10'));_0x2faf2e(_0xcdb0d4[_0xa3f8('0x18')][_0xa3f8('0x16')]);}})[_0xa3f8('0x19')](function(_0x45ef64){logger[_0xa3f8('0x14')](_0xa3f8('0xf'),_0xcfea5,_0x45ef64);_0x2448de(_0x45ef64);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 1365fa4..a23dbb9 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 _0x7e4b=['/:id/sub_intervals','getIntervals','post','create','addInterval','/:id/sub_intervals/create_many','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','get','isAuthenticated','index'];(function(_0x4d0f1c,_0x314943){var _0x33a5ec=function(_0x5bed1b){while(--_0x5bed1b){_0x4d0f1c['push'](_0x4d0f1c['shift']());}};_0x33a5ec(++_0x314943);}(_0x7e4b,0x84));var _0xb7e4=function(_0x2ea378,_0x44d2f1){_0x2ea378=_0x2ea378-0x0;var _0x490513=_0x7e4b[_0x2ea378];return _0x490513;};'use strict';var multer=require(_0xb7e4('0x0'));var util=require(_0xb7e4('0x1'));var path=require('path');var timeout=require(_0xb7e4('0x2'));var express=require(_0xb7e4('0x3'));var router=express['Router']();var fs_extra=require(_0xb7e4('0x4'));var auth=require(_0xb7e4('0x5'));var interaction=require(_0xb7e4('0x6'));var config=require(_0xb7e4('0x7'));var controller=require(_0xb7e4('0x8'));router[_0xb7e4('0x9')]('/',auth[_0xb7e4('0xa')](),controller[_0xb7e4('0xb')]);router[_0xb7e4('0x9')]('/:id',auth[_0xb7e4('0xa')](),controller['show']);router[_0xb7e4('0x9')](_0xb7e4('0xc'),auth[_0xb7e4('0xa')](),controller[_0xb7e4('0xd')]);router[_0xb7e4('0xe')]('/',auth[_0xb7e4('0xa')](),controller[_0xb7e4('0xf')]);router[_0xb7e4('0xe')](_0xb7e4('0xc'),auth[_0xb7e4('0xa')](),controller[_0xb7e4('0x10')]);router[_0xb7e4('0xe')](_0xb7e4('0x11'),auth['isAuthenticated'](),controller['addIntervals']);router[_0xb7e4('0x12')](_0xb7e4('0x13'),auth['isAuthenticated'](),controller[_0xb7e4('0x14')]);router[_0xb7e4('0x15')](_0xb7e4('0x13'),auth[_0xb7e4('0xa')](),controller[_0xb7e4('0x16')]);module[_0xb7e4('0x17')]=router; \ No newline at end of file +var _0x1883=['put','update','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','get','isAuthenticated','index','/:id','/:id/sub_intervals','getIntervals','create','post','addInterval','addIntervals'];(function(_0x1bb992,_0x2e645e){var _0x2f7a0b=function(_0x1e491){while(--_0x1e491){_0x1bb992['push'](_0x1bb992['shift']());}};_0x2f7a0b(++_0x2e645e);}(_0x1883,0xab));var _0x3188=function(_0x412d2e,_0x5db21f){_0x412d2e=_0x412d2e-0x0;var _0x33321e=_0x1883[_0x412d2e];return _0x33321e;};'use strict';var multer=require(_0x3188('0x0'));var util=require(_0x3188('0x1'));var path=require(_0x3188('0x2'));var timeout=require(_0x3188('0x3'));var express=require(_0x3188('0x4'));var router=express[_0x3188('0x5')]();var fs_extra=require(_0x3188('0x6'));var auth=require(_0x3188('0x7'));var interaction=require(_0x3188('0x8'));var config=require(_0x3188('0x9'));var controller=require(_0x3188('0xa'));router[_0x3188('0xb')]('/',auth[_0x3188('0xc')](),controller[_0x3188('0xd')]);router[_0x3188('0xb')](_0x3188('0xe'),auth[_0x3188('0xc')](),controller['show']);router[_0x3188('0xb')](_0x3188('0xf'),auth['isAuthenticated'](),controller[_0x3188('0x10')]);router['post']('/',auth[_0x3188('0xc')](),controller[_0x3188('0x11')]);router[_0x3188('0x12')](_0x3188('0xf'),auth['isAuthenticated'](),controller[_0x3188('0x13')]);router[_0x3188('0x12')]('/:id/sub_intervals/create_many',auth['isAuthenticated'](),controller[_0x3188('0x14')]);router[_0x3188('0x15')](_0x3188('0xe'),auth[_0x3188('0xc')](),controller[_0x3188('0x16')]);router[_0x3188('0x17')]('/:id',auth[_0x3188('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 55b8712..7b79a9b 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 _0x7af1=['sequelize','exports','STRING'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7af1,0x9f));var _0x17af=function(_0xa14730,_0x33609a){_0xa14730=_0xa14730-0x0;var _0x182727=_0x7af1[_0xa14730];return _0x182727;};'use strict';var Sequelize=require(_0x17af('0x0'));module[_0x17af('0x1')]={'name':{'type':Sequelize[_0x17af('0x2')]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0x054e=['sequelize','exports','STRING'];(function(_0x31f7c5,_0x3bf428){var _0x19fabc=function(_0x268080){while(--_0x268080){_0x31f7c5['push'](_0x31f7c5['shift']());}};_0x19fabc(++_0x3bf428);}(_0x054e,0x135));var _0xe054=function(_0x4ec7f2,_0x3d92d2){_0x4ec7f2=_0x4ec7f2-0x0;var _0x118004=_0x054e[_0x4ec7f2];return _0x118004;};'use strict';var Sequelize=require(_0xe054('0x0'));module[_0xe054('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xe054('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index 713cd65..7f130a6 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 _0x4716=['index','Interval','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','length','create','body','user','get','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','getIntervals','findOne','addIntervals','sequelize','transaction','IntervalId','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','then','Intervals','UserProfileResource','error','stack','name','send'];(function(_0x3edc9f,_0x52d3eb){var _0x42d5dc=function(_0x267012){while(--_0x267012){_0x3edc9f['push'](_0x3edc9f['shift']());}};_0x42d5dc(++_0x52d3eb);}(_0x4716,0x8c));var _0x6471=function(_0x23bfbb,_0x3b0fa2){_0x23bfbb=_0x23bfbb-0x0;var _0x383576=_0x4716[_0x23bfbb];return _0x383576;};'use strict';var emlformat=require(_0x6471('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6471('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6471('0x2'));var moment=require(_0x6471('0x3'));var BPromise=require(_0x6471('0x4'));var Mustache=require(_0x6471('0x5'));var util=require(_0x6471('0x6'));var path=require(_0x6471('0x7'));var sox=require('sox');var csv=require(_0x6471('0x8'));var ejs=require(_0x6471('0x9'));var fs=require('fs');var fs_extra=require(_0x6471('0xa'));var _=require(_0x6471('0xb'));var squel=require(_0x6471('0xc'));var crypto=require(_0x6471('0xd'));var jsforce=require(_0x6471('0xe'));var deskjs=require(_0x6471('0xf'));var toCsv=require('to-csv');var querystring=require(_0x6471('0x10'));var Papa=require('papaparse');var Redis=require(_0x6471('0x11'));var authService=require(_0x6471('0x12'));var qs=require(_0x6471('0x13'));var as=require(_0x6471('0x14'));var hardwareService=require(_0x6471('0x15'));var logger=require(_0x6471('0x16'))(_0x6471('0x17'));var utils=require(_0x6471('0x18'));var config=require(_0x6471('0x19'));var licenseUtil=require(_0x6471('0x1a'));var db=require(_0x6471('0x1b'))['db'];var extensions=require('../../components/extensions/rewrite');function respondWithStatusCode(_0x65f76a,_0x41d83b){_0x41d83b=_0x41d83b||0xcc;return function(_0x3de97b){if(_0x3de97b){return _0x65f76a[_0x6471('0x1c')](_0x41d83b);}return _0x65f76a[_0x6471('0x1d')](_0x41d83b)[_0x6471('0x1e')]();};}function respondWithResult(_0x1987c1,_0x1103ec){_0x1103ec=_0x1103ec||0xc8;return function(_0x513354){if(_0x513354){return _0x1987c1['status'](_0x1103ec)['json'](_0x513354);}};}function respondWithFilteredResult(_0x360eea,_0x150cff){return function(_0x189876){if(_0x189876){var _0x3a8b68=typeof _0x150cff[_0x6471('0x1f')]===_0x6471('0x20')&&typeof _0x150cff[_0x6471('0x21')]==='undefined';var _0xe66a09=_0x189876['count'];var _0x3bf38b=_0x3a8b68?0x0:_0x150cff[_0x6471('0x1f')];var _0x466956=_0x3a8b68?_0x189876[_0x6471('0x22')]:_0x150cff[_0x6471('0x1f')]+_0x150cff[_0x6471('0x21')];var _0x3513bc;if(_0x466956>=_0xe66a09){_0x466956=_0xe66a09;_0x3513bc=0xc8;}else{_0x3513bc=0xce;}_0x360eea[_0x6471('0x1d')](_0x3513bc);return _0x360eea[_0x6471('0x23')](_0x6471('0x24'),_0x3bf38b+'-'+_0x466956+'/'+_0xe66a09)[_0x6471('0x25')](_0x189876);}return null;};}function patchUpdates(_0x431986){return function(_0x2041c3){try{jsonpatch[_0x6471('0x26')](_0x2041c3,_0x431986,!![]);}catch(_0x55eb44){return BPromise[_0x6471('0x27')](_0x55eb44);}return _0x2041c3[_0x6471('0x28')]();};}function saveUpdates(_0x2442ad,_0x4b61ba){return function(_0x4a1ae7){if(_0x4a1ae7){return _0x4a1ae7[_0x6471('0x29')](_0x2442ad)['then'](function(_0x18f9ec){return _0x18f9ec;});}return null;};}function removeEntity(_0x2bae17,_0x3aef5d){return function(_0x112034){if(_0x112034){return _0x112034[_0x6471('0x2a')]()[_0x6471('0x2b')](function(){var _0x4b5129=_0x112034['get']({'plain':!![]});var _0x38edd1=_0x6471('0x2c');return db[_0x6471('0x2d')][_0x6471('0x2a')]({'where':{'type':_0x38edd1,'resourceId':_0x4b5129['id']}})['then'](function(){return _0x112034;});})[_0x6471('0x2b')](function(){_0x2bae17[_0x6471('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d0b65,_0x58f4a8){return function(_0x3a9ca7){if(!_0x3a9ca7){_0x4d0b65[_0x6471('0x1c')](0x194);}return _0x3a9ca7;};}function handleError(_0x5a5f2a,_0x774510){_0x774510=_0x774510||0x1f4;return function(_0x34009d){logger[_0x6471('0x2e')](_0x34009d[_0x6471('0x2f')]);if(_0x34009d['name']){delete _0x34009d[_0x6471('0x30')];}_0x5a5f2a[_0x6471('0x1d')](_0x774510)[_0x6471('0x31')](_0x34009d);};}exports[_0x6471('0x32')]=function(_0x541da8,_0x2d7505){var _0x235240={},_0x26810d={},_0x313b4d={'count':0x0,'rows':[]};var _0x1eb375=_['map'](db[_0x6471('0x33')][_0x6471('0x34')],function(_0x4c7e3f){return{'name':_0x4c7e3f['fieldName'],'type':_0x4c7e3f[_0x6471('0x35')][_0x6471('0x36')]};});_0x26810d[_0x6471('0x37')]=_[_0x6471('0x38')](_0x1eb375,'name');_0x26810d[_0x6471('0x39')]=_[_0x6471('0x3a')](_0x541da8[_0x6471('0x39')]);_0x26810d[_0x6471('0x3b')]=_[_0x6471('0x3c')](_0x26810d['model'],_0x26810d[_0x6471('0x39')]);_0x235240[_0x6471('0x3d')]=_['intersection'](_0x26810d[_0x6471('0x37')],qs[_0x6471('0x3e')](_0x541da8[_0x6471('0x39')][_0x6471('0x3e')]));_0x235240[_0x6471('0x3d')]=_0x235240[_0x6471('0x3d')]['length']?_0x235240[_0x6471('0x3d')]:_0x26810d[_0x6471('0x37')];if(!_0x541da8['query'][_0x6471('0x3f')](_0x6471('0x40'))){_0x235240[_0x6471('0x21')]=qs[_0x6471('0x21')](_0x541da8['query']['limit']);_0x235240[_0x6471('0x1f')]=qs[_0x6471('0x1f')](_0x541da8['query'][_0x6471('0x1f')]);}_0x235240['order']=qs[_0x6471('0x41')](_0x541da8[_0x6471('0x39')]['sort']);_0x235240[_0x6471('0x42')]=qs[_0x6471('0x3b')](_[_0x6471('0x43')](_0x541da8[_0x6471('0x39')],_0x26810d[_0x6471('0x3b')]),_0x1eb375);if(_0x541da8['query'][_0x6471('0x44')]){_0x235240[_0x6471('0x42')]=_[_0x6471('0x45')](_0x235240[_0x6471('0x42')],{'$or':_[_0x6471('0x38')](_0x1eb375,function(_0x1f7afc){if(_0x1f7afc[_0x6471('0x35')]!==_0x6471('0x46')){var _0x31b69c={};_0x31b69c[_0x1f7afc['name']]={'$like':'%'+_0x541da8['query']['filter']+'%'};return _0x31b69c;}})});}_0x235240=_[_0x6471('0x45')]({},_0x235240,_0x541da8[_0x6471('0x47')]);var _0x219422={'where':_0x235240[_0x6471('0x42')]};return db[_0x6471('0x33')][_0x6471('0x22')](_0x219422)['then'](function(_0x47f81c){_0x313b4d['count']=_0x47f81c;if(_0x541da8['query'][_0x6471('0x48')]){_0x235240[_0x6471('0x49')]=[{'all':!![]}];}return db[_0x6471('0x33')][_0x6471('0x4a')](_0x235240);})[_0x6471('0x2b')](function(_0xdc4e9b){_0x313b4d['rows']=_0xdc4e9b;return _0x313b4d;})[_0x6471('0x2b')](respondWithFilteredResult(_0x2d7505,_0x235240))[_0x6471('0x4b')](handleError(_0x2d7505,null));};exports[_0x6471('0x4c')]=function(_0x114fa7,_0x4aa12c){var _0x27fcbc={'raw':!![],'where':{'id':_0x114fa7[_0x6471('0x4d')]['id']}},_0x44402b={};_0x44402b[_0x6471('0x37')]=_[_0x6471('0x3a')](db[_0x6471('0x33')][_0x6471('0x34')]);_0x44402b[_0x6471('0x39')]=_[_0x6471('0x3a')](_0x114fa7[_0x6471('0x39')]);_0x44402b[_0x6471('0x3b')]=_[_0x6471('0x3c')](_0x44402b[_0x6471('0x37')],_0x44402b['query']);_0x27fcbc[_0x6471('0x3d')]=_[_0x6471('0x3c')](_0x44402b[_0x6471('0x37')],qs[_0x6471('0x3e')](_0x114fa7[_0x6471('0x39')]['fields']));_0x27fcbc[_0x6471('0x3d')]=_0x27fcbc[_0x6471('0x3d')][_0x6471('0x4e')]?_0x27fcbc[_0x6471('0x3d')]:_0x44402b[_0x6471('0x37')];if(_0x114fa7[_0x6471('0x39')][_0x6471('0x48')]){_0x27fcbc[_0x6471('0x49')]=[{'all':!![]}];}_0x27fcbc=_[_0x6471('0x45')]({},_0x27fcbc,_0x114fa7[_0x6471('0x47')]);return db[_0x6471('0x33')]['find'](_0x27fcbc)['then'](handleEntityNotFound(_0x4aa12c,null))['then'](respondWithResult(_0x4aa12c,null))[_0x6471('0x4b')](handleError(_0x4aa12c,null));};exports[_0x6471('0x4f')]=function(_0x16b8a0,_0x263ad2){return db[_0x6471('0x33')]['create'](_0x16b8a0[_0x6471('0x50')],{})['then'](function(_0x1254e2){var _0x4c02da=_0x16b8a0['user']['get']({'plain':!![]});if(!_0x4c02da)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4c02da['role']===_0x6471('0x51')){var _0x9a2b84=_0x1254e2[_0x6471('0x52')]({'plain':!![]});var _0x272ee9=_0x6471('0x2c');return db[_0x6471('0x53')][_0x6471('0x54')]({'where':{'name':_0x272ee9,'userProfileId':_0x4c02da[_0x6471('0x55')]},'raw':!![]})[_0x6471('0x2b')](function(_0x2d9f8c){if(_0x2d9f8c&&_0x2d9f8c[_0x6471('0x56')]===0x0){return db[_0x6471('0x2d')][_0x6471('0x4f')]({'name':_0x9a2b84[_0x6471('0x30')],'resourceId':_0x9a2b84['id'],'type':_0x2d9f8c[_0x6471('0x30')],'sectionId':_0x2d9f8c['id']},{})[_0x6471('0x2b')](function(){return _0x1254e2;});}else{return _0x1254e2;}})[_0x6471('0x4b')](function(_0x10f733){logger['error'](_0x6471('0x57'),_0x10f733);throw _0x10f733;});}return _0x1254e2;})[_0x6471('0x2b')](respondWithResult(_0x263ad2,0xc9))['catch'](handleError(_0x263ad2,null));};exports[_0x6471('0x29')]=function(_0x44856c,_0x50b754){if(_0x44856c[_0x6471('0x50')]['id']){delete _0x44856c[_0x6471('0x50')]['id'];}return db[_0x6471('0x33')][_0x6471('0x54')]({'where':{'id':_0x44856c['params']['id']}})[_0x6471('0x2b')](handleEntityNotFound(_0x50b754,null))[_0x6471('0x2b')](saveUpdates(_0x44856c['body'],null))[_0x6471('0x2b')](respondWithResult(_0x50b754,null))[_0x6471('0x4b')](handleError(_0x50b754,null));};exports[_0x6471('0x2a')]=function(_0x49ff06,_0x31ec9b){return db[_0x6471('0x33')][_0x6471('0x54')]({'where':{'id':_0x49ff06['params']['id']}})[_0x6471('0x2b')](handleEntityNotFound(_0x31ec9b,null))[_0x6471('0x2b')](removeEntity(_0x31ec9b,null))['catch'](handleError(_0x31ec9b,null));};exports[_0x6471('0x58')]=function(_0x5cf6f5,_0x35a515,_0xf92ef){if(_0x5cf6f5['body']['id']){delete _0x5cf6f5[_0x6471('0x50')]['id'];}return db[_0x6471('0x33')][_0x6471('0x54')]({'where':{'id':_0x5cf6f5[_0x6471('0x4d')]['id']}})[_0x6471('0x2b')](handleEntityNotFound(_0x35a515,null))[_0x6471('0x2b')](function(_0x304c45){if(_0x304c45){_0x5cf6f5[_0x6471('0x50')]['IntervalId']=_0x304c45['id'];return db[_0x6471('0x33')]['create'](_0x5cf6f5['body']);}})[_0x6471('0x2b')](respondWithResult(_0x35a515,null))[_0x6471('0x4b')](handleError(_0x35a515,null));};exports[_0x6471('0x59')]=function(_0x443895,_0x44f96b,_0x5d8a17){var _0x3ee88c={};var _0x52a94e={};var _0x42dace;var _0x7fddb9;return db[_0x6471('0x33')][_0x6471('0x5a')]({'where':{'id':_0x443895[_0x6471('0x4d')]['id']}})[_0x6471('0x2b')](handleEntityNotFound(_0x44f96b,null))[_0x6471('0x2b')](function(_0x1ac8b0){if(_0x1ac8b0){_0x42dace=_0x1ac8b0;_0x52a94e[_0x6471('0x37')]=_[_0x6471('0x3a')](db[_0x6471('0x33')][_0x6471('0x34')]);_0x52a94e[_0x6471('0x39')]=_[_0x6471('0x3a')](_0x443895[_0x6471('0x39')]);_0x52a94e['filters']=_['intersection'](_0x52a94e[_0x6471('0x37')],_0x52a94e[_0x6471('0x39')]);_0x3ee88c[_0x6471('0x3d')]=_[_0x6471('0x3c')](_0x52a94e['model'],qs[_0x6471('0x3e')](_0x443895[_0x6471('0x39')][_0x6471('0x3e')]));_0x3ee88c[_0x6471('0x3d')]=_0x3ee88c[_0x6471('0x3d')][_0x6471('0x4e')]?_0x3ee88c[_0x6471('0x3d')]:_0x52a94e[_0x6471('0x37')];_0x3ee88c['order']=qs[_0x6471('0x41')](_0x443895[_0x6471('0x39')]['sort']);_0x3ee88c['where']=qs[_0x6471('0x3b')](_['pick'](_0x443895[_0x6471('0x39')],_0x52a94e['filters']));if(_0x443895['query'][_0x6471('0x44')]){_0x3ee88c['where']=_[_0x6471('0x45')](_0x3ee88c[_0x6471('0x42')],{'$or':_[_0x6471('0x38')](_0x3ee88c[_0x6471('0x3d')],function(_0x3835e6){var _0x456cbb={};_0x456cbb[_0x3835e6]={'$like':'%'+_0x443895[_0x6471('0x39')][_0x6471('0x44')]+'%'};return _0x456cbb;})});}_0x3ee88c=_['merge']({},_0x3ee88c,_0x443895[_0x6471('0x47')]);return _0x42dace[_0x6471('0x59')](_0x3ee88c);}})['then'](function(_0x267ca1){if(_0x267ca1){_0x7fddb9=_0x267ca1['length'];if(!_0x443895[_0x6471('0x39')][_0x6471('0x3f')](_0x6471('0x40'))){_0x3ee88c['limit']=qs[_0x6471('0x21')](_0x443895[_0x6471('0x39')]['limit']);_0x3ee88c[_0x6471('0x1f')]=qs[_0x6471('0x1f')](_0x443895[_0x6471('0x39')][_0x6471('0x1f')]);}return _0x42dace[_0x6471('0x59')](_0x3ee88c);}})[_0x6471('0x2b')](function(_0x467a5e){if(_0x467a5e){return _0x467a5e?{'count':_0x7fddb9,'rows':_0x467a5e}:null;}})[_0x6471('0x2b')](respondWithResult(_0x44f96b,null))[_0x6471('0x4b')](handleError(_0x44f96b,null));};exports[_0x6471('0x5b')]=function(_0x3ff426,_0x37d039,_0x5aacc5){return db[_0x6471('0x33')]['findOne']({'where':{'id':_0x3ff426[_0x6471('0x4d')]['id']}})[_0x6471('0x2b')](handleEntityNotFound(_0x37d039,null))[_0x6471('0x2b')](function(_0x2f74d0){if(_0x2f74d0){return db[_0x6471('0x5c')][_0x6471('0x5d')](function(_0x4a38ce){return db['Interval'][_0x6471('0x2a')]({'where':{'IntervalId':_0x3ff426[_0x6471('0x4d')]['id']},'transaction':_0x4a38ce})['then'](function(_0x197bcc){var _0x447aec=_['map'](_0x3ff426['body'],function(_0x76f099){delete _0x76f099['id'];_0x76f099[_0x6471('0x5e')]=_0x3ff426['params']['id'];return _0x76f099;});return db[_0x6471('0x33')]['bulkCreate'](_0x447aec,{'transaction':_0x4a38ce});});})[_0x6471('0x2b')](function(){return db[_0x6471('0x33')]['findAll']({'where':{'IntervalId':_0x3ff426[_0x6471('0x4d')]['id']}});});}})[_0x6471('0x2b')](respondWithResult(_0x37d039,null))[_0x6471('0x4b')](handleError(_0x37d039,null));}; \ No newline at end of file +var _0x9e39=['rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../components/extensions/rewrite','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','update','then','get','Intervals','destroy','error','stack','name','send','index','map','Interval','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','IntervalId','getIntervals','findOne','hasOwnProperty','addIntervals','sequelize','bulkCreate'];(function(_0x5646c5,_0x58e7ab){var _0x21f5ef=function(_0x5b49bb){while(--_0x5b49bb){_0x5646c5['push'](_0x5646c5['shift']());}};_0x21f5ef(++_0x58e7ab);}(_0x9e39,0x114));var _0x99e3=function(_0x4c0bc7,_0x58f0e1){_0x4c0bc7=_0x4c0bc7-0x0;var _0x451e8a=_0x9e39[_0x4c0bc7];return _0x451e8a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x99e3('0x0'));var zipdir=require(_0x99e3('0x1'));var jsonpatch=require(_0x99e3('0x2'));var rp=require(_0x99e3('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x99e3('0x4'));var util=require(_0x99e3('0x5'));var path=require(_0x99e3('0x6'));var sox=require(_0x99e3('0x7'));var csv=require(_0x99e3('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x99e3('0x9'));var squel=require(_0x99e3('0xa'));var crypto=require(_0x99e3('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x99e3('0xc'));var toCsv=require(_0x99e3('0x8'));var querystring=require(_0x99e3('0xd'));var Papa=require(_0x99e3('0xe'));var Redis=require(_0x99e3('0xf'));var authService=require(_0x99e3('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x99e3('0x11'));var hardwareService=require(_0x99e3('0x12'));var logger=require(_0x99e3('0x13'))(_0x99e3('0x14'));var utils=require(_0x99e3('0x15'));var config=require(_0x99e3('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var extensions=require(_0x99e3('0x17'));function respondWithStatusCode(_0x5912d6,_0x55fd55){_0x55fd55=_0x55fd55||0xcc;return function(_0x16c469){if(_0x16c469){return _0x5912d6[_0x99e3('0x18')](_0x55fd55);}return _0x5912d6[_0x99e3('0x19')](_0x55fd55)[_0x99e3('0x1a')]();};}function respondWithResult(_0x21e842,_0x53a25e){_0x53a25e=_0x53a25e||0xc8;return function(_0xb84fc7){if(_0xb84fc7){return _0x21e842['status'](_0x53a25e)[_0x99e3('0x1b')](_0xb84fc7);}};}function respondWithFilteredResult(_0x208fd5,_0x52864b){return function(_0x579679){if(_0x579679){var _0xd0d531=typeof _0x52864b[_0x99e3('0x1c')]===_0x99e3('0x1d')&&typeof _0x52864b['limit']===_0x99e3('0x1d');var _0x57191e=_0x579679[_0x99e3('0x1e')];var _0x131614=_0xd0d531?0x0:_0x52864b[_0x99e3('0x1c')];var _0x497628=_0xd0d531?_0x579679[_0x99e3('0x1e')]:_0x52864b[_0x99e3('0x1c')]+_0x52864b[_0x99e3('0x1f')];var _0x2dc3a2;if(_0x497628>=_0x57191e){_0x497628=_0x57191e;_0x2dc3a2=0xc8;}else{_0x2dc3a2=0xce;}_0x208fd5[_0x99e3('0x19')](_0x2dc3a2);return _0x208fd5[_0x99e3('0x20')]('Content-Range',_0x131614+'-'+_0x497628+'/'+_0x57191e)['json'](_0x579679);}return null;};}function patchUpdates(_0x1945e0){return function(_0x2a492c){try{jsonpatch[_0x99e3('0x21')](_0x2a492c,_0x1945e0,!![]);}catch(_0x90eaa0){return BPromise[_0x99e3('0x22')](_0x90eaa0);}return _0x2a492c['save']();};}function saveUpdates(_0x146fce,_0x9efc30){return function(_0x12508a){if(_0x12508a){return _0x12508a[_0x99e3('0x23')](_0x146fce)[_0x99e3('0x24')](function(_0x55b4f0){return _0x55b4f0;});}return null;};}function removeEntity(_0x3aaeb9,_0x1dcbb2){return function(_0x2ed0db){if(_0x2ed0db){return _0x2ed0db['destroy']()[_0x99e3('0x24')](function(){var _0x118941=_0x2ed0db[_0x99e3('0x25')]({'plain':!![]});var _0x4535eb=_0x99e3('0x26');return db['UserProfileResource'][_0x99e3('0x27')]({'where':{'type':_0x4535eb,'resourceId':_0x118941['id']}})[_0x99e3('0x24')](function(){return _0x2ed0db;});})[_0x99e3('0x24')](function(){_0x3aaeb9[_0x99e3('0x19')](0xcc)[_0x99e3('0x1a')]();});}};}function handleEntityNotFound(_0x243fd4,_0x5378d6){return function(_0x1a37cd){if(!_0x1a37cd){_0x243fd4[_0x99e3('0x18')](0x194);}return _0x1a37cd;};}function handleError(_0x48753,_0x1adcf8){_0x1adcf8=_0x1adcf8||0x1f4;return function(_0x24b799){logger[_0x99e3('0x28')](_0x24b799[_0x99e3('0x29')]);if(_0x24b799[_0x99e3('0x2a')]){delete _0x24b799['name'];}_0x48753[_0x99e3('0x19')](_0x1adcf8)[_0x99e3('0x2b')](_0x24b799);};}exports[_0x99e3('0x2c')]=function(_0x366913,_0x1dc051){var _0x3c58dd={},_0x1677d2={},_0x2c1e92={'count':0x0,'rows':[]};var _0x3733d2=_[_0x99e3('0x2d')](db[_0x99e3('0x2e')][_0x99e3('0x2f')],function(_0x48da4a){return{'name':_0x48da4a[_0x99e3('0x30')],'type':_0x48da4a[_0x99e3('0x31')][_0x99e3('0x32')]};});_0x1677d2['model']=_['map'](_0x3733d2,'name');_0x1677d2[_0x99e3('0x33')]=_[_0x99e3('0x34')](_0x366913[_0x99e3('0x33')]);_0x1677d2[_0x99e3('0x35')]=_['intersection'](_0x1677d2[_0x99e3('0x36')],_0x1677d2[_0x99e3('0x33')]);_0x3c58dd[_0x99e3('0x37')]=_[_0x99e3('0x38')](_0x1677d2[_0x99e3('0x36')],qs[_0x99e3('0x39')](_0x366913['query'][_0x99e3('0x39')]));_0x3c58dd[_0x99e3('0x37')]=_0x3c58dd[_0x99e3('0x37')][_0x99e3('0x3a')]?_0x3c58dd[_0x99e3('0x37')]:_0x1677d2[_0x99e3('0x36')];if(!_0x366913[_0x99e3('0x33')]['hasOwnProperty'](_0x99e3('0x3b'))){_0x3c58dd[_0x99e3('0x1f')]=qs[_0x99e3('0x1f')](_0x366913[_0x99e3('0x33')]['limit']);_0x3c58dd[_0x99e3('0x1c')]=qs[_0x99e3('0x1c')](_0x366913[_0x99e3('0x33')][_0x99e3('0x1c')]);}_0x3c58dd[_0x99e3('0x3c')]=qs['sort'](_0x366913[_0x99e3('0x33')][_0x99e3('0x3d')]);_0x3c58dd[_0x99e3('0x3e')]=qs[_0x99e3('0x35')](_[_0x99e3('0x3f')](_0x366913[_0x99e3('0x33')],_0x1677d2[_0x99e3('0x35')]),_0x3733d2);if(_0x366913[_0x99e3('0x33')][_0x99e3('0x40')]){_0x3c58dd['where']=_[_0x99e3('0x41')](_0x3c58dd['where'],{'$or':_['map'](_0x3733d2,function(_0x3832c1){if(_0x3832c1[_0x99e3('0x31')]!==_0x99e3('0x42')){var _0x5be46a={};_0x5be46a[_0x3832c1['name']]={'$like':'%'+_0x366913['query'][_0x99e3('0x40')]+'%'};return _0x5be46a;}})});}_0x3c58dd=_[_0x99e3('0x41')]({},_0x3c58dd,_0x366913[_0x99e3('0x43')]);var _0x22b849={'where':_0x3c58dd[_0x99e3('0x3e')]};return db[_0x99e3('0x2e')][_0x99e3('0x1e')](_0x22b849)[_0x99e3('0x24')](function(_0x241906){_0x2c1e92[_0x99e3('0x1e')]=_0x241906;if(_0x366913['query']['includeAll']){_0x3c58dd[_0x99e3('0x44')]=[{'all':!![]}];}return db[_0x99e3('0x2e')][_0x99e3('0x45')](_0x3c58dd);})['then'](function(_0x344133){_0x2c1e92[_0x99e3('0x46')]=_0x344133;return _0x2c1e92;})['then'](respondWithFilteredResult(_0x1dc051,_0x3c58dd))[_0x99e3('0x47')](handleError(_0x1dc051,null));};exports['show']=function(_0x42f30a,_0x15bb19){var _0x365514={'raw':!![],'where':{'id':_0x42f30a[_0x99e3('0x48')]['id']}},_0x232a88={};_0x232a88[_0x99e3('0x36')]=_[_0x99e3('0x34')](db['Interval'][_0x99e3('0x2f')]);_0x232a88[_0x99e3('0x33')]=_[_0x99e3('0x34')](_0x42f30a[_0x99e3('0x33')]);_0x232a88[_0x99e3('0x35')]=_[_0x99e3('0x38')](_0x232a88['model'],_0x232a88[_0x99e3('0x33')]);_0x365514[_0x99e3('0x37')]=_[_0x99e3('0x38')](_0x232a88[_0x99e3('0x36')],qs[_0x99e3('0x39')](_0x42f30a[_0x99e3('0x33')]['fields']));_0x365514[_0x99e3('0x37')]=_0x365514[_0x99e3('0x37')]['length']?_0x365514[_0x99e3('0x37')]:_0x232a88['model'];if(_0x42f30a[_0x99e3('0x33')]['includeAll']){_0x365514['include']=[{'all':!![]}];}_0x365514=_[_0x99e3('0x41')]({},_0x365514,_0x42f30a[_0x99e3('0x43')]);return db[_0x99e3('0x2e')][_0x99e3('0x49')](_0x365514)[_0x99e3('0x24')](handleEntityNotFound(_0x15bb19,null))['then'](respondWithResult(_0x15bb19,null))[_0x99e3('0x47')](handleError(_0x15bb19,null));};exports[_0x99e3('0x4a')]=function(_0x30867e,_0x5287ad){return db[_0x99e3('0x2e')][_0x99e3('0x4a')](_0x30867e[_0x99e3('0x4b')],{})[_0x99e3('0x24')](function(_0xfb0d78){var _0x47e106=_0x30867e[_0x99e3('0x4c')][_0x99e3('0x25')]({'plain':!![]});if(!_0x47e106)throw new Error(_0x99e3('0x4d'));if(_0x47e106[_0x99e3('0x4e')]===_0x99e3('0x4c')){var _0x440294=_0xfb0d78[_0x99e3('0x25')]({'plain':!![]});var _0x5949e2=_0x99e3('0x26');return db[_0x99e3('0x4f')][_0x99e3('0x49')]({'where':{'name':_0x5949e2,'userProfileId':_0x47e106[_0x99e3('0x50')]},'raw':!![]})['then'](function(_0x39fcc6){if(_0x39fcc6&&_0x39fcc6[_0x99e3('0x51')]===0x0){return db[_0x99e3('0x52')][_0x99e3('0x4a')]({'name':_0x440294[_0x99e3('0x2a')],'resourceId':_0x440294['id'],'type':_0x39fcc6[_0x99e3('0x2a')],'sectionId':_0x39fcc6['id']},{})['then'](function(){return _0xfb0d78;});}else{return _0xfb0d78;}})[_0x99e3('0x47')](function(_0xd97d13){logger['error'](_0x99e3('0x53'),_0xd97d13);throw _0xd97d13;});}return _0xfb0d78;})[_0x99e3('0x24')](respondWithResult(_0x5287ad,0xc9))[_0x99e3('0x47')](handleError(_0x5287ad,null));};exports[_0x99e3('0x23')]=function(_0x558a2d,_0x423aab){if(_0x558a2d[_0x99e3('0x4b')]['id']){delete _0x558a2d[_0x99e3('0x4b')]['id'];}return db[_0x99e3('0x2e')][_0x99e3('0x49')]({'where':{'id':_0x558a2d[_0x99e3('0x48')]['id']}})[_0x99e3('0x24')](handleEntityNotFound(_0x423aab,null))[_0x99e3('0x24')](saveUpdates(_0x558a2d[_0x99e3('0x4b')],null))[_0x99e3('0x24')](respondWithResult(_0x423aab,null))[_0x99e3('0x47')](handleError(_0x423aab,null));};exports['destroy']=function(_0x5d835f,_0x3a2dcc){return db[_0x99e3('0x2e')]['find']({'where':{'id':_0x5d835f[_0x99e3('0x48')]['id']}})[_0x99e3('0x24')](handleEntityNotFound(_0x3a2dcc,null))[_0x99e3('0x24')](removeEntity(_0x3a2dcc,null))['catch'](handleError(_0x3a2dcc,null));};exports[_0x99e3('0x54')]=function(_0x5c453a,_0x25c6a4,_0x42dddd){if(_0x5c453a[_0x99e3('0x4b')]['id']){delete _0x5c453a[_0x99e3('0x4b')]['id'];}return db[_0x99e3('0x2e')][_0x99e3('0x49')]({'where':{'id':_0x5c453a[_0x99e3('0x48')]['id']}})[_0x99e3('0x24')](handleEntityNotFound(_0x25c6a4,null))[_0x99e3('0x24')](function(_0x22c7e5){if(_0x22c7e5){_0x5c453a['body'][_0x99e3('0x55')]=_0x22c7e5['id'];return db['Interval']['create'](_0x5c453a[_0x99e3('0x4b')]);}})[_0x99e3('0x24')](respondWithResult(_0x25c6a4,null))[_0x99e3('0x47')](handleError(_0x25c6a4,null));};exports[_0x99e3('0x56')]=function(_0x1ccb7a,_0x51b9e5,_0x48de8a){var _0x4fca99={};var _0x475b0b={};var _0x52715a;var _0x1f8d7d;return db[_0x99e3('0x2e')][_0x99e3('0x57')]({'where':{'id':_0x1ccb7a[_0x99e3('0x48')]['id']}})['then'](handleEntityNotFound(_0x51b9e5,null))[_0x99e3('0x24')](function(_0x25d070){if(_0x25d070){_0x52715a=_0x25d070;_0x475b0b[_0x99e3('0x36')]=_[_0x99e3('0x34')](db[_0x99e3('0x2e')][_0x99e3('0x2f')]);_0x475b0b[_0x99e3('0x33')]=_['keys'](_0x1ccb7a[_0x99e3('0x33')]);_0x475b0b[_0x99e3('0x35')]=_[_0x99e3('0x38')](_0x475b0b[_0x99e3('0x36')],_0x475b0b['query']);_0x4fca99[_0x99e3('0x37')]=_[_0x99e3('0x38')](_0x475b0b['model'],qs[_0x99e3('0x39')](_0x1ccb7a[_0x99e3('0x33')][_0x99e3('0x39')]));_0x4fca99[_0x99e3('0x37')]=_0x4fca99[_0x99e3('0x37')][_0x99e3('0x3a')]?_0x4fca99[_0x99e3('0x37')]:_0x475b0b[_0x99e3('0x36')];_0x4fca99[_0x99e3('0x3c')]=qs[_0x99e3('0x3d')](_0x1ccb7a['query']['sort']);_0x4fca99[_0x99e3('0x3e')]=qs['filters'](_[_0x99e3('0x3f')](_0x1ccb7a['query'],_0x475b0b[_0x99e3('0x35')]));if(_0x1ccb7a[_0x99e3('0x33')][_0x99e3('0x40')]){_0x4fca99[_0x99e3('0x3e')]=_['merge'](_0x4fca99[_0x99e3('0x3e')],{'$or':_[_0x99e3('0x2d')](_0x4fca99[_0x99e3('0x37')],function(_0x3d9f55){var _0x4e6910={};_0x4e6910[_0x3d9f55]={'$like':'%'+_0x1ccb7a['query'][_0x99e3('0x40')]+'%'};return _0x4e6910;})});}_0x4fca99=_[_0x99e3('0x41')]({},_0x4fca99,_0x1ccb7a[_0x99e3('0x43')]);return _0x52715a[_0x99e3('0x56')](_0x4fca99);}})[_0x99e3('0x24')](function(_0x4ffcfc){if(_0x4ffcfc){_0x1f8d7d=_0x4ffcfc[_0x99e3('0x3a')];if(!_0x1ccb7a[_0x99e3('0x33')][_0x99e3('0x58')]('nolimit')){_0x4fca99[_0x99e3('0x1f')]=qs[_0x99e3('0x1f')](_0x1ccb7a['query'][_0x99e3('0x1f')]);_0x4fca99['offset']=qs[_0x99e3('0x1c')](_0x1ccb7a[_0x99e3('0x33')]['offset']);}return _0x52715a[_0x99e3('0x56')](_0x4fca99);}})[_0x99e3('0x24')](function(_0xf94e1a){if(_0xf94e1a){return _0xf94e1a?{'count':_0x1f8d7d,'rows':_0xf94e1a}:null;}})[_0x99e3('0x24')](respondWithResult(_0x51b9e5,null))['catch'](handleError(_0x51b9e5,null));};exports[_0x99e3('0x59')]=function(_0x1968bf,_0x414a15,_0x11a9e2){return db['Interval'][_0x99e3('0x57')]({'where':{'id':_0x1968bf['params']['id']}})[_0x99e3('0x24')](handleEntityNotFound(_0x414a15,null))[_0x99e3('0x24')](function(_0x56fffc){if(_0x56fffc){return db[_0x99e3('0x5a')]['transaction'](function(_0x17b585){return db[_0x99e3('0x2e')][_0x99e3('0x27')]({'where':{'IntervalId':_0x1968bf[_0x99e3('0x48')]['id']},'transaction':_0x17b585})[_0x99e3('0x24')](function(_0x581c77){var _0x134c73=_[_0x99e3('0x2d')](_0x1968bf[_0x99e3('0x4b')],function(_0x726ad5){delete _0x726ad5['id'];_0x726ad5['IntervalId']=_0x1968bf[_0x99e3('0x48')]['id'];return _0x726ad5;});return db['Interval'][_0x99e3('0x5b')](_0x134c73,{'transaction':_0x17b585});});})['then'](function(){return db[_0x99e3('0x2e')][_0x99e3('0x45')]({'where':{'IntervalId':_0x1968bf['params']['id']}});});}})[_0x99e3('0x24')](respondWithResult(_0x414a15,null))[_0x99e3('0x47')](handleError(_0x414a15,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 138ae54..cd9d5d7 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 _0xa73d=['map','ifTime','then','../../components/extensions/rewrite','iftime','define','tools_intervals','rewrite','interval','getIntervals'];(function(_0x7b544a,_0x33c45a){var _0x33dcb4=function(_0x5ebc7f){while(--_0x5ebc7f){_0x7b544a['push'](_0x7b544a['shift']());}};_0x33dcb4(++_0x33c45a);}(_0xa73d,0xad));var _0xda73=function(_0x4c437f,_0x380c6e){_0x4c437f=_0x4c437f-0x0;var _0xad9c0e=_0xa73d[_0x4c437f];return _0xad9c0e;};'use strict';var attributes=require('./interval.attributes');var extensions=require(_0xda73('0x0'));var iftime=require('../../utils/iftime')[_0xda73('0x1')];module['exports']=function(_0x13dbfd){return _0x13dbfd[_0xda73('0x2')]('Interval',attributes,{'tableName':_0xda73('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x230f8a){extensions[_0xda73('0x4')](_0x13dbfd,_0x230f8a);},'afterBulkCreate':function(_0x434f48,_0x3fbcf8,_0x5d6719){_0x5d6719();extensions[_0xda73('0x4')](_0x13dbfd,_0x434f48[0x0]);},'afterUpdate':function(_0x540546){extensions[_0xda73('0x4')](_0x13dbfd,_0x540546);},'afterDestroy':function(_0x323a71){extensions[_0xda73('0x4')](_0x13dbfd,_0x323a71);}},'instanceMethods':{'ifTime':function(_0x2f5c19=undefined,_0x2dbfcc=new Date()){if(typeof this[_0xda73('0x5')]==='string'){return iftime(this[_0xda73('0x5')],_0x2f5c19,_0x2dbfcc);}else{return this[_0xda73('0x6')]()['then'](function(_0x44cfbf){return Promise['all'](_0x44cfbf[_0xda73('0x7')](function(_0x4424d8){return _0x4424d8[_0xda73('0x8')](_0x2f5c19,_0x2dbfcc);}));})[_0xda73('0x9')](function(_0x3305e9){return _0x3305e9['reduce'](function(_0x3408d5,_0x5747b0){return _0x3408d5||_0x5747b0;},![]);});}}}});}; \ No newline at end of file +var _0xb088=['../../components/extensions/rewrite','../../utils/iftime','iftime','Interval','tools_intervals','rewrite','string','interval','getIntervals','then','all','ifTime','reduce','./interval.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb088,0x99));var _0x8b08=function(_0x24fa3b,_0x4e5434){_0x24fa3b=_0x24fa3b-0x0;var _0x34b400=_0xb088[_0x24fa3b];return _0x34b400;};'use strict';var attributes=require(_0x8b08('0x0'));var extensions=require(_0x8b08('0x1'));var iftime=require(_0x8b08('0x2'))[_0x8b08('0x3')];module['exports']=function(_0xddd82b){return _0xddd82b['define'](_0x8b08('0x4'),attributes,{'tableName':_0x8b08('0x5'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x229988){extensions[_0x8b08('0x6')](_0xddd82b,_0x229988);},'afterBulkCreate':function(_0xf4719d,_0x25297d,_0x9c0291){_0x9c0291();extensions[_0x8b08('0x6')](_0xddd82b,_0xf4719d[0x0]);},'afterUpdate':function(_0x56b9f3){extensions['rewrite'](_0xddd82b,_0x56b9f3);},'afterDestroy':function(_0x137f50){extensions[_0x8b08('0x6')](_0xddd82b,_0x137f50);}},'instanceMethods':{'ifTime':function(_0x1fdb9e=undefined,_0x21a404=new Date()){if(typeof this['interval']===_0x8b08('0x7')){return iftime(this[_0x8b08('0x8')],_0x1fdb9e,_0x21a404);}else{return this[_0x8b08('0x9')]()[_0x8b08('0xa')](function(_0xb18d6a){return Promise[_0x8b08('0xb')](_0xb18d6a['map'](function(_0x49aa83){return _0x49aa83[_0x8b08('0xc')](_0x1fdb9e,_0x21a404);}));})[_0x8b08('0xa')](function(_0x44505c){return _0x44505c[_0x8b08('0xd')](function(_0x3e4ba0,_0x3387e6){return _0x3e4ba0||_0x3387e6;},![]);});}}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 756d641..a4b3d1f 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 _0x394f=['options','raw','where','attributes','include','map','model','then','info','debug','catch','error','message','ShowInterval','find','stringify','ifTime','format','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','join','name','IntervalIftime','isArray','intervals','timezone','length','Iftime','silly','resolve','reduce','lodash','../../mysqldb','../../utils/iftime','iftime','../../config/logger','rpc','GetInterval','Interval','findAll'];(function(_0x18e30f,_0x6b27a6){var _0x5846a9=function(_0x3d2d5c){while(--_0x3d2d5c){_0x18e30f['push'](_0x18e30f['shift']());}};_0x5846a9(++_0x6b27a6);}(_0x394f,0x108));var _0xf394=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x394f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf394('0x0'));var util=require('util');var db=require(_0xf394('0x1'))['db'];var iftime=require(_0xf394('0x2'))[_0xf394('0x3')];var logger=require(_0xf394('0x4'))(_0xf394('0x5'));exports[_0xf394('0x6')]=function(_0x456c1b){var _0xf4bee6=this;return new Promise(function(_0x3c97d3,_0x18f28d){return db[_0xf394('0x7')][_0xf394('0x8')]({'raw':_0x456c1b[_0xf394('0x9')]?_0x456c1b[_0xf394('0x9')][_0xf394('0xa')]===undefined?!![]:![]:!![],'where':_0x456c1b[_0xf394('0x9')]?_0x456c1b[_0xf394('0x9')][_0xf394('0xb')]||null:null,'attributes':_0x456c1b[_0xf394('0x9')]?_0x456c1b[_0xf394('0x9')][_0xf394('0xc')]||null:null,'limit':_0x456c1b['options']?_0x456c1b[_0xf394('0x9')]['limit']||null:null,'include':_0x456c1b['options']?_0x456c1b[_0xf394('0x9')][_0xf394('0xd')]?_[_0xf394('0xe')](_0x456c1b[_0xf394('0x9')][_0xf394('0xd')],function(_0x49c819){return{'model':db[_0x49c819[_0xf394('0xf')]],'as':_0x49c819['as'],'attributes':_0x49c819['attributes'],'include':_0x49c819[_0xf394('0xd')]?_['map'](_0x49c819[_0xf394('0xd')],function(_0x43776a){return{'model':db[_0x43776a['model']],'as':_0x43776a['as'],'attributes':_0x43776a['attributes'],'include':_0x43776a[_0xf394('0xd')]?_[_0xf394('0xe')](_0x43776a[_0xf394('0xd')],function(_0xfb0e7b){return{'model':db[_0xfb0e7b['model']],'as':_0xfb0e7b['as'],'attributes':_0xfb0e7b[_0xf394('0xc')]};}):[]};}):[]};}):[]:[]})[_0xf394('0x10')](function(_0x2a6504){logger[_0xf394('0x11')](_0xf394('0x6'),_0x456c1b);logger[_0xf394('0x12')]('GetInterval',_0x456c1b,JSON['stringify'](_0x2a6504));_0x3c97d3(_0x2a6504);})[_0xf394('0x13')](function(_0x11fe8e){logger[_0xf394('0x14')](_0xf394('0x6'),_0x11fe8e[_0xf394('0x15')],_0x456c1b);_0x18f28d(_0xf4bee6[_0xf394('0x14')](0x1f4,_0x11fe8e['message']));});});};exports[_0xf394('0x16')]=function(_0x368a9f){var _0x22fc69=this;return new Promise(function(_0x4d5191,_0x1e0ef3){return db['Interval'][_0xf394('0x17')]({'raw':_0x368a9f[_0xf394('0x9')]?_0x368a9f['options'][_0xf394('0xa')]===undefined?!![]:![]:!![],'where':_0x368a9f[_0xf394('0x9')]?_0x368a9f['options'][_0xf394('0xb')]||null:null,'attributes':_0x368a9f['options']?_0x368a9f[_0xf394('0x9')][_0xf394('0xc')]||null:null,'include':_0x368a9f[_0xf394('0x9')]?_0x368a9f[_0xf394('0x9')]['include']?_['map'](_0x368a9f[_0xf394('0x9')][_0xf394('0xd')],function(_0x35fcfe){return{'model':db[_0x35fcfe['model']],'as':_0x35fcfe['as'],'attributes':_0x35fcfe['attributes'],'include':_0x35fcfe['include']?_[_0xf394('0xe')](_0x35fcfe['include'],function(_0x1073a4){return{'model':db[_0x1073a4[_0xf394('0xf')]],'as':_0x1073a4['as'],'attributes':_0x1073a4[_0xf394('0xc')],'include':_0x1073a4[_0xf394('0xd')]?_[_0xf394('0xe')](_0x1073a4[_0xf394('0xd')],function(_0x2a330f){return{'model':db[_0x2a330f[_0xf394('0xf')]],'as':_0x2a330f['as'],'attributes':_0x2a330f[_0xf394('0xc')]};}):[]};}):[]};}):[]:[]})[_0xf394('0x10')](function(_0x1fa376){logger['info']('ShowInterval',_0x368a9f);logger['debug']('ShowInterval',_0x368a9f,JSON[_0xf394('0x18')](_0x1fa376));_0x4d5191(_0x1fa376);})[_0xf394('0x13')](function(_0x5f53bf){logger['error'](_0xf394('0x16'),_0x5f53bf[_0xf394('0x15')],_0x368a9f);_0x1e0ef3(_0x22fc69['error'](0x1f4,_0x5f53bf[_0xf394('0x15')]));});});};function checkArrayOfIntervals(_0x4e3499,_0x3e6bd2){var _0x55ea65=[];return db[_0xf394('0x7')][_0xf394('0x8')]({'where':{'id':_0x4e3499}})[_0xf394('0x10')](function(_0x3b8048){_0x55ea65=_0x3b8048;return Promise['all'](_0x55ea65[_0xf394('0xe')](function(_0x374e32){return _0x374e32[_0xf394('0x19')](_0x3e6bd2);}));})[_0xf394('0x10')](function(_0x2fe05e){var _0x14904a=_0x2fe05e['reduce'](function(_0x5955d6,_0x5c26b6){return _0x5955d6||_0x5c26b6;},![]);logger[_0xf394('0x11')](util[_0xf394('0x1a')](_0xf394('0x1b'),_0x55ea65['map'](function(_0x444ade){return _0x444ade['name'];})['join'](',\x20'),_0x55ea65[_0xf394('0xe')](function(_0x34c0c4){return _0x34c0c4['id'];})[_0xf394('0x1c')](',\x20')));return _0x14904a;});}function checkSingleInterval(_0x1c8a80,_0x1944e0){return db[_0xf394('0x7')]['findById'](_0x1c8a80)[_0xf394('0x10')](function(_0x3e241c){if(_0x3e241c){logger['info'](util[_0xf394('0x1a')]('IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)',_0x3e241c[_0xf394('0x1d')],_0x3e241c['id']));return _0x3e241c['ifTime'](_0x1944e0);}});}exports[_0xf394('0x1e')]=function(_0x32de6c){var _0x4f1501=_0x32de6c['intervalIds'];var _0x57643f=Array[_0xf394('0x1f')](_0x32de6c[_0xf394('0x20')])?_0x32de6c[_0xf394('0x20')]:typeof _0x32de6c[_0xf394('0x20')]==='string'?[_0x32de6c[_0xf394('0x20')]]:[];var _0x53d191=_0x32de6c[_0xf394('0x21')]||undefined;var _0x2b0e0a=![];if(_0x57643f[_0xf394('0x22')]){logger['info'](util['format']('IntervalIftime:\x20interval\x20strings\x20=\x20%s',_0x57643f[_0xf394('0x1c')](';\x20')));}if(_0x53d191){logger[_0xf394('0x11')](util[_0xf394('0x1a')]('IntervalIftime:\x20timezone\x20=\x20%s',_0x53d191));}logger['debug'](_0xf394('0x23'),_0x2b0e0a);logger[_0xf394('0x24')](_0xf394('0x1e'),_0x32de6c);return Promise[_0xf394('0x25')]()[_0xf394('0x10')](function(){if(Array['isArray'](_0x4f1501)){return checkArrayOfIntervals(_0x4f1501,_0x53d191);}else if(_0x4f1501){return checkSingleInterval(_0x4f1501,_0x53d191);}})[_0xf394('0x10')](function(_0x3bdcde){var _0x267176=_0x57643f[_0xf394('0x26')](function(_0x577daa,_0x3676f2){return _0x577daa||iftime(_0x3676f2,_0x53d191);},![]);_0x2b0e0a=_0x3bdcde||_0x267176;return _0x2b0e0a;})['catch'](function(_0x576b68){logger[_0xf394('0x14')](_0xf394('0x1e'),_0x32de6c,_0x576b68);throw this[_0xf394('0x14')](0x1f4,_0x576b68['message']);});}; \ No newline at end of file +var _0x73ba=['format','name','join','IntervalIftime','intervalIds','isArray','intervals','string','timezone','length','IntervalIftime:\x20interval\x20strings\x20=\x20%s','silly','resolve','util','../../mysqldb','../../utils/iftime','iftime','../../config/logger','rpc','GetInterval','Interval','options','raw','limit','include','model','map','attributes','then','debug','stringify','error','message','find','where','info','ShowInterval','catch','all','ifTime','reduce'];(function(_0x2f7e20,_0x274e29){var _0x5619a3=function(_0x36db3a){while(--_0x36db3a){_0x2f7e20['push'](_0x2f7e20['shift']());}};_0x5619a3(++_0x274e29);}(_0x73ba,0x103));var _0xa73b=function(_0x5eb9b3,_0x46fda2){_0x5eb9b3=_0x5eb9b3-0x0;var _0xcb3dcb=_0x73ba[_0x5eb9b3];return _0xcb3dcb;};'use strict';var _=require('lodash');var util=require(_0xa73b('0x0'));var db=require(_0xa73b('0x1'))['db'];var iftime=require(_0xa73b('0x2'))[_0xa73b('0x3')];var logger=require(_0xa73b('0x4'))(_0xa73b('0x5'));exports[_0xa73b('0x6')]=function(_0x57c72c){var _0x3780df=this;return new Promise(function(_0x4f84d6,_0x24bf0c){return db[_0xa73b('0x7')]['findAll']({'raw':_0x57c72c[_0xa73b('0x8')]?_0x57c72c[_0xa73b('0x8')][_0xa73b('0x9')]===undefined?!![]:![]:!![],'where':_0x57c72c[_0xa73b('0x8')]?_0x57c72c[_0xa73b('0x8')]['where']||null:null,'attributes':_0x57c72c[_0xa73b('0x8')]?_0x57c72c[_0xa73b('0x8')]['attributes']||null:null,'limit':_0x57c72c[_0xa73b('0x8')]?_0x57c72c[_0xa73b('0x8')][_0xa73b('0xa')]||null:null,'include':_0x57c72c[_0xa73b('0x8')]?_0x57c72c[_0xa73b('0x8')][_0xa73b('0xb')]?_['map'](_0x57c72c[_0xa73b('0x8')][_0xa73b('0xb')],function(_0x2274f9){return{'model':db[_0x2274f9[_0xa73b('0xc')]],'as':_0x2274f9['as'],'attributes':_0x2274f9['attributes'],'include':_0x2274f9[_0xa73b('0xb')]?_[_0xa73b('0xd')](_0x2274f9['include'],function(_0x477f93){return{'model':db[_0x477f93[_0xa73b('0xc')]],'as':_0x477f93['as'],'attributes':_0x477f93[_0xa73b('0xe')],'include':_0x477f93['include']?_[_0xa73b('0xd')](_0x477f93[_0xa73b('0xb')],function(_0x5cfacc){return{'model':db[_0x5cfacc[_0xa73b('0xc')]],'as':_0x5cfacc['as'],'attributes':_0x5cfacc['attributes']};}):[]};}):[]};}):[]:[]})[_0xa73b('0xf')](function(_0xbed040){logger['info'](_0xa73b('0x6'),_0x57c72c);logger[_0xa73b('0x10')](_0xa73b('0x6'),_0x57c72c,JSON[_0xa73b('0x11')](_0xbed040));_0x4f84d6(_0xbed040);})['catch'](function(_0x1b2c26){logger[_0xa73b('0x12')](_0xa73b('0x6'),_0x1b2c26[_0xa73b('0x13')],_0x57c72c);_0x24bf0c(_0x3780df[_0xa73b('0x12')](0x1f4,_0x1b2c26[_0xa73b('0x13')]));});});};exports['ShowInterval']=function(_0x1fc4db){var _0x33f1e9=this;return new Promise(function(_0x3a2565,_0x1702fa){return db[_0xa73b('0x7')][_0xa73b('0x14')]({'raw':_0x1fc4db[_0xa73b('0x8')]?_0x1fc4db['options']['raw']===undefined?!![]:![]:!![],'where':_0x1fc4db['options']?_0x1fc4db[_0xa73b('0x8')][_0xa73b('0x15')]||null:null,'attributes':_0x1fc4db['options']?_0x1fc4db[_0xa73b('0x8')][_0xa73b('0xe')]||null:null,'include':_0x1fc4db[_0xa73b('0x8')]?_0x1fc4db[_0xa73b('0x8')][_0xa73b('0xb')]?_['map'](_0x1fc4db[_0xa73b('0x8')]['include'],function(_0x390051){return{'model':db[_0x390051[_0xa73b('0xc')]],'as':_0x390051['as'],'attributes':_0x390051[_0xa73b('0xe')],'include':_0x390051[_0xa73b('0xb')]?_[_0xa73b('0xd')](_0x390051[_0xa73b('0xb')],function(_0x3d6bb9){return{'model':db[_0x3d6bb9[_0xa73b('0xc')]],'as':_0x3d6bb9['as'],'attributes':_0x3d6bb9[_0xa73b('0xe')],'include':_0x3d6bb9[_0xa73b('0xb')]?_[_0xa73b('0xd')](_0x3d6bb9[_0xa73b('0xb')],function(_0x131f28){return{'model':db[_0x131f28[_0xa73b('0xc')]],'as':_0x131f28['as'],'attributes':_0x131f28[_0xa73b('0xe')]};}):[]};}):[]};}):[]:[]})[_0xa73b('0xf')](function(_0x169e27){logger[_0xa73b('0x16')](_0xa73b('0x17'),_0x1fc4db);logger[_0xa73b('0x10')]('ShowInterval',_0x1fc4db,JSON[_0xa73b('0x11')](_0x169e27));_0x3a2565(_0x169e27);})[_0xa73b('0x18')](function(_0x514057){logger[_0xa73b('0x12')](_0xa73b('0x17'),_0x514057[_0xa73b('0x13')],_0x1fc4db);_0x1702fa(_0x33f1e9['error'](0x1f4,_0x514057[_0xa73b('0x13')]));});});};function checkArrayOfIntervals(_0xd9ca6c,_0x79fe74){var _0x125d91=[];return db['Interval']['findAll']({'where':{'id':_0xd9ca6c}})[_0xa73b('0xf')](function(_0x2cd486){_0x125d91=_0x2cd486;return Promise[_0xa73b('0x19')](_0x125d91[_0xa73b('0xd')](function(_0x4b1660){return _0x4b1660[_0xa73b('0x1a')](_0x79fe74);}));})[_0xa73b('0xf')](function(_0x4a6d29){var _0x42ba60=_0x4a6d29[_0xa73b('0x1b')](function(_0x28e34c,_0x3cfca9){return _0x28e34c||_0x3cfca9;},![]);logger['info'](util[_0xa73b('0x1c')]('IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)',_0x125d91[_0xa73b('0xd')](function(_0x16a87f){return _0x16a87f[_0xa73b('0x1d')];})[_0xa73b('0x1e')](',\x20'),_0x125d91[_0xa73b('0xd')](function(_0x5b450b){return _0x5b450b['id'];})[_0xa73b('0x1e')](',\x20')));return _0x42ba60;});}function checkSingleInterval(_0x1b48a2,_0x11cc6b){return db[_0xa73b('0x7')]['findById'](_0x1b48a2)[_0xa73b('0xf')](function(_0x4bbbdf){if(_0x4bbbdf){logger[_0xa73b('0x16')](util[_0xa73b('0x1c')]('IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)',_0x4bbbdf[_0xa73b('0x1d')],_0x4bbbdf['id']));return _0x4bbbdf[_0xa73b('0x1a')](_0x11cc6b);}});}exports[_0xa73b('0x1f')]=function(_0x3c09ec){var _0x9a3068=_0x3c09ec[_0xa73b('0x20')];var _0x243091=Array[_0xa73b('0x21')](_0x3c09ec[_0xa73b('0x22')])?_0x3c09ec[_0xa73b('0x22')]:typeof _0x3c09ec[_0xa73b('0x22')]===_0xa73b('0x23')?[_0x3c09ec[_0xa73b('0x22')]]:[];var _0x1f344f=_0x3c09ec[_0xa73b('0x24')]||undefined;var _0x315c06=![];if(_0x243091[_0xa73b('0x25')]){logger['info'](util[_0xa73b('0x1c')](_0xa73b('0x26'),_0x243091[_0xa73b('0x1e')](';\x20')));}if(_0x1f344f){logger[_0xa73b('0x16')](util[_0xa73b('0x1c')]('IntervalIftime:\x20timezone\x20=\x20%s',_0x1f344f));}logger['debug']('Iftime',_0x315c06);logger[_0xa73b('0x27')](_0xa73b('0x1f'),_0x3c09ec);return Promise[_0xa73b('0x28')]()[_0xa73b('0xf')](function(){if(Array[_0xa73b('0x21')](_0x9a3068)){return checkArrayOfIntervals(_0x9a3068,_0x1f344f);}else if(_0x9a3068){return checkSingleInterval(_0x9a3068,_0x1f344f);}})[_0xa73b('0xf')](function(_0x12c3d3){var _0x4ace87=_0x243091[_0xa73b('0x1b')](function(_0x350281,_0x26785e){return _0x350281||iftime(_0x26785e,_0x1f344f);},![]);_0x315c06=_0x12c3d3||_0x4ace87;return _0x315c06;})[_0xa73b('0x18')](function(_0x400bcf){logger[_0xa73b('0x12')]('IntervalIftime',_0x3c09ec,_0x400bcf);throw this[_0xa73b('0x12')](0x1f4,_0x400bcf[_0xa73b('0x13')]);});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 1a62acb..6e04826 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 _0x5f2f=['isAuthenticated','send','exports','express','Router','../../components/auth/service','./jira.controller','post'];(function(_0x14e2dc,_0x5f3535){var _0x1843c3=function(_0x56f5cc){while(--_0x56f5cc){_0x14e2dc['push'](_0x14e2dc['shift']());}};_0x1843c3(++_0x5f3535);}(_0x5f2f,0x73));var _0xf5f2=function(_0xbd09cb,_0x5c001d){_0xbd09cb=_0xbd09cb-0x0;var _0x13695b=_0x5f2f[_0xbd09cb];return _0x13695b;};'use strict';var express=require(_0xf5f2('0x0'));var router=express[_0xf5f2('0x1')]();var auth=require(_0xf5f2('0x2'));var controller=require(_0xf5f2('0x3'));router[_0xf5f2('0x4')]('/',auth[_0xf5f2('0x5')](),controller[_0xf5f2('0x6')]);module[_0xf5f2('0x7')]=router; \ No newline at end of file +var _0x5f2f=['isAuthenticated','send','exports','express','Router','../../components/auth/service','./jira.controller','post'];(function(_0x3217d3,_0xf66fcf){var _0x260f43=function(_0x2b4a34){while(--_0x2b4a34){_0x3217d3['push'](_0x3217d3['shift']());}};_0x260f43(++_0xf66fcf);}(_0x5f2f,0x73));var _0xf5f2=function(_0x205e67,_0x37bd87){_0x205e67=_0x205e67-0x0;var _0x2ffa15=_0x5f2f[_0x205e67];return _0x2ffa15;};'use strict';var express=require(_0xf5f2('0x0'));var router=express[_0xf5f2('0x1')]();var auth=require(_0xf5f2('0x2'));var controller=require(_0xf5f2('0x3'));router[_0xf5f2('0x4')]('/',auth[_0xf5f2('0x5')](),controller[_0xf5f2('0x6')]);module[_0xf5f2('0x7')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index b7e99cf..a14a01e 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 _0x6b16=['customfield_11501','oldToken','customfield_11502','customfield_11503','customfield_11504','reason','track.xcallymotion.com','/rest/api/2/issue','POST','toString','base64','request','setEncoding','utf8','data','end','json','parse','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','body','headers','connection','socket','remoteAddress','bluebird','../../config/logger','api','3eAmWpBVP0','key','MOTGUI','summary','Report','\x20from\x20','description','stringify','issuetype','Bug','fields','customfield_11500','email'];(function(_0x30d0d2,_0x1acda7){var _0x18bda9=function(_0x1e25c4){while(--_0x1e25c4){_0x30d0d2['push'](_0x30d0d2['shift']());}};_0x18bda9(++_0x1acda7);}(_0x6b16,0x71));var _0x66b1=function(_0x3da612,_0x332456){_0x3da612=_0x3da612-0x0;var _0x1a9d1d=_0x6b16[_0x3da612];return _0x1a9d1d;};'use strict';var BPromise=require(_0x66b1('0x0'));var https=require('https');var logger=require(_0x66b1('0x1'))(_0x66b1('0x2'));var USERNAME='support';var PASSWORD=_0x66b1('0x3');function openIssue(_0x5f0a2f,_0x1eca6d){var _0x184f88={'fields':{'project':{'key':_0x5f0a2f[_0x66b1('0x4')]||_0x66b1('0x5')},'summary':(_0x5f0a2f[_0x66b1('0x6')]||_0x66b1('0x7'))+_0x66b1('0x8')+_0x5f0a2f['ip'],'description':_0x5f0a2f[_0x66b1('0x9')]||JSON[_0x66b1('0xa')](_0x5f0a2f),'issuetype':{'name':_0x5f0a2f[_0x66b1('0xb')]||_0x66b1('0xc')}}};_0x184f88[_0x66b1('0xd')][_0x66b1('0xe')]=_0x5f0a2f[_0x66b1('0xf')];_0x184f88[_0x66b1('0xd')][_0x66b1('0x10')]=_0x5f0a2f[_0x66b1('0x11')];_0x184f88[_0x66b1('0xd')][_0x66b1('0x12')]=_0x5f0a2f['newToken'];_0x184f88[_0x66b1('0xd')][_0x66b1('0x13')]=_0x5f0a2f['name'];_0x184f88['fields'][_0x66b1('0x14')]=_0x5f0a2f[_0x66b1('0x15')];_0x184f88['fields']['customfield_10102']=_0x5f0a2f['ip'];var _0x68d65d={'host':_0x66b1('0x16'),'port':0x1bb,'path':_0x66b1('0x17'),'method':_0x66b1('0x18'),'timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)[_0x66b1('0x19')](_0x66b1('0x1a'))}};var _0x4e2ea9=JSON[_0x66b1('0xa')](_0x184f88);var _0x3893e1=https[_0x66b1('0x1b')](_0x68d65d,function(_0x57bf7b){_0x57bf7b[_0x66b1('0x1c')](_0x66b1('0x1d'));var _0x20e54b='';_0x57bf7b['on'](_0x66b1('0x1e'),function(_0x4b74f6){_0x20e54b+=_0x4b74f6;});_0x57bf7b['on'](_0x66b1('0x1f'),function(){if(_0x1eca6d){return _0x1eca6d['status'](_0x57bf7b['statusCode'])[_0x66b1('0x20')](JSON[_0x66b1('0x21')](_0x20e54b));}});});_0x3893e1['on']('error',function(_0x5b5a5e){if(_0x1eca6d){return _0x1eca6d['status'](0x1f4)[_0x66b1('0x20')]({'errors':[{'message':_0x66b1('0x22'),'type':_0x66b1('0x23')}]});}});_0x3893e1[_0x66b1('0x24')](_0x4e2ea9);_0x3893e1[_0x66b1('0x1f')]();}exports[_0x66b1('0x25')]=openIssue;exports['send']=function(_0x51317c,_0x492bdf){_0x51317c[_0x66b1('0x26')]['ip']=_0x51317c[_0x66b1('0x27')]['x-forwarded-for']||_0x51317c[_0x66b1('0x28')]['remoteAddress']||_0x51317c[_0x66b1('0x29')]['remoteAddress']||_0x51317c[_0x66b1('0x28')][_0x66b1('0x29')][_0x66b1('0x2a')];return openIssue(_0x51317c['body'],_0x492bdf);}; \ No newline at end of file +var _0x24e8=['stringify','issuetype','Bug','fields','customfield_11500','email','customfield_11501','customfield_11502','customfield_11503','name','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','request','data','end','status','statusCode','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','openIssue','send','body','headers','x-forwarded-for','connection','remoteAddress','socket','bluebird','https','../../config/logger','api','support','3eAmWpBVP0','summary','\x20from\x20'];(function(_0x216140,_0x216b43){var _0x4f8215=function(_0xd241bf){while(--_0xd241bf){_0x216140['push'](_0x216140['shift']());}};_0x4f8215(++_0x216b43);}(_0x24e8,0xa0));var _0x824e=function(_0x3a7e01,_0x51204c){_0x3a7e01=_0x3a7e01-0x0;var _0x5b8398=_0x24e8[_0x3a7e01];return _0x5b8398;};'use strict';var BPromise=require(_0x824e('0x0'));var https=require(_0x824e('0x1'));var logger=require(_0x824e('0x2'))(_0x824e('0x3'));var USERNAME=_0x824e('0x4');var PASSWORD=_0x824e('0x5');function openIssue(_0x55e9f3,_0x3056cd){var _0x2c7384={'fields':{'project':{'key':_0x55e9f3['key']||'MOTGUI'},'summary':(_0x55e9f3[_0x824e('0x6')]||'Report')+_0x824e('0x7')+_0x55e9f3['ip'],'description':_0x55e9f3['description']||JSON[_0x824e('0x8')](_0x55e9f3),'issuetype':{'name':_0x55e9f3[_0x824e('0x9')]||_0x824e('0xa')}}};_0x2c7384[_0x824e('0xb')][_0x824e('0xc')]=_0x55e9f3[_0x824e('0xd')];_0x2c7384['fields'][_0x824e('0xe')]=_0x55e9f3['oldToken'];_0x2c7384['fields'][_0x824e('0xf')]=_0x55e9f3['newToken'];_0x2c7384[_0x824e('0xb')][_0x824e('0x10')]=_0x55e9f3[_0x824e('0x11')];_0x2c7384[_0x824e('0xb')]['customfield_11504']=_0x55e9f3[_0x824e('0x12')];_0x2c7384[_0x824e('0xb')][_0x824e('0x13')]=_0x55e9f3['ip'];var _0x53533b={'host':_0x824e('0x14'),'port':0x1bb,'path':_0x824e('0x15'),'method':_0x824e('0x16'),'timeout':0x4e20,'headers':{'Content-Type':_0x824e('0x17'),'Authorization':_0x824e('0x18')+new Buffer(USERNAME+':'+PASSWORD)['toString']('base64')}};var _0x1c0420=JSON[_0x824e('0x8')](_0x2c7384);var _0x277d05=https[_0x824e('0x19')](_0x53533b,function(_0x159312){_0x159312['setEncoding']('utf8');var _0x144329='';_0x159312['on'](_0x824e('0x1a'),function(_0x2d6373){_0x144329+=_0x2d6373;});_0x159312['on'](_0x824e('0x1b'),function(){if(_0x3056cd){return _0x3056cd[_0x824e('0x1c')](_0x159312[_0x824e('0x1d')])[_0x824e('0x1e')](JSON[_0x824e('0x1f')](_0x144329));}});});_0x277d05['on'](_0x824e('0x20'),function(_0x32825d){if(_0x3056cd){return _0x3056cd['status'](0x1f4)[_0x824e('0x1e')]({'errors':[{'message':_0x824e('0x21'),'type':'api.jira'}]});}});_0x277d05['write'](_0x1c0420);_0x277d05['end']();}exports[_0x824e('0x22')]=openIssue;exports[_0x824e('0x23')]=function(_0x1d27ba,_0x2e7d9f){_0x1d27ba[_0x824e('0x24')]['ip']=_0x1d27ba[_0x824e('0x25')][_0x824e('0x26')]||_0x1d27ba[_0x824e('0x27')][_0x824e('0x28')]||_0x1d27ba['socket'][_0x824e('0x28')]||_0x1d27ba[_0x824e('0x27')][_0x824e('0x29')]['remoteAddress'];return openIssue(_0x1d27ba[_0x824e('0x24')],_0x2e7d9f);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 84c9263..3bd7584 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 _0x5ff3=['/:id','post','create','put','update','destroy','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyAnswerReport.controller','get','isAuthenticated','index'];(function(_0x1a7c8c,_0x419397){var _0x542dac=function(_0x4c6d1f){while(--_0x4c6d1f){_0x1a7c8c['push'](_0x1a7c8c['shift']());}};_0x542dac(++_0x419397);}(_0x5ff3,0x17d));var _0x35ff=function(_0xb55998,_0x57f17b){_0xb55998=_0xb55998-0x0;var _0x17a289=_0x5ff3[_0xb55998];return _0x17a289;};'use strict';var multer=require('multer');var util=require(_0x35ff('0x0'));var path=require('path');var timeout=require(_0x35ff('0x1'));var express=require('express');var router=express[_0x35ff('0x2')]();var fs_extra=require(_0x35ff('0x3'));var auth=require(_0x35ff('0x4'));var interaction=require(_0x35ff('0x5'));var config=require('../../config/environment');var controller=require(_0x35ff('0x6'));router[_0x35ff('0x7')]('/',auth[_0x35ff('0x8')](),controller[_0x35ff('0x9')]);router[_0x35ff('0x7')]('/describe',auth[_0x35ff('0x8')](),controller['describe']);router[_0x35ff('0x7')](_0x35ff('0xa'),auth[_0x35ff('0x8')](),controller['show']);router[_0x35ff('0xb')]('/',auth['isAuthenticated'](),controller[_0x35ff('0xc')]);router[_0x35ff('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x35ff('0xe')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x35ff('0xf')]);module[_0x35ff('0x10')]=router; \ No newline at end of file +var _0xcb91=['get','index','isAuthenticated','describe','/:id','post','create','put','update','delete','destroy','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./jscriptyAnswerReport.controller'];(function(_0xcd9444,_0x411ed8){var _0x55105e=function(_0x1632eb){while(--_0x1632eb){_0xcd9444['push'](_0xcd9444['shift']());}};_0x55105e(++_0x411ed8);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x15797a,_0x16274f){_0x15797a=_0x15797a-0x0;var _0x3e2618=_0xcb91[_0x15797a];return _0x3e2618;};'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');var controller=require(_0x1cb9('0x6'));router[_0x1cb9('0x7')]('/',auth['isAuthenticated'](),controller[_0x1cb9('0x8')]);router[_0x1cb9('0x7')]('/describe',auth[_0x1cb9('0x9')](),controller[_0x1cb9('0xa')]);router['get'](_0x1cb9('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x1cb9('0xc')]('/',auth[_0x1cb9('0x9')](),controller[_0x1cb9('0xd')]);router[_0x1cb9('0xe')](_0x1cb9('0xb'),auth['isAuthenticated'](),controller[_0x1cb9('0xf')]);router[_0x1cb9('0x10')](_0x1cb9('0xb'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 034ceea..2203b68 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(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x7a54,0x106));var _0x47a5=function(_0xcba1d2,_0x4e170d){_0xcba1d2=_0xcba1d2-0x0;var _0x24d6e9=_0x7a54[_0xcba1d2];return _0x24d6e9;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'question':{'type':Sequelize[_0x47a5('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x47a5('0x3'))},'membername':{'type':Sequelize[_0x47a5('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x47a5('0x4')]},'uniqueid':{'type':Sequelize[_0x47a5('0x4')]},'calleridname':{'type':Sequelize[_0x47a5('0x4')]},'calleridnum':{'type':Sequelize[_0x47a5('0x4')]},'questionId':{'type':Sequelize[_0x47a5('0x4')]}}; \ No newline at end of file +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(_0x528ddb,_0xe4892f){_0x528ddb=_0x528ddb-0x0;var _0x22e4f9=_0x7a54[_0x528ddb];return _0x22e4f9;};'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 a20aa8d..d2bbea7 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 _0xbacd=['../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','apply','reject','update','then','destroy','error','stack','name','send','index','map','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','options','JscriptyAnswerReport','includeAll','include','findAll','rows','catch','show','params','merge','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs'];(function(_0xa63c7e,_0x2b8b9e){var _0x536a27=function(_0x35d05c){while(--_0x35d05c){_0xa63c7e['push'](_0xa63c7e['shift']());}};_0x536a27(++_0x2b8b9e);}(_0xbacd,0x1c5));var _0xdbac=function(_0xc418fc,_0x19bb95){_0xc418fc=_0xc418fc-0x0;var _0x2b137c=_0xbacd[_0xc418fc];return _0x2b137c;};'use strict';var emlformat=require(_0xdbac('0x0'));var rimraf=require(_0xdbac('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdbac('0x2'));var rp=require(_0xdbac('0x3'));var moment=require(_0xdbac('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xdbac('0x5'));var util=require(_0xdbac('0x6'));var path=require(_0xdbac('0x7'));var sox=require(_0xdbac('0x8'));var csv=require(_0xdbac('0x9'));var ejs=require(_0xdbac('0xa'));var fs=require('fs');var fs_extra=require(_0xdbac('0xb'));var _=require(_0xdbac('0xc'));var squel=require(_0xdbac('0xd'));var crypto=require(_0xdbac('0xe'));var jsforce=require(_0xdbac('0xf'));var deskjs=require(_0xdbac('0x10'));var toCsv=require(_0xdbac('0x9'));var querystring=require(_0xdbac('0x11'));var Papa=require(_0xdbac('0x12'));var Redis=require('ioredis');var authService=require(_0xdbac('0x13'));var qs=require(_0xdbac('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdbac('0x15'));var logger=require('../../config/logger')(_0xdbac('0x16'));var utils=require(_0xdbac('0x17'));var config=require(_0xdbac('0x18'));var licenseUtil=require(_0xdbac('0x19'));var db=require(_0xdbac('0x1a'))['db'];function respondWithStatusCode(_0x1ebee0,_0xd9ec70){_0xd9ec70=_0xd9ec70||0xcc;return function(_0x2c7f44){if(_0x2c7f44){return _0x1ebee0[_0xdbac('0x1b')](_0xd9ec70);}return _0x1ebee0['status'](_0xd9ec70)[_0xdbac('0x1c')]();};}function respondWithResult(_0x1793b9,_0x1eed36){_0x1eed36=_0x1eed36||0xc8;return function(_0x14ebaa){if(_0x14ebaa){return _0x1793b9[_0xdbac('0x1d')](_0x1eed36)[_0xdbac('0x1e')](_0x14ebaa);}};}function respondWithFilteredResult(_0x94a61,_0x176da6){return function(_0x574e58){if(_0x574e58){var _0x2694ef=typeof _0x176da6[_0xdbac('0x1f')]===_0xdbac('0x20')&&typeof _0x176da6['limit']===_0xdbac('0x20');var _0x36e0de=_0x574e58[_0xdbac('0x21')];var _0x252fc1=_0x2694ef?0x0:_0x176da6[_0xdbac('0x1f')];var _0x1a9690=_0x2694ef?_0x574e58[_0xdbac('0x21')]:_0x176da6[_0xdbac('0x1f')]+_0x176da6[_0xdbac('0x22')];var _0x1301d2;if(_0x1a9690>=_0x36e0de){_0x1a9690=_0x36e0de;_0x1301d2=0xc8;}else{_0x1301d2=0xce;}_0x94a61[_0xdbac('0x1d')](_0x1301d2);return _0x94a61[_0xdbac('0x23')]('Content-Range',_0x252fc1+'-'+_0x1a9690+'/'+_0x36e0de)[_0xdbac('0x1e')](_0x574e58);}return null;};}function patchUpdates(_0x323801){return function(_0x4e4af9){try{jsonpatch[_0xdbac('0x24')](_0x4e4af9,_0x323801,!![]);}catch(_0x582c0b){return BPromise[_0xdbac('0x25')](_0x582c0b);}return _0x4e4af9['save']();};}function saveUpdates(_0x1ead7b,_0x2bcf69){return function(_0x20642c){if(_0x20642c){return _0x20642c[_0xdbac('0x26')](_0x1ead7b)[_0xdbac('0x27')](function(_0x4148fc){return _0x4148fc;});}return null;};}function removeEntity(_0x28393a,_0x4e68b0){return function(_0x361930){if(_0x361930){return _0x361930[_0xdbac('0x28')]()[_0xdbac('0x27')](function(){_0x28393a[_0xdbac('0x1d')](0xcc)[_0xdbac('0x1c')]();});}};}function handleEntityNotFound(_0x2b4cda,_0x3a0f3f){return function(_0x15653d){if(!_0x15653d){_0x2b4cda[_0xdbac('0x1b')](0x194);}return _0x15653d;};}function handleError(_0x175ebc,_0x2cb8b4){_0x2cb8b4=_0x2cb8b4||0x1f4;return function(_0x1ea3c3){logger[_0xdbac('0x29')](_0x1ea3c3[_0xdbac('0x2a')]);if(_0x1ea3c3[_0xdbac('0x2b')]){delete _0x1ea3c3[_0xdbac('0x2b')];}_0x175ebc[_0xdbac('0x1d')](_0x2cb8b4)[_0xdbac('0x2c')](_0x1ea3c3);};}exports[_0xdbac('0x2d')]=function(_0xe744cc,_0x1caa18){var _0x4e7ef9={},_0x446a32={},_0x397f3d={'count':0x0,'rows':[]};var _0x43c0a3=_[_0xdbac('0x2e')](db['JscriptyAnswerReport']['rawAttributes'],function(_0x10c3c8){return{'name':_0x10c3c8[_0xdbac('0x2f')],'type':_0x10c3c8[_0xdbac('0x30')][_0xdbac('0x31')]};});_0x446a32['model']=_[_0xdbac('0x2e')](_0x43c0a3,_0xdbac('0x2b'));_0x446a32[_0xdbac('0x32')]=_[_0xdbac('0x33')](_0xe744cc[_0xdbac('0x32')]);_0x446a32[_0xdbac('0x34')]=_[_0xdbac('0x35')](_0x446a32[_0xdbac('0x36')],_0x446a32['query']);_0x4e7ef9['attributes']=_[_0xdbac('0x35')](_0x446a32[_0xdbac('0x36')],qs[_0xdbac('0x37')](_0xe744cc[_0xdbac('0x32')]['fields']));_0x4e7ef9['attributes']=_0x4e7ef9[_0xdbac('0x38')][_0xdbac('0x39')]?_0x4e7ef9[_0xdbac('0x38')]:_0x446a32[_0xdbac('0x36')];if(!_0xe744cc[_0xdbac('0x32')][_0xdbac('0x3a')](_0xdbac('0x3b'))){_0x4e7ef9[_0xdbac('0x22')]=qs[_0xdbac('0x22')](_0xe744cc[_0xdbac('0x32')][_0xdbac('0x22')]);_0x4e7ef9[_0xdbac('0x1f')]=qs[_0xdbac('0x1f')](_0xe744cc['query'][_0xdbac('0x1f')]);}_0x4e7ef9['order']=qs[_0xdbac('0x3c')](_0xe744cc[_0xdbac('0x32')][_0xdbac('0x3c')]);_0x4e7ef9[_0xdbac('0x3d')]=qs['filters'](_[_0xdbac('0x3e')](_0xe744cc[_0xdbac('0x32')],_0x446a32['filters']),_0x43c0a3);if(_0xe744cc['query'][_0xdbac('0x3f')]){_0x4e7ef9['where']=_['merge'](_0x4e7ef9[_0xdbac('0x3d')],{'$or':_[_0xdbac('0x2e')](_0x43c0a3,function(_0x6c5ecc){if(_0x6c5ecc['type']!==_0xdbac('0x40')){var _0x35f8b7={};_0x35f8b7[_0x6c5ecc[_0xdbac('0x2b')]]={'$like':'%'+_0xe744cc[_0xdbac('0x32')]['filter']+'%'};return _0x35f8b7;}})});}_0x4e7ef9=_['merge']({},_0x4e7ef9,_0xe744cc[_0xdbac('0x41')]);var _0x124904={'where':_0x4e7ef9[_0xdbac('0x3d')]};return db[_0xdbac('0x42')][_0xdbac('0x21')](_0x124904)['then'](function(_0x1a27a4){_0x397f3d[_0xdbac('0x21')]=_0x1a27a4;if(_0xe744cc['query'][_0xdbac('0x43')]){_0x4e7ef9[_0xdbac('0x44')]=[{'all':!![]}];}return db[_0xdbac('0x42')][_0xdbac('0x45')](_0x4e7ef9);})[_0xdbac('0x27')](function(_0x575b59){_0x397f3d[_0xdbac('0x46')]=_0x575b59;return _0x397f3d;})[_0xdbac('0x27')](respondWithFilteredResult(_0x1caa18,_0x4e7ef9))[_0xdbac('0x47')](handleError(_0x1caa18,null));};exports[_0xdbac('0x48')]=function(_0x726ba4,_0x25344a){var _0x2589e1={'raw':!![],'where':{'id':_0x726ba4[_0xdbac('0x49')]['id']}},_0x3c1894={};_0x3c1894[_0xdbac('0x36')]=_[_0xdbac('0x33')](db[_0xdbac('0x42')]['rawAttributes']);_0x3c1894['query']=_['keys'](_0x726ba4['query']);_0x3c1894[_0xdbac('0x34')]=_[_0xdbac('0x35')](_0x3c1894[_0xdbac('0x36')],_0x3c1894[_0xdbac('0x32')]);_0x2589e1[_0xdbac('0x38')]=_[_0xdbac('0x35')](_0x3c1894[_0xdbac('0x36')],qs[_0xdbac('0x37')](_0x726ba4[_0xdbac('0x32')]['fields']));_0x2589e1['attributes']=_0x2589e1['attributes'][_0xdbac('0x39')]?_0x2589e1[_0xdbac('0x38')]:_0x3c1894['model'];if(_0x726ba4['query']['includeAll']){_0x2589e1[_0xdbac('0x44')]=[{'all':!![]}];}_0x2589e1=_[_0xdbac('0x4a')]({},_0x2589e1,_0x726ba4[_0xdbac('0x41')]);return db['JscriptyAnswerReport'][_0xdbac('0x4b')](_0x2589e1)[_0xdbac('0x27')](handleEntityNotFound(_0x25344a,null))[_0xdbac('0x27')](respondWithResult(_0x25344a,null))[_0xdbac('0x47')](handleError(_0x25344a,null));};exports[_0xdbac('0x4c')]=function(_0x5b8aca,_0x35696f){return db[_0xdbac('0x42')][_0xdbac('0x4c')](_0x5b8aca[_0xdbac('0x4d')],{})['then'](respondWithResult(_0x35696f,0xc9))[_0xdbac('0x47')](handleError(_0x35696f,null));};exports[_0xdbac('0x26')]=function(_0x1463ca,_0x5d6e86){if(_0x1463ca[_0xdbac('0x4d')]['id']){delete _0x1463ca[_0xdbac('0x4d')]['id'];}return db[_0xdbac('0x42')][_0xdbac('0x4b')]({'where':{'id':_0x1463ca[_0xdbac('0x49')]['id']}})[_0xdbac('0x27')](handleEntityNotFound(_0x5d6e86,null))['then'](saveUpdates(_0x1463ca[_0xdbac('0x4d')],null))[_0xdbac('0x27')](respondWithResult(_0x5d6e86,null))['catch'](handleError(_0x5d6e86,null));};exports[_0xdbac('0x28')]=function(_0x12b600,_0x26ee2e){return db[_0xdbac('0x42')]['find']({'where':{'id':_0x12b600['params']['id']}})[_0xdbac('0x27')](handleEntityNotFound(_0x26ee2e,null))[_0xdbac('0x27')](removeEntity(_0x26ee2e,null))['catch'](handleError(_0x26ee2e,null));};exports['describe']=function(_0x3f0b35,_0x538747){return db[_0xdbac('0x42')][_0xdbac('0x4e')]()[_0xdbac('0x27')](respondWithResult(_0x538747,null))['catch'](handleError(_0x538747,null));}; \ No newline at end of file +var _0xe14b=['rimraf','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','json','apply','save','update','then','error','stack','name','send','map','JscriptyAnswerReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','destroy','describe','eml-format'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xe14b,0x93));var _0xbe14=function(_0x513642,_0x909c7b){_0x513642=_0x513642-0x0;var _0x2b12aa=_0xe14b[_0x513642];return _0x2b12aa;};'use strict';var emlformat=require(_0xbe14('0x0'));var rimraf=require(_0xbe14('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xbe14('0x2'));var moment=require(_0xbe14('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xbe14('0x4'));var util=require('util');var path=require('path');var sox=require(_0xbe14('0x5'));var csv=require(_0xbe14('0x6'));var ejs=require(_0xbe14('0x7'));var fs=require('fs');var fs_extra=require(_0xbe14('0x8'));var _=require(_0xbe14('0x9'));var squel=require(_0xbe14('0xa'));var crypto=require(_0xbe14('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbe14('0xc'));var Papa=require(_0xbe14('0xd'));var Redis=require(_0xbe14('0xe'));var authService=require(_0xbe14('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbe14('0x10'));var logger=require(_0xbe14('0x11'))('api');var utils=require(_0xbe14('0x12'));var config=require(_0xbe14('0x13'));var licenseUtil=require(_0xbe14('0x14'));var db=require(_0xbe14('0x15'))['db'];function respondWithStatusCode(_0x27792f,_0x3b898d){_0x3b898d=_0x3b898d||0xcc;return function(_0x23a730){if(_0x23a730){return _0x27792f[_0xbe14('0x16')](_0x3b898d);}return _0x27792f[_0xbe14('0x17')](_0x3b898d)[_0xbe14('0x18')]();};}function respondWithResult(_0x1e4826,_0x33fd54){_0x33fd54=_0x33fd54||0xc8;return function(_0x813399){if(_0x813399){return _0x1e4826['status'](_0x33fd54)['json'](_0x813399);}};}function respondWithFilteredResult(_0x3f58f5,_0x3dc4a9){return function(_0xf4ac9){if(_0xf4ac9){var _0x37ce4e=typeof _0x3dc4a9['offset']===_0xbe14('0x19')&&typeof _0x3dc4a9[_0xbe14('0x1a')]===_0xbe14('0x19');var _0x123ede=_0xf4ac9[_0xbe14('0x1b')];var _0x29ab73=_0x37ce4e?0x0:_0x3dc4a9[_0xbe14('0x1c')];var _0x5ea1f8=_0x37ce4e?_0xf4ac9[_0xbe14('0x1b')]:_0x3dc4a9[_0xbe14('0x1c')]+_0x3dc4a9[_0xbe14('0x1a')];var _0x433459;if(_0x5ea1f8>=_0x123ede){_0x5ea1f8=_0x123ede;_0x433459=0xc8;}else{_0x433459=0xce;}_0x3f58f5[_0xbe14('0x17')](_0x433459);return _0x3f58f5[_0xbe14('0x1d')]('Content-Range',_0x29ab73+'-'+_0x5ea1f8+'/'+_0x123ede)[_0xbe14('0x1e')](_0xf4ac9);}return null;};}function patchUpdates(_0x4a1bbd){return function(_0x417c8d){try{jsonpatch[_0xbe14('0x1f')](_0x417c8d,_0x4a1bbd,!![]);}catch(_0x188ec4){return BPromise['reject'](_0x188ec4);}return _0x417c8d[_0xbe14('0x20')]();};}function saveUpdates(_0x56d845,_0x3c1c85){return function(_0x56e80c){if(_0x56e80c){return _0x56e80c[_0xbe14('0x21')](_0x56d845)['then'](function(_0x274018){return _0x274018;});}return null;};}function removeEntity(_0x3d3608,_0x505dbd){return function(_0x2da350){if(_0x2da350){return _0x2da350['destroy']()[_0xbe14('0x22')](function(){_0x3d3608['status'](0xcc)[_0xbe14('0x18')]();});}};}function handleEntityNotFound(_0x5fa043,_0x1ee9c1){return function(_0x39cc81){if(!_0x39cc81){_0x5fa043[_0xbe14('0x16')](0x194);}return _0x39cc81;};}function handleError(_0x2703f5,_0x55d001){_0x55d001=_0x55d001||0x1f4;return function(_0x1822e0){logger[_0xbe14('0x23')](_0x1822e0[_0xbe14('0x24')]);if(_0x1822e0[_0xbe14('0x25')]){delete _0x1822e0['name'];}_0x2703f5[_0xbe14('0x17')](_0x55d001)[_0xbe14('0x26')](_0x1822e0);};}exports['index']=function(_0x3c3613,_0x3b3e84){var _0x1c7cc7={},_0x19252f={},_0x34d648={'count':0x0,'rows':[]};var _0x36d4b2=_[_0xbe14('0x27')](db[_0xbe14('0x28')][_0xbe14('0x29')],function(_0x16a159){return{'name':_0x16a159[_0xbe14('0x2a')],'type':_0x16a159[_0xbe14('0x2b')][_0xbe14('0x2c')]};});_0x19252f[_0xbe14('0x2d')]=_[_0xbe14('0x27')](_0x36d4b2,_0xbe14('0x25'));_0x19252f[_0xbe14('0x2e')]=_[_0xbe14('0x2f')](_0x3c3613[_0xbe14('0x2e')]);_0x19252f[_0xbe14('0x30')]=_['intersection'](_0x19252f[_0xbe14('0x2d')],_0x19252f['query']);_0x1c7cc7['attributes']=_[_0xbe14('0x31')](_0x19252f['model'],qs[_0xbe14('0x32')](_0x3c3613[_0xbe14('0x2e')]['fields']));_0x1c7cc7['attributes']=_0x1c7cc7['attributes'][_0xbe14('0x33')]?_0x1c7cc7[_0xbe14('0x34')]:_0x19252f['model'];if(!_0x3c3613[_0xbe14('0x2e')][_0xbe14('0x35')](_0xbe14('0x36'))){_0x1c7cc7[_0xbe14('0x1a')]=qs[_0xbe14('0x1a')](_0x3c3613['query']['limit']);_0x1c7cc7[_0xbe14('0x1c')]=qs['offset'](_0x3c3613['query']['offset']);}_0x1c7cc7[_0xbe14('0x37')]=qs[_0xbe14('0x38')](_0x3c3613[_0xbe14('0x2e')][_0xbe14('0x38')]);_0x1c7cc7[_0xbe14('0x39')]=qs[_0xbe14('0x30')](_[_0xbe14('0x3a')](_0x3c3613[_0xbe14('0x2e')],_0x19252f[_0xbe14('0x30')]),_0x36d4b2);if(_0x3c3613[_0xbe14('0x2e')][_0xbe14('0x3b')]){_0x1c7cc7[_0xbe14('0x39')]=_['merge'](_0x1c7cc7['where'],{'$or':_[_0xbe14('0x27')](_0x36d4b2,function(_0x2951e1){if(_0x2951e1[_0xbe14('0x2b')]!=='VIRTUAL'){var _0x326329={};_0x326329[_0x2951e1[_0xbe14('0x25')]]={'$like':'%'+_0x3c3613[_0xbe14('0x2e')][_0xbe14('0x3b')]+'%'};return _0x326329;}})});}_0x1c7cc7=_[_0xbe14('0x3c')]({},_0x1c7cc7,_0x3c3613[_0xbe14('0x3d')]);var _0x19fa30={'where':_0x1c7cc7[_0xbe14('0x39')]};return db[_0xbe14('0x28')]['count'](_0x19fa30)[_0xbe14('0x22')](function(_0x841b71){_0x34d648[_0xbe14('0x1b')]=_0x841b71;if(_0x3c3613[_0xbe14('0x2e')][_0xbe14('0x3e')]){_0x1c7cc7[_0xbe14('0x3f')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0xbe14('0x40')](_0x1c7cc7);})[_0xbe14('0x22')](function(_0x1220c9){_0x34d648[_0xbe14('0x41')]=_0x1220c9;return _0x34d648;})['then'](respondWithFilteredResult(_0x3b3e84,_0x1c7cc7))['catch'](handleError(_0x3b3e84,null));};exports[_0xbe14('0x42')]=function(_0xe417b,_0x3272ae){var _0x51c859={'raw':!![],'where':{'id':_0xe417b[_0xbe14('0x43')]['id']}},_0x5d5318={};_0x5d5318['model']=_['keys'](db[_0xbe14('0x28')][_0xbe14('0x29')]);_0x5d5318[_0xbe14('0x2e')]=_['keys'](_0xe417b['query']);_0x5d5318['filters']=_[_0xbe14('0x31')](_0x5d5318[_0xbe14('0x2d')],_0x5d5318[_0xbe14('0x2e')]);_0x51c859['attributes']=_[_0xbe14('0x31')](_0x5d5318[_0xbe14('0x2d')],qs[_0xbe14('0x32')](_0xe417b[_0xbe14('0x2e')]['fields']));_0x51c859['attributes']=_0x51c859[_0xbe14('0x34')][_0xbe14('0x33')]?_0x51c859[_0xbe14('0x34')]:_0x5d5318[_0xbe14('0x2d')];if(_0xe417b[_0xbe14('0x2e')]['includeAll']){_0x51c859['include']=[{'all':!![]}];}_0x51c859=_[_0xbe14('0x3c')]({},_0x51c859,_0xe417b[_0xbe14('0x3d')]);return db[_0xbe14('0x28')][_0xbe14('0x44')](_0x51c859)['then'](handleEntityNotFound(_0x3272ae,null))[_0xbe14('0x22')](respondWithResult(_0x3272ae,null))[_0xbe14('0x45')](handleError(_0x3272ae,null));};exports['create']=function(_0x396e40,_0x2a35e5){return db[_0xbe14('0x28')][_0xbe14('0x46')](_0x396e40['body'],{})['then'](respondWithResult(_0x2a35e5,0xc9))[_0xbe14('0x45')](handleError(_0x2a35e5,null));};exports[_0xbe14('0x21')]=function(_0x4a1a37,_0x5acf90){if(_0x4a1a37[_0xbe14('0x47')]['id']){delete _0x4a1a37[_0xbe14('0x47')]['id'];}return db[_0xbe14('0x28')][_0xbe14('0x44')]({'where':{'id':_0x4a1a37[_0xbe14('0x43')]['id']}})[_0xbe14('0x22')](handleEntityNotFound(_0x5acf90,null))[_0xbe14('0x22')](saveUpdates(_0x4a1a37['body'],null))[_0xbe14('0x22')](respondWithResult(_0x5acf90,null))[_0xbe14('0x45')](handleError(_0x5acf90,null));};exports[_0xbe14('0x48')]=function(_0x22b1f8,_0x2fc073){return db['JscriptyAnswerReport'][_0xbe14('0x44')]({'where':{'id':_0x22b1f8[_0xbe14('0x43')]['id']}})[_0xbe14('0x22')](handleEntityNotFound(_0x2fc073,null))[_0xbe14('0x22')](removeEntity(_0x2fc073,null))[_0xbe14('0x45')](handleError(_0x2fc073,null));};exports[_0xbe14('0x49')]=function(_0x505829,_0x5aeea9){return db[_0xbe14('0x28')][_0xbe14('0x49')]()[_0xbe14('0x22')](respondWithResult(_0x5aeea9,null))['catch'](handleError(_0x5aeea9,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index a5c4690..7568a1d 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 _0xac8c=['path','rimraf','./jscriptyAnswerReport.attributes','exports','JscriptyAnswerReport','report_jscripty_answers','lodash','util','moment','bluebird','request-promise'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0xac8c,0x1b3));var _0xcac8=function(_0x5224ba,_0x3fb4e1){_0x5224ba=_0x5224ba-0x0;var _0x459bd2=_0xac8c[_0x5224ba];return _0x459bd2;};'use strict';var _=require(_0xcac8('0x0'));var util=require(_0xcac8('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xcac8('0x2'));var BPromise=require(_0xcac8('0x3'));var rp=require(_0xcac8('0x4'));var fs=require('fs');var path=require(_0xcac8('0x5'));var rimraf=require(_0xcac8('0x6'));var config=require('../../config/environment');var attributes=require(_0xcac8('0x7'));module[_0xcac8('0x8')]=function(_0x50a2e5,_0x53ea85){return _0x50a2e5['define'](_0xcac8('0x9'),attributes,{'tableName':_0xcac8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x29fe=['../../config/environment','./jscriptyAnswerReport.attributes','define','JscriptyAnswerReport','report_jscripty_answers','util','moment','rimraf'];(function(_0x49f8c2,_0x5166b7){var _0x3e63ec=function(_0x575c26){while(--_0x575c26){_0x49f8c2['push'](_0x49f8c2['shift']());}};_0x3e63ec(++_0x5166b7);}(_0x29fe,0x1bd));var _0xe29f=function(_0x57cf62,_0x3dbbef){_0x57cf62=_0x57cf62-0x0;var _0x1b8f4e=_0x29fe[_0x57cf62];return _0x1b8f4e;};'use strict';var _=require('lodash');var util=require(_0xe29f('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xe29f('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xe29f('0x2'));var config=require(_0xe29f('0x3'));var attributes=require(_0xe29f('0x4'));module['exports']=function(_0x2b8b82,_0x591655){return _0x2b8b82[_0xe29f('0x5')](_0xe29f('0x6'),attributes,{'tableName':_0xe29f('0x7'),'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 59dfdad..8c54114 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 _0x57cc=['jayson/promise','client','http','request','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x29e8e8,_0x5813cd){var _0xcb01bb=function(_0x480047){while(--_0x480047){_0x29e8e8['push'](_0x29e8e8['shift']());}};_0xcb01bb(++_0x5813cd);}(_0x57cc,0x15f));var _0xc57c=function(_0x817d9b,_0x3c37e3){_0x817d9b=_0x817d9b-0x0;var _0x2752e1=_0x57cc[_0x817d9b];return _0x2752e1;};'use strict';var _=require(_0xc57c('0x0'));var util=require(_0xc57c('0x1'));var moment=require(_0xc57c('0x2'));var BPromise=require('bluebird');var rs=require(_0xc57c('0x3'));var fs=require('fs');var Redis=require(_0xc57c('0x4'));var db=require(_0xc57c('0x5'))['db'];var utils=require(_0xc57c('0x6'));var logger=require(_0xc57c('0x7'))('rpc');var config=require(_0xc57c('0x8'));var jayson=require(_0xc57c('0x9'));var client=jayson[_0xc57c('0xa')][_0xc57c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x355427,_0x27577b,_0x52abdf){return new BPromise(function(_0x1762eb,_0xc9417f){return client[_0xc57c('0xc')](_0x355427,_0x52abdf)['then'](function(_0x467be4){logger['info'](_0xc57c('0xd'),_0x27577b,_0xc57c('0xe'));logger[_0xc57c('0xf')](_0xc57c('0x10'),_0x27577b,_0xc57c('0xe'),JSON[_0xc57c('0x11')](_0x467be4));if(_0x467be4[_0xc57c('0x12')]){if(_0x467be4[_0xc57c('0x12')][_0xc57c('0x13')]===0x1f4){logger[_0xc57c('0x12')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x27577b,_0x467be4['error'][_0xc57c('0x14')]);return _0xc9417f(_0x467be4[_0xc57c('0x12')][_0xc57c('0x14')]);}logger[_0xc57c('0x12')](_0xc57c('0xd'),_0x27577b,_0x467be4['error'][_0xc57c('0x14')]);return _0x1762eb(_0x467be4[_0xc57c('0x12')]['message']);}else{logger[_0xc57c('0x15')](_0xc57c('0xd'),_0x27577b,'request\x20sent');_0x1762eb(_0x467be4[_0xc57c('0x16')][_0xc57c('0x14')]);}})[_0xc57c('0x17')](function(_0x3c80e7){logger[_0xc57c('0x12')](_0xc57c('0xd'),_0x27577b,_0x3c80e7);_0xc9417f(_0x3c80e7);});});} \ No newline at end of file +var _0x6fe2=['result','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x35e124,_0x1d85e2){var _0x53c482=function(_0x5afd39){while(--_0x5afd39){_0x35e124['push'](_0x35e124['shift']());}};_0x53c482(++_0x1d85e2);}(_0x6fe2,0x1cf));var _0x26fe=function(_0x15c0ea,_0x4acfaa){_0x15c0ea=_0x15c0ea-0x0;var _0x306627=_0x6fe2[_0x15c0ea];return _0x306627;};'use strict';var _=require(_0x26fe('0x0'));var util=require(_0x26fe('0x1'));var moment=require(_0x26fe('0x2'));var BPromise=require('bluebird');var rs=require(_0x26fe('0x3'));var fs=require('fs');var Redis=require(_0x26fe('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x26fe('0x5'));var logger=require(_0x26fe('0x6'))(_0x26fe('0x7'));var config=require(_0x26fe('0x8'));var jayson=require(_0x26fe('0x9'));var client=jayson['client'][_0x26fe('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x422423,_0x56f7e9,_0xdd4420){return new BPromise(function(_0x4b07f,_0x2a914b){return client['request'](_0x422423,_0xdd4420)[_0x26fe('0xb')](function(_0x2dc781){logger[_0x26fe('0xc')](_0x26fe('0xd'),_0x56f7e9,_0x26fe('0xe'));logger[_0x26fe('0xf')](_0x26fe('0x10'),_0x56f7e9,_0x26fe('0xe'),JSON[_0x26fe('0x11')](_0x2dc781));if(_0x2dc781[_0x26fe('0x12')]){if(_0x2dc781[_0x26fe('0x12')][_0x26fe('0x13')]===0x1f4){logger['error']('JscriptyAnswerReport,\x20%s,\x20%s',_0x56f7e9,_0x2dc781[_0x26fe('0x12')][_0x26fe('0x14')]);return _0x2a914b(_0x2dc781[_0x26fe('0x12')][_0x26fe('0x14')]);}logger[_0x26fe('0x12')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x56f7e9,_0x2dc781['error'][_0x26fe('0x14')]);return _0x4b07f(_0x2dc781['error']['message']);}else{logger[_0x26fe('0xc')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x56f7e9,_0x26fe('0xe'));_0x4b07f(_0x2dc781[_0x26fe('0x15')][_0x26fe('0x14')]);}})['catch'](function(_0x9f7038){logger[_0x26fe('0x12')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x56f7e9,_0x9f7038);_0x2a914b(_0x9f7038);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index e2a4fa0..153a004 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 _0xb5c0=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./jscriptyProject.controller','get','isAuthenticated','index','show','getSessions','/:id/answers','getAnswers','/:id/summary','getSummary','post','/:id/clone','clone','put','/:id','update','delete'];(function(_0x51085f,_0x1cb2f0){var _0x455c86=function(_0x1eae65){while(--_0x1eae65){_0x51085f['push'](_0x51085f['shift']());}};_0x455c86(++_0x1cb2f0);}(_0xb5c0,0x113));var _0x0b5c=function(_0x925f25,_0x20b4ee){_0x925f25=_0x925f25-0x0;var _0x3d0ded=_0xb5c0[_0x925f25];return _0x3d0ded;};'use strict';var multer=require(_0x0b5c('0x0'));var util=require(_0x0b5c('0x1'));var path=require(_0x0b5c('0x2'));var timeout=require(_0x0b5c('0x3'));var express=require(_0x0b5c('0x4'));var router=express[_0x0b5c('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x0b5c('0x6'));var interaction=require(_0x0b5c('0x7'));var config=require('../../config/environment');var controller=require(_0x0b5c('0x8'));router[_0x0b5c('0x9')]('/',auth[_0x0b5c('0xa')](),controller[_0x0b5c('0xb')]);router[_0x0b5c('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x0b5c('0xc')]);router[_0x0b5c('0x9')]('/:id/sessions',auth['isAuthenticated'](),controller[_0x0b5c('0xd')]);router['get'](_0x0b5c('0xe'),auth[_0x0b5c('0xa')](),controller[_0x0b5c('0xf')]);router['get'](_0x0b5c('0x10'),auth['isAuthenticated'](),timeout('30s'),controller[_0x0b5c('0x11')]);router['post']('/',auth[_0x0b5c('0xa')](),controller['create']);router[_0x0b5c('0x12')](_0x0b5c('0x13'),auth[_0x0b5c('0xa')](),controller[_0x0b5c('0x14')]);router[_0x0b5c('0x15')](_0x0b5c('0x16'),auth['isAuthenticated'](),controller[_0x0b5c('0x17')]);router[_0x0b5c('0x18')](_0x0b5c('0x16'),auth[_0x0b5c('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x3f66=['isAuthenticated','/:id','show','/:id/sessions','/:id/answers','/:id/summary','getSummary','post','/:id/clone','clone','put','update','delete','destroy','exports','multer','util','express','Router','fs-extra','../../config/environment','./jscriptyProject.controller','get'];(function(_0x41fb20,_0x489030){var _0x5bd281=function(_0x34b068){while(--_0x34b068){_0x41fb20['push'](_0x41fb20['shift']());}};_0x5bd281(++_0x489030);}(_0x3f66,0xb0));var _0x63f6=function(_0x57855a,_0x147826){_0x57855a=_0x57855a-0x0;var _0x32dca3=_0x3f66[_0x57855a];return _0x32dca3;};'use strict';var multer=require(_0x63f6('0x0'));var util=require(_0x63f6('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x63f6('0x2'));var router=express[_0x63f6('0x3')]();var fs_extra=require(_0x63f6('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x63f6('0x5'));var controller=require(_0x63f6('0x6'));router[_0x63f6('0x7')]('/',auth[_0x63f6('0x8')](),controller['index']);router[_0x63f6('0x7')](_0x63f6('0x9'),auth[_0x63f6('0x8')](),controller[_0x63f6('0xa')]);router[_0x63f6('0x7')](_0x63f6('0xb'),auth[_0x63f6('0x8')](),controller['getSessions']);router[_0x63f6('0x7')](_0x63f6('0xc'),auth['isAuthenticated'](),controller['getAnswers']);router[_0x63f6('0x7')](_0x63f6('0xd'),auth[_0x63f6('0x8')](),timeout('30s'),controller[_0x63f6('0xe')]);router[_0x63f6('0xf')]('/',auth[_0x63f6('0x8')](),controller['create']);router[_0x63f6('0xf')](_0x63f6('0x10'),auth['isAuthenticated'](),controller[_0x63f6('0x11')]);router[_0x63f6('0x12')](_0x63f6('0x9'),auth[_0x63f6('0x8')](),controller[_0x63f6('0x13')]);router[_0x63f6('0x14')](_0x63f6('0x9'),auth[_0x63f6('0x8')](),controller[_0x63f6('0x15')]);module[_0x63f6('0x16')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 0439efc..a0257d2 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 _0x2dd4=['isObjectLike','setDataValue','stringify','isString','formData','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','BOOLEAN','sequelize','lodash','util','exports','STRING','name','TEXT','long'];(function(_0x17ae70,_0x4c408b){var _0x44986f=function(_0x270cb2){while(--_0x270cb2){_0x17ae70['push'](_0x17ae70['shift']());}};_0x44986f(++_0x4c408b);}(_0x2dd4,0xe8));var _0x42dd=function(_0x121135,_0x2ebaa6){_0x121135=_0x121135-0x0;var _0x5a594a=_0x2dd4[_0x121135];return _0x5a594a;};'use strict';var Sequelize=require(_0x42dd('0x0'));var _=require(_0x42dd('0x1'));var util=require(_0x42dd('0x2'));module[_0x42dd('0x3')]={'name':{'type':Sequelize[_0x42dd('0x4')],'unique':_0x42dd('0x5')},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x42dd('0x6')](_0x42dd('0x7')),'set':function(_0x88371b){if(_[_0x42dd('0x8')](_0x88371b)){this[_0x42dd('0x9')]('formData',JSON[_0x42dd('0xa')](_0x88371b));}else if(_[_0x42dd('0xb')](_0x88371b)){this['setDataValue'](_0x42dd('0xc'),_0x88371b);}else{this[_0x42dd('0x9')]('formData',util[_0x42dd('0xd')](_0x42dd('0xe'),this['getDataValue'](_0x42dd('0x5'))||'',this['getDataValue']('description')||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x42dd('0xf')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x42dd('0xf')],'defaultValue':![]}}; \ No newline at end of file +var _0x1d4b=['STRING','name','TEXT','isObjectLike','setDataValue','formData','stringify','format','getDataValue','description','BOOLEAN','sequelize','util','exports'];(function(_0xb646a0,_0x229a9b){var _0x41bf90=function(_0xbb61a4){while(--_0xbb61a4){_0xb646a0['push'](_0xb646a0['shift']());}};_0x41bf90(++_0x229a9b);}(_0x1d4b,0x13f));var _0xb1d4=function(_0x2cd8a4,_0x51fb40){_0x2cd8a4=_0x2cd8a4-0x0;var _0x375630=_0x1d4b[_0x2cd8a4];return _0x375630;};'use strict';var Sequelize=require(_0xb1d4('0x0'));var _=require('lodash');var util=require(_0xb1d4('0x1'));module[_0xb1d4('0x2')]={'name':{'type':Sequelize[_0xb1d4('0x3')],'unique':_0xb1d4('0x4')},'description':{'type':Sequelize[_0xb1d4('0x3')]},'formData':{'type':Sequelize[_0xb1d4('0x5')]('long'),'set':function(_0x5b37c9){if(_[_0xb1d4('0x6')](_0x5b37c9)){this[_0xb1d4('0x7')](_0xb1d4('0x8'),JSON[_0xb1d4('0x9')](_0x5b37c9));}else if(_['isString'](_0x5b37c9)){this['setDataValue'](_0xb1d4('0x8'),_0x5b37c9);}else{this[_0xb1d4('0x7')](_0xb1d4('0x8'),util[_0xb1d4('0xa')]('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this[_0xb1d4('0xb')](_0xb1d4('0x4'))||'',this[_0xb1d4('0xb')](_0xb1d4('0xc'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xb1d4('0xd')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xb1d4('0xd')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index fd50804..da880b1 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 _0x8227=['undefined','limit','count','set','apply','save','update','then','destroy','get','UserProfileResource','sendStatus','error','stack','name','send','index','map','JscriptyProject','fieldName','type','keys','filters','intersection','model','attributes','fields','query','length','hasOwnProperty','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','rawAttributes','includeAll','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','body','Projects','autoAssociation','getSessions','findOne','JscriptySessionReport','nolimit','pick','getAnswers','JscriptyAnswerReport','order','ProjectId','number','fromCharCode','toString','indexOf','getSummary','startTime','starttime','parse','-createdAt','questionId','question','YYYY-MM-DD\x20HH:mm:ss','SessionId','push','isEmpty','now','writeFileSync','format','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Jscripty_Project_%d_Summary_%s.csv','download','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset'];(function(_0x3ae3af,_0x423ded){var _0x3cec82=function(_0x4bfdfe){while(--_0x4bfdfe){_0x3ae3af['push'](_0x3ae3af['shift']());}};_0x3cec82(++_0x423ded);}(_0x8227,0x146));var _0x7822=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8227[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7822('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7822('0x1'));var rp=require(_0x7822('0x2'));var moment=require(_0x7822('0x3'));var BPromise=require(_0x7822('0x4'));var Mustache=require('mustache');var util=require(_0x7822('0x5'));var path=require(_0x7822('0x6'));var sox=require(_0x7822('0x7'));var csv=require(_0x7822('0x8'));var ejs=require(_0x7822('0x9'));var fs=require('fs');var fs_extra=require(_0x7822('0xa'));var _=require(_0x7822('0xb'));var squel=require(_0x7822('0xc'));var crypto=require('crypto');var jsforce=require(_0x7822('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x7822('0x8'));var querystring=require(_0x7822('0xe'));var Papa=require(_0x7822('0xf'));var Redis=require(_0x7822('0x10'));var authService=require(_0x7822('0x11'));var qs=require(_0x7822('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7822('0x13'))('api');var utils=require(_0x7822('0x14'));var config=require(_0x7822('0x15'));var licenseUtil=require(_0x7822('0x16'));var db=require(_0x7822('0x17'))['db'];function respondWithStatusCode(_0x2c21d0,_0x3f6355){_0x3f6355=_0x3f6355||0xcc;return function(_0x5e4623){if(_0x5e4623){return _0x2c21d0['sendStatus'](_0x3f6355);}return _0x2c21d0[_0x7822('0x18')](_0x3f6355)[_0x7822('0x19')]();};}function respondWithResult(_0x5bd7e0,_0x30d3d5){_0x30d3d5=_0x30d3d5||0xc8;return function(_0xe46f15){if(_0xe46f15){return _0x5bd7e0[_0x7822('0x18')](_0x30d3d5)[_0x7822('0x1a')](_0xe46f15);}};}function respondWithFilteredResult(_0x411d99,_0x5c13de){return function(_0x4a8b06){if(_0x4a8b06){var _0x154c49=typeof _0x5c13de[_0x7822('0x1b')]===_0x7822('0x1c')&&typeof _0x5c13de[_0x7822('0x1d')]===_0x7822('0x1c');var _0x9ec4ee=_0x4a8b06[_0x7822('0x1e')];var _0x3f1f94=_0x154c49?0x0:_0x5c13de[_0x7822('0x1b')];var _0x4343b8=_0x154c49?_0x4a8b06[_0x7822('0x1e')]:_0x5c13de[_0x7822('0x1b')]+_0x5c13de[_0x7822('0x1d')];var _0x18ae02;if(_0x4343b8>=_0x9ec4ee){_0x4343b8=_0x9ec4ee;_0x18ae02=0xc8;}else{_0x18ae02=0xce;}_0x411d99[_0x7822('0x18')](_0x18ae02);return _0x411d99[_0x7822('0x1f')]('Content-Range',_0x3f1f94+'-'+_0x4343b8+'/'+_0x9ec4ee)[_0x7822('0x1a')](_0x4a8b06);}return null;};}function patchUpdates(_0x2a25e2){return function(_0x1780c6){try{jsonpatch[_0x7822('0x20')](_0x1780c6,_0x2a25e2,!![]);}catch(_0x171173){return BPromise['reject'](_0x171173);}return _0x1780c6[_0x7822('0x21')]();};}function saveUpdates(_0x497e04,_0x509ee8){return function(_0x275e99){if(_0x275e99){return _0x275e99[_0x7822('0x22')](_0x497e04)[_0x7822('0x23')](function(_0x12a6bd){return _0x12a6bd;});}return null;};}function removeEntity(_0x5599f8,_0x53269e){return function(_0xf0f816){if(_0xf0f816){return _0xf0f816[_0x7822('0x24')]()[_0x7822('0x23')](function(){var _0x53f827=_0xf0f816[_0x7822('0x25')]({'plain':!![]});var _0x202c97='Projects';return db[_0x7822('0x26')][_0x7822('0x24')]({'where':{'type':_0x202c97,'resourceId':_0x53f827['id']}})[_0x7822('0x23')](function(){return _0xf0f816;});})['then'](function(){_0x5599f8[_0x7822('0x18')](0xcc)[_0x7822('0x19')]();});}};}function handleEntityNotFound(_0x30d46d,_0x470dcd){return function(_0x26ef14){if(!_0x26ef14){_0x30d46d[_0x7822('0x27')](0x194);}return _0x26ef14;};}function handleError(_0x54aa99,_0x2dd015){_0x2dd015=_0x2dd015||0x1f4;return function(_0x190cb2){logger[_0x7822('0x28')](_0x190cb2[_0x7822('0x29')]);if(_0x190cb2[_0x7822('0x2a')]){delete _0x190cb2[_0x7822('0x2a')];}_0x54aa99[_0x7822('0x18')](_0x2dd015)[_0x7822('0x2b')](_0x190cb2);};}exports[_0x7822('0x2c')]=function(_0x51da51,_0x4d7d6b){var _0x52865b={},_0x1838cb={},_0x2fe314={'count':0x0,'rows':[]};var _0x53e41a=_[_0x7822('0x2d')](db[_0x7822('0x2e')]['rawAttributes'],function(_0x25aadd){return{'name':_0x25aadd[_0x7822('0x2f')],'type':_0x25aadd[_0x7822('0x30')]['key']};});_0x1838cb['model']=_[_0x7822('0x2d')](_0x53e41a,'name');_0x1838cb['query']=_[_0x7822('0x31')](_0x51da51['query']);_0x1838cb[_0x7822('0x32')]=_[_0x7822('0x33')](_0x1838cb[_0x7822('0x34')],_0x1838cb['query']);_0x52865b[_0x7822('0x35')]=_[_0x7822('0x33')](_0x1838cb[_0x7822('0x34')],qs[_0x7822('0x36')](_0x51da51[_0x7822('0x37')][_0x7822('0x36')]));_0x52865b[_0x7822('0x35')]=_0x52865b['attributes'][_0x7822('0x38')]?_0x52865b[_0x7822('0x35')]:_0x1838cb[_0x7822('0x34')];if(!_0x51da51[_0x7822('0x37')][_0x7822('0x39')]('nolimit')){_0x52865b['limit']=qs[_0x7822('0x1d')](_0x51da51['query'][_0x7822('0x1d')]);_0x52865b[_0x7822('0x1b')]=qs[_0x7822('0x1b')](_0x51da51[_0x7822('0x37')]['offset']);}_0x52865b['order']=qs[_0x7822('0x3a')](_0x51da51[_0x7822('0x37')]['sort']);_0x52865b[_0x7822('0x3b')]=qs[_0x7822('0x32')](_['pick'](_0x51da51['query'],_0x1838cb[_0x7822('0x32')]),_0x53e41a);if(_0x51da51[_0x7822('0x37')][_0x7822('0x3c')]){_0x52865b['where']=_[_0x7822('0x3d')](_0x52865b[_0x7822('0x3b')],{'$or':_[_0x7822('0x2d')](_0x53e41a,function(_0x82a582){if(_0x82a582[_0x7822('0x30')]!==_0x7822('0x3e')){var _0x5b2476={};_0x5b2476[_0x82a582[_0x7822('0x2a')]]={'$like':'%'+_0x51da51[_0x7822('0x37')][_0x7822('0x3c')]+'%'};return _0x5b2476;}})});}_0x52865b=_[_0x7822('0x3d')]({},_0x52865b,_0x51da51[_0x7822('0x3f')]);var _0x55731c={'where':_0x52865b[_0x7822('0x3b')]};return db[_0x7822('0x2e')][_0x7822('0x1e')](_0x55731c)[_0x7822('0x23')](function(_0x5c7b50){_0x2fe314[_0x7822('0x1e')]=_0x5c7b50;if(_0x51da51[_0x7822('0x37')]['includeAll']){_0x52865b[_0x7822('0x40')]=[{'all':!![]}];}return db[_0x7822('0x2e')][_0x7822('0x41')](_0x52865b);})[_0x7822('0x23')](function(_0x45ae4c){_0x2fe314[_0x7822('0x42')]=_0x45ae4c;return _0x2fe314;})['then'](respondWithFilteredResult(_0x4d7d6b,_0x52865b))[_0x7822('0x43')](handleError(_0x4d7d6b,null));};exports[_0x7822('0x44')]=function(_0x51fd88,_0x3b0355){var _0x5800cc={'raw':![],'where':{'id':_0x51fd88[_0x7822('0x45')]['id']}},_0x1cdd37={};_0x1cdd37[_0x7822('0x34')]=_[_0x7822('0x31')](db[_0x7822('0x2e')][_0x7822('0x46')]);_0x1cdd37[_0x7822('0x37')]=_[_0x7822('0x31')](_0x51fd88[_0x7822('0x37')]);_0x1cdd37['filters']=_['intersection'](_0x1cdd37[_0x7822('0x34')],_0x1cdd37['query']);_0x5800cc['attributes']=_[_0x7822('0x33')](_0x1cdd37[_0x7822('0x34')],qs[_0x7822('0x36')](_0x51fd88[_0x7822('0x37')][_0x7822('0x36')]));_0x5800cc[_0x7822('0x35')]=_0x5800cc[_0x7822('0x35')][_0x7822('0x38')]?_0x5800cc[_0x7822('0x35')]:_0x1cdd37['model'];if(_0x51fd88[_0x7822('0x37')][_0x7822('0x47')]){_0x5800cc[_0x7822('0x40')]=[{'all':!![]}];}_0x5800cc=_[_0x7822('0x3d')]({},_0x5800cc,_0x51fd88[_0x7822('0x3f')]);return db[_0x7822('0x2e')]['find'](_0x5800cc)[_0x7822('0x23')](handleEntityNotFound(_0x3b0355,null))[_0x7822('0x23')](respondWithResult(_0x3b0355,null))[_0x7822('0x43')](handleError(_0x3b0355,null));};exports[_0x7822('0x48')]=function(_0x3b6848,_0x3d8b69){return db[_0x7822('0x2e')][_0x7822('0x48')](_0x3b6848['body'],{})['then'](function(_0x28736e){var _0x5010f1=_0x3b6848[_0x7822('0x49')][_0x7822('0x25')]({'plain':!![]});if(!_0x5010f1)throw new Error(_0x7822('0x4a'));if(_0x5010f1[_0x7822('0x4b')]==='user'){var _0x740904=_0x28736e[_0x7822('0x25')]({'plain':!![]});var _0x127e08='Projects';return db[_0x7822('0x4c')][_0x7822('0x4d')]({'where':{'name':_0x127e08,'userProfileId':_0x5010f1[_0x7822('0x4e')]},'raw':!![]})[_0x7822('0x23')](function(_0x5ceee9){if(_0x5ceee9&&_0x5ceee9['autoAssociation']===0x0){return db['UserProfileResource'][_0x7822('0x48')]({'name':_0x740904[_0x7822('0x2a')],'resourceId':_0x740904['id'],'type':_0x5ceee9[_0x7822('0x2a')],'sectionId':_0x5ceee9['id']},{})[_0x7822('0x23')](function(){return _0x28736e;});}else{return _0x28736e;}})[_0x7822('0x43')](function(_0x4f61da){logger[_0x7822('0x28')](_0x7822('0x4f'),_0x4f61da);throw _0x4f61da;});}return _0x28736e;})[_0x7822('0x23')](respondWithResult(_0x3d8b69,0xc9))[_0x7822('0x43')](handleError(_0x3d8b69,null));};exports[_0x7822('0x50')]=function(_0x2ad56d,_0x1c3dab){var _0x1f8eb7={'where':{'id':_0x2ad56d[_0x7822('0x45')]['id']}},_0xd2ed80={};_0xd2ed80[_0x7822('0x34')]=_[_0x7822('0x31')](db['JscriptyProject']['rawAttributes']);_0x1f8eb7['attributes']=_[_0x7822('0x33')](_0xd2ed80[_0x7822('0x34')],qs['fields'](_0x2ad56d[_0x7822('0x37')][_0x7822('0x36')]));_0x1f8eb7[_0x7822('0x35')]=_0x1f8eb7[_0x7822('0x35')][_0x7822('0x38')]?_0x1f8eb7[_0x7822('0x35')]:_0xd2ed80['model'];if(_0x2ad56d[_0x7822('0x37')][_0x7822('0x47')]){_0x1f8eb7[_0x7822('0x40')]=[{'all':!![]}];}_0x1f8eb7=_['merge']({},_0x1f8eb7,_0x2ad56d[_0x7822('0x3f')]);return db[_0x7822('0x2e')]['find'](_0x1f8eb7)[_0x7822('0x23')](handleEntityNotFound(_0x1c3dab,null))[_0x7822('0x23')](function(_0x5e0a3c){if(_0x5e0a3c){var _0x165b58=_0x5e0a3c[_0x7822('0x25')]({'plain':!![]});_0x165b58=qs[_0x7822('0x51')](_0x165b58,['id',_0x7822('0x52'),_0x7822('0x53')]);_0x2ad56d[_0x7822('0x54')]=_[_0x7822('0x51')](_0x2ad56d[_0x7822('0x54')],['id',_0x7822('0x52'),'updatedAt']);return db[_0x7822('0x2e')][_0x7822('0x48')](_[_0x7822('0x3d')](_0x165b58,_0x2ad56d[_0x7822('0x54')]),{'include':_0x2ad56d[_0x7822('0x37')][_0x7822('0x47')]?[{'all':!![]}]:undefined})['then'](function(_0x3497f7){var _0x4da82b=_0x2ad56d[_0x7822('0x49')][_0x7822('0x25')]({'plain':!![]});if(!_0x4da82b)throw new Error(_0x7822('0x4a'));if(_0x4da82b[_0x7822('0x4b')]===_0x7822('0x49')){var _0x3fb6a6=_0x3497f7['get']({'plain':!![]});var _0x2df6cf=_0x7822('0x55');return db[_0x7822('0x4c')][_0x7822('0x4d')]({'where':{'name':_0x2df6cf,'userProfileId':_0x4da82b['userProfileId']},'raw':!![]})[_0x7822('0x23')](function(_0x90971a){if(_0x90971a&&_0x90971a[_0x7822('0x56')]===0x0){return db[_0x7822('0x26')][_0x7822('0x48')]({'name':_0x3fb6a6['name'],'resourceId':_0x3fb6a6['id'],'type':_0x90971a[_0x7822('0x2a')],'sectionId':_0x90971a['id']},{})[_0x7822('0x23')](function(){return _0x3497f7;});}else{return _0x3497f7;}})[_0x7822('0x43')](function(_0x2e3a2c){logger[_0x7822('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2e3a2c);throw _0x2e3a2c;});}return _0x3497f7;});}})[_0x7822('0x23')](respondWithResult(_0x1c3dab,0xc9))[_0x7822('0x43')](handleError(_0x1c3dab,null));};exports[_0x7822('0x22')]=function(_0x3f4e7e,_0x283386){if(_0x3f4e7e[_0x7822('0x54')]['id']){delete _0x3f4e7e[_0x7822('0x54')]['id'];}return db[_0x7822('0x2e')][_0x7822('0x4d')]({'where':{'id':_0x3f4e7e[_0x7822('0x45')]['id']}})[_0x7822('0x23')](handleEntityNotFound(_0x283386,null))[_0x7822('0x23')](saveUpdates(_0x3f4e7e['body'],null))['then'](respondWithResult(_0x283386,null))[_0x7822('0x43')](handleError(_0x283386,null));};exports[_0x7822('0x24')]=function(_0x41bf9a,_0x180440){return db[_0x7822('0x2e')][_0x7822('0x4d')]({'where':{'id':_0x41bf9a[_0x7822('0x45')]['id']}})[_0x7822('0x23')](handleEntityNotFound(_0x180440,null))[_0x7822('0x23')](removeEntity(_0x180440,null))[_0x7822('0x43')](handleError(_0x180440,null));};exports[_0x7822('0x57')]=function(_0x17d51f,_0x56bf33,_0x4812d1){var _0x21ea26={'raw':!![],'where':{}};var _0x195d92={};var _0x508cef={'count':0x0,'rows':[]};return db['JscriptyProject'][_0x7822('0x58')]({'where':{'id':_0x17d51f[_0x7822('0x45')]['id']}})['then'](handleEntityNotFound(_0x56bf33,null))['then'](function(_0x39dcff){if(_0x39dcff){_0x195d92[_0x7822('0x34')]=_[_0x7822('0x31')](db[_0x7822('0x59')]['rawAttributes']);_0x195d92[_0x7822('0x37')]=_[_0x7822('0x31')](_0x17d51f[_0x7822('0x37')]);_0x195d92[_0x7822('0x32')]=_[_0x7822('0x33')](_0x195d92[_0x7822('0x34')],_0x195d92[_0x7822('0x37')]);_0x21ea26[_0x7822('0x35')]=_[_0x7822('0x33')](_0x195d92[_0x7822('0x34')],qs['fields'](_0x17d51f['query'][_0x7822('0x36')]));_0x21ea26[_0x7822('0x35')]=_0x21ea26[_0x7822('0x35')][_0x7822('0x38')]?_0x21ea26[_0x7822('0x35')]:_0x195d92[_0x7822('0x34')];if(!_0x17d51f[_0x7822('0x37')][_0x7822('0x39')](_0x7822('0x5a'))){_0x21ea26[_0x7822('0x1d')]=qs[_0x7822('0x1d')](_0x17d51f['query'][_0x7822('0x1d')]);_0x21ea26[_0x7822('0x1b')]=qs['offset'](_0x17d51f[_0x7822('0x37')]['offset']);}_0x21ea26['order']=qs[_0x7822('0x3a')](_0x17d51f[_0x7822('0x37')][_0x7822('0x3a')]);_0x21ea26[_0x7822('0x3b')]=qs[_0x7822('0x32')](_[_0x7822('0x5b')](_0x17d51f[_0x7822('0x37')],_0x195d92[_0x7822('0x32')]));_0x21ea26[_0x7822('0x3b')]['ProjectId']=_0x39dcff['id'];if(_0x17d51f['query'][_0x7822('0x3c')]){_0x21ea26['where']=_['merge'](_0x21ea26[_0x7822('0x3b')],{'$or':_[_0x7822('0x2d')](_0x21ea26[_0x7822('0x35')],function(_0x411c2d){var _0xa872ed={};_0xa872ed[_0x411c2d]={'$like':'%'+_0x17d51f[_0x7822('0x37')][_0x7822('0x3c')]+'%'};return _0xa872ed;})});}_0x21ea26=_[_0x7822('0x3d')]({},_0x21ea26,_0x17d51f['options']);return db['JscriptySessionReport']['count']({'where':_0x21ea26[_0x7822('0x3b')]})[_0x7822('0x23')](function(_0x4840a2){_0x508cef[_0x7822('0x1e')]=_0x4840a2;if(_0x17d51f[_0x7822('0x37')][_0x7822('0x47')]){_0x21ea26[_0x7822('0x40')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0x7822('0x41')](_0x21ea26);})[_0x7822('0x23')](function(_0x47a7e4){_0x508cef['rows']=_0x47a7e4;return _0x508cef;});}})[_0x7822('0x23')](respondWithFilteredResult(_0x56bf33,_0x21ea26))[_0x7822('0x43')](handleError(_0x56bf33,null));};exports[_0x7822('0x5c')]=function(_0x13f536,_0x8d56d,_0x487a7a){var _0x5d3daa={'raw':!![],'where':{}};var _0x1bc318={};var _0x2ca09a={'count':0x0,'rows':[]};return db[_0x7822('0x2e')][_0x7822('0x58')]({'where':{'id':_0x13f536['params']['id']}})['then'](handleEntityNotFound(_0x8d56d,null))[_0x7822('0x23')](function(_0x20b978){if(_0x20b978){_0x1bc318['model']=_['keys'](db[_0x7822('0x5d')][_0x7822('0x46')]);_0x1bc318[_0x7822('0x37')]=_[_0x7822('0x31')](_0x13f536['query']);_0x1bc318[_0x7822('0x32')]=_[_0x7822('0x33')](_0x1bc318[_0x7822('0x34')],_0x1bc318[_0x7822('0x37')]);_0x5d3daa[_0x7822('0x35')]=_['intersection'](_0x1bc318[_0x7822('0x34')],qs[_0x7822('0x36')](_0x13f536[_0x7822('0x37')][_0x7822('0x36')]));_0x5d3daa[_0x7822('0x35')]=_0x5d3daa[_0x7822('0x35')][_0x7822('0x38')]?_0x5d3daa['attributes']:_0x1bc318[_0x7822('0x34')];if(!_0x13f536[_0x7822('0x37')][_0x7822('0x39')](_0x7822('0x5a'))){_0x5d3daa[_0x7822('0x1d')]=qs[_0x7822('0x1d')](_0x13f536['query'][_0x7822('0x1d')]);_0x5d3daa['offset']=qs['offset'](_0x13f536[_0x7822('0x37')]['offset']);}_0x5d3daa[_0x7822('0x5e')]=qs[_0x7822('0x3a')](_0x13f536[_0x7822('0x37')][_0x7822('0x3a')]);_0x5d3daa[_0x7822('0x3b')]=qs[_0x7822('0x32')](_[_0x7822('0x5b')](_0x13f536[_0x7822('0x37')],_0x1bc318['filters']));_0x5d3daa['where'][_0x7822('0x5f')]=_0x20b978['id'];if(_0x13f536[_0x7822('0x37')][_0x7822('0x3c')]){_0x5d3daa[_0x7822('0x3b')]=_[_0x7822('0x3d')](_0x5d3daa[_0x7822('0x3b')],{'$or':_[_0x7822('0x2d')](_0x5d3daa[_0x7822('0x35')],function(_0x2dfd6d){var _0x13f7c4={};_0x13f7c4[_0x2dfd6d]={'$like':'%'+_0x13f536[_0x7822('0x37')][_0x7822('0x3c')]+'%'};return _0x13f7c4;})});}_0x5d3daa=_[_0x7822('0x3d')]({},_0x5d3daa,_0x13f536[_0x7822('0x3f')]);return db['JscriptyAnswerReport'][_0x7822('0x1e')]({'where':_0x5d3daa['where']})['then'](function(_0x4e6aae){_0x2ca09a['count']=_0x4e6aae;if(_0x13f536[_0x7822('0x37')][_0x7822('0x47')]){_0x5d3daa[_0x7822('0x40')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x7822('0x41')](_0x5d3daa);})[_0x7822('0x23')](function(_0x3e72a6){_0x2ca09a[_0x7822('0x42')]=_0x3e72a6;return _0x2ca09a;});}})['then'](respondWithFilteredResult(_0x8d56d,_0x5d3daa))['catch'](handleError(_0x8d56d,null));};function char(_0x322b4f){return _0x7822('0x60')===typeof _0x322b4f?String[_0x7822('0x61')][_0x7822('0x20')](null,arguments):_0x322b4f;}function needsEncapsulation(_0x273958){return!!_0x273958&&(_0x273958[_0x7822('0x62')]()['indexOf'](char(0xd))>=0x0||_0x273958['toString']()[_0x7822('0x63')](char(0xa))>=0x0||_0x273958[_0x7822('0x62')]()[_0x7822('0x63')](char(0x2c))>=0x0||_0x273958[_0x7822('0x62')]()[_0x7822('0x63')](char(0x22))>=0x0);}function encapsulate(_0x5f594f){var _0x3a4f59=char(0x22),_0x254584='\x5c'+char(0x22),_0x2a8340=_0x5f594f['toString']()['replace'](new RegExp(_0x3a4f59,'g'),_0x254584);return _0x3a4f59+_0x2a8340+_0x3a4f59;}exports[_0x7822('0x64')]=function(_0x44ba9a,_0xb0f424,_0xbe4da0){var _0x2d3ecb,_0x4ed263;var _0x2e6292={'where':{'ProjectId':_0x44ba9a[_0x7822('0x45')]['id']}};if(_0x44ba9a[_0x7822('0x37')][_0x7822('0x65')]){_0x2e6292['where'][_0x7822('0x66')]=JSON[_0x7822('0x67')](_0x44ba9a[_0x7822('0x37')]['startTime']);}return db[_0x7822('0x59')]['findAll'](_0x2e6292)[_0x7822('0x23')](handleEntityNotFound(_0xb0f424,null))[_0x7822('0x23')](function(_0x70a6fb){if(_0x70a6fb){_0x2d3ecb=_0x70a6fb;return db['JscriptyQuestionReport'][_0x7822('0x41')]({'where':{'SessionId':{'$in':_['map'](_0x2d3ecb,'id')},'ProjectId':_0x44ba9a[_0x7822('0x45')]['id']},'order':_0x7822('0x68')});}})[_0x7822('0x23')](handleEntityNotFound(_0xb0f424,null))[_0x7822('0x23')](function(_0x5e2344){if(_0x5e2344){_0x4ed263=_0x5e2344;var _0x2507d4={};for(var _0x1c7a59=0x0,_0x38ac3e=_0x4ed263[_0x7822('0x38')];_0x1c7a59<_0x38ac3e;_0x1c7a59++){if(!_0x2507d4[_0x7822('0x39')](_0x4ed263[_0x1c7a59][_0x7822('0x69')])){_0x2507d4[_0x4ed263[_0x1c7a59][_0x7822('0x69')]]=needsEncapsulation(_0x4ed263[_0x1c7a59][_0x7822('0x6a')])?encapsulate(_0x4ed263[_0x1c7a59][_0x7822('0x6a')]):_0x4ed263[_0x1c7a59][_0x7822('0x6a')];}}var _0x33a3ca=[],_0x29854d={};for(var _0x4996a5=0x0,_0x59340c=_0x2d3ecb[_0x7822('0x38')];_0x4996a5<_0x59340c;_0x4996a5++){_0x29854d={'ProjectId':_0x44ba9a['params']['id'],'SessionId':_0x2d3ecb[_0x4996a5]['id'],'StartTime':moment(_0x2d3ecb[_0x4996a5][_0x7822('0x66')])['format'](_0x7822('0x6b'))};for(var _0x34788f=0x0,_0x351823=_0x4ed263['length'];_0x34788f<_0x351823;_0x34788f++){if(_0x4ed263[_0x34788f][_0x7822('0x6c')]==_0x2d3ecb[_0x4996a5]['id']&&_0x2507d4['hasOwnProperty'](_0x4ed263[_0x34788f][_0x7822('0x69')])){_0x29854d[_0x2507d4[_0x4ed263[_0x34788f]['questionId']]]=_0x4ed263[_0x34788f]['answer'];}}for(var _0x1fc5b7 in _0x2507d4){if(!_0x29854d[_0x7822('0x39')](_0x2507d4[_0x1fc5b7])){_0x29854d[_0x2507d4[_0x1fc5b7]]=null;}}_0x33a3ca[_0x7822('0x6d')](_0x29854d);}return _0x33a3ca;}})['then'](function(_0x311a05){if(!_[_0x7822('0x6e')](_0x311a05)){var _0x3ecea6=toCsv(_0x311a05);var _0x64d5e=Date[_0x7822('0x6f')]();fs[_0x7822('0x70')](util[_0x7822('0x71')](_0x7822('0x72'),_0x44ba9a['params']['id'],_0x64d5e),_0x3ecea6);_0xb0f424[_0x7822('0x73')]('Content-disposition','attachment;\x20filename='+util['format'](_0x7822('0x74'),_0x44ba9a[_0x7822('0x45')]['id'],_0x64d5e));_0xb0f424['setHeader']('Content-type','text/csv');return _0xb0f424[_0x7822('0x75')](util[_0x7822('0x71')](_0x7822('0x72'),_0x44ba9a['params']['id'],_0x64d5e));}else{return _0xb0f424[_0x7822('0x27')](0xcc);}})['catch'](handleError(_0xb0f424,null));}; \ No newline at end of file +var _0x91c5=['intersection','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','JscriptyProject','includeAll','findAll','rows','show','params','rawAttributes','include','options','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','createdAt','updatedAt','omit','getSessions','JscriptySessionReport','pick','ProjectId','findOne','JscriptyAnswerReport','hasOwnProperty','fromCharCode','toString','indexOf','replace','getSummary','starttime','parse','startTime','JscriptyQuestionReport','questionId','question','format','SessionId','push','now','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','text/csv','download','rimraf','request-promise','path','sox','ejs','fs-extra','squel','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','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','then','destroy','get','Projects','sendStatus','error','stack','name','send','index','map','fieldName','type','key','model','query','keys','filters','attributes'];(function(_0x9a7e5c,_0x57549f){var _0x4bb7fc=function(_0x2ae32b){while(--_0x2ae32b){_0x9a7e5c['push'](_0x9a7e5c['shift']());}};_0x4bb7fc(++_0x57549f);}(_0x91c5,0x124));var _0x591c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x91c5[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x591c('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x591c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x591c('0x2'));var sox=require(_0x591c('0x3'));var csv=require('to-csv');var ejs=require(_0x591c('0x4'));var fs=require('fs');var fs_extra=require(_0x591c('0x5'));var _=require('lodash');var squel=require(_0x591c('0x6'));var crypto=require('crypto');var jsforce=require(_0x591c('0x7'));var deskjs=require(_0x591c('0x8'));var toCsv=require(_0x591c('0x9'));var querystring=require(_0x591c('0xa'));var Papa=require(_0x591c('0xb'));var Redis=require(_0x591c('0xc'));var authService=require(_0x591c('0xd'));var qs=require(_0x591c('0xe'));var as=require(_0x591c('0xf'));var hardwareService=require(_0x591c('0x10'));var logger=require(_0x591c('0x11'))(_0x591c('0x12'));var utils=require(_0x591c('0x13'));var config=require(_0x591c('0x14'));var licenseUtil=require(_0x591c('0x15'));var db=require(_0x591c('0x16'))['db'];function respondWithStatusCode(_0x548f0e,_0x1e8e1b){_0x1e8e1b=_0x1e8e1b||0xcc;return function(_0x32446f){if(_0x32446f){return _0x548f0e['sendStatus'](_0x1e8e1b);}return _0x548f0e[_0x591c('0x17')](_0x1e8e1b)[_0x591c('0x18')]();};}function respondWithResult(_0x39d254,_0x3284a2){_0x3284a2=_0x3284a2||0xc8;return function(_0x455ade){if(_0x455ade){return _0x39d254[_0x591c('0x17')](_0x3284a2)[_0x591c('0x19')](_0x455ade);}};}function respondWithFilteredResult(_0x221093,_0x41c4df){return function(_0x4f029c){if(_0x4f029c){var _0x27588d=typeof _0x41c4df['offset']===_0x591c('0x1a')&&typeof _0x41c4df[_0x591c('0x1b')]===_0x591c('0x1a');var _0x3c77bf=_0x4f029c['count'];var _0x2fbb24=_0x27588d?0x0:_0x41c4df[_0x591c('0x1c')];var _0x1bbca5=_0x27588d?_0x4f029c[_0x591c('0x1d')]:_0x41c4df[_0x591c('0x1c')]+_0x41c4df['limit'];var _0x380154;if(_0x1bbca5>=_0x3c77bf){_0x1bbca5=_0x3c77bf;_0x380154=0xc8;}else{_0x380154=0xce;}_0x221093[_0x591c('0x17')](_0x380154);return _0x221093[_0x591c('0x1e')](_0x591c('0x1f'),_0x2fbb24+'-'+_0x1bbca5+'/'+_0x3c77bf)[_0x591c('0x19')](_0x4f029c);}return null;};}function patchUpdates(_0x15d9dd){return function(_0x67508d){try{jsonpatch[_0x591c('0x20')](_0x67508d,_0x15d9dd,!![]);}catch(_0x357718){return BPromise[_0x591c('0x21')](_0x357718);}return _0x67508d['save']();};}function saveUpdates(_0x5e7f53,_0xb80c23){return function(_0x455072){if(_0x455072){return _0x455072['update'](_0x5e7f53)[_0x591c('0x22')](function(_0x5bacdd){return _0x5bacdd;});}return null;};}function removeEntity(_0x4de74f,_0x10ce81){return function(_0x598803){if(_0x598803){return _0x598803[_0x591c('0x23')]()[_0x591c('0x22')](function(){var _0x2086d4=_0x598803[_0x591c('0x24')]({'plain':!![]});var _0x41c99e=_0x591c('0x25');return db['UserProfileResource']['destroy']({'where':{'type':_0x41c99e,'resourceId':_0x2086d4['id']}})['then'](function(){return _0x598803;});})['then'](function(){_0x4de74f[_0x591c('0x17')](0xcc)[_0x591c('0x18')]();});}};}function handleEntityNotFound(_0x4dc802,_0x50e603){return function(_0x6e974f){if(!_0x6e974f){_0x4dc802[_0x591c('0x26')](0x194);}return _0x6e974f;};}function handleError(_0x4ba8c7,_0x2243a4){_0x2243a4=_0x2243a4||0x1f4;return function(_0x5eae09){logger[_0x591c('0x27')](_0x5eae09[_0x591c('0x28')]);if(_0x5eae09[_0x591c('0x29')]){delete _0x5eae09[_0x591c('0x29')];}_0x4ba8c7[_0x591c('0x17')](_0x2243a4)[_0x591c('0x2a')](_0x5eae09);};}exports[_0x591c('0x2b')]=function(_0x3ab816,_0x44536e){var _0x3f01bf={},_0x47e48f={},_0x4fe132={'count':0x0,'rows':[]};var _0x250adf=_[_0x591c('0x2c')](db['JscriptyProject']['rawAttributes'],function(_0x22e7a9){return{'name':_0x22e7a9[_0x591c('0x2d')],'type':_0x22e7a9[_0x591c('0x2e')][_0x591c('0x2f')]};});_0x47e48f[_0x591c('0x30')]=_[_0x591c('0x2c')](_0x250adf,'name');_0x47e48f[_0x591c('0x31')]=_[_0x591c('0x32')](_0x3ab816[_0x591c('0x31')]);_0x47e48f[_0x591c('0x33')]=_['intersection'](_0x47e48f[_0x591c('0x30')],_0x47e48f['query']);_0x3f01bf[_0x591c('0x34')]=_[_0x591c('0x35')](_0x47e48f[_0x591c('0x30')],qs[_0x591c('0x36')](_0x3ab816['query']['fields']));_0x3f01bf[_0x591c('0x34')]=_0x3f01bf[_0x591c('0x34')][_0x591c('0x37')]?_0x3f01bf['attributes']:_0x47e48f[_0x591c('0x30')];if(!_0x3ab816[_0x591c('0x31')]['hasOwnProperty'](_0x591c('0x38'))){_0x3f01bf[_0x591c('0x1b')]=qs['limit'](_0x3ab816['query'][_0x591c('0x1b')]);_0x3f01bf[_0x591c('0x1c')]=qs['offset'](_0x3ab816[_0x591c('0x31')][_0x591c('0x1c')]);}_0x3f01bf[_0x591c('0x39')]=qs[_0x591c('0x3a')](_0x3ab816[_0x591c('0x31')]['sort']);_0x3f01bf[_0x591c('0x3b')]=qs[_0x591c('0x33')](_['pick'](_0x3ab816[_0x591c('0x31')],_0x47e48f['filters']),_0x250adf);if(_0x3ab816[_0x591c('0x31')][_0x591c('0x3c')]){_0x3f01bf['where']=_[_0x591c('0x3d')](_0x3f01bf['where'],{'$or':_[_0x591c('0x2c')](_0x250adf,function(_0x2c7051){if(_0x2c7051[_0x591c('0x2e')]!==_0x591c('0x3e')){var _0x2aa87e={};_0x2aa87e[_0x2c7051[_0x591c('0x29')]]={'$like':'%'+_0x3ab816['query']['filter']+'%'};return _0x2aa87e;}})});}_0x3f01bf=_[_0x591c('0x3d')]({},_0x3f01bf,_0x3ab816['options']);var _0x2ddf7d={'where':_0x3f01bf[_0x591c('0x3b')]};return db[_0x591c('0x3f')][_0x591c('0x1d')](_0x2ddf7d)[_0x591c('0x22')](function(_0x15e257){_0x4fe132[_0x591c('0x1d')]=_0x15e257;if(_0x3ab816['query'][_0x591c('0x40')]){_0x3f01bf['include']=[{'all':!![]}];}return db[_0x591c('0x3f')][_0x591c('0x41')](_0x3f01bf);})[_0x591c('0x22')](function(_0x4f8440){_0x4fe132[_0x591c('0x42')]=_0x4f8440;return _0x4fe132;})[_0x591c('0x22')](respondWithFilteredResult(_0x44536e,_0x3f01bf))['catch'](handleError(_0x44536e,null));};exports[_0x591c('0x43')]=function(_0x401a80,_0x44fd62){var _0x55f350={'raw':![],'where':{'id':_0x401a80[_0x591c('0x44')]['id']}},_0xdf02f1={};_0xdf02f1['model']=_['keys'](db['JscriptyProject'][_0x591c('0x45')]);_0xdf02f1[_0x591c('0x31')]=_[_0x591c('0x32')](_0x401a80['query']);_0xdf02f1[_0x591c('0x33')]=_['intersection'](_0xdf02f1[_0x591c('0x30')],_0xdf02f1[_0x591c('0x31')]);_0x55f350[_0x591c('0x34')]=_[_0x591c('0x35')](_0xdf02f1[_0x591c('0x30')],qs['fields'](_0x401a80['query']['fields']));_0x55f350[_0x591c('0x34')]=_0x55f350[_0x591c('0x34')][_0x591c('0x37')]?_0x55f350['attributes']:_0xdf02f1[_0x591c('0x30')];if(_0x401a80[_0x591c('0x31')]['includeAll']){_0x55f350[_0x591c('0x46')]=[{'all':!![]}];}_0x55f350=_[_0x591c('0x3d')]({},_0x55f350,_0x401a80[_0x591c('0x47')]);return db[_0x591c('0x3f')][_0x591c('0x48')](_0x55f350)[_0x591c('0x22')](handleEntityNotFound(_0x44fd62,null))[_0x591c('0x22')](respondWithResult(_0x44fd62,null))[_0x591c('0x49')](handleError(_0x44fd62,null));};exports[_0x591c('0x4a')]=function(_0x57d644,_0x28afee){return db['JscriptyProject']['create'](_0x57d644[_0x591c('0x4b')],{})['then'](function(_0x4d984b){var _0x188633=_0x57d644['user'][_0x591c('0x24')]({'plain':!![]});if(!_0x188633)throw new Error(_0x591c('0x4c'));if(_0x188633[_0x591c('0x4d')]===_0x591c('0x4e')){var _0x31e50b=_0x4d984b['get']({'plain':!![]});var _0xa4031e=_0x591c('0x25');return db[_0x591c('0x4f')][_0x591c('0x48')]({'where':{'name':_0xa4031e,'userProfileId':_0x188633[_0x591c('0x50')]},'raw':!![]})[_0x591c('0x22')](function(_0x25b8b6){if(_0x25b8b6&&_0x25b8b6[_0x591c('0x51')]===0x0){return db[_0x591c('0x52')][_0x591c('0x4a')]({'name':_0x31e50b[_0x591c('0x29')],'resourceId':_0x31e50b['id'],'type':_0x25b8b6[_0x591c('0x29')],'sectionId':_0x25b8b6['id']},{})[_0x591c('0x22')](function(){return _0x4d984b;});}else{return _0x4d984b;}})[_0x591c('0x49')](function(_0x165fcc){logger[_0x591c('0x27')](_0x591c('0x53'),_0x165fcc);throw _0x165fcc;});}return _0x4d984b;})[_0x591c('0x22')](respondWithResult(_0x28afee,0xc9))[_0x591c('0x49')](handleError(_0x28afee,null));};exports['clone']=function(_0x520385,_0x42f7db){var _0x3ae9c7={'where':{'id':_0x520385['params']['id']}},_0x302855={};_0x302855[_0x591c('0x30')]=_[_0x591c('0x32')](db[_0x591c('0x3f')]['rawAttributes']);_0x3ae9c7[_0x591c('0x34')]=_['intersection'](_0x302855[_0x591c('0x30')],qs[_0x591c('0x36')](_0x520385[_0x591c('0x31')][_0x591c('0x36')]));_0x3ae9c7[_0x591c('0x34')]=_0x3ae9c7[_0x591c('0x34')]['length']?_0x3ae9c7['attributes']:_0x302855[_0x591c('0x30')];if(_0x520385[_0x591c('0x31')][_0x591c('0x40')]){_0x3ae9c7[_0x591c('0x46')]=[{'all':!![]}];}_0x3ae9c7=_[_0x591c('0x3d')]({},_0x3ae9c7,_0x520385[_0x591c('0x47')]);return db['JscriptyProject'][_0x591c('0x48')](_0x3ae9c7)[_0x591c('0x22')](handleEntityNotFound(_0x42f7db,null))['then'](function(_0x26b1cb){if(_0x26b1cb){var _0x33fd4b=_0x26b1cb['get']({'plain':!![]});_0x33fd4b=qs['omit'](_0x33fd4b,['id',_0x591c('0x54'),_0x591c('0x55')]);_0x520385[_0x591c('0x4b')]=_[_0x591c('0x56')](_0x520385[_0x591c('0x4b')],['id','createdAt',_0x591c('0x55')]);return db[_0x591c('0x3f')]['create'](_[_0x591c('0x3d')](_0x33fd4b,_0x520385[_0x591c('0x4b')]),{'include':_0x520385[_0x591c('0x31')][_0x591c('0x40')]?[{'all':!![]}]:undefined})[_0x591c('0x22')](function(_0x32023d){var _0xa02087=_0x520385[_0x591c('0x4e')]['get']({'plain':!![]});if(!_0xa02087)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xa02087[_0x591c('0x4d')]==='user'){var _0x25c0c6=_0x32023d[_0x591c('0x24')]({'plain':!![]});var _0x3693ed='Projects';return db[_0x591c('0x4f')]['find']({'where':{'name':_0x3693ed,'userProfileId':_0xa02087[_0x591c('0x50')]},'raw':!![]})[_0x591c('0x22')](function(_0x301a73){if(_0x301a73&&_0x301a73['autoAssociation']===0x0){return db[_0x591c('0x52')][_0x591c('0x4a')]({'name':_0x25c0c6[_0x591c('0x29')],'resourceId':_0x25c0c6['id'],'type':_0x301a73[_0x591c('0x29')],'sectionId':_0x301a73['id']},{})['then'](function(){return _0x32023d;});}else{return _0x32023d;}})[_0x591c('0x49')](function(_0x288ac1){logger[_0x591c('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x288ac1);throw _0x288ac1;});}return _0x32023d;});}})['then'](respondWithResult(_0x42f7db,0xc9))['catch'](handleError(_0x42f7db,null));};exports['update']=function(_0x2169de,_0x4ac643){if(_0x2169de['body']['id']){delete _0x2169de[_0x591c('0x4b')]['id'];}return db[_0x591c('0x3f')][_0x591c('0x48')]({'where':{'id':_0x2169de[_0x591c('0x44')]['id']}})[_0x591c('0x22')](handleEntityNotFound(_0x4ac643,null))[_0x591c('0x22')](saveUpdates(_0x2169de[_0x591c('0x4b')],null))[_0x591c('0x22')](respondWithResult(_0x4ac643,null))[_0x591c('0x49')](handleError(_0x4ac643,null));};exports[_0x591c('0x23')]=function(_0x581027,_0xffdbf5){return db[_0x591c('0x3f')]['find']({'where':{'id':_0x581027[_0x591c('0x44')]['id']}})[_0x591c('0x22')](handleEntityNotFound(_0xffdbf5,null))[_0x591c('0x22')](removeEntity(_0xffdbf5,null))['catch'](handleError(_0xffdbf5,null));};exports[_0x591c('0x57')]=function(_0x44d917,_0x463de6,_0x2da6ab){var _0xe9b0ad={'raw':!![],'where':{}};var _0x1a04bd={};var _0x59afdf={'count':0x0,'rows':[]};return db[_0x591c('0x3f')]['findOne']({'where':{'id':_0x44d917[_0x591c('0x44')]['id']}})['then'](handleEntityNotFound(_0x463de6,null))[_0x591c('0x22')](function(_0x11e192){if(_0x11e192){_0x1a04bd[_0x591c('0x30')]=_[_0x591c('0x32')](db[_0x591c('0x58')][_0x591c('0x45')]);_0x1a04bd[_0x591c('0x31')]=_['keys'](_0x44d917[_0x591c('0x31')]);_0x1a04bd[_0x591c('0x33')]=_[_0x591c('0x35')](_0x1a04bd['model'],_0x1a04bd[_0x591c('0x31')]);_0xe9b0ad[_0x591c('0x34')]=_[_0x591c('0x35')](_0x1a04bd[_0x591c('0x30')],qs[_0x591c('0x36')](_0x44d917['query'][_0x591c('0x36')]));_0xe9b0ad['attributes']=_0xe9b0ad[_0x591c('0x34')][_0x591c('0x37')]?_0xe9b0ad[_0x591c('0x34')]:_0x1a04bd['model'];if(!_0x44d917[_0x591c('0x31')]['hasOwnProperty'](_0x591c('0x38'))){_0xe9b0ad['limit']=qs[_0x591c('0x1b')](_0x44d917[_0x591c('0x31')][_0x591c('0x1b')]);_0xe9b0ad[_0x591c('0x1c')]=qs['offset'](_0x44d917[_0x591c('0x31')][_0x591c('0x1c')]);}_0xe9b0ad[_0x591c('0x39')]=qs[_0x591c('0x3a')](_0x44d917['query'][_0x591c('0x3a')]);_0xe9b0ad[_0x591c('0x3b')]=qs[_0x591c('0x33')](_[_0x591c('0x59')](_0x44d917[_0x591c('0x31')],_0x1a04bd[_0x591c('0x33')]));_0xe9b0ad[_0x591c('0x3b')][_0x591c('0x5a')]=_0x11e192['id'];if(_0x44d917[_0x591c('0x31')][_0x591c('0x3c')]){_0xe9b0ad[_0x591c('0x3b')]=_[_0x591c('0x3d')](_0xe9b0ad[_0x591c('0x3b')],{'$or':_['map'](_0xe9b0ad[_0x591c('0x34')],function(_0x23a12){var _0x2205d9={};_0x2205d9[_0x23a12]={'$like':'%'+_0x44d917['query'][_0x591c('0x3c')]+'%'};return _0x2205d9;})});}_0xe9b0ad=_[_0x591c('0x3d')]({},_0xe9b0ad,_0x44d917[_0x591c('0x47')]);return db[_0x591c('0x58')][_0x591c('0x1d')]({'where':_0xe9b0ad['where']})['then'](function(_0x466035){_0x59afdf[_0x591c('0x1d')]=_0x466035;if(_0x44d917[_0x591c('0x31')][_0x591c('0x40')]){_0xe9b0ad[_0x591c('0x46')]=[{'all':!![]}];}return db[_0x591c('0x58')]['findAll'](_0xe9b0ad);})[_0x591c('0x22')](function(_0x456078){_0x59afdf[_0x591c('0x42')]=_0x456078;return _0x59afdf;});}})['then'](respondWithFilteredResult(_0x463de6,_0xe9b0ad))['catch'](handleError(_0x463de6,null));};exports['getAnswers']=function(_0x3b7022,_0x3bf730,_0x4e839e){var _0x345c8d={'raw':!![],'where':{}};var _0x512ab5={};var _0x1eb3b3={'count':0x0,'rows':[]};return db[_0x591c('0x3f')][_0x591c('0x5b')]({'where':{'id':_0x3b7022[_0x591c('0x44')]['id']}})[_0x591c('0x22')](handleEntityNotFound(_0x3bf730,null))[_0x591c('0x22')](function(_0x589cda){if(_0x589cda){_0x512ab5[_0x591c('0x30')]=_['keys'](db[_0x591c('0x5c')][_0x591c('0x45')]);_0x512ab5[_0x591c('0x31')]=_[_0x591c('0x32')](_0x3b7022[_0x591c('0x31')]);_0x512ab5[_0x591c('0x33')]=_[_0x591c('0x35')](_0x512ab5[_0x591c('0x30')],_0x512ab5['query']);_0x345c8d['attributes']=_[_0x591c('0x35')](_0x512ab5[_0x591c('0x30')],qs[_0x591c('0x36')](_0x3b7022['query']['fields']));_0x345c8d['attributes']=_0x345c8d['attributes'][_0x591c('0x37')]?_0x345c8d[_0x591c('0x34')]:_0x512ab5[_0x591c('0x30')];if(!_0x3b7022[_0x591c('0x31')][_0x591c('0x5d')](_0x591c('0x38'))){_0x345c8d[_0x591c('0x1b')]=qs[_0x591c('0x1b')](_0x3b7022[_0x591c('0x31')]['limit']);_0x345c8d[_0x591c('0x1c')]=qs['offset'](_0x3b7022[_0x591c('0x31')]['offset']);}_0x345c8d[_0x591c('0x39')]=qs['sort'](_0x3b7022[_0x591c('0x31')][_0x591c('0x3a')]);_0x345c8d[_0x591c('0x3b')]=qs[_0x591c('0x33')](_['pick'](_0x3b7022['query'],_0x512ab5[_0x591c('0x33')]));_0x345c8d[_0x591c('0x3b')][_0x591c('0x5a')]=_0x589cda['id'];if(_0x3b7022[_0x591c('0x31')][_0x591c('0x3c')]){_0x345c8d['where']=_['merge'](_0x345c8d[_0x591c('0x3b')],{'$or':_['map'](_0x345c8d[_0x591c('0x34')],function(_0x1d8f43){var _0x2b880a={};_0x2b880a[_0x1d8f43]={'$like':'%'+_0x3b7022['query'][_0x591c('0x3c')]+'%'};return _0x2b880a;})});}_0x345c8d=_[_0x591c('0x3d')]({},_0x345c8d,_0x3b7022[_0x591c('0x47')]);return db[_0x591c('0x5c')][_0x591c('0x1d')]({'where':_0x345c8d[_0x591c('0x3b')]})[_0x591c('0x22')](function(_0x194460){_0x1eb3b3[_0x591c('0x1d')]=_0x194460;if(_0x3b7022[_0x591c('0x31')][_0x591c('0x40')]){_0x345c8d['include']=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x591c('0x41')](_0x345c8d);})[_0x591c('0x22')](function(_0x37f6f1){_0x1eb3b3[_0x591c('0x42')]=_0x37f6f1;return _0x1eb3b3;});}})[_0x591c('0x22')](respondWithFilteredResult(_0x3bf730,_0x345c8d))[_0x591c('0x49')](handleError(_0x3bf730,null));};function char(_0x2d1ffa){return'number'===typeof _0x2d1ffa?String[_0x591c('0x5e')][_0x591c('0x20')](null,arguments):_0x2d1ffa;}function needsEncapsulation(_0x44359c){return!!_0x44359c&&(_0x44359c[_0x591c('0x5f')]()[_0x591c('0x60')](char(0xd))>=0x0||_0x44359c['toString']()['indexOf'](char(0xa))>=0x0||_0x44359c['toString']()[_0x591c('0x60')](char(0x2c))>=0x0||_0x44359c[_0x591c('0x5f')]()[_0x591c('0x60')](char(0x22))>=0x0);}function encapsulate(_0x1798c8){var _0x3afc5d=char(0x22),_0x6a73bb='\x5c'+char(0x22),_0x44929c=_0x1798c8[_0x591c('0x5f')]()[_0x591c('0x61')](new RegExp(_0x3afc5d,'g'),_0x6a73bb);return _0x3afc5d+_0x44929c+_0x3afc5d;}exports[_0x591c('0x62')]=function(_0x6473f9,_0x10efba,_0x1784ad){var _0x545905,_0x32f16a;var _0x5b5edb={'where':{'ProjectId':_0x6473f9[_0x591c('0x44')]['id']}};if(_0x6473f9[_0x591c('0x31')]['startTime']){_0x5b5edb[_0x591c('0x3b')][_0x591c('0x63')]=JSON[_0x591c('0x64')](_0x6473f9[_0x591c('0x31')][_0x591c('0x65')]);}return db[_0x591c('0x58')][_0x591c('0x41')](_0x5b5edb)['then'](handleEntityNotFound(_0x10efba,null))[_0x591c('0x22')](function(_0x885157){if(_0x885157){_0x545905=_0x885157;return db[_0x591c('0x66')][_0x591c('0x41')]({'where':{'SessionId':{'$in':_['map'](_0x545905,'id')},'ProjectId':_0x6473f9[_0x591c('0x44')]['id']},'order':'-createdAt'});}})[_0x591c('0x22')](handleEntityNotFound(_0x10efba,null))[_0x591c('0x22')](function(_0x25ce60){if(_0x25ce60){_0x32f16a=_0x25ce60;var _0x36cb10={};for(var _0x5bbe69=0x0,_0x197bee=_0x32f16a[_0x591c('0x37')];_0x5bbe69<_0x197bee;_0x5bbe69++){if(!_0x36cb10['hasOwnProperty'](_0x32f16a[_0x5bbe69][_0x591c('0x67')])){_0x36cb10[_0x32f16a[_0x5bbe69][_0x591c('0x67')]]=needsEncapsulation(_0x32f16a[_0x5bbe69]['question'])?encapsulate(_0x32f16a[_0x5bbe69]['question']):_0x32f16a[_0x5bbe69][_0x591c('0x68')];}}var _0xf26690=[],_0x7eaaee={};for(var _0x48931c=0x0,_0x59d91a=_0x545905['length'];_0x48931c<_0x59d91a;_0x48931c++){_0x7eaaee={'ProjectId':_0x6473f9[_0x591c('0x44')]['id'],'SessionId':_0x545905[_0x48931c]['id'],'StartTime':moment(_0x545905[_0x48931c]['starttime'])[_0x591c('0x69')]('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x54f7d5=0x0,_0x4768b4=_0x32f16a[_0x591c('0x37')];_0x54f7d5<_0x4768b4;_0x54f7d5++){if(_0x32f16a[_0x54f7d5][_0x591c('0x6a')]==_0x545905[_0x48931c]['id']&&_0x36cb10[_0x591c('0x5d')](_0x32f16a[_0x54f7d5][_0x591c('0x67')])){_0x7eaaee[_0x36cb10[_0x32f16a[_0x54f7d5]['questionId']]]=_0x32f16a[_0x54f7d5]['answer'];}}for(var _0xbcd6a5 in _0x36cb10){if(!_0x7eaaee[_0x591c('0x5d')](_0x36cb10[_0xbcd6a5])){_0x7eaaee[_0x36cb10[_0xbcd6a5]]=null;}}_0xf26690[_0x591c('0x6b')](_0x7eaaee);}return _0xf26690;}})[_0x591c('0x22')](function(_0x333ca5){if(!_['isEmpty'](_0x333ca5)){var _0x72fdf3=toCsv(_0x333ca5);var _0xc8b12a=Date[_0x591c('0x6c')]();fs['writeFileSync'](util[_0x591c('0x69')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x6473f9['params']['id'],_0xc8b12a),_0x72fdf3);_0x10efba[_0x591c('0x6d')](_0x591c('0x6e'),_0x591c('0x6f')+util[_0x591c('0x69')](_0x591c('0x70'),_0x6473f9[_0x591c('0x44')]['id'],_0xc8b12a));_0x10efba[_0x591c('0x6d')]('Content-type',_0x591c('0x71'));return _0x10efba[_0x591c('0x72')](util[_0x591c('0x69')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x6473f9['params']['id'],_0xc8b12a));}else{return _0x10efba['sendStatus'](0xcc);}})[_0x591c('0x49')](handleError(_0x10efba,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index ae7ea36..ca26fd9 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 _0x5636=['./jscriptyProject.attributes','exports','define','JscriptyProject','jscripty_projects','lodash','util','bluebird','request-promise','path','../../config/environment'];(function(_0x138a26,_0x526219){var _0x5cccae=function(_0x3e2888){while(--_0x3e2888){_0x138a26['push'](_0x138a26['shift']());}};_0x5cccae(++_0x526219);}(_0x5636,0x102));var _0x6563=function(_0x1750b2,_0x8f284a){_0x1750b2=_0x1750b2-0x0;var _0x444b44=_0x5636[_0x1750b2];return _0x444b44;};'use strict';var _=require(_0x6563('0x0'));var util=require(_0x6563('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x6563('0x2'));var rp=require(_0x6563('0x3'));var fs=require('fs');var path=require(_0x6563('0x4'));var rimraf=require('rimraf');var config=require(_0x6563('0x5'));var attributes=require(_0x6563('0x6'));module[_0x6563('0x7')]=function(_0x39792f,_0x29f687){return _0x39792f[_0x6563('0x8')](_0x6563('0x9'),attributes,{'tableName':_0x6563('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9879=['request-promise','path','rimraf','../../config/environment','./jscriptyProject.attributes','exports','define','jscripty_projects','lodash','util','../../config/logger','moment'];(function(_0x77d76e,_0x106ed2){var _0x5620c8=function(_0x481b37){while(--_0x481b37){_0x77d76e['push'](_0x77d76e['shift']());}};_0x5620c8(++_0x106ed2);}(_0x9879,0x98));var _0x9987=function(_0x308279,_0x515b74){_0x308279=_0x308279-0x0;var _0xf33ea7=_0x9879[_0x308279];return _0xf33ea7;};'use strict';var _=require(_0x9987('0x0'));var util=require(_0x9987('0x1'));var logger=require(_0x9987('0x2'))('api');var moment=require(_0x9987('0x3'));var BPromise=require('bluebird');var rp=require(_0x9987('0x4'));var fs=require('fs');var path=require(_0x9987('0x5'));var rimraf=require(_0x9987('0x6'));var config=require(_0x9987('0x7'));var attributes=require(_0x9987('0x8'));module[_0x9987('0x9')]=function(_0x4258df,_0x4d479d){return _0x4258df[_0x9987('0xa')]('JscriptyProject',attributes,{'tableName':_0x9987('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 c190c61..e89d9be 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 _0xe706=['http','request','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x27da15,_0x272d0a){var _0x5042ff=function(_0x1d005f){while(--_0x1d005f){_0x27da15['push'](_0x27da15['shift']());}};_0x5042ff(++_0x272d0a);}(_0xe706,0xa3));var _0x6e70=function(_0x1b0c08,_0xd7531f){_0x1b0c08=_0x1b0c08-0x0;var _0x123dbf=_0xe706[_0x1b0c08];return _0x123dbf;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e70('0x3'));var fs=require('fs');var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var utils=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var config=require(_0x6e70('0x9'));var jayson=require(_0x6e70('0xa'));var client=jayson[_0x6e70('0xb')][_0x6e70('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){return client[_0x6e70('0xd')](_0x36357b,_0x45a2d4)[_0x6e70('0xe')](function(_0x25e61c){logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,_0x6e70('0x11'));logger[_0x6e70('0x12')](_0x6e70('0x13'),_0x293ce7,_0x6e70('0x11'),JSON['stringify'](_0x25e61c));if(_0x25e61c['error']){if(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x15')]===0x1f4){logger[_0x6e70('0x14')](_0x6e70('0x10'),_0x293ce7,_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);return _0x3c4843(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);}logger['error']('JscriptyProject,\x20%s,\x20%s',_0x293ce7,_0x25e61c['error'][_0x6e70('0x16')]);return _0x188ed3(_0x25e61c['error']['message']);}else{logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,'request\x20sent');_0x188ed3(_0x25e61c[_0x6e70('0x17')]['message']);}})[_0x6e70('0x18')](function(_0x161f23){logger['error']('JscriptyProject,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});} \ No newline at end of file +var _0x70e0=['code','JscriptyProject,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x36355f,_0xb1be37){var _0x239d9=function(_0x1eb5b4){while(--_0x1eb5b4){_0x36355f['push'](_0x36355f['shift']());}};_0x239d9(++_0xb1be37);}(_0x70e0,0x17b));var _0x070e=function(_0xdc3296,_0x481586){_0xdc3296=_0xdc3296-0x0;var _0x56abea=_0x70e0[_0xdc3296];return _0x56abea;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x070e('0x3'));var db=require(_0x070e('0x4'))['db'];var utils=require(_0x070e('0x5'));var logger=require(_0x070e('0x6'))('rpc');var config=require(_0x070e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x070e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56e420,_0x5032e5,_0x35ab0c){return new BPromise(function(_0x1e11f0,_0x604664){return client[_0x070e('0x9')](_0x56e420,_0x35ab0c)[_0x070e('0xa')](function(_0x68a09e){logger[_0x070e('0xb')]('JscriptyProject,\x20%s,\x20%s',_0x5032e5,'request\x20sent');logger[_0x070e('0xc')](_0x070e('0xd'),_0x5032e5,_0x070e('0xe'),JSON[_0x070e('0xf')](_0x68a09e));if(_0x68a09e[_0x070e('0x10')]){if(_0x68a09e[_0x070e('0x10')][_0x070e('0x11')]===0x1f4){logger[_0x070e('0x10')](_0x070e('0x12'),_0x5032e5,_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);return _0x604664(_0x68a09e['error']['message']);}logger[_0x070e('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('JscriptyProject,\x20%s,\x20%s',_0x5032e5,_0x070e('0xe'));_0x1e11f0(_0x68a09e[_0x070e('0x14')][_0x070e('0x13')]);}})[_0x070e('0x15')](function(_0x5bc71e){logger['error'](_0x070e('0x12'),_0x5032e5,_0x5bc71e);_0x604664(_0x5bc71e);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index ae77842..6ff5530 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 _0x17cd=['../../components/interaction/service','../../config/environment','get','isAuthenticated','describe','/:id','show','post','create','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x560ad4,_0x30238d){var _0x167c9c=function(_0x4004e1){while(--_0x4004e1){_0x560ad4['push'](_0x560ad4['shift']());}};_0x167c9c(++_0x30238d);}(_0x17cd,0x160));var _0xd17c=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0x17cd[_0x5c351c];return _0x26f3b3;};'use strict';var multer=require(_0xd17c('0x0'));var util=require(_0xd17c('0x1'));var path=require(_0xd17c('0x2'));var timeout=require(_0xd17c('0x3'));var express=require(_0xd17c('0x4'));var router=express[_0xd17c('0x5')]();var fs_extra=require(_0xd17c('0x6'));var auth=require(_0xd17c('0x7'));var interaction=require(_0xd17c('0x8'));var config=require(_0xd17c('0x9'));var controller=require('./jscriptyQuestionReport.controller');router[_0xd17c('0xa')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/describe',auth[_0xd17c('0xb')](),controller[_0xd17c('0xc')]);router[_0xd17c('0xa')](_0xd17c('0xd'),auth[_0xd17c('0xb')](),controller[_0xd17c('0xe')]);router[_0xd17c('0xf')]('/',auth['isAuthenticated'](),controller[_0xd17c('0x10')]);router['put'](_0xd17c('0xd'),auth[_0xd17c('0xb')](),controller['update']);router[_0xd17c('0x11')](_0xd17c('0xd'),auth[_0xd17c('0xb')](),controller[_0xd17c('0x12')]);module[_0xd17c('0x13')]=router; \ No newline at end of file +var _0x2352=['show','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id'];(function(_0x547b60,_0x45eb3f){var _0x5a5440=function(_0x1b0895){while(--_0x1b0895){_0x547b60['push'](_0x547b60['shift']());}};_0x5a5440(++_0x45eb3f);}(_0x2352,0x1aa));var _0x2235=function(_0x3c8453,_0x4f09ee){_0x3c8453=_0x3c8453-0x0;var _0x4a6f8e=_0x2352[_0x3c8453];return _0x4a6f8e;};'use strict';var multer=require(_0x2235('0x0'));var util=require(_0x2235('0x1'));var path=require(_0x2235('0x2'));var timeout=require(_0x2235('0x3'));var express=require(_0x2235('0x4'));var router=express['Router']();var fs_extra=require(_0x2235('0x5'));var auth=require(_0x2235('0x6'));var interaction=require(_0x2235('0x7'));var config=require(_0x2235('0x8'));var controller=require('./jscriptyQuestionReport.controller');router[_0x2235('0x9')]('/',auth[_0x2235('0xa')](),controller['index']);router[_0x2235('0x9')](_0x2235('0xb'),auth[_0x2235('0xa')](),controller[_0x2235('0xc')]);router[_0x2235('0x9')](_0x2235('0xd'),auth['isAuthenticated'](),controller[_0x2235('0xe')]);router['post']('/',auth[_0x2235('0xa')](),controller[_0x2235('0xf')]);router[_0x2235('0x10')]('/:id',auth[_0x2235('0xa')](),controller[_0x2235('0x11')]);router[_0x2235('0x12')]('/:id',auth[_0x2235('0xa')](),controller[_0x2235('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 365bd71..6b7d68d 100644 --- a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js +++ b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0x7a54,0x106));var _0x47a5=function(_0x3fd2f7,_0x5c582c){_0x3fd2f7=_0x3fd2f7-0x0;var _0x5e4500=_0x7a54[_0x3fd2f7];return _0x5e4500;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'question':{'type':Sequelize[_0x47a5('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x47a5('0x3'))},'membername':{'type':Sequelize[_0x47a5('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x47a5('0x4')]},'uniqueid':{'type':Sequelize[_0x47a5('0x4')]},'calleridname':{'type':Sequelize[_0x47a5('0x4')]},'calleridnum':{'type':Sequelize[_0x47a5('0x4')]},'questionId':{'type':Sequelize[_0x47a5('0x4')]}}; \ No newline at end of file +var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0x7a54,0x106));var _0x47a5=function(_0x1bcd34,_0x2597ec){_0x1bcd34=_0x1bcd34-0x0;var _0x403d57=_0x7a54[_0x1bcd34];return _0x403d57;};'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 7d2ac50..718db98 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 _0x4a53=['filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','VIRTUAL','filter','merge','options','include','findAll','rows','catch','includeAll','create','body','find','params','describe','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','limit','undefined','count','offset','set','Content-Range','json','reject','save','update','then','destroy','error','stack','name','send','index','map','JscriptyQuestionReport','rawAttributes','fieldName','type','key','model','query','keys'];(function(_0x2f1b35,_0x4e02c8){var _0x4597c6=function(_0x2cedd9){while(--_0x2cedd9){_0x2f1b35['push'](_0x2f1b35['shift']());}};_0x4597c6(++_0x4e02c8);}(_0x4a53,0x19a));var _0x34a5=function(_0xeeb659,_0x2952f9){_0xeeb659=_0xeeb659-0x0;var _0x39f8fd=_0x4a53[_0xeeb659];return _0x39f8fd;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x34a5('0x0'));var rp=require(_0x34a5('0x1'));var moment=require(_0x34a5('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x34a5('0x3'));var util=require(_0x34a5('0x4'));var path=require(_0x34a5('0x5'));var sox=require('sox');var csv=require(_0x34a5('0x6'));var ejs=require(_0x34a5('0x7'));var fs=require('fs');var fs_extra=require(_0x34a5('0x8'));var _=require(_0x34a5('0x9'));var squel=require(_0x34a5('0xa'));var crypto=require('crypto');var jsforce=require(_0x34a5('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x34a5('0x6'));var querystring=require(_0x34a5('0xc'));var Papa=require(_0x34a5('0xd'));var Redis=require('ioredis');var authService=require(_0x34a5('0xe'));var qs=require(_0x34a5('0xf'));var as=require(_0x34a5('0x10'));var hardwareService=require(_0x34a5('0x11'));var logger=require(_0x34a5('0x12'))(_0x34a5('0x13'));var utils=require(_0x34a5('0x14'));var config=require(_0x34a5('0x15'));var licenseUtil=require(_0x34a5('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x162b0c,_0xbc5cc6){_0xbc5cc6=_0xbc5cc6||0xcc;return function(_0x5907fa){if(_0x5907fa){return _0x162b0c[_0x34a5('0x17')](_0xbc5cc6);}return _0x162b0c[_0x34a5('0x18')](_0xbc5cc6)[_0x34a5('0x19')]();};}function respondWithResult(_0x1cb447,_0x3d1857){_0x3d1857=_0x3d1857||0xc8;return function(_0x239089){if(_0x239089){return _0x1cb447[_0x34a5('0x18')](_0x3d1857)['json'](_0x239089);}};}function respondWithFilteredResult(_0x495522,_0x4477c3){return function(_0x58b751){if(_0x58b751){var _0x8f7219=typeof _0x4477c3['offset']==='undefined'&&typeof _0x4477c3[_0x34a5('0x1a')]===_0x34a5('0x1b');var _0x2dfb03=_0x58b751[_0x34a5('0x1c')];var _0x4f7f5f=_0x8f7219?0x0:_0x4477c3['offset'];var _0x27da44=_0x8f7219?_0x58b751[_0x34a5('0x1c')]:_0x4477c3[_0x34a5('0x1d')]+_0x4477c3[_0x34a5('0x1a')];var _0x23998f;if(_0x27da44>=_0x2dfb03){_0x27da44=_0x2dfb03;_0x23998f=0xc8;}else{_0x23998f=0xce;}_0x495522[_0x34a5('0x18')](_0x23998f);return _0x495522[_0x34a5('0x1e')](_0x34a5('0x1f'),_0x4f7f5f+'-'+_0x27da44+'/'+_0x2dfb03)[_0x34a5('0x20')](_0x58b751);}return null;};}function patchUpdates(_0x5bd91c){return function(_0x3b986e){try{jsonpatch['apply'](_0x3b986e,_0x5bd91c,!![]);}catch(_0x6701ba){return BPromise[_0x34a5('0x21')](_0x6701ba);}return _0x3b986e[_0x34a5('0x22')]();};}function saveUpdates(_0x57d680,_0xd13627){return function(_0x72bf68){if(_0x72bf68){return _0x72bf68[_0x34a5('0x23')](_0x57d680)[_0x34a5('0x24')](function(_0x403244){return _0x403244;});}return null;};}function removeEntity(_0x5cd0fd,_0xf30276){return function(_0x48901c){if(_0x48901c){return _0x48901c[_0x34a5('0x25')]()[_0x34a5('0x24')](function(){_0x5cd0fd[_0x34a5('0x18')](0xcc)[_0x34a5('0x19')]();});}};}function handleEntityNotFound(_0x474a0a,_0xf0336d){return function(_0x2ebb84){if(!_0x2ebb84){_0x474a0a[_0x34a5('0x17')](0x194);}return _0x2ebb84;};}function handleError(_0x16c30d,_0x147e59){_0x147e59=_0x147e59||0x1f4;return function(_0x532b8d){logger[_0x34a5('0x26')](_0x532b8d[_0x34a5('0x27')]);if(_0x532b8d['name']){delete _0x532b8d[_0x34a5('0x28')];}_0x16c30d['status'](_0x147e59)[_0x34a5('0x29')](_0x532b8d);};}exports[_0x34a5('0x2a')]=function(_0x37071d,_0x384e77){var _0x3a73ff={},_0x234cf1={},_0x48f5a0={'count':0x0,'rows':[]};var _0x43303c=_[_0x34a5('0x2b')](db[_0x34a5('0x2c')][_0x34a5('0x2d')],function(_0x5e3ecb){return{'name':_0x5e3ecb[_0x34a5('0x2e')],'type':_0x5e3ecb[_0x34a5('0x2f')][_0x34a5('0x30')]};});_0x234cf1[_0x34a5('0x31')]=_[_0x34a5('0x2b')](_0x43303c,_0x34a5('0x28'));_0x234cf1[_0x34a5('0x32')]=_[_0x34a5('0x33')](_0x37071d[_0x34a5('0x32')]);_0x234cf1[_0x34a5('0x34')]=_[_0x34a5('0x35')](_0x234cf1[_0x34a5('0x31')],_0x234cf1[_0x34a5('0x32')]);_0x3a73ff[_0x34a5('0x36')]=_['intersection'](_0x234cf1['model'],qs[_0x34a5('0x37')](_0x37071d['query'][_0x34a5('0x37')]));_0x3a73ff['attributes']=_0x3a73ff[_0x34a5('0x36')][_0x34a5('0x38')]?_0x3a73ff['attributes']:_0x234cf1[_0x34a5('0x31')];if(!_0x37071d[_0x34a5('0x32')][_0x34a5('0x39')](_0x34a5('0x3a'))){_0x3a73ff[_0x34a5('0x1a')]=qs[_0x34a5('0x1a')](_0x37071d[_0x34a5('0x32')]['limit']);_0x3a73ff['offset']=qs[_0x34a5('0x1d')](_0x37071d['query'][_0x34a5('0x1d')]);}_0x3a73ff[_0x34a5('0x3b')]=qs[_0x34a5('0x3c')](_0x37071d['query'][_0x34a5('0x3c')]);_0x3a73ff['where']=qs[_0x34a5('0x34')](_[_0x34a5('0x3d')](_0x37071d[_0x34a5('0x32')],_0x234cf1[_0x34a5('0x34')]),_0x43303c);if(_0x37071d[_0x34a5('0x32')]['filter']){_0x3a73ff[_0x34a5('0x3e')]=_['merge'](_0x3a73ff[_0x34a5('0x3e')],{'$or':_[_0x34a5('0x2b')](_0x43303c,function(_0x37e27d){if(_0x37e27d['type']!==_0x34a5('0x3f')){var _0x1ae86b={};_0x1ae86b[_0x37e27d[_0x34a5('0x28')]]={'$like':'%'+_0x37071d['query'][_0x34a5('0x40')]+'%'};return _0x1ae86b;}})});}_0x3a73ff=_[_0x34a5('0x41')]({},_0x3a73ff,_0x37071d[_0x34a5('0x42')]);var _0x1f67b4={'where':_0x3a73ff[_0x34a5('0x3e')]};return db[_0x34a5('0x2c')][_0x34a5('0x1c')](_0x1f67b4)[_0x34a5('0x24')](function(_0xe5ffa2){_0x48f5a0[_0x34a5('0x1c')]=_0xe5ffa2;if(_0x37071d['query']['includeAll']){_0x3a73ff[_0x34a5('0x43')]=[{'all':!![]}];}return db[_0x34a5('0x2c')][_0x34a5('0x44')](_0x3a73ff);})[_0x34a5('0x24')](function(_0x302407){_0x48f5a0[_0x34a5('0x45')]=_0x302407;return _0x48f5a0;})[_0x34a5('0x24')](respondWithFilteredResult(_0x384e77,_0x3a73ff))[_0x34a5('0x46')](handleError(_0x384e77,null));};exports['show']=function(_0x3e9cd9,_0x3c5964){var _0x5a56b9={'raw':!![],'where':{'id':_0x3e9cd9['params']['id']}},_0x1c7ff2={};_0x1c7ff2['model']=_[_0x34a5('0x33')](db[_0x34a5('0x2c')][_0x34a5('0x2d')]);_0x1c7ff2[_0x34a5('0x32')]=_[_0x34a5('0x33')](_0x3e9cd9[_0x34a5('0x32')]);_0x1c7ff2['filters']=_['intersection'](_0x1c7ff2[_0x34a5('0x31')],_0x1c7ff2[_0x34a5('0x32')]);_0x5a56b9[_0x34a5('0x36')]=_[_0x34a5('0x35')](_0x1c7ff2['model'],qs[_0x34a5('0x37')](_0x3e9cd9[_0x34a5('0x32')]['fields']));_0x5a56b9[_0x34a5('0x36')]=_0x5a56b9[_0x34a5('0x36')][_0x34a5('0x38')]?_0x5a56b9[_0x34a5('0x36')]:_0x1c7ff2['model'];if(_0x3e9cd9['query'][_0x34a5('0x47')]){_0x5a56b9[_0x34a5('0x43')]=[{'all':!![]}];}_0x5a56b9=_[_0x34a5('0x41')]({},_0x5a56b9,_0x3e9cd9[_0x34a5('0x42')]);return db[_0x34a5('0x2c')]['find'](_0x5a56b9)[_0x34a5('0x24')](handleEntityNotFound(_0x3c5964,null))[_0x34a5('0x24')](respondWithResult(_0x3c5964,null))[_0x34a5('0x46')](handleError(_0x3c5964,null));};exports[_0x34a5('0x48')]=function(_0x34007,_0x22513e){return db[_0x34a5('0x2c')][_0x34a5('0x48')](_0x34007[_0x34a5('0x49')],{})[_0x34a5('0x24')](respondWithResult(_0x22513e,0xc9))[_0x34a5('0x46')](handleError(_0x22513e,null));};exports[_0x34a5('0x23')]=function(_0xf654c5,_0xe31385){if(_0xf654c5[_0x34a5('0x49')]['id']){delete _0xf654c5[_0x34a5('0x49')]['id'];}return db[_0x34a5('0x2c')][_0x34a5('0x4a')]({'where':{'id':_0xf654c5[_0x34a5('0x4b')]['id']}})[_0x34a5('0x24')](handleEntityNotFound(_0xe31385,null))[_0x34a5('0x24')](saveUpdates(_0xf654c5[_0x34a5('0x49')],null))[_0x34a5('0x24')](respondWithResult(_0xe31385,null))[_0x34a5('0x46')](handleError(_0xe31385,null));};exports['destroy']=function(_0x1f3f48,_0x532793){return db[_0x34a5('0x2c')][_0x34a5('0x4a')]({'where':{'id':_0x1f3f48[_0x34a5('0x4b')]['id']}})['then'](handleEntityNotFound(_0x532793,null))[_0x34a5('0x24')](removeEntity(_0x532793,null))[_0x34a5('0x46')](handleError(_0x532793,null));};exports['describe']=function(_0x21635a,_0x59241c){return db[_0x34a5('0x2c')][_0x34a5('0x4c')]()[_0x34a5('0x24')](respondWithResult(_0x59241c,null))[_0x34a5('0x46')](handleError(_0x59241c,null));}; \ No newline at end of file +var _0xfaba=['limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','sendStatus','error','stack','name','send','index','map','JscriptyQuestionReport','rawAttributes','type','key','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','find','create','body','params','destroy','describe','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','undefined'];(function(_0x5d2507,_0x556fac){var _0x198c07=function(_0x2e2b6b){while(--_0x2e2b6b){_0x5d2507['push'](_0x5d2507['shift']());}};_0x198c07(++_0x556fac);}(_0xfaba,0x81));var _0xafab=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfaba[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xafab('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xafab('0x1'));var rp=require(_0xafab('0x2'));var moment=require('moment');var BPromise=require(_0xafab('0x3'));var Mustache=require(_0xafab('0x4'));var util=require(_0xafab('0x5'));var path=require(_0xafab('0x6'));var sox=require(_0xafab('0x7'));var csv=require(_0xafab('0x8'));var ejs=require(_0xafab('0x9'));var fs=require('fs');var fs_extra=require(_0xafab('0xa'));var _=require(_0xafab('0xb'));var squel=require(_0xafab('0xc'));var crypto=require(_0xafab('0xd'));var jsforce=require(_0xafab('0xe'));var deskjs=require(_0xafab('0xf'));var toCsv=require(_0xafab('0x8'));var querystring=require(_0xafab('0x10'));var Papa=require(_0xafab('0x11'));var Redis=require(_0xafab('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xafab('0x13'));var logger=require('../../config/logger')(_0xafab('0x14'));var utils=require('../../config/utils');var config=require(_0xafab('0x15'));var licenseUtil=require(_0xafab('0x16'));var db=require(_0xafab('0x17'))['db'];function respondWithStatusCode(_0x28036,_0x5f447e){_0x5f447e=_0x5f447e||0xcc;return function(_0x5565b1){if(_0x5565b1){return _0x28036['sendStatus'](_0x5f447e);}return _0x28036[_0xafab('0x18')](_0x5f447e)[_0xafab('0x19')]();};}function respondWithResult(_0x163a78,_0x1eb991){_0x1eb991=_0x1eb991||0xc8;return function(_0x44c0c1){if(_0x44c0c1){return _0x163a78[_0xafab('0x18')](_0x1eb991)['json'](_0x44c0c1);}};}function respondWithFilteredResult(_0x8ac783,_0x258587){return function(_0x36e72c){if(_0x36e72c){var _0x4248dc=typeof _0x258587['offset']===_0xafab('0x1a')&&typeof _0x258587[_0xafab('0x1b')]===_0xafab('0x1a');var _0x5347a1=_0x36e72c[_0xafab('0x1c')];var _0x216ffc=_0x4248dc?0x0:_0x258587[_0xafab('0x1d')];var _0x560f38=_0x4248dc?_0x36e72c[_0xafab('0x1c')]:_0x258587[_0xafab('0x1d')]+_0x258587[_0xafab('0x1b')];var _0x1ac5cb;if(_0x560f38>=_0x5347a1){_0x560f38=_0x5347a1;_0x1ac5cb=0xc8;}else{_0x1ac5cb=0xce;}_0x8ac783['status'](_0x1ac5cb);return _0x8ac783[_0xafab('0x1e')](_0xafab('0x1f'),_0x216ffc+'-'+_0x560f38+'/'+_0x5347a1)[_0xafab('0x20')](_0x36e72c);}return null;};}function patchUpdates(_0x1c369a){return function(_0x345ccb){try{jsonpatch[_0xafab('0x21')](_0x345ccb,_0x1c369a,!![]);}catch(_0x5618e3){return BPromise[_0xafab('0x22')](_0x5618e3);}return _0x345ccb[_0xafab('0x23')]();};}function saveUpdates(_0x2c4803,_0x1bb060){return function(_0x26a3fa){if(_0x26a3fa){return _0x26a3fa[_0xafab('0x24')](_0x2c4803)[_0xafab('0x25')](function(_0x2a3754){return _0x2a3754;});}return null;};}function removeEntity(_0x4ec548,_0x3eab7a){return function(_0x473276){if(_0x473276){return _0x473276['destroy']()[_0xafab('0x25')](function(){_0x4ec548['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x32130b,_0x48640e){return function(_0x35cc00){if(!_0x35cc00){_0x32130b[_0xafab('0x26')](0x194);}return _0x35cc00;};}function handleError(_0x460d9e,_0x1a57f1){_0x1a57f1=_0x1a57f1||0x1f4;return function(_0x2d897a){logger[_0xafab('0x27')](_0x2d897a[_0xafab('0x28')]);if(_0x2d897a['name']){delete _0x2d897a[_0xafab('0x29')];}_0x460d9e['status'](_0x1a57f1)[_0xafab('0x2a')](_0x2d897a);};}exports[_0xafab('0x2b')]=function(_0x30ef52,_0x4f0e77){var _0x4c0f47={},_0x2b9d76={},_0x526a38={'count':0x0,'rows':[]};var _0x3c12cb=_[_0xafab('0x2c')](db[_0xafab('0x2d')][_0xafab('0x2e')],function(_0x82c010){return{'name':_0x82c010['fieldName'],'type':_0x82c010[_0xafab('0x2f')][_0xafab('0x30')]};});_0x2b9d76[_0xafab('0x31')]=_[_0xafab('0x2c')](_0x3c12cb,_0xafab('0x29'));_0x2b9d76['query']=_[_0xafab('0x32')](_0x30ef52['query']);_0x2b9d76[_0xafab('0x33')]=_['intersection'](_0x2b9d76[_0xafab('0x31')],_0x2b9d76['query']);_0x4c0f47['attributes']=_[_0xafab('0x34')](_0x2b9d76[_0xafab('0x31')],qs['fields'](_0x30ef52[_0xafab('0x35')][_0xafab('0x36')]));_0x4c0f47[_0xafab('0x37')]=_0x4c0f47[_0xafab('0x37')][_0xafab('0x38')]?_0x4c0f47[_0xafab('0x37')]:_0x2b9d76['model'];if(!_0x30ef52[_0xafab('0x35')][_0xafab('0x39')](_0xafab('0x3a'))){_0x4c0f47['limit']=qs[_0xafab('0x1b')](_0x30ef52[_0xafab('0x35')]['limit']);_0x4c0f47[_0xafab('0x1d')]=qs[_0xafab('0x1d')](_0x30ef52['query']['offset']);}_0x4c0f47[_0xafab('0x3b')]=qs[_0xafab('0x3c')](_0x30ef52[_0xafab('0x35')][_0xafab('0x3c')]);_0x4c0f47['where']=qs[_0xafab('0x33')](_[_0xafab('0x3d')](_0x30ef52[_0xafab('0x35')],_0x2b9d76[_0xafab('0x33')]),_0x3c12cb);if(_0x30ef52[_0xafab('0x35')][_0xafab('0x3e')]){_0x4c0f47[_0xafab('0x3f')]=_[_0xafab('0x40')](_0x4c0f47[_0xafab('0x3f')],{'$or':_[_0xafab('0x2c')](_0x3c12cb,function(_0x27635d){if(_0x27635d[_0xafab('0x2f')]!==_0xafab('0x41')){var _0x2dc837={};_0x2dc837[_0x27635d[_0xafab('0x29')]]={'$like':'%'+_0x30ef52[_0xafab('0x35')][_0xafab('0x3e')]+'%'};return _0x2dc837;}})});}_0x4c0f47=_[_0xafab('0x40')]({},_0x4c0f47,_0x30ef52['options']);var _0x49db92={'where':_0x4c0f47[_0xafab('0x3f')]};return db[_0xafab('0x2d')][_0xafab('0x1c')](_0x49db92)[_0xafab('0x25')](function(_0x5b17f1){_0x526a38[_0xafab('0x1c')]=_0x5b17f1;if(_0x30ef52['query'][_0xafab('0x42')]){_0x4c0f47[_0xafab('0x43')]=[{'all':!![]}];}return db[_0xafab('0x2d')][_0xafab('0x44')](_0x4c0f47);})[_0xafab('0x25')](function(_0x4d1cb1){_0x526a38[_0xafab('0x45')]=_0x4d1cb1;return _0x526a38;})[_0xafab('0x25')](respondWithFilteredResult(_0x4f0e77,_0x4c0f47))[_0xafab('0x46')](handleError(_0x4f0e77,null));};exports[_0xafab('0x47')]=function(_0x539704,_0x19d5b7){var _0x246c1d={'raw':!![],'where':{'id':_0x539704['params']['id']}},_0xfdb150={};_0xfdb150[_0xafab('0x31')]=_[_0xafab('0x32')](db['JscriptyQuestionReport'][_0xafab('0x2e')]);_0xfdb150[_0xafab('0x35')]=_['keys'](_0x539704[_0xafab('0x35')]);_0xfdb150[_0xafab('0x33')]=_['intersection'](_0xfdb150[_0xafab('0x31')],_0xfdb150[_0xafab('0x35')]);_0x246c1d[_0xafab('0x37')]=_[_0xafab('0x34')](_0xfdb150[_0xafab('0x31')],qs['fields'](_0x539704[_0xafab('0x35')][_0xafab('0x36')]));_0x246c1d[_0xafab('0x37')]=_0x246c1d['attributes'][_0xafab('0x38')]?_0x246c1d[_0xafab('0x37')]:_0xfdb150[_0xafab('0x31')];if(_0x539704['query'][_0xafab('0x42')]){_0x246c1d[_0xafab('0x43')]=[{'all':!![]}];}_0x246c1d=_['merge']({},_0x246c1d,_0x539704['options']);return db['JscriptyQuestionReport'][_0xafab('0x48')](_0x246c1d)[_0xafab('0x25')](handleEntityNotFound(_0x19d5b7,null))['then'](respondWithResult(_0x19d5b7,null))[_0xafab('0x46')](handleError(_0x19d5b7,null));};exports[_0xafab('0x49')]=function(_0x150f55,_0x2daa0e){return db['JscriptyQuestionReport']['create'](_0x150f55[_0xafab('0x4a')],{})[_0xafab('0x25')](respondWithResult(_0x2daa0e,0xc9))[_0xafab('0x46')](handleError(_0x2daa0e,null));};exports[_0xafab('0x24')]=function(_0x120c4e,_0x885de2){if(_0x120c4e[_0xafab('0x4a')]['id']){delete _0x120c4e['body']['id'];}return db[_0xafab('0x2d')][_0xafab('0x48')]({'where':{'id':_0x120c4e[_0xafab('0x4b')]['id']}})['then'](handleEntityNotFound(_0x885de2,null))[_0xafab('0x25')](saveUpdates(_0x120c4e[_0xafab('0x4a')],null))[_0xafab('0x25')](respondWithResult(_0x885de2,null))['catch'](handleError(_0x885de2,null));};exports[_0xafab('0x4c')]=function(_0x1a3e6a,_0x1a085b){return db[_0xafab('0x2d')][_0xafab('0x48')]({'where':{'id':_0x1a3e6a['params']['id']}})['then'](handleEntityNotFound(_0x1a085b,null))['then'](removeEntity(_0x1a085b,null))[_0xafab('0x46')](handleError(_0x1a085b,null));};exports[_0xafab('0x4d')]=function(_0x23f094,_0x1cab3a){return db[_0xafab('0x2d')][_0xafab('0x4d')]()[_0xafab('0x25')](respondWithResult(_0x1cab3a,null))['catch'](handleError(_0x1cab3a,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 7b9383e..2b7e933 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 _0x5e3b=['bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports','lodash','../../config/logger','api','moment'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x5e3b,0xc2));var _0xb5e3=function(_0x17ff62,_0x407c95){_0x17ff62=_0x17ff62-0x0;var _0x3ec97b=_0x5e3b[_0x17ff62];return _0x3ec97b;};'use strict';var _=require(_0xb5e3('0x0'));var util=require('util');var logger=require(_0xb5e3('0x1'))(_0xb5e3('0x2'));var moment=require(_0xb5e3('0x3'));var BPromise=require(_0xb5e3('0x4'));var rp=require(_0xb5e3('0x5'));var fs=require('fs');var path=require(_0xb5e3('0x6'));var rimraf=require(_0xb5e3('0x7'));var config=require(_0xb5e3('0x8'));var attributes=require(_0xb5e3('0x9'));module[_0xb5e3('0xa')]=function(_0x2e25b9,_0x348f02){return _0x2e25b9['define']('JscriptyQuestionReport',attributes,{'tableName':'report_jscripty_questions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbe29=['exports','define','report_jscripty_questions','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./jscriptyQuestionReport.attributes'];(function(_0xef5464,_0xdcfb9){var _0x13336d=function(_0x5e2624){while(--_0x5e2624){_0xef5464['push'](_0xef5464['shift']());}};_0x13336d(++_0xdcfb9);}(_0xbe29,0x9d));var _0x9be2=function(_0x4e5552,_0x19ec4e){_0x4e5552=_0x4e5552-0x0;var _0x60a338=_0xbe29[_0x4e5552];return _0x60a338;};'use strict';var _=require('lodash');var util=require(_0x9be2('0x0'));var logger=require(_0x9be2('0x1'))(_0x9be2('0x2'));var moment=require(_0x9be2('0x3'));var BPromise=require(_0x9be2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9be2('0x5'));var rimraf=require('rimraf');var config=require(_0x9be2('0x6'));var attributes=require(_0x9be2('0x7'));module[_0x9be2('0x8')]=function(_0x5bbe6d,_0x309544){return _0x5bbe6d[_0x9be2('0x9')]('JscriptyQuestionReport',attributes,{'tableName':_0x9be2('0xa'),'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 f0cef6e..41a5af3 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 _0x30c6=['client','then','info','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','JscriptyQuestionReport,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x11e76b,_0x2aef59){var _0xa0e8ec=function(_0x2a77b5){while(--_0x2a77b5){_0x11e76b['push'](_0x11e76b['shift']());}};_0xa0e8ec(++_0x2aef59);}(_0x30c6,0x96));var _0x630c=function(_0x3e1625,_0x1ff01b){_0x3e1625=_0x3e1625-0x0;var _0x2ac686=_0x30c6[_0x3e1625];return _0x2ac686;};'use strict';var _=require(_0x630c('0x0'));var util=require(_0x630c('0x1'));var moment=require(_0x630c('0x2'));var BPromise=require(_0x630c('0x3'));var rs=require(_0x630c('0x4'));var fs=require('fs');var Redis=require(_0x630c('0x5'));var db=require(_0x630c('0x6'))['db'];var utils=require(_0x630c('0x7'));var logger=require('../../config/logger')(_0x630c('0x8'));var config=require(_0x630c('0x9'));var jayson=require(_0x630c('0xa'));var client=jayson[_0x630c('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2d2d7d,_0x538bf3,_0x27e356){return new BPromise(function(_0x199dd8,_0x14822c){return client['request'](_0x2d2d7d,_0x27e356)[_0x630c('0xc')](function(_0x6a557a){logger[_0x630c('0xd')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x538bf3,_0x630c('0xe'));logger[_0x630c('0xf')](_0x630c('0x10'),_0x538bf3,'request\x20sent',JSON[_0x630c('0x11')](_0x6a557a));if(_0x6a557a[_0x630c('0x12')]){if(_0x6a557a['error'][_0x630c('0x13')]===0x1f4){logger[_0x630c('0x12')](_0x630c('0x14'),_0x538bf3,_0x6a557a[_0x630c('0x12')][_0x630c('0x15')]);return _0x14822c(_0x6a557a[_0x630c('0x12')][_0x630c('0x15')]);}logger[_0x630c('0x12')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x538bf3,_0x6a557a[_0x630c('0x12')]['message']);return _0x199dd8(_0x6a557a[_0x630c('0x12')][_0x630c('0x15')]);}else{logger['info'](_0x630c('0x14'),_0x538bf3,_0x630c('0xe'));_0x199dd8(_0x6a557a['result']['message']);}})[_0x630c('0x16')](function(_0x194e53){logger['error'](_0x630c('0x14'),_0x538bf3,_0x194e53);_0x14822c(_0x194e53);});});} \ No newline at end of file +var _0x146d=['http','request','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x41f15f,_0x1a39ef){var _0x269a71=function(_0x52c50e){while(--_0x52c50e){_0x41f15f['push'](_0x41f15f['shift']());}};_0x269a71(++_0x1a39ef);}(_0x146d,0x13c));var _0xd146=function(_0x4ffbb0,_0x5b28ea){_0x4ffbb0=_0x4ffbb0-0x0;var _0xd29dd8=_0x146d[_0x4ffbb0];return _0xd29dd8;};'use strict';var _=require(_0xd146('0x0'));var util=require(_0xd146('0x1'));var moment=require(_0xd146('0x2'));var BPromise=require(_0xd146('0x3'));var rs=require(_0xd146('0x4'));var fs=require('fs');var Redis=require(_0xd146('0x5'));var db=require(_0xd146('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xd146('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xd146('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x16c1bb,_0x46420c,_0x148b5b){return new BPromise(function(_0x513459,_0x3da450){return client[_0xd146('0x9')](_0x16c1bb,_0x148b5b)['then'](function(_0x4921b1){logger[_0xd146('0xa')](_0xd146('0xb'),_0x46420c,_0xd146('0xc'));logger['debug'](_0xd146('0xd'),_0x46420c,'request\x20sent',JSON[_0xd146('0xe')](_0x4921b1));if(_0x4921b1[_0xd146('0xf')]){if(_0x4921b1['error']['code']===0x1f4){logger[_0xd146('0xf')](_0xd146('0xb'),_0x46420c,_0x4921b1[_0xd146('0xf')]['message']);return _0x3da450(_0x4921b1['error']['message']);}logger['error'](_0xd146('0xb'),_0x46420c,_0x4921b1['error']['message']);return _0x513459(_0x4921b1[_0xd146('0xf')][_0xd146('0x10')]);}else{logger[_0xd146('0xa')](_0xd146('0xb'),_0x46420c,_0xd146('0xc'));_0x513459(_0x4921b1['result']['message']);}})[_0xd146('0x11')](function(_0xa5ce96){logger[_0xd146('0xf')](_0xd146('0xb'),_0x46420c,_0xa5ce96);_0x3da450(_0xa5ce96);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index a854836..610c467 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 _0x741c=['path','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','index','/describe','isAuthenticated','/:id','show','/:id/questions','post','create','put','update','delete','exports','multer','util'];(function(_0x4ae024,_0x2e3bfc){var _0x1b0f81=function(_0x52417d){while(--_0x52417d){_0x4ae024['push'](_0x4ae024['shift']());}};_0x1b0f81(++_0x2e3bfc);}(_0x741c,0x67));var _0xc741=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x741c[_0x19950b];return _0x3c6b41;};'use strict';var multer=require(_0xc741('0x0'));var util=require(_0xc741('0x1'));var path=require(_0xc741('0x2'));var timeout=require('connect-timeout');var express=require(_0xc741('0x3'));var router=express[_0xc741('0x4')]();var fs_extra=require(_0xc741('0x5'));var auth=require(_0xc741('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc741('0x7'));var controller=require('./jscriptySessionReport.controller');router[_0xc741('0x8')]('/',auth['isAuthenticated'](),controller[_0xc741('0x9')]);router['get'](_0xc741('0xa'),auth[_0xc741('0xb')](),controller['describe']);router['get'](_0xc741('0xc'),auth[_0xc741('0xb')](),controller[_0xc741('0xd')]);router['get'](_0xc741('0xe'),auth[_0xc741('0xb')](),controller['getQuestions']);router[_0xc741('0xf')]('/',auth['isAuthenticated'](),controller[_0xc741('0x10')]);router[_0xc741('0x11')]('/:id',auth[_0xc741('0xb')](),controller[_0xc741('0x12')]);router[_0xc741('0x13')](_0xc741('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0xc741('0x14')]=router; \ No newline at end of file +var _0xaad7=['get','isAuthenticated','index','/describe','describe','/:id','show','/:id/questions','post','create','update','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x44f974,_0x4db616){var _0x805dbd=function(_0x1a56b7){while(--_0x1a56b7){_0x44f974['push'](_0x44f974['shift']());}};_0x805dbd(++_0x4db616);}(_0xaad7,0x1b0));var _0x7aad=function(_0x4853be,_0x53f681){_0x4853be=_0x4853be-0x0;var _0xd5315e=_0xaad7[_0x4853be];return _0xd5315e;};'use strict';var multer=require(_0x7aad('0x0'));var util=require(_0x7aad('0x1'));var path=require('path');var timeout=require(_0x7aad('0x2'));var express=require(_0x7aad('0x3'));var router=express['Router']();var fs_extra=require(_0x7aad('0x4'));var auth=require(_0x7aad('0x5'));var interaction=require(_0x7aad('0x6'));var config=require(_0x7aad('0x7'));var controller=require('./jscriptySessionReport.controller');router[_0x7aad('0x8')]('/',auth[_0x7aad('0x9')](),controller[_0x7aad('0xa')]);router[_0x7aad('0x8')](_0x7aad('0xb'),auth[_0x7aad('0x9')](),controller[_0x7aad('0xc')]);router['get'](_0x7aad('0xd'),auth[_0x7aad('0x9')](),controller[_0x7aad('0xe')]);router[_0x7aad('0x8')](_0x7aad('0xf'),auth[_0x7aad('0x9')](),controller['getQuestions']);router[_0x7aad('0x10')]('/',auth[_0x7aad('0x9')](),controller[_0x7aad('0x11')]);router['put'](_0x7aad('0xd'),auth['isAuthenticated'](),controller[_0x7aad('0x12')]);router[_0x7aad('0x13')]('/:id',auth[_0x7aad('0x9')](),controller[_0x7aad('0x14')]);module[_0x7aad('0x15')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 004279f..83d3f14 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 _0x0c97=['DATE','starttime','setDataValue','endtime','STRING','BOOLEAN','moment','sequelize','exports'];(function(_0x45f66c,_0x4f1479){var _0x437493=function(_0x5a72c3){while(--_0x5a72c3){_0x45f66c['push'](_0x45f66c['shift']());}};_0x437493(++_0x4f1479);}(_0x0c97,0x9f));var _0x70c9=function(_0x12b8ec,_0x1655be){_0x12b8ec=_0x12b8ec-0x0;var _0x21af77=_0x0c97[_0x12b8ec];return _0x21af77;};'use strict';var moment=require(_0x70c9('0x0'));var Sequelize=require(_0x70c9('0x1'));module[_0x70c9('0x2')]={'starttime':{'type':Sequelize[_0x70c9('0x3')],'set':function(_0x3df8dc){this['setDataValue'](_0x70c9('0x4'),_0x3df8dc);this[_0x70c9('0x5')](_0x70c9('0x6'),moment()['format']('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize[_0x70c9('0x3')]},'membername':{'type':Sequelize[_0x70c9('0x7')]},'projectname':{'type':Sequelize[_0x70c9('0x7')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x70c9('0x7')]},'calleridnum':{'type':Sequelize[_0x70c9('0x7')]},'completed':{'type':Sequelize[_0x70c9('0x8')],'defaultValue':![]}}; \ No newline at end of file +var _0xaf97=['starttime','setDataValue','endtime','format','STRING','BOOLEAN','moment','sequelize','exports','DATE'];(function(_0x5bdf64,_0x4e5c71){var _0x323a2c=function(_0x1e3f51){while(--_0x1e3f51){_0x5bdf64['push'](_0x5bdf64['shift']());}};_0x323a2c(++_0x4e5c71);}(_0xaf97,0x15a));var _0x7af9=function(_0x5ba9d1,_0x4ef651){_0x5ba9d1=_0x5ba9d1-0x0;var _0x1bb891=_0xaf97[_0x5ba9d1];return _0x1bb891;};'use strict';var moment=require(_0x7af9('0x0'));var Sequelize=require(_0x7af9('0x1'));module[_0x7af9('0x2')]={'starttime':{'type':Sequelize[_0x7af9('0x3')],'set':function(_0x14c3e0){this['setDataValue'](_0x7af9('0x4'),_0x14c3e0);this[_0x7af9('0x5')](_0x7af9('0x6'),moment()[_0x7af9('0x7')]('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize[_0x7af9('0x3')]},'membername':{'type':Sequelize[_0x7af9('0x8')]},'projectname':{'type':Sequelize[_0x7af9('0x8')]},'queue':{'type':Sequelize[_0x7af9('0x8')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x7af9('0x8')]},'calleridnum':{'type':Sequelize[_0x7af9('0x8')]},'completed':{'type':Sequelize[_0x7af9('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 8af6064..996ac36 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 _0xb7c6=['hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','JscriptySessionReport','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','find','create','body','update','describe','SessionId','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','destroy','error','name','send','fieldName','type','model','map','query','keys','filters','intersection','fields','attributes','length'];(function(_0x53c506,_0x1c0fe8){var _0x165888=function(_0x46f0b6){while(--_0x46f0b6){_0x53c506['push'](_0x53c506['shift']());}};_0x165888(++_0x1c0fe8);}(_0xb7c6,0xb3));var _0x6b7c=function(_0x18d4b8,_0x46f7fd){_0x18d4b8=_0x18d4b8-0x0;var _0x39f157=_0xb7c6[_0x18d4b8];return _0x39f157;};'use strict';var emlformat=require(_0x6b7c('0x0'));var rimraf=require(_0x6b7c('0x1'));var zipdir=require(_0x6b7c('0x2'));var jsonpatch=require(_0x6b7c('0x3'));var rp=require(_0x6b7c('0x4'));var moment=require(_0x6b7c('0x5'));var BPromise=require(_0x6b7c('0x6'));var Mustache=require(_0x6b7c('0x7'));var util=require(_0x6b7c('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x6b7c('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x6b7c('0xa'));var crypto=require(_0x6b7c('0xb'));var jsforce=require(_0x6b7c('0xc'));var deskjs=require(_0x6b7c('0xd'));var toCsv=require(_0x6b7c('0x9'));var querystring=require(_0x6b7c('0xe'));var Papa=require('papaparse');var Redis=require(_0x6b7c('0xf'));var authService=require(_0x6b7c('0x10'));var qs=require(_0x6b7c('0x11'));var as=require(_0x6b7c('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6b7c('0x13'))('api');var utils=require(_0x6b7c('0x14'));var config=require(_0x6b7c('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x6b7c('0x16'))['db'];function respondWithStatusCode(_0x494d50,_0x5ef6e1){_0x5ef6e1=_0x5ef6e1||0xcc;return function(_0x4f769e){if(_0x4f769e){return _0x494d50[_0x6b7c('0x17')](_0x5ef6e1);}return _0x494d50[_0x6b7c('0x18')](_0x5ef6e1)[_0x6b7c('0x19')]();};}function respondWithResult(_0x33fbd1,_0x4fe0d3){_0x4fe0d3=_0x4fe0d3||0xc8;return function(_0x151d0a){if(_0x151d0a){return _0x33fbd1[_0x6b7c('0x18')](_0x4fe0d3)[_0x6b7c('0x1a')](_0x151d0a);}};}function respondWithFilteredResult(_0x4e6dc2,_0x326c4e){return function(_0x45dc5c){if(_0x45dc5c){var _0xf8d2d=typeof _0x326c4e['offset']===_0x6b7c('0x1b')&&typeof _0x326c4e[_0x6b7c('0x1c')]==='undefined';var _0x333e6e=_0x45dc5c[_0x6b7c('0x1d')];var _0x590821=_0xf8d2d?0x0:_0x326c4e[_0x6b7c('0x1e')];var _0x2913d1=_0xf8d2d?_0x45dc5c[_0x6b7c('0x1d')]:_0x326c4e[_0x6b7c('0x1e')]+_0x326c4e['limit'];var _0x488c51;if(_0x2913d1>=_0x333e6e){_0x2913d1=_0x333e6e;_0x488c51=0xc8;}else{_0x488c51=0xce;}_0x4e6dc2[_0x6b7c('0x18')](_0x488c51);return _0x4e6dc2[_0x6b7c('0x1f')](_0x6b7c('0x20'),_0x590821+'-'+_0x2913d1+'/'+_0x333e6e)[_0x6b7c('0x1a')](_0x45dc5c);}return null;};}function patchUpdates(_0x2dbf60){return function(_0x56f27d){try{jsonpatch[_0x6b7c('0x21')](_0x56f27d,_0x2dbf60,!![]);}catch(_0x5398ca){return BPromise[_0x6b7c('0x22')](_0x5398ca);}return _0x56f27d[_0x6b7c('0x23')]();};}function saveUpdates(_0x6d7323,_0x1d9f8e){return function(_0x520aae){if(_0x520aae){return _0x520aae['update'](_0x6d7323)[_0x6b7c('0x24')](function(_0x1de31d){return _0x1de31d;});}return null;};}function removeEntity(_0x10f799,_0x4da0e5){return function(_0x427ab1){if(_0x427ab1){return _0x427ab1[_0x6b7c('0x25')]()[_0x6b7c('0x24')](function(){_0x10f799['status'](0xcc)[_0x6b7c('0x19')]();});}};}function handleEntityNotFound(_0x222904,_0x5e80b2){return function(_0x57d94e){if(!_0x57d94e){_0x222904[_0x6b7c('0x17')](0x194);}return _0x57d94e;};}function handleError(_0x1cbd70,_0x1e3156){_0x1e3156=_0x1e3156||0x1f4;return function(_0x3468db){logger[_0x6b7c('0x26')](_0x3468db['stack']);if(_0x3468db[_0x6b7c('0x27')]){delete _0x3468db[_0x6b7c('0x27')];}_0x1cbd70[_0x6b7c('0x18')](_0x1e3156)[_0x6b7c('0x28')](_0x3468db);};}exports['index']=function(_0x2d9d37,_0x29c1f3){var _0x521127={},_0x320204={},_0x1d4239={'count':0x0,'rows':[]};var _0x52273a=_['map'](db['JscriptySessionReport']['rawAttributes'],function(_0x3128a0){return{'name':_0x3128a0[_0x6b7c('0x29')],'type':_0x3128a0[_0x6b7c('0x2a')]['key']};});_0x320204[_0x6b7c('0x2b')]=_[_0x6b7c('0x2c')](_0x52273a,'name');_0x320204[_0x6b7c('0x2d')]=_[_0x6b7c('0x2e')](_0x2d9d37['query']);_0x320204[_0x6b7c('0x2f')]=_[_0x6b7c('0x30')](_0x320204[_0x6b7c('0x2b')],_0x320204[_0x6b7c('0x2d')]);_0x521127['attributes']=_['intersection'](_0x320204[_0x6b7c('0x2b')],qs[_0x6b7c('0x31')](_0x2d9d37[_0x6b7c('0x2d')]['fields']));_0x521127[_0x6b7c('0x32')]=_0x521127[_0x6b7c('0x32')][_0x6b7c('0x33')]?_0x521127[_0x6b7c('0x32')]:_0x320204[_0x6b7c('0x2b')];if(!_0x2d9d37[_0x6b7c('0x2d')][_0x6b7c('0x34')](_0x6b7c('0x35'))){_0x521127[_0x6b7c('0x1c')]=qs[_0x6b7c('0x1c')](_0x2d9d37['query']['limit']);_0x521127[_0x6b7c('0x1e')]=qs[_0x6b7c('0x1e')](_0x2d9d37[_0x6b7c('0x2d')]['offset']);}_0x521127[_0x6b7c('0x36')]=qs[_0x6b7c('0x37')](_0x2d9d37[_0x6b7c('0x2d')][_0x6b7c('0x37')]);_0x521127['where']=qs[_0x6b7c('0x2f')](_[_0x6b7c('0x38')](_0x2d9d37['query'],_0x320204[_0x6b7c('0x2f')]),_0x52273a);if(_0x2d9d37[_0x6b7c('0x2d')][_0x6b7c('0x39')]){_0x521127['where']=_[_0x6b7c('0x3a')](_0x521127[_0x6b7c('0x3b')],{'$or':_['map'](_0x52273a,function(_0x45bc7d){if(_0x45bc7d[_0x6b7c('0x2a')]!==_0x6b7c('0x3c')){var _0x2c4b9c={};_0x2c4b9c[_0x45bc7d[_0x6b7c('0x27')]]={'$like':'%'+_0x2d9d37['query']['filter']+'%'};return _0x2c4b9c;}})});}_0x521127=_[_0x6b7c('0x3a')]({},_0x521127,_0x2d9d37['options']);var _0x442840={'where':_0x521127['where']};return db[_0x6b7c('0x3d')][_0x6b7c('0x1d')](_0x442840)['then'](function(_0x5997b8){_0x1d4239[_0x6b7c('0x1d')]=_0x5997b8;if(_0x2d9d37['query'][_0x6b7c('0x3e')]){_0x521127[_0x6b7c('0x3f')]=[{'all':!![]}];}return db[_0x6b7c('0x3d')][_0x6b7c('0x40')](_0x521127);})[_0x6b7c('0x24')](function(_0x3ad775){_0x1d4239[_0x6b7c('0x41')]=_0x3ad775;return _0x1d4239;})['then'](respondWithFilteredResult(_0x29c1f3,_0x521127))[_0x6b7c('0x42')](handleError(_0x29c1f3,null));};exports[_0x6b7c('0x43')]=function(_0x21716f,_0xd2f408){var _0x45333b={'raw':!![],'where':{'id':_0x21716f[_0x6b7c('0x44')]['id']}},_0x105661={};_0x105661[_0x6b7c('0x2b')]=_[_0x6b7c('0x2e')](db[_0x6b7c('0x3d')][_0x6b7c('0x45')]);_0x105661['query']=_[_0x6b7c('0x2e')](_0x21716f['query']);_0x105661['filters']=_[_0x6b7c('0x30')](_0x105661[_0x6b7c('0x2b')],_0x105661[_0x6b7c('0x2d')]);_0x45333b['attributes']=_[_0x6b7c('0x30')](_0x105661[_0x6b7c('0x2b')],qs[_0x6b7c('0x31')](_0x21716f['query'][_0x6b7c('0x31')]));_0x45333b[_0x6b7c('0x32')]=_0x45333b[_0x6b7c('0x32')][_0x6b7c('0x33')]?_0x45333b[_0x6b7c('0x32')]:_0x105661[_0x6b7c('0x2b')];if(_0x21716f[_0x6b7c('0x2d')][_0x6b7c('0x3e')]){_0x45333b[_0x6b7c('0x3f')]=[{'all':!![]}];}_0x45333b=_[_0x6b7c('0x3a')]({},_0x45333b,_0x21716f[_0x6b7c('0x46')]);return db[_0x6b7c('0x3d')][_0x6b7c('0x47')](_0x45333b)['then'](handleEntityNotFound(_0xd2f408,null))[_0x6b7c('0x24')](respondWithResult(_0xd2f408,null))[_0x6b7c('0x42')](handleError(_0xd2f408,null));};exports[_0x6b7c('0x48')]=function(_0x220c5c,_0x3c2b44){return db[_0x6b7c('0x3d')][_0x6b7c('0x48')](_0x220c5c[_0x6b7c('0x49')],{})['then'](respondWithResult(_0x3c2b44,0xc9))[_0x6b7c('0x42')](handleError(_0x3c2b44,null));};exports[_0x6b7c('0x4a')]=function(_0x66577f,_0x59299f){if(_0x66577f['body']['id']){delete _0x66577f[_0x6b7c('0x49')]['id'];}return db['JscriptySessionReport'][_0x6b7c('0x47')]({'where':{'id':_0x66577f[_0x6b7c('0x44')]['id']}})[_0x6b7c('0x24')](handleEntityNotFound(_0x59299f,null))[_0x6b7c('0x24')](saveUpdates(_0x66577f['body'],null))['then'](respondWithResult(_0x59299f,null))['catch'](handleError(_0x59299f,null));};exports[_0x6b7c('0x25')]=function(_0x48ca8f,_0x572fee){return db[_0x6b7c('0x3d')][_0x6b7c('0x47')]({'where':{'id':_0x48ca8f[_0x6b7c('0x44')]['id']}})[_0x6b7c('0x24')](handleEntityNotFound(_0x572fee,null))[_0x6b7c('0x24')](removeEntity(_0x572fee,null))[_0x6b7c('0x42')](handleError(_0x572fee,null));};exports[_0x6b7c('0x4b')]=function(_0x5b6dc4,_0x496a7d){return db[_0x6b7c('0x3d')]['describe']()[_0x6b7c('0x24')](respondWithResult(_0x496a7d,null))[_0x6b7c('0x42')](handleError(_0x496a7d,null));};exports['getQuestions']=function(_0xc1ed8a,_0x4fdacb,_0x155589){var _0x52c377={'raw':!![],'where':{}};var _0x11a4c5={};var _0x3ecf27={'count':0x0,'rows':[]};return db[_0x6b7c('0x3d')]['findOne']({'where':{'id':_0xc1ed8a[_0x6b7c('0x44')]['id']}})[_0x6b7c('0x24')](handleEntityNotFound(_0x4fdacb,null))[_0x6b7c('0x24')](function(_0x350d10){if(_0x350d10){_0x11a4c5[_0x6b7c('0x2b')]=_['keys'](db['JscriptyQuestionReport'][_0x6b7c('0x45')]);_0x11a4c5['query']=_['keys'](_0xc1ed8a[_0x6b7c('0x2d')]);_0x11a4c5['filters']=_[_0x6b7c('0x30')](_0x11a4c5[_0x6b7c('0x2b')],_0x11a4c5[_0x6b7c('0x2d')]);_0x52c377[_0x6b7c('0x32')]=_[_0x6b7c('0x30')](_0x11a4c5['model'],qs[_0x6b7c('0x31')](_0xc1ed8a[_0x6b7c('0x2d')][_0x6b7c('0x31')]));_0x52c377[_0x6b7c('0x32')]=_0x52c377[_0x6b7c('0x32')][_0x6b7c('0x33')]?_0x52c377['attributes']:_0x11a4c5[_0x6b7c('0x2b')];if(!_0xc1ed8a['query'][_0x6b7c('0x34')](_0x6b7c('0x35'))){_0x52c377[_0x6b7c('0x1c')]=qs[_0x6b7c('0x1c')](_0xc1ed8a[_0x6b7c('0x2d')][_0x6b7c('0x1c')]);_0x52c377[_0x6b7c('0x1e')]=qs[_0x6b7c('0x1e')](_0xc1ed8a[_0x6b7c('0x2d')][_0x6b7c('0x1e')]);}_0x52c377['order']=qs[_0x6b7c('0x37')](_0xc1ed8a[_0x6b7c('0x2d')]['sort']);_0x52c377[_0x6b7c('0x3b')]=qs[_0x6b7c('0x2f')](_['pick'](_0xc1ed8a['query'],_0x11a4c5[_0x6b7c('0x2f')]));_0x52c377['where'][_0x6b7c('0x4c')]=_0x350d10['id'];if(_0xc1ed8a[_0x6b7c('0x2d')][_0x6b7c('0x39')]){_0x52c377[_0x6b7c('0x3b')]=_[_0x6b7c('0x3a')](_0x52c377[_0x6b7c('0x3b')],{'$or':_[_0x6b7c('0x2c')](_0x52c377['attributes'],function(_0x58ad10){var _0x13b6ad={};_0x13b6ad[_0x58ad10]={'$like':'%'+_0xc1ed8a[_0x6b7c('0x2d')][_0x6b7c('0x39')]+'%'};return _0x13b6ad;})});}_0x52c377=_[_0x6b7c('0x3a')]({},_0x52c377,_0xc1ed8a[_0x6b7c('0x46')]);return db['JscriptyQuestionReport'][_0x6b7c('0x1d')]({'where':_0x52c377[_0x6b7c('0x3b')]})['then'](function(_0x4fab72){_0x3ecf27[_0x6b7c('0x1d')]=_0x4fab72;if(_0xc1ed8a['query']['includeAll']){_0x52c377['include']=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x6b7c('0x40')](_0x52c377);})[_0x6b7c('0x24')](function(_0x40fb8e){_0x3ecf27[_0x6b7c('0x41')]=_0x40fb8e;return _0x3ecf27;});}})[_0x6b7c('0x24')](respondWithFilteredResult(_0x4fdacb,_0x52c377))[_0x6b7c('0x42')](handleError(_0x4fdacb,null));}; \ No newline at end of file +var _0xf0a8=['merge','options','includeAll','findAll','rows','params','include','find','create','body','catch','describe','findOne','JscriptyQuestionReport','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','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/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','end','sendStatus','error','name','send','index','JscriptySessionReport','rawAttributes','fieldName','type','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','map','VIRTUAL','filter'];(function(_0x4b671e,_0x266951){var _0x1c65ee=function(_0x2e983a){while(--_0x2e983a){_0x4b671e['push'](_0x4b671e['shift']());}};_0x1c65ee(++_0x266951);}(_0xf0a8,0x104));var _0x8f0a=function(_0x46ee42,_0x41ac62){_0x46ee42=_0x46ee42-0x0;var _0x2c2f75=_0xf0a8[_0x46ee42];return _0x2c2f75;};'use strict';var emlformat=require(_0x8f0a('0x0'));var rimraf=require(_0x8f0a('0x1'));var zipdir=require(_0x8f0a('0x2'));var jsonpatch=require(_0x8f0a('0x3'));var rp=require(_0x8f0a('0x4'));var moment=require(_0x8f0a('0x5'));var BPromise=require(_0x8f0a('0x6'));var Mustache=require(_0x8f0a('0x7'));var util=require('util');var path=require(_0x8f0a('0x8'));var sox=require(_0x8f0a('0x9'));var csv=require(_0x8f0a('0xa'));var ejs=require(_0x8f0a('0xb'));var fs=require('fs');var fs_extra=require(_0x8f0a('0xc'));var _=require(_0x8f0a('0xd'));var squel=require(_0x8f0a('0xe'));var crypto=require(_0x8f0a('0xf'));var jsforce=require(_0x8f0a('0x10'));var deskjs=require(_0x8f0a('0x11'));var toCsv=require(_0x8f0a('0xa'));var querystring=require(_0x8f0a('0x12'));var Papa=require('papaparse');var Redis=require(_0x8f0a('0x13'));var authService=require(_0x8f0a('0x14'));var qs=require(_0x8f0a('0x15'));var as=require(_0x8f0a('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8f0a('0x17'))('api');var utils=require(_0x8f0a('0x18'));var config=require(_0x8f0a('0x19'));var licenseUtil=require(_0x8f0a('0x1a'));var db=require(_0x8f0a('0x1b'))['db'];function respondWithStatusCode(_0x10dae0,_0xa3c301){_0xa3c301=_0xa3c301||0xcc;return function(_0x450a55){if(_0x450a55){return _0x10dae0['sendStatus'](_0xa3c301);}return _0x10dae0['status'](_0xa3c301)['end']();};}function respondWithResult(_0x38be19,_0x5399b3){_0x5399b3=_0x5399b3||0xc8;return function(_0x2822b4){if(_0x2822b4){return _0x38be19[_0x8f0a('0x1c')](_0x5399b3)[_0x8f0a('0x1d')](_0x2822b4);}};}function respondWithFilteredResult(_0x138731,_0x3b864b){return function(_0x27943f){if(_0x27943f){var _0x2e607a=typeof _0x3b864b[_0x8f0a('0x1e')]===_0x8f0a('0x1f')&&typeof _0x3b864b[_0x8f0a('0x20')]===_0x8f0a('0x1f');var _0x25dcd1=_0x27943f[_0x8f0a('0x21')];var _0x1cd663=_0x2e607a?0x0:_0x3b864b['offset'];var _0x35f455=_0x2e607a?_0x27943f[_0x8f0a('0x21')]:_0x3b864b[_0x8f0a('0x1e')]+_0x3b864b[_0x8f0a('0x20')];var _0x48523a;if(_0x35f455>=_0x25dcd1){_0x35f455=_0x25dcd1;_0x48523a=0xc8;}else{_0x48523a=0xce;}_0x138731[_0x8f0a('0x1c')](_0x48523a);return _0x138731[_0x8f0a('0x22')](_0x8f0a('0x23'),_0x1cd663+'-'+_0x35f455+'/'+_0x25dcd1)[_0x8f0a('0x1d')](_0x27943f);}return null;};}function patchUpdates(_0x596f87){return function(_0x444ece){try{jsonpatch[_0x8f0a('0x24')](_0x444ece,_0x596f87,!![]);}catch(_0x607371){return BPromise[_0x8f0a('0x25')](_0x607371);}return _0x444ece[_0x8f0a('0x26')]();};}function saveUpdates(_0x46124a,_0x3321d9){return function(_0xeaf28f){if(_0xeaf28f){return _0xeaf28f['update'](_0x46124a)[_0x8f0a('0x27')](function(_0x18c8f3){return _0x18c8f3;});}return null;};}function removeEntity(_0x1d1302,_0x281ae3){return function(_0x58f110){if(_0x58f110){return _0x58f110[_0x8f0a('0x28')]()[_0x8f0a('0x27')](function(){_0x1d1302[_0x8f0a('0x1c')](0xcc)[_0x8f0a('0x29')]();});}};}function handleEntityNotFound(_0xda2569,_0x1ec857){return function(_0x351878){if(!_0x351878){_0xda2569[_0x8f0a('0x2a')](0x194);}return _0x351878;};}function handleError(_0x59e96f,_0x2205e0){_0x2205e0=_0x2205e0||0x1f4;return function(_0xe7bde1){logger[_0x8f0a('0x2b')](_0xe7bde1['stack']);if(_0xe7bde1['name']){delete _0xe7bde1[_0x8f0a('0x2c')];}_0x59e96f[_0x8f0a('0x1c')](_0x2205e0)[_0x8f0a('0x2d')](_0xe7bde1);};}exports[_0x8f0a('0x2e')]=function(_0x5ead0d,_0x406d59){var _0x531e5d={},_0x408b8b={},_0x3aac59={'count':0x0,'rows':[]};var _0x4dbc50=_['map'](db[_0x8f0a('0x2f')][_0x8f0a('0x30')],function(_0x208e11){return{'name':_0x208e11[_0x8f0a('0x31')],'type':_0x208e11[_0x8f0a('0x32')]['key']};});_0x408b8b['model']=_['map'](_0x4dbc50,'name');_0x408b8b[_0x8f0a('0x33')]=_[_0x8f0a('0x34')](_0x5ead0d[_0x8f0a('0x33')]);_0x408b8b['filters']=_[_0x8f0a('0x35')](_0x408b8b[_0x8f0a('0x36')],_0x408b8b['query']);_0x531e5d['attributes']=_[_0x8f0a('0x35')](_0x408b8b[_0x8f0a('0x36')],qs['fields'](_0x5ead0d[_0x8f0a('0x33')][_0x8f0a('0x37')]));_0x531e5d['attributes']=_0x531e5d[_0x8f0a('0x38')][_0x8f0a('0x39')]?_0x531e5d['attributes']:_0x408b8b[_0x8f0a('0x36')];if(!_0x5ead0d[_0x8f0a('0x33')][_0x8f0a('0x3a')](_0x8f0a('0x3b'))){_0x531e5d[_0x8f0a('0x20')]=qs[_0x8f0a('0x20')](_0x5ead0d[_0x8f0a('0x33')][_0x8f0a('0x20')]);_0x531e5d[_0x8f0a('0x1e')]=qs['offset'](_0x5ead0d[_0x8f0a('0x33')][_0x8f0a('0x1e')]);}_0x531e5d[_0x8f0a('0x3c')]=qs[_0x8f0a('0x3d')](_0x5ead0d['query'][_0x8f0a('0x3d')]);_0x531e5d[_0x8f0a('0x3e')]=qs[_0x8f0a('0x3f')](_[_0x8f0a('0x40')](_0x5ead0d[_0x8f0a('0x33')],_0x408b8b[_0x8f0a('0x3f')]),_0x4dbc50);if(_0x5ead0d[_0x8f0a('0x33')]['filter']){_0x531e5d[_0x8f0a('0x3e')]=_['merge'](_0x531e5d[_0x8f0a('0x3e')],{'$or':_[_0x8f0a('0x41')](_0x4dbc50,function(_0x51d617){if(_0x51d617[_0x8f0a('0x32')]!==_0x8f0a('0x42')){var _0x1e2627={};_0x1e2627[_0x51d617[_0x8f0a('0x2c')]]={'$like':'%'+_0x5ead0d[_0x8f0a('0x33')][_0x8f0a('0x43')]+'%'};return _0x1e2627;}})});}_0x531e5d=_[_0x8f0a('0x44')]({},_0x531e5d,_0x5ead0d[_0x8f0a('0x45')]);var _0x2b47b6={'where':_0x531e5d[_0x8f0a('0x3e')]};return db[_0x8f0a('0x2f')][_0x8f0a('0x21')](_0x2b47b6)['then'](function(_0x32d62e){_0x3aac59['count']=_0x32d62e;if(_0x5ead0d['query'][_0x8f0a('0x46')]){_0x531e5d['include']=[{'all':!![]}];}return db[_0x8f0a('0x2f')][_0x8f0a('0x47')](_0x531e5d);})[_0x8f0a('0x27')](function(_0xcbbb3){_0x3aac59[_0x8f0a('0x48')]=_0xcbbb3;return _0x3aac59;})[_0x8f0a('0x27')](respondWithFilteredResult(_0x406d59,_0x531e5d))['catch'](handleError(_0x406d59,null));};exports['show']=function(_0x313e3e,_0x5bc28e){var _0x220c59={'raw':!![],'where':{'id':_0x313e3e[_0x8f0a('0x49')]['id']}},_0x2e7340={};_0x2e7340[_0x8f0a('0x36')]=_[_0x8f0a('0x34')](db[_0x8f0a('0x2f')]['rawAttributes']);_0x2e7340['query']=_['keys'](_0x313e3e['query']);_0x2e7340[_0x8f0a('0x3f')]=_[_0x8f0a('0x35')](_0x2e7340[_0x8f0a('0x36')],_0x2e7340[_0x8f0a('0x33')]);_0x220c59['attributes']=_[_0x8f0a('0x35')](_0x2e7340[_0x8f0a('0x36')],qs['fields'](_0x313e3e['query'][_0x8f0a('0x37')]));_0x220c59[_0x8f0a('0x38')]=_0x220c59[_0x8f0a('0x38')][_0x8f0a('0x39')]?_0x220c59[_0x8f0a('0x38')]:_0x2e7340[_0x8f0a('0x36')];if(_0x313e3e[_0x8f0a('0x33')]['includeAll']){_0x220c59[_0x8f0a('0x4a')]=[{'all':!![]}];}_0x220c59=_['merge']({},_0x220c59,_0x313e3e[_0x8f0a('0x45')]);return db['JscriptySessionReport'][_0x8f0a('0x4b')](_0x220c59)[_0x8f0a('0x27')](handleEntityNotFound(_0x5bc28e,null))[_0x8f0a('0x27')](respondWithResult(_0x5bc28e,null))['catch'](handleError(_0x5bc28e,null));};exports[_0x8f0a('0x4c')]=function(_0x20a3e8,_0x2323a8){return db[_0x8f0a('0x2f')]['create'](_0x20a3e8[_0x8f0a('0x4d')],{})['then'](respondWithResult(_0x2323a8,0xc9))[_0x8f0a('0x4e')](handleError(_0x2323a8,null));};exports['update']=function(_0x3fb75f,_0x50bf7){if(_0x3fb75f[_0x8f0a('0x4d')]['id']){delete _0x3fb75f['body']['id'];}return db['JscriptySessionReport'][_0x8f0a('0x4b')]({'where':{'id':_0x3fb75f['params']['id']}})[_0x8f0a('0x27')](handleEntityNotFound(_0x50bf7,null))[_0x8f0a('0x27')](saveUpdates(_0x3fb75f['body'],null))[_0x8f0a('0x27')](respondWithResult(_0x50bf7,null))[_0x8f0a('0x4e')](handleError(_0x50bf7,null));};exports[_0x8f0a('0x28')]=function(_0x22c54e,_0x426f92){return db[_0x8f0a('0x2f')][_0x8f0a('0x4b')]({'where':{'id':_0x22c54e[_0x8f0a('0x49')]['id']}})[_0x8f0a('0x27')](handleEntityNotFound(_0x426f92,null))[_0x8f0a('0x27')](removeEntity(_0x426f92,null))[_0x8f0a('0x4e')](handleError(_0x426f92,null));};exports['describe']=function(_0x18ad91,_0x5c803d){return db[_0x8f0a('0x2f')][_0x8f0a('0x4f')]()['then'](respondWithResult(_0x5c803d,null))[_0x8f0a('0x4e')](handleError(_0x5c803d,null));};exports['getQuestions']=function(_0x56332c,_0x491832,_0x1040d7){var _0x4fe0b5={'raw':!![],'where':{}};var _0x40fbe2={};var _0xef335e={'count':0x0,'rows':[]};return db[_0x8f0a('0x2f')][_0x8f0a('0x50')]({'where':{'id':_0x56332c[_0x8f0a('0x49')]['id']}})['then'](handleEntityNotFound(_0x491832,null))[_0x8f0a('0x27')](function(_0x362472){if(_0x362472){_0x40fbe2[_0x8f0a('0x36')]=_[_0x8f0a('0x34')](db[_0x8f0a('0x51')][_0x8f0a('0x30')]);_0x40fbe2['query']=_[_0x8f0a('0x34')](_0x56332c[_0x8f0a('0x33')]);_0x40fbe2[_0x8f0a('0x3f')]=_[_0x8f0a('0x35')](_0x40fbe2[_0x8f0a('0x36')],_0x40fbe2[_0x8f0a('0x33')]);_0x4fe0b5['attributes']=_['intersection'](_0x40fbe2[_0x8f0a('0x36')],qs[_0x8f0a('0x37')](_0x56332c[_0x8f0a('0x33')][_0x8f0a('0x37')]));_0x4fe0b5[_0x8f0a('0x38')]=_0x4fe0b5['attributes'][_0x8f0a('0x39')]?_0x4fe0b5[_0x8f0a('0x38')]:_0x40fbe2[_0x8f0a('0x36')];if(!_0x56332c[_0x8f0a('0x33')][_0x8f0a('0x3a')]('nolimit')){_0x4fe0b5[_0x8f0a('0x20')]=qs[_0x8f0a('0x20')](_0x56332c[_0x8f0a('0x33')][_0x8f0a('0x20')]);_0x4fe0b5[_0x8f0a('0x1e')]=qs['offset'](_0x56332c[_0x8f0a('0x33')][_0x8f0a('0x1e')]);}_0x4fe0b5['order']=qs[_0x8f0a('0x3d')](_0x56332c[_0x8f0a('0x33')][_0x8f0a('0x3d')]);_0x4fe0b5['where']=qs['filters'](_['pick'](_0x56332c[_0x8f0a('0x33')],_0x40fbe2[_0x8f0a('0x3f')]));_0x4fe0b5[_0x8f0a('0x3e')]['SessionId']=_0x362472['id'];if(_0x56332c[_0x8f0a('0x33')][_0x8f0a('0x43')]){_0x4fe0b5[_0x8f0a('0x3e')]=_[_0x8f0a('0x44')](_0x4fe0b5[_0x8f0a('0x3e')],{'$or':_[_0x8f0a('0x41')](_0x4fe0b5[_0x8f0a('0x38')],function(_0x1c7f8e){var _0x54c624={};_0x54c624[_0x1c7f8e]={'$like':'%'+_0x56332c[_0x8f0a('0x33')][_0x8f0a('0x43')]+'%'};return _0x54c624;})});}_0x4fe0b5=_['merge']({},_0x4fe0b5,_0x56332c[_0x8f0a('0x45')]);return db[_0x8f0a('0x51')][_0x8f0a('0x21')]({'where':_0x4fe0b5[_0x8f0a('0x3e')]})[_0x8f0a('0x27')](function(_0x179df1){_0xef335e[_0x8f0a('0x21')]=_0x179df1;if(_0x56332c['query'][_0x8f0a('0x46')]){_0x4fe0b5[_0x8f0a('0x4a')]=[{'all':!![]}];}return db[_0x8f0a('0x51')][_0x8f0a('0x47')](_0x4fe0b5);})[_0x8f0a('0x27')](function(_0x5920d3){_0xef335e[_0x8f0a('0x48')]=_0x5920d3;return _0xef335e;});}})[_0x8f0a('0x27')](respondWithFilteredResult(_0x491832,_0x4fe0b5))['catch'](handleError(_0x491832,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 0fce448..7747460 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 _0x9a5a=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport','report_jscripty_sessions','lodash','util'];(function(_0x29b609,_0x19d388){var _0x54c952=function(_0xb3c38d){while(--_0xb3c38d){_0x29b609['push'](_0x29b609['shift']());}};_0x54c952(++_0x19d388);}(_0x9a5a,0x194));var _0xa9a5=function(_0x2b7f11,_0x31ef61){_0x2b7f11=_0x2b7f11-0x0;var _0xb3d97=_0x9a5a[_0x2b7f11];return _0xb3d97;};'use strict';var _=require(_0xa9a5('0x0'));var util=require(_0xa9a5('0x1'));var logger=require(_0xa9a5('0x2'))(_0xa9a5('0x3'));var moment=require(_0xa9a5('0x4'));var BPromise=require('bluebird');var rp=require(_0xa9a5('0x5'));var fs=require('fs');var path=require(_0xa9a5('0x6'));var rimraf=require(_0xa9a5('0x7'));var config=require(_0xa9a5('0x8'));var attributes=require(_0xa9a5('0x9'));module[_0xa9a5('0xa')]=function(_0x4a73f4,_0xb0ccd9){return _0x4a73f4[_0xa9a5('0xb')](_0xa9a5('0xc'),attributes,{'tableName':_0xa9a5('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4975=['./jscriptySessionReport.attributes','exports','JscriptySessionReport','report_jscripty_sessions','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x4c6d11,_0x26dd29){var _0x38fe80=function(_0x17b732){while(--_0x17b732){_0x4c6d11['push'](_0x4c6d11['shift']());}};_0x38fe80(++_0x26dd29);}(_0x4975,0x86));var _0x5497=function(_0x59b695,_0x482e28){_0x59b695=_0x59b695-0x0;var _0x35ce76=_0x4975[_0x59b695];return _0x35ce76;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var logger=require(_0x5497('0x1'))(_0x5497('0x2'));var moment=require(_0x5497('0x3'));var BPromise=require(_0x5497('0x4'));var rp=require(_0x5497('0x5'));var fs=require('fs');var path=require(_0x5497('0x6'));var rimraf=require(_0x5497('0x7'));var config=require(_0x5497('0x8'));var attributes=require(_0x5497('0x9'));module[_0x5497('0xa')]=function(_0x539a27,_0x37e48d){return _0x539a27['define'](_0x5497('0xb'),attributes,{'tableName':_0x5497('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index b29954f..1913f15 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 _0x0adf=['request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','code','error','JscriptySessionReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info'];(function(_0x49c699,_0x314403){var _0x2853ea=function(_0x68ceb9){while(--_0x68ceb9){_0x49c699['push'](_0x49c699['shift']());}};_0x2853ea(++_0x314403);}(_0x0adf,0x1d2));var _0xf0ad=function(_0x43c1a1,_0x5d2620){_0x43c1a1=_0x43c1a1-0x0;var _0x3d28f5=_0x0adf[_0x43c1a1];return _0x3d28f5;};'use strict';var _=require(_0xf0ad('0x0'));var util=require(_0xf0ad('0x1'));var moment=require(_0xf0ad('0x2'));var BPromise=require('bluebird');var rs=require(_0xf0ad('0x3'));var fs=require('fs');var Redis=require(_0xf0ad('0x4'));var db=require(_0xf0ad('0x5'))['db'];var utils=require(_0xf0ad('0x6'));var logger=require(_0xf0ad('0x7'))(_0xf0ad('0x8'));var config=require(_0xf0ad('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xf0ad('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2eca0e,_0x44cf37,_0x170574){return new BPromise(function(_0x41c99d,_0xa9a315){return client[_0xf0ad('0xb')](_0x2eca0e,_0x170574)[_0xf0ad('0xc')](function(_0x5bdf69){logger[_0xf0ad('0xd')]('JscriptySessionReport,\x20%s,\x20%s',_0x44cf37,_0xf0ad('0xe'));logger[_0xf0ad('0xf')](_0xf0ad('0x10'),_0x44cf37,_0xf0ad('0xe'),JSON[_0xf0ad('0x11')](_0x5bdf69));if(_0x5bdf69['error']){if(_0x5bdf69['error'][_0xf0ad('0x12')]===0x1f4){logger[_0xf0ad('0x13')](_0xf0ad('0x14'),_0x44cf37,_0x5bdf69[_0xf0ad('0x13')]['message']);return _0xa9a315(_0x5bdf69[_0xf0ad('0x13')][_0xf0ad('0x15')]);}logger['error']('JscriptySessionReport,\x20%s,\x20%s',_0x44cf37,_0x5bdf69['error'][_0xf0ad('0x15')]);return _0x41c99d(_0x5bdf69['error'][_0xf0ad('0x15')]);}else{logger[_0xf0ad('0xd')](_0xf0ad('0x14'),_0x44cf37,_0xf0ad('0xe'));_0x41c99d(_0x5bdf69[_0xf0ad('0x16')]['message']);}})[_0xf0ad('0x17')](function(_0x285ab0){logger[_0xf0ad('0x13')](_0xf0ad('0x14'),_0x44cf37,_0x285ab0);_0xa9a315(_0x285ab0);});});} \ No newline at end of file +var _0x47c5=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x483102,_0x54e93d){var _0x5cc885=function(_0x54931c){while(--_0x54931c){_0x483102['push'](_0x483102['shift']());}};_0x5cc885(++_0x54e93d);}(_0x47c5,0x165));var _0x547c=function(_0x2a5e67,_0x148cca){_0x2a5e67=_0x2a5e67-0x0;var _0xffe10=_0x47c5[_0x2a5e67];return _0xffe10;};'use strict';var _=require(_0x547c('0x0'));var util=require(_0x547c('0x1'));var moment=require(_0x547c('0x2'));var BPromise=require(_0x547c('0x3'));var rs=require(_0x547c('0x4'));var fs=require('fs');var Redis=require(_0x547c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x547c('0x6'));var logger=require(_0x547c('0x7'))('rpc');var config=require(_0x547c('0x8'));var jayson=require(_0x547c('0x9'));var client=jayson['client'][_0x547c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x439f25,_0x381f2e,_0x10a334){return new BPromise(function(_0x12fb7d,_0x4ef079){return client[_0x547c('0xb')](_0x439f25,_0x10a334)[_0x547c('0xc')](function(_0x10dec9){logger[_0x547c('0xd')](_0x547c('0xe'),_0x381f2e,_0x547c('0xf'));logger[_0x547c('0x10')](_0x547c('0x11'),_0x381f2e,_0x547c('0xf'),JSON[_0x547c('0x12')](_0x10dec9));if(_0x10dec9[_0x547c('0x13')]){if(_0x10dec9['error'][_0x547c('0x14')]===0x1f4){logger[_0x547c('0x13')]('JscriptySessionReport,\x20%s,\x20%s',_0x381f2e,_0x10dec9[_0x547c('0x13')][_0x547c('0x15')]);return _0x4ef079(_0x10dec9[_0x547c('0x13')][_0x547c('0x15')]);}logger[_0x547c('0x13')](_0x547c('0xe'),_0x381f2e,_0x10dec9[_0x547c('0x13')][_0x547c('0x15')]);return _0x12fb7d(_0x10dec9[_0x547c('0x13')][_0x547c('0x15')]);}else{logger[_0x547c('0xd')](_0x547c('0xe'),_0x381f2e,_0x547c('0xf'));_0x12fb7d(_0x10dec9[_0x547c('0x16')][_0x547c('0x15')]);}})[_0x547c('0x17')](function(_0x39498d){logger[_0x547c('0x13')]('JscriptySessionReport,\x20%s,\x20%s',_0x381f2e,_0x39498d);_0x4ef079(_0x39498d);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index a7a56e0..39625cc 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 _0x1e6f=['/:id','/download_log_file','isAuthenticated','exports','multer','util','path','connect-timeout','express','Router','get','index'];(function(_0x297eea,_0x5060be){var _0x1c42d2=function(_0x3afff4){while(--_0x3afff4){_0x297eea['push'](_0x297eea['shift']());}};_0x1c42d2(++_0x5060be);}(_0x1e6f,0x70));var _0xf1e6=function(_0x891779,_0x1cf07b){_0x891779=_0x891779-0x0;var _0x1b7975=_0x1e6f[_0x891779];return _0x1b7975;};'use strict';var multer=require(_0xf1e6('0x0'));var util=require(_0xf1e6('0x1'));var path=require(_0xf1e6('0x2'));var timeout=require(_0xf1e6('0x3'));var express=require(_0xf1e6('0x4'));var router=express[_0xf1e6('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./license.controller');router[_0xf1e6('0x6')]('/',controller[_0xf1e6('0x7')]);router['put'](_0xf1e6('0x8'),auth['isAuthenticated'](),controller['update']);router[_0xf1e6('0x6')](_0xf1e6('0x9'),auth[_0xf1e6('0xa')](),controller['downloadLogFile']);module[_0xf1e6('0xb')]=router; \ No newline at end of file +var _0x14d8=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./license.controller','get','index','put','/:id','isAuthenticated','/download_log_file','downloadLogFile','multer','util','path'];(function(_0x256b72,_0x340985){var _0x2183e3=function(_0xf7fd37){while(--_0xf7fd37){_0x256b72['push'](_0x256b72['shift']());}};_0x2183e3(++_0x340985);}(_0x14d8,0x9f));var _0x814d=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x14d8[_0x126558];return _0x1f6d14;};'use strict';var multer=require(_0x814d('0x0'));var util=require(_0x814d('0x1'));var path=require(_0x814d('0x2'));var timeout=require(_0x814d('0x3'));var express=require(_0x814d('0x4'));var router=express[_0x814d('0x5')]();var fs_extra=require(_0x814d('0x6'));var auth=require(_0x814d('0x7'));var interaction=require(_0x814d('0x8'));var config=require(_0x814d('0x9'));var controller=require(_0x814d('0xa'));router[_0x814d('0xb')]('/',controller[_0x814d('0xc')]);router[_0x814d('0xd')](_0x814d('0xe'),auth[_0x814d('0xf')](),controller['update']);router['get'](_0x814d('0x10'),auth[_0x814d('0xf')](),controller[_0x814d('0x11')]);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 a20e5b9..0b7d4c3 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 _0xd732=['TEXT','STRING','INTEGER','exports'];(function(_0x33afc1,_0x9b3caf){var _0x585b01=function(_0x3278e3){while(--_0x3278e3){_0x33afc1['push'](_0x33afc1['shift']());}};_0x585b01(++_0x9b3caf);}(_0xd732,0x17f));var _0x2d73=function(_0x59e905,_0x308e79){_0x59e905=_0x59e905-0x0;var _0xa9e9d9=_0xd732[_0x59e905];return _0xa9e9d9;};'use strict';var Sequelize=require('sequelize');module[_0x2d73('0x0')]={'license':{'type':Sequelize[_0x2d73('0x1')]},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0x2d73('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0x2d73('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x059a=['exports','TEXT','STRING','INTEGER','sequelize'];(function(_0x2fef3a,_0x1f10e4){var _0x342de2=function(_0x2cb802){while(--_0x2cb802){_0x2fef3a['push'](_0x2fef3a['shift']());}};_0x342de2(++_0x1f10e4);}(_0x059a,0x1ee));var _0xa059=function(_0x2f8d56,_0x376c64){_0x2f8d56=_0x2f8d56-0x0;var _0x36081d=_0x059a[_0x2f8d56];return _0x36081d;};'use strict';var Sequelize=require(_0xa059('0x0'));module[_0xa059('0x1')]={'license':{'type':Sequelize[_0xa059('0x2')]},'data1':{'type':Sequelize[_0xa059('0x3')]},'data2':{'type':Sequelize[_0xa059('0x3')]},'chatLicenseExceeded':{'type':Sequelize[_0xa059('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 90262ac..6273080 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 _0xff3e=['../../config/license/util','../../mysqldb','sendStatus','end','status','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','name','send','index','License','rawAttributes','query','keys','filters','model','attributes','fields','merge','options','getLicense','catch','body','params','checkLicense','key','demo','downloadLogFile','license-info.log','/var','log','setHeader','Content-disposition','Content-Type','text/plain','eml-format','rimraf','zip-dir','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment'];(function(_0x2aae31,_0x1014a2){var _0x379006=function(_0x5345ae){while(--_0x5345ae){_0x2aae31['push'](_0x2aae31['shift']());}};_0x379006(++_0x1014a2);}(_0xff3e,0x1d9));var _0xeff3=function(_0x555f36,_0x31c3d3){_0x555f36=_0x555f36-0x0;var _0xa879fd=_0xff3e[_0x555f36];return _0xa879fd;};'use strict';var emlformat=require(_0xeff3('0x0'));var rimraf=require(_0xeff3('0x1'));var zipdir=require(_0xeff3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xeff3('0x3'));var BPromise=require(_0xeff3('0x4'));var Mustache=require('mustache');var util=require(_0xeff3('0x5'));var path=require(_0xeff3('0x6'));var sox=require(_0xeff3('0x7'));var csv=require('to-csv');var ejs=require(_0xeff3('0x8'));var fs=require('fs');var fs_extra=require(_0xeff3('0x9'));var _=require(_0xeff3('0xa'));var squel=require(_0xeff3('0xb'));var crypto=require(_0xeff3('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xeff3('0xd'));var toCsv=require(_0xeff3('0xe'));var querystring=require(_0xeff3('0xf'));var Papa=require(_0xeff3('0x10'));var Redis=require(_0xeff3('0x11'));var authService=require(_0xeff3('0x12'));var qs=require(_0xeff3('0x13'));var as=require(_0xeff3('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xeff3('0x15'))(_0xeff3('0x16'));var utils=require('../../config/utils');var config=require(_0xeff3('0x17'));var licenseUtil=require(_0xeff3('0x18'));var db=require(_0xeff3('0x19'))['db'];function respondWithStatusCode(_0x19250c,_0x2257a2){_0x2257a2=_0x2257a2||0xcc;return function(_0x398c61){if(_0x398c61){return _0x19250c[_0xeff3('0x1a')](_0x2257a2);}return _0x19250c['status'](_0x2257a2)[_0xeff3('0x1b')]();};}function respondWithResult(_0x69a510,_0xd92f0e){_0xd92f0e=_0xd92f0e||0xc8;return function(_0x16b9bc){if(_0x16b9bc){return _0x69a510[_0xeff3('0x1c')](_0xd92f0e)['json'](_0x16b9bc);}};}function respondWithFilteredResult(_0x2d6b4e,_0x2b2e70){return function(_0x4830b5){if(_0x4830b5){var _0x2ad384=typeof _0x2b2e70[_0xeff3('0x1d')]==='undefined'&&typeof _0x2b2e70[_0xeff3('0x1e')]===_0xeff3('0x1f');var _0x4f42e1=_0x4830b5[_0xeff3('0x20')];var _0x51a498=_0x2ad384?0x0:_0x2b2e70['offset'];var _0x197add=_0x2ad384?_0x4830b5[_0xeff3('0x20')]:_0x2b2e70[_0xeff3('0x1d')]+_0x2b2e70['limit'];var _0x14d142;if(_0x197add>=_0x4f42e1){_0x197add=_0x4f42e1;_0x14d142=0xc8;}else{_0x14d142=0xce;}_0x2d6b4e[_0xeff3('0x1c')](_0x14d142);return _0x2d6b4e[_0xeff3('0x21')](_0xeff3('0x22'),_0x51a498+'-'+_0x197add+'/'+_0x4f42e1)[_0xeff3('0x23')](_0x4830b5);}return null;};}function patchUpdates(_0x3efa9c){return function(_0x2f7751){try{jsonpatch[_0xeff3('0x24')](_0x2f7751,_0x3efa9c,!![]);}catch(_0x4361d4){return BPromise[_0xeff3('0x25')](_0x4361d4);}return _0x2f7751[_0xeff3('0x26')]();};}function saveUpdates(_0xf96fba,_0x437a06){return function(_0x4b6a42){if(_0x4b6a42){return _0x4b6a42[_0xeff3('0x27')](_0xf96fba)[_0xeff3('0x28')](function(_0x39d081){return _0x39d081;});}return null;};}function removeEntity(_0x25e4dc,_0x2d17f5){return function(_0x11c9f4){if(_0x11c9f4){return _0x11c9f4[_0xeff3('0x29')]()[_0xeff3('0x28')](function(){_0x25e4dc[_0xeff3('0x1c')](0xcc)[_0xeff3('0x1b')]();});}};}function handleEntityNotFound(_0x1e0cd9,_0x4445f6){return function(_0x3548b6){if(!_0x3548b6){_0x1e0cd9['sendStatus'](0x194);}return _0x3548b6;};}function handleError(_0x2a3853,_0x322cdf){_0x322cdf=_0x322cdf||0x1f4;return function(_0x273632){logger[_0xeff3('0x2a')](_0x273632['stack']);if(_0x273632[_0xeff3('0x2b')]){delete _0x273632['name'];}_0x2a3853[_0xeff3('0x1c')](_0x322cdf)[_0xeff3('0x2c')](_0x273632);};}var utilLicense=require(_0xeff3('0x18'));exports[_0xeff3('0x2d')]=function(_0x9d5ed6,_0x4b37ac){var _0x3156f8={'raw':!![],'where':{'id':0x1}},_0x3d3e31={};_0x3d3e31['model']=_['keys'](db[_0xeff3('0x2e')][_0xeff3('0x2f')]);_0x3d3e31[_0xeff3('0x30')]=_[_0xeff3('0x31')](_0x9d5ed6[_0xeff3('0x30')]);_0x3d3e31[_0xeff3('0x32')]=_['intersection'](_0x3d3e31[_0xeff3('0x33')],_0x3d3e31[_0xeff3('0x30')]);_0x3156f8[_0xeff3('0x34')]=_['intersection'](_0x3d3e31[_0xeff3('0x33')],qs[_0xeff3('0x35')](_0x9d5ed6[_0xeff3('0x30')][_0xeff3('0x35')]));_0x3156f8[_0xeff3('0x34')]=_0x3156f8[_0xeff3('0x34')]['length']?_0x3156f8[_0xeff3('0x34')]:_0x3d3e31[_0xeff3('0x33')];_0x3156f8=_[_0xeff3('0x36')]({},_0x3156f8,_0x9d5ed6[_0xeff3('0x37')]);return utilLicense[_0xeff3('0x38')](_0x3156f8)['then'](respondWithResult(_0x4b37ac,null))[_0xeff3('0x39')](handleError(_0x4b37ac,null));};exports[_0xeff3('0x27')]=function(_0x3f1e82,_0x5da142){if(_0x3f1e82['body']['id']){delete _0x3f1e82[_0xeff3('0x3a')]['id'];}return db['License']['find']({'where':{'id':_0x3f1e82[_0xeff3('0x3b')]['id']}})[_0xeff3('0x28')](handleEntityNotFound(_0x5da142,null))[_0xeff3('0x28')](function(_0x3f20b5){var _0x4164d4=_0x3f20b5['get']({'plain':!![]});return utilLicense[_0xeff3('0x3c')](_0x4164d4,_0x3f1e82['body'][_0xeff3('0x3d')]);})[_0xeff3('0x28')](function(_0x2d1349){if(!_0x2d1349[_0xeff3('0x3e')]){return saveUpdates(_0x3f1e82[_0xeff3('0x3a')],null);}return _0x2d1349;})[_0xeff3('0x28')](respondWithResult(_0x5da142,null))['catch'](handleError(_0x5da142,null));};exports[_0xeff3('0x3f')]=function(_0x1cd1d2,_0x46b5c9){var _0x2bc19f=_0xeff3('0x40');var _0x3b1f43=path['join'](_0xeff3('0x41'),_0xeff3('0x42'),'xcally',_0x2bc19f);_0x46b5c9[_0xeff3('0x43')](_0xeff3('0x44'),'attachment;\x20filename='+_0x2bc19f);_0x46b5c9[_0xeff3('0x21')](_0xeff3('0x45'),_0xeff3('0x46'));_0x46b5c9['download'](_0x3b1f43);}; \ No newline at end of file +var _0x82d4=['jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','model','keys','License','rawAttributes','query','filters','intersection','attributes','fields','merge','options','catch','body','find','params','get','demo','downloadLogFile','join','/var','log','setHeader','Content-disposition','attachment;\x20filename=','Content-Type','text/plain','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','squel','crypto'];(function(_0xbfcd7e,_0x4566d6){var _0x1c8cb4=function(_0x11132c){while(--_0x11132c){_0xbfcd7e['push'](_0xbfcd7e['shift']());}};_0x1c8cb4(++_0x4566d6);}(_0x82d4,0x141));var _0x482d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x82d4[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x482d('0x0'));var rimraf=require(_0x482d('0x1'));var zipdir=require(_0x482d('0x2'));var jsonpatch=require(_0x482d('0x3'));var rp=require(_0x482d('0x4'));var moment=require(_0x482d('0x5'));var BPromise=require(_0x482d('0x6'));var Mustache=require('mustache');var util=require(_0x482d('0x7'));var path=require(_0x482d('0x8'));var sox=require('sox');var csv=require(_0x482d('0x9'));var ejs=require(_0x482d('0xa'));var fs=require('fs');var fs_extra=require(_0x482d('0xb'));var _=require('lodash');var squel=require(_0x482d('0xc'));var crypto=require(_0x482d('0xd'));var jsforce=require(_0x482d('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x482d('0x9'));var querystring=require(_0x482d('0xf'));var Papa=require('papaparse');var Redis=require(_0x482d('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x482d('0x11'));var as=require(_0x482d('0x12'));var hardwareService=require(_0x482d('0x13'));var logger=require(_0x482d('0x14'))(_0x482d('0x15'));var utils=require(_0x482d('0x16'));var config=require(_0x482d('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5abb97,_0x483efb){_0x483efb=_0x483efb||0xcc;return function(_0x2f5b1b){if(_0x2f5b1b){return _0x5abb97[_0x482d('0x18')](_0x483efb);}return _0x5abb97[_0x482d('0x19')](_0x483efb)[_0x482d('0x1a')]();};}function respondWithResult(_0x32b800,_0x54bd20){_0x54bd20=_0x54bd20||0xc8;return function(_0x5023c3){if(_0x5023c3){return _0x32b800[_0x482d('0x19')](_0x54bd20)['json'](_0x5023c3);}};}function respondWithFilteredResult(_0x305676,_0x3b5eb4){return function(_0x37738f){if(_0x37738f){var _0xf9c619=typeof _0x3b5eb4[_0x482d('0x1b')]===_0x482d('0x1c')&&typeof _0x3b5eb4['limit']===_0x482d('0x1c');var _0x2cb754=_0x37738f[_0x482d('0x1d')];var _0x43666c=_0xf9c619?0x0:_0x3b5eb4[_0x482d('0x1b')];var _0x378702=_0xf9c619?_0x37738f[_0x482d('0x1d')]:_0x3b5eb4[_0x482d('0x1b')]+_0x3b5eb4['limit'];var _0x26b759;if(_0x378702>=_0x2cb754){_0x378702=_0x2cb754;_0x26b759=0xc8;}else{_0x26b759=0xce;}_0x305676['status'](_0x26b759);return _0x305676[_0x482d('0x1e')](_0x482d('0x1f'),_0x43666c+'-'+_0x378702+'/'+_0x2cb754)['json'](_0x37738f);}return null;};}function patchUpdates(_0x5c10b3){return function(_0x5d8b1e){try{jsonpatch[_0x482d('0x20')](_0x5d8b1e,_0x5c10b3,!![]);}catch(_0x2a19ca){return BPromise[_0x482d('0x21')](_0x2a19ca);}return _0x5d8b1e[_0x482d('0x22')]();};}function saveUpdates(_0x518fdd,_0x2a8994){return function(_0x2b12c3){if(_0x2b12c3){return _0x2b12c3[_0x482d('0x23')](_0x518fdd)[_0x482d('0x24')](function(_0x105b93){return _0x105b93;});}return null;};}function removeEntity(_0x4360b3,_0x231fa5){return function(_0x470eb8){if(_0x470eb8){return _0x470eb8['destroy']()[_0x482d('0x24')](function(){_0x4360b3['status'](0xcc)[_0x482d('0x1a')]();});}};}function handleEntityNotFound(_0x3617e5,_0x312ec3){return function(_0x3a0b3e){if(!_0x3a0b3e){_0x3617e5[_0x482d('0x18')](0x194);}return _0x3a0b3e;};}function handleError(_0x1b19a2,_0x2308a0){_0x2308a0=_0x2308a0||0x1f4;return function(_0x11b067){logger[_0x482d('0x25')](_0x11b067[_0x482d('0x26')]);if(_0x11b067['name']){delete _0x11b067[_0x482d('0x27')];}_0x1b19a2[_0x482d('0x19')](_0x2308a0)[_0x482d('0x28')](_0x11b067);};}var utilLicense=require('../../config/license/util');exports['index']=function(_0x4036d7,_0xdf849f){var _0x7264e0={'raw':!![],'where':{'id':0x1}},_0x6db9c8={};_0x6db9c8[_0x482d('0x29')]=_[_0x482d('0x2a')](db[_0x482d('0x2b')][_0x482d('0x2c')]);_0x6db9c8[_0x482d('0x2d')]=_[_0x482d('0x2a')](_0x4036d7[_0x482d('0x2d')]);_0x6db9c8[_0x482d('0x2e')]=_[_0x482d('0x2f')](_0x6db9c8[_0x482d('0x29')],_0x6db9c8[_0x482d('0x2d')]);_0x7264e0[_0x482d('0x30')]=_[_0x482d('0x2f')](_0x6db9c8[_0x482d('0x29')],qs[_0x482d('0x31')](_0x4036d7[_0x482d('0x2d')][_0x482d('0x31')]));_0x7264e0[_0x482d('0x30')]=_0x7264e0[_0x482d('0x30')]['length']?_0x7264e0['attributes']:_0x6db9c8[_0x482d('0x29')];_0x7264e0=_[_0x482d('0x32')]({},_0x7264e0,_0x4036d7[_0x482d('0x33')]);return utilLicense['getLicense'](_0x7264e0)[_0x482d('0x24')](respondWithResult(_0xdf849f,null))[_0x482d('0x34')](handleError(_0xdf849f,null));};exports[_0x482d('0x23')]=function(_0x7a89d3,_0x551c83){if(_0x7a89d3[_0x482d('0x35')]['id']){delete _0x7a89d3[_0x482d('0x35')]['id'];}return db[_0x482d('0x2b')][_0x482d('0x36')]({'where':{'id':_0x7a89d3[_0x482d('0x37')]['id']}})[_0x482d('0x24')](handleEntityNotFound(_0x551c83,null))[_0x482d('0x24')](function(_0x5584ba){var _0x1d0054=_0x5584ba[_0x482d('0x38')]({'plain':!![]});return utilLicense['checkLicense'](_0x1d0054,_0x7a89d3[_0x482d('0x35')]['key']);})[_0x482d('0x24')](function(_0x2052ed){if(!_0x2052ed[_0x482d('0x39')]){return saveUpdates(_0x7a89d3['body'],null);}return _0x2052ed;})[_0x482d('0x24')](respondWithResult(_0x551c83,null))[_0x482d('0x34')](handleError(_0x551c83,null));};exports[_0x482d('0x3a')]=function(_0x4c5799,_0x176df2){var _0x2c43a3='license-info.log';var _0x314f6d=path[_0x482d('0x3b')](_0x482d('0x3c'),_0x482d('0x3d'),'xcally',_0x2c43a3);_0x176df2[_0x482d('0x3e')](_0x482d('0x3f'),_0x482d('0x40')+_0x2c43a3);_0x176df2[_0x482d('0x1e')](_0x482d('0x41'),_0x482d('0x42'));_0x176df2['download'](_0x314f6d);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index c64a1ee..ad6760f 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 _0xfad2=['../../config/environment','./license.attributes','define','License','license','util','../../config/logger','moment','bluebird','request-promise','rimraf'];(function(_0x5d789c,_0x2a5732){var _0xfcbde3=function(_0x291246){while(--_0x291246){_0x5d789c['push'](_0x5d789c['shift']());}};_0xfcbde3(++_0x2a5732);}(_0xfad2,0x1a7));var _0x2fad=function(_0x35d91f,_0x28881a){_0x35d91f=_0x35d91f-0x0;var _0x200910=_0xfad2[_0x35d91f];return _0x200910;};'use strict';var _=require('lodash');var util=require(_0x2fad('0x0'));var logger=require(_0x2fad('0x1'))('api');var moment=require(_0x2fad('0x2'));var BPromise=require(_0x2fad('0x3'));var rp=require(_0x2fad('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2fad('0x5'));var config=require(_0x2fad('0x6'));var attributes=require(_0x2fad('0x7'));module['exports']=function(_0x47ef9e,_0x486c89){return _0x47ef9e[_0x2fad('0x8')](_0x2fad('0x9'),attributes,{'tableName':_0x2fad('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x79c7=['rimraf','./license.attributes','exports','define','License','license','lodash','util','api','bluebird','path'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x79c7,0x13a));var _0x779c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x79c7[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x779c('0x0'));var util=require(_0x779c('0x1'));var logger=require('../../config/logger')(_0x779c('0x2'));var moment=require('moment');var BPromise=require(_0x779c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x779c('0x4'));var rimraf=require(_0x779c('0x5'));var config=require('../../config/environment');var attributes=require(_0x779c('0x6'));module[_0x779c('0x7')]=function(_0x2bd6c3,_0x1a4ebc){return _0x2bd6c3[_0x779c('0x8')](_0x779c('0x9'),attributes,{'tableName':_0x779c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/license/license.rpc.js b/server/api/license/license.rpc.js index ac99304..c78f3d0 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 _0xca9f=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','License,\x20%s,\x20%s','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util'];(function(_0x45c981,_0x2ad2d4){var _0x4f62c8=function(_0x55209b){while(--_0x55209b){_0x45c981['push'](_0x45c981['shift']());}};_0x4f62c8(++_0x2ad2d4);}(_0xca9f,0xfb));var _0xfca9=function(_0x4d6ac0,_0x201628){_0x4d6ac0=_0x4d6ac0-0x0;var _0x5296c4=_0xca9f[_0x4d6ac0];return _0x5296c4;};'use strict';var _=require(_0xfca9('0x0'));var util=require(_0xfca9('0x1'));var moment=require(_0xfca9('0x2'));var BPromise=require(_0xfca9('0x3'));var rs=require(_0xfca9('0x4'));var fs=require('fs');var Redis=require(_0xfca9('0x5'));var db=require(_0xfca9('0x6'))['db'];var utils=require(_0xfca9('0x7'));var logger=require(_0xfca9('0x8'))(_0xfca9('0x9'));var config=require(_0xfca9('0xa'));var jayson=require(_0xfca9('0xb'));var client=jayson['client'][_0xfca9('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x40c9d5,_0x3fb006,_0x51f23d){return new BPromise(function(_0x42abff,_0x1f0430){return client['request'](_0x40c9d5,_0x51f23d)[_0xfca9('0xd')](function(_0x3b33be){logger[_0xfca9('0xe')](_0xfca9('0xf'),_0x3fb006,'request\x20sent');logger[_0xfca9('0x10')](_0xfca9('0x11'),_0x3fb006,'request\x20sent',JSON[_0xfca9('0x12')](_0x3b33be));if(_0x3b33be[_0xfca9('0x13')]){if(_0x3b33be['error']['code']===0x1f4){logger[_0xfca9('0x13')](_0xfca9('0xf'),_0x3fb006,_0x3b33be[_0xfca9('0x13')][_0xfca9('0x14')]);return _0x1f0430(_0x3b33be[_0xfca9('0x13')][_0xfca9('0x14')]);}logger[_0xfca9('0x13')](_0xfca9('0xf'),_0x3fb006,_0x3b33be['error']['message']);return _0x42abff(_0x3b33be[_0xfca9('0x13')]['message']);}else{logger['info']('License,\x20%s,\x20%s',_0x3fb006,'request\x20sent');_0x42abff(_0x3b33be[_0xfca9('0x15')]['message']);}})[_0xfca9('0x16')](function(_0xd6e0fd){logger['error'](_0xfca9('0xf'),_0x3fb006,_0xd6e0fd);_0x1f0430(_0xd6e0fd);});});} \ No newline at end of file +var _0x9d68=['http','then','License,\x20%s,\x20%s','License,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x3b22f0,_0x3463fd){var _0x55bf4d=function(_0x18d03b){while(--_0x18d03b){_0x3b22f0['push'](_0x3b22f0['shift']());}};_0x55bf4d(++_0x3463fd);}(_0x9d68,0x1f0));var _0x89d6=function(_0x22a91c,_0x5ce13f){_0x22a91c=_0x22a91c-0x0;var _0x733c2f=_0x9d68[_0x22a91c];return _0x733c2f;};'use strict';var _=require(_0x89d6('0x0'));var util=require(_0x89d6('0x1'));var moment=require('moment');var BPromise=require(_0x89d6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x89d6('0x3'));var db=require(_0x89d6('0x4'))['db'];var utils=require(_0x89d6('0x5'));var logger=require(_0x89d6('0x6'))('rpc');var config=require(_0x89d6('0x7'));var jayson=require(_0x89d6('0x8'));var client=jayson[_0x89d6('0x9')][_0x89d6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2f59af,_0x2b06f9,_0x4f130f){return new BPromise(function(_0x4620b6,_0x142f07){return client['request'](_0x2f59af,_0x4f130f)[_0x89d6('0xb')](function(_0x1bc1f0){logger['info'](_0x89d6('0xc'),_0x2b06f9,'request\x20sent');logger['debug'](_0x89d6('0xd'),_0x2b06f9,_0x89d6('0xe'),JSON[_0x89d6('0xf')](_0x1bc1f0));if(_0x1bc1f0[_0x89d6('0x10')]){if(_0x1bc1f0['error'][_0x89d6('0x11')]===0x1f4){logger[_0x89d6('0x10')]('License,\x20%s,\x20%s',_0x2b06f9,_0x1bc1f0['error'][_0x89d6('0x12')]);return _0x142f07(_0x1bc1f0['error'][_0x89d6('0x12')]);}logger[_0x89d6('0x10')](_0x89d6('0xc'),_0x2b06f9,_0x1bc1f0[_0x89d6('0x10')][_0x89d6('0x12')]);return _0x4620b6(_0x1bc1f0[_0x89d6('0x10')][_0x89d6('0x12')]);}else{logger[_0x89d6('0x13')](_0x89d6('0xc'),_0x2b06f9,'request\x20sent');_0x4620b6(_0x1bc1f0[_0x89d6('0x14')][_0x89d6('0x12')]);}})[_0x89d6('0x15')](function(_0x1d6655){logger['error'](_0x89d6('0xc'),_0x2b06f9,_0x1d6655);_0x142f07(_0x1d6655);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 4c4edc1..1203cc4 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 _0x598a=['addDisposition','create','addImap','addSmtp','/:id/interactions','addApplications','/:id/send','send','addAgents','update','delete','removeDispositions','removeAnswers','removeImap','removeSmtp','/:id','destroy','removeAgents','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/verify','/:id/users','post'];(function(_0x39fcba,_0x556e27){var _0x2a05c4=function(_0x5254ff){while(--_0x5254ff){_0x39fcba['push'](_0x39fcba['shift']());}};_0x2a05c4(++_0x556e27);}(_0x598a,0xce));var _0xa598=function(_0xa91ed3,_0x2329f0){_0xa91ed3=_0xa91ed3-0x0;var _0x2e6620=_0x598a[_0xa91ed3];return _0x2e6620;};'use strict';var multer=require(_0xa598('0x0'));var util=require('util');var path=require(_0xa598('0x1'));var timeout=require(_0xa598('0x2'));var express=require(_0xa598('0x3'));var router=express[_0xa598('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xa598('0x5'));var interaction=require(_0xa598('0x6'));var config=require(_0xa598('0x7'));var controller=require(_0xa598('0x8'));router[_0xa598('0x9')]('/',auth[_0xa598('0xa')](),controller[_0xa598('0xb')]);router['get'](_0xa598('0xc'),auth[_0xa598('0xa')](),controller[_0xa598('0xd')]);router[_0xa598('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xa598('0xe')]);router['get'](_0xa598('0xf'),auth[_0xa598('0xa')](),controller[_0xa598('0x10')]);router['get'](_0xa598('0x11'),auth[_0xa598('0xa')](),controller['getAnswers']);router['get'](_0xa598('0x12'),auth[_0xa598('0xa')](),controller[_0xa598('0x13')]);router[_0xa598('0x9')](_0xa598('0x14'),auth[_0xa598('0xa')](),controller[_0xa598('0x15')]);router['get']('/:id/interactions',auth[_0xa598('0xa')](),controller[_0xa598('0x16')]);router[_0xa598('0x9')](_0xa598('0x17'),auth['isAuthenticated'](),controller['getApplications']);router[_0xa598('0x9')](_0xa598('0x18'),auth['isAuthenticated'](),controller[_0xa598('0x19')]);router[_0xa598('0x9')](_0xa598('0x1a'),auth[_0xa598('0xa')](),controller['verifySmtp']);router['get'](_0xa598('0x1b'),auth['isAuthenticated'](),controller['getAgents']);router[_0xa598('0x1c')](_0xa598('0xf'),auth[_0xa598('0xa')](),controller[_0xa598('0x1d')]);router['post']('/:id/canned_answers',auth[_0xa598('0xa')](),controller['addAnswer']);router[_0xa598('0x1c')]('/',auth[_0xa598('0xa')](),controller[_0xa598('0x1e')]);router['post']('/:id/in_servers',auth['isAuthenticated'](),controller[_0xa598('0x1f')]);router[_0xa598('0x1c')](_0xa598('0x14'),auth['isAuthenticated'](),controller[_0xa598('0x20')]);router[_0xa598('0x1c')](_0xa598('0x21'),auth[_0xa598('0xa')](),controller['addInteraction']);router[_0xa598('0x1c')](_0xa598('0x17'),auth[_0xa598('0xa')](),controller[_0xa598('0x22')]);router[_0xa598('0x1c')](_0xa598('0x23'),auth[_0xa598('0xa')](),controller[_0xa598('0x24')]);router[_0xa598('0x1c')]('/:id/users',auth[_0xa598('0xa')](),controller[_0xa598('0x25')]);router['put']('/:id',auth[_0xa598('0xa')](),controller[_0xa598('0x26')]);router[_0xa598('0x27')](_0xa598('0xf'),auth['isAuthenticated'](),controller[_0xa598('0x28')]);router[_0xa598('0x27')]('/:id/canned_answers',auth[_0xa598('0xa')](),controller[_0xa598('0x29')]);router[_0xa598('0x27')](_0xa598('0x12'),auth[_0xa598('0xa')](),controller[_0xa598('0x2a')]);router[_0xa598('0x27')](_0xa598('0x14'),auth[_0xa598('0xa')](),controller[_0xa598('0x2b')]);router['delete'](_0xa598('0x2c'),auth[_0xa598('0xa')](),controller[_0xa598('0x2d')]);router['delete']('/:id/users',auth[_0xa598('0xa')](),controller[_0xa598('0x2e')]);module['exports']=router; \ No newline at end of file +var _0x61fd=['addAnswer','create','addImap','addSmtp','/:id/interactions','addInteraction','addApplications','/:id/send','send','/:id/users','addAgents','update','delete','removeSmtp','removeAgents','exports','multer','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getAnswers','/:id/in_servers','/:id/out_servers','getSmtp','/:id/applications','/:id/messages','getMessages','/:id/verify','verifySmtp','getAgents','post','addDisposition','/:id/canned_answers'];(function(_0x57b6f4,_0x18a077){var _0x24bda6=function(_0x17b171){while(--_0x17b171){_0x57b6f4['push'](_0x57b6f4['shift']());}};_0x24bda6(++_0x18a077);}(_0x61fd,0x13d));var _0xd61f=function(_0x59f5a4,_0x465acb){_0x59f5a4=_0x59f5a4-0x0;var _0x4824aa=_0x61fd[_0x59f5a4];return _0x4824aa;};'use strict';var multer=require(_0xd61f('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xd61f('0x1')]();var fs_extra=require(_0xd61f('0x2'));var auth=require(_0xd61f('0x3'));var interaction=require(_0xd61f('0x4'));var config=require(_0xd61f('0x5'));var controller=require('./mailAccount.controller');router[_0xd61f('0x6')]('/',auth[_0xd61f('0x7')](),controller[_0xd61f('0x8')]);router[_0xd61f('0x6')](_0xd61f('0x9'),auth[_0xd61f('0x7')](),controller[_0xd61f('0xa')]);router[_0xd61f('0x6')](_0xd61f('0xb'),auth[_0xd61f('0x7')](),controller[_0xd61f('0xc')]);router[_0xd61f('0x6')](_0xd61f('0xd'),auth[_0xd61f('0x7')](),controller['getDispositions']);router[_0xd61f('0x6')]('/:id/canned_answers',auth[_0xd61f('0x7')](),controller[_0xd61f('0xe')]);router[_0xd61f('0x6')](_0xd61f('0xf'),auth[_0xd61f('0x7')](),controller['getImap']);router['get'](_0xd61f('0x10'),auth['isAuthenticated'](),controller[_0xd61f('0x11')]);router['get']('/:id/interactions',auth[_0xd61f('0x7')](),controller['getInteractions']);router[_0xd61f('0x6')](_0xd61f('0x12'),auth['isAuthenticated'](),controller['getApplications']);router[_0xd61f('0x6')](_0xd61f('0x13'),auth[_0xd61f('0x7')](),controller[_0xd61f('0x14')]);router[_0xd61f('0x6')](_0xd61f('0x15'),auth[_0xd61f('0x7')](),controller[_0xd61f('0x16')]);router[_0xd61f('0x6')]('/:id/users',auth[_0xd61f('0x7')](),controller[_0xd61f('0x17')]);router[_0xd61f('0x18')](_0xd61f('0xd'),auth[_0xd61f('0x7')](),controller[_0xd61f('0x19')]);router[_0xd61f('0x18')](_0xd61f('0x1a'),auth[_0xd61f('0x7')](),controller[_0xd61f('0x1b')]);router[_0xd61f('0x18')]('/',auth[_0xd61f('0x7')](),controller[_0xd61f('0x1c')]);router['post'](_0xd61f('0xf'),auth[_0xd61f('0x7')](),controller[_0xd61f('0x1d')]);router[_0xd61f('0x18')](_0xd61f('0x10'),auth[_0xd61f('0x7')](),controller[_0xd61f('0x1e')]);router[_0xd61f('0x18')](_0xd61f('0x1f'),auth[_0xd61f('0x7')](),controller[_0xd61f('0x20')]);router[_0xd61f('0x18')](_0xd61f('0x12'),auth[_0xd61f('0x7')](),controller[_0xd61f('0x21')]);router['post'](_0xd61f('0x22'),auth[_0xd61f('0x7')](),controller[_0xd61f('0x23')]);router[_0xd61f('0x18')](_0xd61f('0x24'),auth[_0xd61f('0x7')](),controller[_0xd61f('0x25')]);router['put'](_0xd61f('0xb'),auth['isAuthenticated'](),controller[_0xd61f('0x26')]);router[_0xd61f('0x27')]('/:id/dispositions',auth['isAuthenticated'](),controller['removeDispositions']);router[_0xd61f('0x27')]('/:id/canned_answers',auth[_0xd61f('0x7')](),controller['removeAnswers']);router[_0xd61f('0x27')](_0xd61f('0xf'),auth[_0xd61f('0x7')](),controller['removeImap']);router[_0xd61f('0x27')]('/:id/out_servers',auth[_0xd61f('0x7')](),controller[_0xd61f('0x28')]);router['delete'](_0xd61f('0xb'),auth[_0xd61f('0x7')](),controller['destroy']);router[_0xd61f('0x27')](_0xd61f('0x24'),auth['isAuthenticated'](),controller[_0xd61f('0x29')]);module[_0xd61f('0x2a')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index ffd22f0..fac9d13 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 _0x9aba=['provider','custom','sequelize','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','ENUM','hotmail','yahoo','outlook365','getDataValue'];(function(_0x37215d,_0x6942ad){var _0x5f21c4=function(_0x2c87cc){while(--_0x2c87cc){_0x37215d['push'](_0x37215d['shift']());}};_0x5f21c4(++_0x6942ad);}(_0x9aba,0x156));var _0xa9ab=function(_0x3884f7,_0x1e27e4){_0x3884f7=_0x3884f7-0x0;var _0x3d8cfb=_0x9aba[_0x3884f7];return _0x3d8cfb;};'use strict';var Sequelize=require(_0xa9ab('0x0'));module[_0xa9ab('0x1')]={'description':{'type':Sequelize[_0xa9ab('0x2')]},'name':{'type':Sequelize[_0xa9ab('0x2')],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0xa9ab('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xa9ab('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0xa9ab('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0xa9ab('0x4')]},'markAsUnread':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xa9ab('0x2')],'allowNull':![],'defaultValue':_0xa9ab('0x5')},'fontSize':{'type':Sequelize[_0xa9ab('0x6')](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xa9ab('0x7');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xa9ab('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xa9ab('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xa9ab('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xa9ab('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xa9ab('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xa9ab('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0xa9ab('0x8')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x2aaec2){if(!_0x2aaec2)this[_0xa9ab('0x9')]('mandatoryDispositionPauseId',null);this['setDataValue']('mandatoryDisposition',_0x2aaec2);}},'provider':{'type':Sequelize[_0xa9ab('0xa')]('gmail',_0xa9ab('0xb'),_0xa9ab('0xc'),_0xa9ab('0xd')),'defaultValue':null,'get':function(){var _0x23c75d=this[_0xa9ab('0xe')](_0xa9ab('0xf'));return _0x23c75d||_0xa9ab('0x10');},'set':function(_0x328d2e){if(_0x328d2e==='custom'){_0x328d2e=null;}return this['setDataValue']('provider',_0x328d2e);}}}; \ No newline at end of file +var _0xcbae=['outlook365','getDataValue','provider','custom','setDataValue','sequelize','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','mandatoryDisposition','ENUM','gmail','hotmail'];(function(_0x5789c6,_0x55f3a0){var _0xad47f1=function(_0x49a37d){while(--_0x49a37d){_0x5789c6['push'](_0x5789c6['shift']());}};_0xad47f1(++_0x55f3a0);}(_0xcbae,0x8a));var _0xecba=function(_0x54ef6b,_0x37c730){_0x54ef6b=_0x54ef6b-0x0;var _0x1fdce3=_0xcbae[_0x54ef6b];return _0x1fdce3;};'use strict';var Sequelize=require(_0xecba('0x0'));module[_0xecba('0x1')]={'description':{'type':Sequelize[_0xecba('0x2')]},'name':{'type':Sequelize[_0xecba('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0xecba('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0xecba('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xecba('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0xecba('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0xecba('0x4')]},'markAsUnread':{'type':Sequelize[_0xecba('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xecba('0x2')],'allowNull':![],'defaultValue':_0xecba('0x5')},'fontSize':{'type':Sequelize[_0xecba('0x6')](0x2)[_0xecba('0x7')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xecba('0x4')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xecba('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xecba('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xecba('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xecba('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xecba('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xecba('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xecba('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0xecba('0x8')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x5a3590){if(!_0x5a3590)this['setDataValue'](_0xecba('0x9'),null);this['setDataValue'](_0xecba('0xa'),_0x5a3590);}},'provider':{'type':Sequelize[_0xecba('0xb')](_0xecba('0xc'),_0xecba('0xd'),'yahoo',_0xecba('0xe')),'defaultValue':null,'get':function(){var _0x4159f4=this[_0xecba('0xf')](_0xecba('0x10'));return _0x4159f4||_0xecba('0x11');},'set':function(_0x43263e){if(_0x43263e===_0xecba('0x11')){_0x43263e=null;}return this[_0xecba('0x12')](_0xecba('0x10'),_0x43263e);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 0777369..8e2ecd4 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 _0x2cc1=['pass','modernAuthentication','CloudProviderId','host','port','secure','service','authentication','Imap','Smtp','MailServerOut','Pause','mandatoryDispositionPause','map','MailAccount','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','include','rows','show','params','MailServerIn','rawAttributes','includeAll','options','find','body','provider','custom','Mail\x20Account\x20not\x20found','describe','addDisposition','MailAccountId','Disposition','getDispositions','pick','findAll','removeDispositions','ids','addAnswer','CannedAnswer','create','findOne','removeAnswers','email','ListId','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','MailAccounts','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','omit','getInteractions','CmContact','Contact','User','Owner','fullname','internal','Tag','tag','addApplications','transaction','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','destroy','bulkCreate','findAndCountAll','priority','finally','getApplications','getMessages','MailMessage','$gte','split','format','inlineCss','true','send','List','Contacts','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','isNil','from','%s\x20<%s>','attachments','join','server/files/attachments','SendMail','sendMail','List\x20not\x20found','subject','attach','out','YYYY-MM-DD\x20HH:mm:ss','Interaction','Messages','verifySmtp','getSmtpOptions','VerifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','emit','userMailAccount:save','removeAgents','userMailAccount:remove','getAgents','bluebird','lodash','juice','ioredis','../../components/parsers/qs','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','client','request','then','request\x20sent','debug','stringify','error','MailAccount,\x20%s,\x20%s','message','result','catch','status','undefined','limit','count','offset','set','Content-Range','json','update','get','UserProfileResource','sendStatus','stack','name','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','gmail','smtp.mail.yahoo.com','smtp-mail.outlook.com','smtp.office365.com','Unknown\x20email\x20service\x20provider','user','username','password'];(function(_0xce6f11,_0x3c3137){var _0x35b709=function(_0x1755c6){while(--_0x1755c6){_0xce6f11['push'](_0xce6f11['shift']());}};_0x35b709(++_0x3c3137);}(_0x2cc1,0x8d));var _0x12cc=function(_0x99405c,_0x445476){_0x99405c=_0x99405c-0x0;var _0x3daed0=_0x2cc1[_0x99405c];return _0x3daed0;};'use strict';var moment=require('moment');var BPromise=require(_0x12cc('0x0'));var util=require('util');var path=require('path');var _=require(_0x12cc('0x1'));var juice=require(_0x12cc('0x2'));var Redis=require(_0x12cc('0x3'));var qs=require(_0x12cc('0x4'));var logger=require('../../config/logger')('api');var config=require('../../config/environment');var db=require(_0x12cc('0x5'))['db'];config['redis']=_[_0x12cc('0x6')](config[_0x12cc('0x7')],{'host':_0x12cc('0x8'),'port':0x18eb});var socket=require(_0x12cc('0x9'))(new Redis(config[_0x12cc('0x7')]));require('./mailAccount.socket')[_0x12cc('0xa')](socket);var jayson=require('jayson/promise');var client=jayson[_0x12cc('0xb')]['http']({'port':0x232b});function respondWithRpcPromise(_0x1a00aa,_0x27eb42,_0xc55783,_0xd0c606){return new BPromise(function(_0x5ca8cc,_0x12dcc3){var _0x197b96=_0xd0c606||client;return _0x197b96[_0x12cc('0xc')](_0x1a00aa,_0xc55783)[_0x12cc('0xd')](function(_0x551284){logger['info']('MailAccount,\x20%s,\x20%s',_0x27eb42,_0x12cc('0xe'));logger[_0x12cc('0xf')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x27eb42,_0x12cc('0xe'),JSON[_0x12cc('0x10')](_0x551284));if(_0x551284[_0x12cc('0x11')]){if(_0x551284['error']['code']===0x1f4){logger[_0x12cc('0x11')](_0x12cc('0x12'),_0x27eb42,_0x551284[_0x12cc('0x11')][_0x12cc('0x13')]);return _0x12dcc3(_0x551284[_0x12cc('0x11')]['message']);}logger[_0x12cc('0x11')](_0x12cc('0x12'),_0x27eb42,_0x551284['error'][_0x12cc('0x13')]);return _0x5ca8cc(_0x551284[_0x12cc('0x11')][_0x12cc('0x13')]);}else{logger['info'](_0x12cc('0x12'),_0x27eb42,_0x12cc('0xe'));_0x5ca8cc(_0x551284[_0x12cc('0x14')][_0x12cc('0x13')]);}})[_0x12cc('0x15')](function(_0x3186f0){logger[_0x12cc('0x11')](_0x12cc('0x12'),_0x27eb42,_0x3186f0);_0x12dcc3(_0x3186f0);});});}function respondWithStatusCode(_0x231355,_0x5bc343){_0x5bc343=_0x5bc343||0xcc;return function(_0x586a01){if(_0x586a01){return _0x231355['sendStatus'](_0x5bc343);}return _0x231355[_0x12cc('0x16')](_0x5bc343)['end']();};}function respondWithResult(_0x47ec6a,_0x51218c){_0x51218c=_0x51218c||0xc8;return function(_0x4947d3){if(_0x4947d3){return _0x47ec6a[_0x12cc('0x16')](_0x51218c)['json'](_0x4947d3);}};}function respondWithFilteredResult(_0x1a99e3,_0x42807e){return function(_0x16a1fe){if(_0x16a1fe){var _0x1ff345=typeof _0x42807e['offset']===_0x12cc('0x17')&&typeof _0x42807e[_0x12cc('0x18')]==='undefined';var _0x37efb2=_0x16a1fe[_0x12cc('0x19')];var _0x2440be=_0x1ff345?0x0:_0x42807e[_0x12cc('0x1a')];var _0x4f7c91=_0x1ff345?_0x16a1fe[_0x12cc('0x19')]:_0x42807e[_0x12cc('0x1a')]+_0x42807e[_0x12cc('0x18')];var _0x5905d6;if(_0x4f7c91>=_0x37efb2){_0x4f7c91=_0x37efb2;_0x5905d6=0xc8;}else{_0x5905d6=0xce;}_0x1a99e3[_0x12cc('0x16')](_0x5905d6);return _0x1a99e3[_0x12cc('0x1b')](_0x12cc('0x1c'),_0x2440be+'-'+_0x4f7c91+'/'+_0x37efb2)[_0x12cc('0x1d')](_0x16a1fe);}return null;};}function saveUpdates(_0xfe242a){return function(_0x5f27cd){if(_0x5f27cd){return _0x5f27cd[_0x12cc('0x1e')](_0xfe242a)['then'](function(_0x3b3466){return _0x3b3466;});}return null;};}function removeEntity(_0x41d9ee){return function(_0x1bd539){if(_0x1bd539){return _0x1bd539['destroy']()[_0x12cc('0xd')](function(){var _0x1e60d5=_0x1bd539[_0x12cc('0x1f')]({'plain':!![]});var _0x3ea142='MailAccounts';return db[_0x12cc('0x20')]['destroy']({'where':{'type':_0x3ea142,'resourceId':_0x1e60d5['id']}})['then'](function(){return _0x1bd539;});})[_0x12cc('0xd')](function(){_0x41d9ee[_0x12cc('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f1810){return function(_0x18e1a2){if(!_0x18e1a2){_0x3f1810[_0x12cc('0x21')](0x194);}return _0x18e1a2;};}function handleError(_0x37aca5,_0xfa7380){_0xfa7380=_0xfa7380||0x1f4;return function(_0x2a0756){logger[_0x12cc('0x11')](_0x2a0756[_0x12cc('0x22')]);if(_0x2a0756['name']){delete _0x2a0756[_0x12cc('0x23')];}_0x37aca5[_0x12cc('0x16')](_0xfa7380)['send'](_0x2a0756);};}function getImapHost(_0x31a45c){switch(_0x31a45c){case'gmail':return _0x12cc('0x24');case _0x12cc('0x25'):return _0x12cc('0x26');case _0x12cc('0x27'):return _0x12cc('0x28');case _0x12cc('0x29'):return _0x12cc('0x2a');}throw new Error('Unknown\x20email\x20service\x20provider',_0x31a45c);}function getSmtpHost(_0x298f5c){switch(_0x298f5c){case _0x12cc('0x2b'):return'smtp.gmail.com';case _0x12cc('0x25'):return _0x12cc('0x2c');case _0x12cc('0x27'):return _0x12cc('0x2d');case _0x12cc('0x29'):return _0x12cc('0x2e');}throw new Error(_0x12cc('0x2f'),_0x298f5c);}function getAuthenticationOptions(_0xb3617f,_0x22acd1){var _0x74bcf0={};var _0x194064={};if(_0xb3617f){_0x74bcf0[_0x12cc('0x30')]=_0x194064[_0x12cc('0x30')]=_0x22acd1[_0x12cc('0x31')];_0x74bcf0[_0x12cc('0x32')]=_0x194064[_0x12cc('0x33')]=_0x22acd1['password'];if(_0x22acd1['modernAuthentication']){_0x74bcf0[_0x12cc('0x34')]=_0x194064['modernAuthentication']=!![];_0x74bcf0[_0x12cc('0x35')]=_0x194064[_0x12cc('0x35')]=_0x22acd1[_0x12cc('0x35')];_0x74bcf0[_0x12cc('0x32')]=_0x194064['pass']=null;}else{_0x74bcf0[_0x12cc('0x35')]=_0x194064[_0x12cc('0x35')]=null;}_0x74bcf0[_0x12cc('0x36')]=getImapHost(_0xb3617f);_0x74bcf0[_0x12cc('0x37')]=0x3e1;_0x194064['host']=getSmtpHost(_0xb3617f);_0x194064[_0x12cc('0x37')]=0x24b;_0x194064[_0x12cc('0x38')]=![];_0x74bcf0['service']=_0x194064[_0x12cc('0x39')]=null;}else{if(_0x22acd1[_0x12cc('0x3a')]){_0x74bcf0[_0x12cc('0x30')]=_0x194064[_0x12cc('0x30')]=_0x22acd1[_0x12cc('0x31')];_0x74bcf0['password']=_0x194064[_0x12cc('0x33')]=_0x22acd1[_0x12cc('0x32')];}else{_0x74bcf0['authentication']=_0x194064[_0x12cc('0x3a')]=![];_0x74bcf0[_0x12cc('0x30')]=_0x194064[_0x12cc('0x30')]=null;_0x74bcf0['password']=_0x194064[_0x12cc('0x33')]=null;}_0x74bcf0[_0x12cc('0x36')]=_0x22acd1[_0x12cc('0x3b')][_0x12cc('0x36')];_0x74bcf0['port']=_0x22acd1[_0x12cc('0x3b')][_0x12cc('0x37')];_0x194064[_0x12cc('0x36')]=_0x22acd1['Smtp'][_0x12cc('0x36')];_0x194064[_0x12cc('0x37')]=_0x22acd1[_0x12cc('0x3c')][_0x12cc('0x37')];}return{'Imap':_0x74bcf0,'Smtp':_0x194064};}exports['index']=function(_0x5f42e7,_0x37388d){var _0x156a58={'include':[{'model':db['MailServerIn'],'as':_0x12cc('0x3b')},{'model':db[_0x12cc('0x3d')],'as':_0x12cc('0x3c')},{'model':db[_0x12cc('0x3e')],'as':_0x12cc('0x3f')}]},_0x159e59={},_0x476e97={'count':0x0,'rows':[]};var _0x3865d1=_[_0x12cc('0x40')](db[_0x12cc('0x41')]['rawAttributes'],function(_0x2af017){return{'name':_0x2af017['fieldName'],'type':_0x2af017[_0x12cc('0x42')][_0x12cc('0x43')]};});_0x159e59[_0x12cc('0x44')]=_['map'](_0x3865d1,_0x12cc('0x23'));_0x159e59[_0x12cc('0x45')]=_[_0x12cc('0x46')](_0x5f42e7[_0x12cc('0x45')]);_0x159e59[_0x12cc('0x47')]=_[_0x12cc('0x48')](_0x159e59[_0x12cc('0x44')],_0x159e59[_0x12cc('0x45')]);_0x156a58[_0x12cc('0x49')]=_[_0x12cc('0x48')](_0x159e59['model'],qs[_0x12cc('0x4a')](_0x5f42e7[_0x12cc('0x45')]['fields']));_0x156a58[_0x12cc('0x49')]=_0x156a58[_0x12cc('0x49')][_0x12cc('0x4b')]?_0x156a58[_0x12cc('0x49')]:_0x159e59[_0x12cc('0x44')];if(!_0x5f42e7[_0x12cc('0x45')][_0x12cc('0x4c')](_0x12cc('0x4d'))){_0x156a58['limit']=qs[_0x12cc('0x18')](_0x5f42e7[_0x12cc('0x45')][_0x12cc('0x18')]);_0x156a58[_0x12cc('0x1a')]=qs[_0x12cc('0x1a')](_0x5f42e7[_0x12cc('0x45')][_0x12cc('0x1a')]);}_0x156a58[_0x12cc('0x4e')]=qs[_0x12cc('0x4f')](_0x5f42e7[_0x12cc('0x45')]['sort']);_0x156a58[_0x12cc('0x50')]=qs[_0x12cc('0x47')](_['pick'](_0x5f42e7[_0x12cc('0x45')],_0x159e59[_0x12cc('0x47')]),_0x3865d1);if(_0x5f42e7[_0x12cc('0x45')][_0x12cc('0x51')]){_0x156a58['where']=_[_0x12cc('0x52')](_0x156a58['where'],{'$or':_[_0x12cc('0x40')](_0x3865d1,function(_0x344530){if(_0x344530[_0x12cc('0x42')]!==_0x12cc('0x53')){var _0x94d4a4={};_0x94d4a4[_0x344530[_0x12cc('0x23')]]={'$like':'%'+_0x5f42e7[_0x12cc('0x45')][_0x12cc('0x51')]+'%'};return _0x94d4a4;}})});}_0x156a58=_[_0x12cc('0x52')]({},_0x156a58,_0x5f42e7['options']);var _0x475fa7={'where':_0x156a58[_0x12cc('0x50')]};return db[_0x12cc('0x41')][_0x12cc('0x19')](_0x475fa7)[_0x12cc('0xd')](function(_0x164c6d){_0x476e97['count']=_0x164c6d;if(_0x5f42e7[_0x12cc('0x45')]['includeAll']){_0x156a58[_0x12cc('0x54')]=[{'all':!![]}];}return db[_0x12cc('0x41')]['findAll'](_0x156a58);})[_0x12cc('0xd')](function(_0x158925){_0x476e97[_0x12cc('0x55')]=_0x158925;return _0x476e97;})[_0x12cc('0xd')](respondWithFilteredResult(_0x37388d,_0x156a58))[_0x12cc('0x15')](handleError(_0x37388d,null));};exports[_0x12cc('0x56')]=function(_0x4f4cdf,_0x963b4c){var _0x2e4178={'raw':![],'where':{'id':_0x4f4cdf[_0x12cc('0x57')]['id']},'include':[{'model':db[_0x12cc('0x58')],'as':_0x12cc('0x3b')},{'model':db[_0x12cc('0x3d')],'as':_0x12cc('0x3c')},{'model':db['Pause'],'as':_0x12cc('0x3f')}]},_0x176fd9={};_0x176fd9[_0x12cc('0x44')]=_[_0x12cc('0x46')](db[_0x12cc('0x41')][_0x12cc('0x59')]);_0x176fd9[_0x12cc('0x45')]=_['keys'](_0x4f4cdf['query']);_0x176fd9['filters']=_[_0x12cc('0x48')](_0x176fd9[_0x12cc('0x44')],_0x176fd9[_0x12cc('0x45')]);_0x2e4178[_0x12cc('0x49')]=_[_0x12cc('0x48')](_0x176fd9[_0x12cc('0x44')],qs[_0x12cc('0x4a')](_0x4f4cdf[_0x12cc('0x45')]['fields']));_0x2e4178[_0x12cc('0x49')]=_0x2e4178[_0x12cc('0x49')][_0x12cc('0x4b')]?_0x2e4178[_0x12cc('0x49')]:_0x176fd9[_0x12cc('0x44')];if(_0x4f4cdf['query'][_0x12cc('0x5a')]){_0x2e4178[_0x12cc('0x54')]=[{'all':!![]}];}_0x2e4178=_[_0x12cc('0x52')]({},_0x2e4178,_0x4f4cdf[_0x12cc('0x5b')]);return db['MailAccount'][_0x12cc('0x5c')](_0x2e4178)[_0x12cc('0xd')](handleEntityNotFound(_0x963b4c,null))[_0x12cc('0xd')](respondWithResult(_0x963b4c,null))[_0x12cc('0x15')](handleError(_0x963b4c,null));};exports[_0x12cc('0x1e')]=function(_0x3e3b9b,_0x2cd12c){if(_0x3e3b9b[_0x12cc('0x5d')]['id']){delete _0x3e3b9b[_0x12cc('0x5d')]['id'];}var _0x308c6b=_0x3e3b9b[_0x12cc('0x5d')][_0x12cc('0x5e')]===_0x12cc('0x5f')?null:_0x3e3b9b[_0x12cc('0x5d')][_0x12cc('0x5e')];var _0x3100de=_0x3e3b9b['body']['Imap']||{};var _0x22126e=_0x3e3b9b[_0x12cc('0x5d')][_0x12cc('0x3c')]||{};if(_0x308c6b){_0x3100de[_0x12cc('0x36')]=getImapHost(_0x308c6b);_0x3100de[_0x12cc('0x37')]=0x3e1;_0x22126e[_0x12cc('0x36')]=getSmtpHost(_0x308c6b);_0x22126e[_0x12cc('0x37')]=0x24b;_0x22126e[_0x12cc('0x38')]=![];}if(_0x22126e['modernAuthentication']){_0x22126e[_0x12cc('0x38')]=![];}else{_0x22126e[_0x12cc('0x35')]=null;}if(!_0x3100de[_0x12cc('0x34')])_0x3100de[_0x12cc('0x35')]=null;_0x3e3b9b[_0x12cc('0x5d')][_0x12cc('0x3b')]=_0x3100de;_0x3e3b9b['body'][_0x12cc('0x3c')]=_0x22126e;return db['MailAccount'][_0x12cc('0x5c')]({'where':{'id':_0x3e3b9b[_0x12cc('0x57')]['id']},'include':[{'model':db[_0x12cc('0x58')],'as':'Imap'},{'model':db[_0x12cc('0x3d')],'as':_0x12cc('0x3c')},{'model':db[_0x12cc('0x3e')],'as':_0x12cc('0x3f')}]})[_0x12cc('0xd')](handleEntityNotFound(_0x2cd12c,null))[_0x12cc('0xd')](function(_0x4becc1){if(!_0x4becc1)throw new Error(_0x12cc('0x60'));if(_0x4becc1['service'])delete _0x3e3b9b['body'][_0x12cc('0x3b')];return _0x4becc1;})[_0x12cc('0xd')](saveUpdates(_0x3e3b9b['body'],null))[_0x12cc('0xd')](function(_0x33ff9b){if(!_0x3e3b9b[_0x12cc('0x5d')][_0x12cc('0x3b')])return _0x33ff9b;return db[_0x12cc('0x58')][_0x12cc('0x1e')](_0x3e3b9b[_0x12cc('0x5d')][_0x12cc('0x3b')],{'where':{'MailAccountId':_0x33ff9b['id']}})['then'](function(){return _0x33ff9b;});})['then'](function(_0x48a589){if(!_0x3e3b9b[_0x12cc('0x5d')][_0x12cc('0x3c')])return _0x48a589;return db[_0x12cc('0x3d')][_0x12cc('0x1e')](_0x3e3b9b[_0x12cc('0x5d')][_0x12cc('0x3c')],{'where':{'MailAccountId':_0x48a589['id']}})[_0x12cc('0xd')](function(){return _0x48a589;});})[_0x12cc('0xd')](respondWithResult(_0x2cd12c,null))[_0x12cc('0x15')](handleError(_0x2cd12c,null));};exports['describe']=function(_0x355356,_0x5e2f8b){return db['MailAccount'][_0x12cc('0x61')]()[_0x12cc('0xd')](respondWithResult(_0x5e2f8b,null))[_0x12cc('0x15')](handleError(_0x5e2f8b,null));};exports[_0x12cc('0x62')]=function(_0xb764aa,_0x5d52eb){if(_0xb764aa[_0x12cc('0x5d')]['id']){delete _0xb764aa[_0x12cc('0x5d')]['id'];}return db[_0x12cc('0x41')]['find']({'where':{'id':_0xb764aa[_0x12cc('0x57')]['id']}})[_0x12cc('0xd')](handleEntityNotFound(_0x5d52eb,null))[_0x12cc('0xd')](function(_0x17a29b){if(_0x17a29b){_0xb764aa['body'][_0x12cc('0x63')]=_0x17a29b['id'];return db[_0x12cc('0x64')]['create'](_0xb764aa[_0x12cc('0x5d')]);}})[_0x12cc('0xd')](respondWithResult(_0x5d52eb,null))[_0x12cc('0x15')](handleError(_0x5d52eb,null));};exports[_0x12cc('0x65')]=function(_0xbf8acc,_0x263d9e){var _0x26478b={'raw':![],'where':{}};var _0xed4f04={};var _0x6c29db={'count':0x0,'rows':[]};return db[_0x12cc('0x41')]['findOne']({'where':{'id':_0xbf8acc[_0x12cc('0x57')]['id']}})[_0x12cc('0xd')](handleEntityNotFound(_0x263d9e,null))[_0x12cc('0xd')](function(_0x2e9526){if(_0x2e9526){_0xed4f04[_0x12cc('0x44')]=_[_0x12cc('0x46')](db[_0x12cc('0x64')][_0x12cc('0x59')]);_0xed4f04[_0x12cc('0x45')]=_[_0x12cc('0x46')](_0xbf8acc[_0x12cc('0x45')]);_0xed4f04[_0x12cc('0x47')]=_[_0x12cc('0x48')](_0xed4f04[_0x12cc('0x44')],_0xed4f04[_0x12cc('0x45')]);_0x26478b[_0x12cc('0x49')]=_[_0x12cc('0x48')](_0xed4f04[_0x12cc('0x44')],qs[_0x12cc('0x4a')](_0xbf8acc[_0x12cc('0x45')][_0x12cc('0x4a')]));_0x26478b[_0x12cc('0x49')]=_0x26478b['attributes']['length']?_0x26478b[_0x12cc('0x49')]:_0xed4f04[_0x12cc('0x44')];if(!_0xbf8acc['query'][_0x12cc('0x4c')](_0x12cc('0x4d'))){_0x26478b[_0x12cc('0x18')]=qs[_0x12cc('0x18')](_0xbf8acc[_0x12cc('0x45')][_0x12cc('0x18')]);_0x26478b[_0x12cc('0x1a')]=qs['offset'](_0xbf8acc['query'][_0x12cc('0x1a')]);}_0x26478b[_0x12cc('0x4e')]=qs[_0x12cc('0x4f')](_0xbf8acc['query'][_0x12cc('0x4f')]);_0x26478b[_0x12cc('0x50')]=qs['filters'](_[_0x12cc('0x66')](_0xbf8acc[_0x12cc('0x45')],_0xed4f04[_0x12cc('0x47')]));_0x26478b[_0x12cc('0x50')]['MailAccountId']=_0x2e9526['id'];if(_0xbf8acc['query'][_0x12cc('0x51')]){_0x26478b[_0x12cc('0x50')]=_[_0x12cc('0x52')](_0x26478b[_0x12cc('0x50')],{'$or':_[_0x12cc('0x40')](_0x26478b[_0x12cc('0x49')],function(_0xe2a600){var _0x5ef633={};_0x5ef633[_0xe2a600]={'$like':'%'+_0xbf8acc['query']['filter']+'%'};return _0x5ef633;})});}_0x26478b=_[_0x12cc('0x52')]({},_0x26478b,_0xbf8acc['options']);return db['Disposition'][_0x12cc('0x19')]({'where':_0x26478b[_0x12cc('0x50')]})[_0x12cc('0xd')](function(_0x14f939){_0x6c29db[_0x12cc('0x19')]=_0x14f939;if(_0xbf8acc[_0x12cc('0x45')][_0x12cc('0x5a')]){_0x26478b[_0x12cc('0x54')]=[{'all':!![]}];}return db[_0x12cc('0x64')][_0x12cc('0x67')](_0x26478b);})['then'](function(_0x31ed5e){_0x6c29db[_0x12cc('0x55')]=_0x31ed5e;return _0x6c29db;});}})[_0x12cc('0xd')](respondWithFilteredResult(_0x263d9e,_0x26478b))['catch'](handleError(_0x263d9e,null));};exports[_0x12cc('0x68')]=function(_0x3ebaf6,_0x43eb91){return db[_0x12cc('0x41')][_0x12cc('0x5c')]({'where':{'id':_0x3ebaf6[_0x12cc('0x57')]['id']}})['then'](handleEntityNotFound(_0x43eb91,null))['then'](function(_0x340b98){if(_0x340b98){return _0x340b98[_0x12cc('0x68')](_0x3ebaf6[_0x12cc('0x45')][_0x12cc('0x69')]);}})[_0x12cc('0xd')](respondWithStatusCode(_0x43eb91,null))[_0x12cc('0x15')](handleError(_0x43eb91,null));};exports[_0x12cc('0x6a')]=function(_0x35766f,_0x56fb3f){if(_0x35766f['body']['id']){delete _0x35766f[_0x12cc('0x5d')]['id'];}return db[_0x12cc('0x41')][_0x12cc('0x5c')]({'where':{'id':_0x35766f[_0x12cc('0x57')]['id']}})[_0x12cc('0xd')](handleEntityNotFound(_0x56fb3f,null))[_0x12cc('0xd')](function(_0x20095a){if(_0x20095a){_0x35766f[_0x12cc('0x5d')][_0x12cc('0x63')]=_0x20095a['id'];return db[_0x12cc('0x6b')][_0x12cc('0x6c')](_0x35766f[_0x12cc('0x5d')]);}})[_0x12cc('0xd')](respondWithResult(_0x56fb3f,null))[_0x12cc('0x15')](handleError(_0x56fb3f,null));};exports['getAnswers']=function(_0x1c7d5c,_0x11bc0c){var _0x599233={'raw':![],'where':{}};var _0x1a3b98={};var _0x5698cc={'count':0x0,'rows':[]};return db['MailAccount'][_0x12cc('0x6d')]({'where':{'id':_0x1c7d5c[_0x12cc('0x57')]['id']}})['then'](handleEntityNotFound(_0x11bc0c,null))['then'](function(_0x417a0f){if(_0x417a0f){_0x1a3b98[_0x12cc('0x44')]=_[_0x12cc('0x46')](db['CannedAnswer'][_0x12cc('0x59')]);_0x1a3b98[_0x12cc('0x45')]=_[_0x12cc('0x46')](_0x1c7d5c[_0x12cc('0x45')]);_0x1a3b98[_0x12cc('0x47')]=_[_0x12cc('0x48')](_0x1a3b98[_0x12cc('0x44')],_0x1a3b98['query']);_0x599233[_0x12cc('0x49')]=_[_0x12cc('0x48')](_0x1a3b98['model'],qs[_0x12cc('0x4a')](_0x1c7d5c['query']['fields']));_0x599233[_0x12cc('0x49')]=_0x599233['attributes'][_0x12cc('0x4b')]?_0x599233['attributes']:_0x1a3b98[_0x12cc('0x44')];if(!_0x1c7d5c[_0x12cc('0x45')][_0x12cc('0x4c')]('nolimit')){_0x599233[_0x12cc('0x18')]=qs[_0x12cc('0x18')](_0x1c7d5c[_0x12cc('0x45')][_0x12cc('0x18')]);_0x599233[_0x12cc('0x1a')]=qs['offset'](_0x1c7d5c[_0x12cc('0x45')][_0x12cc('0x1a')]);}_0x599233['order']=qs[_0x12cc('0x4f')](_0x1c7d5c[_0x12cc('0x45')][_0x12cc('0x4f')]);_0x599233[_0x12cc('0x50')]=qs['filters'](_[_0x12cc('0x66')](_0x1c7d5c[_0x12cc('0x45')],_0x1a3b98[_0x12cc('0x47')]));_0x599233['where'][_0x12cc('0x63')]=_0x417a0f['id'];if(_0x1c7d5c[_0x12cc('0x45')][_0x12cc('0x51')]){_0x599233['where']=_['merge'](_0x599233['where'],{'$or':_[_0x12cc('0x40')](_0x599233['attributes'],function(_0x39846e){var _0x32adf3={};_0x32adf3[_0x39846e]={'$like':'%'+_0x1c7d5c[_0x12cc('0x45')][_0x12cc('0x51')]+'%'};return _0x32adf3;})});}_0x599233=_[_0x12cc('0x52')]({},_0x599233,_0x1c7d5c['options']);return db['CannedAnswer']['count']({'where':_0x599233[_0x12cc('0x50')]})[_0x12cc('0xd')](function(_0x562d76){_0x5698cc[_0x12cc('0x19')]=_0x562d76;if(_0x1c7d5c[_0x12cc('0x45')][_0x12cc('0x5a')]){_0x599233[_0x12cc('0x54')]=[{'all':!![]}];}return db[_0x12cc('0x6b')]['findAll'](_0x599233);})[_0x12cc('0xd')](function(_0x1bb71c){_0x5698cc[_0x12cc('0x55')]=_0x1bb71c;return _0x5698cc;});}})[_0x12cc('0xd')](respondWithFilteredResult(_0x11bc0c,_0x599233))[_0x12cc('0x15')](handleError(_0x11bc0c,null));};exports[_0x12cc('0x6e')]=function(_0x469d78,_0x41fb8e){return db[_0x12cc('0x41')][_0x12cc('0x5c')]({'where':{'id':_0x469d78[_0x12cc('0x57')]['id']}})[_0x12cc('0xd')](handleEntityNotFound(_0x41fb8e,null))['then'](function(_0x37bc35){if(_0x37bc35){return _0x37bc35['removeAnswers'](_0x469d78[_0x12cc('0x45')]['ids']);}})[_0x12cc('0xd')](respondWithStatusCode(_0x41fb8e,null))['catch'](handleError(_0x41fb8e,null));};exports[_0x12cc('0x6c')]=function(_0x25b7f6,_0x2ae479){var _0x8096e7={'name':_0x25b7f6[_0x12cc('0x5d')][_0x12cc('0x23')],'key':_0x25b7f6['body'][_0x12cc('0x43')],'provider':_0x25b7f6['body'][_0x12cc('0x5e')]===_0x12cc('0x5f')?null:_0x25b7f6[_0x12cc('0x5d')][_0x12cc('0x5e')],'email':_0x25b7f6[_0x12cc('0x5d')][_0x12cc('0x6f')],'ListId':_0x25b7f6['body'][_0x12cc('0x70')],'active':!_['isNil'](_0x25b7f6['body']['active'])?_0x25b7f6['body']['active']:!![],'description':_0x25b7f6['body'][_0x12cc('0x71')]||null};var _0xd6025f=getAuthenticationOptions(_0x8096e7[_0x12cc('0x5e')],_0x25b7f6[_0x12cc('0x5d')]);_0x8096e7[_0x12cc('0x3b')]=_0xd6025f[_0x12cc('0x3b')];_0x8096e7[_0x12cc('0x3c')]=_0xd6025f[_0x12cc('0x3c')];return db[_0x12cc('0x41')][_0x12cc('0x6c')](_0x8096e7,{'include':[{'model':db[_0x12cc('0x3d')],'as':'Smtp'},{'model':db[_0x12cc('0x58')],'as':_0x12cc('0x3b')}]})[_0x12cc('0xd')](function(_0x227d64){var _0x5b5ea0=_0x25b7f6['user'][_0x12cc('0x1f')]({'plain':!![]});if(!_0x5b5ea0)throw new Error(_0x12cc('0x72'));if(_0x5b5ea0['role']===_0x12cc('0x30')){var _0xf90341=_0x227d64[_0x12cc('0x1f')]({'plain':!![]});return db['UserProfileSection'][_0x12cc('0x5c')]({'where':{'name':_0x12cc('0x73'),'userProfileId':_0x5b5ea0[_0x12cc('0x74')]},'raw':!![]})[_0x12cc('0xd')](function(_0x1e958b){if(_0x1e958b&&_0x1e958b[_0x12cc('0x75')]===0x0){return db[_0x12cc('0x20')][_0x12cc('0x6c')]({'name':_0xf90341[_0x12cc('0x23')],'resourceId':_0xf90341['id'],'type':_0x1e958b['name'],'sectionId':_0x1e958b['id']},{})['then'](function(){return _0x227d64;});}else{return _0x227d64;}})[_0x12cc('0x15')](function(_0x59cdac){logger['error'](_0x12cc('0x76'),_0x59cdac);throw _0x59cdac;});}return _0x227d64;})[_0x12cc('0xd')](respondWithResult(_0x2ae479,0xc9))[_0x12cc('0x15')](handleError(_0x2ae479,null));};exports[_0x12cc('0x77')]=function(_0xbb560d,_0x4958a6){return db[_0x12cc('0x41')][_0x12cc('0x6d')]({'where':{'id':_0xbb560d[_0x12cc('0x57')]['id']}})[_0x12cc('0xd')](handleEntityNotFound(_0x4958a6,null))[_0x12cc('0xd')](function(_0x29b530){if(_0x29b530){return _0x29b530[_0x12cc('0x77')]();}return null;})[_0x12cc('0xd')](respondWithResult(_0x4958a6,null))[_0x12cc('0x15')](handleError(_0x4958a6,null));};exports[_0x12cc('0x78')]=function(_0x1aca45,_0x540bbb){if(_0x1aca45['body']['id']){delete _0x1aca45[_0x12cc('0x5d')]['id'];}return db[_0x12cc('0x41')][_0x12cc('0x5c')]({'where':{'id':_0x1aca45['params']['id']}})[_0x12cc('0xd')](handleEntityNotFound(_0x540bbb,null))[_0x12cc('0xd')](function(_0x35a67e){if(_0x35a67e){_0x1aca45[_0x12cc('0x5d')][_0x12cc('0x63')]=_0x35a67e['id'];return db[_0x12cc('0x58')][_0x12cc('0x6c')](_0x1aca45[_0x12cc('0x5d')]);}})['then'](respondWithResult(_0x540bbb,null))[_0x12cc('0x15')](handleError(_0x540bbb,null));};exports[_0x12cc('0x79')]=function(_0x26cedc,_0x23f643){return db[_0x12cc('0x41')][_0x12cc('0x6d')]({'where':{'id':_0x26cedc[_0x12cc('0x57')]['id']}})[_0x12cc('0xd')](handleEntityNotFound(_0x23f643,null))[_0x12cc('0xd')](function(_0x353dd2){if(_0x353dd2){return _0x353dd2[_0x12cc('0x7a')](null);}return null;})[_0x12cc('0xd')](respondWithStatusCode(_0x23f643,null))[_0x12cc('0x15')](handleError(_0x23f643,null));};exports[_0x12cc('0x7b')]=function(_0x3a91e0,_0x5b69e4){return db['MailAccount'][_0x12cc('0x6d')]({'where':{'id':_0x3a91e0[_0x12cc('0x57')]['id']}})[_0x12cc('0xd')](handleEntityNotFound(_0x5b69e4,null))[_0x12cc('0xd')](function(_0x229f8c){if(_0x229f8c){return _0x229f8c[_0x12cc('0x7b')]();}return null;})[_0x12cc('0xd')](respondWithResult(_0x5b69e4,null))['catch'](handleError(_0x5b69e4,null));};exports[_0x12cc('0x7c')]=function(_0x1eb78f,_0x4a3c2c){if(_0x1eb78f[_0x12cc('0x5d')]['id']){delete _0x1eb78f[_0x12cc('0x5d')]['id'];}return db[_0x12cc('0x41')][_0x12cc('0x5c')]({'where':{'id':_0x1eb78f['params']['id']}})[_0x12cc('0xd')](handleEntityNotFound(_0x4a3c2c,null))[_0x12cc('0xd')](function(_0x2cadfa){if(_0x2cadfa){_0x1eb78f[_0x12cc('0x5d')][_0x12cc('0x63')]=_0x2cadfa['id'];return db['MailServerOut'][_0x12cc('0x6c')](_0x1eb78f['body']);}})[_0x12cc('0xd')](respondWithResult(_0x4a3c2c,null))[_0x12cc('0x15')](handleError(_0x4a3c2c,null));};exports[_0x12cc('0x7d')]=function(_0x338bcb,_0x2a09a8){return db[_0x12cc('0x41')][_0x12cc('0x6d')]({'where':{'id':_0x338bcb[_0x12cc('0x57')]['id']}})[_0x12cc('0xd')](handleEntityNotFound(_0x2a09a8,null))[_0x12cc('0xd')](function(_0x94b40b){if(_0x94b40b){return _0x94b40b[_0x12cc('0x7e')](null);}return null;})[_0x12cc('0xd')](respondWithStatusCode(_0x2a09a8,null))[_0x12cc('0x15')](handleError(_0x2a09a8,null));};exports[_0x12cc('0x7f')]=function(_0x43b47b,_0x52035a){return db[_0x12cc('0x80')]['find']({'where':{'id':_0x43b47b[_0x12cc('0x57')]['id']}})[_0x12cc('0xd')](handleEntityNotFound(_0x52035a,null))['then'](function(_0x25d3b9){if(_0x25d3b9){return _0x25d3b9['addInteraction'](_0x43b47b[_0x12cc('0x5d')]['ids'],_[_0x12cc('0x81')](_0x43b47b['body'],['ids','id'])||{});}})[_0x12cc('0xd')](respondWithResult(_0x52035a,null))[_0x12cc('0x15')](handleError(_0x52035a,null));};exports[_0x12cc('0x82')]=function(_0x30ddeb,_0x4c65a6){var _0x445842={'raw':![],'where':{}};var _0x21f504={};var _0x189d9d={'count':0x0,'rows':[]};return db['MailAccount'][_0x12cc('0x6d')]({'where':{'id':_0x30ddeb[_0x12cc('0x57')]['id']}})[_0x12cc('0xd')](handleEntityNotFound(_0x4c65a6,null))[_0x12cc('0xd')](function(_0x34bb56){if(_0x34bb56){_0x21f504[_0x12cc('0x44')]=_[_0x12cc('0x46')](db[_0x12cc('0x80')]['rawAttributes']);_0x21f504['query']=_[_0x12cc('0x46')](_0x30ddeb[_0x12cc('0x45')]);_0x21f504[_0x12cc('0x47')]=_[_0x12cc('0x48')](_0x21f504[_0x12cc('0x44')],_0x21f504[_0x12cc('0x45')]);_0x445842[_0x12cc('0x49')]=_[_0x12cc('0x48')](_0x21f504[_0x12cc('0x44')],qs['fields'](_0x30ddeb['query'][_0x12cc('0x4a')]));_0x445842['attributes']=_0x445842[_0x12cc('0x49')][_0x12cc('0x4b')]?_0x445842[_0x12cc('0x49')]:_0x21f504[_0x12cc('0x44')];if(!_0x30ddeb[_0x12cc('0x45')][_0x12cc('0x4c')](_0x12cc('0x4d'))){_0x445842[_0x12cc('0x18')]=qs[_0x12cc('0x18')](_0x30ddeb['query'][_0x12cc('0x18')]);_0x445842[_0x12cc('0x1a')]=qs['offset'](_0x30ddeb[_0x12cc('0x45')][_0x12cc('0x1a')]);}_0x445842[_0x12cc('0x4e')]=qs[_0x12cc('0x4f')](_0x30ddeb[_0x12cc('0x45')][_0x12cc('0x4f')]);_0x445842[_0x12cc('0x50')]=qs[_0x12cc('0x47')](_['pick'](_0x30ddeb[_0x12cc('0x45')],_0x21f504[_0x12cc('0x47')]));_0x445842[_0x12cc('0x50')][_0x12cc('0x63')]=_0x34bb56['id'];if(_0x30ddeb[_0x12cc('0x45')][_0x12cc('0x51')]){_0x445842[_0x12cc('0x50')]=_[_0x12cc('0x52')](_0x445842[_0x12cc('0x50')],{'$or':_[_0x12cc('0x40')](_0x445842['attributes'],function(_0x4d76b6){var _0x486e50={};_0x486e50[_0x4d76b6]={'$like':'%'+_0x30ddeb[_0x12cc('0x45')][_0x12cc('0x51')]+'%'};return _0x486e50;})});}_0x445842=_[_0x12cc('0x52')]({},_0x445842,_0x30ddeb[_0x12cc('0x5b')]);return db[_0x12cc('0x80')][_0x12cc('0x19')]({'where':_0x445842[_0x12cc('0x50')]})[_0x12cc('0xd')](function(_0x29d6d4){_0x189d9d[_0x12cc('0x19')]=_0x29d6d4;if(_0x30ddeb[_0x12cc('0x45')][_0x12cc('0x5a')]){_0x445842[_0x12cc('0x54')]=[{'model':db[_0x12cc('0x83')],'as':_0x12cc('0x84'),'required':![]},{'model':db[_0x12cc('0x85')],'as':_0x12cc('0x86'),'attributes':['name',_0x12cc('0x87'),_0x12cc('0x88')],'required':![]},{'model':db[_0x12cc('0x89')],'as':'Tags','attributes':['id','name','color'],'where':_0x30ddeb[_0x12cc('0x45')][_0x12cc('0x8a')]?{'id':_0x30ddeb['query'][_0x12cc('0x8a')]}:undefined,'required':_0x30ddeb['query'][_0x12cc('0x8a')]?!![]:![]}];}return db[_0x12cc('0x80')]['findAll'](_0x445842);})[_0x12cc('0xd')](function(_0x3dfd62){_0x189d9d[_0x12cc('0x55')]=_0x3dfd62;return _0x189d9d;});}})[_0x12cc('0xd')](respondWithFilteredResult(_0x4c65a6,_0x445842))[_0x12cc('0x15')](handleError(_0x4c65a6,null));};exports[_0x12cc('0x8b')]=function addApplications(_0x1f18e2,_0x5473cb){var _0x9d9c90=_0x1f18e2[_0x12cc('0x57')]['id'];var _0x32a073=_0x1f18e2['body'];var _0x4dc5b7=0xc8;var _0x1c69f7=null;return db['sequelize'][_0x12cc('0x8c')]({'isolationLevel':db[_0x12cc('0x8d')][_0x12cc('0x8e')][_0x12cc('0x8f')][_0x12cc('0x90')]},function(_0x55c353){return db[_0x12cc('0x41')][_0x12cc('0x6d')]({'where':{'id':_0x9d9c90},'transaction':_0x55c353})[_0x12cc('0xd')](function(_0x32a30a){if(_0x32a30a){return db[_0x12cc('0x91')][_0x12cc('0x92')]({'where':{'MailAccountId':_0x9d9c90},'transaction':_0x55c353})[_0x12cc('0xd')](function(){var _0x45e151=_[_0x12cc('0x40')](_0x32a073,function(_0x2bda2d){_0x2bda2d['MailAccountId']=_0x9d9c90;return _0x2bda2d;});return db[_0x12cc('0x91')][_0x12cc('0x93')](_0x45e151,{'transaction':_0x55c353});});}else{_0x4dc5b7=0x194;_0x1c69f7=[];}});})[_0x12cc('0xd')](function(){if(_0x4dc5b7!==0x194){return db[_0x12cc('0x91')][_0x12cc('0x94')]({'where':{'MailAccountId':_0x9d9c90},'order':_0x12cc('0x95')})[_0x12cc('0xd')](function(_0x571041){_0x1c69f7=_0x571041;});}})[_0x12cc('0x15')](function(_0x173877){_0x4dc5b7=0x1f4;logger[_0x12cc('0x11')](_0x173877['stack']);if(_0x173877[_0x12cc('0x23')]){delete _0x173877[_0x12cc('0x23')];}_0x1c69f7=_0x173877;})[_0x12cc('0x96')](function(){if(_0x1c69f7===null){_0x5473cb['sendStatus'](_0x4dc5b7);}else{if(_0x4dc5b7===0x1f4){_0x5473cb[_0x12cc('0x16')](_0x4dc5b7)['send'](_0x1c69f7);}else{_0x5473cb[_0x12cc('0x16')](_0x4dc5b7)[_0x12cc('0x1d')](_0x1c69f7);}}});};exports[_0x12cc('0x97')]=function(_0x5004e5,_0x4d9ae6){var _0x51dbd2={};var _0xe23b0d={};var _0x12c944;var _0x4daa57;return db[_0x12cc('0x41')][_0x12cc('0x6d')]({'where':{'id':_0x5004e5[_0x12cc('0x57')]['id']}})[_0x12cc('0xd')](handleEntityNotFound(_0x4d9ae6,null))[_0x12cc('0xd')](function(_0xf53cfb){if(_0xf53cfb){_0x12c944=_0xf53cfb;_0xe23b0d[_0x12cc('0x44')]=_[_0x12cc('0x46')](db[_0x12cc('0x91')]['rawAttributes']);_0xe23b0d['query']=_['keys'](_0x5004e5[_0x12cc('0x45')]);_0xe23b0d[_0x12cc('0x47')]=_['intersection'](_0xe23b0d[_0x12cc('0x44')],_0xe23b0d['query']);_0x51dbd2[_0x12cc('0x49')]=_[_0x12cc('0x48')](_0xe23b0d[_0x12cc('0x44')],qs['fields'](_0x5004e5['query']['fields']));_0x51dbd2[_0x12cc('0x49')]=_0x51dbd2['attributes'][_0x12cc('0x4b')]?_0x51dbd2[_0x12cc('0x49')]:_0xe23b0d[_0x12cc('0x44')];_0x51dbd2[_0x12cc('0x4e')]=qs[_0x12cc('0x4f')](_0x5004e5[_0x12cc('0x45')]['sort']);_0x51dbd2['where']=qs['filters'](_[_0x12cc('0x66')](_0x5004e5[_0x12cc('0x45')],_0xe23b0d['filters']));if(_0x5004e5['query'][_0x12cc('0x51')]){_0x51dbd2[_0x12cc('0x50')]=_[_0x12cc('0x52')](_0x51dbd2[_0x12cc('0x50')],{'$or':_['map'](_0x51dbd2[_0x12cc('0x49')],function(_0x13630d){var _0x3b3467={};_0x3b3467[_0x13630d]={'$like':'%'+_0x5004e5[_0x12cc('0x45')][_0x12cc('0x51')]+'%'};return _0x3b3467;})});}_0x51dbd2=_[_0x12cc('0x52')]({},_0x51dbd2,_0x5004e5[_0x12cc('0x5b')]);return _0x12c944['getApplications'](_0x51dbd2);}})[_0x12cc('0xd')](function(_0x2771a7){if(_0x2771a7){_0x4daa57=_0x2771a7[_0x12cc('0x4b')];if(!_0x5004e5[_0x12cc('0x45')][_0x12cc('0x4c')](_0x12cc('0x4d'))){_0x51dbd2['limit']=qs[_0x12cc('0x18')](_0x5004e5[_0x12cc('0x45')][_0x12cc('0x18')]);_0x51dbd2['offset']=qs[_0x12cc('0x1a')](_0x5004e5['query'][_0x12cc('0x1a')]);}return _0x12c944[_0x12cc('0x97')](_0x51dbd2);}})[_0x12cc('0xd')](function(_0x42c975){if(_0x42c975){return _0x42c975?{'count':_0x4daa57,'rows':_0x42c975}:null;}})['then'](respondWithResult(_0x4d9ae6,null))['catch'](handleError(_0x4d9ae6,null));};exports[_0x12cc('0x98')]=function(_0x148ad1,_0x2cbd2d){var _0x3f5b09={'raw':!![],'where':{}};var _0x148104={};var _0x43f576={'count':0x0,'rows':[]};return db[_0x12cc('0x41')][_0x12cc('0x6d')]({'where':{'id':_0x148ad1['params']['id']}})[_0x12cc('0xd')](handleEntityNotFound(_0x2cbd2d,null))['then'](function(_0x5c2f3b){if(_0x5c2f3b){_0x148104['model']=_[_0x12cc('0x46')](db[_0x12cc('0x99')][_0x12cc('0x59')]);_0x148104[_0x12cc('0x45')]=_['keys'](_0x148ad1[_0x12cc('0x45')]);_0x148104[_0x12cc('0x47')]=_['intersection'](_0x148104['model'],_0x148104[_0x12cc('0x45')]);_0x3f5b09[_0x12cc('0x49')]=_[_0x12cc('0x48')](_0x148104[_0x12cc('0x44')],qs['fields'](_0x148ad1['query'][_0x12cc('0x4a')]));_0x3f5b09[_0x12cc('0x49')]=_0x3f5b09[_0x12cc('0x49')]['length']?_0x3f5b09[_0x12cc('0x49')]:_0x148104[_0x12cc('0x44')];if(!_0x148ad1[_0x12cc('0x45')][_0x12cc('0x4c')]('nolimit')){_0x3f5b09[_0x12cc('0x18')]=qs['limit'](_0x148ad1[_0x12cc('0x45')][_0x12cc('0x18')]);_0x3f5b09[_0x12cc('0x1a')]=qs[_0x12cc('0x1a')](_0x148ad1[_0x12cc('0x45')]['offset']);}_0x3f5b09[_0x12cc('0x4e')]=qs['sort'](_0x148ad1[_0x12cc('0x45')][_0x12cc('0x4f')]);_0x3f5b09[_0x12cc('0x50')]=qs[_0x12cc('0x47')](_[_0x12cc('0x66')](_0x148ad1[_0x12cc('0x45')],_0x148104['filters']));_0x3f5b09[_0x12cc('0x50')][_0x12cc('0x63')]=_0x5c2f3b['id'];if(_0x148ad1[_0x12cc('0x45')]['filter']){_0x3f5b09[_0x12cc('0x50')]=_['merge'](_0x3f5b09[_0x12cc('0x50')],{'$or':_['map'](_0x3f5b09[_0x12cc('0x49')],function(_0x340d76){var _0x534205={};_0x534205[_0x340d76]={'$like':'%'+_0x148ad1['query'][_0x12cc('0x51')]+'%'};return _0x534205;})});}if(_0x148ad1[_0x12cc('0x45')][_0x12cc('0x9a')]){var _0x3ff5ae=_0x148ad1[_0x12cc('0x45')][_0x12cc('0x9a')][_0x12cc('0x9b')](',');var _0x4125c8={};_0x4125c8[_0x3ff5ae[0x0]]={'$gte':moment(_0x3ff5ae[0x1])[_0x12cc('0x9c')]('YYYY-MM-DD\x20HH:mm:ss')};_0x3f5b09['where']=_['merge'](_0x3f5b09[_0x12cc('0x50')],_0x4125c8);}_0x3f5b09=_[_0x12cc('0x52')]({},_0x3f5b09,_0x148ad1['options']);return db[_0x12cc('0x99')][_0x12cc('0x19')]({'where':_0x3f5b09[_0x12cc('0x50')]})['then'](function(_0x5a1536){_0x43f576[_0x12cc('0x19')]=_0x5a1536;if(_0x148ad1[_0x12cc('0x45')]['includeAll']){_0x3f5b09['include']=[{'all':!![]}];}return db[_0x12cc('0x99')][_0x12cc('0x67')](_0x3f5b09);})['then'](function(_0x46f34e){if(_0x148ad1[_0x12cc('0x45')][_0x12cc('0x9d')]===_0x12cc('0x9e')){for(var _0x26887e=0x0;_0x26887e<_0x46f34e['length'];_0x26887e++){_0x46f34e[_0x26887e][_0x12cc('0x5d')]=juice(_0x46f34e[_0x26887e]['body']);}}_0x43f576['rows']=_0x46f34e;return _0x43f576;});}})[_0x12cc('0xd')](respondWithFilteredResult(_0x2cbd2d,_0x3f5b09))[_0x12cc('0x15')](handleError(_0x2cbd2d,null));};exports[_0x12cc('0x9f')]=function(_0x3515e5,_0x58d2fa){var _0x31f206,_0x41b040={},_0x4f4967;if(_0x3515e5['body']['to']){_0x4f4967=_0x3515e5[_0x12cc('0x5d')]['to'][_0x12cc('0x9b')](',')[0x0];}return db['MailAccount'][_0x12cc('0x5c')]({'where':{'id':_0x3515e5['params']['id']},'include':[{'model':db['CmList'],'as':_0x12cc('0xa0'),'include':[{'model':db[_0x12cc('0x83')],'as':_0x12cc('0xa1'),'where':{'email':_0x4f4967},'limit':0x1,'order':[['updatedAt',_0x12cc('0xa2')]]}]},{'model':db[_0x12cc('0x3d')],'as':_0x12cc('0x3c'),'raw':!![],'include':[{'model':db[_0x12cc('0xa3')],'as':_0x12cc('0xa3'),'raw':!![]}]}]})[_0x12cc('0xd')](handleEntityNotFound(_0x58d2fa,null))['then'](function(_0x4cb014){if(!_0x4cb014)return;_0x31f206=_0x4cb014;if(!_0x4cb014[_0x12cc('0x3c')])throw new Error(_0x12cc('0xa4'));if(_[_0x12cc('0xa5')](_0x3515e5['body'][_0x12cc('0xa6')])){_0x3515e5[_0x12cc('0x5d')]['from']=util[_0x12cc('0x9c')](_0x12cc('0xa7'),_0x4cb014[_0x12cc('0x23')],_0x4cb014[_0x12cc('0x6f')]||_0x4cb014[_0x12cc('0x3c')]['user']);}if(_0x3515e5[_0x12cc('0x5d')][_0x12cc('0xa8')]&&_0x3515e5['body'][_0x12cc('0xa8')][_0x12cc('0x4b')]){for(var _0x1c3842=0x0;_0x1c3842<_0x3515e5[_0x12cc('0x5d')][_0x12cc('0xa8')][_0x12cc('0x4b')];_0x1c3842+=0x1){_0x3515e5['body'][_0x12cc('0xa8')][_0x1c3842]={'filename':_0x3515e5['body'][_0x12cc('0xa8')][_0x1c3842][_0x12cc('0x23')],'path':path[_0x12cc('0xa9')](config['root'],_0x12cc('0xaa'),_0x3515e5[_0x12cc('0x5d')][_0x12cc('0xa8')][_0x1c3842]['basename'])};}}var _0x16c4d7=_0x4cb014['getSmtpOptions']();return respondWithRpcPromise(_0x12cc('0xab'),_0x12cc('0xac'),{'account':_0x16c4d7,'message':_0x3515e5[_0x12cc('0x5d')]});})['then'](function(_0x35170b){if(!_0x35170b)return;_0x41b040=_0x35170b;if(!_0x31f206['List'])throw new Error(_0x12cc('0xad'));if(_0x31f206['List']['Contacts']['length'])return _0x31f206[_0x12cc('0xa0')]['Contacts'][0x0];return db[_0x12cc('0x83')]['create'](_[_0x12cc('0x6')](_0x3515e5['body'],{'firstName':_0x3515e5[_0x12cc('0x5d')]['to'],'email':_0x3515e5[_0x12cc('0x5d')]['to'],'phone':_0x3515e5['body']['to'],'ListId':_0x31f206['ListId']}));})[_0x12cc('0xd')](function(_0xa5e5a8){if(!_0xa5e5a8)return;var _0x4e190b={'UserId':_0x3515e5[_0x12cc('0x30')]['id'],'ContactId':_0xa5e5a8['id'],'MailAccountId':_0x31f206['id'],'inReplyTo':_0x41b040['messageId'],'to':_0x3515e5['body'][_0x12cc('0xa6')],'cc':_0x3515e5[_0x12cc('0x5d')]['cc'],'subject':_0x3515e5[_0x12cc('0x5d')][_0x12cc('0xae')],'attach':_0x3515e5['body'][_0x12cc('0xaf')],'firstMsgDirection':_0x12cc('0xb0'),'lastMsgAt':moment()[_0x12cc('0x9c')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':_0x12cc('0xb0'),'Messages':[_[_0x12cc('0x52')](_0x3515e5['body'],{'messageId':_0x41b040['messageId'],'sentAt':moment()[_0x12cc('0x9c')](_0x12cc('0xb1')),'read':!![],'MailAccountId':_0x31f206['id'],'UserId':_0x3515e5['user']['id'],'ContactId':_0xa5e5a8['id']})]};if(_0x3515e5[_0x12cc('0x5d')][_0x12cc('0xb2')]){_0x4e190b=_[_0x12cc('0x52')](_0x4e190b,_0x3515e5[_0x12cc('0x5d')]['Interaction']);}return db[_0x12cc('0x80')][_0x12cc('0x6c')](_0x4e190b,{'include':[{'model':db[_0x12cc('0x99')],'as':_0x12cc('0xb3')}]});})[_0x12cc('0xd')](respondWithResult(_0x58d2fa,null))[_0x12cc('0x15')](handleError(_0x58d2fa,null));};exports[_0x12cc('0xb4')]=function(_0x1f9198,_0x585976){return db[_0x12cc('0x41')]['find']({'where':{'id':_0x1f9198[_0x12cc('0x57')]['id']},'include':[{'model':db[_0x12cc('0x3d')],'as':_0x12cc('0x3c'),'raw':!![],'include':[{'model':db[_0x12cc('0xa3')],'as':_0x12cc('0xa3'),'raw':!![]}]}]})[_0x12cc('0xd')](handleEntityNotFound(_0x585976,null))[_0x12cc('0xd')](function(_0x20b345){if(!_0x20b345[_0x12cc('0x3c')])return;var _0x5c6368=_0x20b345[_0x12cc('0xb5')]();return respondWithRpcPromise(_0x12cc('0xb6'),_0x12cc('0xb4'),{'account':_0x5c6368});})[_0x12cc('0xd')](respondWithResult(_0x585976,null))['catch'](handleError(_0x585976,null));};exports[_0x12cc('0x92')]=function(_0x166cfc,_0x437eab){return db[_0x12cc('0x41')][_0x12cc('0x5c')]({'where':{'id':_0x166cfc[_0x12cc('0x57')]['id']}})[_0x12cc('0xd')](handleEntityNotFound(_0x437eab,null))[_0x12cc('0xd')](function(_0x5d13dd){if(_0x5d13dd&&_0x5d13dd['service']){throw new db[(_0x12cc('0xb7'))][(_0x12cc('0xb8'))](_0x12cc('0xb9'));}return _0x5d13dd;})['then'](removeEntity(_0x437eab,null))[_0x12cc('0x15')](handleError(_0x437eab,null));};exports[_0x12cc('0xba')]=function(_0x2b589a,_0x461a45){return db[_0x12cc('0x41')]['find']({'where':{'id':_0x2b589a[_0x12cc('0x57')]['id']}})[_0x12cc('0xd')](handleEntityNotFound(_0x461a45,null))[_0x12cc('0xd')](function(_0x14d634){if(_0x14d634){return _0x14d634['addAgents'](_0x2b589a[_0x12cc('0x5d')][_0x12cc('0x69')],_[_0x12cc('0x81')](_0x2b589a['body'],[_0x12cc('0x69'),'id'])||{})['spread'](function(_0x5a3cdb){for(var _0xb6854c=0x0;_0xb6854c<_0x2b589a[_0x12cc('0x5d')][_0x12cc('0x69')][_0x12cc('0x4b')];_0xb6854c+=0x1){socket[_0x12cc('0xbb')](_0x12cc('0xbc'),{'UserId':Number(_0x2b589a['body'][_0x12cc('0x69')][_0xb6854c]),'MailAccountId':Number(_0x2b589a[_0x12cc('0x57')]['id'])});}return _0x5a3cdb;});}})[_0x12cc('0xd')](respondWithResult(_0x461a45,null))[_0x12cc('0x15')](handleError(_0x461a45,null));};exports[_0x12cc('0xbd')]=function(_0xe68371,_0xba498c){return db[_0x12cc('0x41')]['find']({'where':{'id':_0xe68371['params']['id']}})['then'](handleEntityNotFound(_0xba498c,null))[_0x12cc('0xd')](function(_0x1470e6){if(_0x1470e6){return _0x1470e6[_0x12cc('0xbd')](_0xe68371[_0x12cc('0x45')]['ids'])['then'](function(){if(_['isArray'](_0xe68371[_0x12cc('0x45')][_0x12cc('0x69')])){for(var _0x7406d9=0x0;_0x7406d9<_0xe68371[_0x12cc('0x45')][_0x12cc('0x69')][_0x12cc('0x4b')];_0x7406d9+=0x1){socket['emit'](_0x12cc('0xbe'),{'UserId':Number(_0xe68371[_0x12cc('0x45')][_0x12cc('0x69')][_0x7406d9]),'MailAccountId':Number(_0xe68371['params']['id'])});}}else{socket['emit'](_0x12cc('0xbe'),{'UserId':Number(_0xe68371[_0x12cc('0x45')][_0x12cc('0x69')]),'MailAccountId':Number(_0xe68371['params']['id'])});}});}})[_0x12cc('0xd')](respondWithStatusCode(_0xba498c,null))[_0x12cc('0x15')](handleError(_0xba498c,null));};exports[_0x12cc('0xbf')]=function(_0x2f17b9,_0x3ceaaf){var _0x2cefc7={};var _0xc74312={};var _0x5e4320;var _0x36568e;return db[_0x12cc('0x41')][_0x12cc('0x6d')]({'where':{'id':_0x2f17b9[_0x12cc('0x57')]['id']}})[_0x12cc('0xd')](handleEntityNotFound(_0x3ceaaf,null))[_0x12cc('0xd')](function(_0xfaa4ed){if(_0xfaa4ed){_0x5e4320=_0xfaa4ed;_0xc74312[_0x12cc('0x44')]=_[_0x12cc('0x46')](db[_0x12cc('0x85')][_0x12cc('0x59')]);_0xc74312['query']=_[_0x12cc('0x46')](_0x2f17b9[_0x12cc('0x45')]);_0xc74312['filters']=_[_0x12cc('0x48')](_0xc74312[_0x12cc('0x44')],_0xc74312[_0x12cc('0x45')]);_0x2cefc7[_0x12cc('0x49')]=_['intersection'](_0xc74312['model'],qs[_0x12cc('0x4a')](_0x2f17b9[_0x12cc('0x45')]['fields']));_0x2cefc7['attributes']=_0x2cefc7['attributes'][_0x12cc('0x4b')]?_0x2cefc7[_0x12cc('0x49')]:_0xc74312['model'];_0x2cefc7[_0x12cc('0x4e')]=qs['sort'](_0x2f17b9[_0x12cc('0x45')][_0x12cc('0x4f')]);_0x2cefc7[_0x12cc('0x50')]=qs[_0x12cc('0x47')](_[_0x12cc('0x66')](_0x2f17b9[_0x12cc('0x45')],_0xc74312['filters']));if(_0x2f17b9[_0x12cc('0x45')][_0x12cc('0x51')]){_0x2cefc7['where']=_[_0x12cc('0x52')](_0x2cefc7[_0x12cc('0x50')],{'$or':_[_0x12cc('0x40')](_0x2cefc7['attributes'],function(_0x1c39c0){var _0x36f1f5={};_0x36f1f5[_0x1c39c0]={'$like':'%'+_0x2f17b9[_0x12cc('0x45')][_0x12cc('0x51')]+'%'};return _0x36f1f5;})});}_0x2cefc7=_[_0x12cc('0x52')]({},_0x2cefc7,_0x2f17b9[_0x12cc('0x5b')]);return _0x5e4320[_0x12cc('0xbf')](_0x2cefc7);}})[_0x12cc('0xd')](function(_0x532e98){if(_0x532e98){_0x36568e=_0x532e98['length'];if(!_0x2f17b9[_0x12cc('0x45')]['hasOwnProperty'](_0x12cc('0x4d'))){_0x2cefc7[_0x12cc('0x18')]=qs['limit'](_0x2f17b9[_0x12cc('0x45')][_0x12cc('0x18')]);_0x2cefc7[_0x12cc('0x1a')]=qs[_0x12cc('0x1a')](_0x2f17b9[_0x12cc('0x45')][_0x12cc('0x1a')]);}return _0x5e4320['getAgents'](_0x2cefc7);}})[_0x12cc('0xd')](function(_0x29afef){if(_0x29afef){return _0x29afef?{'count':_0x36568e,'rows':_0x29afef}:null;}})[_0x12cc('0xd')](respondWithResult(_0x3ceaaf,null))[_0x12cc('0x15')](handleError(_0x3ceaaf,null));}; \ No newline at end of file +var _0xf852=['from','email','attachments','join','root','basename','SendMail','sendMail','List','List\x20not\x20found','Contacts','subject','attach','out','messageId','Interaction','Messages','verifySmtp','getSmtpOptions','VerifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','User','util','path','lodash','juice','ioredis','../../config/logger','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','jayson/promise','client','http','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','status','end','json','offset','undefined','limit','count','set','Content-Range','destroy','get','MailAccounts','UserProfileResource','sendStatus','stack','name','send','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','smtp.gmail.com','smtp.mail.yahoo.com','smtp-mail.outlook.com','smtp.office365.com','Unknown\x20email\x20service\x20provider','user','password','pass','modernAuthentication','CloudProviderId','host','secure','service','authentication','username','Imap','port','Smtp','MailServerOut','mandatoryDispositionPause','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','merge','type','VIRTUAL','filter','options','MailAccount','includeAll','include','rows','show','params','MailServerIn','Pause','rawAttributes','update','body','custom','provider','find','Mail\x20Account\x20not\x20found','describe','addDisposition','MailAccountId','Disposition','create','findOne','nolimit','order','pick','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findAll','removeAnswers','ListId','isNil','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','MailInteraction','omit','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','bulkCreate','findAndCountAll','priority','getApplications','getMessages','MailMessage','$gte','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','split','CmContact','updatedAt','DESC','CloudProvider'];(function(_0x38ced4,_0x24263f){var _0x547c07=function(_0x279fc4){while(--_0x279fc4){_0x38ced4['push'](_0x38ced4['shift']());}};_0x547c07(++_0x24263f);}(_0xf852,0x1b2));var _0x2f85=function(_0xa8dc5f,_0x14e053){_0xa8dc5f=_0xa8dc5f-0x0;var _0x5d0ac3=_0xf852[_0xa8dc5f];return _0x5d0ac3;};'use strict';var moment=require('moment');var BPromise=require('bluebird');var util=require(_0x2f85('0x0'));var path=require(_0x2f85('0x1'));var _=require(_0x2f85('0x2'));var juice=require(_0x2f85('0x3'));var Redis=require(_0x2f85('0x4'));var qs=require('../../components/parsers/qs');var logger=require(_0x2f85('0x5'))('api');var config=require('../../config/environment');var db=require(_0x2f85('0x6'))['db'];config[_0x2f85('0x7')]=_[_0x2f85('0x8')](config[_0x2f85('0x7')],{'host':_0x2f85('0x9'),'port':0x18eb});var socket=require(_0x2f85('0xa'))(new Redis(config[_0x2f85('0x7')]));require(_0x2f85('0xb'))[_0x2f85('0xc')](socket);var jayson=require(_0x2f85('0xd'));var client=jayson[_0x2f85('0xe')][_0x2f85('0xf')]({'port':0x232b});function respondWithRpcPromise(_0x404e82,_0x1c6125,_0xb812b5,_0xefe293){return new BPromise(function(_0x53baa7,_0x38b1a3){var _0x553cef=_0xefe293||client;return _0x553cef[_0x2f85('0x10')](_0x404e82,_0xb812b5)[_0x2f85('0x11')](function(_0x20e8a5){logger[_0x2f85('0x12')](_0x2f85('0x13'),_0x1c6125,_0x2f85('0x14'));logger[_0x2f85('0x15')](_0x2f85('0x16'),_0x1c6125,_0x2f85('0x14'),JSON['stringify'](_0x20e8a5));if(_0x20e8a5[_0x2f85('0x17')]){if(_0x20e8a5[_0x2f85('0x17')][_0x2f85('0x18')]===0x1f4){logger[_0x2f85('0x17')](_0x2f85('0x13'),_0x1c6125,_0x20e8a5[_0x2f85('0x17')]['message']);return _0x38b1a3(_0x20e8a5[_0x2f85('0x17')][_0x2f85('0x19')]);}logger[_0x2f85('0x17')]('MailAccount,\x20%s,\x20%s',_0x1c6125,_0x20e8a5[_0x2f85('0x17')][_0x2f85('0x19')]);return _0x53baa7(_0x20e8a5[_0x2f85('0x17')][_0x2f85('0x19')]);}else{logger[_0x2f85('0x12')]('MailAccount,\x20%s,\x20%s',_0x1c6125,_0x2f85('0x14'));_0x53baa7(_0x20e8a5['result'][_0x2f85('0x19')]);}})[_0x2f85('0x1a')](function(_0x5abd6c){logger['error']('MailAccount,\x20%s,\x20%s',_0x1c6125,_0x5abd6c);_0x38b1a3(_0x5abd6c);});});}function respondWithStatusCode(_0x1d1e89,_0x579667){_0x579667=_0x579667||0xcc;return function(_0x515e2c){if(_0x515e2c){return _0x1d1e89['sendStatus'](_0x579667);}return _0x1d1e89[_0x2f85('0x1b')](_0x579667)[_0x2f85('0x1c')]();};}function respondWithResult(_0x1a89b7,_0x5b71c8){_0x5b71c8=_0x5b71c8||0xc8;return function(_0x3da77a){if(_0x3da77a){return _0x1a89b7[_0x2f85('0x1b')](_0x5b71c8)[_0x2f85('0x1d')](_0x3da77a);}};}function respondWithFilteredResult(_0x917c13,_0x5b445b){return function(_0x2bd1c0){if(_0x2bd1c0){var _0x1deeb0=typeof _0x5b445b[_0x2f85('0x1e')]===_0x2f85('0x1f')&&typeof _0x5b445b[_0x2f85('0x20')]===_0x2f85('0x1f');var _0x3a4fb1=_0x2bd1c0[_0x2f85('0x21')];var _0x130851=_0x1deeb0?0x0:_0x5b445b['offset'];var _0x3f500d=_0x1deeb0?_0x2bd1c0[_0x2f85('0x21')]:_0x5b445b[_0x2f85('0x1e')]+_0x5b445b[_0x2f85('0x20')];var _0x435327;if(_0x3f500d>=_0x3a4fb1){_0x3f500d=_0x3a4fb1;_0x435327=0xc8;}else{_0x435327=0xce;}_0x917c13[_0x2f85('0x1b')](_0x435327);return _0x917c13[_0x2f85('0x22')](_0x2f85('0x23'),_0x130851+'-'+_0x3f500d+'/'+_0x3a4fb1)[_0x2f85('0x1d')](_0x2bd1c0);}return null;};}function saveUpdates(_0x49323f){return function(_0x154603){if(_0x154603){return _0x154603['update'](_0x49323f)[_0x2f85('0x11')](function(_0x13124a){return _0x13124a;});}return null;};}function removeEntity(_0x5f105f){return function(_0x57e674){if(_0x57e674){return _0x57e674[_0x2f85('0x24')]()[_0x2f85('0x11')](function(){var _0x313df4=_0x57e674[_0x2f85('0x25')]({'plain':!![]});var _0x29071b=_0x2f85('0x26');return db[_0x2f85('0x27')][_0x2f85('0x24')]({'where':{'type':_0x29071b,'resourceId':_0x313df4['id']}})[_0x2f85('0x11')](function(){return _0x57e674;});})[_0x2f85('0x11')](function(){_0x5f105f[_0x2f85('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x16ad40){return function(_0x119177){if(!_0x119177){_0x16ad40[_0x2f85('0x28')](0x194);}return _0x119177;};}function handleError(_0xd30485,_0xbd555f){_0xbd555f=_0xbd555f||0x1f4;return function(_0x2ec68d){logger['error'](_0x2ec68d[_0x2f85('0x29')]);if(_0x2ec68d[_0x2f85('0x2a')]){delete _0x2ec68d['name'];}_0xd30485[_0x2f85('0x1b')](_0xbd555f)[_0x2f85('0x2b')](_0x2ec68d);};}function getImapHost(_0x131e3d){switch(_0x131e3d){case _0x2f85('0x2c'):return _0x2f85('0x2d');case _0x2f85('0x2e'):return _0x2f85('0x2f');case _0x2f85('0x30'):return _0x2f85('0x31');case _0x2f85('0x32'):return _0x2f85('0x33');}throw new Error('Unknown\x20email\x20service\x20provider',_0x131e3d);}function getSmtpHost(_0x4271d4){switch(_0x4271d4){case _0x2f85('0x2c'):return _0x2f85('0x34');case _0x2f85('0x2e'):return _0x2f85('0x35');case'hotmail':return _0x2f85('0x36');case'outlook365':return _0x2f85('0x37');}throw new Error(_0x2f85('0x38'),_0x4271d4);}function getAuthenticationOptions(_0x5ae159,_0x12150e){var _0x319a6b={};var _0x4ebe63={};if(_0x5ae159){_0x319a6b['user']=_0x4ebe63[_0x2f85('0x39')]=_0x12150e['username'];_0x319a6b[_0x2f85('0x3a')]=_0x4ebe63[_0x2f85('0x3b')]=_0x12150e[_0x2f85('0x3a')];if(_0x12150e[_0x2f85('0x3c')]){_0x319a6b[_0x2f85('0x3c')]=_0x4ebe63[_0x2f85('0x3c')]=!![];_0x319a6b['CloudProviderId']=_0x4ebe63[_0x2f85('0x3d')]=_0x12150e[_0x2f85('0x3d')];_0x319a6b['password']=_0x4ebe63[_0x2f85('0x3b')]=null;}else{_0x319a6b['CloudProviderId']=_0x4ebe63[_0x2f85('0x3d')]=null;}_0x319a6b['host']=getImapHost(_0x5ae159);_0x319a6b['port']=0x3e1;_0x4ebe63[_0x2f85('0x3e')]=getSmtpHost(_0x5ae159);_0x4ebe63['port']=0x24b;_0x4ebe63[_0x2f85('0x3f')]=![];_0x319a6b[_0x2f85('0x40')]=_0x4ebe63[_0x2f85('0x40')]=null;}else{if(_0x12150e[_0x2f85('0x41')]){_0x319a6b[_0x2f85('0x39')]=_0x4ebe63[_0x2f85('0x39')]=_0x12150e[_0x2f85('0x42')];_0x319a6b[_0x2f85('0x3a')]=_0x4ebe63['pass']=_0x12150e[_0x2f85('0x3a')];}else{_0x319a6b[_0x2f85('0x41')]=_0x4ebe63[_0x2f85('0x41')]=![];_0x319a6b[_0x2f85('0x39')]=_0x4ebe63['user']=null;_0x319a6b[_0x2f85('0x3a')]=_0x4ebe63[_0x2f85('0x3b')]=null;}_0x319a6b['host']=_0x12150e[_0x2f85('0x43')]['host'];_0x319a6b[_0x2f85('0x44')]=_0x12150e['Imap'][_0x2f85('0x44')];_0x4ebe63[_0x2f85('0x3e')]=_0x12150e[_0x2f85('0x45')]['host'];_0x4ebe63[_0x2f85('0x44')]=_0x12150e[_0x2f85('0x45')]['port'];}return{'Imap':_0x319a6b,'Smtp':_0x4ebe63};}exports['index']=function(_0x1281ed,_0x4dbcae){var _0x105918={'include':[{'model':db['MailServerIn'],'as':_0x2f85('0x43')},{'model':db[_0x2f85('0x46')],'as':_0x2f85('0x45')},{'model':db['Pause'],'as':_0x2f85('0x47')}]},_0x3ebd2b={},_0x2f12c4={'count':0x0,'rows':[]};var _0xf86578=_['map'](db['MailAccount']['rawAttributes'],function(_0x33a612){return{'name':_0x33a612[_0x2f85('0x48')],'type':_0x33a612['type'][_0x2f85('0x49')]};});_0x3ebd2b[_0x2f85('0x4a')]=_[_0x2f85('0x4b')](_0xf86578,_0x2f85('0x2a'));_0x3ebd2b[_0x2f85('0x4c')]=_[_0x2f85('0x4d')](_0x1281ed[_0x2f85('0x4c')]);_0x3ebd2b[_0x2f85('0x4e')]=_[_0x2f85('0x4f')](_0x3ebd2b['model'],_0x3ebd2b['query']);_0x105918[_0x2f85('0x50')]=_[_0x2f85('0x4f')](_0x3ebd2b[_0x2f85('0x4a')],qs[_0x2f85('0x51')](_0x1281ed[_0x2f85('0x4c')][_0x2f85('0x51')]));_0x105918[_0x2f85('0x50')]=_0x105918[_0x2f85('0x50')][_0x2f85('0x52')]?_0x105918[_0x2f85('0x50')]:_0x3ebd2b['model'];if(!_0x1281ed[_0x2f85('0x4c')][_0x2f85('0x53')]('nolimit')){_0x105918[_0x2f85('0x20')]=qs[_0x2f85('0x20')](_0x1281ed[_0x2f85('0x4c')][_0x2f85('0x20')]);_0x105918['offset']=qs['offset'](_0x1281ed[_0x2f85('0x4c')][_0x2f85('0x1e')]);}_0x105918['order']=qs['sort'](_0x1281ed[_0x2f85('0x4c')][_0x2f85('0x54')]);_0x105918['where']=qs['filters'](_['pick'](_0x1281ed[_0x2f85('0x4c')],_0x3ebd2b['filters']),_0xf86578);if(_0x1281ed[_0x2f85('0x4c')]['filter']){_0x105918[_0x2f85('0x55')]=_[_0x2f85('0x56')](_0x105918[_0x2f85('0x55')],{'$or':_[_0x2f85('0x4b')](_0xf86578,function(_0x1a571f){if(_0x1a571f[_0x2f85('0x57')]!==_0x2f85('0x58')){var _0x1bd8fa={};_0x1bd8fa[_0x1a571f['name']]={'$like':'%'+_0x1281ed[_0x2f85('0x4c')][_0x2f85('0x59')]+'%'};return _0x1bd8fa;}})});}_0x105918=_['merge']({},_0x105918,_0x1281ed[_0x2f85('0x5a')]);var _0x17d5c7={'where':_0x105918[_0x2f85('0x55')]};return db[_0x2f85('0x5b')][_0x2f85('0x21')](_0x17d5c7)[_0x2f85('0x11')](function(_0x43bf6a){_0x2f12c4[_0x2f85('0x21')]=_0x43bf6a;if(_0x1281ed['query'][_0x2f85('0x5c')]){_0x105918[_0x2f85('0x5d')]=[{'all':!![]}];}return db['MailAccount']['findAll'](_0x105918);})['then'](function(_0x441524){_0x2f12c4[_0x2f85('0x5e')]=_0x441524;return _0x2f12c4;})['then'](respondWithFilteredResult(_0x4dbcae,_0x105918))[_0x2f85('0x1a')](handleError(_0x4dbcae,null));};exports[_0x2f85('0x5f')]=function(_0x236c50,_0x201b18){var _0x205ff7={'raw':![],'where':{'id':_0x236c50[_0x2f85('0x60')]['id']},'include':[{'model':db[_0x2f85('0x61')],'as':_0x2f85('0x43')},{'model':db[_0x2f85('0x46')],'as':_0x2f85('0x45')},{'model':db[_0x2f85('0x62')],'as':'mandatoryDispositionPause'}]},_0x3f4056={};_0x3f4056['model']=_[_0x2f85('0x4d')](db[_0x2f85('0x5b')][_0x2f85('0x63')]);_0x3f4056[_0x2f85('0x4c')]=_[_0x2f85('0x4d')](_0x236c50[_0x2f85('0x4c')]);_0x3f4056['filters']=_[_0x2f85('0x4f')](_0x3f4056[_0x2f85('0x4a')],_0x3f4056[_0x2f85('0x4c')]);_0x205ff7['attributes']=_[_0x2f85('0x4f')](_0x3f4056[_0x2f85('0x4a')],qs[_0x2f85('0x51')](_0x236c50['query'][_0x2f85('0x51')]));_0x205ff7[_0x2f85('0x50')]=_0x205ff7[_0x2f85('0x50')][_0x2f85('0x52')]?_0x205ff7[_0x2f85('0x50')]:_0x3f4056[_0x2f85('0x4a')];if(_0x236c50[_0x2f85('0x4c')][_0x2f85('0x5c')]){_0x205ff7['include']=[{'all':!![]}];}_0x205ff7=_[_0x2f85('0x56')]({},_0x205ff7,_0x236c50[_0x2f85('0x5a')]);return db[_0x2f85('0x5b')]['find'](_0x205ff7)[_0x2f85('0x11')](handleEntityNotFound(_0x201b18,null))['then'](respondWithResult(_0x201b18,null))['catch'](handleError(_0x201b18,null));};exports[_0x2f85('0x64')]=function(_0xc4c08,_0x44dfd5){if(_0xc4c08[_0x2f85('0x65')]['id']){delete _0xc4c08[_0x2f85('0x65')]['id'];}var _0x2f9e05=_0xc4c08['body']['provider']===_0x2f85('0x66')?null:_0xc4c08[_0x2f85('0x65')][_0x2f85('0x67')];var _0x1ff5f6=_0xc4c08[_0x2f85('0x65')][_0x2f85('0x43')]||{};var _0x416f2c=_0xc4c08[_0x2f85('0x65')]['Smtp']||{};if(_0x2f9e05){_0x1ff5f6[_0x2f85('0x3e')]=getImapHost(_0x2f9e05);_0x1ff5f6[_0x2f85('0x44')]=0x3e1;_0x416f2c[_0x2f85('0x3e')]=getSmtpHost(_0x2f9e05);_0x416f2c[_0x2f85('0x44')]=0x24b;_0x416f2c[_0x2f85('0x3f')]=![];}if(_0x416f2c[_0x2f85('0x3c')]){_0x416f2c['secure']=![];}else{_0x416f2c[_0x2f85('0x3d')]=null;}if(!_0x1ff5f6[_0x2f85('0x3c')])_0x1ff5f6[_0x2f85('0x3d')]=null;_0xc4c08[_0x2f85('0x65')][_0x2f85('0x43')]=_0x1ff5f6;_0xc4c08[_0x2f85('0x65')]['Smtp']=_0x416f2c;return db[_0x2f85('0x5b')][_0x2f85('0x68')]({'where':{'id':_0xc4c08[_0x2f85('0x60')]['id']},'include':[{'model':db['MailServerIn'],'as':_0x2f85('0x43')},{'model':db[_0x2f85('0x46')],'as':_0x2f85('0x45')},{'model':db[_0x2f85('0x62')],'as':'mandatoryDispositionPause'}]})[_0x2f85('0x11')](handleEntityNotFound(_0x44dfd5,null))[_0x2f85('0x11')](function(_0x51d4d9){if(!_0x51d4d9)throw new Error(_0x2f85('0x69'));if(_0x51d4d9[_0x2f85('0x40')])delete _0xc4c08['body'][_0x2f85('0x43')];return _0x51d4d9;})['then'](saveUpdates(_0xc4c08[_0x2f85('0x65')],null))[_0x2f85('0x11')](function(_0x225293){if(!_0xc4c08[_0x2f85('0x65')][_0x2f85('0x43')])return _0x225293;return db[_0x2f85('0x61')][_0x2f85('0x64')](_0xc4c08[_0x2f85('0x65')][_0x2f85('0x43')],{'where':{'MailAccountId':_0x225293['id']}})[_0x2f85('0x11')](function(){return _0x225293;});})[_0x2f85('0x11')](function(_0x2a58ed){if(!_0xc4c08['body'][_0x2f85('0x45')])return _0x2a58ed;return db[_0x2f85('0x46')]['update'](_0xc4c08[_0x2f85('0x65')]['Smtp'],{'where':{'MailAccountId':_0x2a58ed['id']}})['then'](function(){return _0x2a58ed;});})[_0x2f85('0x11')](respondWithResult(_0x44dfd5,null))[_0x2f85('0x1a')](handleError(_0x44dfd5,null));};exports[_0x2f85('0x6a')]=function(_0xcaac97,_0x3d661b){return db[_0x2f85('0x5b')]['describe']()['then'](respondWithResult(_0x3d661b,null))[_0x2f85('0x1a')](handleError(_0x3d661b,null));};exports[_0x2f85('0x6b')]=function(_0x351f36,_0x9f3112){if(_0x351f36['body']['id']){delete _0x351f36['body']['id'];}return db['MailAccount'][_0x2f85('0x68')]({'where':{'id':_0x351f36['params']['id']}})[_0x2f85('0x11')](handleEntityNotFound(_0x9f3112,null))[_0x2f85('0x11')](function(_0x4c0103){if(_0x4c0103){_0x351f36['body'][_0x2f85('0x6c')]=_0x4c0103['id'];return db[_0x2f85('0x6d')][_0x2f85('0x6e')](_0x351f36[_0x2f85('0x65')]);}})[_0x2f85('0x11')](respondWithResult(_0x9f3112,null))[_0x2f85('0x1a')](handleError(_0x9f3112,null));};exports['getDispositions']=function(_0x3719b0,_0x449df9){var _0x5b1d8a={'raw':![],'where':{}};var _0x2de18f={};var _0x33e470={'count':0x0,'rows':[]};return db['MailAccount'][_0x2f85('0x6f')]({'where':{'id':_0x3719b0[_0x2f85('0x60')]['id']}})[_0x2f85('0x11')](handleEntityNotFound(_0x449df9,null))['then'](function(_0x2f4aec){if(_0x2f4aec){_0x2de18f['model']=_[_0x2f85('0x4d')](db[_0x2f85('0x6d')][_0x2f85('0x63')]);_0x2de18f[_0x2f85('0x4c')]=_[_0x2f85('0x4d')](_0x3719b0[_0x2f85('0x4c')]);_0x2de18f[_0x2f85('0x4e')]=_[_0x2f85('0x4f')](_0x2de18f[_0x2f85('0x4a')],_0x2de18f[_0x2f85('0x4c')]);_0x5b1d8a[_0x2f85('0x50')]=_['intersection'](_0x2de18f[_0x2f85('0x4a')],qs[_0x2f85('0x51')](_0x3719b0['query'][_0x2f85('0x51')]));_0x5b1d8a[_0x2f85('0x50')]=_0x5b1d8a[_0x2f85('0x50')]['length']?_0x5b1d8a[_0x2f85('0x50')]:_0x2de18f[_0x2f85('0x4a')];if(!_0x3719b0[_0x2f85('0x4c')][_0x2f85('0x53')](_0x2f85('0x70'))){_0x5b1d8a[_0x2f85('0x20')]=qs[_0x2f85('0x20')](_0x3719b0[_0x2f85('0x4c')][_0x2f85('0x20')]);_0x5b1d8a[_0x2f85('0x1e')]=qs[_0x2f85('0x1e')](_0x3719b0['query'][_0x2f85('0x1e')]);}_0x5b1d8a[_0x2f85('0x71')]=qs['sort'](_0x3719b0[_0x2f85('0x4c')][_0x2f85('0x54')]);_0x5b1d8a[_0x2f85('0x55')]=qs[_0x2f85('0x4e')](_[_0x2f85('0x72')](_0x3719b0[_0x2f85('0x4c')],_0x2de18f[_0x2f85('0x4e')]));_0x5b1d8a['where'][_0x2f85('0x6c')]=_0x2f4aec['id'];if(_0x3719b0[_0x2f85('0x4c')]['filter']){_0x5b1d8a[_0x2f85('0x55')]=_[_0x2f85('0x56')](_0x5b1d8a['where'],{'$or':_[_0x2f85('0x4b')](_0x5b1d8a['attributes'],function(_0x1d8de1){var _0x54fe08={};_0x54fe08[_0x1d8de1]={'$like':'%'+_0x3719b0[_0x2f85('0x4c')][_0x2f85('0x59')]+'%'};return _0x54fe08;})});}_0x5b1d8a=_[_0x2f85('0x56')]({},_0x5b1d8a,_0x3719b0[_0x2f85('0x5a')]);return db['Disposition'][_0x2f85('0x21')]({'where':_0x5b1d8a['where']})[_0x2f85('0x11')](function(_0x392a4b){_0x33e470['count']=_0x392a4b;if(_0x3719b0[_0x2f85('0x4c')]['includeAll']){_0x5b1d8a[_0x2f85('0x5d')]=[{'all':!![]}];}return db[_0x2f85('0x6d')]['findAll'](_0x5b1d8a);})[_0x2f85('0x11')](function(_0x1fa978){_0x33e470[_0x2f85('0x5e')]=_0x1fa978;return _0x33e470;});}})['then'](respondWithFilteredResult(_0x449df9,_0x5b1d8a))[_0x2f85('0x1a')](handleError(_0x449df9,null));};exports[_0x2f85('0x73')]=function(_0x1160b6,_0x23a6a8){return db['MailAccount'][_0x2f85('0x68')]({'where':{'id':_0x1160b6[_0x2f85('0x60')]['id']}})[_0x2f85('0x11')](handleEntityNotFound(_0x23a6a8,null))[_0x2f85('0x11')](function(_0x1f1289){if(_0x1f1289){return _0x1f1289[_0x2f85('0x73')](_0x1160b6[_0x2f85('0x4c')][_0x2f85('0x74')]);}})['then'](respondWithStatusCode(_0x23a6a8,null))['catch'](handleError(_0x23a6a8,null));};exports[_0x2f85('0x75')]=function(_0x4a256b,_0x366f25){if(_0x4a256b[_0x2f85('0x65')]['id']){delete _0x4a256b[_0x2f85('0x65')]['id'];}return db[_0x2f85('0x5b')][_0x2f85('0x68')]({'where':{'id':_0x4a256b['params']['id']}})[_0x2f85('0x11')](handleEntityNotFound(_0x366f25,null))['then'](function(_0x30c825){if(_0x30c825){_0x4a256b[_0x2f85('0x65')][_0x2f85('0x6c')]=_0x30c825['id'];return db[_0x2f85('0x76')][_0x2f85('0x6e')](_0x4a256b['body']);}})[_0x2f85('0x11')](respondWithResult(_0x366f25,null))[_0x2f85('0x1a')](handleError(_0x366f25,null));};exports[_0x2f85('0x77')]=function(_0x3ab5ab,_0x215bc6){var _0x212586={'raw':![],'where':{}};var _0x563897={};var _0x5c8159={'count':0x0,'rows':[]};return db[_0x2f85('0x5b')][_0x2f85('0x6f')]({'where':{'id':_0x3ab5ab[_0x2f85('0x60')]['id']}})[_0x2f85('0x11')](handleEntityNotFound(_0x215bc6,null))['then'](function(_0x1dcdf4){if(_0x1dcdf4){_0x563897[_0x2f85('0x4a')]=_[_0x2f85('0x4d')](db[_0x2f85('0x76')][_0x2f85('0x63')]);_0x563897[_0x2f85('0x4c')]=_[_0x2f85('0x4d')](_0x3ab5ab['query']);_0x563897['filters']=_[_0x2f85('0x4f')](_0x563897[_0x2f85('0x4a')],_0x563897[_0x2f85('0x4c')]);_0x212586[_0x2f85('0x50')]=_[_0x2f85('0x4f')](_0x563897[_0x2f85('0x4a')],qs['fields'](_0x3ab5ab[_0x2f85('0x4c')][_0x2f85('0x51')]));_0x212586[_0x2f85('0x50')]=_0x212586[_0x2f85('0x50')][_0x2f85('0x52')]?_0x212586['attributes']:_0x563897[_0x2f85('0x4a')];if(!_0x3ab5ab['query']['hasOwnProperty'](_0x2f85('0x70'))){_0x212586[_0x2f85('0x20')]=qs[_0x2f85('0x20')](_0x3ab5ab['query'][_0x2f85('0x20')]);_0x212586[_0x2f85('0x1e')]=qs[_0x2f85('0x1e')](_0x3ab5ab[_0x2f85('0x4c')][_0x2f85('0x1e')]);}_0x212586[_0x2f85('0x71')]=qs[_0x2f85('0x54')](_0x3ab5ab[_0x2f85('0x4c')]['sort']);_0x212586[_0x2f85('0x55')]=qs[_0x2f85('0x4e')](_[_0x2f85('0x72')](_0x3ab5ab[_0x2f85('0x4c')],_0x563897[_0x2f85('0x4e')]));_0x212586[_0x2f85('0x55')][_0x2f85('0x6c')]=_0x1dcdf4['id'];if(_0x3ab5ab[_0x2f85('0x4c')]['filter']){_0x212586[_0x2f85('0x55')]=_[_0x2f85('0x56')](_0x212586['where'],{'$or':_[_0x2f85('0x4b')](_0x212586['attributes'],function(_0x128a0c){var _0x33e5d5={};_0x33e5d5[_0x128a0c]={'$like':'%'+_0x3ab5ab[_0x2f85('0x4c')][_0x2f85('0x59')]+'%'};return _0x33e5d5;})});}_0x212586=_[_0x2f85('0x56')]({},_0x212586,_0x3ab5ab[_0x2f85('0x5a')]);return db[_0x2f85('0x76')][_0x2f85('0x21')]({'where':_0x212586[_0x2f85('0x55')]})[_0x2f85('0x11')](function(_0x3917d7){_0x5c8159[_0x2f85('0x21')]=_0x3917d7;if(_0x3ab5ab[_0x2f85('0x4c')][_0x2f85('0x5c')]){_0x212586[_0x2f85('0x5d')]=[{'all':!![]}];}return db['CannedAnswer'][_0x2f85('0x78')](_0x212586);})[_0x2f85('0x11')](function(_0x2acfee){_0x5c8159['rows']=_0x2acfee;return _0x5c8159;});}})['then'](respondWithFilteredResult(_0x215bc6,_0x212586))['catch'](handleError(_0x215bc6,null));};exports[_0x2f85('0x79')]=function(_0x39a731,_0x30faee){return db[_0x2f85('0x5b')][_0x2f85('0x68')]({'where':{'id':_0x39a731[_0x2f85('0x60')]['id']}})[_0x2f85('0x11')](handleEntityNotFound(_0x30faee,null))['then'](function(_0x46ead0){if(_0x46ead0){return _0x46ead0[_0x2f85('0x79')](_0x39a731[_0x2f85('0x4c')][_0x2f85('0x74')]);}})[_0x2f85('0x11')](respondWithStatusCode(_0x30faee,null))[_0x2f85('0x1a')](handleError(_0x30faee,null));};exports['create']=function(_0x124621,_0x481402){var _0x1a8f62={'name':_0x124621[_0x2f85('0x65')][_0x2f85('0x2a')],'key':_0x124621['body']['key'],'provider':_0x124621[_0x2f85('0x65')][_0x2f85('0x67')]==='custom'?null:_0x124621[_0x2f85('0x65')][_0x2f85('0x67')],'email':_0x124621[_0x2f85('0x65')]['email'],'ListId':_0x124621[_0x2f85('0x65')][_0x2f85('0x7a')],'active':!_[_0x2f85('0x7b')](_0x124621[_0x2f85('0x65')][_0x2f85('0x7c')])?_0x124621[_0x2f85('0x65')]['active']:!![],'description':_0x124621[_0x2f85('0x65')][_0x2f85('0x7d')]||null};var _0x3c1c9c=getAuthenticationOptions(_0x1a8f62[_0x2f85('0x67')],_0x124621[_0x2f85('0x65')]);_0x1a8f62[_0x2f85('0x43')]=_0x3c1c9c[_0x2f85('0x43')];_0x1a8f62[_0x2f85('0x45')]=_0x3c1c9c[_0x2f85('0x45')];return db[_0x2f85('0x5b')][_0x2f85('0x6e')](_0x1a8f62,{'include':[{'model':db[_0x2f85('0x46')],'as':_0x2f85('0x45')},{'model':db[_0x2f85('0x61')],'as':_0x2f85('0x43')}]})[_0x2f85('0x11')](function(_0x33c1b8){var _0x2144af=_0x124621['user'][_0x2f85('0x25')]({'plain':!![]});if(!_0x2144af)throw new Error(_0x2f85('0x7e'));if(_0x2144af[_0x2f85('0x7f')]===_0x2f85('0x39')){var _0x4fbfae=_0x33c1b8[_0x2f85('0x25')]({'plain':!![]});return db[_0x2f85('0x80')][_0x2f85('0x68')]({'where':{'name':'MailAccounts','userProfileId':_0x2144af['userProfileId']},'raw':!![]})[_0x2f85('0x11')](function(_0xdb0a34){if(_0xdb0a34&&_0xdb0a34[_0x2f85('0x81')]===0x0){return db['UserProfileResource'][_0x2f85('0x6e')]({'name':_0x4fbfae[_0x2f85('0x2a')],'resourceId':_0x4fbfae['id'],'type':_0xdb0a34[_0x2f85('0x2a')],'sectionId':_0xdb0a34['id']},{})['then'](function(){return _0x33c1b8;});}else{return _0x33c1b8;}})[_0x2f85('0x1a')](function(_0x4ab714){logger['error'](_0x2f85('0x82'),_0x4ab714);throw _0x4ab714;});}return _0x33c1b8;})[_0x2f85('0x11')](respondWithResult(_0x481402,0xc9))[_0x2f85('0x1a')](handleError(_0x481402,null));};exports[_0x2f85('0x83')]=function(_0xc6c4a3,_0x3453ed){return db['MailAccount']['findOne']({'where':{'id':_0xc6c4a3[_0x2f85('0x60')]['id']}})['then'](handleEntityNotFound(_0x3453ed,null))[_0x2f85('0x11')](function(_0xbec8){if(_0xbec8){return _0xbec8[_0x2f85('0x83')]();}return null;})['then'](respondWithResult(_0x3453ed,null))[_0x2f85('0x1a')](handleError(_0x3453ed,null));};exports['addImap']=function(_0x5a5fec,_0x396035){if(_0x5a5fec['body']['id']){delete _0x5a5fec[_0x2f85('0x65')]['id'];}return db['MailAccount']['find']({'where':{'id':_0x5a5fec[_0x2f85('0x60')]['id']}})['then'](handleEntityNotFound(_0x396035,null))[_0x2f85('0x11')](function(_0x2a6dc2){if(_0x2a6dc2){_0x5a5fec['body'][_0x2f85('0x6c')]=_0x2a6dc2['id'];return db[_0x2f85('0x61')][_0x2f85('0x6e')](_0x5a5fec['body']);}})[_0x2f85('0x11')](respondWithResult(_0x396035,null))[_0x2f85('0x1a')](handleError(_0x396035,null));};exports['removeImap']=function(_0x1c3227,_0x48b0ec){return db[_0x2f85('0x5b')][_0x2f85('0x6f')]({'where':{'id':_0x1c3227[_0x2f85('0x60')]['id']}})[_0x2f85('0x11')](handleEntityNotFound(_0x48b0ec,null))[_0x2f85('0x11')](function(_0x38735c){if(_0x38735c){return _0x38735c[_0x2f85('0x84')](null);}return null;})[_0x2f85('0x11')](respondWithStatusCode(_0x48b0ec,null))['catch'](handleError(_0x48b0ec,null));};exports[_0x2f85('0x85')]=function(_0x3da7bc,_0x312201){return db['MailAccount'][_0x2f85('0x6f')]({'where':{'id':_0x3da7bc[_0x2f85('0x60')]['id']}})[_0x2f85('0x11')](handleEntityNotFound(_0x312201,null))[_0x2f85('0x11')](function(_0x1d2c14){if(_0x1d2c14){return _0x1d2c14['getSmtp']();}return null;})['then'](respondWithResult(_0x312201,null))[_0x2f85('0x1a')](handleError(_0x312201,null));};exports[_0x2f85('0x86')]=function(_0x55a260,_0x2c56bb){if(_0x55a260[_0x2f85('0x65')]['id']){delete _0x55a260[_0x2f85('0x65')]['id'];}return db[_0x2f85('0x5b')][_0x2f85('0x68')]({'where':{'id':_0x55a260[_0x2f85('0x60')]['id']}})[_0x2f85('0x11')](handleEntityNotFound(_0x2c56bb,null))['then'](function(_0x30e72d){if(_0x30e72d){_0x55a260['body'][_0x2f85('0x6c')]=_0x30e72d['id'];return db['MailServerOut'][_0x2f85('0x6e')](_0x55a260[_0x2f85('0x65')]);}})[_0x2f85('0x11')](respondWithResult(_0x2c56bb,null))[_0x2f85('0x1a')](handleError(_0x2c56bb,null));};exports[_0x2f85('0x87')]=function(_0x3afee5,_0x1336b7){return db['MailAccount']['findOne']({'where':{'id':_0x3afee5[_0x2f85('0x60')]['id']}})[_0x2f85('0x11')](handleEntityNotFound(_0x1336b7,null))['then'](function(_0x3a9187){if(_0x3a9187){return _0x3a9187[_0x2f85('0x88')](null);}return null;})[_0x2f85('0x11')](respondWithStatusCode(_0x1336b7,null))[_0x2f85('0x1a')](handleError(_0x1336b7,null));};exports['addInteraction']=function(_0x282fbe,_0x5b8482){return db[_0x2f85('0x89')][_0x2f85('0x68')]({'where':{'id':_0x282fbe[_0x2f85('0x60')]['id']}})['then'](handleEntityNotFound(_0x5b8482,null))[_0x2f85('0x11')](function(_0x510816){if(_0x510816){return _0x510816['addInteraction'](_0x282fbe['body'][_0x2f85('0x74')],_[_0x2f85('0x8a')](_0x282fbe[_0x2f85('0x65')],['ids','id'])||{});}})[_0x2f85('0x11')](respondWithResult(_0x5b8482,null))['catch'](handleError(_0x5b8482,null));};exports[_0x2f85('0x8b')]=function(_0x1888c0,_0x3f6b7d){var _0x2956e3={'raw':![],'where':{}};var _0x34cd16={};var _0x51f051={'count':0x0,'rows':[]};return db[_0x2f85('0x5b')][_0x2f85('0x6f')]({'where':{'id':_0x1888c0[_0x2f85('0x60')]['id']}})[_0x2f85('0x11')](handleEntityNotFound(_0x3f6b7d,null))[_0x2f85('0x11')](function(_0x1bde74){if(_0x1bde74){_0x34cd16[_0x2f85('0x4a')]=_[_0x2f85('0x4d')](db[_0x2f85('0x89')][_0x2f85('0x63')]);_0x34cd16['query']=_['keys'](_0x1888c0[_0x2f85('0x4c')]);_0x34cd16[_0x2f85('0x4e')]=_[_0x2f85('0x4f')](_0x34cd16[_0x2f85('0x4a')],_0x34cd16[_0x2f85('0x4c')]);_0x2956e3[_0x2f85('0x50')]=_[_0x2f85('0x4f')](_0x34cd16['model'],qs[_0x2f85('0x51')](_0x1888c0[_0x2f85('0x4c')][_0x2f85('0x51')]));_0x2956e3[_0x2f85('0x50')]=_0x2956e3['attributes'][_0x2f85('0x52')]?_0x2956e3[_0x2f85('0x50')]:_0x34cd16['model'];if(!_0x1888c0[_0x2f85('0x4c')][_0x2f85('0x53')](_0x2f85('0x70'))){_0x2956e3['limit']=qs[_0x2f85('0x20')](_0x1888c0[_0x2f85('0x4c')][_0x2f85('0x20')]);_0x2956e3['offset']=qs[_0x2f85('0x1e')](_0x1888c0['query'][_0x2f85('0x1e')]);}_0x2956e3[_0x2f85('0x71')]=qs['sort'](_0x1888c0['query'][_0x2f85('0x54')]);_0x2956e3[_0x2f85('0x55')]=qs['filters'](_[_0x2f85('0x72')](_0x1888c0[_0x2f85('0x4c')],_0x34cd16['filters']));_0x2956e3[_0x2f85('0x55')][_0x2f85('0x6c')]=_0x1bde74['id'];if(_0x1888c0[_0x2f85('0x4c')][_0x2f85('0x59')]){_0x2956e3[_0x2f85('0x55')]=_[_0x2f85('0x56')](_0x2956e3[_0x2f85('0x55')],{'$or':_[_0x2f85('0x4b')](_0x2956e3[_0x2f85('0x50')],function(_0x312d88){var _0x59d839={};_0x59d839[_0x312d88]={'$like':'%'+_0x1888c0[_0x2f85('0x4c')][_0x2f85('0x59')]+'%'};return _0x59d839;})});}_0x2956e3=_[_0x2f85('0x56')]({},_0x2956e3,_0x1888c0[_0x2f85('0x5a')]);return db[_0x2f85('0x89')][_0x2f85('0x21')]({'where':_0x2956e3[_0x2f85('0x55')]})[_0x2f85('0x11')](function(_0x29a6bf){_0x51f051[_0x2f85('0x21')]=_0x29a6bf;if(_0x1888c0[_0x2f85('0x4c')]['includeAll']){_0x2956e3[_0x2f85('0x5d')]=[{'model':db['CmContact'],'as':_0x2f85('0x8c'),'required':![]},{'model':db['User'],'as':_0x2f85('0x8d'),'attributes':[_0x2f85('0x2a'),_0x2f85('0x8e'),_0x2f85('0x8f')],'required':![]},{'model':db[_0x2f85('0x90')],'as':_0x2f85('0x91'),'attributes':['id',_0x2f85('0x2a'),_0x2f85('0x92')],'where':_0x1888c0[_0x2f85('0x4c')]['tag']?{'id':_0x1888c0['query'][_0x2f85('0x93')]}:undefined,'required':_0x1888c0[_0x2f85('0x4c')][_0x2f85('0x93')]?!![]:![]}];}return db['MailInteraction'][_0x2f85('0x78')](_0x2956e3);})[_0x2f85('0x11')](function(_0x41b54a){_0x51f051[_0x2f85('0x5e')]=_0x41b54a;return _0x51f051;});}})[_0x2f85('0x11')](respondWithFilteredResult(_0x3f6b7d,_0x2956e3))[_0x2f85('0x1a')](handleError(_0x3f6b7d,null));};exports[_0x2f85('0x94')]=function addApplications(_0x41e8fa,_0x42b05b){var _0x306b82=_0x41e8fa[_0x2f85('0x60')]['id'];var _0x4098f8=_0x41e8fa['body'];var _0x16b69c=0xc8;var _0x2c7045=null;return db['sequelize']['transaction']({'isolationLevel':db[_0x2f85('0x95')][_0x2f85('0x96')][_0x2f85('0x97')][_0x2f85('0x98')]},function(_0x284fc1){return db[_0x2f85('0x5b')]['findOne']({'where':{'id':_0x306b82},'transaction':_0x284fc1})['then'](function(_0x1f39eb){if(_0x1f39eb){return db[_0x2f85('0x99')][_0x2f85('0x24')]({'where':{'MailAccountId':_0x306b82},'transaction':_0x284fc1})[_0x2f85('0x11')](function(){var _0x176425=_[_0x2f85('0x4b')](_0x4098f8,function(_0x5478f8){_0x5478f8[_0x2f85('0x6c')]=_0x306b82;return _0x5478f8;});return db[_0x2f85('0x99')][_0x2f85('0x9a')](_0x176425,{'transaction':_0x284fc1});});}else{_0x16b69c=0x194;_0x2c7045=[];}});})['then'](function(){if(_0x16b69c!==0x194){return db[_0x2f85('0x99')][_0x2f85('0x9b')]({'where':{'MailAccountId':_0x306b82},'order':_0x2f85('0x9c')})[_0x2f85('0x11')](function(_0x1cccd6){_0x2c7045=_0x1cccd6;});}})[_0x2f85('0x1a')](function(_0x5ec293){_0x16b69c=0x1f4;logger[_0x2f85('0x17')](_0x5ec293['stack']);if(_0x5ec293[_0x2f85('0x2a')]){delete _0x5ec293[_0x2f85('0x2a')];}_0x2c7045=_0x5ec293;})['finally'](function(){if(_0x2c7045===null){_0x42b05b[_0x2f85('0x28')](_0x16b69c);}else{if(_0x16b69c===0x1f4){_0x42b05b[_0x2f85('0x1b')](_0x16b69c)[_0x2f85('0x2b')](_0x2c7045);}else{_0x42b05b[_0x2f85('0x1b')](_0x16b69c)[_0x2f85('0x1d')](_0x2c7045);}}});};exports[_0x2f85('0x9d')]=function(_0x11fa07,_0x5d87f6){var _0x14c558={};var _0x1d8e72={};var _0x6aea8b;var _0x1c5d0f;return db['MailAccount'][_0x2f85('0x6f')]({'where':{'id':_0x11fa07[_0x2f85('0x60')]['id']}})[_0x2f85('0x11')](handleEntityNotFound(_0x5d87f6,null))[_0x2f85('0x11')](function(_0x48388b){if(_0x48388b){_0x6aea8b=_0x48388b;_0x1d8e72[_0x2f85('0x4a')]=_[_0x2f85('0x4d')](db[_0x2f85('0x99')]['rawAttributes']);_0x1d8e72[_0x2f85('0x4c')]=_[_0x2f85('0x4d')](_0x11fa07[_0x2f85('0x4c')]);_0x1d8e72[_0x2f85('0x4e')]=_[_0x2f85('0x4f')](_0x1d8e72[_0x2f85('0x4a')],_0x1d8e72[_0x2f85('0x4c')]);_0x14c558[_0x2f85('0x50')]=_['intersection'](_0x1d8e72[_0x2f85('0x4a')],qs[_0x2f85('0x51')](_0x11fa07[_0x2f85('0x4c')]['fields']));_0x14c558[_0x2f85('0x50')]=_0x14c558['attributes'][_0x2f85('0x52')]?_0x14c558[_0x2f85('0x50')]:_0x1d8e72[_0x2f85('0x4a')];_0x14c558[_0x2f85('0x71')]=qs[_0x2f85('0x54')](_0x11fa07[_0x2f85('0x4c')]['sort']);_0x14c558[_0x2f85('0x55')]=qs['filters'](_['pick'](_0x11fa07[_0x2f85('0x4c')],_0x1d8e72[_0x2f85('0x4e')]));if(_0x11fa07[_0x2f85('0x4c')][_0x2f85('0x59')]){_0x14c558[_0x2f85('0x55')]=_[_0x2f85('0x56')](_0x14c558[_0x2f85('0x55')],{'$or':_['map'](_0x14c558[_0x2f85('0x50')],function(_0x29c8e6){var _0x492556={};_0x492556[_0x29c8e6]={'$like':'%'+_0x11fa07[_0x2f85('0x4c')]['filter']+'%'};return _0x492556;})});}_0x14c558=_[_0x2f85('0x56')]({},_0x14c558,_0x11fa07[_0x2f85('0x5a')]);return _0x6aea8b[_0x2f85('0x9d')](_0x14c558);}})[_0x2f85('0x11')](function(_0x5c255e){if(_0x5c255e){_0x1c5d0f=_0x5c255e[_0x2f85('0x52')];if(!_0x11fa07[_0x2f85('0x4c')]['hasOwnProperty'](_0x2f85('0x70'))){_0x14c558[_0x2f85('0x20')]=qs[_0x2f85('0x20')](_0x11fa07[_0x2f85('0x4c')][_0x2f85('0x20')]);_0x14c558[_0x2f85('0x1e')]=qs['offset'](_0x11fa07['query'][_0x2f85('0x1e')]);}return _0x6aea8b[_0x2f85('0x9d')](_0x14c558);}})[_0x2f85('0x11')](function(_0x56b3be){if(_0x56b3be){return _0x56b3be?{'count':_0x1c5d0f,'rows':_0x56b3be}:null;}})[_0x2f85('0x11')](respondWithResult(_0x5d87f6,null))[_0x2f85('0x1a')](handleError(_0x5d87f6,null));};exports[_0x2f85('0x9e')]=function(_0x27a2c9,_0x2a6bf2){var _0x1e41df={'raw':!![],'where':{}};var _0x469bf6={};var _0x2dc960={'count':0x0,'rows':[]};return db['MailAccount'][_0x2f85('0x6f')]({'where':{'id':_0x27a2c9[_0x2f85('0x60')]['id']}})[_0x2f85('0x11')](handleEntityNotFound(_0x2a6bf2,null))[_0x2f85('0x11')](function(_0x36ae16){if(_0x36ae16){_0x469bf6[_0x2f85('0x4a')]=_[_0x2f85('0x4d')](db[_0x2f85('0x9f')][_0x2f85('0x63')]);_0x469bf6[_0x2f85('0x4c')]=_['keys'](_0x27a2c9[_0x2f85('0x4c')]);_0x469bf6['filters']=_[_0x2f85('0x4f')](_0x469bf6[_0x2f85('0x4a')],_0x469bf6['query']);_0x1e41df[_0x2f85('0x50')]=_[_0x2f85('0x4f')](_0x469bf6[_0x2f85('0x4a')],qs[_0x2f85('0x51')](_0x27a2c9[_0x2f85('0x4c')]['fields']));_0x1e41df[_0x2f85('0x50')]=_0x1e41df[_0x2f85('0x50')][_0x2f85('0x52')]?_0x1e41df[_0x2f85('0x50')]:_0x469bf6[_0x2f85('0x4a')];if(!_0x27a2c9[_0x2f85('0x4c')][_0x2f85('0x53')](_0x2f85('0x70'))){_0x1e41df[_0x2f85('0x20')]=qs[_0x2f85('0x20')](_0x27a2c9[_0x2f85('0x4c')][_0x2f85('0x20')]);_0x1e41df['offset']=qs[_0x2f85('0x1e')](_0x27a2c9[_0x2f85('0x4c')]['offset']);}_0x1e41df['order']=qs['sort'](_0x27a2c9[_0x2f85('0x4c')]['sort']);_0x1e41df[_0x2f85('0x55')]=qs['filters'](_[_0x2f85('0x72')](_0x27a2c9[_0x2f85('0x4c')],_0x469bf6['filters']));_0x1e41df[_0x2f85('0x55')][_0x2f85('0x6c')]=_0x36ae16['id'];if(_0x27a2c9[_0x2f85('0x4c')][_0x2f85('0x59')]){_0x1e41df[_0x2f85('0x55')]=_['merge'](_0x1e41df[_0x2f85('0x55')],{'$or':_['map'](_0x1e41df[_0x2f85('0x50')],function(_0x471f00){var _0x4fe409={};_0x4fe409[_0x471f00]={'$like':'%'+_0x27a2c9['query'][_0x2f85('0x59')]+'%'};return _0x4fe409;})});}if(_0x27a2c9[_0x2f85('0x4c')][_0x2f85('0xa0')]){var _0x5d101b=_0x27a2c9[_0x2f85('0x4c')][_0x2f85('0xa0')]['split'](',');var _0x696112={};_0x696112[_0x5d101b[0x0]]={'$gte':moment(_0x5d101b[0x1])[_0x2f85('0xa1')](_0x2f85('0xa2'))};_0x1e41df[_0x2f85('0x55')]=_[_0x2f85('0x56')](_0x1e41df[_0x2f85('0x55')],_0x696112);}_0x1e41df=_[_0x2f85('0x56')]({},_0x1e41df,_0x27a2c9[_0x2f85('0x5a')]);return db[_0x2f85('0x9f')][_0x2f85('0x21')]({'where':_0x1e41df[_0x2f85('0x55')]})['then'](function(_0x384915){_0x2dc960['count']=_0x384915;if(_0x27a2c9[_0x2f85('0x4c')][_0x2f85('0x5c')]){_0x1e41df['include']=[{'all':!![]}];}return db[_0x2f85('0x9f')]['findAll'](_0x1e41df);})[_0x2f85('0x11')](function(_0x2e1d26){if(_0x27a2c9[_0x2f85('0x4c')][_0x2f85('0xa3')]==='true'){for(var _0x311bb8=0x0;_0x311bb8<_0x2e1d26[_0x2f85('0x52')];_0x311bb8++){_0x2e1d26[_0x311bb8][_0x2f85('0x65')]=juice(_0x2e1d26[_0x311bb8]['body']);}}_0x2dc960[_0x2f85('0x5e')]=_0x2e1d26;return _0x2dc960;});}})['then'](respondWithFilteredResult(_0x2a6bf2,_0x1e41df))['catch'](handleError(_0x2a6bf2,null));};exports[_0x2f85('0x2b')]=function(_0x401aef,_0x1708ae){var _0x22fa3b,_0x65776a={},_0x12d611;if(_0x401aef[_0x2f85('0x65')]['to']){_0x12d611=_0x401aef[_0x2f85('0x65')]['to'][_0x2f85('0xa4')](',')[0x0];}return db['MailAccount'][_0x2f85('0x68')]({'where':{'id':_0x401aef[_0x2f85('0x60')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x2f85('0xa5')],'as':'Contacts','where':{'email':_0x12d611},'limit':0x1,'order':[[_0x2f85('0xa6'),_0x2f85('0xa7')]]}]},{'model':db['MailServerOut'],'as':'Smtp','raw':!![],'include':[{'model':db[_0x2f85('0xa8')],'as':_0x2f85('0xa8'),'raw':!![]}]}]})[_0x2f85('0x11')](handleEntityNotFound(_0x1708ae,null))['then'](function(_0x21a2fc){if(!_0x21a2fc)return;_0x22fa3b=_0x21a2fc;if(!_0x21a2fc[_0x2f85('0x45')])throw new Error('Smtp\x20configuration\x20not\x20found');if(_[_0x2f85('0x7b')](_0x401aef['body'][_0x2f85('0xa9')])){_0x401aef[_0x2f85('0x65')]['from']=util[_0x2f85('0xa1')]('%s\x20<%s>',_0x21a2fc[_0x2f85('0x2a')],_0x21a2fc[_0x2f85('0xaa')]||_0x21a2fc[_0x2f85('0x45')][_0x2f85('0x39')]);}if(_0x401aef[_0x2f85('0x65')][_0x2f85('0xab')]&&_0x401aef[_0x2f85('0x65')][_0x2f85('0xab')][_0x2f85('0x52')]){for(var _0x285d45=0x0;_0x285d45<_0x401aef[_0x2f85('0x65')][_0x2f85('0xab')][_0x2f85('0x52')];_0x285d45+=0x1){_0x401aef[_0x2f85('0x65')]['attachments'][_0x285d45]={'filename':_0x401aef[_0x2f85('0x65')][_0x2f85('0xab')][_0x285d45]['name'],'path':path[_0x2f85('0xac')](config[_0x2f85('0xad')],'server/files/attachments',_0x401aef[_0x2f85('0x65')][_0x2f85('0xab')][_0x285d45][_0x2f85('0xae')])};}}var _0x17dfda=_0x21a2fc['getSmtpOptions']();return respondWithRpcPromise(_0x2f85('0xaf'),_0x2f85('0xb0'),{'account':_0x17dfda,'message':_0x401aef[_0x2f85('0x65')]});})[_0x2f85('0x11')](function(_0x175642){if(!_0x175642)return;_0x65776a=_0x175642;if(!_0x22fa3b[_0x2f85('0xb1')])throw new Error(_0x2f85('0xb2'));if(_0x22fa3b[_0x2f85('0xb1')][_0x2f85('0xb3')][_0x2f85('0x52')])return _0x22fa3b[_0x2f85('0xb1')][_0x2f85('0xb3')][0x0];return db['CmContact'][_0x2f85('0x6e')](_[_0x2f85('0x8')](_0x401aef[_0x2f85('0x65')],{'firstName':_0x401aef[_0x2f85('0x65')]['to'],'email':_0x401aef['body']['to'],'phone':_0x401aef['body']['to'],'ListId':_0x22fa3b[_0x2f85('0x7a')]}));})[_0x2f85('0x11')](function(_0x5c93b7){if(!_0x5c93b7)return;var _0x4a2b21={'UserId':_0x401aef[_0x2f85('0x39')]['id'],'ContactId':_0x5c93b7['id'],'MailAccountId':_0x22fa3b['id'],'inReplyTo':_0x65776a['messageId'],'to':_0x401aef['body'][_0x2f85('0xa9')],'cc':_0x401aef[_0x2f85('0x65')]['cc'],'subject':_0x401aef[_0x2f85('0x65')][_0x2f85('0xb4')],'attach':_0x401aef[_0x2f85('0x65')][_0x2f85('0xb5')],'firstMsgDirection':_0x2f85('0xb6'),'lastMsgAt':moment()[_0x2f85('0xa1')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':_0x2f85('0xb6'),'Messages':[_[_0x2f85('0x56')](_0x401aef[_0x2f85('0x65')],{'messageId':_0x65776a[_0x2f85('0xb7')],'sentAt':moment()['format'](_0x2f85('0xa2')),'read':!![],'MailAccountId':_0x22fa3b['id'],'UserId':_0x401aef[_0x2f85('0x39')]['id'],'ContactId':_0x5c93b7['id']})]};if(_0x401aef[_0x2f85('0x65')]['Interaction']){_0x4a2b21=_[_0x2f85('0x56')](_0x4a2b21,_0x401aef[_0x2f85('0x65')][_0x2f85('0xb8')]);}return db[_0x2f85('0x89')][_0x2f85('0x6e')](_0x4a2b21,{'include':[{'model':db[_0x2f85('0x9f')],'as':_0x2f85('0xb9')}]});})[_0x2f85('0x11')](respondWithResult(_0x1708ae,null))[_0x2f85('0x1a')](handleError(_0x1708ae,null));};exports[_0x2f85('0xba')]=function(_0x3c2eb5,_0x3535bf){return db[_0x2f85('0x5b')]['find']({'where':{'id':_0x3c2eb5[_0x2f85('0x60')]['id']},'include':[{'model':db[_0x2f85('0x46')],'as':'Smtp','raw':!![],'include':[{'model':db[_0x2f85('0xa8')],'as':_0x2f85('0xa8'),'raw':!![]}]}]})['then'](handleEntityNotFound(_0x3535bf,null))[_0x2f85('0x11')](function(_0x89e967){if(!_0x89e967[_0x2f85('0x45')])return;var _0x5c193a=_0x89e967[_0x2f85('0xbb')]();return respondWithRpcPromise(_0x2f85('0xbc'),_0x2f85('0xba'),{'account':_0x5c193a});})['then'](respondWithResult(_0x3535bf,null))['catch'](handleError(_0x3535bf,null));};exports[_0x2f85('0x24')]=function(_0x5623e7,_0x2eedf2){return db[_0x2f85('0x5b')][_0x2f85('0x68')]({'where':{'id':_0x5623e7[_0x2f85('0x60')]['id']}})['then'](handleEntityNotFound(_0x2eedf2,null))[_0x2f85('0x11')](function(_0x1d366d){if(_0x1d366d&&_0x1d366d[_0x2f85('0x40')]){throw new db[(_0x2f85('0xbd'))][(_0x2f85('0xbe'))](_0x2f85('0xbf'));}return _0x1d366d;})[_0x2f85('0x11')](removeEntity(_0x2eedf2,null))[_0x2f85('0x1a')](handleError(_0x2eedf2,null));};exports['addAgents']=function(_0x4aaff1,_0x96ffcf){return db[_0x2f85('0x5b')][_0x2f85('0x68')]({'where':{'id':_0x4aaff1[_0x2f85('0x60')]['id']}})[_0x2f85('0x11')](handleEntityNotFound(_0x96ffcf,null))[_0x2f85('0x11')](function(_0xb7fbab){if(_0xb7fbab){return _0xb7fbab[_0x2f85('0xc0')](_0x4aaff1[_0x2f85('0x65')][_0x2f85('0x74')],_['omit'](_0x4aaff1[_0x2f85('0x65')],['ids','id'])||{})[_0x2f85('0xc1')](function(_0x3cfbdd){for(var _0x1ba4c0=0x0;_0x1ba4c0<_0x4aaff1[_0x2f85('0x65')][_0x2f85('0x74')][_0x2f85('0x52')];_0x1ba4c0+=0x1){socket[_0x2f85('0xc2')](_0x2f85('0xc3'),{'UserId':Number(_0x4aaff1[_0x2f85('0x65')][_0x2f85('0x74')][_0x1ba4c0]),'MailAccountId':Number(_0x4aaff1['params']['id'])});}return _0x3cfbdd;});}})[_0x2f85('0x11')](respondWithResult(_0x96ffcf,null))[_0x2f85('0x1a')](handleError(_0x96ffcf,null));};exports[_0x2f85('0xc4')]=function(_0x44b8e9,_0x1baf1a){return db[_0x2f85('0x5b')][_0x2f85('0x68')]({'where':{'id':_0x44b8e9['params']['id']}})[_0x2f85('0x11')](handleEntityNotFound(_0x1baf1a,null))['then'](function(_0x33ee8e){if(_0x33ee8e){return _0x33ee8e['removeAgents'](_0x44b8e9['query'][_0x2f85('0x74')])[_0x2f85('0x11')](function(){if(_[_0x2f85('0xc5')](_0x44b8e9[_0x2f85('0x4c')][_0x2f85('0x74')])){for(var _0x16d279=0x0;_0x16d279<_0x44b8e9['query'][_0x2f85('0x74')][_0x2f85('0x52')];_0x16d279+=0x1){socket[_0x2f85('0xc2')](_0x2f85('0xc6'),{'UserId':Number(_0x44b8e9[_0x2f85('0x4c')][_0x2f85('0x74')][_0x16d279]),'MailAccountId':Number(_0x44b8e9[_0x2f85('0x60')]['id'])});}}else{socket['emit']('userMailAccount:remove',{'UserId':Number(_0x44b8e9[_0x2f85('0x4c')][_0x2f85('0x74')]),'MailAccountId':Number(_0x44b8e9[_0x2f85('0x60')]['id'])});}});}})[_0x2f85('0x11')](respondWithStatusCode(_0x1baf1a,null))[_0x2f85('0x1a')](handleError(_0x1baf1a,null));};exports[_0x2f85('0xc7')]=function(_0x2ebc01,_0x5de30c){var _0x5cb8ea={};var _0x469b36={};var _0x11e8c0;var _0x3d8a40;return db[_0x2f85('0x5b')][_0x2f85('0x6f')]({'where':{'id':_0x2ebc01[_0x2f85('0x60')]['id']}})[_0x2f85('0x11')](handleEntityNotFound(_0x5de30c,null))[_0x2f85('0x11')](function(_0x38d5c6){if(_0x38d5c6){_0x11e8c0=_0x38d5c6;_0x469b36[_0x2f85('0x4a')]=_[_0x2f85('0x4d')](db[_0x2f85('0xc8')][_0x2f85('0x63')]);_0x469b36['query']=_['keys'](_0x2ebc01['query']);_0x469b36[_0x2f85('0x4e')]=_[_0x2f85('0x4f')](_0x469b36['model'],_0x469b36[_0x2f85('0x4c')]);_0x5cb8ea[_0x2f85('0x50')]=_['intersection'](_0x469b36[_0x2f85('0x4a')],qs['fields'](_0x2ebc01[_0x2f85('0x4c')][_0x2f85('0x51')]));_0x5cb8ea['attributes']=_0x5cb8ea[_0x2f85('0x50')][_0x2f85('0x52')]?_0x5cb8ea[_0x2f85('0x50')]:_0x469b36[_0x2f85('0x4a')];_0x5cb8ea['order']=qs[_0x2f85('0x54')](_0x2ebc01[_0x2f85('0x4c')]['sort']);_0x5cb8ea['where']=qs[_0x2f85('0x4e')](_['pick'](_0x2ebc01['query'],_0x469b36[_0x2f85('0x4e')]));if(_0x2ebc01[_0x2f85('0x4c')]['filter']){_0x5cb8ea[_0x2f85('0x55')]=_[_0x2f85('0x56')](_0x5cb8ea[_0x2f85('0x55')],{'$or':_['map'](_0x5cb8ea[_0x2f85('0x50')],function(_0x1dc59b){var _0x87fe55={};_0x87fe55[_0x1dc59b]={'$like':'%'+_0x2ebc01[_0x2f85('0x4c')][_0x2f85('0x59')]+'%'};return _0x87fe55;})});}_0x5cb8ea=_[_0x2f85('0x56')]({},_0x5cb8ea,_0x2ebc01[_0x2f85('0x5a')]);return _0x11e8c0[_0x2f85('0xc7')](_0x5cb8ea);}})[_0x2f85('0x11')](function(_0x5c3bac){if(_0x5c3bac){_0x3d8a40=_0x5c3bac['length'];if(!_0x2ebc01[_0x2f85('0x4c')][_0x2f85('0x53')](_0x2f85('0x70'))){_0x5cb8ea[_0x2f85('0x20')]=qs['limit'](_0x2ebc01[_0x2f85('0x4c')][_0x2f85('0x20')]);_0x5cb8ea[_0x2f85('0x1e')]=qs[_0x2f85('0x1e')](_0x2ebc01['query'][_0x2f85('0x1e')]);}return _0x11e8c0[_0x2f85('0xc7')](_0x5cb8ea);}})[_0x2f85('0x11')](function(_0x51afef){if(_0x51afef){return _0x51afef?{'count':_0x3d8a40,'rows':_0x51afef}:null;}})[_0x2f85('0x11')](respondWithResult(_0x5de30c,null))[_0x2f85('0x1a')](handleError(_0x5de30c,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index cbeb0d8..2487cc9 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 _0xe829=['save','update','remove','hasOwnProperty','hook','exports','../../mysqldb','MailAccount','setMaxListeners'];(function(_0x249338,_0x361061){var _0x4ed489=function(_0x2ff360){while(--_0x2ff360){_0x249338['push'](_0x249338['shift']());}};_0x4ed489(++_0x361061);}(_0xe829,0xde));var _0x9e82=function(_0x3295b6,_0x1bc521){_0x3295b6=_0x3295b6-0x0;var _0x4e7914=_0xe829[_0x3295b6];return _0x4e7914;};'use strict';var EventEmitter=require('events');var MailAccount=require(_0x9e82('0x0'))['db'][_0x9e82('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x9e82('0x2')](0x0);var events={'afterCreate':_0x9e82('0x3'),'afterUpdate':_0x9e82('0x4'),'afterDestroy':_0x9e82('0x5')};function emitEvent(_0x487d2d){return function(_0xc8aec1,_0x19ece0,_0x4bd524){MailAccountEvents['emit'](_0x487d2d+':'+_0xc8aec1['id'],_0xc8aec1);MailAccountEvents['emit'](_0x487d2d,_0xc8aec1);_0x4bd524(null);};}for(var e in events){if(events[_0x9e82('0x6')](e)){var event=events[e];MailAccount[_0x9e82('0x7')](e,emitEvent(event));}}module[_0x9e82('0x8')]=MailAccountEvents; \ No newline at end of file +var _0x1b9b=['exports','events','MailAccount','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x1846e2,_0xe66a3a){var _0x626282=function(_0x3c3e01){while(--_0x3c3e01){_0x1846e2['push'](_0x1846e2['shift']());}};_0x626282(++_0xe66a3a);}(_0x1b9b,0x89));var _0xb1b9=function(_0x42034f,_0x6b7fb6){_0x42034f=_0x42034f-0x0;var _0x1ba47d=_0x1b9b[_0x42034f];return _0x1ba47d;};'use strict';var EventEmitter=require(_0xb1b9('0x0'));var MailAccount=require('../../mysqldb')['db'][_0xb1b9('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xb1b9('0x2')](0x0);var events={'afterCreate':_0xb1b9('0x3'),'afterUpdate':_0xb1b9('0x4'),'afterDestroy':'remove'};function emitEvent(_0x38f77a){return function(_0x411464,_0x597f8f,_0x5c24be){MailAccountEvents['emit'](_0x38f77a+':'+_0x411464['id'],_0x411464);MailAccountEvents[_0xb1b9('0x5')](_0x38f77a,_0x411464);_0x5c24be(null);};}for(var e in events){if(events[_0xb1b9('0x6')](e)){var event=events[e];MailAccount['hook'](e,emitEvent(event));}}module[_0xb1b9('0x7')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index aee2f99..b3e1520 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 _0xb4ef=['OAuth2','user','./mailAccount.attributes','exports','define','mail_accounts','provider','service','host','Smtp','port','secure','authentication','modernAuthentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found'];(function(_0x5188fb,_0x4f2f72){var _0x538115=function(_0x230502){while(--_0x230502){_0x5188fb['push'](_0x5188fb['shift']());}};_0x538115(++_0x4f2f72);}(_0xb4ef,0x1a2));var _0xfb4e=function(_0x366799,_0x5c5e0e){_0x366799=_0x366799-0x0;var _0x3cd74d=_0xb4ef[_0x366799];return _0x3cd74d;};'use strict';var attributes=require(_0xfb4e('0x0'));module[_0xfb4e('0x1')]=function(_0xcd2b79){return _0xcd2b79[_0xfb4e('0x2')]('MailAccount',attributes,{'tableName':_0xfb4e('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x384832=this;var _0x1291b7={'id':_0x384832['id'],'tls':{'rejectUnauthorized':![]}};if(_0x384832[_0xfb4e('0x4')]!=='custom'){_0x1291b7[_0xfb4e('0x5')]=_0x384832[_0xfb4e('0x4')];}else{_0x1291b7[_0xfb4e('0x6')]=_0x384832[_0xfb4e('0x7')]['host'];_0x1291b7[_0xfb4e('0x8')]=_0x384832[_0xfb4e('0x7')]['port'];_0x1291b7[_0xfb4e('0x9')]=_0x384832[_0xfb4e('0x7')][_0xfb4e('0x9')];}if(_0x384832['Smtp'][_0xfb4e('0xa')]){if(_0x384832[_0xfb4e('0x7')][_0xfb4e('0xb')]){if(!_0x384832[_0xfb4e('0x7')][_0xfb4e('0xc')])throw new Error(_0xfb4e('0xd'));_0x1291b7['auth']={'type':_0xfb4e('0xe'),'user':_0x384832[_0xfb4e('0x7')][_0xfb4e('0xf')],'accessToken':_0x384832[_0xfb4e('0x7')][_0xfb4e('0xc')]['data5']};}else{_0x1291b7['auth']={'user':_0x384832['Smtp']['user'],'pass':_0x384832['Smtp']['pass']};}}return _0x1291b7;}}});}; \ No newline at end of file +var _0xbeb2=['MailAccount','mail_accounts','custom','service','provider','Smtp','host','port','secure','authentication','modernAuthentication','CloudProvider','OAuth2','user','auth','exports','define'];(function(_0x5b684,_0x22db3c){var _0x1fa9b7=function(_0x2e76f4){while(--_0x2e76f4){_0x5b684['push'](_0x5b684['shift']());}};_0x1fa9b7(++_0x22db3c);}(_0xbeb2,0x75));var _0x2beb=function(_0x1aacb2,_0x4dba34){_0x1aacb2=_0x1aacb2-0x0;var _0x3a6459=_0xbeb2[_0x1aacb2];return _0x3a6459;};'use strict';var attributes=require('./mailAccount.attributes');module[_0x2beb('0x0')]=function(_0xcc612d){return _0xcc612d[_0x2beb('0x1')](_0x2beb('0x2'),attributes,{'tableName':_0x2beb('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x25292d=this;var _0x2e5b9c={'id':_0x25292d['id'],'tls':{'rejectUnauthorized':![]}};if(_0x25292d['provider']!==_0x2beb('0x4')){_0x2e5b9c[_0x2beb('0x5')]=_0x25292d[_0x2beb('0x6')];}else{_0x2e5b9c['host']=_0x25292d[_0x2beb('0x7')][_0x2beb('0x8')];_0x2e5b9c[_0x2beb('0x9')]=_0x25292d['Smtp'][_0x2beb('0x9')];_0x2e5b9c[_0x2beb('0xa')]=_0x25292d['Smtp'][_0x2beb('0xa')];}if(_0x25292d[_0x2beb('0x7')][_0x2beb('0xb')]){if(_0x25292d[_0x2beb('0x7')][_0x2beb('0xc')]){if(!_0x25292d[_0x2beb('0x7')][_0x2beb('0xd')])throw new Error('Cloud\x20Provider\x20configuration\x20not\x20found');_0x2e5b9c['auth']={'type':_0x2beb('0xe'),'user':_0x25292d['Smtp'][_0x2beb('0xf')],'accessToken':_0x25292d['Smtp']['CloudProvider']['data5']};}else{_0x2e5b9c[_0x2beb('0x10')]={'user':_0x25292d[_0x2beb('0x7')][_0x2beb('0xf')],'pass':_0x25292d[_0x2beb('0x7')]['pass']};}}return _0x2e5b9c;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index d674dcb..0c1e7b3 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 _0x1670=['priority','asc','push','length','close','autoclose','*,*,*,*','ListId','List\x20not\x20found','contact','messageId','generate','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','Messages','inReplyTo','create','Contact\x20not\x20found','spread','update','subject','attach','interaction','get','created','attachments','originTo','originCc','originChannel','ChatOfflineMessageId','Attachment','Attachments','User','name','UserId','unshift','agent','waitForTheAssignedAgent','queueId','MailQueue','queue','waitForTheAssignedQueue','Start','startRouting','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','GetMailAccount','MailAccount','findAll','options','where','attributes','include','map','model','catch','find','smtp','setDataValue','getSmtpOptions','ShowMailAccount','NotifyMailAccount','body','mail','difference','keys','CmContact','rawAttributes','createdAt','CompanyId','from\x20is\x20mandatory','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','List','Contacts','DESC','Applications','MailServerOut','account','omit','list','applications','orderBy'];(function(_0x1a7957,_0x19cd9b){var _0x57493e=function(_0xbf9e27){while(--_0xbf9e27){_0x1a7957['push'](_0x1a7957['shift']());}};_0x57493e(++_0x19cd9b);}(_0x1670,0x9a));var _0x0167=function(_0x40225e,_0x5c981a){_0x40225e=_0x40225e-0x0;var _0x326c2b=_0x1670[_0x40225e];return _0x326c2b;};'use strict';var _=require(_0x0167('0x0'));var moment=require(_0x0167('0x1'));var BPromise=require('bluebird');var rs=require(_0x0167('0x2'));var Redis=require('ioredis');var db=require(_0x0167('0x3'))['db'];var logger=require(_0x0167('0x4'))(_0x0167('0x5'));var config=require(_0x0167('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x0167('0x7')]({'port':0x232c});config[_0x0167('0x8')]=_[_0x0167('0x9')](config[_0x0167('0x8')],{'host':_0x0167('0xa'),'port':0x18eb});var socket=require(_0x0167('0xb'))(new Redis(config[_0x0167('0x8')]));require(_0x0167('0xc'))['register'](socket);function respondWithRpcPromise(_0x4c6b78,_0x146dad,_0x178f5f){return new BPromise(function(_0x2b88ec,_0x1632d4){return client[_0x0167('0xd')](_0x4c6b78,_0x178f5f)[_0x0167('0xe')](function(_0x2257a8){logger[_0x0167('0xf')](_0x0167('0x10'),_0x146dad,_0x0167('0x11'));logger[_0x0167('0x12')](_0x0167('0x13'),_0x146dad,_0x0167('0x11'),JSON[_0x0167('0x14')](_0x2257a8));if(_0x2257a8['error']){if(_0x2257a8[_0x0167('0x15')]['code']===0x1f4){logger[_0x0167('0x15')]('MailAccount,\x20%s,\x20%s',_0x146dad,_0x2257a8[_0x0167('0x15')][_0x0167('0x16')]);return _0x1632d4(_0x2257a8[_0x0167('0x15')]['message']);}logger['error']('MailAccount,\x20%s,\x20%s',_0x146dad,_0x2257a8[_0x0167('0x15')][_0x0167('0x16')]);return _0x2b88ec(_0x2257a8['error'][_0x0167('0x16')]);}else{logger['info']('MailAccount,\x20%s,\x20%s',_0x146dad,_0x0167('0x11'));_0x2b88ec(_0x2257a8['result'][_0x0167('0x16')]);}})['catch'](function(_0x16094a){logger[_0x0167('0x15')](_0x0167('0x10'),_0x146dad,_0x16094a);_0x1632d4(_0x16094a);});});}exports[_0x0167('0x17')]=function(_0xc3f9fe){var _0x45dfe1=this;return new Promise(function(_0xa384d9,_0x3cd14f){return db[_0x0167('0x18')][_0x0167('0x19')]({'raw':_0xc3f9fe[_0x0167('0x1a')]?_0xc3f9fe[_0x0167('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0xc3f9fe[_0x0167('0x1a')]?_0xc3f9fe[_0x0167('0x1a')][_0x0167('0x1b')]||null:null,'attributes':_0xc3f9fe['options']?_0xc3f9fe[_0x0167('0x1a')][_0x0167('0x1c')]||null:null,'limit':_0xc3f9fe[_0x0167('0x1a')]?_0xc3f9fe[_0x0167('0x1a')]['limit']||null:null,'include':_0xc3f9fe[_0x0167('0x1a')]?_0xc3f9fe['options'][_0x0167('0x1d')]?_[_0x0167('0x1e')](_0xc3f9fe[_0x0167('0x1a')][_0x0167('0x1d')],function(_0x46231b){return{'model':db[_0x46231b[_0x0167('0x1f')]],'as':_0x46231b['as'],'attributes':_0x46231b[_0x0167('0x1c')],'include':_0x46231b['include']?_[_0x0167('0x1e')](_0x46231b[_0x0167('0x1d')],function(_0x23a863){return{'model':db[_0x23a863['model']],'as':_0x23a863['as'],'attributes':_0x23a863[_0x0167('0x1c')],'include':_0x23a863[_0x0167('0x1d')]?_['map'](_0x23a863[_0x0167('0x1d')],function(_0x3f4071){return{'model':db[_0x3f4071['model']],'as':_0x3f4071['as'],'attributes':_0x3f4071[_0x0167('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x0167('0xe')](function(_0x4179d4){logger['info'](_0x0167('0x17'),_0xc3f9fe);logger[_0x0167('0x12')]('GetMailAccount',_0xc3f9fe,JSON['stringify'](_0x4179d4));_0xa384d9(_0x4179d4);})[_0x0167('0x20')](function(_0x124763){logger[_0x0167('0x15')](_0x0167('0x17'),_0x124763['message'],_0xc3f9fe);_0x3cd14f(_0x45dfe1['error'](0x1f4,_0x124763[_0x0167('0x16')]));});});};exports['ShowMailAccount']=function(_0x4b42a2){var _0x4a4b87=this;return new Promise(function(_0x10fd32,_0x178803){return db[_0x0167('0x18')][_0x0167('0x21')]({'raw':_0x4b42a2[_0x0167('0x1a')]?_0x4b42a2[_0x0167('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x4b42a2['options']?_0x4b42a2[_0x0167('0x1a')][_0x0167('0x1b')]||null:null,'attributes':_0x4b42a2[_0x0167('0x1a')]?_0x4b42a2[_0x0167('0x1a')][_0x0167('0x1c')]||null:null,'include':_0x4b42a2[_0x0167('0x1a')]?_0x4b42a2['options'][_0x0167('0x1d')]?_['map'](_0x4b42a2['options'][_0x0167('0x1d')],function(_0x140130){return{'model':db[_0x140130[_0x0167('0x1f')]],'as':_0x140130['as'],'attributes':_0x140130['attributes'],'include':_0x140130[_0x0167('0x1d')]?_[_0x0167('0x1e')](_0x140130[_0x0167('0x1d')],function(_0xb0cc5c){return{'model':db[_0xb0cc5c['model']],'as':_0xb0cc5c['as'],'attributes':_0xb0cc5c[_0x0167('0x1c')],'include':_0xb0cc5c[_0x0167('0x1d')]?_[_0x0167('0x1e')](_0xb0cc5c['include'],function(_0x2ba723){return{'model':db[_0x2ba723[_0x0167('0x1f')]],'as':_0x2ba723['as'],'attributes':_0x2ba723[_0x0167('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x0167('0xe')](function(_0x3abff6){if(_0x4b42a2['options'][_0x0167('0x22')]===!![])_0x3abff6[_0x0167('0x23')]('smtpOptions',_0x3abff6[_0x0167('0x24')]());logger[_0x0167('0xf')](_0x0167('0x25'),_0x4b42a2);logger[_0x0167('0x12')](_0x0167('0x25'),_0x4b42a2,JSON[_0x0167('0x14')](_0x3abff6));_0x10fd32(_0x3abff6);})['catch'](function(_0x298bcc){logger[_0x0167('0x15')](_0x0167('0x25'),_0x298bcc[_0x0167('0x16')],_0x4b42a2);_0x178803(_0x4a4b87['error'](0x1f4,_0x298bcc[_0x0167('0x16')]));});});};exports[_0x0167('0x26')]=function(_0x599caf){var _0x18de15=this;return new Promise(function(_0x3c393a,_0x3a22f7){var _0x4aec07={'body':_0x599caf[_0x0167('0x27')],'channel':_0x0167('0x28')};var _0x2b56d6=_[_0x0167('0x29')](_[_0x0167('0x2a')](db[_0x0167('0x2b')][_0x0167('0x2c')]),[_0x0167('0x2d'),'updatedAt',_0x0167('0x2e'),'ListId']);var _0x45f0d5=![];if(_0x599caf[_0x0167('0x27')]['id']){delete _0x599caf[_0x0167('0x27')]['id'];}if(_['isNil'](_0x599caf['body']['from'])){return _0x3a22f7(_0x18de15[_0x0167('0x15')](0x1f4,_0x0167('0x2f')));}if(_[_0x0167('0x30')](_0x599caf[_0x0167('0x27')][_0x0167('0x27')])||_0x599caf[_0x0167('0x27')]['body']===''){return _0x3a22f7(_0x18de15['error'](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x0167('0x30')](_0x599caf['body'][_0x0167('0x31')])){return _0x3a22f7(_0x18de15[_0x0167('0x15')](0x1f4,_0x0167('0x32')+_0x2b56d6));}if(!_[_0x0167('0x33')](_0x2b56d6,_0x599caf['body'][_0x0167('0x31')])){return _0x3a22f7(_0x18de15[_0x0167('0x15')](0x1f4,_0x0167('0x34')+_0x2b56d6));}var _0x431cb7={};_0x431cb7[_0x599caf[_0x0167('0x27')][_0x0167('0x31')]]=_0x599caf[_0x0167('0x27')][_0x0167('0x35')];return db[_0x0167('0x18')][_0x0167('0x21')]({'where':{'id':_0x599caf['account']['id']},'include':[{'model':db['CmList'],'as':_0x0167('0x36'),'include':[{'model':db['CmContact'],'as':_0x0167('0x37'),'where':_0x431cb7,'limit':0x1,'order':[['updatedAt',_0x0167('0x38')]]}]},{'model':db['MailApplication'],'as':_0x0167('0x39')},{'model':db[_0x0167('0x3a')],'as':'Smtp','include':[{'model':db['CloudProvider'],'as':'CloudProvider'}]}]})[_0x0167('0xe')](function(_0x55aaa0){if(_0x55aaa0&&_0x55aaa0['List']){var _0x18d29d=_0x55aaa0['get']({'plain':!![]});_0x4aec07[_0x0167('0x3b')]=_[_0x0167('0x3c')](_0x18d29d,[_0x0167('0x39'),'List']);_0x4aec07[_0x0167('0x3b')]['smtpOptions']=_0x55aaa0['getSmtpOptions']();_0x4aec07['applications']=_0x18d29d[_0x0167('0x39')];_0x4aec07[_0x0167('0x3d')]=_0x18d29d[_0x0167('0x36')];_0x4aec07[_0x0167('0x3e')]=_[_0x0167('0x3f')](_0x4aec07['applications'],[_0x0167('0x40')],[_0x0167('0x41')]);if(_0x4aec07[_0x0167('0x3b')]&&_0x4aec07[_0x0167('0x3b')]['autoclose']){_0x4aec07['applications'][_0x0167('0x42')]({'id':0x0,'priority':_0x4aec07['applications'][_0x0167('0x43')]+0x1,'app':_0x0167('0x44'),'appdata':_0x0167('0x45'),'interval':_0x0167('0x46')});}if(_0x4aec07[_0x0167('0x3b')][_0x0167('0x39')]){delete _0x4aec07[_0x0167('0x3b')][_0x0167('0x39')];}if(_0x4aec07[_0x0167('0x3b')][_0x0167('0x36')]){delete _0x4aec07['account']['List'];}if(_0x18d29d[_0x0167('0x36')]['Contacts'][_0x0167('0x43')]){return _0x18d29d[_0x0167('0x36')]['Contacts'][0x0];}var _0xb31427=_[_0x0167('0x9')](_0x599caf['body'],{'firstName':_0x599caf[_0x0167('0x27')][_0x0167('0x35')],'ListId':_0x18d29d[_0x0167('0x47')]});_0xb31427[_0x599caf[_0x0167('0x27')]['mapKey']]=_0x599caf[_0x0167('0x27')][_0x0167('0x35')];return db[_0x0167('0x2b')]['create'](_0xb31427);}else{throw new Error(_0x0167('0x48'));}})[_0x0167('0xe')](function(_0x423af6){_0x4aec07[_0x0167('0x49')]=_0x423af6;if(_0x423af6){if(!_0x599caf[_0x0167('0x27')][_0x0167('0x16')][_0x0167('0x4a')]){_0x599caf[_0x0167('0x27')][_0x0167('0x16')]['messageId']=rs[_0x0167('0x4b')]()+'\x20'+_0x599caf[_0x0167('0x27')][_0x0167('0x16')][_0x0167('0x35')];}var _0x15a544={'ContactId':_0x423af6['id'],'MailAccountId':_0x599caf[_0x0167('0x3b')]['id'],'inReplyTo':_0x599caf['body'][_0x0167('0x16')]['messageId'],'to':_0x599caf['body']['message'][_0x0167('0x35')],'cc':_0x599caf[_0x0167('0x27')][_0x0167('0x16')]['cc'],'subject':_0x599caf[_0x0167('0x27')][_0x0167('0x16')]['subject'],'attach':_0x599caf[_0x0167('0x27')][_0x0167('0x16')]['attach'],'lastMsgAt':moment()[_0x0167('0x4c')](_0x0167('0x4d')),'lastMsgDirection':'in'};return db[_0x0167('0x4e')][_0x0167('0x21')]({'where':{'closed':![],'MailAccountId':_0x599caf['account']['id']},'include':[{'model':db['MailMessage'],'as':_0x0167('0x4f'),'attributes':[_0x0167('0x4a')],'where':{'messageId':_0x599caf[_0x0167('0x27')][_0x0167('0x16')][_0x0167('0x50')]}}]})[_0x0167('0xe')](function(_0x8af33d){if(_0x8af33d){return[_0x8af33d,![]];}return db[_0x0167('0x4e')][_0x0167('0x51')](_0x15a544)[_0x0167('0xe')](function(_0x5ed240){return[_0x5ed240,!![]];});});}else{throw new Error(_0x0167('0x52'));}})[_0x0167('0x53')](function(_0x44fd93,_0x3cd485){if(_0x44fd93){_0x45f0d5=_0x3cd485;if(!_0x3cd485){return _0x44fd93[_0x0167('0x54')]({'inReplyTo':_0x599caf[_0x0167('0x27')][_0x0167('0x16')]['messageId'],'to':_0x599caf[_0x0167('0x27')][_0x0167('0x16')]['from'],'cc':_0x599caf[_0x0167('0x27')]['message']['cc'],'subject':_0x599caf[_0x0167('0x27')][_0x0167('0x16')][_0x0167('0x55')],'attach':_0x44fd93['attach']?_0x44fd93[_0x0167('0x56')]:_0x599caf[_0x0167('0x27')]['message'][_0x0167('0x56')],'substatus':null,'substatusAt':moment()['format'](_0x0167('0x4d')),'lastMsgAt':moment()['format'](_0x0167('0x4d')),'lastMsgDirection':'in'});}else{return _0x44fd93;}}})[_0x0167('0xe')](function(_0x50b6e9){_0x4aec07[_0x0167('0x57')]=_0x50b6e9[_0x0167('0x58')]({'plain':!![]});_0x4aec07[_0x0167('0x57')][_0x0167('0x59')]=_0x45f0d5;return db['MailMessage']['create']({'body':_0x599caf[_0x0167('0x27')][_0x0167('0x27')],'MailAccountId':_0x599caf[_0x0167('0x3b')]['id'],'MailInteractionId':_0x50b6e9['id'],'direction':'in','ContactId':_0x4aec07[_0x0167('0x49')]['id'],'messageId':_0x599caf['body'][_0x0167('0x16')]['messageId'],'from':_0x599caf[_0x0167('0x27')]['message']['from'],'to':_0x599caf[_0x0167('0x27')][_0x0167('0x16')]['to'],'cc':_0x599caf[_0x0167('0x27')][_0x0167('0x16')]['cc'],'subject':_0x599caf['body'][_0x0167('0x16')][_0x0167('0x55')],'attach':_0x599caf[_0x0167('0x27')][_0x0167('0x16')][_0x0167('0x56')],'Attachments':_0x599caf[_0x0167('0x27')][_0x0167('0x16')][_0x0167('0x5a')],'originTo':_0x599caf[_0x0167('0x27')]['message'][_0x0167('0x5b')],'originCc':_0x599caf['body'][_0x0167('0x16')][_0x0167('0x5c')],'bcc':_0x599caf['body']['message']['bcc'],'ChatWebsiteId':_0x599caf[_0x0167('0x27')][_0x0167('0x16')]['ChatWebsiteId']||null,'originChannel':_0x599caf['body'][_0x0167('0x16')][_0x0167('0x5d')]||'Email','ChatOfflineMessageId':_0x599caf[_0x0167('0x27')][_0x0167('0x16')][_0x0167('0x5e')]||null},{'include':[{'model':db[_0x0167('0x5f')],'as':_0x0167('0x60')}]});})[_0x0167('0xe')](function(_0x54a216){_0x4aec07[_0x0167('0x16')]=_0x54a216;if(!_0x4aec07[_0x0167('0x57')]['UserId']){return;}return db[_0x0167('0x61')][_0x0167('0x21')]({'attributes':['id',_0x0167('0x62')],'where':{'id':_0x4aec07[_0x0167('0x57')][_0x0167('0x63')]}});})['then'](function(_0x52bed0){if(_0x52bed0){_0x4aec07['applications'][_0x0167('0x64')]({'id':0x0,'priority':0x0,'app':_0x0167('0x65'),'appdata':_0x52bed0[_0x0167('0x62')]+','+(_0x4aec07[_0x0167('0x3b')][_0x0167('0x66')]||0xa),'interval':'*,*,*,*'});}if(!_0x4aec07[_0x0167('0x57')][_0x0167('0x67')]){return;}return db[_0x0167('0x68')][_0x0167('0x21')]({'attributes':['id',_0x0167('0x62')],'where':{'id':_0x4aec07[_0x0167('0x57')]['queueId']}});})['then'](function(_0x1690ff){if(_0x1690ff){_0x4aec07[_0x0167('0x3e')]['unshift']({'id':0x0,'priority':0x1,'app':_0x0167('0x69'),'appdata':_0x1690ff[_0x0167('0x62')]+','+(_0x4aec07[_0x0167('0x3b')][_0x0167('0x6a')]||0x12c),'interval':_0x0167('0x46')});}return respondWithRpcPromise(_0x0167('0x6b'),_0x0167('0x6c'),_0x4aec07);})[_0x0167('0xe')](function(_0x4ba0c4){_0x3c393a(_0x4ba0c4);})[_0x0167('0x20')](function(_0x1c3cb2){_0x3a22f7(_0x18de15[_0x0167('0x15')](0x1f4,_0x1c3cb2[_0x0167('0x16')]));});});}; \ No newline at end of file +var _0x8ca9=['autoclose','push','length','close','*,*,*,*','create','List\x20not\x20found','contact','messageId','generate','attach','MailInteraction','MailMessage','Messages','inReplyTo','Contact\x20not\x20found','spread','update','subject','format','YYYY-MM-DD\x20HH:mm:ss','interaction','created','attachments','originTo','bcc','Email','ChatOfflineMessageId','Attachments','UserId','User','name','unshift','agent','waitForTheAssignedAgent','queueId','MailQueue','queue','waitForTheAssignedQueue','Start','startRouting','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./mailAccount.socket','register','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMailAccount','MailAccount','findAll','raw','options','limit','include','map','model','attributes','debug','ShowMailAccount','find','where','setDataValue','smtpOptions','getSmtpOptions','NotifyMailAccount','body','mail','difference','keys','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','account','CmList','List','CmContact','Contacts','DESC','MailApplication','Applications','MailServerOut','CloudProvider','get','omit','list','applications','priority','asc'];(function(_0x2b2e8c,_0x54f172){var _0x4e8fac=function(_0x31dfce){while(--_0x31dfce){_0x2b2e8c['push'](_0x2b2e8c['shift']());}};_0x4e8fac(++_0x54f172);}(_0x8ca9,0x9c));var _0x98ca=function(_0x206206,_0x2048ef){_0x206206=_0x206206-0x0;var _0x4c5d93=_0x8ca9[_0x206206];return _0x4c5d93;};'use strict';var _=require(_0x98ca('0x0'));var moment=require(_0x98ca('0x1'));var BPromise=require(_0x98ca('0x2'));var rs=require(_0x98ca('0x3'));var Redis=require(_0x98ca('0x4'));var db=require(_0x98ca('0x5'))['db'];var logger=require(_0x98ca('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x98ca('0x7'));var client=jayson['client'][_0x98ca('0x8')]({'port':0x232c});config['redis']=_[_0x98ca('0x9')](config[_0x98ca('0xa')],{'host':_0x98ca('0xb'),'port':0x18eb});var socket=require(_0x98ca('0xc'))(new Redis(config[_0x98ca('0xa')]));require(_0x98ca('0xd'))[_0x98ca('0xe')](socket);function respondWithRpcPromise(_0x210234,_0x277c29,_0x404cc1){return new BPromise(function(_0x572858,_0x2074fb){return client[_0x98ca('0xf')](_0x210234,_0x404cc1)[_0x98ca('0x10')](function(_0x220a97){logger[_0x98ca('0x11')](_0x98ca('0x12'),_0x277c29,_0x98ca('0x13'));logger['debug'](_0x98ca('0x14'),_0x277c29,_0x98ca('0x13'),JSON[_0x98ca('0x15')](_0x220a97));if(_0x220a97[_0x98ca('0x16')]){if(_0x220a97['error'][_0x98ca('0x17')]===0x1f4){logger[_0x98ca('0x16')](_0x98ca('0x12'),_0x277c29,_0x220a97[_0x98ca('0x16')][_0x98ca('0x18')]);return _0x2074fb(_0x220a97[_0x98ca('0x16')][_0x98ca('0x18')]);}logger['error'](_0x98ca('0x12'),_0x277c29,_0x220a97[_0x98ca('0x16')][_0x98ca('0x18')]);return _0x572858(_0x220a97[_0x98ca('0x16')]['message']);}else{logger[_0x98ca('0x11')](_0x98ca('0x12'),_0x277c29,_0x98ca('0x13'));_0x572858(_0x220a97[_0x98ca('0x19')][_0x98ca('0x18')]);}})[_0x98ca('0x1a')](function(_0x28c8a6){logger[_0x98ca('0x16')](_0x98ca('0x12'),_0x277c29,_0x28c8a6);_0x2074fb(_0x28c8a6);});});}exports[_0x98ca('0x1b')]=function(_0x1b2c69){var _0x4806a3=this;return new Promise(function(_0x626b37,_0x49298d){return db[_0x98ca('0x1c')][_0x98ca('0x1d')]({'raw':_0x1b2c69['options']?_0x1b2c69['options'][_0x98ca('0x1e')]===undefined?!![]:![]:!![],'where':_0x1b2c69[_0x98ca('0x1f')]?_0x1b2c69[_0x98ca('0x1f')]['where']||null:null,'attributes':_0x1b2c69[_0x98ca('0x1f')]?_0x1b2c69[_0x98ca('0x1f')]['attributes']||null:null,'limit':_0x1b2c69[_0x98ca('0x1f')]?_0x1b2c69['options'][_0x98ca('0x20')]||null:null,'include':_0x1b2c69[_0x98ca('0x1f')]?_0x1b2c69[_0x98ca('0x1f')][_0x98ca('0x21')]?_[_0x98ca('0x22')](_0x1b2c69[_0x98ca('0x1f')][_0x98ca('0x21')],function(_0x50b1a2){return{'model':db[_0x50b1a2[_0x98ca('0x23')]],'as':_0x50b1a2['as'],'attributes':_0x50b1a2['attributes'],'include':_0x50b1a2[_0x98ca('0x21')]?_[_0x98ca('0x22')](_0x50b1a2['include'],function(_0x1f569b){return{'model':db[_0x1f569b['model']],'as':_0x1f569b['as'],'attributes':_0x1f569b[_0x98ca('0x24')],'include':_0x1f569b['include']?_['map'](_0x1f569b[_0x98ca('0x21')],function(_0x540f45){return{'model':db[_0x540f45[_0x98ca('0x23')]],'as':_0x540f45['as'],'attributes':_0x540f45[_0x98ca('0x24')]};}):[]};}):[]};}):[]:[]})[_0x98ca('0x10')](function(_0x21a12a){logger[_0x98ca('0x11')](_0x98ca('0x1b'),_0x1b2c69);logger[_0x98ca('0x25')](_0x98ca('0x1b'),_0x1b2c69,JSON[_0x98ca('0x15')](_0x21a12a));_0x626b37(_0x21a12a);})['catch'](function(_0x2ebf28){logger['error'](_0x98ca('0x1b'),_0x2ebf28[_0x98ca('0x18')],_0x1b2c69);_0x49298d(_0x4806a3['error'](0x1f4,_0x2ebf28['message']));});});};exports[_0x98ca('0x26')]=function(_0x4b37b4){var _0x3990d7=this;return new Promise(function(_0x4f1622,_0x2aaf39){return db['MailAccount'][_0x98ca('0x27')]({'raw':_0x4b37b4[_0x98ca('0x1f')]?_0x4b37b4['options'][_0x98ca('0x1e')]===undefined?!![]:![]:!![],'where':_0x4b37b4[_0x98ca('0x1f')]?_0x4b37b4['options'][_0x98ca('0x28')]||null:null,'attributes':_0x4b37b4[_0x98ca('0x1f')]?_0x4b37b4['options'][_0x98ca('0x24')]||null:null,'include':_0x4b37b4[_0x98ca('0x1f')]?_0x4b37b4[_0x98ca('0x1f')][_0x98ca('0x21')]?_[_0x98ca('0x22')](_0x4b37b4['options'][_0x98ca('0x21')],function(_0x430a37){return{'model':db[_0x430a37['model']],'as':_0x430a37['as'],'attributes':_0x430a37[_0x98ca('0x24')],'include':_0x430a37[_0x98ca('0x21')]?_[_0x98ca('0x22')](_0x430a37['include'],function(_0x1ef3ff){return{'model':db[_0x1ef3ff[_0x98ca('0x23')]],'as':_0x1ef3ff['as'],'attributes':_0x1ef3ff[_0x98ca('0x24')],'include':_0x1ef3ff['include']?_[_0x98ca('0x22')](_0x1ef3ff[_0x98ca('0x21')],function(_0x10cbe0){return{'model':db[_0x10cbe0['model']],'as':_0x10cbe0['as'],'attributes':_0x10cbe0['attributes']};}):[]};}):[]};}):[]:[]})[_0x98ca('0x10')](function(_0xe77d02){if(_0x4b37b4[_0x98ca('0x1f')]['smtp']===!![])_0xe77d02[_0x98ca('0x29')](_0x98ca('0x2a'),_0xe77d02[_0x98ca('0x2b')]());logger['info'](_0x98ca('0x26'),_0x4b37b4);logger[_0x98ca('0x25')](_0x98ca('0x26'),_0x4b37b4,JSON[_0x98ca('0x15')](_0xe77d02));_0x4f1622(_0xe77d02);})[_0x98ca('0x1a')](function(_0x5d924c){logger['error']('ShowMailAccount',_0x5d924c[_0x98ca('0x18')],_0x4b37b4);_0x2aaf39(_0x3990d7[_0x98ca('0x16')](0x1f4,_0x5d924c[_0x98ca('0x18')]));});});};exports[_0x98ca('0x2c')]=function(_0x43ba26){var _0xda0db1=this;return new Promise(function(_0x29801f,_0x570afe){var _0x4900ed={'body':_0x43ba26[_0x98ca('0x2d')],'channel':_0x98ca('0x2e')};var _0x31424f=_[_0x98ca('0x2f')](_[_0x98ca('0x30')](db['CmContact']['rawAttributes']),['createdAt',_0x98ca('0x31'),_0x98ca('0x32'),_0x98ca('0x33')]);var _0x3f260b=![];if(_0x43ba26['body']['id']){delete _0x43ba26['body']['id'];}if(_[_0x98ca('0x34')](_0x43ba26[_0x98ca('0x2d')][_0x98ca('0x35')])){return _0x570afe(_0xda0db1[_0x98ca('0x16')](0x1f4,_0x98ca('0x36')));}if(_[_0x98ca('0x34')](_0x43ba26[_0x98ca('0x2d')][_0x98ca('0x2d')])||_0x43ba26[_0x98ca('0x2d')][_0x98ca('0x2d')]===''){return _0x570afe(_0xda0db1[_0x98ca('0x16')](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x98ca('0x34')](_0x43ba26[_0x98ca('0x2d')][_0x98ca('0x37')])){return _0x570afe(_0xda0db1[_0x98ca('0x16')](0x1f4,_0x98ca('0x38')+_0x31424f));}if(!_[_0x98ca('0x39')](_0x31424f,_0x43ba26[_0x98ca('0x2d')][_0x98ca('0x37')])){return _0x570afe(_0xda0db1[_0x98ca('0x16')](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x31424f));}var _0x2a4d0a={};_0x2a4d0a[_0x43ba26[_0x98ca('0x2d')]['mapKey']]=_0x43ba26[_0x98ca('0x2d')]['from'];return db[_0x98ca('0x1c')][_0x98ca('0x27')]({'where':{'id':_0x43ba26[_0x98ca('0x3a')]['id']},'include':[{'model':db[_0x98ca('0x3b')],'as':_0x98ca('0x3c'),'include':[{'model':db[_0x98ca('0x3d')],'as':_0x98ca('0x3e'),'where':_0x2a4d0a,'limit':0x1,'order':[[_0x98ca('0x31'),_0x98ca('0x3f')]]}]},{'model':db[_0x98ca('0x40')],'as':_0x98ca('0x41')},{'model':db[_0x98ca('0x42')],'as':'Smtp','include':[{'model':db[_0x98ca('0x43')],'as':_0x98ca('0x43')}]}]})[_0x98ca('0x10')](function(_0x19dc39){if(_0x19dc39&&_0x19dc39['List']){var _0xec9f92=_0x19dc39[_0x98ca('0x44')]({'plain':!![]});_0x4900ed[_0x98ca('0x3a')]=_[_0x98ca('0x45')](_0xec9f92,[_0x98ca('0x41'),_0x98ca('0x3c')]);_0x4900ed[_0x98ca('0x3a')]['smtpOptions']=_0x19dc39['getSmtpOptions']();_0x4900ed['applications']=_0xec9f92[_0x98ca('0x41')];_0x4900ed[_0x98ca('0x46')]=_0xec9f92[_0x98ca('0x3c')];_0x4900ed[_0x98ca('0x47')]=_['orderBy'](_0x4900ed['applications'],[_0x98ca('0x48')],[_0x98ca('0x49')]);if(_0x4900ed[_0x98ca('0x3a')]&&_0x4900ed[_0x98ca('0x3a')][_0x98ca('0x4a')]){_0x4900ed[_0x98ca('0x47')][_0x98ca('0x4b')]({'id':0x0,'priority':_0x4900ed[_0x98ca('0x47')][_0x98ca('0x4c')]+0x1,'app':_0x98ca('0x4d'),'appdata':_0x98ca('0x4a'),'interval':_0x98ca('0x4e')});}if(_0x4900ed[_0x98ca('0x3a')]['Applications']){delete _0x4900ed[_0x98ca('0x3a')]['Applications'];}if(_0x4900ed[_0x98ca('0x3a')][_0x98ca('0x3c')]){delete _0x4900ed[_0x98ca('0x3a')][_0x98ca('0x3c')];}if(_0xec9f92[_0x98ca('0x3c')]['Contacts'][_0x98ca('0x4c')]){return _0xec9f92[_0x98ca('0x3c')]['Contacts'][0x0];}var _0x19473e=_[_0x98ca('0x9')](_0x43ba26[_0x98ca('0x2d')],{'firstName':_0x43ba26['body'][_0x98ca('0x35')],'ListId':_0xec9f92[_0x98ca('0x33')]});_0x19473e[_0x43ba26['body'][_0x98ca('0x37')]]=_0x43ba26[_0x98ca('0x2d')][_0x98ca('0x35')];return db[_0x98ca('0x3d')][_0x98ca('0x4f')](_0x19473e);}else{throw new Error(_0x98ca('0x50'));}})[_0x98ca('0x10')](function(_0x594d82){_0x4900ed[_0x98ca('0x51')]=_0x594d82;if(_0x594d82){if(!_0x43ba26[_0x98ca('0x2d')][_0x98ca('0x18')]['messageId']){_0x43ba26['body'][_0x98ca('0x18')][_0x98ca('0x52')]=rs[_0x98ca('0x53')]()+'\x20'+_0x43ba26[_0x98ca('0x2d')][_0x98ca('0x18')][_0x98ca('0x35')];}var _0x3dc32e={'ContactId':_0x594d82['id'],'MailAccountId':_0x43ba26[_0x98ca('0x3a')]['id'],'inReplyTo':_0x43ba26['body'][_0x98ca('0x18')]['messageId'],'to':_0x43ba26['body'][_0x98ca('0x18')][_0x98ca('0x35')],'cc':_0x43ba26[_0x98ca('0x2d')][_0x98ca('0x18')]['cc'],'subject':_0x43ba26[_0x98ca('0x2d')][_0x98ca('0x18')]['subject'],'attach':_0x43ba26[_0x98ca('0x2d')][_0x98ca('0x18')][_0x98ca('0x54')],'lastMsgAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'};return db[_0x98ca('0x55')][_0x98ca('0x27')]({'where':{'closed':![],'MailAccountId':_0x43ba26[_0x98ca('0x3a')]['id']},'include':[{'model':db[_0x98ca('0x56')],'as':_0x98ca('0x57'),'attributes':[_0x98ca('0x52')],'where':{'messageId':_0x43ba26[_0x98ca('0x2d')][_0x98ca('0x18')][_0x98ca('0x58')]}}]})[_0x98ca('0x10')](function(_0x40c799){if(_0x40c799){return[_0x40c799,![]];}return db[_0x98ca('0x55')]['create'](_0x3dc32e)[_0x98ca('0x10')](function(_0xb7b30e){return[_0xb7b30e,!![]];});});}else{throw new Error(_0x98ca('0x59'));}})[_0x98ca('0x5a')](function(_0x1082f4,_0x23344b){if(_0x1082f4){_0x3f260b=_0x23344b;if(!_0x23344b){return _0x1082f4[_0x98ca('0x5b')]({'inReplyTo':_0x43ba26[_0x98ca('0x2d')][_0x98ca('0x18')]['messageId'],'to':_0x43ba26[_0x98ca('0x2d')][_0x98ca('0x18')][_0x98ca('0x35')],'cc':_0x43ba26['body'][_0x98ca('0x18')]['cc'],'subject':_0x43ba26[_0x98ca('0x2d')][_0x98ca('0x18')][_0x98ca('0x5c')],'attach':_0x1082f4[_0x98ca('0x54')]?_0x1082f4['attach']:_0x43ba26[_0x98ca('0x2d')][_0x98ca('0x18')]['attach'],'substatus':null,'substatusAt':moment()[_0x98ca('0x5d')](_0x98ca('0x5e')),'lastMsgAt':moment()[_0x98ca('0x5d')](_0x98ca('0x5e')),'lastMsgDirection':'in'});}else{return _0x1082f4;}}})[_0x98ca('0x10')](function(_0x20fcc9){_0x4900ed['interaction']=_0x20fcc9[_0x98ca('0x44')]({'plain':!![]});_0x4900ed[_0x98ca('0x5f')][_0x98ca('0x60')]=_0x3f260b;return db[_0x98ca('0x56')]['create']({'body':_0x43ba26[_0x98ca('0x2d')][_0x98ca('0x2d')],'MailAccountId':_0x43ba26['account']['id'],'MailInteractionId':_0x20fcc9['id'],'direction':'in','ContactId':_0x4900ed[_0x98ca('0x51')]['id'],'messageId':_0x43ba26[_0x98ca('0x2d')]['message'][_0x98ca('0x52')],'from':_0x43ba26[_0x98ca('0x2d')][_0x98ca('0x18')][_0x98ca('0x35')],'to':_0x43ba26[_0x98ca('0x2d')][_0x98ca('0x18')]['to'],'cc':_0x43ba26['body'][_0x98ca('0x18')]['cc'],'subject':_0x43ba26[_0x98ca('0x2d')][_0x98ca('0x18')][_0x98ca('0x5c')],'attach':_0x43ba26[_0x98ca('0x2d')][_0x98ca('0x18')][_0x98ca('0x54')],'Attachments':_0x43ba26['body'][_0x98ca('0x18')][_0x98ca('0x61')],'originTo':_0x43ba26[_0x98ca('0x2d')]['message'][_0x98ca('0x62')],'originCc':_0x43ba26[_0x98ca('0x2d')][_0x98ca('0x18')]['originCc'],'bcc':_0x43ba26[_0x98ca('0x2d')][_0x98ca('0x18')][_0x98ca('0x63')],'ChatWebsiteId':_0x43ba26[_0x98ca('0x2d')][_0x98ca('0x18')]['ChatWebsiteId']||null,'originChannel':_0x43ba26['body'][_0x98ca('0x18')]['originChannel']||_0x98ca('0x64'),'ChatOfflineMessageId':_0x43ba26[_0x98ca('0x2d')][_0x98ca('0x18')][_0x98ca('0x65')]||null},{'include':[{'model':db['Attachment'],'as':_0x98ca('0x66')}]});})[_0x98ca('0x10')](function(_0x55c8c3){_0x4900ed[_0x98ca('0x18')]=_0x55c8c3;if(!_0x4900ed[_0x98ca('0x5f')][_0x98ca('0x67')]){return;}return db[_0x98ca('0x68')][_0x98ca('0x27')]({'attributes':['id',_0x98ca('0x69')],'where':{'id':_0x4900ed[_0x98ca('0x5f')][_0x98ca('0x67')]}});})[_0x98ca('0x10')](function(_0x13114b){if(_0x13114b){_0x4900ed[_0x98ca('0x47')][_0x98ca('0x6a')]({'id':0x0,'priority':0x0,'app':_0x98ca('0x6b'),'appdata':_0x13114b[_0x98ca('0x69')]+','+(_0x4900ed[_0x98ca('0x3a')][_0x98ca('0x6c')]||0xa),'interval':_0x98ca('0x4e')});}if(!_0x4900ed[_0x98ca('0x5f')][_0x98ca('0x6d')]){return;}return db[_0x98ca('0x6e')][_0x98ca('0x27')]({'attributes':['id','name'],'where':{'id':_0x4900ed[_0x98ca('0x5f')][_0x98ca('0x6d')]}});})['then'](function(_0x34c7b7){if(_0x34c7b7){_0x4900ed[_0x98ca('0x47')]['unshift']({'id':0x0,'priority':0x1,'app':_0x98ca('0x6f'),'appdata':_0x34c7b7['name']+','+(_0x4900ed[_0x98ca('0x3a')][_0x98ca('0x70')]||0x12c),'interval':_0x98ca('0x4e')});}return respondWithRpcPromise(_0x98ca('0x71'),_0x98ca('0x72'),_0x4900ed);})['then'](function(_0x54975d){_0x29801f(_0x54975d);})[_0x98ca('0x1a')](function(_0x3f1057){_0x570afe(_0xda0db1[_0x98ca('0x16')](0x1f4,_0x3f1057[_0x98ca('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 8383866..2c28277 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 _0xb65a=['./mailAccount.events','update','removeListener','mailAccount:'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xb65a,0x114));var _0xab65=function(_0x3edcf7,_0x12f8f0){_0x3edcf7=_0x3edcf7-0x0;var _0x4d1519=_0xb65a[_0x3edcf7];return _0x4d1519;};'use strict';var MailAccountEvents=require(_0xab65('0x0'));var events=['save','remove',_0xab65('0x1')];function createListener(_0xfd7fe6,_0x1c1c2f){return function(_0x50534e){_0x1c1c2f['emit'](_0xfd7fe6,_0x50534e);};}function removeListener(_0x6ba738,_0x39447c){return function(){MailAccountEvents[_0xab65('0x2')](_0x6ba738,_0x39447c);};}exports['register']=function(_0x1bda21){for(var _0x4dabba=0x0,_0x59e069=events['length'];_0x4dabba<_0x59e069;_0x4dabba++){var _0x2d1cf1=events[_0x4dabba];var _0x2c3f48=createListener(_0xab65('0x3')+_0x2d1cf1,_0x1bda21);MailAccountEvents['on'](_0x2d1cf1,_0x2c3f48);}}; \ No newline at end of file +var _0x3441=['mailAccount:','./mailAccount.events','update','emit','removeListener','length'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x3441,0x14b));var _0x1344=function(_0x304320,_0x232a69){_0x304320=_0x304320-0x0;var _0xe607da=_0x3441[_0x304320];return _0xe607da;};'use strict';var MailAccountEvents=require(_0x1344('0x0'));var events=['save','remove',_0x1344('0x1')];function createListener(_0x41959b,_0x484761){return function(_0x129aad){_0x484761[_0x1344('0x2')](_0x41959b,_0x129aad);};}function removeListener(_0x582e4e,_0x4df2ef){return function(){MailAccountEvents[_0x1344('0x3')](_0x582e4e,_0x4df2ef);};}exports['register']=function(_0x2b6f30){for(var _0x452819=0x0,_0x258e25=events[_0x1344('0x4')];_0x452819<_0x258e25;_0x452819++){var _0x5a127c=events[_0x452819];var _0x4c19b7=createListener(_0x1344('0x5')+_0x5a127c,_0x2b6f30);MailAccountEvents['on'](_0x5a127c,_0x4c19b7);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 6263142..7f86766 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 _0x9a83=['destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','/:id','show','put','isAuthenticated','update','delete'];(function(_0x3be12f,_0x437488){var _0x1a16d9=function(_0x572600){while(--_0x572600){_0x3be12f['push'](_0x3be12f['shift']());}};_0x1a16d9(++_0x437488);}(_0x9a83,0x152));var _0x39a8=function(_0x1440ce,_0x136aee){_0x1440ce=_0x1440ce-0x0;var _0x389c35=_0x9a83[_0x1440ce];return _0x389c35;};'use strict';var multer=require(_0x39a8('0x0'));var util=require(_0x39a8('0x1'));var path=require('path');var timeout=require(_0x39a8('0x2'));var express=require(_0x39a8('0x3'));var router=express[_0x39a8('0x4')]();var fs_extra=require(_0x39a8('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x39a8('0x6'));var config=require(_0x39a8('0x7'));var controller=require('./mailApplication.controller');router['get'](_0x39a8('0x8'),auth['isAuthenticated'](),controller[_0x39a8('0x9')]);router[_0x39a8('0xa')](_0x39a8('0x8'),auth[_0x39a8('0xb')](),controller[_0x39a8('0xc')]);router[_0x39a8('0xd')](_0x39a8('0x8'),auth[_0x39a8('0xb')](),controller[_0x39a8('0xe')]);module[_0x39a8('0xf')]=router; \ No newline at end of file +var _0x9f7a=['./mailApplication.controller','/:id','show','put','update','isAuthenticated','exports','multer','util','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x934754,_0x15bd40){var _0x5cf1fc=function(_0x2c1de6){while(--_0x2c1de6){_0x934754['push'](_0x934754['shift']());}};_0x5cf1fc(++_0x15bd40);}(_0x9f7a,0x10b));var _0xa9f7=function(_0x42bc91,_0x41f40a){_0x42bc91=_0x42bc91-0x0;var _0x3f5507=_0x9f7a[_0x42bc91];return _0x3f5507;};'use strict';var multer=require(_0xa9f7('0x0'));var util=require(_0xa9f7('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa9f7('0x2')]();var fs_extra=require(_0xa9f7('0x3'));var auth=require(_0xa9f7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xa9f7('0x5'));var controller=require(_0xa9f7('0x6'));router['get'](_0xa9f7('0x7'),auth['isAuthenticated'](),controller[_0xa9f7('0x8')]);router[_0xa9f7('0x9')](_0xa9f7('0x7'),auth['isAuthenticated'](),controller[_0xa9f7('0xa')]);router['delete'](_0xa9f7('0x7'),auth[_0xa9f7('0xb')](),controller['destroy']);module[_0xa9f7('0xc')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 649f2dd..61d556c 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 _0xe00e=['*,*,*,*','sequelize','exports','noop','TEXT'];(function(_0x4333c0,_0x1b8b7d){var _0x1ea60b=function(_0x36a1ea){while(--_0x36a1ea){_0x4333c0['push'](_0x4333c0['shift']());}};_0x1ea60b(++_0x1b8b7d);}(_0xe00e,0x65));var _0xee00=function(_0x3e4712,_0x2a8be3){_0x3e4712=_0x3e4712-0x0;var _0x240683=_0xe00e[_0x3e4712];return _0x240683;};'use strict';var Sequelize=require(_0xee00('0x0'));module[_0xee00('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xee00('0x2')},'appdata':{'type':Sequelize[_0xee00('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xee00('0x4')}}; \ No newline at end of file +var _0x0bb2=['INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize','exports'];(function(_0x555848,_0x2e1da5){var _0x1f607b=function(_0x4277de){while(--_0x4277de){_0x555848['push'](_0x555848['shift']());}};_0x1f607b(++_0x2e1da5);}(_0x0bb2,0x108));var _0x20bb=function(_0x3d29dd,_0x3aa4d4){_0x3d29dd=_0x3d29dd-0x0;var _0x4d38d9=_0x0bb2[_0x3d29dd];return _0x4d38d9;};'use strict';var Sequelize=require(_0x20bb('0x0'));module[_0x20bb('0x1')]={'priority':{'type':Sequelize[_0x20bb('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x20bb('0x3')],'allowNull':![],'defaultValue':_0x20bb('0x4')},'appdata':{'type':Sequelize[_0x20bb('0x5')]()},'description':{'type':Sequelize[_0x20bb('0x3')]},'interval':{'type':Sequelize[_0x20bb('0x3')],'defaultValue':_0x20bb('0x6')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 6146aed..0254861 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 _0x70e0=['util','sox','ejs','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','count','limit','set','apply','save','update','then','error','stack','name','send','show','model','keys','MailApplication','query','filters','attributes','intersection','length','includeAll','include','find','catch','body','params','eml-format','rimraf','zip-dir','moment','bluebird','mustache'];(function(_0x535e1e,_0x2b3930){var _0x5161d2=function(_0x4296ba){while(--_0x4296ba){_0x535e1e['push'](_0x535e1e['shift']());}};_0x5161d2(++_0x2b3930);}(_0x70e0,0x17b));var _0x070e=function(_0x73d5a3,_0x18012d){_0x73d5a3=_0x73d5a3-0x0;var _0x560ac1=_0x70e0[_0x73d5a3];return _0x560ac1;};'use strict';var emlformat=require(_0x070e('0x0'));var rimraf=require(_0x070e('0x1'));var zipdir=require(_0x070e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x070e('0x3'));var BPromise=require(_0x070e('0x4'));var Mustache=require(_0x070e('0x5'));var util=require(_0x070e('0x6'));var path=require('path');var sox=require(_0x070e('0x7'));var csv=require('to-csv');var ejs=require(_0x070e('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x070e('0x9'));var jsforce=require(_0x070e('0xa'));var deskjs=require(_0x070e('0xb'));var toCsv=require(_0x070e('0xc'));var querystring=require(_0x070e('0xd'));var Papa=require(_0x070e('0xe'));var Redis=require(_0x070e('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x070e('0x10'));var hardwareService=require(_0x070e('0x11'));var logger=require(_0x070e('0x12'))(_0x070e('0x13'));var utils=require(_0x070e('0x14'));var config=require(_0x070e('0x15'));var licenseUtil=require(_0x070e('0x16'));var db=require(_0x070e('0x17'))['db'];function respondWithStatusCode(_0x39d2b9,_0x5bf079){_0x5bf079=_0x5bf079||0xcc;return function(_0x2930b8){if(_0x2930b8){return _0x39d2b9['sendStatus'](_0x5bf079);}return _0x39d2b9['status'](_0x5bf079)[_0x070e('0x18')]();};}function respondWithResult(_0x56c7ba,_0x4a33d2){_0x4a33d2=_0x4a33d2||0xc8;return function(_0x5bae0f){if(_0x5bae0f){return _0x56c7ba[_0x070e('0x19')](_0x4a33d2)[_0x070e('0x1a')](_0x5bae0f);}};}function respondWithFilteredResult(_0x51d14d,_0x5d3a38){return function(_0x373d86){if(_0x373d86){var _0xeae1a5=typeof _0x5d3a38[_0x070e('0x1b')]===_0x070e('0x1c')&&typeof _0x5d3a38['limit']==='undefined';var _0x17e2e4=_0x373d86[_0x070e('0x1d')];var _0x38f6e6=_0xeae1a5?0x0:_0x5d3a38[_0x070e('0x1b')];var _0x364b3f=_0xeae1a5?_0x373d86['count']:_0x5d3a38[_0x070e('0x1b')]+_0x5d3a38[_0x070e('0x1e')];var _0x1ad3de;if(_0x364b3f>=_0x17e2e4){_0x364b3f=_0x17e2e4;_0x1ad3de=0xc8;}else{_0x1ad3de=0xce;}_0x51d14d[_0x070e('0x19')](_0x1ad3de);return _0x51d14d[_0x070e('0x1f')]('Content-Range',_0x38f6e6+'-'+_0x364b3f+'/'+_0x17e2e4)['json'](_0x373d86);}return null;};}function patchUpdates(_0x4e958f){return function(_0x9907cf){try{jsonpatch[_0x070e('0x20')](_0x9907cf,_0x4e958f,!![]);}catch(_0x20dc60){return BPromise['reject'](_0x20dc60);}return _0x9907cf[_0x070e('0x21')]();};}function saveUpdates(_0x5dc5d2,_0xf8dd5d){return function(_0x3f6985){if(_0x3f6985){return _0x3f6985[_0x070e('0x22')](_0x5dc5d2)[_0x070e('0x23')](function(_0x28a1c3){return _0x28a1c3;});}return null;};}function removeEntity(_0xa86797,_0xe405e){return function(_0x164cdf){if(_0x164cdf){return _0x164cdf['destroy']()[_0x070e('0x23')](function(){_0xa86797[_0x070e('0x19')](0xcc)[_0x070e('0x18')]();});}};}function handleEntityNotFound(_0x503f4d,_0xf17c56){return function(_0x5f3e9d){if(!_0x5f3e9d){_0x503f4d['sendStatus'](0x194);}return _0x5f3e9d;};}function handleError(_0x2ccbd7,_0x25f6e){_0x25f6e=_0x25f6e||0x1f4;return function(_0x41deb1){logger[_0x070e('0x24')](_0x41deb1[_0x070e('0x25')]);if(_0x41deb1['name']){delete _0x41deb1[_0x070e('0x26')];}_0x2ccbd7[_0x070e('0x19')](_0x25f6e)[_0x070e('0x27')](_0x41deb1);};}exports[_0x070e('0x28')]=function(_0x43dd96,_0x28d7f2){var _0x1a1892={'raw':!![],'where':{'id':_0x43dd96['params']['id']}},_0x26373b={};_0x26373b[_0x070e('0x29')]=_[_0x070e('0x2a')](db[_0x070e('0x2b')]['rawAttributes']);_0x26373b['query']=_[_0x070e('0x2a')](_0x43dd96[_0x070e('0x2c')]);_0x26373b[_0x070e('0x2d')]=_['intersection'](_0x26373b[_0x070e('0x29')],_0x26373b[_0x070e('0x2c')]);_0x1a1892[_0x070e('0x2e')]=_[_0x070e('0x2f')](_0x26373b['model'],qs['fields'](_0x43dd96['query']['fields']));_0x1a1892[_0x070e('0x2e')]=_0x1a1892['attributes'][_0x070e('0x30')]?_0x1a1892[_0x070e('0x2e')]:_0x26373b['model'];if(_0x43dd96['query'][_0x070e('0x31')]){_0x1a1892[_0x070e('0x32')]=[{'all':!![]}];}_0x1a1892=_['merge']({},_0x1a1892,_0x43dd96['options']);return db[_0x070e('0x2b')][_0x070e('0x33')](_0x1a1892)[_0x070e('0x23')](handleEntityNotFound(_0x28d7f2,null))[_0x070e('0x23')](respondWithResult(_0x28d7f2,null))[_0x070e('0x34')](handleError(_0x28d7f2,null));};exports['update']=function(_0x482cc2,_0x24d17d){if(_0x482cc2[_0x070e('0x35')]['id']){delete _0x482cc2[_0x070e('0x35')]['id'];}return db[_0x070e('0x2b')][_0x070e('0x33')]({'where':{'id':_0x482cc2['params']['id']}})[_0x070e('0x23')](handleEntityNotFound(_0x24d17d,null))[_0x070e('0x23')](saveUpdates(_0x482cc2['body'],null))[_0x070e('0x23')](respondWithResult(_0x24d17d,null))[_0x070e('0x34')](handleError(_0x24d17d,null));};exports['destroy']=function(_0x4d4ee8,_0x5ddbe9){return db[_0x070e('0x2b')][_0x070e('0x33')]({'where':{'id':_0x4d4ee8[_0x070e('0x36')]['id']}})[_0x070e('0x23')](handleEntityNotFound(_0x5ddbe9,null))[_0x070e('0x23')](removeEntity(_0x5ddbe9,null))['catch'](handleError(_0x5ddbe9,null));}; \ No newline at end of file +var _0x0713=['catch','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','stack','name','send','show','params','MailApplication','rawAttributes','query','keys','filters','intersection','model','fields','attributes','length','includeAll','include','merge','options','find','body'];(function(_0xfdd9e6,_0x1c1368){var _0x53d41d=function(_0xf23b02){while(--_0xf23b02){_0xfdd9e6['push'](_0xfdd9e6['shift']());}};_0x53d41d(++_0x1c1368);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3071('0x0'));var jsonpatch=require(_0x3071('0x1'));var rp=require(_0x3071('0x2'));var moment=require(_0x3071('0x3'));var BPromise=require(_0x3071('0x4'));var Mustache=require('mustache');var util=require(_0x3071('0x5'));var path=require(_0x3071('0x6'));var sox=require(_0x3071('0x7'));var csv=require(_0x3071('0x8'));var ejs=require(_0x3071('0x9'));var fs=require('fs');var fs_extra=require(_0x3071('0xa'));var _=require(_0x3071('0xb'));var squel=require(_0x3071('0xc'));var crypto=require(_0x3071('0xd'));var jsforce=require(_0x3071('0xe'));var deskjs=require(_0x3071('0xf'));var toCsv=require(_0x3071('0x8'));var querystring=require(_0x3071('0x10'));var Papa=require('papaparse');var Redis=require(_0x3071('0x11'));var authService=require(_0x3071('0x12'));var qs=require(_0x3071('0x13'));var as=require(_0x3071('0x14'));var hardwareService=require(_0x3071('0x15'));var logger=require('../../config/logger')(_0x3071('0x16'));var utils=require(_0x3071('0x17'));var config=require(_0x3071('0x18'));var licenseUtil=require(_0x3071('0x19'));var db=require(_0x3071('0x1a'))['db'];function respondWithStatusCode(_0x4a8cc7,_0x5330a8){_0x5330a8=_0x5330a8||0xcc;return function(_0x1826ca){if(_0x1826ca){return _0x4a8cc7['sendStatus'](_0x5330a8);}return _0x4a8cc7[_0x3071('0x1b')](_0x5330a8)[_0x3071('0x1c')]();};}function respondWithResult(_0x5d4883,_0x104e73){_0x104e73=_0x104e73||0xc8;return function(_0x4e1219){if(_0x4e1219){return _0x5d4883[_0x3071('0x1b')](_0x104e73)[_0x3071('0x1d')](_0x4e1219);}};}function respondWithFilteredResult(_0x1271d0,_0x1f14e1){return function(_0x1caa5d){if(_0x1caa5d){var _0x2a6a4b=typeof _0x1f14e1[_0x3071('0x1e')]===_0x3071('0x1f')&&typeof _0x1f14e1[_0x3071('0x20')]===_0x3071('0x1f');var _0x5f3c22=_0x1caa5d[_0x3071('0x21')];var _0x17dbda=_0x2a6a4b?0x0:_0x1f14e1[_0x3071('0x1e')];var _0x108a83=_0x2a6a4b?_0x1caa5d[_0x3071('0x21')]:_0x1f14e1[_0x3071('0x1e')]+_0x1f14e1[_0x3071('0x20')];var _0x26f113;if(_0x108a83>=_0x5f3c22){_0x108a83=_0x5f3c22;_0x26f113=0xc8;}else{_0x26f113=0xce;}_0x1271d0['status'](_0x26f113);return _0x1271d0[_0x3071('0x22')](_0x3071('0x23'),_0x17dbda+'-'+_0x108a83+'/'+_0x5f3c22)[_0x3071('0x1d')](_0x1caa5d);}return null;};}function patchUpdates(_0x56c267){return function(_0xb8f4e3){try{jsonpatch['apply'](_0xb8f4e3,_0x56c267,!![]);}catch(_0x833074){return BPromise[_0x3071('0x24')](_0x833074);}return _0xb8f4e3[_0x3071('0x25')]();};}function saveUpdates(_0x457b57,_0x33090c){return function(_0x34c50e){if(_0x34c50e){return _0x34c50e[_0x3071('0x26')](_0x457b57)[_0x3071('0x27')](function(_0x542646){return _0x542646;});}return null;};}function removeEntity(_0x481a51,_0x2ce48a){return function(_0xb05b1d){if(_0xb05b1d){return _0xb05b1d[_0x3071('0x28')]()[_0x3071('0x27')](function(){_0x481a51[_0x3071('0x1b')](0xcc)[_0x3071('0x1c')]();});}};}function handleEntityNotFound(_0x7a4cb4,_0x1fe727){return function(_0x1de5fb){if(!_0x1de5fb){_0x7a4cb4['sendStatus'](0x194);}return _0x1de5fb;};}function handleError(_0x2e5f93,_0x3f1e6e){_0x3f1e6e=_0x3f1e6e||0x1f4;return function(_0x177138){logger['error'](_0x177138[_0x3071('0x29')]);if(_0x177138[_0x3071('0x2a')]){delete _0x177138[_0x3071('0x2a')];}_0x2e5f93[_0x3071('0x1b')](_0x3f1e6e)[_0x3071('0x2b')](_0x177138);};}exports[_0x3071('0x2c')]=function(_0x177b5f,_0x3921a1){var _0x32f1b4={'raw':!![],'where':{'id':_0x177b5f[_0x3071('0x2d')]['id']}},_0x292205={};_0x292205['model']=_['keys'](db[_0x3071('0x2e')][_0x3071('0x2f')]);_0x292205[_0x3071('0x30')]=_[_0x3071('0x31')](_0x177b5f[_0x3071('0x30')]);_0x292205[_0x3071('0x32')]=_[_0x3071('0x33')](_0x292205[_0x3071('0x34')],_0x292205['query']);_0x32f1b4['attributes']=_['intersection'](_0x292205[_0x3071('0x34')],qs[_0x3071('0x35')](_0x177b5f['query'][_0x3071('0x35')]));_0x32f1b4[_0x3071('0x36')]=_0x32f1b4[_0x3071('0x36')][_0x3071('0x37')]?_0x32f1b4['attributes']:_0x292205[_0x3071('0x34')];if(_0x177b5f[_0x3071('0x30')][_0x3071('0x38')]){_0x32f1b4[_0x3071('0x39')]=[{'all':!![]}];}_0x32f1b4=_[_0x3071('0x3a')]({},_0x32f1b4,_0x177b5f[_0x3071('0x3b')]);return db[_0x3071('0x2e')][_0x3071('0x3c')](_0x32f1b4)['then'](handleEntityNotFound(_0x3921a1,null))[_0x3071('0x27')](respondWithResult(_0x3921a1,null))['catch'](handleError(_0x3921a1,null));};exports['update']=function(_0x1a1a64,_0xa3a7ae){if(_0x1a1a64['body']['id']){delete _0x1a1a64[_0x3071('0x3d')]['id'];}return db[_0x3071('0x2e')][_0x3071('0x3c')]({'where':{'id':_0x1a1a64[_0x3071('0x2d')]['id']}})[_0x3071('0x27')](handleEntityNotFound(_0xa3a7ae,null))[_0x3071('0x27')](saveUpdates(_0x1a1a64['body'],null))[_0x3071('0x27')](respondWithResult(_0xa3a7ae,null))[_0x3071('0x3e')](handleError(_0xa3a7ae,null));};exports['destroy']=function(_0x44ad05,_0x5b1392){return db[_0x3071('0x2e')][_0x3071('0x3c')]({'where':{'id':_0x44ad05['params']['id']}})['then'](handleEntityNotFound(_0x5b1392,null))[_0x3071('0x27')](removeEntity(_0x5b1392,null))[_0x3071('0x3e')](handleError(_0x5b1392,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index a00acad..430b61d 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 _0x53a4=['MailApplication','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./mailApplication.attributes','exports'];(function(_0x101a17,_0x5d047a){var _0x3b76ee=function(_0x89be1b){while(--_0x89be1b){_0x101a17['push'](_0x101a17['shift']());}};_0x3b76ee(++_0x5d047a);}(_0x53a4,0x1bd));var _0x453a=function(_0x161ddd,_0x4f9795){_0x161ddd=_0x161ddd-0x0;var _0x1fce41=_0x53a4[_0x161ddd];return _0x1fce41;};'use strict';var _=require(_0x453a('0x0'));var util=require(_0x453a('0x1'));var logger=require(_0x453a('0x2'))(_0x453a('0x3'));var moment=require('moment');var BPromise=require(_0x453a('0x4'));var rp=require(_0x453a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x453a('0x6'));var config=require(_0x453a('0x7'));var attributes=require(_0x453a('0x8'));module[_0x453a('0x9')]=function(_0x40dd8,_0x347f34){return _0x40dd8['define'](_0x453a('0xa'),attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x453a('0xb'),'collate':_0x453a('0xc')});}; \ No newline at end of file +var _0x6ced=['../../config/logger','api','moment','bluebird','request-promise','path','./mailApplication.attributes','exports','define','MailApplication','mail_applications','utf8mb4','lodash','util'];(function(_0x1e9b27,_0x389fc8){var _0x1b50c9=function(_0x5d1a26){while(--_0x5d1a26){_0x1e9b27['push'](_0x1e9b27['shift']());}};_0x1b50c9(++_0x389fc8);}(_0x6ced,0x14e));var _0xd6ce=function(_0x4f19d1,_0x16e1a6){_0x4f19d1=_0x4f19d1-0x0;var _0x1fe82e=_0x6ced[_0x4f19d1];return _0x1fe82e;};'use strict';var _=require(_0xd6ce('0x0'));var util=require(_0xd6ce('0x1'));var logger=require(_0xd6ce('0x2'))(_0xd6ce('0x3'));var moment=require(_0xd6ce('0x4'));var BPromise=require(_0xd6ce('0x5'));var rp=require(_0xd6ce('0x6'));var fs=require('fs');var path=require(_0xd6ce('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd6ce('0x8'));module[_0xd6ce('0x9')]=function(_0x40ef57,_0x2df92d){return _0x40ef57[_0xd6ce('0xa')](_0xd6ce('0xb'),attributes,{'tableName':_0xd6ce('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd6ce('0xd'),'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 b6dab68..a6924eb 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 _0x515b=['request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateMailApplication','MailApplication','update','body','options','where','attributes','limit','then','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','MailApplication,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x515b,0x1f2));var _0xb515=function(_0x3734c1,_0x14831d){_0x3734c1=_0x3734c1-0x0;var _0x482051=_0x515b[_0x3734c1];return _0x482051;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xb515('0x0'));var rs=require(_0xb515('0x1'));var fs=require('fs');var Redis=require(_0xb515('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb515('0x3'))(_0xb515('0x4'));var config=require(_0xb515('0x5'));var jayson=require(_0xb515('0x6'));var client=jayson[_0xb515('0x7')][_0xb515('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1db5de,_0x2e7ca0,_0x6e3492){return new BPromise(function(_0x508a99,_0x4c6eb7){return client[_0xb515('0x9')](_0x1db5de,_0x6e3492)['then'](function(_0xdd8c21){logger[_0xb515('0xa')](_0xb515('0xb'),_0x2e7ca0,_0xb515('0xc'));logger[_0xb515('0xd')](_0xb515('0xe'),_0x2e7ca0,'request\x20sent',JSON[_0xb515('0xf')](_0xdd8c21));if(_0xdd8c21[_0xb515('0x10')]){if(_0xdd8c21[_0xb515('0x10')][_0xb515('0x11')]===0x1f4){logger[_0xb515('0x10')](_0xb515('0xb'),_0x2e7ca0,_0xdd8c21['error'][_0xb515('0x12')]);return _0x4c6eb7(_0xdd8c21[_0xb515('0x10')][_0xb515('0x12')]);}logger[_0xb515('0x10')]('MailApplication,\x20%s,\x20%s',_0x2e7ca0,_0xdd8c21[_0xb515('0x10')][_0xb515('0x12')]);return _0x508a99(_0xdd8c21[_0xb515('0x10')]['message']);}else{logger['info'](_0xb515('0xb'),_0x2e7ca0,_0xb515('0xc'));_0x508a99(_0xdd8c21[_0xb515('0x13')][_0xb515('0x12')]);}})[_0xb515('0x14')](function(_0x2247c9){logger['error'](_0xb515('0xb'),_0x2e7ca0,_0x2247c9);_0x4c6eb7(_0x2247c9);});});}exports[_0xb515('0x15')]=function(_0xfd0a44){var _0x55cb65=this;return new Promise(function(_0x2103ce,_0x252b11){return db[_0xb515('0x16')][_0xb515('0x17')](_0xfd0a44[_0xb515('0x18')],{'raw':_0xfd0a44[_0xb515('0x19')]?_0xfd0a44['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xfd0a44[_0xb515('0x19')]?_0xfd0a44['options'][_0xb515('0x1a')]||null:null,'attributes':_0xfd0a44[_0xb515('0x19')]?_0xfd0a44[_0xb515('0x19')][_0xb515('0x1b')]||null:null,'limit':_0xfd0a44[_0xb515('0x19')]?_0xfd0a44[_0xb515('0x19')][_0xb515('0x1c')]||null:null})[_0xb515('0x1d')](function(_0x7d56d1){logger[_0xb515('0xa')](_0xb515('0x15'),_0xfd0a44);logger[_0xb515('0xd')](_0xb515('0x15'),_0xfd0a44,JSON['stringify'](_0x7d56d1));_0x2103ce(_0x7d56d1);})['catch'](function(_0xc9c01e){logger[_0xb515('0x10')](_0xb515('0x15'),_0xc9c01e[_0xb515('0x12')],_0xfd0a44);_0x252b11(_0x55cb65[_0xb515('0x10')](0x1f4,_0xc9c01e[_0xb515('0x12')]));});});}; \ No newline at end of file +var _0xcf71=['where','limit','UpdateMailApplication','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','request\x20sent','debug','stringify','error','code','MailApplication,\x20%s,\x20%s','message','info','MailApplication','update','body','options'];(function(_0xbf5e16,_0x146ce3){var _0x5975a5=function(_0x2387a7){while(--_0x2387a7){_0xbf5e16['push'](_0xbf5e16['shift']());}};_0x5975a5(++_0x146ce3);}(_0xcf71,0xc8));var _0x1cf7=function(_0x9a7d08,_0xe9048){_0x9a7d08=_0x9a7d08-0x0;var _0x58e6e8=_0xcf71[_0x9a7d08];return _0x58e6e8;};'use strict';var _=require('lodash');var util=require(_0x1cf7('0x0'));var moment=require(_0x1cf7('0x1'));var BPromise=require(_0x1cf7('0x2'));var rs=require(_0x1cf7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1cf7('0x4'))['db'];var utils=require(_0x1cf7('0x5'));var logger=require(_0x1cf7('0x6'))(_0x1cf7('0x7'));var config=require(_0x1cf7('0x8'));var jayson=require(_0x1cf7('0x9'));var client=jayson[_0x1cf7('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5e9fa3,_0x58eb80,_0x3705c8){return new BPromise(function(_0x58960f,_0x47b523){return client['request'](_0x5e9fa3,_0x3705c8)[_0x1cf7('0xb')](function(_0x3da83e){logger['info']('MailApplication,\x20%s,\x20%s',_0x58eb80,_0x1cf7('0xc'));logger[_0x1cf7('0xd')]('MailApplication,\x20%s,\x20%s,\x20%s',_0x58eb80,_0x1cf7('0xc'),JSON[_0x1cf7('0xe')](_0x3da83e));if(_0x3da83e[_0x1cf7('0xf')]){if(_0x3da83e['error'][_0x1cf7('0x10')]===0x1f4){logger['error'](_0x1cf7('0x11'),_0x58eb80,_0x3da83e[_0x1cf7('0xf')][_0x1cf7('0x12')]);return _0x47b523(_0x3da83e[_0x1cf7('0xf')]['message']);}logger['error'](_0x1cf7('0x11'),_0x58eb80,_0x3da83e[_0x1cf7('0xf')][_0x1cf7('0x12')]);return _0x58960f(_0x3da83e['error'][_0x1cf7('0x12')]);}else{logger[_0x1cf7('0x13')](_0x1cf7('0x11'),_0x58eb80,'request\x20sent');_0x58960f(_0x3da83e['result'][_0x1cf7('0x12')]);}})['catch'](function(_0x5e7803){logger[_0x1cf7('0xf')](_0x1cf7('0x11'),_0x58eb80,_0x5e7803);_0x47b523(_0x5e7803);});});}exports['UpdateMailApplication']=function(_0x58c494){var _0x304ac8=this;return new Promise(function(_0x16c1be,_0x28b00a){return db[_0x1cf7('0x14')][_0x1cf7('0x15')](_0x58c494[_0x1cf7('0x16')],{'raw':_0x58c494['options']?_0x58c494[_0x1cf7('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x58c494['options']?_0x58c494[_0x1cf7('0x17')][_0x1cf7('0x18')]||null:null,'attributes':_0x58c494[_0x1cf7('0x17')]?_0x58c494['options']['attributes']||null:null,'limit':_0x58c494[_0x1cf7('0x17')]?_0x58c494['options'][_0x1cf7('0x19')]||null:null})[_0x1cf7('0xb')](function(_0x572769){logger[_0x1cf7('0x13')](_0x1cf7('0x1a'),_0x58c494);logger['debug']('UpdateMailApplication',_0x58c494,JSON[_0x1cf7('0xe')](_0x572769));_0x16c1be(_0x572769);})[_0x1cf7('0x1b')](function(_0x435ad7){logger['error'](_0x1cf7('0x1a'),_0x435ad7['message'],_0x58c494);_0x28b00a(_0x304ac8[_0x1cf7('0xf')](0x1f4,_0x435ad7[_0x1cf7('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 9122fc6..770287d 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 _0xce29=['addMessage','tracked','mail','addTags','put','mailinteraction:update','update','mailinteraction:destroy','removeTags','Router','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','index','describe','/:id','getMessages','download','post','create'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xce29,0xa3));var _0x9ce2=function(_0x278d8d,_0x39253d){_0x278d8d=_0x278d8d-0x0;var _0x32c11a=_0xce29[_0x278d8d];return _0x32c11a;};'use strict';var express=require('express');var router=express[_0x9ce2('0x0')]();var auth=require(_0x9ce2('0x1'));var interaction=require(_0x9ce2('0x2'));var controller=require(_0x9ce2('0x3'));router[_0x9ce2('0x4')]('/',auth[_0x9ce2('0x5')](),controller[_0x9ce2('0x6')]);router[_0x9ce2('0x4')]('/describe',auth['isAuthenticated'](),controller[_0x9ce2('0x7')]);router[_0x9ce2('0x4')](_0x9ce2('0x8'),auth[_0x9ce2('0x5')](),controller['show']);router[_0x9ce2('0x4')]('/:id/messages',auth[_0x9ce2('0x5')](),controller[_0x9ce2('0x9')]);router['get']('/:id/download',auth['isAuthenticated'](),controller[_0x9ce2('0xa')]);router[_0x9ce2('0xb')]('/',auth[_0x9ce2('0x5')](),controller[_0x9ce2('0xc')]);router[_0x9ce2('0xb')]('/:id/messages',auth[_0x9ce2('0x5')](),controller[_0x9ce2('0xd')]);router['post']('/:id/tags',auth['isAuthenticated'](),interaction[_0x9ce2('0xe')](_0x9ce2('0xf'),'mailinteraction:addtags'),controller[_0x9ce2('0x10')]);router[_0x9ce2('0x11')](_0x9ce2('0x8'),auth[_0x9ce2('0x5')](),interaction[_0x9ce2('0xe')](_0x9ce2('0xf'),_0x9ce2('0x12')),controller[_0x9ce2('0x13')]);router['delete'](_0x9ce2('0x8'),auth[_0x9ce2('0x5')](),interaction['tracked'](_0x9ce2('0xf'),_0x9ce2('0x14')),controller['destroy']);router['delete']('/:id/tags',auth['isAuthenticated'](),controller[_0x9ce2('0x15')]);module['exports']=router; \ No newline at end of file +var _0x7c0b=['describe','/:id','show','/:id/messages','getMessages','post','create','addMessage','/:id/tags','tracked','mail','mailinteraction:addtags','addTags','mailinteraction:update','mailinteraction:destroy','delete','removeTags','exports','express','Router','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','index'];(function(_0x170647,_0x4d4c36){var _0x349e0e=function(_0x9463fa){while(--_0x9463fa){_0x170647['push'](_0x170647['shift']());}};_0x349e0e(++_0x4d4c36);}(_0x7c0b,0x130));var _0xb7c0=function(_0x39d227,_0x283f4e){_0x39d227=_0x39d227-0x0;var _0x1db84f=_0x7c0b[_0x39d227];return _0x1db84f;};'use strict';var express=require(_0xb7c0('0x0'));var router=express[_0xb7c0('0x1')]();var auth=require(_0xb7c0('0x2'));var interaction=require(_0xb7c0('0x3'));var controller=require(_0xb7c0('0x4'));router[_0xb7c0('0x5')]('/',auth[_0xb7c0('0x6')](),controller[_0xb7c0('0x7')]);router[_0xb7c0('0x5')]('/describe',auth[_0xb7c0('0x6')](),controller[_0xb7c0('0x8')]);router['get'](_0xb7c0('0x9'),auth[_0xb7c0('0x6')](),controller[_0xb7c0('0xa')]);router[_0xb7c0('0x5')](_0xb7c0('0xb'),auth['isAuthenticated'](),controller[_0xb7c0('0xc')]);router['get']('/:id/download',auth[_0xb7c0('0x6')](),controller['download']);router[_0xb7c0('0xd')]('/',auth[_0xb7c0('0x6')](),controller[_0xb7c0('0xe')]);router['post']('/:id/messages',auth[_0xb7c0('0x6')](),controller[_0xb7c0('0xf')]);router[_0xb7c0('0xd')](_0xb7c0('0x10'),auth['isAuthenticated'](),interaction[_0xb7c0('0x11')](_0xb7c0('0x12'),_0xb7c0('0x13')),controller[_0xb7c0('0x14')]);router['put'](_0xb7c0('0x9'),auth[_0xb7c0('0x6')](),interaction['tracked']('mail',_0xb7c0('0x15')),controller['update']);router['delete'](_0xb7c0('0x9'),auth['isAuthenticated'](),interaction[_0xb7c0('0x11')](_0xb7c0('0x12'),_0xb7c0('0x16')),controller['destroy']);router[_0xb7c0('0x17')](_0xb7c0('0x10'),auth['isAuthenticated'](),controller[_0xb7c0('0x18')]);module[_0xb7c0('0x19')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 9950d32..4932614 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 _0x4724=['TEXT','ENUM','INTEGER','iconv','BOOLEAN','DATE','STRING','long'];(function(_0x3f601f,_0x4d4e69){var _0x452b2e=function(_0x3617f4){while(--_0x3617f4){_0x3f601f['push'](_0x3f601f['shift']());}};_0x452b2e(++_0x4d4e69);}(_0x4724,0x83));var _0x4472=function(_0x4090cd,_0x55a2f0){_0x4090cd=_0x4090cd-0x0;var _0x522fbe=_0x4724[_0x4090cd];return _0x522fbe;};'use strict';var Sequelize=require('sequelize');var iconv=require(_0x4472('0x0'));module['exports']={'closed':{'type':Sequelize[_0x4472('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x4472('0x2')]},'disposition':{'type':Sequelize[_0x4472('0x3')]},'secondDisposition':{'type':Sequelize[_0x4472('0x3')]},'thirdDisposition':{'type':Sequelize[_0x4472('0x3')]},'note':{'type':Sequelize[_0x4472('0x3')]},'inReplyTo':{'type':Sequelize['STRING'](0x1fe)},'to':{'type':Sequelize[_0x4472('0x3')]},'cc':{'type':Sequelize['TEXT'](_0x4472('0x4'))},'subject':{'type':Sequelize[_0x4472('0x5')]()},'attach':{'type':Sequelize[_0x4472('0x1')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x4472('0x2')]},'substatus':{'type':Sequelize[_0x4472('0x3')](0x3c)},'substatusAt':{'type':Sequelize[_0x4472('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x4472('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x4472('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x4472('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize[_0x4472('0x7')]}}; \ No newline at end of file +var _0x581f=['sequelize','iconv','exports','BOOLEAN','DATE','STRING','TEXT','ENUM','out','INTEGER'];(function(_0x87b0ff,_0x314389){var _0x3bc0b2=function(_0x41682b){while(--_0x41682b){_0x87b0ff['push'](_0x87b0ff['shift']());}};_0x3bc0b2(++_0x314389);}(_0x581f,0x1e0));var _0xf581=function(_0x1b092a,_0xa0a68d){_0x1b092a=_0x1b092a-0x0;var _0x3e5a3d=_0x581f[_0x1b092a];return _0x3e5a3d;};'use strict';var Sequelize=require(_0xf581('0x0'));var iconv=require(_0xf581('0x1'));module[_0xf581('0x2')]={'closed':{'type':Sequelize[_0xf581('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xf581('0x4')]},'disposition':{'type':Sequelize[_0xf581('0x5')]},'secondDisposition':{'type':Sequelize[_0xf581('0x5')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xf581('0x5')]},'inReplyTo':{'type':Sequelize[_0xf581('0x5')](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0xf581('0x6')]('long')},'subject':{'type':Sequelize[_0xf581('0x6')]()},'attach':{'type':Sequelize[_0xf581('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xf581('0x4')]},'substatus':{'type':Sequelize[_0xf581('0x5')](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xf581('0x7')]('in',_0xf581('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xf581('0x4')]},'lastMsgDirection':{'type':Sequelize[_0xf581('0x7')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xf581('0x3')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xf581('0x9')]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index d5c8c1b..c55f0af 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 _0x12bb=['query','user','catch','keys','rawAttributes','model','attributes','fields','length','includeAll','include','merge','create','body','update','find','params','describe','addMessage','ids','omit','findOne','MailMessage','filters','intersection','hasOwnProperty','nolimit','order','sort','pick','where','filter','map','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','addTags','setTags','spread','Tag','findAll','color','emit','removeTags','download','unix','join','root','server','files','attachments','push','Attachment','Messages','from','subject','createdAt','get','mkdirSync','each','missing.recipient@your.company.com','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','Bcc','existsSync','readFileSync','build','eml-format','zip-dir','bluebird','util','lodash','juice','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','localhost','socket.io-emitter','./mailInteraction.socket','register','status','end','offset','limit','undefined','count','set','Content-Range','json','then','destroy','sendStatus','error','stack','name','send','MailInteraction','fieldName','type','getOptions','mail'];(function(_0x275e0e,_0x2fdb88){var _0x60196a=function(_0x5e4f13){while(--_0x5e4f13){_0x275e0e['push'](_0x275e0e['shift']());}};_0x60196a(++_0x2fdb88);}(_0x12bb,0x122));var _0xb12b=function(_0x2ed7d5,_0x509cad){_0x2ed7d5=_0x2ed7d5-0x0;var _0x515dd0=_0x12bb[_0x2ed7d5];return _0x515dd0;};'use strict';var emlformat=require(_0xb12b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb12b('0x1'));var moment=require('moment');var BPromise=require(_0xb12b('0x2'));var util=require(_0xb12b('0x3'));var path=require('path');var fs=require('fs');var _=require(_0xb12b('0x4'));var juice=require(_0xb12b('0x5'));var Redis=require('ioredis');var interaction=require(_0xb12b('0x6'));var qs=require(_0xb12b('0x7'));var logger=require(_0xb12b('0x8'))(_0xb12b('0x9'));var config=require(_0xb12b('0xa'));var db=require('../../mysqldb')['db'];var htmlEntities=require('html-entities');config['redis']=_['defaults'](config[_0xb12b('0xb')],{'host':_0xb12b('0xc'),'port':0x18eb});var socket=require(_0xb12b('0xd'))(new Redis(config[_0xb12b('0xb')]));require(_0xb12b('0xe'))[_0xb12b('0xf')](socket);function respondWithStatusCode(_0x3094a3,_0x51ad1d){_0x51ad1d=_0x51ad1d||0xcc;return function(_0x4c0843){if(_0x4c0843){return _0x3094a3['sendStatus'](_0x51ad1d);}return _0x3094a3[_0xb12b('0x10')](_0x51ad1d)[_0xb12b('0x11')]();};}function respondWithResult(_0x500ad3,_0x3f5654){_0x3f5654=_0x3f5654||0xc8;return function(_0x5b9ef4){if(_0x5b9ef4){return _0x500ad3[_0xb12b('0x10')](_0x3f5654)['json'](_0x5b9ef4);}};}function respondWithFilteredResult(_0x2f9200,_0x56a459){return function(_0x17c099){if(_0x17c099){var _0x1bda8c=typeof _0x56a459[_0xb12b('0x12')]==='undefined'&&typeof _0x56a459[_0xb12b('0x13')]===_0xb12b('0x14');var _0x188ab1=_0x17c099[_0xb12b('0x15')];var _0x47720c=_0x1bda8c?0x0:_0x56a459[_0xb12b('0x12')];var _0x263642=_0x1bda8c?_0x17c099['count']:_0x56a459[_0xb12b('0x12')]+_0x56a459[_0xb12b('0x13')];var _0x231024;if(_0x263642>=_0x188ab1){_0x263642=_0x188ab1;_0x231024=0xc8;}else{_0x231024=0xce;}_0x2f9200[_0xb12b('0x10')](_0x231024);return _0x2f9200[_0xb12b('0x16')](_0xb12b('0x17'),_0x47720c+'-'+_0x263642+'/'+_0x188ab1)[_0xb12b('0x18')](_0x17c099);}return null;};}function saveUpdates(_0x3384cc){return function(_0x10cdb5){if(_0x10cdb5){return _0x10cdb5['update'](_0x3384cc)[_0xb12b('0x19')](function(_0x38791d){return _0x38791d;});}return null;};}function removeEntity(_0x4c7bb6){return function(_0x93a40b){if(_0x93a40b){return _0x93a40b[_0xb12b('0x1a')]()[_0xb12b('0x19')](function(){_0x4c7bb6[_0xb12b('0x10')](0xcc)[_0xb12b('0x11')]();});}};}function handleEntityNotFound(_0x6fbfb){return function(_0xaa4ff1){if(!_0xaa4ff1){_0x6fbfb[_0xb12b('0x1b')](0x194);}return _0xaa4ff1;};}function handleError(_0x3a7fe5,_0x35592f){_0x35592f=_0x35592f||0x1f4;return function(_0x9b22a3){logger[_0xb12b('0x1c')](_0x9b22a3[_0xb12b('0x1d')]);if(_0x9b22a3[_0xb12b('0x1e')]){delete _0x9b22a3['name'];}_0x3a7fe5[_0xb12b('0x10')](_0x35592f)[_0xb12b('0x1f')](_0x9b22a3);};}exports['index']=function(_0x269309,_0x33f445){var _0x4d5184={};var _0x312fc2=_['map'](db[_0xb12b('0x20')]['rawAttributes'],function(_0x19dfaa){return{'name':_0x19dfaa[_0xb12b('0x21')],'type':_0x19dfaa[_0xb12b('0x22')]['key']};});_0x4d5184=qs[_0xb12b('0x23')](_0x312fc2,_0x269309);return interaction['findAll'](_0xb12b('0x24'),_0x269309[_0xb12b('0x25')],_0x269309[_0xb12b('0x26')],_0x4d5184,_0x312fc2)[_0xb12b('0x19')](respondWithFilteredResult(_0x33f445,_0x4d5184))[_0xb12b('0x27')](handleError(_0x33f445,null));};exports['show']=function(_0x45c7e9,_0x5ee3bf){var _0x224e93={'raw':![],'where':{'id':_0x45c7e9['params']['id']}},_0x2a8382={};_0x2a8382['model']=_[_0xb12b('0x28')](db[_0xb12b('0x20')][_0xb12b('0x29')]);_0x2a8382[_0xb12b('0x25')]=_['keys'](_0x45c7e9[_0xb12b('0x25')]);_0x2a8382['filters']=_['intersection'](_0x2a8382[_0xb12b('0x2a')],_0x2a8382[_0xb12b('0x25')]);_0x224e93[_0xb12b('0x2b')]=_['intersection'](_0x2a8382[_0xb12b('0x2a')],qs[_0xb12b('0x2c')](_0x45c7e9['query']['fields']));_0x224e93[_0xb12b('0x2b')]=_0x224e93[_0xb12b('0x2b')][_0xb12b('0x2d')]?_0x224e93['attributes']:_0x2a8382[_0xb12b('0x2a')];if(_0x45c7e9[_0xb12b('0x25')][_0xb12b('0x2e')]){_0x224e93[_0xb12b('0x2f')]=[{'all':!![]}];}_0x224e93=_[_0xb12b('0x30')]({},_0x224e93,_0x45c7e9['options']);return db[_0xb12b('0x20')]['find'](_0x224e93)[_0xb12b('0x19')](handleEntityNotFound(_0x5ee3bf,null))[_0xb12b('0x19')](respondWithResult(_0x5ee3bf,null))[_0xb12b('0x27')](handleError(_0x5ee3bf,null));};exports[_0xb12b('0x31')]=function(_0x45934d,_0x5acff1){return db[_0xb12b('0x20')][_0xb12b('0x31')](_0x45934d[_0xb12b('0x32')],{})['then'](respondWithResult(_0x5acff1,0xc9))[_0xb12b('0x27')](handleError(_0x5acff1,null));};exports[_0xb12b('0x33')]=function(_0x4d2495,_0x187a2b){if(_0x4d2495[_0xb12b('0x32')]['id']){delete _0x4d2495[_0xb12b('0x32')]['id'];}return db['MailInteraction'][_0xb12b('0x34')]({'where':{'id':_0x4d2495[_0xb12b('0x35')]['id']}})['then'](handleEntityNotFound(_0x187a2b,null))[_0xb12b('0x19')](saveUpdates(_0x4d2495['body'],null))['then'](respondWithResult(_0x187a2b,null))[_0xb12b('0x27')](handleError(_0x187a2b,null));};exports[_0xb12b('0x1a')]=function(_0x4bf508,_0x5c9df1){return db[_0xb12b('0x20')]['find']({'where':{'id':_0x4bf508[_0xb12b('0x35')]['id']}})['then'](handleEntityNotFound(_0x5c9df1,null))[_0xb12b('0x19')](removeEntity(_0x5c9df1,null))[_0xb12b('0x27')](handleError(_0x5c9df1,null));};exports[_0xb12b('0x36')]=function(_0x6b5c26,_0x167b54){return db[_0xb12b('0x20')][_0xb12b('0x36')]()[_0xb12b('0x19')](respondWithResult(_0x167b54,null))[_0xb12b('0x27')](handleError(_0x167b54,null));};exports[_0xb12b('0x37')]=function(_0x3ba30c,_0x1f380a){return db['MailMessage'][_0xb12b('0x34')]({'where':{'id':_0x3ba30c['params']['id']}})[_0xb12b('0x19')](handleEntityNotFound(_0x1f380a,null))[_0xb12b('0x19')](function(_0x38ed52){if(_0x38ed52){return _0x38ed52[_0xb12b('0x37')](_0x3ba30c[_0xb12b('0x32')][_0xb12b('0x38')],_[_0xb12b('0x39')](_0x3ba30c[_0xb12b('0x32')],[_0xb12b('0x38'),'id'])||{});}})[_0xb12b('0x19')](respondWithResult(_0x1f380a,null))[_0xb12b('0x27')](handleError(_0x1f380a,null));};exports['getMessages']=function(_0xaa04cf,_0x3d1311){var _0x1545f4={'raw':![],'where':{}};var _0x148457={};var _0x1a8e48={'count':0x0,'rows':[]};return db['MailInteraction'][_0xb12b('0x3a')]({'where':{'id':_0xaa04cf['params']['id']}})[_0xb12b('0x19')](handleEntityNotFound(_0x3d1311,null))[_0xb12b('0x19')](function(_0x2e7254){if(_0x2e7254){_0x148457[_0xb12b('0x2a')]=_[_0xb12b('0x28')](db[_0xb12b('0x3b')][_0xb12b('0x29')]);_0x148457[_0xb12b('0x25')]=_['keys'](_0xaa04cf[_0xb12b('0x25')]);_0x148457[_0xb12b('0x3c')]=_[_0xb12b('0x3d')](_0x148457[_0xb12b('0x2a')],_0x148457['query']);_0x1545f4['attributes']=_[_0xb12b('0x3d')](_0x148457['model'],qs['fields'](_0xaa04cf[_0xb12b('0x25')][_0xb12b('0x2c')]));_0x1545f4[_0xb12b('0x2b')]=_0x1545f4[_0xb12b('0x2b')][_0xb12b('0x2d')]?_0x1545f4[_0xb12b('0x2b')]:_0x148457['model'];if(!_0xaa04cf[_0xb12b('0x25')][_0xb12b('0x3e')](_0xb12b('0x3f'))){_0x1545f4[_0xb12b('0x13')]=qs[_0xb12b('0x13')](_0xaa04cf[_0xb12b('0x25')][_0xb12b('0x13')]);_0x1545f4[_0xb12b('0x12')]=qs[_0xb12b('0x12')](_0xaa04cf['query'][_0xb12b('0x12')]);}_0x1545f4[_0xb12b('0x40')]=qs[_0xb12b('0x41')](_0xaa04cf['query'][_0xb12b('0x41')]);_0x1545f4['where']=qs[_0xb12b('0x3c')](_[_0xb12b('0x42')](_0xaa04cf[_0xb12b('0x25')],_0x148457[_0xb12b('0x3c')]));_0x1545f4[_0xb12b('0x43')]['MailInteractionId']=_0x2e7254['id'];if(_0xaa04cf[_0xb12b('0x25')][_0xb12b('0x44')]){_0x1545f4[_0xb12b('0x43')]=_['merge'](_0x1545f4['where'],{'$or':_[_0xb12b('0x45')](_0x1545f4[_0xb12b('0x2b')],function(_0x2f96e3){var _0xb7109b={};_0xb7109b[_0x2f96e3]={'$like':'%'+_0xaa04cf[_0xb12b('0x25')][_0xb12b('0x44')]+'%'};return _0xb7109b;})});}if(_0xaa04cf[_0xb12b('0x25')][_0xb12b('0x46')]){var _0x16f785=_0xaa04cf[_0xb12b('0x25')]['$gte'][_0xb12b('0x47')](',');var _0x4e4435={};_0x4e4435[_0x16f785[0x0]]={'$gte':moment(_0x16f785[0x1])[_0xb12b('0x48')](_0xb12b('0x49'))};_0x1545f4[_0xb12b('0x43')]=_[_0xb12b('0x30')](_0x1545f4['where'],_0x4e4435);}_0x1545f4=_['merge']({},_0x1545f4,_0xaa04cf['options']);return db[_0xb12b('0x3b')][_0xb12b('0x15')]({'where':_0x1545f4['where']})['then'](function(_0x353b75){_0x1a8e48[_0xb12b('0x15')]=_0x353b75;if(_0xaa04cf['query'][_0xb12b('0x2e')]){_0x1545f4['include']=[{'all':!![]}];}return db[_0xb12b('0x3b')]['findAll'](_0x1545f4);})[_0xb12b('0x19')](function(_0x5483aa){if(_0xaa04cf[_0xb12b('0x25')][_0xb12b('0x4a')]===_0xb12b('0x4b')){for(var _0x4302c7=0x0;_0x4302c7<_0x5483aa[_0xb12b('0x2d')];_0x4302c7++){_0x5483aa[_0x4302c7][_0xb12b('0x32')]=juice(_0x5483aa[_0x4302c7][_0xb12b('0x32')]);}}_0x1a8e48['rows']=_0x5483aa;return _0x1a8e48;});}})['then'](respondWithFilteredResult(_0x3d1311,_0x1545f4))[_0xb12b('0x27')](handleError(_0x3d1311,null));};exports[_0xb12b('0x4c')]=function(_0x4ad5f2,_0xb5b12a){return db['MailInteraction'][_0xb12b('0x34')]({'where':{'id':_0x4ad5f2[_0xb12b('0x35')]['id']}})[_0xb12b('0x19')](handleEntityNotFound(_0xb5b12a,null))[_0xb12b('0x19')](function(_0x510517){if(_0x510517){return _0x510517[_0xb12b('0x4d')](_0x4ad5f2[_0xb12b('0x32')][_0xb12b('0x38')],_[_0xb12b('0x39')](_0x4ad5f2[_0xb12b('0x32')],[_0xb12b('0x38'),'id'])||{})[_0xb12b('0x4e')](function(){return db[_0xb12b('0x4f')][_0xb12b('0x50')]({'attributes':['id',_0xb12b('0x1e'),_0xb12b('0x51')],'where':{'id':_0x4ad5f2['body']['ids']}});})[_0xb12b('0x19')](function(_0x32bb09){socket[_0xb12b('0x52')]('mailInteractionTags:save',{'id':Number(_0x4ad5f2['params']['id']),'tags':_0x32bb09||[]});return{'id':Number(_0x4ad5f2['params']['id']),'tags':_0x32bb09||[]};});}})['then'](respondWithResult(_0xb5b12a,null))[_0xb12b('0x27')](handleError(_0xb5b12a,null));};exports[_0xb12b('0x53')]=function(_0x5a25b1,_0x218029){return db[_0xb12b('0x20')][_0xb12b('0x34')]({'where':{'id':_0x5a25b1[_0xb12b('0x35')]['id']}})['then'](handleEntityNotFound(_0x218029,null))[_0xb12b('0x19')](function(_0x253a84){if(_0x253a84){return _0x253a84[_0xb12b('0x53')](_0x5a25b1['query'][_0xb12b('0x38')]);}})['then'](respondWithStatusCode(_0x218029,null))[_0xb12b('0x27')](handleError(_0x218029,null));};exports[_0xb12b('0x54')]=function(_0xa05321,_0x313cf7){var _0x3f6b1e=moment()[_0xb12b('0x55')]()['toString']();var _0xd46381=path[_0xb12b('0x56')](config[_0xb12b('0x57')],_0xb12b('0x58'),'files','tmp');var _0x127e7c=path[_0xb12b('0x56')](config[_0xb12b('0x57')],_0xb12b('0x58'),_0xb12b('0x59'),'attachments');var _0x45a84e=path[_0xb12b('0x56')](_0xd46381,_0x3f6b1e);var _0x2c6366=util[_0xb12b('0x48')]('transcript-%d-%s.zip',_0xa05321[_0xb12b('0x35')]['id'],_0x3f6b1e);var _0x3ae4f5=path[_0xb12b('0x56')](_0xd46381,_0x2c6366);var _0x1d6f8a=[];if(_0xa05321[_0xb12b('0x25')][_0xb12b('0x5a')]){_0x1d6f8a[_0xb12b('0x5b')]({'model':db[_0xb12b('0x5c')],'as':'Attachments','raw':!![]});}var _0x2b505b=[{'model':db[_0xb12b('0x3b')],'as':_0xb12b('0x5d'),'attributes':['id',_0xb12b('0x32'),_0xb12b('0x5e'),'to','cc','bcc',_0xb12b('0x5f'),_0xb12b('0x60')],'where':{'secret':![]},'order':qs['sort']('id'),'include':_0x1d6f8a}];return db[_0xb12b('0x20')]['find']({'where':{'id':_0xa05321[_0xb12b('0x35')]['id']},'include':_0x2b505b})['then'](handleEntityNotFound(_0x313cf7,null))[_0xb12b('0x19')](function(_0x569f6f){if(_0x569f6f&&_0x569f6f['Messages']){var _0x4c27fd=_0x569f6f[_0xb12b('0x61')]({'plain':!![]});fs[_0xb12b('0x62')](_0x45a84e);return BPromise[_0xb12b('0x63')](_0x4c27fd[_0xb12b('0x5d')],function(_0x232ffc,_0x10cd23){var _0x1f6fa4={'from':_0x232ffc[_0xb12b('0x5e')],'to':_0x232ffc['to']||_0xb12b('0x64'),'subject':_0x232ffc[_0xb12b('0x5f')],'html':htmlEntities[_0xb12b('0x65')](_0x232ffc[_0xb12b('0x32')]),'headers':{'Date':moment(_0x232ffc[_0xb12b('0x60')])[_0xb12b('0x48')](_0xb12b('0x66'))},'attachments':[]};if(_0x232ffc['cc']){_0x1f6fa4[_0xb12b('0x67')]['Cc']=_0x232ffc['cc'];}if(_0x232ffc[_0xb12b('0x68')]){_0x1f6fa4[_0xb12b('0x67')][_0xb12b('0x69')]=_0x232ffc[_0xb12b('0x68')];}return new BPromise(function(_0x63738e,_0x1b7da2){if(_0x232ffc['Attachments']){for(var _0x4a3ce1=0x0;_0x4a3ce1<_0x232ffc['Attachments'][_0xb12b('0x2d')];_0x4a3ce1++){var _0x29f631=_0x232ffc['Attachments'][_0x4a3ce1];var _0x4e9a86=path[_0xb12b('0x56')](_0x127e7c,_0x29f631['basename']);if(fs[_0xb12b('0x6a')](_0x4e9a86)){_0x1f6fa4[_0xb12b('0x5a')][_0xb12b('0x5b')]({'name':_0x29f631[_0xb12b('0x1e')],'contentType':_0x29f631[_0xb12b('0x22')],'data':fs[_0xb12b('0x6b')](_0x4e9a86)});}}}emlformat[_0xb12b('0x6c')](_0x1f6fa4,function(_0x2dec4b,_0x53187b){if(_0x2dec4b)return _0x1b7da2(_0x2dec4b);fs['writeFileSync'](path[_0xb12b('0x56')](_0x45a84e,util[_0xb12b('0x48')]('message%d.eml',_0x10cd23)),_0x53187b);return _0x63738e(_0x53187b);});});})[_0xb12b('0x19')](function(){return new BPromise(function(_0x4c17cc,_0x115bd6){zipdir(_0x45a84e,{'saveTo':_0x3ae4f5},function(_0x59c93d,_0x34b90e){if(_0x59c93d)return _0x115bd6(_0x59c93d);return _0x4c17cc(_0x34b90e);});})['then'](function(){return new BPromise(function(_0xb0a0ad,_0x208b79){rimraf(_0x45a84e,function(_0x50d551){if(_0x50d551)_0x208b79(_0x50d551);return _0xb0a0ad();});});})['then'](function(){return _0x313cf7['download'](_0x3ae4f5,_0x2c6366,function(_0x4977d1){if(!_0x4977d1)fs['unlinkSync'](_0x3ae4f5);});});});}else{return _0x313cf7[_0xb12b('0x1b')](0xc8);}})[_0xb12b('0x27')](handleError(_0x313cf7,null));}; \ No newline at end of file +var _0xc377=['intersection','fields','attributes','length','includeAll','include','merge','options','find','create','body','params','addMessage','MailMessage','omit','ids','getMessages','findOne','hasOwnProperty','nolimit','order','sort','where','pick','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','count','inlineCss','rows','addTags','setTags','spread','Tag','color','emit','mailInteractionTags:save','removeTags','download','unix','toString','join','root','files','tmp','format','transcript-%d-%s.zip','attachments','push','Attachment','Attachments','Messages','from','subject','createdAt','get','mkdirSync','each','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','Bcc','basename','build','writeFileSync','message%d.eml','eml-format','rimraf','zip-dir','bluebird','path','lodash','juice','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../mysqldb','html-entities','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','update','then','destroy','error','stack','name','send','map','MailInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','mail','catch','model','keys','query','filters'];(function(_0x752ec7,_0x41675b){var _0x30e825=function(_0x2db4a9){while(--_0x2db4a9){_0x752ec7['push'](_0x752ec7['shift']());}};_0x30e825(++_0x41675b);}(_0xc377,0x1a6));var _0x7c37=function(_0x35ff01,_0x36699a){_0x35ff01=_0x35ff01-0x0;var _0x105c89=_0xc377[_0x35ff01];return _0x105c89;};'use strict';var emlformat=require(_0x7c37('0x0'));var rimraf=require(_0x7c37('0x1'));var zipdir=require(_0x7c37('0x2'));var moment=require('moment');var BPromise=require(_0x7c37('0x3'));var util=require('util');var path=require(_0x7c37('0x4'));var fs=require('fs');var _=require(_0x7c37('0x5'));var juice=require(_0x7c37('0x6'));var Redis=require(_0x7c37('0x7'));var interaction=require(_0x7c37('0x8'));var qs=require(_0x7c37('0x9'));var logger=require(_0x7c37('0xa'))(_0x7c37('0xb'));var config=require('../../config/environment');var db=require(_0x7c37('0xc'))['db'];var htmlEntities=require(_0x7c37('0xd'));config[_0x7c37('0xe')]=_[_0x7c37('0xf')](config[_0x7c37('0xe')],{'host':_0x7c37('0x10'),'port':0x18eb});var socket=require(_0x7c37('0x11'))(new Redis(config[_0x7c37('0xe')]));require(_0x7c37('0x12'))[_0x7c37('0x13')](socket);function respondWithStatusCode(_0x552126,_0x107a2c){_0x107a2c=_0x107a2c||0xcc;return function(_0x58acae){if(_0x58acae){return _0x552126[_0x7c37('0x14')](_0x107a2c);}return _0x552126[_0x7c37('0x15')](_0x107a2c)[_0x7c37('0x16')]();};}function respondWithResult(_0x4c79a7,_0x183534){_0x183534=_0x183534||0xc8;return function(_0x57cb92){if(_0x57cb92){return _0x4c79a7[_0x7c37('0x15')](_0x183534)[_0x7c37('0x17')](_0x57cb92);}};}function respondWithFilteredResult(_0x1c61c5,_0x4f5140){return function(_0x12bc78){if(_0x12bc78){var _0xb5e77b=typeof _0x4f5140[_0x7c37('0x18')]===_0x7c37('0x19')&&typeof _0x4f5140[_0x7c37('0x1a')]===_0x7c37('0x19');var _0x495c87=_0x12bc78['count'];var _0x16d1db=_0xb5e77b?0x0:_0x4f5140[_0x7c37('0x18')];var _0x112dcd=_0xb5e77b?_0x12bc78['count']:_0x4f5140[_0x7c37('0x18')]+_0x4f5140[_0x7c37('0x1a')];var _0x489b8;if(_0x112dcd>=_0x495c87){_0x112dcd=_0x495c87;_0x489b8=0xc8;}else{_0x489b8=0xce;}_0x1c61c5[_0x7c37('0x15')](_0x489b8);return _0x1c61c5[_0x7c37('0x1b')](_0x7c37('0x1c'),_0x16d1db+'-'+_0x112dcd+'/'+_0x495c87)[_0x7c37('0x17')](_0x12bc78);}return null;};}function saveUpdates(_0x36e5d0){return function(_0x13bac1){if(_0x13bac1){return _0x13bac1[_0x7c37('0x1d')](_0x36e5d0)[_0x7c37('0x1e')](function(_0xfd8cf0){return _0xfd8cf0;});}return null;};}function removeEntity(_0x1328fc){return function(_0x3e7223){if(_0x3e7223){return _0x3e7223[_0x7c37('0x1f')]()[_0x7c37('0x1e')](function(){_0x1328fc[_0x7c37('0x15')](0xcc)[_0x7c37('0x16')]();});}};}function handleEntityNotFound(_0x4e89e8){return function(_0x214715){if(!_0x214715){_0x4e89e8[_0x7c37('0x14')](0x194);}return _0x214715;};}function handleError(_0x586073,_0x338189){_0x338189=_0x338189||0x1f4;return function(_0x16a4b5){logger[_0x7c37('0x20')](_0x16a4b5[_0x7c37('0x21')]);if(_0x16a4b5['name']){delete _0x16a4b5[_0x7c37('0x22')];}_0x586073[_0x7c37('0x15')](_0x338189)[_0x7c37('0x23')](_0x16a4b5);};}exports['index']=function(_0x1ac3b8,_0x41fcfe){var _0x1ccf06={};var _0xf8ca21=_[_0x7c37('0x24')](db[_0x7c37('0x25')][_0x7c37('0x26')],function(_0x1639ec){return{'name':_0x1639ec[_0x7c37('0x27')],'type':_0x1639ec[_0x7c37('0x28')][_0x7c37('0x29')]};});_0x1ccf06=qs[_0x7c37('0x2a')](_0xf8ca21,_0x1ac3b8);return interaction[_0x7c37('0x2b')](_0x7c37('0x2c'),_0x1ac3b8['query'],_0x1ac3b8['user'],_0x1ccf06,_0xf8ca21)[_0x7c37('0x1e')](respondWithFilteredResult(_0x41fcfe,_0x1ccf06))[_0x7c37('0x2d')](handleError(_0x41fcfe,null));};exports['show']=function(_0x4985c2,_0x36521e){var _0x18a2fa={'raw':![],'where':{'id':_0x4985c2['params']['id']}},_0xdb31b3={};_0xdb31b3[_0x7c37('0x2e')]=_[_0x7c37('0x2f')](db[_0x7c37('0x25')][_0x7c37('0x26')]);_0xdb31b3[_0x7c37('0x30')]=_[_0x7c37('0x2f')](_0x4985c2[_0x7c37('0x30')]);_0xdb31b3[_0x7c37('0x31')]=_[_0x7c37('0x32')](_0xdb31b3['model'],_0xdb31b3[_0x7c37('0x30')]);_0x18a2fa['attributes']=_[_0x7c37('0x32')](_0xdb31b3['model'],qs['fields'](_0x4985c2[_0x7c37('0x30')][_0x7c37('0x33')]));_0x18a2fa[_0x7c37('0x34')]=_0x18a2fa[_0x7c37('0x34')][_0x7c37('0x35')]?_0x18a2fa['attributes']:_0xdb31b3[_0x7c37('0x2e')];if(_0x4985c2['query'][_0x7c37('0x36')]){_0x18a2fa[_0x7c37('0x37')]=[{'all':!![]}];}_0x18a2fa=_[_0x7c37('0x38')]({},_0x18a2fa,_0x4985c2[_0x7c37('0x39')]);return db['MailInteraction'][_0x7c37('0x3a')](_0x18a2fa)['then'](handleEntityNotFound(_0x36521e,null))['then'](respondWithResult(_0x36521e,null))[_0x7c37('0x2d')](handleError(_0x36521e,null));};exports['create']=function(_0x249c0b,_0x536f1d){return db['MailInteraction'][_0x7c37('0x3b')](_0x249c0b[_0x7c37('0x3c')],{})['then'](respondWithResult(_0x536f1d,0xc9))[_0x7c37('0x2d')](handleError(_0x536f1d,null));};exports[_0x7c37('0x1d')]=function(_0xd67e7d,_0x297c7e){if(_0xd67e7d[_0x7c37('0x3c')]['id']){delete _0xd67e7d[_0x7c37('0x3c')]['id'];}return db[_0x7c37('0x25')][_0x7c37('0x3a')]({'where':{'id':_0xd67e7d[_0x7c37('0x3d')]['id']}})[_0x7c37('0x1e')](handleEntityNotFound(_0x297c7e,null))[_0x7c37('0x1e')](saveUpdates(_0xd67e7d[_0x7c37('0x3c')],null))[_0x7c37('0x1e')](respondWithResult(_0x297c7e,null))[_0x7c37('0x2d')](handleError(_0x297c7e,null));};exports['destroy']=function(_0x30ea2b,_0x58ad88){return db['MailInteraction'][_0x7c37('0x3a')]({'where':{'id':_0x30ea2b['params']['id']}})['then'](handleEntityNotFound(_0x58ad88,null))[_0x7c37('0x1e')](removeEntity(_0x58ad88,null))[_0x7c37('0x2d')](handleError(_0x58ad88,null));};exports['describe']=function(_0x3baaa2,_0xcfa30e){return db[_0x7c37('0x25')]['describe']()[_0x7c37('0x1e')](respondWithResult(_0xcfa30e,null))[_0x7c37('0x2d')](handleError(_0xcfa30e,null));};exports[_0x7c37('0x3e')]=function(_0x356b72,_0x23e26b){return db[_0x7c37('0x3f')][_0x7c37('0x3a')]({'where':{'id':_0x356b72[_0x7c37('0x3d')]['id']}})['then'](handleEntityNotFound(_0x23e26b,null))[_0x7c37('0x1e')](function(_0xbc5902){if(_0xbc5902){return _0xbc5902[_0x7c37('0x3e')](_0x356b72[_0x7c37('0x3c')]['ids'],_[_0x7c37('0x40')](_0x356b72[_0x7c37('0x3c')],[_0x7c37('0x41'),'id'])||{});}})[_0x7c37('0x1e')](respondWithResult(_0x23e26b,null))['catch'](handleError(_0x23e26b,null));};exports[_0x7c37('0x42')]=function(_0x12407e,_0x15f9e3){var _0x355984={'raw':![],'where':{}};var _0x3254cd={};var _0x52c919={'count':0x0,'rows':[]};return db[_0x7c37('0x25')][_0x7c37('0x43')]({'where':{'id':_0x12407e[_0x7c37('0x3d')]['id']}})['then'](handleEntityNotFound(_0x15f9e3,null))[_0x7c37('0x1e')](function(_0x1f8666){if(_0x1f8666){_0x3254cd['model']=_['keys'](db[_0x7c37('0x3f')]['rawAttributes']);_0x3254cd[_0x7c37('0x30')]=_[_0x7c37('0x2f')](_0x12407e[_0x7c37('0x30')]);_0x3254cd['filters']=_['intersection'](_0x3254cd['model'],_0x3254cd['query']);_0x355984['attributes']=_[_0x7c37('0x32')](_0x3254cd[_0x7c37('0x2e')],qs[_0x7c37('0x33')](_0x12407e[_0x7c37('0x30')][_0x7c37('0x33')]));_0x355984[_0x7c37('0x34')]=_0x355984[_0x7c37('0x34')][_0x7c37('0x35')]?_0x355984['attributes']:_0x3254cd[_0x7c37('0x2e')];if(!_0x12407e[_0x7c37('0x30')][_0x7c37('0x44')](_0x7c37('0x45'))){_0x355984[_0x7c37('0x1a')]=qs[_0x7c37('0x1a')](_0x12407e[_0x7c37('0x30')]['limit']);_0x355984['offset']=qs['offset'](_0x12407e[_0x7c37('0x30')][_0x7c37('0x18')]);}_0x355984[_0x7c37('0x46')]=qs[_0x7c37('0x47')](_0x12407e[_0x7c37('0x30')][_0x7c37('0x47')]);_0x355984[_0x7c37('0x48')]=qs[_0x7c37('0x31')](_[_0x7c37('0x49')](_0x12407e[_0x7c37('0x30')],_0x3254cd[_0x7c37('0x31')]));_0x355984[_0x7c37('0x48')]['MailInteractionId']=_0x1f8666['id'];if(_0x12407e[_0x7c37('0x30')][_0x7c37('0x4a')]){_0x355984[_0x7c37('0x48')]=_[_0x7c37('0x38')](_0x355984[_0x7c37('0x48')],{'$or':_[_0x7c37('0x24')](_0x355984['attributes'],function(_0x4ec866){var _0x4639ea={};_0x4639ea[_0x4ec866]={'$like':'%'+_0x12407e[_0x7c37('0x30')]['filter']+'%'};return _0x4639ea;})});}if(_0x12407e[_0x7c37('0x30')]['$gte']){var _0x473d45=_0x12407e[_0x7c37('0x30')][_0x7c37('0x4b')][_0x7c37('0x4c')](',');var _0x18ce8e={};_0x18ce8e[_0x473d45[0x0]]={'$gte':moment(_0x473d45[0x1])['format'](_0x7c37('0x4d'))};_0x355984[_0x7c37('0x48')]=_['merge'](_0x355984[_0x7c37('0x48')],_0x18ce8e);}_0x355984=_[_0x7c37('0x38')]({},_0x355984,_0x12407e['options']);return db[_0x7c37('0x3f')][_0x7c37('0x4e')]({'where':_0x355984[_0x7c37('0x48')]})[_0x7c37('0x1e')](function(_0x595249){_0x52c919[_0x7c37('0x4e')]=_0x595249;if(_0x12407e['query']['includeAll']){_0x355984[_0x7c37('0x37')]=[{'all':!![]}];}return db['MailMessage'][_0x7c37('0x2b')](_0x355984);})[_0x7c37('0x1e')](function(_0x5e5ab2){if(_0x12407e[_0x7c37('0x30')][_0x7c37('0x4f')]==='true'){for(var _0x376fc7=0x0;_0x376fc7<_0x5e5ab2[_0x7c37('0x35')];_0x376fc7++){_0x5e5ab2[_0x376fc7][_0x7c37('0x3c')]=juice(_0x5e5ab2[_0x376fc7][_0x7c37('0x3c')]);}}_0x52c919[_0x7c37('0x50')]=_0x5e5ab2;return _0x52c919;});}})[_0x7c37('0x1e')](respondWithFilteredResult(_0x15f9e3,_0x355984))[_0x7c37('0x2d')](handleError(_0x15f9e3,null));};exports[_0x7c37('0x51')]=function(_0x11e974,_0x309891){return db[_0x7c37('0x25')][_0x7c37('0x3a')]({'where':{'id':_0x11e974[_0x7c37('0x3d')]['id']}})[_0x7c37('0x1e')](handleEntityNotFound(_0x309891,null))[_0x7c37('0x1e')](function(_0x15ab56){if(_0x15ab56){return _0x15ab56[_0x7c37('0x52')](_0x11e974[_0x7c37('0x3c')][_0x7c37('0x41')],_[_0x7c37('0x40')](_0x11e974[_0x7c37('0x3c')],['ids','id'])||{})[_0x7c37('0x53')](function(){return db[_0x7c37('0x54')][_0x7c37('0x2b')]({'attributes':['id',_0x7c37('0x22'),_0x7c37('0x55')],'where':{'id':_0x11e974[_0x7c37('0x3c')]['ids']}});})['then'](function(_0x4855e){socket[_0x7c37('0x56')](_0x7c37('0x57'),{'id':Number(_0x11e974[_0x7c37('0x3d')]['id']),'tags':_0x4855e||[]});return{'id':Number(_0x11e974[_0x7c37('0x3d')]['id']),'tags':_0x4855e||[]};});}})[_0x7c37('0x1e')](respondWithResult(_0x309891,null))[_0x7c37('0x2d')](handleError(_0x309891,null));};exports[_0x7c37('0x58')]=function(_0xf5bd6f,_0x3338cf){return db[_0x7c37('0x25')]['find']({'where':{'id':_0xf5bd6f[_0x7c37('0x3d')]['id']}})['then'](handleEntityNotFound(_0x3338cf,null))[_0x7c37('0x1e')](function(_0x4ca1f8){if(_0x4ca1f8){return _0x4ca1f8[_0x7c37('0x58')](_0xf5bd6f[_0x7c37('0x30')][_0x7c37('0x41')]);}})['then'](respondWithStatusCode(_0x3338cf,null))[_0x7c37('0x2d')](handleError(_0x3338cf,null));};exports[_0x7c37('0x59')]=function(_0x10fb7e,_0x1c0d66){var _0x3b593c=moment()[_0x7c37('0x5a')]()[_0x7c37('0x5b')]();var _0x8b80b9=path[_0x7c37('0x5c')](config[_0x7c37('0x5d')],'server',_0x7c37('0x5e'),_0x7c37('0x5f'));var _0x8ec1d4=path[_0x7c37('0x5c')](config[_0x7c37('0x5d')],'server','files','attachments');var _0x4a0706=path[_0x7c37('0x5c')](_0x8b80b9,_0x3b593c);var _0x468dab=util[_0x7c37('0x60')](_0x7c37('0x61'),_0x10fb7e['params']['id'],_0x3b593c);var _0x584b0b=path[_0x7c37('0x5c')](_0x8b80b9,_0x468dab);var _0x3d727f=[];if(_0x10fb7e['query'][_0x7c37('0x62')]){_0x3d727f[_0x7c37('0x63')]({'model':db[_0x7c37('0x64')],'as':_0x7c37('0x65'),'raw':!![]});}var _0x1dd7d8=[{'model':db['MailMessage'],'as':_0x7c37('0x66'),'attributes':['id','body',_0x7c37('0x67'),'to','cc','bcc',_0x7c37('0x68'),_0x7c37('0x69')],'where':{'secret':![]},'order':qs[_0x7c37('0x47')]('id'),'include':_0x3d727f}];return db['MailInteraction'][_0x7c37('0x3a')]({'where':{'id':_0x10fb7e[_0x7c37('0x3d')]['id']},'include':_0x1dd7d8})['then'](handleEntityNotFound(_0x1c0d66,null))['then'](function(_0x46e0a1){if(_0x46e0a1&&_0x46e0a1[_0x7c37('0x66')]){var _0x1c9bcb=_0x46e0a1[_0x7c37('0x6a')]({'plain':!![]});fs[_0x7c37('0x6b')](_0x4a0706);return BPromise[_0x7c37('0x6c')](_0x1c9bcb[_0x7c37('0x66')],function(_0x137d4d,_0x369688){var _0x43ca7a={'from':_0x137d4d[_0x7c37('0x67')],'to':_0x137d4d['to']||'missing.recipient@your.company.com','subject':_0x137d4d[_0x7c37('0x68')],'html':htmlEntities[_0x7c37('0x6d')](_0x137d4d[_0x7c37('0x3c')]),'headers':{'Date':moment(_0x137d4d[_0x7c37('0x69')])['format'](_0x7c37('0x6e'))},'attachments':[]};if(_0x137d4d['cc']){_0x43ca7a[_0x7c37('0x6f')]['Cc']=_0x137d4d['cc'];}if(_0x137d4d[_0x7c37('0x70')]){_0x43ca7a[_0x7c37('0x6f')][_0x7c37('0x71')]=_0x137d4d[_0x7c37('0x70')];}return new BPromise(function(_0x91717c,_0xe0f1ed){if(_0x137d4d[_0x7c37('0x65')]){for(var _0x2fc30b=0x0;_0x2fc30b<_0x137d4d['Attachments']['length'];_0x2fc30b++){var _0x82eab0=_0x137d4d[_0x7c37('0x65')][_0x2fc30b];var _0x2e3178=path[_0x7c37('0x5c')](_0x8ec1d4,_0x82eab0[_0x7c37('0x72')]);if(fs['existsSync'](_0x2e3178)){_0x43ca7a[_0x7c37('0x62')][_0x7c37('0x63')]({'name':_0x82eab0[_0x7c37('0x22')],'contentType':_0x82eab0[_0x7c37('0x28')],'data':fs['readFileSync'](_0x2e3178)});}}}emlformat[_0x7c37('0x73')](_0x43ca7a,function(_0x3584c0,_0x1bcf03){if(_0x3584c0)return _0xe0f1ed(_0x3584c0);fs[_0x7c37('0x74')](path[_0x7c37('0x5c')](_0x4a0706,util[_0x7c37('0x60')](_0x7c37('0x75'),_0x369688)),_0x1bcf03);return _0x91717c(_0x1bcf03);});});})[_0x7c37('0x1e')](function(){return new BPromise(function(_0x207410,_0x1908d8){zipdir(_0x4a0706,{'saveTo':_0x584b0b},function(_0xdf8bdc,_0x52f4ce){if(_0xdf8bdc)return _0x1908d8(_0xdf8bdc);return _0x207410(_0x52f4ce);});})['then'](function(){return new BPromise(function(_0x1ece52,_0x2d071f){rimraf(_0x4a0706,function(_0x5608d9){if(_0x5608d9)_0x2d071f(_0x5608d9);return _0x1ece52();});});})[_0x7c37('0x1e')](function(){return _0x1c0d66[_0x7c37('0x59')](_0x584b0b,_0x468dab,function(_0x2ac239){if(!_0x2ac239)fs['unlinkSync'](_0x584b0b);});});});}else{return _0x1c0d66[_0x7c37('0x14')](0xc8);}})[_0x7c37('0x2d')](handleError(_0x1c0d66,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 11b239f..3263336 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 _0xf0b7=['hook','exports','../../mysqldb','MailInteraction','MailMessage','setMaxListeners','save','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch'];(function(_0x52ad4a,_0x123add){var _0x3f3a81=function(_0x2d2186){while(--_0x2d2186){_0x52ad4a['push'](_0x52ad4a['shift']());}};_0x3f3a81(++_0x123add);}(_0xf0b7,0xec));var _0x7f0b=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xf0b7[_0x17d9e3];return _0x14192d;};'use strict';var EventEmitter=require('events');var MailInteraction=require(_0x7f0b('0x0'))['db'][_0x7f0b('0x1')];var MailMessage=require(_0x7f0b('0x0'))['db'][_0x7f0b('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x7f0b('0x3')](0x0);var events={'afterCreate':_0x7f0b('0x4'),'afterUpdate':'update','afterDestroy':_0x7f0b('0x5')};function emitEvent(_0xafc2d5){return function(_0x2e79a6,_0xb7a70d,_0x3ee0e1){_0x2e79a6[_0x7f0b('0x6')]({'attributes':['id'],'raw':!![]})[_0x7f0b('0x7')](function(_0x45c77e){_0x2e79a6[_0x7f0b('0x8')](_0x7f0b('0x9'),_0x45c77e[_0x7f0b('0xa')](function(_0x12881c){return{'id':_0x12881c['id']};}));return MailMessage[_0x7f0b('0xb')]({'where':{'MailInteractionId':_0x2e79a6['id'],'direction':'in','read':![]},'raw':!![]});})[_0x7f0b('0x7')](function(_0x46d741){_0x2e79a6[_0x7f0b('0x8')](_0x7f0b('0xc'),_0x46d741[_0x7f0b('0xd')]);MailInteractionEvents['emit'](_0xafc2d5+':'+_0x2e79a6['id'],_0x2e79a6);MailInteractionEvents[_0x7f0b('0xe')](_0xafc2d5,_0x2e79a6);_0x3ee0e1(null);})[_0x7f0b('0xf')](_0x3ee0e1(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0x7f0b('0x10')](e,emitEvent(event));}}module[_0x7f0b('0x11')]=MailInteractionEvents; \ No newline at end of file +var _0x13f2=['findAll','length','catch','hasOwnProperty','hook','exports','../../mysqldb','MailInteraction','MailMessage','setMaxListeners','save','update','getUsers','setDataValue','Users','map'];(function(_0x20a0fc,_0x517aa3){var _0x551f1d=function(_0x53112a){while(--_0x53112a){_0x20a0fc['push'](_0x20a0fc['shift']());}};_0x551f1d(++_0x517aa3);}(_0x13f2,0x146));var _0x213f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x13f2[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var MailInteraction=require(_0x213f('0x0'))['db'][_0x213f('0x1')];var MailMessage=require(_0x213f('0x0'))['db'][_0x213f('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x213f('0x3')](0x0);var events={'afterCreate':_0x213f('0x4'),'afterUpdate':_0x213f('0x5'),'afterDestroy':'remove'};function emitEvent(_0x47c7d7){return function(_0x243c58,_0x1f1044,_0x3b5e82){_0x243c58[_0x213f('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x37b5b0){_0x243c58[_0x213f('0x7')](_0x213f('0x8'),_0x37b5b0[_0x213f('0x9')](function(_0x5e17ea){return{'id':_0x5e17ea['id']};}));return MailMessage[_0x213f('0xa')]({'where':{'MailInteractionId':_0x243c58['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x29b155){_0x243c58['setDataValue']('unreadMessages',_0x29b155[_0x213f('0xb')]);MailInteractionEvents['emit'](_0x47c7d7+':'+_0x243c58['id'],_0x243c58);MailInteractionEvents['emit'](_0x47c7d7,_0x243c58);_0x3b5e82(null);})[_0x213f('0xc')](_0x3b5e82(null));};}for(var e in events){if(events[_0x213f('0xd')](e)){var event=events[e];MailInteraction[_0x213f('0xe')](e,emitEvent(event));}}module[_0x213f('0xf')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 60ef736..bcd79c9 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 _0xa055=['closedAt','format','YYYY-MM-DD\x20HH:mm:ss','changed','get','MailMessage','then','utf8mb4','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./mailInteraction.attributes','define','MailInteraction','fti_mail_interactions','FULLTEXT','substatus','substatusAt','closed'];(function(_0xa06587,_0x3f753f){var _0x10344d=function(_0x2a25a8){while(--_0x2a25a8){_0xa06587['push'](_0xa06587['shift']());}};_0x10344d(++_0x3f753f);}(_0xa055,0x68));var _0x5a05=function(_0x8a7e38,_0x473a5d){_0x8a7e38=_0x8a7e38-0x0;var _0x228609=_0xa055[_0x8a7e38];return _0x228609;};'use strict';var _=require(_0x5a05('0x0'));var util=require(_0x5a05('0x1'));var logger=require('../../config/logger')(_0x5a05('0x2'));var moment=require(_0x5a05('0x3'));var BPromise=require(_0x5a05('0x4'));var rp=require(_0x5a05('0x5'));var fs=require('fs');var path=require(_0x5a05('0x6'));var rimraf=require('rimraf');var config=require(_0x5a05('0x7'));var attributes=require(_0x5a05('0x8'));module['exports']=function(_0x2c7170,_0x4fcb68){return _0x2c7170[_0x5a05('0x9')](_0x5a05('0xa'),attributes,{'tableName':'mail_interactions','paranoid':![],'indexes':[{'name':_0x5a05('0xb'),'fields':['subject','to'],'type':_0x5a05('0xc')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0xe15c3e,_0x2cfabf,_0x46e88a){if(_0xe15c3e[_0x5a05('0xd')]){_0xe15c3e[_0x5a05('0xe')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}if(_0xe15c3e[_0x5a05('0xf')]){_0xe15c3e[_0x5a05('0x10')]=moment()[_0x5a05('0x11')](_0x5a05('0x12'));}_0x46e88a(null,_0x2cfabf);},'beforeUpdate':function(_0x471d57,_0x20bb71,_0x406036){if(_0x471d57[_0x5a05('0x13')]('substatus')){_0x471d57[_0x5a05('0xe')]=_0x471d57[_0x5a05('0xd')]?moment()[_0x5a05('0x11')](_0x5a05('0x12')):null;}if(_0x471d57[_0x5a05('0x13')](_0x5a05('0xf'))){_0x471d57[_0x5a05('0x10')]=moment()[_0x5a05('0x11')](_0x5a05('0x12'));_0x471d57[_0x5a05('0xd')]=null;_0x471d57['substatusAt']=null;}_0x406036(null,_0x471d57);},'afterUpdate':function(_0x1ea11c,_0x38de3f,_0x30c7ad){var _0x5c50ab=_0x2c7170['models'];var _0x55a18b=_0x1ea11c[_0x5a05('0x14')]({'plain':!![]});if(_0x55a18b[_0x5a05('0xf')]){return _0x5c50ab[_0x5a05('0x15')]['update']({'read':!![]},{'where':{'MailInteractionId':_0x55a18b['id']}})[_0x5a05('0x16')](function(){_0x30c7ad();})['catch'](function(_0x3c4813){_0x30c7ad(_0x3c4813);});}else{_0x30c7ad();}}},'charset':_0x5a05('0x17'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xf58d=['substatus','format','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','changed','substatusAt','models','get','MailMessage','then','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./mailInteraction.attributes','exports','MailInteraction','mail_interactions','fti_mail_interactions','subject','FULLTEXT'];(function(_0x1dc747,_0x141403){var _0x241ae6=function(_0x382569){while(--_0x382569){_0x1dc747['push'](_0x1dc747['shift']());}};_0x241ae6(++_0x141403);}(_0xf58d,0x15d));var _0xdf58=function(_0x11d5e2,_0x35997c){_0x11d5e2=_0x11d5e2-0x0;var _0x2823c7=_0xf58d[_0x11d5e2];return _0x2823c7;};'use strict';var _=require(_0xdf58('0x0'));var util=require(_0xdf58('0x1'));var logger=require(_0xdf58('0x2'))(_0xdf58('0x3'));var moment=require(_0xdf58('0x4'));var BPromise=require('bluebird');var rp=require(_0xdf58('0x5'));var fs=require('fs');var path=require(_0xdf58('0x6'));var rimraf=require(_0xdf58('0x7'));var config=require('../../config/environment');var attributes=require(_0xdf58('0x8'));module[_0xdf58('0x9')]=function(_0x283c4c,_0x190d98){return _0x283c4c['define'](_0xdf58('0xa'),attributes,{'tableName':_0xdf58('0xb'),'paranoid':![],'indexes':[{'name':_0xdf58('0xc'),'fields':[_0xdf58('0xd'),'to'],'type':_0xdf58('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x340c1a,_0x4d056e,_0x3e2ede){if(_0x340c1a[_0xdf58('0xf')]){_0x340c1a['substatusAt']=moment()[_0xdf58('0x10')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x340c1a[_0xdf58('0x11')]){_0x340c1a[_0xdf58('0x12')]=moment()[_0xdf58('0x10')](_0xdf58('0x13'));}_0x3e2ede(null,_0x4d056e);},'beforeUpdate':function(_0x5aebb5,_0x372fe8,_0x39b99f){if(_0x5aebb5[_0xdf58('0x14')]('substatus')){_0x5aebb5[_0xdf58('0x15')]=_0x5aebb5[_0xdf58('0xf')]?moment()['format'](_0xdf58('0x13')):null;}if(_0x5aebb5['changed'](_0xdf58('0x11'))){_0x5aebb5['closedAt']=moment()[_0xdf58('0x10')](_0xdf58('0x13'));_0x5aebb5[_0xdf58('0xf')]=null;_0x5aebb5['substatusAt']=null;}_0x39b99f(null,_0x5aebb5);},'afterUpdate':function(_0x323ae2,_0x1be9fd,_0x541ccd){var _0x51c161=_0x283c4c[_0xdf58('0x16')];var _0x433810=_0x323ae2[_0xdf58('0x17')]({'plain':!![]});if(_0x433810[_0xdf58('0x11')]){return _0x51c161[_0xdf58('0x18')]['update']({'read':!![]},{'where':{'MailInteractionId':_0x433810['id']}})[_0xdf58('0x19')](function(){_0x541ccd();})['catch'](function(_0x15e4ce){_0x541ccd(_0x15e4ce);});}else{_0x541ccd();}}},'charset':_0xdf58('0x1a'),'collate':_0xdf58('0x1b')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 8b10071..847a116 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 _0x58b4=['info','MailInteraction,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','UpdateMailInteraction','options','raw','where','attributes','AddTagsToMailInteraction','MailInteraction','addTags','ids','omit','body','spread','AddTags','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','register','then'];(function(_0x1b37ca,_0x38ac2d){var _0x3bbcca=function(_0x2852cd){while(--_0x2852cd){_0x1b37ca['push'](_0x1b37ca['shift']());}};_0x3bbcca(++_0x38ac2d);}(_0x58b4,0xb7));var _0x458b=function(_0xbfabe2,_0x59823f){_0xbfabe2=_0xbfabe2-0x0;var _0x100aec=_0x58b4[_0xbfabe2];return _0x100aec;};'use strict';var _=require('lodash');var util=require(_0x458b('0x0'));var moment=require(_0x458b('0x1'));var BPromise=require(_0x458b('0x2'));var rs=require(_0x458b('0x3'));var fs=require('fs');var Redis=require(_0x458b('0x4'));var db=require(_0x458b('0x5'))['db'];var utils=require(_0x458b('0x6'));var logger=require(_0x458b('0x7'))(_0x458b('0x8'));var config=require('../../config/environment');var jayson=require(_0x458b('0x9'));var client=jayson[_0x458b('0xa')][_0x458b('0xb')]({'port':0x232a});config[_0x458b('0xc')]=_[_0x458b('0xd')](config[_0x458b('0xc')],{'host':_0x458b('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x458b('0xc')]));require('./mailInteraction.socket')[_0x458b('0xf')](socket);function respondWithRpcPromise(_0x3808d1,_0x34e0d1,_0x40031a){return new BPromise(function(_0x1e2c50,_0x3aeb9f){return client['request'](_0x3808d1,_0x40031a)[_0x458b('0x10')](function(_0x2b2bee){logger[_0x458b('0x11')](_0x458b('0x12'),_0x34e0d1,'request\x20sent');logger[_0x458b('0x13')]('MailInteraction,\x20%s,\x20%s,\x20%s',_0x34e0d1,_0x458b('0x14'),JSON[_0x458b('0x15')](_0x2b2bee));if(_0x2b2bee['error']){if(_0x2b2bee[_0x458b('0x16')][_0x458b('0x17')]===0x1f4){logger[_0x458b('0x16')]('MailInteraction,\x20%s,\x20%s',_0x34e0d1,_0x2b2bee[_0x458b('0x16')][_0x458b('0x18')]);return _0x3aeb9f(_0x2b2bee[_0x458b('0x16')][_0x458b('0x18')]);}logger[_0x458b('0x16')](_0x458b('0x12'),_0x34e0d1,_0x2b2bee[_0x458b('0x16')][_0x458b('0x18')]);return _0x1e2c50(_0x2b2bee[_0x458b('0x16')]['message']);}else{logger['info']('MailInteraction,\x20%s,\x20%s',_0x34e0d1,_0x458b('0x14'));_0x1e2c50(_0x2b2bee[_0x458b('0x19')]['message']);}})[_0x458b('0x1a')](function(_0x5c8c6e){logger[_0x458b('0x16')]('MailInteraction,\x20%s,\x20%s',_0x34e0d1,_0x5c8c6e);_0x3aeb9f(_0x5c8c6e);});});}exports[_0x458b('0x1b')]=function(_0x5006a5){var _0x20ba43=this;return new Promise(function(_0x4bd98c,_0x25ef98){return db['MailInteraction']['update'](_0x5006a5['body'],{'raw':_0x5006a5[_0x458b('0x1c')]?_0x5006a5[_0x458b('0x1c')][_0x458b('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5006a5[_0x458b('0x1c')]?_0x5006a5[_0x458b('0x1c')][_0x458b('0x1e')]||null:null,'attributes':_0x5006a5[_0x458b('0x1c')]?_0x5006a5[_0x458b('0x1c')][_0x458b('0x1f')]||null:null,'limit':_0x5006a5[_0x458b('0x1c')]?_0x5006a5[_0x458b('0x1c')]['limit']||null:null})['then'](function(_0x5e5c8f){logger[_0x458b('0x11')](_0x458b('0x1b'),_0x5006a5);logger[_0x458b('0x13')](_0x458b('0x1b'),_0x5006a5,JSON['stringify'](_0x5e5c8f));_0x4bd98c(_0x5e5c8f);})[_0x458b('0x1a')](function(_0x1c9503){logger[_0x458b('0x16')](_0x458b('0x1b'),_0x1c9503[_0x458b('0x18')],_0x5006a5);_0x25ef98(_0x20ba43[_0x458b('0x16')](0x1f4,_0x1c9503[_0x458b('0x18')]));});});};exports[_0x458b('0x20')]=function(_0x572398){return new Promise(function(_0x4b751d,_0x3062e7){return db[_0x458b('0x21')]['find']({'where':_0x572398[_0x458b('0x1c')]?_0x572398[_0x458b('0x1c')][_0x458b('0x1e')]||null:null})['then'](function(_0x129266){if(_0x129266){return _0x129266[_0x458b('0x22')](_0x572398['body'][_0x458b('0x23')],_[_0x458b('0x24')](_0x572398[_0x458b('0x25')],[_0x458b('0x23'),'id'])||{});}})[_0x458b('0x26')](function(_0x40ad8d){logger[_0x458b('0x11')](_0x458b('0x27'),_0x572398);logger[_0x458b('0x13')](_0x458b('0x27'),_0x572398,JSON[_0x458b('0x15')](_0x40ad8d));_0x4b751d(_0x40ad8d);})[_0x458b('0x1a')](function(_0xcf1d5e){logger[_0x458b('0x16')]('AddTags',_0xcf1d5e['message'],_0x572398);_0x3062e7(_this['error'](0x1f4,_0xcf1d5e[_0x458b('0x18')]));});});}; \ No newline at end of file +var _0xf69d=['../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','request','then','MailInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','MailInteraction,\x20%s,\x20%s','message','info','catch','UpdateMailInteraction','body','options','where','attributes','AddTagsToMailInteraction','MailInteraction','find','addTags','ids','omit','spread','debug','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x554247,_0x367fda){var _0x469992=function(_0x5d643f){while(--_0x5d643f){_0x554247['push'](_0x554247['shift']());}};_0x469992(++_0x367fda);}(_0xf69d,0xd3));var _0xdf69=function(_0x226536,_0x37a2f8){_0x226536=_0x226536-0x0;var _0x2c8fe9=_0xf69d[_0x226536];return _0x2c8fe9;};'use strict';var _=require(_0xdf69('0x0'));var util=require(_0xdf69('0x1'));var moment=require(_0xdf69('0x2'));var BPromise=require(_0xdf69('0x3'));var rs=require(_0xdf69('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdf69('0x5'))['db'];var utils=require(_0xdf69('0x6'));var logger=require(_0xdf69('0x7'))(_0xdf69('0x8'));var config=require(_0xdf69('0x9'));var jayson=require(_0xdf69('0xa'));var client=jayson[_0xdf69('0xb')][_0xdf69('0xc')]({'port':0x232a});config[_0xdf69('0xd')]=_[_0xdf69('0xe')](config[_0xdf69('0xd')],{'host':_0xdf69('0xf'),'port':0x18eb});var socket=require(_0xdf69('0x10'))(new Redis(config[_0xdf69('0xd')]));require(_0xdf69('0x11'))[_0xdf69('0x12')](socket);function respondWithRpcPromise(_0x1e0e8d,_0x4fcc93,_0x305726){return new BPromise(function(_0x420011,_0x20cc6c){return client[_0xdf69('0x13')](_0x1e0e8d,_0x305726)[_0xdf69('0x14')](function(_0x1b86d4){logger['info']('MailInteraction,\x20%s,\x20%s',_0x4fcc93,'request\x20sent');logger['debug'](_0xdf69('0x15'),_0x4fcc93,_0xdf69('0x16'),JSON[_0xdf69('0x17')](_0x1b86d4));if(_0x1b86d4[_0xdf69('0x18')]){if(_0x1b86d4[_0xdf69('0x18')][_0xdf69('0x19')]===0x1f4){logger['error'](_0xdf69('0x1a'),_0x4fcc93,_0x1b86d4[_0xdf69('0x18')][_0xdf69('0x1b')]);return _0x20cc6c(_0x1b86d4[_0xdf69('0x18')]['message']);}logger[_0xdf69('0x18')]('MailInteraction,\x20%s,\x20%s',_0x4fcc93,_0x1b86d4[_0xdf69('0x18')][_0xdf69('0x1b')]);return _0x420011(_0x1b86d4['error'][_0xdf69('0x1b')]);}else{logger[_0xdf69('0x1c')](_0xdf69('0x1a'),_0x4fcc93,_0xdf69('0x16'));_0x420011(_0x1b86d4['result']['message']);}})[_0xdf69('0x1d')](function(_0x15e73a){logger['error'](_0xdf69('0x1a'),_0x4fcc93,_0x15e73a);_0x20cc6c(_0x15e73a);});});}exports[_0xdf69('0x1e')]=function(_0x68fa80){var _0x526cbc=this;return new Promise(function(_0x4776df,_0x452cfa){return db['MailInteraction']['update'](_0x68fa80[_0xdf69('0x1f')],{'raw':_0x68fa80[_0xdf69('0x20')]?_0x68fa80[_0xdf69('0x20')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x68fa80['options']?_0x68fa80['options'][_0xdf69('0x21')]||null:null,'attributes':_0x68fa80['options']?_0x68fa80[_0xdf69('0x20')][_0xdf69('0x22')]||null:null,'limit':_0x68fa80[_0xdf69('0x20')]?_0x68fa80['options']['limit']||null:null})[_0xdf69('0x14')](function(_0x1437f6){logger[_0xdf69('0x1c')](_0xdf69('0x1e'),_0x68fa80);logger['debug'](_0xdf69('0x1e'),_0x68fa80,JSON[_0xdf69('0x17')](_0x1437f6));_0x4776df(_0x1437f6);})[_0xdf69('0x1d')](function(_0x5969cb){logger[_0xdf69('0x18')]('UpdateMailInteraction',_0x5969cb['message'],_0x68fa80);_0x452cfa(_0x526cbc['error'](0x1f4,_0x5969cb['message']));});});};exports[_0xdf69('0x23')]=function(_0xe339ac){return new Promise(function(_0x4fc007,_0x301bd2){return db[_0xdf69('0x24')][_0xdf69('0x25')]({'where':_0xe339ac[_0xdf69('0x20')]?_0xe339ac[_0xdf69('0x20')][_0xdf69('0x21')]||null:null})[_0xdf69('0x14')](function(_0x16b3ee){if(_0x16b3ee){return _0x16b3ee[_0xdf69('0x26')](_0xe339ac[_0xdf69('0x1f')][_0xdf69('0x27')],_[_0xdf69('0x28')](_0xe339ac[_0xdf69('0x1f')],[_0xdf69('0x27'),'id'])||{});}})[_0xdf69('0x29')](function(_0x31cee5){logger[_0xdf69('0x1c')]('AddTags',_0xe339ac);logger[_0xdf69('0x2a')](_0xdf69('0x2b'),_0xe339ac,JSON[_0xdf69('0x17')](_0x31cee5));_0x4fc007(_0x31cee5);})[_0xdf69('0x1d')](function(_0x1a23d1){logger['error'](_0xdf69('0x2b'),_0x1a23d1['message'],_0xe339ac);_0x301bd2(_this[_0xdf69('0x18')](0x1f4,_0x1a23d1[_0xdf69('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 9b83303..9cd45ad 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 _0xef3a=['remove','update','emit','register','length','./mailInteraction.events','save'];(function(_0x2e72c9,_0x3e3787){var _0x4a7e3b=function(_0x506fe3){while(--_0x506fe3){_0x2e72c9['push'](_0x2e72c9['shift']());}};_0x4a7e3b(++_0x3e3787);}(_0xef3a,0xc2));var _0xaef3=function(_0x118653,_0x50ef26){_0x118653=_0x118653-0x0;var _0xc11fa6=_0xef3a[_0x118653];return _0xc11fa6;};'use strict';var MailInteractionEvents=require(_0xaef3('0x0'));var events=[_0xaef3('0x1'),_0xaef3('0x2'),_0xaef3('0x3')];function createListener(_0x1b82c5,_0x2507bc){return function(_0x24cf10){_0x2507bc[_0xaef3('0x4')](_0x1b82c5,_0x24cf10);};}function removeListener(_0x13b0f7,_0x3522e6){return function(){MailInteractionEvents['removeListener'](_0x13b0f7,_0x3522e6);};}exports[_0xaef3('0x5')]=function(_0x32fc90){for(var _0x25e363=0x0,_0xdc9157=events[_0xaef3('0x6')];_0x25e363<_0xdc9157;_0x25e363++){var _0x4753c3=events[_0x25e363];var _0x111eb7=createListener('mailInteraction:'+_0x4753c3,_0x32fc90);MailInteractionEvents['on'](_0x4753c3,_0x111eb7);}}; \ No newline at end of file +var _0x1ed8=['mailInteraction:','save','update','emit','register','length'];(function(_0x4a245a,_0x118e63){var _0x26286e=function(_0x595812){while(--_0x595812){_0x4a245a['push'](_0x4a245a['shift']());}};_0x26286e(++_0x118e63);}(_0x1ed8,0x157));var _0x81ed=function(_0x3524b4,_0x144e7b){_0x3524b4=_0x3524b4-0x0;var _0x15c122=_0x1ed8[_0x3524b4];return _0x15c122;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=[_0x81ed('0x0'),'remove',_0x81ed('0x1')];function createListener(_0x2cf5ab,_0x11292e){return function(_0x439214){_0x11292e[_0x81ed('0x2')](_0x2cf5ab,_0x439214);};}function removeListener(_0xbea08d,_0x5f0eca){return function(){MailInteractionEvents['removeListener'](_0xbea08d,_0x5f0eca);};}exports[_0x81ed('0x3')]=function(_0xe524d3){for(var _0x47b7d1=0x0,_0x5bf77b=events[_0x81ed('0x4')];_0x47b7d1<_0x5bf77b;_0x47b7d1++){var _0x15f560=events[_0x47b7d1];var _0x427b33=createListener(_0x81ed('0x5')+_0x15f560,_0xe524d3);MailInteractionEvents['on'](_0x15f560,_0x427b33);}}; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/index.js b/server/api/mailInteractionHasTag/index.js index b28c352..c87e76b 100644 --- a/server/api/mailInteractionHasTag/index.js +++ b/server/api/mailInteractionHasTag/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc130=['../../components/auth/service','./mailInteractionHasTag.controller','get','/describe','isAuthenticated','describe','exports','express','Router'];(function(_0xfaa5e5,_0x13edad){var _0x4c0e1d=function(_0x4fb8d1){while(--_0x4fb8d1){_0xfaa5e5['push'](_0xfaa5e5['shift']());}};_0x4c0e1d(++_0x13edad);}(_0xc130,0x7c));var _0x0c13=function(_0x5e5168,_0x479061){_0x5e5168=_0x5e5168-0x0;var _0x380924=_0xc130[_0x5e5168];return _0x380924;};'use strict';var express=require(_0x0c13('0x0'));var router=express[_0x0c13('0x1')]();var auth=require(_0x0c13('0x2'));var controller=require(_0x0c13('0x3'));router[_0x0c13('0x4')](_0x0c13('0x5'),auth[_0x0c13('0x6')](),controller[_0x0c13('0x7')]);module[_0x0c13('0x8')]=router; \ No newline at end of file +var _0xa0a1=['../../components/auth/service','./mailInteractionHasTag.controller','get','describe','exports','express'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0xa0a1,0x15b));var _0x1a0a=function(_0xd8b0c5,_0x4784e5){_0xd8b0c5=_0xd8b0c5-0x0;var _0x5e769f=_0xa0a1[_0xd8b0c5];return _0x5e769f;};'use strict';var express=require(_0x1a0a('0x0'));var router=express['Router']();var auth=require(_0x1a0a('0x1'));var controller=require(_0x1a0a('0x2'));router[_0x1a0a('0x3')]('/describe',auth['isAuthenticated'](),controller[_0x1a0a('0x4')]);module[_0x1a0a('0x5')]=router; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js b/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js index ad035dc..1b10bbb 100644 --- a/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js +++ b/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['catch','../../config/logger','api','../../mysqldb','json','error','name','status','describe','then'];(function(_0x37ce97,_0xcbc261){var _0x590daa=function(_0x53a879){while(--_0x53a879){_0x37ce97['push'](_0x37ce97['shift']());}};_0x590daa(++_0xcbc261);}(_0xa9e0,0x123));var _0x0a9e=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xa9e0[_0x484e36];return _0xafc85d;};'use strict';var logger=require(_0x0a9e('0x0'))(_0x0a9e('0x1'));var db=require(_0x0a9e('0x2'))['db'];function respondWithResult(_0x5dd881,_0x550fbc){_0x550fbc=_0x550fbc||0xc8;return function(_0x18d5c9){if(_0x18d5c9){return _0x5dd881['status'](_0x550fbc)[_0x0a9e('0x3')](_0x18d5c9);}};}function handleError(_0x432180,_0x2ab90b){_0x2ab90b=_0x2ab90b||0x1f4;return function(_0x991246){logger[_0x0a9e('0x4')](_0x991246['stack']);if(_0x991246[_0x0a9e('0x5')]){delete _0x991246[_0x0a9e('0x5')];}_0x432180[_0x0a9e('0x6')](_0x2ab90b)['send'](_0x991246);};}exports['describe']=function(_0xe42b77,_0x56465b){return db['MailInteractionHasTag'][_0x0a9e('0x7')]()[_0x0a9e('0x8')](respondWithResult(_0x56465b,null))[_0x0a9e('0x9')](handleError(_0x56465b,null));}; \ No newline at end of file +var _0xa9e0=['catch','../../config/logger','api','../../mysqldb','json','error','name','status','describe','then'];(function(_0x3df1bc,_0x4c2da5){var _0x58f0d9=function(_0x224e89){while(--_0x224e89){_0x3df1bc['push'](_0x3df1bc['shift']());}};_0x58f0d9(++_0x4c2da5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xa9e0[_0x3c2a69];return _0x596bc8;};'use strict';var logger=require(_0x0a9e('0x0'))(_0x0a9e('0x1'));var db=require(_0x0a9e('0x2'))['db'];function respondWithResult(_0x5dd881,_0x550fbc){_0x550fbc=_0x550fbc||0xc8;return function(_0x18d5c9){if(_0x18d5c9){return _0x5dd881['status'](_0x550fbc)[_0x0a9e('0x3')](_0x18d5c9);}};}function handleError(_0x432180,_0x2ab90b){_0x2ab90b=_0x2ab90b||0x1f4;return function(_0x991246){logger[_0x0a9e('0x4')](_0x991246['stack']);if(_0x991246[_0x0a9e('0x5')]){delete _0x991246[_0x0a9e('0x5')];}_0x432180[_0x0a9e('0x6')](_0x2ab90b)['send'](_0x991246);};}exports['describe']=function(_0xe42b77,_0x56465b){return db['MailInteractionHasTag'][_0x0a9e('0x7')]()[_0x0a9e('0x8')](respondWithResult(_0x56465b,null))[_0x0a9e('0x9')](handleError(_0x56465b,null));}; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/mailInteractionHasTag.js b/server/api/mailInteractionHasTag/mailInteractionHasTag.js index 44602fc..0f77788 100644 --- a/server/api/mailInteractionHasTag/mailInteractionHasTag.js +++ b/server/api/mailInteractionHasTag/mailInteractionHasTag.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xed70=['INTEGER','exports'];(function(_0x44c296,_0x449415){var _0x1b9b44=function(_0x2f3194){while(--_0x2f3194){_0x44c296['push'](_0x44c296['shift']());}};_0x1b9b44(++_0x449415);}(_0xed70,0xa1));var _0x0ed7=function(_0x13544b,_0x25fcd3){_0x13544b=_0x13544b-0x0;var _0x1f4ee4=_0xed70[_0x13544b];return _0x1f4ee4;};'use strict';var Sequelize=require('sequelize');module[_0x0ed7('0x0')]={'MailInteractionId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'TagId':{'type':Sequelize[_0x0ed7('0x1')],'defaultValue':null}}; \ No newline at end of file +var _0x526d=['sequelize','exports','INTEGER'];(function(_0x390a19,_0x5dd137){var _0x5d8230=function(_0x2e6234){while(--_0x2e6234){_0x390a19['push'](_0x390a19['shift']());}};_0x5d8230(++_0x5dd137);}(_0x526d,0x1b3));var _0xd526=function(_0x22bdec,_0x184bc2){_0x22bdec=_0x22bdec-0x0;var _0x23b2a5=_0x526d[_0x22bdec];return _0x23b2a5;};'use strict';var Sequelize=require(_0xd526('0x0'));module[_0xd526('0x1')]={'MailInteractionId':{'type':Sequelize[_0xd526('0x2')],'primaryKey':!![]},'TagId':{'type':Sequelize[_0xd526('0x2')],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js b/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js index ecf8d65..2368205 100644 --- a/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js +++ b/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd724=['exports','define','MailInteractionHasTag'];(function(_0x2b1f02,_0x253c90){var _0x196149=function(_0x4f5dc5){while(--_0x4f5dc5){_0x2b1f02['push'](_0x2b1f02['shift']());}};_0x196149(++_0x253c90);}(_0xd724,0x1f2));var _0x4d72=function(_0x263c5d,_0x57edc1){_0x263c5d=_0x263c5d-0x0;var _0x5c0fc2=_0xd724[_0x263c5d];return _0x5c0fc2;};'use strict';var attributes=require('./mailInteractionHasTag');module[_0x4d72('0x0')]=function(_0x4b59c3){return _0x4b59c3[_0x4d72('0x1')](_0x4d72('0x2'),attributes,{'tableName':'mail_interaction_has_tags','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6e3f=['./mailInteractionHasTag','define'];(function(_0xc241ac,_0x1da4c6){var _0x246556=function(_0x5c0a51){while(--_0x5c0a51){_0xc241ac['push'](_0xc241ac['shift']());}};_0x246556(++_0x1da4c6);}(_0x6e3f,0x1a6));var _0xf6e3=function(_0x459965,_0x13b387){_0x459965=_0x459965-0x0;var _0x1dde7f=_0x6e3f[_0x459965];return _0x1dde7f;};'use strict';var attributes=require(_0xf6e3('0x0'));module['exports']=function(_0x104a38){return _0x104a38[_0xf6e3('0x1')]('MailInteractionHasTag',attributes,{'tableName':'mail_interaction_has_tags','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 6632e73..1943d60 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 _0x6c50=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','mailmessage:create','put','/:id/accept','accept','reject','delete','destroy','multer','util','path','connect-timeout'];(function(_0x595e03,_0x3d8714){var _0x484879=function(_0x1e8a1f){while(--_0x1e8a1f){_0x595e03['push'](_0x595e03['shift']());}};_0x484879(++_0x3d8714);}(_0x6c50,0xa4));var _0x06c5=function(_0x535538,_0x4b4f88){_0x535538=_0x535538-0x0;var _0x3ffee6=_0x6c50[_0x535538];return _0x3ffee6;};'use strict';var multer=require(_0x06c5('0x0'));var util=require(_0x06c5('0x1'));var path=require(_0x06c5('0x2'));var timeout=require(_0x06c5('0x3'));var express=require('express');var router=express[_0x06c5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x06c5('0x5'));var interaction=require(_0x06c5('0x6'));var config=require(_0x06c5('0x7'));var controller=require(_0x06c5('0x8'));router[_0x06c5('0x9')]('/',auth[_0x06c5('0xa')](),controller[_0x06c5('0xb')]);router[_0x06c5('0x9')](_0x06c5('0xc'),auth[_0x06c5('0xa')](),controller[_0x06c5('0xd')]);router['get'](_0x06c5('0xe'),auth[_0x06c5('0xa')](),controller[_0x06c5('0xf')]);router[_0x06c5('0x9')]('/:id/download',auth['isAuthenticated'](),controller['download']);router[_0x06c5('0x10')]('/',auth['isAuthenticated'](),interaction['tracked']('mail',_0x06c5('0x11')),controller['create']);router[_0x06c5('0x12')](_0x06c5('0xe'),auth[_0x06c5('0xa')](),controller['update']);router[_0x06c5('0x12')](_0x06c5('0x13'),auth[_0x06c5('0xa')](),controller[_0x06c5('0x14')]);router['put']('/:id/reject',auth[_0x06c5('0xa')](),controller[_0x06c5('0x15')]);router[_0x06c5('0x16')]('/:id',auth[_0x06c5('0xa')](),controller[_0x06c5('0x17')]);module['exports']=router; \ No newline at end of file +var _0x5a68=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','isAuthenticated','index','get','describe','/:id','show','/:id/download','post','mailmessage:create','update','put','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','path','connect-timeout'];(function(_0xf34109,_0x380779){var _0x570bfc=function(_0x1ad086){while(--_0x1ad086){_0xf34109['push'](_0xf34109['shift']());}};_0x570bfc(++_0x380779);}(_0x5a68,0x1ae));var _0x85a6=function(_0x59d74c,_0x311f12){_0x59d74c=_0x59d74c-0x0;var _0x2402cd=_0x5a68[_0x59d74c];return _0x2402cd;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x85a6('0x0'));var timeout=require(_0x85a6('0x1'));var express=require(_0x85a6('0x2'));var router=express[_0x85a6('0x3')]();var fs_extra=require(_0x85a6('0x4'));var auth=require(_0x85a6('0x5'));var interaction=require(_0x85a6('0x6'));var config=require(_0x85a6('0x7'));var controller=require(_0x85a6('0x8'));router['get']('/',auth[_0x85a6('0x9')](),controller[_0x85a6('0xa')]);router[_0x85a6('0xb')]('/describe',auth[_0x85a6('0x9')](),controller[_0x85a6('0xc')]);router[_0x85a6('0xb')](_0x85a6('0xd'),auth[_0x85a6('0x9')](),controller[_0x85a6('0xe')]);router[_0x85a6('0xb')](_0x85a6('0xf'),auth[_0x85a6('0x9')](),controller['download']);router[_0x85a6('0x10')]('/',auth['isAuthenticated'](),interaction['tracked']('mail',_0x85a6('0x11')),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x85a6('0x12')]);router[_0x85a6('0x13')](_0x85a6('0x14'),auth['isAuthenticated'](),controller[_0x85a6('0x15')]);router[_0x85a6('0x13')](_0x85a6('0x16'),auth[_0x85a6('0x9')](),controller[_0x85a6('0x17')]);router[_0x85a6('0x18')](_0x85a6('0xd'),auth[_0x85a6('0x9')](),controller[_0x85a6('0x19')]);module[_0x85a6('0x1a')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 0c23165..eebf242 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 _0xf315=['long','medium','BOOLEAN','out','STRING','DATE','INTEGER','ENUM','Email','Chat','sequelize','lodash','exports','TEXT'];(function(_0x184d73,_0x5869de){var _0x275f11=function(_0x2ca3bd){while(--_0x2ca3bd){_0x184d73['push'](_0x184d73['shift']());}};_0x275f11(++_0x5869de);}(_0xf315,0x130));var _0x5f31=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf315[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x5f31('0x0'));var _=require(_0x5f31('0x1'));module[_0x5f31('0x2')]={'body':{'type':Sequelize[_0x5f31('0x3')](_0x5f31('0x4')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x5f31('0x5'))},'read':{'type':Sequelize[_0x5f31('0x6')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x5f31('0x7')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x5f31('0x8')](0x1fe)},'from':{'type':Sequelize[_0x5f31('0x8')]},'to':{'type':Sequelize[_0x5f31('0x3')](_0x5f31('0x4'))},'cc':{'type':Sequelize[_0x5f31('0x3')](_0x5f31('0x4'))},'bcc':{'type':Sequelize[_0x5f31('0x3')]('long')},'subject':{'type':Sequelize[_0x5f31('0x3')]},'sentAt':{'type':Sequelize[_0x5f31('0x9')]},'attach':{'type':Sequelize[_0x5f31('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x5f31('0x6')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x5f31('0x9')]},'originTo':{'type':Sequelize[_0x5f31('0x3')](_0x5f31('0x4'))},'originCc':{'type':Sequelize[_0x5f31('0x3')](_0x5f31('0x4'))},'originChannel':{'type':Sequelize[_0x5f31('0xb')](_0x5f31('0xc'),_0x5f31('0xd')),'defaultValue':'Email','allowNull':![]}}; \ No newline at end of file +var _0x61fa=['medium','BOOLEAN','ENUM','out','STRING','long','DATE','INTEGER','Email','Chat','lodash','TEXT'];(function(_0x3b3cbb,_0x13a449){var _0x365fe9=function(_0x4b59f0){while(--_0x4b59f0){_0x3b3cbb['push'](_0x3b3cbb['shift']());}};_0x365fe9(++_0x13a449);}(_0x61fa,0x1ba));var _0xa61f=function(_0x4bc7a8,_0x501829){_0x4bc7a8=_0x4bc7a8-0x0;var _0x2bb25c=_0x61fa[_0x4bc7a8];return _0x2bb25c;};'use strict';var Sequelize=require('sequelize');var _=require(_0xa61f('0x0'));module['exports']={'body':{'type':Sequelize[_0xa61f('0x1')]('long'),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0xa61f('0x2'))},'read':{'type':Sequelize[_0xa61f('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xa61f('0x4')]('in',_0xa61f('0x5')),'defaultValue':_0xa61f('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0xa61f('0x6')](0x1fe)},'from':{'type':Sequelize[_0xa61f('0x6')]},'to':{'type':Sequelize[_0xa61f('0x1')](_0xa61f('0x7'))},'cc':{'type':Sequelize['TEXT']('long')},'bcc':{'type':Sequelize[_0xa61f('0x1')](_0xa61f('0x7'))},'subject':{'type':Sequelize[_0xa61f('0x1')]},'sentAt':{'type':Sequelize[_0xa61f('0x8')]},'attach':{'type':Sequelize[_0xa61f('0x9')],'defaultValue':0x0},'secret':{'type':Sequelize[_0xa61f('0x3')],'defaultValue':![]},'readAt':{'type':Sequelize[_0xa61f('0x8')]},'originTo':{'type':Sequelize['TEXT'](_0xa61f('0x7'))},'originCc':{'type':Sequelize['TEXT'](_0xa61f('0x7'))},'originChannel':{'type':Sequelize['ENUM'](_0xa61f('0xa'),_0xa61f('0xb')),'defaultValue':_0xa61f('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 3a04057..54e139e 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 _0xcfaf=['existsSync','push','readFileSync','build','unlinkSync','eml-format','moment','util','path','lodash','ioredis','html-to-text','../../components/interaction/service','api','../../config/logger','mail-interactions','../../config/environment','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','register','jayson/promise','http','then','info','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','MailMessage,\x20%s,\x20%s','message','result','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','end','sendStatus','stack','name','send','map','rawAttributes','fieldName','key','model','keys','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','options','MailMessage','includeAll','rows','length','include','find','catch','body','params','describe','create','out','secret','split','findOne','CmList','List','CmContact','Contacts','updatedAt','MailServerOut','Smtp','getSmtpOptions','attachments','join','server/files/attachments','ListId','SendMail','sendMail','messageId','format','accept','mail','acceptMessage','reject','UserId','agent','get','MailInteraction','MailInteractionId','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','RejectMessage','sequelize','Sequelize','QueryTypes','SELECT','contact','email','internal','SIP/%s','channel','event','fromString','EventManager','download','unix','toString','root','server','files','tmp','message-%s.eml','from','bcc','subject','createdAt','Attachment','Attachments','decode','headers','basename'];(function(_0x325654,_0x4e6fe1){var _0x994fc7=function(_0x3a0d47){while(--_0x3a0d47){_0x325654['push'](_0x325654['shift']());}};_0x994fc7(++_0x4e6fe1);}(_0xcfaf,0x125));var _0xfcfa=function(_0x17197d,_0x5dc148){_0x17197d=_0x17197d-0x0;var _0x355f4f=_0xcfaf[_0x17197d];return _0x355f4f;};'use strict';var emlformat=require(_0xfcfa('0x0'));var moment=require(_0xfcfa('0x1'));var util=require(_0xfcfa('0x2'));var path=require(_0xfcfa('0x3'));var fs=require('fs');var _=require(_0xfcfa('0x4'));var Redis=require(_0xfcfa('0x5'));var htmlToText=require(_0xfcfa('0x6'));var interactionService=require(_0xfcfa('0x7'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0xfcfa('0x8'));var interaction_log=require(_0xfcfa('0x9'))(_0xfcfa('0xa'));var config=require(_0xfcfa('0xb'));var db=require('../../mysqldb')['db'];config[_0xfcfa('0xc')]=_[_0xfcfa('0xd')](config[_0xfcfa('0xc')],{'host':_0xfcfa('0xe'),'port':0x18eb});var socket=require(_0xfcfa('0xf'))(new Redis(config[_0xfcfa('0xc')]));var htmlEntities=require('html-entities');require(_0xfcfa('0x10'))[_0xfcfa('0x11')](socket);var jayson=require(_0xfcfa('0x12'));var client=jayson['client'][_0xfcfa('0x13')]({'port':0x232c});var client9003=jayson['client']['http']({'port':0x232b});var client9002=jayson['client'][_0xfcfa('0x13')]({'port':0x232a});function respondWithRpcPromise(_0x498094,_0x2f48f8,_0x3eb956,_0x214a1f){return new Promise(function(_0x3e8186,_0x2b581e){var _0xa3feea=_0x214a1f||client;return _0xa3feea['request'](_0x498094,_0x3eb956)[_0xfcfa('0x14')](function(_0x24e4f1){logger[_0xfcfa('0x15')]('MailMessage,\x20%s,\x20%s',_0x2f48f8,_0xfcfa('0x16'));logger[_0xfcfa('0x17')](_0xfcfa('0x18'),_0x2f48f8,'request\x20sent',JSON[_0xfcfa('0x19')](_0x24e4f1));if(_0x24e4f1['error']){if(_0x24e4f1[_0xfcfa('0x1a')][_0xfcfa('0x1b')]===0x1f4){logger['error'](_0xfcfa('0x1c'),_0x2f48f8,_0x24e4f1[_0xfcfa('0x1a')]['message']);return _0x2b581e(_0x24e4f1[_0xfcfa('0x1a')][_0xfcfa('0x1d')]);}logger[_0xfcfa('0x1a')](_0xfcfa('0x1c'),_0x2f48f8,_0x24e4f1[_0xfcfa('0x1a')]['message']);return _0x3e8186(_0x24e4f1[_0xfcfa('0x1a')]['message']);}else{logger[_0xfcfa('0x15')](_0xfcfa('0x1c'),_0x2f48f8,'request\x20sent');_0x3e8186(_0x24e4f1[_0xfcfa('0x1e')]['message']);}})['catch'](function(_0x59d541){logger[_0xfcfa('0x1a')](_0xfcfa('0x1c'),_0x2f48f8,_0x59d541);_0x2b581e(_0x59d541);});});}function respondWithResult(_0x346114,_0x2f0103){_0x2f0103=_0x2f0103||0xc8;return function(_0x91c358){if(_0x91c358){return _0x346114[_0xfcfa('0x1f')](_0x2f0103)[_0xfcfa('0x20')](_0x91c358);}};}function respondWithFilteredResult(_0x23d68e,_0x169a04){return function(_0x323989){if(_0x323989){var _0x22569d=typeof _0x169a04[_0xfcfa('0x21')]===_0xfcfa('0x22')&&typeof _0x169a04[_0xfcfa('0x23')]===_0xfcfa('0x22');var _0x489842=_0x323989[_0xfcfa('0x24')];var _0x4ee554=_0x22569d?0x0:_0x169a04[_0xfcfa('0x21')];var _0x4c5d87=_0x22569d?_0x323989['count']:_0x169a04['offset']+_0x169a04['limit'];var _0x5b61f2;if(_0x4c5d87>=_0x489842){_0x4c5d87=_0x489842;_0x5b61f2=0xc8;}else{_0x5b61f2=0xce;}_0x23d68e[_0xfcfa('0x1f')](_0x5b61f2);return _0x23d68e[_0xfcfa('0x25')](_0xfcfa('0x26'),_0x4ee554+'-'+_0x4c5d87+'/'+_0x489842)[_0xfcfa('0x20')](_0x323989);}return null;};}function saveUpdates(_0x767b50){return function(_0x16dc29){if(_0x16dc29){return _0x16dc29[_0xfcfa('0x27')](_0x767b50)[_0xfcfa('0x14')](function(_0x3c15e2){return _0x3c15e2;});}return null;};}function removeEntity(_0x237447){return function(_0x46ea03){if(_0x46ea03){return _0x46ea03[_0xfcfa('0x28')]()[_0xfcfa('0x14')](function(){_0x237447[_0xfcfa('0x1f')](0xcc)[_0xfcfa('0x29')]();});}};}function handleEntityNotFound(_0x5c4eff){return function(_0x5aaa36){if(!_0x5aaa36){_0x5c4eff[_0xfcfa('0x2a')](0x194);}return _0x5aaa36;};}function handleError(_0x5f23b,_0xf4fa71){_0xf4fa71=_0xf4fa71||0x1f4;return function(_0x323614){logger[_0xfcfa('0x1a')](_0x323614[_0xfcfa('0x2b')]);if(_0x323614[_0xfcfa('0x2c')]){delete _0x323614[_0xfcfa('0x2c')];}_0x5f23b[_0xfcfa('0x1f')](_0xf4fa71)[_0xfcfa('0x2d')](_0x323614);};}exports['index']=function(_0x233099,_0x2cceb5){var _0x19cbf4={},_0x1f00a7={},_0x24682b={'count':0x0,'rows':[]};var _0x2a6e71=_[_0xfcfa('0x2e')](db['MailMessage'][_0xfcfa('0x2f')],function(_0x288622){return{'name':_0x288622[_0xfcfa('0x30')],'type':_0x288622['type'][_0xfcfa('0x31')]};});_0x1f00a7[_0xfcfa('0x32')]=_[_0xfcfa('0x2e')](_0x2a6e71,_0xfcfa('0x2c'));_0x1f00a7['query']=_[_0xfcfa('0x33')](_0x233099['query']);_0x1f00a7['filters']=_[_0xfcfa('0x34')](_0x1f00a7['model'],_0x1f00a7[_0xfcfa('0x35')]);_0x19cbf4[_0xfcfa('0x36')]=_[_0xfcfa('0x34')](_0x1f00a7[_0xfcfa('0x32')],qs[_0xfcfa('0x37')](_0x233099[_0xfcfa('0x35')][_0xfcfa('0x37')]));_0x19cbf4[_0xfcfa('0x36')]=_0x19cbf4[_0xfcfa('0x36')]['length']?_0x19cbf4[_0xfcfa('0x36')]:_0x1f00a7[_0xfcfa('0x32')];if(!_0x233099[_0xfcfa('0x35')][_0xfcfa('0x38')](_0xfcfa('0x39'))){_0x19cbf4[_0xfcfa('0x23')]=qs[_0xfcfa('0x23')](_0x233099['query'][_0xfcfa('0x23')]);_0x19cbf4[_0xfcfa('0x21')]=qs[_0xfcfa('0x21')](_0x233099[_0xfcfa('0x35')][_0xfcfa('0x21')]);}_0x19cbf4[_0xfcfa('0x3a')]=qs['sort'](_0x233099[_0xfcfa('0x35')][_0xfcfa('0x3b')]);_0x19cbf4[_0xfcfa('0x3c')]=qs[_0xfcfa('0x3d')](_[_0xfcfa('0x3e')](_0x233099[_0xfcfa('0x35')],_0x1f00a7[_0xfcfa('0x3d')]),_0x2a6e71);if(_0x233099[_0xfcfa('0x35')]['filter']){_0x19cbf4[_0xfcfa('0x3c')]=_['merge'](_0x19cbf4[_0xfcfa('0x3c')],{'$or':_[_0xfcfa('0x2e')](_0x2a6e71,function(_0x1de8a5){if(_0x1de8a5['type']!=='VIRTUAL'){var _0x3b44df={};_0x3b44df[_0x1de8a5[_0xfcfa('0x2c')]]={'$like':'%'+_0x233099['query']['filter']+'%'};return _0x3b44df;}})});}_0x19cbf4=_[_0xfcfa('0x3f')]({},_0x19cbf4,_0x233099[_0xfcfa('0x40')]);var _0xb03417={'where':_0x19cbf4[_0xfcfa('0x3c')]};return db[_0xfcfa('0x41')]['count'](_0xb03417)[_0xfcfa('0x14')](function(_0x8874ee){_0x24682b[_0xfcfa('0x24')]=_0x8874ee;if(_0x233099['query'][_0xfcfa('0x42')]){_0x19cbf4['include']=[{'all':!![]}];}return db[_0xfcfa('0x41')]['findAll'](_0x19cbf4);})[_0xfcfa('0x14')](function(_0x1ae322){_0x24682b[_0xfcfa('0x43')]=_0x1ae322;return _0x24682b;})[_0xfcfa('0x14')](respondWithFilteredResult(_0x2cceb5,_0x19cbf4))['catch'](handleError(_0x2cceb5,null));};exports['show']=function(_0x2cccbe,_0x3f7d7b){var _0x369474={'raw':!![],'where':{'id':_0x2cccbe['params']['id']}},_0x21d020={};_0x21d020[_0xfcfa('0x32')]=_['keys'](db[_0xfcfa('0x41')][_0xfcfa('0x2f')]);_0x21d020[_0xfcfa('0x35')]=_['keys'](_0x2cccbe[_0xfcfa('0x35')]);_0x21d020[_0xfcfa('0x3d')]=_['intersection'](_0x21d020[_0xfcfa('0x32')],_0x21d020[_0xfcfa('0x35')]);_0x369474[_0xfcfa('0x36')]=_[_0xfcfa('0x34')](_0x21d020[_0xfcfa('0x32')],qs['fields'](_0x2cccbe[_0xfcfa('0x35')][_0xfcfa('0x37')]));_0x369474[_0xfcfa('0x36')]=_0x369474['attributes'][_0xfcfa('0x44')]?_0x369474[_0xfcfa('0x36')]:_0x21d020[_0xfcfa('0x32')];if(_0x2cccbe['query']['includeAll']){_0x369474[_0xfcfa('0x45')]=[{'all':!![]}];}_0x369474=_[_0xfcfa('0x3f')]({},_0x369474,_0x2cccbe[_0xfcfa('0x40')]);return db[_0xfcfa('0x41')][_0xfcfa('0x46')](_0x369474)[_0xfcfa('0x14')](handleEntityNotFound(_0x3f7d7b,null))[_0xfcfa('0x14')](respondWithResult(_0x3f7d7b,null))[_0xfcfa('0x47')](handleError(_0x3f7d7b,null));};exports[_0xfcfa('0x27')]=function(_0x288367,_0x159c79){if(_0x288367[_0xfcfa('0x48')]['id']){delete _0x288367[_0xfcfa('0x48')]['id'];}return db[_0xfcfa('0x41')][_0xfcfa('0x46')]({'where':{'id':_0x288367[_0xfcfa('0x49')]['id']}})[_0xfcfa('0x14')](handleEntityNotFound(_0x159c79,null))['then'](saveUpdates(_0x288367['body'],null))[_0xfcfa('0x14')](respondWithResult(_0x159c79,null))[_0xfcfa('0x47')](handleError(_0x159c79,null));};exports[_0xfcfa('0x28')]=function(_0x2095dc,_0x538218){return db[_0xfcfa('0x41')][_0xfcfa('0x46')]({'where':{'id':_0x2095dc[_0xfcfa('0x49')]['id']}})['then'](handleEntityNotFound(_0x538218,null))['then'](removeEntity(_0x538218,null))[_0xfcfa('0x47')](handleError(_0x538218,null));};exports[_0xfcfa('0x4a')]=function(_0x59e416,_0x1ac4a5){return db['MailMessage']['describe']()[_0xfcfa('0x14')](respondWithResult(_0x1ac4a5,null))[_0xfcfa('0x47')](handleError(_0x1ac4a5,null));};exports[_0xfcfa('0x4b')]=function(_0x391045,_0x4286e0){return db[_0xfcfa('0x41')][_0xfcfa('0x4b')](_0x391045[_0xfcfa('0x48')])[_0xfcfa('0x14')](function(_0x47ebc3){if(_0x47ebc3){if(_0x47ebc3['direction']===_0xfcfa('0x4c')&&!_0x47ebc3[_0xfcfa('0x4d')]){var _0x414ee8,_0x7377b8,_0x2876ae;if(_0x391045['body']['to']){_0x7377b8=_0x391045[_0xfcfa('0x48')]['to'][_0xfcfa('0x4e')](',')[0x0];}return db['MailAccount'][_0xfcfa('0x4f')]({'where':{'id':_0x47ebc3['MailAccountId']},'include':[{'model':db[_0xfcfa('0x50')],'as':_0xfcfa('0x51'),'include':[{'model':db[_0xfcfa('0x52')],'as':_0xfcfa('0x53'),'where':{'email':_0x7377b8},'limit':0x1,'order':[[_0xfcfa('0x54'),'DESC']]}]},{'model':db[_0xfcfa('0x55')],'as':'Smtp','raw':!![],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','raw':!![]}]}]})['then'](function(_0x478f86){_0x414ee8=_0x478f86;if(!_0x414ee8||!_0x414ee8[_0xfcfa('0x56')])return;var _0x448ad2=_0x414ee8[_0xfcfa('0x57')]();if(_0x391045[_0xfcfa('0x48')]['attachments']&&_0x391045['body'][_0xfcfa('0x58')][_0xfcfa('0x44')]){for(var _0x831db8=0x0;_0x831db8<_0x391045['body'][_0xfcfa('0x58')]['length'];_0x831db8+=0x1){_0x391045[_0xfcfa('0x48')]['attachments'][_0x831db8]={'filename':_0x391045[_0xfcfa('0x48')][_0xfcfa('0x58')][_0x831db8][_0xfcfa('0x2c')],'path':path[_0xfcfa('0x59')](config['root'],_0xfcfa('0x5a'),_0x391045['body'][_0xfcfa('0x58')][_0x831db8]['basename'])};}}_0x2876ae={'account':_0x448ad2,'message':_0x391045['body']};return;})[_0xfcfa('0x14')](function(){if(_0x414ee8[_0xfcfa('0x51')]){if(_0x414ee8['List']['Contacts'][_0xfcfa('0x44')]){return _0x414ee8['List'][_0xfcfa('0x53')][0x0];}else{return db[_0xfcfa('0x52')][_0xfcfa('0x4b')](_[_0xfcfa('0xd')](_0x391045['body'],{'firstName':_0x391045[_0xfcfa('0x48')]['to'],'email':_0x391045[_0xfcfa('0x48')]['to'],'phone':_0x391045[_0xfcfa('0x48')]['to'],'ListId':_0x414ee8[_0xfcfa('0x5b')]}));}}else{throw new Error('List\x20not\x20found');}})[_0xfcfa('0x14')](function(){if(_0x2876ae){return respondWithRpcPromise(_0xfcfa('0x5c'),_0xfcfa('0x5d'),_0x2876ae,client9003)[_0xfcfa('0x14')](function(_0x488092){return _0x47ebc3[_0xfcfa('0x27')]({'read':!![],'messageId':_0x488092[_0xfcfa('0x5e')],'sentAt':moment()[_0xfcfa('0x5f')]('YYYY-MM-DD\x20HH:mm:ss')});})['catch'](function(_0x963b4c){logger[_0xfcfa('0x1a')]('%s',JSON[_0xfcfa('0x19')](_0x963b4c));return _0x47ebc3;});}return _0x47ebc3;});}return _0x47ebc3;}})[_0xfcfa('0x14')](respondWithResult(_0x4286e0,0xc9))['catch'](handleError(_0x4286e0,null));};exports[_0xfcfa('0x60')]=function(_0x223dde,_0x4ca5b3){var _0xfc8174=_0xfcfa('0x61');return interactionService[_0xfcfa('0x62')](_0x223dde,_0xfc8174)[_0xfcfa('0x14')](respondWithResult(_0x4ca5b3,null))[_0xfcfa('0x47')](handleError(_0x4ca5b3,null));};exports[_0xfcfa('0x63')]=function(_0x173214,_0x23c4e4){var _0x109fb9={'agent':{},'channel':_0xfcfa('0x61')};if(_0x173214[_0xfcfa('0x48')]['id']){delete _0x173214[_0xfcfa('0x48')]['id'];}_0x173214['body']['UserId']=_0x173214[_0xfcfa('0x48')][_0xfcfa('0x64')]||_0x173214['user']['id'];_0x109fb9[_0xfcfa('0x65')]['id']=_0x173214[_0xfcfa('0x48')][_0xfcfa('0x64')];return db[_0xfcfa('0x41')][_0xfcfa('0x46')]({'where':{'id':_0x173214[_0xfcfa('0x49')]['id'],'UserId':null}})[_0xfcfa('0x14')](handleEntityNotFound(_0x23c4e4,null))[_0xfcfa('0x14')](function(_0x39e6d9){if(_0x39e6d9){_0x109fb9[_0xfcfa('0x1d')]=_0x39e6d9[_0xfcfa('0x66')]({'plain':!![]});return db[_0xfcfa('0x67')][_0xfcfa('0x46')]({'where':{'id':_0x39e6d9[_0xfcfa('0x68')]}});}return null;})['then'](handleEntityNotFound(_0x23c4e4,null))['then'](function(_0x338c32){if(_0x338c32){_0x109fb9['interaction']=_0x338c32['get']({'plain':!![]});interaction_log['info'](_0xfcfa('0x69'),_0x173214[_0xfcfa('0x6a')]['id'],_0x173214[_0xfcfa('0x6a')][_0xfcfa('0x2c')],_0x173214[_0xfcfa('0x6a')][_0xfcfa('0x6b')],_0x109fb9['interaction']['id'],_0x173214['body']?JSON['stringify'](_0x173214[_0xfcfa('0x48')]):_0xfcfa('0x6c'));return respondWithRpcPromise(_0xfcfa('0x6d'),'rejectMessage',_0x109fb9);}return null;})[_0xfcfa('0x14')](function(_0x3746e8){var _0x5acf67='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x3746e8[_0xfcfa('0x1d')]['ContactId'];return db[_0xfcfa('0x6e')][_0xfcfa('0x35')](_0x5acf67,{'type':db[_0xfcfa('0x6f')][_0xfcfa('0x70')][_0xfcfa('0x71')],'raw':!![]})[_0xfcfa('0x14')](function(_0x31fdc5){return _0x31fdc5;});})[_0xfcfa('0x14')](function(_0x5e3bc3){if(_0x5e3bc3){_0x109fb9[_0xfcfa('0x1d')][_0xfcfa('0x72')]=_0x5e3bc3[0x0];if(!_0x173214[_0xfcfa('0x48')][_0xfcfa('0x64')])return;return db['User'][_0xfcfa('0x46')]({'where':{'id':_0x173214[_0xfcfa('0x48')][_0xfcfa('0x64')],'role':_0xfcfa('0x65')},'attributes':['id','name','fullname',_0xfcfa('0x73'),_0xfcfa('0x74')],'raw':!![]});}return null;})[_0xfcfa('0x14')](function(_0x1505b3){if(!_0x1505b3)return null;_0x109fb9['message'][_0xfcfa('0x65')]=_0x1505b3;return _0x109fb9;})[_0xfcfa('0x14')](function(_0x3f11db){if(_0x3f11db){_0x3f11db[_0xfcfa('0x1d')]['interface']=util[_0xfcfa('0x5f')](_0xfcfa('0x75'),_0x173214[_0xfcfa('0x6a')][_0xfcfa('0x2c')]);_0x3f11db[_0xfcfa('0x1d')][_0xfcfa('0x76')]=_0x109fb9[_0xfcfa('0x76')];_0x3f11db['message']['motionChannel']=_0x109fb9[_0xfcfa('0x76')];_0x3f11db[_0xfcfa('0x1d')][_0xfcfa('0x77')]=_0xfcfa('0x63');_0x3f11db[_0xfcfa('0x1d')][_0xfcfa('0x48')]=htmlToText[_0xfcfa('0x78')](_0x109fb9[_0xfcfa('0x1d')][_0xfcfa('0x48')]);respondWithRpcPromise(_0xfcfa('0x79'),_0xfcfa('0x79'),{'event':'rejectmessage','message':_0x3f11db[_0xfcfa('0x1d')]},client9002);return _0x109fb9;}return null;})[_0xfcfa('0x14')](respondWithResult(_0x23c4e4,null))[_0xfcfa('0x47')](handleError(_0x23c4e4,null));};exports[_0xfcfa('0x7a')]=function(_0xae8d9e,_0x36d0b4){var _0x575063=moment()[_0xfcfa('0x7b')]()[_0xfcfa('0x7c')]();var _0x4d2ee8=path['join'](config[_0xfcfa('0x7d')],_0xfcfa('0x7e'),_0xfcfa('0x7f'),_0xfcfa('0x80'));var _0x23c909=path[_0xfcfa('0x59')](config['root'],_0xfcfa('0x7e'),'files','attachments');var _0xda6878=util[_0xfcfa('0x5f')](_0xfcfa('0x81'),_0x575063);return db[_0xfcfa('0x41')][_0xfcfa('0x46')]({'where':{'id':_0xae8d9e[_0xfcfa('0x49')]['id']},'attributes':['id',_0xfcfa('0x48'),_0xfcfa('0x82'),'to','cc',_0xfcfa('0x83'),_0xfcfa('0x84'),_0xfcfa('0x85')],'include':_0xae8d9e[_0xfcfa('0x35')][_0xfcfa('0x58')]?[{'model':db[_0xfcfa('0x86')],'as':_0xfcfa('0x87')}]:undefined})[_0xfcfa('0x14')](handleEntityNotFound(_0x36d0b4,null))[_0xfcfa('0x14')](function(_0x3ac958){if(_0x3ac958){var _0x4da023=_0x3ac958;var _0x2358f7={'from':_0x4da023[_0xfcfa('0x82')],'to':_0x4da023['to'],'subject':_0x4da023[_0xfcfa('0x84')],'html':htmlEntities[_0xfcfa('0x88')](_0x4da023[_0xfcfa('0x48')]),'headers':{'Date':moment(_0x4da023['createdAt'])[_0xfcfa('0x5f')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x3ac958['cc']){_0x2358f7[_0xfcfa('0x89')]['Cc']=_0x3ac958['cc'];}if(_0x3ac958['bcc']){_0x2358f7[_0xfcfa('0x89')]['Bcc']=_0x3ac958[_0xfcfa('0x83')];}return new Promise(function(_0x456dc7,_0x17282f){if(_0x3ac958['Attachments']){for(var _0x4631b1=0x0;_0x4631b1<_0x3ac958[_0xfcfa('0x87')][_0xfcfa('0x44')];_0x4631b1++){var _0x4127c5=_0x3ac958[_0xfcfa('0x87')][_0x4631b1];var _0x386a46=path[_0xfcfa('0x59')](_0x23c909,_0x4127c5[_0xfcfa('0x8a')]);if(fs[_0xfcfa('0x8b')](_0x386a46)){_0x2358f7['attachments'][_0xfcfa('0x8c')]({'name':_0x4127c5[_0xfcfa('0x2c')],'contentType':_0x4127c5['type'],'data':fs[_0xfcfa('0x8d')](_0x386a46)});}}}emlformat[_0xfcfa('0x8e')](_0x2358f7,function(_0x4a5742,_0x2086ea){if(_0x4a5742)return _0x17282f(_0x4a5742);fs['writeFileSync'](path[_0xfcfa('0x59')](_0x4d2ee8,_0xda6878),_0x2086ea);return _0x456dc7(_0x2086ea);});});}})[_0xfcfa('0x14')](function(_0x4e6894){if(_0x4e6894){return _0x36d0b4[_0xfcfa('0x7a')](path[_0xfcfa('0x59')](_0x4d2ee8,_0xda6878),_0xda6878,function(_0x239398){if(!_0x239398)fs[_0xfcfa('0x8f')](path[_0xfcfa('0x59')](_0x4d2ee8,_0xda6878));});}})[_0xfcfa('0x47')](handleError(_0x36d0b4,null));}; \ No newline at end of file +var _0xa07a=['writeFileSync','unlinkSync','eml-format','moment','util','path','lodash','ioredis','html-to-text','../../components/interaction/service','../../config/logger','api','mail-interactions','../../mysqldb','redis','localhost','html-entities','./mailMessage.socket','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','error','code','MailMessage,\x20%s,\x20%s','message','catch','status','json','offset','undefined','limit','count','set','update','destroy','end','sendStatus','name','send','index','MailMessage','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','include','findAll','rows','show','params','includeAll','options','find','body','create','direction','out','secret','split','MailAccount','MailAccountId','CmList','List','Contacts','updatedAt','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','join','root','server/files/attachments','basename','CmContact','defaults','ListId','List\x20not\x20found','sendMail','YYYY-MM-DD\x20HH:mm:ss','stringify','accept','mail','acceptMessage','UserId','get','MailInteractionId','interaction','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','null','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','agent','interface','SIP/%s','channel','motionChannel','event','reject','EventManager','download','unix','files','tmp','server','message-%s.eml','from','bcc','subject','Attachment','decode','createdAt','format','headers','Bcc','Attachments','existsSync','push','readFileSync','build'];(function(_0x523f68,_0x13aac8){var _0x50b982=function(_0xc12b51){while(--_0xc12b51){_0x523f68['push'](_0x523f68['shift']());}};_0x50b982(++_0x13aac8);}(_0xa07a,0x9c));var _0xaa07=function(_0x46b389,_0x1eeb39){_0x46b389=_0x46b389-0x0;var _0x180f3e=_0xa07a[_0x46b389];return _0x180f3e;};'use strict';var emlformat=require(_0xaa07('0x0'));var moment=require(_0xaa07('0x1'));var util=require(_0xaa07('0x2'));var path=require(_0xaa07('0x3'));var fs=require('fs');var _=require(_0xaa07('0x4'));var Redis=require(_0xaa07('0x5'));var htmlToText=require(_0xaa07('0x6'));var interactionService=require(_0xaa07('0x7'));var qs=require('../../components/parsers/qs');var logger=require(_0xaa07('0x8'))(_0xaa07('0x9'));var interaction_log=require('../../config/logger')(_0xaa07('0xa'));var config=require('../../config/environment');var db=require(_0xaa07('0xb'))['db'];config[_0xaa07('0xc')]=_['defaults'](config['redis'],{'host':_0xaa07('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xaa07('0xc')]));var htmlEntities=require(_0xaa07('0xe'));require(_0xaa07('0xf'))[_0xaa07('0x10')](socket);var jayson=require(_0xaa07('0x11'));var client=jayson['client']['http']({'port':0x232c});var client9003=jayson[_0xaa07('0x12')][_0xaa07('0x13')]({'port':0x232b});var client9002=jayson['client'][_0xaa07('0x13')]({'port':0x232a});function respondWithRpcPromise(_0xbf9fde,_0x25fe8e,_0x2ff470,_0x5f1925){return new Promise(function(_0x2307e6,_0x31d908){var _0x232577=_0x5f1925||client;return _0x232577[_0xaa07('0x14')](_0xbf9fde,_0x2ff470)[_0xaa07('0x15')](function(_0x4573ae){logger[_0xaa07('0x16')]('MailMessage,\x20%s,\x20%s',_0x25fe8e,_0xaa07('0x17'));logger[_0xaa07('0x18')](_0xaa07('0x19'),_0x25fe8e,'request\x20sent',JSON['stringify'](_0x4573ae));if(_0x4573ae[_0xaa07('0x1a')]){if(_0x4573ae['error'][_0xaa07('0x1b')]===0x1f4){logger[_0xaa07('0x1a')](_0xaa07('0x1c'),_0x25fe8e,_0x4573ae[_0xaa07('0x1a')][_0xaa07('0x1d')]);return _0x31d908(_0x4573ae[_0xaa07('0x1a')][_0xaa07('0x1d')]);}logger[_0xaa07('0x1a')](_0xaa07('0x1c'),_0x25fe8e,_0x4573ae['error'][_0xaa07('0x1d')]);return _0x2307e6(_0x4573ae[_0xaa07('0x1a')][_0xaa07('0x1d')]);}else{logger['info'](_0xaa07('0x1c'),_0x25fe8e,_0xaa07('0x17'));_0x2307e6(_0x4573ae['result'][_0xaa07('0x1d')]);}})[_0xaa07('0x1e')](function(_0x361111){logger['error']('MailMessage,\x20%s,\x20%s',_0x25fe8e,_0x361111);_0x31d908(_0x361111);});});}function respondWithResult(_0x3f8114,_0xf65b11){_0xf65b11=_0xf65b11||0xc8;return function(_0x5c266f){if(_0x5c266f){return _0x3f8114[_0xaa07('0x1f')](_0xf65b11)[_0xaa07('0x20')](_0x5c266f);}};}function respondWithFilteredResult(_0x4c3f3e,_0x1a7200){return function(_0xfd0275){if(_0xfd0275){var _0x23c555=typeof _0x1a7200[_0xaa07('0x21')]===_0xaa07('0x22')&&typeof _0x1a7200[_0xaa07('0x23')]===_0xaa07('0x22');var _0x2a0f7c=_0xfd0275[_0xaa07('0x24')];var _0x2f3af7=_0x23c555?0x0:_0x1a7200[_0xaa07('0x21')];var _0x1b9d08=_0x23c555?_0xfd0275[_0xaa07('0x24')]:_0x1a7200[_0xaa07('0x21')]+_0x1a7200['limit'];var _0x207e48;if(_0x1b9d08>=_0x2a0f7c){_0x1b9d08=_0x2a0f7c;_0x207e48=0xc8;}else{_0x207e48=0xce;}_0x4c3f3e[_0xaa07('0x1f')](_0x207e48);return _0x4c3f3e[_0xaa07('0x25')]('Content-Range',_0x2f3af7+'-'+_0x1b9d08+'/'+_0x2a0f7c)[_0xaa07('0x20')](_0xfd0275);}return null;};}function saveUpdates(_0x46c2cf){return function(_0x4d54dd){if(_0x4d54dd){return _0x4d54dd[_0xaa07('0x26')](_0x46c2cf)[_0xaa07('0x15')](function(_0x623e1b){return _0x623e1b;});}return null;};}function removeEntity(_0x5cc068){return function(_0x31f41a){if(_0x31f41a){return _0x31f41a[_0xaa07('0x27')]()[_0xaa07('0x15')](function(){_0x5cc068['status'](0xcc)[_0xaa07('0x28')]();});}};}function handleEntityNotFound(_0x25b2a2){return function(_0x422fb9){if(!_0x422fb9){_0x25b2a2[_0xaa07('0x29')](0x194);}return _0x422fb9;};}function handleError(_0x32180d,_0x39feaf){_0x39feaf=_0x39feaf||0x1f4;return function(_0x283d65){logger[_0xaa07('0x1a')](_0x283d65['stack']);if(_0x283d65[_0xaa07('0x2a')]){delete _0x283d65[_0xaa07('0x2a')];}_0x32180d[_0xaa07('0x1f')](_0x39feaf)[_0xaa07('0x2b')](_0x283d65);};}exports[_0xaa07('0x2c')]=function(_0x39f6a3,_0x4b92a1){var _0x52812f={},_0x22075d={},_0x2befcc={'count':0x0,'rows':[]};var _0x3745e6=_['map'](db[_0xaa07('0x2d')][_0xaa07('0x2e')],function(_0x238199){return{'name':_0x238199[_0xaa07('0x2f')],'type':_0x238199[_0xaa07('0x30')][_0xaa07('0x31')]};});_0x22075d[_0xaa07('0x32')]=_[_0xaa07('0x33')](_0x3745e6,_0xaa07('0x2a'));_0x22075d[_0xaa07('0x34')]=_[_0xaa07('0x35')](_0x39f6a3[_0xaa07('0x34')]);_0x22075d[_0xaa07('0x36')]=_[_0xaa07('0x37')](_0x22075d[_0xaa07('0x32')],_0x22075d[_0xaa07('0x34')]);_0x52812f[_0xaa07('0x38')]=_[_0xaa07('0x37')](_0x22075d[_0xaa07('0x32')],qs['fields'](_0x39f6a3[_0xaa07('0x34')][_0xaa07('0x39')]));_0x52812f[_0xaa07('0x38')]=_0x52812f[_0xaa07('0x38')][_0xaa07('0x3a')]?_0x52812f['attributes']:_0x22075d[_0xaa07('0x32')];if(!_0x39f6a3['query'][_0xaa07('0x3b')](_0xaa07('0x3c'))){_0x52812f[_0xaa07('0x23')]=qs[_0xaa07('0x23')](_0x39f6a3[_0xaa07('0x34')][_0xaa07('0x23')]);_0x52812f[_0xaa07('0x21')]=qs['offset'](_0x39f6a3[_0xaa07('0x34')]['offset']);}_0x52812f[_0xaa07('0x3d')]=qs[_0xaa07('0x3e')](_0x39f6a3[_0xaa07('0x34')][_0xaa07('0x3e')]);_0x52812f[_0xaa07('0x3f')]=qs[_0xaa07('0x36')](_[_0xaa07('0x40')](_0x39f6a3['query'],_0x22075d[_0xaa07('0x36')]),_0x3745e6);if(_0x39f6a3['query'][_0xaa07('0x41')]){_0x52812f['where']=_[_0xaa07('0x42')](_0x52812f['where'],{'$or':_[_0xaa07('0x33')](_0x3745e6,function(_0x92cde6){if(_0x92cde6[_0xaa07('0x30')]!=='VIRTUAL'){var _0x2f0e91={};_0x2f0e91[_0x92cde6[_0xaa07('0x2a')]]={'$like':'%'+_0x39f6a3['query'][_0xaa07('0x41')]+'%'};return _0x2f0e91;}})});}_0x52812f=_[_0xaa07('0x42')]({},_0x52812f,_0x39f6a3['options']);var _0x3d7f80={'where':_0x52812f[_0xaa07('0x3f')]};return db[_0xaa07('0x2d')][_0xaa07('0x24')](_0x3d7f80)['then'](function(_0x1307d3){_0x2befcc[_0xaa07('0x24')]=_0x1307d3;if(_0x39f6a3['query']['includeAll']){_0x52812f[_0xaa07('0x43')]=[{'all':!![]}];}return db[_0xaa07('0x2d')][_0xaa07('0x44')](_0x52812f);})[_0xaa07('0x15')](function(_0x44e8b1){_0x2befcc[_0xaa07('0x45')]=_0x44e8b1;return _0x2befcc;})[_0xaa07('0x15')](respondWithFilteredResult(_0x4b92a1,_0x52812f))[_0xaa07('0x1e')](handleError(_0x4b92a1,null));};exports[_0xaa07('0x46')]=function(_0xc52208,_0xd56fdb){var _0x134da7={'raw':!![],'where':{'id':_0xc52208[_0xaa07('0x47')]['id']}},_0x3aded5={};_0x3aded5[_0xaa07('0x32')]=_[_0xaa07('0x35')](db['MailMessage'][_0xaa07('0x2e')]);_0x3aded5[_0xaa07('0x34')]=_['keys'](_0xc52208[_0xaa07('0x34')]);_0x3aded5[_0xaa07('0x36')]=_['intersection'](_0x3aded5[_0xaa07('0x32')],_0x3aded5[_0xaa07('0x34')]);_0x134da7[_0xaa07('0x38')]=_[_0xaa07('0x37')](_0x3aded5[_0xaa07('0x32')],qs[_0xaa07('0x39')](_0xc52208[_0xaa07('0x34')][_0xaa07('0x39')]));_0x134da7[_0xaa07('0x38')]=_0x134da7[_0xaa07('0x38')][_0xaa07('0x3a')]?_0x134da7['attributes']:_0x3aded5[_0xaa07('0x32')];if(_0xc52208[_0xaa07('0x34')][_0xaa07('0x48')]){_0x134da7[_0xaa07('0x43')]=[{'all':!![]}];}_0x134da7=_[_0xaa07('0x42')]({},_0x134da7,_0xc52208[_0xaa07('0x49')]);return db['MailMessage'][_0xaa07('0x4a')](_0x134da7)[_0xaa07('0x15')](handleEntityNotFound(_0xd56fdb,null))[_0xaa07('0x15')](respondWithResult(_0xd56fdb,null))[_0xaa07('0x1e')](handleError(_0xd56fdb,null));};exports[_0xaa07('0x26')]=function(_0x10ba04,_0x4375d1){if(_0x10ba04[_0xaa07('0x4b')]['id']){delete _0x10ba04['body']['id'];}return db['MailMessage']['find']({'where':{'id':_0x10ba04[_0xaa07('0x47')]['id']}})[_0xaa07('0x15')](handleEntityNotFound(_0x4375d1,null))[_0xaa07('0x15')](saveUpdates(_0x10ba04['body'],null))['then'](respondWithResult(_0x4375d1,null))['catch'](handleError(_0x4375d1,null));};exports['destroy']=function(_0x587955,_0x533897){return db[_0xaa07('0x2d')][_0xaa07('0x4a')]({'where':{'id':_0x587955['params']['id']}})[_0xaa07('0x15')](handleEntityNotFound(_0x533897,null))[_0xaa07('0x15')](removeEntity(_0x533897,null))[_0xaa07('0x1e')](handleError(_0x533897,null));};exports['describe']=function(_0x106e62,_0x53caa6){return db[_0xaa07('0x2d')]['describe']()[_0xaa07('0x15')](respondWithResult(_0x53caa6,null))[_0xaa07('0x1e')](handleError(_0x53caa6,null));};exports[_0xaa07('0x4c')]=function(_0x46f3f7,_0x4f7a9d){return db[_0xaa07('0x2d')][_0xaa07('0x4c')](_0x46f3f7[_0xaa07('0x4b')])['then'](function(_0x2eedd8){if(_0x2eedd8){if(_0x2eedd8[_0xaa07('0x4d')]===_0xaa07('0x4e')&&!_0x2eedd8[_0xaa07('0x4f')]){var _0xf736d4,_0x583c33,_0x17f6ef;if(_0x46f3f7['body']['to']){_0x583c33=_0x46f3f7['body']['to'][_0xaa07('0x50')](',')[0x0];}return db[_0xaa07('0x51')]['findOne']({'where':{'id':_0x2eedd8[_0xaa07('0x52')]},'include':[{'model':db[_0xaa07('0x53')],'as':_0xaa07('0x54'),'include':[{'model':db['CmContact'],'as':_0xaa07('0x55'),'where':{'email':_0x583c33},'limit':0x1,'order':[[_0xaa07('0x56'),'DESC']]}]},{'model':db[_0xaa07('0x57')],'as':_0xaa07('0x58'),'raw':!![],'include':[{'model':db[_0xaa07('0x59')],'as':'CloudProvider','raw':!![]}]}]})[_0xaa07('0x15')](function(_0x1dc13c){_0xf736d4=_0x1dc13c;if(!_0xf736d4||!_0xf736d4[_0xaa07('0x58')])return;var _0x36af97=_0xf736d4[_0xaa07('0x5a')]();if(_0x46f3f7['body'][_0xaa07('0x5b')]&&_0x46f3f7[_0xaa07('0x4b')][_0xaa07('0x5b')][_0xaa07('0x3a')]){for(var _0x464bf0=0x0;_0x464bf0<_0x46f3f7[_0xaa07('0x4b')][_0xaa07('0x5b')][_0xaa07('0x3a')];_0x464bf0+=0x1){_0x46f3f7[_0xaa07('0x4b')][_0xaa07('0x5b')][_0x464bf0]={'filename':_0x46f3f7['body'][_0xaa07('0x5b')][_0x464bf0][_0xaa07('0x2a')],'path':path[_0xaa07('0x5c')](config[_0xaa07('0x5d')],_0xaa07('0x5e'),_0x46f3f7[_0xaa07('0x4b')][_0xaa07('0x5b')][_0x464bf0][_0xaa07('0x5f')])};}}_0x17f6ef={'account':_0x36af97,'message':_0x46f3f7['body']};return;})['then'](function(){if(_0xf736d4['List']){if(_0xf736d4['List']['Contacts'][_0xaa07('0x3a')]){return _0xf736d4[_0xaa07('0x54')]['Contacts'][0x0];}else{return db[_0xaa07('0x60')][_0xaa07('0x4c')](_[_0xaa07('0x61')](_0x46f3f7[_0xaa07('0x4b')],{'firstName':_0x46f3f7[_0xaa07('0x4b')]['to'],'email':_0x46f3f7['body']['to'],'phone':_0x46f3f7[_0xaa07('0x4b')]['to'],'ListId':_0xf736d4[_0xaa07('0x62')]}));}}else{throw new Error(_0xaa07('0x63'));}})['then'](function(){if(_0x17f6ef){return respondWithRpcPromise('SendMail',_0xaa07('0x64'),_0x17f6ef,client9003)[_0xaa07('0x15')](function(_0x271d93){return _0x2eedd8[_0xaa07('0x26')]({'read':!![],'messageId':_0x271d93['messageId'],'sentAt':moment()['format'](_0xaa07('0x65'))});})[_0xaa07('0x1e')](function(_0x51138c){logger[_0xaa07('0x1a')]('%s',JSON[_0xaa07('0x66')](_0x51138c));return _0x2eedd8;});}return _0x2eedd8;});}return _0x2eedd8;}})[_0xaa07('0x15')](respondWithResult(_0x4f7a9d,0xc9))[_0xaa07('0x1e')](handleError(_0x4f7a9d,null));};exports[_0xaa07('0x67')]=function(_0x1d2c03,_0x2d8fe1){var _0x32996d=_0xaa07('0x68');return interactionService[_0xaa07('0x69')](_0x1d2c03,_0x32996d)[_0xaa07('0x15')](respondWithResult(_0x2d8fe1,null))[_0xaa07('0x1e')](handleError(_0x2d8fe1,null));};exports['reject']=function(_0x2de654,_0x1f49a1){var _0xb65dfe={'agent':{},'channel':_0xaa07('0x68')};if(_0x2de654[_0xaa07('0x4b')]['id']){delete _0x2de654[_0xaa07('0x4b')]['id'];}_0x2de654[_0xaa07('0x4b')][_0xaa07('0x6a')]=_0x2de654[_0xaa07('0x4b')][_0xaa07('0x6a')]||_0x2de654['user']['id'];_0xb65dfe['agent']['id']=_0x2de654[_0xaa07('0x4b')][_0xaa07('0x6a')];return db[_0xaa07('0x2d')][_0xaa07('0x4a')]({'where':{'id':_0x2de654['params']['id'],'UserId':null}})[_0xaa07('0x15')](handleEntityNotFound(_0x1f49a1,null))[_0xaa07('0x15')](function(_0x332754){if(_0x332754){_0xb65dfe['message']=_0x332754[_0xaa07('0x6b')]({'plain':!![]});return db['MailInteraction']['find']({'where':{'id':_0x332754[_0xaa07('0x6c')]}});}return null;})[_0xaa07('0x15')](handleEntityNotFound(_0x1f49a1,null))[_0xaa07('0x15')](function(_0x469e74){if(_0x469e74){_0xb65dfe[_0xaa07('0x6d')]=_0x469e74[_0xaa07('0x6b')]({'plain':!![]});interaction_log[_0xaa07('0x16')](_0xaa07('0x6e'),_0x2de654[_0xaa07('0x6f')]['id'],_0x2de654['user'][_0xaa07('0x2a')],_0x2de654[_0xaa07('0x6f')]['role'],_0xb65dfe['interaction']['id'],_0x2de654['body']?JSON['stringify'](_0x2de654[_0xaa07('0x4b')]):_0xaa07('0x70'));return respondWithRpcPromise(_0xaa07('0x71'),_0xaa07('0x72'),_0xb65dfe);}return null;})['then'](function(_0x309147){var _0x584311=_0xaa07('0x73')+_0x309147[_0xaa07('0x1d')][_0xaa07('0x74')];return db[_0xaa07('0x75')][_0xaa07('0x34')](_0x584311,{'type':db[_0xaa07('0x76')][_0xaa07('0x77')][_0xaa07('0x78')],'raw':!![]})[_0xaa07('0x15')](function(_0x381d5a){return _0x381d5a;});})[_0xaa07('0x15')](function(_0xca4090){if(_0xca4090){_0xb65dfe['message'][_0xaa07('0x79')]=_0xca4090[0x0];if(!_0x2de654[_0xaa07('0x4b')]['UserId'])return;return db[_0xaa07('0x7a')][_0xaa07('0x4a')]({'where':{'id':_0x2de654[_0xaa07('0x4b')][_0xaa07('0x6a')],'role':'agent'},'attributes':['id',_0xaa07('0x2a'),_0xaa07('0x7b'),'email','internal'],'raw':!![]});}return null;})[_0xaa07('0x15')](function(_0x4d2ee6){if(!_0x4d2ee6)return null;_0xb65dfe[_0xaa07('0x1d')][_0xaa07('0x7c')]=_0x4d2ee6;return _0xb65dfe;})[_0xaa07('0x15')](function(_0x4382af){if(_0x4382af){_0x4382af[_0xaa07('0x1d')][_0xaa07('0x7d')]=util['format'](_0xaa07('0x7e'),_0x2de654[_0xaa07('0x6f')][_0xaa07('0x2a')]);_0x4382af[_0xaa07('0x1d')][_0xaa07('0x7f')]=_0xb65dfe[_0xaa07('0x7f')];_0x4382af[_0xaa07('0x1d')][_0xaa07('0x80')]=_0xb65dfe['channel'];_0x4382af[_0xaa07('0x1d')][_0xaa07('0x81')]=_0xaa07('0x82');_0x4382af[_0xaa07('0x1d')]['body']=htmlToText['fromString'](_0xb65dfe['message'][_0xaa07('0x4b')]);respondWithRpcPromise(_0xaa07('0x83'),_0xaa07('0x83'),{'event':'rejectmessage','message':_0x4382af[_0xaa07('0x1d')]},client9002);return _0xb65dfe;}return null;})[_0xaa07('0x15')](respondWithResult(_0x1f49a1,null))[_0xaa07('0x1e')](handleError(_0x1f49a1,null));};exports[_0xaa07('0x84')]=function(_0x59d937,_0x5445c4){var _0x203a31=moment()[_0xaa07('0x85')]()['toString']();var _0x21098f=path[_0xaa07('0x5c')](config['root'],'server',_0xaa07('0x86'),_0xaa07('0x87'));var _0x5efb4d=path[_0xaa07('0x5c')](config[_0xaa07('0x5d')],_0xaa07('0x88'),'files',_0xaa07('0x5b'));var _0x4ed940=util['format'](_0xaa07('0x89'),_0x203a31);return db[_0xaa07('0x2d')][_0xaa07('0x4a')]({'where':{'id':_0x59d937['params']['id']},'attributes':['id','body',_0xaa07('0x8a'),'to','cc',_0xaa07('0x8b'),_0xaa07('0x8c'),'createdAt'],'include':_0x59d937[_0xaa07('0x34')][_0xaa07('0x5b')]?[{'model':db[_0xaa07('0x8d')],'as':'Attachments'}]:undefined})['then'](handleEntityNotFound(_0x5445c4,null))[_0xaa07('0x15')](function(_0x23740){if(_0x23740){var _0x3d5842=_0x23740;var _0x37fe9b={'from':_0x3d5842[_0xaa07('0x8a')],'to':_0x3d5842['to'],'subject':_0x3d5842[_0xaa07('0x8c')],'html':htmlEntities[_0xaa07('0x8e')](_0x3d5842['body']),'headers':{'Date':moment(_0x3d5842[_0xaa07('0x8f')])[_0xaa07('0x90')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x23740['cc']){_0x37fe9b[_0xaa07('0x91')]['Cc']=_0x23740['cc'];}if(_0x23740[_0xaa07('0x8b')]){_0x37fe9b[_0xaa07('0x91')][_0xaa07('0x92')]=_0x23740[_0xaa07('0x8b')];}return new Promise(function(_0x5cc815,_0x496504){if(_0x23740[_0xaa07('0x93')]){for(var _0x37fcbf=0x0;_0x37fcbf<_0x23740[_0xaa07('0x93')][_0xaa07('0x3a')];_0x37fcbf++){var _0x4469eb=_0x23740[_0xaa07('0x93')][_0x37fcbf];var _0x3ab04e=path['join'](_0x5efb4d,_0x4469eb[_0xaa07('0x5f')]);if(fs[_0xaa07('0x94')](_0x3ab04e)){_0x37fe9b[_0xaa07('0x5b')][_0xaa07('0x95')]({'name':_0x4469eb[_0xaa07('0x2a')],'contentType':_0x4469eb[_0xaa07('0x30')],'data':fs[_0xaa07('0x96')](_0x3ab04e)});}}}emlformat[_0xaa07('0x97')](_0x37fe9b,function(_0xc44435,_0x1236e4){if(_0xc44435)return _0x496504(_0xc44435);fs[_0xaa07('0x98')](path[_0xaa07('0x5c')](_0x21098f,_0x4ed940),_0x1236e4);return _0x5cc815(_0x1236e4);});});}})[_0xaa07('0x15')](function(_0x1e6ccf){if(_0x1e6ccf){return _0x5445c4['download'](path[_0xaa07('0x5c')](_0x21098f,_0x4ed940),_0x4ed940,function(_0x133c67){if(!_0x133c67)fs[_0xaa07('0x99')](path[_0xaa07('0x5c')](_0x21098f,_0x4ed940));});}})['catch'](handleError(_0x5445c4,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 02a50d8..96dd468 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 _0x3740=['remove','emit','hook','MailMessage','save','update'];(function(_0x3f4dd9,_0xe0b819){var _0x31c54a=function(_0x25e6c6){while(--_0x25e6c6){_0x3f4dd9['push'](_0x3f4dd9['shift']());}};_0x31c54a(++_0xe0b819);}(_0x3740,0x11d));var _0x0374=function(_0x9cfe28,_0x1a335c){_0x9cfe28=_0x9cfe28-0x0;var _0x54a1d0=_0x3740[_0x9cfe28];return _0x54a1d0;};'use strict';var EventEmitter=require('events');var MailMessage=require('../../mysqldb')['db'][_0x0374('0x0')];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0374('0x1'),'afterUpdate':_0x0374('0x2'),'afterDestroy':_0x0374('0x3')};function emitEvent(_0x2ee04f){return function(_0x23898c,_0xa94a7e,_0x2d1b84){MailMessageEvents['emit'](_0x2ee04f+':'+_0x23898c['id'],_0x23898c);MailMessageEvents[_0x0374('0x4')](_0x2ee04f,_0x23898c);_0x2d1b84(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0x0374('0x5')](e,emitEvent(event));}}module['exports']=MailMessageEvents; \ No newline at end of file +var _0x4d93=['exports','events','../../mysqldb','MailMessage','setMaxListeners','save','remove','emit','hasOwnProperty','hook'];(function(_0x5712f8,_0x17156b){var _0x14a364=function(_0x1da9de){while(--_0x1da9de){_0x5712f8['push'](_0x5712f8['shift']());}};_0x14a364(++_0x17156b);}(_0x4d93,0x169));var _0x34d9=function(_0x53efd8,_0x4610ff){_0x53efd8=_0x53efd8-0x0;var _0x1879d3=_0x4d93[_0x53efd8];return _0x1879d3;};'use strict';var EventEmitter=require(_0x34d9('0x0'));var MailMessage=require(_0x34d9('0x1'))['db'][_0x34d9('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x34d9('0x3')](0x0);var events={'afterCreate':_0x34d9('0x4'),'afterUpdate':'update','afterDestroy':_0x34d9('0x5')};function emitEvent(_0x5263d4){return function(_0x3dc684,_0x4c817a,_0x33063c){MailMessageEvents[_0x34d9('0x6')](_0x5263d4+':'+_0x3dc684['id'],_0x3dc684);MailMessageEvents[_0x34d9('0x6')](_0x5263d4,_0x3dc684);_0x33063c(null);};}for(var e in events){if(events[_0x34d9('0x7')](e)){var event=events[e];MailMessage[_0x34d9('0x8')](e,emitEvent(event));}}module[_0x34d9('0x9')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 3c3b668..bd11f89 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 _0x01d8=['bluebird','request-promise','path','rimraf','../../config/environment','./mailMessage.attributes','exports','define','MailMessage','mail_messages','messageId','fti_mail_messages','subject','FULLTEXT','body','plainBody','fromString','models','get','direction','toLowerCase','out','secret','isNil','MailInteraction','findOne','MailInteractionId','createdAt','catch','error','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment'];(function(_0x43f6ca,_0x5295ff){var _0x36dcad=function(_0x4c88ec){while(--_0x4c88ec){_0x43f6ca['push'](_0x43f6ca['shift']());}};_0x36dcad(++_0x5295ff);}(_0x01d8,0x88));var _0x801d=function(_0x3f4cd0,_0x303070){_0x3f4cd0=_0x3f4cd0-0x0;var _0x3f9f01=_0x01d8[_0x3f4cd0];return _0x3f9f01;};'use strict';var _=require(_0x801d('0x0'));var util=require(_0x801d('0x1'));var logger=require(_0x801d('0x2'))('api');var moment=require(_0x801d('0x3'));var BPromise=require(_0x801d('0x4'));var rp=require(_0x801d('0x5'));var htmlToText=require('html-to-text');var fs=require('fs');var path=require(_0x801d('0x6'));var rimraf=require(_0x801d('0x7'));var config=require(_0x801d('0x8'));var attributes=require(_0x801d('0x9'));module[_0x801d('0xa')]=function(_0x4d35c6,_0x5aab08){return _0x4d35c6[_0x801d('0xb')](_0x801d('0xc'),attributes,{'tableName':_0x801d('0xd'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x801d('0xe')]},{'name':_0x801d('0xf'),'fields':['plainBody',_0x801d('0x10')],'type':_0x801d('0x11')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x11d7fa,_0x4d4f4c,_0x17f7e3){if(_0x11d7fa[_0x801d('0x12')]){_0x11d7fa[_0x801d('0x13')]=htmlToText[_0x801d('0x14')](_0x11d7fa[_0x801d('0x12')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x17f7e3(null,_0x4d4f4c);},'afterCreate':function(_0x5adef6,_0x580e2b,_0x8a917a){var _0x37ec12=_0x4d35c6[_0x801d('0x15')];var _0x29cb56=_0x5adef6[_0x801d('0x16')]({'plain':!![]});if(_0x29cb56[_0x801d('0x17')][_0x801d('0x18')]()==='in'||_0x29cb56[_0x801d('0x17')][_0x801d('0x18')]()===_0x801d('0x19')&&!_0x29cb56[_0x801d('0x1a')]&&!_[_0x801d('0x1b')](_0x29cb56['UserId'])){_0x37ec12[_0x801d('0x1c')][_0x801d('0x1d')]({'where':{'id':_0x29cb56[_0x801d('0x1e')]}})['then'](function(_0x53c758){if(_0x53c758){_0x53c758['update']({'lastMsgAt':_0x29cb56[_0x801d('0x1f')],'lastMsgDirection':_0x29cb56[_0x801d('0x17')][_0x801d('0x18')]()});}})[_0x801d('0x20')](function(_0x1796e9){console[_0x801d('0x21')](_0x1796e9);});}_0x8a917a();}},'charset':'utf8mb4','collate':_0x801d('0x22')});}; \ No newline at end of file +var _0x3d9e=['subject','FULLTEXT','body','models','get','direction','toLowerCase','out','secret','isNil','UserId','MailInteraction','update','createdAt','error','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','request-promise','path','rimraf','./mailMessage.attributes','MailMessage','mail_messages','messageId','fti_mail_messages','plainBody'];(function(_0x420d3d,_0x31b95d){var _0x3d4235=function(_0x351661){while(--_0x351661){_0x420d3d['push'](_0x420d3d['shift']());}};_0x3d4235(++_0x31b95d);}(_0x3d9e,0x133));var _0xe3d9=function(_0x5caf7e,_0x52e1bc){_0x5caf7e=_0x5caf7e-0x0;var _0x5c3435=_0x3d9e[_0x5caf7e];return _0x5c3435;};'use strict';var _=require(_0xe3d9('0x0'));var util=require('util');var logger=require(_0xe3d9('0x1'))(_0xe3d9('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe3d9('0x3'));var htmlToText=require('html-to-text');var fs=require('fs');var path=require(_0xe3d9('0x4'));var rimraf=require(_0xe3d9('0x5'));var config=require('../../config/environment');var attributes=require(_0xe3d9('0x6'));module['exports']=function(_0x246e06,_0x138cd6){return _0x246e06['define'](_0xe3d9('0x7'),attributes,{'tableName':_0xe3d9('0x8'),'paranoid':![],'indexes':[{'name':_0xe3d9('0x9'),'fields':[_0xe3d9('0x9')]},{'name':_0xe3d9('0xa'),'fields':[_0xe3d9('0xb'),_0xe3d9('0xc')],'type':_0xe3d9('0xd')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4a596a,_0x1e7860,_0x4b2222){if(_0x4a596a[_0xe3d9('0xe')]){_0x4a596a[_0xe3d9('0xb')]=htmlToText['fromString'](_0x4a596a['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x4b2222(null,_0x1e7860);},'afterCreate':function(_0x18ca13,_0x573f58,_0x5e95c9){var _0x3921d8=_0x246e06[_0xe3d9('0xf')];var _0x1f75ba=_0x18ca13[_0xe3d9('0x10')]({'plain':!![]});if(_0x1f75ba[_0xe3d9('0x11')][_0xe3d9('0x12')]()==='in'||_0x1f75ba[_0xe3d9('0x11')][_0xe3d9('0x12')]()===_0xe3d9('0x13')&&!_0x1f75ba[_0xe3d9('0x14')]&&!_[_0xe3d9('0x15')](_0x1f75ba[_0xe3d9('0x16')])){_0x3921d8[_0xe3d9('0x17')]['findOne']({'where':{'id':_0x1f75ba['MailInteractionId']}})['then'](function(_0x16436f){if(_0x16436f){_0x16436f[_0xe3d9('0x18')]({'lastMsgAt':_0x1f75ba[_0xe3d9('0x19')],'lastMsgDirection':_0x1f75ba[_0xe3d9('0x11')][_0xe3d9('0x12')]()});}})['catch'](function(_0x3e14fb){console[_0xe3d9('0x1a')](_0x3e14fb);});}_0x5e95c9();}},'charset':_0xe3d9('0x1b'),'collate':_0xe3d9('0x1c')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 4683a09..6df95fc 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 _0x4024=['debug','stringify','error','code','message','info','catch','CreateMailMessage','MailMessage','create','body','options','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','client','http','redis','then','MailMessage,\x20%s,\x20%s','request\x20sent'];(function(_0x23971e,_0x24c061){var _0x54c10a=function(_0x554e54){while(--_0x554e54){_0x23971e['push'](_0x23971e['shift']());}};_0x54c10a(++_0x24c061);}(_0x4024,0x89));var _0x4402=function(_0x10ea18,_0x918c9a){_0x10ea18=_0x10ea18-0x0;var _0x3c3cd3=_0x4024[_0x10ea18];return _0x3c3cd3;};'use strict';var _=require(_0x4402('0x0'));var util=require(_0x4402('0x1'));var moment=require('moment');var BPromise=require(_0x4402('0x2'));var rs=require(_0x4402('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4402('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4402('0x5'))(_0x4402('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4402('0x7')][_0x4402('0x8')]({'port':0x232a});config[_0x4402('0x9')]=_['defaults'](config[_0x4402('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4402('0x9')]));require('./mailMessage.socket')['register'](socket);function respondWithRpcPromise(_0x30fd34,_0x4f56aa,_0x1a4a47){return new BPromise(function(_0x4e1a7e,_0x34b4a6){return client['request'](_0x30fd34,_0x1a4a47)[_0x4402('0xa')](function(_0x251286){logger['info'](_0x4402('0xb'),_0x4f56aa,_0x4402('0xc'));logger[_0x4402('0xd')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x4f56aa,_0x4402('0xc'),JSON[_0x4402('0xe')](_0x251286));if(_0x251286[_0x4402('0xf')]){if(_0x251286[_0x4402('0xf')][_0x4402('0x10')]===0x1f4){logger[_0x4402('0xf')](_0x4402('0xb'),_0x4f56aa,_0x251286[_0x4402('0xf')][_0x4402('0x11')]);return _0x34b4a6(_0x251286[_0x4402('0xf')][_0x4402('0x11')]);}logger[_0x4402('0xf')](_0x4402('0xb'),_0x4f56aa,_0x251286[_0x4402('0xf')][_0x4402('0x11')]);return _0x4e1a7e(_0x251286[_0x4402('0xf')][_0x4402('0x11')]);}else{logger[_0x4402('0x12')](_0x4402('0xb'),_0x4f56aa,_0x4402('0xc'));_0x4e1a7e(_0x251286['result']['message']);}})[_0x4402('0x13')](function(_0x2a7afc){logger['error'](_0x4402('0xb'),_0x4f56aa,_0x2a7afc);_0x34b4a6(_0x2a7afc);});});}exports[_0x4402('0x14')]=function(_0x5cb0c5){var _0x38b459=this;return new Promise(function(_0x4e0340,_0x55cc8c){return db[_0x4402('0x15')][_0x4402('0x16')](_0x5cb0c5[_0x4402('0x17')],{'raw':_0x5cb0c5['options']?_0x5cb0c5[_0x4402('0x18')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x6f1f72){logger[_0x4402('0x12')](_0x4402('0x14'),_0x5cb0c5);logger[_0x4402('0xd')](_0x4402('0x14'),_0x5cb0c5,JSON[_0x4402('0xe')](_0x6f1f72));_0x4e0340(_0x6f1f72);})[_0x4402('0x13')](function(_0x6b1fc5){logger[_0x4402('0xf')]('CreateMailMessage',_0x6b1fc5[_0x4402('0x11')],_0x5cb0c5);_0x55cc8c(_0x38b459['error'](0x1f4,_0x6b1fc5[_0x4402('0x11')]));});});}; \ No newline at end of file +var _0x1893=['result','MailMessage','body','options','CreateMailMessage','debug','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','register','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0xe0d5ef,_0x5e238c){var _0xfa7ccc=function(_0x281a07){while(--_0x281a07){_0xe0d5ef['push'](_0xe0d5ef['shift']());}};_0xfa7ccc(++_0x5e238c);}(_0x1893,0xa2));var _0x3189=function(_0x51bdda,_0x5666ca){_0x51bdda=_0x51bdda-0x0;var _0x998aab=_0x1893[_0x51bdda];return _0x998aab;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3189('0x0'));var BPromise=require(_0x3189('0x1'));var rs=require(_0x3189('0x2'));var fs=require('fs');var Redis=require(_0x3189('0x3'));var db=require(_0x3189('0x4'))['db'];var utils=require(_0x3189('0x5'));var logger=require(_0x3189('0x6'))('rpc');var config=require(_0x3189('0x7'));var jayson=require(_0x3189('0x8'));var client=jayson[_0x3189('0x9')][_0x3189('0xa')]({'port':0x232a});config[_0x3189('0xb')]=_[_0x3189('0xc')](config[_0x3189('0xb')],{'host':_0x3189('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3189('0xb')]));require('./mailMessage.socket')[_0x3189('0xe')](socket);function respondWithRpcPromise(_0x4ac683,_0x3ec9d0,_0x33cdfb){return new BPromise(function(_0xca480c,_0x176799){return client['request'](_0x4ac683,_0x33cdfb)[_0x3189('0xf')](function(_0x149428){logger[_0x3189('0x10')](_0x3189('0x11'),_0x3ec9d0,_0x3189('0x12'));logger['debug'](_0x3189('0x13'),_0x3ec9d0,_0x3189('0x12'),JSON[_0x3189('0x14')](_0x149428));if(_0x149428[_0x3189('0x15')]){if(_0x149428[_0x3189('0x15')][_0x3189('0x16')]===0x1f4){logger[_0x3189('0x15')](_0x3189('0x11'),_0x3ec9d0,_0x149428['error'][_0x3189('0x17')]);return _0x176799(_0x149428[_0x3189('0x15')][_0x3189('0x17')]);}logger[_0x3189('0x15')]('MailMessage,\x20%s,\x20%s',_0x3ec9d0,_0x149428[_0x3189('0x15')]['message']);return _0xca480c(_0x149428['error'][_0x3189('0x17')]);}else{logger['info'](_0x3189('0x11'),_0x3ec9d0,_0x3189('0x12'));_0xca480c(_0x149428[_0x3189('0x18')][_0x3189('0x17')]);}})['catch'](function(_0xd3d5a){logger[_0x3189('0x15')](_0x3189('0x11'),_0x3ec9d0,_0xd3d5a);_0x176799(_0xd3d5a);});});}exports['CreateMailMessage']=function(_0x561265){var _0xb0e89b=this;return new Promise(function(_0x306ed3,_0x2c1e59){return db[_0x3189('0x19')]['create'](_0x561265[_0x3189('0x1a')],{'raw':_0x561265[_0x3189('0x1b')]?_0x561265[_0x3189('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0x3189('0xf')](function(_0x47abb4){logger[_0x3189('0x10')](_0x3189('0x1c'),_0x561265);logger[_0x3189('0x1d')](_0x3189('0x1c'),_0x561265,JSON[_0x3189('0x14')](_0x47abb4));_0x306ed3(_0x47abb4);})[_0x3189('0x1e')](function(_0x5a08dc){logger['error'](_0x3189('0x1c'),_0x5a08dc[_0x3189('0x17')],_0x561265);_0x2c1e59(_0xb0e89b[_0x3189('0x15')](0x1f4,_0x5a08dc[_0x3189('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 24bb479..82caa17 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 _0x755b=['update','emit','removeListener','mailMessage:','save','remove'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0x755b,0xfa));var _0xb755=function(_0xc298ad,_0xea4dc2){_0xc298ad=_0xc298ad-0x0;var _0x11b2e6=_0x755b[_0xc298ad];return _0x11b2e6;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=[_0xb755('0x0'),_0xb755('0x1'),_0xb755('0x2')];function createListener(_0x455bef,_0x1658f5){return function(_0x626c8f){_0x1658f5[_0xb755('0x3')](_0x455bef,_0x626c8f);};}function removeListener(_0x35ec81,_0xed2068){return function(){MailMessageEvents[_0xb755('0x4')](_0x35ec81,_0xed2068);};}exports['register']=function(_0x1ec43a){for(var _0x399f2a=0x0,_0x15a732=events['length'];_0x399f2a<_0x15a732;_0x399f2a++){var _0x52a7b5=events[_0x399f2a];var _0x5b9691=createListener(_0xb755('0x5')+_0x52a7b5,_0x1ec43a);MailMessageEvents['on'](_0x52a7b5,_0x5b9691);}}; \ No newline at end of file +var _0xa85a=['mailMessage:','save','update','emit','removeListener','register','length'];(function(_0x5df7bb,_0x58a6a4){var _0x419db2=function(_0xbea27e){while(--_0xbea27e){_0x5df7bb['push'](_0x5df7bb['shift']());}};_0x419db2(++_0x58a6a4);}(_0xa85a,0xcc));var _0xaa85=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0xa85a[_0x17b6e3];return _0x3906f3;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=[_0xaa85('0x0'),'remove',_0xaa85('0x1')];function createListener(_0x27d2a2,_0x247039){return function(_0x38e92a){_0x247039[_0xaa85('0x2')](_0x27d2a2,_0x38e92a);};}function removeListener(_0x44e9dc,_0xa9d0b1){return function(){MailMessageEvents[_0xaa85('0x3')](_0x44e9dc,_0xa9d0b1);};}exports[_0xaa85('0x4')]=function(_0x2709d9){for(var _0xdbf70c=0x0,_0x7da8=events[_0xaa85('0x5')];_0xdbf70c<_0x7da8;_0xdbf70c++){var _0x2a00c5=events[_0xdbf70c];var _0x2148b5=createListener(_0xaa85('0x6')+_0x2a00c5,_0x2709d9);MailMessageEvents['on'](_0x2a00c5,_0x2148b5);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 14f31a6..db8cb03 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 _0x1924=['addAgents','put','/:id','update','delete','destroy','removeTeams','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./mailQueue.controller','get','isAuthenticated','index','/describe','describe','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','/:id/teams','addTeams'];(function(_0x1395e1,_0x2543e2){var _0x28047f=function(_0x5d3273){while(--_0x5d3273){_0x1395e1['push'](_0x1395e1['shift']());}};_0x28047f(++_0x2543e2);}(_0x1924,0x1e7));var _0x4192=function(_0x516ee3,_0xb042c8){_0x516ee3=_0x516ee3-0x0;var _0x5a8ffe=_0x1924[_0x516ee3];return _0x5a8ffe;};'use strict';var multer=require(_0x4192('0x0'));var util=require(_0x4192('0x1'));var path=require(_0x4192('0x2'));var timeout=require(_0x4192('0x3'));var express=require(_0x4192('0x4'));var router=express[_0x4192('0x5')]();var fs_extra=require(_0x4192('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x4192('0x7'));var config=require('../../config/environment');var controller=require(_0x4192('0x8'));router[_0x4192('0x9')]('/',auth[_0x4192('0xa')](),controller[_0x4192('0xb')]);router[_0x4192('0x9')](_0x4192('0xc'),auth[_0x4192('0xa')](),controller[_0x4192('0xd')]);router['get']('/:id',auth[_0x4192('0xa')](),controller[_0x4192('0xe')]);router[_0x4192('0x9')](_0x4192('0xf'),auth['isAuthenticated'](),controller[_0x4192('0x10')]);router[_0x4192('0x9')]('/:id/teams',auth[_0x4192('0xa')](),controller[_0x4192('0x11')]);router[_0x4192('0x9')](_0x4192('0x12'),auth[_0x4192('0xa')](),controller[_0x4192('0x13')]);router[_0x4192('0x14')]('/',auth[_0x4192('0xa')](),controller['create']);router[_0x4192('0x14')](_0x4192('0x15'),auth['isAuthenticated'](),controller[_0x4192('0x16')]);router[_0x4192('0x14')]('/:id/users',auth[_0x4192('0xa')](),controller[_0x4192('0x17')]);router[_0x4192('0x18')](_0x4192('0x19'),auth['isAuthenticated'](),controller[_0x4192('0x1a')]);router[_0x4192('0x1b')](_0x4192('0x19'),auth['isAuthenticated'](),controller[_0x4192('0x1c')]);router[_0x4192('0x1b')]('/:id/teams',auth['isAuthenticated'](),controller[_0x4192('0x1d')]);router[_0x4192('0x1b')](_0x4192('0x12'),auth['isAuthenticated'](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0xe88e=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./mailQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/members','/:id/teams','getTeams','getAgents','create','addTeams','post','addAgents','put','destroy','delete','exports','multer','util'];(function(_0x2fe50b,_0x155110){var _0x5e4800=function(_0x354497){while(--_0x354497){_0x2fe50b['push'](_0x2fe50b['shift']());}};_0x5e4800(++_0x155110);}(_0xe88e,0x178));var _0xee88=function(_0x4b90c2,_0xaae537){_0x4b90c2=_0x4b90c2-0x0;var _0x59b4c0=_0xe88e[_0x4b90c2];return _0x59b4c0;};'use strict';var multer=require(_0xee88('0x0'));var util=require(_0xee88('0x1'));var path=require(_0xee88('0x2'));var timeout=require(_0xee88('0x3'));var express=require(_0xee88('0x4'));var router=express[_0xee88('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xee88('0x6'));var interaction=require(_0xee88('0x7'));var config=require('../../config/environment');var controller=require(_0xee88('0x8'));router[_0xee88('0x9')]('/',auth[_0xee88('0xa')](),controller[_0xee88('0xb')]);router[_0xee88('0x9')](_0xee88('0xc'),auth[_0xee88('0xa')](),controller[_0xee88('0xd')]);router[_0xee88('0x9')](_0xee88('0xe'),auth[_0xee88('0xa')](),controller['show']);router[_0xee88('0x9')](_0xee88('0xf'),auth[_0xee88('0xa')](),controller['getMembers']);router[_0xee88('0x9')](_0xee88('0x10'),auth[_0xee88('0xa')](),controller[_0xee88('0x11')]);router['get']('/:id/users',auth[_0xee88('0xa')](),controller[_0xee88('0x12')]);router['post']('/',auth[_0xee88('0xa')](),controller[_0xee88('0x13')]);router['post'](_0xee88('0x10'),auth['isAuthenticated'](),controller[_0xee88('0x14')]);router[_0xee88('0x15')]('/:id/users',auth['isAuthenticated'](),controller[_0xee88('0x16')]);router[_0xee88('0x17')](_0xee88('0xe'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0xee88('0xa')](),controller[_0xee88('0x18')]);router[_0xee88('0x19')](_0xee88('0x10'),auth[_0xee88('0xa')](),controller['removeTeams']);router[_0xee88('0x19')]('/:id/users',auth[_0xee88('0xa')](),controller['removeAgents']);module[_0xee88('0x1a')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index bed5c46..93e7e71 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 _0xdba0=['sequelize','STRING','name','rrmemory','beepall','roundrobin'];(function(_0x237f07,_0x2142a9){var _0x22c133=function(_0x3e1280){while(--_0x3e1280){_0x237f07['push'](_0x237f07['shift']());}};_0x22c133(++_0x2142a9);}(_0xdba0,0xb4));var _0x0dba=function(_0x37b3e5,_0x33b516){_0x37b3e5=_0x37b3e5-0x0;var _0x207f20=_0xdba0[_0x37b3e5];return _0x207f20;};'use strict';var Sequelize=require(_0x0dba('0x0'));module['exports']={'name':{'type':Sequelize[_0x0dba('0x1')],'unique':_0x0dba('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x0dba('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x0dba('0x3'),_0x0dba('0x4'),_0x0dba('0x5'))}}; \ No newline at end of file +var _0x3aed=['beepall','roundrobin','sequelize','exports','STRING','name','INTEGER','ENUM','rrmemory'];(function(_0x2b559d,_0x1b3307){var _0x25d03a=function(_0x83ea79){while(--_0x83ea79){_0x2b559d['push'](_0x2b559d['shift']());}};_0x25d03a(++_0x1b3307);}(_0x3aed,0x1d6));var _0xd3ae=function(_0x2272b5,_0x362458){_0x2272b5=_0x2272b5-0x0;var _0x110156=_0x3aed[_0x2272b5];return _0x110156;};'use strict';var Sequelize=require(_0xd3ae('0x0'));module[_0xd3ae('0x1')]={'name':{'type':Sequelize[_0xd3ae('0x2')],'unique':_0xd3ae('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xd3ae('0x2')]},'timeout':{'type':Sequelize[_0xd3ae('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xd3ae('0x5')](_0xd3ae('0x6'),_0xd3ae('0x7'),_0xd3ae('0x8'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 47e6322..4de713b 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 _0x7f8b=['undefined','count','offset','set','update','destroy','get','MailQueues','UserProfileResource','then','error','stack','name','send','index','map','rawAttributes','type','getOptions','where','MailQueue','include','query','rows','catch','show','params','keys','intersection','model','attributes','fields','length','merge','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','UserMailQueue','filters','hasOwnProperty','nolimit','order','sort','pick','MailQueueId','filter','findAll','User','findAndCountAll','UserId','agent','mailPause','updatedAt','createdAt','SIP','findOne','getTeams','addTeams','ids','Team','Agents','interface','flatMap','sequelize','transaction','forEach','emit','userMailQueue:save','removeTeams','select','from','team_has_mail_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','all','value','userMailQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','bluebird','lodash','squel','ioredis','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','sendStatus','status','end','json','limit'];(function(_0x9c7f4a,_0x29cbcf){var _0xf27c07=function(_0x3bd3b9){while(--_0x3bd3b9){_0x9c7f4a['push'](_0x9c7f4a['shift']());}};_0xf27c07(++_0x29cbcf);}(_0x7f8b,0xd6));var _0xb7f8=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x7f8b[_0x173441];return _0x2423a8;};'use strict';var BPromise=require(_0xb7f8('0x0'));var util=require('util');var _=require(_0xb7f8('0x1'));var squel=require(_0xb7f8('0x2'));var Redis=require(_0xb7f8('0x3'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0xb7f8('0x4'));var config=require(_0xb7f8('0x5'));var db=require(_0xb7f8('0x6'))['db'];config[_0xb7f8('0x7')]=_[_0xb7f8('0x8')](config[_0xb7f8('0x7')],{'host':_0xb7f8('0x9'),'port':0x18eb});var socket=require(_0xb7f8('0xa'))(new Redis(config[_0xb7f8('0x7')]));require(_0xb7f8('0xb'))[_0xb7f8('0xc')](socket);function respondWithStatusCode(_0x292b23,_0x7b02fe){_0x7b02fe=_0x7b02fe||0xcc;return function(_0x1fde46){if(_0x1fde46){return _0x292b23[_0xb7f8('0xd')](_0x7b02fe);}return _0x292b23[_0xb7f8('0xe')](_0x7b02fe)[_0xb7f8('0xf')]();};}function respondWithResult(_0x13cdf6,_0x2f7d5f){_0x2f7d5f=_0x2f7d5f||0xc8;return function(_0x4c6e14){if(_0x4c6e14){return _0x13cdf6[_0xb7f8('0xe')](_0x2f7d5f)[_0xb7f8('0x10')](_0x4c6e14);}};}function respondWithFilteredResult(_0x5d4b6d,_0x563783){return function(_0x25996a){if(_0x25996a){var _0x5a8d92=typeof _0x563783['offset']==='undefined'&&typeof _0x563783[_0xb7f8('0x11')]===_0xb7f8('0x12');var _0x24a3db=_0x25996a[_0xb7f8('0x13')];var _0x34bd31=_0x5a8d92?0x0:_0x563783[_0xb7f8('0x14')];var _0x4d1bcf=_0x5a8d92?_0x25996a['count']:_0x563783[_0xb7f8('0x14')]+_0x563783[_0xb7f8('0x11')];var _0x35645c;if(_0x4d1bcf>=_0x24a3db){_0x4d1bcf=_0x24a3db;_0x35645c=0xc8;}else{_0x35645c=0xce;}_0x5d4b6d['status'](_0x35645c);return _0x5d4b6d[_0xb7f8('0x15')]('Content-Range',_0x34bd31+'-'+_0x4d1bcf+'/'+_0x24a3db)['json'](_0x25996a);}return null;};}function saveUpdates(_0x4c1d8e){return function(_0x3a4607){if(_0x3a4607){return _0x3a4607[_0xb7f8('0x16')](_0x4c1d8e)['then'](function(_0x73956a){return _0x73956a;});}return null;};}function removeEntity(_0x45d51b){return function(_0x23eba5){if(_0x23eba5){return _0x23eba5[_0xb7f8('0x17')]()['then'](function(){var _0x4bb3e2=_0x23eba5[_0xb7f8('0x18')]({'plain':!![]});var _0x1bd45b=_0xb7f8('0x19');return db[_0xb7f8('0x1a')]['destroy']({'where':{'type':_0x1bd45b,'resourceId':_0x4bb3e2['id']}})[_0xb7f8('0x1b')](function(){return _0x23eba5;});})['then'](function(){_0x45d51b['status'](0xcc)[_0xb7f8('0xf')]();});}};}function handleEntityNotFound(_0x1884cc){return function(_0x12cfa0){if(!_0x12cfa0){_0x1884cc[_0xb7f8('0xd')](0x194);}return _0x12cfa0;};}function handleError(_0xab7b83,_0x28d2b9){_0x28d2b9=_0x28d2b9||0x1f4;return function(_0x302574){logger[_0xb7f8('0x1c')](_0x302574[_0xb7f8('0x1d')]);if(_0x302574[_0xb7f8('0x1e')]){delete _0x302574[_0xb7f8('0x1e')];}_0xab7b83[_0xb7f8('0xe')](_0x28d2b9)[_0xb7f8('0x1f')](_0x302574);};}exports[_0xb7f8('0x20')]=function(_0x1ed230,_0x27caed){var _0xb6e509={};var _0x5f2009={'count':0x0,'rows':[]};var _0x57a9f7=_[_0xb7f8('0x21')](db['MailQueue'][_0xb7f8('0x22')],function(_0x1941af){return{'name':_0x1941af['fieldName'],'type':_0x1941af[_0xb7f8('0x23')]['key']};});_0xb6e509=qs[_0xb7f8('0x24')](_0x57a9f7,_0x1ed230);var _0x3477ed={'where':_0xb6e509[_0xb7f8('0x25')]};return db[_0xb7f8('0x26')][_0xb7f8('0x13')](_0x3477ed)[_0xb7f8('0x1b')](function(_0x1c4e14){_0x5f2009[_0xb7f8('0x13')]=_0x1c4e14;_0xb6e509['include']=qs[_0xb7f8('0x27')](_0x1ed230[_0xb7f8('0x28')]);return db['MailQueue']['findAll'](_0xb6e509);})['then'](function(_0x4d50b2){_0x5f2009[_0xb7f8('0x29')]=_0x4d50b2;return _0x5f2009;})[_0xb7f8('0x1b')](respondWithFilteredResult(_0x27caed,_0xb6e509))[_0xb7f8('0x2a')](handleError(_0x27caed,null));};exports[_0xb7f8('0x2b')]=function(_0x4bde2e,_0x5dfefe){var _0x2a84aa={'raw':!![],'where':{'id':_0x4bde2e[_0xb7f8('0x2c')]['id']}},_0x1f4c3d={};_0x1f4c3d['model']=_[_0xb7f8('0x2d')](db[_0xb7f8('0x26')][_0xb7f8('0x22')]);_0x1f4c3d['query']=_[_0xb7f8('0x2d')](_0x4bde2e['query']);_0x1f4c3d['filters']=_[_0xb7f8('0x2e')](_0x1f4c3d[_0xb7f8('0x2f')],_0x1f4c3d['query']);_0x2a84aa[_0xb7f8('0x30')]=_[_0xb7f8('0x2e')](_0x1f4c3d['model'],qs['fields'](_0x4bde2e[_0xb7f8('0x28')][_0xb7f8('0x31')]));_0x2a84aa['attributes']=_0x2a84aa[_0xb7f8('0x30')][_0xb7f8('0x32')]?_0x2a84aa[_0xb7f8('0x30')]:_0x1f4c3d['model'];if(_0x4bde2e['query']['includeAll']){_0x2a84aa[_0xb7f8('0x27')]=[{'all':!![]}];}_0x2a84aa=_[_0xb7f8('0x33')]({},_0x2a84aa,_0x4bde2e[_0xb7f8('0x34')]);return db[_0xb7f8('0x26')][_0xb7f8('0x35')](_0x2a84aa)[_0xb7f8('0x1b')](handleEntityNotFound(_0x5dfefe,null))[_0xb7f8('0x1b')](respondWithResult(_0x5dfefe,null))[_0xb7f8('0x2a')](handleError(_0x5dfefe,null));};exports['create']=function(_0x43d660,_0x30bc10){return db['MailQueue'][_0xb7f8('0x36')](_0x43d660[_0xb7f8('0x37')],{})[_0xb7f8('0x1b')](function(_0xee6c19){var _0x55338b=_0x43d660[_0xb7f8('0x38')][_0xb7f8('0x18')]({'plain':!![]});if(!_0x55338b)throw new Error(_0xb7f8('0x39'));if(_0x55338b[_0xb7f8('0x3a')]===_0xb7f8('0x38')){var _0x2264d3=_0xee6c19['get']({'plain':!![]});var _0x420f31='MailQueues';return db[_0xb7f8('0x3b')][_0xb7f8('0x35')]({'where':{'name':_0x420f31,'userProfileId':_0x55338b['userProfileId']},'raw':!![]})['then'](function(_0x3a1893){if(_0x3a1893&&_0x3a1893[_0xb7f8('0x3c')]===0x0){return db[_0xb7f8('0x1a')][_0xb7f8('0x36')]({'name':_0x2264d3[_0xb7f8('0x1e')],'resourceId':_0x2264d3['id'],'type':_0x3a1893['name'],'sectionId':_0x3a1893['id']},{})['then'](function(){return _0xee6c19;});}else{return _0xee6c19;}})[_0xb7f8('0x2a')](function(_0x23ec41){logger['error'](_0xb7f8('0x3d'),_0x23ec41);throw _0x23ec41;});}return _0xee6c19;})[_0xb7f8('0x1b')](respondWithResult(_0x30bc10,0xc9))[_0xb7f8('0x2a')](handleError(_0x30bc10,null));};exports[_0xb7f8('0x16')]=function(_0x200949,_0x4c0381){if(_0x200949[_0xb7f8('0x37')]['id']){delete _0x200949['body']['id'];}return db['MailQueue'][_0xb7f8('0x35')]({'where':{'id':_0x200949['params']['id']}})[_0xb7f8('0x1b')](handleEntityNotFound(_0x4c0381,null))[_0xb7f8('0x1b')](saveUpdates(_0x200949[_0xb7f8('0x37')],null))['then'](respondWithResult(_0x4c0381,null))['catch'](handleError(_0x4c0381,null));};exports['destroy']=function(_0x222bd1,_0x15971e){return db[_0xb7f8('0x26')][_0xb7f8('0x35')]({'where':{'id':_0x222bd1['params']['id']}})[_0xb7f8('0x1b')](handleEntityNotFound(_0x15971e,null))[_0xb7f8('0x1b')](removeEntity(_0x15971e,null))[_0xb7f8('0x2a')](handleError(_0x15971e,null));};exports['describe']=function(_0x3f9ec7,_0xf7fc5d){return db[_0xb7f8('0x26')][_0xb7f8('0x3e')]()[_0xb7f8('0x1b')](respondWithResult(_0xf7fc5d,null))[_0xb7f8('0x2a')](handleError(_0xf7fc5d,null));};exports['getMembers']=function(_0xdc35f5,_0x42877f){var _0x4532b1={'raw':!![],'where':{}},_0x3a70c7={},_0x45dd67;return db[_0xb7f8('0x26')]['findOne']({'where':{'id':_0xdc35f5[_0xb7f8('0x2c')]['id']}})[_0xb7f8('0x1b')](handleEntityNotFound(_0x42877f,null))['then'](function(_0x19e902){if(_0x19e902){_0x45dd67=_0x19e902['get']({'plain':!![]});_0x3a70c7['model']=_[_0xb7f8('0x2d')](db[_0xb7f8('0x3f')][_0xb7f8('0x22')]);_0x3a70c7[_0xb7f8('0x28')]=_[_0xb7f8('0x2d')](_0xdc35f5['query']);_0x3a70c7[_0xb7f8('0x40')]=_[_0xb7f8('0x2e')](_0x3a70c7[_0xb7f8('0x2f')],_0x3a70c7['query']);_0x4532b1[_0xb7f8('0x30')]=_[_0xb7f8('0x2e')](_0x3a70c7['model'],qs[_0xb7f8('0x31')](_0xdc35f5['query']['fields']));_0x4532b1[_0xb7f8('0x30')]=_0x4532b1[_0xb7f8('0x30')]['length']?_0x4532b1[_0xb7f8('0x30')]:_0x3a70c7['model'];if(!_0xdc35f5[_0xb7f8('0x28')][_0xb7f8('0x41')](_0xb7f8('0x42'))){_0x4532b1[_0xb7f8('0x11')]=qs[_0xb7f8('0x11')](_0xdc35f5[_0xb7f8('0x28')][_0xb7f8('0x11')]);_0x4532b1[_0xb7f8('0x14')]=qs[_0xb7f8('0x14')](_0xdc35f5[_0xb7f8('0x28')][_0xb7f8('0x14')]);}_0x4532b1[_0xb7f8('0x43')]=qs[_0xb7f8('0x44')](_0xdc35f5[_0xb7f8('0x28')][_0xb7f8('0x44')]);_0x4532b1['where']=qs['filters'](_[_0xb7f8('0x45')](_0xdc35f5['query'],_0x3a70c7[_0xb7f8('0x40')]));_0x4532b1['where'][_0xb7f8('0x46')]=_0x19e902['id'];if(_0xdc35f5[_0xb7f8('0x28')][_0xb7f8('0x47')]){_0x4532b1['where']=_[_0xb7f8('0x33')](_0x4532b1[_0xb7f8('0x25')],{'$or':_['map'](_0x4532b1[_0xb7f8('0x30')],function(_0x3e836a){var _0x25f343={};_0x25f343[_0x3e836a]={'$like':'%'+_0xdc35f5['query'][_0xb7f8('0x47')]+'%'};return _0x25f343;})});}_0x4532b1=_['merge']({},_0x4532b1,_0xdc35f5['options']);return db[_0xb7f8('0x3f')][_0xb7f8('0x48')](_0x4532b1);}})[_0xb7f8('0x1b')](function(_0x148351){if(_0x148351){return db[_0xb7f8('0x49')][_0xb7f8('0x4a')]({'where':{'id':_[_0xb7f8('0x21')](_0x148351,_0xb7f8('0x4b')),'role':_0xb7f8('0x4c')},'attributes':['id',_0xb7f8('0x1e'),_0xb7f8('0x4d'),_0xb7f8('0x4e'),_0xb7f8('0x4f')]});}})[_0xb7f8('0x1b')](function(_0x405ce4){if(_0x405ce4){return{'count':_0x405ce4[_0xb7f8('0x13')],'rows':_[_0xb7f8('0x21')](_0x405ce4[_0xb7f8('0x29')],function(_0x4d1008){return{'membername':_0x4d1008['name'],'UserId':_0x4d1008['id'],'queue_name':_0x45dd67['name'],'MailQueueId':_0x45dd67['id'],'interface':util['format']('%s/%s',_0xb7f8('0x50'),_0x4d1008[_0xb7f8('0x1e')]),'penalty':0x0,'paused':_0x4d1008['mailPause'],'createdAt':_0x4d1008['createdAt'],'updatedAt':_0x4d1008[_0xb7f8('0x4e')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x42877f,_0x4532b1))['catch'](handleError(_0x42877f,null));};exports['getTeams']=function(_0x41dbf2,_0xe69ada){var _0x34bb9d={};var _0x18a8a4={};var _0x48a69a;var _0x1d8bae;return db[_0xb7f8('0x26')][_0xb7f8('0x51')]({'where':{'id':_0x41dbf2[_0xb7f8('0x2c')]['id']}})[_0xb7f8('0x1b')](handleEntityNotFound(_0xe69ada,null))['then'](function(_0x4c5b0e){if(_0x4c5b0e){_0x48a69a=_0x4c5b0e;_0x18a8a4['model']=_[_0xb7f8('0x2d')](db['Team'][_0xb7f8('0x22')]);_0x18a8a4[_0xb7f8('0x28')]=_['keys'](_0x41dbf2[_0xb7f8('0x28')]);_0x18a8a4['filters']=_[_0xb7f8('0x2e')](_0x18a8a4['model'],_0x18a8a4[_0xb7f8('0x28')]);_0x34bb9d[_0xb7f8('0x30')]=_['intersection'](_0x18a8a4['model'],qs['fields'](_0x41dbf2['query'][_0xb7f8('0x31')]));_0x34bb9d['attributes']=_0x34bb9d[_0xb7f8('0x30')]['length']?_0x34bb9d[_0xb7f8('0x30')]:_0x18a8a4[_0xb7f8('0x2f')];_0x34bb9d[_0xb7f8('0x43')]=qs[_0xb7f8('0x44')](_0x41dbf2['query'][_0xb7f8('0x44')]);_0x34bb9d[_0xb7f8('0x25')]=qs['filters'](_['pick'](_0x41dbf2[_0xb7f8('0x28')],_0x18a8a4[_0xb7f8('0x40')]));if(_0x41dbf2['query']['filter']){_0x34bb9d[_0xb7f8('0x25')]=_[_0xb7f8('0x33')](_0x34bb9d[_0xb7f8('0x25')],{'$or':_['map'](_0x34bb9d['attributes'],function(_0x3d51ea){var _0x25b253={};_0x25b253[_0x3d51ea]={'$like':'%'+_0x41dbf2['query'][_0xb7f8('0x47')]+'%'};return _0x25b253;})});}_0x34bb9d=_[_0xb7f8('0x33')]({},_0x34bb9d,_0x41dbf2[_0xb7f8('0x34')]);return _0x48a69a[_0xb7f8('0x52')](_0x34bb9d);}})['then'](function(_0x4d17a5){if(_0x4d17a5){_0x1d8bae=_0x4d17a5[_0xb7f8('0x32')];if(!_0x41dbf2[_0xb7f8('0x28')]['hasOwnProperty'](_0xb7f8('0x42'))){_0x34bb9d[_0xb7f8('0x11')]=qs['limit'](_0x41dbf2[_0xb7f8('0x28')]['limit']);_0x34bb9d['offset']=qs[_0xb7f8('0x14')](_0x41dbf2[_0xb7f8('0x28')][_0xb7f8('0x14')]);}return _0x48a69a['getTeams'](_0x34bb9d);}})[_0xb7f8('0x1b')](function(_0x93d2a6){if(_0x93d2a6){return _0x93d2a6?{'count':_0x1d8bae,'rows':_0x93d2a6}:null;}})['then'](respondWithResult(_0xe69ada,null))['catch'](handleError(_0xe69ada,null));};exports[_0xb7f8('0x53')]=function(_0xb236a9,_0x543086){var _0x362dc4=_0xb236a9[_0xb7f8('0x37')][_0xb7f8('0x54')];return db[_0xb7f8('0x55')][_0xb7f8('0x48')]({'where':{'id':_0x362dc4},'attributes':['id'],'include':[{'model':db[_0xb7f8('0x49')],'as':_0xb7f8('0x56'),'attributes':['id',_0xb7f8('0x1e'),'online','voicePause',_0xb7f8('0x57')],'raw':!![]}]})['then'](function(_0x230ba5){if(_0x230ba5){var _0x7f5ffd=_[_0xb7f8('0x58')](_0x230ba5,function(_0x1ebebb){var _0x5b57c3=_0x1ebebb[_0xb7f8('0x18')]({'plain':!![]});return _0x5b57c3[_0xb7f8('0x56')];});return db['MailQueue'][_0xb7f8('0x35')]({'where':{'id':_0xb236a9[_0xb7f8('0x2c')]['id']}})[_0xb7f8('0x1b')](function(_0x58a2d2){return db[_0xb7f8('0x59')][_0xb7f8('0x5a')](function(_0x17676f){return _0x58a2d2[_0xb7f8('0x53')](_0x362dc4,{'transaction':_0x17676f})['then'](function(){return BPromise['each'](_0x7f5ffd,function(_0x3d7104){return db['UserMailQueue']['findOrCreate']({'where':{'UserId':_0x3d7104['id'],'MailQueueId':_0xb236a9[_0xb7f8('0x2c')]['id']},'transaction':_0x17676f});});})[_0xb7f8('0x1b')](function(){_0x7f5ffd[_0xb7f8('0x5b')](function(_0x4127fc){socket[_0xb7f8('0x5c')](_0xb7f8('0x5d'),{'UserId':_0x4127fc['id'],'MailQueueId':_0x58a2d2['id']});});});});});}})[_0xb7f8('0x1b')](respondWithStatusCode(_0x543086,null))['catch'](handleError(_0x543086,null));};exports[_0xb7f8('0x5e')]=function(_0x1d95c5,_0x449263){return db[_0xb7f8('0x55')][_0xb7f8('0x48')]({'where':{'id':_0x1d95c5['query']['ids']},'attributes':['id'],'include':[{'model':db[_0xb7f8('0x49')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xb7f8('0x1b')](handleEntityNotFound(_0x449263,null))['then'](function(_0xb9fb5c){var _0x5cfae3=_[_0xb7f8('0x21')](_0xb9fb5c,'id');var _0x55a659=[];var _0x9e1a2e=[];var _0x216d50=squel[_0xb7f8('0x5f')]();_0x216d50['field']('tq.TeamId')[_0xb7f8('0x60')](_0xb7f8('0x61'),'tq')['join'](_0xb7f8('0x62'),'ut',_0xb7f8('0x63'))[_0xb7f8('0x25')](_0xb7f8('0x64'),_0x1d95c5[_0xb7f8('0x2c')]['id']);for(var _0x32a336=0x0;_0x32a336<_0xb9fb5c[_0xb7f8('0x32')];_0x32a336+=0x1){let _0x5f37ac=_0xb9fb5c[_0x32a336];for(var _0x30ddc0=0x0;_0x30ddc0<_0x5f37ac[_0xb7f8('0x56')][_0xb7f8('0x32')];_0x30ddc0+=0x1){let _0x4ea94f=_0x5f37ac['Agents'][_0x30ddc0];var _0x173be3=_0x216d50[_0xb7f8('0x65')]();_0x173be3[_0xb7f8('0x25')](_0xb7f8('0x66'),_0x4ea94f['id']);_0x9e1a2e[_0xb7f8('0x67')](db[_0xb7f8('0x59')]['query'](_0x173be3['toString'](),{'type':db[_0xb7f8('0x59')][_0xb7f8('0x68')][_0xb7f8('0x69')]})[_0xb7f8('0x1b')](function(_0x4ced1c){if(_0x4ced1c[_0xb7f8('0x32')]===0x1){return _0x4ea94f['id'];}else{var _0x48d34e=_[_0xb7f8('0x6a')](_[_0xb7f8('0x21')](_0x4ced1c,'TeamId'),function(_0xba1d70){return _['includes'](_0x5cfae3,_0xba1d70);});if(_0x48d34e){return _0x4ea94f['id'];}}}));}}return BPromise[_0xb7f8('0x6b')](_0x9e1a2e)[_0xb7f8('0x1b')](function(_0x407b8e){_0x55a659=_(_0x55a659)['union'](_0x407b8e)['compact']()[_0xb7f8('0x6c')]();return db[_0xb7f8('0x26')][_0xb7f8('0x35')]({'where':{'id':_0x1d95c5['params']['id']}})[_0xb7f8('0x1b')](function(_0x382e36){return db['sequelize'][_0xb7f8('0x5a')](function(_0x33fc2d){return _0x382e36['removeTeams'](_0x1d95c5[_0xb7f8('0x28')][_0xb7f8('0x54')],{'transaction':_0x33fc2d})[_0xb7f8('0x1b')](function(){if(!_['isEmpty'](_0x55a659)){return _0x382e36['removeAgents'](_0x55a659,{'transaction':_0x33fc2d});}})['then'](function(){_0x55a659[_0xb7f8('0x5b')](function(_0x4ee89f){socket['emit'](_0xb7f8('0x6d'),{'UserId':_0x4ee89f,'MailQueueId':_0x382e36['id']});});});});});});})['then'](respondWithStatusCode(_0x449263,null))[_0xb7f8('0x2a')](handleError(_0x449263,null));};exports['addAgents']=function(_0x31003c,_0x1bd703){return db[_0xb7f8('0x26')]['find']({'where':{'id':_0x31003c[_0xb7f8('0x2c')]['id']}})[_0xb7f8('0x1b')](handleEntityNotFound(_0x1bd703,null))['then'](function(_0x1d9709){if(_0x1d9709){return _0x1d9709[_0xb7f8('0x6e')](_0x31003c[_0xb7f8('0x37')]['ids'],_[_0xb7f8('0x6f')](_0x31003c['body'],['ids','id'])||{})[_0xb7f8('0x70')](function(_0x1e06ea){for(var _0x4defb9=0x0;_0x4defb9<_0x31003c[_0xb7f8('0x37')][_0xb7f8('0x54')][_0xb7f8('0x32')];_0x4defb9+=0x1){socket[_0xb7f8('0x5c')]('userMailQueue:save',{'UserId':Number(_0x31003c['body'][_0xb7f8('0x54')][_0x4defb9]),'MailQueueId':Number(_0x31003c[_0xb7f8('0x2c')]['id'])});}return _0x1e06ea;});}})[_0xb7f8('0x1b')](respondWithResult(_0x1bd703,null))[_0xb7f8('0x2a')](handleError(_0x1bd703,null));};exports[_0xb7f8('0x71')]=function(_0x5577da,_0x426d9f){return db[_0xb7f8('0x26')][_0xb7f8('0x35')]({'where':{'id':_0x5577da[_0xb7f8('0x2c')]['id']}})[_0xb7f8('0x1b')](handleEntityNotFound(_0x426d9f,null))['then'](function(_0x27b9ab){if(_0x27b9ab){return _0x27b9ab[_0xb7f8('0x71')](_0x5577da[_0xb7f8('0x28')][_0xb7f8('0x54')])[_0xb7f8('0x1b')](function(){if(_[_0xb7f8('0x72')](_0x5577da[_0xb7f8('0x28')][_0xb7f8('0x54')])){for(var _0x3ca462=0x0;_0x3ca462<_0x5577da[_0xb7f8('0x28')]['ids'][_0xb7f8('0x32')];_0x3ca462+=0x1){socket['emit'](_0xb7f8('0x6d'),{'UserId':Number(_0x5577da['query'][_0xb7f8('0x54')][_0x3ca462]),'MailQueueId':Number(_0x5577da[_0xb7f8('0x2c')]['id'])});}}else{socket[_0xb7f8('0x5c')](_0xb7f8('0x6d'),{'UserId':Number(_0x5577da[_0xb7f8('0x28')][_0xb7f8('0x54')]),'MailQueueId':Number(_0x5577da['params']['id'])});}});}})[_0xb7f8('0x1b')](respondWithStatusCode(_0x426d9f,null))[_0xb7f8('0x2a')](handleError(_0x426d9f,null));};exports[_0xb7f8('0x73')]=function(_0x5cca03,_0x40fb9c){var _0x4a1c7f={};var _0x4c246d={};var _0x3858d0;var _0x566e67;return db[_0xb7f8('0x26')]['findOne']({'where':{'id':_0x5cca03[_0xb7f8('0x2c')]['id']}})['then'](handleEntityNotFound(_0x40fb9c,null))[_0xb7f8('0x1b')](function(_0x487c01){if(_0x487c01){_0x3858d0=_0x487c01;_0x4c246d[_0xb7f8('0x2f')]=_[_0xb7f8('0x2d')](db[_0xb7f8('0x49')][_0xb7f8('0x22')]);_0x4c246d[_0xb7f8('0x28')]=_[_0xb7f8('0x2d')](_0x5cca03[_0xb7f8('0x28')]);_0x4c246d[_0xb7f8('0x40')]=_[_0xb7f8('0x2e')](_0x4c246d[_0xb7f8('0x2f')],_0x4c246d[_0xb7f8('0x28')]);_0x4a1c7f[_0xb7f8('0x30')]=_[_0xb7f8('0x2e')](_0x4c246d['model'],qs['fields'](_0x5cca03[_0xb7f8('0x28')]['fields']));_0x4a1c7f[_0xb7f8('0x30')]=_0x4a1c7f[_0xb7f8('0x30')][_0xb7f8('0x32')]?_0x4a1c7f[_0xb7f8('0x30')]:_0x4c246d[_0xb7f8('0x2f')];_0x4a1c7f[_0xb7f8('0x43')]=qs[_0xb7f8('0x44')](_0x5cca03['query'][_0xb7f8('0x44')]);_0x4a1c7f[_0xb7f8('0x25')]=qs[_0xb7f8('0x40')](_['pick'](_0x5cca03[_0xb7f8('0x28')],_0x4c246d[_0xb7f8('0x40')]));if(_0x5cca03[_0xb7f8('0x28')][_0xb7f8('0x47')]){_0x4a1c7f[_0xb7f8('0x25')]=_[_0xb7f8('0x33')](_0x4a1c7f['where'],{'$or':_[_0xb7f8('0x21')](_0x4a1c7f[_0xb7f8('0x30')],function(_0x578d5c){var _0x549a12={};_0x549a12[_0x578d5c]={'$like':'%'+_0x5cca03[_0xb7f8('0x28')][_0xb7f8('0x47')]+'%'};return _0x549a12;})});}_0x4a1c7f=_['merge']({},_0x4a1c7f,_0x5cca03[_0xb7f8('0x34')]);return _0x3858d0[_0xb7f8('0x73')](_0x4a1c7f);}})[_0xb7f8('0x1b')](function(_0xb5034b){if(_0xb5034b){_0x566e67=_0xb5034b[_0xb7f8('0x32')];if(!_0x5cca03[_0xb7f8('0x28')]['hasOwnProperty'](_0xb7f8('0x42'))){_0x4a1c7f['limit']=qs[_0xb7f8('0x11')](_0x5cca03['query'][_0xb7f8('0x11')]);_0x4a1c7f[_0xb7f8('0x14')]=qs[_0xb7f8('0x14')](_0x5cca03['query'][_0xb7f8('0x14')]);}return _0x3858d0[_0xb7f8('0x73')](_0x4a1c7f);}})[_0xb7f8('0x1b')](function(_0x70fc85){if(_0x70fc85){return _0x70fc85?{'count':_0x566e67,'rows':_0x70fc85}:null;}})['then'](respondWithResult(_0x40fb9c,null))[_0xb7f8('0x2a')](handleError(_0x40fb9c,null));}; \ No newline at end of file +var _0x57b4=['from','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','removeAgents','userMailQueue:remove','addAgents','omit','spread','isArray','getAgents','bluebird','util','lodash','ioredis','../../components/parsers/qs','../../mysqldb','redis','defaults','localhost','./mailQueue.socket','register','json','offset','undefined','limit','count','status','set','Content-Range','update','destroy','MailQueues','UserProfileResource','then','end','sendStatus','error','stack','name','send','map','MailQueue','rawAttributes','type','getOptions','include','query','findAll','catch','model','keys','filters','intersection','attributes','fields','length','merge','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','getMembers','UserMailQueue','nolimit','order','sort','where','pick','filter','User','mailPause','createdAt','%s/%s','SIP','getTeams','hasOwnProperty','addTeams','ids','Team','online','voicePause','interface','Agents','sequelize','transaction','each','findOrCreate','forEach','emit','userMailQueue:save','removeTeams','select','field'];(function(_0x5a09e9,_0x391256){var _0x5e4735=function(_0x23d780){while(--_0x23d780){_0x5a09e9['push'](_0x5a09e9['shift']());}};_0x5e4735(++_0x391256);}(_0x57b4,0x174));var _0x457b=function(_0x2839db,_0x1003dd){_0x2839db=_0x2839db-0x0;var _0xd29a37=_0x57b4[_0x2839db];return _0xd29a37;};'use strict';var BPromise=require(_0x457b('0x0'));var util=require(_0x457b('0x1'));var _=require(_0x457b('0x2'));var squel=require('squel');var Redis=require(_0x457b('0x3'));var qs=require(_0x457b('0x4'));var logger=require('../../config/logger')('api');var config=require('../../config/environment');var db=require(_0x457b('0x5'))['db'];config[_0x457b('0x6')]=_[_0x457b('0x7')](config['redis'],{'host':_0x457b('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x457b('0x6')]));require(_0x457b('0x9'))[_0x457b('0xa')](socket);function respondWithStatusCode(_0x6ba95e,_0x4a9bdf){_0x4a9bdf=_0x4a9bdf||0xcc;return function(_0x2acced){if(_0x2acced){return _0x6ba95e['sendStatus'](_0x4a9bdf);}return _0x6ba95e['status'](_0x4a9bdf)['end']();};}function respondWithResult(_0xc6abdf,_0x31a7bd){_0x31a7bd=_0x31a7bd||0xc8;return function(_0x5e12dc){if(_0x5e12dc){return _0xc6abdf['status'](_0x31a7bd)[_0x457b('0xb')](_0x5e12dc);}};}function respondWithFilteredResult(_0x346251,_0x44c8b2){return function(_0x35f469){if(_0x35f469){var _0x338499=typeof _0x44c8b2[_0x457b('0xc')]===_0x457b('0xd')&&typeof _0x44c8b2[_0x457b('0xe')]===_0x457b('0xd');var _0x183d8a=_0x35f469[_0x457b('0xf')];var _0x1530c9=_0x338499?0x0:_0x44c8b2[_0x457b('0xc')];var _0x2e28f0=_0x338499?_0x35f469[_0x457b('0xf')]:_0x44c8b2['offset']+_0x44c8b2[_0x457b('0xe')];var _0x3128bc;if(_0x2e28f0>=_0x183d8a){_0x2e28f0=_0x183d8a;_0x3128bc=0xc8;}else{_0x3128bc=0xce;}_0x346251[_0x457b('0x10')](_0x3128bc);return _0x346251[_0x457b('0x11')](_0x457b('0x12'),_0x1530c9+'-'+_0x2e28f0+'/'+_0x183d8a)[_0x457b('0xb')](_0x35f469);}return null;};}function saveUpdates(_0x55185d){return function(_0x536e2a){if(_0x536e2a){return _0x536e2a[_0x457b('0x13')](_0x55185d)['then'](function(_0x57b6d6){return _0x57b6d6;});}return null;};}function removeEntity(_0x16f432){return function(_0x38f7a7){if(_0x38f7a7){return _0x38f7a7[_0x457b('0x14')]()['then'](function(){var _0x2010f1=_0x38f7a7['get']({'plain':!![]});var _0x5a1da8=_0x457b('0x15');return db[_0x457b('0x16')]['destroy']({'where':{'type':_0x5a1da8,'resourceId':_0x2010f1['id']}})[_0x457b('0x17')](function(){return _0x38f7a7;});})['then'](function(){_0x16f432[_0x457b('0x10')](0xcc)[_0x457b('0x18')]();});}};}function handleEntityNotFound(_0x236d24){return function(_0x2dc386){if(!_0x2dc386){_0x236d24[_0x457b('0x19')](0x194);}return _0x2dc386;};}function handleError(_0x5acabe,_0x5d9da6){_0x5d9da6=_0x5d9da6||0x1f4;return function(_0xdd0cdc){logger[_0x457b('0x1a')](_0xdd0cdc[_0x457b('0x1b')]);if(_0xdd0cdc[_0x457b('0x1c')]){delete _0xdd0cdc['name'];}_0x5acabe[_0x457b('0x10')](_0x5d9da6)[_0x457b('0x1d')](_0xdd0cdc);};}exports['index']=function(_0xbfdc41,_0x37c7ab){var _0x49b0a2={};var _0x1319ef={'count':0x0,'rows':[]};var _0x511f99=_[_0x457b('0x1e')](db[_0x457b('0x1f')][_0x457b('0x20')],function(_0x99d23c){return{'name':_0x99d23c['fieldName'],'type':_0x99d23c[_0x457b('0x21')]['key']};});_0x49b0a2=qs[_0x457b('0x22')](_0x511f99,_0xbfdc41);var _0x12015f={'where':_0x49b0a2['where']};return db[_0x457b('0x1f')]['count'](_0x12015f)[_0x457b('0x17')](function(_0x2ace3e){_0x1319ef[_0x457b('0xf')]=_0x2ace3e;_0x49b0a2['include']=qs[_0x457b('0x23')](_0xbfdc41[_0x457b('0x24')]);return db[_0x457b('0x1f')][_0x457b('0x25')](_0x49b0a2);})[_0x457b('0x17')](function(_0x7988ce){_0x1319ef['rows']=_0x7988ce;return _0x1319ef;})[_0x457b('0x17')](respondWithFilteredResult(_0x37c7ab,_0x49b0a2))[_0x457b('0x26')](handleError(_0x37c7ab,null));};exports['show']=function(_0x3e7923,_0x1734e7){var _0xca2522={'raw':!![],'where':{'id':_0x3e7923['params']['id']}},_0x2fcde3={};_0x2fcde3[_0x457b('0x27')]=_[_0x457b('0x28')](db[_0x457b('0x1f')][_0x457b('0x20')]);_0x2fcde3[_0x457b('0x24')]=_['keys'](_0x3e7923[_0x457b('0x24')]);_0x2fcde3[_0x457b('0x29')]=_[_0x457b('0x2a')](_0x2fcde3[_0x457b('0x27')],_0x2fcde3['query']);_0xca2522[_0x457b('0x2b')]=_[_0x457b('0x2a')](_0x2fcde3[_0x457b('0x27')],qs[_0x457b('0x2c')](_0x3e7923[_0x457b('0x24')][_0x457b('0x2c')]));_0xca2522['attributes']=_0xca2522[_0x457b('0x2b')][_0x457b('0x2d')]?_0xca2522[_0x457b('0x2b')]:_0x2fcde3[_0x457b('0x27')];if(_0x3e7923[_0x457b('0x24')]['includeAll']){_0xca2522[_0x457b('0x23')]=[{'all':!![]}];}_0xca2522=_[_0x457b('0x2e')]({},_0xca2522,_0x3e7923[_0x457b('0x2f')]);return db[_0x457b('0x1f')][_0x457b('0x30')](_0xca2522)['then'](handleEntityNotFound(_0x1734e7,null))[_0x457b('0x17')](respondWithResult(_0x1734e7,null))['catch'](handleError(_0x1734e7,null));};exports[_0x457b('0x31')]=function(_0x4445ab,_0x23e35f){return db[_0x457b('0x1f')][_0x457b('0x31')](_0x4445ab[_0x457b('0x32')],{})[_0x457b('0x17')](function(_0x1d6693){var _0x218518=_0x4445ab[_0x457b('0x33')][_0x457b('0x34')]({'plain':!![]});if(!_0x218518)throw new Error(_0x457b('0x35'));if(_0x218518[_0x457b('0x36')]===_0x457b('0x33')){var _0x24dd3e=_0x1d6693[_0x457b('0x34')]({'plain':!![]});var _0x166e04=_0x457b('0x15');return db[_0x457b('0x37')][_0x457b('0x30')]({'where':{'name':_0x166e04,'userProfileId':_0x218518[_0x457b('0x38')]},'raw':!![]})['then'](function(_0x5e14c2){if(_0x5e14c2&&_0x5e14c2[_0x457b('0x39')]===0x0){return db['UserProfileResource'][_0x457b('0x31')]({'name':_0x24dd3e[_0x457b('0x1c')],'resourceId':_0x24dd3e['id'],'type':_0x5e14c2['name'],'sectionId':_0x5e14c2['id']},{})[_0x457b('0x17')](function(){return _0x1d6693;});}else{return _0x1d6693;}})[_0x457b('0x26')](function(_0x327b95){logger[_0x457b('0x1a')](_0x457b('0x3a'),_0x327b95);throw _0x327b95;});}return _0x1d6693;})[_0x457b('0x17')](respondWithResult(_0x23e35f,0xc9))['catch'](handleError(_0x23e35f,null));};exports[_0x457b('0x13')]=function(_0x5c1f02,_0x8dd913){if(_0x5c1f02[_0x457b('0x32')]['id']){delete _0x5c1f02[_0x457b('0x32')]['id'];}return db[_0x457b('0x1f')][_0x457b('0x30')]({'where':{'id':_0x5c1f02[_0x457b('0x3b')]['id']}})[_0x457b('0x17')](handleEntityNotFound(_0x8dd913,null))[_0x457b('0x17')](saveUpdates(_0x5c1f02[_0x457b('0x32')],null))[_0x457b('0x17')](respondWithResult(_0x8dd913,null))[_0x457b('0x26')](handleError(_0x8dd913,null));};exports[_0x457b('0x14')]=function(_0x25d51b,_0x44ce15){return db[_0x457b('0x1f')][_0x457b('0x30')]({'where':{'id':_0x25d51b[_0x457b('0x3b')]['id']}})['then'](handleEntityNotFound(_0x44ce15,null))[_0x457b('0x17')](removeEntity(_0x44ce15,null))[_0x457b('0x26')](handleError(_0x44ce15,null));};exports['describe']=function(_0x54f533,_0x3e32bd){return db[_0x457b('0x1f')]['describe']()[_0x457b('0x17')](respondWithResult(_0x3e32bd,null))[_0x457b('0x26')](handleError(_0x3e32bd,null));};exports[_0x457b('0x3c')]=function(_0x3b6f99,_0x4d4057){var _0x1a4c3e={'raw':!![],'where':{}},_0x401587={},_0x277ffe;return db[_0x457b('0x1f')]['findOne']({'where':{'id':_0x3b6f99['params']['id']}})[_0x457b('0x17')](handleEntityNotFound(_0x4d4057,null))[_0x457b('0x17')](function(_0xee5646){if(_0xee5646){_0x277ffe=_0xee5646['get']({'plain':!![]});_0x401587[_0x457b('0x27')]=_[_0x457b('0x28')](db[_0x457b('0x3d')][_0x457b('0x20')]);_0x401587['query']=_[_0x457b('0x28')](_0x3b6f99[_0x457b('0x24')]);_0x401587[_0x457b('0x29')]=_[_0x457b('0x2a')](_0x401587[_0x457b('0x27')],_0x401587[_0x457b('0x24')]);_0x1a4c3e['attributes']=_[_0x457b('0x2a')](_0x401587['model'],qs[_0x457b('0x2c')](_0x3b6f99['query'][_0x457b('0x2c')]));_0x1a4c3e['attributes']=_0x1a4c3e[_0x457b('0x2b')][_0x457b('0x2d')]?_0x1a4c3e['attributes']:_0x401587[_0x457b('0x27')];if(!_0x3b6f99['query']['hasOwnProperty'](_0x457b('0x3e'))){_0x1a4c3e['limit']=qs['limit'](_0x3b6f99['query'][_0x457b('0xe')]);_0x1a4c3e[_0x457b('0xc')]=qs[_0x457b('0xc')](_0x3b6f99[_0x457b('0x24')]['offset']);}_0x1a4c3e[_0x457b('0x3f')]=qs[_0x457b('0x40')](_0x3b6f99[_0x457b('0x24')]['sort']);_0x1a4c3e[_0x457b('0x41')]=qs[_0x457b('0x29')](_[_0x457b('0x42')](_0x3b6f99[_0x457b('0x24')],_0x401587[_0x457b('0x29')]));_0x1a4c3e[_0x457b('0x41')]['MailQueueId']=_0xee5646['id'];if(_0x3b6f99[_0x457b('0x24')][_0x457b('0x43')]){_0x1a4c3e[_0x457b('0x41')]=_['merge'](_0x1a4c3e['where'],{'$or':_[_0x457b('0x1e')](_0x1a4c3e['attributes'],function(_0x431d57){var _0x2ed0f7={};_0x2ed0f7[_0x431d57]={'$like':'%'+_0x3b6f99[_0x457b('0x24')][_0x457b('0x43')]+'%'};return _0x2ed0f7;})});}_0x1a4c3e=_[_0x457b('0x2e')]({},_0x1a4c3e,_0x3b6f99[_0x457b('0x2f')]);return db[_0x457b('0x3d')][_0x457b('0x25')](_0x1a4c3e);}})[_0x457b('0x17')](function(_0x91d946){if(_0x91d946){return db[_0x457b('0x44')]['findAndCountAll']({'where':{'id':_[_0x457b('0x1e')](_0x91d946,'UserId'),'role':'agent'},'attributes':['id',_0x457b('0x1c'),_0x457b('0x45'),'updatedAt',_0x457b('0x46')]});}})[_0x457b('0x17')](function(_0x2f956e){if(_0x2f956e){return{'count':_0x2f956e['count'],'rows':_[_0x457b('0x1e')](_0x2f956e['rows'],function(_0x45b28e){return{'membername':_0x45b28e['name'],'UserId':_0x45b28e['id'],'queue_name':_0x277ffe['name'],'MailQueueId':_0x277ffe['id'],'interface':util['format'](_0x457b('0x47'),_0x457b('0x48'),_0x45b28e['name']),'penalty':0x0,'paused':_0x45b28e[_0x457b('0x45')],'createdAt':_0x45b28e[_0x457b('0x46')],'updatedAt':_0x45b28e['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x457b('0x17')](respondWithFilteredResult(_0x4d4057,_0x1a4c3e))[_0x457b('0x26')](handleError(_0x4d4057,null));};exports[_0x457b('0x49')]=function(_0x27dda5,_0x3b94ed){var _0x40449d={};var _0x12f59d={};var _0x30f9c1;var _0xf2e80d;return db[_0x457b('0x1f')]['findOne']({'where':{'id':_0x27dda5['params']['id']}})[_0x457b('0x17')](handleEntityNotFound(_0x3b94ed,null))[_0x457b('0x17')](function(_0x247106){if(_0x247106){_0x30f9c1=_0x247106;_0x12f59d['model']=_[_0x457b('0x28')](db['Team'][_0x457b('0x20')]);_0x12f59d[_0x457b('0x24')]=_[_0x457b('0x28')](_0x27dda5[_0x457b('0x24')]);_0x12f59d[_0x457b('0x29')]=_[_0x457b('0x2a')](_0x12f59d['model'],_0x12f59d[_0x457b('0x24')]);_0x40449d[_0x457b('0x2b')]=_[_0x457b('0x2a')](_0x12f59d['model'],qs['fields'](_0x27dda5['query'][_0x457b('0x2c')]));_0x40449d['attributes']=_0x40449d[_0x457b('0x2b')][_0x457b('0x2d')]?_0x40449d['attributes']:_0x12f59d[_0x457b('0x27')];_0x40449d[_0x457b('0x3f')]=qs['sort'](_0x27dda5['query'][_0x457b('0x40')]);_0x40449d['where']=qs[_0x457b('0x29')](_[_0x457b('0x42')](_0x27dda5[_0x457b('0x24')],_0x12f59d['filters']));if(_0x27dda5['query'][_0x457b('0x43')]){_0x40449d[_0x457b('0x41')]=_[_0x457b('0x2e')](_0x40449d['where'],{'$or':_['map'](_0x40449d[_0x457b('0x2b')],function(_0x3b0d1a){var _0x157efb={};_0x157efb[_0x3b0d1a]={'$like':'%'+_0x27dda5[_0x457b('0x24')]['filter']+'%'};return _0x157efb;})});}_0x40449d=_['merge']({},_0x40449d,_0x27dda5[_0x457b('0x2f')]);return _0x30f9c1['getTeams'](_0x40449d);}})[_0x457b('0x17')](function(_0x4e4d05){if(_0x4e4d05){_0xf2e80d=_0x4e4d05[_0x457b('0x2d')];if(!_0x27dda5[_0x457b('0x24')][_0x457b('0x4a')](_0x457b('0x3e'))){_0x40449d[_0x457b('0xe')]=qs[_0x457b('0xe')](_0x27dda5[_0x457b('0x24')][_0x457b('0xe')]);_0x40449d[_0x457b('0xc')]=qs[_0x457b('0xc')](_0x27dda5[_0x457b('0x24')][_0x457b('0xc')]);}return _0x30f9c1[_0x457b('0x49')](_0x40449d);}})[_0x457b('0x17')](function(_0xdfae4c){if(_0xdfae4c){return _0xdfae4c?{'count':_0xf2e80d,'rows':_0xdfae4c}:null;}})[_0x457b('0x17')](respondWithResult(_0x3b94ed,null))['catch'](handleError(_0x3b94ed,null));};exports[_0x457b('0x4b')]=function(_0x2f94b3,_0x1af1a8){var _0x99f770=_0x2f94b3[_0x457b('0x32')][_0x457b('0x4c')];return db[_0x457b('0x4d')][_0x457b('0x25')]({'where':{'id':_0x99f770},'attributes':['id'],'include':[{'model':db[_0x457b('0x44')],'as':'Agents','attributes':['id','name',_0x457b('0x4e'),_0x457b('0x4f'),_0x457b('0x50')],'raw':!![]}]})[_0x457b('0x17')](function(_0x2a9c71){if(_0x2a9c71){var _0x5c6328=_['flatMap'](_0x2a9c71,function(_0x1288f7){var _0x44ac3d=_0x1288f7['get']({'plain':!![]});return _0x44ac3d[_0x457b('0x51')];});return db[_0x457b('0x1f')][_0x457b('0x30')]({'where':{'id':_0x2f94b3[_0x457b('0x3b')]['id']}})[_0x457b('0x17')](function(_0x16e0ff){return db[_0x457b('0x52')][_0x457b('0x53')](function(_0x457ab9){return _0x16e0ff[_0x457b('0x4b')](_0x99f770,{'transaction':_0x457ab9})[_0x457b('0x17')](function(){return BPromise[_0x457b('0x54')](_0x5c6328,function(_0x24f043){return db[_0x457b('0x3d')][_0x457b('0x55')]({'where':{'UserId':_0x24f043['id'],'MailQueueId':_0x2f94b3[_0x457b('0x3b')]['id']},'transaction':_0x457ab9});});})[_0x457b('0x17')](function(){_0x5c6328[_0x457b('0x56')](function(_0x58a130){socket[_0x457b('0x57')](_0x457b('0x58'),{'UserId':_0x58a130['id'],'MailQueueId':_0x16e0ff['id']});});});});});}})['then'](respondWithStatusCode(_0x1af1a8,null))[_0x457b('0x26')](handleError(_0x1af1a8,null));};exports[_0x457b('0x59')]=function(_0x2df5ce,_0x3598a4){return db['Team'][_0x457b('0x25')]({'where':{'id':_0x2df5ce['query'][_0x457b('0x4c')]},'attributes':['id'],'include':[{'model':db[_0x457b('0x44')],'as':_0x457b('0x51'),'attributes':['id'],'raw':!![]}]})[_0x457b('0x17')](handleEntityNotFound(_0x3598a4,null))[_0x457b('0x17')](function(_0x533fab){var _0x485671=_['map'](_0x533fab,'id');var _0xa5cb43=[];var _0x4c051c=[];var _0x504e18=squel[_0x457b('0x5a')]();_0x504e18[_0x457b('0x5b')]('tq.TeamId')[_0x457b('0x5c')](_0x457b('0x5d'),'tq')[_0x457b('0x5e')](_0x457b('0x5f'),'ut',_0x457b('0x60'))['where']('MailQueueId\x20=\x20?',_0x2df5ce['params']['id']);for(var _0x5886ce=0x0;_0x5886ce<_0x533fab[_0x457b('0x2d')];_0x5886ce+=0x1){let _0x5a07b2=_0x533fab[_0x5886ce];for(var _0x19e792=0x0;_0x19e792<_0x5a07b2['Agents'][_0x457b('0x2d')];_0x19e792+=0x1){let _0x41233e=_0x5a07b2[_0x457b('0x51')][_0x19e792];var _0x22dc85=_0x504e18[_0x457b('0x61')]();_0x22dc85[_0x457b('0x41')](_0x457b('0x62'),_0x41233e['id']);_0x4c051c['push'](db['sequelize'][_0x457b('0x24')](_0x22dc85[_0x457b('0x63')](),{'type':db[_0x457b('0x52')][_0x457b('0x64')][_0x457b('0x65')]})[_0x457b('0x17')](function(_0x3bb3dd){if(_0x3bb3dd[_0x457b('0x2d')]===0x1){return _0x41233e['id'];}else{var _0x396842=_[_0x457b('0x66')](_[_0x457b('0x1e')](_0x3bb3dd,_0x457b('0x67')),function(_0xe30a09){return _[_0x457b('0x68')](_0x485671,_0xe30a09);});if(_0x396842){return _0x41233e['id'];}}}));}}return BPromise[_0x457b('0x69')](_0x4c051c)[_0x457b('0x17')](function(_0x540122){_0xa5cb43=_(_0xa5cb43)[_0x457b('0x6a')](_0x540122)[_0x457b('0x6b')]()[_0x457b('0x6c')]();return db[_0x457b('0x1f')][_0x457b('0x30')]({'where':{'id':_0x2df5ce[_0x457b('0x3b')]['id']}})[_0x457b('0x17')](function(_0x2f6e4e){return db[_0x457b('0x52')]['transaction'](function(_0x5ecc24){return _0x2f6e4e[_0x457b('0x59')](_0x2df5ce[_0x457b('0x24')]['ids'],{'transaction':_0x5ecc24})['then'](function(){if(!_['isEmpty'](_0xa5cb43)){return _0x2f6e4e[_0x457b('0x6d')](_0xa5cb43,{'transaction':_0x5ecc24});}})[_0x457b('0x17')](function(){_0xa5cb43[_0x457b('0x56')](function(_0x4f9ba7){socket['emit'](_0x457b('0x6e'),{'UserId':_0x4f9ba7,'MailQueueId':_0x2f6e4e['id']});});});});});});})[_0x457b('0x17')](respondWithStatusCode(_0x3598a4,null))[_0x457b('0x26')](handleError(_0x3598a4,null));};exports[_0x457b('0x6f')]=function(_0x5d3fff,_0x41554f){return db[_0x457b('0x1f')][_0x457b('0x30')]({'where':{'id':_0x5d3fff['params']['id']}})[_0x457b('0x17')](handleEntityNotFound(_0x41554f,null))[_0x457b('0x17')](function(_0xdec095){if(_0xdec095){return _0xdec095['addAgents'](_0x5d3fff['body']['ids'],_[_0x457b('0x70')](_0x5d3fff[_0x457b('0x32')],[_0x457b('0x4c'),'id'])||{})[_0x457b('0x71')](function(_0x56d9a2){for(var _0x32d61c=0x0;_0x32d61c<_0x5d3fff[_0x457b('0x32')][_0x457b('0x4c')]['length'];_0x32d61c+=0x1){socket[_0x457b('0x57')]('userMailQueue:save',{'UserId':Number(_0x5d3fff[_0x457b('0x32')][_0x457b('0x4c')][_0x32d61c]),'MailQueueId':Number(_0x5d3fff[_0x457b('0x3b')]['id'])});}return _0x56d9a2;});}})['then'](respondWithResult(_0x41554f,null))[_0x457b('0x26')](handleError(_0x41554f,null));};exports[_0x457b('0x6d')]=function(_0x2c6baa,_0x599b00){return db['MailQueue'][_0x457b('0x30')]({'where':{'id':_0x2c6baa['params']['id']}})[_0x457b('0x17')](handleEntityNotFound(_0x599b00,null))[_0x457b('0x17')](function(_0xea24a1){if(_0xea24a1){return _0xea24a1['removeAgents'](_0x2c6baa[_0x457b('0x24')][_0x457b('0x4c')])['then'](function(){if(_[_0x457b('0x72')](_0x2c6baa[_0x457b('0x24')][_0x457b('0x4c')])){for(var _0x38fca2=0x0;_0x38fca2<_0x2c6baa[_0x457b('0x24')][_0x457b('0x4c')][_0x457b('0x2d')];_0x38fca2+=0x1){socket[_0x457b('0x57')](_0x457b('0x6e'),{'UserId':Number(_0x2c6baa[_0x457b('0x24')]['ids'][_0x38fca2]),'MailQueueId':Number(_0x2c6baa['params']['id'])});}}else{socket['emit'](_0x457b('0x6e'),{'UserId':Number(_0x2c6baa[_0x457b('0x24')][_0x457b('0x4c')]),'MailQueueId':Number(_0x2c6baa['params']['id'])});}});}})[_0x457b('0x17')](respondWithStatusCode(_0x599b00,null))[_0x457b('0x26')](handleError(_0x599b00,null));};exports[_0x457b('0x73')]=function(_0x483d01,_0x42739b){var _0x3abb19={};var _0x1b6561={};var _0x590533;var _0x3a2c52;return db[_0x457b('0x1f')]['findOne']({'where':{'id':_0x483d01[_0x457b('0x3b')]['id']}})[_0x457b('0x17')](handleEntityNotFound(_0x42739b,null))[_0x457b('0x17')](function(_0x57153b){if(_0x57153b){_0x590533=_0x57153b;_0x1b6561['model']=_['keys'](db[_0x457b('0x44')][_0x457b('0x20')]);_0x1b6561['query']=_[_0x457b('0x28')](_0x483d01[_0x457b('0x24')]);_0x1b6561['filters']=_[_0x457b('0x2a')](_0x1b6561[_0x457b('0x27')],_0x1b6561[_0x457b('0x24')]);_0x3abb19['attributes']=_[_0x457b('0x2a')](_0x1b6561['model'],qs[_0x457b('0x2c')](_0x483d01['query'][_0x457b('0x2c')]));_0x3abb19[_0x457b('0x2b')]=_0x3abb19[_0x457b('0x2b')][_0x457b('0x2d')]?_0x3abb19[_0x457b('0x2b')]:_0x1b6561[_0x457b('0x27')];_0x3abb19[_0x457b('0x3f')]=qs['sort'](_0x483d01[_0x457b('0x24')][_0x457b('0x40')]);_0x3abb19[_0x457b('0x41')]=qs[_0x457b('0x29')](_[_0x457b('0x42')](_0x483d01['query'],_0x1b6561[_0x457b('0x29')]));if(_0x483d01[_0x457b('0x24')][_0x457b('0x43')]){_0x3abb19[_0x457b('0x41')]=_[_0x457b('0x2e')](_0x3abb19[_0x457b('0x41')],{'$or':_[_0x457b('0x1e')](_0x3abb19[_0x457b('0x2b')],function(_0x152536){var _0x214088={};_0x214088[_0x152536]={'$like':'%'+_0x483d01['query'][_0x457b('0x43')]+'%'};return _0x214088;})});}_0x3abb19=_['merge']({},_0x3abb19,_0x483d01[_0x457b('0x2f')]);return _0x590533['getAgents'](_0x3abb19);}})['then'](function(_0x202a31){if(_0x202a31){_0x3a2c52=_0x202a31[_0x457b('0x2d')];if(!_0x483d01[_0x457b('0x24')][_0x457b('0x4a')]('nolimit')){_0x3abb19[_0x457b('0xe')]=qs[_0x457b('0xe')](_0x483d01['query'][_0x457b('0xe')]);_0x3abb19[_0x457b('0xc')]=qs['offset'](_0x483d01[_0x457b('0x24')][_0x457b('0xc')]);}return _0x590533[_0x457b('0x73')](_0x3abb19);}})[_0x457b('0x17')](function(_0x4c12f5){if(_0x4c12f5){return _0x4c12f5?{'count':_0x3a2c52,'rows':_0x4c12f5}:null;}})[_0x457b('0x17')](respondWithResult(_0x42739b,null))[_0x457b('0x26')](handleError(_0x42739b,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 666c90f..5dbf3d0 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 _0xb406=['update','emit','hook','../../mysqldb','MailQueue','setMaxListeners','save'];(function(_0x24799f,_0x15a803){var _0x128dc9=function(_0x2462bc){while(--_0x2462bc){_0x24799f['push'](_0x24799f['shift']());}};_0x128dc9(++_0x15a803);}(_0xb406,0xc0));var _0x6b40=function(_0x1102ff,_0x1d2f6f){_0x1102ff=_0x1102ff-0x0;var _0x23e7c9=_0xb406[_0x1102ff];return _0x23e7c9;};'use strict';var EventEmitter=require('events');var MailQueue=require(_0x6b40('0x0'))['db'][_0x6b40('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x6b40('0x2')](0x0);var events={'afterCreate':_0x6b40('0x3'),'afterUpdate':_0x6b40('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5a577f){return function(_0x24857d,_0x1ecc99,_0xc91c92){MailQueueEvents[_0x6b40('0x5')](_0x5a577f+':'+_0x24857d['id'],_0x24857d);MailQueueEvents[_0x6b40('0x5')](_0x5a577f,_0x24857d);_0xc91c92(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue[_0x6b40('0x6')](e,emitEvent(event));}}module['exports']=MailQueueEvents; \ No newline at end of file +var _0xb181=['emit','hasOwnProperty','hook','events','setMaxListeners','save','remove'];(function(_0x328043,_0x3458fb){var _0x1a5cbb=function(_0x11d525){while(--_0x11d525){_0x328043['push'](_0x328043['shift']());}};_0x1a5cbb(++_0x3458fb);}(_0xb181,0x130));var _0x1b18=function(_0x1a3921,_0x586fdd){_0x1a3921=_0x1a3921-0x0;var _0x2a1e32=_0xb181[_0x1a3921];return _0x2a1e32;};'use strict';var EventEmitter=require(_0x1b18('0x0'));var MailQueue=require('../../mysqldb')['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x1b18('0x1')](0x0);var events={'afterCreate':_0x1b18('0x2'),'afterUpdate':'update','afterDestroy':_0x1b18('0x3')};function emitEvent(_0x2a99bf){return function(_0x35ad81,_0x9ea335,_0x49cb5b){MailQueueEvents['emit'](_0x2a99bf+':'+_0x35ad81['id'],_0x35ad81);MailQueueEvents[_0x1b18('0x4')](_0x2a99bf,_0x35ad81);_0x49cb5b(null);};}for(var e in events){if(events[_0x1b18('0x5')](e)){var event=events[e];MailQueue[_0x1b18('0x6')](e,emitEvent(event));}}module['exports']=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 81369ba..ee1fd84 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 _0x2527=['rimraf','../../config/environment','./mailQueue.attributes','exports','mail_queues','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x2527,0x1d9));var _0x7252=function(_0x26149a,_0x177cda){_0x26149a=_0x26149a-0x0;var _0x17c825=_0x2527[_0x26149a];return _0x17c825;};'use strict';var _=require(_0x7252('0x0'));var util=require(_0x7252('0x1'));var logger=require(_0x7252('0x2'))('api');var moment=require(_0x7252('0x3'));var BPromise=require(_0x7252('0x4'));var rp=require(_0x7252('0x5'));var fs=require('fs');var path=require(_0x7252('0x6'));var rimraf=require(_0x7252('0x7'));var config=require(_0x7252('0x8'));var attributes=require(_0x7252('0x9'));module[_0x7252('0xa')]=function(_0xf726b5,_0x5e903d){return _0xf726b5['define']('MailQueue',attributes,{'tableName':_0x7252('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb8c0=['../../config/logger','moment','request-promise','../../config/environment','exports','define','MailQueue','mail_queues','util'];(function(_0x363cc2,_0x32ae4a){var _0x490814=function(_0x3dc973){while(--_0x3dc973){_0x363cc2['push'](_0x363cc2['shift']());}};_0x490814(++_0x32ae4a);}(_0xb8c0,0x11f));var _0x0b8c=function(_0x2903e7,_0x311fc8){_0x2903e7=_0x2903e7-0x0;var _0x388929=_0xb8c0[_0x2903e7];return _0x388929;};'use strict';var _=require('lodash');var util=require(_0x0b8c('0x0'));var logger=require(_0x0b8c('0x1'))('api');var moment=require(_0x0b8c('0x2'));var BPromise=require('bluebird');var rp=require(_0x0b8c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x0b8c('0x4'));var attributes=require('./mailQueue.attributes');module[_0x0b8c('0x5')]=function(_0x3f16b5,_0x10caf7){return _0x3f16b5[_0x0b8c('0x6')](_0x0b8c('0x7'),attributes,{'tableName':_0x0b8c('0x8'),'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 38f2c3c..ee4bf5b 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 _0xc66c=['find','ShowMailQueue','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','request','then','info','debug','MailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','MailQueue,\x20%s,\x20%s','message','catch','GetMailQueue','MailQueue','findAll','options','raw','where','attributes','limit','include','model','map'];(function(_0x2ebbe5,_0x4bd798){var _0x5a1960=function(_0xf7f849){while(--_0xf7f849){_0x2ebbe5['push'](_0x2ebbe5['shift']());}};_0x5a1960(++_0x4bd798);}(_0xc66c,0x77));var _0xcc66=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xc66c[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0xcc66('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xcc66('0x1'));var rs=require(_0xcc66('0x2'));var fs=require('fs');var Redis=require(_0xcc66('0x3'));var db=require(_0xcc66('0x4'))['db'];var utils=require(_0xcc66('0x5'));var logger=require(_0xcc66('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xcc66('0x7')][_0xcc66('0x8')]({'port':0x232a});config[_0xcc66('0x9')]=_[_0xcc66('0xa')](config[_0xcc66('0x9')],{'host':_0xcc66('0xb'),'port':0x18eb});var socket=require(_0xcc66('0xc'))(new Redis(config[_0xcc66('0x9')]));require(_0xcc66('0xd'))[_0xcc66('0xe')](socket);function respondWithRpcPromise(_0x216c52,_0x4202cd,_0x5c33ae){return new BPromise(function(_0x5ea205,_0x4cd1a8){return client[_0xcc66('0xf')](_0x216c52,_0x5c33ae)[_0xcc66('0x10')](function(_0xe54325){logger[_0xcc66('0x11')]('MailQueue,\x20%s,\x20%s',_0x4202cd,'request\x20sent');logger[_0xcc66('0x12')](_0xcc66('0x13'),_0x4202cd,_0xcc66('0x14'),JSON[_0xcc66('0x15')](_0xe54325));if(_0xe54325[_0xcc66('0x16')]){if(_0xe54325[_0xcc66('0x16')]['code']===0x1f4){logger[_0xcc66('0x16')](_0xcc66('0x17'),_0x4202cd,_0xe54325[_0xcc66('0x16')]['message']);return _0x4cd1a8(_0xe54325[_0xcc66('0x16')][_0xcc66('0x18')]);}logger[_0xcc66('0x16')](_0xcc66('0x17'),_0x4202cd,_0xe54325[_0xcc66('0x16')][_0xcc66('0x18')]);return _0x5ea205(_0xe54325[_0xcc66('0x16')][_0xcc66('0x18')]);}else{logger[_0xcc66('0x11')]('MailQueue,\x20%s,\x20%s',_0x4202cd,_0xcc66('0x14'));_0x5ea205(_0xe54325['result'][_0xcc66('0x18')]);}})[_0xcc66('0x19')](function(_0x2ed553){logger['error'](_0xcc66('0x17'),_0x4202cd,_0x2ed553);_0x4cd1a8(_0x2ed553);});});}exports[_0xcc66('0x1a')]=function(_0x29a5a4){var _0x3208c1=this;return new Promise(function(_0x164c0a,_0x33d71b){return db[_0xcc66('0x1b')][_0xcc66('0x1c')]({'raw':_0x29a5a4[_0xcc66('0x1d')]?_0x29a5a4[_0xcc66('0x1d')][_0xcc66('0x1e')]===undefined?!![]:![]:!![],'where':_0x29a5a4[_0xcc66('0x1d')]?_0x29a5a4['options'][_0xcc66('0x1f')]||null:null,'attributes':_0x29a5a4[_0xcc66('0x1d')]?_0x29a5a4[_0xcc66('0x1d')][_0xcc66('0x20')]||null:null,'limit':_0x29a5a4[_0xcc66('0x1d')]?_0x29a5a4[_0xcc66('0x1d')][_0xcc66('0x21')]||null:null,'include':_0x29a5a4[_0xcc66('0x1d')]?_0x29a5a4[_0xcc66('0x1d')]['include']?_['map'](_0x29a5a4['options'][_0xcc66('0x22')],function(_0x56d65a){return{'model':db[_0x56d65a[_0xcc66('0x23')]],'as':_0x56d65a['as'],'attributes':_0x56d65a[_0xcc66('0x20')],'include':_0x56d65a[_0xcc66('0x22')]?_[_0xcc66('0x24')](_0x56d65a['include'],function(_0x54e968){return{'model':db[_0x54e968[_0xcc66('0x23')]],'as':_0x54e968['as'],'attributes':_0x54e968[_0xcc66('0x20')],'include':_0x54e968[_0xcc66('0x22')]?_[_0xcc66('0x24')](_0x54e968[_0xcc66('0x22')],function(_0x246d7e){return{'model':db[_0x246d7e[_0xcc66('0x23')]],'as':_0x246d7e['as'],'attributes':_0x246d7e[_0xcc66('0x20')]};}):[]};}):[]};}):[]:[]})[_0xcc66('0x10')](function(_0x41b68b){logger[_0xcc66('0x11')](_0xcc66('0x1a'),_0x29a5a4);logger[_0xcc66('0x12')](_0xcc66('0x1a'),_0x29a5a4,JSON[_0xcc66('0x15')](_0x41b68b));_0x164c0a(_0x41b68b);})['catch'](function(_0x52b0bc){logger[_0xcc66('0x16')]('GetMailQueue',_0x52b0bc[_0xcc66('0x18')],_0x29a5a4);_0x33d71b(_0x3208c1[_0xcc66('0x16')](0x1f4,_0x52b0bc['message']));});});};exports['ShowMailQueue']=function(_0x5de9c8){var _0x5ed161=this;return new Promise(function(_0x1be4cb,_0x273cb5){return db[_0xcc66('0x1b')][_0xcc66('0x25')]({'raw':_0x5de9c8[_0xcc66('0x1d')]?_0x5de9c8[_0xcc66('0x1d')][_0xcc66('0x1e')]===undefined?!![]:![]:!![],'where':_0x5de9c8[_0xcc66('0x1d')]?_0x5de9c8[_0xcc66('0x1d')][_0xcc66('0x1f')]||null:null,'attributes':_0x5de9c8[_0xcc66('0x1d')]?_0x5de9c8[_0xcc66('0x1d')]['attributes']||null:null,'include':_0x5de9c8[_0xcc66('0x1d')]?_0x5de9c8[_0xcc66('0x1d')][_0xcc66('0x22')]?_['map'](_0x5de9c8[_0xcc66('0x1d')]['include'],function(_0xe0bf5){return{'model':db[_0xe0bf5['model']],'as':_0xe0bf5['as'],'attributes':_0xe0bf5[_0xcc66('0x20')],'include':_0xe0bf5['include']?_[_0xcc66('0x24')](_0xe0bf5[_0xcc66('0x22')],function(_0x2bb15e){return{'model':db[_0x2bb15e[_0xcc66('0x23')]],'as':_0x2bb15e['as'],'attributes':_0x2bb15e[_0xcc66('0x20')],'include':_0x2bb15e['include']?_['map'](_0x2bb15e[_0xcc66('0x22')],function(_0x318fbc){return{'model':db[_0x318fbc[_0xcc66('0x23')]],'as':_0x318fbc['as'],'attributes':_0x318fbc['attributes']};}):[]};}):[]};}):[]:[]})[_0xcc66('0x10')](function(_0x34bcad){logger[_0xcc66('0x11')](_0xcc66('0x26'),_0x5de9c8);logger[_0xcc66('0x12')]('ShowMailQueue',_0x5de9c8,JSON[_0xcc66('0x15')](_0x34bcad));_0x1be4cb(_0x34bcad);})[_0xcc66('0x19')](function(_0x3ac9d8){logger[_0xcc66('0x16')](_0xcc66('0x26'),_0x3ac9d8[_0xcc66('0x18')],_0x5de9c8);_0x273cb5(_0x5ed161[_0xcc66('0x16')](0x1f4,_0x3ac9d8[_0xcc66('0x18')]));});});}; \ No newline at end of file +var _0xd5b4=['GetMailQueue','ShowMailQueue','find','debug','lodash','util','bluebird','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','then','MailQueue,\x20%s,\x20%s','request\x20sent','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','MailQueue','findAll','raw','options','where','limit','include','map','model','attributes'];(function(_0x47f996,_0x121aec){var _0x4670ee=function(_0x3fa561){while(--_0x3fa561){_0x47f996['push'](_0x47f996['shift']());}};_0x4670ee(++_0x121aec);}(_0xd5b4,0xa0));var _0x4d5b=function(_0x2678f6,_0x1fa781){_0x2678f6=_0x2678f6-0x0;var _0x28e5de=_0xd5b4[_0x2678f6];return _0x28e5de;};'use strict';var _=require(_0x4d5b('0x0'));var util=require(_0x4d5b('0x1'));var moment=require('moment');var BPromise=require(_0x4d5b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4d5b('0x3'));var logger=require('../../config/logger')(_0x4d5b('0x4'));var config=require(_0x4d5b('0x5'));var jayson=require(_0x4d5b('0x6'));var client=jayson[_0x4d5b('0x7')][_0x4d5b('0x8')]({'port':0x232a});config['redis']=_[_0x4d5b('0x9')](config['redis'],{'host':_0x4d5b('0xa'),'port':0x18eb});var socket=require(_0x4d5b('0xb'))(new Redis(config['redis']));require(_0x4d5b('0xc'))[_0x4d5b('0xd')](socket);function respondWithRpcPromise(_0x5cadda,_0x3f1394,_0x1e458e){return new BPromise(function(_0x2b350f,_0x433925){return client['request'](_0x5cadda,_0x1e458e)[_0x4d5b('0xe')](function(_0x53bd1f){logger['info'](_0x4d5b('0xf'),_0x3f1394,_0x4d5b('0x10'));logger['debug'](_0x4d5b('0x11'),_0x3f1394,'request\x20sent',JSON[_0x4d5b('0x12')](_0x53bd1f));if(_0x53bd1f[_0x4d5b('0x13')]){if(_0x53bd1f['error'][_0x4d5b('0x14')]===0x1f4){logger['error'](_0x4d5b('0xf'),_0x3f1394,_0x53bd1f[_0x4d5b('0x13')][_0x4d5b('0x15')]);return _0x433925(_0x53bd1f[_0x4d5b('0x13')][_0x4d5b('0x15')]);}logger['error'](_0x4d5b('0xf'),_0x3f1394,_0x53bd1f[_0x4d5b('0x13')]['message']);return _0x2b350f(_0x53bd1f['error']['message']);}else{logger[_0x4d5b('0x16')](_0x4d5b('0xf'),_0x3f1394,_0x4d5b('0x10'));_0x2b350f(_0x53bd1f[_0x4d5b('0x17')][_0x4d5b('0x15')]);}})[_0x4d5b('0x18')](function(_0x5db797){logger[_0x4d5b('0x13')](_0x4d5b('0xf'),_0x3f1394,_0x5db797);_0x433925(_0x5db797);});});}exports['GetMailQueue']=function(_0x27a5b7){var _0x3ed1c2=this;return new Promise(function(_0x2d3de2,_0x25d2fc){return db[_0x4d5b('0x19')][_0x4d5b('0x1a')]({'raw':_0x27a5b7['options']?_0x27a5b7['options'][_0x4d5b('0x1b')]===undefined?!![]:![]:!![],'where':_0x27a5b7[_0x4d5b('0x1c')]?_0x27a5b7[_0x4d5b('0x1c')][_0x4d5b('0x1d')]||null:null,'attributes':_0x27a5b7[_0x4d5b('0x1c')]?_0x27a5b7[_0x4d5b('0x1c')]['attributes']||null:null,'limit':_0x27a5b7[_0x4d5b('0x1c')]?_0x27a5b7[_0x4d5b('0x1c')][_0x4d5b('0x1e')]||null:null,'include':_0x27a5b7[_0x4d5b('0x1c')]?_0x27a5b7['options'][_0x4d5b('0x1f')]?_[_0x4d5b('0x20')](_0x27a5b7[_0x4d5b('0x1c')][_0x4d5b('0x1f')],function(_0x4e1be7){return{'model':db[_0x4e1be7[_0x4d5b('0x21')]],'as':_0x4e1be7['as'],'attributes':_0x4e1be7[_0x4d5b('0x22')],'include':_0x4e1be7[_0x4d5b('0x1f')]?_['map'](_0x4e1be7[_0x4d5b('0x1f')],function(_0x1188d7){return{'model':db[_0x1188d7[_0x4d5b('0x21')]],'as':_0x1188d7['as'],'attributes':_0x1188d7[_0x4d5b('0x22')],'include':_0x1188d7[_0x4d5b('0x1f')]?_[_0x4d5b('0x20')](_0x1188d7[_0x4d5b('0x1f')],function(_0x3e326b){return{'model':db[_0x3e326b[_0x4d5b('0x21')]],'as':_0x3e326b['as'],'attributes':_0x3e326b[_0x4d5b('0x22')]};}):[]};}):[]};}):[]:[]})[_0x4d5b('0xe')](function(_0x5c7dc7){logger[_0x4d5b('0x16')](_0x4d5b('0x23'),_0x27a5b7);logger['debug']('GetMailQueue',_0x27a5b7,JSON[_0x4d5b('0x12')](_0x5c7dc7));_0x2d3de2(_0x5c7dc7);})[_0x4d5b('0x18')](function(_0x13e407){logger[_0x4d5b('0x13')]('GetMailQueue',_0x13e407['message'],_0x27a5b7);_0x25d2fc(_0x3ed1c2['error'](0x1f4,_0x13e407['message']));});});};exports[_0x4d5b('0x24')]=function(_0x23b547){var _0x2654ed=this;return new Promise(function(_0x5e2601,_0x57a52f){return db[_0x4d5b('0x19')][_0x4d5b('0x25')]({'raw':_0x23b547['options']?_0x23b547[_0x4d5b('0x1c')][_0x4d5b('0x1b')]===undefined?!![]:![]:!![],'where':_0x23b547[_0x4d5b('0x1c')]?_0x23b547[_0x4d5b('0x1c')][_0x4d5b('0x1d')]||null:null,'attributes':_0x23b547[_0x4d5b('0x1c')]?_0x23b547['options'][_0x4d5b('0x22')]||null:null,'include':_0x23b547[_0x4d5b('0x1c')]?_0x23b547['options'][_0x4d5b('0x1f')]?_[_0x4d5b('0x20')](_0x23b547[_0x4d5b('0x1c')][_0x4d5b('0x1f')],function(_0x237f2a){return{'model':db[_0x237f2a[_0x4d5b('0x21')]],'as':_0x237f2a['as'],'attributes':_0x237f2a[_0x4d5b('0x22')],'include':_0x237f2a[_0x4d5b('0x1f')]?_[_0x4d5b('0x20')](_0x237f2a[_0x4d5b('0x1f')],function(_0x549a83){return{'model':db[_0x549a83[_0x4d5b('0x21')]],'as':_0x549a83['as'],'attributes':_0x549a83[_0x4d5b('0x22')],'include':_0x549a83[_0x4d5b('0x1f')]?_[_0x4d5b('0x20')](_0x549a83['include'],function(_0x127189){return{'model':db[_0x127189[_0x4d5b('0x21')]],'as':_0x127189['as'],'attributes':_0x127189['attributes']};}):[]};}):[]};}):[]:[]})[_0x4d5b('0xe')](function(_0x4c2c07){logger[_0x4d5b('0x16')]('ShowMailQueue',_0x23b547);logger[_0x4d5b('0x26')](_0x4d5b('0x24'),_0x23b547,JSON[_0x4d5b('0x12')](_0x4c2c07));_0x5e2601(_0x4c2c07);})[_0x4d5b('0x18')](function(_0x33370c){logger[_0x4d5b('0x13')](_0x4d5b('0x24'),_0x33370c['message'],_0x23b547);_0x57a52f(_0x2654ed[_0x4d5b('0x13')](0x1f4,_0x33370c['message']));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index e78bc7b..c2ad4f6 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 _0x2ca3=['emit','removeListener','register','length','mailQueue:','./mailQueue.events','save','update'];(function(_0x38d672,_0xc41411){var _0x33b0ca=function(_0x1022ee){while(--_0x1022ee){_0x38d672['push'](_0x38d672['shift']());}};_0x33b0ca(++_0xc41411);}(_0x2ca3,0xb5));var _0x32ca=function(_0xdffd72,_0xc39199){_0xdffd72=_0xdffd72-0x0;var _0x1ea274=_0x2ca3[_0xdffd72];return _0x1ea274;};'use strict';var MailQueueEvents=require(_0x32ca('0x0'));var events=[_0x32ca('0x1'),'remove',_0x32ca('0x2')];function createListener(_0x4ddccb,_0x1ae6f4){return function(_0xd07e77){_0x1ae6f4[_0x32ca('0x3')](_0x4ddccb,_0xd07e77);};}function removeListener(_0x141ccb,_0x5e9d56){return function(){MailQueueEvents[_0x32ca('0x4')](_0x141ccb,_0x5e9d56);};}exports[_0x32ca('0x5')]=function(_0x2f207d){for(var _0x3eac95=0x0,_0x2b57f4=events[_0x32ca('0x6')];_0x3eac95<_0x2b57f4;_0x3eac95++){var _0x2c5ea3=events[_0x3eac95];var _0x41b4db=createListener(_0x32ca('0x7')+_0x2c5ea3,_0x2f207d);MailQueueEvents['on'](_0x2c5ea3,_0x41b4db);}}; \ No newline at end of file +var _0x1856=['update','emit','removeListener','length','mailQueue:','./mailQueue.events'];(function(_0x4470b4,_0x2d1245){var _0x317e5a=function(_0x398e3d){while(--_0x398e3d){_0x4470b4['push'](_0x4470b4['shift']());}};_0x317e5a(++_0x2d1245);}(_0x1856,0x185));var _0x6185=function(_0x41722d,_0x37d74c){_0x41722d=_0x41722d-0x0;var _0xafc6d1=_0x1856[_0x41722d];return _0xafc6d1;};'use strict';var MailQueueEvents=require(_0x6185('0x0'));var events=['save','remove',_0x6185('0x1')];function createListener(_0x304126,_0x4c9ab7){return function(_0x11ae86){_0x4c9ab7[_0x6185('0x2')](_0x304126,_0x11ae86);};}function removeListener(_0xfd3b0d,_0x2b2dc3){return function(){MailQueueEvents[_0x6185('0x3')](_0xfd3b0d,_0x2b2dc3);};}exports['register']=function(_0x51a08f){for(var _0x3a0676=0x0,_0x1ff3e6=events[_0x6185('0x4')];_0x3a0676<_0x1ff3e6;_0x3a0676++){var _0x56dfa6=events[_0x3a0676];var _0x4d9d86=createListener(_0x6185('0x5')+_0x56dfa6,_0x51a08f);MailQueueEvents['on'](_0x56dfa6,_0x4d9d86);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 7735b69..0f305b9 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 _0xc479=['put','update','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','post','create'];(function(_0x486f4a,_0x478dc7){var _0x135d99=function(_0x434008){while(--_0x434008){_0x486f4a['push'](_0x486f4a['shift']());}};_0x135d99(++_0x478dc7);}(_0xc479,0x91));var _0x9c47=function(_0x1a16d7,_0x2a62a2){_0x1a16d7=_0x1a16d7-0x0;var _0x4e2f6a=_0xc479[_0x1a16d7];return _0x4e2f6a;};'use strict';var multer=require(_0x9c47('0x0'));var util=require(_0x9c47('0x1'));var path=require('path');var timeout=require(_0x9c47('0x2'));var express=require('express');var router=express[_0x9c47('0x3')]();var fs_extra=require(_0x9c47('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x9c47('0x5'));var config=require(_0x9c47('0x6'));var controller=require('./mailQueueReport.controller');router[_0x9c47('0x7')]('/',auth[_0x9c47('0x8')](),controller[_0x9c47('0x9')]);router[_0x9c47('0x7')](_0x9c47('0xa'),auth[_0x9c47('0x8')](),controller[_0x9c47('0xb')]);router[_0x9c47('0x7')](_0x9c47('0xc'),auth[_0x9c47('0x8')](),controller['show']);router[_0x9c47('0xd')]('/',auth[_0x9c47('0x8')](),controller[_0x9c47('0xe')]);router[_0x9c47('0xf')](_0x9c47('0xc'),auth[_0x9c47('0x8')](),controller[_0x9c47('0x10')]);router[_0x9c47('0x11')](_0x9c47('0xc'),auth['isAuthenticated'](),controller[_0x9c47('0x12')]);module[_0x9c47('0x13')]=router; \ No newline at end of file +var _0xa200=['put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create'];(function(_0x93f145,_0x2ad475){var _0x5e68ad=function(_0x77d156){while(--_0x77d156){_0x93f145['push'](_0x93f145['shift']());}};_0x5e68ad(++_0x2ad475);}(_0xa200,0x7c));var _0x0a20=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xa200[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0a20('0x0'));var util=require(_0x0a20('0x1'));var path=require(_0x0a20('0x2'));var timeout=require(_0x0a20('0x3'));var express=require(_0x0a20('0x4'));var router=express[_0x0a20('0x5')]();var fs_extra=require(_0x0a20('0x6'));var auth=require(_0x0a20('0x7'));var interaction=require(_0x0a20('0x8'));var config=require(_0x0a20('0x9'));var controller=require(_0x0a20('0xa'));router[_0x0a20('0xb')]('/',auth[_0x0a20('0xc')](),controller[_0x0a20('0xd')]);router[_0x0a20('0xb')](_0x0a20('0xe'),auth['isAuthenticated'](),controller[_0x0a20('0xf')]);router[_0x0a20('0xb')](_0x0a20('0x10'),auth['isAuthenticated'](),controller[_0x0a20('0x11')]);router[_0x0a20('0x12')]('/',auth[_0x0a20('0xc')](),controller[_0x0a20('0x13')]);router[_0x0a20('0x14')](_0x0a20('0x10'),auth[_0x0a20('0xc')](),controller['update']);router[_0x0a20('0x15')](_0x0a20('0x10'),auth[_0x0a20('0xc')](),controller[_0x0a20('0x16')]);module[_0x0a20('0x17')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index bc884c0..6d09218 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 _0x6ef9=['exports','STRING','DATE','moment','sequelize'];(function(_0x1dd688,_0x3b2f52){var _0x194452=function(_0x5ca10e){while(--_0x5ca10e){_0x1dd688['push'](_0x1dd688['shift']());}};_0x194452(++_0x3b2f52);}(_0x6ef9,0x148));var _0x96ef=function(_0x5311e8,_0x57c5bb){_0x5311e8=_0x5311e8-0x0;var _0x582ad8=_0x6ef9[_0x5311e8];return _0x582ad8;};'use strict';var moment=require(_0x96ef('0x0'));var Sequelize=require(_0x96ef('0x1'));module[_0x96ef('0x2')]={'uniqueid':{'type':Sequelize[_0x96ef('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x96ef('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x96ef('0x4')]},'acceptAt':{'type':Sequelize[_0x96ef('0x4')]},'exitAt':{'type':Sequelize[_0x96ef('0x4')]},'reason':{'type':Sequelize[_0x96ef('0x3')]}}; \ No newline at end of file +var _0x05da=['moment','sequelize','STRING','DATE'];(function(_0x47fb59,_0x862899){var _0x2bf187=function(_0x1d629){while(--_0x1d629){_0x47fb59['push'](_0x47fb59['shift']());}};_0x2bf187(++_0x862899);}(_0x05da,0x94));var _0xa05d=function(_0x2b0b50,_0x3f9d7d){_0x2b0b50=_0x2b0b50-0x0;var _0x60755d=_0x05da[_0x2b0b50];return _0x60755d;};'use strict';var moment=require(_0xa05d('0x0'));var Sequelize=require(_0xa05d('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xa05d('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xa05d('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xa05d('0x3')]},'exitAt':{'type':Sequelize[_0xa05d('0x3')]},'reason':{'type':Sequelize[_0xa05d('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 6e979b2..b26ac38 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 _0x93e9=['end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','error','name','send','map','rawAttributes','fieldName','type','key','query','intersection','model','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','MailQueueReport','includeAll','include','findAll','catch','show','params','keys','fields','length','options','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status'];(function(_0x4290b5,_0x51cc70){var _0x56c794=function(_0xf0129e){while(--_0xf0129e){_0x4290b5['push'](_0x4290b5['shift']());}};_0x56c794(++_0x51cc70);}(_0x93e9,0xcc));var _0x993e=function(_0x4c9380,_0x2fefc0){_0x4c9380=_0x4c9380-0x0;var _0x49a523=_0x93e9[_0x4c9380];return _0x49a523;};'use strict';var emlformat=require(_0x993e('0x0'));var rimraf=require(_0x993e('0x1'));var zipdir=require(_0x993e('0x2'));var jsonpatch=require(_0x993e('0x3'));var rp=require(_0x993e('0x4'));var moment=require(_0x993e('0x5'));var BPromise=require(_0x993e('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x993e('0x7'));var sox=require(_0x993e('0x8'));var csv=require(_0x993e('0x9'));var ejs=require(_0x993e('0xa'));var fs=require('fs');var fs_extra=require(_0x993e('0xb'));var _=require(_0x993e('0xc'));var squel=require(_0x993e('0xd'));var crypto=require(_0x993e('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x993e('0xf'));var toCsv=require(_0x993e('0x9'));var querystring=require(_0x993e('0x10'));var Papa=require(_0x993e('0x11'));var Redis=require(_0x993e('0x12'));var authService=require(_0x993e('0x13'));var qs=require(_0x993e('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x993e('0x15'));var logger=require(_0x993e('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x993e('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x993e('0x18'))['db'];function respondWithStatusCode(_0x5d5c0d,_0x4c2707){_0x4c2707=_0x4c2707||0xcc;return function(_0x31ece2){if(_0x31ece2){return _0x5d5c0d[_0x993e('0x19')](_0x4c2707);}return _0x5d5c0d[_0x993e('0x1a')](_0x4c2707)[_0x993e('0x1b')]();};}function respondWithResult(_0x3e082b,_0x397b42){_0x397b42=_0x397b42||0xc8;return function(_0x34ddda){if(_0x34ddda){return _0x3e082b[_0x993e('0x1a')](_0x397b42)[_0x993e('0x1c')](_0x34ddda);}};}function respondWithFilteredResult(_0xa43a4e,_0x1a7726){return function(_0x135771){if(_0x135771){var _0x3df0e7=typeof _0x1a7726[_0x993e('0x1d')]===_0x993e('0x1e')&&typeof _0x1a7726[_0x993e('0x1f')]===_0x993e('0x1e');var _0x526e06=_0x135771[_0x993e('0x20')];var _0x1acd21=_0x3df0e7?0x0:_0x1a7726[_0x993e('0x1d')];var _0x3d6109=_0x3df0e7?_0x135771[_0x993e('0x20')]:_0x1a7726[_0x993e('0x1d')]+_0x1a7726['limit'];var _0x11cd41;if(_0x3d6109>=_0x526e06){_0x3d6109=_0x526e06;_0x11cd41=0xc8;}else{_0x11cd41=0xce;}_0xa43a4e[_0x993e('0x1a')](_0x11cd41);return _0xa43a4e[_0x993e('0x21')](_0x993e('0x22'),_0x1acd21+'-'+_0x3d6109+'/'+_0x526e06)[_0x993e('0x1c')](_0x135771);}return null;};}function patchUpdates(_0x425ab4){return function(_0x29e48d){try{jsonpatch[_0x993e('0x23')](_0x29e48d,_0x425ab4,!![]);}catch(_0x4bbe9c){return BPromise[_0x993e('0x24')](_0x4bbe9c);}return _0x29e48d['save']();};}function saveUpdates(_0x11f6f4,_0x37ff57){return function(_0x32b09e){if(_0x32b09e){return _0x32b09e['update'](_0x11f6f4)[_0x993e('0x25')](function(_0x13db4e){return _0x13db4e;});}return null;};}function removeEntity(_0xfba00f,_0x1c52fd){return function(_0x3b45ef){if(_0x3b45ef){return _0x3b45ef[_0x993e('0x26')]()[_0x993e('0x25')](function(){_0xfba00f[_0x993e('0x1a')](0xcc)[_0x993e('0x1b')]();});}};}function handleEntityNotFound(_0x18f6ac,_0x3fe099){return function(_0x3603fa){if(!_0x3603fa){_0x18f6ac['sendStatus'](0x194);}return _0x3603fa;};}function handleError(_0x2756a7,_0x279bb8){_0x279bb8=_0x279bb8||0x1f4;return function(_0x52b727){logger[_0x993e('0x27')](_0x52b727['stack']);if(_0x52b727[_0x993e('0x28')]){delete _0x52b727[_0x993e('0x28')];}_0x2756a7[_0x993e('0x1a')](_0x279bb8)[_0x993e('0x29')](_0x52b727);};}exports['index']=function(_0x48d457,_0x32e332){var _0x466d63={},_0x4a4f00={},_0x223af0={'count':0x0,'rows':[]};var _0x46670a=_[_0x993e('0x2a')](db['MailQueueReport'][_0x993e('0x2b')],function(_0x9e0309){return{'name':_0x9e0309[_0x993e('0x2c')],'type':_0x9e0309[_0x993e('0x2d')][_0x993e('0x2e')]};});_0x4a4f00['model']=_[_0x993e('0x2a')](_0x46670a,'name');_0x4a4f00[_0x993e('0x2f')]=_['keys'](_0x48d457[_0x993e('0x2f')]);_0x4a4f00['filters']=_[_0x993e('0x30')](_0x4a4f00[_0x993e('0x31')],_0x4a4f00[_0x993e('0x2f')]);_0x466d63[_0x993e('0x32')]=_[_0x993e('0x30')](_0x4a4f00[_0x993e('0x31')],qs['fields'](_0x48d457[_0x993e('0x2f')]['fields']));_0x466d63['attributes']=_0x466d63[_0x993e('0x32')]['length']?_0x466d63[_0x993e('0x32')]:_0x4a4f00[_0x993e('0x31')];if(!_0x48d457[_0x993e('0x2f')][_0x993e('0x33')](_0x993e('0x34'))){_0x466d63[_0x993e('0x1f')]=qs[_0x993e('0x1f')](_0x48d457[_0x993e('0x2f')][_0x993e('0x1f')]);_0x466d63[_0x993e('0x1d')]=qs[_0x993e('0x1d')](_0x48d457[_0x993e('0x2f')][_0x993e('0x1d')]);}_0x466d63[_0x993e('0x35')]=qs[_0x993e('0x36')](_0x48d457['query'][_0x993e('0x36')]);_0x466d63[_0x993e('0x37')]=qs[_0x993e('0x38')](_[_0x993e('0x39')](_0x48d457[_0x993e('0x2f')],_0x4a4f00[_0x993e('0x38')]),_0x46670a);if(_0x48d457[_0x993e('0x2f')][_0x993e('0x3a')]){_0x466d63[_0x993e('0x37')]=_['merge'](_0x466d63[_0x993e('0x37')],{'$or':_['map'](_0x46670a,function(_0xf79f29){if(_0xf79f29[_0x993e('0x2d')]!==_0x993e('0x3b')){var _0x406f14={};_0x406f14[_0xf79f29[_0x993e('0x28')]]={'$like':'%'+_0x48d457[_0x993e('0x2f')][_0x993e('0x3a')]+'%'};return _0x406f14;}})});}_0x466d63=_[_0x993e('0x3c')]({},_0x466d63,_0x48d457['options']);var _0x186d55={'where':_0x466d63['where']};return db[_0x993e('0x3d')]['count'](_0x186d55)[_0x993e('0x25')](function(_0xbd9983){_0x223af0[_0x993e('0x20')]=_0xbd9983;if(_0x48d457[_0x993e('0x2f')][_0x993e('0x3e')]){_0x466d63[_0x993e('0x3f')]=[{'all':!![]}];}return db[_0x993e('0x3d')][_0x993e('0x40')](_0x466d63);})['then'](function(_0xe64c){_0x223af0['rows']=_0xe64c;return _0x223af0;})['then'](respondWithFilteredResult(_0x32e332,_0x466d63))[_0x993e('0x41')](handleError(_0x32e332,null));};exports[_0x993e('0x42')]=function(_0x1f058f,_0x5ed497){var _0x620b26={'raw':!![],'where':{'id':_0x1f058f[_0x993e('0x43')]['id']}},_0x40719d={};_0x40719d['model']=_['keys'](db['MailQueueReport'][_0x993e('0x2b')]);_0x40719d[_0x993e('0x2f')]=_[_0x993e('0x44')](_0x1f058f['query']);_0x40719d[_0x993e('0x38')]=_[_0x993e('0x30')](_0x40719d['model'],_0x40719d[_0x993e('0x2f')]);_0x620b26[_0x993e('0x32')]=_['intersection'](_0x40719d[_0x993e('0x31')],qs[_0x993e('0x45')](_0x1f058f[_0x993e('0x2f')]['fields']));_0x620b26['attributes']=_0x620b26['attributes'][_0x993e('0x46')]?_0x620b26[_0x993e('0x32')]:_0x40719d[_0x993e('0x31')];if(_0x1f058f[_0x993e('0x2f')]['includeAll']){_0x620b26[_0x993e('0x3f')]=[{'all':!![]}];}_0x620b26=_[_0x993e('0x3c')]({},_0x620b26,_0x1f058f[_0x993e('0x47')]);return db[_0x993e('0x3d')][_0x993e('0x48')](_0x620b26)[_0x993e('0x25')](handleEntityNotFound(_0x5ed497,null))['then'](respondWithResult(_0x5ed497,null))['catch'](handleError(_0x5ed497,null));};exports[_0x993e('0x49')]=function(_0x416f9f,_0x4d560d){return db['MailQueueReport'][_0x993e('0x49')](_0x416f9f[_0x993e('0x4a')],{})[_0x993e('0x25')](respondWithResult(_0x4d560d,0xc9))[_0x993e('0x41')](handleError(_0x4d560d,null));};exports[_0x993e('0x4b')]=function(_0x256ce3,_0x5b18e3){if(_0x256ce3[_0x993e('0x4a')]['id']){delete _0x256ce3['body']['id'];}return db[_0x993e('0x3d')][_0x993e('0x48')]({'where':{'id':_0x256ce3[_0x993e('0x43')]['id']}})[_0x993e('0x25')](handleEntityNotFound(_0x5b18e3,null))[_0x993e('0x25')](saveUpdates(_0x256ce3[_0x993e('0x4a')],null))[_0x993e('0x25')](respondWithResult(_0x5b18e3,null))[_0x993e('0x41')](handleError(_0x5b18e3,null));};exports['destroy']=function(_0x23f09c,_0x66ee65){return db[_0x993e('0x3d')]['find']({'where':{'id':_0x23f09c[_0x993e('0x43')]['id']}})['then'](handleEntityNotFound(_0x66ee65,null))[_0x993e('0x25')](removeEntity(_0x66ee65,null))[_0x993e('0x41')](handleError(_0x66ee65,null));};exports['describe']=function(_0xb2508b,_0xef78a1){return db['MailQueueReport'][_0x993e('0x4c')]()[_0x993e('0x25')](respondWithResult(_0xef78a1,null))[_0x993e('0x41')](handleError(_0xef78a1,null));}; \ No newline at end of file +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','MailQueueReport','rawAttributes','fieldName','type','key','map','query','keys'];(function(_0x3f5dca,_0x59472b){var _0x5b833a=function(_0x1cb84b){while(--_0x1cb84b){_0x3f5dca['push'](_0x3f5dca['shift']());}};_0x5b833a(++_0x59472b);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x64045a,_0x1c7e70){_0x64045a=_0x64045a-0x0;var _0x38bd10=_0xc6ac[_0x64045a];return _0x38bd10;};'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['MailQueueReport'][_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/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 94d2b5f..3005800 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 _0xea4f=['report_mail_queue','uniqueid','lodash','util','api','moment','bluebird','request-promise','./mailQueueReport.attributes','define'];(function(_0x525ac5,_0x178d00){var _0x3c0fc2=function(_0x2f4873){while(--_0x2f4873){_0x525ac5['push'](_0x525ac5['shift']());}};_0x3c0fc2(++_0x178d00);}(_0xea4f,0x7a));var _0xfea4=function(_0x37a76e,_0x30f473){_0x37a76e=_0x37a76e-0x0;var _0x5328db=_0xea4f[_0x37a76e];return _0x5328db;};'use strict';var _=require(_0xfea4('0x0'));var util=require(_0xfea4('0x1'));var logger=require('../../config/logger')(_0xfea4('0x2'));var moment=require(_0xfea4('0x3'));var BPromise=require(_0xfea4('0x4'));var rp=require(_0xfea4('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xfea4('0x6'));module['exports']=function(_0x5518a2,_0x545d11){return _0x5518a2[_0xfea4('0x7')]('MailQueueReport',attributes,{'tableName':_0xfea4('0x8'),'paranoid':![],'indexes':[{'name':_0xfea4('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xd05f=['path','rimraf','../../config/environment','./mailQueueReport.attributes','exports','define','uniqueid','lodash','util','api','moment','bluebird','request-promise'];(function(_0x364062,_0x29f4f6){var _0x5930e7=function(_0x297ead){while(--_0x297ead){_0x364062['push'](_0x364062['shift']());}};_0x5930e7(++_0x29f4f6);}(_0xd05f,0x96));var _0xfd05=function(_0x448333,_0x4a1fe6){_0x448333=_0x448333-0x0;var _0x357457=_0xd05f[_0x448333];return _0x357457;};'use strict';var _=require(_0xfd05('0x0'));var util=require(_0xfd05('0x1'));var logger=require('../../config/logger')(_0xfd05('0x2'));var moment=require(_0xfd05('0x3'));var BPromise=require(_0xfd05('0x4'));var rp=require(_0xfd05('0x5'));var fs=require('fs');var path=require(_0xfd05('0x6'));var rimraf=require(_0xfd05('0x7'));var config=require(_0xfd05('0x8'));var attributes=require(_0xfd05('0x9'));module[_0xfd05('0xa')]=function(_0x3de7da,_0x142f45){return _0x3de7da[_0xfd05('0xb')]('MailQueueReport',attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':_0xfd05('0xc'),'fields':[_0xfd05('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 eb35a7d..8c70d4e 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 _0x1261=['../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','MailQueueReport,\x20%s,\x20%s','request\x20sent','MailQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','CreateMailQueueReport','body','options','raw','stringify','MailQueueReport','update','where','UpdateMailQueueReport','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x4ed261,_0x34ed3b){var _0x46e465=function(_0x3c646e){while(--_0x3c646e){_0x4ed261['push'](_0x4ed261['shift']());}};_0x46e465(++_0x34ed3b);}(_0x1261,0x144));var _0x1126=function(_0x51708f,_0x511834){_0x51708f=_0x51708f-0x0;var _0x5c60a3=_0x1261[_0x51708f];return _0x5c60a3;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('MailQueueReport,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});}exports[_0x1126('0x15')]=function(_0x4a7b49){var _0x4d2b38=this;return new Promise(function(_0x22ae0b,_0x2b2487){return db['MailQueueReport']['create'](_0x4a7b49[_0x1126('0x16')],{'raw':_0x4a7b49['options']?_0x4a7b49[_0x1126('0x17')][_0x1126('0x18')]===undefined?!![]:![]:!![]})[_0x1126('0xc')](function(_0x54400a){logger[_0x1126('0xd')]('CreateMailQueueReport',_0x4a7b49);logger['debug'](_0x1126('0x15'),_0x4a7b49,JSON[_0x1126('0x19')](_0x54400a));_0x22ae0b(_0x54400a);})[_0x1126('0x14')](function(_0x36d254){logger['error'](_0x1126('0x15'),_0x36d254[_0x1126('0x13')],_0x4a7b49);_0x2b2487(_0x4d2b38['error'](0x1f4,_0x36d254[_0x1126('0x13')]));});});};exports['UpdateMailQueueReport']=function(_0x529dd9){var _0x4b57ab=this;return new Promise(function(_0x2199d9,_0x15bcc3){return db[_0x1126('0x1a')][_0x1126('0x1b')](_0x529dd9[_0x1126('0x16')],{'raw':_0x529dd9[_0x1126('0x17')]?_0x529dd9[_0x1126('0x17')][_0x1126('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x529dd9['options']?_0x529dd9[_0x1126('0x17')][_0x1126('0x1c')]||null:null,'attributes':_0x529dd9[_0x1126('0x17')]?_0x529dd9['options']['attributes']||null:null,'limit':_0x529dd9[_0x1126('0x17')]?_0x529dd9[_0x1126('0x17')]['limit']||null:null})[_0x1126('0xc')](function(_0x23d2bc){logger['info'](_0x1126('0x1d'),_0x529dd9);logger['debug'](_0x1126('0x1d'),_0x529dd9,JSON['stringify'](_0x23d2bc));_0x2199d9(_0x23d2bc);})[_0x1126('0x14')](function(_0x583ce6){logger[_0x1126('0x11')]('UpdateMailQueueReport',_0x583ce6['message'],_0x529dd9);_0x15bcc3(_0x4b57ab['error'](0x1f4,_0x583ce6[_0x1126('0x13')]));});});}; \ No newline at end of file +var _0xadb5=['MailQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateMailQueueReport','create','options','raw','debug','MailQueueReport','body','attributes','limit','UpdateMailQueueReport','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info'];(function(_0x57ad75,_0xf30c10){var _0xb06828=function(_0x4332d4){while(--_0x4332d4){_0x57ad75['push'](_0x57ad75['shift']());}};_0xb06828(++_0xf30c10);}(_0xadb5,0xad));var _0x5adb=function(_0xf0534f,_0x43e1c9){_0xf0534f=_0xf0534f-0x0;var _0x298d20=_0xadb5[_0xf0534f];return _0x298d20;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('MailQueueReport,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});}exports[_0x5adb('0x15')]=function(_0x529b65){var _0x3fff62=this;return new Promise(function(_0x5de028,_0x1d9e86){return db['MailQueueReport'][_0x5adb('0x16')](_0x529b65['body'],{'raw':_0x529b65['options']?_0x529b65[_0x5adb('0x17')][_0x5adb('0x18')]===undefined?!![]:![]:!![]})[_0x5adb('0xb')](function(_0x1fd4a7){logger[_0x5adb('0xc')]('CreateMailQueueReport',_0x529b65);logger[_0x5adb('0x19')]('CreateMailQueueReport',_0x529b65,JSON['stringify'](_0x1fd4a7));_0x5de028(_0x1fd4a7);})[_0x5adb('0x14')](function(_0x379b33){logger[_0x5adb('0x10')](_0x5adb('0x15'),_0x379b33[_0x5adb('0x12')],_0x529b65);_0x1d9e86(_0x3fff62[_0x5adb('0x10')](0x1f4,_0x379b33[_0x5adb('0x12')]));});});};exports['UpdateMailQueueReport']=function(_0x4b1957){var _0x373cc3=this;return new Promise(function(_0x3220cd,_0x3839fb){return db[_0x5adb('0x1a')]['update'](_0x4b1957[_0x5adb('0x1b')],{'raw':_0x4b1957[_0x5adb('0x17')]?_0x4b1957['options'][_0x5adb('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b1957[_0x5adb('0x17')]?_0x4b1957[_0x5adb('0x17')]['where']||null:null,'attributes':_0x4b1957[_0x5adb('0x17')]?_0x4b1957[_0x5adb('0x17')][_0x5adb('0x1c')]||null:null,'limit':_0x4b1957[_0x5adb('0x17')]?_0x4b1957[_0x5adb('0x17')][_0x5adb('0x1d')]||null:null})['then'](function(_0x49992e){logger['info'](_0x5adb('0x1e'),_0x4b1957);logger[_0x5adb('0x19')](_0x5adb('0x1e'),_0x4b1957,JSON[_0x5adb('0xf')](_0x49992e));_0x3220cd(_0x49992e);})[_0x5adb('0x14')](function(_0x4de310){logger[_0x5adb('0x10')](_0x5adb('0x1e'),_0x4de310[_0x5adb('0x12')],_0x4b1957);_0x3839fb(_0x373cc3[_0x5adb('0x10')](0x1f4,_0x4de310[_0x5adb('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 5f3df38..deee669 100644 --- a/server/api/mailServerIn/index.js +++ b/server/api/mailServerIn/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x56f151,_0x281759){var _0x52c1e3=function(_0x12ba6d){while(--_0x12ba6d){_0x56f151['push'](_0x56f151['shift']());}};_0x52c1e3(++_0x281759);}(_0x9c44,0x178));var _0x49c4=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0x9c44[_0x2064e5];return _0x21a233;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x69473,_0x1cbe33){var _0x50bff3=function(_0x241d54){while(--_0x241d54){_0x69473['push'](_0x69473['shift']());}};_0x50bff3(++_0x1cbe33);}(_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/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 5214b0c..d18b736 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 _0xd039=['exports','STRING','BOOLEAN','INTEGER','sequelize'];(function(_0x53564f,_0x52d58d){var _0xd566eb=function(_0x42ff0c){while(--_0x42ff0c){_0x53564f['push'](_0x53564f['shift']());}};_0xd566eb(++_0x52d58d);}(_0xd039,0x1e9));var _0x9d03=function(_0x2f8d91,_0x208e5f){_0x2f8d91=_0x2f8d91-0x0;var _0x271286=_0xd039[_0x2f8d91];return _0x271286;};'use strict';var Sequelize=require(_0x9d03('0x0'));module[_0x9d03('0x1')]={'description':{'type':Sequelize[_0x9d03('0x2')]},'host':{'type':Sequelize[_0x9d03('0x2')]},'authentication':{'type':Sequelize[_0x9d03('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0x9d03('0x2')]},'password':{'type':Sequelize[_0x9d03('0x2')]},'port':{'type':Sequelize[_0x9d03('0x4')]},'tls':{'type':Sequelize[_0x9d03('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x9d03('0x2')],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x9d03('0x4')],'defaultValue':0x5},'service':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize[_0x9d03('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xd4af=['INTEGER','sequelize','exports','STRING','BOOLEAN','INBOX'];(function(_0xd62db,_0x5e81b8){var _0x104c01=function(_0x586a53){while(--_0x586a53){_0xd62db['push'](_0xd62db['shift']());}};_0x104c01(++_0x5e81b8);}(_0xd4af,0xe5));var _0xfd4a=function(_0x139a49,_0x5a4f50){_0x139a49=_0x139a49-0x0;var _0x2d9518=_0xd4af[_0x139a49];return _0x2d9518;};'use strict';var Sequelize=require(_0xfd4a('0x0'));module[_0xfd4a('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xfd4a('0x2')]},'authentication':{'type':Sequelize[_0xfd4a('0x3')],'defaultValue':!![]},'user':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xfd4a('0x2')]},'port':{'type':Sequelize['INTEGER']},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':_0xfd4a('0x4')},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xfd4a('0x5')],'defaultValue':0x5},'service':{'type':Sequelize[_0xfd4a('0x2')]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index ec1d9b2..be1c3e4 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 _0x0bbd=['lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./mailServerIn.attributes','exports','define','MailServerIn','mail_servers_in'];(function(_0x1a3cb2,_0x11c068){var _0x56cf8a=function(_0x52d3c7){while(--_0x52d3c7){_0x1a3cb2['push'](_0x1a3cb2['shift']());}};_0x56cf8a(++_0x11c068);}(_0x0bbd,0x68));var _0xd0bb=function(_0x84cab1,_0x384b3e){_0x84cab1=_0x84cab1-0x0;var _0x364476=_0x0bbd[_0x84cab1];return _0x364476;};'use strict';var _=require(_0xd0bb('0x0'));var util=require(_0xd0bb('0x1'));var logger=require(_0xd0bb('0x2'))('api');var moment=require(_0xd0bb('0x3'));var BPromise=require(_0xd0bb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd0bb('0x5'));var rimraf=require(_0xd0bb('0x6'));var config=require(_0xd0bb('0x7'));var attributes=require(_0xd0bb('0x8'));module[_0xd0bb('0x9')]=function(_0x2bfa66,_0x50bbef){return _0x2bfa66[_0xd0bb('0xa')](_0xd0bb('0xb'),attributes,{'tableName':_0xd0bb('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x10d1=['./mailServerIn.attributes','define','MailServerIn','mail_servers_in','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x5850a5,_0x163e88){var _0x4ccd59=function(_0x4e94f7){while(--_0x4e94f7){_0x5850a5['push'](_0x5850a5['shift']());}};_0x4ccd59(++_0x163e88);}(_0x10d1,0x170));var _0x110d=function(_0xdb0e85,_0x342441){_0xdb0e85=_0xdb0e85-0x0;var _0x249f87=_0x10d1[_0xdb0e85];return _0x249f87;};'use strict';var _=require(_0x110d('0x0'));var util=require(_0x110d('0x1'));var logger=require(_0x110d('0x2'))('api');var moment=require(_0x110d('0x3'));var BPromise=require(_0x110d('0x4'));var rp=require(_0x110d('0x5'));var fs=require('fs');var path=require(_0x110d('0x6'));var rimraf=require(_0x110d('0x7'));var config=require(_0x110d('0x8'));var attributes=require(_0x110d('0x9'));module['exports']=function(_0x47b7c9,_0x15b27c){return _0x47b7c9[_0x110d('0xa')](_0x110d('0xb'),attributes,{'tableName':_0x110d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.rpc.js b/server/api/mailServerIn/mailServerIn.rpc.js index a7ef9a7..62e8de3 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 _0xc805=['stringify','error','code','message','info','result','catch','GetMailServerIn','MailServerIn','findAll','options','where','attributes','include','model','map','debug','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','request','then','MailServerIn,\x20%s,\x20%s','request\x20sent','MailServerIn,\x20%s,\x20%s,\x20%s'];(function(_0x172872,_0x4f4299){var _0x378d84=function(_0x14f36f){while(--_0x14f36f){_0x172872['push'](_0x172872['shift']());}};_0x378d84(++_0x4f4299);}(_0xc805,0x171));var _0x5c80=function(_0x3ff0f0,_0x5523bf){_0x3ff0f0=_0x3ff0f0-0x0;var _0x5dc82a=_0xc805[_0x3ff0f0];return _0x5dc82a;};'use strict';var _=require(_0x5c80('0x0'));var util=require('util');var moment=require(_0x5c80('0x1'));var BPromise=require(_0x5c80('0x2'));var rs=require(_0x5c80('0x3'));var fs=require('fs');var Redis=require(_0x5c80('0x4'));var db=require(_0x5c80('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x5c80('0x6'))(_0x5c80('0x7'));var config=require('../../config/environment');var jayson=require(_0x5c80('0x8'));var client=jayson['client'][_0x5c80('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xc7f27e,_0xb5d868,_0x5d4c1b){return new BPromise(function(_0x17358d,_0x1960b7){return client[_0x5c80('0xa')](_0xc7f27e,_0x5d4c1b)[_0x5c80('0xb')](function(_0x5a4b2b){logger['info'](_0x5c80('0xc'),_0xb5d868,_0x5c80('0xd'));logger['debug'](_0x5c80('0xe'),_0xb5d868,_0x5c80('0xd'),JSON[_0x5c80('0xf')](_0x5a4b2b));if(_0x5a4b2b[_0x5c80('0x10')]){if(_0x5a4b2b['error'][_0x5c80('0x11')]===0x1f4){logger[_0x5c80('0x10')]('MailServerIn,\x20%s,\x20%s',_0xb5d868,_0x5a4b2b[_0x5c80('0x10')][_0x5c80('0x12')]);return _0x1960b7(_0x5a4b2b[_0x5c80('0x10')][_0x5c80('0x12')]);}logger[_0x5c80('0x10')](_0x5c80('0xc'),_0xb5d868,_0x5a4b2b[_0x5c80('0x10')]['message']);return _0x17358d(_0x5a4b2b['error'][_0x5c80('0x12')]);}else{logger[_0x5c80('0x13')](_0x5c80('0xc'),_0xb5d868,_0x5c80('0xd'));_0x17358d(_0x5a4b2b[_0x5c80('0x14')]['message']);}})[_0x5c80('0x15')](function(_0x164726){logger[_0x5c80('0x10')](_0x5c80('0xc'),_0xb5d868,_0x164726);_0x1960b7(_0x164726);});});}exports[_0x5c80('0x16')]=function(_0x849856){var _0xfd4291=this;return new Promise(function(_0x406d5e,_0x37e2b0){return db[_0x5c80('0x17')][_0x5c80('0x18')]({'raw':_0x849856[_0x5c80('0x19')]?_0x849856[_0x5c80('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x849856[_0x5c80('0x19')]?_0x849856[_0x5c80('0x19')][_0x5c80('0x1a')]||null:null,'attributes':_0x849856[_0x5c80('0x19')]?_0x849856[_0x5c80('0x19')][_0x5c80('0x1b')]||null:null,'limit':_0x849856['options']?_0x849856[_0x5c80('0x19')]['limit']||null:null,'include':_0x849856[_0x5c80('0x19')]?_0x849856[_0x5c80('0x19')][_0x5c80('0x1c')]?_['map'](_0x849856['options'][_0x5c80('0x1c')],function(_0x2b5530){return{'model':db[_0x2b5530[_0x5c80('0x1d')]],'as':_0x2b5530['as'],'attributes':_0x2b5530[_0x5c80('0x1b')],'include':_0x2b5530[_0x5c80('0x1c')]?_[_0x5c80('0x1e')](_0x2b5530['include'],function(_0x5ae145){return{'model':db[_0x5ae145[_0x5c80('0x1d')]],'as':_0x5ae145['as'],'attributes':_0x5ae145[_0x5c80('0x1b')],'include':_0x5ae145[_0x5c80('0x1c')]?_[_0x5c80('0x1e')](_0x5ae145[_0x5c80('0x1c')],function(_0x5aa162){return{'model':db[_0x5aa162['model']],'as':_0x5aa162['as'],'attributes':_0x5aa162[_0x5c80('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x5c80('0xb')](function(_0x596edc){logger[_0x5c80('0x13')](_0x5c80('0x16'),_0x849856);logger[_0x5c80('0x1f')](_0x5c80('0x16'),_0x849856,JSON[_0x5c80('0xf')](_0x596edc));_0x406d5e(_0x596edc);})[_0x5c80('0x15')](function(_0x2196e5){logger[_0x5c80('0x10')](_0x5c80('0x16'),_0x2196e5[_0x5c80('0x12')],_0x849856);_0x37e2b0(_0xfd4291[_0x5c80('0x10')](0x1f4,_0x2196e5[_0x5c80('0x12')]));});});}; \ No newline at end of file +var _0x95ce=['client','request','then','MailServerIn,\x20%s,\x20%s','MailServerIn,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetMailServerIn','MailServerIn','findAll','options','raw','where','attributes','limit','include','map','model','info','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x227267,_0x548e57){var _0x47e978=function(_0x4ddc41){while(--_0x4ddc41){_0x227267['push'](_0x227267['shift']());}};_0x47e978(++_0x548e57);}(_0x95ce,0x1e6));var _0xe95c=function(_0x3ea7a5,_0x59e8e8){_0x3ea7a5=_0x3ea7a5-0x0;var _0x165fe5=_0x95ce[_0x3ea7a5];return _0x165fe5;};'use strict';var _=require('lodash');var util=require(_0xe95c('0x0'));var moment=require(_0xe95c('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe95c('0x2'));var db=require(_0xe95c('0x3'))['db'];var utils=require(_0xe95c('0x4'));var logger=require(_0xe95c('0x5'))(_0xe95c('0x6'));var config=require(_0xe95c('0x7'));var jayson=require(_0xe95c('0x8'));var client=jayson[_0xe95c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2be11f,_0x467d6f,_0x445413){return new BPromise(function(_0x4f923c,_0x54a1e9){return client[_0xe95c('0xa')](_0x2be11f,_0x445413)[_0xe95c('0xb')](function(_0x16e3ff){logger['info'](_0xe95c('0xc'),_0x467d6f,'request\x20sent');logger['debug'](_0xe95c('0xd'),_0x467d6f,_0xe95c('0xe'),JSON[_0xe95c('0xf')](_0x16e3ff));if(_0x16e3ff['error']){if(_0x16e3ff[_0xe95c('0x10')][_0xe95c('0x11')]===0x1f4){logger['error'](_0xe95c('0xc'),_0x467d6f,_0x16e3ff[_0xe95c('0x10')][_0xe95c('0x12')]);return _0x54a1e9(_0x16e3ff[_0xe95c('0x10')][_0xe95c('0x12')]);}logger[_0xe95c('0x10')]('MailServerIn,\x20%s,\x20%s',_0x467d6f,_0x16e3ff[_0xe95c('0x10')][_0xe95c('0x12')]);return _0x4f923c(_0x16e3ff[_0xe95c('0x10')]['message']);}else{logger['info'](_0xe95c('0xc'),_0x467d6f,_0xe95c('0xe'));_0x4f923c(_0x16e3ff[_0xe95c('0x13')][_0xe95c('0x12')]);}})[_0xe95c('0x14')](function(_0x30662c){logger[_0xe95c('0x10')](_0xe95c('0xc'),_0x467d6f,_0x30662c);_0x54a1e9(_0x30662c);});});}exports[_0xe95c('0x15')]=function(_0x17b96d){var _0x2562aa=this;return new Promise(function(_0x2a5fd8,_0x4dc52c){return db[_0xe95c('0x16')][_0xe95c('0x17')]({'raw':_0x17b96d[_0xe95c('0x18')]?_0x17b96d['options'][_0xe95c('0x19')]===undefined?!![]:![]:!![],'where':_0x17b96d['options']?_0x17b96d[_0xe95c('0x18')][_0xe95c('0x1a')]||null:null,'attributes':_0x17b96d[_0xe95c('0x18')]?_0x17b96d[_0xe95c('0x18')][_0xe95c('0x1b')]||null:null,'limit':_0x17b96d[_0xe95c('0x18')]?_0x17b96d[_0xe95c('0x18')][_0xe95c('0x1c')]||null:null,'include':_0x17b96d[_0xe95c('0x18')]?_0x17b96d[_0xe95c('0x18')][_0xe95c('0x1d')]?_[_0xe95c('0x1e')](_0x17b96d['options'][_0xe95c('0x1d')],function(_0x1f9c5a){return{'model':db[_0x1f9c5a[_0xe95c('0x1f')]],'as':_0x1f9c5a['as'],'attributes':_0x1f9c5a[_0xe95c('0x1b')],'include':_0x1f9c5a[_0xe95c('0x1d')]?_[_0xe95c('0x1e')](_0x1f9c5a['include'],function(_0x2dc218){return{'model':db[_0x2dc218[_0xe95c('0x1f')]],'as':_0x2dc218['as'],'attributes':_0x2dc218['attributes'],'include':_0x2dc218[_0xe95c('0x1d')]?_['map'](_0x2dc218[_0xe95c('0x1d')],function(_0x5d4c50){return{'model':db[_0x5d4c50['model']],'as':_0x5d4c50['as'],'attributes':_0x5d4c50[_0xe95c('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xa1e841){logger[_0xe95c('0x20')](_0xe95c('0x15'),_0x17b96d);logger['debug'](_0xe95c('0x15'),_0x17b96d,JSON[_0xe95c('0xf')](_0xa1e841));_0x2a5fd8(_0xa1e841);})[_0xe95c('0x14')](function(_0x298ff7){logger[_0xe95c('0x10')](_0xe95c('0x15'),_0x298ff7[_0xe95c('0x12')],_0x17b96d);_0x4dc52c(_0x2562aa['error'](0x1f4,_0x298ff7[_0xe95c('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 3ad2c60..8fc80e1 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(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file +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(_0x1cfa0d,_0x4391f2){var _0xe33279=function(_0x3ce7c1){while(--_0x3ce7c1){_0x1cfa0d['push'](_0x1cfa0d['shift']());}};_0xe33279(++_0x4391f2);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index 48a6cb3..59a37ca 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 _0x2547=['BOOLEAN','exports','STRING','INTEGER'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0x2547,0x1cd));var _0x7254=function(_0x5acad7,_0x3e6fda){_0x5acad7=_0x5acad7-0x0;var _0x264e42=_0x2547[_0x5acad7];return _0x264e42;};'use strict';var Sequelize=require('sequelize');module[_0x7254('0x0')]={'description':{'type':Sequelize[_0x7254('0x1')]},'host':{'type':Sequelize[_0x7254('0x1')]},'user':{'type':Sequelize[_0x7254('0x1')]},'pass':{'type':Sequelize[_0x7254('0x1')]},'port':{'type':Sequelize[_0x7254('0x2')]},'secure':{'type':Sequelize[_0x7254('0x3')],'defaultValue':![]},'service':{'type':Sequelize[_0x7254('0x1')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x7254('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x02ce=['STRING','INTEGER','BOOLEAN','sequelize','exports'];(function(_0x40a777,_0x2b559a){var _0x157353=function(_0xb2ca49){while(--_0xb2ca49){_0x40a777['push'](_0x40a777['shift']());}};_0x157353(++_0x2b559a);}(_0x02ce,0x1ac));var _0xe02c=function(_0x46f4bf,_0x27ea7e){_0x46f4bf=_0x46f4bf-0x0;var _0x4e561a=_0x02ce[_0x46f4bf];return _0x4e561a;};'use strict';var Sequelize=require(_0xe02c('0x0'));module[_0xe02c('0x1')]={'description':{'type':Sequelize[_0xe02c('0x2')]},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize[_0xe02c('0x2')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xe02c('0x3')]},'secure':{'type':Sequelize[_0xe02c('0x4')],'defaultValue':![]},'service':{'type':Sequelize[_0xe02c('0x2')]},'authentication':{'type':Sequelize[_0xe02c('0x4')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0xe02c('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 c33f5cb..ee57caf 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 _0x7f28=['end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','MailServerOut','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','where','merge','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','update','body','eml-format','rimraf','zip-dir','request-promise','bluebird','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status'];(function(_0x1e7f4d,_0x20acaa){var _0x5f0fd9=function(_0x4dbbf4){while(--_0x4dbbf4){_0x1e7f4d['push'](_0x1e7f4d['shift']());}};_0x5f0fd9(++_0x20acaa);}(_0x7f28,0x166));var _0x87f2=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x7f28[_0x432682];return _0x463d05;};'use strict';var emlformat=require(_0x87f2('0x0'));var rimraf=require(_0x87f2('0x1'));var zipdir=require(_0x87f2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x87f2('0x3'));var moment=require('moment');var BPromise=require(_0x87f2('0x4'));var Mustache=require('mustache');var util=require(_0x87f2('0x5'));var path=require(_0x87f2('0x6'));var sox=require(_0x87f2('0x7'));var csv=require('to-csv');var ejs=require(_0x87f2('0x8'));var fs=require('fs');var fs_extra=require(_0x87f2('0x9'));var _=require(_0x87f2('0xa'));var squel=require('squel');var crypto=require(_0x87f2('0xb'));var jsforce=require(_0x87f2('0xc'));var deskjs=require(_0x87f2('0xd'));var toCsv=require(_0x87f2('0xe'));var querystring=require(_0x87f2('0xf'));var Papa=require(_0x87f2('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x87f2('0x11'));var as=require(_0x87f2('0x12'));var hardwareService=require(_0x87f2('0x13'));var logger=require(_0x87f2('0x14'))(_0x87f2('0x15'));var utils=require(_0x87f2('0x16'));var config=require(_0x87f2('0x17'));var licenseUtil=require(_0x87f2('0x18'));var db=require(_0x87f2('0x19'))['db'];function respondWithStatusCode(_0x1cf79c,_0x5d20ec){_0x5d20ec=_0x5d20ec||0xcc;return function(_0x2914b3){if(_0x2914b3){return _0x1cf79c['sendStatus'](_0x5d20ec);}return _0x1cf79c[_0x87f2('0x1a')](_0x5d20ec)[_0x87f2('0x1b')]();};}function respondWithResult(_0x59cfbe,_0x5bbc73){_0x5bbc73=_0x5bbc73||0xc8;return function(_0x30cf30){if(_0x30cf30){return _0x59cfbe[_0x87f2('0x1a')](_0x5bbc73)['json'](_0x30cf30);}};}function respondWithFilteredResult(_0x3e8835,_0x3b5f06){return function(_0x41acaa){if(_0x41acaa){var _0x3150ca=typeof _0x3b5f06[_0x87f2('0x1c')]===_0x87f2('0x1d')&&typeof _0x3b5f06[_0x87f2('0x1e')]===_0x87f2('0x1d');var _0x5cedbd=_0x41acaa[_0x87f2('0x1f')];var _0x13ac7f=_0x3150ca?0x0:_0x3b5f06[_0x87f2('0x1c')];var _0x4646a3=_0x3150ca?_0x41acaa[_0x87f2('0x1f')]:_0x3b5f06['offset']+_0x3b5f06[_0x87f2('0x1e')];var _0x857504;if(_0x4646a3>=_0x5cedbd){_0x4646a3=_0x5cedbd;_0x857504=0xc8;}else{_0x857504=0xce;}_0x3e8835['status'](_0x857504);return _0x3e8835[_0x87f2('0x20')](_0x87f2('0x21'),_0x13ac7f+'-'+_0x4646a3+'/'+_0x5cedbd)['json'](_0x41acaa);}return null;};}function patchUpdates(_0x2fba51){return function(_0xf006a8){try{jsonpatch[_0x87f2('0x22')](_0xf006a8,_0x2fba51,!![]);}catch(_0x1ce85e){return BPromise[_0x87f2('0x23')](_0x1ce85e);}return _0xf006a8[_0x87f2('0x24')]();};}function saveUpdates(_0x1d8df8,_0x47ac37){return function(_0x1f06a9){if(_0x1f06a9){return _0x1f06a9['update'](_0x1d8df8)[_0x87f2('0x25')](function(_0x115451){return _0x115451;});}return null;};}function removeEntity(_0x3965d0,_0x30037e){return function(_0xbc9b9c){if(_0xbc9b9c){return _0xbc9b9c[_0x87f2('0x26')]()[_0x87f2('0x25')](function(){_0x3965d0[_0x87f2('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4cdff1,_0x555f4b){return function(_0x2c92df){if(!_0x2c92df){_0x4cdff1['sendStatus'](0x194);}return _0x2c92df;};}function handleError(_0x2880d8,_0xc2e3e2){_0xc2e3e2=_0xc2e3e2||0x1f4;return function(_0x2f4b43){logger[_0x87f2('0x27')](_0x2f4b43[_0x87f2('0x28')]);if(_0x2f4b43['name']){delete _0x2f4b43[_0x87f2('0x29')];}_0x2880d8['status'](_0xc2e3e2)[_0x87f2('0x2a')](_0x2f4b43);};}exports[_0x87f2('0x2b')]=function(_0x1762da,_0x748ea8){var _0x1e8a0d={},_0xf32d2b={},_0xef93e1={'count':0x0,'rows':[]};var _0x5c30a5=_[_0x87f2('0x2c')](db[_0x87f2('0x2d')][_0x87f2('0x2e')],function(_0x1fcf72){return{'name':_0x1fcf72[_0x87f2('0x2f')],'type':_0x1fcf72[_0x87f2('0x30')][_0x87f2('0x31')]};});_0xf32d2b['model']=_['map'](_0x5c30a5,_0x87f2('0x29'));_0xf32d2b[_0x87f2('0x32')]=_[_0x87f2('0x33')](_0x1762da[_0x87f2('0x32')]);_0xf32d2b['filters']=_[_0x87f2('0x34')](_0xf32d2b[_0x87f2('0x35')],_0xf32d2b[_0x87f2('0x32')]);_0x1e8a0d[_0x87f2('0x36')]=_[_0x87f2('0x34')](_0xf32d2b[_0x87f2('0x35')],qs['fields'](_0x1762da[_0x87f2('0x32')][_0x87f2('0x37')]));_0x1e8a0d['attributes']=_0x1e8a0d[_0x87f2('0x36')][_0x87f2('0x38')]?_0x1e8a0d[_0x87f2('0x36')]:_0xf32d2b[_0x87f2('0x35')];if(!_0x1762da[_0x87f2('0x32')][_0x87f2('0x39')](_0x87f2('0x3a'))){_0x1e8a0d[_0x87f2('0x1e')]=qs[_0x87f2('0x1e')](_0x1762da[_0x87f2('0x32')]['limit']);_0x1e8a0d[_0x87f2('0x1c')]=qs[_0x87f2('0x1c')](_0x1762da[_0x87f2('0x32')]['offset']);}_0x1e8a0d[_0x87f2('0x3b')]=qs['sort'](_0x1762da[_0x87f2('0x32')][_0x87f2('0x3c')]);_0x1e8a0d['where']=qs[_0x87f2('0x3d')](_['pick'](_0x1762da[_0x87f2('0x32')],_0xf32d2b['filters']),_0x5c30a5);if(_0x1762da[_0x87f2('0x32')]['filter']){_0x1e8a0d[_0x87f2('0x3e')]=_[_0x87f2('0x3f')](_0x1e8a0d[_0x87f2('0x3e')],{'$or':_[_0x87f2('0x2c')](_0x5c30a5,function(_0x331ee9){if(_0x331ee9[_0x87f2('0x30')]!=='VIRTUAL'){var _0x5756c7={};_0x5756c7[_0x331ee9['name']]={'$like':'%'+_0x1762da[_0x87f2('0x32')][_0x87f2('0x40')]+'%'};return _0x5756c7;}})});}_0x1e8a0d=_['merge']({},_0x1e8a0d,_0x1762da[_0x87f2('0x41')]);var _0x3cc954={'where':_0x1e8a0d[_0x87f2('0x3e')]};return db['MailServerOut'][_0x87f2('0x1f')](_0x3cc954)['then'](function(_0x4c5a86){_0xef93e1[_0x87f2('0x1f')]=_0x4c5a86;if(_0x1762da[_0x87f2('0x32')][_0x87f2('0x42')]){_0x1e8a0d[_0x87f2('0x43')]=[{'all':!![]}];}return db[_0x87f2('0x2d')][_0x87f2('0x44')](_0x1e8a0d);})[_0x87f2('0x25')](function(_0x53e722){_0xef93e1[_0x87f2('0x45')]=_0x53e722;return _0xef93e1;})[_0x87f2('0x25')](respondWithFilteredResult(_0x748ea8,_0x1e8a0d))[_0x87f2('0x46')](handleError(_0x748ea8,null));};exports[_0x87f2('0x47')]=function(_0x167521,_0x22231f){var _0xa0c728={'raw':!![],'where':{'id':_0x167521[_0x87f2('0x48')]['id']}},_0x2d85e4={};_0x2d85e4[_0x87f2('0x35')]=_['keys'](db[_0x87f2('0x2d')]['rawAttributes']);_0x2d85e4[_0x87f2('0x32')]=_[_0x87f2('0x33')](_0x167521[_0x87f2('0x32')]);_0x2d85e4['filters']=_[_0x87f2('0x34')](_0x2d85e4[_0x87f2('0x35')],_0x2d85e4[_0x87f2('0x32')]);_0xa0c728[_0x87f2('0x36')]=_['intersection'](_0x2d85e4[_0x87f2('0x35')],qs[_0x87f2('0x37')](_0x167521['query'][_0x87f2('0x37')]));_0xa0c728[_0x87f2('0x36')]=_0xa0c728['attributes'][_0x87f2('0x38')]?_0xa0c728['attributes']:_0x2d85e4[_0x87f2('0x35')];if(_0x167521['query'][_0x87f2('0x42')]){_0xa0c728['include']=[{'all':!![]}];}_0xa0c728=_[_0x87f2('0x3f')]({},_0xa0c728,_0x167521[_0x87f2('0x41')]);return db[_0x87f2('0x2d')][_0x87f2('0x49')](_0xa0c728)[_0x87f2('0x25')](handleEntityNotFound(_0x22231f,null))[_0x87f2('0x25')](respondWithResult(_0x22231f,null))[_0x87f2('0x46')](handleError(_0x22231f,null));};exports[_0x87f2('0x4a')]=function(_0x45996b,_0x35e92c){return db[_0x87f2('0x2d')][_0x87f2('0x4a')](_0x45996b['body'],{})[_0x87f2('0x25')](respondWithResult(_0x35e92c,0xc9))[_0x87f2('0x46')](handleError(_0x35e92c,null));};exports[_0x87f2('0x4b')]=function(_0x42694f,_0x427196){if(_0x42694f['body']['id']){delete _0x42694f[_0x87f2('0x4c')]['id'];}return db[_0x87f2('0x2d')][_0x87f2('0x49')]({'where':{'id':_0x42694f[_0x87f2('0x48')]['id']}})[_0x87f2('0x25')](handleEntityNotFound(_0x427196,null))[_0x87f2('0x25')](saveUpdates(_0x42694f[_0x87f2('0x4c')],null))[_0x87f2('0x25')](respondWithResult(_0x427196,null))['catch'](handleError(_0x427196,null));};exports[_0x87f2('0x26')]=function(_0x84e669,_0x44f582){return db[_0x87f2('0x2d')][_0x87f2('0x49')]({'where':{'id':_0x84e669[_0x87f2('0x48')]['id']}})[_0x87f2('0x25')](handleEntityNotFound(_0x44f582,null))[_0x87f2('0x25')](removeEntity(_0x44f582,null))[_0x87f2('0x46')](handleError(_0x44f582,null));}; \ No newline at end of file +var _0xc6f7=['error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','VIRTUAL','filter','options','MailServerOut','includeAll','include','findAll','catch','show','params','merge','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','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','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc6f7,0x72));var _0x7c6f=function(_0x24711e,_0x463218){_0x24711e=_0x24711e-0x0;var _0x1e82a5=_0xc6f7[_0x24711e];return _0x1e82a5;};'use strict';var emlformat=require(_0x7c6f('0x0'));var rimraf=require(_0x7c6f('0x1'));var zipdir=require(_0x7c6f('0x2'));var jsonpatch=require(_0x7c6f('0x3'));var rp=require(_0x7c6f('0x4'));var moment=require(_0x7c6f('0x5'));var BPromise=require(_0x7c6f('0x6'));var Mustache=require(_0x7c6f('0x7'));var util=require('util');var path=require(_0x7c6f('0x8'));var sox=require(_0x7c6f('0x9'));var csv=require(_0x7c6f('0xa'));var ejs=require(_0x7c6f('0xb'));var fs=require('fs');var fs_extra=require(_0x7c6f('0xc'));var _=require(_0x7c6f('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7c6f('0xe'));var deskjs=require(_0x7c6f('0xf'));var toCsv=require(_0x7c6f('0xa'));var querystring=require(_0x7c6f('0x10'));var Papa=require(_0x7c6f('0x11'));var Redis=require(_0x7c6f('0x12'));var authService=require(_0x7c6f('0x13'));var qs=require(_0x7c6f('0x14'));var as=require(_0x7c6f('0x15'));var hardwareService=require(_0x7c6f('0x16'));var logger=require(_0x7c6f('0x17'))(_0x7c6f('0x18'));var utils=require(_0x7c6f('0x19'));var config=require(_0x7c6f('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x7c6f('0x1b'))['db'];function respondWithStatusCode(_0xe8c540,_0x5929cb){_0x5929cb=_0x5929cb||0xcc;return function(_0x5c637e){if(_0x5c637e){return _0xe8c540[_0x7c6f('0x1c')](_0x5929cb);}return _0xe8c540[_0x7c6f('0x1d')](_0x5929cb)[_0x7c6f('0x1e')]();};}function respondWithResult(_0x478d1e,_0x5195ee){_0x5195ee=_0x5195ee||0xc8;return function(_0x117a4b){if(_0x117a4b){return _0x478d1e[_0x7c6f('0x1d')](_0x5195ee)[_0x7c6f('0x1f')](_0x117a4b);}};}function respondWithFilteredResult(_0xccd25d,_0x24a377){return function(_0x24a706){if(_0x24a706){var _0x200f6e=typeof _0x24a377[_0x7c6f('0x20')]===_0x7c6f('0x21')&&typeof _0x24a377[_0x7c6f('0x22')]==='undefined';var _0x540a70=_0x24a706['count'];var _0x23d656=_0x200f6e?0x0:_0x24a377[_0x7c6f('0x20')];var _0x599ebb=_0x200f6e?_0x24a706[_0x7c6f('0x23')]:_0x24a377[_0x7c6f('0x20')]+_0x24a377['limit'];var _0x32ce1c;if(_0x599ebb>=_0x540a70){_0x599ebb=_0x540a70;_0x32ce1c=0xc8;}else{_0x32ce1c=0xce;}_0xccd25d[_0x7c6f('0x1d')](_0x32ce1c);return _0xccd25d['set'](_0x7c6f('0x24'),_0x23d656+'-'+_0x599ebb+'/'+_0x540a70)[_0x7c6f('0x1f')](_0x24a706);}return null;};}function patchUpdates(_0x251841){return function(_0x505a85){try{jsonpatch[_0x7c6f('0x25')](_0x505a85,_0x251841,!![]);}catch(_0x1d7a47){return BPromise[_0x7c6f('0x26')](_0x1d7a47);}return _0x505a85['save']();};}function saveUpdates(_0x28e0b6,_0x45c4b3){return function(_0x3fabe3){if(_0x3fabe3){return _0x3fabe3[_0x7c6f('0x27')](_0x28e0b6)[_0x7c6f('0x28')](function(_0x957060){return _0x957060;});}return null;};}function removeEntity(_0x37e90e,_0x24307b){return function(_0x2ccd01){if(_0x2ccd01){return _0x2ccd01[_0x7c6f('0x29')]()[_0x7c6f('0x28')](function(){_0x37e90e[_0x7c6f('0x1d')](0xcc)[_0x7c6f('0x1e')]();});}};}function handleEntityNotFound(_0x2b14e4,_0x12a44e){return function(_0x43582b){if(!_0x43582b){_0x2b14e4[_0x7c6f('0x1c')](0x194);}return _0x43582b;};}function handleError(_0x4ee14d,_0xb0854a){_0xb0854a=_0xb0854a||0x1f4;return function(_0xa39389){logger[_0x7c6f('0x2a')](_0xa39389[_0x7c6f('0x2b')]);if(_0xa39389[_0x7c6f('0x2c')]){delete _0xa39389['name'];}_0x4ee14d[_0x7c6f('0x1d')](_0xb0854a)['send'](_0xa39389);};}exports[_0x7c6f('0x2d')]=function(_0x493ea7,_0x5a5eb1){var _0x2f19ab={},_0x22e3c9={},_0x16747e={'count':0x0,'rows':[]};var _0x368ee1=_[_0x7c6f('0x2e')](db['MailServerOut'][_0x7c6f('0x2f')],function(_0x1e8740){return{'name':_0x1e8740[_0x7c6f('0x30')],'type':_0x1e8740[_0x7c6f('0x31')][_0x7c6f('0x32')]};});_0x22e3c9[_0x7c6f('0x33')]=_[_0x7c6f('0x2e')](_0x368ee1,'name');_0x22e3c9[_0x7c6f('0x34')]=_[_0x7c6f('0x35')](_0x493ea7['query']);_0x22e3c9[_0x7c6f('0x36')]=_[_0x7c6f('0x37')](_0x22e3c9[_0x7c6f('0x33')],_0x22e3c9['query']);_0x2f19ab['attributes']=_[_0x7c6f('0x37')](_0x22e3c9[_0x7c6f('0x33')],qs[_0x7c6f('0x38')](_0x493ea7['query']['fields']));_0x2f19ab[_0x7c6f('0x39')]=_0x2f19ab[_0x7c6f('0x39')][_0x7c6f('0x3a')]?_0x2f19ab['attributes']:_0x22e3c9[_0x7c6f('0x33')];if(!_0x493ea7[_0x7c6f('0x34')]['hasOwnProperty'](_0x7c6f('0x3b'))){_0x2f19ab[_0x7c6f('0x22')]=qs[_0x7c6f('0x22')](_0x493ea7[_0x7c6f('0x34')][_0x7c6f('0x22')]);_0x2f19ab[_0x7c6f('0x20')]=qs['offset'](_0x493ea7['query'][_0x7c6f('0x20')]);}_0x2f19ab[_0x7c6f('0x3c')]=qs[_0x7c6f('0x3d')](_0x493ea7[_0x7c6f('0x34')]['sort']);_0x2f19ab[_0x7c6f('0x3e')]=qs[_0x7c6f('0x36')](_[_0x7c6f('0x3f')](_0x493ea7[_0x7c6f('0x34')],_0x22e3c9[_0x7c6f('0x36')]),_0x368ee1);if(_0x493ea7[_0x7c6f('0x34')]['filter']){_0x2f19ab[_0x7c6f('0x3e')]=_['merge'](_0x2f19ab[_0x7c6f('0x3e')],{'$or':_[_0x7c6f('0x2e')](_0x368ee1,function(_0x54f073){if(_0x54f073[_0x7c6f('0x31')]!==_0x7c6f('0x40')){var _0x1e3b60={};_0x1e3b60[_0x54f073[_0x7c6f('0x2c')]]={'$like':'%'+_0x493ea7[_0x7c6f('0x34')][_0x7c6f('0x41')]+'%'};return _0x1e3b60;}})});}_0x2f19ab=_['merge']({},_0x2f19ab,_0x493ea7[_0x7c6f('0x42')]);var _0x40c5f3={'where':_0x2f19ab[_0x7c6f('0x3e')]};return db[_0x7c6f('0x43')][_0x7c6f('0x23')](_0x40c5f3)['then'](function(_0x2611d4){_0x16747e[_0x7c6f('0x23')]=_0x2611d4;if(_0x493ea7[_0x7c6f('0x34')][_0x7c6f('0x44')]){_0x2f19ab[_0x7c6f('0x45')]=[{'all':!![]}];}return db[_0x7c6f('0x43')][_0x7c6f('0x46')](_0x2f19ab);})['then'](function(_0x290cf1){_0x16747e['rows']=_0x290cf1;return _0x16747e;})[_0x7c6f('0x28')](respondWithFilteredResult(_0x5a5eb1,_0x2f19ab))[_0x7c6f('0x47')](handleError(_0x5a5eb1,null));};exports[_0x7c6f('0x48')]=function(_0x28fd03,_0x5b10b1){var _0x23ed0d={'raw':!![],'where':{'id':_0x28fd03[_0x7c6f('0x49')]['id']}},_0x5bca61={};_0x5bca61[_0x7c6f('0x33')]=_[_0x7c6f('0x35')](db[_0x7c6f('0x43')][_0x7c6f('0x2f')]);_0x5bca61[_0x7c6f('0x34')]=_['keys'](_0x28fd03[_0x7c6f('0x34')]);_0x5bca61[_0x7c6f('0x36')]=_['intersection'](_0x5bca61[_0x7c6f('0x33')],_0x5bca61[_0x7c6f('0x34')]);_0x23ed0d[_0x7c6f('0x39')]=_['intersection'](_0x5bca61[_0x7c6f('0x33')],qs['fields'](_0x28fd03[_0x7c6f('0x34')][_0x7c6f('0x38')]));_0x23ed0d[_0x7c6f('0x39')]=_0x23ed0d[_0x7c6f('0x39')][_0x7c6f('0x3a')]?_0x23ed0d['attributes']:_0x5bca61[_0x7c6f('0x33')];if(_0x28fd03[_0x7c6f('0x34')]['includeAll']){_0x23ed0d[_0x7c6f('0x45')]=[{'all':!![]}];}_0x23ed0d=_[_0x7c6f('0x4a')]({},_0x23ed0d,_0x28fd03[_0x7c6f('0x42')]);return db[_0x7c6f('0x43')][_0x7c6f('0x4b')](_0x23ed0d)[_0x7c6f('0x28')](handleEntityNotFound(_0x5b10b1,null))['then'](respondWithResult(_0x5b10b1,null))[_0x7c6f('0x47')](handleError(_0x5b10b1,null));};exports[_0x7c6f('0x4c')]=function(_0x196ff8,_0x582e30){return db[_0x7c6f('0x43')][_0x7c6f('0x4c')](_0x196ff8['body'],{})[_0x7c6f('0x28')](respondWithResult(_0x582e30,0xc9))[_0x7c6f('0x47')](handleError(_0x582e30,null));};exports[_0x7c6f('0x27')]=function(_0xe05bf2,_0x3dfeca){if(_0xe05bf2[_0x7c6f('0x4d')]['id']){delete _0xe05bf2[_0x7c6f('0x4d')]['id'];}return db[_0x7c6f('0x43')][_0x7c6f('0x4b')]({'where':{'id':_0xe05bf2[_0x7c6f('0x49')]['id']}})[_0x7c6f('0x28')](handleEntityNotFound(_0x3dfeca,null))['then'](saveUpdates(_0xe05bf2['body'],null))[_0x7c6f('0x28')](respondWithResult(_0x3dfeca,null))[_0x7c6f('0x47')](handleError(_0x3dfeca,null));};exports['destroy']=function(_0x1c5e2b,_0x554329){return db['MailServerOut'][_0x7c6f('0x4b')]({'where':{'id':_0x1c5e2b[_0x7c6f('0x49')]['id']}})[_0x7c6f('0x28')](handleEntityNotFound(_0x554329,null))[_0x7c6f('0x28')](removeEntity(_0x554329,null))[_0x7c6f('0x47')](handleError(_0x554329,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index a21bb38..beb4453 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 _0xaa5a=['lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./mailServerOut.attributes','exports','define'];(function(_0x300f9c,_0x59ccd4){var _0x72ca5=function(_0x3a9bc5){while(--_0x3a9bc5){_0x300f9c['push'](_0x300f9c['shift']());}};_0x72ca5(++_0x59ccd4);}(_0xaa5a,0xe7));var _0xaaa5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xaa5a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xaaa5('0x0'));var util=require(_0xaaa5('0x1'));var logger=require(_0xaaa5('0x2'))(_0xaaa5('0x3'));var moment=require(_0xaaa5('0x4'));var BPromise=require('bluebird');var rp=require(_0xaaa5('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xaaa5('0x6'));var config=require(_0xaaa5('0x7'));var attributes=require(_0xaaa5('0x8'));module[_0xaaa5('0x9')]=function(_0x474f88,_0x1454fd){return _0x474f88[_0xaaa5('0xa')]('MailServerOut',attributes,{'tableName':'mail_servers_out','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd752=['./mailServerOut.attributes','exports','define','MailServerOut','mail_servers_out','lodash','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xd752,0x191));var _0x2d75=function(_0x52c538,_0x48f45a){_0x52c538=_0x52c538-0x0;var _0x33cb72=_0xd752[_0x52c538];return _0x33cb72;};'use strict';var _=require(_0x2d75('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x2d75('0x1'));var moment=require('moment');var BPromise=require(_0x2d75('0x2'));var rp=require(_0x2d75('0x3'));var fs=require('fs');var path=require(_0x2d75('0x4'));var rimraf=require(_0x2d75('0x5'));var config=require(_0x2d75('0x6'));var attributes=require(_0x2d75('0x7'));module[_0x2d75('0x8')]=function(_0x46ae10,_0x326ce2){return _0x46ae10[_0x2d75('0x9')](_0x2d75('0xa'),attributes,{'tableName':_0x2d75('0xb'),'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 d489188..e1a8a16 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 _0xdb28=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util'];(function(_0x520a99,_0x3780ca){var _0x103611=function(_0x1462fd){while(--_0x1462fd){_0x520a99['push'](_0x520a99['shift']());}};_0x103611(++_0x3780ca);}(_0xdb28,0x106));var _0x8db2=function(_0x382772,_0xac978c){_0x382772=_0x382772-0x0;var _0x1689b1=_0xdb28[_0x382772];return _0x1689b1;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494b40,_0x477f50,_0x46932f){return new BPromise(function(_0x131537,_0x29f698){return client[_0x8db2('0xb')](_0x494b40,_0x46932f)[_0x8db2('0xc')](function(_0x126c78){logger['info'](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));logger[_0x8db2('0xf')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});} \ No newline at end of file +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(_0x278809,_0x2acb3b){var _0x1b1e75=function(_0x374430){while(--_0x374430){_0x278809['push'](_0x278809['shift']());}};_0x1b1e75(++_0x2acb3b);}(_0xc4aa,0x1b7));var _0xac4a=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0xc4aa[_0xaa1b3e];return _0x454d7d;};'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 fb94fd9..41a1107 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 _0x63f1=['show','post','put','/:id','delete','destroy','exports','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailSubstatus.controller','isAuthenticated','get','describe'];(function(_0xd193c2,_0x48669b){var _0x1e2a64=function(_0x547c72){while(--_0x547c72){_0xd193c2['push'](_0xd193c2['shift']());}};_0x1e2a64(++_0x48669b);}(_0x63f1,0x106));var _0x163f=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x63f1[_0x27af45];return _0x18df21;};'use strict';var multer=require('multer');var util=require(_0x163f('0x0'));var path=require(_0x163f('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x163f('0x2')]();var fs_extra=require(_0x163f('0x3'));var auth=require(_0x163f('0x4'));var interaction=require(_0x163f('0x5'));var config=require('../../config/environment');var controller=require(_0x163f('0x6'));router['get']('/',auth[_0x163f('0x7')](),controller['index']);router[_0x163f('0x8')]('/describe',auth[_0x163f('0x7')](),controller[_0x163f('0x9')]);router['get']('/:id',auth[_0x163f('0x7')](),controller[_0x163f('0xa')]);router[_0x163f('0xb')]('/',auth[_0x163f('0x7')](),controller['create']);router[_0x163f('0xc')](_0x163f('0xd'),auth[_0x163f('0x7')](),controller['update']);router[_0x163f('0xe')](_0x163f('0xd'),auth['isAuthenticated'](),controller[_0x163f('0xf')]);module[_0x163f('0x10')]=router; \ No newline at end of file +var _0xd4ca=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','index','isAuthenticated','/:id','show','post','create','update','delete','destroy','exports'];(function(_0x50337b,_0x35a8ee){var _0x53d607=function(_0x1c0451){while(--_0x1c0451){_0x50337b['push'](_0x50337b['shift']());}};_0x53d607(++_0x35a8ee);}(_0xd4ca,0x78));var _0xad4c=function(_0x519e56,_0xe2cc6b){_0x519e56=_0x519e56-0x0;var _0xd205ad=_0xd4ca[_0x519e56];return _0xd205ad;};'use strict';var multer=require('multer');var util=require(_0xad4c('0x0'));var path=require(_0xad4c('0x1'));var timeout=require(_0xad4c('0x2'));var express=require(_0xad4c('0x3'));var router=express[_0xad4c('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xad4c('0x5'));var interaction=require(_0xad4c('0x6'));var config=require(_0xad4c('0x7'));var controller=require(_0xad4c('0x8'));router[_0xad4c('0x9')]('/',auth['isAuthenticated'](),controller[_0xad4c('0xa')]);router[_0xad4c('0x9')]('/describe',auth[_0xad4c('0xb')](),controller['describe']);router['get'](_0xad4c('0xc'),auth[_0xad4c('0xb')](),controller[_0xad4c('0xd')]);router[_0xad4c('0xe')]('/',auth['isAuthenticated'](),controller[_0xad4c('0xf')]);router['put'](_0xad4c('0xc'),auth['isAuthenticated'](),controller[_0xad4c('0x10')]);router[_0xad4c('0x11')]('/:id',auth[_0xad4c('0xb')](),controller[_0xad4c('0x12')]);module[_0xad4c('0x13')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 8571709..be14daa 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 _0x02a7=['exports','STRING'];(function(_0x438912,_0x3f7f74){var _0x18112f=function(_0x1b8ac9){while(--_0x1b8ac9){_0x438912['push'](_0x438912['shift']());}};_0x18112f(++_0x3f7f74);}(_0x02a7,0x7a));var _0x702a=function(_0x166f66,_0x1e9f39){_0x166f66=_0x166f66-0x0;var _0x5294cd=_0x02a7[_0x166f66];return _0x5294cd;};'use strict';var Sequelize=require('sequelize');module[_0x702a('0x0')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x702a('0x1')]}}; \ No newline at end of file +var _0x1db9=['STRING','name','sequelize','exports'];(function(_0x26dc7f,_0x3d6977){var _0x44c839=function(_0x453b8e){while(--_0x453b8e){_0x26dc7f['push'](_0x26dc7f['shift']());}};_0x44c839(++_0x3d6977);}(_0x1db9,0x176));var _0x91db=function(_0x4068e3,_0x288776){_0x4068e3=_0x4068e3-0x0;var _0x208071=_0x1db9[_0x4068e3];return _0x208071;};'use strict';var Sequelize=require(_0x91db('0x0'));module[_0x91db('0x1')]={'name':{'type':Sequelize[_0x91db('0x2')],'unique':_0x91db('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x91db('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 0543117..356d8a7 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 _0x8690=['describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','json','limit','undefined','count','offset','status','set','Content-Range','apply','reject','update','destroy','then','sendStatus','stack','index','map','rawAttributes','fieldName','type','key','model','name','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','MailSubstatus','create','body','find'];(function(_0x353471,_0x19f123){var _0x584806=function(_0x3c8352){while(--_0x3c8352){_0x353471['push'](_0x353471['shift']());}};_0x584806(++_0x19f123);}(_0x8690,0x191));var _0x0869=function(_0xba96b0,_0x36e8f8){_0xba96b0=_0xba96b0-0x0;var _0xdad969=_0x8690[_0xba96b0];return _0xdad969;};'use strict';var emlformat=require(_0x0869('0x0'));var rimraf=require(_0x0869('0x1'));var zipdir=require(_0x0869('0x2'));var jsonpatch=require(_0x0869('0x3'));var rp=require(_0x0869('0x4'));var moment=require(_0x0869('0x5'));var BPromise=require(_0x0869('0x6'));var Mustache=require(_0x0869('0x7'));var util=require(_0x0869('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x0869('0x9'));var ejs=require(_0x0869('0xa'));var fs=require('fs');var fs_extra=require(_0x0869('0xb'));var _=require(_0x0869('0xc'));var squel=require('squel');var crypto=require(_0x0869('0xd'));var jsforce=require(_0x0869('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x0869('0x9'));var querystring=require(_0x0869('0xf'));var Papa=require(_0x0869('0x10'));var Redis=require(_0x0869('0x11'));var authService=require(_0x0869('0x12'));var qs=require(_0x0869('0x13'));var as=require(_0x0869('0x14'));var hardwareService=require(_0x0869('0x15'));var logger=require(_0x0869('0x16'))(_0x0869('0x17'));var utils=require(_0x0869('0x18'));var config=require(_0x0869('0x19'));var licenseUtil=require(_0x0869('0x1a'));var db=require(_0x0869('0x1b'))['db'];function respondWithStatusCode(_0x22d1a4,_0x8b0e0a){_0x8b0e0a=_0x8b0e0a||0xcc;return function(_0x2f8876){if(_0x2f8876){return _0x22d1a4['sendStatus'](_0x8b0e0a);}return _0x22d1a4['status'](_0x8b0e0a)[_0x0869('0x1c')]();};}function respondWithResult(_0x34852c,_0x36d36c){_0x36d36c=_0x36d36c||0xc8;return function(_0x25e588){if(_0x25e588){return _0x34852c['status'](_0x36d36c)[_0x0869('0x1d')](_0x25e588);}};}function respondWithFilteredResult(_0x17a10b,_0x5767eb){return function(_0x50917d){if(_0x50917d){var _0x181962=typeof _0x5767eb['offset']==='undefined'&&typeof _0x5767eb[_0x0869('0x1e')]===_0x0869('0x1f');var _0x4346bd=_0x50917d[_0x0869('0x20')];var _0x5c09ed=_0x181962?0x0:_0x5767eb[_0x0869('0x21')];var _0x4a03e7=_0x181962?_0x50917d['count']:_0x5767eb['offset']+_0x5767eb[_0x0869('0x1e')];var _0x4f455f;if(_0x4a03e7>=_0x4346bd){_0x4a03e7=_0x4346bd;_0x4f455f=0xc8;}else{_0x4f455f=0xce;}_0x17a10b[_0x0869('0x22')](_0x4f455f);return _0x17a10b[_0x0869('0x23')](_0x0869('0x24'),_0x5c09ed+'-'+_0x4a03e7+'/'+_0x4346bd)[_0x0869('0x1d')](_0x50917d);}return null;};}function patchUpdates(_0x5c5c1c){return function(_0x563164){try{jsonpatch[_0x0869('0x25')](_0x563164,_0x5c5c1c,!![]);}catch(_0x24e8fd){return BPromise[_0x0869('0x26')](_0x24e8fd);}return _0x563164['save']();};}function saveUpdates(_0x574611,_0xb10f52){return function(_0x116855){if(_0x116855){return _0x116855[_0x0869('0x27')](_0x574611)['then'](function(_0x5aabb3){return _0x5aabb3;});}return null;};}function removeEntity(_0x28b973,_0x3921c6){return function(_0x473575){if(_0x473575){return _0x473575[_0x0869('0x28')]()[_0x0869('0x29')](function(){_0x28b973[_0x0869('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x44c25c,_0x4e303d){return function(_0x5117c8){if(!_0x5117c8){_0x44c25c[_0x0869('0x2a')](0x194);}return _0x5117c8;};}function handleError(_0x2b10e2,_0xdd4781){_0xdd4781=_0xdd4781||0x1f4;return function(_0x9c9aaf){logger['error'](_0x9c9aaf[_0x0869('0x2b')]);if(_0x9c9aaf['name']){delete _0x9c9aaf['name'];}_0x2b10e2['status'](_0xdd4781)['send'](_0x9c9aaf);};}exports[_0x0869('0x2c')]=function(_0x3bfee1,_0xee08b7){var _0x3be3c9={},_0xe070b6={},_0x4307dc={'count':0x0,'rows':[]};var _0x1c8842=_[_0x0869('0x2d')](db['MailSubstatus'][_0x0869('0x2e')],function(_0x296532){return{'name':_0x296532[_0x0869('0x2f')],'type':_0x296532[_0x0869('0x30')][_0x0869('0x31')]};});_0xe070b6[_0x0869('0x32')]=_[_0x0869('0x2d')](_0x1c8842,_0x0869('0x33'));_0xe070b6[_0x0869('0x34')]=_[_0x0869('0x35')](_0x3bfee1['query']);_0xe070b6[_0x0869('0x36')]=_['intersection'](_0xe070b6['model'],_0xe070b6[_0x0869('0x34')]);_0x3be3c9[_0x0869('0x37')]=_[_0x0869('0x38')](_0xe070b6[_0x0869('0x32')],qs[_0x0869('0x39')](_0x3bfee1[_0x0869('0x34')][_0x0869('0x39')]));_0x3be3c9[_0x0869('0x37')]=_0x3be3c9['attributes'][_0x0869('0x3a')]?_0x3be3c9[_0x0869('0x37')]:_0xe070b6[_0x0869('0x32')];if(!_0x3bfee1[_0x0869('0x34')][_0x0869('0x3b')](_0x0869('0x3c'))){_0x3be3c9[_0x0869('0x1e')]=qs[_0x0869('0x1e')](_0x3bfee1[_0x0869('0x34')][_0x0869('0x1e')]);_0x3be3c9[_0x0869('0x21')]=qs['offset'](_0x3bfee1[_0x0869('0x34')][_0x0869('0x21')]);}_0x3be3c9['order']=qs[_0x0869('0x3d')](_0x3bfee1[_0x0869('0x34')]['sort']);_0x3be3c9['where']=qs['filters'](_[_0x0869('0x3e')](_0x3bfee1[_0x0869('0x34')],_0xe070b6[_0x0869('0x36')]),_0x1c8842);if(_0x3bfee1[_0x0869('0x34')][_0x0869('0x3f')]){_0x3be3c9[_0x0869('0x40')]=_[_0x0869('0x41')](_0x3be3c9['where'],{'$or':_['map'](_0x1c8842,function(_0x1836b9){if(_0x1836b9['type']!==_0x0869('0x42')){var _0x5aa8d6={};_0x5aa8d6[_0x1836b9[_0x0869('0x33')]]={'$like':'%'+_0x3bfee1[_0x0869('0x34')][_0x0869('0x3f')]+'%'};return _0x5aa8d6;}})});}_0x3be3c9=_[_0x0869('0x41')]({},_0x3be3c9,_0x3bfee1[_0x0869('0x43')]);var _0x16df64={'where':_0x3be3c9[_0x0869('0x40')]};return db['MailSubstatus'][_0x0869('0x20')](_0x16df64)['then'](function(_0x1c0017){_0x4307dc[_0x0869('0x20')]=_0x1c0017;if(_0x3bfee1[_0x0869('0x34')][_0x0869('0x44')]){_0x3be3c9[_0x0869('0x45')]=[{'all':!![]}];}return db['MailSubstatus'][_0x0869('0x46')](_0x3be3c9);})[_0x0869('0x29')](function(_0x426d85){_0x4307dc[_0x0869('0x47')]=_0x426d85;return _0x4307dc;})['then'](respondWithFilteredResult(_0xee08b7,_0x3be3c9))[_0x0869('0x48')](handleError(_0xee08b7,null));};exports[_0x0869('0x49')]=function(_0x27bf52,_0x11e5e6){var _0x33f4aa={'raw':!![],'where':{'id':_0x27bf52[_0x0869('0x4a')]['id']}},_0x17a8d4={};_0x17a8d4['model']=_['keys'](db[_0x0869('0x4b')][_0x0869('0x2e')]);_0x17a8d4[_0x0869('0x34')]=_[_0x0869('0x35')](_0x27bf52[_0x0869('0x34')]);_0x17a8d4[_0x0869('0x36')]=_[_0x0869('0x38')](_0x17a8d4['model'],_0x17a8d4['query']);_0x33f4aa[_0x0869('0x37')]=_['intersection'](_0x17a8d4['model'],qs[_0x0869('0x39')](_0x27bf52[_0x0869('0x34')][_0x0869('0x39')]));_0x33f4aa[_0x0869('0x37')]=_0x33f4aa['attributes'][_0x0869('0x3a')]?_0x33f4aa[_0x0869('0x37')]:_0x17a8d4['model'];if(_0x27bf52['query']['includeAll']){_0x33f4aa[_0x0869('0x45')]=[{'all':!![]}];}_0x33f4aa=_[_0x0869('0x41')]({},_0x33f4aa,_0x27bf52[_0x0869('0x43')]);return db[_0x0869('0x4b')]['find'](_0x33f4aa)[_0x0869('0x29')](handleEntityNotFound(_0x11e5e6,null))[_0x0869('0x29')](respondWithResult(_0x11e5e6,null))[_0x0869('0x48')](handleError(_0x11e5e6,null));};exports['create']=function(_0x50c3d7,_0x4f3fb6){return db[_0x0869('0x4b')][_0x0869('0x4c')](_0x50c3d7[_0x0869('0x4d')],{})['then'](respondWithResult(_0x4f3fb6,0xc9))[_0x0869('0x48')](handleError(_0x4f3fb6,null));};exports[_0x0869('0x27')]=function(_0xf50093,_0x30b82f){if(_0xf50093[_0x0869('0x4d')]['id']){delete _0xf50093[_0x0869('0x4d')]['id'];}return db['MailSubstatus'][_0x0869('0x4e')]({'where':{'id':_0xf50093[_0x0869('0x4a')]['id']}})[_0x0869('0x29')](handleEntityNotFound(_0x30b82f,null))[_0x0869('0x29')](saveUpdates(_0xf50093[_0x0869('0x4d')],null))[_0x0869('0x29')](respondWithResult(_0x30b82f,null))[_0x0869('0x48')](handleError(_0x30b82f,null));};exports[_0x0869('0x28')]=function(_0x21f3d5,_0x5d7e29){return db['MailSubstatus'][_0x0869('0x4e')]({'where':{'id':_0x21f3d5[_0x0869('0x4a')]['id']}})[_0x0869('0x29')](handleEntityNotFound(_0x5d7e29,null))[_0x0869('0x29')](removeEntity(_0x5d7e29,null))[_0x0869('0x48')](handleError(_0x5d7e29,null));};exports[_0x0869('0x4f')]=function(_0x310528,_0x3d5961){return db['MailSubstatus'][_0x0869('0x4f')]()[_0x0869('0x29')](respondWithResult(_0x3d5961,null))[_0x0869('0x48')](handleError(_0x3d5961,null));}; \ No newline at end of file +var _0xccd3=['bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','apply','save','update','then','destroy','stack','name','index','map','MailSubstatus','rawAttributes','fieldName','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','describe','rimraf','fast-json-patch','request-promise'];(function(_0x544baa,_0x1b17fe){var _0x5e8cc1=function(_0x1b55dc){while(--_0x1b55dc){_0x544baa['push'](_0x544baa['shift']());}};_0x5e8cc1(++_0x1b17fe);}(_0xccd3,0xd5));var _0x3ccd=function(_0x1d0fe1,_0x452dbb){_0x1d0fe1=_0x1d0fe1-0x0;var _0x228558=_0xccd3[_0x1d0fe1];return _0x228558;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3ccd('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3ccd('0x1'));var rp=require(_0x3ccd('0x2'));var moment=require('moment');var BPromise=require(_0x3ccd('0x3'));var Mustache=require(_0x3ccd('0x4'));var util=require('util');var path=require('path');var sox=require(_0x3ccd('0x5'));var csv=require(_0x3ccd('0x6'));var ejs=require(_0x3ccd('0x7'));var fs=require('fs');var fs_extra=require(_0x3ccd('0x8'));var _=require(_0x3ccd('0x9'));var squel=require(_0x3ccd('0xa'));var crypto=require(_0x3ccd('0xb'));var jsforce=require(_0x3ccd('0xc'));var deskjs=require(_0x3ccd('0xd'));var toCsv=require(_0x3ccd('0x6'));var querystring=require('querystring');var Papa=require(_0x3ccd('0xe'));var Redis=require(_0x3ccd('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x3ccd('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3ccd('0x11'));var logger=require(_0x3ccd('0x12'))(_0x3ccd('0x13'));var utils=require(_0x3ccd('0x14'));var config=require(_0x3ccd('0x15'));var licenseUtil=require(_0x3ccd('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a49af,_0x30cb30){_0x30cb30=_0x30cb30||0xcc;return function(_0x2212b8){if(_0x2212b8){return _0x1a49af[_0x3ccd('0x17')](_0x30cb30);}return _0x1a49af[_0x3ccd('0x18')](_0x30cb30)[_0x3ccd('0x19')]();};}function respondWithResult(_0x37410d,_0x5bf30d){_0x5bf30d=_0x5bf30d||0xc8;return function(_0x225ab0){if(_0x225ab0){return _0x37410d['status'](_0x5bf30d)[_0x3ccd('0x1a')](_0x225ab0);}};}function respondWithFilteredResult(_0x4ed9b9,_0x457b30){return function(_0x2e4dba){if(_0x2e4dba){var _0x1f83df=typeof _0x457b30[_0x3ccd('0x1b')]===_0x3ccd('0x1c')&&typeof _0x457b30['limit']===_0x3ccd('0x1c');var _0x555d75=_0x2e4dba[_0x3ccd('0x1d')];var _0x1272f4=_0x1f83df?0x0:_0x457b30[_0x3ccd('0x1b')];var _0x1ae206=_0x1f83df?_0x2e4dba[_0x3ccd('0x1d')]:_0x457b30[_0x3ccd('0x1b')]+_0x457b30['limit'];var _0x1a37d5;if(_0x1ae206>=_0x555d75){_0x1ae206=_0x555d75;_0x1a37d5=0xc8;}else{_0x1a37d5=0xce;}_0x4ed9b9[_0x3ccd('0x18')](_0x1a37d5);return _0x4ed9b9['set']('Content-Range',_0x1272f4+'-'+_0x1ae206+'/'+_0x555d75)[_0x3ccd('0x1a')](_0x2e4dba);}return null;};}function patchUpdates(_0xf84932){return function(_0x111ac0){try{jsonpatch[_0x3ccd('0x1e')](_0x111ac0,_0xf84932,!![]);}catch(_0x34dbba){return BPromise['reject'](_0x34dbba);}return _0x111ac0[_0x3ccd('0x1f')]();};}function saveUpdates(_0x78d739,_0xf7cdf4){return function(_0x50f579){if(_0x50f579){return _0x50f579[_0x3ccd('0x20')](_0x78d739)[_0x3ccd('0x21')](function(_0xa0488e){return _0xa0488e;});}return null;};}function removeEntity(_0x46ed7c,_0x240748){return function(_0x5ea626){if(_0x5ea626){return _0x5ea626[_0x3ccd('0x22')]()['then'](function(){_0x46ed7c[_0x3ccd('0x18')](0xcc)[_0x3ccd('0x19')]();});}};}function handleEntityNotFound(_0x4c3bfd,_0x3e7763){return function(_0x3b1fd9){if(!_0x3b1fd9){_0x4c3bfd[_0x3ccd('0x17')](0x194);}return _0x3b1fd9;};}function handleError(_0x3558b8,_0x294b5e){_0x294b5e=_0x294b5e||0x1f4;return function(_0x23ef12){logger['error'](_0x23ef12[_0x3ccd('0x23')]);if(_0x23ef12[_0x3ccd('0x24')]){delete _0x23ef12['name'];}_0x3558b8[_0x3ccd('0x18')](_0x294b5e)['send'](_0x23ef12);};}exports[_0x3ccd('0x25')]=function(_0x55fd0f,_0x2a9e24){var _0x388747={},_0x5d23f9={},_0x313df9={'count':0x0,'rows':[]};var _0x8eff11=_[_0x3ccd('0x26')](db[_0x3ccd('0x27')][_0x3ccd('0x28')],function(_0x2614ba){return{'name':_0x2614ba[_0x3ccd('0x29')],'type':_0x2614ba['type'][_0x3ccd('0x2a')]};});_0x5d23f9[_0x3ccd('0x2b')]=_[_0x3ccd('0x26')](_0x8eff11,_0x3ccd('0x24'));_0x5d23f9['query']=_[_0x3ccd('0x2c')](_0x55fd0f[_0x3ccd('0x2d')]);_0x5d23f9[_0x3ccd('0x2e')]=_['intersection'](_0x5d23f9[_0x3ccd('0x2b')],_0x5d23f9['query']);_0x388747['attributes']=_[_0x3ccd('0x2f')](_0x5d23f9[_0x3ccd('0x2b')],qs[_0x3ccd('0x30')](_0x55fd0f[_0x3ccd('0x2d')][_0x3ccd('0x30')]));_0x388747[_0x3ccd('0x31')]=_0x388747['attributes'][_0x3ccd('0x32')]?_0x388747['attributes']:_0x5d23f9[_0x3ccd('0x2b')];if(!_0x55fd0f[_0x3ccd('0x2d')][_0x3ccd('0x33')](_0x3ccd('0x34'))){_0x388747[_0x3ccd('0x35')]=qs['limit'](_0x55fd0f[_0x3ccd('0x2d')]['limit']);_0x388747[_0x3ccd('0x1b')]=qs['offset'](_0x55fd0f['query'][_0x3ccd('0x1b')]);}_0x388747[_0x3ccd('0x36')]=qs['sort'](_0x55fd0f[_0x3ccd('0x2d')]['sort']);_0x388747[_0x3ccd('0x37')]=qs[_0x3ccd('0x2e')](_[_0x3ccd('0x38')](_0x55fd0f[_0x3ccd('0x2d')],_0x5d23f9[_0x3ccd('0x2e')]),_0x8eff11);if(_0x55fd0f[_0x3ccd('0x2d')][_0x3ccd('0x39')]){_0x388747['where']=_[_0x3ccd('0x3a')](_0x388747['where'],{'$or':_[_0x3ccd('0x26')](_0x8eff11,function(_0x34e065){if(_0x34e065[_0x3ccd('0x3b')]!==_0x3ccd('0x3c')){var _0x11a963={};_0x11a963[_0x34e065['name']]={'$like':'%'+_0x55fd0f['query'][_0x3ccd('0x39')]+'%'};return _0x11a963;}})});}_0x388747=_[_0x3ccd('0x3a')]({},_0x388747,_0x55fd0f[_0x3ccd('0x3d')]);var _0x4d7e74={'where':_0x388747[_0x3ccd('0x37')]};return db[_0x3ccd('0x27')][_0x3ccd('0x1d')](_0x4d7e74)[_0x3ccd('0x21')](function(_0x285004){_0x313df9[_0x3ccd('0x1d')]=_0x285004;if(_0x55fd0f[_0x3ccd('0x2d')][_0x3ccd('0x3e')]){_0x388747[_0x3ccd('0x3f')]=[{'all':!![]}];}return db['MailSubstatus']['findAll'](_0x388747);})[_0x3ccd('0x21')](function(_0x2dc9eb){_0x313df9[_0x3ccd('0x40')]=_0x2dc9eb;return _0x313df9;})['then'](respondWithFilteredResult(_0x2a9e24,_0x388747))[_0x3ccd('0x41')](handleError(_0x2a9e24,null));};exports[_0x3ccd('0x42')]=function(_0xa8c34e,_0x54be87){var _0x3344ce={'raw':!![],'where':{'id':_0xa8c34e[_0x3ccd('0x43')]['id']}},_0x3d68ae={};_0x3d68ae[_0x3ccd('0x2b')]=_[_0x3ccd('0x2c')](db[_0x3ccd('0x27')][_0x3ccd('0x28')]);_0x3d68ae[_0x3ccd('0x2d')]=_[_0x3ccd('0x2c')](_0xa8c34e[_0x3ccd('0x2d')]);_0x3d68ae['filters']=_[_0x3ccd('0x2f')](_0x3d68ae['model'],_0x3d68ae[_0x3ccd('0x2d')]);_0x3344ce[_0x3ccd('0x31')]=_[_0x3ccd('0x2f')](_0x3d68ae[_0x3ccd('0x2b')],qs[_0x3ccd('0x30')](_0xa8c34e[_0x3ccd('0x2d')][_0x3ccd('0x30')]));_0x3344ce[_0x3ccd('0x31')]=_0x3344ce[_0x3ccd('0x31')][_0x3ccd('0x32')]?_0x3344ce[_0x3ccd('0x31')]:_0x3d68ae['model'];if(_0xa8c34e[_0x3ccd('0x2d')][_0x3ccd('0x3e')]){_0x3344ce['include']=[{'all':!![]}];}_0x3344ce=_[_0x3ccd('0x3a')]({},_0x3344ce,_0xa8c34e[_0x3ccd('0x3d')]);return db[_0x3ccd('0x27')][_0x3ccd('0x44')](_0x3344ce)[_0x3ccd('0x21')](handleEntityNotFound(_0x54be87,null))[_0x3ccd('0x21')](respondWithResult(_0x54be87,null))[_0x3ccd('0x41')](handleError(_0x54be87,null));};exports['create']=function(_0x5d18ee,_0x400292){return db['MailSubstatus'][_0x3ccd('0x45')](_0x5d18ee['body'],{})['then'](respondWithResult(_0x400292,0xc9))[_0x3ccd('0x41')](handleError(_0x400292,null));};exports[_0x3ccd('0x20')]=function(_0x3f827f,_0x5ef7da){if(_0x3f827f['body']['id']){delete _0x3f827f[_0x3ccd('0x46')]['id'];}return db[_0x3ccd('0x27')][_0x3ccd('0x44')]({'where':{'id':_0x3f827f['params']['id']}})[_0x3ccd('0x21')](handleEntityNotFound(_0x5ef7da,null))[_0x3ccd('0x21')](saveUpdates(_0x3f827f['body'],null))[_0x3ccd('0x21')](respondWithResult(_0x5ef7da,null))['catch'](handleError(_0x5ef7da,null));};exports[_0x3ccd('0x22')]=function(_0x46928b,_0x27ae19){return db[_0x3ccd('0x27')]['find']({'where':{'id':_0x46928b[_0x3ccd('0x43')]['id']}})['then'](handleEntityNotFound(_0x27ae19,null))[_0x3ccd('0x21')](removeEntity(_0x27ae19,null))['catch'](handleError(_0x27ae19,null));};exports[_0x3ccd('0x47')]=function(_0x3a573e,_0x1c903f){return db[_0x3ccd('0x27')][_0x3ccd('0x47')]()[_0x3ccd('0x21')](respondWithResult(_0x1c903f,null))[_0x3ccd('0x41')](handleError(_0x1c903f,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index f513849..c8dc2a5 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 _0x4be1=['events','MailSubstatus','setMaxListeners','update','emit','hasOwnProperty','hook','exports'];(function(_0x50f6e5,_0x151ccb){var _0x5988c5=function(_0x490a93){while(--_0x490a93){_0x50f6e5['push'](_0x50f6e5['shift']());}};_0x5988c5(++_0x151ccb);}(_0x4be1,0x130));var _0x14be=function(_0x582274,_0x2cbd9c){_0x582274=_0x582274-0x0;var _0x8f14d3=_0x4be1[_0x582274];return _0x8f14d3;};'use strict';var EventEmitter=require(_0x14be('0x0'));var MailSubstatus=require('../../mysqldb')['db'][_0x14be('0x1')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x14be('0x2')](0x0);var events={'afterUpdate':_0x14be('0x3')};function emitEvent(_0x3da3ef){return function(_0x58a46f,_0x518196,_0xd9661c){MailSubstatusEvents[_0x14be('0x4')](_0x3da3ef+':'+_0x58a46f['id'],_0x58a46f);MailSubstatusEvents[_0x14be('0x4')](_0x3da3ef,_0x58a46f);_0xd9661c(null);};}for(var e in events){if(events[_0x14be('0x5')](e)){var event=events[e];MailSubstatus[_0x14be('0x6')](e,emitEvent(event));}}module[_0x14be('0x7')]=MailSubstatusEvents; \ No newline at end of file +var _0x6a60=['../../mysqldb','MailSubstatus','setMaxListeners','update','emit','exports'];(function(_0x3fad94,_0x48b5ce){var _0x18f2f7=function(_0xfef13){while(--_0xfef13){_0x3fad94['push'](_0x3fad94['shift']());}};_0x18f2f7(++_0x48b5ce);}(_0x6a60,0x16e));var _0x06a6=function(_0x3ddfd5,_0x2183d9){_0x3ddfd5=_0x3ddfd5-0x0;var _0xdeae69=_0x6a60[_0x3ddfd5];return _0xdeae69;};'use strict';var EventEmitter=require('events');var MailSubstatus=require(_0x06a6('0x0'))['db'][_0x06a6('0x1')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x06a6('0x2')](0x0);var events={'afterUpdate':_0x06a6('0x3')};function emitEvent(_0x3c4c8a){return function(_0xb845bc,_0x35a957,_0x446724){MailSubstatusEvents[_0x06a6('0x4')](_0x3c4c8a+':'+_0xb845bc['id'],_0xb845bc);MailSubstatusEvents[_0x06a6('0x4')](_0x3c4c8a,_0xb845bc);_0x446724(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailSubstatus['hook'](e,emitEvent(event));}}module[_0x06a6('0x5')]=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 5629dce..227b1d1 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 _0x5cf1=['update','name','_previousDataValues','then','exports','models','Condition'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5cf1,0xba));var _0x15cf=function(_0x149db1,_0x25f28b){_0x149db1=_0x149db1-0x0;var _0x2059a8=_0x5cf1[_0x149db1];return _0x2059a8;};'use strict';var attributes=require('./mailSubstatus.attributes');module[_0x15cf('0x0')]=function(_0x556f4e){var _0x309b3a=_0x556f4e[_0x15cf('0x1')];return _0x556f4e['define']('MailSubstatus',attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x293890,_0x3de178,_0x5d0e49){return _0x309b3a[_0x15cf('0x2')][_0x15cf('0x3')]({'value':_0x293890[_0x15cf('0x4')]},{'where':{'field':'mailSubstatus','value':_0x293890[_0x15cf('0x5')]['name']}})[_0x15cf('0x6')](function(){_0x5d0e49();})['catch'](function(_0x34144c){_0x5d0e49(_0x34144c);});}}});}; \ No newline at end of file +var _0xe8c3=['./mailSubstatus.attributes','exports','models','define','Condition','update','mailSubstatus','name','then','catch'];(function(_0x4f85a3,_0x50582a){var _0x54e3f5=function(_0x10f6ce){while(--_0x10f6ce){_0x4f85a3['push'](_0x4f85a3['shift']());}};_0x54e3f5(++_0x50582a);}(_0xe8c3,0x168));var _0x3e8c=function(_0x26df48,_0x22aa50){_0x26df48=_0x26df48-0x0;var _0x209047=_0xe8c3[_0x26df48];return _0x209047;};'use strict';var attributes=require(_0x3e8c('0x0'));module[_0x3e8c('0x1')]=function(_0x14d544){var _0x4723b8=_0x14d544[_0x3e8c('0x2')];return _0x14d544[_0x3e8c('0x3')]('MailSubstatus',attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x5c09f8,_0x401600,_0x59d38d){return _0x4723b8[_0x3e8c('0x4')][_0x3e8c('0x5')]({'value':_0x5c09f8['name']},{'where':{'field':_0x3e8c('0x6'),'value':_0x5c09f8['_previousDataValues'][_0x3e8c('0x7')]}})[_0x3e8c('0x8')](function(){_0x59d38d();})[_0x3e8c('0x9')](function(_0x470f2c){_0x59d38d(_0x470f2c);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 46e2d7b..a723726 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 _0xf377=['lodash','util','moment','bluebird','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch'];(function(_0x112c50,_0xc36512){var _0x23c96c=function(_0x2cd808){while(--_0x2cd808){_0x112c50['push'](_0x112c50['shift']());}};_0x23c96c(++_0xc36512);}(_0xf377,0x126));var _0x7f37=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0xf377[_0x5c3c0b];return _0x52ecd2;};'use strict';var _=require(_0x7f37('0x0'));var util=require(_0x7f37('0x1'));var moment=require(_0x7f37('0x2'));var BPromise=require(_0x7f37('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7f37('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7f37('0x5'))('rpc');var config=require(_0x7f37('0x6'));var jayson=require(_0x7f37('0x7'));var client=jayson[_0x7f37('0x8')][_0x7f37('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x302c4b,_0x5cd66a,_0x3c10ad){return new BPromise(function(_0xf60b2,_0x823c23){return client[_0x7f37('0xa')](_0x302c4b,_0x3c10ad)['then'](function(_0x7d20b3){logger[_0x7f37('0xb')](_0x7f37('0xc'),_0x5cd66a,_0x7f37('0xd'));logger[_0x7f37('0xe')](_0x7f37('0xf'),_0x5cd66a,_0x7f37('0xd'),JSON[_0x7f37('0x10')](_0x7d20b3));if(_0x7d20b3[_0x7f37('0x11')]){if(_0x7d20b3[_0x7f37('0x11')][_0x7f37('0x12')]===0x1f4){logger[_0x7f37('0x11')]('MailSubstatus,\x20%s,\x20%s',_0x5cd66a,_0x7d20b3[_0x7f37('0x11')]['message']);return _0x823c23(_0x7d20b3[_0x7f37('0x11')][_0x7f37('0x13')]);}logger['error'](_0x7f37('0xc'),_0x5cd66a,_0x7d20b3[_0x7f37('0x11')][_0x7f37('0x13')]);return _0xf60b2(_0x7d20b3[_0x7f37('0x11')][_0x7f37('0x13')]);}else{logger[_0x7f37('0xb')]('MailSubstatus,\x20%s,\x20%s',_0x5cd66a,'request\x20sent');_0xf60b2(_0x7d20b3['result'][_0x7f37('0x13')]);}})[_0x7f37('0x14')](function(_0x32cdf0){logger[_0x7f37('0x11')](_0x7f37('0xc'),_0x5cd66a,_0x32cdf0);_0x823c23(_0x32cdf0);});});} \ No newline at end of file +var _0x9374=['debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','jayson/promise','http','request','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent'];(function(_0x2b7e9c,_0x236531){var _0x39ac82=function(_0x351563){while(--_0x351563){_0x2b7e9c['push'](_0x2b7e9c['shift']());}};_0x39ac82(++_0x236531);}(_0x9374,0x1ac));var _0x4937=function(_0x33fdd4,_0x3ec50d){_0x33fdd4=_0x33fdd4-0x0;var _0x3eba45=_0x9374[_0x33fdd4];return _0x3eba45;};'use strict';var _=require('lodash');var util=require(_0x4937('0x0'));var moment=require(_0x4937('0x1'));var BPromise=require(_0x4937('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4937('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4937('0x4'));var logger=require(_0x4937('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x4937('0x6'));var client=jayson['client'][_0x4937('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3bbe3a,_0x18616b,_0x29f39d){return new BPromise(function(_0x8b2800,_0x179add){return client[_0x4937('0x8')](_0x3bbe3a,_0x29f39d)[_0x4937('0x9')](function(_0x226629){logger[_0x4937('0xa')](_0x4937('0xb'),_0x18616b,_0x4937('0xc'));logger[_0x4937('0xd')](_0x4937('0xe'),_0x18616b,'request\x20sent',JSON[_0x4937('0xf')](_0x226629));if(_0x226629[_0x4937('0x10')]){if(_0x226629['error'][_0x4937('0x11')]===0x1f4){logger[_0x4937('0x10')](_0x4937('0xb'),_0x18616b,_0x226629[_0x4937('0x10')][_0x4937('0x12')]);return _0x179add(_0x226629['error'][_0x4937('0x12')]);}logger[_0x4937('0x10')]('MailSubstatus,\x20%s,\x20%s',_0x18616b,_0x226629[_0x4937('0x10')][_0x4937('0x12')]);return _0x8b2800(_0x226629[_0x4937('0x10')][_0x4937('0x12')]);}else{logger['info'](_0x4937('0xb'),_0x18616b,_0x4937('0xc'));_0x8b2800(_0x226629[_0x4937('0x13')]['message']);}})[_0x4937('0x14')](function(_0x6f9cb7){logger[_0x4937('0x10')](_0x4937('0xb'),_0x18616b,_0x6f9cb7);_0x179add(_0x6f9cb7);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 01c34db..dd53437 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 _0x903d=['get','index','/describe','describe','/:id','isAuthenticated','show','post','create','put','update','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2c0acf,_0x436456){var _0xb5e130=function(_0x4b2424){while(--_0x4b2424){_0x2c0acf['push'](_0x2c0acf['shift']());}};_0xb5e130(++_0x436456);}(_0x903d,0x19c));var _0xd903=function(_0x4da1fe,_0x2243b0){_0x4da1fe=_0x4da1fe-0x0;var _0x32ac56=_0x903d[_0x4da1fe];return _0x32ac56;};'use strict';var multer=require('multer');var util=require(_0xd903('0x0'));var path=require('path');var timeout=require(_0xd903('0x1'));var express=require(_0xd903('0x2'));var router=express[_0xd903('0x3')]();var fs_extra=require(_0xd903('0x4'));var auth=require(_0xd903('0x5'));var interaction=require(_0xd903('0x6'));var config=require(_0xd903('0x7'));var controller=require('./mailTransferReport.controller');router[_0xd903('0x8')]('/',auth['isAuthenticated'](),controller[_0xd903('0x9')]);router['get'](_0xd903('0xa'),auth['isAuthenticated'](),controller[_0xd903('0xb')]);router[_0xd903('0x8')](_0xd903('0xc'),auth[_0xd903('0xd')](),controller[_0xd903('0xe')]);router[_0xd903('0xf')]('/',auth[_0xd903('0xd')](),controller[_0xd903('0x10')]);router[_0xd903('0x11')](_0xd903('0xc'),auth[_0xd903('0xd')](),controller[_0xd903('0x12')]);router['delete'](_0xd903('0xc'),auth['isAuthenticated'](),controller[_0xd903('0x13')]);module[_0xd903('0x14')]=router; \ No newline at end of file +var _0x6228=['create','put','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','index','get','/describe','isAuthenticated','/:id'];(function(_0x35de70,_0x28b7fd){var _0xeb27b=function(_0x34088a){while(--_0x34088a){_0x35de70['push'](_0x35de70['shift']());}};_0xeb27b(++_0x28b7fd);}(_0x6228,0x1a1));var _0x8622=function(_0x9efc0b,_0x4e0680){_0x9efc0b=_0x9efc0b-0x0;var _0xf032b=_0x6228[_0x9efc0b];return _0xf032b;};'use strict';var multer=require(_0x8622('0x0'));var util=require('util');var path=require(_0x8622('0x1'));var timeout=require(_0x8622('0x2'));var express=require(_0x8622('0x3'));var router=express[_0x8622('0x4')]();var fs_extra=require(_0x8622('0x5'));var auth=require(_0x8622('0x6'));var interaction=require(_0x8622('0x7'));var config=require(_0x8622('0x8'));var controller=require(_0x8622('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x8622('0xa')]);router[_0x8622('0xb')](_0x8622('0xc'),auth[_0x8622('0xd')](),controller['describe']);router[_0x8622('0xb')](_0x8622('0xe'),auth[_0x8622('0xd')](),controller['show']);router['post']('/',auth[_0x8622('0xd')](),controller[_0x8622('0xf')]);router[_0x8622('0x10')](_0x8622('0xe'),auth[_0x8622('0xd')](),controller['update']);router['delete'](_0x8622('0xe'),auth[_0x8622('0xd')](),controller[_0x8622('0x11')]);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 36b4198..007f92b 100644 --- a/server/api/mailTransferReport/mailTransferReport.attributes.js +++ b/server/api/mailTransferReport/mailTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x474bc0,_0x26989c){var _0x4b24cf=function(_0x4be866){while(--_0x4be866){_0x474bc0['push'](_0x474bc0['shift']());}};_0x4b24cf(++_0x26989c);}(_0xb43b,0x1b2));var _0xbb43=function(_0x5e895f,_0x1d126e){_0x5e895f=_0x5e895f-0x0;var _0x44f0ac=_0xb43b[_0x5e895f];return _0x44f0ac;};'use strict';var moment=require(_0xbb43('0x0'));var Sequelize=require(_0xbb43('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xbb43('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbb43('0x3')](_0xbb43('0x4'),'agent',_0xbb43('0x5')),'allowNull':![],'defaultValue':_0xbb43('0x5')},'transferredAt':{'type':Sequelize[_0xbb43('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xbb43('0x7')]}}; \ No newline at end of file +var _0x54ef=['agent','queue','DATE','NOW','moment','sequelize','exports','ENUM','account'];(function(_0x20f060,_0xe160c9){var _0x46077c=function(_0x3c615a){while(--_0x3c615a){_0x20f060['push'](_0x20f060['shift']());}};_0x46077c(++_0xe160c9);}(_0x54ef,0x112));var _0xf54e=function(_0x872977,_0x310a3a){_0x872977=_0x872977-0x0;var _0x42f654=_0x54ef[_0x872977];return _0x42f654;};'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 diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index e3e474b..5cae98b 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 _0xea24=['limit','count','offset','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','fieldName','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','sort','where','filter','merge','type','VIRTUAL','options','MailTransferReport','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','find','body','describe','eml-format','zip-dir','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0xea24,0x1ef));var _0x4ea2=function(_0xa57e38,_0x53e62d){_0xa57e38=_0xa57e38-0x0;var _0x5a5e0e=_0xea24[_0xa57e38];return _0x5a5e0e;};'use strict';var emlformat=require(_0x4ea2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4ea2('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4ea2('0x2'));var BPromise=require(_0x4ea2('0x3'));var Mustache=require(_0x4ea2('0x4'));var util=require('util');var path=require(_0x4ea2('0x5'));var sox=require(_0x4ea2('0x6'));var csv=require(_0x4ea2('0x7'));var ejs=require(_0x4ea2('0x8'));var fs=require('fs');var fs_extra=require(_0x4ea2('0x9'));var _=require(_0x4ea2('0xa'));var squel=require(_0x4ea2('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4ea2('0xc'));var toCsv=require(_0x4ea2('0x7'));var querystring=require(_0x4ea2('0xd'));var Papa=require(_0x4ea2('0xe'));var Redis=require(_0x4ea2('0xf'));var authService=require(_0x4ea2('0x10'));var qs=require(_0x4ea2('0x11'));var as=require(_0x4ea2('0x12'));var hardwareService=require(_0x4ea2('0x13'));var logger=require(_0x4ea2('0x14'))('api');var utils=require(_0x4ea2('0x15'));var config=require(_0x4ea2('0x16'));var licenseUtil=require(_0x4ea2('0x17'));var db=require(_0x4ea2('0x18'))['db'];function respondWithStatusCode(_0x379a5b,_0x212546){_0x212546=_0x212546||0xcc;return function(_0x4d0255){if(_0x4d0255){return _0x379a5b[_0x4ea2('0x19')](_0x212546);}return _0x379a5b[_0x4ea2('0x1a')](_0x212546)[_0x4ea2('0x1b')]();};}function respondWithResult(_0x576d24,_0x1b296b){_0x1b296b=_0x1b296b||0xc8;return function(_0x4fd406){if(_0x4fd406){return _0x576d24['status'](_0x1b296b)[_0x4ea2('0x1c')](_0x4fd406);}};}function respondWithFilteredResult(_0x264e06,_0x2eaa91){return function(_0x3ea8b8){if(_0x3ea8b8){var _0x2ca4ad=typeof _0x2eaa91['offset']===_0x4ea2('0x1d')&&typeof _0x2eaa91[_0x4ea2('0x1e')]===_0x4ea2('0x1d');var _0x580ce2=_0x3ea8b8[_0x4ea2('0x1f')];var _0x5d9220=_0x2ca4ad?0x0:_0x2eaa91[_0x4ea2('0x20')];var _0x535315=_0x2ca4ad?_0x3ea8b8[_0x4ea2('0x1f')]:_0x2eaa91['offset']+_0x2eaa91[_0x4ea2('0x1e')];var _0x2c2a81;if(_0x535315>=_0x580ce2){_0x535315=_0x580ce2;_0x2c2a81=0xc8;}else{_0x2c2a81=0xce;}_0x264e06[_0x4ea2('0x1a')](_0x2c2a81);return _0x264e06[_0x4ea2('0x21')]('Content-Range',_0x5d9220+'-'+_0x535315+'/'+_0x580ce2)[_0x4ea2('0x1c')](_0x3ea8b8);}return null;};}function patchUpdates(_0x3338df){return function(_0x328d1e){try{jsonpatch[_0x4ea2('0x22')](_0x328d1e,_0x3338df,!![]);}catch(_0x1d4ca8){return BPromise[_0x4ea2('0x23')](_0x1d4ca8);}return _0x328d1e[_0x4ea2('0x24')]();};}function saveUpdates(_0xfd353b,_0xf7541d){return function(_0x426cbc){if(_0x426cbc){return _0x426cbc[_0x4ea2('0x25')](_0xfd353b)[_0x4ea2('0x26')](function(_0x329421){return _0x329421;});}return null;};}function removeEntity(_0xb75f68,_0x31ac59){return function(_0x53043e){if(_0x53043e){return _0x53043e[_0x4ea2('0x27')]()[_0x4ea2('0x26')](function(){_0xb75f68[_0x4ea2('0x1a')](0xcc)[_0x4ea2('0x1b')]();});}};}function handleEntityNotFound(_0x1abd94,_0x563cd3){return function(_0x23b48b){if(!_0x23b48b){_0x1abd94[_0x4ea2('0x19')](0x194);}return _0x23b48b;};}function handleError(_0x559a52,_0x4090d8){_0x4090d8=_0x4090d8||0x1f4;return function(_0x359e86){logger[_0x4ea2('0x28')](_0x359e86[_0x4ea2('0x29')]);if(_0x359e86[_0x4ea2('0x2a')]){delete _0x359e86[_0x4ea2('0x2a')];}_0x559a52['status'](_0x4090d8)[_0x4ea2('0x2b')](_0x359e86);};}exports[_0x4ea2('0x2c')]=function(_0x4c75d1,_0x52f23c){var _0x4bdea3={},_0x33d85d={},_0x2ee5a0={'count':0x0,'rows':[]};var _0x2eb5fc=_[_0x4ea2('0x2d')](db['MailTransferReport']['rawAttributes'],function(_0x2b404b){return{'name':_0x2b404b[_0x4ea2('0x2e')],'type':_0x2b404b['type']['key']};});_0x33d85d[_0x4ea2('0x2f')]=_['map'](_0x2eb5fc,'name');_0x33d85d[_0x4ea2('0x30')]=_[_0x4ea2('0x31')](_0x4c75d1[_0x4ea2('0x30')]);_0x33d85d[_0x4ea2('0x32')]=_[_0x4ea2('0x33')](_0x33d85d['model'],_0x33d85d[_0x4ea2('0x30')]);_0x4bdea3[_0x4ea2('0x34')]=_['intersection'](_0x33d85d[_0x4ea2('0x2f')],qs[_0x4ea2('0x35')](_0x4c75d1[_0x4ea2('0x30')][_0x4ea2('0x35')]));_0x4bdea3[_0x4ea2('0x34')]=_0x4bdea3['attributes']['length']?_0x4bdea3[_0x4ea2('0x34')]:_0x33d85d['model'];if(!_0x4c75d1[_0x4ea2('0x30')][_0x4ea2('0x36')]('nolimit')){_0x4bdea3[_0x4ea2('0x1e')]=qs[_0x4ea2('0x1e')](_0x4c75d1[_0x4ea2('0x30')][_0x4ea2('0x1e')]);_0x4bdea3[_0x4ea2('0x20')]=qs[_0x4ea2('0x20')](_0x4c75d1['query'][_0x4ea2('0x20')]);}_0x4bdea3['order']=qs[_0x4ea2('0x37')](_0x4c75d1['query'][_0x4ea2('0x37')]);_0x4bdea3[_0x4ea2('0x38')]=qs[_0x4ea2('0x32')](_['pick'](_0x4c75d1['query'],_0x33d85d[_0x4ea2('0x32')]),_0x2eb5fc);if(_0x4c75d1['query'][_0x4ea2('0x39')]){_0x4bdea3[_0x4ea2('0x38')]=_[_0x4ea2('0x3a')](_0x4bdea3[_0x4ea2('0x38')],{'$or':_['map'](_0x2eb5fc,function(_0x15626a){if(_0x15626a[_0x4ea2('0x3b')]!==_0x4ea2('0x3c')){var _0x20b1d2={};_0x20b1d2[_0x15626a[_0x4ea2('0x2a')]]={'$like':'%'+_0x4c75d1[_0x4ea2('0x30')][_0x4ea2('0x39')]+'%'};return _0x20b1d2;}})});}_0x4bdea3=_[_0x4ea2('0x3a')]({},_0x4bdea3,_0x4c75d1[_0x4ea2('0x3d')]);var _0x23ae14={'where':_0x4bdea3[_0x4ea2('0x38')]};return db[_0x4ea2('0x3e')][_0x4ea2('0x1f')](_0x23ae14)[_0x4ea2('0x26')](function(_0x4ae209){_0x2ee5a0[_0x4ea2('0x1f')]=_0x4ae209;if(_0x4c75d1[_0x4ea2('0x30')][_0x4ea2('0x3f')]){_0x4bdea3[_0x4ea2('0x40')]=[{'all':!![]}];}return db[_0x4ea2('0x3e')][_0x4ea2('0x41')](_0x4bdea3);})[_0x4ea2('0x26')](function(_0x438437){_0x2ee5a0[_0x4ea2('0x42')]=_0x438437;return _0x2ee5a0;})['then'](respondWithFilteredResult(_0x52f23c,_0x4bdea3))[_0x4ea2('0x43')](handleError(_0x52f23c,null));};exports[_0x4ea2('0x44')]=function(_0x51f29c,_0x19efe9){var _0x37427d={'raw':!![],'where':{'id':_0x51f29c[_0x4ea2('0x45')]['id']}},_0x21acf3={};_0x21acf3[_0x4ea2('0x2f')]=_[_0x4ea2('0x31')](db[_0x4ea2('0x3e')][_0x4ea2('0x46')]);_0x21acf3['query']=_[_0x4ea2('0x31')](_0x51f29c[_0x4ea2('0x30')]);_0x21acf3[_0x4ea2('0x32')]=_[_0x4ea2('0x33')](_0x21acf3[_0x4ea2('0x2f')],_0x21acf3[_0x4ea2('0x30')]);_0x37427d[_0x4ea2('0x34')]=_[_0x4ea2('0x33')](_0x21acf3['model'],qs[_0x4ea2('0x35')](_0x51f29c[_0x4ea2('0x30')][_0x4ea2('0x35')]));_0x37427d['attributes']=_0x37427d['attributes'][_0x4ea2('0x47')]?_0x37427d[_0x4ea2('0x34')]:_0x21acf3[_0x4ea2('0x2f')];if(_0x51f29c['query']['includeAll']){_0x37427d[_0x4ea2('0x40')]=[{'all':!![]}];}_0x37427d=_[_0x4ea2('0x3a')]({},_0x37427d,_0x51f29c[_0x4ea2('0x3d')]);return db['MailTransferReport'][_0x4ea2('0x48')](_0x37427d)[_0x4ea2('0x26')](handleEntityNotFound(_0x19efe9,null))[_0x4ea2('0x26')](respondWithResult(_0x19efe9,null))[_0x4ea2('0x43')](handleError(_0x19efe9,null));};exports['create']=function(_0x5341e9,_0xbbe3bf){return db['MailTransferReport']['create'](_0x5341e9[_0x4ea2('0x49')],{})[_0x4ea2('0x26')](respondWithResult(_0xbbe3bf,0xc9))['catch'](handleError(_0xbbe3bf,null));};exports['update']=function(_0x173a50,_0x2d776d){if(_0x173a50[_0x4ea2('0x49')]['id']){delete _0x173a50[_0x4ea2('0x49')]['id'];}return db[_0x4ea2('0x3e')][_0x4ea2('0x48')]({'where':{'id':_0x173a50['params']['id']}})[_0x4ea2('0x26')](handleEntityNotFound(_0x2d776d,null))[_0x4ea2('0x26')](saveUpdates(_0x173a50[_0x4ea2('0x49')],null))[_0x4ea2('0x26')](respondWithResult(_0x2d776d,null))[_0x4ea2('0x43')](handleError(_0x2d776d,null));};exports[_0x4ea2('0x27')]=function(_0x2c9e0a,_0x33f3f3){return db[_0x4ea2('0x3e')][_0x4ea2('0x48')]({'where':{'id':_0x2c9e0a[_0x4ea2('0x45')]['id']}})[_0x4ea2('0x26')](handleEntityNotFound(_0x33f3f3,null))[_0x4ea2('0x26')](removeEntity(_0x33f3f3,null))[_0x4ea2('0x43')](handleError(_0x33f3f3,null));};exports['describe']=function(_0x1667f3,_0x577d68){return db[_0x4ea2('0x3e')][_0x4ea2('0x4a')]()['then'](respondWithResult(_0x577d68,null))['catch'](handleError(_0x577d68,null));}; \ No newline at end of file +var _0x270e=['fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','find','catch','create','body','params','describe','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','update','then','destroy','error','stack','name','index','map','MailTransferReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection'];(function(_0x27bc08,_0x1bd619){var _0x51e98d=function(_0x279226){while(--_0x279226){_0x27bc08['push'](_0x27bc08['shift']());}};_0x51e98d(++_0x1bd619);}(_0x270e,0xab));var _0xe270=function(_0x2f4d7f,_0x62f4b7){_0x2f4d7f=_0x2f4d7f-0x0;var _0x147ba1=_0x270e[_0x2f4d7f];return _0x147ba1;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe270('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe270('0x1'));var moment=require('moment');var BPromise=require(_0xe270('0x2'));var Mustache=require(_0xe270('0x3'));var util=require(_0xe270('0x4'));var path=require(_0xe270('0x5'));var sox=require(_0xe270('0x6'));var csv=require(_0xe270('0x7'));var ejs=require(_0xe270('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe270('0x9'));var squel=require(_0xe270('0xa'));var crypto=require(_0xe270('0xb'));var jsforce=require(_0xe270('0xc'));var deskjs=require(_0xe270('0xd'));var toCsv=require('to-csv');var querystring=require(_0xe270('0xe'));var Papa=require(_0xe270('0xf'));var Redis=require(_0xe270('0x10'));var authService=require(_0xe270('0x11'));var qs=require(_0xe270('0x12'));var as=require(_0xe270('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe270('0x14'))('api');var utils=require(_0xe270('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xe270('0x16'))['db'];function respondWithStatusCode(_0x198928,_0x512ad7){_0x512ad7=_0x512ad7||0xcc;return function(_0x22c003){if(_0x22c003){return _0x198928[_0xe270('0x17')](_0x512ad7);}return _0x198928[_0xe270('0x18')](_0x512ad7)[_0xe270('0x19')]();};}function respondWithResult(_0x3fa015,_0x3f20c6){_0x3f20c6=_0x3f20c6||0xc8;return function(_0x26c295){if(_0x26c295){return _0x3fa015[_0xe270('0x18')](_0x3f20c6)[_0xe270('0x1a')](_0x26c295);}};}function respondWithFilteredResult(_0x39d775,_0x3ca150){return function(_0x3f6203){if(_0x3f6203){var _0x15e72c=typeof _0x3ca150[_0xe270('0x1b')]===_0xe270('0x1c')&&typeof _0x3ca150['limit']===_0xe270('0x1c');var _0x6151c8=_0x3f6203[_0xe270('0x1d')];var _0x2a9e1f=_0x15e72c?0x0:_0x3ca150['offset'];var _0x1ff996=_0x15e72c?_0x3f6203[_0xe270('0x1d')]:_0x3ca150[_0xe270('0x1b')]+_0x3ca150[_0xe270('0x1e')];var _0x471a34;if(_0x1ff996>=_0x6151c8){_0x1ff996=_0x6151c8;_0x471a34=0xc8;}else{_0x471a34=0xce;}_0x39d775[_0xe270('0x18')](_0x471a34);return _0x39d775[_0xe270('0x1f')](_0xe270('0x20'),_0x2a9e1f+'-'+_0x1ff996+'/'+_0x6151c8)[_0xe270('0x1a')](_0x3f6203);}return null;};}function patchUpdates(_0x20b0ff){return function(_0x274b4e){try{jsonpatch[_0xe270('0x21')](_0x274b4e,_0x20b0ff,!![]);}catch(_0x49c162){return BPromise['reject'](_0x49c162);}return _0x274b4e['save']();};}function saveUpdates(_0xf9d33d,_0x4e28e7){return function(_0x45279f){if(_0x45279f){return _0x45279f[_0xe270('0x22')](_0xf9d33d)[_0xe270('0x23')](function(_0x20bf88){return _0x20bf88;});}return null;};}function removeEntity(_0x16a872,_0x31ca63){return function(_0x23e0ad){if(_0x23e0ad){return _0x23e0ad[_0xe270('0x24')]()[_0xe270('0x23')](function(){_0x16a872[_0xe270('0x18')](0xcc)[_0xe270('0x19')]();});}};}function handleEntityNotFound(_0x4b2a0f,_0x538c5d){return function(_0x2c111d){if(!_0x2c111d){_0x4b2a0f[_0xe270('0x17')](0x194);}return _0x2c111d;};}function handleError(_0x145705,_0x5a0a56){_0x5a0a56=_0x5a0a56||0x1f4;return function(_0x21f0e6){logger[_0xe270('0x25')](_0x21f0e6[_0xe270('0x26')]);if(_0x21f0e6[_0xe270('0x27')]){delete _0x21f0e6[_0xe270('0x27')];}_0x145705[_0xe270('0x18')](_0x5a0a56)['send'](_0x21f0e6);};}exports[_0xe270('0x28')]=function(_0x578ab7,_0xa85431){var _0x4d54be={},_0x263830={},_0xa6c981={'count':0x0,'rows':[]};var _0x2dd44f=_[_0xe270('0x29')](db[_0xe270('0x2a')][_0xe270('0x2b')],function(_0xaccf74){return{'name':_0xaccf74[_0xe270('0x2c')],'type':_0xaccf74['type'][_0xe270('0x2d')]};});_0x263830[_0xe270('0x2e')]=_[_0xe270('0x29')](_0x2dd44f,_0xe270('0x27'));_0x263830[_0xe270('0x2f')]=_[_0xe270('0x30')](_0x578ab7[_0xe270('0x2f')]);_0x263830[_0xe270('0x31')]=_['intersection'](_0x263830[_0xe270('0x2e')],_0x263830[_0xe270('0x2f')]);_0x4d54be['attributes']=_[_0xe270('0x32')](_0x263830[_0xe270('0x2e')],qs[_0xe270('0x33')](_0x578ab7[_0xe270('0x2f')][_0xe270('0x33')]));_0x4d54be[_0xe270('0x34')]=_0x4d54be[_0xe270('0x34')][_0xe270('0x35')]?_0x4d54be[_0xe270('0x34')]:_0x263830[_0xe270('0x2e')];if(!_0x578ab7[_0xe270('0x2f')][_0xe270('0x36')]('nolimit')){_0x4d54be['limit']=qs[_0xe270('0x1e')](_0x578ab7['query'][_0xe270('0x1e')]);_0x4d54be[_0xe270('0x1b')]=qs['offset'](_0x578ab7['query'][_0xe270('0x1b')]);}_0x4d54be[_0xe270('0x37')]=qs['sort'](_0x578ab7[_0xe270('0x2f')][_0xe270('0x38')]);_0x4d54be[_0xe270('0x39')]=qs[_0xe270('0x31')](_[_0xe270('0x3a')](_0x578ab7[_0xe270('0x2f')],_0x263830['filters']),_0x2dd44f);if(_0x578ab7[_0xe270('0x2f')][_0xe270('0x3b')]){_0x4d54be[_0xe270('0x39')]=_['merge'](_0x4d54be[_0xe270('0x39')],{'$or':_['map'](_0x2dd44f,function(_0x3c7e24){if(_0x3c7e24['type']!==_0xe270('0x3c')){var _0x205156={};_0x205156[_0x3c7e24[_0xe270('0x27')]]={'$like':'%'+_0x578ab7['query'][_0xe270('0x3b')]+'%'};return _0x205156;}})});}_0x4d54be=_[_0xe270('0x3d')]({},_0x4d54be,_0x578ab7[_0xe270('0x3e')]);var _0x2aa8d4={'where':_0x4d54be['where']};return db[_0xe270('0x2a')][_0xe270('0x1d')](_0x2aa8d4)['then'](function(_0x4004e9){_0xa6c981[_0xe270('0x1d')]=_0x4004e9;if(_0x578ab7['query'][_0xe270('0x3f')]){_0x4d54be[_0xe270('0x40')]=[{'all':!![]}];}return db[_0xe270('0x2a')][_0xe270('0x41')](_0x4d54be);})[_0xe270('0x23')](function(_0x23b02c){_0xa6c981[_0xe270('0x42')]=_0x23b02c;return _0xa6c981;})[_0xe270('0x23')](respondWithFilteredResult(_0xa85431,_0x4d54be))['catch'](handleError(_0xa85431,null));};exports[_0xe270('0x43')]=function(_0x4702a2,_0x3569bc){var _0x54caee={'raw':!![],'where':{'id':_0x4702a2['params']['id']}},_0x5cb66c={};_0x5cb66c[_0xe270('0x2e')]=_['keys'](db[_0xe270('0x2a')][_0xe270('0x2b')]);_0x5cb66c[_0xe270('0x2f')]=_['keys'](_0x4702a2['query']);_0x5cb66c[_0xe270('0x31')]=_['intersection'](_0x5cb66c[_0xe270('0x2e')],_0x5cb66c[_0xe270('0x2f')]);_0x54caee[_0xe270('0x34')]=_[_0xe270('0x32')](_0x5cb66c['model'],qs[_0xe270('0x33')](_0x4702a2[_0xe270('0x2f')][_0xe270('0x33')]));_0x54caee[_0xe270('0x34')]=_0x54caee[_0xe270('0x34')][_0xe270('0x35')]?_0x54caee[_0xe270('0x34')]:_0x5cb66c[_0xe270('0x2e')];if(_0x4702a2[_0xe270('0x2f')][_0xe270('0x3f')]){_0x54caee['include']=[{'all':!![]}];}_0x54caee=_[_0xe270('0x3d')]({},_0x54caee,_0x4702a2[_0xe270('0x3e')]);return db[_0xe270('0x2a')][_0xe270('0x44')](_0x54caee)[_0xe270('0x23')](handleEntityNotFound(_0x3569bc,null))['then'](respondWithResult(_0x3569bc,null))[_0xe270('0x45')](handleError(_0x3569bc,null));};exports[_0xe270('0x46')]=function(_0x54d6f6,_0x263a16){return db[_0xe270('0x2a')][_0xe270('0x46')](_0x54d6f6['body'],{})[_0xe270('0x23')](respondWithResult(_0x263a16,0xc9))[_0xe270('0x45')](handleError(_0x263a16,null));};exports[_0xe270('0x22')]=function(_0x2faf27,_0x309a8e){if(_0x2faf27[_0xe270('0x47')]['id']){delete _0x2faf27['body']['id'];}return db[_0xe270('0x2a')][_0xe270('0x44')]({'where':{'id':_0x2faf27[_0xe270('0x48')]['id']}})[_0xe270('0x23')](handleEntityNotFound(_0x309a8e,null))[_0xe270('0x23')](saveUpdates(_0x2faf27[_0xe270('0x47')],null))[_0xe270('0x23')](respondWithResult(_0x309a8e,null))[_0xe270('0x45')](handleError(_0x309a8e,null));};exports[_0xe270('0x24')]=function(_0x5746a1,_0x5e6abc){return db[_0xe270('0x2a')][_0xe270('0x44')]({'where':{'id':_0x5746a1[_0xe270('0x48')]['id']}})[_0xe270('0x23')](handleEntityNotFound(_0x5e6abc,null))[_0xe270('0x23')](removeEntity(_0x5e6abc,null))['catch'](handleError(_0x5e6abc,null));};exports[_0xe270('0x49')]=function(_0x2fe044,_0x49e7c2){return db[_0xe270('0x2a')][_0xe270('0x49')]()[_0xe270('0x23')](respondWithResult(_0x49e7c2,null))[_0xe270('0x45')](handleError(_0x49e7c2,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 84731f9..711c056 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 _0x37cc=['api','moment','bluebird','rimraf','../../config/environment','./mailTransferReport.attributes','exports','define','MailTransferReport','report_mail_transfer','uniqueid','lodash','util','../../config/logger'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x37cc,0x185));var _0xc37c=function(_0x22f3bc,_0x54340e){_0x22f3bc=_0x22f3bc-0x0;var _0x325c4e=_0x37cc[_0x22f3bc];return _0x325c4e;};'use strict';var _=require(_0xc37c('0x0'));var util=require(_0xc37c('0x1'));var logger=require(_0xc37c('0x2'))(_0xc37c('0x3'));var moment=require(_0xc37c('0x4'));var BPromise=require(_0xc37c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc37c('0x6'));var config=require(_0xc37c('0x7'));var attributes=require(_0xc37c('0x8'));module[_0xc37c('0x9')]=function(_0x4c9dcd,_0x582100){return _0x4c9dcd[_0xc37c('0xa')](_0xc37c('0xb'),attributes,{'tableName':_0xc37c('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xc37c('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb18e=['./mailTransferReport.attributes','exports','define','report_mail_transfer','uniqueid','../../config/logger','moment','request-promise','path','../../config/environment'];(function(_0x27e6f9,_0x7454f1){var _0x50b299=function(_0x14bbee){while(--_0x14bbee){_0x27e6f9['push'](_0x27e6f9['shift']());}};_0x50b299(++_0x7454f1);}(_0xb18e,0x181));var _0xeb18=function(_0x1b3564,_0x16c919){_0x1b3564=_0x1b3564-0x0;var _0x504069=_0xb18e[_0x1b3564];return _0x504069;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xeb18('0x0'))('api');var moment=require(_0xeb18('0x1'));var BPromise=require('bluebird');var rp=require(_0xeb18('0x2'));var fs=require('fs');var path=require(_0xeb18('0x3'));var rimraf=require('rimraf');var config=require(_0xeb18('0x4'));var attributes=require(_0xeb18('0x5'));module[_0xeb18('0x6')]=function(_0x409efb,_0x46d281){return _0x409efb[_0xeb18('0x7')]('MailTransferReport',attributes,{'tableName':_0xeb18('0x8'),'paranoid':![],'indexes':[{'name':_0xeb18('0x9'),'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 fe612a2..524eed7 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 _0x7edc=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','bluebird','randomstring','ioredis'];(function(_0x30fed1,_0x9f755b){var _0x2d9ee0=function(_0x52a2cf){while(--_0x52a2cf){_0x30fed1['push'](_0x30fed1['shift']());}};_0x2d9ee0(++_0x9f755b);}(_0x7edc,0x152));var _0xc7ed=function(_0x533132,_0xf5b6fa){_0x533132=_0x533132-0x0;var _0x1a7447=_0x7edc[_0x533132];return _0x1a7447;};'use strict';var _=require(_0xc7ed('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc7ed('0x1'));var rs=require(_0xc7ed('0x2'));var fs=require('fs');var Redis=require(_0xc7ed('0x3'));var db=require(_0xc7ed('0x4'))['db'];var utils=require(_0xc7ed('0x5'));var logger=require('../../config/logger')(_0xc7ed('0x6'));var config=require(_0xc7ed('0x7'));var jayson=require(_0xc7ed('0x8'));var client=jayson['client'][_0xc7ed('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x8d073,_0x21c822,_0x585814){return new BPromise(function(_0x136a71,_0x3d593d){return client[_0xc7ed('0xa')](_0x8d073,_0x585814)['then'](function(_0x36f769){logger[_0xc7ed('0xb')](_0xc7ed('0xc'),_0x21c822,_0xc7ed('0xd'));logger['debug'](_0xc7ed('0xe'),_0x21c822,_0xc7ed('0xd'),JSON[_0xc7ed('0xf')](_0x36f769));if(_0x36f769[_0xc7ed('0x10')]){if(_0x36f769[_0xc7ed('0x10')]['code']===0x1f4){logger[_0xc7ed('0x10')]('MailTransferReport,\x20%s,\x20%s',_0x21c822,_0x36f769[_0xc7ed('0x10')][_0xc7ed('0x11')]);return _0x3d593d(_0x36f769[_0xc7ed('0x10')][_0xc7ed('0x11')]);}logger[_0xc7ed('0x10')](_0xc7ed('0xc'),_0x21c822,_0x36f769['error'][_0xc7ed('0x11')]);return _0x136a71(_0x36f769[_0xc7ed('0x10')][_0xc7ed('0x11')]);}else{logger['info'](_0xc7ed('0xc'),_0x21c822,_0xc7ed('0xd'));_0x136a71(_0x36f769['result'][_0xc7ed('0x11')]);}})[_0xc7ed('0x12')](function(_0x1fef02){logger[_0xc7ed('0x10')](_0xc7ed('0xc'),_0x21c822,_0x1fef02);_0x3d593d(_0x1fef02);});});} \ No newline at end of file +var _0x5e02=['error','code','message','result','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0x8eeafb,_0x4c416e){var _0x1d981e=function(_0x4ff80b){while(--_0x4ff80b){_0x8eeafb['push'](_0x8eeafb['shift']());}};_0x1d981e(++_0x4c416e);}(_0x5e02,0x1c7));var _0x25e0=function(_0x23371f,_0x34bf84){_0x23371f=_0x23371f-0x0;var _0x241060=_0x5e02[_0x23371f];return _0x241060;};'use strict';var _=require(_0x25e0('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x25e0('0x1'));var fs=require('fs');var Redis=require(_0x25e0('0x2'));var db=require(_0x25e0('0x3'))['db'];var utils=require(_0x25e0('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x25e0('0x5'));var jayson=require(_0x25e0('0x6'));var client=jayson['client'][_0x25e0('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3bb157,_0x287fdd,_0x43fd98){return new BPromise(function(_0x2bda31,_0x2b2101){return client['request'](_0x3bb157,_0x43fd98)['then'](function(_0x4464b7){logger[_0x25e0('0x8')](_0x25e0('0x9'),_0x287fdd,_0x25e0('0xa'));logger[_0x25e0('0xb')](_0x25e0('0xc'),_0x287fdd,_0x25e0('0xa'),JSON['stringify'](_0x4464b7));if(_0x4464b7[_0x25e0('0xd')]){if(_0x4464b7[_0x25e0('0xd')][_0x25e0('0xe')]===0x1f4){logger['error']('MailTransferReport,\x20%s,\x20%s',_0x287fdd,_0x4464b7['error']['message']);return _0x2b2101(_0x4464b7[_0x25e0('0xd')][_0x25e0('0xf')]);}logger['error'](_0x25e0('0x9'),_0x287fdd,_0x4464b7['error'][_0x25e0('0xf')]);return _0x2bda31(_0x4464b7['error'][_0x25e0('0xf')]);}else{logger['info'](_0x25e0('0x9'),_0x287fdd,'request\x20sent');_0x2bda31(_0x4464b7[_0x25e0('0x10')][_0x25e0('0xf')]);}})[_0x25e0('0x11')](function(_0x4420ce){logger[_0x25e0('0xd')]('MailTransferReport,\x20%s,\x20%s',_0x287fdd,_0x4420ce);_0x2b2101(_0x4420ce);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index aa4c512..0e9ca14 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 _0x972e=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','destroy','exports'];(function(_0x140734,_0x33df05){var _0x4de877=function(_0x214249){while(--_0x214249){_0x140734['push'](_0x140734['shift']());}};_0x4de877(++_0x33df05);}(_0x972e,0x6e));var _0xe972=function(_0x1273a7,_0x767a60){_0x1273a7=_0x1273a7-0x0;var _0x29783c=_0x972e[_0x1273a7];return _0x29783c;};'use strict';var multer=require('multer');var util=require(_0xe972('0x0'));var path=require('path');var timeout=require(_0xe972('0x1'));var express=require(_0xe972('0x2'));var router=express[_0xe972('0x3')]();var fs_extra=require(_0xe972('0x4'));var auth=require(_0xe972('0x5'));var interaction=require(_0xe972('0x6'));var config=require(_0xe972('0x7'));var controller=require(_0xe972('0x8'));router[_0xe972('0x9')]('/',auth['isAuthenticated'](),controller[_0xe972('0xa')]);router[_0xe972('0x9')](_0xe972('0xb'),auth[_0xe972('0xc')](),controller[_0xe972('0xd')]);router[_0xe972('0x9')](_0xe972('0xe'),auth[_0xe972('0xc')](),controller[_0xe972('0xf')]);router[_0xe972('0x10')]('/',auth[_0xe972('0xc')](),controller[_0xe972('0x11')]);router[_0xe972('0x12')](_0xe972('0xe'),auth['isAuthenticated'](),controller[_0xe972('0x13')]);router['delete'](_0xe972('0xe'),auth['isAuthenticated'](),controller[_0xe972('0x14')]);module[_0xe972('0x15')]=router; \ No newline at end of file +var _0x619a=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','get','isAuthenticated','index','/describe','describe','create','/:id','update','delete','multer','path','connect-timeout','express','Router'];(function(_0x490605,_0xccbe84){var _0x56a9b7=function(_0x56dccd){while(--_0x56dccd){_0x490605['push'](_0x490605['shift']());}};_0x56a9b7(++_0xccbe84);}(_0x619a,0x1e9));var _0xa619=function(_0x165833,_0x3f430e){_0x165833=_0x165833-0x0;var _0x2ee4ee=_0x619a[_0x165833];return _0x2ee4ee;};'use strict';var multer=require(_0xa619('0x0'));var util=require('util');var path=require(_0xa619('0x1'));var timeout=require(_0xa619('0x2'));var express=require(_0xa619('0x3'));var router=express[_0xa619('0x4')]();var fs_extra=require(_0xa619('0x5'));var auth=require(_0xa619('0x6'));var interaction=require(_0xa619('0x7'));var config=require(_0xa619('0x8'));var controller=require(_0xa619('0x9'));router[_0xa619('0xa')]('/',auth[_0xa619('0xb')](),controller[_0xa619('0xc')]);router[_0xa619('0xa')](_0xa619('0xd'),auth[_0xa619('0xb')](),controller[_0xa619('0xe')]);router[_0xa619('0xa')]('/:id',auth[_0xa619('0xb')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xa619('0xf')]);router['put'](_0xa619('0x10'),auth['isAuthenticated'](),controller[_0xa619('0x11')]);router[_0xa619('0x12')](_0xa619('0x10'),auth[_0xa619('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 25e22fd..b778a87 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 _0x8c9b=['enterAt','seconds','setDataValue','exitAt','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','moment','exports','STRING','INTEGER','DATE','getDataValue'];(function(_0x346f31,_0x3616bc){var _0x31920f=function(_0x21b578){while(--_0x21b578){_0x346f31['push'](_0x346f31['shift']());}};_0x31920f(++_0x3616bc);}(_0x8c9b,0x120));var _0xb8c9=function(_0x17afca,_0x5d6455){_0x17afca=_0x17afca-0x0;var _0x4691c9=_0x8c9b[_0x17afca];return _0x4691c9;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xb8c9('0x0'));module[_0xb8c9('0x1')]={'channel':{'type':Sequelize[_0xb8c9('0x2')]},'membername':{'type':Sequelize[_0xb8c9('0x2')]},'interface':{'type':Sequelize[_0xb8c9('0x2')]},'type':{'type':Sequelize[_0xb8c9('0x2')],'defaultValue':'DEFAULT\x20PAUSE','comment':'LOGIN,\x20PAUSE,\x20TALKING'},'duration':{'type':Sequelize[_0xb8c9('0x3')]},'enterAt':{'type':Sequelize[_0xb8c9('0x4')]},'exitAt':{'type':Sequelize[_0xb8c9('0x4')],'set':function(_0x3f4a33){var _0x1a652b=moment(_0x3f4a33);var _0x33560d=moment(this[_0xb8c9('0x5')](_0xb8c9('0x6')));var _0x47447d=_0x1a652b['diff'](_0x33560d,_0xb8c9('0x7'));this[_0xb8c9('0x8')](_0xb8c9('0x9'),_0x3f4a33);this['setDataValue']('duration',_0x47447d>=0x0?_0x47447d:null);}},'data1':{'type':Sequelize[_0xb8c9('0x2')],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize[_0xb8c9('0x2')],'comment':_0xb8c9('0xa')},'data3':{'type':Sequelize['STRING'],'comment':_0xb8c9('0xb')},'data4':{'type':Sequelize[_0xb8c9('0x2')],'comment':_0xb8c9('0xc')},'data5':{'type':Sequelize[_0xb8c9('0x2')],'comment':_0xb8c9('0xd')},'role':{'type':Sequelize[_0xb8c9('0x2')]},'internal':{'type':Sequelize[_0xb8c9('0x3')]},'uniqueid':{'type':Sequelize[_0xb8c9('0x2')]}}; \ No newline at end of file +var _0x0449=['duration','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','enterAt','diff','exitAt','setDataValue'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x0449,0x1b8));var _0x9044=function(_0x497676,_0x1f8488){_0x497676=_0x497676-0x0;var _0x82cfb=_0x0449[_0x497676];return _0x82cfb;};'use strict';var Sequelize=require(_0x9044('0x0'));var moment=require('moment');module['exports']={'channel':{'type':Sequelize[_0x9044('0x1')]},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x9044('0x1')],'defaultValue':_0x9044('0x2'),'comment':_0x9044('0x3')},'duration':{'type':Sequelize[_0x9044('0x4')]},'enterAt':{'type':Sequelize[_0x9044('0x5')]},'exitAt':{'type':Sequelize[_0x9044('0x5')],'set':function(_0xc6e666){var _0x105dfe=moment(_0xc6e666);var _0x25e106=moment(this['getDataValue'](_0x9044('0x6')));var _0x1797e2=_0x105dfe[_0x9044('0x7')](_0x25e106,'seconds');this['setDataValue'](_0x9044('0x8'),_0xc6e666);this[_0x9044('0x9')](_0x9044('0xa'),_0x1797e2>=0x0?_0x1797e2:null);}},'data1':{'type':Sequelize['STRING'],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize[_0x9044('0x1')],'comment':_0x9044('0xb')},'data3':{'type':Sequelize[_0x9044('0x1')],'comment':_0x9044('0xc')},'data4':{'type':Sequelize[_0x9044('0x1')],'comment':_0x9044('0xd')},'data5':{'type':Sequelize[_0x9044('0x1')],'comment':_0x9044('0xe')},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize[_0x9044('0x4')]},'uniqueid':{'type':Sequelize[_0x9044('0x1')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 17ed38a..231fbaf 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 _0x7217=['query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','merge','filter','includeAll','include','rows','catch','show','params','rawAttributes','length','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','send','index','map','MemberReport','fieldName','type','model','name','keys'];(function(_0x15142c,_0x362e2e){var _0x5cd69e=function(_0x16ed43){while(--_0x16ed43){_0x15142c['push'](_0x15142c['shift']());}};_0x5cd69e(++_0x362e2e);}(_0x7217,0x19e));var _0x7721=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0x7217[_0x29b609];return _0x54c952;};'use strict';var emlformat=require(_0x7721('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7721('0x1'));var jsonpatch=require(_0x7721('0x2'));var rp=require(_0x7721('0x3'));var moment=require(_0x7721('0x4'));var BPromise=require(_0x7721('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x7721('0x6'));var sox=require(_0x7721('0x7'));var csv=require(_0x7721('0x8'));var ejs=require(_0x7721('0x9'));var fs=require('fs');var fs_extra=require(_0x7721('0xa'));var _=require(_0x7721('0xb'));var squel=require(_0x7721('0xc'));var crypto=require(_0x7721('0xd'));var jsforce=require(_0x7721('0xe'));var deskjs=require(_0x7721('0xf'));var toCsv=require(_0x7721('0x8'));var querystring=require(_0x7721('0x10'));var Papa=require(_0x7721('0x11'));var Redis=require(_0x7721('0x12'));var authService=require(_0x7721('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x7721('0x14'));var hardwareService=require(_0x7721('0x15'));var logger=require(_0x7721('0x16'))(_0x7721('0x17'));var utils=require(_0x7721('0x18'));var config=require(_0x7721('0x19'));var licenseUtil=require(_0x7721('0x1a'));var db=require(_0x7721('0x1b'))['db'];function respondWithStatusCode(_0x55b4ca,_0x2911ec){_0x2911ec=_0x2911ec||0xcc;return function(_0x199930){if(_0x199930){return _0x55b4ca['sendStatus'](_0x2911ec);}return _0x55b4ca[_0x7721('0x1c')](_0x2911ec)[_0x7721('0x1d')]();};}function respondWithResult(_0x3f01c5,_0x2e9752){_0x2e9752=_0x2e9752||0xc8;return function(_0x5069da){if(_0x5069da){return _0x3f01c5[_0x7721('0x1c')](_0x2e9752)[_0x7721('0x1e')](_0x5069da);}};}function respondWithFilteredResult(_0x534f1b,_0x4e199a){return function(_0x4b183e){if(_0x4b183e){var _0x5ed54=typeof _0x4e199a[_0x7721('0x1f')]===_0x7721('0x20')&&typeof _0x4e199a[_0x7721('0x21')]==='undefined';var _0x20f669=_0x4b183e['count'];var _0x3fc09e=_0x5ed54?0x0:_0x4e199a['offset'];var _0xfec626=_0x5ed54?_0x4b183e[_0x7721('0x22')]:_0x4e199a[_0x7721('0x1f')]+_0x4e199a[_0x7721('0x21')];var _0x2286e5;if(_0xfec626>=_0x20f669){_0xfec626=_0x20f669;_0x2286e5=0xc8;}else{_0x2286e5=0xce;}_0x534f1b[_0x7721('0x1c')](_0x2286e5);return _0x534f1b[_0x7721('0x23')](_0x7721('0x24'),_0x3fc09e+'-'+_0xfec626+'/'+_0x20f669)[_0x7721('0x1e')](_0x4b183e);}return null;};}function patchUpdates(_0xaeccc4){return function(_0x4ce1db){try{jsonpatch[_0x7721('0x25')](_0x4ce1db,_0xaeccc4,!![]);}catch(_0x2c1583){return BPromise[_0x7721('0x26')](_0x2c1583);}return _0x4ce1db[_0x7721('0x27')]();};}function saveUpdates(_0x57140c,_0x28f5a6){return function(_0x512f31){if(_0x512f31){return _0x512f31[_0x7721('0x28')](_0x57140c)[_0x7721('0x29')](function(_0x3e8a4e){return _0x3e8a4e;});}return null;};}function removeEntity(_0x1caad8,_0x121cc4){return function(_0x395b15){if(_0x395b15){return _0x395b15[_0x7721('0x2a')]()['then'](function(){_0x1caad8[_0x7721('0x1c')](0xcc)[_0x7721('0x1d')]();});}};}function handleEntityNotFound(_0x125564,_0x1f67c7){return function(_0x40d550){if(!_0x40d550){_0x125564[_0x7721('0x2b')](0x194);}return _0x40d550;};}function handleError(_0x424e05,_0xf753f1){_0xf753f1=_0xf753f1||0x1f4;return function(_0x40f367){logger['error'](_0x40f367[_0x7721('0x2c')]);if(_0x40f367['name']){delete _0x40f367['name'];}_0x424e05[_0x7721('0x1c')](_0xf753f1)[_0x7721('0x2d')](_0x40f367);};}exports[_0x7721('0x2e')]=function(_0x158d98,_0x1ea4d){var _0x37b9f0={},_0xd7d703={},_0x1da2d8={'count':0x0,'rows':[]};var _0x5c54f0=_[_0x7721('0x2f')](db[_0x7721('0x30')]['rawAttributes'],function(_0x4a25c9){return{'name':_0x4a25c9[_0x7721('0x31')],'type':_0x4a25c9[_0x7721('0x32')]['key']};});_0xd7d703[_0x7721('0x33')]=_[_0x7721('0x2f')](_0x5c54f0,_0x7721('0x34'));_0xd7d703['query']=_[_0x7721('0x35')](_0x158d98[_0x7721('0x36')]);_0xd7d703[_0x7721('0x37')]=_[_0x7721('0x38')](_0xd7d703[_0x7721('0x33')],_0xd7d703['query']);_0x37b9f0[_0x7721('0x39')]=_[_0x7721('0x38')](_0xd7d703[_0x7721('0x33')],qs['fields'](_0x158d98[_0x7721('0x36')][_0x7721('0x3a')]));_0x37b9f0['attributes']=_0x37b9f0[_0x7721('0x39')]['length']?_0x37b9f0[_0x7721('0x39')]:_0xd7d703[_0x7721('0x33')];if(!_0x158d98[_0x7721('0x36')][_0x7721('0x3b')](_0x7721('0x3c'))){_0x37b9f0[_0x7721('0x21')]=qs[_0x7721('0x21')](_0x158d98[_0x7721('0x36')][_0x7721('0x21')]);_0x37b9f0[_0x7721('0x1f')]=qs[_0x7721('0x1f')](_0x158d98['query'][_0x7721('0x1f')]);}_0x37b9f0['order']=qs[_0x7721('0x3d')](_0x158d98[_0x7721('0x36')][_0x7721('0x3d')]);_0x37b9f0[_0x7721('0x3e')]=qs[_0x7721('0x37')](_[_0x7721('0x3f')](_0x158d98['query'],_0xd7d703['filters']),_0x5c54f0);if(_0x158d98['query']['filter']){_0x37b9f0[_0x7721('0x3e')]=_[_0x7721('0x40')](_0x37b9f0[_0x7721('0x3e')],{'$or':_[_0x7721('0x2f')](_0x5c54f0,function(_0x4a90ce){if(_0x4a90ce[_0x7721('0x32')]!=='VIRTUAL'){var _0xfab37b={};_0xfab37b[_0x4a90ce[_0x7721('0x34')]]={'$like':'%'+_0x158d98['query'][_0x7721('0x41')]+'%'};return _0xfab37b;}})});}_0x37b9f0=_[_0x7721('0x40')]({},_0x37b9f0,_0x158d98['options']);var _0x4d0111={'where':_0x37b9f0[_0x7721('0x3e')]};return db[_0x7721('0x30')][_0x7721('0x22')](_0x4d0111)[_0x7721('0x29')](function(_0x577af9){_0x1da2d8[_0x7721('0x22')]=_0x577af9;if(_0x158d98[_0x7721('0x36')][_0x7721('0x42')]){_0x37b9f0[_0x7721('0x43')]=[{'all':!![]}];}return db[_0x7721('0x30')]['findAll'](_0x37b9f0);})[_0x7721('0x29')](function(_0x4a2c28){_0x1da2d8[_0x7721('0x44')]=_0x4a2c28;return _0x1da2d8;})['then'](respondWithFilteredResult(_0x1ea4d,_0x37b9f0))[_0x7721('0x45')](handleError(_0x1ea4d,null));};exports[_0x7721('0x46')]=function(_0x231dad,_0x49e0c5){var _0x1453d4={'raw':!![],'where':{'id':_0x231dad[_0x7721('0x47')]['id']}},_0x11d853={};_0x11d853['model']=_[_0x7721('0x35')](db[_0x7721('0x30')][_0x7721('0x48')]);_0x11d853[_0x7721('0x36')]=_[_0x7721('0x35')](_0x231dad[_0x7721('0x36')]);_0x11d853[_0x7721('0x37')]=_['intersection'](_0x11d853['model'],_0x11d853[_0x7721('0x36')]);_0x1453d4[_0x7721('0x39')]=_[_0x7721('0x38')](_0x11d853[_0x7721('0x33')],qs[_0x7721('0x3a')](_0x231dad[_0x7721('0x36')][_0x7721('0x3a')]));_0x1453d4[_0x7721('0x39')]=_0x1453d4[_0x7721('0x39')][_0x7721('0x49')]?_0x1453d4['attributes']:_0x11d853['model'];if(_0x231dad[_0x7721('0x36')][_0x7721('0x42')]){_0x1453d4[_0x7721('0x43')]=[{'all':!![]}];}_0x1453d4=_[_0x7721('0x40')]({},_0x1453d4,_0x231dad['options']);return db[_0x7721('0x30')][_0x7721('0x4a')](_0x1453d4)['then'](handleEntityNotFound(_0x49e0c5,null))[_0x7721('0x29')](respondWithResult(_0x49e0c5,null))['catch'](handleError(_0x49e0c5,null));};exports[_0x7721('0x4b')]=function(_0x5c6922,_0x334f23){return db[_0x7721('0x30')][_0x7721('0x4b')](_0x5c6922['body'],{})[_0x7721('0x29')](respondWithResult(_0x334f23,0xc9))[_0x7721('0x45')](handleError(_0x334f23,null));};exports['update']=function(_0x223d93,_0x1196c2){if(_0x223d93[_0x7721('0x4c')]['id']){delete _0x223d93['body']['id'];}return db[_0x7721('0x30')]['find']({'where':{'id':_0x223d93[_0x7721('0x47')]['id']}})[_0x7721('0x29')](handleEntityNotFound(_0x1196c2,null))[_0x7721('0x29')](saveUpdates(_0x223d93[_0x7721('0x4c')],null))[_0x7721('0x29')](respondWithResult(_0x1196c2,null))[_0x7721('0x45')](handleError(_0x1196c2,null));};exports[_0x7721('0x2a')]=function(_0x7fbb73,_0x694d2f){return db[_0x7721('0x30')][_0x7721('0x4a')]({'where':{'id':_0x7fbb73[_0x7721('0x47')]['id']}})[_0x7721('0x29')](handleEntityNotFound(_0x694d2f,null))[_0x7721('0x29')](removeEntity(_0x694d2f,null))[_0x7721('0x45')](handleError(_0x694d2f,null));};exports['describe']=function(_0x474f32,_0x2f6f30){return db[_0x7721('0x30')][_0x7721('0x4d')]()[_0x7721('0x29')](respondWithResult(_0x2f6f30,null))[_0x7721('0x45')](handleError(_0x2f6f30,null));}; \ No newline at end of file +var _0x3e74=['show','params','options','find','catch','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','end','json','undefined','limit','offset','count','status','set','Content-Range','apply','save','update','then','destroy','sendStatus','name','send','index','map','MemberReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows'];(function(_0x185ed2,_0xb1564a){var _0x11d850=function(_0xfecc87){while(--_0xfecc87){_0x185ed2['push'](_0x185ed2['shift']());}};_0x11d850(++_0xb1564a);}(_0x3e74,0x175));var _0x43e7=function(_0x4b3045,_0xe0f208){_0x4b3045=_0x4b3045-0x0;var _0x1bc426=_0x3e74[_0x4b3045];return _0x1bc426;};'use strict';var emlformat=require(_0x43e7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x43e7('0x1'));var jsonpatch=require(_0x43e7('0x2'));var rp=require(_0x43e7('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x43e7('0x4'));var util=require('util');var path=require(_0x43e7('0x5'));var sox=require(_0x43e7('0x6'));var csv=require(_0x43e7('0x7'));var ejs=require(_0x43e7('0x8'));var fs=require('fs');var fs_extra=require(_0x43e7('0x9'));var _=require('lodash');var squel=require(_0x43e7('0xa'));var crypto=require(_0x43e7('0xb'));var jsforce=require(_0x43e7('0xc'));var deskjs=require(_0x43e7('0xd'));var toCsv=require(_0x43e7('0x7'));var querystring=require('querystring');var Papa=require(_0x43e7('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x43e7('0xf'));var as=require(_0x43e7('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x43e7('0x11'))('api');var utils=require(_0x43e7('0x12'));var config=require(_0x43e7('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x43e7('0x14'))['db'];function respondWithStatusCode(_0xc960ea,_0x2718d3){_0x2718d3=_0x2718d3||0xcc;return function(_0x3bb83f){if(_0x3bb83f){return _0xc960ea['sendStatus'](_0x2718d3);}return _0xc960ea['status'](_0x2718d3)[_0x43e7('0x15')]();};}function respondWithResult(_0x21fdd3,_0x44b0bd){_0x44b0bd=_0x44b0bd||0xc8;return function(_0x51b974){if(_0x51b974){return _0x21fdd3['status'](_0x44b0bd)[_0x43e7('0x16')](_0x51b974);}};}function respondWithFilteredResult(_0x14c146,_0x203378){return function(_0x328445){if(_0x328445){var _0x4de324=typeof _0x203378['offset']===_0x43e7('0x17')&&typeof _0x203378[_0x43e7('0x18')]===_0x43e7('0x17');var _0x5d346f=_0x328445['count'];var _0x446986=_0x4de324?0x0:_0x203378[_0x43e7('0x19')];var _0x9037d3=_0x4de324?_0x328445[_0x43e7('0x1a')]:_0x203378[_0x43e7('0x19')]+_0x203378[_0x43e7('0x18')];var _0x619236;if(_0x9037d3>=_0x5d346f){_0x9037d3=_0x5d346f;_0x619236=0xc8;}else{_0x619236=0xce;}_0x14c146[_0x43e7('0x1b')](_0x619236);return _0x14c146[_0x43e7('0x1c')](_0x43e7('0x1d'),_0x446986+'-'+_0x9037d3+'/'+_0x5d346f)[_0x43e7('0x16')](_0x328445);}return null;};}function patchUpdates(_0x177ee1){return function(_0x4b5d64){try{jsonpatch[_0x43e7('0x1e')](_0x4b5d64,_0x177ee1,!![]);}catch(_0x3c6625){return BPromise['reject'](_0x3c6625);}return _0x4b5d64[_0x43e7('0x1f')]();};}function saveUpdates(_0x3e281e,_0x3945bb){return function(_0x28aacc){if(_0x28aacc){return _0x28aacc[_0x43e7('0x20')](_0x3e281e)[_0x43e7('0x21')](function(_0x54a9e7){return _0x54a9e7;});}return null;};}function removeEntity(_0x454359,_0x4eea52){return function(_0x4c9df3){if(_0x4c9df3){return _0x4c9df3[_0x43e7('0x22')]()[_0x43e7('0x21')](function(){_0x454359['status'](0xcc)[_0x43e7('0x15')]();});}};}function handleEntityNotFound(_0x4ca5cf,_0x326dab){return function(_0x5c5e67){if(!_0x5c5e67){_0x4ca5cf[_0x43e7('0x23')](0x194);}return _0x5c5e67;};}function handleError(_0x1b5f50,_0x20888b){_0x20888b=_0x20888b||0x1f4;return function(_0x405f85){logger['error'](_0x405f85['stack']);if(_0x405f85[_0x43e7('0x24')]){delete _0x405f85['name'];}_0x1b5f50[_0x43e7('0x1b')](_0x20888b)[_0x43e7('0x25')](_0x405f85);};}exports[_0x43e7('0x26')]=function(_0xb1fc63,_0x5087d7){var _0x33a1a5={},_0x4690a6={},_0x45b675={'count':0x0,'rows':[]};var _0x50f9f5=_[_0x43e7('0x27')](db[_0x43e7('0x28')][_0x43e7('0x29')],function(_0x31b2a6){return{'name':_0x31b2a6[_0x43e7('0x2a')],'type':_0x31b2a6[_0x43e7('0x2b')][_0x43e7('0x2c')]};});_0x4690a6[_0x43e7('0x2d')]=_[_0x43e7('0x27')](_0x50f9f5,_0x43e7('0x24'));_0x4690a6['query']=_[_0x43e7('0x2e')](_0xb1fc63[_0x43e7('0x2f')]);_0x4690a6[_0x43e7('0x30')]=_[_0x43e7('0x31')](_0x4690a6[_0x43e7('0x2d')],_0x4690a6['query']);_0x33a1a5[_0x43e7('0x32')]=_[_0x43e7('0x31')](_0x4690a6[_0x43e7('0x2d')],qs[_0x43e7('0x33')](_0xb1fc63['query']['fields']));_0x33a1a5['attributes']=_0x33a1a5[_0x43e7('0x32')][_0x43e7('0x34')]?_0x33a1a5[_0x43e7('0x32')]:_0x4690a6[_0x43e7('0x2d')];if(!_0xb1fc63[_0x43e7('0x2f')][_0x43e7('0x35')]('nolimit')){_0x33a1a5['limit']=qs['limit'](_0xb1fc63['query']['limit']);_0x33a1a5['offset']=qs['offset'](_0xb1fc63[_0x43e7('0x2f')]['offset']);}_0x33a1a5[_0x43e7('0x36')]=qs[_0x43e7('0x37')](_0xb1fc63[_0x43e7('0x2f')][_0x43e7('0x37')]);_0x33a1a5[_0x43e7('0x38')]=qs[_0x43e7('0x30')](_[_0x43e7('0x39')](_0xb1fc63['query'],_0x4690a6['filters']),_0x50f9f5);if(_0xb1fc63['query'][_0x43e7('0x3a')]){_0x33a1a5[_0x43e7('0x38')]=_[_0x43e7('0x3b')](_0x33a1a5[_0x43e7('0x38')],{'$or':_[_0x43e7('0x27')](_0x50f9f5,function(_0x1ed538){if(_0x1ed538[_0x43e7('0x2b')]!==_0x43e7('0x3c')){var _0x55c798={};_0x55c798[_0x1ed538[_0x43e7('0x24')]]={'$like':'%'+_0xb1fc63[_0x43e7('0x2f')]['filter']+'%'};return _0x55c798;}})});}_0x33a1a5=_[_0x43e7('0x3b')]({},_0x33a1a5,_0xb1fc63['options']);var _0x44d8e4={'where':_0x33a1a5[_0x43e7('0x38')]};return db[_0x43e7('0x28')][_0x43e7('0x1a')](_0x44d8e4)[_0x43e7('0x21')](function(_0x234d8f){_0x45b675['count']=_0x234d8f;if(_0xb1fc63['query'][_0x43e7('0x3d')]){_0x33a1a5[_0x43e7('0x3e')]=[{'all':!![]}];}return db[_0x43e7('0x28')][_0x43e7('0x3f')](_0x33a1a5);})[_0x43e7('0x21')](function(_0x4a4a85){_0x45b675[_0x43e7('0x40')]=_0x4a4a85;return _0x45b675;})[_0x43e7('0x21')](respondWithFilteredResult(_0x5087d7,_0x33a1a5))['catch'](handleError(_0x5087d7,null));};exports[_0x43e7('0x41')]=function(_0x51a69c,_0x2ad8ef){var _0x504101={'raw':!![],'where':{'id':_0x51a69c[_0x43e7('0x42')]['id']}},_0x3d81ae={};_0x3d81ae[_0x43e7('0x2d')]=_[_0x43e7('0x2e')](db['MemberReport']['rawAttributes']);_0x3d81ae[_0x43e7('0x2f')]=_[_0x43e7('0x2e')](_0x51a69c[_0x43e7('0x2f')]);_0x3d81ae[_0x43e7('0x30')]=_['intersection'](_0x3d81ae['model'],_0x3d81ae['query']);_0x504101[_0x43e7('0x32')]=_['intersection'](_0x3d81ae[_0x43e7('0x2d')],qs['fields'](_0x51a69c['query'][_0x43e7('0x33')]));_0x504101['attributes']=_0x504101[_0x43e7('0x32')][_0x43e7('0x34')]?_0x504101[_0x43e7('0x32')]:_0x3d81ae[_0x43e7('0x2d')];if(_0x51a69c['query'][_0x43e7('0x3d')]){_0x504101[_0x43e7('0x3e')]=[{'all':!![]}];}_0x504101=_[_0x43e7('0x3b')]({},_0x504101,_0x51a69c[_0x43e7('0x43')]);return db[_0x43e7('0x28')][_0x43e7('0x44')](_0x504101)['then'](handleEntityNotFound(_0x2ad8ef,null))['then'](respondWithResult(_0x2ad8ef,null))[_0x43e7('0x45')](handleError(_0x2ad8ef,null));};exports[_0x43e7('0x46')]=function(_0x212841,_0x4c00a8){return db['MemberReport']['create'](_0x212841[_0x43e7('0x47')],{})[_0x43e7('0x21')](respondWithResult(_0x4c00a8,0xc9))['catch'](handleError(_0x4c00a8,null));};exports[_0x43e7('0x20')]=function(_0x47686e,_0x3c96fe){if(_0x47686e['body']['id']){delete _0x47686e['body']['id'];}return db['MemberReport']['find']({'where':{'id':_0x47686e[_0x43e7('0x42')]['id']}})[_0x43e7('0x21')](handleEntityNotFound(_0x3c96fe,null))['then'](saveUpdates(_0x47686e[_0x43e7('0x47')],null))[_0x43e7('0x21')](respondWithResult(_0x3c96fe,null))[_0x43e7('0x45')](handleError(_0x3c96fe,null));};exports[_0x43e7('0x22')]=function(_0x4a0ce5,_0x2718d5){return db['MemberReport']['find']({'where':{'id':_0x4a0ce5[_0x43e7('0x42')]['id']}})[_0x43e7('0x21')](handleEntityNotFound(_0x2718d5,null))[_0x43e7('0x21')](removeEntity(_0x2718d5,null))[_0x43e7('0x45')](handleError(_0x2718d5,null));};exports[_0x43e7('0x48')]=function(_0x2351cf,_0x1cd87c){return db[_0x43e7('0x28')][_0x43e7('0x48')]()[_0x43e7('0x21')](respondWithResult(_0x1cd87c,null))['catch'](handleError(_0x1cd87c,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 168fbc8..bbf7d15 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 _0x019b=['../../config/environment','./memberReport.attributes','exports','define','MemberReport','report_member','membername_interface','membername','interface','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x1ac49a,_0x2b78a7){var _0x232558=function(_0x242dd4){while(--_0x242dd4){_0x1ac49a['push'](_0x1ac49a['shift']());}};_0x232558(++_0x2b78a7);}(_0x019b,0x1da));var _0xb019=function(_0x56138f,_0x1e9ebb){_0x56138f=_0x56138f-0x0;var _0x1acaf7=_0x019b[_0x56138f];return _0x1acaf7;};'use strict';var _=require(_0xb019('0x0'));var util=require(_0xb019('0x1'));var logger=require(_0xb019('0x2'))(_0xb019('0x3'));var moment=require(_0xb019('0x4'));var BPromise=require(_0xb019('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb019('0x6'));var attributes=require(_0xb019('0x7'));module[_0xb019('0x8')]=function(_0x173ee4,_0x39bafe){return _0x173ee4[_0xb019('0x9')](_0xb019('0xa'),attributes,{'tableName':_0xb019('0xb'),'paranoid':![],'indexes':[{'name':_0xb019('0xc'),'fields':[_0xb019('0xd'),_0xb019('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb3fd=['api','bluebird','request-promise','path','rimraf','../../config/environment','exports','MemberReport','report_member','membername_interface','interface','util','../../config/logger'];(function(_0x203d64,_0x1ec79c){var _0x462ab3=function(_0x55ee6e){while(--_0x55ee6e){_0x203d64['push'](_0x203d64['shift']());}};_0x462ab3(++_0x1ec79c);}(_0xb3fd,0xdb));var _0xdb3f=function(_0x565b5f,_0x187173){_0x565b5f=_0x565b5f-0x0;var _0x263f22=_0xb3fd[_0x565b5f];return _0x263f22;};'use strict';var _=require('lodash');var util=require(_0xdb3f('0x0'));var logger=require(_0xdb3f('0x1'))(_0xdb3f('0x2'));var moment=require('moment');var BPromise=require(_0xdb3f('0x3'));var rp=require(_0xdb3f('0x4'));var fs=require('fs');var path=require(_0xdb3f('0x5'));var rimraf=require(_0xdb3f('0x6'));var config=require(_0xdb3f('0x7'));var attributes=require('./memberReport.attributes');module[_0xdb3f('0x8')]=function(_0x317d72,_0x615643){return _0x317d72['define'](_0xdb3f('0x9'),attributes,{'tableName':_0xdb3f('0xa'),'paranoid':![],'indexes':[{'name':_0xdb3f('0xb'),'fields':['membername',_0xdb3f('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index d529cb3..f5c7334 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 _0xd9ce=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','MemberReport','findAll','options','raw','where','attributes','limit','include','map','model','GetMemberReport','create','body','CreateMemberReport','catch','UpdateMemberReport','update','lodash','util','moment','bluebird','randomstring'];(function(_0x87b845,_0x277414){var _0x34f59f=function(_0x47c3ea){while(--_0x47c3ea){_0x87b845['push'](_0x87b845['shift']());}};_0x34f59f(++_0x277414);}(_0xd9ce,0xeb));var _0xed9c=function(_0x4ab9a7,_0x291df1){_0x4ab9a7=_0x4ab9a7-0x0;var _0xd08799=_0xd9ce[_0x4ab9a7];return _0xd08799;};'use strict';var _=require(_0xed9c('0x0'));var util=require(_0xed9c('0x1'));var moment=require(_0xed9c('0x2'));var BPromise=require(_0xed9c('0x3'));var rs=require(_0xed9c('0x4'));var fs=require('fs');var Redis=require(_0xed9c('0x5'));var db=require(_0xed9c('0x6'))['db'];var utils=require(_0xed9c('0x7'));var logger=require('../../config/logger')(_0xed9c('0x8'));var config=require(_0xed9c('0x9'));var jayson=require(_0xed9c('0xa'));var client=jayson[_0xed9c('0xb')][_0xed9c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x434898,_0x58c757,_0x2ad757){return new BPromise(function(_0xde32e4,_0x5a312d){return client['request'](_0x434898,_0x2ad757)[_0xed9c('0xd')](function(_0x5ed0ab){logger[_0xed9c('0xe')](_0xed9c('0xf'),_0x58c757,_0xed9c('0x10'));logger[_0xed9c('0x11')]('MemberReport,\x20%s,\x20%s,\x20%s',_0x58c757,_0xed9c('0x10'),JSON[_0xed9c('0x12')](_0x5ed0ab));if(_0x5ed0ab[_0xed9c('0x13')]){if(_0x5ed0ab[_0xed9c('0x13')][_0xed9c('0x14')]===0x1f4){logger['error']('MemberReport,\x20%s,\x20%s',_0x58c757,_0x5ed0ab[_0xed9c('0x13')][_0xed9c('0x15')]);return _0x5a312d(_0x5ed0ab[_0xed9c('0x13')][_0xed9c('0x15')]);}logger['error']('MemberReport,\x20%s,\x20%s',_0x58c757,_0x5ed0ab[_0xed9c('0x13')]['message']);return _0xde32e4(_0x5ed0ab[_0xed9c('0x13')][_0xed9c('0x15')]);}else{logger[_0xed9c('0xe')](_0xed9c('0xf'),_0x58c757,_0xed9c('0x10'));_0xde32e4(_0x5ed0ab[_0xed9c('0x16')][_0xed9c('0x15')]);}})['catch'](function(_0x244d5e){logger[_0xed9c('0x13')](_0xed9c('0xf'),_0x58c757,_0x244d5e);_0x5a312d(_0x244d5e);});});}exports['GetMemberReport']=function(_0x485029){var _0x7eea82=this;return new Promise(function(_0x48b7b4,_0x421834){return db[_0xed9c('0x17')][_0xed9c('0x18')]({'raw':_0x485029[_0xed9c('0x19')]?_0x485029[_0xed9c('0x19')][_0xed9c('0x1a')]===undefined?!![]:![]:!![],'where':_0x485029['options']?_0x485029[_0xed9c('0x19')][_0xed9c('0x1b')]||null:null,'attributes':_0x485029[_0xed9c('0x19')]?_0x485029['options'][_0xed9c('0x1c')]||null:null,'limit':_0x485029[_0xed9c('0x19')]?_0x485029[_0xed9c('0x19')][_0xed9c('0x1d')]||null:null,'include':_0x485029['options']?_0x485029['options'][_0xed9c('0x1e')]?_[_0xed9c('0x1f')](_0x485029[_0xed9c('0x19')][_0xed9c('0x1e')],function(_0x1fd75d){return{'model':db[_0x1fd75d[_0xed9c('0x20')]],'as':_0x1fd75d['as'],'attributes':_0x1fd75d['attributes'],'include':_0x1fd75d[_0xed9c('0x1e')]?_['map'](_0x1fd75d['include'],function(_0x495055){return{'model':db[_0x495055[_0xed9c('0x20')]],'as':_0x495055['as'],'attributes':_0x495055[_0xed9c('0x1c')],'include':_0x495055[_0xed9c('0x1e')]?_[_0xed9c('0x1f')](_0x495055['include'],function(_0x2a1fac){return{'model':db[_0x2a1fac[_0xed9c('0x20')]],'as':_0x2a1fac['as'],'attributes':_0x2a1fac[_0xed9c('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xe3be1){logger[_0xed9c('0xe')](_0xed9c('0x21'),_0x485029);logger[_0xed9c('0x11')]('GetMemberReport',_0x485029,JSON[_0xed9c('0x12')](_0xe3be1));_0x48b7b4(_0xe3be1);})['catch'](function(_0x42c134){logger[_0xed9c('0x13')](_0xed9c('0x21'),_0x42c134[_0xed9c('0x15')],_0x485029);_0x421834(_0x7eea82[_0xed9c('0x13')](0x1f4,_0x42c134['message']));});});};exports['CreateMemberReport']=function(_0x241372){var _0x9a2584=this;return new Promise(function(_0x13d128,_0xf6ddf4){return db['MemberReport'][_0xed9c('0x22')](_0x241372[_0xed9c('0x23')],{'raw':_0x241372[_0xed9c('0x19')]?_0x241372[_0xed9c('0x19')][_0xed9c('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x2226a2){logger['info'](_0xed9c('0x24'),_0x241372);logger[_0xed9c('0x11')](_0xed9c('0x24'),_0x241372,JSON[_0xed9c('0x12')](_0x2226a2));_0x13d128(_0x2226a2);})[_0xed9c('0x25')](function(_0x3ee465){logger[_0xed9c('0x13')](_0xed9c('0x24'),_0x3ee465[_0xed9c('0x15')],_0x241372);_0xf6ddf4(_0x9a2584[_0xed9c('0x13')](0x1f4,_0x3ee465[_0xed9c('0x15')]));});});};exports[_0xed9c('0x26')]=function(_0x281ca0){var _0x4655ba=this;return new Promise(function(_0x436b86,_0x3e986e){return db['MemberReport'][_0xed9c('0x27')](_0x281ca0[_0xed9c('0x23')],{'raw':_0x281ca0[_0xed9c('0x19')]?_0x281ca0[_0xed9c('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x281ca0[_0xed9c('0x19')]?_0x281ca0[_0xed9c('0x19')][_0xed9c('0x1b')]||null:null,'attributes':_0x281ca0[_0xed9c('0x19')]?_0x281ca0[_0xed9c('0x19')][_0xed9c('0x1c')]||null:null,'limit':_0x281ca0[_0xed9c('0x19')]?_0x281ca0[_0xed9c('0x19')][_0xed9c('0x1d')]||null:null})[_0xed9c('0xd')](function(_0x50e6f0){logger['info'](_0xed9c('0x26'),_0x281ca0);logger[_0xed9c('0x11')](_0xed9c('0x26'),_0x281ca0,JSON['stringify'](_0x50e6f0));_0x436b86(_0x50e6f0);})[_0xed9c('0x25')](function(_0x4dc992){logger['error'](_0xed9c('0x26'),_0x4dc992['message'],_0x281ca0);_0x3e986e(_0x4655ba['error'](0x1f4,_0x4dc992[_0xed9c('0x15')]));});});}; \ No newline at end of file +var _0xd046=['util','moment','bluebird','ioredis','../../config/logger','../../config/environment','http','MemberReport,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','GetMemberReport','MemberReport','findAll','options','raw','where','attributes','limit','map','include','model','then','debug','create','body','CreateMemberReport','UpdateMemberReport','update'];(function(_0x188cd9,_0x43fd57){var _0x57f41a=function(_0xee0963){while(--_0xee0963){_0x188cd9['push'](_0x188cd9['shift']());}};_0x57f41a(++_0x43fd57);}(_0xd046,0x129));var _0x6d04=function(_0x597931,_0x8112e0){_0x597931=_0x597931-0x0;var _0x14e151=_0xd046[_0x597931];return _0x14e151;};'use strict';var _=require('lodash');var util=require(_0x6d04('0x0'));var moment=require(_0x6d04('0x1'));var BPromise=require(_0x6d04('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6d04('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6d04('0x4'))('rpc');var config=require(_0x6d04('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6d04('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x1968c4,_0x4f83bc,_0x569c7b){return new BPromise(function(_0x2e2c01,_0x42aa22){return client['request'](_0x1968c4,_0x569c7b)['then'](function(_0x27a3d6){logger['info'](_0x6d04('0x7'),_0x4f83bc,'request\x20sent');logger['debug']('MemberReport,\x20%s,\x20%s,\x20%s',_0x4f83bc,_0x6d04('0x8'),JSON[_0x6d04('0x9')](_0x27a3d6));if(_0x27a3d6[_0x6d04('0xa')]){if(_0x27a3d6[_0x6d04('0xa')]['code']===0x1f4){logger[_0x6d04('0xa')](_0x6d04('0x7'),_0x4f83bc,_0x27a3d6[_0x6d04('0xa')][_0x6d04('0xb')]);return _0x42aa22(_0x27a3d6[_0x6d04('0xa')][_0x6d04('0xb')]);}logger[_0x6d04('0xa')](_0x6d04('0x7'),_0x4f83bc,_0x27a3d6[_0x6d04('0xa')][_0x6d04('0xb')]);return _0x2e2c01(_0x27a3d6[_0x6d04('0xa')][_0x6d04('0xb')]);}else{logger[_0x6d04('0xc')](_0x6d04('0x7'),_0x4f83bc,_0x6d04('0x8'));_0x2e2c01(_0x27a3d6[_0x6d04('0xd')][_0x6d04('0xb')]);}})[_0x6d04('0xe')](function(_0xed5538){logger[_0x6d04('0xa')](_0x6d04('0x7'),_0x4f83bc,_0xed5538);_0x42aa22(_0xed5538);});});}exports[_0x6d04('0xf')]=function(_0x2bc798){var _0x3ad325=this;return new Promise(function(_0x4e93b5,_0x3657a1){return db[_0x6d04('0x10')][_0x6d04('0x11')]({'raw':_0x2bc798[_0x6d04('0x12')]?_0x2bc798[_0x6d04('0x12')][_0x6d04('0x13')]===undefined?!![]:![]:!![],'where':_0x2bc798[_0x6d04('0x12')]?_0x2bc798[_0x6d04('0x12')][_0x6d04('0x14')]||null:null,'attributes':_0x2bc798[_0x6d04('0x12')]?_0x2bc798[_0x6d04('0x12')][_0x6d04('0x15')]||null:null,'limit':_0x2bc798[_0x6d04('0x12')]?_0x2bc798['options'][_0x6d04('0x16')]||null:null,'include':_0x2bc798[_0x6d04('0x12')]?_0x2bc798['options']['include']?_[_0x6d04('0x17')](_0x2bc798[_0x6d04('0x12')][_0x6d04('0x18')],function(_0xe8f198){return{'model':db[_0xe8f198[_0x6d04('0x19')]],'as':_0xe8f198['as'],'attributes':_0xe8f198[_0x6d04('0x15')],'include':_0xe8f198[_0x6d04('0x18')]?_[_0x6d04('0x17')](_0xe8f198[_0x6d04('0x18')],function(_0x38e90f){return{'model':db[_0x38e90f[_0x6d04('0x19')]],'as':_0x38e90f['as'],'attributes':_0x38e90f[_0x6d04('0x15')],'include':_0x38e90f[_0x6d04('0x18')]?_[_0x6d04('0x17')](_0x38e90f['include'],function(_0x1dc29b){return{'model':db[_0x1dc29b[_0x6d04('0x19')]],'as':_0x1dc29b['as'],'attributes':_0x1dc29b[_0x6d04('0x15')]};}):[]};}):[]};}):[]:[]})[_0x6d04('0x1a')](function(_0x4256a3){logger[_0x6d04('0xc')]('GetMemberReport',_0x2bc798);logger[_0x6d04('0x1b')](_0x6d04('0xf'),_0x2bc798,JSON[_0x6d04('0x9')](_0x4256a3));_0x4e93b5(_0x4256a3);})[_0x6d04('0xe')](function(_0x2ed2bb){logger['error']('GetMemberReport',_0x2ed2bb['message'],_0x2bc798);_0x3657a1(_0x3ad325['error'](0x1f4,_0x2ed2bb[_0x6d04('0xb')]));});});};exports['CreateMemberReport']=function(_0x43eb48){var _0x4ed123=this;return new Promise(function(_0x26be38,_0xee1291){return db[_0x6d04('0x10')][_0x6d04('0x1c')](_0x43eb48[_0x6d04('0x1d')],{'raw':_0x43eb48[_0x6d04('0x12')]?_0x43eb48[_0x6d04('0x12')][_0x6d04('0x13')]===undefined?!![]:![]:!![]})[_0x6d04('0x1a')](function(_0xff4c36){logger['info']('CreateMemberReport',_0x43eb48);logger[_0x6d04('0x1b')](_0x6d04('0x1e'),_0x43eb48,JSON[_0x6d04('0x9')](_0xff4c36));_0x26be38(_0xff4c36);})[_0x6d04('0xe')](function(_0x592f01){logger[_0x6d04('0xa')](_0x6d04('0x1e'),_0x592f01[_0x6d04('0xb')],_0x43eb48);_0xee1291(_0x4ed123[_0x6d04('0xa')](0x1f4,_0x592f01['message']));});});};exports[_0x6d04('0x1f')]=function(_0x1d86d2){var _0x1e03a4=this;return new Promise(function(_0x184da2,_0x2f59ef){return db[_0x6d04('0x10')][_0x6d04('0x20')](_0x1d86d2[_0x6d04('0x1d')],{'raw':_0x1d86d2[_0x6d04('0x12')]?_0x1d86d2[_0x6d04('0x12')][_0x6d04('0x13')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1d86d2[_0x6d04('0x12')]?_0x1d86d2[_0x6d04('0x12')][_0x6d04('0x14')]||null:null,'attributes':_0x1d86d2[_0x6d04('0x12')]?_0x1d86d2['options'][_0x6d04('0x15')]||null:null,'limit':_0x1d86d2['options']?_0x1d86d2[_0x6d04('0x12')][_0x6d04('0x16')]||null:null})['then'](function(_0x39991b){logger[_0x6d04('0xc')](_0x6d04('0x1f'),_0x1d86d2);logger[_0x6d04('0x1b')](_0x6d04('0x1f'),_0x1d86d2,JSON[_0x6d04('0x9')](_0x39991b));_0x184da2(_0x39991b);})[_0x6d04('0xe')](function(_0x1246a7){logger['error'](_0x6d04('0x1f'),_0x1246a7[_0x6d04('0xb')],_0x1d86d2);_0x2f59ef(_0x1e03a4[_0x6d04('0xa')](0x1f4,_0x1246a7[_0x6d04('0xb')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index e058a81..cb3eb91 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 _0x8149=['util','connect-timeout','express','../../components/interaction/service','../../config/environment','index','multer'];(function(_0x3d1289,_0x362df5){var _0xfa5838=function(_0x43f49e){while(--_0x43f49e){_0x3d1289['push'](_0x3d1289['shift']());}};_0xfa5838(++_0x362df5);}(_0x8149,0x1a3));var _0x9814=function(_0x457189,_0x454408){_0x457189=_0x457189-0x0;var _0x56461c=_0x8149[_0x457189];return _0x56461c;};'use strict';var multer=require(_0x9814('0x0'));var util=require(_0x9814('0x1'));var path=require('path');var timeout=require(_0x9814('0x2'));var express=require(_0x9814('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x9814('0x4'));var config=require(_0x9814('0x5'));var controller=require('./migration.controller');router['get']('/',controller[_0x9814('0x6')]);module['exports']=router; \ No newline at end of file +var _0x0795=['../../config/environment','./migration.controller','index','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x35c4ab,_0x236cf3){var _0x18308f=function(_0x4fce24){while(--_0x4fce24){_0x35c4ab['push'](_0x35c4ab['shift']());}};_0x18308f(++_0x236cf3);}(_0x0795,0x14e));var _0x5079=function(_0x39719c,_0x1404a8){_0x39719c=_0x39719c-0x0;var _0x4893f3=_0x0795[_0x39719c];return _0x4893f3;};'use strict';var multer=require(_0x5079('0x0'));var util=require(_0x5079('0x1'));var path=require(_0x5079('0x2'));var timeout=require(_0x5079('0x3'));var express=require('express');var router=express[_0x5079('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x5079('0x5'));var interaction=require(_0x5079('0x6'));var config=require(_0x5079('0x7'));var controller=require(_0x5079('0x8'));router['get']('/',controller[_0x5079('0x9')]);module[_0x5079('0xa')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index dbf0089..4c158d0 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 _0xebc3=['exports','STRING','version','sequelize'];(function(_0x295148,_0x585dfa){var _0xaf3076=function(_0x43ecd6){while(--_0x43ecd6){_0x295148['push'](_0x295148['shift']());}};_0xaf3076(++_0x585dfa);}(_0xebc3,0x7f));var _0x3ebc=function(_0x5b39f3,_0x1bc28a){_0x5b39f3=_0x5b39f3-0x0;var _0xfec1fa=_0xebc3[_0x5b39f3];return _0xfec1fa;};'use strict';var Sequelize=require(_0x3ebc('0x0'));module[_0x3ebc('0x1')]={'version':{'type':Sequelize[_0x3ebc('0x2')],'unique':_0x3ebc('0x3')}}; \ No newline at end of file +var _0x02e4=['version','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x02e4,0x89));var _0x402e=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x02e4[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require('sequelize');module[_0x402e('0x0')]={'version':{'type':Sequelize['STRING'],'unique':_0x402e('0x1')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 6283175..25817a9 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 _0x96e6=['index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','length','nolimit','offset','sort','pick','where','merge','VIRTUAL','filter','options','Migration','includeAll','include','findAll','rows','catch','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send'];(function(_0xbf8ebe,_0x3b69a5){var _0x1e25e8=function(_0x40c390){while(--_0x40c390){_0xbf8ebe['push'](_0xbf8ebe['shift']());}};_0x1e25e8(++_0x3b69a5);}(_0x96e6,0xab));var _0x696e=function(_0x405e28,_0x2ab3a9){_0x405e28=_0x405e28-0x0;var _0x5c2877=_0x96e6[_0x405e28];return _0x5c2877;};'use strict';var emlformat=require(_0x696e('0x0'));var rimraf=require(_0x696e('0x1'));var zipdir=require(_0x696e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x696e('0x3'));var moment=require(_0x696e('0x4'));var BPromise=require(_0x696e('0x5'));var Mustache=require(_0x696e('0x6'));var util=require(_0x696e('0x7'));var path=require('path');var sox=require(_0x696e('0x8'));var csv=require('to-csv');var ejs=require(_0x696e('0x9'));var fs=require('fs');var fs_extra=require(_0x696e('0xa'));var _=require('lodash');var squel=require(_0x696e('0xb'));var crypto=require('crypto');var jsforce=require(_0x696e('0xc'));var deskjs=require(_0x696e('0xd'));var toCsv=require(_0x696e('0xe'));var querystring=require(_0x696e('0xf'));var Papa=require(_0x696e('0x10'));var Redis=require(_0x696e('0x11'));var authService=require(_0x696e('0x12'));var qs=require(_0x696e('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x696e('0x14'));var logger=require(_0x696e('0x15'))(_0x696e('0x16'));var utils=require(_0x696e('0x17'));var config=require(_0x696e('0x18'));var licenseUtil=require(_0x696e('0x19'));var db=require(_0x696e('0x1a'))['db'];function respondWithStatusCode(_0x5099da,_0x45e036){_0x45e036=_0x45e036||0xcc;return function(_0x37cbbc){if(_0x37cbbc){return _0x5099da[_0x696e('0x1b')](_0x45e036);}return _0x5099da['status'](_0x45e036)[_0x696e('0x1c')]();};}function respondWithResult(_0x281b9e,_0xe9464f){_0xe9464f=_0xe9464f||0xc8;return function(_0x272cb3){if(_0x272cb3){return _0x281b9e[_0x696e('0x1d')](_0xe9464f)[_0x696e('0x1e')](_0x272cb3);}};}function respondWithFilteredResult(_0x4ebaaa,_0x2dda8a){return function(_0x301d61){if(_0x301d61){var _0xe7f7ab=typeof _0x2dda8a['offset']===_0x696e('0x1f')&&typeof _0x2dda8a[_0x696e('0x20')]==='undefined';var _0x5d9872=_0x301d61[_0x696e('0x21')];var _0x4b642c=_0xe7f7ab?0x0:_0x2dda8a['offset'];var _0x1f1e86=_0xe7f7ab?_0x301d61[_0x696e('0x21')]:_0x2dda8a['offset']+_0x2dda8a[_0x696e('0x20')];var _0x147cb5;if(_0x1f1e86>=_0x5d9872){_0x1f1e86=_0x5d9872;_0x147cb5=0xc8;}else{_0x147cb5=0xce;}_0x4ebaaa[_0x696e('0x1d')](_0x147cb5);return _0x4ebaaa[_0x696e('0x22')](_0x696e('0x23'),_0x4b642c+'-'+_0x1f1e86+'/'+_0x5d9872)[_0x696e('0x1e')](_0x301d61);}return null;};}function patchUpdates(_0xfa1fad){return function(_0x5b68ff){try{jsonpatch[_0x696e('0x24')](_0x5b68ff,_0xfa1fad,!![]);}catch(_0x57e266){return BPromise[_0x696e('0x25')](_0x57e266);}return _0x5b68ff[_0x696e('0x26')]();};}function saveUpdates(_0x502853,_0xc2263b){return function(_0x192f7d){if(_0x192f7d){return _0x192f7d['update'](_0x502853)[_0x696e('0x27')](function(_0x80fe6f){return _0x80fe6f;});}return null;};}function removeEntity(_0x20b5a0,_0x2ba634){return function(_0x3d763b){if(_0x3d763b){return _0x3d763b[_0x696e('0x28')]()[_0x696e('0x27')](function(){_0x20b5a0[_0x696e('0x1d')](0xcc)[_0x696e('0x1c')]();});}};}function handleEntityNotFound(_0x14ba2d,_0x2027ab){return function(_0x518608){if(!_0x518608){_0x14ba2d[_0x696e('0x1b')](0x194);}return _0x518608;};}function handleError(_0x2e1db7,_0x174078){_0x174078=_0x174078||0x1f4;return function(_0x2b36c6){logger[_0x696e('0x29')](_0x2b36c6[_0x696e('0x2a')]);if(_0x2b36c6[_0x696e('0x2b')]){delete _0x2b36c6[_0x696e('0x2b')];}_0x2e1db7['status'](_0x174078)[_0x696e('0x2c')](_0x2b36c6);};}exports[_0x696e('0x2d')]=function(_0x511aec,_0xf57565){var _0x39627e={},_0x4355b3={},_0x2008f4={'count':0x0,'rows':[]};var _0x5f18c2=_[_0x696e('0x2e')](db['Migration'][_0x696e('0x2f')],function(_0x22dea9){return{'name':_0x22dea9[_0x696e('0x30')],'type':_0x22dea9['type'][_0x696e('0x31')]};});_0x4355b3[_0x696e('0x32')]=_[_0x696e('0x2e')](_0x5f18c2,_0x696e('0x2b'));_0x4355b3[_0x696e('0x33')]=_[_0x696e('0x34')](_0x511aec[_0x696e('0x33')]);_0x4355b3[_0x696e('0x35')]=_[_0x696e('0x36')](_0x4355b3[_0x696e('0x32')],_0x4355b3[_0x696e('0x33')]);_0x39627e[_0x696e('0x37')]=_[_0x696e('0x36')](_0x4355b3[_0x696e('0x32')],qs['fields'](_0x511aec[_0x696e('0x33')]['fields']));_0x39627e[_0x696e('0x37')]=_0x39627e['attributes'][_0x696e('0x38')]?_0x39627e['attributes']:_0x4355b3['model'];if(!_0x511aec[_0x696e('0x33')]['hasOwnProperty'](_0x696e('0x39'))){_0x39627e[_0x696e('0x20')]=qs[_0x696e('0x20')](_0x511aec['query'][_0x696e('0x20')]);_0x39627e[_0x696e('0x3a')]=qs[_0x696e('0x3a')](_0x511aec[_0x696e('0x33')][_0x696e('0x3a')]);}_0x39627e['order']=qs[_0x696e('0x3b')](_0x511aec[_0x696e('0x33')][_0x696e('0x3b')]);_0x39627e['where']=qs[_0x696e('0x35')](_[_0x696e('0x3c')](_0x511aec[_0x696e('0x33')],_0x4355b3[_0x696e('0x35')]),_0x5f18c2);if(_0x511aec[_0x696e('0x33')]['filter']){_0x39627e[_0x696e('0x3d')]=_[_0x696e('0x3e')](_0x39627e['where'],{'$or':_['map'](_0x5f18c2,function(_0x14d4fa){if(_0x14d4fa['type']!==_0x696e('0x3f')){var _0x16dca4={};_0x16dca4[_0x14d4fa[_0x696e('0x2b')]]={'$like':'%'+_0x511aec[_0x696e('0x33')][_0x696e('0x40')]+'%'};return _0x16dca4;}})});}_0x39627e=_[_0x696e('0x3e')]({},_0x39627e,_0x511aec[_0x696e('0x41')]);var _0x5e828b={'where':_0x39627e['where']};return db[_0x696e('0x42')][_0x696e('0x21')](_0x5e828b)['then'](function(_0x32a427){_0x2008f4[_0x696e('0x21')]=_0x32a427;if(_0x511aec[_0x696e('0x33')][_0x696e('0x43')]){_0x39627e[_0x696e('0x44')]=[{'all':!![]}];}return db[_0x696e('0x42')][_0x696e('0x45')](_0x39627e);})[_0x696e('0x27')](function(_0x29e04b){_0x2008f4[_0x696e('0x46')]=_0x29e04b;return _0x2008f4;})['then'](respondWithFilteredResult(_0xf57565,_0x39627e))[_0x696e('0x47')](handleError(_0xf57565,null));}; \ No newline at end of file +var _0xff7b=['undefined','limit','count','set','apply','reject','update','then','destroy','end','error','stack','name','index','map','rawAttributes','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','type','VIRTUAL','merge','options','Migration','include','rows','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xff7b,0xe8));var _0xbff7=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xff7b[_0x42cae2];return _0x5f256f;};'use strict';var emlformat=require(_0xbff7('0x0'));var rimraf=require(_0xbff7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbff7('0x2'));var rp=require(_0xbff7('0x3'));var moment=require('moment');var BPromise=require(_0xbff7('0x4'));var Mustache=require(_0xbff7('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xbff7('0x6'));var fs=require('fs');var fs_extra=require(_0xbff7('0x7'));var _=require('lodash');var squel=require(_0xbff7('0x8'));var crypto=require(_0xbff7('0x9'));var jsforce=require(_0xbff7('0xa'));var deskjs=require(_0xbff7('0xb'));var toCsv=require(_0xbff7('0xc'));var querystring=require(_0xbff7('0xd'));var Papa=require(_0xbff7('0xe'));var Redis=require(_0xbff7('0xf'));var authService=require(_0xbff7('0x10'));var qs=require(_0xbff7('0x11'));var as=require(_0xbff7('0x12'));var hardwareService=require(_0xbff7('0x13'));var logger=require(_0xbff7('0x14'))('api');var utils=require(_0xbff7('0x15'));var config=require(_0xbff7('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xbff7('0x17'))['db'];function respondWithStatusCode(_0x543c58,_0x26f0d2){_0x26f0d2=_0x26f0d2||0xcc;return function(_0x94bcfa){if(_0x94bcfa){return _0x543c58[_0xbff7('0x18')](_0x26f0d2);}return _0x543c58[_0xbff7('0x19')](_0x26f0d2)['end']();};}function respondWithResult(_0x2df80b,_0x531b96){_0x531b96=_0x531b96||0xc8;return function(_0x1d1145){if(_0x1d1145){return _0x2df80b['status'](_0x531b96)[_0xbff7('0x1a')](_0x1d1145);}};}function respondWithFilteredResult(_0x71be25,_0x4b8b9b){return function(_0x3a3951){if(_0x3a3951){var _0x4d46fa=typeof _0x4b8b9b[_0xbff7('0x1b')]===_0xbff7('0x1c')&&typeof _0x4b8b9b[_0xbff7('0x1d')]===_0xbff7('0x1c');var _0x10618c=_0x3a3951[_0xbff7('0x1e')];var _0x2b4a85=_0x4d46fa?0x0:_0x4b8b9b[_0xbff7('0x1b')];var _0x165a86=_0x4d46fa?_0x3a3951[_0xbff7('0x1e')]:_0x4b8b9b[_0xbff7('0x1b')]+_0x4b8b9b[_0xbff7('0x1d')];var _0x1aecb6;if(_0x165a86>=_0x10618c){_0x165a86=_0x10618c;_0x1aecb6=0xc8;}else{_0x1aecb6=0xce;}_0x71be25[_0xbff7('0x19')](_0x1aecb6);return _0x71be25[_0xbff7('0x1f')]('Content-Range',_0x2b4a85+'-'+_0x165a86+'/'+_0x10618c)['json'](_0x3a3951);}return null;};}function patchUpdates(_0x1a18fb){return function(_0x20e97a){try{jsonpatch[_0xbff7('0x20')](_0x20e97a,_0x1a18fb,!![]);}catch(_0x37bdb6){return BPromise[_0xbff7('0x21')](_0x37bdb6);}return _0x20e97a['save']();};}function saveUpdates(_0x5b7159,_0x12caef){return function(_0x5461f9){if(_0x5461f9){return _0x5461f9[_0xbff7('0x22')](_0x5b7159)[_0xbff7('0x23')](function(_0x4592ee){return _0x4592ee;});}return null;};}function removeEntity(_0x4966f8,_0x5c58a4){return function(_0x339eac){if(_0x339eac){return _0x339eac[_0xbff7('0x24')]()[_0xbff7('0x23')](function(){_0x4966f8[_0xbff7('0x19')](0xcc)[_0xbff7('0x25')]();});}};}function handleEntityNotFound(_0x556978,_0x3381f7){return function(_0x2fdee8){if(!_0x2fdee8){_0x556978[_0xbff7('0x18')](0x194);}return _0x2fdee8;};}function handleError(_0x4ae781,_0x23966f){_0x23966f=_0x23966f||0x1f4;return function(_0x59595e){logger[_0xbff7('0x26')](_0x59595e[_0xbff7('0x27')]);if(_0x59595e[_0xbff7('0x28')]){delete _0x59595e['name'];}_0x4ae781[_0xbff7('0x19')](_0x23966f)['send'](_0x59595e);};}exports[_0xbff7('0x29')]=function(_0x10e074,_0x13cd7d){var _0x292851={},_0x1025d8={},_0x5cb9a7={'count':0x0,'rows':[]};var _0x53447b=_[_0xbff7('0x2a')](db['Migration'][_0xbff7('0x2b')],function(_0x15ea87){return{'name':_0x15ea87['fieldName'],'type':_0x15ea87['type']['key']};});_0x1025d8[_0xbff7('0x2c')]=_[_0xbff7('0x2a')](_0x53447b,_0xbff7('0x28'));_0x1025d8[_0xbff7('0x2d')]=_[_0xbff7('0x2e')](_0x10e074[_0xbff7('0x2d')]);_0x1025d8[_0xbff7('0x2f')]=_['intersection'](_0x1025d8[_0xbff7('0x2c')],_0x1025d8[_0xbff7('0x2d')]);_0x292851[_0xbff7('0x30')]=_[_0xbff7('0x31')](_0x1025d8[_0xbff7('0x2c')],qs['fields'](_0x10e074[_0xbff7('0x2d')][_0xbff7('0x32')]));_0x292851[_0xbff7('0x30')]=_0x292851[_0xbff7('0x30')][_0xbff7('0x33')]?_0x292851[_0xbff7('0x30')]:_0x1025d8[_0xbff7('0x2c')];if(!_0x10e074[_0xbff7('0x2d')][_0xbff7('0x34')](_0xbff7('0x35'))){_0x292851[_0xbff7('0x1d')]=qs[_0xbff7('0x1d')](_0x10e074[_0xbff7('0x2d')]['limit']);_0x292851[_0xbff7('0x1b')]=qs[_0xbff7('0x1b')](_0x10e074[_0xbff7('0x2d')][_0xbff7('0x1b')]);}_0x292851['order']=qs[_0xbff7('0x36')](_0x10e074[_0xbff7('0x2d')][_0xbff7('0x36')]);_0x292851[_0xbff7('0x37')]=qs['filters'](_[_0xbff7('0x38')](_0x10e074[_0xbff7('0x2d')],_0x1025d8[_0xbff7('0x2f')]),_0x53447b);if(_0x10e074[_0xbff7('0x2d')][_0xbff7('0x39')]){_0x292851[_0xbff7('0x37')]=_['merge'](_0x292851[_0xbff7('0x37')],{'$or':_[_0xbff7('0x2a')](_0x53447b,function(_0x5e2ae7){if(_0x5e2ae7[_0xbff7('0x3a')]!==_0xbff7('0x3b')){var _0x45f82f={};_0x45f82f[_0x5e2ae7[_0xbff7('0x28')]]={'$like':'%'+_0x10e074[_0xbff7('0x2d')]['filter']+'%'};return _0x45f82f;}})});}_0x292851=_[_0xbff7('0x3c')]({},_0x292851,_0x10e074[_0xbff7('0x3d')]);var _0x2e966b={'where':_0x292851[_0xbff7('0x37')]};return db[_0xbff7('0x3e')][_0xbff7('0x1e')](_0x2e966b)[_0xbff7('0x23')](function(_0x45e02d){_0x5cb9a7[_0xbff7('0x1e')]=_0x45e02d;if(_0x10e074[_0xbff7('0x2d')]['includeAll']){_0x292851[_0xbff7('0x3f')]=[{'all':!![]}];}return db[_0xbff7('0x3e')]['findAll'](_0x292851);})[_0xbff7('0x23')](function(_0x19456d){_0x5cb9a7[_0xbff7('0x40')]=_0x19456d;return _0x5cb9a7;})[_0xbff7('0x23')](respondWithFilteredResult(_0x13cd7d,_0x292851))['catch'](handleError(_0x13cd7d,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 4c36aa7..4aa406e 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 _0x1999=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./migration.attributes','exports','define','migrations','lodash','util','../../config/logger'];(function(_0x57fbc8,_0x5f1746){var _0xfcf1de=function(_0x368e6e){while(--_0x368e6e){_0x57fbc8['push'](_0x57fbc8['shift']());}};_0xfcf1de(++_0x5f1746);}(_0x1999,0xe7));var _0x9199=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x1999[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x9199('0x0'));var util=require(_0x9199('0x1'));var logger=require(_0x9199('0x2'))('api');var moment=require(_0x9199('0x3'));var BPromise=require(_0x9199('0x4'));var rp=require(_0x9199('0x5'));var fs=require('fs');var path=require(_0x9199('0x6'));var rimraf=require(_0x9199('0x7'));var config=require(_0x9199('0x8'));var attributes=require(_0x9199('0x9'));module[_0x9199('0xa')]=function(_0x204f37,_0x594660){return _0x204f37[_0x9199('0xb')]('Migration',attributes,{'tableName':_0x9199('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdfe4=['migrations','util','api','moment','bluebird','request-promise','path','rimraf','./migration.attributes','exports','define','Migration'];(function(_0x394562,_0x4260af){var _0x34c244=function(_0x1c8966){while(--_0x1c8966){_0x394562['push'](_0x394562['shift']());}};_0x34c244(++_0x4260af);}(_0xdfe4,0x175));var _0x4dfe=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xdfe4[_0x30ae5e];return _0x1f2e93;};'use strict';var _=require('lodash');var util=require(_0x4dfe('0x0'));var logger=require('../../config/logger')(_0x4dfe('0x1'));var moment=require(_0x4dfe('0x2'));var BPromise=require(_0x4dfe('0x3'));var rp=require(_0x4dfe('0x4'));var fs=require('fs');var path=require(_0x4dfe('0x5'));var rimraf=require(_0x4dfe('0x6'));var config=require('../../config/environment');var attributes=require(_0x4dfe('0x7'));module[_0x4dfe('0x8')]=function(_0x463f01,_0x5c75d1){return _0x463f01[_0x4dfe('0x9')](_0x4dfe('0xa'),attributes,{'tableName':_0x4dfe('0xb'),'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 48c33ec..a0cf165 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 _0xa571=['request','then','info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','jayson/promise','client','http'];(function(_0x2ab76b,_0x176579){var _0x201126=function(_0x11d8c8){while(--_0x11d8c8){_0x2ab76b['push'](_0x2ab76b['shift']());}};_0x201126(++_0x176579);}(_0xa571,0x107));var _0x1a57=function(_0x32b2bf,_0x64a61e){_0x32b2bf=_0x32b2bf-0x0;var _0x42756a=_0xa571[_0x32b2bf];return _0x42756a;};'use strict';var _=require(_0x1a57('0x0'));var util=require(_0x1a57('0x1'));var moment=require(_0x1a57('0x2'));var BPromise=require(_0x1a57('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1a57('0x4'));var db=require(_0x1a57('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1a57('0x6'));var config=require('../../config/environment');var jayson=require(_0x1a57('0x7'));var client=jayson[_0x1a57('0x8')][_0x1a57('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3c5352,_0x2492f5,_0x924873){return new BPromise(function(_0x5d9f45,_0x3edb40){return client[_0x1a57('0xa')](_0x3c5352,_0x924873)[_0x1a57('0xb')](function(_0x58e266){logger[_0x1a57('0xc')](_0x1a57('0xd'),_0x2492f5,_0x1a57('0xe'));logger[_0x1a57('0xf')](_0x1a57('0x10'),_0x2492f5,_0x1a57('0xe'),JSON[_0x1a57('0x11')](_0x58e266));if(_0x58e266[_0x1a57('0x12')]){if(_0x58e266['error']['code']===0x1f4){logger[_0x1a57('0x12')](_0x1a57('0xd'),_0x2492f5,_0x58e266[_0x1a57('0x12')]['message']);return _0x3edb40(_0x58e266[_0x1a57('0x12')][_0x1a57('0x13')]);}logger['error'](_0x1a57('0xd'),_0x2492f5,_0x58e266['error'][_0x1a57('0x13')]);return _0x5d9f45(_0x58e266[_0x1a57('0x12')][_0x1a57('0x13')]);}else{logger[_0x1a57('0xc')]('Migration,\x20%s,\x20%s',_0x2492f5,_0x1a57('0xe'));_0x5d9f45(_0x58e266['result']['message']);}})[_0x1a57('0x14')](function(_0x1c537f){logger[_0x1a57('0x12')]('Migration,\x20%s,\x20%s',_0x2492f5,_0x1c537f);_0x3edb40(_0x1c537f);});});} \ No newline at end of file +var _0xe28e=['../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','stringify','error','code','Migration,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x54336b,_0x48b028){var _0x5b64a3=function(_0x4db3e5){while(--_0x4db3e5){_0x54336b['push'](_0x54336b['shift']());}};_0x5b64a3(++_0x48b028);}(_0xe28e,0x1ba));var _0xee28=function(_0x58083f,_0x314c1e){_0x58083f=_0x58083f-0x0;var _0x13d7b7=_0xe28e[_0x58083f];return _0x13d7b7;};'use strict';var _=require(_0xee28('0x0'));var util=require(_0xee28('0x1'));var moment=require(_0xee28('0x2'));var BPromise=require(_0xee28('0x3'));var rs=require(_0xee28('0x4'));var fs=require('fs');var Redis=require(_0xee28('0x5'));var db=require(_0xee28('0x6'))['db'];var utils=require(_0xee28('0x7'));var logger=require(_0xee28('0x8'))(_0xee28('0x9'));var config=require(_0xee28('0xa'));var jayson=require(_0xee28('0xb'));var client=jayson[_0xee28('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x39b337,_0x30224a,_0x3f9bd9){return new BPromise(function(_0x66d0b6,_0x156aad){return client[_0xee28('0xd')](_0x39b337,_0x3f9bd9)[_0xee28('0xe')](function(_0x5d7562){logger['info']('Migration,\x20%s,\x20%s',_0x30224a,_0xee28('0xf'));logger[_0xee28('0x10')]('Migration,\x20%s,\x20%s,\x20%s',_0x30224a,_0xee28('0xf'),JSON[_0xee28('0x11')](_0x5d7562));if(_0x5d7562['error']){if(_0x5d7562[_0xee28('0x12')][_0xee28('0x13')]===0x1f4){logger[_0xee28('0x12')](_0xee28('0x14'),_0x30224a,_0x5d7562[_0xee28('0x12')][_0xee28('0x15')]);return _0x156aad(_0x5d7562[_0xee28('0x12')]['message']);}logger[_0xee28('0x12')](_0xee28('0x14'),_0x30224a,_0x5d7562[_0xee28('0x12')][_0xee28('0x15')]);return _0x66d0b6(_0x5d7562[_0xee28('0x12')]['message']);}else{logger[_0xee28('0x16')](_0xee28('0x14'),_0x30224a,_0xee28('0xf'));_0x66d0b6(_0x5d7562[_0xee28('0x17')][_0xee28('0x15')]);}})[_0xee28('0x18')](function(_0x4c0eb9){logger[_0xee28('0x12')]('Migration,\x20%s,\x20%s',_0x30224a,_0x4c0eb9);_0x156aad(_0x4c0eb9);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index dad1179..3255504 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 _0x7d37=['fs-extra','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','create','update','destroy','exports','multer','util','path','express','Router'];(function(_0x162df5,_0x431ca5){var _0x2eef64=function(_0x1d8878){while(--_0x1d8878){_0x162df5['push'](_0x162df5['shift']());}};_0x2eef64(++_0x431ca5);}(_0x7d37,0x1db));var _0x77d3=function(_0x3727e9,_0x24db0a){_0x3727e9=_0x3727e9-0x0;var _0x2598c4=_0x7d37[_0x3727e9];return _0x2598c4;};'use strict';var multer=require(_0x77d3('0x0'));var util=require(_0x77d3('0x1'));var path=require(_0x77d3('0x2'));var timeout=require('connect-timeout');var express=require(_0x77d3('0x3'));var router=express[_0x77d3('0x4')]();var fs_extra=require(_0x77d3('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x77d3('0x6'));var config=require(_0x77d3('0x7'));var controller=require('./network.controller');router[_0x77d3('0x8')]('/',auth['isAuthenticated'](),controller[_0x77d3('0x9')]);router['get'](_0x77d3('0xa'),auth[_0x77d3('0xb')](),controller['show']);router['post']('/',auth[_0x77d3('0xb')](),controller[_0x77d3('0xc')]);router['put'](_0x77d3('0xa'),auth['isAuthenticated'](),controller[_0x77d3('0xd')]);router['delete'](_0x77d3('0xa'),auth['isAuthenticated'](),controller[_0x77d3('0xe')]);module[_0x77d3('0xf')]=router; \ No newline at end of file +var _0x1bec=['path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./network.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports'];(function(_0x38aa55,_0x527d35){var _0x4e951f=function(_0x4c91cb){while(--_0x4c91cb){_0x38aa55['push'](_0x38aa55['shift']());}};_0x4e951f(++_0x527d35);}(_0x1bec,0x168));var _0xc1be=function(_0x264e7f,_0x4b8f91){_0x264e7f=_0x264e7f-0x0;var _0x173e6e=_0x1bec[_0x264e7f];return _0x173e6e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc1be('0x0'));var timeout=require('connect-timeout');var express=require(_0xc1be('0x1'));var router=express[_0xc1be('0x2')]();var fs_extra=require(_0xc1be('0x3'));var auth=require(_0xc1be('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xc1be('0x5'));var controller=require(_0xc1be('0x6'));router[_0xc1be('0x7')]('/',auth[_0xc1be('0x8')](),controller[_0xc1be('0x9')]);router[_0xc1be('0x7')](_0xc1be('0xa'),auth[_0xc1be('0x8')](),controller[_0xc1be('0xb')]);router[_0xc1be('0xc')]('/',auth['isAuthenticated'](),controller[_0xc1be('0xd')]);router[_0xc1be('0xe')](_0xc1be('0xa'),auth['isAuthenticated'](),controller[_0xc1be('0xf')]);router['delete'](_0xc1be('0xa'),auth[_0xc1be('0x8')](),controller[_0xc1be('0x10')]);module[_0xc1be('0x11')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 760bd31..86d4557 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 _0x417c=['STRING','exports','ENUM','localnet','externip','stun','turn'];(function(_0x153fb3,_0x547cb0){var _0x12a556=function(_0x15e924){while(--_0x15e924){_0x153fb3['push'](_0x153fb3['shift']());}};_0x12a556(++_0x547cb0);}(_0x417c,0x1c1));var _0xc417=function(_0x1c0c68,_0x783954){_0x1c0c68=_0x1c0c68-0x0;var _0x2c98fa=_0x417c[_0x1c0c68];return _0x2c98fa;};'use strict';var Sequelize=require('sequelize');module[_0xc417('0x0')]={'type':{'type':Sequelize[_0xc417('0x1')](_0xc417('0x2'),_0xc417('0x3'),_0xc417('0x4'),_0xc417('0x5'))},'value':{'type':Sequelize[_0xc417('0x6')]},'username':{'type':Sequelize[_0xc417('0x6')]},'password':{'type':Sequelize[_0xc417('0x6')]}}; \ No newline at end of file +var _0x6b91=['stun','STRING','sequelize','exports','ENUM','externip'];(function(_0x2f5b0d,_0x2a64d2){var _0x3530fc=function(_0x5390fe){while(--_0x5390fe){_0x2f5b0d['push'](_0x2f5b0d['shift']());}};_0x3530fc(++_0x2a64d2);}(_0x6b91,0x9e));var _0x16b9=function(_0x481ad0,_0x8f10dc){_0x481ad0=_0x481ad0-0x0;var _0x207245=_0x6b91[_0x481ad0];return _0x207245;};'use strict';var Sequelize=require(_0x16b9('0x0'));module[_0x16b9('0x1')]={'type':{'type':Sequelize[_0x16b9('0x2')]('localnet',_0x16b9('0x3'),_0x16b9('0x4'),'turn')},'value':{'type':Sequelize[_0x16b9('0x5')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x16b9('0x5')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index fb549c4..fd128f7 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 _0xa0b6=['server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','format','toLowerCase','chan_sip.so','readFileSync','server/files/templates/turn_multiple.ejs','/etc/asterisk/sip_xcally_%s.conf','destroy','util','path','ejs','lodash','../../components/parsers/qs','../../config/environment','../../mysqldb','jayson/promise','http','request','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','status','undefined','limit','count','offset','Content-Range','update','then','end','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','Network','find','create','body','toUpperCase','STUN','join','root'];(function(_0x22fbdf,_0xb8a923){var _0x16b602=function(_0xfc1f3d){while(--_0xfc1f3d){_0x22fbdf['push'](_0x22fbdf['shift']());}};_0x16b602(++_0xb8a923);}(_0xa0b6,0x169));var _0x6a0b=function(_0x1d24eb,_0x12295b){_0x1d24eb=_0x1d24eb-0x0;var _0x1dc576=_0xa0b6[_0x1d24eb];return _0x1dc576;};'use strict';var util=require(_0x6a0b('0x0'));var path=require(_0x6a0b('0x1'));var ejs=require(_0x6a0b('0x2'));var fs=require('fs');var _=require(_0x6a0b('0x3'));var qs=require(_0x6a0b('0x4'));var logger=require('../../config/logger')('api');var config=require(_0x6a0b('0x5'));var db=require(_0x6a0b('0x6'))['db'];var jayson=require(_0x6a0b('0x7'));var client=jayson['client'][_0x6a0b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x92ae31,_0xafd29d,_0x5aa2e1,_0x44ffb6){return new Promise(function(_0x588eef,_0x1e73e7){var _0x27069f=_0x44ffb6||client;return _0x27069f[_0x6a0b('0x9')](_0x92ae31,_0x5aa2e1)['then'](function(_0x5e0298){logger['info'](_0x6a0b('0xa'),_0xafd29d,_0x6a0b('0xb'));logger[_0x6a0b('0xc')](_0x6a0b('0xd'),_0xafd29d,_0x6a0b('0xb'),JSON[_0x6a0b('0xe')](_0x5e0298));if(_0x5e0298[_0x6a0b('0xf')]){if(_0x5e0298[_0x6a0b('0xf')]['code']===0x1f4){logger[_0x6a0b('0xf')](_0x6a0b('0xa'),_0xafd29d,_0x5e0298[_0x6a0b('0xf')][_0x6a0b('0x10')]);return _0x1e73e7(_0x5e0298[_0x6a0b('0xf')][_0x6a0b('0x10')]);}logger[_0x6a0b('0xf')](_0x6a0b('0xa'),_0xafd29d,_0x5e0298['error'][_0x6a0b('0x10')]);return _0x588eef(_0x5e0298[_0x6a0b('0xf')][_0x6a0b('0x10')]);}else{logger['info'](_0x6a0b('0xa'),_0xafd29d,_0x6a0b('0xb'));_0x588eef(_0x5e0298[_0x6a0b('0x11')][_0x6a0b('0x10')]);}})[_0x6a0b('0x12')](function(_0x18fc75){logger['error'](_0x6a0b('0xa'),_0xafd29d,_0x18fc75);_0x1e73e7(_0x18fc75);});});}function respondWithResult(_0x46ed37,_0x20bbe0){_0x20bbe0=_0x20bbe0||0xc8;return function(_0x4d92d5){if(_0x4d92d5){return _0x46ed37[_0x6a0b('0x13')](_0x20bbe0)['json'](_0x4d92d5);}};}function respondWithFilteredResult(_0x1e8718,_0x123242){return function(_0x3d8f69){if(_0x3d8f69){var _0x182acb=typeof _0x123242['offset']===_0x6a0b('0x14')&&typeof _0x123242[_0x6a0b('0x15')]==='undefined';var _0x4d3a57=_0x3d8f69[_0x6a0b('0x16')];var _0x46c681=_0x182acb?0x0:_0x123242['offset'];var _0x10cef1=_0x182acb?_0x3d8f69['count']:_0x123242[_0x6a0b('0x17')]+_0x123242[_0x6a0b('0x15')];var _0x243af3;if(_0x10cef1>=_0x4d3a57){_0x10cef1=_0x4d3a57;_0x243af3=0xc8;}else{_0x243af3=0xce;}_0x1e8718[_0x6a0b('0x13')](_0x243af3);return _0x1e8718['set'](_0x6a0b('0x18'),_0x46c681+'-'+_0x10cef1+'/'+_0x4d3a57)['json'](_0x3d8f69);}return null;};}function saveUpdates(_0xe56aaf){return function(_0x482c6c){if(_0x482c6c){return _0x482c6c[_0x6a0b('0x19')](_0xe56aaf)[_0x6a0b('0x1a')](function(_0x110914){return _0x110914;});}return null;};}function removeEntity(_0xd14208){return function(_0x26a43a){if(_0x26a43a){return _0x26a43a['destroy']()[_0x6a0b('0x1a')](function(){_0xd14208['status'](0xcc)[_0x6a0b('0x1b')]();});}};}function handleEntityNotFound(_0x1fafe0){return function(_0x596cdc){if(!_0x596cdc){_0x1fafe0[_0x6a0b('0x1c')](0x194);}return _0x596cdc;};}function handleError(_0x5ada2f,_0x457190){_0x457190=_0x457190||0x1f4;return function(_0x6431b7){logger['error'](_0x6431b7[_0x6a0b('0x1d')]);if(_0x6431b7[_0x6a0b('0x1e')]){delete _0x6431b7['name'];}_0x5ada2f[_0x6a0b('0x13')](_0x457190)[_0x6a0b('0x1f')](_0x6431b7);};}exports[_0x6a0b('0x20')]=function(_0xb775c1,_0x251212){var _0x21557a={},_0x7c3904={},_0x9e3d55={'count':0x0,'rows':[]};var _0x1ab39e=_[_0x6a0b('0x21')](db['Network'][_0x6a0b('0x22')],function(_0x53c772){return{'name':_0x53c772[_0x6a0b('0x23')],'type':_0x53c772[_0x6a0b('0x24')][_0x6a0b('0x25')]};});_0x7c3904['model']=_[_0x6a0b('0x21')](_0x1ab39e,_0x6a0b('0x1e'));_0x7c3904[_0x6a0b('0x26')]=_[_0x6a0b('0x27')](_0xb775c1['query']);_0x7c3904['filters']=_['intersection'](_0x7c3904[_0x6a0b('0x28')],_0x7c3904[_0x6a0b('0x26')]);_0x21557a[_0x6a0b('0x29')]=_[_0x6a0b('0x2a')](_0x7c3904[_0x6a0b('0x28')],qs[_0x6a0b('0x2b')](_0xb775c1[_0x6a0b('0x26')]['fields']));_0x21557a[_0x6a0b('0x29')]=_0x21557a[_0x6a0b('0x29')][_0x6a0b('0x2c')]?_0x21557a[_0x6a0b('0x29')]:_0x7c3904[_0x6a0b('0x28')];if(!_0xb775c1['query'][_0x6a0b('0x2d')](_0x6a0b('0x2e'))){_0x21557a[_0x6a0b('0x15')]=qs[_0x6a0b('0x15')](_0xb775c1[_0x6a0b('0x26')][_0x6a0b('0x15')]);_0x21557a[_0x6a0b('0x17')]=qs['offset'](_0xb775c1[_0x6a0b('0x26')][_0x6a0b('0x17')]);}_0x21557a[_0x6a0b('0x2f')]=qs[_0x6a0b('0x30')](_0xb775c1[_0x6a0b('0x26')][_0x6a0b('0x30')]);_0x21557a[_0x6a0b('0x31')]=qs[_0x6a0b('0x32')](_[_0x6a0b('0x33')](_0xb775c1[_0x6a0b('0x26')],_0x7c3904['filters']),_0x1ab39e);if(_0xb775c1['query'][_0x6a0b('0x34')]){_0x21557a[_0x6a0b('0x31')]=_[_0x6a0b('0x35')](_0x21557a[_0x6a0b('0x31')],{'$or':_[_0x6a0b('0x21')](_0x1ab39e,function(_0xa9df0){if(_0xa9df0['type']!==_0x6a0b('0x36')){var _0x2a88cc={};_0x2a88cc[_0xa9df0[_0x6a0b('0x1e')]]={'$like':'%'+_0xb775c1[_0x6a0b('0x26')]['filter']+'%'};return _0x2a88cc;}})});}_0x21557a=_[_0x6a0b('0x35')]({},_0x21557a,_0xb775c1[_0x6a0b('0x37')]);var _0x44ca3c={'where':_0x21557a[_0x6a0b('0x31')]};return db['Network'][_0x6a0b('0x16')](_0x44ca3c)[_0x6a0b('0x1a')](function(_0x4e9ca2){_0x9e3d55[_0x6a0b('0x16')]=_0x4e9ca2;if(_0xb775c1['query'][_0x6a0b('0x38')]){_0x21557a[_0x6a0b('0x39')]=[{'all':!![]}];}return db['Network'][_0x6a0b('0x3a')](_0x21557a);})[_0x6a0b('0x1a')](function(_0x10f2a0){_0x9e3d55['rows']=_0x10f2a0;return _0x9e3d55;})[_0x6a0b('0x1a')](respondWithFilteredResult(_0x251212,_0x21557a))[_0x6a0b('0x12')](handleError(_0x251212,null));};exports[_0x6a0b('0x3b')]=function(_0x5d8a1a,_0x46c008){var _0x57288d={'raw':!![],'where':{'id':_0x5d8a1a[_0x6a0b('0x3c')]['id']}},_0x55a7cd={};_0x55a7cd['model']=_[_0x6a0b('0x27')](db[_0x6a0b('0x3d')][_0x6a0b('0x22')]);_0x55a7cd[_0x6a0b('0x26')]=_[_0x6a0b('0x27')](_0x5d8a1a[_0x6a0b('0x26')]);_0x55a7cd[_0x6a0b('0x32')]=_[_0x6a0b('0x2a')](_0x55a7cd['model'],_0x55a7cd['query']);_0x57288d['attributes']=_[_0x6a0b('0x2a')](_0x55a7cd['model'],qs['fields'](_0x5d8a1a['query'][_0x6a0b('0x2b')]));_0x57288d[_0x6a0b('0x29')]=_0x57288d[_0x6a0b('0x29')][_0x6a0b('0x2c')]?_0x57288d['attributes']:_0x55a7cd[_0x6a0b('0x28')];if(_0x5d8a1a[_0x6a0b('0x26')][_0x6a0b('0x38')]){_0x57288d[_0x6a0b('0x39')]=[{'all':!![]}];}_0x57288d=_[_0x6a0b('0x35')]({},_0x57288d,_0x5d8a1a[_0x6a0b('0x37')]);return db[_0x6a0b('0x3d')][_0x6a0b('0x3e')](_0x57288d)['then'](handleEntityNotFound(_0x46c008,null))[_0x6a0b('0x1a')](respondWithResult(_0x46c008,null))[_0x6a0b('0x12')](handleError(_0x46c008,null));};exports[_0x6a0b('0x3f')]=function(_0x5eaa5c,_0x14a375){var _0x2f1137;return db[_0x6a0b('0x3d')]['create'](_0x5eaa5c[_0x6a0b('0x40')],{'raw':!![]})[_0x6a0b('0x1a')](function(_0x20a14e){_0x2f1137=_0x20a14e;return db[_0x6a0b('0x3d')][_0x6a0b('0x3a')]({'where':{'type':_0x5eaa5c[_0x6a0b('0x40')]['type']},'raw':!![]});})[_0x6a0b('0x1a')](function(_0x320e4d){if(_0x2f1137[_0x6a0b('0x24')][_0x6a0b('0x41')]()==_0x6a0b('0x42')){var _0x44583d=fs['readFileSync'](path[_0x6a0b('0x43')](config[_0x6a0b('0x44')],_0x6a0b('0x45')),_0x6a0b('0x46'));var _0x5960e2=ejs[_0x6a0b('0x47')](_0x44583d,{'networks':_0x320e4d||[]});fs[_0x6a0b('0x48')](_0x6a0b('0x49'),_0x5960e2);return respondWithRpcPromise(_0x6a0b('0x4a'),_0x6a0b('0x3f'),{'module':_0x6a0b('0x4b')});}else if(_0x2f1137[_0x6a0b('0x24')][_0x6a0b('0x41')]()==_0x6a0b('0x4c')){var _0x8398fd=fs['readFileSync'](path[_0x6a0b('0x43')](config[_0x6a0b('0x44')],'server/files/templates/turn_multiple.ejs'),_0x6a0b('0x46'));var _0x4e17a7=ejs['render'](_0x8398fd,{'networks':_0x320e4d||[]});fs[_0x6a0b('0x48')](_0x6a0b('0x4d'),_0x4e17a7);return respondWithRpcPromise(_0x6a0b('0x4a'),_0x6a0b('0x3f'),{'module':_0x6a0b('0x4b')});}else{var _0x301d66=fs['readFileSync'](path[_0x6a0b('0x43')](config['root'],_0x6a0b('0x4e')),_0x6a0b('0x46'));var _0x1d45ca=ejs[_0x6a0b('0x47')](_0x301d66,{'networks':_0x320e4d||[]});fs[_0x6a0b('0x48')](util[_0x6a0b('0x4f')]('/etc/asterisk/sip_xcally_%s.conf',_0x5eaa5c[_0x6a0b('0x40')]['type'][_0x6a0b('0x50')]()),_0x1d45ca);return respondWithRpcPromise(_0x6a0b('0x4a'),'create',{'module':_0x6a0b('0x51')});}})[_0x6a0b('0x1a')](function(){return _0x2f1137;})[_0x6a0b('0x1a')](respondWithResult(_0x14a375,0xc9))[_0x6a0b('0x12')](handleError(_0x14a375,null));};exports[_0x6a0b('0x19')]=function(_0x3980d9,_0x5badfe){var _0x526d9d;return db['Network'][_0x6a0b('0x3e')]({'where':{'id':_0x3980d9['params']['id']}})[_0x6a0b('0x1a')](handleEntityNotFound(_0x5badfe,null))[_0x6a0b('0x1a')](saveUpdates(_0x3980d9['body'],null))[_0x6a0b('0x1a')](function(_0x141383){if(_0x141383){_0x526d9d=_0x141383;return db[_0x6a0b('0x3d')][_0x6a0b('0x3a')]({'where':{'type':_0x526d9d[_0x6a0b('0x24')]},'raw':!![]});}return null;})[_0x6a0b('0x1a')](function(_0x1d6108){if(_0x526d9d[_0x6a0b('0x24')]['toUpperCase']()==_0x6a0b('0x42')){var _0x5db53a=fs[_0x6a0b('0x52')](path['join'](config[_0x6a0b('0x44')],'server/files/templates/stun_multiple.ejs'),_0x6a0b('0x46'));var _0x403977=ejs[_0x6a0b('0x47')](_0x5db53a,{'networks':_0x1d6108||[]});fs[_0x6a0b('0x48')](_0x6a0b('0x49'),_0x403977);return respondWithRpcPromise(_0x6a0b('0x4a'),_0x6a0b('0x19'),{'module':'res_stun_monitor.so'});}else if(_0x526d9d[_0x6a0b('0x24')][_0x6a0b('0x41')]()==_0x6a0b('0x4c')){var _0x4c44b5=fs[_0x6a0b('0x52')](path[_0x6a0b('0x43')](config[_0x6a0b('0x44')],_0x6a0b('0x53')),'utf8');var _0x5c4fb0=ejs[_0x6a0b('0x47')](_0x4c44b5,{'networks':_0x1d6108||[]});fs['writeFileSync']('/etc/asterisk/turn_xcally.conf',_0x5c4fb0);return respondWithRpcPromise(_0x6a0b('0x4a'),_0x6a0b('0x19'),{'module':_0x6a0b('0x4b')});}else{var _0x2697c6=fs[_0x6a0b('0x52')](path[_0x6a0b('0x43')](config[_0x6a0b('0x44')],_0x6a0b('0x4e')),_0x6a0b('0x46'));var _0x2e2976=ejs[_0x6a0b('0x47')](_0x2697c6,{'networks':_0x1d6108||[]});fs[_0x6a0b('0x48')](util[_0x6a0b('0x4f')](_0x6a0b('0x54'),_0x3980d9[_0x6a0b('0x40')][_0x6a0b('0x24')][_0x6a0b('0x50')]()),_0x2e2976);return respondWithRpcPromise(_0x6a0b('0x4a'),_0x6a0b('0x19'),{'module':_0x6a0b('0x51')});}})[_0x6a0b('0x1a')](function(_0x2a5a3b){if(_0x2a5a3b){return _0x526d9d;}return null;})['then'](respondWithResult(_0x5badfe,null))['catch'](handleError(_0x5badfe,null));};exports['destroy']=function(_0x1d7b51,_0x1b3195){var _0x2e6c48;return db[_0x6a0b('0x3d')][_0x6a0b('0x3e')]({'where':{'id':_0x1d7b51[_0x6a0b('0x3c')]['id']}})[_0x6a0b('0x1a')](function(_0x5719d2){_0x2e6c48=_0x5719d2;return _0x5719d2;})['then'](handleEntityNotFound(_0x1b3195,null))[_0x6a0b('0x1a')](removeEntity(_0x1b3195,null))['then'](function(){if(_0x2e6c48){return db[_0x6a0b('0x3d')][_0x6a0b('0x3a')]({'where':{'type':_0x2e6c48[_0x6a0b('0x24')]},'raw':!![]});}})[_0x6a0b('0x1a')](function(_0x382644){if(_0x2e6c48[_0x6a0b('0x24')][_0x6a0b('0x41')]()==_0x6a0b('0x42')){var _0x49a10b=fs[_0x6a0b('0x52')](path[_0x6a0b('0x43')](config[_0x6a0b('0x44')],_0x6a0b('0x45')),_0x6a0b('0x46'));var _0x1127eb=ejs[_0x6a0b('0x47')](_0x49a10b,{'networks':_0x382644||[]});fs[_0x6a0b('0x48')](_0x6a0b('0x49'),_0x1127eb);return respondWithRpcPromise('Reload',_0x6a0b('0x55'),{'module':_0x6a0b('0x4b')});}else if(_0x2e6c48[_0x6a0b('0x24')][_0x6a0b('0x41')]()==_0x6a0b('0x4c')){var _0x54fa2a=fs[_0x6a0b('0x52')](path[_0x6a0b('0x43')](config[_0x6a0b('0x44')],'server/files/templates/turn_multiple.ejs'),'utf8');var _0x4d3314=ejs['render'](_0x54fa2a,{'networks':_0x382644||[]});fs[_0x6a0b('0x48')](_0x6a0b('0x4d'),_0x4d3314);return respondWithRpcPromise(_0x6a0b('0x4a'),_0x6a0b('0x55'),{'module':_0x6a0b('0x4b')});}else{var _0x63e1dd=fs['readFileSync'](path[_0x6a0b('0x43')](config[_0x6a0b('0x44')],'server/files/templates/network.ejs'),'utf8');var _0x399b21=ejs[_0x6a0b('0x47')](_0x63e1dd,{'networks':_0x382644||[]});fs[_0x6a0b('0x48')](util['format']('/etc/asterisk/sip_xcally_%s.conf',_0x2e6c48[_0x6a0b('0x24')][_0x6a0b('0x50')]()),_0x399b21);return respondWithRpcPromise(_0x6a0b('0x4a'),'destroy',{'module':_0x6a0b('0x51')});}})[_0x6a0b('0x12')](handleError(_0x1b3195,null));}; \ No newline at end of file +var _0x3541=['readFileSync','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','TURN','server/files/templates/network.ejs','path','ejs','../../config/logger','api','../../mysqldb','client','request','then','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','json','undefined','limit','count','offset','status','set','update','destroy','end','sendStatus','stack','name','send','index','Network','rawAttributes','type','model','map','keys','query','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','show','params','intersection','includeAll','find','create','body','toUpperCase','STUN','join','root','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0x3541,0x19c));var _0x1354=function(_0x4d07cc,_0x587613){_0x4d07cc=_0x4d07cc-0x0;var _0x42de3b=_0x3541[_0x4d07cc];return _0x42de3b;};'use strict';var util=require('util');var path=require(_0x1354('0x0'));var ejs=require(_0x1354('0x1'));var fs=require('fs');var _=require('lodash');var qs=require('../../components/parsers/qs');var logger=require(_0x1354('0x2'))(_0x1354('0x3'));var config=require('../../config/environment');var db=require(_0x1354('0x4'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x1354('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0x405d10,_0x52b7e5,_0x22c604,_0x2583b2){return new Promise(function(_0x49d330,_0x3be150){var _0x5491a6=_0x2583b2||client;return _0x5491a6[_0x1354('0x6')](_0x405d10,_0x22c604)[_0x1354('0x7')](function(_0x4a98ba){logger['info'](_0x1354('0x8'),_0x52b7e5,_0x1354('0x9'));logger[_0x1354('0xa')](_0x1354('0xb'),_0x52b7e5,_0x1354('0x9'),JSON['stringify'](_0x4a98ba));if(_0x4a98ba[_0x1354('0xc')]){if(_0x4a98ba[_0x1354('0xc')]['code']===0x1f4){logger[_0x1354('0xc')](_0x1354('0x8'),_0x52b7e5,_0x4a98ba['error'][_0x1354('0xd')]);return _0x3be150(_0x4a98ba[_0x1354('0xc')]['message']);}logger[_0x1354('0xc')](_0x1354('0x8'),_0x52b7e5,_0x4a98ba[_0x1354('0xc')][_0x1354('0xd')]);return _0x49d330(_0x4a98ba[_0x1354('0xc')][_0x1354('0xd')]);}else{logger[_0x1354('0xe')](_0x1354('0x8'),_0x52b7e5,_0x1354('0x9'));_0x49d330(_0x4a98ba[_0x1354('0xf')][_0x1354('0xd')]);}})[_0x1354('0x10')](function(_0x2780c3){logger[_0x1354('0xc')](_0x1354('0x8'),_0x52b7e5,_0x2780c3);_0x3be150(_0x2780c3);});});}function respondWithResult(_0x5a12c9,_0x30cce9){_0x30cce9=_0x30cce9||0xc8;return function(_0x27766b){if(_0x27766b){return _0x5a12c9['status'](_0x30cce9)[_0x1354('0x11')](_0x27766b);}};}function respondWithFilteredResult(_0x38adda,_0x4f25d8){return function(_0x54cdf6){if(_0x54cdf6){var _0x22dda4=typeof _0x4f25d8['offset']===_0x1354('0x12')&&typeof _0x4f25d8[_0x1354('0x13')]==='undefined';var _0x256e4a=_0x54cdf6[_0x1354('0x14')];var _0x11b4da=_0x22dda4?0x0:_0x4f25d8['offset'];var _0x45ebe9=_0x22dda4?_0x54cdf6[_0x1354('0x14')]:_0x4f25d8[_0x1354('0x15')]+_0x4f25d8[_0x1354('0x13')];var _0x2cc2a2;if(_0x45ebe9>=_0x256e4a){_0x45ebe9=_0x256e4a;_0x2cc2a2=0xc8;}else{_0x2cc2a2=0xce;}_0x38adda[_0x1354('0x16')](_0x2cc2a2);return _0x38adda[_0x1354('0x17')]('Content-Range',_0x11b4da+'-'+_0x45ebe9+'/'+_0x256e4a)['json'](_0x54cdf6);}return null;};}function saveUpdates(_0x24307e){return function(_0x2eb3a5){if(_0x2eb3a5){return _0x2eb3a5[_0x1354('0x18')](_0x24307e)[_0x1354('0x7')](function(_0x3f9d84){return _0x3f9d84;});}return null;};}function removeEntity(_0x2e6405){return function(_0x53b15d){if(_0x53b15d){return _0x53b15d[_0x1354('0x19')]()[_0x1354('0x7')](function(){_0x2e6405[_0x1354('0x16')](0xcc)[_0x1354('0x1a')]();});}};}function handleEntityNotFound(_0x5ab6c3){return function(_0x3322d9){if(!_0x3322d9){_0x5ab6c3[_0x1354('0x1b')](0x194);}return _0x3322d9;};}function handleError(_0x594e64,_0x560852){_0x560852=_0x560852||0x1f4;return function(_0x20e2c9){logger[_0x1354('0xc')](_0x20e2c9[_0x1354('0x1c')]);if(_0x20e2c9[_0x1354('0x1d')]){delete _0x20e2c9[_0x1354('0x1d')];}_0x594e64['status'](_0x560852)[_0x1354('0x1e')](_0x20e2c9);};}exports[_0x1354('0x1f')]=function(_0x201035,_0x3234bf){var _0x1c11c9={},_0x15408e={},_0x325be0={'count':0x0,'rows':[]};var _0x599b4d=_['map'](db[_0x1354('0x20')][_0x1354('0x21')],function(_0x128c97){return{'name':_0x128c97['fieldName'],'type':_0x128c97[_0x1354('0x22')]['key']};});_0x15408e[_0x1354('0x23')]=_[_0x1354('0x24')](_0x599b4d,'name');_0x15408e['query']=_[_0x1354('0x25')](_0x201035[_0x1354('0x26')]);_0x15408e[_0x1354('0x27')]=_['intersection'](_0x15408e[_0x1354('0x23')],_0x15408e[_0x1354('0x26')]);_0x1c11c9[_0x1354('0x28')]=_['intersection'](_0x15408e[_0x1354('0x23')],qs[_0x1354('0x29')](_0x201035['query'][_0x1354('0x29')]));_0x1c11c9[_0x1354('0x28')]=_0x1c11c9['attributes'][_0x1354('0x2a')]?_0x1c11c9[_0x1354('0x28')]:_0x15408e[_0x1354('0x23')];if(!_0x201035[_0x1354('0x26')][_0x1354('0x2b')](_0x1354('0x2c'))){_0x1c11c9[_0x1354('0x13')]=qs[_0x1354('0x13')](_0x201035['query']['limit']);_0x1c11c9[_0x1354('0x15')]=qs[_0x1354('0x15')](_0x201035[_0x1354('0x26')]['offset']);}_0x1c11c9['order']=qs[_0x1354('0x2d')](_0x201035[_0x1354('0x26')][_0x1354('0x2d')]);_0x1c11c9['where']=qs['filters'](_[_0x1354('0x2e')](_0x201035[_0x1354('0x26')],_0x15408e[_0x1354('0x27')]),_0x599b4d);if(_0x201035[_0x1354('0x26')][_0x1354('0x2f')]){_0x1c11c9[_0x1354('0x30')]=_[_0x1354('0x31')](_0x1c11c9[_0x1354('0x30')],{'$or':_[_0x1354('0x24')](_0x599b4d,function(_0x55ccfb){if(_0x55ccfb[_0x1354('0x22')]!==_0x1354('0x32')){var _0x554906={};_0x554906[_0x55ccfb[_0x1354('0x1d')]]={'$like':'%'+_0x201035[_0x1354('0x26')]['filter']+'%'};return _0x554906;}})});}_0x1c11c9=_[_0x1354('0x31')]({},_0x1c11c9,_0x201035[_0x1354('0x33')]);var _0xb501b7={'where':_0x1c11c9[_0x1354('0x30')]};return db['Network'][_0x1354('0x14')](_0xb501b7)['then'](function(_0x1a6ece){_0x325be0[_0x1354('0x14')]=_0x1a6ece;if(_0x201035[_0x1354('0x26')]['includeAll']){_0x1c11c9[_0x1354('0x34')]=[{'all':!![]}];}return db['Network'][_0x1354('0x35')](_0x1c11c9);})[_0x1354('0x7')](function(_0x347d6c){_0x325be0['rows']=_0x347d6c;return _0x325be0;})[_0x1354('0x7')](respondWithFilteredResult(_0x3234bf,_0x1c11c9))[_0x1354('0x10')](handleError(_0x3234bf,null));};exports[_0x1354('0x36')]=function(_0xb081ab,_0x3d5e95){var _0x3d8ee5={'raw':!![],'where':{'id':_0xb081ab[_0x1354('0x37')]['id']}},_0x3bab5f={};_0x3bab5f[_0x1354('0x23')]=_[_0x1354('0x25')](db[_0x1354('0x20')]['rawAttributes']);_0x3bab5f[_0x1354('0x26')]=_[_0x1354('0x25')](_0xb081ab[_0x1354('0x26')]);_0x3bab5f[_0x1354('0x27')]=_[_0x1354('0x38')](_0x3bab5f['model'],_0x3bab5f[_0x1354('0x26')]);_0x3d8ee5['attributes']=_[_0x1354('0x38')](_0x3bab5f[_0x1354('0x23')],qs['fields'](_0xb081ab[_0x1354('0x26')][_0x1354('0x29')]));_0x3d8ee5['attributes']=_0x3d8ee5[_0x1354('0x28')]['length']?_0x3d8ee5[_0x1354('0x28')]:_0x3bab5f[_0x1354('0x23')];if(_0xb081ab['query'][_0x1354('0x39')]){_0x3d8ee5[_0x1354('0x34')]=[{'all':!![]}];}_0x3d8ee5=_[_0x1354('0x31')]({},_0x3d8ee5,_0xb081ab[_0x1354('0x33')]);return db['Network'][_0x1354('0x3a')](_0x3d8ee5)[_0x1354('0x7')](handleEntityNotFound(_0x3d5e95,null))[_0x1354('0x7')](respondWithResult(_0x3d5e95,null))[_0x1354('0x10')](handleError(_0x3d5e95,null));};exports['create']=function(_0x5ae282,_0x3d7717){var _0x32a01d;return db[_0x1354('0x20')][_0x1354('0x3b')](_0x5ae282['body'],{'raw':!![]})[_0x1354('0x7')](function(_0x2c97e4){_0x32a01d=_0x2c97e4;return db[_0x1354('0x20')][_0x1354('0x35')]({'where':{'type':_0x5ae282[_0x1354('0x3c')][_0x1354('0x22')]},'raw':!![]});})[_0x1354('0x7')](function(_0x39eebd){if(_0x32a01d[_0x1354('0x22')][_0x1354('0x3d')]()==_0x1354('0x3e')){var _0x237656=fs['readFileSync'](path[_0x1354('0x3f')](config[_0x1354('0x40')],_0x1354('0x41')),_0x1354('0x42'));var _0x29d33d=ejs[_0x1354('0x43')](_0x237656,{'networks':_0x39eebd||[]});fs[_0x1354('0x44')](_0x1354('0x45'),_0x29d33d);return respondWithRpcPromise(_0x1354('0x46'),_0x1354('0x3b'),{'module':_0x1354('0x47')});}else if(_0x32a01d[_0x1354('0x22')][_0x1354('0x3d')]()=='TURN'){var _0x1ae300=fs['readFileSync'](path[_0x1354('0x3f')](config[_0x1354('0x40')],_0x1354('0x48')),'utf8');var _0x5f56f4=ejs['render'](_0x1ae300,{'networks':_0x39eebd||[]});fs[_0x1354('0x44')](_0x1354('0x49'),_0x5f56f4);return respondWithRpcPromise(_0x1354('0x46'),'create',{'module':_0x1354('0x47')});}else{var _0x48ff35=fs[_0x1354('0x4a')](path[_0x1354('0x3f')](config['root'],'server/files/templates/network.ejs'),_0x1354('0x42'));var _0x36b20f=ejs[_0x1354('0x43')](_0x48ff35,{'networks':_0x39eebd||[]});fs[_0x1354('0x44')](util[_0x1354('0x4b')](_0x1354('0x4c'),_0x5ae282[_0x1354('0x3c')][_0x1354('0x22')][_0x1354('0x4d')]()),_0x36b20f);return respondWithRpcPromise(_0x1354('0x46'),_0x1354('0x3b'),{'module':_0x1354('0x4e')});}})[_0x1354('0x7')](function(){return _0x32a01d;})['then'](respondWithResult(_0x3d7717,0xc9))['catch'](handleError(_0x3d7717,null));};exports[_0x1354('0x18')]=function(_0x1aff37,_0x8199fd){var _0x9f808f;return db[_0x1354('0x20')][_0x1354('0x3a')]({'where':{'id':_0x1aff37[_0x1354('0x37')]['id']}})[_0x1354('0x7')](handleEntityNotFound(_0x8199fd,null))[_0x1354('0x7')](saveUpdates(_0x1aff37['body'],null))[_0x1354('0x7')](function(_0xd690d6){if(_0xd690d6){_0x9f808f=_0xd690d6;return db[_0x1354('0x20')]['findAll']({'where':{'type':_0x9f808f['type']},'raw':!![]});}return null;})[_0x1354('0x7')](function(_0x34a6bc){if(_0x9f808f[_0x1354('0x22')][_0x1354('0x3d')]()==_0x1354('0x3e')){var _0x44b64b=fs['readFileSync'](path[_0x1354('0x3f')](config['root'],'server/files/templates/stun_multiple.ejs'),_0x1354('0x42'));var _0x9c56a4=ejs[_0x1354('0x43')](_0x44b64b,{'networks':_0x34a6bc||[]});fs[_0x1354('0x44')](_0x1354('0x45'),_0x9c56a4);return respondWithRpcPromise(_0x1354('0x46'),_0x1354('0x18'),{'module':_0x1354('0x47')});}else if(_0x9f808f['type']['toUpperCase']()==_0x1354('0x4f')){var _0x448efc=fs[_0x1354('0x4a')](path[_0x1354('0x3f')](config[_0x1354('0x40')],_0x1354('0x48')),_0x1354('0x42'));var _0x541ecf=ejs[_0x1354('0x43')](_0x448efc,{'networks':_0x34a6bc||[]});fs[_0x1354('0x44')](_0x1354('0x49'),_0x541ecf);return respondWithRpcPromise(_0x1354('0x46'),_0x1354('0x18'),{'module':'res_stun_monitor.so'});}else{var _0x2070d6=fs[_0x1354('0x4a')](path[_0x1354('0x3f')](config[_0x1354('0x40')],_0x1354('0x50')),_0x1354('0x42'));var _0x3bc97e=ejs[_0x1354('0x43')](_0x2070d6,{'networks':_0x34a6bc||[]});fs['writeFileSync'](util[_0x1354('0x4b')](_0x1354('0x4c'),_0x1aff37[_0x1354('0x3c')][_0x1354('0x22')][_0x1354('0x4d')]()),_0x3bc97e);return respondWithRpcPromise('Reload',_0x1354('0x18'),{'module':_0x1354('0x4e')});}})[_0x1354('0x7')](function(_0x567072){if(_0x567072){return _0x9f808f;}return null;})[_0x1354('0x7')](respondWithResult(_0x8199fd,null))[_0x1354('0x10')](handleError(_0x8199fd,null));};exports[_0x1354('0x19')]=function(_0x1fc827,_0x393d90){var _0x4bf1ae;return db[_0x1354('0x20')][_0x1354('0x3a')]({'where':{'id':_0x1fc827[_0x1354('0x37')]['id']}})['then'](function(_0xcdbc3b){_0x4bf1ae=_0xcdbc3b;return _0xcdbc3b;})[_0x1354('0x7')](handleEntityNotFound(_0x393d90,null))[_0x1354('0x7')](removeEntity(_0x393d90,null))[_0x1354('0x7')](function(){if(_0x4bf1ae){return db[_0x1354('0x20')][_0x1354('0x35')]({'where':{'type':_0x4bf1ae[_0x1354('0x22')]},'raw':!![]});}})[_0x1354('0x7')](function(_0x154d06){if(_0x4bf1ae['type']['toUpperCase']()=='STUN'){var _0x7373ca=fs[_0x1354('0x4a')](path[_0x1354('0x3f')](config['root'],_0x1354('0x41')),_0x1354('0x42'));var _0x2c6120=ejs['render'](_0x7373ca,{'networks':_0x154d06||[]});fs[_0x1354('0x44')]('/etc/asterisk/stun_xcally.conf',_0x2c6120);return respondWithRpcPromise(_0x1354('0x46'),_0x1354('0x19'),{'module':_0x1354('0x47')});}else if(_0x4bf1ae[_0x1354('0x22')][_0x1354('0x3d')]()=='TURN'){var _0x456399=fs[_0x1354('0x4a')](path[_0x1354('0x3f')](config['root'],_0x1354('0x48')),_0x1354('0x42'));var _0x18b3cd=ejs[_0x1354('0x43')](_0x456399,{'networks':_0x154d06||[]});fs[_0x1354('0x44')](_0x1354('0x49'),_0x18b3cd);return respondWithRpcPromise(_0x1354('0x46'),_0x1354('0x19'),{'module':'res_stun_monitor.so'});}else{var _0x58e517=fs[_0x1354('0x4a')](path['join'](config[_0x1354('0x40')],_0x1354('0x50')),_0x1354('0x42'));var _0x2b6599=ejs[_0x1354('0x43')](_0x58e517,{'networks':_0x154d06||[]});fs[_0x1354('0x44')](util[_0x1354('0x4b')](_0x1354('0x4c'),_0x4bf1ae['type']['toLowerCase']()),_0x2b6599);return respondWithRpcPromise(_0x1354('0x46'),_0x1354('0x19'),{'module':_0x1354('0x4e')});}})[_0x1354('0x10')](handleError(_0x393d90,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 53ff12e..8b282cc 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 _0xcb91=['rimraf','./network.attributes','exports','define','network','../../config/logger','api','moment','bluebird','path'];(function(_0x278aec,_0x362035){var _0x1dc040=function(_0x4a9623){while(--_0x4a9623){_0x278aec['push'](_0x278aec['shift']());}};_0x1dc040(++_0x362035);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x547456,_0x1de17e){_0x547456=_0x547456-0x0;var _0xc1fd7b=_0xcb91[_0x547456];return _0xc1fd7b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var moment=require(_0x1cb9('0x2'));var BPromise=require(_0x1cb9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1cb9('0x4'));var rimraf=require(_0x1cb9('0x5'));var config=require('../../config/environment');var attributes=require(_0x1cb9('0x6'));module[_0x1cb9('0x7')]=function(_0x53ffbd,_0x226b69){return _0x53ffbd[_0x1cb9('0x8')]('Network',attributes,{'tableName':_0x1cb9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbb53=['define','Network','network','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x367448,_0x3e9deb){var _0x28b046=function(_0x2c9ff8){while(--_0x2c9ff8){_0x367448['push'](_0x367448['shift']());}};_0x28b046(++_0x3e9deb);}(_0xbb53,0x121));var _0x3bb5=function(_0x13ff20,_0x4e4c58){_0x13ff20=_0x13ff20-0x0;var _0x27bd7f=_0xbb53[_0x13ff20];return _0x27bd7f;};'use strict';var _=require(_0x3bb5('0x0'));var util=require(_0x3bb5('0x1'));var logger=require(_0x3bb5('0x2'))(_0x3bb5('0x3'));var moment=require(_0x3bb5('0x4'));var BPromise=require(_0x3bb5('0x5'));var rp=require(_0x3bb5('0x6'));var fs=require('fs');var path=require(_0x3bb5('0x7'));var rimraf=require(_0x3bb5('0x8'));var config=require(_0x3bb5('0x9'));var attributes=require('./network.attributes');module['exports']=function(_0x23f11e,_0x2460b0){return _0x23f11e[_0x3bb5('0xa')](_0x3bb5('0xb'),attributes,{'tableName':_0x3bb5('0xc'),'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 64d2188..4b966c9 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(_0x2c2306,_0x1f6be9){var _0x459232=function(_0x473d7d){while(--_0x473d7d){_0x2c2306['push'](_0x2c2306['shift']());}};_0x459232(++_0x1f6be9);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Network,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file +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(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x7a54,0x106));var _0x47a5=function(_0x1890d5,_0x439325){_0x1890d5=_0x1890d5-0x0;var _0x39ac5e=_0x7a54[_0x1890d5];return _0x39ac5e;};'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 fec35f6..fb9c7e1 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 _0xfcbb=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','show','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/users','getAgents','post','create','/:id/dispositions','addDisposition','addAnswer','/:id/notify','notify','addApplications','/:id/send','put','/:id','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','Router'];(function(_0x433b91,_0x29447a){var _0x481ca8=function(_0xdc271f){while(--_0xdc271f){_0x433b91['push'](_0x433b91['shift']());}};_0x481ca8(++_0x29447a);}(_0xfcbb,0x10d));var _0xbfcb=function(_0x9a6d3,_0x2ab9b9){_0x9a6d3=_0x9a6d3-0x0;var _0x577127=_0xfcbb[_0x9a6d3];return _0x577127;};'use strict';var multer=require(_0xbfcb('0x0'));var util=require(_0xbfcb('0x1'));var path=require(_0xbfcb('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xbfcb('0x3')]();var fs_extra=require(_0xbfcb('0x4'));var auth=require(_0xbfcb('0x5'));var interaction=require(_0xbfcb('0x6'));var config=require(_0xbfcb('0x7'));var controller=require('./openchannelAccount.controller');router['get']('/',auth[_0xbfcb('0x8')](),controller[_0xbfcb('0x9')]);router[_0xbfcb('0xa')](_0xbfcb('0xb'),auth[_0xbfcb('0x8')](),controller[_0xbfcb('0xc')]);router[_0xbfcb('0xa')]('/:id',auth[_0xbfcb('0x8')](),controller[_0xbfcb('0xd')]);router[_0xbfcb('0xa')]('/:id/dispositions',auth[_0xbfcb('0x8')](),controller[_0xbfcb('0xe')]);router[_0xbfcb('0xa')](_0xbfcb('0xf'),auth[_0xbfcb('0x8')](),controller[_0xbfcb('0x10')]);router['get'](_0xbfcb('0x11'),auth[_0xbfcb('0x8')](),controller[_0xbfcb('0x12')]);router[_0xbfcb('0xa')]('/:id/interactions',auth[_0xbfcb('0x8')](),controller['getInteractions']);router[_0xbfcb('0xa')](_0xbfcb('0x13'),auth[_0xbfcb('0x8')](),controller[_0xbfcb('0x14')]);router[_0xbfcb('0x15')]('/',auth[_0xbfcb('0x8')](),controller[_0xbfcb('0x16')]);router[_0xbfcb('0x15')](_0xbfcb('0x17'),auth[_0xbfcb('0x8')](),controller[_0xbfcb('0x18')]);router[_0xbfcb('0x15')](_0xbfcb('0xf'),auth[_0xbfcb('0x8')](),controller[_0xbfcb('0x19')]);router[_0xbfcb('0x15')](_0xbfcb('0x1a'),controller[_0xbfcb('0x1b')]);router[_0xbfcb('0x15')](_0xbfcb('0x11'),auth[_0xbfcb('0x8')](),controller[_0xbfcb('0x1c')]);router['post'](_0xbfcb('0x13'),auth[_0xbfcb('0x8')](),controller['addAgents']);router[_0xbfcb('0x15')](_0xbfcb('0x1d'),auth['isAuthenticated'](),controller['send']);router[_0xbfcb('0x1e')](_0xbfcb('0x1f'),auth[_0xbfcb('0x8')](),controller[_0xbfcb('0x20')]);router[_0xbfcb('0x21')]('/:id',auth[_0xbfcb('0x8')](),controller[_0xbfcb('0x22')]);router[_0xbfcb('0x21')](_0xbfcb('0x17'),auth[_0xbfcb('0x8')](),controller[_0xbfcb('0x23')]);router[_0xbfcb('0x21')](_0xbfcb('0xf'),auth[_0xbfcb('0x8')](),controller[_0xbfcb('0x24')]);router[_0xbfcb('0x21')](_0xbfcb('0x13'),auth[_0xbfcb('0x8')](),controller[_0xbfcb('0x25')]);module[_0xbfcb('0x26')]=router; \ No newline at end of file +var _0x7b84=['notify','addAgents','/:id/send','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','create','post','addDisposition'];(function(_0x5c371a,_0x4e70dd){var _0x1dfb09=function(_0xb30d9e){while(--_0xb30d9e){_0x5c371a['push'](_0x5c371a['shift']());}};_0x1dfb09(++_0x4e70dd);}(_0x7b84,0x17c));var _0x47b8=function(_0x4f9750,_0x1174f4){_0x4f9750=_0x4f9750-0x0;var _0x5be57e=_0x7b84[_0x4f9750];return _0x5be57e;};'use strict';var multer=require(_0x47b8('0x0'));var util=require(_0x47b8('0x1'));var path=require(_0x47b8('0x2'));var timeout=require(_0x47b8('0x3'));var express=require(_0x47b8('0x4'));var router=express[_0x47b8('0x5')]();var fs_extra=require(_0x47b8('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x47b8('0x7'));var config=require(_0x47b8('0x8'));var controller=require(_0x47b8('0x9'));router[_0x47b8('0xa')]('/',auth[_0x47b8('0xb')](),controller[_0x47b8('0xc')]);router['get'](_0x47b8('0xd'),auth[_0x47b8('0xb')](),controller[_0x47b8('0xe')]);router[_0x47b8('0xa')](_0x47b8('0xf'),auth[_0x47b8('0xb')](),controller[_0x47b8('0x10')]);router[_0x47b8('0xa')](_0x47b8('0x11'),auth[_0x47b8('0xb')](),controller[_0x47b8('0x12')]);router[_0x47b8('0xa')](_0x47b8('0x13'),auth[_0x47b8('0xb')](),controller[_0x47b8('0x14')]);router[_0x47b8('0xa')](_0x47b8('0x15'),auth[_0x47b8('0xb')](),controller[_0x47b8('0x16')]);router[_0x47b8('0xa')](_0x47b8('0x17'),auth[_0x47b8('0xb')](),controller[_0x47b8('0x18')]);router[_0x47b8('0xa')](_0x47b8('0x19'),auth[_0x47b8('0xb')](),controller[_0x47b8('0x1a')]);router['post']('/',auth[_0x47b8('0xb')](),controller[_0x47b8('0x1b')]);router[_0x47b8('0x1c')](_0x47b8('0x11'),auth[_0x47b8('0xb')](),controller[_0x47b8('0x1d')]);router[_0x47b8('0x1c')]('/:id/canned_answers',auth[_0x47b8('0xb')](),controller['addAnswer']);router['post']('/:id/notify',controller[_0x47b8('0x1e')]);router[_0x47b8('0x1c')](_0x47b8('0x15'),auth['isAuthenticated'](),controller['addApplications']);router['post'](_0x47b8('0x19'),auth['isAuthenticated'](),controller[_0x47b8('0x1f')]);router[_0x47b8('0x1c')](_0x47b8('0x20'),auth[_0x47b8('0xb')](),controller['send']);router[_0x47b8('0x21')](_0x47b8('0xf'),auth[_0x47b8('0xb')](),controller[_0x47b8('0x22')]);router[_0x47b8('0x23')](_0x47b8('0xf'),auth['isAuthenticated'](),controller[_0x47b8('0x24')]);router[_0x47b8('0x23')]('/:id/dispositions',auth[_0x47b8('0xb')](),controller[_0x47b8('0x25')]);router[_0x47b8('0x23')](_0x47b8('0x13'),auth['isAuthenticated'](),controller[_0x47b8('0x26')]);router[_0x47b8('0x23')](_0x47b8('0x19'),auth[_0x47b8('0xb')](),controller[_0x47b8('0x27')]);module[_0x47b8('0x28')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 7042a1e..eafbc81 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 _0xfca8=['setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x35f6b4,_0x505966){var _0x10f072=function(_0x20e563){while(--_0x20e563){_0x35f6b4['push'](_0x35f6b4['shift']());}};_0x10f072(++_0x505966);}(_0xfca8,0x1d7));var _0x8fca=function(_0x3d5c21,_0x12ec72){_0x3d5c21=_0x3d5c21-0x0;var _0x395e68=_0xfca8[_0x3d5c21];return _0x395e68;};'use strict';var Sequelize=require(_0x8fca('0x0'));var rs=require('randomstring');module[_0x8fca('0x1')]={'name':{'type':Sequelize[_0x8fca('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x8fca('0x2')],'defaultValue':function(){return rs[_0x8fca('0x3')]();}},'replyUri':{'type':Sequelize[_0x8fca('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x8fca('0x4')],'defaultValue':function(){return _0x8fca('0x5');}},'notificationSound':{'type':Sequelize[_0x8fca('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x8fca('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x8fca('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x8fca('0x2')]},'queueTransfer':{'type':Sequelize[_0x8fca('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x8fca('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x8fca('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x8fca('0x7')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x8fca('0x6')],'defaultValue':![],'comment':_0x8fca('0x8'),'set':function(_0x4350eb){if(!_0x4350eb)this[_0x8fca('0x9')](_0x8fca('0xa'),null);this[_0x8fca('0x9')](_0x8fca('0xb'),_0x4350eb);}}}; \ No newline at end of file +var _0x1c83=['mandatoryDispositionPauseId','sequelize','randomstring','exports','name','STRING','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue'];(function(_0xda044f,_0x3e4b33){var _0x3758f9=function(_0x45b846){while(--_0x45b846){_0xda044f['push'](_0xda044f['shift']());}};_0x3758f9(++_0x3e4b33);}(_0x1c83,0xd9));var _0x31c8=function(_0x297998,_0x33ab99){_0x297998=_0x297998-0x0;var _0x1926eb=_0x1c83[_0x297998];return _0x1926eb;};'use strict';var Sequelize=require(_0x31c8('0x0'));var rs=require(_0x31c8('0x1'));module[_0x31c8('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0x31c8('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x31c8('0x4')],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize[_0x31c8('0x4')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x31c8('0x4')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x31c8('0x5')],'defaultValue':function(){return _0x31c8('0x6');}},'notificationSound':{'type':Sequelize[_0x31c8('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x31c8('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x31c8('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x31c8('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x31c8('0x4')]},'queueTransfer':{'type':Sequelize[_0x31c8('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x31c8('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x31c8('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x31c8('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x31c8('0x8')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x31c8('0x7')],'defaultValue':![],'comment':_0x31c8('0x9'),'set':function(_0x2a3fd7){if(!_0x2a3fd7)this[_0x31c8('0xa')](_0x31c8('0xb'),null);this['setDataValue']('mandatoryDisposition',_0x2a3fd7);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index ca0e962..6f82f63 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 _0x483f=['addDisposition','OpenchannelAccountId','Disposition','findOne','hasOwnProperty','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','notify','openchannel','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','from\x20is\x20mandatory','isNil','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','CmList','List','Contacts','DESC','OpenchannelApplication','Applications','account','applications','list','priority','asc','contact','firstName','lastName','threadId','OpenchannelInteraction','ContactId','messageId','interaction','created','autoclose','close','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','queueId','queue','waitForTheAssignedQueue','Start','startRouting','EventManager','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','finally','getApplications','getInteractions','Owner','fullname','internal','Tag','Tags','tag','addAgents','omit','spread','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','out','Messages','push','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','./openchannelAccount.socket','register','jayson/promise','client','http','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','status','end','json','undefined','limit','count','offset','Content-Range','apply','save','update','UserProfileResource','destroy','sendStatus','stack','name','send','index','Pause','mandatoryDispositionPause','OpenchannelAccount','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','VIRTUAL','options','where','includeAll','findAll','rows','params','include','merge','find','create','body','user','get','role','UserProfileSection','userProfileId','autoAssociation','describe'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x483f,0x11c));var _0xf483=function(_0x27b309,_0x217d6a){_0x27b309=_0x27b309-0x0;var _0x6a712=_0x483f[_0x27b309];return _0x6a712;};'use strict';var emlformat=require(_0xf483('0x0'));var rimraf=require(_0xf483('0x1'));var zipdir=require(_0xf483('0x2'));var jsonpatch=require(_0xf483('0x3'));var rp=require(_0xf483('0x4'));var moment=require(_0xf483('0x5'));var BPromise=require(_0xf483('0x6'));var Mustache=require(_0xf483('0x7'));var util=require(_0xf483('0x8'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf483('0x9'));var fs=require('fs');var fs_extra=require(_0xf483('0xa'));var _=require(_0xf483('0xb'));var squel=require(_0xf483('0xc'));var crypto=require(_0xf483('0xd'));var jsforce=require(_0xf483('0xe'));var deskjs=require(_0xf483('0xf'));var toCsv=require(_0xf483('0x10'));var querystring=require('querystring');var Papa=require(_0xf483('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xf483('0x12'));var as=require(_0xf483('0x13'));var hardwareService=require(_0xf483('0x14'));var logger=require(_0xf483('0x15'))('api');var utils=require(_0xf483('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xf483('0x17'));var db=require(_0xf483('0x18'))['db'];config['redis']=_[_0xf483('0x19')](config[_0xf483('0x1a')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf483('0x1a')]));require(_0xf483('0x1b'))[_0xf483('0x1c')](socket);var jayson=require(_0xf483('0x1d'));var client=jayson[_0xf483('0x1e')]['http']({'port':0x232c});var client9002=jayson[_0xf483('0x1e')][_0xf483('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x48ee49,_0x14811d,_0x325472,_0x209bf0){return new BPromise(function(_0xaaab8f,_0xc1c541){var _0x355f6a=_0x209bf0||client;return _0x355f6a[_0xf483('0x20')](_0x48ee49,_0x325472)[_0xf483('0x21')](function(_0x4a2b19){logger[_0xf483('0x22')](_0xf483('0x23'),_0x14811d,_0xf483('0x24'));logger['debug']('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x14811d,_0xf483('0x24'),JSON[_0xf483('0x25')](_0x4a2b19));if(_0x4a2b19[_0xf483('0x26')]){if(_0x4a2b19['error'][_0xf483('0x27')]===0x1f4){logger[_0xf483('0x26')]('OpenchannelAccount,\x20%s,\x20%s',_0x14811d,_0x4a2b19[_0xf483('0x26')]['message']);return _0xc1c541(_0x4a2b19[_0xf483('0x26')]['message']);}logger[_0xf483('0x26')]('OpenchannelAccount,\x20%s,\x20%s',_0x14811d,_0x4a2b19[_0xf483('0x26')][_0xf483('0x28')]);return _0xaaab8f(_0x4a2b19[_0xf483('0x26')][_0xf483('0x28')]);}else{logger[_0xf483('0x22')](_0xf483('0x23'),_0x14811d,_0xf483('0x24'));_0xaaab8f(_0x4a2b19['result'][_0xf483('0x28')]);}})[_0xf483('0x29')](function(_0x50932d){logger[_0xf483('0x26')](_0xf483('0x23'),_0x14811d,_0x50932d);_0xc1c541(_0x50932d);});});}function respondWithStatusCode(_0x514811,_0x2188ff){_0x2188ff=_0x2188ff||0xcc;return function(_0xfb138e){if(_0xfb138e){return _0x514811['sendStatus'](_0x2188ff);}return _0x514811[_0xf483('0x2a')](_0x2188ff)[_0xf483('0x2b')]();};}function respondWithResult(_0x2ac32d,_0x49147f){_0x49147f=_0x49147f||0xc8;return function(_0x1c6000){if(_0x1c6000){return _0x2ac32d['status'](_0x49147f)[_0xf483('0x2c')](_0x1c6000);}};}function respondWithFilteredResult(_0x202eab,_0x38d1eb){return function(_0x2c00d6){if(_0x2c00d6){var _0x2afaf6=typeof _0x38d1eb['offset']===_0xf483('0x2d')&&typeof _0x38d1eb[_0xf483('0x2e')]===_0xf483('0x2d');var _0x40c76f=_0x2c00d6[_0xf483('0x2f')];var _0x12498b=_0x2afaf6?0x0:_0x38d1eb[_0xf483('0x30')];var _0x2ed65b=_0x2afaf6?_0x2c00d6[_0xf483('0x2f')]:_0x38d1eb[_0xf483('0x30')]+_0x38d1eb[_0xf483('0x2e')];var _0x2f369f;if(_0x2ed65b>=_0x40c76f){_0x2ed65b=_0x40c76f;_0x2f369f=0xc8;}else{_0x2f369f=0xce;}_0x202eab[_0xf483('0x2a')](_0x2f369f);return _0x202eab['set'](_0xf483('0x31'),_0x12498b+'-'+_0x2ed65b+'/'+_0x40c76f)[_0xf483('0x2c')](_0x2c00d6);}return null;};}function patchUpdates(_0x397b60){return function(_0x18711a){try{jsonpatch[_0xf483('0x32')](_0x18711a,_0x397b60,!![]);}catch(_0x32bc2a){return BPromise['reject'](_0x32bc2a);}return _0x18711a[_0xf483('0x33')]();};}function saveUpdates(_0x493866,_0x280aca){return function(_0x3f6471){if(_0x3f6471){return _0x3f6471[_0xf483('0x34')](_0x493866)[_0xf483('0x21')](function(_0x5b6edb){return _0x5b6edb;});}return null;};}function removeEntity(_0x573bd3,_0x5e594e){return function(_0x277c3f){if(_0x277c3f){return _0x277c3f['destroy']()[_0xf483('0x21')](function(){var _0x2e3444=_0x277c3f['get']({'plain':!![]});var _0x57879a='OpenchannelAccounts';return db[_0xf483('0x35')][_0xf483('0x36')]({'where':{'type':_0x57879a,'resourceId':_0x2e3444['id']}})[_0xf483('0x21')](function(){return _0x277c3f;});})[_0xf483('0x21')](function(){_0x573bd3[_0xf483('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1118c6,_0x56ad00){return function(_0x53c3d9){if(!_0x53c3d9){_0x1118c6[_0xf483('0x37')](0x194);}return _0x53c3d9;};}function handleError(_0x1a71dc,_0x4a8f45){_0x4a8f45=_0x4a8f45||0x1f4;return function(_0x58c5dd){logger[_0xf483('0x26')](_0x58c5dd[_0xf483('0x38')]);if(_0x58c5dd[_0xf483('0x39')]){delete _0x58c5dd['name'];}_0x1a71dc['status'](_0x4a8f45)[_0xf483('0x3a')](_0x58c5dd);};}exports[_0xf483('0x3b')]=function(_0x364502,_0x28649b){var _0xd834da={'include':[{'model':db[_0xf483('0x3c')],'as':_0xf483('0x3d')}]},_0x5d1432={},_0x1044e9={'count':0x0,'rows':[]};var _0x42fd62=_['map'](db[_0xf483('0x3e')][_0xf483('0x3f')],function(_0xa5e99d){return{'name':_0xa5e99d[_0xf483('0x40')],'type':_0xa5e99d[_0xf483('0x41')][_0xf483('0x42')]};});_0x5d1432[_0xf483('0x43')]=_[_0xf483('0x44')](_0x42fd62,_0xf483('0x39'));_0x5d1432['query']=_[_0xf483('0x45')](_0x364502[_0xf483('0x46')]);_0x5d1432[_0xf483('0x47')]=_[_0xf483('0x48')](_0x5d1432[_0xf483('0x43')],_0x5d1432[_0xf483('0x46')]);_0xd834da[_0xf483('0x49')]=_[_0xf483('0x48')](_0x5d1432[_0xf483('0x43')],qs['fields'](_0x364502[_0xf483('0x46')][_0xf483('0x4a')]));_0xd834da['attributes']=_0xd834da[_0xf483('0x49')][_0xf483('0x4b')]?_0xd834da[_0xf483('0x49')]:_0x5d1432[_0xf483('0x43')];if(!_0x364502[_0xf483('0x46')]['hasOwnProperty'](_0xf483('0x4c'))){_0xd834da[_0xf483('0x2e')]=qs['limit'](_0x364502[_0xf483('0x46')]['limit']);_0xd834da[_0xf483('0x30')]=qs[_0xf483('0x30')](_0x364502[_0xf483('0x46')]['offset']);}_0xd834da[_0xf483('0x4d')]=qs['sort'](_0x364502['query'][_0xf483('0x4e')]);_0xd834da['where']=qs[_0xf483('0x47')](_[_0xf483('0x4f')](_0x364502[_0xf483('0x46')],_0x5d1432[_0xf483('0x47')]),_0x42fd62);if(_0x364502[_0xf483('0x46')][_0xf483('0x50')]){_0xd834da['where']=_['merge'](_0xd834da['where'],{'$or':_[_0xf483('0x44')](_0x42fd62,function(_0x447953){if(_0x447953[_0xf483('0x41')]!==_0xf483('0x51')){var _0x53a42b={};_0x53a42b[_0x447953[_0xf483('0x39')]]={'$like':'%'+_0x364502[_0xf483('0x46')][_0xf483('0x50')]+'%'};return _0x53a42b;}})});}_0xd834da=_['merge']({},_0xd834da,_0x364502[_0xf483('0x52')]);var _0x588f53={'where':_0xd834da[_0xf483('0x53')]};return db[_0xf483('0x3e')][_0xf483('0x2f')](_0x588f53)[_0xf483('0x21')](function(_0x2da7d0){_0x1044e9[_0xf483('0x2f')]=_0x2da7d0;if(_0x364502[_0xf483('0x46')][_0xf483('0x54')]){_0xd834da['include']=[{'all':!![]}];}return db[_0xf483('0x3e')][_0xf483('0x55')](_0xd834da);})[_0xf483('0x21')](function(_0x11b1b6){_0x1044e9[_0xf483('0x56')]=_0x11b1b6;return _0x1044e9;})[_0xf483('0x21')](respondWithFilteredResult(_0x28649b,_0xd834da))[_0xf483('0x29')](handleError(_0x28649b,null));};exports['show']=function(_0x18712c,_0x5ae641){var _0x326e0a={'raw':![],'where':{'id':_0x18712c[_0xf483('0x57')]['id']},'include':[{'model':db[_0xf483('0x3c')],'as':_0xf483('0x3d')}]},_0x599c1d={};_0x599c1d[_0xf483('0x43')]=_[_0xf483('0x45')](db['OpenchannelAccount'][_0xf483('0x3f')]);_0x599c1d['query']=_[_0xf483('0x45')](_0x18712c['query']);_0x599c1d['filters']=_['intersection'](_0x599c1d[_0xf483('0x43')],_0x599c1d[_0xf483('0x46')]);_0x326e0a['attributes']=_['intersection'](_0x599c1d[_0xf483('0x43')],qs[_0xf483('0x4a')](_0x18712c['query'][_0xf483('0x4a')]));_0x326e0a[_0xf483('0x49')]=_0x326e0a[_0xf483('0x49')]['length']?_0x326e0a[_0xf483('0x49')]:_0x599c1d[_0xf483('0x43')];if(_0x18712c[_0xf483('0x46')][_0xf483('0x54')]){_0x326e0a[_0xf483('0x58')]=[{'all':!![]}];}_0x326e0a=_[_0xf483('0x59')]({},_0x326e0a,_0x18712c['options']);return db['OpenchannelAccount'][_0xf483('0x5a')](_0x326e0a)['then'](handleEntityNotFound(_0x5ae641,null))[_0xf483('0x21')](respondWithResult(_0x5ae641,null))[_0xf483('0x29')](handleError(_0x5ae641,null));};exports[_0xf483('0x5b')]=function(_0x57bf0b,_0x1265eb){return db[_0xf483('0x3e')][_0xf483('0x5b')](_0x57bf0b[_0xf483('0x5c')],{})['then'](function(_0x56af15){var _0x1bdea3=_0x57bf0b[_0xf483('0x5d')][_0xf483('0x5e')]({'plain':!![]});if(!_0x1bdea3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1bdea3[_0xf483('0x5f')]===_0xf483('0x5d')){var _0x4df340=_0x56af15[_0xf483('0x5e')]({'plain':!![]});var _0x5784e0='OpenchannelAccounts';return db[_0xf483('0x60')][_0xf483('0x5a')]({'where':{'name':_0x5784e0,'userProfileId':_0x1bdea3[_0xf483('0x61')]},'raw':!![]})[_0xf483('0x21')](function(_0x597c3c){if(_0x597c3c&&_0x597c3c[_0xf483('0x62')]===0x0){return db[_0xf483('0x35')][_0xf483('0x5b')]({'name':_0x4df340[_0xf483('0x39')],'resourceId':_0x4df340['id'],'type':_0x597c3c[_0xf483('0x39')],'sectionId':_0x597c3c['id']},{})['then'](function(){return _0x56af15;});}else{return _0x56af15;}})[_0xf483('0x29')](function(_0x3d3647){logger[_0xf483('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3d3647);throw _0x3d3647;});}return _0x56af15;})['then'](respondWithResult(_0x1265eb,0xc9))[_0xf483('0x29')](handleError(_0x1265eb,null));};exports['update']=function(_0x22af15,_0x4d0754){if(_0x22af15['body']['id']){delete _0x22af15[_0xf483('0x5c')]['id'];}return db[_0xf483('0x3e')][_0xf483('0x5a')]({'where':{'id':_0x22af15[_0xf483('0x57')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0xf483('0x21')](handleEntityNotFound(_0x4d0754,null))[_0xf483('0x21')](saveUpdates(_0x22af15['body'],null))[_0xf483('0x21')](respondWithResult(_0x4d0754,null))['catch'](handleError(_0x4d0754,null));};exports[_0xf483('0x36')]=function(_0x5256f6,_0x34efd1){return db[_0xf483('0x3e')][_0xf483('0x5a')]({'where':{'id':_0x5256f6[_0xf483('0x57')]['id']}})[_0xf483('0x21')](handleEntityNotFound(_0x34efd1,null))[_0xf483('0x21')](removeEntity(_0x34efd1,null))[_0xf483('0x29')](handleError(_0x34efd1,null));};exports[_0xf483('0x63')]=function(_0x5140f8,_0x2e0b5c){return db['OpenchannelAccount']['describe']()[_0xf483('0x21')](respondWithResult(_0x2e0b5c,null))[_0xf483('0x29')](handleError(_0x2e0b5c,null));};exports[_0xf483('0x64')]=function(_0x4fcf38,_0x4d7b3a,_0xbb1a0d){if(_0x4fcf38[_0xf483('0x5c')]['id']){delete _0x4fcf38[_0xf483('0x5c')]['id'];}return db[_0xf483('0x3e')][_0xf483('0x5a')]({'where':{'id':_0x4fcf38['params']['id']}})[_0xf483('0x21')](handleEntityNotFound(_0x4d7b3a,null))[_0xf483('0x21')](function(_0x46fe47){if(_0x46fe47){_0x4fcf38['body'][_0xf483('0x65')]=_0x46fe47['id'];return db[_0xf483('0x66')][_0xf483('0x5b')](_0x4fcf38[_0xf483('0x5c')]);}})[_0xf483('0x21')](respondWithResult(_0x4d7b3a,null))[_0xf483('0x29')](handleError(_0x4d7b3a,null));};exports['getDispositions']=function(_0x4abf56,_0xaaffdd,_0x294ffa){var _0x55a5de={'raw':![],'where':{}};var _0x8f2281={};var _0x1bebd9={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xf483('0x67')]({'where':{'id':_0x4abf56['params']['id']}})[_0xf483('0x21')](handleEntityNotFound(_0xaaffdd,null))['then'](function(_0x47b886){if(_0x47b886){_0x8f2281[_0xf483('0x43')]=_[_0xf483('0x45')](db[_0xf483('0x66')][_0xf483('0x3f')]);_0x8f2281[_0xf483('0x46')]=_[_0xf483('0x45')](_0x4abf56[_0xf483('0x46')]);_0x8f2281[_0xf483('0x47')]=_[_0xf483('0x48')](_0x8f2281[_0xf483('0x43')],_0x8f2281[_0xf483('0x46')]);_0x55a5de[_0xf483('0x49')]=_[_0xf483('0x48')](_0x8f2281[_0xf483('0x43')],qs[_0xf483('0x4a')](_0x4abf56[_0xf483('0x46')][_0xf483('0x4a')]));_0x55a5de['attributes']=_0x55a5de[_0xf483('0x49')][_0xf483('0x4b')]?_0x55a5de[_0xf483('0x49')]:_0x8f2281[_0xf483('0x43')];if(!_0x4abf56[_0xf483('0x46')][_0xf483('0x68')](_0xf483('0x4c'))){_0x55a5de['limit']=qs[_0xf483('0x2e')](_0x4abf56['query'][_0xf483('0x2e')]);_0x55a5de[_0xf483('0x30')]=qs[_0xf483('0x30')](_0x4abf56[_0xf483('0x46')]['offset']);}_0x55a5de[_0xf483('0x4d')]=qs[_0xf483('0x4e')](_0x4abf56[_0xf483('0x46')][_0xf483('0x4e')]);_0x55a5de[_0xf483('0x53')]=qs['filters'](_[_0xf483('0x4f')](_0x4abf56['query'],_0x8f2281[_0xf483('0x47')]));_0x55a5de['where'][_0xf483('0x65')]=_0x47b886['id'];if(_0x4abf56[_0xf483('0x46')]['filter']){_0x55a5de[_0xf483('0x53')]=_[_0xf483('0x59')](_0x55a5de[_0xf483('0x53')],{'$or':_[_0xf483('0x44')](_0x55a5de[_0xf483('0x49')],function(_0x4e96ce){var _0x4d691c={};_0x4d691c[_0x4e96ce]={'$like':'%'+_0x4abf56['query'][_0xf483('0x50')]+'%'};return _0x4d691c;})});}_0x55a5de=_[_0xf483('0x59')]({},_0x55a5de,_0x4abf56[_0xf483('0x52')]);return db[_0xf483('0x66')][_0xf483('0x2f')]({'where':_0x55a5de[_0xf483('0x53')]})[_0xf483('0x21')](function(_0x357ed1){_0x1bebd9[_0xf483('0x2f')]=_0x357ed1;if(_0x4abf56[_0xf483('0x46')][_0xf483('0x54')]){_0x55a5de['include']=[{'all':!![]}];}return db[_0xf483('0x66')]['findAll'](_0x55a5de);})[_0xf483('0x21')](function(_0x3545b8){_0x1bebd9[_0xf483('0x56')]=_0x3545b8;return _0x1bebd9;});}})[_0xf483('0x21')](respondWithFilteredResult(_0xaaffdd,_0x55a5de))['catch'](handleError(_0xaaffdd,null));};exports['removeDispositions']=function(_0x8b7a73,_0x358b51,_0x2830bb){return db[_0xf483('0x3e')]['find']({'where':{'id':_0x8b7a73[_0xf483('0x57')]['id']}})[_0xf483('0x21')](handleEntityNotFound(_0x358b51,null))[_0xf483('0x21')](function(_0x1357fc){if(_0x1357fc){return _0x1357fc[_0xf483('0x69')](_0x8b7a73[_0xf483('0x46')][_0xf483('0x6a')]);}})[_0xf483('0x21')](respondWithStatusCode(_0x358b51,null))[_0xf483('0x29')](handleError(_0x358b51,null));};exports[_0xf483('0x6b')]=function(_0x3a2da2,_0x45142f,_0x5260b6){if(_0x3a2da2['body']['id']){delete _0x3a2da2['body']['id'];}return db[_0xf483('0x3e')][_0xf483('0x5a')]({'where':{'id':_0x3a2da2[_0xf483('0x57')]['id']}})[_0xf483('0x21')](handleEntityNotFound(_0x45142f,null))['then'](function(_0x497e1d){if(_0x497e1d){_0x3a2da2[_0xf483('0x5c')][_0xf483('0x65')]=_0x497e1d['id'];return db[_0xf483('0x6c')][_0xf483('0x5b')](_0x3a2da2[_0xf483('0x5c')]);}})[_0xf483('0x21')](respondWithResult(_0x45142f,null))[_0xf483('0x29')](handleError(_0x45142f,null));};exports['getAnswers']=function(_0x46bf77,_0x3590a9,_0x3a350d){var _0x25d9ee={'raw':![],'where':{}};var _0x13d70b={};var _0x4bbf7a={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xf483('0x67')]({'where':{'id':_0x46bf77['params']['id']}})[_0xf483('0x21')](handleEntityNotFound(_0x3590a9,null))[_0xf483('0x21')](function(_0x20ab3e){if(_0x20ab3e){_0x13d70b[_0xf483('0x43')]=_[_0xf483('0x45')](db[_0xf483('0x6c')][_0xf483('0x3f')]);_0x13d70b['query']=_[_0xf483('0x45')](_0x46bf77[_0xf483('0x46')]);_0x13d70b[_0xf483('0x47')]=_['intersection'](_0x13d70b[_0xf483('0x43')],_0x13d70b['query']);_0x25d9ee['attributes']=_[_0xf483('0x48')](_0x13d70b['model'],qs[_0xf483('0x4a')](_0x46bf77[_0xf483('0x46')]['fields']));_0x25d9ee[_0xf483('0x49')]=_0x25d9ee[_0xf483('0x49')][_0xf483('0x4b')]?_0x25d9ee[_0xf483('0x49')]:_0x13d70b['model'];if(!_0x46bf77[_0xf483('0x46')]['hasOwnProperty'](_0xf483('0x4c'))){_0x25d9ee['limit']=qs['limit'](_0x46bf77[_0xf483('0x46')]['limit']);_0x25d9ee[_0xf483('0x30')]=qs['offset'](_0x46bf77[_0xf483('0x46')][_0xf483('0x30')]);}_0x25d9ee[_0xf483('0x4d')]=qs[_0xf483('0x4e')](_0x46bf77[_0xf483('0x46')][_0xf483('0x4e')]);_0x25d9ee[_0xf483('0x53')]=qs['filters'](_[_0xf483('0x4f')](_0x46bf77['query'],_0x13d70b[_0xf483('0x47')]));_0x25d9ee['where'][_0xf483('0x65')]=_0x20ab3e['id'];if(_0x46bf77['query'][_0xf483('0x50')]){_0x25d9ee[_0xf483('0x53')]=_[_0xf483('0x59')](_0x25d9ee[_0xf483('0x53')],{'$or':_['map'](_0x25d9ee[_0xf483('0x49')],function(_0x8e6ee4){var _0x102293={};_0x102293[_0x8e6ee4]={'$like':'%'+_0x46bf77[_0xf483('0x46')][_0xf483('0x50')]+'%'};return _0x102293;})});}_0x25d9ee=_[_0xf483('0x59')]({},_0x25d9ee,_0x46bf77[_0xf483('0x52')]);return db['CannedAnswer'][_0xf483('0x2f')]({'where':_0x25d9ee[_0xf483('0x53')]})[_0xf483('0x21')](function(_0x13ee77){_0x4bbf7a[_0xf483('0x2f')]=_0x13ee77;if(_0x46bf77[_0xf483('0x46')][_0xf483('0x54')]){_0x25d9ee[_0xf483('0x58')]=[{'all':!![]}];}return db['CannedAnswer'][_0xf483('0x55')](_0x25d9ee);})['then'](function(_0x50ec3b){_0x4bbf7a['rows']=_0x50ec3b;return _0x4bbf7a;});}})['then'](respondWithFilteredResult(_0x3590a9,_0x25d9ee))['catch'](handleError(_0x3590a9,null));};exports[_0xf483('0x6d')]=function(_0x56a60b,_0x26d567,_0x5f568e){return db[_0xf483('0x3e')][_0xf483('0x5a')]({'where':{'id':_0x56a60b[_0xf483('0x57')]['id']}})[_0xf483('0x21')](handleEntityNotFound(_0x26d567,null))['then'](function(_0x227278){if(_0x227278){return _0x227278[_0xf483('0x6d')](_0x56a60b['query'][_0xf483('0x6a')]);}})[_0xf483('0x21')](respondWithStatusCode(_0x26d567,null))[_0xf483('0x29')](handleError(_0x26d567,null));};exports[_0xf483('0x6e')]=function(_0x5c1e07,_0x509a47,_0x57a2c4){var _0x5e6b42={'body':_0x5c1e07['body'],'channel':_0xf483('0x6f')};var _0x5ba4af=[];var _0x4b964b=[];var _0x2e8034={};var _0x3800a7=![];return db[_0xf483('0x70')][_0xf483('0x63')]()[_0xf483('0x21')](function(_0x435881){if(!_0x435881){throw new db[(_0xf483('0x71'))]['ValidationError'](_0xf483('0x72'));}_0x5ba4af=_[_0xf483('0x73')](_[_0xf483('0x45')](_0x435881),[_0xf483('0x74'),_0xf483('0x75')]);_0x4b964b=_['difference'](_[_0xf483('0x45')](_0x435881),['createdAt','updatedAt',_0xf483('0x76'),_0xf483('0x77')]);if(_0x5c1e07[_0xf483('0x5c')]['id']){delete _0x5c1e07[_0xf483('0x5c')]['id'];}if(_['isNil'](_0x5c1e07[_0xf483('0x5c')]['from'])){throw new db['Sequelize']['ValidationError'](_0xf483('0x78'));}if(_[_0xf483('0x79')](_0x5c1e07['body']['body'])||_0x5c1e07[_0xf483('0x5c')]['body']===''){throw new db[(_0xf483('0x71'))][(_0xf483('0x7a'))](_0xf483('0x7b'));}if(_[_0xf483('0x79')](_0x5c1e07[_0xf483('0x5c')]['mapKey'])){throw new db[(_0xf483('0x71'))][(_0xf483('0x7a'))](_0xf483('0x7c')+_0x4b964b);}if(!_[_0xf483('0x7d')](_0x4b964b,_0x5c1e07[_0xf483('0x5c')][_0xf483('0x7e')])){throw new db[(_0xf483('0x71'))][(_0xf483('0x7a'))](_0xf483('0x7f')+_0x4b964b);}_0x2e8034[_0x5c1e07[_0xf483('0x5c')][_0xf483('0x7e')]]=_0x5c1e07[_0xf483('0x5c')][_0xf483('0x80')];})[_0xf483('0x21')](function(){return db[_0xf483('0x3e')][_0xf483('0x5a')]({'where':{'id':_0x5c1e07[_0xf483('0x57')]['id']},'include':[{'model':db[_0xf483('0x81')],'as':_0xf483('0x82'),'include':[{'model':db['CmContact'],'as':_0xf483('0x83'),'where':_0x2e8034,'limit':0x1,'order':[[_0xf483('0x75'),_0xf483('0x84')]]}]},{'model':db[_0xf483('0x85')],'as':_0xf483('0x86')}]});})[_0xf483('0x21')](handleEntityNotFound(_0x509a47,null))['then'](function(_0x25afda){if(_0x25afda&&_0x25afda[_0xf483('0x82')]){_0x5e6b42[_0xf483('0x87')]=_0x25afda;_0x5e6b42[_0xf483('0x88')]=_0x25afda[_0xf483('0x86')];_0x5e6b42[_0xf483('0x89')]=_0x25afda[_0xf483('0x82')];_0x5e6b42[_0xf483('0x88')]=_['orderBy'](_0x5e6b42[_0xf483('0x88')],[_0xf483('0x8a')],[_0xf483('0x8b')]);if(_0x5e6b42['account'][_0xf483('0x86')]){delete _0x5e6b42['account']['Applications'];}if(_0x5e6b42['account'][_0xf483('0x82')]&&_0x5e6b42[_0xf483('0x87')][_0xf483('0x82')][_0xf483('0x83')][_0xf483('0x4b')]){return _0x5e6b42['account'][_0xf483('0x82')][_0xf483('0x83')][0x0];}var _0x310ec6=_['defaults'](_0x5c1e07[_0xf483('0x5c')],{'firstName':_0x5c1e07[_0xf483('0x5c')][_0xf483('0x80')],'ListId':_0x25afda[_0xf483('0x77')]});_0x310ec6[_0x5c1e07[_0xf483('0x5c')][_0xf483('0x7e')]]=_0x5c1e07[_0xf483('0x5c')][_0xf483('0x80')];return db[_0xf483('0x70')][_0xf483('0x5b')](_0x310ec6,{'fields':_0x5ba4af,'raw':!![]});}})[_0xf483('0x21')](handleEntityNotFound(_0x509a47,null))[_0xf483('0x21')](function(_0x3ef26d){_0x5e6b42[_0xf483('0x8c')]=_0x3ef26d;if(_0x3ef26d){var _0x3e1b97={'ContactId':_0x3ef26d['id'],'OpenchannelAccountId':_0x5c1e07[_0xf483('0x57')]['id'],'from':(_0x3ef26d[_0xf483('0x8d')]||'')+'\x20'+(_0x3ef26d[_0xf483('0x8e')]||'')};var _0x127594={'OpenchannelAccountId':_0x5c1e07[_0xf483('0x57')]['id'],'closed':![]};if(_0x5c1e07[_0xf483('0x5c')]['threadId']){_0x127594[_0xf483('0x8f')]=_0x5c1e07[_0xf483('0x5c')]['threadId'];return db[_0xf483('0x90')][_0xf483('0x5a')]({'where':_0x127594})[_0xf483('0x21')](function(_0xf564f1){if(_0xf564f1){return[_0xf564f1,![]];}_0x3e1b97['threadId']=_0x5c1e07['body'][_0xf483('0x8f')];_0x3e1b97['externalUrl']=_0x5c1e07[_0xf483('0x5c')]['externalUrl'];return db[_0xf483('0x90')][_0xf483('0x5b')](_0x3e1b97)[_0xf483('0x21')](function(_0x4339b0){return[_0x4339b0,!![]];});});}else{_0x127594[_0xf483('0x8f')]=null;}_0x127594[_0xf483('0x91')]=_0x3ef26d['id'];return db['OpenchannelInteraction'][_0xf483('0x5a')]({'where':_0x127594})[_0xf483('0x21')](function(_0x3dec20){if(_0x3dec20){return[_0x3dec20,![]];}return db[_0xf483('0x90')][_0xf483('0x5b')](_0x3e1b97)[_0xf483('0x21')](function(_0x52c775){return[_0x52c775,!![]];});});}})['spread'](function(_0x4df7b2,_0x1caf13){if(_0x4df7b2){_0x3800a7=_0x1caf13;if(!_0x1caf13){var _0x95f359={'from':(_0x5e6b42[_0xf483('0x8c')][_0xf483('0x8d')]||'')+'\x20'+(_0x5e6b42[_0xf483('0x8c')][_0xf483('0x8e')]||'')};if(_0x5c1e07[_0xf483('0x5c')][_0xf483('0x8f')]&&_0x5c1e07[_0xf483('0x5c')][_0xf483('0x92')]&&_0x5c1e07[_0xf483('0x5c')][_0xf483('0x8f')]!=_0x5c1e07[_0xf483('0x5c')][_0xf483('0x92')]){_0x95f359[_0xf483('0x8f')]=_0x5c1e07[_0xf483('0x5c')][_0xf483('0x92')];}return _0x4df7b2[_0xf483('0x34')](_0x95f359);}else{return _0x4df7b2;}}})['then'](function(_0x21f9e3){_0x5e6b42[_0xf483('0x93')]=_0x21f9e3['get']({'plain':!![]});_0x5e6b42['interaction'][_0xf483('0x94')]=_0x3800a7;if(_0x5e6b42['interaction'][_0xf483('0x94')]){if(_0x5e6b42[_0xf483('0x87')][_0xf483('0x95')]){_0x5e6b42[_0xf483('0x88')]['push']({'id':0x0,'priority':_0x5e6b42['applications'][_0xf483('0x4b')]+0x1,'app':_0xf483('0x96'),'appdata':'unmanaged','interval':_0xf483('0x97')});}}return db[_0xf483('0x98')]['create']({'body':_0x5c1e07[_0xf483('0x5c')]['body'],'OpenchannelAccountId':_0x5c1e07['params']['id'],'OpenchannelInteractionId':_0x21f9e3['id'],'direction':'in','ContactId':_0x5e6b42[_0xf483('0x8c')]['id'],'AttachmentId':_0x5c1e07[_0xf483('0x5c')][_0xf483('0x99')]});})[_0xf483('0x21')](function(_0x57bb82){_0x5e6b42[_0xf483('0x28')]=_0x57bb82;if(!_0x5e6b42[_0xf483('0x93')][_0xf483('0x9a')])return;return db[_0xf483('0x9b')][_0xf483('0x5a')]({'attributes':['id',_0xf483('0x39')],'where':{'id':_0x5e6b42['interaction'][_0xf483('0x9a')]}});})[_0xf483('0x21')](function(_0x54b3f5){if(_0x54b3f5){_0x5e6b42['applications'][_0xf483('0x9c')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x54b3f5[_0xf483('0x39')]+','+(_0x5e6b42[_0xf483('0x87')][_0xf483('0x9d')]||0xa),'interval':_0xf483('0x97')});}if(!_0x5e6b42[_0xf483('0x93')][_0xf483('0x9e')])return;return db['OpenchannelQueue']['find']({'attributes':['id',_0xf483('0x39')],'where':{'id':_0x5e6b42[_0xf483('0x93')]['queueId']}});})[_0xf483('0x21')](function(_0x568a9a){if(_0x568a9a){_0x5e6b42[_0xf483('0x88')][_0xf483('0x9c')]({'id':0x0,'priority':0x1,'app':_0xf483('0x9f'),'appdata':_0x568a9a['name']+','+(_0x5e6b42[_0xf483('0x87')][_0xf483('0xa0')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xf483('0xa1'),_0xf483('0xa2'),_0x5e6b42);})[_0xf483('0x21')](function(_0x25d0c8){respondWithRpcPromise('EventManager',_0xf483('0xa3'),{'event':_0xf483('0x6e'),'message':_0x25d0c8},client9002);return _0x25d0c8;})[_0xf483('0x21')](respondWithResult(_0x509a47,null))[_0xf483('0x29')](handleError(_0x509a47,null));};exports['addApplications']=function(_0x4a554d,_0x33764f){var _0x4a2fc1=_0x4a554d['params']['id'];var _0x492993=_0x4a554d['body'];var _0x243f38=0xc8;var _0x541732=null;return db[_0xf483('0xa4')][_0xf483('0xa5')]({'isolationLevel':db[_0xf483('0xa4')][_0xf483('0xa6')][_0xf483('0xa7')][_0xf483('0xa8')]},function(_0x4383f0){return db[_0xf483('0x3e')][_0xf483('0x67')]({'where':{'id':_0x4a2fc1},'transaction':_0x4383f0})[_0xf483('0x21')](function(_0x564809){if(_0x564809){return db[_0xf483('0x85')][_0xf483('0x36')]({'where':{'OpenchannelAccountId':_0x4a2fc1},'transaction':_0x4383f0})[_0xf483('0x21')](function(){var _0x5b646f=_[_0xf483('0x44')](_0x492993,function(_0x3c50c7){_0x3c50c7[_0xf483('0x65')]=_0x4a2fc1;return _0x3c50c7;});return db[_0xf483('0x85')][_0xf483('0xa9')](_0x5b646f,{'transaction':_0x4383f0});});}else{_0x243f38=0x194;_0x541732=[];}});})[_0xf483('0x21')](function(){if(_0x243f38!==0x194){return db['OpenchannelApplication']['findAndCountAll']({'where':{'OpenchannelAccountId':_0x4a2fc1},'order':_0xf483('0x8a')})[_0xf483('0x21')](function(_0x53386d){_0x541732=_0x53386d;});}})['catch'](function(_0x5d429e){_0x243f38=0x1f4;logger[_0xf483('0x26')](_0x5d429e[_0xf483('0x38')]);if(_0x5d429e['name']){delete _0x5d429e['name'];}_0x541732=_0x5d429e;})[_0xf483('0xaa')](function(){if(_0x541732===null){_0x33764f[_0xf483('0x37')](_0x243f38);}else{if(_0x243f38===0x1f4){_0x33764f[_0xf483('0x2a')](_0x243f38)['send'](_0x541732);}else{_0x33764f['status'](_0x243f38)[_0xf483('0x2c')](_0x541732);}}});};exports['getApplications']=function(_0x4942aa,_0x522691,_0x5db014){var _0x86ec2f={};var _0x167c7d={};var _0x1c9768;var _0x40421b;return db['OpenchannelAccount']['findOne']({'where':{'id':_0x4942aa['params']['id']}})[_0xf483('0x21')](handleEntityNotFound(_0x522691,null))[_0xf483('0x21')](function(_0x5371fe){if(_0x5371fe){_0x1c9768=_0x5371fe;_0x167c7d['model']=_['keys'](db[_0xf483('0x85')][_0xf483('0x3f')]);_0x167c7d[_0xf483('0x46')]=_['keys'](_0x4942aa[_0xf483('0x46')]);_0x167c7d[_0xf483('0x47')]=_[_0xf483('0x48')](_0x167c7d[_0xf483('0x43')],_0x167c7d['query']);_0x86ec2f[_0xf483('0x49')]=_['intersection'](_0x167c7d[_0xf483('0x43')],qs[_0xf483('0x4a')](_0x4942aa[_0xf483('0x46')][_0xf483('0x4a')]));_0x86ec2f[_0xf483('0x49')]=_0x86ec2f['attributes'][_0xf483('0x4b')]?_0x86ec2f['attributes']:_0x167c7d[_0xf483('0x43')];_0x86ec2f[_0xf483('0x4d')]=qs[_0xf483('0x4e')](_0x4942aa['query']['sort']);_0x86ec2f[_0xf483('0x53')]=qs['filters'](_[_0xf483('0x4f')](_0x4942aa['query'],_0x167c7d['filters']));if(_0x4942aa['query']['filter']){_0x86ec2f[_0xf483('0x53')]=_['merge'](_0x86ec2f[_0xf483('0x53')],{'$or':_['map'](_0x86ec2f[_0xf483('0x49')],function(_0x4b1605){var _0x17d3c6={};_0x17d3c6[_0x4b1605]={'$like':'%'+_0x4942aa[_0xf483('0x46')]['filter']+'%'};return _0x17d3c6;})});}_0x86ec2f=_['merge']({},_0x86ec2f,_0x4942aa['options']);return _0x1c9768[_0xf483('0xab')](_0x86ec2f);}})['then'](function(_0x49a0f2){if(_0x49a0f2){_0x40421b=_0x49a0f2[_0xf483('0x4b')];if(!_0x4942aa[_0xf483('0x46')][_0xf483('0x68')]('nolimit')){_0x86ec2f[_0xf483('0x2e')]=qs[_0xf483('0x2e')](_0x4942aa[_0xf483('0x46')]['limit']);_0x86ec2f['offset']=qs[_0xf483('0x30')](_0x4942aa[_0xf483('0x46')]['offset']);}return _0x1c9768[_0xf483('0xab')](_0x86ec2f);}})[_0xf483('0x21')](function(_0x4fe717){if(_0x4fe717){return _0x4fe717?{'count':_0x40421b,'rows':_0x4fe717}:null;}})['then'](respondWithResult(_0x522691,null))[_0xf483('0x29')](handleError(_0x522691,null));};exports[_0xf483('0xac')]=function(_0x365c76,_0x46052d,_0x7433e3){var _0x263b8a={'raw':![],'where':{}};var _0x25f6d0={};var _0xf5c069={'count':0x0,'rows':[]};return db[_0xf483('0x3e')][_0xf483('0x67')]({'where':{'id':_0x365c76[_0xf483('0x57')]['id']}})[_0xf483('0x21')](handleEntityNotFound(_0x46052d,null))[_0xf483('0x21')](function(_0x420eac){if(_0x420eac){_0x25f6d0[_0xf483('0x43')]=_['keys'](db[_0xf483('0x90')]['rawAttributes']);_0x25f6d0[_0xf483('0x46')]=_[_0xf483('0x45')](_0x365c76[_0xf483('0x46')]);_0x25f6d0[_0xf483('0x47')]=_[_0xf483('0x48')](_0x25f6d0['model'],_0x25f6d0[_0xf483('0x46')]);_0x263b8a[_0xf483('0x49')]=_['intersection'](_0x25f6d0[_0xf483('0x43')],qs[_0xf483('0x4a')](_0x365c76['query']['fields']));_0x263b8a[_0xf483('0x49')]=_0x263b8a['attributes'][_0xf483('0x4b')]?_0x263b8a[_0xf483('0x49')]:_0x25f6d0[_0xf483('0x43')];if(!_0x365c76['query'][_0xf483('0x68')](_0xf483('0x4c'))){_0x263b8a[_0xf483('0x2e')]=qs[_0xf483('0x2e')](_0x365c76['query'][_0xf483('0x2e')]);_0x263b8a[_0xf483('0x30')]=qs['offset'](_0x365c76[_0xf483('0x46')][_0xf483('0x30')]);}_0x263b8a[_0xf483('0x4d')]=qs[_0xf483('0x4e')](_0x365c76[_0xf483('0x46')]['sort']);_0x263b8a['where']=qs['filters'](_[_0xf483('0x4f')](_0x365c76['query'],_0x25f6d0[_0xf483('0x47')]));_0x263b8a['where']['OpenchannelAccountId']=_0x420eac['id'];if(_0x365c76[_0xf483('0x46')]['filter']){_0x263b8a[_0xf483('0x53')]=_[_0xf483('0x59')](_0x263b8a[_0xf483('0x53')],{'$or':_[_0xf483('0x44')](_0x263b8a[_0xf483('0x49')],function(_0x374d32){var _0x17186e={};_0x17186e[_0x374d32]={'$like':'%'+_0x365c76[_0xf483('0x46')][_0xf483('0x50')]+'%'};return _0x17186e;})});}_0x263b8a=_[_0xf483('0x59')]({},_0x263b8a,_0x365c76[_0xf483('0x52')]);return db[_0xf483('0x90')][_0xf483('0x2f')]({'where':_0x263b8a['where']})[_0xf483('0x21')](function(_0x3410d7){_0xf5c069[_0xf483('0x2f')]=_0x3410d7;if(_0x365c76['query'][_0xf483('0x54')]){_0x263b8a[_0xf483('0x58')]=[{'model':db[_0xf483('0x70')],'as':'Contact','required':![]},{'model':db['User'],'as':_0xf483('0xad'),'attributes':[_0xf483('0x39'),_0xf483('0xae'),_0xf483('0xaf')],'required':![]},{'model':db[_0xf483('0xb0')],'as':_0xf483('0xb1'),'attributes':['id',_0xf483('0x39'),'color'],'where':_0x365c76['query'][_0xf483('0xb2')]?{'id':_0x365c76[_0xf483('0x46')]['tag']}:undefined,'required':_0x365c76[_0xf483('0x46')][_0xf483('0xb2')]?!![]:![]}];}return db[_0xf483('0x90')]['findAll'](_0x263b8a);})[_0xf483('0x21')](function(_0x138050){_0xf5c069[_0xf483('0x56')]=_0x138050;return _0xf5c069;});}})[_0xf483('0x21')](respondWithFilteredResult(_0x46052d,_0x263b8a))[_0xf483('0x29')](handleError(_0x46052d,null));};exports[_0xf483('0xb3')]=function(_0x197578,_0x40a5e4,_0x88c5d7){return db[_0xf483('0x3e')][_0xf483('0x5a')]({'where':{'id':_0x197578[_0xf483('0x57')]['id']}})['then'](handleEntityNotFound(_0x40a5e4,null))['then'](function(_0x5bb8bb){if(_0x5bb8bb){return _0x5bb8bb[_0xf483('0xb3')](_0x197578[_0xf483('0x5c')]['ids'],_[_0xf483('0xb4')](_0x197578[_0xf483('0x5c')],['ids','id'])||{})[_0xf483('0xb5')](function(_0x632141){for(var _0x281c3d=0x0;_0x281c3d<_0x197578[_0xf483('0x5c')][_0xf483('0x6a')][_0xf483('0x4b')];_0x281c3d+=0x1){socket[_0xf483('0xb6')](_0xf483('0xb7'),{'UserId':Number(_0x197578[_0xf483('0x5c')][_0xf483('0x6a')][_0x281c3d]),'OpenchannelAccountId':Number(_0x197578[_0xf483('0x57')]['id'])});}return _0x632141;});}})['then'](respondWithResult(_0x40a5e4,null))[_0xf483('0x29')](handleError(_0x40a5e4,null));};exports[_0xf483('0xb8')]=function(_0x352bed,_0x34e661,_0x2ff6f0){return db['OpenchannelAccount']['find']({'where':{'id':_0x352bed[_0xf483('0x57')]['id']}})['then'](handleEntityNotFound(_0x34e661,null))['then'](function(_0x2ea619){if(_0x2ea619){return _0x2ea619[_0xf483('0xb8')](_0x352bed['query']['ids'])[_0xf483('0x21')](function(){if(_[_0xf483('0xb9')](_0x352bed['query'][_0xf483('0x6a')])){for(var _0x4287fd=0x0;_0x4287fd<_0x352bed['query'][_0xf483('0x6a')][_0xf483('0x4b')];_0x4287fd+=0x1){socket[_0xf483('0xb6')]('userOpenchannelAccount:remove',{'UserId':Number(_0x352bed['query'][_0xf483('0x6a')][_0x4287fd]),'OpenchannelAccountId':Number(_0x352bed[_0xf483('0x57')]['id'])});}}else{socket['emit'](_0xf483('0xba'),{'UserId':Number(_0x352bed['query']['ids']),'OpenchannelAccountId':Number(_0x352bed[_0xf483('0x57')]['id'])});}});}})[_0xf483('0x21')](respondWithStatusCode(_0x34e661,null))[_0xf483('0x29')](handleError(_0x34e661,null));};exports['getAgents']=function(_0x22207a,_0xe1bf97,_0x40629e){var _0x5aa00a={};var _0x409b34={};var _0x6d31d2;var _0xfb1d14;return db[_0xf483('0x3e')][_0xf483('0x67')]({'where':{'id':_0x22207a[_0xf483('0x57')]['id']}})[_0xf483('0x21')](handleEntityNotFound(_0xe1bf97,null))[_0xf483('0x21')](function(_0x1d7851){if(_0x1d7851){_0x6d31d2=_0x1d7851;_0x409b34[_0xf483('0x43')]=_[_0xf483('0x45')](db[_0xf483('0x9b')][_0xf483('0x3f')]);_0x409b34[_0xf483('0x46')]=_[_0xf483('0x45')](_0x22207a['query']);_0x409b34[_0xf483('0x47')]=_['intersection'](_0x409b34[_0xf483('0x43')],_0x409b34[_0xf483('0x46')]);_0x5aa00a[_0xf483('0x49')]=_[_0xf483('0x48')](_0x409b34[_0xf483('0x43')],qs[_0xf483('0x4a')](_0x22207a['query']['fields']));_0x5aa00a[_0xf483('0x49')]=_0x5aa00a[_0xf483('0x49')][_0xf483('0x4b')]?_0x5aa00a[_0xf483('0x49')]:_0x409b34['model'];_0x5aa00a['order']=qs[_0xf483('0x4e')](_0x22207a[_0xf483('0x46')][_0xf483('0x4e')]);_0x5aa00a[_0xf483('0x53')]=qs['filters'](_[_0xf483('0x4f')](_0x22207a[_0xf483('0x46')],_0x409b34['filters']));if(_0x22207a[_0xf483('0x46')][_0xf483('0x50')]){_0x5aa00a['where']=_['merge'](_0x5aa00a[_0xf483('0x53')],{'$or':_[_0xf483('0x44')](_0x5aa00a[_0xf483('0x49')],function(_0x3fb89b){var _0x3d86da={};_0x3d86da[_0x3fb89b]={'$like':'%'+_0x22207a[_0xf483('0x46')][_0xf483('0x50')]+'%'};return _0x3d86da;})});}_0x5aa00a=_[_0xf483('0x59')]({},_0x5aa00a,_0x22207a['options']);return _0x6d31d2[_0xf483('0xbb')](_0x5aa00a);}})[_0xf483('0x21')](function(_0x3f65bc){if(_0x3f65bc){_0xfb1d14=_0x3f65bc['length'];if(!_0x22207a[_0xf483('0x46')][_0xf483('0x68')](_0xf483('0x4c'))){_0x5aa00a[_0xf483('0x2e')]=qs[_0xf483('0x2e')](_0x22207a[_0xf483('0x46')][_0xf483('0x2e')]);_0x5aa00a['offset']=qs['offset'](_0x22207a[_0xf483('0x46')]['offset']);}return _0x6d31d2[_0xf483('0xbb')](_0x5aa00a);}})['then'](function(_0x2f0ab6){if(_0x2f0ab6){return _0x2f0ab6?{'count':_0xfb1d14,'rows':_0x2f0ab6}:null;}})['then'](respondWithResult(_0xe1bf97,null))[_0xf483('0x29')](handleError(_0xe1bf97,null));};exports['send']=function(_0x2739b0,_0x3929a2,_0x3b836d){var _0x20a11b,_0x3c9ed6,_0x58e269;if(_['isNil'](_0x2739b0['body'][_0xf483('0x5c')])||_0x2739b0[_0xf483('0x5c')][_0xf483('0x5c')]===''){throw new db[(_0xf483('0x71'))][(_0xf483('0x7a'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xf483('0x79')](_0x2739b0['body']['to'])){}_0x20a11b=_0x2739b0[_0xf483('0x5c')]['to'];return db[_0xf483('0x3e')][_0xf483('0x67')]({'where':{'id':_0x2739b0['params']['id']}})['then'](handleEntityNotFound(_0x3929a2,null))['then'](function(_0xf9f144){if(_0xf9f144){return db['OpenchannelAccount'][_0xf483('0x5a')]({'where':{'id':_0xf9f144['id']},'include':[{'model':db[_0xf483('0x81')],'as':'List','include':[{'model':db[_0xf483('0x70')],'as':_0xf483('0x83'),'where':{[_0xf9f144[_0xf483('0x7e')]]:_0x20a11b},'limit':0x1,'order':[[_0xf483('0x75'),'DESC']]}]}]})['then'](handleEntityNotFound(_0x3929a2,null))[_0xf483('0x21')](function(_0x4aeb82){if(_0x4aeb82&&_0x4aeb82[_0xf483('0x82')]){_0x3c9ed6=_0x4aeb82[_0xf483('0x5e')]({'plain':!![]});if(_0x3c9ed6[_0xf483('0x82')]&&_0x3c9ed6['List'][_0xf483('0x83')][_0xf483('0x4b')]){return _0x3c9ed6['List'][_0xf483('0x83')][0x0];}return db[_0xf483('0x70')]['create'](_['defaults'](_0x2739b0['body'],{'firstName':_0x20a11b,[_0x4aeb82[_0xf483('0x7e')]]:_0x20a11b,'phone':_0x20a11b,'ListId':_0x3c9ed6[_0xf483('0x77')]}));}})[_0xf483('0x21')](handleEntityNotFound(_0x3929a2,null))[_0xf483('0x21')](function(_0x37d356){if(_0x37d356){_0x58e269=_0x37d356;return db[_0xf483('0x90')][_0xf483('0x5a')]({'where':{'ContactId':_0x58e269['id'],'closed':![],'OpenchannelAccountId':_0x3c9ed6['id']}})[_0xf483('0x21')](function(_0xdb86c4){if(_0xdb86c4){return[_0xdb86c4,![]];}return db[_0xf483('0x90')][_0xf483('0x5b')]({'UserId':_0x2739b0['user']['id'],'ContactId':_0x58e269['id'],'OpenchannelAccountId':_0x3c9ed6['id'],'lastMsgDirection':_0xf483('0xbc'),'firstMsgDirection':_0xf483('0xbc'),'Messages':[_[_0xf483('0x59')](_0x2739b0[_0xf483('0x5c')],{'read':![],'body':_0x2739b0[_0xf483('0x5c')][_0xf483('0x5c')],'OpenchannelAccountId':_0x3c9ed6['id'],'UserId':_0x2739b0[_0xf483('0x5d')]['id'],'ContactId':_0x58e269['id']})]},{'include':[{'model':db[_0xf483('0x98')],'as':'Messages'}]})[_0xf483('0x21')](function(_0xec881d){return[_0xec881d,!![]];});});}})[_0xf483('0xb5')](function(_0x2a061c,_0x18480e){if(_0x18480e){return _0x2a061c;}return db['OpenchannelMessage']['create'](_[_0xf483('0x59')](_0x2739b0[_0xf483('0x5c')],{'read':![],'body':_0x2739b0[_0xf483('0x5c')][_0xf483('0x5c')],'OpenchannelAccountId':_0x3c9ed6['id'],'OpenchannelInteractionId':_0x2a061c['id'],'UserId':_0x2739b0[_0xf483('0x5d')]['id'],'ContactId':_0x58e269['id']}))[_0xf483('0x21')](function(_0x284d81){_0x2a061c['dataValues'][_0xf483('0xbd')]=[];_0x2a061c['dataValues'][_0xf483('0xbd')][_0xf483('0xbe')](_0x284d81[_0xf483('0xbf')]);return _0x2a061c;});});}})['then'](respondWithResult(_0x3929a2,null))[_0xf483('0x29')](handleError(_0x3929a2,null));}; \ No newline at end of file +var _0x19b5=['List','DESC','OpenchannelApplication','Applications','account','applications','orderBy','priority','asc','Contacts','lastName','threadId','ContactId','OpenchannelInteraction','contact','firstName','messageId','interaction','created','autoclose','push','close','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','queueId','OpenchannelQueue','queue','waitForTheAssignedQueue','Start','startRouting','EventManager','addApplications','Transaction','READ_COMMITTED','finally','send','getApplications','getInteractions','Contact','fullname','Tag','Tags','color','tag','addAgents','ids','omit','spread','emit','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','User','CmList','out','Messages','dataValues','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','client','http','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','sendStatus','status','json','offset','undefined','limit','count','set','apply','update','destroy','get','UserProfileResource','end','stack','name','index','Pause','map','OpenchannelAccount','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','findAll','catch','show','mandatoryDispositionPause','rawAttributes','include','find','create','role','user','OpenchannelAccounts','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','OpenchannelAccountId','Disposition','getDispositions','findOne','order','rows','removeDispositions','addAnswer','CannedAnswer','removeAnswers','notify','openchannel','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','updatedAt','CompanyId','ListId','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from'];(function(_0x114b7c,_0xc4b93b){var _0x47185f=function(_0x5b4cfa){while(--_0x5b4cfa){_0x114b7c['push'](_0x114b7c['shift']());}};_0x47185f(++_0xc4b93b);}(_0x19b5,0x1b7));var _0x519b=function(_0x5f5c53,_0x2734c3){_0x5f5c53=_0x5f5c53-0x0;var _0x109f1f=_0x19b5[_0x5f5c53];return _0x109f1f;};'use strict';var emlformat=require(_0x519b('0x0'));var rimraf=require(_0x519b('0x1'));var zipdir=require(_0x519b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x519b('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x519b('0x4'));var util=require(_0x519b('0x5'));var path=require(_0x519b('0x6'));var sox=require(_0x519b('0x7'));var csv=require(_0x519b('0x8'));var ejs=require(_0x519b('0x9'));var fs=require('fs');var fs_extra=require(_0x519b('0xa'));var _=require('lodash');var squel=require(_0x519b('0xb'));var crypto=require(_0x519b('0xc'));var jsforce=require(_0x519b('0xd'));var deskjs=require(_0x519b('0xe'));var toCsv=require('to-csv');var querystring=require(_0x519b('0xf'));var Papa=require('papaparse');var Redis=require(_0x519b('0x10'));var authService=require(_0x519b('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x519b('0x12'));var hardwareService=require(_0x519b('0x13'));var logger=require('../../config/logger')(_0x519b('0x14'));var utils=require(_0x519b('0x15'));var config=require(_0x519b('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x519b('0x17'))['db'];config[_0x519b('0x18')]=_[_0x519b('0x19')](config[_0x519b('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x519b('0x1a'))(new Redis(config[_0x519b('0x18')]));require(_0x519b('0x1b'))[_0x519b('0x1c')](socket);var jayson=require(_0x519b('0x1d'));var client=jayson[_0x519b('0x1e')][_0x519b('0x1f')]({'port':0x232c});var client9002=jayson['client'][_0x519b('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x5e6aaa,_0x612b8b,_0x362c1a,_0x17d924){return new BPromise(function(_0x5a0410,_0x48665c){var _0xb693b6=_0x17d924||client;return _0xb693b6[_0x519b('0x20')](_0x5e6aaa,_0x362c1a)[_0x519b('0x21')](function(_0x4144a2){logger[_0x519b('0x22')](_0x519b('0x23'),_0x612b8b,_0x519b('0x24'));logger['debug'](_0x519b('0x25'),_0x612b8b,_0x519b('0x24'),JSON['stringify'](_0x4144a2));if(_0x4144a2[_0x519b('0x26')]){if(_0x4144a2['error'][_0x519b('0x27')]===0x1f4){logger[_0x519b('0x26')](_0x519b('0x23'),_0x612b8b,_0x4144a2[_0x519b('0x26')][_0x519b('0x28')]);return _0x48665c(_0x4144a2['error'][_0x519b('0x28')]);}logger[_0x519b('0x26')](_0x519b('0x23'),_0x612b8b,_0x4144a2[_0x519b('0x26')][_0x519b('0x28')]);return _0x5a0410(_0x4144a2['error'][_0x519b('0x28')]);}else{logger['info'](_0x519b('0x23'),_0x612b8b,_0x519b('0x24'));_0x5a0410(_0x4144a2[_0x519b('0x29')][_0x519b('0x28')]);}})['catch'](function(_0x5affe1){logger[_0x519b('0x26')](_0x519b('0x23'),_0x612b8b,_0x5affe1);_0x48665c(_0x5affe1);});});}function respondWithStatusCode(_0x49832c,_0x31ebf8){_0x31ebf8=_0x31ebf8||0xcc;return function(_0x8dd34f){if(_0x8dd34f){return _0x49832c[_0x519b('0x2a')](_0x31ebf8);}return _0x49832c[_0x519b('0x2b')](_0x31ebf8)['end']();};}function respondWithResult(_0x7d9fcd,_0x4543d7){_0x4543d7=_0x4543d7||0xc8;return function(_0x2b19d4){if(_0x2b19d4){return _0x7d9fcd[_0x519b('0x2b')](_0x4543d7)[_0x519b('0x2c')](_0x2b19d4);}};}function respondWithFilteredResult(_0x4a69d1,_0x57aa0f){return function(_0x354328){if(_0x354328){var _0x1169dd=typeof _0x57aa0f[_0x519b('0x2d')]===_0x519b('0x2e')&&typeof _0x57aa0f[_0x519b('0x2f')]===_0x519b('0x2e');var _0x2e54a3=_0x354328[_0x519b('0x30')];var _0x75bd77=_0x1169dd?0x0:_0x57aa0f[_0x519b('0x2d')];var _0x5d8ec5=_0x1169dd?_0x354328[_0x519b('0x30')]:_0x57aa0f[_0x519b('0x2d')]+_0x57aa0f[_0x519b('0x2f')];var _0xdfdf9f;if(_0x5d8ec5>=_0x2e54a3){_0x5d8ec5=_0x2e54a3;_0xdfdf9f=0xc8;}else{_0xdfdf9f=0xce;}_0x4a69d1[_0x519b('0x2b')](_0xdfdf9f);return _0x4a69d1[_0x519b('0x31')]('Content-Range',_0x75bd77+'-'+_0x5d8ec5+'/'+_0x2e54a3)['json'](_0x354328);}return null;};}function patchUpdates(_0x1990dd){return function(_0x23e646){try{jsonpatch[_0x519b('0x32')](_0x23e646,_0x1990dd,!![]);}catch(_0x3dc90b){return BPromise['reject'](_0x3dc90b);}return _0x23e646['save']();};}function saveUpdates(_0x7d619,_0x1a1f01){return function(_0x59fe9a){if(_0x59fe9a){return _0x59fe9a[_0x519b('0x33')](_0x7d619)[_0x519b('0x21')](function(_0x3e06fe){return _0x3e06fe;});}return null;};}function removeEntity(_0x4eae61,_0x48a579){return function(_0x1362c0){if(_0x1362c0){return _0x1362c0[_0x519b('0x34')]()[_0x519b('0x21')](function(){var _0x487603=_0x1362c0[_0x519b('0x35')]({'plain':!![]});var _0x1227a4='OpenchannelAccounts';return db[_0x519b('0x36')][_0x519b('0x34')]({'where':{'type':_0x1227a4,'resourceId':_0x487603['id']}})[_0x519b('0x21')](function(){return _0x1362c0;});})[_0x519b('0x21')](function(){_0x4eae61[_0x519b('0x2b')](0xcc)[_0x519b('0x37')]();});}};}function handleEntityNotFound(_0x38bffd,_0x4172e7){return function(_0x5523fe){if(!_0x5523fe){_0x38bffd[_0x519b('0x2a')](0x194);}return _0x5523fe;};}function handleError(_0x536fb7,_0x467c10){_0x467c10=_0x467c10||0x1f4;return function(_0xdb7004){logger[_0x519b('0x26')](_0xdb7004[_0x519b('0x38')]);if(_0xdb7004[_0x519b('0x39')]){delete _0xdb7004[_0x519b('0x39')];}_0x536fb7['status'](_0x467c10)['send'](_0xdb7004);};}exports[_0x519b('0x3a')]=function(_0x22eb91,_0x1a2a28){var _0x364fa3={'include':[{'model':db[_0x519b('0x3b')],'as':'mandatoryDispositionPause'}]},_0x47fd2d={},_0x1abf88={'count':0x0,'rows':[]};var _0xedba34=_[_0x519b('0x3c')](db[_0x519b('0x3d')]['rawAttributes'],function(_0x463e1f){return{'name':_0x463e1f[_0x519b('0x3e')],'type':_0x463e1f['type'][_0x519b('0x3f')]};});_0x47fd2d[_0x519b('0x40')]=_[_0x519b('0x3c')](_0xedba34,_0x519b('0x39'));_0x47fd2d[_0x519b('0x41')]=_[_0x519b('0x42')](_0x22eb91[_0x519b('0x41')]);_0x47fd2d[_0x519b('0x43')]=_[_0x519b('0x44')](_0x47fd2d[_0x519b('0x40')],_0x47fd2d['query']);_0x364fa3[_0x519b('0x45')]=_[_0x519b('0x44')](_0x47fd2d[_0x519b('0x40')],qs['fields'](_0x22eb91[_0x519b('0x41')][_0x519b('0x46')]));_0x364fa3['attributes']=_0x364fa3[_0x519b('0x45')][_0x519b('0x47')]?_0x364fa3[_0x519b('0x45')]:_0x47fd2d[_0x519b('0x40')];if(!_0x22eb91['query'][_0x519b('0x48')](_0x519b('0x49'))){_0x364fa3[_0x519b('0x2f')]=qs[_0x519b('0x2f')](_0x22eb91['query'][_0x519b('0x2f')]);_0x364fa3[_0x519b('0x2d')]=qs['offset'](_0x22eb91[_0x519b('0x41')][_0x519b('0x2d')]);}_0x364fa3['order']=qs['sort'](_0x22eb91[_0x519b('0x41')][_0x519b('0x4a')]);_0x364fa3[_0x519b('0x4b')]=qs[_0x519b('0x43')](_[_0x519b('0x4c')](_0x22eb91[_0x519b('0x41')],_0x47fd2d[_0x519b('0x43')]),_0xedba34);if(_0x22eb91[_0x519b('0x41')][_0x519b('0x4d')]){_0x364fa3['where']=_[_0x519b('0x4e')](_0x364fa3[_0x519b('0x4b')],{'$or':_[_0x519b('0x3c')](_0xedba34,function(_0x1acea8){if(_0x1acea8['type']!=='VIRTUAL'){var _0x584dc1={};_0x584dc1[_0x1acea8[_0x519b('0x39')]]={'$like':'%'+_0x22eb91[_0x519b('0x41')][_0x519b('0x4d')]+'%'};return _0x584dc1;}})});}_0x364fa3=_[_0x519b('0x4e')]({},_0x364fa3,_0x22eb91[_0x519b('0x4f')]);var _0x37cded={'where':_0x364fa3[_0x519b('0x4b')]};return db['OpenchannelAccount'][_0x519b('0x30')](_0x37cded)[_0x519b('0x21')](function(_0x1cee0c){_0x1abf88[_0x519b('0x30')]=_0x1cee0c;if(_0x22eb91[_0x519b('0x41')][_0x519b('0x50')]){_0x364fa3['include']=[{'all':!![]}];}return db[_0x519b('0x3d')][_0x519b('0x51')](_0x364fa3);})[_0x519b('0x21')](function(_0x384b78){_0x1abf88['rows']=_0x384b78;return _0x1abf88;})['then'](respondWithFilteredResult(_0x1a2a28,_0x364fa3))[_0x519b('0x52')](handleError(_0x1a2a28,null));};exports[_0x519b('0x53')]=function(_0x8a1775,_0x267882){var _0x1488d7={'raw':![],'where':{'id':_0x8a1775['params']['id']},'include':[{'model':db['Pause'],'as':_0x519b('0x54')}]},_0x8348f={};_0x8348f[_0x519b('0x40')]=_['keys'](db[_0x519b('0x3d')][_0x519b('0x55')]);_0x8348f[_0x519b('0x41')]=_[_0x519b('0x42')](_0x8a1775[_0x519b('0x41')]);_0x8348f[_0x519b('0x43')]=_[_0x519b('0x44')](_0x8348f['model'],_0x8348f[_0x519b('0x41')]);_0x1488d7[_0x519b('0x45')]=_['intersection'](_0x8348f[_0x519b('0x40')],qs[_0x519b('0x46')](_0x8a1775[_0x519b('0x41')][_0x519b('0x46')]));_0x1488d7[_0x519b('0x45')]=_0x1488d7[_0x519b('0x45')][_0x519b('0x47')]?_0x1488d7[_0x519b('0x45')]:_0x8348f[_0x519b('0x40')];if(_0x8a1775['query'][_0x519b('0x50')]){_0x1488d7[_0x519b('0x56')]=[{'all':!![]}];}_0x1488d7=_[_0x519b('0x4e')]({},_0x1488d7,_0x8a1775[_0x519b('0x4f')]);return db[_0x519b('0x3d')][_0x519b('0x57')](_0x1488d7)[_0x519b('0x21')](handleEntityNotFound(_0x267882,null))[_0x519b('0x21')](respondWithResult(_0x267882,null))[_0x519b('0x52')](handleError(_0x267882,null));};exports[_0x519b('0x58')]=function(_0x1b0a77,_0x418a70){return db[_0x519b('0x3d')][_0x519b('0x58')](_0x1b0a77['body'],{})[_0x519b('0x21')](function(_0x5400ca){var _0x37ed23=_0x1b0a77['user'][_0x519b('0x35')]({'plain':!![]});if(!_0x37ed23)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x37ed23[_0x519b('0x59')]===_0x519b('0x5a')){var _0x151900=_0x5400ca[_0x519b('0x35')]({'plain':!![]});var _0x88756e=_0x519b('0x5b');return db[_0x519b('0x5c')][_0x519b('0x57')]({'where':{'name':_0x88756e,'userProfileId':_0x37ed23[_0x519b('0x5d')]},'raw':!![]})[_0x519b('0x21')](function(_0x45c640){if(_0x45c640&&_0x45c640[_0x519b('0x5e')]===0x0){return db['UserProfileResource'][_0x519b('0x58')]({'name':_0x151900[_0x519b('0x39')],'resourceId':_0x151900['id'],'type':_0x45c640[_0x519b('0x39')],'sectionId':_0x45c640['id']},{})[_0x519b('0x21')](function(){return _0x5400ca;});}else{return _0x5400ca;}})[_0x519b('0x52')](function(_0x45872e){logger[_0x519b('0x26')](_0x519b('0x5f'),_0x45872e);throw _0x45872e;});}return _0x5400ca;})[_0x519b('0x21')](respondWithResult(_0x418a70,0xc9))['catch'](handleError(_0x418a70,null));};exports['update']=function(_0x37ce2d,_0x3b4e3a){if(_0x37ce2d[_0x519b('0x60')]['id']){delete _0x37ce2d['body']['id'];}return db[_0x519b('0x3d')]['find']({'where':{'id':_0x37ce2d[_0x519b('0x61')]['id']},'include':[{'model':db['Pause'],'as':_0x519b('0x54')}]})['then'](handleEntityNotFound(_0x3b4e3a,null))[_0x519b('0x21')](saveUpdates(_0x37ce2d['body'],null))[_0x519b('0x21')](respondWithResult(_0x3b4e3a,null))['catch'](handleError(_0x3b4e3a,null));};exports[_0x519b('0x34')]=function(_0x3b37a2,_0xfdef39){return db[_0x519b('0x3d')][_0x519b('0x57')]({'where':{'id':_0x3b37a2[_0x519b('0x61')]['id']}})[_0x519b('0x21')](handleEntityNotFound(_0xfdef39,null))[_0x519b('0x21')](removeEntity(_0xfdef39,null))[_0x519b('0x52')](handleError(_0xfdef39,null));};exports['describe']=function(_0x55f4fd,_0x30e3bf){return db[_0x519b('0x3d')][_0x519b('0x62')]()[_0x519b('0x21')](respondWithResult(_0x30e3bf,null))[_0x519b('0x52')](handleError(_0x30e3bf,null));};exports['addDisposition']=function(_0x2595e6,_0xc827e3,_0x3d23e5){if(_0x2595e6[_0x519b('0x60')]['id']){delete _0x2595e6[_0x519b('0x60')]['id'];}return db[_0x519b('0x3d')]['find']({'where':{'id':_0x2595e6[_0x519b('0x61')]['id']}})[_0x519b('0x21')](handleEntityNotFound(_0xc827e3,null))[_0x519b('0x21')](function(_0x3a2805){if(_0x3a2805){_0x2595e6['body'][_0x519b('0x63')]=_0x3a2805['id'];return db[_0x519b('0x64')][_0x519b('0x58')](_0x2595e6['body']);}})[_0x519b('0x21')](respondWithResult(_0xc827e3,null))[_0x519b('0x52')](handleError(_0xc827e3,null));};exports[_0x519b('0x65')]=function(_0x3401b7,_0x169e53,_0x5a496b){var _0x25fc60={'raw':![],'where':{}};var _0x389f2c={};var _0x4beb6c={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x519b('0x66')]({'where':{'id':_0x3401b7[_0x519b('0x61')]['id']}})['then'](handleEntityNotFound(_0x169e53,null))[_0x519b('0x21')](function(_0x15da5d){if(_0x15da5d){_0x389f2c[_0x519b('0x40')]=_[_0x519b('0x42')](db['Disposition']['rawAttributes']);_0x389f2c[_0x519b('0x41')]=_[_0x519b('0x42')](_0x3401b7[_0x519b('0x41')]);_0x389f2c[_0x519b('0x43')]=_[_0x519b('0x44')](_0x389f2c['model'],_0x389f2c['query']);_0x25fc60[_0x519b('0x45')]=_['intersection'](_0x389f2c[_0x519b('0x40')],qs[_0x519b('0x46')](_0x3401b7[_0x519b('0x41')][_0x519b('0x46')]));_0x25fc60['attributes']=_0x25fc60[_0x519b('0x45')][_0x519b('0x47')]?_0x25fc60[_0x519b('0x45')]:_0x389f2c['model'];if(!_0x3401b7[_0x519b('0x41')][_0x519b('0x48')](_0x519b('0x49'))){_0x25fc60[_0x519b('0x2f')]=qs['limit'](_0x3401b7[_0x519b('0x41')]['limit']);_0x25fc60['offset']=qs['offset'](_0x3401b7[_0x519b('0x41')][_0x519b('0x2d')]);}_0x25fc60[_0x519b('0x67')]=qs[_0x519b('0x4a')](_0x3401b7['query'][_0x519b('0x4a')]);_0x25fc60[_0x519b('0x4b')]=qs[_0x519b('0x43')](_[_0x519b('0x4c')](_0x3401b7[_0x519b('0x41')],_0x389f2c[_0x519b('0x43')]));_0x25fc60['where'][_0x519b('0x63')]=_0x15da5d['id'];if(_0x3401b7['query'][_0x519b('0x4d')]){_0x25fc60['where']=_[_0x519b('0x4e')](_0x25fc60[_0x519b('0x4b')],{'$or':_[_0x519b('0x3c')](_0x25fc60[_0x519b('0x45')],function(_0x2d9fb4){var _0x3c8e8d={};_0x3c8e8d[_0x2d9fb4]={'$like':'%'+_0x3401b7[_0x519b('0x41')]['filter']+'%'};return _0x3c8e8d;})});}_0x25fc60=_['merge']({},_0x25fc60,_0x3401b7[_0x519b('0x4f')]);return db[_0x519b('0x64')][_0x519b('0x30')]({'where':_0x25fc60[_0x519b('0x4b')]})[_0x519b('0x21')](function(_0x15874d){_0x4beb6c['count']=_0x15874d;if(_0x3401b7[_0x519b('0x41')][_0x519b('0x50')]){_0x25fc60['include']=[{'all':!![]}];}return db['Disposition'][_0x519b('0x51')](_0x25fc60);})[_0x519b('0x21')](function(_0x37cd15){_0x4beb6c[_0x519b('0x68')]=_0x37cd15;return _0x4beb6c;});}})[_0x519b('0x21')](respondWithFilteredResult(_0x169e53,_0x25fc60))['catch'](handleError(_0x169e53,null));};exports[_0x519b('0x69')]=function(_0x37c1f9,_0x1b9e74,_0x35ddf8){return db[_0x519b('0x3d')][_0x519b('0x57')]({'where':{'id':_0x37c1f9[_0x519b('0x61')]['id']}})[_0x519b('0x21')](handleEntityNotFound(_0x1b9e74,null))['then'](function(_0x4d7fc8){if(_0x4d7fc8){return _0x4d7fc8[_0x519b('0x69')](_0x37c1f9[_0x519b('0x41')]['ids']);}})[_0x519b('0x21')](respondWithStatusCode(_0x1b9e74,null))['catch'](handleError(_0x1b9e74,null));};exports[_0x519b('0x6a')]=function(_0x4e7ac8,_0x4f9088,_0x4093d6){if(_0x4e7ac8[_0x519b('0x60')]['id']){delete _0x4e7ac8['body']['id'];}return db['OpenchannelAccount']['find']({'where':{'id':_0x4e7ac8[_0x519b('0x61')]['id']}})[_0x519b('0x21')](handleEntityNotFound(_0x4f9088,null))[_0x519b('0x21')](function(_0x3e9da1){if(_0x3e9da1){_0x4e7ac8[_0x519b('0x60')][_0x519b('0x63')]=_0x3e9da1['id'];return db[_0x519b('0x6b')][_0x519b('0x58')](_0x4e7ac8[_0x519b('0x60')]);}})['then'](respondWithResult(_0x4f9088,null))['catch'](handleError(_0x4f9088,null));};exports['getAnswers']=function(_0x536c6c,_0x1ebcfb,_0x4e2ed8){var _0x35649c={'raw':![],'where':{}};var _0x292bce={};var _0x11f8eb={'count':0x0,'rows':[]};return db[_0x519b('0x3d')][_0x519b('0x66')]({'where':{'id':_0x536c6c[_0x519b('0x61')]['id']}})[_0x519b('0x21')](handleEntityNotFound(_0x1ebcfb,null))[_0x519b('0x21')](function(_0x2522a2){if(_0x2522a2){_0x292bce[_0x519b('0x40')]=_['keys'](db[_0x519b('0x6b')][_0x519b('0x55')]);_0x292bce[_0x519b('0x41')]=_['keys'](_0x536c6c[_0x519b('0x41')]);_0x292bce['filters']=_[_0x519b('0x44')](_0x292bce[_0x519b('0x40')],_0x292bce[_0x519b('0x41')]);_0x35649c['attributes']=_[_0x519b('0x44')](_0x292bce[_0x519b('0x40')],qs[_0x519b('0x46')](_0x536c6c['query'][_0x519b('0x46')]));_0x35649c[_0x519b('0x45')]=_0x35649c[_0x519b('0x45')][_0x519b('0x47')]?_0x35649c[_0x519b('0x45')]:_0x292bce['model'];if(!_0x536c6c['query'][_0x519b('0x48')](_0x519b('0x49'))){_0x35649c[_0x519b('0x2f')]=qs[_0x519b('0x2f')](_0x536c6c[_0x519b('0x41')][_0x519b('0x2f')]);_0x35649c[_0x519b('0x2d')]=qs[_0x519b('0x2d')](_0x536c6c['query']['offset']);}_0x35649c[_0x519b('0x67')]=qs[_0x519b('0x4a')](_0x536c6c['query'][_0x519b('0x4a')]);_0x35649c[_0x519b('0x4b')]=qs['filters'](_['pick'](_0x536c6c[_0x519b('0x41')],_0x292bce['filters']));_0x35649c[_0x519b('0x4b')][_0x519b('0x63')]=_0x2522a2['id'];if(_0x536c6c[_0x519b('0x41')][_0x519b('0x4d')]){_0x35649c[_0x519b('0x4b')]=_[_0x519b('0x4e')](_0x35649c[_0x519b('0x4b')],{'$or':_[_0x519b('0x3c')](_0x35649c['attributes'],function(_0x470db7){var _0x3ec3d7={};_0x3ec3d7[_0x470db7]={'$like':'%'+_0x536c6c[_0x519b('0x41')]['filter']+'%'};return _0x3ec3d7;})});}_0x35649c=_[_0x519b('0x4e')]({},_0x35649c,_0x536c6c[_0x519b('0x4f')]);return db[_0x519b('0x6b')][_0x519b('0x30')]({'where':_0x35649c[_0x519b('0x4b')]})['then'](function(_0x4df3ba){_0x11f8eb[_0x519b('0x30')]=_0x4df3ba;if(_0x536c6c[_0x519b('0x41')][_0x519b('0x50')]){_0x35649c[_0x519b('0x56')]=[{'all':!![]}];}return db['CannedAnswer'][_0x519b('0x51')](_0x35649c);})['then'](function(_0x197be0){_0x11f8eb[_0x519b('0x68')]=_0x197be0;return _0x11f8eb;});}})[_0x519b('0x21')](respondWithFilteredResult(_0x1ebcfb,_0x35649c))['catch'](handleError(_0x1ebcfb,null));};exports[_0x519b('0x6c')]=function(_0x1de959,_0x54e715,_0x2aee26){return db[_0x519b('0x3d')][_0x519b('0x57')]({'where':{'id':_0x1de959[_0x519b('0x61')]['id']}})[_0x519b('0x21')](handleEntityNotFound(_0x54e715,null))[_0x519b('0x21')](function(_0x1be489){if(_0x1be489){return _0x1be489[_0x519b('0x6c')](_0x1de959[_0x519b('0x41')]['ids']);}})[_0x519b('0x21')](respondWithStatusCode(_0x54e715,null))['catch'](handleError(_0x54e715,null));};exports[_0x519b('0x6d')]=function(_0x385d5b,_0x15789f,_0x3849f3){var _0x46c140={'body':_0x385d5b['body'],'channel':_0x519b('0x6e')};var _0x533182=[];var _0x858911=[];var _0x54ef87={};var _0x406152=![];return db[_0x519b('0x6f')][_0x519b('0x62')]()['then'](function(_0x12fc44){if(!_0x12fc44){throw new db[(_0x519b('0x70'))][(_0x519b('0x71'))](_0x519b('0x72'));}_0x533182=_[_0x519b('0x73')](_[_0x519b('0x42')](_0x12fc44),['createdAt',_0x519b('0x74')]);_0x858911=_[_0x519b('0x73')](_[_0x519b('0x42')](_0x12fc44),['createdAt','updatedAt',_0x519b('0x75'),_0x519b('0x76')]);if(_0x385d5b[_0x519b('0x60')]['id']){delete _0x385d5b[_0x519b('0x60')]['id'];}if(_[_0x519b('0x77')](_0x385d5b[_0x519b('0x60')]['from'])){throw new db[(_0x519b('0x70'))]['ValidationError']('from\x20is\x20mandatory');}if(_['isNil'](_0x385d5b['body'][_0x519b('0x60')])||_0x385d5b[_0x519b('0x60')][_0x519b('0x60')]===''){throw new db[(_0x519b('0x70'))][(_0x519b('0x71'))](_0x519b('0x78'));}if(_['isNil'](_0x385d5b[_0x519b('0x60')][_0x519b('0x79')])){throw new db[(_0x519b('0x70'))][(_0x519b('0x71'))](_0x519b('0x7a')+_0x858911);}if(!_['includes'](_0x858911,_0x385d5b[_0x519b('0x60')][_0x519b('0x79')])){throw new db[(_0x519b('0x70'))][(_0x519b('0x71'))](_0x519b('0x7b')+_0x858911);}_0x54ef87[_0x385d5b[_0x519b('0x60')][_0x519b('0x79')]]=_0x385d5b[_0x519b('0x60')][_0x519b('0x7c')];})[_0x519b('0x21')](function(){return db[_0x519b('0x3d')][_0x519b('0x57')]({'where':{'id':_0x385d5b['params']['id']},'include':[{'model':db['CmList'],'as':_0x519b('0x7d'),'include':[{'model':db[_0x519b('0x6f')],'as':'Contacts','where':_0x54ef87,'limit':0x1,'order':[[_0x519b('0x74'),_0x519b('0x7e')]]}]},{'model':db[_0x519b('0x7f')],'as':_0x519b('0x80')}]});})[_0x519b('0x21')](handleEntityNotFound(_0x15789f,null))['then'](function(_0x4cd343){if(_0x4cd343&&_0x4cd343[_0x519b('0x7d')]){_0x46c140[_0x519b('0x81')]=_0x4cd343;_0x46c140[_0x519b('0x82')]=_0x4cd343[_0x519b('0x80')];_0x46c140['list']=_0x4cd343['List'];_0x46c140[_0x519b('0x82')]=_[_0x519b('0x83')](_0x46c140[_0x519b('0x82')],[_0x519b('0x84')],[_0x519b('0x85')]);if(_0x46c140['account'][_0x519b('0x80')]){delete _0x46c140[_0x519b('0x81')]['Applications'];}if(_0x46c140[_0x519b('0x81')]['List']&&_0x46c140[_0x519b('0x81')][_0x519b('0x7d')]['Contacts'][_0x519b('0x47')]){return _0x46c140[_0x519b('0x81')][_0x519b('0x7d')][_0x519b('0x86')][0x0];}var _0x519bd3=_[_0x519b('0x19')](_0x385d5b[_0x519b('0x60')],{'firstName':_0x385d5b[_0x519b('0x60')][_0x519b('0x7c')],'ListId':_0x4cd343[_0x519b('0x76')]});_0x519bd3[_0x385d5b[_0x519b('0x60')][_0x519b('0x79')]]=_0x385d5b[_0x519b('0x60')][_0x519b('0x7c')];return db[_0x519b('0x6f')]['create'](_0x519bd3,{'fields':_0x533182,'raw':!![]});}})[_0x519b('0x21')](handleEntityNotFound(_0x15789f,null))[_0x519b('0x21')](function(_0x588040){_0x46c140['contact']=_0x588040;if(_0x588040){var _0x1915f9={'ContactId':_0x588040['id'],'OpenchannelAccountId':_0x385d5b[_0x519b('0x61')]['id'],'from':(_0x588040['firstName']||'')+'\x20'+(_0x588040[_0x519b('0x87')]||'')};var _0x5690b4={'OpenchannelAccountId':_0x385d5b[_0x519b('0x61')]['id'],'closed':![]};if(_0x385d5b['body'][_0x519b('0x88')]){_0x5690b4[_0x519b('0x88')]=_0x385d5b[_0x519b('0x60')][_0x519b('0x88')];return db['OpenchannelInteraction'][_0x519b('0x57')]({'where':_0x5690b4})[_0x519b('0x21')](function(_0x3f01cf){if(_0x3f01cf){return[_0x3f01cf,![]];}_0x1915f9[_0x519b('0x88')]=_0x385d5b['body'][_0x519b('0x88')];_0x1915f9['externalUrl']=_0x385d5b['body']['externalUrl'];return db['OpenchannelInteraction'][_0x519b('0x58')](_0x1915f9)['then'](function(_0x48d55f){return[_0x48d55f,!![]];});});}else{_0x5690b4[_0x519b('0x88')]=null;}_0x5690b4[_0x519b('0x89')]=_0x588040['id'];return db['OpenchannelInteraction'][_0x519b('0x57')]({'where':_0x5690b4})[_0x519b('0x21')](function(_0x504633){if(_0x504633){return[_0x504633,![]];}return db[_0x519b('0x8a')]['create'](_0x1915f9)[_0x519b('0x21')](function(_0x2ce147){return[_0x2ce147,!![]];});});}})['spread'](function(_0x5ba252,_0x1964a5){if(_0x5ba252){_0x406152=_0x1964a5;if(!_0x1964a5){var _0x755665={'from':(_0x46c140[_0x519b('0x8b')][_0x519b('0x8c')]||'')+'\x20'+(_0x46c140['contact'][_0x519b('0x87')]||'')};if(_0x385d5b['body'][_0x519b('0x88')]&&_0x385d5b[_0x519b('0x60')][_0x519b('0x8d')]&&_0x385d5b[_0x519b('0x60')][_0x519b('0x88')]!=_0x385d5b[_0x519b('0x60')][_0x519b('0x8d')]){_0x755665['threadId']=_0x385d5b[_0x519b('0x60')][_0x519b('0x8d')];}return _0x5ba252['update'](_0x755665);}else{return _0x5ba252;}}})[_0x519b('0x21')](function(_0x4c976d){_0x46c140[_0x519b('0x8e')]=_0x4c976d[_0x519b('0x35')]({'plain':!![]});_0x46c140['interaction']['created']=_0x406152;if(_0x46c140[_0x519b('0x8e')][_0x519b('0x8f')]){if(_0x46c140[_0x519b('0x81')][_0x519b('0x90')]){_0x46c140[_0x519b('0x82')][_0x519b('0x91')]({'id':0x0,'priority':_0x46c140['applications'][_0x519b('0x47')]+0x1,'app':_0x519b('0x92'),'appdata':'unmanaged','interval':_0x519b('0x93')});}}return db[_0x519b('0x94')][_0x519b('0x58')]({'body':_0x385d5b['body'][_0x519b('0x60')],'OpenchannelAccountId':_0x385d5b['params']['id'],'OpenchannelInteractionId':_0x4c976d['id'],'direction':'in','ContactId':_0x46c140[_0x519b('0x8b')]['id'],'AttachmentId':_0x385d5b[_0x519b('0x60')][_0x519b('0x95')]});})[_0x519b('0x21')](function(_0x322093){_0x46c140[_0x519b('0x28')]=_0x322093;if(!_0x46c140[_0x519b('0x8e')][_0x519b('0x96')])return;return db['User'][_0x519b('0x57')]({'attributes':['id','name'],'where':{'id':_0x46c140[_0x519b('0x8e')][_0x519b('0x96')]}});})[_0x519b('0x21')](function(_0x4bfcaf){if(_0x4bfcaf){_0x46c140['applications'][_0x519b('0x97')]({'id':0x0,'priority':0x0,'app':_0x519b('0x98'),'appdata':_0x4bfcaf[_0x519b('0x39')]+','+(_0x46c140[_0x519b('0x81')][_0x519b('0x99')]||0xa),'interval':_0x519b('0x93')});}if(!_0x46c140[_0x519b('0x8e')][_0x519b('0x9a')])return;return db[_0x519b('0x9b')][_0x519b('0x57')]({'attributes':['id',_0x519b('0x39')],'where':{'id':_0x46c140['interaction']['queueId']}});})[_0x519b('0x21')](function(_0x4826e4){if(_0x4826e4){_0x46c140[_0x519b('0x82')][_0x519b('0x97')]({'id':0x0,'priority':0x1,'app':_0x519b('0x9c'),'appdata':_0x4826e4['name']+','+(_0x46c140[_0x519b('0x81')][_0x519b('0x9d')]||0x12c),'interval':_0x519b('0x93')});}return respondWithRpcPromise(_0x519b('0x9e'),_0x519b('0x9f'),_0x46c140);})[_0x519b('0x21')](function(_0x2411bd){respondWithRpcPromise(_0x519b('0xa0'),_0x519b('0xa0'),{'event':_0x519b('0x6d'),'message':_0x2411bd},client9002);return _0x2411bd;})[_0x519b('0x21')](respondWithResult(_0x15789f,null))['catch'](handleError(_0x15789f,null));};exports[_0x519b('0xa1')]=function(_0x290d44,_0x246d0e){var _0x40b310=_0x290d44[_0x519b('0x61')]['id'];var _0x445a31=_0x290d44[_0x519b('0x60')];var _0x291c18=0xc8;var _0x1ee526=null;return db['sequelize']['transaction']({'isolationLevel':db['sequelize'][_0x519b('0xa2')]['ISOLATION_LEVELS'][_0x519b('0xa3')]},function(_0x261f98){return db[_0x519b('0x3d')][_0x519b('0x66')]({'where':{'id':_0x40b310},'transaction':_0x261f98})['then'](function(_0xde3c07){if(_0xde3c07){return db[_0x519b('0x7f')]['destroy']({'where':{'OpenchannelAccountId':_0x40b310},'transaction':_0x261f98})[_0x519b('0x21')](function(){var _0x24c2c9=_['map'](_0x445a31,function(_0x13a481){_0x13a481[_0x519b('0x63')]=_0x40b310;return _0x13a481;});return db[_0x519b('0x7f')]['bulkCreate'](_0x24c2c9,{'transaction':_0x261f98});});}else{_0x291c18=0x194;_0x1ee526=[];}});})['then'](function(){if(_0x291c18!==0x194){return db['OpenchannelApplication']['findAndCountAll']({'where':{'OpenchannelAccountId':_0x40b310},'order':_0x519b('0x84')})[_0x519b('0x21')](function(_0x318b5f){_0x1ee526=_0x318b5f;});}})['catch'](function(_0x34c6af){_0x291c18=0x1f4;logger[_0x519b('0x26')](_0x34c6af[_0x519b('0x38')]);if(_0x34c6af[_0x519b('0x39')]){delete _0x34c6af[_0x519b('0x39')];}_0x1ee526=_0x34c6af;})[_0x519b('0xa4')](function(){if(_0x1ee526===null){_0x246d0e[_0x519b('0x2a')](_0x291c18);}else{if(_0x291c18===0x1f4){_0x246d0e['status'](_0x291c18)[_0x519b('0xa5')](_0x1ee526);}else{_0x246d0e[_0x519b('0x2b')](_0x291c18)[_0x519b('0x2c')](_0x1ee526);}}});};exports[_0x519b('0xa6')]=function(_0x2a2d52,_0x406372,_0x3fb7e0){var _0x1f1a65={};var _0x1f59c7={};var _0x59651c;var _0x50649c;return db[_0x519b('0x3d')]['findOne']({'where':{'id':_0x2a2d52['params']['id']}})[_0x519b('0x21')](handleEntityNotFound(_0x406372,null))[_0x519b('0x21')](function(_0x99f4cc){if(_0x99f4cc){_0x59651c=_0x99f4cc;_0x1f59c7[_0x519b('0x40')]=_[_0x519b('0x42')](db[_0x519b('0x7f')][_0x519b('0x55')]);_0x1f59c7['query']=_['keys'](_0x2a2d52[_0x519b('0x41')]);_0x1f59c7['filters']=_[_0x519b('0x44')](_0x1f59c7['model'],_0x1f59c7[_0x519b('0x41')]);_0x1f1a65[_0x519b('0x45')]=_['intersection'](_0x1f59c7['model'],qs[_0x519b('0x46')](_0x2a2d52[_0x519b('0x41')][_0x519b('0x46')]));_0x1f1a65[_0x519b('0x45')]=_0x1f1a65['attributes'][_0x519b('0x47')]?_0x1f1a65['attributes']:_0x1f59c7[_0x519b('0x40')];_0x1f1a65[_0x519b('0x67')]=qs[_0x519b('0x4a')](_0x2a2d52[_0x519b('0x41')][_0x519b('0x4a')]);_0x1f1a65[_0x519b('0x4b')]=qs['filters'](_['pick'](_0x2a2d52[_0x519b('0x41')],_0x1f59c7[_0x519b('0x43')]));if(_0x2a2d52[_0x519b('0x41')][_0x519b('0x4d')]){_0x1f1a65[_0x519b('0x4b')]=_[_0x519b('0x4e')](_0x1f1a65['where'],{'$or':_[_0x519b('0x3c')](_0x1f1a65[_0x519b('0x45')],function(_0xb05d01){var _0xac855f={};_0xac855f[_0xb05d01]={'$like':'%'+_0x2a2d52['query'][_0x519b('0x4d')]+'%'};return _0xac855f;})});}_0x1f1a65=_['merge']({},_0x1f1a65,_0x2a2d52[_0x519b('0x4f')]);return _0x59651c[_0x519b('0xa6')](_0x1f1a65);}})[_0x519b('0x21')](function(_0xe7c8fa){if(_0xe7c8fa){_0x50649c=_0xe7c8fa[_0x519b('0x47')];if(!_0x2a2d52[_0x519b('0x41')][_0x519b('0x48')](_0x519b('0x49'))){_0x1f1a65[_0x519b('0x2f')]=qs[_0x519b('0x2f')](_0x2a2d52[_0x519b('0x41')][_0x519b('0x2f')]);_0x1f1a65[_0x519b('0x2d')]=qs[_0x519b('0x2d')](_0x2a2d52['query'][_0x519b('0x2d')]);}return _0x59651c[_0x519b('0xa6')](_0x1f1a65);}})[_0x519b('0x21')](function(_0x4b60ea){if(_0x4b60ea){return _0x4b60ea?{'count':_0x50649c,'rows':_0x4b60ea}:null;}})[_0x519b('0x21')](respondWithResult(_0x406372,null))[_0x519b('0x52')](handleError(_0x406372,null));};exports[_0x519b('0xa7')]=function(_0x2abe1b,_0x14fcef,_0x1ca9c8){var _0x50d1e1={'raw':![],'where':{}};var _0x581d5a={};var _0x5d3de9={'count':0x0,'rows':[]};return db[_0x519b('0x3d')]['findOne']({'where':{'id':_0x2abe1b[_0x519b('0x61')]['id']}})[_0x519b('0x21')](handleEntityNotFound(_0x14fcef,null))[_0x519b('0x21')](function(_0x156063){if(_0x156063){_0x581d5a[_0x519b('0x40')]=_['keys'](db['OpenchannelInteraction'][_0x519b('0x55')]);_0x581d5a[_0x519b('0x41')]=_[_0x519b('0x42')](_0x2abe1b[_0x519b('0x41')]);_0x581d5a['filters']=_['intersection'](_0x581d5a[_0x519b('0x40')],_0x581d5a[_0x519b('0x41')]);_0x50d1e1[_0x519b('0x45')]=_[_0x519b('0x44')](_0x581d5a['model'],qs[_0x519b('0x46')](_0x2abe1b['query'][_0x519b('0x46')]));_0x50d1e1[_0x519b('0x45')]=_0x50d1e1[_0x519b('0x45')][_0x519b('0x47')]?_0x50d1e1[_0x519b('0x45')]:_0x581d5a['model'];if(!_0x2abe1b['query'][_0x519b('0x48')](_0x519b('0x49'))){_0x50d1e1[_0x519b('0x2f')]=qs[_0x519b('0x2f')](_0x2abe1b[_0x519b('0x41')][_0x519b('0x2f')]);_0x50d1e1['offset']=qs['offset'](_0x2abe1b[_0x519b('0x41')]['offset']);}_0x50d1e1[_0x519b('0x67')]=qs['sort'](_0x2abe1b[_0x519b('0x41')][_0x519b('0x4a')]);_0x50d1e1[_0x519b('0x4b')]=qs[_0x519b('0x43')](_['pick'](_0x2abe1b[_0x519b('0x41')],_0x581d5a['filters']));_0x50d1e1[_0x519b('0x4b')][_0x519b('0x63')]=_0x156063['id'];if(_0x2abe1b['query'][_0x519b('0x4d')]){_0x50d1e1[_0x519b('0x4b')]=_[_0x519b('0x4e')](_0x50d1e1[_0x519b('0x4b')],{'$or':_[_0x519b('0x3c')](_0x50d1e1[_0x519b('0x45')],function(_0x4d418f){var _0x2806c4={};_0x2806c4[_0x4d418f]={'$like':'%'+_0x2abe1b[_0x519b('0x41')][_0x519b('0x4d')]+'%'};return _0x2806c4;})});}_0x50d1e1=_[_0x519b('0x4e')]({},_0x50d1e1,_0x2abe1b[_0x519b('0x4f')]);return db[_0x519b('0x8a')][_0x519b('0x30')]({'where':_0x50d1e1['where']})[_0x519b('0x21')](function(_0x130b14){_0x5d3de9['count']=_0x130b14;if(_0x2abe1b['query']['includeAll']){_0x50d1e1['include']=[{'model':db[_0x519b('0x6f')],'as':_0x519b('0xa8'),'required':![]},{'model':db['User'],'as':'Owner','attributes':[_0x519b('0x39'),_0x519b('0xa9'),'internal'],'required':![]},{'model':db[_0x519b('0xaa')],'as':_0x519b('0xab'),'attributes':['id',_0x519b('0x39'),_0x519b('0xac')],'where':_0x2abe1b['query'][_0x519b('0xad')]?{'id':_0x2abe1b[_0x519b('0x41')][_0x519b('0xad')]}:undefined,'required':_0x2abe1b[_0x519b('0x41')][_0x519b('0xad')]?!![]:![]}];}return db['OpenchannelInteraction']['findAll'](_0x50d1e1);})[_0x519b('0x21')](function(_0x588e35){_0x5d3de9[_0x519b('0x68')]=_0x588e35;return _0x5d3de9;});}})['then'](respondWithFilteredResult(_0x14fcef,_0x50d1e1))['catch'](handleError(_0x14fcef,null));};exports[_0x519b('0xae')]=function(_0x231fd3,_0x177bae,_0x510d6e){return db[_0x519b('0x3d')][_0x519b('0x57')]({'where':{'id':_0x231fd3[_0x519b('0x61')]['id']}})[_0x519b('0x21')](handleEntityNotFound(_0x177bae,null))[_0x519b('0x21')](function(_0x4a4434){if(_0x4a4434){return _0x4a4434['addAgents'](_0x231fd3[_0x519b('0x60')][_0x519b('0xaf')],_[_0x519b('0xb0')](_0x231fd3[_0x519b('0x60')],[_0x519b('0xaf'),'id'])||{})[_0x519b('0xb1')](function(_0x23f4bd){for(var _0x5d847b=0x0;_0x5d847b<_0x231fd3[_0x519b('0x60')][_0x519b('0xaf')][_0x519b('0x47')];_0x5d847b+=0x1){socket[_0x519b('0xb2')]('userOpenchannelAccount:save',{'UserId':Number(_0x231fd3[_0x519b('0x60')][_0x519b('0xaf')][_0x5d847b]),'OpenchannelAccountId':Number(_0x231fd3[_0x519b('0x61')]['id'])});}return _0x23f4bd;});}})[_0x519b('0x21')](respondWithResult(_0x177bae,null))[_0x519b('0x52')](handleError(_0x177bae,null));};exports[_0x519b('0xb3')]=function(_0x2abd94,_0x5d852a,_0x4dc4a0){return db['OpenchannelAccount']['find']({'where':{'id':_0x2abd94[_0x519b('0x61')]['id']}})[_0x519b('0x21')](handleEntityNotFound(_0x5d852a,null))[_0x519b('0x21')](function(_0x56d8d9){if(_0x56d8d9){return _0x56d8d9['removeAgents'](_0x2abd94[_0x519b('0x41')]['ids'])[_0x519b('0x21')](function(){if(_[_0x519b('0xb4')](_0x2abd94['query']['ids'])){for(var _0xddddbd=0x0;_0xddddbd<_0x2abd94[_0x519b('0x41')][_0x519b('0xaf')][_0x519b('0x47')];_0xddddbd+=0x1){socket[_0x519b('0xb2')](_0x519b('0xb5'),{'UserId':Number(_0x2abd94[_0x519b('0x41')][_0x519b('0xaf')][_0xddddbd]),'OpenchannelAccountId':Number(_0x2abd94[_0x519b('0x61')]['id'])});}}else{socket['emit'](_0x519b('0xb5'),{'UserId':Number(_0x2abd94[_0x519b('0x41')]['ids']),'OpenchannelAccountId':Number(_0x2abd94[_0x519b('0x61')]['id'])});}});}})[_0x519b('0x21')](respondWithStatusCode(_0x5d852a,null))[_0x519b('0x52')](handleError(_0x5d852a,null));};exports[_0x519b('0xb6')]=function(_0x29c00d,_0x19a21c,_0x531475){var _0x45e221={};var _0x3a5c2f={};var _0x14eecb;var _0x4784a9;return db[_0x519b('0x3d')][_0x519b('0x66')]({'where':{'id':_0x29c00d[_0x519b('0x61')]['id']}})[_0x519b('0x21')](handleEntityNotFound(_0x19a21c,null))[_0x519b('0x21')](function(_0x32701a){if(_0x32701a){_0x14eecb=_0x32701a;_0x3a5c2f['model']=_[_0x519b('0x42')](db[_0x519b('0xb7')][_0x519b('0x55')]);_0x3a5c2f['query']=_[_0x519b('0x42')](_0x29c00d[_0x519b('0x41')]);_0x3a5c2f['filters']=_['intersection'](_0x3a5c2f[_0x519b('0x40')],_0x3a5c2f[_0x519b('0x41')]);_0x45e221['attributes']=_['intersection'](_0x3a5c2f[_0x519b('0x40')],qs[_0x519b('0x46')](_0x29c00d['query'][_0x519b('0x46')]));_0x45e221[_0x519b('0x45')]=_0x45e221[_0x519b('0x45')][_0x519b('0x47')]?_0x45e221[_0x519b('0x45')]:_0x3a5c2f['model'];_0x45e221['order']=qs[_0x519b('0x4a')](_0x29c00d[_0x519b('0x41')][_0x519b('0x4a')]);_0x45e221[_0x519b('0x4b')]=qs['filters'](_['pick'](_0x29c00d[_0x519b('0x41')],_0x3a5c2f[_0x519b('0x43')]));if(_0x29c00d[_0x519b('0x41')][_0x519b('0x4d')]){_0x45e221[_0x519b('0x4b')]=_['merge'](_0x45e221['where'],{'$or':_['map'](_0x45e221[_0x519b('0x45')],function(_0x141d79){var _0x34c569={};_0x34c569[_0x141d79]={'$like':'%'+_0x29c00d['query']['filter']+'%'};return _0x34c569;})});}_0x45e221=_[_0x519b('0x4e')]({},_0x45e221,_0x29c00d[_0x519b('0x4f')]);return _0x14eecb[_0x519b('0xb6')](_0x45e221);}})[_0x519b('0x21')](function(_0x3a42b9){if(_0x3a42b9){_0x4784a9=_0x3a42b9[_0x519b('0x47')];if(!_0x29c00d['query'][_0x519b('0x48')]('nolimit')){_0x45e221[_0x519b('0x2f')]=qs[_0x519b('0x2f')](_0x29c00d[_0x519b('0x41')]['limit']);_0x45e221['offset']=qs[_0x519b('0x2d')](_0x29c00d[_0x519b('0x41')][_0x519b('0x2d')]);}return _0x14eecb[_0x519b('0xb6')](_0x45e221);}})['then'](function(_0x3c36ed){if(_0x3c36ed){return _0x3c36ed?{'count':_0x4784a9,'rows':_0x3c36ed}:null;}})[_0x519b('0x21')](respondWithResult(_0x19a21c,null))['catch'](handleError(_0x19a21c,null));};exports[_0x519b('0xa5')]=function(_0x16c9da,_0x429ba7,_0x13eb4a){var _0x3a1d18,_0x2d57d4,_0x2ec6d9;if(_[_0x519b('0x77')](_0x16c9da['body'][_0x519b('0x60')])||_0x16c9da[_0x519b('0x60')]['body']===''){throw new db[(_0x519b('0x70'))][(_0x519b('0x71'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x16c9da[_0x519b('0x60')]['to'])){}_0x3a1d18=_0x16c9da[_0x519b('0x60')]['to'];return db[_0x519b('0x3d')][_0x519b('0x66')]({'where':{'id':_0x16c9da[_0x519b('0x61')]['id']}})[_0x519b('0x21')](handleEntityNotFound(_0x429ba7,null))[_0x519b('0x21')](function(_0x23ba78){if(_0x23ba78){return db[_0x519b('0x3d')][_0x519b('0x57')]({'where':{'id':_0x23ba78['id']},'include':[{'model':db[_0x519b('0xb8')],'as':'List','include':[{'model':db['CmContact'],'as':_0x519b('0x86'),'where':{[_0x23ba78[_0x519b('0x79')]]:_0x3a1d18},'limit':0x1,'order':[[_0x519b('0x74'),_0x519b('0x7e')]]}]}]})[_0x519b('0x21')](handleEntityNotFound(_0x429ba7,null))['then'](function(_0x4e68ad){if(_0x4e68ad&&_0x4e68ad[_0x519b('0x7d')]){_0x2d57d4=_0x4e68ad[_0x519b('0x35')]({'plain':!![]});if(_0x2d57d4['List']&&_0x2d57d4[_0x519b('0x7d')]['Contacts'][_0x519b('0x47')]){return _0x2d57d4[_0x519b('0x7d')][_0x519b('0x86')][0x0];}return db['CmContact'][_0x519b('0x58')](_[_0x519b('0x19')](_0x16c9da[_0x519b('0x60')],{'firstName':_0x3a1d18,[_0x4e68ad['mapKey']]:_0x3a1d18,'phone':_0x3a1d18,'ListId':_0x2d57d4[_0x519b('0x76')]}));}})['then'](handleEntityNotFound(_0x429ba7,null))[_0x519b('0x21')](function(_0x240deb){if(_0x240deb){_0x2ec6d9=_0x240deb;return db[_0x519b('0x8a')][_0x519b('0x57')]({'where':{'ContactId':_0x2ec6d9['id'],'closed':![],'OpenchannelAccountId':_0x2d57d4['id']}})['then'](function(_0x26f4a6){if(_0x26f4a6){return[_0x26f4a6,![]];}return db['OpenchannelInteraction']['create']({'UserId':_0x16c9da[_0x519b('0x5a')]['id'],'ContactId':_0x2ec6d9['id'],'OpenchannelAccountId':_0x2d57d4['id'],'lastMsgDirection':_0x519b('0xb9'),'firstMsgDirection':_0x519b('0xb9'),'Messages':[_[_0x519b('0x4e')](_0x16c9da[_0x519b('0x60')],{'read':![],'body':_0x16c9da['body'][_0x519b('0x60')],'OpenchannelAccountId':_0x2d57d4['id'],'UserId':_0x16c9da['user']['id'],'ContactId':_0x2ec6d9['id']})]},{'include':[{'model':db[_0x519b('0x94')],'as':_0x519b('0xba')}]})['then'](function(_0xd75844){return[_0xd75844,!![]];});});}})[_0x519b('0xb1')](function(_0x8d2ded,_0x5ea0c4){if(_0x5ea0c4){return _0x8d2ded;}return db[_0x519b('0x94')][_0x519b('0x58')](_[_0x519b('0x4e')](_0x16c9da[_0x519b('0x60')],{'read':![],'body':_0x16c9da[_0x519b('0x60')][_0x519b('0x60')],'OpenchannelAccountId':_0x2d57d4['id'],'OpenchannelInteractionId':_0x8d2ded['id'],'UserId':_0x16c9da[_0x519b('0x5a')]['id'],'ContactId':_0x2ec6d9['id']}))[_0x519b('0x21')](function(_0x523913){_0x8d2ded['dataValues'][_0x519b('0xba')]=[];_0x8d2ded[_0x519b('0xbb')][_0x519b('0xba')][_0x519b('0x91')](_0x523913[_0x519b('0xbb')]);return _0x8d2ded;});});}})[_0x519b('0x21')](respondWithResult(_0x429ba7,null))['catch'](handleError(_0x429ba7,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 181f136..54fe3df 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 _0xe706=['hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelAccount','save','update','remove','emit'];(function(_0xce32e9,_0x40820d){var _0x5a6d7c=function(_0x4bfc42){while(--_0x4bfc42){_0xce32e9['push'](_0xce32e9['shift']());}};_0x5a6d7c(++_0x40820d);}(_0xe706,0xa3));var _0x6e70=function(_0x5ee287,_0x49b6a1){_0x5ee287=_0x5ee287-0x0;var _0x2a1adf=_0xe706[_0x5ee287];return _0x2a1adf;};'use strict';var EventEmitter=require(_0x6e70('0x0'));var OpenchannelAccount=require(_0x6e70('0x1'))['db'][_0x6e70('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6e70('0x3'),'afterUpdate':_0x6e70('0x4'),'afterDestroy':_0x6e70('0x5')};function emitEvent(_0x7dfbc3){return function(_0x142c27,_0x2164a4,_0x376a8d){OpenchannelAccountEvents[_0x6e70('0x6')](_0x7dfbc3+':'+_0x142c27['id'],_0x142c27);OpenchannelAccountEvents[_0x6e70('0x6')](_0x7dfbc3,_0x142c27);_0x376a8d(null);};}for(var e in events){if(events[_0x6e70('0x7')](e)){var event=events[e];OpenchannelAccount[_0x6e70('0x8')](e,emitEvent(event));}}module[_0x6e70('0x9')]=OpenchannelAccountEvents; \ No newline at end of file +var _0xf4eb=['hook','events','update','emit','hasOwnProperty'];(function(_0x5ea60a,_0xd007d4){var _0x1b2359=function(_0x5e4b53){while(--_0x5e4b53){_0x5ea60a['push'](_0x5ea60a['shift']());}};_0x1b2359(++_0xd007d4);}(_0xf4eb,0xec));var _0xbf4e=function(_0x376006,_0x4db369){_0x376006=_0x376006-0x0;var _0x42ca92=_0xf4eb[_0x376006];return _0x42ca92;};'use strict';var EventEmitter=require(_0xbf4e('0x0'));var OpenchannelAccount=require('../../mysqldb')['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xbf4e('0x1'),'afterDestroy':'remove'};function emitEvent(_0x4e7fa7){return function(_0x2e3070,_0x1c7606,_0x32d1d7){OpenchannelAccountEvents[_0xbf4e('0x2')](_0x4e7fa7+':'+_0x2e3070['id'],_0x2e3070);OpenchannelAccountEvents[_0xbf4e('0x2')](_0x4e7fa7,_0x2e3070);_0x32d1d7(null);};}for(var e in events){if(events[_0xbf4e('0x3')](e)){var event=events[e];OpenchannelAccount[_0xbf4e('0x4')](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 e5944b9..3d1ddf4 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(_0x2b05d8,_0x54ec4d){var _0xe254ea=function(_0x2ade05){while(--_0x2ade05){_0x2b05d8['push'](_0x2b05d8['shift']());}};_0xe254ea(++_0x54ec4d);}(_0xa9e0,0x123));var _0x0a9e=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa9e0[_0xae7c2f];return _0x5d7001;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'openchannel_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['../../config/environment','./openchannelAccount.attributes','exports','define','OpenchannelAccount','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x4b0061,_0x8a95da){var _0x55c2db=function(_0x2dd1ba){while(--_0x2dd1ba){_0x4b0061['push'](_0x4b0061['shift']());}};_0x55c2db(++_0x8a95da);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xa9e0[_0x47e7cb];return _0x2a8874;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 a4f5291..e3bbef6 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 _0xcb91=['stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','localhost','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x1acb7e,_0x5c1b6f){var _0x18b5c7=function(_0x5af735){while(--_0x5af735){_0x1acb7e['push'](_0x1acb7e['shift']());}};_0x18b5c7(++_0x5c1b6f);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x30cd7e,_0x4db10a){_0x30cd7e=_0x30cd7e-0x0;var _0x462a02=_0xcb91[_0x30cd7e];return _0x462a02;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var BPromise=require(_0x1cb9('0x1'));var rs=require(_0x1cb9('0x2'));var fs=require('fs');var Redis=require(_0x1cb9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('rpc');var config=require(_0x1cb9('0x6'));var jayson=require(_0x1cb9('0x7'));var client=jayson['client'][_0x1cb9('0x8')]({'port':0x232a});config[_0x1cb9('0x9')]=_['defaults'](config[_0x1cb9('0x9')],{'host':_0x1cb9('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1cb9('0x9')]));require('./openchannelAccount.socket')['register'](socket);function respondWithRpcPromise(_0x45a12f,_0x2fa15c,_0x74ce19){return new BPromise(function(_0x1f0eca,_0x2fc627){return client['request'](_0x45a12f,_0x74ce19)[_0x1cb9('0xb')](function(_0x44a6b4){logger[_0x1cb9('0xc')](_0x1cb9('0xd'),_0x2fa15c,_0x1cb9('0xe'));logger['debug']('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x2fa15c,'request\x20sent',JSON[_0x1cb9('0xf')](_0x44a6b4));if(_0x44a6b4[_0x1cb9('0x10')]){if(_0x44a6b4[_0x1cb9('0x10')][_0x1cb9('0x11')]===0x1f4){logger['error'](_0x1cb9('0xd'),_0x2fa15c,_0x44a6b4[_0x1cb9('0x10')][_0x1cb9('0x12')]);return _0x2fc627(_0x44a6b4[_0x1cb9('0x10')][_0x1cb9('0x12')]);}logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x2fa15c,_0x44a6b4[_0x1cb9('0x10')][_0x1cb9('0x12')]);return _0x1f0eca(_0x44a6b4[_0x1cb9('0x10')][_0x1cb9('0x12')]);}else{logger[_0x1cb9('0xc')](_0x1cb9('0xd'),_0x2fa15c,_0x1cb9('0xe'));_0x1f0eca(_0x44a6b4['result']['message']);}})[_0x1cb9('0x13')](function(_0x41ac41){logger[_0x1cb9('0x10')](_0x1cb9('0xd'),_0x2fa15c,_0x41ac41);_0x2fc627(_0x41ac41);});});} \ No newline at end of file +var _0x0427=['./openchannelAccount.socket','register','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x55bf9a,_0xc1f45c){var _0x3715e0=function(_0x24aa5f){while(--_0x24aa5f){_0x55bf9a['push'](_0x55bf9a['shift']());}};_0x3715e0(++_0xc1f45c);}(_0x0427,0x137));var _0x7042=function(_0x5ebfb7,_0x42f415){_0x5ebfb7=_0x5ebfb7-0x0;var _0x203f86=_0x0427[_0x5ebfb7];return _0x203f86;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7042('0x0'));var BPromise=require(_0x7042('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7042('0x2'));var db=require(_0x7042('0x3'))['db'];var utils=require(_0x7042('0x4'));var logger=require(_0x7042('0x5'))(_0x7042('0x6'));var config=require(_0x7042('0x7'));var jayson=require(_0x7042('0x8'));var client=jayson['client'][_0x7042('0x9')]({'port':0x232a});config[_0x7042('0xa')]=_[_0x7042('0xb')](config[_0x7042('0xa')],{'host':_0x7042('0xc'),'port':0x18eb});var socket=require(_0x7042('0xd'))(new Redis(config[_0x7042('0xa')]));require(_0x7042('0xe'))[_0x7042('0xf')](socket);function respondWithRpcPromise(_0x5a29aa,_0x326210,_0x5c3f0f){return new BPromise(function(_0x5cf853,_0x50eefb){return client['request'](_0x5a29aa,_0x5c3f0f)[_0x7042('0x10')](function(_0x5636e8){logger[_0x7042('0x11')](_0x7042('0x12'),_0x326210,_0x7042('0x13'));logger['debug']('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x326210,_0x7042('0x13'),JSON[_0x7042('0x14')](_0x5636e8));if(_0x5636e8[_0x7042('0x15')]){if(_0x5636e8[_0x7042('0x15')][_0x7042('0x16')]===0x1f4){logger[_0x7042('0x15')]('OpenchannelAccount,\x20%s,\x20%s',_0x326210,_0x5636e8[_0x7042('0x15')][_0x7042('0x17')]);return _0x50eefb(_0x5636e8[_0x7042('0x15')]['message']);}logger[_0x7042('0x15')](_0x7042('0x12'),_0x326210,_0x5636e8['error'][_0x7042('0x17')]);return _0x5cf853(_0x5636e8['error']['message']);}else{logger[_0x7042('0x11')](_0x7042('0x12'),_0x326210,_0x7042('0x13'));_0x5cf853(_0x5636e8[_0x7042('0x18')][_0x7042('0x17')]);}})['catch'](function(_0x438084){logger[_0x7042('0x15')](_0x7042('0x12'),_0x326210,_0x438084);_0x50eefb(_0x438084);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 4ff7b9c..cb35723 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 _0xff96=['openchannelAccount:','./openchannelAccount.events','save','remove','update','emit','removeListener','register'];(function(_0x4063a4,_0x19d730){var _0x17908d=function(_0x3ce714){while(--_0x3ce714){_0x4063a4['push'](_0x4063a4['shift']());}};_0x17908d(++_0x19d730);}(_0xff96,0x179));var _0x6ff9=function(_0x5bb488,_0x405570){_0x5bb488=_0x5bb488-0x0;var _0x3a541a=_0xff96[_0x5bb488];return _0x3a541a;};'use strict';var OpenchannelAccountEvents=require(_0x6ff9('0x0'));var events=[_0x6ff9('0x1'),_0x6ff9('0x2'),_0x6ff9('0x3')];function createListener(_0xa3cf6b,_0x19b956){return function(_0xc1de29){_0x19b956[_0x6ff9('0x4')](_0xa3cf6b,_0xc1de29);};}function removeListener(_0x3561d7,_0x207c06){return function(){OpenchannelAccountEvents[_0x6ff9('0x5')](_0x3561d7,_0x207c06);};}exports[_0x6ff9('0x6')]=function(_0x4adb77){for(var _0x3efaff=0x0,_0x5509ee=events['length'];_0x3efaff<_0x5509ee;_0x3efaff++){var _0x4f982b=events[_0x3efaff];var _0x5d56f4=createListener(_0x6ff9('0x7')+_0x4f982b,_0x4adb77);OpenchannelAccountEvents['on'](_0x4f982b,_0x5d56f4);}}; \ No newline at end of file +var _0x92f0=['remove','removeListener','register','length','save'];(function(_0xe602,_0x4ffd07){var _0x3283e5=function(_0xbf8e0a){while(--_0xbf8e0a){_0xe602['push'](_0xe602['shift']());}};_0x3283e5(++_0x4ffd07);}(_0x92f0,0x10d));var _0x092f=function(_0x4206f5,_0x21f338){_0x4206f5=_0x4206f5-0x0;var _0xa29cf3=_0x92f0[_0x4206f5];return _0xa29cf3;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=[_0x092f('0x0'),_0x092f('0x1'),'update'];function createListener(_0x6d6daa,_0x2530d4){return function(_0x5e9f2c){_0x2530d4['emit'](_0x6d6daa,_0x5e9f2c);};}function removeListener(_0x16bf0b,_0x2db72b){return function(){OpenchannelAccountEvents[_0x092f('0x2')](_0x16bf0b,_0x2db72b);};}exports[_0x092f('0x3')]=function(_0x2996b0){for(var _0x2b6dcb=0x0,_0x5b5741=events[_0x092f('0x4')];_0x2b6dcb<_0x5b5741;_0x2b6dcb++){var _0x542b99=events[_0x2b6dcb];var _0x1825f7=createListener('openchannelAccount:'+_0x542b99,_0x2996b0);OpenchannelAccountEvents['on'](_0x542b99,_0x1825f7);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 8317958..11ae256 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 _0x3fb7=['get','index','/:id','isAuthenticated','show','post','create','put','update','delete','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller'];(function(_0x157d74,_0x2f03f5){var _0x29a3ac=function(_0x588b6e){while(--_0x588b6e){_0x157d74['push'](_0x157d74['shift']());}};_0x29a3ac(++_0x2f03f5);}(_0x3fb7,0x19b));var _0x73fb=function(_0x16f20e,_0x4863cf){_0x16f20e=_0x16f20e-0x0;var _0x48d7a1=_0x3fb7[_0x16f20e];return _0x48d7a1;};'use strict';var multer=require('multer');var util=require(_0x73fb('0x0'));var path=require(_0x73fb('0x1'));var timeout=require(_0x73fb('0x2'));var express=require(_0x73fb('0x3'));var router=express['Router']();var fs_extra=require(_0x73fb('0x4'));var auth=require(_0x73fb('0x5'));var interaction=require(_0x73fb('0x6'));var config=require(_0x73fb('0x7'));var controller=require(_0x73fb('0x8'));router[_0x73fb('0x9')]('/',auth['isAuthenticated'](),controller[_0x73fb('0xa')]);router['get'](_0x73fb('0xb'),auth[_0x73fb('0xc')](),controller[_0x73fb('0xd')]);router[_0x73fb('0xe')]('/',auth[_0x73fb('0xc')](),controller[_0x73fb('0xf')]);router[_0x73fb('0x10')](_0x73fb('0xb'),auth[_0x73fb('0xc')](),controller[_0x73fb('0x11')]);router[_0x73fb('0x12')](_0x73fb('0xb'),auth[_0x73fb('0xc')](),controller['destroy']);module[_0x73fb('0x13')]=router; \ No newline at end of file +var _0x4606=['multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','isAuthenticated','/:id','show','post','update','delete','destroy'];(function(_0x4dd524,_0x2247e5){var _0x482629=function(_0x1fc3a0){while(--_0x1fc3a0){_0x4dd524['push'](_0x4dd524['shift']());}};_0x482629(++_0x2247e5);}(_0x4606,0x1dc));var _0x6460=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4606[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x6460('0x0'));var util=require(_0x6460('0x1'));var path=require(_0x6460('0x2'));var timeout=require('connect-timeout');var express=require(_0x6460('0x3'));var router=express[_0x6460('0x4')]();var fs_extra=require(_0x6460('0x5'));var auth=require(_0x6460('0x6'));var interaction=require(_0x6460('0x7'));var config=require(_0x6460('0x8'));var controller=require(_0x6460('0x9'));router['get']('/',auth[_0x6460('0xa')](),controller['index']);router['get'](_0x6460('0xb'),auth[_0x6460('0xa')](),controller[_0x6460('0xc')]);router[_0x6460('0xd')]('/',auth[_0x6460('0xa')](),controller['create']);router['put']('/:id',auth[_0x6460('0xa')](),controller[_0x6460('0xe')]);router[_0x6460('0xf')]('/:id',auth[_0x6460('0xa')](),controller[_0x6460('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index a79c340..f2dabf8 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 _0x20bb=['*,*,*,*','sequelize','exports','STRING','noop'];(function(_0x57fec5,_0x48cd67){var _0x5d7684=function(_0xcd4a5a){while(--_0xcd4a5a){_0x57fec5['push'](_0x57fec5['shift']());}};_0x5d7684(++_0x48cd67);}(_0x20bb,0xa1));var _0xb20b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x20bb[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xb20b('0x0'));module[_0xb20b('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xb20b('0x2')],'allowNull':![],'defaultValue':_0xb20b('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xb20b('0x2')]},'interval':{'type':Sequelize[_0xb20b('0x2')],'defaultValue':_0xb20b('0x4')}}; \ No newline at end of file +var _0xce87=['TEXT','*,*,*,*','sequelize'];(function(_0x5650b4,_0x2723ba){var _0x297a62=function(_0x4ceedf){while(--_0x4ceedf){_0x5650b4['push'](_0x5650b4['shift']());}};_0x297a62(++_0x2723ba);}(_0xce87,0x65));var _0x7ce8=function(_0x536cdf,_0x54ee2a){_0x536cdf=_0x536cdf-0x0;var _0xdc5eac=_0xce87[_0x536cdf];return _0xdc5eac;};'use strict';var Sequelize=require(_0x7ce8('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x7ce8('0x1')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x7ce8('0x2')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 98323f1..bdb8539 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 _0xe45d=['map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','include','find','create','body','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','send','index','OpenchannelApplication','rawAttributes','fieldName','type','key','model'];(function(_0x42418a,_0x5d6f7e){var _0x2bd0cd=function(_0x3e0086){while(--_0x3e0086){_0x42418a['push'](_0x42418a['shift']());}};_0x2bd0cd(++_0x5d6f7e);}(_0xe45d,0xb0));var _0xde45=function(_0x4e9646,_0x224f43){_0x4e9646=_0x4e9646-0x0;var _0x149afe=_0xe45d[_0x4e9646];return _0x149afe;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xde45('0x0'));var zipdir=require(_0xde45('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xde45('0x2'));var moment=require(_0xde45('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xde45('0x4'));var util=require(_0xde45('0x5'));var path=require(_0xde45('0x6'));var sox=require(_0xde45('0x7'));var csv=require('to-csv');var ejs=require(_0xde45('0x8'));var fs=require('fs');var fs_extra=require(_0xde45('0x9'));var _=require(_0xde45('0xa'));var squel=require(_0xde45('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xde45('0xc'));var querystring=require(_0xde45('0xd'));var Papa=require(_0xde45('0xe'));var Redis=require(_0xde45('0xf'));var authService=require(_0xde45('0x10'));var qs=require(_0xde45('0x11'));var as=require(_0xde45('0x12'));var hardwareService=require(_0xde45('0x13'));var logger=require('../../config/logger')(_0xde45('0x14'));var utils=require(_0xde45('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xde45('0x16'));var db=require(_0xde45('0x17'))['db'];function respondWithStatusCode(_0x1ac5e8,_0x1a2855){_0x1a2855=_0x1a2855||0xcc;return function(_0x25bcb2){if(_0x25bcb2){return _0x1ac5e8[_0xde45('0x18')](_0x1a2855);}return _0x1ac5e8[_0xde45('0x19')](_0x1a2855)['end']();};}function respondWithResult(_0x18e488,_0x428c50){_0x428c50=_0x428c50||0xc8;return function(_0x11c231){if(_0x11c231){return _0x18e488[_0xde45('0x19')](_0x428c50)[_0xde45('0x1a')](_0x11c231);}};}function respondWithFilteredResult(_0x1a55bf,_0x15747a){return function(_0x36cd09){if(_0x36cd09){var _0x47bdee=typeof _0x15747a[_0xde45('0x1b')]===_0xde45('0x1c')&&typeof _0x15747a[_0xde45('0x1d')]===_0xde45('0x1c');var _0x45f299=_0x36cd09[_0xde45('0x1e')];var _0x271406=_0x47bdee?0x0:_0x15747a[_0xde45('0x1b')];var _0x51f47a=_0x47bdee?_0x36cd09[_0xde45('0x1e')]:_0x15747a[_0xde45('0x1b')]+_0x15747a[_0xde45('0x1d')];var _0x22d77c;if(_0x51f47a>=_0x45f299){_0x51f47a=_0x45f299;_0x22d77c=0xc8;}else{_0x22d77c=0xce;}_0x1a55bf[_0xde45('0x19')](_0x22d77c);return _0x1a55bf['set'](_0xde45('0x1f'),_0x271406+'-'+_0x51f47a+'/'+_0x45f299)[_0xde45('0x1a')](_0x36cd09);}return null;};}function patchUpdates(_0x83af2d){return function(_0x458bde){try{jsonpatch[_0xde45('0x20')](_0x458bde,_0x83af2d,!![]);}catch(_0x3e79ce){return BPromise[_0xde45('0x21')](_0x3e79ce);}return _0x458bde['save']();};}function saveUpdates(_0x710811,_0x1c9d52){return function(_0x1cc01b){if(_0x1cc01b){return _0x1cc01b[_0xde45('0x22')](_0x710811)[_0xde45('0x23')](function(_0x2b42d4){return _0x2b42d4;});}return null;};}function removeEntity(_0x24b9e8,_0x5a4980){return function(_0x2349ca){if(_0x2349ca){return _0x2349ca[_0xde45('0x24')]()['then'](function(){_0x24b9e8['status'](0xcc)[_0xde45('0x25')]();});}};}function handleEntityNotFound(_0x1a3a4d,_0x2a9a61){return function(_0x580839){if(!_0x580839){_0x1a3a4d[_0xde45('0x18')](0x194);}return _0x580839;};}function handleError(_0x4cc1d6,_0x46af6a){_0x46af6a=_0x46af6a||0x1f4;return function(_0x2ba974){logger[_0xde45('0x26')](_0x2ba974[_0xde45('0x27')]);if(_0x2ba974[_0xde45('0x28')]){delete _0x2ba974[_0xde45('0x28')];}_0x4cc1d6[_0xde45('0x19')](_0x46af6a)[_0xde45('0x29')](_0x2ba974);};}exports[_0xde45('0x2a')]=function(_0x53897d,_0x6da233){var _0x50803f={},_0x5081d1={},_0x5d5d99={'count':0x0,'rows':[]};var _0x277893=_['map'](db[_0xde45('0x2b')][_0xde45('0x2c')],function(_0x8e92a8){return{'name':_0x8e92a8[_0xde45('0x2d')],'type':_0x8e92a8[_0xde45('0x2e')][_0xde45('0x2f')]};});_0x5081d1[_0xde45('0x30')]=_[_0xde45('0x31')](_0x277893,_0xde45('0x28'));_0x5081d1[_0xde45('0x32')]=_[_0xde45('0x33')](_0x53897d[_0xde45('0x32')]);_0x5081d1['filters']=_[_0xde45('0x34')](_0x5081d1[_0xde45('0x30')],_0x5081d1[_0xde45('0x32')]);_0x50803f[_0xde45('0x35')]=_[_0xde45('0x34')](_0x5081d1[_0xde45('0x30')],qs['fields'](_0x53897d['query'][_0xde45('0x36')]));_0x50803f['attributes']=_0x50803f[_0xde45('0x35')][_0xde45('0x37')]?_0x50803f['attributes']:_0x5081d1[_0xde45('0x30')];if(!_0x53897d[_0xde45('0x32')][_0xde45('0x38')](_0xde45('0x39'))){_0x50803f[_0xde45('0x1d')]=qs['limit'](_0x53897d[_0xde45('0x32')][_0xde45('0x1d')]);_0x50803f[_0xde45('0x1b')]=qs['offset'](_0x53897d[_0xde45('0x32')][_0xde45('0x1b')]);}_0x50803f[_0xde45('0x3a')]=qs['sort'](_0x53897d[_0xde45('0x32')]['sort']);_0x50803f[_0xde45('0x3b')]=qs[_0xde45('0x3c')](_[_0xde45('0x3d')](_0x53897d[_0xde45('0x32')],_0x5081d1[_0xde45('0x3c')]),_0x277893);if(_0x53897d['query'][_0xde45('0x3e')]){_0x50803f['where']=_[_0xde45('0x3f')](_0x50803f[_0xde45('0x3b')],{'$or':_[_0xde45('0x31')](_0x277893,function(_0x505dcb){if(_0x505dcb[_0xde45('0x2e')]!==_0xde45('0x40')){var _0x226fdc={};_0x226fdc[_0x505dcb[_0xde45('0x28')]]={'$like':'%'+_0x53897d[_0xde45('0x32')][_0xde45('0x3e')]+'%'};return _0x226fdc;}})});}_0x50803f=_[_0xde45('0x3f')]({},_0x50803f,_0x53897d[_0xde45('0x41')]);var _0xd05231={'where':_0x50803f[_0xde45('0x3b')]};return db[_0xde45('0x2b')][_0xde45('0x1e')](_0xd05231)['then'](function(_0x441240){_0x5d5d99[_0xde45('0x1e')]=_0x441240;if(_0x53897d[_0xde45('0x32')][_0xde45('0x42')]){_0x50803f['include']=[{'all':!![]}];}return db[_0xde45('0x2b')][_0xde45('0x43')](_0x50803f);})['then'](function(_0x5e0f01){_0x5d5d99[_0xde45('0x44')]=_0x5e0f01;return _0x5d5d99;})[_0xde45('0x23')](respondWithFilteredResult(_0x6da233,_0x50803f))[_0xde45('0x45')](handleError(_0x6da233,null));};exports['show']=function(_0x3a1603,_0x42edd2){var _0x3caaf9={'raw':!![],'where':{'id':_0x3a1603[_0xde45('0x46')]['id']}},_0x469883={};_0x469883[_0xde45('0x30')]=_[_0xde45('0x33')](db['OpenchannelApplication'][_0xde45('0x2c')]);_0x469883['query']=_[_0xde45('0x33')](_0x3a1603[_0xde45('0x32')]);_0x469883[_0xde45('0x3c')]=_[_0xde45('0x34')](_0x469883[_0xde45('0x30')],_0x469883[_0xde45('0x32')]);_0x3caaf9['attributes']=_[_0xde45('0x34')](_0x469883[_0xde45('0x30')],qs[_0xde45('0x36')](_0x3a1603[_0xde45('0x32')][_0xde45('0x36')]));_0x3caaf9[_0xde45('0x35')]=_0x3caaf9[_0xde45('0x35')]['length']?_0x3caaf9['attributes']:_0x469883[_0xde45('0x30')];if(_0x3a1603[_0xde45('0x32')][_0xde45('0x42')]){_0x3caaf9[_0xde45('0x47')]=[{'all':!![]}];}_0x3caaf9=_[_0xde45('0x3f')]({},_0x3caaf9,_0x3a1603[_0xde45('0x41')]);return db['OpenchannelApplication'][_0xde45('0x48')](_0x3caaf9)['then'](handleEntityNotFound(_0x42edd2,null))['then'](respondWithResult(_0x42edd2,null))['catch'](handleError(_0x42edd2,null));};exports[_0xde45('0x49')]=function(_0x183f10,_0x43da39){return db['OpenchannelApplication'][_0xde45('0x49')](_0x183f10[_0xde45('0x4a')],{})[_0xde45('0x23')](respondWithResult(_0x43da39,0xc9))[_0xde45('0x45')](handleError(_0x43da39,null));};exports[_0xde45('0x22')]=function(_0x4e78cf,_0x442179){if(_0x4e78cf[_0xde45('0x4a')]['id']){delete _0x4e78cf[_0xde45('0x4a')]['id'];}return db[_0xde45('0x2b')][_0xde45('0x48')]({'where':{'id':_0x4e78cf[_0xde45('0x46')]['id']}})[_0xde45('0x23')](handleEntityNotFound(_0x442179,null))['then'](saveUpdates(_0x4e78cf[_0xde45('0x4a')],null))[_0xde45('0x23')](respondWithResult(_0x442179,null))['catch'](handleError(_0x442179,null));};exports['destroy']=function(_0x28c700,_0x44a08b){return db[_0xde45('0x2b')][_0xde45('0x48')]({'where':{'id':_0x28c700['params']['id']}})['then'](handleEntityNotFound(_0x44a08b,null))[_0xde45('0x23')](removeEntity(_0x44a08b,null))[_0xde45('0x45')](handleError(_0x44a08b,null));}; \ No newline at end of file +var _0x9adb=['then','destroy','error','stack','name','send','map','OpenchannelApplication','rawAttributes','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','type','VIRTUAL','merge','include','findAll','rows','catch','params','includeAll','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','save','update'];(function(_0xf88ed6,_0x2f6bc2){var _0x1480a4=function(_0x2a3290){while(--_0x2a3290){_0xf88ed6['push'](_0xf88ed6['shift']());}};_0x1480a4(++_0x2f6bc2);}(_0x9adb,0xb2));var _0xb9ad=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9adb[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0xb9ad('0x0'));var rimraf=require(_0xb9ad('0x1'));var zipdir=require(_0xb9ad('0x2'));var jsonpatch=require(_0xb9ad('0x3'));var rp=require(_0xb9ad('0x4'));var moment=require(_0xb9ad('0x5'));var BPromise=require(_0xb9ad('0x6'));var Mustache=require('mustache');var util=require(_0xb9ad('0x7'));var path=require('path');var sox=require(_0xb9ad('0x8'));var csv=require(_0xb9ad('0x9'));var ejs=require(_0xb9ad('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb9ad('0xb'));var squel=require(_0xb9ad('0xc'));var crypto=require('crypto');var jsforce=require(_0xb9ad('0xd'));var deskjs=require(_0xb9ad('0xe'));var toCsv=require(_0xb9ad('0x9'));var querystring=require('querystring');var Papa=require(_0xb9ad('0xf'));var Redis=require(_0xb9ad('0x10'));var authService=require(_0xb9ad('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xb9ad('0x12'));var hardwareService=require(_0xb9ad('0x13'));var logger=require('../../config/logger')(_0xb9ad('0x14'));var utils=require(_0xb9ad('0x15'));var config=require(_0xb9ad('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xb9ad('0x17'))['db'];function respondWithStatusCode(_0x2a2e48,_0x309a9d){_0x309a9d=_0x309a9d||0xcc;return function(_0x4b7670){if(_0x4b7670){return _0x2a2e48[_0xb9ad('0x18')](_0x309a9d);}return _0x2a2e48['status'](_0x309a9d)[_0xb9ad('0x19')]();};}function respondWithResult(_0x5261db,_0x2fe09b){_0x2fe09b=_0x2fe09b||0xc8;return function(_0x7ae4ed){if(_0x7ae4ed){return _0x5261db[_0xb9ad('0x1a')](_0x2fe09b)[_0xb9ad('0x1b')](_0x7ae4ed);}};}function respondWithFilteredResult(_0x1c3218,_0x1d0edb){return function(_0x55c5fb){if(_0x55c5fb){var _0x53d791=typeof _0x1d0edb[_0xb9ad('0x1c')]===_0xb9ad('0x1d')&&typeof _0x1d0edb[_0xb9ad('0x1e')]===_0xb9ad('0x1d');var _0xaa1261=_0x55c5fb['count'];var _0x324a37=_0x53d791?0x0:_0x1d0edb[_0xb9ad('0x1c')];var _0x4cf858=_0x53d791?_0x55c5fb[_0xb9ad('0x1f')]:_0x1d0edb['offset']+_0x1d0edb[_0xb9ad('0x1e')];var _0xef287d;if(_0x4cf858>=_0xaa1261){_0x4cf858=_0xaa1261;_0xef287d=0xc8;}else{_0xef287d=0xce;}_0x1c3218[_0xb9ad('0x1a')](_0xef287d);return _0x1c3218['set'](_0xb9ad('0x20'),_0x324a37+'-'+_0x4cf858+'/'+_0xaa1261)['json'](_0x55c5fb);}return null;};}function patchUpdates(_0x98ab0){return function(_0x590286){try{jsonpatch['apply'](_0x590286,_0x98ab0,!![]);}catch(_0x359ad1){return BPromise['reject'](_0x359ad1);}return _0x590286[_0xb9ad('0x21')]();};}function saveUpdates(_0x160f2a,_0x1fcb6c){return function(_0x12999e){if(_0x12999e){return _0x12999e[_0xb9ad('0x22')](_0x160f2a)[_0xb9ad('0x23')](function(_0x41a07a){return _0x41a07a;});}return null;};}function removeEntity(_0x6e057a,_0x344192){return function(_0x3c04dc){if(_0x3c04dc){return _0x3c04dc[_0xb9ad('0x24')]()[_0xb9ad('0x23')](function(){_0x6e057a[_0xb9ad('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a00c5,_0xa6e9cf){return function(_0x5c80ab){if(!_0x5c80ab){_0x2a00c5['sendStatus'](0x194);}return _0x5c80ab;};}function handleError(_0x22bf80,_0x3f8c2c){_0x3f8c2c=_0x3f8c2c||0x1f4;return function(_0x432ed1){logger[_0xb9ad('0x25')](_0x432ed1[_0xb9ad('0x26')]);if(_0x432ed1[_0xb9ad('0x27')]){delete _0x432ed1[_0xb9ad('0x27')];}_0x22bf80[_0xb9ad('0x1a')](_0x3f8c2c)[_0xb9ad('0x28')](_0x432ed1);};}exports['index']=function(_0x52ed3a,_0x2e18c7){var _0x522075={},_0x2178df={},_0x161abe={'count':0x0,'rows':[]};var _0x48b994=_[_0xb9ad('0x29')](db[_0xb9ad('0x2a')][_0xb9ad('0x2b')],function(_0x1b4b91){return{'name':_0x1b4b91['fieldName'],'type':_0x1b4b91['type'][_0xb9ad('0x2c')]};});_0x2178df[_0xb9ad('0x2d')]=_[_0xb9ad('0x29')](_0x48b994,_0xb9ad('0x27'));_0x2178df[_0xb9ad('0x2e')]=_[_0xb9ad('0x2f')](_0x52ed3a[_0xb9ad('0x2e')]);_0x2178df[_0xb9ad('0x30')]=_['intersection'](_0x2178df[_0xb9ad('0x2d')],_0x2178df[_0xb9ad('0x2e')]);_0x522075[_0xb9ad('0x31')]=_[_0xb9ad('0x32')](_0x2178df[_0xb9ad('0x2d')],qs[_0xb9ad('0x33')](_0x52ed3a[_0xb9ad('0x2e')][_0xb9ad('0x33')]));_0x522075[_0xb9ad('0x31')]=_0x522075[_0xb9ad('0x31')][_0xb9ad('0x34')]?_0x522075[_0xb9ad('0x31')]:_0x2178df[_0xb9ad('0x2d')];if(!_0x52ed3a[_0xb9ad('0x2e')][_0xb9ad('0x35')](_0xb9ad('0x36'))){_0x522075['limit']=qs[_0xb9ad('0x1e')](_0x52ed3a['query'][_0xb9ad('0x1e')]);_0x522075[_0xb9ad('0x1c')]=qs['offset'](_0x52ed3a[_0xb9ad('0x2e')][_0xb9ad('0x1c')]);}_0x522075['order']=qs[_0xb9ad('0x37')](_0x52ed3a[_0xb9ad('0x2e')]['sort']);_0x522075['where']=qs['filters'](_[_0xb9ad('0x38')](_0x52ed3a[_0xb9ad('0x2e')],_0x2178df[_0xb9ad('0x30')]),_0x48b994);if(_0x52ed3a['query'][_0xb9ad('0x39')]){_0x522075[_0xb9ad('0x3a')]=_['merge'](_0x522075['where'],{'$or':_['map'](_0x48b994,function(_0x40e915){if(_0x40e915[_0xb9ad('0x3b')]!==_0xb9ad('0x3c')){var _0x2abf3d={};_0x2abf3d[_0x40e915[_0xb9ad('0x27')]]={'$like':'%'+_0x52ed3a[_0xb9ad('0x2e')][_0xb9ad('0x39')]+'%'};return _0x2abf3d;}})});}_0x522075=_[_0xb9ad('0x3d')]({},_0x522075,_0x52ed3a['options']);var _0x2d4d91={'where':_0x522075[_0xb9ad('0x3a')]};return db[_0xb9ad('0x2a')][_0xb9ad('0x1f')](_0x2d4d91)[_0xb9ad('0x23')](function(_0x78a7f2){_0x161abe[_0xb9ad('0x1f')]=_0x78a7f2;if(_0x52ed3a[_0xb9ad('0x2e')]['includeAll']){_0x522075[_0xb9ad('0x3e')]=[{'all':!![]}];}return db[_0xb9ad('0x2a')][_0xb9ad('0x3f')](_0x522075);})[_0xb9ad('0x23')](function(_0x2e628d){_0x161abe[_0xb9ad('0x40')]=_0x2e628d;return _0x161abe;})[_0xb9ad('0x23')](respondWithFilteredResult(_0x2e18c7,_0x522075))[_0xb9ad('0x41')](handleError(_0x2e18c7,null));};exports['show']=function(_0x5a3722,_0x4bc8f8){var _0xdc7dbc={'raw':!![],'where':{'id':_0x5a3722[_0xb9ad('0x42')]['id']}},_0x5928fb={};_0x5928fb[_0xb9ad('0x2d')]=_[_0xb9ad('0x2f')](db[_0xb9ad('0x2a')][_0xb9ad('0x2b')]);_0x5928fb[_0xb9ad('0x2e')]=_[_0xb9ad('0x2f')](_0x5a3722[_0xb9ad('0x2e')]);_0x5928fb[_0xb9ad('0x30')]=_[_0xb9ad('0x32')](_0x5928fb[_0xb9ad('0x2d')],_0x5928fb[_0xb9ad('0x2e')]);_0xdc7dbc['attributes']=_['intersection'](_0x5928fb[_0xb9ad('0x2d')],qs[_0xb9ad('0x33')](_0x5a3722[_0xb9ad('0x2e')]['fields']));_0xdc7dbc[_0xb9ad('0x31')]=_0xdc7dbc['attributes']['length']?_0xdc7dbc[_0xb9ad('0x31')]:_0x5928fb[_0xb9ad('0x2d')];if(_0x5a3722[_0xb9ad('0x2e')][_0xb9ad('0x43')]){_0xdc7dbc[_0xb9ad('0x3e')]=[{'all':!![]}];}_0xdc7dbc=_[_0xb9ad('0x3d')]({},_0xdc7dbc,_0x5a3722['options']);return db['OpenchannelApplication'][_0xb9ad('0x44')](_0xdc7dbc)[_0xb9ad('0x23')](handleEntityNotFound(_0x4bc8f8,null))['then'](respondWithResult(_0x4bc8f8,null))['catch'](handleError(_0x4bc8f8,null));};exports[_0xb9ad('0x45')]=function(_0x10d53e,_0xbfb9e3){return db['OpenchannelApplication']['create'](_0x10d53e[_0xb9ad('0x46')],{})[_0xb9ad('0x23')](respondWithResult(_0xbfb9e3,0xc9))[_0xb9ad('0x41')](handleError(_0xbfb9e3,null));};exports[_0xb9ad('0x22')]=function(_0x5e3978,_0x22acb2){if(_0x5e3978['body']['id']){delete _0x5e3978[_0xb9ad('0x46')]['id'];}return db['OpenchannelApplication'][_0xb9ad('0x44')]({'where':{'id':_0x5e3978['params']['id']}})['then'](handleEntityNotFound(_0x22acb2,null))[_0xb9ad('0x23')](saveUpdates(_0x5e3978[_0xb9ad('0x46')],null))[_0xb9ad('0x23')](respondWithResult(_0x22acb2,null))['catch'](handleError(_0x22acb2,null));};exports['destroy']=function(_0x5433b8,_0x40b8fc){return db[_0xb9ad('0x2a')][_0xb9ad('0x44')]({'where':{'id':_0x5433b8[_0xb9ad('0x42')]['id']}})[_0xb9ad('0x23')](handleEntityNotFound(_0x40b8fc,null))[_0xb9ad('0x23')](removeEntity(_0x40b8fc,null))[_0xb9ad('0x41')](handleError(_0x40b8fc,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index c6397c7..8d81065 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 _0xce95=['../../config/environment','./openchannelApplication.attributes','exports','define','OpenchannelApplication','openchannel_applications','utf8mb4','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x4c6370,_0x2ff70a){var _0x35156e=function(_0x1f1359){while(--_0x1f1359){_0x4c6370['push'](_0x4c6370['shift']());}};_0x35156e(++_0x2ff70a);}(_0xce95,0x69));var _0x5ce9=function(_0x2f9467,_0x40576f){_0x2f9467=_0x2f9467-0x0;var _0x39894c=_0xce95[_0x2f9467];return _0x39894c;};'use strict';var _=require('lodash');var util=require(_0x5ce9('0x0'));var logger=require(_0x5ce9('0x1'))(_0x5ce9('0x2'));var moment=require(_0x5ce9('0x3'));var BPromise=require(_0x5ce9('0x4'));var rp=require(_0x5ce9('0x5'));var fs=require('fs');var path=require(_0x5ce9('0x6'));var rimraf=require('rimraf');var config=require(_0x5ce9('0x7'));var attributes=require(_0x5ce9('0x8'));module[_0x5ce9('0x9')]=function(_0x3c6643,_0x433aa5){return _0x3c6643[_0x5ce9('0xa')](_0x5ce9('0xb'),attributes,{'tableName':_0x5ce9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5ce9('0xd'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xd1b2=['define','OpenchannelApplication','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x191330,_0x4dac38){var _0x174131=function(_0x3426a8){while(--_0x3426a8){_0x191330['push'](_0x191330['shift']());}};_0x174131(++_0x4dac38);}(_0xd1b2,0x171));var _0x2d1b=function(_0x3326bb,_0x461bd9){_0x3326bb=_0x3326bb-0x0;var _0x5eb850=_0xd1b2[_0x3326bb];return _0x5eb850;};'use strict';var _=require(_0x2d1b('0x0'));var util=require(_0x2d1b('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x2d1b('0x2'));var BPromise=require(_0x2d1b('0x3'));var rp=require(_0x2d1b('0x4'));var fs=require('fs');var path=require(_0x2d1b('0x5'));var rimraf=require(_0x2d1b('0x6'));var config=require(_0x2d1b('0x7'));var attributes=require('./openchannelApplication.attributes');module['exports']=function(_0x120112,_0x1e3762){return _0x120112[_0x2d1b('0x8')](_0x2d1b('0x9'),attributes,{'tableName':_0x2d1b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2d1b('0xb'),'collate':_0x2d1b('0xc')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 83a7f5f..6ee430b 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 _0x84e0=['message','result','catch','UpdateOpenchannelApplication','update','body','options','raw','attributes','limit','stringify','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','error'];(function(_0x35a329,_0x488fee){var _0x4cbdb1=function(_0x5042c0){while(--_0x5042c0){_0x35a329['push'](_0x35a329['shift']());}};_0x4cbdb1(++_0x488fee);}(_0x84e0,0xcf));var _0x084e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x84e0[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x084e('0x0'));var moment=require(_0x084e('0x1'));var BPromise=require(_0x084e('0x2'));var rs=require(_0x084e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x084e('0x4'))['db'];var utils=require(_0x084e('0x5'));var logger=require(_0x084e('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x084e('0x7'));var client=jayson['client'][_0x084e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2612f9,_0x3f9ede,_0x46efb9){return new BPromise(function(_0x63e045,_0x53f0e9){return client[_0x084e('0x9')](_0x2612f9,_0x46efb9)[_0x084e('0xa')](function(_0xf11b0c){logger[_0x084e('0xb')](_0x084e('0xc'),_0x3f9ede,_0x084e('0xd'));logger[_0x084e('0xe')](_0x084e('0xf'),_0x3f9ede,_0x084e('0xd'),JSON['stringify'](_0xf11b0c));if(_0xf11b0c[_0x084e('0x10')]){if(_0xf11b0c['error']['code']===0x1f4){logger['error'](_0x084e('0xc'),_0x3f9ede,_0xf11b0c[_0x084e('0x10')][_0x084e('0x11')]);return _0x53f0e9(_0xf11b0c['error'][_0x084e('0x11')]);}logger['error'](_0x084e('0xc'),_0x3f9ede,_0xf11b0c['error'][_0x084e('0x11')]);return _0x63e045(_0xf11b0c['error'][_0x084e('0x11')]);}else{logger['info'](_0x084e('0xc'),_0x3f9ede,'request\x20sent');_0x63e045(_0xf11b0c[_0x084e('0x12')][_0x084e('0x11')]);}})[_0x084e('0x13')](function(_0x5dcf3f){logger[_0x084e('0x10')]('OpenchannelApplication,\x20%s,\x20%s',_0x3f9ede,_0x5dcf3f);_0x53f0e9(_0x5dcf3f);});});}exports[_0x084e('0x14')]=function(_0x1affe7){var _0x5e45fe=this;return new Promise(function(_0x446fe7,_0x1dea99){return db['OpenchannelApplication'][_0x084e('0x15')](_0x1affe7[_0x084e('0x16')],{'raw':_0x1affe7[_0x084e('0x17')]?_0x1affe7[_0x084e('0x17')][_0x084e('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1affe7[_0x084e('0x17')]?_0x1affe7[_0x084e('0x17')]['where']||null:null,'attributes':_0x1affe7[_0x084e('0x17')]?_0x1affe7[_0x084e('0x17')][_0x084e('0x19')]||null:null,'limit':_0x1affe7[_0x084e('0x17')]?_0x1affe7[_0x084e('0x17')][_0x084e('0x1a')]||null:null})[_0x084e('0xa')](function(_0x4a3964){logger[_0x084e('0xb')]('UpdateOpenchannelApplication',_0x1affe7);logger['debug'](_0x084e('0x14'),_0x1affe7,JSON[_0x084e('0x1b')](_0x4a3964));_0x446fe7(_0x4a3964);})[_0x084e('0x13')](function(_0x4d0d1f){logger[_0x084e('0x10')](_0x084e('0x14'),_0x4d0d1f[_0x084e('0x11')],_0x1affe7);_0x1dea99(_0x5e45fe[_0x084e('0x10')](0x1f4,_0x4d0d1f[_0x084e('0x11')]));});});}; \ No newline at end of file +var _0xa474=['request','then','info','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','OpenchannelApplication,\x20%s,\x20%s','message','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options','raw','where','attributes','limit','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x50e0ef,_0x226576){var _0x333457=function(_0x21f557){while(--_0x21f557){_0x50e0ef['push'](_0x50e0ef['shift']());}};_0x333457(++_0x226576);}(_0xa474,0x15f));var _0x4a47=function(_0x248ad0,_0x416197){_0x248ad0=_0x248ad0-0x0;var _0x190d11=_0xa474[_0x248ad0];return _0x190d11;};'use strict';var _=require(_0x4a47('0x0'));var util=require(_0x4a47('0x1'));var moment=require(_0x4a47('0x2'));var BPromise=require(_0x4a47('0x3'));var rs=require(_0x4a47('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4a47('0x5'))['db'];var utils=require(_0x4a47('0x6'));var logger=require(_0x4a47('0x7'))(_0x4a47('0x8'));var config=require('../../config/environment');var jayson=require(_0x4a47('0x9'));var client=jayson[_0x4a47('0xa')][_0x4a47('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x58f7bd,_0x5992f8,_0x2d75f9){return new BPromise(function(_0x15441f,_0xaf0c67){return client[_0x4a47('0xc')](_0x58f7bd,_0x2d75f9)[_0x4a47('0xd')](function(_0x11f3db){logger[_0x4a47('0xe')]('OpenchannelApplication,\x20%s,\x20%s',_0x5992f8,_0x4a47('0xf'));logger[_0x4a47('0x10')](_0x4a47('0x11'),_0x5992f8,_0x4a47('0xf'),JSON[_0x4a47('0x12')](_0x11f3db));if(_0x11f3db['error']){if(_0x11f3db[_0x4a47('0x13')]['code']===0x1f4){logger[_0x4a47('0x13')](_0x4a47('0x14'),_0x5992f8,_0x11f3db[_0x4a47('0x13')][_0x4a47('0x15')]);return _0xaf0c67(_0x11f3db[_0x4a47('0x13')][_0x4a47('0x15')]);}logger[_0x4a47('0x13')](_0x4a47('0x14'),_0x5992f8,_0x11f3db[_0x4a47('0x13')][_0x4a47('0x15')]);return _0x15441f(_0x11f3db[_0x4a47('0x13')]['message']);}else{logger[_0x4a47('0xe')]('OpenchannelApplication,\x20%s,\x20%s',_0x5992f8,_0x4a47('0xf'));_0x15441f(_0x11f3db[_0x4a47('0x16')][_0x4a47('0x15')]);}})[_0x4a47('0x17')](function(_0xddbfda){logger[_0x4a47('0x13')](_0x4a47('0x14'),_0x5992f8,_0xddbfda);_0xaf0c67(_0xddbfda);});});}exports[_0x4a47('0x18')]=function(_0x3cfa63){var _0x21ddc1=this;return new Promise(function(_0x648555,_0x5dea07){return db[_0x4a47('0x19')][_0x4a47('0x1a')](_0x3cfa63[_0x4a47('0x1b')],{'raw':_0x3cfa63['options']?_0x3cfa63[_0x4a47('0x1c')][_0x4a47('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3cfa63[_0x4a47('0x1c')]?_0x3cfa63[_0x4a47('0x1c')][_0x4a47('0x1e')]||null:null,'attributes':_0x3cfa63[_0x4a47('0x1c')]?_0x3cfa63[_0x4a47('0x1c')][_0x4a47('0x1f')]||null:null,'limit':_0x3cfa63['options']?_0x3cfa63[_0x4a47('0x1c')][_0x4a47('0x20')]||null:null})[_0x4a47('0xd')](function(_0x2a41d9){logger[_0x4a47('0xe')]('UpdateOpenchannelApplication',_0x3cfa63);logger['debug'](_0x4a47('0x18'),_0x3cfa63,JSON['stringify'](_0x2a41d9));_0x648555(_0x2a41d9);})['catch'](function(_0x595b71){logger[_0x4a47('0x13')](_0x4a47('0x18'),_0x595b71[_0x4a47('0x15')],_0x3cfa63);_0x5dea07(_0x21ddc1[_0x4a47('0x13')](0x1f4,_0x595b71[_0x4a47('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index e3ddf23..001be40 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 _0x3573=['addTags','put','/:id','tracked','openchannelinteraction:update','update','delete','openchannelinteraction:destroy','destroy','/:id/tags','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','index','describe','show','/:id/messages','getMessages','download','create','post','openchannel','openchannelinteraction:addtags'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0x3573,0x175));var _0x3357=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3573[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x3357('0x0'));var util=require(_0x3357('0x1'));var path=require(_0x3357('0x2'));var timeout=require(_0x3357('0x3'));var express=require(_0x3357('0x4'));var router=express[_0x3357('0x5')]();var fs_extra=require(_0x3357('0x6'));var auth=require(_0x3357('0x7'));var interaction=require(_0x3357('0x8'));var config=require(_0x3357('0x9'));var controller=require(_0x3357('0xa'));router[_0x3357('0xb')]('/',auth[_0x3357('0xc')](),controller[_0x3357('0xd')]);router['get']('/describe',auth[_0x3357('0xc')](),controller[_0x3357('0xe')]);router[_0x3357('0xb')]('/:id',auth[_0x3357('0xc')](),controller[_0x3357('0xf')]);router['get'](_0x3357('0x10'),auth[_0x3357('0xc')](),controller[_0x3357('0x11')]);router['get']('/:id/download',auth[_0x3357('0xc')](),controller[_0x3357('0x12')]);router['post']('/',auth['isAuthenticated'](),controller[_0x3357('0x13')]);router['post'](_0x3357('0x10'),auth[_0x3357('0xc')](),controller['addMessage']);router[_0x3357('0x14')]('/:id/tags',auth[_0x3357('0xc')](),interaction['tracked'](_0x3357('0x15'),_0x3357('0x16')),controller[_0x3357('0x17')]);router[_0x3357('0x18')](_0x3357('0x19'),auth[_0x3357('0xc')](),interaction[_0x3357('0x1a')](_0x3357('0x15'),_0x3357('0x1b')),controller[_0x3357('0x1c')]);router[_0x3357('0x1d')](_0x3357('0x19'),auth[_0x3357('0xc')](),interaction['tracked'](_0x3357('0x15'),_0x3357('0x1e')),controller[_0x3357('0x1f')]);router[_0x3357('0x1d')](_0x3357('0x20'),auth[_0x3357('0xc')](),controller['removeTags']);module['exports']=router; \ No newline at end of file +var _0xde37=['destroy','removeTags','multer','util','connect-timeout','express','Router','fs-extra','../../config/environment','./openchannelInteraction.controller','isAuthenticated','index','get','/describe','describe','getMessages','/:id/download','download','post','/:id/messages','/:id/tags','tracked','addTags','put','/:id','openchannel','openchannelinteraction:update','update','delete','openchannelinteraction:destroy'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xde37,0x110));var _0x7de3=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xde37[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x7de3('0x0'));var util=require(_0x7de3('0x1'));var path=require('path');var timeout=require(_0x7de3('0x2'));var express=require(_0x7de3('0x3'));var router=express[_0x7de3('0x4')]();var fs_extra=require(_0x7de3('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7de3('0x6'));var controller=require(_0x7de3('0x7'));router['get']('/',auth[_0x7de3('0x8')](),controller[_0x7de3('0x9')]);router[_0x7de3('0xa')](_0x7de3('0xb'),auth[_0x7de3('0x8')](),controller[_0x7de3('0xc')]);router[_0x7de3('0xa')]('/:id',auth[_0x7de3('0x8')](),controller['show']);router[_0x7de3('0xa')]('/:id/messages',auth[_0x7de3('0x8')](),controller[_0x7de3('0xd')]);router[_0x7de3('0xa')](_0x7de3('0xe'),auth[_0x7de3('0x8')](),controller[_0x7de3('0xf')]);router['post']('/',auth[_0x7de3('0x8')](),controller['create']);router[_0x7de3('0x10')](_0x7de3('0x11'),auth[_0x7de3('0x8')](),controller['addMessage']);router['post'](_0x7de3('0x12'),auth[_0x7de3('0x8')](),interaction[_0x7de3('0x13')]('openchannel','openchannelinteraction:addtags'),controller[_0x7de3('0x14')]);router[_0x7de3('0x15')](_0x7de3('0x16'),auth[_0x7de3('0x8')](),interaction[_0x7de3('0x13')](_0x7de3('0x17'),_0x7de3('0x18')),controller[_0x7de3('0x19')]);router[_0x7de3('0x1a')]('/:id',auth['isAuthenticated'](),interaction[_0x7de3('0x13')](_0x7de3('0x17'),_0x7de3('0x1b')),controller[_0x7de3('0x1c')]);router[_0x7de3('0x1a')](_0x7de3('0x12'),auth[_0x7de3('0x8')](),controller[_0x7de3('0x1d')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 9b2288a..841f1c8 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 _0x7b05=['out','sequelize','exports','BOOLEAN','DATE','STRING'];(function(_0x4dab14,_0x164ea0){var _0xf41aa=function(_0x305d50){while(--_0x305d50){_0x4dab14['push'](_0x4dab14['shift']());}};_0xf41aa(++_0x164ea0);}(_0x7b05,0x91));var _0x57b0=function(_0x1fa841,_0x37a70c){_0x1fa841=_0x1fa841-0x0;var _0x384b67=_0x7b05[_0x1fa841];return _0x384b67;};'use strict';var Sequelize=require(_0x57b0('0x0'));module[_0x57b0('0x1')]={'closed':{'type':Sequelize[_0x57b0('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x57b0('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x57b0('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x57b0('0x4')]},'read1stAt':{'type':Sequelize[_0x57b0('0x3')]},'threadId':{'type':Sequelize[_0x57b0('0x4')]},'externalUrl':{'type':Sequelize[_0x57b0('0x4')]},'lastMsgAt':{'type':Sequelize[_0x57b0('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x57b0('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x57b0('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x57b0('0x4')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x9e2a=['ENUM','out','BOOLEAN','sequelize','STRING','DATE'];(function(_0xab2afb,_0x546bfb){var _0x25262b=function(_0x3bd92d){while(--_0x3bd92d){_0xab2afb['push'](_0xab2afb['shift']());}};_0x25262b(++_0x546bfb);}(_0x9e2a,0xe1));var _0xa9e2=function(_0xea3e42,_0x2e43f9){_0xea3e42=_0xea3e42-0x0;var _0x394ae9=_0x9e2a[_0xea3e42];return _0x394ae9;};'use strict';var Sequelize=require(_0xa9e2('0x0'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xa9e2('0x1')]},'thirdDisposition':{'type':Sequelize[_0xa9e2('0x1')]},'note':{'type':Sequelize[_0xa9e2('0x1')]},'read1stAt':{'type':Sequelize[_0xa9e2('0x2')]},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xa9e2('0x3')]('in',_0xa9e2('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0xa9e2('0x3')]('in',_0xa9e2('0x4')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xa9e2('0x1')]},'autoreplyExecuted':{'type':Sequelize[_0xa9e2('0x5')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index eaa7516..861af0a 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 _0x6db1=['addMessage','OpenchannelMessage','ids','omit','getMessages','findOne','hasOwnProperty','sort','where','OpenchannelInteractionId','filter','merge','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','addTags','setTags','Tag','emit','removeTags','download','toString','join','root','server','files','transcript-%d-%s.zip','User','fullname','CmContact','Contact','firstName','lastName','push','Attachment','Messages','createdAt','secret','OpenchannelAccount','Account','Owner','get','mkdirSync','Openchannel','N.A.','closed','closedAt','disposition','Public','Private','existsSync','System','basename','direction','out','read','renderFile','views','transcript-','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','rimraf','moment','path','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','error','stack','name','map','OpenchannelInteraction','rawAttributes','fieldName','getOptions','openchannel','query','user','type','from','params','keys','filters','intersection','model','attributes','fields','length','include','options','find','catch','create','body','describe'];(function(_0x2c9d43,_0x12efae){var _0x1b46e3=function(_0x17c639){while(--_0x17c639){_0x2c9d43['push'](_0x2c9d43['shift']());}};_0x1b46e3(++_0x12efae);}(_0x6db1,0x12c));var _0x16db=function(_0x5a5c34,_0x52338d){_0x5a5c34=_0x5a5c34-0x0;var _0xbd439=_0x6db1[_0x5a5c34];return _0xbd439;};'use strict';var rimraf=require(_0x16db('0x0'));var zipdir=require('zip-dir');var moment=require(_0x16db('0x1'));var util=require('util');var path=require(_0x16db('0x2'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var Redis=require(_0x16db('0x3'));var interaction=require(_0x16db('0x4'));var qs=require(_0x16db('0x5'));var pdf=require('../../components/export/pdf');var logger=require(_0x16db('0x6'))('api');var config=require(_0x16db('0x7'));var db=require('../../mysqldb')['db'];config[_0x16db('0x8')]=_[_0x16db('0x9')](config['redis'],{'host':_0x16db('0xa'),'port':0x18eb});var socket=require(_0x16db('0xb'))(new Redis(config[_0x16db('0x8')]));require('./openchannelInteraction.socket')[_0x16db('0xc')](socket);function respondWithStatusCode(_0x16e95b,_0x4f8b8a){_0x4f8b8a=_0x4f8b8a||0xcc;return function(_0x339b21){if(_0x339b21){return _0x16e95b[_0x16db('0xd')](_0x4f8b8a);}return _0x16e95b[_0x16db('0xe')](_0x4f8b8a)['end']();};}function respondWithResult(_0x1b94b2,_0x5cd313){_0x5cd313=_0x5cd313||0xc8;return function(_0x430c8e){if(_0x430c8e){return _0x1b94b2[_0x16db('0xe')](_0x5cd313)[_0x16db('0xf')](_0x430c8e);}};}function respondWithFilteredResult(_0x10cdb0,_0x4fff4d){return function(_0x104f1d){if(_0x104f1d){var _0x58fadb=typeof _0x4fff4d[_0x16db('0x10')]===_0x16db('0x11')&&typeof _0x4fff4d[_0x16db('0x12')]==='undefined';var _0x3a109b=_0x104f1d[_0x16db('0x13')];var _0x5a2c76=_0x58fadb?0x0:_0x4fff4d['offset'];var _0x44116b=_0x58fadb?_0x104f1d[_0x16db('0x13')]:_0x4fff4d['offset']+_0x4fff4d[_0x16db('0x12')];var _0x402dce;if(_0x44116b>=_0x3a109b){_0x44116b=_0x3a109b;_0x402dce=0xc8;}else{_0x402dce=0xce;}_0x10cdb0[_0x16db('0xe')](_0x402dce);return _0x10cdb0[_0x16db('0x14')](_0x16db('0x15'),_0x5a2c76+'-'+_0x44116b+'/'+_0x3a109b)[_0x16db('0xf')](_0x104f1d);}return null;};}function saveUpdates(_0x5d43e2){return function(_0x56b061){if(_0x56b061){return _0x56b061[_0x16db('0x16')](_0x5d43e2)[_0x16db('0x17')](function(_0x333f8e){return _0x333f8e;});}return null;};}function removeEntity(_0x44d5f6){return function(_0x23889e){if(_0x23889e){return _0x23889e[_0x16db('0x18')]()[_0x16db('0x17')](function(){_0x44d5f6[_0x16db('0xe')](0xcc)[_0x16db('0x19')]();});}};}function handleEntityNotFound(_0x72dee2){return function(_0x53d7d4){if(!_0x53d7d4){_0x72dee2['sendStatus'](0x194);}return _0x53d7d4;};}function handleError(_0xed3a70,_0x5c2893){_0x5c2893=_0x5c2893||0x1f4;return function(_0x5b8a15){logger[_0x16db('0x1a')](_0x5b8a15[_0x16db('0x1b')]);if(_0x5b8a15[_0x16db('0x1c')]){delete _0x5b8a15[_0x16db('0x1c')];}_0xed3a70[_0x16db('0xe')](_0x5c2893)['send'](_0x5b8a15);};}exports['index']=function(_0x5cc781,_0x2a1fb7){var _0x5bcfa1={};var _0x735419=_[_0x16db('0x1d')](db[_0x16db('0x1e')][_0x16db('0x1f')],function(_0x233ad7){return{'name':_0x233ad7[_0x16db('0x20')],'type':_0x233ad7['type']['key']};});_0x5bcfa1=qs[_0x16db('0x21')](_0x735419,_0x5cc781);return interaction['findAll'](_0x16db('0x22'),_0x5cc781[_0x16db('0x23')],_0x5cc781[_0x16db('0x24')],_0x5bcfa1,_0x735419)[_0x16db('0x17')](respondWithFilteredResult(_0x2a1fb7,_0x5bcfa1))['catch'](handleError(_0x2a1fb7,null));};exports['show']=function(_0x4717b8,_0x598327){var _0x1fa9c0={};if(_0x4717b8[_0x16db('0x23')][_0x16db('0x25')]&&_0x4717b8['query'][_0x16db('0x25')]===_0x16db('0x26')){_0x1fa9c0[_0x16db('0x26')]=_0x4717b8[_0x16db('0x27')]['id'];}else{_0x1fa9c0['id']=_0x4717b8[_0x16db('0x27')]['id'];}var _0x2ff564={'raw':![],'where':_0x1fa9c0},_0x2e69cb={};_0x2e69cb['model']=_[_0x16db('0x28')](db[_0x16db('0x1e')][_0x16db('0x1f')]);_0x2e69cb[_0x16db('0x23')]=_['keys'](_0x4717b8['query']);_0x2e69cb[_0x16db('0x29')]=_[_0x16db('0x2a')](_0x2e69cb[_0x16db('0x2b')],_0x2e69cb['query']);_0x2ff564[_0x16db('0x2c')]=_[_0x16db('0x2a')](_0x2e69cb['model'],qs[_0x16db('0x2d')](_0x4717b8[_0x16db('0x23')]['fields']));_0x2ff564[_0x16db('0x2c')]=_0x2ff564[_0x16db('0x2c')][_0x16db('0x2e')]?_0x2ff564['attributes']:_0x2e69cb[_0x16db('0x2b')];if(_0x4717b8['query']['includeAll']){_0x2ff564[_0x16db('0x2f')]=[{'all':!![]}];}_0x2ff564=_['merge']({},_0x2ff564,_0x4717b8[_0x16db('0x30')]);return db['OpenchannelInteraction'][_0x16db('0x31')](_0x2ff564)[_0x16db('0x17')](handleEntityNotFound(_0x598327,null))[_0x16db('0x17')](respondWithResult(_0x598327,null))[_0x16db('0x32')](handleError(_0x598327,null));};exports[_0x16db('0x33')]=function(_0x5d040b,_0x4b556f){return db[_0x16db('0x1e')][_0x16db('0x33')](_0x5d040b[_0x16db('0x34')],{})[_0x16db('0x17')](respondWithResult(_0x4b556f,0xc9))[_0x16db('0x32')](handleError(_0x4b556f,null));};exports[_0x16db('0x16')]=function(_0x5a95cf,_0x4f406a){if(_0x5a95cf['body']['id']){delete _0x5a95cf['body']['id'];}return db[_0x16db('0x1e')][_0x16db('0x31')]({'where':{'id':_0x5a95cf[_0x16db('0x27')]['id']}})[_0x16db('0x17')](handleEntityNotFound(_0x4f406a,null))[_0x16db('0x17')](saveUpdates(_0x5a95cf[_0x16db('0x34')],null))[_0x16db('0x17')](respondWithResult(_0x4f406a,null))[_0x16db('0x32')](handleError(_0x4f406a,null));};exports[_0x16db('0x18')]=function(_0x2e3cca,_0x1f3c1a){return db[_0x16db('0x1e')][_0x16db('0x31')]({'where':{'id':_0x2e3cca['params']['id']}})[_0x16db('0x17')](handleEntityNotFound(_0x1f3c1a,null))[_0x16db('0x17')](removeEntity(_0x1f3c1a,null))['catch'](handleError(_0x1f3c1a,null));};exports[_0x16db('0x35')]=function(_0x221204,_0x2a68c0){return db['OpenchannelInteraction'][_0x16db('0x35')]()[_0x16db('0x17')](respondWithResult(_0x2a68c0,null))[_0x16db('0x32')](handleError(_0x2a68c0,null));};exports[_0x16db('0x36')]=function(_0x151638,_0x3e101c){return db[_0x16db('0x37')][_0x16db('0x31')]({'where':{'id':_0x151638[_0x16db('0x27')]['id']}})[_0x16db('0x17')](handleEntityNotFound(_0x3e101c,null))[_0x16db('0x17')](function(_0x1ee01e){if(_0x1ee01e){return _0x1ee01e[_0x16db('0x36')](_0x151638[_0x16db('0x34')][_0x16db('0x38')],_[_0x16db('0x39')](_0x151638[_0x16db('0x34')],['ids','id'])||{});}})['then'](respondWithResult(_0x3e101c,null))['catch'](handleError(_0x3e101c,null));};exports[_0x16db('0x3a')]=function(_0x3f02ba,_0x1ce3f5){var _0x136d95={'raw':![],'where':{}};var _0x3ac14b={};var _0x25e78d={'count':0x0,'rows':[]};return db['OpenchannelInteraction'][_0x16db('0x3b')]({'where':{'id':_0x3f02ba[_0x16db('0x27')]['id']}})['then'](handleEntityNotFound(_0x1ce3f5,null))[_0x16db('0x17')](function(_0x4509b1){if(_0x4509b1){_0x3ac14b[_0x16db('0x2b')]=_['keys'](db[_0x16db('0x37')][_0x16db('0x1f')]);_0x3ac14b[_0x16db('0x23')]=_['keys'](_0x3f02ba['query']);_0x3ac14b[_0x16db('0x29')]=_[_0x16db('0x2a')](_0x3ac14b['model'],_0x3ac14b[_0x16db('0x23')]);_0x136d95[_0x16db('0x2c')]=_[_0x16db('0x2a')](_0x3ac14b[_0x16db('0x2b')],qs[_0x16db('0x2d')](_0x3f02ba[_0x16db('0x23')][_0x16db('0x2d')]));_0x136d95['attributes']=_0x136d95[_0x16db('0x2c')][_0x16db('0x2e')]?_0x136d95['attributes']:_0x3ac14b[_0x16db('0x2b')];if(!_0x3f02ba['query'][_0x16db('0x3c')]('nolimit')){_0x136d95[_0x16db('0x12')]=qs[_0x16db('0x12')](_0x3f02ba[_0x16db('0x23')][_0x16db('0x12')]);_0x136d95['offset']=qs[_0x16db('0x10')](_0x3f02ba[_0x16db('0x23')][_0x16db('0x10')]);}_0x136d95['order']=qs[_0x16db('0x3d')](_0x3f02ba[_0x16db('0x23')][_0x16db('0x3d')]);_0x136d95[_0x16db('0x3e')]=qs['filters'](_['pick'](_0x3f02ba[_0x16db('0x23')],_0x3ac14b[_0x16db('0x29')]));_0x136d95[_0x16db('0x3e')][_0x16db('0x3f')]=_0x4509b1['id'];if(_0x3f02ba[_0x16db('0x23')][_0x16db('0x40')]){_0x136d95['where']=_[_0x16db('0x41')](_0x136d95[_0x16db('0x3e')],{'$or':_[_0x16db('0x1d')](_0x136d95[_0x16db('0x2c')],function(_0x3b4760){var _0xeb88ec={};_0xeb88ec[_0x3b4760]={'$like':'%'+_0x3f02ba[_0x16db('0x23')][_0x16db('0x40')]+'%'};return _0xeb88ec;})});}if(_0x3f02ba[_0x16db('0x23')][_0x16db('0x42')]){var _0x401349=_0x3f02ba['query'][_0x16db('0x42')][_0x16db('0x43')](',');var _0x51bbee={};_0x51bbee[_0x401349[0x0]]={'$gte':moment(_0x401349[0x1])[_0x16db('0x44')](_0x16db('0x45'))};_0x136d95[_0x16db('0x3e')]=_[_0x16db('0x41')](_0x136d95['where'],_0x51bbee);}_0x136d95=_[_0x16db('0x41')]({},_0x136d95,_0x3f02ba[_0x16db('0x30')]);return db[_0x16db('0x37')][_0x16db('0x13')]({'where':_0x136d95[_0x16db('0x3e')]})[_0x16db('0x17')](function(_0x259502){_0x25e78d[_0x16db('0x13')]=_0x259502;if(_0x3f02ba[_0x16db('0x23')][_0x16db('0x46')]){_0x136d95[_0x16db('0x2f')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0x16db('0x47')](_0x136d95);})[_0x16db('0x17')](function(_0x3cdfe9){_0x25e78d['rows']=_0x3cdfe9;return _0x25e78d;});}})[_0x16db('0x17')](respondWithFilteredResult(_0x1ce3f5,_0x136d95))['catch'](handleError(_0x1ce3f5,null));};exports[_0x16db('0x48')]=function(_0x1fd357,_0x6ebce4){return db['OpenchannelInteraction']['find']({'where':{'id':_0x1fd357[_0x16db('0x27')]['id']}})[_0x16db('0x17')](handleEntityNotFound(_0x6ebce4,null))[_0x16db('0x17')](function(_0x488b38){if(_0x488b38){return _0x488b38[_0x16db('0x49')](_0x1fd357[_0x16db('0x34')]['ids'],_[_0x16db('0x39')](_0x1fd357[_0x16db('0x34')],[_0x16db('0x38'),'id'])||{})['spread'](function(){return db[_0x16db('0x4a')][_0x16db('0x47')]({'attributes':['id',_0x16db('0x1c'),'color'],'where':{'id':_0x1fd357[_0x16db('0x34')]['ids']}});})[_0x16db('0x17')](function(_0x44bd3a){socket[_0x16db('0x4b')]('openchannelInteractionTags:save',{'id':Number(_0x1fd357['params']['id']),'tags':_0x44bd3a||[]});return{'id':Number(_0x1fd357[_0x16db('0x27')]['id']),'tags':_0x44bd3a||[]};});}})['then'](respondWithResult(_0x6ebce4,null))[_0x16db('0x32')](handleError(_0x6ebce4,null));};exports[_0x16db('0x4c')]=function(_0x2bd86d,_0x401f5a){return db['OpenchannelInteraction'][_0x16db('0x31')]({'where':{'id':_0x2bd86d[_0x16db('0x27')]['id']}})[_0x16db('0x17')](handleEntityNotFound(_0x401f5a,null))['then'](function(_0x426268){if(_0x426268){return _0x426268[_0x16db('0x4c')](_0x2bd86d[_0x16db('0x23')][_0x16db('0x38')]);}})[_0x16db('0x17')](respondWithStatusCode(_0x401f5a,null))[_0x16db('0x32')](handleError(_0x401f5a,null));};exports[_0x16db('0x4d')]=function(_0x572bff,_0x18b886){var _0xfba94e=moment()['unix']()[_0x16db('0x4e')]();var _0x5546e4=path[_0x16db('0x4f')](config[_0x16db('0x50')],_0x16db('0x51'),'files','tmp');var _0x180ef8=path[_0x16db('0x4f')](config[_0x16db('0x50')],_0x16db('0x51'),_0x16db('0x52'),'attachments');var _0x11266d=path[_0x16db('0x4f')](_0x5546e4,_0xfba94e);var _0x335a79=util[_0x16db('0x44')](_0x16db('0x53'),_0x572bff['params']['id'],_0xfba94e);var _0x2b4f46=path[_0x16db('0x4f')](_0x5546e4,_0x335a79);var _0xb40093=[];_0xb40093['push']({'model':db['User'],'as':_0x16db('0x54'),'attributes':['id',_0x16db('0x55')],'raw':!![]});_0xb40093['push']({'model':db[_0x16db('0x56')],'as':_0x16db('0x57'),'attributes':['id',_0x16db('0x58'),_0x16db('0x59')],'raw':!![]});if(_0x572bff['query']['attachments']){_0xb40093[_0x16db('0x5a')]({'model':db[_0x16db('0x5b')],'as':_0x16db('0x5b'),'raw':!![]});}var _0x12d337=[{'model':db[_0x16db('0x37')],'as':_0x16db('0x5c'),'attributes':['id',_0x16db('0x34'),_0x16db('0x5d'),'direction',_0x16db('0x5e'),'read'],'include':_0xb40093}];_0x12d337['push']({'model':db[_0x16db('0x5f')],'as':_0x16db('0x60'),'attributes':['id','name']});_0x12d337['push']({'model':db[_0x16db('0x54')],'as':_0x16db('0x61'),'attributes':['id',_0x16db('0x55')]});return db[_0x16db('0x1e')][_0x16db('0x31')]({'where':{'id':_0x572bff['params']['id']},'include':_0x12d337})[_0x16db('0x17')](handleEntityNotFound(_0x18b886,null))['then'](function(_0x449922){if(_0x449922){var _0x24b6c8=_0x449922[_0x16db('0x62')]({'plain':!![]});fs[_0x16db('0x63')](_0x11266d);var _0x5d9b10={'channel':_0x16db('0x64'),'account':_0x24b6c8[_0x16db('0x60')][_0x16db('0x1c')],'agent':_0x24b6c8[_0x16db('0x61')]?_0x24b6c8[_0x16db('0x61')]['fullname']:_0x16db('0x65'),'createdAt':moment(_0x24b6c8['createdAt'])[_0x16db('0x44')](_0x16db('0x45'))['toString'](),'closedAt':_0x24b6c8[_0x16db('0x66')]?moment(_0x24b6c8[_0x16db('0x67')])[_0x16db('0x44')](_0x16db('0x45'))[_0x16db('0x4e')]():'','disposition':_0x24b6c8[_0x16db('0x68')],'visibility':_0x24b6c8['threadId']?_0x16db('0x69'):_0x16db('0x6a'),'messages':_(_0x24b6c8[_0x16db('0x5c')])['filter']({'secret':![]})[_0x16db('0x1d')](function(_0x1e9c53){if(_0x1e9c53[_0x16db('0x5b')]){var _0x3f0a4a=path[_0x16db('0x4f')](_0x180ef8,_0x1e9c53[_0x16db('0x5b')]['basename']);if(fs[_0x16db('0x6b')](_0x3f0a4a)){fs['createReadStream'](_0x3f0a4a)['pipe'](fs['createWriteStream'](path['join'](_0x11266d,_0x1e9c53['Attachment']['basename'])));}}return{'date':moment(_0x1e9c53['createdAt'])[_0x16db('0x44')](_0x16db('0x45'))[_0x16db('0x4e')](),'sender':_0x1e9c53['direction']==='out'?_0x1e9c53[_0x16db('0x54')]?_0x1e9c53[_0x16db('0x54')]['fullname']:_0x16db('0x6c'):_0x1e9c53[_0x16db('0x57')][_0x16db('0x58')]+(_0x1e9c53[_0x16db('0x57')]['lastName']?'\x20'+_0x1e9c53[_0x16db('0x57')][_0x16db('0x59')]:''),'body':_0x1e9c53[_0x16db('0x5b')]?_0x1e9c53['Attachment'][_0x16db('0x6d')]:_0x1e9c53[_0x16db('0x34')],'direction':_0x1e9c53[_0x16db('0x6e')]===_0x16db('0x6f')?'A':'C','secret':_0x1e9c53['secret'],'read':_0x1e9c53[_0x16db('0x70')],'attachment':_0x1e9c53['Attachment']};})['value']()};return ejs[_0x16db('0x71')](path[_0x16db('0x4f')](config['root'],'server',_0x16db('0x72'),'downloadInteraction.ejs'),{'interaction':_0x5d9b10})[_0x16db('0x17')](function(_0x502cae){var _0x18a1c7=path[_0x16db('0x4f')](_0x11266d,_0x16db('0x73')+_0x24b6c8['id']+'-'+_0xfba94e+'.pdf');var _0x4aeba8={'path':_0x18a1c7,'channel':_0x16db('0x64'),'interactionId':_0x24b6c8['id']};return pdf['createPdfFromHTML'](_0x502cae,_0x4aeba8);})[_0x16db('0x17')](function(){return new Promise(function(_0x510ec2,_0x189efa){zipdir(_0x11266d,{'saveTo':_0x2b4f46},function(_0x1865ff,_0xdaec6f){if(_0x1865ff)return _0x189efa(_0x1865ff);return _0x510ec2(_0xdaec6f);});})['then'](function(){return new Promise(function(_0x538002,_0x16eefd){rimraf(_0x11266d,function(_0x3be5d6){if(_0x3be5d6)_0x16eefd(_0x3be5d6);return _0x538002();});});})[_0x16db('0x17')](function(){return _0x18b886[_0x16db('0x4d')](_0x2b4f46,_0x335a79,function(_0x3a68bd){if(_0x3a68bd){logger[_0x16db('0x1a')](_0x16db('0x74'),_0x3a68bd);}else{fs[_0x16db('0x75')](_0x2b4f46);}});});});}else{return _0x18b886['sendStatus'](0xc8);}})['catch'](handleError(_0x18b886,null));}; \ No newline at end of file +var _0x0255=['type','key','getOptions','findAll','openchannel','catch','show','query','from','params','keys','filters','intersection','model','attributes','fields','include','merge','options','find','create','body','destroy','addMessage','OpenchannelMessage','ids','omit','getMessages','findOne','hasOwnProperty','nolimit','order','sort','where','pick','OpenchannelInteractionId','map','$gte','split','includeAll','addTags','setTags','spread','Tag','emit','removeTags','download','unix','toString','join','root','files','tmp','server','format','transcript-%d-%s.zip','User','fullname','push','CmContact','Contact','lastName','attachments','Attachment','Messages','createdAt','read','OpenchannelAccount','Account','Owner','get','mkdirSync','Openchannel','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','threadId','Public','filter','basename','createReadStream','pipe','createWriteStream','direction','out','System','firstName','renderFile','views','downloadInteraction.ejs','transcript-','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','rimraf','zip-dir','moment','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','api','../../config/environment','../../mysqldb','redis','localhost','./openchannelInteraction.socket','register','end','json','offset','limit','undefined','count','status','set','Content-Range','update','then','sendStatus','error','stack','name','send','index','OpenchannelInteraction','rawAttributes'];(function(_0x39b6dd,_0xca8511){var _0x32ecce=function(_0x31b287){while(--_0x31b287){_0x39b6dd['push'](_0x39b6dd['shift']());}};_0x32ecce(++_0xca8511);}(_0x0255,0x15f));var _0x5025=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0255[_0x3dd15e];return _0x231fd0;};'use strict';var rimraf=require(_0x5025('0x0'));var zipdir=require(_0x5025('0x1'));var moment=require(_0x5025('0x2'));var util=require('util');var path=require(_0x5025('0x3'));var ejs=require(_0x5025('0x4'));var fs=require('fs');var _=require(_0x5025('0x5'));var Redis=require(_0x5025('0x6'));var interaction=require(_0x5025('0x7'));var qs=require(_0x5025('0x8'));var pdf=require(_0x5025('0x9'));var logger=require('../../config/logger')(_0x5025('0xa'));var config=require(_0x5025('0xb'));var db=require(_0x5025('0xc'))['db'];config[_0x5025('0xd')]=_['defaults'](config[_0x5025('0xd')],{'host':_0x5025('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5025('0xd')]));require(_0x5025('0xf'))[_0x5025('0x10')](socket);function respondWithStatusCode(_0x5c69e1,_0xe60622){_0xe60622=_0xe60622||0xcc;return function(_0x5b00e4){if(_0x5b00e4){return _0x5c69e1['sendStatus'](_0xe60622);}return _0x5c69e1['status'](_0xe60622)[_0x5025('0x11')]();};}function respondWithResult(_0x37c8ca,_0x539253){_0x539253=_0x539253||0xc8;return function(_0x1f4cf3){if(_0x1f4cf3){return _0x37c8ca['status'](_0x539253)[_0x5025('0x12')](_0x1f4cf3);}};}function respondWithFilteredResult(_0x482d91,_0x10e48a){return function(_0x30bcc5){if(_0x30bcc5){var _0x56106e=typeof _0x10e48a[_0x5025('0x13')]==='undefined'&&typeof _0x10e48a[_0x5025('0x14')]===_0x5025('0x15');var _0x57bbac=_0x30bcc5[_0x5025('0x16')];var _0x4205e2=_0x56106e?0x0:_0x10e48a[_0x5025('0x13')];var _0x1fcc33=_0x56106e?_0x30bcc5[_0x5025('0x16')]:_0x10e48a['offset']+_0x10e48a[_0x5025('0x14')];var _0x4b34b4;if(_0x1fcc33>=_0x57bbac){_0x1fcc33=_0x57bbac;_0x4b34b4=0xc8;}else{_0x4b34b4=0xce;}_0x482d91[_0x5025('0x17')](_0x4b34b4);return _0x482d91[_0x5025('0x18')](_0x5025('0x19'),_0x4205e2+'-'+_0x1fcc33+'/'+_0x57bbac)[_0x5025('0x12')](_0x30bcc5);}return null;};}function saveUpdates(_0x19de89){return function(_0x6c79ef){if(_0x6c79ef){return _0x6c79ef[_0x5025('0x1a')](_0x19de89)[_0x5025('0x1b')](function(_0xe837ad){return _0xe837ad;});}return null;};}function removeEntity(_0x27212d){return function(_0x16fda8){if(_0x16fda8){return _0x16fda8['destroy']()[_0x5025('0x1b')](function(){_0x27212d[_0x5025('0x17')](0xcc)[_0x5025('0x11')]();});}};}function handleEntityNotFound(_0x4e8a16){return function(_0x57db5b){if(!_0x57db5b){_0x4e8a16[_0x5025('0x1c')](0x194);}return _0x57db5b;};}function handleError(_0x21a6de,_0x2dad46){_0x2dad46=_0x2dad46||0x1f4;return function(_0x699987){logger[_0x5025('0x1d')](_0x699987[_0x5025('0x1e')]);if(_0x699987[_0x5025('0x1f')]){delete _0x699987['name'];}_0x21a6de[_0x5025('0x17')](_0x2dad46)[_0x5025('0x20')](_0x699987);};}exports[_0x5025('0x21')]=function(_0x5ae0a6,_0x26acc0){var _0x9365d3={};var _0x56b351=_['map'](db[_0x5025('0x22')][_0x5025('0x23')],function(_0x365acf){return{'name':_0x365acf['fieldName'],'type':_0x365acf[_0x5025('0x24')][_0x5025('0x25')]};});_0x9365d3=qs[_0x5025('0x26')](_0x56b351,_0x5ae0a6);return interaction[_0x5025('0x27')](_0x5025('0x28'),_0x5ae0a6['query'],_0x5ae0a6['user'],_0x9365d3,_0x56b351)['then'](respondWithFilteredResult(_0x26acc0,_0x9365d3))[_0x5025('0x29')](handleError(_0x26acc0,null));};exports[_0x5025('0x2a')]=function(_0x181839,_0x2b0d02){var _0x244756={};if(_0x181839[_0x5025('0x2b')][_0x5025('0x24')]&&_0x181839[_0x5025('0x2b')][_0x5025('0x24')]===_0x5025('0x2c')){_0x244756[_0x5025('0x2c')]=_0x181839[_0x5025('0x2d')]['id'];}else{_0x244756['id']=_0x181839[_0x5025('0x2d')]['id'];}var _0x3edb39={'raw':![],'where':_0x244756},_0x3e9e7e={};_0x3e9e7e['model']=_[_0x5025('0x2e')](db[_0x5025('0x22')]['rawAttributes']);_0x3e9e7e[_0x5025('0x2b')]=_[_0x5025('0x2e')](_0x181839[_0x5025('0x2b')]);_0x3e9e7e[_0x5025('0x2f')]=_[_0x5025('0x30')](_0x3e9e7e[_0x5025('0x31')],_0x3e9e7e[_0x5025('0x2b')]);_0x3edb39[_0x5025('0x32')]=_[_0x5025('0x30')](_0x3e9e7e[_0x5025('0x31')],qs['fields'](_0x181839[_0x5025('0x2b')][_0x5025('0x33')]));_0x3edb39['attributes']=_0x3edb39[_0x5025('0x32')]['length']?_0x3edb39['attributes']:_0x3e9e7e[_0x5025('0x31')];if(_0x181839['query']['includeAll']){_0x3edb39[_0x5025('0x34')]=[{'all':!![]}];}_0x3edb39=_[_0x5025('0x35')]({},_0x3edb39,_0x181839[_0x5025('0x36')]);return db[_0x5025('0x22')][_0x5025('0x37')](_0x3edb39)[_0x5025('0x1b')](handleEntityNotFound(_0x2b0d02,null))[_0x5025('0x1b')](respondWithResult(_0x2b0d02,null))[_0x5025('0x29')](handleError(_0x2b0d02,null));};exports[_0x5025('0x38')]=function(_0x5cec5c,_0x67f6bb){return db[_0x5025('0x22')][_0x5025('0x38')](_0x5cec5c[_0x5025('0x39')],{})[_0x5025('0x1b')](respondWithResult(_0x67f6bb,0xc9))[_0x5025('0x29')](handleError(_0x67f6bb,null));};exports[_0x5025('0x1a')]=function(_0x4d8364,_0xed11f3){if(_0x4d8364['body']['id']){delete _0x4d8364[_0x5025('0x39')]['id'];}return db[_0x5025('0x22')][_0x5025('0x37')]({'where':{'id':_0x4d8364['params']['id']}})[_0x5025('0x1b')](handleEntityNotFound(_0xed11f3,null))[_0x5025('0x1b')](saveUpdates(_0x4d8364['body'],null))[_0x5025('0x1b')](respondWithResult(_0xed11f3,null))[_0x5025('0x29')](handleError(_0xed11f3,null));};exports[_0x5025('0x3a')]=function(_0x468f27,_0x152db2){return db[_0x5025('0x22')][_0x5025('0x37')]({'where':{'id':_0x468f27[_0x5025('0x2d')]['id']}})['then'](handleEntityNotFound(_0x152db2,null))[_0x5025('0x1b')](removeEntity(_0x152db2,null))[_0x5025('0x29')](handleError(_0x152db2,null));};exports['describe']=function(_0x2d7631,_0x4b9ea9){return db['OpenchannelInteraction']['describe']()[_0x5025('0x1b')](respondWithResult(_0x4b9ea9,null))[_0x5025('0x29')](handleError(_0x4b9ea9,null));};exports[_0x5025('0x3b')]=function(_0x170692,_0x351528){return db[_0x5025('0x3c')][_0x5025('0x37')]({'where':{'id':_0x170692[_0x5025('0x2d')]['id']}})['then'](handleEntityNotFound(_0x351528,null))[_0x5025('0x1b')](function(_0x12763a){if(_0x12763a){return _0x12763a[_0x5025('0x3b')](_0x170692[_0x5025('0x39')][_0x5025('0x3d')],_[_0x5025('0x3e')](_0x170692[_0x5025('0x39')],['ids','id'])||{});}})[_0x5025('0x1b')](respondWithResult(_0x351528,null))[_0x5025('0x29')](handleError(_0x351528,null));};exports[_0x5025('0x3f')]=function(_0x210e77,_0x1511de){var _0x142ea2={'raw':![],'where':{}};var _0x548cb9={};var _0x3b4754={'count':0x0,'rows':[]};return db[_0x5025('0x22')][_0x5025('0x40')]({'where':{'id':_0x210e77['params']['id']}})['then'](handleEntityNotFound(_0x1511de,null))[_0x5025('0x1b')](function(_0x38d0df){if(_0x38d0df){_0x548cb9[_0x5025('0x31')]=_[_0x5025('0x2e')](db[_0x5025('0x3c')][_0x5025('0x23')]);_0x548cb9[_0x5025('0x2b')]=_[_0x5025('0x2e')](_0x210e77[_0x5025('0x2b')]);_0x548cb9[_0x5025('0x2f')]=_[_0x5025('0x30')](_0x548cb9['model'],_0x548cb9[_0x5025('0x2b')]);_0x142ea2[_0x5025('0x32')]=_[_0x5025('0x30')](_0x548cb9[_0x5025('0x31')],qs['fields'](_0x210e77[_0x5025('0x2b')][_0x5025('0x33')]));_0x142ea2[_0x5025('0x32')]=_0x142ea2['attributes']['length']?_0x142ea2[_0x5025('0x32')]:_0x548cb9['model'];if(!_0x210e77[_0x5025('0x2b')][_0x5025('0x41')](_0x5025('0x42'))){_0x142ea2['limit']=qs[_0x5025('0x14')](_0x210e77[_0x5025('0x2b')][_0x5025('0x14')]);_0x142ea2['offset']=qs[_0x5025('0x13')](_0x210e77['query'][_0x5025('0x13')]);}_0x142ea2[_0x5025('0x43')]=qs[_0x5025('0x44')](_0x210e77[_0x5025('0x2b')]['sort']);_0x142ea2[_0x5025('0x45')]=qs[_0x5025('0x2f')](_[_0x5025('0x46')](_0x210e77[_0x5025('0x2b')],_0x548cb9[_0x5025('0x2f')]));_0x142ea2['where'][_0x5025('0x47')]=_0x38d0df['id'];if(_0x210e77[_0x5025('0x2b')]['filter']){_0x142ea2[_0x5025('0x45')]=_[_0x5025('0x35')](_0x142ea2[_0x5025('0x45')],{'$or':_[_0x5025('0x48')](_0x142ea2[_0x5025('0x32')],function(_0x5be608){var _0x69eb45={};_0x69eb45[_0x5be608]={'$like':'%'+_0x210e77['query']['filter']+'%'};return _0x69eb45;})});}if(_0x210e77[_0x5025('0x2b')]['$gte']){var _0x1fc181=_0x210e77[_0x5025('0x2b')][_0x5025('0x49')][_0x5025('0x4a')](',');var _0x1db80b={};_0x1db80b[_0x1fc181[0x0]]={'$gte':moment(_0x1fc181[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x142ea2[_0x5025('0x45')]=_[_0x5025('0x35')](_0x142ea2['where'],_0x1db80b);}_0x142ea2=_[_0x5025('0x35')]({},_0x142ea2,_0x210e77[_0x5025('0x36')]);return db[_0x5025('0x3c')][_0x5025('0x16')]({'where':_0x142ea2['where']})['then'](function(_0xcfd367){_0x3b4754[_0x5025('0x16')]=_0xcfd367;if(_0x210e77[_0x5025('0x2b')][_0x5025('0x4b')]){_0x142ea2[_0x5025('0x34')]=[{'all':!![]}];}return db[_0x5025('0x3c')][_0x5025('0x27')](_0x142ea2);})[_0x5025('0x1b')](function(_0x1c9b3f){_0x3b4754['rows']=_0x1c9b3f;return _0x3b4754;});}})[_0x5025('0x1b')](respondWithFilteredResult(_0x1511de,_0x142ea2))[_0x5025('0x29')](handleError(_0x1511de,null));};exports[_0x5025('0x4c')]=function(_0x598648,_0x3da74c){return db[_0x5025('0x22')][_0x5025('0x37')]({'where':{'id':_0x598648[_0x5025('0x2d')]['id']}})[_0x5025('0x1b')](handleEntityNotFound(_0x3da74c,null))[_0x5025('0x1b')](function(_0x320b3b){if(_0x320b3b){return _0x320b3b[_0x5025('0x4d')](_0x598648[_0x5025('0x39')][_0x5025('0x3d')],_[_0x5025('0x3e')](_0x598648[_0x5025('0x39')],[_0x5025('0x3d'),'id'])||{})[_0x5025('0x4e')](function(){return db[_0x5025('0x4f')]['findAll']({'attributes':['id','name','color'],'where':{'id':_0x598648[_0x5025('0x39')]['ids']}});})[_0x5025('0x1b')](function(_0x3a6805){socket[_0x5025('0x50')]('openchannelInteractionTags:save',{'id':Number(_0x598648[_0x5025('0x2d')]['id']),'tags':_0x3a6805||[]});return{'id':Number(_0x598648[_0x5025('0x2d')]['id']),'tags':_0x3a6805||[]};});}})[_0x5025('0x1b')](respondWithResult(_0x3da74c,null))[_0x5025('0x29')](handleError(_0x3da74c,null));};exports[_0x5025('0x51')]=function(_0x23cdf5,_0x231dec){return db[_0x5025('0x22')][_0x5025('0x37')]({'where':{'id':_0x23cdf5[_0x5025('0x2d')]['id']}})[_0x5025('0x1b')](handleEntityNotFound(_0x231dec,null))['then'](function(_0x1614ff){if(_0x1614ff){return _0x1614ff['removeTags'](_0x23cdf5['query'][_0x5025('0x3d')]);}})['then'](respondWithStatusCode(_0x231dec,null))[_0x5025('0x29')](handleError(_0x231dec,null));};exports[_0x5025('0x52')]=function(_0x288d17,_0x1dc0f1){var _0x12fac7=moment()[_0x5025('0x53')]()[_0x5025('0x54')]();var _0x20b2e4=path[_0x5025('0x55')](config[_0x5025('0x56')],'server',_0x5025('0x57'),_0x5025('0x58'));var _0x5e9e10=path[_0x5025('0x55')](config[_0x5025('0x56')],_0x5025('0x59'),'files','attachments');var _0x4fffed=path['join'](_0x20b2e4,_0x12fac7);var _0x4e65f0=util[_0x5025('0x5a')](_0x5025('0x5b'),_0x288d17[_0x5025('0x2d')]['id'],_0x12fac7);var _0x4fbc7d=path['join'](_0x20b2e4,_0x4e65f0);var _0x1e31d6=[];_0x1e31d6['push']({'model':db['User'],'as':_0x5025('0x5c'),'attributes':['id',_0x5025('0x5d')],'raw':!![]});_0x1e31d6[_0x5025('0x5e')]({'model':db[_0x5025('0x5f')],'as':_0x5025('0x60'),'attributes':['id','firstName',_0x5025('0x61')],'raw':!![]});if(_0x288d17[_0x5025('0x2b')][_0x5025('0x62')]){_0x1e31d6[_0x5025('0x5e')]({'model':db['Attachment'],'as':_0x5025('0x63'),'raw':!![]});}var _0x4b5793=[{'model':db['OpenchannelMessage'],'as':_0x5025('0x64'),'attributes':['id','body',_0x5025('0x65'),'direction','secret',_0x5025('0x66')],'include':_0x1e31d6}];_0x4b5793[_0x5025('0x5e')]({'model':db[_0x5025('0x67')],'as':_0x5025('0x68'),'attributes':['id','name']});_0x4b5793['push']({'model':db[_0x5025('0x5c')],'as':_0x5025('0x69'),'attributes':['id',_0x5025('0x5d')]});return db[_0x5025('0x22')][_0x5025('0x37')]({'where':{'id':_0x288d17[_0x5025('0x2d')]['id']},'include':_0x4b5793})[_0x5025('0x1b')](handleEntityNotFound(_0x1dc0f1,null))['then'](function(_0x235e2a){if(_0x235e2a){var _0x54e4c7=_0x235e2a[_0x5025('0x6a')]({'plain':!![]});fs[_0x5025('0x6b')](_0x4fffed);var _0x9678c8={'channel':_0x5025('0x6c'),'account':_0x54e4c7[_0x5025('0x68')][_0x5025('0x1f')],'agent':_0x54e4c7[_0x5025('0x69')]?_0x54e4c7[_0x5025('0x69')][_0x5025('0x5d')]:'N.A.','createdAt':moment(_0x54e4c7[_0x5025('0x65')])[_0x5025('0x5a')](_0x5025('0x6d'))[_0x5025('0x54')](),'closedAt':_0x54e4c7[_0x5025('0x6e')]?moment(_0x54e4c7[_0x5025('0x6f')])[_0x5025('0x5a')](_0x5025('0x6d'))['toString']():'','disposition':_0x54e4c7['disposition'],'visibility':_0x54e4c7[_0x5025('0x70')]?_0x5025('0x71'):'Private','messages':_(_0x54e4c7[_0x5025('0x64')])[_0x5025('0x72')]({'secret':![]})[_0x5025('0x48')](function(_0x3b6998){if(_0x3b6998[_0x5025('0x63')]){var _0x3d17a6=path[_0x5025('0x55')](_0x5e9e10,_0x3b6998[_0x5025('0x63')][_0x5025('0x73')]);if(fs['existsSync'](_0x3d17a6)){fs[_0x5025('0x74')](_0x3d17a6)[_0x5025('0x75')](fs[_0x5025('0x76')](path['join'](_0x4fffed,_0x3b6998[_0x5025('0x63')][_0x5025('0x73')])));}}return{'date':moment(_0x3b6998[_0x5025('0x65')])[_0x5025('0x5a')](_0x5025('0x6d'))[_0x5025('0x54')](),'sender':_0x3b6998[_0x5025('0x77')]===_0x5025('0x78')?_0x3b6998[_0x5025('0x5c')]?_0x3b6998[_0x5025('0x5c')][_0x5025('0x5d')]:_0x5025('0x79'):_0x3b6998[_0x5025('0x60')][_0x5025('0x7a')]+(_0x3b6998[_0x5025('0x60')][_0x5025('0x61')]?'\x20'+_0x3b6998['Contact'][_0x5025('0x61')]:''),'body':_0x3b6998[_0x5025('0x63')]?_0x3b6998[_0x5025('0x63')][_0x5025('0x73')]:_0x3b6998['body'],'direction':_0x3b6998['direction']==='out'?'A':'C','secret':_0x3b6998['secret'],'read':_0x3b6998[_0x5025('0x66')],'attachment':_0x3b6998[_0x5025('0x63')]};})['value']()};return ejs[_0x5025('0x7b')](path[_0x5025('0x55')](config[_0x5025('0x56')],'server',_0x5025('0x7c'),_0x5025('0x7d')),{'interaction':_0x9678c8})['then'](function(_0x6a9886){var _0x101c37=path[_0x5025('0x55')](_0x4fffed,_0x5025('0x7e')+_0x54e4c7['id']+'-'+_0x12fac7+'.pdf');var _0x15ba8c={'path':_0x101c37,'channel':_0x5025('0x6c'),'interactionId':_0x54e4c7['id']};return pdf['createPdfFromHTML'](_0x6a9886,_0x15ba8c);})[_0x5025('0x1b')](function(){return new Promise(function(_0x6f1625,_0x5d53c5){zipdir(_0x4fffed,{'saveTo':_0x4fbc7d},function(_0x201978,_0x4b26e5){if(_0x201978)return _0x5d53c5(_0x201978);return _0x6f1625(_0x4b26e5);});})[_0x5025('0x1b')](function(){return new Promise(function(_0x5179f8,_0x4d3019){rimraf(_0x4fffed,function(_0x6eab39){if(_0x6eab39)_0x4d3019(_0x6eab39);return _0x5179f8();});});})[_0x5025('0x1b')](function(){return _0x1dc0f1[_0x5025('0x52')](_0x4fbc7d,_0x4e65f0,function(_0x6ab8fb){if(_0x6ab8fb){logger[_0x5025('0x1d')](_0x5025('0x7f'),_0x6ab8fb);}else{fs[_0x5025('0x80')](_0x4fbc7d);}});});});}else{return _0x1dc0f1['sendStatus'](0xc8);}})[_0x5025('0x29')](handleError(_0x1dc0f1,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 66dbe7f..bfeb12c 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 _0x6492=['../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','save','update','remove','then','Users','map','findAll','unreadMessages','emit','catch','hook','events'];(function(_0x39c5c0,_0x357dae){var _0x2e4dd4=function(_0x4a473f){while(--_0x4a473f){_0x39c5c0['push'](_0x39c5c0['shift']());}};_0x2e4dd4(++_0x357dae);}(_0x6492,0x11f));var _0x2649=function(_0x5935c6,_0x1f7127){_0x5935c6=_0x5935c6-0x0;var _0x24d6bd=_0x6492[_0x5935c6];return _0x24d6bd;};'use strict';var EventEmitter=require(_0x2649('0x0'));var OpenchannelInteraction=require(_0x2649('0x1'))['db'][_0x2649('0x2')];var OpenchannelMessage=require(_0x2649('0x1'))['db'][_0x2649('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x2649('0x4')](0x0);var events={'afterCreate':_0x2649('0x5'),'afterUpdate':_0x2649('0x6'),'afterDestroy':_0x2649('0x7')};function emitEvent(_0x1951aa){return function(_0x5b8dc9,_0x424aea,_0x3659bf){_0x5b8dc9['getUsers']({'attributes':['id'],'raw':!![]})[_0x2649('0x8')](function(_0x3112ba){_0x5b8dc9['setDataValue'](_0x2649('0x9'),_0x3112ba[_0x2649('0xa')](function(_0x5b49f8){return{'id':_0x5b49f8['id']};}));return OpenchannelMessage[_0x2649('0xb')]({'where':{'OpenchannelInteractionId':_0x5b8dc9['id'],'direction':'in','read':![]},'raw':!![]});})[_0x2649('0x8')](function(_0x43e9f3){_0x5b8dc9['setDataValue'](_0x2649('0xc'),_0x43e9f3['length']);OpenchannelInteractionEvents[_0x2649('0xd')](_0x1951aa+':'+_0x5b8dc9['id'],_0x5b8dc9);OpenchannelInteractionEvents['emit'](_0x1951aa,_0x5b8dc9);_0x3659bf(null);})[_0x2649('0xe')](_0x3659bf(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction[_0x2649('0xf')](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file +var _0xb5be=['catch','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update','remove','getUsers','then','Users','findAll','setDataValue','unreadMessages','length','emit'];(function(_0x35fabd,_0x825452){var _0x61a8ee=function(_0x218f4c){while(--_0x218f4c){_0x35fabd['push'](_0x35fabd['shift']());}};_0x61a8ee(++_0x825452);}(_0xb5be,0x76));var _0xeb5b=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0xb5be[_0x4d613c];return _0x301fe3;};'use strict';var EventEmitter=require(_0xeb5b('0x0'));var OpenchannelInteraction=require(_0xeb5b('0x1'))['db']['OpenchannelInteraction'];var OpenchannelMessage=require(_0xeb5b('0x1'))['db'][_0xeb5b('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xeb5b('0x3')](0x0);var events={'afterCreate':_0xeb5b('0x4'),'afterUpdate':_0xeb5b('0x5'),'afterDestroy':_0xeb5b('0x6')};function emitEvent(_0x17a4dd){return function(_0x13bd80,_0x4c4346,_0x48b7b2){_0x13bd80[_0xeb5b('0x7')]({'attributes':['id'],'raw':!![]})[_0xeb5b('0x8')](function(_0x4380de){_0x13bd80['setDataValue'](_0xeb5b('0x9'),_0x4380de['map'](function(_0x46d1b6){return{'id':_0x46d1b6['id']};}));return OpenchannelMessage[_0xeb5b('0xa')]({'where':{'OpenchannelInteractionId':_0x13bd80['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x511bb5){_0x13bd80[_0xeb5b('0xb')](_0xeb5b('0xc'),_0x511bb5[_0xeb5b('0xd')]);OpenchannelInteractionEvents[_0xeb5b('0xe')](_0x17a4dd+':'+_0x13bd80['id'],_0x13bd80);OpenchannelInteractionEvents[_0xeb5b('0xe')](_0x17a4dd,_0x13bd80);_0x48b7b2(null);})[_0xeb5b('0xf')](_0x48b7b2(null));};}for(var e in events){if(events[_0xeb5b('0x10')](e)){var event=events[e];OpenchannelInteraction[_0xeb5b('0x11')](e,emitEvent(event));}}module[_0xeb5b('0x12')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 1e1dca1..dd384d6 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 _0x5f27=['define','OpenchannelInteraction','openchannel_interactions','utf8mb4','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','moment','bluebird','path','rimraf','../../config/environment','./openchannelInteraction.attributes','exports'];(function(_0x5bbb96,_0x10071d){var _0x18d362=function(_0x41af9a){while(--_0x41af9a){_0x5bbb96['push'](_0x5bbb96['shift']());}};_0x18d362(++_0x10071d);}(_0x5f27,0xd8));var _0x75f2=function(_0x260f5b,_0x43929d){_0x260f5b=_0x260f5b-0x0;var _0x301ab1=_0x5f27[_0x260f5b];return _0x301ab1;};'use strict';var _=require(_0x75f2('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x75f2('0x1'));var BPromise=require(_0x75f2('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x75f2('0x3'));var rimraf=require(_0x75f2('0x4'));var config=require(_0x75f2('0x5'));var attributes=require(_0x75f2('0x6'));module[_0x75f2('0x7')]=function(_0x1490d7,_0x1295e8){return _0x1490d7[_0x75f2('0x8')](_0x75f2('0x9'),attributes,{'tableName':_0x75f2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x75f2('0xb'),'collate':'utf8mb4_unicode_ci','hooks':{'beforeUpdate':function(_0x2bdee9,_0x4d8b2c,_0x21a663){if(_0x2bdee9['changed']('closed')){_0x2bdee9[_0x75f2('0xc')]=moment()['format'](_0x75f2('0xd'));}_0x21a663(null,_0x2bdee9);}}});}; \ No newline at end of file +var _0xb666=['request-promise','rimraf','../../config/environment','./openchannelInteraction.attributes','OpenchannelInteraction','openchannel_interactions','changed','closed','format','lodash','util'];(function(_0x112694,_0x49b537){var _0x3508af=function(_0x22b2b7){while(--_0x22b2b7){_0x112694['push'](_0x112694['shift']());}};_0x3508af(++_0x49b537);}(_0xb666,0x77));var _0x6b66=function(_0x31a16a,_0x1d60e3){_0x31a16a=_0x31a16a-0x0;var _0x21c892=_0xb666[_0x31a16a];return _0x21c892;};'use strict';var _=require(_0x6b66('0x0'));var util=require(_0x6b66('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6b66('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6b66('0x3'));var config=require(_0x6b66('0x4'));var attributes=require(_0x6b66('0x5'));module['exports']=function(_0x350d08,_0x5b28cf){return _0x350d08['define'](_0x6b66('0x6'),attributes,{'tableName':_0x6b66('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci','hooks':{'beforeUpdate':function(_0x26e3d3,_0x144fc4,_0x21dee8){if(_0x26e3d3[_0x6b66('0x8')](_0x6b66('0x9'))){_0x26e3d3['closedAt']=moment()[_0x6b66('0xa')]('YYYY-MM-DD\x20HH:mm:ss');}_0x21dee8(null,_0x26e3d3);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index e4679cd..1752f8c 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 _0x026a=['request','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateOpenchannelInteraction','options','raw','where','attributes','limit','AddTagsToOpenchannelInteraction','OpenchannelInteraction','find','ids','body','spread','AddTags','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','jayson/promise','client','redis','socket.io-emitter','register'];(function(_0x228111,_0x5eae48){var _0x31034e=function(_0x556668){while(--_0x556668){_0x228111['push'](_0x228111['shift']());}};_0x31034e(++_0x5eae48);}(_0x026a,0x1d6));var _0xa026=function(_0x481f5b,_0x1067e4){_0x481f5b=_0x481f5b-0x0;var _0x3f0179=_0x026a[_0x481f5b];return _0x3f0179;};'use strict';var _=require(_0xa026('0x0'));var util=require('util');var moment=require(_0xa026('0x1'));var BPromise=require(_0xa026('0x2'));var rs=require(_0xa026('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa026('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa026('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xa026('0x6'));var client=jayson[_0xa026('0x7')]['http']({'port':0x232a});config[_0xa026('0x8')]=_['defaults'](config[_0xa026('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0xa026('0x9'))(new Redis(config[_0xa026('0x8')]));require('./openchannelInteraction.socket')[_0xa026('0xa')](socket);function respondWithRpcPromise(_0x547841,_0x5c23b7,_0x148997){return new BPromise(function(_0x514dd9,_0x2e116f){return client[_0xa026('0xb')](_0x547841,_0x148997)[_0xa026('0xc')](function(_0x86b7e){logger[_0xa026('0xd')](_0xa026('0xe'),_0x5c23b7,_0xa026('0xf'));logger[_0xa026('0x10')](_0xa026('0x11'),_0x5c23b7,_0xa026('0xf'),JSON[_0xa026('0x12')](_0x86b7e));if(_0x86b7e[_0xa026('0x13')]){if(_0x86b7e[_0xa026('0x13')][_0xa026('0x14')]===0x1f4){logger[_0xa026('0x13')](_0xa026('0xe'),_0x5c23b7,_0x86b7e[_0xa026('0x13')][_0xa026('0x15')]);return _0x2e116f(_0x86b7e[_0xa026('0x13')][_0xa026('0x15')]);}logger[_0xa026('0x13')](_0xa026('0xe'),_0x5c23b7,_0x86b7e[_0xa026('0x13')]['message']);return _0x514dd9(_0x86b7e[_0xa026('0x13')][_0xa026('0x15')]);}else{logger[_0xa026('0xd')](_0xa026('0xe'),_0x5c23b7,_0xa026('0xf'));_0x514dd9(_0x86b7e[_0xa026('0x16')][_0xa026('0x15')]);}})[_0xa026('0x17')](function(_0x4da156){logger['error']('OpenchannelInteraction,\x20%s,\x20%s',_0x5c23b7,_0x4da156);_0x2e116f(_0x4da156);});});}exports[_0xa026('0x18')]=function(_0x2e59b8){var _0x50f02c=this;return new Promise(function(_0xdc68a1,_0x3c58e5){return db['OpenchannelInteraction']['update'](_0x2e59b8['body'],{'raw':_0x2e59b8[_0xa026('0x19')]?_0x2e59b8[_0xa026('0x19')][_0xa026('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2e59b8[_0xa026('0x19')]?_0x2e59b8[_0xa026('0x19')][_0xa026('0x1b')]||null:null,'attributes':_0x2e59b8['options']?_0x2e59b8[_0xa026('0x19')][_0xa026('0x1c')]||null:null,'limit':_0x2e59b8[_0xa026('0x19')]?_0x2e59b8['options'][_0xa026('0x1d')]||null:null})[_0xa026('0xc')](function(_0xa86d4a){logger[_0xa026('0xd')]('UpdateOpenchannelInteraction',_0x2e59b8);logger[_0xa026('0x10')]('UpdateOpenchannelInteraction',_0x2e59b8,JSON[_0xa026('0x12')](_0xa86d4a));_0xdc68a1(_0xa86d4a);})[_0xa026('0x17')](function(_0x415695){logger['error'](_0xa026('0x18'),_0x415695['message'],_0x2e59b8);_0x3c58e5(_0x50f02c['error'](0x1f4,_0x415695[_0xa026('0x15')]));});});};exports[_0xa026('0x1e')]=function(_0x53e26f){return new Promise(function(_0x28de99,_0x277eb0){return db[_0xa026('0x1f')][_0xa026('0x20')]({'where':_0x53e26f[_0xa026('0x19')]?_0x53e26f[_0xa026('0x19')]['where']||null:null})[_0xa026('0xc')](function(_0x36e155){if(_0x36e155){return _0x36e155['addTags'](_0x53e26f['body'][_0xa026('0x21')],_['omit'](_0x53e26f[_0xa026('0x22')],[_0xa026('0x21'),'id'])||{});}})[_0xa026('0x23')](function(_0x2a685d){logger[_0xa026('0xd')](_0xa026('0x24'),_0x53e26f);logger[_0xa026('0x10')](_0xa026('0x24'),_0x53e26f,JSON[_0xa026('0x12')](_0x2a685d));_0x28de99(_0x2a685d);})['catch'](function(_0x53c9b8){logger[_0xa026('0x13')](_0xa026('0x24'),_0x53c9b8[_0xa026('0x15')],_0x53e26f);_0x277eb0(_this[_0xa026('0x13')](0x1f4,_0x53c9b8[_0xa026('0x15')]));});});}; \ No newline at end of file +var _0x99a8=['info','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','raw','options','attributes','limit','stringify','AddTagsToOpenchannelInteraction','find','where','addTags','omit','ids','spread','AddTags','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','then','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','error','code','OpenchannelInteraction,\x20%s,\x20%s','message'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x99a8,0x92));var _0x899a=function(_0x58c4db,_0x3fcd24){_0x58c4db=_0x58c4db-0x0;var _0x2770f5=_0x99a8[_0x58c4db];return _0x2770f5;};'use strict';var _=require('lodash');var util=require(_0x899a('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x899a('0x1'));var fs=require('fs');var Redis=require(_0x899a('0x2'));var db=require(_0x899a('0x3'))['db'];var utils=require(_0x899a('0x4'));var logger=require(_0x899a('0x5'))(_0x899a('0x6'));var config=require(_0x899a('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x899a('0x8')]({'port':0x232a});config[_0x899a('0x9')]=_['defaults'](config[_0x899a('0x9')],{'host':_0x899a('0xa'),'port':0x18eb});var socket=require(_0x899a('0xb'))(new Redis(config['redis']));require(_0x899a('0xc'))[_0x899a('0xd')](socket);function respondWithRpcPromise(_0x5916f4,_0x226bdf,_0x12db5a){return new BPromise(function(_0x54c8e0,_0x5d89f7){return client['request'](_0x5916f4,_0x12db5a)[_0x899a('0xe')](function(_0x2e6e57){logger['info']('OpenchannelInteraction,\x20%s,\x20%s',_0x226bdf,_0x899a('0xf'));logger[_0x899a('0x10')](_0x899a('0x11'),_0x226bdf,'request\x20sent',JSON['stringify'](_0x2e6e57));if(_0x2e6e57[_0x899a('0x12')]){if(_0x2e6e57[_0x899a('0x12')][_0x899a('0x13')]===0x1f4){logger['error'](_0x899a('0x14'),_0x226bdf,_0x2e6e57[_0x899a('0x12')]['message']);return _0x5d89f7(_0x2e6e57['error'][_0x899a('0x15')]);}logger['error'](_0x899a('0x14'),_0x226bdf,_0x2e6e57[_0x899a('0x12')]['message']);return _0x54c8e0(_0x2e6e57['error'][_0x899a('0x15')]);}else{logger[_0x899a('0x16')]('OpenchannelInteraction,\x20%s,\x20%s',_0x226bdf,_0x899a('0xf'));_0x54c8e0(_0x2e6e57[_0x899a('0x17')][_0x899a('0x15')]);}})[_0x899a('0x18')](function(_0xcdc36d){logger['error'](_0x899a('0x14'),_0x226bdf,_0xcdc36d);_0x5d89f7(_0xcdc36d);});});}exports[_0x899a('0x19')]=function(_0x33469d){var _0x4422c5=this;return new Promise(function(_0x3a2e6f,_0x1ebd3e){return db[_0x899a('0x1a')][_0x899a('0x1b')](_0x33469d[_0x899a('0x1c')],{'raw':_0x33469d['options']?_0x33469d['options'][_0x899a('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x33469d[_0x899a('0x1e')]?_0x33469d[_0x899a('0x1e')]['where']||null:null,'attributes':_0x33469d[_0x899a('0x1e')]?_0x33469d[_0x899a('0x1e')][_0x899a('0x1f')]||null:null,'limit':_0x33469d[_0x899a('0x1e')]?_0x33469d[_0x899a('0x1e')][_0x899a('0x20')]||null:null})[_0x899a('0xe')](function(_0x478d33){logger[_0x899a('0x16')](_0x899a('0x19'),_0x33469d);logger[_0x899a('0x10')](_0x899a('0x19'),_0x33469d,JSON[_0x899a('0x21')](_0x478d33));_0x3a2e6f(_0x478d33);})['catch'](function(_0x29e0e5){logger['error'](_0x899a('0x19'),_0x29e0e5[_0x899a('0x15')],_0x33469d);_0x1ebd3e(_0x4422c5['error'](0x1f4,_0x29e0e5[_0x899a('0x15')]));});});};exports[_0x899a('0x22')]=function(_0x25ecda){return new Promise(function(_0x2aa461,_0x23abc4){return db['OpenchannelInteraction'][_0x899a('0x23')]({'where':_0x25ecda['options']?_0x25ecda[_0x899a('0x1e')][_0x899a('0x24')]||null:null})[_0x899a('0xe')](function(_0x146243){if(_0x146243){return _0x146243[_0x899a('0x25')](_0x25ecda[_0x899a('0x1c')]['ids'],_[_0x899a('0x26')](_0x25ecda[_0x899a('0x1c')],[_0x899a('0x27'),'id'])||{});}})[_0x899a('0x28')](function(_0x40dd91){logger['info'](_0x899a('0x29'),_0x25ecda);logger[_0x899a('0x10')](_0x899a('0x29'),_0x25ecda,JSON[_0x899a('0x21')](_0x40dd91));_0x2aa461(_0x40dd91);})[_0x899a('0x18')](function(_0x4f29b3){logger['error'](_0x899a('0x29'),_0x4f29b3[_0x899a('0x15')],_0x25ecda);_0x23abc4(_this[_0x899a('0x12')](0x1f4,_0x4f29b3[_0x899a('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 1289ca3..021f416 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 _0x32e5=['emit','removeListener','register','length','openchannelInteraction:','save','remove','update'];(function(_0x15cbce,_0xda8402){var _0x257f29=function(_0x388132){while(--_0x388132){_0x15cbce['push'](_0x15cbce['shift']());}};_0x257f29(++_0xda8402);}(_0x32e5,0xbd));var _0x532e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x32e5[_0xbca1b1];return _0x4e1686;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=[_0x532e('0x0'),_0x532e('0x1'),_0x532e('0x2')];function createListener(_0x6d9d48,_0x410ee0){return function(_0x20ceea){_0x410ee0[_0x532e('0x3')](_0x6d9d48,_0x20ceea);};}function removeListener(_0x42f77d,_0x243072){return function(){OpenchannelInteractionEvents[_0x532e('0x4')](_0x42f77d,_0x243072);};}exports[_0x532e('0x5')]=function(_0x315d2d){for(var _0x40d603=0x0,_0x5b7312=events[_0x532e('0x6')];_0x40d603<_0x5b7312;_0x40d603++){var _0x53096f=events[_0x40d603];var _0x86c243=createListener(_0x532e('0x7')+_0x53096f,_0x315d2d);OpenchannelInteractionEvents['on'](_0x53096f,_0x86c243);}}; \ No newline at end of file +var _0xa98e=['save','remove','update','emit','removeListener'];(function(_0x1161da,_0xfaf583){var _0x5bcc5e=function(_0x18f31c){while(--_0x18f31c){_0x1161da['push'](_0x1161da['shift']());}};_0x5bcc5e(++_0xfaf583);}(_0xa98e,0xf5));var _0xea98=function(_0x322f01,_0x28aebf){_0x322f01=_0x322f01-0x0;var _0x2e503e=_0xa98e[_0x322f01];return _0x2e503e;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=[_0xea98('0x0'),_0xea98('0x1'),_0xea98('0x2')];function createListener(_0x516f66,_0x4b7811){return function(_0x5760f1){_0x4b7811[_0xea98('0x3')](_0x516f66,_0x5760f1);};}function removeListener(_0x51e2a8,_0x6d0c14){return function(){OpenchannelInteractionEvents[_0xea98('0x4')](_0x51e2a8,_0x6d0c14);};}exports['register']=function(_0x1f2373){for(var _0xdc7330=0x0,_0x4d5a90=events['length'];_0xdc7330<_0x4d5a90;_0xdc7330++){var _0x122247=events[_0xdc7330];var _0x39f06c=createListener('openchannelInteraction:'+_0x122247,_0x1f2373);OpenchannelInteractionEvents['on'](_0x122247,_0x39f06c);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index ae34c50..569c8c3 100644 --- a/server/api/openchannelMessage/index.js +++ b/server/api/openchannelMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','tracked','openchannel','openchannelmessage:create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','util'];(function(_0xeeca45,_0x5ce4af){var _0x366bcb=function(_0x411cd5){while(--_0x411cd5){_0xeeca45['push'](_0xeeca45['shift']());}};_0x366bcb(++_0x5ce4af);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./openchannelMessage.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),interaction[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x0d8b('0x10')),controller['create']);router[_0x0d8b('0x11')]('/:id',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x12')]);router[_0x0d8b('0x11')](_0x0d8b('0x13'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x14')]);router[_0x0d8b('0x11')](_0x0d8b('0x15'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x16')]);router[_0x0d8b('0x17')](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x18')]);module['exports']=router; \ No newline at end of file +var _0x70e0=['put','update','/:id/accept','accept','destroy','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','isAuthenticated','describe','get','/:id','show','post','openchannel','openchannelmessage:create','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x70e0,0x17b));var _0x070e=function(_0x19cee2,_0x3238e2){_0x19cee2=_0x19cee2-0x0;var _0x2a70ee=_0x70e0[_0x19cee2];return _0x2a70ee;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');var controller=require(_0x070e('0x7'));router['get']('/',auth[_0x070e('0x8')](),controller['index']);router['get']('/describe',auth[_0x070e('0x8')](),controller[_0x070e('0x9')]);router[_0x070e('0xa')](_0x070e('0xb'),auth[_0x070e('0x8')](),controller[_0x070e('0xc')]);router[_0x070e('0xd')]('/',auth['isAuthenticated'](),interaction['tracked'](_0x070e('0xe'),_0x070e('0xf')),controller[_0x070e('0x10')]);router[_0x070e('0x11')](_0x070e('0xb'),auth[_0x070e('0x8')](),controller[_0x070e('0x12')]);router[_0x070e('0x11')](_0x070e('0x13'),auth[_0x070e('0x8')](),controller[_0x070e('0x14')]);router['put']('/:id/reject',auth[_0x070e('0x8')](),controller['reject']);router['delete']('/:id',auth[_0x070e('0x8')](),controller[_0x070e('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 5f3fcfc..c00eb26 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 _0x3cae=['exports','TEXT','medium','BOOLEAN','ENUM','out','DATE','sequelize'];(function(_0x1fa759,_0x4ecdce){var _0x2da9f4=function(_0x463e2a){while(--_0x463e2a){_0x1fa759['push'](_0x1fa759['shift']());}};_0x2da9f4(++_0x4ecdce);}(_0x3cae,0x117));var _0xe3ca=function(_0x5c2a2b,_0x22c94e){_0x5c2a2b=_0x5c2a2b-0x0;var _0x19921f=_0x3cae[_0x5c2a2b];return _0x19921f;};'use strict';var Sequelize=require(_0xe3ca('0x0'));module[_0xe3ca('0x1')]={'body':{'type':Sequelize[_0xe3ca('0x2')](_0xe3ca('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xe3ca('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0xe3ca('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xe3ca('0x5')]('in','out'),'defaultValue':_0xe3ca('0x6'),'allowNull':![]},'readAt':{'type':Sequelize[_0xe3ca('0x7')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xe3ca('0x2')]}}; \ No newline at end of file +var _0x0447=['ENUM','out','DATE','STRING','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x272202,_0x569e70){var _0xcad2a7=function(_0x3b39b2){while(--_0x3b39b2){_0x272202['push'](_0x272202['shift']());}};_0xcad2a7(++_0x569e70);}(_0x0447,0x8b));var _0x7044=function(_0x10a546,_0x5ea132){_0x10a546=_0x10a546-0x0;var _0x30e897=_0x0447[_0x10a546];return _0x30e897;};'use strict';var Sequelize=require(_0x7044('0x0'));module[_0x7044('0x1')]={'body':{'type':Sequelize[_0x7044('0x2')](_0x7044('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x7044('0x4')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x7044('0x5')]('in',_0x7044('0x6')),'defaultValue':_0x7044('0x6'),'allowNull':![]},'readAt':{'type':Sequelize[_0x7044('0x7')]},'providerName':{'type':Sequelize[_0x7044('0x8')]},'providerResponse':{'type':Sequelize[_0x7044('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 7f0e20a..ec4329c 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 _0xf43f=['client','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','json','offset','undefined','limit','count','status','set','Content-Range','update','destroy','end','sendStatus','stack','name','map','rawAttributes','fieldName','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','merge','where','OpenchannelMessage','findAll','rows','params','keys','includeAll','include','options','find','create','body','describe','acceptMessage','reject','openchannel','UserId','user','agent','OpenchannelInteraction','OpenchannelInteractionId','interaction','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','RejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','SELECT','contact','User','fullname','email','internal','interface','format','SIP/%s','channel','motionChannel','event','EventManager','util','ioredis','../../components/interaction/service','../../config/logger','../../config/environment','defaults','redis','localhost','socket.io-emitter','register','http'];(function(_0x515dcc,_0x1e7059){var _0x2993bf=function(_0x530a73){while(--_0x530a73){_0x515dcc['push'](_0x515dcc['shift']());}};_0x2993bf(++_0x1e7059);}(_0xf43f,0x1d0));var _0xff43=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf43f[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0xff43('0x0'));var _=require('lodash');var Redis=require(_0xff43('0x1'));var interactionService=require(_0xff43('0x2'));var qs=require('../../components/parsers/qs');var logger=require(_0xff43('0x3'))('api');var config=require(_0xff43('0x4'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xff43('0x5')](config[_0xff43('0x6')],{'host':_0xff43('0x7'),'port':0x18eb});var socket=require(_0xff43('0x8'))(new Redis(config['redis']));require('./openchannelMessage.socket')[_0xff43('0x9')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xff43('0xa')]({'port':0x232c});var client9002=jayson[_0xff43('0xb')][_0xff43('0xa')]({'port':0x232a});var interaction_log=require(_0xff43('0x3'))('openchannel-interactions');function respondWithRpcPromise(_0x52bd4b,_0x53f4bd,_0x21be63,_0x5d8960){return new Promise(function(_0x13f290,_0xc87b50){var _0x110a4a=_0x5d8960||client;return _0x110a4a[_0xff43('0xc')](_0x52bd4b,_0x21be63)[_0xff43('0xd')](function(_0x836717){logger[_0xff43('0xe')](_0xff43('0xf'),_0x53f4bd,_0xff43('0x10'));logger['debug']('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x53f4bd,_0xff43('0x10'),JSON[_0xff43('0x11')](_0x836717));if(_0x836717[_0xff43('0x12')]){if(_0x836717[_0xff43('0x12')]['code']===0x1f4){logger[_0xff43('0x12')](_0xff43('0xf'),_0x53f4bd,_0x836717[_0xff43('0x12')][_0xff43('0x13')]);return _0xc87b50(_0x836717[_0xff43('0x12')][_0xff43('0x13')]);}logger['error'](_0xff43('0xf'),_0x53f4bd,_0x836717[_0xff43('0x12')][_0xff43('0x13')]);return _0x13f290(_0x836717[_0xff43('0x12')]['message']);}else{logger[_0xff43('0xe')]('OpenchannelMessage,\x20%s,\x20%s',_0x53f4bd,_0xff43('0x10'));_0x13f290(_0x836717[_0xff43('0x14')][_0xff43('0x13')]);}})[_0xff43('0x15')](function(_0x171fc9){logger['error'](_0xff43('0xf'),_0x53f4bd,_0x171fc9);_0xc87b50(_0x171fc9);});});}function respondWithResult(_0x5eb4f7,_0x29c1b5){_0x29c1b5=_0x29c1b5||0xc8;return function(_0x291013){if(_0x291013){return _0x5eb4f7['status'](_0x29c1b5)[_0xff43('0x16')](_0x291013);}};}function respondWithFilteredResult(_0x5c6c1a,_0x4ae9f2){return function(_0x20c8bb){if(_0x20c8bb){var _0x12512a=typeof _0x4ae9f2[_0xff43('0x17')]===_0xff43('0x18')&&typeof _0x4ae9f2[_0xff43('0x19')]===_0xff43('0x18');var _0xcaa824=_0x20c8bb[_0xff43('0x1a')];var _0x51727b=_0x12512a?0x0:_0x4ae9f2[_0xff43('0x17')];var _0x2afb7b=_0x12512a?_0x20c8bb[_0xff43('0x1a')]:_0x4ae9f2[_0xff43('0x17')]+_0x4ae9f2[_0xff43('0x19')];var _0x26ad75;if(_0x2afb7b>=_0xcaa824){_0x2afb7b=_0xcaa824;_0x26ad75=0xc8;}else{_0x26ad75=0xce;}_0x5c6c1a[_0xff43('0x1b')](_0x26ad75);return _0x5c6c1a[_0xff43('0x1c')](_0xff43('0x1d'),_0x51727b+'-'+_0x2afb7b+'/'+_0xcaa824)[_0xff43('0x16')](_0x20c8bb);}return null;};}function saveUpdates(_0x4b8254){return function(_0x532654){if(_0x532654){return _0x532654[_0xff43('0x1e')](_0x4b8254)[_0xff43('0xd')](function(_0x2ca5cb){return _0x2ca5cb;});}return null;};}function removeEntity(_0x437cc7){return function(_0x19ab9c){if(_0x19ab9c){return _0x19ab9c[_0xff43('0x1f')]()['then'](function(){_0x437cc7[_0xff43('0x1b')](0xcc)[_0xff43('0x20')]();});}};}function handleEntityNotFound(_0x553f2c){return function(_0x2e8386){if(!_0x2e8386){_0x553f2c[_0xff43('0x21')](0x194);}return _0x2e8386;};}function handleError(_0xafeadf,_0x3be2e4){_0x3be2e4=_0x3be2e4||0x1f4;return function(_0x215027){logger[_0xff43('0x12')](_0x215027[_0xff43('0x22')]);if(_0x215027[_0xff43('0x23')]){delete _0x215027[_0xff43('0x23')];}_0xafeadf[_0xff43('0x1b')](_0x3be2e4)['send'](_0x215027);};}exports['index']=function(_0x18d9b4,_0x54369f){var _0x5633fa={},_0x286fff={},_0x31ee35={'count':0x0,'rows':[]};var _0x25f9d4=_[_0xff43('0x24')](db['OpenchannelMessage'][_0xff43('0x25')],function(_0x248b07){return{'name':_0x248b07[_0xff43('0x26')],'type':_0x248b07['type'][_0xff43('0x27')]};});_0x286fff[_0xff43('0x28')]=_[_0xff43('0x24')](_0x25f9d4,_0xff43('0x23'));_0x286fff[_0xff43('0x29')]=_['keys'](_0x18d9b4[_0xff43('0x29')]);_0x286fff['filters']=_[_0xff43('0x2a')](_0x286fff['model'],_0x286fff[_0xff43('0x29')]);_0x5633fa[_0xff43('0x2b')]=_[_0xff43('0x2a')](_0x286fff[_0xff43('0x28')],qs[_0xff43('0x2c')](_0x18d9b4[_0xff43('0x29')][_0xff43('0x2c')]));_0x5633fa[_0xff43('0x2b')]=_0x5633fa[_0xff43('0x2b')][_0xff43('0x2d')]?_0x5633fa[_0xff43('0x2b')]:_0x286fff['model'];if(!_0x18d9b4['query'][_0xff43('0x2e')](_0xff43('0x2f'))){_0x5633fa[_0xff43('0x19')]=qs[_0xff43('0x19')](_0x18d9b4['query'][_0xff43('0x19')]);_0x5633fa[_0xff43('0x17')]=qs['offset'](_0x18d9b4[_0xff43('0x29')][_0xff43('0x17')]);}_0x5633fa[_0xff43('0x30')]=qs[_0xff43('0x31')](_0x18d9b4['query']['sort']);_0x5633fa['where']=qs[_0xff43('0x32')](_[_0xff43('0x33')](_0x18d9b4[_0xff43('0x29')],_0x286fff[_0xff43('0x32')]),_0x25f9d4);if(_0x18d9b4[_0xff43('0x29')][_0xff43('0x34')]){_0x5633fa['where']=_[_0xff43('0x35')](_0x5633fa[_0xff43('0x36')],{'$or':_[_0xff43('0x24')](_0x25f9d4,function(_0x36ffb8){if(_0x36ffb8['type']!=='VIRTUAL'){var _0x420e25={};_0x420e25[_0x36ffb8[_0xff43('0x23')]]={'$like':'%'+_0x18d9b4[_0xff43('0x29')]['filter']+'%'};return _0x420e25;}})});}_0x5633fa=_[_0xff43('0x35')]({},_0x5633fa,_0x18d9b4['options']);var _0x1c45a5={'where':_0x5633fa[_0xff43('0x36')]};return db[_0xff43('0x37')][_0xff43('0x1a')](_0x1c45a5)[_0xff43('0xd')](function(_0x3924be){_0x31ee35[_0xff43('0x1a')]=_0x3924be;if(_0x18d9b4['query']['includeAll']){_0x5633fa['include']=[{'all':!![]}];}return db[_0xff43('0x37')][_0xff43('0x38')](_0x5633fa);})[_0xff43('0xd')](function(_0x4d752b){_0x31ee35[_0xff43('0x39')]=_0x4d752b;return _0x31ee35;})['then'](respondWithFilteredResult(_0x54369f,_0x5633fa))['catch'](handleError(_0x54369f,null));};exports['show']=function(_0x336825,_0x3d1a76){var _0x5dfcfb={'raw':!![],'where':{'id':_0x336825[_0xff43('0x3a')]['id']}},_0x25b4d4={};_0x25b4d4[_0xff43('0x28')]=_[_0xff43('0x3b')](db[_0xff43('0x37')][_0xff43('0x25')]);_0x25b4d4[_0xff43('0x29')]=_[_0xff43('0x3b')](_0x336825[_0xff43('0x29')]);_0x25b4d4[_0xff43('0x32')]=_[_0xff43('0x2a')](_0x25b4d4['model'],_0x25b4d4[_0xff43('0x29')]);_0x5dfcfb[_0xff43('0x2b')]=_['intersection'](_0x25b4d4[_0xff43('0x28')],qs['fields'](_0x336825[_0xff43('0x29')][_0xff43('0x2c')]));_0x5dfcfb[_0xff43('0x2b')]=_0x5dfcfb[_0xff43('0x2b')]['length']?_0x5dfcfb[_0xff43('0x2b')]:_0x25b4d4['model'];if(_0x336825[_0xff43('0x29')][_0xff43('0x3c')]){_0x5dfcfb[_0xff43('0x3d')]=[{'all':!![]}];}_0x5dfcfb=_[_0xff43('0x35')]({},_0x5dfcfb,_0x336825[_0xff43('0x3e')]);return db[_0xff43('0x37')][_0xff43('0x3f')](_0x5dfcfb)[_0xff43('0xd')](handleEntityNotFound(_0x3d1a76,null))[_0xff43('0xd')](respondWithResult(_0x3d1a76,null))[_0xff43('0x15')](handleError(_0x3d1a76,null));};exports[_0xff43('0x40')]=function(_0x1b354e,_0x223646){return db[_0xff43('0x37')]['create'](_0x1b354e['body'],{})[_0xff43('0xd')](respondWithResult(_0x223646,0xc9))[_0xff43('0x15')](handleError(_0x223646,null));};exports[_0xff43('0x1e')]=function(_0x13a3eb,_0x139d9a){if(_0x13a3eb[_0xff43('0x41')]['id']){delete _0x13a3eb[_0xff43('0x41')]['id'];}return db[_0xff43('0x37')][_0xff43('0x3f')]({'where':{'id':_0x13a3eb[_0xff43('0x3a')]['id']}})['then'](handleEntityNotFound(_0x139d9a,null))[_0xff43('0xd')](saveUpdates(_0x13a3eb[_0xff43('0x41')],null))['then'](respondWithResult(_0x139d9a,null))[_0xff43('0x15')](handleError(_0x139d9a,null));};exports[_0xff43('0x1f')]=function(_0x75ae5f,_0x5bf5b1){return db[_0xff43('0x37')]['find']({'where':{'id':_0x75ae5f[_0xff43('0x3a')]['id']}})[_0xff43('0xd')](handleEntityNotFound(_0x5bf5b1,null))[_0xff43('0xd')](removeEntity(_0x5bf5b1,null))[_0xff43('0x15')](handleError(_0x5bf5b1,null));};exports['describe']=function(_0x163823,_0x32793a){return db[_0xff43('0x37')][_0xff43('0x42')]()[_0xff43('0xd')](respondWithResult(_0x32793a,null))[_0xff43('0x15')](handleError(_0x32793a,null));};exports['accept']=function(_0x244ba7,_0x2a7a38){var _0x2c2402='openchannel';return interactionService[_0xff43('0x43')](_0x244ba7,_0x2c2402)[_0xff43('0xd')](respondWithResult(_0x2a7a38,null))[_0xff43('0x15')](handleError(_0x2a7a38,null));};exports[_0xff43('0x44')]=function(_0x2fd47d,_0xb7eb87){var _0x35db45={'agent':{},'channel':_0xff43('0x45')};if(_0x2fd47d[_0xff43('0x41')]['id']){delete _0x2fd47d[_0xff43('0x41')]['id'];}_0x2fd47d['body'][_0xff43('0x46')]=_0x2fd47d[_0xff43('0x41')][_0xff43('0x46')]||_0x2fd47d[_0xff43('0x47')]['id'];_0x35db45[_0xff43('0x48')]['id']=_0x2fd47d['body'][_0xff43('0x46')];return db['OpenchannelMessage'][_0xff43('0x3f')]({'where':{'id':_0x2fd47d[_0xff43('0x3a')]['id'],'UserId':null}})[_0xff43('0xd')](handleEntityNotFound(_0xb7eb87,null))[_0xff43('0xd')](function(_0x13befb){if(_0x13befb){_0x35db45[_0xff43('0x13')]=_0x13befb['get']({'plain':!![]});return db[_0xff43('0x49')][_0xff43('0x3f')]({'where':{'id':_0x13befb[_0xff43('0x4a')]}});}return null;})['then'](handleEntityNotFound(_0xb7eb87,null))['then'](function(_0x53bda1){if(_0x53bda1){_0x35db45[_0xff43('0x4b')]=_0x53bda1['get']({'plain':!![]});interaction_log[_0xff43('0xe')](_0xff43('0x4c'),_0x2fd47d[_0xff43('0x47')]['id'],_0x2fd47d[_0xff43('0x47')][_0xff43('0x23')],_0x2fd47d[_0xff43('0x47')][_0xff43('0x4d')],_0x35db45['interaction']['id'],_0x2fd47d['body']?JSON['stringify'](_0x2fd47d[_0xff43('0x41')]):_0xff43('0x4e'));return respondWithRpcPromise(_0xff43('0x4f'),'rejectMessage',_0x35db45);}return null;})[_0xff43('0xd')](function(_0x3d5f61){var _0x4ae617=_0xff43('0x50')+_0x3d5f61[_0xff43('0x13')]['ContactId'];return db[_0xff43('0x51')][_0xff43('0x29')](_0x4ae617,{'type':db['Sequelize']['QueryTypes'][_0xff43('0x52')],'raw':!![]})['then'](function(_0x4a70e6){return _0x4a70e6;});})[_0xff43('0xd')](function(_0x11e9a5){if(_0x11e9a5){_0x35db45[_0xff43('0x13')][_0xff43('0x53')]=_0x11e9a5[0x0];if(!_0x2fd47d[_0xff43('0x41')][_0xff43('0x46')])return;return db[_0xff43('0x54')][_0xff43('0x3f')]({'where':{'id':_0x2fd47d['body'][_0xff43('0x46')],'role':_0xff43('0x48')},'attributes':['id',_0xff43('0x23'),_0xff43('0x55'),_0xff43('0x56'),_0xff43('0x57')],'raw':!![]});}return null;})[_0xff43('0xd')](function(_0x5b39cd){if(!_0x5b39cd)return null;_0x35db45[_0xff43('0x13')][_0xff43('0x48')]=_0x5b39cd;return _0x35db45;})['then'](function(_0x1fe60f){if(_0x1fe60f){_0x1fe60f['message'][_0xff43('0x58')]=util[_0xff43('0x59')](_0xff43('0x5a'),_0x2fd47d[_0xff43('0x47')]['name']);_0x1fe60f['message'][_0xff43('0x5b')]=_0x35db45['channel'];_0x1fe60f['message'][_0xff43('0x5c')]=_0x35db45[_0xff43('0x5b')];_0x1fe60f[_0xff43('0x13')][_0xff43('0x5d')]=_0xff43('0x44');respondWithRpcPromise(_0xff43('0x5e'),_0xff43('0x5e'),{'event':'rejectmessage','message':_0x1fe60f[_0xff43('0x13')]},client9002);return _0x35db45;}return null;})[_0xff43('0xd')](respondWithResult(_0xb7eb87,null))[_0xff43('0x15')](handleError(_0xb7eb87,null));}; \ No newline at end of file +var _0x8f74=['EventManager','rejectmessage','util','lodash','ioredis','../../components/parsers/qs','../../config/environment','redis','defaults','socket.io-emitter','register','jayson/promise','client','http','../../config/logger','openchannel-interactions','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','status','json','offset','limit','undefined','count','set','Content-Range','destroy','end','sendStatus','stack','name','index','map','OpenchannelMessage','fieldName','type','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes','find','create','update','body','accept','openchannel','UserId','user','agent','OpenchannelInteractionId','interaction','get','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','contact','User','email','internal','interface','format','SIP/%s','channel','motionChannel','event'];(function(_0x40ad17,_0xe922b4){var _0x3b03ed=function(_0x39f13a){while(--_0x39f13a){_0x40ad17['push'](_0x40ad17['shift']());}};_0x3b03ed(++_0xe922b4);}(_0x8f74,0x196));var _0x48f7=function(_0x1e6db1,_0xb90700){_0x1e6db1=_0x1e6db1-0x0;var _0x55e924=_0x8f74[_0x1e6db1];return _0x55e924;};'use strict';var util=require(_0x48f7('0x0'));var _=require(_0x48f7('0x1'));var Redis=require(_0x48f7('0x2'));var interactionService=require('../../components/interaction/service');var qs=require(_0x48f7('0x3'));var logger=require('../../config/logger')('api');var config=require(_0x48f7('0x4'));var db=require('../../mysqldb')['db'];config[_0x48f7('0x5')]=_[_0x48f7('0x6')](config[_0x48f7('0x5')],{'host':'localhost','port':0x18eb});var socket=require(_0x48f7('0x7'))(new Redis(config[_0x48f7('0x5')]));require('./openchannelMessage.socket')[_0x48f7('0x8')](socket);var jayson=require(_0x48f7('0x9'));var client=jayson[_0x48f7('0xa')][_0x48f7('0xb')]({'port':0x232c});var client9002=jayson[_0x48f7('0xa')][_0x48f7('0xb')]({'port':0x232a});var interaction_log=require(_0x48f7('0xc'))(_0x48f7('0xd'));function respondWithRpcPromise(_0xc44576,_0x1489a8,_0x5b5891,_0x41e8ea){return new Promise(function(_0x507b1a,_0x39399a){var _0x3bb040=_0x41e8ea||client;return _0x3bb040['request'](_0xc44576,_0x5b5891)[_0x48f7('0xe')](function(_0x205ac3){logger['info'](_0x48f7('0xf'),_0x1489a8,_0x48f7('0x10'));logger[_0x48f7('0x11')](_0x48f7('0x12'),_0x1489a8,'request\x20sent',JSON[_0x48f7('0x13')](_0x205ac3));if(_0x205ac3[_0x48f7('0x14')]){if(_0x205ac3[_0x48f7('0x14')]['code']===0x1f4){logger[_0x48f7('0x14')]('OpenchannelMessage,\x20%s,\x20%s',_0x1489a8,_0x205ac3[_0x48f7('0x14')][_0x48f7('0x15')]);return _0x39399a(_0x205ac3['error'][_0x48f7('0x15')]);}logger['error'](_0x48f7('0xf'),_0x1489a8,_0x205ac3['error'][_0x48f7('0x15')]);return _0x507b1a(_0x205ac3[_0x48f7('0x14')][_0x48f7('0x15')]);}else{logger[_0x48f7('0x16')]('OpenchannelMessage,\x20%s,\x20%s',_0x1489a8,_0x48f7('0x10'));_0x507b1a(_0x205ac3[_0x48f7('0x17')][_0x48f7('0x15')]);}})[_0x48f7('0x18')](function(_0x8fcfcf){logger[_0x48f7('0x14')](_0x48f7('0xf'),_0x1489a8,_0x8fcfcf);_0x39399a(_0x8fcfcf);});});}function respondWithResult(_0x336b6b,_0x2b3fe5){_0x2b3fe5=_0x2b3fe5||0xc8;return function(_0x35a022){if(_0x35a022){return _0x336b6b[_0x48f7('0x19')](_0x2b3fe5)[_0x48f7('0x1a')](_0x35a022);}};}function respondWithFilteredResult(_0x506bb2,_0x5a4473){return function(_0xd187e9){if(_0xd187e9){var _0x58e448=typeof _0x5a4473[_0x48f7('0x1b')]==='undefined'&&typeof _0x5a4473[_0x48f7('0x1c')]===_0x48f7('0x1d');var _0x4c7d45=_0xd187e9[_0x48f7('0x1e')];var _0x5d1ab0=_0x58e448?0x0:_0x5a4473[_0x48f7('0x1b')];var _0x4e5b02=_0x58e448?_0xd187e9['count']:_0x5a4473['offset']+_0x5a4473[_0x48f7('0x1c')];var _0x55e618;if(_0x4e5b02>=_0x4c7d45){_0x4e5b02=_0x4c7d45;_0x55e618=0xc8;}else{_0x55e618=0xce;}_0x506bb2[_0x48f7('0x19')](_0x55e618);return _0x506bb2[_0x48f7('0x1f')](_0x48f7('0x20'),_0x5d1ab0+'-'+_0x4e5b02+'/'+_0x4c7d45)[_0x48f7('0x1a')](_0xd187e9);}return null;};}function saveUpdates(_0x4ac89e){return function(_0x1693e9){if(_0x1693e9){return _0x1693e9['update'](_0x4ac89e)[_0x48f7('0xe')](function(_0x1a5754){return _0x1a5754;});}return null;};}function removeEntity(_0x4eee30){return function(_0x5e075a){if(_0x5e075a){return _0x5e075a[_0x48f7('0x21')]()[_0x48f7('0xe')](function(){_0x4eee30[_0x48f7('0x19')](0xcc)[_0x48f7('0x22')]();});}};}function handleEntityNotFound(_0x52f10a){return function(_0x2d7c9d){if(!_0x2d7c9d){_0x52f10a[_0x48f7('0x23')](0x194);}return _0x2d7c9d;};}function handleError(_0x1a0ffa,_0x2eccfc){_0x2eccfc=_0x2eccfc||0x1f4;return function(_0x23d750){logger[_0x48f7('0x14')](_0x23d750[_0x48f7('0x24')]);if(_0x23d750['name']){delete _0x23d750[_0x48f7('0x25')];}_0x1a0ffa[_0x48f7('0x19')](_0x2eccfc)['send'](_0x23d750);};}exports[_0x48f7('0x26')]=function(_0x63988c,_0xe92bc9){var _0x24f03a={},_0x4982c4={},_0x2968e9={'count':0x0,'rows':[]};var _0x955cd5=_[_0x48f7('0x27')](db[_0x48f7('0x28')]['rawAttributes'],function(_0x10ef2c){return{'name':_0x10ef2c[_0x48f7('0x29')],'type':_0x10ef2c[_0x48f7('0x2a')]['key']};});_0x4982c4['model']=_[_0x48f7('0x27')](_0x955cd5,_0x48f7('0x25'));_0x4982c4['query']=_[_0x48f7('0x2b')](_0x63988c[_0x48f7('0x2c')]);_0x4982c4[_0x48f7('0x2d')]=_[_0x48f7('0x2e')](_0x4982c4[_0x48f7('0x2f')],_0x4982c4[_0x48f7('0x2c')]);_0x24f03a['attributes']=_[_0x48f7('0x2e')](_0x4982c4[_0x48f7('0x2f')],qs[_0x48f7('0x30')](_0x63988c[_0x48f7('0x2c')][_0x48f7('0x30')]));_0x24f03a[_0x48f7('0x31')]=_0x24f03a[_0x48f7('0x31')][_0x48f7('0x32')]?_0x24f03a[_0x48f7('0x31')]:_0x4982c4[_0x48f7('0x2f')];if(!_0x63988c[_0x48f7('0x2c')][_0x48f7('0x33')]('nolimit')){_0x24f03a[_0x48f7('0x1c')]=qs[_0x48f7('0x1c')](_0x63988c[_0x48f7('0x2c')][_0x48f7('0x1c')]);_0x24f03a[_0x48f7('0x1b')]=qs[_0x48f7('0x1b')](_0x63988c[_0x48f7('0x2c')][_0x48f7('0x1b')]);}_0x24f03a[_0x48f7('0x34')]=qs[_0x48f7('0x35')](_0x63988c[_0x48f7('0x2c')][_0x48f7('0x35')]);_0x24f03a[_0x48f7('0x36')]=qs[_0x48f7('0x2d')](_[_0x48f7('0x37')](_0x63988c[_0x48f7('0x2c')],_0x4982c4[_0x48f7('0x2d')]),_0x955cd5);if(_0x63988c['query'][_0x48f7('0x38')]){_0x24f03a['where']=_[_0x48f7('0x39')](_0x24f03a[_0x48f7('0x36')],{'$or':_[_0x48f7('0x27')](_0x955cd5,function(_0x28c427){if(_0x28c427[_0x48f7('0x2a')]!==_0x48f7('0x3a')){var _0x753c8={};_0x753c8[_0x28c427[_0x48f7('0x25')]]={'$like':'%'+_0x63988c[_0x48f7('0x2c')][_0x48f7('0x38')]+'%'};return _0x753c8;}})});}_0x24f03a=_[_0x48f7('0x39')]({},_0x24f03a,_0x63988c[_0x48f7('0x3b')]);var _0x405fd2={'where':_0x24f03a[_0x48f7('0x36')]};return db[_0x48f7('0x28')][_0x48f7('0x1e')](_0x405fd2)[_0x48f7('0xe')](function(_0x51707a){_0x2968e9[_0x48f7('0x1e')]=_0x51707a;if(_0x63988c['query'][_0x48f7('0x3c')]){_0x24f03a[_0x48f7('0x3d')]=[{'all':!![]}];}return db[_0x48f7('0x28')][_0x48f7('0x3e')](_0x24f03a);})['then'](function(_0x3abc31){_0x2968e9[_0x48f7('0x3f')]=_0x3abc31;return _0x2968e9;})[_0x48f7('0xe')](respondWithFilteredResult(_0xe92bc9,_0x24f03a))[_0x48f7('0x18')](handleError(_0xe92bc9,null));};exports[_0x48f7('0x40')]=function(_0x419c1d,_0x3aea20){var _0x5c24c5={'raw':!![],'where':{'id':_0x419c1d[_0x48f7('0x41')]['id']}},_0x48987e={};_0x48987e[_0x48f7('0x2f')]=_[_0x48f7('0x2b')](db['OpenchannelMessage'][_0x48f7('0x42')]);_0x48987e[_0x48f7('0x2c')]=_['keys'](_0x419c1d[_0x48f7('0x2c')]);_0x48987e[_0x48f7('0x2d')]=_['intersection'](_0x48987e[_0x48f7('0x2f')],_0x48987e[_0x48f7('0x2c')]);_0x5c24c5[_0x48f7('0x31')]=_[_0x48f7('0x2e')](_0x48987e['model'],qs['fields'](_0x419c1d[_0x48f7('0x2c')][_0x48f7('0x30')]));_0x5c24c5[_0x48f7('0x31')]=_0x5c24c5['attributes'][_0x48f7('0x32')]?_0x5c24c5[_0x48f7('0x31')]:_0x48987e['model'];if(_0x419c1d[_0x48f7('0x2c')][_0x48f7('0x3c')]){_0x5c24c5[_0x48f7('0x3d')]=[{'all':!![]}];}_0x5c24c5=_[_0x48f7('0x39')]({},_0x5c24c5,_0x419c1d[_0x48f7('0x3b')]);return db['OpenchannelMessage'][_0x48f7('0x43')](_0x5c24c5)[_0x48f7('0xe')](handleEntityNotFound(_0x3aea20,null))['then'](respondWithResult(_0x3aea20,null))['catch'](handleError(_0x3aea20,null));};exports['create']=function(_0x5070c4,_0x3c8db8){return db[_0x48f7('0x28')][_0x48f7('0x44')](_0x5070c4['body'],{})['then'](respondWithResult(_0x3c8db8,0xc9))['catch'](handleError(_0x3c8db8,null));};exports[_0x48f7('0x45')]=function(_0x3452b3,_0x8c8155){if(_0x3452b3[_0x48f7('0x46')]['id']){delete _0x3452b3[_0x48f7('0x46')]['id'];}return db[_0x48f7('0x28')]['find']({'where':{'id':_0x3452b3[_0x48f7('0x41')]['id']}})[_0x48f7('0xe')](handleEntityNotFound(_0x8c8155,null))['then'](saveUpdates(_0x3452b3[_0x48f7('0x46')],null))[_0x48f7('0xe')](respondWithResult(_0x8c8155,null))[_0x48f7('0x18')](handleError(_0x8c8155,null));};exports[_0x48f7('0x21')]=function(_0x4adb72,_0x79a03f){return db[_0x48f7('0x28')][_0x48f7('0x43')]({'where':{'id':_0x4adb72[_0x48f7('0x41')]['id']}})[_0x48f7('0xe')](handleEntityNotFound(_0x79a03f,null))['then'](removeEntity(_0x79a03f,null))[_0x48f7('0x18')](handleError(_0x79a03f,null));};exports['describe']=function(_0x1ed769,_0x4e6a09){return db[_0x48f7('0x28')]['describe']()['then'](respondWithResult(_0x4e6a09,null))['catch'](handleError(_0x4e6a09,null));};exports[_0x48f7('0x47')]=function(_0x57224d,_0x1ac120){var _0x21f67f=_0x48f7('0x48');return interactionService['acceptMessage'](_0x57224d,_0x21f67f)[_0x48f7('0xe')](respondWithResult(_0x1ac120,null))['catch'](handleError(_0x1ac120,null));};exports['reject']=function(_0x4104f2,_0x29c717){var _0x4bed89={'agent':{},'channel':'openchannel'};if(_0x4104f2[_0x48f7('0x46')]['id']){delete _0x4104f2['body']['id'];}_0x4104f2['body'][_0x48f7('0x49')]=_0x4104f2[_0x48f7('0x46')][_0x48f7('0x49')]||_0x4104f2[_0x48f7('0x4a')]['id'];_0x4bed89[_0x48f7('0x4b')]['id']=_0x4104f2[_0x48f7('0x46')][_0x48f7('0x49')];return db[_0x48f7('0x28')][_0x48f7('0x43')]({'where':{'id':_0x4104f2['params']['id'],'UserId':null}})[_0x48f7('0xe')](handleEntityNotFound(_0x29c717,null))[_0x48f7('0xe')](function(_0x215a58){if(_0x215a58){_0x4bed89[_0x48f7('0x15')]=_0x215a58['get']({'plain':!![]});return db['OpenchannelInteraction'][_0x48f7('0x43')]({'where':{'id':_0x215a58[_0x48f7('0x4c')]}});}return null;})[_0x48f7('0xe')](handleEntityNotFound(_0x29c717,null))[_0x48f7('0xe')](function(_0x35465e){if(_0x35465e){_0x4bed89[_0x48f7('0x4d')]=_0x35465e[_0x48f7('0x4e')]({'plain':!![]});interaction_log[_0x48f7('0x16')](_0x48f7('0x4f'),_0x4104f2[_0x48f7('0x4a')]['id'],_0x4104f2[_0x48f7('0x4a')][_0x48f7('0x25')],_0x4104f2['user'][_0x48f7('0x50')],_0x4bed89[_0x48f7('0x4d')]['id'],_0x4104f2[_0x48f7('0x46')]?JSON[_0x48f7('0x13')](_0x4104f2[_0x48f7('0x46')]):_0x48f7('0x51'));return respondWithRpcPromise(_0x48f7('0x52'),_0x48f7('0x53'),_0x4bed89);}return null;})[_0x48f7('0xe')](function(_0x1bad38){var _0x541907=_0x48f7('0x54')+_0x1bad38['message'][_0x48f7('0x55')];return db[_0x48f7('0x56')][_0x48f7('0x2c')](_0x541907,{'type':db[_0x48f7('0x57')][_0x48f7('0x58')]['SELECT'],'raw':!![]})[_0x48f7('0xe')](function(_0x155a5c){return _0x155a5c;});})['then'](function(_0x4b8828){if(_0x4b8828){_0x4bed89['message'][_0x48f7('0x59')]=_0x4b8828[0x0];if(!_0x4104f2[_0x48f7('0x46')][_0x48f7('0x49')])return;return db[_0x48f7('0x5a')]['find']({'where':{'id':_0x4104f2[_0x48f7('0x46')][_0x48f7('0x49')],'role':_0x48f7('0x4b')},'attributes':['id',_0x48f7('0x25'),'fullname',_0x48f7('0x5b'),_0x48f7('0x5c')],'raw':!![]});}return null;})['then'](function(_0x46425c){if(!_0x46425c)return null;_0x4bed89['message'][_0x48f7('0x4b')]=_0x46425c;return _0x4bed89;})[_0x48f7('0xe')](function(_0x2b88b4){if(_0x2b88b4){_0x2b88b4['message'][_0x48f7('0x5d')]=util[_0x48f7('0x5e')](_0x48f7('0x5f'),_0x4104f2['user'][_0x48f7('0x25')]);_0x2b88b4[_0x48f7('0x15')][_0x48f7('0x60')]=_0x4bed89[_0x48f7('0x60')];_0x2b88b4['message'][_0x48f7('0x61')]=_0x4bed89[_0x48f7('0x60')];_0x2b88b4[_0x48f7('0x15')][_0x48f7('0x62')]='reject';respondWithRpcPromise(_0x48f7('0x63'),_0x48f7('0x63'),{'event':_0x48f7('0x64'),'message':_0x2b88b4[_0x48f7('0x15')]},client9002);return _0x4bed89;}return null;})[_0x48f7('0xe')](respondWithResult(_0x29c717,null))[_0x48f7('0x18')](handleError(_0x29c717,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 976308e..0f71402 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 _0x745a=['save','update','remove','emit','hasOwnProperty','hook','exports','events','OpenchannelMessage'];(function(_0x31ec70,_0x1e44d4){var _0x2c8719=function(_0x4aa35e){while(--_0x4aa35e){_0x31ec70['push'](_0x31ec70['shift']());}};_0x2c8719(++_0x1e44d4);}(_0x745a,0x15d));var _0xa745=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x745a[_0x1cc8fe];return _0x230054;};'use strict';var EventEmitter=require(_0xa745('0x0'));var OpenchannelMessage=require('../../mysqldb')['db'][_0xa745('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa745('0x2'),'afterUpdate':_0xa745('0x3'),'afterDestroy':_0xa745('0x4')};function emitEvent(_0x4580d0){return function(_0xef0c5f,_0x1a6957,_0x5dac8c){OpenchannelMessageEvents[_0xa745('0x5')](_0x4580d0+':'+_0xef0c5f['id'],_0xef0c5f);OpenchannelMessageEvents[_0xa745('0x5')](_0x4580d0,_0xef0c5f);_0x5dac8c(null);};}for(var e in events){if(events[_0xa745('0x6')](e)){var event=events[e];OpenchannelMessage[_0xa745('0x7')](e,emitEvent(event));}}module[_0xa745('0x8')]=OpenchannelMessageEvents; \ No newline at end of file +var _0xef7a=['update','emit','hook','../../mysqldb','OpenchannelMessage','save'];(function(_0x163374,_0x1b0054){var _0x445d96=function(_0x532d44){while(--_0x532d44){_0x163374['push'](_0x163374['shift']());}};_0x445d96(++_0x1b0054);}(_0xef7a,0x18f));var _0xaef7=function(_0x4f4de2,_0x257b5d){_0x4f4de2=_0x4f4de2-0x0;var _0x1cbf3a=_0xef7a[_0x4f4de2];return _0x1cbf3a;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0xaef7('0x0'))['db'][_0xaef7('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xaef7('0x2'),'afterUpdate':_0xaef7('0x3'),'afterDestroy':'remove'};function emitEvent(_0xc84a73){return function(_0x586df9,_0x4c135a,_0x2b509d){OpenchannelMessageEvents[_0xaef7('0x4')](_0xc84a73+':'+_0x586df9['id'],_0x586df9);OpenchannelMessageEvents[_0xaef7('0x4')](_0xc84a73,_0x586df9);_0x2b509d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage[_0xaef7('0x5')](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 aeed9b8..6e6da9a 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 _0x9c46=['catch','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage','fti_openchannel_messages','body','FULLTEXT','models','direction','toLowerCase','out','secret','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','createdAt','error','CmContact','then','find','OpenchannelAccountId','Interactions','keys','get','info','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','replyUri','length','omit','Contact','POST','method','GET','OpenchannelMessage,\x20%s,\x20%s','Message\x20%d\x20forwarded\x20to\x20%s','threadId','update','Interaction'];(function(_0x50b53a,_0x359f54){var _0x723807=function(_0x284024){while(--_0x284024){_0x50b53a['push'](_0x50b53a['shift']());}};_0x723807(++_0x359f54);}(_0x9c46,0xa9));var _0x69c4=function(_0x5e6f73,_0x652f65){_0x5e6f73=_0x5e6f73-0x0;var _0x3744a0=_0x9c46[_0x5e6f73];return _0x3744a0;};'use strict';var _=require(_0x69c4('0x0'));var util=require(_0x69c4('0x1'));var logger=require(_0x69c4('0x2'))(_0x69c4('0x3'));var moment=require(_0x69c4('0x4'));var BPromise=require(_0x69c4('0x5'));var rp=require(_0x69c4('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x69c4('0x7'));var config=require(_0x69c4('0x8'));var attributes=require(_0x69c4('0x9'));module[_0x69c4('0xa')]=function(_0x179175,_0x5d7367){return _0x179175[_0x69c4('0xb')](_0x69c4('0xc'),attributes,{'tableName':'openchannel_messages','paranoid':![],'indexes':[{'name':_0x69c4('0xd'),'fields':[_0x69c4('0xe')],'type':_0x69c4('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x12ba91,_0x33c899,_0x5d8cfe){var _0x170b68=_0x179175[_0x69c4('0x10')];var _0x64b439=_0x12ba91['get']({'plain':!![]});if(_0x64b439[_0x69c4('0x11')][_0x69c4('0x12')]()==='in'||_0x64b439[_0x69c4('0x11')][_0x69c4('0x12')]()===_0x69c4('0x13')&&!_0x64b439[_0x69c4('0x14')]&&!_[_0x69c4('0x15')](_0x64b439[_0x69c4('0x16')])){_0x170b68[_0x69c4('0x17')][_0x69c4('0x18')]({'where':{'id':_0x64b439[_0x69c4('0x19')]}})['then'](function(_0x4eae45){if(_0x4eae45){_0x4eae45['update']({'lastMsgAt':_0x64b439[_0x69c4('0x1a')],'lastMsgDirection':_0x64b439[_0x69c4('0x11')][_0x69c4('0x12')]()});}})['catch'](function(_0x502ce0){console[_0x69c4('0x1b')](_0x502ce0);});}if(_0x64b439[_0x69c4('0x11')]===_0x69c4('0x13')&&!_0x64b439[_0x69c4('0x14')]){var _0xdd122f;_0x170b68[_0x69c4('0x1c')]['describe']()[_0x69c4('0x1d')](function(_0x18d872){return _0x170b68['OpenchannelAccount'][_0x69c4('0x1e')]({'where':{'id':_0x64b439[_0x69c4('0x1f')]},'include':[{'model':_0x170b68[_0x69c4('0x17')],'as':_0x69c4('0x20'),'where':{'id':_0x64b439[_0x69c4('0x19')]},'limit':0x1,'include':[{'model':_0x170b68['CmContact'],'as':'Contact','attributes':_[_0x69c4('0x21')](_0x18d872)}]}]});})[_0x69c4('0x1d')](function(_0x4bf367){_0xdd122f=_0x4bf367[_0x69c4('0x22')]({'plain':!![]});if(_0xdd122f&&_0xdd122f['replyUri']){logger[_0x69c4('0x23')]('OpenchannelMessage,\x20%s,\x20%s',_0x69c4('0x24'),util[_0x69c4('0x25')](_0x69c4('0x26'),_0x64b439['id'],_0xdd122f[_0x69c4('0x27')]));if(_0xdd122f[_0x69c4('0x20')]&&_0xdd122f['Interactions'][_0x69c4('0x28')]){_0x64b439['Interaction']=_[_0x69c4('0x29')](_0xdd122f[_0x69c4('0x20')][0x0],_0x69c4('0x2a'));_0x64b439['Contact']=_0xdd122f['Interactions'][0x0][_0x69c4('0x2a')];}var _0x33c899={'method':_0x69c4('0x2b'),'uri':encodeURI(_0xdd122f['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x33c899[_0x69c4('0x2c')]){case _0x69c4('0x2d'):_0x33c899['qs']=_0x64b439;break;case'POST':_0x33c899[_0x69c4('0xe')]=_0x64b439;break;}return rp(_0x33c899)['then'](function(_0x1142f8){logger[_0x69c4('0x23')](_0x69c4('0x2e'),_0x69c4('0x24'),util[_0x69c4('0x25')](_0x69c4('0x2f'),_0x64b439['id'],_0xdd122f[_0x69c4('0x27')]));if(_0x1142f8['body'][_0x69c4('0x30')]&&_0x1142f8[_0x69c4('0xe')][_0x69c4('0x30')]!=_0x64b439['Interaction'][_0x69c4('0x30')]){return _0x170b68[_0x69c4('0x17')][_0x69c4('0x31')]({'threadId':_0x1142f8[_0x69c4('0xe')][_0x69c4('0x30')]},{'where':{'id':_0x64b439[_0x69c4('0x32')]['id']}});}else{return;}})['then'](function(){return _0x12ba91[_0x69c4('0x31')]({'read':!![]});})[_0x69c4('0x33')](function(_0x262aa0){logger[_0x69c4('0x1b')](_0x69c4('0x2e'),'afterCreate',util['inspect'](_0x262aa0,{'showHidden':![],'depth':null}));_0x5d8cfe();});}else{_0x5d8cfe();}})[_0x69c4('0x34')](function(){_0x5d8cfe();});}else{_0x5d8cfe();}}},'charset':_0x69c4('0x35'),'collate':_0x69c4('0x36')});}; \ No newline at end of file +var _0x83d2=['OpenchannelMessage','openchannel_messages','fti_openchannel_messages','FULLTEXT','models','toLowerCase','direction','out','secret','isNil','UserId','OpenchannelInteraction','findOne','update','createdAt','catch','error','describe','then','find','OpenchannelAccountId','CmContact','Contact','keys','get','info','Forwarding\x20message\x20%d\x20to\x20%s','replyUri','Interactions','length','omit','POST','GET','body','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Message\x20%d\x20forwarded\x20to\x20%s','threadId','Interaction','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports'];(function(_0x2b034a,_0xd9088c){var _0x2763f4=function(_0x550dc3){while(--_0x550dc3){_0x2b034a['push'](_0x2b034a['shift']());}};_0x2763f4(++_0xd9088c);}(_0x83d2,0xfa));var _0x283d=function(_0x18f743,_0x2c626b){_0x18f743=_0x18f743-0x0;var _0x5e2d4=_0x83d2[_0x18f743];return _0x5e2d4;};'use strict';var _=require(_0x283d('0x0'));var util=require('util');var logger=require(_0x283d('0x1'))(_0x283d('0x2'));var moment=require('moment');var BPromise=require(_0x283d('0x3'));var rp=require(_0x283d('0x4'));var fs=require('fs');var path=require(_0x283d('0x5'));var rimraf=require(_0x283d('0x6'));var config=require(_0x283d('0x7'));var attributes=require(_0x283d('0x8'));module[_0x283d('0x9')]=function(_0x479dbf,_0x59490d){return _0x479dbf['define'](_0x283d('0xa'),attributes,{'tableName':_0x283d('0xb'),'paranoid':![],'indexes':[{'name':_0x283d('0xc'),'fields':['body'],'type':_0x283d('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4b1231,_0x1bc2da,_0x1b9ef0){var _0x6601a1=_0x479dbf[_0x283d('0xe')];var _0x26d556=_0x4b1231['get']({'plain':!![]});if(_0x26d556['direction'][_0x283d('0xf')]()==='in'||_0x26d556[_0x283d('0x10')]['toLowerCase']()===_0x283d('0x11')&&!_0x26d556[_0x283d('0x12')]&&!_[_0x283d('0x13')](_0x26d556[_0x283d('0x14')])){_0x6601a1[_0x283d('0x15')][_0x283d('0x16')]({'where':{'id':_0x26d556['OpenchannelInteractionId']}})['then'](function(_0x3afe52){if(_0x3afe52){_0x3afe52[_0x283d('0x17')]({'lastMsgAt':_0x26d556[_0x283d('0x18')],'lastMsgDirection':_0x26d556[_0x283d('0x10')][_0x283d('0xf')]()});}})[_0x283d('0x19')](function(_0x453bf5){console[_0x283d('0x1a')](_0x453bf5);});}if(_0x26d556[_0x283d('0x10')]===_0x283d('0x11')&&!_0x26d556[_0x283d('0x12')]){var _0x4a5444;_0x6601a1['CmContact'][_0x283d('0x1b')]()[_0x283d('0x1c')](function(_0x597dde){return _0x6601a1['OpenchannelAccount'][_0x283d('0x1d')]({'where':{'id':_0x26d556[_0x283d('0x1e')]},'include':[{'model':_0x6601a1[_0x283d('0x15')],'as':'Interactions','where':{'id':_0x26d556['OpenchannelInteractionId']},'limit':0x1,'include':[{'model':_0x6601a1[_0x283d('0x1f')],'as':_0x283d('0x20'),'attributes':_[_0x283d('0x21')](_0x597dde)}]}]});})[_0x283d('0x1c')](function(_0x2cb1ce){_0x4a5444=_0x2cb1ce[_0x283d('0x22')]({'plain':!![]});if(_0x4a5444&&_0x4a5444['replyUri']){logger[_0x283d('0x23')]('OpenchannelMessage,\x20%s,\x20%s','afterCreate',util['format'](_0x283d('0x24'),_0x26d556['id'],_0x4a5444[_0x283d('0x25')]));if(_0x4a5444[_0x283d('0x26')]&&_0x4a5444[_0x283d('0x26')][_0x283d('0x27')]){_0x26d556['Interaction']=_[_0x283d('0x28')](_0x4a5444[_0x283d('0x26')][0x0],_0x283d('0x20'));_0x26d556[_0x283d('0x20')]=_0x4a5444[_0x283d('0x26')][0x0][_0x283d('0x20')];}var _0x1bc2da={'method':_0x283d('0x29'),'uri':encodeURI(_0x4a5444[_0x283d('0x25')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x1bc2da['method']){case _0x283d('0x2a'):_0x1bc2da['qs']=_0x26d556;break;case _0x283d('0x29'):_0x1bc2da[_0x283d('0x2b')]=_0x26d556;break;}return rp(_0x1bc2da)[_0x283d('0x1c')](function(_0x3a1d96){logger['info'](_0x283d('0x2c'),_0x283d('0x2d'),util[_0x283d('0x2e')](_0x283d('0x2f'),_0x26d556['id'],_0x4a5444[_0x283d('0x25')]));if(_0x3a1d96[_0x283d('0x2b')][_0x283d('0x30')]&&_0x3a1d96[_0x283d('0x2b')][_0x283d('0x30')]!=_0x26d556[_0x283d('0x31')]['threadId']){return _0x6601a1[_0x283d('0x15')][_0x283d('0x17')]({'threadId':_0x3a1d96[_0x283d('0x2b')][_0x283d('0x30')]},{'where':{'id':_0x26d556[_0x283d('0x31')]['id']}});}else{return;}})['then'](function(){return _0x4b1231['update']({'read':!![]});})[_0x283d('0x19')](function(_0xd0e7d8){logger['error'](_0x283d('0x2c'),'afterCreate',util['inspect'](_0xd0e7d8,{'showHidden':![],'depth':null}));_0x1b9ef0();});}else{_0x1b9ef0();}})['finally'](function(){_0x1b9ef0();});}else{_0x1b9ef0();}}},'charset':_0x283d('0x32'),'collate':_0x283d('0x33')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 039e268..9ece96d 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 _0x1261=['../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','localhost','socket.io-emitter','./openchannelMessage.socket','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','OpenchannelMessage','options','raw','then','CreateOpenchannelMessage','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x59481b,_0x4c7624){var _0x55e559=function(_0x15c3a4){while(--_0x15c3a4){_0x59481b['push'](_0x59481b['shift']());}};_0x55e559(++_0x4c7624);}(_0x1261,0x144));var _0x1126=function(_0xc4ea75,_0x273753){_0xc4ea75=_0xc4ea75-0x0;var _0x52ea5e=_0x1261[_0xc4ea75];return _0x52ea5e;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});config[_0x1126('0xb')]=_['defaults'](config[_0x1126('0xb')],{'host':_0x1126('0xc'),'port':0x18eb});var socket=require(_0x1126('0xd'))(new Redis(config[_0x1126('0xb')]));require(_0x1126('0xe'))['register'](socket);function respondWithRpcPromise(_0x3f09ac,_0x18dbe6,_0x167ef1){return new BPromise(function(_0x5e72e2,_0x34571c){return client['request'](_0x3f09ac,_0x167ef1)['then'](function(_0x15c071){logger['info'](_0x1126('0xf'),_0x18dbe6,_0x1126('0x10'));logger[_0x1126('0x11')](_0x1126('0x12'),_0x18dbe6,_0x1126('0x10'),JSON[_0x1126('0x13')](_0x15c071));if(_0x15c071[_0x1126('0x14')]){if(_0x15c071[_0x1126('0x14')][_0x1126('0x15')]===0x1f4){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x18dbe6,_0x15c071[_0x1126('0x14')][_0x1126('0x16')]);return _0x34571c(_0x15c071[_0x1126('0x14')]['message']);}logger[_0x1126('0x14')]('OpenchannelMessage,\x20%s,\x20%s',_0x18dbe6,_0x15c071[_0x1126('0x14')][_0x1126('0x16')]);return _0x5e72e2(_0x15c071[_0x1126('0x14')]['message']);}else{logger[_0x1126('0x17')](_0x1126('0xf'),_0x18dbe6,'request\x20sent');_0x5e72e2(_0x15c071['result'][_0x1126('0x16')]);}})[_0x1126('0x18')](function(_0x58d11a){logger['error'](_0x1126('0xf'),_0x18dbe6,_0x58d11a);_0x34571c(_0x58d11a);});});}exports['CreateOpenchannelMessage']=function(_0x22ed37){var _0x1d6d19=this;return new Promise(function(_0x2f70ac,_0x54400a){return db[_0x1126('0x19')]['create'](_0x22ed37['body'],{'raw':_0x22ed37[_0x1126('0x1a')]?_0x22ed37[_0x1126('0x1a')][_0x1126('0x1b')]===undefined?!![]:![]:!![]})[_0x1126('0x1c')](function(_0x526ca1){logger[_0x1126('0x17')](_0x1126('0x1d'),_0x22ed37);logger['debug'](_0x1126('0x1d'),_0x22ed37,JSON['stringify'](_0x526ca1));_0x2f70ac(_0x526ca1);})['catch'](function(_0x4b57ab){logger[_0x1126('0x14')](_0x1126('0x1d'),_0x4b57ab[_0x1126('0x16')],_0x22ed37);_0x54400a(_0x1d6d19[_0x1126('0x14')](0x1f4,_0x4b57ab[_0x1126('0x16')]));});});}; \ No newline at end of file +var _0x5f2f=['OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','OpenchannelMessage','create','options','raw','CreateOpenchannelMessage','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x77123c,_0xbb959e){var _0x4d6c5d=function(_0x487c03){while(--_0x487c03){_0x77123c['push'](_0x77123c['shift']());}};_0x4d6c5d(++_0xbb959e);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2afcfa,_0x456ebd){_0x2afcfa=_0x2afcfa-0x0;var _0x1f012d=_0x5f2f[_0x2afcfa];return _0x1f012d;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});config[_0xf5f2('0xc')]=_[_0xf5f2('0xd')](config['redis'],{'host':_0xf5f2('0xe'),'port':0x18eb});var socket=require(_0xf5f2('0xf'))(new Redis(config[_0xf5f2('0xc')]));require('./openchannelMessage.socket')[_0xf5f2('0x10')](socket);function respondWithRpcPromise(_0x15dd7c,_0x218ae3,_0x4e0e6b){return new BPromise(function(_0x977a59,_0x4ebbbe){return client['request'](_0x15dd7c,_0x4e0e6b)[_0xf5f2('0x11')](function(_0x151aba){logger['info'](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));logger[_0xf5f2('0x14')](_0xf5f2('0x15'),_0x218ae3,_0xf5f2('0x13'),JSON[_0xf5f2('0x16')](_0x151aba));if(_0x151aba['error']){if(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x18')]===0x1f4){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')]['message']);return _0x4ebbbe(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);return _0x977a59(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}else{logger[_0xf5f2('0x1a')](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));_0x977a59(_0x151aba[_0xf5f2('0x1b')][_0xf5f2('0x19')]);}})[_0xf5f2('0x1c')](function(_0x3cf5ea){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x3cf5ea);_0x4ebbbe(_0x3cf5ea);});});}exports['CreateOpenchannelMessage']=function(_0x34706d){var _0x47101e=this;return new Promise(function(_0x49dac2,_0x47acfc){return db[_0xf5f2('0x1d')][_0xf5f2('0x1e')](_0x34706d['body'],{'raw':_0x34706d[_0xf5f2('0x1f')]?_0x34706d[_0xf5f2('0x1f')][_0xf5f2('0x20')]===undefined?!![]:![]:!![]})[_0xf5f2('0x11')](function(_0x36f1cb){logger['info'](_0xf5f2('0x21'),_0x34706d);logger[_0xf5f2('0x14')](_0xf5f2('0x21'),_0x34706d,JSON[_0xf5f2('0x16')](_0x36f1cb));_0x49dac2(_0x36f1cb);})[_0xf5f2('0x1c')](function(_0x5bdf4a){logger['error'](_0xf5f2('0x21'),_0x5bdf4a[_0xf5f2('0x19')],_0x34706d);_0x47acfc(_0x47101e[_0xf5f2('0x17')](0x1f4,_0x5bdf4a[_0xf5f2('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 90219c9..7fc7a8d 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 _0xf066=['save','remove','update','emit','removeListener','register'];(function(_0x2c4f80,_0x1d7421){var _0x1d5c9d=function(_0x1a1366){while(--_0x1a1366){_0x2c4f80['push'](_0x2c4f80['shift']());}};_0x1d5c9d(++_0x1d7421);}(_0xf066,0x1a4));var _0x6f06=function(_0x44799d,_0x26c23a){_0x44799d=_0x44799d-0x0;var _0x4f4a20=_0xf066[_0x44799d];return _0x4f4a20;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=[_0x6f06('0x0'),_0x6f06('0x1'),_0x6f06('0x2')];function createListener(_0x2608de,_0x3a1ff8){return function(_0x1a9901){_0x3a1ff8[_0x6f06('0x3')](_0x2608de,_0x1a9901);};}function removeListener(_0x350970,_0x5c3443){return function(){OpenchannelMessageEvents[_0x6f06('0x4')](_0x350970,_0x5c3443);};}exports[_0x6f06('0x5')]=function(_0x1e76c5){for(var _0x2e77a9=0x0,_0x1452d4=events['length'];_0x2e77a9<_0x1452d4;_0x2e77a9++){var _0x280442=events[_0x2e77a9];var _0x2e49e6=createListener('openchannelMessage:'+_0x280442,_0x1e76c5);OpenchannelMessageEvents['on'](_0x280442,_0x2e49e6);}}; \ No newline at end of file +var _0xe63f=['openchannelMessage:','./openchannelMessage.events','remove','update','emit','removeListener'];(function(_0x109eb7,_0x102f08){var _0x299899=function(_0x5c50c5){while(--_0x5c50c5){_0x109eb7['push'](_0x109eb7['shift']());}};_0x299899(++_0x102f08);}(_0xe63f,0x163));var _0xfe63=function(_0xc8ddee,_0x251e0b){_0xc8ddee=_0xc8ddee-0x0;var _0x2daa9d=_0xe63f[_0xc8ddee];return _0x2daa9d;};'use strict';var OpenchannelMessageEvents=require(_0xfe63('0x0'));var events=['save',_0xfe63('0x1'),_0xfe63('0x2')];function createListener(_0xf8596e,_0x377d21){return function(_0x5e9051){_0x377d21[_0xfe63('0x3')](_0xf8596e,_0x5e9051);};}function removeListener(_0x25d703,_0x547609){return function(){OpenchannelMessageEvents[_0xfe63('0x4')](_0x25d703,_0x547609);};}exports['register']=function(_0x4bb882){for(var _0x5813a4=0x0,_0x3e60a2=events['length'];_0x5813a4<_0x3e60a2;_0x5813a4++){var _0x3f928b=events[_0x5813a4];var _0x47d18f=createListener(_0xfe63('0x5')+_0x3f928b,_0x4bb882);OpenchannelMessageEvents['on'](_0x3f928b,_0x47d18f);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 58bf8e8..c78d375 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 _0x2c41=['/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','update','delete','destroy','removeTeams','removeAgents','multer','util','path','connect-timeout','express','fs-extra','../../config/environment','./openchannelQueue.controller','get','index','/describe','isAuthenticated','describe'];(function(_0x57f8c0,_0x136cf6){var _0x117f08=function(_0x426cd4){while(--_0x426cd4){_0x57f8c0['push'](_0x57f8c0['shift']());}};_0x117f08(++_0x136cf6);}(_0x2c41,0x101));var _0x12c4=function(_0x47568e,_0x5ccdaf){_0x47568e=_0x47568e-0x0;var _0x33815b=_0x2c41[_0x47568e];return _0x33815b;};'use strict';var multer=require(_0x12c4('0x0'));var util=require(_0x12c4('0x1'));var path=require(_0x12c4('0x2'));var timeout=require(_0x12c4('0x3'));var express=require(_0x12c4('0x4'));var router=express['Router']();var fs_extra=require(_0x12c4('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x12c4('0x6'));var controller=require(_0x12c4('0x7'));router[_0x12c4('0x8')]('/',auth['isAuthenticated'](),controller[_0x12c4('0x9')]);router[_0x12c4('0x8')](_0x12c4('0xa'),auth[_0x12c4('0xb')](),controller[_0x12c4('0xc')]);router[_0x12c4('0x8')](_0x12c4('0xd'),auth[_0x12c4('0xb')](),controller[_0x12c4('0xe')]);router['get'](_0x12c4('0xf'),auth[_0x12c4('0xb')](),controller[_0x12c4('0x10')]);router[_0x12c4('0x8')](_0x12c4('0x11'),auth[_0x12c4('0xb')](),controller[_0x12c4('0x12')]);router[_0x12c4('0x8')](_0x12c4('0x13'),auth['isAuthenticated'](),controller[_0x12c4('0x14')]);router[_0x12c4('0x15')]('/',auth[_0x12c4('0xb')](),controller[_0x12c4('0x16')]);router[_0x12c4('0x15')](_0x12c4('0x11'),auth['isAuthenticated'](),controller[_0x12c4('0x17')]);router[_0x12c4('0x15')](_0x12c4('0x13'),auth[_0x12c4('0xb')](),controller[_0x12c4('0x18')]);router['put'](_0x12c4('0xd'),auth[_0x12c4('0xb')](),controller[_0x12c4('0x19')]);router[_0x12c4('0x1a')](_0x12c4('0xd'),auth[_0x12c4('0xb')](),controller[_0x12c4('0x1b')]);router[_0x12c4('0x1a')](_0x12c4('0x11'),auth['isAuthenticated'](),controller[_0x12c4('0x1c')]);router[_0x12c4('0x1a')](_0x12c4('0x13'),auth[_0x12c4('0xb')](),controller[_0x12c4('0x1d')]);module['exports']=router; \ No newline at end of file +var _0xe815=['isAuthenticated','index','/describe','describe','/:id','/:id/members','getMembers','/:id/teams','/:id/users','post','addTeams','addAgents','put','delete','destroy','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./openchannelQueue.controller','get'];(function(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0xe815,0x13a));var _0x5e81=function(_0x1b0edb,_0x4f7765){_0x1b0edb=_0x1b0edb-0x0;var _0x5d186f=_0xe815[_0x1b0edb];return _0x5d186f;};'use strict';var multer=require(_0x5e81('0x0'));var util=require(_0x5e81('0x1'));var path=require(_0x5e81('0x2'));var timeout=require(_0x5e81('0x3'));var express=require(_0x5e81('0x4'));var router=express[_0x5e81('0x5')]();var fs_extra=require(_0x5e81('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x5e81('0x7'));var controller=require(_0x5e81('0x8'));router[_0x5e81('0x9')]('/',auth[_0x5e81('0xa')](),controller[_0x5e81('0xb')]);router[_0x5e81('0x9')](_0x5e81('0xc'),auth[_0x5e81('0xa')](),controller[_0x5e81('0xd')]);router[_0x5e81('0x9')](_0x5e81('0xe'),auth[_0x5e81('0xa')](),controller['show']);router[_0x5e81('0x9')](_0x5e81('0xf'),auth[_0x5e81('0xa')](),controller[_0x5e81('0x10')]);router['get'](_0x5e81('0x11'),auth[_0x5e81('0xa')](),controller['getTeams']);router[_0x5e81('0x9')](_0x5e81('0x12'),auth[_0x5e81('0xa')](),controller['getAgents']);router[_0x5e81('0x13')]('/',auth[_0x5e81('0xa')](),controller['create']);router['post']('/:id/teams',auth[_0x5e81('0xa')](),controller[_0x5e81('0x14')]);router[_0x5e81('0x13')](_0x5e81('0x12'),auth['isAuthenticated'](),controller[_0x5e81('0x15')]);router[_0x5e81('0x16')](_0x5e81('0xe'),auth[_0x5e81('0xa')](),controller['update']);router[_0x5e81('0x17')](_0x5e81('0xe'),auth[_0x5e81('0xa')](),controller[_0x5e81('0x18')]);router[_0x5e81('0x17')](_0x5e81('0x11'),auth['isAuthenticated'](),controller['removeTeams']);router['delete']('/:id/users',auth[_0x5e81('0xa')](),controller[_0x5e81('0x19')]);module[_0x5e81('0x1a')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index d1afcc9..fd00c50 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 _0xfa67=['beepall','roundrobin','sequelize','STRING','name','INTEGER','rrmemory'];(function(_0x2b350c,_0x3427b5){var _0xbb04c2=function(_0x2cb3c7){while(--_0x2cb3c7){_0x2b350c['push'](_0x2b350c['shift']());}};_0xbb04c2(++_0x3427b5);}(_0xfa67,0x1a6));var _0x7fa6=function(_0x43bde0,_0x4621cf){_0x43bde0=_0x43bde0-0x0;var _0x489e57=_0xfa67[_0x43bde0];return _0x489e57;};'use strict';var Sequelize=require(_0x7fa6('0x0'));module['exports']={'name':{'type':Sequelize[_0x7fa6('0x1')],'unique':_0x7fa6('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x7fa6('0x1')]},'timeout':{'type':Sequelize[_0x7fa6('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x7fa6('0x4'),_0x7fa6('0x5'),_0x7fa6('0x6'))}}; \ No newline at end of file +var _0x6bab=['STRING','ENUM','rrmemory','sequelize','exports'];(function(_0x499cbf,_0x353dac){var _0x2ed63a=function(_0x5ad634){while(--_0x5ad634){_0x499cbf['push'](_0x499cbf['shift']());}};_0x2ed63a(++_0x353dac);}(_0x6bab,0x1b6));var _0xb6ba=function(_0x34aec4,_0x3801da){_0x34aec4=_0x34aec4-0x0;var _0x51e1a7=_0x6bab[_0x34aec4];return _0x51e1a7;};'use strict';var Sequelize=require(_0xb6ba('0x0'));module[_0xb6ba('0x1')]={'name':{'type':Sequelize[_0xb6ba('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xb6ba('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xb6ba('0x3')](_0xb6ba('0x4'),'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 e49e342..eb6204d 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 _0x1410=['findOrCreate','forEach','emit','userOpenchannelQueue:save','ids','select','field','from','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','sequelize','SELECT','every','all','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','omit','isArray','merge','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','localhost','socket.io-emitter','./openchannelQueue.socket','register','end','status','json','offset','undefined','count','limit','set','Content-Range','then','get','OpenchannelQueues','stack','name','send','index','map','OpenchannelQueue','rawAttributes','fieldName','type','key','getOptions','where','include','query','params','model','keys','attributes','intersection','fields','options','find','catch','create','user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','destroy','describe','getMembers','findOne','filters','hasOwnProperty','order','sort','pick','filter','UserOpenchannelQueue','findAll','User','UserId','openchannelPause','updatedAt','createdAt','rows','format','%s/%s','getTeams','length','nolimit','addTeams','Team','Agents','online','voicePause','flatMap','transaction','each'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x1410,0x1e6));var _0x0141=function(_0x223a9d,_0x53cd64){_0x223a9d=_0x223a9d-0x0;var _0x5cca43=_0x1410[_0x223a9d];return _0x5cca43;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require(_0x0141('0x0'));var squel=require(_0x0141('0x1'));var Redis=require(_0x0141('0x2'));var qs=require(_0x0141('0x3'));var logger=require(_0x0141('0x4'))(_0x0141('0x5'));var config=require(_0x0141('0x6'));var db=require('../../mysqldb')['db'];config[_0x0141('0x7')]=_['defaults'](config['redis'],{'host':_0x0141('0x8'),'port':0x18eb});var socket=require(_0x0141('0x9'))(new Redis(config[_0x0141('0x7')]));require(_0x0141('0xa'))[_0x0141('0xb')](socket);function respondWithStatusCode(_0x3deac2,_0x46a622){_0x46a622=_0x46a622||0xcc;return function(_0x37ee15){if(_0x37ee15){return _0x3deac2['sendStatus'](_0x46a622);}return _0x3deac2['status'](_0x46a622)[_0x0141('0xc')]();};}function respondWithResult(_0x473f9a,_0x1ef4bf){_0x1ef4bf=_0x1ef4bf||0xc8;return function(_0x17fc00){if(_0x17fc00){return _0x473f9a[_0x0141('0xd')](_0x1ef4bf)[_0x0141('0xe')](_0x17fc00);}};}function respondWithFilteredResult(_0xf7eb9c,_0x2ffd50){return function(_0x50ad75){if(_0x50ad75){var _0x53a003=typeof _0x2ffd50[_0x0141('0xf')]===_0x0141('0x10')&&typeof _0x2ffd50['limit']===_0x0141('0x10');var _0x4bd35e=_0x50ad75[_0x0141('0x11')];var _0x2fcf53=_0x53a003?0x0:_0x2ffd50[_0x0141('0xf')];var _0xff932b=_0x53a003?_0x50ad75[_0x0141('0x11')]:_0x2ffd50['offset']+_0x2ffd50[_0x0141('0x12')];var _0x1eb781;if(_0xff932b>=_0x4bd35e){_0xff932b=_0x4bd35e;_0x1eb781=0xc8;}else{_0x1eb781=0xce;}_0xf7eb9c[_0x0141('0xd')](_0x1eb781);return _0xf7eb9c[_0x0141('0x13')](_0x0141('0x14'),_0x2fcf53+'-'+_0xff932b+'/'+_0x4bd35e)[_0x0141('0xe')](_0x50ad75);}return null;};}function saveUpdates(_0x267fa1){return function(_0x4bca88){if(_0x4bca88){return _0x4bca88['update'](_0x267fa1)[_0x0141('0x15')](function(_0xdd2bb9){return _0xdd2bb9;});}return null;};}function removeEntity(_0x278fbc){return function(_0x84cfa9){if(_0x84cfa9){return _0x84cfa9['destroy']()[_0x0141('0x15')](function(){var _0x34f0e2=_0x84cfa9[_0x0141('0x16')]({'plain':!![]});var _0x398265=_0x0141('0x17');return db['UserProfileResource']['destroy']({'where':{'type':_0x398265,'resourceId':_0x34f0e2['id']}})['then'](function(){return _0x84cfa9;});})['then'](function(){_0x278fbc['status'](0xcc)[_0x0141('0xc')]();});}};}function handleEntityNotFound(_0x14fa6c){return function(_0x19551c){if(!_0x19551c){_0x14fa6c['sendStatus'](0x194);}return _0x19551c;};}function handleError(_0x5e2a24,_0x54308f){_0x54308f=_0x54308f||0x1f4;return function(_0x31ca82){logger['error'](_0x31ca82[_0x0141('0x18')]);if(_0x31ca82['name']){delete _0x31ca82[_0x0141('0x19')];}_0x5e2a24['status'](_0x54308f)[_0x0141('0x1a')](_0x31ca82);};}exports[_0x0141('0x1b')]=function(_0x315f86,_0x2b9222){var _0x16d7eb={};var _0x26ca36={'count':0x0,'rows':[]};var _0x5b357b=_[_0x0141('0x1c')](db[_0x0141('0x1d')][_0x0141('0x1e')],function(_0x23ade0){return{'name':_0x23ade0[_0x0141('0x1f')],'type':_0x23ade0[_0x0141('0x20')][_0x0141('0x21')]};});_0x16d7eb=qs[_0x0141('0x22')](_0x5b357b,_0x315f86);var _0x4ab208={'where':_0x16d7eb[_0x0141('0x23')]};return db['OpenchannelQueue'][_0x0141('0x11')](_0x4ab208)[_0x0141('0x15')](function(_0x21a1e6){_0x26ca36[_0x0141('0x11')]=_0x21a1e6;_0x16d7eb[_0x0141('0x24')]=qs[_0x0141('0x24')](_0x315f86[_0x0141('0x25')]);return db[_0x0141('0x1d')]['findAll'](_0x16d7eb);})[_0x0141('0x15')](function(_0x5a17a5){_0x26ca36['rows']=_0x5a17a5;return _0x26ca36;})[_0x0141('0x15')](respondWithFilteredResult(_0x2b9222,_0x16d7eb))['catch'](handleError(_0x2b9222,null));};exports['show']=function(_0xdd2635,_0x404197){var _0xbc6375={'raw':!![],'where':{'id':_0xdd2635[_0x0141('0x26')]['id']}},_0x379f7d={};_0x379f7d[_0x0141('0x27')]=_[_0x0141('0x28')](db[_0x0141('0x1d')]['rawAttributes']);_0x379f7d[_0x0141('0x25')]=_[_0x0141('0x28')](_0xdd2635[_0x0141('0x25')]);_0x379f7d['filters']=_['intersection'](_0x379f7d[_0x0141('0x27')],_0x379f7d['query']);_0xbc6375[_0x0141('0x29')]=_[_0x0141('0x2a')](_0x379f7d[_0x0141('0x27')],qs[_0x0141('0x2b')](_0xdd2635[_0x0141('0x25')][_0x0141('0x2b')]));_0xbc6375[_0x0141('0x29')]=_0xbc6375[_0x0141('0x29')]['length']?_0xbc6375[_0x0141('0x29')]:_0x379f7d[_0x0141('0x27')];if(_0xdd2635[_0x0141('0x25')]['includeAll']){_0xbc6375['include']=[{'all':!![]}];}_0xbc6375=_['merge']({},_0xbc6375,_0xdd2635[_0x0141('0x2c')]);return db[_0x0141('0x1d')][_0x0141('0x2d')](_0xbc6375)['then'](handleEntityNotFound(_0x404197,null))[_0x0141('0x15')](respondWithResult(_0x404197,null))[_0x0141('0x2e')](handleError(_0x404197,null));};exports['create']=function(_0x2ce7f7,_0x4b6fcf){return db[_0x0141('0x1d')][_0x0141('0x2f')](_0x2ce7f7['body'],{})[_0x0141('0x15')](function(_0x18be76){var _0x3fac37=_0x2ce7f7[_0x0141('0x30')]['get']({'plain':!![]});if(!_0x3fac37)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3fac37[_0x0141('0x31')]==='user'){var _0x17e66c=_0x18be76['get']({'plain':!![]});var _0xda398f=_0x0141('0x17');return db[_0x0141('0x32')][_0x0141('0x2d')]({'where':{'name':_0xda398f,'userProfileId':_0x3fac37[_0x0141('0x33')]},'raw':!![]})[_0x0141('0x15')](function(_0x5bc04f){if(_0x5bc04f&&_0x5bc04f[_0x0141('0x34')]===0x0){return db[_0x0141('0x35')][_0x0141('0x2f')]({'name':_0x17e66c[_0x0141('0x19')],'resourceId':_0x17e66c['id'],'type':_0x5bc04f['name'],'sectionId':_0x5bc04f['id']},{})[_0x0141('0x15')](function(){return _0x18be76;});}else{return _0x18be76;}})[_0x0141('0x2e')](function(_0xe055e4){logger[_0x0141('0x36')](_0x0141('0x37'),_0xe055e4);throw _0xe055e4;});}return _0x18be76;})[_0x0141('0x15')](respondWithResult(_0x4b6fcf,0xc9))[_0x0141('0x2e')](handleError(_0x4b6fcf,null));};exports[_0x0141('0x38')]=function(_0x531d2c,_0x2c75ca){if(_0x531d2c[_0x0141('0x39')]['id']){delete _0x531d2c[_0x0141('0x39')]['id'];}return db[_0x0141('0x1d')]['find']({'where':{'id':_0x531d2c[_0x0141('0x26')]['id']}})[_0x0141('0x15')](handleEntityNotFound(_0x2c75ca,null))[_0x0141('0x15')](saveUpdates(_0x531d2c[_0x0141('0x39')],null))['then'](respondWithResult(_0x2c75ca,null))['catch'](handleError(_0x2c75ca,null));};exports[_0x0141('0x3a')]=function(_0x4ed577,_0x1a779f){return db['OpenchannelQueue'][_0x0141('0x2d')]({'where':{'id':_0x4ed577[_0x0141('0x26')]['id']}})['then'](handleEntityNotFound(_0x1a779f,null))[_0x0141('0x15')](removeEntity(_0x1a779f,null))[_0x0141('0x2e')](handleError(_0x1a779f,null));};exports[_0x0141('0x3b')]=function(_0x48313a,_0x28b3be){return db[_0x0141('0x1d')][_0x0141('0x3b')]()[_0x0141('0x15')](respondWithResult(_0x28b3be,null))['catch'](handleError(_0x28b3be,null));};exports[_0x0141('0x3c')]=function(_0x33ff92,_0x2c8ed9){var _0x236e23={'raw':!![],'where':{}},_0x557d13={},_0x3afa12;return db[_0x0141('0x1d')][_0x0141('0x3d')]({'where':{'id':_0x33ff92['params']['id']}})[_0x0141('0x15')](handleEntityNotFound(_0x2c8ed9,null))[_0x0141('0x15')](function(_0x4aed4a){if(_0x4aed4a){_0x3afa12=_0x4aed4a[_0x0141('0x16')]({'plain':!![]});_0x557d13[_0x0141('0x27')]=_['keys'](db['UserOpenchannelQueue'][_0x0141('0x1e')]);_0x557d13[_0x0141('0x25')]=_[_0x0141('0x28')](_0x33ff92['query']);_0x557d13[_0x0141('0x3e')]=_['intersection'](_0x557d13[_0x0141('0x27')],_0x557d13[_0x0141('0x25')]);_0x236e23[_0x0141('0x29')]=_['intersection'](_0x557d13[_0x0141('0x27')],qs[_0x0141('0x2b')](_0x33ff92[_0x0141('0x25')]['fields']));_0x236e23[_0x0141('0x29')]=_0x236e23[_0x0141('0x29')]['length']?_0x236e23['attributes']:_0x557d13['model'];if(!_0x33ff92[_0x0141('0x25')][_0x0141('0x3f')]('nolimit')){_0x236e23['limit']=qs[_0x0141('0x12')](_0x33ff92['query'][_0x0141('0x12')]);_0x236e23['offset']=qs[_0x0141('0xf')](_0x33ff92[_0x0141('0x25')]['offset']);}_0x236e23[_0x0141('0x40')]=qs[_0x0141('0x41')](_0x33ff92['query']['sort']);_0x236e23[_0x0141('0x23')]=qs[_0x0141('0x3e')](_[_0x0141('0x42')](_0x33ff92[_0x0141('0x25')],_0x557d13[_0x0141('0x3e')]));_0x236e23['where']['OpenchannelQueueId']=_0x4aed4a['id'];if(_0x33ff92[_0x0141('0x25')][_0x0141('0x43')]){_0x236e23[_0x0141('0x23')]=_['merge'](_0x236e23[_0x0141('0x23')],{'$or':_['map'](_0x236e23['attributes'],function(_0x58fae2){var _0x4813a9={};_0x4813a9[_0x58fae2]={'$like':'%'+_0x33ff92[_0x0141('0x25')][_0x0141('0x43')]+'%'};return _0x4813a9;})});}_0x236e23=_['merge']({},_0x236e23,_0x33ff92[_0x0141('0x2c')]);return db[_0x0141('0x44')][_0x0141('0x45')](_0x236e23);}})[_0x0141('0x15')](function(_0x21bd2f){if(_0x21bd2f){return db[_0x0141('0x46')]['findAndCountAll']({'where':{'id':_['map'](_0x21bd2f,_0x0141('0x47')),'role':'agent'},'attributes':['id',_0x0141('0x19'),_0x0141('0x48'),_0x0141('0x49'),_0x0141('0x4a')]});}})[_0x0141('0x15')](function(_0x3dfce0){if(_0x3dfce0){return{'count':_0x3dfce0[_0x0141('0x11')],'rows':_[_0x0141('0x1c')](_0x3dfce0[_0x0141('0x4b')],function(_0x195fd8){return{'membername':_0x195fd8[_0x0141('0x19')],'UserId':_0x195fd8['id'],'queue_name':_0x3afa12[_0x0141('0x19')],'OpenchannelQueueId':_0x3afa12['id'],'interface':util[_0x0141('0x4c')](_0x0141('0x4d'),'SIP',_0x195fd8[_0x0141('0x19')]),'penalty':0x0,'paused':_0x195fd8[_0x0141('0x48')],'createdAt':_0x195fd8[_0x0141('0x4a')],'updatedAt':_0x195fd8[_0x0141('0x49')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x2c8ed9,_0x236e23))['catch'](handleError(_0x2c8ed9,null));};exports[_0x0141('0x4e')]=function(_0x48233d,_0x75280){var _0xcbf7f6={};var _0x408cd5={};var _0xffdc9f;var _0x2b1158;return db[_0x0141('0x1d')][_0x0141('0x3d')]({'where':{'id':_0x48233d[_0x0141('0x26')]['id']}})[_0x0141('0x15')](handleEntityNotFound(_0x75280,null))[_0x0141('0x15')](function(_0x6ebd56){if(_0x6ebd56){_0xffdc9f=_0x6ebd56;_0x408cd5[_0x0141('0x27')]=_[_0x0141('0x28')](db['Team'][_0x0141('0x1e')]);_0x408cd5['query']=_['keys'](_0x48233d[_0x0141('0x25')]);_0x408cd5[_0x0141('0x3e')]=_['intersection'](_0x408cd5[_0x0141('0x27')],_0x408cd5['query']);_0xcbf7f6['attributes']=_[_0x0141('0x2a')](_0x408cd5[_0x0141('0x27')],qs[_0x0141('0x2b')](_0x48233d[_0x0141('0x25')][_0x0141('0x2b')]));_0xcbf7f6['attributes']=_0xcbf7f6[_0x0141('0x29')][_0x0141('0x4f')]?_0xcbf7f6['attributes']:_0x408cd5[_0x0141('0x27')];_0xcbf7f6[_0x0141('0x40')]=qs[_0x0141('0x41')](_0x48233d[_0x0141('0x25')][_0x0141('0x41')]);_0xcbf7f6[_0x0141('0x23')]=qs[_0x0141('0x3e')](_['pick'](_0x48233d[_0x0141('0x25')],_0x408cd5[_0x0141('0x3e')]));if(_0x48233d[_0x0141('0x25')][_0x0141('0x43')]){_0xcbf7f6[_0x0141('0x23')]=_['merge'](_0xcbf7f6[_0x0141('0x23')],{'$or':_[_0x0141('0x1c')](_0xcbf7f6['attributes'],function(_0x44d576){var _0x5e471b={};_0x5e471b[_0x44d576]={'$like':'%'+_0x48233d[_0x0141('0x25')]['filter']+'%'};return _0x5e471b;})});}_0xcbf7f6=_['merge']({},_0xcbf7f6,_0x48233d[_0x0141('0x2c')]);return _0xffdc9f['getTeams'](_0xcbf7f6);}})[_0x0141('0x15')](function(_0x84ce6d){if(_0x84ce6d){_0x2b1158=_0x84ce6d[_0x0141('0x4f')];if(!_0x48233d[_0x0141('0x25')][_0x0141('0x3f')](_0x0141('0x50'))){_0xcbf7f6['limit']=qs[_0x0141('0x12')](_0x48233d[_0x0141('0x25')][_0x0141('0x12')]);_0xcbf7f6[_0x0141('0xf')]=qs['offset'](_0x48233d[_0x0141('0x25')][_0x0141('0xf')]);}return _0xffdc9f[_0x0141('0x4e')](_0xcbf7f6);}})[_0x0141('0x15')](function(_0x515c1b){if(_0x515c1b){return _0x515c1b?{'count':_0x2b1158,'rows':_0x515c1b}:null;}})[_0x0141('0x15')](respondWithResult(_0x75280,null))[_0x0141('0x2e')](handleError(_0x75280,null));};exports[_0x0141('0x51')]=function(_0x7b2fda,_0x40a52d){var _0x4e77e7=_0x7b2fda['body']['ids'];return db[_0x0141('0x52')][_0x0141('0x45')]({'where':{'id':_0x4e77e7},'attributes':['id'],'include':[{'model':db[_0x0141('0x46')],'as':_0x0141('0x53'),'attributes':['id',_0x0141('0x19'),_0x0141('0x54'),_0x0141('0x55'),'interface'],'raw':!![]}]})[_0x0141('0x15')](function(_0x7d3578){if(_0x7d3578){var _0x8f40ab=_[_0x0141('0x56')](_0x7d3578,function(_0x5151ef){var _0x263216=_0x5151ef[_0x0141('0x16')]({'plain':!![]});return _0x263216[_0x0141('0x53')];});return db[_0x0141('0x1d')][_0x0141('0x2d')]({'where':{'id':_0x7b2fda[_0x0141('0x26')]['id']}})[_0x0141('0x15')](function(_0x1a303c){return db['sequelize'][_0x0141('0x57')](function(_0x1cfc22){return _0x1a303c[_0x0141('0x51')](_0x4e77e7,{'transaction':_0x1cfc22})[_0x0141('0x15')](function(){return BPromise[_0x0141('0x58')](_0x8f40ab,function(_0x2eb494){return db['UserOpenchannelQueue'][_0x0141('0x59')]({'where':{'UserId':_0x2eb494['id'],'OpenchannelQueueId':_0x7b2fda['params']['id']},'transaction':_0x1cfc22});});})['then'](function(){_0x8f40ab[_0x0141('0x5a')](function(_0x335840){socket[_0x0141('0x5b')](_0x0141('0x5c'),{'UserId':_0x335840['id'],'OpenchannelQueueId':_0x1a303c['id']});});});});});}})[_0x0141('0x15')](respondWithStatusCode(_0x40a52d,null))[_0x0141('0x2e')](handleError(_0x40a52d,null));};exports['removeTeams']=function(_0x1732d1,_0x2f1e7f){return db[_0x0141('0x52')][_0x0141('0x45')]({'where':{'id':_0x1732d1[_0x0141('0x25')][_0x0141('0x5d')]},'attributes':['id'],'include':[{'model':db[_0x0141('0x46')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x0141('0x15')](handleEntityNotFound(_0x2f1e7f,null))[_0x0141('0x15')](function(_0x5a3394){var _0x5c6598=_[_0x0141('0x1c')](_0x5a3394,'id');var _0x5e20a2=[];var _0x55768b=[];var _0x49456c=squel[_0x0141('0x5e')]();_0x49456c[_0x0141('0x5f')]('tq.TeamId')[_0x0141('0x60')](_0x0141('0x61'),'tq')[_0x0141('0x62')](_0x0141('0x63'),'ut',_0x0141('0x64'))[_0x0141('0x23')](_0x0141('0x65'),_0x1732d1[_0x0141('0x26')]['id']);for(var _0x483b73=0x0;_0x483b73<_0x5a3394['length'];_0x483b73+=0x1){let _0x1236d0=_0x5a3394[_0x483b73];for(var _0x1953c8=0x0;_0x1953c8<_0x1236d0[_0x0141('0x53')]['length'];_0x1953c8+=0x1){let _0x2dd977=_0x1236d0[_0x0141('0x53')][_0x1953c8];var _0x2abb7c=_0x49456c['clone']();_0x2abb7c[_0x0141('0x23')](_0x0141('0x66'),_0x2dd977['id']);_0x55768b[_0x0141('0x67')](db[_0x0141('0x68')][_0x0141('0x25')](_0x2abb7c['toString'](),{'type':db[_0x0141('0x68')]['QueryTypes'][_0x0141('0x69')]})[_0x0141('0x15')](function(_0x55428e){if(_0x55428e[_0x0141('0x4f')]===0x1){return _0x2dd977['id'];}else{var _0x1cf9f8=_[_0x0141('0x6a')](_[_0x0141('0x1c')](_0x55428e,'TeamId'),function(_0x2bfbe8){return _['includes'](_0x5c6598,_0x2bfbe8);});if(_0x1cf9f8){return _0x2dd977['id'];}}}));}}return BPromise[_0x0141('0x6b')](_0x55768b)['then'](function(_0x300a2c){_0x5e20a2=_(_0x5e20a2)['union'](_0x300a2c)['compact']()['value']();return db[_0x0141('0x1d')][_0x0141('0x2d')]({'where':{'id':_0x1732d1['params']['id']}})[_0x0141('0x15')](function(_0x4ee6ce){return db['sequelize'][_0x0141('0x57')](function(_0x20250c){return _0x4ee6ce['removeTeams'](_0x1732d1[_0x0141('0x25')][_0x0141('0x5d')],{'transaction':_0x20250c})[_0x0141('0x15')](function(){if(!_[_0x0141('0x6c')](_0x5e20a2)){return _0x4ee6ce[_0x0141('0x6d')](_0x5e20a2,{'transaction':_0x20250c});}})[_0x0141('0x15')](function(){_0x5e20a2[_0x0141('0x5a')](function(_0x2b088a){socket['emit'](_0x0141('0x6e'),{'UserId':_0x2b088a,'OpenchannelQueueId':_0x4ee6ce['id']});});});});});});})[_0x0141('0x15')](respondWithStatusCode(_0x2f1e7f,null))[_0x0141('0x2e')](handleError(_0x2f1e7f,null));};exports[_0x0141('0x6f')]=function(_0x28aa0c,_0x4bd7a7){return db['OpenchannelQueue'][_0x0141('0x2d')]({'where':{'id':_0x28aa0c[_0x0141('0x26')]['id']}})['then'](handleEntityNotFound(_0x4bd7a7,null))[_0x0141('0x15')](function(_0x4e31e3){if(_0x4e31e3){return _0x4e31e3[_0x0141('0x6f')](_0x28aa0c['body'][_0x0141('0x5d')],_[_0x0141('0x70')](_0x28aa0c[_0x0141('0x39')],['ids','id'])||{})['spread'](function(_0x278f41){for(var _0x3758fe=0x0;_0x3758fe<_0x28aa0c[_0x0141('0x39')][_0x0141('0x5d')]['length'];_0x3758fe+=0x1){socket[_0x0141('0x5b')](_0x0141('0x5c'),{'UserId':Number(_0x28aa0c[_0x0141('0x39')][_0x0141('0x5d')][_0x3758fe]),'OpenchannelQueueId':Number(_0x28aa0c[_0x0141('0x26')]['id'])});}return _0x278f41;});}})[_0x0141('0x15')](respondWithResult(_0x4bd7a7,null))[_0x0141('0x2e')](handleError(_0x4bd7a7,null));};exports[_0x0141('0x6d')]=function(_0x48f71f,_0x249f29){return db[_0x0141('0x1d')]['find']({'where':{'id':_0x48f71f['params']['id']}})[_0x0141('0x15')](handleEntityNotFound(_0x249f29,null))['then'](function(_0x41e232){if(_0x41e232){return _0x41e232[_0x0141('0x6d')](_0x48f71f[_0x0141('0x25')][_0x0141('0x5d')])[_0x0141('0x15')](function(){if(_[_0x0141('0x71')](_0x48f71f[_0x0141('0x25')]['ids'])){for(var _0x3318cd=0x0;_0x3318cd<_0x48f71f[_0x0141('0x25')]['ids'][_0x0141('0x4f')];_0x3318cd+=0x1){socket[_0x0141('0x5b')](_0x0141('0x6e'),{'UserId':Number(_0x48f71f[_0x0141('0x25')][_0x0141('0x5d')][_0x3318cd]),'OpenchannelQueueId':Number(_0x48f71f[_0x0141('0x26')]['id'])});}}else{socket['emit']('userOpenchannelQueue:remove',{'UserId':Number(_0x48f71f[_0x0141('0x25')][_0x0141('0x5d')]),'OpenchannelQueueId':Number(_0x48f71f['params']['id'])});}});}})[_0x0141('0x15')](respondWithStatusCode(_0x249f29,null))[_0x0141('0x2e')](handleError(_0x249f29,null));};exports['getAgents']=function(_0x279938,_0x4d8ea9){var _0x55a2d5={};var _0x2ec000={};var _0x45a0f1;var _0x1949e0;return db[_0x0141('0x1d')][_0x0141('0x3d')]({'where':{'id':_0x279938['params']['id']}})[_0x0141('0x15')](handleEntityNotFound(_0x4d8ea9,null))['then'](function(_0x38ef82){if(_0x38ef82){_0x45a0f1=_0x38ef82;_0x2ec000['model']=_[_0x0141('0x28')](db[_0x0141('0x46')][_0x0141('0x1e')]);_0x2ec000[_0x0141('0x25')]=_[_0x0141('0x28')](_0x279938[_0x0141('0x25')]);_0x2ec000['filters']=_[_0x0141('0x2a')](_0x2ec000[_0x0141('0x27')],_0x2ec000[_0x0141('0x25')]);_0x55a2d5[_0x0141('0x29')]=_[_0x0141('0x2a')](_0x2ec000[_0x0141('0x27')],qs['fields'](_0x279938[_0x0141('0x25')][_0x0141('0x2b')]));_0x55a2d5[_0x0141('0x29')]=_0x55a2d5['attributes'][_0x0141('0x4f')]?_0x55a2d5[_0x0141('0x29')]:_0x2ec000[_0x0141('0x27')];_0x55a2d5[_0x0141('0x40')]=qs[_0x0141('0x41')](_0x279938[_0x0141('0x25')][_0x0141('0x41')]);_0x55a2d5[_0x0141('0x23')]=qs[_0x0141('0x3e')](_['pick'](_0x279938['query'],_0x2ec000[_0x0141('0x3e')]));if(_0x279938[_0x0141('0x25')][_0x0141('0x43')]){_0x55a2d5[_0x0141('0x23')]=_['merge'](_0x55a2d5[_0x0141('0x23')],{'$or':_[_0x0141('0x1c')](_0x55a2d5[_0x0141('0x29')],function(_0x21054f){var _0x16587e={};_0x16587e[_0x21054f]={'$like':'%'+_0x279938[_0x0141('0x25')][_0x0141('0x43')]+'%'};return _0x16587e;})});}_0x55a2d5=_[_0x0141('0x72')]({},_0x55a2d5,_0x279938[_0x0141('0x2c')]);return _0x45a0f1['getAgents'](_0x55a2d5);}})[_0x0141('0x15')](function(_0x9cce58){if(_0x9cce58){_0x1949e0=_0x9cce58[_0x0141('0x4f')];if(!_0x279938[_0x0141('0x25')][_0x0141('0x3f')](_0x0141('0x50'))){_0x55a2d5[_0x0141('0x12')]=qs[_0x0141('0x12')](_0x279938['query']['limit']);_0x55a2d5[_0x0141('0xf')]=qs[_0x0141('0xf')](_0x279938[_0x0141('0x25')][_0x0141('0xf')]);}return _0x45a0f1['getAgents'](_0x55a2d5);}})['then'](function(_0x55346f){if(_0x55346f){return _0x55346f?{'count':_0x1949e0,'rows':_0x55346f}:null;}})[_0x0141('0x15')](respondWithResult(_0x4d8ea9,null))[_0x0141('0x2e')](handleError(_0x4d8ea9,null));}; \ No newline at end of file +var _0x1351=['../../components/parsers/qs','../../config/logger','api','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./openchannelQueue.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','get','OpenchannelQueues','UserProfileResource','error','name','send','index','map','OpenchannelQueue','fieldName','type','key','getOptions','where','then','include','findAll','catch','params','model','rawAttributes','query','filters','intersection','attributes','fields','length','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','keys','UserOpenchannelQueue','hasOwnProperty','nolimit','order','pick','filter','merge','User','findAndCountAll','UserId','openchannelPause','rows','%s/%s','SIP','updatedAt','getTeams','findOne','sort','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','Team','select','field','tq.TeamId','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','TeamId','compact','value','isEmpty','removeAgents','userOpenchannelQueue:remove','omit','spread','isArray','getAgents','bluebird','util','lodash','squel','ioredis'];(function(_0x3a7a9c,_0x24f7d6){var _0x59156e=function(_0x5bc930){while(--_0x5bc930){_0x3a7a9c['push'](_0x3a7a9c['shift']());}};_0x59156e(++_0x24f7d6);}(_0x1351,0xf5));var _0x1135=function(_0x173b05,_0x381418){_0x173b05=_0x173b05-0x0;var _0x105c54=_0x1351[_0x173b05];return _0x105c54;};'use strict';var BPromise=require(_0x1135('0x0'));var util=require(_0x1135('0x1'));var _=require(_0x1135('0x2'));var squel=require(_0x1135('0x3'));var Redis=require(_0x1135('0x4'));var qs=require(_0x1135('0x5'));var logger=require(_0x1135('0x6'))(_0x1135('0x7'));var config=require('../../config/environment');var db=require(_0x1135('0x8'))['db'];config['redis']=_[_0x1135('0x9')](config['redis'],{'host':_0x1135('0xa'),'port':0x18eb});var socket=require(_0x1135('0xb'))(new Redis(config[_0x1135('0xc')]));require(_0x1135('0xd'))[_0x1135('0xe')](socket);function respondWithStatusCode(_0x458876,_0x4fd5c0){_0x4fd5c0=_0x4fd5c0||0xcc;return function(_0x46f3f1){if(_0x46f3f1){return _0x458876[_0x1135('0xf')](_0x4fd5c0);}return _0x458876['status'](_0x4fd5c0)[_0x1135('0x10')]();};}function respondWithResult(_0x289035,_0x29a569){_0x29a569=_0x29a569||0xc8;return function(_0x42ea65){if(_0x42ea65){return _0x289035[_0x1135('0x11')](_0x29a569)[_0x1135('0x12')](_0x42ea65);}};}function respondWithFilteredResult(_0x2be0c5,_0x563c71){return function(_0x397133){if(_0x397133){var _0x5cca43=typeof _0x563c71[_0x1135('0x13')]===_0x1135('0x14')&&typeof _0x563c71[_0x1135('0x15')]===_0x1135('0x14');var _0x4c7f33=_0x397133[_0x1135('0x16')];var _0x4fe4d7=_0x5cca43?0x0:_0x563c71[_0x1135('0x13')];var _0x5d4fbf=_0x5cca43?_0x397133[_0x1135('0x16')]:_0x563c71[_0x1135('0x13')]+_0x563c71['limit'];var _0x44020e;if(_0x5d4fbf>=_0x4c7f33){_0x5d4fbf=_0x4c7f33;_0x44020e=0xc8;}else{_0x44020e=0xce;}_0x2be0c5[_0x1135('0x11')](_0x44020e);return _0x2be0c5[_0x1135('0x17')](_0x1135('0x18'),_0x4fe4d7+'-'+_0x5d4fbf+'/'+_0x4c7f33)[_0x1135('0x12')](_0x397133);}return null;};}function saveUpdates(_0x3a9f17){return function(_0x44e933){if(_0x44e933){return _0x44e933[_0x1135('0x19')](_0x3a9f17)['then'](function(_0x58b8dd){return _0x58b8dd;});}return null;};}function removeEntity(_0x5dc772){return function(_0x29af3d){if(_0x29af3d){return _0x29af3d[_0x1135('0x1a')]()['then'](function(){var _0x3ef47c=_0x29af3d[_0x1135('0x1b')]({'plain':!![]});var _0x577f03=_0x1135('0x1c');return db[_0x1135('0x1d')][_0x1135('0x1a')]({'where':{'type':_0x577f03,'resourceId':_0x3ef47c['id']}})['then'](function(){return _0x29af3d;});})['then'](function(){_0x5dc772[_0x1135('0x11')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1bba3e){return function(_0x3d4d5d){if(!_0x3d4d5d){_0x1bba3e[_0x1135('0xf')](0x194);}return _0x3d4d5d;};}function handleError(_0x38755e,_0x4728de){_0x4728de=_0x4728de||0x1f4;return function(_0x117447){logger[_0x1135('0x1e')](_0x117447['stack']);if(_0x117447[_0x1135('0x1f')]){delete _0x117447[_0x1135('0x1f')];}_0x38755e['status'](_0x4728de)[_0x1135('0x20')](_0x117447);};}exports[_0x1135('0x21')]=function(_0x104a3f,_0x45cb64){var _0x247b91={};var _0x17239e={'count':0x0,'rows':[]};var _0x5eac92=_[_0x1135('0x22')](db[_0x1135('0x23')]['rawAttributes'],function(_0x23da0a){return{'name':_0x23da0a[_0x1135('0x24')],'type':_0x23da0a[_0x1135('0x25')][_0x1135('0x26')]};});_0x247b91=qs[_0x1135('0x27')](_0x5eac92,_0x104a3f);var _0x3c75ba={'where':_0x247b91[_0x1135('0x28')]};return db[_0x1135('0x23')][_0x1135('0x16')](_0x3c75ba)[_0x1135('0x29')](function(_0x5299b6){_0x17239e[_0x1135('0x16')]=_0x5299b6;_0x247b91[_0x1135('0x2a')]=qs[_0x1135('0x2a')](_0x104a3f['query']);return db[_0x1135('0x23')][_0x1135('0x2b')](_0x247b91);})[_0x1135('0x29')](function(_0x8dbf1b){_0x17239e['rows']=_0x8dbf1b;return _0x17239e;})[_0x1135('0x29')](respondWithFilteredResult(_0x45cb64,_0x247b91))[_0x1135('0x2c')](handleError(_0x45cb64,null));};exports['show']=function(_0x1043d8,_0x260d33){var _0x1399bf={'raw':!![],'where':{'id':_0x1043d8[_0x1135('0x2d')]['id']}},_0x3fd34e={};_0x3fd34e[_0x1135('0x2e')]=_['keys'](db[_0x1135('0x23')][_0x1135('0x2f')]);_0x3fd34e['query']=_['keys'](_0x1043d8[_0x1135('0x30')]);_0x3fd34e[_0x1135('0x31')]=_[_0x1135('0x32')](_0x3fd34e[_0x1135('0x2e')],_0x3fd34e[_0x1135('0x30')]);_0x1399bf[_0x1135('0x33')]=_[_0x1135('0x32')](_0x3fd34e[_0x1135('0x2e')],qs[_0x1135('0x34')](_0x1043d8[_0x1135('0x30')]['fields']));_0x1399bf[_0x1135('0x33')]=_0x1399bf['attributes'][_0x1135('0x35')]?_0x1399bf[_0x1135('0x33')]:_0x3fd34e['model'];if(_0x1043d8['query']['includeAll']){_0x1399bf['include']=[{'all':!![]}];}_0x1399bf=_['merge']({},_0x1399bf,_0x1043d8[_0x1135('0x36')]);return db[_0x1135('0x23')][_0x1135('0x37')](_0x1399bf)[_0x1135('0x29')](handleEntityNotFound(_0x260d33,null))[_0x1135('0x29')](respondWithResult(_0x260d33,null))[_0x1135('0x2c')](handleError(_0x260d33,null));};exports[_0x1135('0x38')]=function(_0x44bfd4,_0x7a9594){return db[_0x1135('0x23')][_0x1135('0x38')](_0x44bfd4['body'],{})[_0x1135('0x29')](function(_0x2574bc){var _0x4e8d7f=_0x44bfd4[_0x1135('0x39')][_0x1135('0x1b')]({'plain':!![]});if(!_0x4e8d7f)throw new Error(_0x1135('0x3a'));if(_0x4e8d7f[_0x1135('0x3b')]===_0x1135('0x39')){var _0x496c1a=_0x2574bc[_0x1135('0x1b')]({'plain':!![]});var _0xaa34c2=_0x1135('0x1c');return db[_0x1135('0x3c')]['find']({'where':{'name':_0xaa34c2,'userProfileId':_0x4e8d7f[_0x1135('0x3d')]},'raw':!![]})['then'](function(_0x13756c){if(_0x13756c&&_0x13756c[_0x1135('0x3e')]===0x0){return db[_0x1135('0x1d')][_0x1135('0x38')]({'name':_0x496c1a[_0x1135('0x1f')],'resourceId':_0x496c1a['id'],'type':_0x13756c[_0x1135('0x1f')],'sectionId':_0x13756c['id']},{})['then'](function(){return _0x2574bc;});}else{return _0x2574bc;}})[_0x1135('0x2c')](function(_0x17ce6){logger['error'](_0x1135('0x3f'),_0x17ce6);throw _0x17ce6;});}return _0x2574bc;})['then'](respondWithResult(_0x7a9594,0xc9))[_0x1135('0x2c')](handleError(_0x7a9594,null));};exports[_0x1135('0x19')]=function(_0x37add6,_0x4beb71){if(_0x37add6[_0x1135('0x40')]['id']){delete _0x37add6[_0x1135('0x40')]['id'];}return db[_0x1135('0x23')][_0x1135('0x37')]({'where':{'id':_0x37add6[_0x1135('0x2d')]['id']}})[_0x1135('0x29')](handleEntityNotFound(_0x4beb71,null))[_0x1135('0x29')](saveUpdates(_0x37add6[_0x1135('0x40')],null))[_0x1135('0x29')](respondWithResult(_0x4beb71,null))['catch'](handleError(_0x4beb71,null));};exports[_0x1135('0x1a')]=function(_0x40ce22,_0xda0a52){return db[_0x1135('0x23')][_0x1135('0x37')]({'where':{'id':_0x40ce22[_0x1135('0x2d')]['id']}})[_0x1135('0x29')](handleEntityNotFound(_0xda0a52,null))[_0x1135('0x29')](removeEntity(_0xda0a52,null))[_0x1135('0x2c')](handleError(_0xda0a52,null));};exports[_0x1135('0x41')]=function(_0x242c44,_0x45d1aa){return db[_0x1135('0x23')]['describe']()[_0x1135('0x29')](respondWithResult(_0x45d1aa,null))[_0x1135('0x2c')](handleError(_0x45d1aa,null));};exports[_0x1135('0x42')]=function(_0x48f00c,_0x315314){var _0x373354={'raw':!![],'where':{}},_0x30c78c={},_0x4efe08;return db[_0x1135('0x23')]['findOne']({'where':{'id':_0x48f00c[_0x1135('0x2d')]['id']}})['then'](handleEntityNotFound(_0x315314,null))['then'](function(_0xd49f8a){if(_0xd49f8a){_0x4efe08=_0xd49f8a['get']({'plain':!![]});_0x30c78c['model']=_[_0x1135('0x43')](db[_0x1135('0x44')]['rawAttributes']);_0x30c78c[_0x1135('0x30')]=_['keys'](_0x48f00c[_0x1135('0x30')]);_0x30c78c[_0x1135('0x31')]=_[_0x1135('0x32')](_0x30c78c[_0x1135('0x2e')],_0x30c78c[_0x1135('0x30')]);_0x373354[_0x1135('0x33')]=_['intersection'](_0x30c78c[_0x1135('0x2e')],qs[_0x1135('0x34')](_0x48f00c['query'][_0x1135('0x34')]));_0x373354[_0x1135('0x33')]=_0x373354[_0x1135('0x33')][_0x1135('0x35')]?_0x373354[_0x1135('0x33')]:_0x30c78c['model'];if(!_0x48f00c[_0x1135('0x30')][_0x1135('0x45')](_0x1135('0x46'))){_0x373354['limit']=qs['limit'](_0x48f00c[_0x1135('0x30')]['limit']);_0x373354[_0x1135('0x13')]=qs[_0x1135('0x13')](_0x48f00c[_0x1135('0x30')]['offset']);}_0x373354[_0x1135('0x47')]=qs['sort'](_0x48f00c[_0x1135('0x30')]['sort']);_0x373354[_0x1135('0x28')]=qs[_0x1135('0x31')](_[_0x1135('0x48')](_0x48f00c[_0x1135('0x30')],_0x30c78c[_0x1135('0x31')]));_0x373354['where']['OpenchannelQueueId']=_0xd49f8a['id'];if(_0x48f00c[_0x1135('0x30')][_0x1135('0x49')]){_0x373354['where']=_[_0x1135('0x4a')](_0x373354[_0x1135('0x28')],{'$or':_[_0x1135('0x22')](_0x373354[_0x1135('0x33')],function(_0x43d2cb){var _0x2ab869={};_0x2ab869[_0x43d2cb]={'$like':'%'+_0x48f00c[_0x1135('0x30')][_0x1135('0x49')]+'%'};return _0x2ab869;})});}_0x373354=_['merge']({},_0x373354,_0x48f00c[_0x1135('0x36')]);return db[_0x1135('0x44')][_0x1135('0x2b')](_0x373354);}})[_0x1135('0x29')](function(_0x2451d3){if(_0x2451d3){return db[_0x1135('0x4b')][_0x1135('0x4c')]({'where':{'id':_[_0x1135('0x22')](_0x2451d3,_0x1135('0x4d')),'role':'agent'},'attributes':['id',_0x1135('0x1f'),_0x1135('0x4e'),'updatedAt','createdAt']});}})['then'](function(_0x3bae0a){if(_0x3bae0a){return{'count':_0x3bae0a['count'],'rows':_['map'](_0x3bae0a[_0x1135('0x4f')],function(_0x8d3223){return{'membername':_0x8d3223[_0x1135('0x1f')],'UserId':_0x8d3223['id'],'queue_name':_0x4efe08['name'],'OpenchannelQueueId':_0x4efe08['id'],'interface':util['format'](_0x1135('0x50'),_0x1135('0x51'),_0x8d3223['name']),'penalty':0x0,'paused':_0x8d3223[_0x1135('0x4e')],'createdAt':_0x8d3223['createdAt'],'updatedAt':_0x8d3223[_0x1135('0x52')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x1135('0x29')](respondWithFilteredResult(_0x315314,_0x373354))[_0x1135('0x2c')](handleError(_0x315314,null));};exports[_0x1135('0x53')]=function(_0x10810f,_0x1a3ba7){var _0x67e477={};var _0x58d79d={};var _0x476ea6;var _0x2f179f;return db['OpenchannelQueue'][_0x1135('0x54')]({'where':{'id':_0x10810f[_0x1135('0x2d')]['id']}})[_0x1135('0x29')](handleEntityNotFound(_0x1a3ba7,null))[_0x1135('0x29')](function(_0xa7fbb2){if(_0xa7fbb2){_0x476ea6=_0xa7fbb2;_0x58d79d['model']=_[_0x1135('0x43')](db['Team']['rawAttributes']);_0x58d79d[_0x1135('0x30')]=_[_0x1135('0x43')](_0x10810f[_0x1135('0x30')]);_0x58d79d[_0x1135('0x31')]=_[_0x1135('0x32')](_0x58d79d[_0x1135('0x2e')],_0x58d79d[_0x1135('0x30')]);_0x67e477['attributes']=_[_0x1135('0x32')](_0x58d79d['model'],qs[_0x1135('0x34')](_0x10810f[_0x1135('0x30')][_0x1135('0x34')]));_0x67e477['attributes']=_0x67e477[_0x1135('0x33')][_0x1135('0x35')]?_0x67e477['attributes']:_0x58d79d['model'];_0x67e477[_0x1135('0x47')]=qs[_0x1135('0x55')](_0x10810f['query'][_0x1135('0x55')]);_0x67e477[_0x1135('0x28')]=qs[_0x1135('0x31')](_[_0x1135('0x48')](_0x10810f['query'],_0x58d79d[_0x1135('0x31')]));if(_0x10810f['query'][_0x1135('0x49')]){_0x67e477['where']=_[_0x1135('0x4a')](_0x67e477['where'],{'$or':_[_0x1135('0x22')](_0x67e477['attributes'],function(_0x382fe5){var _0x164808={};_0x164808[_0x382fe5]={'$like':'%'+_0x10810f[_0x1135('0x30')][_0x1135('0x49')]+'%'};return _0x164808;})});}_0x67e477=_[_0x1135('0x4a')]({},_0x67e477,_0x10810f[_0x1135('0x36')]);return _0x476ea6[_0x1135('0x53')](_0x67e477);}})[_0x1135('0x29')](function(_0x568b82){if(_0x568b82){_0x2f179f=_0x568b82[_0x1135('0x35')];if(!_0x10810f['query'][_0x1135('0x45')](_0x1135('0x46'))){_0x67e477[_0x1135('0x15')]=qs[_0x1135('0x15')](_0x10810f[_0x1135('0x30')][_0x1135('0x15')]);_0x67e477[_0x1135('0x13')]=qs[_0x1135('0x13')](_0x10810f['query'][_0x1135('0x13')]);}return _0x476ea6[_0x1135('0x53')](_0x67e477);}})[_0x1135('0x29')](function(_0xb1b1fa){if(_0xb1b1fa){return _0xb1b1fa?{'count':_0x2f179f,'rows':_0xb1b1fa}:null;}})[_0x1135('0x29')](respondWithResult(_0x1a3ba7,null))[_0x1135('0x2c')](handleError(_0x1a3ba7,null));};exports[_0x1135('0x56')]=function(_0x1a753a,_0x10db4b){var _0x477003=_0x1a753a[_0x1135('0x40')][_0x1135('0x57')];return db['Team'][_0x1135('0x2b')]({'where':{'id':_0x477003},'attributes':['id'],'include':[{'model':db['User'],'as':_0x1135('0x58'),'attributes':['id',_0x1135('0x1f'),_0x1135('0x59'),_0x1135('0x5a'),_0x1135('0x5b')],'raw':!![]}]})[_0x1135('0x29')](function(_0x53f72d){if(_0x53f72d){var _0x241798=_[_0x1135('0x5c')](_0x53f72d,function(_0x25467){var _0x20358e=_0x25467['get']({'plain':!![]});return _0x20358e[_0x1135('0x58')];});return db[_0x1135('0x23')][_0x1135('0x37')]({'where':{'id':_0x1a753a[_0x1135('0x2d')]['id']}})['then'](function(_0x2ee307){return db[_0x1135('0x5d')][_0x1135('0x5e')](function(_0x286883){return _0x2ee307['addTeams'](_0x477003,{'transaction':_0x286883})[_0x1135('0x29')](function(){return BPromise[_0x1135('0x5f')](_0x241798,function(_0x4b0268){return db[_0x1135('0x44')][_0x1135('0x60')]({'where':{'UserId':_0x4b0268['id'],'OpenchannelQueueId':_0x1a753a[_0x1135('0x2d')]['id']},'transaction':_0x286883});});})[_0x1135('0x29')](function(){_0x241798[_0x1135('0x61')](function(_0x33c93e){socket[_0x1135('0x62')](_0x1135('0x63'),{'UserId':_0x33c93e['id'],'OpenchannelQueueId':_0x2ee307['id']});});});});});}})[_0x1135('0x29')](respondWithStatusCode(_0x10db4b,null))[_0x1135('0x2c')](handleError(_0x10db4b,null));};exports[_0x1135('0x64')]=function(_0x1e7738,_0x1c6086){return db[_0x1135('0x65')][_0x1135('0x2b')]({'where':{'id':_0x1e7738[_0x1135('0x30')][_0x1135('0x57')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x1135('0x58'),'attributes':['id'],'raw':!![]}]})[_0x1135('0x29')](handleEntityNotFound(_0x1c6086,null))[_0x1135('0x29')](function(_0x2d456b){var _0x5c3412=_[_0x1135('0x22')](_0x2d456b,'id');var _0x2364ac=[];var _0x3fa039=[];var _0xd71b8b=squel[_0x1135('0x66')]();_0xd71b8b[_0x1135('0x67')](_0x1135('0x68'))['from']('team_has_openchannel_queues','tq')[_0x1135('0x69')](_0x1135('0x6a'),'ut',_0x1135('0x6b'))[_0x1135('0x28')](_0x1135('0x6c'),_0x1e7738[_0x1135('0x2d')]['id']);for(var _0x1163dc=0x0;_0x1163dc<_0x2d456b['length'];_0x1163dc+=0x1){let _0x55b80d=_0x2d456b[_0x1163dc];for(var _0x24a2bf=0x0;_0x24a2bf<_0x55b80d[_0x1135('0x58')][_0x1135('0x35')];_0x24a2bf+=0x1){let _0x251b7e=_0x55b80d[_0x1135('0x58')][_0x24a2bf];var _0x4ede1b=_0xd71b8b[_0x1135('0x6d')]();_0x4ede1b[_0x1135('0x28')](_0x1135('0x6e'),_0x251b7e['id']);_0x3fa039[_0x1135('0x6f')](db['sequelize']['query'](_0x4ede1b['toString'](),{'type':db[_0x1135('0x5d')][_0x1135('0x70')][_0x1135('0x71')]})[_0x1135('0x29')](function(_0x238637){if(_0x238637[_0x1135('0x35')]===0x1){return _0x251b7e['id'];}else{var _0x50c709=_[_0x1135('0x72')](_[_0x1135('0x22')](_0x238637,_0x1135('0x73')),function(_0x21814c){return _['includes'](_0x5c3412,_0x21814c);});if(_0x50c709){return _0x251b7e['id'];}}}));}}return BPromise['all'](_0x3fa039)[_0x1135('0x29')](function(_0x2ca936){_0x2364ac=_(_0x2364ac)['union'](_0x2ca936)[_0x1135('0x74')]()[_0x1135('0x75')]();return db['OpenchannelQueue'][_0x1135('0x37')]({'where':{'id':_0x1e7738['params']['id']}})[_0x1135('0x29')](function(_0x4bff31){return db[_0x1135('0x5d')][_0x1135('0x5e')](function(_0xb76f2a){return _0x4bff31[_0x1135('0x64')](_0x1e7738[_0x1135('0x30')]['ids'],{'transaction':_0xb76f2a})[_0x1135('0x29')](function(){if(!_[_0x1135('0x76')](_0x2364ac)){return _0x4bff31[_0x1135('0x77')](_0x2364ac,{'transaction':_0xb76f2a});}})['then'](function(){_0x2364ac['forEach'](function(_0x220005){socket[_0x1135('0x62')](_0x1135('0x78'),{'UserId':_0x220005,'OpenchannelQueueId':_0x4bff31['id']});});});});});});})[_0x1135('0x29')](respondWithStatusCode(_0x1c6086,null))['catch'](handleError(_0x1c6086,null));};exports['addAgents']=function(_0x567fa1,_0x2bb788){return db[_0x1135('0x23')]['find']({'where':{'id':_0x567fa1[_0x1135('0x2d')]['id']}})[_0x1135('0x29')](handleEntityNotFound(_0x2bb788,null))['then'](function(_0x193484){if(_0x193484){return _0x193484['addAgents'](_0x567fa1[_0x1135('0x40')][_0x1135('0x57')],_[_0x1135('0x79')](_0x567fa1[_0x1135('0x40')],[_0x1135('0x57'),'id'])||{})[_0x1135('0x7a')](function(_0x31812a){for(var _0x4d0d91=0x0;_0x4d0d91<_0x567fa1['body']['ids']['length'];_0x4d0d91+=0x1){socket[_0x1135('0x62')](_0x1135('0x63'),{'UserId':Number(_0x567fa1[_0x1135('0x40')][_0x1135('0x57')][_0x4d0d91]),'OpenchannelQueueId':Number(_0x567fa1['params']['id'])});}return _0x31812a;});}})[_0x1135('0x29')](respondWithResult(_0x2bb788,null))[_0x1135('0x2c')](handleError(_0x2bb788,null));};exports[_0x1135('0x77')]=function(_0x28f3f0,_0x16373b){return db['OpenchannelQueue'][_0x1135('0x37')]({'where':{'id':_0x28f3f0['params']['id']}})[_0x1135('0x29')](handleEntityNotFound(_0x16373b,null))[_0x1135('0x29')](function(_0x1ed1bd){if(_0x1ed1bd){return _0x1ed1bd[_0x1135('0x77')](_0x28f3f0[_0x1135('0x30')][_0x1135('0x57')])['then'](function(){if(_[_0x1135('0x7b')](_0x28f3f0[_0x1135('0x30')][_0x1135('0x57')])){for(var _0xcb5cf5=0x0;_0xcb5cf5<_0x28f3f0[_0x1135('0x30')]['ids']['length'];_0xcb5cf5+=0x1){socket[_0x1135('0x62')](_0x1135('0x78'),{'UserId':Number(_0x28f3f0[_0x1135('0x30')]['ids'][_0xcb5cf5]),'OpenchannelQueueId':Number(_0x28f3f0['params']['id'])});}}else{socket[_0x1135('0x62')](_0x1135('0x78'),{'UserId':Number(_0x28f3f0[_0x1135('0x30')][_0x1135('0x57')]),'OpenchannelQueueId':Number(_0x28f3f0['params']['id'])});}});}})[_0x1135('0x29')](respondWithStatusCode(_0x16373b,null))[_0x1135('0x2c')](handleError(_0x16373b,null));};exports[_0x1135('0x7c')]=function(_0x3d6a3a,_0x1810a3){var _0x1aacc4={};var _0x357200={};var _0x544ad7;var _0x4d7ed0;return db[_0x1135('0x23')][_0x1135('0x54')]({'where':{'id':_0x3d6a3a['params']['id']}})[_0x1135('0x29')](handleEntityNotFound(_0x1810a3,null))[_0x1135('0x29')](function(_0x316850){if(_0x316850){_0x544ad7=_0x316850;_0x357200['model']=_[_0x1135('0x43')](db[_0x1135('0x4b')][_0x1135('0x2f')]);_0x357200[_0x1135('0x30')]=_[_0x1135('0x43')](_0x3d6a3a[_0x1135('0x30')]);_0x357200['filters']=_['intersection'](_0x357200[_0x1135('0x2e')],_0x357200[_0x1135('0x30')]);_0x1aacc4[_0x1135('0x33')]=_[_0x1135('0x32')](_0x357200[_0x1135('0x2e')],qs['fields'](_0x3d6a3a[_0x1135('0x30')][_0x1135('0x34')]));_0x1aacc4[_0x1135('0x33')]=_0x1aacc4['attributes'][_0x1135('0x35')]?_0x1aacc4['attributes']:_0x357200[_0x1135('0x2e')];_0x1aacc4[_0x1135('0x47')]=qs[_0x1135('0x55')](_0x3d6a3a[_0x1135('0x30')][_0x1135('0x55')]);_0x1aacc4[_0x1135('0x28')]=qs[_0x1135('0x31')](_[_0x1135('0x48')](_0x3d6a3a[_0x1135('0x30')],_0x357200[_0x1135('0x31')]));if(_0x3d6a3a['query']['filter']){_0x1aacc4[_0x1135('0x28')]=_['merge'](_0x1aacc4['where'],{'$or':_['map'](_0x1aacc4[_0x1135('0x33')],function(_0x6d4796){var _0x32bd13={};_0x32bd13[_0x6d4796]={'$like':'%'+_0x3d6a3a['query'][_0x1135('0x49')]+'%'};return _0x32bd13;})});}_0x1aacc4=_['merge']({},_0x1aacc4,_0x3d6a3a[_0x1135('0x36')]);return _0x544ad7[_0x1135('0x7c')](_0x1aacc4);}})['then'](function(_0x13b2a9){if(_0x13b2a9){_0x4d7ed0=_0x13b2a9[_0x1135('0x35')];if(!_0x3d6a3a[_0x1135('0x30')][_0x1135('0x45')]('nolimit')){_0x1aacc4[_0x1135('0x15')]=qs[_0x1135('0x15')](_0x3d6a3a[_0x1135('0x30')][_0x1135('0x15')]);_0x1aacc4[_0x1135('0x13')]=qs['offset'](_0x3d6a3a[_0x1135('0x30')][_0x1135('0x13')]);}return _0x544ad7['getAgents'](_0x1aacc4);}})[_0x1135('0x29')](function(_0x58bd9d){if(_0x58bd9d){return _0x58bd9d?{'count':_0x4d7ed0,'rows':_0x58bd9d}:null;}})[_0x1135('0x29')](respondWithResult(_0x1810a3,null))[_0x1135('0x2c')](handleError(_0x1810a3,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 6323b06..1146a08 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 _0xb4cd=['exports','events','../../mysqldb','setMaxListeners','save','update','remove','hasOwnProperty','hook'];(function(_0x435b2f,_0x4c44da){var _0x181648=function(_0x3d753e){while(--_0x3d753e){_0x435b2f['push'](_0x435b2f['shift']());}};_0x181648(++_0x4c44da);}(_0xb4cd,0x9a));var _0xdb4c=function(_0x950c87,_0x381c1a){_0x950c87=_0x950c87-0x0;var _0x19d1ee=_0xb4cd[_0x950c87];return _0x19d1ee;};'use strict';var EventEmitter=require(_0xdb4c('0x0'));var OpenchannelQueue=require(_0xdb4c('0x1'))['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xdb4c('0x2')](0x0);var events={'afterCreate':_0xdb4c('0x3'),'afterUpdate':_0xdb4c('0x4'),'afterDestroy':_0xdb4c('0x5')};function emitEvent(_0x37f13d){return function(_0x24ac3a,_0x2eb6bd,_0x1e3141){OpenchannelQueueEvents['emit'](_0x37f13d+':'+_0x24ac3a['id'],_0x24ac3a);OpenchannelQueueEvents['emit'](_0x37f13d,_0x24ac3a);_0x1e3141(null);};}for(var e in events){if(events[_0xdb4c('0x6')](e)){var event=events[e];OpenchannelQueue[_0xdb4c('0x7')](e,emitEvent(event));}}module[_0xdb4c('0x8')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x9faa=['../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x54bbb9,_0x24c53d){var _0x29fd2b=function(_0x4e0ef9){while(--_0x4e0ef9){_0x54bbb9['push'](_0x54bbb9['shift']());}};_0x29fd2b(++_0x24c53d);}(_0x9faa,0x13b));var _0xa9fa=function(_0xb0aaf7,_0x3d73df){_0xb0aaf7=_0xb0aaf7-0x0;var _0x333563=_0x9faa[_0xb0aaf7];return _0x333563;};'use strict';var EventEmitter=require('events');var OpenchannelQueue=require(_0xa9fa('0x0'))['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xa9fa('0x1')](0x0);var events={'afterCreate':_0xa9fa('0x2'),'afterUpdate':_0xa9fa('0x3'),'afterDestroy':_0xa9fa('0x4')};function emitEvent(_0x104e42){return function(_0x5a8542,_0x374dd8,_0x3d3711){OpenchannelQueueEvents[_0xa9fa('0x5')](_0x104e42+':'+_0x5a8542['id'],_0x5a8542);OpenchannelQueueEvents['emit'](_0x104e42,_0x5a8542);_0x3d3711(null);};}for(var e in events){if(events[_0xa9fa('0x6')](e)){var event=events[e];OpenchannelQueue['hook'](e,emitEvent(event));}}module['exports']=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 0918542..1968bcf 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 _0xe5b5=['OpenchannelQueue','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','define'];(function(_0x2afcc2,_0x509165){var _0x238b69=function(_0x578f28){while(--_0x578f28){_0x2afcc2['push'](_0x2afcc2['shift']());}};_0x238b69(++_0x509165);}(_0xe5b5,0x8d));var _0x5e5b=function(_0x43a37c,_0x25a567){_0x43a37c=_0x43a37c-0x0;var _0x5d1d40=_0xe5b5[_0x43a37c];return _0x5d1d40;};'use strict';var _=require('lodash');var util=require(_0x5e5b('0x0'));var logger=require(_0x5e5b('0x1'))(_0x5e5b('0x2'));var moment=require(_0x5e5b('0x3'));var BPromise=require('bluebird');var rp=require(_0x5e5b('0x4'));var fs=require('fs');var path=require(_0x5e5b('0x5'));var rimraf=require(_0x5e5b('0x6'));var config=require(_0x5e5b('0x7'));var attributes=require('./openchannelQueue.attributes');module['exports']=function(_0x51ea1c,_0x36e88e){return _0x51ea1c[_0x5e5b('0x8')](_0x5e5b('0x9'),attributes,{'tableName':'openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcfa2=['exports','OpenchannelQueue','openchannel_queues','lodash','util','../../config/logger','api','path','rimraf','../../config/environment','./openchannelQueue.attributes'];(function(_0x2cc69f,_0x341adc){var _0x4ba756=function(_0x4bb7de){while(--_0x4bb7de){_0x2cc69f['push'](_0x2cc69f['shift']());}};_0x4ba756(++_0x341adc);}(_0xcfa2,0x66));var _0x2cfa=function(_0x5b0166,_0x2bf818){_0x5b0166=_0x5b0166-0x0;var _0x2b43db=_0xcfa2[_0x5b0166];return _0x2b43db;};'use strict';var _=require(_0x2cfa('0x0'));var util=require(_0x2cfa('0x1'));var logger=require(_0x2cfa('0x2'))(_0x2cfa('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2cfa('0x4'));var rimraf=require(_0x2cfa('0x5'));var config=require(_0x2cfa('0x6'));var attributes=require(_0x2cfa('0x7'));module[_0x2cfa('0x8')]=function(_0x58839a,_0x8878d6){return _0x58839a['define'](_0x2cfa('0x9'),attributes,{'tableName':_0x2cfa('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 37fd3b0..dc85732 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 _0x080a=['attributes','limit','include','map','model','GetOpenchannelQueue','catch','ShowOpenchannelQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','request','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','OpenchannelQueue','options','raw','where'];(function(_0x3bb5b4,_0x128455){var _0x586c60=function(_0x179226){while(--_0x179226){_0x3bb5b4['push'](_0x3bb5b4['shift']());}};_0x586c60(++_0x128455);}(_0x080a,0x111));var _0xa080=function(_0xc136d6,_0x291dd5){_0xc136d6=_0xc136d6-0x0;var _0xe1c77f=_0x080a[_0xc136d6];return _0xe1c77f;};'use strict';var _=require(_0xa080('0x0'));var util=require(_0xa080('0x1'));var moment=require(_0xa080('0x2'));var BPromise=require(_0xa080('0x3'));var rs=require(_0xa080('0x4'));var fs=require('fs');var Redis=require(_0xa080('0x5'));var db=require(_0xa080('0x6'))['db'];var utils=require(_0xa080('0x7'));var logger=require(_0xa080('0x8'))(_0xa080('0x9'));var config=require(_0xa080('0xa'));var jayson=require(_0xa080('0xb'));var client=jayson['client'][_0xa080('0xc')]({'port':0x232a});config[_0xa080('0xd')]=_[_0xa080('0xe')](config[_0xa080('0xd')],{'host':_0xa080('0xf'),'port':0x18eb});var socket=require(_0xa080('0x10'))(new Redis(config[_0xa080('0xd')]));require(_0xa080('0x11'))[_0xa080('0x12')](socket);function respondWithRpcPromise(_0x9feabe,_0x4777b9,_0x32d17d){return new BPromise(function(_0x5a88c3,_0x523d2f){return client[_0xa080('0x13')](_0x9feabe,_0x32d17d)[_0xa080('0x14')](function(_0x5573cf){logger[_0xa080('0x15')](_0xa080('0x16'),_0x4777b9,_0xa080('0x17'));logger[_0xa080('0x18')](_0xa080('0x19'),_0x4777b9,'request\x20sent',JSON[_0xa080('0x1a')](_0x5573cf));if(_0x5573cf[_0xa080('0x1b')]){if(_0x5573cf[_0xa080('0x1b')][_0xa080('0x1c')]===0x1f4){logger['error'](_0xa080('0x16'),_0x4777b9,_0x5573cf[_0xa080('0x1b')][_0xa080('0x1d')]);return _0x523d2f(_0x5573cf[_0xa080('0x1b')]['message']);}logger[_0xa080('0x1b')]('OpenchannelQueue,\x20%s,\x20%s',_0x4777b9,_0x5573cf[_0xa080('0x1b')][_0xa080('0x1d')]);return _0x5a88c3(_0x5573cf[_0xa080('0x1b')][_0xa080('0x1d')]);}else{logger[_0xa080('0x15')](_0xa080('0x16'),_0x4777b9,_0xa080('0x17'));_0x5a88c3(_0x5573cf[_0xa080('0x1e')][_0xa080('0x1d')]);}})['catch'](function(_0x5aca39){logger['error'](_0xa080('0x16'),_0x4777b9,_0x5aca39);_0x523d2f(_0x5aca39);});});}exports['GetOpenchannelQueue']=function(_0x52fd8a){var _0xcffc85=this;return new Promise(function(_0x3eabf2,_0x4c77fc){return db[_0xa080('0x1f')]['findAll']({'raw':_0x52fd8a[_0xa080('0x20')]?_0x52fd8a[_0xa080('0x20')][_0xa080('0x21')]===undefined?!![]:![]:!![],'where':_0x52fd8a[_0xa080('0x20')]?_0x52fd8a[_0xa080('0x20')][_0xa080('0x22')]||null:null,'attributes':_0x52fd8a[_0xa080('0x20')]?_0x52fd8a['options'][_0xa080('0x23')]||null:null,'limit':_0x52fd8a[_0xa080('0x20')]?_0x52fd8a[_0xa080('0x20')][_0xa080('0x24')]||null:null,'include':_0x52fd8a[_0xa080('0x20')]?_0x52fd8a[_0xa080('0x20')][_0xa080('0x25')]?_[_0xa080('0x26')](_0x52fd8a[_0xa080('0x20')]['include'],function(_0x3c2006){return{'model':db[_0x3c2006[_0xa080('0x27')]],'as':_0x3c2006['as'],'attributes':_0x3c2006[_0xa080('0x23')],'include':_0x3c2006[_0xa080('0x25')]?_[_0xa080('0x26')](_0x3c2006[_0xa080('0x25')],function(_0xd07ff9){return{'model':db[_0xd07ff9[_0xa080('0x27')]],'as':_0xd07ff9['as'],'attributes':_0xd07ff9[_0xa080('0x23')],'include':_0xd07ff9[_0xa080('0x25')]?_['map'](_0xd07ff9[_0xa080('0x25')],function(_0x45d09e){return{'model':db[_0x45d09e[_0xa080('0x27')]],'as':_0x45d09e['as'],'attributes':_0x45d09e[_0xa080('0x23')]};}):[]};}):[]};}):[]:[]})[_0xa080('0x14')](function(_0x9cc4f5){logger[_0xa080('0x15')](_0xa080('0x28'),_0x52fd8a);logger['debug'](_0xa080('0x28'),_0x52fd8a,JSON[_0xa080('0x1a')](_0x9cc4f5));_0x3eabf2(_0x9cc4f5);})[_0xa080('0x29')](function(_0x4c9554){logger[_0xa080('0x1b')](_0xa080('0x28'),_0x4c9554[_0xa080('0x1d')],_0x52fd8a);_0x4c77fc(_0xcffc85[_0xa080('0x1b')](0x1f4,_0x4c9554[_0xa080('0x1d')]));});});};exports[_0xa080('0x2a')]=function(_0x524b3f){var _0x2f347c=this;return new Promise(function(_0x414e5b,_0x32ea49){return db[_0xa080('0x1f')][_0xa080('0x2b')]({'raw':_0x524b3f[_0xa080('0x20')]?_0x524b3f[_0xa080('0x20')][_0xa080('0x21')]===undefined?!![]:![]:!![],'where':_0x524b3f[_0xa080('0x20')]?_0x524b3f['options'][_0xa080('0x22')]||null:null,'attributes':_0x524b3f[_0xa080('0x20')]?_0x524b3f[_0xa080('0x20')]['attributes']||null:null,'include':_0x524b3f[_0xa080('0x20')]?_0x524b3f[_0xa080('0x20')][_0xa080('0x25')]?_[_0xa080('0x26')](_0x524b3f['options'][_0xa080('0x25')],function(_0xfdaf12){return{'model':db[_0xfdaf12[_0xa080('0x27')]],'as':_0xfdaf12['as'],'attributes':_0xfdaf12[_0xa080('0x23')],'include':_0xfdaf12[_0xa080('0x25')]?_[_0xa080('0x26')](_0xfdaf12['include'],function(_0x47f20e){return{'model':db[_0x47f20e[_0xa080('0x27')]],'as':_0x47f20e['as'],'attributes':_0x47f20e['attributes'],'include':_0x47f20e[_0xa080('0x25')]?_['map'](_0x47f20e[_0xa080('0x25')],function(_0x75062d){return{'model':db[_0x75062d[_0xa080('0x27')]],'as':_0x75062d['as'],'attributes':_0x75062d[_0xa080('0x23')]};}):[]};}):[]};}):[]:[]})[_0xa080('0x14')](function(_0x512070){logger[_0xa080('0x15')](_0xa080('0x2a'),_0x524b3f);logger[_0xa080('0x18')]('ShowOpenchannelQueue',_0x524b3f,JSON[_0xa080('0x1a')](_0x512070));_0x414e5b(_0x512070);})[_0xa080('0x29')](function(_0x572019){logger[_0xa080('0x1b')](_0xa080('0x2a'),_0x572019[_0xa080('0x1d')],_0x524b3f);_0x32ea49(_0x2f347c['error'](0x1f4,_0x572019[_0xa080('0x1d')]));});});}; \ No newline at end of file +var _0x1588=['find','raw','where','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','request','then','info','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','OpenchannelQueue,\x20%s,\x20%s','result','catch','GetOpenchannelQueue','OpenchannelQueue','options','attributes','limit','include','map','model','ShowOpenchannelQueue'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x1588,0x75));var _0x8158=function(_0x398aca,_0x481c00){_0x398aca=_0x398aca-0x0;var _0x30dc08=_0x1588[_0x398aca];return _0x30dc08;};'use strict';var _=require(_0x8158('0x0'));var util=require(_0x8158('0x1'));var moment=require(_0x8158('0x2'));var BPromise=require(_0x8158('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8158('0x4'));var db=require(_0x8158('0x5'))['db'];var utils=require(_0x8158('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8158('0x7')][_0x8158('0x8')]({'port':0x232a});config[_0x8158('0x9')]=_[_0x8158('0xa')](config[_0x8158('0x9')],{'host':_0x8158('0xb'),'port':0x18eb});var socket=require(_0x8158('0xc'))(new Redis(config['redis']));require(_0x8158('0xd'))['register'](socket);function respondWithRpcPromise(_0x45dc3b,_0x42922f,_0x1a8b97){return new BPromise(function(_0xdeeb58,_0x3908bf){return client[_0x8158('0xe')](_0x45dc3b,_0x1a8b97)[_0x8158('0xf')](function(_0x5a886c){logger[_0x8158('0x10')]('OpenchannelQueue,\x20%s,\x20%s',_0x42922f,'request\x20sent');logger[_0x8158('0x11')](_0x8158('0x12'),_0x42922f,_0x8158('0x13'),JSON[_0x8158('0x14')](_0x5a886c));if(_0x5a886c[_0x8158('0x15')]){if(_0x5a886c[_0x8158('0x15')]['code']===0x1f4){logger[_0x8158('0x15')]('OpenchannelQueue,\x20%s,\x20%s',_0x42922f,_0x5a886c[_0x8158('0x15')][_0x8158('0x16')]);return _0x3908bf(_0x5a886c[_0x8158('0x15')][_0x8158('0x16')]);}logger['error'](_0x8158('0x17'),_0x42922f,_0x5a886c[_0x8158('0x15')]['message']);return _0xdeeb58(_0x5a886c[_0x8158('0x15')][_0x8158('0x16')]);}else{logger['info'](_0x8158('0x17'),_0x42922f,_0x8158('0x13'));_0xdeeb58(_0x5a886c[_0x8158('0x18')][_0x8158('0x16')]);}})[_0x8158('0x19')](function(_0x302945){logger[_0x8158('0x15')]('OpenchannelQueue,\x20%s,\x20%s',_0x42922f,_0x302945);_0x3908bf(_0x302945);});});}exports[_0x8158('0x1a')]=function(_0x175af3){var _0x2d75d6=this;return new Promise(function(_0x71fcc2,_0x3373fb){return db[_0x8158('0x1b')]['findAll']({'raw':_0x175af3[_0x8158('0x1c')]?_0x175af3[_0x8158('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x175af3[_0x8158('0x1c')]?_0x175af3['options']['where']||null:null,'attributes':_0x175af3[_0x8158('0x1c')]?_0x175af3[_0x8158('0x1c')][_0x8158('0x1d')]||null:null,'limit':_0x175af3[_0x8158('0x1c')]?_0x175af3[_0x8158('0x1c')][_0x8158('0x1e')]||null:null,'include':_0x175af3[_0x8158('0x1c')]?_0x175af3[_0x8158('0x1c')][_0x8158('0x1f')]?_[_0x8158('0x20')](_0x175af3['options'][_0x8158('0x1f')],function(_0x28629b){return{'model':db[_0x28629b['model']],'as':_0x28629b['as'],'attributes':_0x28629b['attributes'],'include':_0x28629b[_0x8158('0x1f')]?_[_0x8158('0x20')](_0x28629b[_0x8158('0x1f')],function(_0x58a6f7){return{'model':db[_0x58a6f7['model']],'as':_0x58a6f7['as'],'attributes':_0x58a6f7[_0x8158('0x1d')],'include':_0x58a6f7['include']?_[_0x8158('0x20')](_0x58a6f7[_0x8158('0x1f')],function(_0x57e152){return{'model':db[_0x57e152[_0x8158('0x21')]],'as':_0x57e152['as'],'attributes':_0x57e152[_0x8158('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x8158('0xf')](function(_0x3ba15d){logger[_0x8158('0x10')](_0x8158('0x1a'),_0x175af3);logger[_0x8158('0x11')]('GetOpenchannelQueue',_0x175af3,JSON[_0x8158('0x14')](_0x3ba15d));_0x71fcc2(_0x3ba15d);})[_0x8158('0x19')](function(_0x3c9df5){logger[_0x8158('0x15')](_0x8158('0x1a'),_0x3c9df5['message'],_0x175af3);_0x3373fb(_0x2d75d6[_0x8158('0x15')](0x1f4,_0x3c9df5[_0x8158('0x16')]));});});};exports[_0x8158('0x22')]=function(_0x1860e0){var _0x5ce24f=this;return new Promise(function(_0x136702,_0x36b8a0){return db[_0x8158('0x1b')][_0x8158('0x23')]({'raw':_0x1860e0[_0x8158('0x1c')]?_0x1860e0['options'][_0x8158('0x24')]===undefined?!![]:![]:!![],'where':_0x1860e0[_0x8158('0x1c')]?_0x1860e0[_0x8158('0x1c')][_0x8158('0x25')]||null:null,'attributes':_0x1860e0['options']?_0x1860e0['options']['attributes']||null:null,'include':_0x1860e0[_0x8158('0x1c')]?_0x1860e0[_0x8158('0x1c')]['include']?_[_0x8158('0x20')](_0x1860e0[_0x8158('0x1c')][_0x8158('0x1f')],function(_0x22fe11){return{'model':db[_0x22fe11[_0x8158('0x21')]],'as':_0x22fe11['as'],'attributes':_0x22fe11[_0x8158('0x1d')],'include':_0x22fe11[_0x8158('0x1f')]?_[_0x8158('0x20')](_0x22fe11['include'],function(_0xf01271){return{'model':db[_0xf01271[_0x8158('0x21')]],'as':_0xf01271['as'],'attributes':_0xf01271[_0x8158('0x1d')],'include':_0xf01271[_0x8158('0x1f')]?_[_0x8158('0x20')](_0xf01271[_0x8158('0x1f')],function(_0x1d9670){return{'model':db[_0x1d9670[_0x8158('0x21')]],'as':_0x1d9670['as'],'attributes':_0x1d9670[_0x8158('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x8158('0xf')](function(_0x3ef2b0){logger[_0x8158('0x10')](_0x8158('0x22'),_0x1860e0);logger[_0x8158('0x11')](_0x8158('0x22'),_0x1860e0,JSON[_0x8158('0x14')](_0x3ef2b0));_0x136702(_0x3ef2b0);})[_0x8158('0x19')](function(_0x39cfd3){logger[_0x8158('0x15')](_0x8158('0x22'),_0x39cfd3[_0x8158('0x16')],_0x1860e0);_0x36b8a0(_0x5ce24f[_0x8158('0x15')](0x1f4,_0x39cfd3['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 4d94bdc..d052224 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 _0xebd0=['save','remove','emit','register','length','./openchannelQueue.events'];(function(_0x40b932,_0x305c43){var _0x188a20=function(_0x1b2bd2){while(--_0x1b2bd2){_0x40b932['push'](_0x40b932['shift']());}};_0x188a20(++_0x305c43);}(_0xebd0,0x149));var _0x0ebd=function(_0x1993a9,_0x42cc64){_0x1993a9=_0x1993a9-0x0;var _0x125e71=_0xebd0[_0x1993a9];return _0x125e71;};'use strict';var OpenchannelQueueEvents=require(_0x0ebd('0x0'));var events=[_0x0ebd('0x1'),_0x0ebd('0x2'),'update'];function createListener(_0x168d49,_0x1c0a1c){return function(_0x1d23f9){_0x1c0a1c[_0x0ebd('0x3')](_0x168d49,_0x1d23f9);};}function removeListener(_0x46d2d2,_0x775024){return function(){OpenchannelQueueEvents['removeListener'](_0x46d2d2,_0x775024);};}exports[_0x0ebd('0x4')]=function(_0x1ddc1b){for(var _0x5ede3d=0x0,_0x20f3eb=events[_0x0ebd('0x5')];_0x5ede3d<_0x20f3eb;_0x5ede3d++){var _0xd91292=events[_0x5ede3d];var _0x4a48d1=createListener('openchannelQueue:'+_0xd91292,_0x1ddc1b);OpenchannelQueueEvents['on'](_0xd91292,_0x4a48d1);}}; \ No newline at end of file +var _0xa88d=['openchannelQueue:','./openchannelQueue.events','remove','update','emit','register','length'];(function(_0x25ea21,_0x266c3a){var _0x431523=function(_0x1d1639){while(--_0x1d1639){_0x25ea21['push'](_0x25ea21['shift']());}};_0x431523(++_0x266c3a);}(_0xa88d,0x71));var _0xda88=function(_0x4d39a7,_0x16db64){_0x4d39a7=_0x4d39a7-0x0;var _0x30e04a=_0xa88d[_0x4d39a7];return _0x30e04a;};'use strict';var OpenchannelQueueEvents=require(_0xda88('0x0'));var events=['save',_0xda88('0x1'),_0xda88('0x2')];function createListener(_0x1a730e,_0x20fd01){return function(_0x36bfe8){_0x20fd01[_0xda88('0x3')](_0x1a730e,_0x36bfe8);};}function removeListener(_0x82cdfe,_0x53ba48){return function(){OpenchannelQueueEvents['removeListener'](_0x82cdfe,_0x53ba48);};}exports[_0xda88('0x4')]=function(_0x562dab){for(var _0x4a9465=0x0,_0x4c707c=events[_0xda88('0x5')];_0x4a9465<_0x4c707c;_0x4a9465++){var _0x270fe7=events[_0x4a9465];var _0x1b4ee1=createListener(_0xda88('0x6')+_0x270fe7,_0x562dab);OpenchannelQueueEvents['on'](_0x270fe7,_0x1b4ee1);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 116c743..23e52e6 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 _0x8ec8=['../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','/describe','describe','/:id','isAuthenticated','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x18fb16,_0x45edbc){var _0x147b0d=function(_0x5b1b00){while(--_0x5b1b00){_0x18fb16['push'](_0x18fb16['shift']());}};_0x147b0d(++_0x45edbc);}(_0x8ec8,0x159));var _0x88ec=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8ec8[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x88ec('0x0'));var util=require(_0x88ec('0x1'));var path=require(_0x88ec('0x2'));var timeout=require(_0x88ec('0x3'));var express=require(_0x88ec('0x4'));var router=express[_0x88ec('0x5')]();var fs_extra=require(_0x88ec('0x6'));var auth=require(_0x88ec('0x7'));var interaction=require(_0x88ec('0x8'));var config=require(_0x88ec('0x9'));var controller=require(_0x88ec('0xa'));router[_0x88ec('0xb')]('/',auth['isAuthenticated'](),controller['index']);router[_0x88ec('0xb')](_0x88ec('0xc'),auth['isAuthenticated'](),controller[_0x88ec('0xd')]);router['get'](_0x88ec('0xe'),auth[_0x88ec('0xf')](),controller['show']);router[_0x88ec('0x10')]('/',auth['isAuthenticated'](),controller[_0x88ec('0x11')]);router[_0x88ec('0x12')](_0x88ec('0xe'),auth[_0x88ec('0xf')](),controller[_0x88ec('0x13')]);router['delete'](_0x88ec('0xe'),auth['isAuthenticated'](),controller[_0x88ec('0x14')]);module[_0x88ec('0x15')]=router; \ No newline at end of file +var _0x5d5e=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','isAuthenticated','get','/describe','/:id','show','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x2b8c2f,_0x26343d){var _0x2b23ab=function(_0x57015a){while(--_0x57015a){_0x2b8c2f['push'](_0x2b8c2f['shift']());}};_0x2b23ab(++_0x26343d);}(_0x5d5e,0x152));var _0xe5d5=function(_0x2d2f1f,_0x170b70){_0x2d2f1f=_0x2d2f1f-0x0;var _0x3c7bfb=_0x5d5e[_0x2d2f1f];return _0x3c7bfb;};'use strict';var multer=require(_0xe5d5('0x0'));var util=require(_0xe5d5('0x1'));var path=require(_0xe5d5('0x2'));var timeout=require(_0xe5d5('0x3'));var express=require(_0xe5d5('0x4'));var router=express[_0xe5d5('0x5')]();var fs_extra=require(_0xe5d5('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xe5d5('0x7'));var config=require(_0xe5d5('0x8'));var controller=require(_0xe5d5('0x9'));router['get']('/',auth[_0xe5d5('0xa')](),controller['index']);router[_0xe5d5('0xb')](_0xe5d5('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0xe5d5('0xb')](_0xe5d5('0xd'),auth[_0xe5d5('0xa')](),controller[_0xe5d5('0xe')]);router['post']('/',auth[_0xe5d5('0xa')](),controller['create']);router['put']('/:id',auth[_0xe5d5('0xa')](),controller['update']);router[_0xe5d5('0xf')](_0xe5d5('0xd'),auth['isAuthenticated'](),controller[_0xe5d5('0x10')]);module[_0xe5d5('0x11')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 9885b87..02a1836 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 _0x363b=['moment','sequelize','exports','STRING','DATE'];(function(_0x1f272f,_0x4ec10f){var _0x3cd290=function(_0x4aa5ea){while(--_0x4aa5ea){_0x1f272f['push'](_0x1f272f['shift']());}};_0x3cd290(++_0x4ec10f);}(_0x363b,0x17c));var _0xb363=function(_0x79f71b,_0x4946d2){_0x79f71b=_0x79f71b-0x0;var _0x2495af=_0x363b[_0x79f71b];return _0x2495af;};'use strict';var moment=require(_0xb363('0x0'));var Sequelize=require(_0xb363('0x1'));module[_0xb363('0x2')]={'uniqueid':{'type':Sequelize[_0xb363('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xb363('0x3')]},'joinAt':{'type':Sequelize[_0xb363('0x4')]},'leaveAt':{'type':Sequelize[_0xb363('0x4')]},'acceptAt':{'type':Sequelize[_0xb363('0x4')]},'exitAt':{'type':Sequelize[_0xb363('0x4')]},'reason':{'type':Sequelize[_0xb363('0x3')]}}; \ No newline at end of file +var _0x3bfc=['moment','sequelize','exports','STRING','DATE'];(function(_0x1f9889,_0x208e7b){var _0x4a4e57=function(_0x970c8d){while(--_0x970c8d){_0x1f9889['push'](_0x1f9889['shift']());}};_0x4a4e57(++_0x208e7b);}(_0x3bfc,0x177));var _0xc3bf=function(_0x45c981,_0x2ad2d4){_0x45c981=_0x45c981-0x0;var _0x4f62c8=_0x3bfc[_0x45c981];return _0x4f62c8;};'use strict';var moment=require(_0xc3bf('0x0'));var Sequelize=require(_0xc3bf('0x1'));module[_0xc3bf('0x2')]={'uniqueid':{'type':Sequelize[_0xc3bf('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xc3bf('0x3')]},'joinAt':{'type':Sequelize[_0xc3bf('0x4')]},'leaveAt':{'type':Sequelize[_0xc3bf('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xc3bf('0x4')]},'reason':{'type':Sequelize[_0xc3bf('0x3')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index b229671..7385ae4 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 _0xb84b=['request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','OpenchannelQueueReport','rawAttributes','fieldName','query','keys','filters','model','attributes','fields','length','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','show','params','intersection','include','catch','create','body','find','describe','eml-format','rimraf','fast-json-patch'];(function(_0x13b6fc,_0x3e52c1){var _0x595398=function(_0x2fb338){while(--_0x2fb338){_0x13b6fc['push'](_0x13b6fc['shift']());}};_0x595398(++_0x3e52c1);}(_0xb84b,0x139));var _0xbb84=function(_0xdb6406,_0x431a46){_0xdb6406=_0xdb6406-0x0;var _0x24386d=_0xb84b[_0xdb6406];return _0x24386d;};'use strict';var emlformat=require(_0xbb84('0x0'));var rimraf=require(_0xbb84('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbb84('0x2'));var rp=require(_0xbb84('0x3'));var moment=require(_0xbb84('0x4'));var BPromise=require(_0xbb84('0x5'));var Mustache=require(_0xbb84('0x6'));var util=require('util');var path=require(_0xbb84('0x7'));var sox=require(_0xbb84('0x8'));var csv=require(_0xbb84('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbb84('0xa'));var _=require(_0xbb84('0xb'));var squel=require('squel');var crypto=require(_0xbb84('0xc'));var jsforce=require(_0xbb84('0xd'));var deskjs=require(_0xbb84('0xe'));var toCsv=require(_0xbb84('0x9'));var querystring=require(_0xbb84('0xf'));var Papa=require(_0xbb84('0x10'));var Redis=require(_0xbb84('0x11'));var authService=require(_0xbb84('0x12'));var qs=require(_0xbb84('0x13'));var as=require(_0xbb84('0x14'));var hardwareService=require(_0xbb84('0x15'));var logger=require('../../config/logger')(_0xbb84('0x16'));var utils=require(_0xbb84('0x17'));var config=require(_0xbb84('0x18'));var licenseUtil=require(_0xbb84('0x19'));var db=require(_0xbb84('0x1a'))['db'];function respondWithStatusCode(_0x54fea8,_0x55a917){_0x55a917=_0x55a917||0xcc;return function(_0x8a345e){if(_0x8a345e){return _0x54fea8['sendStatus'](_0x55a917);}return _0x54fea8[_0xbb84('0x1b')](_0x55a917)[_0xbb84('0x1c')]();};}function respondWithResult(_0xdd15cc,_0x18b330){_0x18b330=_0x18b330||0xc8;return function(_0x479a42){if(_0x479a42){return _0xdd15cc['status'](_0x18b330)[_0xbb84('0x1d')](_0x479a42);}};}function respondWithFilteredResult(_0x5c990c,_0x36c24d){return function(_0x4ec136){if(_0x4ec136){var _0x278d86=typeof _0x36c24d[_0xbb84('0x1e')]===_0xbb84('0x1f')&&typeof _0x36c24d['limit']===_0xbb84('0x1f');var _0x1e5ba9=_0x4ec136[_0xbb84('0x20')];var _0x358a4f=_0x278d86?0x0:_0x36c24d[_0xbb84('0x1e')];var _0xe1a193=_0x278d86?_0x4ec136[_0xbb84('0x20')]:_0x36c24d[_0xbb84('0x1e')]+_0x36c24d[_0xbb84('0x21')];var _0x28205c;if(_0xe1a193>=_0x1e5ba9){_0xe1a193=_0x1e5ba9;_0x28205c=0xc8;}else{_0x28205c=0xce;}_0x5c990c[_0xbb84('0x1b')](_0x28205c);return _0x5c990c[_0xbb84('0x22')](_0xbb84('0x23'),_0x358a4f+'-'+_0xe1a193+'/'+_0x1e5ba9)[_0xbb84('0x1d')](_0x4ec136);}return null;};}function patchUpdates(_0x346428){return function(_0x13e9ca){try{jsonpatch['apply'](_0x13e9ca,_0x346428,!![]);}catch(_0x2b2efa){return BPromise[_0xbb84('0x24')](_0x2b2efa);}return _0x13e9ca[_0xbb84('0x25')]();};}function saveUpdates(_0x417c7e,_0x108873){return function(_0x720c60){if(_0x720c60){return _0x720c60[_0xbb84('0x26')](_0x417c7e)[_0xbb84('0x27')](function(_0x17cf25){return _0x17cf25;});}return null;};}function removeEntity(_0x111ac9,_0x238eab){return function(_0x23c05d){if(_0x23c05d){return _0x23c05d[_0xbb84('0x28')]()[_0xbb84('0x27')](function(){_0x111ac9['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d44d5,_0x37b1d9){return function(_0x780b35){if(!_0x780b35){_0x4d44d5[_0xbb84('0x29')](0x194);}return _0x780b35;};}function handleError(_0x287bed,_0x5e11cd){_0x5e11cd=_0x5e11cd||0x1f4;return function(_0x28437e){logger[_0xbb84('0x2a')](_0x28437e[_0xbb84('0x2b')]);if(_0x28437e['name']){delete _0x28437e[_0xbb84('0x2c')];}_0x287bed[_0xbb84('0x1b')](_0x5e11cd)[_0xbb84('0x2d')](_0x28437e);};}exports[_0xbb84('0x2e')]=function(_0x2083f8,_0x4eb464){var _0x2e1bb4={},_0x5b6cf4={},_0x2b90a0={'count':0x0,'rows':[]};var _0x310665=_[_0xbb84('0x2f')](db[_0xbb84('0x30')][_0xbb84('0x31')],function(_0x4b0702){return{'name':_0x4b0702[_0xbb84('0x32')],'type':_0x4b0702['type']['key']};});_0x5b6cf4['model']=_[_0xbb84('0x2f')](_0x310665,'name');_0x5b6cf4[_0xbb84('0x33')]=_[_0xbb84('0x34')](_0x2083f8['query']);_0x5b6cf4[_0xbb84('0x35')]=_['intersection'](_0x5b6cf4[_0xbb84('0x36')],_0x5b6cf4[_0xbb84('0x33')]);_0x2e1bb4[_0xbb84('0x37')]=_['intersection'](_0x5b6cf4['model'],qs[_0xbb84('0x38')](_0x2083f8[_0xbb84('0x33')][_0xbb84('0x38')]));_0x2e1bb4[_0xbb84('0x37')]=_0x2e1bb4[_0xbb84('0x37')][_0xbb84('0x39')]?_0x2e1bb4[_0xbb84('0x37')]:_0x5b6cf4[_0xbb84('0x36')];if(!_0x2083f8[_0xbb84('0x33')]['hasOwnProperty'](_0xbb84('0x3a'))){_0x2e1bb4[_0xbb84('0x21')]=qs['limit'](_0x2083f8[_0xbb84('0x33')][_0xbb84('0x21')]);_0x2e1bb4[_0xbb84('0x1e')]=qs[_0xbb84('0x1e')](_0x2083f8[_0xbb84('0x33')][_0xbb84('0x1e')]);}_0x2e1bb4[_0xbb84('0x3b')]=qs[_0xbb84('0x3c')](_0x2083f8[_0xbb84('0x33')][_0xbb84('0x3c')]);_0x2e1bb4[_0xbb84('0x3d')]=qs['filters'](_['pick'](_0x2083f8[_0xbb84('0x33')],_0x5b6cf4[_0xbb84('0x35')]),_0x310665);if(_0x2083f8[_0xbb84('0x33')][_0xbb84('0x3e')]){_0x2e1bb4[_0xbb84('0x3d')]=_[_0xbb84('0x3f')](_0x2e1bb4[_0xbb84('0x3d')],{'$or':_[_0xbb84('0x2f')](_0x310665,function(_0x1a1fa3){if(_0x1a1fa3[_0xbb84('0x40')]!==_0xbb84('0x41')){var _0xd726b0={};_0xd726b0[_0x1a1fa3[_0xbb84('0x2c')]]={'$like':'%'+_0x2083f8['query']['filter']+'%'};return _0xd726b0;}})});}_0x2e1bb4=_['merge']({},_0x2e1bb4,_0x2083f8[_0xbb84('0x42')]);var _0x34a54a={'where':_0x2e1bb4[_0xbb84('0x3d')]};return db['OpenchannelQueueReport'][_0xbb84('0x20')](_0x34a54a)[_0xbb84('0x27')](function(_0x5784f0){_0x2b90a0[_0xbb84('0x20')]=_0x5784f0;if(_0x2083f8[_0xbb84('0x33')][_0xbb84('0x43')]){_0x2e1bb4['include']=[{'all':!![]}];}return db[_0xbb84('0x30')][_0xbb84('0x44')](_0x2e1bb4);})[_0xbb84('0x27')](function(_0x5c8bd8){_0x2b90a0[_0xbb84('0x45')]=_0x5c8bd8;return _0x2b90a0;})[_0xbb84('0x27')](respondWithFilteredResult(_0x4eb464,_0x2e1bb4))['catch'](handleError(_0x4eb464,null));};exports[_0xbb84('0x46')]=function(_0x28b02a,_0x3bec88){var _0x37edc5={'raw':!![],'where':{'id':_0x28b02a[_0xbb84('0x47')]['id']}},_0x3e95cc={};_0x3e95cc['model']=_[_0xbb84('0x34')](db['OpenchannelQueueReport'][_0xbb84('0x31')]);_0x3e95cc[_0xbb84('0x33')]=_['keys'](_0x28b02a[_0xbb84('0x33')]);_0x3e95cc['filters']=_['intersection'](_0x3e95cc[_0xbb84('0x36')],_0x3e95cc['query']);_0x37edc5['attributes']=_[_0xbb84('0x48')](_0x3e95cc[_0xbb84('0x36')],qs['fields'](_0x28b02a[_0xbb84('0x33')][_0xbb84('0x38')]));_0x37edc5[_0xbb84('0x37')]=_0x37edc5[_0xbb84('0x37')][_0xbb84('0x39')]?_0x37edc5[_0xbb84('0x37')]:_0x3e95cc['model'];if(_0x28b02a[_0xbb84('0x33')][_0xbb84('0x43')]){_0x37edc5[_0xbb84('0x49')]=[{'all':!![]}];}_0x37edc5=_[_0xbb84('0x3f')]({},_0x37edc5,_0x28b02a[_0xbb84('0x42')]);return db['OpenchannelQueueReport']['find'](_0x37edc5)[_0xbb84('0x27')](handleEntityNotFound(_0x3bec88,null))[_0xbb84('0x27')](respondWithResult(_0x3bec88,null))[_0xbb84('0x4a')](handleError(_0x3bec88,null));};exports['create']=function(_0x2e964a,_0x536122){return db[_0xbb84('0x30')][_0xbb84('0x4b')](_0x2e964a[_0xbb84('0x4c')],{})[_0xbb84('0x27')](respondWithResult(_0x536122,0xc9))['catch'](handleError(_0x536122,null));};exports['update']=function(_0x58ce2e,_0x1c455c){if(_0x58ce2e[_0xbb84('0x4c')]['id']){delete _0x58ce2e[_0xbb84('0x4c')]['id'];}return db[_0xbb84('0x30')][_0xbb84('0x4d')]({'where':{'id':_0x58ce2e[_0xbb84('0x47')]['id']}})[_0xbb84('0x27')](handleEntityNotFound(_0x1c455c,null))['then'](saveUpdates(_0x58ce2e[_0xbb84('0x4c')],null))[_0xbb84('0x27')](respondWithResult(_0x1c455c,null))[_0xbb84('0x4a')](handleError(_0x1c455c,null));};exports[_0xbb84('0x28')]=function(_0x20b493,_0x58656a){return db[_0xbb84('0x30')][_0xbb84('0x4d')]({'where':{'id':_0x20b493[_0xbb84('0x47')]['id']}})[_0xbb84('0x27')](handleEntityNotFound(_0x58656a,null))[_0xbb84('0x27')](removeEntity(_0x58656a,null))['catch'](handleError(_0x58656a,null));};exports[_0xbb84('0x4e')]=function(_0x3cc89e,_0x212081){return db[_0xbb84('0x30')][_0xbb84('0x4e')]()[_0xbb84('0x27')](respondWithResult(_0x212081,null))['catch'](handleError(_0x212081,null));}; \ No newline at end of file +var _0x40dd=['set','apply','reject','save','update','then','destroy','end','error','stack','name','index','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','map','VIRTUAL','filter','merge','OpenchannelQueueReport','includeAll','include','findAll','rows','catch','show','params','options','create','body','find','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','count'];(function(_0x98db33,_0x397f20){var _0x5ae63a=function(_0x411f1c){while(--_0x411f1c){_0x98db33['push'](_0x98db33['shift']());}};_0x5ae63a(++_0x397f20);}(_0x40dd,0x169));var _0xd40d=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x40dd[_0xa1e3e3];return _0xc980e9;};'use strict';var emlformat=require(_0xd40d('0x0'));var rimraf=require(_0xd40d('0x1'));var zipdir=require(_0xd40d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd40d('0x3'));var moment=require(_0xd40d('0x4'));var BPromise=require(_0xd40d('0x5'));var Mustache=require(_0xd40d('0x6'));var util=require(_0xd40d('0x7'));var path=require(_0xd40d('0x8'));var sox=require(_0xd40d('0x9'));var csv=require(_0xd40d('0xa'));var ejs=require(_0xd40d('0xb'));var fs=require('fs');var fs_extra=require(_0xd40d('0xc'));var _=require(_0xd40d('0xd'));var squel=require(_0xd40d('0xe'));var crypto=require(_0xd40d('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xd40d('0x10'));var toCsv=require(_0xd40d('0xa'));var querystring=require('querystring');var Papa=require(_0xd40d('0x11'));var Redis=require(_0xd40d('0x12'));var authService=require(_0xd40d('0x13'));var qs=require(_0xd40d('0x14'));var as=require(_0xd40d('0x15'));var hardwareService=require(_0xd40d('0x16'));var logger=require(_0xd40d('0x17'))(_0xd40d('0x18'));var utils=require(_0xd40d('0x19'));var config=require(_0xd40d('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xd40d('0x1b'))['db'];function respondWithStatusCode(_0xdd65c0,_0x440034){_0x440034=_0x440034||0xcc;return function(_0x11e49f){if(_0x11e49f){return _0xdd65c0[_0xd40d('0x1c')](_0x440034);}return _0xdd65c0['status'](_0x440034)['end']();};}function respondWithResult(_0x4decb9,_0x4666e3){_0x4666e3=_0x4666e3||0xc8;return function(_0x1d5176){if(_0x1d5176){return _0x4decb9[_0xd40d('0x1d')](_0x4666e3)[_0xd40d('0x1e')](_0x1d5176);}};}function respondWithFilteredResult(_0x158329,_0x172d05){return function(_0x134eff){if(_0x134eff){var _0x5d8420=typeof _0x172d05[_0xd40d('0x1f')]==='undefined'&&typeof _0x172d05[_0xd40d('0x20')]==='undefined';var _0x271342=_0x134eff[_0xd40d('0x21')];var _0x59a00a=_0x5d8420?0x0:_0x172d05[_0xd40d('0x1f')];var _0x52932e=_0x5d8420?_0x134eff['count']:_0x172d05['offset']+_0x172d05[_0xd40d('0x20')];var _0x5dc74c;if(_0x52932e>=_0x271342){_0x52932e=_0x271342;_0x5dc74c=0xc8;}else{_0x5dc74c=0xce;}_0x158329[_0xd40d('0x1d')](_0x5dc74c);return _0x158329[_0xd40d('0x22')]('Content-Range',_0x59a00a+'-'+_0x52932e+'/'+_0x271342)[_0xd40d('0x1e')](_0x134eff);}return null;};}function patchUpdates(_0x5a1e26){return function(_0x117428){try{jsonpatch[_0xd40d('0x23')](_0x117428,_0x5a1e26,!![]);}catch(_0x4f51e4){return BPromise[_0xd40d('0x24')](_0x4f51e4);}return _0x117428[_0xd40d('0x25')]();};}function saveUpdates(_0x1a89a3,_0x5b25c3){return function(_0x51f396){if(_0x51f396){return _0x51f396[_0xd40d('0x26')](_0x1a89a3)[_0xd40d('0x27')](function(_0x206b53){return _0x206b53;});}return null;};}function removeEntity(_0x516be1,_0x311137){return function(_0xb0b985){if(_0xb0b985){return _0xb0b985[_0xd40d('0x28')]()[_0xd40d('0x27')](function(){_0x516be1[_0xd40d('0x1d')](0xcc)[_0xd40d('0x29')]();});}};}function handleEntityNotFound(_0x49f341,_0x5b52c2){return function(_0x1f921d){if(!_0x1f921d){_0x49f341[_0xd40d('0x1c')](0x194);}return _0x1f921d;};}function handleError(_0x277060,_0x5712c8){_0x5712c8=_0x5712c8||0x1f4;return function(_0x26d0ba){logger[_0xd40d('0x2a')](_0x26d0ba[_0xd40d('0x2b')]);if(_0x26d0ba[_0xd40d('0x2c')]){delete _0x26d0ba[_0xd40d('0x2c')];}_0x277060[_0xd40d('0x1d')](_0x5712c8)['send'](_0x26d0ba);};}exports[_0xd40d('0x2d')]=function(_0x2e12b6,_0x9af341){var _0x78e858={},_0x3dc7ab={},_0xf45938={'count':0x0,'rows':[]};var _0xb45be7=_['map'](db['OpenchannelQueueReport'][_0xd40d('0x2e')],function(_0x49d851){return{'name':_0x49d851[_0xd40d('0x2f')],'type':_0x49d851['type'][_0xd40d('0x30')]};});_0x3dc7ab[_0xd40d('0x31')]=_['map'](_0xb45be7,_0xd40d('0x2c'));_0x3dc7ab[_0xd40d('0x32')]=_[_0xd40d('0x33')](_0x2e12b6['query']);_0x3dc7ab[_0xd40d('0x34')]=_[_0xd40d('0x35')](_0x3dc7ab[_0xd40d('0x31')],_0x3dc7ab[_0xd40d('0x32')]);_0x78e858['attributes']=_['intersection'](_0x3dc7ab[_0xd40d('0x31')],qs['fields'](_0x2e12b6[_0xd40d('0x32')][_0xd40d('0x36')]));_0x78e858[_0xd40d('0x37')]=_0x78e858[_0xd40d('0x37')][_0xd40d('0x38')]?_0x78e858['attributes']:_0x3dc7ab[_0xd40d('0x31')];if(!_0x2e12b6[_0xd40d('0x32')][_0xd40d('0x39')](_0xd40d('0x3a'))){_0x78e858[_0xd40d('0x20')]=qs['limit'](_0x2e12b6['query'][_0xd40d('0x20')]);_0x78e858[_0xd40d('0x1f')]=qs[_0xd40d('0x1f')](_0x2e12b6[_0xd40d('0x32')][_0xd40d('0x1f')]);}_0x78e858[_0xd40d('0x3b')]=qs[_0xd40d('0x3c')](_0x2e12b6['query'][_0xd40d('0x3c')]);_0x78e858[_0xd40d('0x3d')]=qs[_0xd40d('0x34')](_[_0xd40d('0x3e')](_0x2e12b6[_0xd40d('0x32')],_0x3dc7ab[_0xd40d('0x34')]),_0xb45be7);if(_0x2e12b6['query']['filter']){_0x78e858[_0xd40d('0x3d')]=_['merge'](_0x78e858['where'],{'$or':_[_0xd40d('0x3f')](_0xb45be7,function(_0x95af0b){if(_0x95af0b['type']!==_0xd40d('0x40')){var _0x339c24={};_0x339c24[_0x95af0b[_0xd40d('0x2c')]]={'$like':'%'+_0x2e12b6['query'][_0xd40d('0x41')]+'%'};return _0x339c24;}})});}_0x78e858=_[_0xd40d('0x42')]({},_0x78e858,_0x2e12b6['options']);var _0x30a3a0={'where':_0x78e858[_0xd40d('0x3d')]};return db[_0xd40d('0x43')][_0xd40d('0x21')](_0x30a3a0)[_0xd40d('0x27')](function(_0x527a3e){_0xf45938[_0xd40d('0x21')]=_0x527a3e;if(_0x2e12b6[_0xd40d('0x32')][_0xd40d('0x44')]){_0x78e858[_0xd40d('0x45')]=[{'all':!![]}];}return db[_0xd40d('0x43')][_0xd40d('0x46')](_0x78e858);})[_0xd40d('0x27')](function(_0x3a77f5){_0xf45938[_0xd40d('0x47')]=_0x3a77f5;return _0xf45938;})[_0xd40d('0x27')](respondWithFilteredResult(_0x9af341,_0x78e858))[_0xd40d('0x48')](handleError(_0x9af341,null));};exports[_0xd40d('0x49')]=function(_0x7c2bdb,_0x5abbda){var _0x3e45a0={'raw':!![],'where':{'id':_0x7c2bdb[_0xd40d('0x4a')]['id']}},_0x3c0296={};_0x3c0296[_0xd40d('0x31')]=_['keys'](db[_0xd40d('0x43')][_0xd40d('0x2e')]);_0x3c0296[_0xd40d('0x32')]=_[_0xd40d('0x33')](_0x7c2bdb['query']);_0x3c0296['filters']=_[_0xd40d('0x35')](_0x3c0296[_0xd40d('0x31')],_0x3c0296[_0xd40d('0x32')]);_0x3e45a0[_0xd40d('0x37')]=_[_0xd40d('0x35')](_0x3c0296['model'],qs[_0xd40d('0x36')](_0x7c2bdb[_0xd40d('0x32')][_0xd40d('0x36')]));_0x3e45a0[_0xd40d('0x37')]=_0x3e45a0[_0xd40d('0x37')][_0xd40d('0x38')]?_0x3e45a0['attributes']:_0x3c0296[_0xd40d('0x31')];if(_0x7c2bdb['query'][_0xd40d('0x44')]){_0x3e45a0['include']=[{'all':!![]}];}_0x3e45a0=_[_0xd40d('0x42')]({},_0x3e45a0,_0x7c2bdb[_0xd40d('0x4b')]);return db[_0xd40d('0x43')]['find'](_0x3e45a0)[_0xd40d('0x27')](handleEntityNotFound(_0x5abbda,null))[_0xd40d('0x27')](respondWithResult(_0x5abbda,null))[_0xd40d('0x48')](handleError(_0x5abbda,null));};exports[_0xd40d('0x4c')]=function(_0x1103a5,_0x1ed18a){return db['OpenchannelQueueReport'][_0xd40d('0x4c')](_0x1103a5[_0xd40d('0x4d')],{})[_0xd40d('0x27')](respondWithResult(_0x1ed18a,0xc9))['catch'](handleError(_0x1ed18a,null));};exports[_0xd40d('0x26')]=function(_0x1a101e,_0x33a283){if(_0x1a101e[_0xd40d('0x4d')]['id']){delete _0x1a101e[_0xd40d('0x4d')]['id'];}return db[_0xd40d('0x43')][_0xd40d('0x4e')]({'where':{'id':_0x1a101e[_0xd40d('0x4a')]['id']}})['then'](handleEntityNotFound(_0x33a283,null))[_0xd40d('0x27')](saveUpdates(_0x1a101e['body'],null))[_0xd40d('0x27')](respondWithResult(_0x33a283,null))[_0xd40d('0x48')](handleError(_0x33a283,null));};exports['destroy']=function(_0x2545a3,_0x1d3501){return db['OpenchannelQueueReport'][_0xd40d('0x4e')]({'where':{'id':_0x2545a3[_0xd40d('0x4a')]['id']}})[_0xd40d('0x27')](handleEntityNotFound(_0x1d3501,null))['then'](removeEntity(_0x1d3501,null))[_0xd40d('0x48')](handleError(_0x1d3501,null));};exports['describe']=function(_0x1e8fdb,_0x430b0f){return db[_0xd40d('0x43')]['describe']()[_0xd40d('0x27')](respondWithResult(_0x430b0f,null))['catch'](handleError(_0x430b0f,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 6696007..8880636 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 _0xc4aa=['bluebird','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','lodash','util','../../config/logger','api','moment'];(function(_0x1eab6d,_0x39ff21){var _0x16be0b=function(_0x17d6ed){while(--_0x17d6ed){_0x1eab6d['push'](_0x1eab6d['shift']());}};_0x16be0b(++_0x39ff21);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x88cd7b,_0x4c884c){_0x88cd7b=_0x88cd7b-0x0;var _0x56fcc8=_0xc4aa[_0x88cd7b];return _0x56fcc8;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var logger=require(_0xac4a('0x2'))(_0xac4a('0x3'));var moment=require(_0xac4a('0x4'));var BPromise=require(_0xac4a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xac4a('0x6'));var attributes=require(_0xac4a('0x7'));module[_0xac4a('0x8')]=function(_0x215f39,_0x96be2b){return _0x215f39[_0xac4a('0x9')](_0xac4a('0xa'),attributes,{'tableName':_0xac4a('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x814b=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','uniqueid','lodash','util'];(function(_0x28e74e,_0x53fdf1){var _0xb45ac1=function(_0x311a7a){while(--_0x311a7a){_0x28e74e['push'](_0x28e74e['shift']());}};_0xb45ac1(++_0x53fdf1);}(_0x814b,0x1a2));var _0xb814=function(_0x56c70f,_0x4e4493){_0x56c70f=_0x56c70f-0x0;var _0x3812ed=_0x814b[_0x56c70f];return _0x3812ed;};'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 diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 5128518..207ec57 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 _0x174b=['body','options','raw','CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','OpenchannelQueueReport','update','attributes','limit','stringify','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','request\x20sent','debug','error','OpenchannelQueueReport,\x20%s,\x20%s','message','result','catch','create'];(function(_0xaf27ed,_0x35d737){var _0x15ae4f=function(_0x5730e2){while(--_0x5730e2){_0xaf27ed['push'](_0xaf27ed['shift']());}};_0x15ae4f(++_0x35d737);}(_0x174b,0x19d));var _0xb174=function(_0x5785e0,_0x1cc2a6){_0x5785e0=_0x5785e0-0x0;var _0x535e6c=_0x174b[_0x5785e0];return _0x535e6c;};'use strict';var _=require(_0xb174('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xb174('0x1'));var rs=require(_0xb174('0x2'));var fs=require('fs');var Redis=require(_0xb174('0x3'));var db=require(_0xb174('0x4'))['db'];var utils=require(_0xb174('0x5'));var logger=require(_0xb174('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xb174('0x7'));var client=jayson[_0xb174('0x8')][_0xb174('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3e7a36,_0xa073f6,_0x1e3e13){return new BPromise(function(_0x465cd6,_0x149942){return client[_0xb174('0xa')](_0x3e7a36,_0x1e3e13)[_0xb174('0xb')](function(_0x4c3cea){logger[_0xb174('0xc')]('OpenchannelQueueReport,\x20%s,\x20%s',_0xa073f6,_0xb174('0xd'));logger[_0xb174('0xe')]('OpenchannelQueueReport,\x20%s,\x20%s,\x20%s',_0xa073f6,_0xb174('0xd'),JSON['stringify'](_0x4c3cea));if(_0x4c3cea[_0xb174('0xf')]){if(_0x4c3cea[_0xb174('0xf')]['code']===0x1f4){logger[_0xb174('0xf')](_0xb174('0x10'),_0xa073f6,_0x4c3cea[_0xb174('0xf')][_0xb174('0x11')]);return _0x149942(_0x4c3cea['error'][_0xb174('0x11')]);}logger['error'](_0xb174('0x10'),_0xa073f6,_0x4c3cea[_0xb174('0xf')][_0xb174('0x11')]);return _0x465cd6(_0x4c3cea[_0xb174('0xf')]['message']);}else{logger[_0xb174('0xc')](_0xb174('0x10'),_0xa073f6,_0xb174('0xd'));_0x465cd6(_0x4c3cea[_0xb174('0x12')][_0xb174('0x11')]);}})[_0xb174('0x13')](function(_0x5d31ac){logger['error']('OpenchannelQueueReport,\x20%s,\x20%s',_0xa073f6,_0x5d31ac);_0x149942(_0x5d31ac);});});}exports['CreateOpenchannelQueueReport']=function(_0x2ab4dc){var _0x4fb4eb=this;return new Promise(function(_0xaf80a9,_0x1a6f40){return db['OpenchannelQueueReport'][_0xb174('0x14')](_0x2ab4dc[_0xb174('0x15')],{'raw':_0x2ab4dc[_0xb174('0x16')]?_0x2ab4dc[_0xb174('0x16')][_0xb174('0x17')]===undefined?!![]:![]:!![]})[_0xb174('0xb')](function(_0xcc8d9a){logger['info'](_0xb174('0x18'),_0x2ab4dc);logger[_0xb174('0xe')]('CreateOpenchannelQueueReport',_0x2ab4dc,JSON['stringify'](_0xcc8d9a));_0xaf80a9(_0xcc8d9a);})['catch'](function(_0x338dc4){logger[_0xb174('0xf')](_0xb174('0x18'),_0x338dc4['message'],_0x2ab4dc);_0x1a6f40(_0x4fb4eb[_0xb174('0xf')](0x1f4,_0x338dc4[_0xb174('0x11')]));});});};exports[_0xb174('0x19')]=function(_0x5a3fbd){var _0x19473b=this;return new Promise(function(_0x410411,_0x3b5abf){return db[_0xb174('0x1a')][_0xb174('0x1b')](_0x5a3fbd['body'],{'raw':_0x5a3fbd[_0xb174('0x16')]?_0x5a3fbd['options'][_0xb174('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5a3fbd[_0xb174('0x16')]?_0x5a3fbd[_0xb174('0x16')]['where']||null:null,'attributes':_0x5a3fbd['options']?_0x5a3fbd[_0xb174('0x16')][_0xb174('0x1c')]||null:null,'limit':_0x5a3fbd['options']?_0x5a3fbd['options'][_0xb174('0x1d')]||null:null})['then'](function(_0x291d6c){logger[_0xb174('0xc')](_0xb174('0x19'),_0x5a3fbd);logger[_0xb174('0xe')](_0xb174('0x19'),_0x5a3fbd,JSON[_0xb174('0x1e')](_0x291d6c));_0x410411(_0x291d6c);})[_0xb174('0x13')](function(_0x530167){logger['error'](_0xb174('0x19'),_0x530167[_0xb174('0x11')],_0x5a3fbd);_0x3b5abf(_0x19473b[_0xb174('0xf')](0x1f4,_0x530167[_0xb174('0x11')]));});});}; \ No newline at end of file +var _0x9c00=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','create','body','options','raw','CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','OpenchannelQueueReport','where','attributes','limit','lodash','util','randomstring','ioredis'];(function(_0x57411a,_0x59328f){var _0xd487ba=function(_0x2fb456){while(--_0x2fb456){_0x57411a['push'](_0x57411a['shift']());}};_0xd487ba(++_0x59328f);}(_0x9c00,0x1a0));var _0x09c0=function(_0x5227ab,_0x514da4){_0x5227ab=_0x5227ab-0x0;var _0x3dc702=_0x9c00[_0x5227ab];return _0x3dc702;};'use strict';var _=require(_0x09c0('0x0'));var util=require(_0x09c0('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x09c0('0x2'));var fs=require('fs');var Redis=require(_0x09c0('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x09c0('0x4'));var logger=require(_0x09c0('0x5'))(_0x09c0('0x6'));var config=require(_0x09c0('0x7'));var jayson=require(_0x09c0('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1f3d7e,_0x17d11f,_0x1b633b){return new BPromise(function(_0x3187aa,_0x17cd9d){return client['request'](_0x1f3d7e,_0x1b633b)[_0x09c0('0x9')](function(_0x1c1246){logger[_0x09c0('0xa')](_0x09c0('0xb'),_0x17d11f,_0x09c0('0xc'));logger[_0x09c0('0xd')](_0x09c0('0xe'),_0x17d11f,_0x09c0('0xc'),JSON[_0x09c0('0xf')](_0x1c1246));if(_0x1c1246[_0x09c0('0x10')]){if(_0x1c1246[_0x09c0('0x10')][_0x09c0('0x11')]===0x1f4){logger[_0x09c0('0x10')](_0x09c0('0xb'),_0x17d11f,_0x1c1246[_0x09c0('0x10')][_0x09c0('0x12')]);return _0x17cd9d(_0x1c1246[_0x09c0('0x10')][_0x09c0('0x12')]);}logger[_0x09c0('0x10')](_0x09c0('0xb'),_0x17d11f,_0x1c1246[_0x09c0('0x10')][_0x09c0('0x12')]);return _0x3187aa(_0x1c1246[_0x09c0('0x10')][_0x09c0('0x12')]);}else{logger[_0x09c0('0xa')](_0x09c0('0xb'),_0x17d11f,'request\x20sent');_0x3187aa(_0x1c1246['result']['message']);}})[_0x09c0('0x13')](function(_0x11f4b2){logger[_0x09c0('0x10')](_0x09c0('0xb'),_0x17d11f,_0x11f4b2);_0x17cd9d(_0x11f4b2);});});}exports['CreateOpenchannelQueueReport']=function(_0x2c4440){var _0x4aa8a5=this;return new Promise(function(_0x4c29a7,_0x2c12da){return db['OpenchannelQueueReport'][_0x09c0('0x14')](_0x2c4440[_0x09c0('0x15')],{'raw':_0x2c4440[_0x09c0('0x16')]?_0x2c4440['options'][_0x09c0('0x17')]===undefined?!![]:![]:!![]})[_0x09c0('0x9')](function(_0x8ad645){logger[_0x09c0('0xa')](_0x09c0('0x18'),_0x2c4440);logger[_0x09c0('0xd')](_0x09c0('0x18'),_0x2c4440,JSON['stringify'](_0x8ad645));_0x4c29a7(_0x8ad645);})[_0x09c0('0x13')](function(_0x46f171){logger[_0x09c0('0x10')](_0x09c0('0x18'),_0x46f171['message'],_0x2c4440);_0x2c12da(_0x4aa8a5['error'](0x1f4,_0x46f171[_0x09c0('0x12')]));});});};exports[_0x09c0('0x19')]=function(_0x1e8a1c){var _0x3a5370=this;return new Promise(function(_0x491e6f,_0x42ebfc){return db[_0x09c0('0x1a')]['update'](_0x1e8a1c[_0x09c0('0x15')],{'raw':_0x1e8a1c[_0x09c0('0x16')]?_0x1e8a1c[_0x09c0('0x16')][_0x09c0('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1e8a1c[_0x09c0('0x16')]?_0x1e8a1c[_0x09c0('0x16')][_0x09c0('0x1b')]||null:null,'attributes':_0x1e8a1c[_0x09c0('0x16')]?_0x1e8a1c[_0x09c0('0x16')][_0x09c0('0x1c')]||null:null,'limit':_0x1e8a1c[_0x09c0('0x16')]?_0x1e8a1c['options'][_0x09c0('0x1d')]||null:null})[_0x09c0('0x9')](function(_0x53a7b8){logger[_0x09c0('0xa')]('UpdateOpenchannelQueueReport',_0x1e8a1c);logger[_0x09c0('0xd')]('UpdateOpenchannelQueueReport',_0x1e8a1c,JSON[_0x09c0('0xf')](_0x53a7b8));_0x491e6f(_0x53a7b8);})[_0x09c0('0x13')](function(_0x108409){logger[_0x09c0('0x10')]('UpdateOpenchannelQueueReport',_0x108409['message'],_0x1e8a1c);_0x42ebfc(_0x3a5370[_0x09c0('0x10')](0x1f4,_0x108409[_0x09c0('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 2029dc5..0c82ea3 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 _0x7cec=['../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','isAuthenticated','get','/describe','/:id','show','post','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x7cec,0x113));var _0xc7ce=function(_0x2315ad,_0x1b40e0){_0x2315ad=_0x2315ad-0x0;var _0x4aa7b0=_0x7cec[_0x2315ad];return _0x4aa7b0;};'use strict';var multer=require(_0xc7ce('0x0'));var util=require('util');var path=require(_0xc7ce('0x1'));var timeout=require(_0xc7ce('0x2'));var express=require(_0xc7ce('0x3'));var router=express[_0xc7ce('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xc7ce('0x5'));var interaction=require(_0xc7ce('0x6'));var config=require(_0xc7ce('0x7'));var controller=require(_0xc7ce('0x8'));router['get']('/',auth[_0xc7ce('0x9')](),controller['index']);router[_0xc7ce('0xa')](_0xc7ce('0xb'),auth[_0xc7ce('0x9')](),controller['describe']);router[_0xc7ce('0xa')](_0xc7ce('0xc'),auth[_0xc7ce('0x9')](),controller[_0xc7ce('0xd')]);router[_0xc7ce('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc7ce('0xf')](_0xc7ce('0xc'),auth[_0xc7ce('0x9')](),controller[_0xc7ce('0x10')]);router[_0xc7ce('0x11')](_0xc7ce('0xc'),auth[_0xc7ce('0x9')](),controller[_0xc7ce('0x12')]);module[_0xc7ce('0x13')]=router; \ No newline at end of file +var _0xf3fb=['describe','/:id','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get'];(function(_0xd02def,_0x144f25){var _0x2e8374=function(_0x5ceb35){while(--_0x5ceb35){_0xd02def['push'](_0xd02def['shift']());}};_0x2e8374(++_0x144f25);}(_0xf3fb,0xc6));var _0xbf3f=function(_0x458363,_0x1675db){_0x458363=_0x458363-0x0;var _0x4d0290=_0xf3fb[_0x458363];return _0x4d0290;};'use strict';var multer=require(_0xbf3f('0x0'));var util=require(_0xbf3f('0x1'));var path=require('path');var timeout=require(_0xbf3f('0x2'));var express=require(_0xbf3f('0x3'));var router=express[_0xbf3f('0x4')]();var fs_extra=require(_0xbf3f('0x5'));var auth=require(_0xbf3f('0x6'));var interaction=require(_0xbf3f('0x7'));var config=require(_0xbf3f('0x8'));var controller=require('./openchannelTransferReport.controller');router['get']('/',auth[_0xbf3f('0x9')](),controller[_0xbf3f('0xa')]);router[_0xbf3f('0xb')]('/describe',auth[_0xbf3f('0x9')](),controller[_0xbf3f('0xc')]);router[_0xbf3f('0xb')](_0xbf3f('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xbf3f('0xe')]('/',auth[_0xbf3f('0x9')](),controller[_0xbf3f('0xf')]);router[_0xbf3f('0x10')](_0xbf3f('0xd'),auth[_0xbf3f('0x9')](),controller[_0xbf3f('0x11')]);router[_0xbf3f('0x12')](_0xbf3f('0xd'),auth[_0xbf3f('0x9')](),controller[_0xbf3f('0x13')]);module[_0xbf3f('0x14')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index 62d14ad..dc50d3c 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 _0xf4eb=['NOW','moment','account','queue','DATE'];(function(_0x5cbc24,_0x3e11f4){var _0x2a3a2c=function(_0x52c342){while(--_0x52c342){_0x5cbc24['push'](_0x5cbc24['shift']());}};_0x2a3a2c(++_0x3e11f4);}(_0xf4eb,0xec));var _0xbf4e=function(_0x570e51,_0x4325a7){_0x570e51=_0x570e51-0x0;var _0x2d5cce=_0xf4eb[_0x570e51];return _0x2d5cce;};'use strict';var moment=require(_0xbf4e('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xbf4e('0x1'),'agent','queue'),'allowNull':![],'defaultValue':_0xbf4e('0x2')},'transferredAt':{'type':Sequelize[_0xbf4e('0x3')],'allowNull':![],'defaultValue':Sequelize[_0xbf4e('0x4')]}}; \ No newline at end of file +var _0xcb91=['STRING','ENUM','account','queue','NOW','exports'];(function(_0x1ef1e1,_0x1898cc){var _0x12e953=function(_0x28aa96){while(--_0x28aa96){_0x1ef1e1['push'](_0x1ef1e1['shift']());}};_0x12e953(++_0x1898cc);}(_0xcb91,0x1a9));var _0x1cb9=function(_0xf26c2e,_0x56c3ea){_0xf26c2e=_0xf26c2e-0x0;var _0x46ecb4=_0xcb91[_0xf26c2e];return _0x46ecb4;};'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 diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 09b7254..b35ff10 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 _0xfa65=['show','params','keys','includeAll','options','find','create','body','describe','rimraf','zip-dir','fast-json-patch','moment','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','reject','update','destroy','then','name','send','index','map','OpenchannelTransferReport','rawAttributes','fieldName','model','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','findAll','rows','catch'];(function(_0x2421f3,_0xdb1c83){var _0x3bd74c=function(_0x547dc2){while(--_0x547dc2){_0x2421f3['push'](_0x2421f3['shift']());}};_0x3bd74c(++_0xdb1c83);}(_0xfa65,0x97));var _0x5fa6=function(_0x2045c5,_0xef0ec8){_0x2045c5=_0x2045c5-0x0;var _0x4744ca=_0xfa65[_0x2045c5];return _0x4744ca;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5fa6('0x0'));var zipdir=require(_0x5fa6('0x1'));var jsonpatch=require(_0x5fa6('0x2'));var rp=require('request-promise');var moment=require(_0x5fa6('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x5fa6('0x4'));var path=require(_0x5fa6('0x5'));var sox=require('sox');var csv=require(_0x5fa6('0x6'));var ejs=require(_0x5fa6('0x7'));var fs=require('fs');var fs_extra=require(_0x5fa6('0x8'));var _=require(_0x5fa6('0x9'));var squel=require(_0x5fa6('0xa'));var crypto=require('crypto');var jsforce=require(_0x5fa6('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x5fa6('0x6'));var querystring=require(_0x5fa6('0xc'));var Papa=require(_0x5fa6('0xd'));var Redis=require(_0x5fa6('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x5fa6('0xf'));var as=require(_0x5fa6('0x10'));var hardwareService=require(_0x5fa6('0x11'));var logger=require(_0x5fa6('0x12'))(_0x5fa6('0x13'));var utils=require('../../config/utils');var config=require(_0x5fa6('0x14'));var licenseUtil=require(_0x5fa6('0x15'));var db=require(_0x5fa6('0x16'))['db'];function respondWithStatusCode(_0x3dff26,_0x1a08a6){_0x1a08a6=_0x1a08a6||0xcc;return function(_0x423d74){if(_0x423d74){return _0x3dff26[_0x5fa6('0x17')](_0x1a08a6);}return _0x3dff26['status'](_0x1a08a6)[_0x5fa6('0x18')]();};}function respondWithResult(_0x4cb982,_0x387f09){_0x387f09=_0x387f09||0xc8;return function(_0x365b6b){if(_0x365b6b){return _0x4cb982[_0x5fa6('0x19')](_0x387f09)['json'](_0x365b6b);}};}function respondWithFilteredResult(_0x380ab2,_0x7e498e){return function(_0x4595df){if(_0x4595df){var _0x2e7558=typeof _0x7e498e[_0x5fa6('0x1a')]===_0x5fa6('0x1b')&&typeof _0x7e498e[_0x5fa6('0x1c')]===_0x5fa6('0x1b');var _0x3c95a4=_0x4595df[_0x5fa6('0x1d')];var _0x1529ae=_0x2e7558?0x0:_0x7e498e['offset'];var _0x22a66f=_0x2e7558?_0x4595df[_0x5fa6('0x1d')]:_0x7e498e['offset']+_0x7e498e['limit'];var _0xea7678;if(_0x22a66f>=_0x3c95a4){_0x22a66f=_0x3c95a4;_0xea7678=0xc8;}else{_0xea7678=0xce;}_0x380ab2[_0x5fa6('0x19')](_0xea7678);return _0x380ab2[_0x5fa6('0x1e')](_0x5fa6('0x1f'),_0x1529ae+'-'+_0x22a66f+'/'+_0x3c95a4)[_0x5fa6('0x20')](_0x4595df);}return null;};}function patchUpdates(_0x1c0413){return function(_0x1df127){try{jsonpatch['apply'](_0x1df127,_0x1c0413,!![]);}catch(_0xaa6d6a){return BPromise[_0x5fa6('0x21')](_0xaa6d6a);}return _0x1df127['save']();};}function saveUpdates(_0x1d07e5,_0x4b1743){return function(_0x2bed95){if(_0x2bed95){return _0x2bed95[_0x5fa6('0x22')](_0x1d07e5)['then'](function(_0x55226f){return _0x55226f;});}return null;};}function removeEntity(_0x3bdf06,_0x2b12cd){return function(_0xe2fc3e){if(_0xe2fc3e){return _0xe2fc3e[_0x5fa6('0x23')]()[_0x5fa6('0x24')](function(){_0x3bdf06[_0x5fa6('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b055e,_0x47d6c1){return function(_0x321eb9){if(!_0x321eb9){_0x2b055e[_0x5fa6('0x17')](0x194);}return _0x321eb9;};}function handleError(_0x2827ca,_0x46973b){_0x46973b=_0x46973b||0x1f4;return function(_0x270697){logger['error'](_0x270697['stack']);if(_0x270697[_0x5fa6('0x25')]){delete _0x270697[_0x5fa6('0x25')];}_0x2827ca[_0x5fa6('0x19')](_0x46973b)[_0x5fa6('0x26')](_0x270697);};}exports[_0x5fa6('0x27')]=function(_0x34dab0,_0xb753d5){var _0x3f1007={},_0xaa2bf0={},_0x54e134={'count':0x0,'rows':[]};var _0x2b2c35=_[_0x5fa6('0x28')](db[_0x5fa6('0x29')][_0x5fa6('0x2a')],function(_0x4f1fb8){return{'name':_0x4f1fb8[_0x5fa6('0x2b')],'type':_0x4f1fb8['type']['key']};});_0xaa2bf0[_0x5fa6('0x2c')]=_[_0x5fa6('0x28')](_0x2b2c35,_0x5fa6('0x25'));_0xaa2bf0[_0x5fa6('0x2d')]=_['keys'](_0x34dab0['query']);_0xaa2bf0['filters']=_[_0x5fa6('0x2e')](_0xaa2bf0['model'],_0xaa2bf0[_0x5fa6('0x2d')]);_0x3f1007[_0x5fa6('0x2f')]=_[_0x5fa6('0x2e')](_0xaa2bf0[_0x5fa6('0x2c')],qs[_0x5fa6('0x30')](_0x34dab0[_0x5fa6('0x2d')][_0x5fa6('0x30')]));_0x3f1007[_0x5fa6('0x2f')]=_0x3f1007[_0x5fa6('0x2f')][_0x5fa6('0x31')]?_0x3f1007[_0x5fa6('0x2f')]:_0xaa2bf0[_0x5fa6('0x2c')];if(!_0x34dab0[_0x5fa6('0x2d')][_0x5fa6('0x32')]('nolimit')){_0x3f1007[_0x5fa6('0x1c')]=qs[_0x5fa6('0x1c')](_0x34dab0[_0x5fa6('0x2d')][_0x5fa6('0x1c')]);_0x3f1007[_0x5fa6('0x1a')]=qs[_0x5fa6('0x1a')](_0x34dab0[_0x5fa6('0x2d')]['offset']);}_0x3f1007[_0x5fa6('0x33')]=qs[_0x5fa6('0x34')](_0x34dab0[_0x5fa6('0x2d')]['sort']);_0x3f1007[_0x5fa6('0x35')]=qs[_0x5fa6('0x36')](_[_0x5fa6('0x37')](_0x34dab0['query'],_0xaa2bf0[_0x5fa6('0x36')]),_0x2b2c35);if(_0x34dab0['query'][_0x5fa6('0x38')]){_0x3f1007[_0x5fa6('0x35')]=_[_0x5fa6('0x39')](_0x3f1007['where'],{'$or':_[_0x5fa6('0x28')](_0x2b2c35,function(_0xe2e10e){if(_0xe2e10e['type']!==_0x5fa6('0x3a')){var _0xd1857d={};_0xd1857d[_0xe2e10e['name']]={'$like':'%'+_0x34dab0[_0x5fa6('0x2d')][_0x5fa6('0x38')]+'%'};return _0xd1857d;}})});}_0x3f1007=_['merge']({},_0x3f1007,_0x34dab0['options']);var _0x2ef99d={'where':_0x3f1007[_0x5fa6('0x35')]};return db[_0x5fa6('0x29')][_0x5fa6('0x1d')](_0x2ef99d)[_0x5fa6('0x24')](function(_0x167269){_0x54e134['count']=_0x167269;if(_0x34dab0[_0x5fa6('0x2d')]['includeAll']){_0x3f1007['include']=[{'all':!![]}];}return db['OpenchannelTransferReport'][_0x5fa6('0x3b')](_0x3f1007);})[_0x5fa6('0x24')](function(_0x52527a){_0x54e134[_0x5fa6('0x3c')]=_0x52527a;return _0x54e134;})['then'](respondWithFilteredResult(_0xb753d5,_0x3f1007))[_0x5fa6('0x3d')](handleError(_0xb753d5,null));};exports[_0x5fa6('0x3e')]=function(_0x38ffd4,_0x23a7a3){var _0x12ad10={'raw':!![],'where':{'id':_0x38ffd4[_0x5fa6('0x3f')]['id']}},_0x320343={};_0x320343['model']=_[_0x5fa6('0x40')](db[_0x5fa6('0x29')][_0x5fa6('0x2a')]);_0x320343[_0x5fa6('0x2d')]=_[_0x5fa6('0x40')](_0x38ffd4['query']);_0x320343[_0x5fa6('0x36')]=_[_0x5fa6('0x2e')](_0x320343[_0x5fa6('0x2c')],_0x320343['query']);_0x12ad10[_0x5fa6('0x2f')]=_[_0x5fa6('0x2e')](_0x320343[_0x5fa6('0x2c')],qs[_0x5fa6('0x30')](_0x38ffd4[_0x5fa6('0x2d')][_0x5fa6('0x30')]));_0x12ad10[_0x5fa6('0x2f')]=_0x12ad10[_0x5fa6('0x2f')]['length']?_0x12ad10['attributes']:_0x320343[_0x5fa6('0x2c')];if(_0x38ffd4['query'][_0x5fa6('0x41')]){_0x12ad10['include']=[{'all':!![]}];}_0x12ad10=_['merge']({},_0x12ad10,_0x38ffd4[_0x5fa6('0x42')]);return db['OpenchannelTransferReport'][_0x5fa6('0x43')](_0x12ad10)['then'](handleEntityNotFound(_0x23a7a3,null))[_0x5fa6('0x24')](respondWithResult(_0x23a7a3,null))[_0x5fa6('0x3d')](handleError(_0x23a7a3,null));};exports[_0x5fa6('0x44')]=function(_0x4aa21b,_0x483c76){return db['OpenchannelTransferReport']['create'](_0x4aa21b[_0x5fa6('0x45')],{})['then'](respondWithResult(_0x483c76,0xc9))[_0x5fa6('0x3d')](handleError(_0x483c76,null));};exports[_0x5fa6('0x22')]=function(_0x348920,_0x2f3134){if(_0x348920[_0x5fa6('0x45')]['id']){delete _0x348920[_0x5fa6('0x45')]['id'];}return db[_0x5fa6('0x29')][_0x5fa6('0x43')]({'where':{'id':_0x348920['params']['id']}})[_0x5fa6('0x24')](handleEntityNotFound(_0x2f3134,null))[_0x5fa6('0x24')](saveUpdates(_0x348920[_0x5fa6('0x45')],null))[_0x5fa6('0x24')](respondWithResult(_0x2f3134,null))[_0x5fa6('0x3d')](handleError(_0x2f3134,null));};exports[_0x5fa6('0x23')]=function(_0x788a3b,_0x489d33){return db[_0x5fa6('0x29')][_0x5fa6('0x43')]({'where':{'id':_0x788a3b[_0x5fa6('0x3f')]['id']}})['then'](handleEntityNotFound(_0x489d33,null))['then'](removeEntity(_0x489d33,null))[_0x5fa6('0x3d')](handleError(_0x489d33,null));};exports[_0x5fa6('0x46')]=function(_0x3454a4,_0x22afda){return db[_0x5fa6('0x29')][_0x5fa6('0x46')]()['then'](respondWithResult(_0x22afda,null))[_0x5fa6('0x3d')](handleError(_0x22afda,null));}; \ No newline at end of file +var _0x702e=['index','rawAttributes','type','key','map','query','intersection','model','fields','attributes','hasOwnProperty','nolimit','sort','where','filters','pick','merge','VIRTUAL','filter','options','OpenchannelTransferReport','includeAll','include','rows','catch','show','params','keys','create','body','find','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','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','end','error','stack','name'];(function(_0x596776,_0x209317){var _0x153c39=function(_0x371fd5){while(--_0x371fd5){_0x596776['push'](_0x596776['shift']());}};_0x153c39(++_0x209317);}(_0x702e,0x6c));var _0xe702=function(_0x2809be,_0x2203d7){_0x2809be=_0x2809be-0x0;var _0x366785=_0x702e[_0x2809be];return _0x366785;};'use strict';var emlformat=require(_0xe702('0x0'));var rimraf=require(_0xe702('0x1'));var zipdir=require(_0xe702('0x2'));var jsonpatch=require(_0xe702('0x3'));var rp=require(_0xe702('0x4'));var moment=require(_0xe702('0x5'));var BPromise=require(_0xe702('0x6'));var Mustache=require(_0xe702('0x7'));var util=require(_0xe702('0x8'));var path=require(_0xe702('0x9'));var sox=require(_0xe702('0xa'));var csv=require(_0xe702('0xb'));var ejs=require(_0xe702('0xc'));var fs=require('fs');var fs_extra=require(_0xe702('0xd'));var _=require(_0xe702('0xe'));var squel=require(_0xe702('0xf'));var crypto=require(_0xe702('0x10'));var jsforce=require(_0xe702('0x11'));var deskjs=require(_0xe702('0x12'));var toCsv=require(_0xe702('0xb'));var querystring=require(_0xe702('0x13'));var Papa=require('papaparse');var Redis=require(_0xe702('0x14'));var authService=require(_0xe702('0x15'));var qs=require(_0xe702('0x16'));var as=require(_0xe702('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xe702('0x18'));var utils=require(_0xe702('0x19'));var config=require(_0xe702('0x1a'));var licenseUtil=require(_0xe702('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1ba9c3,_0x4f1c84){_0x4f1c84=_0x4f1c84||0xcc;return function(_0x239f8c){if(_0x239f8c){return _0x1ba9c3[_0xe702('0x1c')](_0x4f1c84);}return _0x1ba9c3[_0xe702('0x1d')](_0x4f1c84)['end']();};}function respondWithResult(_0x140b86,_0x526a11){_0x526a11=_0x526a11||0xc8;return function(_0x4d877e){if(_0x4d877e){return _0x140b86['status'](_0x526a11)[_0xe702('0x1e')](_0x4d877e);}};}function respondWithFilteredResult(_0xffbce5,_0x708469){return function(_0x1e514c){if(_0x1e514c){var _0x128b7b=typeof _0x708469['offset']==='undefined'&&typeof _0x708469['limit']===_0xe702('0x1f');var _0x3c1f35=_0x1e514c[_0xe702('0x20')];var _0x2f4ffe=_0x128b7b?0x0:_0x708469[_0xe702('0x21')];var _0x3553f8=_0x128b7b?_0x1e514c[_0xe702('0x20')]:_0x708469[_0xe702('0x21')]+_0x708469[_0xe702('0x22')];var _0x3df82f;if(_0x3553f8>=_0x3c1f35){_0x3553f8=_0x3c1f35;_0x3df82f=0xc8;}else{_0x3df82f=0xce;}_0xffbce5[_0xe702('0x1d')](_0x3df82f);return _0xffbce5[_0xe702('0x23')](_0xe702('0x24'),_0x2f4ffe+'-'+_0x3553f8+'/'+_0x3c1f35)['json'](_0x1e514c);}return null;};}function patchUpdates(_0x748a61){return function(_0x317ddc){try{jsonpatch[_0xe702('0x25')](_0x317ddc,_0x748a61,!![]);}catch(_0x53d850){return BPromise[_0xe702('0x26')](_0x53d850);}return _0x317ddc['save']();};}function saveUpdates(_0x5ec413,_0x37bf6f){return function(_0x25f75b){if(_0x25f75b){return _0x25f75b[_0xe702('0x27')](_0x5ec413)[_0xe702('0x28')](function(_0x45c796){return _0x45c796;});}return null;};}function removeEntity(_0x1e1723,_0x42734f){return function(_0x492550){if(_0x492550){return _0x492550[_0xe702('0x29')]()[_0xe702('0x28')](function(){_0x1e1723['status'](0xcc)[_0xe702('0x2a')]();});}};}function handleEntityNotFound(_0x3979ba,_0x101a26){return function(_0x3351cc){if(!_0x3351cc){_0x3979ba['sendStatus'](0x194);}return _0x3351cc;};}function handleError(_0x1b4c06,_0x2cf88d){_0x2cf88d=_0x2cf88d||0x1f4;return function(_0xd35b7b){logger[_0xe702('0x2b')](_0xd35b7b[_0xe702('0x2c')]);if(_0xd35b7b[_0xe702('0x2d')]){delete _0xd35b7b[_0xe702('0x2d')];}_0x1b4c06['status'](_0x2cf88d)['send'](_0xd35b7b);};}exports[_0xe702('0x2e')]=function(_0x35bb9e,_0x2fb024){var _0x463f3e={},_0x253c57={},_0x439987={'count':0x0,'rows':[]};var _0x166699=_['map'](db['OpenchannelTransferReport'][_0xe702('0x2f')],function(_0x43fe0b){return{'name':_0x43fe0b['fieldName'],'type':_0x43fe0b[_0xe702('0x30')][_0xe702('0x31')]};});_0x253c57['model']=_[_0xe702('0x32')](_0x166699,_0xe702('0x2d'));_0x253c57[_0xe702('0x33')]=_['keys'](_0x35bb9e[_0xe702('0x33')]);_0x253c57['filters']=_[_0xe702('0x34')](_0x253c57[_0xe702('0x35')],_0x253c57[_0xe702('0x33')]);_0x463f3e['attributes']=_[_0xe702('0x34')](_0x253c57[_0xe702('0x35')],qs[_0xe702('0x36')](_0x35bb9e[_0xe702('0x33')][_0xe702('0x36')]));_0x463f3e[_0xe702('0x37')]=_0x463f3e['attributes']['length']?_0x463f3e[_0xe702('0x37')]:_0x253c57[_0xe702('0x35')];if(!_0x35bb9e['query'][_0xe702('0x38')](_0xe702('0x39'))){_0x463f3e[_0xe702('0x22')]=qs[_0xe702('0x22')](_0x35bb9e['query'][_0xe702('0x22')]);_0x463f3e[_0xe702('0x21')]=qs[_0xe702('0x21')](_0x35bb9e[_0xe702('0x33')][_0xe702('0x21')]);}_0x463f3e['order']=qs[_0xe702('0x3a')](_0x35bb9e['query'][_0xe702('0x3a')]);_0x463f3e[_0xe702('0x3b')]=qs[_0xe702('0x3c')](_[_0xe702('0x3d')](_0x35bb9e[_0xe702('0x33')],_0x253c57[_0xe702('0x3c')]),_0x166699);if(_0x35bb9e['query']['filter']){_0x463f3e[_0xe702('0x3b')]=_[_0xe702('0x3e')](_0x463f3e[_0xe702('0x3b')],{'$or':_[_0xe702('0x32')](_0x166699,function(_0x538395){if(_0x538395['type']!==_0xe702('0x3f')){var _0x4fa45a={};_0x4fa45a[_0x538395[_0xe702('0x2d')]]={'$like':'%'+_0x35bb9e[_0xe702('0x33')][_0xe702('0x40')]+'%'};return _0x4fa45a;}})});}_0x463f3e=_[_0xe702('0x3e')]({},_0x463f3e,_0x35bb9e[_0xe702('0x41')]);var _0x3f561f={'where':_0x463f3e[_0xe702('0x3b')]};return db[_0xe702('0x42')]['count'](_0x3f561f)[_0xe702('0x28')](function(_0xee4e24){_0x439987['count']=_0xee4e24;if(_0x35bb9e['query'][_0xe702('0x43')]){_0x463f3e[_0xe702('0x44')]=[{'all':!![]}];}return db[_0xe702('0x42')]['findAll'](_0x463f3e);})['then'](function(_0x53d052){_0x439987[_0xe702('0x45')]=_0x53d052;return _0x439987;})['then'](respondWithFilteredResult(_0x2fb024,_0x463f3e))[_0xe702('0x46')](handleError(_0x2fb024,null));};exports[_0xe702('0x47')]=function(_0x571bd5,_0x226eb5){var _0xb2af78={'raw':!![],'where':{'id':_0x571bd5[_0xe702('0x48')]['id']}},_0x38f098={};_0x38f098[_0xe702('0x35')]=_['keys'](db[_0xe702('0x42')][_0xe702('0x2f')]);_0x38f098[_0xe702('0x33')]=_[_0xe702('0x49')](_0x571bd5['query']);_0x38f098['filters']=_['intersection'](_0x38f098['model'],_0x38f098[_0xe702('0x33')]);_0xb2af78[_0xe702('0x37')]=_['intersection'](_0x38f098[_0xe702('0x35')],qs[_0xe702('0x36')](_0x571bd5[_0xe702('0x33')][_0xe702('0x36')]));_0xb2af78['attributes']=_0xb2af78[_0xe702('0x37')]['length']?_0xb2af78[_0xe702('0x37')]:_0x38f098[_0xe702('0x35')];if(_0x571bd5[_0xe702('0x33')][_0xe702('0x43')]){_0xb2af78[_0xe702('0x44')]=[{'all':!![]}];}_0xb2af78=_[_0xe702('0x3e')]({},_0xb2af78,_0x571bd5[_0xe702('0x41')]);return db[_0xe702('0x42')]['find'](_0xb2af78)[_0xe702('0x28')](handleEntityNotFound(_0x226eb5,null))[_0xe702('0x28')](respondWithResult(_0x226eb5,null))[_0xe702('0x46')](handleError(_0x226eb5,null));};exports[_0xe702('0x4a')]=function(_0xe674ca,_0x3f7c6d){return db[_0xe702('0x42')][_0xe702('0x4a')](_0xe674ca[_0xe702('0x4b')],{})['then'](respondWithResult(_0x3f7c6d,0xc9))['catch'](handleError(_0x3f7c6d,null));};exports['update']=function(_0x4d52ae,_0xd9e418){if(_0x4d52ae[_0xe702('0x4b')]['id']){delete _0x4d52ae[_0xe702('0x4b')]['id'];}return db['OpenchannelTransferReport']['find']({'where':{'id':_0x4d52ae['params']['id']}})[_0xe702('0x28')](handleEntityNotFound(_0xd9e418,null))[_0xe702('0x28')](saveUpdates(_0x4d52ae[_0xe702('0x4b')],null))[_0xe702('0x28')](respondWithResult(_0xd9e418,null))[_0xe702('0x46')](handleError(_0xd9e418,null));};exports['destroy']=function(_0x48a996,_0x26e332){return db[_0xe702('0x42')][_0xe702('0x4c')]({'where':{'id':_0x48a996['params']['id']}})[_0xe702('0x28')](handleEntityNotFound(_0x26e332,null))[_0xe702('0x28')](removeEntity(_0x26e332,null))[_0xe702('0x46')](handleError(_0x26e332,null));};exports['describe']=function(_0x194403,_0x4e8f08){return db[_0xe702('0x42')]['describe']()['then'](respondWithResult(_0x4e8f08,null))[_0xe702('0x46')](handleError(_0x4e8f08,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 837b520..171b043 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 _0xc705=['./openchannelTransferReport.attributes','exports','define','uniqueid','lodash','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x4ea972,_0xde1d16){var _0x34db41=function(_0x3487ef){while(--_0x3487ef){_0x4ea972['push'](_0x4ea972['shift']());}};_0x34db41(++_0xde1d16);}(_0xc705,0x7d));var _0x5c70=function(_0x5ac0f0,_0xee4d98){_0x5ac0f0=_0x5ac0f0-0x0;var _0x4aceec=_0xc705[_0x5ac0f0];return _0x4aceec;};'use strict';var _=require(_0x5c70('0x0'));var util=require('util');var logger=require(_0x5c70('0x1'))(_0x5c70('0x2'));var moment=require(_0x5c70('0x3'));var BPromise=require('bluebird');var rp=require(_0x5c70('0x4'));var fs=require('fs');var path=require(_0x5c70('0x5'));var rimraf=require(_0x5c70('0x6'));var config=require('../../config/environment');var attributes=require(_0x5c70('0x7'));module[_0x5c70('0x8')]=function(_0x3cf579,_0x4aa3cf){return _0x3cf579[_0x5c70('0x9')]('OpenchannelTransferReport',attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':_0x5c70('0xa'),'fields':[_0x5c70('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc3af=['OpenchannelTransferReport','report_openchannel_transfer','uniqueid','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./openchannelTransferReport.attributes','exports','define'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xc3af,0x1ed));var _0xfc3a=function(_0xbec8e6,_0x2841b5){_0xbec8e6=_0xbec8e6-0x0;var _0x4aa6f2=_0xc3af[_0xbec8e6];return _0x4aa6f2;};'use strict';var _=require('lodash');var util=require(_0xfc3a('0x0'));var logger=require(_0xfc3a('0x1'))(_0xfc3a('0x2'));var moment=require(_0xfc3a('0x3'));var BPromise=require('bluebird');var rp=require(_0xfc3a('0x4'));var fs=require('fs');var path=require(_0xfc3a('0x5'));var rimraf=require(_0xfc3a('0x6'));var config=require(_0xfc3a('0x7'));var attributes=require(_0xfc3a('0x8'));module[_0xfc3a('0x9')]=function(_0x5b9801,_0x20ad00){return _0x5b9801[_0xfc3a('0xa')](_0xfc3a('0xb'),attributes,{'tableName':_0xfc3a('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xfc3a('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 077979b..3a9f541 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 _0xee14=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','info','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','error','code','OpenchannelTransferReport,\x20%s,\x20%s','message','result','catch','moment'];(function(_0x23e728,_0x1996fd){var _0x49cecc=function(_0x48166d){while(--_0x48166d){_0x23e728['push'](_0x23e728['shift']());}};_0x49cecc(++_0x1996fd);}(_0xee14,0x13a));var _0x4ee1=function(_0x2034f8,_0x45a186){_0x2034f8=_0x2034f8-0x0;var _0x16d783=_0xee14[_0x2034f8];return _0x16d783;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4ee1('0x0'));var BPromise=require(_0x4ee1('0x1'));var rs=require(_0x4ee1('0x2'));var fs=require('fs');var Redis=require(_0x4ee1('0x3'));var db=require(_0x4ee1('0x4'))['db'];var utils=require(_0x4ee1('0x5'));var logger=require(_0x4ee1('0x6'))(_0x4ee1('0x7'));var config=require(_0x4ee1('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x4ee1('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x327c18,_0x3a45a3,_0x187656){return new BPromise(function(_0x293d5f,_0xdfe9c1){return client[_0x4ee1('0xa')](_0x327c18,_0x187656)['then'](function(_0x33dbe6){logger[_0x4ee1('0xb')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x3a45a3,_0x4ee1('0xc'));logger[_0x4ee1('0xd')](_0x4ee1('0xe'),_0x3a45a3,_0x4ee1('0xc'),JSON['stringify'](_0x33dbe6));if(_0x33dbe6[_0x4ee1('0xf')]){if(_0x33dbe6[_0x4ee1('0xf')][_0x4ee1('0x10')]===0x1f4){logger[_0x4ee1('0xf')](_0x4ee1('0x11'),_0x3a45a3,_0x33dbe6[_0x4ee1('0xf')]['message']);return _0xdfe9c1(_0x33dbe6[_0x4ee1('0xf')][_0x4ee1('0x12')]);}logger[_0x4ee1('0xf')](_0x4ee1('0x11'),_0x3a45a3,_0x33dbe6[_0x4ee1('0xf')][_0x4ee1('0x12')]);return _0x293d5f(_0x33dbe6[_0x4ee1('0xf')][_0x4ee1('0x12')]);}else{logger[_0x4ee1('0xb')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x3a45a3,_0x4ee1('0xc'));_0x293d5f(_0x33dbe6[_0x4ee1('0x13')][_0x4ee1('0x12')]);}})[_0x4ee1('0x14')](function(_0x123c5e){logger[_0x4ee1('0xf')](_0x4ee1('0x11'),_0x3a45a3,_0x123c5e);_0xdfe9c1(_0x123c5e);});});} \ No newline at end of file +var _0x02a7=['../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','OpenchannelTransferReport,\x20%s,\x20%s','message','result','util','randomstring','ioredis','../../mysqldb'];(function(_0xc0e74b,_0x4792f5){var _0x141d3c=function(_0x154848){while(--_0x154848){_0xc0e74b['push'](_0xc0e74b['shift']());}};_0x141d3c(++_0x4792f5);}(_0x02a7,0x7a));var _0x702a=function(_0x3b2f79,_0x6a7b4d){_0x3b2f79=_0x3b2f79-0x0;var _0x26e44e=_0x02a7[_0x3b2f79];return _0x26e44e;};'use strict';var _=require('lodash');var util=require(_0x702a('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x702a('0x1'));var fs=require('fs');var Redis=require(_0x702a('0x2'));var db=require(_0x702a('0x3'))['db'];var utils=require(_0x702a('0x4'));var logger=require(_0x702a('0x5'))(_0x702a('0x6'));var config=require(_0x702a('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x702a('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x26b25e,_0x1aa2c2,_0x3f2954){return new BPromise(function(_0x161dee,_0x430cf3){return client[_0x702a('0x9')](_0x26b25e,_0x3f2954)[_0x702a('0xa')](function(_0x48469e){logger[_0x702a('0xb')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x1aa2c2,'request\x20sent');logger[_0x702a('0xc')](_0x702a('0xd'),_0x1aa2c2,_0x702a('0xe'),JSON[_0x702a('0xf')](_0x48469e));if(_0x48469e['error']){if(_0x48469e[_0x702a('0x10')][_0x702a('0x11')]===0x1f4){logger[_0x702a('0x10')](_0x702a('0x12'),_0x1aa2c2,_0x48469e[_0x702a('0x10')][_0x702a('0x13')]);return _0x430cf3(_0x48469e[_0x702a('0x10')]['message']);}logger['error'](_0x702a('0x12'),_0x1aa2c2,_0x48469e['error']['message']);return _0x161dee(_0x48469e['error']['message']);}else{logger['info'](_0x702a('0x12'),_0x1aa2c2,_0x702a('0xe'));_0x161dee(_0x48469e[_0x702a('0x14')]['message']);}})['catch'](function(_0x506772){logger[_0x702a('0x10')](_0x702a('0x12'),_0x1aa2c2,_0x506772);_0x430cf3(_0x506772);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index bb29cf4..840572a 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 _0x6bd3=['index','/:id','show','create','put','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','isAuthenticated'];(function(_0x5abf7f,_0x2202b9){var _0x3b4a5b=function(_0x13cee9){while(--_0x13cee9){_0x5abf7f['push'](_0x5abf7f['shift']());}};_0x3b4a5b(++_0x2202b9);}(_0x6bd3,0x8d));var _0x36bd=function(_0x525209,_0x4293b7){_0x525209=_0x525209-0x0;var _0x5241b3=_0x6bd3[_0x525209];return _0x5241b3;};'use strict';var multer=require(_0x36bd('0x0'));var util=require(_0x36bd('0x1'));var path=require('path');var timeout=require(_0x36bd('0x2'));var express=require(_0x36bd('0x3'));var router=express[_0x36bd('0x4')]();var fs_extra=require(_0x36bd('0x5'));var auth=require(_0x36bd('0x6'));var interaction=require(_0x36bd('0x7'));var config=require(_0x36bd('0x8'));var controller=require(_0x36bd('0x9'));router['get']('/',auth[_0x36bd('0xa')](),controller[_0x36bd('0xb')]);router['get'](_0x36bd('0xc'),auth['isAuthenticated'](),controller[_0x36bd('0xd')]);router['post']('/',auth[_0x36bd('0xa')](),controller[_0x36bd('0xe')]);router[_0x36bd('0xf')]('/:id',auth[_0x36bd('0xa')](),controller['update']);router[_0x36bd('0x10')](_0x36bd('0xc'),auth['isAuthenticated'](),controller[_0x36bd('0x11')]);module[_0x36bd('0x12')]=router; \ No newline at end of file +var _0xc922=['isAuthenticated','show','post','put','update','delete','exports','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/:id'];(function(_0x39e71b,_0x1514e6){var _0x10e46f=function(_0x4548a4){while(--_0x4548a4){_0x39e71b['push'](_0x39e71b['shift']());}};_0x10e46f(++_0x1514e6);}(_0xc922,0x1b0));var _0x2c92=function(_0x3c5e09,_0x351c27){_0x3c5e09=_0x3c5e09-0x0;var _0x278b2a=_0xc922[_0x3c5e09];return _0x278b2a;};'use strict';var multer=require('multer');var util=require(_0x2c92('0x0'));var path=require('path');var timeout=require(_0x2c92('0x1'));var express=require(_0x2c92('0x2'));var router=express['Router']();var fs_extra=require(_0x2c92('0x3'));var auth=require(_0x2c92('0x4'));var interaction=require(_0x2c92('0x5'));var config=require(_0x2c92('0x6'));var controller=require('./pause.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x2c92('0x7')]);router[_0x2c92('0x8')](_0x2c92('0x9'),auth[_0x2c92('0xa')](),controller[_0x2c92('0xb')]);router[_0x2c92('0xc')]('/',auth[_0x2c92('0xa')](),controller['create']);router[_0x2c92('0xd')]('/:id',auth[_0x2c92('0xa')](),controller[_0x2c92('0xe')]);router[_0x2c92('0xf')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x2c92('0x10')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 8293100..e97ff32 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 _0xb854=['STRING','name','exports'];(function(_0x5f0c5c,_0x3f3c28){var _0x488df7=function(_0xb0e3f){while(--_0xb0e3f){_0x5f0c5c['push'](_0x5f0c5c['shift']());}};_0x488df7(++_0x3f3c28);}(_0xb854,0xe0));var _0x4b85=function(_0x3c7810,_0x274437){_0x3c7810=_0x3c7810-0x0;var _0x2645bc=_0xb854[_0x3c7810];return _0x2645bc;};'use strict';var Sequelize=require('sequelize');module[_0x4b85('0x0')]={'name':{'type':Sequelize[_0x4b85('0x1')],'unique':_0x4b85('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x4b85('0x1')]}}; \ No newline at end of file +var _0xfba9=['name','sequelize','STRING'];(function(_0x4d1dfc,_0x253877){var _0x5d611a=function(_0x400dbf){while(--_0x400dbf){_0x4d1dfc['push'](_0x4d1dfc['shift']());}};_0x5d611a(++_0x253877);}(_0xfba9,0x160));var _0x9fba=function(_0x4d7988,_0x4c62e3){_0x4d7988=_0x4d7988-0x0;var _0x97e287=_0xfba9[_0x4d7988];return _0x97e287;};'use strict';var Sequelize=require(_0x9fba('0x0'));module['exports']={'name':{'type':Sequelize[_0x9fba('0x1')],'unique':_0x9fba('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x9fba('0x1')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index e357441..a2dd468 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 _0xa98c=['filter','merge','includeAll','include','findAll','rows','show','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','body','params','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','destroy','then','get','Pauses','UserProfileResource','stack','name','send','index','Pause','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x2ca90c,_0x3ae6ff){var _0x59fda3=function(_0x2c634d){while(--_0x2c634d){_0x2ca90c['push'](_0x2ca90c['shift']());}};_0x59fda3(++_0x3ae6ff);}(_0xa98c,0xb7));var _0xca98=function(_0xe1a3a5,_0xd3e341){_0xe1a3a5=_0xe1a3a5-0x0;var _0x362646=_0xa98c[_0xe1a3a5];return _0x362646;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xca98('0x0'));var jsonpatch=require(_0xca98('0x1'));var rp=require(_0xca98('0x2'));var moment=require('moment');var BPromise=require(_0xca98('0x3'));var Mustache=require(_0xca98('0x4'));var util=require(_0xca98('0x5'));var path=require('path');var sox=require(_0xca98('0x6'));var csv=require(_0xca98('0x7'));var ejs=require(_0xca98('0x8'));var fs=require('fs');var fs_extra=require(_0xca98('0x9'));var _=require('lodash');var squel=require(_0xca98('0xa'));var crypto=require('crypto');var jsforce=require(_0xca98('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xca98('0x7'));var querystring=require(_0xca98('0xc'));var Papa=require(_0xca98('0xd'));var Redis=require(_0xca98('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xca98('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xca98('0x10'))(_0xca98('0x11'));var utils=require(_0xca98('0x12'));var config=require(_0xca98('0x13'));var licenseUtil=require(_0xca98('0x14'));var db=require(_0xca98('0x15'))['db'];function respondWithStatusCode(_0x329aa7,_0x5775f1){_0x5775f1=_0x5775f1||0xcc;return function(_0x183b4f){if(_0x183b4f){return _0x329aa7[_0xca98('0x16')](_0x5775f1);}return _0x329aa7[_0xca98('0x17')](_0x5775f1)[_0xca98('0x18')]();};}function respondWithResult(_0x56b749,_0x54c77d){_0x54c77d=_0x54c77d||0xc8;return function(_0x287d68){if(_0x287d68){return _0x56b749['status'](_0x54c77d)[_0xca98('0x19')](_0x287d68);}};}function respondWithFilteredResult(_0x4f5901,_0x5e6b0a){return function(_0x14aa97){if(_0x14aa97){var _0x5c15ed=typeof _0x5e6b0a['offset']===_0xca98('0x1a')&&typeof _0x5e6b0a[_0xca98('0x1b')]===_0xca98('0x1a');var _0x3a7704=_0x14aa97[_0xca98('0x1c')];var _0x4ff609=_0x5c15ed?0x0:_0x5e6b0a[_0xca98('0x1d')];var _0x4a0b65=_0x5c15ed?_0x14aa97[_0xca98('0x1c')]:_0x5e6b0a[_0xca98('0x1d')]+_0x5e6b0a['limit'];var _0x51f94e;if(_0x4a0b65>=_0x3a7704){_0x4a0b65=_0x3a7704;_0x51f94e=0xc8;}else{_0x51f94e=0xce;}_0x4f5901[_0xca98('0x17')](_0x51f94e);return _0x4f5901['set'](_0xca98('0x1e'),_0x4ff609+'-'+_0x4a0b65+'/'+_0x3a7704)[_0xca98('0x19')](_0x14aa97);}return null;};}function patchUpdates(_0x1ab8cc){return function(_0x4ca9f9){try{jsonpatch[_0xca98('0x1f')](_0x4ca9f9,_0x1ab8cc,!![]);}catch(_0x5876c5){return BPromise[_0xca98('0x20')](_0x5876c5);}return _0x4ca9f9[_0xca98('0x21')]();};}function saveUpdates(_0x141bbb,_0x2cc65a){return function(_0x5c4879){if(_0x5c4879){return _0x5c4879[_0xca98('0x22')](_0x141bbb)['then'](function(_0xe8032b){return _0xe8032b;});}return null;};}function removeEntity(_0x55b91f,_0x143213){return function(_0x5eb3e2){if(_0x5eb3e2){return _0x5eb3e2[_0xca98('0x23')]()[_0xca98('0x24')](function(){var _0x19ba53=_0x5eb3e2[_0xca98('0x25')]({'plain':!![]});var _0x9a5cca=_0xca98('0x26');return db[_0xca98('0x27')][_0xca98('0x23')]({'where':{'type':_0x9a5cca,'resourceId':_0x19ba53['id']}})[_0xca98('0x24')](function(){return _0x5eb3e2;});})['then'](function(){_0x55b91f[_0xca98('0x17')](0xcc)[_0xca98('0x18')]();});}};}function handleEntityNotFound(_0x1e5468,_0x35f7c6){return function(_0x27a442){if(!_0x27a442){_0x1e5468['sendStatus'](0x194);}return _0x27a442;};}function handleError(_0x18066b,_0x2a5dcb){_0x2a5dcb=_0x2a5dcb||0x1f4;return function(_0x43ae38){logger['error'](_0x43ae38[_0xca98('0x28')]);if(_0x43ae38[_0xca98('0x29')]){delete _0x43ae38[_0xca98('0x29')];}_0x18066b[_0xca98('0x17')](_0x2a5dcb)[_0xca98('0x2a')](_0x43ae38);};}exports[_0xca98('0x2b')]=function(_0x23a1a0,_0x44eea1){var _0x5643c3={},_0xb010c6={},_0x17039a={'count':0x0,'rows':[]};var _0x575817=_['map'](db[_0xca98('0x2c')][_0xca98('0x2d')],function(_0x40e15e){return{'name':_0x40e15e[_0xca98('0x2e')],'type':_0x40e15e[_0xca98('0x2f')][_0xca98('0x30')]};});_0xb010c6[_0xca98('0x31')]=_[_0xca98('0x32')](_0x575817,_0xca98('0x29'));_0xb010c6['query']=_[_0xca98('0x33')](_0x23a1a0[_0xca98('0x34')]);_0xb010c6[_0xca98('0x35')]=_[_0xca98('0x36')](_0xb010c6[_0xca98('0x31')],_0xb010c6['query']);_0x5643c3[_0xca98('0x37')]=_[_0xca98('0x36')](_0xb010c6[_0xca98('0x31')],qs[_0xca98('0x38')](_0x23a1a0[_0xca98('0x34')][_0xca98('0x38')]));_0x5643c3[_0xca98('0x37')]=_0x5643c3[_0xca98('0x37')][_0xca98('0x39')]?_0x5643c3[_0xca98('0x37')]:_0xb010c6[_0xca98('0x31')];if(!_0x23a1a0['query'][_0xca98('0x3a')](_0xca98('0x3b'))){_0x5643c3[_0xca98('0x1b')]=qs['limit'](_0x23a1a0['query']['limit']);_0x5643c3[_0xca98('0x1d')]=qs[_0xca98('0x1d')](_0x23a1a0[_0xca98('0x34')][_0xca98('0x1d')]);}_0x5643c3[_0xca98('0x3c')]=qs[_0xca98('0x3d')](_0x23a1a0[_0xca98('0x34')]['sort']);_0x5643c3[_0xca98('0x3e')]=qs[_0xca98('0x35')](_['pick'](_0x23a1a0[_0xca98('0x34')],_0xb010c6['filters']),_0x575817);if(_0x23a1a0[_0xca98('0x34')][_0xca98('0x3f')]){_0x5643c3[_0xca98('0x3e')]=_[_0xca98('0x40')](_0x5643c3['where'],{'$or':_[_0xca98('0x32')](_0x575817,function(_0x14d0b9){if(_0x14d0b9[_0xca98('0x2f')]!=='VIRTUAL'){var _0x4f3f53={};_0x4f3f53[_0x14d0b9['name']]={'$like':'%'+_0x23a1a0[_0xca98('0x34')]['filter']+'%'};return _0x4f3f53;}})});}_0x5643c3=_['merge']({},_0x5643c3,_0x23a1a0['options']);var _0x14700d={'where':_0x5643c3[_0xca98('0x3e')]};return db[_0xca98('0x2c')][_0xca98('0x1c')](_0x14700d)[_0xca98('0x24')](function(_0x1f0473){_0x17039a[_0xca98('0x1c')]=_0x1f0473;if(_0x23a1a0['query'][_0xca98('0x41')]){_0x5643c3[_0xca98('0x42')]=[{'all':!![]}];}return db['Pause'][_0xca98('0x43')](_0x5643c3);})[_0xca98('0x24')](function(_0x540197){_0x17039a[_0xca98('0x44')]=_0x540197;return _0x17039a;})[_0xca98('0x24')](respondWithFilteredResult(_0x44eea1,_0x5643c3))['catch'](handleError(_0x44eea1,null));};exports[_0xca98('0x45')]=function(_0x5c79bd,_0x1c371f){var _0x2da7e7={'raw':!![],'where':{'id':_0x5c79bd['params']['id']}},_0x137bdd={};_0x137bdd[_0xca98('0x31')]=_[_0xca98('0x33')](db['Pause'][_0xca98('0x2d')]);_0x137bdd[_0xca98('0x34')]=_['keys'](_0x5c79bd[_0xca98('0x34')]);_0x137bdd[_0xca98('0x35')]=_['intersection'](_0x137bdd['model'],_0x137bdd['query']);_0x2da7e7['attributes']=_['intersection'](_0x137bdd[_0xca98('0x31')],qs['fields'](_0x5c79bd[_0xca98('0x34')]['fields']));_0x2da7e7['attributes']=_0x2da7e7[_0xca98('0x37')][_0xca98('0x39')]?_0x2da7e7[_0xca98('0x37')]:_0x137bdd[_0xca98('0x31')];if(_0x5c79bd[_0xca98('0x34')]['includeAll']){_0x2da7e7['include']=[{'all':!![]}];}_0x2da7e7=_[_0xca98('0x40')]({},_0x2da7e7,_0x5c79bd['options']);return db[_0xca98('0x2c')][_0xca98('0x46')](_0x2da7e7)[_0xca98('0x24')](handleEntityNotFound(_0x1c371f,null))[_0xca98('0x24')](respondWithResult(_0x1c371f,null))[_0xca98('0x47')](handleError(_0x1c371f,null));};exports[_0xca98('0x48')]=function(_0x35c3d6,_0x4c9f43){return db['Pause'][_0xca98('0x48')](_0x35c3d6['body'],{})[_0xca98('0x24')](function(_0x16f230){var _0x84e1d8=_0x35c3d6[_0xca98('0x49')][_0xca98('0x25')]({'plain':!![]});if(!_0x84e1d8)throw new Error(_0xca98('0x4a'));if(_0x84e1d8[_0xca98('0x4b')]===_0xca98('0x49')){var _0x149dc7=_0x16f230[_0xca98('0x25')]({'plain':!![]});var _0x24ccba='Pauses';return db[_0xca98('0x4c')][_0xca98('0x46')]({'where':{'name':_0x24ccba,'userProfileId':_0x84e1d8[_0xca98('0x4d')]},'raw':!![]})[_0xca98('0x24')](function(_0x422c9d){if(_0x422c9d&&_0x422c9d[_0xca98('0x4e')]===0x0){return db[_0xca98('0x27')]['create']({'name':_0x149dc7[_0xca98('0x29')],'resourceId':_0x149dc7['id'],'type':_0x422c9d[_0xca98('0x29')],'sectionId':_0x422c9d['id']},{})[_0xca98('0x24')](function(){return _0x16f230;});}else{return _0x16f230;}})[_0xca98('0x47')](function(_0x1d0b8c){logger[_0xca98('0x4f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1d0b8c);throw _0x1d0b8c;});}return _0x16f230;})[_0xca98('0x24')](respondWithResult(_0x4c9f43,0xc9))[_0xca98('0x47')](handleError(_0x4c9f43,null));};exports[_0xca98('0x22')]=function(_0x3592dc,_0x17abbd){if(_0x3592dc['body']['id']){delete _0x3592dc[_0xca98('0x50')]['id'];}return db[_0xca98('0x2c')][_0xca98('0x46')]({'where':{'id':_0x3592dc[_0xca98('0x51')]['id']}})[_0xca98('0x24')](handleEntityNotFound(_0x17abbd,null))[_0xca98('0x24')](saveUpdates(_0x3592dc['body'],null))[_0xca98('0x24')](respondWithResult(_0x17abbd,null))[_0xca98('0x47')](handleError(_0x17abbd,null));};exports['destroy']=function(_0x58161a,_0x13481b){return db[_0xca98('0x2c')]['find']({'where':{'id':_0x58161a[_0xca98('0x51')]['id']}})[_0xca98('0x24')](handleEntityNotFound(_0x13481b,null))[_0xca98('0x24')](removeEntity(_0x13481b,null))[_0xca98('0x47')](handleError(_0x13481b,null));}; \ No newline at end of file +var _0x1a3d=['destroy','get','Pauses','UserProfileResource','end','error','stack','name','send','index','map','Pause','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','keys','length','find','catch','create','role','UserProfileSection','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x1a3d,0x129));var _0xd1a3=function(_0x17b4a7,_0x5816fb){_0x17b4a7=_0x17b4a7-0x0;var _0x5d8597=_0x1a3d[_0x17b4a7];return _0x5d8597;};'use strict';var emlformat=require(_0xd1a3('0x0'));var rimraf=require(_0xd1a3('0x1'));var zipdir=require(_0xd1a3('0x2'));var jsonpatch=require(_0xd1a3('0x3'));var rp=require(_0xd1a3('0x4'));var moment=require(_0xd1a3('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xd1a3('0x6'));var util=require(_0xd1a3('0x7'));var path=require(_0xd1a3('0x8'));var sox=require(_0xd1a3('0x9'));var csv=require('to-csv');var ejs=require(_0xd1a3('0xa'));var fs=require('fs');var fs_extra=require(_0xd1a3('0xb'));var _=require(_0xd1a3('0xc'));var squel=require(_0xd1a3('0xd'));var crypto=require(_0xd1a3('0xe'));var jsforce=require(_0xd1a3('0xf'));var deskjs=require(_0xd1a3('0x10'));var toCsv=require(_0xd1a3('0x11'));var querystring=require(_0xd1a3('0x12'));var Papa=require('papaparse');var Redis=require(_0xd1a3('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd1a3('0x14'));var logger=require(_0xd1a3('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xd1a3('0x16'));var licenseUtil=require(_0xd1a3('0x17'));var db=require(_0xd1a3('0x18'))['db'];function respondWithStatusCode(_0x31916d,_0x12239c){_0x12239c=_0x12239c||0xcc;return function(_0x4f6c27){if(_0x4f6c27){return _0x31916d[_0xd1a3('0x19')](_0x12239c);}return _0x31916d[_0xd1a3('0x1a')](_0x12239c)['end']();};}function respondWithResult(_0x37dfc0,_0x32407a){_0x32407a=_0x32407a||0xc8;return function(_0x36dd05){if(_0x36dd05){return _0x37dfc0[_0xd1a3('0x1a')](_0x32407a)[_0xd1a3('0x1b')](_0x36dd05);}};}function respondWithFilteredResult(_0x53df78,_0x52a8df){return function(_0x5b8689){if(_0x5b8689){var _0x9e298e=typeof _0x52a8df[_0xd1a3('0x1c')]===_0xd1a3('0x1d')&&typeof _0x52a8df[_0xd1a3('0x1e')]===_0xd1a3('0x1d');var _0x500766=_0x5b8689[_0xd1a3('0x1f')];var _0x38f4fc=_0x9e298e?0x0:_0x52a8df[_0xd1a3('0x1c')];var _0x442f36=_0x9e298e?_0x5b8689[_0xd1a3('0x1f')]:_0x52a8df['offset']+_0x52a8df[_0xd1a3('0x1e')];var _0x2dff2a;if(_0x442f36>=_0x500766){_0x442f36=_0x500766;_0x2dff2a=0xc8;}else{_0x2dff2a=0xce;}_0x53df78['status'](_0x2dff2a);return _0x53df78[_0xd1a3('0x20')](_0xd1a3('0x21'),_0x38f4fc+'-'+_0x442f36+'/'+_0x500766)['json'](_0x5b8689);}return null;};}function patchUpdates(_0x177514){return function(_0x453331){try{jsonpatch[_0xd1a3('0x22')](_0x453331,_0x177514,!![]);}catch(_0x4f1d0b){return BPromise[_0xd1a3('0x23')](_0x4f1d0b);}return _0x453331[_0xd1a3('0x24')]();};}function saveUpdates(_0x4577c0,_0x10bfc6){return function(_0x26e691){if(_0x26e691){return _0x26e691[_0xd1a3('0x25')](_0x4577c0)[_0xd1a3('0x26')](function(_0x28e600){return _0x28e600;});}return null;};}function removeEntity(_0x3467d0,_0x57c26e){return function(_0x381221){if(_0x381221){return _0x381221[_0xd1a3('0x27')]()['then'](function(){var _0x18a5ef=_0x381221[_0xd1a3('0x28')]({'plain':!![]});var _0xf03b6a=_0xd1a3('0x29');return db[_0xd1a3('0x2a')][_0xd1a3('0x27')]({'where':{'type':_0xf03b6a,'resourceId':_0x18a5ef['id']}})[_0xd1a3('0x26')](function(){return _0x381221;});})[_0xd1a3('0x26')](function(){_0x3467d0[_0xd1a3('0x1a')](0xcc)[_0xd1a3('0x2b')]();});}};}function handleEntityNotFound(_0x4202ed,_0x1c9ad0){return function(_0x464b37){if(!_0x464b37){_0x4202ed[_0xd1a3('0x19')](0x194);}return _0x464b37;};}function handleError(_0x64aa46,_0x517f8d){_0x517f8d=_0x517f8d||0x1f4;return function(_0x53d6cc){logger[_0xd1a3('0x2c')](_0x53d6cc[_0xd1a3('0x2d')]);if(_0x53d6cc['name']){delete _0x53d6cc[_0xd1a3('0x2e')];}_0x64aa46[_0xd1a3('0x1a')](_0x517f8d)[_0xd1a3('0x2f')](_0x53d6cc);};}exports[_0xd1a3('0x30')]=function(_0x772b5c,_0x3c720d){var _0x51da64={},_0x4f461d={},_0x11ab91={'count':0x0,'rows':[]};var _0x10caa8=_[_0xd1a3('0x31')](db[_0xd1a3('0x32')][_0xd1a3('0x33')],function(_0x4db474){return{'name':_0x4db474[_0xd1a3('0x34')],'type':_0x4db474[_0xd1a3('0x35')][_0xd1a3('0x36')]};});_0x4f461d[_0xd1a3('0x37')]=_['map'](_0x10caa8,_0xd1a3('0x2e'));_0x4f461d['query']=_['keys'](_0x772b5c[_0xd1a3('0x38')]);_0x4f461d['filters']=_[_0xd1a3('0x39')](_0x4f461d[_0xd1a3('0x37')],_0x4f461d[_0xd1a3('0x38')]);_0x51da64['attributes']=_['intersection'](_0x4f461d[_0xd1a3('0x37')],qs[_0xd1a3('0x3a')](_0x772b5c['query']['fields']));_0x51da64[_0xd1a3('0x3b')]=_0x51da64['attributes']['length']?_0x51da64[_0xd1a3('0x3b')]:_0x4f461d[_0xd1a3('0x37')];if(!_0x772b5c['query']['hasOwnProperty'](_0xd1a3('0x3c'))){_0x51da64[_0xd1a3('0x1e')]=qs['limit'](_0x772b5c['query']['limit']);_0x51da64['offset']=qs[_0xd1a3('0x1c')](_0x772b5c[_0xd1a3('0x38')][_0xd1a3('0x1c')]);}_0x51da64[_0xd1a3('0x3d')]=qs[_0xd1a3('0x3e')](_0x772b5c[_0xd1a3('0x38')][_0xd1a3('0x3e')]);_0x51da64[_0xd1a3('0x3f')]=qs[_0xd1a3('0x40')](_[_0xd1a3('0x41')](_0x772b5c[_0xd1a3('0x38')],_0x4f461d[_0xd1a3('0x40')]),_0x10caa8);if(_0x772b5c[_0xd1a3('0x38')]['filter']){_0x51da64[_0xd1a3('0x3f')]=_[_0xd1a3('0x42')](_0x51da64[_0xd1a3('0x3f')],{'$or':_[_0xd1a3('0x31')](_0x10caa8,function(_0x537a1e){if(_0x537a1e[_0xd1a3('0x35')]!==_0xd1a3('0x43')){var _0x3dc69b={};_0x3dc69b[_0x537a1e[_0xd1a3('0x2e')]]={'$like':'%'+_0x772b5c['query'][_0xd1a3('0x44')]+'%'};return _0x3dc69b;}})});}_0x51da64=_[_0xd1a3('0x42')]({},_0x51da64,_0x772b5c[_0xd1a3('0x45')]);var _0x4583bb={'where':_0x51da64[_0xd1a3('0x3f')]};return db[_0xd1a3('0x32')][_0xd1a3('0x1f')](_0x4583bb)[_0xd1a3('0x26')](function(_0x21e035){_0x11ab91[_0xd1a3('0x1f')]=_0x21e035;if(_0x772b5c[_0xd1a3('0x38')][_0xd1a3('0x46')]){_0x51da64[_0xd1a3('0x47')]=[{'all':!![]}];}return db['Pause'][_0xd1a3('0x48')](_0x51da64);})[_0xd1a3('0x26')](function(_0x3b62dd){_0x11ab91[_0xd1a3('0x49')]=_0x3b62dd;return _0x11ab91;})[_0xd1a3('0x26')](respondWithFilteredResult(_0x3c720d,_0x51da64))['catch'](handleError(_0x3c720d,null));};exports[_0xd1a3('0x4a')]=function(_0x10ecdd,_0xdafe58){var _0x1162f1={'raw':!![],'where':{'id':_0x10ecdd[_0xd1a3('0x4b')]['id']}},_0x1b3f8e={};_0x1b3f8e[_0xd1a3('0x37')]=_[_0xd1a3('0x4c')](db['Pause']['rawAttributes']);_0x1b3f8e[_0xd1a3('0x38')]=_[_0xd1a3('0x4c')](_0x10ecdd[_0xd1a3('0x38')]);_0x1b3f8e[_0xd1a3('0x40')]=_[_0xd1a3('0x39')](_0x1b3f8e[_0xd1a3('0x37')],_0x1b3f8e[_0xd1a3('0x38')]);_0x1162f1[_0xd1a3('0x3b')]=_['intersection'](_0x1b3f8e[_0xd1a3('0x37')],qs['fields'](_0x10ecdd[_0xd1a3('0x38')]['fields']));_0x1162f1[_0xd1a3('0x3b')]=_0x1162f1[_0xd1a3('0x3b')][_0xd1a3('0x4d')]?_0x1162f1[_0xd1a3('0x3b')]:_0x1b3f8e[_0xd1a3('0x37')];if(_0x10ecdd[_0xd1a3('0x38')][_0xd1a3('0x46')]){_0x1162f1['include']=[{'all':!![]}];}_0x1162f1=_[_0xd1a3('0x42')]({},_0x1162f1,_0x10ecdd['options']);return db[_0xd1a3('0x32')][_0xd1a3('0x4e')](_0x1162f1)[_0xd1a3('0x26')](handleEntityNotFound(_0xdafe58,null))[_0xd1a3('0x26')](respondWithResult(_0xdafe58,null))[_0xd1a3('0x4f')](handleError(_0xdafe58,null));};exports[_0xd1a3('0x50')]=function(_0x52225b,_0x2c62a8){return db[_0xd1a3('0x32')][_0xd1a3('0x50')](_0x52225b['body'],{})[_0xd1a3('0x26')](function(_0x2edf74){var _0x120c22=_0x52225b['user'][_0xd1a3('0x28')]({'plain':!![]});if(!_0x120c22)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x120c22[_0xd1a3('0x51')]==='user'){var _0x5dbbe6=_0x2edf74[_0xd1a3('0x28')]({'plain':!![]});var _0x35bd16=_0xd1a3('0x29');return db[_0xd1a3('0x52')][_0xd1a3('0x4e')]({'where':{'name':_0x35bd16,'userProfileId':_0x120c22['userProfileId']},'raw':!![]})[_0xd1a3('0x26')](function(_0x2e86d7){if(_0x2e86d7&&_0x2e86d7['autoAssociation']===0x0){return db[_0xd1a3('0x2a')][_0xd1a3('0x50')]({'name':_0x5dbbe6['name'],'resourceId':_0x5dbbe6['id'],'type':_0x2e86d7[_0xd1a3('0x2e')],'sectionId':_0x2e86d7['id']},{})[_0xd1a3('0x26')](function(){return _0x2edf74;});}else{return _0x2edf74;}})[_0xd1a3('0x4f')](function(_0x2dfe42){logger[_0xd1a3('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2dfe42);throw _0x2dfe42;});}return _0x2edf74;})[_0xd1a3('0x26')](respondWithResult(_0x2c62a8,0xc9))[_0xd1a3('0x4f')](handleError(_0x2c62a8,null));};exports[_0xd1a3('0x25')]=function(_0x5cea79,_0x47dcb6){if(_0x5cea79['body']['id']){delete _0x5cea79[_0xd1a3('0x53')]['id'];}return db[_0xd1a3('0x32')][_0xd1a3('0x4e')]({'where':{'id':_0x5cea79[_0xd1a3('0x4b')]['id']}})[_0xd1a3('0x26')](handleEntityNotFound(_0x47dcb6,null))[_0xd1a3('0x26')](saveUpdates(_0x5cea79[_0xd1a3('0x53')],null))[_0xd1a3('0x26')](respondWithResult(_0x47dcb6,null))[_0xd1a3('0x4f')](handleError(_0x47dcb6,null));};exports[_0xd1a3('0x27')]=function(_0x58e0b6,_0x1f3da2){return db[_0xd1a3('0x32')][_0xd1a3('0x4e')]({'where':{'id':_0x58e0b6[_0xd1a3('0x4b')]['id']}})[_0xd1a3('0x26')](handleEntityNotFound(_0x1f3da2,null))[_0xd1a3('0x26')](removeEntity(_0x1f3da2,null))[_0xd1a3('0x4f')](handleError(_0x1f3da2,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 3730dc3..65ac498 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 _0x326f=['tools_pauses','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./pause.attributes','exports','define','Pause'];(function(_0x5e91be,_0x24e723){var _0x2a357d=function(_0x4c695e){while(--_0x4c695e){_0x5e91be['push'](_0x5e91be['shift']());}};_0x2a357d(++_0x24e723);}(_0x326f,0xd1));var _0xf326=function(_0x41fcb6,_0x3aa5ae){_0x41fcb6=_0x41fcb6-0x0;var _0x186956=_0x326f[_0x41fcb6];return _0x186956;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf326('0x1'));var moment=require(_0xf326('0x2'));var BPromise=require(_0xf326('0x3'));var rp=require(_0xf326('0x4'));var fs=require('fs');var path=require(_0xf326('0x5'));var rimraf=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var attributes=require(_0xf326('0x8'));module[_0xf326('0x9')]=function(_0x3ace29,_0x4c2249){return _0x3ace29[_0xf326('0xa')](_0xf326('0xb'),attributes,{'tableName':_0xf326('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xabce=['util','../../config/logger','api','moment','path','rimraf','../../config/environment','define','tools_pauses','lodash'];(function(_0x2e89ae,_0x184867){var _0x3e65cb=function(_0x1b0d79){while(--_0x1b0d79){_0x2e89ae['push'](_0x2e89ae['shift']());}};_0x3e65cb(++_0x184867);}(_0xabce,0x103));var _0xeabc=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xabce[_0x92c450];return _0x2a9599;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var logger=require(_0xeabc('0x2'))(_0xeabc('0x3'));var moment=require(_0xeabc('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xeabc('0x5'));var rimraf=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var attributes=require('./pause.attributes');module['exports']=function(_0x1b07a8,_0x52a4d7){return _0x1b07a8[_0xeabc('0x8')]('Pause',attributes,{'tableName':_0xeabc('0x9'),'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 de1a5a8..18a5213 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(_0x4ddfbd,_0x37fdcf){var _0x3db951=function(_0x462781){while(--_0x462781){_0x4ddfbd['push'](_0x4ddfbd['shift']());}};_0x3db951(++_0x37fdcf);}(_0xb10b,0x12a));var _0xbb10=function(_0xd050c6,_0x58ffb4){_0xd050c6=_0xd050c6-0x0;var _0x7278a=_0xb10b[_0xd050c6];return _0x7278a;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['include']?_[_0xbb10('0x1c')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1d')],function(_0x317da4){return{'model':db[_0x317da4[_0xbb10('0x1e')]],'as':_0x317da4['as'],'attributes':_0x317da4[_0xbb10('0x1b')],'include':_0x317da4[_0xbb10('0x1d')]?_[_0xbb10('0x1c')](_0x317da4[_0xbb10('0x1d')],function(_0x395404){return{'model':db[_0x395404[_0xbb10('0x1e')]],'as':_0x395404['as'],'attributes':_0x395404[_0xbb10('0x1b')],'include':_0x395404['include']?_['map'](_0x395404['include'],function(_0xc93a04){return{'model':db[_0xc93a04[_0xbb10('0x1e')]],'as':_0xc93a04['as'],'attributes':_0xc93a04[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdde9){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2fdde9));_0x575cca(_0x2fdde9);})[_0xbb10('0x20')](function(_0x4aabb9){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x4aabb9[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x4aabb9[_0xbb10('0x13')]));});});}; \ No newline at end of file +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(_0x340209,_0x3f3fda){var _0x1dcef=function(_0x350558){while(--_0x350558){_0x340209['push'](_0x340209['shift']());}};_0x1dcef(++_0x3f3fda);}(_0xb10b,0x12a));var _0xbb10=function(_0xa6180a,_0x508ff9){_0xa6180a=_0xa6180a-0x0;var _0x10f626=_0xb10b[_0xa6180a];return _0x10f626;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['include']?_[_0xbb10('0x1c')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1d')],function(_0x317da4){return{'model':db[_0x317da4[_0xbb10('0x1e')]],'as':_0x317da4['as'],'attributes':_0x317da4[_0xbb10('0x1b')],'include':_0x317da4[_0xbb10('0x1d')]?_[_0xbb10('0x1c')](_0x317da4[_0xbb10('0x1d')],function(_0x395404){return{'model':db[_0x395404[_0xbb10('0x1e')]],'as':_0x395404['as'],'attributes':_0x395404[_0xbb10('0x1b')],'include':_0x395404['include']?_['map'](_0x395404['include'],function(_0xc93a04){return{'model':db[_0xc93a04[_0xbb10('0x1e')]],'as':_0xc93a04['as'],'attributes':_0xc93a04[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdde9){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2fdde9));_0x575cca(_0x2fdde9);})[_0xbb10('0x20')](function(_0x4aabb9){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x4aabb9[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x4aabb9[_0xbb10('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index 3dd9595..bf6dc72 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 _0x68fc=['webhookPost','put','update','delete','exports','multer','util','path','Router','../../components/auth/service','./plugin.controller','get','isAuthenticated','index','webhookGet','/:id','show','/:id/download','download','diskStorage','join','root','server/files/plugins','originalname','replace','%s-%s%s','basename','extname','now','post','upload','/webhook'];(function(_0x373f38,_0x5b41bb){var _0x19eb4f=function(_0x2f7f2e){while(--_0x2f7f2e){_0x373f38['push'](_0x373f38['shift']());}};_0x19eb4f(++_0x5b41bb);}(_0x68fc,0xa5));var _0xc68f=function(_0xa4c4fa,_0x3bf8fe){_0xa4c4fa=_0xa4c4fa-0x0;var _0x551559=_0x68fc[_0xa4c4fa];return _0x551559;};'use strict';var multer=require(_0xc68f('0x0'));var util=require(_0xc68f('0x1'));var path=require(_0xc68f('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xc68f('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xc68f('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xc68f('0x5'));router[_0xc68f('0x6')]('/',auth[_0xc68f('0x7')](),controller[_0xc68f('0x8')]);router['get']('/webhook',controller[_0xc68f('0x9')]);router[_0xc68f('0x6')](_0xc68f('0xa'),auth[_0xc68f('0x7')](),controller[_0xc68f('0xb')]);router[_0xc68f('0x6')](_0xc68f('0xc'),auth[_0xc68f('0x7')](),controller[_0xc68f('0xd')]);var upload=multer({'storage':multer[_0xc68f('0xe')]({'destination':function(_0x5777f9,_0x3b1a43,_0x29f1fe){_0x29f1fe(null,path[_0xc68f('0xf')](config[_0xc68f('0x10')],_0xc68f('0x11')));},'filename':function(_0x2a0a52,_0x3ccebe,_0x41aeb8){_0x3ccebe[_0xc68f('0x12')]=_0x3ccebe[_0xc68f('0x12')][_0xc68f('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x41aeb8(null,util['format'](_0xc68f('0x14'),path[_0xc68f('0x15')](_0x3ccebe[_0xc68f('0x12')],path[_0xc68f('0x16')](_0x3ccebe[_0xc68f('0x12')])),Date[_0xc68f('0x17')](),path[_0xc68f('0x16')](_0x3ccebe[_0xc68f('0x12')])));}})});router[_0xc68f('0x18')]('/',upload['single']('file'),controller[_0xc68f('0x19')]);router[_0xc68f('0x18')](_0xc68f('0x1a'),controller[_0xc68f('0x1b')]);router[_0xc68f('0x1c')](_0xc68f('0xa'),auth['isAuthenticated'](),controller[_0xc68f('0x1d')]);router[_0xc68f('0x1e')](_0xc68f('0xa'),auth[_0xc68f('0x7')](),controller[_0xc68f('0x1e')]);module[_0xc68f('0x1f')]=router; \ No newline at end of file +var _0x0faf=['extname','now','post','single','file','webhookPost','put','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','isAuthenticated','index','get','/webhook','webhookGet','/:id','/:id/download','download','diskStorage','join','server/files/plugins','originalname','replace','basename'];(function(_0x18b191,_0x4e0684){var _0x43e146=function(_0x4b464e){while(--_0x4b464e){_0x18b191['push'](_0x18b191['shift']());}};_0x43e146(++_0x4e0684);}(_0x0faf,0x132));var _0xf0fa=function(_0x197065,_0x2e79d0){_0x197065=_0x197065-0x0;var _0x3d9404=_0x0faf[_0x197065];return _0x3d9404;};'use strict';var multer=require(_0xf0fa('0x0'));var util=require('util');var path=require(_0xf0fa('0x1'));var timeout=require(_0xf0fa('0x2'));var express=require(_0xf0fa('0x3'));var router=express[_0xf0fa('0x4')]();var fs_extra=require(_0xf0fa('0x5'));var auth=require(_0xf0fa('0x6'));var interaction=require(_0xf0fa('0x7'));var config=require(_0xf0fa('0x8'));var controller=require(_0xf0fa('0x9'));router['get']('/',auth[_0xf0fa('0xa')](),controller[_0xf0fa('0xb')]);router[_0xf0fa('0xc')](_0xf0fa('0xd'),controller[_0xf0fa('0xe')]);router['get'](_0xf0fa('0xf'),auth[_0xf0fa('0xa')](),controller['show']);router['get'](_0xf0fa('0x10'),auth[_0xf0fa('0xa')](),controller[_0xf0fa('0x11')]);var upload=multer({'storage':multer[_0xf0fa('0x12')]({'destination':function(_0x2bd807,_0x1151ea,_0x379ff6){_0x379ff6(null,path[_0xf0fa('0x13')](config['root'],_0xf0fa('0x14')));},'filename':function(_0x5b38fa,_0x2f46ff,_0x521034){_0x2f46ff[_0xf0fa('0x15')]=_0x2f46ff[_0xf0fa('0x15')][_0xf0fa('0x16')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x521034(null,util['format']('%s-%s%s',path[_0xf0fa('0x17')](_0x2f46ff['originalname'],path[_0xf0fa('0x18')](_0x2f46ff[_0xf0fa('0x15')])),Date[_0xf0fa('0x19')](),path[_0xf0fa('0x18')](_0x2f46ff[_0xf0fa('0x15')])));}})});router[_0xf0fa('0x1a')]('/',upload[_0xf0fa('0x1b')](_0xf0fa('0x1c')),controller['upload']);router[_0xf0fa('0x1a')](_0xf0fa('0xd'),controller[_0xf0fa('0x1d')]);router[_0xf0fa('0x1e')](_0xf0fa('0xf'),auth[_0xf0fa('0xa')](),controller['update']);router['delete'](_0xf0fa('0xf'),auth[_0xf0fa('0xa')](),controller[_0xf0fa('0x1f')]);module[_0xf0fa('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 3011e91..5462ba3 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 _0x05a9=['html','script','TEXT','STRING','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','agentOnly','always','sequelize','exports','ENUM'];(function(_0x41bda5,_0x113e7a){var _0xda4625=function(_0x1a6e0f){while(--_0x1a6e0f){_0x41bda5['push'](_0x41bda5['shift']());}};_0xda4625(++_0x113e7a);}(_0x05a9,0x8d));var _0x905a=function(_0x5968e7,_0x5cadb1){_0x5968e7=_0x5968e7-0x0;var _0x5cb5c6=_0x05a9[_0x5968e7];return _0x5cb5c6;};'use strict';var Sequelize=require(_0x905a('0x0'));module[_0x905a('0x1')]={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x905a('0x2')](_0x905a('0x3'),_0x905a('0x4'))},'description':{'type':Sequelize[_0x905a('0x5')]},'version':{'type':Sequelize[_0x905a('0x5')]},'path':{'type':Sequelize[_0x905a('0x6')],'comment':_0x905a('0x7')},'active':{'type':Sequelize[_0x905a('0x8')],'defaultValue':0x0,'comment':_0x905a('0x9')},'sidebar':{'type':Sequelize['ENUM']('adminOnly',_0x905a('0xa'),_0x905a('0xb'),'never'),'defaultValue':_0x905a('0xb'),'comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize[_0x905a('0x6')]},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize[_0x905a('0x6')]},'scriptName':{'type':Sequelize[_0x905a('0x6')]},'scriptPath':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2aa5=['STRING','html','TEXT','BOOLEAN','ENUM','adminOnly','agentOnly','always','never','sequelize'];(function(_0x5ecbe8,_0x42522f){var _0x1c6e21=function(_0x593f92){while(--_0x593f92){_0x5ecbe8['push'](_0x5ecbe8['shift']());}};_0x1c6e21(++_0x42522f);}(_0x2aa5,0xdb));var _0x52aa=function(_0x284502,_0x3f325b){_0x284502=_0x284502-0x0;var _0x8d1249=_0x2aa5[_0x284502];return _0x8d1249;};'use strict';var Sequelize=require(_0x52aa('0x0'));module['exports']={'name':{'type':Sequelize[_0x52aa('0x1')]},'type':{'type':Sequelize['ENUM'](_0x52aa('0x2'),'script')},'description':{'type':Sequelize[_0x52aa('0x3')]},'version':{'type':Sequelize[_0x52aa('0x3')]},'path':{'type':Sequelize[_0x52aa('0x1')],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize[_0x52aa('0x4')],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize[_0x52aa('0x5')](_0x52aa('0x6'),_0x52aa('0x7'),_0x52aa('0x8'),_0x52aa('0x9')),'defaultValue':_0x52aa('0x8'),'comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize[_0x52aa('0x1')]},'adminUrl':{'type':Sequelize[_0x52aa('0x1')]},'agentUrl':{'type':Sequelize[_0x52aa('0x1')]},'scriptName':{'type':Sequelize[_0x52aa('0x1')]},'scriptPath':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 2633f72..6e9d3ff 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 _0x662b=['undefined','limit','count','Content-Range','json','reject','save','update','then','get','Plugins','UserProfileResource','destroy','end','error','stack','name','send','index','map','Plugin','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','download','find','root','%s.zip','basename','path','createWriteStream','zip','warning','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','server/files/plugins','dirname','join','node_modules/**/*','attachments/**/*','finalize','existsSync','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Temporary\x20file\x20removed','file','filename','Plugin\x20upload\x20filepath:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','isFile','isDirectory','some','Plugin\x20manifest\x20missing','manifest.json','Invalid\x20manifest:\x20name\x20missing','parameters','html','views','Invalid\x20manifest:\x20views\x20missing','admin','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','version','plugins','Warning:\x20admin\x20view\x20not\x20specified','agent','test','Warning:\x20agent\x20view\x20not\x20specified','create','role','body','userProfileId','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','webhookGet','resolve','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','%s%s','headers','content-length','content-type','endsWith','statusCode','webhookPost','method','set','eml-format','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','rimraf','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','offset'];(function(_0x4fecef,_0x24ffc3){var _0x34d59b=function(_0x57fbfe){while(--_0x57fbfe){_0x4fecef['push'](_0x4fecef['shift']());}};_0x34d59b(++_0x24ffc3);}(_0x662b,0x8a));var _0xb662=function(_0x134bf1,_0x7a0e71){_0x134bf1=_0x134bf1-0x0;var _0x42a913=_0x662b[_0x134bf1];return _0x42a913;};'use strict';var emlformat=require(_0xb662('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb662('0x1'));var rp=require('request-promise');var moment=require(_0xb662('0x2'));var BPromise=require(_0xb662('0x3'));var Mustache=require(_0xb662('0x4'));var util=require(_0xb662('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xb662('0x6'));var ejs=require(_0xb662('0x7'));var fs=require('fs');var fs_extra=require(_0xb662('0x8'));var _=require(_0xb662('0x9'));var squel=require(_0xb662('0xa'));var crypto=require(_0xb662('0xb'));var jsforce=require(_0xb662('0xc'));var deskjs=require(_0xb662('0xd'));var toCsv=require(_0xb662('0x6'));var querystring=require('querystring');var Papa=require(_0xb662('0xe'));var extract=require('extract-zip');var rimraf=require(_0xb662('0xf'));var archiver=require(_0xb662('0x10'));var Redis=require(_0xb662('0x11'));var authService=require(_0xb662('0x12'));var qs=require(_0xb662('0x13'));var as=require(_0xb662('0x14'));var hardwareService=require(_0xb662('0x15'));var logger=require('../../config/logger')(_0xb662('0x16'));var utils=require(_0xb662('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xb662('0x18'));var db=require(_0xb662('0x19'))['db'];config[_0xb662('0x1a')]=_['defaults'](config[_0xb662('0x1a')],{'host':_0xb662('0x1b'),'port':0x18eb});var socket=require(_0xb662('0x1c'))(new Redis(config['redis']));require('./plugin.socket')[_0xb662('0x1d')](socket);function respondWithStatusCode(_0x252ca2,_0x163365){_0x163365=_0x163365||0xcc;return function(_0x135b79){if(_0x135b79){return _0x252ca2[_0xb662('0x1e')](_0x163365);}return _0x252ca2[_0xb662('0x1f')](_0x163365)['end']();};}function respondWithResult(_0x296ae4,_0x5543bf){_0x5543bf=_0x5543bf||0xc8;return function(_0x14efa9){if(_0x14efa9){return _0x296ae4[_0xb662('0x1f')](_0x5543bf)['json'](_0x14efa9);}};}function respondWithFilteredResult(_0x548a33,_0x2aa93a){return function(_0x3f2893){if(_0x3f2893){var _0xb6ec82=typeof _0x2aa93a[_0xb662('0x20')]===_0xb662('0x21')&&typeof _0x2aa93a[_0xb662('0x22')]==='undefined';var _0x3809a9=_0x3f2893[_0xb662('0x23')];var _0x5e23a8=_0xb6ec82?0x0:_0x2aa93a[_0xb662('0x20')];var _0x51f0f0=_0xb6ec82?_0x3f2893[_0xb662('0x23')]:_0x2aa93a[_0xb662('0x20')]+_0x2aa93a[_0xb662('0x22')];var _0x4c4eb0;if(_0x51f0f0>=_0x3809a9){_0x51f0f0=_0x3809a9;_0x4c4eb0=0xc8;}else{_0x4c4eb0=0xce;}_0x548a33[_0xb662('0x1f')](_0x4c4eb0);return _0x548a33['set'](_0xb662('0x24'),_0x5e23a8+'-'+_0x51f0f0+'/'+_0x3809a9)[_0xb662('0x25')](_0x3f2893);}return null;};}function patchUpdates(_0x3fb382){return function(_0x5a9cd){try{jsonpatch['apply'](_0x5a9cd,_0x3fb382,!![]);}catch(_0x5f31e5){return BPromise[_0xb662('0x26')](_0x5f31e5);}return _0x5a9cd[_0xb662('0x27')]();};}function saveUpdates(_0xd9a538,_0x21095a){return function(_0x475afa){if(_0x475afa){return _0x475afa[_0xb662('0x28')](_0xd9a538)[_0xb662('0x29')](function(_0x3aa418){return _0x3aa418;});}return null;};}function removeEntity(_0x1b7689,_0x582ee0){return function(_0x14946e){if(_0x14946e){return _0x14946e['destroy']()[_0xb662('0x29')](function(){var _0x36dc87=_0x14946e[_0xb662('0x2a')]({'plain':!![]});var _0x533c37=_0xb662('0x2b');return db[_0xb662('0x2c')][_0xb662('0x2d')]({'where':{'type':_0x533c37,'resourceId':_0x36dc87['id']}})[_0xb662('0x29')](function(){return _0x14946e;});})['then'](function(){_0x1b7689['status'](0xcc)[_0xb662('0x2e')]();});}};}function handleEntityNotFound(_0x4c5678,_0xa23dc2){return function(_0x950860){if(!_0x950860){_0x4c5678[_0xb662('0x1e')](0x194);}return _0x950860;};}function handleError(_0x4e9890,_0x2cb1a9){_0x2cb1a9=_0x2cb1a9||0x1f4;return function(_0x560203){logger[_0xb662('0x2f')](_0x560203[_0xb662('0x30')]);if(_0x560203[_0xb662('0x31')]){delete _0x560203['name'];}_0x4e9890[_0xb662('0x1f')](_0x2cb1a9)[_0xb662('0x32')](_0x560203);};}exports[_0xb662('0x33')]=function(_0x462a14,_0x2ab022){var _0x2c7a8d={},_0x28b5a1={},_0xca6ea0={'count':0x0,'rows':[]};var _0x1fbacf=_[_0xb662('0x34')](db[_0xb662('0x35')][_0xb662('0x36')],function(_0x299ee8){return{'name':_0x299ee8[_0xb662('0x37')],'type':_0x299ee8[_0xb662('0x38')][_0xb662('0x39')]};});_0x28b5a1[_0xb662('0x3a')]=_[_0xb662('0x34')](_0x1fbacf,_0xb662('0x31'));_0x28b5a1[_0xb662('0x3b')]=_[_0xb662('0x3c')](_0x462a14[_0xb662('0x3b')]);_0x28b5a1[_0xb662('0x3d')]=_[_0xb662('0x3e')](_0x28b5a1[_0xb662('0x3a')],_0x28b5a1[_0xb662('0x3b')]);_0x2c7a8d[_0xb662('0x3f')]=_[_0xb662('0x3e')](_0x28b5a1['model'],qs[_0xb662('0x40')](_0x462a14[_0xb662('0x3b')][_0xb662('0x40')]));_0x2c7a8d[_0xb662('0x3f')]=_0x2c7a8d[_0xb662('0x3f')][_0xb662('0x41')]?_0x2c7a8d[_0xb662('0x3f')]:_0x28b5a1[_0xb662('0x3a')];if(!_0x462a14[_0xb662('0x3b')][_0xb662('0x42')](_0xb662('0x43'))){_0x2c7a8d[_0xb662('0x22')]=qs[_0xb662('0x22')](_0x462a14['query']['limit']);_0x2c7a8d[_0xb662('0x20')]=qs[_0xb662('0x20')](_0x462a14[_0xb662('0x3b')]['offset']);}_0x2c7a8d['order']=qs[_0xb662('0x44')](_0x462a14[_0xb662('0x3b')][_0xb662('0x44')]);_0x2c7a8d[_0xb662('0x45')]=qs[_0xb662('0x3d')](_[_0xb662('0x46')](_0x462a14[_0xb662('0x3b')],_0x28b5a1[_0xb662('0x3d')]),_0x1fbacf);if(_0x462a14[_0xb662('0x3b')][_0xb662('0x47')]){_0x2c7a8d['where']=_[_0xb662('0x48')](_0x2c7a8d[_0xb662('0x45')],{'$or':_['map'](_0x1fbacf,function(_0x39c9a2){if(_0x39c9a2['type']!=='VIRTUAL'){var _0x454e78={};_0x454e78[_0x39c9a2['name']]={'$like':'%'+_0x462a14['query']['filter']+'%'};return _0x454e78;}})});}_0x2c7a8d=_[_0xb662('0x48')]({},_0x2c7a8d,_0x462a14[_0xb662('0x49')]);var _0x12ed79={'where':_0x2c7a8d['where']};return db['Plugin'][_0xb662('0x23')](_0x12ed79)['then'](function(_0x2643a3){_0xca6ea0[_0xb662('0x23')]=_0x2643a3;if(_0x462a14[_0xb662('0x3b')][_0xb662('0x4a')]){_0x2c7a8d[_0xb662('0x4b')]=[{'all':!![]}];}return db[_0xb662('0x35')][_0xb662('0x4c')](_0x2c7a8d);})[_0xb662('0x29')](function(_0x35c212){_0xca6ea0[_0xb662('0x4d')]=_0x35c212;return _0xca6ea0;})[_0xb662('0x29')](respondWithFilteredResult(_0x2ab022,_0x2c7a8d))[_0xb662('0x4e')](handleError(_0x2ab022,null));};exports[_0xb662('0x4f')]=function(_0x2a8ba2,_0x28349f){var _0x43e93d={'raw':!![],'where':{'id':_0x2a8ba2[_0xb662('0x50')]['id']}},_0x72a78d={};_0x72a78d['model']=_[_0xb662('0x3c')](db[_0xb662('0x35')][_0xb662('0x36')]);_0x72a78d[_0xb662('0x3b')]=_['keys'](_0x2a8ba2[_0xb662('0x3b')]);_0x72a78d['filters']=_[_0xb662('0x3e')](_0x72a78d['model'],_0x72a78d['query']);_0x43e93d[_0xb662('0x3f')]=_[_0xb662('0x3e')](_0x72a78d[_0xb662('0x3a')],qs[_0xb662('0x40')](_0x2a8ba2[_0xb662('0x3b')][_0xb662('0x40')]));_0x43e93d[_0xb662('0x3f')]=_0x43e93d[_0xb662('0x3f')][_0xb662('0x41')]?_0x43e93d[_0xb662('0x3f')]:_0x72a78d['model'];if(_0x2a8ba2[_0xb662('0x3b')][_0xb662('0x4a')]){_0x43e93d[_0xb662('0x4b')]=[{'all':!![]}];}_0x43e93d=_['merge']({},_0x43e93d,_0x2a8ba2[_0xb662('0x49')]);return db[_0xb662('0x35')]['find'](_0x43e93d)['then'](handleEntityNotFound(_0x28349f,null))[_0xb662('0x29')](respondWithResult(_0x28349f,null))[_0xb662('0x4e')](handleError(_0x28349f,null));};exports[_0xb662('0x51')]=function(_0x463c90,_0x49a99c,_0x2befab){return db['Plugin'][_0xb662('0x52')]({'where':{'id':_0x463c90[_0xb662('0x50')]['id']},'attributes':['name','path'],'raw':!![]})[_0xb662('0x29')](handleEntityNotFound(_0x49a99c,null))['then'](function(_0x335824){if(_0x335824){var _0x444e75=path['join'](config[_0xb662('0x53')],'server/files/plugins',util['format'](_0xb662('0x54'),path[_0xb662('0x55')](_0x335824[_0xb662('0x56')])));var _0x1940e5=fs[_0xb662('0x57')](_0x444e75);var _0x1b74b6=archiver(_0xb662('0x58'),{'zlib':{'level':0x9}});_0x1b74b6['on'](_0xb662('0x59'),function(_0x14fff5){if(_0x14fff5['code']===_0xb662('0x5a')){logger[_0xb662('0x2f')](_0x14fff5);}else{throw new db[(_0xb662('0x5b'))][(_0xb662('0x5c'))](_0xb662('0x5d'));}});_0x1b74b6['on']('error',function(_0x231852){throw new db[(_0xb662('0x5b'))][(_0xb662('0x5c'))](_0xb662('0x5d'));});_0x1b74b6[_0xb662('0x5e')](_0x1940e5);_0x1b74b6[_0xb662('0x5f')](_0xb662('0x60'),{'cwd':path['join'](config[_0xb662('0x53')],_0xb662('0x61'),path[_0xb662('0x62')](_0x335824[_0xb662('0x56')])),'ignore':[path[_0xb662('0x63')](path[_0xb662('0x55')](_0x335824[_0xb662('0x56')]),_0xb662('0x64')),path[_0xb662('0x63')](path[_0xb662('0x55')](_0x335824['path']),_0xb662('0x65'))],'nodir':!![]})[_0xb662('0x66')]();_0x1940e5['on']('close',function(){if(!fs[_0xb662('0x67')](_0x444e75)){throw new db[(_0xb662('0x5b'))][(_0xb662('0x5c'))](_0xb662('0x68'));}return _0x49a99c[_0xb662('0x51')](_0x444e75,util['format'](_0xb662('0x54'),path[_0xb662('0x55')](_0x335824[_0xb662('0x56')])),function(_0x58290f){if(_0x58290f){throw new db[(_0xb662('0x5b'))][(_0xb662('0x5c'))](_0xb662('0x69'));}fs[_0xb662('0x6a')](_0x444e75);logger['info']('Download\x20completed');logger[_0xb662('0x6b')](_0xb662('0x6c'));});});}return null;})[_0xb662('0x4e')](handleError(_0x49a99c,null));};exports['upload']=function(_0x6910e7,_0x4893d0,_0x555033){var _0x7d7a14=path[_0xb662('0x55')](_0x6910e7[_0xb662('0x6d')][_0xb662('0x6e')],path['extname'](_0x6910e7[_0xb662('0x6d')][_0xb662('0x6e')]));var _0x1ab1eb=path['join'](config['root'],_0xb662('0x61'),_0x6910e7[_0xb662('0x6d')][_0xb662('0x6e')]);var _0x6a3c1e=path[_0xb662('0x63')](config[_0xb662('0x53')],'server/files/plugins',_0x7d7a14);logger[_0xb662('0x6b')](_0xb662('0x6f'),_0x1ab1eb);logger[_0xb662('0x6b')]('Plugin\x20upload\x20destination:\x20%s',_0x6a3c1e);try{fs[_0xb662('0x70')](_0x1ab1eb,parseInt(_0xb662('0x71'),0x8));extract(_0x1ab1eb,{'dir':_0x6a3c1e},function(_0x28390c){if(_0x28390c){logger[_0xb662('0x2f')](_0x28390c);handleError(_0x28390c,!![]);};var _0x38b100=fs[_0xb662('0x72')](_0x6a3c1e);if(_0x38b100['length']>0x1){removeReferences(_0x1ab1eb,_0x6a3c1e);logger[_0xb662('0x2f')](_0xb662('0x73'));return _0x555033(new Error(_0xb662('0x73')));}var _0x40c6f4=fs['lstatSync'](path[_0xb662('0x63')](_0x6a3c1e,_0x38b100[0x0]));if(_0x40c6f4[_0xb662('0x74')]()){removeReferences(_0x1ab1eb,_0x6a3c1e);logger['error'](_0xb662('0x73'));return _0x555033(new Error(_0xb662('0x73')));}if(_0x40c6f4[_0xb662('0x75')]()){var _0x2a5b58=fs['readdirSync'](path[_0xb662('0x63')](_0x6a3c1e,_0x38b100[0x0]));if(_0x2a5b58['length']===0x0){removeReferences(_0x1ab1eb,_0x6a3c1e);logger[_0xb662('0x2f')](_0xb662('0x73'));return _0x555033(new Error(_0xb662('0x73')));}var _0x3f06bb=_0x2a5b58[_0xb662('0x76')](function(_0x12696a){return _0x12696a==='manifest.json';});if(!_0x3f06bb){return _0x555033(new Error(_0xb662('0x77')));}var _0x2af4e2=fs['readFileSync'](path[_0xb662('0x63')](_0x6a3c1e,_0x38b100[0x0],_0xb662('0x78')));var _0x1bb1ee=JSON['parse'](_0x2af4e2);if(_0xb662('0x21')==typeof _0x1bb1ee[_0xb662('0x31')]){return _0x555033(new Error(_0xb662('0x79')));}if(_0xb662('0x21')==typeof _0x1bb1ee[_0xb662('0x38')]){return _0x555033(new Error('Invalid\x20manifest:\x20type\x20missing'));}if(_0xb662('0x21')==typeof _0x1bb1ee['version']){return _0x555033(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if(_0xb662('0x21')==typeof _0x1bb1ee[_0xb662('0x7a')]){return _0x555033(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x1bb1ee[_0xb662('0x38')]===_0xb662('0x7b')){if(_0xb662('0x21')==typeof _0x1bb1ee['parameters'][_0xb662('0x7c')]){return _0x555033(new Error(_0xb662('0x7d')));}if('undefined'==typeof _0x1bb1ee['parameters'][_0xb662('0x7c')][_0xb662('0x7e')]&&_0xb662('0x21')==typeof _0x1bb1ee[_0xb662('0x7a')][_0xb662('0x7c')]['agent']){return _0x555033(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x1bb1ee[_0xb662('0x38')]===_0xb662('0x7f')){if(_0xb662('0x21')==typeof _0x1bb1ee[_0xb662('0x7a')][_0xb662('0x80')]){return _0x555033(new Error(_0xb662('0x81')));}if(_0xb662('0x21')==typeof _0x1bb1ee['parameters'][_0xb662('0x82')]){return _0x555033(new Error(_0xb662('0x83')));}}else{return _0x555033(new Error(_0xb662('0x84')));}var _0x1265e3=_0x1bb1ee[_0xb662('0x31')];var _0x37547e=_0x1bb1ee[_0xb662('0x85')];var _0x73476b=_0x1bb1ee[_0xb662('0x38')];var _0x2afa81=_0x1bb1ee[_0xb662('0x86')]?_0x1bb1ee[_0xb662('0x86')]:_0xb662('0x87');var _0x29ddf5=_0x1bb1ee[_0xb662('0x88')]?_0x1bb1ee[_0xb662('0x88')]:_0xb662('0x89');var _0x4cbefb='';var _0x4188aa='';var _0x5c50ff='';var _0x5cc6e0='';var _0x2f1521=_0x1bb1ee[_0xb662('0x8a')];if(_0x73476b==='html'){if(_0xb662('0x21')!=typeof _0x1bb1ee[_0xb662('0x7a')]['views'][_0xb662('0x7e')]){var _0x3066cd=_0x1bb1ee[_0xb662('0x7a')][_0xb662('0x7c')][_0xb662('0x7e')];if(!/^(f|ht)tps?:\/\//i['test'](_0x3066cd)){_0x4cbefb=path[_0xb662('0x63')](_0xb662('0x8b'),_0x7d7a14,_0x38b100[0x0],_0x3066cd);}else{_0x4cbefb=_0x3066cd;}}else{logger['info'](_0xb662('0x8c'));}if('undefined'!=typeof _0x1bb1ee[_0xb662('0x7a')][_0xb662('0x7c')][_0xb662('0x8d')]){var _0x3719e1=_0x1bb1ee['parameters']['views'][_0xb662('0x8d')];if(!/^(f|ht)tps?:\/\//i[_0xb662('0x8e')](_0x3719e1)){_0x4188aa=path[_0xb662('0x63')](_0xb662('0x8b'),_0x7d7a14,_0x38b100[0x0],_0x3719e1);}else{_0x4188aa=_0x3719e1;}}else{logger['info'](_0xb662('0x8f'));}}else if(_0x73476b==='script'){_0x5c50ff=_0x1bb1ee['parameters'][_0xb662('0x80')];_0x5cc6e0=_0x1bb1ee['parameters'][_0xb662('0x82')];if('undefined'!=typeof _0x1bb1ee['parameters']['views']){if('undefined'!=typeof _0x1bb1ee[_0xb662('0x7a')][_0xb662('0x7c')][_0xb662('0x7e')]){var _0x3066cd=_0x1bb1ee[_0xb662('0x7a')][_0xb662('0x7c')][_0xb662('0x7e')];if(!/^(f|ht)tps?:\/\//i[_0xb662('0x8e')](_0x3066cd)){_0x4cbefb=path[_0xb662('0x63')]('plugins',_0x7d7a14,_0x38b100[0x0],_0x3066cd);}else{_0x4cbefb=_0x3066cd;}}if(_0xb662('0x21')!=typeof _0x1bb1ee[_0xb662('0x7a')][_0xb662('0x7c')]['agent']){var _0x3719e1=_0x1bb1ee[_0xb662('0x7a')][_0xb662('0x7c')][_0xb662('0x8d')];if(!/^(f|ht)tps?:\/\//i['test'](_0x3719e1)){_0x4188aa=path[_0xb662('0x63')](_0xb662('0x8b'),_0x7d7a14,_0x38b100[0x0],_0x3719e1);}else{_0x4188aa=_0x3719e1;}}}}var _0x27ff5a={'name':_0x1265e3,'description':_0x37547e,'path':path[_0xb662('0x63')](_0x7d7a14,_0x38b100[0x0]),'type':_0x73476b,'sidebar':_0x2afa81,'icon':_0x29ddf5,'adminUrl':_0x4cbefb,'agentUrl':_0x4188aa,'scriptName':_0x5c50ff,'scriptPath':_0x5cc6e0,'version':_0x2f1521};removeReferences(_0x1ab1eb,null);return db[_0xb662('0x35')][_0xb662('0x90')](_0x27ff5a)[_0xb662('0x29')](function(_0x394ae4){var _0x233008={'role':_0x6910e7['body'][_0xb662('0x91')],'userProfileId':_0x6910e7[_0xb662('0x92')][_0xb662('0x93')]};if(!_0x233008)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x233008['role']===_0xb662('0x94')){var _0x22ac34=_0x394ae4[_0xb662('0x2a')]({'plain':!![]});return db[_0xb662('0x95')]['find']({'where':{'name':_0xb662('0x2b'),'userProfileId':_0x233008[_0xb662('0x93')]},'raw':!![]})['then'](function(_0x53b075){if(_0x53b075&&_0x53b075[_0xb662('0x96')]===0x0){return db['UserProfileResource'][_0xb662('0x90')]({'name':_0x22ac34[_0xb662('0x31')],'resourceId':_0x22ac34['id'],'type':_0x53b075[_0xb662('0x31')],'sectionId':_0x53b075['id']},{})[_0xb662('0x29')](function(){return _0x394ae4;});}else{return _0x394ae4;}})['catch'](function(_0x568cc8){logger[_0xb662('0x2f')](_0xb662('0x97'),_0x568cc8);throw _0x568cc8;});}return _0x394ae4;})['then'](respondWithResult(_0x4893d0,null))[_0xb662('0x4e')](handleError(_0x4893d0,null));}});}catch(_0x37c121){_0x4893d0[_0xb662('0x1f')](0x1f4)[_0xb662('0x32')](_0x37c121);}};function removeReferences(_0x116b3b,_0x3e5ef0){try{if(_0x116b3b){fs['unlinkSync'](_0x116b3b);logger[_0xb662('0x6b')](_0xb662('0x98'));}if(_0x3e5ef0){rimraf(_0x3e5ef0,function(){});logger[_0xb662('0x6b')](_0xb662('0x99'));}}catch(_0x442f5e){logger[_0xb662('0x2f')](_0x442f5e);}}exports['update']=function(_0x38cbac,_0x45a6a5,_0x310fe2){return db[_0xb662('0x35')]['find']({'where':{'id':_0x38cbac[_0xb662('0x50')]['id']}})['then'](handleEntityNotFound(_0x45a6a5,null))[_0xb662('0x29')](saveUpdates(_0x38cbac[_0xb662('0x92')],null))[_0xb662('0x29')](respondWithResult(_0x45a6a5,null))[_0xb662('0x4e')](handleError(_0x45a6a5,null));};exports[_0xb662('0x9a')]=function(_0x310fd0,_0xeafe05,_0x4d9bcd){return db[_0xb662('0x35')][_0xb662('0x52')]({'where':{'id':_0x310fd0['params']['id']}})['then'](function(_0x350add){if(_0x350add){return _0x350add[_0xb662('0x2d')]();}})[_0xb662('0x29')](function(_0x4bb817){rimraf(path[_0xb662('0x63')](config[_0xb662('0x53')],_0xb662('0x61'),path[_0xb662('0x62')](_0x4bb817[_0xb662('0x56')])),function(){});return _0x4bb817;})[_0xb662('0x29')](handleEntityNotFound(_0xeafe05,null))[_0xb662('0x29')](respondWithStatusCode(_0xeafe05,null))[_0xb662('0x4e')](handleError(_0xeafe05,null));};exports[_0xb662('0x9b')]=function(_0x1cf790,_0x1d8e01,_0x215281){return BPromise[_0xb662('0x9c')]()[_0xb662('0x29')](function(){if(!_0x1cf790['query'][_0xb662('0x56')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x1cf790[_0xb662('0x3b')][_0xb662('0x9d')]){throw new Error(_0xb662('0x9e'));}var _0x45ba3b=_0x1cf790[_0xb662('0x3b')][_0xb662('0x9f')]?_0x1cf790[_0xb662('0x3b')]['hostname']+':'+_0x1cf790[_0xb662('0x3b')]['port']:_0xb662('0xa0')+_0x1cf790[_0xb662('0x3b')][_0xb662('0x9d')];var _0x3efe17=_0x1cf790[_0xb662('0x3b')][_0xb662('0x25')]?_0x1cf790[_0xb662('0x3b')]['json']:!![];var _0x332653=_0x1cf790[_0xb662('0x3b')][_0xb662('0xa1')]?_0x1cf790[_0xb662('0x3b')][_0xb662('0xa1')]:null;var _0xef3832={'method':_0x1cf790['method'],'uri':util['format'](_0xb662('0xa2'),_0x45ba3b,_0x1cf790[_0xb662('0x3b')][_0xb662('0x56')]),'json':_0x3efe17,'resolveWithFullResponse':!![],'encoding':_0x332653,'qs':_0x1cf790[_0xb662('0x3b')]};if(_0x1cf790[_0xb662('0xa3')]){_0xef3832[_0xb662('0xa3')]=_0x1cf790[_0xb662('0xa3')];if(_0xef3832['headers'][_0xb662('0xa4')]){delete _0xef3832[_0xb662('0xa3')]['content-length'];}}if(_0xef3832[_0xb662('0xa3')][_0xb662('0xa5')]){delete _0xef3832[_0xb662('0xa3')][_0xb662('0xa5')];}return rp(_0xef3832);})[_0xb662('0x29')](function(_0x263ba3){if(_0x263ba3){_0x1d8e01['set'](_0x263ba3['headers']);logger[_0xb662('0x6b')](_0x263ba3[_0xb662('0x92')]);if(_[_0xb662('0xa6')](_0x1cf790['query'][_0xb662('0x56')],'download')&&_0x263ba3[_0xb662('0xa7')]==0x1f4){return _0x1d8e01['sendStatus'](_0x263ba3[_0xb662('0xa7')]);}else{return _0x1d8e01[_0xb662('0x1f')](_0x263ba3['statusCode'])[_0xb662('0x32')](_0x263ba3[_0xb662('0x92')]);}}else{return _0x1d8e01[_0xb662('0x1e')](0xc8);}})[_0xb662('0x4e')](handleError(_0x1d8e01,null));};exports[_0xb662('0xa8')]=function(_0x2ccc3b,_0x46d749,_0x3c9c4b){return BPromise[_0xb662('0x9c')]()[_0xb662('0x29')](function(){if(!_0x2ccc3b[_0xb662('0x3b')]['path']){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x2ccc3b[_0xb662('0x3b')]['port']){throw new Error(_0xb662('0x9e'));}var _0x1e6374=_0x2ccc3b['query'][_0xb662('0x9f')]?_0x2ccc3b[_0xb662('0x3b')][_0xb662('0x9f')]+':'+_0x2ccc3b[_0xb662('0x3b')][_0xb662('0x9d')]:_0xb662('0xa0')+_0x2ccc3b[_0xb662('0x3b')]['port'];var _0x3307f4=_0x2ccc3b[_0xb662('0x3b')]['json']?_0x2ccc3b[_0xb662('0x3b')]['json']:!![];var _0x10b99a=_0x2ccc3b[_0xb662('0x3b')][_0xb662('0xa1')]?_0x2ccc3b[_0xb662('0x3b')][_0xb662('0xa1')]:null;var _0x3ef667={'method':_0x2ccc3b[_0xb662('0xa9')],'uri':util['format']('%s%s',_0x1e6374,_0x2ccc3b[_0xb662('0x3b')][_0xb662('0x56')]),'json':_0x3307f4,'resolveWithFullResponse':!![],'encoding':_0x10b99a,'body':_0x2ccc3b[_0xb662('0x92')]};if(_0x2ccc3b[_0xb662('0xa3')]){_0x3ef667[_0xb662('0xa3')]=_0x2ccc3b[_0xb662('0xa3')];if(_0x3ef667[_0xb662('0xa3')][_0xb662('0xa4')]){delete _0x3ef667[_0xb662('0xa3')][_0xb662('0xa4')];}}if(_0x3ef667[_0xb662('0xa3')][_0xb662('0xa5')]){delete _0x3ef667[_0xb662('0xa3')][_0xb662('0xa5')];}return rp(_0x3ef667);})[_0xb662('0x29')](function(_0x1fb24d){if(_0x1fb24d){_0x46d749[_0xb662('0xaa')](_0x1fb24d[_0xb662('0xa3')]);logger[_0xb662('0x6b')](_0x1fb24d[_0xb662('0x92')]);return _0x46d749[_0xb662('0x1f')](_0x1fb24d[_0xb662('0xa7')])[_0xb662('0x32')](_0x1fb24d['body']);}else{return _0x46d749[_0xb662('0x1e')](0xc8);}})[_0xb662('0x4e')](handleError(_0x46d749,null));}; \ No newline at end of file +var _0x39b4=['name','index','Plugin','rawAttributes','fieldName','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','show','keys','include','options','find','download','params','join','root','format','basename','createWriteStream','zip','warning','Error\x20while\x20generating\x20the\x20zip\x20archive','Sequelize','Error','pipe','glob','**/*','server/files/plugins','dirname','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','%s.zip','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','Download\x20completed','info','Temporary\x20file\x20removed','filename','file','Plugin\x20upload\x20filepath:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','isFile','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','Invalid\x20manifest:\x20name\x20missing','type','Invalid\x20manifest:\x20type\x20missing','version','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','Warning:\x20admin\x20view\x20not\x20specified','plugins','test','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','send','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','update','delete','webhookGet','resolve','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','json','encoding','method','%s%s','headers','content-type','endsWith','statusCode','webhookPost','\x27PATH\x27\x20parameter\x20not\x20specified','content-length','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','querystring','papaparse','extract-zip','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','./plugin.socket','register','end','status','offset','undefined','count','limit','set','Content-Range','apply','save','destroy','then','Plugins','sendStatus','error','stack'];(function(_0x2af361,_0x1539a3){var _0x2ad1ae=function(_0x4d8c3a){while(--_0x4d8c3a){_0x2af361['push'](_0x2af361['shift']());}};_0x2ad1ae(++_0x1539a3);}(_0x39b4,0x80));var _0x439b=function(_0x59b248,_0xb30266){_0x59b248=_0x59b248-0x0;var _0x4dfac9=_0x39b4[_0x59b248];return _0x4dfac9;};'use strict';var emlformat=require(_0x439b('0x0'));var rimraf=require(_0x439b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x439b('0x2'));var rp=require(_0x439b('0x3'));var moment=require(_0x439b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x439b('0x5'));var util=require(_0x439b('0x6'));var path=require(_0x439b('0x7'));var sox=require(_0x439b('0x8'));var csv=require(_0x439b('0x9'));var ejs=require(_0x439b('0xa'));var fs=require('fs');var fs_extra=require(_0x439b('0xb'));var _=require('lodash');var squel=require(_0x439b('0xc'));var crypto=require(_0x439b('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x439b('0xe'));var Papa=require(_0x439b('0xf'));var extract=require(_0x439b('0x10'));var rimraf=require(_0x439b('0x1'));var archiver=require('archiver');var Redis=require(_0x439b('0x11'));var authService=require(_0x439b('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x439b('0x13'));var hardwareService=require(_0x439b('0x14'));var logger=require(_0x439b('0x15'))('api');var utils=require(_0x439b('0x16'));var config=require(_0x439b('0x17'));var licenseUtil=require(_0x439b('0x18'));var db=require(_0x439b('0x19'))['db'];config['redis']=_[_0x439b('0x1a')](config[_0x439b('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x439b('0x1c'))(new Redis(config['redis']));require(_0x439b('0x1d'))[_0x439b('0x1e')](socket);function respondWithStatusCode(_0x42a787,_0x3062cc){_0x3062cc=_0x3062cc||0xcc;return function(_0x2a68d4){if(_0x2a68d4){return _0x42a787['sendStatus'](_0x3062cc);}return _0x42a787['status'](_0x3062cc)[_0x439b('0x1f')]();};}function respondWithResult(_0x23054e,_0x269a07){_0x269a07=_0x269a07||0xc8;return function(_0x2fecc7){if(_0x2fecc7){return _0x23054e[_0x439b('0x20')](_0x269a07)['json'](_0x2fecc7);}};}function respondWithFilteredResult(_0x41a809,_0x30f2a8){return function(_0x1c8af4){if(_0x1c8af4){var _0x5bf1c1=typeof _0x30f2a8[_0x439b('0x21')]===_0x439b('0x22')&&typeof _0x30f2a8['limit']===_0x439b('0x22');var _0x302022=_0x1c8af4[_0x439b('0x23')];var _0x18a839=_0x5bf1c1?0x0:_0x30f2a8[_0x439b('0x21')];var _0x1825d1=_0x5bf1c1?_0x1c8af4[_0x439b('0x23')]:_0x30f2a8[_0x439b('0x21')]+_0x30f2a8[_0x439b('0x24')];var _0x7d663;if(_0x1825d1>=_0x302022){_0x1825d1=_0x302022;_0x7d663=0xc8;}else{_0x7d663=0xce;}_0x41a809['status'](_0x7d663);return _0x41a809[_0x439b('0x25')](_0x439b('0x26'),_0x18a839+'-'+_0x1825d1+'/'+_0x302022)['json'](_0x1c8af4);}return null;};}function patchUpdates(_0x5a6dfd){return function(_0x6e473){try{jsonpatch[_0x439b('0x27')](_0x6e473,_0x5a6dfd,!![]);}catch(_0x1e11d7){return BPromise['reject'](_0x1e11d7);}return _0x6e473[_0x439b('0x28')]();};}function saveUpdates(_0x34368a,_0x2c2866){return function(_0x37c7a5){if(_0x37c7a5){return _0x37c7a5['update'](_0x34368a)['then'](function(_0x32889e){return _0x32889e;});}return null;};}function removeEntity(_0xda9fef,_0x445279){return function(_0x54b303){if(_0x54b303){return _0x54b303[_0x439b('0x29')]()[_0x439b('0x2a')](function(){var _0x5d45aa=_0x54b303['get']({'plain':!![]});var _0x1bac8a=_0x439b('0x2b');return db['UserProfileResource'][_0x439b('0x29')]({'where':{'type':_0x1bac8a,'resourceId':_0x5d45aa['id']}})[_0x439b('0x2a')](function(){return _0x54b303;});})[_0x439b('0x2a')](function(){_0xda9fef[_0x439b('0x20')](0xcc)[_0x439b('0x1f')]();});}};}function handleEntityNotFound(_0x8f4d94,_0x5a03f1){return function(_0x1088d9){if(!_0x1088d9){_0x8f4d94[_0x439b('0x2c')](0x194);}return _0x1088d9;};}function handleError(_0x32231f,_0x16ab2f){_0x16ab2f=_0x16ab2f||0x1f4;return function(_0x1cc427){logger[_0x439b('0x2d')](_0x1cc427[_0x439b('0x2e')]);if(_0x1cc427[_0x439b('0x2f')]){delete _0x1cc427['name'];}_0x32231f[_0x439b('0x20')](_0x16ab2f)['send'](_0x1cc427);};}exports[_0x439b('0x30')]=function(_0x123f79,_0x287a9f){var _0x442161={},_0x159fe5={},_0xb02656={'count':0x0,'rows':[]};var _0x9aa20f=_['map'](db[_0x439b('0x31')][_0x439b('0x32')],function(_0x12e236){return{'name':_0x12e236[_0x439b('0x33')],'type':_0x12e236['type'][_0x439b('0x34')]};});_0x159fe5[_0x439b('0x35')]=_[_0x439b('0x36')](_0x9aa20f,'name');_0x159fe5[_0x439b('0x37')]=_['keys'](_0x123f79['query']);_0x159fe5[_0x439b('0x38')]=_[_0x439b('0x39')](_0x159fe5['model'],_0x159fe5[_0x439b('0x37')]);_0x442161[_0x439b('0x3a')]=_[_0x439b('0x39')](_0x159fe5[_0x439b('0x35')],qs['fields'](_0x123f79['query'][_0x439b('0x3b')]));_0x442161['attributes']=_0x442161[_0x439b('0x3a')][_0x439b('0x3c')]?_0x442161[_0x439b('0x3a')]:_0x159fe5['model'];if(!_0x123f79[_0x439b('0x37')][_0x439b('0x3d')](_0x439b('0x3e'))){_0x442161[_0x439b('0x24')]=qs[_0x439b('0x24')](_0x123f79[_0x439b('0x37')][_0x439b('0x24')]);_0x442161['offset']=qs[_0x439b('0x21')](_0x123f79['query'][_0x439b('0x21')]);}_0x442161['order']=qs[_0x439b('0x3f')](_0x123f79[_0x439b('0x37')][_0x439b('0x3f')]);_0x442161[_0x439b('0x40')]=qs[_0x439b('0x38')](_[_0x439b('0x41')](_0x123f79[_0x439b('0x37')],_0x159fe5[_0x439b('0x38')]),_0x9aa20f);if(_0x123f79[_0x439b('0x37')][_0x439b('0x42')]){_0x442161['where']=_[_0x439b('0x43')](_0x442161[_0x439b('0x40')],{'$or':_[_0x439b('0x36')](_0x9aa20f,function(_0x598a79){if(_0x598a79['type']!==_0x439b('0x44')){var _0x5a910f={};_0x5a910f[_0x598a79['name']]={'$like':'%'+_0x123f79[_0x439b('0x37')][_0x439b('0x42')]+'%'};return _0x5a910f;}})});}_0x442161=_[_0x439b('0x43')]({},_0x442161,_0x123f79['options']);var _0x43d865={'where':_0x442161[_0x439b('0x40')]};return db[_0x439b('0x31')][_0x439b('0x23')](_0x43d865)['then'](function(_0xc1a92f){_0xb02656['count']=_0xc1a92f;if(_0x123f79['query'][_0x439b('0x45')]){_0x442161['include']=[{'all':!![]}];}return db[_0x439b('0x31')][_0x439b('0x46')](_0x442161);})[_0x439b('0x2a')](function(_0x556073){_0xb02656[_0x439b('0x47')]=_0x556073;return _0xb02656;})[_0x439b('0x2a')](respondWithFilteredResult(_0x287a9f,_0x442161))[_0x439b('0x48')](handleError(_0x287a9f,null));};exports[_0x439b('0x49')]=function(_0xd74cac,_0x1ce791){var _0x10cfdd={'raw':!![],'where':{'id':_0xd74cac['params']['id']}},_0x960337={};_0x960337[_0x439b('0x35')]=_[_0x439b('0x4a')](db[_0x439b('0x31')]['rawAttributes']);_0x960337['query']=_[_0x439b('0x4a')](_0xd74cac[_0x439b('0x37')]);_0x960337[_0x439b('0x38')]=_[_0x439b('0x39')](_0x960337[_0x439b('0x35')],_0x960337[_0x439b('0x37')]);_0x10cfdd[_0x439b('0x3a')]=_[_0x439b('0x39')](_0x960337[_0x439b('0x35')],qs[_0x439b('0x3b')](_0xd74cac[_0x439b('0x37')]['fields']));_0x10cfdd['attributes']=_0x10cfdd['attributes'][_0x439b('0x3c')]?_0x10cfdd[_0x439b('0x3a')]:_0x960337[_0x439b('0x35')];if(_0xd74cac[_0x439b('0x37')][_0x439b('0x45')]){_0x10cfdd[_0x439b('0x4b')]=[{'all':!![]}];}_0x10cfdd=_[_0x439b('0x43')]({},_0x10cfdd,_0xd74cac[_0x439b('0x4c')]);return db[_0x439b('0x31')][_0x439b('0x4d')](_0x10cfdd)[_0x439b('0x2a')](handleEntityNotFound(_0x1ce791,null))[_0x439b('0x2a')](respondWithResult(_0x1ce791,null))[_0x439b('0x48')](handleError(_0x1ce791,null));};exports[_0x439b('0x4e')]=function(_0x5e25c8,_0x3651e7,_0x5595c9){return db['Plugin'][_0x439b('0x4d')]({'where':{'id':_0x5e25c8[_0x439b('0x4f')]['id']},'attributes':[_0x439b('0x2f'),_0x439b('0x7')],'raw':!![]})[_0x439b('0x2a')](handleEntityNotFound(_0x3651e7,null))[_0x439b('0x2a')](function(_0x2c386f){if(_0x2c386f){var _0x32e639=path[_0x439b('0x50')](config[_0x439b('0x51')],'server/files/plugins',util[_0x439b('0x52')]('%s.zip',path[_0x439b('0x53')](_0x2c386f['path'])));var _0x3e4c78=fs[_0x439b('0x54')](_0x32e639);var _0x4cc2f7=archiver(_0x439b('0x55'),{'zlib':{'level':0x9}});_0x4cc2f7['on'](_0x439b('0x56'),function(_0x41af31){if(_0x41af31['code']==='ENOENT'){logger['error'](_0x41af31);}else{throw new db['Sequelize']['Error'](_0x439b('0x57'));}});_0x4cc2f7['on']('error',function(_0x2e9d77){throw new db[(_0x439b('0x58'))][(_0x439b('0x59'))](_0x439b('0x57'));});_0x4cc2f7[_0x439b('0x5a')](_0x3e4c78);_0x4cc2f7[_0x439b('0x5b')](_0x439b('0x5c'),{'cwd':path[_0x439b('0x50')](config[_0x439b('0x51')],_0x439b('0x5d'),path[_0x439b('0x5e')](_0x2c386f[_0x439b('0x7')])),'ignore':[path[_0x439b('0x50')](path['basename'](_0x2c386f['path']),'node_modules/**/*'),path['join'](path[_0x439b('0x53')](_0x2c386f['path']),_0x439b('0x5f'))],'nodir':!![]})[_0x439b('0x60')]();_0x3e4c78['on'](_0x439b('0x61'),function(){if(!fs[_0x439b('0x62')](_0x32e639)){throw new db[(_0x439b('0x58'))][(_0x439b('0x59'))](_0x439b('0x63'));}return _0x3651e7['download'](_0x32e639,util['format'](_0x439b('0x64'),path[_0x439b('0x53')](_0x2c386f[_0x439b('0x7')])),function(_0x2fadf7){if(_0x2fadf7){throw new db[(_0x439b('0x58'))]['Error'](_0x439b('0x65'));}fs[_0x439b('0x66')](_0x32e639);logger['info'](_0x439b('0x67'));logger[_0x439b('0x68')](_0x439b('0x69'));});});}return null;})['catch'](handleError(_0x3651e7,null));};exports['upload']=function(_0x8c868,_0x2eec58,_0x3b2dcd){var _0x4deba6=path[_0x439b('0x53')](_0x8c868['file'][_0x439b('0x6a')],path['extname'](_0x8c868[_0x439b('0x6b')][_0x439b('0x6a')]));var _0xd77823=path[_0x439b('0x50')](config[_0x439b('0x51')],_0x439b('0x5d'),_0x8c868[_0x439b('0x6b')]['filename']);var _0x176414=path['join'](config[_0x439b('0x51')],'server/files/plugins',_0x4deba6);logger[_0x439b('0x68')](_0x439b('0x6c'),_0xd77823);logger[_0x439b('0x68')]('Plugin\x20upload\x20destination:\x20%s',_0x176414);try{fs[_0x439b('0x6d')](_0xd77823,parseInt(_0x439b('0x6e'),0x8));extract(_0xd77823,{'dir':_0x176414},function(_0x3884d9){if(_0x3884d9){logger['error'](_0x3884d9);handleError(_0x3884d9,!![]);};var _0x2aaf74=fs[_0x439b('0x6f')](_0x176414);if(_0x2aaf74[_0x439b('0x3c')]>0x1){removeReferences(_0xd77823,_0x176414);logger[_0x439b('0x2d')]('Invalid\x20plugin\x20structure');return _0x3b2dcd(new Error(_0x439b('0x70')));}var _0x1099c3=fs['lstatSync'](path['join'](_0x176414,_0x2aaf74[0x0]));if(_0x1099c3[_0x439b('0x71')]()){removeReferences(_0xd77823,_0x176414);logger[_0x439b('0x2d')](_0x439b('0x70'));return _0x3b2dcd(new Error(_0x439b('0x70')));}if(_0x1099c3[_0x439b('0x72')]()){var _0x44a56d=fs['readdirSync'](path[_0x439b('0x50')](_0x176414,_0x2aaf74[0x0]));if(_0x44a56d[_0x439b('0x3c')]===0x0){removeReferences(_0xd77823,_0x176414);logger[_0x439b('0x2d')](_0x439b('0x70'));return _0x3b2dcd(new Error(_0x439b('0x70')));}var _0x4bf854=_0x44a56d[_0x439b('0x73')](function(_0xe606a9){return _0xe606a9===_0x439b('0x74');});if(!_0x4bf854){return _0x3b2dcd(new Error(_0x439b('0x75')));}var _0x1a0de7=fs[_0x439b('0x76')](path[_0x439b('0x50')](_0x176414,_0x2aaf74[0x0],_0x439b('0x74')));var _0x41cfa4=JSON['parse'](_0x1a0de7);if(_0x439b('0x22')==typeof _0x41cfa4['name']){return _0x3b2dcd(new Error(_0x439b('0x77')));}if('undefined'==typeof _0x41cfa4[_0x439b('0x78')]){return _0x3b2dcd(new Error(_0x439b('0x79')));}if('undefined'==typeof _0x41cfa4[_0x439b('0x7a')]){return _0x3b2dcd(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if(_0x439b('0x22')==typeof _0x41cfa4[_0x439b('0x7b')]){return _0x3b2dcd(new Error(_0x439b('0x7c')));}if(_0x41cfa4['type']===_0x439b('0x7d')){if('undefined'==typeof _0x41cfa4[_0x439b('0x7b')][_0x439b('0x7e')]){return _0x3b2dcd(new Error(_0x439b('0x7f')));}if('undefined'==typeof _0x41cfa4[_0x439b('0x7b')]['views'][_0x439b('0x80')]&&_0x439b('0x22')==typeof _0x41cfa4[_0x439b('0x7b')]['views'][_0x439b('0x81')]){return _0x3b2dcd(new Error(_0x439b('0x82')));}}else if(_0x41cfa4[_0x439b('0x78')]===_0x439b('0x83')){if(_0x439b('0x22')==typeof _0x41cfa4[_0x439b('0x7b')][_0x439b('0x84')]){return _0x3b2dcd(new Error(_0x439b('0x85')));}if(_0x439b('0x22')==typeof _0x41cfa4[_0x439b('0x7b')][_0x439b('0x86')]){return _0x3b2dcd(new Error(_0x439b('0x87')));}}else{return _0x3b2dcd(new Error(_0x439b('0x88')));}var _0x345bae=_0x41cfa4[_0x439b('0x2f')];var _0x3d66e1=_0x41cfa4[_0x439b('0x89')];var _0x765045=_0x41cfa4['type'];var _0x40a011=_0x41cfa4['sidebar']?_0x41cfa4[_0x439b('0x8a')]:_0x439b('0x8b');var _0x57496f=_0x41cfa4[_0x439b('0x8c')]?_0x41cfa4[_0x439b('0x8c')]:'icon-apps';var _0x54b7e9='';var _0x18cdc7='';var _0x262988='';var _0x572c85='';var _0x3966ce=_0x41cfa4[_0x439b('0x7a')];if(_0x765045==='html'){if(_0x439b('0x22')!=typeof _0x41cfa4[_0x439b('0x7b')][_0x439b('0x7e')][_0x439b('0x80')]){var _0x207995=_0x41cfa4[_0x439b('0x7b')]['views'][_0x439b('0x80')];if(!/^(f|ht)tps?:\/\//i['test'](_0x207995)){_0x54b7e9=path[_0x439b('0x50')]('plugins',_0x4deba6,_0x2aaf74[0x0],_0x207995);}else{_0x54b7e9=_0x207995;}}else{logger['info'](_0x439b('0x8d'));}if(_0x439b('0x22')!=typeof _0x41cfa4[_0x439b('0x7b')][_0x439b('0x7e')][_0x439b('0x81')]){var _0x3abdce=_0x41cfa4['parameters']['views'][_0x439b('0x81')];if(!/^(f|ht)tps?:\/\//i['test'](_0x3abdce)){_0x18cdc7=path[_0x439b('0x50')](_0x439b('0x8e'),_0x4deba6,_0x2aaf74[0x0],_0x3abdce);}else{_0x18cdc7=_0x3abdce;}}else{logger['info']('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0x765045===_0x439b('0x83')){_0x262988=_0x41cfa4['parameters'][_0x439b('0x84')];_0x572c85=_0x41cfa4[_0x439b('0x7b')][_0x439b('0x86')];if(_0x439b('0x22')!=typeof _0x41cfa4[_0x439b('0x7b')][_0x439b('0x7e')]){if('undefined'!=typeof _0x41cfa4['parameters'][_0x439b('0x7e')][_0x439b('0x80')]){var _0x207995=_0x41cfa4[_0x439b('0x7b')][_0x439b('0x7e')][_0x439b('0x80')];if(!/^(f|ht)tps?:\/\//i[_0x439b('0x8f')](_0x207995)){_0x54b7e9=path[_0x439b('0x50')](_0x439b('0x8e'),_0x4deba6,_0x2aaf74[0x0],_0x207995);}else{_0x54b7e9=_0x207995;}}if(_0x439b('0x22')!=typeof _0x41cfa4[_0x439b('0x7b')][_0x439b('0x7e')]['agent']){var _0x3abdce=_0x41cfa4[_0x439b('0x7b')][_0x439b('0x7e')][_0x439b('0x81')];if(!/^(f|ht)tps?:\/\//i[_0x439b('0x8f')](_0x3abdce)){_0x18cdc7=path[_0x439b('0x50')](_0x439b('0x8e'),_0x4deba6,_0x2aaf74[0x0],_0x3abdce);}else{_0x18cdc7=_0x3abdce;}}}}var _0x290b07={'name':_0x345bae,'description':_0x3d66e1,'path':path[_0x439b('0x50')](_0x4deba6,_0x2aaf74[0x0]),'type':_0x765045,'sidebar':_0x40a011,'icon':_0x57496f,'adminUrl':_0x54b7e9,'agentUrl':_0x18cdc7,'scriptName':_0x262988,'scriptPath':_0x572c85,'version':_0x3966ce};removeReferences(_0xd77823,null);return db[_0x439b('0x31')][_0x439b('0x90')](_0x290b07)['then'](function(_0x395778){var _0x4e85bc={'role':_0x8c868[_0x439b('0x91')][_0x439b('0x92')],'userProfileId':_0x8c868[_0x439b('0x91')][_0x439b('0x93')]};if(!_0x4e85bc)throw new Error(_0x439b('0x94'));if(_0x4e85bc[_0x439b('0x92')]===_0x439b('0x95')){var _0x5f5603=_0x395778[_0x439b('0x96')]({'plain':!![]});return db['UserProfileSection'][_0x439b('0x4d')]({'where':{'name':'Plugins','userProfileId':_0x4e85bc[_0x439b('0x93')]},'raw':!![]})['then'](function(_0x4e5037){if(_0x4e5037&&_0x4e5037['autoAssociation']===0x0){return db[_0x439b('0x97')][_0x439b('0x90')]({'name':_0x5f5603[_0x439b('0x2f')],'resourceId':_0x5f5603['id'],'type':_0x4e5037[_0x439b('0x2f')],'sectionId':_0x4e5037['id']},{})['then'](function(){return _0x395778;});}else{return _0x395778;}})[_0x439b('0x48')](function(_0x12c309){logger[_0x439b('0x2d')](_0x439b('0x98'),_0x12c309);throw _0x12c309;});}return _0x395778;})['then'](respondWithResult(_0x2eec58,null))['catch'](handleError(_0x2eec58,null));}});}catch(_0x5c29be){_0x2eec58[_0x439b('0x20')](0x1f4)[_0x439b('0x99')](_0x5c29be);}};function removeReferences(_0x1470a8,_0x1bffd4){try{if(_0x1470a8){fs[_0x439b('0x66')](_0x1470a8);logger[_0x439b('0x68')](_0x439b('0x9a'));}if(_0x1bffd4){rimraf(_0x1bffd4,function(){});logger[_0x439b('0x68')](_0x439b('0x9b'));}}catch(_0x21e539){logger[_0x439b('0x2d')](_0x21e539);}}exports[_0x439b('0x9c')]=function(_0x10bed6,_0x589d78,_0x1997d2){return db[_0x439b('0x31')][_0x439b('0x4d')]({'where':{'id':_0x10bed6[_0x439b('0x4f')]['id']}})[_0x439b('0x2a')](handleEntityNotFound(_0x589d78,null))['then'](saveUpdates(_0x10bed6[_0x439b('0x91')],null))[_0x439b('0x2a')](respondWithResult(_0x589d78,null))['catch'](handleError(_0x589d78,null));};exports[_0x439b('0x9d')]=function(_0x2c0202,_0xd71026,_0x1beaf5){return db['Plugin'][_0x439b('0x4d')]({'where':{'id':_0x2c0202[_0x439b('0x4f')]['id']}})['then'](function(_0x57c08a){if(_0x57c08a){return _0x57c08a[_0x439b('0x29')]();}})[_0x439b('0x2a')](function(_0x46c3d7){rimraf(path[_0x439b('0x50')](config[_0x439b('0x51')],_0x439b('0x5d'),path[_0x439b('0x5e')](_0x46c3d7[_0x439b('0x7')])),function(){});return _0x46c3d7;})[_0x439b('0x2a')](handleEntityNotFound(_0xd71026,null))[_0x439b('0x2a')](respondWithStatusCode(_0xd71026,null))[_0x439b('0x48')](handleError(_0xd71026,null));};exports[_0x439b('0x9e')]=function(_0x272270,_0x1bbf9a,_0x1d4594){return BPromise[_0x439b('0x9f')]()[_0x439b('0x2a')](function(){if(!_0x272270[_0x439b('0x37')][_0x439b('0x7')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x272270[_0x439b('0x37')][_0x439b('0xa0')]){throw new Error(_0x439b('0xa1'));}var _0x509af9=_0x272270[_0x439b('0x37')][_0x439b('0xa2')]?_0x272270['query'][_0x439b('0xa2')]+':'+_0x272270[_0x439b('0x37')]['port']:_0x439b('0xa3')+_0x272270[_0x439b('0x37')][_0x439b('0xa0')];var _0x2b7948=_0x272270['query']['json']?_0x272270[_0x439b('0x37')][_0x439b('0xa4')]:!![];var _0x7f3ab8=_0x272270[_0x439b('0x37')][_0x439b('0xa5')]?_0x272270['query'][_0x439b('0xa5')]:null;var _0x432cd0={'method':_0x272270[_0x439b('0xa6')],'uri':util['format'](_0x439b('0xa7'),_0x509af9,_0x272270[_0x439b('0x37')][_0x439b('0x7')]),'json':_0x2b7948,'resolveWithFullResponse':!![],'encoding':_0x7f3ab8,'qs':_0x272270[_0x439b('0x37')]};if(_0x272270[_0x439b('0xa8')]){_0x432cd0['headers']=_0x272270['headers'];if(_0x432cd0[_0x439b('0xa8')]['content-length']){delete _0x432cd0['headers']['content-length'];}}if(_0x432cd0[_0x439b('0xa8')][_0x439b('0xa9')]){delete _0x432cd0[_0x439b('0xa8')][_0x439b('0xa9')];}return rp(_0x432cd0);})[_0x439b('0x2a')](function(_0x28214b){if(_0x28214b){_0x1bbf9a[_0x439b('0x25')](_0x28214b[_0x439b('0xa8')]);logger['info'](_0x28214b[_0x439b('0x91')]);if(_[_0x439b('0xaa')](_0x272270['query']['path'],_0x439b('0x4e'))&&_0x28214b[_0x439b('0xab')]==0x1f4){return _0x1bbf9a[_0x439b('0x2c')](_0x28214b[_0x439b('0xab')]);}else{return _0x1bbf9a[_0x439b('0x20')](_0x28214b[_0x439b('0xab')])[_0x439b('0x99')](_0x28214b[_0x439b('0x91')]);}}else{return _0x1bbf9a['sendStatus'](0xc8);}})[_0x439b('0x48')](handleError(_0x1bbf9a,null));};exports[_0x439b('0xac')]=function(_0x7f9c86,_0x2c54f0,_0x3f636d){return BPromise[_0x439b('0x9f')]()[_0x439b('0x2a')](function(){if(!_0x7f9c86[_0x439b('0x37')][_0x439b('0x7')]){throw new Error(_0x439b('0xad'));}if(!_0x7f9c86[_0x439b('0x37')][_0x439b('0xa0')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x5aca83=_0x7f9c86[_0x439b('0x37')][_0x439b('0xa2')]?_0x7f9c86[_0x439b('0x37')][_0x439b('0xa2')]+':'+_0x7f9c86[_0x439b('0x37')]['port']:'http://localhost:'+_0x7f9c86[_0x439b('0x37')][_0x439b('0xa0')];var _0xca254e=_0x7f9c86[_0x439b('0x37')]['json']?_0x7f9c86[_0x439b('0x37')][_0x439b('0xa4')]:!![];var _0x6091d9=_0x7f9c86[_0x439b('0x37')]['encoding']?_0x7f9c86['query'][_0x439b('0xa5')]:null;var _0x5ae2f9={'method':_0x7f9c86[_0x439b('0xa6')],'uri':util['format']('%s%s',_0x5aca83,_0x7f9c86[_0x439b('0x37')]['path']),'json':_0xca254e,'resolveWithFullResponse':!![],'encoding':_0x6091d9,'body':_0x7f9c86[_0x439b('0x91')]};if(_0x7f9c86[_0x439b('0xa8')]){_0x5ae2f9[_0x439b('0xa8')]=_0x7f9c86[_0x439b('0xa8')];if(_0x5ae2f9[_0x439b('0xa8')][_0x439b('0xae')]){delete _0x5ae2f9[_0x439b('0xa8')][_0x439b('0xae')];}}if(_0x5ae2f9['headers'][_0x439b('0xa9')]){delete _0x5ae2f9['headers'][_0x439b('0xa9')];}return rp(_0x5ae2f9);})[_0x439b('0x2a')](function(_0x28f8f7){if(_0x28f8f7){_0x2c54f0[_0x439b('0x25')](_0x28f8f7[_0x439b('0xa8')]);logger[_0x439b('0x68')](_0x28f8f7[_0x439b('0x91')]);return _0x2c54f0[_0x439b('0x20')](_0x28f8f7[_0x439b('0xab')])[_0x439b('0x99')](_0x28f8f7[_0x439b('0x91')]);}else{return _0x2c54f0['sendStatus'](0xc8);}})[_0x439b('0x48')](handleError(_0x2c54f0,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 289a88a..891f686 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 _0x37cc=['../../mysqldb','Plugin','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events'];(function(_0x2c29f4,_0x3ba791){var _0x35596a=function(_0x53c6bf){while(--_0x53c6bf){_0x2c29f4['push'](_0x2c29f4['shift']());}};_0x35596a(++_0x3ba791);}(_0x37cc,0x185));var _0xc37c=function(_0x22b68a,_0x2bffc3){_0x22b68a=_0x22b68a-0x0;var _0x1ac67a=_0x37cc[_0x22b68a];return _0x1ac67a;};'use strict';var EventEmitter=require(_0xc37c('0x0'));var Plugin=require(_0xc37c('0x1'))['db'][_0xc37c('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0xc37c('0x3')](0x0);var events={'afterCreate':_0xc37c('0x4'),'afterUpdate':_0xc37c('0x5'),'afterDestroy':'remove'};function emitEvent(_0x55b158){return function(_0x334d3c,_0x946e3b,_0x310b02){PluginEvents[_0xc37c('0x6')](_0x55b158+':'+_0x334d3c['id'],_0x334d3c);PluginEvents[_0xc37c('0x6')](_0x55b158,_0x334d3c);_0x310b02(null);};}for(var e in events){if(events[_0xc37c('0x7')](e)){var event=events[e];Plugin[_0xc37c('0x8')](e,emitEvent(event));}}module[_0xc37c('0x9')]=PluginEvents; \ No newline at end of file +var _0x363e=['../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x363e,0x179));var _0xe363=function(_0x577ce5,_0x22755d){_0x577ce5=_0x577ce5-0x0;var _0x971df8=_0x363e[_0x577ce5];return _0x971df8;};'use strict';var EventEmitter=require(_0xe363('0x0'));var Plugin=require(_0xe363('0x1'))['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents[_0xe363('0x2')](0x0);var events={'afterCreate':_0xe363('0x3'),'afterUpdate':_0xe363('0x4'),'afterDestroy':_0xe363('0x5')};function emitEvent(_0x179157){return function(_0x3809ea,_0x6e174a,_0x11775e){PluginEvents[_0xe363('0x6')](_0x179157+':'+_0x3809ea['id'],_0x3809ea);PluginEvents[_0xe363('0x6')](_0x179157,_0x3809ea);_0x11775e(null);};}for(var e in events){if(events[_0xe363('0x7')](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0xe363('0x8')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 948a718..19b9567 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 _0xc393=['plugins','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./plugin.attributes','define','Plugin'];(function(_0x2b9e21,_0x14724c){var _0xe19250=function(_0x26c4b0){while(--_0x26c4b0){_0x2b9e21['push'](_0x2b9e21['shift']());}};_0xe19250(++_0x14724c);}(_0xc393,0xd3));var _0x3c39=function(_0x1e6d9a,_0x548cf2){_0x1e6d9a=_0x1e6d9a-0x0;var _0x59b4da=_0xc393[_0x1e6d9a];return _0x59b4da;};'use strict';var _=require(_0x3c39('0x0'));var util=require(_0x3c39('0x1'));var logger=require(_0x3c39('0x2'))(_0x3c39('0x3'));var moment=require(_0x3c39('0x4'));var BPromise=require(_0x3c39('0x5'));var rp=require(_0x3c39('0x6'));var fs=require('fs');var path=require(_0x3c39('0x7'));var rimraf=require(_0x3c39('0x8'));var config=require(_0x3c39('0x9'));var attributes=require(_0x3c39('0xa'));module['exports']=function(_0x26842f,_0xfd74f3){return _0x26842f[_0x3c39('0xb')](_0x3c39('0xc'),attributes,{'tableName':_0x3c39('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc859=['moment','bluebird','path','rimraf','../../config/environment','exports','define','plugins','lodash','util','../../config/logger'];(function(_0x57f76c,_0xc7eee9){var _0x20a028=function(_0x5e6d6a){while(--_0x5e6d6a){_0x57f76c['push'](_0x57f76c['shift']());}};_0x20a028(++_0xc7eee9);}(_0xc859,0xb8));var _0x9c85=function(_0x28d18d,_0x55896b){_0x28d18d=_0x28d18d-0x0;var _0x470640=_0xc859[_0x28d18d];return _0x470640;};'use strict';var _=require(_0x9c85('0x0'));var util=require(_0x9c85('0x1'));var logger=require(_0x9c85('0x2'))('api');var moment=require(_0x9c85('0x3'));var BPromise=require(_0x9c85('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9c85('0x5'));var rimraf=require(_0x9c85('0x6'));var config=require(_0x9c85('0x7'));var attributes=require('./plugin.attributes');module[_0x9c85('0x8')]=function(_0x445353,_0x4b2b2e){return _0x445353[_0x9c85('0x9')]('Plugin',attributes,{'tableName':_0x9c85('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.rpc.js b/server/api/plugin/plugin.rpc.js index a74e2dc..b4fda6e 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 _0x8c5c=['bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','request','info','Plugin,\x20%s,\x20%s','Plugin,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','CreatePlugin','body','options','then','debug','catch','util'];(function(_0x16b1a5,_0x318267){var _0x475e25=function(_0x2e3bf6){while(--_0x2e3bf6){_0x16b1a5['push'](_0x16b1a5['shift']());}};_0x475e25(++_0x318267);}(_0x8c5c,0x7f));var _0xc8c5=function(_0x16e7ad,_0x66e047){_0x16e7ad=_0x16e7ad-0x0;var _0x184e69=_0x8c5c[_0x16e7ad];return _0x184e69;};'use strict';var _=require('lodash');var util=require(_0xc8c5('0x0'));var moment=require('moment');var BPromise=require(_0xc8c5('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc8c5('0x2'));var db=require(_0xc8c5('0x3'))['db'];var utils=require(_0xc8c5('0x4'));var logger=require('../../config/logger')(_0xc8c5('0x5'));var config=require(_0xc8c5('0x6'));var jayson=require(_0xc8c5('0x7'));var client=jayson[_0xc8c5('0x8')][_0xc8c5('0x9')]({'port':0x232a});config[_0xc8c5('0xa')]=_[_0xc8c5('0xb')](config['redis'],{'host':_0xc8c5('0xc'),'port':0x18eb});var socket=require(_0xc8c5('0xd'))(new Redis(config[_0xc8c5('0xa')]));require(_0xc8c5('0xe'))[_0xc8c5('0xf')](socket);function respondWithRpcPromise(_0x2446b4,_0x3b4534,_0x3aea27){return new BPromise(function(_0xbc58be,_0x59f2c5){return client[_0xc8c5('0x10')](_0x2446b4,_0x3aea27)['then'](function(_0x2b691a){logger[_0xc8c5('0x11')](_0xc8c5('0x12'),_0x3b4534,'request\x20sent');logger['debug'](_0xc8c5('0x13'),_0x3b4534,_0xc8c5('0x14'),JSON[_0xc8c5('0x15')](_0x2b691a));if(_0x2b691a[_0xc8c5('0x16')]){if(_0x2b691a[_0xc8c5('0x16')][_0xc8c5('0x17')]===0x1f4){logger[_0xc8c5('0x16')](_0xc8c5('0x12'),_0x3b4534,_0x2b691a['error'][_0xc8c5('0x18')]);return _0x59f2c5(_0x2b691a['error'][_0xc8c5('0x18')]);}logger[_0xc8c5('0x16')](_0xc8c5('0x12'),_0x3b4534,_0x2b691a[_0xc8c5('0x16')]['message']);return _0xbc58be(_0x2b691a[_0xc8c5('0x16')][_0xc8c5('0x18')]);}else{logger[_0xc8c5('0x11')](_0xc8c5('0x12'),_0x3b4534,_0xc8c5('0x14'));_0xbc58be(_0x2b691a[_0xc8c5('0x19')][_0xc8c5('0x18')]);}})['catch'](function(_0x3d1fb7){logger['error'](_0xc8c5('0x12'),_0x3b4534,_0x3d1fb7);_0x59f2c5(_0x3d1fb7);});});}exports[_0xc8c5('0x1a')]=function(_0x52148d){var _0x2a2d91=this;return new Promise(function(_0x5b9d43,_0x447bee){return db['Plugin']['create'](_0x52148d[_0xc8c5('0x1b')],{'raw':_0x52148d[_0xc8c5('0x1c')]?_0x52148d[_0xc8c5('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0xc8c5('0x1d')](function(_0x597063){logger[_0xc8c5('0x11')](_0xc8c5('0x1a'),_0x52148d);logger[_0xc8c5('0x1e')](_0xc8c5('0x1a'),_0x52148d,JSON[_0xc8c5('0x15')](_0x597063));_0x5b9d43(_0x597063);})[_0xc8c5('0x1f')](function(_0x5b18e0){logger[_0xc8c5('0x16')](_0xc8c5('0x1a'),_0x5b18e0['message'],_0x52148d);_0x447bee(_0x2a2d91[_0xc8c5('0x16')](0x1f4,_0x5b18e0[_0xc8c5('0x18')]));});});}; \ No newline at end of file +var _0x7366=['debug','stringify','error','code','message','result','catch','Plugin','create','body','options','raw','CreatePlugin','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./plugin.socket','register','request','then','info','Plugin,\x20%s,\x20%s','request\x20sent'];(function(_0x5a34d6,_0x56792c){var _0x3a5000=function(_0x27cdd2){while(--_0x27cdd2){_0x5a34d6['push'](_0x5a34d6['shift']());}};_0x3a5000(++_0x56792c);}(_0x7366,0x1c7));var _0x6736=function(_0x2b778d,_0x5dd9e4){_0x2b778d=_0x2b778d-0x0;var _0x46a581=_0x7366[_0x2b778d];return _0x46a581;};'use strict';var _=require('lodash');var util=require(_0x6736('0x0'));var moment=require(_0x6736('0x1'));var BPromise=require(_0x6736('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6736('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x6736('0x4'));var logger=require(_0x6736('0x5'))(_0x6736('0x6'));var config=require(_0x6736('0x7'));var jayson=require(_0x6736('0x8'));var client=jayson[_0x6736('0x9')]['http']({'port':0x232a});config['redis']=_[_0x6736('0xa')](config[_0x6736('0xb')],{'host':_0x6736('0xc'),'port':0x18eb});var socket=require(_0x6736('0xd'))(new Redis(config[_0x6736('0xb')]));require(_0x6736('0xe'))[_0x6736('0xf')](socket);function respondWithRpcPromise(_0x4037e3,_0x424f0a,_0x437e61){return new BPromise(function(_0x379ea8,_0x1aea1f){return client[_0x6736('0x10')](_0x4037e3,_0x437e61)[_0x6736('0x11')](function(_0x4fe9c5){logger[_0x6736('0x12')](_0x6736('0x13'),_0x424f0a,_0x6736('0x14'));logger[_0x6736('0x15')]('Plugin,\x20%s,\x20%s,\x20%s',_0x424f0a,'request\x20sent',JSON[_0x6736('0x16')](_0x4fe9c5));if(_0x4fe9c5[_0x6736('0x17')]){if(_0x4fe9c5[_0x6736('0x17')][_0x6736('0x18')]===0x1f4){logger['error'](_0x6736('0x13'),_0x424f0a,_0x4fe9c5[_0x6736('0x17')][_0x6736('0x19')]);return _0x1aea1f(_0x4fe9c5[_0x6736('0x17')]['message']);}logger[_0x6736('0x17')](_0x6736('0x13'),_0x424f0a,_0x4fe9c5[_0x6736('0x17')][_0x6736('0x19')]);return _0x379ea8(_0x4fe9c5['error']['message']);}else{logger[_0x6736('0x12')](_0x6736('0x13'),_0x424f0a,_0x6736('0x14'));_0x379ea8(_0x4fe9c5[_0x6736('0x1a')][_0x6736('0x19')]);}})[_0x6736('0x1b')](function(_0x5f3d97){logger[_0x6736('0x17')]('Plugin,\x20%s,\x20%s',_0x424f0a,_0x5f3d97);_0x1aea1f(_0x5f3d97);});});}exports['CreatePlugin']=function(_0xaf0a7c){var _0x31010f=this;return new Promise(function(_0x1f6af9,_0xee3b4a){return db[_0x6736('0x1c')][_0x6736('0x1d')](_0xaf0a7c[_0x6736('0x1e')],{'raw':_0xaf0a7c[_0x6736('0x1f')]?_0xaf0a7c[_0x6736('0x1f')][_0x6736('0x20')]===undefined?!![]:![]:!![]})[_0x6736('0x11')](function(_0x326b23){logger[_0x6736('0x12')](_0x6736('0x21'),_0xaf0a7c);logger['debug'](_0x6736('0x21'),_0xaf0a7c,JSON[_0x6736('0x16')](_0x326b23));_0x1f6af9(_0x326b23);})['catch'](function(_0x1a672e){logger['error'](_0x6736('0x21'),_0x1a672e[_0x6736('0x19')],_0xaf0a7c);_0xee3b4a(_0x31010f['error'](0x1f4,_0x1a672e[_0x6736('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 3ce1723..57db92a 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 _0x94e0=['emit','removeListener','register','length','plugin:','./plugin.events','save','remove'];(function(_0x40368e,_0x458699){var _0x4e004e=function(_0x1db306){while(--_0x1db306){_0x40368e['push'](_0x40368e['shift']());}};_0x4e004e(++_0x458699);}(_0x94e0,0xa5));var _0x094e=function(_0x2da8e3,_0x397415){_0x2da8e3=_0x2da8e3-0x0;var _0x281fd5=_0x94e0[_0x2da8e3];return _0x281fd5;};'use strict';var PluginEvents=require(_0x094e('0x0'));var events=[_0x094e('0x1'),_0x094e('0x2'),'update'];function createListener(_0x3e00c8,_0x2edb4a){return function(_0x2acf00){_0x2edb4a[_0x094e('0x3')](_0x3e00c8,_0x2acf00);};}function removeListener(_0x3aa15f,_0x1c09ed){return function(){PluginEvents[_0x094e('0x4')](_0x3aa15f,_0x1c09ed);};}exports[_0x094e('0x5')]=function(_0x336027){for(var _0x46b93a=0x0,_0x17a813=events[_0x094e('0x6')];_0x46b93a<_0x17a813;_0x46b93a++){var _0x4c4a32=events[_0x46b93a];var _0x5ce6d9=createListener(_0x094e('0x7')+_0x4c4a32,_0x336027);PluginEvents['on'](_0x4c4a32,_0x5ce6d9);}}; \ No newline at end of file +var _0xdae6=['register','length','./plugin.events','save','update','emit'];(function(_0x2cf97a,_0x336128){var _0x435f47=function(_0x11c869){while(--_0x11c869){_0x2cf97a['push'](_0x2cf97a['shift']());}};_0x435f47(++_0x336128);}(_0xdae6,0x110));var _0x6dae=function(_0x546703,_0x1941cc){_0x546703=_0x546703-0x0;var _0x865ad8=_0xdae6[_0x546703];return _0x865ad8;};'use strict';var PluginEvents=require(_0x6dae('0x0'));var events=[_0x6dae('0x1'),'remove',_0x6dae('0x2')];function createListener(_0x349f4e,_0x5408f4){return function(_0x38d188){_0x5408f4[_0x6dae('0x3')](_0x349f4e,_0x38d188);};}function removeListener(_0x531b28,_0x452665){return function(){PluginEvents['removeListener'](_0x531b28,_0x452665);};}exports[_0x6dae('0x4')]=function(_0x5c98ca){for(var _0x2e076c=0x0,_0x249375=events[_0x6dae('0x5')];_0x2e076c<_0x249375;_0x2e076c++){var _0x4e1e2a=events[_0x2e076c];var _0x297aeb=createListener('plugin:'+_0x4e1e2a,_0x5c98ca);PluginEvents['on'](_0x4e1e2a,_0x297aeb);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index b103e71..258e7dd 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(_0x16fa08,_0x5b2061){var _0x27a8ca=function(_0x2fcea7){while(--_0x2fcea7){_0x16fa08['push'](_0x16fa08['shift']());}};_0x27a8ca(++_0x5b2061);}(_0xa9e0,0x123));var _0x0a9e=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa9e0[_0x45e98e];return _0x374dba;};'use strict';var express=require(_0x0a9e('0x0'));var router=express[_0x0a9e('0x1')]();var auth=require(_0x0a9e('0x2'));var controller=require('./pm2.controller');router['get']('/',auth[_0x0a9e('0x3')](),controller['index']);router[_0x0a9e('0x4')](_0x0a9e('0x5'),auth[_0x0a9e('0x3')](),controller[_0x0a9e('0x6')]);router[_0x0a9e('0x7')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x8')]);router[_0x0a9e('0x9')](_0x0a9e('0x5'),auth['isAuthenticated'](),controller['update']);router[_0x0a9e('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);module[_0x0a9e('0xc')]=router; \ No newline at end of file +var _0xa9e0=['create','put','delete','destroy','exports','express','Router','../../components/auth/service','isAuthenticated','get','/:id','show','post'];(function(_0x267120,_0x413c07){var _0x54d790=function(_0x1a65d5){while(--_0x1a65d5){_0x267120['push'](_0x267120['shift']());}};_0x54d790(++_0x413c07);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'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 07ddf4c..7028ff2 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 _0x70e0=['dump','Missing\x20name\x20and/or\x20path','update','restart','stop','hasOwnProperty','status','destroy','delete','Unknown\x20id','lodash','../../config/pm2','../../config/logger','child_process','exec','bluebird','json','error','stack','name','send','npm\x20install','info','index','list','reject','motion2','length','then','describe','params','catch','create','body','join','../../files/plugins','script','cwd','chdir','dirname','start'];(function(_0x1b1c4f,_0x32eb9c){var _0x3f02c1=function(_0x180c82){while(--_0x180c82){_0x1b1c4f['push'](_0x1b1c4f['shift']());}};_0x3f02c1(++_0x32eb9c);}(_0x70e0,0x17b));var _0x070e=function(_0x484227,_0x4780ae){_0x484227=_0x484227-0x0;var _0xa19abe=_0x70e0[_0x484227];return _0xa19abe;};'use strict';var _=require(_0x070e('0x0'));var pm2=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('api');var path=require('path');var exec=require(_0x070e('0x3'))[_0x070e('0x4')];var BPromise=require(_0x070e('0x5'));function handleEntityNotFound(_0x2593e5,_0x5c90fc){return function(_0x7bce9b){if(!_0x7bce9b){_0x2593e5['sendStatus'](0x194);;}return _0x7bce9b;};}function respondWithResult(_0x46fe68,_0x4b041d){_0x4b041d=_0x4b041d||0xc8;return function(_0x56e420){if(_0x56e420){return _0x46fe68['status'](_0x4b041d)[_0x070e('0x6')](_0x56e420);}return null;};}function handleError(_0x1e11f0,_0x604664){_0x604664=_0x604664||0x1f4;return function(_0x2611e6){logger[_0x070e('0x7')](_0x2611e6[_0x070e('0x8')]);if(_0x2611e6[_0x070e('0x9')]){delete _0x2611e6['name'];}_0x1e11f0['status'](_0x604664)[_0x070e('0xa')](_0x2611e6);};}function execChildProcess(){return new BPromise(function(_0x2e3e5e,_0x12bb37){exec(_0x070e('0xb'),function(_0xa927a2,_0xffcdd6,_0x25cfe1){logger[_0x070e('0xc')](_0xffcdd6);logger[_0x070e('0xc')](_0x25cfe1);if(_0xa927a2){logger[_0x070e('0x7')](_0xa927a2);return _0x12bb37(_0xa927a2);}return _0x2e3e5e(_0xffcdd6);});});}exports[_0x070e('0xd')]=function(_0x52da3b,_0x5dca0f){return pm2[_0x070e('0xe')]()['then'](function(_0x4a33d2){if(_0x4a33d2){var _0x5bae0f=_[_0x070e('0xf')](_0x4a33d2,function(_0x14c3fd){return _0x14c3fd['name']==='express'||_0x14c3fd[_0x070e('0x9')]===_0x070e('0x10');});return{'rows':_0x5bae0f,'count':_0x5bae0f[_0x070e('0x11')]};}return null;})[_0x070e('0x12')](respondWithResult(_0x5dca0f,null))['catch'](handleError(_0x5dca0f,null));};exports['show']=function(_0x17e2e4,_0x2bd937){return pm2[_0x070e('0x13')](_0x17e2e4[_0x070e('0x14')]['id'])[_0x070e('0x12')](respondWithResult(_0x2bd937,null))['then'](handleEntityNotFound(_0x2bd937,null))[_0x070e('0x15')](handleError(_0x2bd937,null));};exports[_0x070e('0x16')]=function(_0x1ad3de,_0x3ea105){if(_0x1ad3de[_0x070e('0x17')]['name']&&_0x1ad3de['body']['script']){var _0x9907cf=path[_0x070e('0x18')](__dirname,_0x070e('0x19'),_0x1ad3de['body'][_0x070e('0x1a')]);var _0x5dc5d2=process[_0x070e('0x1b')]();process[_0x070e('0x1c')](path[_0x070e('0x1d')](_0x9907cf));return execChildProcess()[_0x070e('0x12')](function(_0x28a1c3){process[_0x070e('0x1c')](_0x5dc5d2);return pm2[_0x070e('0x1e')]({'name':_0x1ad3de[_0x070e('0x17')]['name'],'script':_0x9907cf});})[_0x070e('0x12')](function(_0x270061){pm2[_0x070e('0x1f')]();return _0x270061[0x0];})['then'](respondWithResult(_0x3ea105,0xc9))[_0x070e('0x15')](handleError(_0x3ea105,null));}else{return _0x3ea105['status'](0x1f4)['send']({'message':_0x070e('0x20')});}};exports[_0x070e('0x21')]=function(_0x41deb1,_0x1743cc){if(_0x41deb1[_0x070e('0x17')]['id']){delete _0x41deb1['body']['id'];}var _0x374c54={'online':_0x070e('0x22'),'stopped':_0x070e('0x23')};if(_0x374c54[_0x070e('0x24')](_0x41deb1[_0x070e('0x17')][_0x070e('0x25')])){return pm2[_0x374c54[_0x41deb1[_0x070e('0x17')][_0x070e('0x25')]]](_0x41deb1['params']['id'])[_0x070e('0x12')](respondWithResult(_0x1743cc,0xc8))[_0x070e('0x15')](handleError(_0x1743cc,null));}else{return _0x1743cc[_0x070e('0x25')](0x1f4)['send']({'message':'Unknown\x20status'});}};exports[_0x070e('0x26')]=function(_0x46065c,_0xa6c0ab){if(_0x46065c['body']['id']){delete _0x46065c[_0x070e('0x17')]['id'];}if(_0x46065c[_0x070e('0x14')]['id']){return pm2[_0x070e('0x27')](_0x46065c[_0x070e('0x14')]['id'])['then'](function(_0x5bf522){pm2['dump']();return _0x5bf522[0x0];})['then'](respondWithResult(_0xa6c0ab,null))[_0x070e('0x15')](handleError(_0xa6c0ab,null));}else{return _0xa6c0ab['status'](0x1f4)[_0x070e('0xa')]({'message':_0x070e('0x28')});}}; \ No newline at end of file +var _0x668b=['index','list','then','reject','express','motion2','length','show','describe','create','body','join','../../files/plugins','cwd','dirname','start','dump','catch','restart','stop','params','destroy','delete','Unknown\x20id','lodash','../../config/pm2','api','path','exec','status','json','error','stack','name','send','npm\x20install','info'];(function(_0x5b5862,_0x3e710f){var _0x18966f=function(_0x20ef1d){while(--_0x20ef1d){_0x5b5862['push'](_0x5b5862['shift']());}};_0x18966f(++_0x3e710f);}(_0x668b,0x140));var _0xb668=function(_0x514c15,_0x486901){_0x514c15=_0x514c15-0x0;var _0x16283e=_0x668b[_0x514c15];return _0x16283e;};'use strict';var _=require(_0xb668('0x0'));var pm2=require(_0xb668('0x1'));var logger=require('../../config/logger')(_0xb668('0x2'));var path=require(_0xb668('0x3'));var exec=require('child_process')[_0xb668('0x4')];var BPromise=require('bluebird');function handleEntityNotFound(_0x2fab11,_0x4092a6){return function(_0x2960f5){if(!_0x2960f5){_0x2fab11['sendStatus'](0x194);;}return _0x2960f5;};}function respondWithResult(_0x9b99a8,_0x296fa9){_0x296fa9=_0x296fa9||0xc8;return function(_0x3be92e){if(_0x3be92e){return _0x9b99a8[_0xb668('0x5')](_0x296fa9)[_0xb668('0x6')](_0x3be92e);}return null;};}function handleError(_0x3f01bc,_0x517fc5){_0x517fc5=_0x517fc5||0x1f4;return function(_0x11bb5e){logger[_0xb668('0x7')](_0x11bb5e[_0xb668('0x8')]);if(_0x11bb5e[_0xb668('0x9')]){delete _0x11bb5e[_0xb668('0x9')];}_0x3f01bc[_0xb668('0x5')](_0x517fc5)[_0xb668('0xa')](_0x11bb5e);};}function execChildProcess(){return new BPromise(function(_0x3616e9,_0x567ea9){exec(_0xb668('0xb'),function(_0x27dbf7,_0x27de15,_0x2ea5fc){logger[_0xb668('0xc')](_0x27de15);logger[_0xb668('0xc')](_0x2ea5fc);if(_0x27dbf7){logger[_0xb668('0x7')](_0x27dbf7);return _0x567ea9(_0x27dbf7);}return _0x3616e9(_0x27de15);});});}exports[_0xb668('0xd')]=function(_0x3e5be0,_0x25c5c5){return pm2[_0xb668('0xe')]()[_0xb668('0xf')](function(_0x3aed25){if(_0x3aed25){var _0xd0450f=_[_0xb668('0x10')](_0x3aed25,function(_0x3b0c84){return _0x3b0c84[_0xb668('0x9')]===_0xb668('0x11')||_0x3b0c84[_0xb668('0x9')]===_0xb668('0x12');});return{'rows':_0xd0450f,'count':_0xd0450f[_0xb668('0x13')]};}return null;})[_0xb668('0xf')](respondWithResult(_0x25c5c5,null))['catch'](handleError(_0x25c5c5,null));};exports[_0xb668('0x14')]=function(_0x567ad7,_0x30742a){return pm2[_0xb668('0x15')](_0x567ad7['params']['id'])[_0xb668('0xf')](respondWithResult(_0x30742a,null))[_0xb668('0xf')](handleEntityNotFound(_0x30742a,null))['catch'](handleError(_0x30742a,null));};exports[_0xb668('0x16')]=function(_0x5b31ab,_0x12fb3f){if(_0x5b31ab[_0xb668('0x17')][_0xb668('0x9')]&&_0x5b31ab[_0xb668('0x17')]['script']){var _0x2b7f96=path[_0xb668('0x18')](__dirname,_0xb668('0x19'),_0x5b31ab['body']['script']);var _0x43a70b=process[_0xb668('0x1a')]();process['chdir'](path[_0xb668('0x1b')](_0x2b7f96));return execChildProcess()['then'](function(_0x2f1394){process['chdir'](_0x43a70b);return pm2[_0xb668('0x1c')]({'name':_0x5b31ab[_0xb668('0x17')][_0xb668('0x9')],'script':_0x2b7f96});})[_0xb668('0xf')](function(_0x2a5b3d){pm2[_0xb668('0x1d')]();return _0x2a5b3d[0x0];})['then'](respondWithResult(_0x12fb3f,0xc9))[_0xb668('0x1e')](handleError(_0x12fb3f,null));}else{return _0x12fb3f[_0xb668('0x5')](0x1f4)[_0xb668('0xa')]({'message':'Missing\x20name\x20and/or\x20path'});}};exports['update']=function(_0xe62fce,_0x2a826d){if(_0xe62fce[_0xb668('0x17')]['id']){delete _0xe62fce['body']['id'];}var _0x3a2543={'online':_0xb668('0x1f'),'stopped':_0xb668('0x20')};if(_0x3a2543['hasOwnProperty'](_0xe62fce['body'][_0xb668('0x5')])){return pm2[_0x3a2543[_0xe62fce[_0xb668('0x17')]['status']]](_0xe62fce[_0xb668('0x21')]['id'])[_0xb668('0xf')](respondWithResult(_0x2a826d,0xc8))[_0xb668('0x1e')](handleError(_0x2a826d,null));}else{return _0x2a826d[_0xb668('0x5')](0x1f4)[_0xb668('0xa')]({'message':'Unknown\x20status'});}};exports[_0xb668('0x22')]=function(_0x3bd27c,_0x5dfa2c){if(_0x3bd27c[_0xb668('0x17')]['id']){delete _0x3bd27c['body']['id'];}if(_0x3bd27c[_0xb668('0x21')]['id']){return pm2[_0xb668('0x23')](_0x3bd27c[_0xb668('0x21')]['id'])[_0xb668('0xf')](function(_0x2e40dd){pm2[_0xb668('0x1d')]();return _0x2e40dd[0x0];})[_0xb668('0xf')](respondWithResult(_0x5dfa2c,null))[_0xb668('0x1e')](handleError(_0x5dfa2c,null));}else{return _0x5dfa2c[_0xb668('0x5')](0x1f4)['send']({'message':_0xb668('0x24')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index a9cafa4..2f75c58 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 _0x24b6=['get','/agents','isAuthenticated','getAgents','getQueues','exports','../../components/auth/service','./realtime.controller'];(function(_0x22e231,_0x453380){var _0x3e89f5=function(_0x5141fb){while(--_0x5141fb){_0x22e231['push'](_0x22e231['shift']());}};_0x3e89f5(++_0x453380);}(_0x24b6,0xde));var _0x624b=function(_0x274bcb,_0x2bd5a6){_0x274bcb=_0x274bcb-0x0;var _0x3497c6=_0x24b6[_0x274bcb];return _0x3497c6;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0x624b('0x0'));var controller=require(_0x624b('0x1'));router[_0x624b('0x2')](_0x624b('0x3'),auth[_0x624b('0x4')](),controller[_0x624b('0x5')]);router['get']('/queues',auth[_0x624b('0x4')](),controller[_0x624b('0x6')]);module[_0x624b('0x7')]=router; \ No newline at end of file +var _0x830b=['getAgents','/queues','getQueues','express','Router','../../components/auth/service','./realtime.controller','get','/agents','isAuthenticated'];(function(_0x1cfa0d,_0x4391f2){var _0xe33279=function(_0x3ce7c1){while(--_0x3ce7c1){_0x1cfa0d['push'](_0x1cfa0d['shift']());}};_0xe33279(++_0x4391f2);}(_0x830b,0x175));var _0xb830=function(_0x5f5a99,_0x18f74c){_0x5f5a99=_0x5f5a99-0x0;var _0x5c7bfa=_0x830b[_0x5f5a99];return _0x5c7bfa;};'use strict';var express=require(_0xb830('0x0'));var router=express[_0xb830('0x1')]();var auth=require(_0xb830('0x2'));var controller=require(_0xb830('0x3'));router[_0xb830('0x4')](_0xb830('0x5'),auth[_0xb830('0x6')](),controller[_0xb830('0x7')]);router['get'](_0xb830('0x8'),auth[_0xb830('0x6')](),controller[_0xb830('0x9')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index 6a50f95..bb9f029 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 _0xc03f=['assign','getResources','findAndCountAll','getRealtimeQueues','initializeQueues','lodash','util','../../components/realtime/agents','../../components/realtime/queues','../../mysqldb','../../errors/api','APIBadRequestError','handleError','undefined','count','offset','limit','status','Content-Range','getAgents','getChannels','query','globalQueueFilter','pauseTypeFilter','*pause','resolve','isValidChannel','channel','toLowerCase','sort','includes','globalStatus','validateSortParameter','getUpdatedSortOptions','fields','join','order','then','getAgentIdsByQueues','getRealtimeAgents','getSortedAgentsIdsByStatus','getAgentIdsByStatus','length','User','fieldName','type','key','role','agent','getOptions','raw','sequelize','literal','FIELD(id,','forEach','Pause','push','where','merge','user','Agents','online','extraQueryConditions','UserProfile','rows','map','filterAgentAttributes','getAgentStatus','pause','voiceStatus','talking','Status','sortAgentsByStatus','getRealtimeAgentsQueryFields','pick','catch','format','Channel\x20parameter\x20%s\x20is\x20invalid','startCase','Queue','rawAttributes','name','voice','outbound','dialActive','dialMethod','Queues'];(function(_0xbb38e8,_0x46812b){var _0x5a4c51=function(_0xea1967){while(--_0xea1967){_0xbb38e8['push'](_0xbb38e8['shift']());}};_0x5a4c51(++_0x46812b);}(_0xc03f,0x161));var _0xfc03=function(_0x27af8e,_0x44328b){_0x27af8e=_0x27af8e-0x0;var _0x3d00f8=_0xc03f[_0x27af8e];return _0x3d00f8;};'use strict';var _=require(_0xfc03('0x0'));var util=require(_0xfc03('0x1'));var rta=require(_0xfc03('0x2'));var rtq=require(_0xfc03('0x3'));var qs=require('../../components/parsers/qs');var utils=require('../../config/utils');var db=require(_0xfc03('0x4'))['db'];var APIBadRequestError=require(_0xfc03('0x5'))[_0xfc03('0x6')];var APIHandleError=require(_0xfc03('0x5'))[_0xfc03('0x7')];function respondWithFilteredResult(_0x9faa76,_0x26f221){return function(_0x37727b){if(_0x37727b){var _0x678fd0=typeof _0x26f221['offset']===_0xfc03('0x8')&&typeof _0x26f221['limit']===_0xfc03('0x8');var _0x35d8dc=_0x37727b[_0xfc03('0x9')];var _0x17880d=_0x678fd0?0x0:_0x26f221[_0xfc03('0xa')];var _0x16ba67=_0x678fd0?_0x37727b[_0xfc03('0x9')]:_0x26f221['offset']+_0x26f221[_0xfc03('0xb')];var _0x4e0113;if(_0x16ba67>=_0x35d8dc){_0x16ba67=_0x35d8dc;_0x4e0113=0xc8;}else{_0x4e0113=0xce;}_0x9faa76[_0xfc03('0xc')](_0x4e0113);return _0x9faa76['set'](_0xfc03('0xd'),_0x17880d+'-'+_0x16ba67+'/'+_0x35d8dc)['json'](_0x37727b);}return null;};}exports[_0xfc03('0xe')]=function(_0x35901f,_0x505a4f){var _0x1e616e={'count':0x0,'rows':[]};var _0x5de734={};var _0x205494;var _0x2bc537=utils[_0xfc03('0xf')]();var _0x4a86a0;var _0x1723f7;var _0x51470e=_0x35901f[_0xfc03('0x10')][_0xfc03('0x11')];var _0x298169=_0x35901f[_0xfc03('0x10')]['globalStatusFilter'];var _0xc24dff=_0x35901f['query'][_0xfc03('0x12')];var _0x3fbb27=_0x298169==='pause'||_0x298169===_0xfc03('0x13')?!![]:![];var _0x336c7f=[];var _0x439391;var _0x12ad7d;Promise[_0xfc03('0x14')]()['then'](function(){if(_0x35901f['query']['channel']){if(!utils[_0xfc03('0x15')](_0x35901f[_0xfc03('0x10')][_0xfc03('0x16')])){throw new APIBadRequestError(util['format']('Channel\x20parameter\x20%s\x20is\x20invalid',_0x35901f['query'][_0xfc03('0x16')]));}_0x205494=_0x35901f[_0xfc03('0x10')][_0xfc03('0x16')][_0xfc03('0x17')]();}if(!_0x35901f['query'][_0xfc03('0x18')]||!_0x35901f[_0xfc03('0x10')][_0xfc03('0x18')][_0xfc03('0x19')](_0xfc03('0x1a'))){_0x35901f['query'][_0xfc03('0x18')]=rta[_0xfc03('0x1b')](_0x35901f[_0xfc03('0x10')][_0xfc03('0x18')]);return;}var _0x15e34d=rta[_0xfc03('0x1c')](_0x35901f[_0xfc03('0x10')]['sort']);_0x35901f['query'][_0xfc03('0x18')]=_0x15e34d[_0xfc03('0x1d')][_0xfc03('0x1e')](',');_0x439391=_0x15e34d[_0xfc03('0x1f')];})[_0xfc03('0x20')](function(){if(!_0x51470e){return[];}return rta[_0xfc03('0x21')](_0x51470e,_0x205494);})[_0xfc03('0x20')](function(_0x33bba9){_0x336c7f=_0x33bba9;return rta[_0xfc03('0x22')]();})[_0xfc03('0x20')](function(_0x710453){_0x1723f7=_0x710453['rows'];if((!_0x298169||_0x3fbb27)&&!_0x439391){return _0x336c7f;}if(_0x439391&&!_0x298169){return rta[_0xfc03('0x23')](_0x1723f7,_0x336c7f,_0x439391);}else{return rta[_0xfc03('0x24')](_0x1723f7,_0x336c7f,_0x298169);}})[_0xfc03('0x20')](function(_0x4f9ad6){_0x336c7f=_0x4f9ad6;var _0x53dd42=![];if(_0x336c7f[_0xfc03('0x25')]===0x0){if(_0x51470e||_0x298169){_0x53dd42=!![];}if(_0x3fbb27){_0x53dd42=![];}}if(_0x53dd42){return _0x1e616e;}var _0x1fca25=_['map'](db[_0xfc03('0x26')]['rawAttributes'],function(_0x159da0){return{'name':_0x159da0[_0xfc03('0x27')],'type':_0x159da0[_0xfc03('0x28')][_0xfc03('0x29')]};});_0x35901f['query'][_0xfc03('0x2a')]=_0xfc03('0x2b');_0x5de734=qs[_0xfc03('0x2c')](_0x1fca25,_0x35901f);_0x5de734[_0xfc03('0x2d')]=!![];var _0xfa0cd=[];if(_0x336c7f[_0xfc03('0x25')]>0x0){_0xfa0cd['push']({'id':{'$in':_0x336c7f}});if(_0x439391&&!_0x298169){_0x12ad7d=[db[_0xfc03('0x2e')][_0xfc03('0x2f')](_0xfc03('0x30')+_0x336c7f+')')];_0x5de734[_0xfc03('0x1f')]=_0x12ad7d;}}if(_0x3fbb27){_0x2bc537[_0xfc03('0x31')](function(_0x21833c){var _0x6050b2=!![];if(_0x298169===_0xfc03('0x13')&&_0x205494!==_0x21833c){_0x6050b2=![];}_0xfa0cd['push']({[_0x21833c+_0xfc03('0x32')]:_0x6050b2});});if(_0xc24dff){_0xfa0cd[_0xfc03('0x33')]({'pauseType':_0xc24dff});}}else if(_0x298169){_0x2bc537[_0xfc03('0x31')](function(_0x3f2a0d){_0xfa0cd[_0xfc03('0x33')]({[_0x3f2a0d+_0xfc03('0x32')]:![]});});}_0x5de734[_0xfc03('0x34')]=_[_0xfc03('0x35')](_0x5de734['where'],{'$and':_0xfa0cd});if(_0x35901f[_0xfc03('0x36')][_0xfc03('0x2a')]==='user'){var _0x4a79f5={'params':{'id':_0x35901f['user']['userProfileId']},'query':{'section':_0xfc03('0x37'),'role':_0xfc03('0x2b'),'raw':!![],'ids':_0x336c7f,'customSorting':_0x12ad7d}};if(_0x35901f[_0xfc03('0x10')][_0xfc03('0x38')]){_0x4a79f5[_0xfc03('0x10')][_0xfc03('0x38')]=!![];}if(_0x3fbb27){_0x4a79f5[_0xfc03('0x10')][_0xfc03('0x39')]=_0xfa0cd;}_0x4a79f5[_0xfc03('0x10')]=Object['assign'](_0x4a79f5[_0xfc03('0x10')],_['omit'](_0x35901f[_0xfc03('0x10')],'id'));return db[_0xfc03('0x3a')]['getResources'](_0x4a79f5);}return db[_0xfc03('0x26')]['findAndCountAll'](_0x5de734);})[_0xfc03('0x20')](function(_0x9d3ffb){_0x1e616e[_0xfc03('0x9')]=_0x9d3ffb[_0xfc03('0x9')];_0x4a86a0=_0x9d3ffb[_0xfc03('0x3b')];return _0x4a86a0[_0xfc03('0x3c')](function(_0x2ab7ec){var _0xbe716e=_['find'](_0x1723f7,['id',_0x2ab7ec['id']]);if(_0xbe716e){var _0x139cf7=rta[_0xfc03('0x3d')](_0xbe716e);_[_0xfc03('0x35')](_0x2ab7ec,_0x139cf7);}_0x2ab7ec[_0xfc03('0x1a')]=rta[_0xfc03('0x3e')](_0x2ab7ec);if(_0x2ab7ec[_0xfc03('0x1a')][_0xfc03('0x19')](_0xfc03('0x3f'))){_0x2bc537[_0xfc03('0x31')](function(_0x5e14df){if(_0x2ab7ec[_0x5e14df+_0xfc03('0x32')]){if(_0x5e14df==='voice'){if(_0x2ab7ec[_0xfc03('0x40')]!==_0xfc03('0x41')){_0x2ab7ec[_0xfc03('0x40')]=_0xfc03('0x3f');}}else{_0x2ab7ec[_0x5e14df+_0xfc03('0x42')]=_0xfc03('0x3f');}}});}return _0x2ab7ec;});})['then'](function(_0x46e0d4){if(!_0x439391||_0x12ad7d){return _0x46e0d4;}return rta[_0xfc03('0x43')](_0x46e0d4,_0x439391);})[_0xfc03('0x20')](function(_0x2d7700){var _0x49cfa8=rta[_0xfc03('0x44')]();_0x1e616e[_0xfc03('0x3b')]=_0x2d7700[_0xfc03('0x3c')](function(_0x35ed29){return _[_0xfc03('0x45')](_0x35ed29,_0x49cfa8);});return _0x1e616e;})[_0xfc03('0x20')](respondWithFilteredResult(_0x505a4f,_0x5de734))[_0xfc03('0x46')](APIHandleError(_0x505a4f));};exports['getQueues']=function(_0x4726f8,_0xa8a39b){var _0x259c70={'count':0x0,'rows':[]};var _0x1e641d={};var _0x4999e1;var _0x485265;var _0x294784;Promise[_0xfc03('0x14')]()[_0xfc03('0x20')](function(){if(_0x4726f8[_0xfc03('0x10')][_0xfc03('0x16')]){if(!utils[_0xfc03('0x15')](_0x4726f8[_0xfc03('0x10')][_0xfc03('0x16')])){throw new APIBadRequestError(util[_0xfc03('0x47')](_0xfc03('0x48'),_0x4726f8['query'][_0xfc03('0x16')]));}_0x4999e1=_0x4726f8['query'][_0xfc03('0x16')]['toLowerCase']();}var _0x5aba5c=_[_0xfc03('0x49')](_0x4999e1)+_0xfc03('0x4a');var _0x4616cb=_[_0xfc03('0x3c')](db[_0x5aba5c][_0xfc03('0x4b')],function(_0x51a748){return{'name':_0x51a748[_0xfc03('0x27')],'type':_0x51a748[_0xfc03('0x28')][_0xfc03('0x29')]};});if(!_0x4726f8['query']['fields']){var _0x3ef793=['id',_0xfc03('0x4c')];if(_0x4999e1===_0xfc03('0x4d')){_0x3ef793[_0xfc03('0x33')]('type');if(_0x4726f8[_0xfc03('0x10')]['type']===_0xfc03('0x4e')){_0x3ef793[_0xfc03('0x33')]([_0xfc03('0x4f'),_0xfc03('0x50')]);}}_0x4726f8[_0xfc03('0x10')]['fields']=_0x3ef793[_0xfc03('0x1e')](',');}_0x1e641d=qs[_0xfc03('0x2c')](_0x4616cb,_0x4726f8);if(_0x4726f8[_0xfc03('0x36')][_0xfc03('0x2a')]===_0xfc03('0x36')){var _0x51a464={'params':{'id':_0x4726f8[_0xfc03('0x36')]['userProfileId']},'query':{'section':_0x4999e1===_0xfc03('0x4d')&&_0x4726f8[_0xfc03('0x10')][_0xfc03('0x28')]===_0xfc03('0x4e')?'QueueCampaigns':_[_0xfc03('0x49')](_0x4999e1)+_0xfc03('0x51'),'type':_0x4726f8['query'][_0xfc03('0x28')],'nolimit':!![],'sort':_0xfc03('0x4c'),'filter':_0x4726f8[_0xfc03('0x10')]['filter']}};_0x51a464['query']=Object[_0xfc03('0x52')](_0x51a464[_0xfc03('0x10')],_0x4726f8['query']);delete _0x51a464[_0xfc03('0x10')]['id'];return db[_0xfc03('0x3a')][_0xfc03('0x53')](_0x51a464);}return db[_0x5aba5c][_0xfc03('0x54')](_0x1e641d);})['then'](function(_0x159c4e){_0x259c70[_0xfc03('0x9')]=_0x159c4e[_0xfc03('0x9')];_0x485265=_0x159c4e[_0xfc03('0x3b')];return rtq[_0xfc03('0x55')](_0x4726f8,_0x4999e1);})[_0xfc03('0x20')](function(_0x392b62){_0x294784=_0x392b62[_0xfc03('0x3b')];return rtq[_0xfc03('0x56')](_0x485265,_0x294784,_0x4999e1,_0x4726f8[_0xfc03('0x10')]['type']);})[_0xfc03('0x20')](function(_0x124a23){_0x259c70[_0xfc03('0x3b')]=_0x124a23;return _0x259c70;})[_0xfc03('0x20')](respondWithFilteredResult(_0xa8a39b,_0x1e641d))[_0xfc03('0x46')](APIHandleError(_0xa8a39b));}; \ No newline at end of file +var _0x86fd=['initializeQueues','catch','lodash','../../components/realtime/agents','../../components/realtime/queues','../../components/parsers/qs','../../config/utils','../../mysqldb','../../errors/api','offset','limit','undefined','count','set','Content-Range','json','query','globalQueueFilter','globalStatusFilter','pauseTypeFilter','pause','*pause','resolve','then','channel','format','Channel\x20parameter\x20%s\x20is\x20invalid','sort','includes','globalStatus','fields','order','getAgentIdsByQueues','getRealtimeAgents','getSortedAgentsIdsByStatus','getAgentIdsByStatus','map','User','rawAttributes','key','role','agent','getOptions','raw','sequelize','literal','FIELD(id,','push','Pause','forEach','where','merge','user','userProfileId','online','extraQueryConditions','assign','omit','UserProfile','getResources','findAndCountAll','rows','find','filterAgentAttributes','getAgentStatus','voiceStatus','talking','pick','getQueues','isValidChannel','toLowerCase','startCase','Queue','fieldName','type','name','voice','dialActive','dialMethod','outbound','QueueCampaigns','Queues','filter','getRealtimeQueues'];(function(_0x3ca476,_0x3066a0){var _0x32f811=function(_0x1035e3){while(--_0x1035e3){_0x3ca476['push'](_0x3ca476['shift']());}};_0x32f811(++_0x3066a0);}(_0x86fd,0xaa));var _0xd86f=function(_0x21090b,_0x39dd3b){_0x21090b=_0x21090b-0x0;var _0x3c68d7=_0x86fd[_0x21090b];return _0x3c68d7;};'use strict';var _=require(_0xd86f('0x0'));var util=require('util');var rta=require(_0xd86f('0x1'));var rtq=require(_0xd86f('0x2'));var qs=require(_0xd86f('0x3'));var utils=require(_0xd86f('0x4'));var db=require(_0xd86f('0x5'))['db'];var APIBadRequestError=require(_0xd86f('0x6'))['APIBadRequestError'];var APIHandleError=require(_0xd86f('0x6'))['handleError'];function respondWithFilteredResult(_0x2c1c61,_0x681252){return function(_0x39c20f){if(_0x39c20f){var _0x5eddd5=typeof _0x681252[_0xd86f('0x7')]==='undefined'&&typeof _0x681252[_0xd86f('0x8')]===_0xd86f('0x9');var _0x792917=_0x39c20f['count'];var _0x3ee5f8=_0x5eddd5?0x0:_0x681252[_0xd86f('0x7')];var _0x2857a2=_0x5eddd5?_0x39c20f[_0xd86f('0xa')]:_0x681252[_0xd86f('0x7')]+_0x681252[_0xd86f('0x8')];var _0x2b377c;if(_0x2857a2>=_0x792917){_0x2857a2=_0x792917;_0x2b377c=0xc8;}else{_0x2b377c=0xce;}_0x2c1c61['status'](_0x2b377c);return _0x2c1c61[_0xd86f('0xb')](_0xd86f('0xc'),_0x3ee5f8+'-'+_0x2857a2+'/'+_0x792917)[_0xd86f('0xd')](_0x39c20f);}return null;};}exports['getAgents']=function(_0x3cc48e,_0x307eca){var _0x252d77={'count':0x0,'rows':[]};var _0x3f16b4={};var _0x5a3114;var _0x4b64ea=utils['getChannels']();var _0xaaa2f7;var _0xf91887;var _0x3d4b53=_0x3cc48e[_0xd86f('0xe')][_0xd86f('0xf')];var _0x2f5567=_0x3cc48e['query'][_0xd86f('0x10')];var _0x3297a8=_0x3cc48e[_0xd86f('0xe')][_0xd86f('0x11')];var _0x20f7fd=_0x2f5567===_0xd86f('0x12')||_0x2f5567===_0xd86f('0x13')?!![]:![];var _0x217ed1=[];var _0x2b977a;var _0x5d5881;Promise[_0xd86f('0x14')]()[_0xd86f('0x15')](function(){if(_0x3cc48e['query'][_0xd86f('0x16')]){if(!utils['isValidChannel'](_0x3cc48e[_0xd86f('0xe')][_0xd86f('0x16')])){throw new APIBadRequestError(util[_0xd86f('0x17')](_0xd86f('0x18'),_0x3cc48e[_0xd86f('0xe')][_0xd86f('0x16')]));}_0x5a3114=_0x3cc48e[_0xd86f('0xe')][_0xd86f('0x16')]['toLowerCase']();}if(!_0x3cc48e[_0xd86f('0xe')][_0xd86f('0x19')]||!_0x3cc48e[_0xd86f('0xe')][_0xd86f('0x19')][_0xd86f('0x1a')](_0xd86f('0x1b'))){_0x3cc48e[_0xd86f('0xe')][_0xd86f('0x19')]=rta['validateSortParameter'](_0x3cc48e[_0xd86f('0xe')][_0xd86f('0x19')]);return;}var _0x2329e5=rta['getUpdatedSortOptions'](_0x3cc48e[_0xd86f('0xe')][_0xd86f('0x19')]);_0x3cc48e[_0xd86f('0xe')][_0xd86f('0x19')]=_0x2329e5[_0xd86f('0x1c')]['join'](',');_0x2b977a=_0x2329e5[_0xd86f('0x1d')];})[_0xd86f('0x15')](function(){if(!_0x3d4b53){return[];}return rta[_0xd86f('0x1e')](_0x3d4b53,_0x5a3114);})[_0xd86f('0x15')](function(_0x2cabe9){_0x217ed1=_0x2cabe9;return rta[_0xd86f('0x1f')]();})[_0xd86f('0x15')](function(_0x425823){_0xf91887=_0x425823['rows'];if((!_0x2f5567||_0x20f7fd)&&!_0x2b977a){return _0x217ed1;}if(_0x2b977a&&!_0x2f5567){return rta[_0xd86f('0x20')](_0xf91887,_0x217ed1,_0x2b977a);}else{return rta[_0xd86f('0x21')](_0xf91887,_0x217ed1,_0x2f5567);}})[_0xd86f('0x15')](function(_0x3e3489){_0x217ed1=_0x3e3489;var _0x3a8302=![];if(_0x217ed1['length']===0x0){if(_0x3d4b53||_0x2f5567){_0x3a8302=!![];}if(_0x20f7fd){_0x3a8302=![];}}if(_0x3a8302){return _0x252d77;}var _0x389d7f=_[_0xd86f('0x22')](db[_0xd86f('0x23')][_0xd86f('0x24')],function(_0x131d75){return{'name':_0x131d75['fieldName'],'type':_0x131d75['type'][_0xd86f('0x25')]};});_0x3cc48e['query'][_0xd86f('0x26')]=_0xd86f('0x27');_0x3f16b4=qs[_0xd86f('0x28')](_0x389d7f,_0x3cc48e);_0x3f16b4[_0xd86f('0x29')]=!![];var _0x154b5f=[];if(_0x217ed1['length']>0x0){_0x154b5f['push']({'id':{'$in':_0x217ed1}});if(_0x2b977a&&!_0x2f5567){_0x5d5881=[db[_0xd86f('0x2a')][_0xd86f('0x2b')](_0xd86f('0x2c')+_0x217ed1+')')];_0x3f16b4[_0xd86f('0x1d')]=_0x5d5881;}}if(_0x20f7fd){_0x4b64ea['forEach'](function(_0x3bb489){var _0x1139ec=!![];if(_0x2f5567===_0xd86f('0x13')&&_0x5a3114!==_0x3bb489){_0x1139ec=![];}_0x154b5f[_0xd86f('0x2d')]({[_0x3bb489+_0xd86f('0x2e')]:_0x1139ec});});if(_0x3297a8){_0x154b5f[_0xd86f('0x2d')]({'pauseType':_0x3297a8});}}else if(_0x2f5567){_0x4b64ea[_0xd86f('0x2f')](function(_0x5e088c){_0x154b5f[_0xd86f('0x2d')]({[_0x5e088c+_0xd86f('0x2e')]:![]});});}_0x3f16b4[_0xd86f('0x30')]=_[_0xd86f('0x31')](_0x3f16b4['where'],{'$and':_0x154b5f});if(_0x3cc48e[_0xd86f('0x32')][_0xd86f('0x26')]===_0xd86f('0x32')){var _0x2751d3={'params':{'id':_0x3cc48e[_0xd86f('0x32')][_0xd86f('0x33')]},'query':{'section':'Agents','role':'agent','raw':!![],'ids':_0x217ed1,'customSorting':_0x5d5881}};if(_0x3cc48e[_0xd86f('0xe')][_0xd86f('0x34')]){_0x2751d3[_0xd86f('0xe')]['online']=!![];}if(_0x20f7fd){_0x2751d3[_0xd86f('0xe')][_0xd86f('0x35')]=_0x154b5f;}_0x2751d3[_0xd86f('0xe')]=Object[_0xd86f('0x36')](_0x2751d3[_0xd86f('0xe')],_[_0xd86f('0x37')](_0x3cc48e[_0xd86f('0xe')],'id'));return db[_0xd86f('0x38')][_0xd86f('0x39')](_0x2751d3);}return db['User'][_0xd86f('0x3a')](_0x3f16b4);})[_0xd86f('0x15')](function(_0x2c7ea1){_0x252d77[_0xd86f('0xa')]=_0x2c7ea1[_0xd86f('0xa')];_0xaaa2f7=_0x2c7ea1[_0xd86f('0x3b')];return _0xaaa2f7[_0xd86f('0x22')](function(_0xb47261){var _0x112686=_[_0xd86f('0x3c')](_0xf91887,['id',_0xb47261['id']]);if(_0x112686){var _0x4d45d0=rta[_0xd86f('0x3d')](_0x112686);_[_0xd86f('0x31')](_0xb47261,_0x4d45d0);}_0xb47261[_0xd86f('0x1b')]=rta[_0xd86f('0x3e')](_0xb47261);if(_0xb47261[_0xd86f('0x1b')][_0xd86f('0x1a')](_0xd86f('0x12'))){_0x4b64ea[_0xd86f('0x2f')](function(_0x5a8986){if(_0xb47261[_0x5a8986+'Pause']){if(_0x5a8986==='voice'){if(_0xb47261[_0xd86f('0x3f')]!==_0xd86f('0x40')){_0xb47261[_0xd86f('0x3f')]='pause';}}else{_0xb47261[_0x5a8986+'Status']=_0xd86f('0x12');}}});}return _0xb47261;});})[_0xd86f('0x15')](function(_0xfe2c70){if(!_0x2b977a||_0x5d5881){return _0xfe2c70;}return rta['sortAgentsByStatus'](_0xfe2c70,_0x2b977a);})[_0xd86f('0x15')](function(_0x76ae16){var _0x1a5a08=rta['getRealtimeAgentsQueryFields']();_0x252d77[_0xd86f('0x3b')]=_0x76ae16[_0xd86f('0x22')](function(_0x527f34){return _[_0xd86f('0x41')](_0x527f34,_0x1a5a08);});return _0x252d77;})['then'](respondWithFilteredResult(_0x307eca,_0x3f16b4))['catch'](APIHandleError(_0x307eca));};exports[_0xd86f('0x42')]=function(_0xf098e9,_0x3624f1){var _0x4275aa={'count':0x0,'rows':[]};var _0x3773d8={};var _0x1d12ef;var _0x4417d9;var _0x4671b3;Promise[_0xd86f('0x14')]()[_0xd86f('0x15')](function(){if(_0xf098e9[_0xd86f('0xe')][_0xd86f('0x16')]){if(!utils[_0xd86f('0x43')](_0xf098e9[_0xd86f('0xe')][_0xd86f('0x16')])){throw new APIBadRequestError(util[_0xd86f('0x17')](_0xd86f('0x18'),_0xf098e9[_0xd86f('0xe')]['channel']));}_0x1d12ef=_0xf098e9[_0xd86f('0xe')][_0xd86f('0x16')][_0xd86f('0x44')]();}var _0x1be5fc=_[_0xd86f('0x45')](_0x1d12ef)+_0xd86f('0x46');var _0x372ee9=_[_0xd86f('0x22')](db[_0x1be5fc][_0xd86f('0x24')],function(_0x516994){return{'name':_0x516994[_0xd86f('0x47')],'type':_0x516994[_0xd86f('0x48')]['key']};});if(!_0xf098e9['query'][_0xd86f('0x1c')]){var _0x116c9a=['id',_0xd86f('0x49')];if(_0x1d12ef===_0xd86f('0x4a')){_0x116c9a[_0xd86f('0x2d')](_0xd86f('0x48'));if(_0xf098e9['query'][_0xd86f('0x48')]==='outbound'){_0x116c9a[_0xd86f('0x2d')]([_0xd86f('0x4b'),_0xd86f('0x4c')]);}}_0xf098e9[_0xd86f('0xe')][_0xd86f('0x1c')]=_0x116c9a['join'](',');}_0x3773d8=qs['getOptions'](_0x372ee9,_0xf098e9);if(_0xf098e9[_0xd86f('0x32')][_0xd86f('0x26')]===_0xd86f('0x32')){var _0x10706c={'params':{'id':_0xf098e9[_0xd86f('0x32')][_0xd86f('0x33')]},'query':{'section':_0x1d12ef===_0xd86f('0x4a')&&_0xf098e9[_0xd86f('0xe')]['type']===_0xd86f('0x4d')?_0xd86f('0x4e'):_[_0xd86f('0x45')](_0x1d12ef)+_0xd86f('0x4f'),'type':_0xf098e9[_0xd86f('0xe')]['type'],'nolimit':!![],'sort':_0xd86f('0x49'),'filter':_0xf098e9[_0xd86f('0xe')][_0xd86f('0x50')]}};_0x10706c['query']=Object['assign'](_0x10706c['query'],_0xf098e9[_0xd86f('0xe')]);delete _0x10706c[_0xd86f('0xe')]['id'];return db[_0xd86f('0x38')]['getResources'](_0x10706c);}return db[_0x1be5fc][_0xd86f('0x3a')](_0x3773d8);})[_0xd86f('0x15')](function(_0x53910a){_0x4275aa[_0xd86f('0xa')]=_0x53910a[_0xd86f('0xa')];_0x4417d9=_0x53910a['rows'];return rtq[_0xd86f('0x51')](_0xf098e9,_0x1d12ef);})[_0xd86f('0x15')](function(_0xa2a85a){_0x4671b3=_0xa2a85a[_0xd86f('0x3b')];return rtq[_0xd86f('0x52')](_0x4417d9,_0x4671b3,_0x1d12ef,_0xf098e9[_0xd86f('0xe')][_0xd86f('0x48')]);})['then'](function(_0x490f41){_0x4275aa[_0xd86f('0x3b')]=_0x490f41;return _0x4275aa;})[_0xd86f('0x15')](respondWithFilteredResult(_0x3624f1,_0x3773d8))[_0xd86f('0x53')](APIHandleError(_0x3624f1));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index cb908af..a1a353a 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x237587,_0x5ca4cb){var _0x1ae730=function(_0x1d471e){while(--_0x1d471e){_0x237587['push'](_0x237587['shift']());}};_0x1ae730(++_0x5ca4cb);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x3ed5fb,_0x1be775){var _0x4327c2=function(_0x2d5f2b){while(--_0x2d5f2b){_0x3ed5fb['push'](_0x3ed5fb['shift']());}};_0x4327c2(++_0x1be775);}(_0x70e0,0x17b));var _0x070e=function(_0x359970,_0x4618eb){_0x359970=_0x359970-0x0;var _0xf32d92=_0x70e0[_0x359970];return _0xf32d92;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 2a9f087..86dfb5e 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 _0x44ff=['STRING','exports','INTEGER'];(function(_0x765cc9,_0x90fa0d){var _0x5450a1=function(_0x2b2daa){while(--_0x2b2daa){_0x765cc9['push'](_0x765cc9['shift']());}};_0x5450a1(++_0x90fa0d);}(_0x44ff,0x1c3));var _0xf44f=function(_0x3922d8,_0x24f376){_0x3922d8=_0x3922d8-0x0;var _0x21038e=_0x44ff[_0x3922d8];return _0x21038e;};'use strict';var Sequelize=require('sequelize');module[_0xf44f('0x0')]={'state':{'type':Sequelize[_0xf44f('0x1')](0x2)},'statedesc':{'type':Sequelize[_0xf44f('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0xf44f('0x1')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xf44f('0x2')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x7923=['INTEGER','STRING','DATE','sequelize','exports'];(function(_0x3dadaa,_0x79d509){var _0x339ad4=function(_0x26e100){while(--_0x26e100){_0x3dadaa['push'](_0x3dadaa['shift']());}};_0x339ad4(++_0x79d509);}(_0x7923,0x8f));var _0x3792=function(_0x4ed16c,_0x4ead33){_0x4ed16c=_0x4ed16c-0x0;var _0x5b0af5=_0x7923[_0x4ed16c];return _0x5b0af5;};'use strict';var Sequelize=require(_0x3792('0x0'));module[_0x3792('0x1')]={'state':{'type':Sequelize[_0x3792('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x3792('0x3')]},'scheduledat':{'type':Sequelize[_0x3792('0x4')]},'uniqueid':{'type':Sequelize[_0x3792('0x3')]},'starttime':{'type':Sequelize[_0x3792('0x4')]},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x3792('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x3792('0x3')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index def9359..6db4874 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 _0x1412=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./reportAgentPreview.attributes','define','ReportAgentPreview','report_agent_preview'];(function(_0x1eefe6,_0x415de6){var _0x49295b=function(_0x383fb3){while(--_0x383fb3){_0x1eefe6['push'](_0x1eefe6['shift']());}};_0x49295b(++_0x415de6);}(_0x1412,0x8f));var _0x2141=function(_0x5a4f25,_0x2bc735){_0x5a4f25=_0x5a4f25-0x0;var _0x207dd7=_0x1412[_0x5a4f25];return _0x207dd7;};'use strict';var _=require(_0x2141('0x0'));var util=require('util');var logger=require(_0x2141('0x1'))(_0x2141('0x2'));var moment=require(_0x2141('0x3'));var BPromise=require(_0x2141('0x4'));var rp=require(_0x2141('0x5'));var fs=require('fs');var path=require(_0x2141('0x6'));var rimraf=require(_0x2141('0x7'));var config=require(_0x2141('0x8'));var attributes=require(_0x2141('0x9'));module['exports']=function(_0x33fb65,_0x53815a){return _0x33fb65[_0x2141('0xa')](_0x2141('0xb'),attributes,{'tableName':_0x2141('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x52f2=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./reportAgentPreview.attributes','define','ReportAgentPreview','report_agent_preview','lodash','util'];(function(_0x3aef0f,_0x513c63){var _0x1ed516=function(_0x567588){while(--_0x567588){_0x3aef0f['push'](_0x3aef0f['shift']());}};_0x1ed516(++_0x513c63);}(_0x52f2,0x11c));var _0x252f=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0x52f2[_0x54d4fe];return _0x1ab5bb;};'use strict';var _=require(_0x252f('0x0'));var util=require(_0x252f('0x1'));var logger=require(_0x252f('0x2'))(_0x252f('0x3'));var moment=require(_0x252f('0x4'));var BPromise=require(_0x252f('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x252f('0x6'));var rimraf=require(_0x252f('0x7'));var config=require(_0x252f('0x8'));var attributes=require(_0x252f('0x9'));module['exports']=function(_0x5419eb,_0x2f7fde){return _0x5419eb[_0x252f('0xa')](_0x252f('0xb'),attributes,{'tableName':_0x252f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.rpc.js b/server/api/reportAgentPreview/reportAgentPreview.rpc.js index afb9231..c159429 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 _0xd324=['util','moment','randomstring','ioredis','../../config/logger','../../config/environment','http','request','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','error','code','message','catch','ReportAgentPreview','create','body','options','then','CreateReportAgentPreview','lodash'];(function(_0x4ac761,_0x228735){var _0x4de38d=function(_0x430d65){while(--_0x430d65){_0x4ac761['push'](_0x4ac761['shift']());}};_0x4de38d(++_0x228735);}(_0xd324,0x137));var _0x4d32=function(_0x4ef734,_0x5826d){_0x4ef734=_0x4ef734-0x0;var _0x33a7cb=_0xd324[_0x4ef734];return _0x33a7cb;};'use strict';var _=require(_0x4d32('0x0'));var util=require(_0x4d32('0x1'));var moment=require(_0x4d32('0x2'));var BPromise=require('bluebird');var rs=require(_0x4d32('0x3'));var fs=require('fs');var Redis=require(_0x4d32('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4d32('0x5'))('rpc');var config=require(_0x4d32('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x4d32('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x280bce,_0x313b41,_0x4fe7cb){return new BPromise(function(_0x4b0cd3,_0x215ca5){return client[_0x4d32('0x8')](_0x280bce,_0x4fe7cb)['then'](function(_0x2cd8b6){logger[_0x4d32('0x9')](_0x4d32('0xa'),_0x313b41,_0x4d32('0xb'));logger[_0x4d32('0xc')](_0x4d32('0xd'),_0x313b41,'request\x20sent',JSON['stringify'](_0x2cd8b6));if(_0x2cd8b6[_0x4d32('0xe')]){if(_0x2cd8b6['error'][_0x4d32('0xf')]===0x1f4){logger[_0x4d32('0xe')](_0x4d32('0xa'),_0x313b41,_0x2cd8b6[_0x4d32('0xe')][_0x4d32('0x10')]);return _0x215ca5(_0x2cd8b6[_0x4d32('0xe')]['message']);}logger[_0x4d32('0xe')]('ReportAgentPreview,\x20%s,\x20%s',_0x313b41,_0x2cd8b6[_0x4d32('0xe')][_0x4d32('0x10')]);return _0x4b0cd3(_0x2cd8b6['error'][_0x4d32('0x10')]);}else{logger[_0x4d32('0x9')]('ReportAgentPreview,\x20%s,\x20%s',_0x313b41,_0x4d32('0xb'));_0x4b0cd3(_0x2cd8b6['result'][_0x4d32('0x10')]);}})[_0x4d32('0x11')](function(_0x294768){logger[_0x4d32('0xe')](_0x4d32('0xa'),_0x313b41,_0x294768);_0x215ca5(_0x294768);});});}exports['CreateReportAgentPreview']=function(_0x55a535){var _0x3c763f=this;return new Promise(function(_0x163f3b,_0x2832c7){return db[_0x4d32('0x12')][_0x4d32('0x13')](_0x55a535[_0x4d32('0x14')],{'raw':_0x55a535['options']?_0x55a535[_0x4d32('0x15')]['raw']===undefined?!![]:![]:!![]})[_0x4d32('0x16')](function(_0x309802){logger[_0x4d32('0x9')](_0x4d32('0x17'),_0x55a535);logger[_0x4d32('0xc')]('CreateReportAgentPreview',_0x55a535,JSON['stringify'](_0x309802));_0x163f3b(_0x309802);})[_0x4d32('0x11')](function(_0x10d1cd){logger['error']('CreateReportAgentPreview',_0x10d1cd['message'],_0x55a535);_0x2832c7(_0x3c763f[_0x4d32('0xe')](0x1f4,_0x10d1cd[_0x4d32('0x10')]));});});}; \ No newline at end of file +var _0x701b=['catch','ReportAgentPreview','body','options','raw','then','CreateReportAgentPreview','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x701b,0x16f));var _0xb701=function(_0x356ff1,_0x13194a){_0x356ff1=_0x356ff1-0x0;var _0x19a90a=_0x701b[_0x356ff1];return _0x19a90a;};'use strict';var _=require(_0xb701('0x0'));var util=require(_0xb701('0x1'));var moment=require(_0xb701('0x2'));var BPromise=require(_0xb701('0x3'));var rs=require(_0xb701('0x4'));var fs=require('fs');var Redis=require(_0xb701('0x5'));var db=require(_0xb701('0x6'))['db'];var utils=require(_0xb701('0x7'));var logger=require(_0xb701('0x8'))(_0xb701('0x9'));var config=require(_0xb701('0xa'));var jayson=require(_0xb701('0xb'));var client=jayson[_0xb701('0xc')][_0xb701('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x23cf96,_0x5ec158,_0x14fec2){return new BPromise(function(_0x3bd424,_0x4c179f){return client[_0xb701('0xe')](_0x23cf96,_0x14fec2)['then'](function(_0x394c5e){logger[_0xb701('0xf')](_0xb701('0x10'),_0x5ec158,_0xb701('0x11'));logger['debug'](_0xb701('0x12'),_0x5ec158,_0xb701('0x11'),JSON[_0xb701('0x13')](_0x394c5e));if(_0x394c5e['error']){if(_0x394c5e[_0xb701('0x14')][_0xb701('0x15')]===0x1f4){logger[_0xb701('0x14')](_0xb701('0x10'),_0x5ec158,_0x394c5e[_0xb701('0x14')]['message']);return _0x4c179f(_0x394c5e[_0xb701('0x14')][_0xb701('0x16')]);}logger[_0xb701('0x14')](_0xb701('0x10'),_0x5ec158,_0x394c5e[_0xb701('0x14')][_0xb701('0x16')]);return _0x3bd424(_0x394c5e[_0xb701('0x14')]['message']);}else{logger['info'](_0xb701('0x10'),_0x5ec158,_0xb701('0x11'));_0x3bd424(_0x394c5e['result'][_0xb701('0x16')]);}})[_0xb701('0x17')](function(_0x5d1992){logger['error'](_0xb701('0x10'),_0x5ec158,_0x5d1992);_0x4c179f(_0x5d1992);});});}exports['CreateReportAgentPreview']=function(_0x183b13){var _0x22d1d9=this;return new Promise(function(_0x44933b,_0x2b6c19){return db[_0xb701('0x18')]['create'](_0x183b13[_0xb701('0x19')],{'raw':_0x183b13[_0xb701('0x1a')]?_0x183b13[_0xb701('0x1a')][_0xb701('0x1b')]===undefined?!![]:![]:!![]})[_0xb701('0x1c')](function(_0x1d902e){logger[_0xb701('0xf')](_0xb701('0x1d'),_0x183b13);logger['debug'](_0xb701('0x1d'),_0x183b13,JSON[_0xb701('0x13')](_0x1d902e));_0x44933b(_0x1d902e);})[_0xb701('0x17')](function(_0x22cddc){logger['error']('CreateReportAgentPreview',_0x22cddc[_0xb701('0x16')],_0x183b13);_0x2b6c19(_0x22d1d9['error'](0x1f4,_0x22cddc[_0xb701('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 59f68e8..51080e3 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 _0x234c=['showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','agentNotify','exports','multer','util','express','Router','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','/voice/queues','voiceQueues','chatQueues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','smsQueues','/whatsapp/queues','/fax/queues','faxQueues','voiceQueuesPreview','voiceQueuesChannels','/voice/queues/channels/:uniqueid','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','/voice/queues/:id','showVoiceQueues','put','outbound','/outbound/channels','outboundChannels','agents','/agents/:id/capacity','agentCapacity','/telephones','telephones','/trunks','trunks','/campaigns','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','/openchannel/queues/waitinginteractions','/openchannel/queues/:id/waitinginteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','queueNotify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','post','/fax/queues/:id/notify','fax','/fax/queues/:id','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','/sms/queues/:id/notify','/sms/queues/:id'];(function(_0x4a9801,_0x548afb){var _0x2b089a=function(_0x4b4074){while(--_0x4b4074){_0x4a9801['push'](_0x4a9801['shift']());}};_0x2b089a(++_0x548afb);}(_0x234c,0x9b));var _0xc234=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x234c[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xc234('0x0'));var util=require(_0xc234('0x1'));var path=require('path');var express=require(_0xc234('0x2'));var router=express[_0xc234('0x3')]();var auth=require('../../components/auth/service');var controller=require(_0xc234('0x4'));router[_0xc234('0x5')](_0xc234('0x6'),auth[_0xc234('0x7')](),controller[_0xc234('0x8')]);router[_0xc234('0x5')](_0xc234('0x9'),auth['isAuthenticated'](),controller[_0xc234('0xa')]);router['get'](_0xc234('0xb'),auth[_0xc234('0x7')](),controller['voiceChannelStopMixMonitor']);router[_0xc234('0x5')](_0xc234('0xc'),auth['isAuthenticated'](),controller[_0xc234('0xd')]);router[_0xc234('0x5')]('/chat/queues',auth[_0xc234('0x7')](),controller[_0xc234('0xe')]);router[_0xc234('0x5')](_0xc234('0xf'),auth[_0xc234('0x7')](),controller[_0xc234('0x10')]);router[_0xc234('0x5')](_0xc234('0x11'),auth[_0xc234('0x7')](),controller[_0xc234('0x12')]);router[_0xc234('0x5')](_0xc234('0x13'),auth[_0xc234('0x7')](),controller[_0xc234('0x14')]);router[_0xc234('0x5')]('/sms/queues',auth[_0xc234('0x7')](),controller[_0xc234('0x15')]);router['get'](_0xc234('0x16'),auth[_0xc234('0x7')](),controller['whatsappQueues']);router[_0xc234('0x5')](_0xc234('0x17'),auth['isAuthenticated'](),controller[_0xc234('0x18')]);router[_0xc234('0x5')]('/voice/queues/preview/:id',auth[_0xc234('0x7')](),controller[_0xc234('0x19')]);router[_0xc234('0x5')]('/voice/queues/channels',auth[_0xc234('0x7')](),controller[_0xc234('0x1a')]);router[_0xc234('0x5')](_0xc234('0x1b'),auth[_0xc234('0x7')](),controller['voiceQueuesChannel']);router[_0xc234('0x5')](_0xc234('0x1c'),auth['isAuthenticated'](),controller[_0xc234('0x1d')]);router[_0xc234('0x5')](_0xc234('0x1e'),auth[_0xc234('0x7')](),controller['voiceQueuesChannelRedirect']);router['get'](_0xc234('0x1f'),auth[_0xc234('0x7')](),controller[_0xc234('0x20')]);router[_0xc234('0x21')]('/voice/queues/:id',auth['isAuthenticated'](),controller['updateVoiceQueue']);router[_0xc234('0x5')]('/outbound',auth[_0xc234('0x7')](),controller[_0xc234('0x22')]);router[_0xc234('0x5')](_0xc234('0x23'),auth[_0xc234('0x7')](),controller[_0xc234('0x24')]);router[_0xc234('0x5')]('/agents',auth[_0xc234('0x7')](),controller[_0xc234('0x25')]);router[_0xc234('0x21')](_0xc234('0x26'),auth[_0xc234('0x7')](),controller[_0xc234('0x27')]);router['get'](_0xc234('0x28'),auth[_0xc234('0x7')](),controller[_0xc234('0x29')]);router[_0xc234('0x5')](_0xc234('0x2a'),auth[_0xc234('0x7')](),controller[_0xc234('0x2b')]);router[_0xc234('0x5')](_0xc234('0x2c'),auth['isAuthenticated'](),controller['campaigns']);router['get']('/fax/accounts',auth[_0xc234('0x7')](),controller['faxAccounts']);router['get'](_0xc234('0x2d'),auth[_0xc234('0x7')](),controller[_0xc234('0x2e')]);router['get'](_0xc234('0x2f'),auth[_0xc234('0x7')](),controller['mailQueuesWaitingInteractions']);router[_0xc234('0x5')](_0xc234('0x30'),auth[_0xc234('0x7')](),controller['openchannelQueuesWaitingInteractions']);router[_0xc234('0x5')](_0xc234('0x31'),auth[_0xc234('0x7')](),controller['openchannelQueuesIdWaitingInteractions']);router['get']('/sms/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0xc234('0x32')]);router['get']('/whatsapp/queues/waitinginteractions',auth[_0xc234('0x7')](),controller[_0xc234('0x33')]);router[_0xc234('0x5')]('/fax/queues/waitinginteractions',auth[_0xc234('0x7')](),controller[_0xc234('0x34')]);router['post']('/mail/queues/:id/notify',auth[_0xc234('0x7')](),controller[_0xc234('0x35')](_0xc234('0x36')));router['get'](_0xc234('0x37'),auth[_0xc234('0x7')](),controller[_0xc234('0x38')]);router['post'](_0xc234('0x39'),auth[_0xc234('0x7')](),controller[_0xc234('0x35')](_0xc234('0x3a')));router['get'](_0xc234('0x3b'),auth[_0xc234('0x7')](),controller[_0xc234('0x3c')]);router[_0xc234('0x3d')](_0xc234('0x3e'),auth[_0xc234('0x7')](),controller['queueNotify'](_0xc234('0x3f')));router['get'](_0xc234('0x40'),auth[_0xc234('0x7')](),controller['showFaxQueues']);router['post'](_0xc234('0x41'),auth[_0xc234('0x7')](),controller[_0xc234('0x35')](_0xc234('0x42')));router[_0xc234('0x5')](_0xc234('0x43'),auth[_0xc234('0x7')](),controller['showOpenchannelQueues']);router[_0xc234('0x3d')](_0xc234('0x44'),auth[_0xc234('0x7')](),controller['queueNotify']('sms'));router['post']('/whatsapp/queues/:id/notify',auth[_0xc234('0x7')](),controller[_0xc234('0x35')]('whatsapp'));router[_0xc234('0x5')](_0xc234('0x45'),auth[_0xc234('0x7')](),controller[_0xc234('0x46')]);router[_0xc234('0x5')](_0xc234('0x47'),auth[_0xc234('0x7')](),controller[_0xc234('0x48')]);router[_0xc234('0x3d')]('/agents/:id/notify',auth[_0xc234('0x7')](),controller[_0xc234('0x49')]);module[_0xc234('0x4a')]=router; \ No newline at end of file +var _0x5a9c=['/agents','agents','/agents/:id/capacity','agentCapacity','/telephones','telephones','/trunks','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','post','queueNotify','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','/openchannel/queues/:id/notify','openchannel','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','/sms/queues/:id','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','util','path','express','Router','../../components/auth/service','./rpc.controller','/voice/channels','isAuthenticated','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','get','/voice/channels/:uniqueid/stopmixmonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','/sms/queues','smsQueues','/whatsapp/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','put','updateVoiceQueue','/outbound','outbound','/outbound/channels','outboundChannels'];(function(_0x504b32,_0x183b43){var _0x117d62=function(_0x13a6ec){while(--_0x13a6ec){_0x504b32['push'](_0x504b32['shift']());}};_0x117d62(++_0x183b43);}(_0x5a9c,0xcb));var _0xc5a9=function(_0x18db9f,_0x52c3a6){_0x18db9f=_0x18db9f-0x0;var _0x2b840c=_0x5a9c[_0x18db9f];return _0x2b840c;};'use strict';var multer=require('multer');var util=require(_0xc5a9('0x0'));var path=require(_0xc5a9('0x1'));var express=require(_0xc5a9('0x2'));var router=express[_0xc5a9('0x3')]();var auth=require(_0xc5a9('0x4'));var controller=require(_0xc5a9('0x5'));router['get'](_0xc5a9('0x6'),auth[_0xc5a9('0x7')](),controller['voiceChannels']);router['get'](_0xc5a9('0x8'),auth[_0xc5a9('0x7')](),controller[_0xc5a9('0x9')]);router[_0xc5a9('0xa')](_0xc5a9('0xb'),auth[_0xc5a9('0x7')](),controller['voiceChannelStopMixMonitor']);router[_0xc5a9('0xa')](_0xc5a9('0xc'),auth['isAuthenticated'](),controller[_0xc5a9('0xd')]);router[_0xc5a9('0xa')](_0xc5a9('0xe'),auth[_0xc5a9('0x7')](),controller[_0xc5a9('0xf')]);router[_0xc5a9('0xa')](_0xc5a9('0x10'),auth[_0xc5a9('0x7')](),controller[_0xc5a9('0x11')]);router[_0xc5a9('0xa')](_0xc5a9('0x12'),auth[_0xc5a9('0x7')](),controller[_0xc5a9('0x13')]);router[_0xc5a9('0xa')](_0xc5a9('0x14'),auth[_0xc5a9('0x7')](),controller['openchannelQueues']);router[_0xc5a9('0xa')](_0xc5a9('0x15'),auth[_0xc5a9('0x7')](),controller[_0xc5a9('0x16')]);router[_0xc5a9('0xa')](_0xc5a9('0x17'),auth[_0xc5a9('0x7')](),controller['whatsappQueues']);router[_0xc5a9('0xa')]('/fax/queues',auth['isAuthenticated'](),controller[_0xc5a9('0x18')]);router['get'](_0xc5a9('0x19'),auth[_0xc5a9('0x7')](),controller[_0xc5a9('0x1a')]);router[_0xc5a9('0xa')](_0xc5a9('0x1b'),auth[_0xc5a9('0x7')](),controller[_0xc5a9('0x1c')]);router[_0xc5a9('0xa')](_0xc5a9('0x1d'),auth[_0xc5a9('0x7')](),controller['voiceQueuesChannel']);router[_0xc5a9('0xa')]('/voice/queues/channels/:uniqueid/hangup',auth[_0xc5a9('0x7')](),controller['voiceQueuesChannelHangup']);router['get'](_0xc5a9('0x1e'),auth[_0xc5a9('0x7')](),controller[_0xc5a9('0x1f')]);router[_0xc5a9('0xa')](_0xc5a9('0x20'),auth['isAuthenticated'](),controller[_0xc5a9('0x21')]);router[_0xc5a9('0x22')](_0xc5a9('0x20'),auth['isAuthenticated'](),controller[_0xc5a9('0x23')]);router[_0xc5a9('0xa')](_0xc5a9('0x24'),auth[_0xc5a9('0x7')](),controller[_0xc5a9('0x25')]);router[_0xc5a9('0xa')](_0xc5a9('0x26'),auth[_0xc5a9('0x7')](),controller[_0xc5a9('0x27')]);router['get'](_0xc5a9('0x28'),auth[_0xc5a9('0x7')](),controller[_0xc5a9('0x29')]);router[_0xc5a9('0x22')](_0xc5a9('0x2a'),auth[_0xc5a9('0x7')](),controller[_0xc5a9('0x2b')]);router['get'](_0xc5a9('0x2c'),auth[_0xc5a9('0x7')](),controller[_0xc5a9('0x2d')]);router[_0xc5a9('0xa')](_0xc5a9('0x2e'),auth[_0xc5a9('0x7')](),controller[_0xc5a9('0x2f')]);router[_0xc5a9('0xa')](_0xc5a9('0x30'),auth[_0xc5a9('0x7')](),controller[_0xc5a9('0x31')]);router[_0xc5a9('0xa')](_0xc5a9('0x32'),auth['isAuthenticated'](),controller[_0xc5a9('0x33')]);router[_0xc5a9('0xa')](_0xc5a9('0x34'),auth[_0xc5a9('0x7')](),controller[_0xc5a9('0x35')]);router[_0xc5a9('0xa')]('/mail/queues/waitinginteractions',auth[_0xc5a9('0x7')](),controller[_0xc5a9('0x36')]);router[_0xc5a9('0xa')]('/openchannel/queues/waitinginteractions',auth[_0xc5a9('0x7')](),controller[_0xc5a9('0x37')]);router['get']('/openchannel/queues/:id/waitinginteractions',auth[_0xc5a9('0x7')](),controller['openchannelQueuesIdWaitingInteractions']);router[_0xc5a9('0xa')](_0xc5a9('0x38'),auth['isAuthenticated'](),controller[_0xc5a9('0x39')]);router[_0xc5a9('0xa')]('/whatsapp/queues/waitinginteractions',auth[_0xc5a9('0x7')](),controller[_0xc5a9('0x3a')]);router[_0xc5a9('0xa')]('/fax/queues/waitinginteractions',auth[_0xc5a9('0x7')](),controller['faxQueuesWaitingInteractions']);router[_0xc5a9('0x3b')]('/mail/queues/:id/notify',auth[_0xc5a9('0x7')](),controller[_0xc5a9('0x3c')]('mail'));router[_0xc5a9('0xa')](_0xc5a9('0x3d'),auth['isAuthenticated'](),controller[_0xc5a9('0x3e')]);router[_0xc5a9('0x3b')](_0xc5a9('0x3f'),auth[_0xc5a9('0x7')](),controller[_0xc5a9('0x3c')](_0xc5a9('0x40')));router[_0xc5a9('0xa')](_0xc5a9('0x41'),auth[_0xc5a9('0x7')](),controller[_0xc5a9('0x42')]);router[_0xc5a9('0x3b')](_0xc5a9('0x43'),auth[_0xc5a9('0x7')](),controller[_0xc5a9('0x3c')](_0xc5a9('0x44')));router[_0xc5a9('0xa')]('/fax/queues/:id',auth[_0xc5a9('0x7')](),controller['showFaxQueues']);router['post'](_0xc5a9('0x45'),auth[_0xc5a9('0x7')](),controller['queueNotify'](_0xc5a9('0x46')));router[_0xc5a9('0xa')]('/openchannel/queues/:id',auth[_0xc5a9('0x7')](),controller[_0xc5a9('0x47')]);router[_0xc5a9('0x3b')](_0xc5a9('0x48'),auth[_0xc5a9('0x7')](),controller['queueNotify'](_0xc5a9('0x49')));router['post'](_0xc5a9('0x4a'),auth[_0xc5a9('0x7')](),controller[_0xc5a9('0x3c')]('whatsapp'));router[_0xc5a9('0xa')](_0xc5a9('0x4b'),auth[_0xc5a9('0x7')](),controller['showSmsQueues']);router[_0xc5a9('0xa')](_0xc5a9('0x4c'),auth[_0xc5a9('0x7')](),controller[_0xc5a9('0x4d')]);router['post'](_0xc5a9('0x4e'),auth['isAuthenticated'](),controller[_0xc5a9('0x4f')]);module[_0xc5a9('0x50')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index c8e489f..d7efe2c 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 _0xe706=['indexOf','queue_id','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','Website','Queue','\x20Queue\x20not\x20found','Message','findOne','Interaction','Account','update','queue','MessageId','InteractionId','TransferReport','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','chat','User','Agent\x20not\x20found','messageId','\x20Message\x20not\x20found','From','create','Start','agentTransferTimeout','bluebird','moment','lodash','../../mysqldb','../../config/logger','api','jayson/promise','client','http','request','then','error','code','message','result','catch','status','json','name','send','isNil','rows','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','user','hasOwnProperty','MemberReport','findAll','INTERACTION','interaction','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','SIP/%s','interface','agent','internal','capacity','Telephones','trunks','Trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','OpenchannelQueues','showOpenchannelQueues','showSmsQueues','SmsQueues','whatsappQueues','WhatsappQueues','faxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','uniq'];(function(_0x6dfea,_0x19621e){var _0x892046=function(_0x38eb3a){while(--_0x38eb3a){_0x6dfea['push'](_0x6dfea['shift']());}};_0x892046(++_0x19621e);}(_0xe706,0xa3));var _0x6e70=function(_0x3bb63a,_0x15af8f){_0x3bb63a=_0x3bb63a-0x0;var _0x3b822a=_0xe706[_0x3bb63a];return _0x3b822a;};'use strict';var BPromise=require(_0x6e70('0x0'));var moment=require(_0x6e70('0x1'));var _=require(_0x6e70('0x2'));var util=require('util');var db=require(_0x6e70('0x3'))['db'];var logger=require(_0x6e70('0x4'))(_0x6e70('0x5'));var jayson=require(_0x6e70('0x6'));var amiClient=jayson[_0x6e70('0x7')][_0x6e70('0x8')]({'port':0x232a});var mailClient=jayson[_0x6e70('0x7')][_0x6e70('0x8')]({'port':0x232b});var routingClient=jayson[_0x6e70('0x7')][_0x6e70('0x8')]({'port':0x232c});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){var _0x449b48=_0x45a2d4?_0x45a2d4:amiClient;return _0x449b48[_0x6e70('0x9')](_0x36357b,_0x293ce7)[_0x6e70('0xa')](function(_0x100eb7){if(_0x100eb7[_0x6e70('0xb')]){if(_0x100eb7[_0x6e70('0xb')][_0x6e70('0xc')]===0x1f4){return _0x3c4843(_0x100eb7[_0x6e70('0xb')][_0x6e70('0xd')]);}return _0x188ed3(_0x100eb7['error']['message']);}else{_0x188ed3(_0x100eb7[_0x6e70('0xe')]);}})[_0x6e70('0xf')](function(_0x18cf27){_0x3c4843(_0x18cf27);});});}function respondWithResult(_0x27dd9b,_0x3b38f3){_0x3b38f3=_0x3b38f3||0xc8;return function(_0x310eb7){if(_0x310eb7){return _0x27dd9b[_0x6e70('0x10')](_0x3b38f3)[_0x6e70('0x11')](_0x310eb7);}return _0x27dd9b['sendStatus'](0x194);};}function handleError(_0x52737e,_0x48bc72){_0x48bc72=_0x48bc72||0x1f4;return function(_0x257e81){logger['error'](_0x257e81['stack']);if(_0x257e81[_0x6e70('0x12')]){delete _0x257e81[_0x6e70('0x12')];}_0x52737e['status'](_0x48bc72)[_0x6e70('0x13')](_0x257e81);};}function findById(_0x5c3fe7){return function(_0x2efc0f){if(!_[_0x6e70('0x14')](_0x5c3fe7)&&!_['isNil'](_0x2efc0f)&&!_['isNil'](_0x2efc0f[_0x6e70('0x15')])){return _['find'](_0x2efc0f[_0x6e70('0x15')],function(_0x173afe){return _0x173afe['id']==_0x5c3fe7;});}return null;};}exports['voiceChannels']=function(_0x497d61,_0xc238ba){return respondWithRpcPromise(_0x6e70('0x16'),_0x497d61[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0xc238ba,null))[_0x6e70('0xf')](handleError(_0xc238ba,null));};exports[_0x6e70('0x18')]=function(_0x1b2453,_0x44a49f){return respondWithRpcPromise(_0x6e70('0x19'),_[_0x6e70('0x1a')](_0x1b2453['query'],_0x1b2453[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x44a49f,null))[_0x6e70('0xf')](handleError(_0x44a49f,null));};exports['voiceChannelStopMixMonitor']=function(_0x3ccd87,_0xa5d49){return respondWithRpcPromise(_0x6e70('0x1c'),_['merge'](_0x3ccd87[_0x6e70('0x17')],_0x3ccd87['params']))['then'](respondWithResult(_0xa5d49,null))['catch'](handleError(_0xa5d49,null));};exports[_0x6e70('0x1d')]=function(_0x19c5ae,_0x51d292){return respondWithRpcPromise(_0x6e70('0x1e'),_0x19c5ae[_0x6e70('0x17')])['then'](respondWithResult(_0x51d292,null))[_0x6e70('0xf')](handleError(_0x51d292,null));};exports[_0x6e70('0x1f')]=function(_0x2bb231,_0x4a67ac){return respondWithRpcPromise('VoiceQueues',_0x2bb231[_0x6e70('0x17')])[_0x6e70('0xa')](findById(_0x2bb231[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x4a67ac,null))[_0x6e70('0xf')](handleError(_0x4a67ac,null));};exports['updateVoiceQueue']=function(_0x1952ea,_0x406f29){return respondWithRpcPromise(_0x6e70('0x20'),_[_0x6e70('0x1a')](_0x1952ea[_0x6e70('0x21')],_0x1952ea[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x406f29,null))[_0x6e70('0xf')](handleError(_0x406f29,null));};exports[_0x6e70('0x22')]=function(_0x3a5d30,_0x4b1229){return respondWithRpcPromise(_0x6e70('0x23'),_['merge'](_0x3a5d30[_0x6e70('0x17')],_0x3a5d30['params']))[_0x6e70('0xa')](respondWithResult(_0x4b1229,null))[_0x6e70('0xf')](handleError(_0x4b1229,null));};exports[_0x6e70('0x24')]=function(_0x56f6f7,_0x38c40d){return respondWithRpcPromise(_0x6e70('0x25'),_0x56f6f7['query'])[_0x6e70('0xa')](respondWithResult(_0x38c40d,null))[_0x6e70('0xf')](handleError(_0x38c40d,null));};exports['voiceQueuesChannel']=function(_0x10d8f6,_0x3665a1){return respondWithRpcPromise(_0x6e70('0x26'),_[_0x6e70('0x1a')](_0x10d8f6[_0x6e70('0x17')],_0x10d8f6[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x3665a1,null))[_0x6e70('0xf')](handleError(_0x3665a1,null));};exports[_0x6e70('0x27')]=function(_0x419a41,_0x4d32d8){return respondWithRpcPromise(_0x6e70('0x28'),_['merge'](_0x419a41[_0x6e70('0x17')],_0x419a41[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x4d32d8,null))[_0x6e70('0xf')](handleError(_0x4d32d8,null));};exports[_0x6e70('0x29')]=function(_0x989b80,_0x2440be){return respondWithRpcPromise(_0x6e70('0x2a'),_[_0x6e70('0x1a')](_0x989b80[_0x6e70('0x17')],_0x989b80[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x2440be,null))[_0x6e70('0xf')](handleError(_0x2440be,null));};exports['outbound']=function(_0x5446a2,_0x5424eb){return respondWithRpcPromise(_0x6e70('0x2b'),_0x5446a2[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x5424eb,null))[_0x6e70('0xf')](handleError(_0x5424eb,null));};exports[_0x6e70('0x2c')]=function(_0x3bdd87,_0x572a71){return respondWithRpcPromise(_0x6e70('0x2d'),_0x3bdd87[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x572a71,null))[_0x6e70('0xf')](handleError(_0x572a71,null));};exports[_0x6e70('0x2e')]=function(_0x37bf46,_0x246e61){var _0x16fc7d;return respondWithRpcPromise('Agents',_0x37bf46[_0x6e70('0x17')])[_0x6e70('0xa')](function(_0x22fce9){_0x16fc7d=_0x22fce9;return respondWithRpcPromise(_0x6e70('0x2f'),_0x37bf46[_0x6e70('0x17')],routingClient);})[_0x6e70('0xa')](function(_0x21b0e7){return _['merge']({},_0x21b0e7,_0x16fc7d);})['then'](respondWithResult(_0x246e61,null))['catch'](handleError(_0x246e61,null));};exports[_0x6e70('0x30')]=function(_0x2b63cc,_0x83847b){if(_0x2b63cc[_0x6e70('0x21')]&&_0x2b63cc[_0x6e70('0x21')]['interaction']&&_0x2b63cc[_0x6e70('0x31')]&&_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x12')]){for(var _0x52b197 in _0x2b63cc['body']['interaction']){if(_0x2b63cc[_0x6e70('0x21')]['interaction'][_0x6e70('0x32')](_0x52b197)){db[_0x6e70('0x33')][_0x6e70('0x34')]({'where':{'channel':_0x52b197,'membername':_0x2b63cc[_0x6e70('0x31')]['name'],'type':_0x6e70('0x35'),'exitAt':null,'uniqueid':_0x2b63cc['body'][_0x6e70('0x36')][_0x52b197]&&_0x2b63cc[_0x6e70('0x21')][_0x6e70('0x36')][_0x52b197][_0x6e70('0x37')]?{'$notIn':_0x2b63cc['body'][_0x6e70('0x36')][_0x52b197]}:{'$ne':null}}})[_0x6e70('0xa')](function(_0x3d39c3){var _0xac87d6=moment()[_0x6e70('0x38')](_0x6e70('0x39'));for(var _0x3d9c5=0x0,_0x552e7e=_0x3d39c3[_0x6e70('0x37')];_0x3d9c5<_0x552e7e;_0x3d9c5+=0x1){_0x3d39c3[_0x3d9c5][_0x6e70('0x3a')]({'exitAt':_0xac87d6});}});for(var _0x10de2a=0x0;_0x10de2a<_0x2b63cc[_0x6e70('0x21')][_0x6e70('0x36')][_0x52b197][_0x6e70('0x37')];_0x10de2a+=0x1){db[_0x6e70('0x33')]['findOrCreate']({'where':{'channel':_0x52b197,'membername':_0x2b63cc[_0x6e70('0x31')]['name'],'type':_0x6e70('0x35'),'uniqueid':_0x2b63cc[_0x6e70('0x21')]['interaction'][_0x52b197][_0x10de2a],'exitAt':null},'defaults':{'channel':_0x52b197,'membername':_0x2b63cc['user'][_0x6e70('0x12')],'interface':_[_0x6e70('0x14')](_0x2b63cc[_0x6e70('0x31')]['interface'])?util['format'](_0x6e70('0x3b'),_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x12')]):_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x3c')],'type':_0x6e70('0x35'),'enterAt':moment()['format'](_0x6e70('0x39')),'role':_0x6e70('0x3d'),'internal':_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x3e')],'uniqueid':_0x2b63cc[_0x6e70('0x21')]['interaction'][_0x52b197][_0x10de2a]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x2b63cc[_0x6e70('0x1b')]['id'],'capacity':_0x2b63cc[_0x6e70('0x21')][_0x6e70('0x3f')]},routingClient)[_0x6e70('0xa')](respondWithResult(_0x83847b,null))[_0x6e70('0xf')](handleError(_0x83847b,null));};exports['telephones']=function(_0x41bd0b,_0x232366){return respondWithRpcPromise(_0x6e70('0x40'),_0x41bd0b[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x232366,null))['catch'](handleError(_0x232366,null));};exports[_0x6e70('0x41')]=function(_0x1dd242,_0x2c20d3){return respondWithRpcPromise(_0x6e70('0x42'),_0x1dd242[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x2c20d3,null))['catch'](handleError(_0x2c20d3,null));};exports[_0x6e70('0x43')]=function(_0x8d425d,_0x5c2396){return respondWithRpcPromise(_0x6e70('0x44'),_0x8d425d[_0x6e70('0x17')])['then'](respondWithResult(_0x5c2396,null))[_0x6e70('0xf')](handleError(_0x5c2396,null));};exports[_0x6e70('0x45')]=function(_0x2134c4,_0x46d536){return respondWithRpcPromise(_0x6e70('0x46'),_0x2134c4['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x46d536,null))[_0x6e70('0xf')](handleError(_0x46d536,null));};exports[_0x6e70('0x47')]=function(_0x13be81,_0x1c02d7){return respondWithRpcPromise(_0x6e70('0x46'),_0x13be81[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x13be81[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x1c02d7,null))[_0x6e70('0xf')](handleError(_0x1c02d7,null));};exports[_0x6e70('0x48')]=function(_0xb8f78,_0x1fd9a6){return respondWithRpcPromise(_0x6e70('0x49'),_0xb8f78[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x1fd9a6,null))[_0x6e70('0xf')](handleError(_0x1fd9a6,null));};exports[_0x6e70('0x4a')]=function(_0x1c7dca,_0x4c6aab){return respondWithRpcPromise(_0x6e70('0x49'),_0x1c7dca[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x1c7dca[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x4c6aab,null))[_0x6e70('0xf')](handleError(_0x4c6aab,null));};exports['mailAccounts']=function(_0x42bd85,_0x6cabf0){return respondWithRpcPromise('MailAccounts',_0x42bd85[_0x6e70('0x17')],mailClient)[_0x6e70('0xa')](respondWithResult(_0x6cabf0,null))[_0x6e70('0xf')](handleError(_0x6cabf0,null));};exports['openchannelQueues']=function(_0x51f268,_0x2f9be4){return respondWithRpcPromise(_0x6e70('0x4b'),_0x51f268[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x2f9be4,null))[_0x6e70('0xf')](handleError(_0x2f9be4,null));};exports[_0x6e70('0x4c')]=function(_0x30cd88,_0x57bfe5){return respondWithRpcPromise('OpenchannelQueues',_0x30cd88[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x30cd88[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x57bfe5,null))['catch'](handleError(_0x57bfe5,null));};exports['smsQueues']=function(_0x2e972b,_0x4e5545){return respondWithRpcPromise('SmsQueues',_0x2e972b['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x4e5545,null))['catch'](handleError(_0x4e5545,null));};exports[_0x6e70('0x4d')]=function(_0x23900b,_0x3b4da0){return respondWithRpcPromise(_0x6e70('0x4e'),_0x23900b[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x23900b[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x3b4da0,null))['catch'](handleError(_0x3b4da0,null));};exports[_0x6e70('0x4f')]=function(_0x6a560f,_0x22c836){return respondWithRpcPromise(_0x6e70('0x50'),_0x6a560f[_0x6e70('0x17')],routingClient)['then'](respondWithResult(_0x22c836,null))['catch'](handleError(_0x22c836,null));};exports['showWhatsappQueues']=function(_0x1bb338,_0xd91b9){return respondWithRpcPromise(_0x6e70('0x50'),_0x1bb338['query'],routingClient)['then'](findById(_0x1bb338[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0xd91b9,null))[_0x6e70('0xf')](handleError(_0xd91b9,null));};exports[_0x6e70('0x51')]=function(_0x2285f1,_0x32b884){return respondWithRpcPromise('FaxQueues',_0x2285f1[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x32b884,null))[_0x6e70('0xf')](handleError(_0x32b884,null));};exports[_0x6e70('0x52')]=function(_0x515c0c,_0xce964b){return respondWithRpcPromise('FaxQueues',_0x515c0c['query'],routingClient)[_0x6e70('0xa')](findById(_0x515c0c[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0xce964b,null))[_0x6e70('0xf')](handleError(_0xce964b,null));};exports[_0x6e70('0x53')]=function(_0x2be0fc,_0x4b5b19){return respondWithRpcPromise(_0x6e70('0x54'),_0x2be0fc[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x4b5b19,null))[_0x6e70('0xf')](handleError(_0x4b5b19,null));};exports[_0x6e70('0x55')]=function(_0x13c092,_0x363722){return respondWithRpcPromise(_0x6e70('0x56'),_0x13c092[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x363722,null))['catch'](handleError(_0x363722,null));};exports[_0x6e70('0x57')]=function(_0x303c5a,_0x577c3b){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x303c5a['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x577c3b,null))[_0x6e70('0xf')](handleError(_0x577c3b,null));};exports[_0x6e70('0x58')]=function(_0x14bb74,_0x5a3dcb){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x14bb74['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x5a3dcb,null))[_0x6e70('0xf')](handleError(_0x5a3dcb,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x58666a,_0x1c7c5f){return respondWithRpcPromise(_0x6e70('0x59'),_0x58666a[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](function(_0x44bf96){if(_0x58666a[_0x6e70('0x17')][_0x6e70('0x5a')]!==undefined){var _0x3650e9=_(_0x44bf96[_0x6e70('0x15')])[_0x6e70('0x5b')]([_0x58666a[_0x6e70('0x17')][_0x6e70('0x5a')],_0x58666a[_0x6e70('0x1b')]['id']])['map']('queue_id')[_0x6e70('0x5c')]()['value']();return _0x44bf96[_0x6e70('0x15')]['filter'](function(_0x5b5471){return _0x3650e9[_0x6e70('0x5d')](_0x5b5471['queue_id'])>-0x1;});}else{return _0x44bf96['rows'][_0x6e70('0x5b')](function(_0x21e4c2){return _0x21e4c2[_0x6e70('0x5e')]===parseInt(_0x58666a['params']['id']);});}})['then'](respondWithResult(_0x1c7c5f,null))['catch'](handleError(_0x1c7c5f,null));};exports[_0x6e70('0x5f')]=function(_0x512b0a,_0x2e8ed3){return respondWithRpcPromise(_0x6e70('0x60'),_0x512b0a[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x2e8ed3,null))[_0x6e70('0xf')](handleError(_0x2e8ed3,null));};exports[_0x6e70('0x61')]=function(_0x214a8f,_0x50046a){return respondWithRpcPromise(_0x6e70('0x62'),_0x214a8f[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x50046a,null))['catch'](handleError(_0x50046a,null));};exports[_0x6e70('0x63')]=function(_0x227d94,_0x11a615){return respondWithRpcPromise(_0x6e70('0x64'),_0x227d94[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x11a615,null))[_0x6e70('0xf')](handleError(_0x11a615,null));};exports[_0x6e70('0x65')]=function(_0x461ec0){return function(_0x48f6fd,_0x463eed){var _0x39e6db,_0x53acc8;var _0x252f07=_[_0x6e70('0x66')](_0x461ec0);var _0x51be27=_0x461ec0==='chat'?_0x6e70('0x67'):'Account';return db[_0x252f07+_0x6e70('0x68')]['findOne']({'raw':!![],'where':{'id':_0x48f6fd[_0x6e70('0x1b')]['id']}})[_0x6e70('0xa')](function(_0x106f32){if(_[_0x6e70('0x14')](_0x106f32)){throw new Error(_0x252f07+_0x6e70('0x69'));}_0x39e6db=_0x106f32;return db[_0x252f07+_0x6e70('0x6a')][_0x6e70('0x6b')]({'where':{'id':_0x48f6fd['body']['messageId']},'include':[{'model':db[_0x252f07+_0x6e70('0x6c')],'as':'Interaction'},{'model':db[_0x252f07+_0x51be27],'as':_0x6e70('0x6d')}]});})[_0x6e70('0xa')](function(_0x28e5b1){if(_[_0x6e70('0x14')](_0x28e5b1)){throw new Error(_0x252f07+'\x20Message\x20not\x20found');}_0x53acc8=_0x28e5b1;return _0x28e5b1[_0x6e70('0x6e')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x260dfa={'uniqueid':_0x461ec0+'.'+_0x53acc8['id']+'.'+_0x53acc8[_0x6e70('0x6c')]['id'],'FromUserId':_0x48f6fd[_0x6e70('0x31')]['id'],'type':_0x6e70('0x6f')};_0x260dfa[_0x252f07+_0x6e70('0x70')]=_0x53acc8['id'];_0x260dfa[_0x252f07+_0x6e70('0x71')]=_0x53acc8[_0x6e70('0x6c')]['id'];_0x260dfa['From'+_0x252f07+_0x51be27+'Id']=_0x53acc8[_0x6e70('0x6d')]['id'];_0x260dfa['To'+_0x252f07+'QueueId']=_0x39e6db['id'];return db[_0x252f07+_0x6e70('0x72')]['create'](_0x260dfa);})['then'](function(){return respondWithRpcPromise('Start',{'channel':_0x461ec0,'interaction':_0x53acc8[_0x6e70('0x6c')],'message':_0x53acc8,'account':_0x53acc8[_0x6e70('0x6d')],'applications':[{'id':0x0,'priority':0x1,'app':_0x6e70('0x6f'),'appdata':_0x39e6db[_0x6e70('0x12')]+','+(_0x53acc8[_0x6e70('0x6d')]['queueTransferTimeout']||0x12c),'interval':_0x6e70('0x73')}],'transfer':!![]},routingClient);})[_0x6e70('0xa')](respondWithResult(_0x463eed,null))['catch'](handleError(_0x463eed,null));};};exports[_0x6e70('0x74')]=function(_0x50e494,_0x17d3a4){var _0x5d0585,_0x4a87e2;if(_[_0x6e70('0x14')](_0x50e494[_0x6e70('0x21')][_0x6e70('0x75')])){throw new Error(_0x6e70('0x76'));}var _0x3e6661=_0x50e494[_0x6e70('0x21')][_0x6e70('0x75')];var _0x5c0276=_[_0x6e70('0x66')](_0x3e6661);var _0x4f4a16=_0x3e6661===_0x6e70('0x77')?_0x6e70('0x67'):_0x6e70('0x6d');return db[_0x6e70('0x78')][_0x6e70('0x6b')]({'raw':!![],'where':{'id':_0x50e494[_0x6e70('0x1b')]['id'],'role':_0x6e70('0x3d')}})['then'](function(_0x4466f0){if(_['isNil'](_0x4466f0)){throw new Error(_0x6e70('0x79'));}_0x5d0585=_0x4466f0;return db[_0x5c0276+_0x6e70('0x6a')][_0x6e70('0x6b')]({'where':{'id':_0x50e494[_0x6e70('0x21')][_0x6e70('0x7a')]},'include':[{'model':db[_0x5c0276+_0x6e70('0x6c')],'as':_0x6e70('0x6c')},{'model':db[_0x5c0276+_0x4f4a16],'as':_0x6e70('0x6d')}]});})[_0x6e70('0xa')](function(_0x162bc3){if(_['isNil'](_0x162bc3)){throw new Error(_0x5c0276+_0x6e70('0x7b'));}_0x4a87e2=_0x162bc3;return _0x162bc3[_0x6e70('0x6e')]({'read':0x0,'readAt':null,'UserId':null});})[_0x6e70('0xa')](function(){var _0x181802={'uniqueid':_0x3e6661+'.'+_0x4a87e2['id']+'.'+_0x4a87e2[_0x6e70('0x6c')]['id'],'FromUserId':_0x50e494['user']['id'],'type':'agent','ToUserId':_0x5d0585['id']};_0x181802[_0x5c0276+'MessageId']=_0x4a87e2['id'];_0x181802[_0x5c0276+_0x6e70('0x71')]=_0x4a87e2[_0x6e70('0x6c')]['id'];_0x181802[_0x6e70('0x7c')+_0x5c0276+_0x4f4a16+'Id']=_0x4a87e2[_0x6e70('0x6d')]['id'];return db[_0x5c0276+_0x6e70('0x72')][_0x6e70('0x7d')](_0x181802);})[_0x6e70('0xa')](function(){return respondWithRpcPromise(_0x6e70('0x7e'),{'channel':_0x3e6661,'interaction':_0x4a87e2[_0x6e70('0x6c')],'message':_0x4a87e2,'account':_0x4a87e2[_0x6e70('0x6d')],'applications':[{'id':0x0,'priority':0x1,'app':_0x6e70('0x3d'),'appdata':_0x5d0585[_0x6e70('0x12')]+','+(_0x4a87e2[_0x6e70('0x6d')][_0x6e70('0x7f')]||0x12c),'interval':_0x6e70('0x73')}],'transfer':!![]},routingClient);})['then'](respondWithResult(_0x17d3a4,null))[_0x6e70('0xf')](handleError(_0x17d3a4,null));}; \ No newline at end of file +var _0xb10b=['showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','queue_id','uniq','value','indexOf','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','queueNotify','capitalize','Website','Account','Queue','\x20Queue\x20not\x20found','Message','findOne','messageId','Interaction','\x20Message\x20not\x20found','update','queue','MessageId','InteractionId','From','QueueId','TransferReport','create','*,*,*,*','agentNotify','channel','chat','User','Agent\x20not\x20found','Start','agentTransferTimeout','bluebird','lodash','util','../../mysqldb','api','jayson/promise','client','http','request','then','error','message','result','status','json','stack','name','send','isNil','rows','find','voiceChannels','query','catch','voiceChannelMixMonitor','merge','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','params','voiceQueues','showVoiceQueues','VoiceQueues','UpdateVoiceQueue','body','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','interaction','user','hasOwnProperty','findAll','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','MemberReport','findOrCreate','SIP/%s','interface','agent','AgentCapacity','capacity','telephones','Telephones','trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','MailAccounts','openchannelQueues','OpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','faxQueues','FaxQueues'];(function(_0x39e2d7,_0x1b15f6){var _0x413d0d=function(_0x3af71d){while(--_0x3af71d){_0x39e2d7['push'](_0x39e2d7['shift']());}};_0x413d0d(++_0x1b15f6);}(_0xb10b,0x12a));var _0xbb10=function(_0x36cba4,_0x53a452){_0x36cba4=_0x36cba4-0x0;var _0xcc6047=_0xb10b[_0x36cba4];return _0xcc6047;};'use strict';var BPromise=require(_0xbb10('0x0'));var moment=require('moment');var _=require(_0xbb10('0x1'));var util=require(_0xbb10('0x2'));var db=require(_0xbb10('0x3'))['db'];var logger=require('../../config/logger')(_0xbb10('0x4'));var jayson=require(_0xbb10('0x5'));var amiClient=jayson[_0xbb10('0x6')][_0xbb10('0x7')]({'port':0x232a});var mailClient=jayson[_0xbb10('0x6')][_0xbb10('0x7')]({'port':0x232b});var routingClient=jayson['client'][_0xbb10('0x7')]({'port':0x232c});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){var _0x1c3ee5=_0x1b9e94?_0x1b9e94:amiClient;return _0x1c3ee5[_0xbb10('0x8')](_0x3cdd53,_0x513741)[_0xbb10('0x9')](function(_0x229887){if(_0x229887[_0xbb10('0xa')]){if(_0x229887['error']['code']===0x1f4){return _0x21370f(_0x229887[_0xbb10('0xa')][_0xbb10('0xb')]);}return _0x3fb675(_0x229887[_0xbb10('0xa')]['message']);}else{_0x3fb675(_0x229887[_0xbb10('0xc')]);}})['catch'](function(_0x44fb19){_0x21370f(_0x44fb19);});});}function respondWithResult(_0x916a32,_0x285009){_0x285009=_0x285009||0xc8;return function(_0x193a27){if(_0x193a27){return _0x916a32[_0xbb10('0xd')](_0x285009)[_0xbb10('0xe')](_0x193a27);}return _0x916a32['sendStatus'](0x194);};}function handleError(_0x26e021,_0x42d7e4){_0x42d7e4=_0x42d7e4||0x1f4;return function(_0x45b9d6){logger[_0xbb10('0xa')](_0x45b9d6[_0xbb10('0xf')]);if(_0x45b9d6[_0xbb10('0x10')]){delete _0x45b9d6[_0xbb10('0x10')];}_0x26e021[_0xbb10('0xd')](_0x42d7e4)[_0xbb10('0x11')](_0x45b9d6);};}function findById(_0x2b184e){return function(_0x4a2bfc){if(!_[_0xbb10('0x12')](_0x2b184e)&&!_[_0xbb10('0x12')](_0x4a2bfc)&&!_[_0xbb10('0x12')](_0x4a2bfc[_0xbb10('0x13')])){return _[_0xbb10('0x14')](_0x4a2bfc[_0xbb10('0x13')],function(_0x575cca){return _0x575cca['id']==_0x2b184e;});}return null;};}exports[_0xbb10('0x15')]=function(_0xbf2906,_0xe1c665){return respondWithRpcPromise('VoiceChannels',_0xbf2906[_0xbb10('0x16')])[_0xbb10('0x9')](respondWithResult(_0xe1c665,null))[_0xbb10('0x17')](handleError(_0xe1c665,null));};exports[_0xbb10('0x18')]=function(_0xdf237d,_0x44e563){return respondWithRpcPromise('VoiceChannelMixMonitor',_[_0xbb10('0x19')](_0xdf237d[_0xbb10('0x16')],_0xdf237d['params']))['then'](respondWithResult(_0x44e563,null))[_0xbb10('0x17')](handleError(_0x44e563,null));};exports[_0xbb10('0x1a')]=function(_0x2e911d,_0x317da4){return respondWithRpcPromise(_0xbb10('0x1b'),_[_0xbb10('0x19')](_0x2e911d[_0xbb10('0x16')],_0x2e911d[_0xbb10('0x1c')]))[_0xbb10('0x9')](respondWithResult(_0x317da4,null))[_0xbb10('0x17')](handleError(_0x317da4,null));};exports[_0xbb10('0x1d')]=function(_0x26ad93,_0x537898){return respondWithRpcPromise('VoiceQueues',_0x26ad93['query'])[_0xbb10('0x9')](respondWithResult(_0x537898,null))[_0xbb10('0x17')](handleError(_0x537898,null));};exports[_0xbb10('0x1e')]=function(_0x4e25ff,_0x2fdde9){return respondWithRpcPromise(_0xbb10('0x1f'),_0x4e25ff[_0xbb10('0x16')])[_0xbb10('0x9')](findById(_0x4e25ff[_0xbb10('0x1c')]['id']))[_0xbb10('0x9')](respondWithResult(_0x2fdde9,null))[_0xbb10('0x17')](handleError(_0x2fdde9,null));};exports['updateVoiceQueue']=function(_0x3796c7,_0x21ac54){return respondWithRpcPromise(_0xbb10('0x20'),_[_0xbb10('0x19')](_0x3796c7[_0xbb10('0x21')],_0x3796c7[_0xbb10('0x1c')]))['then'](respondWithResult(_0x21ac54,null))[_0xbb10('0x17')](handleError(_0x21ac54,null));};exports['voiceQueuesPreview']=function(_0x448d5c,_0x56f2da){return respondWithRpcPromise(_0xbb10('0x22'),_[_0xbb10('0x19')](_0x448d5c[_0xbb10('0x16')],_0x448d5c['params']))['then'](respondWithResult(_0x56f2da,null))[_0xbb10('0x17')](handleError(_0x56f2da,null));};exports[_0xbb10('0x23')]=function(_0x4f590d,_0x359ad4){return respondWithRpcPromise(_0xbb10('0x24'),_0x4f590d[_0xbb10('0x16')])[_0xbb10('0x9')](respondWithResult(_0x359ad4,null))[_0xbb10('0x17')](handleError(_0x359ad4,null));};exports[_0xbb10('0x25')]=function(_0xf85197,_0x4975f5){return respondWithRpcPromise(_0xbb10('0x26'),_[_0xbb10('0x19')](_0xf85197[_0xbb10('0x16')],_0xf85197[_0xbb10('0x1c')]))[_0xbb10('0x9')](respondWithResult(_0x4975f5,null))[_0xbb10('0x17')](handleError(_0x4975f5,null));};exports[_0xbb10('0x27')]=function(_0x10202c,_0x3c8d7d){return respondWithRpcPromise('VoiceQueuesChannelHangup',_[_0xbb10('0x19')](_0x10202c[_0xbb10('0x16')],_0x10202c[_0xbb10('0x1c')]))[_0xbb10('0x9')](respondWithResult(_0x3c8d7d,null))['catch'](handleError(_0x3c8d7d,null));};exports[_0xbb10('0x28')]=function(_0x5de37b,_0x4e2754){return respondWithRpcPromise(_0xbb10('0x29'),_[_0xbb10('0x19')](_0x5de37b[_0xbb10('0x16')],_0x5de37b[_0xbb10('0x1c')]))[_0xbb10('0x9')](respondWithResult(_0x4e2754,null))[_0xbb10('0x17')](handleError(_0x4e2754,null));};exports['outbound']=function(_0x1e5bbd,_0x25d72f){return respondWithRpcPromise('Outbound',_0x1e5bbd['query'])['then'](respondWithResult(_0x25d72f,null))[_0xbb10('0x17')](handleError(_0x25d72f,null));};exports[_0xbb10('0x2a')]=function(_0x2b658a,_0x4d5a9b){return respondWithRpcPromise(_0xbb10('0x2b'),_0x2b658a[_0xbb10('0x16')])[_0xbb10('0x9')](respondWithResult(_0x4d5a9b,null))['catch'](handleError(_0x4d5a9b,null));};exports[_0xbb10('0x2c')]=function(_0x12238a,_0x1dcd38){var _0x446f49;return respondWithRpcPromise('Agents',_0x12238a[_0xbb10('0x16')])[_0xbb10('0x9')](function(_0x5835fd){_0x446f49=_0x5835fd;return respondWithRpcPromise(_0xbb10('0x2d'),_0x12238a[_0xbb10('0x16')],routingClient);})[_0xbb10('0x9')](function(_0x3a9934){return _[_0xbb10('0x19')]({},_0x3a9934,_0x446f49);})[_0xbb10('0x9')](respondWithResult(_0x1dcd38,null))['catch'](handleError(_0x1dcd38,null));};exports[_0xbb10('0x2e')]=function(_0x1c7fae,_0x3e7b4c){if(_0x1c7fae[_0xbb10('0x21')]&&_0x1c7fae['body'][_0xbb10('0x2f')]&&_0x1c7fae[_0xbb10('0x30')]&&_0x1c7fae[_0xbb10('0x30')][_0xbb10('0x10')]){for(var _0x5e2cfa in _0x1c7fae[_0xbb10('0x21')][_0xbb10('0x2f')]){if(_0x1c7fae['body']['interaction'][_0xbb10('0x31')](_0x5e2cfa)){db['MemberReport'][_0xbb10('0x32')]({'where':{'channel':_0x5e2cfa,'membername':_0x1c7fae[_0xbb10('0x30')]['name'],'type':_0xbb10('0x33'),'exitAt':null,'uniqueid':_0x1c7fae[_0xbb10('0x21')][_0xbb10('0x2f')][_0x5e2cfa]&&_0x1c7fae['body'][_0xbb10('0x2f')][_0x5e2cfa][_0xbb10('0x34')]?{'$notIn':_0x1c7fae[_0xbb10('0x21')][_0xbb10('0x2f')][_0x5e2cfa]}:{'$ne':null}}})[_0xbb10('0x9')](function(_0x19f94d){var _0x190781=moment()[_0xbb10('0x35')](_0xbb10('0x36'));for(var _0x43b948=0x0,_0x197871=_0x19f94d[_0xbb10('0x34')];_0x43b948<_0x197871;_0x43b948+=0x1){_0x19f94d[_0x43b948]['updateAttributes']({'exitAt':_0x190781});}});for(var _0x426b95=0x0;_0x426b95<_0x1c7fae[_0xbb10('0x21')]['interaction'][_0x5e2cfa][_0xbb10('0x34')];_0x426b95+=0x1){db[_0xbb10('0x37')][_0xbb10('0x38')]({'where':{'channel':_0x5e2cfa,'membername':_0x1c7fae[_0xbb10('0x30')][_0xbb10('0x10')],'type':_0xbb10('0x33'),'uniqueid':_0x1c7fae[_0xbb10('0x21')]['interaction'][_0x5e2cfa][_0x426b95],'exitAt':null},'defaults':{'channel':_0x5e2cfa,'membername':_0x1c7fae['user'][_0xbb10('0x10')],'interface':_[_0xbb10('0x12')](_0x1c7fae[_0xbb10('0x30')]['interface'])?util['format'](_0xbb10('0x39'),_0x1c7fae[_0xbb10('0x30')][_0xbb10('0x10')]):_0x1c7fae[_0xbb10('0x30')][_0xbb10('0x3a')],'type':_0xbb10('0x33'),'enterAt':moment()[_0xbb10('0x35')](_0xbb10('0x36')),'role':_0xbb10('0x3b'),'internal':_0x1c7fae[_0xbb10('0x30')]['internal'],'uniqueid':_0x1c7fae['body'][_0xbb10('0x2f')][_0x5e2cfa][_0x426b95]}});}}}}return respondWithRpcPromise(_0xbb10('0x3c'),{'id':_0x1c7fae[_0xbb10('0x1c')]['id'],'capacity':_0x1c7fae[_0xbb10('0x21')][_0xbb10('0x3d')]},routingClient)[_0xbb10('0x9')](respondWithResult(_0x3e7b4c,null))[_0xbb10('0x17')](handleError(_0x3e7b4c,null));};exports[_0xbb10('0x3e')]=function(_0x1c0d8f,_0x1214f7){return respondWithRpcPromise(_0xbb10('0x3f'),_0x1c0d8f[_0xbb10('0x16')])[_0xbb10('0x9')](respondWithResult(_0x1214f7,null))[_0xbb10('0x17')](handleError(_0x1214f7,null));};exports[_0xbb10('0x40')]=function(_0x547a7a,_0x124052){return respondWithRpcPromise('Trunks',_0x547a7a[_0xbb10('0x16')])[_0xbb10('0x9')](respondWithResult(_0x124052,null))[_0xbb10('0x17')](handleError(_0x124052,null));};exports[_0xbb10('0x41')]=function(_0x26e66e,_0x32d8e9){return respondWithRpcPromise(_0xbb10('0x42'),_0x26e66e[_0xbb10('0x16')])[_0xbb10('0x9')](respondWithResult(_0x32d8e9,null))[_0xbb10('0x17')](handleError(_0x32d8e9,null));};exports[_0xbb10('0x43')]=function(_0x1c2dce,_0x1d49e1){return respondWithRpcPromise(_0xbb10('0x44'),_0x1c2dce[_0xbb10('0x16')],routingClient)['then'](respondWithResult(_0x1d49e1,null))[_0xbb10('0x17')](handleError(_0x1d49e1,null));};exports[_0xbb10('0x45')]=function(_0x1b83a9,_0x4ce8e7){return respondWithRpcPromise(_0xbb10('0x44'),_0x1b83a9[_0xbb10('0x16')],routingClient)['then'](findById(_0x1b83a9[_0xbb10('0x1c')]['id']))[_0xbb10('0x9')](respondWithResult(_0x4ce8e7,null))[_0xbb10('0x17')](handleError(_0x4ce8e7,null));};exports[_0xbb10('0x46')]=function(_0x432728,_0x22de7f){return respondWithRpcPromise(_0xbb10('0x47'),_0x432728[_0xbb10('0x16')],routingClient)[_0xbb10('0x9')](respondWithResult(_0x22de7f,null))[_0xbb10('0x17')](handleError(_0x22de7f,null));};exports[_0xbb10('0x48')]=function(_0x2a1ce1,_0x16932f){return respondWithRpcPromise('MailQueues',_0x2a1ce1['query'],routingClient)[_0xbb10('0x9')](findById(_0x2a1ce1[_0xbb10('0x1c')]['id']))[_0xbb10('0x9')](respondWithResult(_0x16932f,null))[_0xbb10('0x17')](handleError(_0x16932f,null));};exports['mailAccounts']=function(_0x506498,_0x79411e){return respondWithRpcPromise(_0xbb10('0x49'),_0x506498[_0xbb10('0x16')],mailClient)[_0xbb10('0x9')](respondWithResult(_0x79411e,null))[_0xbb10('0x17')](handleError(_0x79411e,null));};exports[_0xbb10('0x4a')]=function(_0x45c0dc,_0x4a5fb9){return respondWithRpcPromise(_0xbb10('0x4b'),_0x45c0dc[_0xbb10('0x16')],routingClient)['then'](respondWithResult(_0x4a5fb9,null))['catch'](handleError(_0x4a5fb9,null));};exports['showOpenchannelQueues']=function(_0x32c1e8,_0x31c727){return respondWithRpcPromise(_0xbb10('0x4b'),_0x32c1e8['query'],routingClient)['then'](findById(_0x32c1e8['params']['id']))[_0xbb10('0x9')](respondWithResult(_0x31c727,null))[_0xbb10('0x17')](handleError(_0x31c727,null));};exports[_0xbb10('0x4c')]=function(_0x4e9fbd,_0xa1bbd9){return respondWithRpcPromise(_0xbb10('0x4d'),_0x4e9fbd['query'],routingClient)['then'](respondWithResult(_0xa1bbd9,null))[_0xbb10('0x17')](handleError(_0xa1bbd9,null));};exports[_0xbb10('0x4e')]=function(_0xd77753,_0x237246){return respondWithRpcPromise('SmsQueues',_0xd77753[_0xbb10('0x16')],routingClient)[_0xbb10('0x9')](findById(_0xd77753[_0xbb10('0x1c')]['id']))['then'](respondWithResult(_0x237246,null))[_0xbb10('0x17')](handleError(_0x237246,null));};exports[_0xbb10('0x4f')]=function(_0x3e3617,_0x5b2bd4){return respondWithRpcPromise(_0xbb10('0x50'),_0x3e3617[_0xbb10('0x16')],routingClient)[_0xbb10('0x9')](respondWithResult(_0x5b2bd4,null))[_0xbb10('0x17')](handleError(_0x5b2bd4,null));};exports['showWhatsappQueues']=function(_0x251417,_0x258e55){return respondWithRpcPromise(_0xbb10('0x50'),_0x251417[_0xbb10('0x16')],routingClient)['then'](findById(_0x251417[_0xbb10('0x1c')]['id']))[_0xbb10('0x9')](respondWithResult(_0x258e55,null))[_0xbb10('0x17')](handleError(_0x258e55,null));};exports[_0xbb10('0x51')]=function(_0x12f750,_0x17807e){return respondWithRpcPromise(_0xbb10('0x52'),_0x12f750['query'],routingClient)['then'](respondWithResult(_0x17807e,null))['catch'](handleError(_0x17807e,null));};exports[_0xbb10('0x53')]=function(_0x9c672d,_0x3eda96){return respondWithRpcPromise('FaxQueues',_0x9c672d['query'],routingClient)[_0xbb10('0x9')](findById(_0x9c672d[_0xbb10('0x1c')]['id']))[_0xbb10('0x9')](respondWithResult(_0x3eda96,null))[_0xbb10('0x17')](handleError(_0x3eda96,null));};exports[_0xbb10('0x54')]=function(_0x1ad2ed,_0x4cf2f3){return respondWithRpcPromise(_0xbb10('0x55'),_0x1ad2ed[_0xbb10('0x16')])[_0xbb10('0x9')](respondWithResult(_0x4cf2f3,null))[_0xbb10('0x17')](handleError(_0x4cf2f3,null));};exports[_0xbb10('0x56')]=function(_0x5bfc68,_0x56094a){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x5bfc68[_0xbb10('0x16')],routingClient)[_0xbb10('0x9')](respondWithResult(_0x56094a,null))[_0xbb10('0x17')](handleError(_0x56094a,null));};exports[_0xbb10('0x57')]=function(_0x2f7d2a,_0x1d40b8){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x2f7d2a[_0xbb10('0x16')],routingClient)['then'](respondWithResult(_0x1d40b8,null))['catch'](handleError(_0x1d40b8,null));};exports['openchannelQueuesWaitingInteractions']=function(_0xdf634f,_0x13040d){return respondWithRpcPromise(_0xbb10('0x58'),_0xdf634f[_0xbb10('0x16')],routingClient)['then'](respondWithResult(_0x13040d,null))[_0xbb10('0x17')](handleError(_0x13040d,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x576179,_0x165fe9){return respondWithRpcPromise(_0xbb10('0x58'),_0x576179[_0xbb10('0x16')],routingClient)[_0xbb10('0x9')](function(_0xfa3c7c){if(_0x576179['query'][_0xbb10('0x59')]!==undefined){var _0x19fcec=_(_0xfa3c7c[_0xbb10('0x13')])[_0xbb10('0x5a')]([_0x576179[_0xbb10('0x16')][_0xbb10('0x59')],_0x576179[_0xbb10('0x1c')]['id']])['map'](_0xbb10('0x5b'))[_0xbb10('0x5c')]()[_0xbb10('0x5d')]();return _0xfa3c7c[_0xbb10('0x13')][_0xbb10('0x5a')](function(_0x172be3){return _0x19fcec[_0xbb10('0x5e')](_0x172be3[_0xbb10('0x5b')])>-0x1;});}else{return _0xfa3c7c['rows'][_0xbb10('0x5a')](function(_0x218690){return _0x218690[_0xbb10('0x5b')]===parseInt(_0x576179['params']['id']);});}})['then'](respondWithResult(_0x165fe9,null))['catch'](handleError(_0x165fe9,null));};exports[_0xbb10('0x5f')]=function(_0x5a3c44,_0x4e3d6a){return respondWithRpcPromise(_0xbb10('0x60'),_0x5a3c44[_0xbb10('0x16')],routingClient)[_0xbb10('0x9')](respondWithResult(_0x4e3d6a,null))[_0xbb10('0x17')](handleError(_0x4e3d6a,null));};exports[_0xbb10('0x61')]=function(_0x24dca6,_0x33116){return respondWithRpcPromise(_0xbb10('0x62'),_0x24dca6[_0xbb10('0x16')],routingClient)['then'](respondWithResult(_0x33116,null))[_0xbb10('0x17')](handleError(_0x33116,null));};exports[_0xbb10('0x63')]=function(_0x46b6d2,_0x35b811){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x46b6d2['query'],routingClient)[_0xbb10('0x9')](respondWithResult(_0x35b811,null))[_0xbb10('0x17')](handleError(_0x35b811,null));};exports[_0xbb10('0x64')]=function(_0x32bb25){return function(_0x5ee705,_0x17d596){var _0x275bce,_0x3f0d74;var _0xf7b3e1=_[_0xbb10('0x65')](_0x32bb25);var _0x517185=_0x32bb25==='chat'?_0xbb10('0x66'):_0xbb10('0x67');return db[_0xf7b3e1+_0xbb10('0x68')]['findOne']({'raw':!![],'where':{'id':_0x5ee705[_0xbb10('0x1c')]['id']}})[_0xbb10('0x9')](function(_0x50bcc9){if(_['isNil'](_0x50bcc9)){throw new Error(_0xf7b3e1+_0xbb10('0x69'));}_0x275bce=_0x50bcc9;return db[_0xf7b3e1+_0xbb10('0x6a')][_0xbb10('0x6b')]({'where':{'id':_0x5ee705['body'][_0xbb10('0x6c')]},'include':[{'model':db[_0xf7b3e1+_0xbb10('0x6d')],'as':_0xbb10('0x6d')},{'model':db[_0xf7b3e1+_0x517185],'as':_0xbb10('0x67')}]});})[_0xbb10('0x9')](function(_0x5de006){if(_[_0xbb10('0x12')](_0x5de006)){throw new Error(_0xf7b3e1+_0xbb10('0x6e'));}_0x3f0d74=_0x5de006;return _0x5de006[_0xbb10('0x6f')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x3367d4={'uniqueid':_0x32bb25+'.'+_0x3f0d74['id']+'.'+_0x3f0d74[_0xbb10('0x6d')]['id'],'FromUserId':_0x5ee705[_0xbb10('0x30')]['id'],'type':_0xbb10('0x70')};_0x3367d4[_0xf7b3e1+_0xbb10('0x71')]=_0x3f0d74['id'];_0x3367d4[_0xf7b3e1+_0xbb10('0x72')]=_0x3f0d74[_0xbb10('0x6d')]['id'];_0x3367d4[_0xbb10('0x73')+_0xf7b3e1+_0x517185+'Id']=_0x3f0d74[_0xbb10('0x67')]['id'];_0x3367d4['To'+_0xf7b3e1+_0xbb10('0x74')]=_0x275bce['id'];return db[_0xf7b3e1+_0xbb10('0x75')][_0xbb10('0x76')](_0x3367d4);})['then'](function(){return respondWithRpcPromise('Start',{'channel':_0x32bb25,'interaction':_0x3f0d74[_0xbb10('0x6d')],'message':_0x3f0d74,'account':_0x3f0d74[_0xbb10('0x67')],'applications':[{'id':0x0,'priority':0x1,'app':_0xbb10('0x70'),'appdata':_0x275bce[_0xbb10('0x10')]+','+(_0x3f0d74[_0xbb10('0x67')]['queueTransferTimeout']||0x12c),'interval':_0xbb10('0x77')}],'transfer':!![]},routingClient);})[_0xbb10('0x9')](respondWithResult(_0x17d596,null))[_0xbb10('0x17')](handleError(_0x17d596,null));};};exports[_0xbb10('0x78')]=function(_0x19694d,_0x379d49){var _0x546db5,_0xb25e71;if(_[_0xbb10('0x12')](_0x19694d['body'][_0xbb10('0x79')])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0xc53c87=_0x19694d[_0xbb10('0x21')][_0xbb10('0x79')];var _0xa99bf5=_[_0xbb10('0x65')](_0xc53c87);var _0x556d7b=_0xc53c87===_0xbb10('0x7a')?'Website':_0xbb10('0x67');return db[_0xbb10('0x7b')]['findOne']({'raw':!![],'where':{'id':_0x19694d['params']['id'],'role':_0xbb10('0x3b')}})[_0xbb10('0x9')](function(_0x1b77c2){if(_[_0xbb10('0x12')](_0x1b77c2)){throw new Error(_0xbb10('0x7c'));}_0x546db5=_0x1b77c2;return db[_0xa99bf5+_0xbb10('0x6a')][_0xbb10('0x6b')]({'where':{'id':_0x19694d[_0xbb10('0x21')][_0xbb10('0x6c')]},'include':[{'model':db[_0xa99bf5+_0xbb10('0x6d')],'as':_0xbb10('0x6d')},{'model':db[_0xa99bf5+_0x556d7b],'as':'Account'}]});})[_0xbb10('0x9')](function(_0x3eeceb){if(_[_0xbb10('0x12')](_0x3eeceb)){throw new Error(_0xa99bf5+_0xbb10('0x6e'));}_0xb25e71=_0x3eeceb;return _0x3eeceb[_0xbb10('0x6f')]({'read':0x0,'readAt':null,'UserId':null});})[_0xbb10('0x9')](function(){var _0xfefa17={'uniqueid':_0xc53c87+'.'+_0xb25e71['id']+'.'+_0xb25e71[_0xbb10('0x6d')]['id'],'FromUserId':_0x19694d[_0xbb10('0x30')]['id'],'type':_0xbb10('0x3b'),'ToUserId':_0x546db5['id']};_0xfefa17[_0xa99bf5+_0xbb10('0x71')]=_0xb25e71['id'];_0xfefa17[_0xa99bf5+_0xbb10('0x72')]=_0xb25e71['Interaction']['id'];_0xfefa17[_0xbb10('0x73')+_0xa99bf5+_0x556d7b+'Id']=_0xb25e71['Account']['id'];return db[_0xa99bf5+_0xbb10('0x75')][_0xbb10('0x76')](_0xfefa17);})[_0xbb10('0x9')](function(){return respondWithRpcPromise(_0xbb10('0x7d'),{'channel':_0xc53c87,'interaction':_0xb25e71[_0xbb10('0x6d')],'message':_0xb25e71,'account':_0xb25e71['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0xbb10('0x3b'),'appdata':_0x546db5[_0xbb10('0x10')]+','+(_0xb25e71[_0xbb10('0x67')][_0xbb10('0x7e')]||0x12c),'interval':_0xbb10('0x77')}],'transfer':!![]},routingClient);})[_0xbb10('0x9')](respondWithResult(_0x379d49,null))['catch'](handleError(_0x379d49,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 1e819cd..887ec42 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 _0x5150=['show','/:id/run','run','create','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x5150,0x173));var _0x0515=function(_0x1a595a,_0x263824){_0x1a595a=_0x1a595a-0x0;var _0x33f008=_0x5150[_0x1a595a];return _0x33f008;};'use strict';var multer=require(_0x0515('0x0'));var util=require(_0x0515('0x1'));var path=require('path');var timeout=require(_0x0515('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x0515('0x3'));var auth=require(_0x0515('0x4'));var interaction=require(_0x0515('0x5'));var config=require('../../config/environment');var controller=require('./schedule.controller');router[_0x0515('0x6')]('/',auth[_0x0515('0x7')](),controller[_0x0515('0x8')]);router[_0x0515('0x6')]('/:id',auth[_0x0515('0x7')](),controller[_0x0515('0x9')]);router[_0x0515('0x6')](_0x0515('0xa'),auth[_0x0515('0x7')](),controller[_0x0515('0xb')]);router['post']('/',auth[_0x0515('0x7')](),controller[_0x0515('0xc')]);router[_0x0515('0xd')](_0x0515('0xe'),auth['isAuthenticated'](),controller[_0x0515('0xf')]);router[_0x0515('0x10')](_0x0515('0xe'),auth[_0x0515('0x7')](),controller[_0x0515('0x11')]);module[_0x0515('0x12')]=router; \ No newline at end of file +var _0xd709=['Router','../../components/auth/service','../../components/interaction/service','./schedule.controller','isAuthenticated','index','get','/:id','show','run','put','update','destroy','exports','util','path','connect-timeout','express'];(function(_0x5eb06f,_0x57f2de){var _0x2d51df=function(_0x20c3a8){while(--_0x20c3a8){_0x5eb06f['push'](_0x5eb06f['shift']());}};_0x2d51df(++_0x57f2de);}(_0xd709,0x1f4));var _0x9d70=function(_0x424b65,_0x411d03){_0x424b65=_0x424b65-0x0;var _0x110cea=_0xd709[_0x424b65];return _0x110cea;};'use strict';var multer=require('multer');var util=require(_0x9d70('0x0'));var path=require(_0x9d70('0x1'));var timeout=require(_0x9d70('0x2'));var express=require(_0x9d70('0x3'));var router=express[_0x9d70('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9d70('0x5'));var interaction=require(_0x9d70('0x6'));var config=require('../../config/environment');var controller=require(_0x9d70('0x7'));router['get']('/',auth[_0x9d70('0x8')](),controller[_0x9d70('0x9')]);router[_0x9d70('0xa')](_0x9d70('0xb'),auth[_0x9d70('0x8')](),controller[_0x9d70('0xc')]);router[_0x9d70('0xa')]('/:id/run',auth[_0x9d70('0x8')](),controller[_0x9d70('0xd')]);router['post']('/',auth[_0x9d70('0x8')](),controller['create']);router[_0x9d70('0xe')](_0x9d70('0xb'),auth[_0x9d70('0x8')](),controller[_0x9d70('0xf')]);router['delete']('/:id',auth[_0x9d70('0x8')](),controller[_0x9d70('0x10')]);module[_0x9d70('0x11')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 84410ef..450d3d4 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 _0xe827=['years','months','weeks','days','hours','minutes','csv','xlsx','custom','TEXT','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM'];(function(_0x2e56cf,_0x32a94a){var _0x2e4d87=function(_0xcab258){while(--_0xcab258){_0x2e56cf['push'](_0x2e56cf['shift']());}};_0x2e4d87(++_0x32a94a);}(_0xe827,0x191));var _0x7e82=function(_0xcb7b05,_0x1aff01){_0xcb7b05=_0xcb7b05-0x0;var _0x23ef2a=_0xe827[_0xcb7b05];return _0x23ef2a;};'use strict';var Sequelize=require('sequelize');module[_0x7e82('0x0')]={'name':{'type':Sequelize[_0x7e82('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x7e82('0x1')]},'active':{'type':Sequelize[_0x7e82('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x7e82('0x1')],'allowNull':![],'defaultValue':_0x7e82('0x3')},'startAt':{'type':Sequelize[_0x7e82('0x4')],'allowNull':![]},'endAt':{'type':Sequelize[_0x7e82('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x7e82('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x7e82('0x6')](_0x7e82('0x7'),'quarters',_0x7e82('0x8'),_0x7e82('0x9'),_0x7e82('0xa'),_0x7e82('0xb'),_0x7e82('0xc')),'allowNull':![],'defaultValue':'days'},'output':{'type':Sequelize[_0x7e82('0x6')](_0x7e82('0xd'),'pdf',_0x7e82('0xe')),'allowNull':![],'defaultValue':_0x7e82('0xd')},'type':{'type':Sequelize['ENUM'](_0x7e82('0xf'),'default'),'allowNull':![],'defaultValue':_0x7e82('0xf')},'sendMail':{'type':Sequelize[_0x7e82('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0x7e82('0x1')]},'cc':{'type':Sequelize[_0x7e82('0x10')]},'bcc':{'type':Sequelize[_0x7e82('0x10')]},'sendIfEmpty':{'type':Sequelize[_0x7e82('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0xf932=['0\x200\x20*\x20*\x20*','INTEGER','ENUM','years','weeks','days','minutes','pdf','xlsx','csv','default','custom','TEXT','sequelize','exports','STRING','BOOLEAN'];(function(_0x5a9d09,_0x555798){var _0x7f892d=function(_0x25a086){while(--_0x25a086){_0x5a9d09['push'](_0x5a9d09['shift']());}};_0x7f892d(++_0x555798);}(_0xf932,0x194));var _0x2f93=function(_0x3d3e0a,_0x5b246d){_0x3d3e0a=_0x3d3e0a-0x0;var _0x3955d3=_0xf932[_0x3d3e0a];return _0x3955d3;};'use strict';var Sequelize=require(_0x2f93('0x0'));module[_0x2f93('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x2f93('0x2')]},'active':{'type':Sequelize[_0x2f93('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x2f93('0x2')],'allowNull':![],'defaultValue':_0x2f93('0x4')},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x2f93('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x2f93('0x6')](_0x2f93('0x7'),'quarters','months',_0x2f93('0x8'),_0x2f93('0x9'),'hours',_0x2f93('0xa')),'allowNull':![],'defaultValue':_0x2f93('0x9')},'output':{'type':Sequelize[_0x2f93('0x6')]('csv',_0x2f93('0xb'),_0x2f93('0xc')),'allowNull':![],'defaultValue':_0x2f93('0xd')},'type':{'type':Sequelize['ENUM']('custom',_0x2f93('0xe')),'allowNull':![],'defaultValue':_0x2f93('0xf')},'sendMail':{'type':Sequelize[_0x2f93('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x2f93('0x2')]},'cc':{'type':Sequelize[_0x2f93('0x10')]},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize[_0x2f93('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 5e71ed7..877d3a9 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 _0xda56=['update','then','destroy','get','UserProfileResource','sendStatus','name','send','Schedule','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','sort','where','pick','filter','merge','map','VIRTUAL','includeAll','include','findAll','rows','catch','rawAttributes','options','find','create','user','role','Scheduler','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','run','../../config/schedule','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','undefined','limit','count','set','json','apply','reject'];(function(_0x2a84d1,_0x2e6209){var _0x2eaadb=function(_0x21f65f){while(--_0x21f65f){_0x2a84d1['push'](_0x2a84d1['shift']());}};_0x2eaadb(++_0x2e6209);}(_0xda56,0x80));var _0x6da5=function(_0x337dd9,_0x54e3f3){_0x337dd9=_0x337dd9-0x0;var _0x20f4fc=_0xda56[_0x337dd9];return _0x20f4fc;};'use strict';var emlformat=require(_0x6da5('0x0'));var rimraf=require(_0x6da5('0x1'));var zipdir=require(_0x6da5('0x2'));var jsonpatch=require(_0x6da5('0x3'));var rp=require(_0x6da5('0x4'));var moment=require(_0x6da5('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x6da5('0x6'));var util=require(_0x6da5('0x7'));var path=require(_0x6da5('0x8'));var sox=require(_0x6da5('0x9'));var csv=require(_0x6da5('0xa'));var ejs=require(_0x6da5('0xb'));var fs=require('fs');var fs_extra=require(_0x6da5('0xc'));var _=require(_0x6da5('0xd'));var squel=require('squel');var crypto=require(_0x6da5('0xe'));var jsforce=require(_0x6da5('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x6da5('0xa'));var querystring=require(_0x6da5('0x10'));var Papa=require(_0x6da5('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6da5('0x12'));var as=require(_0x6da5('0x13'));var hardwareService=require(_0x6da5('0x14'));var logger=require(_0x6da5('0x15'))(_0x6da5('0x16'));var utils=require(_0x6da5('0x17'));var config=require(_0x6da5('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x6da5('0x19'))['db'];function respondWithStatusCode(_0x3c833f,_0x59500a){_0x59500a=_0x59500a||0xcc;return function(_0x308f97){if(_0x308f97){return _0x3c833f['sendStatus'](_0x59500a);}return _0x3c833f[_0x6da5('0x1a')](_0x59500a)[_0x6da5('0x1b')]();};}function respondWithResult(_0x16953e,_0x330a42){_0x330a42=_0x330a42||0xc8;return function(_0x2f7d40){if(_0x2f7d40){return _0x16953e[_0x6da5('0x1a')](_0x330a42)['json'](_0x2f7d40);}};}function respondWithFilteredResult(_0x451f44,_0x3c13fc){return function(_0x2dae0f){if(_0x2dae0f){var _0x1d41f5=typeof _0x3c13fc[_0x6da5('0x1c')]===_0x6da5('0x1d')&&typeof _0x3c13fc[_0x6da5('0x1e')]===_0x6da5('0x1d');var _0x164988=_0x2dae0f[_0x6da5('0x1f')];var _0x3b51bd=_0x1d41f5?0x0:_0x3c13fc[_0x6da5('0x1c')];var _0xa40d00=_0x1d41f5?_0x2dae0f['count']:_0x3c13fc['offset']+_0x3c13fc[_0x6da5('0x1e')];var _0x973777;if(_0xa40d00>=_0x164988){_0xa40d00=_0x164988;_0x973777=0xc8;}else{_0x973777=0xce;}_0x451f44[_0x6da5('0x1a')](_0x973777);return _0x451f44[_0x6da5('0x20')]('Content-Range',_0x3b51bd+'-'+_0xa40d00+'/'+_0x164988)[_0x6da5('0x21')](_0x2dae0f);}return null;};}function patchUpdates(_0x4d1dd9){return function(_0x5e8136){try{jsonpatch[_0x6da5('0x22')](_0x5e8136,_0x4d1dd9,!![]);}catch(_0x5d5d5e){return BPromise[_0x6da5('0x23')](_0x5d5d5e);}return _0x5e8136['save']();};}function saveUpdates(_0x580d45,_0x56dd6e){return function(_0x480c7d){if(_0x480c7d){return _0x480c7d[_0x6da5('0x24')](_0x580d45)[_0x6da5('0x25')](function(_0x9ae910){return _0x9ae910;});}return null;};}function removeEntity(_0x433ded,_0x39eeed){return function(_0x5935f4){if(_0x5935f4){return _0x5935f4[_0x6da5('0x26')]()['then'](function(){var _0x4df7a3=_0x5935f4[_0x6da5('0x27')]({'plain':!![]});var _0x57fcb5='Scheduler';return db[_0x6da5('0x28')]['destroy']({'where':{'type':_0x57fcb5,'resourceId':_0x4df7a3['id']}})[_0x6da5('0x25')](function(){return _0x5935f4;});})['then'](function(){_0x433ded[_0x6da5('0x1a')](0xcc)[_0x6da5('0x1b')]();});}};}function handleEntityNotFound(_0x13c660,_0x30509f){return function(_0xd991eb){if(!_0xd991eb){_0x13c660[_0x6da5('0x29')](0x194);}return _0xd991eb;};}function handleError(_0x59c80b,_0x5e0a8e){_0x5e0a8e=_0x5e0a8e||0x1f4;return function(_0x5ab024){logger['error'](_0x5ab024['stack']);if(_0x5ab024['name']){delete _0x5ab024[_0x6da5('0x2a')];}_0x59c80b[_0x6da5('0x1a')](_0x5e0a8e)[_0x6da5('0x2b')](_0x5ab024);};}exports['index']=function(_0x3da242,_0x52a561){var _0x3eb441={},_0xe8887c={},_0x2b8d2d={'count':0x0,'rows':[]};var _0x556e18=_['map'](db[_0x6da5('0x2c')]['rawAttributes'],function(_0xa56b5d){return{'name':_0xa56b5d['fieldName'],'type':_0xa56b5d[_0x6da5('0x2d')]['key']};});_0xe8887c[_0x6da5('0x2e')]=_['map'](_0x556e18,_0x6da5('0x2a'));_0xe8887c[_0x6da5('0x2f')]=_[_0x6da5('0x30')](_0x3da242['query']);_0xe8887c[_0x6da5('0x31')]=_['intersection'](_0xe8887c[_0x6da5('0x2e')],_0xe8887c['query']);_0x3eb441[_0x6da5('0x32')]=_[_0x6da5('0x33')](_0xe8887c['model'],qs[_0x6da5('0x34')](_0x3da242[_0x6da5('0x2f')][_0x6da5('0x34')]));_0x3eb441[_0x6da5('0x32')]=_0x3eb441[_0x6da5('0x32')][_0x6da5('0x35')]?_0x3eb441['attributes']:_0xe8887c[_0x6da5('0x2e')];if(!_0x3da242[_0x6da5('0x2f')][_0x6da5('0x36')]('nolimit')){_0x3eb441[_0x6da5('0x1e')]=qs[_0x6da5('0x1e')](_0x3da242[_0x6da5('0x2f')][_0x6da5('0x1e')]);_0x3eb441[_0x6da5('0x1c')]=qs[_0x6da5('0x1c')](_0x3da242[_0x6da5('0x2f')][_0x6da5('0x1c')]);}_0x3eb441['order']=qs[_0x6da5('0x37')](_0x3da242[_0x6da5('0x2f')][_0x6da5('0x37')]);_0x3eb441[_0x6da5('0x38')]=qs['filters'](_[_0x6da5('0x39')](_0x3da242[_0x6da5('0x2f')],_0xe8887c[_0x6da5('0x31')]),_0x556e18);if(_0x3da242[_0x6da5('0x2f')][_0x6da5('0x3a')]){_0x3eb441[_0x6da5('0x38')]=_[_0x6da5('0x3b')](_0x3eb441[_0x6da5('0x38')],{'$or':_[_0x6da5('0x3c')](_0x556e18,function(_0x405c63){if(_0x405c63[_0x6da5('0x2d')]!==_0x6da5('0x3d')){var _0x11f2b6={};_0x11f2b6[_0x405c63['name']]={'$like':'%'+_0x3da242[_0x6da5('0x2f')][_0x6da5('0x3a')]+'%'};return _0x11f2b6;}})});}_0x3eb441=_[_0x6da5('0x3b')]({},_0x3eb441,_0x3da242['options']);var _0x2a665a={'where':_0x3eb441[_0x6da5('0x38')]};return db[_0x6da5('0x2c')][_0x6da5('0x1f')](_0x2a665a)['then'](function(_0xf5ae98){_0x2b8d2d[_0x6da5('0x1f')]=_0xf5ae98;if(_0x3da242['query'][_0x6da5('0x3e')]){_0x3eb441[_0x6da5('0x3f')]=[{'all':!![]}];}return db[_0x6da5('0x2c')][_0x6da5('0x40')](_0x3eb441);})[_0x6da5('0x25')](function(_0x4f216c){_0x2b8d2d[_0x6da5('0x41')]=_0x4f216c;return _0x2b8d2d;})[_0x6da5('0x25')](respondWithFilteredResult(_0x52a561,_0x3eb441))[_0x6da5('0x42')](handleError(_0x52a561,null));};exports['show']=function(_0x43c73e,_0x55a873){var _0x54176b={'raw':![],'where':{'id':_0x43c73e['params']['id']}},_0x282791={};_0x282791['model']=_['keys'](db[_0x6da5('0x2c')][_0x6da5('0x43')]);_0x282791['query']=_[_0x6da5('0x30')](_0x43c73e[_0x6da5('0x2f')]);_0x282791[_0x6da5('0x31')]=_[_0x6da5('0x33')](_0x282791[_0x6da5('0x2e')],_0x282791[_0x6da5('0x2f')]);_0x54176b[_0x6da5('0x32')]=_[_0x6da5('0x33')](_0x282791[_0x6da5('0x2e')],qs[_0x6da5('0x34')](_0x43c73e[_0x6da5('0x2f')][_0x6da5('0x34')]));_0x54176b[_0x6da5('0x32')]=_0x54176b[_0x6da5('0x32')][_0x6da5('0x35')]?_0x54176b[_0x6da5('0x32')]:_0x282791[_0x6da5('0x2e')];if(_0x43c73e['query'][_0x6da5('0x3e')]){_0x54176b['include']=[{'all':!![]}];}_0x54176b=_[_0x6da5('0x3b')]({},_0x54176b,_0x43c73e[_0x6da5('0x44')]);return db[_0x6da5('0x2c')][_0x6da5('0x45')](_0x54176b)[_0x6da5('0x25')](handleEntityNotFound(_0x55a873,null))[_0x6da5('0x25')](respondWithResult(_0x55a873,null))[_0x6da5('0x42')](handleError(_0x55a873,null));};exports['create']=function(_0x37d66d,_0x31cdb6){return db[_0x6da5('0x2c')][_0x6da5('0x46')](_0x37d66d['body'],{})['then'](function(_0x165d87){var _0x1ef3d8=_0x37d66d[_0x6da5('0x47')][_0x6da5('0x27')]({'plain':!![]});if(!_0x1ef3d8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1ef3d8[_0x6da5('0x48')]==='user'){var _0x4a2581=_0x165d87[_0x6da5('0x27')]({'plain':!![]});var _0x5a6a9a=_0x6da5('0x49');return db[_0x6da5('0x4a')][_0x6da5('0x45')]({'where':{'name':_0x5a6a9a,'userProfileId':_0x1ef3d8['userProfileId']},'raw':!![]})[_0x6da5('0x25')](function(_0x1a02d7){if(_0x1a02d7&&_0x1a02d7[_0x6da5('0x4b')]===0x0){return db['UserProfileResource'][_0x6da5('0x46')]({'name':_0x4a2581[_0x6da5('0x2a')],'resourceId':_0x4a2581['id'],'type':_0x1a02d7[_0x6da5('0x2a')],'sectionId':_0x1a02d7['id']},{})[_0x6da5('0x25')](function(){return _0x165d87;});}else{return _0x165d87;}})[_0x6da5('0x42')](function(_0x48038f){logger[_0x6da5('0x4c')](_0x6da5('0x4d'),_0x48038f);throw _0x48038f;});}return _0x165d87;})[_0x6da5('0x25')](respondWithResult(_0x31cdb6,0xc9))[_0x6da5('0x42')](handleError(_0x31cdb6,null));};exports['update']=function(_0x3f738d,_0x2a4a17){if(_0x3f738d[_0x6da5('0x4e')]['id']){delete _0x3f738d['body']['id'];}return db[_0x6da5('0x2c')][_0x6da5('0x45')]({'where':{'id':_0x3f738d['params']['id']}})[_0x6da5('0x25')](handleEntityNotFound(_0x2a4a17,null))[_0x6da5('0x25')](saveUpdates(_0x3f738d[_0x6da5('0x4e')],null))[_0x6da5('0x25')](respondWithResult(_0x2a4a17,null))[_0x6da5('0x42')](handleError(_0x2a4a17,null));};exports[_0x6da5('0x26')]=function(_0x132f8c,_0x6cfa9a){return db[_0x6da5('0x2c')][_0x6da5('0x45')]({'where':{'id':_0x132f8c[_0x6da5('0x4f')]['id']}})[_0x6da5('0x25')](handleEntityNotFound(_0x6cfa9a,null))[_0x6da5('0x25')](removeEntity(_0x6cfa9a,null))[_0x6da5('0x42')](handleError(_0x6cfa9a,null));};exports[_0x6da5('0x50')]=function(_0x22ffa9,_0xe30fce,_0x56096b){var _0x5368d4=require(_0x6da5('0x51'));return db['Schedule'][_0x6da5('0x45')]({'where':{'id':_0x22ffa9[_0x6da5('0x4f')]['id']},'raw':!![]})[_0x6da5('0x25')](handleEntityNotFound(_0xe30fce,null))['then'](function(){_0x5368d4[_0x6da5('0x50')](_0x22ffa9[_0x6da5('0x4f')]['id']);})[_0x6da5('0x25')](respondWithStatusCode(_0xe30fce,null))[_0x6da5('0x42')](handleError(_0xe30fce,null));}; \ No newline at end of file +var _0x884c=['zip-dir','fast-json-patch','request-promise','bluebird','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','then','destroy','get','Scheduler','UserProfileResource','sendStatus','error','stack','name','send','index','map','Schedule','fieldName','type','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','intersection','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','../../config/schedule','run','eml-format','rimraf'];(function(_0x42f2a5,_0x3fd9a3){var _0x56d5b6=function(_0x53e87b){while(--_0x53e87b){_0x42f2a5['push'](_0x42f2a5['shift']());}};_0x56d5b6(++_0x3fd9a3);}(_0x884c,0x142));var _0xc884=function(_0x5bb3a6,_0xc89ee3){_0x5bb3a6=_0x5bb3a6-0x0;var _0x279273=_0x884c[_0x5bb3a6];return _0x279273;};'use strict';var emlformat=require(_0xc884('0x0'));var rimraf=require(_0xc884('0x1'));var zipdir=require(_0xc884('0x2'));var jsonpatch=require(_0xc884('0x3'));var rp=require(_0xc884('0x4'));var moment=require('moment');var BPromise=require(_0xc884('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc884('0x6'));var squel=require(_0xc884('0x7'));var crypto=require(_0xc884('0x8'));var jsforce=require(_0xc884('0x9'));var deskjs=require(_0xc884('0xa'));var toCsv=require(_0xc884('0xb'));var querystring=require(_0xc884('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xc884('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xc884('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc884('0xf'))('api');var utils=require(_0xc884('0x10'));var config=require(_0xc884('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0xc884('0x12'))['db'];function respondWithStatusCode(_0x5247be,_0x18b3b6){_0x18b3b6=_0x18b3b6||0xcc;return function(_0x300657){if(_0x300657){return _0x5247be['sendStatus'](_0x18b3b6);}return _0x5247be[_0xc884('0x13')](_0x18b3b6)[_0xc884('0x14')]();};}function respondWithResult(_0xd14464,_0x302b80){_0x302b80=_0x302b80||0xc8;return function(_0x1f83f3){if(_0x1f83f3){return _0xd14464[_0xc884('0x13')](_0x302b80)['json'](_0x1f83f3);}};}function respondWithFilteredResult(_0x31a714,_0x32f151){return function(_0x2855d4){if(_0x2855d4){var _0xa4a24d=typeof _0x32f151[_0xc884('0x15')]==='undefined'&&typeof _0x32f151[_0xc884('0x16')]===_0xc884('0x17');var _0x27eb17=_0x2855d4[_0xc884('0x18')];var _0xf264e0=_0xa4a24d?0x0:_0x32f151[_0xc884('0x15')];var _0x446af9=_0xa4a24d?_0x2855d4[_0xc884('0x18')]:_0x32f151[_0xc884('0x15')]+_0x32f151[_0xc884('0x16')];var _0x111ccf;if(_0x446af9>=_0x27eb17){_0x446af9=_0x27eb17;_0x111ccf=0xc8;}else{_0x111ccf=0xce;}_0x31a714['status'](_0x111ccf);return _0x31a714[_0xc884('0x19')](_0xc884('0x1a'),_0xf264e0+'-'+_0x446af9+'/'+_0x27eb17)[_0xc884('0x1b')](_0x2855d4);}return null;};}function patchUpdates(_0x5e933b){return function(_0x300ed8){try{jsonpatch[_0xc884('0x1c')](_0x300ed8,_0x5e933b,!![]);}catch(_0x380ee8){return BPromise[_0xc884('0x1d')](_0x380ee8);}return _0x300ed8[_0xc884('0x1e')]();};}function saveUpdates(_0x1c86bf,_0x4113da){return function(_0x53cfe0){if(_0x53cfe0){return _0x53cfe0[_0xc884('0x1f')](_0x1c86bf)[_0xc884('0x20')](function(_0x71ce6){return _0x71ce6;});}return null;};}function removeEntity(_0x5d5336,_0x20dde9){return function(_0x1fe593){if(_0x1fe593){return _0x1fe593[_0xc884('0x21')]()[_0xc884('0x20')](function(){var _0x3ac4c0=_0x1fe593[_0xc884('0x22')]({'plain':!![]});var _0x2f2284=_0xc884('0x23');return db[_0xc884('0x24')]['destroy']({'where':{'type':_0x2f2284,'resourceId':_0x3ac4c0['id']}})['then'](function(){return _0x1fe593;});})[_0xc884('0x20')](function(){_0x5d5336[_0xc884('0x13')](0xcc)[_0xc884('0x14')]();});}};}function handleEntityNotFound(_0x40f0c7,_0x2a2bcb){return function(_0xa46813){if(!_0xa46813){_0x40f0c7[_0xc884('0x25')](0x194);}return _0xa46813;};}function handleError(_0x44bd91,_0x4beb0c){_0x4beb0c=_0x4beb0c||0x1f4;return function(_0x3dfb8f){logger[_0xc884('0x26')](_0x3dfb8f[_0xc884('0x27')]);if(_0x3dfb8f[_0xc884('0x28')]){delete _0x3dfb8f[_0xc884('0x28')];}_0x44bd91[_0xc884('0x13')](_0x4beb0c)[_0xc884('0x29')](_0x3dfb8f);};}exports[_0xc884('0x2a')]=function(_0x21a42d,_0x1faaa7){var _0x33482a={},_0x3bf2fb={},_0x2ee0c5={'count':0x0,'rows':[]};var _0x5b67b4=_[_0xc884('0x2b')](db[_0xc884('0x2c')]['rawAttributes'],function(_0x5b7f4f){return{'name':_0x5b7f4f[_0xc884('0x2d')],'type':_0x5b7f4f[_0xc884('0x2e')]['key']};});_0x3bf2fb[_0xc884('0x2f')]=_[_0xc884('0x2b')](_0x5b67b4,_0xc884('0x28'));_0x3bf2fb[_0xc884('0x30')]=_[_0xc884('0x31')](_0x21a42d[_0xc884('0x30')]);_0x3bf2fb[_0xc884('0x32')]=_['intersection'](_0x3bf2fb['model'],_0x3bf2fb['query']);_0x33482a[_0xc884('0x33')]=_['intersection'](_0x3bf2fb[_0xc884('0x2f')],qs[_0xc884('0x34')](_0x21a42d[_0xc884('0x30')][_0xc884('0x34')]));_0x33482a[_0xc884('0x33')]=_0x33482a['attributes'][_0xc884('0x35')]?_0x33482a['attributes']:_0x3bf2fb[_0xc884('0x2f')];if(!_0x21a42d[_0xc884('0x30')][_0xc884('0x36')](_0xc884('0x37'))){_0x33482a[_0xc884('0x16')]=qs[_0xc884('0x16')](_0x21a42d[_0xc884('0x30')][_0xc884('0x16')]);_0x33482a[_0xc884('0x15')]=qs['offset'](_0x21a42d[_0xc884('0x30')][_0xc884('0x15')]);}_0x33482a[_0xc884('0x38')]=qs[_0xc884('0x39')](_0x21a42d['query'][_0xc884('0x39')]);_0x33482a[_0xc884('0x3a')]=qs[_0xc884('0x32')](_[_0xc884('0x3b')](_0x21a42d['query'],_0x3bf2fb['filters']),_0x5b67b4);if(_0x21a42d[_0xc884('0x30')][_0xc884('0x3c')]){_0x33482a[_0xc884('0x3a')]=_[_0xc884('0x3d')](_0x33482a['where'],{'$or':_[_0xc884('0x2b')](_0x5b67b4,function(_0x253f69){if(_0x253f69['type']!==_0xc884('0x3e')){var _0x16a35c={};_0x16a35c[_0x253f69[_0xc884('0x28')]]={'$like':'%'+_0x21a42d[_0xc884('0x30')][_0xc884('0x3c')]+'%'};return _0x16a35c;}})});}_0x33482a=_[_0xc884('0x3d')]({},_0x33482a,_0x21a42d[_0xc884('0x3f')]);var _0x55aa2d={'where':_0x33482a[_0xc884('0x3a')]};return db[_0xc884('0x2c')][_0xc884('0x18')](_0x55aa2d)[_0xc884('0x20')](function(_0x476a8b){_0x2ee0c5[_0xc884('0x18')]=_0x476a8b;if(_0x21a42d[_0xc884('0x30')]['includeAll']){_0x33482a[_0xc884('0x40')]=[{'all':!![]}];}return db[_0xc884('0x2c')][_0xc884('0x41')](_0x33482a);})[_0xc884('0x20')](function(_0x31c527){_0x2ee0c5[_0xc884('0x42')]=_0x31c527;return _0x2ee0c5;})[_0xc884('0x20')](respondWithFilteredResult(_0x1faaa7,_0x33482a))[_0xc884('0x43')](handleError(_0x1faaa7,null));};exports[_0xc884('0x44')]=function(_0x13ebef,_0x29aec1){var _0x5ec48a={'raw':![],'where':{'id':_0x13ebef[_0xc884('0x45')]['id']}},_0x526bd6={};_0x526bd6[_0xc884('0x2f')]=_[_0xc884('0x31')](db[_0xc884('0x2c')]['rawAttributes']);_0x526bd6[_0xc884('0x30')]=_[_0xc884('0x31')](_0x13ebef[_0xc884('0x30')]);_0x526bd6['filters']=_[_0xc884('0x46')](_0x526bd6[_0xc884('0x2f')],_0x526bd6[_0xc884('0x30')]);_0x5ec48a['attributes']=_[_0xc884('0x46')](_0x526bd6[_0xc884('0x2f')],qs[_0xc884('0x34')](_0x13ebef[_0xc884('0x30')][_0xc884('0x34')]));_0x5ec48a[_0xc884('0x33')]=_0x5ec48a[_0xc884('0x33')][_0xc884('0x35')]?_0x5ec48a[_0xc884('0x33')]:_0x526bd6[_0xc884('0x2f')];if(_0x13ebef[_0xc884('0x30')]['includeAll']){_0x5ec48a[_0xc884('0x40')]=[{'all':!![]}];}_0x5ec48a=_['merge']({},_0x5ec48a,_0x13ebef[_0xc884('0x3f')]);return db[_0xc884('0x2c')][_0xc884('0x47')](_0x5ec48a)['then'](handleEntityNotFound(_0x29aec1,null))['then'](respondWithResult(_0x29aec1,null))[_0xc884('0x43')](handleError(_0x29aec1,null));};exports['create']=function(_0x1ac905,_0x40cc2d){return db[_0xc884('0x2c')][_0xc884('0x48')](_0x1ac905['body'],{})[_0xc884('0x20')](function(_0x25a7fe){var _0x299c8d=_0x1ac905['user'][_0xc884('0x22')]({'plain':!![]});if(!_0x299c8d)throw new Error(_0xc884('0x49'));if(_0x299c8d[_0xc884('0x4a')]===_0xc884('0x4b')){var _0xc168ab=_0x25a7fe['get']({'plain':!![]});var _0x148e2c='Scheduler';return db[_0xc884('0x4c')]['find']({'where':{'name':_0x148e2c,'userProfileId':_0x299c8d['userProfileId']},'raw':!![]})[_0xc884('0x20')](function(_0x5234c0){if(_0x5234c0&&_0x5234c0['autoAssociation']===0x0){return db['UserProfileResource'][_0xc884('0x48')]({'name':_0xc168ab[_0xc884('0x28')],'resourceId':_0xc168ab['id'],'type':_0x5234c0[_0xc884('0x28')],'sectionId':_0x5234c0['id']},{})[_0xc884('0x20')](function(){return _0x25a7fe;});}else{return _0x25a7fe;}})[_0xc884('0x43')](function(_0x507390){logger[_0xc884('0x26')](_0xc884('0x4d'),_0x507390);throw _0x507390;});}return _0x25a7fe;})[_0xc884('0x20')](respondWithResult(_0x40cc2d,0xc9))[_0xc884('0x43')](handleError(_0x40cc2d,null));};exports[_0xc884('0x1f')]=function(_0xfb9bbe,_0x7fd73c){if(_0xfb9bbe[_0xc884('0x4e')]['id']){delete _0xfb9bbe[_0xc884('0x4e')]['id'];}return db['Schedule'][_0xc884('0x47')]({'where':{'id':_0xfb9bbe[_0xc884('0x45')]['id']}})['then'](handleEntityNotFound(_0x7fd73c,null))[_0xc884('0x20')](saveUpdates(_0xfb9bbe[_0xc884('0x4e')],null))['then'](respondWithResult(_0x7fd73c,null))[_0xc884('0x43')](handleError(_0x7fd73c,null));};exports[_0xc884('0x21')]=function(_0x4f72fd,_0x1ea470){return db[_0xc884('0x2c')]['find']({'where':{'id':_0x4f72fd[_0xc884('0x45')]['id']}})[_0xc884('0x20')](handleEntityNotFound(_0x1ea470,null))[_0xc884('0x20')](removeEntity(_0x1ea470,null))['catch'](handleError(_0x1ea470,null));};exports['run']=function(_0x575068,_0x4a5941,_0x48187f){var _0x77748f=require(_0xc884('0x4f'));return db[_0xc884('0x2c')]['find']({'where':{'id':_0x575068['params']['id']},'raw':!![]})[_0xc884('0x20')](handleEntityNotFound(_0x4a5941,null))[_0xc884('0x20')](function(){_0x77748f[_0xc884('0x50')](_0x575068[_0xc884('0x45')]['id']);})[_0xc884('0x20')](respondWithStatusCode(_0x4a5941,null))[_0xc884('0x43')](handleError(_0x4a5941,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 3abfd63..0fe3ab8 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 _0x3c87=['define','Schedule','tools_schedules','../../config/logger','api','bluebird','path','../../config/environment','./schedule.attributes'];(function(_0x3c8909,_0x145aa7){var _0x51dfa8=function(_0x23f07a){while(--_0x23f07a){_0x3c8909['push'](_0x3c8909['shift']());}};_0x51dfa8(++_0x145aa7);}(_0x3c87,0x198));var _0x73c8=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0x3c87[_0x33032e];return _0x13316b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x73c8('0x0'))(_0x73c8('0x1'));var moment=require('moment');var BPromise=require(_0x73c8('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x73c8('0x3'));var rimraf=require('rimraf');var config=require(_0x73c8('0x4'));var attributes=require(_0x73c8('0x5'));module['exports']=function(_0x55d573,_0x1874dc){return _0x55d573[_0x73c8('0x6')](_0x73c8('0x7'),attributes,{'tableName':_0x73c8('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaa3b=['rimraf','../../config/environment','./schedule.attributes','exports','define','Schedule','tools_schedules','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x472ca8,_0x2c8c37){var _0x14c783=function(_0x1689cf){while(--_0x1689cf){_0x472ca8['push'](_0x472ca8['shift']());}};_0x14c783(++_0x2c8c37);}(_0xaa3b,0x181));var _0xbaa3=function(_0x1c6664,_0x45566e){_0x1c6664=_0x1c6664-0x0;var _0x33124b=_0xaa3b[_0x1c6664];return _0x33124b;};'use strict';var _=require(_0xbaa3('0x0'));var util=require(_0xbaa3('0x1'));var logger=require(_0xbaa3('0x2'))(_0xbaa3('0x3'));var moment=require(_0xbaa3('0x4'));var BPromise=require(_0xbaa3('0x5'));var rp=require(_0xbaa3('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbaa3('0x7'));var config=require(_0xbaa3('0x8'));var attributes=require(_0xbaa3('0x9'));module[_0xbaa3('0xa')]=function(_0x1f95ad,_0x2e69bd){return _0x1f95ad[_0xbaa3('0xb')](_0xbaa3('0xc'),attributes,{'tableName':_0xbaa3('0xd'),'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 776aa0a..c745fff 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 _0xec7c=['code','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','error'];(function(_0x2c7b5c,_0x331adf){var _0x1df5f3=function(_0x4fc30b){while(--_0x4fc30b){_0x2c7b5c['push'](_0x2c7b5c['shift']());}};_0x1df5f3(++_0x331adf);}(_0xec7c,0x163));var _0xcec7=function(_0x239b5e,_0x208a3f){_0x239b5e=_0x239b5e-0x0;var _0x577f3d=_0xec7c[_0x239b5e];return _0x577f3d;};'use strict';var _=require(_0xcec7('0x0'));var util=require(_0xcec7('0x1'));var moment=require('moment');var BPromise=require(_0xcec7('0x2'));var rs=require(_0xcec7('0x3'));var fs=require('fs');var Redis=require(_0xcec7('0x4'));var db=require(_0xcec7('0x5'))['db'];var utils=require(_0xcec7('0x6'));var logger=require(_0xcec7('0x7'))(_0xcec7('0x8'));var config=require('../../config/environment');var jayson=require(_0xcec7('0x9'));var client=jayson[_0xcec7('0xa')][_0xcec7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x32dcd8,_0x2f7966,_0x2dda08){return new BPromise(function(_0x285b4a,_0x1875e5){return client[_0xcec7('0xc')](_0x32dcd8,_0x2dda08)['then'](function(_0x43f6c2){logger[_0xcec7('0xd')](_0xcec7('0xe'),_0x2f7966,_0xcec7('0xf'));logger[_0xcec7('0x10')](_0xcec7('0x11'),_0x2f7966,_0xcec7('0xf'),JSON['stringify'](_0x43f6c2));if(_0x43f6c2[_0xcec7('0x12')]){if(_0x43f6c2['error'][_0xcec7('0x13')]===0x1f4){logger['error'](_0xcec7('0xe'),_0x2f7966,_0x43f6c2[_0xcec7('0x12')]['message']);return _0x1875e5(_0x43f6c2[_0xcec7('0x12')]['message']);}logger[_0xcec7('0x12')]('Schedule,\x20%s,\x20%s',_0x2f7966,_0x43f6c2[_0xcec7('0x12')][_0xcec7('0x14')]);return _0x285b4a(_0x43f6c2[_0xcec7('0x12')][_0xcec7('0x14')]);}else{logger[_0xcec7('0xd')]('Schedule,\x20%s,\x20%s',_0x2f7966,'request\x20sent');_0x285b4a(_0x43f6c2[_0xcec7('0x15')][_0xcec7('0x14')]);}})['catch'](function(_0x18ac96){logger[_0xcec7('0x12')]('Schedule,\x20%s,\x20%s',_0x2f7966,_0x18ac96);_0x1875e5(_0x18ac96);});});} \ No newline at end of file +var _0xcc5a=['result','catch','lodash','util','moment','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Schedule,\x20%s,\x20%s'];(function(_0x19b3f9,_0xade753){var _0x18c3f6=function(_0x21439f){while(--_0x21439f){_0x19b3f9['push'](_0x19b3f9['shift']());}};_0x18c3f6(++_0xade753);}(_0xcc5a,0x144));var _0xacc5=function(_0x59d0cc,_0xa7c52b){_0x59d0cc=_0x59d0cc-0x0;var _0x2ae79f=_0xcc5a[_0x59d0cc];return _0x2ae79f;};'use strict';var _=require(_0xacc5('0x0'));var util=require(_0xacc5('0x1'));var moment=require(_0xacc5('0x2'));var BPromise=require('bluebird');var rs=require(_0xacc5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xacc5('0x4'))(_0xacc5('0x5'));var config=require(_0xacc5('0x6'));var jayson=require(_0xacc5('0x7'));var client=jayson[_0xacc5('0x8')][_0xacc5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5c5c6e,_0x433fe6,_0x24ad95){return new BPromise(function(_0x2209b2,_0x4b28ac){return client[_0xacc5('0xa')](_0x5c5c6e,_0x24ad95)[_0xacc5('0xb')](function(_0x52ebd8){logger[_0xacc5('0xc')]('Schedule,\x20%s,\x20%s',_0x433fe6,_0xacc5('0xd'));logger[_0xacc5('0xe')](_0xacc5('0xf'),_0x433fe6,_0xacc5('0xd'),JSON[_0xacc5('0x10')](_0x52ebd8));if(_0x52ebd8[_0xacc5('0x11')]){if(_0x52ebd8[_0xacc5('0x11')][_0xacc5('0x12')]===0x1f4){logger['error']('Schedule,\x20%s,\x20%s',_0x433fe6,_0x52ebd8[_0xacc5('0x11')][_0xacc5('0x13')]);return _0x4b28ac(_0x52ebd8['error'][_0xacc5('0x13')]);}logger[_0xacc5('0x11')](_0xacc5('0x14'),_0x433fe6,_0x52ebd8['error'][_0xacc5('0x13')]);return _0x2209b2(_0x52ebd8[_0xacc5('0x11')][_0xacc5('0x13')]);}else{logger['info'](_0xacc5('0x14'),_0x433fe6,_0xacc5('0xd'));_0x2209b2(_0x52ebd8[_0xacc5('0x15')]['message']);}})[_0xacc5('0x16')](function(_0x611e8e){logger[_0xacc5('0x11')]('Schedule,\x20%s,\x20%s',_0x433fe6,_0x611e8e);_0x4b28ac(_0x611e8e);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index bf5c88a..d7305c7 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 _0xb377=['util','connect-timeout','Router','fs-extra','../../components/interaction/service','./screenRecording.controller','get','isAuthenticated','index','/describe','describe','show','download','post','create','put','/:id','update','exports'];(function(_0x1d1d0a,_0x43d9b6){var _0x42e8a4=function(_0x23358e){while(--_0x23358e){_0x1d1d0a['push'](_0x1d1d0a['shift']());}};_0x42e8a4(++_0x43d9b6);}(_0xb377,0xf7));var _0x7b37=function(_0x51ce7a,_0x56c33b){_0x51ce7a=_0x51ce7a-0x0;var _0x5d2992=_0xb377[_0x51ce7a];return _0x5d2992;};'use strict';var multer=require('multer');var util=require(_0x7b37('0x0'));var path=require('path');var timeout=require(_0x7b37('0x1'));var express=require('express');var router=express[_0x7b37('0x2')]();var fs_extra=require(_0x7b37('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x7b37('0x4'));var config=require('../../config/environment');var controller=require(_0x7b37('0x5'));router[_0x7b37('0x6')]('/',auth[_0x7b37('0x7')](),controller[_0x7b37('0x8')]);router['get'](_0x7b37('0x9'),auth[_0x7b37('0x7')](),controller[_0x7b37('0xa')]);router[_0x7b37('0x6')]('/:id',auth[_0x7b37('0x7')](),controller[_0x7b37('0xb')]);router[_0x7b37('0x6')]('/:id/download',auth['isAuthenticated'](),controller[_0x7b37('0xc')]);router[_0x7b37('0xd')]('/',auth[_0x7b37('0x7')](),controller[_0x7b37('0xe')]);router[_0x7b37('0xf')](_0x7b37('0x10'),auth[_0x7b37('0x7')](),controller[_0x7b37('0x11')]);router['delete'](_0x7b37('0x10'),auth[_0x7b37('0x7')](),controller['destroy']);module[_0x7b37('0x12')]=router; \ No newline at end of file +var _0xc02d=['../../components/interaction/service','get','isAuthenticated','index','/:id','/:id/download','download','post','create','put','update','destroy','exports','multer','util','connect-timeout','fs-extra'];(function(_0xd88549,_0x23b388){var _0x35c1e1=function(_0x5c8389){while(--_0x5c8389){_0xd88549['push'](_0xd88549['shift']());}};_0x35c1e1(++_0x23b388);}(_0xc02d,0xc8));var _0xdc02=function(_0x2d6f34,_0x2c7d59){_0x2d6f34=_0x2d6f34-0x0;var _0x10e098=_0xc02d[_0x2d6f34];return _0x10e098;};'use strict';var multer=require(_0xdc02('0x0'));var util=require(_0xdc02('0x1'));var path=require('path');var timeout=require(_0xdc02('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xdc02('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xdc02('0x4'));var config=require('../../config/environment');var controller=require('./screenRecording.controller');router[_0xdc02('0x5')]('/',auth[_0xdc02('0x6')](),controller[_0xdc02('0x7')]);router[_0xdc02('0x5')]('/describe',auth[_0xdc02('0x6')](),controller['describe']);router[_0xdc02('0x5')](_0xdc02('0x8'),auth['isAuthenticated'](),controller['show']);router[_0xdc02('0x5')](_0xdc02('0x9'),auth[_0xdc02('0x6')](),controller[_0xdc02('0xa')]);router[_0xdc02('0xb')]('/',auth[_0xdc02('0x6')](),controller[_0xdc02('0xc')]);router[_0xdc02('0xd')](_0xdc02('0x8'),auth[_0xdc02('0x6')](),controller[_0xdc02('0xe')]);router['delete'](_0xdc02('0x8'),auth[_0xdc02('0x6')](),controller[_0xdc02('0xf')]);module[_0xdc02('0x10')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 6b20c1f..18f8589 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 _0x253d=['toString','sequelize','VIRTUAL','getDataValue','value','extname','STRING','setDataValue','INTEGER','duration','DATE','startedAt','format','closedAt'];(function(_0x4b73a2,_0x40b5fe){var _0x383c66=function(_0x3917ae){while(--_0x3917ae){_0x4b73a2['push'](_0x4b73a2['shift']());}};_0x383c66(++_0x40b5fe);}(_0x253d,0x1b3));var _0xd253=function(_0x1f60c5,_0x402257){_0x1f60c5=_0x1f60c5-0x0;var _0x47ee42=_0x253d[_0x1f60c5];return _0x47ee42;};'use strict';var Sequelize=require(_0xd253('0x0'));var moment=require('moment');var path=require('path');var config=require('../../config/environment');module['exports']={'format':{'type':Sequelize[_0xd253('0x1')],'get':function(){return this[_0xd253('0x2')](_0xd253('0x3'))?path[_0xd253('0x4')](this[_0xd253('0x2')]('value')):undefined;}},'interactionid':{'type':Sequelize[_0xd253('0x5')]},'channel':{'type':Sequelize[_0xd253('0x5')]},'value':{'type':Sequelize[_0xd253('0x5')],'set':function(_0x17589a){var _0xf4b457=_0x17589a['replace'](/\\/g,'/');this[_0xd253('0x6')](_0xd253('0x3'),_0xf4b457);}},'rating':{'type':Sequelize[_0xd253('0x7')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xd253('0x7')],'set':function(_0x351047){this[_0xd253('0x6')]('startedAt',moment()['subtract'](_0x351047,'ms'));this[_0xd253('0x6')]('closedAt',moment());this[_0xd253('0x6')](_0xd253('0x8'),_0x351047);}},'startedAt':{'type':Sequelize[_0xd253('0x9')],'get':function(){return moment(this[_0xd253('0x2')](_0xd253('0xa')))[_0xd253('0xb')]('MM-DD-YYYY\x20HH:mm')['toString']();}},'closedAt':{'type':Sequelize[_0xd253('0x9')],'get':function(){return moment(this[_0xd253('0x2')](_0xd253('0xc')))['format']('MM-DD-YYYY\x20HH:mm')[_0xd253('0xd')]();}},'createdAt':{'type':Sequelize[_0xd253('0x9')],'get':function(){return moment(this[_0xd253('0x2')]('createdAt'))[_0xd253('0xb')]('MM-DD-YYYY\x20HH:mm')[_0xd253('0xd')]();}},'updatedAt':{'type':Sequelize[_0xd253('0x9')],'get':function(){return moment(this[_0xd253('0x2')]('updatedAt'))[_0xd253('0xb')]('MM-DD-YYYY\x20HH:mm')[_0xd253('0xd')]();}}}; \ No newline at end of file +var _0x677a=['MM-DD-YYYY\x20HH:mm','toString','createdAt','updatedAt','sequelize','path','../../config/environment','exports','VIRTUAL','getDataValue','extname','value','STRING','replace','setDataValue','startedAt','subtract','closedAt','duration','DATE','format'];(function(_0x524b52,_0x183069){var _0x420161=function(_0x18f36a){while(--_0x18f36a){_0x524b52['push'](_0x524b52['shift']());}};_0x420161(++_0x183069);}(_0x677a,0xd6));var _0xa677=function(_0x12bb14,_0x2268b9){_0x12bb14=_0x12bb14-0x0;var _0xcc7709=_0x677a[_0x12bb14];return _0xcc7709;};'use strict';var Sequelize=require(_0xa677('0x0'));var moment=require('moment');var path=require(_0xa677('0x1'));var config=require(_0xa677('0x2'));module[_0xa677('0x3')]={'format':{'type':Sequelize[_0xa677('0x4')],'get':function(){return this[_0xa677('0x5')]('value')?path[_0xa677('0x6')](this[_0xa677('0x5')](_0xa677('0x7'))):undefined;}},'interactionid':{'type':Sequelize[_0xa677('0x8')]},'channel':{'type':Sequelize[_0xa677('0x8')]},'value':{'type':Sequelize['STRING'],'set':function(_0x303092){var _0x1c997f=_0x303092[_0xa677('0x9')](/\\/g,'/');this[_0xa677('0xa')]('value',_0x1c997f);}},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0x43d392){this['setDataValue'](_0xa677('0xb'),moment()[_0xa677('0xc')](_0x43d392,'ms'));this['setDataValue'](_0xa677('0xd'),moment());this[_0xa677('0xa')](_0xa677('0xe'),_0x43d392);}},'startedAt':{'type':Sequelize[_0xa677('0xf')],'get':function(){return moment(this['getDataValue'](_0xa677('0xb')))[_0xa677('0x10')](_0xa677('0x11'))[_0xa677('0x12')]();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xa677('0x5')]('closedAt'))[_0xa677('0x10')](_0xa677('0x11'))[_0xa677('0x12')]();}},'createdAt':{'type':Sequelize[_0xa677('0xf')],'get':function(){return moment(this[_0xa677('0x5')](_0xa677('0x13')))[_0xa677('0x10')](_0xa677('0x11'))[_0xa677('0x12')]();}},'updatedAt':{'type':Sequelize[_0xa677('0xf')],'get':function(){return moment(this[_0xa677('0x5')](_0xa677('0x14')))[_0xa677('0x10')](_0xa677('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 17dd5ed..64052ec 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 _0x9a19=['limit','count','set','Content-Range','save','then','destroy','error','stack','name','send','map','ScreenRecording','fieldName','type','key','model','differenceBy','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','update','duration','value','find','describe','download','../../components/encryptor','uniqueid','join','root','format','%s.cypher','existsSync','decryptFile','recording','server/files/screen_recordings','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','isNil','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','info','.cypher','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined'];(function(_0x3cb152,_0x57eb54){var _0x4f54c3=function(_0x273a45){while(--_0x273a45){_0x3cb152['push'](_0x3cb152['shift']());}};_0x4f54c3(++_0x57eb54);}(_0x9a19,0x114));var _0x99a1=function(_0x16bb4b,_0x5fe431){_0x16bb4b=_0x16bb4b-0x0;var _0x8aeb84=_0x9a19[_0x16bb4b];return _0x8aeb84;};'use strict';var emlformat=require(_0x99a1('0x0'));var rimraf=require(_0x99a1('0x1'));var zipdir=require(_0x99a1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x99a1('0x3'));var moment=require(_0x99a1('0x4'));var BPromise=require(_0x99a1('0x5'));var Mustache=require(_0x99a1('0x6'));var util=require(_0x99a1('0x7'));var path=require(_0x99a1('0x8'));var sox=require(_0x99a1('0x9'));var csv=require(_0x99a1('0xa'));var ejs=require(_0x99a1('0xb'));var fs=require('fs');var fs_extra=require(_0x99a1('0xc'));var _=require(_0x99a1('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x99a1('0xe'));var toCsv=require(_0x99a1('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x99a1('0xf'));var authService=require(_0x99a1('0x10'));var qs=require(_0x99a1('0x11'));var as=require(_0x99a1('0x12'));var hardwareService=require(_0x99a1('0x13'));var logger=require('../../config/logger')(_0x99a1('0x14'));var utils=require(_0x99a1('0x15'));var config=require(_0x99a1('0x16'));var licenseUtil=require(_0x99a1('0x17'));var db=require(_0x99a1('0x18'))['db'];function respondWithStatusCode(_0x1bc7aa,_0x2ff655){_0x2ff655=_0x2ff655||0xcc;return function(_0x532f56){if(_0x532f56){return _0x1bc7aa[_0x99a1('0x19')](_0x2ff655);}return _0x1bc7aa[_0x99a1('0x1a')](_0x2ff655)[_0x99a1('0x1b')]();};}function respondWithResult(_0x47815e,_0xe1a1f){_0xe1a1f=_0xe1a1f||0xc8;return function(_0x3c9ef4){if(_0x3c9ef4){return _0x47815e[_0x99a1('0x1a')](_0xe1a1f)['json'](_0x3c9ef4);}};}function respondWithFilteredResult(_0x2d81ed,_0x3e45d4){return function(_0x1bb464){if(_0x1bb464){var _0x3d40cc=typeof _0x3e45d4[_0x99a1('0x1c')]===_0x99a1('0x1d')&&typeof _0x3e45d4[_0x99a1('0x1e')]==='undefined';var _0x4f049c=_0x1bb464[_0x99a1('0x1f')];var _0xbf62f1=_0x3d40cc?0x0:_0x3e45d4[_0x99a1('0x1c')];var _0x1fcd00=_0x3d40cc?_0x1bb464[_0x99a1('0x1f')]:_0x3e45d4[_0x99a1('0x1c')]+_0x3e45d4[_0x99a1('0x1e')];var _0x3cd62c;if(_0x1fcd00>=_0x4f049c){_0x1fcd00=_0x4f049c;_0x3cd62c=0xc8;}else{_0x3cd62c=0xce;}_0x2d81ed[_0x99a1('0x1a')](_0x3cd62c);return _0x2d81ed[_0x99a1('0x20')](_0x99a1('0x21'),_0xbf62f1+'-'+_0x1fcd00+'/'+_0x4f049c)['json'](_0x1bb464);}return null;};}function patchUpdates(_0x3023a1){return function(_0x20007e){try{jsonpatch['apply'](_0x20007e,_0x3023a1,!![]);}catch(_0x38435b){return BPromise['reject'](_0x38435b);}return _0x20007e[_0x99a1('0x22')]();};}function saveUpdates(_0x2927b0,_0x2d6f20){return function(_0x2d3b82){if(_0x2d3b82){return _0x2d3b82['update'](_0x2927b0)[_0x99a1('0x23')](function(_0x1268a7){return _0x1268a7;});}return null;};}function removeEntity(_0x483c17,_0x44df2d){return function(_0x5b5dfa){if(_0x5b5dfa){return _0x5b5dfa[_0x99a1('0x24')]()[_0x99a1('0x23')](function(){_0x483c17[_0x99a1('0x1a')](0xcc)[_0x99a1('0x1b')]();});}};}function handleEntityNotFound(_0x3c813,_0x491341){return function(_0x4fe7f7){if(!_0x4fe7f7){_0x3c813[_0x99a1('0x19')](0x194);}return _0x4fe7f7;};}function handleError(_0x5dabd9,_0x5dc733){_0x5dc733=_0x5dc733||0x1f4;return function(_0xafea84){logger[_0x99a1('0x25')](_0xafea84[_0x99a1('0x26')]);if(_0xafea84[_0x99a1('0x27')]){delete _0xafea84[_0x99a1('0x27')];}_0x5dabd9[_0x99a1('0x1a')](_0x5dc733)[_0x99a1('0x28')](_0xafea84);};}exports['index']=function(_0xf41b0d,_0x499eef){var _0x255197={},_0x1137f2={},_0x26fbae={'count':0x0,'rows':[]};var _0x523668=_[_0x99a1('0x29')](db[_0x99a1('0x2a')]['rawAttributes'],function(_0x37514e){return{'name':_0x37514e[_0x99a1('0x2b')],'type':_0x37514e[_0x99a1('0x2c')][_0x99a1('0x2d')]};});_0x1137f2[_0x99a1('0x2e')]=_[_0x99a1('0x2f')](_[_0x99a1('0x29')](_0x523668,_0x99a1('0x27')),['format']);_0x1137f2['query']=_[_0x99a1('0x30')](_0xf41b0d['query']);_0x1137f2[_0x99a1('0x31')]=_[_0x99a1('0x32')](_0x1137f2['model'],_0x1137f2[_0x99a1('0x33')]);_0x255197[_0x99a1('0x34')]=_[_0x99a1('0x32')](_0x1137f2[_0x99a1('0x2e')],qs[_0x99a1('0x35')](_0xf41b0d[_0x99a1('0x33')][_0x99a1('0x35')]));_0x255197[_0x99a1('0x34')]=_0x255197[_0x99a1('0x34')][_0x99a1('0x36')]?_0x255197[_0x99a1('0x34')]:_0x1137f2[_0x99a1('0x2e')];if(!_0xf41b0d[_0x99a1('0x33')][_0x99a1('0x37')]('nolimit')){_0x255197['limit']=qs[_0x99a1('0x1e')](_0xf41b0d[_0x99a1('0x33')][_0x99a1('0x1e')]);_0x255197[_0x99a1('0x1c')]=qs[_0x99a1('0x1c')](_0xf41b0d[_0x99a1('0x33')][_0x99a1('0x1c')]);}_0x255197['order']=qs[_0x99a1('0x38')](_0xf41b0d[_0x99a1('0x33')]['sort']);_0x255197[_0x99a1('0x39')]=qs[_0x99a1('0x31')](_[_0x99a1('0x3a')](_0xf41b0d[_0x99a1('0x33')],_0x1137f2[_0x99a1('0x31')]),_0x523668);if(_0xf41b0d[_0x99a1('0x33')][_0x99a1('0x3b')]){_0x255197[_0x99a1('0x39')]=_[_0x99a1('0x3c')](_0x255197[_0x99a1('0x39')],{'$or':_[_0x99a1('0x29')](_0x523668,function(_0x152969){if(_0x152969[_0x99a1('0x2c')]!=='VIRTUAL'){var _0x5553e4={};_0x5553e4[_0x152969['name']]={'$like':'%'+_0xf41b0d[_0x99a1('0x33')][_0x99a1('0x3b')]+'%'};return _0x5553e4;}})});}_0x255197=_[_0x99a1('0x3c')]({},_0x255197,_0xf41b0d[_0x99a1('0x3d')]);var _0x40613a={'where':_0x255197['where']};return db[_0x99a1('0x2a')][_0x99a1('0x1f')](_0x40613a)[_0x99a1('0x23')](function(_0x51efe5){_0x26fbae['count']=_0x51efe5;if(_0xf41b0d[_0x99a1('0x33')][_0x99a1('0x3e')]){_0x255197[_0x99a1('0x3f')]=[{'all':!![]}];}return db['ScreenRecording'][_0x99a1('0x40')](_0x255197);})[_0x99a1('0x23')](function(_0x1b5d2d){_0x26fbae[_0x99a1('0x41')]=_0x1b5d2d;return _0x26fbae;})[_0x99a1('0x23')](respondWithFilteredResult(_0x499eef,_0x255197))[_0x99a1('0x42')](handleError(_0x499eef,null));};exports[_0x99a1('0x43')]=function(_0x29d0a0,_0x1c4ce4){var _0x2be9e3={'raw':![],'where':{'id':_0x29d0a0[_0x99a1('0x44')]['id']}},_0x4b40e1={};_0x4b40e1[_0x99a1('0x2e')]=_[_0x99a1('0x30')](db['ScreenRecording'][_0x99a1('0x45')]);_0x4b40e1['query']=_[_0x99a1('0x30')](_0x29d0a0[_0x99a1('0x33')]);_0x4b40e1[_0x99a1('0x31')]=_[_0x99a1('0x32')](_0x4b40e1[_0x99a1('0x2e')],_0x4b40e1[_0x99a1('0x33')]);_0x2be9e3['attributes']=_[_0x99a1('0x32')](_0x4b40e1['model'],qs[_0x99a1('0x35')](_0x29d0a0[_0x99a1('0x33')][_0x99a1('0x35')]));_0x2be9e3[_0x99a1('0x34')]=_0x2be9e3[_0x99a1('0x34')][_0x99a1('0x36')]?_0x2be9e3[_0x99a1('0x34')]:_0x4b40e1[_0x99a1('0x2e')];if(_0x29d0a0[_0x99a1('0x33')][_0x99a1('0x3e')]){_0x2be9e3[_0x99a1('0x3f')]=[{'all':!![]}];}_0x2be9e3=_['merge']({},_0x2be9e3,_0x29d0a0[_0x99a1('0x3d')]);return db[_0x99a1('0x2a')]['find'](_0x2be9e3)[_0x99a1('0x23')](handleEntityNotFound(_0x1c4ce4,null))[_0x99a1('0x23')](respondWithResult(_0x1c4ce4,null))[_0x99a1('0x42')](handleError(_0x1c4ce4,null));};exports[_0x99a1('0x46')]=function(_0x113dd9,_0x254c41){return db[_0x99a1('0x2a')]['create'](_0x113dd9[_0x99a1('0x47')],{})['then'](respondWithResult(_0x254c41,0xc9))[_0x99a1('0x42')](handleError(_0x254c41,null));};exports[_0x99a1('0x48')]=function(_0x566442,_0x5433f2){if(_0x566442[_0x99a1('0x47')]['id']){delete _0x566442[_0x99a1('0x47')]['id'];}delete _0x566442[_0x99a1('0x47')][_0x99a1('0x49')];delete _0x566442[_0x99a1('0x47')]['createdAt'];delete _0x566442['body']['closedAt'];delete _0x566442[_0x99a1('0x47')][_0x99a1('0x4a')];return db[_0x99a1('0x2a')][_0x99a1('0x4b')]({'where':{'id':_0x566442[_0x99a1('0x44')]['id']}})[_0x99a1('0x23')](handleEntityNotFound(_0x5433f2,null))[_0x99a1('0x23')](saveUpdates(_0x566442['body'],null))[_0x99a1('0x23')](respondWithResult(_0x5433f2,null))[_0x99a1('0x42')](handleError(_0x5433f2,null));};exports[_0x99a1('0x4c')]=function(_0x5e877f,_0x81e218){return db['ScreenRecording']['describe']()[_0x99a1('0x23')](respondWithResult(_0x81e218,null))[_0x99a1('0x42')](handleError(_0x81e218,null));};exports[_0x99a1('0x4d')]=function(_0x175f6d,_0x11632d,_0xf8208a){var _0x240d2e=require(_0x99a1('0x4e'));var _0x16641e=![];var _0x53e9eb={};if(_0x175f6d[_0x99a1('0x33')]['type']&&_0x175f6d[_0x99a1('0x33')][_0x99a1('0x2c')]==='uniqueid'){_0x53e9eb[_0x99a1('0x4f')]=_0x175f6d[_0x99a1('0x44')]['id'];}else{_0x53e9eb['id']=_0x175f6d[_0x99a1('0x44')]['id'];}return db[_0x99a1('0x2a')][_0x99a1('0x4b')]({'where':_0x53e9eb,'attributes':['id',_0x99a1('0x4a')],'raw':!![]})[_0x99a1('0x23')](handleEntityNotFound(_0x11632d,null))[_0x99a1('0x23')](function(_0x28ba8f){if(_0x28ba8f){var _0x1c2926=path[_0x99a1('0x50')](config[_0x99a1('0x51')],'server/files/screen_recordings',_0x28ba8f['value']);var _0x2e3e08=util[_0x99a1('0x52')](_0x99a1('0x53'),_0x1c2926);if(fs[_0x99a1('0x54')](_0x2e3e08)){_0x16641e=!![];return _0x240d2e[_0x99a1('0x55')](_0x2e3e08,_0x1c2926,config['secrets'][_0x99a1('0x56')])[_0x99a1('0x23')](function(){return _0x28ba8f;});}return _0x28ba8f;}})['then'](function(_0x6107cd){if(_0x6107cd){var _0x95f20a=path[_0x99a1('0x50')](config[_0x99a1('0x51')],_0x99a1('0x57'),_0x6107cd['value']);if(!fs[_0x99a1('0x54')](_0x95f20a)){throw new db[(_0x99a1('0x58'))][(_0x99a1('0x59'))](_0x99a1('0x5a'));}if(_0x6107cd[_0x99a1('0x5b')]){return _0x11632d[_0x99a1('0x4d')](_0x95f20a,_0x6107cd['filename']+path[_0x99a1('0x5c')](_0x95f20a),function(){if(_0x16641e){fs[_0x99a1('0x5d')](_0x95f20a);}});}else{return _0x11632d['download'](_0x95f20a,function(_0x33feb9){if(_0x16641e){fs[_0x99a1('0x5d')](_0x95f20a);}});}}})[_0x99a1('0x42')](function(_0xb126dd){if(_0xb126dd[_0x99a1('0x5e')]==='ScreenRecording\x20not\x20found'){_0x11632d[_0x99a1('0x1a')](0x194)['send']('Not\x20found');}else{return handleError(_0x11632d,null);}});};exports['destroy']=function(_0x38ce3c,_0x3f7c16){return db['ScreenRecording']['find']({'where':{'id':_0x38ce3c[_0x99a1('0x44')]['id']}})['then'](function(_0x21a5f6){if(_[_0x99a1('0x5f')](_0x21a5f6)){throw new ReferenceError(_0x99a1('0x60'));}return _0x21a5f6;})[_0x99a1('0x23')](function(_0x56d6cf){var _0x18f74b=path[_0x99a1('0x50')](config[_0x99a1('0x51')],'server/files/screen_recordings',_0x56d6cf[_0x99a1('0x4a')]);logger['info'](_0x99a1('0x61'),_0x18f74b);if(!_[_0x99a1('0x5f')](_0x56d6cf[_0x99a1('0x4a')])&&fs[_0x99a1('0x54')](_0x18f74b)){logger[_0x99a1('0x62')]('File:\x20\x22'+_0x18f74b+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x18f74b);}_0x18f74b=_0x18f74b+_0x99a1('0x63');if(!_[_0x99a1('0x5f')](_0x56d6cf['value'])&&fs['existsSync'](_0x18f74b)){logger[_0x99a1('0x62')](_0x99a1('0x64')+_0x18f74b+_0x99a1('0x65'));fs['unlinkSync'](_0x18f74b);}return _0x56d6cf;})['then'](function(_0x2b8df8){if(!_0x2b8df8)throw new InternalError();return _0x2b8df8['destroy']();})[_0x99a1('0x23')](function(){_0x3f7c16[_0x99a1('0x1a')](0xcc)[_0x99a1('0x1b')]();})['catch'](handleError(_0x3f7c16,null));}; \ No newline at end of file +var _0x33c5=['download','uniqueid','join','root','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','secrets','recording','ScreenRecording\x20not\x20found','filename','unlink','message','Not\x20found','cancellazione\x20fisica\x20documento\x20%s','isNil','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','unlinkSync','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','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/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','map','ScreenRecording','type','key','model','differenceBy','format','query','keys','filters','intersection','attributes','fields','length','order','sort','where','merge','VIRTUAL','filter','options','includeAll','findAll','show','params','include','find','catch','create','body','duration','createdAt','closedAt','value','describe'];(function(_0x5080f9,_0x421c0c){var _0x2c1121=function(_0x17d787){while(--_0x17d787){_0x5080f9['push'](_0x5080f9['shift']());}};_0x2c1121(++_0x421c0c);}(_0x33c5,0xe6));var _0x533c=function(_0x16539a,_0x31409a){_0x16539a=_0x16539a-0x0;var _0x200796=_0x33c5[_0x16539a];return _0x200796;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x533c('0x0'));var zipdir=require(_0x533c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x533c('0x2'));var moment=require(_0x533c('0x3'));var BPromise=require(_0x533c('0x4'));var Mustache=require(_0x533c('0x5'));var util=require(_0x533c('0x6'));var path=require('path');var sox=require(_0x533c('0x7'));var csv=require(_0x533c('0x8'));var ejs=require(_0x533c('0x9'));var fs=require('fs');var fs_extra=require(_0x533c('0xa'));var _=require(_0x533c('0xb'));var squel=require(_0x533c('0xc'));var crypto=require(_0x533c('0xd'));var jsforce=require(_0x533c('0xe'));var deskjs=require(_0x533c('0xf'));var toCsv=require(_0x533c('0x8'));var querystring=require(_0x533c('0x10'));var Papa=require(_0x533c('0x11'));var Redis=require(_0x533c('0x12'));var authService=require(_0x533c('0x13'));var qs=require(_0x533c('0x14'));var as=require(_0x533c('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x533c('0x16'))(_0x533c('0x17'));var utils=require(_0x533c('0x18'));var config=require(_0x533c('0x19'));var licenseUtil=require(_0x533c('0x1a'));var db=require(_0x533c('0x1b'))['db'];function respondWithStatusCode(_0x530e10,_0x5c9462){_0x5c9462=_0x5c9462||0xcc;return function(_0xf93007){if(_0xf93007){return _0x530e10[_0x533c('0x1c')](_0x5c9462);}return _0x530e10[_0x533c('0x1d')](_0x5c9462)[_0x533c('0x1e')]();};}function respondWithResult(_0x1a2a83,_0x8d7c66){_0x8d7c66=_0x8d7c66||0xc8;return function(_0xa616ca){if(_0xa616ca){return _0x1a2a83['status'](_0x8d7c66)[_0x533c('0x1f')](_0xa616ca);}};}function respondWithFilteredResult(_0x7c1d33,_0x3f4a5c){return function(_0x3e544f){if(_0x3e544f){var _0x56dfb7=typeof _0x3f4a5c[_0x533c('0x20')]===_0x533c('0x21')&&typeof _0x3f4a5c[_0x533c('0x22')]===_0x533c('0x21');var _0x2854ab=_0x3e544f[_0x533c('0x23')];var _0x1f0a72=_0x56dfb7?0x0:_0x3f4a5c[_0x533c('0x20')];var _0x1f9f85=_0x56dfb7?_0x3e544f[_0x533c('0x23')]:_0x3f4a5c[_0x533c('0x20')]+_0x3f4a5c[_0x533c('0x22')];var _0x78dd72;if(_0x1f9f85>=_0x2854ab){_0x1f9f85=_0x2854ab;_0x78dd72=0xc8;}else{_0x78dd72=0xce;}_0x7c1d33[_0x533c('0x1d')](_0x78dd72);return _0x7c1d33[_0x533c('0x24')](_0x533c('0x25'),_0x1f0a72+'-'+_0x1f9f85+'/'+_0x2854ab)[_0x533c('0x1f')](_0x3e544f);}return null;};}function patchUpdates(_0x2bc58f){return function(_0x4ba0bd){try{jsonpatch[_0x533c('0x26')](_0x4ba0bd,_0x2bc58f,!![]);}catch(_0x51785c){return BPromise['reject'](_0x51785c);}return _0x4ba0bd[_0x533c('0x27')]();};}function saveUpdates(_0x36d4e4,_0x5f5090){return function(_0x21dfd3){if(_0x21dfd3){return _0x21dfd3[_0x533c('0x28')](_0x36d4e4)[_0x533c('0x29')](function(_0x3dd249){return _0x3dd249;});}return null;};}function removeEntity(_0x5ebbe0,_0x3762f7){return function(_0x42c87b){if(_0x42c87b){return _0x42c87b[_0x533c('0x2a')]()[_0x533c('0x29')](function(){_0x5ebbe0[_0x533c('0x1d')](0xcc)[_0x533c('0x1e')]();});}};}function handleEntityNotFound(_0xb51a5,_0x43f669){return function(_0xb1c937){if(!_0xb1c937){_0xb51a5[_0x533c('0x1c')](0x194);}return _0xb1c937;};}function handleError(_0x4d47d0,_0x11d775){_0x11d775=_0x11d775||0x1f4;return function(_0xfab4da){logger['error'](_0xfab4da[_0x533c('0x2b')]);if(_0xfab4da['name']){delete _0xfab4da[_0x533c('0x2c')];}_0x4d47d0[_0x533c('0x1d')](_0x11d775)[_0x533c('0x2d')](_0xfab4da);};}exports[_0x533c('0x2e')]=function(_0x425f60,_0x146a8e){var _0x212d1b={},_0x38d886={},_0x3c559b={'count':0x0,'rows':[]};var _0x2fc7fa=_[_0x533c('0x2f')](db[_0x533c('0x30')]['rawAttributes'],function(_0x370263){return{'name':_0x370263['fieldName'],'type':_0x370263[_0x533c('0x31')][_0x533c('0x32')]};});_0x38d886[_0x533c('0x33')]=_[_0x533c('0x34')](_[_0x533c('0x2f')](_0x2fc7fa,_0x533c('0x2c')),[_0x533c('0x35')]);_0x38d886[_0x533c('0x36')]=_[_0x533c('0x37')](_0x425f60[_0x533c('0x36')]);_0x38d886[_0x533c('0x38')]=_[_0x533c('0x39')](_0x38d886[_0x533c('0x33')],_0x38d886[_0x533c('0x36')]);_0x212d1b[_0x533c('0x3a')]=_['intersection'](_0x38d886[_0x533c('0x33')],qs[_0x533c('0x3b')](_0x425f60[_0x533c('0x36')][_0x533c('0x3b')]));_0x212d1b['attributes']=_0x212d1b[_0x533c('0x3a')][_0x533c('0x3c')]?_0x212d1b[_0x533c('0x3a')]:_0x38d886[_0x533c('0x33')];if(!_0x425f60[_0x533c('0x36')]['hasOwnProperty']('nolimit')){_0x212d1b['limit']=qs['limit'](_0x425f60['query'][_0x533c('0x22')]);_0x212d1b['offset']=qs[_0x533c('0x20')](_0x425f60['query'][_0x533c('0x20')]);}_0x212d1b[_0x533c('0x3d')]=qs[_0x533c('0x3e')](_0x425f60['query'][_0x533c('0x3e')]);_0x212d1b[_0x533c('0x3f')]=qs[_0x533c('0x38')](_['pick'](_0x425f60[_0x533c('0x36')],_0x38d886[_0x533c('0x38')]),_0x2fc7fa);if(_0x425f60[_0x533c('0x36')]['filter']){_0x212d1b[_0x533c('0x3f')]=_[_0x533c('0x40')](_0x212d1b[_0x533c('0x3f')],{'$or':_[_0x533c('0x2f')](_0x2fc7fa,function(_0x454dbc){if(_0x454dbc[_0x533c('0x31')]!==_0x533c('0x41')){var _0x2dbd81={};_0x2dbd81[_0x454dbc[_0x533c('0x2c')]]={'$like':'%'+_0x425f60[_0x533c('0x36')][_0x533c('0x42')]+'%'};return _0x2dbd81;}})});}_0x212d1b=_['merge']({},_0x212d1b,_0x425f60[_0x533c('0x43')]);var _0x784493={'where':_0x212d1b[_0x533c('0x3f')]};return db[_0x533c('0x30')][_0x533c('0x23')](_0x784493)[_0x533c('0x29')](function(_0x5d2bf9){_0x3c559b[_0x533c('0x23')]=_0x5d2bf9;if(_0x425f60[_0x533c('0x36')][_0x533c('0x44')]){_0x212d1b['include']=[{'all':!![]}];}return db[_0x533c('0x30')][_0x533c('0x45')](_0x212d1b);})[_0x533c('0x29')](function(_0x1abd47){_0x3c559b['rows']=_0x1abd47;return _0x3c559b;})[_0x533c('0x29')](respondWithFilteredResult(_0x146a8e,_0x212d1b))['catch'](handleError(_0x146a8e,null));};exports[_0x533c('0x46')]=function(_0x39034e,_0x55a372){var _0x3f4015={'raw':![],'where':{'id':_0x39034e[_0x533c('0x47')]['id']}},_0x3f1e47={};_0x3f1e47['model']=_['keys'](db['ScreenRecording']['rawAttributes']);_0x3f1e47[_0x533c('0x36')]=_['keys'](_0x39034e[_0x533c('0x36')]);_0x3f1e47['filters']=_[_0x533c('0x39')](_0x3f1e47['model'],_0x3f1e47[_0x533c('0x36')]);_0x3f4015[_0x533c('0x3a')]=_['intersection'](_0x3f1e47[_0x533c('0x33')],qs[_0x533c('0x3b')](_0x39034e[_0x533c('0x36')][_0x533c('0x3b')]));_0x3f4015[_0x533c('0x3a')]=_0x3f4015['attributes'][_0x533c('0x3c')]?_0x3f4015[_0x533c('0x3a')]:_0x3f1e47[_0x533c('0x33')];if(_0x39034e[_0x533c('0x36')]['includeAll']){_0x3f4015[_0x533c('0x48')]=[{'all':!![]}];}_0x3f4015=_[_0x533c('0x40')]({},_0x3f4015,_0x39034e['options']);return db['ScreenRecording'][_0x533c('0x49')](_0x3f4015)['then'](handleEntityNotFound(_0x55a372,null))[_0x533c('0x29')](respondWithResult(_0x55a372,null))[_0x533c('0x4a')](handleError(_0x55a372,null));};exports[_0x533c('0x4b')]=function(_0x471c59,_0xe9354a){return db[_0x533c('0x30')][_0x533c('0x4b')](_0x471c59[_0x533c('0x4c')],{})['then'](respondWithResult(_0xe9354a,0xc9))[_0x533c('0x4a')](handleError(_0xe9354a,null));};exports[_0x533c('0x28')]=function(_0xaaf682,_0x57c6c6){if(_0xaaf682[_0x533c('0x4c')]['id']){delete _0xaaf682[_0x533c('0x4c')]['id'];}delete _0xaaf682['body'][_0x533c('0x4d')];delete _0xaaf682['body'][_0x533c('0x4e')];delete _0xaaf682[_0x533c('0x4c')][_0x533c('0x4f')];delete _0xaaf682[_0x533c('0x4c')][_0x533c('0x50')];return db[_0x533c('0x30')][_0x533c('0x49')]({'where':{'id':_0xaaf682['params']['id']}})[_0x533c('0x29')](handleEntityNotFound(_0x57c6c6,null))[_0x533c('0x29')](saveUpdates(_0xaaf682[_0x533c('0x4c')],null))[_0x533c('0x29')](respondWithResult(_0x57c6c6,null))[_0x533c('0x4a')](handleError(_0x57c6c6,null));};exports[_0x533c('0x51')]=function(_0x3eb174,_0x50d5a2){return db['ScreenRecording']['describe']()['then'](respondWithResult(_0x50d5a2,null))[_0x533c('0x4a')](handleError(_0x50d5a2,null));};exports[_0x533c('0x52')]=function(_0x5c5dd0,_0xac086b,_0x1da579){var _0x2f6794=require('../../components/encryptor');var _0x1de19e=![];var _0x564a31={};if(_0x5c5dd0['query'][_0x533c('0x31')]&&_0x5c5dd0[_0x533c('0x36')][_0x533c('0x31')]===_0x533c('0x53')){_0x564a31[_0x533c('0x53')]=_0x5c5dd0[_0x533c('0x47')]['id'];}else{_0x564a31['id']=_0x5c5dd0[_0x533c('0x47')]['id'];}return db['ScreenRecording'][_0x533c('0x49')]({'where':_0x564a31,'attributes':['id','value'],'raw':!![]})[_0x533c('0x29')](handleEntityNotFound(_0xac086b,null))[_0x533c('0x29')](function(_0x274686){if(_0x274686){var _0x2c7600=path[_0x533c('0x54')](config[_0x533c('0x55')],_0x533c('0x56'),_0x274686[_0x533c('0x50')]);var _0x58f528=util[_0x533c('0x35')](_0x533c('0x57'),_0x2c7600);if(fs[_0x533c('0x58')](_0x58f528)){_0x1de19e=!![];return _0x2f6794[_0x533c('0x59')](_0x58f528,_0x2c7600,config[_0x533c('0x5a')][_0x533c('0x5b')])['then'](function(){return _0x274686;});}return _0x274686;}})[_0x533c('0x29')](function(_0x554a9f){if(_0x554a9f){var _0x43383e=path[_0x533c('0x54')](config[_0x533c('0x55')],_0x533c('0x56'),_0x554a9f[_0x533c('0x50')]);if(!fs[_0x533c('0x58')](_0x43383e)){throw new db['Sequelize']['ValidationError'](_0x533c('0x5c'));}if(_0x554a9f[_0x533c('0x5d')]){return _0xac086b[_0x533c('0x52')](_0x43383e,_0x554a9f[_0x533c('0x5d')]+path['extname'](_0x43383e),function(){if(_0x1de19e){fs[_0x533c('0x5e')](_0x43383e);}});}else{return _0xac086b[_0x533c('0x52')](_0x43383e,function(_0x8e04c7){if(_0x1de19e){fs[_0x533c('0x5e')](_0x43383e);}});}}})[_0x533c('0x4a')](function(_0x2f2863){if(_0x2f2863[_0x533c('0x5f')]===_0x533c('0x5c')){_0xac086b[_0x533c('0x1d')](0x194)[_0x533c('0x2d')](_0x533c('0x60'));}else{return handleError(_0xac086b,null);}});};exports[_0x533c('0x2a')]=function(_0x13a7f2,_0xea6ea2){return db[_0x533c('0x30')][_0x533c('0x49')]({'where':{'id':_0x13a7f2[_0x533c('0x47')]['id']}})['then'](function(_0x31bba1){if(_['isNil'](_0x31bba1)){throw new ReferenceError('Entity\x20not\x20found');}return _0x31bba1;})[_0x533c('0x29')](function(_0xb23f94){var _0x965b85=path[_0x533c('0x54')](config[_0x533c('0x55')],_0x533c('0x56'),_0xb23f94[_0x533c('0x50')]);logger['info'](_0x533c('0x61'),_0x965b85);if(!_[_0x533c('0x62')](_0xb23f94['value'])&&fs[_0x533c('0x58')](_0x965b85)){logger[_0x533c('0x63')](_0x533c('0x64')+_0x965b85+_0x533c('0x65'));fs['unlinkSync'](_0x965b85);}_0x965b85=_0x965b85+_0x533c('0x66');if(!_[_0x533c('0x62')](_0xb23f94['value'])&&fs[_0x533c('0x58')](_0x965b85)){logger[_0x533c('0x63')]('File:\x20\x22'+_0x965b85+_0x533c('0x65'));fs[_0x533c('0x67')](_0x965b85);}return _0xb23f94;})['then'](function(_0x444f46){if(!_0x444f46)throw new InternalError();return _0x444f46['destroy']();})['then'](function(){_0xea6ea2[_0x533c('0x1d')](0xcc)[_0x533c('0x1e')]();})[_0x533c('0x4a')](handleError(_0xea6ea2,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index fd21065..a15527e 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 _0xdfbc=['request-promise','path','rimraf','../../config/environment','./screenRecording.attributes','exports','define','ScreenRecording','screen_recordings','interactionid','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x19f813,_0x547998){var _0xf9c00e=function(_0x3e142d){while(--_0x3e142d){_0x19f813['push'](_0x19f813['shift']());}};_0xf9c00e(++_0x547998);}(_0xdfbc,0x13a));var _0xcdfb=function(_0x3f7778,_0x1d9d48){_0x3f7778=_0x3f7778-0x0;var _0x4e4f37=_0xdfbc[_0x3f7778];return _0x4e4f37;};'use strict';var _=require(_0xcdfb('0x0'));var util=require(_0xcdfb('0x1'));var logger=require(_0xcdfb('0x2'))(_0xcdfb('0x3'));var moment=require(_0xcdfb('0x4'));var BPromise=require(_0xcdfb('0x5'));var rp=require(_0xcdfb('0x6'));var fs=require('fs');var path=require(_0xcdfb('0x7'));var rimraf=require(_0xcdfb('0x8'));var config=require(_0xcdfb('0x9'));var attributes=require(_0xcdfb('0xa'));module[_0xcdfb('0xb')]=function(_0x45b111,_0x143c2f){return _0x45b111[_0xcdfb('0xc')](_0xcdfb('0xd'),attributes,{'tableName':_0xcdfb('0xe'),'paranoid':![],'indexes':[{'name':_0xcdfb('0xf'),'fields':['interactionid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xf15d=['../../config/environment','./screenRecording.attributes','exports','ScreenRecording','screen_recordings','interactionid','../../config/logger','bluebird','request-promise','path','rimraf'];(function(_0x4d0c6f,_0x49959a){var _0x28bde5=function(_0x22fedb){while(--_0x22fedb){_0x4d0c6f['push'](_0x4d0c6f['shift']());}};_0x28bde5(++_0x49959a);}(_0xf15d,0x8a));var _0xdf15=function(_0x4941ce,_0x307c6a){_0x4941ce=_0x4941ce-0x0;var _0x5aed09=_0xf15d[_0x4941ce];return _0x5aed09;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xdf15('0x0'))('api');var moment=require('moment');var BPromise=require(_0xdf15('0x1'));var rp=require(_0xdf15('0x2'));var fs=require('fs');var path=require(_0xdf15('0x3'));var rimraf=require(_0xdf15('0x4'));var config=require(_0xdf15('0x5'));var attributes=require(_0xdf15('0x6'));module[_0xdf15('0x7')]=function(_0x2bed49,_0x5eb688){return _0x2bed49['define'](_0xdf15('0x8'),attributes,{'tableName':_0xdf15('0x9'),'paranoid':![],'indexes':[{'name':_0xdf15('0xa'),'fields':[_0xdf15('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 08f6966..91bd3d8 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 _0x4ba6=['ScreenRecording,\x20%s,\x20%s,\x20%s','error','code','message','result','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ScreenRecording,\x20%s,\x20%s','request\x20sent'];(function(_0x218ec3,_0x5aae78){var _0x23db5d=function(_0x426135){while(--_0x426135){_0x218ec3['push'](_0x218ec3['shift']());}};_0x23db5d(++_0x5aae78);}(_0x4ba6,0x155));var _0x64ba=function(_0x295a92,_0x7d70dc){_0x295a92=_0x295a92-0x0;var _0x3f5dac=_0x4ba6[_0x295a92];return _0x3f5dac;};'use strict';var _=require('lodash');var util=require(_0x64ba('0x0'));var moment=require(_0x64ba('0x1'));var BPromise=require(_0x64ba('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x64ba('0x3'))['db'];var utils=require(_0x64ba('0x4'));var logger=require(_0x64ba('0x5'))(_0x64ba('0x6'));var config=require(_0x64ba('0x7'));var jayson=require(_0x64ba('0x8'));var client=jayson[_0x64ba('0x9')][_0x64ba('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4dad8e,_0x3bb882,_0x1a27a2){return new BPromise(function(_0x5be7a0,_0x2113ff){return client[_0x64ba('0xb')](_0x4dad8e,_0x1a27a2)[_0x64ba('0xc')](function(_0x152bde){logger[_0x64ba('0xd')](_0x64ba('0xe'),_0x3bb882,_0x64ba('0xf'));logger['debug'](_0x64ba('0x10'),_0x3bb882,'request\x20sent',JSON['stringify'](_0x152bde));if(_0x152bde[_0x64ba('0x11')]){if(_0x152bde[_0x64ba('0x11')][_0x64ba('0x12')]===0x1f4){logger[_0x64ba('0x11')]('ScreenRecording,\x20%s,\x20%s',_0x3bb882,_0x152bde[_0x64ba('0x11')][_0x64ba('0x13')]);return _0x2113ff(_0x152bde[_0x64ba('0x11')][_0x64ba('0x13')]);}logger['error']('ScreenRecording,\x20%s,\x20%s',_0x3bb882,_0x152bde['error']['message']);return _0x5be7a0(_0x152bde['error'][_0x64ba('0x13')]);}else{logger[_0x64ba('0xd')](_0x64ba('0xe'),_0x3bb882,_0x64ba('0xf'));_0x5be7a0(_0x152bde[_0x64ba('0x14')][_0x64ba('0x13')]);}})['catch'](function(_0x39a9ff){logger[_0x64ba('0x11')](_0x64ba('0xe'),_0x3bb882,_0x39a9ff);_0x2113ff(_0x39a9ff);});});} \ No newline at end of file +var _0x8c29=['result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x1284dd,_0x5e3473){var _0x12d015=function(_0x63e5ee){while(--_0x63e5ee){_0x1284dd['push'](_0x1284dd['shift']());}};_0x12d015(++_0x5e3473);}(_0x8c29,0x86));var _0x98c2=function(_0x3e8fc1,_0x598549){_0x3e8fc1=_0x3e8fc1-0x0;var _0x2c8f88=_0x8c29[_0x3e8fc1];return _0x2c8f88;};'use strict';var _=require(_0x98c2('0x0'));var util=require(_0x98c2('0x1'));var moment=require(_0x98c2('0x2'));var BPromise=require('bluebird');var rs=require(_0x98c2('0x3'));var fs=require('fs');var Redis=require(_0x98c2('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x98c2('0x5'));var logger=require(_0x98c2('0x6'))(_0x98c2('0x7'));var config=require(_0x98c2('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x98c2('0x9')][_0x98c2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2b72d3,_0x50d4f3,_0x4eae10){return new BPromise(function(_0x26df4b,_0x37334f){return client[_0x98c2('0xb')](_0x2b72d3,_0x4eae10)['then'](function(_0x282099){logger[_0x98c2('0xc')](_0x98c2('0xd'),_0x50d4f3,_0x98c2('0xe'));logger[_0x98c2('0xf')]('ScreenRecording,\x20%s,\x20%s,\x20%s',_0x50d4f3,_0x98c2('0xe'),JSON[_0x98c2('0x10')](_0x282099));if(_0x282099[_0x98c2('0x11')]){if(_0x282099[_0x98c2('0x11')][_0x98c2('0x12')]===0x1f4){logger['error']('ScreenRecording,\x20%s,\x20%s',_0x50d4f3,_0x282099[_0x98c2('0x11')]['message']);return _0x37334f(_0x282099[_0x98c2('0x11')]['message']);}logger[_0x98c2('0x11')](_0x98c2('0xd'),_0x50d4f3,_0x282099[_0x98c2('0x11')][_0x98c2('0x13')]);return _0x26df4b(_0x282099['error'][_0x98c2('0x13')]);}else{logger[_0x98c2('0xc')](_0x98c2('0xd'),_0x50d4f3,'request\x20sent');_0x26df4b(_0x282099[_0x98c2('0x14')][_0x98c2('0x13')]);}})[_0x98c2('0x15')](function(_0x557eeb){logger[_0x98c2('0x11')]('ScreenRecording,\x20%s,\x20%s',_0x50d4f3,_0x557eeb);_0x37334f(_0x557eeb);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 09d5f81..c2a06fc 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 _0x539d=['root','server/files/images/logos/','format','%s%s','logo','extname','originalname','post','/:id/logo','single','addLogo','/:id/logo_login','preferred','addPreferred','favicon','/:id/favicon','file','addFavicon','put','/:id','isAuthenticated','multer','util','path','express','Router','fs-extra','../../components/interaction/service','./setting.controller','/now','getDate','get','getLogo','/:id/gdpr','gdpr','/:id/preferred','getPreferred','diskStorage','join'];(function(_0x28d1d9,_0x226b8c){var _0x5f0c03=function(_0x5c89c0){while(--_0x5c89c0){_0x28d1d9['push'](_0x28d1d9['shift']());}};_0x5f0c03(++_0x226b8c);}(_0x539d,0x1c2));var _0xd539=function(_0x200827,_0x4af951){_0x200827=_0x200827-0x0;var _0x120047=_0x539d[_0x200827];return _0x120047;};'use strict';var multer=require(_0xd539('0x0'));var util=require(_0xd539('0x1'));var path=require(_0xd539('0x2'));var timeout=require('connect-timeout');var express=require(_0xd539('0x3'));var router=express[_0xd539('0x4')]();var fs_extra=require(_0xd539('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xd539('0x6'));var config=require('../../config/environment');var controller=require(_0xd539('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xd539('0x8'),controller[_0xd539('0x9')]);router[_0xd539('0xa')]('/:id',controller['show']);router[_0xd539('0xa')]('/:id/logo',controller[_0xd539('0xb')]);router['get']('/:id/logo_login',controller['getLogoLogin']);router[_0xd539('0xa')](_0xd539('0xc'),controller[_0xd539('0xd')]);router[_0xd539('0xa')](_0xd539('0xe'),controller[_0xd539('0xf')]);router[_0xd539('0xa')]('/:id/favicon',controller['getFavicon']);var upload=multer({'storage':multer[_0xd539('0x10')]({'destination':function(_0x172565,_0x5bbde3,_0x3b8f61){_0x3b8f61(null,path[_0xd539('0x11')](config[_0xd539('0x12')],_0xd539('0x13')));},'filename':function(_0x2eb050,_0x5b806d,_0x389fdd){_0x389fdd(null,util[_0xd539('0x14')](_0xd539('0x15'),_0xd539('0x16'),path[_0xd539('0x17')](_0x5b806d[_0xd539('0x18')])));}})});router[_0xd539('0x19')](_0xd539('0x1a'),upload[_0xd539('0x1b')]('file'),controller[_0xd539('0x1c')]);var upload=multer({'storage':multer[_0xd539('0x10')]({'destination':function(_0x16c7ba,_0x44755b,_0x248de6){_0x248de6(null,path['join'](config['root'],'server/files/images/logos/'));},'filename':function(_0xfe50b9,_0x547af5,_0x2039d1){_0x2039d1(null,util['format'](_0xd539('0x15'),'logologin',path[_0xd539('0x17')](_0x547af5[_0xd539('0x18')])));}})});router[_0xd539('0x19')](_0xd539('0x1d'),upload[_0xd539('0x1b')]('file'),controller['addLogoLogin']);var upload=multer({'storage':multer[_0xd539('0x10')]({'destination':function(_0x19da37,_0x94f0a6,_0x360dbe){_0x360dbe(null,path[_0xd539('0x11')](config['root'],_0xd539('0x13')));},'filename':function(_0x532d6a,_0x424312,_0x5217d0){_0x5217d0(null,util['format'](_0xd539('0x15'),_0xd539('0x1e'),path[_0xd539('0x17')](_0x424312[_0xd539('0x18')])));}})});router[_0xd539('0x19')](_0xd539('0xe'),upload[_0xd539('0x1b')]('file'),controller[_0xd539('0x1f')]);var upload=multer({'storage':multer[_0xd539('0x10')]({'destination':function(_0x2e5708,_0x35608b,_0x5383fc){_0x5383fc(null,path[_0xd539('0x11')](config['root'],'server/files/images/logos/'));},'filename':function(_0x406d67,_0x2e95b3,_0x4818e2){_0x4818e2(null,util[_0xd539('0x14')](_0xd539('0x15'),_0xd539('0x20'),path['extname'](_0x2e95b3[_0xd539('0x18')])));}})});router[_0xd539('0x19')](_0xd539('0x21'),upload['single'](_0xd539('0x22')),controller[_0xd539('0x23')]);router[_0xd539('0x24')](_0xd539('0x25'),auth[_0xd539('0x26')](),controller['update']);module['exports']=router; \ No newline at end of file +var _0x5b7b=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','get','isAuthenticated','index','/now','getDate','/:id','show','getLogo','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','getFavicon','join','format','%s%s','logo','extname','originalname','post','/:id/logo','single','file','addLogo','diskStorage','logologin','/:id/logo_login','root','server/files/images/logos/','addPreferred','favicon','/:id/favicon','put','exports','multer','path','connect-timeout'];(function(_0x12cbc9,_0x51222d){var _0x43ef8b=function(_0x52154b){while(--_0x52154b){_0x12cbc9['push'](_0x12cbc9['shift']());}};_0x43ef8b(++_0x51222d);}(_0x5b7b,0xd9));var _0xb5b7=function(_0x2f965f,_0x100aca){_0x2f965f=_0x2f965f-0x0;var _0x73f2b9=_0x5b7b[_0x2f965f];return _0x73f2b9;};'use strict';var multer=require(_0xb5b7('0x0'));var util=require('util');var path=require(_0xb5b7('0x1'));var timeout=require(_0xb5b7('0x2'));var express=require(_0xb5b7('0x3'));var router=express[_0xb5b7('0x4')]();var fs_extra=require(_0xb5b7('0x5'));var auth=require(_0xb5b7('0x6'));var interaction=require(_0xb5b7('0x7'));var config=require(_0xb5b7('0x8'));var controller=require(_0xb5b7('0x9'));router[_0xb5b7('0xa')]('/',auth[_0xb5b7('0xb')](),controller[_0xb5b7('0xc')]);router[_0xb5b7('0xa')](_0xb5b7('0xd'),controller[_0xb5b7('0xe')]);router['get'](_0xb5b7('0xf'),controller[_0xb5b7('0x10')]);router[_0xb5b7('0xa')]('/:id/logo',controller[_0xb5b7('0x11')]);router[_0xb5b7('0xa')]('/:id/logo_login',controller[_0xb5b7('0x12')]);router['get'](_0xb5b7('0x13'),controller[_0xb5b7('0x14')]);router[_0xb5b7('0xa')](_0xb5b7('0x15'),controller['getPreferred']);router[_0xb5b7('0xa')]('/:id/favicon',controller[_0xb5b7('0x16')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x312c33,_0x18568a,_0x16b620){_0x16b620(null,path[_0xb5b7('0x17')](config['root'],'server/files/images/logos/'));},'filename':function(_0x3a6bc0,_0x3da58e,_0x869820){_0x869820(null,util[_0xb5b7('0x18')](_0xb5b7('0x19'),_0xb5b7('0x1a'),path[_0xb5b7('0x1b')](_0x3da58e[_0xb5b7('0x1c')])));}})});router[_0xb5b7('0x1d')](_0xb5b7('0x1e'),upload[_0xb5b7('0x1f')](_0xb5b7('0x20')),controller[_0xb5b7('0x21')]);var upload=multer({'storage':multer[_0xb5b7('0x22')]({'destination':function(_0x2c782b,_0x56783a,_0x2ab56c){_0x2ab56c(null,path[_0xb5b7('0x17')](config['root'],'server/files/images/logos/'));},'filename':function(_0x3bf4b2,_0x2d2e1f,_0xc92b25){_0xc92b25(null,util[_0xb5b7('0x18')](_0xb5b7('0x19'),_0xb5b7('0x23'),path['extname'](_0x2d2e1f[_0xb5b7('0x1c')])));}})});router[_0xb5b7('0x1d')](_0xb5b7('0x24'),upload['single'](_0xb5b7('0x20')),controller['addLogoLogin']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x113dfc,_0x4983a9,_0x28d2c0){_0x28d2c0(null,path['join'](config[_0xb5b7('0x25')],_0xb5b7('0x26')));},'filename':function(_0x456d53,_0x55554e,_0x3cc941){_0x3cc941(null,util[_0xb5b7('0x18')](_0xb5b7('0x19'),'preferred',path[_0xb5b7('0x1b')](_0x55554e[_0xb5b7('0x1c')])));}})});router['post'](_0xb5b7('0x15'),upload[_0xb5b7('0x1f')](_0xb5b7('0x20')),controller[_0xb5b7('0x27')]);var upload=multer({'storage':multer[_0xb5b7('0x22')]({'destination':function(_0x55ed15,_0xb6d531,_0x566bf7){_0x566bf7(null,path[_0xb5b7('0x17')](config['root'],_0xb5b7('0x26')));},'filename':function(_0x27fa02,_0x361273,_0x5d6b98){_0x5d6b98(null,util[_0xb5b7('0x18')](_0xb5b7('0x19'),_0xb5b7('0x28'),path[_0xb5b7('0x1b')](_0x361273[_0xb5b7('0x1c')])));}})});router[_0xb5b7('0x1d')](_0xb5b7('0x29'),upload['single'](_0xb5b7('0x20')),controller['addFavicon']);router[_0xb5b7('0x2a')](_0xb5b7('0xf'),auth[_0xb5b7('0xb')](),controller['update']);module[_0xb5b7('0x2b')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 04a43c1..67b49a7 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 _0x434e=['min_internal','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','UNSIGNED','exports','INTEGER'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0x434e,0x10c));var _0xe434=function(_0x25bca6,_0xe415ea){_0x25bca6=_0x25bca6-0x0;var _0x3f8d02=_0x434e[_0x25bca6];return _0x3f8d02;};'use strict';var Sequelize=require('sequelize');module[_0xe434('0x0')]={'min_internal':{'type':Sequelize[_0xe434('0x1')](0xb),'unique':_0xe434('0x2'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0xe434('0x1')](0xb),'unique':_0xe434('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0xe434('0x1')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0xe434('0x4')],'defaultValue':_0xe434('0x5')},'logo':{'type':Sequelize['STRING']},'defaultLogo':{'type':Sequelize[_0xe434('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0xe434('0x4')]},'defaultLoginLogo':{'type':Sequelize[_0xe434('0x6')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0xe434('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0xe434('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0xe434('0x6')],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize['STRING']},'turnusername':{'type':Sequelize[_0xe434('0x4')]},'turnpassword':{'type':Sequelize[_0xe434('0x4')]},'pageTitle':{'type':Sequelize['STRING']},'defaultPageTitle':{'type':Sequelize[_0xe434('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0xe434('0x1')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0xe434('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0xe434('0x4')],'defaultValue':_0xe434('0x7')},'enableEmailPreview':{'type':Sequelize[_0xe434('0x6')],'defaultValue':![]},'split':{'type':Sequelize[_0xe434('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0xe434('0x1')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0xe434('0x1')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0xe434('0x4')],'defaultValue':_0xe434('0x8')},'chatTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0xe434('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0xe434('0x4')]},'defaultPreferred':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0xe434('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0xe434('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0xe434('0x1')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0xe434('0x1')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0xe434('0x4')]},'defaultFavicon':{'type':Sequelize[_0xe434('0x6')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize['INTEGER'],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0xe434('0x6')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0xe434('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0xe434('0x4')]},'sentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0xe434('0x6')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0xe434('0x1')]},'sentimentRegion':{'type':Sequelize[_0xe434('0x4')]},'language':{'type':Sequelize[_0xe434('0x4')]},'bucket':{'type':Sequelize['STRING']},'googleSsoEnabled':{'type':Sequelize[_0xe434('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0xe434('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0xe434('0x1')](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0xe434('0x1')](0x2)[_0xe434('0x9')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize['INTEGER'](0x2)[_0xe434('0x9')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0xe434('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0xe434('0x1')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0xe434('0x1')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0xe434('0x1')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0xe434('0x1')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0xe434('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0xe434('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0xe434('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0xe434('0x1')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0xe434('0x1')],'defaultValue':0x14},'filterFullName':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x51c2=['INTEGER','min_internal','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','UNSIGNED','sequelize'];(function(_0x1c9d0e,_0x3f4701){var _0x918fbb=function(_0x284970){while(--_0x284970){_0x1c9d0e['push'](_0x1c9d0e['shift']());}};_0x918fbb(++_0x3f4701);}(_0x51c2,0xe5));var _0x251c=function(_0x2405bc,_0x2f28a1){_0x2405bc=_0x2405bc-0x0;var _0x5272d4=_0x51c2[_0x2405bc];return _0x5272d4;};'use strict';var Sequelize=require(_0x251c('0x0'));module['exports']={'min_internal':{'type':Sequelize[_0x251c('0x1')](0xb),'unique':_0x251c('0x2'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x251c('0x1')](0xb),'unique':_0x251c('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x251c('0x1')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x251c('0x4')],'defaultValue':_0x251c('0x5')},'logo':{'type':Sequelize[_0x251c('0x4')]},'defaultLogo':{'type':Sequelize[_0x251c('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x251c('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize['STRING']},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x251c('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x251c('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x251c('0x4')]},'turnaddr':{'type':Sequelize['STRING']},'turnusername':{'type':Sequelize[_0x251c('0x4')]},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x251c('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x251c('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x251c('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x251c('0x4')],'defaultValue':_0x251c('0x7')},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize[_0x251c('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x251c('0x1')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x251c('0x1')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x251c('0x1')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0x251c('0x8')},'chatTimeout':{'type':Sequelize[_0x251c('0x1')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x251c('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x251c('0x4')]},'defaultPreferred':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x251c('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x251c('0x4')]},'allowedLoginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'blockDuration':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x251c('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x251c('0x1')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x251c('0x6')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x251c('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x251c('0x1')]},'transcribeRegion':{'type':Sequelize['STRING']},'sentiment':{'type':Sequelize[_0x251c('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x251c('0x6')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x251c('0x1')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'bucket':{'type':Sequelize[_0x251c('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x251c('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x251c('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x251c('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x251c('0x1')](0x2)[_0x251c('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x251c('0x1')](0x2)[_0x251c('0x9')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x251c('0x1')](0x2)[_0x251c('0x9')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize['INTEGER'](0x2)[_0x251c('0x9')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x251c('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x251c('0x1')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x251c('0x1')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x251c('0x1')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x251c('0x1')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0x251c('0x1')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x251c('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x251c('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize['INTEGER'],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x251c('0x1')],'defaultValue':0x14},'filterFullName':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 3642e5d..372a6e5 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 _0xf021=['getLogo','server/files/images/logos','preferred','favicon','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','default_logo.svg','default','upperFirst','custom','Sequelize','\x20not\x20found','download','getLogoLogin','getLicense','defaultLogo','defaultLoginLogo','default_loginLogo.svg','ValidationError','securePassword','addPreferred','getPreferred','addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset','now','format','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','client','http','request','then','info','Setting,\x20%s,\x20%s','debug','error','code','message','request\x20sent','result','catch','status','end','offset','undefined','limit','set','Content-Range','json','apply','save','update','destroy','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','key','keys','intersection','model','query','attributes','fields','length','hasOwnProperty','sort','where','filters','pick','VIRTUAL','filter','options','Setting','count','includeAll','include','findAll','rows','show','merge','find','body','params','addLogo','logo','file','filename','addLogoLogin','loginLogo'];(function(_0x5f382f,_0x3f1432){var _0x3bb11b=function(_0x4daf9b){while(--_0x4daf9b){_0x5f382f['push'](_0x5f382f['shift']());}};_0x3bb11b(++_0x3f1432);}(_0xf021,0x18f));var _0x1f02=function(_0xeb4c8b,_0x1dc497){_0xeb4c8b=_0xeb4c8b-0x0;var _0x90b0d0=_0xf021[_0xeb4c8b];return _0x90b0d0;};'use strict';var emlformat=require(_0x1f02('0x0'));var rimraf=require(_0x1f02('0x1'));var zipdir=require(_0x1f02('0x2'));var jsonpatch=require(_0x1f02('0x3'));var rp=require(_0x1f02('0x4'));var moment=require('moment');var BPromise=require(_0x1f02('0x5'));var Mustache=require('mustache');var util=require(_0x1f02('0x6'));var path=require(_0x1f02('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1f02('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1f02('0x9'));var squel=require(_0x1f02('0xa'));var crypto=require(_0x1f02('0xb'));var jsforce=require(_0x1f02('0xc'));var deskjs=require(_0x1f02('0xd'));var toCsv=require('to-csv');var querystring=require(_0x1f02('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x1f02('0xf'));var as=require(_0x1f02('0x10'));var hardwareService=require(_0x1f02('0x11'));var logger=require(_0x1f02('0x12'))(_0x1f02('0x13'));var utils=require('../../config/utils');var config=require(_0x1f02('0x14'));var licenseUtil=require(_0x1f02('0x15'));var db=require(_0x1f02('0x16'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x1f02('0x17')][_0x1f02('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x154a1e,_0x567f8a,_0x5b12e8,_0x4974bd){return new BPromise(function(_0x11ba7e,_0x2c08ad){var _0x354ad1=_0x4974bd||client;return _0x354ad1[_0x1f02('0x19')](_0x154a1e,_0x5b12e8)[_0x1f02('0x1a')](function(_0x45bae1){logger[_0x1f02('0x1b')](_0x1f02('0x1c'),_0x567f8a,'request\x20sent');logger[_0x1f02('0x1d')]('Setting,\x20%s,\x20%s,\x20%s',_0x567f8a,'request\x20sent',JSON['stringify'](_0x45bae1));if(_0x45bae1['error']){if(_0x45bae1[_0x1f02('0x1e')][_0x1f02('0x1f')]===0x1f4){logger[_0x1f02('0x1e')]('Setting,\x20%s,\x20%s',_0x567f8a,_0x45bae1[_0x1f02('0x1e')][_0x1f02('0x20')]);return _0x2c08ad(_0x45bae1[_0x1f02('0x1e')][_0x1f02('0x20')]);}logger['error']('Setting,\x20%s,\x20%s',_0x567f8a,_0x45bae1[_0x1f02('0x1e')][_0x1f02('0x20')]);return _0x11ba7e(_0x45bae1['error']['message']);}else{logger[_0x1f02('0x1b')](_0x1f02('0x1c'),_0x567f8a,_0x1f02('0x21'));_0x11ba7e(_0x45bae1[_0x1f02('0x22')]['message']);}})[_0x1f02('0x23')](function(_0x127b1d){logger[_0x1f02('0x1e')](_0x1f02('0x1c'),_0x567f8a,_0x127b1d);_0x2c08ad(_0x127b1d);});});}function respondWithStatusCode(_0x43b3e7,_0x134398){_0x134398=_0x134398||0xcc;return function(_0x1328ea){if(_0x1328ea){return _0x43b3e7['sendStatus'](_0x134398);}return _0x43b3e7[_0x1f02('0x24')](_0x134398)[_0x1f02('0x25')]();};}function respondWithResult(_0x47bc22,_0x25a8d1){_0x25a8d1=_0x25a8d1||0xc8;return function(_0x43db49){if(_0x43db49){return _0x47bc22['status'](_0x25a8d1)['json'](_0x43db49);}};}function respondWithFilteredResult(_0x3f7426,_0x36c8c1){return function(_0x3c3fda){if(_0x3c3fda){var _0xf2b9a8=typeof _0x36c8c1[_0x1f02('0x26')]===_0x1f02('0x27')&&typeof _0x36c8c1[_0x1f02('0x28')]==='undefined';var _0x4d5f7e=_0x3c3fda['count'];var _0x3ef4bf=_0xf2b9a8?0x0:_0x36c8c1[_0x1f02('0x26')];var _0x23059a=_0xf2b9a8?_0x3c3fda['count']:_0x36c8c1['offset']+_0x36c8c1[_0x1f02('0x28')];var _0x6e88d5;if(_0x23059a>=_0x4d5f7e){_0x23059a=_0x4d5f7e;_0x6e88d5=0xc8;}else{_0x6e88d5=0xce;}_0x3f7426[_0x1f02('0x24')](_0x6e88d5);return _0x3f7426[_0x1f02('0x29')](_0x1f02('0x2a'),_0x3ef4bf+'-'+_0x23059a+'/'+_0x4d5f7e)[_0x1f02('0x2b')](_0x3c3fda);}return null;};}function patchUpdates(_0x442333){return function(_0x23fa22){try{jsonpatch[_0x1f02('0x2c')](_0x23fa22,_0x442333,!![]);}catch(_0x2869b0){return BPromise['reject'](_0x2869b0);}return _0x23fa22[_0x1f02('0x2d')]();};}function saveUpdates(_0x5ab7a2,_0xa61d8f){return function(_0x3b3b57){if(_0x3b3b57){return _0x3b3b57[_0x1f02('0x2e')](_0x5ab7a2)[_0x1f02('0x1a')](function(_0x28a572){return _0x28a572;});}return null;};}function removeEntity(_0x194c85,_0x58f332){return function(_0x48ae22){if(_0x48ae22){return _0x48ae22[_0x1f02('0x2f')]()[_0x1f02('0x1a')](function(){_0x194c85['status'](0xcc)[_0x1f02('0x25')]();});}};}function handleEntityNotFound(_0x4d1aec,_0x34b0d2){return function(_0x4e7add){if(!_0x4e7add){_0x4d1aec[_0x1f02('0x30')](0x194);}return _0x4e7add;};}function handleError(_0x5482d9,_0x596fcc){_0x596fcc=_0x596fcc||0x1f4;return function(_0x26f33e){logger[_0x1f02('0x1e')](_0x26f33e[_0x1f02('0x31')]);if(_0x26f33e[_0x1f02('0x32')]){delete _0x26f33e['name'];}_0x5482d9[_0x1f02('0x24')](_0x596fcc)[_0x1f02('0x33')](_0x26f33e);};}exports[_0x1f02('0x34')]=function(_0x507866,_0x68a2cb){var _0x3454aa={},_0x2a82fa={},_0x390686={'count':0x0,'rows':[]};var _0x4292b7=_[_0x1f02('0x35')](db['Setting'][_0x1f02('0x36')],function(_0x143e18){return{'name':_0x143e18[_0x1f02('0x37')],'type':_0x143e18['type'][_0x1f02('0x38')]};});_0x2a82fa['model']=_[_0x1f02('0x35')](_0x4292b7,'name');_0x2a82fa['query']=_[_0x1f02('0x39')](_0x507866['query']);_0x2a82fa['filters']=_[_0x1f02('0x3a')](_0x2a82fa[_0x1f02('0x3b')],_0x2a82fa[_0x1f02('0x3c')]);_0x3454aa[_0x1f02('0x3d')]=_['intersection'](_0x2a82fa[_0x1f02('0x3b')],qs['fields'](_0x507866[_0x1f02('0x3c')][_0x1f02('0x3e')]));_0x3454aa[_0x1f02('0x3d')]=_0x3454aa[_0x1f02('0x3d')][_0x1f02('0x3f')]?_0x3454aa[_0x1f02('0x3d')]:_0x2a82fa[_0x1f02('0x3b')];if(!_0x507866[_0x1f02('0x3c')][_0x1f02('0x40')]('nolimit')){_0x3454aa[_0x1f02('0x28')]=qs['limit'](_0x507866[_0x1f02('0x3c')]['limit']);_0x3454aa[_0x1f02('0x26')]=qs[_0x1f02('0x26')](_0x507866[_0x1f02('0x3c')]['offset']);}_0x3454aa['order']=qs[_0x1f02('0x41')](_0x507866[_0x1f02('0x3c')][_0x1f02('0x41')]);_0x3454aa[_0x1f02('0x42')]=qs[_0x1f02('0x43')](_[_0x1f02('0x44')](_0x507866[_0x1f02('0x3c')],_0x2a82fa[_0x1f02('0x43')]),_0x4292b7);if(_0x507866[_0x1f02('0x3c')]['filter']){_0x3454aa[_0x1f02('0x42')]=_['merge'](_0x3454aa['where'],{'$or':_[_0x1f02('0x35')](_0x4292b7,function(_0x4e185a){if(_0x4e185a['type']!==_0x1f02('0x45')){var _0x55ad2b={};_0x55ad2b[_0x4e185a['name']]={'$like':'%'+_0x507866[_0x1f02('0x3c')][_0x1f02('0x46')]+'%'};return _0x55ad2b;}})});}_0x3454aa=_['merge']({},_0x3454aa,_0x507866[_0x1f02('0x47')]);var _0x1ec899={'where':_0x3454aa[_0x1f02('0x42')]};return db[_0x1f02('0x48')]['count'](_0x1ec899)[_0x1f02('0x1a')](function(_0x30d438){_0x390686[_0x1f02('0x49')]=_0x30d438;if(_0x507866[_0x1f02('0x3c')][_0x1f02('0x4a')]){_0x3454aa[_0x1f02('0x4b')]=[{'all':!![]}];}return db[_0x1f02('0x48')][_0x1f02('0x4c')](_0x3454aa);})[_0x1f02('0x1a')](function(_0x282e5b){_0x390686[_0x1f02('0x4d')]=_0x282e5b;return _0x390686;})[_0x1f02('0x1a')](respondWithFilteredResult(_0x68a2cb,_0x3454aa))[_0x1f02('0x23')](handleError(_0x68a2cb,null));};exports[_0x1f02('0x4e')]=function(_0x5b6d49,_0x240f49){var _0x50d5ed={'raw':![],'where':{'id':_0x5b6d49['params']['id']}},_0x37759d={};_0x37759d[_0x1f02('0x3b')]=_[_0x1f02('0x39')](db[_0x1f02('0x48')][_0x1f02('0x36')]);_0x37759d[_0x1f02('0x3c')]=_[_0x1f02('0x39')](_0x5b6d49[_0x1f02('0x3c')]);_0x37759d[_0x1f02('0x43')]=_[_0x1f02('0x3a')](_0x37759d[_0x1f02('0x3b')],_0x37759d[_0x1f02('0x3c')]);_0x50d5ed['attributes']=_[_0x1f02('0x3a')](_0x37759d[_0x1f02('0x3b')],qs[_0x1f02('0x3e')](_0x5b6d49[_0x1f02('0x3c')][_0x1f02('0x3e')]));_0x50d5ed[_0x1f02('0x3d')]=_0x50d5ed[_0x1f02('0x3d')][_0x1f02('0x3f')]?_0x50d5ed[_0x1f02('0x3d')]:_0x37759d['model'];if(_0x5b6d49[_0x1f02('0x3c')][_0x1f02('0x4a')]){_0x50d5ed[_0x1f02('0x4b')]=[{'all':!![]}];}_0x50d5ed=_[_0x1f02('0x4f')]({},_0x50d5ed,_0x5b6d49[_0x1f02('0x47')]);return db['Setting'][_0x1f02('0x50')](_0x50d5ed)['then'](handleEntityNotFound(_0x240f49,null))[_0x1f02('0x1a')](respondWithResult(_0x240f49,null))[_0x1f02('0x23')](handleError(_0x240f49,null));};exports[_0x1f02('0x2e')]=function(_0x18d80d,_0x2eb2f4){if(_0x18d80d[_0x1f02('0x51')]['id']){delete _0x18d80d[_0x1f02('0x51')]['id'];}return db[_0x1f02('0x48')][_0x1f02('0x50')]({'where':{'id':_0x18d80d[_0x1f02('0x52')]['id']}})['then'](handleEntityNotFound(_0x2eb2f4,null))['then'](saveUpdates(_0x18d80d['body'],null))[_0x1f02('0x1a')](respondWithResult(_0x2eb2f4,null))['catch'](handleError(_0x2eb2f4,null));};exports[_0x1f02('0x53')]=function(_0x449d58,_0x587873,_0x5a8768){if(_0x449d58['file']&&_0x449d58['file']['filename']){_0x449d58[_0x1f02('0x51')][_0x1f02('0x54')]=_0x449d58[_0x1f02('0x55')][_0x1f02('0x56')];}return db[_0x1f02('0x48')][_0x1f02('0x50')]({'where':{'id':_0x449d58['params']['id']}})[_0x1f02('0x1a')](handleEntityNotFound(_0x587873,null))[_0x1f02('0x1a')](saveUpdates(_0x449d58['body'],null))['then'](respondWithResult(_0x587873,null))[_0x1f02('0x23')](handleError(_0x587873,null));};exports[_0x1f02('0x57')]=function(_0x270bab,_0x47efdf,_0x1c515c){if(_0x270bab['file']&&_0x270bab[_0x1f02('0x55')]['filename']){_0x270bab[_0x1f02('0x51')][_0x1f02('0x58')]=_0x270bab[_0x1f02('0x55')][_0x1f02('0x56')];}return db[_0x1f02('0x48')][_0x1f02('0x50')]({'where':{'id':_0x270bab[_0x1f02('0x52')]['id']}})[_0x1f02('0x1a')](handleEntityNotFound(_0x47efdf,null))[_0x1f02('0x1a')](saveUpdates(_0x270bab[_0x1f02('0x51')],null))[_0x1f02('0x1a')](respondWithResult(_0x47efdf,null))[_0x1f02('0x23')](handleError(_0x47efdf,null));};var utilLicense=require(_0x1f02('0x15'));exports[_0x1f02('0x59')]=function(_0x34e2af,_0x14038a,_0x2218dd){var _0x3a465f=_0x1f02('0x5a');var _0x283060={'custom':![]};return utilLicense['getLicense']()[_0x1f02('0x1a')](function(_0x225e17){if(_0x225e17){_0x283060=_0x225e17;}return db['Setting'][_0x1f02('0x50')]({'where':{'id':_0x34e2af[_0x1f02('0x52')]['id']},'attributes':['logo',_0x1f02('0x58'),_0x1f02('0x5b'),_0x1f02('0x5c'),'defaultLogo','defaultLoginLogo',_0x1f02('0x5d'),_0x1f02('0x5e')],'raw':!![]});})[_0x1f02('0x1a')](handleEntityNotFound(_0x14038a,null))[_0x1f02('0x1a')](function(_0x6a2cd8){if(_0x6a2cd8){var _0x2f971c=_0x6a2cd8[_0x1f02('0x54')]&&fs[_0x1f02('0x5f')](path[_0x1f02('0x60')](config[_0x1f02('0x61')],_0x3a465f,_['toLower'](_0x6a2cd8[_0x1f02('0x54')])))?path['join'](config['root'],_0x3a465f,_[_0x1f02('0x62')](_0x6a2cd8[_0x1f02('0x54')])):path[_0x1f02('0x60')](config[_0x1f02('0x61')],_0x3a465f,_[_0x1f02('0x62')](_0x1f02('0x63')));var _0x2fb8bb=_0x1f02('0x64')+_[_0x1f02('0x65')](_0x1f02('0x54'));if(_0x6a2cd8[_0x2fb8bb]||!_0x283060[_0x1f02('0x66')]){_0x2f971c=path[_0x1f02('0x60')](config[_0x1f02('0x61')],_0x3a465f,_['toLower']('default_logo.svg'));}if(!fs[_0x1f02('0x5f')](_0x2f971c)){throw new db[(_0x1f02('0x67'))]['ValidationError'](_['upperFirst'](_0x1f02('0x54'))+_0x1f02('0x68'));}return _0x14038a[_0x1f02('0x69')](_0x2f971c);}})[_0x1f02('0x23')](handleError(_0x14038a,null));};var utilLicense=require(_0x1f02('0x15'));exports[_0x1f02('0x6a')]=function(_0x5b10cd,_0x2e7c1b,_0x5ee858){var _0x386df5=_0x1f02('0x5a');var _0x2886b4={'custom':![]};return utilLicense[_0x1f02('0x6b')]()[_0x1f02('0x1a')](function(_0x452ca2){if(_0x452ca2){_0x2886b4=_0x452ca2;}return db[_0x1f02('0x48')]['find']({'where':{'id':_0x5b10cd[_0x1f02('0x52')]['id']},'attributes':[_0x1f02('0x54'),_0x1f02('0x58'),_0x1f02('0x5b'),_0x1f02('0x5c'),_0x1f02('0x6c'),_0x1f02('0x6d'),_0x1f02('0x5d'),_0x1f02('0x5e')],'raw':!![]});})[_0x1f02('0x1a')](handleEntityNotFound(_0x2e7c1b,null))[_0x1f02('0x1a')](function(_0x48655c){if(_0x48655c){var _0x572965=_0x48655c[_0x1f02('0x58')]&&fs[_0x1f02('0x5f')](path[_0x1f02('0x60')](config[_0x1f02('0x61')],_0x386df5,_[_0x1f02('0x62')](_0x48655c[_0x1f02('0x58')])))?path[_0x1f02('0x60')](config[_0x1f02('0x61')],_0x386df5,_[_0x1f02('0x62')](_0x48655c[_0x1f02('0x58')])):path[_0x1f02('0x60')](config[_0x1f02('0x61')],_0x386df5,_[_0x1f02('0x62')](_0x1f02('0x6e')));var _0x4187b9=_0x1f02('0x64')+_[_0x1f02('0x65')](_0x1f02('0x58'));if(_0x48655c[_0x4187b9]||!_0x2886b4['custom']){_0x572965=path['join'](config[_0x1f02('0x61')],_0x386df5,_[_0x1f02('0x62')]('default_loginLogo.svg'));}if(!fs[_0x1f02('0x5f')](_0x572965)){throw new db[(_0x1f02('0x67'))][(_0x1f02('0x6f'))](_[_0x1f02('0x65')](_0x1f02('0x58'))+_0x1f02('0x68'));}return _0x2e7c1b[_0x1f02('0x69')](_0x572965);}})[_0x1f02('0x23')](handleError(_0x2e7c1b,null));};exports['gdpr']=function(_0x1343af,_0x14d455){return db[_0x1f02('0x48')][_0x1f02('0x50')]({'where':{'id':_0x1343af[_0x1f02('0x52')]['id']},'attributes':[_0x1f02('0x70')]})[_0x1f02('0x1a')](respondWithResult(_0x14d455,null))[_0x1f02('0x23')](handleError(_0x14d455,null));};exports[_0x1f02('0x71')]=function(_0x5b64d4,_0x27bd93,_0x1bf800){if(_0x5b64d4['file']&&_0x5b64d4[_0x1f02('0x55')]['filename']){_0x5b64d4[_0x1f02('0x51')][_0x1f02('0x5b')]=_0x5b64d4[_0x1f02('0x55')][_0x1f02('0x56')];}return db[_0x1f02('0x48')][_0x1f02('0x50')]({'where':{'id':_0x5b64d4[_0x1f02('0x52')]['id']}})[_0x1f02('0x1a')](handleEntityNotFound(_0x27bd93,null))[_0x1f02('0x1a')](saveUpdates(_0x5b64d4[_0x1f02('0x51')],null))[_0x1f02('0x1a')](respondWithResult(_0x27bd93,null))[_0x1f02('0x23')](handleError(_0x27bd93,null));};var utilLicense=require(_0x1f02('0x15'));exports[_0x1f02('0x72')]=function(_0x3af2fa,_0x3e0332,_0x119420){var _0x18ed82=_0x1f02('0x5a');var _0x337fcf={'custom':![]};return utilLicense[_0x1f02('0x6b')]()[_0x1f02('0x1a')](function(_0x1a1eed){if(_0x1a1eed){_0x337fcf=_0x1a1eed;}return db[_0x1f02('0x48')][_0x1f02('0x50')]({'where':{'id':_0x3af2fa[_0x1f02('0x52')]['id']},'attributes':['logo',_0x1f02('0x58'),_0x1f02('0x5b'),_0x1f02('0x5c'),'defaultLogo',_0x1f02('0x6d'),_0x1f02('0x5d'),_0x1f02('0x5e')],'raw':!![]});})[_0x1f02('0x1a')](handleEntityNotFound(_0x3e0332,null))[_0x1f02('0x1a')](function(_0x440557){if(_0x440557){var _0x582685=_0x440557['preferred']&&fs[_0x1f02('0x5f')](path[_0x1f02('0x60')](config['root'],_0x18ed82,_[_0x1f02('0x62')](_0x440557[_0x1f02('0x5b')])))?path[_0x1f02('0x60')](config['root'],_0x18ed82,_[_0x1f02('0x62')](_0x440557[_0x1f02('0x5b')])):path[_0x1f02('0x60')](config[_0x1f02('0x61')],_0x18ed82,_['toLower']('default_preferred.png'));var _0x293c10=_0x1f02('0x64')+_['upperFirst']('preferred');if(_0x440557[_0x293c10]||!_0x337fcf[_0x1f02('0x66')]||!_0x337fcf[_0x1f02('0x5b')]){_0x582685=path[_0x1f02('0x60')](config[_0x1f02('0x61')],_0x18ed82,_[_0x1f02('0x62')]('default_preferred.png'));}if(!fs[_0x1f02('0x5f')](_0x582685)){throw new db['Sequelize'][(_0x1f02('0x6f'))](_[_0x1f02('0x65')](_0x1f02('0x5b'))+'\x20not\x20found');}return _0x3e0332[_0x1f02('0x69')](_0x582685);}})[_0x1f02('0x23')](handleError(_0x3e0332,null));};exports[_0x1f02('0x73')]=function(_0x55764d,_0x1eca0f,_0xbce1c5){if(_0x55764d[_0x1f02('0x55')]&&_0x55764d[_0x1f02('0x55')]['filename']){_0x55764d[_0x1f02('0x51')]['favicon']=_0x55764d[_0x1f02('0x55')]['filename'];}return db[_0x1f02('0x48')]['find']({'where':{'id':_0x55764d[_0x1f02('0x52')]['id']}})[_0x1f02('0x1a')](handleEntityNotFound(_0x1eca0f,null))['then'](saveUpdates(_0x55764d[_0x1f02('0x51')],null))[_0x1f02('0x1a')](respondWithResult(_0x1eca0f,null))[_0x1f02('0x23')](handleError(_0x1eca0f,null));};var utilLicense=require(_0x1f02('0x15'));exports[_0x1f02('0x74')]=function(_0x541d97,_0x1734cb,_0x34fe7f){var _0x299fa9=_0x1f02('0x5a');var _0x2198eb={'custom':![]};return utilLicense['getLicense']()[_0x1f02('0x1a')](function(_0x31052c){if(_0x31052c){_0x2198eb=_0x31052c;}return db[_0x1f02('0x48')][_0x1f02('0x50')]({'where':{'id':_0x541d97['params']['id']},'attributes':['logo',_0x1f02('0x58'),'preferred',_0x1f02('0x5c'),_0x1f02('0x6c'),_0x1f02('0x6d'),_0x1f02('0x5d'),_0x1f02('0x5e')],'raw':!![]});})[_0x1f02('0x1a')](handleEntityNotFound(_0x1734cb,null))[_0x1f02('0x1a')](function(_0x262bd6){if(_0x262bd6){var _0x5b3fb5=_0x262bd6[_0x1f02('0x5c')]&&fs[_0x1f02('0x5f')](path['join'](config['root'],_0x299fa9,_[_0x1f02('0x62')](_0x262bd6['favicon'])))?path[_0x1f02('0x60')](config['root'],_0x299fa9,_[_0x1f02('0x62')](_0x262bd6['favicon'])):path[_0x1f02('0x60')](config[_0x1f02('0x61')],_0x299fa9,_[_0x1f02('0x62')]('default_favicon.ico'));var _0x3cc8da=_0x1f02('0x64')+_['upperFirst'](_0x1f02('0x5c'));if(_0x262bd6[_0x3cc8da]||!_0x2198eb[_0x1f02('0x66')]){_0x5b3fb5=path[_0x1f02('0x60')](config[_0x1f02('0x61')],_0x299fa9,_[_0x1f02('0x62')](_0x1f02('0x75')));}if(!fs[_0x1f02('0x5f')](_0x5b3fb5)){throw new db[(_0x1f02('0x67'))][(_0x1f02('0x6f'))](_['upperFirst'](_0x1f02('0x5c'))+_0x1f02('0x68'));}return _0x1734cb[_0x1f02('0x69')](_0x5b3fb5);}})['catch'](handleError(_0x1734cb,null));};exports[_0x1f02('0x76')]=function(_0x40a945,_0x23ad42){var _0x1f9e2f={'offset':moment()[_0x1f02('0x77')]()};_0x1f9e2f[_0x1f02('0x78')]=moment()[_0x1f02('0x77')](_0x1f9e2f[_0x1f02('0x26')])[_0x1f02('0x79')]('YYYY-MM-DD\x20HH:mm:ss:SSS');return _0x23ad42[_0x1f02('0x24')](0xc8)[_0x1f02('0x33')](_0x1f9e2f);}; \ No newline at end of file +var _0x8413=['format','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','http','then','info','request\x20sent','debug','stringify','error','code','Setting,\x20%s,\x20%s','message','result','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','name','send','index','map','Setting','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','catch','show','options','find','body','file','filename','addLogoLogin','loginLogo','getLogo','server/files/images/logos','getLicense','params','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','logo','join','toLower','root','default_logo.svg','default','upperFirst','existsSync','ValidationError','\x20not\x20found','default_loginLogo.svg','custom','download','gdpr','securePassword','getPreferred','default_preferred.png','addFavicon','default_favicon.ico','Sequelize','getDate','utcOffset'];(function(_0x3b4492,_0x1b2243){var _0x424f09=function(_0x5cae17){while(--_0x5cae17){_0x3b4492['push'](_0x3b4492['shift']());}};_0x424f09(++_0x1b2243);}(_0x8413,0x7b));var _0x3841=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0x8413[_0x5447fd];return _0x15b28a;};'use strict';var emlformat=require(_0x3841('0x0'));var rimraf=require(_0x3841('0x1'));var zipdir=require(_0x3841('0x2'));var jsonpatch=require(_0x3841('0x3'));var rp=require(_0x3841('0x4'));var moment=require(_0x3841('0x5'));var BPromise=require(_0x3841('0x6'));var Mustache=require(_0x3841('0x7'));var util=require(_0x3841('0x8'));var path=require('path');var sox=require(_0x3841('0x9'));var csv=require(_0x3841('0xa'));var ejs=require(_0x3841('0xb'));var fs=require('fs');var fs_extra=require(_0x3841('0xc'));var _=require(_0x3841('0xd'));var squel=require('squel');var crypto=require(_0x3841('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x3841('0xf'));var toCsv=require(_0x3841('0xa'));var querystring=require(_0x3841('0x10'));var Papa=require(_0x3841('0x11'));var Redis=require(_0x3841('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x3841('0x13'));var as=require(_0x3841('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3841('0x15'))(_0x3841('0x16'));var utils=require(_0x3841('0x17'));var config=require(_0x3841('0x18'));var licenseUtil=require(_0x3841('0x19'));var db=require(_0x3841('0x1a'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x3841('0x1b')][_0x3841('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x515f33,_0x1b8642,_0x16a67a,_0x9febdd){return new BPromise(function(_0xa61092,_0xf0bbb4){var _0x3ce674=_0x9febdd||client;return _0x3ce674['request'](_0x515f33,_0x16a67a)[_0x3841('0x1d')](function(_0x577cf3){logger[_0x3841('0x1e')]('Setting,\x20%s,\x20%s',_0x1b8642,_0x3841('0x1f'));logger[_0x3841('0x20')]('Setting,\x20%s,\x20%s,\x20%s',_0x1b8642,'request\x20sent',JSON[_0x3841('0x21')](_0x577cf3));if(_0x577cf3[_0x3841('0x22')]){if(_0x577cf3[_0x3841('0x22')][_0x3841('0x23')]===0x1f4){logger[_0x3841('0x22')](_0x3841('0x24'),_0x1b8642,_0x577cf3['error'][_0x3841('0x25')]);return _0xf0bbb4(_0x577cf3['error'][_0x3841('0x25')]);}logger[_0x3841('0x22')]('Setting,\x20%s,\x20%s',_0x1b8642,_0x577cf3['error'][_0x3841('0x25')]);return _0xa61092(_0x577cf3['error'][_0x3841('0x25')]);}else{logger[_0x3841('0x1e')]('Setting,\x20%s,\x20%s',_0x1b8642,_0x3841('0x1f'));_0xa61092(_0x577cf3[_0x3841('0x26')][_0x3841('0x25')]);}})['catch'](function(_0x57c8d5){logger[_0x3841('0x22')](_0x3841('0x24'),_0x1b8642,_0x57c8d5);_0xf0bbb4(_0x57c8d5);});});}function respondWithStatusCode(_0x160f86,_0x363c58){_0x363c58=_0x363c58||0xcc;return function(_0x279353){if(_0x279353){return _0x160f86[_0x3841('0x27')](_0x363c58);}return _0x160f86[_0x3841('0x28')](_0x363c58)[_0x3841('0x29')]();};}function respondWithResult(_0x4f7161,_0x38fa26){_0x38fa26=_0x38fa26||0xc8;return function(_0x455bd0){if(_0x455bd0){return _0x4f7161[_0x3841('0x28')](_0x38fa26)[_0x3841('0x2a')](_0x455bd0);}};}function respondWithFilteredResult(_0x231546,_0x5c069b){return function(_0x18387d){if(_0x18387d){var _0x5d8c15=typeof _0x5c069b['offset']===_0x3841('0x2b')&&typeof _0x5c069b[_0x3841('0x2c')]==='undefined';var _0x14a27b=_0x18387d[_0x3841('0x2d')];var _0x10c0b4=_0x5d8c15?0x0:_0x5c069b[_0x3841('0x2e')];var _0x431572=_0x5d8c15?_0x18387d['count']:_0x5c069b[_0x3841('0x2e')]+_0x5c069b[_0x3841('0x2c')];var _0x353e8b;if(_0x431572>=_0x14a27b){_0x431572=_0x14a27b;_0x353e8b=0xc8;}else{_0x353e8b=0xce;}_0x231546[_0x3841('0x28')](_0x353e8b);return _0x231546[_0x3841('0x2f')](_0x3841('0x30'),_0x10c0b4+'-'+_0x431572+'/'+_0x14a27b)[_0x3841('0x2a')](_0x18387d);}return null;};}function patchUpdates(_0x4b2335){return function(_0x26e0bf){try{jsonpatch[_0x3841('0x31')](_0x26e0bf,_0x4b2335,!![]);}catch(_0x398e27){return BPromise[_0x3841('0x32')](_0x398e27);}return _0x26e0bf[_0x3841('0x33')]();};}function saveUpdates(_0x2a385a,_0x3d3586){return function(_0x5d7a16){if(_0x5d7a16){return _0x5d7a16[_0x3841('0x34')](_0x2a385a)[_0x3841('0x1d')](function(_0x1896da){return _0x1896da;});}return null;};}function removeEntity(_0x741e99,_0x5a919e){return function(_0x3ba2bd){if(_0x3ba2bd){return _0x3ba2bd[_0x3841('0x35')]()[_0x3841('0x1d')](function(){_0x741e99[_0x3841('0x28')](0xcc)[_0x3841('0x29')]();});}};}function handleEntityNotFound(_0x2c858d,_0x24b134){return function(_0x4c4fa6){if(!_0x4c4fa6){_0x2c858d['sendStatus'](0x194);}return _0x4c4fa6;};}function handleError(_0x3adb90,_0x1eabdb){_0x1eabdb=_0x1eabdb||0x1f4;return function(_0x586c9f){logger[_0x3841('0x22')](_0x586c9f['stack']);if(_0x586c9f[_0x3841('0x36')]){delete _0x586c9f[_0x3841('0x36')];}_0x3adb90[_0x3841('0x28')](_0x1eabdb)[_0x3841('0x37')](_0x586c9f);};}exports[_0x3841('0x38')]=function(_0x25f14d,_0x30ccb9){var _0x2305d6={},_0x324d3e={},_0x2c3278={'count':0x0,'rows':[]};var _0x4fea90=_[_0x3841('0x39')](db[_0x3841('0x3a')]['rawAttributes'],function(_0x373d01){return{'name':_0x373d01[_0x3841('0x3b')],'type':_0x373d01['type'][_0x3841('0x3c')]};});_0x324d3e[_0x3841('0x3d')]=_[_0x3841('0x39')](_0x4fea90,_0x3841('0x36'));_0x324d3e[_0x3841('0x3e')]=_[_0x3841('0x3f')](_0x25f14d[_0x3841('0x3e')]);_0x324d3e[_0x3841('0x40')]=_[_0x3841('0x41')](_0x324d3e[_0x3841('0x3d')],_0x324d3e[_0x3841('0x3e')]);_0x2305d6[_0x3841('0x42')]=_[_0x3841('0x41')](_0x324d3e[_0x3841('0x3d')],qs['fields'](_0x25f14d[_0x3841('0x3e')][_0x3841('0x43')]));_0x2305d6['attributes']=_0x2305d6['attributes'][_0x3841('0x44')]?_0x2305d6[_0x3841('0x42')]:_0x324d3e[_0x3841('0x3d')];if(!_0x25f14d['query'][_0x3841('0x45')]('nolimit')){_0x2305d6[_0x3841('0x2c')]=qs[_0x3841('0x2c')](_0x25f14d[_0x3841('0x3e')][_0x3841('0x2c')]);_0x2305d6['offset']=qs[_0x3841('0x2e')](_0x25f14d[_0x3841('0x3e')][_0x3841('0x2e')]);}_0x2305d6[_0x3841('0x46')]=qs[_0x3841('0x47')](_0x25f14d[_0x3841('0x3e')]['sort']);_0x2305d6[_0x3841('0x48')]=qs[_0x3841('0x40')](_[_0x3841('0x49')](_0x25f14d[_0x3841('0x3e')],_0x324d3e['filters']),_0x4fea90);if(_0x25f14d[_0x3841('0x3e')][_0x3841('0x4a')]){_0x2305d6[_0x3841('0x48')]=_[_0x3841('0x4b')](_0x2305d6[_0x3841('0x48')],{'$or':_[_0x3841('0x39')](_0x4fea90,function(_0x37383e){if(_0x37383e[_0x3841('0x4c')]!==_0x3841('0x4d')){var _0x2e82ae={};_0x2e82ae[_0x37383e['name']]={'$like':'%'+_0x25f14d[_0x3841('0x3e')]['filter']+'%'};return _0x2e82ae;}})});}_0x2305d6=_[_0x3841('0x4b')]({},_0x2305d6,_0x25f14d['options']);var _0x4d1d94={'where':_0x2305d6[_0x3841('0x48')]};return db[_0x3841('0x3a')]['count'](_0x4d1d94)[_0x3841('0x1d')](function(_0x359de0){_0x2c3278[_0x3841('0x2d')]=_0x359de0;if(_0x25f14d[_0x3841('0x3e')][_0x3841('0x4e')]){_0x2305d6[_0x3841('0x4f')]=[{'all':!![]}];}return db[_0x3841('0x3a')]['findAll'](_0x2305d6);})[_0x3841('0x1d')](function(_0xb54851){_0x2c3278['rows']=_0xb54851;return _0x2c3278;})[_0x3841('0x1d')](respondWithFilteredResult(_0x30ccb9,_0x2305d6))[_0x3841('0x50')](handleError(_0x30ccb9,null));};exports[_0x3841('0x51')]=function(_0x4eb39c,_0x4f4990){var _0x8eef78={'raw':![],'where':{'id':_0x4eb39c['params']['id']}},_0x536042={};_0x536042[_0x3841('0x3d')]=_['keys'](db[_0x3841('0x3a')]['rawAttributes']);_0x536042[_0x3841('0x3e')]=_[_0x3841('0x3f')](_0x4eb39c[_0x3841('0x3e')]);_0x536042[_0x3841('0x40')]=_[_0x3841('0x41')](_0x536042[_0x3841('0x3d')],_0x536042['query']);_0x8eef78['attributes']=_[_0x3841('0x41')](_0x536042[_0x3841('0x3d')],qs['fields'](_0x4eb39c[_0x3841('0x3e')][_0x3841('0x43')]));_0x8eef78[_0x3841('0x42')]=_0x8eef78[_0x3841('0x42')][_0x3841('0x44')]?_0x8eef78['attributes']:_0x536042['model'];if(_0x4eb39c[_0x3841('0x3e')][_0x3841('0x4e')]){_0x8eef78[_0x3841('0x4f')]=[{'all':!![]}];}_0x8eef78=_[_0x3841('0x4b')]({},_0x8eef78,_0x4eb39c[_0x3841('0x52')]);return db[_0x3841('0x3a')][_0x3841('0x53')](_0x8eef78)[_0x3841('0x1d')](handleEntityNotFound(_0x4f4990,null))[_0x3841('0x1d')](respondWithResult(_0x4f4990,null))[_0x3841('0x50')](handleError(_0x4f4990,null));};exports[_0x3841('0x34')]=function(_0x565ad0,_0x358d85){if(_0x565ad0[_0x3841('0x54')]['id']){delete _0x565ad0[_0x3841('0x54')]['id'];}return db[_0x3841('0x3a')][_0x3841('0x53')]({'where':{'id':_0x565ad0['params']['id']}})[_0x3841('0x1d')](handleEntityNotFound(_0x358d85,null))[_0x3841('0x1d')](saveUpdates(_0x565ad0[_0x3841('0x54')],null))['then'](respondWithResult(_0x358d85,null))[_0x3841('0x50')](handleError(_0x358d85,null));};exports['addLogo']=function(_0x83d14c,_0x5625e6,_0x3c3461){if(_0x83d14c[_0x3841('0x55')]&&_0x83d14c[_0x3841('0x55')][_0x3841('0x56')]){_0x83d14c['body']['logo']=_0x83d14c[_0x3841('0x55')]['filename'];}return db[_0x3841('0x3a')][_0x3841('0x53')]({'where':{'id':_0x83d14c['params']['id']}})[_0x3841('0x1d')](handleEntityNotFound(_0x5625e6,null))['then'](saveUpdates(_0x83d14c['body'],null))[_0x3841('0x1d')](respondWithResult(_0x5625e6,null))[_0x3841('0x50')](handleError(_0x5625e6,null));};exports[_0x3841('0x57')]=function(_0x3a6f15,_0xc8d877,_0x9b4e71){if(_0x3a6f15[_0x3841('0x55')]&&_0x3a6f15[_0x3841('0x55')][_0x3841('0x56')]){_0x3a6f15[_0x3841('0x54')][_0x3841('0x58')]=_0x3a6f15[_0x3841('0x55')]['filename'];}return db[_0x3841('0x3a')]['find']({'where':{'id':_0x3a6f15['params']['id']}})[_0x3841('0x1d')](handleEntityNotFound(_0xc8d877,null))['then'](saveUpdates(_0x3a6f15[_0x3841('0x54')],null))[_0x3841('0x1d')](respondWithResult(_0xc8d877,null))['catch'](handleError(_0xc8d877,null));};var utilLicense=require(_0x3841('0x19'));exports[_0x3841('0x59')]=function(_0x5bc3a7,_0x521da0,_0x411913){var _0x4a8448=_0x3841('0x5a');var _0x45cd2e={'custom':![]};return utilLicense[_0x3841('0x5b')]()[_0x3841('0x1d')](function(_0x22d5c9){if(_0x22d5c9){_0x45cd2e=_0x22d5c9;}return db[_0x3841('0x3a')][_0x3841('0x53')]({'where':{'id':_0x5bc3a7[_0x3841('0x5c')]['id']},'attributes':['logo',_0x3841('0x58'),_0x3841('0x5d'),_0x3841('0x5e'),_0x3841('0x5f'),_0x3841('0x60'),_0x3841('0x61'),_0x3841('0x62')],'raw':!![]});})['then'](handleEntityNotFound(_0x521da0,null))[_0x3841('0x1d')](function(_0x156bcd){if(_0x156bcd){var _0x2f3068=_0x156bcd[_0x3841('0x63')]&&fs['existsSync'](path[_0x3841('0x64')](config['root'],_0x4a8448,_[_0x3841('0x65')](_0x156bcd[_0x3841('0x63')])))?path[_0x3841('0x64')](config[_0x3841('0x66')],_0x4a8448,_[_0x3841('0x65')](_0x156bcd['logo'])):path[_0x3841('0x64')](config[_0x3841('0x66')],_0x4a8448,_['toLower'](_0x3841('0x67')));var _0x4a3fee=_0x3841('0x68')+_[_0x3841('0x69')]('logo');if(_0x156bcd[_0x4a3fee]||!_0x45cd2e['custom']){_0x2f3068=path[_0x3841('0x64')](config[_0x3841('0x66')],_0x4a8448,_[_0x3841('0x65')](_0x3841('0x67')));}if(!fs[_0x3841('0x6a')](_0x2f3068)){throw new db['Sequelize'][(_0x3841('0x6b'))](_[_0x3841('0x69')]('logo')+_0x3841('0x6c'));}return _0x521da0['download'](_0x2f3068);}})[_0x3841('0x50')](handleError(_0x521da0,null));};var utilLicense=require(_0x3841('0x19'));exports['getLogoLogin']=function(_0x2c05f9,_0x304216,_0x1da72b){var _0x3b672c=_0x3841('0x5a');var _0x2ca07f={'custom':![]};return utilLicense[_0x3841('0x5b')]()['then'](function(_0x501770){if(_0x501770){_0x2ca07f=_0x501770;}return db[_0x3841('0x3a')]['find']({'where':{'id':_0x2c05f9['params']['id']},'attributes':[_0x3841('0x63'),_0x3841('0x58'),_0x3841('0x5d'),_0x3841('0x5e'),_0x3841('0x5f'),_0x3841('0x60'),_0x3841('0x61'),_0x3841('0x62')],'raw':!![]});})[_0x3841('0x1d')](handleEntityNotFound(_0x304216,null))[_0x3841('0x1d')](function(_0x233da2){if(_0x233da2){var _0x52840e=_0x233da2[_0x3841('0x58')]&&fs[_0x3841('0x6a')](path[_0x3841('0x64')](config['root'],_0x3b672c,_[_0x3841('0x65')](_0x233da2[_0x3841('0x58')])))?path[_0x3841('0x64')](config['root'],_0x3b672c,_[_0x3841('0x65')](_0x233da2[_0x3841('0x58')])):path['join'](config[_0x3841('0x66')],_0x3b672c,_[_0x3841('0x65')](_0x3841('0x6d')));var _0x149b92='default'+_[_0x3841('0x69')](_0x3841('0x58'));if(_0x233da2[_0x149b92]||!_0x2ca07f[_0x3841('0x6e')]){_0x52840e=path[_0x3841('0x64')](config[_0x3841('0x66')],_0x3b672c,_[_0x3841('0x65')](_0x3841('0x6d')));}if(!fs['existsSync'](_0x52840e)){throw new db['Sequelize'][(_0x3841('0x6b'))](_[_0x3841('0x69')](_0x3841('0x58'))+_0x3841('0x6c'));}return _0x304216[_0x3841('0x6f')](_0x52840e);}})['catch'](handleError(_0x304216,null));};exports[_0x3841('0x70')]=function(_0x1346cb,_0x37f7e4){return db[_0x3841('0x3a')][_0x3841('0x53')]({'where':{'id':_0x1346cb[_0x3841('0x5c')]['id']},'attributes':[_0x3841('0x71')]})[_0x3841('0x1d')](respondWithResult(_0x37f7e4,null))['catch'](handleError(_0x37f7e4,null));};exports['addPreferred']=function(_0x2154ff,_0xeb0cd,_0x247b9c){if(_0x2154ff[_0x3841('0x55')]&&_0x2154ff[_0x3841('0x55')][_0x3841('0x56')]){_0x2154ff['body']['preferred']=_0x2154ff['file']['filename'];}return db[_0x3841('0x3a')][_0x3841('0x53')]({'where':{'id':_0x2154ff[_0x3841('0x5c')]['id']}})[_0x3841('0x1d')](handleEntityNotFound(_0xeb0cd,null))[_0x3841('0x1d')](saveUpdates(_0x2154ff[_0x3841('0x54')],null))[_0x3841('0x1d')](respondWithResult(_0xeb0cd,null))[_0x3841('0x50')](handleError(_0xeb0cd,null));};var utilLicense=require(_0x3841('0x19'));exports[_0x3841('0x72')]=function(_0x5bd926,_0x212eed,_0x4f3efa){var _0x242918=_0x3841('0x5a');var _0x1dc563={'custom':![]};return utilLicense['getLicense']()[_0x3841('0x1d')](function(_0x49d91b){if(_0x49d91b){_0x1dc563=_0x49d91b;}return db[_0x3841('0x3a')]['find']({'where':{'id':_0x5bd926['params']['id']},'attributes':['logo',_0x3841('0x58'),_0x3841('0x5d'),'favicon','defaultLogo',_0x3841('0x60'),_0x3841('0x61'),_0x3841('0x62')],'raw':!![]});})[_0x3841('0x1d')](handleEntityNotFound(_0x212eed,null))[_0x3841('0x1d')](function(_0x613e0d){if(_0x613e0d){var _0x4fac5f=_0x613e0d[_0x3841('0x5d')]&&fs['existsSync'](path[_0x3841('0x64')](config[_0x3841('0x66')],_0x242918,_[_0x3841('0x65')](_0x613e0d[_0x3841('0x5d')])))?path[_0x3841('0x64')](config[_0x3841('0x66')],_0x242918,_[_0x3841('0x65')](_0x613e0d[_0x3841('0x5d')])):path[_0x3841('0x64')](config[_0x3841('0x66')],_0x242918,_['toLower'](_0x3841('0x73')));var _0x42e8b7='default'+_[_0x3841('0x69')](_0x3841('0x5d'));if(_0x613e0d[_0x42e8b7]||!_0x1dc563['custom']||!_0x1dc563['preferred']){_0x4fac5f=path[_0x3841('0x64')](config['root'],_0x242918,_[_0x3841('0x65')](_0x3841('0x73')));}if(!fs['existsSync'](_0x4fac5f)){throw new db['Sequelize'][(_0x3841('0x6b'))](_[_0x3841('0x69')]('preferred')+'\x20not\x20found');}return _0x212eed[_0x3841('0x6f')](_0x4fac5f);}})[_0x3841('0x50')](handleError(_0x212eed,null));};exports[_0x3841('0x74')]=function(_0x500b8c,_0x4f5bf4,_0x5ac7f4){if(_0x500b8c['file']&&_0x500b8c[_0x3841('0x55')][_0x3841('0x56')]){_0x500b8c[_0x3841('0x54')][_0x3841('0x5e')]=_0x500b8c[_0x3841('0x55')]['filename'];}return db[_0x3841('0x3a')][_0x3841('0x53')]({'where':{'id':_0x500b8c[_0x3841('0x5c')]['id']}})[_0x3841('0x1d')](handleEntityNotFound(_0x4f5bf4,null))[_0x3841('0x1d')](saveUpdates(_0x500b8c[_0x3841('0x54')],null))['then'](respondWithResult(_0x4f5bf4,null))[_0x3841('0x50')](handleError(_0x4f5bf4,null));};var utilLicense=require('../../config/license/util');exports['getFavicon']=function(_0x152a47,_0x9ed367,_0xf3471a){var _0x30ada7=_0x3841('0x5a');var _0xadefe3={'custom':![]};return utilLicense[_0x3841('0x5b')]()['then'](function(_0x203244){if(_0x203244){_0xadefe3=_0x203244;}return db['Setting']['find']({'where':{'id':_0x152a47['params']['id']},'attributes':['logo',_0x3841('0x58'),_0x3841('0x5d'),'favicon',_0x3841('0x5f'),_0x3841('0x60'),_0x3841('0x61'),_0x3841('0x62')],'raw':!![]});})[_0x3841('0x1d')](handleEntityNotFound(_0x9ed367,null))[_0x3841('0x1d')](function(_0x4e80a5){if(_0x4e80a5){var _0x3bf4d1=_0x4e80a5[_0x3841('0x5e')]&&fs[_0x3841('0x6a')](path[_0x3841('0x64')](config['root'],_0x30ada7,_[_0x3841('0x65')](_0x4e80a5[_0x3841('0x5e')])))?path[_0x3841('0x64')](config[_0x3841('0x66')],_0x30ada7,_[_0x3841('0x65')](_0x4e80a5[_0x3841('0x5e')])):path[_0x3841('0x64')](config['root'],_0x30ada7,_['toLower'](_0x3841('0x75')));var _0x3094fb=_0x3841('0x68')+_['upperFirst'](_0x3841('0x5e'));if(_0x4e80a5[_0x3094fb]||!_0xadefe3[_0x3841('0x6e')]){_0x3bf4d1=path[_0x3841('0x64')](config[_0x3841('0x66')],_0x30ada7,_[_0x3841('0x65')](_0x3841('0x75')));}if(!fs[_0x3841('0x6a')](_0x3bf4d1)){throw new db[(_0x3841('0x76'))][(_0x3841('0x6b'))](_[_0x3841('0x69')](_0x3841('0x5e'))+'\x20not\x20found');}return _0x9ed367[_0x3841('0x6f')](_0x3bf4d1);}})[_0x3841('0x50')](handleError(_0x9ed367,null));};exports[_0x3841('0x77')]=function(_0x463679,_0x57b313){var _0x5a1d79={'offset':moment()[_0x3841('0x78')]()};_0x5a1d79['now']=moment()[_0x3841('0x78')](_0x5a1d79[_0x3841('0x2e')])[_0x3841('0x79')]('YYYY-MM-DD\x20HH:mm:ss:SSS');return _0x57b313['status'](0xc8)[_0x3841('0x37')](_0x5a1d79);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index a76253b..8a9b725 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 _0x7217=['../../config/environment','./setting.attributes','exports','define','Setting','settings','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x2eec1f,_0x1b9987){var _0x543075=function(_0x5792d2){while(--_0x5792d2){_0x2eec1f['push'](_0x2eec1f['shift']());}};_0x543075(++_0x1b9987);}(_0x7217,0x19e));var _0x7721=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0x7217[_0x1da04e];return _0xdd8c41;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var logger=require(_0x7721('0x1'))(_0x7721('0x2'));var moment=require(_0x7721('0x3'));var BPromise=require(_0x7721('0x4'));var rp=require(_0x7721('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7721('0x6'));var attributes=require(_0x7721('0x7'));module[_0x7721('0x8')]=function(_0x3fe47c,_0xb239e0){return _0x3fe47c[_0x7721('0x9')](_0x7721('0xa'),attributes,{'tableName':_0x7721('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x008c=['define','settings','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./setting.attributes','exports'];(function(_0xcc3caf,_0x11800f){var _0x5d1173=function(_0x398db1){while(--_0x398db1){_0xcc3caf['push'](_0xcc3caf['shift']());}};_0x5d1173(++_0x11800f);}(_0x008c,0x188));var _0xc008=function(_0x49e66,_0x43f4b9){_0x49e66=_0x49e66-0x0;var _0x545549=_0x008c[_0x49e66];return _0x545549;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var logger=require(_0xc008('0x2'))(_0xc008('0x3'));var moment=require(_0xc008('0x4'));var BPromise=require('bluebird');var rp=require(_0xc008('0x5'));var fs=require('fs');var path=require(_0xc008('0x6'));var rimraf=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var attributes=require(_0xc008('0x9'));module[_0xc008('0xa')]=function(_0x13aa7,_0x39bb5e){return _0x13aa7[_0xc008('0xb')]('Setting',attributes,{'tableName':_0xc008('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index c499444..291ac2c 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 _0x5fc1=['then','lodash','util','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','request','info','request\x20sent','debug','error','code','Setting,\x20%s,\x20%s','message','result','catch','ShowSetting','Setting','find','options','raw','where','attributes','include','map','model'];(function(_0x1ebce2,_0x10e903){var _0x4a330c=function(_0x4fd810){while(--_0x4fd810){_0x1ebce2['push'](_0x1ebce2['shift']());}};_0x4a330c(++_0x10e903);}(_0x5fc1,0x1c3));var _0x15fc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5fc1[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x15fc('0x0'));var util=require(_0x15fc('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x15fc('0x2'));var fs=require('fs');var Redis=require(_0x15fc('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x15fc('0x4'))(_0x15fc('0x5'));var config=require('../../config/environment');var jayson=require(_0x15fc('0x6'));var client=jayson[_0x15fc('0x7')][_0x15fc('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x535400,_0xd9660a,_0x55b775){return new BPromise(function(_0x93615a,_0x40ed48){return client[_0x15fc('0x9')](_0x535400,_0x55b775)['then'](function(_0x4d63a1){logger[_0x15fc('0xa')]('Setting,\x20%s,\x20%s',_0xd9660a,_0x15fc('0xb'));logger[_0x15fc('0xc')]('Setting,\x20%s,\x20%s,\x20%s',_0xd9660a,_0x15fc('0xb'),JSON['stringify'](_0x4d63a1));if(_0x4d63a1[_0x15fc('0xd')]){if(_0x4d63a1[_0x15fc('0xd')][_0x15fc('0xe')]===0x1f4){logger['error'](_0x15fc('0xf'),_0xd9660a,_0x4d63a1[_0x15fc('0xd')][_0x15fc('0x10')]);return _0x40ed48(_0x4d63a1[_0x15fc('0xd')][_0x15fc('0x10')]);}logger[_0x15fc('0xd')](_0x15fc('0xf'),_0xd9660a,_0x4d63a1[_0x15fc('0xd')]['message']);return _0x93615a(_0x4d63a1[_0x15fc('0xd')]['message']);}else{logger[_0x15fc('0xa')]('Setting,\x20%s,\x20%s',_0xd9660a,_0x15fc('0xb'));_0x93615a(_0x4d63a1[_0x15fc('0x11')][_0x15fc('0x10')]);}})[_0x15fc('0x12')](function(_0x28b460){logger[_0x15fc('0xd')](_0x15fc('0xf'),_0xd9660a,_0x28b460);_0x40ed48(_0x28b460);});});}exports[_0x15fc('0x13')]=function(_0x28ca29){var _0xcdc238=this;return new Promise(function(_0x53dd02,_0x22695f){return db[_0x15fc('0x14')][_0x15fc('0x15')]({'raw':_0x28ca29[_0x15fc('0x16')]?_0x28ca29[_0x15fc('0x16')][_0x15fc('0x17')]===undefined?!![]:![]:!![],'where':_0x28ca29['options']?_0x28ca29[_0x15fc('0x16')][_0x15fc('0x18')]||null:null,'attributes':_0x28ca29['options']?_0x28ca29[_0x15fc('0x16')][_0x15fc('0x19')]||null:null,'include':_0x28ca29[_0x15fc('0x16')]?_0x28ca29[_0x15fc('0x16')][_0x15fc('0x1a')]?_[_0x15fc('0x1b')](_0x28ca29[_0x15fc('0x16')][_0x15fc('0x1a')],function(_0x473b4f){return{'model':db[_0x473b4f['model']],'as':_0x473b4f['as'],'attributes':_0x473b4f[_0x15fc('0x19')],'include':_0x473b4f['include']?_[_0x15fc('0x1b')](_0x473b4f[_0x15fc('0x1a')],function(_0x13553f){return{'model':db[_0x13553f['model']],'as':_0x13553f['as'],'attributes':_0x13553f[_0x15fc('0x19')],'include':_0x13553f[_0x15fc('0x1a')]?_[_0x15fc('0x1b')](_0x13553f[_0x15fc('0x1a')],function(_0x5c34b7){return{'model':db[_0x5c34b7[_0x15fc('0x1c')]],'as':_0x5c34b7['as'],'attributes':_0x5c34b7[_0x15fc('0x19')]};}):[]};}):[]};}):[]:[]})[_0x15fc('0x1d')](function(_0x46d5ea){logger[_0x15fc('0xa')](_0x15fc('0x13'),_0x28ca29);logger[_0x15fc('0xc')](_0x15fc('0x13'),_0x28ca29,JSON['stringify'](_0x46d5ea));_0x53dd02(_0x46d5ea);})[_0x15fc('0x12')](function(_0x8e203e){logger[_0x15fc('0xd')](_0x15fc('0x13'),_0x8e203e[_0x15fc('0x10')],_0x28ca29);_0x22695f(_0xcdc238[_0x15fc('0xd')](0x1f4,_0x8e203e[_0x15fc('0x10')]));});});}; \ No newline at end of file +var _0x0fc8=['map','model','attributes','then','catch','lodash','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','client','http','request','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','ShowSetting','Setting','find','options','raw','where','include'];(function(_0x795db4,_0x30eb2c){var _0x1cc503=function(_0x2baeb9){while(--_0x2baeb9){_0x795db4['push'](_0x795db4['shift']());}};_0x1cc503(++_0x30eb2c);}(_0x0fc8,0x1c5));var _0x80fc=function(_0x4d8f02,_0x10b286){_0x4d8f02=_0x4d8f02-0x0;var _0x3883b5=_0x0fc8[_0x4d8f02];return _0x3883b5;};'use strict';var _=require(_0x80fc('0x0'));var util=require('util');var moment=require(_0x80fc('0x1'));var BPromise=require(_0x80fc('0x2'));var rs=require(_0x80fc('0x3'));var fs=require('fs');var Redis=require(_0x80fc('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x80fc('0x5'));var config=require(_0x80fc('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x80fc('0x7')][_0x80fc('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x579e8d,_0x32795c,_0x81b99d){return new BPromise(function(_0x569ce2,_0x452b95){return client[_0x80fc('0x9')](_0x579e8d,_0x81b99d)['then'](function(_0x1536fa){logger[_0x80fc('0xa')](_0x80fc('0xb'),_0x32795c,_0x80fc('0xc'));logger[_0x80fc('0xd')](_0x80fc('0xe'),_0x32795c,_0x80fc('0xc'),JSON[_0x80fc('0xf')](_0x1536fa));if(_0x1536fa[_0x80fc('0x10')]){if(_0x1536fa[_0x80fc('0x10')][_0x80fc('0x11')]===0x1f4){logger[_0x80fc('0x10')](_0x80fc('0xb'),_0x32795c,_0x1536fa[_0x80fc('0x10')]['message']);return _0x452b95(_0x1536fa[_0x80fc('0x10')]['message']);}logger[_0x80fc('0x10')](_0x80fc('0xb'),_0x32795c,_0x1536fa['error'][_0x80fc('0x12')]);return _0x569ce2(_0x1536fa[_0x80fc('0x10')]['message']);}else{logger[_0x80fc('0xa')](_0x80fc('0xb'),_0x32795c,'request\x20sent');_0x569ce2(_0x1536fa[_0x80fc('0x13')]['message']);}})['catch'](function(_0x2c0729){logger['error']('Setting,\x20%s,\x20%s',_0x32795c,_0x2c0729);_0x452b95(_0x2c0729);});});}exports[_0x80fc('0x14')]=function(_0x11ec75){var _0x434d10=this;return new Promise(function(_0x203abe,_0x10ca10){return db[_0x80fc('0x15')][_0x80fc('0x16')]({'raw':_0x11ec75[_0x80fc('0x17')]?_0x11ec75[_0x80fc('0x17')][_0x80fc('0x18')]===undefined?!![]:![]:!![],'where':_0x11ec75[_0x80fc('0x17')]?_0x11ec75[_0x80fc('0x17')][_0x80fc('0x19')]||null:null,'attributes':_0x11ec75['options']?_0x11ec75['options']['attributes']||null:null,'include':_0x11ec75[_0x80fc('0x17')]?_0x11ec75[_0x80fc('0x17')][_0x80fc('0x1a')]?_[_0x80fc('0x1b')](_0x11ec75[_0x80fc('0x17')][_0x80fc('0x1a')],function(_0x5f0053){return{'model':db[_0x5f0053[_0x80fc('0x1c')]],'as':_0x5f0053['as'],'attributes':_0x5f0053[_0x80fc('0x1d')],'include':_0x5f0053['include']?_[_0x80fc('0x1b')](_0x5f0053[_0x80fc('0x1a')],function(_0x55bbdf){return{'model':db[_0x55bbdf[_0x80fc('0x1c')]],'as':_0x55bbdf['as'],'attributes':_0x55bbdf[_0x80fc('0x1d')],'include':_0x55bbdf[_0x80fc('0x1a')]?_[_0x80fc('0x1b')](_0x55bbdf[_0x80fc('0x1a')],function(_0x48cb48){return{'model':db[_0x48cb48[_0x80fc('0x1c')]],'as':_0x48cb48['as'],'attributes':_0x48cb48[_0x80fc('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x80fc('0x1e')](function(_0x34118e){logger[_0x80fc('0xa')](_0x80fc('0x14'),_0x11ec75);logger[_0x80fc('0xd')](_0x80fc('0x14'),_0x11ec75,JSON[_0x80fc('0xf')](_0x34118e));_0x203abe(_0x34118e);})[_0x80fc('0x1f')](function(_0x707656){logger[_0x80fc('0x10')]('ShowSetting',_0x707656[_0x80fc('0x12')],_0x11ec75);_0x10ca10(_0x434d10['error'](0x1f4,_0x707656['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 7f2ce98..1b22203 100644 --- a/server/api/smsAccount/index.js +++ b/server/api/smsAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['getInteractions','/:id/status','statusGet','/:id/users','post','create','addAnswer','/:id/notify','notify','addApplications','send','status','addAgents','put','/:id','update','delete','destroy','/:id/canned_answers','removeAnswers','removeAgents','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','index','/describe','isAuthenticated','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications'];(function(_0x1fbd6b,_0x209219){var _0x6e8190=function(_0x2d55de){while(--_0x2d55de){_0x1fbd6b['push'](_0x1fbd6b['shift']());}};_0x6e8190(++_0x209219);}(_0x7a54,0x106));var _0x47a5=function(_0x3cc46f,_0x30523c){_0x3cc46f=_0x3cc46f-0x0;var _0x1c907a=_0x7a54[_0x3cc46f];return _0x1c907a;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['describe']);router[_0x47a5('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x47a5('0x9')](_0x47a5('0xd'),auth['isAuthenticated'](),controller[_0x47a5('0xe')]);router['get']('/:id/canned_answers',auth[_0x47a5('0xc')](),controller[_0x47a5('0xf')]);router[_0x47a5('0x9')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x11')]);router[_0x47a5('0x9')]('/:id/interactions',auth[_0x47a5('0xc')](),controller[_0x47a5('0x12')]);router[_0x47a5('0x9')](_0x47a5('0x13'),controller[_0x47a5('0x14')]);router[_0x47a5('0x9')](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller['getAgents']);router[_0x47a5('0x16')]('/',auth[_0x47a5('0xc')](),controller[_0x47a5('0x17')]);router[_0x47a5('0x16')](_0x47a5('0xd'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x47a5('0x16')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x47a5('0x18')]);router[_0x47a5('0x16')](_0x47a5('0x19'),controller[_0x47a5('0x1a')]);router[_0x47a5('0x16')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x1b')]);router[_0x47a5('0x16')]('/:id/send',auth[_0x47a5('0xc')](),controller[_0x47a5('0x1c')]);router['post'](_0x47a5('0x13'),controller[_0x47a5('0x1d')]);router[_0x47a5('0x16')]('/:id/users',auth[_0x47a5('0xc')](),controller[_0x47a5('0x1e')]);router[_0x47a5('0x1f')](_0x47a5('0x20'),auth['isAuthenticated'](),controller[_0x47a5('0x21')]);router[_0x47a5('0x22')]('/:id',auth[_0x47a5('0xc')](),controller[_0x47a5('0x23')]);router[_0x47a5('0x22')](_0x47a5('0xd'),auth[_0x47a5('0xc')](),controller['removeDispositions']);router['delete'](_0x47a5('0x24'),auth['isAuthenticated'](),controller[_0x47a5('0x25')]);router['delete'](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x26')]);module[_0x47a5('0x27')]=router; \ No newline at end of file +var _0x7a54=['getInteractions','/:id/status','statusGet','/:id/users','post','create','addAnswer','/:id/notify','notify','addApplications','send','status','addAgents','put','/:id','update','delete','destroy','/:id/canned_answers','removeAnswers','removeAgents','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','index','/describe','isAuthenticated','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications'];(function(_0x2f2a83,_0x4b14a6){var _0x54fc5c=function(_0xbe81bf){while(--_0xbe81bf){_0x2f2a83['push'](_0x2f2a83['shift']());}};_0x54fc5c(++_0x4b14a6);}(_0x7a54,0x106));var _0x47a5=function(_0x22652b,_0x4b70ef){_0x22652b=_0x22652b-0x0;var _0x43912f=_0x7a54[_0x22652b];return _0x43912f;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['describe']);router[_0x47a5('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x47a5('0x9')](_0x47a5('0xd'),auth['isAuthenticated'](),controller[_0x47a5('0xe')]);router['get']('/:id/canned_answers',auth[_0x47a5('0xc')](),controller[_0x47a5('0xf')]);router[_0x47a5('0x9')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x11')]);router[_0x47a5('0x9')]('/:id/interactions',auth[_0x47a5('0xc')](),controller[_0x47a5('0x12')]);router[_0x47a5('0x9')](_0x47a5('0x13'),controller[_0x47a5('0x14')]);router[_0x47a5('0x9')](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller['getAgents']);router[_0x47a5('0x16')]('/',auth[_0x47a5('0xc')](),controller[_0x47a5('0x17')]);router[_0x47a5('0x16')](_0x47a5('0xd'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x47a5('0x16')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x47a5('0x18')]);router[_0x47a5('0x16')](_0x47a5('0x19'),controller[_0x47a5('0x1a')]);router[_0x47a5('0x16')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x1b')]);router[_0x47a5('0x16')]('/:id/send',auth[_0x47a5('0xc')](),controller[_0x47a5('0x1c')]);router['post'](_0x47a5('0x13'),controller[_0x47a5('0x1d')]);router[_0x47a5('0x16')]('/:id/users',auth[_0x47a5('0xc')](),controller[_0x47a5('0x1e')]);router[_0x47a5('0x1f')](_0x47a5('0x20'),auth['isAuthenticated'](),controller[_0x47a5('0x21')]);router[_0x47a5('0x22')]('/:id',auth[_0x47a5('0xc')](),controller[_0x47a5('0x23')]);router[_0x47a5('0x22')](_0x47a5('0xd'),auth[_0x47a5('0xc')](),controller['removeDispositions']);router['delete'](_0x47a5('0x24'),auth['isAuthenticated'](),controller[_0x47a5('0x25')]);router['delete'](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x26')]);module[_0x47a5('0x27')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 68539c0..4bc392d 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 _0x1d95=['randomstring','exports','name','STRING','generate','skebby','connectel','clicksend','csc','intelepeer','ENUM','TEXT','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1d95,0x117));var _0x51d9=function(_0x86e660,_0x4db72e){_0x86e660=_0x86e660-0x0;var _0x3c7a0a=_0x1d95[_0x86e660];return _0x3c7a0a;};'use strict';var Sequelize=require(_0x51d9('0x0'));var rs=require(_0x51d9('0x1'));module[_0x51d9('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0x51d9('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x51d9('0x4')],'allowNull':![]},'remote':{'type':Sequelize[_0x51d9('0x4')],'allowNull':![]},'token':{'type':Sequelize[_0x51d9('0x4')],'defaultValue':function(){return rs[_0x51d9('0x5')]();}},'phone':{'type':Sequelize[_0x51d9('0x4')]},'type':{'type':Sequelize['ENUM']('twilio',_0x51d9('0x6'),_0x51d9('0x7'),_0x51d9('0x8'),'plivo','clickatell','bandwidth',_0x51d9('0x9'),'infobip',_0x51d9('0xa'))},'accountSid':{'type':Sequelize[_0x51d9('0x4')]},'authId':{'type':Sequelize[_0x51d9('0x4')]},'authToken':{'type':Sequelize[_0x51d9('0x4')]},'smsMethod':{'type':Sequelize[_0x51d9('0xb')]('SI','TI','GP')},'username':{'type':Sequelize[_0x51d9('0x4')]},'password':{'type':Sequelize[_0x51d9('0x4')]},'apiKey':{'type':Sequelize[_0x51d9('0x4')]},'applicationId':{'type':Sequelize['STRING']},'accountId':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize['STRING']},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x51d9('0x4')]},'notificationTemplate':{'type':Sequelize[_0x51d9('0xc')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x51d9('0xd')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x51d9('0xd')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x51d9('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x51d9('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x51d9('0xd')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x51d9('0xd')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x51d9('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x51d9('0x4')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x51d9('0xe')],'comment':_0x51d9('0xf')},'mandatoryDisposition':{'type':Sequelize[_0x51d9('0xd')],'defaultValue':![],'comment':_0x51d9('0x10'),'set':function(_0x18cde4){if(!_0x18cde4)this[_0x51d9('0x11')](_0x51d9('0x12'),null);this[_0x51d9('0x11')](_0x51d9('0x13'),_0x18cde4);}}}; \ No newline at end of file +var _0x56f9=['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','twilio','skebby','connectel','clicksend','plivo','clickatell','bandwidth','infobip','intelepeer'];(function(_0x59ca6b,_0x13ba69){var _0x355907=function(_0x4b20df){while(--_0x4b20df){_0x59ca6b['push'](_0x59ca6b['shift']());}};_0x355907(++_0x13ba69);}(_0x56f9,0x64));var _0x956f=function(_0x4772bd,_0x2faf18){_0x4772bd=_0x4772bd-0x0;var _0xeeb033=_0x56f9[_0x4772bd];return _0xeeb033;};'use strict';var Sequelize=require(_0x956f('0x0'));var rs=require(_0x956f('0x1'));module[_0x956f('0x2')]={'name':{'type':Sequelize[_0x956f('0x3')],'unique':_0x956f('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x956f('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x956f('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x956f('0x3')],'defaultValue':function(){return rs[_0x956f('0x5')]();}},'phone':{'type':Sequelize[_0x956f('0x3')]},'type':{'type':Sequelize['ENUM'](_0x956f('0x6'),_0x956f('0x7'),_0x956f('0x8'),_0x956f('0x9'),_0x956f('0xa'),_0x956f('0xb'),_0x956f('0xc'),'csc',_0x956f('0xd'),_0x956f('0xe'))},'accountSid':{'type':Sequelize[_0x956f('0x3')]},'authId':{'type':Sequelize[_0x956f('0x3')]},'authToken':{'type':Sequelize[_0x956f('0x3')]},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize[_0x956f('0x3')]},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0x956f('0x3')]},'applicationId':{'type':Sequelize[_0x956f('0x3')]},'accountId':{'type':Sequelize[_0x956f('0x3')]},'senderString':{'type':Sequelize[_0x956f('0x3')]},'deliveryReport':{'type':Sequelize[_0x956f('0xf')],'defaultValue':![]},'description':{'type':Sequelize[_0x956f('0x3')]},'notificationTemplate':{'type':Sequelize[_0x956f('0x10')],'defaultValue':function(){return _0x956f('0x11');}},'notificationSound':{'type':Sequelize[_0x956f('0xf')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x956f('0xf')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x956f('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x956f('0xf')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x956f('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x956f('0xf')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x956f('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x956f('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x956f('0x13')},'mandatoryDisposition':{'type':Sequelize[_0x956f('0xf')],'defaultValue':![],'comment':_0x956f('0x14'),'set':function(_0x8dd7c){if(!_0x8dd7c)this[_0x956f('0x15')]('mandatoryDispositionPauseId',null);this[_0x956f('0x15')](_0x956f('0x16'),_0x8dd7c);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index f42b34a..35d8550 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 _0x4ed1=['intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','VIRTUAL','merge','includeAll','SmsAccount','findAll','params','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','describe','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','nolimit','rows','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','notify','sms','SmsApplication','Applications','applications','orderBy','priority','asc','account','CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','mobile','from','Body','MessageSid','skebby','sender','connectel','clicksend','messageId','message_id','plivo','Text','MessageUUID','infobip','results','text','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','bandwidth','intelepeer','refid','Sequelize','from\x20is\x20mandatory','isNil','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','DESC','list','Contacts','SmsInteraction','spread','interaction','get','created','close','unmanaged','*,*,*,*','ContactId','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','queueId','SmsQueue','queue','waitForTheAssignedQueue','Start','startRouting','receiveMessage','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','twilio','text/xml','send','\x0a','addApplications','sequelize','Transaction','bulkCreate','findAndCountAll','finally','getApplications','getInteractions','Contact','fullname','internal','Tag','Tags','color','tag','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','List','ListId','out','SmsMessage','dataValues','Messages','push','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','statusInt','status_code','groupName','DELIVERED','redif','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','ACCEPTD','message-id','state','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','request-promise','moment','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','defaults','socket.io-emitter','redis','./smsAccount.socket','register','jayson/promise','client','http','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','UserProfileResource','end','stack','name','Pause','mandatoryDispositionPause','map','rawAttributes','type','key','model','keys','query'];(function(_0x54666f,_0x56cc45){var _0x4c2ede=function(_0x4a5401){while(--_0x4a5401){_0x54666f['push'](_0x54666f['shift']());}};_0x4c2ede(++_0x56cc45);}(_0x4ed1,0x18d));var _0x14ed=function(_0x3c5afd,_0x2dc439){_0x3c5afd=_0x3c5afd-0x0;var _0x574f20=_0x4ed1[_0x3c5afd];return _0x574f20;};'use strict';var emlformat=require(_0x14ed('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x14ed('0x1'));var moment=require(_0x14ed('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x14ed('0x3'));var path=require(_0x14ed('0x4'));var sox=require('sox');var csv=require(_0x14ed('0x5'));var ejs=require(_0x14ed('0x6'));var fs=require('fs');var fs_extra=require(_0x14ed('0x7'));var _=require(_0x14ed('0x8'));var squel=require(_0x14ed('0x9'));var crypto=require(_0x14ed('0xa'));var jsforce=require(_0x14ed('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x14ed('0x5'));var querystring=require('querystring');var Papa=require(_0x14ed('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x14ed('0xd'));var hardwareService=require(_0x14ed('0xe'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x14ed('0xf'));var licenseUtil=require(_0x14ed('0x10'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x14ed('0x11')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x14ed('0x12'))(new Redis(config[_0x14ed('0x13')]));require(_0x14ed('0x14'))[_0x14ed('0x15')](socket);var jayson=require(_0x14ed('0x16'));var client=jayson[_0x14ed('0x17')][_0x14ed('0x18')]({'port':0x232c});function respondWithRpcPromise(_0xd899cf,_0x3acc2e,_0x105b2e,_0x3b5804){return new BPromise(function(_0x48c2ee,_0x54b20a){var _0x1d2c33=_0x3b5804||client;return _0x1d2c33['request'](_0xd899cf,_0x105b2e)['then'](function(_0x292479){logger['info'](_0x14ed('0x19'),_0x3acc2e,_0x14ed('0x1a'));logger[_0x14ed('0x1b')](_0x14ed('0x1c'),_0x3acc2e,_0x14ed('0x1a'),JSON[_0x14ed('0x1d')](_0x292479));if(_0x292479[_0x14ed('0x1e')]){if(_0x292479[_0x14ed('0x1e')][_0x14ed('0x1f')]===0x1f4){logger[_0x14ed('0x1e')](_0x14ed('0x19'),_0x3acc2e,_0x292479[_0x14ed('0x1e')][_0x14ed('0x20')]);return _0x54b20a(_0x292479['error'][_0x14ed('0x20')]);}logger[_0x14ed('0x1e')](_0x14ed('0x19'),_0x3acc2e,_0x292479[_0x14ed('0x1e')][_0x14ed('0x20')]);return _0x48c2ee(_0x292479[_0x14ed('0x1e')][_0x14ed('0x20')]);}else{logger[_0x14ed('0x21')](_0x14ed('0x19'),_0x3acc2e,'request\x20sent');_0x48c2ee(_0x292479[_0x14ed('0x22')]['message']);}})[_0x14ed('0x23')](function(_0x46061d){logger[_0x14ed('0x1e')](_0x14ed('0x19'),_0x3acc2e,_0x46061d);_0x54b20a(_0x46061d);});});}function respondWithStatusCode(_0x4c5fdb,_0x334293){_0x334293=_0x334293||0xcc;return function(_0x386b5d){if(_0x386b5d){return _0x4c5fdb[_0x14ed('0x24')](_0x334293);}return _0x4c5fdb[_0x14ed('0x25')](_0x334293)['end']();};}function respondWithResult(_0x1af906,_0x1942ac){_0x1942ac=_0x1942ac||0xc8;return function(_0x39bdd6){if(_0x39bdd6){return _0x1af906['status'](_0x1942ac)[_0x14ed('0x26')](_0x39bdd6);}};}function respondWithFilteredResult(_0x3c7ce5,_0x1f04d8){return function(_0x3dea08){if(_0x3dea08){var _0x59c451=typeof _0x1f04d8[_0x14ed('0x27')]===_0x14ed('0x28')&&typeof _0x1f04d8[_0x14ed('0x29')]==='undefined';var _0x9d8b2f=_0x3dea08['count'];var _0x236827=_0x59c451?0x0:_0x1f04d8[_0x14ed('0x27')];var _0x53a2d3=_0x59c451?_0x3dea08[_0x14ed('0x2a')]:_0x1f04d8[_0x14ed('0x27')]+_0x1f04d8[_0x14ed('0x29')];var _0x268006;if(_0x53a2d3>=_0x9d8b2f){_0x53a2d3=_0x9d8b2f;_0x268006=0xc8;}else{_0x268006=0xce;}_0x3c7ce5['status'](_0x268006);return _0x3c7ce5[_0x14ed('0x2b')](_0x14ed('0x2c'),_0x236827+'-'+_0x53a2d3+'/'+_0x9d8b2f)['json'](_0x3dea08);}return null;};}function patchUpdates(_0x10f20f){return function(_0x171db0){try{jsonpatch[_0x14ed('0x2d')](_0x171db0,_0x10f20f,!![]);}catch(_0x31948f){return BPromise[_0x14ed('0x2e')](_0x31948f);}return _0x171db0['save']();};}function saveUpdates(_0x44c0fb,_0x1f1982){return function(_0x41ccdd){if(_0x41ccdd){return _0x41ccdd[_0x14ed('0x2f')](_0x44c0fb)[_0x14ed('0x30')](function(_0x2ce8ac){return _0x2ce8ac;});}return null;};}function removeEntity(_0x4f5292,_0x365e38){return function(_0xdedcfe){if(_0xdedcfe){return _0xdedcfe[_0x14ed('0x31')]()['then'](function(){var _0x37cc96=_0xdedcfe['get']({'plain':!![]});var _0x502501='SmsAccounts';return db[_0x14ed('0x32')]['destroy']({'where':{'type':_0x502501,'resourceId':_0x37cc96['id']}})[_0x14ed('0x30')](function(){return _0xdedcfe;});})[_0x14ed('0x30')](function(){_0x4f5292[_0x14ed('0x25')](0xcc)[_0x14ed('0x33')]();});}};}function handleEntityNotFound(_0x580594,_0x565ae6){return function(_0x562ad8){if(!_0x562ad8){_0x580594[_0x14ed('0x24')](0x194);}return _0x562ad8;};}function handleError(_0x34ff4c,_0x19889d){_0x19889d=_0x19889d||0x1f4;return function(_0x18ab00){logger[_0x14ed('0x1e')](_0x18ab00[_0x14ed('0x34')]);if(_0x18ab00[_0x14ed('0x35')]){delete _0x18ab00[_0x14ed('0x35')];}_0x34ff4c[_0x14ed('0x25')](_0x19889d)['send'](_0x18ab00);};}exports['index']=function(_0x55e5da,_0x2021c4){var _0x5f9aec={'include':[{'model':db[_0x14ed('0x36')],'as':_0x14ed('0x37')}]},_0xfeb1cf={},_0xdcfc4f={'count':0x0,'rows':[]};var _0x28b262=_[_0x14ed('0x38')](db['SmsAccount'][_0x14ed('0x39')],function(_0x33e828){return{'name':_0x33e828['fieldName'],'type':_0x33e828[_0x14ed('0x3a')][_0x14ed('0x3b')]};});_0xfeb1cf[_0x14ed('0x3c')]=_['map'](_0x28b262,_0x14ed('0x35'));_0xfeb1cf['query']=_[_0x14ed('0x3d')](_0x55e5da[_0x14ed('0x3e')]);_0xfeb1cf['filters']=_[_0x14ed('0x3f')](_0xfeb1cf[_0x14ed('0x3c')],_0xfeb1cf['query']);_0x5f9aec[_0x14ed('0x40')]=_[_0x14ed('0x3f')](_0xfeb1cf[_0x14ed('0x3c')],qs[_0x14ed('0x41')](_0x55e5da['query'][_0x14ed('0x41')]));_0x5f9aec[_0x14ed('0x40')]=_0x5f9aec[_0x14ed('0x40')][_0x14ed('0x42')]?_0x5f9aec[_0x14ed('0x40')]:_0xfeb1cf[_0x14ed('0x3c')];if(!_0x55e5da[_0x14ed('0x3e')][_0x14ed('0x43')]('nolimit')){_0x5f9aec[_0x14ed('0x29')]=qs[_0x14ed('0x29')](_0x55e5da['query'][_0x14ed('0x29')]);_0x5f9aec[_0x14ed('0x27')]=qs['offset'](_0x55e5da[_0x14ed('0x3e')][_0x14ed('0x27')]);}_0x5f9aec[_0x14ed('0x44')]=qs[_0x14ed('0x45')](_0x55e5da[_0x14ed('0x3e')]['sort']);_0x5f9aec[_0x14ed('0x46')]=qs[_0x14ed('0x47')](_[_0x14ed('0x48')](_0x55e5da[_0x14ed('0x3e')],_0xfeb1cf[_0x14ed('0x47')]),_0x28b262);if(_0x55e5da['query'][_0x14ed('0x49')]){_0x5f9aec['where']=_['merge'](_0x5f9aec['where'],{'$or':_['map'](_0x28b262,function(_0x46bc19){if(_0x46bc19['type']!==_0x14ed('0x4a')){var _0x10411b={};_0x10411b[_0x46bc19[_0x14ed('0x35')]]={'$like':'%'+_0x55e5da[_0x14ed('0x3e')]['filter']+'%'};return _0x10411b;}})});}_0x5f9aec=_[_0x14ed('0x4b')]({},_0x5f9aec,_0x55e5da['options']);var _0x333ac7={'where':_0x5f9aec[_0x14ed('0x46')]};return db['SmsAccount'][_0x14ed('0x2a')](_0x333ac7)[_0x14ed('0x30')](function(_0x7a05e8){_0xdcfc4f[_0x14ed('0x2a')]=_0x7a05e8;if(_0x55e5da['query'][_0x14ed('0x4c')]){_0x5f9aec['include']=[{'all':!![]}];}return db[_0x14ed('0x4d')][_0x14ed('0x4e')](_0x5f9aec);})['then'](function(_0x3d6ccf){_0xdcfc4f['rows']=_0x3d6ccf;return _0xdcfc4f;})[_0x14ed('0x30')](respondWithFilteredResult(_0x2021c4,_0x5f9aec))[_0x14ed('0x23')](handleError(_0x2021c4,null));};exports['show']=function(_0x362269,_0x39bb0a){var _0x53c666={'raw':![],'where':{'id':_0x362269[_0x14ed('0x4f')]['id']},'include':[{'model':db[_0x14ed('0x36')],'as':_0x14ed('0x37')}]},_0x8f5b46={};_0x8f5b46[_0x14ed('0x3c')]=_[_0x14ed('0x3d')](db[_0x14ed('0x4d')][_0x14ed('0x39')]);_0x8f5b46[_0x14ed('0x3e')]=_[_0x14ed('0x3d')](_0x362269[_0x14ed('0x3e')]);_0x8f5b46[_0x14ed('0x47')]=_[_0x14ed('0x3f')](_0x8f5b46[_0x14ed('0x3c')],_0x8f5b46[_0x14ed('0x3e')]);_0x53c666[_0x14ed('0x40')]=_[_0x14ed('0x3f')](_0x8f5b46[_0x14ed('0x3c')],qs['fields'](_0x362269['query'][_0x14ed('0x41')]));_0x53c666[_0x14ed('0x40')]=_0x53c666[_0x14ed('0x40')][_0x14ed('0x42')]?_0x53c666[_0x14ed('0x40')]:_0x8f5b46[_0x14ed('0x3c')];if(_0x362269[_0x14ed('0x3e')]['includeAll']){_0x53c666[_0x14ed('0x50')]=[{'all':!![]}];}_0x53c666=_[_0x14ed('0x4b')]({},_0x53c666,_0x362269[_0x14ed('0x51')]);return db[_0x14ed('0x4d')][_0x14ed('0x52')](_0x53c666)[_0x14ed('0x30')](handleEntityNotFound(_0x39bb0a,null))[_0x14ed('0x30')](respondWithResult(_0x39bb0a,null))['catch'](handleError(_0x39bb0a,null));};exports[_0x14ed('0x53')]=function(_0x235bd6,_0x5a82dc){return db['SmsAccount'][_0x14ed('0x53')](_0x235bd6[_0x14ed('0x54')],{})[_0x14ed('0x30')](function(_0x2e1edc){var _0x569942=_0x235bd6[_0x14ed('0x55')]['get']({'plain':!![]});if(!_0x569942)throw new Error(_0x14ed('0x56'));if(_0x569942[_0x14ed('0x57')]===_0x14ed('0x55')){var _0x5dff9a=_0x2e1edc['get']({'plain':!![]});var _0x22e5b6='SmsAccounts';return db['UserProfileSection']['find']({'where':{'name':_0x22e5b6,'userProfileId':_0x569942[_0x14ed('0x58')]},'raw':!![]})[_0x14ed('0x30')](function(_0x549fe2){if(_0x549fe2&&_0x549fe2[_0x14ed('0x59')]===0x0){return db[_0x14ed('0x32')]['create']({'name':_0x5dff9a[_0x14ed('0x35')],'resourceId':_0x5dff9a['id'],'type':_0x549fe2[_0x14ed('0x35')],'sectionId':_0x549fe2['id']},{})['then'](function(){return _0x2e1edc;});}else{return _0x2e1edc;}})[_0x14ed('0x23')](function(_0x691a06){logger[_0x14ed('0x1e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x691a06);throw _0x691a06;});}return _0x2e1edc;})[_0x14ed('0x30')](respondWithResult(_0x5a82dc,0xc9))[_0x14ed('0x23')](handleError(_0x5a82dc,null));};exports[_0x14ed('0x2f')]=function(_0x43ef03,_0x1daecd){if(_0x43ef03['body']['id']){delete _0x43ef03[_0x14ed('0x54')]['id'];}return db[_0x14ed('0x4d')]['find']({'where':{'id':_0x43ef03[_0x14ed('0x4f')]['id']},'include':[{'model':db[_0x14ed('0x36')],'as':_0x14ed('0x37')}]})[_0x14ed('0x30')](handleEntityNotFound(_0x1daecd,null))[_0x14ed('0x30')](saveUpdates(_0x43ef03[_0x14ed('0x54')],null))['then'](respondWithResult(_0x1daecd,null))['catch'](handleError(_0x1daecd,null));};exports[_0x14ed('0x31')]=function(_0xf2cf34,_0x49b0a1){return db[_0x14ed('0x4d')][_0x14ed('0x52')]({'where':{'id':_0xf2cf34['params']['id']}})[_0x14ed('0x30')](handleEntityNotFound(_0x49b0a1,null))[_0x14ed('0x30')](removeEntity(_0x49b0a1,null))[_0x14ed('0x23')](handleError(_0x49b0a1,null));};exports[_0x14ed('0x5a')]=function(_0x2935d4,_0xbb851){return db[_0x14ed('0x4d')][_0x14ed('0x5a')]()[_0x14ed('0x30')](respondWithResult(_0xbb851,null))[_0x14ed('0x23')](handleError(_0xbb851,null));};exports[_0x14ed('0x5b')]=function(_0x99ddff,_0x48c84f,_0x44be89){if(_0x99ddff[_0x14ed('0x54')]['id']){delete _0x99ddff[_0x14ed('0x54')]['id'];}return db['SmsAccount']['find']({'where':{'id':_0x99ddff[_0x14ed('0x4f')]['id']}})['then'](handleEntityNotFound(_0x48c84f,null))[_0x14ed('0x30')](function(_0x1c192e){if(_0x1c192e){_0x99ddff[_0x14ed('0x54')][_0x14ed('0x5c')]=_0x1c192e['id'];return db[_0x14ed('0x5d')]['create'](_0x99ddff[_0x14ed('0x54')]);}})['then'](respondWithResult(_0x48c84f,null))[_0x14ed('0x23')](handleError(_0x48c84f,null));};exports[_0x14ed('0x5e')]=function(_0x38497a,_0x56ef8e,_0x4184d4){var _0x1c8743={'raw':![],'where':{}};var _0x2974c8={};var _0x37cab1={'count':0x0,'rows':[]};return db[_0x14ed('0x4d')][_0x14ed('0x5f')]({'where':{'id':_0x38497a[_0x14ed('0x4f')]['id']}})['then'](handleEntityNotFound(_0x56ef8e,null))['then'](function(_0xd65e68){if(_0xd65e68){_0x2974c8[_0x14ed('0x3c')]=_[_0x14ed('0x3d')](db[_0x14ed('0x5d')][_0x14ed('0x39')]);_0x2974c8['query']=_[_0x14ed('0x3d')](_0x38497a[_0x14ed('0x3e')]);_0x2974c8[_0x14ed('0x47')]=_[_0x14ed('0x3f')](_0x2974c8['model'],_0x2974c8['query']);_0x1c8743[_0x14ed('0x40')]=_[_0x14ed('0x3f')](_0x2974c8['model'],qs[_0x14ed('0x41')](_0x38497a['query'][_0x14ed('0x41')]));_0x1c8743['attributes']=_0x1c8743[_0x14ed('0x40')][_0x14ed('0x42')]?_0x1c8743['attributes']:_0x2974c8['model'];if(!_0x38497a[_0x14ed('0x3e')][_0x14ed('0x43')](_0x14ed('0x60'))){_0x1c8743[_0x14ed('0x29')]=qs[_0x14ed('0x29')](_0x38497a[_0x14ed('0x3e')]['limit']);_0x1c8743[_0x14ed('0x27')]=qs['offset'](_0x38497a[_0x14ed('0x3e')]['offset']);}_0x1c8743['order']=qs['sort'](_0x38497a[_0x14ed('0x3e')]['sort']);_0x1c8743[_0x14ed('0x46')]=qs[_0x14ed('0x47')](_[_0x14ed('0x48')](_0x38497a[_0x14ed('0x3e')],_0x2974c8[_0x14ed('0x47')]));_0x1c8743['where'][_0x14ed('0x5c')]=_0xd65e68['id'];if(_0x38497a['query'][_0x14ed('0x49')]){_0x1c8743[_0x14ed('0x46')]=_[_0x14ed('0x4b')](_0x1c8743[_0x14ed('0x46')],{'$or':_[_0x14ed('0x38')](_0x1c8743['attributes'],function(_0x449b43){var _0x4dd1a8={};_0x4dd1a8[_0x449b43]={'$like':'%'+_0x38497a[_0x14ed('0x3e')][_0x14ed('0x49')]+'%'};return _0x4dd1a8;})});}_0x1c8743=_[_0x14ed('0x4b')]({},_0x1c8743,_0x38497a[_0x14ed('0x51')]);return db[_0x14ed('0x5d')]['count']({'where':_0x1c8743['where']})[_0x14ed('0x30')](function(_0x571d28){_0x37cab1[_0x14ed('0x2a')]=_0x571d28;if(_0x38497a['query'][_0x14ed('0x4c')]){_0x1c8743[_0x14ed('0x50')]=[{'all':!![]}];}return db[_0x14ed('0x5d')]['findAll'](_0x1c8743);})[_0x14ed('0x30')](function(_0x46438c){_0x37cab1[_0x14ed('0x61')]=_0x46438c;return _0x37cab1;});}})[_0x14ed('0x30')](respondWithFilteredResult(_0x56ef8e,_0x1c8743))['catch'](handleError(_0x56ef8e,null));};exports['removeDispositions']=function(_0x59813e,_0x5c6d0a,_0x40f5bc){return db[_0x14ed('0x4d')][_0x14ed('0x52')]({'where':{'id':_0x59813e[_0x14ed('0x4f')]['id']}})[_0x14ed('0x30')](handleEntityNotFound(_0x5c6d0a,null))['then'](function(_0x10ceeb){if(_0x10ceeb){return _0x10ceeb[_0x14ed('0x62')](_0x59813e[_0x14ed('0x3e')]['ids']);}})[_0x14ed('0x30')](respondWithStatusCode(_0x5c6d0a,null))[_0x14ed('0x23')](handleError(_0x5c6d0a,null));};exports[_0x14ed('0x63')]=function(_0x1962a9,_0x18a442,_0x5ce6ca){if(_0x1962a9[_0x14ed('0x54')]['id']){delete _0x1962a9['body']['id'];}return db[_0x14ed('0x4d')]['find']({'where':{'id':_0x1962a9[_0x14ed('0x4f')]['id']}})[_0x14ed('0x30')](handleEntityNotFound(_0x18a442,null))[_0x14ed('0x30')](function(_0x2a5c3f){if(_0x2a5c3f){_0x1962a9[_0x14ed('0x54')]['SmsAccountId']=_0x2a5c3f['id'];return db[_0x14ed('0x64')][_0x14ed('0x53')](_0x1962a9[_0x14ed('0x54')]);}})[_0x14ed('0x30')](respondWithResult(_0x18a442,null))[_0x14ed('0x23')](handleError(_0x18a442,null));};exports[_0x14ed('0x65')]=function(_0x43d04c,_0x458847,_0x4c70fc){var _0x14d830={'raw':![],'where':{}};var _0x449b55={};var _0x4b341e={'count':0x0,'rows':[]};return db[_0x14ed('0x4d')][_0x14ed('0x5f')]({'where':{'id':_0x43d04c[_0x14ed('0x4f')]['id']}})[_0x14ed('0x30')](handleEntityNotFound(_0x458847,null))[_0x14ed('0x30')](function(_0x1af99e){if(_0x1af99e){_0x449b55['model']=_[_0x14ed('0x3d')](db[_0x14ed('0x64')][_0x14ed('0x39')]);_0x449b55[_0x14ed('0x3e')]=_[_0x14ed('0x3d')](_0x43d04c[_0x14ed('0x3e')]);_0x449b55[_0x14ed('0x47')]=_[_0x14ed('0x3f')](_0x449b55[_0x14ed('0x3c')],_0x449b55[_0x14ed('0x3e')]);_0x14d830['attributes']=_[_0x14ed('0x3f')](_0x449b55[_0x14ed('0x3c')],qs[_0x14ed('0x41')](_0x43d04c[_0x14ed('0x3e')][_0x14ed('0x41')]));_0x14d830['attributes']=_0x14d830[_0x14ed('0x40')][_0x14ed('0x42')]?_0x14d830['attributes']:_0x449b55['model'];if(!_0x43d04c[_0x14ed('0x3e')][_0x14ed('0x43')](_0x14ed('0x60'))){_0x14d830[_0x14ed('0x29')]=qs[_0x14ed('0x29')](_0x43d04c[_0x14ed('0x3e')]['limit']);_0x14d830[_0x14ed('0x27')]=qs[_0x14ed('0x27')](_0x43d04c['query'][_0x14ed('0x27')]);}_0x14d830[_0x14ed('0x44')]=qs[_0x14ed('0x45')](_0x43d04c[_0x14ed('0x3e')]['sort']);_0x14d830[_0x14ed('0x46')]=qs[_0x14ed('0x47')](_[_0x14ed('0x48')](_0x43d04c[_0x14ed('0x3e')],_0x449b55[_0x14ed('0x47')]));_0x14d830[_0x14ed('0x46')]['SmsAccountId']=_0x1af99e['id'];if(_0x43d04c[_0x14ed('0x3e')][_0x14ed('0x49')]){_0x14d830['where']=_['merge'](_0x14d830[_0x14ed('0x46')],{'$or':_['map'](_0x14d830[_0x14ed('0x40')],function(_0x4d5c3f){var _0x8ac059={};_0x8ac059[_0x4d5c3f]={'$like':'%'+_0x43d04c[_0x14ed('0x3e')][_0x14ed('0x49')]+'%'};return _0x8ac059;})});}_0x14d830=_[_0x14ed('0x4b')]({},_0x14d830,_0x43d04c[_0x14ed('0x51')]);return db[_0x14ed('0x64')][_0x14ed('0x2a')]({'where':_0x14d830[_0x14ed('0x46')]})['then'](function(_0x1372b9){_0x4b341e[_0x14ed('0x2a')]=_0x1372b9;if(_0x43d04c[_0x14ed('0x3e')][_0x14ed('0x4c')]){_0x14d830[_0x14ed('0x50')]=[{'all':!![]}];}return db[_0x14ed('0x64')][_0x14ed('0x4e')](_0x14d830);})[_0x14ed('0x30')](function(_0x2d5341){_0x4b341e[_0x14ed('0x61')]=_0x2d5341;return _0x4b341e;});}})[_0x14ed('0x30')](respondWithFilteredResult(_0x458847,_0x14d830))[_0x14ed('0x23')](handleError(_0x458847,null));};exports[_0x14ed('0x66')]=function(_0x5dc446,_0x15da66,_0x2057e9){return db[_0x14ed('0x4d')][_0x14ed('0x52')]({'where':{'id':_0x5dc446[_0x14ed('0x4f')]['id']}})[_0x14ed('0x30')](handleEntityNotFound(_0x15da66,null))['then'](function(_0x9d1c06){if(_0x9d1c06){return _0x9d1c06['removeAnswers'](_0x5dc446[_0x14ed('0x3e')][_0x14ed('0x67')]);}})[_0x14ed('0x30')](respondWithStatusCode(_0x15da66,null))[_0x14ed('0x23')](handleError(_0x15da66,null));};exports[_0x14ed('0x68')]=function(_0x12e564,_0x23b082,_0x432d30){var _0x43cc7b={'channel':_0x14ed('0x69')};var _0x131242=[];var _0x4719c5=[];var _0x3c5202={};return db['SmsAccount']['find']({'where':{'id':_0x12e564[_0x14ed('0x4f')]['id']},'include':[{'model':db[_0x14ed('0x6a')],'as':_0x14ed('0x6b')}]})[_0x14ed('0x30')](handleEntityNotFound(_0x23b082,null))[_0x14ed('0x30')](function(_0x410969){_0x43cc7b['account']=_0x410969;_0x43cc7b[_0x14ed('0x6c')]=_[_0x14ed('0x6d')](_0x410969[_0x14ed('0x6b')],[_0x14ed('0x6e')],[_0x14ed('0x6f')]);if(_0x43cc7b[_0x14ed('0x70')][_0x14ed('0x6b')]){delete _0x43cc7b[_0x14ed('0x70')][_0x14ed('0x6b')];}return db[_0x14ed('0x71')]['describe']();})[_0x14ed('0x30')](function(_0x387b24){if(!_0x387b24){throw new db['Sequelize'][(_0x14ed('0x72'))](_0x14ed('0x73'));}_0x131242=_[_0x14ed('0x74')](_[_0x14ed('0x3d')](_0x387b24),[_0x14ed('0x75'),_0x14ed('0x76')]);_0x4719c5=_['difference'](_[_0x14ed('0x3d')](_0x387b24),[_0x14ed('0x75'),_0x14ed('0x76'),_0x14ed('0x77'),'ListId']);_0x43cc7b[_0x14ed('0x54')]={'mapKey':_0x14ed('0x78')};if(_0x43cc7b[_0x14ed('0x70')][_0x14ed('0x3a')]){switch(_0x43cc7b[_0x14ed('0x70')][_0x14ed('0x3a')]){case'twilio':_0x43cc7b[_0x14ed('0x54')][_0x14ed('0x79')]=_0x12e564[_0x14ed('0x54')]['From'];_0x43cc7b[_0x14ed('0x54')][_0x14ed('0x54')]=_0x12e564['body'][_0x14ed('0x7a')];_0x43cc7b[_0x14ed('0x54')]['messageId']=_0x12e564[_0x14ed('0x54')][_0x14ed('0x7b')];break;case _0x14ed('0x7c'):_0x43cc7b[_0x14ed('0x54')]['from']='+'+_0x12e564[_0x14ed('0x54')][_0x14ed('0x7d')];_0x43cc7b[_0x14ed('0x54')][_0x14ed('0x54')]=_0x12e564['body']['text'];break;case _0x14ed('0x7e'):_0x43cc7b['body']['from']=_0x12e564[_0x14ed('0x54')][_0x14ed('0x79')];_0x43cc7b['body'][_0x14ed('0x54')]=_0x12e564[_0x14ed('0x54')]['message'];break;case _0x14ed('0x7f'):_0x43cc7b[_0x14ed('0x54')][_0x14ed('0x79')]=_0x12e564[_0x14ed('0x54')][_0x14ed('0x79')];_0x43cc7b['body'][_0x14ed('0x54')]=_0x12e564[_0x14ed('0x54')]['body'];_0x43cc7b[_0x14ed('0x54')][_0x14ed('0x80')]=_0x12e564['body'][_0x14ed('0x81')];break;case _0x14ed('0x82'):_0x43cc7b[_0x14ed('0x54')]['from']=_0x12e564[_0x14ed('0x54')]['From'];_0x43cc7b['body']['body']=_0x12e564[_0x14ed('0x54')][_0x14ed('0x83')];_0x43cc7b[_0x14ed('0x54')][_0x14ed('0x80')]=_0x12e564['body'][_0x14ed('0x84')];break;case _0x14ed('0x85'):_0x43cc7b[_0x14ed('0x54')][_0x14ed('0x79')]='+'+_0x12e564[_0x14ed('0x54')][_0x14ed('0x86')][0x0][_0x14ed('0x79')];_0x43cc7b[_0x14ed('0x54')][_0x14ed('0x54')]=_0x12e564[_0x14ed('0x54')]['results'][0x0][_0x14ed('0x87')];_0x43cc7b[_0x14ed('0x54')][_0x14ed('0x80')]=_0x12e564[_0x14ed('0x54')]['results'][0x0]['messageId'];break;case _0x14ed('0x88'):_0x43cc7b[_0x14ed('0x54')][_0x14ed('0x79')]=_0x12e564[_0x14ed('0x54')][_0x14ed('0x89')];_0x43cc7b[_0x14ed('0x54')][_0x14ed('0x54')]=_0x12e564[_0x14ed('0x54')][_0x14ed('0x8a')]['message'];break;case _0x14ed('0x8b'):_0x43cc7b[_0x14ed('0x54')][_0x14ed('0x79')]=_0x12e564[_0x14ed('0x54')][_0x14ed('0x8c')];_0x43cc7b[_0x14ed('0x54')][_0x14ed('0x54')]=_0x12e564[_0x14ed('0x54')][_0x14ed('0x87')];_0x43cc7b[_0x14ed('0x54')]['messageId']=_0x12e564[_0x14ed('0x54')]['replyMessageId'];break;case _0x14ed('0x8d'):_0x43cc7b['body']['messageId']=_0x12e564[_0x14ed('0x54')][0x0][_0x14ed('0x20')]['id'];_0x43cc7b[_0x14ed('0x54')][_0x14ed('0x79')]=_0x12e564['body'][0x0][_0x14ed('0x20')]['from'];_0x43cc7b['body']['body']=_0x12e564[_0x14ed('0x54')][0x0][_0x14ed('0x20')][_0x14ed('0x87')];break;case _0x14ed('0x8e'):_0x43cc7b['body'][_0x14ed('0x79')]=_0x12e564[_0x14ed('0x54')][_0x14ed('0x79')];_0x43cc7b[_0x14ed('0x54')]['body']=_0x12e564[_0x14ed('0x54')][_0x14ed('0x20')];_0x43cc7b['body'][_0x14ed('0x80')]=_0x12e564[_0x14ed('0x54')][_0x14ed('0x8f')];break;}}if(_0x43cc7b[_0x14ed('0x54')]['id']){delete _0x43cc7b[_0x14ed('0x54')]['id'];}if(_['isNil'](_0x43cc7b[_0x14ed('0x54')][_0x14ed('0x79')])){throw new db[(_0x14ed('0x90'))][(_0x14ed('0x72'))](_0x14ed('0x91'));}if(_[_0x14ed('0x92')](_0x43cc7b['body'][_0x14ed('0x54')])||_0x43cc7b[_0x14ed('0x54')]['body']===''){throw new db[(_0x14ed('0x90'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x14ed('0x92')](_0x43cc7b[_0x14ed('0x54')]['mapKey'])){throw new db['Sequelize'][(_0x14ed('0x72'))](_0x14ed('0x93')+_0x4719c5);}if(!_[_0x14ed('0x94')](_0x4719c5,_0x43cc7b['body'][_0x14ed('0x95')])){throw new db[(_0x14ed('0x90'))]['ValidationError'](_0x14ed('0x96')+_0x4719c5);}_0x3c5202[_0x43cc7b[_0x14ed('0x54')][_0x14ed('0x95')]]=_0x43cc7b[_0x14ed('0x54')][_0x14ed('0x79')];return db[_0x14ed('0x97')][_0x14ed('0x52')]({'where':{'id':_0x43cc7b[_0x14ed('0x70')]['ListId']},'include':[{'model':db[_0x14ed('0x71')],'as':'Contacts','where':_0x3c5202,'limit':0x1,'order':[[_0x14ed('0x76'),_0x14ed('0x98')]]}]});})[_0x14ed('0x30')](handleEntityNotFound(_0x23b082,null))[_0x14ed('0x30')](function(_0x5e5f78){if(_0x5e5f78){_0x43cc7b[_0x14ed('0x99')]=_['omit'](_0x5e5f78,[_0x14ed('0x9a')]);if(_0x5e5f78['Contacts'][_0x14ed('0x42')]){return _0x5e5f78[_0x14ed('0x9a')][0x0];}var _0x27aab5=_[_0x14ed('0x11')](_0x43cc7b[_0x14ed('0x54')],{'firstName':_0x43cc7b['body'][_0x14ed('0x79')],'ListId':_0x5e5f78['id']});_0x27aab5[_0x43cc7b[_0x14ed('0x54')][_0x14ed('0x95')]]=_0x43cc7b['body']['from'];return db[_0x14ed('0x71')][_0x14ed('0x53')](_0x27aab5,{'fields':_0x131242,'raw':!![]});}})[_0x14ed('0x30')](handleEntityNotFound(_0x23b082,null))[_0x14ed('0x30')](function(_0x31475a){if(_0x31475a){_0x43cc7b['contact']=_0x31475a;var _0x250cb2={'ContactId':_0x31475a['id'],'phone':_0x43cc7b[_0x14ed('0x54')][_0x14ed('0x79')],'SmsAccountId':_0x12e564[_0x14ed('0x4f')]['id']};var _0x4e2070={'ContactId':_0x31475a['id'],'SmsAccountId':_0x12e564[_0x14ed('0x4f')]['id'],'closed':![]};return db['SmsInteraction']['find']({'where':_0x4e2070})[_0x14ed('0x30')](function(_0x33b046){if(_0x33b046){return[_0x33b046,![]];}return db[_0x14ed('0x9b')][_0x14ed('0x53')](_0x250cb2)['then'](function(_0x1e9ff3){return[_0x1e9ff3,!![]];});});}})[_0x14ed('0x9c')](function(_0x44f510,_0x1fd926){_0x43cc7b[_0x14ed('0x9d')]=_0x44f510[_0x14ed('0x9e')]({'plain':!![]});_0x43cc7b[_0x14ed('0x9d')][_0x14ed('0x9f')]=![];if(_0x1fd926){if(_0x43cc7b['account']['autoclose']){_0x43cc7b[_0x14ed('0x6c')]['push']({'id':0x0,'priority':_0x43cc7b[_0x14ed('0x6c')]['length']+0x1,'app':_0x14ed('0xa0'),'appdata':_0x14ed('0xa1'),'interval':_0x14ed('0xa2')});}_0x43cc7b[_0x14ed('0x9d')]['created']=!![];}return db['SmsMessage'][_0x14ed('0x53')]({'phone':_0x43cc7b[_0x14ed('0x54')][_0x14ed('0x79')],'messageId':_0x43cc7b[_0x14ed('0x54')][_0x14ed('0x80')],'body':_0x43cc7b['body'][_0x14ed('0x54')],'SmsAccountId':_0x12e564[_0x14ed('0x4f')]['id'],'SmsInteractionId':_0x44f510['id'],'direction':'in','ContactId':_0x44f510[_0x14ed('0xa3')],'AttachmentId':_0x43cc7b[_0x14ed('0x54')][_0x14ed('0xa4')]});})[_0x14ed('0x30')](function(_0x5ed729){_0x43cc7b['message']=_0x5ed729;if(!_0x43cc7b[_0x14ed('0x9d')][_0x14ed('0xa5')])return;return db[_0x14ed('0xa6')][_0x14ed('0x52')]({'attributes':['id',_0x14ed('0x35')],'where':{'id':_0x43cc7b[_0x14ed('0x9d')][_0x14ed('0xa5')]}});})['then'](function(_0x3f8470){if(_0x3f8470){_0x43cc7b[_0x14ed('0x6c')][_0x14ed('0xa7')]({'id':0x0,'priority':0x0,'app':_0x14ed('0xa8'),'appdata':_0x3f8470['name']+','+(_0x43cc7b[_0x14ed('0x70')][_0x14ed('0xa9')]||0xa),'interval':'*,*,*,*'});}if(!_0x43cc7b['interaction'][_0x14ed('0xaa')])return;return db[_0x14ed('0xab')][_0x14ed('0x52')]({'attributes':['id',_0x14ed('0x35')],'where':{'id':_0x43cc7b[_0x14ed('0x9d')][_0x14ed('0xaa')]}});})['then'](function(_0x15e239){if(_0x15e239){_0x43cc7b[_0x14ed('0x6c')][_0x14ed('0xa7')]({'id':0x0,'priority':0x1,'app':_0x14ed('0xac'),'appdata':_0x15e239[_0x14ed('0x35')]+','+(_0x43cc7b[_0x14ed('0x70')][_0x14ed('0xad')]||0x12c),'interval':_0x14ed('0xa2')});}return respondWithRpcPromise(_0x14ed('0xae'),_0x14ed('0xaf'),_0x43cc7b);})[_0x14ed('0x30')](function(_0x42fbfa){if(_0x42fbfa){var _0x8b1b53=0xc8;var _0x414797=_0x14ed('0xb0');logger[_0x14ed('0x21')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x414797,_0x8b1b53,'entity\x20found');logger['debug'](_0x14ed('0xb1'),_0x414797,_0x8b1b53,'entity\x20found',JSON[_0x14ed('0x1d')](_0x42fbfa));if(_0x43cc7b[_0x14ed('0x70')][_0x14ed('0x3a')]===_0x14ed('0xb2')){return _0x23b082['status'](_0x8b1b53)[_0x14ed('0x2b')]('Content-Type',_0x14ed('0xb3'))[_0x14ed('0xb4')](_0x14ed('0xb5'));}else{return _0x23b082[_0x14ed('0x25')](_0x8b1b53)[_0x14ed('0x26')](_0x42fbfa);}}})[_0x14ed('0x23')](handleError(_0x23b082,null));};exports[_0x14ed('0xb6')]=function(_0x28167f,_0x154a25){var _0x5083e6=_0x28167f[_0x14ed('0x4f')]['id'];var _0x344757=_0x28167f[_0x14ed('0x54')];var _0x5ede63=0xc8;var _0x569780=null;return db[_0x14ed('0xb7')]['transaction']({'isolationLevel':db[_0x14ed('0xb7')][_0x14ed('0xb8')]['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x391f7f){return db[_0x14ed('0x4d')]['findOne']({'where':{'id':_0x5083e6},'transaction':_0x391f7f})[_0x14ed('0x30')](function(_0x2fb464){if(_0x2fb464){return db[_0x14ed('0x6a')]['destroy']({'where':{'SmsAccountId':_0x5083e6},'transaction':_0x391f7f})[_0x14ed('0x30')](function(){var _0x3a9366=_[_0x14ed('0x38')](_0x344757,function(_0x24053e){_0x24053e[_0x14ed('0x5c')]=_0x5083e6;return _0x24053e;});return db['SmsApplication'][_0x14ed('0xb9')](_0x3a9366,{'transaction':_0x391f7f});});}else{_0x5ede63=0x194;_0x569780=[];}});})[_0x14ed('0x30')](function(){if(_0x5ede63!==0x194){return db['SmsApplication'][_0x14ed('0xba')]({'where':{'SmsAccountId':_0x5083e6},'order':_0x14ed('0x6e')})[_0x14ed('0x30')](function(_0x3b9953){_0x569780=_0x3b9953;});}})[_0x14ed('0x23')](function(_0x502db9){_0x5ede63=0x1f4;logger[_0x14ed('0x1e')](_0x502db9[_0x14ed('0x34')]);if(_0x502db9[_0x14ed('0x35')]){delete _0x502db9[_0x14ed('0x35')];}_0x569780=_0x502db9;})[_0x14ed('0xbb')](function(){if(_0x569780===null){_0x154a25[_0x14ed('0x24')](_0x5ede63);}else{if(_0x5ede63===0x1f4){_0x154a25[_0x14ed('0x25')](_0x5ede63)[_0x14ed('0xb4')](_0x569780);}else{_0x154a25['status'](_0x5ede63)[_0x14ed('0x26')](_0x569780);}}});};exports[_0x14ed('0xbc')]=function(_0x1a00f3,_0x4d8db5,_0x204efd){var _0x54a931={};var _0x4771f5={};var _0x22d0a9;var _0x32d412;return db['SmsAccount'][_0x14ed('0x5f')]({'where':{'id':_0x1a00f3['params']['id']}})[_0x14ed('0x30')](handleEntityNotFound(_0x4d8db5,null))[_0x14ed('0x30')](function(_0x4a4389){if(_0x4a4389){_0x22d0a9=_0x4a4389;_0x4771f5[_0x14ed('0x3c')]=_[_0x14ed('0x3d')](db[_0x14ed('0x6a')][_0x14ed('0x39')]);_0x4771f5[_0x14ed('0x3e')]=_['keys'](_0x1a00f3[_0x14ed('0x3e')]);_0x4771f5[_0x14ed('0x47')]=_[_0x14ed('0x3f')](_0x4771f5['model'],_0x4771f5[_0x14ed('0x3e')]);_0x54a931[_0x14ed('0x40')]=_[_0x14ed('0x3f')](_0x4771f5[_0x14ed('0x3c')],qs[_0x14ed('0x41')](_0x1a00f3['query'][_0x14ed('0x41')]));_0x54a931[_0x14ed('0x40')]=_0x54a931[_0x14ed('0x40')][_0x14ed('0x42')]?_0x54a931[_0x14ed('0x40')]:_0x4771f5[_0x14ed('0x3c')];_0x54a931[_0x14ed('0x44')]=qs[_0x14ed('0x45')](_0x1a00f3[_0x14ed('0x3e')]['sort']);_0x54a931[_0x14ed('0x46')]=qs[_0x14ed('0x47')](_[_0x14ed('0x48')](_0x1a00f3[_0x14ed('0x3e')],_0x4771f5['filters']));if(_0x1a00f3[_0x14ed('0x3e')][_0x14ed('0x49')]){_0x54a931[_0x14ed('0x46')]=_[_0x14ed('0x4b')](_0x54a931[_0x14ed('0x46')],{'$or':_['map'](_0x54a931['attributes'],function(_0x38ca6c){var _0x218625={};_0x218625[_0x38ca6c]={'$like':'%'+_0x1a00f3['query']['filter']+'%'};return _0x218625;})});}_0x54a931=_[_0x14ed('0x4b')]({},_0x54a931,_0x1a00f3['options']);return _0x22d0a9[_0x14ed('0xbc')](_0x54a931);}})[_0x14ed('0x30')](function(_0x3ac262){if(_0x3ac262){_0x32d412=_0x3ac262[_0x14ed('0x42')];if(!_0x1a00f3[_0x14ed('0x3e')][_0x14ed('0x43')](_0x14ed('0x60'))){_0x54a931[_0x14ed('0x29')]=qs[_0x14ed('0x29')](_0x1a00f3[_0x14ed('0x3e')]['limit']);_0x54a931[_0x14ed('0x27')]=qs[_0x14ed('0x27')](_0x1a00f3[_0x14ed('0x3e')][_0x14ed('0x27')]);}return _0x22d0a9[_0x14ed('0xbc')](_0x54a931);}})['then'](function(_0x950d5f){if(_0x950d5f){return _0x950d5f?{'count':_0x32d412,'rows':_0x950d5f}:null;}})[_0x14ed('0x30')](respondWithResult(_0x4d8db5,null))[_0x14ed('0x23')](handleError(_0x4d8db5,null));};exports[_0x14ed('0xbd')]=function(_0x2294f7,_0xab3916,_0x3d0c79){var _0x3e3d3d={'raw':![],'where':{}};var _0x1c840c={};var _0x262892={'count':0x0,'rows':[]};return db['SmsAccount']['findOne']({'where':{'id':_0x2294f7[_0x14ed('0x4f')]['id']}})[_0x14ed('0x30')](handleEntityNotFound(_0xab3916,null))[_0x14ed('0x30')](function(_0x429d5e){if(_0x429d5e){_0x1c840c[_0x14ed('0x3c')]=_[_0x14ed('0x3d')](db['SmsInteraction'][_0x14ed('0x39')]);_0x1c840c['query']=_[_0x14ed('0x3d')](_0x2294f7[_0x14ed('0x3e')]);_0x1c840c[_0x14ed('0x47')]=_[_0x14ed('0x3f')](_0x1c840c[_0x14ed('0x3c')],_0x1c840c[_0x14ed('0x3e')]);_0x3e3d3d[_0x14ed('0x40')]=_[_0x14ed('0x3f')](_0x1c840c[_0x14ed('0x3c')],qs[_0x14ed('0x41')](_0x2294f7[_0x14ed('0x3e')][_0x14ed('0x41')]));_0x3e3d3d[_0x14ed('0x40')]=_0x3e3d3d[_0x14ed('0x40')][_0x14ed('0x42')]?_0x3e3d3d[_0x14ed('0x40')]:_0x1c840c['model'];if(!_0x2294f7[_0x14ed('0x3e')]['hasOwnProperty'](_0x14ed('0x60'))){_0x3e3d3d['limit']=qs[_0x14ed('0x29')](_0x2294f7['query']['limit']);_0x3e3d3d[_0x14ed('0x27')]=qs[_0x14ed('0x27')](_0x2294f7[_0x14ed('0x3e')][_0x14ed('0x27')]);}_0x3e3d3d[_0x14ed('0x44')]=qs[_0x14ed('0x45')](_0x2294f7[_0x14ed('0x3e')][_0x14ed('0x45')]);_0x3e3d3d[_0x14ed('0x46')]=qs[_0x14ed('0x47')](_[_0x14ed('0x48')](_0x2294f7['query'],_0x1c840c[_0x14ed('0x47')]));_0x3e3d3d['where'][_0x14ed('0x5c')]=_0x429d5e['id'];if(_0x2294f7[_0x14ed('0x3e')][_0x14ed('0x49')]){_0x3e3d3d[_0x14ed('0x46')]=_[_0x14ed('0x4b')](_0x3e3d3d[_0x14ed('0x46')],{'$or':_[_0x14ed('0x38')](_0x3e3d3d[_0x14ed('0x40')],function(_0x44a784){var _0x3c25d8={};_0x3c25d8[_0x44a784]={'$like':'%'+_0x2294f7[_0x14ed('0x3e')][_0x14ed('0x49')]+'%'};return _0x3c25d8;})});}_0x3e3d3d=_['merge']({},_0x3e3d3d,_0x2294f7[_0x14ed('0x51')]);return db[_0x14ed('0x9b')][_0x14ed('0x2a')]({'where':_0x3e3d3d['where']})[_0x14ed('0x30')](function(_0x1a9eb5){_0x262892[_0x14ed('0x2a')]=_0x1a9eb5;if(_0x2294f7[_0x14ed('0x3e')]['includeAll']){_0x3e3d3d['include']=[{'model':db['CmContact'],'as':_0x14ed('0xbe'),'required':![]},{'model':db[_0x14ed('0xa6')],'as':'Owner','attributes':[_0x14ed('0x35'),_0x14ed('0xbf'),_0x14ed('0xc0')],'required':![]},{'model':db[_0x14ed('0xc1')],'as':_0x14ed('0xc2'),'attributes':['id',_0x14ed('0x35'),_0x14ed('0xc3')],'where':_0x2294f7[_0x14ed('0x3e')][_0x14ed('0xc4')]?{'id':_0x2294f7[_0x14ed('0x3e')][_0x14ed('0xc4')]}:undefined,'required':_0x2294f7['query'][_0x14ed('0xc4')]?!![]:![]}];}return db[_0x14ed('0x9b')][_0x14ed('0x4e')](_0x3e3d3d);})['then'](function(_0x511f26){_0x262892[_0x14ed('0x61')]=_0x511f26;return _0x262892;});}})[_0x14ed('0x30')](respondWithFilteredResult(_0xab3916,_0x3e3d3d))['catch'](handleError(_0xab3916,null));};exports[_0x14ed('0xb4')]=function(_0x49c7f4,_0xdcfcc4,_0x4d3a93){var _0x233d7e,_0x3a117a,_0x4f6504;if(_[_0x14ed('0x92')](_0x49c7f4[_0x14ed('0x54')]['body'])||_0x49c7f4[_0x14ed('0x54')][_0x14ed('0x54')]===''){throw new db['Sequelize']['ValidationError'](_0x14ed('0xc5'));}if(_['isNil'](_0x49c7f4[_0x14ed('0x54')]['to'])){throw new db[(_0x14ed('0x90'))][(_0x14ed('0x72'))](_0x14ed('0xc6'));}_0x233d7e=_0x49c7f4['body']['to'];return db[_0x14ed('0x4d')][_0x14ed('0x52')]({'where':{'id':_0x49c7f4[_0x14ed('0x4f')]['id']},'include':[{'model':db['CmList'],'as':_0x14ed('0xc7'),'include':[{'model':db[_0x14ed('0x71')],'as':_0x14ed('0x9a'),'where':{'mobile':_0x233d7e},'limit':0x1,'order':[[_0x14ed('0x76'),_0x14ed('0x98')]]}]}]})[_0x14ed('0x30')](handleEntityNotFound(_0xdcfcc4,null))[_0x14ed('0x30')](function(_0x46d9d2){if(_0x46d9d2&&_0x46d9d2[_0x14ed('0xc7')]){_0x3a117a=_0x46d9d2[_0x14ed('0x9e')]({'plain':!![]});if(_0x3a117a['List']&&_0x3a117a[_0x14ed('0xc7')][_0x14ed('0x9a')]['length']){return _0x3a117a[_0x14ed('0xc7')][_0x14ed('0x9a')][0x0];}return db['CmContact']['create'](_['defaults'](_0x49c7f4[_0x14ed('0x54')],{'firstName':_0x233d7e,'mobile':_0x233d7e,'phone':_0x233d7e,'ListId':_0x3a117a[_0x14ed('0xc8')]}));}})[_0x14ed('0x30')](handleEntityNotFound(_0xdcfcc4,null))[_0x14ed('0x30')](function(_0x5c35a2){if(_0x5c35a2){_0x4f6504=_0x5c35a2;return db[_0x14ed('0x9b')][_0x14ed('0x52')]({'where':{'ContactId':_0x4f6504['id'],'closed':![],'SmsAccountId':_0x3a117a['id']}})[_0x14ed('0x30')](function(_0x2d44ec){if(_0x2d44ec){return[_0x2d44ec,![]];}return db[_0x14ed('0x9b')][_0x14ed('0x53')]({'UserId':_0x49c7f4[_0x14ed('0x55')]['id'],'ContactId':_0x4f6504['id'],'SmsAccountId':_0x3a117a['id'],'phone':_0x233d7e,'firstMsgDirection':_0x14ed('0xc9'),'Messages':[_[_0x14ed('0x4b')](_0x49c7f4[_0x14ed('0x54')],{'read':![],'body':_0x49c7f4[_0x14ed('0x54')][_0x14ed('0x54')],'phone':_0x233d7e,'SmsAccountId':_0x3a117a['id'],'UserId':_0x49c7f4[_0x14ed('0x55')]['id'],'ContactId':_0x4f6504['id']})]},{'include':[{'model':db[_0x14ed('0xca')],'as':'Messages'}]})[_0x14ed('0x30')](function(_0xf1b2e8){return[_0xf1b2e8,!![]];});});}})[_0x14ed('0x9c')](function(_0x587121,_0x572121){if(_0x572121){return _0x587121;}return db[_0x14ed('0xca')][_0x14ed('0x53')](_[_0x14ed('0x4b')](_0x49c7f4[_0x14ed('0x54')],{'read':![],'body':_0x49c7f4[_0x14ed('0x54')][_0x14ed('0x54')],'phone':_0x233d7e,'SmsAccountId':_0x3a117a['id'],'SmsInteractionId':_0x587121['id'],'UserId':_0x49c7f4[_0x14ed('0x55')]['id'],'ContactId':_0x4f6504['id']}))[_0x14ed('0x30')](function(_0x12442d){_0x587121[_0x14ed('0xcb')][_0x14ed('0xcc')]=[];_0x587121[_0x14ed('0xcb')][_0x14ed('0xcc')][_0x14ed('0xcd')](_0x12442d[_0x14ed('0xcb')]);return _0x587121;});})[_0x14ed('0x30')](respondWithResult(_0xdcfcc4,null))[_0x14ed('0x23')](handleError(_0xdcfcc4,null));};exports[_0x14ed('0x25')]=function(_0x2a8e93,_0x439f12,_0x1fe607){if(_0x2a8e93['body']['id']){delete _0x2a8e93[_0x14ed('0x54')]['id'];}var _0x2661d2,_0x5a13d2,_0x44853e;return db[_0x14ed('0x4d')]['find']({'where':{'id':_0x2a8e93[_0x14ed('0x4f')]['id']}})[_0x14ed('0x30')](handleEntityNotFound(_0x439f12,null))['then'](function(_0x494f84){if(_0x494f84){_0x44853e=_0x494f84;logger[_0x14ed('0x1b')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x14ed('0x25'),_0x14ed('0xce'),_0x494f84['type'],util[_0x14ed('0xcf')](_0x2a8e93['body'],{'showHidden':![],'depth':null}));switch(_0x494f84[_0x14ed('0x3a')]){case _0x14ed('0x7c'):if(_0x2a8e93[_0x14ed('0x54')][_0x14ed('0xd0')]&&_0x2a8e93['body'][_0x14ed('0x25')]){_0x5a13d2=_0x2a8e93['body'][_0x14ed('0x25')];return db[_0x14ed('0xca')][_0x14ed('0x52')]({'where':{'messageId':_0x2a8e93[_0x14ed('0x54')][_0x14ed('0xd0')]}});}break;case _0x14ed('0x7e'):if(_0x2a8e93[_0x14ed('0x54')][_0x14ed('0xd1')]&&_0x2a8e93['body'][_0x14ed('0xd2')]){_0x5a13d2=_0x2a8e93[_0x14ed('0x54')][_0x14ed('0xd2')];return db[_0x14ed('0xca')][_0x14ed('0x52')]({'where':{'messageId':_0x2a8e93[_0x14ed('0x54')][_0x14ed('0xd1')]}});}break;case _0x14ed('0x7f'):if(_0x2a8e93[_0x14ed('0x54')][_0x14ed('0x81')]&&_0x2a8e93[_0x14ed('0x54')][_0x14ed('0xd3')]){_0x5a13d2=_0x2a8e93[_0x14ed('0x54')][_0x14ed('0xd3')];return db[_0x14ed('0xca')][_0x14ed('0x52')]({'where':{'messageId':_0x2a8e93[_0x14ed('0x54')][_0x14ed('0x81')]}});}break;case _0x14ed('0x85'):var _0x4e7029=_0x2a8e93['body'][_0x14ed('0x86')][0x0];if(_0x4e7029[_0x14ed('0x80')]&&_0x4e7029[_0x14ed('0x25')][_0x14ed('0xd4')]===_0x14ed('0xd5')){_0x5a13d2=_0x4e7029['status'][_0x14ed('0xd4')];return db[_0x14ed('0xca')]['find']({'where':{'messageId':_0x4e7029[_0x14ed('0x80')]}});}break;case _0x14ed('0x8b'):if(_0x2a8e93['body'][_0x14ed('0x80')]&&_0x2a8e93['body']['status']){_0x5a13d2=_0x2a8e93['body']['status'];return db[_0x14ed('0xca')][_0x14ed('0x52')]({'where':{'messageId':_0x2a8e93[_0x14ed('0x54')]['messageId']}});}break;case _0x14ed('0x8d'):if(_0x2a8e93[_0x14ed('0x54')][0x0][_0x14ed('0x20')]['id']){_0x5a13d2=_0x2a8e93[_0x14ed('0x54')][0x0]['type'];return db['SmsMessage'][_0x14ed('0x52')]({'where':{'messageId':_0x2a8e93[_0x14ed('0x54')][0x0][_0x14ed('0x20')]['id']}});}break;case'intelepeer':if(_0x2a8e93[_0x14ed('0x54')][_0x14ed('0xd6')]&&_0x2a8e93['body'][_0x14ed('0x25')]){_0x5a13d2=_0x2a8e93['body']['status'];return db['SmsMessage'][_0x14ed('0x52')]({'where':{'messageId':_0x2a8e93['body']['redif']}});}break;}}})[_0x14ed('0x30')](handleEntityNotFound(_0x439f12,null))['then'](function(_0x496520){if(_0x496520){_0x2661d2=_0x496520;switch(_0x44853e['type']){case _0x14ed('0x7c'):if(_0x5a13d2===_0x14ed('0xd5')){return _0x2661d2[_0x14ed('0x2f')]({'read':!![]});}else{logger['error'](_0x14ed('0x1c'),_0x14ed('0x25'),_0x14ed('0x7c'),util[_0x14ed('0xcf')](_0x2a8e93[_0x14ed('0x54')],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x5a13d2==='1'){return _0x2661d2['update']({'read':!![]});}else{logger['error'](_0x14ed('0x1c'),_0x14ed('0x25'),_0x14ed('0x7c'),util[_0x14ed('0xcf')](_0x2a8e93['body'],{'showHidden':![],'depth':null}));}break;case _0x14ed('0x7f'):if(!_0x2a8e93[_0x14ed('0x54')][_0x14ed('0xd7')]&&_0x5a13d2>=0xc8&&_0x5a13d2<=0xce){return _0x2661d2[_0x14ed('0x2f')]({'read':!![]});}else{logger[_0x14ed('0x1e')](_0x14ed('0x1c'),_0x14ed('0x25'),_0x14ed('0x7f'),util['inspect'](_0x2a8e93['body'],{'showHidden':![],'depth':null}));}break;case _0x14ed('0x85'):var _0x128c18=_0x2a8e93['body'][_0x14ed('0x86')][0x0];if(_0x128c18['status'][_0x14ed('0xd4')]==='DELIVERED'){return _0x2661d2[_0x14ed('0x2f')]({'read':!![]});}else{logger[_0x14ed('0x1e')](_0x14ed('0x1c'),'status',_0x14ed('0x85'),util[_0x14ed('0xcf')](_0x2a8e93[_0x14ed('0x54')],{'showHidden':![],'depth':null}));}break;case _0x14ed('0x8b'):if(_0x5a13d2==_0x14ed('0xd8')||_0x5a13d2==_0x14ed('0xd9')){return _0x2661d2[_0x14ed('0x2f')]({'read':!![]});}else{logger['error'](_0x14ed('0x1c'),_0x14ed('0x25'),'clickatell',util['inspect'](_0x2a8e93[_0x14ed('0x54')],{'showHidden':![],'depth':null}));}break;case'bandwidth':if(_0x5a13d2==_0x14ed('0xda')){return _0x2661d2[_0x14ed('0x2f')]({'read':!![]});}else{logger[_0x14ed('0x1e')](_0x14ed('0x1c'),_0x14ed('0x25'),_0x14ed('0x8d'),util[_0x14ed('0xcf')](_0x2a8e93[_0x14ed('0x54')],{'showHidden':![],'depth':null}));}break;case _0x14ed('0x8e'):if(_0x5a13d2===_0x14ed('0xdb')||_0x5a13d2===_0x14ed('0xdc')){return _0x2661d2['update']({'read':!![]});}else{logger[_0x14ed('0x1e')](_0x14ed('0x1c'),_0x14ed('0x25'),_0x14ed('0x8e'),util[_0x14ed('0xcf')](_0x2a8e93[_0x14ed('0x54')],{'showHidden':![],'depth':null}));}break;}return _0x2661d2;}})[_0x14ed('0x30')](respondWithResult(_0x439f12,null))[_0x14ed('0x23')](handleError(_0x439f12,null));};exports['statusGet']=function(_0x50cd3d,_0x10615f,_0x4dd80a){var _0x4bf5b1,_0x406f34,_0x564f09;return db[_0x14ed('0x4d')][_0x14ed('0x52')]({'where':{'id':_0x50cd3d['params']['id']}})[_0x14ed('0x30')](handleEntityNotFound(_0x10615f,null))[_0x14ed('0x30')](function(_0x1cf8f1){if(_0x1cf8f1){_0x564f09=_0x1cf8f1;logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x14ed('0x25'),'received\x20delivery\x20report\x20from',_0x1cf8f1[_0x14ed('0x3a')],util[_0x14ed('0xcf')](_0x50cd3d[_0x14ed('0x3e')],{'showHidden':![],'depth':null}));switch(_0x1cf8f1[_0x14ed('0x3a')]){case _0x14ed('0x88'):if(_0x50cd3d['query'][_0x14ed('0xdd')]&&_0x50cd3d[_0x14ed('0x3e')][_0x14ed('0xde')]){_0x406f34=_0x50cd3d['query'][_0x14ed('0xde')];return db[_0x14ed('0xca')]['find']({'where':{'messageId':_0x50cd3d[_0x14ed('0x3e')][_0x14ed('0xdd')]}});}break;}}})[_0x14ed('0x30')](handleEntityNotFound(_0x10615f,null))['then'](function(_0x10024e){if(_0x10024e){_0x4bf5b1=_0x10024e;switch(_0x564f09[_0x14ed('0x3a')]){case'csc':if(_0x406f34==='2'||_0x406f34==='6'){return _0x4bf5b1['update']({'read':!![]});}else{logger[_0x14ed('0x1e')](_0x14ed('0x1c'),_0x14ed('0x25'),'csc',util[_0x14ed('0xcf')](_0x50cd3d[_0x14ed('0x3e')],{'showHidden':![],'depth':null}));};break;}return _0x4bf5b1;}})[_0x14ed('0x30')](respondWithResult(_0x10615f,null))[_0x14ed('0x23')](handleError(_0x10615f,null));};exports[_0x14ed('0xdf')]=function(_0xd6699c,_0x537dc3,_0x484aa2){return db[_0x14ed('0x4d')]['find']({'where':{'id':_0xd6699c['params']['id']}})[_0x14ed('0x30')](handleEntityNotFound(_0x537dc3,null))[_0x14ed('0x30')](function(_0x1ab4ce){if(_0x1ab4ce){return _0x1ab4ce[_0x14ed('0xdf')](_0xd6699c['body'][_0x14ed('0x67')],_['omit'](_0xd6699c[_0x14ed('0x54')],[_0x14ed('0x67'),'id'])||{})['spread'](function(_0x2054c9){for(var _0x221b9c=0x0;_0x221b9c<_0xd6699c[_0x14ed('0x54')][_0x14ed('0x67')][_0x14ed('0x42')];_0x221b9c+=0x1){socket[_0x14ed('0xe0')](_0x14ed('0xe1'),{'UserId':Number(_0xd6699c[_0x14ed('0x54')][_0x14ed('0x67')][_0x221b9c]),'SmsAccountId':Number(_0xd6699c['params']['id'])});}return _0x2054c9;});}})[_0x14ed('0x30')](respondWithResult(_0x537dc3,null))['catch'](handleError(_0x537dc3,null));};exports[_0x14ed('0xe2')]=function(_0x41fc94,_0x1dc261,_0x5204fc){return db[_0x14ed('0x4d')][_0x14ed('0x52')]({'where':{'id':_0x41fc94[_0x14ed('0x4f')]['id']}})['then'](handleEntityNotFound(_0x1dc261,null))[_0x14ed('0x30')](function(_0x2698a3){if(_0x2698a3){return _0x2698a3[_0x14ed('0xe2')](_0x41fc94[_0x14ed('0x3e')][_0x14ed('0x67')])[_0x14ed('0x30')](function(){if(_[_0x14ed('0xe3')](_0x41fc94[_0x14ed('0x3e')]['ids'])){for(var _0x50e071=0x0;_0x50e071<_0x41fc94[_0x14ed('0x3e')][_0x14ed('0x67')][_0x14ed('0x42')];_0x50e071+=0x1){socket['emit']('userSmsAccount:remove',{'UserId':Number(_0x41fc94[_0x14ed('0x3e')]['ids'][_0x50e071]),'SmsAccountId':Number(_0x41fc94['params']['id'])});}}else{socket[_0x14ed('0xe0')](_0x14ed('0xe4'),{'UserId':Number(_0x41fc94[_0x14ed('0x3e')]['ids']),'SmsAccountId':Number(_0x41fc94[_0x14ed('0x4f')]['id'])});}});}})[_0x14ed('0x30')](respondWithStatusCode(_0x1dc261,null))['catch'](handleError(_0x1dc261,null));};exports[_0x14ed('0xe5')]=function(_0x2b05c0,_0x407655,_0x594f86){var _0x34894c={};var _0x3b7003={};var _0x36e4ed;var _0x491d66;return db[_0x14ed('0x4d')][_0x14ed('0x5f')]({'where':{'id':_0x2b05c0['params']['id']}})[_0x14ed('0x30')](handleEntityNotFound(_0x407655,null))[_0x14ed('0x30')](function(_0x51c9f9){if(_0x51c9f9){_0x36e4ed=_0x51c9f9;_0x3b7003[_0x14ed('0x3c')]=_[_0x14ed('0x3d')](db[_0x14ed('0xa6')][_0x14ed('0x39')]);_0x3b7003[_0x14ed('0x3e')]=_[_0x14ed('0x3d')](_0x2b05c0['query']);_0x3b7003[_0x14ed('0x47')]=_[_0x14ed('0x3f')](_0x3b7003[_0x14ed('0x3c')],_0x3b7003[_0x14ed('0x3e')]);_0x34894c[_0x14ed('0x40')]=_[_0x14ed('0x3f')](_0x3b7003['model'],qs['fields'](_0x2b05c0[_0x14ed('0x3e')][_0x14ed('0x41')]));_0x34894c['attributes']=_0x34894c[_0x14ed('0x40')][_0x14ed('0x42')]?_0x34894c[_0x14ed('0x40')]:_0x3b7003[_0x14ed('0x3c')];_0x34894c[_0x14ed('0x44')]=qs[_0x14ed('0x45')](_0x2b05c0['query'][_0x14ed('0x45')]);_0x34894c['where']=qs[_0x14ed('0x47')](_[_0x14ed('0x48')](_0x2b05c0[_0x14ed('0x3e')],_0x3b7003[_0x14ed('0x47')]));if(_0x2b05c0[_0x14ed('0x3e')]['filter']){_0x34894c['where']=_[_0x14ed('0x4b')](_0x34894c[_0x14ed('0x46')],{'$or':_[_0x14ed('0x38')](_0x34894c[_0x14ed('0x40')],function(_0x5609c7){var _0x257817={};_0x257817[_0x5609c7]={'$like':'%'+_0x2b05c0[_0x14ed('0x3e')][_0x14ed('0x49')]+'%'};return _0x257817;})});}_0x34894c=_[_0x14ed('0x4b')]({},_0x34894c,_0x2b05c0[_0x14ed('0x51')]);return _0x36e4ed[_0x14ed('0xe5')](_0x34894c);}})[_0x14ed('0x30')](function(_0x41365a){if(_0x41365a){_0x491d66=_0x41365a['length'];if(!_0x2b05c0[_0x14ed('0x3e')][_0x14ed('0x43')](_0x14ed('0x60'))){_0x34894c[_0x14ed('0x29')]=qs[_0x14ed('0x29')](_0x2b05c0['query'][_0x14ed('0x29')]);_0x34894c[_0x14ed('0x27')]=qs['offset'](_0x2b05c0['query'][_0x14ed('0x27')]);}return _0x36e4ed[_0x14ed('0xe5')](_0x34894c);}})[_0x14ed('0x30')](function(_0x38b7f4){if(_0x38b7f4){return _0x38b7f4?{'count':_0x491d66,'rows':_0x38b7f4}:null;}})[_0x14ed('0x30')](respondWithResult(_0x407655,null))[_0x14ed('0x23')](handleError(_0x407655,null));}; \ No newline at end of file +var _0xb234=['body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','omit','contact','SmsInteraction','spread','interaction','autoclose','push','close','unmanaged','created','SmsMessage','ContactId','AttachmentId','UserId','User','*,*,*,*','queueId','unshift','queue','waitForTheAssignedQueue','startRouting','entity\x20found','text/xml','\x0a','addApplications','sequelize','transaction','ISOLATION_LEVELS','bulkCreate','findAndCountAll','finally','getApplications','getInteractions','Contact','Owner','fullname','tag','List','DESC','out','Messages','dataValues','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','connectel','statusInt','requestid','status_code','infobip','groupName','intelepeer','redif','DELIVERED','RECEIVED_BY_RECIPIENT','bandwidth','message-delivered','DELIVRD','ACCEPTD','statusGet','message-id','state','emit','userSmsAccount:save','removeAgents','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','./smsAccount.socket','register','jayson/promise','client','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','get','SmsAccounts','UserProfileResource','sendStatus','stack','name','send','index','Pause','mandatoryDispositionPause','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','options','SmsAccount','includeAll','include','findAll','rows','params','rawAttributes','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','nolimit','filter','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','sms','SmsApplication','Applications','account','applications','orderBy','priority','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','twilio','from','From','Body','messageId','MessageSid','skebby','sender','text','clicksend','message_id','plivo','Text','MessageUUID','results','csc','originatingAddress','clickatell','fromNumber','replyMessageId','refid','from\x20is\x20mandatory','isNil'];(function(_0x6ad6c6,_0x6574fe){var _0x24a815=function(_0x2e2eb6){while(--_0x2e2eb6){_0x6ad6c6['push'](_0x6ad6c6['shift']());}};_0x24a815(++_0x6574fe);}(_0xb234,0x129));var _0x4b23=function(_0x2f948b,_0x49323c){_0x2f948b=_0x2f948b-0x0;var _0x3ae457=_0xb234[_0x2f948b];return _0x3ae457;};'use strict';var emlformat=require(_0x4b23('0x0'));var rimraf=require(_0x4b23('0x1'));var zipdir=require(_0x4b23('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4b23('0x3'));var moment=require(_0x4b23('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4b23('0x5'));var util=require(_0x4b23('0x6'));var path=require(_0x4b23('0x7'));var sox=require(_0x4b23('0x8'));var csv=require(_0x4b23('0x9'));var ejs=require(_0x4b23('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4b23('0xb'));var squel=require('squel');var crypto=require(_0x4b23('0xc'));var jsforce=require(_0x4b23('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x4b23('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4b23('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x4b23('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x4b23('0x10'))('api');var utils=require('../../config/utils');var config=require(_0x4b23('0x11'));var licenseUtil=require(_0x4b23('0x12'));var db=require(_0x4b23('0x13'))['db'];config[_0x4b23('0x14')]=_[_0x4b23('0x15')](config[_0x4b23('0x14')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x4b23('0x16'))[_0x4b23('0x17')](socket);var jayson=require(_0x4b23('0x18'));var client=jayson[_0x4b23('0x19')]['http']({'port':0x232c});function respondWithRpcPromise(_0x2fb586,_0x25716e,_0x44abea,_0x28b317){return new BPromise(function(_0x5d81d3,_0x23de4a){var _0x4d82cd=_0x28b317||client;return _0x4d82cd[_0x4b23('0x1a')](_0x2fb586,_0x44abea)[_0x4b23('0x1b')](function(_0x2539e0){logger[_0x4b23('0x1c')](_0x4b23('0x1d'),_0x25716e,_0x4b23('0x1e'));logger[_0x4b23('0x1f')](_0x4b23('0x20'),_0x25716e,_0x4b23('0x1e'),JSON[_0x4b23('0x21')](_0x2539e0));if(_0x2539e0[_0x4b23('0x22')]){if(_0x2539e0[_0x4b23('0x22')][_0x4b23('0x23')]===0x1f4){logger['error'](_0x4b23('0x1d'),_0x25716e,_0x2539e0[_0x4b23('0x22')][_0x4b23('0x24')]);return _0x23de4a(_0x2539e0[_0x4b23('0x22')][_0x4b23('0x24')]);}logger[_0x4b23('0x22')](_0x4b23('0x1d'),_0x25716e,_0x2539e0['error'][_0x4b23('0x24')]);return _0x5d81d3(_0x2539e0['error']['message']);}else{logger[_0x4b23('0x1c')](_0x4b23('0x1d'),_0x25716e,'request\x20sent');_0x5d81d3(_0x2539e0[_0x4b23('0x25')]['message']);}})[_0x4b23('0x26')](function(_0x169912){logger['error'](_0x4b23('0x1d'),_0x25716e,_0x169912);_0x23de4a(_0x169912);});});}function respondWithStatusCode(_0x512a4f,_0xec7381){_0xec7381=_0xec7381||0xcc;return function(_0x2de841){if(_0x2de841){return _0x512a4f['sendStatus'](_0xec7381);}return _0x512a4f[_0x4b23('0x27')](_0xec7381)[_0x4b23('0x28')]();};}function respondWithResult(_0x2f065d,_0x1d8ec8){_0x1d8ec8=_0x1d8ec8||0xc8;return function(_0x1de464){if(_0x1de464){return _0x2f065d[_0x4b23('0x27')](_0x1d8ec8)[_0x4b23('0x29')](_0x1de464);}};}function respondWithFilteredResult(_0x3ddb66,_0x165bd8){return function(_0x2f664a){if(_0x2f664a){var _0x36aa2d=typeof _0x165bd8[_0x4b23('0x2a')]===_0x4b23('0x2b')&&typeof _0x165bd8[_0x4b23('0x2c')]===_0x4b23('0x2b');var _0x2df17d=_0x2f664a['count'];var _0x406f6f=_0x36aa2d?0x0:_0x165bd8[_0x4b23('0x2a')];var _0x116b2a=_0x36aa2d?_0x2f664a[_0x4b23('0x2d')]:_0x165bd8[_0x4b23('0x2a')]+_0x165bd8[_0x4b23('0x2c')];var _0x462035;if(_0x116b2a>=_0x2df17d){_0x116b2a=_0x2df17d;_0x462035=0xc8;}else{_0x462035=0xce;}_0x3ddb66[_0x4b23('0x27')](_0x462035);return _0x3ddb66[_0x4b23('0x2e')](_0x4b23('0x2f'),_0x406f6f+'-'+_0x116b2a+'/'+_0x2df17d)[_0x4b23('0x29')](_0x2f664a);}return null;};}function patchUpdates(_0x4c9740){return function(_0x18e814){try{jsonpatch[_0x4b23('0x30')](_0x18e814,_0x4c9740,!![]);}catch(_0x337ad7){return BPromise['reject'](_0x337ad7);}return _0x18e814[_0x4b23('0x31')]();};}function saveUpdates(_0xd43f42,_0x5d564b){return function(_0x36a2a5){if(_0x36a2a5){return _0x36a2a5[_0x4b23('0x32')](_0xd43f42)[_0x4b23('0x1b')](function(_0x4611ba){return _0x4611ba;});}return null;};}function removeEntity(_0x140a63,_0x2d67b0){return function(_0x359f53){if(_0x359f53){return _0x359f53[_0x4b23('0x33')]()[_0x4b23('0x1b')](function(){var _0x43c052=_0x359f53[_0x4b23('0x34')]({'plain':!![]});var _0x874cc6=_0x4b23('0x35');return db[_0x4b23('0x36')][_0x4b23('0x33')]({'where':{'type':_0x874cc6,'resourceId':_0x43c052['id']}})[_0x4b23('0x1b')](function(){return _0x359f53;});})[_0x4b23('0x1b')](function(){_0x140a63[_0x4b23('0x27')](0xcc)[_0x4b23('0x28')]();});}};}function handleEntityNotFound(_0x3fe35b,_0x2ab5f1){return function(_0x289460){if(!_0x289460){_0x3fe35b[_0x4b23('0x37')](0x194);}return _0x289460;};}function handleError(_0x4cf053,_0x460a3e){_0x460a3e=_0x460a3e||0x1f4;return function(_0x1e2cd0){logger[_0x4b23('0x22')](_0x1e2cd0[_0x4b23('0x38')]);if(_0x1e2cd0[_0x4b23('0x39')]){delete _0x1e2cd0['name'];}_0x4cf053[_0x4b23('0x27')](_0x460a3e)[_0x4b23('0x3a')](_0x1e2cd0);};}exports[_0x4b23('0x3b')]=function(_0x2ea8cd,_0x2fbf90){var _0xf630e0={'include':[{'model':db[_0x4b23('0x3c')],'as':_0x4b23('0x3d')}]},_0x138e52={},_0x2c5808={'count':0x0,'rows':[]};var _0x5b9e18=_[_0x4b23('0x3e')](db['SmsAccount']['rawAttributes'],function(_0x1483ab){return{'name':_0x1483ab[_0x4b23('0x3f')],'type':_0x1483ab[_0x4b23('0x40')][_0x4b23('0x41')]};});_0x138e52[_0x4b23('0x42')]=_[_0x4b23('0x3e')](_0x5b9e18,_0x4b23('0x39'));_0x138e52[_0x4b23('0x43')]=_[_0x4b23('0x44')](_0x2ea8cd[_0x4b23('0x43')]);_0x138e52[_0x4b23('0x45')]=_[_0x4b23('0x46')](_0x138e52[_0x4b23('0x42')],_0x138e52['query']);_0xf630e0[_0x4b23('0x47')]=_[_0x4b23('0x46')](_0x138e52[_0x4b23('0x42')],qs[_0x4b23('0x48')](_0x2ea8cd[_0x4b23('0x43')][_0x4b23('0x48')]));_0xf630e0[_0x4b23('0x47')]=_0xf630e0[_0x4b23('0x47')]['length']?_0xf630e0[_0x4b23('0x47')]:_0x138e52[_0x4b23('0x42')];if(!_0x2ea8cd[_0x4b23('0x43')][_0x4b23('0x49')]('nolimit')){_0xf630e0['limit']=qs['limit'](_0x2ea8cd['query'][_0x4b23('0x2c')]);_0xf630e0[_0x4b23('0x2a')]=qs[_0x4b23('0x2a')](_0x2ea8cd[_0x4b23('0x43')][_0x4b23('0x2a')]);}_0xf630e0[_0x4b23('0x4a')]=qs[_0x4b23('0x4b')](_0x2ea8cd['query']['sort']);_0xf630e0[_0x4b23('0x4c')]=qs[_0x4b23('0x45')](_[_0x4b23('0x4d')](_0x2ea8cd[_0x4b23('0x43')],_0x138e52[_0x4b23('0x45')]),_0x5b9e18);if(_0x2ea8cd[_0x4b23('0x43')]['filter']){_0xf630e0[_0x4b23('0x4c')]=_[_0x4b23('0x4e')](_0xf630e0['where'],{'$or':_[_0x4b23('0x3e')](_0x5b9e18,function(_0x1d4896){if(_0x1d4896['type']!==_0x4b23('0x4f')){var _0x3b4887={};_0x3b4887[_0x1d4896[_0x4b23('0x39')]]={'$like':'%'+_0x2ea8cd[_0x4b23('0x43')]['filter']+'%'};return _0x3b4887;}})});}_0xf630e0=_[_0x4b23('0x4e')]({},_0xf630e0,_0x2ea8cd[_0x4b23('0x50')]);var _0x211ea0={'where':_0xf630e0['where']};return db[_0x4b23('0x51')][_0x4b23('0x2d')](_0x211ea0)['then'](function(_0x40bf00){_0x2c5808[_0x4b23('0x2d')]=_0x40bf00;if(_0x2ea8cd[_0x4b23('0x43')][_0x4b23('0x52')]){_0xf630e0[_0x4b23('0x53')]=[{'all':!![]}];}return db['SmsAccount'][_0x4b23('0x54')](_0xf630e0);})['then'](function(_0x222e7d){_0x2c5808[_0x4b23('0x55')]=_0x222e7d;return _0x2c5808;})[_0x4b23('0x1b')](respondWithFilteredResult(_0x2fbf90,_0xf630e0))[_0x4b23('0x26')](handleError(_0x2fbf90,null));};exports['show']=function(_0x14eb25,_0x41bc67){var _0x6c5f8f={'raw':![],'where':{'id':_0x14eb25[_0x4b23('0x56')]['id']},'include':[{'model':db[_0x4b23('0x3c')],'as':_0x4b23('0x3d')}]},_0x59b648={};_0x59b648[_0x4b23('0x42')]=_['keys'](db['SmsAccount'][_0x4b23('0x57')]);_0x59b648[_0x4b23('0x43')]=_['keys'](_0x14eb25[_0x4b23('0x43')]);_0x59b648[_0x4b23('0x45')]=_[_0x4b23('0x46')](_0x59b648[_0x4b23('0x42')],_0x59b648['query']);_0x6c5f8f['attributes']=_['intersection'](_0x59b648[_0x4b23('0x42')],qs[_0x4b23('0x48')](_0x14eb25[_0x4b23('0x43')][_0x4b23('0x48')]));_0x6c5f8f[_0x4b23('0x47')]=_0x6c5f8f['attributes'][_0x4b23('0x58')]?_0x6c5f8f[_0x4b23('0x47')]:_0x59b648[_0x4b23('0x42')];if(_0x14eb25[_0x4b23('0x43')][_0x4b23('0x52')]){_0x6c5f8f['include']=[{'all':!![]}];}_0x6c5f8f=_[_0x4b23('0x4e')]({},_0x6c5f8f,_0x14eb25[_0x4b23('0x50')]);return db[_0x4b23('0x51')][_0x4b23('0x59')](_0x6c5f8f)[_0x4b23('0x1b')](handleEntityNotFound(_0x41bc67,null))[_0x4b23('0x1b')](respondWithResult(_0x41bc67,null))[_0x4b23('0x26')](handleError(_0x41bc67,null));};exports[_0x4b23('0x5a')]=function(_0x49ba66,_0x25b9ad){return db[_0x4b23('0x51')][_0x4b23('0x5a')](_0x49ba66[_0x4b23('0x5b')],{})[_0x4b23('0x1b')](function(_0x1738b2){var _0xe90d=_0x49ba66[_0x4b23('0x5c')][_0x4b23('0x34')]({'plain':!![]});if(!_0xe90d)throw new Error(_0x4b23('0x5d'));if(_0xe90d[_0x4b23('0x5e')]==='user'){var _0x30308d=_0x1738b2[_0x4b23('0x34')]({'plain':!![]});var _0x1e7297=_0x4b23('0x35');return db['UserProfileSection'][_0x4b23('0x59')]({'where':{'name':_0x1e7297,'userProfileId':_0xe90d[_0x4b23('0x5f')]},'raw':!![]})[_0x4b23('0x1b')](function(_0x37d29b){if(_0x37d29b&&_0x37d29b[_0x4b23('0x60')]===0x0){return db['UserProfileResource']['create']({'name':_0x30308d[_0x4b23('0x39')],'resourceId':_0x30308d['id'],'type':_0x37d29b['name'],'sectionId':_0x37d29b['id']},{})[_0x4b23('0x1b')](function(){return _0x1738b2;});}else{return _0x1738b2;}})[_0x4b23('0x26')](function(_0x322502){logger['error'](_0x4b23('0x61'),_0x322502);throw _0x322502;});}return _0x1738b2;})[_0x4b23('0x1b')](respondWithResult(_0x25b9ad,0xc9))['catch'](handleError(_0x25b9ad,null));};exports[_0x4b23('0x32')]=function(_0xc42c1c,_0x15dfde){if(_0xc42c1c[_0x4b23('0x5b')]['id']){delete _0xc42c1c[_0x4b23('0x5b')]['id'];}return db['SmsAccount'][_0x4b23('0x59')]({'where':{'id':_0xc42c1c['params']['id']},'include':[{'model':db[_0x4b23('0x3c')],'as':_0x4b23('0x3d')}]})[_0x4b23('0x1b')](handleEntityNotFound(_0x15dfde,null))[_0x4b23('0x1b')](saveUpdates(_0xc42c1c[_0x4b23('0x5b')],null))['then'](respondWithResult(_0x15dfde,null))[_0x4b23('0x26')](handleError(_0x15dfde,null));};exports[_0x4b23('0x33')]=function(_0x16f61b,_0x455bb0){return db[_0x4b23('0x51')]['find']({'where':{'id':_0x16f61b[_0x4b23('0x56')]['id']}})[_0x4b23('0x1b')](handleEntityNotFound(_0x455bb0,null))['then'](removeEntity(_0x455bb0,null))[_0x4b23('0x26')](handleError(_0x455bb0,null));};exports[_0x4b23('0x62')]=function(_0x3d64a9,_0x15e509){return db[_0x4b23('0x51')][_0x4b23('0x62')]()[_0x4b23('0x1b')](respondWithResult(_0x15e509,null))[_0x4b23('0x26')](handleError(_0x15e509,null));};exports[_0x4b23('0x63')]=function(_0x19c31d,_0x10dc5a,_0x335db1){if(_0x19c31d['body']['id']){delete _0x19c31d[_0x4b23('0x5b')]['id'];}return db[_0x4b23('0x51')][_0x4b23('0x59')]({'where':{'id':_0x19c31d['params']['id']}})[_0x4b23('0x1b')](handleEntityNotFound(_0x10dc5a,null))['then'](function(_0x515531){if(_0x515531){_0x19c31d['body'][_0x4b23('0x64')]=_0x515531['id'];return db[_0x4b23('0x65')][_0x4b23('0x5a')](_0x19c31d[_0x4b23('0x5b')]);}})[_0x4b23('0x1b')](respondWithResult(_0x10dc5a,null))[_0x4b23('0x26')](handleError(_0x10dc5a,null));};exports[_0x4b23('0x66')]=function(_0x12a92c,_0x178f58,_0x480081){var _0x2578d7={'raw':![],'where':{}};var _0x473bd1={};var _0x41c637={'count':0x0,'rows':[]};return db['SmsAccount'][_0x4b23('0x67')]({'where':{'id':_0x12a92c[_0x4b23('0x56')]['id']}})[_0x4b23('0x1b')](handleEntityNotFound(_0x178f58,null))[_0x4b23('0x1b')](function(_0x1cd144){if(_0x1cd144){_0x473bd1['model']=_[_0x4b23('0x44')](db['Disposition']['rawAttributes']);_0x473bd1[_0x4b23('0x43')]=_[_0x4b23('0x44')](_0x12a92c[_0x4b23('0x43')]);_0x473bd1[_0x4b23('0x45')]=_[_0x4b23('0x46')](_0x473bd1[_0x4b23('0x42')],_0x473bd1[_0x4b23('0x43')]);_0x2578d7[_0x4b23('0x47')]=_[_0x4b23('0x46')](_0x473bd1['model'],qs[_0x4b23('0x48')](_0x12a92c[_0x4b23('0x43')][_0x4b23('0x48')]));_0x2578d7['attributes']=_0x2578d7['attributes']['length']?_0x2578d7[_0x4b23('0x47')]:_0x473bd1[_0x4b23('0x42')];if(!_0x12a92c['query']['hasOwnProperty'](_0x4b23('0x68'))){_0x2578d7[_0x4b23('0x2c')]=qs[_0x4b23('0x2c')](_0x12a92c['query'][_0x4b23('0x2c')]);_0x2578d7[_0x4b23('0x2a')]=qs[_0x4b23('0x2a')](_0x12a92c['query'][_0x4b23('0x2a')]);}_0x2578d7[_0x4b23('0x4a')]=qs[_0x4b23('0x4b')](_0x12a92c['query'][_0x4b23('0x4b')]);_0x2578d7[_0x4b23('0x4c')]=qs[_0x4b23('0x45')](_[_0x4b23('0x4d')](_0x12a92c[_0x4b23('0x43')],_0x473bd1['filters']));_0x2578d7[_0x4b23('0x4c')][_0x4b23('0x64')]=_0x1cd144['id'];if(_0x12a92c[_0x4b23('0x43')][_0x4b23('0x69')]){_0x2578d7[_0x4b23('0x4c')]=_[_0x4b23('0x4e')](_0x2578d7['where'],{'$or':_['map'](_0x2578d7[_0x4b23('0x47')],function(_0xbb3acc){var _0x4c9bcb={};_0x4c9bcb[_0xbb3acc]={'$like':'%'+_0x12a92c[_0x4b23('0x43')][_0x4b23('0x69')]+'%'};return _0x4c9bcb;})});}_0x2578d7=_['merge']({},_0x2578d7,_0x12a92c[_0x4b23('0x50')]);return db[_0x4b23('0x65')][_0x4b23('0x2d')]({'where':_0x2578d7[_0x4b23('0x4c')]})['then'](function(_0x1e661d){_0x41c637[_0x4b23('0x2d')]=_0x1e661d;if(_0x12a92c[_0x4b23('0x43')]['includeAll']){_0x2578d7[_0x4b23('0x53')]=[{'all':!![]}];}return db[_0x4b23('0x65')][_0x4b23('0x54')](_0x2578d7);})[_0x4b23('0x1b')](function(_0x5a1747){_0x41c637[_0x4b23('0x55')]=_0x5a1747;return _0x41c637;});}})[_0x4b23('0x1b')](respondWithFilteredResult(_0x178f58,_0x2578d7))[_0x4b23('0x26')](handleError(_0x178f58,null));};exports[_0x4b23('0x6a')]=function(_0x122165,_0x4bd25f,_0x336443){return db[_0x4b23('0x51')][_0x4b23('0x59')]({'where':{'id':_0x122165['params']['id']}})[_0x4b23('0x1b')](handleEntityNotFound(_0x4bd25f,null))[_0x4b23('0x1b')](function(_0x2060d6){if(_0x2060d6){return _0x2060d6[_0x4b23('0x6a')](_0x122165['query'][_0x4b23('0x6b')]);}})['then'](respondWithStatusCode(_0x4bd25f,null))[_0x4b23('0x26')](handleError(_0x4bd25f,null));};exports[_0x4b23('0x6c')]=function(_0x20cc87,_0x34f462,_0x3535a1){if(_0x20cc87[_0x4b23('0x5b')]['id']){delete _0x20cc87[_0x4b23('0x5b')]['id'];}return db[_0x4b23('0x51')][_0x4b23('0x59')]({'where':{'id':_0x20cc87[_0x4b23('0x56')]['id']}})['then'](handleEntityNotFound(_0x34f462,null))[_0x4b23('0x1b')](function(_0x37d14e){if(_0x37d14e){_0x20cc87[_0x4b23('0x5b')][_0x4b23('0x64')]=_0x37d14e['id'];return db[_0x4b23('0x6d')][_0x4b23('0x5a')](_0x20cc87[_0x4b23('0x5b')]);}})['then'](respondWithResult(_0x34f462,null))[_0x4b23('0x26')](handleError(_0x34f462,null));};exports[_0x4b23('0x6e')]=function(_0x4ffaec,_0x3a6c7d,_0x2691cc){var _0x17403a={'raw':![],'where':{}};var _0x2b9165={};var _0xa88a2f={'count':0x0,'rows':[]};return db['SmsAccount'][_0x4b23('0x67')]({'where':{'id':_0x4ffaec[_0x4b23('0x56')]['id']}})[_0x4b23('0x1b')](handleEntityNotFound(_0x3a6c7d,null))['then'](function(_0x4a9cfd){if(_0x4a9cfd){_0x2b9165['model']=_[_0x4b23('0x44')](db[_0x4b23('0x6d')]['rawAttributes']);_0x2b9165[_0x4b23('0x43')]=_[_0x4b23('0x44')](_0x4ffaec['query']);_0x2b9165[_0x4b23('0x45')]=_[_0x4b23('0x46')](_0x2b9165['model'],_0x2b9165['query']);_0x17403a['attributes']=_[_0x4b23('0x46')](_0x2b9165['model'],qs[_0x4b23('0x48')](_0x4ffaec['query']['fields']));_0x17403a[_0x4b23('0x47')]=_0x17403a[_0x4b23('0x47')]['length']?_0x17403a[_0x4b23('0x47')]:_0x2b9165[_0x4b23('0x42')];if(!_0x4ffaec[_0x4b23('0x43')][_0x4b23('0x49')]('nolimit')){_0x17403a['limit']=qs[_0x4b23('0x2c')](_0x4ffaec[_0x4b23('0x43')][_0x4b23('0x2c')]);_0x17403a[_0x4b23('0x2a')]=qs['offset'](_0x4ffaec[_0x4b23('0x43')][_0x4b23('0x2a')]);}_0x17403a[_0x4b23('0x4a')]=qs[_0x4b23('0x4b')](_0x4ffaec[_0x4b23('0x43')][_0x4b23('0x4b')]);_0x17403a[_0x4b23('0x4c')]=qs[_0x4b23('0x45')](_[_0x4b23('0x4d')](_0x4ffaec[_0x4b23('0x43')],_0x2b9165[_0x4b23('0x45')]));_0x17403a['where']['SmsAccountId']=_0x4a9cfd['id'];if(_0x4ffaec[_0x4b23('0x43')][_0x4b23('0x69')]){_0x17403a[_0x4b23('0x4c')]=_['merge'](_0x17403a['where'],{'$or':_['map'](_0x17403a[_0x4b23('0x47')],function(_0x5edce3){var _0x437713={};_0x437713[_0x5edce3]={'$like':'%'+_0x4ffaec['query'][_0x4b23('0x69')]+'%'};return _0x437713;})});}_0x17403a=_['merge']({},_0x17403a,_0x4ffaec[_0x4b23('0x50')]);return db['CannedAnswer']['count']({'where':_0x17403a[_0x4b23('0x4c')]})[_0x4b23('0x1b')](function(_0x43feba){_0xa88a2f[_0x4b23('0x2d')]=_0x43feba;if(_0x4ffaec[_0x4b23('0x43')][_0x4b23('0x52')]){_0x17403a[_0x4b23('0x53')]=[{'all':!![]}];}return db[_0x4b23('0x6d')]['findAll'](_0x17403a);})[_0x4b23('0x1b')](function(_0x2887c9){_0xa88a2f[_0x4b23('0x55')]=_0x2887c9;return _0xa88a2f;});}})['then'](respondWithFilteredResult(_0x3a6c7d,_0x17403a))[_0x4b23('0x26')](handleError(_0x3a6c7d,null));};exports[_0x4b23('0x6f')]=function(_0x176fae,_0x27f9b4,_0x59cc31){return db[_0x4b23('0x51')]['find']({'where':{'id':_0x176fae['params']['id']}})['then'](handleEntityNotFound(_0x27f9b4,null))['then'](function(_0x4f7744){if(_0x4f7744){return _0x4f7744[_0x4b23('0x6f')](_0x176fae['query'][_0x4b23('0x6b')]);}})['then'](respondWithStatusCode(_0x27f9b4,null))[_0x4b23('0x26')](handleError(_0x27f9b4,null));};exports['notify']=function(_0x2a5be4,_0x4f29ac,_0x3a8e85){var _0x1c9bf0={'channel':_0x4b23('0x70')};var _0xab340f=[];var _0x420b3a=[];var _0x58faaf={};return db[_0x4b23('0x51')][_0x4b23('0x59')]({'where':{'id':_0x2a5be4[_0x4b23('0x56')]['id']},'include':[{'model':db[_0x4b23('0x71')],'as':_0x4b23('0x72')}]})[_0x4b23('0x1b')](handleEntityNotFound(_0x4f29ac,null))['then'](function(_0x5895f8){_0x1c9bf0[_0x4b23('0x73')]=_0x5895f8;_0x1c9bf0[_0x4b23('0x74')]=_[_0x4b23('0x75')](_0x5895f8['Applications'],[_0x4b23('0x76')],[_0x4b23('0x77')]);if(_0x1c9bf0[_0x4b23('0x73')][_0x4b23('0x72')]){delete _0x1c9bf0['account']['Applications'];}return db[_0x4b23('0x78')][_0x4b23('0x62')]();})[_0x4b23('0x1b')](function(_0x190d26){if(!_0x190d26){throw new db[(_0x4b23('0x79'))][(_0x4b23('0x7a'))](_0x4b23('0x7b'));}_0xab340f=_[_0x4b23('0x7c')](_[_0x4b23('0x44')](_0x190d26),[_0x4b23('0x7d'),_0x4b23('0x7e')]);_0x420b3a=_[_0x4b23('0x7c')](_[_0x4b23('0x44')](_0x190d26),['createdAt',_0x4b23('0x7e'),'CompanyId',_0x4b23('0x7f')]);_0x1c9bf0[_0x4b23('0x5b')]={'mapKey':'mobile'};if(_0x1c9bf0[_0x4b23('0x73')][_0x4b23('0x40')]){switch(_0x1c9bf0[_0x4b23('0x73')][_0x4b23('0x40')]){case _0x4b23('0x80'):_0x1c9bf0['body'][_0x4b23('0x81')]=_0x2a5be4['body'][_0x4b23('0x82')];_0x1c9bf0['body'][_0x4b23('0x5b')]=_0x2a5be4[_0x4b23('0x5b')][_0x4b23('0x83')];_0x1c9bf0[_0x4b23('0x5b')][_0x4b23('0x84')]=_0x2a5be4[_0x4b23('0x5b')][_0x4b23('0x85')];break;case _0x4b23('0x86'):_0x1c9bf0[_0x4b23('0x5b')][_0x4b23('0x81')]='+'+_0x2a5be4[_0x4b23('0x5b')][_0x4b23('0x87')];_0x1c9bf0[_0x4b23('0x5b')]['body']=_0x2a5be4[_0x4b23('0x5b')][_0x4b23('0x88')];break;case'connectel':_0x1c9bf0['body']['from']=_0x2a5be4[_0x4b23('0x5b')]['from'];_0x1c9bf0[_0x4b23('0x5b')][_0x4b23('0x5b')]=_0x2a5be4['body'][_0x4b23('0x24')];break;case _0x4b23('0x89'):_0x1c9bf0[_0x4b23('0x5b')]['from']=_0x2a5be4[_0x4b23('0x5b')][_0x4b23('0x81')];_0x1c9bf0[_0x4b23('0x5b')][_0x4b23('0x5b')]=_0x2a5be4[_0x4b23('0x5b')][_0x4b23('0x5b')];_0x1c9bf0['body'][_0x4b23('0x84')]=_0x2a5be4['body'][_0x4b23('0x8a')];break;case _0x4b23('0x8b'):_0x1c9bf0['body']['from']=_0x2a5be4['body'][_0x4b23('0x82')];_0x1c9bf0[_0x4b23('0x5b')][_0x4b23('0x5b')]=_0x2a5be4['body'][_0x4b23('0x8c')];_0x1c9bf0[_0x4b23('0x5b')][_0x4b23('0x84')]=_0x2a5be4[_0x4b23('0x5b')][_0x4b23('0x8d')];break;case'infobip':_0x1c9bf0[_0x4b23('0x5b')][_0x4b23('0x81')]='+'+_0x2a5be4[_0x4b23('0x5b')][_0x4b23('0x8e')][0x0][_0x4b23('0x81')];_0x1c9bf0[_0x4b23('0x5b')][_0x4b23('0x5b')]=_0x2a5be4[_0x4b23('0x5b')][_0x4b23('0x8e')][0x0][_0x4b23('0x88')];_0x1c9bf0[_0x4b23('0x5b')][_0x4b23('0x84')]=_0x2a5be4[_0x4b23('0x5b')]['results'][0x0][_0x4b23('0x84')];break;case _0x4b23('0x8f'):_0x1c9bf0['body'][_0x4b23('0x81')]=_0x2a5be4[_0x4b23('0x5b')][_0x4b23('0x90')];_0x1c9bf0['body'][_0x4b23('0x5b')]=_0x2a5be4['body']['segmentedMessage'][_0x4b23('0x24')];break;case _0x4b23('0x91'):_0x1c9bf0['body']['from']=_0x2a5be4[_0x4b23('0x5b')][_0x4b23('0x92')];_0x1c9bf0[_0x4b23('0x5b')][_0x4b23('0x5b')]=_0x2a5be4[_0x4b23('0x5b')]['text'];_0x1c9bf0[_0x4b23('0x5b')][_0x4b23('0x84')]=_0x2a5be4['body'][_0x4b23('0x93')];break;case'bandwidth':_0x1c9bf0['body']['messageId']=_0x2a5be4[_0x4b23('0x5b')][0x0][_0x4b23('0x24')]['id'];_0x1c9bf0[_0x4b23('0x5b')][_0x4b23('0x81')]=_0x2a5be4[_0x4b23('0x5b')][0x0][_0x4b23('0x24')]['from'];_0x1c9bf0[_0x4b23('0x5b')]['body']=_0x2a5be4[_0x4b23('0x5b')][0x0]['message']['text'];break;case'intelepeer':_0x1c9bf0['body'][_0x4b23('0x81')]=_0x2a5be4[_0x4b23('0x5b')]['from'];_0x1c9bf0['body'][_0x4b23('0x5b')]=_0x2a5be4['body']['message'];_0x1c9bf0[_0x4b23('0x5b')][_0x4b23('0x84')]=_0x2a5be4['body'][_0x4b23('0x94')];break;}}if(_0x1c9bf0[_0x4b23('0x5b')]['id']){delete _0x1c9bf0[_0x4b23('0x5b')]['id'];}if(_['isNil'](_0x1c9bf0[_0x4b23('0x5b')][_0x4b23('0x81')])){throw new db[(_0x4b23('0x79'))][(_0x4b23('0x7a'))](_0x4b23('0x95'));}if(_[_0x4b23('0x96')](_0x1c9bf0[_0x4b23('0x5b')]['body'])||_0x1c9bf0['body'][_0x4b23('0x5b')]===''){throw new db[(_0x4b23('0x79'))]['ValidationError'](_0x4b23('0x97'));}if(_['isNil'](_0x1c9bf0[_0x4b23('0x5b')][_0x4b23('0x98')])){throw new db[(_0x4b23('0x79'))][(_0x4b23('0x7a'))](_0x4b23('0x99')+_0x420b3a);}if(!_['includes'](_0x420b3a,_0x1c9bf0[_0x4b23('0x5b')][_0x4b23('0x98')])){throw new db[(_0x4b23('0x79'))][(_0x4b23('0x7a'))](_0x4b23('0x9a')+_0x420b3a);}_0x58faaf[_0x1c9bf0[_0x4b23('0x5b')][_0x4b23('0x98')]]=_0x1c9bf0[_0x4b23('0x5b')][_0x4b23('0x81')];return db[_0x4b23('0x9b')][_0x4b23('0x59')]({'where':{'id':_0x1c9bf0[_0x4b23('0x73')][_0x4b23('0x7f')]},'include':[{'model':db[_0x4b23('0x78')],'as':_0x4b23('0x9c'),'where':_0x58faaf,'limit':0x1,'order':[[_0x4b23('0x7e'),'DESC']]}]});})['then'](handleEntityNotFound(_0x4f29ac,null))['then'](function(_0x484838){if(_0x484838){_0x1c9bf0['list']=_[_0x4b23('0x9d')](_0x484838,[_0x4b23('0x9c')]);if(_0x484838[_0x4b23('0x9c')]['length']){return _0x484838[_0x4b23('0x9c')][0x0];}var _0x3e2493=_['defaults'](_0x1c9bf0[_0x4b23('0x5b')],{'firstName':_0x1c9bf0[_0x4b23('0x5b')][_0x4b23('0x81')],'ListId':_0x484838['id']});_0x3e2493[_0x1c9bf0[_0x4b23('0x5b')][_0x4b23('0x98')]]=_0x1c9bf0[_0x4b23('0x5b')]['from'];return db[_0x4b23('0x78')]['create'](_0x3e2493,{'fields':_0xab340f,'raw':!![]});}})[_0x4b23('0x1b')](handleEntityNotFound(_0x4f29ac,null))[_0x4b23('0x1b')](function(_0x291f64){if(_0x291f64){_0x1c9bf0[_0x4b23('0x9e')]=_0x291f64;var _0x2a8b98={'ContactId':_0x291f64['id'],'phone':_0x1c9bf0[_0x4b23('0x5b')][_0x4b23('0x81')],'SmsAccountId':_0x2a5be4[_0x4b23('0x56')]['id']};var _0xe59041={'ContactId':_0x291f64['id'],'SmsAccountId':_0x2a5be4[_0x4b23('0x56')]['id'],'closed':![]};return db['SmsInteraction'][_0x4b23('0x59')]({'where':_0xe59041})[_0x4b23('0x1b')](function(_0x498247){if(_0x498247){return[_0x498247,![]];}return db[_0x4b23('0x9f')]['create'](_0x2a8b98)[_0x4b23('0x1b')](function(_0x54323b){return[_0x54323b,!![]];});});}})[_0x4b23('0xa0')](function(_0x133b96,_0x329bed){_0x1c9bf0[_0x4b23('0xa1')]=_0x133b96[_0x4b23('0x34')]({'plain':!![]});_0x1c9bf0[_0x4b23('0xa1')]['created']=![];if(_0x329bed){if(_0x1c9bf0[_0x4b23('0x73')][_0x4b23('0xa2')]){_0x1c9bf0[_0x4b23('0x74')][_0x4b23('0xa3')]({'id':0x0,'priority':_0x1c9bf0[_0x4b23('0x74')][_0x4b23('0x58')]+0x1,'app':_0x4b23('0xa4'),'appdata':_0x4b23('0xa5'),'interval':'*,*,*,*'});}_0x1c9bf0[_0x4b23('0xa1')][_0x4b23('0xa6')]=!![];}return db[_0x4b23('0xa7')][_0x4b23('0x5a')]({'phone':_0x1c9bf0[_0x4b23('0x5b')]['from'],'messageId':_0x1c9bf0[_0x4b23('0x5b')][_0x4b23('0x84')],'body':_0x1c9bf0[_0x4b23('0x5b')][_0x4b23('0x5b')],'SmsAccountId':_0x2a5be4['params']['id'],'SmsInteractionId':_0x133b96['id'],'direction':'in','ContactId':_0x133b96[_0x4b23('0xa8')],'AttachmentId':_0x1c9bf0[_0x4b23('0x5b')][_0x4b23('0xa9')]});})[_0x4b23('0x1b')](function(_0xce1d63){_0x1c9bf0[_0x4b23('0x24')]=_0xce1d63;if(!_0x1c9bf0[_0x4b23('0xa1')][_0x4b23('0xaa')])return;return db[_0x4b23('0xab')][_0x4b23('0x59')]({'attributes':['id',_0x4b23('0x39')],'where':{'id':_0x1c9bf0[_0x4b23('0xa1')][_0x4b23('0xaa')]}});})[_0x4b23('0x1b')](function(_0x454ba5){if(_0x454ba5){_0x1c9bf0['applications']['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x454ba5[_0x4b23('0x39')]+','+(_0x1c9bf0[_0x4b23('0x73')]['waitForTheAssignedAgent']||0xa),'interval':_0x4b23('0xac')});}if(!_0x1c9bf0[_0x4b23('0xa1')]['queueId'])return;return db['SmsQueue'][_0x4b23('0x59')]({'attributes':['id',_0x4b23('0x39')],'where':{'id':_0x1c9bf0[_0x4b23('0xa1')][_0x4b23('0xad')]}});})[_0x4b23('0x1b')](function(_0x4a3019){if(_0x4a3019){_0x1c9bf0[_0x4b23('0x74')][_0x4b23('0xae')]({'id':0x0,'priority':0x1,'app':_0x4b23('0xaf'),'appdata':_0x4a3019[_0x4b23('0x39')]+','+(_0x1c9bf0[_0x4b23('0x73')][_0x4b23('0xb0')]||0x12c),'interval':_0x4b23('0xac')});}return respondWithRpcPromise('Start',_0x4b23('0xb1'),_0x1c9bf0);})['then'](function(_0xd213bc){if(_0xd213bc){var _0x3cc9c8=0xc8;var _0x292f02='receiveMessage';logger[_0x4b23('0x1c')](_0x4b23('0x20'),_0x292f02,_0x3cc9c8,_0x4b23('0xb2'));logger[_0x4b23('0x1f')]('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x292f02,_0x3cc9c8,_0x4b23('0xb2'),JSON[_0x4b23('0x21')](_0xd213bc));if(_0x1c9bf0[_0x4b23('0x73')][_0x4b23('0x40')]===_0x4b23('0x80')){return _0x4f29ac['status'](_0x3cc9c8)[_0x4b23('0x2e')]('Content-Type',_0x4b23('0xb3'))[_0x4b23('0x3a')](_0x4b23('0xb4'));}else{return _0x4f29ac[_0x4b23('0x27')](_0x3cc9c8)['json'](_0xd213bc);}}})[_0x4b23('0x26')](handleError(_0x4f29ac,null));};exports[_0x4b23('0xb5')]=function(_0x4bfbd3,_0x6f4161){var _0x1ecde5=_0x4bfbd3[_0x4b23('0x56')]['id'];var _0xd8c929=_0x4bfbd3[_0x4b23('0x5b')];var _0x28bae1=0xc8;var _0x222a43=null;return db[_0x4b23('0xb6')][_0x4b23('0xb7')]({'isolationLevel':db[_0x4b23('0xb6')]['Transaction'][_0x4b23('0xb8')]['READ_COMMITTED']},function(_0x337f83){return db[_0x4b23('0x51')][_0x4b23('0x67')]({'where':{'id':_0x1ecde5},'transaction':_0x337f83})[_0x4b23('0x1b')](function(_0x46df47){if(_0x46df47){return db[_0x4b23('0x71')][_0x4b23('0x33')]({'where':{'SmsAccountId':_0x1ecde5},'transaction':_0x337f83})[_0x4b23('0x1b')](function(){var _0x5dd816=_['map'](_0xd8c929,function(_0x40f3d0){_0x40f3d0['SmsAccountId']=_0x1ecde5;return _0x40f3d0;});return db['SmsApplication'][_0x4b23('0xb9')](_0x5dd816,{'transaction':_0x337f83});});}else{_0x28bae1=0x194;_0x222a43=[];}});})['then'](function(){if(_0x28bae1!==0x194){return db['SmsApplication'][_0x4b23('0xba')]({'where':{'SmsAccountId':_0x1ecde5},'order':_0x4b23('0x76')})[_0x4b23('0x1b')](function(_0x4b34ba){_0x222a43=_0x4b34ba;});}})['catch'](function(_0x829e2a){_0x28bae1=0x1f4;logger[_0x4b23('0x22')](_0x829e2a[_0x4b23('0x38')]);if(_0x829e2a['name']){delete _0x829e2a[_0x4b23('0x39')];}_0x222a43=_0x829e2a;})[_0x4b23('0xbb')](function(){if(_0x222a43===null){_0x6f4161[_0x4b23('0x37')](_0x28bae1);}else{if(_0x28bae1===0x1f4){_0x6f4161[_0x4b23('0x27')](_0x28bae1)[_0x4b23('0x3a')](_0x222a43);}else{_0x6f4161['status'](_0x28bae1)[_0x4b23('0x29')](_0x222a43);}}});};exports['getApplications']=function(_0x198d06,_0x8ad11c,_0x364b4c){var _0x65601b={};var _0xfa387c={};var _0x3f2704;var _0x49b6a;return db[_0x4b23('0x51')][_0x4b23('0x67')]({'where':{'id':_0x198d06[_0x4b23('0x56')]['id']}})[_0x4b23('0x1b')](handleEntityNotFound(_0x8ad11c,null))[_0x4b23('0x1b')](function(_0x24788a){if(_0x24788a){_0x3f2704=_0x24788a;_0xfa387c[_0x4b23('0x42')]=_[_0x4b23('0x44')](db[_0x4b23('0x71')][_0x4b23('0x57')]);_0xfa387c[_0x4b23('0x43')]=_[_0x4b23('0x44')](_0x198d06[_0x4b23('0x43')]);_0xfa387c['filters']=_[_0x4b23('0x46')](_0xfa387c[_0x4b23('0x42')],_0xfa387c[_0x4b23('0x43')]);_0x65601b[_0x4b23('0x47')]=_[_0x4b23('0x46')](_0xfa387c[_0x4b23('0x42')],qs[_0x4b23('0x48')](_0x198d06['query'][_0x4b23('0x48')]));_0x65601b[_0x4b23('0x47')]=_0x65601b[_0x4b23('0x47')][_0x4b23('0x58')]?_0x65601b[_0x4b23('0x47')]:_0xfa387c[_0x4b23('0x42')];_0x65601b[_0x4b23('0x4a')]=qs['sort'](_0x198d06[_0x4b23('0x43')]['sort']);_0x65601b[_0x4b23('0x4c')]=qs[_0x4b23('0x45')](_[_0x4b23('0x4d')](_0x198d06[_0x4b23('0x43')],_0xfa387c[_0x4b23('0x45')]));if(_0x198d06[_0x4b23('0x43')][_0x4b23('0x69')]){_0x65601b[_0x4b23('0x4c')]=_['merge'](_0x65601b[_0x4b23('0x4c')],{'$or':_['map'](_0x65601b[_0x4b23('0x47')],function(_0x4ad98b){var _0x36dccc={};_0x36dccc[_0x4ad98b]={'$like':'%'+_0x198d06['query'][_0x4b23('0x69')]+'%'};return _0x36dccc;})});}_0x65601b=_[_0x4b23('0x4e')]({},_0x65601b,_0x198d06[_0x4b23('0x50')]);return _0x3f2704[_0x4b23('0xbc')](_0x65601b);}})[_0x4b23('0x1b')](function(_0x1addc7){if(_0x1addc7){_0x49b6a=_0x1addc7[_0x4b23('0x58')];if(!_0x198d06[_0x4b23('0x43')]['hasOwnProperty'](_0x4b23('0x68'))){_0x65601b[_0x4b23('0x2c')]=qs[_0x4b23('0x2c')](_0x198d06['query'][_0x4b23('0x2c')]);_0x65601b[_0x4b23('0x2a')]=qs['offset'](_0x198d06['query'][_0x4b23('0x2a')]);}return _0x3f2704['getApplications'](_0x65601b);}})[_0x4b23('0x1b')](function(_0x4337f6){if(_0x4337f6){return _0x4337f6?{'count':_0x49b6a,'rows':_0x4337f6}:null;}})['then'](respondWithResult(_0x8ad11c,null))[_0x4b23('0x26')](handleError(_0x8ad11c,null));};exports[_0x4b23('0xbd')]=function(_0x57540c,_0x9dbcf5,_0x52c49d){var _0x379b87={'raw':![],'where':{}};var _0x1ff507={};var _0xdc78ed={'count':0x0,'rows':[]};return db['SmsAccount'][_0x4b23('0x67')]({'where':{'id':_0x57540c[_0x4b23('0x56')]['id']}})[_0x4b23('0x1b')](handleEntityNotFound(_0x9dbcf5,null))[_0x4b23('0x1b')](function(_0x9534fc){if(_0x9534fc){_0x1ff507[_0x4b23('0x42')]=_[_0x4b23('0x44')](db[_0x4b23('0x9f')][_0x4b23('0x57')]);_0x1ff507['query']=_[_0x4b23('0x44')](_0x57540c['query']);_0x1ff507[_0x4b23('0x45')]=_[_0x4b23('0x46')](_0x1ff507[_0x4b23('0x42')],_0x1ff507[_0x4b23('0x43')]);_0x379b87[_0x4b23('0x47')]=_[_0x4b23('0x46')](_0x1ff507[_0x4b23('0x42')],qs['fields'](_0x57540c[_0x4b23('0x43')]['fields']));_0x379b87[_0x4b23('0x47')]=_0x379b87[_0x4b23('0x47')][_0x4b23('0x58')]?_0x379b87[_0x4b23('0x47')]:_0x1ff507['model'];if(!_0x57540c['query']['hasOwnProperty'](_0x4b23('0x68'))){_0x379b87[_0x4b23('0x2c')]=qs[_0x4b23('0x2c')](_0x57540c[_0x4b23('0x43')][_0x4b23('0x2c')]);_0x379b87[_0x4b23('0x2a')]=qs[_0x4b23('0x2a')](_0x57540c[_0x4b23('0x43')][_0x4b23('0x2a')]);}_0x379b87[_0x4b23('0x4a')]=qs[_0x4b23('0x4b')](_0x57540c['query'][_0x4b23('0x4b')]);_0x379b87['where']=qs['filters'](_[_0x4b23('0x4d')](_0x57540c[_0x4b23('0x43')],_0x1ff507['filters']));_0x379b87[_0x4b23('0x4c')][_0x4b23('0x64')]=_0x9534fc['id'];if(_0x57540c[_0x4b23('0x43')][_0x4b23('0x69')]){_0x379b87['where']=_[_0x4b23('0x4e')](_0x379b87[_0x4b23('0x4c')],{'$or':_['map'](_0x379b87[_0x4b23('0x47')],function(_0x453b3f){var _0x2cd3a1={};_0x2cd3a1[_0x453b3f]={'$like':'%'+_0x57540c[_0x4b23('0x43')][_0x4b23('0x69')]+'%'};return _0x2cd3a1;})});}_0x379b87=_[_0x4b23('0x4e')]({},_0x379b87,_0x57540c[_0x4b23('0x50')]);return db[_0x4b23('0x9f')]['count']({'where':_0x379b87[_0x4b23('0x4c')]})[_0x4b23('0x1b')](function(_0x35c942){_0xdc78ed[_0x4b23('0x2d')]=_0x35c942;if(_0x57540c[_0x4b23('0x43')][_0x4b23('0x52')]){_0x379b87[_0x4b23('0x53')]=[{'model':db['CmContact'],'as':_0x4b23('0xbe'),'required':![]},{'model':db['User'],'as':_0x4b23('0xbf'),'attributes':[_0x4b23('0x39'),_0x4b23('0xc0'),'internal'],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id','name','color'],'where':_0x57540c[_0x4b23('0x43')][_0x4b23('0xc1')]?{'id':_0x57540c[_0x4b23('0x43')]['tag']}:undefined,'required':_0x57540c[_0x4b23('0x43')][_0x4b23('0xc1')]?!![]:![]}];}return db['SmsInteraction']['findAll'](_0x379b87);})[_0x4b23('0x1b')](function(_0x4ac8b1){_0xdc78ed[_0x4b23('0x55')]=_0x4ac8b1;return _0xdc78ed;});}})['then'](respondWithFilteredResult(_0x9dbcf5,_0x379b87))[_0x4b23('0x26')](handleError(_0x9dbcf5,null));};exports[_0x4b23('0x3a')]=function(_0x3aa9fc,_0x109a72,_0x49b3b2){var _0x5d343e,_0x1ad8fe,_0x1b87e;if(_[_0x4b23('0x96')](_0x3aa9fc[_0x4b23('0x5b')][_0x4b23('0x5b')])||_0x3aa9fc[_0x4b23('0x5b')][_0x4b23('0x5b')]===''){throw new db[(_0x4b23('0x79'))][(_0x4b23('0x7a'))](_0x4b23('0x97'));}if(_[_0x4b23('0x96')](_0x3aa9fc[_0x4b23('0x5b')]['to'])){throw new db[(_0x4b23('0x79'))]['ValidationError']('to\x20is\x20mandatory');}_0x5d343e=_0x3aa9fc[_0x4b23('0x5b')]['to'];return db[_0x4b23('0x51')][_0x4b23('0x59')]({'where':{'id':_0x3aa9fc[_0x4b23('0x56')]['id']},'include':[{'model':db[_0x4b23('0x9b')],'as':_0x4b23('0xc2'),'include':[{'model':db[_0x4b23('0x78')],'as':_0x4b23('0x9c'),'where':{'mobile':_0x5d343e},'limit':0x1,'order':[[_0x4b23('0x7e'),_0x4b23('0xc3')]]}]}]})[_0x4b23('0x1b')](handleEntityNotFound(_0x109a72,null))[_0x4b23('0x1b')](function(_0x1eca83){if(_0x1eca83&&_0x1eca83[_0x4b23('0xc2')]){_0x1ad8fe=_0x1eca83[_0x4b23('0x34')]({'plain':!![]});if(_0x1ad8fe[_0x4b23('0xc2')]&&_0x1ad8fe['List'][_0x4b23('0x9c')][_0x4b23('0x58')]){return _0x1ad8fe[_0x4b23('0xc2')][_0x4b23('0x9c')][0x0];}return db[_0x4b23('0x78')][_0x4b23('0x5a')](_[_0x4b23('0x15')](_0x3aa9fc[_0x4b23('0x5b')],{'firstName':_0x5d343e,'mobile':_0x5d343e,'phone':_0x5d343e,'ListId':_0x1ad8fe['ListId']}));}})['then'](handleEntityNotFound(_0x109a72,null))['then'](function(_0x1a7095){if(_0x1a7095){_0x1b87e=_0x1a7095;return db[_0x4b23('0x9f')][_0x4b23('0x59')]({'where':{'ContactId':_0x1b87e['id'],'closed':![],'SmsAccountId':_0x1ad8fe['id']}})[_0x4b23('0x1b')](function(_0x533967){if(_0x533967){return[_0x533967,![]];}return db[_0x4b23('0x9f')][_0x4b23('0x5a')]({'UserId':_0x3aa9fc[_0x4b23('0x5c')]['id'],'ContactId':_0x1b87e['id'],'SmsAccountId':_0x1ad8fe['id'],'phone':_0x5d343e,'firstMsgDirection':_0x4b23('0xc4'),'Messages':[_[_0x4b23('0x4e')](_0x3aa9fc[_0x4b23('0x5b')],{'read':![],'body':_0x3aa9fc[_0x4b23('0x5b')]['body'],'phone':_0x5d343e,'SmsAccountId':_0x1ad8fe['id'],'UserId':_0x3aa9fc[_0x4b23('0x5c')]['id'],'ContactId':_0x1b87e['id']})]},{'include':[{'model':db[_0x4b23('0xa7')],'as':'Messages'}]})[_0x4b23('0x1b')](function(_0x14e82e){return[_0x14e82e,!![]];});});}})[_0x4b23('0xa0')](function(_0x570f4f,_0x3d3022){if(_0x3d3022){return _0x570f4f;}return db[_0x4b23('0xa7')][_0x4b23('0x5a')](_['merge'](_0x3aa9fc[_0x4b23('0x5b')],{'read':![],'body':_0x3aa9fc[_0x4b23('0x5b')][_0x4b23('0x5b')],'phone':_0x5d343e,'SmsAccountId':_0x1ad8fe['id'],'SmsInteractionId':_0x570f4f['id'],'UserId':_0x3aa9fc[_0x4b23('0x5c')]['id'],'ContactId':_0x1b87e['id']}))['then'](function(_0x106586){_0x570f4f['dataValues'][_0x4b23('0xc5')]=[];_0x570f4f[_0x4b23('0xc6')][_0x4b23('0xc5')][_0x4b23('0xa3')](_0x106586[_0x4b23('0xc6')]);return _0x570f4f;});})[_0x4b23('0x1b')](respondWithResult(_0x109a72,null))[_0x4b23('0x26')](handleError(_0x109a72,null));};exports[_0x4b23('0x27')]=function(_0x9deea9,_0x181bd3,_0x808289){if(_0x9deea9[_0x4b23('0x5b')]['id']){delete _0x9deea9[_0x4b23('0x5b')]['id'];}var _0x14c59f,_0x53f799,_0x7c1500;return db[_0x4b23('0x51')]['find']({'where':{'id':_0x9deea9['params']['id']}})['then'](handleEntityNotFound(_0x181bd3,null))[_0x4b23('0x1b')](function(_0x38f3d4){if(_0x38f3d4){_0x7c1500=_0x38f3d4;logger['debug'](_0x4b23('0x20'),_0x4b23('0x27'),_0x4b23('0xc7'),_0x38f3d4['type'],util[_0x4b23('0xc8')](_0x9deea9[_0x4b23('0x5b')],{'showHidden':![],'depth':null}));switch(_0x38f3d4[_0x4b23('0x40')]){case _0x4b23('0x86'):if(_0x9deea9['body'][_0x4b23('0xc9')]&&_0x9deea9[_0x4b23('0x5b')]['status']){_0x53f799=_0x9deea9[_0x4b23('0x5b')][_0x4b23('0x27')];return db['SmsMessage'][_0x4b23('0x59')]({'where':{'messageId':_0x9deea9[_0x4b23('0x5b')][_0x4b23('0xc9')]}});}break;case _0x4b23('0xca'):if(_0x9deea9['body']['requestid']&&_0x9deea9['body'][_0x4b23('0xcb')]){_0x53f799=_0x9deea9[_0x4b23('0x5b')]['statusInt'];return db[_0x4b23('0xa7')][_0x4b23('0x59')]({'where':{'messageId':_0x9deea9[_0x4b23('0x5b')][_0x4b23('0xcc')]}});}break;case _0x4b23('0x89'):if(_0x9deea9[_0x4b23('0x5b')]['message_id']&&_0x9deea9[_0x4b23('0x5b')][_0x4b23('0xcd')]){_0x53f799=_0x9deea9[_0x4b23('0x5b')][_0x4b23('0xcd')];return db[_0x4b23('0xa7')][_0x4b23('0x59')]({'where':{'messageId':_0x9deea9['body'][_0x4b23('0x8a')]}});}break;case _0x4b23('0xce'):var _0x5aa30d=_0x9deea9[_0x4b23('0x5b')][_0x4b23('0x8e')][0x0];if(_0x5aa30d['messageId']&&_0x5aa30d[_0x4b23('0x27')][_0x4b23('0xcf')]==='DELIVERED'){_0x53f799=_0x5aa30d[_0x4b23('0x27')][_0x4b23('0xcf')];return db[_0x4b23('0xa7')][_0x4b23('0x59')]({'where':{'messageId':_0x5aa30d[_0x4b23('0x84')]}});}break;case _0x4b23('0x91'):if(_0x9deea9[_0x4b23('0x5b')]['messageId']&&_0x9deea9[_0x4b23('0x5b')][_0x4b23('0x27')]){_0x53f799=_0x9deea9['body'][_0x4b23('0x27')];return db[_0x4b23('0xa7')][_0x4b23('0x59')]({'where':{'messageId':_0x9deea9[_0x4b23('0x5b')]['messageId']}});}break;case'bandwidth':if(_0x9deea9['body'][0x0][_0x4b23('0x24')]['id']){_0x53f799=_0x9deea9[_0x4b23('0x5b')][0x0][_0x4b23('0x40')];return db['SmsMessage'][_0x4b23('0x59')]({'where':{'messageId':_0x9deea9[_0x4b23('0x5b')][0x0][_0x4b23('0x24')]['id']}});}break;case _0x4b23('0xd0'):if(_0x9deea9[_0x4b23('0x5b')][_0x4b23('0xd1')]&&_0x9deea9[_0x4b23('0x5b')]['status']){_0x53f799=_0x9deea9['body'][_0x4b23('0x27')];return db[_0x4b23('0xa7')][_0x4b23('0x59')]({'where':{'messageId':_0x9deea9[_0x4b23('0x5b')]['redif']}});}break;}}})['then'](handleEntityNotFound(_0x181bd3,null))[_0x4b23('0x1b')](function(_0x415d6d){if(_0x415d6d){_0x14c59f=_0x415d6d;switch(_0x7c1500['type']){case _0x4b23('0x86'):if(_0x53f799===_0x4b23('0xd2')){return _0x14c59f[_0x4b23('0x32')]({'read':!![]});}else{logger['error'](_0x4b23('0x20'),_0x4b23('0x27'),'skebby',util[_0x4b23('0xc8')](_0x9deea9[_0x4b23('0x5b')],{'showHidden':![],'depth':null}));}break;case _0x4b23('0xca'):if(_0x53f799==='1'){return _0x14c59f[_0x4b23('0x32')]({'read':!![]});}else{logger[_0x4b23('0x22')](_0x4b23('0x20'),'status','skebby',util[_0x4b23('0xc8')](_0x9deea9['body'],{'showHidden':![],'depth':null}));}break;case _0x4b23('0x89'):if(!_0x9deea9['body']['error_code']&&_0x53f799>=0xc8&&_0x53f799<=0xce){return _0x14c59f[_0x4b23('0x32')]({'read':!![]});}else{logger[_0x4b23('0x22')](_0x4b23('0x20'),'status',_0x4b23('0x89'),util[_0x4b23('0xc8')](_0x9deea9[_0x4b23('0x5b')],{'showHidden':![],'depth':null}));}break;case _0x4b23('0xce'):var _0x3bdc9b=_0x9deea9[_0x4b23('0x5b')][_0x4b23('0x8e')][0x0];if(_0x3bdc9b[_0x4b23('0x27')][_0x4b23('0xcf')]===_0x4b23('0xd2')){return _0x14c59f['update']({'read':!![]});}else{logger[_0x4b23('0x22')](_0x4b23('0x20'),'status','infobip',util['inspect'](_0x9deea9[_0x4b23('0x5b')],{'showHidden':![],'depth':null}));}break;case _0x4b23('0x91'):if(_0x53f799=='DELIVERED_TO_GATEWAY'||_0x53f799==_0x4b23('0xd3')){return _0x14c59f[_0x4b23('0x32')]({'read':!![]});}else{logger['error'](_0x4b23('0x20'),_0x4b23('0x27'),_0x4b23('0x91'),util[_0x4b23('0xc8')](_0x9deea9[_0x4b23('0x5b')],{'showHidden':![],'depth':null}));}break;case _0x4b23('0xd4'):if(_0x53f799==_0x4b23('0xd5')){return _0x14c59f[_0x4b23('0x32')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x4b23('0x27'),_0x4b23('0xd4'),util[_0x4b23('0xc8')](_0x9deea9[_0x4b23('0x5b')],{'showHidden':![],'depth':null}));}break;case _0x4b23('0xd0'):if(_0x53f799===_0x4b23('0xd6')||_0x53f799===_0x4b23('0xd7')){return _0x14c59f['update']({'read':!![]});}else{logger[_0x4b23('0x22')](_0x4b23('0x20'),_0x4b23('0x27'),_0x4b23('0xd0'),util[_0x4b23('0xc8')](_0x9deea9[_0x4b23('0x5b')],{'showHidden':![],'depth':null}));}break;}return _0x14c59f;}})[_0x4b23('0x1b')](respondWithResult(_0x181bd3,null))[_0x4b23('0x26')](handleError(_0x181bd3,null));};exports[_0x4b23('0xd8')]=function(_0x4e1662,_0x398a23,_0x9e9565){var _0x1f9200,_0x10d8f0,_0x3adcca;return db[_0x4b23('0x51')][_0x4b23('0x59')]({'where':{'id':_0x4e1662[_0x4b23('0x56')]['id']}})['then'](handleEntityNotFound(_0x398a23,null))[_0x4b23('0x1b')](function(_0x3e0430){if(_0x3e0430){_0x3adcca=_0x3e0430;logger['debug'](_0x4b23('0x20'),_0x4b23('0x27'),'received\x20delivery\x20report\x20from',_0x3e0430['type'],util[_0x4b23('0xc8')](_0x4e1662[_0x4b23('0x43')],{'showHidden':![],'depth':null}));switch(_0x3e0430[_0x4b23('0x40')]){case _0x4b23('0x8f'):if(_0x4e1662[_0x4b23('0x43')][_0x4b23('0xd9')]&&_0x4e1662[_0x4b23('0x43')][_0x4b23('0xda')]){_0x10d8f0=_0x4e1662[_0x4b23('0x43')][_0x4b23('0xda')];return db[_0x4b23('0xa7')][_0x4b23('0x59')]({'where':{'messageId':_0x4e1662['query'][_0x4b23('0xd9')]}});}break;}}})[_0x4b23('0x1b')](handleEntityNotFound(_0x398a23,null))[_0x4b23('0x1b')](function(_0x1416d2){if(_0x1416d2){_0x1f9200=_0x1416d2;switch(_0x3adcca[_0x4b23('0x40')]){case _0x4b23('0x8f'):if(_0x10d8f0==='2'||_0x10d8f0==='6'){return _0x1f9200[_0x4b23('0x32')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x4b23('0x27'),'csc',util[_0x4b23('0xc8')](_0x4e1662[_0x4b23('0x43')],{'showHidden':![],'depth':null}));};break;}return _0x1f9200;}})[_0x4b23('0x1b')](respondWithResult(_0x398a23,null))[_0x4b23('0x26')](handleError(_0x398a23,null));};exports['addAgents']=function(_0x456763,_0x141379,_0x571779){return db['SmsAccount'][_0x4b23('0x59')]({'where':{'id':_0x456763[_0x4b23('0x56')]['id']}})[_0x4b23('0x1b')](handleEntityNotFound(_0x141379,null))[_0x4b23('0x1b')](function(_0xe7c4cd){if(_0xe7c4cd){return _0xe7c4cd['addAgents'](_0x456763['body'][_0x4b23('0x6b')],_[_0x4b23('0x9d')](_0x456763[_0x4b23('0x5b')],[_0x4b23('0x6b'),'id'])||{})[_0x4b23('0xa0')](function(_0xfc45eb){for(var _0x74ac8f=0x0;_0x74ac8f<_0x456763[_0x4b23('0x5b')]['ids']['length'];_0x74ac8f+=0x1){socket[_0x4b23('0xdb')](_0x4b23('0xdc'),{'UserId':Number(_0x456763[_0x4b23('0x5b')]['ids'][_0x74ac8f]),'SmsAccountId':Number(_0x456763['params']['id'])});}return _0xfc45eb;});}})[_0x4b23('0x1b')](respondWithResult(_0x141379,null))['catch'](handleError(_0x141379,null));};exports[_0x4b23('0xdd')]=function(_0x49cb0e,_0x4c0f14,_0x744060){return db['SmsAccount']['find']({'where':{'id':_0x49cb0e['params']['id']}})[_0x4b23('0x1b')](handleEntityNotFound(_0x4c0f14,null))['then'](function(_0x32808e){if(_0x32808e){return _0x32808e['removeAgents'](_0x49cb0e['query'][_0x4b23('0x6b')])[_0x4b23('0x1b')](function(){if(_['isArray'](_0x49cb0e[_0x4b23('0x43')]['ids'])){for(var _0x5aed78=0x0;_0x5aed78<_0x49cb0e[_0x4b23('0x43')][_0x4b23('0x6b')]['length'];_0x5aed78+=0x1){socket[_0x4b23('0xdb')](_0x4b23('0xde'),{'UserId':Number(_0x49cb0e['query']['ids'][_0x5aed78]),'SmsAccountId':Number(_0x49cb0e['params']['id'])});}}else{socket[_0x4b23('0xdb')](_0x4b23('0xde'),{'UserId':Number(_0x49cb0e[_0x4b23('0x43')]['ids']),'SmsAccountId':Number(_0x49cb0e[_0x4b23('0x56')]['id'])});}});}})[_0x4b23('0x1b')](respondWithStatusCode(_0x4c0f14,null))[_0x4b23('0x26')](handleError(_0x4c0f14,null));};exports[_0x4b23('0xdf')]=function(_0x230bd7,_0x4c1132,_0x214147){var _0x189641={};var _0x454f1e={};var _0x502174;var _0x457e53;return db[_0x4b23('0x51')]['findOne']({'where':{'id':_0x230bd7[_0x4b23('0x56')]['id']}})[_0x4b23('0x1b')](handleEntityNotFound(_0x4c1132,null))['then'](function(_0x2165f3){if(_0x2165f3){_0x502174=_0x2165f3;_0x454f1e[_0x4b23('0x42')]=_[_0x4b23('0x44')](db[_0x4b23('0xab')][_0x4b23('0x57')]);_0x454f1e[_0x4b23('0x43')]=_[_0x4b23('0x44')](_0x230bd7[_0x4b23('0x43')]);_0x454f1e[_0x4b23('0x45')]=_[_0x4b23('0x46')](_0x454f1e[_0x4b23('0x42')],_0x454f1e[_0x4b23('0x43')]);_0x189641[_0x4b23('0x47')]=_[_0x4b23('0x46')](_0x454f1e[_0x4b23('0x42')],qs[_0x4b23('0x48')](_0x230bd7['query'][_0x4b23('0x48')]));_0x189641[_0x4b23('0x47')]=_0x189641[_0x4b23('0x47')][_0x4b23('0x58')]?_0x189641[_0x4b23('0x47')]:_0x454f1e[_0x4b23('0x42')];_0x189641[_0x4b23('0x4a')]=qs[_0x4b23('0x4b')](_0x230bd7[_0x4b23('0x43')]['sort']);_0x189641[_0x4b23('0x4c')]=qs[_0x4b23('0x45')](_[_0x4b23('0x4d')](_0x230bd7[_0x4b23('0x43')],_0x454f1e[_0x4b23('0x45')]));if(_0x230bd7[_0x4b23('0x43')]['filter']){_0x189641[_0x4b23('0x4c')]=_[_0x4b23('0x4e')](_0x189641[_0x4b23('0x4c')],{'$or':_[_0x4b23('0x3e')](_0x189641[_0x4b23('0x47')],function(_0x14d9dd){var _0x445e9b={};_0x445e9b[_0x14d9dd]={'$like':'%'+_0x230bd7[_0x4b23('0x43')][_0x4b23('0x69')]+'%'};return _0x445e9b;})});}_0x189641=_[_0x4b23('0x4e')]({},_0x189641,_0x230bd7[_0x4b23('0x50')]);return _0x502174[_0x4b23('0xdf')](_0x189641);}})[_0x4b23('0x1b')](function(_0x462f24){if(_0x462f24){_0x457e53=_0x462f24[_0x4b23('0x58')];if(!_0x230bd7['query']['hasOwnProperty'](_0x4b23('0x68'))){_0x189641['limit']=qs[_0x4b23('0x2c')](_0x230bd7[_0x4b23('0x43')][_0x4b23('0x2c')]);_0x189641[_0x4b23('0x2a')]=qs[_0x4b23('0x2a')](_0x230bd7['query']['offset']);}return _0x502174[_0x4b23('0xdf')](_0x189641);}})[_0x4b23('0x1b')](function(_0x3b05ad){if(_0x3b05ad){return _0x3b05ad?{'count':_0x457e53,'rows':_0x3b05ad}:null;}})[_0x4b23('0x1b')](respondWithResult(_0x4c1132,null))[_0x4b23('0x26')](handleError(_0x4c1132,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 740923a..1cd0ab4 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 _0x1fec=['update','emit','hasOwnProperty','hook','exports','events','SmsAccount','setMaxListeners','save'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x1fec,0x1e2));var _0xc1fe=function(_0x341e0f,_0x4a09d0){_0x341e0f=_0x341e0f-0x0;var _0x59555a=_0x1fec[_0x341e0f];return _0x59555a;};'use strict';var EventEmitter=require(_0xc1fe('0x0'));var SmsAccount=require('../../mysqldb')['db'][_0xc1fe('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xc1fe('0x2')](0x0);var events={'afterCreate':_0xc1fe('0x3'),'afterUpdate':_0xc1fe('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2487ca){return function(_0x3b024b,_0x480dbb,_0x59555a){SmsAccountEvents[_0xc1fe('0x5')](_0x2487ca+':'+_0x3b024b['id'],_0x3b024b);SmsAccountEvents[_0xc1fe('0x5')](_0x2487ca,_0x3b024b);_0x59555a(null);};}for(var e in events){if(events[_0xc1fe('0x6')](e)){var event=events[e];SmsAccount[_0xc1fe('0x7')](e,emitEvent(event));}}module[_0xc1fe('0x8')]=SmsAccountEvents; \ No newline at end of file +var _0x048d=['update','remove','emit','hasOwnProperty','hook','exports','setMaxListeners','save'];(function(_0x281834,_0x5a69de){var _0xbeb0f4=function(_0x14bffe){while(--_0x14bffe){_0x281834['push'](_0x281834['shift']());}};_0xbeb0f4(++_0x5a69de);}(_0x048d,0xae));var _0xd048=function(_0x55e645,_0x2e8017){_0x55e645=_0x55e645-0x0;var _0x34c1c3=_0x048d[_0x55e645];return _0x34c1c3;};'use strict';var EventEmitter=require('events');var SmsAccount=require('../../mysqldb')['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xd048('0x0')](0x0);var events={'afterCreate':_0xd048('0x1'),'afterUpdate':_0xd048('0x2'),'afterDestroy':_0xd048('0x3')};function emitEvent(_0x5e6469){return function(_0xe365cc,_0x4c00ed,_0x5cf7b2){SmsAccountEvents[_0xd048('0x4')](_0x5e6469+':'+_0xe365cc['id'],_0xe365cc);SmsAccountEvents[_0xd048('0x4')](_0x5e6469,_0xe365cc);_0x5cf7b2(null);};}for(var e in events){if(events[_0xd048('0x5')](e)){var event=events[e];SmsAccount[_0xd048('0x6')](e,emitEvent(event));}}module[_0xd048('0x7')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index e7358ab..17085da 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 _0xdf70=['request-promise','./smsAccount.attributes','exports','define','lodash','util','api','moment','bluebird'];(function(_0xf36a76,_0x3967b3){var _0x414aa5=function(_0x84dc89){while(--_0x84dc89){_0xf36a76['push'](_0xf36a76['shift']());}};_0x414aa5(++_0x3967b3);}(_0xdf70,0x109));var _0x0df7=function(_0x4b962a,_0x3c7758){_0x4b962a=_0x4b962a-0x0;var _0x3fe9ef=_0xdf70[_0x4b962a];return _0x3fe9ef;};'use strict';var _=require(_0x0df7('0x0'));var util=require(_0x0df7('0x1'));var logger=require('../../config/logger')(_0x0df7('0x2'));var moment=require(_0x0df7('0x3'));var BPromise=require(_0x0df7('0x4'));var rp=require(_0x0df7('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x0df7('0x6'));module[_0x0df7('0x7')]=function(_0x11a66e,_0x41a27a){return _0x11a66e[_0x0df7('0x8')]('SmsAccount',attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x841b=['util','api','moment','request-promise','rimraf','../../config/environment','exports','define','SmsAccount','sms_accounts','lodash'];(function(_0x35fdc1,_0xbcacf8){var _0x1f8548=function(_0x24d8d9){while(--_0x24d8d9){_0x35fdc1['push'](_0x35fdc1['shift']());}};_0x1f8548(++_0xbcacf8);}(_0x841b,0xba));var _0xb841=function(_0x299ecf,_0x5e642b){_0x299ecf=_0x299ecf-0x0;var _0x4813c9=_0x841b[_0x299ecf];return _0x4813c9;};'use strict';var _=require(_0xb841('0x0'));var util=require(_0xb841('0x1'));var logger=require('../../config/logger')(_0xb841('0x2'));var moment=require(_0xb841('0x3'));var BPromise=require('bluebird');var rp=require(_0xb841('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb841('0x5'));var config=require(_0xb841('0x6'));var attributes=require('./smsAccount.attributes');module[_0xb841('0x7')]=function(_0x292c51,_0x5380db){return _0x292c51[_0xb841('0x8')](_0xb841('0x9'),attributes,{'tableName':_0xb841('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index 33aa22a..64474e0 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 _0x9d24=['SmsAccount','find','options','raw','attributes','map','include','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','redis','localhost','socket.io-emitter','./smsAccount.socket','register','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','ShowSmsAccount'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x9d24,0x139));var _0x49d2=function(_0x15d503,_0x125150){_0x15d503=_0x15d503-0x0;var _0x5ac089=_0x9d24[_0x15d503];return _0x5ac089;};'use strict';var _=require(_0x49d2('0x0'));var util=require('util');var moment=require(_0x49d2('0x1'));var BPromise=require(_0x49d2('0x2'));var rs=require(_0x49d2('0x3'));var fs=require('fs');var Redis=require(_0x49d2('0x4'));var db=require(_0x49d2('0x5'))['db'];var utils=require(_0x49d2('0x6'));var logger=require('../../config/logger')(_0x49d2('0x7'));var config=require('../../config/environment');var jayson=require(_0x49d2('0x8'));var client=jayson['client'][_0x49d2('0x9')]({'port':0x232a});config[_0x49d2('0xa')]=_['defaults'](config['redis'],{'host':_0x49d2('0xb'),'port':0x18eb});var socket=require(_0x49d2('0xc'))(new Redis(config[_0x49d2('0xa')]));require(_0x49d2('0xd'))[_0x49d2('0xe')](socket);function respondWithRpcPromise(_0x1cd3c5,_0xd902cc,_0x8fd3e5){return new BPromise(function(_0x30b17c,_0x40b59f){return client['request'](_0x1cd3c5,_0x8fd3e5)[_0x49d2('0xf')](function(_0x5919a3){logger[_0x49d2('0x10')](_0x49d2('0x11'),_0xd902cc,_0x49d2('0x12'));logger[_0x49d2('0x13')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xd902cc,_0x49d2('0x12'),JSON[_0x49d2('0x14')](_0x5919a3));if(_0x5919a3[_0x49d2('0x15')]){if(_0x5919a3[_0x49d2('0x15')][_0x49d2('0x16')]===0x1f4){logger['error'](_0x49d2('0x11'),_0xd902cc,_0x5919a3['error'][_0x49d2('0x17')]);return _0x40b59f(_0x5919a3[_0x49d2('0x15')][_0x49d2('0x17')]);}logger['error'](_0x49d2('0x11'),_0xd902cc,_0x5919a3[_0x49d2('0x15')][_0x49d2('0x17')]);return _0x30b17c(_0x5919a3[_0x49d2('0x15')][_0x49d2('0x17')]);}else{logger[_0x49d2('0x10')](_0x49d2('0x11'),_0xd902cc,'request\x20sent');_0x30b17c(_0x5919a3[_0x49d2('0x18')][_0x49d2('0x17')]);}})[_0x49d2('0x19')](function(_0x1213e4){logger['error'](_0x49d2('0x11'),_0xd902cc,_0x1213e4);_0x40b59f(_0x1213e4);});});}exports[_0x49d2('0x1a')]=function(_0x469fb3){var _0x2caf58=this;return new Promise(function(_0x59da44,_0x29b0e8){return db[_0x49d2('0x1b')][_0x49d2('0x1c')]({'raw':_0x469fb3[_0x49d2('0x1d')]?_0x469fb3[_0x49d2('0x1d')][_0x49d2('0x1e')]===undefined?!![]:![]:!![],'where':_0x469fb3['options']?_0x469fb3[_0x49d2('0x1d')]['where']||null:null,'attributes':_0x469fb3[_0x49d2('0x1d')]?_0x469fb3['options'][_0x49d2('0x1f')]||null:null,'include':_0x469fb3[_0x49d2('0x1d')]?_0x469fb3['options']['include']?_[_0x49d2('0x20')](_0x469fb3[_0x49d2('0x1d')][_0x49d2('0x21')],function(_0x36022d){return{'model':db[_0x36022d['model']],'as':_0x36022d['as'],'attributes':_0x36022d['attributes'],'include':_0x36022d[_0x49d2('0x21')]?_[_0x49d2('0x20')](_0x36022d[_0x49d2('0x21')],function(_0x49b4aa){return{'model':db[_0x49b4aa['model']],'as':_0x49b4aa['as'],'attributes':_0x49b4aa['attributes'],'include':_0x49b4aa[_0x49d2('0x21')]?_[_0x49d2('0x20')](_0x49b4aa[_0x49d2('0x21')],function(_0x5a64fc){return{'model':db[_0x5a64fc['model']],'as':_0x5a64fc['as'],'attributes':_0x5a64fc['attributes']};}):[]};}):[]};}):[]:[]})[_0x49d2('0xf')](function(_0x3389fc){logger[_0x49d2('0x10')](_0x49d2('0x1a'),_0x469fb3);logger[_0x49d2('0x13')](_0x49d2('0x1a'),_0x469fb3,JSON[_0x49d2('0x14')](_0x3389fc));_0x59da44(_0x3389fc);})[_0x49d2('0x19')](function(_0x21f988){logger['error'](_0x49d2('0x1a'),_0x21f988['message'],_0x469fb3);_0x29b0e8(_0x2caf58['error'](0x1f4,_0x21f988[_0x49d2('0x17')]));});});}; \ No newline at end of file +var _0x112c=['code','message','result','catch','ShowSmsAccount','SmsAccount','find','options','raw','where','attributes','include','map','model','stringify','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','localhost','redis','./smsAccount.socket','register','then','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','error'];(function(_0x32a554,_0x37ad7b){var _0x5ce71c=function(_0x1f670d){while(--_0x1f670d){_0x32a554['push'](_0x32a554['shift']());}};_0x5ce71c(++_0x37ad7b);}(_0x112c,0x177));var _0xc112=function(_0x37c17b,_0x4d0cff){_0x37c17b=_0x37c17b-0x0;var _0x138ca9=_0x112c[_0x37c17b];return _0x138ca9;};'use strict';var _=require(_0xc112('0x0'));var util=require(_0xc112('0x1'));var moment=require(_0xc112('0x2'));var BPromise=require('bluebird');var rs=require(_0xc112('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc112('0x4'))['db'];var utils=require(_0xc112('0x5'));var logger=require(_0xc112('0x6'))(_0xc112('0x7'));var config=require(_0xc112('0x8'));var jayson=require(_0xc112('0x9'));var client=jayson[_0xc112('0xa')][_0xc112('0xb')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0xc112('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc112('0xd')]));require(_0xc112('0xe'))[_0xc112('0xf')](socket);function respondWithRpcPromise(_0x538d90,_0x4d8855,_0x2db783){return new BPromise(function(_0x901c54,_0x3172c7){return client['request'](_0x538d90,_0x2db783)[_0xc112('0x10')](function(_0x5a689c){logger['info'](_0xc112('0x11'),_0x4d8855,_0xc112('0x12'));logger[_0xc112('0x13')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x4d8855,_0xc112('0x12'),JSON['stringify'](_0x5a689c));if(_0x5a689c[_0xc112('0x14')]){if(_0x5a689c[_0xc112('0x14')][_0xc112('0x15')]===0x1f4){logger[_0xc112('0x14')](_0xc112('0x11'),_0x4d8855,_0x5a689c[_0xc112('0x14')][_0xc112('0x16')]);return _0x3172c7(_0x5a689c[_0xc112('0x14')][_0xc112('0x16')]);}logger['error'](_0xc112('0x11'),_0x4d8855,_0x5a689c[_0xc112('0x14')][_0xc112('0x16')]);return _0x901c54(_0x5a689c[_0xc112('0x14')][_0xc112('0x16')]);}else{logger['info'](_0xc112('0x11'),_0x4d8855,_0xc112('0x12'));_0x901c54(_0x5a689c[_0xc112('0x17')][_0xc112('0x16')]);}})[_0xc112('0x18')](function(_0x36faa0){logger[_0xc112('0x14')](_0xc112('0x11'),_0x4d8855,_0x36faa0);_0x3172c7(_0x36faa0);});});}exports[_0xc112('0x19')]=function(_0x49d0c7){var _0x20023a=this;return new Promise(function(_0x43eb5e,_0x14bfbc){return db[_0xc112('0x1a')][_0xc112('0x1b')]({'raw':_0x49d0c7[_0xc112('0x1c')]?_0x49d0c7[_0xc112('0x1c')][_0xc112('0x1d')]===undefined?!![]:![]:!![],'where':_0x49d0c7[_0xc112('0x1c')]?_0x49d0c7['options'][_0xc112('0x1e')]||null:null,'attributes':_0x49d0c7[_0xc112('0x1c')]?_0x49d0c7[_0xc112('0x1c')][_0xc112('0x1f')]||null:null,'include':_0x49d0c7[_0xc112('0x1c')]?_0x49d0c7[_0xc112('0x1c')][_0xc112('0x20')]?_[_0xc112('0x21')](_0x49d0c7['options']['include'],function(_0x59a177){return{'model':db[_0x59a177[_0xc112('0x22')]],'as':_0x59a177['as'],'attributes':_0x59a177[_0xc112('0x1f')],'include':_0x59a177[_0xc112('0x20')]?_['map'](_0x59a177[_0xc112('0x20')],function(_0x207859){return{'model':db[_0x207859[_0xc112('0x22')]],'as':_0x207859['as'],'attributes':_0x207859[_0xc112('0x1f')],'include':_0x207859['include']?_['map'](_0x207859[_0xc112('0x20')],function(_0x2dd975){return{'model':db[_0x2dd975[_0xc112('0x22')]],'as':_0x2dd975['as'],'attributes':_0x2dd975['attributes']};}):[]};}):[]};}):[]:[]})[_0xc112('0x10')](function(_0x134d5e){logger['info'](_0xc112('0x19'),_0x49d0c7);logger['debug'](_0xc112('0x19'),_0x49d0c7,JSON[_0xc112('0x23')](_0x134d5e));_0x43eb5e(_0x134d5e);})[_0xc112('0x18')](function(_0x37e4ea){logger[_0xc112('0x14')](_0xc112('0x19'),_0x37e4ea[_0xc112('0x16')],_0x49d0c7);_0x14bfbc(_0x20023a[_0xc112('0x14')](0x1f4,_0x37e4ea['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index a73eb84..4595384 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(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'use strict';var SmsAccountEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){SmsAccountEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);SmsAccountEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file +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(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xa9e0[_0x5b78e8];return _0xf2c321;};'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 cdda3dc..c399d8a 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 _0xedd9=['post','create','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsApplication.controller','get','isAuthenticated','index','/:id','show'];(function(_0x3c9fa6,_0x457c18){var _0x15d44b=function(_0x276afb){while(--_0x276afb){_0x3c9fa6['push'](_0x3c9fa6['shift']());}};_0x15d44b(++_0x457c18);}(_0xedd9,0xfc));var _0x9edd=function(_0x5311d1,_0x36e532){_0x5311d1=_0x5311d1-0x0;var _0x161197=_0xedd9[_0x5311d1];return _0x161197;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');var controller=require(_0x9edd('0x8'));router[_0x9edd('0x9')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xb')]);router['get'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0xd')]);router[_0x9edd('0xe')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xf')]);router['put'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0x10')]);router[_0x9edd('0x11')]('/:id',auth[_0x9edd('0xa')](),controller[_0x9edd('0x12')]);module['exports']=router; \ No newline at end of file +var _0x34e8=['../../config/environment','./smsApplication.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x8343ba,_0x217a01){var _0x3b10ff=function(_0x3afe94){while(--_0x3afe94){_0x8343ba['push'](_0x8343ba['shift']());}};_0x3b10ff(++_0x217a01);}(_0x34e8,0x12c));var _0x834e=function(_0x150fdf,_0x224f2b){_0x150fdf=_0x150fdf-0x0;var _0x46b40a=_0x34e8[_0x150fdf];return _0x46b40a;};'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('0xf')]('/',auth[_0x834e('0xd')](),controller[_0x834e('0x10')]);router[_0x834e('0x11')](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0x12')]);router[_0x834e('0x13')](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0x14')]);module[_0x834e('0x15')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 78962bc..8685774 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 _0x6a0a=['TEXT','STRING','sequelize','INTEGER','noop'];(function(_0x979612,_0x5b7618){var _0x27f117=function(_0x5de4fd){while(--_0x5de4fd){_0x979612['push'](_0x979612['shift']());}};_0x27f117(++_0x5b7618);}(_0x6a0a,0x174));var _0xa6a0=function(_0x293e39,_0x34315f){_0x293e39=_0x293e39-0x0;var _0x118450=_0x6a0a[_0x293e39];return _0x118450;};'use strict';var Sequelize=require(_0xa6a0('0x0'));module['exports']={'priority':{'type':Sequelize[_0xa6a0('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xa6a0('0x2')},'appdata':{'type':Sequelize[_0xa6a0('0x3')]()},'description':{'type':Sequelize[_0xa6a0('0x4')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x80c7=['INTEGER','STRING','*,*,*,*','sequelize','exports'];(function(_0x17d322,_0x271d5b){var _0x182072=function(_0x2ead33){while(--_0x2ead33){_0x17d322['push'](_0x17d322['shift']());}};_0x182072(++_0x271d5b);}(_0x80c7,0x1b1));var _0x780c=function(_0x3e12b1,_0x2367a4){_0x3e12b1=_0x3e12b1-0x0;var _0x1ac0de=_0x80c7[_0x3e12b1];return _0x1ac0de;};'use strict';var Sequelize=require(_0x780c('0x0'));module[_0x780c('0x1')]={'priority':{'type':Sequelize[_0x780c('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x780c('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x780c('0x3')]},'interval':{'type':Sequelize[_0x780c('0x3')],'defaultValue':_0x780c('0x4')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 68278bb..3e61761 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 _0xfc60=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','limit','undefined','offset','Content-Range','apply','reject','save','update','destroy','then','status','end','error','stack','name','send','index','map','SmsApplication','rawAttributes','fieldName','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','count','includeAll','include','rows','catch','show','params','find','body'];(function(_0x338974,_0x225b29){var _0x2bc83a=function(_0x16b991){while(--_0x16b991){_0x338974['push'](_0x338974['shift']());}};_0x2bc83a(++_0x225b29);}(_0xfc60,0x8c));var _0x0fc6=function(_0x2a24f9,_0x33f21b){_0x2a24f9=_0x2a24f9-0x0;var _0x32edf3=_0xfc60[_0x2a24f9];return _0x32edf3;};'use strict';var emlformat=require(_0x0fc6('0x0'));var rimraf=require(_0x0fc6('0x1'));var zipdir=require(_0x0fc6('0x2'));var jsonpatch=require(_0x0fc6('0x3'));var rp=require(_0x0fc6('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x0fc6('0x5'));var util=require('util');var path=require(_0x0fc6('0x6'));var sox=require(_0x0fc6('0x7'));var csv=require('to-csv');var ejs=require(_0x0fc6('0x8'));var fs=require('fs');var fs_extra=require(_0x0fc6('0x9'));var _=require(_0x0fc6('0xa'));var squel=require(_0x0fc6('0xb'));var crypto=require(_0x0fc6('0xc'));var jsforce=require(_0x0fc6('0xd'));var deskjs=require(_0x0fc6('0xe'));var toCsv=require('to-csv');var querystring=require(_0x0fc6('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x0fc6('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x0fc6('0x11'));var hardwareService=require(_0x0fc6('0x12'));var logger=require(_0x0fc6('0x13'))(_0x0fc6('0x14'));var utils=require(_0x0fc6('0x15'));var config=require(_0x0fc6('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x0fc6('0x17'))['db'];function respondWithStatusCode(_0x3acc6e,_0x29d971){_0x29d971=_0x29d971||0xcc;return function(_0x3b3b40){if(_0x3b3b40){return _0x3acc6e[_0x0fc6('0x18')](_0x29d971);}return _0x3acc6e['status'](_0x29d971)['end']();};}function respondWithResult(_0x3d5557,_0x32632a){_0x32632a=_0x32632a||0xc8;return function(_0x128ecd){if(_0x128ecd){return _0x3d5557['status'](_0x32632a)['json'](_0x128ecd);}};}function respondWithFilteredResult(_0x5ac80e,_0x282178){return function(_0x212440){if(_0x212440){var _0x33f115=typeof _0x282178['offset']==='undefined'&&typeof _0x282178[_0x0fc6('0x19')]===_0x0fc6('0x1a');var _0x3318c7=_0x212440['count'];var _0x241b2d=_0x33f115?0x0:_0x282178[_0x0fc6('0x1b')];var _0x4e0105=_0x33f115?_0x212440['count']:_0x282178[_0x0fc6('0x1b')]+_0x282178[_0x0fc6('0x19')];var _0x226123;if(_0x4e0105>=_0x3318c7){_0x4e0105=_0x3318c7;_0x226123=0xc8;}else{_0x226123=0xce;}_0x5ac80e['status'](_0x226123);return _0x5ac80e['set'](_0x0fc6('0x1c'),_0x241b2d+'-'+_0x4e0105+'/'+_0x3318c7)['json'](_0x212440);}return null;};}function patchUpdates(_0x560c50){return function(_0x34196f){try{jsonpatch[_0x0fc6('0x1d')](_0x34196f,_0x560c50,!![]);}catch(_0x1a1f4a){return BPromise[_0x0fc6('0x1e')](_0x1a1f4a);}return _0x34196f[_0x0fc6('0x1f')]();};}function saveUpdates(_0x34adf3,_0x27939c){return function(_0x927ef1){if(_0x927ef1){return _0x927ef1[_0x0fc6('0x20')](_0x34adf3)['then'](function(_0x1eb321){return _0x1eb321;});}return null;};}function removeEntity(_0x3738a8,_0x38e3b5){return function(_0x254c83){if(_0x254c83){return _0x254c83[_0x0fc6('0x21')]()[_0x0fc6('0x22')](function(){_0x3738a8[_0x0fc6('0x23')](0xcc)[_0x0fc6('0x24')]();});}};}function handleEntityNotFound(_0x1d3c62,_0xa6ca83){return function(_0x17cfcb){if(!_0x17cfcb){_0x1d3c62['sendStatus'](0x194);}return _0x17cfcb;};}function handleError(_0x115c6f,_0x3c0aa0){_0x3c0aa0=_0x3c0aa0||0x1f4;return function(_0x1171ec){logger[_0x0fc6('0x25')](_0x1171ec[_0x0fc6('0x26')]);if(_0x1171ec[_0x0fc6('0x27')]){delete _0x1171ec[_0x0fc6('0x27')];}_0x115c6f[_0x0fc6('0x23')](_0x3c0aa0)[_0x0fc6('0x28')](_0x1171ec);};}exports[_0x0fc6('0x29')]=function(_0x10bd37,_0x15b32d){var _0x197b0f={},_0x1ac075={},_0x3354e8={'count':0x0,'rows':[]};var _0x23c223=_[_0x0fc6('0x2a')](db[_0x0fc6('0x2b')][_0x0fc6('0x2c')],function(_0x18884e){return{'name':_0x18884e[_0x0fc6('0x2d')],'type':_0x18884e['type']['key']};});_0x1ac075[_0x0fc6('0x2e')]=_[_0x0fc6('0x2a')](_0x23c223,_0x0fc6('0x27'));_0x1ac075[_0x0fc6('0x2f')]=_['keys'](_0x10bd37[_0x0fc6('0x2f')]);_0x1ac075[_0x0fc6('0x30')]=_['intersection'](_0x1ac075[_0x0fc6('0x2e')],_0x1ac075['query']);_0x197b0f[_0x0fc6('0x31')]=_['intersection'](_0x1ac075[_0x0fc6('0x2e')],qs[_0x0fc6('0x32')](_0x10bd37['query'][_0x0fc6('0x32')]));_0x197b0f[_0x0fc6('0x31')]=_0x197b0f['attributes'][_0x0fc6('0x33')]?_0x197b0f[_0x0fc6('0x31')]:_0x1ac075[_0x0fc6('0x2e')];if(!_0x10bd37[_0x0fc6('0x2f')][_0x0fc6('0x34')](_0x0fc6('0x35'))){_0x197b0f[_0x0fc6('0x19')]=qs[_0x0fc6('0x19')](_0x10bd37[_0x0fc6('0x2f')][_0x0fc6('0x19')]);_0x197b0f[_0x0fc6('0x1b')]=qs['offset'](_0x10bd37['query'][_0x0fc6('0x1b')]);}_0x197b0f[_0x0fc6('0x36')]=qs['sort'](_0x10bd37['query'][_0x0fc6('0x37')]);_0x197b0f['where']=qs['filters'](_[_0x0fc6('0x38')](_0x10bd37['query'],_0x1ac075[_0x0fc6('0x30')]),_0x23c223);if(_0x10bd37['query'][_0x0fc6('0x39')]){_0x197b0f[_0x0fc6('0x3a')]=_['merge'](_0x197b0f[_0x0fc6('0x3a')],{'$or':_[_0x0fc6('0x2a')](_0x23c223,function(_0x49b205){if(_0x49b205['type']!=='VIRTUAL'){var _0x21e6fe={};_0x21e6fe[_0x49b205[_0x0fc6('0x27')]]={'$like':'%'+_0x10bd37[_0x0fc6('0x2f')][_0x0fc6('0x39')]+'%'};return _0x21e6fe;}})});}_0x197b0f=_[_0x0fc6('0x3b')]({},_0x197b0f,_0x10bd37[_0x0fc6('0x3c')]);var _0x224bab={'where':_0x197b0f[_0x0fc6('0x3a')]};return db[_0x0fc6('0x2b')][_0x0fc6('0x3d')](_0x224bab)['then'](function(_0xf08267){_0x3354e8[_0x0fc6('0x3d')]=_0xf08267;if(_0x10bd37[_0x0fc6('0x2f')][_0x0fc6('0x3e')]){_0x197b0f[_0x0fc6('0x3f')]=[{'all':!![]}];}return db[_0x0fc6('0x2b')]['findAll'](_0x197b0f);})[_0x0fc6('0x22')](function(_0x2d7f7a){_0x3354e8[_0x0fc6('0x40')]=_0x2d7f7a;return _0x3354e8;})[_0x0fc6('0x22')](respondWithFilteredResult(_0x15b32d,_0x197b0f))[_0x0fc6('0x41')](handleError(_0x15b32d,null));};exports[_0x0fc6('0x42')]=function(_0x1ef871,_0x11da93){var _0x371030={'raw':!![],'where':{'id':_0x1ef871[_0x0fc6('0x43')]['id']}},_0x3a0ae8={};_0x3a0ae8[_0x0fc6('0x2e')]=_['keys'](db['SmsApplication'][_0x0fc6('0x2c')]);_0x3a0ae8[_0x0fc6('0x2f')]=_['keys'](_0x1ef871[_0x0fc6('0x2f')]);_0x3a0ae8[_0x0fc6('0x30')]=_['intersection'](_0x3a0ae8['model'],_0x3a0ae8[_0x0fc6('0x2f')]);_0x371030['attributes']=_['intersection'](_0x3a0ae8[_0x0fc6('0x2e')],qs[_0x0fc6('0x32')](_0x1ef871[_0x0fc6('0x2f')][_0x0fc6('0x32')]));_0x371030[_0x0fc6('0x31')]=_0x371030[_0x0fc6('0x31')]['length']?_0x371030[_0x0fc6('0x31')]:_0x3a0ae8[_0x0fc6('0x2e')];if(_0x1ef871[_0x0fc6('0x2f')][_0x0fc6('0x3e')]){_0x371030[_0x0fc6('0x3f')]=[{'all':!![]}];}_0x371030=_['merge']({},_0x371030,_0x1ef871['options']);return db[_0x0fc6('0x2b')][_0x0fc6('0x44')](_0x371030)[_0x0fc6('0x22')](handleEntityNotFound(_0x11da93,null))[_0x0fc6('0x22')](respondWithResult(_0x11da93,null))['catch'](handleError(_0x11da93,null));};exports['create']=function(_0x58833b,_0x5b0291){return db[_0x0fc6('0x2b')]['create'](_0x58833b[_0x0fc6('0x45')],{})[_0x0fc6('0x22')](respondWithResult(_0x5b0291,0xc9))[_0x0fc6('0x41')](handleError(_0x5b0291,null));};exports[_0x0fc6('0x20')]=function(_0x3149fd,_0x460927){if(_0x3149fd[_0x0fc6('0x45')]['id']){delete _0x3149fd['body']['id'];}return db[_0x0fc6('0x2b')][_0x0fc6('0x44')]({'where':{'id':_0x3149fd['params']['id']}})[_0x0fc6('0x22')](handleEntityNotFound(_0x460927,null))[_0x0fc6('0x22')](saveUpdates(_0x3149fd[_0x0fc6('0x45')],null))[_0x0fc6('0x22')](respondWithResult(_0x460927,null))[_0x0fc6('0x41')](handleError(_0x460927,null));};exports['destroy']=function(_0x2a1a40,_0x5a8b8d){return db[_0x0fc6('0x2b')][_0x0fc6('0x44')]({'where':{'id':_0x2a1a40['params']['id']}})[_0x0fc6('0x22')](handleEntityNotFound(_0x5a8b8d,null))[_0x0fc6('0x22')](removeEntity(_0x5a8b8d,null))[_0x0fc6('0x41')](handleError(_0x5a8b8d,null));}; \ No newline at end of file +var _0xe7c6=['VIRTUAL','options','includeAll','findAll','rows','catch','params','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','map','SmsApplication','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge'];(function(_0x427d3a,_0x23724c){var _0xe5c521=function(_0x77b277){while(--_0x77b277){_0x427d3a['push'](_0x427d3a['shift']());}};_0xe5c521(++_0x23724c);}(_0xe7c6,0x1ea));var _0x6e7c=function(_0x526fb9,_0x3f433a){_0x526fb9=_0x526fb9-0x0;var _0x4d1eb8=_0xe7c6[_0x526fb9];return _0x4d1eb8;};'use strict';var emlformat=require(_0x6e7c('0x0'));var rimraf=require(_0x6e7c('0x1'));var zipdir=require(_0x6e7c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6e7c('0x3'));var moment=require(_0x6e7c('0x4'));var BPromise=require(_0x6e7c('0x5'));var Mustache=require(_0x6e7c('0x6'));var util=require(_0x6e7c('0x7'));var path=require(_0x6e7c('0x8'));var sox=require(_0x6e7c('0x9'));var csv=require(_0x6e7c('0xa'));var ejs=require(_0x6e7c('0xb'));var fs=require('fs');var fs_extra=require(_0x6e7c('0xc'));var _=require(_0x6e7c('0xd'));var squel=require('squel');var crypto=require(_0x6e7c('0xe'));var jsforce=require(_0x6e7c('0xf'));var deskjs=require(_0x6e7c('0x10'));var toCsv=require(_0x6e7c('0xa'));var querystring=require(_0x6e7c('0x11'));var Papa=require(_0x6e7c('0x12'));var Redis=require(_0x6e7c('0x13'));var authService=require(_0x6e7c('0x14'));var qs=require(_0x6e7c('0x15'));var as=require(_0x6e7c('0x16'));var hardwareService=require(_0x6e7c('0x17'));var logger=require(_0x6e7c('0x18'))(_0x6e7c('0x19'));var utils=require(_0x6e7c('0x1a'));var config=require(_0x6e7c('0x1b'));var licenseUtil=require(_0x6e7c('0x1c'));var db=require(_0x6e7c('0x1d'))['db'];function respondWithStatusCode(_0x4af10f,_0x4d9c0f){_0x4d9c0f=_0x4d9c0f||0xcc;return function(_0x2f9059){if(_0x2f9059){return _0x4af10f[_0x6e7c('0x1e')](_0x4d9c0f);}return _0x4af10f[_0x6e7c('0x1f')](_0x4d9c0f)[_0x6e7c('0x20')]();};}function respondWithResult(_0x2dea32,_0x3faedc){_0x3faedc=_0x3faedc||0xc8;return function(_0x5e7998){if(_0x5e7998){return _0x2dea32[_0x6e7c('0x1f')](_0x3faedc)[_0x6e7c('0x21')](_0x5e7998);}};}function respondWithFilteredResult(_0x395ccf,_0x50244f){return function(_0x352e10){if(_0x352e10){var _0x1e684f=typeof _0x50244f[_0x6e7c('0x22')]===_0x6e7c('0x23')&&typeof _0x50244f[_0x6e7c('0x24')]===_0x6e7c('0x23');var _0x5dbe83=_0x352e10[_0x6e7c('0x25')];var _0x127d6e=_0x1e684f?0x0:_0x50244f[_0x6e7c('0x22')];var _0x429b9c=_0x1e684f?_0x352e10[_0x6e7c('0x25')]:_0x50244f['offset']+_0x50244f['limit'];var _0xd443fe;if(_0x429b9c>=_0x5dbe83){_0x429b9c=_0x5dbe83;_0xd443fe=0xc8;}else{_0xd443fe=0xce;}_0x395ccf['status'](_0xd443fe);return _0x395ccf[_0x6e7c('0x26')](_0x6e7c('0x27'),_0x127d6e+'-'+_0x429b9c+'/'+_0x5dbe83)[_0x6e7c('0x21')](_0x352e10);}return null;};}function patchUpdates(_0x2b0233){return function(_0x9ff368){try{jsonpatch[_0x6e7c('0x28')](_0x9ff368,_0x2b0233,!![]);}catch(_0x17f3c){return BPromise[_0x6e7c('0x29')](_0x17f3c);}return _0x9ff368[_0x6e7c('0x2a')]();};}function saveUpdates(_0x10872c,_0xc6657d){return function(_0x254f9c){if(_0x254f9c){return _0x254f9c[_0x6e7c('0x2b')](_0x10872c)[_0x6e7c('0x2c')](function(_0xc46f37){return _0xc46f37;});}return null;};}function removeEntity(_0x1715ad,_0x203ff1){return function(_0x1a3f2c){if(_0x1a3f2c){return _0x1a3f2c[_0x6e7c('0x2d')]()[_0x6e7c('0x2c')](function(){_0x1715ad[_0x6e7c('0x1f')](0xcc)[_0x6e7c('0x20')]();});}};}function handleEntityNotFound(_0x2830eb,_0x569757){return function(_0x309275){if(!_0x309275){_0x2830eb[_0x6e7c('0x1e')](0x194);}return _0x309275;};}function handleError(_0x388f0e,_0x2c474b){_0x2c474b=_0x2c474b||0x1f4;return function(_0x5008db){logger[_0x6e7c('0x2e')](_0x5008db[_0x6e7c('0x2f')]);if(_0x5008db[_0x6e7c('0x30')]){delete _0x5008db['name'];}_0x388f0e['status'](_0x2c474b)['send'](_0x5008db);};}exports['index']=function(_0x4fb96a,_0x135f51){var _0x2819af={},_0x3cc12a={},_0x387449={'count':0x0,'rows':[]};var _0x53c2fe=_[_0x6e7c('0x31')](db[_0x6e7c('0x32')][_0x6e7c('0x33')],function(_0x4cfdd4){return{'name':_0x4cfdd4[_0x6e7c('0x34')],'type':_0x4cfdd4[_0x6e7c('0x35')][_0x6e7c('0x36')]};});_0x3cc12a[_0x6e7c('0x37')]=_['map'](_0x53c2fe,_0x6e7c('0x30'));_0x3cc12a[_0x6e7c('0x38')]=_[_0x6e7c('0x39')](_0x4fb96a[_0x6e7c('0x38')]);_0x3cc12a[_0x6e7c('0x3a')]=_[_0x6e7c('0x3b')](_0x3cc12a[_0x6e7c('0x37')],_0x3cc12a[_0x6e7c('0x38')]);_0x2819af[_0x6e7c('0x3c')]=_['intersection'](_0x3cc12a[_0x6e7c('0x37')],qs[_0x6e7c('0x3d')](_0x4fb96a[_0x6e7c('0x38')][_0x6e7c('0x3d')]));_0x2819af[_0x6e7c('0x3c')]=_0x2819af[_0x6e7c('0x3c')][_0x6e7c('0x3e')]?_0x2819af[_0x6e7c('0x3c')]:_0x3cc12a[_0x6e7c('0x37')];if(!_0x4fb96a[_0x6e7c('0x38')][_0x6e7c('0x3f')](_0x6e7c('0x40'))){_0x2819af[_0x6e7c('0x24')]=qs[_0x6e7c('0x24')](_0x4fb96a[_0x6e7c('0x38')][_0x6e7c('0x24')]);_0x2819af[_0x6e7c('0x22')]=qs[_0x6e7c('0x22')](_0x4fb96a[_0x6e7c('0x38')][_0x6e7c('0x22')]);}_0x2819af['order']=qs['sort'](_0x4fb96a['query'][_0x6e7c('0x41')]);_0x2819af[_0x6e7c('0x42')]=qs[_0x6e7c('0x3a')](_[_0x6e7c('0x43')](_0x4fb96a[_0x6e7c('0x38')],_0x3cc12a[_0x6e7c('0x3a')]),_0x53c2fe);if(_0x4fb96a['query'][_0x6e7c('0x44')]){_0x2819af[_0x6e7c('0x42')]=_[_0x6e7c('0x45')](_0x2819af['where'],{'$or':_['map'](_0x53c2fe,function(_0x3592de){if(_0x3592de[_0x6e7c('0x35')]!==_0x6e7c('0x46')){var _0x25e516={};_0x25e516[_0x3592de[_0x6e7c('0x30')]]={'$like':'%'+_0x4fb96a[_0x6e7c('0x38')][_0x6e7c('0x44')]+'%'};return _0x25e516;}})});}_0x2819af=_[_0x6e7c('0x45')]({},_0x2819af,_0x4fb96a[_0x6e7c('0x47')]);var _0x35daac={'where':_0x2819af[_0x6e7c('0x42')]};return db[_0x6e7c('0x32')]['count'](_0x35daac)[_0x6e7c('0x2c')](function(_0x174286){_0x387449['count']=_0x174286;if(_0x4fb96a['query'][_0x6e7c('0x48')]){_0x2819af['include']=[{'all':!![]}];}return db[_0x6e7c('0x32')][_0x6e7c('0x49')](_0x2819af);})['then'](function(_0xadd908){_0x387449[_0x6e7c('0x4a')]=_0xadd908;return _0x387449;})[_0x6e7c('0x2c')](respondWithFilteredResult(_0x135f51,_0x2819af))[_0x6e7c('0x4b')](handleError(_0x135f51,null));};exports['show']=function(_0x2e3994,_0x1b273e){var _0x259cc8={'raw':!![],'where':{'id':_0x2e3994[_0x6e7c('0x4c')]['id']}},_0x5b930e={};_0x5b930e[_0x6e7c('0x37')]=_['keys'](db[_0x6e7c('0x32')][_0x6e7c('0x33')]);_0x5b930e[_0x6e7c('0x38')]=_[_0x6e7c('0x39')](_0x2e3994[_0x6e7c('0x38')]);_0x5b930e[_0x6e7c('0x3a')]=_[_0x6e7c('0x3b')](_0x5b930e[_0x6e7c('0x37')],_0x5b930e[_0x6e7c('0x38')]);_0x259cc8[_0x6e7c('0x3c')]=_['intersection'](_0x5b930e['model'],qs[_0x6e7c('0x3d')](_0x2e3994[_0x6e7c('0x38')]['fields']));_0x259cc8[_0x6e7c('0x3c')]=_0x259cc8[_0x6e7c('0x3c')][_0x6e7c('0x3e')]?_0x259cc8['attributes']:_0x5b930e[_0x6e7c('0x37')];if(_0x2e3994[_0x6e7c('0x38')][_0x6e7c('0x48')]){_0x259cc8['include']=[{'all':!![]}];}_0x259cc8=_[_0x6e7c('0x45')]({},_0x259cc8,_0x2e3994[_0x6e7c('0x47')]);return db['SmsApplication'][_0x6e7c('0x4d')](_0x259cc8)[_0x6e7c('0x2c')](handleEntityNotFound(_0x1b273e,null))['then'](respondWithResult(_0x1b273e,null))[_0x6e7c('0x4b')](handleError(_0x1b273e,null));};exports[_0x6e7c('0x4e')]=function(_0x52b393,_0x42edef){return db[_0x6e7c('0x32')][_0x6e7c('0x4e')](_0x52b393[_0x6e7c('0x4f')],{})[_0x6e7c('0x2c')](respondWithResult(_0x42edef,0xc9))[_0x6e7c('0x4b')](handleError(_0x42edef,null));};exports['update']=function(_0x209c81,_0x398209){if(_0x209c81[_0x6e7c('0x4f')]['id']){delete _0x209c81[_0x6e7c('0x4f')]['id'];}return db[_0x6e7c('0x32')][_0x6e7c('0x4d')]({'where':{'id':_0x209c81[_0x6e7c('0x4c')]['id']}})[_0x6e7c('0x2c')](handleEntityNotFound(_0x398209,null))[_0x6e7c('0x2c')](saveUpdates(_0x209c81[_0x6e7c('0x4f')],null))[_0x6e7c('0x2c')](respondWithResult(_0x398209,null))[_0x6e7c('0x4b')](handleError(_0x398209,null));};exports[_0x6e7c('0x2d')]=function(_0x1859fb,_0x4f2a20){return db[_0x6e7c('0x32')][_0x6e7c('0x4d')]({'where':{'id':_0x1859fb['params']['id']}})[_0x6e7c('0x2c')](handleEntityNotFound(_0x4f2a20,null))[_0x6e7c('0x2c')](removeEntity(_0x4f2a20,null))[_0x6e7c('0x4b')](handleError(_0x4f2a20,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 4da8b08..ef1a3e5 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 _0x7aee=['utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsApplication.attributes','exports','define','SmsApplication','sms_applications','utf8mb4'];(function(_0x4179e2,_0xf2dbb){var _0x24cb50=function(_0x3b7899){while(--_0x3b7899){_0x4179e2['push'](_0x4179e2['shift']());}};_0x24cb50(++_0xf2dbb);}(_0x7aee,0x1c3));var _0xe7ae=function(_0x44e8d8,_0x38f2eb){_0x44e8d8=_0x44e8d8-0x0;var _0x220193=_0x7aee[_0x44e8d8];return _0x220193;};'use strict';var _=require(_0xe7ae('0x0'));var util=require('util');var logger=require(_0xe7ae('0x1'))(_0xe7ae('0x2'));var moment=require(_0xe7ae('0x3'));var BPromise=require(_0xe7ae('0x4'));var rp=require(_0xe7ae('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe7ae('0x6'));var config=require(_0xe7ae('0x7'));var attributes=require(_0xe7ae('0x8'));module[_0xe7ae('0x9')]=function(_0x1d658a,_0x5c4173){return _0x1d658a[_0xe7ae('0xa')](_0xe7ae('0xb'),attributes,{'tableName':_0xe7ae('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe7ae('0xd'),'collate':_0xe7ae('0xe')});}; \ No newline at end of file +var _0xdbad=['api','moment','request-promise','path','./smsApplication.attributes','exports','define','SmsApplication','sms_applications','lodash','util','../../config/logger'];(function(_0x537e73,_0x36dbe7){var _0x43c134=function(_0x34575f){while(--_0x34575f){_0x537e73['push'](_0x537e73['shift']());}};_0x43c134(++_0x36dbe7);}(_0xdbad,0x8d));var _0xddba=function(_0x5ef56f,_0x313b19){_0x5ef56f=_0x5ef56f-0x0;var _0x4fe05d=_0xdbad[_0x5ef56f];return _0x4fe05d;};'use strict';var _=require(_0xddba('0x0'));var util=require(_0xddba('0x1'));var logger=require(_0xddba('0x2'))(_0xddba('0x3'));var moment=require(_0xddba('0x4'));var BPromise=require('bluebird');var rp=require(_0xddba('0x5'));var fs=require('fs');var path=require(_0xddba('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xddba('0x7'));module[_0xddba('0x8')]=function(_0x52d9da,_0x4140c8){return _0x52d9da[_0xddba('0x9')](_0xddba('0xa'),attributes,{'tableName':_0xddba('0xb'),'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 390edbb..9dd2d91 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 _0x3ef7=['catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x3a34c2,_0x3fb737){var _0x58cdef=function(_0x3336d1){while(--_0x3336d1){_0x3a34c2['push'](_0x3a34c2['shift']());}};_0x58cdef(++_0x3fb737);}(_0x3ef7,0xa2));var _0x73ef=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3ef7[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x73ef('0x0'));var util=require('util');var moment=require(_0x73ef('0x1'));var BPromise=require(_0x73ef('0x2'));var rs=require(_0x73ef('0x3'));var fs=require('fs');var Redis=require(_0x73ef('0x4'));var db=require(_0x73ef('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x73ef('0x6'))(_0x73ef('0x7'));var config=require(_0x73ef('0x8'));var jayson=require(_0x73ef('0x9'));var client=jayson['client'][_0x73ef('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x137f35,_0x1bc285,_0x1b2802){return new BPromise(function(_0xe938e1,_0x4cd5ce){return client[_0x73ef('0xb')](_0x137f35,_0x1b2802)[_0x73ef('0xc')](function(_0x50098a){logger[_0x73ef('0xd')](_0x73ef('0xe'),_0x1bc285,_0x73ef('0xf'));logger[_0x73ef('0x10')](_0x73ef('0x11'),_0x1bc285,'request\x20sent',JSON[_0x73ef('0x12')](_0x50098a));if(_0x50098a[_0x73ef('0x13')]){if(_0x50098a[_0x73ef('0x13')][_0x73ef('0x14')]===0x1f4){logger[_0x73ef('0x13')](_0x73ef('0xe'),_0x1bc285,_0x50098a[_0x73ef('0x13')][_0x73ef('0x15')]);return _0x4cd5ce(_0x50098a[_0x73ef('0x13')][_0x73ef('0x15')]);}logger[_0x73ef('0x13')](_0x73ef('0xe'),_0x1bc285,_0x50098a[_0x73ef('0x13')]['message']);return _0xe938e1(_0x50098a[_0x73ef('0x13')]['message']);}else{logger[_0x73ef('0xd')](_0x73ef('0xe'),_0x1bc285,_0x73ef('0xf'));_0xe938e1(_0x50098a['result'][_0x73ef('0x15')]);}})[_0x73ef('0x16')](function(_0x4bccf6){logger[_0x73ef('0x13')](_0x73ef('0xe'),_0x1bc285,_0x4bccf6);_0x4cd5ce(_0x4bccf6);});});} \ No newline at end of file +var _0x6e1c=['rpc','../../config/environment','jayson/promise','client','http','request','info','SmsApplication,\x20%s,\x20%s','SmsApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x582076,_0x61857f){var _0x3558ad=function(_0x3a47e7){while(--_0x3a47e7){_0x582076['push'](_0x582076['shift']());}};_0x3558ad(++_0x61857f);}(_0x6e1c,0xb6));var _0xc6e1=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6e1c[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xc6e1('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc6e1('0x1'));var rs=require(_0xc6e1('0x2'));var fs=require('fs');var Redis=require(_0xc6e1('0x3'));var db=require(_0xc6e1('0x4'))['db'];var utils=require(_0xc6e1('0x5'));var logger=require(_0xc6e1('0x6'))(_0xc6e1('0x7'));var config=require(_0xc6e1('0x8'));var jayson=require(_0xc6e1('0x9'));var client=jayson[_0xc6e1('0xa')][_0xc6e1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5247f1,_0x3ff10c,_0x1242d5){return new BPromise(function(_0x39000a,_0x2ffee0){return client[_0xc6e1('0xc')](_0x5247f1,_0x1242d5)['then'](function(_0xa29af9){logger[_0xc6e1('0xd')](_0xc6e1('0xe'),_0x3ff10c,'request\x20sent');logger['debug'](_0xc6e1('0xf'),_0x3ff10c,_0xc6e1('0x10'),JSON['stringify'](_0xa29af9));if(_0xa29af9[_0xc6e1('0x11')]){if(_0xa29af9[_0xc6e1('0x11')][_0xc6e1('0x12')]===0x1f4){logger[_0xc6e1('0x11')](_0xc6e1('0xe'),_0x3ff10c,_0xa29af9[_0xc6e1('0x11')]['message']);return _0x2ffee0(_0xa29af9[_0xc6e1('0x11')][_0xc6e1('0x13')]);}logger[_0xc6e1('0x11')](_0xc6e1('0xe'),_0x3ff10c,_0xa29af9[_0xc6e1('0x11')]['message']);return _0x39000a(_0xa29af9['error'][_0xc6e1('0x13')]);}else{logger[_0xc6e1('0xd')]('SmsApplication,\x20%s,\x20%s',_0x3ff10c,_0xc6e1('0x10'));_0x39000a(_0xa29af9[_0xc6e1('0x14')][_0xc6e1('0x13')]);}})['catch'](function(_0x44ef6c){logger[_0xc6e1('0x11')](_0xc6e1('0xe'),_0x3ff10c,_0x44ef6c);_0x2ffee0(_0x44ef6c);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 94579b3..0b0f185 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 _0xb7e7=['download','post','create','addMessage','/:id/tags','sms','smsinteraction:addtags','addTags','put','smsinteraction:update','update','delete','tracked','smsinteraction:destroy','destroy','removeTags','exports','multer','path','express','fs-extra','../../components/interaction/service','../../config/environment','./smsInteraction.controller','index','get','/describe','describe','/:id','isAuthenticated','show','/:id/messages','getMessages','/:id/download'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xb7e7,0x121));var _0x7b7e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xb7e7[_0x376b45];return _0x2341b3;};'use strict';var multer=require(_0x7b7e('0x0'));var util=require('util');var path=require(_0x7b7e('0x1'));var timeout=require('connect-timeout');var express=require(_0x7b7e('0x2'));var router=express['Router']();var fs_extra=require(_0x7b7e('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var controller=require(_0x7b7e('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x7b7e('0x7')]);router[_0x7b7e('0x8')](_0x7b7e('0x9'),auth['isAuthenticated'](),controller[_0x7b7e('0xa')]);router[_0x7b7e('0x8')](_0x7b7e('0xb'),auth[_0x7b7e('0xc')](),controller[_0x7b7e('0xd')]);router[_0x7b7e('0x8')](_0x7b7e('0xe'),auth['isAuthenticated'](),controller[_0x7b7e('0xf')]);router[_0x7b7e('0x8')](_0x7b7e('0x10'),auth[_0x7b7e('0xc')](),controller[_0x7b7e('0x11')]);router[_0x7b7e('0x12')]('/',auth[_0x7b7e('0xc')](),controller[_0x7b7e('0x13')]);router[_0x7b7e('0x12')]('/:id/messages',auth[_0x7b7e('0xc')](),controller[_0x7b7e('0x14')]);router['post'](_0x7b7e('0x15'),auth['isAuthenticated'](),interaction['tracked'](_0x7b7e('0x16'),_0x7b7e('0x17')),controller[_0x7b7e('0x18')]);router[_0x7b7e('0x19')](_0x7b7e('0xb'),auth['isAuthenticated'](),interaction['tracked'](_0x7b7e('0x16'),_0x7b7e('0x1a')),controller[_0x7b7e('0x1b')]);router[_0x7b7e('0x1c')](_0x7b7e('0xb'),auth[_0x7b7e('0xc')](),interaction[_0x7b7e('0x1d')](_0x7b7e('0x16'),_0x7b7e('0x1e')),controller[_0x7b7e('0x1f')]);router[_0x7b7e('0x1c')](_0x7b7e('0x15'),auth[_0x7b7e('0xc')](),controller[_0x7b7e('0x20')]);module[_0x7b7e('0x21')]=router; \ No newline at end of file +var _0x5c00=['smsinteraction:addtags','addTags','/:id','smsinteraction:update','update','delete','smsinteraction:destroy','destroy','removeTags','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','show','/:id/messages','getMessages','post','create','addMessage','/:id/tags','tracked','sms'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x5c00,0x17e));var _0x05c0=function(_0x4361c1,_0x175703){_0x4361c1=_0x4361c1-0x0;var _0x7d47bd=_0x5c00[_0x4361c1];return _0x7d47bd;};'use strict';var multer=require(_0x05c0('0x0'));var util=require(_0x05c0('0x1'));var path=require(_0x05c0('0x2'));var timeout=require('connect-timeout');var express=require(_0x05c0('0x3'));var router=express['Router']();var fs_extra=require(_0x05c0('0x4'));var auth=require(_0x05c0('0x5'));var interaction=require(_0x05c0('0x6'));var config=require(_0x05c0('0x7'));var controller=require('./smsInteraction.controller');router[_0x05c0('0x8')]('/',auth[_0x05c0('0x9')](),controller[_0x05c0('0xa')]);router[_0x05c0('0x8')]('/describe',auth[_0x05c0('0x9')](),controller[_0x05c0('0xb')]);router[_0x05c0('0x8')]('/:id',auth[_0x05c0('0x9')](),controller[_0x05c0('0xc')]);router[_0x05c0('0x8')](_0x05c0('0xd'),auth[_0x05c0('0x9')](),controller[_0x05c0('0xe')]);router['get']('/:id/download',auth[_0x05c0('0x9')](),controller['download']);router[_0x05c0('0xf')]('/',auth[_0x05c0('0x9')](),controller[_0x05c0('0x10')]);router['post'](_0x05c0('0xd'),auth['isAuthenticated'](),controller[_0x05c0('0x11')]);router[_0x05c0('0xf')](_0x05c0('0x12'),auth[_0x05c0('0x9')](),interaction[_0x05c0('0x13')](_0x05c0('0x14'),_0x05c0('0x15')),controller[_0x05c0('0x16')]);router['put'](_0x05c0('0x17'),auth[_0x05c0('0x9')](),interaction[_0x05c0('0x13')](_0x05c0('0x14'),_0x05c0('0x18')),controller[_0x05c0('0x19')]);router[_0x05c0('0x1a')](_0x05c0('0x17'),auth[_0x05c0('0x9')](),interaction['tracked'](_0x05c0('0x14'),_0x05c0('0x1b')),controller[_0x05c0('0x1c')]);router['delete'](_0x05c0('0x12'),auth[_0x05c0('0x9')](),controller[_0x05c0('0x1d')]);module[_0x05c0('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 597e65f..82e5549 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 _0x110f=['STRING','ENUM','out','DATE','BOOLEAN','INTEGER','sequelize','moment'];(function(_0x4c506e,_0x81d98d){var _0x42a808=function(_0x55313c){while(--_0x55313c){_0x4c506e['push'](_0x4c506e['shift']());}};_0x42a808(++_0x81d98d);}(_0x110f,0x1e6));var _0xf110=function(_0x5aa14d,_0x13f3ed){_0x5aa14d=_0x5aa14d-0x0;var _0x4a3297=_0x110f[_0x5aa14d];return _0x4a3297;};'use strict';var Sequelize=require(_0xf110('0x0'));var moment=require(_0xf110('0x1'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xf110('0x2')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xf110('0x2')]},'note':{'type':Sequelize[_0xf110('0x2')]},'phone':{'type':Sequelize[_0xf110('0x2')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xf110('0x3')]('in',_0xf110('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xf110('0x5')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xf110('0x4')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xf110('0x6')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xf110('0x7')]}}; \ No newline at end of file +var _0xdbc6=['exports','DATE','STRING','ENUM','out','BOOLEAN','INTEGER'];(function(_0x388f52,_0x4c652c){var _0x121252=function(_0x5936ff){while(--_0x5936ff){_0x388f52['push'](_0x388f52['shift']());}};_0x121252(++_0x4c652c);}(_0xdbc6,0x13b));var _0x6dbc=function(_0x348ded,_0x3d0e22){_0x348ded=_0x348ded-0x0;var _0x2d652e=_0xdbc6[_0x348ded];return _0x2d652e;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x6dbc('0x0')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x6dbc('0x1')]},'disposition':{'type':Sequelize[_0x6dbc('0x2')]},'secondDisposition':{'type':Sequelize[_0x6dbc('0x2')]},'thirdDisposition':{'type':Sequelize[_0x6dbc('0x2')]},'note':{'type':Sequelize[_0x6dbc('0x2')]},'phone':{'type':Sequelize[_0x6dbc('0x2')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x6dbc('0x3')]('in',_0x6dbc('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x6dbc('0x3')]('in',_0x6dbc('0x4')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x6dbc('0x5')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x6dbc('0x6')]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index a20c73f..82ce702 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 _0xfd62=['ids','omit','getMessages','findOne','length','nolimit','order','sort','where','pick','filter','$gte','addTags','Tag','color','emit','smsInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','tmp','format','transcript-%d-%s.zip','User','push','Contact','lastName','direction','secret','read','SmsAccount','Owner','fullname','get','mkdirSync','Sms','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','disposition','Messages','createdAt','out','firstName','value','renderFile','.pdf','createPdfFromHTML','log','err','unlinkSync','rimraf','zip-dir','util','path','ejs','lodash','ioredis','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','redis','localhost','socket.io-emitter','sendStatus','status','undefined','limit','count','offset','set','Content-Range','update','destroy','then','name','send','index','map','rawAttributes','key','findAll','sms','query','user','catch','show','model','keys','SmsInteraction','filters','intersection','fields','attributes','includeAll','include','merge','options','find','create','body','params','describe','addMessage','SmsMessage'];(function(_0x12f688,_0x585c25){var _0x59c3de=function(_0x4ac301){while(--_0x4ac301){_0x12f688['push'](_0x12f688['shift']());}};_0x59c3de(++_0x585c25);}(_0xfd62,0xaa));var _0x2fd6=function(_0xd8906c,_0x256420){_0xd8906c=_0xd8906c-0x0;var _0x4c49cb=_0xfd62[_0xd8906c];return _0x4c49cb;};'use strict';var rimraf=require(_0x2fd6('0x0'));var zipdir=require(_0x2fd6('0x1'));var moment=require('moment');var BPromise=require('bluebird');var util=require(_0x2fd6('0x2'));var path=require(_0x2fd6('0x3'));var ejs=require(_0x2fd6('0x4'));var fs=require('fs');var _=require(_0x2fd6('0x5'));var Redis=require(_0x2fd6('0x6'));var interaction=require('../../components/interaction/service');var qs=require(_0x2fd6('0x7'));var pdf=require(_0x2fd6('0x8'));var logger=require(_0x2fd6('0x9'))(_0x2fd6('0xa'));var config=require(_0x2fd6('0xb'));var db=require('../../mysqldb')['db'];config[_0x2fd6('0xc')]=_['defaults'](config[_0x2fd6('0xc')],{'host':_0x2fd6('0xd'),'port':0x18eb});var socket=require(_0x2fd6('0xe'))(new Redis(config[_0x2fd6('0xc')]));require('./smsInteraction.socket')['register'](socket);function respondWithStatusCode(_0x692df2,_0x297560){_0x297560=_0x297560||0xcc;return function(_0x5901a7){if(_0x5901a7){return _0x692df2[_0x2fd6('0xf')](_0x297560);}return _0x692df2[_0x2fd6('0x10')](_0x297560)['end']();};}function respondWithResult(_0x2aa16d,_0x3766b8){_0x3766b8=_0x3766b8||0xc8;return function(_0xa505e6){if(_0xa505e6){return _0x2aa16d['status'](_0x3766b8)['json'](_0xa505e6);}};}function respondWithFilteredResult(_0x12f253,_0x55ab9f){return function(_0xd10d1){if(_0xd10d1){var _0x483ed5=typeof _0x55ab9f['offset']===_0x2fd6('0x11')&&typeof _0x55ab9f[_0x2fd6('0x12')]===_0x2fd6('0x11');var _0x3f1020=_0xd10d1[_0x2fd6('0x13')];var _0x20ff71=_0x483ed5?0x0:_0x55ab9f['offset'];var _0x28c9dc=_0x483ed5?_0xd10d1['count']:_0x55ab9f[_0x2fd6('0x14')]+_0x55ab9f[_0x2fd6('0x12')];var _0x2d7098;if(_0x28c9dc>=_0x3f1020){_0x28c9dc=_0x3f1020;_0x2d7098=0xc8;}else{_0x2d7098=0xce;}_0x12f253[_0x2fd6('0x10')](_0x2d7098);return _0x12f253[_0x2fd6('0x15')](_0x2fd6('0x16'),_0x20ff71+'-'+_0x28c9dc+'/'+_0x3f1020)['json'](_0xd10d1);}return null;};}function saveUpdates(_0x426a80){return function(_0x4480e5){if(_0x4480e5){return _0x4480e5[_0x2fd6('0x17')](_0x426a80)['then'](function(_0x5f43c8){return _0x5f43c8;});}return null;};}function removeEntity(_0x1f1635){return function(_0x2b71db){if(_0x2b71db){return _0x2b71db[_0x2fd6('0x18')]()[_0x2fd6('0x19')](function(){_0x1f1635[_0x2fd6('0x10')](0xcc)['end']();});}};}function handleEntityNotFound(_0x16abe8){return function(_0x4009ef){if(!_0x4009ef){_0x16abe8['sendStatus'](0x194);}return _0x4009ef;};}function handleError(_0x51b6d0,_0x1cc532){_0x1cc532=_0x1cc532||0x1f4;return function(_0x4471c4){logger['error'](_0x4471c4['stack']);if(_0x4471c4[_0x2fd6('0x1a')]){delete _0x4471c4[_0x2fd6('0x1a')];}_0x51b6d0[_0x2fd6('0x10')](_0x1cc532)[_0x2fd6('0x1b')](_0x4471c4);};}exports[_0x2fd6('0x1c')]=function(_0x1f5de5,_0x3cde78){var _0x3ed117={};var _0x24d7bf=_[_0x2fd6('0x1d')](db['SmsInteraction'][_0x2fd6('0x1e')],function(_0x5f00f3){return{'name':_0x5f00f3['fieldName'],'type':_0x5f00f3['type'][_0x2fd6('0x1f')]};});_0x3ed117=qs['getOptions'](_0x24d7bf,_0x1f5de5);return interaction[_0x2fd6('0x20')](_0x2fd6('0x21'),_0x1f5de5[_0x2fd6('0x22')],_0x1f5de5[_0x2fd6('0x23')],_0x3ed117,_0x24d7bf)['then'](respondWithFilteredResult(_0x3cde78,_0x3ed117))[_0x2fd6('0x24')](handleError(_0x3cde78,null));};exports[_0x2fd6('0x25')]=function(_0x2023dc,_0x190d08){var _0x5025d0={'raw':![],'where':{'id':_0x2023dc['params']['id']}},_0x275fac={};_0x275fac[_0x2fd6('0x26')]=_[_0x2fd6('0x27')](db[_0x2fd6('0x28')][_0x2fd6('0x1e')]);_0x275fac['query']=_[_0x2fd6('0x27')](_0x2023dc[_0x2fd6('0x22')]);_0x275fac[_0x2fd6('0x29')]=_[_0x2fd6('0x2a')](_0x275fac[_0x2fd6('0x26')],_0x275fac['query']);_0x5025d0['attributes']=_[_0x2fd6('0x2a')](_0x275fac[_0x2fd6('0x26')],qs[_0x2fd6('0x2b')](_0x2023dc[_0x2fd6('0x22')]['fields']));_0x5025d0[_0x2fd6('0x2c')]=_0x5025d0[_0x2fd6('0x2c')]['length']?_0x5025d0[_0x2fd6('0x2c')]:_0x275fac[_0x2fd6('0x26')];if(_0x2023dc['query'][_0x2fd6('0x2d')]){_0x5025d0[_0x2fd6('0x2e')]=[{'all':!![]}];}_0x5025d0=_[_0x2fd6('0x2f')]({},_0x5025d0,_0x2023dc[_0x2fd6('0x30')]);return db['SmsInteraction'][_0x2fd6('0x31')](_0x5025d0)['then'](handleEntityNotFound(_0x190d08,null))['then'](respondWithResult(_0x190d08,null))[_0x2fd6('0x24')](handleError(_0x190d08,null));};exports[_0x2fd6('0x32')]=function(_0xdffcc4,_0x256e2f){return db[_0x2fd6('0x28')][_0x2fd6('0x32')](_0xdffcc4[_0x2fd6('0x33')],{})[_0x2fd6('0x19')](respondWithResult(_0x256e2f,0xc9))[_0x2fd6('0x24')](handleError(_0x256e2f,null));};exports['update']=function(_0x43acda,_0x3a04e7){if(_0x43acda[_0x2fd6('0x33')]['id']){delete _0x43acda['body']['id'];}return db[_0x2fd6('0x28')]['find']({'where':{'id':_0x43acda[_0x2fd6('0x34')]['id']}})['then'](handleEntityNotFound(_0x3a04e7,null))[_0x2fd6('0x19')](saveUpdates(_0x43acda[_0x2fd6('0x33')],null))[_0x2fd6('0x19')](respondWithResult(_0x3a04e7,null))[_0x2fd6('0x24')](handleError(_0x3a04e7,null));};exports[_0x2fd6('0x18')]=function(_0x1231e9,_0x432f63){return db[_0x2fd6('0x28')][_0x2fd6('0x31')]({'where':{'id':_0x1231e9['params']['id']}})['then'](handleEntityNotFound(_0x432f63,null))[_0x2fd6('0x19')](removeEntity(_0x432f63,null))[_0x2fd6('0x24')](handleError(_0x432f63,null));};exports[_0x2fd6('0x35')]=function(_0x446a25,_0x3f5dbe){return db[_0x2fd6('0x28')]['describe']()['then'](respondWithResult(_0x3f5dbe,null))[_0x2fd6('0x24')](handleError(_0x3f5dbe,null));};exports[_0x2fd6('0x36')]=function(_0x16b7e6,_0x1eca4a){return db[_0x2fd6('0x37')][_0x2fd6('0x31')]({'where':{'id':_0x16b7e6[_0x2fd6('0x34')]['id']}})['then'](handleEntityNotFound(_0x1eca4a,null))['then'](function(_0x57a7fe){if(_0x57a7fe){return _0x57a7fe[_0x2fd6('0x36')](_0x16b7e6['body'][_0x2fd6('0x38')],_[_0x2fd6('0x39')](_0x16b7e6[_0x2fd6('0x33')],[_0x2fd6('0x38'),'id'])||{});}})[_0x2fd6('0x19')](respondWithResult(_0x1eca4a,null))[_0x2fd6('0x24')](handleError(_0x1eca4a,null));};exports[_0x2fd6('0x3a')]=function(_0x43f311,_0x3e1ea5){var _0x4482c3={'raw':![],'where':{}};var _0x2ca614={};var _0x37df73={'count':0x0,'rows':[]};return db[_0x2fd6('0x28')][_0x2fd6('0x3b')]({'where':{'id':_0x43f311['params']['id']}})[_0x2fd6('0x19')](handleEntityNotFound(_0x3e1ea5,null))[_0x2fd6('0x19')](function(_0xf847fa){if(_0xf847fa){_0x2ca614[_0x2fd6('0x26')]=_[_0x2fd6('0x27')](db[_0x2fd6('0x37')][_0x2fd6('0x1e')]);_0x2ca614[_0x2fd6('0x22')]=_[_0x2fd6('0x27')](_0x43f311['query']);_0x2ca614[_0x2fd6('0x29')]=_[_0x2fd6('0x2a')](_0x2ca614[_0x2fd6('0x26')],_0x2ca614[_0x2fd6('0x22')]);_0x4482c3[_0x2fd6('0x2c')]=_[_0x2fd6('0x2a')](_0x2ca614[_0x2fd6('0x26')],qs[_0x2fd6('0x2b')](_0x43f311[_0x2fd6('0x22')][_0x2fd6('0x2b')]));_0x4482c3[_0x2fd6('0x2c')]=_0x4482c3[_0x2fd6('0x2c')][_0x2fd6('0x3c')]?_0x4482c3[_0x2fd6('0x2c')]:_0x2ca614[_0x2fd6('0x26')];if(!_0x43f311[_0x2fd6('0x22')]['hasOwnProperty'](_0x2fd6('0x3d'))){_0x4482c3[_0x2fd6('0x12')]=qs['limit'](_0x43f311['query'][_0x2fd6('0x12')]);_0x4482c3[_0x2fd6('0x14')]=qs[_0x2fd6('0x14')](_0x43f311[_0x2fd6('0x22')][_0x2fd6('0x14')]);}_0x4482c3[_0x2fd6('0x3e')]=qs[_0x2fd6('0x3f')](_0x43f311[_0x2fd6('0x22')]['sort']);_0x4482c3[_0x2fd6('0x40')]=qs[_0x2fd6('0x29')](_[_0x2fd6('0x41')](_0x43f311['query'],_0x2ca614[_0x2fd6('0x29')]));_0x4482c3[_0x2fd6('0x40')]['SmsInteractionId']=_0xf847fa['id'];if(_0x43f311[_0x2fd6('0x22')]['filter']){_0x4482c3[_0x2fd6('0x40')]=_[_0x2fd6('0x2f')](_0x4482c3['where'],{'$or':_['map'](_0x4482c3[_0x2fd6('0x2c')],function(_0x245eb6){var _0x2ee0d9={};_0x2ee0d9[_0x245eb6]={'$like':'%'+_0x43f311[_0x2fd6('0x22')][_0x2fd6('0x42')]+'%'};return _0x2ee0d9;})});}if(_0x43f311[_0x2fd6('0x22')][_0x2fd6('0x43')]){var _0x2dcfe3=_0x43f311[_0x2fd6('0x22')][_0x2fd6('0x43')]['split'](',');var _0x2bec78={};_0x2bec78[_0x2dcfe3[0x0]]={'$gte':moment(_0x2dcfe3[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x4482c3['where']=_[_0x2fd6('0x2f')](_0x4482c3['where'],_0x2bec78);}_0x4482c3=_['merge']({},_0x4482c3,_0x43f311['options']);return db[_0x2fd6('0x37')]['count']({'where':_0x4482c3['where']})['then'](function(_0x11dfba){_0x37df73[_0x2fd6('0x13')]=_0x11dfba;if(_0x43f311[_0x2fd6('0x22')][_0x2fd6('0x2d')]){_0x4482c3[_0x2fd6('0x2e')]=[{'all':!![]}];}return db['SmsMessage'][_0x2fd6('0x20')](_0x4482c3);})[_0x2fd6('0x19')](function(_0xbd3152){_0x37df73['rows']=_0xbd3152;return _0x37df73;});}})['then'](respondWithFilteredResult(_0x3e1ea5,_0x4482c3))[_0x2fd6('0x24')](handleError(_0x3e1ea5,null));};exports[_0x2fd6('0x44')]=function(_0xcb0c39,_0x436d66){return db[_0x2fd6('0x28')][_0x2fd6('0x31')]({'where':{'id':_0xcb0c39[_0x2fd6('0x34')]['id']}})[_0x2fd6('0x19')](handleEntityNotFound(_0x436d66,null))[_0x2fd6('0x19')](function(_0x1ed953){if(_0x1ed953){return _0x1ed953['setTags'](_0xcb0c39[_0x2fd6('0x33')][_0x2fd6('0x38')],_[_0x2fd6('0x39')](_0xcb0c39[_0x2fd6('0x33')],[_0x2fd6('0x38'),'id'])||{})['spread'](function(){return db[_0x2fd6('0x45')][_0x2fd6('0x20')]({'attributes':['id',_0x2fd6('0x1a'),_0x2fd6('0x46')],'where':{'id':_0xcb0c39['body'][_0x2fd6('0x38')]}});})[_0x2fd6('0x19')](function(_0x49e4f2){socket[_0x2fd6('0x47')](_0x2fd6('0x48'),{'id':Number(_0xcb0c39['params']['id']),'tags':_0x49e4f2||[]});return{'id':Number(_0xcb0c39[_0x2fd6('0x34')]['id']),'tags':_0x49e4f2||[]};});}})[_0x2fd6('0x19')](respondWithResult(_0x436d66,null))[_0x2fd6('0x24')](handleError(_0x436d66,null));};exports[_0x2fd6('0x49')]=function(_0x4fd81c,_0x574d6b){return db[_0x2fd6('0x28')]['find']({'where':{'id':_0x4fd81c[_0x2fd6('0x34')]['id']}})[_0x2fd6('0x19')](handleEntityNotFound(_0x574d6b,null))[_0x2fd6('0x19')](function(_0xb6b731){if(_0xb6b731){return _0xb6b731[_0x2fd6('0x49')](_0x4fd81c[_0x2fd6('0x22')]['ids']);}})[_0x2fd6('0x19')](respondWithStatusCode(_0x574d6b,null))[_0x2fd6('0x24')](handleError(_0x574d6b,null));};exports[_0x2fd6('0x4a')]=function(_0x43a324,_0xfa1ac4){var _0x57cdde=moment()[_0x2fd6('0x4b')]()[_0x2fd6('0x4c')]();var _0x19154e=path[_0x2fd6('0x4d')](config[_0x2fd6('0x4e')],_0x2fd6('0x4f'),_0x2fd6('0x50'),_0x2fd6('0x51'));var _0x481d6a=path[_0x2fd6('0x4d')](_0x19154e,_0x57cdde);var _0x459460=util[_0x2fd6('0x52')](_0x2fd6('0x53'),_0x43a324['params']['id'],_0x57cdde);var _0xee0b42=path['join'](_0x19154e,_0x459460);var _0x325210=[];_0x325210['push']({'model':db[_0x2fd6('0x54')],'as':_0x2fd6('0x54'),'attributes':['id','fullname'],'raw':!![]});_0x325210[_0x2fd6('0x55')]({'model':db['CmContact'],'as':_0x2fd6('0x56'),'attributes':['id','firstName',_0x2fd6('0x57')],'raw':!![]});var _0x5b2a42=[{'model':db[_0x2fd6('0x37')],'as':'Messages','attributes':['id',_0x2fd6('0x33'),'createdAt',_0x2fd6('0x58'),_0x2fd6('0x59'),_0x2fd6('0x5a')],'include':_0x325210}];_0x5b2a42['push']({'model':db[_0x2fd6('0x5b')],'as':'Account','attributes':['id',_0x2fd6('0x1a')]});_0x5b2a42[_0x2fd6('0x55')]({'model':db[_0x2fd6('0x54')],'as':_0x2fd6('0x5c'),'attributes':['id',_0x2fd6('0x5d')]});return db['SmsInteraction'][_0x2fd6('0x31')]({'where':{'id':_0x43a324[_0x2fd6('0x34')]['id']},'include':_0x5b2a42})['then'](handleEntityNotFound(_0xfa1ac4,null))['then'](function(_0x53bebf){if(_0x53bebf){var _0x1bd283=_0x53bebf[_0x2fd6('0x5e')]({'plain':!![]});fs[_0x2fd6('0x5f')](_0x481d6a);var _0x2ff9bd={'channel':_0x2fd6('0x60'),'account':_0x1bd283['Account'][_0x2fd6('0x1a')],'agent':_0x1bd283[_0x2fd6('0x5c')]?_0x1bd283['Owner'][_0x2fd6('0x5d')]:_0x2fd6('0x61'),'createdAt':moment(_0x1bd283['createdAt'])[_0x2fd6('0x52')](_0x2fd6('0x62'))['toString'](),'closedAt':_0x1bd283[_0x2fd6('0x63')]?moment(_0x1bd283[_0x2fd6('0x64')])[_0x2fd6('0x52')](_0x2fd6('0x62'))[_0x2fd6('0x4c')]():'','disposition':_0x1bd283[_0x2fd6('0x65')],'messages':_(_0x1bd283[_0x2fd6('0x66')])[_0x2fd6('0x42')]({'secret':![]})['map'](function(_0x505a97){return{'date':moment(_0x505a97[_0x2fd6('0x67')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x2fd6('0x4c')](),'sender':_0x505a97[_0x2fd6('0x58')]===_0x2fd6('0x68')?_0x505a97[_0x2fd6('0x54')]?_0x505a97['User'][_0x2fd6('0x5d')]:'System':_0x505a97[_0x2fd6('0x56')][_0x2fd6('0x69')]+(_0x505a97[_0x2fd6('0x56')][_0x2fd6('0x57')]?'\x20'+_0x505a97[_0x2fd6('0x56')][_0x2fd6('0x57')]:''),'body':_0x505a97[_0x2fd6('0x33')],'direction':_0x505a97[_0x2fd6('0x58')]===_0x2fd6('0x68')?'A':'C','secret':_0x505a97[_0x2fd6('0x59')],'read':_0x505a97[_0x2fd6('0x5a')]};})[_0x2fd6('0x6a')]()};return ejs[_0x2fd6('0x6b')](path[_0x2fd6('0x4d')](config[_0x2fd6('0x4e')],_0x2fd6('0x4f'),'views','downloadInteraction.ejs'),{'interaction':_0x2ff9bd})[_0x2fd6('0x19')](function(_0x3fe9c2){var _0x5bf1b2=path['join'](_0x481d6a,'transcript-'+_0x1bd283['id']+'-'+_0x57cdde+_0x2fd6('0x6c'));var _0x24c10c={'path':_0x5bf1b2,'channel':_0x2fd6('0x60'),'interactionId':_0x1bd283['id']};return pdf[_0x2fd6('0x6d')](_0x3fe9c2,_0x24c10c);})[_0x2fd6('0x19')](function(){return new BPromise(function(_0x17698b,_0xdeb5a0){zipdir(_0x481d6a,{'saveTo':_0xee0b42},function(_0x1ec33a,_0x1d9337){if(_0x1ec33a)return _0xdeb5a0(_0x1ec33a);return _0x17698b(_0x1d9337);});})[_0x2fd6('0x19')](function(){return new BPromise(function(_0x42c9bd,_0x473863){rimraf(_0x481d6a,function(_0x3b94b2){if(_0x3b94b2)_0x473863(_0x3b94b2);return _0x42c9bd();});});})[_0x2fd6('0x19')](function(){return _0xfa1ac4[_0x2fd6('0x4a')](_0xee0b42,_0x459460,function(_0x51e194){if(_0x51e194){console[_0x2fd6('0x6e')](_0x2fd6('0x6f'),_0x51e194);}else{fs[_0x2fd6('0x70')](_0xee0b42);}});});});}else{return _0xfa1ac4[_0x2fd6('0xf')](0xc8);}})[_0x2fd6('0x24')](handleError(_0xfa1ac4,null));}; \ No newline at end of file +var _0xc7d3=['lastName','secret','value','renderFile','views','downloadInteraction.ejs','.pdf','unlinkSync','zip-dir','moment','bluebird','path','ejs','lodash','ioredis','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','status','end','json','offset','undefined','count','limit','set','Content-Range','update','then','destroy','sendStatus','error','stack','name','send','rawAttributes','type','key','getOptions','sms','query','user','catch','show','params','model','keys','SmsInteraction','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','create','body','describe','SmsMessage','addMessage','omit','ids','getMessages','findOne','hasOwnProperty','sort','where','pick','filter','map','$gte','YYYY-MM-DD\x20HH:mm:ss','addTags','setTags','spread','Tag','findAll','color','emit','smsInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','tmp','format','User','fullname','CmContact','Contact','firstName','Messages','direction','read','push','SmsAccount','Account','Owner','get','mkdirSync','Sms','closedAt','disposition','createdAt','System'];(function(_0x3c5ef3,_0x23f977){var _0x43d971=function(_0x5dc15a){while(--_0x5dc15a){_0x3c5ef3['push'](_0x3c5ef3['shift']());}};_0x43d971(++_0x23f977);}(_0xc7d3,0x1e8));var _0x3c7d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc7d3[_0x3dd15e];return _0x231fd0;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x3c7d('0x0'));var moment=require(_0x3c7d('0x1'));var BPromise=require(_0x3c7d('0x2'));var util=require('util');var path=require(_0x3c7d('0x3'));var ejs=require(_0x3c7d('0x4'));var fs=require('fs');var _=require(_0x3c7d('0x5'));var Redis=require(_0x3c7d('0x6'));var interaction=require('../../components/interaction/service');var qs=require('../../components/parsers/qs');var pdf=require(_0x3c7d('0x7'));var logger=require(_0x3c7d('0x8'))(_0x3c7d('0x9'));var config=require(_0x3c7d('0xa'));var db=require(_0x3c7d('0xb'))['db'];config[_0x3c7d('0xc')]=_[_0x3c7d('0xd')](config[_0x3c7d('0xc')],{'host':_0x3c7d('0xe'),'port':0x18eb});var socket=require(_0x3c7d('0xf'))(new Redis(config[_0x3c7d('0xc')]));require(_0x3c7d('0x10'))[_0x3c7d('0x11')](socket);function respondWithStatusCode(_0x46b0bf,_0xec958f){_0xec958f=_0xec958f||0xcc;return function(_0x210796){if(_0x210796){return _0x46b0bf['sendStatus'](_0xec958f);}return _0x46b0bf[_0x3c7d('0x12')](_0xec958f)[_0x3c7d('0x13')]();};}function respondWithResult(_0x2953af,_0x715e1d){_0x715e1d=_0x715e1d||0xc8;return function(_0x364af1){if(_0x364af1){return _0x2953af[_0x3c7d('0x12')](_0x715e1d)[_0x3c7d('0x14')](_0x364af1);}};}function respondWithFilteredResult(_0x4a6934,_0x561d44){return function(_0x5f3bee){if(_0x5f3bee){var _0x250fdb=typeof _0x561d44[_0x3c7d('0x15')]===_0x3c7d('0x16')&&typeof _0x561d44['limit']==='undefined';var _0x42d928=_0x5f3bee[_0x3c7d('0x17')];var _0x23bbe1=_0x250fdb?0x0:_0x561d44[_0x3c7d('0x15')];var _0x2f4586=_0x250fdb?_0x5f3bee[_0x3c7d('0x17')]:_0x561d44[_0x3c7d('0x15')]+_0x561d44[_0x3c7d('0x18')];var _0x508813;if(_0x2f4586>=_0x42d928){_0x2f4586=_0x42d928;_0x508813=0xc8;}else{_0x508813=0xce;}_0x4a6934[_0x3c7d('0x12')](_0x508813);return _0x4a6934[_0x3c7d('0x19')](_0x3c7d('0x1a'),_0x23bbe1+'-'+_0x2f4586+'/'+_0x42d928)[_0x3c7d('0x14')](_0x5f3bee);}return null;};}function saveUpdates(_0x47961b){return function(_0x381079){if(_0x381079){return _0x381079[_0x3c7d('0x1b')](_0x47961b)[_0x3c7d('0x1c')](function(_0x3646c4){return _0x3646c4;});}return null;};}function removeEntity(_0x5bcea1){return function(_0x53f518){if(_0x53f518){return _0x53f518[_0x3c7d('0x1d')]()[_0x3c7d('0x1c')](function(){_0x5bcea1[_0x3c7d('0x12')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4783c9){return function(_0x4eb075){if(!_0x4eb075){_0x4783c9[_0x3c7d('0x1e')](0x194);}return _0x4eb075;};}function handleError(_0x3bb5b9,_0x460aa6){_0x460aa6=_0x460aa6||0x1f4;return function(_0x557655){logger[_0x3c7d('0x1f')](_0x557655[_0x3c7d('0x20')]);if(_0x557655[_0x3c7d('0x21')]){delete _0x557655[_0x3c7d('0x21')];}_0x3bb5b9[_0x3c7d('0x12')](_0x460aa6)[_0x3c7d('0x22')](_0x557655);};}exports['index']=function(_0x679088,_0x5e67eb){var _0x3cde58={};var _0x39050e=_['map'](db['SmsInteraction'][_0x3c7d('0x23')],function(_0x4519f0){return{'name':_0x4519f0['fieldName'],'type':_0x4519f0[_0x3c7d('0x24')][_0x3c7d('0x25')]};});_0x3cde58=qs[_0x3c7d('0x26')](_0x39050e,_0x679088);return interaction['findAll'](_0x3c7d('0x27'),_0x679088[_0x3c7d('0x28')],_0x679088[_0x3c7d('0x29')],_0x3cde58,_0x39050e)['then'](respondWithFilteredResult(_0x5e67eb,_0x3cde58))[_0x3c7d('0x2a')](handleError(_0x5e67eb,null));};exports[_0x3c7d('0x2b')]=function(_0xe68b9f,_0x56f727){var _0x1506e7={'raw':![],'where':{'id':_0xe68b9f[_0x3c7d('0x2c')]['id']}},_0x55dabb={};_0x55dabb[_0x3c7d('0x2d')]=_[_0x3c7d('0x2e')](db[_0x3c7d('0x2f')][_0x3c7d('0x23')]);_0x55dabb[_0x3c7d('0x28')]=_[_0x3c7d('0x2e')](_0xe68b9f['query']);_0x55dabb[_0x3c7d('0x30')]=_[_0x3c7d('0x31')](_0x55dabb[_0x3c7d('0x2d')],_0x55dabb[_0x3c7d('0x28')]);_0x1506e7[_0x3c7d('0x32')]=_[_0x3c7d('0x31')](_0x55dabb[_0x3c7d('0x2d')],qs[_0x3c7d('0x33')](_0xe68b9f[_0x3c7d('0x28')][_0x3c7d('0x33')]));_0x1506e7[_0x3c7d('0x32')]=_0x1506e7[_0x3c7d('0x32')][_0x3c7d('0x34')]?_0x1506e7[_0x3c7d('0x32')]:_0x55dabb[_0x3c7d('0x2d')];if(_0xe68b9f['query'][_0x3c7d('0x35')]){_0x1506e7[_0x3c7d('0x36')]=[{'all':!![]}];}_0x1506e7=_[_0x3c7d('0x37')]({},_0x1506e7,_0xe68b9f[_0x3c7d('0x38')]);return db[_0x3c7d('0x2f')][_0x3c7d('0x39')](_0x1506e7)['then'](handleEntityNotFound(_0x56f727,null))[_0x3c7d('0x1c')](respondWithResult(_0x56f727,null))[_0x3c7d('0x2a')](handleError(_0x56f727,null));};exports[_0x3c7d('0x3a')]=function(_0x2f3509,_0x152521){return db[_0x3c7d('0x2f')][_0x3c7d('0x3a')](_0x2f3509[_0x3c7d('0x3b')],{})[_0x3c7d('0x1c')](respondWithResult(_0x152521,0xc9))[_0x3c7d('0x2a')](handleError(_0x152521,null));};exports['update']=function(_0x120f35,_0x2b6504){if(_0x120f35[_0x3c7d('0x3b')]['id']){delete _0x120f35[_0x3c7d('0x3b')]['id'];}return db[_0x3c7d('0x2f')][_0x3c7d('0x39')]({'where':{'id':_0x120f35[_0x3c7d('0x2c')]['id']}})[_0x3c7d('0x1c')](handleEntityNotFound(_0x2b6504,null))[_0x3c7d('0x1c')](saveUpdates(_0x120f35['body'],null))['then'](respondWithResult(_0x2b6504,null))['catch'](handleError(_0x2b6504,null));};exports[_0x3c7d('0x1d')]=function(_0x5208a1,_0x15593b){return db[_0x3c7d('0x2f')][_0x3c7d('0x39')]({'where':{'id':_0x5208a1[_0x3c7d('0x2c')]['id']}})['then'](handleEntityNotFound(_0x15593b,null))[_0x3c7d('0x1c')](removeEntity(_0x15593b,null))[_0x3c7d('0x2a')](handleError(_0x15593b,null));};exports[_0x3c7d('0x3c')]=function(_0x522ed6,_0x40eab3){return db[_0x3c7d('0x2f')]['describe']()['then'](respondWithResult(_0x40eab3,null))[_0x3c7d('0x2a')](handleError(_0x40eab3,null));};exports['addMessage']=function(_0x1bbd8e,_0x2da129){return db[_0x3c7d('0x3d')][_0x3c7d('0x39')]({'where':{'id':_0x1bbd8e[_0x3c7d('0x2c')]['id']}})[_0x3c7d('0x1c')](handleEntityNotFound(_0x2da129,null))[_0x3c7d('0x1c')](function(_0x5cb663){if(_0x5cb663){return _0x5cb663[_0x3c7d('0x3e')](_0x1bbd8e[_0x3c7d('0x3b')]['ids'],_[_0x3c7d('0x3f')](_0x1bbd8e[_0x3c7d('0x3b')],[_0x3c7d('0x40'),'id'])||{});}})[_0x3c7d('0x1c')](respondWithResult(_0x2da129,null))[_0x3c7d('0x2a')](handleError(_0x2da129,null));};exports[_0x3c7d('0x41')]=function(_0x16ab37,_0x226c0a){var _0x424949={'raw':![],'where':{}};var _0x288821={};var _0x2ecf05={'count':0x0,'rows':[]};return db['SmsInteraction'][_0x3c7d('0x42')]({'where':{'id':_0x16ab37['params']['id']}})[_0x3c7d('0x1c')](handleEntityNotFound(_0x226c0a,null))[_0x3c7d('0x1c')](function(_0x15fc06){if(_0x15fc06){_0x288821[_0x3c7d('0x2d')]=_[_0x3c7d('0x2e')](db[_0x3c7d('0x3d')][_0x3c7d('0x23')]);_0x288821[_0x3c7d('0x28')]=_[_0x3c7d('0x2e')](_0x16ab37[_0x3c7d('0x28')]);_0x288821[_0x3c7d('0x30')]=_[_0x3c7d('0x31')](_0x288821['model'],_0x288821[_0x3c7d('0x28')]);_0x424949[_0x3c7d('0x32')]=_['intersection'](_0x288821[_0x3c7d('0x2d')],qs[_0x3c7d('0x33')](_0x16ab37[_0x3c7d('0x28')]['fields']));_0x424949['attributes']=_0x424949['attributes']['length']?_0x424949[_0x3c7d('0x32')]:_0x288821['model'];if(!_0x16ab37['query'][_0x3c7d('0x43')]('nolimit')){_0x424949[_0x3c7d('0x18')]=qs[_0x3c7d('0x18')](_0x16ab37[_0x3c7d('0x28')][_0x3c7d('0x18')]);_0x424949[_0x3c7d('0x15')]=qs['offset'](_0x16ab37[_0x3c7d('0x28')][_0x3c7d('0x15')]);}_0x424949['order']=qs[_0x3c7d('0x44')](_0x16ab37[_0x3c7d('0x28')][_0x3c7d('0x44')]);_0x424949[_0x3c7d('0x45')]=qs[_0x3c7d('0x30')](_[_0x3c7d('0x46')](_0x16ab37[_0x3c7d('0x28')],_0x288821[_0x3c7d('0x30')]));_0x424949[_0x3c7d('0x45')]['SmsInteractionId']=_0x15fc06['id'];if(_0x16ab37['query'][_0x3c7d('0x47')]){_0x424949[_0x3c7d('0x45')]=_[_0x3c7d('0x37')](_0x424949['where'],{'$or':_[_0x3c7d('0x48')](_0x424949['attributes'],function(_0x51cf9b){var _0xf29893={};_0xf29893[_0x51cf9b]={'$like':'%'+_0x16ab37['query']['filter']+'%'};return _0xf29893;})});}if(_0x16ab37['query'][_0x3c7d('0x49')]){var _0x9b2d03=_0x16ab37['query'][_0x3c7d('0x49')]['split'](',');var _0x489386={};_0x489386[_0x9b2d03[0x0]]={'$gte':moment(_0x9b2d03[0x1])['format'](_0x3c7d('0x4a'))};_0x424949[_0x3c7d('0x45')]=_[_0x3c7d('0x37')](_0x424949[_0x3c7d('0x45')],_0x489386);}_0x424949=_[_0x3c7d('0x37')]({},_0x424949,_0x16ab37[_0x3c7d('0x38')]);return db[_0x3c7d('0x3d')]['count']({'where':_0x424949[_0x3c7d('0x45')]})[_0x3c7d('0x1c')](function(_0x32d1fa){_0x2ecf05[_0x3c7d('0x17')]=_0x32d1fa;if(_0x16ab37[_0x3c7d('0x28')][_0x3c7d('0x35')]){_0x424949[_0x3c7d('0x36')]=[{'all':!![]}];}return db[_0x3c7d('0x3d')]['findAll'](_0x424949);})[_0x3c7d('0x1c')](function(_0x12404a){_0x2ecf05['rows']=_0x12404a;return _0x2ecf05;});}})[_0x3c7d('0x1c')](respondWithFilteredResult(_0x226c0a,_0x424949))[_0x3c7d('0x2a')](handleError(_0x226c0a,null));};exports[_0x3c7d('0x4b')]=function(_0x368abd,_0x40e163){return db[_0x3c7d('0x2f')][_0x3c7d('0x39')]({'where':{'id':_0x368abd['params']['id']}})[_0x3c7d('0x1c')](handleEntityNotFound(_0x40e163,null))[_0x3c7d('0x1c')](function(_0x1697c2){if(_0x1697c2){return _0x1697c2[_0x3c7d('0x4c')](_0x368abd[_0x3c7d('0x3b')]['ids'],_[_0x3c7d('0x3f')](_0x368abd[_0x3c7d('0x3b')],[_0x3c7d('0x40'),'id'])||{})[_0x3c7d('0x4d')](function(){return db[_0x3c7d('0x4e')][_0x3c7d('0x4f')]({'attributes':['id',_0x3c7d('0x21'),_0x3c7d('0x50')],'where':{'id':_0x368abd['body'][_0x3c7d('0x40')]}});})[_0x3c7d('0x1c')](function(_0x26075b){socket[_0x3c7d('0x51')](_0x3c7d('0x52'),{'id':Number(_0x368abd[_0x3c7d('0x2c')]['id']),'tags':_0x26075b||[]});return{'id':Number(_0x368abd[_0x3c7d('0x2c')]['id']),'tags':_0x26075b||[]};});}})[_0x3c7d('0x1c')](respondWithResult(_0x40e163,null))['catch'](handleError(_0x40e163,null));};exports[_0x3c7d('0x53')]=function(_0x16e717,_0xdc3358){return db[_0x3c7d('0x2f')][_0x3c7d('0x39')]({'where':{'id':_0x16e717[_0x3c7d('0x2c')]['id']}})[_0x3c7d('0x1c')](handleEntityNotFound(_0xdc3358,null))[_0x3c7d('0x1c')](function(_0x5ecc96){if(_0x5ecc96){return _0x5ecc96[_0x3c7d('0x53')](_0x16e717[_0x3c7d('0x28')]['ids']);}})['then'](respondWithStatusCode(_0xdc3358,null))[_0x3c7d('0x2a')](handleError(_0xdc3358,null));};exports[_0x3c7d('0x54')]=function(_0x525bf7,_0x4fb2e8){var _0x5594aa=moment()[_0x3c7d('0x55')]()[_0x3c7d('0x56')]();var _0x404250=path[_0x3c7d('0x57')](config[_0x3c7d('0x58')],_0x3c7d('0x59'),_0x3c7d('0x5a'),_0x3c7d('0x5b'));var _0x52de22=path['join'](_0x404250,_0x5594aa);var _0x20ccf1=util[_0x3c7d('0x5c')]('transcript-%d-%s.zip',_0x525bf7[_0x3c7d('0x2c')]['id'],_0x5594aa);var _0x5971d1=path[_0x3c7d('0x57')](_0x404250,_0x20ccf1);var _0x28d22c=[];_0x28d22c['push']({'model':db[_0x3c7d('0x5d')],'as':_0x3c7d('0x5d'),'attributes':['id',_0x3c7d('0x5e')],'raw':!![]});_0x28d22c['push']({'model':db[_0x3c7d('0x5f')],'as':_0x3c7d('0x60'),'attributes':['id',_0x3c7d('0x61'),'lastName'],'raw':!![]});var _0x3ce7d9=[{'model':db[_0x3c7d('0x3d')],'as':_0x3c7d('0x62'),'attributes':['id','body','createdAt',_0x3c7d('0x63'),'secret',_0x3c7d('0x64')],'include':_0x28d22c}];_0x3ce7d9[_0x3c7d('0x65')]({'model':db[_0x3c7d('0x66')],'as':_0x3c7d('0x67'),'attributes':['id',_0x3c7d('0x21')]});_0x3ce7d9[_0x3c7d('0x65')]({'model':db[_0x3c7d('0x5d')],'as':_0x3c7d('0x68'),'attributes':['id','fullname']});return db[_0x3c7d('0x2f')][_0x3c7d('0x39')]({'where':{'id':_0x525bf7['params']['id']},'include':_0x3ce7d9})[_0x3c7d('0x1c')](handleEntityNotFound(_0x4fb2e8,null))[_0x3c7d('0x1c')](function(_0x55336d){if(_0x55336d){var _0x245ad8=_0x55336d[_0x3c7d('0x69')]({'plain':!![]});fs[_0x3c7d('0x6a')](_0x52de22);var _0x3d76e9={'channel':_0x3c7d('0x6b'),'account':_0x245ad8[_0x3c7d('0x67')][_0x3c7d('0x21')],'agent':_0x245ad8[_0x3c7d('0x68')]?_0x245ad8[_0x3c7d('0x68')][_0x3c7d('0x5e')]:'N.A.','createdAt':moment(_0x245ad8['createdAt'])[_0x3c7d('0x5c')](_0x3c7d('0x4a'))[_0x3c7d('0x56')](),'closedAt':_0x245ad8['closed']?moment(_0x245ad8[_0x3c7d('0x6c')])[_0x3c7d('0x5c')]('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x245ad8[_0x3c7d('0x6d')],'messages':_(_0x245ad8[_0x3c7d('0x62')])['filter']({'secret':![]})[_0x3c7d('0x48')](function(_0x5d8286){return{'date':moment(_0x5d8286[_0x3c7d('0x6e')])[_0x3c7d('0x5c')](_0x3c7d('0x4a'))[_0x3c7d('0x56')](),'sender':_0x5d8286['direction']==='out'?_0x5d8286[_0x3c7d('0x5d')]?_0x5d8286[_0x3c7d('0x5d')]['fullname']:_0x3c7d('0x6f'):_0x5d8286['Contact'][_0x3c7d('0x61')]+(_0x5d8286[_0x3c7d('0x60')][_0x3c7d('0x70')]?'\x20'+_0x5d8286['Contact'][_0x3c7d('0x70')]:''),'body':_0x5d8286[_0x3c7d('0x3b')],'direction':_0x5d8286[_0x3c7d('0x63')]==='out'?'A':'C','secret':_0x5d8286[_0x3c7d('0x71')],'read':_0x5d8286['read']};})[_0x3c7d('0x72')]()};return ejs[_0x3c7d('0x73')](path['join'](config[_0x3c7d('0x58')],'server',_0x3c7d('0x74'),_0x3c7d('0x75')),{'interaction':_0x3d76e9})[_0x3c7d('0x1c')](function(_0x4f2ceb){var _0x4011aa=path['join'](_0x52de22,'transcript-'+_0x245ad8['id']+'-'+_0x5594aa+_0x3c7d('0x76'));var _0x24f9e2={'path':_0x4011aa,'channel':_0x3c7d('0x6b'),'interactionId':_0x245ad8['id']};return pdf['createPdfFromHTML'](_0x4f2ceb,_0x24f9e2);})['then'](function(){return new BPromise(function(_0x225409,_0x3ac67d){zipdir(_0x52de22,{'saveTo':_0x5971d1},function(_0x56130e,_0x3ec78c){if(_0x56130e)return _0x3ac67d(_0x56130e);return _0x225409(_0x3ec78c);});})[_0x3c7d('0x1c')](function(){return new BPromise(function(_0x493092,_0x337f24){rimraf(_0x52de22,function(_0x40fb85){if(_0x40fb85)_0x337f24(_0x40fb85);return _0x493092();});});})[_0x3c7d('0x1c')](function(){return _0x4fb2e8[_0x3c7d('0x54')](_0x5971d1,_0x20ccf1,function(_0x2eadc2){if(_0x2eadc2){console['log']('err',_0x2eadc2);}else{fs[_0x3c7d('0x77')](_0x5971d1);}});});});}else{return _0x4fb2e8[_0x3c7d('0x1e')](0xc8);}})[_0x3c7d('0x2a')](handleError(_0x4fb2e8,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index e08bccb..0f10bed 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 _0x28f2=['update','remove','then','setDataValue','Users','map','findAll','length','emit','catch','hasOwnProperty','exports','events','../../mysqldb','SmsInteraction','SmsMessage','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x28f2,0x193));var _0x228f=function(_0xb2c144,_0x193d3c){_0xb2c144=_0xb2c144-0x0;var _0x49b81d=_0x28f2[_0xb2c144];return _0x49b81d;};'use strict';var EventEmitter=require(_0x228f('0x0'));var SmsInteraction=require(_0x228f('0x1'))['db'][_0x228f('0x2')];var SmsMessage=require(_0x228f('0x1'))['db'][_0x228f('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x228f('0x4'),'afterUpdate':_0x228f('0x5'),'afterDestroy':_0x228f('0x6')};function emitEvent(_0x4303c3){return function(_0x2bb7d7,_0x3439f5,_0x32c5c3){_0x2bb7d7['getUsers']({'attributes':['id'],'raw':!![]})[_0x228f('0x7')](function(_0x4a4a44){_0x2bb7d7[_0x228f('0x8')](_0x228f('0x9'),_0x4a4a44[_0x228f('0xa')](function(_0x5f406c){return{'id':_0x5f406c['id']};}));return SmsMessage[_0x228f('0xb')]({'where':{'SmsInteractionId':_0x2bb7d7['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x212c90){_0x2bb7d7[_0x228f('0x8')]('unreadMessages',_0x212c90[_0x228f('0xc')]);SmsInteractionEvents[_0x228f('0xd')](_0x4303c3+':'+_0x2bb7d7['id'],_0x2bb7d7);SmsInteractionEvents[_0x228f('0xd')](_0x4303c3,_0x2bb7d7);_0x32c5c3(null);})[_0x228f('0xe')](_0x32c5c3(null));};}for(var e in events){if(events[_0x228f('0xf')](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module[_0x228f('0x10')]=SmsInteractionEvents; \ No newline at end of file +var _0xadb5=['update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','emit','catch','hasOwnProperty','exports','../../mysqldb','SmsMessage','setMaxListeners'];(function(_0x5a7f5f,_0xf95293){var _0x205d32=function(_0x12f654){while(--_0x12f654){_0x5a7f5f['push'](_0x5a7f5f['shift']());}};_0x205d32(++_0xf95293);}(_0xadb5,0xad));var _0x5adb=function(_0x36b32d,_0x2b265d){_0x36b32d=_0x36b32d-0x0;var _0x3d3efe=_0xadb5[_0x36b32d];return _0x3d3efe;};'use strict';var EventEmitter=require('events');var SmsInteraction=require(_0x5adb('0x0'))['db']['SmsInteraction'];var SmsMessage=require(_0x5adb('0x0'))['db'][_0x5adb('0x1')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x5adb('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x5adb('0x3'),'afterDestroy':_0x5adb('0x4')};function emitEvent(_0x2e3ef4){return function(_0x4cb1d1,_0x35a5d3,_0x168d89){_0x4cb1d1[_0x5adb('0x5')]({'attributes':['id'],'raw':!![]})[_0x5adb('0x6')](function(_0xdf3776){_0x4cb1d1[_0x5adb('0x7')](_0x5adb('0x8'),_0xdf3776[_0x5adb('0x9')](function(_0x41261c){return{'id':_0x41261c['id']};}));return SmsMessage[_0x5adb('0xa')]({'where':{'SmsInteractionId':_0x4cb1d1['id'],'direction':'in','read':![]},'raw':!![]});})[_0x5adb('0x6')](function(_0x336bad){_0x4cb1d1[_0x5adb('0x7')](_0x5adb('0xb'),_0x336bad['length']);SmsInteractionEvents['emit'](_0x2e3ef4+':'+_0x4cb1d1['id'],_0x4cb1d1);SmsInteractionEvents[_0x5adb('0xc')](_0x2e3ef4,_0x4cb1d1);_0x168d89(null);})[_0x5adb('0xd')](_0x168d89(null));};}for(var e in events){if(events[_0x5adb('0xe')](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module[_0x5adb('0xf')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 69f56e4..4343c17 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 _0xb438=['./smsInteraction.attributes','define','SmsInteraction','sms_interactions','changed','closed','closedAt','format','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x15bc81,_0x4d4f77){var _0x59440e=function(_0x1b60f2){while(--_0x1b60f2){_0x15bc81['push'](_0x15bc81['shift']());}};_0x59440e(++_0x4d4f77);}(_0xb438,0x1b8));var _0x8b43=function(_0x130745,_0x194bd8){_0x130745=_0x130745-0x0;var _0x189c0d=_0xb438[_0x130745];return _0x189c0d;};'use strict';var _=require(_0x8b43('0x0'));var util=require(_0x8b43('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x8b43('0x2'));var BPromise=require(_0x8b43('0x3'));var rp=require(_0x8b43('0x4'));var fs=require('fs');var path=require(_0x8b43('0x5'));var rimraf=require(_0x8b43('0x6'));var config=require(_0x8b43('0x7'));var attributes=require(_0x8b43('0x8'));module['exports']=function(_0x2b5fc5,_0x968f5b){return _0x2b5fc5[_0x8b43('0x9')](_0x8b43('0xa'),attributes,{'tableName':_0x8b43('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2a1e20,_0x51226c,_0x2831f2){if(_0x2a1e20[_0x8b43('0xc')](_0x8b43('0xd'))){_0x2a1e20[_0x8b43('0xe')]=moment()[_0x8b43('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}_0x2831f2(null,_0x2a1e20);}}});}; \ No newline at end of file +var _0xe667=['bluebird','request-promise','path','rimraf','../../config/environment','./smsInteraction.attributes','exports','sms_interactions','closedAt','format','lodash','util','../../config/logger','moment'];(function(_0x5efae6,_0x342ade){var _0x23106f=function(_0x505fda){while(--_0x505fda){_0x5efae6['push'](_0x5efae6['shift']());}};_0x23106f(++_0x342ade);}(_0xe667,0x176));var _0x7e66=function(_0x59fda2,_0x37526f){_0x59fda2=_0x59fda2-0x0;var _0x482102=_0xe667[_0x59fda2];return _0x482102;};'use strict';var _=require(_0x7e66('0x0'));var util=require(_0x7e66('0x1'));var logger=require(_0x7e66('0x2'))('api');var moment=require(_0x7e66('0x3'));var BPromise=require(_0x7e66('0x4'));var rp=require(_0x7e66('0x5'));var fs=require('fs');var path=require(_0x7e66('0x6'));var rimraf=require(_0x7e66('0x7'));var config=require(_0x7e66('0x8'));var attributes=require(_0x7e66('0x9'));module[_0x7e66('0xa')]=function(_0x201d2f,_0xcd2439){return _0x201d2f['define']('SmsInteraction',attributes,{'tableName':_0x7e66('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x37884b,_0x446178,_0x682b95){if(_0x37884b['changed']('closed')){_0x37884b[_0x7e66('0xc')]=moment()[_0x7e66('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}_0x682b95(null,_0x37884b);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 0306d0b..237a313 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 _0x1cab=['info','SmsInteraction,\x20%s,\x20%s','SmsInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','SmsInteraction','update','body','options','attributes','limit','UpdateSmsInteraction','debug','AddTagsToSmsInteraction','find','where','addTags','ids','spread','AddTags','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','then'];(function(_0x4d8ed9,_0x2ae284){var _0x1e2140=function(_0x9cca89){while(--_0x9cca89){_0x4d8ed9['push'](_0x4d8ed9['shift']());}};_0x1e2140(++_0x2ae284);}(_0x1cab,0xb5));var _0xb1ca=function(_0x351bc2,_0x4704c4){_0x351bc2=_0x351bc2-0x0;var _0x25dfcc=_0x1cab[_0x351bc2];return _0x25dfcc;};'use strict';var _=require('lodash');var util=require(_0xb1ca('0x0'));var moment=require(_0xb1ca('0x1'));var BPromise=require(_0xb1ca('0x2'));var rs=require(_0xb1ca('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb1ca('0x4'));var logger=require(_0xb1ca('0x5'))(_0xb1ca('0x6'));var config=require(_0xb1ca('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xb1ca('0x8')]({'port':0x232a});config[_0xb1ca('0x9')]=_[_0xb1ca('0xa')](config['redis'],{'host':_0xb1ca('0xb'),'port':0x18eb});var socket=require(_0xb1ca('0xc'))(new Redis(config['redis']));require('./smsInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x170b98,_0x32694e,_0x5bfa7c){return new BPromise(function(_0x2f3fb7,_0xe150d4){return client['request'](_0x170b98,_0x5bfa7c)[_0xb1ca('0xd')](function(_0x388f01){logger[_0xb1ca('0xe')](_0xb1ca('0xf'),_0x32694e,'request\x20sent');logger['debug'](_0xb1ca('0x10'),_0x32694e,_0xb1ca('0x11'),JSON[_0xb1ca('0x12')](_0x388f01));if(_0x388f01[_0xb1ca('0x13')]){if(_0x388f01['error'][_0xb1ca('0x14')]===0x1f4){logger[_0xb1ca('0x13')](_0xb1ca('0xf'),_0x32694e,_0x388f01[_0xb1ca('0x13')][_0xb1ca('0x15')]);return _0xe150d4(_0x388f01['error'][_0xb1ca('0x15')]);}logger['error'](_0xb1ca('0xf'),_0x32694e,_0x388f01[_0xb1ca('0x13')]['message']);return _0x2f3fb7(_0x388f01['error'][_0xb1ca('0x15')]);}else{logger[_0xb1ca('0xe')]('SmsInteraction,\x20%s,\x20%s',_0x32694e,'request\x20sent');_0x2f3fb7(_0x388f01[_0xb1ca('0x16')][_0xb1ca('0x15')]);}})[_0xb1ca('0x17')](function(_0x6dc3dd){logger[_0xb1ca('0x13')](_0xb1ca('0xf'),_0x32694e,_0x6dc3dd);_0xe150d4(_0x6dc3dd);});});}exports['UpdateSmsInteraction']=function(_0x4c5f9a){var _0x550cb3=this;return new Promise(function(_0x176bd5,_0xc4d01e){return db[_0xb1ca('0x18')][_0xb1ca('0x19')](_0x4c5f9a[_0xb1ca('0x1a')],{'raw':_0x4c5f9a[_0xb1ca('0x1b')]?_0x4c5f9a['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4c5f9a[_0xb1ca('0x1b')]?_0x4c5f9a[_0xb1ca('0x1b')]['where']||null:null,'attributes':_0x4c5f9a[_0xb1ca('0x1b')]?_0x4c5f9a[_0xb1ca('0x1b')][_0xb1ca('0x1c')]||null:null,'limit':_0x4c5f9a[_0xb1ca('0x1b')]?_0x4c5f9a[_0xb1ca('0x1b')][_0xb1ca('0x1d')]||null:null})['then'](function(_0x379500){logger[_0xb1ca('0xe')](_0xb1ca('0x1e'),_0x4c5f9a);logger[_0xb1ca('0x1f')]('UpdateSmsInteraction',_0x4c5f9a,JSON['stringify'](_0x379500));_0x176bd5(_0x379500);})[_0xb1ca('0x17')](function(_0x130854){logger[_0xb1ca('0x13')]('UpdateSmsInteraction',_0x130854[_0xb1ca('0x15')],_0x4c5f9a);_0xc4d01e(_0x550cb3[_0xb1ca('0x13')](0x1f4,_0x130854[_0xb1ca('0x15')]));});});};exports[_0xb1ca('0x20')]=function(_0x327580){return new Promise(function(_0x2aa364,_0x151f05){return db['SmsInteraction'][_0xb1ca('0x21')]({'where':_0x327580[_0xb1ca('0x1b')]?_0x327580[_0xb1ca('0x1b')][_0xb1ca('0x22')]||null:null})[_0xb1ca('0xd')](function(_0x47d6f7){if(_0x47d6f7){return _0x47d6f7[_0xb1ca('0x23')](_0x327580[_0xb1ca('0x1a')]['ids'],_['omit'](_0x327580[_0xb1ca('0x1a')],[_0xb1ca('0x24'),'id'])||{});}})[_0xb1ca('0x25')](function(_0x8fe94){logger[_0xb1ca('0xe')](_0xb1ca('0x26'),_0x327580);logger['debug'](_0xb1ca('0x26'),_0x327580,JSON[_0xb1ca('0x12')](_0x8fe94));_0x2aa364(_0x8fe94);})['catch'](function(_0x4c262b){logger[_0xb1ca('0x13')]('AddTags',_0x4c262b[_0xb1ca('0x15')],_0x327580);_0x151f05(_this['error'](0x1f4,_0x4c262b[_0xb1ca('0x15')]));});});}; \ No newline at end of file +var _0x0b26=['find','addTags','body','ids','omit','spread','AddTags','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./smsInteraction.socket','register','request','then','info','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','error','SmsInteraction,\x20%s,\x20%s','message','result','catch','UpdateSmsInteraction','SmsInteraction','options','raw','where','attributes','limit'];(function(_0x3b7e18,_0xb04a03){var _0x2a48cd=function(_0x137c08){while(--_0x137c08){_0x3b7e18['push'](_0x3b7e18['shift']());}};_0x2a48cd(++_0xb04a03);}(_0x0b26,0xab));var _0x60b2=function(_0x57928b,_0x29a111){_0x57928b=_0x57928b-0x0;var _0x49aad6=_0x0b26[_0x57928b];return _0x49aad6;};'use strict';var _=require(_0x60b2('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x60b2('0x1'));var rs=require(_0x60b2('0x2'));var fs=require('fs');var Redis=require(_0x60b2('0x3'));var db=require(_0x60b2('0x4'))['db'];var utils=require(_0x60b2('0x5'));var logger=require('../../config/logger')(_0x60b2('0x6'));var config=require(_0x60b2('0x7'));var jayson=require(_0x60b2('0x8'));var client=jayson[_0x60b2('0x9')][_0x60b2('0xa')]({'port':0x232a});config[_0x60b2('0xb')]=_[_0x60b2('0xc')](config['redis'],{'host':_0x60b2('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x60b2('0xe'))[_0x60b2('0xf')](socket);function respondWithRpcPromise(_0x432bb1,_0xa8d767,_0x13b0ad){return new BPromise(function(_0x19a2ac,_0x2b0155){return client[_0x60b2('0x10')](_0x432bb1,_0x13b0ad)[_0x60b2('0x11')](function(_0x2bb00e){logger[_0x60b2('0x12')]('SmsInteraction,\x20%s,\x20%s',_0xa8d767,_0x60b2('0x13'));logger[_0x60b2('0x14')](_0x60b2('0x15'),_0xa8d767,_0x60b2('0x13'),JSON['stringify'](_0x2bb00e));if(_0x2bb00e[_0x60b2('0x16')]){if(_0x2bb00e[_0x60b2('0x16')]['code']===0x1f4){logger[_0x60b2('0x16')](_0x60b2('0x17'),_0xa8d767,_0x2bb00e[_0x60b2('0x16')][_0x60b2('0x18')]);return _0x2b0155(_0x2bb00e['error'][_0x60b2('0x18')]);}logger[_0x60b2('0x16')](_0x60b2('0x17'),_0xa8d767,_0x2bb00e[_0x60b2('0x16')]['message']);return _0x19a2ac(_0x2bb00e[_0x60b2('0x16')][_0x60b2('0x18')]);}else{logger[_0x60b2('0x12')](_0x60b2('0x17'),_0xa8d767,'request\x20sent');_0x19a2ac(_0x2bb00e[_0x60b2('0x19')][_0x60b2('0x18')]);}})[_0x60b2('0x1a')](function(_0x59c047){logger[_0x60b2('0x16')]('SmsInteraction,\x20%s,\x20%s',_0xa8d767,_0x59c047);_0x2b0155(_0x59c047);});});}exports[_0x60b2('0x1b')]=function(_0x2fdd11){var _0x2be5c2=this;return new Promise(function(_0x1e696b,_0x5a7b5f){return db[_0x60b2('0x1c')]['update'](_0x2fdd11['body'],{'raw':_0x2fdd11['options']?_0x2fdd11[_0x60b2('0x1d')][_0x60b2('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2fdd11[_0x60b2('0x1d')]?_0x2fdd11[_0x60b2('0x1d')][_0x60b2('0x1f')]||null:null,'attributes':_0x2fdd11[_0x60b2('0x1d')]?_0x2fdd11[_0x60b2('0x1d')][_0x60b2('0x20')]||null:null,'limit':_0x2fdd11[_0x60b2('0x1d')]?_0x2fdd11[_0x60b2('0x1d')][_0x60b2('0x21')]||null:null})[_0x60b2('0x11')](function(_0xb39669){logger['info'](_0x60b2('0x1b'),_0x2fdd11);logger[_0x60b2('0x14')](_0x60b2('0x1b'),_0x2fdd11,JSON['stringify'](_0xb39669));_0x1e696b(_0xb39669);})['catch'](function(_0x2ac3d0){logger[_0x60b2('0x16')](_0x60b2('0x1b'),_0x2ac3d0[_0x60b2('0x18')],_0x2fdd11);_0x5a7b5f(_0x2be5c2[_0x60b2('0x16')](0x1f4,_0x2ac3d0[_0x60b2('0x18')]));});});};exports['AddTagsToSmsInteraction']=function(_0x2a5913){return new Promise(function(_0x570381,_0x46b9ce){return db[_0x60b2('0x1c')][_0x60b2('0x22')]({'where':_0x2a5913[_0x60b2('0x1d')]?_0x2a5913[_0x60b2('0x1d')][_0x60b2('0x1f')]||null:null})[_0x60b2('0x11')](function(_0x1db6f3){if(_0x1db6f3){return _0x1db6f3[_0x60b2('0x23')](_0x2a5913[_0x60b2('0x24')][_0x60b2('0x25')],_[_0x60b2('0x26')](_0x2a5913[_0x60b2('0x24')],[_0x60b2('0x25'),'id'])||{});}})[_0x60b2('0x27')](function(_0x4e4867){logger[_0x60b2('0x12')](_0x60b2('0x28'),_0x2a5913);logger['debug'](_0x60b2('0x28'),_0x2a5913,JSON['stringify'](_0x4e4867));_0x570381(_0x4e4867);})['catch'](function(_0x4f6342){logger['error'](_0x60b2('0x28'),_0x4f6342[_0x60b2('0x18')],_0x2a5913);_0x46b9ce(_this[_0x60b2('0x16')](0x1f4,_0x4f6342['message']));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 6012833..46b4bf4 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 _0xe408=['remove','update','emit','register','length','smsInteraction:'];(function(_0x20b50f,_0xc24bfb){var _0x3173ff=function(_0x3f17c1){while(--_0x3f17c1){_0x20b50f['push'](_0x20b50f['shift']());}};_0x3173ff(++_0xc24bfb);}(_0xe408,0xa8));var _0x8e40=function(_0x24f31b,_0x44b8f3){_0x24f31b=_0x24f31b-0x0;var _0x488401=_0xe408[_0x24f31b];return _0x488401;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=['save',_0x8e40('0x0'),_0x8e40('0x1')];function createListener(_0x1c06dc,_0x1afec4){return function(_0x54d83e){_0x1afec4[_0x8e40('0x2')](_0x1c06dc,_0x54d83e);};}function removeListener(_0x6bbac3,_0x7dd03c){return function(){SmsInteractionEvents['removeListener'](_0x6bbac3,_0x7dd03c);};}exports[_0x8e40('0x3')]=function(_0x416101){for(var _0x44d88d=0x0,_0x29922e=events[_0x8e40('0x4')];_0x44d88d<_0x29922e;_0x44d88d++){var _0xcac02a=events[_0x44d88d];var _0x1fe4a7=createListener(_0x8e40('0x5')+_0xcac02a,_0x416101);SmsInteractionEvents['on'](_0xcac02a,_0x1fe4a7);}}; \ No newline at end of file +var _0x8c3b=['register','length','smsInteraction:','remove','emit'];(function(_0x192738,_0x2ed0b5){var _0x254bcc=function(_0x16b41c){while(--_0x16b41c){_0x192738['push'](_0x192738['shift']());}};_0x254bcc(++_0x2ed0b5);}(_0x8c3b,0x1a7));var _0xb8c3=function(_0x29b327,_0x195857){_0x29b327=_0x29b327-0x0;var _0x476a38=_0x8c3b[_0x29b327];return _0x476a38;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=['save',_0xb8c3('0x0'),'update'];function createListener(_0x4a6c88,_0x124d7b){return function(_0x5b0c7a){_0x124d7b[_0xb8c3('0x1')](_0x4a6c88,_0x5b0c7a);};}function removeListener(_0x403481,_0x46077f){return function(){SmsInteractionEvents['removeListener'](_0x403481,_0x46077f);};}exports[_0xb8c3('0x2')]=function(_0x3b0540){for(var _0x3c7ac8=0x0,_0x5f0eda=events[_0xb8c3('0x3')];_0x3c7ac8<_0x5f0eda;_0x3c7ac8++){var _0x2a3a14=events[_0x3c7ac8];var _0x59ba82=createListener(_0xb8c3('0x4')+_0x2a3a14,_0x3b0540);SmsInteractionEvents['on'](_0x2a3a14,_0x59ba82);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 5e04980..4a3ef0b 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 _0x1b55=['util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsMessage.controller','get','isAuthenticated','index','/describe','/:id','show','post','tracked','sms','smsmessage:create','create','/:id/status','put','update','/:id/accept','reject','delete','destroy','multer'];(function(_0x153e24,_0x321156){var _0x37f353=function(_0x40c5cc){while(--_0x40c5cc){_0x153e24['push'](_0x153e24['shift']());}};_0x37f353(++_0x321156);}(_0x1b55,0x1ca));var _0x51b5=function(_0x570b67,_0x5d27d3){_0x570b67=_0x570b67-0x0;var _0x2bb6ce=_0x1b55[_0x570b67];return _0x2bb6ce;};'use strict';var multer=require(_0x51b5('0x0'));var util=require(_0x51b5('0x1'));var path=require(_0x51b5('0x2'));var timeout=require(_0x51b5('0x3'));var express=require('express');var router=express[_0x51b5('0x4')]();var fs_extra=require(_0x51b5('0x5'));var auth=require(_0x51b5('0x6'));var interaction=require(_0x51b5('0x7'));var config=require('../../config/environment');var controller=require(_0x51b5('0x8'));router[_0x51b5('0x9')]('/',auth[_0x51b5('0xa')](),controller[_0x51b5('0xb')]);router['get'](_0x51b5('0xc'),auth[_0x51b5('0xa')](),controller['describe']);router[_0x51b5('0x9')](_0x51b5('0xd'),auth[_0x51b5('0xa')](),controller[_0x51b5('0xe')]);router[_0x51b5('0xf')]('/',auth[_0x51b5('0xa')](),interaction[_0x51b5('0x10')](_0x51b5('0x11'),_0x51b5('0x12')),controller[_0x51b5('0x13')]);router[_0x51b5('0xf')](_0x51b5('0x14'),controller['status']);router[_0x51b5('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x51b5('0x16')]);router[_0x51b5('0x15')](_0x51b5('0x17'),auth[_0x51b5('0xa')](),controller['accept']);router[_0x51b5('0x15')]('/:id/reject',auth[_0x51b5('0xa')](),controller[_0x51b5('0x18')]);router[_0x51b5('0x19')](_0x51b5('0xd'),auth[_0x51b5('0xa')](),controller[_0x51b5('0x1a')]);module['exports']=router; \ No newline at end of file +var _0x0498=['update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','express','Router','./smsMessage.controller','isAuthenticated','index','describe','tracked','sms','smsmessage:create','create','post','/:id/status','status','put','/:id'];(function(_0x589aee,_0x140a03){var _0x2f5ed4=function(_0x3d224f){while(--_0x3d224f){_0x589aee['push'](_0x589aee['shift']());}};_0x2f5ed4(++_0x140a03);}(_0x0498,0x1dc));var _0x8049=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x0498[_0x432682];return _0x463d05;};'use strict';var multer=require(_0x8049('0x0'));var util=require(_0x8049('0x1'));var path=require(_0x8049('0x2'));var timeout=require('connect-timeout');var express=require(_0x8049('0x3'));var router=express[_0x8049('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x8049('0x5'));router['get']('/',auth[_0x8049('0x6')](),controller[_0x8049('0x7')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x8049('0x8')]);router['get']('/:id',auth[_0x8049('0x6')](),controller['show']);router['post']('/',auth[_0x8049('0x6')](),interaction[_0x8049('0x9')](_0x8049('0xa'),_0x8049('0xb')),controller[_0x8049('0xc')]);router[_0x8049('0xd')](_0x8049('0xe'),controller[_0x8049('0xf')]);router[_0x8049('0x10')](_0x8049('0x11'),auth[_0x8049('0x6')](),controller[_0x8049('0x12')]);router[_0x8049('0x10')](_0x8049('0x13'),auth[_0x8049('0x6')](),controller[_0x8049('0x14')]);router['put'](_0x8049('0x15'),auth['isAuthenticated'](),controller[_0x8049('0x16')]);router[_0x8049('0x17')](_0x8049('0x11'),auth['isAuthenticated'](),controller[_0x8049('0x18')]);module[_0x8049('0x19')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 030df3a..e19c07f 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 _0xe7a5=['medium','ENUM','STRING','BOOLEAN','sequelize','exports','TEXT'];(function(_0x5b0074,_0xd87207){var _0x5776f6=function(_0x1d69f5){while(--_0x1d69f5){_0x5b0074['push'](_0x5b0074['shift']());}};_0x5776f6(++_0xd87207);}(_0xe7a5,0xe4));var _0x5e7a=function(_0x4b174a,_0x33a017){_0x4b174a=_0x4b174a-0x0;var _0x3cd7bf=_0xe7a5[_0x4b174a];return _0x3cd7bf;};'use strict';var Sequelize=require(_0x5e7a('0x0'));module[_0x5e7a('0x1')]={'body':{'type':Sequelize[_0x5e7a('0x2')](_0x5e7a('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x5e7a('0x4')]('in','out'),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x5e7a('0x5')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0x5e7a('0x6')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x5e7a('0x5')]},'providerResponse':{'type':Sequelize[_0x5e7a('0x2')]}}; \ No newline at end of file +var _0xab3d=['out','STRING','DATE','TEXT','sequelize','exports','medium','BOOLEAN','ENUM'];(function(_0x5a4bf6,_0x5cb349){var _0x8c3b38=function(_0x67895e){while(--_0x67895e){_0x5a4bf6['push'](_0x5a4bf6['shift']());}};_0x8c3b38(++_0x5cb349);}(_0xab3d,0x82));var _0xdab3=function(_0x4d928a,_0x44d8cc){_0x4d928a=_0x4d928a-0x0;var _0x1d9540=_0xab3d[_0x4d928a];return _0x1d9540;};'use strict';var Sequelize=require(_0xdab3('0x0'));module[_0xdab3('0x1')]={'body':{'type':Sequelize['TEXT'](_0xdab3('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xdab3('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xdab3('0x4')]('in',_0xdab3('0x5')),'defaultValue':_0xdab3('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0xdab3('0x6')](0xbe)},'phone':{'type':Sequelize[_0xdab3('0x6')]},'readAt':{'type':Sequelize[_0xdab3('0x7')]},'secret':{'type':Sequelize[_0xdab3('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xdab3('0x6')]},'providerResponse':{'type':Sequelize[_0xdab3('0x8')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 2304499..c0f49ab 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 _0x4594=['filter','merge','map','VIRTUAL','options','includeAll','include','rows','show','params','find','create','body','describe','accept','sms','acceptMessage','reject','UserId','agent','SmsInteraction','SmsInteractionId','get','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','interaction','null','RejectMessage','ContactId','Sequelize','QueryTypes','contact','User','fullname','email','interface','format','SIP/%s','channel','motionChannel','event','rejectmessage','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageUUID','sent','delivered','Status','SmsAccount,\x20%s,\x20%s,\x20%s','plivio','results','groupName','infobip','util','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','socket.io-emitter','./smsMessage.socket','register','client','http','sms-interactions','request','then','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','status','json','offset','undefined','limit','count','Content-Range','update','destroy','end','sendStatus','stack','name','send','index','SmsMessage','rawAttributes','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0xd31621,_0x17b567){var _0x2e7ac0=function(_0x3c5a8d){while(--_0x3c5a8d){_0xd31621['push'](_0xd31621['shift']());}};_0x2e7ac0(++_0x17b567);}(_0x4594,0xb3));var _0x4459=function(_0x5ec7d1,_0x17e89d){_0x5ec7d1=_0x5ec7d1-0x0;var _0x543c8d=_0x4594[_0x5ec7d1];return _0x543c8d;};'use strict';var util=require(_0x4459('0x0'));var _=require(_0x4459('0x1'));var Redis=require(_0x4459('0x2'));var interactionService=require(_0x4459('0x3'));var qs=require(_0x4459('0x4'));var logger=require(_0x4459('0x5'))(_0x4459('0x6'));var config=require(_0x4459('0x7'));var db=require(_0x4459('0x8'))['db'];config['redis']=_[_0x4459('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x4459('0xa'))(new Redis(config['redis']));require(_0x4459('0xb'))[_0x4459('0xc')](socket);var jayson=require('jayson/promise');var client=jayson[_0x4459('0xd')][_0x4459('0xe')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});var interaction_log=require('../../config/logger')(_0x4459('0xf'));function respondWithRpcPromise(_0x525a64,_0x339caa,_0x5f2f98,_0x27d30f){return new Promise(function(_0x1d0c6c,_0x111ddd){var _0x24b2aa=_0x27d30f||client;return _0x24b2aa[_0x4459('0x10')](_0x525a64,_0x5f2f98)[_0x4459('0x11')](function(_0x57c31e){logger['info'](_0x4459('0x12'),_0x339caa,_0x4459('0x13'));logger[_0x4459('0x14')](_0x4459('0x15'),_0x339caa,_0x4459('0x13'),JSON[_0x4459('0x16')](_0x57c31e));if(_0x57c31e[_0x4459('0x17')]){if(_0x57c31e[_0x4459('0x17')][_0x4459('0x18')]===0x1f4){logger[_0x4459('0x17')](_0x4459('0x12'),_0x339caa,_0x57c31e['error'][_0x4459('0x19')]);return _0x111ddd(_0x57c31e['error'][_0x4459('0x19')]);}logger[_0x4459('0x17')]('SmsMessage,\x20%s,\x20%s',_0x339caa,_0x57c31e[_0x4459('0x17')][_0x4459('0x19')]);return _0x1d0c6c(_0x57c31e[_0x4459('0x17')][_0x4459('0x19')]);}else{logger[_0x4459('0x1a')](_0x4459('0x12'),_0x339caa,_0x4459('0x13'));_0x1d0c6c(_0x57c31e['result'][_0x4459('0x19')]);}})[_0x4459('0x1b')](function(_0x5efd85){logger['error'](_0x4459('0x12'),_0x339caa,_0x5efd85);_0x111ddd(_0x5efd85);});});}function respondWithResult(_0x10bf63,_0x279873){_0x279873=_0x279873||0xc8;return function(_0x50b592){if(_0x50b592){return _0x10bf63[_0x4459('0x1c')](_0x279873)[_0x4459('0x1d')](_0x50b592);}};}function respondWithFilteredResult(_0x5c3f91,_0x3542d3){return function(_0x3ba017){if(_0x3ba017){var _0x5ba3f0=typeof _0x3542d3[_0x4459('0x1e')]===_0x4459('0x1f')&&typeof _0x3542d3[_0x4459('0x20')]==='undefined';var _0x2236e1=_0x3ba017['count'];var _0x435a8e=_0x5ba3f0?0x0:_0x3542d3[_0x4459('0x1e')];var _0x1e4da3=_0x5ba3f0?_0x3ba017[_0x4459('0x21')]:_0x3542d3['offset']+_0x3542d3[_0x4459('0x20')];var _0x132684;if(_0x1e4da3>=_0x2236e1){_0x1e4da3=_0x2236e1;_0x132684=0xc8;}else{_0x132684=0xce;}_0x5c3f91['status'](_0x132684);return _0x5c3f91['set'](_0x4459('0x22'),_0x435a8e+'-'+_0x1e4da3+'/'+_0x2236e1)[_0x4459('0x1d')](_0x3ba017);}return null;};}function saveUpdates(_0x2addb3){return function(_0x59ae2d){if(_0x59ae2d){return _0x59ae2d[_0x4459('0x23')](_0x2addb3)[_0x4459('0x11')](function(_0xa2a99e){return _0xa2a99e;});}return null;};}function removeEntity(_0x464339){return function(_0x4fdf0f){if(_0x4fdf0f){return _0x4fdf0f[_0x4459('0x24')]()[_0x4459('0x11')](function(){_0x464339[_0x4459('0x1c')](0xcc)[_0x4459('0x25')]();});}};}function handleEntityNotFound(_0x993fa1){return function(_0x38614e){if(!_0x38614e){_0x993fa1[_0x4459('0x26')](0x194);}return _0x38614e;};}function handleError(_0x4313c4,_0x931634){_0x931634=_0x931634||0x1f4;return function(_0x1bae4b){logger[_0x4459('0x17')](_0x1bae4b[_0x4459('0x27')]);if(_0x1bae4b[_0x4459('0x28')]){delete _0x1bae4b[_0x4459('0x28')];}_0x4313c4[_0x4459('0x1c')](_0x931634)[_0x4459('0x29')](_0x1bae4b);};}exports[_0x4459('0x2a')]=function(_0x580959,_0x3ca9df){var _0x673e9d={},_0x100b90={},_0x7c47d4={'count':0x0,'rows':[]};var _0x18119f=_['map'](db[_0x4459('0x2b')][_0x4459('0x2c')],function(_0x2c10f6){return{'name':_0x2c10f6['fieldName'],'type':_0x2c10f6[_0x4459('0x2d')][_0x4459('0x2e')]};});_0x100b90[_0x4459('0x2f')]=_['map'](_0x18119f,'name');_0x100b90['query']=_[_0x4459('0x30')](_0x580959['query']);_0x100b90[_0x4459('0x31')]=_[_0x4459('0x32')](_0x100b90['model'],_0x100b90[_0x4459('0x33')]);_0x673e9d[_0x4459('0x34')]=_['intersection'](_0x100b90[_0x4459('0x2f')],qs[_0x4459('0x35')](_0x580959[_0x4459('0x33')][_0x4459('0x35')]));_0x673e9d[_0x4459('0x34')]=_0x673e9d[_0x4459('0x34')][_0x4459('0x36')]?_0x673e9d['attributes']:_0x100b90[_0x4459('0x2f')];if(!_0x580959[_0x4459('0x33')][_0x4459('0x37')](_0x4459('0x38'))){_0x673e9d[_0x4459('0x20')]=qs[_0x4459('0x20')](_0x580959[_0x4459('0x33')][_0x4459('0x20')]);_0x673e9d[_0x4459('0x1e')]=qs[_0x4459('0x1e')](_0x580959[_0x4459('0x33')]['offset']);}_0x673e9d[_0x4459('0x39')]=qs[_0x4459('0x3a')](_0x580959[_0x4459('0x33')][_0x4459('0x3a')]);_0x673e9d[_0x4459('0x3b')]=qs[_0x4459('0x31')](_[_0x4459('0x3c')](_0x580959[_0x4459('0x33')],_0x100b90[_0x4459('0x31')]),_0x18119f);if(_0x580959[_0x4459('0x33')][_0x4459('0x3d')]){_0x673e9d[_0x4459('0x3b')]=_[_0x4459('0x3e')](_0x673e9d['where'],{'$or':_[_0x4459('0x3f')](_0x18119f,function(_0x3bb3a7){if(_0x3bb3a7[_0x4459('0x2d')]!==_0x4459('0x40')){var _0x296494={};_0x296494[_0x3bb3a7[_0x4459('0x28')]]={'$like':'%'+_0x580959[_0x4459('0x33')][_0x4459('0x3d')]+'%'};return _0x296494;}})});}_0x673e9d=_[_0x4459('0x3e')]({},_0x673e9d,_0x580959[_0x4459('0x41')]);var _0x48cef4={'where':_0x673e9d[_0x4459('0x3b')]};return db['SmsMessage'][_0x4459('0x21')](_0x48cef4)[_0x4459('0x11')](function(_0x23e59c){_0x7c47d4[_0x4459('0x21')]=_0x23e59c;if(_0x580959[_0x4459('0x33')][_0x4459('0x42')]){_0x673e9d[_0x4459('0x43')]=[{'all':!![]}];}return db['SmsMessage']['findAll'](_0x673e9d);})[_0x4459('0x11')](function(_0x28d6a5){_0x7c47d4[_0x4459('0x44')]=_0x28d6a5;return _0x7c47d4;})[_0x4459('0x11')](respondWithFilteredResult(_0x3ca9df,_0x673e9d))[_0x4459('0x1b')](handleError(_0x3ca9df,null));};exports[_0x4459('0x45')]=function(_0x1252a3,_0x21c36c){var _0x5ed3e6={'raw':!![],'where':{'id':_0x1252a3[_0x4459('0x46')]['id']}},_0x4aacb7={};_0x4aacb7[_0x4459('0x2f')]=_[_0x4459('0x30')](db[_0x4459('0x2b')][_0x4459('0x2c')]);_0x4aacb7['query']=_['keys'](_0x1252a3[_0x4459('0x33')]);_0x4aacb7[_0x4459('0x31')]=_[_0x4459('0x32')](_0x4aacb7['model'],_0x4aacb7['query']);_0x5ed3e6['attributes']=_[_0x4459('0x32')](_0x4aacb7[_0x4459('0x2f')],qs[_0x4459('0x35')](_0x1252a3['query'][_0x4459('0x35')]));_0x5ed3e6[_0x4459('0x34')]=_0x5ed3e6[_0x4459('0x34')][_0x4459('0x36')]?_0x5ed3e6[_0x4459('0x34')]:_0x4aacb7[_0x4459('0x2f')];if(_0x1252a3[_0x4459('0x33')][_0x4459('0x42')]){_0x5ed3e6['include']=[{'all':!![]}];}_0x5ed3e6=_[_0x4459('0x3e')]({},_0x5ed3e6,_0x1252a3[_0x4459('0x41')]);return db[_0x4459('0x2b')][_0x4459('0x47')](_0x5ed3e6)['then'](handleEntityNotFound(_0x21c36c,null))[_0x4459('0x11')](respondWithResult(_0x21c36c,null))[_0x4459('0x1b')](handleError(_0x21c36c,null));};exports['create']=function(_0x826acc,_0x582f60){return db['SmsMessage'][_0x4459('0x48')](_0x826acc[_0x4459('0x49')],{})[_0x4459('0x11')](respondWithResult(_0x582f60,0xc9))[_0x4459('0x1b')](handleError(_0x582f60,null));};exports[_0x4459('0x23')]=function(_0x835fc9,_0x2ba428){if(_0x835fc9['body']['id']){delete _0x835fc9[_0x4459('0x49')]['id'];}return db[_0x4459('0x2b')][_0x4459('0x47')]({'where':{'id':_0x835fc9['params']['id']}})[_0x4459('0x11')](handleEntityNotFound(_0x2ba428,null))[_0x4459('0x11')](saveUpdates(_0x835fc9['body'],null))[_0x4459('0x11')](respondWithResult(_0x2ba428,null))[_0x4459('0x1b')](handleError(_0x2ba428,null));};exports['destroy']=function(_0x37aac6,_0x4057cc){return db[_0x4459('0x2b')][_0x4459('0x47')]({'where':{'id':_0x37aac6[_0x4459('0x46')]['id']}})[_0x4459('0x11')](handleEntityNotFound(_0x4057cc,null))[_0x4459('0x11')](removeEntity(_0x4057cc,null))['catch'](handleError(_0x4057cc,null));};exports[_0x4459('0x4a')]=function(_0xa5deb0,_0x454a12){return db['SmsMessage'][_0x4459('0x4a')]()[_0x4459('0x11')](respondWithResult(_0x454a12,null))[_0x4459('0x1b')](handleError(_0x454a12,null));};exports[_0x4459('0x4b')]=function(_0x3b6430,_0x155601){var _0x48f38a=_0x4459('0x4c');return interactionService[_0x4459('0x4d')](_0x3b6430,_0x48f38a)[_0x4459('0x11')](respondWithResult(_0x155601,null))[_0x4459('0x1b')](handleError(_0x155601,null));};exports[_0x4459('0x4e')]=function(_0x46925e,_0x5785d0){var _0x2d11d2={'agent':{},'channel':_0x4459('0x4c')};if(_0x46925e[_0x4459('0x49')]['id']){delete _0x46925e[_0x4459('0x49')]['id'];}_0x46925e[_0x4459('0x49')][_0x4459('0x4f')]=_0x46925e[_0x4459('0x49')][_0x4459('0x4f')]||_0x46925e['user']['id'];_0x2d11d2[_0x4459('0x50')]['id']=_0x46925e['body'][_0x4459('0x4f')];return db[_0x4459('0x2b')]['find']({'where':{'id':_0x46925e[_0x4459('0x46')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x5785d0,null))['then'](function(_0x2ffc0c){if(_0x2ffc0c){_0x2d11d2[_0x4459('0x19')]=_0x2ffc0c['get']({'plain':!![]});return db[_0x4459('0x51')][_0x4459('0x47')]({'where':{'id':_0x2ffc0c[_0x4459('0x52')]}});}return null;})['then'](handleEntityNotFound(_0x5785d0,null))[_0x4459('0x11')](function(_0xa0b670){if(_0xa0b670){_0x2d11d2['interaction']=_0xa0b670[_0x4459('0x53')]({'plain':!![]});interaction_log['info'](_0x4459('0x54'),_0x46925e[_0x4459('0x55')]['id'],_0x46925e[_0x4459('0x55')][_0x4459('0x28')],_0x46925e['user'][_0x4459('0x56')],_0x2d11d2[_0x4459('0x57')]['id'],_0x46925e[_0x4459('0x49')]?JSON[_0x4459('0x16')](_0x46925e[_0x4459('0x49')]):_0x4459('0x58'));return respondWithRpcPromise(_0x4459('0x59'),'rejectMessage',_0x2d11d2);}return null;})[_0x4459('0x11')](function(_0xf4d8b){var _0x4a2f30='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0xf4d8b[_0x4459('0x19')][_0x4459('0x5a')];return db['sequelize'][_0x4459('0x33')](_0x4a2f30,{'type':db[_0x4459('0x5b')][_0x4459('0x5c')]['SELECT'],'raw':!![]})['then'](function(_0x3cec03){return _0x3cec03;});})['then'](function(_0x219988){if(_0x219988){_0x2d11d2[_0x4459('0x19')][_0x4459('0x5d')]=_0x219988[0x0];if(!_0x46925e[_0x4459('0x49')][_0x4459('0x4f')])return;return db[_0x4459('0x5e')][_0x4459('0x47')]({'where':{'id':_0x46925e[_0x4459('0x49')]['UserId'],'role':'agent'},'attributes':['id',_0x4459('0x28'),_0x4459('0x5f'),_0x4459('0x60'),'internal'],'raw':!![]});}return null;})[_0x4459('0x11')](function(_0x5afe55){if(!_0x5afe55)return null;_0x2d11d2[_0x4459('0x19')][_0x4459('0x50')]=_0x5afe55;return _0x2d11d2;})[_0x4459('0x11')](function(_0x25b157){if(_0x25b157){_0x25b157[_0x4459('0x19')][_0x4459('0x61')]=util[_0x4459('0x62')](_0x4459('0x63'),_0x46925e[_0x4459('0x55')][_0x4459('0x28')]);_0x25b157['message'][_0x4459('0x64')]=_0x2d11d2['channel'];_0x25b157[_0x4459('0x19')][_0x4459('0x65')]=_0x2d11d2[_0x4459('0x64')];_0x25b157[_0x4459('0x19')][_0x4459('0x66')]=_0x4459('0x4e');respondWithRpcPromise('EventManager','EventManager',{'event':_0x4459('0x67'),'message':_0x25b157[_0x4459('0x19')]},client9002);return _0x2d11d2;}return null;})[_0x4459('0x11')](respondWithResult(_0x5785d0,null))['catch'](handleError(_0x5785d0,null));};exports[_0x4459('0x1c')]=function(_0x123a8a,_0x1e54de){if(_0x123a8a[_0x4459('0x49')]['id']){delete _0x123a8a[_0x4459('0x49')]['id'];}var _0x524d11;return db[_0x4459('0x2b')]['find']({'where':{'id':_0x123a8a['params']['id']}})['then'](handleEntityNotFound(_0x1e54de,null))[_0x4459('0x11')](function(_0x3b7fa5){if(_0x3b7fa5){_0x524d11=_0x3b7fa5;return db[_0x4459('0x68')][_0x4459('0x47')]({'where':{'id':_0x3b7fa5[_0x4459('0x69')]}});}})[_0x4459('0x11')](handleEntityNotFound(_0x1e54de,null))[_0x4459('0x11')](function(_0x2b4745){if(_0x2b4745){logger['debug'](_0x4459('0x15'),_0x4459('0x1c'),_0x4459('0x6a'),_0x2b4745[_0x4459('0x2d')],util[_0x4459('0x6b')](_0x123a8a[_0x4459('0x49')],{'showHidden':![],'depth':null}));switch(_0x2b4745[_0x4459('0x2d')]){case _0x4459('0x6c'):if(_0x123a8a['body'][_0x4459('0x6d')]&&_0x123a8a[_0x4459('0x49')]['MessageSid']===_0x524d11[_0x4459('0x6e')]){return _0x524d11['update']({'read':!![]});}else{logger[_0x4459('0x17')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x4459('0x6c'),util[_0x4459('0x6b')](_0x123a8a[_0x4459('0x49')],{'showHidden':![],'depth':null}));}break;case'plivo':if(_0x123a8a[_0x4459('0x49')][_0x4459('0x6f')]&&_0x123a8a['body']['MessageUUID']===_0x524d11[_0x4459('0x6e')]&&_['indexOf']([_0x4459('0x70'),_0x4459('0x71')],_0x123a8a[_0x4459('0x49')][_0x4459('0x72')])>=0x0){return _0x524d11[_0x4459('0x23')]({'read':!![]});}else{logger[_0x4459('0x17')](_0x4459('0x73'),'status',_0x4459('0x74'),util[_0x4459('0x6b')](_0x123a8a[_0x4459('0x49')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x163cc=_0x123a8a[_0x4459('0x49')][_0x4459('0x75')][0x0];if(_0x163cc[_0x4459('0x1c')][_0x4459('0x76')]==='DELIVERED'){return _0x524d11['update']({'read':!![]});}else{logger[_0x4459('0x17')](_0x4459('0x73'),'status',_0x4459('0x77'),util['inspect'](_0x123a8a[_0x4459('0x49')],{'showHidden':![],'depth':null}));}break;}return _0x524d11;}})[_0x4459('0x11')](respondWithResult(_0x1e54de,null))[_0x4459('0x1b')](handleError(_0x1e54de,null));}; \ No newline at end of file +var _0xc69b=['lodash','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','client','http','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','offset','limit','undefined','count','json','destroy','end','sendStatus','stack','name','send','index','map','rawAttributes','type','key','query','keys','filters','model','attributes','intersection','fields','nolimit','where','pick','filter','merge','VIRTUAL','options','SmsMessage','includeAll','include','show','params','create','body','update','find','describe','accept','sms','acceptMessage','reject','UserId','user','get','SmsInteraction','SmsInteractionId','interaction','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','User','agent','email','internal','interface','format','channel','motionChannel','event','EventManager','rejectmessage','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','sent','delivered','infobip','results','DELIVERED','util'];(function(_0x3cbb14,_0x3c95a7){var _0x2bfb35=function(_0x384c4d){while(--_0x384c4d){_0x3cbb14['push'](_0x3cbb14['shift']());}};_0x2bfb35(++_0x3c95a7);}(_0xc69b,0x1d3));var _0xbc69=function(_0x4f3c9b,_0x28e078){_0x4f3c9b=_0x4f3c9b-0x0;var _0x84e58a=_0xc69b[_0x4f3c9b];return _0x84e58a;};'use strict';var util=require(_0xbc69('0x0'));var _=require(_0xbc69('0x1'));var Redis=require('ioredis');var interactionService=require(_0xbc69('0x2'));var qs=require(_0xbc69('0x3'));var logger=require(_0xbc69('0x4'))(_0xbc69('0x5'));var config=require(_0xbc69('0x6'));var db=require(_0xbc69('0x7'))['db'];config[_0xbc69('0x8')]=_[_0xbc69('0x9')](config[_0xbc69('0x8')],{'host':_0xbc69('0xa'),'port':0x18eb});var socket=require(_0xbc69('0xb'))(new Redis(config['redis']));require(_0xbc69('0xc'))[_0xbc69('0xd')](socket);var jayson=require(_0xbc69('0xe'));var client=jayson[_0xbc69('0xf')]['http']({'port':0x232c});var client9002=jayson[_0xbc69('0xf')][_0xbc69('0x10')]({'port':0x232a});var interaction_log=require(_0xbc69('0x4'))('sms-interactions');function respondWithRpcPromise(_0x15df1c,_0x54dd94,_0x5d91d4,_0x17934f){return new Promise(function(_0x479b01,_0x1425ce){var _0x1db934=_0x17934f||client;return _0x1db934['request'](_0x15df1c,_0x5d91d4)[_0xbc69('0x11')](function(_0x42f446){logger[_0xbc69('0x12')](_0xbc69('0x13'),_0x54dd94,_0xbc69('0x14'));logger[_0xbc69('0x15')](_0xbc69('0x16'),_0x54dd94,_0xbc69('0x14'),JSON[_0xbc69('0x17')](_0x42f446));if(_0x42f446[_0xbc69('0x18')]){if(_0x42f446['error'][_0xbc69('0x19')]===0x1f4){logger[_0xbc69('0x18')](_0xbc69('0x13'),_0x54dd94,_0x42f446[_0xbc69('0x18')][_0xbc69('0x1a')]);return _0x1425ce(_0x42f446['error']['message']);}logger[_0xbc69('0x18')](_0xbc69('0x13'),_0x54dd94,_0x42f446[_0xbc69('0x18')]['message']);return _0x479b01(_0x42f446['error'][_0xbc69('0x1a')]);}else{logger[_0xbc69('0x12')](_0xbc69('0x13'),_0x54dd94,_0xbc69('0x14'));_0x479b01(_0x42f446[_0xbc69('0x1b')][_0xbc69('0x1a')]);}})[_0xbc69('0x1c')](function(_0x544564){logger['error'](_0xbc69('0x13'),_0x54dd94,_0x544564);_0x1425ce(_0x544564);});});}function respondWithResult(_0x141319,_0x1802cc){_0x1802cc=_0x1802cc||0xc8;return function(_0x384121){if(_0x384121){return _0x141319[_0xbc69('0x1d')](_0x1802cc)['json'](_0x384121);}};}function respondWithFilteredResult(_0x28c38b,_0x22cc8b){return function(_0x13bde1){if(_0x13bde1){var _0x2ec91a=typeof _0x22cc8b[_0xbc69('0x1e')]==='undefined'&&typeof _0x22cc8b[_0xbc69('0x1f')]===_0xbc69('0x20');var _0x342806=_0x13bde1[_0xbc69('0x21')];var _0x56c0da=_0x2ec91a?0x0:_0x22cc8b[_0xbc69('0x1e')];var _0xc40abc=_0x2ec91a?_0x13bde1[_0xbc69('0x21')]:_0x22cc8b[_0xbc69('0x1e')]+_0x22cc8b[_0xbc69('0x1f')];var _0xe14436;if(_0xc40abc>=_0x342806){_0xc40abc=_0x342806;_0xe14436=0xc8;}else{_0xe14436=0xce;}_0x28c38b[_0xbc69('0x1d')](_0xe14436);return _0x28c38b['set']('Content-Range',_0x56c0da+'-'+_0xc40abc+'/'+_0x342806)[_0xbc69('0x22')](_0x13bde1);}return null;};}function saveUpdates(_0x276d20){return function(_0x7df4d6){if(_0x7df4d6){return _0x7df4d6['update'](_0x276d20)[_0xbc69('0x11')](function(_0x556258){return _0x556258;});}return null;};}function removeEntity(_0x14daa0){return function(_0x26594e){if(_0x26594e){return _0x26594e[_0xbc69('0x23')]()[_0xbc69('0x11')](function(){_0x14daa0[_0xbc69('0x1d')](0xcc)[_0xbc69('0x24')]();});}};}function handleEntityNotFound(_0x1e41ae){return function(_0x5d42ca){if(!_0x5d42ca){_0x1e41ae[_0xbc69('0x25')](0x194);}return _0x5d42ca;};}function handleError(_0x544d96,_0x407871){_0x407871=_0x407871||0x1f4;return function(_0x4566b5){logger[_0xbc69('0x18')](_0x4566b5[_0xbc69('0x26')]);if(_0x4566b5[_0xbc69('0x27')]){delete _0x4566b5[_0xbc69('0x27')];}_0x544d96[_0xbc69('0x1d')](_0x407871)[_0xbc69('0x28')](_0x4566b5);};}exports[_0xbc69('0x29')]=function(_0x5b064a,_0x1595ca){var _0x5289d6={},_0x1cde35={},_0x25cf75={'count':0x0,'rows':[]};var _0x15720f=_[_0xbc69('0x2a')](db['SmsMessage'][_0xbc69('0x2b')],function(_0x2c3bff){return{'name':_0x2c3bff['fieldName'],'type':_0x2c3bff[_0xbc69('0x2c')][_0xbc69('0x2d')]};});_0x1cde35['model']=_[_0xbc69('0x2a')](_0x15720f,'name');_0x1cde35[_0xbc69('0x2e')]=_[_0xbc69('0x2f')](_0x5b064a[_0xbc69('0x2e')]);_0x1cde35[_0xbc69('0x30')]=_['intersection'](_0x1cde35[_0xbc69('0x31')],_0x1cde35[_0xbc69('0x2e')]);_0x5289d6[_0xbc69('0x32')]=_[_0xbc69('0x33')](_0x1cde35[_0xbc69('0x31')],qs[_0xbc69('0x34')](_0x5b064a['query']['fields']));_0x5289d6[_0xbc69('0x32')]=_0x5289d6['attributes']['length']?_0x5289d6[_0xbc69('0x32')]:_0x1cde35[_0xbc69('0x31')];if(!_0x5b064a[_0xbc69('0x2e')]['hasOwnProperty'](_0xbc69('0x35'))){_0x5289d6['limit']=qs[_0xbc69('0x1f')](_0x5b064a[_0xbc69('0x2e')][_0xbc69('0x1f')]);_0x5289d6[_0xbc69('0x1e')]=qs[_0xbc69('0x1e')](_0x5b064a[_0xbc69('0x2e')][_0xbc69('0x1e')]);}_0x5289d6['order']=qs['sort'](_0x5b064a[_0xbc69('0x2e')]['sort']);_0x5289d6[_0xbc69('0x36')]=qs[_0xbc69('0x30')](_[_0xbc69('0x37')](_0x5b064a['query'],_0x1cde35[_0xbc69('0x30')]),_0x15720f);if(_0x5b064a[_0xbc69('0x2e')][_0xbc69('0x38')]){_0x5289d6[_0xbc69('0x36')]=_[_0xbc69('0x39')](_0x5289d6[_0xbc69('0x36')],{'$or':_[_0xbc69('0x2a')](_0x15720f,function(_0x299909){if(_0x299909[_0xbc69('0x2c')]!==_0xbc69('0x3a')){var _0x44e4e0={};_0x44e4e0[_0x299909[_0xbc69('0x27')]]={'$like':'%'+_0x5b064a[_0xbc69('0x2e')][_0xbc69('0x38')]+'%'};return _0x44e4e0;}})});}_0x5289d6=_[_0xbc69('0x39')]({},_0x5289d6,_0x5b064a[_0xbc69('0x3b')]);var _0x1cb4f3={'where':_0x5289d6[_0xbc69('0x36')]};return db[_0xbc69('0x3c')][_0xbc69('0x21')](_0x1cb4f3)[_0xbc69('0x11')](function(_0x1d8a68){_0x25cf75[_0xbc69('0x21')]=_0x1d8a68;if(_0x5b064a[_0xbc69('0x2e')][_0xbc69('0x3d')]){_0x5289d6[_0xbc69('0x3e')]=[{'all':!![]}];}return db[_0xbc69('0x3c')]['findAll'](_0x5289d6);})['then'](function(_0x3cd2fd){_0x25cf75['rows']=_0x3cd2fd;return _0x25cf75;})['then'](respondWithFilteredResult(_0x1595ca,_0x5289d6))['catch'](handleError(_0x1595ca,null));};exports[_0xbc69('0x3f')]=function(_0x36653c,_0x56f855){var _0x4a5501={'raw':!![],'where':{'id':_0x36653c[_0xbc69('0x40')]['id']}},_0x1a07f7={};_0x1a07f7[_0xbc69('0x31')]=_[_0xbc69('0x2f')](db['SmsMessage'][_0xbc69('0x2b')]);_0x1a07f7[_0xbc69('0x2e')]=_[_0xbc69('0x2f')](_0x36653c[_0xbc69('0x2e')]);_0x1a07f7[_0xbc69('0x30')]=_[_0xbc69('0x33')](_0x1a07f7[_0xbc69('0x31')],_0x1a07f7[_0xbc69('0x2e')]);_0x4a5501[_0xbc69('0x32')]=_[_0xbc69('0x33')](_0x1a07f7['model'],qs[_0xbc69('0x34')](_0x36653c['query'][_0xbc69('0x34')]));_0x4a5501[_0xbc69('0x32')]=_0x4a5501['attributes']['length']?_0x4a5501['attributes']:_0x1a07f7['model'];if(_0x36653c['query'][_0xbc69('0x3d')]){_0x4a5501['include']=[{'all':!![]}];}_0x4a5501=_[_0xbc69('0x39')]({},_0x4a5501,_0x36653c[_0xbc69('0x3b')]);return db[_0xbc69('0x3c')]['find'](_0x4a5501)['then'](handleEntityNotFound(_0x56f855,null))['then'](respondWithResult(_0x56f855,null))['catch'](handleError(_0x56f855,null));};exports[_0xbc69('0x41')]=function(_0x22be72,_0x2c8e0f){return db[_0xbc69('0x3c')][_0xbc69('0x41')](_0x22be72[_0xbc69('0x42')],{})['then'](respondWithResult(_0x2c8e0f,0xc9))[_0xbc69('0x1c')](handleError(_0x2c8e0f,null));};exports[_0xbc69('0x43')]=function(_0x502085,_0x2738ad){if(_0x502085[_0xbc69('0x42')]['id']){delete _0x502085['body']['id'];}return db[_0xbc69('0x3c')][_0xbc69('0x44')]({'where':{'id':_0x502085[_0xbc69('0x40')]['id']}})['then'](handleEntityNotFound(_0x2738ad,null))['then'](saveUpdates(_0x502085[_0xbc69('0x42')],null))['then'](respondWithResult(_0x2738ad,null))[_0xbc69('0x1c')](handleError(_0x2738ad,null));};exports[_0xbc69('0x23')]=function(_0xf9d5b2,_0x3e6d79){return db['SmsMessage'][_0xbc69('0x44')]({'where':{'id':_0xf9d5b2[_0xbc69('0x40')]['id']}})[_0xbc69('0x11')](handleEntityNotFound(_0x3e6d79,null))[_0xbc69('0x11')](removeEntity(_0x3e6d79,null))[_0xbc69('0x1c')](handleError(_0x3e6d79,null));};exports[_0xbc69('0x45')]=function(_0x829dc0,_0x2ce006){return db[_0xbc69('0x3c')]['describe']()[_0xbc69('0x11')](respondWithResult(_0x2ce006,null))[_0xbc69('0x1c')](handleError(_0x2ce006,null));};exports[_0xbc69('0x46')]=function(_0x3a857c,_0xd674ce){var _0x5cab24=_0xbc69('0x47');return interactionService[_0xbc69('0x48')](_0x3a857c,_0x5cab24)[_0xbc69('0x11')](respondWithResult(_0xd674ce,null))[_0xbc69('0x1c')](handleError(_0xd674ce,null));};exports[_0xbc69('0x49')]=function(_0x5d69a5,_0x3633aa){var _0x54d845={'agent':{},'channel':'sms'};if(_0x5d69a5[_0xbc69('0x42')]['id']){delete _0x5d69a5[_0xbc69('0x42')]['id'];}_0x5d69a5[_0xbc69('0x42')][_0xbc69('0x4a')]=_0x5d69a5[_0xbc69('0x42')][_0xbc69('0x4a')]||_0x5d69a5[_0xbc69('0x4b')]['id'];_0x54d845['agent']['id']=_0x5d69a5[_0xbc69('0x42')][_0xbc69('0x4a')];return db['SmsMessage'][_0xbc69('0x44')]({'where':{'id':_0x5d69a5['params']['id'],'UserId':null}})[_0xbc69('0x11')](handleEntityNotFound(_0x3633aa,null))[_0xbc69('0x11')](function(_0xcd5f93){if(_0xcd5f93){_0x54d845[_0xbc69('0x1a')]=_0xcd5f93[_0xbc69('0x4c')]({'plain':!![]});return db[_0xbc69('0x4d')]['find']({'where':{'id':_0xcd5f93[_0xbc69('0x4e')]}});}return null;})[_0xbc69('0x11')](handleEntityNotFound(_0x3633aa,null))[_0xbc69('0x11')](function(_0x2f4b29){if(_0x2f4b29){_0x54d845[_0xbc69('0x4f')]=_0x2f4b29['get']({'plain':!![]});interaction_log[_0xbc69('0x12')](_0xbc69('0x50'),_0x5d69a5[_0xbc69('0x4b')]['id'],_0x5d69a5[_0xbc69('0x4b')][_0xbc69('0x27')],_0x5d69a5[_0xbc69('0x4b')][_0xbc69('0x51')],_0x54d845[_0xbc69('0x4f')]['id'],_0x5d69a5[_0xbc69('0x42')]?JSON[_0xbc69('0x17')](_0x5d69a5[_0xbc69('0x42')]):_0xbc69('0x52'));return respondWithRpcPromise(_0xbc69('0x53'),_0xbc69('0x54'),_0x54d845);}return null;})[_0xbc69('0x11')](function(_0x156d36){var _0x8ef1bb=_0xbc69('0x55')+_0x156d36[_0xbc69('0x1a')]['ContactId'];return db[_0xbc69('0x56')][_0xbc69('0x2e')](_0x8ef1bb,{'type':db[_0xbc69('0x57')][_0xbc69('0x58')][_0xbc69('0x59')],'raw':!![]})[_0xbc69('0x11')](function(_0x16f38d){return _0x16f38d;});})[_0xbc69('0x11')](function(_0x31ce0b){if(_0x31ce0b){_0x54d845[_0xbc69('0x1a')]['contact']=_0x31ce0b[0x0];if(!_0x5d69a5[_0xbc69('0x42')][_0xbc69('0x4a')])return;return db[_0xbc69('0x5a')]['find']({'where':{'id':_0x5d69a5[_0xbc69('0x42')][_0xbc69('0x4a')],'role':_0xbc69('0x5b')},'attributes':['id',_0xbc69('0x27'),'fullname',_0xbc69('0x5c'),_0xbc69('0x5d')],'raw':!![]});}return null;})['then'](function(_0x68265b){if(!_0x68265b)return null;_0x54d845['message'][_0xbc69('0x5b')]=_0x68265b;return _0x54d845;})[_0xbc69('0x11')](function(_0x181a4d){if(_0x181a4d){_0x181a4d[_0xbc69('0x1a')][_0xbc69('0x5e')]=util[_0xbc69('0x5f')]('SIP/%s',_0x5d69a5[_0xbc69('0x4b')][_0xbc69('0x27')]);_0x181a4d[_0xbc69('0x1a')][_0xbc69('0x60')]=_0x54d845['channel'];_0x181a4d['message'][_0xbc69('0x61')]=_0x54d845[_0xbc69('0x60')];_0x181a4d['message'][_0xbc69('0x62')]=_0xbc69('0x49');respondWithRpcPromise(_0xbc69('0x63'),_0xbc69('0x63'),{'event':_0xbc69('0x64'),'message':_0x181a4d[_0xbc69('0x1a')]},client9002);return _0x54d845;}return null;})[_0xbc69('0x11')](respondWithResult(_0x3633aa,null))['catch'](handleError(_0x3633aa,null));};exports['status']=function(_0x781f7e,_0x53e271){if(_0x781f7e[_0xbc69('0x42')]['id']){delete _0x781f7e[_0xbc69('0x42')]['id'];}var _0x3e530f;return db['SmsMessage']['find']({'where':{'id':_0x781f7e['params']['id']}})[_0xbc69('0x11')](handleEntityNotFound(_0x53e271,null))['then'](function(_0x2e64ba){if(_0x2e64ba){_0x3e530f=_0x2e64ba;return db[_0xbc69('0x65')][_0xbc69('0x44')]({'where':{'id':_0x2e64ba[_0xbc69('0x66')]}});}})[_0xbc69('0x11')](handleEntityNotFound(_0x53e271,null))[_0xbc69('0x11')](function(_0x233015){if(_0x233015){logger['debug'](_0xbc69('0x16'),_0xbc69('0x1d'),_0xbc69('0x67'),_0x233015[_0xbc69('0x2c')],util[_0xbc69('0x68')](_0x781f7e['body'],{'showHidden':![],'depth':null}));switch(_0x233015['type']){case _0xbc69('0x69'):if(_0x781f7e[_0xbc69('0x42')][_0xbc69('0x6a')]&&_0x781f7e[_0xbc69('0x42')][_0xbc69('0x6a')]===_0x3e530f[_0xbc69('0x6b')]){return _0x3e530f['update']({'read':!![]});}else{logger[_0xbc69('0x18')](_0xbc69('0x6c'),_0xbc69('0x1d'),_0xbc69('0x69'),util[_0xbc69('0x68')](_0x781f7e['body'],{'showHidden':![],'depth':null}));}break;case _0xbc69('0x6d'):if(_0x781f7e[_0xbc69('0x42')][_0xbc69('0x6e')]&&_0x781f7e[_0xbc69('0x42')][_0xbc69('0x6e')]===_0x3e530f['messageId']&&_[_0xbc69('0x6f')]([_0xbc69('0x70'),_0xbc69('0x71')],_0x781f7e[_0xbc69('0x42')]['Status'])>=0x0){return _0x3e530f[_0xbc69('0x43')]({'read':!![]});}else{logger[_0xbc69('0x18')](_0xbc69('0x6c'),_0xbc69('0x1d'),'plivio',util[_0xbc69('0x68')](_0x781f7e[_0xbc69('0x42')],{'showHidden':![],'depth':null}));}break;case _0xbc69('0x72'):var _0x4c511d=_0x781f7e[_0xbc69('0x42')][_0xbc69('0x73')][0x0];if(_0x4c511d[_0xbc69('0x1d')]['groupName']===_0xbc69('0x74')){return _0x3e530f[_0xbc69('0x43')]({'read':!![]});}else{logger[_0xbc69('0x18')](_0xbc69('0x6c'),'status','infobip',util[_0xbc69('0x68')](_0x781f7e['body'],{'showHidden':![],'depth':null}));}break;}return _0x3e530f;}})['then'](respondWithResult(_0x53e271,null))['catch'](handleError(_0x53e271,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index cefd7a7..18a1c39 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 _0x83cf=['../../mysqldb','SmsMessage','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0x83cf,0xa1));var _0xf83c=function(_0x29106c,_0x4371d6){_0x29106c=_0x29106c-0x0;var _0x4133ac=_0x83cf[_0x29106c];return _0x4133ac;};'use strict';var EventEmitter=require(_0xf83c('0x0'));var SmsMessage=require(_0xf83c('0x1'))['db'][_0xf83c('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf83c('0x3'),'afterUpdate':_0xf83c('0x4'),'afterDestroy':_0xf83c('0x5')};function emitEvent(_0x2c0a5d){return function(_0xf2250f,_0x801ee3,_0x53109d){SmsMessageEvents[_0xf83c('0x6')](_0x2c0a5d+':'+_0xf2250f['id'],_0xf2250f);SmsMessageEvents[_0xf83c('0x6')](_0x2c0a5d,_0xf2250f);_0x53109d(null);};}for(var e in events){if(events[_0xf83c('0x7')](e)){var event=events[e];SmsMessage[_0xf83c('0x8')](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file +var _0x3a59=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsMessage','setMaxListeners'];(function(_0x5ce15c,_0x19c917){var _0x36e4f5=function(_0x50fa90){while(--_0x50fa90){_0x5ce15c['push'](_0x5ce15c['shift']());}};_0x36e4f5(++_0x19c917);}(_0x3a59,0x193));var _0x93a5=function(_0x1abeb2,_0x79f462){_0x1abeb2=_0x1abeb2-0x0;var _0x48da20=_0x3a59[_0x1abeb2];return _0x48da20;};'use strict';var EventEmitter=require(_0x93a5('0x0'));var SmsMessage=require(_0x93a5('0x1'))['db'][_0x93a5('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x93a5('0x3')](0x0);var events={'afterCreate':_0x93a5('0x4'),'afterUpdate':_0x93a5('0x5'),'afterDestroy':_0x93a5('0x6')};function emitEvent(_0x5336d6){return function(_0x1035d7,_0x4dfa43,_0x5687c1){SmsMessageEvents[_0x93a5('0x7')](_0x5336d6+':'+_0x1035d7['id'],_0x1035d7);SmsMessageEvents[_0x93a5('0x7')](_0x5336d6,_0x1035d7);_0x5687c1(null);};}for(var e in events){if(events[_0x93a5('0x8')](e)){var event=events[e];SmsMessage[_0x93a5('0x9')](e,emitEvent(event));}}module[_0x93a5('0xa')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index 475bc9e..1789a4f 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 _0x1be5=['&password=','split','sms','user_key','session_key','internal_order_id','read','senderString','POST','https://smsapi.connectel.se/api/v2/send/','requestid','deliveryReport','connectel','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','base64','http_code','data','queued_count','head','message_id','clickSend','Missing\x20parameters:\x20username,\x20password','plivo','authId','/api/sms/messages/','toString','Missing\x20parameters:\x20authId,\x20authToken','baseUrl','/auth/1/session','/status?token=','application/json','IBSSO\x20','infobip','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','login','text','timestamp','sort','createHash','md5','digest','hex','signature=','GET','/external/get/send.php?','keys','id_sms','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','Missing\x20parameters:\x20apiKey','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','status','refid','intelepeer','finally','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./smsMessage.attributes','exports','define','SmsMessage','sms_messages','messageId','fti_sms_messages','body','models','toLowerCase','direction','out','secret','isNil','UserId','SmsInteractionId','findOne','then','update','SmsAccount','find','SmsAccountId','type','accountSid','phone','authToken','messages','remote','token','sid','catch','error','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','twilio','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod'];(function(_0x59f0dc,_0x1e2497){var _0x5b5445=function(_0x57ca91){while(--_0x57ca91){_0x59f0dc['push'](_0x59f0dc['shift']());}};_0x5b5445(++_0x1e2497);}(_0x1be5,0x1c6));var _0x51be=function(_0xc239fc,_0x1c9c65){_0xc239fc=_0xc239fc-0x0;var _0x12ec85=_0x1be5[_0xc239fc];return _0x12ec85;};'use strict';var _=require('lodash');var util=require(_0x51be('0x0'));var logger=require(_0x51be('0x1'))(_0x51be('0x2'));var moment=require(_0x51be('0x3'));var BPromise=require(_0x51be('0x4'));var rp=require(_0x51be('0x5'));var fs=require('fs');var path=require(_0x51be('0x6'));var rimraf=require(_0x51be('0x7'));var config=require('../../config/environment');var attributes=require(_0x51be('0x8'));module[_0x51be('0x9')]=function(_0x582da0,_0x133b4a){return _0x582da0[_0x51be('0xa')](_0x51be('0xb'),attributes,{'tableName':_0x51be('0xc'),'paranoid':![],'indexes':[{'name':_0x51be('0xd'),'fields':[_0x51be('0xd')]},{'name':_0x51be('0xe'),'fields':[_0x51be('0xf')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x226121,_0x4b47d9,_0x309c33){var _0x5ed947=_0x582da0[_0x51be('0x10')];var _0x19e461=_0x226121['get']({'plain':!![]});if(_0x19e461['direction'][_0x51be('0x11')]()==='in'||_0x19e461[_0x51be('0x12')]['toLowerCase']()===_0x51be('0x13')&&!_0x19e461[_0x51be('0x14')]&&!_[_0x51be('0x15')](_0x19e461[_0x51be('0x16')])&&!_[_0x51be('0x15')](_0x19e461[_0x51be('0x17')])){_0x5ed947['SmsInteraction'][_0x51be('0x18')]({'where':{'id':_0x19e461[_0x51be('0x17')]}})[_0x51be('0x19')](function(_0x1c0948){if(_0x1c0948){_0x1c0948[_0x51be('0x1a')]({'lastMsgAt':_0x19e461['createdAt'],'lastMsgDirection':_0x19e461['direction'][_0x51be('0x11')]()});}})['catch'](function(_0x1de4c1){console['error'](_0x1de4c1);});}if(_0x19e461['direction']===_0x51be('0x13')&&!_0x19e461['secret']){var _0x4ec33d;_0x5ed947[_0x51be('0x1b')][_0x51be('0x1c')]({'where':{'id':_0x19e461[_0x51be('0x1d')]},'raw':!![]})[_0x51be('0x19')](function(_0xfba4df){_0x4ec33d=_0xfba4df;if(_0x4ec33d&&_0x4ec33d[_0x51be('0x1e')]){switch(_0x4ec33d['type']){case'twilio':var _0x18f918=require('twilio');if(_0x4ec33d[_0x51be('0x1f')]&&_0x4ec33d['authToken']&&_0x4ec33d[_0x51be('0x20')]){var _0x4584cf=new _0x18f918(_0x4ec33d[_0x51be('0x1f')],_0x4ec33d[_0x51be('0x21')]);_0x4584cf[_0x51be('0x22')]['create']({'body':_0x19e461[_0x51be('0xf')],'to':_0x19e461[_0x51be('0x20')],'from':_0x4ec33d[_0x51be('0x20')],'statusCallback':_0x4ec33d[_0x51be('0x23')]+'/api/sms/messages/'+_0x19e461['id']+'/status?token='+_0x4ec33d[_0x51be('0x24')]})[_0x51be('0x19')](function(_0x3068d9){if(_0x3068d9[_0x51be('0x25')]){return _0x226121[_0x51be('0x1a')]({'messageId':_0x3068d9[_0x51be('0x25')]});}})[_0x51be('0x26')](function(_0x354631){logger[_0x51be('0x27')](_0x51be('0x28'),_0x51be('0x29'),_0x51be('0x2a'),util[_0x51be('0x2b')](_0x354631,{'showHidden':![],'depth':null}));});}else{logger[_0x51be('0x27')](_0x51be('0x28'),_0x51be('0x29'),_0x51be('0x2a'),_0x51be('0x2c'));}break;case _0x51be('0x2d'):var _0x233e6c=_0x51be('0x2e');if(_0x4ec33d[_0x51be('0x2f')]&&_0x4ec33d[_0x51be('0x30')]){var _0x31ad92={'recipient':[_0x19e461[_0x51be('0x20')]],'message':_0x19e461['body'],'message_type':_0x4ec33d['smsMethod']};if(_0x4ec33d[_0x51be('0x31')]&&_0x4ec33d['smsMethod']!=='SI'){_0x31ad92['sender']=_0x4ec33d[_0x51be('0x20')];}var _0x1829e8={'url':_0x233e6c+'login?username='+_0x4ec33d[_0x51be('0x2f')]+_0x51be('0x32')+_0x4ec33d[_0x51be('0x30')],'method':'GET'};rp(_0x1829e8)[_0x51be('0x19')](function(_0x29e6f6){var _0x1be94f=_0x29e6f6[_0x51be('0x33')](';');var _0x569be0={'user_key':_0x1be94f[0x0],'session_key':_0x1be94f[0x1]};_0x1829e8={'url':_0x233e6c+_0x51be('0x34'),'method':'POST','headers':{'user_key':_0x569be0[_0x51be('0x35')],'Session_key':_0x569be0[_0x51be('0x36')]},'json':!![],'body':_0x31ad92};return rp(_0x1829e8);})[_0x51be('0x19')](function(_0x4d8881){if(_0x4d8881['total_sent']>=0x1){var _0x3f1c61={'messageId':_0x4d8881[_0x51be('0x37')]};if(_0x4ec33d[_0x51be('0x31')]!=='GP'||!_0x4ec33d['deliveryReport']){_0x3f1c61[_0x51be('0x38')]=!![];}return _0x226121[_0x51be('0x1a')](_0x3f1c61);}else{return logger['error'](_0x51be('0x28'),_0x51be('0x29'),'skebby',util['inspect'](_0x4d8881,{'showHidden':![],'depth':null}));}})[_0x51be('0x26')](function(_0x2e32a7){return logger[_0x51be('0x27')](_0x51be('0x28'),'afterCreate',_0x51be('0x2d'),util[_0x51be('0x2b')](_0x2e32a7,{'showHidden':![],'depth':null}));});}else{logger[_0x51be('0x27')](_0x51be('0x28'),'afterCreate',_0x51be('0x2d'),'Missing\x20parameters:\x20username,\x20password');}break;case'connectel':if(_0x4ec33d[_0x51be('0x21')]){var _0x3b46f0={'recipient':_0x19e461['phone'],'message':_0x19e461[_0x51be('0xf')],'sender':_0x4ec33d[_0x51be('0x39')]||_0x4ec33d['phone'],'authorization':_0x4ec33d[_0x51be('0x21')]};var _0x4b47d9={'method':_0x51be('0x3a'),'uri':_0x51be('0x3b'),'body':_0x3b46f0,'json':!![]};rp(_0x4b47d9)[_0x51be('0x19')](function(_0x87e18d){var _0x523dfd={'messageId':_0x87e18d[_0x51be('0x3c')]};if(!_0x4ec33d[_0x51be('0x3d')]){_0x523dfd['read']=!![];}return _0x226121[_0x51be('0x1a')](_0x523dfd);})[_0x51be('0x26')](function(_0x489784){logger['error'](_0x51be('0x28'),_0x51be('0x29'),_0x51be('0x3e'),util[_0x51be('0x2b')](_0x489784,{'showHidden':![],'depth':null}));});}else{logger[_0x51be('0x27')](_0x51be('0x28'),_0x51be('0x29'),'connectel',_0x51be('0x3f'));}break;case _0x51be('0x40'):if(_0x4ec33d[_0x51be('0x2f')]&&_0x4ec33d[_0x51be('0x30')]){var _0x3b46f0={'messages':[{'source':_0x51be('0x41'),'to':_0x19e461[_0x51be('0x20')],'body':_0x19e461[_0x51be('0xf')],'from':_0x4ec33d[_0x51be('0x39')]||_0x4ec33d[_0x51be('0x20')]}]};var _0x385e93=util[_0x51be('0x42')](_0x51be('0x43'),_0x4ec33d[_0x51be('0x2f')],_0x4ec33d[_0x51be('0x30')]);var _0x4b47d9={'method':_0x51be('0x3a'),'uri':_0x51be('0x44'),'body':_0x3b46f0,'headers':{'Authorization':util[_0x51be('0x42')](_0x51be('0x45'),new Buffer(_0x385e93)['toString'](_0x51be('0x46')))},'json':!![]};rp(_0x4b47d9)[_0x51be('0x19')](function(_0x54609b){if(_0x54609b[_0x51be('0x47')]>=0xc8&&_0x54609b[_0x51be('0x47')]<=0xce){if(_0x54609b['data']&&_0x54609b[_0x51be('0x48')][_0x51be('0x49')]>0x0){var _0x1130d9=_[_0x51be('0x4a')](_0x54609b['data'][_0x51be('0x22')]);var _0x57b9b8={'messageId':_0x1130d9[_0x51be('0x4b')]};if(!_0x4ec33d['deliveryReport']){_0x57b9b8['read']=!![];}return _0x226121[_0x51be('0x1a')](_0x57b9b8);}else{logger[_0x51be('0x27')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x51be('0x4c'),util['inspect'](_0x54609b,{'showHidden':![],'depth':null}));}}else{logger[_0x51be('0x27')](_0x51be('0x28'),'afterCreate',_0x51be('0x4c'),util[_0x51be('0x2b')](_0x54609b,{'showHidden':![],'depth':null}));}})['catch'](function(_0x37dc67){logger[_0x51be('0x27')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x51be('0x29'),_0x51be('0x4c'),util[_0x51be('0x2b')](_0x37dc67,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x51be('0x28'),_0x51be('0x29'),_0x51be('0x4c'),_0x51be('0x4d'));}break;case _0x51be('0x4e'):if(_0x4ec33d[_0x51be('0x4f')]&&_0x4ec33d[_0x51be('0x21')]){var _0x3b46f0={'dst':_0x19e461[_0x51be('0x20')],'text':_0x19e461[_0x51be('0xf')],'src':_0x4ec33d[_0x51be('0x39')]||_0x4ec33d[_0x51be('0x20')],'url':_0x4ec33d[_0x51be('0x23')]+_0x51be('0x50')+_0x19e461['id']+'/status?token='+_0x4ec33d[_0x51be('0x24')]};var _0x385e93=util[_0x51be('0x42')](_0x51be('0x43'),_0x4ec33d[_0x51be('0x4f')],_0x4ec33d[_0x51be('0x21')]);var _0x4b47d9={'method':_0x51be('0x3a'),'uri':util[_0x51be('0x42')]('https://api.plivo.com/v1/Account/%s/Message/',_0x4ec33d[_0x51be('0x4f')]),'body':_0x3b46f0,'headers':{'Authorization':util['format'](_0x51be('0x45'),new Buffer(_0x385e93)[_0x51be('0x51')](_0x51be('0x46')))},'json':!![]};rp(_0x4b47d9)[_0x51be('0x19')](function(_0x330d61){var _0x511fd0={'messageId':_0x330d61['message_uuid'][0x0]};return _0x226121[_0x51be('0x1a')](_0x511fd0);})[_0x51be('0x26')](function(_0x2b3946){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x51be('0x29'),_0x51be('0x4e'),util[_0x51be('0x2b')](_0x2b3946,{'showHidden':![],'depth':null}));});}else{logger[_0x51be('0x27')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x51be('0x29'),_0x51be('0x4e'),_0x51be('0x52'));}break;case'infobip':if(_0x4ec33d['username']&&_0x4ec33d[_0x51be('0x30')]){if(_0x4ec33d[_0x51be('0x53')]){var _0x5231e2={'method':_0x51be('0x3a'),'uri':_0x4ec33d[_0x51be('0x53')]+_0x51be('0x54'),'body':{'username':_0x4ec33d[_0x51be('0x2f')],'password':_0x4ec33d[_0x51be('0x30')]},'json':!![]};return rp(_0x5231e2)[_0x51be('0x19')](function(_0x1ca23c){var _0x341c9e={'method':_0x51be('0x3a'),'uri':_0x4ec33d[_0x51be('0x53')]+'/sms/2/text/advanced','body':{'messages':[{'from':_0x4ec33d['phone'],'destinations':[{'to':_0x19e461[_0x51be('0x20')]}],'text':_0x19e461[_0x51be('0xf')],'notifyUrl':_0x4ec33d['remote']+_0x51be('0x50')+_0x19e461['id']+_0x51be('0x55')+_0x4ec33d[_0x51be('0x24')],'notifyContentType':_0x51be('0x56'),'callbackData':_0x4ec33d[_0x51be('0x20')]+';'+_0x19e461[_0x51be('0xf')]}]},'headers':{'Authorization':_0x51be('0x57')+_0x1ca23c[_0x51be('0x24')]},'json':!![]};return rp(_0x341c9e)[_0x51be('0x19')](function(_0x592ba5){if(_0x592ba5['messages']){var _0x38dc37={'messageId':_0x592ba5[_0x51be('0x22')][0x0][_0x51be('0xd')]};if(!_0x4ec33d['deliveryReport']){_0x38dc37['read']=!![];}return _0x226121['update'](_0x38dc37);}else{return logger[_0x51be('0x27')](_0x51be('0x28'),'afterCreate',_0x51be('0x58'),util[_0x51be('0x2b')](_0x592ba5,{'showHidden':![],'depth':null}));}});})[_0x51be('0x26')](function(_0x6ec4ff){return logger[_0x51be('0x27')](_0x51be('0x28'),_0x51be('0x29'),_0x51be('0x58'),util[_0x51be('0x2b')](_0x6ec4ff,{'showHidden':![],'depth':null}));});}else{logger[_0x51be('0x27')](_0x51be('0x28'),_0x51be('0x29'),_0x51be('0x58'),_0x51be('0x59'));}}else{logger[_0x51be('0x27')](_0x51be('0x28'),_0x51be('0x29'),_0x51be('0x58'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x51be('0x5a'):var _0x5aa64d=require(_0x51be('0x5b'));if(_0x4ec33d[_0x51be('0x5c')]){var _0x1e19d3={};_0x1e19d3[_0x51be('0x5d')]=_0x4ec33d['username'];_0x1e19d3['phone']=_0x19e461[_0x51be('0x20')];_0x1e19d3['sender']=_0x4ec33d['phone'];_0x1e19d3[_0x51be('0x5e')]=_0x19e461[_0x51be('0xf')];_0x1e19d3[_0x51be('0x5f')]=+new Date();var _0x43cdc8='';var _0x217215='';var _0x6f46f3=Object['keys'](_0x1e19d3);_0x6f46f3[_0x51be('0x60')]();for(var _0x1a0658=0x0;_0x1a0658<_0x6f46f3['length'];_0x1a0658++){if(_0x43cdc8!=''){_0x43cdc8+='&';}_0x43cdc8+=_0x6f46f3[_0x1a0658]+'='+encodeURIComponent(_0x1e19d3[_0x6f46f3[_0x1a0658]]);_0x217215+=_0x1e19d3[_0x6f46f3[_0x1a0658]];}_0x217215+=_0x4ec33d[_0x51be('0x5c')];_0x217215=_0x5aa64d[_0x51be('0x61')](_0x51be('0x62'))[_0x51be('0x1a')](_0x217215)[_0x51be('0x63')](_0x51be('0x64'));if(_0x43cdc8!==''){_0x43cdc8+='&';}_0x43cdc8+=_0x51be('0x65')+_0x217215;var _0x1829e8={'method':_0x51be('0x66'),'uri':_0x4ec33d[_0x51be('0x53')]+_0x51be('0x67')+_0x43cdc8,'json':!![]};return rp(_0x1829e8)[_0x51be('0x19')](function(_0x15de0f){var _0x34e37b=Object[_0x51be('0x68')](_0x15de0f);if(_0x15de0f[_0x34e37b[0x0]][_0x51be('0x27')]&&parseInt(_0x15de0f[_0x34e37b[0x0]][_0x51be('0x27')])===0x0){var _0x424803={'messageId':_0x15de0f[_0x34e37b[0x0]][_0x51be('0x69')]};if(!_0x4ec33d[_0x51be('0x3d')]){_0x424803['read']=!![];}return _0x226121[_0x51be('0x1a')](_0x424803);}else{return logger[_0x51be('0x27')](_0x51be('0x28'),_0x51be('0x29'),'csc',util['inspect'](_0x15de0f['error'],{'showHidden':![],'depth':null}));}})[_0x51be('0x26')](function(_0x21f657){return logger['error'](_0x51be('0x28'),_0x51be('0x29'),_0x51be('0x5a'),util['inspect'](_0x21f657,{'showHidden':![],'depth':null}));});}else{logger[_0x51be('0x27')](_0x51be('0x28'),'afterCreate','csc','Missing\x20parameters:\x20apiKey');}break;case _0x51be('0x6a'):if(_0x4ec33d[_0x51be('0x5c')]){var _0x392d06={'method':_0x51be('0x3a'),'uri':_0x51be('0x6b'),'headers':{'Authorization':_0x4ec33d[_0x51be('0x5c')]},'body':{'content':_0x19e461[_0x51be('0xf')],'to':[_0x19e461[_0x51be('0x20')]],'from':_0x4ec33d[_0x51be('0x20')],'binary':![],'clientMessageId':_0x51be('0x6c'),'charset':_0x51be('0x6d')},'json':!![]};rp(_0x392d06)[_0x51be('0x19')](function(_0x4cb67d){if(!_0x4cb67d['error']){var _0x4eeb6a={'messageId':_0x4cb67d['messages'][0x0][_0x51be('0x6e')]};if(!_0x4ec33d[_0x51be('0x3d')]){_0x4eeb6a[_0x51be('0x38')]=!![];}return _0x226121[_0x51be('0x1a')](_0x4eeb6a);}else{return logger[_0x51be('0x27')](_0x51be('0x28'),_0x51be('0x29'),_0x51be('0x6a'),util[_0x51be('0x2b')](_0x4cb67d['error'],{'showHidden':![],'depth':null}));}})[_0x51be('0x26')](function(_0x167a20){return logger[_0x51be('0x27')](_0x51be('0x28'),_0x51be('0x29'),_0x51be('0x6a'),util['inspect'](_0x167a20,{'showHidden':![],'depth':null}));});}else{logger[_0x51be('0x27')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x51be('0x29'),_0x51be('0x6a'),_0x51be('0x6f'));}break;case _0x51be('0x70'):if(_0x4ec33d[_0x51be('0x2f')]&&_0x4ec33d[_0x51be('0x30')]){var _0x385e93=util[_0x51be('0x42')](_0x51be('0x43'),_0x4ec33d[_0x51be('0x2f')],_0x4ec33d[_0x51be('0x30')]);var _0x4b47d9={'method':'POST','uri':_0x51be('0x71')+_0x4ec33d[_0x51be('0x72')]+_0x51be('0x73'),'body':{'to':[_0x19e461[_0x51be('0x20')]],'text':_0x19e461[_0x51be('0xf')],'from':_0x4ec33d[_0x51be('0x20')],'applicationId':_0x4ec33d[_0x51be('0x74')]},'headers':{'Authorization':util['format'](_0x51be('0x45'),new Buffer(_0x385e93)[_0x51be('0x51')](_0x51be('0x46')))},'json':!![]};rp(_0x4b47d9)[_0x51be('0x19')](function(_0x313487){if(_0x313487['id']){var _0x3ce370={'messageId':_0x313487['id']};return _0x226121[_0x51be('0x1a')](_0x3ce370);}else{logger[_0x51be('0x27')](_0x51be('0x28'),_0x51be('0x29'),_0x51be('0x70'),util['inspect'](_0x313487,{'showHidden':![],'depth':null}));}})['catch'](function(_0x2e6d77){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x51be('0x29'),_0x51be('0x70'),util[_0x51be('0x2b')](_0x2e6d77,{'showHidden':![],'depth':null}));});}else{logger[_0x51be('0x27')](_0x51be('0x28'),_0x51be('0x29'),_0x51be('0x70'),_0x51be('0x4d'));}break;case'intelepeer':if(_0x4ec33d[_0x51be('0x5c')]){var _0x41fc10={};var _0x1829e8={'method':_0x51be('0x3a'),'uri':_0x51be('0x75'),'headers':{'Authorization':_0x51be('0x76')+_0x4ec33d['apiKey'],'Content-Type':_0x51be('0x56')},'body':{'from':_0x4ec33d[_0x51be('0x20')],'to':_0x19e461[_0x51be('0x20')],'text':_0x19e461[_0x51be('0xf')]},'json':!![]};return rp(_0x1829e8)[_0x51be('0x19')](function(_0x97e9b7){if(_0x97e9b7[_0x51be('0x77')]==0xca){_0x41fc10[_0x51be('0x78')]=_0x97e9b7;var _0x2eec06={'method':_0x51be('0x3a'),'uri':_0x51be('0x79'),'headers':{'Authorization':'Bearer\x20'+_0x4ec33d[_0x51be('0x5c')],'Content-Type':'application/json'},'body':{'refid':_0x41fc10['message']['refid']},'json':!![]};return rp(_0x2eec06)['then'](function(_0xe3ed36){_0x41fc10[_0x51be('0x7a')]=_0xe3ed36;var _0x50837f={'messageId':_0x41fc10[_0x51be('0x78')][_0x51be('0x7b')],'read':!![]};return _0x226121[_0x51be('0x1a')](_0x50837f);});}else{return logger[_0x51be('0x27')](_0x51be('0x28'),_0x51be('0x29'),'intelepeer',util['inspect'](_0x97e9b7,{'showHidden':![],'depth':null}));}})['catch'](function(_0x5aec56){return logger[_0x51be('0x27')](_0x51be('0x28'),'afterCreate',_0x51be('0x7c'),util[_0x51be('0x2b')](_0x5aec56,{'showHidden':![],'depth':null}));});}else{return logger['error'](_0x51be('0x28'),_0x51be('0x29'),'intelepeer','Token\x20not\x20received');}break;}}})[_0x51be('0x7d')](function(){_0x309c33();});}else{_0x309c33();}}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x4968=['https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','application/json','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','intelepeer','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./smsMessage.attributes','exports','define','SmsMessage','sms_messages','messageId','body','FULLTEXT','get','direction','toLowerCase','out','secret','isNil','UserId','findOne','then','update','createdAt','catch','error','find','SmsAccountId','type','twilio','authToken','messages','create','phone','/api/sms/messages/','/status?token=','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','login?username=','&password=','GET','split','sms','user_key','session_key','total_sent','internal_order_id','deliveryReport','read','senderString','POST','https://smsapi.connectel.se/api/v2/send/','connectel','Missing\x20parameters:\x20authToken','clicksend','format','%s:%s','https://rest.clicksend.com/v3/sms/send','http_code','data','queued_count','clickSend','Missing\x20parameters:\x20username,\x20password','plivo','authId','Basic\x20%s','toString','base64','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/sms/2/text/advanced','remote','token','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','timestamp','sort','length','md5','digest','hex','signature=','keys','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','apiMessageId','bandwidth','accountId','/messages'];(function(_0x16ea87,_0x378d8b){var _0x6e7b1c=function(_0x26306e){while(--_0x26306e){_0x16ea87['push'](_0x16ea87['shift']());}};_0x6e7b1c(++_0x378d8b);}(_0x4968,0x85));var _0x8496=function(_0x5dc4f7,_0x4308e8){_0x5dc4f7=_0x5dc4f7-0x0;var _0x42100c=_0x4968[_0x5dc4f7];return _0x42100c;};'use strict';var _=require(_0x8496('0x0'));var util=require(_0x8496('0x1'));var logger=require(_0x8496('0x2'))(_0x8496('0x3'));var moment=require(_0x8496('0x4'));var BPromise=require(_0x8496('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8496('0x6'));var rimraf=require(_0x8496('0x7'));var config=require(_0x8496('0x8'));var attributes=require(_0x8496('0x9'));module[_0x8496('0xa')]=function(_0x4596dd,_0x54f85f){return _0x4596dd[_0x8496('0xb')](_0x8496('0xc'),attributes,{'tableName':_0x8496('0xd'),'paranoid':![],'indexes':[{'name':_0x8496('0xe'),'fields':[_0x8496('0xe')]},{'name':'fti_sms_messages','fields':[_0x8496('0xf')],'type':_0x8496('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4aded1,_0x431c67,_0x1e5a12){var _0x362d07=_0x4596dd['models'];var _0x40792c=_0x4aded1[_0x8496('0x11')]({'plain':!![]});if(_0x40792c[_0x8496('0x12')][_0x8496('0x13')]()==='in'||_0x40792c[_0x8496('0x12')][_0x8496('0x13')]()===_0x8496('0x14')&&!_0x40792c[_0x8496('0x15')]&&!_[_0x8496('0x16')](_0x40792c[_0x8496('0x17')])&&!_[_0x8496('0x16')](_0x40792c['SmsInteractionId'])){_0x362d07['SmsInteraction'][_0x8496('0x18')]({'where':{'id':_0x40792c['SmsInteractionId']}})[_0x8496('0x19')](function(_0x4d5aec){if(_0x4d5aec){_0x4d5aec[_0x8496('0x1a')]({'lastMsgAt':_0x40792c[_0x8496('0x1b')],'lastMsgDirection':_0x40792c[_0x8496('0x12')]['toLowerCase']()});}})[_0x8496('0x1c')](function(_0x512f5d){console[_0x8496('0x1d')](_0x512f5d);});}if(_0x40792c[_0x8496('0x12')]==='out'&&!_0x40792c[_0x8496('0x15')]){var _0x21d264;_0x362d07['SmsAccount'][_0x8496('0x1e')]({'where':{'id':_0x40792c[_0x8496('0x1f')]},'raw':!![]})[_0x8496('0x19')](function(_0x510e30){_0x21d264=_0x510e30;if(_0x21d264&&_0x21d264['type']){switch(_0x21d264[_0x8496('0x20')]){case _0x8496('0x21'):var _0x125568=require('twilio');if(_0x21d264['accountSid']&&_0x21d264[_0x8496('0x22')]&&_0x21d264['phone']){var _0x369db3=new _0x125568(_0x21d264['accountSid'],_0x21d264[_0x8496('0x22')]);_0x369db3[_0x8496('0x23')][_0x8496('0x24')]({'body':_0x40792c[_0x8496('0xf')],'to':_0x40792c[_0x8496('0x25')],'from':_0x21d264['phone'],'statusCallback':_0x21d264['remote']+_0x8496('0x26')+_0x40792c['id']+_0x8496('0x27')+_0x21d264['token']})[_0x8496('0x19')](function(_0x4fb2e8){if(_0x4fb2e8[_0x8496('0x28')]){return _0x4aded1['update']({'messageId':_0x4fb2e8[_0x8496('0x28')]});}})[_0x8496('0x1c')](function(_0x591a27){logger[_0x8496('0x1d')](_0x8496('0x29'),_0x8496('0x2a'),_0x8496('0x21'),util[_0x8496('0x2b')](_0x591a27,{'showHidden':![],'depth':null}));});}else{logger[_0x8496('0x1d')](_0x8496('0x29'),_0x8496('0x2a'),_0x8496('0x21'),_0x8496('0x2c'));}break;case _0x8496('0x2d'):var _0xd65e1b=_0x8496('0x2e');if(_0x21d264[_0x8496('0x2f')]&&_0x21d264[_0x8496('0x30')]){var _0x10cea8={'recipient':[_0x40792c[_0x8496('0x25')]],'message':_0x40792c[_0x8496('0xf')],'message_type':_0x21d264['smsMethod']};if(_0x21d264[_0x8496('0x31')]&&_0x21d264[_0x8496('0x31')]!=='SI'){_0x10cea8[_0x8496('0x32')]=_0x21d264[_0x8496('0x25')];}var _0x37b75c={'url':_0xd65e1b+_0x8496('0x33')+_0x21d264[_0x8496('0x2f')]+_0x8496('0x34')+_0x21d264['password'],'method':_0x8496('0x35')};rp(_0x37b75c)['then'](function(_0x8995b4){var _0xfad93d=_0x8995b4[_0x8496('0x36')](';');var _0x5ba874={'user_key':_0xfad93d[0x0],'session_key':_0xfad93d[0x1]};_0x37b75c={'url':_0xd65e1b+_0x8496('0x37'),'method':'POST','headers':{'user_key':_0x5ba874[_0x8496('0x38')],'Session_key':_0x5ba874[_0x8496('0x39')]},'json':!![],'body':_0x10cea8};return rp(_0x37b75c);})[_0x8496('0x19')](function(_0x48726b){if(_0x48726b[_0x8496('0x3a')]>=0x1){var _0x98329d={'messageId':_0x48726b[_0x8496('0x3b')]};if(_0x21d264[_0x8496('0x31')]!=='GP'||!_0x21d264[_0x8496('0x3c')]){_0x98329d[_0x8496('0x3d')]=!![];}return _0x4aded1[_0x8496('0x1a')](_0x98329d);}else{return logger[_0x8496('0x1d')](_0x8496('0x29'),_0x8496('0x2a'),_0x8496('0x2d'),util['inspect'](_0x48726b,{'showHidden':![],'depth':null}));}})[_0x8496('0x1c')](function(_0x25c7f1){return logger[_0x8496('0x1d')](_0x8496('0x29'),_0x8496('0x2a'),_0x8496('0x2d'),util['inspect'](_0x25c7f1,{'showHidden':![],'depth':null}));});}else{logger[_0x8496('0x1d')](_0x8496('0x29'),_0x8496('0x2a'),_0x8496('0x2d'),'Missing\x20parameters:\x20username,\x20password');}break;case'connectel':if(_0x21d264['authToken']){var _0x2455fd={'recipient':_0x40792c[_0x8496('0x25')],'message':_0x40792c[_0x8496('0xf')],'sender':_0x21d264[_0x8496('0x3e')]||_0x21d264[_0x8496('0x25')],'authorization':_0x21d264['authToken']};var _0x431c67={'method':_0x8496('0x3f'),'uri':_0x8496('0x40'),'body':_0x2455fd,'json':!![]};rp(_0x431c67)[_0x8496('0x19')](function(_0x56e323){var _0x35920b={'messageId':_0x56e323['requestid']};if(!_0x21d264[_0x8496('0x3c')]){_0x35920b[_0x8496('0x3d')]=!![];}return _0x4aded1[_0x8496('0x1a')](_0x35920b);})['catch'](function(_0xf998e5){logger[_0x8496('0x1d')](_0x8496('0x29'),_0x8496('0x2a'),_0x8496('0x41'),util[_0x8496('0x2b')](_0xf998e5,{'showHidden':![],'depth':null}));});}else{logger[_0x8496('0x1d')](_0x8496('0x29'),'afterCreate',_0x8496('0x41'),_0x8496('0x42'));}break;case _0x8496('0x43'):if(_0x21d264['username']&&_0x21d264[_0x8496('0x30')]){var _0x2455fd={'messages':[{'source':'xCALLY\x20Motion','to':_0x40792c[_0x8496('0x25')],'body':_0x40792c[_0x8496('0xf')],'from':_0x21d264[_0x8496('0x3e')]||_0x21d264[_0x8496('0x25')]}]};var _0x23c4de=util[_0x8496('0x44')](_0x8496('0x45'),_0x21d264[_0x8496('0x2f')],_0x21d264['password']);var _0x431c67={'method':_0x8496('0x3f'),'uri':_0x8496('0x46'),'body':_0x2455fd,'headers':{'Authorization':util[_0x8496('0x44')]('Basic\x20%s',new Buffer(_0x23c4de)['toString']('base64'))},'json':!![]};rp(_0x431c67)[_0x8496('0x19')](function(_0x14c027){if(_0x14c027[_0x8496('0x47')]>=0xc8&&_0x14c027['http_code']<=0xce){if(_0x14c027[_0x8496('0x48')]&&_0x14c027[_0x8496('0x48')][_0x8496('0x49')]>0x0){var _0x4d6e04=_['head'](_0x14c027[_0x8496('0x48')][_0x8496('0x23')]);var _0x294a25={'messageId':_0x4d6e04['message_id']};if(!_0x21d264['deliveryReport']){_0x294a25[_0x8496('0x3d')]=!![];}return _0x4aded1[_0x8496('0x1a')](_0x294a25);}else{logger[_0x8496('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x8496('0x2a'),_0x8496('0x4a'),util['inspect'](_0x14c027,{'showHidden':![],'depth':null}));}}else{logger['error'](_0x8496('0x29'),'afterCreate',_0x8496('0x4a'),util['inspect'](_0x14c027,{'showHidden':![],'depth':null}));}})[_0x8496('0x1c')](function(_0x527d61){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x8496('0x4a'),util[_0x8496('0x2b')](_0x527d61,{'showHidden':![],'depth':null}));});}else{logger[_0x8496('0x1d')](_0x8496('0x29'),_0x8496('0x2a'),'clickSend',_0x8496('0x4b'));}break;case _0x8496('0x4c'):if(_0x21d264[_0x8496('0x4d')]&&_0x21d264['authToken']){var _0x2455fd={'dst':_0x40792c[_0x8496('0x25')],'text':_0x40792c['body'],'src':_0x21d264[_0x8496('0x3e')]||_0x21d264[_0x8496('0x25')],'url':_0x21d264['remote']+_0x8496('0x26')+_0x40792c['id']+'/status?token='+_0x21d264['token']};var _0x23c4de=util[_0x8496('0x44')](_0x8496('0x45'),_0x21d264[_0x8496('0x4d')],_0x21d264['authToken']);var _0x431c67={'method':_0x8496('0x3f'),'uri':util[_0x8496('0x44')]('https://api.plivo.com/v1/Account/%s/Message/',_0x21d264[_0x8496('0x4d')]),'body':_0x2455fd,'headers':{'Authorization':util[_0x8496('0x44')](_0x8496('0x4e'),new Buffer(_0x23c4de)[_0x8496('0x4f')](_0x8496('0x50')))},'json':!![]};rp(_0x431c67)[_0x8496('0x19')](function(_0x54bb02){var _0x6302e5={'messageId':_0x54bb02[_0x8496('0x51')][0x0]};return _0x4aded1[_0x8496('0x1a')](_0x6302e5);})[_0x8496('0x1c')](function(_0x32dafa){logger[_0x8496('0x1d')](_0x8496('0x29'),_0x8496('0x2a'),_0x8496('0x4c'),util[_0x8496('0x2b')](_0x32dafa,{'showHidden':![],'depth':null}));});}else{logger[_0x8496('0x1d')](_0x8496('0x29'),'afterCreate',_0x8496('0x4c'),_0x8496('0x52'));}break;case _0x8496('0x53'):if(_0x21d264[_0x8496('0x2f')]&&_0x21d264['password']){if(_0x21d264[_0x8496('0x54')]){var _0x2cdf78={'method':_0x8496('0x3f'),'uri':_0x21d264[_0x8496('0x54')]+'/auth/1/session','body':{'username':_0x21d264[_0x8496('0x2f')],'password':_0x21d264[_0x8496('0x30')]},'json':!![]};return rp(_0x2cdf78)[_0x8496('0x19')](function(_0x499362){var _0x7e7272={'method':_0x8496('0x3f'),'uri':_0x21d264[_0x8496('0x54')]+_0x8496('0x55'),'body':{'messages':[{'from':_0x21d264['phone'],'destinations':[{'to':_0x40792c[_0x8496('0x25')]}],'text':_0x40792c['body'],'notifyUrl':_0x21d264[_0x8496('0x56')]+_0x8496('0x26')+_0x40792c['id']+'/status?token='+_0x21d264[_0x8496('0x57')],'notifyContentType':'application/json','callbackData':_0x21d264[_0x8496('0x25')]+';'+_0x40792c[_0x8496('0xf')]}]},'headers':{'Authorization':_0x8496('0x58')+_0x499362[_0x8496('0x57')]},'json':!![]};return rp(_0x7e7272)['then'](function(_0x265062){if(_0x265062[_0x8496('0x23')]){var _0x349df8={'messageId':_0x265062['messages'][0x0][_0x8496('0xe')]};if(!_0x21d264[_0x8496('0x3c')]){_0x349df8[_0x8496('0x3d')]=!![];}return _0x4aded1[_0x8496('0x1a')](_0x349df8);}else{return logger[_0x8496('0x1d')](_0x8496('0x29'),_0x8496('0x2a'),_0x8496('0x53'),util[_0x8496('0x2b')](_0x265062,{'showHidden':![],'depth':null}));}});})[_0x8496('0x1c')](function(_0x2fbcb5){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x8496('0x2a'),_0x8496('0x53'),util['inspect'](_0x2fbcb5,{'showHidden':![],'depth':null}));});}else{logger[_0x8496('0x1d')](_0x8496('0x29'),'afterCreate',_0x8496('0x53'),_0x8496('0x59'));}}else{logger[_0x8496('0x1d')](_0x8496('0x29'),'afterCreate',_0x8496('0x53'),_0x8496('0x4b'));}break;case _0x8496('0x5a'):var _0x185099=require(_0x8496('0x5b'));if(_0x21d264[_0x8496('0x5c')]){var _0x1f1338={};_0x1f1338['login']=_0x21d264['username'];_0x1f1338['phone']=_0x40792c['phone'];_0x1f1338[_0x8496('0x32')]=_0x21d264['phone'];_0x1f1338['text']=_0x40792c[_0x8496('0xf')];_0x1f1338[_0x8496('0x5d')]=+new Date();var _0xb04db6='';var _0x121590='';var _0x232c49=Object['keys'](_0x1f1338);_0x232c49[_0x8496('0x5e')]();for(var _0x5430c1=0x0;_0x5430c1<_0x232c49[_0x8496('0x5f')];_0x5430c1++){if(_0xb04db6!=''){_0xb04db6+='&';}_0xb04db6+=_0x232c49[_0x5430c1]+'='+encodeURIComponent(_0x1f1338[_0x232c49[_0x5430c1]]);_0x121590+=_0x1f1338[_0x232c49[_0x5430c1]];}_0x121590+=_0x21d264[_0x8496('0x5c')];_0x121590=_0x185099['createHash'](_0x8496('0x60'))['update'](_0x121590)[_0x8496('0x61')](_0x8496('0x62'));if(_0xb04db6!==''){_0xb04db6+='&';}_0xb04db6+=_0x8496('0x63')+_0x121590;var _0x37b75c={'method':'GET','uri':_0x21d264[_0x8496('0x54')]+'/external/get/send.php?'+_0xb04db6,'json':!![]};return rp(_0x37b75c)[_0x8496('0x19')](function(_0x334186){var _0x4a83a5=Object[_0x8496('0x64')](_0x334186);if(_0x334186[_0x4a83a5[0x0]][_0x8496('0x1d')]&&parseInt(_0x334186[_0x4a83a5[0x0]]['error'])===0x0){var _0x20e0b4={'messageId':_0x334186[_0x4a83a5[0x0]]['id_sms']};if(!_0x21d264[_0x8496('0x3c')]){_0x20e0b4[_0x8496('0x3d')]=!![];}return _0x4aded1['update'](_0x20e0b4);}else{return logger[_0x8496('0x1d')](_0x8496('0x29'),'afterCreate',_0x8496('0x5a'),util[_0x8496('0x2b')](_0x334186[_0x8496('0x1d')],{'showHidden':![],'depth':null}));}})[_0x8496('0x1c')](function(_0x448962){return logger[_0x8496('0x1d')](_0x8496('0x29'),_0x8496('0x2a'),_0x8496('0x5a'),util[_0x8496('0x2b')](_0x448962,{'showHidden':![],'depth':null}));});}else{logger[_0x8496('0x1d')](_0x8496('0x29'),_0x8496('0x2a'),_0x8496('0x5a'),_0x8496('0x65'));}break;case _0x8496('0x66'):if(_0x21d264['apiKey']){var _0x53a2bb={'method':'POST','uri':_0x8496('0x67'),'headers':{'Authorization':_0x21d264[_0x8496('0x5c')]},'body':{'content':_0x40792c[_0x8496('0xf')],'to':[_0x40792c[_0x8496('0x25')]],'from':_0x21d264['phone'],'binary':![],'clientMessageId':_0x8496('0x68'),'charset':'UTF-8'},'json':!![]};rp(_0x53a2bb)[_0x8496('0x19')](function(_0x232009){if(!_0x232009[_0x8496('0x1d')]){var _0xee3316={'messageId':_0x232009[_0x8496('0x23')][0x0][_0x8496('0x69')]};if(!_0x21d264['deliveryReport']){_0xee3316[_0x8496('0x3d')]=!![];}return _0x4aded1[_0x8496('0x1a')](_0xee3316);}else{return logger['error'](_0x8496('0x29'),'afterCreate',_0x8496('0x66'),util[_0x8496('0x2b')](_0x232009[_0x8496('0x1d')],{'showHidden':![],'depth':null}));}})[_0x8496('0x1c')](function(_0x43ee6e){return logger['error'](_0x8496('0x29'),'afterCreate',_0x8496('0x66'),util['inspect'](_0x43ee6e,{'showHidden':![],'depth':null}));});}else{logger[_0x8496('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x8496('0x2a'),_0x8496('0x66'),_0x8496('0x65'));}break;case _0x8496('0x6a'):if(_0x21d264[_0x8496('0x2f')]&&_0x21d264[_0x8496('0x30')]){var _0x23c4de=util[_0x8496('0x44')]('%s:%s',_0x21d264[_0x8496('0x2f')],_0x21d264['password']);var _0x431c67={'method':_0x8496('0x3f'),'uri':'https://messaging.bandwidth.com/api/v2/users/'+_0x21d264[_0x8496('0x6b')]+_0x8496('0x6c'),'body':{'to':[_0x40792c[_0x8496('0x25')]],'text':_0x40792c['body'],'from':_0x21d264[_0x8496('0x25')],'applicationId':_0x21d264['applicationId']},'headers':{'Authorization':util[_0x8496('0x44')]('Basic\x20%s',new Buffer(_0x23c4de)[_0x8496('0x4f')](_0x8496('0x50')))},'json':!![]};rp(_0x431c67)[_0x8496('0x19')](function(_0x2eac91){if(_0x2eac91['id']){var _0x1d7665={'messageId':_0x2eac91['id']};return _0x4aded1[_0x8496('0x1a')](_0x1d7665);}else{logger[_0x8496('0x1d')](_0x8496('0x29'),_0x8496('0x2a'),_0x8496('0x6a'),util['inspect'](_0x2eac91,{'showHidden':![],'depth':null}));}})[_0x8496('0x1c')](function(_0x562b79){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x8496('0x2a'),_0x8496('0x6a'),util[_0x8496('0x2b')](_0x562b79,{'showHidden':![],'depth':null}));});}else{logger[_0x8496('0x1d')](_0x8496('0x29'),_0x8496('0x2a'),_0x8496('0x6a'),_0x8496('0x4b'));}break;case'intelepeer':if(_0x21d264['apiKey']){var _0x16f318={};var _0x37b75c={'method':_0x8496('0x3f'),'uri':_0x8496('0x6d'),'headers':{'Authorization':_0x8496('0x6e')+_0x21d264[_0x8496('0x5c')],'Content-Type':_0x8496('0x6f')},'body':{'from':_0x21d264[_0x8496('0x25')],'to':_0x40792c[_0x8496('0x25')],'text':_0x40792c[_0x8496('0xf')]},'json':!![]};return rp(_0x37b75c)[_0x8496('0x19')](function(_0x896aa7){if(_0x896aa7[_0x8496('0x70')]==0xca){_0x16f318[_0x8496('0x71')]=_0x896aa7;var _0x5e38d1={'method':'POST','uri':_0x8496('0x72'),'headers':{'Authorization':_0x8496('0x6e')+_0x21d264[_0x8496('0x5c')],'Content-Type':'application/json'},'body':{'refid':_0x16f318[_0x8496('0x71')][_0x8496('0x73')]},'json':!![]};return rp(_0x5e38d1)[_0x8496('0x19')](function(_0x44338b){_0x16f318[_0x8496('0x74')]=_0x44338b;var _0x17130d={'messageId':_0x16f318[_0x8496('0x71')][_0x8496('0x73')],'read':!![]};return _0x4aded1[_0x8496('0x1a')](_0x17130d);});}else{return logger[_0x8496('0x1d')](_0x8496('0x29'),_0x8496('0x2a'),_0x8496('0x75'),util['inspect'](_0x896aa7,{'showHidden':![],'depth':null}));}})[_0x8496('0x1c')](function(_0x3784ca){return logger['error'](_0x8496('0x29'),'afterCreate',_0x8496('0x75'),util[_0x8496('0x2b')](_0x3784ca,{'showHidden':![],'depth':null}));});}else{return logger[_0x8496('0x1d')](_0x8496('0x29'),_0x8496('0x2a'),_0x8496('0x75'),'Token\x20not\x20received');}break;}}})[_0x8496('0x76')](function(){_0x1e5a12();});}else{_0x1e5a12();}}},'charset':_0x8496('0x77'),'collate':_0x8496('0x78')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 7823257..83f122b 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 _0x7254=['message','catch','CreateSmsMessage','SmsMessage','create','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','./smsMessage.socket','register','then','info','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','code','SmsMessage,\x20%s,\x20%s'];(function(_0x549ba5,_0x2538cb){var _0x195d32=function(_0x531f86){while(--_0x531f86){_0x549ba5['push'](_0x549ba5['shift']());}};_0x195d32(++_0x2538cb);}(_0x7254,0x168));var _0x4725=function(_0x5f1212,_0x116bf1){_0x5f1212=_0x5f1212-0x0;var _0x336e3b=_0x7254[_0x5f1212];return _0x336e3b;};'use strict';var _=require(_0x4725('0x0'));var util=require(_0x4725('0x1'));var moment=require(_0x4725('0x2'));var BPromise=require(_0x4725('0x3'));var rs=require(_0x4725('0x4'));var fs=require('fs');var Redis=require(_0x4725('0x5'));var db=require(_0x4725('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x4725('0x7'))(_0x4725('0x8'));var config=require(_0x4725('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x4725('0xa')][_0x4725('0xb')]({'port':0x232a});config[_0x4725('0xc')]=_[_0x4725('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4725('0xc')]));require(_0x4725('0xe'))[_0x4725('0xf')](socket);function respondWithRpcPromise(_0x4aaf74,_0x2707c0,_0x2ea264){return new BPromise(function(_0xd5cc1,_0x33247c){return client['request'](_0x4aaf74,_0x2ea264)[_0x4725('0x10')](function(_0x5201a7){logger[_0x4725('0x11')]('SmsMessage,\x20%s,\x20%s',_0x2707c0,_0x4725('0x12'));logger[_0x4725('0x13')](_0x4725('0x14'),_0x2707c0,_0x4725('0x12'),JSON['stringify'](_0x5201a7));if(_0x5201a7[_0x4725('0x15')]){if(_0x5201a7[_0x4725('0x15')][_0x4725('0x16')]===0x1f4){logger[_0x4725('0x15')](_0x4725('0x17'),_0x2707c0,_0x5201a7[_0x4725('0x15')]['message']);return _0x33247c(_0x5201a7[_0x4725('0x15')][_0x4725('0x18')]);}logger['error'](_0x4725('0x17'),_0x2707c0,_0x5201a7[_0x4725('0x15')][_0x4725('0x18')]);return _0xd5cc1(_0x5201a7[_0x4725('0x15')][_0x4725('0x18')]);}else{logger[_0x4725('0x11')](_0x4725('0x17'),_0x2707c0,_0x4725('0x12'));_0xd5cc1(_0x5201a7['result'][_0x4725('0x18')]);}})[_0x4725('0x19')](function(_0x4b13e7){logger[_0x4725('0x15')](_0x4725('0x17'),_0x2707c0,_0x4b13e7);_0x33247c(_0x4b13e7);});});}exports[_0x4725('0x1a')]=function(_0x1b1804){var _0x4026a9=this;return new Promise(function(_0x5d0193,_0x2555b0){return db[_0x4725('0x1b')][_0x4725('0x1c')](_0x1b1804[_0x4725('0x1d')],{'raw':_0x1b1804[_0x4725('0x1e')]?_0x1b1804[_0x4725('0x1e')][_0x4725('0x1f')]===undefined?!![]:![]:!![]})['then'](function(_0x209c99){logger[_0x4725('0x11')](_0x4725('0x1a'),_0x1b1804);logger[_0x4725('0x13')](_0x4725('0x1a'),_0x1b1804,JSON['stringify'](_0x209c99));_0x5d0193(_0x209c99);})[_0x4725('0x19')](function(_0x421a9b){logger['error'](_0x4725('0x1a'),_0x421a9b['message'],_0x1b1804);_0x2555b0(_0x4026a9[_0x4725('0x15')](0x1f4,_0x421a9b[_0x4725('0x18')]));});});}; \ No newline at end of file +var _0x4744=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSmsMessage','SmsMessage','create','body','options','debug','lodash','util','bluebird','randomstring','ioredis'];(function(_0x4b2952,_0x38d09a){var _0x281c6b=function(_0x5925b3){while(--_0x5925b3){_0x4b2952['push'](_0x4b2952['shift']());}};_0x281c6b(++_0x38d09a);}(_0x4744,0x1c2));var _0x4474=function(_0x32c872,_0x4e59fc){_0x32c872=_0x32c872-0x0;var _0x36a6f9=_0x4744[_0x32c872];return _0x36a6f9;};'use strict';var _=require(_0x4474('0x0'));var util=require(_0x4474('0x1'));var moment=require('moment');var BPromise=require(_0x4474('0x2'));var rs=require(_0x4474('0x3'));var fs=require('fs');var Redis=require(_0x4474('0x4'));var db=require(_0x4474('0x5'))['db'];var utils=require(_0x4474('0x6'));var logger=require(_0x4474('0x7'))('rpc');var config=require(_0x4474('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x4474('0x9')][_0x4474('0xa')]({'port':0x232a});config[_0x4474('0xb')]=_[_0x4474('0xc')](config['redis'],{'host':_0x4474('0xd'),'port':0x18eb});var socket=require(_0x4474('0xe'))(new Redis(config[_0x4474('0xb')]));require(_0x4474('0xf'))[_0x4474('0x10')](socket);function respondWithRpcPromise(_0x497a6f,_0x34e5eb,_0x30bdf9){return new BPromise(function(_0x248230,_0x266de2){return client[_0x4474('0x11')](_0x497a6f,_0x30bdf9)[_0x4474('0x12')](function(_0x2901a4){logger[_0x4474('0x13')](_0x4474('0x14'),_0x34e5eb,_0x4474('0x15'));logger['debug'](_0x4474('0x16'),_0x34e5eb,_0x4474('0x15'),JSON[_0x4474('0x17')](_0x2901a4));if(_0x2901a4[_0x4474('0x18')]){if(_0x2901a4['error'][_0x4474('0x19')]===0x1f4){logger['error']('SmsMessage,\x20%s,\x20%s',_0x34e5eb,_0x2901a4[_0x4474('0x18')][_0x4474('0x1a')]);return _0x266de2(_0x2901a4[_0x4474('0x18')][_0x4474('0x1a')]);}logger[_0x4474('0x18')](_0x4474('0x14'),_0x34e5eb,_0x2901a4['error']['message']);return _0x248230(_0x2901a4[_0x4474('0x18')][_0x4474('0x1a')]);}else{logger[_0x4474('0x13')](_0x4474('0x14'),_0x34e5eb,_0x4474('0x15'));_0x248230(_0x2901a4[_0x4474('0x1b')]['message']);}})[_0x4474('0x1c')](function(_0x42d282){logger[_0x4474('0x18')](_0x4474('0x14'),_0x34e5eb,_0x42d282);_0x266de2(_0x42d282);});});}exports[_0x4474('0x1d')]=function(_0x6feb20){var _0x1ea484=this;return new Promise(function(_0x4c91d7,_0x22cc1c){return db[_0x4474('0x1e')][_0x4474('0x1f')](_0x6feb20[_0x4474('0x20')],{'raw':_0x6feb20[_0x4474('0x21')]?_0x6feb20[_0x4474('0x21')]['raw']===undefined?!![]:![]:!![]})[_0x4474('0x12')](function(_0x2e1c27){logger['info'](_0x4474('0x1d'),_0x6feb20);logger[_0x4474('0x22')](_0x4474('0x1d'),_0x6feb20,JSON['stringify'](_0x2e1c27));_0x4c91d7(_0x2e1c27);})[_0x4474('0x1c')](function(_0x992d5f){logger['error'](_0x4474('0x1d'),_0x992d5f[_0x4474('0x1a')],_0x6feb20);_0x22cc1c(_0x1ea484[_0x4474('0x18')](0x1f4,_0x992d5f[_0x4474('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 8485349..c04bf94 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 _0xefd8=['removeListener','length','smsMessage:','./smsMessage.events','save','update','emit'];(function(_0x303c30,_0x16edcb){var _0x43161b=function(_0x3330ff){while(--_0x3330ff){_0x303c30['push'](_0x303c30['shift']());}};_0x43161b(++_0x16edcb);}(_0xefd8,0x1ae));var _0x8efd=function(_0x359471,_0x4c7eaf){_0x359471=_0x359471-0x0;var _0x131710=_0xefd8[_0x359471];return _0x131710;};'use strict';var SmsMessageEvents=require(_0x8efd('0x0'));var events=[_0x8efd('0x1'),'remove',_0x8efd('0x2')];function createListener(_0x21cb64,_0x11dc04){return function(_0xad068a){_0x11dc04[_0x8efd('0x3')](_0x21cb64,_0xad068a);};}function removeListener(_0x2e015e,_0x4e7d34){return function(){SmsMessageEvents[_0x8efd('0x4')](_0x2e015e,_0x4e7d34);};}exports['register']=function(_0x425d74){for(var _0x4805ce=0x0,_0x27f757=events[_0x8efd('0x5')];_0x4805ce<_0x27f757;_0x4805ce++){var _0x32261a=events[_0x4805ce];var _0x4ff94e=createListener(_0x8efd('0x6')+_0x32261a,_0x425d74);SmsMessageEvents['on'](_0x32261a,_0x4ff94e);}}; \ No newline at end of file +var _0x9f1b=['remove','emit','removeListener','length','./smsMessage.events'];(function(_0x45beb2,_0x2144ae){var _0x1167af=function(_0x199954){while(--_0x199954){_0x45beb2['push'](_0x45beb2['shift']());}};_0x1167af(++_0x2144ae);}(_0x9f1b,0x14e));var _0xb9f1=function(_0x1244f3,_0x48ab9d){_0x1244f3=_0x1244f3-0x0;var _0x4b22d6=_0x9f1b[_0x1244f3];return _0x4b22d6;};'use strict';var SmsMessageEvents=require(_0xb9f1('0x0'));var events=['save',_0xb9f1('0x1'),'update'];function createListener(_0x338c93,_0x4b6358){return function(_0x263a5b){_0x4b6358[_0xb9f1('0x2')](_0x338c93,_0x263a5b);};}function removeListener(_0x517ae8,_0x30d08c){return function(){SmsMessageEvents[_0xb9f1('0x3')](_0x517ae8,_0x30d08c);};}exports['register']=function(_0x37b75b){for(var _0x25bcbb=0x0,_0x4641d2=events[_0xb9f1('0x4')];_0x25bcbb<_0x4641d2;_0x25bcbb++){var _0x153e89=events[_0x25bcbb];var _0x1c73f2=createListener('smsMessage:'+_0x153e89,_0x37b75b);SmsMessageEvents['on'](_0x153e89,_0x1c73f2);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 14eee20..8acaac9 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 _0xddb8=['/:id/users','put','/:id','update','delete','removeTeams','removeAgents','exports','multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsQueue.controller','index','get','isAuthenticated','/:id/members','post','create','/:id/teams','addTeams'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0xddb8,0xee));var _0x8ddb=function(_0x368d90,_0x3b9b75){_0x368d90=_0x368d90-0x0;var _0x3ca5f5=_0xddb8[_0x368d90];return _0x3ca5f5;};'use strict';var multer=require(_0x8ddb('0x0'));var util=require(_0x8ddb('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8ddb('0x2')]();var fs_extra=require(_0x8ddb('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x8ddb('0x4'));var config=require(_0x8ddb('0x5'));var controller=require(_0x8ddb('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x8ddb('0x7')]);router[_0x8ddb('0x8')]('/describe',auth[_0x8ddb('0x9')](),controller['describe']);router[_0x8ddb('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x8ddb('0x8')](_0x8ddb('0xa'),auth[_0x8ddb('0x9')](),controller['getMembers']);router['get']('/:id/teams',auth[_0x8ddb('0x9')](),controller['getTeams']);router[_0x8ddb('0x8')]('/:id/users',auth[_0x8ddb('0x9')](),controller['getAgents']);router[_0x8ddb('0xb')]('/',auth['isAuthenticated'](),controller[_0x8ddb('0xc')]);router[_0x8ddb('0xb')](_0x8ddb('0xd'),auth[_0x8ddb('0x9')](),controller[_0x8ddb('0xe')]);router[_0x8ddb('0xb')](_0x8ddb('0xf'),auth[_0x8ddb('0x9')](),controller['addAgents']);router[_0x8ddb('0x10')](_0x8ddb('0x11'),auth[_0x8ddb('0x9')](),controller[_0x8ddb('0x12')]);router[_0x8ddb('0x13')](_0x8ddb('0x11'),auth[_0x8ddb('0x9')](),controller['destroy']);router[_0x8ddb('0x13')]('/:id/teams',auth[_0x8ddb('0x9')](),controller[_0x8ddb('0x14')]);router[_0x8ddb('0x13')]('/:id/users',auth[_0x8ddb('0x9')](),controller[_0x8ddb('0x15')]);module[_0x8ddb('0x16')]=router; \ No newline at end of file +var _0xc101=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','index','/describe','isAuthenticated','describe','/:id','getMembers','/:id/teams','getTeams','post','create','/:id/users','update','delete','destroy','removeTeams','exports','multer','path','connect-timeout'];(function(_0x4b22c1,_0x2988d9){var _0x4767ce=function(_0x146c54){while(--_0x146c54){_0x4b22c1['push'](_0x4b22c1['shift']());}};_0x4767ce(++_0x2988d9);}(_0xc101,0xcd));var _0x1c10=function(_0x3e44fa,_0x75ed2a){_0x3e44fa=_0x3e44fa-0x0;var _0x2a0aba=_0xc101[_0x3e44fa];return _0x2a0aba;};'use strict';var multer=require(_0x1c10('0x0'));var util=require('util');var path=require(_0x1c10('0x1'));var timeout=require(_0x1c10('0x2'));var express=require(_0x1c10('0x3'));var router=express['Router']();var fs_extra=require(_0x1c10('0x4'));var auth=require(_0x1c10('0x5'));var interaction=require(_0x1c10('0x6'));var config=require(_0x1c10('0x7'));var controller=require(_0x1c10('0x8'));router[_0x1c10('0x9')]('/',auth['isAuthenticated'](),controller[_0x1c10('0xa')]);router[_0x1c10('0x9')](_0x1c10('0xb'),auth[_0x1c10('0xc')](),controller[_0x1c10('0xd')]);router[_0x1c10('0x9')](_0x1c10('0xe'),auth[_0x1c10('0xc')](),controller['show']);router[_0x1c10('0x9')]('/:id/members',auth[_0x1c10('0xc')](),controller[_0x1c10('0xf')]);router[_0x1c10('0x9')](_0x1c10('0x10'),auth[_0x1c10('0xc')](),controller[_0x1c10('0x11')]);router[_0x1c10('0x9')]('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router[_0x1c10('0x12')]('/',auth[_0x1c10('0xc')](),controller[_0x1c10('0x13')]);router[_0x1c10('0x12')]('/:id/teams',auth[_0x1c10('0xc')](),controller['addTeams']);router[_0x1c10('0x12')](_0x1c10('0x14'),auth['isAuthenticated'](),controller['addAgents']);router['put'](_0x1c10('0xe'),auth[_0x1c10('0xc')](),controller[_0x1c10('0x15')]);router[_0x1c10('0x16')](_0x1c10('0xe'),auth[_0x1c10('0xc')](),controller[_0x1c10('0x17')]);router[_0x1c10('0x16')](_0x1c10('0x10'),auth[_0x1c10('0xc')](),controller[_0x1c10('0x18')]);router[_0x1c10('0x16')](_0x1c10('0x14'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x1c10('0x19')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 5b38133..477820e 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 _0x62b2=['roundrobin','sequelize','exports','name','STRING','ENUM','rrmemory','beepall'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0x62b2,0x181));var _0x262b=function(_0x58dae7,_0x2a7986){_0x58dae7=_0x58dae7-0x0;var _0x57abc3=_0x62b2[_0x58dae7];return _0x57abc3;};'use strict';var Sequelize=require(_0x262b('0x0'));module[_0x262b('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x262b('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x262b('0x3')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x262b('0x4')](_0x262b('0x5'),_0x262b('0x6'),_0x262b('0x7'))}}; \ No newline at end of file +var _0x7ad9=['INTEGER','ENUM','rrmemory','roundrobin','sequelize','exports','STRING','name'];(function(_0x1a72b8,_0x1e4f4b){var _0x39f72d=function(_0x35aef1){while(--_0x35aef1){_0x1a72b8['push'](_0x1a72b8['shift']());}};_0x39f72d(++_0x1e4f4b);}(_0x7ad9,0x104));var _0x97ad=function(_0x5aa2a1,_0xd9c1c9){_0x5aa2a1=_0x5aa2a1-0x0;var _0x1a9949=_0x7ad9[_0x5aa2a1];return _0x1a9949;};'use strict';var Sequelize=require(_0x97ad('0x0'));module[_0x97ad('0x1')]={'name':{'type':Sequelize[_0x97ad('0x2')],'unique':_0x97ad('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x97ad('0x2')]},'timeout':{'type':Sequelize[_0x97ad('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x97ad('0x5')](_0x97ad('0x6'),'beepall',_0x97ad('0x7'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 83ad210..5dfc43d 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 _0xdb28=['userSmsQueue:save','removeTeams','select','field','from','team_has_sms_queues','join','SmsQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','QueryTypes','TeamId','includes','all','union','value','isEmpty','removeAgents','forEach','addAgents','omit','spread','userSmsQueue:remove','getAgents','bluebird','util','lodash','squel','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','./smsQueue.socket','register','sendStatus','end','status','json','offset','undefined','count','limit','Content-Range','update','then','get','SmsQueues','destroy','error','stack','name','map','SmsQueue','fieldName','type','key','where','include','rows','show','keys','query','filters','intersection','model','attributes','fields','length','includeAll','merge','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','catch','body','params','describe','getMembers','findOne','UserSmsQueue','rawAttributes','hasOwnProperty','nolimit','order','sort','SmsQueueId','filter','findAll','User','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','format','%s/%s','getTeams','Team','pick','ids','Agents','online','voicePause','interface','sequelize','transaction','addTeams','each','emit'];(function(_0x43020d,_0x214151){var _0x379d07=function(_0x5b843a){while(--_0x5b843a){_0x43020d['push'](_0x43020d['shift']());}};_0x379d07(++_0x214151);}(_0xdb28,0x106));var _0x8db2=function(_0x3fa433,_0x16d93f){_0x3fa433=_0x3fa433-0x0;var _0x2d985b=_0xdb28[_0x3fa433];return _0x2d985b;};'use strict';var BPromise=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var _=require(_0x8db2('0x2'));var squel=require(_0x8db2('0x3'));var Redis=require('ioredis');var qs=require(_0x8db2('0x4'));var logger=require(_0x8db2('0x5'))(_0x8db2('0x6'));var config=require(_0x8db2('0x7'));var db=require(_0x8db2('0x8'))['db'];config['redis']=_[_0x8db2('0x9')](config[_0x8db2('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8db2('0xa')]));require(_0x8db2('0xb'))[_0x8db2('0xc')](socket);function respondWithStatusCode(_0x29f698,_0x2f3f2f){_0x2f3f2f=_0x2f3f2f||0xcc;return function(_0x1ff362){if(_0x1ff362){return _0x29f698[_0x8db2('0xd')](_0x2f3f2f);}return _0x29f698['status'](_0x2f3f2f)[_0x8db2('0xe')]();};}function respondWithResult(_0x476216,_0x1f62af){_0x1f62af=_0x1f62af||0xc8;return function(_0x57015f){if(_0x57015f){return _0x476216[_0x8db2('0xf')](_0x1f62af)[_0x8db2('0x10')](_0x57015f);}};}function respondWithFilteredResult(_0x576475,_0x41beda){return function(_0x3b2faa){if(_0x3b2faa){var _0x1349f6=typeof _0x41beda[_0x8db2('0x11')]===_0x8db2('0x12')&&typeof _0x41beda['limit']==='undefined';var _0x15070d=_0x3b2faa[_0x8db2('0x13')];var _0x350d61=_0x1349f6?0x0:_0x41beda[_0x8db2('0x11')];var _0x227355=_0x1349f6?_0x3b2faa[_0x8db2('0x13')]:_0x41beda[_0x8db2('0x11')]+_0x41beda[_0x8db2('0x14')];var _0x131252;if(_0x227355>=_0x15070d){_0x227355=_0x15070d;_0x131252=0xc8;}else{_0x131252=0xce;}_0x576475[_0x8db2('0xf')](_0x131252);return _0x576475['set'](_0x8db2('0x15'),_0x350d61+'-'+_0x227355+'/'+_0x15070d)[_0x8db2('0x10')](_0x3b2faa);}return null;};}function saveUpdates(_0x48101e){return function(_0x2b3f73){if(_0x2b3f73){return _0x2b3f73[_0x8db2('0x16')](_0x48101e)[_0x8db2('0x17')](function(_0x3fddc2){return _0x3fddc2;});}return null;};}function removeEntity(_0x2efd06){return function(_0x46ce14){if(_0x46ce14){return _0x46ce14['destroy']()['then'](function(){var _0x77789=_0x46ce14[_0x8db2('0x18')]({'plain':!![]});var _0x1310d3=_0x8db2('0x19');return db['UserProfileResource'][_0x8db2('0x1a')]({'where':{'type':_0x1310d3,'resourceId':_0x77789['id']}})[_0x8db2('0x17')](function(){return _0x46ce14;});})[_0x8db2('0x17')](function(){_0x2efd06[_0x8db2('0xf')](0xcc)[_0x8db2('0xe')]();});}};}function handleEntityNotFound(_0x597260){return function(_0x124467){if(!_0x124467){_0x597260[_0x8db2('0xd')](0x194);}return _0x124467;};}function handleError(_0x18f69c,_0x125be2){_0x125be2=_0x125be2||0x1f4;return function(_0x2260d8){logger[_0x8db2('0x1b')](_0x2260d8[_0x8db2('0x1c')]);if(_0x2260d8['name']){delete _0x2260d8[_0x8db2('0x1d')];}_0x18f69c['status'](_0x125be2)['send'](_0x2260d8);};}exports['index']=function(_0x4d923c,_0xec8cd2){var _0x29b5cd={};var _0x3be281={'count':0x0,'rows':[]};var _0x2baed0=_[_0x8db2('0x1e')](db[_0x8db2('0x1f')]['rawAttributes'],function(_0x3544ba){return{'name':_0x3544ba[_0x8db2('0x20')],'type':_0x3544ba[_0x8db2('0x21')][_0x8db2('0x22')]};});_0x29b5cd=qs['getOptions'](_0x2baed0,_0x4d923c);var _0x2e0691={'where':_0x29b5cd[_0x8db2('0x23')]};return db[_0x8db2('0x1f')][_0x8db2('0x13')](_0x2e0691)[_0x8db2('0x17')](function(_0x21bae5){_0x3be281[_0x8db2('0x13')]=_0x21bae5;_0x29b5cd[_0x8db2('0x24')]=qs[_0x8db2('0x24')](_0x4d923c['query']);return db[_0x8db2('0x1f')]['findAll'](_0x29b5cd);})['then'](function(_0x302188){_0x3be281[_0x8db2('0x25')]=_0x302188;return _0x3be281;})[_0x8db2('0x17')](respondWithFilteredResult(_0xec8cd2,_0x29b5cd))['catch'](handleError(_0xec8cd2,null));};exports[_0x8db2('0x26')]=function(_0x56b71a,_0x3f7aac){var _0x2b653b={'raw':!![],'where':{'id':_0x56b71a['params']['id']}},_0x14bd12={};_0x14bd12['model']=_[_0x8db2('0x27')](db[_0x8db2('0x1f')]['rawAttributes']);_0x14bd12['query']=_[_0x8db2('0x27')](_0x56b71a[_0x8db2('0x28')]);_0x14bd12[_0x8db2('0x29')]=_[_0x8db2('0x2a')](_0x14bd12[_0x8db2('0x2b')],_0x14bd12[_0x8db2('0x28')]);_0x2b653b[_0x8db2('0x2c')]=_[_0x8db2('0x2a')](_0x14bd12[_0x8db2('0x2b')],qs[_0x8db2('0x2d')](_0x56b71a['query'][_0x8db2('0x2d')]));_0x2b653b[_0x8db2('0x2c')]=_0x2b653b['attributes'][_0x8db2('0x2e')]?_0x2b653b[_0x8db2('0x2c')]:_0x14bd12['model'];if(_0x56b71a['query'][_0x8db2('0x2f')]){_0x2b653b['include']=[{'all':!![]}];}_0x2b653b=_[_0x8db2('0x30')]({},_0x2b653b,_0x56b71a[_0x8db2('0x31')]);return db[_0x8db2('0x1f')][_0x8db2('0x32')](_0x2b653b)['then'](handleEntityNotFound(_0x3f7aac,null))[_0x8db2('0x17')](respondWithResult(_0x3f7aac,null))['catch'](handleError(_0x3f7aac,null));};exports[_0x8db2('0x33')]=function(_0xd550ae,_0x2c8bc9){return db[_0x8db2('0x1f')]['create'](_0xd550ae['body'],{})[_0x8db2('0x17')](function(_0x2c0507){var _0x5dc2b4=_0xd550ae[_0x8db2('0x34')][_0x8db2('0x18')]({'plain':!![]});if(!_0x5dc2b4)throw new Error(_0x8db2('0x35'));if(_0x5dc2b4['role']===_0x8db2('0x34')){var _0x149186=_0x2c0507[_0x8db2('0x18')]({'plain':!![]});var _0x279e74=_0x8db2('0x19');return db[_0x8db2('0x36')][_0x8db2('0x32')]({'where':{'name':_0x279e74,'userProfileId':_0x5dc2b4[_0x8db2('0x37')]},'raw':!![]})[_0x8db2('0x17')](function(_0x63c561){if(_0x63c561&&_0x63c561[_0x8db2('0x38')]===0x0){return db[_0x8db2('0x39')][_0x8db2('0x33')]({'name':_0x149186['name'],'resourceId':_0x149186['id'],'type':_0x63c561[_0x8db2('0x1d')],'sectionId':_0x63c561['id']},{})[_0x8db2('0x17')](function(){return _0x2c0507;});}else{return _0x2c0507;}})['catch'](function(_0x49a7ae){logger[_0x8db2('0x1b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x49a7ae);throw _0x49a7ae;});}return _0x2c0507;})[_0x8db2('0x17')](respondWithResult(_0x2c8bc9,0xc9))[_0x8db2('0x3a')](handleError(_0x2c8bc9,null));};exports[_0x8db2('0x16')]=function(_0x307783,_0xb4fe2c){if(_0x307783[_0x8db2('0x3b')]['id']){delete _0x307783[_0x8db2('0x3b')]['id'];}return db['SmsQueue'][_0x8db2('0x32')]({'where':{'id':_0x307783[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0xb4fe2c,null))[_0x8db2('0x17')](saveUpdates(_0x307783['body'],null))[_0x8db2('0x17')](respondWithResult(_0xb4fe2c,null))[_0x8db2('0x3a')](handleError(_0xb4fe2c,null));};exports[_0x8db2('0x1a')]=function(_0x2c47cc,_0x5427af){return db[_0x8db2('0x1f')]['find']({'where':{'id':_0x2c47cc[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0x5427af,null))[_0x8db2('0x17')](removeEntity(_0x5427af,null))['catch'](handleError(_0x5427af,null));};exports['describe']=function(_0x1ec3d0,_0x47c556){return db[_0x8db2('0x1f')][_0x8db2('0x3d')]()[_0x8db2('0x17')](respondWithResult(_0x47c556,null))[_0x8db2('0x3a')](handleError(_0x47c556,null));};exports[_0x8db2('0x3e')]=function(_0x40c6e6,_0x4355e2){var _0xab6bdd={'raw':!![],'where':{}},_0x4291e3={},_0x12a1ef;return db[_0x8db2('0x1f')][_0x8db2('0x3f')]({'where':{'id':_0x40c6e6['params']['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0x4355e2,null))[_0x8db2('0x17')](function(_0xdbba64){if(_0xdbba64){_0x12a1ef=_0xdbba64[_0x8db2('0x18')]({'plain':!![]});_0x4291e3['model']=_['keys'](db[_0x8db2('0x40')][_0x8db2('0x41')]);_0x4291e3[_0x8db2('0x28')]=_['keys'](_0x40c6e6['query']);_0x4291e3['filters']=_[_0x8db2('0x2a')](_0x4291e3[_0x8db2('0x2b')],_0x4291e3[_0x8db2('0x28')]);_0xab6bdd[_0x8db2('0x2c')]=_[_0x8db2('0x2a')](_0x4291e3[_0x8db2('0x2b')],qs[_0x8db2('0x2d')](_0x40c6e6['query']['fields']));_0xab6bdd[_0x8db2('0x2c')]=_0xab6bdd[_0x8db2('0x2c')][_0x8db2('0x2e')]?_0xab6bdd[_0x8db2('0x2c')]:_0x4291e3[_0x8db2('0x2b')];if(!_0x40c6e6[_0x8db2('0x28')][_0x8db2('0x42')](_0x8db2('0x43'))){_0xab6bdd[_0x8db2('0x14')]=qs[_0x8db2('0x14')](_0x40c6e6[_0x8db2('0x28')][_0x8db2('0x14')]);_0xab6bdd[_0x8db2('0x11')]=qs[_0x8db2('0x11')](_0x40c6e6[_0x8db2('0x28')]['offset']);}_0xab6bdd[_0x8db2('0x44')]=qs[_0x8db2('0x45')](_0x40c6e6['query'][_0x8db2('0x45')]);_0xab6bdd[_0x8db2('0x23')]=qs[_0x8db2('0x29')](_['pick'](_0x40c6e6[_0x8db2('0x28')],_0x4291e3[_0x8db2('0x29')]));_0xab6bdd[_0x8db2('0x23')][_0x8db2('0x46')]=_0xdbba64['id'];if(_0x40c6e6[_0x8db2('0x28')]['filter']){_0xab6bdd[_0x8db2('0x23')]=_[_0x8db2('0x30')](_0xab6bdd[_0x8db2('0x23')],{'$or':_['map'](_0xab6bdd[_0x8db2('0x2c')],function(_0x18cc13){var _0x33dddd={};_0x33dddd[_0x18cc13]={'$like':'%'+_0x40c6e6[_0x8db2('0x28')][_0x8db2('0x47')]+'%'};return _0x33dddd;})});}_0xab6bdd=_[_0x8db2('0x30')]({},_0xab6bdd,_0x40c6e6[_0x8db2('0x31')]);return db['UserSmsQueue'][_0x8db2('0x48')](_0xab6bdd);}})[_0x8db2('0x17')](function(_0x4d3c19){if(_0x4d3c19){return db[_0x8db2('0x49')][_0x8db2('0x4a')]({'where':{'id':_['map'](_0x4d3c19,_0x8db2('0x4b')),'role':_0x8db2('0x4c')},'attributes':['id',_0x8db2('0x1d'),_0x8db2('0x4d'),_0x8db2('0x4e'),_0x8db2('0x4f')]});}})[_0x8db2('0x17')](function(_0x33a600){if(_0x33a600){return{'count':_0x33a600[_0x8db2('0x13')],'rows':_[_0x8db2('0x1e')](_0x33a600[_0x8db2('0x25')],function(_0x447a47){return{'membername':_0x447a47[_0x8db2('0x1d')],'UserId':_0x447a47['id'],'queue_name':_0x12a1ef[_0x8db2('0x1d')],'SmsQueueId':_0x12a1ef['id'],'interface':util[_0x8db2('0x50')](_0x8db2('0x51'),'SIP',_0x447a47[_0x8db2('0x1d')]),'penalty':0x0,'paused':_0x447a47[_0x8db2('0x4d')],'createdAt':_0x447a47[_0x8db2('0x4f')],'updatedAt':_0x447a47[_0x8db2('0x4e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x8db2('0x17')](respondWithFilteredResult(_0x4355e2,_0xab6bdd))['catch'](handleError(_0x4355e2,null));};exports[_0x8db2('0x52')]=function(_0x2c3087,_0x3ab670){var _0x1e1c0d={};var _0x2ad70f={};var _0x348da8;var _0x17341d;return db[_0x8db2('0x1f')][_0x8db2('0x3f')]({'where':{'id':_0x2c3087[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0x3ab670,null))[_0x8db2('0x17')](function(_0x170a72){if(_0x170a72){_0x348da8=_0x170a72;_0x2ad70f[_0x8db2('0x2b')]=_[_0x8db2('0x27')](db[_0x8db2('0x53')][_0x8db2('0x41')]);_0x2ad70f[_0x8db2('0x28')]=_['keys'](_0x2c3087[_0x8db2('0x28')]);_0x2ad70f['filters']=_[_0x8db2('0x2a')](_0x2ad70f['model'],_0x2ad70f[_0x8db2('0x28')]);_0x1e1c0d[_0x8db2('0x2c')]=_[_0x8db2('0x2a')](_0x2ad70f[_0x8db2('0x2b')],qs[_0x8db2('0x2d')](_0x2c3087['query']['fields']));_0x1e1c0d[_0x8db2('0x2c')]=_0x1e1c0d[_0x8db2('0x2c')][_0x8db2('0x2e')]?_0x1e1c0d[_0x8db2('0x2c')]:_0x2ad70f[_0x8db2('0x2b')];_0x1e1c0d[_0x8db2('0x44')]=qs[_0x8db2('0x45')](_0x2c3087[_0x8db2('0x28')]['sort']);_0x1e1c0d[_0x8db2('0x23')]=qs[_0x8db2('0x29')](_[_0x8db2('0x54')](_0x2c3087[_0x8db2('0x28')],_0x2ad70f[_0x8db2('0x29')]));if(_0x2c3087[_0x8db2('0x28')][_0x8db2('0x47')]){_0x1e1c0d[_0x8db2('0x23')]=_['merge'](_0x1e1c0d['where'],{'$or':_[_0x8db2('0x1e')](_0x1e1c0d[_0x8db2('0x2c')],function(_0x1d2dfc){var _0x27f4cd={};_0x27f4cd[_0x1d2dfc]={'$like':'%'+_0x2c3087[_0x8db2('0x28')]['filter']+'%'};return _0x27f4cd;})});}_0x1e1c0d=_['merge']({},_0x1e1c0d,_0x2c3087[_0x8db2('0x31')]);return _0x348da8[_0x8db2('0x52')](_0x1e1c0d);}})['then'](function(_0xa698bd){if(_0xa698bd){_0x17341d=_0xa698bd[_0x8db2('0x2e')];if(!_0x2c3087[_0x8db2('0x28')]['hasOwnProperty'](_0x8db2('0x43'))){_0x1e1c0d[_0x8db2('0x14')]=qs[_0x8db2('0x14')](_0x2c3087['query'][_0x8db2('0x14')]);_0x1e1c0d[_0x8db2('0x11')]=qs[_0x8db2('0x11')](_0x2c3087[_0x8db2('0x28')][_0x8db2('0x11')]);}return _0x348da8['getTeams'](_0x1e1c0d);}})[_0x8db2('0x17')](function(_0x3023fe){if(_0x3023fe){return _0x3023fe?{'count':_0x17341d,'rows':_0x3023fe}:null;}})[_0x8db2('0x17')](respondWithResult(_0x3ab670,null))['catch'](handleError(_0x3ab670,null));};exports['addTeams']=function(_0x2cdf3c,_0xbe05ca){var _0x487dcb=_0x2cdf3c[_0x8db2('0x3b')][_0x8db2('0x55')];return db[_0x8db2('0x53')][_0x8db2('0x48')]({'where':{'id':_0x487dcb},'attributes':['id'],'include':[{'model':db[_0x8db2('0x49')],'as':_0x8db2('0x56'),'attributes':['id',_0x8db2('0x1d'),_0x8db2('0x57'),_0x8db2('0x58'),_0x8db2('0x59')],'raw':!![]}]})[_0x8db2('0x17')](function(_0x3e1478){if(_0x3e1478){var _0x24a52d=_['flatMap'](_0x3e1478,function(_0x2ba42d){var _0x4f29f1=_0x2ba42d[_0x8db2('0x18')]({'plain':!![]});return _0x4f29f1[_0x8db2('0x56')];});return db['SmsQueue'][_0x8db2('0x32')]({'where':{'id':_0x2cdf3c[_0x8db2('0x3c')]['id']}})['then'](function(_0x2159c4){return db[_0x8db2('0x5a')][_0x8db2('0x5b')](function(_0x25a3ab){return _0x2159c4[_0x8db2('0x5c')](_0x487dcb,{'transaction':_0x25a3ab})[_0x8db2('0x17')](function(){return BPromise[_0x8db2('0x5d')](_0x24a52d,function(_0x3ac0fa){return db[_0x8db2('0x40')]['findOrCreate']({'where':{'UserId':_0x3ac0fa['id'],'SmsQueueId':_0x2cdf3c['params']['id']},'transaction':_0x25a3ab});});})[_0x8db2('0x17')](function(){_0x24a52d['forEach'](function(_0xf8afa5){socket[_0x8db2('0x5e')](_0x8db2('0x5f'),{'UserId':_0xf8afa5['id'],'SmsQueueId':_0x2159c4['id']});});});});});}})['then'](respondWithStatusCode(_0xbe05ca,null))[_0x8db2('0x3a')](handleError(_0xbe05ca,null));};exports[_0x8db2('0x60')]=function(_0x3e37e7,_0x591c5d){return db[_0x8db2('0x53')][_0x8db2('0x48')]({'where':{'id':_0x3e37e7[_0x8db2('0x28')][_0x8db2('0x55')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x8db2('0x56'),'attributes':['id'],'raw':!![]}]})[_0x8db2('0x17')](handleEntityNotFound(_0x591c5d,null))[_0x8db2('0x17')](function(_0x1edb1a){var _0xcf1c42=_[_0x8db2('0x1e')](_0x1edb1a,'id');var _0x1aadfb=[];var _0x3682bf=[];var _0x358f48=squel[_0x8db2('0x61')]();_0x358f48[_0x8db2('0x62')]('tq.TeamId')[_0x8db2('0x63')](_0x8db2('0x64'),'tq')[_0x8db2('0x65')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x8db2('0x66'),_0x3e37e7[_0x8db2('0x3c')]['id']);for(var _0x3191c8=0x0;_0x3191c8<_0x1edb1a[_0x8db2('0x2e')];_0x3191c8+=0x1){let _0x2ad024=_0x1edb1a[_0x3191c8];for(var _0x313918=0x0;_0x313918<_0x2ad024[_0x8db2('0x56')][_0x8db2('0x2e')];_0x313918+=0x1){let _0x3b1929=_0x2ad024[_0x8db2('0x56')][_0x313918];var _0x46eb80=_0x358f48['clone']();_0x46eb80[_0x8db2('0x23')](_0x8db2('0x67'),_0x3b1929['id']);_0x3682bf[_0x8db2('0x68')](db[_0x8db2('0x5a')]['query'](_0x46eb80['toString'](),{'type':db[_0x8db2('0x5a')][_0x8db2('0x69')]['SELECT']})[_0x8db2('0x17')](function(_0x121f31){if(_0x121f31[_0x8db2('0x2e')]===0x1){return _0x3b1929['id'];}else{var _0x5f2ece=_['every'](_['map'](_0x121f31,_0x8db2('0x6a')),function(_0x18b4a6){return _[_0x8db2('0x6b')](_0xcf1c42,_0x18b4a6);});if(_0x5f2ece){return _0x3b1929['id'];}}}));}}return BPromise[_0x8db2('0x6c')](_0x3682bf)[_0x8db2('0x17')](function(_0x4e8aac){_0x1aadfb=_(_0x1aadfb)[_0x8db2('0x6d')](_0x4e8aac)['compact']()[_0x8db2('0x6e')]();return db[_0x8db2('0x1f')][_0x8db2('0x32')]({'where':{'id':_0x3e37e7[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](function(_0x5d5380){return db['sequelize'][_0x8db2('0x5b')](function(_0x51afcf){return _0x5d5380[_0x8db2('0x60')](_0x3e37e7[_0x8db2('0x28')][_0x8db2('0x55')],{'transaction':_0x51afcf})[_0x8db2('0x17')](function(){if(!_[_0x8db2('0x6f')](_0x1aadfb)){return _0x5d5380[_0x8db2('0x70')](_0x1aadfb,{'transaction':_0x51afcf});}})['then'](function(){_0x1aadfb[_0x8db2('0x71')](function(_0x222ea2){socket[_0x8db2('0x5e')]('userSmsQueue:remove',{'UserId':_0x222ea2,'SmsQueueId':_0x5d5380['id']});});});});});});})[_0x8db2('0x17')](respondWithStatusCode(_0x591c5d,null))[_0x8db2('0x3a')](handleError(_0x591c5d,null));};exports['addAgents']=function(_0x2d7abf,_0x7cb97d){return db[_0x8db2('0x1f')][_0x8db2('0x32')]({'where':{'id':_0x2d7abf[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0x7cb97d,null))[_0x8db2('0x17')](function(_0x19e25b){if(_0x19e25b){return _0x19e25b[_0x8db2('0x72')](_0x2d7abf['body'][_0x8db2('0x55')],_[_0x8db2('0x73')](_0x2d7abf[_0x8db2('0x3b')],[_0x8db2('0x55'),'id'])||{})[_0x8db2('0x74')](function(_0x345ff9){for(var _0x16d1c5=0x0;_0x16d1c5<_0x2d7abf[_0x8db2('0x3b')][_0x8db2('0x55')][_0x8db2('0x2e')];_0x16d1c5+=0x1){socket['emit'](_0x8db2('0x5f'),{'UserId':Number(_0x2d7abf[_0x8db2('0x3b')][_0x8db2('0x55')][_0x16d1c5]),'SmsQueueId':Number(_0x2d7abf[_0x8db2('0x3c')]['id'])});}return _0x345ff9;});}})['then'](respondWithResult(_0x7cb97d,null))[_0x8db2('0x3a')](handleError(_0x7cb97d,null));};exports[_0x8db2('0x70')]=function(_0x46476e,_0x4f653e){return db['SmsQueue'][_0x8db2('0x32')]({'where':{'id':_0x46476e[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0x4f653e,null))[_0x8db2('0x17')](function(_0x4f9ce4){if(_0x4f9ce4){return _0x4f9ce4[_0x8db2('0x70')](_0x46476e[_0x8db2('0x28')][_0x8db2('0x55')])[_0x8db2('0x17')](function(){if(_['isArray'](_0x46476e[_0x8db2('0x28')][_0x8db2('0x55')])){for(var _0x3e7b24=0x0;_0x3e7b24<_0x46476e['query']['ids']['length'];_0x3e7b24+=0x1){socket[_0x8db2('0x5e')](_0x8db2('0x75'),{'UserId':Number(_0x46476e[_0x8db2('0x28')][_0x8db2('0x55')][_0x3e7b24]),'SmsQueueId':Number(_0x46476e['params']['id'])});}}else{socket['emit'](_0x8db2('0x75'),{'UserId':Number(_0x46476e[_0x8db2('0x28')][_0x8db2('0x55')]),'SmsQueueId':Number(_0x46476e[_0x8db2('0x3c')]['id'])});}});}})[_0x8db2('0x17')](respondWithStatusCode(_0x4f653e,null))[_0x8db2('0x3a')](handleError(_0x4f653e,null));};exports['getAgents']=function(_0x2942eb,_0x5f32ce){var _0x432780={};var _0x23457b={};var _0x1ef898;var _0x39f2d3;return db[_0x8db2('0x1f')]['findOne']({'where':{'id':_0x2942eb[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0x5f32ce,null))['then'](function(_0x28beec){if(_0x28beec){_0x1ef898=_0x28beec;_0x23457b[_0x8db2('0x2b')]=_[_0x8db2('0x27')](db[_0x8db2('0x49')]['rawAttributes']);_0x23457b[_0x8db2('0x28')]=_['keys'](_0x2942eb['query']);_0x23457b[_0x8db2('0x29')]=_[_0x8db2('0x2a')](_0x23457b[_0x8db2('0x2b')],_0x23457b[_0x8db2('0x28')]);_0x432780[_0x8db2('0x2c')]=_[_0x8db2('0x2a')](_0x23457b[_0x8db2('0x2b')],qs['fields'](_0x2942eb[_0x8db2('0x28')]['fields']));_0x432780['attributes']=_0x432780[_0x8db2('0x2c')]['length']?_0x432780['attributes']:_0x23457b[_0x8db2('0x2b')];_0x432780[_0x8db2('0x44')]=qs[_0x8db2('0x45')](_0x2942eb['query'][_0x8db2('0x45')]);_0x432780[_0x8db2('0x23')]=qs[_0x8db2('0x29')](_['pick'](_0x2942eb[_0x8db2('0x28')],_0x23457b[_0x8db2('0x29')]));if(_0x2942eb[_0x8db2('0x28')][_0x8db2('0x47')]){_0x432780[_0x8db2('0x23')]=_[_0x8db2('0x30')](_0x432780[_0x8db2('0x23')],{'$or':_[_0x8db2('0x1e')](_0x432780['attributes'],function(_0xa7b208){var _0x3cb456={};_0x3cb456[_0xa7b208]={'$like':'%'+_0x2942eb[_0x8db2('0x28')][_0x8db2('0x47')]+'%'};return _0x3cb456;})});}_0x432780=_[_0x8db2('0x30')]({},_0x432780,_0x2942eb[_0x8db2('0x31')]);return _0x1ef898[_0x8db2('0x76')](_0x432780);}})[_0x8db2('0x17')](function(_0x3a53e2){if(_0x3a53e2){_0x39f2d3=_0x3a53e2[_0x8db2('0x2e')];if(!_0x2942eb[_0x8db2('0x28')]['hasOwnProperty'](_0x8db2('0x43'))){_0x432780[_0x8db2('0x14')]=qs[_0x8db2('0x14')](_0x2942eb['query'][_0x8db2('0x14')]);_0x432780[_0x8db2('0x11')]=qs[_0x8db2('0x11')](_0x2942eb['query']['offset']);}return _0x1ef898[_0x8db2('0x76')](_0x432780);}})[_0x8db2('0x17')](function(_0x296966){if(_0x296966){return _0x296966?{'count':_0x39f2d3,'rows':_0x296966}:null;}})[_0x8db2('0x17')](respondWithResult(_0x5f32ce,null))[_0x8db2('0x3a')](handleError(_0x5f32ce,null));}; \ No newline at end of file +var _0x5f66=['show','params','model','keys','intersection','attributes','fields','includeAll','merge','options','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','SmsQueues','find','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','rawAttributes','filters','hasOwnProperty','order','sort','pick','map','UserSmsQueue','User','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','%s/%s','SIP','getTeams','length','filter','nolimit','ids','Team','Agents','interface','flatMap','sequelize','transaction','addTeams','forEach','emit','userSmsQueue:save','removeTeams','select','tq.TeamId','team_has_sms_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','includes','all','compact','value','isEmpty','removeAgents','userSmsQueue:remove','addAgents','spread','isArray','findOne','getAgents','util','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','defaults','redis','./smsQueue.socket','register','end','json','offset','limit','undefined','count','status','update','then','UserProfileResource','destroy','sendStatus','stack','name','send','index','fieldName','key','getOptions','where','SmsQueue','include','query','findAll','catch'];(function(_0x1e9449,_0x422da){var _0x1740ab=function(_0x2562b8){while(--_0x2562b8){_0x1e9449['push'](_0x1e9449['shift']());}};_0x1740ab(++_0x422da);}(_0x5f66,0x1a0));var _0x65f6=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0x5f66[_0x36eaaa];return _0x461349;};'use strict';var BPromise=require('bluebird');var util=require(_0x65f6('0x0'));var _=require('lodash');var squel=require(_0x65f6('0x1'));var Redis=require(_0x65f6('0x2'));var qs=require(_0x65f6('0x3'));var logger=require(_0x65f6('0x4'))(_0x65f6('0x5'));var config=require('../../config/environment');var db=require(_0x65f6('0x6'))['db'];config['redis']=_[_0x65f6('0x7')](config[_0x65f6('0x8')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x65f6('0x8')]));require(_0x65f6('0x9'))[_0x65f6('0xa')](socket);function respondWithStatusCode(_0x8f6451,_0xc44c70){_0xc44c70=_0xc44c70||0xcc;return function(_0x14f4c7){if(_0x14f4c7){return _0x8f6451['sendStatus'](_0xc44c70);}return _0x8f6451['status'](_0xc44c70)[_0x65f6('0xb')]();};}function respondWithResult(_0x2f6d5b,_0x264647){_0x264647=_0x264647||0xc8;return function(_0x25c416){if(_0x25c416){return _0x2f6d5b['status'](_0x264647)[_0x65f6('0xc')](_0x25c416);}};}function respondWithFilteredResult(_0x571436,_0x497cf3){return function(_0x2d2dfa){if(_0x2d2dfa){var _0x576875=typeof _0x497cf3[_0x65f6('0xd')]==='undefined'&&typeof _0x497cf3[_0x65f6('0xe')]===_0x65f6('0xf');var _0x2c4ee5=_0x2d2dfa[_0x65f6('0x10')];var _0x369f96=_0x576875?0x0:_0x497cf3[_0x65f6('0xd')];var _0x44144b=_0x576875?_0x2d2dfa[_0x65f6('0x10')]:_0x497cf3[_0x65f6('0xd')]+_0x497cf3[_0x65f6('0xe')];var _0x59154e;if(_0x44144b>=_0x2c4ee5){_0x44144b=_0x2c4ee5;_0x59154e=0xc8;}else{_0x59154e=0xce;}_0x571436[_0x65f6('0x11')](_0x59154e);return _0x571436['set']('Content-Range',_0x369f96+'-'+_0x44144b+'/'+_0x2c4ee5)[_0x65f6('0xc')](_0x2d2dfa);}return null;};}function saveUpdates(_0x5c69f8){return function(_0x37330d){if(_0x37330d){return _0x37330d[_0x65f6('0x12')](_0x5c69f8)[_0x65f6('0x13')](function(_0x1f974c){return _0x1f974c;});}return null;};}function removeEntity(_0xc8660c){return function(_0x18380e){if(_0x18380e){return _0x18380e['destroy']()['then'](function(){var _0x2d538c=_0x18380e['get']({'plain':!![]});var _0x4c81f3='SmsQueues';return db[_0x65f6('0x14')][_0x65f6('0x15')]({'where':{'type':_0x4c81f3,'resourceId':_0x2d538c['id']}})['then'](function(){return _0x18380e;});})[_0x65f6('0x13')](function(){_0xc8660c[_0x65f6('0x11')](0xcc)[_0x65f6('0xb')]();});}};}function handleEntityNotFound(_0x3876ed){return function(_0x219ab2){if(!_0x219ab2){_0x3876ed[_0x65f6('0x16')](0x194);}return _0x219ab2;};}function handleError(_0x581374,_0x197a49){_0x197a49=_0x197a49||0x1f4;return function(_0x4bb39e){logger['error'](_0x4bb39e[_0x65f6('0x17')]);if(_0x4bb39e[_0x65f6('0x18')]){delete _0x4bb39e['name'];}_0x581374[_0x65f6('0x11')](_0x197a49)[_0x65f6('0x19')](_0x4bb39e);};}exports[_0x65f6('0x1a')]=function(_0x2774a1,_0x4f5a69){var _0x9d7bb0={};var _0x59ea32={'count':0x0,'rows':[]};var _0x20a161=_['map'](db['SmsQueue']['rawAttributes'],function(_0x29abdb){return{'name':_0x29abdb[_0x65f6('0x1b')],'type':_0x29abdb['type'][_0x65f6('0x1c')]};});_0x9d7bb0=qs[_0x65f6('0x1d')](_0x20a161,_0x2774a1);var _0x52277c={'where':_0x9d7bb0[_0x65f6('0x1e')]};return db[_0x65f6('0x1f')][_0x65f6('0x10')](_0x52277c)['then'](function(_0x4ac04b){_0x59ea32['count']=_0x4ac04b;_0x9d7bb0[_0x65f6('0x20')]=qs[_0x65f6('0x20')](_0x2774a1[_0x65f6('0x21')]);return db[_0x65f6('0x1f')][_0x65f6('0x22')](_0x9d7bb0);})[_0x65f6('0x13')](function(_0x144e55){_0x59ea32['rows']=_0x144e55;return _0x59ea32;})['then'](respondWithFilteredResult(_0x4f5a69,_0x9d7bb0))[_0x65f6('0x23')](handleError(_0x4f5a69,null));};exports[_0x65f6('0x24')]=function(_0x5878bc,_0x4e50c0){var _0x10b368={'raw':!![],'where':{'id':_0x5878bc[_0x65f6('0x25')]['id']}},_0x1ce43c={};_0x1ce43c[_0x65f6('0x26')]=_[_0x65f6('0x27')](db[_0x65f6('0x1f')]['rawAttributes']);_0x1ce43c[_0x65f6('0x21')]=_[_0x65f6('0x27')](_0x5878bc[_0x65f6('0x21')]);_0x1ce43c['filters']=_[_0x65f6('0x28')](_0x1ce43c[_0x65f6('0x26')],_0x1ce43c[_0x65f6('0x21')]);_0x10b368[_0x65f6('0x29')]=_[_0x65f6('0x28')](_0x1ce43c[_0x65f6('0x26')],qs['fields'](_0x5878bc[_0x65f6('0x21')][_0x65f6('0x2a')]));_0x10b368['attributes']=_0x10b368[_0x65f6('0x29')]['length']?_0x10b368[_0x65f6('0x29')]:_0x1ce43c['model'];if(_0x5878bc[_0x65f6('0x21')][_0x65f6('0x2b')]){_0x10b368['include']=[{'all':!![]}];}_0x10b368=_[_0x65f6('0x2c')]({},_0x10b368,_0x5878bc[_0x65f6('0x2d')]);return db[_0x65f6('0x1f')]['find'](_0x10b368)['then'](handleEntityNotFound(_0x4e50c0,null))[_0x65f6('0x13')](respondWithResult(_0x4e50c0,null))['catch'](handleError(_0x4e50c0,null));};exports[_0x65f6('0x2e')]=function(_0x4e6653,_0x22d760){return db[_0x65f6('0x1f')]['create'](_0x4e6653[_0x65f6('0x2f')],{})['then'](function(_0x5edd04){var _0x71b16b=_0x4e6653[_0x65f6('0x30')][_0x65f6('0x31')]({'plain':!![]});if(!_0x71b16b)throw new Error(_0x65f6('0x32'));if(_0x71b16b[_0x65f6('0x33')]===_0x65f6('0x30')){var _0x1a55da=_0x5edd04[_0x65f6('0x31')]({'plain':!![]});var _0x4f933b=_0x65f6('0x34');return db['UserProfileSection'][_0x65f6('0x35')]({'where':{'name':_0x4f933b,'userProfileId':_0x71b16b[_0x65f6('0x36')]},'raw':!![]})[_0x65f6('0x13')](function(_0x2ea7f7){if(_0x2ea7f7&&_0x2ea7f7['autoAssociation']===0x0){return db[_0x65f6('0x14')][_0x65f6('0x2e')]({'name':_0x1a55da[_0x65f6('0x18')],'resourceId':_0x1a55da['id'],'type':_0x2ea7f7[_0x65f6('0x18')],'sectionId':_0x2ea7f7['id']},{})[_0x65f6('0x13')](function(){return _0x5edd04;});}else{return _0x5edd04;}})[_0x65f6('0x23')](function(_0xed4c96){logger[_0x65f6('0x37')](_0x65f6('0x38'),_0xed4c96);throw _0xed4c96;});}return _0x5edd04;})['then'](respondWithResult(_0x22d760,0xc9))[_0x65f6('0x23')](handleError(_0x22d760,null));};exports[_0x65f6('0x12')]=function(_0x377ae5,_0x181798){if(_0x377ae5[_0x65f6('0x2f')]['id']){delete _0x377ae5[_0x65f6('0x2f')]['id'];}return db[_0x65f6('0x1f')][_0x65f6('0x35')]({'where':{'id':_0x377ae5[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](handleEntityNotFound(_0x181798,null))[_0x65f6('0x13')](saveUpdates(_0x377ae5[_0x65f6('0x2f')],null))[_0x65f6('0x13')](respondWithResult(_0x181798,null))[_0x65f6('0x23')](handleError(_0x181798,null));};exports[_0x65f6('0x15')]=function(_0x2cb38d,_0x5119ee){return db[_0x65f6('0x1f')][_0x65f6('0x35')]({'where':{'id':_0x2cb38d[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](handleEntityNotFound(_0x5119ee,null))['then'](removeEntity(_0x5119ee,null))[_0x65f6('0x23')](handleError(_0x5119ee,null));};exports[_0x65f6('0x39')]=function(_0x2b01eb,_0x5e69b4){return db[_0x65f6('0x1f')][_0x65f6('0x39')]()[_0x65f6('0x13')](respondWithResult(_0x5e69b4,null))[_0x65f6('0x23')](handleError(_0x5e69b4,null));};exports['getMembers']=function(_0x2ec114,_0x512527){var _0x3f1baa={'raw':!![],'where':{}},_0x6968b={},_0x577c93;return db[_0x65f6('0x1f')]['findOne']({'where':{'id':_0x2ec114[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](handleEntityNotFound(_0x512527,null))[_0x65f6('0x13')](function(_0xc0db01){if(_0xc0db01){_0x577c93=_0xc0db01[_0x65f6('0x31')]({'plain':!![]});_0x6968b[_0x65f6('0x26')]=_['keys'](db['UserSmsQueue'][_0x65f6('0x3a')]);_0x6968b[_0x65f6('0x21')]=_[_0x65f6('0x27')](_0x2ec114[_0x65f6('0x21')]);_0x6968b[_0x65f6('0x3b')]=_[_0x65f6('0x28')](_0x6968b[_0x65f6('0x26')],_0x6968b[_0x65f6('0x21')]);_0x3f1baa[_0x65f6('0x29')]=_['intersection'](_0x6968b[_0x65f6('0x26')],qs[_0x65f6('0x2a')](_0x2ec114[_0x65f6('0x21')]['fields']));_0x3f1baa[_0x65f6('0x29')]=_0x3f1baa[_0x65f6('0x29')]['length']?_0x3f1baa[_0x65f6('0x29')]:_0x6968b[_0x65f6('0x26')];if(!_0x2ec114['query'][_0x65f6('0x3c')]('nolimit')){_0x3f1baa[_0x65f6('0xe')]=qs[_0x65f6('0xe')](_0x2ec114[_0x65f6('0x21')]['limit']);_0x3f1baa[_0x65f6('0xd')]=qs[_0x65f6('0xd')](_0x2ec114['query'][_0x65f6('0xd')]);}_0x3f1baa[_0x65f6('0x3d')]=qs['sort'](_0x2ec114[_0x65f6('0x21')][_0x65f6('0x3e')]);_0x3f1baa[_0x65f6('0x1e')]=qs[_0x65f6('0x3b')](_[_0x65f6('0x3f')](_0x2ec114[_0x65f6('0x21')],_0x6968b[_0x65f6('0x3b')]));_0x3f1baa[_0x65f6('0x1e')]['SmsQueueId']=_0xc0db01['id'];if(_0x2ec114['query']['filter']){_0x3f1baa[_0x65f6('0x1e')]=_[_0x65f6('0x2c')](_0x3f1baa[_0x65f6('0x1e')],{'$or':_[_0x65f6('0x40')](_0x3f1baa['attributes'],function(_0x183c08){var _0x2032b9={};_0x2032b9[_0x183c08]={'$like':'%'+_0x2ec114[_0x65f6('0x21')]['filter']+'%'};return _0x2032b9;})});}_0x3f1baa=_[_0x65f6('0x2c')]({},_0x3f1baa,_0x2ec114[_0x65f6('0x2d')]);return db[_0x65f6('0x41')]['findAll'](_0x3f1baa);}})['then'](function(_0x1d337d){if(_0x1d337d){return db[_0x65f6('0x42')][_0x65f6('0x43')]({'where':{'id':_[_0x65f6('0x40')](_0x1d337d,_0x65f6('0x44')),'role':_0x65f6('0x45')},'attributes':['id',_0x65f6('0x18'),_0x65f6('0x46'),_0x65f6('0x47'),_0x65f6('0x48')]});}})[_0x65f6('0x13')](function(_0x141fcc){if(_0x141fcc){return{'count':_0x141fcc[_0x65f6('0x10')],'rows':_[_0x65f6('0x40')](_0x141fcc['rows'],function(_0x47610a){return{'membername':_0x47610a[_0x65f6('0x18')],'UserId':_0x47610a['id'],'queue_name':_0x577c93[_0x65f6('0x18')],'SmsQueueId':_0x577c93['id'],'interface':util['format'](_0x65f6('0x49'),_0x65f6('0x4a'),_0x47610a[_0x65f6('0x18')]),'penalty':0x0,'paused':_0x47610a[_0x65f6('0x46')],'createdAt':_0x47610a['createdAt'],'updatedAt':_0x47610a[_0x65f6('0x47')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x65f6('0x13')](respondWithFilteredResult(_0x512527,_0x3f1baa))[_0x65f6('0x23')](handleError(_0x512527,null));};exports[_0x65f6('0x4b')]=function(_0x553ff0,_0x2923ff){var _0x2fc20f={};var _0x5c55e4={};var _0x28682b;var _0x26481e;return db[_0x65f6('0x1f')]['findOne']({'where':{'id':_0x553ff0[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](handleEntityNotFound(_0x2923ff,null))[_0x65f6('0x13')](function(_0x3c23e3){if(_0x3c23e3){_0x28682b=_0x3c23e3;_0x5c55e4[_0x65f6('0x26')]=_[_0x65f6('0x27')](db['Team']['rawAttributes']);_0x5c55e4['query']=_[_0x65f6('0x27')](_0x553ff0[_0x65f6('0x21')]);_0x5c55e4[_0x65f6('0x3b')]=_[_0x65f6('0x28')](_0x5c55e4[_0x65f6('0x26')],_0x5c55e4[_0x65f6('0x21')]);_0x2fc20f['attributes']=_[_0x65f6('0x28')](_0x5c55e4[_0x65f6('0x26')],qs['fields'](_0x553ff0[_0x65f6('0x21')][_0x65f6('0x2a')]));_0x2fc20f[_0x65f6('0x29')]=_0x2fc20f['attributes'][_0x65f6('0x4c')]?_0x2fc20f[_0x65f6('0x29')]:_0x5c55e4['model'];_0x2fc20f[_0x65f6('0x3d')]=qs[_0x65f6('0x3e')](_0x553ff0[_0x65f6('0x21')][_0x65f6('0x3e')]);_0x2fc20f[_0x65f6('0x1e')]=qs[_0x65f6('0x3b')](_[_0x65f6('0x3f')](_0x553ff0['query'],_0x5c55e4['filters']));if(_0x553ff0[_0x65f6('0x21')][_0x65f6('0x4d')]){_0x2fc20f['where']=_[_0x65f6('0x2c')](_0x2fc20f['where'],{'$or':_[_0x65f6('0x40')](_0x2fc20f['attributes'],function(_0x440df1){var _0xdc8989={};_0xdc8989[_0x440df1]={'$like':'%'+_0x553ff0[_0x65f6('0x21')][_0x65f6('0x4d')]+'%'};return _0xdc8989;})});}_0x2fc20f=_[_0x65f6('0x2c')]({},_0x2fc20f,_0x553ff0[_0x65f6('0x2d')]);return _0x28682b[_0x65f6('0x4b')](_0x2fc20f);}})[_0x65f6('0x13')](function(_0x2405a7){if(_0x2405a7){_0x26481e=_0x2405a7['length'];if(!_0x553ff0['query'][_0x65f6('0x3c')](_0x65f6('0x4e'))){_0x2fc20f[_0x65f6('0xe')]=qs['limit'](_0x553ff0['query'][_0x65f6('0xe')]);_0x2fc20f[_0x65f6('0xd')]=qs[_0x65f6('0xd')](_0x553ff0[_0x65f6('0x21')][_0x65f6('0xd')]);}return _0x28682b[_0x65f6('0x4b')](_0x2fc20f);}})['then'](function(_0x4f42ae){if(_0x4f42ae){return _0x4f42ae?{'count':_0x26481e,'rows':_0x4f42ae}:null;}})[_0x65f6('0x13')](respondWithResult(_0x2923ff,null))[_0x65f6('0x23')](handleError(_0x2923ff,null));};exports['addTeams']=function(_0x219bf8,_0x4a8b60){var _0x254e9f=_0x219bf8[_0x65f6('0x2f')][_0x65f6('0x4f')];return db[_0x65f6('0x50')]['findAll']({'where':{'id':_0x254e9f},'attributes':['id'],'include':[{'model':db[_0x65f6('0x42')],'as':_0x65f6('0x51'),'attributes':['id',_0x65f6('0x18'),'online','voicePause',_0x65f6('0x52')],'raw':!![]}]})['then'](function(_0x305967){if(_0x305967){var _0xf6de=_[_0x65f6('0x53')](_0x305967,function(_0x354b90){var _0x512776=_0x354b90['get']({'plain':!![]});return _0x512776['Agents'];});return db[_0x65f6('0x1f')][_0x65f6('0x35')]({'where':{'id':_0x219bf8[_0x65f6('0x25')]['id']}})['then'](function(_0x46cbde){return db[_0x65f6('0x54')][_0x65f6('0x55')](function(_0x49cee2){return _0x46cbde[_0x65f6('0x56')](_0x254e9f,{'transaction':_0x49cee2})[_0x65f6('0x13')](function(){return BPromise['each'](_0xf6de,function(_0x758e80){return db[_0x65f6('0x41')]['findOrCreate']({'where':{'UserId':_0x758e80['id'],'SmsQueueId':_0x219bf8[_0x65f6('0x25')]['id']},'transaction':_0x49cee2});});})['then'](function(){_0xf6de[_0x65f6('0x57')](function(_0x55ea91){socket[_0x65f6('0x58')](_0x65f6('0x59'),{'UserId':_0x55ea91['id'],'SmsQueueId':_0x46cbde['id']});});});});});}})['then'](respondWithStatusCode(_0x4a8b60,null))[_0x65f6('0x23')](handleError(_0x4a8b60,null));};exports[_0x65f6('0x5a')]=function(_0x2a700b,_0x299b85){return db[_0x65f6('0x50')][_0x65f6('0x22')]({'where':{'id':_0x2a700b[_0x65f6('0x21')][_0x65f6('0x4f')]},'attributes':['id'],'include':[{'model':db[_0x65f6('0x42')],'as':_0x65f6('0x51'),'attributes':['id'],'raw':!![]}]})[_0x65f6('0x13')](handleEntityNotFound(_0x299b85,null))['then'](function(_0x10a661){var _0x1cf1bd=_[_0x65f6('0x40')](_0x10a661,'id');var _0x219e42=[];var _0x5694f9=[];var _0x453080=squel[_0x65f6('0x5b')]();_0x453080['field'](_0x65f6('0x5c'))['from'](_0x65f6('0x5d'),'tq')['join'](_0x65f6('0x5e'),'ut',_0x65f6('0x5f'))['where']('SmsQueueId\x20=\x20?',_0x2a700b[_0x65f6('0x25')]['id']);for(var _0x413c21=0x0;_0x413c21<_0x10a661['length'];_0x413c21+=0x1){let _0x2d86c8=_0x10a661[_0x413c21];for(var _0x3b3bd5=0x0;_0x3b3bd5<_0x2d86c8[_0x65f6('0x51')]['length'];_0x3b3bd5+=0x1){let _0x1348ec=_0x2d86c8[_0x65f6('0x51')][_0x3b3bd5];var _0x5889dc=_0x453080[_0x65f6('0x60')]();_0x5889dc['where'](_0x65f6('0x61'),_0x1348ec['id']);_0x5694f9['push'](db['sequelize'][_0x65f6('0x21')](_0x5889dc[_0x65f6('0x62')](),{'type':db[_0x65f6('0x54')][_0x65f6('0x63')][_0x65f6('0x64')]})[_0x65f6('0x13')](function(_0x1ac46f){if(_0x1ac46f[_0x65f6('0x4c')]===0x1){return _0x1348ec['id'];}else{var _0x4d66fe=_['every'](_[_0x65f6('0x40')](_0x1ac46f,'TeamId'),function(_0x1ee28a){return _[_0x65f6('0x65')](_0x1cf1bd,_0x1ee28a);});if(_0x4d66fe){return _0x1348ec['id'];}}}));}}return BPromise[_0x65f6('0x66')](_0x5694f9)[_0x65f6('0x13')](function(_0x43127b){_0x219e42=_(_0x219e42)['union'](_0x43127b)[_0x65f6('0x67')]()[_0x65f6('0x68')]();return db[_0x65f6('0x1f')]['find']({'where':{'id':_0x2a700b[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](function(_0x4254c2){return db[_0x65f6('0x54')][_0x65f6('0x55')](function(_0x16bf93){return _0x4254c2['removeTeams'](_0x2a700b['query'][_0x65f6('0x4f')],{'transaction':_0x16bf93})[_0x65f6('0x13')](function(){if(!_[_0x65f6('0x69')](_0x219e42)){return _0x4254c2[_0x65f6('0x6a')](_0x219e42,{'transaction':_0x16bf93});}})['then'](function(){_0x219e42['forEach'](function(_0x336076){socket[_0x65f6('0x58')](_0x65f6('0x6b'),{'UserId':_0x336076,'SmsQueueId':_0x4254c2['id']});});});});});});})[_0x65f6('0x13')](respondWithStatusCode(_0x299b85,null))[_0x65f6('0x23')](handleError(_0x299b85,null));};exports[_0x65f6('0x6c')]=function(_0x5daaf4,_0x4d607a){return db['SmsQueue'][_0x65f6('0x35')]({'where':{'id':_0x5daaf4[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](handleEntityNotFound(_0x4d607a,null))[_0x65f6('0x13')](function(_0x53b11c){if(_0x53b11c){return _0x53b11c['addAgents'](_0x5daaf4[_0x65f6('0x2f')][_0x65f6('0x4f')],_['omit'](_0x5daaf4[_0x65f6('0x2f')],['ids','id'])||{})[_0x65f6('0x6d')](function(_0x4f3ef8){for(var _0x3a30ed=0x0;_0x3a30ed<_0x5daaf4[_0x65f6('0x2f')]['ids'][_0x65f6('0x4c')];_0x3a30ed+=0x1){socket[_0x65f6('0x58')](_0x65f6('0x59'),{'UserId':Number(_0x5daaf4[_0x65f6('0x2f')][_0x65f6('0x4f')][_0x3a30ed]),'SmsQueueId':Number(_0x5daaf4[_0x65f6('0x25')]['id'])});}return _0x4f3ef8;});}})['then'](respondWithResult(_0x4d607a,null))[_0x65f6('0x23')](handleError(_0x4d607a,null));};exports['removeAgents']=function(_0x24495c,_0x56336a){return db[_0x65f6('0x1f')][_0x65f6('0x35')]({'where':{'id':_0x24495c[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](handleEntityNotFound(_0x56336a,null))['then'](function(_0x2b6f98){if(_0x2b6f98){return _0x2b6f98[_0x65f6('0x6a')](_0x24495c[_0x65f6('0x21')]['ids'])['then'](function(){if(_[_0x65f6('0x6e')](_0x24495c[_0x65f6('0x21')]['ids'])){for(var _0x180cde=0x0;_0x180cde<_0x24495c[_0x65f6('0x21')][_0x65f6('0x4f')]['length'];_0x180cde+=0x1){socket[_0x65f6('0x58')](_0x65f6('0x6b'),{'UserId':Number(_0x24495c['query'][_0x65f6('0x4f')][_0x180cde]),'SmsQueueId':Number(_0x24495c[_0x65f6('0x25')]['id'])});}}else{socket[_0x65f6('0x58')]('userSmsQueue:remove',{'UserId':Number(_0x24495c[_0x65f6('0x21')][_0x65f6('0x4f')]),'SmsQueueId':Number(_0x24495c[_0x65f6('0x25')]['id'])});}});}})['then'](respondWithStatusCode(_0x56336a,null))[_0x65f6('0x23')](handleError(_0x56336a,null));};exports['getAgents']=function(_0x1beaa7,_0x87a9e4){var _0x31ec61={};var _0x22be6e={};var _0x29b2de;var _0x430fb8;return db['SmsQueue'][_0x65f6('0x6f')]({'where':{'id':_0x1beaa7[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](handleEntityNotFound(_0x87a9e4,null))[_0x65f6('0x13')](function(_0x207d15){if(_0x207d15){_0x29b2de=_0x207d15;_0x22be6e['model']=_['keys'](db['User'][_0x65f6('0x3a')]);_0x22be6e[_0x65f6('0x21')]=_[_0x65f6('0x27')](_0x1beaa7['query']);_0x22be6e[_0x65f6('0x3b')]=_['intersection'](_0x22be6e['model'],_0x22be6e[_0x65f6('0x21')]);_0x31ec61[_0x65f6('0x29')]=_['intersection'](_0x22be6e[_0x65f6('0x26')],qs[_0x65f6('0x2a')](_0x1beaa7[_0x65f6('0x21')][_0x65f6('0x2a')]));_0x31ec61[_0x65f6('0x29')]=_0x31ec61[_0x65f6('0x29')][_0x65f6('0x4c')]?_0x31ec61[_0x65f6('0x29')]:_0x22be6e[_0x65f6('0x26')];_0x31ec61[_0x65f6('0x3d')]=qs[_0x65f6('0x3e')](_0x1beaa7[_0x65f6('0x21')]['sort']);_0x31ec61[_0x65f6('0x1e')]=qs['filters'](_['pick'](_0x1beaa7[_0x65f6('0x21')],_0x22be6e[_0x65f6('0x3b')]));if(_0x1beaa7[_0x65f6('0x21')][_0x65f6('0x4d')]){_0x31ec61['where']=_[_0x65f6('0x2c')](_0x31ec61['where'],{'$or':_['map'](_0x31ec61[_0x65f6('0x29')],function(_0x99fe6e){var _0x1a7e52={};_0x1a7e52[_0x99fe6e]={'$like':'%'+_0x1beaa7[_0x65f6('0x21')][_0x65f6('0x4d')]+'%'};return _0x1a7e52;})});}_0x31ec61=_[_0x65f6('0x2c')]({},_0x31ec61,_0x1beaa7['options']);return _0x29b2de[_0x65f6('0x70')](_0x31ec61);}})['then'](function(_0x1ef2a0){if(_0x1ef2a0){_0x430fb8=_0x1ef2a0[_0x65f6('0x4c')];if(!_0x1beaa7[_0x65f6('0x21')]['hasOwnProperty'](_0x65f6('0x4e'))){_0x31ec61['limit']=qs['limit'](_0x1beaa7[_0x65f6('0x21')][_0x65f6('0xe')]);_0x31ec61[_0x65f6('0xd')]=qs[_0x65f6('0xd')](_0x1beaa7[_0x65f6('0x21')]['offset']);}return _0x29b2de[_0x65f6('0x70')](_0x31ec61);}})[_0x65f6('0x13')](function(_0x3bebe3){if(_0x3bebe3){return _0x3bebe3?{'count':_0x430fb8,'rows':_0x3bebe3}:null;}})[_0x65f6('0x13')](respondWithResult(_0x87a9e4,null))['catch'](handleError(_0x87a9e4,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 3dc9c2d..9e0dbe3 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 _0x8f59=['../../mysqldb','SmsQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x30bd3b,_0x4c2538){var _0x17aacd=function(_0x3d4716){while(--_0x3d4716){_0x30bd3b['push'](_0x30bd3b['shift']());}};_0x17aacd(++_0x4c2538);}(_0x8f59,0x9f));var _0x98f5=function(_0x419e17,_0x7fe78c){_0x419e17=_0x419e17-0x0;var _0x1f2044=_0x8f59[_0x419e17];return _0x1f2044;};'use strict';var EventEmitter=require(_0x98f5('0x0'));var SmsQueue=require(_0x98f5('0x1'))['db'][_0x98f5('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x98f5('0x3')](0x0);var events={'afterCreate':_0x98f5('0x4'),'afterUpdate':_0x98f5('0x5'),'afterDestroy':_0x98f5('0x6')};function emitEvent(_0x3c097c){return function(_0x3e5a99,_0x525356,_0x210123){SmsQueueEvents[_0x98f5('0x7')](_0x3c097c+':'+_0x3e5a99['id'],_0x3e5a99);SmsQueueEvents[_0x98f5('0x7')](_0x3c097c,_0x3e5a99);_0x210123(null);};}for(var e in events){if(events[_0x98f5('0x8')](e)){var event=events[e];SmsQueue[_0x98f5('0x9')](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file +var _0x2a5e=['events','../../mysqldb','SmsQueue','setMaxListeners','save','remove','emit','hook','exports'];(function(_0x1363ae,_0x158004){var _0x4eeaac=function(_0x2e7fee){while(--_0x2e7fee){_0x1363ae['push'](_0x1363ae['shift']());}};_0x4eeaac(++_0x158004);}(_0x2a5e,0x1ef));var _0xe2a5=function(_0xe94afa,_0x5b0a05){_0xe94afa=_0xe94afa-0x0;var _0x5b6179=_0x2a5e[_0xe94afa];return _0x5b6179;};'use strict';var EventEmitter=require(_0xe2a5('0x0'));var SmsQueue=require(_0xe2a5('0x1'))['db'][_0xe2a5('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xe2a5('0x3')](0x0);var events={'afterCreate':_0xe2a5('0x4'),'afterUpdate':'update','afterDestroy':_0xe2a5('0x5')};function emitEvent(_0x574a6d){return function(_0x488a3d,_0x4039ab,_0x28ebf2){SmsQueueEvents[_0xe2a5('0x6')](_0x574a6d+':'+_0x488a3d['id'],_0x488a3d);SmsQueueEvents[_0xe2a5('0x6')](_0x574a6d,_0x488a3d);_0x28ebf2(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue[_0xe2a5('0x7')](e,emitEvent(event));}}module[_0xe2a5('0x8')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 70c0b89..fb5696b 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 _0x58c0=['moment','request-promise','../../config/environment','define','SmsQueue','sms_queues','util','../../config/logger'];(function(_0x5b5c52,_0x249992){var _0x161eb0=function(_0x3a9a86){while(--_0x3a9a86){_0x5b5c52['push'](_0x5b5c52['shift']());}};_0x161eb0(++_0x249992);}(_0x58c0,0x1ae));var _0x058c=function(_0x5c5c52,_0x36d085){_0x5c5c52=_0x5c5c52-0x0;var _0x4229ff=_0x58c0[_0x5c5c52];return _0x4229ff;};'use strict';var _=require('lodash');var util=require(_0x058c('0x0'));var logger=require(_0x058c('0x1'))('api');var moment=require(_0x058c('0x2'));var BPromise=require('bluebird');var rp=require(_0x058c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x058c('0x4'));var attributes=require('./smsQueue.attributes');module['exports']=function(_0x38fc76,_0x9c4ddd){return _0x38fc76[_0x058c('0x5')](_0x058c('0x6'),attributes,{'tableName':_0x058c('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x501d=['./smsQueue.attributes','define','SmsQueue','sms_queues','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x5bb8d8,_0x21a57f){var _0x34adbb=function(_0x358b70){while(--_0x358b70){_0x5bb8d8['push'](_0x5bb8d8['shift']());}};_0x34adbb(++_0x21a57f);}(_0x501d,0x94));var _0xd501=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x501d[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0xd501('0x0'));var util=require(_0xd501('0x1'));var logger=require(_0xd501('0x2'))('api');var moment=require(_0xd501('0x3'));var BPromise=require(_0xd501('0x4'));var rp=require(_0xd501('0x5'));var fs=require('fs');var path=require(_0xd501('0x6'));var rimraf=require('rimraf');var config=require(_0xd501('0x7'));var attributes=require(_0xd501('0x8'));module['exports']=function(_0x55df5c,_0x9643a6){return _0x55df5c[_0xd501('0x9')](_0xd501('0xa'),attributes,{'tableName':_0xd501('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.rpc.js b/server/api/smsQueue/smsQueue.rpc.js index 0afe914..6dba4d6 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 _0x57df=['code','message','info','result','catch','GetSmsQueue','SmsQueue','findAll','options','raw','where','map','include','model','attributes','find','ShowSmsQueue','lodash','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','http','redis','localhost','socket.io-emitter','register','then','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x104740,_0x56a583){var _0x303b51=function(_0x3f4e3c){while(--_0x3f4e3c){_0x104740['push'](_0x104740['shift']());}};_0x303b51(++_0x56a583);}(_0x57df,0xc0));var _0xf57d=function(_0x169e1d,_0x16f8c2){_0x169e1d=_0x169e1d-0x0;var _0x1b4689=_0x57df[_0x169e1d];return _0x1b4689;};'use strict';var _=require(_0xf57d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf57d('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf57d('0x2'))['db'];var utils=require(_0xf57d('0x3'));var logger=require('../../config/logger')(_0xf57d('0x4'));var config=require(_0xf57d('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf57d('0x6')]({'port':0x232a});config[_0xf57d('0x7')]=_['defaults'](config[_0xf57d('0x7')],{'host':_0xf57d('0x8'),'port':0x18eb});var socket=require(_0xf57d('0x9'))(new Redis(config[_0xf57d('0x7')]));require('./smsQueue.socket')[_0xf57d('0xa')](socket);function respondWithRpcPromise(_0x5a69a9,_0x55ab4a,_0x371ad9){return new BPromise(function(_0x1cf01b,_0x537828){return client['request'](_0x5a69a9,_0x371ad9)[_0xf57d('0xb')](function(_0x185c08){logger['info'](_0xf57d('0xc'),_0x55ab4a,_0xf57d('0xd'));logger[_0xf57d('0xe')](_0xf57d('0xf'),_0x55ab4a,_0xf57d('0xd'),JSON[_0xf57d('0x10')](_0x185c08));if(_0x185c08[_0xf57d('0x11')]){if(_0x185c08[_0xf57d('0x11')][_0xf57d('0x12')]===0x1f4){logger['error']('SmsQueue,\x20%s,\x20%s',_0x55ab4a,_0x185c08[_0xf57d('0x11')][_0xf57d('0x13')]);return _0x537828(_0x185c08['error'][_0xf57d('0x13')]);}logger[_0xf57d('0x11')](_0xf57d('0xc'),_0x55ab4a,_0x185c08['error'][_0xf57d('0x13')]);return _0x1cf01b(_0x185c08[_0xf57d('0x11')]['message']);}else{logger[_0xf57d('0x14')](_0xf57d('0xc'),_0x55ab4a,_0xf57d('0xd'));_0x1cf01b(_0x185c08[_0xf57d('0x15')][_0xf57d('0x13')]);}})[_0xf57d('0x16')](function(_0x52e959){logger[_0xf57d('0x11')](_0xf57d('0xc'),_0x55ab4a,_0x52e959);_0x537828(_0x52e959);});});}exports[_0xf57d('0x17')]=function(_0x36d041){var _0x1a41c4=this;return new Promise(function(_0x42cbc4,_0x6729c3){return db[_0xf57d('0x18')][_0xf57d('0x19')]({'raw':_0x36d041[_0xf57d('0x1a')]?_0x36d041[_0xf57d('0x1a')][_0xf57d('0x1b')]===undefined?!![]:![]:!![],'where':_0x36d041[_0xf57d('0x1a')]?_0x36d041['options'][_0xf57d('0x1c')]||null:null,'attributes':_0x36d041['options']?_0x36d041[_0xf57d('0x1a')]['attributes']||null:null,'limit':_0x36d041[_0xf57d('0x1a')]?_0x36d041[_0xf57d('0x1a')]['limit']||null:null,'include':_0x36d041[_0xf57d('0x1a')]?_0x36d041[_0xf57d('0x1a')]['include']?_[_0xf57d('0x1d')](_0x36d041['options'][_0xf57d('0x1e')],function(_0x34768f){return{'model':db[_0x34768f[_0xf57d('0x1f')]],'as':_0x34768f['as'],'attributes':_0x34768f['attributes'],'include':_0x34768f['include']?_[_0xf57d('0x1d')](_0x34768f[_0xf57d('0x1e')],function(_0x1bbd16){return{'model':db[_0x1bbd16[_0xf57d('0x1f')]],'as':_0x1bbd16['as'],'attributes':_0x1bbd16[_0xf57d('0x20')],'include':_0x1bbd16[_0xf57d('0x1e')]?_[_0xf57d('0x1d')](_0x1bbd16[_0xf57d('0x1e')],function(_0x32fdac){return{'model':db[_0x32fdac['model']],'as':_0x32fdac['as'],'attributes':_0x32fdac[_0xf57d('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1649e8){logger['info'](_0xf57d('0x17'),_0x36d041);logger[_0xf57d('0xe')](_0xf57d('0x17'),_0x36d041,JSON[_0xf57d('0x10')](_0x1649e8));_0x42cbc4(_0x1649e8);})['catch'](function(_0x240b3e){logger[_0xf57d('0x11')](_0xf57d('0x17'),_0x240b3e['message'],_0x36d041);_0x6729c3(_0x1a41c4['error'](0x1f4,_0x240b3e[_0xf57d('0x13')]));});});};exports['ShowSmsQueue']=function(_0x4b8c65){var _0x827bae=this;return new Promise(function(_0x1645c5,_0x96e5d8){return db[_0xf57d('0x18')][_0xf57d('0x21')]({'raw':_0x4b8c65[_0xf57d('0x1a')]?_0x4b8c65['options'][_0xf57d('0x1b')]===undefined?!![]:![]:!![],'where':_0x4b8c65[_0xf57d('0x1a')]?_0x4b8c65[_0xf57d('0x1a')][_0xf57d('0x1c')]||null:null,'attributes':_0x4b8c65['options']?_0x4b8c65[_0xf57d('0x1a')]['attributes']||null:null,'include':_0x4b8c65[_0xf57d('0x1a')]?_0x4b8c65[_0xf57d('0x1a')]['include']?_[_0xf57d('0x1d')](_0x4b8c65['options'][_0xf57d('0x1e')],function(_0x235c2a){return{'model':db[_0x235c2a[_0xf57d('0x1f')]],'as':_0x235c2a['as'],'attributes':_0x235c2a[_0xf57d('0x20')],'include':_0x235c2a[_0xf57d('0x1e')]?_['map'](_0x235c2a['include'],function(_0x1993c4){return{'model':db[_0x1993c4[_0xf57d('0x1f')]],'as':_0x1993c4['as'],'attributes':_0x1993c4[_0xf57d('0x20')],'include':_0x1993c4[_0xf57d('0x1e')]?_[_0xf57d('0x1d')](_0x1993c4['include'],function(_0x53c005){return{'model':db[_0x53c005['model']],'as':_0x53c005['as'],'attributes':_0x53c005[_0xf57d('0x20')]};}):[]};}):[]};}):[]:[]})[_0xf57d('0xb')](function(_0x18e64c){logger[_0xf57d('0x14')](_0xf57d('0x22'),_0x4b8c65);logger[_0xf57d('0xe')](_0xf57d('0x22'),_0x4b8c65,JSON[_0xf57d('0x10')](_0x18e64c));_0x1645c5(_0x18e64c);})[_0xf57d('0x16')](function(_0x4e8626){logger[_0xf57d('0x11')](_0xf57d('0x22'),_0x4e8626[_0xf57d('0x13')],_0x4b8c65);_0x96e5d8(_0x827bae[_0xf57d('0x11')](0x1f4,_0x4e8626[_0xf57d('0x13')]));});});}; \ No newline at end of file +var _0xaf92=['debug','ShowSmsQueue','find','raw','where','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','GetSmsQueue','SmsQueue','options','limit','include','map','attributes','model'];(function(_0x59e73b,_0x572fab){var _0x2ccff4=function(_0x205266){while(--_0x205266){_0x59e73b['push'](_0x59e73b['shift']());}};_0x2ccff4(++_0x572fab);}(_0xaf92,0xa1));var _0x2af9=function(_0x15c3e0,_0x320c34){_0x15c3e0=_0x15c3e0-0x0;var _0x2f3a01=_0xaf92[_0x15c3e0];return _0x2f3a01;};'use strict';var _=require(_0x2af9('0x0'));var util=require('util');var moment=require(_0x2af9('0x1'));var BPromise=require(_0x2af9('0x2'));var rs=require(_0x2af9('0x3'));var fs=require('fs');var Redis=require(_0x2af9('0x4'));var db=require(_0x2af9('0x5'))['db'];var utils=require(_0x2af9('0x6'));var logger=require('../../config/logger')(_0x2af9('0x7'));var config=require(_0x2af9('0x8'));var jayson=require(_0x2af9('0x9'));var client=jayson[_0x2af9('0xa')][_0x2af9('0xb')]({'port':0x232a});config[_0x2af9('0xc')]=_[_0x2af9('0xd')](config[_0x2af9('0xc')],{'host':_0x2af9('0xe'),'port':0x18eb});var socket=require(_0x2af9('0xf'))(new Redis(config[_0x2af9('0xc')]));require('./smsQueue.socket')[_0x2af9('0x10')](socket);function respondWithRpcPromise(_0x204a6b,_0x3b52f6,_0x5b5df0){return new BPromise(function(_0x284631,_0x393001){return client[_0x2af9('0x11')](_0x204a6b,_0x5b5df0)[_0x2af9('0x12')](function(_0x19af72){logger[_0x2af9('0x13')](_0x2af9('0x14'),_0x3b52f6,_0x2af9('0x15'));logger['debug'](_0x2af9('0x16'),_0x3b52f6,_0x2af9('0x15'),JSON[_0x2af9('0x17')](_0x19af72));if(_0x19af72[_0x2af9('0x18')]){if(_0x19af72[_0x2af9('0x18')]['code']===0x1f4){logger[_0x2af9('0x18')](_0x2af9('0x14'),_0x3b52f6,_0x19af72['error']['message']);return _0x393001(_0x19af72['error']['message']);}logger[_0x2af9('0x18')](_0x2af9('0x14'),_0x3b52f6,_0x19af72['error']['message']);return _0x284631(_0x19af72[_0x2af9('0x18')]['message']);}else{logger[_0x2af9('0x13')](_0x2af9('0x14'),_0x3b52f6,_0x2af9('0x15'));_0x284631(_0x19af72['result'][_0x2af9('0x19')]);}})['catch'](function(_0x33bf3a){logger[_0x2af9('0x18')](_0x2af9('0x14'),_0x3b52f6,_0x33bf3a);_0x393001(_0x33bf3a);});});}exports[_0x2af9('0x1a')]=function(_0xa9fac2){var _0x4e180b=this;return new Promise(function(_0x2bc7b1,_0x22d545){return db[_0x2af9('0x1b')]['findAll']({'raw':_0xa9fac2['options']?_0xa9fac2[_0x2af9('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0xa9fac2[_0x2af9('0x1c')]?_0xa9fac2[_0x2af9('0x1c')]['where']||null:null,'attributes':_0xa9fac2['options']?_0xa9fac2[_0x2af9('0x1c')]['attributes']||null:null,'limit':_0xa9fac2[_0x2af9('0x1c')]?_0xa9fac2[_0x2af9('0x1c')][_0x2af9('0x1d')]||null:null,'include':_0xa9fac2['options']?_0xa9fac2[_0x2af9('0x1c')][_0x2af9('0x1e')]?_[_0x2af9('0x1f')](_0xa9fac2['options'][_0x2af9('0x1e')],function(_0x2fb722){return{'model':db[_0x2fb722['model']],'as':_0x2fb722['as'],'attributes':_0x2fb722[_0x2af9('0x20')],'include':_0x2fb722[_0x2af9('0x1e')]?_[_0x2af9('0x1f')](_0x2fb722[_0x2af9('0x1e')],function(_0xe4ce58){return{'model':db[_0xe4ce58[_0x2af9('0x21')]],'as':_0xe4ce58['as'],'attributes':_0xe4ce58[_0x2af9('0x20')],'include':_0xe4ce58[_0x2af9('0x1e')]?_[_0x2af9('0x1f')](_0xe4ce58[_0x2af9('0x1e')],function(_0x45f68d){return{'model':db[_0x45f68d['model']],'as':_0x45f68d['as'],'attributes':_0x45f68d['attributes']};}):[]};}):[]};}):[]:[]})[_0x2af9('0x12')](function(_0x426195){logger[_0x2af9('0x13')](_0x2af9('0x1a'),_0xa9fac2);logger[_0x2af9('0x22')]('GetSmsQueue',_0xa9fac2,JSON['stringify'](_0x426195));_0x2bc7b1(_0x426195);})['catch'](function(_0x1ab9df){logger[_0x2af9('0x18')](_0x2af9('0x1a'),_0x1ab9df[_0x2af9('0x19')],_0xa9fac2);_0x22d545(_0x4e180b[_0x2af9('0x18')](0x1f4,_0x1ab9df[_0x2af9('0x19')]));});});};exports[_0x2af9('0x23')]=function(_0x550575){var _0x10df4f=this;return new Promise(function(_0x549ef3,_0x592ea5){return db[_0x2af9('0x1b')][_0x2af9('0x24')]({'raw':_0x550575[_0x2af9('0x1c')]?_0x550575[_0x2af9('0x1c')][_0x2af9('0x25')]===undefined?!![]:![]:!![],'where':_0x550575['options']?_0x550575[_0x2af9('0x1c')][_0x2af9('0x26')]||null:null,'attributes':_0x550575['options']?_0x550575['options'][_0x2af9('0x20')]||null:null,'include':_0x550575[_0x2af9('0x1c')]?_0x550575[_0x2af9('0x1c')][_0x2af9('0x1e')]?_[_0x2af9('0x1f')](_0x550575[_0x2af9('0x1c')][_0x2af9('0x1e')],function(_0x444cd3){return{'model':db[_0x444cd3[_0x2af9('0x21')]],'as':_0x444cd3['as'],'attributes':_0x444cd3['attributes'],'include':_0x444cd3['include']?_[_0x2af9('0x1f')](_0x444cd3['include'],function(_0xe0ecf9){return{'model':db[_0xe0ecf9[_0x2af9('0x21')]],'as':_0xe0ecf9['as'],'attributes':_0xe0ecf9[_0x2af9('0x20')],'include':_0xe0ecf9[_0x2af9('0x1e')]?_[_0x2af9('0x1f')](_0xe0ecf9['include'],function(_0x4f83be){return{'model':db[_0x4f83be[_0x2af9('0x21')]],'as':_0x4f83be['as'],'attributes':_0x4f83be[_0x2af9('0x20')]};}):[]};}):[]};}):[]:[]})[_0x2af9('0x12')](function(_0x1a6437){logger['info'](_0x2af9('0x23'),_0x550575);logger['debug'](_0x2af9('0x23'),_0x550575,JSON[_0x2af9('0x17')](_0x1a6437));_0x549ef3(_0x1a6437);})['catch'](function(_0x5ab357){logger[_0x2af9('0x18')](_0x2af9('0x23'),_0x5ab357['message'],_0x550575);_0x592ea5(_0x10df4f[_0x2af9('0x18')](0x1f4,_0x5ab357['message']));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index ea5a760..f757f55 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 _0x09dd=['smsQueue:','./smsQueue.events','remove','emit','register'];(function(_0x4cb6e1,_0x6d5c3){var _0x1b8e77=function(_0x294d86){while(--_0x294d86){_0x4cb6e1['push'](_0x4cb6e1['shift']());}};_0x1b8e77(++_0x6d5c3);}(_0x09dd,0xd8));var _0xd09d=function(_0x5a3785,_0x2de636){_0x5a3785=_0x5a3785-0x0;var _0x4d058a=_0x09dd[_0x5a3785];return _0x4d058a;};'use strict';var SmsQueueEvents=require(_0xd09d('0x0'));var events=['save',_0xd09d('0x1'),'update'];function createListener(_0x369ae4,_0x5deaf0){return function(_0x2cf0bf){_0x5deaf0[_0xd09d('0x2')](_0x369ae4,_0x2cf0bf);};}function removeListener(_0x538661,_0x2f76cc){return function(){SmsQueueEvents['removeListener'](_0x538661,_0x2f76cc);};}exports[_0xd09d('0x3')]=function(_0x54e61a){for(var _0x2c9dfb=0x0,_0x3ac9ae=events['length'];_0x2c9dfb<_0x3ac9ae;_0x2c9dfb++){var _0x31fdcf=events[_0x2c9dfb];var _0x2f029c=createListener(_0xd09d('0x4')+_0x31fdcf,_0x54e61a);SmsQueueEvents['on'](_0x31fdcf,_0x2f029c);}}; \ No newline at end of file +var _0x99aa=['register','length','./smsQueue.events','remove','update','emit','removeListener'];(function(_0x4bea9f,_0x4b6d15){var _0x56afa2=function(_0x560108){while(--_0x560108){_0x4bea9f['push'](_0x4bea9f['shift']());}};_0x56afa2(++_0x4b6d15);}(_0x99aa,0x64));var _0xa99a=function(_0x68108e,_0x9cfc45){_0x68108e=_0x68108e-0x0;var _0x4c770a=_0x99aa[_0x68108e];return _0x4c770a;};'use strict';var SmsQueueEvents=require(_0xa99a('0x0'));var events=['save',_0xa99a('0x1'),_0xa99a('0x2')];function createListener(_0x2e9944,_0x13ff2b){return function(_0x450cab){_0x13ff2b[_0xa99a('0x3')](_0x2e9944,_0x450cab);};}function removeListener(_0x1baf06,_0x43953f){return function(){SmsQueueEvents[_0xa99a('0x4')](_0x1baf06,_0x43953f);};}exports[_0xa99a('0x5')]=function(_0x33b6ea){for(var _0x4de474=0x0,_0x26ba1d=events[_0xa99a('0x6')];_0x4de474<_0x26ba1d;_0x4de474++){var _0x3af48a=events[_0x4de474];var _0x38517f=createListener('smsQueue:'+_0x3af48a,_0x33b6ea);SmsQueueEvents['on'](_0x3af48a,_0x38517f);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 540e965..4d78752 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 _0x6b24=['/:id','show','post','update','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe'];(function(_0x1dfd1d,_0x305800){var _0x26d4d1=function(_0x3d1218){while(--_0x3d1218){_0x1dfd1d['push'](_0x1dfd1d['shift']());}};_0x26d4d1(++_0x305800);}(_0x6b24,0xf7));var _0x46b2=function(_0x19cf7a,_0x1dd21e){_0x19cf7a=_0x19cf7a-0x0;var _0x1a75bb=_0x6b24[_0x19cf7a];return _0x1a75bb;};'use strict';var multer=require(_0x46b2('0x0'));var util=require(_0x46b2('0x1'));var path=require(_0x46b2('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x46b2('0x3')]();var fs_extra=require(_0x46b2('0x4'));var auth=require(_0x46b2('0x5'));var interaction=require(_0x46b2('0x6'));var config=require(_0x46b2('0x7'));var controller=require('./smsQueueReport.controller');router[_0x46b2('0x8')]('/',auth[_0x46b2('0x9')](),controller[_0x46b2('0xa')]);router[_0x46b2('0x8')](_0x46b2('0xb'),auth['isAuthenticated'](),controller[_0x46b2('0xc')]);router[_0x46b2('0x8')](_0x46b2('0xd'),auth[_0x46b2('0x9')](),controller[_0x46b2('0xe')]);router[_0x46b2('0xf')]('/',auth[_0x46b2('0x9')](),controller['create']);router['put']('/:id',auth[_0x46b2('0x9')](),controller[_0x46b2('0x10')]);router[_0x46b2('0x11')](_0x46b2('0xd'),auth[_0x46b2('0x9')](),controller[_0x46b2('0x12')]);module[_0x46b2('0x13')]=router; \ No newline at end of file +var _0x5ce1=['update','delete','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','index','/describe','/:id','isAuthenticated','post','create'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x5ce1,0xd4));var _0x15ce=function(_0x219b00,_0x236fdc){_0x219b00=_0x219b00-0x0;var _0x4ea221=_0x5ce1[_0x219b00];return _0x4ea221;};'use strict';var multer=require('multer');var util=require(_0x15ce('0x0'));var path=require(_0x15ce('0x1'));var timeout=require(_0x15ce('0x2'));var express=require('express');var router=express[_0x15ce('0x3')]();var fs_extra=require(_0x15ce('0x4'));var auth=require(_0x15ce('0x5'));var interaction=require(_0x15ce('0x6'));var config=require(_0x15ce('0x7'));var controller=require(_0x15ce('0x8'));router[_0x15ce('0x9')]('/',auth['isAuthenticated'](),controller[_0x15ce('0xa')]);router[_0x15ce('0x9')](_0x15ce('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x15ce('0x9')](_0x15ce('0xc'),auth[_0x15ce('0xd')](),controller['show']);router[_0x15ce('0xe')]('/',auth[_0x15ce('0xd')](),controller[_0x15ce('0xf')]);router['put'](_0x15ce('0xc'),auth['isAuthenticated'](),controller[_0x15ce('0x10')]);router[_0x15ce('0x11')](_0x15ce('0xc'),auth[_0x15ce('0xd')](),controller['destroy']);module[_0x15ce('0x12')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index aa30e75..21ecfdc 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 _0x6a47=['moment','sequelize','exports','STRING','DATE'];(function(_0xaecb42,_0xd0e70d){var _0x491972=function(_0x365f84){while(--_0x365f84){_0xaecb42['push'](_0xaecb42['shift']());}};_0x491972(++_0xd0e70d);}(_0x6a47,0x16d));var _0x76a4=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x6a47[_0x321bb2];return _0x9c12ed;};'use strict';var moment=require(_0x76a4('0x0'));var Sequelize=require(_0x76a4('0x1'));module[_0x76a4('0x2')]={'uniqueid':{'type':Sequelize[_0x76a4('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x76a4('0x3')]},'joinAt':{'type':Sequelize[_0x76a4('0x4')]},'leaveAt':{'type':Sequelize[_0x76a4('0x4')]},'acceptAt':{'type':Sequelize[_0x76a4('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x76a4('0x3')]}}; \ No newline at end of file +var _0x343e=['STRING','DATE','moment','exports'];(function(_0x91ed5c,_0xdb6b34){var _0x2387d8=function(_0x1a9d15){while(--_0x1a9d15){_0x91ed5c['push'](_0x91ed5c['shift']());}};_0x2387d8(++_0xdb6b34);}(_0x343e,0x9a));var _0xe343=function(_0x1efdb3,_0x3964fe){_0x1efdb3=_0x1efdb3-0x0;var _0x465d8f=_0x343e[_0x1efdb3];return _0x465d8f;};'use strict';var moment=require(_0xe343('0x0'));var Sequelize=require('sequelize');module[_0xe343('0x1')]={'uniqueid':{'type':Sequelize[_0xe343('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xe343('0x2')]},'joinAt':{'type':Sequelize[_0xe343('0x3')]},'leaveAt':{'type':Sequelize[_0xe343('0x3')]},'acceptAt':{'type':Sequelize[_0xe343('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 7fd598e..e927b82 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 _0x8e7c=['../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','end','stack','name','index','map','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','pick','merge','where','filter','SmsQueueReport','include','findAll','rows','catch','params','includeAll','options','find','create','body','describe','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x8e7c,0xc2));var _0xc8e7=function(_0x1b3df5,_0x2e2fb0){_0x1b3df5=_0x1b3df5-0x0;var _0x12f463=_0x8e7c[_0x1b3df5];return _0x12f463;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc8e7('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc8e7('0x1'));var rp=require(_0xc8e7('0x2'));var moment=require(_0xc8e7('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xc8e7('0x4'));var util=require(_0xc8e7('0x5'));var path=require(_0xc8e7('0x6'));var sox=require(_0xc8e7('0x7'));var csv=require(_0xc8e7('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xc8e7('0x9'));var crypto=require(_0xc8e7('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xc8e7('0xb'));var toCsv=require(_0xc8e7('0x8'));var querystring=require(_0xc8e7('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xc8e7('0xd'));var qs=require(_0xc8e7('0xe'));var as=require(_0xc8e7('0xf'));var hardwareService=require(_0xc8e7('0x10'));var logger=require(_0xc8e7('0x11'))(_0xc8e7('0x12'));var utils=require(_0xc8e7('0x13'));var config=require(_0xc8e7('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xc8e7('0x15'))['db'];function respondWithStatusCode(_0x7b5d4e,_0x19dd73){_0x19dd73=_0x19dd73||0xcc;return function(_0x20634f){if(_0x20634f){return _0x7b5d4e[_0xc8e7('0x16')](_0x19dd73);}return _0x7b5d4e['status'](_0x19dd73)['end']();};}function respondWithResult(_0x59ed80,_0x1ae1f7){_0x1ae1f7=_0x1ae1f7||0xc8;return function(_0x3d0e27){if(_0x3d0e27){return _0x59ed80[_0xc8e7('0x17')](_0x1ae1f7)['json'](_0x3d0e27);}};}function respondWithFilteredResult(_0x405725,_0x1ae18b){return function(_0x40200f){if(_0x40200f){var _0x4a5df8=typeof _0x1ae18b[_0xc8e7('0x18')]===_0xc8e7('0x19')&&typeof _0x1ae18b[_0xc8e7('0x1a')]===_0xc8e7('0x19');var _0x14ba18=_0x40200f[_0xc8e7('0x1b')];var _0x57c598=_0x4a5df8?0x0:_0x1ae18b[_0xc8e7('0x18')];var _0x58d6b5=_0x4a5df8?_0x40200f['count']:_0x1ae18b['offset']+_0x1ae18b['limit'];var _0x2f85aa;if(_0x58d6b5>=_0x14ba18){_0x58d6b5=_0x14ba18;_0x2f85aa=0xc8;}else{_0x2f85aa=0xce;}_0x405725[_0xc8e7('0x17')](_0x2f85aa);return _0x405725[_0xc8e7('0x1c')](_0xc8e7('0x1d'),_0x57c598+'-'+_0x58d6b5+'/'+_0x14ba18)[_0xc8e7('0x1e')](_0x40200f);}return null;};}function patchUpdates(_0x1257c0){return function(_0x51aa8e){try{jsonpatch[_0xc8e7('0x1f')](_0x51aa8e,_0x1257c0,!![]);}catch(_0x2e1aed){return BPromise[_0xc8e7('0x20')](_0x2e1aed);}return _0x51aa8e[_0xc8e7('0x21')]();};}function saveUpdates(_0x5ce44d,_0x343272){return function(_0x1926ff){if(_0x1926ff){return _0x1926ff[_0xc8e7('0x22')](_0x5ce44d)[_0xc8e7('0x23')](function(_0x3cac96){return _0x3cac96;});}return null;};}function removeEntity(_0xc7c40c,_0xdb87a4){return function(_0x33e38d){if(_0x33e38d){return _0x33e38d['destroy']()[_0xc8e7('0x23')](function(){_0xc7c40c['status'](0xcc)[_0xc8e7('0x24')]();});}};}function handleEntityNotFound(_0xfe145f,_0x341f24){return function(_0x35924b){if(!_0x35924b){_0xfe145f[_0xc8e7('0x16')](0x194);}return _0x35924b;};}function handleError(_0x203d8c,_0x3a3d71){_0x3a3d71=_0x3a3d71||0x1f4;return function(_0x3d1694){logger['error'](_0x3d1694[_0xc8e7('0x25')]);if(_0x3d1694[_0xc8e7('0x26')]){delete _0x3d1694[_0xc8e7('0x26')];}_0x203d8c[_0xc8e7('0x17')](_0x3a3d71)['send'](_0x3d1694);};}exports[_0xc8e7('0x27')]=function(_0x559ac2,_0x411414){var _0x3a88eb={},_0x8ef0dd={},_0x2b2210={'count':0x0,'rows':[]};var _0x2b293f=_[_0xc8e7('0x28')](db['SmsQueueReport']['rawAttributes'],function(_0x2a81fa){return{'name':_0x2a81fa[_0xc8e7('0x29')],'type':_0x2a81fa[_0xc8e7('0x2a')][_0xc8e7('0x2b')]};});_0x8ef0dd[_0xc8e7('0x2c')]=_[_0xc8e7('0x28')](_0x2b293f,_0xc8e7('0x26'));_0x8ef0dd[_0xc8e7('0x2d')]=_[_0xc8e7('0x2e')](_0x559ac2[_0xc8e7('0x2d')]);_0x8ef0dd[_0xc8e7('0x2f')]=_['intersection'](_0x8ef0dd[_0xc8e7('0x2c')],_0x8ef0dd['query']);_0x3a88eb[_0xc8e7('0x30')]=_[_0xc8e7('0x31')](_0x8ef0dd[_0xc8e7('0x2c')],qs[_0xc8e7('0x32')](_0x559ac2[_0xc8e7('0x2d')][_0xc8e7('0x32')]));_0x3a88eb[_0xc8e7('0x30')]=_0x3a88eb[_0xc8e7('0x30')][_0xc8e7('0x33')]?_0x3a88eb['attributes']:_0x8ef0dd[_0xc8e7('0x2c')];if(!_0x559ac2[_0xc8e7('0x2d')]['hasOwnProperty'](_0xc8e7('0x34'))){_0x3a88eb['limit']=qs['limit'](_0x559ac2[_0xc8e7('0x2d')][_0xc8e7('0x1a')]);_0x3a88eb[_0xc8e7('0x18')]=qs[_0xc8e7('0x18')](_0x559ac2[_0xc8e7('0x2d')][_0xc8e7('0x18')]);}_0x3a88eb[_0xc8e7('0x35')]=qs[_0xc8e7('0x36')](_0x559ac2[_0xc8e7('0x2d')][_0xc8e7('0x36')]);_0x3a88eb['where']=qs[_0xc8e7('0x2f')](_[_0xc8e7('0x37')](_0x559ac2[_0xc8e7('0x2d')],_0x8ef0dd[_0xc8e7('0x2f')]),_0x2b293f);if(_0x559ac2['query']['filter']){_0x3a88eb['where']=_[_0xc8e7('0x38')](_0x3a88eb[_0xc8e7('0x39')],{'$or':_[_0xc8e7('0x28')](_0x2b293f,function(_0x2169c2){if(_0x2169c2[_0xc8e7('0x2a')]!=='VIRTUAL'){var _0x53943d={};_0x53943d[_0x2169c2[_0xc8e7('0x26')]]={'$like':'%'+_0x559ac2[_0xc8e7('0x2d')][_0xc8e7('0x3a')]+'%'};return _0x53943d;}})});}_0x3a88eb=_[_0xc8e7('0x38')]({},_0x3a88eb,_0x559ac2['options']);var _0x282e93={'where':_0x3a88eb[_0xc8e7('0x39')]};return db[_0xc8e7('0x3b')][_0xc8e7('0x1b')](_0x282e93)['then'](function(_0x17d991){_0x2b2210[_0xc8e7('0x1b')]=_0x17d991;if(_0x559ac2[_0xc8e7('0x2d')]['includeAll']){_0x3a88eb[_0xc8e7('0x3c')]=[{'all':!![]}];}return db[_0xc8e7('0x3b')][_0xc8e7('0x3d')](_0x3a88eb);})[_0xc8e7('0x23')](function(_0x2b859a){_0x2b2210[_0xc8e7('0x3e')]=_0x2b859a;return _0x2b2210;})[_0xc8e7('0x23')](respondWithFilteredResult(_0x411414,_0x3a88eb))[_0xc8e7('0x3f')](handleError(_0x411414,null));};exports['show']=function(_0x386c87,_0x73d63d){var _0xcd0c6a={'raw':!![],'where':{'id':_0x386c87[_0xc8e7('0x40')]['id']}},_0x402fd8={};_0x402fd8[_0xc8e7('0x2c')]=_['keys'](db['SmsQueueReport']['rawAttributes']);_0x402fd8['query']=_[_0xc8e7('0x2e')](_0x386c87['query']);_0x402fd8[_0xc8e7('0x2f')]=_[_0xc8e7('0x31')](_0x402fd8[_0xc8e7('0x2c')],_0x402fd8[_0xc8e7('0x2d')]);_0xcd0c6a[_0xc8e7('0x30')]=_[_0xc8e7('0x31')](_0x402fd8[_0xc8e7('0x2c')],qs[_0xc8e7('0x32')](_0x386c87[_0xc8e7('0x2d')][_0xc8e7('0x32')]));_0xcd0c6a['attributes']=_0xcd0c6a[_0xc8e7('0x30')]['length']?_0xcd0c6a[_0xc8e7('0x30')]:_0x402fd8[_0xc8e7('0x2c')];if(_0x386c87[_0xc8e7('0x2d')][_0xc8e7('0x41')]){_0xcd0c6a[_0xc8e7('0x3c')]=[{'all':!![]}];}_0xcd0c6a=_['merge']({},_0xcd0c6a,_0x386c87[_0xc8e7('0x42')]);return db[_0xc8e7('0x3b')][_0xc8e7('0x43')](_0xcd0c6a)['then'](handleEntityNotFound(_0x73d63d,null))[_0xc8e7('0x23')](respondWithResult(_0x73d63d,null))[_0xc8e7('0x3f')](handleError(_0x73d63d,null));};exports[_0xc8e7('0x44')]=function(_0x122371,_0x54b3f7){return db[_0xc8e7('0x3b')]['create'](_0x122371[_0xc8e7('0x45')],{})[_0xc8e7('0x23')](respondWithResult(_0x54b3f7,0xc9))[_0xc8e7('0x3f')](handleError(_0x54b3f7,null));};exports['update']=function(_0xda44cd,_0x24579f){if(_0xda44cd['body']['id']){delete _0xda44cd['body']['id'];}return db[_0xc8e7('0x3b')][_0xc8e7('0x43')]({'where':{'id':_0xda44cd['params']['id']}})[_0xc8e7('0x23')](handleEntityNotFound(_0x24579f,null))['then'](saveUpdates(_0xda44cd[_0xc8e7('0x45')],null))[_0xc8e7('0x23')](respondWithResult(_0x24579f,null))[_0xc8e7('0x3f')](handleError(_0x24579f,null));};exports['destroy']=function(_0x14855f,_0x275659){return db[_0xc8e7('0x3b')][_0xc8e7('0x43')]({'where':{'id':_0x14855f[_0xc8e7('0x40')]['id']}})[_0xc8e7('0x23')](handleEntityNotFound(_0x275659,null))[_0xc8e7('0x23')](removeEntity(_0x275659,null))[_0xc8e7('0x3f')](handleError(_0x275659,null));};exports[_0xc8e7('0x46')]=function(_0x129123,_0x5e0672){return db[_0xc8e7('0x3b')][_0xc8e7('0x46')]()['then'](respondWithResult(_0x5e0672,null))[_0xc8e7('0x3f')](handleError(_0x5e0672,null));}; \ No newline at end of file +var _0xf837=['length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','include','findAll','rows','params','create','catch','body','find','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','apply','reject','save','update','then','end','sendStatus','error','name','send','index','map','SmsQueueReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf837,0x1d1));var _0x7f83=function(_0x39c778,_0x4328f3){_0x39c778=_0x39c778-0x0;var _0x32301d=_0xf837[_0x39c778];return _0x32301d;};'use strict';var emlformat=require(_0x7f83('0x0'));var rimraf=require(_0x7f83('0x1'));var zipdir=require(_0x7f83('0x2'));var jsonpatch=require(_0x7f83('0x3'));var rp=require(_0x7f83('0x4'));var moment=require(_0x7f83('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7f83('0x6'));var path=require(_0x7f83('0x7'));var sox=require('sox');var csv=require(_0x7f83('0x8'));var ejs=require(_0x7f83('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7f83('0xa'));var squel=require(_0x7f83('0xb'));var crypto=require('crypto');var jsforce=require(_0x7f83('0xc'));var deskjs=require(_0x7f83('0xd'));var toCsv=require(_0x7f83('0x8'));var querystring=require(_0x7f83('0xe'));var Papa=require(_0x7f83('0xf'));var Redis=require('ioredis');var authService=require(_0x7f83('0x10'));var qs=require(_0x7f83('0x11'));var as=require(_0x7f83('0x12'));var hardwareService=require(_0x7f83('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x7f83('0x14'));var config=require(_0x7f83('0x15'));var licenseUtil=require(_0x7f83('0x16'));var db=require(_0x7f83('0x17'))['db'];function respondWithStatusCode(_0xce771d,_0x68dd5b){_0x68dd5b=_0x68dd5b||0xcc;return function(_0xd7378a){if(_0xd7378a){return _0xce771d['sendStatus'](_0x68dd5b);}return _0xce771d[_0x7f83('0x18')](_0x68dd5b)['end']();};}function respondWithResult(_0x3a013e,_0x16ab17){_0x16ab17=_0x16ab17||0xc8;return function(_0x2f3a0d){if(_0x2f3a0d){return _0x3a013e[_0x7f83('0x18')](_0x16ab17)[_0x7f83('0x19')](_0x2f3a0d);}};}function respondWithFilteredResult(_0x39e275,_0x3c6bc7){return function(_0x15da46){if(_0x15da46){var _0x3c377b=typeof _0x3c6bc7[_0x7f83('0x1a')]===_0x7f83('0x1b')&&typeof _0x3c6bc7[_0x7f83('0x1c')]===_0x7f83('0x1b');var _0x48c0f6=_0x15da46[_0x7f83('0x1d')];var _0x487232=_0x3c377b?0x0:_0x3c6bc7['offset'];var _0x476a70=_0x3c377b?_0x15da46['count']:_0x3c6bc7[_0x7f83('0x1a')]+_0x3c6bc7[_0x7f83('0x1c')];var _0xdc029;if(_0x476a70>=_0x48c0f6){_0x476a70=_0x48c0f6;_0xdc029=0xc8;}else{_0xdc029=0xce;}_0x39e275[_0x7f83('0x18')](_0xdc029);return _0x39e275['set']('Content-Range',_0x487232+'-'+_0x476a70+'/'+_0x48c0f6)[_0x7f83('0x19')](_0x15da46);}return null;};}function patchUpdates(_0x15f1b8){return function(_0x2d45f5){try{jsonpatch[_0x7f83('0x1e')](_0x2d45f5,_0x15f1b8,!![]);}catch(_0xa5155){return BPromise[_0x7f83('0x1f')](_0xa5155);}return _0x2d45f5[_0x7f83('0x20')]();};}function saveUpdates(_0x632f5c,_0x22efba){return function(_0x233a63){if(_0x233a63){return _0x233a63[_0x7f83('0x21')](_0x632f5c)[_0x7f83('0x22')](function(_0x27de70){return _0x27de70;});}return null;};}function removeEntity(_0x213578,_0x37e199){return function(_0x49acdd){if(_0x49acdd){return _0x49acdd['destroy']()[_0x7f83('0x22')](function(){_0x213578['status'](0xcc)[_0x7f83('0x23')]();});}};}function handleEntityNotFound(_0x231037,_0x3c9720){return function(_0x23b3a3){if(!_0x23b3a3){_0x231037[_0x7f83('0x24')](0x194);}return _0x23b3a3;};}function handleError(_0x21e4de,_0x39fabc){_0x39fabc=_0x39fabc||0x1f4;return function(_0xac865e){logger[_0x7f83('0x25')](_0xac865e['stack']);if(_0xac865e[_0x7f83('0x26')]){delete _0xac865e[_0x7f83('0x26')];}_0x21e4de[_0x7f83('0x18')](_0x39fabc)[_0x7f83('0x27')](_0xac865e);};}exports[_0x7f83('0x28')]=function(_0x4eea77,_0x357ce0){var _0x30b212={},_0x4f9542={},_0x565b11={'count':0x0,'rows':[]};var _0x46cda4=_[_0x7f83('0x29')](db[_0x7f83('0x2a')][_0x7f83('0x2b')],function(_0x5cb83d){return{'name':_0x5cb83d[_0x7f83('0x2c')],'type':_0x5cb83d[_0x7f83('0x2d')][_0x7f83('0x2e')]};});_0x4f9542[_0x7f83('0x2f')]=_[_0x7f83('0x29')](_0x46cda4,_0x7f83('0x26'));_0x4f9542[_0x7f83('0x30')]=_[_0x7f83('0x31')](_0x4eea77[_0x7f83('0x30')]);_0x4f9542['filters']=_[_0x7f83('0x32')](_0x4f9542['model'],_0x4f9542[_0x7f83('0x30')]);_0x30b212['attributes']=_['intersection'](_0x4f9542[_0x7f83('0x2f')],qs[_0x7f83('0x33')](_0x4eea77[_0x7f83('0x30')]['fields']));_0x30b212[_0x7f83('0x34')]=_0x30b212[_0x7f83('0x34')][_0x7f83('0x35')]?_0x30b212['attributes']:_0x4f9542[_0x7f83('0x2f')];if(!_0x4eea77['query'][_0x7f83('0x36')](_0x7f83('0x37'))){_0x30b212[_0x7f83('0x1c')]=qs[_0x7f83('0x1c')](_0x4eea77[_0x7f83('0x30')]['limit']);_0x30b212[_0x7f83('0x1a')]=qs[_0x7f83('0x1a')](_0x4eea77['query'][_0x7f83('0x1a')]);}_0x30b212[_0x7f83('0x38')]=qs[_0x7f83('0x39')](_0x4eea77[_0x7f83('0x30')][_0x7f83('0x39')]);_0x30b212[_0x7f83('0x3a')]=qs[_0x7f83('0x3b')](_[_0x7f83('0x3c')](_0x4eea77[_0x7f83('0x30')],_0x4f9542[_0x7f83('0x3b')]),_0x46cda4);if(_0x4eea77[_0x7f83('0x30')][_0x7f83('0x3d')]){_0x30b212[_0x7f83('0x3a')]=_['merge'](_0x30b212['where'],{'$or':_[_0x7f83('0x29')](_0x46cda4,function(_0x21d290){if(_0x21d290[_0x7f83('0x2d')]!=='VIRTUAL'){var _0x273f65={};_0x273f65[_0x21d290[_0x7f83('0x26')]]={'$like':'%'+_0x4eea77[_0x7f83('0x30')][_0x7f83('0x3d')]+'%'};return _0x273f65;}})});}_0x30b212=_[_0x7f83('0x3e')]({},_0x30b212,_0x4eea77[_0x7f83('0x3f')]);var _0xe13b61={'where':_0x30b212[_0x7f83('0x3a')]};return db[_0x7f83('0x2a')][_0x7f83('0x1d')](_0xe13b61)['then'](function(_0x1c31a2){_0x565b11['count']=_0x1c31a2;if(_0x4eea77[_0x7f83('0x30')]['includeAll']){_0x30b212[_0x7f83('0x40')]=[{'all':!![]}];}return db[_0x7f83('0x2a')][_0x7f83('0x41')](_0x30b212);})['then'](function(_0x4c6fb6){_0x565b11[_0x7f83('0x42')]=_0x4c6fb6;return _0x565b11;})['then'](respondWithFilteredResult(_0x357ce0,_0x30b212))['catch'](handleError(_0x357ce0,null));};exports['show']=function(_0x402f6d,_0x53cb35){var _0x115a00={'raw':!![],'where':{'id':_0x402f6d[_0x7f83('0x43')]['id']}},_0x5b13e1={};_0x5b13e1['model']=_['keys'](db[_0x7f83('0x2a')][_0x7f83('0x2b')]);_0x5b13e1[_0x7f83('0x30')]=_[_0x7f83('0x31')](_0x402f6d[_0x7f83('0x30')]);_0x5b13e1['filters']=_['intersection'](_0x5b13e1[_0x7f83('0x2f')],_0x5b13e1[_0x7f83('0x30')]);_0x115a00[_0x7f83('0x34')]=_[_0x7f83('0x32')](_0x5b13e1[_0x7f83('0x2f')],qs[_0x7f83('0x33')](_0x402f6d[_0x7f83('0x30')][_0x7f83('0x33')]));_0x115a00[_0x7f83('0x34')]=_0x115a00[_0x7f83('0x34')][_0x7f83('0x35')]?_0x115a00[_0x7f83('0x34')]:_0x5b13e1[_0x7f83('0x2f')];if(_0x402f6d['query']['includeAll']){_0x115a00[_0x7f83('0x40')]=[{'all':!![]}];}_0x115a00=_[_0x7f83('0x3e')]({},_0x115a00,_0x402f6d[_0x7f83('0x3f')]);return db[_0x7f83('0x2a')]['find'](_0x115a00)[_0x7f83('0x22')](handleEntityNotFound(_0x53cb35,null))['then'](respondWithResult(_0x53cb35,null))['catch'](handleError(_0x53cb35,null));};exports[_0x7f83('0x44')]=function(_0x343406,_0x5e53c6){return db[_0x7f83('0x2a')][_0x7f83('0x44')](_0x343406['body'],{})[_0x7f83('0x22')](respondWithResult(_0x5e53c6,0xc9))[_0x7f83('0x45')](handleError(_0x5e53c6,null));};exports['update']=function(_0x44b648,_0x1976d5){if(_0x44b648[_0x7f83('0x46')]['id']){delete _0x44b648[_0x7f83('0x46')]['id'];}return db['SmsQueueReport'][_0x7f83('0x47')]({'where':{'id':_0x44b648[_0x7f83('0x43')]['id']}})[_0x7f83('0x22')](handleEntityNotFound(_0x1976d5,null))[_0x7f83('0x22')](saveUpdates(_0x44b648[_0x7f83('0x46')],null))[_0x7f83('0x22')](respondWithResult(_0x1976d5,null))[_0x7f83('0x45')](handleError(_0x1976d5,null));};exports[_0x7f83('0x48')]=function(_0x5a80e9,_0x3aa916){return db['SmsQueueReport'][_0x7f83('0x47')]({'where':{'id':_0x5a80e9[_0x7f83('0x43')]['id']}})['then'](handleEntityNotFound(_0x3aa916,null))['then'](removeEntity(_0x3aa916,null))[_0x7f83('0x45')](handleError(_0x3aa916,null));};exports[_0x7f83('0x49')]=function(_0x441d28,_0x30fac3){return db['SmsQueueReport'][_0x7f83('0x49')]()['then'](respondWithResult(_0x30fac3,null))['catch'](handleError(_0x30fac3,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 6687c75..b958621 100644 --- a/server/api/smsQueueReport/smsQueueReport.model.js +++ b/server/api/smsQueueReport/smsQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid','lodash','util'];(function(_0x58f923,_0x2ac4a7){var _0x12088c=function(_0x415533){while(--_0x415533){_0x58f923['push'](_0x58f923['shift']());}};_0x12088c(++_0x2ac4a7);}(_0xe706,0xa3));var _0x6e70=function(_0x423eba,_0xb6826c){_0x423eba=_0x423eba-0x0;var _0x138f29=_0xe706[_0x423eba];return _0x138f29;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));module[_0x6e70('0xa')]=function(_0x1b0389,_0x4381d1){return _0x1b0389[_0x6e70('0xb')](_0x6e70('0xc'),attributes,{'tableName':_0x6e70('0xd'),'paranoid':![],'indexes':[{'name':_0x6e70('0xe'),'fields':[_0x6e70('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcb91=['path','rimraf','./smsQueueReport.attributes','exports','define','report_sms_queue','uniqueid','../../config/logger','api','moment','bluebird'];(function(_0x5c950c,_0x475951){var _0x34c645=function(_0x5427b5){while(--_0x5427b5){_0x5c950c['push'](_0x5c950c['shift']());}};_0x34c645(++_0x475951);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0xcb91[_0x18ab2a];return _0x16dcee;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var moment=require(_0x1cb9('0x2'));var BPromise=require(_0x1cb9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1cb9('0x4'));var rimraf=require(_0x1cb9('0x5'));var config=require('../../config/environment');var attributes=require(_0x1cb9('0x6'));module[_0x1cb9('0x7')]=function(_0x53ffbd,_0x226b69){return _0x53ffbd[_0x1cb9('0x8')]('SmsQueueReport',attributes,{'tableName':_0x1cb9('0x9'),'paranoid':![],'indexes':[{'name':_0x1cb9('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 66aa512..c90024d 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 _0x5e72=['client','http','request','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','SmsQueueReport','body','options','raw','then','CreateSmsQueueReport','UpdateSmsQueueReport','update','where','attributes','limit','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0x5e72,0x1d3));var _0x25e7=function(_0x668df5,_0x40b17a){_0x668df5=_0x668df5-0x0;var _0x5d30f8=_0x5e72[_0x668df5];return _0x5d30f8;};'use strict';var _=require(_0x25e7('0x0'));var util=require(_0x25e7('0x1'));var moment=require(_0x25e7('0x2'));var BPromise=require(_0x25e7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x25e7('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x25e7('0x5'));var logger=require(_0x25e7('0x6'))('rpc');var config=require(_0x25e7('0x7'));var jayson=require(_0x25e7('0x8'));var client=jayson[_0x25e7('0x9')][_0x25e7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1dc834,_0x290800,_0x49b41f){return new BPromise(function(_0x129959,_0x13ed49){return client[_0x25e7('0xb')](_0x1dc834,_0x49b41f)['then'](function(_0x20b0e4){logger['info'](_0x25e7('0xc'),_0x290800,_0x25e7('0xd'));logger[_0x25e7('0xe')](_0x25e7('0xf'),_0x290800,'request\x20sent',JSON[_0x25e7('0x10')](_0x20b0e4));if(_0x20b0e4[_0x25e7('0x11')]){if(_0x20b0e4[_0x25e7('0x11')][_0x25e7('0x12')]===0x1f4){logger[_0x25e7('0x11')](_0x25e7('0xc'),_0x290800,_0x20b0e4[_0x25e7('0x11')][_0x25e7('0x13')]);return _0x13ed49(_0x20b0e4[_0x25e7('0x11')]['message']);}logger['error'](_0x25e7('0xc'),_0x290800,_0x20b0e4[_0x25e7('0x11')][_0x25e7('0x13')]);return _0x129959(_0x20b0e4[_0x25e7('0x11')][_0x25e7('0x13')]);}else{logger[_0x25e7('0x14')](_0x25e7('0xc'),_0x290800,_0x25e7('0xd'));_0x129959(_0x20b0e4[_0x25e7('0x15')][_0x25e7('0x13')]);}})[_0x25e7('0x16')](function(_0x2e58a5){logger[_0x25e7('0x11')]('SmsQueueReport,\x20%s,\x20%s',_0x290800,_0x2e58a5);_0x13ed49(_0x2e58a5);});});}exports['CreateSmsQueueReport']=function(_0x5eed37){var _0xb1885c=this;return new Promise(function(_0x4b996b,_0x3d71bc){return db[_0x25e7('0x17')]['create'](_0x5eed37[_0x25e7('0x18')],{'raw':_0x5eed37[_0x25e7('0x19')]?_0x5eed37['options'][_0x25e7('0x1a')]===undefined?!![]:![]:!![]})[_0x25e7('0x1b')](function(_0x2c17b6){logger[_0x25e7('0x14')](_0x25e7('0x1c'),_0x5eed37);logger[_0x25e7('0xe')](_0x25e7('0x1c'),_0x5eed37,JSON[_0x25e7('0x10')](_0x2c17b6));_0x4b996b(_0x2c17b6);})[_0x25e7('0x16')](function(_0x544680){logger[_0x25e7('0x11')](_0x25e7('0x1c'),_0x544680['message'],_0x5eed37);_0x3d71bc(_0xb1885c[_0x25e7('0x11')](0x1f4,_0x544680['message']));});});};exports[_0x25e7('0x1d')]=function(_0x10b2a8){var _0x47c398=this;return new Promise(function(_0x36ecce,_0x29fd16){return db[_0x25e7('0x17')][_0x25e7('0x1e')](_0x10b2a8[_0x25e7('0x18')],{'raw':_0x10b2a8[_0x25e7('0x19')]?_0x10b2a8[_0x25e7('0x19')][_0x25e7('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x10b2a8[_0x25e7('0x19')]?_0x10b2a8[_0x25e7('0x19')][_0x25e7('0x1f')]||null:null,'attributes':_0x10b2a8[_0x25e7('0x19')]?_0x10b2a8['options'][_0x25e7('0x20')]||null:null,'limit':_0x10b2a8[_0x25e7('0x19')]?_0x10b2a8['options'][_0x25e7('0x21')]||null:null})['then'](function(_0x117570){logger[_0x25e7('0x14')]('UpdateSmsQueueReport',_0x10b2a8);logger[_0x25e7('0xe')](_0x25e7('0x1d'),_0x10b2a8,JSON[_0x25e7('0x10')](_0x117570));_0x36ecce(_0x117570);})[_0x25e7('0x16')](function(_0x11448f){logger[_0x25e7('0x11')](_0x25e7('0x1d'),_0x11448f[_0x25e7('0x13')],_0x10b2a8);_0x29fd16(_0x47c398[_0x25e7('0x11')](0x1f4,_0x11448f[_0x25e7('0x13')]));});});}; \ No newline at end of file +var _0xfffc=['update','where','limit','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','SmsQueueReport,\x20%s,\x20%s','message','result','catch','SmsQueueReport','body','options','raw','then','CreateSmsQueueReport','UpdateSmsQueueReport'];(function(_0x55c121,_0x18ffa8){var _0x197d07=function(_0x1600a2){while(--_0x1600a2){_0x55c121['push'](_0x55c121['shift']());}};_0x197d07(++_0x18ffa8);}(_0xfffc,0x1d4));var _0xcfff=function(_0x499ea4,_0x254251){_0x499ea4=_0x499ea4-0x0;var _0x154ea3=_0xfffc[_0x499ea4];return _0x154ea3;};'use strict';var _=require('lodash');var util=require(_0xcfff('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xcfff('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcfff('0x2'))['db'];var utils=require(_0xcfff('0x3'));var logger=require(_0xcfff('0x4'))(_0xcfff('0x5'));var config=require(_0xcfff('0x6'));var jayson=require(_0xcfff('0x7'));var client=jayson[_0xcfff('0x8')][_0xcfff('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2cc189,_0x5c3caa,_0x592484){return new BPromise(function(_0x43a909,_0x3fc907){return client[_0xcfff('0xa')](_0x2cc189,_0x592484)['then'](function(_0x357289){logger[_0xcfff('0xb')]('SmsQueueReport,\x20%s,\x20%s',_0x5c3caa,'request\x20sent');logger[_0xcfff('0xc')](_0xcfff('0xd'),_0x5c3caa,_0xcfff('0xe'),JSON[_0xcfff('0xf')](_0x357289));if(_0x357289[_0xcfff('0x10')]){if(_0x357289[_0xcfff('0x10')]['code']===0x1f4){logger[_0xcfff('0x10')](_0xcfff('0x11'),_0x5c3caa,_0x357289['error'][_0xcfff('0x12')]);return _0x3fc907(_0x357289[_0xcfff('0x10')][_0xcfff('0x12')]);}logger[_0xcfff('0x10')]('SmsQueueReport,\x20%s,\x20%s',_0x5c3caa,_0x357289['error'][_0xcfff('0x12')]);return _0x43a909(_0x357289[_0xcfff('0x10')][_0xcfff('0x12')]);}else{logger[_0xcfff('0xb')](_0xcfff('0x11'),_0x5c3caa,_0xcfff('0xe'));_0x43a909(_0x357289[_0xcfff('0x13')][_0xcfff('0x12')]);}})[_0xcfff('0x14')](function(_0x1a054d){logger['error']('SmsQueueReport,\x20%s,\x20%s',_0x5c3caa,_0x1a054d);_0x3fc907(_0x1a054d);});});}exports['CreateSmsQueueReport']=function(_0x4b6f87){var _0x37d09a=this;return new Promise(function(_0x3338b7,_0x364d27){return db[_0xcfff('0x15')]['create'](_0x4b6f87[_0xcfff('0x16')],{'raw':_0x4b6f87[_0xcfff('0x17')]?_0x4b6f87[_0xcfff('0x17')][_0xcfff('0x18')]===undefined?!![]:![]:!![]})[_0xcfff('0x19')](function(_0x5ddd0d){logger[_0xcfff('0xb')](_0xcfff('0x1a'),_0x4b6f87);logger[_0xcfff('0xc')]('CreateSmsQueueReport',_0x4b6f87,JSON['stringify'](_0x5ddd0d));_0x3338b7(_0x5ddd0d);})[_0xcfff('0x14')](function(_0x58220c){logger[_0xcfff('0x10')](_0xcfff('0x1a'),_0x58220c['message'],_0x4b6f87);_0x364d27(_0x37d09a[_0xcfff('0x10')](0x1f4,_0x58220c['message']));});});};exports[_0xcfff('0x1b')]=function(_0x47245a){var _0x1efd4a=this;return new Promise(function(_0x44b07f,_0x30fad3){return db['SmsQueueReport'][_0xcfff('0x1c')](_0x47245a[_0xcfff('0x16')],{'raw':_0x47245a[_0xcfff('0x17')]?_0x47245a[_0xcfff('0x17')][_0xcfff('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x47245a[_0xcfff('0x17')]?_0x47245a[_0xcfff('0x17')][_0xcfff('0x1d')]||null:null,'attributes':_0x47245a['options']?_0x47245a[_0xcfff('0x17')]['attributes']||null:null,'limit':_0x47245a[_0xcfff('0x17')]?_0x47245a[_0xcfff('0x17')][_0xcfff('0x1e')]||null:null})[_0xcfff('0x19')](function(_0x2032d5){logger['info'](_0xcfff('0x1b'),_0x47245a);logger[_0xcfff('0xc')](_0xcfff('0x1b'),_0x47245a,JSON[_0xcfff('0xf')](_0x2032d5));_0x44b07f(_0x2032d5);})['catch'](function(_0x331d4d){logger[_0xcfff('0x10')](_0xcfff('0x1b'),_0x331d4d[_0xcfff('0x12')],_0x47245a);_0x30fad3(_0x1efd4a[_0xcfff('0x10')](0x1f4,_0x331d4d['message']));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 7683a46..bc705d9 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 _0x3561=['exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get','isAuthenticated','index','describe','show','post','create','/:id','delete','destroy'];(function(_0x4b0a3e,_0x236bc4){var _0x418bde=function(_0x2df866){while(--_0x2df866){_0x4b0a3e['push'](_0x4b0a3e['shift']());}};_0x418bde(++_0x236bc4);}(_0x3561,0x94));var _0x1356=function(_0x3786a0,_0x58a16f){_0x3786a0=_0x3786a0-0x0;var _0xaef246=_0x3561[_0x3786a0];return _0xaef246;};'use strict';var multer=require(_0x1356('0x0'));var util=require('util');var path=require(_0x1356('0x1'));var timeout=require(_0x1356('0x2'));var express=require(_0x1356('0x3'));var router=express[_0x1356('0x4')]();var fs_extra=require(_0x1356('0x5'));var auth=require(_0x1356('0x6'));var interaction=require(_0x1356('0x7'));var config=require(_0x1356('0x8'));var controller=require(_0x1356('0x9'));router[_0x1356('0xa')]('/',auth[_0x1356('0xb')](),controller[_0x1356('0xc')]);router[_0x1356('0xa')]('/describe',auth[_0x1356('0xb')](),controller[_0x1356('0xd')]);router[_0x1356('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x1356('0xe')]);router[_0x1356('0xf')]('/',auth['isAuthenticated'](),controller[_0x1356('0x10')]);router['put'](_0x1356('0x11'),auth[_0x1356('0xb')](),controller['update']);router[_0x1356('0x12')](_0x1356('0x11'),auth['isAuthenticated'](),controller[_0x1356('0x13')]);module[_0x1356('0x14')]=router; \ No newline at end of file +var _0x99c9=['describe','/:id','show','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get','isAuthenticated','index','/describe'];(function(_0x19f06c,_0x223211){var _0x2c6450=function(_0x3d8a82){while(--_0x3d8a82){_0x19f06c['push'](_0x19f06c['shift']());}};_0x2c6450(++_0x223211);}(_0x99c9,0x13c));var _0x999c=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0x99c9[_0x5f3f88];return _0xd08119;};'use strict';var multer=require(_0x999c('0x0'));var util=require(_0x999c('0x1'));var path=require(_0x999c('0x2'));var timeout=require(_0x999c('0x3'));var express=require(_0x999c('0x4'));var router=express[_0x999c('0x5')]();var fs_extra=require(_0x999c('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x999c('0x7'));var config=require(_0x999c('0x8'));var controller=require(_0x999c('0x9'));router[_0x999c('0xa')]('/',auth[_0x999c('0xb')](),controller[_0x999c('0xc')]);router[_0x999c('0xa')](_0x999c('0xd'),auth[_0x999c('0xb')](),controller[_0x999c('0xe')]);router[_0x999c('0xa')](_0x999c('0xf'),auth[_0x999c('0xb')](),controller[_0x999c('0x10')]);router['post']('/',auth[_0x999c('0xb')](),controller[_0x999c('0x11')]);router['put'](_0x999c('0xf'),auth[_0x999c('0xb')](),controller[_0x999c('0x12')]);router[_0x999c('0x13')](_0x999c('0xf'),auth[_0x999c('0xb')](),controller[_0x999c('0x14')]);module[_0x999c('0x15')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index e82ef4a..baed137 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(_0x127473,_0x4a6406){var _0x3d4712=function(_0x5d2894){while(--_0x5d2894){_0x127473['push'](_0x127473['shift']());}};_0x3d4712(++_0x4a6406);}(_0xf4eb,0xec));var _0xbf4e=function(_0x37e3bd,_0x50e852){_0x37e3bd=_0x37e3bd-0x0;var _0x870291=_0xf4eb[_0x37e3bd];return _0x870291;};'use strict';var moment=require(_0xbf4e('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xbf4e('0x1'),'agent','queue'),'allowNull':![],'defaultValue':_0xbf4e('0x2')},'transferredAt':{'type':Sequelize[_0xbf4e('0x3')],'allowNull':![],'defaultValue':Sequelize[_0xbf4e('0x4')]}}; \ No newline at end of file +var _0xf4eb=['NOW','moment','account','queue','DATE'];(function(_0xe11bcd,_0x188db1){var _0x527db7=function(_0xa8f63b){while(--_0xa8f63b){_0xe11bcd['push'](_0xe11bcd['shift']());}};_0x527db7(++_0x188db1);}(_0xf4eb,0xec));var _0xbf4e=function(_0x132c37,_0x512735){_0x132c37=_0x132c37-0x0;var _0x67a062=_0xf4eb[_0x132c37];return _0x67a062;};'use strict';var moment=require(_0xbf4e('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xbf4e('0x1'),'agent','queue'),'allowNull':![],'defaultValue':_0xbf4e('0x2')},'transferredAt':{'type':Sequelize[_0xbf4e('0x3')],'allowNull':![],'defaultValue':Sequelize[_0xbf4e('0x4')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index b8de53b..7e191c3 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 _0xa24a=['zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','send','index','map','SmsTransferReport','rawAttributes','type','key','query','keys','intersection','model','attributes','fields','length','nolimit','order','where','filters','pick','filter','VIRTUAL','options','include','findAll','rows','show','params','includeAll','merge','find','catch','create','body','describe','eml-format','rimraf'];(function(_0x4fc9e6,_0xc51915){var _0x551d28=function(_0x1a603b){while(--_0x1a603b){_0x4fc9e6['push'](_0x4fc9e6['shift']());}};_0x551d28(++_0xc51915);}(_0xa24a,0x184));var _0xaa24=function(_0x181aa1,_0x456875){_0x181aa1=_0x181aa1-0x0;var _0x47216f=_0xa24a[_0x181aa1];return _0x47216f;};'use strict';var emlformat=require(_0xaa24('0x0'));var rimraf=require(_0xaa24('0x1'));var zipdir=require(_0xaa24('0x2'));var jsonpatch=require(_0xaa24('0x3'));var rp=require('request-promise');var moment=require(_0xaa24('0x4'));var BPromise=require(_0xaa24('0x5'));var Mustache=require(_0xaa24('0x6'));var util=require(_0xaa24('0x7'));var path=require(_0xaa24('0x8'));var sox=require('sox');var csv=require(_0xaa24('0x9'));var ejs=require(_0xaa24('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xaa24('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xaa24('0xc'));var deskjs=require(_0xaa24('0xd'));var toCsv=require(_0xaa24('0x9'));var querystring=require(_0xaa24('0xe'));var Papa=require(_0xaa24('0xf'));var Redis=require(_0xaa24('0x10'));var authService=require(_0xaa24('0x11'));var qs=require(_0xaa24('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaa24('0x13'));var logger=require(_0xaa24('0x14'))(_0xaa24('0x15'));var utils=require(_0xaa24('0x16'));var config=require(_0xaa24('0x17'));var licenseUtil=require(_0xaa24('0x18'));var db=require(_0xaa24('0x19'))['db'];function respondWithStatusCode(_0x5b34d5,_0x2ae629){_0x2ae629=_0x2ae629||0xcc;return function(_0x2901f9){if(_0x2901f9){return _0x5b34d5['sendStatus'](_0x2ae629);}return _0x5b34d5[_0xaa24('0x1a')](_0x2ae629)[_0xaa24('0x1b')]();};}function respondWithResult(_0x27cca6,_0x11d3d8){_0x11d3d8=_0x11d3d8||0xc8;return function(_0x2a68d6){if(_0x2a68d6){return _0x27cca6[_0xaa24('0x1a')](_0x11d3d8)[_0xaa24('0x1c')](_0x2a68d6);}};}function respondWithFilteredResult(_0x2c3594,_0x3e7efb){return function(_0x16d48a){if(_0x16d48a){var _0xc93f0f=typeof _0x3e7efb['offset']===_0xaa24('0x1d')&&typeof _0x3e7efb[_0xaa24('0x1e')]===_0xaa24('0x1d');var _0x16afde=_0x16d48a[_0xaa24('0x1f')];var _0x5e058c=_0xc93f0f?0x0:_0x3e7efb[_0xaa24('0x20')];var _0x5ec4df=_0xc93f0f?_0x16d48a[_0xaa24('0x1f')]:_0x3e7efb['offset']+_0x3e7efb[_0xaa24('0x1e')];var _0xab0ada;if(_0x5ec4df>=_0x16afde){_0x5ec4df=_0x16afde;_0xab0ada=0xc8;}else{_0xab0ada=0xce;}_0x2c3594[_0xaa24('0x1a')](_0xab0ada);return _0x2c3594[_0xaa24('0x21')](_0xaa24('0x22'),_0x5e058c+'-'+_0x5ec4df+'/'+_0x16afde)[_0xaa24('0x1c')](_0x16d48a);}return null;};}function patchUpdates(_0x884e35){return function(_0x59fcba){try{jsonpatch[_0xaa24('0x23')](_0x59fcba,_0x884e35,!![]);}catch(_0x1aee09){return BPromise[_0xaa24('0x24')](_0x1aee09);}return _0x59fcba[_0xaa24('0x25')]();};}function saveUpdates(_0x5e2f4e,_0x56f6af){return function(_0x2cc1e1){if(_0x2cc1e1){return _0x2cc1e1[_0xaa24('0x26')](_0x5e2f4e)[_0xaa24('0x27')](function(_0x3519fd){return _0x3519fd;});}return null;};}function removeEntity(_0x479cee,_0x366ec8){return function(_0x233a64){if(_0x233a64){return _0x233a64[_0xaa24('0x28')]()['then'](function(){_0x479cee[_0xaa24('0x1a')](0xcc)[_0xaa24('0x1b')]();});}};}function handleEntityNotFound(_0x4c2f79,_0x50ffb9){return function(_0x1d96f2){if(!_0x1d96f2){_0x4c2f79[_0xaa24('0x29')](0x194);}return _0x1d96f2;};}function handleError(_0x5cfa9f,_0x53d5ea){_0x53d5ea=_0x53d5ea||0x1f4;return function(_0x142713){logger[_0xaa24('0x2a')](_0x142713['stack']);if(_0x142713['name']){delete _0x142713[_0xaa24('0x2b')];}_0x5cfa9f['status'](_0x53d5ea)[_0xaa24('0x2c')](_0x142713);};}exports[_0xaa24('0x2d')]=function(_0x2d9a2f,_0x129eeb){var _0x260390={},_0xacc77e={},_0x32e360={'count':0x0,'rows':[]};var _0x3cee29=_[_0xaa24('0x2e')](db[_0xaa24('0x2f')][_0xaa24('0x30')],function(_0x581978){return{'name':_0x581978['fieldName'],'type':_0x581978[_0xaa24('0x31')][_0xaa24('0x32')]};});_0xacc77e['model']=_[_0xaa24('0x2e')](_0x3cee29,_0xaa24('0x2b'));_0xacc77e[_0xaa24('0x33')]=_[_0xaa24('0x34')](_0x2d9a2f[_0xaa24('0x33')]);_0xacc77e['filters']=_[_0xaa24('0x35')](_0xacc77e[_0xaa24('0x36')],_0xacc77e[_0xaa24('0x33')]);_0x260390[_0xaa24('0x37')]=_[_0xaa24('0x35')](_0xacc77e['model'],qs[_0xaa24('0x38')](_0x2d9a2f[_0xaa24('0x33')]['fields']));_0x260390[_0xaa24('0x37')]=_0x260390['attributes'][_0xaa24('0x39')]?_0x260390[_0xaa24('0x37')]:_0xacc77e['model'];if(!_0x2d9a2f['query']['hasOwnProperty'](_0xaa24('0x3a'))){_0x260390[_0xaa24('0x1e')]=qs[_0xaa24('0x1e')](_0x2d9a2f[_0xaa24('0x33')][_0xaa24('0x1e')]);_0x260390[_0xaa24('0x20')]=qs[_0xaa24('0x20')](_0x2d9a2f[_0xaa24('0x33')][_0xaa24('0x20')]);}_0x260390[_0xaa24('0x3b')]=qs['sort'](_0x2d9a2f[_0xaa24('0x33')]['sort']);_0x260390[_0xaa24('0x3c')]=qs[_0xaa24('0x3d')](_[_0xaa24('0x3e')](_0x2d9a2f[_0xaa24('0x33')],_0xacc77e[_0xaa24('0x3d')]),_0x3cee29);if(_0x2d9a2f[_0xaa24('0x33')][_0xaa24('0x3f')]){_0x260390[_0xaa24('0x3c')]=_['merge'](_0x260390['where'],{'$or':_[_0xaa24('0x2e')](_0x3cee29,function(_0x4d3ebe){if(_0x4d3ebe[_0xaa24('0x31')]!==_0xaa24('0x40')){var _0x516ce4={};_0x516ce4[_0x4d3ebe['name']]={'$like':'%'+_0x2d9a2f[_0xaa24('0x33')][_0xaa24('0x3f')]+'%'};return _0x516ce4;}})});}_0x260390=_['merge']({},_0x260390,_0x2d9a2f[_0xaa24('0x41')]);var _0x41bd48={'where':_0x260390[_0xaa24('0x3c')]};return db['SmsTransferReport'][_0xaa24('0x1f')](_0x41bd48)['then'](function(_0x5dbab9){_0x32e360[_0xaa24('0x1f')]=_0x5dbab9;if(_0x2d9a2f[_0xaa24('0x33')]['includeAll']){_0x260390[_0xaa24('0x42')]=[{'all':!![]}];}return db[_0xaa24('0x2f')][_0xaa24('0x43')](_0x260390);})[_0xaa24('0x27')](function(_0x197f8f){_0x32e360[_0xaa24('0x44')]=_0x197f8f;return _0x32e360;})[_0xaa24('0x27')](respondWithFilteredResult(_0x129eeb,_0x260390))['catch'](handleError(_0x129eeb,null));};exports[_0xaa24('0x45')]=function(_0x584b99,_0x3ed009){var _0x2ea459={'raw':!![],'where':{'id':_0x584b99[_0xaa24('0x46')]['id']}},_0x460cd1={};_0x460cd1[_0xaa24('0x36')]=_[_0xaa24('0x34')](db[_0xaa24('0x2f')][_0xaa24('0x30')]);_0x460cd1[_0xaa24('0x33')]=_[_0xaa24('0x34')](_0x584b99[_0xaa24('0x33')]);_0x460cd1[_0xaa24('0x3d')]=_[_0xaa24('0x35')](_0x460cd1[_0xaa24('0x36')],_0x460cd1[_0xaa24('0x33')]);_0x2ea459[_0xaa24('0x37')]=_[_0xaa24('0x35')](_0x460cd1[_0xaa24('0x36')],qs[_0xaa24('0x38')](_0x584b99[_0xaa24('0x33')][_0xaa24('0x38')]));_0x2ea459[_0xaa24('0x37')]=_0x2ea459[_0xaa24('0x37')][_0xaa24('0x39')]?_0x2ea459[_0xaa24('0x37')]:_0x460cd1['model'];if(_0x584b99[_0xaa24('0x33')][_0xaa24('0x47')]){_0x2ea459['include']=[{'all':!![]}];}_0x2ea459=_[_0xaa24('0x48')]({},_0x2ea459,_0x584b99[_0xaa24('0x41')]);return db['SmsTransferReport'][_0xaa24('0x49')](_0x2ea459)['then'](handleEntityNotFound(_0x3ed009,null))[_0xaa24('0x27')](respondWithResult(_0x3ed009,null))[_0xaa24('0x4a')](handleError(_0x3ed009,null));};exports[_0xaa24('0x4b')]=function(_0x31a0e3,_0x57a5aa){return db['SmsTransferReport']['create'](_0x31a0e3[_0xaa24('0x4c')],{})[_0xaa24('0x27')](respondWithResult(_0x57a5aa,0xc9))[_0xaa24('0x4a')](handleError(_0x57a5aa,null));};exports[_0xaa24('0x26')]=function(_0x5b2836,_0xab68b){if(_0x5b2836[_0xaa24('0x4c')]['id']){delete _0x5b2836['body']['id'];}return db[_0xaa24('0x2f')][_0xaa24('0x49')]({'where':{'id':_0x5b2836[_0xaa24('0x46')]['id']}})[_0xaa24('0x27')](handleEntityNotFound(_0xab68b,null))[_0xaa24('0x27')](saveUpdates(_0x5b2836['body'],null))[_0xaa24('0x27')](respondWithResult(_0xab68b,null))['catch'](handleError(_0xab68b,null));};exports[_0xaa24('0x28')]=function(_0xc329a8,_0x8ac093){return db[_0xaa24('0x2f')][_0xaa24('0x49')]({'where':{'id':_0xc329a8[_0xaa24('0x46')]['id']}})[_0xaa24('0x27')](handleEntityNotFound(_0x8ac093,null))[_0xaa24('0x27')](removeEntity(_0x8ac093,null))[_0xaa24('0x4a')](handleError(_0x8ac093,null));};exports[_0xaa24('0x4d')]=function(_0x40e03e,_0x90c298){return db['SmsTransferReport'][_0xaa24('0x4d')]()[_0xaa24('0x27')](respondWithResult(_0x90c298,null))[_0xaa24('0x4a')](handleError(_0x90c298,null));}; \ No newline at end of file +var _0x0ec2=['map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','options','include','findAll','rows','catch','includeAll','create','body','params','destroy','describe','rimraf','zip-dir','request-promise','moment','bluebird','util','path','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','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','then','error','stack','name','index','SmsTransferReport','rawAttributes','fieldName','type','key','model'];(function(_0x2b5eae,_0x55010d){var _0x5f3ac9=function(_0x397bfc){while(--_0x397bfc){_0x2b5eae['push'](_0x2b5eae['shift']());}};_0x5f3ac9(++_0x55010d);}(_0x0ec2,0x69));var _0x20ec=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0x0ec2[_0x30ae5e];return _0x1f2e93;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x20ec('0x0'));var zipdir=require(_0x20ec('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x20ec('0x2'));var moment=require(_0x20ec('0x3'));var BPromise=require(_0x20ec('0x4'));var Mustache=require('mustache');var util=require(_0x20ec('0x5'));var path=require(_0x20ec('0x6'));var sox=require('sox');var csv=require(_0x20ec('0x7'));var ejs=require(_0x20ec('0x8'));var fs=require('fs');var fs_extra=require(_0x20ec('0x9'));var _=require(_0x20ec('0xa'));var squel=require(_0x20ec('0xb'));var crypto=require(_0x20ec('0xc'));var jsforce=require(_0x20ec('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x20ec('0x7'));var querystring=require(_0x20ec('0xe'));var Papa=require(_0x20ec('0xf'));var Redis=require(_0x20ec('0x10'));var authService=require(_0x20ec('0x11'));var qs=require(_0x20ec('0x12'));var as=require(_0x20ec('0x13'));var hardwareService=require(_0x20ec('0x14'));var logger=require(_0x20ec('0x15'))(_0x20ec('0x16'));var utils=require('../../config/utils');var config=require(_0x20ec('0x17'));var licenseUtil=require(_0x20ec('0x18'));var db=require(_0x20ec('0x19'))['db'];function respondWithStatusCode(_0x5a5aa9,_0x2e94ef){_0x2e94ef=_0x2e94ef||0xcc;return function(_0x18d65f){if(_0x18d65f){return _0x5a5aa9[_0x20ec('0x1a')](_0x2e94ef);}return _0x5a5aa9[_0x20ec('0x1b')](_0x2e94ef)[_0x20ec('0x1c')]();};}function respondWithResult(_0x1ff3c1,_0x144eef){_0x144eef=_0x144eef||0xc8;return function(_0x356d26){if(_0x356d26){return _0x1ff3c1[_0x20ec('0x1b')](_0x144eef)[_0x20ec('0x1d')](_0x356d26);}};}function respondWithFilteredResult(_0x3c2afe,_0xd339a1){return function(_0x73b39d){if(_0x73b39d){var _0x128739=typeof _0xd339a1[_0x20ec('0x1e')]===_0x20ec('0x1f')&&typeof _0xd339a1['limit']===_0x20ec('0x1f');var _0x1a9d8d=_0x73b39d[_0x20ec('0x20')];var _0x12da4c=_0x128739?0x0:_0xd339a1[_0x20ec('0x1e')];var _0x1df4b8=_0x128739?_0x73b39d[_0x20ec('0x20')]:_0xd339a1[_0x20ec('0x1e')]+_0xd339a1['limit'];var _0x425175;if(_0x1df4b8>=_0x1a9d8d){_0x1df4b8=_0x1a9d8d;_0x425175=0xc8;}else{_0x425175=0xce;}_0x3c2afe[_0x20ec('0x1b')](_0x425175);return _0x3c2afe[_0x20ec('0x21')](_0x20ec('0x22'),_0x12da4c+'-'+_0x1df4b8+'/'+_0x1a9d8d)['json'](_0x73b39d);}return null;};}function patchUpdates(_0x5e7fbb){return function(_0x3c6b10){try{jsonpatch[_0x20ec('0x23')](_0x3c6b10,_0x5e7fbb,!![]);}catch(_0x520b4a){return BPromise[_0x20ec('0x24')](_0x520b4a);}return _0x3c6b10[_0x20ec('0x25')]();};}function saveUpdates(_0x47e76b,_0x5b0bf2){return function(_0xed0777){if(_0xed0777){return _0xed0777['update'](_0x47e76b)[_0x20ec('0x26')](function(_0x1eda7d){return _0x1eda7d;});}return null;};}function removeEntity(_0x43aeb6,_0x4b37a3){return function(_0x2e4cbb){if(_0x2e4cbb){return _0x2e4cbb['destroy']()['then'](function(){_0x43aeb6[_0x20ec('0x1b')](0xcc)[_0x20ec('0x1c')]();});}};}function handleEntityNotFound(_0x148cc2,_0x3c6a92){return function(_0x6dc90e){if(!_0x6dc90e){_0x148cc2[_0x20ec('0x1a')](0x194);}return _0x6dc90e;};}function handleError(_0x20ab3e,_0x5b1d09){_0x5b1d09=_0x5b1d09||0x1f4;return function(_0x1e7787){logger[_0x20ec('0x27')](_0x1e7787[_0x20ec('0x28')]);if(_0x1e7787[_0x20ec('0x29')]){delete _0x1e7787[_0x20ec('0x29')];}_0x20ab3e['status'](_0x5b1d09)['send'](_0x1e7787);};}exports[_0x20ec('0x2a')]=function(_0x14d906,_0x7ba37b){var _0x3b38ad={},_0x7613c9={},_0x3f97fd={'count':0x0,'rows':[]};var _0x57c61d=_['map'](db[_0x20ec('0x2b')][_0x20ec('0x2c')],function(_0x2226e6){return{'name':_0x2226e6[_0x20ec('0x2d')],'type':_0x2226e6[_0x20ec('0x2e')][_0x20ec('0x2f')]};});_0x7613c9[_0x20ec('0x30')]=_[_0x20ec('0x31')](_0x57c61d,_0x20ec('0x29'));_0x7613c9[_0x20ec('0x32')]=_[_0x20ec('0x33')](_0x14d906['query']);_0x7613c9[_0x20ec('0x34')]=_[_0x20ec('0x35')](_0x7613c9[_0x20ec('0x30')],_0x7613c9[_0x20ec('0x32')]);_0x3b38ad[_0x20ec('0x36')]=_[_0x20ec('0x35')](_0x7613c9[_0x20ec('0x30')],qs[_0x20ec('0x37')](_0x14d906[_0x20ec('0x32')][_0x20ec('0x37')]));_0x3b38ad[_0x20ec('0x36')]=_0x3b38ad[_0x20ec('0x36')][_0x20ec('0x38')]?_0x3b38ad['attributes']:_0x7613c9[_0x20ec('0x30')];if(!_0x14d906[_0x20ec('0x32')][_0x20ec('0x39')](_0x20ec('0x3a'))){_0x3b38ad['limit']=qs[_0x20ec('0x3b')](_0x14d906['query'][_0x20ec('0x3b')]);_0x3b38ad[_0x20ec('0x1e')]=qs[_0x20ec('0x1e')](_0x14d906[_0x20ec('0x32')][_0x20ec('0x1e')]);}_0x3b38ad[_0x20ec('0x3c')]=qs[_0x20ec('0x3d')](_0x14d906[_0x20ec('0x32')][_0x20ec('0x3d')]);_0x3b38ad[_0x20ec('0x3e')]=qs['filters'](_[_0x20ec('0x3f')](_0x14d906[_0x20ec('0x32')],_0x7613c9['filters']),_0x57c61d);if(_0x14d906[_0x20ec('0x32')][_0x20ec('0x40')]){_0x3b38ad['where']=_[_0x20ec('0x41')](_0x3b38ad[_0x20ec('0x3e')],{'$or':_[_0x20ec('0x31')](_0x57c61d,function(_0x7166e6){if(_0x7166e6[_0x20ec('0x2e')]!=='VIRTUAL'){var _0x2872f2={};_0x2872f2[_0x7166e6[_0x20ec('0x29')]]={'$like':'%'+_0x14d906['query'][_0x20ec('0x40')]+'%'};return _0x2872f2;}})});}_0x3b38ad=_[_0x20ec('0x41')]({},_0x3b38ad,_0x14d906[_0x20ec('0x42')]);var _0x4e7b41={'where':_0x3b38ad[_0x20ec('0x3e')]};return db['SmsTransferReport'][_0x20ec('0x20')](_0x4e7b41)[_0x20ec('0x26')](function(_0xe4c1cd){_0x3f97fd[_0x20ec('0x20')]=_0xe4c1cd;if(_0x14d906[_0x20ec('0x32')]['includeAll']){_0x3b38ad[_0x20ec('0x43')]=[{'all':!![]}];}return db[_0x20ec('0x2b')][_0x20ec('0x44')](_0x3b38ad);})[_0x20ec('0x26')](function(_0x33eacb){_0x3f97fd[_0x20ec('0x45')]=_0x33eacb;return _0x3f97fd;})[_0x20ec('0x26')](respondWithFilteredResult(_0x7ba37b,_0x3b38ad))[_0x20ec('0x46')](handleError(_0x7ba37b,null));};exports['show']=function(_0xb6e39c,_0x19128b){var _0x459aa0={'raw':!![],'where':{'id':_0xb6e39c['params']['id']}},_0x394b39={};_0x394b39['model']=_[_0x20ec('0x33')](db[_0x20ec('0x2b')][_0x20ec('0x2c')]);_0x394b39[_0x20ec('0x32')]=_[_0x20ec('0x33')](_0xb6e39c[_0x20ec('0x32')]);_0x394b39[_0x20ec('0x34')]=_[_0x20ec('0x35')](_0x394b39[_0x20ec('0x30')],_0x394b39[_0x20ec('0x32')]);_0x459aa0[_0x20ec('0x36')]=_[_0x20ec('0x35')](_0x394b39['model'],qs['fields'](_0xb6e39c['query'][_0x20ec('0x37')]));_0x459aa0[_0x20ec('0x36')]=_0x459aa0[_0x20ec('0x36')]['length']?_0x459aa0[_0x20ec('0x36')]:_0x394b39[_0x20ec('0x30')];if(_0xb6e39c[_0x20ec('0x32')][_0x20ec('0x47')]){_0x459aa0['include']=[{'all':!![]}];}_0x459aa0=_[_0x20ec('0x41')]({},_0x459aa0,_0xb6e39c['options']);return db[_0x20ec('0x2b')]['find'](_0x459aa0)[_0x20ec('0x26')](handleEntityNotFound(_0x19128b,null))[_0x20ec('0x26')](respondWithResult(_0x19128b,null))[_0x20ec('0x46')](handleError(_0x19128b,null));};exports[_0x20ec('0x48')]=function(_0x2c5668,_0x17323b){return db[_0x20ec('0x2b')][_0x20ec('0x48')](_0x2c5668[_0x20ec('0x49')],{})[_0x20ec('0x26')](respondWithResult(_0x17323b,0xc9))[_0x20ec('0x46')](handleError(_0x17323b,null));};exports['update']=function(_0x3da00c,_0x24bc0f){if(_0x3da00c['body']['id']){delete _0x3da00c[_0x20ec('0x49')]['id'];}return db[_0x20ec('0x2b')]['find']({'where':{'id':_0x3da00c[_0x20ec('0x4a')]['id']}})[_0x20ec('0x26')](handleEntityNotFound(_0x24bc0f,null))[_0x20ec('0x26')](saveUpdates(_0x3da00c[_0x20ec('0x49')],null))[_0x20ec('0x26')](respondWithResult(_0x24bc0f,null))[_0x20ec('0x46')](handleError(_0x24bc0f,null));};exports[_0x20ec('0x4b')]=function(_0x4fcacb,_0x2557a4){return db[_0x20ec('0x2b')]['find']({'where':{'id':_0x4fcacb[_0x20ec('0x4a')]['id']}})[_0x20ec('0x26')](handleEntityNotFound(_0x2557a4,null))['then'](removeEntity(_0x2557a4,null))[_0x20ec('0x46')](handleError(_0x2557a4,null));};exports['describe']=function(_0x75f8c4,_0x1239cb){return db[_0x20ec('0x2b')][_0x20ec('0x4c')]()[_0x20ec('0x26')](respondWithResult(_0x1239cb,null))[_0x20ec('0x46')](handleError(_0x1239cb,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index d735a5d..52fa585 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 _0xe02c=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsTransferReport.attributes','exports','define','SmsTransferReport','report_sms_transfer','uniqueid','lodash'];(function(_0x296e73,_0x56d662){var _0xd7f53=function(_0x3f5151){while(--_0x3f5151){_0x296e73['push'](_0x296e73['shift']());}};_0xd7f53(++_0x56d662);}(_0xe02c,0x81));var _0xce02=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe02c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xce02('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xce02('0x1'));var BPromise=require(_0xce02('0x2'));var rp=require(_0xce02('0x3'));var fs=require('fs');var path=require(_0xce02('0x4'));var rimraf=require(_0xce02('0x5'));var config=require(_0xce02('0x6'));var attributes=require(_0xce02('0x7'));module[_0xce02('0x8')]=function(_0x4dfae3,_0x1cd6cd){return _0x4dfae3[_0xce02('0x9')](_0xce02('0xa'),attributes,{'tableName':_0xce02('0xb'),'paranoid':![],'indexes':[{'name':_0xce02('0xc'),'fields':[_0xce02('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd8ba=['SmsTransferReport','report_sms_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./smsTransferReport.attributes','exports','define'];(function(_0x5c0adf,_0x4f791a){var _0x326d00=function(_0x438487){while(--_0x438487){_0x5c0adf['push'](_0x5c0adf['shift']());}};_0x326d00(++_0x4f791a);}(_0xd8ba,0x12f));var _0xad8b=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xd8ba[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0xad8b('0x0'));var util=require(_0xad8b('0x1'));var logger=require(_0xad8b('0x2'))(_0xad8b('0x3'));var moment=require(_0xad8b('0x4'));var BPromise=require(_0xad8b('0x5'));var rp=require(_0xad8b('0x6'));var fs=require('fs');var path=require(_0xad8b('0x7'));var rimraf=require(_0xad8b('0x8'));var config=require('../../config/environment');var attributes=require(_0xad8b('0x9'));module[_0xad8b('0xa')]=function(_0x1632cf,_0xe4c3c1){return _0x1632cf[_0xad8b('0xb')](_0xad8b('0xc'),attributes,{'tableName':_0xad8b('0xd'),'paranoid':![],'indexes':[{'name':_0xad8b('0xe'),'fields':[_0xad8b('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 96d8b2d..1726a43 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 _0x56a4=['randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird'];(function(_0x2aab76,_0x520bdf){var _0xa1dff0=function(_0x5e80a6){while(--_0x5e80a6){_0x2aab76['push'](_0x2aab76['shift']());}};_0xa1dff0(++_0x520bdf);}(_0x56a4,0x11b));var _0x456a=function(_0x206fc3,_0x251f21){_0x206fc3=_0x206fc3-0x0;var _0xea0c75=_0x56a4[_0x206fc3];return _0xea0c75;};'use strict';var _=require(_0x456a('0x0'));var util=require(_0x456a('0x1'));var moment=require('moment');var BPromise=require(_0x456a('0x2'));var rs=require(_0x456a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x456a('0x4'));var logger=require(_0x456a('0x5'))(_0x456a('0x6'));var config=require(_0x456a('0x7'));var jayson=require(_0x456a('0x8'));var client=jayson['client'][_0x456a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x52b38d,_0x497df4,_0x2b6329){return new BPromise(function(_0x20c8e0,_0x37f1b4){return client['request'](_0x52b38d,_0x2b6329)[_0x456a('0xa')](function(_0x595c4b){logger[_0x456a('0xb')](_0x456a('0xc'),_0x497df4,_0x456a('0xd'));logger[_0x456a('0xe')](_0x456a('0xf'),_0x497df4,_0x456a('0xd'),JSON[_0x456a('0x10')](_0x595c4b));if(_0x595c4b[_0x456a('0x11')]){if(_0x595c4b[_0x456a('0x11')][_0x456a('0x12')]===0x1f4){logger[_0x456a('0x11')]('SmsTransferReport,\x20%s,\x20%s',_0x497df4,_0x595c4b[_0x456a('0x11')]['message']);return _0x37f1b4(_0x595c4b['error'][_0x456a('0x13')]);}logger[_0x456a('0x11')](_0x456a('0xc'),_0x497df4,_0x595c4b[_0x456a('0x11')]['message']);return _0x20c8e0(_0x595c4b[_0x456a('0x11')][_0x456a('0x13')]);}else{logger[_0x456a('0xb')](_0x456a('0xc'),_0x497df4,_0x456a('0xd'));_0x20c8e0(_0x595c4b[_0x456a('0x14')]['message']);}})[_0x456a('0x15')](function(_0x42f7d8){logger[_0x456a('0x11')](_0x456a('0xc'),_0x497df4,_0x42f7d8);_0x37f1b4(_0x42f7d8);});});} \ No newline at end of file +var _0x31af=['client','http','request','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x31af,0xde));var _0xf31a=function(_0xb4c17c,_0x2c12ba){_0xb4c17c=_0xb4c17c-0x0;var _0x3c343c=_0x31af[_0xb4c17c];return _0x3c343c;};'use strict';var _=require(_0xf31a('0x0'));var util=require(_0xf31a('0x1'));var moment=require(_0xf31a('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf31a('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf31a('0x4'));var logger=require(_0xf31a('0x5'))(_0xf31a('0x6'));var config=require(_0xf31a('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xf31a('0x8')][_0xf31a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x405926,_0x1dc7cc,_0x47b7a1){return new BPromise(function(_0x31f8e7,_0xe5778a){return client[_0xf31a('0xa')](_0x405926,_0x47b7a1)[_0xf31a('0xb')](function(_0x48cc46){logger[_0xf31a('0xc')](_0xf31a('0xd'),_0x1dc7cc,_0xf31a('0xe'));logger[_0xf31a('0xf')](_0xf31a('0x10'),_0x1dc7cc,'request\x20sent',JSON[_0xf31a('0x11')](_0x48cc46));if(_0x48cc46[_0xf31a('0x12')]){if(_0x48cc46[_0xf31a('0x12')][_0xf31a('0x13')]===0x1f4){logger['error'](_0xf31a('0xd'),_0x1dc7cc,_0x48cc46[_0xf31a('0x12')]['message']);return _0xe5778a(_0x48cc46[_0xf31a('0x12')][_0xf31a('0x14')]);}logger[_0xf31a('0x12')](_0xf31a('0xd'),_0x1dc7cc,_0x48cc46[_0xf31a('0x12')][_0xf31a('0x14')]);return _0x31f8e7(_0x48cc46[_0xf31a('0x12')][_0xf31a('0x14')]);}else{logger[_0xf31a('0xc')](_0xf31a('0xd'),_0x1dc7cc,_0xf31a('0xe'));_0x31f8e7(_0x48cc46[_0xf31a('0x15')][_0xf31a('0x14')]);}})[_0xf31a('0x16')](function(_0x1429c8){logger['error'](_0xf31a('0xd'),_0x1dc7cc,_0x1429c8);_0xe5778a(_0x1429c8);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 77418ad..568d7f0 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 _0xe6ca=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','get','isAuthenticated','/:id','show','download','diskStorage','join','server/files/sounds/original/','originalname','replace','format','%s-%s%s','basename','extname','post','single','file','create','put','update','exports','multer','path','connect-timeout'];(function(_0x53f0db,_0x35c67c){var _0xae0a5c=function(_0x4bd6fb){while(--_0x4bd6fb){_0x53f0db['push'](_0x53f0db['shift']());}};_0xae0a5c(++_0x35c67c);}(_0xe6ca,0x13c));var _0xae6c=function(_0x5e6eaa,_0x154146){_0x5e6eaa=_0x5e6eaa-0x0;var _0x48174e=_0xe6ca[_0x5e6eaa];return _0x48174e;};'use strict';var multer=require(_0xae6c('0x0'));var util=require('util');var path=require(_0xae6c('0x1'));var timeout=require(_0xae6c('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xae6c('0x3'));var auth=require(_0xae6c('0x4'));var interaction=require(_0xae6c('0x5'));var config=require(_0xae6c('0x6'));var controller=require(_0xae6c('0x7'));router[_0xae6c('0x8')]('/',auth[_0xae6c('0x9')](),controller['index']);router[_0xae6c('0x8')](_0xae6c('0xa'),auth['isAuthenticated'](),controller[_0xae6c('0xb')]);router[_0xae6c('0x8')]('/:id/download',auth[_0xae6c('0x9')](),controller[_0xae6c('0xc')]);var upload=multer({'storage':multer[_0xae6c('0xd')]({'destination':function(_0x370966,_0x2cee69,_0x26a9ec){_0x26a9ec(null,path[_0xae6c('0xe')](config['root'],_0xae6c('0xf')));},'filename':function(_0x2af0c0,_0xe9c2ff,_0x119b4f){_0xe9c2ff[_0xae6c('0x10')]=_0xe9c2ff['originalname'][_0xae6c('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x119b4f(null,util[_0xae6c('0x12')](_0xae6c('0x13'),path[_0xae6c('0x14')](_0xe9c2ff[_0xae6c('0x10')],path[_0xae6c('0x15')](_0xe9c2ff[_0xae6c('0x10')])),Date['now'](),path['extname'](_0xe9c2ff[_0xae6c('0x10')])));}})});router[_0xae6c('0x16')]('/',upload[_0xae6c('0x17')](_0xae6c('0x18')),controller[_0xae6c('0x19')]);router[_0xae6c('0x1a')](_0xae6c('0xa'),auth[_0xae6c('0x9')](),controller[_0xae6c('0x1b')]);router['delete'](_0xae6c('0xa'),auth[_0xae6c('0x9')](),controller['delete']);module[_0xae6c('0x1c')]=router; \ No newline at end of file +var _0xd444=['../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','get','/:id','isAuthenticated','show','download','diskStorage','join','root','server/files/sounds/original/','originalname','format','%s-%s%s','basename','now','extname','post','single','file','put','delete','multer','path','connect-timeout','Router'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0xd444,0x6c));var _0x4d44=function(_0x83af7f,_0x49c6fd){_0x83af7f=_0x83af7f-0x0;var _0x32d85c=_0xd444[_0x83af7f];return _0x32d85c;};'use strict';var multer=require(_0x4d44('0x0'));var util=require('util');var path=require(_0x4d44('0x1'));var timeout=require(_0x4d44('0x2'));var express=require('express');var router=express[_0x4d44('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x4d44('0x4'));var interaction=require(_0x4d44('0x5'));var config=require(_0x4d44('0x6'));var controller=require(_0x4d44('0x7'));router[_0x4d44('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x4d44('0x8')](_0x4d44('0x9'),auth[_0x4d44('0xa')](),controller[_0x4d44('0xb')]);router[_0x4d44('0x8')]('/:id/download',auth[_0x4d44('0xa')](),controller[_0x4d44('0xc')]);var upload=multer({'storage':multer[_0x4d44('0xd')]({'destination':function(_0x4f5371,_0x1eed18,_0x2bccd7){_0x2bccd7(null,path[_0x4d44('0xe')](config[_0x4d44('0xf')],_0x4d44('0x10')));},'filename':function(_0x5d78a0,_0x1fd104,_0x380263){_0x1fd104[_0x4d44('0x11')]=_0x1fd104[_0x4d44('0x11')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x380263(null,util[_0x4d44('0x12')](_0x4d44('0x13'),path[_0x4d44('0x14')](_0x1fd104[_0x4d44('0x11')],path['extname'](_0x1fd104[_0x4d44('0x11')])),Date[_0x4d44('0x15')](),path[_0x4d44('0x16')](_0x1fd104[_0x4d44('0x11')])));}})});router[_0x4d44('0x17')]('/',upload[_0x4d44('0x18')](_0x4d44('0x19')),controller['create']);router[_0x4d44('0x1a')](_0x4d44('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x4d44('0x1b')](_0x4d44('0x9'),auth[_0x4d44('0xa')](),controller[_0x4d44('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 20e5b9c..a67b710 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 _0x9da3=['name','FLOAT','BIGINT','INTEGER','sequelize','exports','STRING'];(function(_0x2d9da8,_0x545785){var _0x30670e=function(_0x3d19f0){while(--_0x3d19f0){_0x2d9da8['push'](_0x2d9da8['shift']());}};_0x30670e(++_0x545785);}(_0x9da3,0x1b6));var _0x39da=function(_0x26f7ff,_0x18ae86){_0x26f7ff=_0x26f7ff-0x0;var _0x495cab=_0x9da3[_0x26f7ff];return _0x495cab;};'use strict';var Sequelize=require(_0x39da('0x0'));module[_0x39da('0x1')]={'name':{'type':Sequelize[_0x39da('0x2')],'unique':_0x39da('0x3'),'allowNull':![]},'save_name':{'type':Sequelize[_0x39da('0x2')]},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize[_0x39da('0x2')]},'original_format':{'type':Sequelize[_0x39da('0x2')]},'original_duration':{'type':Sequelize[_0x39da('0x4')]},'original_sampleCount':{'type':Sequelize[_0x39da('0x5')]},'original_channelCount':{'type':Sequelize[_0x39da('0x6')]},'original_bitRate':{'type':Sequelize[_0x39da('0x5')]},'original_sampleRate':{'type':Sequelize[_0x39da('0x6')]},'converted_format':{'type':Sequelize[_0x39da('0x2')]},'converted_duration':{'type':Sequelize[_0x39da('0x4')]},'converted_sampleCount':{'type':Sequelize[_0x39da('0x5')]},'converted_channelCount':{'type':Sequelize[_0x39da('0x6')]},'converted_bitRate':{'type':Sequelize[_0x39da('0x5')]},'converted_sampleRate':{'type':Sequelize[_0x39da('0x6')]}}; \ No newline at end of file +var _0x299a=['BIGINT','INTEGER','sequelize','STRING','name','FLOAT'];(function(_0x26662c,_0x36b7e6){var _0x1f7040=function(_0x420912){while(--_0x420912){_0x26662c['push'](_0x26662c['shift']());}};_0x1f7040(++_0x36b7e6);}(_0x299a,0xb0));var _0xa299=function(_0x5c7b94,_0x761646){_0x5c7b94=_0x5c7b94-0x0;var _0x37edb3=_0x299a[_0x5c7b94];return _0x37edb3;};'use strict';var Sequelize=require(_0xa299('0x0'));module['exports']={'name':{'type':Sequelize[_0xa299('0x1')],'unique':_0xa299('0x2'),'allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize[_0xa299('0x1')],'defaultValue':''},'description':{'type':Sequelize[_0xa299('0x1')]},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize[_0xa299('0x3')]},'original_sampleCount':{'type':Sequelize[_0xa299('0x4')]},'original_channelCount':{'type':Sequelize[_0xa299('0x5')]},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize[_0xa299('0x5')]},'converted_format':{'type':Sequelize[_0xa299('0x1')]},'converted_duration':{'type':Sequelize[_0xa299('0x3')]},'converted_sampleCount':{'type':Sequelize[_0xa299('0x4')]},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize[_0xa299('0x4')]},'converted_sampleRate':{'type':Sequelize[_0xa299('0x5')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index ceca049..1de82db 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 _0x9417=['../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','limit','offset','count','set','apply','reject','save','update','then','get','Sounds','destroy','end','name','map','Sound','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','rawAttributes','download','find','save_name','converted_format','server/files/sounds/converted','ValidationError','Sound\x20not\x20found','root','format','%s.%s','create','basename','file','originalname','extname','filename','substring','server/files/sounds/original','join','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','wav','error','unlinkSync','send','original_duration','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','duration','converted_channelCount','converted_bitRate','converted_sampleRate','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','delete','rimraf','zip-dir','fast-json-patch','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x5b0540,_0xc6d8b3){var _0x131754=function(_0x3f6992){while(--_0x3f6992){_0x5b0540['push'](_0x5b0540['shift']());}};_0x131754(++_0xc6d8b3);}(_0x9417,0xe6));var _0x7941=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0x9417[_0x36ed48];return _0x51c63a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7941('0x0'));var zipdir=require(_0x7941('0x1'));var jsonpatch=require(_0x7941('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x7941('0x3'));var util=require(_0x7941('0x4'));var path=require(_0x7941('0x5'));var sox=require(_0x7941('0x6'));var csv=require(_0x7941('0x7'));var ejs=require(_0x7941('0x8'));var fs=require('fs');var fs_extra=require(_0x7941('0x9'));var _=require(_0x7941('0xa'));var squel=require(_0x7941('0xb'));var crypto=require(_0x7941('0xc'));var jsforce=require(_0x7941('0xd'));var deskjs=require(_0x7941('0xe'));var toCsv=require(_0x7941('0x7'));var querystring=require(_0x7941('0xf'));var Papa=require(_0x7941('0x10'));var Redis=require(_0x7941('0x11'));var authService=require(_0x7941('0x12'));var qs=require(_0x7941('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7941('0x14'))(_0x7941('0x15'));var utils=require(_0x7941('0x16'));var config=require(_0x7941('0x17'));var licenseUtil=require(_0x7941('0x18'));var db=require(_0x7941('0x19'))['db'];function respondWithStatusCode(_0x5060b0,_0x5b1ca2){_0x5b1ca2=_0x5b1ca2||0xcc;return function(_0x1bfe9d){if(_0x1bfe9d){return _0x5060b0['sendStatus'](_0x5b1ca2);}return _0x5060b0['status'](_0x5b1ca2)['end']();};}function respondWithResult(_0x1e17d2,_0x4c4b4d){_0x4c4b4d=_0x4c4b4d||0xc8;return function(_0x337b12){if(_0x337b12){return _0x1e17d2[_0x7941('0x1a')](_0x4c4b4d)[_0x7941('0x1b')](_0x337b12);}};}function respondWithFilteredResult(_0xdc9e44,_0x474538){return function(_0x18119f){if(_0x18119f){var _0x4d524d=typeof _0x474538['offset']===_0x7941('0x1c')&&typeof _0x474538[_0x7941('0x1d')]===_0x7941('0x1c');var _0xc35338=_0x18119f['count'];var _0x444460=_0x4d524d?0x0:_0x474538[_0x7941('0x1e')];var _0x85928e=_0x4d524d?_0x18119f[_0x7941('0x1f')]:_0x474538[_0x7941('0x1e')]+_0x474538[_0x7941('0x1d')];var _0x1bd9d8;if(_0x85928e>=_0xc35338){_0x85928e=_0xc35338;_0x1bd9d8=0xc8;}else{_0x1bd9d8=0xce;}_0xdc9e44[_0x7941('0x1a')](_0x1bd9d8);return _0xdc9e44[_0x7941('0x20')]('Content-Range',_0x444460+'-'+_0x85928e+'/'+_0xc35338)['json'](_0x18119f);}return null;};}function patchUpdates(_0x50bb89){return function(_0x56847){try{jsonpatch[_0x7941('0x21')](_0x56847,_0x50bb89,!![]);}catch(_0x13a19d){return BPromise[_0x7941('0x22')](_0x13a19d);}return _0x56847[_0x7941('0x23')]();};}function saveUpdates(_0x410ee3,_0x1d0efd){return function(_0xde75d4){if(_0xde75d4){return _0xde75d4[_0x7941('0x24')](_0x410ee3)[_0x7941('0x25')](function(_0x724c92){return _0x724c92;});}return null;};}function removeEntity(_0x365e8b,_0x4cb9ef){return function(_0xdaf685){if(_0xdaf685){return _0xdaf685['destroy']()[_0x7941('0x25')](function(){var _0x389c8e=_0xdaf685[_0x7941('0x26')]({'plain':!![]});var _0x55e279=_0x7941('0x27');return db['UserProfileResource'][_0x7941('0x28')]({'where':{'type':_0x55e279,'resourceId':_0x389c8e['id']}})[_0x7941('0x25')](function(){return _0xdaf685;});})[_0x7941('0x25')](function(){_0x365e8b[_0x7941('0x1a')](0xcc)[_0x7941('0x29')]();});}};}function handleEntityNotFound(_0x475adb,_0x375ade){return function(_0x4e0ae8){if(!_0x4e0ae8){_0x475adb['sendStatus'](0x194);}return _0x4e0ae8;};}function handleError(_0x3c2ae8,_0x20cbb6){_0x20cbb6=_0x20cbb6||0x1f4;return function(_0x31c69f){logger['error'](_0x31c69f['stack']);if(_0x31c69f[_0x7941('0x2a')]){delete _0x31c69f['name'];}_0x3c2ae8[_0x7941('0x1a')](_0x20cbb6)['send'](_0x31c69f);};}exports['index']=function(_0x32cea9,_0x490beb){var _0x184a57={},_0x50e2e1={},_0x58d91d={'count':0x0,'rows':[]};var _0x30a76c=_[_0x7941('0x2b')](db[_0x7941('0x2c')]['rawAttributes'],function(_0x47c64c){return{'name':_0x47c64c[_0x7941('0x2d')],'type':_0x47c64c[_0x7941('0x2e')][_0x7941('0x2f')]};});_0x50e2e1[_0x7941('0x30')]=_['map'](_0x30a76c,_0x7941('0x2a'));_0x50e2e1[_0x7941('0x31')]=_[_0x7941('0x32')](_0x32cea9[_0x7941('0x31')]);_0x50e2e1[_0x7941('0x33')]=_[_0x7941('0x34')](_0x50e2e1[_0x7941('0x30')],_0x50e2e1[_0x7941('0x31')]);_0x184a57[_0x7941('0x35')]=_['intersection'](_0x50e2e1[_0x7941('0x30')],qs[_0x7941('0x36')](_0x32cea9[_0x7941('0x31')][_0x7941('0x36')]));_0x184a57[_0x7941('0x35')]=_0x184a57[_0x7941('0x35')][_0x7941('0x37')]?_0x184a57[_0x7941('0x35')]:_0x50e2e1[_0x7941('0x30')];if(!_0x32cea9[_0x7941('0x31')][_0x7941('0x38')]('nolimit')){_0x184a57['limit']=qs[_0x7941('0x1d')](_0x32cea9[_0x7941('0x31')][_0x7941('0x1d')]);_0x184a57['offset']=qs[_0x7941('0x1e')](_0x32cea9[_0x7941('0x31')][_0x7941('0x1e')]);}_0x184a57[_0x7941('0x39')]=qs['sort'](_0x32cea9[_0x7941('0x31')][_0x7941('0x3a')]);_0x184a57['where']=qs['filters'](_[_0x7941('0x3b')](_0x32cea9['query'],_0x50e2e1['filters']),_0x30a76c);if(_0x32cea9[_0x7941('0x31')][_0x7941('0x3c')]){_0x184a57[_0x7941('0x3d')]=_[_0x7941('0x3e')](_0x184a57[_0x7941('0x3d')],{'$or':_['map'](_0x30a76c,function(_0x2eca15){if(_0x2eca15[_0x7941('0x2e')]!==_0x7941('0x3f')){var _0x26aacf={};_0x26aacf[_0x2eca15[_0x7941('0x2a')]]={'$like':'%'+_0x32cea9[_0x7941('0x31')][_0x7941('0x3c')]+'%'};return _0x26aacf;}})});}_0x184a57=_['merge']({},_0x184a57,_0x32cea9['options']);var _0x4852f1={'where':_0x184a57[_0x7941('0x3d')]};return db[_0x7941('0x2c')][_0x7941('0x1f')](_0x4852f1)[_0x7941('0x25')](function(_0x1cc51c){_0x58d91d['count']=_0x1cc51c;if(_0x32cea9['query'][_0x7941('0x40')]){_0x184a57[_0x7941('0x41')]=[{'all':!![]}];}return db[_0x7941('0x2c')][_0x7941('0x42')](_0x184a57);})[_0x7941('0x25')](function(_0x4ce718){_0x58d91d[_0x7941('0x43')]=_0x4ce718;return _0x58d91d;})['then'](respondWithFilteredResult(_0x490beb,_0x184a57))[_0x7941('0x44')](handleError(_0x490beb,null));};exports[_0x7941('0x45')]=function(_0x12aba8,_0x1925e6){var _0x57264a={'raw':!![],'where':{'id':_0x12aba8[_0x7941('0x46')]['id']}},_0x4283d5={};_0x4283d5[_0x7941('0x30')]=_[_0x7941('0x32')](db[_0x7941('0x2c')][_0x7941('0x47')]);_0x4283d5['query']=_['keys'](_0x12aba8[_0x7941('0x31')]);_0x4283d5[_0x7941('0x33')]=_[_0x7941('0x34')](_0x4283d5['model'],_0x4283d5['query']);_0x57264a['attributes']=_[_0x7941('0x34')](_0x4283d5[_0x7941('0x30')],qs[_0x7941('0x36')](_0x12aba8['query'][_0x7941('0x36')]));_0x57264a['attributes']=_0x57264a[_0x7941('0x35')][_0x7941('0x37')]?_0x57264a['attributes']:_0x4283d5[_0x7941('0x30')];if(_0x12aba8[_0x7941('0x31')][_0x7941('0x40')]){_0x57264a[_0x7941('0x41')]=[{'all':!![]}];}_0x57264a=_['merge']({},_0x57264a,_0x12aba8['options']);return db[_0x7941('0x2c')]['find'](_0x57264a)[_0x7941('0x25')](handleEntityNotFound(_0x1925e6,null))['then'](respondWithResult(_0x1925e6,null))['catch'](handleError(_0x1925e6,null));};exports[_0x7941('0x48')]=function(_0x2eb252,_0x41cce9,_0x2a0fe8){return db[_0x7941('0x2c')][_0x7941('0x49')]({'where':{'id':_0x2eb252[_0x7941('0x46')]['id']},'attributes':[_0x7941('0x2a'),_0x7941('0x4a'),_0x7941('0x4b')],'raw':!![]})['then'](handleEntityNotFound(_0x41cce9,null))['then'](function(_0x57f6f8){if(_0x57f6f8){if(!fs['existsSync'](path['join'](config['root'],_0x7941('0x4c'),_0x57f6f8['save_name']+'.'+_0x57f6f8[_0x7941('0x4b')]))){throw new db['Sequelize'][(_0x7941('0x4d'))](_0x7941('0x4e'));}return _0x41cce9['download'](path['join'](config[_0x7941('0x4f')],_0x7941('0x4c'),util[_0x7941('0x50')](_0x7941('0x51'),_0x57f6f8[_0x7941('0x4a')],_0x57f6f8[_0x7941('0x4b')])),util['format'](_0x7941('0x51'),_0x57f6f8['name'],_0x57f6f8[_0x7941('0x4b')]));}return null;})[_0x7941('0x44')](handleError(_0x41cce9,null));};exports[_0x7941('0x52')]=function(_0xc39eb3,_0x26b26e,_0x34b7d2){var _0x1facbc={'name':path[_0x7941('0x53')](_0xc39eb3[_0x7941('0x54')][_0x7941('0x55')],path[_0x7941('0x56')](_0xc39eb3[_0x7941('0x54')][_0x7941('0x55')])),'save_name':path[_0x7941('0x53')](_0xc39eb3['file'][_0x7941('0x57')],path[_0x7941('0x56')](_0xc39eb3[_0x7941('0x54')][_0x7941('0x57')])),'original_format':path[_0x7941('0x56')](_0xc39eb3[_0x7941('0x54')][_0x7941('0x55')])[_0x7941('0x58')](0x1),'converted_format':'wav'};var _0x2da1b1=path['join'](config[_0x7941('0x4f')],_0x7941('0x59'),_0xc39eb3[_0x7941('0x54')][_0x7941('0x57')]);var _0x4308a4=path[_0x7941('0x5a')](config[_0x7941('0x4f')],_0x7941('0x4c'),util[_0x7941('0x50')](_0x7941('0x51'),path[_0x7941('0x53')](_0xc39eb3[_0x7941('0x54')]['filename'],path[_0x7941('0x56')](_0xc39eb3[_0x7941('0x54')]['filename'])),_0x1facbc[_0x7941('0x4b')]));logger[_0x7941('0x5b')](_0x7941('0x5c'),_0x2da1b1);logger['info'](_0x7941('0x5d'),_0x4308a4);try{fs[_0x7941('0x5e')](_0x2da1b1,parseInt(_0x7941('0x5f'),0x8));var _0x5c1f2f=sox[_0x7941('0x60')](_0x2da1b1,_0x4308a4,{'sampleRate':0x1f40,'format':_0x7941('0x61'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x5c1f2f['on'](_0x7941('0x62'),function(_0x3b047b){fs[_0x7941('0x63')](_0x2da1b1);_0x26b26e['status'](0x1f4)[_0x7941('0x64')](_0x3b047b);});_0x5c1f2f['on']('src',function(_0x3fa897){_0x1facbc[_0x7941('0x65')]=isNaN(_0x3fa897['duration'])?null:_0x3fa897['duration']*0x3e8;_0x1facbc['original_sampleCount']=isNaN(_0x3fa897[_0x7941('0x66')])?null:_0x3fa897[_0x7941('0x66')];_0x1facbc[_0x7941('0x67')]=isNaN(_0x3fa897[_0x7941('0x68')])?null:_0x3fa897['channelCount'];_0x1facbc[_0x7941('0x69')]=isNaN(_0x3fa897[_0x7941('0x6a')])?null:_0x3fa897['bitRate'];_0x1facbc[_0x7941('0x6b')]=isNaN(_0x3fa897[_0x7941('0x6c')])?null:_0x3fa897[_0x7941('0x6c')];});_0x5c1f2f['on'](_0x7941('0x6d'),function(_0x28456e){_0x1facbc[_0x7941('0x6e')]=isNaN(_0x28456e[_0x7941('0x6f')])?null:_0x28456e[_0x7941('0x6f')]*0x3e8;_0x1facbc['converted_sampleCount']=isNaN(_0x28456e[_0x7941('0x66')])?null:_0x28456e['sampleCount'];_0x1facbc[_0x7941('0x70')]=isNaN(_0x28456e[_0x7941('0x68')])?null:_0x28456e[_0x7941('0x68')];_0x1facbc[_0x7941('0x71')]=isNaN(_0x28456e[_0x7941('0x6a')])?null:_0x28456e[_0x7941('0x6a')];_0x1facbc[_0x7941('0x72')]=isNaN(_0x28456e['sampleRate'])?null:_0x28456e[_0x7941('0x6c')];});_0x5c1f2f['on'](_0x7941('0x29'),function(){fs[_0x7941('0x5e')](_0x4308a4,parseInt(_0x7941('0x5f'),0x8));return db[_0x7941('0x2c')][_0x7941('0x52')](_0x1facbc)[_0x7941('0x25')](function(_0xbc26f4){var _0x274d01={'role':_0xc39eb3[_0x7941('0x73')]['role'],'userProfileId':_0xc39eb3['body']['userProfileId']};if(!_0x274d01)throw new Error(_0x7941('0x74'));if(_0x274d01[_0x7941('0x75')]===_0x7941('0x76')){var _0x19ca3c=_0xbc26f4[_0x7941('0x26')]({'plain':!![]});return db[_0x7941('0x77')][_0x7941('0x49')]({'where':{'name':_0x7941('0x27'),'userProfileId':_0x274d01['userProfileId']},'raw':!![]})[_0x7941('0x25')](function(_0x132e40){if(_0x132e40&&_0x132e40['autoAssociation']===0x0){return db[_0x7941('0x78')][_0x7941('0x52')]({'name':_0x19ca3c[_0x7941('0x2a')],'resourceId':_0x19ca3c['id'],'type':_0x132e40['name'],'sectionId':_0x132e40['id']},{})[_0x7941('0x25')](function(){return _0xbc26f4;});}else{return _0xbc26f4;}})[_0x7941('0x44')](function(_0x225ba9){logger[_0x7941('0x62')](_0x7941('0x79'),_0x225ba9);throw _0x225ba9;});}return _0xbc26f4;})['then'](respondWithResult(_0x26b26e,null))[_0x7941('0x44')](handleError(_0x26b26e,null));});_0x5c1f2f[_0x7941('0x7a')]();}catch(_0x14b55b){_0x26b26e[_0x7941('0x1a')](0x1f4)[_0x7941('0x64')](_0x14b55b);}};exports[_0x7941('0x24')]=function(_0x5dffb8,_0x15138e,_0x1f8267){return db[_0x7941('0x2c')][_0x7941('0x49')]({'where':{'id':_0x5dffb8[_0x7941('0x46')]['id']}})[_0x7941('0x25')](handleEntityNotFound(_0x15138e,null))[_0x7941('0x25')](saveUpdates(_[_0x7941('0x3b')](_0x5dffb8[_0x7941('0x73')],['name','description']),null))['then'](respondWithResult(_0x15138e,null))[_0x7941('0x44')](handleError(_0x15138e,null));};exports[_0x7941('0x7b')]=function(_0x19238a,_0x3a20bf,_0xe05003){return db['Sound'][_0x7941('0x49')]({'where':{'id':_0x19238a['params']['id']}})[_0x7941('0x25')](function(_0x4f2e33){if(_0x4f2e33){return _0x4f2e33[_0x7941('0x28')]();}})['then'](function(_0x8d5279){var _0x26631e=path[_0x7941('0x5a')](config[_0x7941('0x4f')],_0x7941('0x59'),util['format'](_0x7941('0x51'),_0x8d5279[_0x7941('0x4a')],_0x8d5279['original_format']));var _0x38fd07=path['join'](config[_0x7941('0x4f')],_0x7941('0x4c'),util[_0x7941('0x50')](_0x7941('0x51'),_0x8d5279[_0x7941('0x4a')],_0x8d5279[_0x7941('0x4b')]));fs['unlinkSync'](_0x26631e);fs['unlinkSync'](_0x38fd07);return _0x8d5279;})[_0x7941('0x25')](function(_0x5af809){if(_0x5af809){return _0x3a20bf['status'](0xcc)[_0x7941('0x29')]();}})[_0x7941('0x25')](handleEntityNotFound(_0x3a20bf,null))[_0x7941('0x44')](handleError(_0x3a20bf,null));}; \ No newline at end of file +var _0x8024=['include','options','find','download','params','save_name','converted_format','join','root','server/files/sounds/converted','Sequelize','ValidationError','Sound\x20not\x20found','format','%s.%s','create','originalname','extname','basename','filename','file','server/files/sounds/original','Sound\x20upload\x20filepath:\x20%s','info','Sound\x20upload\x20destination:\x20%s','transcode','wav','src','duration','original_sampleCount','sampleCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','chmodSync','0777','role','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','Sounds','userProfileId','autoAssociation','update','description','delete','original_format','unlinkSync','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','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','end','json','offset','undefined','count','limit','status','Content-Range','apply','save','then','destroy','UserProfileResource','error','stack','name','send','index','map','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','Sound','includeAll','findAll','rows','catch','show','rawAttributes','keys'];(function(_0xe8d963,_0x2a4ec0){var _0x1965d1=function(_0x44e87e){while(--_0x44e87e){_0xe8d963['push'](_0xe8d963['shift']());}};_0x1965d1(++_0x2a4ec0);}(_0x8024,0xb2));var _0x4802=function(_0x3d1d42,_0x28accd){_0x3d1d42=_0x3d1d42-0x0;var _0x3e9e29=_0x8024[_0x3d1d42];return _0x3e9e29;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4802('0x0'));var zipdir=require(_0x4802('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4802('0x2'));var moment=require('moment');var BPromise=require(_0x4802('0x3'));var Mustache=require(_0x4802('0x4'));var util=require(_0x4802('0x5'));var path=require(_0x4802('0x6'));var sox=require(_0x4802('0x7'));var csv=require(_0x4802('0x8'));var ejs=require(_0x4802('0x9'));var fs=require('fs');var fs_extra=require(_0x4802('0xa'));var _=require(_0x4802('0xb'));var squel=require(_0x4802('0xc'));var crypto=require('crypto');var jsforce=require(_0x4802('0xd'));var deskjs=require(_0x4802('0xe'));var toCsv=require('to-csv');var querystring=require(_0x4802('0xf'));var Papa=require(_0x4802('0x10'));var Redis=require('ioredis');var authService=require(_0x4802('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x4802('0x12'));var hardwareService=require(_0x4802('0x13'));var logger=require(_0x4802('0x14'))(_0x4802('0x15'));var utils=require(_0x4802('0x16'));var config=require(_0x4802('0x17'));var licenseUtil=require(_0x4802('0x18'));var db=require(_0x4802('0x19'))['db'];function respondWithStatusCode(_0x2accff,_0x13ff18){_0x13ff18=_0x13ff18||0xcc;return function(_0xf029b8){if(_0xf029b8){return _0x2accff[_0x4802('0x1a')](_0x13ff18);}return _0x2accff['status'](_0x13ff18)[_0x4802('0x1b')]();};}function respondWithResult(_0x58fbaa,_0x2288cd){_0x2288cd=_0x2288cd||0xc8;return function(_0x4f7a19){if(_0x4f7a19){return _0x58fbaa['status'](_0x2288cd)[_0x4802('0x1c')](_0x4f7a19);}};}function respondWithFilteredResult(_0x4d086f,_0x24b9a6){return function(_0x1a6e92){if(_0x1a6e92){var _0x3a24f=typeof _0x24b9a6[_0x4802('0x1d')]==='undefined'&&typeof _0x24b9a6['limit']===_0x4802('0x1e');var _0x38d5b4=_0x1a6e92[_0x4802('0x1f')];var _0x22639d=_0x3a24f?0x0:_0x24b9a6[_0x4802('0x1d')];var _0x33e151=_0x3a24f?_0x1a6e92[_0x4802('0x1f')]:_0x24b9a6['offset']+_0x24b9a6[_0x4802('0x20')];var _0x96cc74;if(_0x33e151>=_0x38d5b4){_0x33e151=_0x38d5b4;_0x96cc74=0xc8;}else{_0x96cc74=0xce;}_0x4d086f[_0x4802('0x21')](_0x96cc74);return _0x4d086f['set'](_0x4802('0x22'),_0x22639d+'-'+_0x33e151+'/'+_0x38d5b4)[_0x4802('0x1c')](_0x1a6e92);}return null;};}function patchUpdates(_0x2e523c){return function(_0x427b73){try{jsonpatch[_0x4802('0x23')](_0x427b73,_0x2e523c,!![]);}catch(_0x4f0438){return BPromise['reject'](_0x4f0438);}return _0x427b73[_0x4802('0x24')]();};}function saveUpdates(_0x5c3261,_0x226ed5){return function(_0x542cb6){if(_0x542cb6){return _0x542cb6['update'](_0x5c3261)[_0x4802('0x25')](function(_0x44515a){return _0x44515a;});}return null;};}function removeEntity(_0x2c2fd8,_0x390608){return function(_0x21850b){if(_0x21850b){return _0x21850b[_0x4802('0x26')]()[_0x4802('0x25')](function(){var _0x108e7c=_0x21850b['get']({'plain':!![]});var _0x22eccb='Sounds';return db[_0x4802('0x27')][_0x4802('0x26')]({'where':{'type':_0x22eccb,'resourceId':_0x108e7c['id']}})[_0x4802('0x25')](function(){return _0x21850b;});})[_0x4802('0x25')](function(){_0x2c2fd8['status'](0xcc)[_0x4802('0x1b')]();});}};}function handleEntityNotFound(_0x454b1a,_0x515330){return function(_0x125173){if(!_0x125173){_0x454b1a[_0x4802('0x1a')](0x194);}return _0x125173;};}function handleError(_0x5714dc,_0x3d506a){_0x3d506a=_0x3d506a||0x1f4;return function(_0x675b53){logger[_0x4802('0x28')](_0x675b53[_0x4802('0x29')]);if(_0x675b53['name']){delete _0x675b53[_0x4802('0x2a')];}_0x5714dc[_0x4802('0x21')](_0x3d506a)[_0x4802('0x2b')](_0x675b53);};}exports[_0x4802('0x2c')]=function(_0x26b7fe,_0x1cabbd){var _0x4147c9={},_0x740c82={},_0x5546a6={'count':0x0,'rows':[]};var _0x29229e=_[_0x4802('0x2d')](db['Sound']['rawAttributes'],function(_0x14c399){return{'name':_0x14c399[_0x4802('0x2e')],'type':_0x14c399[_0x4802('0x2f')][_0x4802('0x30')]};});_0x740c82[_0x4802('0x31')]=_[_0x4802('0x2d')](_0x29229e,_0x4802('0x2a'));_0x740c82[_0x4802('0x32')]=_['keys'](_0x26b7fe['query']);_0x740c82[_0x4802('0x33')]=_[_0x4802('0x34')](_0x740c82[_0x4802('0x31')],_0x740c82[_0x4802('0x32')]);_0x4147c9[_0x4802('0x35')]=_[_0x4802('0x34')](_0x740c82[_0x4802('0x31')],qs[_0x4802('0x36')](_0x26b7fe[_0x4802('0x32')]['fields']));_0x4147c9['attributes']=_0x4147c9['attributes'][_0x4802('0x37')]?_0x4147c9[_0x4802('0x35')]:_0x740c82[_0x4802('0x31')];if(!_0x26b7fe[_0x4802('0x32')][_0x4802('0x38')](_0x4802('0x39'))){_0x4147c9[_0x4802('0x20')]=qs[_0x4802('0x20')](_0x26b7fe[_0x4802('0x32')][_0x4802('0x20')]);_0x4147c9['offset']=qs[_0x4802('0x1d')](_0x26b7fe[_0x4802('0x32')][_0x4802('0x1d')]);}_0x4147c9[_0x4802('0x3a')]=qs[_0x4802('0x3b')](_0x26b7fe[_0x4802('0x32')]['sort']);_0x4147c9[_0x4802('0x3c')]=qs['filters'](_['pick'](_0x26b7fe[_0x4802('0x32')],_0x740c82[_0x4802('0x33')]),_0x29229e);if(_0x26b7fe['query'][_0x4802('0x3d')]){_0x4147c9[_0x4802('0x3c')]=_[_0x4802('0x3e')](_0x4147c9[_0x4802('0x3c')],{'$or':_[_0x4802('0x2d')](_0x29229e,function(_0x2cf719){if(_0x2cf719[_0x4802('0x2f')]!==_0x4802('0x3f')){var _0xcdd866={};_0xcdd866[_0x2cf719[_0x4802('0x2a')]]={'$like':'%'+_0x26b7fe[_0x4802('0x32')][_0x4802('0x3d')]+'%'};return _0xcdd866;}})});}_0x4147c9=_[_0x4802('0x3e')]({},_0x4147c9,_0x26b7fe['options']);var _0x42a33c={'where':_0x4147c9[_0x4802('0x3c')]};return db[_0x4802('0x40')][_0x4802('0x1f')](_0x42a33c)[_0x4802('0x25')](function(_0x46d128){_0x5546a6['count']=_0x46d128;if(_0x26b7fe[_0x4802('0x32')][_0x4802('0x41')]){_0x4147c9['include']=[{'all':!![]}];}return db[_0x4802('0x40')][_0x4802('0x42')](_0x4147c9);})[_0x4802('0x25')](function(_0x58ed2){_0x5546a6[_0x4802('0x43')]=_0x58ed2;return _0x5546a6;})[_0x4802('0x25')](respondWithFilteredResult(_0x1cabbd,_0x4147c9))[_0x4802('0x44')](handleError(_0x1cabbd,null));};exports[_0x4802('0x45')]=function(_0x2a84ba,_0x17d05d){var _0x5a1140={'raw':!![],'where':{'id':_0x2a84ba['params']['id']}},_0x33d371={};_0x33d371[_0x4802('0x31')]=_['keys'](db[_0x4802('0x40')][_0x4802('0x46')]);_0x33d371[_0x4802('0x32')]=_[_0x4802('0x47')](_0x2a84ba[_0x4802('0x32')]);_0x33d371[_0x4802('0x33')]=_[_0x4802('0x34')](_0x33d371[_0x4802('0x31')],_0x33d371[_0x4802('0x32')]);_0x5a1140[_0x4802('0x35')]=_['intersection'](_0x33d371['model'],qs[_0x4802('0x36')](_0x2a84ba['query'][_0x4802('0x36')]));_0x5a1140[_0x4802('0x35')]=_0x5a1140[_0x4802('0x35')][_0x4802('0x37')]?_0x5a1140[_0x4802('0x35')]:_0x33d371['model'];if(_0x2a84ba[_0x4802('0x32')][_0x4802('0x41')]){_0x5a1140[_0x4802('0x48')]=[{'all':!![]}];}_0x5a1140=_[_0x4802('0x3e')]({},_0x5a1140,_0x2a84ba[_0x4802('0x49')]);return db['Sound'][_0x4802('0x4a')](_0x5a1140)[_0x4802('0x25')](handleEntityNotFound(_0x17d05d,null))[_0x4802('0x25')](respondWithResult(_0x17d05d,null))[_0x4802('0x44')](handleError(_0x17d05d,null));};exports[_0x4802('0x4b')]=function(_0x50f3a7,_0x233f14,_0x1d7b63){return db[_0x4802('0x40')][_0x4802('0x4a')]({'where':{'id':_0x50f3a7[_0x4802('0x4c')]['id']},'attributes':[_0x4802('0x2a'),_0x4802('0x4d'),_0x4802('0x4e')],'raw':!![]})[_0x4802('0x25')](handleEntityNotFound(_0x233f14,null))['then'](function(_0x297112){if(_0x297112){if(!fs['existsSync'](path[_0x4802('0x4f')](config[_0x4802('0x50')],_0x4802('0x51'),_0x297112['save_name']+'.'+_0x297112[_0x4802('0x4e')]))){throw new db[(_0x4802('0x52'))][(_0x4802('0x53'))](_0x4802('0x54'));}return _0x233f14[_0x4802('0x4b')](path[_0x4802('0x4f')](config[_0x4802('0x50')],_0x4802('0x51'),util[_0x4802('0x55')](_0x4802('0x56'),_0x297112[_0x4802('0x4d')],_0x297112['converted_format'])),util[_0x4802('0x55')](_0x4802('0x56'),_0x297112[_0x4802('0x2a')],_0x297112[_0x4802('0x4e')]));}return null;})[_0x4802('0x44')](handleError(_0x233f14,null));};exports[_0x4802('0x57')]=function(_0x52656a,_0x488fdf,_0x23295e){var _0x291a8e={'name':path['basename'](_0x52656a['file'][_0x4802('0x58')],path[_0x4802('0x59')](_0x52656a['file'][_0x4802('0x58')])),'save_name':path[_0x4802('0x5a')](_0x52656a['file'][_0x4802('0x5b')],path[_0x4802('0x59')](_0x52656a[_0x4802('0x5c')]['filename'])),'original_format':path[_0x4802('0x59')](_0x52656a['file'][_0x4802('0x58')])['substring'](0x1),'converted_format':'wav'};var _0x34acc1=path[_0x4802('0x4f')](config[_0x4802('0x50')],_0x4802('0x5d'),_0x52656a['file'][_0x4802('0x5b')]);var _0x7412ab=path[_0x4802('0x4f')](config[_0x4802('0x50')],_0x4802('0x51'),util[_0x4802('0x55')](_0x4802('0x56'),path[_0x4802('0x5a')](_0x52656a[_0x4802('0x5c')]['filename'],path[_0x4802('0x59')](_0x52656a[_0x4802('0x5c')]['filename'])),_0x291a8e['converted_format']));logger['info'](_0x4802('0x5e'),_0x34acc1);logger[_0x4802('0x5f')](_0x4802('0x60'),_0x7412ab);try{fs['chmodSync'](_0x34acc1,parseInt('0777',0x8));var _0x58a82f=sox[_0x4802('0x61')](_0x34acc1,_0x7412ab,{'sampleRate':0x1f40,'format':_0x4802('0x62'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x58a82f['on']('error',function(_0x4610d5){fs['unlinkSync'](_0x34acc1);_0x488fdf[_0x4802('0x21')](0x1f4)[_0x4802('0x2b')](_0x4610d5);});_0x58a82f['on'](_0x4802('0x63'),function(_0x3cc43b){_0x291a8e['original_duration']=isNaN(_0x3cc43b[_0x4802('0x64')])?null:_0x3cc43b[_0x4802('0x64')]*0x3e8;_0x291a8e[_0x4802('0x65')]=isNaN(_0x3cc43b['sampleCount'])?null:_0x3cc43b[_0x4802('0x66')];_0x291a8e['original_channelCount']=isNaN(_0x3cc43b[_0x4802('0x67')])?null:_0x3cc43b[_0x4802('0x67')];_0x291a8e[_0x4802('0x68')]=isNaN(_0x3cc43b[_0x4802('0x69')])?null:_0x3cc43b[_0x4802('0x69')];_0x291a8e[_0x4802('0x6a')]=isNaN(_0x3cc43b[_0x4802('0x6b')])?null:_0x3cc43b[_0x4802('0x6b')];});_0x58a82f['on'](_0x4802('0x6c'),function(_0xa3a17f){_0x291a8e[_0x4802('0x6d')]=isNaN(_0xa3a17f[_0x4802('0x64')])?null:_0xa3a17f[_0x4802('0x64')]*0x3e8;_0x291a8e[_0x4802('0x6e')]=isNaN(_0xa3a17f[_0x4802('0x66')])?null:_0xa3a17f[_0x4802('0x66')];_0x291a8e[_0x4802('0x6f')]=isNaN(_0xa3a17f[_0x4802('0x67')])?null:_0xa3a17f[_0x4802('0x67')];_0x291a8e['converted_bitRate']=isNaN(_0xa3a17f['bitRate'])?null:_0xa3a17f[_0x4802('0x69')];_0x291a8e['converted_sampleRate']=isNaN(_0xa3a17f['sampleRate'])?null:_0xa3a17f[_0x4802('0x6b')];});_0x58a82f['on']('end',function(){fs[_0x4802('0x70')](_0x7412ab,parseInt(_0x4802('0x71'),0x8));return db[_0x4802('0x40')]['create'](_0x291a8e)[_0x4802('0x25')](function(_0x42387f){var _0xb925e7={'role':_0x52656a['body'][_0x4802('0x72')],'userProfileId':_0x52656a[_0x4802('0x73')]['userProfileId']};if(!_0xb925e7)throw new Error(_0x4802('0x74'));if(_0xb925e7[_0x4802('0x72')]==='user'){var _0x43ed88=_0x42387f['get']({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0x4802('0x75'),'userProfileId':_0xb925e7[_0x4802('0x76')]},'raw':!![]})['then'](function(_0x4addb9){if(_0x4addb9&&_0x4addb9[_0x4802('0x77')]===0x0){return db['UserProfileResource'][_0x4802('0x57')]({'name':_0x43ed88['name'],'resourceId':_0x43ed88['id'],'type':_0x4addb9[_0x4802('0x2a')],'sectionId':_0x4addb9['id']},{})[_0x4802('0x25')](function(){return _0x42387f;});}else{return _0x42387f;}})[_0x4802('0x44')](function(_0x2c767a){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2c767a);throw _0x2c767a;});}return _0x42387f;})['then'](respondWithResult(_0x488fdf,null))[_0x4802('0x44')](handleError(_0x488fdf,null));});_0x58a82f['start']();}catch(_0x468417){_0x488fdf[_0x4802('0x21')](0x1f4)['send'](_0x468417);}};exports[_0x4802('0x78')]=function(_0x24383d,_0x57ef9a,_0x22c0b3){return db['Sound'][_0x4802('0x4a')]({'where':{'id':_0x24383d['params']['id']}})[_0x4802('0x25')](handleEntityNotFound(_0x57ef9a,null))[_0x4802('0x25')](saveUpdates(_['pick'](_0x24383d[_0x4802('0x73')],[_0x4802('0x2a'),_0x4802('0x79')]),null))[_0x4802('0x25')](respondWithResult(_0x57ef9a,null))[_0x4802('0x44')](handleError(_0x57ef9a,null));};exports[_0x4802('0x7a')]=function(_0x46fdc2,_0x1f3e75,_0x1cb6a9){return db['Sound'][_0x4802('0x4a')]({'where':{'id':_0x46fdc2[_0x4802('0x4c')]['id']}})['then'](function(_0x1c48fb){if(_0x1c48fb){return _0x1c48fb[_0x4802('0x26')]();}})[_0x4802('0x25')](function(_0x272c98){var _0x3e2b32=path[_0x4802('0x4f')](config[_0x4802('0x50')],_0x4802('0x5d'),util[_0x4802('0x55')]('%s.%s',_0x272c98['save_name'],_0x272c98[_0x4802('0x7b')]));var _0x2012d0=path['join'](config[_0x4802('0x50')],_0x4802('0x51'),util[_0x4802('0x55')](_0x4802('0x56'),_0x272c98[_0x4802('0x4d')],_0x272c98[_0x4802('0x4e')]));fs[_0x4802('0x7c')](_0x3e2b32);fs[_0x4802('0x7c')](_0x2012d0);return _0x272c98;})[_0x4802('0x25')](function(_0x103475){if(_0x103475){return _0x1f3e75[_0x4802('0x21')](0xcc)[_0x4802('0x1b')]();}})['then'](handleEntityNotFound(_0x1f3e75,null))[_0x4802('0x44')](handleError(_0x1f3e75,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 65bfdd2..e6d6b94 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 _0x9be9=['Sound','api','moment','bluebird','request-promise','path','rimraf','./sound.attributes','exports','define'];(function(_0x5afdc4,_0x3be94e){var _0x41cf71=function(_0x25eb22){while(--_0x25eb22){_0x5afdc4['push'](_0x5afdc4['shift']());}};_0x41cf71(++_0x3be94e);}(_0x9be9,0xf1));var _0x99be=function(_0x525117,_0x25d139){_0x525117=_0x525117-0x0;var _0x2997f0=_0x9be9[_0x525117];return _0x2997f0;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x99be('0x0'));var moment=require(_0x99be('0x1'));var BPromise=require(_0x99be('0x2'));var rp=require(_0x99be('0x3'));var fs=require('fs');var path=require(_0x99be('0x4'));var rimraf=require(_0x99be('0x5'));var config=require('../../config/environment');var attributes=require(_0x99be('0x6'));module[_0x99be('0x7')]=function(_0x7f7418,_0x150b3f){return _0x7f7418[_0x99be('0x8')](_0x99be('0x9'),attributes,{'tableName':'tools_sounds','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xecd7=['moment','bluebird','request-promise','path','../../config/environment','./sound.attributes','define','Sound','tools_sounds','util','../../config/logger'];(function(_0x3e0184,_0x52a4fb){var _0xcc1067=function(_0x2e3735){while(--_0x2e3735){_0x3e0184['push'](_0x3e0184['shift']());}};_0xcc1067(++_0x52a4fb);}(_0xecd7,0xf0));var _0x7ecd=function(_0x5c7403,_0x4bf9f0){_0x5c7403=_0x5c7403-0x0;var _0x101e87=_0xecd7[_0x5c7403];return _0x101e87;};'use strict';var _=require('lodash');var util=require(_0x7ecd('0x0'));var logger=require(_0x7ecd('0x1'))('api');var moment=require(_0x7ecd('0x2'));var BPromise=require(_0x7ecd('0x3'));var rp=require(_0x7ecd('0x4'));var fs=require('fs');var path=require(_0x7ecd('0x5'));var rimraf=require('rimraf');var config=require(_0x7ecd('0x6'));var attributes=require(_0x7ecd('0x7'));module['exports']=function(_0x1d39c7,_0x7bec9d){return _0x1d39c7[_0x7ecd('0x8')](_0x7ecd('0x9'),attributes,{'tableName':_0x7ecd('0xa'),'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 0c098a0..7676629 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 _0x5a33=['stringify','error','code','message','result','Sound','find','options','raw','attributes','include','map','model','ShowSound','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Sound,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x11e30d,_0x5584aa){var _0x2d4e29=function(_0x2486ce){while(--_0x2486ce){_0x11e30d['push'](_0x11e30d['shift']());}};_0x2d4e29(++_0x5584aa);}(_0x5a33,0x1b3));var _0x35a3=function(_0x1e48e7,_0xf3114b){_0x1e48e7=_0x1e48e7-0x0;var _0x3712d4=_0x5a33[_0x1e48e7];return _0x3712d4;};'use strict';var _=require(_0x35a3('0x0'));var util=require(_0x35a3('0x1'));var moment=require(_0x35a3('0x2'));var BPromise=require(_0x35a3('0x3'));var rs=require(_0x35a3('0x4'));var fs=require('fs');var Redis=require(_0x35a3('0x5'));var db=require(_0x35a3('0x6'))['db'];var utils=require(_0x35a3('0x7'));var logger=require(_0x35a3('0x8'))(_0x35a3('0x9'));var config=require(_0x35a3('0xa'));var jayson=require(_0x35a3('0xb'));var client=jayson[_0x35a3('0xc')][_0x35a3('0xd')]({'port':0x232a});function respondWithRpcPromise(_0xb4d32,_0x59d953,_0x17bc05){return new BPromise(function(_0x499482,_0x8d2385){return client[_0x35a3('0xe')](_0xb4d32,_0x17bc05)[_0x35a3('0xf')](function(_0x4c13a0){logger[_0x35a3('0x10')](_0x35a3('0x11'),_0x59d953,_0x35a3('0x12'));logger[_0x35a3('0x13')]('Sound,\x20%s,\x20%s,\x20%s',_0x59d953,'request\x20sent',JSON[_0x35a3('0x14')](_0x4c13a0));if(_0x4c13a0[_0x35a3('0x15')]){if(_0x4c13a0['error'][_0x35a3('0x16')]===0x1f4){logger[_0x35a3('0x15')]('Sound,\x20%s,\x20%s',_0x59d953,_0x4c13a0[_0x35a3('0x15')][_0x35a3('0x17')]);return _0x8d2385(_0x4c13a0[_0x35a3('0x15')][_0x35a3('0x17')]);}logger[_0x35a3('0x15')](_0x35a3('0x11'),_0x59d953,_0x4c13a0[_0x35a3('0x15')][_0x35a3('0x17')]);return _0x499482(_0x4c13a0[_0x35a3('0x15')][_0x35a3('0x17')]);}else{logger[_0x35a3('0x10')](_0x35a3('0x11'),_0x59d953,_0x35a3('0x12'));_0x499482(_0x4c13a0[_0x35a3('0x18')][_0x35a3('0x17')]);}})['catch'](function(_0xe7baa6){logger['error'](_0x35a3('0x11'),_0x59d953,_0xe7baa6);_0x8d2385(_0xe7baa6);});});}exports['ShowSound']=function(_0x2b7975){var _0x826089=this;return new Promise(function(_0x5352fb,_0xf30e97){return db[_0x35a3('0x19')][_0x35a3('0x1a')]({'raw':_0x2b7975['options']?_0x2b7975[_0x35a3('0x1b')][_0x35a3('0x1c')]===undefined?!![]:![]:!![],'where':_0x2b7975[_0x35a3('0x1b')]?_0x2b7975[_0x35a3('0x1b')]['where']||null:null,'attributes':_0x2b7975[_0x35a3('0x1b')]?_0x2b7975[_0x35a3('0x1b')][_0x35a3('0x1d')]||null:null,'include':_0x2b7975[_0x35a3('0x1b')]?_0x2b7975[_0x35a3('0x1b')][_0x35a3('0x1e')]?_[_0x35a3('0x1f')](_0x2b7975[_0x35a3('0x1b')][_0x35a3('0x1e')],function(_0x5c0ce5){return{'model':db[_0x5c0ce5[_0x35a3('0x20')]],'as':_0x5c0ce5['as'],'attributes':_0x5c0ce5['attributes'],'include':_0x5c0ce5[_0x35a3('0x1e')]?_[_0x35a3('0x1f')](_0x5c0ce5[_0x35a3('0x1e')],function(_0x312530){return{'model':db[_0x312530[_0x35a3('0x20')]],'as':_0x312530['as'],'attributes':_0x312530[_0x35a3('0x1d')],'include':_0x312530[_0x35a3('0x1e')]?_[_0x35a3('0x1f')](_0x312530[_0x35a3('0x1e')],function(_0x769a49){return{'model':db[_0x769a49[_0x35a3('0x20')]],'as':_0x769a49['as'],'attributes':_0x769a49[_0x35a3('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x35a3('0xf')](function(_0xac9b1e){logger['info'](_0x35a3('0x21'),_0x2b7975);logger[_0x35a3('0x13')](_0x35a3('0x21'),_0x2b7975,JSON[_0x35a3('0x14')](_0xac9b1e));_0x5352fb(_0xac9b1e);})[_0x35a3('0x22')](function(_0x4bccd8){logger[_0x35a3('0x15')](_0x35a3('0x21'),_0x4bccd8['message'],_0x2b7975);_0xf30e97(_0x826089[_0x35a3('0x15')](0x1f4,_0x4bccd8[_0x35a3('0x17')]));});});}; \ No newline at end of file +var _0x9746=['request\x20sent','result','catch','ShowSound','Sound','find','options','raw','attributes','include','map','model','stringify','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','Sound,\x20%s,\x20%s','debug','Sound,\x20%s,\x20%s,\x20%s','error','code','message','info'];(function(_0x309643,_0x45fc34){var _0x2a6f10=function(_0x485986){while(--_0x485986){_0x309643['push'](_0x309643['shift']());}};_0x2a6f10(++_0x45fc34);}(_0x9746,0x1db));var _0x6974=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0x9746[_0x55e08b];return _0xd1a7ff;};'use strict';var _=require(_0x6974('0x0'));var util=require(_0x6974('0x1'));var moment=require(_0x6974('0x2'));var BPromise=require(_0x6974('0x3'));var rs=require(_0x6974('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6974('0x5'))['db'];var utils=require(_0x6974('0x6'));var logger=require('../../config/logger')(_0x6974('0x7'));var config=require(_0x6974('0x8'));var jayson=require(_0x6974('0x9'));var client=jayson[_0x6974('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x506d55,_0x59c6e5,_0x964f46){return new BPromise(function(_0x39cf58,_0x19206e){return client[_0x6974('0xb')](_0x506d55,_0x964f46)[_0x6974('0xc')](function(_0x1db7ae){logger['info'](_0x6974('0xd'),_0x59c6e5,'request\x20sent');logger[_0x6974('0xe')](_0x6974('0xf'),_0x59c6e5,'request\x20sent',JSON['stringify'](_0x1db7ae));if(_0x1db7ae[_0x6974('0x10')]){if(_0x1db7ae[_0x6974('0x10')][_0x6974('0x11')]===0x1f4){logger[_0x6974('0x10')]('Sound,\x20%s,\x20%s',_0x59c6e5,_0x1db7ae[_0x6974('0x10')]['message']);return _0x19206e(_0x1db7ae[_0x6974('0x10')][_0x6974('0x12')]);}logger[_0x6974('0x10')](_0x6974('0xd'),_0x59c6e5,_0x1db7ae[_0x6974('0x10')]['message']);return _0x39cf58(_0x1db7ae[_0x6974('0x10')][_0x6974('0x12')]);}else{logger[_0x6974('0x13')](_0x6974('0xd'),_0x59c6e5,_0x6974('0x14'));_0x39cf58(_0x1db7ae[_0x6974('0x15')][_0x6974('0x12')]);}})[_0x6974('0x16')](function(_0xe6944){logger[_0x6974('0x10')]('Sound,\x20%s,\x20%s',_0x59c6e5,_0xe6944);_0x19206e(_0xe6944);});});}exports[_0x6974('0x17')]=function(_0x3fe092){var _0x18c8cb=this;return new Promise(function(_0x675787,_0x11e7dd){return db[_0x6974('0x18')][_0x6974('0x19')]({'raw':_0x3fe092[_0x6974('0x1a')]?_0x3fe092[_0x6974('0x1a')][_0x6974('0x1b')]===undefined?!![]:![]:!![],'where':_0x3fe092[_0x6974('0x1a')]?_0x3fe092[_0x6974('0x1a')]['where']||null:null,'attributes':_0x3fe092[_0x6974('0x1a')]?_0x3fe092[_0x6974('0x1a')][_0x6974('0x1c')]||null:null,'include':_0x3fe092[_0x6974('0x1a')]?_0x3fe092[_0x6974('0x1a')][_0x6974('0x1d')]?_[_0x6974('0x1e')](_0x3fe092[_0x6974('0x1a')][_0x6974('0x1d')],function(_0x4c2ad1){return{'model':db[_0x4c2ad1['model']],'as':_0x4c2ad1['as'],'attributes':_0x4c2ad1[_0x6974('0x1c')],'include':_0x4c2ad1[_0x6974('0x1d')]?_[_0x6974('0x1e')](_0x4c2ad1[_0x6974('0x1d')],function(_0x5ec9bd){return{'model':db[_0x5ec9bd[_0x6974('0x1f')]],'as':_0x5ec9bd['as'],'attributes':_0x5ec9bd[_0x6974('0x1c')],'include':_0x5ec9bd[_0x6974('0x1d')]?_['map'](_0x5ec9bd[_0x6974('0x1d')],function(_0xa3a271){return{'model':db[_0xa3a271[_0x6974('0x1f')]],'as':_0xa3a271['as'],'attributes':_0xa3a271[_0x6974('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x6974('0xc')](function(_0x174ee3){logger[_0x6974('0x13')]('ShowSound',_0x3fe092);logger[_0x6974('0xe')](_0x6974('0x17'),_0x3fe092,JSON[_0x6974('0x20')](_0x174ee3));_0x675787(_0x174ee3);})[_0x6974('0x16')](function(_0x305c27){logger[_0x6974('0x10')](_0x6974('0x17'),_0x305c27[_0x6974('0x12')],_0x3fe092);_0x11e7dd(_0x18c8cb[_0x6974('0x10')](0x1f4,_0x305c27['message']));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 5c290cc..79f83c6 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 _0xb10b=['./squareMessage.controller','get','index','isAuthenticated','show','post','create','put','/:id','destroy','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0xc8ea89,_0x41819d){var _0x36fbe5=function(_0xe335ca){while(--_0xe335ca){_0xc8ea89['push'](_0xc8ea89['shift']());}};_0x36fbe5(++_0x41819d);}(_0xb10b,0x12a));var _0xbb10=function(_0x25bb4c,_0x1a0b53){_0x25bb4c=_0x25bb4c-0x0;var _0x4c78b2=_0xb10b[_0x25bb4c];return _0x4c78b2;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0xd')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['update']);router['delete'](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);module['exports']=router; \ No newline at end of file +var _0xda3f=['../../config/environment','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','util','path','fs-extra','../../components/interaction/service'];(function(_0x374f59,_0x5c2098){var _0x408ead=function(_0x3e6b54){while(--_0x3e6b54){_0x374f59['push'](_0x374f59['shift']());}};_0x408ead(++_0x5c2098);}(_0xda3f,0xec));var _0xfda3=function(_0x941437,_0x1de3f0){_0x941437=_0x941437-0x0;var _0x3b85de=_0xda3f[_0x941437];return _0x3b85de;};'use strict';var multer=require('multer');var util=require(_0xfda3('0x0'));var path=require(_0xfda3('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xfda3('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xfda3('0x3'));var config=require(_0xfda3('0x4'));var controller=require('./squareMessage.controller');router[_0xfda3('0x5')]('/',auth[_0xfda3('0x6')](),controller['index']);router['get'](_0xfda3('0x7'),auth[_0xfda3('0x6')](),controller[_0xfda3('0x8')]);router[_0xfda3('0x9')]('/',auth[_0xfda3('0x6')](),controller[_0xfda3('0xa')]);router[_0xfda3('0xb')](_0xfda3('0x7'),auth[_0xfda3('0x6')](),controller[_0xfda3('0xc')]);router[_0xfda3('0xd')](_0xfda3('0x7'),auth['isAuthenticated'](),controller[_0xfda3('0xe')]);module[_0xfda3('0xf')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index a5bf04f..2b6df15 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 _0xe70b=['out','sequelize','exports','STRING','TEXT','medium'];(function(_0x27621f,_0x371da3){var _0x3938eb=function(_0x28a75f){while(--_0x28a75f){_0x27621f['push'](_0x27621f['shift']());}};_0x3938eb(++_0x371da3);}(_0xe70b,0x67));var _0xbe70=function(_0x47fcd3,_0x56bab3){_0x47fcd3=_0x47fcd3-0x0;var _0x863076=_0xe70b[_0x47fcd3];return _0x863076;};'use strict';var Sequelize=require(_0xbe70('0x0'));module[_0xbe70('0x1')]={'uniqueid':{'type':Sequelize[_0xbe70('0x2')]},'body':{'type':Sequelize[_0xbe70('0x3')](_0xbe70('0x4')),'allowNull':![]},'direction':{'type':Sequelize['ENUM']('in',_0xbe70('0x5')),'defaultValue':_0xbe70('0x5'),'allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xbe70('0x3')]}}; \ No newline at end of file +var _0x749e=['ENUM','out','exports','STRING'];(function(_0xbe31d1,_0x126345){var _0x7bd03=function(_0xbcacac){while(--_0xbcacac){_0xbe31d1['push'](_0xbe31d1['shift']());}};_0x7bd03(++_0x126345);}(_0x749e,0x192));var _0xe749=function(_0x46c25e,_0x3d84fa){_0x46c25e=_0x46c25e-0x0;var _0x4d1bcf=_0x749e[_0x46c25e];return _0x4d1bcf;};'use strict';var Sequelize=require('sequelize');module[_0xe749('0x0')]={'uniqueid':{'type':Sequelize[_0xe749('0x1')]},'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'direction':{'type':Sequelize[_0xe749('0x2')]('in','out'),'defaultValue':_0xe749('0x3'),'allowNull':![]},'providerName':{'type':Sequelize[_0xe749('0x1')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index bb75cb2..0629ad1 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 _0x16a8=['destroy','stack','name','send','index','SquareMessage','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','nolimit','where','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','update','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','then'];(function(_0x462df2,_0x31503d){var _0x19a513=function(_0x2bf8d3){while(--_0x2bf8d3){_0x462df2['push'](_0x462df2['shift']());}};_0x19a513(++_0x31503d);}(_0x16a8,0xb4));var _0x816a=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x16a8[_0x618414];return _0x21c19a;};'use strict';var emlformat=require(_0x816a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x816a('0x1'));var jsonpatch=require(_0x816a('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x816a('0x3'));var Mustache=require(_0x816a('0x4'));var util=require(_0x816a('0x5'));var path=require(_0x816a('0x6'));var sox=require(_0x816a('0x7'));var csv=require(_0x816a('0x8'));var ejs=require(_0x816a('0x9'));var fs=require('fs');var fs_extra=require(_0x816a('0xa'));var _=require(_0x816a('0xb'));var squel=require('squel');var crypto=require(_0x816a('0xc'));var jsforce=require(_0x816a('0xd'));var deskjs=require(_0x816a('0xe'));var toCsv=require(_0x816a('0x8'));var querystring=require(_0x816a('0xf'));var Papa=require(_0x816a('0x10'));var Redis=require(_0x816a('0x11'));var authService=require(_0x816a('0x12'));var qs=require(_0x816a('0x13'));var as=require(_0x816a('0x14'));var hardwareService=require(_0x816a('0x15'));var logger=require('../../config/logger')(_0x816a('0x16'));var utils=require(_0x816a('0x17'));var config=require(_0x816a('0x18'));var licenseUtil=require(_0x816a('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4d4427,_0x454929){_0x454929=_0x454929||0xcc;return function(_0x3057f8){if(_0x3057f8){return _0x4d4427[_0x816a('0x1a')](_0x454929);}return _0x4d4427[_0x816a('0x1b')](_0x454929)[_0x816a('0x1c')]();};}function respondWithResult(_0x3e3829,_0x2ac2ea){_0x2ac2ea=_0x2ac2ea||0xc8;return function(_0x4a7a11){if(_0x4a7a11){return _0x3e3829['status'](_0x2ac2ea)[_0x816a('0x1d')](_0x4a7a11);}};}function respondWithFilteredResult(_0x4e9d5e,_0x3ce19d){return function(_0x3d668a){if(_0x3d668a){var _0x106d28=typeof _0x3ce19d['offset']===_0x816a('0x1e')&&typeof _0x3ce19d[_0x816a('0x1f')]===_0x816a('0x1e');var _0x5ef835=_0x3d668a[_0x816a('0x20')];var _0x543ee8=_0x106d28?0x0:_0x3ce19d[_0x816a('0x21')];var _0x511ed8=_0x106d28?_0x3d668a[_0x816a('0x20')]:_0x3ce19d[_0x816a('0x21')]+_0x3ce19d['limit'];var _0x3c8b09;if(_0x511ed8>=_0x5ef835){_0x511ed8=_0x5ef835;_0x3c8b09=0xc8;}else{_0x3c8b09=0xce;}_0x4e9d5e['status'](_0x3c8b09);return _0x4e9d5e[_0x816a('0x22')](_0x816a('0x23'),_0x543ee8+'-'+_0x511ed8+'/'+_0x5ef835)[_0x816a('0x1d')](_0x3d668a);}return null;};}function patchUpdates(_0x339be6){return function(_0x123abd){try{jsonpatch[_0x816a('0x24')](_0x123abd,_0x339be6,!![]);}catch(_0x2f5ec0){return BPromise[_0x816a('0x25')](_0x2f5ec0);}return _0x123abd['save']();};}function saveUpdates(_0xd5051f,_0xf5fddc){return function(_0x440c76){if(_0x440c76){return _0x440c76['update'](_0xd5051f)[_0x816a('0x26')](function(_0xb053ab){return _0xb053ab;});}return null;};}function removeEntity(_0x5ac945,_0x4108bf){return function(_0x1dd0b8){if(_0x1dd0b8){return _0x1dd0b8[_0x816a('0x27')]()['then'](function(){_0x5ac945['status'](0xcc)[_0x816a('0x1c')]();});}};}function handleEntityNotFound(_0x58898f,_0x377229){return function(_0x31bea4){if(!_0x31bea4){_0x58898f[_0x816a('0x1a')](0x194);}return _0x31bea4;};}function handleError(_0x4cf4f4,_0x46eaa6){_0x46eaa6=_0x46eaa6||0x1f4;return function(_0x1bf75d){logger['error'](_0x1bf75d[_0x816a('0x28')]);if(_0x1bf75d[_0x816a('0x29')]){delete _0x1bf75d['name'];}_0x4cf4f4[_0x816a('0x1b')](_0x46eaa6)[_0x816a('0x2a')](_0x1bf75d);};}exports[_0x816a('0x2b')]=function(_0x42832e,_0x2323fd){var _0x392541={},_0x4e89a9={},_0x339295={'count':0x0,'rows':[]};var _0x2c489c=_['map'](db[_0x816a('0x2c')][_0x816a('0x2d')],function(_0x561ade){return{'name':_0x561ade[_0x816a('0x2e')],'type':_0x561ade[_0x816a('0x2f')][_0x816a('0x30')]};});_0x4e89a9[_0x816a('0x31')]=_[_0x816a('0x32')](_0x2c489c,_0x816a('0x29'));_0x4e89a9[_0x816a('0x33')]=_[_0x816a('0x34')](_0x42832e[_0x816a('0x33')]);_0x4e89a9[_0x816a('0x35')]=_[_0x816a('0x36')](_0x4e89a9[_0x816a('0x31')],_0x4e89a9[_0x816a('0x33')]);_0x392541[_0x816a('0x37')]=_[_0x816a('0x36')](_0x4e89a9[_0x816a('0x31')],qs[_0x816a('0x38')](_0x42832e['query'][_0x816a('0x38')]));_0x392541[_0x816a('0x37')]=_0x392541[_0x816a('0x37')]['length']?_0x392541[_0x816a('0x37')]:_0x4e89a9[_0x816a('0x31')];if(!_0x42832e[_0x816a('0x33')]['hasOwnProperty'](_0x816a('0x39'))){_0x392541['limit']=qs[_0x816a('0x1f')](_0x42832e[_0x816a('0x33')][_0x816a('0x1f')]);_0x392541['offset']=qs['offset'](_0x42832e['query'][_0x816a('0x21')]);}_0x392541['order']=qs['sort'](_0x42832e['query']['sort']);_0x392541[_0x816a('0x3a')]=qs['filters'](_['pick'](_0x42832e[_0x816a('0x33')],_0x4e89a9[_0x816a('0x35')]),_0x2c489c);if(_0x42832e[_0x816a('0x33')][_0x816a('0x3b')]){_0x392541[_0x816a('0x3a')]=_[_0x816a('0x3c')](_0x392541['where'],{'$or':_[_0x816a('0x32')](_0x2c489c,function(_0x527b5f){if(_0x527b5f[_0x816a('0x2f')]!=='VIRTUAL'){var _0x4f4dcd={};_0x4f4dcd[_0x527b5f[_0x816a('0x29')]]={'$like':'%'+_0x42832e['query']['filter']+'%'};return _0x4f4dcd;}})});}_0x392541=_[_0x816a('0x3c')]({},_0x392541,_0x42832e[_0x816a('0x3d')]);var _0x5c60a9={'where':_0x392541[_0x816a('0x3a')]};return db[_0x816a('0x2c')][_0x816a('0x20')](_0x5c60a9)[_0x816a('0x26')](function(_0x20227f){_0x339295['count']=_0x20227f;if(_0x42832e['query'][_0x816a('0x3e')]){_0x392541[_0x816a('0x3f')]=[{'all':!![]}];}return db['SquareMessage'][_0x816a('0x40')](_0x392541);})[_0x816a('0x26')](function(_0x48b15f){_0x339295[_0x816a('0x41')]=_0x48b15f;return _0x339295;})[_0x816a('0x26')](respondWithFilteredResult(_0x2323fd,_0x392541))[_0x816a('0x42')](handleError(_0x2323fd,null));};exports[_0x816a('0x43')]=function(_0x16e74c,_0x27877a){var _0xa1838={'raw':!![],'where':{'id':_0x16e74c[_0x816a('0x44')]['id']}},_0x2e2eb7={};_0x2e2eb7[_0x816a('0x31')]=_['keys'](db['SquareMessage'][_0x816a('0x2d')]);_0x2e2eb7[_0x816a('0x33')]=_['keys'](_0x16e74c[_0x816a('0x33')]);_0x2e2eb7[_0x816a('0x35')]=_[_0x816a('0x36')](_0x2e2eb7['model'],_0x2e2eb7[_0x816a('0x33')]);_0xa1838[_0x816a('0x37')]=_['intersection'](_0x2e2eb7[_0x816a('0x31')],qs[_0x816a('0x38')](_0x16e74c[_0x816a('0x33')][_0x816a('0x38')]));_0xa1838[_0x816a('0x37')]=_0xa1838[_0x816a('0x37')]['length']?_0xa1838['attributes']:_0x2e2eb7[_0x816a('0x31')];if(_0x16e74c[_0x816a('0x33')]['includeAll']){_0xa1838[_0x816a('0x3f')]=[{'all':!![]}];}_0xa1838=_[_0x816a('0x3c')]({},_0xa1838,_0x16e74c['options']);return db[_0x816a('0x2c')][_0x816a('0x45')](_0xa1838)['then'](handleEntityNotFound(_0x27877a,null))['then'](respondWithResult(_0x27877a,null))[_0x816a('0x42')](handleError(_0x27877a,null));};exports[_0x816a('0x46')]=function(_0x5b8768,_0x3cfb98){return db[_0x816a('0x2c')]['create'](_0x5b8768[_0x816a('0x47')],{})[_0x816a('0x26')](respondWithResult(_0x3cfb98,0xc9))[_0x816a('0x42')](handleError(_0x3cfb98,null));};exports[_0x816a('0x48')]=function(_0xc35abb,_0x59bbd0){if(_0xc35abb['body']['id']){delete _0xc35abb[_0x816a('0x47')]['id'];}return db[_0x816a('0x2c')][_0x816a('0x45')]({'where':{'id':_0xc35abb['params']['id']}})[_0x816a('0x26')](handleEntityNotFound(_0x59bbd0,null))['then'](saveUpdates(_0xc35abb['body'],null))[_0x816a('0x26')](respondWithResult(_0x59bbd0,null))[_0x816a('0x42')](handleError(_0x59bbd0,null));};exports[_0x816a('0x27')]=function(_0xc5f7c2,_0x325549){return db[_0x816a('0x2c')][_0x816a('0x45')]({'where':{'id':_0xc5f7c2['params']['id']}})[_0x816a('0x26')](handleEntityNotFound(_0x325549,null))[_0x816a('0x26')](removeEntity(_0x325549,null))[_0x816a('0x42')](handleError(_0x325549,null));}; \ No newline at end of file +var _0x2ebd=['eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','../../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','undefined','count','offset','limit','set','json','apply','reject','update','then','destroy','error','stack','name','send','index','SquareMessage','rawAttributes','type','model','map','query','keys','filters','intersection','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','fields','find','create','body'];(function(_0x2a880e,_0x44beb7){var _0x45e0ce=function(_0x10cbc2){while(--_0x10cbc2){_0x2a880e['push'](_0x2a880e['shift']());}};_0x45e0ce(++_0x44beb7);}(_0x2ebd,0x1c8));var _0xd2eb=function(_0x51db4c,_0x3b58bc){_0x51db4c=_0x51db4c-0x0;var _0x5b8a76=_0x2ebd[_0x51db4c];return _0x5b8a76;};'use strict';var emlformat=require(_0xd2eb('0x0'));var rimraf=require(_0xd2eb('0x1'));var zipdir=require(_0xd2eb('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xd2eb('0x3'));var BPromise=require(_0xd2eb('0x4'));var Mustache=require(_0xd2eb('0x5'));var util=require(_0xd2eb('0x6'));var path=require(_0xd2eb('0x7'));var sox=require(_0xd2eb('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd2eb('0x9'));var _=require(_0xd2eb('0xa'));var squel=require(_0xd2eb('0xb'));var crypto=require(_0xd2eb('0xc'));var jsforce=require(_0xd2eb('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xd2eb('0xe'));var querystring=require(_0xd2eb('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xd2eb('0x10'));var qs=require(_0xd2eb('0x11'));var as=require(_0xd2eb('0x12'));var hardwareService=require(_0xd2eb('0x13'));var logger=require(_0xd2eb('0x14'))(_0xd2eb('0x15'));var utils=require(_0xd2eb('0x16'));var config=require(_0xd2eb('0x17'));var licenseUtil=require(_0xd2eb('0x18'));var db=require(_0xd2eb('0x19'))['db'];function respondWithStatusCode(_0x3f694e,_0x2af8b6){_0x2af8b6=_0x2af8b6||0xcc;return function(_0x47f354){if(_0x47f354){return _0x3f694e[_0xd2eb('0x1a')](_0x2af8b6);}return _0x3f694e['status'](_0x2af8b6)[_0xd2eb('0x1b')]();};}function respondWithResult(_0x7c192a,_0x503cd1){_0x503cd1=_0x503cd1||0xc8;return function(_0xd4024){if(_0xd4024){return _0x7c192a[_0xd2eb('0x1c')](_0x503cd1)['json'](_0xd4024);}};}function respondWithFilteredResult(_0xa4f6c4,_0xa042c9){return function(_0x216f82){if(_0x216f82){var _0x4bf46e=typeof _0xa042c9['offset']===_0xd2eb('0x1d')&&typeof _0xa042c9['limit']==='undefined';var _0x8555b=_0x216f82[_0xd2eb('0x1e')];var _0x561e13=_0x4bf46e?0x0:_0xa042c9[_0xd2eb('0x1f')];var _0x2b3a76=_0x4bf46e?_0x216f82[_0xd2eb('0x1e')]:_0xa042c9[_0xd2eb('0x1f')]+_0xa042c9[_0xd2eb('0x20')];var _0x154349;if(_0x2b3a76>=_0x8555b){_0x2b3a76=_0x8555b;_0x154349=0xc8;}else{_0x154349=0xce;}_0xa4f6c4[_0xd2eb('0x1c')](_0x154349);return _0xa4f6c4[_0xd2eb('0x21')]('Content-Range',_0x561e13+'-'+_0x2b3a76+'/'+_0x8555b)[_0xd2eb('0x22')](_0x216f82);}return null;};}function patchUpdates(_0x4d57ee){return function(_0x328a07){try{jsonpatch[_0xd2eb('0x23')](_0x328a07,_0x4d57ee,!![]);}catch(_0x2a9a90){return BPromise[_0xd2eb('0x24')](_0x2a9a90);}return _0x328a07['save']();};}function saveUpdates(_0x27c797,_0x442eb4){return function(_0x47bc42){if(_0x47bc42){return _0x47bc42[_0xd2eb('0x25')](_0x27c797)[_0xd2eb('0x26')](function(_0x3bacd7){return _0x3bacd7;});}return null;};}function removeEntity(_0x2a9967,_0x2bc69a){return function(_0x27a3b4){if(_0x27a3b4){return _0x27a3b4[_0xd2eb('0x27')]()[_0xd2eb('0x26')](function(){_0x2a9967['status'](0xcc)[_0xd2eb('0x1b')]();});}};}function handleEntityNotFound(_0x443842,_0x22329f){return function(_0x3e6eb1){if(!_0x3e6eb1){_0x443842[_0xd2eb('0x1a')](0x194);}return _0x3e6eb1;};}function handleError(_0x221406,_0xe72bbb){_0xe72bbb=_0xe72bbb||0x1f4;return function(_0x2f0fd1){logger[_0xd2eb('0x28')](_0x2f0fd1[_0xd2eb('0x29')]);if(_0x2f0fd1[_0xd2eb('0x2a')]){delete _0x2f0fd1[_0xd2eb('0x2a')];}_0x221406[_0xd2eb('0x1c')](_0xe72bbb)[_0xd2eb('0x2b')](_0x2f0fd1);};}exports[_0xd2eb('0x2c')]=function(_0x39ee3d,_0x448973){var _0x6996b={},_0x6998b1={},_0x39ed9d={'count':0x0,'rows':[]};var _0x20d8dd=_['map'](db[_0xd2eb('0x2d')][_0xd2eb('0x2e')],function(_0x41030b){return{'name':_0x41030b['fieldName'],'type':_0x41030b[_0xd2eb('0x2f')]['key']};});_0x6998b1[_0xd2eb('0x30')]=_[_0xd2eb('0x31')](_0x20d8dd,'name');_0x6998b1[_0xd2eb('0x32')]=_[_0xd2eb('0x33')](_0x39ee3d[_0xd2eb('0x32')]);_0x6998b1[_0xd2eb('0x34')]=_[_0xd2eb('0x35')](_0x6998b1[_0xd2eb('0x30')],_0x6998b1['query']);_0x6996b['attributes']=_[_0xd2eb('0x35')](_0x6998b1['model'],qs['fields'](_0x39ee3d[_0xd2eb('0x32')]['fields']));_0x6996b[_0xd2eb('0x36')]=_0x6996b['attributes'][_0xd2eb('0x37')]?_0x6996b[_0xd2eb('0x36')]:_0x6998b1['model'];if(!_0x39ee3d['query'][_0xd2eb('0x38')]('nolimit')){_0x6996b[_0xd2eb('0x20')]=qs[_0xd2eb('0x20')](_0x39ee3d[_0xd2eb('0x32')]['limit']);_0x6996b['offset']=qs[_0xd2eb('0x1f')](_0x39ee3d['query'][_0xd2eb('0x1f')]);}_0x6996b[_0xd2eb('0x39')]=qs[_0xd2eb('0x3a')](_0x39ee3d[_0xd2eb('0x32')]['sort']);_0x6996b[_0xd2eb('0x3b')]=qs['filters'](_[_0xd2eb('0x3c')](_0x39ee3d['query'],_0x6998b1[_0xd2eb('0x34')]),_0x20d8dd);if(_0x39ee3d[_0xd2eb('0x32')][_0xd2eb('0x3d')]){_0x6996b[_0xd2eb('0x3b')]=_[_0xd2eb('0x3e')](_0x6996b[_0xd2eb('0x3b')],{'$or':_[_0xd2eb('0x31')](_0x20d8dd,function(_0x15da99){if(_0x15da99[_0xd2eb('0x2f')]!==_0xd2eb('0x3f')){var _0x5cc289={};_0x5cc289[_0x15da99[_0xd2eb('0x2a')]]={'$like':'%'+_0x39ee3d[_0xd2eb('0x32')]['filter']+'%'};return _0x5cc289;}})});}_0x6996b=_[_0xd2eb('0x3e')]({},_0x6996b,_0x39ee3d[_0xd2eb('0x40')]);var _0x326a5e={'where':_0x6996b[_0xd2eb('0x3b')]};return db['SquareMessage'][_0xd2eb('0x1e')](_0x326a5e)['then'](function(_0x49b97a){_0x39ed9d[_0xd2eb('0x1e')]=_0x49b97a;if(_0x39ee3d['query'][_0xd2eb('0x41')]){_0x6996b[_0xd2eb('0x42')]=[{'all':!![]}];}return db[_0xd2eb('0x2d')][_0xd2eb('0x43')](_0x6996b);})[_0xd2eb('0x26')](function(_0x5d4314){_0x39ed9d[_0xd2eb('0x44')]=_0x5d4314;return _0x39ed9d;})[_0xd2eb('0x26')](respondWithFilteredResult(_0x448973,_0x6996b))[_0xd2eb('0x45')](handleError(_0x448973,null));};exports[_0xd2eb('0x46')]=function(_0x31698c,_0x4ec8b3){var _0x2f45eb={'raw':!![],'where':{'id':_0x31698c[_0xd2eb('0x47')]['id']}},_0x442e2a={};_0x442e2a[_0xd2eb('0x30')]=_['keys'](db[_0xd2eb('0x2d')]['rawAttributes']);_0x442e2a[_0xd2eb('0x32')]=_['keys'](_0x31698c[_0xd2eb('0x32')]);_0x442e2a[_0xd2eb('0x34')]=_[_0xd2eb('0x35')](_0x442e2a[_0xd2eb('0x30')],_0x442e2a[_0xd2eb('0x32')]);_0x2f45eb['attributes']=_[_0xd2eb('0x35')](_0x442e2a[_0xd2eb('0x30')],qs['fields'](_0x31698c[_0xd2eb('0x32')][_0xd2eb('0x48')]));_0x2f45eb[_0xd2eb('0x36')]=_0x2f45eb[_0xd2eb('0x36')][_0xd2eb('0x37')]?_0x2f45eb[_0xd2eb('0x36')]:_0x442e2a[_0xd2eb('0x30')];if(_0x31698c[_0xd2eb('0x32')][_0xd2eb('0x41')]){_0x2f45eb['include']=[{'all':!![]}];}_0x2f45eb=_[_0xd2eb('0x3e')]({},_0x2f45eb,_0x31698c['options']);return db[_0xd2eb('0x2d')][_0xd2eb('0x49')](_0x2f45eb)[_0xd2eb('0x26')](handleEntityNotFound(_0x4ec8b3,null))[_0xd2eb('0x26')](respondWithResult(_0x4ec8b3,null))[_0xd2eb('0x45')](handleError(_0x4ec8b3,null));};exports[_0xd2eb('0x4a')]=function(_0x737c60,_0x436c22){return db[_0xd2eb('0x2d')][_0xd2eb('0x4a')](_0x737c60[_0xd2eb('0x4b')],{})[_0xd2eb('0x26')](respondWithResult(_0x436c22,0xc9))[_0xd2eb('0x45')](handleError(_0x436c22,null));};exports[_0xd2eb('0x25')]=function(_0x375da1,_0x2f079c){if(_0x375da1[_0xd2eb('0x4b')]['id']){delete _0x375da1[_0xd2eb('0x4b')]['id'];}return db[_0xd2eb('0x2d')][_0xd2eb('0x49')]({'where':{'id':_0x375da1[_0xd2eb('0x47')]['id']}})[_0xd2eb('0x26')](handleEntityNotFound(_0x2f079c,null))[_0xd2eb('0x26')](saveUpdates(_0x375da1['body'],null))[_0xd2eb('0x26')](respondWithResult(_0x2f079c,null))[_0xd2eb('0x45')](handleError(_0x2f079c,null));};exports[_0xd2eb('0x27')]=function(_0x543cc4,_0x1b8bb9){return db['SquareMessage']['find']({'where':{'id':_0x543cc4[_0xd2eb('0x47')]['id']}})[_0xd2eb('0x26')](handleEntityNotFound(_0x1b8bb9,null))['then'](removeEntity(_0x1b8bb9,null))[_0xd2eb('0x45')](handleError(_0x1b8bb9,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 3c676af..2728378 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 _0xe1e3=['./squareMessage.attributes','exports','define','square_messages','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x70a8a5,_0x35a384){var _0x2b563b=function(_0x4bbb5b){while(--_0x4bbb5b){_0x70a8a5['push'](_0x70a8a5['shift']());}};_0x2b563b(++_0x35a384);}(_0xe1e3,0xe8));var _0x3e1e=function(_0x1ba331,_0x3e0150){_0x1ba331=_0x1ba331-0x0;var _0x4687ea=_0xe1e3[_0x1ba331];return _0x4687ea;};'use strict';var _=require(_0x3e1e('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3e1e('0x1'));var moment=require(_0x3e1e('0x2'));var BPromise=require(_0x3e1e('0x3'));var rp=require(_0x3e1e('0x4'));var fs=require('fs');var path=require(_0x3e1e('0x5'));var rimraf=require(_0x3e1e('0x6'));var config=require(_0x3e1e('0x7'));var attributes=require(_0x3e1e('0x8'));module[_0x3e1e('0x9')]=function(_0x2f67bc,_0x4a698f){return _0x2f67bc[_0x3e1e('0xa')]('SquareMessage',attributes,{'tableName':_0x3e1e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x58c1=['square_messages','util','../../config/logger','bluebird','request-promise','../../config/environment','./squareMessage.attributes','exports','define'];(function(_0x1278b6,_0x24252e){var _0x2cff42=function(_0x46b845){while(--_0x46b845){_0x1278b6['push'](_0x1278b6['shift']());}};_0x2cff42(++_0x24252e);}(_0x58c1,0x1b1));var _0x158c=function(_0x5ef2d7,_0x17b418){_0x5ef2d7=_0x5ef2d7-0x0;var _0x5398c4=_0x58c1[_0x5ef2d7];return _0x5398c4;};'use strict';var _=require('lodash');var util=require(_0x158c('0x0'));var logger=require(_0x158c('0x1'))('api');var moment=require('moment');var BPromise=require(_0x158c('0x2'));var rp=require(_0x158c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x158c('0x4'));var attributes=require(_0x158c('0x5'));module[_0x158c('0x6')]=function(_0x344bd9,_0x1b4a7a){return _0x344bd9[_0x158c('0x7')]('SquareMessage',attributes,{'tableName':_0x158c('0x8'),'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 baaf101..d2183f2 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 _0x7b23=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','then','info','SquareMessage,\x20%s,\x20%s','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateSquareMessage','SquareMessage','create','options','raw','catch','lodash'];(function(_0x51ece4,_0x39165c){var _0x2b7e27=function(_0x88b36e){while(--_0x88b36e){_0x51ece4['push'](_0x51ece4['shift']());}};_0x2b7e27(++_0x39165c);}(_0x7b23,0x1bf));var _0x37b2=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x7b23[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x37b2('0x0'));var util=require(_0x37b2('0x1'));var moment=require(_0x37b2('0x2'));var BPromise=require(_0x37b2('0x3'));var rs=require(_0x37b2('0x4'));var fs=require('fs');var Redis=require(_0x37b2('0x5'));var db=require(_0x37b2('0x6'))['db'];var utils=require(_0x37b2('0x7'));var logger=require(_0x37b2('0x8'))(_0x37b2('0x9'));var config=require('../../config/environment');var jayson=require(_0x37b2('0xa'));var client=jayson[_0x37b2('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x22718a,_0x2cdff0,_0x179dd6){return new BPromise(function(_0x4143ce,_0x199b63){return client['request'](_0x22718a,_0x179dd6)[_0x37b2('0xc')](function(_0x2687e9){logger[_0x37b2('0xd')](_0x37b2('0xe'),_0x2cdff0,'request\x20sent');logger[_0x37b2('0xf')](_0x37b2('0x10'),_0x2cdff0,'request\x20sent',JSON[_0x37b2('0x11')](_0x2687e9));if(_0x2687e9[_0x37b2('0x12')]){if(_0x2687e9[_0x37b2('0x12')][_0x37b2('0x13')]===0x1f4){logger[_0x37b2('0x12')]('SquareMessage,\x20%s,\x20%s',_0x2cdff0,_0x2687e9[_0x37b2('0x12')][_0x37b2('0x14')]);return _0x199b63(_0x2687e9['error']['message']);}logger[_0x37b2('0x12')](_0x37b2('0xe'),_0x2cdff0,_0x2687e9['error'][_0x37b2('0x14')]);return _0x4143ce(_0x2687e9[_0x37b2('0x12')][_0x37b2('0x14')]);}else{logger['info']('SquareMessage,\x20%s,\x20%s',_0x2cdff0,'request\x20sent');_0x4143ce(_0x2687e9[_0x37b2('0x15')]['message']);}})['catch'](function(_0x467073){logger['error'](_0x37b2('0xe'),_0x2cdff0,_0x467073);_0x199b63(_0x467073);});});}exports[_0x37b2('0x16')]=function(_0x2b7f55){var _0x4718c6=this;return new Promise(function(_0x47c444,_0x2bb121){return db[_0x37b2('0x17')][_0x37b2('0x18')](_0x2b7f55['body'],{'raw':_0x2b7f55[_0x37b2('0x19')]?_0x2b7f55[_0x37b2('0x19')][_0x37b2('0x1a')]===undefined?!![]:![]:!![]})[_0x37b2('0xc')](function(_0x3643a2){logger['info']('CreateSquareMessage',_0x2b7f55);logger[_0x37b2('0xf')](_0x37b2('0x16'),_0x2b7f55,JSON[_0x37b2('0x11')](_0x3643a2));_0x47c444(_0x3643a2);})[_0x37b2('0x1b')](function(_0x5afb56){logger['error'](_0x37b2('0x16'),_0x5afb56['message'],_0x2b7f55);_0x2bb121(_0x4718c6[_0x37b2('0x12')](0x1f4,_0x5afb56['message']));});});}; \ No newline at end of file +var _0xdcd6=['jayson/promise','http','request','then','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateSquareMessage','SquareMessage','create','body','options','raw','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x4709c0,_0x3396c7){var _0x13348b=function(_0x426235){while(--_0x426235){_0x4709c0['push'](_0x4709c0['shift']());}};_0x13348b(++_0x3396c7);}(_0xdcd6,0xa5));var _0x6dcd=function(_0x284bc3,_0x22dffe){_0x284bc3=_0x284bc3-0x0;var _0x41ac81=_0xdcd6[_0x284bc3];return _0x41ac81;};'use strict';var _=require(_0x6dcd('0x0'));var util=require(_0x6dcd('0x1'));var moment=require(_0x6dcd('0x2'));var BPromise=require(_0x6dcd('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6dcd('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6dcd('0x5'));var logger=require(_0x6dcd('0x6'))(_0x6dcd('0x7'));var config=require(_0x6dcd('0x8'));var jayson=require(_0x6dcd('0x9'));var client=jayson['client'][_0x6dcd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x7c4faa,_0x604f0e,_0x168abd){return new BPromise(function(_0x5b0d73,_0x4eb85b){return client[_0x6dcd('0xb')](_0x7c4faa,_0x168abd)[_0x6dcd('0xc')](function(_0x6f28fd){logger[_0x6dcd('0xd')](_0x6dcd('0xe'),_0x604f0e,_0x6dcd('0xf'));logger[_0x6dcd('0x10')](_0x6dcd('0x11'),_0x604f0e,_0x6dcd('0xf'),JSON[_0x6dcd('0x12')](_0x6f28fd));if(_0x6f28fd['error']){if(_0x6f28fd[_0x6dcd('0x13')]['code']===0x1f4){logger[_0x6dcd('0x13')](_0x6dcd('0xe'),_0x604f0e,_0x6f28fd['error']['message']);return _0x4eb85b(_0x6f28fd[_0x6dcd('0x13')][_0x6dcd('0x14')]);}logger[_0x6dcd('0x13')](_0x6dcd('0xe'),_0x604f0e,_0x6f28fd[_0x6dcd('0x13')]['message']);return _0x5b0d73(_0x6f28fd[_0x6dcd('0x13')]['message']);}else{logger[_0x6dcd('0xd')]('SquareMessage,\x20%s,\x20%s',_0x604f0e,_0x6dcd('0xf'));_0x5b0d73(_0x6f28fd[_0x6dcd('0x15')]['message']);}})[_0x6dcd('0x16')](function(_0x180b75){logger[_0x6dcd('0x13')]('SquareMessage,\x20%s,\x20%s',_0x604f0e,_0x180b75);_0x4eb85b(_0x180b75);});});}exports[_0x6dcd('0x17')]=function(_0x154fe8){var _0xe2dc12=this;return new Promise(function(_0x44ac56,_0xbae24d){return db[_0x6dcd('0x18')][_0x6dcd('0x19')](_0x154fe8[_0x6dcd('0x1a')],{'raw':_0x154fe8[_0x6dcd('0x1b')]?_0x154fe8[_0x6dcd('0x1b')][_0x6dcd('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x2e7673){logger[_0x6dcd('0xd')]('CreateSquareMessage',_0x154fe8);logger[_0x6dcd('0x10')](_0x6dcd('0x17'),_0x154fe8,JSON[_0x6dcd('0x12')](_0x2e7673));_0x44ac56(_0x2e7673);})['catch'](function(_0x3abdf6){logger[_0x6dcd('0x13')](_0x6dcd('0x17'),_0x3abdf6['message'],_0x154fe8);_0xbae24d(_0xe2dc12[_0x6dcd('0x13')](0x1f4,_0x3abdf6[_0x6dcd('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 45e2e77..68f9518 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 _0x31f2=['path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','/:id','show','isAuthenticated','15s','test','put','update','delete','exports','multer','util'];(function(_0x5a6cef,_0x1697df){var _0x37f76f=function(_0x17dc71){while(--_0x17dc71){_0x5a6cef['push'](_0x5a6cef['shift']());}};_0x37f76f(++_0x1697df);}(_0x31f2,0x12e));var _0x231f=function(_0x423e29,_0x589378){_0x423e29=_0x423e29-0x0;var _0x30c8cb=_0x31f2[_0x423e29];return _0x30c8cb;};'use strict';var multer=require(_0x231f('0x0'));var util=require(_0x231f('0x1'));var path=require(_0x231f('0x2'));var timeout=require(_0x231f('0x3'));var express=require(_0x231f('0x4'));var router=express[_0x231f('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x231f('0x6'));var config=require(_0x231f('0x7'));var controller=require(_0x231f('0x8'));router[_0x231f('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x231f('0x9')](_0x231f('0xa'),auth['isAuthenticated'](),controller[_0x231f('0xb')]);router[_0x231f('0x9')]('/:id/test',auth[_0x231f('0xc')](),timeout(_0x231f('0xd')),controller[_0x231f('0xe')]);router['post']('/',auth[_0x231f('0xc')](),controller['create']);router[_0x231f('0xf')]('/:id',auth[_0x231f('0xc')](),controller[_0x231f('0x10')]);router[_0x231f('0x11')](_0x231f('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x231f('0x12')]=router; \ No newline at end of file +var _0x4432=['path','Router','fs-extra','../../components/auth/service','../../config/environment','./squareOdbc.controller','isAuthenticated','index','get','/:id','show','/:id/test','15s','test','post','create','put','update','delete','exports','util'];(function(_0x3b8c45,_0x2a410b){var _0x3980d6=function(_0xa40d9e){while(--_0xa40d9e){_0x3b8c45['push'](_0x3b8c45['shift']());}};_0x3980d6(++_0x2a410b);}(_0x4432,0x164));var _0x2443=function(_0x45b97f,_0x3b9d0e){_0x45b97f=_0x45b97f-0x0;var _0x3911a2=_0x4432[_0x45b97f];return _0x3911a2;};'use strict';var multer=require('multer');var util=require(_0x2443('0x0'));var path=require(_0x2443('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2443('0x2')]();var fs_extra=require(_0x2443('0x3'));var auth=require(_0x2443('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x2443('0x5'));var controller=require(_0x2443('0x6'));router['get']('/',auth[_0x2443('0x7')](),controller[_0x2443('0x8')]);router[_0x2443('0x9')](_0x2443('0xa'),auth['isAuthenticated'](),controller[_0x2443('0xb')]);router['get'](_0x2443('0xc'),auth[_0x2443('0x7')](),timeout(_0x2443('0xd')),controller[_0x2443('0xe')]);router[_0x2443('0xf')]('/',auth[_0x2443('0x7')](),controller[_0x2443('0x10')]);router[_0x2443('0x11')](_0x2443('0xa'),auth[_0x2443('0x7')](),controller[_0x2443('0x12')]);router[_0x2443('0x13')](_0x2443('0xa'),auth[_0x2443('0x7')](),controller['destroy']);module[_0x2443('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 35db089..437ca09 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 _0x157a=['sequelize','STRING','name'];(function(_0xd1b4d7,_0x28b2c1){var _0x3002ec=function(_0x3d95ce){while(--_0x3d95ce){_0xd1b4d7['push'](_0xd1b4d7['shift']());}};_0x3002ec(++_0x28b2c1);}(_0x157a,0x15f));var _0xa157=function(_0x2d8eac,_0x4d2f89){_0x2d8eac=_0x2d8eac-0x0;var _0x4af6a7=_0x157a[_0x2d8eac];return _0x4af6a7;};'use strict';var Sequelize=require(_0xa157('0x0'));module['exports']={'name':{'type':Sequelize[_0xa157('0x1')],'unique':_0xa157('0x2'),'allowNull':![]},'dsn':{'type':Sequelize[_0xa157('0x1')]},'description':{'type':Sequelize[_0xa157('0x1')]}}; \ No newline at end of file +var _0x0ca7=['STRING','sequelize','exports','name'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0ca7,0x11d));var _0x70ca=function(_0x1cd585,_0x54276b){_0x1cd585=_0x1cd585-0x0;var _0x3ca87f=_0x0ca7[_0x1cd585];return _0x3ca87f;};'use strict';var Sequelize=require(_0x70ca('0x0'));module[_0x70ca('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x70ca('0x2'),'allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x70ca('0x3')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 25dbfad..8c062f1 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 _0x542b=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','reject','update','then','destroy','get','ODBC','UserProfileResource','end','stack','name','index','map','SquareOdbc','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','VIRTUAL','filter','merge','includeAll','include','findAll','show','create','user','role','UserProfileSection','userProfileId','autoAssociation','catch','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','params','test','odbc','openSync','dsn','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api'];(function(_0xf34418,_0x3b5a25){var _0x5e1cdf=function(_0x43d732){while(--_0x43d732){_0xf34418['push'](_0xf34418['shift']());}};_0x5e1cdf(++_0x3b5a25);}(_0x542b,0x149));var _0xb542=function(_0x4eafed,_0x26e2bc){_0x4eafed=_0x4eafed-0x0;var _0x159c85=_0x542b[_0x4eafed];return _0x159c85;};'use strict';var emlformat=require(_0xb542('0x0'));var rimraf=require(_0xb542('0x1'));var zipdir=require(_0xb542('0x2'));var jsonpatch=require(_0xb542('0x3'));var rp=require(_0xb542('0x4'));var moment=require(_0xb542('0x5'));var BPromise=require(_0xb542('0x6'));var Mustache=require(_0xb542('0x7'));var util=require(_0xb542('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xb542('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb542('0xa'));var _=require('lodash');var squel=require(_0xb542('0xb'));var crypto=require(_0xb542('0xc'));var jsforce=require(_0xb542('0xd'));var deskjs=require(_0xb542('0xe'));var toCsv=require('to-csv');var querystring=require(_0xb542('0xf'));var Papa=require(_0xb542('0x10'));var Redis=require(_0xb542('0x11'));var authService=require(_0xb542('0x12'));var qs=require(_0xb542('0x13'));var as=require(_0xb542('0x14'));var hardwareService=require(_0xb542('0x15'));var logger=require('../../config/logger')(_0xb542('0x16'));var utils=require(_0xb542('0x17'));var config=require(_0xb542('0x18'));var licenseUtil=require(_0xb542('0x19'));var db=require(_0xb542('0x1a'))['db'];function respondWithStatusCode(_0x319232,_0x432174){_0x432174=_0x432174||0xcc;return function(_0x2be4fc){if(_0x2be4fc){return _0x319232[_0xb542('0x1b')](_0x432174);}return _0x319232[_0xb542('0x1c')](_0x432174)['end']();};}function respondWithResult(_0x2c6800,_0x537ba6){_0x537ba6=_0x537ba6||0xc8;return function(_0x3b6c0f){if(_0x3b6c0f){return _0x2c6800[_0xb542('0x1c')](_0x537ba6)[_0xb542('0x1d')](_0x3b6c0f);}};}function respondWithFilteredResult(_0x6e6d49,_0x1fb03a){return function(_0x2f9495){if(_0x2f9495){var _0x256f18=typeof _0x1fb03a[_0xb542('0x1e')]===_0xb542('0x1f')&&typeof _0x1fb03a[_0xb542('0x20')]===_0xb542('0x1f');var _0x395dfb=_0x2f9495[_0xb542('0x21')];var _0x362c91=_0x256f18?0x0:_0x1fb03a['offset'];var _0x37e5eb=_0x256f18?_0x2f9495[_0xb542('0x21')]:_0x1fb03a['offset']+_0x1fb03a[_0xb542('0x20')];var _0x135f81;if(_0x37e5eb>=_0x395dfb){_0x37e5eb=_0x395dfb;_0x135f81=0xc8;}else{_0x135f81=0xce;}_0x6e6d49[_0xb542('0x1c')](_0x135f81);return _0x6e6d49['set'](_0xb542('0x22'),_0x362c91+'-'+_0x37e5eb+'/'+_0x395dfb)[_0xb542('0x1d')](_0x2f9495);}return null;};}function patchUpdates(_0x3ef031){return function(_0x2d9bef){try{jsonpatch['apply'](_0x2d9bef,_0x3ef031,!![]);}catch(_0x49b64d){return BPromise[_0xb542('0x23')](_0x49b64d);}return _0x2d9bef['save']();};}function saveUpdates(_0x5c08c5,_0x299be8){return function(_0xc32d40){if(_0xc32d40){return _0xc32d40[_0xb542('0x24')](_0x5c08c5)[_0xb542('0x25')](function(_0x252171){return _0x252171;});}return null;};}function removeEntity(_0x5c5602,_0x3ba222){return function(_0x401375){if(_0x401375){return _0x401375[_0xb542('0x26')]()[_0xb542('0x25')](function(){var _0x37dfd4=_0x401375[_0xb542('0x27')]({'plain':!![]});var _0x3fcced=_0xb542('0x28');return db[_0xb542('0x29')][_0xb542('0x26')]({'where':{'type':_0x3fcced,'resourceId':_0x37dfd4['id']}})['then'](function(){return _0x401375;});})[_0xb542('0x25')](function(){_0x5c5602['status'](0xcc)[_0xb542('0x2a')]();});}};}function handleEntityNotFound(_0x5a0d76,_0x2c4224){return function(_0x34dd7c){if(!_0x34dd7c){_0x5a0d76[_0xb542('0x1b')](0x194);}return _0x34dd7c;};}function handleError(_0x4f32b9,_0x43b152){_0x43b152=_0x43b152||0x1f4;return function(_0x5a8fa1){logger['error'](_0x5a8fa1[_0xb542('0x2b')]);if(_0x5a8fa1[_0xb542('0x2c')]){delete _0x5a8fa1[_0xb542('0x2c')];}_0x4f32b9[_0xb542('0x1c')](_0x43b152)['send'](_0x5a8fa1);};}exports[_0xb542('0x2d')]=function(_0xebee22,_0x16a8f6){var _0x349de8={},_0x3794af={},_0x3cbb68={'count':0x0,'rows':[]};var _0x44bbb0=_[_0xb542('0x2e')](db[_0xb542('0x2f')][_0xb542('0x30')],function(_0x214f4d){return{'name':_0x214f4d[_0xb542('0x31')],'type':_0x214f4d[_0xb542('0x32')][_0xb542('0x33')]};});_0x3794af[_0xb542('0x34')]=_['map'](_0x44bbb0,_0xb542('0x2c'));_0x3794af[_0xb542('0x35')]=_[_0xb542('0x36')](_0xebee22[_0xb542('0x35')]);_0x3794af['filters']=_[_0xb542('0x37')](_0x3794af[_0xb542('0x34')],_0x3794af['query']);_0x349de8[_0xb542('0x38')]=_['intersection'](_0x3794af[_0xb542('0x34')],qs[_0xb542('0x39')](_0xebee22[_0xb542('0x35')][_0xb542('0x39')]));_0x349de8[_0xb542('0x38')]=_0x349de8[_0xb542('0x38')][_0xb542('0x3a')]?_0x349de8['attributes']:_0x3794af[_0xb542('0x34')];if(!_0xebee22[_0xb542('0x35')][_0xb542('0x3b')](_0xb542('0x3c'))){_0x349de8['limit']=qs[_0xb542('0x20')](_0xebee22[_0xb542('0x35')][_0xb542('0x20')]);_0x349de8[_0xb542('0x1e')]=qs[_0xb542('0x1e')](_0xebee22[_0xb542('0x35')]['offset']);}_0x349de8['order']=qs[_0xb542('0x3d')](_0xebee22[_0xb542('0x35')]['sort']);_0x349de8[_0xb542('0x3e')]=qs[_0xb542('0x3f')](_[_0xb542('0x40')](_0xebee22[_0xb542('0x35')],_0x3794af[_0xb542('0x3f')]),_0x44bbb0);if(_0xebee22[_0xb542('0x35')]['filter']){_0x349de8[_0xb542('0x3e')]=_['merge'](_0x349de8['where'],{'$or':_[_0xb542('0x2e')](_0x44bbb0,function(_0x5758a9){if(_0x5758a9[_0xb542('0x32')]!==_0xb542('0x41')){var _0x4bcbe0={};_0x4bcbe0[_0x5758a9['name']]={'$like':'%'+_0xebee22[_0xb542('0x35')][_0xb542('0x42')]+'%'};return _0x4bcbe0;}})});}_0x349de8=_[_0xb542('0x43')]({},_0x349de8,_0xebee22['options']);var _0x1b4bbf={'where':_0x349de8['where']};return db[_0xb542('0x2f')][_0xb542('0x21')](_0x1b4bbf)['then'](function(_0x1ec9bc){_0x3cbb68['count']=_0x1ec9bc;if(_0xebee22[_0xb542('0x35')][_0xb542('0x44')]){_0x349de8[_0xb542('0x45')]=[{'all':!![]}];}return db['SquareOdbc'][_0xb542('0x46')](_0x349de8);})['then'](function(_0x96ab3b){_0x3cbb68['rows']=_0x96ab3b;return _0x3cbb68;})[_0xb542('0x25')](respondWithFilteredResult(_0x16a8f6,_0x349de8))['catch'](handleError(_0x16a8f6,null));};exports[_0xb542('0x47')]=function(_0x381cfe,_0x6e73a0){var _0x2d720a={'raw':!![],'where':{'id':_0x381cfe['params']['id']}},_0xc3f6d7={};_0xc3f6d7[_0xb542('0x34')]=_['keys'](db['SquareOdbc'][_0xb542('0x30')]);_0xc3f6d7[_0xb542('0x35')]=_[_0xb542('0x36')](_0x381cfe[_0xb542('0x35')]);_0xc3f6d7[_0xb542('0x3f')]=_['intersection'](_0xc3f6d7[_0xb542('0x34')],_0xc3f6d7['query']);_0x2d720a[_0xb542('0x38')]=_['intersection'](_0xc3f6d7[_0xb542('0x34')],qs[_0xb542('0x39')](_0x381cfe[_0xb542('0x35')][_0xb542('0x39')]));_0x2d720a[_0xb542('0x38')]=_0x2d720a[_0xb542('0x38')]['length']?_0x2d720a['attributes']:_0xc3f6d7['model'];if(_0x381cfe[_0xb542('0x35')][_0xb542('0x44')]){_0x2d720a[_0xb542('0x45')]=[{'all':!![]}];}_0x2d720a=_[_0xb542('0x43')]({},_0x2d720a,_0x381cfe['options']);return db[_0xb542('0x2f')]['find'](_0x2d720a)[_0xb542('0x25')](handleEntityNotFound(_0x6e73a0,null))['then'](respondWithResult(_0x6e73a0,null))['catch'](handleError(_0x6e73a0,null));};exports[_0xb542('0x48')]=function(_0x398ce4,_0x4acf12){return db[_0xb542('0x2f')][_0xb542('0x48')](_0x398ce4['body'],{})[_0xb542('0x25')](function(_0x25d30c){var _0x2e529f=_0x398ce4[_0xb542('0x49')][_0xb542('0x27')]({'plain':!![]});if(!_0x2e529f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2e529f[_0xb542('0x4a')]===_0xb542('0x49')){var _0x2c0f4e=_0x25d30c[_0xb542('0x27')]({'plain':!![]});var _0x5b7a68=_0xb542('0x28');return db[_0xb542('0x4b')]['find']({'where':{'name':_0x5b7a68,'userProfileId':_0x2e529f[_0xb542('0x4c')]},'raw':!![]})[_0xb542('0x25')](function(_0x41ed66){if(_0x41ed66&&_0x41ed66[_0xb542('0x4d')]===0x0){return db[_0xb542('0x29')][_0xb542('0x48')]({'name':_0x2c0f4e[_0xb542('0x2c')],'resourceId':_0x2c0f4e['id'],'type':_0x41ed66['name'],'sectionId':_0x41ed66['id']},{})[_0xb542('0x25')](function(){return _0x25d30c;});}else{return _0x25d30c;}})[_0xb542('0x4e')](function(_0x4663cf){logger[_0xb542('0x4f')](_0xb542('0x50'),_0x4663cf);throw _0x4663cf;});}return _0x25d30c;})[_0xb542('0x25')](respondWithResult(_0x4acf12,0xc9))[_0xb542('0x4e')](handleError(_0x4acf12,null));};exports['update']=function(_0x596672,_0xe5606c){if(_0x596672[_0xb542('0x51')]['id']){delete _0x596672[_0xb542('0x51')]['id'];}return db['SquareOdbc'][_0xb542('0x52')]({'where':{'id':_0x596672[_0xb542('0x53')]['id']}})[_0xb542('0x25')](handleEntityNotFound(_0xe5606c,null))[_0xb542('0x25')](saveUpdates(_0x596672[_0xb542('0x51')],null))['then'](respondWithResult(_0xe5606c,null))[_0xb542('0x4e')](handleError(_0xe5606c,null));};exports[_0xb542('0x26')]=function(_0x205f47,_0x113483){return db[_0xb542('0x2f')][_0xb542('0x52')]({'where':{'id':_0x205f47[_0xb542('0x53')]['id']}})[_0xb542('0x25')](handleEntityNotFound(_0x113483,null))[_0xb542('0x25')](removeEntity(_0x113483,null))[_0xb542('0x4e')](handleError(_0x113483,null));};exports[_0xb542('0x54')]=function(_0x3757fc,_0x4be860,_0x145ebd){var _0x1c3739;return db[_0xb542('0x2f')][_0xb542('0x52')]({'where':{'id':_0x3757fc['params']['id']},'attributes':['id','dsn']})[_0xb542('0x25')](handleEntityNotFound(_0x4be860,null))['then'](function(_0x1f5bf1){if(_0x1f5bf1){var _0xfa8dcb=require(_0xb542('0x55'))();_0xfa8dcb[_0xb542('0x56')](_0x1f5bf1[_0xb542('0x57')]);_0xfa8dcb['closeSync']();return _0x1f5bf1;}})['then'](respondWithResult(_0x4be860,null))[_0xb542('0x4e')](handleError(_0x4be860,null));}; \ No newline at end of file +var _0x30c1=['hasOwnProperty','nolimit','sort','pick','filters','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','keys','rawAttributes','find','create','body','user','ODBC','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','test','dsn','odbc','openSync','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','lodash','crypto','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','get','UserProfileResource','error','send','index','map','SquareOdbc','key','name','query','intersection','model','attributes','fields'];(function(_0x930779,_0x29d865){var _0x1a3652=function(_0x208d4e){while(--_0x208d4e){_0x930779['push'](_0x930779['shift']());}};_0x1a3652(++_0x29d865);}(_0x30c1,0xc4));var _0x130c=function(_0x56bc0a,_0x42a7cf){_0x56bc0a=_0x56bc0a-0x0;var _0x521c65=_0x30c1[_0x56bc0a];return _0x521c65;};'use strict';var emlformat=require(_0x130c('0x0'));var rimraf=require(_0x130c('0x1'));var zipdir=require(_0x130c('0x2'));var jsonpatch=require(_0x130c('0x3'));var rp=require('request-promise');var moment=require(_0x130c('0x4'));var BPromise=require(_0x130c('0x5'));var Mustache=require(_0x130c('0x6'));var util=require(_0x130c('0x7'));var path=require(_0x130c('0x8'));var sox=require(_0x130c('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x130c('0xa'));var squel=require('squel');var crypto=require(_0x130c('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x130c('0xc'));var querystring=require(_0x130c('0xd'));var Papa=require(_0x130c('0xe'));var Redis=require('ioredis');var authService=require(_0x130c('0xf'));var qs=require(_0x130c('0x10'));var as=require(_0x130c('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x130c('0x12'))(_0x130c('0x13'));var utils=require(_0x130c('0x14'));var config=require(_0x130c('0x15'));var licenseUtil=require(_0x130c('0x16'));var db=require(_0x130c('0x17'))['db'];function respondWithStatusCode(_0xbe6697,_0x241192){_0x241192=_0x241192||0xcc;return function(_0x240b7b){if(_0x240b7b){return _0xbe6697[_0x130c('0x18')](_0x241192);}return _0xbe6697[_0x130c('0x19')](_0x241192)[_0x130c('0x1a')]();};}function respondWithResult(_0x13d239,_0x1c7062){_0x1c7062=_0x1c7062||0xc8;return function(_0x512268){if(_0x512268){return _0x13d239[_0x130c('0x19')](_0x1c7062)[_0x130c('0x1b')](_0x512268);}};}function respondWithFilteredResult(_0x5055c5,_0x4fdfa4){return function(_0x550751){if(_0x550751){var _0x485138=typeof _0x4fdfa4[_0x130c('0x1c')]===_0x130c('0x1d')&&typeof _0x4fdfa4['limit']===_0x130c('0x1d');var _0x3ada6a=_0x550751[_0x130c('0x1e')];var _0x4cc53b=_0x485138?0x0:_0x4fdfa4['offset'];var _0x311c7d=_0x485138?_0x550751['count']:_0x4fdfa4['offset']+_0x4fdfa4[_0x130c('0x1f')];var _0x551a24;if(_0x311c7d>=_0x3ada6a){_0x311c7d=_0x3ada6a;_0x551a24=0xc8;}else{_0x551a24=0xce;}_0x5055c5[_0x130c('0x19')](_0x551a24);return _0x5055c5[_0x130c('0x20')](_0x130c('0x21'),_0x4cc53b+'-'+_0x311c7d+'/'+_0x3ada6a)['json'](_0x550751);}return null;};}function patchUpdates(_0x563398){return function(_0x2a86a9){try{jsonpatch['apply'](_0x2a86a9,_0x563398,!![]);}catch(_0x3d8199){return BPromise[_0x130c('0x22')](_0x3d8199);}return _0x2a86a9[_0x130c('0x23')]();};}function saveUpdates(_0x440035,_0x4f6c14){return function(_0x5234ac){if(_0x5234ac){return _0x5234ac[_0x130c('0x24')](_0x440035)[_0x130c('0x25')](function(_0x512e78){return _0x512e78;});}return null;};}function removeEntity(_0x426909,_0x4cfa3b){return function(_0x6f8822){if(_0x6f8822){return _0x6f8822[_0x130c('0x26')]()['then'](function(){var _0x126e83=_0x6f8822[_0x130c('0x27')]({'plain':!![]});var _0x4d34fc='ODBC';return db[_0x130c('0x28')][_0x130c('0x26')]({'where':{'type':_0x4d34fc,'resourceId':_0x126e83['id']}})[_0x130c('0x25')](function(){return _0x6f8822;});})[_0x130c('0x25')](function(){_0x426909[_0x130c('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x427630,_0xfcef9a){return function(_0x353854){if(!_0x353854){_0x427630[_0x130c('0x18')](0x194);}return _0x353854;};}function handleError(_0x4e857f,_0x133341){_0x133341=_0x133341||0x1f4;return function(_0x1bb469){logger[_0x130c('0x29')](_0x1bb469['stack']);if(_0x1bb469['name']){delete _0x1bb469['name'];}_0x4e857f[_0x130c('0x19')](_0x133341)[_0x130c('0x2a')](_0x1bb469);};}exports[_0x130c('0x2b')]=function(_0x4a79f3,_0x5612ca){var _0x1a3c80={},_0x3b86ac={},_0x2d6e35={'count':0x0,'rows':[]};var _0x274e65=_[_0x130c('0x2c')](db[_0x130c('0x2d')]['rawAttributes'],function(_0x46c453){return{'name':_0x46c453['fieldName'],'type':_0x46c453['type'][_0x130c('0x2e')]};});_0x3b86ac['model']=_[_0x130c('0x2c')](_0x274e65,_0x130c('0x2f'));_0x3b86ac[_0x130c('0x30')]=_['keys'](_0x4a79f3[_0x130c('0x30')]);_0x3b86ac['filters']=_[_0x130c('0x31')](_0x3b86ac[_0x130c('0x32')],_0x3b86ac[_0x130c('0x30')]);_0x1a3c80[_0x130c('0x33')]=_[_0x130c('0x31')](_0x3b86ac[_0x130c('0x32')],qs['fields'](_0x4a79f3[_0x130c('0x30')][_0x130c('0x34')]));_0x1a3c80[_0x130c('0x33')]=_0x1a3c80[_0x130c('0x33')]['length']?_0x1a3c80[_0x130c('0x33')]:_0x3b86ac[_0x130c('0x32')];if(!_0x4a79f3[_0x130c('0x30')][_0x130c('0x35')](_0x130c('0x36'))){_0x1a3c80[_0x130c('0x1f')]=qs[_0x130c('0x1f')](_0x4a79f3[_0x130c('0x30')][_0x130c('0x1f')]);_0x1a3c80[_0x130c('0x1c')]=qs[_0x130c('0x1c')](_0x4a79f3[_0x130c('0x30')][_0x130c('0x1c')]);}_0x1a3c80['order']=qs[_0x130c('0x37')](_0x4a79f3[_0x130c('0x30')][_0x130c('0x37')]);_0x1a3c80['where']=qs['filters'](_[_0x130c('0x38')](_0x4a79f3[_0x130c('0x30')],_0x3b86ac[_0x130c('0x39')]),_0x274e65);if(_0x4a79f3[_0x130c('0x30')][_0x130c('0x3a')]){_0x1a3c80[_0x130c('0x3b')]=_[_0x130c('0x3c')](_0x1a3c80['where'],{'$or':_[_0x130c('0x2c')](_0x274e65,function(_0x59b348){if(_0x59b348['type']!==_0x130c('0x3d')){var _0x1ec386={};_0x1ec386[_0x59b348['name']]={'$like':'%'+_0x4a79f3[_0x130c('0x30')][_0x130c('0x3a')]+'%'};return _0x1ec386;}})});}_0x1a3c80=_[_0x130c('0x3c')]({},_0x1a3c80,_0x4a79f3[_0x130c('0x3e')]);var _0x58cc4c={'where':_0x1a3c80[_0x130c('0x3b')]};return db['SquareOdbc'][_0x130c('0x1e')](_0x58cc4c)[_0x130c('0x25')](function(_0x22a4e0){_0x2d6e35[_0x130c('0x1e')]=_0x22a4e0;if(_0x4a79f3[_0x130c('0x30')][_0x130c('0x3f')]){_0x1a3c80[_0x130c('0x40')]=[{'all':!![]}];}return db[_0x130c('0x2d')][_0x130c('0x41')](_0x1a3c80);})[_0x130c('0x25')](function(_0x3a0f72){_0x2d6e35[_0x130c('0x42')]=_0x3a0f72;return _0x2d6e35;})[_0x130c('0x25')](respondWithFilteredResult(_0x5612ca,_0x1a3c80))[_0x130c('0x43')](handleError(_0x5612ca,null));};exports['show']=function(_0x20b7f3,_0x42036e){var _0x127c2e={'raw':!![],'where':{'id':_0x20b7f3['params']['id']}},_0x12b1fa={};_0x12b1fa[_0x130c('0x32')]=_[_0x130c('0x44')](db[_0x130c('0x2d')][_0x130c('0x45')]);_0x12b1fa[_0x130c('0x30')]=_[_0x130c('0x44')](_0x20b7f3['query']);_0x12b1fa[_0x130c('0x39')]=_[_0x130c('0x31')](_0x12b1fa['model'],_0x12b1fa[_0x130c('0x30')]);_0x127c2e[_0x130c('0x33')]=_[_0x130c('0x31')](_0x12b1fa[_0x130c('0x32')],qs[_0x130c('0x34')](_0x20b7f3[_0x130c('0x30')]['fields']));_0x127c2e[_0x130c('0x33')]=_0x127c2e[_0x130c('0x33')]['length']?_0x127c2e[_0x130c('0x33')]:_0x12b1fa[_0x130c('0x32')];if(_0x20b7f3[_0x130c('0x30')][_0x130c('0x3f')]){_0x127c2e[_0x130c('0x40')]=[{'all':!![]}];}_0x127c2e=_['merge']({},_0x127c2e,_0x20b7f3[_0x130c('0x3e')]);return db[_0x130c('0x2d')][_0x130c('0x46')](_0x127c2e)[_0x130c('0x25')](handleEntityNotFound(_0x42036e,null))[_0x130c('0x25')](respondWithResult(_0x42036e,null))['catch'](handleError(_0x42036e,null));};exports[_0x130c('0x47')]=function(_0x2f15d9,_0x693bf){return db['SquareOdbc']['create'](_0x2f15d9[_0x130c('0x48')],{})[_0x130c('0x25')](function(_0x2ddd78){var _0x14f8ae=_0x2f15d9[_0x130c('0x49')][_0x130c('0x27')]({'plain':!![]});if(!_0x14f8ae)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x14f8ae['role']===_0x130c('0x49')){var _0x378851=_0x2ddd78[_0x130c('0x27')]({'plain':!![]});var _0x4f2850=_0x130c('0x4a');return db[_0x130c('0x4b')][_0x130c('0x46')]({'where':{'name':_0x4f2850,'userProfileId':_0x14f8ae['userProfileId']},'raw':!![]})[_0x130c('0x25')](function(_0x496ee6){if(_0x496ee6&&_0x496ee6[_0x130c('0x4c')]===0x0){return db[_0x130c('0x28')][_0x130c('0x47')]({'name':_0x378851[_0x130c('0x2f')],'resourceId':_0x378851['id'],'type':_0x496ee6[_0x130c('0x2f')],'sectionId':_0x496ee6['id']},{})[_0x130c('0x25')](function(){return _0x2ddd78;});}else{return _0x2ddd78;}})['catch'](function(_0x17e65d){logger[_0x130c('0x29')](_0x130c('0x4d'),_0x17e65d);throw _0x17e65d;});}return _0x2ddd78;})['then'](respondWithResult(_0x693bf,0xc9))[_0x130c('0x43')](handleError(_0x693bf,null));};exports[_0x130c('0x24')]=function(_0x5425fb,_0x54b92c){if(_0x5425fb[_0x130c('0x48')]['id']){delete _0x5425fb[_0x130c('0x48')]['id'];}return db[_0x130c('0x2d')]['find']({'where':{'id':_0x5425fb[_0x130c('0x4e')]['id']}})[_0x130c('0x25')](handleEntityNotFound(_0x54b92c,null))[_0x130c('0x25')](saveUpdates(_0x5425fb[_0x130c('0x48')],null))[_0x130c('0x25')](respondWithResult(_0x54b92c,null))[_0x130c('0x43')](handleError(_0x54b92c,null));};exports[_0x130c('0x26')]=function(_0x32c833,_0x33223e){return db[_0x130c('0x2d')][_0x130c('0x46')]({'where':{'id':_0x32c833[_0x130c('0x4e')]['id']}})[_0x130c('0x25')](handleEntityNotFound(_0x33223e,null))['then'](removeEntity(_0x33223e,null))['catch'](handleError(_0x33223e,null));};exports[_0x130c('0x4f')]=function(_0x10a056,_0x24043a,_0x2d54bc){var _0x438a59;return db[_0x130c('0x2d')][_0x130c('0x46')]({'where':{'id':_0x10a056[_0x130c('0x4e')]['id']},'attributes':['id',_0x130c('0x50')]})['then'](handleEntityNotFound(_0x24043a,null))[_0x130c('0x25')](function(_0x2ea7f9){if(_0x2ea7f9){var _0x510095=require(_0x130c('0x51'))();_0x510095[_0x130c('0x52')](_0x2ea7f9[_0x130c('0x50')]);_0x510095['closeSync']();return _0x2ea7f9;}})[_0x130c('0x25')](respondWithResult(_0x24043a,null))[_0x130c('0x43')](handleError(_0x24043a,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 25adce3..1b1be93 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 _0x4975=['./squareOdbc.attributes','exports','SquareOdbc','square_odbc','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x34374d,_0x5d925c){var _0x592a7b=function(_0x488573){while(--_0x488573){_0x34374d['push'](_0x34374d['shift']());}};_0x592a7b(++_0x5d925c);}(_0x4975,0x86));var _0x5497=function(_0x4ee49c,_0x5231ac){_0x4ee49c=_0x4ee49c-0x0;var _0x3351fe=_0x4975[_0x4ee49c];return _0x3351fe;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var logger=require(_0x5497('0x1'))(_0x5497('0x2'));var moment=require(_0x5497('0x3'));var BPromise=require(_0x5497('0x4'));var rp=require(_0x5497('0x5'));var fs=require('fs');var path=require(_0x5497('0x6'));var rimraf=require(_0x5497('0x7'));var config=require(_0x5497('0x8'));var attributes=require(_0x5497('0x9'));module[_0x5497('0xa')]=function(_0x539a27,_0x37e48d){return _0x539a27['define'](_0x5497('0xb'),attributes,{'tableName':_0x5497('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbd45=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','SquareOdbc','square_odbc','lodash','util','../../config/logger'];(function(_0x3aa8b3,_0x23041c){var _0x1b2379=function(_0xf25113){while(--_0xf25113){_0x3aa8b3['push'](_0x3aa8b3['shift']());}};_0x1b2379(++_0x23041c);}(_0xbd45,0x193));var _0x5bd4=function(_0x18d012,_0x2f6968){_0x18d012=_0x18d012-0x0;var _0x47d115=_0xbd45[_0x18d012];return _0x47d115;};'use strict';var _=require(_0x5bd4('0x0'));var util=require(_0x5bd4('0x1'));var logger=require(_0x5bd4('0x2'))(_0x5bd4('0x3'));var moment=require(_0x5bd4('0x4'));var BPromise=require(_0x5bd4('0x5'));var rp=require(_0x5bd4('0x6'));var fs=require('fs');var path=require(_0x5bd4('0x7'));var rimraf=require(_0x5bd4('0x8'));var config=require(_0x5bd4('0x9'));var attributes=require('./squareOdbc.attributes');module[_0x5bd4('0xa')]=function(_0x4d4a53,_0x235b7b){return _0x4d4a53[_0x5bd4('0xb')](_0x5bd4('0xc'),attributes,{'tableName':_0x5bd4('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 9b269b2..631469a 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 _0xf582=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','SquareOdbc,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','info','catch','find','raw','options','where','attributes','include','map','model','then','ShowSquareOdbc','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x3fcfb1,_0x114e24){var _0x2b5019=function(_0x267216){while(--_0x267216){_0x3fcfb1['push'](_0x3fcfb1['shift']());}};_0x2b5019(++_0x114e24);}(_0xf582,0x179));var _0x2f58=function(_0x2ccab9,_0x42969d){_0x2ccab9=_0x2ccab9-0x0;var _0x20e296=_0xf582[_0x2ccab9];return _0x20e296;};'use strict';var _=require(_0x2f58('0x0'));var util=require(_0x2f58('0x1'));var moment=require(_0x2f58('0x2'));var BPromise=require('bluebird');var rs=require(_0x2f58('0x3'));var fs=require('fs');var Redis=require(_0x2f58('0x4'));var db=require(_0x2f58('0x5'))['db'];var utils=require(_0x2f58('0x6'));var logger=require(_0x2f58('0x7'))(_0x2f58('0x8'));var config=require(_0x2f58('0x9'));var jayson=require(_0x2f58('0xa'));var client=jayson[_0x2f58('0xb')][_0x2f58('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3c262e,_0x7be1d6,_0x150ce6){return new BPromise(function(_0x3c58cc,_0x8edaab){return client[_0x2f58('0xd')](_0x3c262e,_0x150ce6)['then'](function(_0x3ec7a9){logger['info'](_0x2f58('0xe'),_0x7be1d6,'request\x20sent');logger[_0x2f58('0xf')]('SquareOdbc,\x20%s,\x20%s,\x20%s',_0x7be1d6,_0x2f58('0x10'),JSON[_0x2f58('0x11')](_0x3ec7a9));if(_0x3ec7a9['error']){if(_0x3ec7a9['error']['code']===0x1f4){logger[_0x2f58('0x12')](_0x2f58('0xe'),_0x7be1d6,_0x3ec7a9['error'][_0x2f58('0x13')]);return _0x8edaab(_0x3ec7a9['error'][_0x2f58('0x13')]);}logger[_0x2f58('0x12')]('SquareOdbc,\x20%s,\x20%s',_0x7be1d6,_0x3ec7a9['error'][_0x2f58('0x13')]);return _0x3c58cc(_0x3ec7a9[_0x2f58('0x12')]['message']);}else{logger[_0x2f58('0x14')](_0x2f58('0xe'),_0x7be1d6,_0x2f58('0x10'));_0x3c58cc(_0x3ec7a9['result'][_0x2f58('0x13')]);}})[_0x2f58('0x15')](function(_0x3e5201){logger[_0x2f58('0x12')]('SquareOdbc,\x20%s,\x20%s',_0x7be1d6,_0x3e5201);_0x8edaab(_0x3e5201);});});}exports['ShowSquareOdbc']=function(_0x1e03c9){var _0xc6f5f0=this;return new Promise(function(_0x3db9ea,_0x3e9352){return db['SquareOdbc'][_0x2f58('0x16')]({'raw':_0x1e03c9['options']?_0x1e03c9['options'][_0x2f58('0x17')]===undefined?!![]:![]:!![],'where':_0x1e03c9['options']?_0x1e03c9[_0x2f58('0x18')][_0x2f58('0x19')]||null:null,'attributes':_0x1e03c9['options']?_0x1e03c9[_0x2f58('0x18')][_0x2f58('0x1a')]||null:null,'include':_0x1e03c9[_0x2f58('0x18')]?_0x1e03c9[_0x2f58('0x18')][_0x2f58('0x1b')]?_[_0x2f58('0x1c')](_0x1e03c9[_0x2f58('0x18')][_0x2f58('0x1b')],function(_0x3b817f){return{'model':db[_0x3b817f[_0x2f58('0x1d')]],'as':_0x3b817f['as'],'attributes':_0x3b817f['attributes'],'include':_0x3b817f[_0x2f58('0x1b')]?_[_0x2f58('0x1c')](_0x3b817f[_0x2f58('0x1b')],function(_0x2d1079){return{'model':db[_0x2d1079[_0x2f58('0x1d')]],'as':_0x2d1079['as'],'attributes':_0x2d1079[_0x2f58('0x1a')],'include':_0x2d1079[_0x2f58('0x1b')]?_[_0x2f58('0x1c')](_0x2d1079[_0x2f58('0x1b')],function(_0x47f4ec){return{'model':db[_0x47f4ec['model']],'as':_0x47f4ec['as'],'attributes':_0x47f4ec[_0x2f58('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x2f58('0x1e')](function(_0x43bf13){logger[_0x2f58('0x14')]('ShowSquareOdbc',_0x1e03c9);logger[_0x2f58('0xf')]('ShowSquareOdbc',_0x1e03c9,JSON[_0x2f58('0x11')](_0x43bf13));_0x3db9ea(_0x43bf13);})[_0x2f58('0x15')](function(_0x1f9b82){logger[_0x2f58('0x12')](_0x2f58('0x1f'),_0x1f9b82[_0x2f58('0x13')],_0x1e03c9);_0x3e9352(_0xc6f5f0[_0x2f58('0x12')](0x1f4,_0x1f9b82['message']));});});}; \ No newline at end of file +var _0x5308=['../../config/environment','client','http','request','info','SquareOdbc,\x20%s,\x20%s','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','SquareOdbc','options','raw','where','attributes','map','include','model','then','debug','ShowSquareOdbc','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x1e925e,_0x21f88e){var _0x56098e=function(_0x2bc666){while(--_0x2bc666){_0x1e925e['push'](_0x1e925e['shift']());}};_0x56098e(++_0x21f88e);}(_0x5308,0x1d8));var _0x8530=function(_0x58e469,_0x95ee3e){_0x58e469=_0x58e469-0x0;var _0x4c01c5=_0x5308[_0x58e469];return _0x4c01c5;};'use strict';var _=require(_0x8530('0x0'));var util=require('util');var moment=require(_0x8530('0x1'));var BPromise=require(_0x8530('0x2'));var rs=require(_0x8530('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8530('0x4'))['db'];var utils=require(_0x8530('0x5'));var logger=require(_0x8530('0x6'))(_0x8530('0x7'));var config=require(_0x8530('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x8530('0x9')][_0x8530('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1002e3,_0x543b90,_0x42e37b){return new BPromise(function(_0x36289e,_0x13ef98){return client[_0x8530('0xb')](_0x1002e3,_0x42e37b)['then'](function(_0x329fcd){logger[_0x8530('0xc')](_0x8530('0xd'),_0x543b90,'request\x20sent');logger['debug'](_0x8530('0xe'),_0x543b90,'request\x20sent',JSON[_0x8530('0xf')](_0x329fcd));if(_0x329fcd[_0x8530('0x10')]){if(_0x329fcd['error']['code']===0x1f4){logger['error'](_0x8530('0xd'),_0x543b90,_0x329fcd[_0x8530('0x10')][_0x8530('0x11')]);return _0x13ef98(_0x329fcd[_0x8530('0x10')]['message']);}logger[_0x8530('0x10')](_0x8530('0xd'),_0x543b90,_0x329fcd['error'][_0x8530('0x11')]);return _0x36289e(_0x329fcd[_0x8530('0x10')][_0x8530('0x11')]);}else{logger['info'](_0x8530('0xd'),_0x543b90,_0x8530('0x12'));_0x36289e(_0x329fcd[_0x8530('0x13')][_0x8530('0x11')]);}})[_0x8530('0x14')](function(_0x20df03){logger[_0x8530('0x10')](_0x8530('0xd'),_0x543b90,_0x20df03);_0x13ef98(_0x20df03);});});}exports['ShowSquareOdbc']=function(_0x39b8a9){var _0x3755f9=this;return new Promise(function(_0x88f24e,_0x2bbdc1){return db[_0x8530('0x15')]['find']({'raw':_0x39b8a9[_0x8530('0x16')]?_0x39b8a9['options'][_0x8530('0x17')]===undefined?!![]:![]:!![],'where':_0x39b8a9['options']?_0x39b8a9['options'][_0x8530('0x18')]||null:null,'attributes':_0x39b8a9['options']?_0x39b8a9[_0x8530('0x16')][_0x8530('0x19')]||null:null,'include':_0x39b8a9['options']?_0x39b8a9['options']['include']?_[_0x8530('0x1a')](_0x39b8a9['options'][_0x8530('0x1b')],function(_0x2a6220){return{'model':db[_0x2a6220[_0x8530('0x1c')]],'as':_0x2a6220['as'],'attributes':_0x2a6220[_0x8530('0x19')],'include':_0x2a6220[_0x8530('0x1b')]?_[_0x8530('0x1a')](_0x2a6220['include'],function(_0x120586){return{'model':db[_0x120586[_0x8530('0x1c')]],'as':_0x120586['as'],'attributes':_0x120586[_0x8530('0x19')],'include':_0x120586[_0x8530('0x1b')]?_[_0x8530('0x1a')](_0x120586['include'],function(_0x4045b9){return{'model':db[_0x4045b9[_0x8530('0x1c')]],'as':_0x4045b9['as'],'attributes':_0x4045b9[_0x8530('0x19')]};}):[]};}):[]};}):[]:[]})[_0x8530('0x1d')](function(_0x2d35c0){logger[_0x8530('0xc')]('ShowSquareOdbc',_0x39b8a9);logger[_0x8530('0x1e')](_0x8530('0x1f'),_0x39b8a9,JSON['stringify'](_0x2d35c0));_0x88f24e(_0x2d35c0);})[_0x8530('0x14')](function(_0x26ee5a){logger[_0x8530('0x10')](_0x8530('0x1f'),_0x26ee5a[_0x8530('0x11')],_0x39b8a9);_0x2bbdc1(_0x3755f9['error'](0x1f4,_0x26ee5a[_0x8530('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 8bb68e5..e12723a 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 _0x24a0=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','./squareProject.controller','isAuthenticated','get','/:id','create'];(function(_0x499210,_0x325b29){var _0x2e153d=function(_0x951263){while(--_0x951263){_0x499210['push'](_0x499210['shift']());}};_0x2e153d(++_0x325b29);}(_0x24a0,0x148));var _0x024a=function(_0x1745f8,_0x117055){_0x1745f8=_0x1745f8-0x0;var _0x3a6f17=_0x24a0[_0x1745f8];return _0x3a6f17;};'use strict';var multer=require(_0x024a('0x0'));var util=require(_0x024a('0x1'));var path=require(_0x024a('0x2'));var timeout=require(_0x024a('0x3'));var express=require(_0x024a('0x4'));var router=express['Router']();var fs_extra=require(_0x024a('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x024a('0x6'));var config=require('../../config/environment');var controller=require(_0x024a('0x7'));router['get']('/',auth[_0x024a('0x8')](),controller['index']);router[_0x024a('0x9')](_0x024a('0xa'),auth[_0x024a('0x8')](),controller['show']);router['post']('/',auth[_0x024a('0x8')](),controller[_0x024a('0xb')]);router[_0x024a('0xc')]('/:id',auth[_0x024a('0x8')](),controller[_0x024a('0xd')]);router[_0x024a('0xe')](_0x024a('0xa'),auth[_0x024a('0x8')](),controller[_0x024a('0xf')]);module[_0x024a('0x10')]=router; \ No newline at end of file +var _0xe305=['path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','exports','util'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe305,0x1d3));var _0x5e30=function(_0x23957f,_0x122338){_0x23957f=_0x23957f-0x0;var _0x1291cb=_0xe305[_0x23957f];return _0x1291cb;};'use strict';var multer=require('multer');var util=require(_0x5e30('0x0'));var path=require(_0x5e30('0x1'));var timeout=require(_0x5e30('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x5e30('0x3'));var interaction=require(_0x5e30('0x4'));var config=require(_0x5e30('0x5'));var controller=require(_0x5e30('0x6'));router[_0x5e30('0x7')]('/',auth[_0x5e30('0x8')](),controller[_0x5e30('0x9')]);router[_0x5e30('0x7')](_0x5e30('0xa'),auth['isAuthenticated'](),controller[_0x5e30('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x5e30('0xc')]);router[_0x5e30('0xd')]('/:id',auth[_0x5e30('0x8')](),controller[_0x5e30('0xe')]);router[_0x5e30('0xf')](_0x5e30('0xa'),auth['isAuthenticated'](),controller[_0x5e30('0x10')]);module[_0x5e30('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 59aaf8d..42e9015 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 _0x4a03=['preproduction','getDataValue','toString','utf8','production','DATE','exports','STRING','name','TEXT','BLOB','long'];(function(_0xccd4d3,_0xec2028){var _0xca752=function(_0x42de71){while(--_0x42de71){_0xccd4d3['push'](_0xccd4d3['shift']());}};_0xca752(++_0xec2028);}(_0x4a03,0x16e));var _0x34a0=function(_0x11ceb6,_0x4ed25c){_0x11ceb6=_0x11ceb6-0x0;var _0x50595c=_0x4a03[_0x11ceb6];return _0x50595c;};'use strict';var Sequelize=require('sequelize');module[_0x34a0('0x0')]={'name':{'type':Sequelize[_0x34a0('0x1')],'unique':_0x34a0('0x2'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize[_0x34a0('0x3')]},'preproduction':{'type':Sequelize[_0x34a0('0x4')](_0x34a0('0x5')),'get':function(){if(this['getDataValue'](_0x34a0('0x6'))){return this[_0x34a0('0x7')]('preproduction')[_0x34a0('0x8')](_0x34a0('0x9'));}}},'production':{'type':Sequelize['BLOB'](_0x34a0('0x5')),'get':function(){if(this[_0x34a0('0x7')]('production')){return this[_0x34a0('0x7')](_0x34a0('0xa'))[_0x34a0('0x8')](_0x34a0('0x9'));}}},'savedAt':{'type':Sequelize[_0x34a0('0xb')]},'publishedAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0x2c70=['getDataValue','preproduction','toString','utf8','BLOB','long','production','DATE','sequelize','STRING','TEXT'];(function(_0x4b6484,_0x13a951){var _0x48bec3=function(_0x531efe){while(--_0x531efe){_0x4b6484['push'](_0x4b6484['shift']());}};_0x48bec3(++_0x13a951);}(_0x2c70,0x19f));var _0x02c7=function(_0x37931a,_0x37f53c){_0x37931a=_0x37931a-0x0;var _0x506e66=_0x2c70[_0x37931a];return _0x506e66;};'use strict';var Sequelize=require(_0x02c7('0x0'));module['exports']={'name':{'type':Sequelize[_0x02c7('0x1')],'unique':'name','allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize[_0x02c7('0x2')]},'preproduction':{'type':Sequelize['BLOB']('long'),'get':function(){if(this[_0x02c7('0x3')](_0x02c7('0x4'))){return this['getDataValue'](_0x02c7('0x4'))[_0x02c7('0x5')](_0x02c7('0x6'));}}},'production':{'type':Sequelize[_0x02c7('0x7')](_0x02c7('0x8')),'get':function(){if(this[_0x02c7('0x3')](_0x02c7('0x9'))){return this['getDataValue'](_0x02c7('0x9'))['toString'](_0x02c7('0x6'));}}},'savedAt':{'type':Sequelize[_0x02c7('0xa')]},'publishedAt':{'type':Sequelize[_0x02c7('0xa')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 6309fa1..bc04229 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 _0xe8d5=['map','SquareProject','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','body','agi','production','lodash','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','socket.io-emitter','status','offset','undefined','limit','count','Content-Range','json','destroy','then','get','SquareProjects','UserProfileResource','publish','stringify','end','sendStatus','error','stack','name','send'];(function(_0xb8a736,_0x1bbded){var _0x54dc30=function(_0x3b36fe){while(--_0x3b36fe){_0xb8a736['push'](_0xb8a736['shift']());}};_0x54dc30(++_0x1bbded);}(_0xe8d5,0x138));var _0x5e8d=function(_0xaa0309,_0x1c8008){_0xaa0309=_0xaa0309-0x0;var _0x5de7ce=_0xe8d5[_0xaa0309];return _0x5de7ce;};'use strict';var _=require(_0x5e8d('0x0'));var Redis=require(_0x5e8d('0x1'));var qs=require(_0x5e8d('0x2'));var logger=require(_0x5e8d('0x3'))('api');var config=require(_0x5e8d('0x4'));var db=require(_0x5e8d('0x5'))['db'];config[_0x5e8d('0x6')]=_['defaults'](config[_0x5e8d('0x6')],{'host':'localhost','port':0x18eb});var socket=require(_0x5e8d('0x7'))(new Redis(config[_0x5e8d('0x6')]));require('./squareProject.socket')['register'](socket);function respondWithResult(_0x3404fd,_0x5a2945){_0x5a2945=_0x5a2945||0xc8;return function(_0xd47817){if(_0xd47817){return _0x3404fd[_0x5e8d('0x8')](_0x5a2945)['json'](_0xd47817);}};}function respondWithFilteredResult(_0x4db909,_0x107ca5){return function(_0x195047){if(_0x195047){var _0x105385=typeof _0x107ca5[_0x5e8d('0x9')]===_0x5e8d('0xa')&&typeof _0x107ca5[_0x5e8d('0xb')]===_0x5e8d('0xa');var _0x1a8119=_0x195047[_0x5e8d('0xc')];var _0x44365c=_0x105385?0x0:_0x107ca5[_0x5e8d('0x9')];var _0x423ae0=_0x105385?_0x195047[_0x5e8d('0xc')]:_0x107ca5[_0x5e8d('0x9')]+_0x107ca5['limit'];var _0x57e44f;if(_0x423ae0>=_0x1a8119){_0x423ae0=_0x1a8119;_0x57e44f=0xc8;}else{_0x57e44f=0xce;}_0x4db909[_0x5e8d('0x8')](_0x57e44f);return _0x4db909['set'](_0x5e8d('0xd'),_0x44365c+'-'+_0x423ae0+'/'+_0x1a8119)[_0x5e8d('0xe')](_0x195047);}return null;};}function saveUpdates(_0x348c1a){return function(_0x114ba0){if(_0x114ba0){return _0x114ba0['update'](_0x348c1a)['then'](function(_0xbbaa8c){return _0xbbaa8c;});}return null;};}function removeEntity(_0x5291b6){return function(_0x3ac4db){if(_0x3ac4db){return _0x3ac4db[_0x5e8d('0xf')]()[_0x5e8d('0x10')](function(){var _0x5eb633=_0x3ac4db[_0x5e8d('0x11')]({'plain':!![]});var _0x5d39be=_0x5e8d('0x12');return db[_0x5e8d('0x13')][_0x5e8d('0xf')]({'where':{'type':_0x5d39be,'resourceId':_0x5eb633['id']}})[_0x5e8d('0x10')](function(){return _0x3ac4db;});})[_0x5e8d('0x10')](function(){var _0x2ebc3f=new Redis(config[_0x5e8d('0x6')]);_0x2ebc3f[_0x5e8d('0x14')]('agi',JSON[_0x5e8d('0x15')]({'id':_0x3ac4db['id'],'deleted':!![]}));})[_0x5e8d('0x10')](function(){_0x5291b6[_0x5e8d('0x8')](0xcc)[_0x5e8d('0x16')]();});}};}function handleEntityNotFound(_0xf77635){return function(_0x5e3d3e){if(!_0x5e3d3e){_0xf77635[_0x5e8d('0x17')](0x194);}return _0x5e3d3e;};}function handleError(_0x2f90c6,_0x3bfc2f){_0x3bfc2f=_0x3bfc2f||0x1f4;return function(_0x537beb){logger[_0x5e8d('0x18')](_0x537beb[_0x5e8d('0x19')]);if(_0x537beb[_0x5e8d('0x1a')]){delete _0x537beb[_0x5e8d('0x1a')];}_0x2f90c6[_0x5e8d('0x8')](_0x3bfc2f)[_0x5e8d('0x1b')](_0x537beb);};}exports['index']=function(_0x174316,_0xb4538c){var _0x393f45={},_0xa7db73={},_0x1fb3ab={'count':0x0,'rows':[]};var _0xac052c=_[_0x5e8d('0x1c')](db[_0x5e8d('0x1d')][_0x5e8d('0x1e')],function(_0x148c0f){return{'name':_0x148c0f[_0x5e8d('0x1f')],'type':_0x148c0f[_0x5e8d('0x20')][_0x5e8d('0x21')]};});_0xa7db73[_0x5e8d('0x22')]=_[_0x5e8d('0x1c')](_0xac052c,_0x5e8d('0x1a'));_0xa7db73[_0x5e8d('0x23')]=_['keys'](_0x174316[_0x5e8d('0x23')]);_0xa7db73[_0x5e8d('0x24')]=_['intersection'](_0xa7db73[_0x5e8d('0x22')],_0xa7db73[_0x5e8d('0x23')]);_0x393f45[_0x5e8d('0x25')]=_[_0x5e8d('0x26')](_0xa7db73[_0x5e8d('0x22')],qs[_0x5e8d('0x27')](_0x174316[_0x5e8d('0x23')]['fields']));_0x393f45['attributes']=_0x393f45[_0x5e8d('0x25')][_0x5e8d('0x28')]?_0x393f45[_0x5e8d('0x25')]:_0xa7db73[_0x5e8d('0x22')];if(!_0x174316[_0x5e8d('0x23')][_0x5e8d('0x29')](_0x5e8d('0x2a'))){_0x393f45[_0x5e8d('0xb')]=qs['limit'](_0x174316[_0x5e8d('0x23')]['limit']);_0x393f45[_0x5e8d('0x9')]=qs[_0x5e8d('0x9')](_0x174316[_0x5e8d('0x23')][_0x5e8d('0x9')]);}_0x393f45['order']=qs['sort'](_0x174316[_0x5e8d('0x23')][_0x5e8d('0x2b')]);_0x393f45[_0x5e8d('0x2c')]=qs[_0x5e8d('0x24')](_[_0x5e8d('0x2d')](_0x174316['query'],_0xa7db73[_0x5e8d('0x24')]),_0xac052c);if(_0x174316[_0x5e8d('0x23')]['filter']){_0x393f45['where']=_[_0x5e8d('0x2e')](_0x393f45['where'],{'$or':_[_0x5e8d('0x1c')](_0xac052c,function(_0x27f3c9){if(_0x27f3c9['type']!==_0x5e8d('0x2f')){var _0x23d141={};_0x23d141[_0x27f3c9[_0x5e8d('0x1a')]]={'$like':'%'+_0x174316[_0x5e8d('0x23')][_0x5e8d('0x30')]+'%'};return _0x23d141;}})});}_0x393f45=_[_0x5e8d('0x2e')]({},_0x393f45,_0x174316[_0x5e8d('0x31')]);var _0x2f7571={'where':_0x393f45[_0x5e8d('0x2c')]};return db[_0x5e8d('0x1d')][_0x5e8d('0xc')](_0x2f7571)[_0x5e8d('0x10')](function(_0x5f095c){_0x1fb3ab['count']=_0x5f095c;if(_0x174316['query'][_0x5e8d('0x32')]){_0x393f45[_0x5e8d('0x33')]=[{'all':!![]}];}return db['SquareProject'][_0x5e8d('0x34')](_0x393f45);})['then'](function(_0x38b715){_0x1fb3ab[_0x5e8d('0x35')]=_0x38b715;return _0x1fb3ab;})[_0x5e8d('0x10')](respondWithFilteredResult(_0xb4538c,_0x393f45))[_0x5e8d('0x36')](handleError(_0xb4538c,null));};exports[_0x5e8d('0x37')]=function(_0x414709,_0x215e80){var _0x1c7e95={'raw':![],'where':{'id':_0x414709[_0x5e8d('0x38')]['id']}},_0x3beeab={};_0x3beeab[_0x5e8d('0x22')]=_[_0x5e8d('0x39')](db['SquareProject'][_0x5e8d('0x1e')]);_0x3beeab[_0x5e8d('0x23')]=_[_0x5e8d('0x39')](_0x414709[_0x5e8d('0x23')]);_0x3beeab[_0x5e8d('0x24')]=_[_0x5e8d('0x26')](_0x3beeab[_0x5e8d('0x22')],_0x3beeab['query']);_0x1c7e95[_0x5e8d('0x25')]=_[_0x5e8d('0x26')](_0x3beeab['model'],qs['fields'](_0x414709['query'][_0x5e8d('0x27')]));_0x1c7e95[_0x5e8d('0x25')]=_0x1c7e95['attributes']['length']?_0x1c7e95[_0x5e8d('0x25')]:_0x3beeab[_0x5e8d('0x22')];if(_0x414709[_0x5e8d('0x23')][_0x5e8d('0x32')]){_0x1c7e95[_0x5e8d('0x33')]=[{'all':!![]}];}_0x1c7e95=_[_0x5e8d('0x2e')]({},_0x1c7e95,_0x414709['options']);return db[_0x5e8d('0x1d')][_0x5e8d('0x3a')](_0x1c7e95)[_0x5e8d('0x10')](handleEntityNotFound(_0x215e80,null))[_0x5e8d('0x10')](respondWithResult(_0x215e80,null))[_0x5e8d('0x36')](handleError(_0x215e80,null));};exports['create']=function(_0x42fd7d,_0x4a553c){return db[_0x5e8d('0x1d')][_0x5e8d('0x3b')](_0x42fd7d['body'],{})[_0x5e8d('0x10')](function(_0x597ec8){var _0xea1618=_0x42fd7d[_0x5e8d('0x3c')]['get']({'plain':!![]});if(!_0xea1618)throw new Error(_0x5e8d('0x3d'));if(_0xea1618[_0x5e8d('0x3e')]===_0x5e8d('0x3c')){var _0x403eb0=_0x597ec8[_0x5e8d('0x11')]({'plain':!![]});var _0x5b98d0='SquareProjects';return db[_0x5e8d('0x3f')]['find']({'where':{'name':_0x5b98d0,'userProfileId':_0xea1618[_0x5e8d('0x40')]},'raw':!![]})[_0x5e8d('0x10')](function(_0x440578){if(_0x440578&&_0x440578['autoAssociation']===0x0){return db[_0x5e8d('0x13')]['create']({'name':_0x403eb0[_0x5e8d('0x1a')],'resourceId':_0x403eb0['id'],'type':_0x440578['name'],'sectionId':_0x440578['id']},{})['then'](function(){return _0x597ec8;});}else{return _0x597ec8;}})[_0x5e8d('0x36')](function(_0x139004){logger[_0x5e8d('0x18')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x139004);throw _0x139004;});}return _0x597ec8;})[_0x5e8d('0x10')](respondWithResult(_0x4a553c,0xc9))['catch'](handleError(_0x4a553c,null));};exports['update']=function(_0x417b63,_0x141393){if(_0x417b63[_0x5e8d('0x41')]['id']){delete _0x417b63['body']['id'];}return db[_0x5e8d('0x1d')][_0x5e8d('0x3a')]({'where':{'id':_0x417b63['params']['id']}})[_0x5e8d('0x10')](handleEntityNotFound(_0x141393,null))[_0x5e8d('0x10')](saveUpdates(_0x417b63['body'],null))[_0x5e8d('0x10')](function(_0x3ea58a){if(!_0x3ea58a)return;var _0xce43d5=_0x3ea58a[_0x5e8d('0x11')]({'plain':!![]});return _0xce43d5;})[_0x5e8d('0x10')](function(_0x1bdc5f){var _0x1c2df2=new Redis(config[_0x5e8d('0x6')]);_0x1c2df2[_0x5e8d('0x14')](_0x5e8d('0x42'),JSON[_0x5e8d('0x15')](_[_0x5e8d('0x2d')](_0x1bdc5f,['id','name',_0x5e8d('0x43')])));return _0x1bdc5f;})['then'](respondWithResult(_0x141393,null))[_0x5e8d('0x36')](handleError(_0x141393,null));};exports['destroy']=function(_0x42ddc5,_0x5af765){return db[_0x5e8d('0x1d')][_0x5e8d('0x3a')]({'where':{'id':_0x42ddc5['params']['id']}})[_0x5e8d('0x10')](handleEntityNotFound(_0x5af765,null))[_0x5e8d('0x10')](removeEntity(_0x5af765,null))[_0x5e8d('0x36')](handleError(_0x5af765,null));}; \ No newline at end of file +var _0x9364=['UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','lodash','../../config/logger','api','../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter','./squareProject.socket','register','status','json','offset','undefined','limit','count','set','update','then','get','SquareProjects','UserProfileResource','destroy','redis','publish','agi','stringify','end','name','send','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','type','VIRTUAL','merge','SquareProject','include','rows','catch','show','includeAll','find','create','body','user'];(function(_0x45fa43,_0x489dfe){var _0x477cc2=function(_0x44a8d8){while(--_0x44a8d8){_0x45fa43['push'](_0x45fa43['shift']());}};_0x477cc2(++_0x489dfe);}(_0x9364,0x87));var _0x4936=function(_0xc93a87,_0x43e41d){_0xc93a87=_0xc93a87-0x0;var _0x2dca8a=_0x9364[_0xc93a87];return _0x2dca8a;};'use strict';var _=require(_0x4936('0x0'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0x4936('0x1'))(_0x4936('0x2'));var config=require(_0x4936('0x3'));var db=require(_0x4936('0x4'))['db'];config['redis']=_[_0x4936('0x5')](config['redis'],{'host':_0x4936('0x6'),'port':0x18eb});var socket=require(_0x4936('0x7'))(new Redis(config['redis']));require(_0x4936('0x8'))[_0x4936('0x9')](socket);function respondWithResult(_0x382f06,_0x3b2d2b){_0x3b2d2b=_0x3b2d2b||0xc8;return function(_0x3ceb86){if(_0x3ceb86){return _0x382f06[_0x4936('0xa')](_0x3b2d2b)[_0x4936('0xb')](_0x3ceb86);}};}function respondWithFilteredResult(_0xccb12a,_0x6d67c4){return function(_0x165e85){if(_0x165e85){var _0x3c4566=typeof _0x6d67c4[_0x4936('0xc')]===_0x4936('0xd')&&typeof _0x6d67c4[_0x4936('0xe')]===_0x4936('0xd');var _0x352d44=_0x165e85['count'];var _0x13c57e=_0x3c4566?0x0:_0x6d67c4[_0x4936('0xc')];var _0x49ca8b=_0x3c4566?_0x165e85[_0x4936('0xf')]:_0x6d67c4['offset']+_0x6d67c4[_0x4936('0xe')];var _0x28d618;if(_0x49ca8b>=_0x352d44){_0x49ca8b=_0x352d44;_0x28d618=0xc8;}else{_0x28d618=0xce;}_0xccb12a[_0x4936('0xa')](_0x28d618);return _0xccb12a[_0x4936('0x10')]('Content-Range',_0x13c57e+'-'+_0x49ca8b+'/'+_0x352d44)[_0x4936('0xb')](_0x165e85);}return null;};}function saveUpdates(_0x4a8a23){return function(_0x272228){if(_0x272228){return _0x272228[_0x4936('0x11')](_0x4a8a23)[_0x4936('0x12')](function(_0x574148){return _0x574148;});}return null;};}function removeEntity(_0xfbe6ad){return function(_0x49b4cb){if(_0x49b4cb){return _0x49b4cb['destroy']()[_0x4936('0x12')](function(){var _0x297585=_0x49b4cb[_0x4936('0x13')]({'plain':!![]});var _0x42d165=_0x4936('0x14');return db[_0x4936('0x15')][_0x4936('0x16')]({'where':{'type':_0x42d165,'resourceId':_0x297585['id']}})[_0x4936('0x12')](function(){return _0x49b4cb;});})[_0x4936('0x12')](function(){var _0x3b9476=new Redis(config[_0x4936('0x17')]);_0x3b9476[_0x4936('0x18')](_0x4936('0x19'),JSON[_0x4936('0x1a')]({'id':_0x49b4cb['id'],'deleted':!![]}));})[_0x4936('0x12')](function(){_0xfbe6ad[_0x4936('0xa')](0xcc)[_0x4936('0x1b')]();});}};}function handleEntityNotFound(_0x1290f){return function(_0x3682e3){if(!_0x3682e3){_0x1290f['sendStatus'](0x194);}return _0x3682e3;};}function handleError(_0x13b7b3,_0x4ebfb0){_0x4ebfb0=_0x4ebfb0||0x1f4;return function(_0x15d999){logger['error'](_0x15d999['stack']);if(_0x15d999[_0x4936('0x1c')]){delete _0x15d999[_0x4936('0x1c')];}_0x13b7b3['status'](_0x4ebfb0)[_0x4936('0x1d')](_0x15d999);};}exports['index']=function(_0x4c5afc,_0x4f2bc3){var _0x1af963={},_0x1fce61={},_0x520607={'count':0x0,'rows':[]};var _0x1dd72d=_[_0x4936('0x1e')](db['SquareProject'][_0x4936('0x1f')],function(_0x41eaca){return{'name':_0x41eaca[_0x4936('0x20')],'type':_0x41eaca['type'][_0x4936('0x21')]};});_0x1fce61[_0x4936('0x22')]=_['map'](_0x1dd72d,'name');_0x1fce61[_0x4936('0x23')]=_[_0x4936('0x24')](_0x4c5afc['query']);_0x1fce61[_0x4936('0x25')]=_[_0x4936('0x26')](_0x1fce61[_0x4936('0x22')],_0x1fce61[_0x4936('0x23')]);_0x1af963[_0x4936('0x27')]=_[_0x4936('0x26')](_0x1fce61[_0x4936('0x22')],qs[_0x4936('0x28')](_0x4c5afc[_0x4936('0x23')][_0x4936('0x28')]));_0x1af963[_0x4936('0x27')]=_0x1af963[_0x4936('0x27')][_0x4936('0x29')]?_0x1af963[_0x4936('0x27')]:_0x1fce61['model'];if(!_0x4c5afc['query']['hasOwnProperty'](_0x4936('0x2a'))){_0x1af963[_0x4936('0xe')]=qs['limit'](_0x4c5afc[_0x4936('0x23')]['limit']);_0x1af963['offset']=qs[_0x4936('0xc')](_0x4c5afc[_0x4936('0x23')][_0x4936('0xc')]);}_0x1af963[_0x4936('0x2b')]=qs['sort'](_0x4c5afc[_0x4936('0x23')][_0x4936('0x2c')]);_0x1af963[_0x4936('0x2d')]=qs['filters'](_['pick'](_0x4c5afc['query'],_0x1fce61[_0x4936('0x25')]),_0x1dd72d);if(_0x4c5afc[_0x4936('0x23')][_0x4936('0x2e')]){_0x1af963[_0x4936('0x2d')]=_['merge'](_0x1af963['where'],{'$or':_[_0x4936('0x1e')](_0x1dd72d,function(_0xe6d58c){if(_0xe6d58c[_0x4936('0x2f')]!==_0x4936('0x30')){var _0x472b53={};_0x472b53[_0xe6d58c[_0x4936('0x1c')]]={'$like':'%'+_0x4c5afc[_0x4936('0x23')][_0x4936('0x2e')]+'%'};return _0x472b53;}})});}_0x1af963=_[_0x4936('0x31')]({},_0x1af963,_0x4c5afc['options']);var _0x322a9d={'where':_0x1af963[_0x4936('0x2d')]};return db[_0x4936('0x32')]['count'](_0x322a9d)[_0x4936('0x12')](function(_0x2d0d99){_0x520607[_0x4936('0xf')]=_0x2d0d99;if(_0x4c5afc[_0x4936('0x23')]['includeAll']){_0x1af963[_0x4936('0x33')]=[{'all':!![]}];}return db[_0x4936('0x32')]['findAll'](_0x1af963);})['then'](function(_0x3242c6){_0x520607[_0x4936('0x34')]=_0x3242c6;return _0x520607;})[_0x4936('0x12')](respondWithFilteredResult(_0x4f2bc3,_0x1af963))[_0x4936('0x35')](handleError(_0x4f2bc3,null));};exports[_0x4936('0x36')]=function(_0x534089,_0x2c41a9){var _0x1dd1fb={'raw':![],'where':{'id':_0x534089['params']['id']}},_0x5a9049={};_0x5a9049['model']=_['keys'](db['SquareProject'][_0x4936('0x1f')]);_0x5a9049['query']=_[_0x4936('0x24')](_0x534089[_0x4936('0x23')]);_0x5a9049['filters']=_[_0x4936('0x26')](_0x5a9049[_0x4936('0x22')],_0x5a9049[_0x4936('0x23')]);_0x1dd1fb[_0x4936('0x27')]=_['intersection'](_0x5a9049['model'],qs[_0x4936('0x28')](_0x534089[_0x4936('0x23')]['fields']));_0x1dd1fb['attributes']=_0x1dd1fb[_0x4936('0x27')][_0x4936('0x29')]?_0x1dd1fb[_0x4936('0x27')]:_0x5a9049[_0x4936('0x22')];if(_0x534089[_0x4936('0x23')][_0x4936('0x37')]){_0x1dd1fb[_0x4936('0x33')]=[{'all':!![]}];}_0x1dd1fb=_[_0x4936('0x31')]({},_0x1dd1fb,_0x534089['options']);return db[_0x4936('0x32')][_0x4936('0x38')](_0x1dd1fb)[_0x4936('0x12')](handleEntityNotFound(_0x2c41a9,null))[_0x4936('0x12')](respondWithResult(_0x2c41a9,null))[_0x4936('0x35')](handleError(_0x2c41a9,null));};exports[_0x4936('0x39')]=function(_0x252ef6,_0x5ace68){return db['SquareProject'][_0x4936('0x39')](_0x252ef6[_0x4936('0x3a')],{})['then'](function(_0x2d2cca){var _0x1e514b=_0x252ef6[_0x4936('0x3b')]['get']({'plain':!![]});if(!_0x1e514b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1e514b['role']==='user'){var _0xdb9bcf=_0x2d2cca[_0x4936('0x13')]({'plain':!![]});var _0x2def18=_0x4936('0x14');return db[_0x4936('0x3c')][_0x4936('0x38')]({'where':{'name':_0x2def18,'userProfileId':_0x1e514b['userProfileId']},'raw':!![]})['then'](function(_0x2854bc){if(_0x2854bc&&_0x2854bc[_0x4936('0x3d')]===0x0){return db[_0x4936('0x15')][_0x4936('0x39')]({'name':_0xdb9bcf[_0x4936('0x1c')],'resourceId':_0xdb9bcf['id'],'type':_0x2854bc[_0x4936('0x1c')],'sectionId':_0x2854bc['id']},{})[_0x4936('0x12')](function(){return _0x2d2cca;});}else{return _0x2d2cca;}})[_0x4936('0x35')](function(_0x94c19c){logger[_0x4936('0x3e')](_0x4936('0x3f'),_0x94c19c);throw _0x94c19c;});}return _0x2d2cca;})[_0x4936('0x12')](respondWithResult(_0x5ace68,0xc9))['catch'](handleError(_0x5ace68,null));};exports[_0x4936('0x11')]=function(_0x2f910b,_0x5c96d8){if(_0x2f910b['body']['id']){delete _0x2f910b[_0x4936('0x3a')]['id'];}return db[_0x4936('0x32')][_0x4936('0x38')]({'where':{'id':_0x2f910b[_0x4936('0x40')]['id']}})['then'](handleEntityNotFound(_0x5c96d8,null))[_0x4936('0x12')](saveUpdates(_0x2f910b['body'],null))[_0x4936('0x12')](function(_0x343f76){if(!_0x343f76)return;var _0x38e8ba=_0x343f76['get']({'plain':!![]});return _0x38e8ba;})[_0x4936('0x12')](function(_0x10e07e){var _0x6fe5a6=new Redis(config['redis']);_0x6fe5a6[_0x4936('0x18')]('agi',JSON[_0x4936('0x1a')](_['pick'](_0x10e07e,['id',_0x4936('0x1c'),'production'])));return _0x10e07e;})[_0x4936('0x12')](respondWithResult(_0x5c96d8,null))[_0x4936('0x35')](handleError(_0x5c96d8,null));};exports[_0x4936('0x16')]=function(_0x5817e7,_0x16c221){return db[_0x4936('0x32')]['find']({'where':{'id':_0x5817e7[_0x4936('0x40')]['id']}})[_0x4936('0x12')](handleEntityNotFound(_0x16c221,null))[_0x4936('0x12')](removeEntity(_0x16c221,null))[_0x4936('0x35')](handleError(_0x16c221,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index d0949a1..a8874a8 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 _0xff1b=['update','remove','emit','hasOwnProperty','events','SquareProject'];(function(_0x598475,_0x4405d2){var _0x304ec2=function(_0xc8cb7b){while(--_0xc8cb7b){_0x598475['push'](_0x598475['shift']());}};_0x304ec2(++_0x4405d2);}(_0xff1b,0x16c));var _0xbff1=function(_0x5e7b6c,_0x4916d0){_0x5e7b6c=_0x5e7b6c-0x0;var _0x3afdbd=_0xff1b[_0x5e7b6c];return _0x3afdbd;};'use strict';var EventEmitter=require(_0xbff1('0x0'));var SquareProject=require('../../mysqldb')['db'][_0xbff1('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xbff1('0x2'),'afterDestroy':_0xbff1('0x3')};function emitEvent(_0x5cfb01){return function(_0x1c1838,_0x19078f,_0xd6b3df){SquareProjectEvents[_0xbff1('0x4')](_0x5cfb01+':'+_0x1c1838['id'],_0x1c1838);SquareProjectEvents['emit'](_0x5cfb01,_0x1c1838);_0xd6b3df(null);};}for(var e in events){if(events[_0xbff1('0x5')](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module['exports']=SquareProjectEvents; \ No newline at end of file +var _0x1428=['save','update','remove','emit','exports','../../mysqldb','SquareProject','setMaxListeners'];(function(_0x415d7c,_0x39dec4){var _0x2e5f18=function(_0x419155){while(--_0x419155){_0x415d7c['push'](_0x415d7c['shift']());}};_0x2e5f18(++_0x39dec4);}(_0x1428,0x16d));var _0x8142=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0x1428[_0x47e7cb];return _0x2a8874;};'use strict';var EventEmitter=require('events');var SquareProject=require(_0x8142('0x0'))['db'][_0x8142('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x8142('0x2')](0x0);var events={'afterCreate':_0x8142('0x3'),'afterUpdate':_0x8142('0x4'),'afterDestroy':_0x8142('0x5')};function emitEvent(_0x1b818c){return function(_0x40bb74,_0xdc5a1d,_0x11a92e){SquareProjectEvents[_0x8142('0x6')](_0x1b818c+':'+_0x40bb74['id'],_0x40bb74);SquareProjectEvents[_0x8142('0x6')](_0x1b818c,_0x40bb74);_0x11a92e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module[_0x8142('0x7')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 5bb083b..ae964a1 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 _0x926c=['format','changed','publishedAt','util','../../config/logger','api','bluebird','rimraf','../../config/environment','./squareProject.attributes','exports','define','SquareProject','square_projects','preproduction','savedAt'];(function(_0x273c39,_0x1052e6){var _0x46d6b5=function(_0x44f1fb){while(--_0x44f1fb){_0x273c39['push'](_0x273c39['shift']());}};_0x46d6b5(++_0x1052e6);}(_0x926c,0x193));var _0xc926=function(_0x55aa03,_0x2baa86){_0x55aa03=_0x55aa03-0x0;var _0x26282e=_0x926c[_0x55aa03];return _0x26282e;};'use strict';var _=require('lodash');var util=require(_0xc926('0x0'));var logger=require(_0xc926('0x1'))(_0xc926('0x2'));var moment=require('moment');var BPromise=require(_0xc926('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc926('0x4'));var config=require(_0xc926('0x5'));var attributes=require(_0xc926('0x6'));module[_0xc926('0x7')]=function(_0x578d43,_0x4e6bb6){return _0x578d43[_0xc926('0x8')](_0xc926('0x9'),attributes,{'tableName':_0xc926('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x88ff34,_0x407639,_0x225ea5){if(_0x88ff34['changed'](_0xc926('0xb'))){_0x88ff34[_0xc926('0xc')]=moment()[_0xc926('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x88ff34[_0xc926('0xe')]('production')){_0x88ff34[_0xc926('0xf')]=moment()[_0xc926('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}_0x225ea5(null,_0x88ff34);}}});}; \ No newline at end of file +var _0x320e=['YYYY-MM-DD\x20HH:mm:ss','publishedAt','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define','SquareProject','square_projects','changed','preproduction','savedAt','format'];(function(_0x1a0600,_0x41feef){var _0x734670=function(_0x2da4e4){while(--_0x2da4e4){_0x1a0600['push'](_0x1a0600['shift']());}};_0x734670(++_0x41feef);}(_0x320e,0x8a));var _0xe320=function(_0x1bb80c,_0x26d406){_0x1bb80c=_0x1bb80c-0x0;var _0x368f16=_0x320e[_0x1bb80c];return _0x368f16;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe320('0x0'))(_0xe320('0x1'));var moment=require(_0xe320('0x2'));var BPromise=require(_0xe320('0x3'));var rp=require(_0xe320('0x4'));var fs=require('fs');var path=require(_0xe320('0x5'));var rimraf=require(_0xe320('0x6'));var config=require('../../config/environment');var attributes=require('./squareProject.attributes');module[_0xe320('0x7')]=function(_0x288efb,_0x21ac59){return _0x288efb[_0xe320('0x8')](_0xe320('0x9'),attributes,{'tableName':_0xe320('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xdf521f,_0x28a2ee,_0x490830){if(_0xdf521f[_0xe320('0xb')](_0xe320('0xc'))){_0xdf521f[_0xe320('0xd')]=moment()[_0xe320('0xe')](_0xe320('0xf'));}if(_0xdf521f[_0xe320('0xb')]('production')){_0xdf521f[_0xe320('0x10')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x490830(null,_0xdf521f);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index b93131a..3b63c54 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 _0xb9fd=['error','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','defaults','localhost','socket.io-emitter','redis','./squareProject.socket','register','SquareProject','findAll','options','where','attributes','limit','map','include','model','then','info','GetSquareProjects','stringify','message','ShowSquareProject','raw','debug','catch'];(function(_0x23974d,_0x43643f){var _0x50aed1=function(_0xaf5404){while(--_0xaf5404){_0x23974d['push'](_0x23974d['shift']());}};_0x50aed1(++_0x43643f);}(_0xb9fd,0x187));var _0xdb9f=function(_0x1f9503,_0x8e450b){_0x1f9503=_0x1f9503-0x0;var _0xaab94f=_0xb9fd[_0x1f9503];return _0xaab94f;};'use strict';var _=require('lodash');var Redis=require(_0xdb9f('0x0'));var db=require(_0xdb9f('0x1'))['db'];var logger=require(_0xdb9f('0x2'))(_0xdb9f('0x3'));var config=require(_0xdb9f('0x4'));config['redis']=_[_0xdb9f('0x5')](config['redis'],{'host':_0xdb9f('0x6'),'port':0x18eb});var socket=require(_0xdb9f('0x7'))(new Redis(config[_0xdb9f('0x8')]));require(_0xdb9f('0x9'))[_0xdb9f('0xa')](socket);exports['GetSquareProjects']=function(_0x23bd5a){var _0x90ead8=this;return new Promise(function(_0x491528,_0x210608){return db[_0xdb9f('0xb')][_0xdb9f('0xc')]({'raw':_0x23bd5a[_0xdb9f('0xd')]?_0x23bd5a[_0xdb9f('0xd')]['raw']===undefined?!![]:![]:!![],'where':_0x23bd5a[_0xdb9f('0xd')]?_0x23bd5a[_0xdb9f('0xd')][_0xdb9f('0xe')]||null:null,'attributes':_0x23bd5a['options']?_0x23bd5a['options'][_0xdb9f('0xf')]||null:null,'limit':_0x23bd5a[_0xdb9f('0xd')]?_0x23bd5a[_0xdb9f('0xd')][_0xdb9f('0x10')]||null:null,'include':_0x23bd5a[_0xdb9f('0xd')]?_0x23bd5a[_0xdb9f('0xd')]['include']?_[_0xdb9f('0x11')](_0x23bd5a[_0xdb9f('0xd')][_0xdb9f('0x12')],function(_0x1e255e){return{'model':db[_0x1e255e[_0xdb9f('0x13')]],'as':_0x1e255e['as'],'attributes':_0x1e255e[_0xdb9f('0xf')],'include':_0x1e255e[_0xdb9f('0x12')]?_['map'](_0x1e255e['include'],function(_0x436338){return{'model':db[_0x436338['model']],'as':_0x436338['as'],'attributes':_0x436338[_0xdb9f('0xf')],'include':_0x436338[_0xdb9f('0x12')]?_['map'](_0x436338[_0xdb9f('0x12')],function(_0x1167a5){return{'model':db[_0x1167a5[_0xdb9f('0x13')]],'as':_0x1167a5['as'],'attributes':_0x1167a5['attributes']};}):[]};}):[]};}):[]:[]})[_0xdb9f('0x14')](function(_0x78e4ac){logger[_0xdb9f('0x15')](_0xdb9f('0x16'),_0x23bd5a);logger['debug'](_0xdb9f('0x16'),_0x23bd5a,JSON[_0xdb9f('0x17')](_0x78e4ac));_0x491528(_0x78e4ac);})['catch'](function(_0x25dac9){logger['error'](_0xdb9f('0x16'),_0x25dac9[_0xdb9f('0x18')],_0x23bd5a);_0x210608(_0x90ead8['error'](0x1f4,_0x25dac9[_0xdb9f('0x18')]));});});};exports[_0xdb9f('0x19')]=function(_0x2c37eb){var _0x23dcf6=this;return new Promise(function(_0xfabb56,_0x424659){return db['SquareProject']['find']({'raw':_0x2c37eb[_0xdb9f('0xd')]?_0x2c37eb['options'][_0xdb9f('0x1a')]===undefined?!![]:![]:!![],'where':_0x2c37eb[_0xdb9f('0xd')]?_0x2c37eb[_0xdb9f('0xd')]['where']||null:null,'attributes':_0x2c37eb[_0xdb9f('0xd')]?_0x2c37eb[_0xdb9f('0xd')][_0xdb9f('0xf')]||null:null,'include':_0x2c37eb[_0xdb9f('0xd')]?_0x2c37eb[_0xdb9f('0xd')][_0xdb9f('0x12')]?_[_0xdb9f('0x11')](_0x2c37eb['options']['include'],function(_0x2c0018){return{'model':db[_0x2c0018['model']],'as':_0x2c0018['as'],'attributes':_0x2c0018[_0xdb9f('0xf')],'include':_0x2c0018[_0xdb9f('0x12')]?_[_0xdb9f('0x11')](_0x2c0018['include'],function(_0x20001c){return{'model':db[_0x20001c[_0xdb9f('0x13')]],'as':_0x20001c['as'],'attributes':_0x20001c[_0xdb9f('0xf')],'include':_0x20001c[_0xdb9f('0x12')]?_[_0xdb9f('0x11')](_0x20001c[_0xdb9f('0x12')],function(_0x5c3a19){return{'model':db[_0x5c3a19[_0xdb9f('0x13')]],'as':_0x5c3a19['as'],'attributes':_0x5c3a19[_0xdb9f('0xf')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x580528){logger[_0xdb9f('0x15')](_0xdb9f('0x19'),_0x2c37eb);logger[_0xdb9f('0x1b')]('ShowSquareProject',_0x2c37eb,JSON[_0xdb9f('0x17')](_0x580528));_0xfabb56(_0x580528);})[_0xdb9f('0x1c')](function(_0x3e4dd2){logger[_0xdb9f('0x1d')](_0xdb9f('0x19'),_0x3e4dd2[_0xdb9f('0x18')],_0x2c37eb);_0x424659(_0x23dcf6[_0xdb9f('0x1d')](0x1f4,_0x3e4dd2['message']));});});}; \ No newline at end of file +var _0x4354=['redis','localhost','socket.io-emitter','./squareProject.socket','register','GetSquareProjects','SquareProject','options','raw','where','limit','include','map','model','attributes','then','info','debug','catch','error','message','ShowSquareProject','stringify','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0xada054,_0x79cdfc){var _0x135102=function(_0x34499c){while(--_0x34499c){_0xada054['push'](_0xada054['shift']());}};_0x135102(++_0x79cdfc);}(_0x4354,0xf7));var _0x4435=function(_0x4c69ac,_0x4418ea){_0x4c69ac=_0x4c69ac-0x0;var _0x13d05e=_0x4354[_0x4c69ac];return _0x13d05e;};'use strict';var _=require('lodash');var Redis=require(_0x4435('0x0'));var db=require(_0x4435('0x1'))['db'];var logger=require(_0x4435('0x2'))(_0x4435('0x3'));var config=require(_0x4435('0x4'));config[_0x4435('0x5')]=_['defaults'](config[_0x4435('0x5')],{'host':_0x4435('0x6'),'port':0x18eb});var socket=require(_0x4435('0x7'))(new Redis(config['redis']));require(_0x4435('0x8'))[_0x4435('0x9')](socket);exports[_0x4435('0xa')]=function(_0x1e9504){var _0x486d4d=this;return new Promise(function(_0x40ac3b,_0x5cf680){return db[_0x4435('0xb')]['findAll']({'raw':_0x1e9504[_0x4435('0xc')]?_0x1e9504[_0x4435('0xc')][_0x4435('0xd')]===undefined?!![]:![]:!![],'where':_0x1e9504[_0x4435('0xc')]?_0x1e9504[_0x4435('0xc')][_0x4435('0xe')]||null:null,'attributes':_0x1e9504['options']?_0x1e9504['options']['attributes']||null:null,'limit':_0x1e9504['options']?_0x1e9504[_0x4435('0xc')][_0x4435('0xf')]||null:null,'include':_0x1e9504[_0x4435('0xc')]?_0x1e9504[_0x4435('0xc')][_0x4435('0x10')]?_[_0x4435('0x11')](_0x1e9504[_0x4435('0xc')][_0x4435('0x10')],function(_0x499f9d){return{'model':db[_0x499f9d[_0x4435('0x12')]],'as':_0x499f9d['as'],'attributes':_0x499f9d['attributes'],'include':_0x499f9d[_0x4435('0x10')]?_[_0x4435('0x11')](_0x499f9d[_0x4435('0x10')],function(_0x5f4da4){return{'model':db[_0x5f4da4[_0x4435('0x12')]],'as':_0x5f4da4['as'],'attributes':_0x5f4da4['attributes'],'include':_0x5f4da4[_0x4435('0x10')]?_[_0x4435('0x11')](_0x5f4da4[_0x4435('0x10')],function(_0x2a6e05){return{'model':db[_0x2a6e05[_0x4435('0x12')]],'as':_0x2a6e05['as'],'attributes':_0x2a6e05[_0x4435('0x13')]};}):[]};}):[]};}):[]:[]})[_0x4435('0x14')](function(_0x273450){logger[_0x4435('0x15')](_0x4435('0xa'),_0x1e9504);logger[_0x4435('0x16')]('GetSquareProjects',_0x1e9504,JSON['stringify'](_0x273450));_0x40ac3b(_0x273450);})[_0x4435('0x17')](function(_0x5daa19){logger[_0x4435('0x18')]('GetSquareProjects',_0x5daa19[_0x4435('0x19')],_0x1e9504);_0x5cf680(_0x486d4d[_0x4435('0x18')](0x1f4,_0x5daa19[_0x4435('0x19')]));});});};exports[_0x4435('0x1a')]=function(_0x28d3c7){var _0x127c7c=this;return new Promise(function(_0x398d1e,_0x202ad3){return db[_0x4435('0xb')]['find']({'raw':_0x28d3c7[_0x4435('0xc')]?_0x28d3c7['options'][_0x4435('0xd')]===undefined?!![]:![]:!![],'where':_0x28d3c7[_0x4435('0xc')]?_0x28d3c7['options'][_0x4435('0xe')]||null:null,'attributes':_0x28d3c7[_0x4435('0xc')]?_0x28d3c7['options'][_0x4435('0x13')]||null:null,'include':_0x28d3c7['options']?_0x28d3c7[_0x4435('0xc')]['include']?_[_0x4435('0x11')](_0x28d3c7[_0x4435('0xc')][_0x4435('0x10')],function(_0x1698a8){return{'model':db[_0x1698a8[_0x4435('0x12')]],'as':_0x1698a8['as'],'attributes':_0x1698a8[_0x4435('0x13')],'include':_0x1698a8['include']?_[_0x4435('0x11')](_0x1698a8['include'],function(_0x51200d){return{'model':db[_0x51200d[_0x4435('0x12')]],'as':_0x51200d['as'],'attributes':_0x51200d['attributes'],'include':_0x51200d[_0x4435('0x10')]?_['map'](_0x51200d[_0x4435('0x10')],function(_0x4c7f18){return{'model':db[_0x4c7f18[_0x4435('0x12')]],'as':_0x4c7f18['as'],'attributes':_0x4c7f18[_0x4435('0x13')]};}):[]};}):[]};}):[]:[]})[_0x4435('0x14')](function(_0x142803){logger['info']('ShowSquareProject',_0x28d3c7);logger['debug'](_0x4435('0x1a'),_0x28d3c7,JSON[_0x4435('0x1b')](_0x142803));_0x398d1e(_0x142803);})[_0x4435('0x17')](function(_0x41e157){logger[_0x4435('0x18')](_0x4435('0x1a'),_0x41e157[_0x4435('0x19')],_0x28d3c7);_0x202ad3(_0x127c7c[_0x4435('0x18')](0x1f4,_0x41e157[_0x4435('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 5c372a4..18436ce 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 _0x3d6b=['remove','update','emit','removeListener','length','squareProject:','./squareProject.events','save'];(function(_0x364cdc,_0x4bdb15){var _0x5ac378=function(_0xa7a23a){while(--_0xa7a23a){_0x364cdc['push'](_0x364cdc['shift']());}};_0x5ac378(++_0x4bdb15);}(_0x3d6b,0x9e));var _0xb3d6=function(_0x2803ab,_0x1c33f2){_0x2803ab=_0x2803ab-0x0;var _0x3d6e8e=_0x3d6b[_0x2803ab];return _0x3d6e8e;};'use strict';var SquareProjectEvents=require(_0xb3d6('0x0'));var events=[_0xb3d6('0x1'),_0xb3d6('0x2'),_0xb3d6('0x3')];function createListener(_0x5032a4,_0x17a53a){return function(_0x4f6551){_0x17a53a[_0xb3d6('0x4')](_0x5032a4,_0x4f6551);};}function removeListener(_0x1139cd,_0x2afb2f){return function(){SquareProjectEvents[_0xb3d6('0x5')](_0x1139cd,_0x2afb2f);};}exports['register']=function(_0x419178){for(var _0x2f4f42=0x0,_0x5178e4=events[_0xb3d6('0x6')];_0x2f4f42<_0x5178e4;_0x2f4f42++){var _0x25e106=events[_0x2f4f42];var _0x10b4d5=createListener(_0xb3d6('0x7')+_0x25e106,_0x419178);SquareProjectEvents['on'](_0x25e106,_0x10b4d5);}}; \ No newline at end of file +var _0xa8da=['save','remove','update','register','length','squareProject:'];(function(_0x281ba3,_0x35f75b){var _0x51cf9c=function(_0x14818f){while(--_0x14818f){_0x281ba3['push'](_0x281ba3['shift']());}};_0x51cf9c(++_0x35f75b);}(_0xa8da,0x17a));var _0xaa8d=function(_0x22e059,_0x32975e){_0x22e059=_0x22e059-0x0;var _0x41c11e=_0xa8da[_0x22e059];return _0x41c11e;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=[_0xaa8d('0x0'),_0xaa8d('0x1'),_0xaa8d('0x2')];function createListener(_0x321dd3,_0x440a03){return function(_0x1c7cd4){_0x440a03['emit'](_0x321dd3,_0x1c7cd4);};}function removeListener(_0x1c56e9,_0x772789){return function(){SquareProjectEvents['removeListener'](_0x1c56e9,_0x772789);};}exports[_0xaa8d('0x3')]=function(_0x3c67e1){for(var _0xa2b1d8=0x0,_0x20bbf0=events[_0xaa8d('0x4')];_0xa2b1d8<_0x20bbf0;_0xa2b1d8++){var _0x319db6=events[_0xa2b1d8];var _0x3b3e21=createListener(_0xaa8d('0x5')+_0x319db6,_0x3c67e1);SquareProjectEvents['on'](_0x319db6,_0x3b3e21);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 5dc044d..6ed86b0 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(_0x386ac0,_0x53958c){var _0x43de54=function(_0x3ace49){while(--_0x3ace49){_0x386ac0['push'](_0x386ac0['shift']());}};_0x43de54(++_0x53958c);}(_0x53ec,0x192));var _0xc53e=function(_0x15c421,_0x6366f7){_0x15c421=_0x15c421-0x0;var _0x5e5ed5=_0x53ec[_0x15c421];return _0x5e5ed5;};'use strict';var multer=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var path=require(_0xc53e('0x2'));var timeout=require(_0xc53e('0x3'));var express=require(_0xc53e('0x4'));var router=express[_0xc53e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc53e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc53e('0x7'));var controller=require(_0xc53e('0x8'));router['get']('/',auth[_0xc53e('0x9')](),controller['index']);router[_0xc53e('0xa')](_0xc53e('0xb'),auth['isAuthenticated'](),controller[_0xc53e('0xc')]);router[_0xc53e('0xa')](_0xc53e('0xd'),auth[_0xc53e('0x9')](),controller[_0xc53e('0xe')]);router[_0xc53e('0xf')]('/',auth[_0xc53e('0x9')](),controller[_0xc53e('0x10')]);router[_0xc53e('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xc53e('0x12')]);router['delete']('/:id',auth[_0xc53e('0x9')](),controller[_0xc53e('0x13')]);module[_0xc53e('0x14')]=router; \ No newline at end of file +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(_0x64e597,_0x1f5e9d){var _0x14a6c3=function(_0x21b19f){while(--_0x21b19f){_0x64e597['push'](_0x64e597['shift']());}};_0x14a6c3(++_0x1f5e9d);}(_0x4975,0x86));var _0x5497=function(_0x391287,_0x2acad8){_0x391287=_0x391287-0x0;var _0x53fa94=_0x4975[_0x391287];return _0x53fa94;};'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 8419dc4..b6262b7 100644 --- a/server/api/squareRecording/squareRecording.attributes.js +++ b/server/api/squareRecording/squareRecording.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x326f=['getDataValue','sequelize','STRING','VIRTUAL'];(function(_0x19e087,_0x18c45a){var _0x5b0033=function(_0x521831){while(--_0x521831){_0x19e087['push'](_0x19e087['shift']());}};_0x5b0033(++_0x18c45a);}(_0x326f,0xd1));var _0xf326=function(_0x524dfb,_0x19c24c){_0x524dfb=_0x524dfb-0x0;var _0x1ebb2e=_0x326f[_0x524dfb];return _0x1ebb2e;};'use strict';var Sequelize=require(_0xf326('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xf326('0x1')]},'calleridname':{'type':Sequelize[_0xf326('0x1')]},'context':{'type':Sequelize[_0xf326('0x1')]},'extension':{'type':Sequelize[_0xf326('0x1')]},'priority':{'type':Sequelize[_0xf326('0x1')]},'accountcode':{'type':Sequelize[_0xf326('0x1')]},'dnid':{'type':Sequelize[_0xf326('0x1')]},'projectName':{'type':Sequelize[_0xf326('0x1')]},'saveName':{'type':Sequelize[_0xf326('0x1')]},'filename':{'type':Sequelize[_0xf326('0x1')]},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0xf326('0x2')],'get':function(){var _0x3851eb='';var _0x165f95=this[_0xf326('0x3')]('savePath');if(_0x165f95){_0x3851eb=_0x165f95['substring'](_0x165f95['lastIndexOf']('.'));}return _0x3851eb;}}}; \ No newline at end of file +var _0xac31=['STRING','VIRTUAL','savePath','lastIndexOf','sequelize','exports'];(function(_0x3ec5ce,_0x4b97aa){var _0x3a9e68=function(_0x2e2be4){while(--_0x2e2be4){_0x3ec5ce['push'](_0x3ec5ce['shift']());}};_0x3a9e68(++_0x4b97aa);}(_0xac31,0xca));var _0x1ac3=function(_0x4ae1c9,_0x99b14a){_0x4ae1c9=_0x4ae1c9-0x0;var _0x5af8e4=_0xac31[_0x4ae1c9];return _0x5af8e4;};'use strict';var Sequelize=require(_0x1ac3('0x0'));module[_0x1ac3('0x1')]={'uniqueid':{'type':Sequelize[_0x1ac3('0x2')]},'callerid':{'type':Sequelize[_0x1ac3('0x2')]},'calleridname':{'type':Sequelize[_0x1ac3('0x2')]},'context':{'type':Sequelize[_0x1ac3('0x2')]},'extension':{'type':Sequelize[_0x1ac3('0x2')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x1ac3('0x2')]},'dnid':{'type':Sequelize[_0x1ac3('0x2')]},'projectName':{'type':Sequelize['STRING']},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize[_0x1ac3('0x2')]},'savePath':{'type':Sequelize[_0x1ac3('0x2')]},'format':{'type':Sequelize[_0x1ac3('0x3')],'get':function(){var _0x1be223='';var _0x157604=this['getDataValue'](_0x1ac3('0x4'));if(_0x157604){_0x1be223=_0x157604['substring'](_0x157604[_0x1ac3('0x5')]('.'));}return _0x1be223;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 8c4915c..b043d9d 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 _0xabdb=['sort','where','filter','map','type','merge','options','count','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','download','uniqueid','savePath','filename','%s.cypher','secrets','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','extname','unlink','message','send','isNil','Entity\x20not\x20found','info','existsSync','File:\x20\x22','unlinkSync','.cypher','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','Content-Range','reject','save','update','then','destroy','name','index','SquareRecording','fieldName','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','order'];(function(_0x456fb1,_0x859a1d){var _0x4083d6=function(_0xe1d0f2){while(--_0xe1d0f2){_0x456fb1['push'](_0x456fb1['shift']());}};_0x4083d6(++_0x859a1d);}(_0xabdb,0x188));var _0xbabd=function(_0x125813,_0x15dfc7){_0x125813=_0x125813-0x0;var _0x26eda0=_0xabdb[_0x125813];return _0x26eda0;};'use strict';var emlformat=require(_0xbabd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbabd('0x1'));var jsonpatch=require(_0xbabd('0x2'));var rp=require(_0xbabd('0x3'));var moment=require('moment');var BPromise=require(_0xbabd('0x4'));var Mustache=require('mustache');var util=require(_0xbabd('0x5'));var path=require(_0xbabd('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xbabd('0x7'));var fs=require('fs');var fs_extra=require(_0xbabd('0x8'));var _=require(_0xbabd('0x9'));var squel=require('squel');var crypto=require(_0xbabd('0xa'));var jsforce=require(_0xbabd('0xb'));var deskjs=require(_0xbabd('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xbabd('0xd'));var Redis=require('ioredis');var authService=require(_0xbabd('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xbabd('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbabd('0x10'))(_0xbabd('0x11'));var utils=require('../../config/utils');var config=require(_0xbabd('0x12'));var licenseUtil=require(_0xbabd('0x13'));var db=require(_0xbabd('0x14'))['db'];function respondWithStatusCode(_0x59645a,_0x2ea1e9){_0x2ea1e9=_0x2ea1e9||0xcc;return function(_0x2b19dd){if(_0x2b19dd){return _0x59645a[_0xbabd('0x15')](_0x2ea1e9);}return _0x59645a[_0xbabd('0x16')](_0x2ea1e9)[_0xbabd('0x17')]();};}function respondWithResult(_0x4ea92a,_0x34e333){_0x34e333=_0x34e333||0xc8;return function(_0x6542cd){if(_0x6542cd){return _0x4ea92a[_0xbabd('0x16')](_0x34e333)[_0xbabd('0x18')](_0x6542cd);}};}function respondWithFilteredResult(_0x432592,_0x92457b){return function(_0x1f1cbf){if(_0x1f1cbf){var _0x2783a6=typeof _0x92457b[_0xbabd('0x19')]===_0xbabd('0x1a')&&typeof _0x92457b[_0xbabd('0x1b')]===_0xbabd('0x1a');var _0x4dad48=_0x1f1cbf['count'];var _0x487df4=_0x2783a6?0x0:_0x92457b[_0xbabd('0x19')];var _0x4f369a=_0x2783a6?_0x1f1cbf['count']:_0x92457b[_0xbabd('0x19')]+_0x92457b['limit'];var _0x4768fe;if(_0x4f369a>=_0x4dad48){_0x4f369a=_0x4dad48;_0x4768fe=0xc8;}else{_0x4768fe=0xce;}_0x432592['status'](_0x4768fe);return _0x432592['set'](_0xbabd('0x1c'),_0x487df4+'-'+_0x4f369a+'/'+_0x4dad48)[_0xbabd('0x18')](_0x1f1cbf);}return null;};}function patchUpdates(_0x5f5ecc){return function(_0x3a62b5){try{jsonpatch['apply'](_0x3a62b5,_0x5f5ecc,!![]);}catch(_0x3d4b19){return BPromise[_0xbabd('0x1d')](_0x3d4b19);}return _0x3a62b5[_0xbabd('0x1e')]();};}function saveUpdates(_0x53bb4d,_0x1f3679){return function(_0x12963a){if(_0x12963a){return _0x12963a[_0xbabd('0x1f')](_0x53bb4d)[_0xbabd('0x20')](function(_0x4cc067){return _0x4cc067;});}return null;};}function removeEntity(_0x357318,_0x32f4c2){return function(_0x5d8790){if(_0x5d8790){return _0x5d8790[_0xbabd('0x21')]()[_0xbabd('0x20')](function(){_0x357318[_0xbabd('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x252f52,_0x2a767c){return function(_0x3f8208){if(!_0x3f8208){_0x252f52[_0xbabd('0x15')](0x194);}return _0x3f8208;};}function handleError(_0x34cb38,_0x84fba5){_0x84fba5=_0x84fba5||0x1f4;return function(_0x3a1484){logger['error'](_0x3a1484['stack']);if(_0x3a1484[_0xbabd('0x22')]){delete _0x3a1484[_0xbabd('0x22')];}_0x34cb38[_0xbabd('0x16')](_0x84fba5)['send'](_0x3a1484);};}exports[_0xbabd('0x23')]=function(_0x3a4649,_0x155b9d){var _0x29abad={},_0x22169f={},_0x1ef2b6={'count':0x0,'rows':[]};var _0x427568=_['map'](db[_0xbabd('0x24')]['rawAttributes'],function(_0x3c4573){return{'name':_0x3c4573[_0xbabd('0x25')],'type':_0x3c4573['type']['key']};});_0x22169f['model']=_['map'](_0x427568,'name');_0x22169f[_0xbabd('0x26')]=_[_0xbabd('0x27')](_0x3a4649[_0xbabd('0x26')]);_0x22169f[_0xbabd('0x28')]=_[_0xbabd('0x29')](_0x22169f[_0xbabd('0x2a')],_0x22169f[_0xbabd('0x26')]);_0x29abad['attributes']=_[_0xbabd('0x29')](_0x22169f[_0xbabd('0x2a')],qs[_0xbabd('0x2b')](_0x3a4649[_0xbabd('0x26')][_0xbabd('0x2b')]));_0x29abad[_0xbabd('0x2c')]=_0x29abad[_0xbabd('0x2c')][_0xbabd('0x2d')]?_0x29abad[_0xbabd('0x2c')]:_0x22169f[_0xbabd('0x2a')];if(!_0x3a4649[_0xbabd('0x26')][_0xbabd('0x2e')]('nolimit')){_0x29abad[_0xbabd('0x1b')]=qs[_0xbabd('0x1b')](_0x3a4649[_0xbabd('0x26')][_0xbabd('0x1b')]);_0x29abad[_0xbabd('0x19')]=qs['offset'](_0x3a4649[_0xbabd('0x26')]['offset']);}_0x29abad[_0xbabd('0x2f')]=qs[_0xbabd('0x30')](_0x3a4649[_0xbabd('0x26')][_0xbabd('0x30')]);_0x29abad[_0xbabd('0x31')]=qs['filters'](_['pick'](_0x3a4649['query'],_0x22169f[_0xbabd('0x28')]),_0x427568);if(_0x3a4649[_0xbabd('0x26')][_0xbabd('0x32')]){_0x29abad[_0xbabd('0x31')]=_['merge'](_0x29abad['where'],{'$or':_[_0xbabd('0x33')](_0x427568,function(_0x1ff3e1){if(_0x1ff3e1[_0xbabd('0x34')]!=='VIRTUAL'){var _0x5ca893={};_0x5ca893[_0x1ff3e1[_0xbabd('0x22')]]={'$like':'%'+_0x3a4649[_0xbabd('0x26')][_0xbabd('0x32')]+'%'};return _0x5ca893;}})});}_0x29abad=_[_0xbabd('0x35')]({},_0x29abad,_0x3a4649[_0xbabd('0x36')]);var _0x275497={'where':_0x29abad[_0xbabd('0x31')]};return db[_0xbabd('0x24')][_0xbabd('0x37')](_0x275497)[_0xbabd('0x20')](function(_0x13b83d){_0x1ef2b6['count']=_0x13b83d;if(_0x3a4649[_0xbabd('0x26')][_0xbabd('0x38')]){_0x29abad[_0xbabd('0x39')]=[{'all':!![]}];}return db[_0xbabd('0x24')][_0xbabd('0x3a')](_0x29abad);})['then'](function(_0x2d3195){_0x1ef2b6[_0xbabd('0x3b')]=_0x2d3195;return _0x1ef2b6;})[_0xbabd('0x20')](respondWithFilteredResult(_0x155b9d,_0x29abad))[_0xbabd('0x3c')](handleError(_0x155b9d,null));};exports[_0xbabd('0x3d')]=function(_0x1b8a8c,_0x298df8){var _0x5a5641={'raw':!![],'where':{'id':_0x1b8a8c[_0xbabd('0x3e')]['id']}},_0x379153={};_0x379153[_0xbabd('0x2a')]=_[_0xbabd('0x27')](db[_0xbabd('0x24')][_0xbabd('0x3f')]);_0x379153[_0xbabd('0x26')]=_[_0xbabd('0x27')](_0x1b8a8c[_0xbabd('0x26')]);_0x379153[_0xbabd('0x28')]=_[_0xbabd('0x29')](_0x379153[_0xbabd('0x2a')],_0x379153[_0xbabd('0x26')]);_0x5a5641[_0xbabd('0x2c')]=_[_0xbabd('0x29')](_0x379153[_0xbabd('0x2a')],qs[_0xbabd('0x2b')](_0x1b8a8c[_0xbabd('0x26')]['fields']));_0x5a5641['attributes']=_0x5a5641['attributes'][_0xbabd('0x2d')]?_0x5a5641[_0xbabd('0x2c')]:_0x379153[_0xbabd('0x2a')];if(_0x1b8a8c[_0xbabd('0x26')][_0xbabd('0x38')]){_0x5a5641['include']=[{'all':!![]}];}_0x5a5641=_['merge']({},_0x5a5641,_0x1b8a8c[_0xbabd('0x36')]);return db['SquareRecording'][_0xbabd('0x40')](_0x5a5641)[_0xbabd('0x20')](handleEntityNotFound(_0x298df8,null))[_0xbabd('0x20')](respondWithResult(_0x298df8,null))['catch'](handleError(_0x298df8,null));};exports[_0xbabd('0x41')]=function(_0x3af725,_0x432cab){return db[_0xbabd('0x24')][_0xbabd('0x41')](_0x3af725[_0xbabd('0x42')],{})[_0xbabd('0x20')](respondWithResult(_0x432cab,0xc9))[_0xbabd('0x3c')](handleError(_0x432cab,null));};exports[_0xbabd('0x1f')]=function(_0xdf2f34,_0xaae685){if(_0xdf2f34['body']['id']){delete _0xdf2f34['body']['id'];}return db[_0xbabd('0x24')]['find']({'where':{'id':_0xdf2f34[_0xbabd('0x3e')]['id']}})[_0xbabd('0x20')](handleEntityNotFound(_0xaae685,null))[_0xbabd('0x20')](saveUpdates(_0xdf2f34[_0xbabd('0x42')],null))['then'](respondWithResult(_0xaae685,null))['catch'](handleError(_0xaae685,null));};exports[_0xbabd('0x43')]=function(_0x5b0f0a,_0x30779f,_0x2c5204){var _0x2d7093=require('../../components/encryptor');var _0x2c9874=![];var _0x3b5cc9={};if(_0x5b0f0a['query'][_0xbabd('0x34')]&&_0x5b0f0a[_0xbabd('0x26')][_0xbabd('0x34')]===_0xbabd('0x44')){_0x3b5cc9[_0xbabd('0x44')]=_0x5b0f0a[_0xbabd('0x3e')]['id'];}else{_0x3b5cc9['id']=_0x5b0f0a[_0xbabd('0x3e')]['id'];}return db[_0xbabd('0x24')][_0xbabd('0x40')]({'where':_0x3b5cc9,'attributes':['id',_0xbabd('0x45'),_0xbabd('0x46')],'raw':!![]})[_0xbabd('0x20')](handleEntityNotFound(_0x30779f,null))['then'](function(_0x59f400){if(_0x59f400){var _0x2932a1=_0x59f400[_0xbabd('0x45')];var _0x5dfe4d=util['format'](_0xbabd('0x47'),_0x2932a1);if(fs['existsSync'](_0x5dfe4d)){_0x2c9874=!![];return _0x2d7093['decryptFile'](_0x5dfe4d,_0x2932a1,config[_0xbabd('0x48')][_0xbabd('0x49')])[_0xbabd('0x20')](function(){return _0x59f400;});}return _0x59f400;}})[_0xbabd('0x20')](function(_0x569879){if(_0x569879){var _0x409a87=_0x569879[_0xbabd('0x45')];if(!fs['existsSync'](_0x409a87)){throw new db[(_0xbabd('0x4a'))][(_0xbabd('0x4b'))](_0xbabd('0x4c'));}if(_0x569879['filename']){return _0x30779f[_0xbabd('0x43')](_0x409a87,_0x569879[_0xbabd('0x46')]+path[_0xbabd('0x4d')](_0x409a87),function(){if(_0x2c9874){fs[_0xbabd('0x4e')](_0x409a87);}});}else{return _0x30779f['download'](_0x409a87,function(_0x4735f4){if(_0x2c9874){fs[_0xbabd('0x4e')](_0x409a87);}});}}})['catch'](function(_0x54759d){if(_0x54759d[_0xbabd('0x4f')]==='SquareRecording\x20not\x20found'){_0x30779f[_0xbabd('0x16')](0x194)[_0xbabd('0x50')]('Not\x20found');}else{return handleError(_0x30779f,null);}});};exports[_0xbabd('0x21')]=function(_0x5521ec,_0x4a0e5f){return db[_0xbabd('0x24')]['find']({'where':{'id':_0x5521ec[_0xbabd('0x3e')]['id']}})['then'](function(_0xfd2de3){if(_[_0xbabd('0x51')](_0xfd2de3)){throw new ReferenceError(_0xbabd('0x52'));}return _0xfd2de3;})[_0xbabd('0x20')](function(_0x1b59d9){var _0x2bb31d=_0x1b59d9[_0xbabd('0x45')];logger[_0xbabd('0x53')]('cancellazione\x20fisica\x20documento\x20%s',_0x2bb31d);if(!_['isNil'](_0x1b59d9[_0xbabd('0x45')])&&fs[_0xbabd('0x54')](_0x2bb31d)){logger[_0xbabd('0x53')](_0xbabd('0x55')+_0x2bb31d+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xbabd('0x56')](_0x2bb31d);}_0x2bb31d=_0x2bb31d+_0xbabd('0x57');if(!_['isNil'](_0x1b59d9['savePath'])&&fs[_0xbabd('0x54')](_0x2bb31d)){logger[_0xbabd('0x53')](_0xbabd('0x55')+_0x2bb31d+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xbabd('0x56')](_0x2bb31d);}return _0x1b59d9;})['then'](function(_0x4c4172){if(!_0x4c4172)throw new InternalError();return _0x4c4172[_0xbabd('0x21')]();})[_0xbabd('0x20')](function(){_0x4a0e5f[_0xbabd('0x16')](0xcc)[_0xbabd('0x17')]();})[_0xbabd('0x3c')](handleError(_0x4a0e5f,null));}; \ No newline at end of file +var _0x5acf=['query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','where','merge','VIRTUAL','filter','options','include','findAll','params','keys','includeAll','find','catch','create','body','download','../../components/encryptor','uniqueid','savePath','filename','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','extname','unlink','message','SquareRecording\x20not\x20found','Not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','.cypher','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','map','SquareRecording','rawAttributes','fieldName','type','key','model'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x5acf,0xec));var _0xf5ac=function(_0x4d7d5c,_0x1a456d){_0x4d7d5c=_0x4d7d5c-0x0;var _0x2c0910=_0x5acf[_0x4d7d5c];return _0x2c0910;};'use strict';var emlformat=require(_0xf5ac('0x0'));var rimraf=require(_0xf5ac('0x1'));var zipdir=require(_0xf5ac('0x2'));var jsonpatch=require(_0xf5ac('0x3'));var rp=require(_0xf5ac('0x4'));var moment=require('moment');var BPromise=require(_0xf5ac('0x5'));var Mustache=require(_0xf5ac('0x6'));var util=require(_0xf5ac('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xf5ac('0x8'));var ejs=require(_0xf5ac('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf5ac('0xa'));var squel=require(_0xf5ac('0xb'));var crypto=require('crypto');var jsforce=require(_0xf5ac('0xc'));var deskjs=require(_0xf5ac('0xd'));var toCsv=require('to-csv');var querystring=require(_0xf5ac('0xe'));var Papa=require(_0xf5ac('0xf'));var Redis=require(_0xf5ac('0x10'));var authService=require(_0xf5ac('0x11'));var qs=require(_0xf5ac('0x12'));var as=require(_0xf5ac('0x13'));var hardwareService=require(_0xf5ac('0x14'));var logger=require(_0xf5ac('0x15'))(_0xf5ac('0x16'));var utils=require(_0xf5ac('0x17'));var config=require(_0xf5ac('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xf5ac('0x19'))['db'];function respondWithStatusCode(_0x53b110,_0x482e72){_0x482e72=_0x482e72||0xcc;return function(_0x2d15b6){if(_0x2d15b6){return _0x53b110[_0xf5ac('0x1a')](_0x482e72);}return _0x53b110[_0xf5ac('0x1b')](_0x482e72)[_0xf5ac('0x1c')]();};}function respondWithResult(_0x39fa5e,_0x4c975f){_0x4c975f=_0x4c975f||0xc8;return function(_0x275cae){if(_0x275cae){return _0x39fa5e[_0xf5ac('0x1b')](_0x4c975f)[_0xf5ac('0x1d')](_0x275cae);}};}function respondWithFilteredResult(_0x38e229,_0x139487){return function(_0x2ac5f5){if(_0x2ac5f5){var _0x2b1f26=typeof _0x139487[_0xf5ac('0x1e')]==='undefined'&&typeof _0x139487[_0xf5ac('0x1f')]===_0xf5ac('0x20');var _0x589f57=_0x2ac5f5[_0xf5ac('0x21')];var _0x5b8e8a=_0x2b1f26?0x0:_0x139487[_0xf5ac('0x1e')];var _0x1d3c0e=_0x2b1f26?_0x2ac5f5[_0xf5ac('0x21')]:_0x139487[_0xf5ac('0x1e')]+_0x139487[_0xf5ac('0x1f')];var _0xac3a95;if(_0x1d3c0e>=_0x589f57){_0x1d3c0e=_0x589f57;_0xac3a95=0xc8;}else{_0xac3a95=0xce;}_0x38e229['status'](_0xac3a95);return _0x38e229[_0xf5ac('0x22')](_0xf5ac('0x23'),_0x5b8e8a+'-'+_0x1d3c0e+'/'+_0x589f57)['json'](_0x2ac5f5);}return null;};}function patchUpdates(_0x1f4a2d){return function(_0x3e7d9d){try{jsonpatch[_0xf5ac('0x24')](_0x3e7d9d,_0x1f4a2d,!![]);}catch(_0x6f8c7a){return BPromise[_0xf5ac('0x25')](_0x6f8c7a);}return _0x3e7d9d[_0xf5ac('0x26')]();};}function saveUpdates(_0x49011a,_0x36cdb3){return function(_0x38b980){if(_0x38b980){return _0x38b980[_0xf5ac('0x27')](_0x49011a)[_0xf5ac('0x28')](function(_0x3970c8){return _0x3970c8;});}return null;};}function removeEntity(_0x41713a,_0x490fb2){return function(_0x3b645d){if(_0x3b645d){return _0x3b645d[_0xf5ac('0x29')]()[_0xf5ac('0x28')](function(){_0x41713a[_0xf5ac('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39464f,_0x4b797c){return function(_0x3aa23a){if(!_0x3aa23a){_0x39464f[_0xf5ac('0x1a')](0x194);}return _0x3aa23a;};}function handleError(_0x16040e,_0x435f14){_0x435f14=_0x435f14||0x1f4;return function(_0x3033f4){logger['error'](_0x3033f4[_0xf5ac('0x2a')]);if(_0x3033f4[_0xf5ac('0x2b')]){delete _0x3033f4[_0xf5ac('0x2b')];}_0x16040e['status'](_0x435f14)[_0xf5ac('0x2c')](_0x3033f4);};}exports['index']=function(_0x617af1,_0x36b400){var _0x4a552b={},_0x525050={},_0x2d7363={'count':0x0,'rows':[]};var _0x110660=_[_0xf5ac('0x2d')](db[_0xf5ac('0x2e')][_0xf5ac('0x2f')],function(_0x3ee77b){return{'name':_0x3ee77b[_0xf5ac('0x30')],'type':_0x3ee77b[_0xf5ac('0x31')][_0xf5ac('0x32')]};});_0x525050[_0xf5ac('0x33')]=_['map'](_0x110660,_0xf5ac('0x2b'));_0x525050[_0xf5ac('0x34')]=_['keys'](_0x617af1[_0xf5ac('0x34')]);_0x525050[_0xf5ac('0x35')]=_[_0xf5ac('0x36')](_0x525050['model'],_0x525050[_0xf5ac('0x34')]);_0x4a552b['attributes']=_[_0xf5ac('0x36')](_0x525050[_0xf5ac('0x33')],qs[_0xf5ac('0x37')](_0x617af1[_0xf5ac('0x34')][_0xf5ac('0x37')]));_0x4a552b[_0xf5ac('0x38')]=_0x4a552b['attributes'][_0xf5ac('0x39')]?_0x4a552b[_0xf5ac('0x38')]:_0x525050['model'];if(!_0x617af1[_0xf5ac('0x34')][_0xf5ac('0x3a')](_0xf5ac('0x3b'))){_0x4a552b[_0xf5ac('0x1f')]=qs[_0xf5ac('0x1f')](_0x617af1[_0xf5ac('0x34')][_0xf5ac('0x1f')]);_0x4a552b[_0xf5ac('0x1e')]=qs[_0xf5ac('0x1e')](_0x617af1[_0xf5ac('0x34')][_0xf5ac('0x1e')]);}_0x4a552b['order']=qs['sort'](_0x617af1[_0xf5ac('0x34')]['sort']);_0x4a552b[_0xf5ac('0x3c')]=qs[_0xf5ac('0x35')](_['pick'](_0x617af1[_0xf5ac('0x34')],_0x525050[_0xf5ac('0x35')]),_0x110660);if(_0x617af1[_0xf5ac('0x34')]['filter']){_0x4a552b[_0xf5ac('0x3c')]=_[_0xf5ac('0x3d')](_0x4a552b['where'],{'$or':_['map'](_0x110660,function(_0xc9a99f){if(_0xc9a99f[_0xf5ac('0x31')]!==_0xf5ac('0x3e')){var _0x36d172={};_0x36d172[_0xc9a99f[_0xf5ac('0x2b')]]={'$like':'%'+_0x617af1['query'][_0xf5ac('0x3f')]+'%'};return _0x36d172;}})});}_0x4a552b=_[_0xf5ac('0x3d')]({},_0x4a552b,_0x617af1[_0xf5ac('0x40')]);var _0x53eaac={'where':_0x4a552b[_0xf5ac('0x3c')]};return db[_0xf5ac('0x2e')]['count'](_0x53eaac)[_0xf5ac('0x28')](function(_0x2b5600){_0x2d7363['count']=_0x2b5600;if(_0x617af1[_0xf5ac('0x34')]['includeAll']){_0x4a552b[_0xf5ac('0x41')]=[{'all':!![]}];}return db[_0xf5ac('0x2e')][_0xf5ac('0x42')](_0x4a552b);})[_0xf5ac('0x28')](function(_0x2dae02){_0x2d7363['rows']=_0x2dae02;return _0x2d7363;})[_0xf5ac('0x28')](respondWithFilteredResult(_0x36b400,_0x4a552b))['catch'](handleError(_0x36b400,null));};exports['show']=function(_0x182645,_0x567c0d){var _0x56b39d={'raw':!![],'where':{'id':_0x182645[_0xf5ac('0x43')]['id']}},_0x241e01={};_0x241e01['model']=_[_0xf5ac('0x44')](db['SquareRecording'][_0xf5ac('0x2f')]);_0x241e01[_0xf5ac('0x34')]=_[_0xf5ac('0x44')](_0x182645[_0xf5ac('0x34')]);_0x241e01['filters']=_[_0xf5ac('0x36')](_0x241e01['model'],_0x241e01['query']);_0x56b39d[_0xf5ac('0x38')]=_[_0xf5ac('0x36')](_0x241e01[_0xf5ac('0x33')],qs[_0xf5ac('0x37')](_0x182645[_0xf5ac('0x34')][_0xf5ac('0x37')]));_0x56b39d['attributes']=_0x56b39d[_0xf5ac('0x38')][_0xf5ac('0x39')]?_0x56b39d[_0xf5ac('0x38')]:_0x241e01['model'];if(_0x182645[_0xf5ac('0x34')][_0xf5ac('0x45')]){_0x56b39d['include']=[{'all':!![]}];}_0x56b39d=_[_0xf5ac('0x3d')]({},_0x56b39d,_0x182645[_0xf5ac('0x40')]);return db[_0xf5ac('0x2e')][_0xf5ac('0x46')](_0x56b39d)[_0xf5ac('0x28')](handleEntityNotFound(_0x567c0d,null))[_0xf5ac('0x28')](respondWithResult(_0x567c0d,null))[_0xf5ac('0x47')](handleError(_0x567c0d,null));};exports['create']=function(_0x56cbee,_0x2704f5){return db[_0xf5ac('0x2e')][_0xf5ac('0x48')](_0x56cbee[_0xf5ac('0x49')],{})[_0xf5ac('0x28')](respondWithResult(_0x2704f5,0xc9))[_0xf5ac('0x47')](handleError(_0x2704f5,null));};exports['update']=function(_0x39740c,_0x4b2b9f){if(_0x39740c[_0xf5ac('0x49')]['id']){delete _0x39740c['body']['id'];}return db[_0xf5ac('0x2e')][_0xf5ac('0x46')]({'where':{'id':_0x39740c['params']['id']}})['then'](handleEntityNotFound(_0x4b2b9f,null))['then'](saveUpdates(_0x39740c['body'],null))[_0xf5ac('0x28')](respondWithResult(_0x4b2b9f,null))['catch'](handleError(_0x4b2b9f,null));};exports[_0xf5ac('0x4a')]=function(_0x430d1c,_0x2d7c6e,_0x4ac31b){var _0x1bdaea=require(_0xf5ac('0x4b'));var _0x265a7a=![];var _0x3eaae0={};if(_0x430d1c[_0xf5ac('0x34')][_0xf5ac('0x31')]&&_0x430d1c[_0xf5ac('0x34')][_0xf5ac('0x31')]===_0xf5ac('0x4c')){_0x3eaae0[_0xf5ac('0x4c')]=_0x430d1c[_0xf5ac('0x43')]['id'];}else{_0x3eaae0['id']=_0x430d1c[_0xf5ac('0x43')]['id'];}return db[_0xf5ac('0x2e')]['find']({'where':_0x3eaae0,'attributes':['id',_0xf5ac('0x4d'),_0xf5ac('0x4e')],'raw':!![]})['then'](handleEntityNotFound(_0x2d7c6e,null))[_0xf5ac('0x28')](function(_0x49eea6){if(_0x49eea6){var _0x52ae69=_0x49eea6[_0xf5ac('0x4d')];var _0xdb070d=util['format'](_0xf5ac('0x4f'),_0x52ae69);if(fs[_0xf5ac('0x50')](_0xdb070d)){_0x265a7a=!![];return _0x1bdaea[_0xf5ac('0x51')](_0xdb070d,_0x52ae69,config[_0xf5ac('0x52')][_0xf5ac('0x53')])[_0xf5ac('0x28')](function(){return _0x49eea6;});}return _0x49eea6;}})['then'](function(_0x423385){if(_0x423385){var _0x296689=_0x423385[_0xf5ac('0x4d')];if(!fs[_0xf5ac('0x50')](_0x296689)){throw new db[(_0xf5ac('0x54'))]['ValidationError']('SquareRecording\x20not\x20found');}if(_0x423385[_0xf5ac('0x4e')]){return _0x2d7c6e['download'](_0x296689,_0x423385['filename']+path[_0xf5ac('0x55')](_0x296689),function(){if(_0x265a7a){fs[_0xf5ac('0x56')](_0x296689);}});}else{return _0x2d7c6e['download'](_0x296689,function(_0x12f62e){if(_0x265a7a){fs[_0xf5ac('0x56')](_0x296689);}});}}})[_0xf5ac('0x47')](function(_0x3ef7ed){if(_0x3ef7ed[_0xf5ac('0x57')]===_0xf5ac('0x58')){_0x2d7c6e['status'](0x194)[_0xf5ac('0x2c')](_0xf5ac('0x59'));}else{return handleError(_0x2d7c6e,null);}});};exports[_0xf5ac('0x29')]=function(_0x3ab61f,_0x35a32c){return db[_0xf5ac('0x2e')][_0xf5ac('0x46')]({'where':{'id':_0x3ab61f[_0xf5ac('0x43')]['id']}})[_0xf5ac('0x28')](function(_0x568985){if(_['isNil'](_0x568985)){throw new ReferenceError('Entity\x20not\x20found');}return _0x568985;})['then'](function(_0x15ada6){var _0x5f52f9=_0x15ada6['savePath'];logger[_0xf5ac('0x5a')](_0xf5ac('0x5b'),_0x5f52f9);if(!_[_0xf5ac('0x5c')](_0x15ada6[_0xf5ac('0x4d')])&&fs[_0xf5ac('0x50')](_0x5f52f9)){logger[_0xf5ac('0x5a')](_0xf5ac('0x5d')+_0x5f52f9+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x5f52f9);}_0x5f52f9=_0x5f52f9+_0xf5ac('0x5e');if(!_[_0xf5ac('0x5c')](_0x15ada6[_0xf5ac('0x4d')])&&fs[_0xf5ac('0x50')](_0x5f52f9)){logger[_0xf5ac('0x5a')](_0xf5ac('0x5d')+_0x5f52f9+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xf5ac('0x5f')](_0x5f52f9);}return _0x15ada6;})[_0xf5ac('0x28')](function(_0x24aa90){if(!_0x24aa90)throw new InternalError();return _0x24aa90[_0xf5ac('0x29')]();})[_0xf5ac('0x28')](function(){_0x35a32c[_0xf5ac('0x1b')](0xcc)[_0xf5ac('0x1c')]();})[_0xf5ac('0x47')](handleError(_0x35a32c,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 50c2c7a..03c1bae 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 _0xbd9e=['./squareRecording.attributes','define','SquareRecording','square_recordings','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xbd9e,0x108));var _0xebd9=function(_0x363ef8,_0x4ecb1a){_0x363ef8=_0x363ef8-0x0;var _0x148822=_0xbd9e[_0x363ef8];return _0x148822;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xebd9('0x0'))('api');var moment=require(_0xebd9('0x1'));var BPromise=require(_0xebd9('0x2'));var rp=require(_0xebd9('0x3'));var fs=require('fs');var path=require(_0xebd9('0x4'));var rimraf=require(_0xebd9('0x5'));var config=require('../../config/environment');var attributes=require(_0xebd9('0x6'));module['exports']=function(_0x3b2ade,_0x17f877){return _0x3b2ade[_0xebd9('0x7')](_0xebd9('0x8'),attributes,{'tableName':_0xebd9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9e54=['lodash','util','bluebird','request-promise','path','../../config/environment','./squareRecording.attributes','SquareRecording'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0x9e54,0x88));var _0x49e5=function(_0x336595,_0x413e3d){_0x336595=_0x336595-0x0;var _0x600f95=_0x9e54[_0x336595];return _0x600f95;};'use strict';var _=require(_0x49e5('0x0'));var util=require(_0x49e5('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x49e5('0x2'));var rp=require(_0x49e5('0x3'));var fs=require('fs');var path=require(_0x49e5('0x4'));var rimraf=require('rimraf');var config=require(_0x49e5('0x5'));var attributes=require(_0x49e5('0x6'));module['exports']=function(_0xa16cfa,_0x57486f){return _0xa16cfa['define'](_0x49e5('0x7'),attributes,{'tableName':'square_recordings','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 5b5d0cd..9a28224 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 _0xdb63=['info','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareRecording,\x20%s,\x20%s','message','request\x20sent','result','catch','CreateSquareRecording','create','body','options','raw','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x271bf3,_0x25daa2){var _0x1fcb26=function(_0x24f78e){while(--_0x24f78e){_0x271bf3['push'](_0x271bf3['shift']());}};_0x1fcb26(++_0x25daa2);}(_0xdb63,0x132));var _0x3db6=function(_0x5ac2e1,_0x2fc6e4){_0x5ac2e1=_0x5ac2e1-0x0;var _0xbfde8=_0xdb63[_0x5ac2e1];return _0xbfde8;};'use strict';var _=require(_0x3db6('0x0'));var util=require('util');var moment=require(_0x3db6('0x1'));var BPromise=require('bluebird');var rs=require(_0x3db6('0x2'));var fs=require('fs');var Redis=require(_0x3db6('0x3'));var db=require(_0x3db6('0x4'))['db'];var utils=require(_0x3db6('0x5'));var logger=require(_0x3db6('0x6'))('rpc');var config=require(_0x3db6('0x7'));var jayson=require(_0x3db6('0x8'));var client=jayson[_0x3db6('0x9')][_0x3db6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cf83b,_0x553602,_0x4dd7d5){return new BPromise(function(_0x1e3017,_0x55fdf3){return client[_0x3db6('0xb')](_0x3cf83b,_0x4dd7d5)[_0x3db6('0xc')](function(_0x407e21){logger[_0x3db6('0xd')]('SquareRecording,\x20%s,\x20%s',_0x553602,'request\x20sent');logger[_0x3db6('0xe')](_0x3db6('0xf'),_0x553602,'request\x20sent',JSON[_0x3db6('0x10')](_0x407e21));if(_0x407e21['error']){if(_0x407e21[_0x3db6('0x11')][_0x3db6('0x12')]===0x1f4){logger['error'](_0x3db6('0x13'),_0x553602,_0x407e21['error'][_0x3db6('0x14')]);return _0x55fdf3(_0x407e21[_0x3db6('0x11')][_0x3db6('0x14')]);}logger[_0x3db6('0x11')](_0x3db6('0x13'),_0x553602,_0x407e21['error'][_0x3db6('0x14')]);return _0x1e3017(_0x407e21[_0x3db6('0x11')][_0x3db6('0x14')]);}else{logger[_0x3db6('0xd')](_0x3db6('0x13'),_0x553602,_0x3db6('0x15'));_0x1e3017(_0x407e21[_0x3db6('0x16')][_0x3db6('0x14')]);}})[_0x3db6('0x17')](function(_0x269b4a){logger['error'](_0x3db6('0x13'),_0x553602,_0x269b4a);_0x55fdf3(_0x269b4a);});});}exports[_0x3db6('0x18')]=function(_0x2e37f4){var _0x279464=this;return new Promise(function(_0x298f78,_0x45281c){return db['SquareRecording'][_0x3db6('0x19')](_0x2e37f4[_0x3db6('0x1a')],{'raw':_0x2e37f4['options']?_0x2e37f4[_0x3db6('0x1b')][_0x3db6('0x1c')]===undefined?!![]:![]:!![]})[_0x3db6('0xc')](function(_0x49e963){logger['info'](_0x3db6('0x18'),_0x2e37f4);logger[_0x3db6('0xe')]('CreateSquareRecording',_0x2e37f4,JSON['stringify'](_0x49e963));_0x298f78(_0x49e963);})[_0x3db6('0x17')](function(_0x5e207e){logger[_0x3db6('0x11')](_0x3db6('0x18'),_0x5e207e[_0x3db6('0x14')],_0x2e37f4);_0x45281c(_0x279464['error'](0x1f4,_0x5e207e[_0x3db6('0x14')]));});});}; \ No newline at end of file +var _0x5f2f=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','SquareRecording,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CreateSquareRecording','SquareRecording','create','body','options','raw','lodash'];(function(_0x4da196,_0x357dc9){var _0x375df3=function(_0x366603){while(--_0x366603){_0x4da196['push'](_0x4da196['shift']());}};_0x375df3(++_0x357dc9);}(_0x5f2f,0x73));var _0xf5f2=function(_0x385304,_0xd75c30){_0x385304=_0x385304-0x0;var _0x2ac3d2=_0x5f2f[_0x385304];return _0x2ac3d2;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('SquareRecording,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});}exports[_0xf5f2('0x17')]=function(_0x20fccd){var _0x28e097=this;return new Promise(function(_0x4ff59b,_0x3ee69){return db[_0xf5f2('0x18')][_0xf5f2('0x19')](_0x20fccd[_0xf5f2('0x1a')],{'raw':_0x20fccd['options']?_0x20fccd[_0xf5f2('0x1b')][_0xf5f2('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x47acfc){logger[_0xf5f2('0xd')](_0xf5f2('0x17'),_0x20fccd);logger['debug'](_0xf5f2('0x17'),_0x20fccd,JSON[_0xf5f2('0x10')](_0x47acfc));_0x4ff59b(_0x47acfc);})[_0xf5f2('0x16')](function(_0x39c024){logger[_0xf5f2('0x11')]('CreateSquareRecording',_0x39c024[_0xf5f2('0x13')],_0x20fccd);_0x3ee69(_0x28e097[_0xf5f2('0x11')](0x1f4,_0x39c024[_0xf5f2('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 8c72292..b5c1cd2 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 _0xbaf0=['/:id','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index','/describe','show','post','create','put'];(function(_0x473de8,_0x5c24f1){var _0x5c24de=function(_0x2aa8b3){while(--_0x2aa8b3){_0x473de8['push'](_0x473de8['shift']());}};_0x5c24de(++_0x5c24f1);}(_0xbaf0,0x12a));var _0x0baf=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xbaf0[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['describe']);router[_0x0baf('0x9')]('/:id',auth[_0x0baf('0xa')](),controller[_0x0baf('0xd')]);router[_0x0baf('0xe')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xf')]);router[_0x0baf('0x10')](_0x0baf('0x11'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')](_0x0baf('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x0baf('0x14')]=router; \ No newline at end of file +var _0xbaf0=['/:id','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index','/describe','show','post','create','put'];(function(_0x1ee4fd,_0x2cbfc8){var _0x26cc5e=function(_0x18b62c){while(--_0x18b62c){_0x1ee4fd['push'](_0x1ee4fd['shift']());}};_0x26cc5e(++_0x2cbfc8);}(_0xbaf0,0x12a));var _0x0baf=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xbaf0[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['describe']);router[_0x0baf('0x9')]('/:id',auth[_0x0baf('0xa')](),controller[_0x0baf('0xd')]);router[_0x0baf('0xe')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xf')]);router[_0x0baf('0x10')](_0x0baf('0x11'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')](_0x0baf('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x0baf('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 6a2e123..707a9a0 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 _0x12b7=['BOOLEAN','sequelize','STRING','DATE'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x12b7,0x81));var _0x712b=function(_0x128232,_0x4bdea7){_0x128232=_0x128232-0x0;var _0x1b76b1=_0x12b7[_0x128232];return _0x1b76b1;};'use strict';var Sequelize=require(_0x712b('0x0'));module['exports']={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0x712b('0x1')]},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x712b('0x1')]},'language':{'type':Sequelize[_0x712b('0x1')]},'type':{'type':Sequelize[_0x712b('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize[_0x712b('0x1')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize[_0x712b('0x1')]},'callingani2':{'type':Sequelize[_0x712b('0x1')]},'callington':{'type':Sequelize[_0x712b('0x1')]},'callingtns':{'type':Sequelize[_0x712b('0x1')]},'dnid':{'type':Sequelize[_0x712b('0x1')]},'rdnis':{'type':Sequelize[_0x712b('0x1')]},'context':{'type':Sequelize[_0x712b('0x1')]},'extension':{'type':Sequelize[_0x712b('0x1')]},'priority':{'type':Sequelize[_0x712b('0x1')]},'enhanced':{'type':Sequelize[_0x712b('0x1')]},'accountcode':{'type':Sequelize[_0x712b('0x1')]},'threadid':{'type':Sequelize[_0x712b('0x1')]},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x712b('0x2')]},'leaveAt':{'type':Sequelize[_0x712b('0x2')]},'bot':{'type':Sequelize[_0x712b('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x4bcc=['exports','STRING','DATE','BOOLEAN'];(function(_0x33cece,_0x54b9da){var _0x1a2efd=function(_0x3745e6){while(--_0x3745e6){_0x33cece['push'](_0x33cece['shift']());}};_0x1a2efd(++_0x54b9da);}(_0x4bcc,0x1a8));var _0xc4bc=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x4bcc[_0x580576];return _0x3f55a0;};'use strict';var Sequelize=require('sequelize');module[_0xc4bc('0x0')]={'network':{'type':Sequelize[_0xc4bc('0x1')]},'network_script':{'type':Sequelize[_0xc4bc('0x1')]},'request':{'type':Sequelize[_0xc4bc('0x1')]},'channel':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xc4bc('0x1')]},'type':{'type':Sequelize[_0xc4bc('0x1')]},'uniqueid':{'type':Sequelize[_0xc4bc('0x1')]},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xc4bc('0x1')]},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize[_0xc4bc('0x1')]},'callingtns':{'type':Sequelize[_0xc4bc('0x1')]},'dnid':{'type':Sequelize[_0xc4bc('0x1')]},'rdnis':{'type':Sequelize[_0xc4bc('0x1')]},'context':{'type':Sequelize[_0xc4bc('0x1')]},'extension':{'type':Sequelize[_0xc4bc('0x1')]},'priority':{'type':Sequelize[_0xc4bc('0x1')]},'enhanced':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xc4bc('0x1')]},'threadid':{'type':Sequelize[_0xc4bc('0x1')]},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xc4bc('0x2')]},'leaveAt':{'type':Sequelize[_0xc4bc('0x2')]},'bot':{'type':Sequelize[_0xc4bc('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 2840a0d..0ae0269 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 _0xea13=['offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','name','send','index','SquareReport','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','sort','pick','filter','where','type','merge','includeAll','include','catch','show','params','rawAttributes','options','find','create','body','describe','eml-format','rimraf','zip-dir','moment','bluebird','mustache','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json'];(function(_0x52b7b9,_0x43ed4b){var _0x5b5d30=function(_0x4a5b9c){while(--_0x4a5b9c){_0x52b7b9['push'](_0x52b7b9['shift']());}};_0x5b5d30(++_0x43ed4b);}(_0xea13,0x195));var _0x3ea1=function(_0x3f875d,_0x214000){_0x3f875d=_0x3f875d-0x0;var _0x37e83d=_0xea13[_0x3f875d];return _0x37e83d;};'use strict';var emlformat=require(_0x3ea1('0x0'));var rimraf=require(_0x3ea1('0x1'));var zipdir=require(_0x3ea1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x3ea1('0x3'));var BPromise=require(_0x3ea1('0x4'));var Mustache=require(_0x3ea1('0x5'));var util=require('util');var path=require(_0x3ea1('0x6'));var sox=require('sox');var csv=require(_0x3ea1('0x7'));var ejs=require(_0x3ea1('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3ea1('0x9'));var squel=require('squel');var crypto=require(_0x3ea1('0xa'));var jsforce=require(_0x3ea1('0xb'));var deskjs=require(_0x3ea1('0xc'));var toCsv=require(_0x3ea1('0x7'));var querystring=require(_0x3ea1('0xd'));var Papa=require('papaparse');var Redis=require(_0x3ea1('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3ea1('0xf'));var hardwareService=require(_0x3ea1('0x10'));var logger=require(_0x3ea1('0x11'))(_0x3ea1('0x12'));var utils=require(_0x3ea1('0x13'));var config=require(_0x3ea1('0x14'));var licenseUtil=require(_0x3ea1('0x15'));var db=require(_0x3ea1('0x16'))['db'];function respondWithStatusCode(_0xfdea85,_0x4532bf){_0x4532bf=_0x4532bf||0xcc;return function(_0xed674e){if(_0xed674e){return _0xfdea85[_0x3ea1('0x17')](_0x4532bf);}return _0xfdea85[_0x3ea1('0x18')](_0x4532bf)[_0x3ea1('0x19')]();};}function respondWithResult(_0x1eaa95,_0x2528c6){_0x2528c6=_0x2528c6||0xc8;return function(_0x2a9748){if(_0x2a9748){return _0x1eaa95[_0x3ea1('0x18')](_0x2528c6)[_0x3ea1('0x1a')](_0x2a9748);}};}function respondWithFilteredResult(_0x59616b,_0x490100){return function(_0x3b4791){if(_0x3b4791){var _0x192618=typeof _0x490100[_0x3ea1('0x1b')]===_0x3ea1('0x1c')&&typeof _0x490100[_0x3ea1('0x1d')]===_0x3ea1('0x1c');var _0x3bec0c=_0x3b4791['count'];var _0x19b59f=_0x192618?0x0:_0x490100['offset'];var _0x7db3d1=_0x192618?_0x3b4791[_0x3ea1('0x1e')]:_0x490100[_0x3ea1('0x1b')]+_0x490100[_0x3ea1('0x1d')];var _0x582300;if(_0x7db3d1>=_0x3bec0c){_0x7db3d1=_0x3bec0c;_0x582300=0xc8;}else{_0x582300=0xce;}_0x59616b['status'](_0x582300);return _0x59616b[_0x3ea1('0x1f')](_0x3ea1('0x20'),_0x19b59f+'-'+_0x7db3d1+'/'+_0x3bec0c)[_0x3ea1('0x1a')](_0x3b4791);}return null;};}function patchUpdates(_0x3420c3){return function(_0x19aff8){try{jsonpatch[_0x3ea1('0x21')](_0x19aff8,_0x3420c3,!![]);}catch(_0x1fa659){return BPromise[_0x3ea1('0x22')](_0x1fa659);}return _0x19aff8['save']();};}function saveUpdates(_0x386b79,_0x3b5753){return function(_0x1718bb){if(_0x1718bb){return _0x1718bb[_0x3ea1('0x23')](_0x386b79)[_0x3ea1('0x24')](function(_0x1a3a3a){return _0x1a3a3a;});}return null;};}function removeEntity(_0x5c30c7,_0x585e97){return function(_0x2e5e07){if(_0x2e5e07){return _0x2e5e07[_0x3ea1('0x25')]()[_0x3ea1('0x24')](function(){_0x5c30c7['status'](0xcc)[_0x3ea1('0x19')]();});}};}function handleEntityNotFound(_0x8e0170,_0x1e8fa7){return function(_0x2fe56f){if(!_0x2fe56f){_0x8e0170[_0x3ea1('0x17')](0x194);}return _0x2fe56f;};}function handleError(_0x4fad1c,_0x14efd9){_0x14efd9=_0x14efd9||0x1f4;return function(_0xa17e05){logger[_0x3ea1('0x26')](_0xa17e05['stack']);if(_0xa17e05[_0x3ea1('0x27')]){delete _0xa17e05['name'];}_0x4fad1c[_0x3ea1('0x18')](_0x14efd9)[_0x3ea1('0x28')](_0xa17e05);};}exports[_0x3ea1('0x29')]=function(_0x377f48,_0x156b0d){var _0x41ca52={},_0x33efe7={},_0x141341={'count':0x0,'rows':[]};var _0x1e6997=_['map'](db[_0x3ea1('0x2a')]['rawAttributes'],function(_0x183fa2){return{'name':_0x183fa2[_0x3ea1('0x2b')],'type':_0x183fa2['type'][_0x3ea1('0x2c')]};});_0x33efe7[_0x3ea1('0x2d')]=_[_0x3ea1('0x2e')](_0x1e6997,'name');_0x33efe7[_0x3ea1('0x2f')]=_[_0x3ea1('0x30')](_0x377f48[_0x3ea1('0x2f')]);_0x33efe7[_0x3ea1('0x31')]=_[_0x3ea1('0x32')](_0x33efe7[_0x3ea1('0x2d')],_0x33efe7['query']);_0x41ca52['attributes']=_[_0x3ea1('0x32')](_0x33efe7['model'],qs[_0x3ea1('0x33')](_0x377f48[_0x3ea1('0x2f')][_0x3ea1('0x33')]));_0x41ca52[_0x3ea1('0x34')]=_0x41ca52['attributes'][_0x3ea1('0x35')]?_0x41ca52[_0x3ea1('0x34')]:_0x33efe7[_0x3ea1('0x2d')];if(!_0x377f48['query'][_0x3ea1('0x36')]('nolimit')){_0x41ca52['limit']=qs[_0x3ea1('0x1d')](_0x377f48[_0x3ea1('0x2f')][_0x3ea1('0x1d')]);_0x41ca52[_0x3ea1('0x1b')]=qs[_0x3ea1('0x1b')](_0x377f48[_0x3ea1('0x2f')][_0x3ea1('0x1b')]);}_0x41ca52['order']=qs[_0x3ea1('0x37')](_0x377f48[_0x3ea1('0x2f')][_0x3ea1('0x37')]);_0x41ca52['where']=qs[_0x3ea1('0x31')](_[_0x3ea1('0x38')](_0x377f48[_0x3ea1('0x2f')],_0x33efe7['filters']),_0x1e6997);if(_0x377f48['query'][_0x3ea1('0x39')]){_0x41ca52[_0x3ea1('0x3a')]=_['merge'](_0x41ca52[_0x3ea1('0x3a')],{'$or':_[_0x3ea1('0x2e')](_0x1e6997,function(_0x53252e){if(_0x53252e[_0x3ea1('0x3b')]!=='VIRTUAL'){var _0x213d44={};_0x213d44[_0x53252e['name']]={'$like':'%'+_0x377f48['query'][_0x3ea1('0x39')]+'%'};return _0x213d44;}})});}_0x41ca52=_[_0x3ea1('0x3c')]({},_0x41ca52,_0x377f48['options']);var _0x478869={'where':_0x41ca52[_0x3ea1('0x3a')]};return db[_0x3ea1('0x2a')]['count'](_0x478869)[_0x3ea1('0x24')](function(_0x371287){_0x141341[_0x3ea1('0x1e')]=_0x371287;if(_0x377f48['query'][_0x3ea1('0x3d')]){_0x41ca52[_0x3ea1('0x3e')]=[{'all':!![]}];}return db[_0x3ea1('0x2a')]['findAll'](_0x41ca52);})[_0x3ea1('0x24')](function(_0x21fa86){_0x141341['rows']=_0x21fa86;return _0x141341;})[_0x3ea1('0x24')](respondWithFilteredResult(_0x156b0d,_0x41ca52))[_0x3ea1('0x3f')](handleError(_0x156b0d,null));};exports[_0x3ea1('0x40')]=function(_0x27cccc,_0x508be7){var _0x7e5b86={'raw':!![],'where':{'id':_0x27cccc[_0x3ea1('0x41')]['id']}},_0x1ec712={};_0x1ec712[_0x3ea1('0x2d')]=_[_0x3ea1('0x30')](db[_0x3ea1('0x2a')][_0x3ea1('0x42')]);_0x1ec712['query']=_[_0x3ea1('0x30')](_0x27cccc[_0x3ea1('0x2f')]);_0x1ec712[_0x3ea1('0x31')]=_['intersection'](_0x1ec712['model'],_0x1ec712[_0x3ea1('0x2f')]);_0x7e5b86[_0x3ea1('0x34')]=_['intersection'](_0x1ec712[_0x3ea1('0x2d')],qs[_0x3ea1('0x33')](_0x27cccc['query']['fields']));_0x7e5b86['attributes']=_0x7e5b86['attributes']['length']?_0x7e5b86[_0x3ea1('0x34')]:_0x1ec712[_0x3ea1('0x2d')];if(_0x27cccc['query'][_0x3ea1('0x3d')]){_0x7e5b86[_0x3ea1('0x3e')]=[{'all':!![]}];}_0x7e5b86=_[_0x3ea1('0x3c')]({},_0x7e5b86,_0x27cccc[_0x3ea1('0x43')]);return db[_0x3ea1('0x2a')][_0x3ea1('0x44')](_0x7e5b86)['then'](handleEntityNotFound(_0x508be7,null))[_0x3ea1('0x24')](respondWithResult(_0x508be7,null))[_0x3ea1('0x3f')](handleError(_0x508be7,null));};exports[_0x3ea1('0x45')]=function(_0x24cecb,_0x195b87){return db[_0x3ea1('0x2a')][_0x3ea1('0x45')](_0x24cecb[_0x3ea1('0x46')],{})[_0x3ea1('0x24')](respondWithResult(_0x195b87,0xc9))['catch'](handleError(_0x195b87,null));};exports[_0x3ea1('0x23')]=function(_0x24c790,_0xbfb57d){if(_0x24c790[_0x3ea1('0x46')]['id']){delete _0x24c790[_0x3ea1('0x46')]['id'];}return db[_0x3ea1('0x2a')][_0x3ea1('0x44')]({'where':{'id':_0x24c790[_0x3ea1('0x41')]['id']}})[_0x3ea1('0x24')](handleEntityNotFound(_0xbfb57d,null))[_0x3ea1('0x24')](saveUpdates(_0x24c790[_0x3ea1('0x46')],null))['then'](respondWithResult(_0xbfb57d,null))[_0x3ea1('0x3f')](handleError(_0xbfb57d,null));};exports[_0x3ea1('0x25')]=function(_0x58b1c2,_0x1b0350){return db[_0x3ea1('0x2a')][_0x3ea1('0x44')]({'where':{'id':_0x58b1c2['params']['id']}})[_0x3ea1('0x24')](handleEntityNotFound(_0x1b0350,null))['then'](removeEntity(_0x1b0350,null))['catch'](handleError(_0x1b0350,null));};exports[_0x3ea1('0x47')]=function(_0x211e1e,_0x457036){return db[_0x3ea1('0x2a')]['describe']()[_0x3ea1('0x24')](respondWithResult(_0x457036,null))[_0x3ea1('0x3f')](handleError(_0x457036,null));}; \ No newline at end of file +var _0xa8d2=['query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','findAll','catch','include','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','SquareReport','rawAttributes','key','model','keys'];(function(_0x38523c,_0x219644){var _0x429e6a=function(_0x10d799){while(--_0x10d799){_0x38523c['push'](_0x38523c['shift']());}};_0x429e6a(++_0x219644);}(_0xa8d2,0x1da));var _0x2a8d=function(_0x83c1af,_0x24ef2a){_0x83c1af=_0x83c1af-0x0;var _0xa9f3e=_0xa8d2[_0x83c1af];return _0xa9f3e;};'use strict';var emlformat=require(_0x2a8d('0x0'));var rimraf=require(_0x2a8d('0x1'));var zipdir=require(_0x2a8d('0x2'));var jsonpatch=require(_0x2a8d('0x3'));var rp=require(_0x2a8d('0x4'));var moment=require('moment');var BPromise=require(_0x2a8d('0x5'));var Mustache=require(_0x2a8d('0x6'));var util=require('util');var path=require(_0x2a8d('0x7'));var sox=require('sox');var csv=require(_0x2a8d('0x8'));var ejs=require(_0x2a8d('0x9'));var fs=require('fs');var fs_extra=require(_0x2a8d('0xa'));var _=require(_0x2a8d('0xb'));var squel=require(_0x2a8d('0xc'));var crypto=require(_0x2a8d('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x2a8d('0xe'));var toCsv=require('to-csv');var querystring=require(_0x2a8d('0xf'));var Papa=require(_0x2a8d('0x10'));var Redis=require(_0x2a8d('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x2a8d('0x12'));var hardwareService=require(_0x2a8d('0x13'));var logger=require(_0x2a8d('0x14'))(_0x2a8d('0x15'));var utils=require('../../config/utils');var config=require(_0x2a8d('0x16'));var licenseUtil=require(_0x2a8d('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x244e11,_0x1f688f){_0x1f688f=_0x1f688f||0xcc;return function(_0x239319){if(_0x239319){return _0x244e11[_0x2a8d('0x18')](_0x1f688f);}return _0x244e11['status'](_0x1f688f)['end']();};}function respondWithResult(_0x298601,_0x352d44){_0x352d44=_0x352d44||0xc8;return function(_0x1cf83c){if(_0x1cf83c){return _0x298601[_0x2a8d('0x19')](_0x352d44)[_0x2a8d('0x1a')](_0x1cf83c);}};}function respondWithFilteredResult(_0x7c1b92,_0x3f1b08){return function(_0x34b7e8){if(_0x34b7e8){var _0x46f46f=typeof _0x3f1b08[_0x2a8d('0x1b')]===_0x2a8d('0x1c')&&typeof _0x3f1b08[_0x2a8d('0x1d')]===_0x2a8d('0x1c');var _0xa0938d=_0x34b7e8['count'];var _0x4694ee=_0x46f46f?0x0:_0x3f1b08[_0x2a8d('0x1b')];var _0x535f0a=_0x46f46f?_0x34b7e8[_0x2a8d('0x1e')]:_0x3f1b08[_0x2a8d('0x1b')]+_0x3f1b08[_0x2a8d('0x1d')];var _0x26d403;if(_0x535f0a>=_0xa0938d){_0x535f0a=_0xa0938d;_0x26d403=0xc8;}else{_0x26d403=0xce;}_0x7c1b92[_0x2a8d('0x19')](_0x26d403);return _0x7c1b92[_0x2a8d('0x1f')](_0x2a8d('0x20'),_0x4694ee+'-'+_0x535f0a+'/'+_0xa0938d)[_0x2a8d('0x1a')](_0x34b7e8);}return null;};}function patchUpdates(_0xff6d1c){return function(_0x29d950){try{jsonpatch[_0x2a8d('0x21')](_0x29d950,_0xff6d1c,!![]);}catch(_0xff67){return BPromise[_0x2a8d('0x22')](_0xff67);}return _0x29d950[_0x2a8d('0x23')]();};}function saveUpdates(_0x35f22f,_0x4fd3b6){return function(_0x53f411){if(_0x53f411){return _0x53f411[_0x2a8d('0x24')](_0x35f22f)[_0x2a8d('0x25')](function(_0x51da14){return _0x51da14;});}return null;};}function removeEntity(_0x154bcd,_0x3f7790){return function(_0x366b94){if(_0x366b94){return _0x366b94[_0x2a8d('0x26')]()[_0x2a8d('0x25')](function(){_0x154bcd[_0x2a8d('0x19')](0xcc)[_0x2a8d('0x27')]();});}};}function handleEntityNotFound(_0x2f51a4,_0x1f9807){return function(_0x8f36ff){if(!_0x8f36ff){_0x2f51a4[_0x2a8d('0x18')](0x194);}return _0x8f36ff;};}function handleError(_0x299d63,_0x2337ca){_0x2337ca=_0x2337ca||0x1f4;return function(_0x5102a5){logger[_0x2a8d('0x28')](_0x5102a5[_0x2a8d('0x29')]);if(_0x5102a5['name']){delete _0x5102a5[_0x2a8d('0x2a')];}_0x299d63['status'](_0x2337ca)[_0x2a8d('0x2b')](_0x5102a5);};}exports[_0x2a8d('0x2c')]=function(_0x3cd896,_0x23b90e){var _0x45a011={},_0x3a3038={},_0x3e7922={'count':0x0,'rows':[]};var _0x47d049=_[_0x2a8d('0x2d')](db[_0x2a8d('0x2e')][_0x2a8d('0x2f')],function(_0x4efdcc){return{'name':_0x4efdcc['fieldName'],'type':_0x4efdcc['type'][_0x2a8d('0x30')]};});_0x3a3038[_0x2a8d('0x31')]=_[_0x2a8d('0x2d')](_0x47d049,'name');_0x3a3038['query']=_[_0x2a8d('0x32')](_0x3cd896[_0x2a8d('0x33')]);_0x3a3038[_0x2a8d('0x34')]=_[_0x2a8d('0x35')](_0x3a3038['model'],_0x3a3038[_0x2a8d('0x33')]);_0x45a011['attributes']=_[_0x2a8d('0x35')](_0x3a3038[_0x2a8d('0x31')],qs[_0x2a8d('0x36')](_0x3cd896[_0x2a8d('0x33')]['fields']));_0x45a011[_0x2a8d('0x37')]=_0x45a011[_0x2a8d('0x37')][_0x2a8d('0x38')]?_0x45a011[_0x2a8d('0x37')]:_0x3a3038[_0x2a8d('0x31')];if(!_0x3cd896[_0x2a8d('0x33')][_0x2a8d('0x39')]('nolimit')){_0x45a011[_0x2a8d('0x1d')]=qs['limit'](_0x3cd896[_0x2a8d('0x33')][_0x2a8d('0x1d')]);_0x45a011[_0x2a8d('0x1b')]=qs[_0x2a8d('0x1b')](_0x3cd896[_0x2a8d('0x33')]['offset']);}_0x45a011[_0x2a8d('0x3a')]=qs[_0x2a8d('0x3b')](_0x3cd896[_0x2a8d('0x33')][_0x2a8d('0x3b')]);_0x45a011[_0x2a8d('0x3c')]=qs['filters'](_['pick'](_0x3cd896[_0x2a8d('0x33')],_0x3a3038[_0x2a8d('0x34')]),_0x47d049);if(_0x3cd896['query'][_0x2a8d('0x3d')]){_0x45a011[_0x2a8d('0x3c')]=_[_0x2a8d('0x3e')](_0x45a011[_0x2a8d('0x3c')],{'$or':_[_0x2a8d('0x2d')](_0x47d049,function(_0x26cc94){if(_0x26cc94[_0x2a8d('0x3f')]!==_0x2a8d('0x40')){var _0x101073={};_0x101073[_0x26cc94[_0x2a8d('0x2a')]]={'$like':'%'+_0x3cd896['query'][_0x2a8d('0x3d')]+'%'};return _0x101073;}})});}_0x45a011=_['merge']({},_0x45a011,_0x3cd896[_0x2a8d('0x41')]);var _0x2aad84={'where':_0x45a011[_0x2a8d('0x3c')]};return db['SquareReport'][_0x2a8d('0x1e')](_0x2aad84)[_0x2a8d('0x25')](function(_0x4f76a1){_0x3e7922[_0x2a8d('0x1e')]=_0x4f76a1;if(_0x3cd896[_0x2a8d('0x33')][_0x2a8d('0x42')]){_0x45a011['include']=[{'all':!![]}];}return db[_0x2a8d('0x2e')][_0x2a8d('0x43')](_0x45a011);})['then'](function(_0x4bc5e8){_0x3e7922['rows']=_0x4bc5e8;return _0x3e7922;})[_0x2a8d('0x25')](respondWithFilteredResult(_0x23b90e,_0x45a011))[_0x2a8d('0x44')](handleError(_0x23b90e,null));};exports['show']=function(_0x2ed6ad,_0x21428e){var _0x576eee={'raw':!![],'where':{'id':_0x2ed6ad['params']['id']}},_0x2d7d16={};_0x2d7d16[_0x2a8d('0x31')]=_[_0x2a8d('0x32')](db['SquareReport'][_0x2a8d('0x2f')]);_0x2d7d16[_0x2a8d('0x33')]=_[_0x2a8d('0x32')](_0x2ed6ad[_0x2a8d('0x33')]);_0x2d7d16['filters']=_[_0x2a8d('0x35')](_0x2d7d16[_0x2a8d('0x31')],_0x2d7d16[_0x2a8d('0x33')]);_0x576eee[_0x2a8d('0x37')]=_[_0x2a8d('0x35')](_0x2d7d16['model'],qs[_0x2a8d('0x36')](_0x2ed6ad[_0x2a8d('0x33')][_0x2a8d('0x36')]));_0x576eee[_0x2a8d('0x37')]=_0x576eee[_0x2a8d('0x37')][_0x2a8d('0x38')]?_0x576eee[_0x2a8d('0x37')]:_0x2d7d16[_0x2a8d('0x31')];if(_0x2ed6ad['query'][_0x2a8d('0x42')]){_0x576eee[_0x2a8d('0x45')]=[{'all':!![]}];}_0x576eee=_[_0x2a8d('0x3e')]({},_0x576eee,_0x2ed6ad[_0x2a8d('0x41')]);return db[_0x2a8d('0x2e')][_0x2a8d('0x46')](_0x576eee)[_0x2a8d('0x25')](handleEntityNotFound(_0x21428e,null))[_0x2a8d('0x25')](respondWithResult(_0x21428e,null))[_0x2a8d('0x44')](handleError(_0x21428e,null));};exports['create']=function(_0xb884d0,_0x5de958){return db['SquareReport'][_0x2a8d('0x47')](_0xb884d0[_0x2a8d('0x48')],{})[_0x2a8d('0x25')](respondWithResult(_0x5de958,0xc9))[_0x2a8d('0x44')](handleError(_0x5de958,null));};exports[_0x2a8d('0x24')]=function(_0x406699,_0x405cd6){if(_0x406699[_0x2a8d('0x48')]['id']){delete _0x406699[_0x2a8d('0x48')]['id'];}return db[_0x2a8d('0x2e')]['find']({'where':{'id':_0x406699['params']['id']}})['then'](handleEntityNotFound(_0x405cd6,null))[_0x2a8d('0x25')](saveUpdates(_0x406699['body'],null))[_0x2a8d('0x25')](respondWithResult(_0x405cd6,null))['catch'](handleError(_0x405cd6,null));};exports[_0x2a8d('0x26')]=function(_0x2cde99,_0x418aba){return db[_0x2a8d('0x2e')][_0x2a8d('0x46')]({'where':{'id':_0x2cde99[_0x2a8d('0x49')]['id']}})['then'](handleEntityNotFound(_0x418aba,null))['then'](removeEntity(_0x418aba,null))[_0x2a8d('0x44')](handleError(_0x418aba,null));};exports['describe']=function(_0x42b851,_0x555359){return db[_0x2a8d('0x2e')][_0x2a8d('0x4a')]()[_0x2a8d('0x25')](respondWithResult(_0x555359,null))[_0x2a8d('0x44')](handleError(_0x555359,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 4955d6e..32fd4ef 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 _0x6d1c=['request-promise','path','rimraf','../../config/environment','./squareReport.attributes','define','SquareReport','report_square','uid_pname','project_name','leaveAt','lodash','../../config/logger','moment','bluebird'];(function(_0x36375a,_0x43ede3){var _0xe646d0=function(_0x4e9ea2){while(--_0x4e9ea2){_0x36375a['push'](_0x36375a['shift']());}};_0xe646d0(++_0x43ede3);}(_0x6d1c,0xa1));var _0xc6d1=function(_0x2d0d9f,_0x22c0d8){_0x2d0d9f=_0x2d0d9f-0x0;var _0x30243d=_0x6d1c[_0x2d0d9f];return _0x30243d;};'use strict';var _=require(_0xc6d1('0x0'));var util=require('util');var logger=require(_0xc6d1('0x1'))('api');var moment=require(_0xc6d1('0x2'));var BPromise=require(_0xc6d1('0x3'));var rp=require(_0xc6d1('0x4'));var fs=require('fs');var path=require(_0xc6d1('0x5'));var rimraf=require(_0xc6d1('0x6'));var config=require(_0xc6d1('0x7'));var attributes=require(_0xc6d1('0x8'));module['exports']=function(_0x773409,_0x397213){return _0x773409[_0xc6d1('0x9')](_0xc6d1('0xa'),attributes,{'tableName':_0xc6d1('0xb'),'paranoid':![],'indexes':[{'name':_0xc6d1('0xc'),'fields':['uniqueid',_0xc6d1('0xd')]},{'name':_0xc6d1('0xe'),'fields':[_0xc6d1('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcf73=['bluebird','request-promise','rimraf','./squareReport.attributes','exports','SquareReport','report_square','project_name','leaveAt','lodash','util','../../config/logger','api','moment'];(function(_0x20e5d0,_0x1f9854){var _0x492c0d=function(_0x5d9496){while(--_0x5d9496){_0x20e5d0['push'](_0x20e5d0['shift']());}};_0x492c0d(++_0x1f9854);}(_0xcf73,0x113));var _0x3cf7=function(_0x1280b7,_0x33482f){_0x1280b7=_0x1280b7-0x0;var _0x11928e=_0xcf73[_0x1280b7];return _0x11928e;};'use strict';var _=require(_0x3cf7('0x0'));var util=require(_0x3cf7('0x1'));var logger=require(_0x3cf7('0x2'))(_0x3cf7('0x3'));var moment=require(_0x3cf7('0x4'));var BPromise=require(_0x3cf7('0x5'));var rp=require(_0x3cf7('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3cf7('0x7'));var config=require('../../config/environment');var attributes=require(_0x3cf7('0x8'));module[_0x3cf7('0x9')]=function(_0x153f32,_0x28ea6f){return _0x153f32['define'](_0x3cf7('0xa'),attributes,{'tableName':_0x3cf7('0xb'),'paranoid':![],'indexes':[{'name':'uid_pname','fields':['uniqueid',_0x3cf7('0xc')]},{'name':_0x3cf7('0xd'),'fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 49f25f2..f727e71 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 _0xcf0d=['UpdateSquareReport','body','raw','where','attributes','limit','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','SquareReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','SquareReport','options','CreateSquareReport'];(function(_0x4129c9,_0x229ea7){var _0xb1f9cd=function(_0xd69e17){while(--_0xd69e17){_0x4129c9['push'](_0x4129c9['shift']());}};_0xb1f9cd(++_0x229ea7);}(_0xcf0d,0x1d6));var _0xdcf0=function(_0x4e5e92,_0x4e657e){_0x4e5e92=_0x4e5e92-0x0;var _0x486c68=_0xcf0d[_0x4e5e92];return _0x486c68;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xdcf0('0x0'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdcf0('0x1'))['db'];var utils=require(_0xdcf0('0x2'));var logger=require(_0xdcf0('0x3'))(_0xdcf0('0x4'));var config=require(_0xdcf0('0x5'));var jayson=require(_0xdcf0('0x6'));var client=jayson['client'][_0xdcf0('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3f2915,_0x7b7e98,_0x20c587){return new BPromise(function(_0x3eee9c,_0x13f066){return client[_0xdcf0('0x8')](_0x3f2915,_0x20c587)[_0xdcf0('0x9')](function(_0x2b39c7){logger[_0xdcf0('0xa')](_0xdcf0('0xb'),_0x7b7e98,'request\x20sent');logger[_0xdcf0('0xc')]('SquareReport,\x20%s,\x20%s,\x20%s',_0x7b7e98,_0xdcf0('0xd'),JSON[_0xdcf0('0xe')](_0x2b39c7));if(_0x2b39c7[_0xdcf0('0xf')]){if(_0x2b39c7[_0xdcf0('0xf')][_0xdcf0('0x10')]===0x1f4){logger['error'](_0xdcf0('0xb'),_0x7b7e98,_0x2b39c7[_0xdcf0('0xf')]['message']);return _0x13f066(_0x2b39c7[_0xdcf0('0xf')][_0xdcf0('0x11')]);}logger['error']('SquareReport,\x20%s,\x20%s',_0x7b7e98,_0x2b39c7[_0xdcf0('0xf')]['message']);return _0x3eee9c(_0x2b39c7[_0xdcf0('0xf')][_0xdcf0('0x11')]);}else{logger[_0xdcf0('0xa')](_0xdcf0('0xb'),_0x7b7e98,_0xdcf0('0xd'));_0x3eee9c(_0x2b39c7[_0xdcf0('0x12')][_0xdcf0('0x11')]);}})[_0xdcf0('0x13')](function(_0x1c5d08){logger['error']('SquareReport,\x20%s,\x20%s',_0x7b7e98,_0x1c5d08);_0x13f066(_0x1c5d08);});});}exports['CreateSquareReport']=function(_0x2c931e){var _0x436ea8=this;return new Promise(function(_0x3a18d0,_0x44cbe6){return db[_0xdcf0('0x14')]['create'](_0x2c931e['body'],{'raw':_0x2c931e[_0xdcf0('0x15')]?_0x2c931e[_0xdcf0('0x15')]['raw']===undefined?!![]:![]:!![]})[_0xdcf0('0x9')](function(_0x2953cf){logger[_0xdcf0('0xa')]('CreateSquareReport',_0x2c931e);logger[_0xdcf0('0xc')]('CreateSquareReport',_0x2c931e,JSON[_0xdcf0('0xe')](_0x2953cf));_0x3a18d0(_0x2953cf);})[_0xdcf0('0x13')](function(_0x2e9bb7){logger[_0xdcf0('0xf')](_0xdcf0('0x16'),_0x2e9bb7['message'],_0x2c931e);_0x44cbe6(_0x436ea8['error'](0x1f4,_0x2e9bb7[_0xdcf0('0x11')]));});});};exports[_0xdcf0('0x17')]=function(_0x2a96ca){var _0x4e76a2=this;return new Promise(function(_0x3cec5c,_0x5117ad){return db['SquareReport']['update'](_0x2a96ca[_0xdcf0('0x18')],{'raw':_0x2a96ca[_0xdcf0('0x15')]?_0x2a96ca[_0xdcf0('0x15')][_0xdcf0('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2a96ca[_0xdcf0('0x15')]?_0x2a96ca[_0xdcf0('0x15')][_0xdcf0('0x1a')]||null:null,'attributes':_0x2a96ca['options']?_0x2a96ca['options'][_0xdcf0('0x1b')]||null:null,'limit':_0x2a96ca[_0xdcf0('0x15')]?_0x2a96ca['options'][_0xdcf0('0x1c')]||null:null})[_0xdcf0('0x9')](function(_0x4f22d8){logger[_0xdcf0('0xa')]('UpdateSquareReport',_0x2a96ca);logger['debug'](_0xdcf0('0x17'),_0x2a96ca,JSON[_0xdcf0('0xe')](_0x4f22d8));_0x3cec5c(_0x4f22d8);})[_0xdcf0('0x13')](function(_0x1f6f07){logger['error']('UpdateSquareReport',_0x1f6f07[_0xdcf0('0x11')],_0x2a96ca);_0x5117ad(_0x4e76a2[_0xdcf0('0xf')](0x1f4,_0x1f6f07[_0xdcf0('0x11')]));});});}; \ No newline at end of file +var _0x5ffc=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','info','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','SquareReport,\x20%s,\x20%s','message','catch','CreateSquareReport','body','options','raw','UpdateSquareReport','SquareReport','where','attributes','limit','lodash','util','moment','bluebird','randomstring'];(function(_0x3cef5e,_0x1b95ae){var _0x20b9c2=function(_0x35a6e4){while(--_0x35a6e4){_0x3cef5e['push'](_0x3cef5e['shift']());}};_0x20b9c2(++_0x1b95ae);}(_0x5ffc,0x19f));var _0xc5ff=function(_0x2aa733,_0xcde568){_0x2aa733=_0x2aa733-0x0;var _0x2bcf85=_0x5ffc[_0x2aa733];return _0x2bcf85;};'use strict';var _=require(_0xc5ff('0x0'));var util=require(_0xc5ff('0x1'));var moment=require(_0xc5ff('0x2'));var BPromise=require(_0xc5ff('0x3'));var rs=require(_0xc5ff('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc5ff('0x5'))['db'];var utils=require(_0xc5ff('0x6'));var logger=require(_0xc5ff('0x7'))(_0xc5ff('0x8'));var config=require(_0xc5ff('0x9'));var jayson=require(_0xc5ff('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3a2a2f,_0x31ee4a,_0x551db6){return new BPromise(function(_0x305404,_0x5b1758){return client['request'](_0x3a2a2f,_0x551db6)[_0xc5ff('0xb')](function(_0x3e3da3){logger[_0xc5ff('0xc')]('SquareReport,\x20%s,\x20%s',_0x31ee4a,_0xc5ff('0xd'));logger[_0xc5ff('0xe')](_0xc5ff('0xf'),_0x31ee4a,_0xc5ff('0xd'),JSON[_0xc5ff('0x10')](_0x3e3da3));if(_0x3e3da3[_0xc5ff('0x11')]){if(_0x3e3da3[_0xc5ff('0x11')]['code']===0x1f4){logger[_0xc5ff('0x11')](_0xc5ff('0x12'),_0x31ee4a,_0x3e3da3[_0xc5ff('0x11')]['message']);return _0x5b1758(_0x3e3da3['error'][_0xc5ff('0x13')]);}logger[_0xc5ff('0x11')]('SquareReport,\x20%s,\x20%s',_0x31ee4a,_0x3e3da3['error'][_0xc5ff('0x13')]);return _0x305404(_0x3e3da3[_0xc5ff('0x11')]['message']);}else{logger['info'](_0xc5ff('0x12'),_0x31ee4a,_0xc5ff('0xd'));_0x305404(_0x3e3da3['result']['message']);}})[_0xc5ff('0x14')](function(_0x23bb8f){logger['error'](_0xc5ff('0x12'),_0x31ee4a,_0x23bb8f);_0x5b1758(_0x23bb8f);});});}exports[_0xc5ff('0x15')]=function(_0xe2da2e){var _0xde8308=this;return new Promise(function(_0x27feca,_0x4ac582){return db['SquareReport']['create'](_0xe2da2e[_0xc5ff('0x16')],{'raw':_0xe2da2e[_0xc5ff('0x17')]?_0xe2da2e['options'][_0xc5ff('0x18')]===undefined?!![]:![]:!![]})[_0xc5ff('0xb')](function(_0x36f948){logger[_0xc5ff('0xc')](_0xc5ff('0x15'),_0xe2da2e);logger[_0xc5ff('0xe')]('CreateSquareReport',_0xe2da2e,JSON[_0xc5ff('0x10')](_0x36f948));_0x27feca(_0x36f948);})[_0xc5ff('0x14')](function(_0x5a04d7){logger[_0xc5ff('0x11')](_0xc5ff('0x15'),_0x5a04d7['message'],_0xe2da2e);_0x4ac582(_0xde8308[_0xc5ff('0x11')](0x1f4,_0x5a04d7[_0xc5ff('0x13')]));});});};exports[_0xc5ff('0x19')]=function(_0x41292a){var _0x549390=this;return new Promise(function(_0x308df6,_0x122ecb){return db[_0xc5ff('0x1a')]['update'](_0x41292a['body'],{'raw':_0x41292a[_0xc5ff('0x17')]?_0x41292a[_0xc5ff('0x17')][_0xc5ff('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x41292a[_0xc5ff('0x17')]?_0x41292a[_0xc5ff('0x17')][_0xc5ff('0x1b')]||null:null,'attributes':_0x41292a['options']?_0x41292a[_0xc5ff('0x17')][_0xc5ff('0x1c')]||null:null,'limit':_0x41292a[_0xc5ff('0x17')]?_0x41292a['options'][_0xc5ff('0x1d')]||null:null})[_0xc5ff('0xb')](function(_0x122a8d){logger[_0xc5ff('0xc')](_0xc5ff('0x19'),_0x41292a);logger['debug'](_0xc5ff('0x19'),_0x41292a,JSON[_0xc5ff('0x10')](_0x122a8d));_0x308df6(_0x122a8d);})['catch'](function(_0x319424){logger[_0xc5ff('0x11')](_0xc5ff('0x19'),_0x319424['message'],_0x41292a);_0x122ecb(_0x549390[_0xc5ff('0x11')](0x1f4,_0x319424['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 4cc5943..591fd97 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 _0xb285=['express','../../components/auth/service','../../config/environment','./squareReportDetail.controller','get','index','/describe','/:id','show','post','isAuthenticated','create','update','delete','destroy','multer','util','path','connect-timeout'];(function(_0x3aec4a,_0x48fe63){var _0x879bfa=function(_0x1e30bc){while(--_0x1e30bc){_0x3aec4a['push'](_0x3aec4a['shift']());}};_0x879bfa(++_0x48fe63);}(_0xb285,0x19e));var _0x5b28=function(_0x967959,_0x53c5c1){_0x967959=_0x967959-0x0;var _0x5c4489=_0xb285[_0x967959];return _0x5c4489;};'use strict';var multer=require(_0x5b28('0x0'));var util=require(_0x5b28('0x1'));var path=require(_0x5b28('0x2'));var timeout=require(_0x5b28('0x3'));var express=require(_0x5b28('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x5b28('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x5b28('0x6'));var controller=require(_0x5b28('0x7'));router[_0x5b28('0x8')]('/',auth['isAuthenticated'](),controller[_0x5b28('0x9')]);router['get'](_0x5b28('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x5b28('0x8')](_0x5b28('0xb'),auth['isAuthenticated'](),controller[_0x5b28('0xc')]);router[_0x5b28('0xd')]('/',auth[_0x5b28('0xe')](),controller[_0x5b28('0xf')]);router['put']('/:id',auth[_0x5b28('0xe')](),controller[_0x5b28('0x10')]);router[_0x5b28('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x5b28('0x12')]);module['exports']=router; \ No newline at end of file +var _0x913c=['isAuthenticated','/describe','describe','/:id','post','create','put','update','delete','destroy','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get'];(function(_0x39ab75,_0x5d9f40){var _0x594e9e=function(_0x434f80){while(--_0x434f80){_0x39ab75['push'](_0x39ab75['shift']());}};_0x594e9e(++_0x5d9f40);}(_0x913c,0xd0));var _0xc913=function(_0x3ec117,_0x319fd8){_0x3ec117=_0x3ec117-0x0;var _0x53f1ba=_0x913c[_0x3ec117];return _0x53f1ba;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xc913('0x0'));var express=require(_0xc913('0x1'));var router=express[_0xc913('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xc913('0x3'));var interaction=require(_0xc913('0x4'));var config=require(_0xc913('0x5'));var controller=require(_0xc913('0x6'));router[_0xc913('0x7')]('/',auth[_0xc913('0x8')](),controller['index']);router[_0xc913('0x7')](_0xc913('0x9'),auth[_0xc913('0x8')](),controller[_0xc913('0xa')]);router[_0xc913('0x7')](_0xc913('0xb'),auth[_0xc913('0x8')](),controller['show']);router[_0xc913('0xc')]('/',auth[_0xc913('0x8')](),controller[_0xc913('0xd')]);router[_0xc913('0xe')](_0xc913('0xb'),auth[_0xc913('0x8')](),controller[_0xc913('0xf')]);router[_0xc913('0x10')](_0xc913('0xb'),auth['isAuthenticated'](),controller[_0xc913('0x11')]);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 65dd63b..7d6e0b2 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 _0x8152=['TEXT','sequelize','exports','STRING'];(function(_0x3fe5b1,_0x1b9732){var _0x2cc1cf=function(_0x32b299){while(--_0x32b299){_0x3fe5b1['push'](_0x3fe5b1['shift']());}};_0x2cc1cf(++_0x1b9732);}(_0x8152,0x81));var _0x2815=function(_0x358d7c,_0x433fc6){_0x358d7c=_0x358d7c-0x0;var _0x3e54e4=_0x8152[_0x358d7c];return _0x3e54e4;};'use strict';var Sequelize=require(_0x2815('0x0'));module[_0x2815('0x1')]={'uniqueid':{'type':Sequelize[_0x2815('0x2')]},'node':{'type':Sequelize[_0x2815('0x2')]},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize[_0x2815('0x3')]},'project_name':{'type':Sequelize[_0x2815('0x2')]},'callerid':{'type':Sequelize[_0x2815('0x2')]}}; \ No newline at end of file +var _0x2fb1=['sequelize','STRING','TEXT'];(function(_0x3241ee,_0x37dc59){var _0x5845f7=function(_0x552acd){while(--_0x552acd){_0x3241ee['push'](_0x3241ee['shift']());}};_0x5845f7(++_0x37dc59);}(_0x2fb1,0xd8));var _0x12fb=function(_0x502c4d,_0x44e6a4){_0x502c4d=_0x502c4d-0x0;var _0x24ce60=_0x2fb1[_0x502c4d];return _0x24ce60;};'use strict';var Sequelize=require(_0x12fb('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize[_0x12fb('0x1')]},'data':{'type':Sequelize[_0x12fb('0x2')]},'project_name':{'type':Sequelize[_0x12fb('0x1')]},'callerid':{'type':Sequelize[_0x12fb('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 7799b4f..dea0686 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 _0xe404=['length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','count','findAll','params','includeAll','include','find','catch','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','set','apply','reject','save','update','then','error','name','send','index','SquareDetailsReport','rawAttributes','key','model','map','query','keys','filters','intersection','attributes','fields'];(function(_0x586f2b,_0x331fc0){var _0x29927f=function(_0x4cc557){while(--_0x4cc557){_0x586f2b['push'](_0x586f2b['shift']());}};_0x29927f(++_0x331fc0);}(_0xe404,0x144));var _0x4e40=function(_0x2fa079,_0x4e406a){_0x2fa079=_0x2fa079-0x0;var _0x8bf6ca=_0xe404[_0x2fa079];return _0x8bf6ca;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4e40('0x0'));var zipdir=require(_0x4e40('0x1'));var jsonpatch=require(_0x4e40('0x2'));var rp=require(_0x4e40('0x3'));var moment=require(_0x4e40('0x4'));var BPromise=require(_0x4e40('0x5'));var Mustache=require(_0x4e40('0x6'));var util=require('util');var path=require(_0x4e40('0x7'));var sox=require(_0x4e40('0x8'));var csv=require(_0x4e40('0x9'));var ejs=require(_0x4e40('0xa'));var fs=require('fs');var fs_extra=require(_0x4e40('0xb'));var _=require(_0x4e40('0xc'));var squel=require(_0x4e40('0xd'));var crypto=require(_0x4e40('0xe'));var jsforce=require(_0x4e40('0xf'));var deskjs=require(_0x4e40('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4e40('0x11'));var Redis=require(_0x4e40('0x12'));var authService=require(_0x4e40('0x13'));var qs=require(_0x4e40('0x14'));var as=require(_0x4e40('0x15'));var hardwareService=require(_0x4e40('0x16'));var logger=require(_0x4e40('0x17'))('api');var utils=require(_0x4e40('0x18'));var config=require(_0x4e40('0x19'));var licenseUtil=require(_0x4e40('0x1a'));var db=require(_0x4e40('0x1b'))['db'];function respondWithStatusCode(_0x433ccc,_0x51da10){_0x51da10=_0x51da10||0xcc;return function(_0x34e3c6){if(_0x34e3c6){return _0x433ccc[_0x4e40('0x1c')](_0x51da10);}return _0x433ccc['status'](_0x51da10)[_0x4e40('0x1d')]();};}function respondWithResult(_0x588552,_0x8b95e2){_0x8b95e2=_0x8b95e2||0xc8;return function(_0xe7de05){if(_0xe7de05){return _0x588552[_0x4e40('0x1e')](_0x8b95e2)[_0x4e40('0x1f')](_0xe7de05);}};}function respondWithFilteredResult(_0x54b8b2,_0x5d2318){return function(_0x4fec5d){if(_0x4fec5d){var _0x260619=typeof _0x5d2318[_0x4e40('0x20')]===_0x4e40('0x21')&&typeof _0x5d2318[_0x4e40('0x22')]==='undefined';var _0x50e936=_0x4fec5d['count'];var _0x231937=_0x260619?0x0:_0x5d2318[_0x4e40('0x20')];var _0x503270=_0x260619?_0x4fec5d['count']:_0x5d2318[_0x4e40('0x20')]+_0x5d2318[_0x4e40('0x22')];var _0x58d72d;if(_0x503270>=_0x50e936){_0x503270=_0x50e936;_0x58d72d=0xc8;}else{_0x58d72d=0xce;}_0x54b8b2[_0x4e40('0x1e')](_0x58d72d);return _0x54b8b2[_0x4e40('0x23')]('Content-Range',_0x231937+'-'+_0x503270+'/'+_0x50e936)[_0x4e40('0x1f')](_0x4fec5d);}return null;};}function patchUpdates(_0x5f56b6){return function(_0x4c0908){try{jsonpatch[_0x4e40('0x24')](_0x4c0908,_0x5f56b6,!![]);}catch(_0xa667fd){return BPromise[_0x4e40('0x25')](_0xa667fd);}return _0x4c0908[_0x4e40('0x26')]();};}function saveUpdates(_0x1893c1,_0x556f7e){return function(_0x3392d9){if(_0x3392d9){return _0x3392d9[_0x4e40('0x27')](_0x1893c1)[_0x4e40('0x28')](function(_0x350254){return _0x350254;});}return null;};}function removeEntity(_0xe84bde,_0x439ce7){return function(_0x3c1200){if(_0x3c1200){return _0x3c1200['destroy']()[_0x4e40('0x28')](function(){_0xe84bde[_0x4e40('0x1e')](0xcc)[_0x4e40('0x1d')]();});}};}function handleEntityNotFound(_0x53a6b6,_0x254516){return function(_0x4e4419){if(!_0x4e4419){_0x53a6b6[_0x4e40('0x1c')](0x194);}return _0x4e4419;};}function handleError(_0x5634ac,_0x25815e){_0x25815e=_0x25815e||0x1f4;return function(_0xf25e66){logger[_0x4e40('0x29')](_0xf25e66['stack']);if(_0xf25e66[_0x4e40('0x2a')]){delete _0xf25e66['name'];}_0x5634ac['status'](_0x25815e)[_0x4e40('0x2b')](_0xf25e66);};}exports[_0x4e40('0x2c')]=function(_0x353fd5,_0x5551db){var _0x4e8c49={},_0x107daa={},_0x4569fc={'count':0x0,'rows':[]};var _0x1c4af7=_['map'](db[_0x4e40('0x2d')][_0x4e40('0x2e')],function(_0x341321){return{'name':_0x341321['fieldName'],'type':_0x341321['type'][_0x4e40('0x2f')]};});_0x107daa[_0x4e40('0x30')]=_[_0x4e40('0x31')](_0x1c4af7,_0x4e40('0x2a'));_0x107daa[_0x4e40('0x32')]=_[_0x4e40('0x33')](_0x353fd5[_0x4e40('0x32')]);_0x107daa[_0x4e40('0x34')]=_[_0x4e40('0x35')](_0x107daa['model'],_0x107daa[_0x4e40('0x32')]);_0x4e8c49[_0x4e40('0x36')]=_[_0x4e40('0x35')](_0x107daa['model'],qs[_0x4e40('0x37')](_0x353fd5['query'][_0x4e40('0x37')]));_0x4e8c49[_0x4e40('0x36')]=_0x4e8c49[_0x4e40('0x36')][_0x4e40('0x38')]?_0x4e8c49[_0x4e40('0x36')]:_0x107daa[_0x4e40('0x30')];if(!_0x353fd5[_0x4e40('0x32')][_0x4e40('0x39')](_0x4e40('0x3a'))){_0x4e8c49[_0x4e40('0x22')]=qs[_0x4e40('0x22')](_0x353fd5['query'][_0x4e40('0x22')]);_0x4e8c49['offset']=qs[_0x4e40('0x20')](_0x353fd5[_0x4e40('0x32')][_0x4e40('0x20')]);}_0x4e8c49['order']=qs[_0x4e40('0x3b')](_0x353fd5[_0x4e40('0x32')][_0x4e40('0x3b')]);_0x4e8c49[_0x4e40('0x3c')]=qs['filters'](_[_0x4e40('0x3d')](_0x353fd5[_0x4e40('0x32')],_0x107daa[_0x4e40('0x34')]),_0x1c4af7);if(_0x353fd5[_0x4e40('0x32')]['filter']){_0x4e8c49['where']=_[_0x4e40('0x3e')](_0x4e8c49[_0x4e40('0x3c')],{'$or':_[_0x4e40('0x31')](_0x1c4af7,function(_0x5cb0db){if(_0x5cb0db['type']!==_0x4e40('0x3f')){var _0x542445={};_0x542445[_0x5cb0db[_0x4e40('0x2a')]]={'$like':'%'+_0x353fd5[_0x4e40('0x32')][_0x4e40('0x40')]+'%'};return _0x542445;}})});}_0x4e8c49=_[_0x4e40('0x3e')]({},_0x4e8c49,_0x353fd5[_0x4e40('0x41')]);var _0x3db387={'where':_0x4e8c49[_0x4e40('0x3c')]};return db[_0x4e40('0x2d')]['count'](_0x3db387)[_0x4e40('0x28')](function(_0x5eea6e){_0x4569fc[_0x4e40('0x42')]=_0x5eea6e;if(_0x353fd5[_0x4e40('0x32')]['includeAll']){_0x4e8c49['include']=[{'all':!![]}];}return db[_0x4e40('0x2d')][_0x4e40('0x43')](_0x4e8c49);})[_0x4e40('0x28')](function(_0x31c188){_0x4569fc['rows']=_0x31c188;return _0x4569fc;})[_0x4e40('0x28')](respondWithFilteredResult(_0x5551db,_0x4e8c49))['catch'](handleError(_0x5551db,null));};exports['show']=function(_0x116521,_0x128de8){var _0x734034={'raw':!![],'where':{'id':_0x116521[_0x4e40('0x44')]['id']}},_0x54ffed={};_0x54ffed[_0x4e40('0x30')]=_[_0x4e40('0x33')](db[_0x4e40('0x2d')]['rawAttributes']);_0x54ffed[_0x4e40('0x32')]=_[_0x4e40('0x33')](_0x116521['query']);_0x54ffed[_0x4e40('0x34')]=_[_0x4e40('0x35')](_0x54ffed[_0x4e40('0x30')],_0x54ffed['query']);_0x734034[_0x4e40('0x36')]=_[_0x4e40('0x35')](_0x54ffed['model'],qs['fields'](_0x116521[_0x4e40('0x32')]['fields']));_0x734034[_0x4e40('0x36')]=_0x734034[_0x4e40('0x36')][_0x4e40('0x38')]?_0x734034[_0x4e40('0x36')]:_0x54ffed['model'];if(_0x116521[_0x4e40('0x32')][_0x4e40('0x45')]){_0x734034[_0x4e40('0x46')]=[{'all':!![]}];}_0x734034=_[_0x4e40('0x3e')]({},_0x734034,_0x116521[_0x4e40('0x41')]);return db['SquareDetailsReport'][_0x4e40('0x47')](_0x734034)[_0x4e40('0x28')](handleEntityNotFound(_0x128de8,null))[_0x4e40('0x28')](respondWithResult(_0x128de8,null))[_0x4e40('0x48')](handleError(_0x128de8,null));};exports[_0x4e40('0x49')]=function(_0x5a0164,_0x44c7a){return db[_0x4e40('0x2d')][_0x4e40('0x49')](_0x5a0164[_0x4e40('0x4a')],{})[_0x4e40('0x28')](respondWithResult(_0x44c7a,0xc9))[_0x4e40('0x48')](handleError(_0x44c7a,null));};exports[_0x4e40('0x27')]=function(_0xb44eb6,_0x43dce9){if(_0xb44eb6[_0x4e40('0x4a')]['id']){delete _0xb44eb6[_0x4e40('0x4a')]['id'];}return db[_0x4e40('0x2d')][_0x4e40('0x47')]({'where':{'id':_0xb44eb6[_0x4e40('0x44')]['id']}})[_0x4e40('0x28')](handleEntityNotFound(_0x43dce9,null))[_0x4e40('0x28')](saveUpdates(_0xb44eb6[_0x4e40('0x4a')],null))[_0x4e40('0x28')](respondWithResult(_0x43dce9,null))['catch'](handleError(_0x43dce9,null));};exports['destroy']=function(_0x54a633,_0x433355){return db[_0x4e40('0x2d')]['find']({'where':{'id':_0x54a633[_0x4e40('0x44')]['id']}})['then'](handleEntityNotFound(_0x433355,null))[_0x4e40('0x28')](removeEntity(_0x433355,null))[_0x4e40('0x48')](handleError(_0x433355,null));};exports[_0x4e40('0x4b')]=function(_0x234ef1,_0x1ea4ce){return db[_0x4e40('0x2d')][_0x4e40('0x4b')]()[_0x4e40('0x28')](respondWithResult(_0x1ea4ce,null))[_0x4e40('0x48')](handleError(_0x1ea4ce,null));}; \ No newline at end of file +var _0xd002=['lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','map','SquareDetailsReport','rawAttributes','type','keys','query','filters','model','attributes','intersection','fields','nolimit','limit','offset','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','length','find','create','body','params','describe','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs'];(function(_0x1c8790,_0x7fca0e){var _0x5cab4c=function(_0x461964){while(--_0x461964){_0x1c8790['push'](_0x1c8790['shift']());}};_0x5cab4c(++_0x7fca0e);}(_0xd002,0x10f));var _0x2d00=function(_0x1e4806,_0x4d70f1){_0x1e4806=_0x1e4806-0x0;var _0x24b274=_0xd002[_0x1e4806];return _0x24b274;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x2d00('0x0'));var jsonpatch=require(_0x2d00('0x1'));var rp=require(_0x2d00('0x2'));var moment=require(_0x2d00('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x2d00('0x4'));var util=require('util');var path=require(_0x2d00('0x5'));var sox=require(_0x2d00('0x6'));var csv=require(_0x2d00('0x7'));var ejs=require(_0x2d00('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2d00('0x9'));var squel=require('squel');var crypto=require(_0x2d00('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x2d00('0xb'));var toCsv=require(_0x2d00('0x7'));var querystring=require(_0x2d00('0xc'));var Papa=require(_0x2d00('0xd'));var Redis=require('ioredis');var authService=require(_0x2d00('0xe'));var qs=require(_0x2d00('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x2d00('0x10'))(_0x2d00('0x11'));var utils=require(_0x2d00('0x12'));var config=require(_0x2d00('0x13'));var licenseUtil=require(_0x2d00('0x14'));var db=require(_0x2d00('0x15'))['db'];function respondWithStatusCode(_0x256e32,_0x31dcf6){_0x31dcf6=_0x31dcf6||0xcc;return function(_0x1dd136){if(_0x1dd136){return _0x256e32[_0x2d00('0x16')](_0x31dcf6);}return _0x256e32[_0x2d00('0x17')](_0x31dcf6)[_0x2d00('0x18')]();};}function respondWithResult(_0x3a1be2,_0x82aa18){_0x82aa18=_0x82aa18||0xc8;return function(_0x2c73d0){if(_0x2c73d0){return _0x3a1be2[_0x2d00('0x17')](_0x82aa18)[_0x2d00('0x19')](_0x2c73d0);}};}function respondWithFilteredResult(_0x49bdd4,_0x1735a0){return function(_0x20bd1d){if(_0x20bd1d){var _0x1ea470=typeof _0x1735a0['offset']===_0x2d00('0x1a')&&typeof _0x1735a0['limit']===_0x2d00('0x1a');var _0x3f18c1=_0x20bd1d[_0x2d00('0x1b')];var _0x2e27c6=_0x1ea470?0x0:_0x1735a0['offset'];var _0x8205d7=_0x1ea470?_0x20bd1d[_0x2d00('0x1b')]:_0x1735a0['offset']+_0x1735a0['limit'];var _0x5eded3;if(_0x8205d7>=_0x3f18c1){_0x8205d7=_0x3f18c1;_0x5eded3=0xc8;}else{_0x5eded3=0xce;}_0x49bdd4[_0x2d00('0x17')](_0x5eded3);return _0x49bdd4[_0x2d00('0x1c')]('Content-Range',_0x2e27c6+'-'+_0x8205d7+'/'+_0x3f18c1)['json'](_0x20bd1d);}return null;};}function patchUpdates(_0x363121){return function(_0x619562){try{jsonpatch[_0x2d00('0x1d')](_0x619562,_0x363121,!![]);}catch(_0x5c4b86){return BPromise[_0x2d00('0x1e')](_0x5c4b86);}return _0x619562[_0x2d00('0x1f')]();};}function saveUpdates(_0x96fae3,_0x1a83f6){return function(_0x150caf){if(_0x150caf){return _0x150caf[_0x2d00('0x20')](_0x96fae3)[_0x2d00('0x21')](function(_0x5203a7){return _0x5203a7;});}return null;};}function removeEntity(_0xe95d23,_0x53d5e8){return function(_0x40bb6d){if(_0x40bb6d){return _0x40bb6d[_0x2d00('0x22')]()[_0x2d00('0x21')](function(){_0xe95d23[_0x2d00('0x17')](0xcc)[_0x2d00('0x18')]();});}};}function handleEntityNotFound(_0x33c3ba,_0x267c3f){return function(_0x128efa){if(!_0x128efa){_0x33c3ba[_0x2d00('0x16')](0x194);}return _0x128efa;};}function handleError(_0xcbdc2,_0x31100d){_0x31100d=_0x31100d||0x1f4;return function(_0x45fe72){logger[_0x2d00('0x23')](_0x45fe72[_0x2d00('0x24')]);if(_0x45fe72[_0x2d00('0x25')]){delete _0x45fe72[_0x2d00('0x25')];}_0xcbdc2[_0x2d00('0x17')](_0x31100d)[_0x2d00('0x26')](_0x45fe72);};}exports['index']=function(_0x39cda3,_0x4cbafe){var _0x2cd822={},_0x438161={},_0x40dcae={'count':0x0,'rows':[]};var _0x115641=_[_0x2d00('0x27')](db[_0x2d00('0x28')][_0x2d00('0x29')],function(_0x363cc1){return{'name':_0x363cc1['fieldName'],'type':_0x363cc1[_0x2d00('0x2a')]['key']};});_0x438161['model']=_[_0x2d00('0x27')](_0x115641,_0x2d00('0x25'));_0x438161['query']=_[_0x2d00('0x2b')](_0x39cda3[_0x2d00('0x2c')]);_0x438161[_0x2d00('0x2d')]=_['intersection'](_0x438161[_0x2d00('0x2e')],_0x438161['query']);_0x2cd822[_0x2d00('0x2f')]=_[_0x2d00('0x30')](_0x438161['model'],qs['fields'](_0x39cda3[_0x2d00('0x2c')][_0x2d00('0x31')]));_0x2cd822['attributes']=_0x2cd822[_0x2d00('0x2f')]['length']?_0x2cd822[_0x2d00('0x2f')]:_0x438161[_0x2d00('0x2e')];if(!_0x39cda3[_0x2d00('0x2c')]['hasOwnProperty'](_0x2d00('0x32'))){_0x2cd822[_0x2d00('0x33')]=qs['limit'](_0x39cda3[_0x2d00('0x2c')]['limit']);_0x2cd822[_0x2d00('0x34')]=qs['offset'](_0x39cda3[_0x2d00('0x2c')][_0x2d00('0x34')]);}_0x2cd822['order']=qs[_0x2d00('0x35')](_0x39cda3[_0x2d00('0x2c')][_0x2d00('0x35')]);_0x2cd822[_0x2d00('0x36')]=qs[_0x2d00('0x2d')](_[_0x2d00('0x37')](_0x39cda3[_0x2d00('0x2c')],_0x438161['filters']),_0x115641);if(_0x39cda3[_0x2d00('0x2c')][_0x2d00('0x38')]){_0x2cd822['where']=_['merge'](_0x2cd822['where'],{'$or':_[_0x2d00('0x27')](_0x115641,function(_0x426f4a){if(_0x426f4a[_0x2d00('0x2a')]!==_0x2d00('0x39')){var _0x2ea2e6={};_0x2ea2e6[_0x426f4a[_0x2d00('0x25')]]={'$like':'%'+_0x39cda3['query']['filter']+'%'};return _0x2ea2e6;}})});}_0x2cd822=_[_0x2d00('0x3a')]({},_0x2cd822,_0x39cda3[_0x2d00('0x3b')]);var _0x9ba242={'where':_0x2cd822['where']};return db[_0x2d00('0x28')][_0x2d00('0x1b')](_0x9ba242)['then'](function(_0x431b30){_0x40dcae[_0x2d00('0x1b')]=_0x431b30;if(_0x39cda3[_0x2d00('0x2c')][_0x2d00('0x3c')]){_0x2cd822['include']=[{'all':!![]}];}return db[_0x2d00('0x28')][_0x2d00('0x3d')](_0x2cd822);})[_0x2d00('0x21')](function(_0x4fdced){_0x40dcae[_0x2d00('0x3e')]=_0x4fdced;return _0x40dcae;})[_0x2d00('0x21')](respondWithFilteredResult(_0x4cbafe,_0x2cd822))[_0x2d00('0x3f')](handleError(_0x4cbafe,null));};exports['show']=function(_0x2aec50,_0x305be6){var _0x1679e8={'raw':!![],'where':{'id':_0x2aec50['params']['id']}},_0x6160df={};_0x6160df['model']=_[_0x2d00('0x2b')](db[_0x2d00('0x28')][_0x2d00('0x29')]);_0x6160df[_0x2d00('0x2c')]=_['keys'](_0x2aec50[_0x2d00('0x2c')]);_0x6160df[_0x2d00('0x2d')]=_[_0x2d00('0x30')](_0x6160df[_0x2d00('0x2e')],_0x6160df[_0x2d00('0x2c')]);_0x1679e8['attributes']=_['intersection'](_0x6160df[_0x2d00('0x2e')],qs[_0x2d00('0x31')](_0x2aec50[_0x2d00('0x2c')][_0x2d00('0x31')]));_0x1679e8[_0x2d00('0x2f')]=_0x1679e8['attributes'][_0x2d00('0x40')]?_0x1679e8[_0x2d00('0x2f')]:_0x6160df['model'];if(_0x2aec50[_0x2d00('0x2c')][_0x2d00('0x3c')]){_0x1679e8['include']=[{'all':!![]}];}_0x1679e8=_[_0x2d00('0x3a')]({},_0x1679e8,_0x2aec50['options']);return db[_0x2d00('0x28')][_0x2d00('0x41')](_0x1679e8)[_0x2d00('0x21')](handleEntityNotFound(_0x305be6,null))['then'](respondWithResult(_0x305be6,null))[_0x2d00('0x3f')](handleError(_0x305be6,null));};exports[_0x2d00('0x42')]=function(_0x446006,_0x21d392){return db['SquareDetailsReport'][_0x2d00('0x42')](_0x446006['body'],{})['then'](respondWithResult(_0x21d392,0xc9))['catch'](handleError(_0x21d392,null));};exports['update']=function(_0x11c4ce,_0x3e39dc){if(_0x11c4ce[_0x2d00('0x43')]['id']){delete _0x11c4ce[_0x2d00('0x43')]['id'];}return db['SquareDetailsReport'][_0x2d00('0x41')]({'where':{'id':_0x11c4ce['params']['id']}})[_0x2d00('0x21')](handleEntityNotFound(_0x3e39dc,null))[_0x2d00('0x21')](saveUpdates(_0x11c4ce[_0x2d00('0x43')],null))[_0x2d00('0x21')](respondWithResult(_0x3e39dc,null))[_0x2d00('0x3f')](handleError(_0x3e39dc,null));};exports[_0x2d00('0x22')]=function(_0x1176d7,_0x4291a3){return db[_0x2d00('0x28')]['find']({'where':{'id':_0x1176d7[_0x2d00('0x44')]['id']}})[_0x2d00('0x21')](handleEntityNotFound(_0x4291a3,null))[_0x2d00('0x21')](removeEntity(_0x4291a3,null))[_0x2d00('0x3f')](handleError(_0x4291a3,null));};exports[_0x2d00('0x45')]=function(_0xa7cf44,_0x10403d){return db['SquareDetailsReport'][_0x2d00('0x45')]()[_0x2d00('0x21')](respondWithResult(_0x10403d,null))[_0x2d00('0x3f')](handleError(_0x10403d,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 4e71c9b..1189b07 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 _0xa36e=['request-promise','path','rimraf','./squareReportDetail.attributes','lodash','util','api','moment','bluebird'];(function(_0x1da09c,_0x29d5ea){var _0x1b09fa=function(_0x29189c){while(--_0x29189c){_0x1da09c['push'](_0x1da09c['shift']());}};_0x1b09fa(++_0x29d5ea);}(_0xa36e,0x109));var _0xea36=function(_0x3af7d4,_0x2f817b){_0x3af7d4=_0x3af7d4-0x0;var _0x4c8da4=_0xa36e[_0x3af7d4];return _0x4c8da4;};'use strict';var _=require(_0xea36('0x0'));var util=require(_0xea36('0x1'));var logger=require('../../config/logger')(_0xea36('0x2'));var moment=require(_0xea36('0x3'));var BPromise=require(_0xea36('0x4'));var rp=require(_0xea36('0x5'));var fs=require('fs');var path=require(_0xea36('0x6'));var rimraf=require(_0xea36('0x7'));var config=require('../../config/environment');var attributes=require(_0xea36('0x8'));module['exports']=function(_0x1ede3e,_0x27b076){return _0x1ede3e['define']('SquareDetailsReport',attributes,{'tableName':'report_square_details','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8425=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareReportDetail.attributes','exports','define','SquareDetailsReport','report_square_details','lodash','util','../../config/logger','api'];(function(_0x1ac2c2,_0x21d7bf){var _0x5d508f=function(_0x2b4e3c){while(--_0x2b4e3c){_0x1ac2c2['push'](_0x1ac2c2['shift']());}};_0x5d508f(++_0x21d7bf);}(_0x8425,0x65));var _0x5842=function(_0x582978,_0xfc1e41){_0x582978=_0x582978-0x0;var _0x124132=_0x8425[_0x582978];return _0x124132;};'use strict';var _=require(_0x5842('0x0'));var util=require(_0x5842('0x1'));var logger=require(_0x5842('0x2'))(_0x5842('0x3'));var moment=require(_0x5842('0x4'));var BPromise=require(_0x5842('0x5'));var rp=require(_0x5842('0x6'));var fs=require('fs');var path=require(_0x5842('0x7'));var rimraf=require(_0x5842('0x8'));var config=require(_0x5842('0x9'));var attributes=require(_0x5842('0xa'));module[_0x5842('0xb')]=function(_0x2e717b,_0x2f9d45){return _0x2e717b[_0x5842('0xc')](_0x5842('0xd'),attributes,{'tableName':_0x5842('0xe'),'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 61f9c4e..bc82c8d 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 _0x3de3=['../../config/logger','../../config/environment','jayson/promise','http','request','then','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','CreateSquareDetailsReport','create','options','raw','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x35421e,_0x3e37f1){var _0x241e0f=function(_0xb16213){while(--_0xb16213){_0x35421e['push'](_0x35421e['shift']());}};_0x241e0f(++_0x3e37f1);}(_0x3de3,0x1ce));var _0x33de=function(_0x197a54,_0xc35b61){_0x197a54=_0x197a54-0x0;var _0x1284da=_0x3de3[_0x197a54];return _0x1284da;};'use strict';var _=require(_0x33de('0x0'));var util=require('util');var moment=require(_0x33de('0x1'));var BPromise=require(_0x33de('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x33de('0x3'));var db=require(_0x33de('0x4'))['db'];var utils=require(_0x33de('0x5'));var logger=require(_0x33de('0x6'))('rpc');var config=require(_0x33de('0x7'));var jayson=require(_0x33de('0x8'));var client=jayson['client'][_0x33de('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x587be8,_0x13afea,_0x35ee93){return new BPromise(function(_0x7ceca6,_0x486ab6){return client[_0x33de('0xa')](_0x587be8,_0x35ee93)[_0x33de('0xb')](function(_0x2e0419){logger['info'](_0x33de('0xc'),_0x13afea,_0x33de('0xd'));logger[_0x33de('0xe')](_0x33de('0xf'),_0x13afea,_0x33de('0xd'),JSON[_0x33de('0x10')](_0x2e0419));if(_0x2e0419[_0x33de('0x11')]){if(_0x2e0419[_0x33de('0x11')][_0x33de('0x12')]===0x1f4){logger[_0x33de('0x11')](_0x33de('0xc'),_0x13afea,_0x2e0419['error'][_0x33de('0x13')]);return _0x486ab6(_0x2e0419[_0x33de('0x11')]['message']);}logger['error'](_0x33de('0xc'),_0x13afea,_0x2e0419[_0x33de('0x11')][_0x33de('0x13')]);return _0x7ceca6(_0x2e0419[_0x33de('0x11')]['message']);}else{logger[_0x33de('0x14')](_0x33de('0xc'),_0x13afea,'request\x20sent');_0x7ceca6(_0x2e0419['result'][_0x33de('0x13')]);}})[_0x33de('0x15')](function(_0x13e832){logger['error'](_0x33de('0xc'),_0x13afea,_0x13e832);_0x486ab6(_0x13e832);});});}exports[_0x33de('0x16')]=function(_0x52cfa0){var _0x2815a7=this;return new Promise(function(_0x201ff3,_0x482667){return db['SquareDetailsReport'][_0x33de('0x17')](_0x52cfa0['body'],{'raw':_0x52cfa0[_0x33de('0x18')]?_0x52cfa0[_0x33de('0x18')][_0x33de('0x19')]===undefined?!![]:![]:!![]})[_0x33de('0xb')](function(_0xc4f1a4){logger[_0x33de('0x14')](_0x33de('0x16'),_0x52cfa0);logger['debug']('CreateSquareDetailsReport',_0x52cfa0,JSON[_0x33de('0x10')](_0xc4f1a4));_0x201ff3(_0xc4f1a4);})['catch'](function(_0x8acd8d){logger['error'](_0x33de('0x16'),_0x8acd8d[_0x33de('0x13')],_0x52cfa0);_0x482667(_0x2815a7['error'](0x1f4,_0x8acd8d[_0x33de('0x13')]));});});}; \ No newline at end of file +var _0x8f4c=['SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','request','then','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x528673,_0x38fabf){var _0x7b85b8=function(_0x53ec07){while(--_0x53ec07){_0x528673['push'](_0x528673['shift']());}};_0x7b85b8(++_0x38fabf);}(_0x8f4c,0x113));var _0xc8f4=function(_0x2e34f8,_0x53a191){_0x2e34f8=_0x2e34f8-0x0;var _0x2b147a=_0x8f4c[_0x2e34f8];return _0x2b147a;};'use strict';var _=require(_0xc8f4('0x0'));var util=require(_0xc8f4('0x1'));var moment=require(_0xc8f4('0x2'));var BPromise=require(_0xc8f4('0x3'));var rs=require(_0xc8f4('0x4'));var fs=require('fs');var Redis=require(_0xc8f4('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc8f4('0x6'));var logger=require(_0xc8f4('0x7'))(_0xc8f4('0x8'));var config=require('../../config/environment');var jayson=require(_0xc8f4('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x520063,_0x373506,_0x48c39d){return new BPromise(function(_0x3ea9a2,_0x3a9ab1){return client[_0xc8f4('0xa')](_0x520063,_0x48c39d)[_0xc8f4('0xb')](function(_0x34f05f){logger['info'](_0xc8f4('0xc'),_0x373506,_0xc8f4('0xd'));logger[_0xc8f4('0xe')](_0xc8f4('0xf'),_0x373506,'request\x20sent',JSON[_0xc8f4('0x10')](_0x34f05f));if(_0x34f05f['error']){if(_0x34f05f[_0xc8f4('0x11')][_0xc8f4('0x12')]===0x1f4){logger[_0xc8f4('0x11')](_0xc8f4('0xc'),_0x373506,_0x34f05f[_0xc8f4('0x11')]['message']);return _0x3a9ab1(_0x34f05f[_0xc8f4('0x11')][_0xc8f4('0x13')]);}logger[_0xc8f4('0x11')](_0xc8f4('0xc'),_0x373506,_0x34f05f[_0xc8f4('0x11')][_0xc8f4('0x13')]);return _0x3ea9a2(_0x34f05f['error'][_0xc8f4('0x13')]);}else{logger[_0xc8f4('0x14')](_0xc8f4('0xc'),_0x373506,_0xc8f4('0xd'));_0x3ea9a2(_0x34f05f[_0xc8f4('0x15')]['message']);}})[_0xc8f4('0x16')](function(_0x4d2b77){logger['error'](_0xc8f4('0xc'),_0x373506,_0x4d2b77);_0x3a9ab1(_0x4d2b77);});});}exports[_0xc8f4('0x17')]=function(_0x108076){var _0x7bb973=this;return new Promise(function(_0x4763c1,_0x374761){return db[_0xc8f4('0x18')][_0xc8f4('0x19')](_0x108076[_0xc8f4('0x1a')],{'raw':_0x108076[_0xc8f4('0x1b')]?_0x108076[_0xc8f4('0x1b')][_0xc8f4('0x1c')]===undefined?!![]:![]:!![]})[_0xc8f4('0xb')](function(_0x5f3264){logger[_0xc8f4('0x14')](_0xc8f4('0x17'),_0x108076);logger[_0xc8f4('0xe')](_0xc8f4('0x17'),_0x108076,JSON[_0xc8f4('0x10')](_0x5f3264));_0x4763c1(_0x5f3264);})[_0xc8f4('0x16')](function(_0xaeee7d){logger[_0xc8f4('0x11')]('CreateSquareDetailsReport',_0xaeee7d[_0xc8f4('0x13')],_0x108076);_0x374761(_0x7bb973[_0xc8f4('0x11')](0x1f4,_0xaeee7d[_0xc8f4('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index fb0c6af..98241ce 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 _0x7938=['exports','express','Router','../../components/auth/service','get','isAuthenticated','index','killProcess'];(function(_0x3f086a,_0xdfc88e){var _0xf5c68b=function(_0x503785){while(--_0x503785){_0x3f086a['push'](_0x3f086a['shift']());}};_0xf5c68b(++_0xdfc88e);}(_0x7938,0x1e1));var _0x8793=function(_0x137b54,_0x3ac723){_0x137b54=_0x137b54-0x0;var _0x305fbb=_0x7938[_0x137b54];return _0x305fbb;};'use strict';var express=require(_0x8793('0x0'));var router=express[_0x8793('0x1')]();var auth=require(_0x8793('0x2'));var controller=require('./system.controller');router[_0x8793('0x3')]('/',auth[_0x8793('0x4')](),controller[_0x8793('0x5')]);router['get']('/process/:pid/kill',auth[_0x8793('0x4')](),controller[_0x8793('0x6')]);module[_0x8793('0x7')]=router; \ No newline at end of file +var _0x467f=['../../components/auth/service','./system.controller','get','index','/process/:pid/kill','isAuthenticated'];(function(_0x5d80de,_0x2cf15d){var _0x1c7556=function(_0x5bd806){while(--_0x5bd806){_0x5d80de['push'](_0x5d80de['shift']());}};_0x1c7556(++_0x2cf15d);}(_0x467f,0x1b0));var _0xf467=function(_0x38537f,_0x252124){_0x38537f=_0x38537f-0x0;var _0x141e23=_0x467f[_0x38537f];return _0x141e23;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0xf467('0x0'));var controller=require(_0xf467('0x1'));router[_0xf467('0x2')]('/',auth['isAuthenticated'](),controller[_0xf467('0x3')]);router[_0xf467('0x2')](_0xf467('0x4'),auth[_0xf467('0x5')](),controller['killProcess']);module['exports']=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 7122114..74b6278 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 _0xeabe=['SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','../../config/logger','api','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','name','status','send','index','then','catch','killProcess','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0xeabe,0x12d));var _0xeeab=function(_0x435049,_0x1c5f97){_0x435049=_0x435049-0x0;var _0x519ffe=_0xeabe[_0x435049];return _0x519ffe;};'use strict';var info=require('systeminformation');var exec=require('child_process')['exec'];var logger=require(_0xeeab('0x0'))(_0xeeab('0x1'));var util=require('util');var BPromise=require(_0xeeab('0x2'));var _=require(_0xeeab('0x3'));function handleError(_0x44da89,_0x18e71b,_0x9bae77){_0x18e71b=_0x18e71b||0x1f4;return function(_0x125b35){logger[_0xeeab('0x4')](_0xeeab('0x5'),_0x9bae77,_0x18e71b,util['inspect'](_0x125b35,{'showHidden':![],'depth':null}));delete _0x125b35[_0xeeab('0x6')];_0x44da89[_0xeeab('0x7')](_0x18e71b)[_0xeeab('0x8')](_0x125b35);};}exports[_0xeeab('0x9')]=function(_0x59ee4c,_0x3625b6){return info['getAllData']()[_0xeeab('0xa')](function(_0x1d7303){return _0x3625b6[_0xeeab('0x7')](0xc8)['json'](_0x1d7303);})[_0xeeab('0xb')](function(_0x29c10f){return _0x3625b6['status'](0x1f4)['json'](_0x29c10f);});};exports[_0xeeab('0xc')]=function(_0x38418c,_0x433dae){var _0x2cf99a=['components/import/cm'];return new BPromise(function(_0x5f0785,_0x3410af){return exec(util[_0xeeab('0xd')](_0xeeab('0xe'),_0x38418c[_0xeeab('0xf')][_0xeeab('0x10')]),function(_0x353b63,_0x8c51ed,_0x723897){if(_0x353b63){return _0x3410af(_0x353b63);}return _0x5f0785(_0x8c51ed);});})[_0xeeab('0xa')](function(_0x29412d){var _0x4191f0=![];var _0x1c0952=_0x29412d[_0xeeab('0x11')](/\n/);for(var _0x13d0b5=0x0,_0x2a6436=_0x2cf99a[_0xeeab('0x12')];_0x13d0b5<_0x2a6436,_0x4191f0===![];_0x13d0b5+=0x1){if(_0x29412d[_0xeeab('0x13')](_0x2cf99a[_0x13d0b5])>=0x0){_0x4191f0=!![];}}if(!_0x4191f0){throw new Error(util[_0xeeab('0xd')](_0xeeab('0x14'),_0x38418c['params'][_0xeeab('0x10')]));}process['kill'](_0x38418c['params'][_0xeeab('0x10')],_0xeeab('0x15'));return _0x433dae[_0xeeab('0x7')](0xc8)['json']({'message':util['format'](_0xeeab('0x16'),_0x38418c[_0xeeab('0xf')][_0xeeab('0x10')])});})[_0xeeab('0xb')](handleError(_0x433dae,null,_0xeeab('0xc')));}; \ No newline at end of file +var _0xbb42=['send','index','then','json','catch','killProcess','components/import/cm','format','pid','split','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','params','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','exec','api','util','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status'];(function(_0x52d453,_0x9c8293){var _0x16b462=function(_0xeaa7f0){while(--_0xeaa7f0){_0x52d453['push'](_0x52d453['shift']());}};_0x16b462(++_0x9c8293);}(_0xbb42,0x80));var _0x2bb4=function(_0xe2be6b,_0x32bfdd){_0xe2be6b=_0xe2be6b-0x0;var _0x379cdf=_0xbb42[_0xe2be6b];return _0x379cdf;};'use strict';var info=require(_0x2bb4('0x0'));var exec=require(_0x2bb4('0x1'))[_0x2bb4('0x2')];var logger=require('../../config/logger')(_0x2bb4('0x3'));var util=require(_0x2bb4('0x4'));var BPromise=require(_0x2bb4('0x5'));var _=require(_0x2bb4('0x6'));function handleError(_0x152c0a,_0x238d88,_0x73b374){_0x238d88=_0x238d88||0x1f4;return function(_0x31c81e){logger[_0x2bb4('0x7')](_0x2bb4('0x8'),_0x73b374,_0x238d88,util[_0x2bb4('0x9')](_0x31c81e,{'showHidden':![],'depth':null}));delete _0x31c81e[_0x2bb4('0xa')];_0x152c0a[_0x2bb4('0xb')](_0x238d88)[_0x2bb4('0xc')](_0x31c81e);};}exports[_0x2bb4('0xd')]=function(_0x130440,_0x538656){return info['getAllData']()[_0x2bb4('0xe')](function(_0x4c8f20){return _0x538656[_0x2bb4('0xb')](0xc8)[_0x2bb4('0xf')](_0x4c8f20);})[_0x2bb4('0x10')](function(_0x1f87c2){return _0x538656['status'](0x1f4)[_0x2bb4('0xf')](_0x1f87c2);});};exports[_0x2bb4('0x11')]=function(_0x2267cb,_0x95477e){var _0x5ddf1c=[_0x2bb4('0x12')];return new BPromise(function(_0x1c978b,_0x37695c){return exec(util[_0x2bb4('0x13')]('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x2267cb['params'][_0x2bb4('0x14')]),function(_0x171cda,_0x2a34c3,_0x5dfe9c){if(_0x171cda){return _0x37695c(_0x171cda);}return _0x1c978b(_0x2a34c3);});})[_0x2bb4('0xe')](function(_0x35d5cb){var _0x20948c=![];var _0x16493c=_0x35d5cb[_0x2bb4('0x15')](/\n/);for(var _0x5712ef=0x0,_0x50f98e=_0x5ddf1c['length'];_0x5712ef<_0x50f98e,_0x20948c===![];_0x5712ef+=0x1){if(_0x35d5cb[_0x2bb4('0x16')](_0x5ddf1c[_0x5712ef])>=0x0){_0x20948c=!![];}}if(!_0x20948c){throw new Error(util[_0x2bb4('0x13')](_0x2bb4('0x17'),_0x2267cb[_0x2bb4('0x18')][_0x2bb4('0x14')]));}process[_0x2bb4('0x19')](_0x2267cb[_0x2bb4('0x18')][_0x2bb4('0x14')],_0x2bb4('0x1a'));return _0x95477e[_0x2bb4('0xb')](0xc8)['json']({'message':util[_0x2bb4('0x13')](_0x2bb4('0x1b'),_0x2267cb[_0x2bb4('0x18')][_0x2bb4('0x14')])});})[_0x2bb4('0x10')](handleError(_0x95477e,null,_0x2bb4('0x11')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index e1099c9..5d9d9b5 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 _0x0a9a=['Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','create','update','destroy','util','connect-timeout','express'];(function(_0x3d2f87,_0xa9f93a){var _0x45e78c=function(_0xb0d2f6){while(--_0xb0d2f6){_0x3d2f87['push'](_0x3d2f87['shift']());}};_0x45e78c(++_0xa9f93a);}(_0x0a9a,0x183));var _0xa0a9=function(_0x1458c7,_0x5f5a0b){_0x1458c7=_0x1458c7-0x0;var _0x5c2f1a=_0x0a9a[_0x1458c7];return _0x5c2f1a;};'use strict';var multer=require('multer');var util=require(_0xa0a9('0x0'));var path=require('path');var timeout=require(_0xa0a9('0x1'));var express=require(_0xa0a9('0x2'));var router=express[_0xa0a9('0x3')]();var fs_extra=require(_0xa0a9('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xa0a9('0x5'));var config=require(_0xa0a9('0x6'));var controller=require('./tag.controller');router[_0xa0a9('0x7')]('/',auth[_0xa0a9('0x8')](),controller[_0xa0a9('0x9')]);router[_0xa0a9('0x7')]('/describe',auth[_0xa0a9('0x8')](),controller['describe']);router[_0xa0a9('0x7')](_0xa0a9('0xa'),auth[_0xa0a9('0x8')](),controller[_0xa0a9('0xb')]);router['post']('/',auth[_0xa0a9('0x8')](),controller[_0xa0a9('0xc')]);router['put']('/:id',auth[_0xa0a9('0x8')](),controller[_0xa0a9('0xd')]);router['delete'](_0xa0a9('0xa'),auth['isAuthenticated'](),controller[_0xa0a9('0xe')]);module['exports']=router; \ No newline at end of file +var _0x702d=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','describe','/:id','isAuthenticated','show','post','create','put','update','destroy','exports','multer','util','path'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x702d,0x147));var _0xd702=function(_0x457160,_0x2835a4){_0x457160=_0x457160-0x0;var _0x16e52b=_0x702d[_0x457160];return _0x16e52b;};'use strict';var multer=require(_0xd702('0x0'));var util=require(_0xd702('0x1'));var path=require(_0xd702('0x2'));var timeout=require(_0xd702('0x3'));var express=require(_0xd702('0x4'));var router=express['Router']();var fs_extra=require(_0xd702('0x5'));var auth=require(_0xd702('0x6'));var interaction=require(_0xd702('0x7'));var config=require(_0xd702('0x8'));var controller=require('./tag.controller');router[_0xd702('0x9')]('/',auth['isAuthenticated'](),controller[_0xd702('0xa')]);router[_0xd702('0x9')](_0xd702('0xb'),auth['isAuthenticated'](),controller[_0xd702('0xc')]);router['get'](_0xd702('0xd'),auth[_0xd702('0xe')](),controller[_0xd702('0xf')]);router[_0xd702('0x10')]('/',auth[_0xd702('0xe')](),controller[_0xd702('0x11')]);router[_0xd702('0x12')](_0xd702('0xd'),auth[_0xd702('0xe')](),controller[_0xd702('0x13')]);router['delete']('/:id',auth[_0xd702('0xe')](),controller[_0xd702('0x14')]);module[_0xd702('0x15')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 99e04f7..46fa746 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 _0x9a86=['name','STRING','#0091EA','sequelize','exports'];(function(_0x244aab,_0x3e607f){var _0x3182ca=function(_0x380946){while(--_0x380946){_0x244aab['push'](_0x244aab['shift']());}};_0x3182ca(++_0x3e607f);}(_0x9a86,0x1ed));var _0x69a8=function(_0x34933a,_0x327378){_0x34933a=_0x34933a-0x0;var _0x36abb4=_0x9a86[_0x34933a];return _0x36abb4;};'use strict';var Sequelize=require(_0x69a8('0x0'));module[_0x69a8('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x69a8('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x69a8('0x3')],'defaultValue':_0x69a8('0x4')},'description':{'type':Sequelize[_0x69a8('0x3')]}}; \ No newline at end of file +var _0x09dd=['STRING','name','#0091EA','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x09dd,0xb7));var _0xd09d=function(_0x28a6ad,_0x351697){_0x28a6ad=_0x28a6ad-0x0;var _0xbb804=_0x09dd[_0x28a6ad];return _0xbb804;};'use strict';var Sequelize=require(_0xd09d('0x0'));module[_0xd09d('0x1')]={'name':{'type':Sequelize[_0xd09d('0x2')],'unique':_0xd09d('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xd09d('0x2')],'defaultValue':_0xd09d('0x4')},'description':{'type':Sequelize[_0xd09d('0x2')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index aad362c..da7646b 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 _0x40df=['send','index','map','Tag','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','limit','undefined','count','offset','apply','save','then','destroy','get','Tags','UserProfileResource','error','name'];(function(_0x44c6dc,_0x5e2c56){var _0x403a26=function(_0x4f1cf5){while(--_0x4f1cf5){_0x44c6dc['push'](_0x44c6dc['shift']());}};_0x403a26(++_0x5e2c56);}(_0x40df,0x16c));var _0xf40d=function(_0x22c90f,_0xd7a36b){_0x22c90f=_0x22c90f-0x0;var _0xd26886=_0x40df[_0x22c90f];return _0xd26886;};'use strict';var emlformat=require(_0xf40d('0x0'));var rimraf=require(_0xf40d('0x1'));var zipdir=require(_0xf40d('0x2'));var jsonpatch=require(_0xf40d('0x3'));var rp=require('request-promise');var moment=require(_0xf40d('0x4'));var BPromise=require(_0xf40d('0x5'));var Mustache=require(_0xf40d('0x6'));var util=require('util');var path=require(_0xf40d('0x7'));var sox=require(_0xf40d('0x8'));var csv=require(_0xf40d('0x9'));var ejs=require(_0xf40d('0xa'));var fs=require('fs');var fs_extra=require(_0xf40d('0xb'));var _=require(_0xf40d('0xc'));var squel=require(_0xf40d('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf40d('0x9'));var querystring=require('querystring');var Papa=require(_0xf40d('0xe'));var Redis=require('ioredis');var authService=require(_0xf40d('0xf'));var qs=require(_0xf40d('0x10'));var as=require(_0xf40d('0x11'));var hardwareService=require(_0xf40d('0x12'));var logger=require(_0xf40d('0x13'))(_0xf40d('0x14'));var utils=require(_0xf40d('0x15'));var config=require(_0xf40d('0x16'));var licenseUtil=require(_0xf40d('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xf4530f,_0x5f5c1b){_0x5f5c1b=_0x5f5c1b||0xcc;return function(_0x4f400e){if(_0x4f400e){return _0xf4530f[_0xf40d('0x18')](_0x5f5c1b);}return _0xf4530f['status'](_0x5f5c1b)[_0xf40d('0x19')]();};}function respondWithResult(_0x234d2d,_0x2ab870){_0x2ab870=_0x2ab870||0xc8;return function(_0x386831){if(_0x386831){return _0x234d2d[_0xf40d('0x1a')](_0x2ab870)[_0xf40d('0x1b')](_0x386831);}};}function respondWithFilteredResult(_0x369e67,_0x3aa1bb){return function(_0x42a60b){if(_0x42a60b){var _0x13c587=typeof _0x3aa1bb['offset']==='undefined'&&typeof _0x3aa1bb[_0xf40d('0x1c')]===_0xf40d('0x1d');var _0xae8aee=_0x42a60b['count'];var _0x2471f9=_0x13c587?0x0:_0x3aa1bb['offset'];var _0x1ff89c=_0x13c587?_0x42a60b[_0xf40d('0x1e')]:_0x3aa1bb[_0xf40d('0x1f')]+_0x3aa1bb['limit'];var _0x266f24;if(_0x1ff89c>=_0xae8aee){_0x1ff89c=_0xae8aee;_0x266f24=0xc8;}else{_0x266f24=0xce;}_0x369e67[_0xf40d('0x1a')](_0x266f24);return _0x369e67['set']('Content-Range',_0x2471f9+'-'+_0x1ff89c+'/'+_0xae8aee)['json'](_0x42a60b);}return null;};}function patchUpdates(_0x5d38b2){return function(_0x2dc396){try{jsonpatch[_0xf40d('0x20')](_0x2dc396,_0x5d38b2,!![]);}catch(_0x4dea06){return BPromise['reject'](_0x4dea06);}return _0x2dc396[_0xf40d('0x21')]();};}function saveUpdates(_0x3e0960,_0xa65b45){return function(_0xad8f35){if(_0xad8f35){return _0xad8f35['update'](_0x3e0960)[_0xf40d('0x22')](function(_0x58e758){return _0x58e758;});}return null;};}function removeEntity(_0x1880db,_0x3f44f1){return function(_0x115c0e){if(_0x115c0e){return _0x115c0e[_0xf40d('0x23')]()[_0xf40d('0x22')](function(){var _0x3a6198=_0x115c0e[_0xf40d('0x24')]({'plain':!![]});var _0x3d7612=_0xf40d('0x25');return db[_0xf40d('0x26')][_0xf40d('0x23')]({'where':{'type':_0x3d7612,'resourceId':_0x3a6198['id']}})['then'](function(){return _0x115c0e;});})[_0xf40d('0x22')](function(){_0x1880db[_0xf40d('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b3c5e,_0x200f5f){return function(_0x1399fa){if(!_0x1399fa){_0x2b3c5e['sendStatus'](0x194);}return _0x1399fa;};}function handleError(_0x9aa6a,_0x5682dc){_0x5682dc=_0x5682dc||0x1f4;return function(_0x37d128){logger[_0xf40d('0x27')](_0x37d128['stack']);if(_0x37d128[_0xf40d('0x28')]){delete _0x37d128[_0xf40d('0x28')];}_0x9aa6a[_0xf40d('0x1a')](_0x5682dc)[_0xf40d('0x29')](_0x37d128);};}exports[_0xf40d('0x2a')]=function(_0x473d30,_0x4bf8ea){var _0x18e9b2={},_0x5e61e1={},_0x804d61={'count':0x0,'rows':[]};var _0x462509=_[_0xf40d('0x2b')](db[_0xf40d('0x2c')][_0xf40d('0x2d')],function(_0x44b52e){return{'name':_0x44b52e[_0xf40d('0x2e')],'type':_0x44b52e[_0xf40d('0x2f')]['key']};});_0x5e61e1[_0xf40d('0x30')]=_[_0xf40d('0x2b')](_0x462509,_0xf40d('0x28'));_0x5e61e1[_0xf40d('0x31')]=_[_0xf40d('0x32')](_0x473d30[_0xf40d('0x31')]);_0x5e61e1[_0xf40d('0x33')]=_[_0xf40d('0x34')](_0x5e61e1[_0xf40d('0x30')],_0x5e61e1[_0xf40d('0x31')]);_0x18e9b2['attributes']=_[_0xf40d('0x34')](_0x5e61e1[_0xf40d('0x30')],qs[_0xf40d('0x35')](_0x473d30[_0xf40d('0x31')]['fields']));_0x18e9b2[_0xf40d('0x36')]=_0x18e9b2['attributes'][_0xf40d('0x37')]?_0x18e9b2[_0xf40d('0x36')]:_0x5e61e1['model'];if(!_0x473d30['query']['hasOwnProperty'](_0xf40d('0x38'))){_0x18e9b2['limit']=qs['limit'](_0x473d30[_0xf40d('0x31')][_0xf40d('0x1c')]);_0x18e9b2[_0xf40d('0x1f')]=qs[_0xf40d('0x1f')](_0x473d30[_0xf40d('0x31')][_0xf40d('0x1f')]);}_0x18e9b2[_0xf40d('0x39')]=qs[_0xf40d('0x3a')](_0x473d30[_0xf40d('0x31')][_0xf40d('0x3a')]);_0x18e9b2[_0xf40d('0x3b')]=qs[_0xf40d('0x33')](_['pick'](_0x473d30['query'],_0x5e61e1['filters']),_0x462509);if(_0x473d30[_0xf40d('0x31')][_0xf40d('0x3c')]){_0x18e9b2[_0xf40d('0x3b')]=_[_0xf40d('0x3d')](_0x18e9b2['where'],{'$or':_['map'](_0x462509,function(_0x245c68){if(_0x245c68[_0xf40d('0x2f')]!==_0xf40d('0x3e')){var _0x23138f={};_0x23138f[_0x245c68[_0xf40d('0x28')]]={'$like':'%'+_0x473d30[_0xf40d('0x31')][_0xf40d('0x3c')]+'%'};return _0x23138f;}})});}_0x18e9b2=_[_0xf40d('0x3d')]({},_0x18e9b2,_0x473d30[_0xf40d('0x3f')]);var _0x5bee2f={'where':_0x18e9b2[_0xf40d('0x3b')]};return db[_0xf40d('0x2c')][_0xf40d('0x1e')](_0x5bee2f)[_0xf40d('0x22')](function(_0x162b92){_0x804d61['count']=_0x162b92;if(_0x473d30['query'][_0xf40d('0x40')]){_0x18e9b2[_0xf40d('0x41')]=[{'all':!![]}];}return db[_0xf40d('0x2c')][_0xf40d('0x42')](_0x18e9b2);})[_0xf40d('0x22')](function(_0x151afb){_0x804d61['rows']=_0x151afb;return _0x804d61;})['then'](respondWithFilteredResult(_0x4bf8ea,_0x18e9b2))[_0xf40d('0x43')](handleError(_0x4bf8ea,null));};exports[_0xf40d('0x44')]=function(_0x3471d9,_0x5e3116){var _0x34bd24={'raw':!![],'where':{'id':_0x3471d9['params']['id']}},_0xe1c442={};_0xe1c442['model']=_[_0xf40d('0x32')](db[_0xf40d('0x2c')][_0xf40d('0x2d')]);_0xe1c442[_0xf40d('0x31')]=_[_0xf40d('0x32')](_0x3471d9['query']);_0xe1c442['filters']=_[_0xf40d('0x34')](_0xe1c442[_0xf40d('0x30')],_0xe1c442[_0xf40d('0x31')]);_0x34bd24['attributes']=_['intersection'](_0xe1c442['model'],qs[_0xf40d('0x35')](_0x3471d9[_0xf40d('0x31')][_0xf40d('0x35')]));_0x34bd24[_0xf40d('0x36')]=_0x34bd24[_0xf40d('0x36')][_0xf40d('0x37')]?_0x34bd24[_0xf40d('0x36')]:_0xe1c442[_0xf40d('0x30')];if(_0x3471d9['query'][_0xf40d('0x40')]){_0x34bd24[_0xf40d('0x41')]=[{'all':!![]}];}_0x34bd24=_[_0xf40d('0x3d')]({},_0x34bd24,_0x3471d9[_0xf40d('0x3f')]);return db['Tag'][_0xf40d('0x45')](_0x34bd24)[_0xf40d('0x22')](handleEntityNotFound(_0x5e3116,null))[_0xf40d('0x22')](respondWithResult(_0x5e3116,null))['catch'](handleError(_0x5e3116,null));};exports['create']=function(_0x251e6a,_0x3f13fd){return db[_0xf40d('0x2c')][_0xf40d('0x46')](_0x251e6a[_0xf40d('0x47')],{})[_0xf40d('0x22')](function(_0x1873e9){var _0x14f083=_0x251e6a[_0xf40d('0x48')]['get']({'plain':!![]});if(!_0x14f083)throw new Error(_0xf40d('0x49'));if(_0x14f083[_0xf40d('0x4a')]===_0xf40d('0x48')){var _0x251d47=_0x1873e9['get']({'plain':!![]});var _0x1b674b=_0xf40d('0x25');return db[_0xf40d('0x4b')][_0xf40d('0x45')]({'where':{'name':_0x1b674b,'userProfileId':_0x14f083[_0xf40d('0x4c')]},'raw':!![]})[_0xf40d('0x22')](function(_0x5aacf6){if(_0x5aacf6&&_0x5aacf6['autoAssociation']===0x0){return db[_0xf40d('0x26')][_0xf40d('0x46')]({'name':_0x251d47[_0xf40d('0x28')],'resourceId':_0x251d47['id'],'type':_0x5aacf6[_0xf40d('0x28')],'sectionId':_0x5aacf6['id']},{})[_0xf40d('0x22')](function(){return _0x1873e9;});}else{return _0x1873e9;}})[_0xf40d('0x43')](function(_0x16025b){logger[_0xf40d('0x27')](_0xf40d('0x4d'),_0x16025b);throw _0x16025b;});}return _0x1873e9;})[_0xf40d('0x22')](respondWithResult(_0x3f13fd,0xc9))[_0xf40d('0x43')](handleError(_0x3f13fd,null));};exports[_0xf40d('0x4e')]=function(_0x50b051,_0x48b21c){if(_0x50b051['body']['id']){delete _0x50b051[_0xf40d('0x47')]['id'];}return db[_0xf40d('0x2c')][_0xf40d('0x45')]({'where':{'id':_0x50b051[_0xf40d('0x4f')]['id']}})[_0xf40d('0x22')](handleEntityNotFound(_0x48b21c,null))[_0xf40d('0x22')](saveUpdates(_0x50b051[_0xf40d('0x47')],null))[_0xf40d('0x22')](respondWithResult(_0x48b21c,null))[_0xf40d('0x43')](handleError(_0x48b21c,null));};exports[_0xf40d('0x23')]=function(_0x562917,_0xf3cef){return db[_0xf40d('0x2c')][_0xf40d('0x45')]({'where':{'id':_0x562917[_0xf40d('0x4f')]['id']}})[_0xf40d('0x22')](handleEntityNotFound(_0xf3cef,null))[_0xf40d('0x22')](removeEntity(_0xf3cef,null))[_0xf40d('0x43')](handleError(_0xf3cef,null));};exports[_0xf40d('0x50')]=function(_0x19412f,_0xea5624){return db[_0xf40d('0x2c')][_0xf40d('0x50')]()[_0xf40d('0x22')](respondWithResult(_0xea5624,null))[_0xf40d('0x43')](handleError(_0xea5624,null));}; \ No newline at end of file +var _0x847d=['user','role','Tags','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','limit','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','Tag','rawAttributes','fieldName','type','key','query','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','filters','pick','filter','merge','where','VIRTUAL','options','includeAll','show','keys','find','catch','create','body'];(function(_0x298c24,_0x2847b4){var _0x5b5772=function(_0x4ad68d){while(--_0x4ad68d){_0x298c24['push'](_0x298c24['shift']());}};_0x5b5772(++_0x2847b4);}(_0x847d,0xf8));var _0xd847=function(_0x3b1b23,_0x21bccd){_0x3b1b23=_0x3b1b23-0x0;var _0x1efc85=_0x847d[_0x3b1b23];return _0x1efc85;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd847('0x0'));var zipdir=require(_0xd847('0x1'));var jsonpatch=require(_0xd847('0x2'));var rp=require(_0xd847('0x3'));var moment=require(_0xd847('0x4'));var BPromise=require(_0xd847('0x5'));var Mustache=require(_0xd847('0x6'));var util=require('util');var path=require(_0xd847('0x7'));var sox=require(_0xd847('0x8'));var csv=require(_0xd847('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd847('0xa'));var _=require(_0xd847('0xb'));var squel=require('squel');var crypto=require(_0xd847('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xd847('0xd'));var toCsv=require(_0xd847('0x9'));var querystring=require(_0xd847('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xd847('0xf'));var qs=require(_0xd847('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd847('0x11'));var logger=require(_0xd847('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xd847('0x13'));var licenseUtil=require(_0xd847('0x14'));var db=require(_0xd847('0x15'))['db'];function respondWithStatusCode(_0x3f5935,_0x40b2a5){_0x40b2a5=_0x40b2a5||0xcc;return function(_0x5a99b2){if(_0x5a99b2){return _0x3f5935[_0xd847('0x16')](_0x40b2a5);}return _0x3f5935[_0xd847('0x17')](_0x40b2a5)['end']();};}function respondWithResult(_0x36d17a,_0x3386fa){_0x3386fa=_0x3386fa||0xc8;return function(_0x5753ba){if(_0x5753ba){return _0x36d17a[_0xd847('0x17')](_0x3386fa)[_0xd847('0x18')](_0x5753ba);}};}function respondWithFilteredResult(_0x1e87ce,_0xa957c6){return function(_0x7b9337){if(_0x7b9337){var _0x15738=typeof _0xa957c6['offset']==='undefined'&&typeof _0xa957c6[_0xd847('0x19')]==='undefined';var _0x5db30b=_0x7b9337['count'];var _0x56fa2d=_0x15738?0x0:_0xa957c6[_0xd847('0x1a')];var _0xdc9166=_0x15738?_0x7b9337[_0xd847('0x1b')]:_0xa957c6[_0xd847('0x1a')]+_0xa957c6[_0xd847('0x19')];var _0x53027f;if(_0xdc9166>=_0x5db30b){_0xdc9166=_0x5db30b;_0x53027f=0xc8;}else{_0x53027f=0xce;}_0x1e87ce[_0xd847('0x17')](_0x53027f);return _0x1e87ce[_0xd847('0x1c')](_0xd847('0x1d'),_0x56fa2d+'-'+_0xdc9166+'/'+_0x5db30b)[_0xd847('0x18')](_0x7b9337);}return null;};}function patchUpdates(_0x37e01c){return function(_0x512c41){try{jsonpatch[_0xd847('0x1e')](_0x512c41,_0x37e01c,!![]);}catch(_0x4c2c6c){return BPromise[_0xd847('0x1f')](_0x4c2c6c);}return _0x512c41[_0xd847('0x20')]();};}function saveUpdates(_0x2363ba,_0x544ec2){return function(_0x4b9035){if(_0x4b9035){return _0x4b9035[_0xd847('0x21')](_0x2363ba)[_0xd847('0x22')](function(_0x1d91a1){return _0x1d91a1;});}return null;};}function removeEntity(_0x44213a,_0x506435){return function(_0x1796e2){if(_0x1796e2){return _0x1796e2[_0xd847('0x23')]()['then'](function(){var _0x1b2039=_0x1796e2[_0xd847('0x24')]({'plain':!![]});var _0x3d7a90='Tags';return db[_0xd847('0x25')][_0xd847('0x23')]({'where':{'type':_0x3d7a90,'resourceId':_0x1b2039['id']}})[_0xd847('0x22')](function(){return _0x1796e2;});})[_0xd847('0x22')](function(){_0x44213a[_0xd847('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x14eb0f,_0x1b6ac1){return function(_0x85ff76){if(!_0x85ff76){_0x14eb0f[_0xd847('0x16')](0x194);}return _0x85ff76;};}function handleError(_0x2da5fc,_0x187e01){_0x187e01=_0x187e01||0x1f4;return function(_0x2c9297){logger[_0xd847('0x26')](_0x2c9297[_0xd847('0x27')]);if(_0x2c9297[_0xd847('0x28')]){delete _0x2c9297['name'];}_0x2da5fc[_0xd847('0x17')](_0x187e01)[_0xd847('0x29')](_0x2c9297);};}exports[_0xd847('0x2a')]=function(_0x262e0e,_0xe380ff){var _0x2c4a24={},_0x58ca2f={},_0x283a54={'count':0x0,'rows':[]};var _0x5b8cbf=_[_0xd847('0x2b')](db[_0xd847('0x2c')][_0xd847('0x2d')],function(_0x2c0127){return{'name':_0x2c0127[_0xd847('0x2e')],'type':_0x2c0127[_0xd847('0x2f')][_0xd847('0x30')]};});_0x58ca2f['model']=_[_0xd847('0x2b')](_0x5b8cbf,_0xd847('0x28'));_0x58ca2f['query']=_['keys'](_0x262e0e[_0xd847('0x31')]);_0x58ca2f['filters']=_['intersection'](_0x58ca2f[_0xd847('0x32')],_0x58ca2f[_0xd847('0x31')]);_0x2c4a24[_0xd847('0x33')]=_[_0xd847('0x34')](_0x58ca2f[_0xd847('0x32')],qs[_0xd847('0x35')](_0x262e0e[_0xd847('0x31')][_0xd847('0x35')]));_0x2c4a24[_0xd847('0x33')]=_0x2c4a24[_0xd847('0x33')][_0xd847('0x36')]?_0x2c4a24[_0xd847('0x33')]:_0x58ca2f['model'];if(!_0x262e0e[_0xd847('0x31')][_0xd847('0x37')](_0xd847('0x38'))){_0x2c4a24['limit']=qs[_0xd847('0x19')](_0x262e0e[_0xd847('0x31')][_0xd847('0x19')]);_0x2c4a24[_0xd847('0x1a')]=qs[_0xd847('0x1a')](_0x262e0e[_0xd847('0x31')]['offset']);}_0x2c4a24['order']=qs[_0xd847('0x39')](_0x262e0e[_0xd847('0x31')][_0xd847('0x39')]);_0x2c4a24['where']=qs[_0xd847('0x3a')](_[_0xd847('0x3b')](_0x262e0e[_0xd847('0x31')],_0x58ca2f['filters']),_0x5b8cbf);if(_0x262e0e[_0xd847('0x31')][_0xd847('0x3c')]){_0x2c4a24['where']=_[_0xd847('0x3d')](_0x2c4a24[_0xd847('0x3e')],{'$or':_['map'](_0x5b8cbf,function(_0x5189b4){if(_0x5189b4[_0xd847('0x2f')]!==_0xd847('0x3f')){var _0x52398d={};_0x52398d[_0x5189b4['name']]={'$like':'%'+_0x262e0e[_0xd847('0x31')][_0xd847('0x3c')]+'%'};return _0x52398d;}})});}_0x2c4a24=_[_0xd847('0x3d')]({},_0x2c4a24,_0x262e0e[_0xd847('0x40')]);var _0x215f9b={'where':_0x2c4a24[_0xd847('0x3e')]};return db[_0xd847('0x2c')]['count'](_0x215f9b)[_0xd847('0x22')](function(_0x141cd0){_0x283a54[_0xd847('0x1b')]=_0x141cd0;if(_0x262e0e[_0xd847('0x31')][_0xd847('0x41')]){_0x2c4a24['include']=[{'all':!![]}];}return db[_0xd847('0x2c')]['findAll'](_0x2c4a24);})[_0xd847('0x22')](function(_0x1fe350){_0x283a54['rows']=_0x1fe350;return _0x283a54;})[_0xd847('0x22')](respondWithFilteredResult(_0xe380ff,_0x2c4a24))['catch'](handleError(_0xe380ff,null));};exports[_0xd847('0x42')]=function(_0x31b0bc,_0x476dee){var _0x6409fb={'raw':!![],'where':{'id':_0x31b0bc['params']['id']}},_0x5317c9={};_0x5317c9[_0xd847('0x32')]=_[_0xd847('0x43')](db['Tag']['rawAttributes']);_0x5317c9[_0xd847('0x31')]=_['keys'](_0x31b0bc['query']);_0x5317c9['filters']=_[_0xd847('0x34')](_0x5317c9[_0xd847('0x32')],_0x5317c9['query']);_0x6409fb['attributes']=_[_0xd847('0x34')](_0x5317c9[_0xd847('0x32')],qs[_0xd847('0x35')](_0x31b0bc[_0xd847('0x31')][_0xd847('0x35')]));_0x6409fb['attributes']=_0x6409fb[_0xd847('0x33')]['length']?_0x6409fb[_0xd847('0x33')]:_0x5317c9[_0xd847('0x32')];if(_0x31b0bc['query'][_0xd847('0x41')]){_0x6409fb['include']=[{'all':!![]}];}_0x6409fb=_[_0xd847('0x3d')]({},_0x6409fb,_0x31b0bc[_0xd847('0x40')]);return db[_0xd847('0x2c')][_0xd847('0x44')](_0x6409fb)['then'](handleEntityNotFound(_0x476dee,null))['then'](respondWithResult(_0x476dee,null))[_0xd847('0x45')](handleError(_0x476dee,null));};exports[_0xd847('0x46')]=function(_0x516a97,_0x56f7f6){return db[_0xd847('0x2c')]['create'](_0x516a97[_0xd847('0x47')],{})[_0xd847('0x22')](function(_0x455f9b){var _0xe16325=_0x516a97[_0xd847('0x48')][_0xd847('0x24')]({'plain':!![]});if(!_0xe16325)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xe16325[_0xd847('0x49')]===_0xd847('0x48')){var _0x414e56=_0x455f9b[_0xd847('0x24')]({'plain':!![]});var _0x3c96a5=_0xd847('0x4a');return db[_0xd847('0x4b')][_0xd847('0x44')]({'where':{'name':_0x3c96a5,'userProfileId':_0xe16325[_0xd847('0x4c')]},'raw':!![]})['then'](function(_0x344a30){if(_0x344a30&&_0x344a30['autoAssociation']===0x0){return db['UserProfileResource'][_0xd847('0x46')]({'name':_0x414e56['name'],'resourceId':_0x414e56['id'],'type':_0x344a30[_0xd847('0x28')],'sectionId':_0x344a30['id']},{})[_0xd847('0x22')](function(){return _0x455f9b;});}else{return _0x455f9b;}})[_0xd847('0x45')](function(_0x1b3e44){logger[_0xd847('0x26')](_0xd847('0x4d'),_0x1b3e44);throw _0x1b3e44;});}return _0x455f9b;})[_0xd847('0x22')](respondWithResult(_0x56f7f6,0xc9))[_0xd847('0x45')](handleError(_0x56f7f6,null));};exports[_0xd847('0x21')]=function(_0x507a7f,_0xf82600){if(_0x507a7f[_0xd847('0x47')]['id']){delete _0x507a7f['body']['id'];}return db[_0xd847('0x2c')][_0xd847('0x44')]({'where':{'id':_0x507a7f['params']['id']}})[_0xd847('0x22')](handleEntityNotFound(_0xf82600,null))[_0xd847('0x22')](saveUpdates(_0x507a7f[_0xd847('0x47')],null))['then'](respondWithResult(_0xf82600,null))[_0xd847('0x45')](handleError(_0xf82600,null));};exports['destroy']=function(_0x49c336,_0x3cab30){return db[_0xd847('0x2c')][_0xd847('0x44')]({'where':{'id':_0x49c336[_0xd847('0x4e')]['id']}})[_0xd847('0x22')](handleEntityNotFound(_0x3cab30,null))['then'](removeEntity(_0x3cab30,null))['catch'](handleError(_0x3cab30,null));};exports[_0xd847('0x4f')]=function(_0x1b74f0,_0x3d1d11){return db[_0xd847('0x2c')][_0xd847('0x4f')]()[_0xd847('0x22')](respondWithResult(_0x3d1d11,null))[_0xd847('0x45')](handleError(_0x3d1d11,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index d8ff082..9d0294b 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 _0x1445=['api','moment','bluebird','request-promise','path','../../config/environment','exports','define','Tag','lodash','util'];(function(_0x14766d,_0x100937){var _0x4d7937=function(_0x541bbe){while(--_0x541bbe){_0x14766d['push'](_0x14766d['shift']());}};_0x4d7937(++_0x100937);}(_0x1445,0xa3));var _0x5144=function(_0x507b8c,_0x362593){_0x507b8c=_0x507b8c-0x0;var _0x1ab72a=_0x1445[_0x507b8c];return _0x1ab72a;};'use strict';var _=require(_0x5144('0x0'));var util=require(_0x5144('0x1'));var logger=require('../../config/logger')(_0x5144('0x2'));var moment=require(_0x5144('0x3'));var BPromise=require(_0x5144('0x4'));var rp=require(_0x5144('0x5'));var fs=require('fs');var path=require(_0x5144('0x6'));var rimraf=require('rimraf');var config=require(_0x5144('0x7'));var attributes=require('./tag.attributes');module[_0x5144('0x8')]=function(_0x3b268e,_0x214f9e){return _0x3b268e[_0x5144('0x9')](_0x5144('0xa'),attributes,{'tableName':'tools_tags','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf03c=['Tag','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./tag.attributes','exports','define'];(function(_0x14a866,_0x2615de){var _0x4d3401=function(_0x4f0069){while(--_0x4f0069){_0x14a866['push'](_0x14a866['shift']());}};_0x4d3401(++_0x2615de);}(_0xf03c,0x199));var _0xcf03=function(_0x40f800,_0x26c66e){_0x40f800=_0x40f800-0x0;var _0x3b3685=_0xf03c[_0x40f800];return _0x3b3685;};'use strict';var _=require(_0xcf03('0x0'));var util=require(_0xcf03('0x1'));var logger=require(_0xcf03('0x2'))('api');var moment=require(_0xcf03('0x3'));var BPromise=require(_0xcf03('0x4'));var rp=require(_0xcf03('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcf03('0x6'));var config=require(_0xcf03('0x7'));var attributes=require(_0xcf03('0x8'));module[_0xcf03('0x9')]=function(_0x367a9a,_0x46348d){return _0x367a9a[_0xcf03('0xa')](_0xcf03('0xb'),attributes,{'tableName':'tools_tags','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/tag/tag.rpc.js b/server/api/tag/tag.rpc.js index b8ac40f..562050e 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 _0xe644=['../../config/logger','rpc','../../config/environment','jayson/promise','client','info','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x3d83ac,_0x1d0135){var _0x299760=function(_0x40c1a3){while(--_0x40c1a3){_0x3d83ac['push'](_0x3d83ac['shift']());}};_0x299760(++_0x1d0135);}(_0xe644,0x159));var _0x4e64=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe644[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4e64('0x0'));var util=require(_0x4e64('0x1'));var moment=require(_0x4e64('0x2'));var BPromise=require(_0x4e64('0x3'));var rs=require(_0x4e64('0x4'));var fs=require('fs');var Redis=require(_0x4e64('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x4e64('0x6'));var logger=require(_0x4e64('0x7'))(_0x4e64('0x8'));var config=require(_0x4e64('0x9'));var jayson=require(_0x4e64('0xa'));var client=jayson[_0x4e64('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x66faf,_0x12c40d,_0x5cce6e){return new BPromise(function(_0x4d5aa6,_0x8573c1){return client['request'](_0x66faf,_0x5cce6e)['then'](function(_0x2ebcfe){logger[_0x4e64('0xc')](_0x4e64('0xd'),_0x12c40d,_0x4e64('0xe'));logger[_0x4e64('0xf')](_0x4e64('0x10'),_0x12c40d,'request\x20sent',JSON[_0x4e64('0x11')](_0x2ebcfe));if(_0x2ebcfe[_0x4e64('0x12')]){if(_0x2ebcfe['error'][_0x4e64('0x13')]===0x1f4){logger['error']('Tag,\x20%s,\x20%s',_0x12c40d,_0x2ebcfe[_0x4e64('0x12')]['message']);return _0x8573c1(_0x2ebcfe[_0x4e64('0x12')][_0x4e64('0x14')]);}logger[_0x4e64('0x12')](_0x4e64('0xd'),_0x12c40d,_0x2ebcfe[_0x4e64('0x12')][_0x4e64('0x14')]);return _0x4d5aa6(_0x2ebcfe[_0x4e64('0x12')]['message']);}else{logger[_0x4e64('0xc')](_0x4e64('0xd'),_0x12c40d,_0x4e64('0xe'));_0x4d5aa6(_0x2ebcfe['result'][_0x4e64('0x14')]);}})[_0x4e64('0x15')](function(_0x452f34){logger[_0x4e64('0x12')](_0x4e64('0xd'),_0x12c40d,_0x452f34);_0x8573c1(_0x452f34);});});} \ No newline at end of file +var _0x4c6d=['result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','Tag,\x20%s,\x20%s','debug','Tag,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message'];(function(_0x546e49,_0x349453){var _0x47e655=function(_0x27fbbd){while(--_0x27fbbd){_0x546e49['push'](_0x546e49['shift']());}};_0x47e655(++_0x349453);}(_0x4c6d,0x1d0));var _0xd4c6=function(_0x33afe7,_0x1d96a9){_0x33afe7=_0x33afe7-0x0;var _0x50ad5f=_0x4c6d[_0x33afe7];return _0x50ad5f;};'use strict';var _=require(_0xd4c6('0x0'));var util=require(_0xd4c6('0x1'));var moment=require(_0xd4c6('0x2'));var BPromise=require(_0xd4c6('0x3'));var rs=require(_0xd4c6('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd4c6('0x5'))['db'];var utils=require(_0xd4c6('0x6'));var logger=require(_0xd4c6('0x7'))('rpc');var config=require(_0xd4c6('0x8'));var jayson=require(_0xd4c6('0x9'));var client=jayson['client'][_0xd4c6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x316314,_0x4329e3,_0x5d4fce){return new BPromise(function(_0x440ee3,_0x19ce1c){return client[_0xd4c6('0xb')](_0x316314,_0x5d4fce)['then'](function(_0xe2f90b){logger[_0xd4c6('0xc')](_0xd4c6('0xd'),_0x4329e3,'request\x20sent');logger[_0xd4c6('0xe')](_0xd4c6('0xf'),_0x4329e3,_0xd4c6('0x10'),JSON[_0xd4c6('0x11')](_0xe2f90b));if(_0xe2f90b[_0xd4c6('0x12')]){if(_0xe2f90b[_0xd4c6('0x12')]['code']===0x1f4){logger['error'](_0xd4c6('0xd'),_0x4329e3,_0xe2f90b['error'][_0xd4c6('0x13')]);return _0x19ce1c(_0xe2f90b[_0xd4c6('0x12')][_0xd4c6('0x13')]);}logger[_0xd4c6('0x12')](_0xd4c6('0xd'),_0x4329e3,_0xe2f90b[_0xd4c6('0x12')][_0xd4c6('0x13')]);return _0x440ee3(_0xe2f90b['error']['message']);}else{logger[_0xd4c6('0xc')](_0xd4c6('0xd'),_0x4329e3,_0xd4c6('0x10'));_0x440ee3(_0xe2f90b[_0xd4c6('0x14')][_0xd4c6('0x13')]);}})[_0xd4c6('0x15')](function(_0xe52075){logger['error'](_0xd4c6('0xd'),_0x4329e3,_0xe52075);_0x19ce1c(_0xe52075);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 7a9d23e..82db054 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(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/queues',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/queues',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0xf')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller['destroy']);router[_0x0a9e('0x13')]('/:id/queues',auth[_0x0a9e('0xd')](),controller['removeQueues']);router[_0x0a9e('0x13')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x14')]);module['exports']=router; \ No newline at end of file +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(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('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 7a6b139..cf8bcc1 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 _0xe706=['STRING','sequelize','exports'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0xe706,0xa3));var _0x6e70=function(_0x165d3c,_0x3ba20d){_0x165d3c=_0x165d3c-0x0;var _0xc27339=_0xe706[_0x165d3c];return _0xc27339;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'name':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x6e70('0x2')]}}; \ No newline at end of file +var _0xe706=['STRING','sequelize','exports'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0xe706,0xa3));var _0x6e70=function(_0x275293,_0x31bf61){_0x275293=_0x275293-0x0;var _0x539b28=_0xe706[_0x275293];return _0x539b28;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'name':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x6e70('0x2')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index a88e386..b161398 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 _0xe0f8=['create','user','role','get','Teams','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','sequelize','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','QueryTypes','SELECT','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','VoiceQueueId','UserVoiceQueue','destroy','MailQueueId','UserMailQueue','Sequelize','SmsQueueId','UserSmsQueue','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','UserProfileResource','send','getQueues','findOne','channel','isValidChannel','ValidationError','Unknown\x20channel','toLowerCase','order','capitalize','Queues','add','removeQueues','remove','ids','isArray','Voice','Chat','Mail','Sms','Fax','Openchannel','Whatsapp','through','penalty','QueueId','defaults','TeamVoiceQueue','User','Queue','findOrCreate','emit','Queue:save','online','voicePause','UserVoiceQueueRt','upsert','isNil','SIP/%s','interface','all','addAgents','spread','removeAgents','Queue:remove','getAgents','eml-format','rimraf','fast-json-patch','request-promise','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','redis','localhost','./team.socket','register','status','end','json','offset','limit','undefined','count','set','apply','reject','save','update','then','sendStatus','error','stack','name','map','Team','rawAttributes','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','show','length','find','catch'];(function(_0x554c3b,_0x3196d0){var _0x54402a=function(_0x5beb60){while(--_0x5beb60){_0x554c3b['push'](_0x554c3b['shift']());}};_0x54402a(++_0x3196d0);}(_0xe0f8,0xe4));var _0x8e0f=function(_0x4dc7b9,_0x319d5a){_0x4dc7b9=_0x4dc7b9-0x0;var _0x3ab114=_0xe0f8[_0x4dc7b9];return _0x3ab114;};'use strict';var emlformat=require(_0x8e0f('0x0'));var rimraf=require(_0x8e0f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8e0f('0x2'));var rp=require(_0x8e0f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x8e0f('0x4'));var csv=require(_0x8e0f('0x5'));var ejs=require(_0x8e0f('0x6'));var fs=require('fs');var fs_extra=require(_0x8e0f('0x7'));var _=require(_0x8e0f('0x8'));var squel=require(_0x8e0f('0x9'));var crypto=require(_0x8e0f('0xa'));var jsforce=require(_0x8e0f('0xb'));var deskjs=require(_0x8e0f('0xc'));var toCsv=require(_0x8e0f('0x5'));var querystring=require(_0x8e0f('0xd'));var Papa=require(_0x8e0f('0xe'));var Redis=require(_0x8e0f('0xf'));var authService=require(_0x8e0f('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x8e0f('0x11'));var hardwareService=require(_0x8e0f('0x12'));var logger=require(_0x8e0f('0x13'))('api');var utils=require(_0x8e0f('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x8e0f('0x15'))['db'];config[_0x8e0f('0x16')]=_['defaults'](config[_0x8e0f('0x16')],{'host':_0x8e0f('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8e0f('0x16')]));require(_0x8e0f('0x18'))[_0x8e0f('0x19')](socket);function respondWithStatusCode(_0x4dc7a5,_0x161008){_0x161008=_0x161008||0xcc;return function(_0x48195b){if(_0x48195b){return _0x4dc7a5['sendStatus'](_0x161008);}return _0x4dc7a5[_0x8e0f('0x1a')](_0x161008)[_0x8e0f('0x1b')]();};}function respondWithResult(_0x186cc5,_0x6a7dd7){_0x6a7dd7=_0x6a7dd7||0xc8;return function(_0x3654b8){if(_0x3654b8){return _0x186cc5[_0x8e0f('0x1a')](_0x6a7dd7)[_0x8e0f('0x1c')](_0x3654b8);}};}function respondWithFilteredResult(_0x592e85,_0x48aa6b){return function(_0x4023c6){if(_0x4023c6){var _0x546ccc=typeof _0x48aa6b[_0x8e0f('0x1d')]==='undefined'&&typeof _0x48aa6b[_0x8e0f('0x1e')]===_0x8e0f('0x1f');var _0x25f6e4=_0x4023c6[_0x8e0f('0x20')];var _0xc9817b=_0x546ccc?0x0:_0x48aa6b[_0x8e0f('0x1d')];var _0x5d13fb=_0x546ccc?_0x4023c6[_0x8e0f('0x20')]:_0x48aa6b['offset']+_0x48aa6b['limit'];var _0x156962;if(_0x5d13fb>=_0x25f6e4){_0x5d13fb=_0x25f6e4;_0x156962=0xc8;}else{_0x156962=0xce;}_0x592e85['status'](_0x156962);return _0x592e85[_0x8e0f('0x21')]('Content-Range',_0xc9817b+'-'+_0x5d13fb+'/'+_0x25f6e4)[_0x8e0f('0x1c')](_0x4023c6);}return null;};}function patchUpdates(_0x5d4e2a){return function(_0x3b7cd9){try{jsonpatch[_0x8e0f('0x22')](_0x3b7cd9,_0x5d4e2a,!![]);}catch(_0x5e42fb){return BPromise[_0x8e0f('0x23')](_0x5e42fb);}return _0x3b7cd9[_0x8e0f('0x24')]();};}function saveUpdates(_0x3ff6c2,_0x5ad610){return function(_0x1a8604){if(_0x1a8604){return _0x1a8604[_0x8e0f('0x25')](_0x3ff6c2)[_0x8e0f('0x26')](function(_0x5f2181){return _0x5f2181;});}return null;};}function handleEntityNotFound(_0x5b593c,_0x4e6d05){return function(_0x370831){if(!_0x370831){_0x5b593c[_0x8e0f('0x27')](0x194);}return _0x370831;};}function handleError(_0x2ddb75,_0xfa1d8a){_0xfa1d8a=_0xfa1d8a||0x1f4;return function(_0x465038){logger[_0x8e0f('0x28')](_0x465038[_0x8e0f('0x29')]);if(_0x465038[_0x8e0f('0x2a')]){delete _0x465038['name'];}_0x2ddb75[_0x8e0f('0x1a')](_0xfa1d8a)['send'](_0x465038);};}exports['index']=function(_0x385961,_0x26aadc){var _0x541867={},_0x3ea37b={},_0x22c491={'count':0x0,'rows':[]};var _0x516ee4=_[_0x8e0f('0x2b')](db[_0x8e0f('0x2c')][_0x8e0f('0x2d')],function(_0x5ae0e1){return{'name':_0x5ae0e1['fieldName'],'type':_0x5ae0e1['type']['key']};});_0x3ea37b[_0x8e0f('0x2e')]=_[_0x8e0f('0x2b')](_0x516ee4,_0x8e0f('0x2a'));_0x3ea37b[_0x8e0f('0x2f')]=_[_0x8e0f('0x30')](_0x385961[_0x8e0f('0x2f')]);_0x3ea37b[_0x8e0f('0x31')]=_['intersection'](_0x3ea37b[_0x8e0f('0x2e')],_0x3ea37b[_0x8e0f('0x2f')]);_0x541867[_0x8e0f('0x32')]=_[_0x8e0f('0x33')](_0x3ea37b[_0x8e0f('0x2e')],qs[_0x8e0f('0x34')](_0x385961[_0x8e0f('0x2f')][_0x8e0f('0x34')]));_0x541867[_0x8e0f('0x32')]=_0x541867['attributes']['length']?_0x541867[_0x8e0f('0x32')]:_0x3ea37b['model'];if(!_0x385961[_0x8e0f('0x2f')][_0x8e0f('0x35')](_0x8e0f('0x36'))){_0x541867[_0x8e0f('0x1e')]=qs[_0x8e0f('0x1e')](_0x385961[_0x8e0f('0x2f')][_0x8e0f('0x1e')]);_0x541867[_0x8e0f('0x1d')]=qs['offset'](_0x385961[_0x8e0f('0x2f')]['offset']);}_0x541867['order']=qs[_0x8e0f('0x37')](_0x385961[_0x8e0f('0x2f')][_0x8e0f('0x37')]);_0x541867['where']=qs[_0x8e0f('0x31')](_[_0x8e0f('0x38')](_0x385961['query'],_0x3ea37b[_0x8e0f('0x31')]),_0x516ee4);if(_0x385961[_0x8e0f('0x2f')]['filter']){_0x541867[_0x8e0f('0x39')]=_[_0x8e0f('0x3a')](_0x541867[_0x8e0f('0x39')],{'$or':_[_0x8e0f('0x2b')](_0x516ee4,function(_0xb79af1){if(_0xb79af1['type']!==_0x8e0f('0x3b')){var _0x143046={};_0x143046[_0xb79af1[_0x8e0f('0x2a')]]={'$like':'%'+_0x385961[_0x8e0f('0x2f')][_0x8e0f('0x3c')]+'%'};return _0x143046;}})});}_0x541867=_[_0x8e0f('0x3a')]({},_0x541867,_0x385961[_0x8e0f('0x3d')]);var _0x488fd4={'where':_0x541867[_0x8e0f('0x39')]};return db[_0x8e0f('0x2c')][_0x8e0f('0x20')](_0x488fd4)[_0x8e0f('0x26')](function(_0x25b95f){_0x22c491['count']=_0x25b95f;if(_0x385961[_0x8e0f('0x2f')][_0x8e0f('0x3e')]){_0x541867[_0x8e0f('0x3f')]=[{'all':!![]}];}return db['Team']['findAll'](_0x541867);})[_0x8e0f('0x26')](function(_0x324732){_0x22c491['rows']=_0x324732;return _0x22c491;})['then'](respondWithFilteredResult(_0x26aadc,_0x541867))['catch'](handleError(_0x26aadc,null));};exports[_0x8e0f('0x40')]=function(_0x383c44,_0x240560){var _0x19e62c={'raw':![],'where':{'id':_0x383c44['params']['id']}},_0x9528b={};_0x9528b['model']=_[_0x8e0f('0x30')](db[_0x8e0f('0x2c')]['rawAttributes']);_0x9528b[_0x8e0f('0x2f')]=_[_0x8e0f('0x30')](_0x383c44['query']);_0x9528b[_0x8e0f('0x31')]=_[_0x8e0f('0x33')](_0x9528b[_0x8e0f('0x2e')],_0x9528b['query']);_0x19e62c[_0x8e0f('0x32')]=_[_0x8e0f('0x33')](_0x9528b[_0x8e0f('0x2e')],qs['fields'](_0x383c44[_0x8e0f('0x2f')]['fields']));_0x19e62c[_0x8e0f('0x32')]=_0x19e62c[_0x8e0f('0x32')][_0x8e0f('0x41')]?_0x19e62c[_0x8e0f('0x32')]:_0x9528b[_0x8e0f('0x2e')];if(_0x383c44[_0x8e0f('0x2f')][_0x8e0f('0x3e')]){_0x19e62c[_0x8e0f('0x3f')]=[{'all':!![]}];}_0x19e62c=_[_0x8e0f('0x3a')]({},_0x19e62c,_0x383c44[_0x8e0f('0x3d')]);return db[_0x8e0f('0x2c')][_0x8e0f('0x42')](_0x19e62c)['then'](handleEntityNotFound(_0x240560,null))[_0x8e0f('0x26')](respondWithResult(_0x240560,null))[_0x8e0f('0x43')](handleError(_0x240560,null));};exports[_0x8e0f('0x44')]=function(_0x51ebd0,_0x328155){return db['Team'][_0x8e0f('0x44')](_0x51ebd0['body'],{})[_0x8e0f('0x26')](function(_0x2c579e){var _0x3e8126=_0x51ebd0[_0x8e0f('0x45')]['get']({'plain':!![]});if(!_0x3e8126)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3e8126[_0x8e0f('0x46')]==='user'){var _0x27c19f=_0x2c579e[_0x8e0f('0x47')]({'plain':!![]});var _0x37dc54=_0x8e0f('0x48');return db['UserProfileSection'][_0x8e0f('0x42')]({'where':{'name':_0x37dc54,'userProfileId':_0x3e8126[_0x8e0f('0x49')]},'raw':!![]})[_0x8e0f('0x26')](function(_0x51b58a){if(_0x51b58a&&_0x51b58a[_0x8e0f('0x4a')]===0x0){return db['UserProfileResource'][_0x8e0f('0x44')]({'name':_0x27c19f[_0x8e0f('0x2a')],'resourceId':_0x27c19f['id'],'type':_0x51b58a[_0x8e0f('0x2a')],'sectionId':_0x51b58a['id']},{})['then'](function(){return _0x2c579e;});}else{return _0x2c579e;}})[_0x8e0f('0x43')](function(_0x51a6fe){logger[_0x8e0f('0x28')](_0x8e0f('0x4b'),_0x51a6fe);throw _0x51a6fe;});}return _0x2c579e;})[_0x8e0f('0x26')](respondWithResult(_0x328155,0xc9))[_0x8e0f('0x43')](handleError(_0x328155,null));};exports[_0x8e0f('0x25')]=function(_0x1dc435,_0x57e7ee){if(_0x1dc435[_0x8e0f('0x4c')]['id']){delete _0x1dc435['body']['id'];}return db[_0x8e0f('0x2c')][_0x8e0f('0x42')]({'where':{'id':_0x1dc435[_0x8e0f('0x4d')]['id']}})[_0x8e0f('0x26')](handleEntityNotFound(_0x57e7ee,null))[_0x8e0f('0x26')](saveUpdates(_0x1dc435[_0x8e0f('0x4c')],null))[_0x8e0f('0x26')](respondWithResult(_0x57e7ee,null))[_0x8e0f('0x43')](handleError(_0x57e7ee,null));};exports['destroy']=function(_0x1d3d18,_0x7d729){var _0xc10776=_0x1d3d18[_0x8e0f('0x4d')]['id'];var _0x239645=[];return db[_0x8e0f('0x4e')][_0x8e0f('0x4f')](function(_0x12a844){var _0x1d5938=_0x8e0f('0x50')+_0xc10776;return db[_0x8e0f('0x4e')][_0x8e0f('0x2f')](_0x1d5938,{'type':db['Sequelize'][_0x8e0f('0x51')][_0x8e0f('0x52')],'raw':!![],'transaction':_0x12a844})[_0x8e0f('0x26')](function(_0xe34742){_0x239645=_[_0x8e0f('0x2b')](_0xe34742,function(_0x188ae2){return Number(_0x188ae2['UserId']);});})['then'](function(){var _0xe9e746=_0x8e0f('0x53')+_0xc10776;return db[_0x8e0f('0x4e')][_0x8e0f('0x2f')](_0xe9e746,{'type':db['Sequelize']['QueryTypes'][_0x8e0f('0x52')],'raw':!![],'transaction':_0x12a844});})[_0x8e0f('0x26')](function(_0x48bff8){var _0xce3ebf=_[_0x8e0f('0x2b')](_0x48bff8,function(_0x865641){return Number(_0x865641[_0x8e0f('0x54')]);});return db[_0x8e0f('0x55')][_0x8e0f('0x56')]({'where':{'UserId':{'$in':_0x239645},'VoiceQueueId':{'$in':_0xce3ebf}},'transaction':_0x12a844});})['then'](function(){var _0x571e74='SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20'+_0xc10776;return db['sequelize'][_0x8e0f('0x2f')](_0x571e74,{'type':db['Sequelize'][_0x8e0f('0x51')][_0x8e0f('0x52')],'raw':!![],'transaction':_0x12a844});})['then'](function(_0x5c4f12){var _0x3645b5=_[_0x8e0f('0x2b')](_0x5c4f12,function(_0x505c5f){return Number(_0x505c5f[_0x8e0f('0x57')]);});return db[_0x8e0f('0x58')][_0x8e0f('0x56')]({'where':{'UserId':{'$in':_0x239645},'MailQueueId':{'$in':_0x3645b5}},'transaction':_0x12a844});})[_0x8e0f('0x26')](function(){var _0x2a62c8='SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20'+_0xc10776;return db[_0x8e0f('0x4e')][_0x8e0f('0x2f')](_0x2a62c8,{'type':db[_0x8e0f('0x59')]['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x12a844});})['then'](function(_0x4d830e){var _0x5bfd92=_[_0x8e0f('0x2b')](_0x4d830e,function(_0x56434c){return Number(_0x56434c[_0x8e0f('0x5a')]);});return db[_0x8e0f('0x5b')]['destroy']({'where':{'UserId':{'$in':_0x239645},'SmsQueueId':{'$in':_0x5bfd92}},'transaction':_0x12a844});})['then'](function(){var _0x41598a='SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20'+_0xc10776;return db['sequelize'][_0x8e0f('0x2f')](_0x41598a,{'type':db['Sequelize'][_0x8e0f('0x51')][_0x8e0f('0x52')],'raw':!![],'transaction':_0x12a844});})['then'](function(_0x1527e8){var _0x437bd0=_[_0x8e0f('0x2b')](_0x1527e8,function(_0x2baddd){return Number(_0x2baddd['ChatQueueId']);});return db[_0x8e0f('0x5c')][_0x8e0f('0x56')]({'where':{'UserId':{'$in':_0x239645},'ChatQueueId':{'$in':_0x437bd0}},'transaction':_0x12a844});})[_0x8e0f('0x26')](function(){var _0x23e296=_0x8e0f('0x5d')+_0xc10776;return db[_0x8e0f('0x4e')]['query'](_0x23e296,{'type':db['Sequelize'][_0x8e0f('0x51')][_0x8e0f('0x52')],'raw':!![],'transaction':_0x12a844});})[_0x8e0f('0x26')](function(_0x33746b){var _0xe7c3e0=_['map'](_0x33746b,function(_0x379534){return Number(_0x379534['FaxQueueId']);});return db['UserFaxQueue'][_0x8e0f('0x56')]({'where':{'UserId':{'$in':_0x239645},'FaxQueueId':{'$in':_0xe7c3e0}},'transaction':_0x12a844});})[_0x8e0f('0x26')](function(){var _0x128087=_0x8e0f('0x5e')+_0xc10776;return db['sequelize'][_0x8e0f('0x2f')](_0x128087,{'type':db[_0x8e0f('0x59')][_0x8e0f('0x51')][_0x8e0f('0x52')],'raw':!![],'transaction':_0x12a844});})[_0x8e0f('0x26')](function(_0x586d66){var _0x45fc8e=_[_0x8e0f('0x2b')](_0x586d66,function(_0x1cf86c){return Number(_0x1cf86c[_0x8e0f('0x5f')]);});return db['UserOpenchannelQueue'][_0x8e0f('0x56')]({'where':{'UserId':{'$in':_0x239645},'OpenchannelQueueId':{'$in':_0x45fc8e}},'transaction':_0x12a844});})[_0x8e0f('0x26')](function(){var _0x477b8f=_0x8e0f('0x60')+_0xc10776;return db[_0x8e0f('0x4e')][_0x8e0f('0x2f')](_0x477b8f,{'type':db[_0x8e0f('0x59')]['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x12a844});})[_0x8e0f('0x26')](function(_0x84581a){var _0x29d85d=_[_0x8e0f('0x2b')](_0x84581a,function(_0x817636){return Number(_0x817636['WhatsappQueueId']);});return db[_0x8e0f('0x61')][_0x8e0f('0x56')]({'where':{'UserId':{'$in':_0x239645},'WhatsappQueueId':{'$in':_0x29d85d}},'transaction':_0x12a844});})[_0x8e0f('0x26')](function(){return db[_0x8e0f('0x62')][_0x8e0f('0x42')]({'where':{'TeamId':_0xc10776}});})[_0x8e0f('0x26')](function(_0x4c548a){if(_0x4c548a===null){return;}return db[_0x8e0f('0x63')]['destroy']({'where':{'UserId':{'$in':_0x239645},'VoicePrefixId':_0x4c548a[_0x8e0f('0x64')]},'transaction':_0x12a844});})['then'](function(){return db[_0x8e0f('0x2c')][_0x8e0f('0x56')]({'where':{'id':_0xc10776},'cascade':!![],'transaction':_0x12a844});})[_0x8e0f('0x26')](function(_0x546f22){if(_0x546f22===0x0){_0x7d729[_0x8e0f('0x27')](0x194);}else{return db[_0x8e0f('0x65')][_0x8e0f('0x56')]({'where':{'type':_0x8e0f('0x48'),'resourceId':_0xc10776},'cascade':!![],'transaction':_0x12a844})['then'](function(){_0x7d729[_0x8e0f('0x1a')](0xcc)['end']();});}})[_0x8e0f('0x43')](function(_0x47565a){_0x7d729[_0x8e0f('0x1a')](0x1f4)[_0x8e0f('0x66')](_0x47565a);});});};exports[_0x8e0f('0x67')]=function(_0x2bd8f6,_0x2c4516,_0x38dbe5){return db[_0x8e0f('0x2c')][_0x8e0f('0x68')]({'where':{'id':_0x2bd8f6[_0x8e0f('0x4d')]['id']}})[_0x8e0f('0x26')](handleEntityNotFound(_0x2c4516,null))[_0x8e0f('0x26')](function(_0xae1ab2){if(!_0x2bd8f6[_0x8e0f('0x2f')][_0x8e0f('0x69')]||!utils[_0x8e0f('0x6a')](_0x2bd8f6[_0x8e0f('0x2f')][_0x8e0f('0x69')])){throw new db[(_0x8e0f('0x59'))][(_0x8e0f('0x6b'))](_0x8e0f('0x6c'));}var _0x333256={};var _0x37ba34={};_0x37ba34[_0x8e0f('0x2e')]=_['keys'](db[_['capitalize'](_0x2bd8f6['query'][_0x8e0f('0x69')][_0x8e0f('0x6d')]())+'Queue'][_0x8e0f('0x2d')]);_0x37ba34[_0x8e0f('0x2f')]=_[_0x8e0f('0x30')](_0x2bd8f6['query']);_0x37ba34[_0x8e0f('0x31')]=_['intersection'](_0x37ba34['model'],_0x37ba34['query']);_0x333256['attributes']=_['intersection'](_0x37ba34[_0x8e0f('0x2e')],qs[_0x8e0f('0x34')](_0x2bd8f6[_0x8e0f('0x2f')][_0x8e0f('0x34')]));_0x333256[_0x8e0f('0x32')]=_0x333256['attributes'][_0x8e0f('0x41')]?_0x333256[_0x8e0f('0x32')]:_0x37ba34[_0x8e0f('0x2e')];_0x333256['limit']=qs[_0x8e0f('0x1e')](_0x2bd8f6['query'][_0x8e0f('0x1e')]);_0x333256[_0x8e0f('0x1d')]=qs[_0x8e0f('0x1d')](_0x2bd8f6['query'][_0x8e0f('0x1d')]);_0x333256[_0x8e0f('0x6e')]=qs[_0x8e0f('0x37')](_0x2bd8f6[_0x8e0f('0x2f')][_0x8e0f('0x37')]);_0x333256[_0x8e0f('0x39')]=qs[_0x8e0f('0x31')](_[_0x8e0f('0x38')](_0x2bd8f6[_0x8e0f('0x2f')],_0x37ba34['filters']));_0x333256=_[_0x8e0f('0x3a')]({},_0x333256,_0x2bd8f6[_0x8e0f('0x3d')]);return _0xae1ab2[_0x8e0f('0x47')+_[_0x8e0f('0x6f')](_0x2bd8f6['query'][_0x8e0f('0x69')][_0x8e0f('0x6d')]())+_0x8e0f('0x70')](_0x333256);})['then'](respondWithResult(_0x2c4516,null))[_0x8e0f('0x43')](handleError(_0x2c4516,null));};exports['addQueues']=function(_0x2882f6,_0x4cdf80,_0x5751ae){return db[_0x8e0f('0x2c')][_0x8e0f('0x68')]({'where':{'id':_0x2882f6[_0x8e0f('0x4d')]['id']}})[_0x8e0f('0x26')](function(_0x5ea5f9){if(_0x5ea5f9){if(!_0x2882f6[_0x8e0f('0x4c')]['channel']||!utils[_0x8e0f('0x6a')](_0x2882f6[_0x8e0f('0x4c')][_0x8e0f('0x69')])){throw new db[(_0x8e0f('0x59'))][(_0x8e0f('0x6b'))]('Unknown\x20channel');}return _0x5ea5f9[_0x8e0f('0x71')+_[_0x8e0f('0x6f')](_0x2882f6[_0x8e0f('0x4c')][_0x8e0f('0x69')][_0x8e0f('0x6d')]())+_0x8e0f('0x70')](_0x2882f6['body']['ids']);}return null;})[_0x8e0f('0x26')](handleEntityNotFound(_0x4cdf80,null))[_0x8e0f('0x26')](respondWithStatusCode(_0x4cdf80,null))[_0x8e0f('0x43')](handleError(_0x4cdf80,null));};exports[_0x8e0f('0x72')]=function(_0x2e43e3,_0x72443,_0x22d051){return db[_0x8e0f('0x2c')][_0x8e0f('0x68')]({'where':{'id':_0x2e43e3[_0x8e0f('0x4d')]['id']}})['then'](function(_0x321fbf){if(_0x321fbf){if(!_0x2e43e3[_0x8e0f('0x2f')][_0x8e0f('0x69')]||!utils[_0x8e0f('0x6a')](_0x2e43e3[_0x8e0f('0x2f')]['channel'])){throw new db[(_0x8e0f('0x59'))][(_0x8e0f('0x6b'))]('Unknown\x20channel');}return _0x321fbf[_0x8e0f('0x73')+_['capitalize'](_0x2e43e3[_0x8e0f('0x2f')][_0x8e0f('0x69')][_0x8e0f('0x6d')]())+'Queues'](_0x2e43e3['query'][_0x8e0f('0x74')]);}return null;})[_0x8e0f('0x26')](handleEntityNotFound(_0x72443,null))[_0x8e0f('0x26')](respondWithStatusCode(_0x72443,null))[_0x8e0f('0x43')](handleError(_0x72443,null));};exports['addAgents']=function(_0x55a701,_0x3e9830){var _0x2fee83=_[_0x8e0f('0x75')](_0x55a701[_0x8e0f('0x4c')][_0x8e0f('0x74')])?_0x55a701[_0x8e0f('0x4c')][_0x8e0f('0x74')]:[_0x55a701['body'][_0x8e0f('0x74')]];var _0x53a3ca=_0x55a701[_0x8e0f('0x4d')]['id'];return db[_0x8e0f('0x2c')]['find']({'where':{'id':_0x53a3ca}})[_0x8e0f('0x26')](handleEntityNotFound(_0x3e9830,null))[_0x8e0f('0x26')](function(_0x111d52){if(_0x111d52){var _0x2636f7=[_0x8e0f('0x76'),_0x8e0f('0x77'),_0x8e0f('0x78'),_0x8e0f('0x79'),_0x8e0f('0x7a'),_0x8e0f('0x7b'),_0x8e0f('0x7c')];return db[_0x8e0f('0x4e')][_0x8e0f('0x4f')](function(_0x2077db){var _0x1c8292=_[_0x8e0f('0x2b')](_0x2636f7,function(_0x29e3bc){var _0x3842ea={'attributes':['id',_0x8e0f('0x2a')]};if(_0x29e3bc===_0x8e0f('0x76')){_0x3842ea[_0x8e0f('0x7d')]={'attributes':[_0x8e0f('0x7e')]};}return _0x111d52[_0x8e0f('0x47')+_0x29e3bc+_0x8e0f('0x70')](_0x3842ea)[_0x8e0f('0x26')](function(_0x2e1864){var _0x23b618=_[_0x8e0f('0x2b')](_0x2e1864,function(_0x51e843){var _0x53572a=_[_0x8e0f('0x2b')](_0x2fee83,function(_0x5d80b3){var _0x5a98d5={'where':{'UserId':_0x5d80b3,[_0x29e3bc+_0x8e0f('0x7f')]:_0x51e843['id']},'transaction':_0x2077db};if(_0x29e3bc===_0x8e0f('0x76')){_0x5a98d5[_0x8e0f('0x80')]={'penalty':_0x51e843[_0x8e0f('0x81')]['penalty']};}return db[_0x8e0f('0x82')+_0x29e3bc+_0x8e0f('0x83')][_0x8e0f('0x84')](_0x5a98d5)['then'](function(){socket[_0x8e0f('0x85')](_0x8e0f('0x45')+_0x29e3bc+_0x8e0f('0x86'),{'UserId':_0x5d80b3,[_0x29e3bc+'QueueId']:_0x51e843['id']});if(_0x29e3bc!==_0x8e0f('0x76')){return;}return db[_0x8e0f('0x82')]['findAll']({'where':{'id':_0x2fee83,'online':0x1},'attributes':['id',_0x8e0f('0x2a'),_0x8e0f('0x87'),_0x8e0f('0x88'),'interface'],'raw':!![]})['then'](function(_0x22f667){var _0x37f6bc=_[_0x8e0f('0x2b')](_0x22f667,function(_0x509ffd){return db[_0x8e0f('0x89')][_0x8e0f('0x8a')]({'membername':_0x509ffd[_0x8e0f('0x2a')],'UserId':_0x509ffd['id'],'queue_name':_0x51e843[_0x8e0f('0x2a')],'VoiceQueueId':_0x51e843['id'],'interface':_[_0x8e0f('0x8b')](_0x509ffd['interface'])?util['format'](_0x8e0f('0x8c'),_0x509ffd[_0x8e0f('0x2a')]):_0x509ffd[_0x8e0f('0x8d')],'paused':_0x509ffd['voicePause']||![],'penalty':_0x51e843[_0x8e0f('0x81')][_0x8e0f('0x7e')]},{'transaction':_0x2077db});});return Promise[_0x8e0f('0x8e')](_0x37f6bc);});});});return Promise[_0x8e0f('0x8e')](_0x53572a);});return Promise[_0x8e0f('0x8e')](_0x23b618);})[_0x8e0f('0x26')](function(){return db[_0x8e0f('0x62')]['findOne']({'where':{'teamId':_0x53a3ca}})['then'](function(_0x2a6032){if(_0x2a6032){var _0x1d3d2b=_['map'](_0x2fee83,function(_0x290389){db[_0x8e0f('0x63')]['upsert']({'UserId':_0x290389,'VoicePrefixId':_0x2a6032['VoicePrefixId']});});return Promise[_0x8e0f('0x8e')](_0x1d3d2b);}});});});return Promise[_0x8e0f('0x8e')](_0x1c8292)[_0x8e0f('0x26')](function(){return _0x111d52[_0x8e0f('0x8f')](_0x2fee83,{'transaction':_0x2077db})[_0x8e0f('0x90')](function(_0xf7f553){return _0xf7f553;});});});}})[_0x8e0f('0x26')](respondWithResult(_0x3e9830,null))[_0x8e0f('0x43')](handleError(_0x3e9830,null));};exports[_0x8e0f('0x91')]=function(_0x3853ff,_0x59ca11){var _0x3ebf1e=_[_0x8e0f('0x75')](_0x3853ff[_0x8e0f('0x2f')][_0x8e0f('0x74')])?_0x3853ff['query'][_0x8e0f('0x74')]:[_0x3853ff['query'][_0x8e0f('0x74')]];var _0x4da83c=_0x3853ff['params']['id'];return db[_0x8e0f('0x2c')][_0x8e0f('0x42')]({'where':{'id':_0x4da83c}})[_0x8e0f('0x26')](handleEntityNotFound(_0x59ca11,null))['then'](function(_0x4482b2){if(_0x4482b2){var _0xcbc46c=[_0x8e0f('0x76'),_0x8e0f('0x77'),_0x8e0f('0x78'),_0x8e0f('0x79'),_0x8e0f('0x7a'),_0x8e0f('0x7b'),'Whatsapp'];return db['sequelize'][_0x8e0f('0x4f')](function(_0x30b2df){var _0x56b1e0=_[_0x8e0f('0x2b')](_0xcbc46c,function(_0x1a39a4){var _0x614dd8={'attributes':['id',_0x8e0f('0x2a')]};return _0x4482b2[_0x8e0f('0x47')+_0x1a39a4+'Queues'](_0x614dd8)[_0x8e0f('0x26')](function(_0x96b504){var _0x26cdb4=_['map'](_0x96b504,function(_0x32727f){return _0x32727f['removeAgents'](_0x3ebf1e,{'transaction':_0x30b2df})[_0x8e0f('0x26')](function(){var _0xbc5466=_[_0x8e0f('0x2b')](_0x3ebf1e,function(_0x1af583){socket[_0x8e0f('0x85')](_0x8e0f('0x45')+_0x1a39a4+_0x8e0f('0x92'),{'UserId':Number(_0x1af583),[_0x1a39a4+'QueueId']:_0x32727f['id']});if(_0x1a39a4!==_0x8e0f('0x76')){return;}return db['UserVoiceQueueRt'][_0x8e0f('0x56')]({'where':{'VoiceQueueId':_0x32727f['id'],'UserId':_0x1af583},'transaction':_0x30b2df});});return Promise[_0x8e0f('0x8e')](_0xbc5466);});});return Promise['all'](_0x26cdb4);});});return Promise[_0x8e0f('0x8e')](_0x56b1e0)[_0x8e0f('0x26')](function(){return _0x4482b2[_0x8e0f('0x91')](_0x3ebf1e,{'transaction':_0x30b2df});})[_0x8e0f('0x26')](function(){return db['TeamVoicePrefix']['findOne']({'where':{'teamId':_0x4da83c}})[_0x8e0f('0x26')](function(_0x543c57){if(_0x543c57){var _0x1b67e5=_[_0x8e0f('0x2b')](_0x3ebf1e,function(_0x1e2ad6){db[_0x8e0f('0x63')][_0x8e0f('0x56')]({'where':{'UserId':_0x1e2ad6,'VoicePrefixId':_0x543c57[_0x8e0f('0x64')]}});});return Promise[_0x8e0f('0x8e')](_0x1b67e5);}});});});}})['then'](respondWithStatusCode(_0x59ca11,null))['catch'](handleError(_0x59ca11,null));};exports['getAgents']=function(_0x45bff0,_0x5111af,_0x444f6d){var _0x4493dd={};var _0x542a5e={};var _0x1f00fa;var _0x4cd53e;return db[_0x8e0f('0x2c')][_0x8e0f('0x68')]({'where':{'id':_0x45bff0[_0x8e0f('0x4d')]['id']}})['then'](handleEntityNotFound(_0x5111af,null))[_0x8e0f('0x26')](function(_0xfaeccc){if(_0xfaeccc){_0x1f00fa=_0xfaeccc;_0x542a5e[_0x8e0f('0x2e')]=_[_0x8e0f('0x30')](db[_0x8e0f('0x82')][_0x8e0f('0x2d')]);_0x542a5e[_0x8e0f('0x2f')]=_[_0x8e0f('0x30')](_0x45bff0['query']);_0x542a5e['filters']=_[_0x8e0f('0x33')](_0x542a5e['model'],_0x542a5e[_0x8e0f('0x2f')]);_0x4493dd[_0x8e0f('0x32')]=_['intersection'](_0x542a5e[_0x8e0f('0x2e')],qs['fields'](_0x45bff0[_0x8e0f('0x2f')]['fields']));_0x4493dd[_0x8e0f('0x32')]=_0x4493dd[_0x8e0f('0x32')][_0x8e0f('0x41')]?_0x4493dd[_0x8e0f('0x32')]:_0x542a5e[_0x8e0f('0x2e')];_0x4493dd[_0x8e0f('0x6e')]=qs[_0x8e0f('0x37')](_0x45bff0[_0x8e0f('0x2f')]['sort']);_0x4493dd[_0x8e0f('0x39')]=qs['filters'](_[_0x8e0f('0x38')](_0x45bff0[_0x8e0f('0x2f')],_0x542a5e[_0x8e0f('0x31')]));if(_0x45bff0[_0x8e0f('0x2f')]['filter']){_0x4493dd[_0x8e0f('0x39')]=_['merge'](_0x4493dd['where'],{'$or':_[_0x8e0f('0x2b')](_0x4493dd[_0x8e0f('0x32')],function(_0x1a7eb0){var _0x47ea8f={};_0x47ea8f[_0x1a7eb0]={'$like':'%'+_0x45bff0[_0x8e0f('0x2f')][_0x8e0f('0x3c')]+'%'};return _0x47ea8f;})});}_0x4493dd=_['merge']({},_0x4493dd,_0x45bff0[_0x8e0f('0x3d')]);return _0x1f00fa[_0x8e0f('0x93')](_0x4493dd);}})[_0x8e0f('0x26')](function(_0x5b33aa){if(_0x5b33aa){_0x4cd53e=_0x5b33aa[_0x8e0f('0x41')];if(!_0x45bff0['query'][_0x8e0f('0x35')](_0x8e0f('0x36'))){_0x4493dd[_0x8e0f('0x1e')]=qs['limit'](_0x45bff0[_0x8e0f('0x2f')]['limit']);_0x4493dd[_0x8e0f('0x1d')]=qs[_0x8e0f('0x1d')](_0x45bff0[_0x8e0f('0x2f')][_0x8e0f('0x1d')]);}return _0x1f00fa[_0x8e0f('0x93')](_0x4493dd);}})[_0x8e0f('0x26')](function(_0x476ba5){if(_0x476ba5){return _0x476ba5?{'count':_0x4cd53e,'rows':_0x476ba5}:null;}})['then'](respondWithResult(_0x5111af,null))[_0x8e0f('0x43')](handleError(_0x5111af,null));}; \ No newline at end of file +var _0xab30=['register','sendStatus','status','end','json','undefined','limit','offset','apply','reject','update','then','error','stack','name','send','index','map','Team','type','key','model','query','filters','intersection','fields','attributes','nolimit','order','sort','where','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','rawAttributes','keys','length','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Teams','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','sequelize','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','SELECT','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','QueryTypes','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','UserMailQueue','SmsQueueId','UserSmsQueue','destroy','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','TeamVoicePrefix','VoicePrefixId','getQueues','channel','isValidChannel','Unknown\x20channel','capitalize','toLowerCase','pick','addQueues','findOne','Queues','removeQueues','ValidationError','remove','addAgents','isArray','ids','Chat','Mail','Sms','Fax','Openchannel','Whatsapp','transaction','Voice','through','penalty','QueueId','TeamVoiceQueue','User','Queue','Queue:save','online','voicePause','UserVoiceQueueRt','isNil','interface','format','SIP/%s','all','UserVoicePrefix','upsert','removeAgents','Queue:remove','getAgents','hasOwnProperty','eml-format','rimraf','zip-dir','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xab30,0x1b7));var _0x0ab3=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xab30[_0x40a045];return _0x1a687c;};'use strict';var emlformat=require(_0x0ab3('0x0'));var rimraf=require(_0x0ab3('0x1'));var zipdir=require(_0x0ab3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0ab3('0x3'));var moment=require(_0x0ab3('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0ab3('0x5'));var util=require('util');var path=require('path');var sox=require(_0x0ab3('0x6'));var csv=require(_0x0ab3('0x7'));var ejs=require(_0x0ab3('0x8'));var fs=require('fs');var fs_extra=require(_0x0ab3('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x0ab3('0xa'));var jsforce=require(_0x0ab3('0xb'));var deskjs=require(_0x0ab3('0xc'));var toCsv=require(_0x0ab3('0x7'));var querystring=require(_0x0ab3('0xd'));var Papa=require(_0x0ab3('0xe'));var Redis=require(_0x0ab3('0xf'));var authService=require(_0x0ab3('0x10'));var qs=require(_0x0ab3('0x11'));var as=require(_0x0ab3('0x12'));var hardwareService=require(_0x0ab3('0x13'));var logger=require(_0x0ab3('0x14'))(_0x0ab3('0x15'));var utils=require(_0x0ab3('0x16'));var config=require(_0x0ab3('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x0ab3('0x18'))['db'];config[_0x0ab3('0x19')]=_[_0x0ab3('0x1a')](config[_0x0ab3('0x19')],{'host':_0x0ab3('0x1b'),'port':0x18eb});var socket=require(_0x0ab3('0x1c'))(new Redis(config[_0x0ab3('0x19')]));require('./team.socket')[_0x0ab3('0x1d')](socket);function respondWithStatusCode(_0x2b8a6d,_0x541c1c){_0x541c1c=_0x541c1c||0xcc;return function(_0x35c41f){if(_0x35c41f){return _0x2b8a6d[_0x0ab3('0x1e')](_0x541c1c);}return _0x2b8a6d[_0x0ab3('0x1f')](_0x541c1c)[_0x0ab3('0x20')]();};}function respondWithResult(_0x177e51,_0x47caeb){_0x47caeb=_0x47caeb||0xc8;return function(_0x5c2a30){if(_0x5c2a30){return _0x177e51['status'](_0x47caeb)[_0x0ab3('0x21')](_0x5c2a30);}};}function respondWithFilteredResult(_0x1a7fe0,_0x40bfae){return function(_0x54dece){if(_0x54dece){var _0x36145f=typeof _0x40bfae['offset']===_0x0ab3('0x22')&&typeof _0x40bfae[_0x0ab3('0x23')]==='undefined';var _0x4fc9ff=_0x54dece['count'];var _0x1c2aa5=_0x36145f?0x0:_0x40bfae[_0x0ab3('0x24')];var _0x12f2d1=_0x36145f?_0x54dece['count']:_0x40bfae[_0x0ab3('0x24')]+_0x40bfae['limit'];var _0x40769d;if(_0x12f2d1>=_0x4fc9ff){_0x12f2d1=_0x4fc9ff;_0x40769d=0xc8;}else{_0x40769d=0xce;}_0x1a7fe0[_0x0ab3('0x1f')](_0x40769d);return _0x1a7fe0['set']('Content-Range',_0x1c2aa5+'-'+_0x12f2d1+'/'+_0x4fc9ff)[_0x0ab3('0x21')](_0x54dece);}return null;};}function patchUpdates(_0x3cb6ea){return function(_0x140254){try{jsonpatch[_0x0ab3('0x25')](_0x140254,_0x3cb6ea,!![]);}catch(_0x35b186){return BPromise[_0x0ab3('0x26')](_0x35b186);}return _0x140254['save']();};}function saveUpdates(_0x3e4bbe,_0x6fe744){return function(_0x29a2ef){if(_0x29a2ef){return _0x29a2ef[_0x0ab3('0x27')](_0x3e4bbe)[_0x0ab3('0x28')](function(_0x4816fd){return _0x4816fd;});}return null;};}function handleEntityNotFound(_0x52cd3c,_0x1059a3){return function(_0x14deb8){if(!_0x14deb8){_0x52cd3c[_0x0ab3('0x1e')](0x194);}return _0x14deb8;};}function handleError(_0x1a03de,_0x3c856a){_0x3c856a=_0x3c856a||0x1f4;return function(_0x904a15){logger[_0x0ab3('0x29')](_0x904a15[_0x0ab3('0x2a')]);if(_0x904a15['name']){delete _0x904a15[_0x0ab3('0x2b')];}_0x1a03de[_0x0ab3('0x1f')](_0x3c856a)[_0x0ab3('0x2c')](_0x904a15);};}exports[_0x0ab3('0x2d')]=function(_0x1fb8ef,_0x5691ad){var _0x1c49d9={},_0x3dd308={},_0x4c876e={'count':0x0,'rows':[]};var _0xfb7958=_[_0x0ab3('0x2e')](db[_0x0ab3('0x2f')]['rawAttributes'],function(_0x2e92bc){return{'name':_0x2e92bc['fieldName'],'type':_0x2e92bc[_0x0ab3('0x30')][_0x0ab3('0x31')]};});_0x3dd308[_0x0ab3('0x32')]=_['map'](_0xfb7958,_0x0ab3('0x2b'));_0x3dd308[_0x0ab3('0x33')]=_['keys'](_0x1fb8ef[_0x0ab3('0x33')]);_0x3dd308[_0x0ab3('0x34')]=_[_0x0ab3('0x35')](_0x3dd308[_0x0ab3('0x32')],_0x3dd308[_0x0ab3('0x33')]);_0x1c49d9['attributes']=_[_0x0ab3('0x35')](_0x3dd308[_0x0ab3('0x32')],qs[_0x0ab3('0x36')](_0x1fb8ef[_0x0ab3('0x33')]['fields']));_0x1c49d9[_0x0ab3('0x37')]=_0x1c49d9[_0x0ab3('0x37')]['length']?_0x1c49d9[_0x0ab3('0x37')]:_0x3dd308[_0x0ab3('0x32')];if(!_0x1fb8ef[_0x0ab3('0x33')]['hasOwnProperty'](_0x0ab3('0x38'))){_0x1c49d9[_0x0ab3('0x23')]=qs[_0x0ab3('0x23')](_0x1fb8ef['query']['limit']);_0x1c49d9['offset']=qs[_0x0ab3('0x24')](_0x1fb8ef['query'][_0x0ab3('0x24')]);}_0x1c49d9[_0x0ab3('0x39')]=qs[_0x0ab3('0x3a')](_0x1fb8ef['query'][_0x0ab3('0x3a')]);_0x1c49d9[_0x0ab3('0x3b')]=qs[_0x0ab3('0x34')](_['pick'](_0x1fb8ef[_0x0ab3('0x33')],_0x3dd308[_0x0ab3('0x34')]),_0xfb7958);if(_0x1fb8ef['query'][_0x0ab3('0x3c')]){_0x1c49d9[_0x0ab3('0x3b')]=_[_0x0ab3('0x3d')](_0x1c49d9[_0x0ab3('0x3b')],{'$or':_[_0x0ab3('0x2e')](_0xfb7958,function(_0x144ca4){if(_0x144ca4[_0x0ab3('0x30')]!==_0x0ab3('0x3e')){var _0x4fc7a6={};_0x4fc7a6[_0x144ca4[_0x0ab3('0x2b')]]={'$like':'%'+_0x1fb8ef['query'][_0x0ab3('0x3c')]+'%'};return _0x4fc7a6;}})});}_0x1c49d9=_[_0x0ab3('0x3d')]({},_0x1c49d9,_0x1fb8ef[_0x0ab3('0x3f')]);var _0x492fd2={'where':_0x1c49d9[_0x0ab3('0x3b')]};return db[_0x0ab3('0x2f')][_0x0ab3('0x40')](_0x492fd2)['then'](function(_0xb1761c){_0x4c876e[_0x0ab3('0x40')]=_0xb1761c;if(_0x1fb8ef['query'][_0x0ab3('0x41')]){_0x1c49d9[_0x0ab3('0x42')]=[{'all':!![]}];}return db[_0x0ab3('0x2f')][_0x0ab3('0x43')](_0x1c49d9);})[_0x0ab3('0x28')](function(_0x7e93fd){_0x4c876e[_0x0ab3('0x44')]=_0x7e93fd;return _0x4c876e;})[_0x0ab3('0x28')](respondWithFilteredResult(_0x5691ad,_0x1c49d9))[_0x0ab3('0x45')](handleError(_0x5691ad,null));};exports[_0x0ab3('0x46')]=function(_0x3946d1,_0x4c08da){var _0x2eaf16={'raw':![],'where':{'id':_0x3946d1[_0x0ab3('0x47')]['id']}},_0xad55dc={};_0xad55dc['model']=_['keys'](db[_0x0ab3('0x2f')][_0x0ab3('0x48')]);_0xad55dc[_0x0ab3('0x33')]=_[_0x0ab3('0x49')](_0x3946d1['query']);_0xad55dc[_0x0ab3('0x34')]=_[_0x0ab3('0x35')](_0xad55dc[_0x0ab3('0x32')],_0xad55dc['query']);_0x2eaf16[_0x0ab3('0x37')]=_[_0x0ab3('0x35')](_0xad55dc[_0x0ab3('0x32')],qs['fields'](_0x3946d1['query'][_0x0ab3('0x36')]));_0x2eaf16['attributes']=_0x2eaf16[_0x0ab3('0x37')][_0x0ab3('0x4a')]?_0x2eaf16[_0x0ab3('0x37')]:_0xad55dc[_0x0ab3('0x32')];if(_0x3946d1[_0x0ab3('0x33')]['includeAll']){_0x2eaf16['include']=[{'all':!![]}];}_0x2eaf16=_[_0x0ab3('0x3d')]({},_0x2eaf16,_0x3946d1[_0x0ab3('0x3f')]);return db[_0x0ab3('0x2f')][_0x0ab3('0x4b')](_0x2eaf16)['then'](handleEntityNotFound(_0x4c08da,null))['then'](respondWithResult(_0x4c08da,null))[_0x0ab3('0x45')](handleError(_0x4c08da,null));};exports[_0x0ab3('0x4c')]=function(_0x1a8791,_0x197d8c){return db[_0x0ab3('0x2f')]['create'](_0x1a8791[_0x0ab3('0x4d')],{})[_0x0ab3('0x28')](function(_0x53db52){var _0x2fe675=_0x1a8791['user'][_0x0ab3('0x4e')]({'plain':!![]});if(!_0x2fe675)throw new Error(_0x0ab3('0x4f'));if(_0x2fe675[_0x0ab3('0x50')]===_0x0ab3('0x51')){var _0x19e27d=_0x53db52[_0x0ab3('0x4e')]({'plain':!![]});var _0x5970a2=_0x0ab3('0x52');return db['UserProfileSection']['find']({'where':{'name':_0x5970a2,'userProfileId':_0x2fe675[_0x0ab3('0x53')]},'raw':!![]})[_0x0ab3('0x28')](function(_0x10b7fd){if(_0x10b7fd&&_0x10b7fd[_0x0ab3('0x54')]===0x0){return db[_0x0ab3('0x55')][_0x0ab3('0x4c')]({'name':_0x19e27d['name'],'resourceId':_0x19e27d['id'],'type':_0x10b7fd[_0x0ab3('0x2b')],'sectionId':_0x10b7fd['id']},{})[_0x0ab3('0x28')](function(){return _0x53db52;});}else{return _0x53db52;}})[_0x0ab3('0x45')](function(_0xe6615d){logger['error'](_0x0ab3('0x56'),_0xe6615d);throw _0xe6615d;});}return _0x53db52;})[_0x0ab3('0x28')](respondWithResult(_0x197d8c,0xc9))['catch'](handleError(_0x197d8c,null));};exports[_0x0ab3('0x27')]=function(_0x3721d8,_0x37df2d){if(_0x3721d8[_0x0ab3('0x4d')]['id']){delete _0x3721d8[_0x0ab3('0x4d')]['id'];}return db['Team']['find']({'where':{'id':_0x3721d8[_0x0ab3('0x47')]['id']}})[_0x0ab3('0x28')](handleEntityNotFound(_0x37df2d,null))[_0x0ab3('0x28')](saveUpdates(_0x3721d8[_0x0ab3('0x4d')],null))['then'](respondWithResult(_0x37df2d,null))[_0x0ab3('0x45')](handleError(_0x37df2d,null));};exports['destroy']=function(_0x3d4c9c,_0x154efa){var _0x3b7d54=_0x3d4c9c[_0x0ab3('0x47')]['id'];var _0x5d31e9=[];return db[_0x0ab3('0x57')]['transaction'](function(_0x9693c1){var _0x56c7a4=_0x0ab3('0x58')+_0x3b7d54;return db[_0x0ab3('0x57')][_0x0ab3('0x33')](_0x56c7a4,{'type':db[_0x0ab3('0x59')]['QueryTypes'][_0x0ab3('0x5a')],'raw':!![],'transaction':_0x9693c1})[_0x0ab3('0x28')](function(_0x2fc6bb){_0x5d31e9=_['map'](_0x2fc6bb,function(_0x28fe12){return Number(_0x28fe12['UserId']);});})['then'](function(){var _0x178517=_0x0ab3('0x5b')+_0x3b7d54;return db['sequelize'][_0x0ab3('0x33')](_0x178517,{'type':db[_0x0ab3('0x59')][_0x0ab3('0x5c')][_0x0ab3('0x5a')],'raw':!![],'transaction':_0x9693c1});})['then'](function(_0x433f1c){var _0x4ef045=_[_0x0ab3('0x2e')](_0x433f1c,function(_0x5912b2){return Number(_0x5912b2['VoiceQueueId']);});return db['UserVoiceQueue']['destroy']({'where':{'UserId':{'$in':_0x5d31e9},'VoiceQueueId':{'$in':_0x4ef045}},'transaction':_0x9693c1});})[_0x0ab3('0x28')](function(){var _0x2c2586=_0x0ab3('0x5d')+_0x3b7d54;return db[_0x0ab3('0x57')][_0x0ab3('0x33')](_0x2c2586,{'type':db[_0x0ab3('0x59')][_0x0ab3('0x5c')]['SELECT'],'raw':!![],'transaction':_0x9693c1});})[_0x0ab3('0x28')](function(_0x4b1fee){var _0x92bd15=_['map'](_0x4b1fee,function(_0x3577a2){return Number(_0x3577a2[_0x0ab3('0x5e')]);});return db[_0x0ab3('0x5f')]['destroy']({'where':{'UserId':{'$in':_0x5d31e9},'MailQueueId':{'$in':_0x92bd15}},'transaction':_0x9693c1});})[_0x0ab3('0x28')](function(){var _0x1bbda3='SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20'+_0x3b7d54;return db['sequelize'][_0x0ab3('0x33')](_0x1bbda3,{'type':db['Sequelize'][_0x0ab3('0x5c')][_0x0ab3('0x5a')],'raw':!![],'transaction':_0x9693c1});})['then'](function(_0x4bf8bc){var _0xbb262d=_[_0x0ab3('0x2e')](_0x4bf8bc,function(_0x57588e){return Number(_0x57588e[_0x0ab3('0x60')]);});return db[_0x0ab3('0x61')][_0x0ab3('0x62')]({'where':{'UserId':{'$in':_0x5d31e9},'SmsQueueId':{'$in':_0xbb262d}},'transaction':_0x9693c1});})[_0x0ab3('0x28')](function(){var _0x2f1453=_0x0ab3('0x63')+_0x3b7d54;return db[_0x0ab3('0x57')][_0x0ab3('0x33')](_0x2f1453,{'type':db[_0x0ab3('0x59')]['QueryTypes'][_0x0ab3('0x5a')],'raw':!![],'transaction':_0x9693c1});})['then'](function(_0x3a027d){var _0xb3d6a6=_[_0x0ab3('0x2e')](_0x3a027d,function(_0x22786b){return Number(_0x22786b['ChatQueueId']);});return db[_0x0ab3('0x64')][_0x0ab3('0x62')]({'where':{'UserId':{'$in':_0x5d31e9},'ChatQueueId':{'$in':_0xb3d6a6}},'transaction':_0x9693c1});})[_0x0ab3('0x28')](function(){var _0x4c10f1=_0x0ab3('0x65')+_0x3b7d54;return db[_0x0ab3('0x57')][_0x0ab3('0x33')](_0x4c10f1,{'type':db[_0x0ab3('0x59')]['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x9693c1});})[_0x0ab3('0x28')](function(_0x2da9ab){var _0x13720a=_['map'](_0x2da9ab,function(_0x214272){return Number(_0x214272[_0x0ab3('0x66')]);});return db[_0x0ab3('0x67')][_0x0ab3('0x62')]({'where':{'UserId':{'$in':_0x5d31e9},'FaxQueueId':{'$in':_0x13720a}},'transaction':_0x9693c1});})[_0x0ab3('0x28')](function(){var _0x4d0170=_0x0ab3('0x68')+_0x3b7d54;return db[_0x0ab3('0x57')][_0x0ab3('0x33')](_0x4d0170,{'type':db['Sequelize'][_0x0ab3('0x5c')]['SELECT'],'raw':!![],'transaction':_0x9693c1});})[_0x0ab3('0x28')](function(_0x2ba4f5){var _0x1d43e7=_[_0x0ab3('0x2e')](_0x2ba4f5,function(_0x575392){return Number(_0x575392[_0x0ab3('0x69')]);});return db[_0x0ab3('0x6a')]['destroy']({'where':{'UserId':{'$in':_0x5d31e9},'OpenchannelQueueId':{'$in':_0x1d43e7}},'transaction':_0x9693c1});})['then'](function(){var _0x4170a0=_0x0ab3('0x6b')+_0x3b7d54;return db[_0x0ab3('0x57')][_0x0ab3('0x33')](_0x4170a0,{'type':db[_0x0ab3('0x59')][_0x0ab3('0x5c')][_0x0ab3('0x5a')],'raw':!![],'transaction':_0x9693c1});})[_0x0ab3('0x28')](function(_0x272889){var _0x2f92e0=_[_0x0ab3('0x2e')](_0x272889,function(_0x4569cb){return Number(_0x4569cb[_0x0ab3('0x6c')]);});return db['UserWhatsappQueue']['destroy']({'where':{'UserId':{'$in':_0x5d31e9},'WhatsappQueueId':{'$in':_0x2f92e0}},'transaction':_0x9693c1});})[_0x0ab3('0x28')](function(){return db[_0x0ab3('0x6d')]['find']({'where':{'TeamId':_0x3b7d54}});})[_0x0ab3('0x28')](function(_0x4e6591){if(_0x4e6591===null){return;}return db['UserVoicePrefix'][_0x0ab3('0x62')]({'where':{'UserId':{'$in':_0x5d31e9},'VoicePrefixId':_0x4e6591[_0x0ab3('0x6e')]},'transaction':_0x9693c1});})['then'](function(){return db[_0x0ab3('0x2f')][_0x0ab3('0x62')]({'where':{'id':_0x3b7d54},'cascade':!![],'transaction':_0x9693c1});})[_0x0ab3('0x28')](function(_0x43c45d){if(_0x43c45d===0x0){_0x154efa[_0x0ab3('0x1e')](0x194);}else{return db[_0x0ab3('0x55')][_0x0ab3('0x62')]({'where':{'type':'Teams','resourceId':_0x3b7d54},'cascade':!![],'transaction':_0x9693c1})[_0x0ab3('0x28')](function(){_0x154efa[_0x0ab3('0x1f')](0xcc)['end']();});}})[_0x0ab3('0x45')](function(_0x56dfba){_0x154efa[_0x0ab3('0x1f')](0x1f4)[_0x0ab3('0x2c')](_0x56dfba);});});};exports[_0x0ab3('0x6f')]=function(_0x39b0a0,_0x49081c,_0x848968){return db[_0x0ab3('0x2f')]['findOne']({'where':{'id':_0x39b0a0[_0x0ab3('0x47')]['id']}})['then'](handleEntityNotFound(_0x49081c,null))[_0x0ab3('0x28')](function(_0x57453b){if(!_0x39b0a0[_0x0ab3('0x33')][_0x0ab3('0x70')]||!utils[_0x0ab3('0x71')](_0x39b0a0['query'][_0x0ab3('0x70')])){throw new db[(_0x0ab3('0x59'))]['ValidationError'](_0x0ab3('0x72'));}var _0xb93f27={};var _0x2901a7={};_0x2901a7[_0x0ab3('0x32')]=_[_0x0ab3('0x49')](db[_[_0x0ab3('0x73')](_0x39b0a0['query']['channel'][_0x0ab3('0x74')]())+'Queue']['rawAttributes']);_0x2901a7['query']=_[_0x0ab3('0x49')](_0x39b0a0[_0x0ab3('0x33')]);_0x2901a7['filters']=_['intersection'](_0x2901a7[_0x0ab3('0x32')],_0x2901a7['query']);_0xb93f27[_0x0ab3('0x37')]=_[_0x0ab3('0x35')](_0x2901a7[_0x0ab3('0x32')],qs[_0x0ab3('0x36')](_0x39b0a0[_0x0ab3('0x33')]['fields']));_0xb93f27[_0x0ab3('0x37')]=_0xb93f27['attributes'][_0x0ab3('0x4a')]?_0xb93f27[_0x0ab3('0x37')]:_0x2901a7[_0x0ab3('0x32')];_0xb93f27[_0x0ab3('0x23')]=qs[_0x0ab3('0x23')](_0x39b0a0[_0x0ab3('0x33')][_0x0ab3('0x23')]);_0xb93f27[_0x0ab3('0x24')]=qs[_0x0ab3('0x24')](_0x39b0a0[_0x0ab3('0x33')][_0x0ab3('0x24')]);_0xb93f27[_0x0ab3('0x39')]=qs[_0x0ab3('0x3a')](_0x39b0a0[_0x0ab3('0x33')]['sort']);_0xb93f27['where']=qs[_0x0ab3('0x34')](_[_0x0ab3('0x75')](_0x39b0a0['query'],_0x2901a7['filters']));_0xb93f27=_[_0x0ab3('0x3d')]({},_0xb93f27,_0x39b0a0[_0x0ab3('0x3f')]);return _0x57453b[_0x0ab3('0x4e')+_[_0x0ab3('0x73')](_0x39b0a0[_0x0ab3('0x33')][_0x0ab3('0x70')][_0x0ab3('0x74')]())+'Queues'](_0xb93f27);})[_0x0ab3('0x28')](respondWithResult(_0x49081c,null))[_0x0ab3('0x45')](handleError(_0x49081c,null));};exports[_0x0ab3('0x76')]=function(_0x2d6984,_0x8b4c61,_0x4f61b0){return db['Team'][_0x0ab3('0x77')]({'where':{'id':_0x2d6984[_0x0ab3('0x47')]['id']}})[_0x0ab3('0x28')](function(_0x14150c){if(_0x14150c){if(!_0x2d6984[_0x0ab3('0x4d')][_0x0ab3('0x70')]||!utils[_0x0ab3('0x71')](_0x2d6984[_0x0ab3('0x4d')][_0x0ab3('0x70')])){throw new db[(_0x0ab3('0x59'))]['ValidationError']('Unknown\x20channel');}return _0x14150c['add'+_['capitalize'](_0x2d6984[_0x0ab3('0x4d')][_0x0ab3('0x70')][_0x0ab3('0x74')]())+_0x0ab3('0x78')](_0x2d6984[_0x0ab3('0x4d')]['ids']);}return null;})[_0x0ab3('0x28')](handleEntityNotFound(_0x8b4c61,null))[_0x0ab3('0x28')](respondWithStatusCode(_0x8b4c61,null))[_0x0ab3('0x45')](handleError(_0x8b4c61,null));};exports[_0x0ab3('0x79')]=function(_0x4b1907,_0x2a6948,_0x1c8740){return db[_0x0ab3('0x2f')][_0x0ab3('0x77')]({'where':{'id':_0x4b1907[_0x0ab3('0x47')]['id']}})[_0x0ab3('0x28')](function(_0x16944f){if(_0x16944f){if(!_0x4b1907[_0x0ab3('0x33')][_0x0ab3('0x70')]||!utils[_0x0ab3('0x71')](_0x4b1907[_0x0ab3('0x33')][_0x0ab3('0x70')])){throw new db[(_0x0ab3('0x59'))][(_0x0ab3('0x7a'))](_0x0ab3('0x72'));}return _0x16944f[_0x0ab3('0x7b')+_[_0x0ab3('0x73')](_0x4b1907[_0x0ab3('0x33')][_0x0ab3('0x70')][_0x0ab3('0x74')]())+'Queues'](_0x4b1907[_0x0ab3('0x33')]['ids']);}return null;})[_0x0ab3('0x28')](handleEntityNotFound(_0x2a6948,null))[_0x0ab3('0x28')](respondWithStatusCode(_0x2a6948,null))[_0x0ab3('0x45')](handleError(_0x2a6948,null));};exports[_0x0ab3('0x7c')]=function(_0x51b4e2,_0x27d224){var _0x59172f=_[_0x0ab3('0x7d')](_0x51b4e2[_0x0ab3('0x4d')][_0x0ab3('0x7e')])?_0x51b4e2[_0x0ab3('0x4d')][_0x0ab3('0x7e')]:[_0x51b4e2[_0x0ab3('0x4d')]['ids']];var _0x2b11e9=_0x51b4e2[_0x0ab3('0x47')]['id'];return db[_0x0ab3('0x2f')]['find']({'where':{'id':_0x2b11e9}})['then'](handleEntityNotFound(_0x27d224,null))['then'](function(_0x405cc0){if(_0x405cc0){var _0x1da661=['Voice',_0x0ab3('0x7f'),_0x0ab3('0x80'),_0x0ab3('0x81'),_0x0ab3('0x82'),_0x0ab3('0x83'),_0x0ab3('0x84')];return db[_0x0ab3('0x57')][_0x0ab3('0x85')](function(_0x25bd50){var _0x1ba0d2=_[_0x0ab3('0x2e')](_0x1da661,function(_0x2b4b70){var _0x384908={'attributes':['id','name']};if(_0x2b4b70===_0x0ab3('0x86')){_0x384908[_0x0ab3('0x87')]={'attributes':[_0x0ab3('0x88')]};}return _0x405cc0['get'+_0x2b4b70+_0x0ab3('0x78')](_0x384908)[_0x0ab3('0x28')](function(_0x1cecee){var _0x2f26ee=_[_0x0ab3('0x2e')](_0x1cecee,function(_0x47a782){var _0x2e9089=_['map'](_0x59172f,function(_0x5bb894){var _0x1c8901={'where':{'UserId':_0x5bb894,[_0x2b4b70+_0x0ab3('0x89')]:_0x47a782['id']},'transaction':_0x25bd50};if(_0x2b4b70===_0x0ab3('0x86')){_0x1c8901[_0x0ab3('0x1a')]={'penalty':_0x47a782[_0x0ab3('0x8a')]['penalty']};}return db[_0x0ab3('0x8b')+_0x2b4b70+_0x0ab3('0x8c')]['findOrCreate'](_0x1c8901)[_0x0ab3('0x28')](function(){socket['emit'](_0x0ab3('0x51')+_0x2b4b70+_0x0ab3('0x8d'),{'UserId':_0x5bb894,[_0x2b4b70+'QueueId']:_0x47a782['id']});if(_0x2b4b70!=='Voice'){return;}return db['User']['findAll']({'where':{'id':_0x59172f,'online':0x1},'attributes':['id',_0x0ab3('0x2b'),_0x0ab3('0x8e'),_0x0ab3('0x8f'),'interface'],'raw':!![]})['then'](function(_0x32e2b6){var _0x65ec39=_[_0x0ab3('0x2e')](_0x32e2b6,function(_0x3ed511){return db[_0x0ab3('0x90')]['upsert']({'membername':_0x3ed511[_0x0ab3('0x2b')],'UserId':_0x3ed511['id'],'queue_name':_0x47a782[_0x0ab3('0x2b')],'VoiceQueueId':_0x47a782['id'],'interface':_[_0x0ab3('0x91')](_0x3ed511[_0x0ab3('0x92')])?util[_0x0ab3('0x93')](_0x0ab3('0x94'),_0x3ed511[_0x0ab3('0x2b')]):_0x3ed511[_0x0ab3('0x92')],'paused':_0x3ed511[_0x0ab3('0x8f')]||![],'penalty':_0x47a782['TeamVoiceQueue']['penalty']},{'transaction':_0x25bd50});});return Promise[_0x0ab3('0x95')](_0x65ec39);});});});return Promise[_0x0ab3('0x95')](_0x2e9089);});return Promise[_0x0ab3('0x95')](_0x2f26ee);})[_0x0ab3('0x28')](function(){return db[_0x0ab3('0x6d')][_0x0ab3('0x77')]({'where':{'teamId':_0x2b11e9}})[_0x0ab3('0x28')](function(_0x3c860c){if(_0x3c860c){var _0x3ea9f1=_[_0x0ab3('0x2e')](_0x59172f,function(_0x356fb7){db[_0x0ab3('0x96')][_0x0ab3('0x97')]({'UserId':_0x356fb7,'VoicePrefixId':_0x3c860c[_0x0ab3('0x6e')]});});return Promise[_0x0ab3('0x95')](_0x3ea9f1);}});});});return Promise['all'](_0x1ba0d2)['then'](function(){return _0x405cc0[_0x0ab3('0x7c')](_0x59172f,{'transaction':_0x25bd50})['spread'](function(_0x554003){return _0x554003;});});});}})['then'](respondWithResult(_0x27d224,null))[_0x0ab3('0x45')](handleError(_0x27d224,null));};exports[_0x0ab3('0x98')]=function(_0x1e8f6f,_0x3073dc){var _0x57d02a=_[_0x0ab3('0x7d')](_0x1e8f6f['query'][_0x0ab3('0x7e')])?_0x1e8f6f[_0x0ab3('0x33')][_0x0ab3('0x7e')]:[_0x1e8f6f[_0x0ab3('0x33')][_0x0ab3('0x7e')]];var _0x3c8a5b=_0x1e8f6f[_0x0ab3('0x47')]['id'];return db[_0x0ab3('0x2f')][_0x0ab3('0x4b')]({'where':{'id':_0x3c8a5b}})[_0x0ab3('0x28')](handleEntityNotFound(_0x3073dc,null))['then'](function(_0x4080e7){if(_0x4080e7){var _0x2af2c3=['Voice',_0x0ab3('0x7f'),_0x0ab3('0x80'),_0x0ab3('0x81'),_0x0ab3('0x82'),'Openchannel',_0x0ab3('0x84')];return db['sequelize']['transaction'](function(_0x390f0a){var _0x498cdb=_['map'](_0x2af2c3,function(_0x24b56d){var _0x2d06f7={'attributes':['id','name']};return _0x4080e7[_0x0ab3('0x4e')+_0x24b56d+'Queues'](_0x2d06f7)[_0x0ab3('0x28')](function(_0x47af14){var _0x14a730=_[_0x0ab3('0x2e')](_0x47af14,function(_0x5f3f82){return _0x5f3f82[_0x0ab3('0x98')](_0x57d02a,{'transaction':_0x390f0a})[_0x0ab3('0x28')](function(){var _0x2ebb81=_[_0x0ab3('0x2e')](_0x57d02a,function(_0x54e8fb){socket['emit'](_0x0ab3('0x51')+_0x24b56d+_0x0ab3('0x99'),{'UserId':Number(_0x54e8fb),[_0x24b56d+_0x0ab3('0x89')]:_0x5f3f82['id']});if(_0x24b56d!==_0x0ab3('0x86')){return;}return db[_0x0ab3('0x90')]['destroy']({'where':{'VoiceQueueId':_0x5f3f82['id'],'UserId':_0x54e8fb},'transaction':_0x390f0a});});return Promise[_0x0ab3('0x95')](_0x2ebb81);});});return Promise[_0x0ab3('0x95')](_0x14a730);});});return Promise[_0x0ab3('0x95')](_0x498cdb)[_0x0ab3('0x28')](function(){return _0x4080e7[_0x0ab3('0x98')](_0x57d02a,{'transaction':_0x390f0a});})['then'](function(){return db[_0x0ab3('0x6d')][_0x0ab3('0x77')]({'where':{'teamId':_0x3c8a5b}})[_0x0ab3('0x28')](function(_0x402e7a){if(_0x402e7a){var _0x2535e4=_[_0x0ab3('0x2e')](_0x57d02a,function(_0x348ab7){db[_0x0ab3('0x96')][_0x0ab3('0x62')]({'where':{'UserId':_0x348ab7,'VoicePrefixId':_0x402e7a['VoicePrefixId']}});});return Promise['all'](_0x2535e4);}});});});}})[_0x0ab3('0x28')](respondWithStatusCode(_0x3073dc,null))['catch'](handleError(_0x3073dc,null));};exports[_0x0ab3('0x9a')]=function(_0x2eb986,_0x25d88b,_0x4ce857){var _0x18cbca={};var _0x227115={};var _0x12f9ab;var _0x3b829d;return db[_0x0ab3('0x2f')]['findOne']({'where':{'id':_0x2eb986['params']['id']}})[_0x0ab3('0x28')](handleEntityNotFound(_0x25d88b,null))[_0x0ab3('0x28')](function(_0x20f82e){if(_0x20f82e){_0x12f9ab=_0x20f82e;_0x227115[_0x0ab3('0x32')]=_[_0x0ab3('0x49')](db[_0x0ab3('0x8b')]['rawAttributes']);_0x227115[_0x0ab3('0x33')]=_[_0x0ab3('0x49')](_0x2eb986[_0x0ab3('0x33')]);_0x227115[_0x0ab3('0x34')]=_['intersection'](_0x227115['model'],_0x227115[_0x0ab3('0x33')]);_0x18cbca[_0x0ab3('0x37')]=_[_0x0ab3('0x35')](_0x227115[_0x0ab3('0x32')],qs['fields'](_0x2eb986['query'][_0x0ab3('0x36')]));_0x18cbca[_0x0ab3('0x37')]=_0x18cbca[_0x0ab3('0x37')]['length']?_0x18cbca[_0x0ab3('0x37')]:_0x227115[_0x0ab3('0x32')];_0x18cbca[_0x0ab3('0x39')]=qs[_0x0ab3('0x3a')](_0x2eb986[_0x0ab3('0x33')][_0x0ab3('0x3a')]);_0x18cbca[_0x0ab3('0x3b')]=qs[_0x0ab3('0x34')](_['pick'](_0x2eb986[_0x0ab3('0x33')],_0x227115[_0x0ab3('0x34')]));if(_0x2eb986[_0x0ab3('0x33')]['filter']){_0x18cbca[_0x0ab3('0x3b')]=_[_0x0ab3('0x3d')](_0x18cbca[_0x0ab3('0x3b')],{'$or':_[_0x0ab3('0x2e')](_0x18cbca[_0x0ab3('0x37')],function(_0x41caf0){var _0x13c0f0={};_0x13c0f0[_0x41caf0]={'$like':'%'+_0x2eb986[_0x0ab3('0x33')]['filter']+'%'};return _0x13c0f0;})});}_0x18cbca=_[_0x0ab3('0x3d')]({},_0x18cbca,_0x2eb986[_0x0ab3('0x3f')]);return _0x12f9ab[_0x0ab3('0x9a')](_0x18cbca);}})[_0x0ab3('0x28')](function(_0x539a75){if(_0x539a75){_0x3b829d=_0x539a75[_0x0ab3('0x4a')];if(!_0x2eb986['query'][_0x0ab3('0x9b')](_0x0ab3('0x38'))){_0x18cbca['limit']=qs[_0x0ab3('0x23')](_0x2eb986[_0x0ab3('0x33')][_0x0ab3('0x23')]);_0x18cbca[_0x0ab3('0x24')]=qs['offset'](_0x2eb986[_0x0ab3('0x33')][_0x0ab3('0x24')]);}return _0x12f9ab['getAgents'](_0x18cbca);}})[_0x0ab3('0x28')](function(_0x1c36cc){if(_0x1c36cc){return _0x1c36cc?{'count':_0x3b829d,'rows':_0x1c36cc}:null;}})[_0x0ab3('0x28')](respondWithResult(_0x25d88b,null))[_0x0ab3('0x45')](handleError(_0x25d88b,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index e4ffc13..7c7aa54 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 _0xe3b2=['Team','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0xa56e40,_0x3b594a){var _0x361f56=function(_0x32edce){while(--_0x32edce){_0xa56e40['push'](_0xa56e40['shift']());}};_0x361f56(++_0x3b594a);}(_0xe3b2,0x1ae));var _0x2e3b=function(_0x5f4ce2,_0x42c469){_0x5f4ce2=_0x5f4ce2-0x0;var _0x219b5b=_0xe3b2[_0x5f4ce2];return _0x219b5b;};'use strict';var EventEmitter=require(_0x2e3b('0x0'));var Team=require(_0x2e3b('0x1'))['db'][_0x2e3b('0x2')];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x2e3b('0x3'),'afterDestroy':_0x2e3b('0x4')};function emitEvent(_0x53e444){return function(_0x32759c,_0x4f7e7e,_0x2ff40d){TeamEvents['emit'](_0x53e444+':'+_0x32759c['id'],_0x32759c);TeamEvents[_0x2e3b('0x5')](_0x53e444,_0x32759c);_0x2ff40d(null);};}for(var e in events){if(events[_0x2e3b('0x6')](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module[_0x2e3b('0x7')]=TeamEvents; \ No newline at end of file +var _0x0f6d=['Team','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events'];(function(_0x11c4fa,_0x3d68f0){var _0x12e9aa=function(_0x417aa1){while(--_0x417aa1){_0x11c4fa['push'](_0x11c4fa['shift']());}};_0x12e9aa(++_0x3d68f0);}(_0x0f6d,0x182));var _0xd0f6=function(_0x5f1cf8,_0x5e0923){_0x5f1cf8=_0x5f1cf8-0x0;var _0x27d0fa=_0x0f6d[_0x5f1cf8];return _0x27d0fa;};'use strict';var EventEmitter=require(_0xd0f6('0x0'));var Team=require('../../mysqldb')['db'][_0xd0f6('0x1')];var TeamEvents=new EventEmitter();TeamEvents[_0xd0f6('0x2')](0x0);var events={'afterCreate':_0xd0f6('0x3'),'afterUpdate':_0xd0f6('0x4'),'afterDestroy':_0xd0f6('0x5')};function emitEvent(_0xc7a282){return function(_0x280457,_0x3bbffe,_0x4c73dc){TeamEvents[_0xd0f6('0x6')](_0xc7a282+':'+_0x280457['id'],_0x280457);TeamEvents['emit'](_0xc7a282,_0x280457);_0x4c73dc(null);};}for(var e in events){if(events[_0xd0f6('0x7')](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module[_0xd0f6('0x8')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 6993d98..7629608 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 _0x3533=['Whatsapp','resolve','all','lodash','get','map','setDataValue','channel','exports','define','Team','teams','Chat','Fax','Mail','Openchannel','Sms','Voice'];(function(_0x3a6922,_0xc728be){var _0x9c1b44=function(_0x4ffb5e){while(--_0x4ffb5e){_0x3a6922['push'](_0x3a6922['shift']());}};_0x9c1b44(++_0xc728be);}(_0x3533,0xdb));var _0x3353=function(_0xd0c7bf,_0xb7f4ef){_0xd0c7bf=_0xd0c7bf-0x0;var _0x2bc558=_0x3533[_0xd0c7bf];return _0x2bc558;};'use strict';var _=require(_0x3353('0x0'));var attributes=require('./team.attributes');function getQueuesByChannel(_0x1656da,_0x12a256){var _0x5d0866=_0x3353('0x1')+_0x12a256+'Queues';return _0x1656da[_0x5d0866]()['then'](function(_0x2ff01e){return _[_0x3353('0x2')](_0x2ff01e,function(_0x58b02b){_0x58b02b[_0x3353('0x3')](_0x3353('0x4'),_0x12a256);return _0x58b02b;});})['catch'](function(_0x5de4d1){throw _0x5de4d1;});}module[_0x3353('0x5')]=function(_0x3c7c10){return _0x3c7c10[_0x3353('0x6')](_0x3353('0x7'),attributes,{'tableName':_0x3353('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x5127a9=this;var _0x528afe=[_0x3353('0x9'),_0x3353('0xa'),_0x3353('0xb'),_0x3353('0xc'),_0x3353('0xd'),_0x3353('0xe'),_0x3353('0xf')];return Promise[_0x3353('0x10')]()['then'](function(){var _0x1c9c91=_[_0x3353('0x2')](_0x528afe,function(_0x55afb9){return getQueuesByChannel(_0x5127a9,_0x55afb9);});return Promise[_0x3353('0x11')](_0x1c9c91);})['catch'](function(_0x21f679){throw _0x21f679;});}}});}; \ No newline at end of file +var _0x70fb=['lodash','then','exports','Team','teams','Mail','Sms','Whatsapp','resolve','map','all'];(function(_0x5d1fb1,_0x38fc17){var _0x243ca5=function(_0x406242){while(--_0x406242){_0x5d1fb1['push'](_0x5d1fb1['shift']());}};_0x243ca5(++_0x38fc17);}(_0x70fb,0x197));var _0xb70f=function(_0x4ec7f2,_0x3d92d2){_0x4ec7f2=_0x4ec7f2-0x0;var _0x118004=_0x70fb[_0x4ec7f2];return _0x118004;};'use strict';var _=require(_0xb70f('0x0'));var attributes=require('./team.attributes');function getQueuesByChannel(_0x166c6a,_0x5bd2cf){var _0x1f5f0b='get'+_0x5bd2cf+'Queues';return _0x166c6a[_0x1f5f0b]()[_0xb70f('0x1')](function(_0x323f7e){return _['map'](_0x323f7e,function(_0x16761c){_0x16761c['setDataValue']('channel',_0x5bd2cf);return _0x16761c;});})['catch'](function(_0x500f3e){throw _0x500f3e;});}module[_0xb70f('0x2')]=function(_0xf2f7ab){return _0xf2f7ab['define'](_0xb70f('0x3'),attributes,{'tableName':_0xb70f('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x3c3c51=this;var _0x1e87d1=['Chat','Fax',_0xb70f('0x5'),'Openchannel',_0xb70f('0x6'),'Voice',_0xb70f('0x7')];return Promise[_0xb70f('0x8')]()[_0xb70f('0x1')](function(){var _0x7ef30f=_[_0xb70f('0x9')](_0x1e87d1,function(_0x212a24){return getQueuesByChannel(_0x3c3c51,_0x212a24);});return Promise[_0xb70f('0xa')](_0x7ef30f);})['catch'](function(_0x39f22e){throw _0x39f22e;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 3bc3bfc..3a50aeb 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 _0x7a36=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./team.socket','request','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','util','moment'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x7a36,0xce));var _0x67a3=function(_0x3666c2,_0x8467fe){_0x3666c2=_0x3666c2-0x0;var _0x14700f=_0x7a36[_0x3666c2];return _0x14700f;};'use strict';var _=require('lodash');var util=require(_0x67a3('0x0'));var moment=require(_0x67a3('0x1'));var BPromise=require(_0x67a3('0x2'));var rs=require(_0x67a3('0x3'));var fs=require('fs');var Redis=require(_0x67a3('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x67a3('0x5'));var logger=require(_0x67a3('0x6'))(_0x67a3('0x7'));var config=require(_0x67a3('0x8'));var jayson=require(_0x67a3('0x9'));var client=jayson[_0x67a3('0xa')]['http']({'port':0x232a});config[_0x67a3('0xb')]=_[_0x67a3('0xc')](config[_0x67a3('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x67a3('0xd'))(new Redis(config['redis']));require(_0x67a3('0xe'))['register'](socket);function respondWithRpcPromise(_0x4d75a7,_0x110f92,_0xd1827d){return new BPromise(function(_0x11801f,_0xfacdcb){return client[_0x67a3('0xf')](_0x4d75a7,_0xd1827d)['then'](function(_0x5e81e4){logger['info'](_0x67a3('0x10'),_0x110f92,_0x67a3('0x11'));logger[_0x67a3('0x12')](_0x67a3('0x13'),_0x110f92,_0x67a3('0x11'),JSON['stringify'](_0x5e81e4));if(_0x5e81e4[_0x67a3('0x14')]){if(_0x5e81e4[_0x67a3('0x14')][_0x67a3('0x15')]===0x1f4){logger[_0x67a3('0x14')](_0x67a3('0x10'),_0x110f92,_0x5e81e4[_0x67a3('0x14')]['message']);return _0xfacdcb(_0x5e81e4['error'][_0x67a3('0x16')]);}logger[_0x67a3('0x14')](_0x67a3('0x10'),_0x110f92,_0x5e81e4[_0x67a3('0x14')][_0x67a3('0x16')]);return _0x11801f(_0x5e81e4[_0x67a3('0x14')]['message']);}else{logger[_0x67a3('0x17')]('Team,\x20%s,\x20%s',_0x110f92,_0x67a3('0x11'));_0x11801f(_0x5e81e4[_0x67a3('0x18')][_0x67a3('0x16')]);}})[_0x67a3('0x19')](function(_0x4696aa){logger[_0x67a3('0x14')](_0x67a3('0x10'),_0x110f92,_0x4696aa);_0xfacdcb(_0x4696aa);});});} \ No newline at end of file +var _0x5756=['socket.io-emitter','redis','register','then','request\x20sent','debug','stringify','error','code','message','info','result','Team,\x20%s,\x20%s','lodash','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','defaults'];(function(_0x44d81a,_0x46f7a5){var _0x1b01cc=function(_0x5c3375){while(--_0x5c3375){_0x44d81a['push'](_0x44d81a['shift']());}};_0x1b01cc(++_0x46f7a5);}(_0x5756,0xdc));var _0x6575=function(_0x365eff,_0x40f55c){_0x365eff=_0x365eff-0x0;var _0x2bf075=_0x5756[_0x365eff];return _0x2bf075;};'use strict';var _=require(_0x6575('0x0'));var util=require('util');var moment=require(_0x6575('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6575('0x2'));var db=require(_0x6575('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x6575('0x4'))(_0x6575('0x5'));var config=require(_0x6575('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x6575('0x7')][_0x6575('0x8')]({'port':0x232a});config['redis']=_[_0x6575('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x6575('0xa'))(new Redis(config[_0x6575('0xb')]));require('./team.socket')[_0x6575('0xc')](socket);function respondWithRpcPromise(_0x5730e2,_0x533c94,_0x255f57){return new BPromise(function(_0x2649df,_0xd50bec){return client['request'](_0x5730e2,_0x255f57)[_0x6575('0xd')](function(_0x4b865c){logger['info']('Team,\x20%s,\x20%s',_0x533c94,_0x6575('0xe'));logger[_0x6575('0xf')]('Team,\x20%s,\x20%s,\x20%s',_0x533c94,_0x6575('0xe'),JSON[_0x6575('0x10')](_0x4b865c));if(_0x4b865c['error']){if(_0x4b865c[_0x6575('0x11')][_0x6575('0x12')]===0x1f4){logger['error']('Team,\x20%s,\x20%s',_0x533c94,_0x4b865c['error'][_0x6575('0x13')]);return _0xd50bec(_0x4b865c[_0x6575('0x11')][_0x6575('0x13')]);}logger['error']('Team,\x20%s,\x20%s',_0x533c94,_0x4b865c[_0x6575('0x11')]['message']);return _0x2649df(_0x4b865c['error']['message']);}else{logger[_0x6575('0x14')]('Team,\x20%s,\x20%s',_0x533c94,_0x6575('0xe'));_0x2649df(_0x4b865c[_0x6575('0x15')][_0x6575('0x13')]);}})['catch'](function(_0x224f8f){logger[_0x6575('0x11')](_0x6575('0x16'),_0x533c94,_0x224f8f);_0xd50bec(_0x224f8f);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index f73156f..504f74a 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 _0xd2e3=['register','team:','./team.events','save','remove','update','emit','removeListener'];(function(_0x4417c5,_0x597821){var _0x5376a4=function(_0x40ff33){while(--_0x40ff33){_0x4417c5['push'](_0x4417c5['shift']());}};_0x5376a4(++_0x597821);}(_0xd2e3,0x10a));var _0x3d2e=function(_0x3070af,_0x268826){_0x3070af=_0x3070af-0x0;var _0x5be773=_0xd2e3[_0x3070af];return _0x5be773;};'use strict';var TeamEvents=require(_0x3d2e('0x0'));var events=[_0x3d2e('0x1'),_0x3d2e('0x2'),_0x3d2e('0x3')];function createListener(_0x5bf326,_0x33d073){return function(_0x4eabf8){_0x33d073[_0x3d2e('0x4')](_0x5bf326,_0x4eabf8);};}function removeListener(_0x4468e2,_0x3c34a6){return function(){TeamEvents[_0x3d2e('0x5')](_0x4468e2,_0x3c34a6);};}exports[_0x3d2e('0x6')]=function(_0x1d74f9){for(var _0x10ec04=0x0,_0x5588e5=events['length'];_0x10ec04<_0x5588e5;_0x10ec04++){var _0x3c6af4=events[_0x10ec04];var _0x5e3cd3=createListener(_0x3d2e('0x7')+_0x3c6af4,_0x1d74f9);TeamEvents['on'](_0x3c6af4,_0x5e3cd3);}}; \ No newline at end of file +var _0x9703=['register','length','team:','remove','update','removeListener'];(function(_0x34fd8c,_0x315ec6){var _0x512ba0=function(_0x49cc25){while(--_0x49cc25){_0x34fd8c['push'](_0x34fd8c['shift']());}};_0x512ba0(++_0x315ec6);}(_0x9703,0xdb));var _0x3970=function(_0x29b564,_0x2d95bd){_0x29b564=_0x29b564-0x0;var _0xae0676=_0x9703[_0x29b564];return _0xae0676;};'use strict';var TeamEvents=require('./team.events');var events=['save',_0x3970('0x0'),_0x3970('0x1')];function createListener(_0x3ed006,_0x58168c){return function(_0x1fb9af){_0x58168c['emit'](_0x3ed006,_0x1fb9af);};}function removeListener(_0x2312a5,_0x5edd50){return function(){TeamEvents[_0x3970('0x2')](_0x2312a5,_0x5edd50);};}exports[_0x3970('0x3')]=function(_0x5cdfda){for(var _0x5669ec=0x0,_0x21986b=events[_0x3970('0x4')];_0x5669ec<_0x21986b;_0x5669ec++){var _0x282355=events[_0x5669ec];var _0x41d4d1=createListener(_0x3970('0x5')+_0x282355,_0x5cdfda);TeamEvents['on'](_0x282355,_0x41d4d1);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 139384f..4c2fdc8 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 _0xa446=['sequelize','exports','INTEGER'];(function(_0x196a6f,_0x348ee1){var _0x41e47c=function(_0x4d4c3b){while(--_0x4d4c3b){_0x196a6f['push'](_0x196a6f['shift']());}};_0x41e47c(++_0x348ee1);}(_0xa446,0xc6));var _0x6a44=function(_0x2414c3,_0x58983f){_0x2414c3=_0x2414c3-0x0;var _0x5951fc=_0xa446[_0x2414c3];return _0x5951fc;};'use strict';var Sequelize=require(_0x6a44('0x0'));module[_0x6a44('0x1')]={'TeamId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0x6a44('0x2')]}}; \ No newline at end of file +var _0x03bc=['sequelize','INTEGER'];(function(_0x2ec23a,_0xeda41){var _0x108a11=function(_0x56d905){while(--_0x56d905){_0x2ec23a['push'](_0x2ec23a['shift']());}};_0x108a11(++_0xeda41);}(_0x03bc,0xb8));var _0xc03b=function(_0x45b131,_0x1bcbd2){_0x45b131=_0x45b131-0x0;var _0x54d307=_0x03bc[_0x45b131];return _0x54d307;};'use strict';var Sequelize=require(_0xc03b('0x0'));module['exports']={'TeamId':{'type':Sequelize[_0xc03b('0x1')]},'VoicePrefixId':{'type':Sequelize[_0xc03b('0x1')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index 86dd532..ea326db 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 _0x78e2=['request-promise','rimraf','../../config/environment','./teamVoicePrefix.attributes','exports','define','TeamVoicePrefix','team_has_voice_prefixes','lodash','util','../../config/logger','api','moment'];(function(_0x131bf1,_0x1f0959){var _0x1df658=function(_0x1ba0a0){while(--_0x1ba0a0){_0x131bf1['push'](_0x131bf1['shift']());}};_0x1df658(++_0x1f0959);}(_0x78e2,0x1a8));var _0x278e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x78e2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x278e('0x0'));var util=require(_0x278e('0x1'));var logger=require(_0x278e('0x2'))(_0x278e('0x3'));var moment=require(_0x278e('0x4'));var BPromise=require('bluebird');var rp=require(_0x278e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x278e('0x6'));var config=require(_0x278e('0x7'));var attributes=require(_0x278e('0x8'));module[_0x278e('0x9')]=function(_0x221b65,_0xc1a9b8){return _0x221b65[_0x278e('0xa')](_0x278e('0xb'),attributes,{'tableName':_0x278e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5269=['lodash','bluebird','request-promise','path','./teamVoicePrefix.attributes','define','TeamVoicePrefix','team_has_voice_prefixes'];(function(_0x5cf295,_0x5ecf49){var _0x353098=function(_0x2c45e7){while(--_0x2c45e7){_0x5cf295['push'](_0x5cf295['shift']());}};_0x353098(++_0x5ecf49);}(_0x5269,0x150));var _0x9526=function(_0x4d1d72,_0x2f77d8){_0x4d1d72=_0x4d1d72-0x0;var _0x455123=_0x5269[_0x4d1d72];return _0x455123;};'use strict';var _=require(_0x9526('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x9526('0x1'));var rp=require(_0x9526('0x2'));var fs=require('fs');var path=require(_0x9526('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x9526('0x4'));module['exports']=function(_0x15d394,_0x9cf5eb){return _0x15d394[_0x9526('0x5')](_0x9526('0x6'),attributes,{'tableName':_0x9526('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index 675dcf7..2c544d8 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x84ce4d,_0x24c6d7){var _0x327d33=function(_0x5748f9){while(--_0x5748f9){_0x84ce4d['push'](_0x84ce4d['shift']());}};_0x327d33(++_0x24c6d7);}(_0x9c44,0x178));var _0x49c4=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x9c44[_0x16b9ed];return _0x66b1f8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x41425c,_0x559f66){var _0x49a245=function(_0x22d187){while(--_0x22d187){_0x41425c['push'](_0x41425c['shift']());}};_0x49a245(++_0x559f66);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x80f51a,_0x32e95e){_0x80f51a=_0x80f51a-0x0;var _0x327148=_0xcb91[_0x80f51a];return _0x327148;};'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 4e44cad..05130f6 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 _0x1bc2=['exports','INTEGER'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1bc2,0x1e8));var _0x21bc=function(_0x21a9ae,_0x354716){_0x21a9ae=_0x21a9ae-0x0;var _0x41da4a=_0x1bc2[_0x21a9ae];return _0x41da4a;};'use strict';var Sequelize=require('sequelize');module[_0x21bc('0x0')]={'penalty':{'type':Sequelize[_0x21bc('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x3b78=['exports','INTEGER','sequelize'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x3b78,0xaa));var _0x83b7=function(_0x421b7b,_0x566ee9){_0x421b7b=_0x421b7b-0x0;var _0x2c472c=_0x3b78[_0x421b7b];return _0x2c472c;};'use strict';var Sequelize=require(_0x83b7('0x0'));module[_0x83b7('0x1')]={'penalty':{'type':Sequelize[_0x83b7('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 aa5851a..562832c 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 _0x1b73=['../../config/logger','api','moment','request-promise','rimraf','../../config/environment','exports','TeamVoiceQueue','team_has_voice_queues','util'];(function(_0x34df29,_0x2eb175){var _0x4cff66=function(_0x379d68){while(--_0x379d68){_0x34df29['push'](_0x34df29['shift']());}};_0x4cff66(++_0x2eb175);}(_0x1b73,0x1d5));var _0x31b7=function(_0x388863,_0x2b9b00){_0x388863=_0x388863-0x0;var _0x4f5c70=_0x1b73[_0x388863];return _0x4f5c70;};'use strict';var _=require('lodash');var util=require(_0x31b7('0x0'));var logger=require(_0x31b7('0x1'))(_0x31b7('0x2'));var moment=require(_0x31b7('0x3'));var BPromise=require('bluebird');var rp=require(_0x31b7('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x31b7('0x5'));var config=require(_0x31b7('0x6'));var attributes=require('./teamVoiceQueue.attributes');module[_0x31b7('0x7')]=function(_0x3d058f,_0x15c31e){return _0x3d058f['define'](_0x31b7('0x8'),attributes,{'tableName':_0x31b7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeb5d=['util','../../config/logger','api','moment','path','rimraf','./teamVoiceQueue.attributes','exports','define','TeamVoiceQueue','team_has_voice_queues'];(function(_0xd34f49,_0x5aad69){var _0x498d6c=function(_0x6c3e51){while(--_0x6c3e51){_0xd34f49['push'](_0xd34f49['shift']());}};_0x498d6c(++_0x5aad69);}(_0xeb5d,0x16b));var _0xdeb5=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0xeb5d[_0x27af45];return _0x18df21;};'use strict';var _=require('lodash');var util=require(_0xdeb5('0x0'));var logger=require(_0xdeb5('0x1'))(_0xdeb5('0x2'));var moment=require(_0xdeb5('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xdeb5('0x4'));var rimraf=require(_0xdeb5('0x5'));var config=require('../../config/environment');var attributes=require(_0xdeb5('0x6'));module[_0xdeb5('0x7')]=function(_0x164ecb,_0x33af72){return _0x164ecb[_0xdeb5('0x8')](_0xdeb5('0x9'),attributes,{'tableName':_0xdeb5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js b/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js index 43d4898..f91c019 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 _0x4522=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','stringify','error','code','TeamVoiceQueue,\x20%s,\x20%s','message','result','catch','moment','bluebird','randomstring','../../mysqldb'];(function(_0x56549f,_0x1325f9){var _0x540ad3=function(_0x4bbcf2){while(--_0x4bbcf2){_0x56549f['push'](_0x56549f['shift']());}};_0x540ad3(++_0x1325f9);}(_0x4522,0x1a0));var _0x2452=function(_0x237c98,_0x1c9921){_0x237c98=_0x237c98-0x0;var _0x4c6130=_0x4522[_0x237c98];return _0x4c6130;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2452('0x0'));var BPromise=require(_0x2452('0x1'));var rs=require(_0x2452('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2452('0x3'))['db'];var utils=require(_0x2452('0x4'));var logger=require(_0x2452('0x5'))(_0x2452('0x6'));var config=require(_0x2452('0x7'));var jayson=require(_0x2452('0x8'));var client=jayson[_0x2452('0x9')][_0x2452('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2f0139,_0x149807,_0x3bc193){return new BPromise(function(_0x33b935,_0x24073f){return client[_0x2452('0xb')](_0x2f0139,_0x3bc193)[_0x2452('0xc')](function(_0x2995b5){logger['info']('TeamVoiceQueue,\x20%s,\x20%s',_0x149807,_0x2452('0xd'));logger['debug']('TeamVoiceQueue,\x20%s,\x20%s,\x20%s',_0x149807,_0x2452('0xd'),JSON[_0x2452('0xe')](_0x2995b5));if(_0x2995b5[_0x2452('0xf')]){if(_0x2995b5[_0x2452('0xf')][_0x2452('0x10')]===0x1f4){logger[_0x2452('0xf')](_0x2452('0x11'),_0x149807,_0x2995b5[_0x2452('0xf')]['message']);return _0x24073f(_0x2995b5['error']['message']);}logger[_0x2452('0xf')]('TeamVoiceQueue,\x20%s,\x20%s',_0x149807,_0x2995b5[_0x2452('0xf')]['message']);return _0x33b935(_0x2995b5[_0x2452('0xf')][_0x2452('0x12')]);}else{logger['info'](_0x2452('0x11'),_0x149807,'request\x20sent');_0x33b935(_0x2995b5[_0x2452('0x13')][_0x2452('0x12')]);}})[_0x2452('0x14')](function(_0xdede20){logger['error'](_0x2452('0x11'),_0x149807,_0xdede20);_0x24073f(_0xdede20);});});} \ No newline at end of file +var _0x2188=['TeamVoiceQueue,\x20%s,\x20%s','debug','error','message','request\x20sent','result','lodash','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','client','http','request','info'];(function(_0x14d7d6,_0x57bcd5){var _0x5d900b=function(_0x528c1b){while(--_0x528c1b){_0x14d7d6['push'](_0x14d7d6['shift']());}};_0x5d900b(++_0x57bcd5);}(_0x2188,0x1d6));var _0x8218=function(_0x47e954,_0x3b972b){_0x47e954=_0x47e954-0x0;var _0x5911e4=_0x2188[_0x47e954];return _0x5911e4;};'use strict';var _=require(_0x8218('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x8218('0x1'));var rs=require(_0x8218('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8218('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x8218('0x4'))(_0x8218('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8218('0x6')][_0x8218('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xd416ac,_0x5f6617,_0x113802){return new BPromise(function(_0x298d38,_0x20d3d){return client[_0x8218('0x8')](_0xd416ac,_0x113802)['then'](function(_0x1baafc){logger[_0x8218('0x9')](_0x8218('0xa'),_0x5f6617,'request\x20sent');logger[_0x8218('0xb')]('TeamVoiceQueue,\x20%s,\x20%s,\x20%s',_0x5f6617,'request\x20sent',JSON['stringify'](_0x1baafc));if(_0x1baafc['error']){if(_0x1baafc[_0x8218('0xc')]['code']===0x1f4){logger['error']('TeamVoiceQueue,\x20%s,\x20%s',_0x5f6617,_0x1baafc[_0x8218('0xc')][_0x8218('0xd')]);return _0x20d3d(_0x1baafc[_0x8218('0xc')][_0x8218('0xd')]);}logger[_0x8218('0xc')](_0x8218('0xa'),_0x5f6617,_0x1baafc[_0x8218('0xc')][_0x8218('0xd')]);return _0x298d38(_0x1baafc[_0x8218('0xc')][_0x8218('0xd')]);}else{logger[_0x8218('0x9')]('TeamVoiceQueue,\x20%s,\x20%s',_0x5f6617,_0x8218('0xe'));_0x298d38(_0x1baafc[_0x8218('0xf')]['message']);}})['catch'](function(_0x40482c){logger[_0x8218('0xc')](_0x8218('0xa'),_0x5f6617,_0x40482c);_0x20d3d(_0x40482c);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index d15bc36..765432a 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 _0x9e6d=['exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','create','destroy'];(function(_0x2c9a53,_0x3051f1){var _0x3c80b5=function(_0x148e2e){while(--_0x148e2e){_0x2c9a53['push'](_0x2c9a53['shift']());}};_0x3c80b5(++_0x3051f1);}(_0x9e6d,0x1d2));var _0xd9e6=function(_0x1e712e,_0x215ba3){_0x1e712e=_0x1e712e-0x0;var _0x161d24=_0x9e6d[_0x1e712e];return _0x161d24;};'use strict';var multer=require(_0xd9e6('0x0'));var util=require('util');var path=require(_0xd9e6('0x1'));var timeout=require(_0xd9e6('0x2'));var express=require(_0xd9e6('0x3'));var router=express['Router']();var fs_extra=require(_0xd9e6('0x4'));var auth=require(_0xd9e6('0x5'));var interaction=require(_0xd9e6('0x6'));var config=require(_0xd9e6('0x7'));var controller=require('./template.controller');router[_0xd9e6('0x8')]('/',auth[_0xd9e6('0x9')](),controller['index']);router['get'](_0xd9e6('0xa'),auth[_0xd9e6('0x9')](),controller[_0xd9e6('0xb')]);router['post']('/',auth[_0xd9e6('0x9')](),controller[_0xd9e6('0xc')]);router['put'](_0xd9e6('0xa'),auth[_0xd9e6('0x9')](),controller['update']);router['delete'](_0xd9e6('0xa'),auth[_0xd9e6('0x9')](),controller[_0xd9e6('0xd')]);module[_0xd9e6('0xe')]=router; \ No newline at end of file +var _0xd052=['path','express','../../components/auth/service','../../config/environment','./template.controller','isAuthenticated','index','get','/:id','show','post','create','put','destroy','exports'];(function(_0x594a0a,_0x432ae7){var _0x5ed9be=function(_0x5a4942){while(--_0x5a4942){_0x594a0a['push'](_0x594a0a['shift']());}};_0x5ed9be(++_0x432ae7);}(_0xd052,0x69));var _0x2d05=function(_0x259d09,_0xbe1403){_0x259d09=_0x259d09-0x0;var _0x205ca8=_0xd052[_0x259d09];return _0x205ca8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2d05('0x0'));var timeout=require('connect-timeout');var express=require(_0x2d05('0x1'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x2d05('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x2d05('0x3'));var controller=require(_0x2d05('0x4'));router['get']('/',auth[_0x2d05('0x5')](),controller[_0x2d05('0x6')]);router[_0x2d05('0x7')](_0x2d05('0x8'),auth[_0x2d05('0x5')](),controller[_0x2d05('0x9')]);router[_0x2d05('0xa')]('/',auth[_0x2d05('0x5')](),controller[_0x2d05('0xb')]);router[_0x2d05('0xc')](_0x2d05('0x8'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x2d05('0x8'),auth[_0x2d05('0x5')](),controller[_0x2d05('0xd')]);module[_0x2d05('0xe')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 4c4644a..b8a33e5 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 _0x31b7=['sequelize','exports','STRING','TEXT'];(function(_0x52a059,_0x46e42e){var _0x250df2=function(_0x9a35a1){while(--_0x9a35a1){_0x52a059['push'](_0x52a059['shift']());}};_0x250df2(++_0x46e42e);}(_0x31b7,0xec));var _0x731b=function(_0x2d3ebb,_0x1a3d93){_0x2d3ebb=_0x2d3ebb-0x0;var _0x14adfe=_0x31b7[_0x2d3ebb];return _0x14adfe;};'use strict';var Sequelize=require(_0x731b('0x0'));module[_0x731b('0x1')]={'name':{'type':Sequelize[_0x731b('0x2')]},'description':{'type':Sequelize[_0x731b('0x2')]},'html':{'type':Sequelize[_0x731b('0x3')]}}; \ No newline at end of file +var _0x55b7=['TEXT','exports','STRING'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x55b7,0x190));var _0x755b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x55b7[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module[_0x755b('0x0')]={'name':{'type':Sequelize[_0x755b('0x1')]},'description':{'type':Sequelize[_0x755b('0x1')]},'html':{'type':Sequelize[_0x755b('0x2')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 2f99556..da2a86e 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 _0x453a=['sox','to-csv','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','save','update','then','destroy','get','Templates','UserProfileResource','error','stack','name','send','map','Template','rawAttributes','fieldName','type','key','query','keys','model','fields','attributes','length','nolimit','sort','filters','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','intersection','options','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','moment','bluebird','util','path'];(function(_0x231389,_0x287116){var _0x2f815b=function(_0x19e9b7){while(--_0x19e9b7){_0x231389['push'](_0x231389['shift']());}};_0x2f815b(++_0x287116);}(_0x453a,0xf2));var _0xa453=function(_0x412ae1,_0x20a4c4){_0x412ae1=_0x412ae1-0x0;var _0x50bea0=_0x453a[_0x412ae1];return _0x50bea0;};'use strict';var emlformat=require(_0xa453('0x0'));var rimraf=require(_0xa453('0x1'));var zipdir=require(_0xa453('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa453('0x3'));var BPromise=require(_0xa453('0x4'));var Mustache=require('mustache');var util=require(_0xa453('0x5'));var path=require(_0xa453('0x6'));var sox=require(_0xa453('0x7'));var csv=require(_0xa453('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa453('0x9'));var squel=require(_0xa453('0xa'));var crypto=require('crypto');var jsforce=require(_0xa453('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xa453('0x8'));var querystring=require(_0xa453('0xc'));var Papa=require(_0xa453('0xd'));var Redis=require(_0xa453('0xe'));var authService=require(_0xa453('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xa453('0x10'));var hardwareService=require(_0xa453('0x11'));var logger=require(_0xa453('0x12'))(_0xa453('0x13'));var utils=require(_0xa453('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xa453('0x15'));var db=require(_0xa453('0x16'))['db'];function respondWithStatusCode(_0x579842,_0x1e31ba){_0x1e31ba=_0x1e31ba||0xcc;return function(_0x2163c2){if(_0x2163c2){return _0x579842[_0xa453('0x17')](_0x1e31ba);}return _0x579842[_0xa453('0x18')](_0x1e31ba)[_0xa453('0x19')]();};}function respondWithResult(_0x58e3d1,_0x543b97){_0x543b97=_0x543b97||0xc8;return function(_0x2cdbce){if(_0x2cdbce){return _0x58e3d1[_0xa453('0x18')](_0x543b97)['json'](_0x2cdbce);}};}function respondWithFilteredResult(_0x2aaa1b,_0x3b8328){return function(_0x180160){if(_0x180160){var _0xb1b799=typeof _0x3b8328[_0xa453('0x1a')]===_0xa453('0x1b')&&typeof _0x3b8328[_0xa453('0x1c')]===_0xa453('0x1b');var _0x3b487e=_0x180160[_0xa453('0x1d')];var _0x296eda=_0xb1b799?0x0:_0x3b8328[_0xa453('0x1a')];var _0x198641=_0xb1b799?_0x180160[_0xa453('0x1d')]:_0x3b8328['offset']+_0x3b8328[_0xa453('0x1c')];var _0x5796cd;if(_0x198641>=_0x3b487e){_0x198641=_0x3b487e;_0x5796cd=0xc8;}else{_0x5796cd=0xce;}_0x2aaa1b[_0xa453('0x18')](_0x5796cd);return _0x2aaa1b[_0xa453('0x1e')]('Content-Range',_0x296eda+'-'+_0x198641+'/'+_0x3b487e)[_0xa453('0x1f')](_0x180160);}return null;};}function patchUpdates(_0x324cf2){return function(_0x5f148b){try{jsonpatch[_0xa453('0x20')](_0x5f148b,_0x324cf2,!![]);}catch(_0x8a376){return BPromise[_0xa453('0x21')](_0x8a376);}return _0x5f148b[_0xa453('0x22')]();};}function saveUpdates(_0x5fe284,_0x58b3a7){return function(_0x7b8fde){if(_0x7b8fde){return _0x7b8fde[_0xa453('0x23')](_0x5fe284)[_0xa453('0x24')](function(_0x36092c){return _0x36092c;});}return null;};}function removeEntity(_0x111067,_0xd66ee2){return function(_0x420082){if(_0x420082){return _0x420082[_0xa453('0x25')]()[_0xa453('0x24')](function(){var _0x32af25=_0x420082[_0xa453('0x26')]({'plain':!![]});var _0x30307d=_0xa453('0x27');return db[_0xa453('0x28')][_0xa453('0x25')]({'where':{'type':_0x30307d,'resourceId':_0x32af25['id']}})['then'](function(){return _0x420082;});})[_0xa453('0x24')](function(){_0x111067[_0xa453('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x17d9e7,_0x11c259){return function(_0x9f87fe){if(!_0x9f87fe){_0x17d9e7[_0xa453('0x17')](0x194);}return _0x9f87fe;};}function handleError(_0x2e6fa5,_0x2bd367){_0x2bd367=_0x2bd367||0x1f4;return function(_0x7781bc){logger[_0xa453('0x29')](_0x7781bc[_0xa453('0x2a')]);if(_0x7781bc[_0xa453('0x2b')]){delete _0x7781bc[_0xa453('0x2b')];}_0x2e6fa5[_0xa453('0x18')](_0x2bd367)[_0xa453('0x2c')](_0x7781bc);};}exports['index']=function(_0x225a0b,_0x292ced){var _0x53d12a={},_0x2b98fa={},_0x4a0e63={'count':0x0,'rows':[]};var _0x4c3e0d=_[_0xa453('0x2d')](db[_0xa453('0x2e')][_0xa453('0x2f')],function(_0x4f5090){return{'name':_0x4f5090[_0xa453('0x30')],'type':_0x4f5090[_0xa453('0x31')][_0xa453('0x32')]};});_0x2b98fa['model']=_['map'](_0x4c3e0d,_0xa453('0x2b'));_0x2b98fa[_0xa453('0x33')]=_[_0xa453('0x34')](_0x225a0b[_0xa453('0x33')]);_0x2b98fa['filters']=_['intersection'](_0x2b98fa[_0xa453('0x35')],_0x2b98fa[_0xa453('0x33')]);_0x53d12a['attributes']=_['intersection'](_0x2b98fa[_0xa453('0x35')],qs[_0xa453('0x36')](_0x225a0b[_0xa453('0x33')]['fields']));_0x53d12a[_0xa453('0x37')]=_0x53d12a[_0xa453('0x37')][_0xa453('0x38')]?_0x53d12a[_0xa453('0x37')]:_0x2b98fa[_0xa453('0x35')];if(!_0x225a0b[_0xa453('0x33')]['hasOwnProperty'](_0xa453('0x39'))){_0x53d12a['limit']=qs[_0xa453('0x1c')](_0x225a0b['query'][_0xa453('0x1c')]);_0x53d12a[_0xa453('0x1a')]=qs[_0xa453('0x1a')](_0x225a0b[_0xa453('0x33')][_0xa453('0x1a')]);}_0x53d12a['order']=qs[_0xa453('0x3a')](_0x225a0b[_0xa453('0x33')][_0xa453('0x3a')]);_0x53d12a['where']=qs[_0xa453('0x3b')](_[_0xa453('0x3c')](_0x225a0b[_0xa453('0x33')],_0x2b98fa[_0xa453('0x3b')]),_0x4c3e0d);if(_0x225a0b[_0xa453('0x33')][_0xa453('0x3d')]){_0x53d12a[_0xa453('0x3e')]=_[_0xa453('0x3f')](_0x53d12a[_0xa453('0x3e')],{'$or':_['map'](_0x4c3e0d,function(_0x308d56){if(_0x308d56[_0xa453('0x31')]!==_0xa453('0x40')){var _0x145b74={};_0x145b74[_0x308d56[_0xa453('0x2b')]]={'$like':'%'+_0x225a0b[_0xa453('0x33')]['filter']+'%'};return _0x145b74;}})});}_0x53d12a=_['merge']({},_0x53d12a,_0x225a0b['options']);var _0x2dac3f={'where':_0x53d12a[_0xa453('0x3e')]};return db[_0xa453('0x2e')][_0xa453('0x1d')](_0x2dac3f)[_0xa453('0x24')](function(_0x1d503d){_0x4a0e63[_0xa453('0x1d')]=_0x1d503d;if(_0x225a0b[_0xa453('0x33')][_0xa453('0x41')]){_0x53d12a[_0xa453('0x42')]=[{'all':!![]}];}return db[_0xa453('0x2e')][_0xa453('0x43')](_0x53d12a);})[_0xa453('0x24')](function(_0x212aad){_0x4a0e63[_0xa453('0x44')]=_0x212aad;return _0x4a0e63;})[_0xa453('0x24')](respondWithFilteredResult(_0x292ced,_0x53d12a))['catch'](handleError(_0x292ced,null));};exports[_0xa453('0x45')]=function(_0x369109,_0x297c4c){var _0x364617={'raw':!![],'where':{'id':_0x369109[_0xa453('0x46')]['id']}},_0x5a58b3={};_0x5a58b3[_0xa453('0x35')]=_['keys'](db[_0xa453('0x2e')][_0xa453('0x2f')]);_0x5a58b3['query']=_[_0xa453('0x34')](_0x369109[_0xa453('0x33')]);_0x5a58b3[_0xa453('0x3b')]=_[_0xa453('0x47')](_0x5a58b3[_0xa453('0x35')],_0x5a58b3[_0xa453('0x33')]);_0x364617[_0xa453('0x37')]=_[_0xa453('0x47')](_0x5a58b3[_0xa453('0x35')],qs[_0xa453('0x36')](_0x369109[_0xa453('0x33')][_0xa453('0x36')]));_0x364617[_0xa453('0x37')]=_0x364617[_0xa453('0x37')][_0xa453('0x38')]?_0x364617[_0xa453('0x37')]:_0x5a58b3[_0xa453('0x35')];if(_0x369109[_0xa453('0x33')][_0xa453('0x41')]){_0x364617[_0xa453('0x42')]=[{'all':!![]}];}_0x364617=_['merge']({},_0x364617,_0x369109[_0xa453('0x48')]);return db[_0xa453('0x2e')][_0xa453('0x49')](_0x364617)['then'](handleEntityNotFound(_0x297c4c,null))['then'](respondWithResult(_0x297c4c,null))[_0xa453('0x4a')](handleError(_0x297c4c,null));};exports[_0xa453('0x4b')]=function(_0x305e4f,_0x4bb593){return db[_0xa453('0x2e')][_0xa453('0x4b')](_0x305e4f[_0xa453('0x4c')],{})[_0xa453('0x24')](function(_0x4dd589){var _0x578cd8=_0x305e4f[_0xa453('0x4d')][_0xa453('0x26')]({'plain':!![]});if(!_0x578cd8)throw new Error(_0xa453('0x4e'));if(_0x578cd8['role']===_0xa453('0x4d')){var _0x49a180=_0x4dd589[_0xa453('0x26')]({'plain':!![]});var _0x4d4921=_0xa453('0x27');return db[_0xa453('0x4f')][_0xa453('0x49')]({'where':{'name':_0x4d4921,'userProfileId':_0x578cd8[_0xa453('0x50')]},'raw':!![]})[_0xa453('0x24')](function(_0x4ed2fb){if(_0x4ed2fb&&_0x4ed2fb[_0xa453('0x51')]===0x0){return db['UserProfileResource'][_0xa453('0x4b')]({'name':_0x49a180[_0xa453('0x2b')],'resourceId':_0x49a180['id'],'type':_0x4ed2fb['name'],'sectionId':_0x4ed2fb['id']},{})[_0xa453('0x24')](function(){return _0x4dd589;});}else{return _0x4dd589;}})[_0xa453('0x4a')](function(_0x387b50){logger[_0xa453('0x29')](_0xa453('0x52'),_0x387b50);throw _0x387b50;});}return _0x4dd589;})[_0xa453('0x24')](respondWithResult(_0x4bb593,0xc9))['catch'](handleError(_0x4bb593,null));};exports[_0xa453('0x23')]=function(_0x492014,_0x948887){if(_0x492014[_0xa453('0x4c')]['id']){delete _0x492014[_0xa453('0x4c')]['id'];}return db[_0xa453('0x2e')][_0xa453('0x49')]({'where':{'id':_0x492014[_0xa453('0x46')]['id']}})[_0xa453('0x24')](handleEntityNotFound(_0x948887,null))['then'](saveUpdates(_0x492014['body'],null))[_0xa453('0x24')](respondWithResult(_0x948887,null))[_0xa453('0x4a')](handleError(_0x948887,null));};exports[_0xa453('0x25')]=function(_0xe9df30,_0x5d02ae){return db['Template'][_0xa453('0x49')]({'where':{'id':_0xe9df30[_0xa453('0x46')]['id']}})[_0xa453('0x24')](handleEntityNotFound(_0x5d02ae,null))['then'](removeEntity(_0x5d02ae,null))['catch'](handleError(_0x5d02ae,null));}; \ No newline at end of file +var _0x7f1a=['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','../../mysqldb','sendStatus','end','status','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','Templates','UserProfileResource','error','name','send','index','map','Template','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','show','params','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','find','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox'];(function(_0xc9275e,_0x4cc1ba){var _0x5162d4=function(_0x52ef80){while(--_0x52ef80){_0xc9275e['push'](_0xc9275e['shift']());}};_0x5162d4(++_0x4cc1ba);}(_0x7f1a,0xf0));var _0xa7f1=function(_0x391316,_0x3a4682){_0x391316=_0x391316-0x0;var _0x4386de=_0x7f1a[_0x391316];return _0x4386de;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa7f1('0x0'));var zipdir=require(_0xa7f1('0x1'));var jsonpatch=require(_0xa7f1('0x2'));var rp=require(_0xa7f1('0x3'));var moment=require(_0xa7f1('0x4'));var BPromise=require(_0xa7f1('0x5'));var Mustache=require(_0xa7f1('0x6'));var util=require(_0xa7f1('0x7'));var path=require('path');var sox=require(_0xa7f1('0x8'));var csv=require(_0xa7f1('0x9'));var ejs=require(_0xa7f1('0xa'));var fs=require('fs');var fs_extra=require(_0xa7f1('0xb'));var _=require(_0xa7f1('0xc'));var squel=require(_0xa7f1('0xd'));var crypto=require(_0xa7f1('0xe'));var jsforce=require(_0xa7f1('0xf'));var deskjs=require(_0xa7f1('0x10'));var toCsv=require(_0xa7f1('0x9'));var querystring=require(_0xa7f1('0x11'));var Papa=require('papaparse');var Redis=require(_0xa7f1('0x12'));var authService=require(_0xa7f1('0x13'));var qs=require(_0xa7f1('0x14'));var as=require(_0xa7f1('0x15'));var hardwareService=require(_0xa7f1('0x16'));var logger=require(_0xa7f1('0x17'))(_0xa7f1('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xa7f1('0x19'))['db'];function respondWithStatusCode(_0x2b7afb,_0x37ab71){_0x37ab71=_0x37ab71||0xcc;return function(_0x542657){if(_0x542657){return _0x2b7afb[_0xa7f1('0x1a')](_0x37ab71);}return _0x2b7afb['status'](_0x37ab71)[_0xa7f1('0x1b')]();};}function respondWithResult(_0x3e94dd,_0x44f7ff){_0x44f7ff=_0x44f7ff||0xc8;return function(_0xe8bfdc){if(_0xe8bfdc){return _0x3e94dd[_0xa7f1('0x1c')](_0x44f7ff)['json'](_0xe8bfdc);}};}function respondWithFilteredResult(_0x776a28,_0xd78a67){return function(_0x387619){if(_0x387619){var _0xc8084c=typeof _0xd78a67[_0xa7f1('0x1d')]===_0xa7f1('0x1e')&&typeof _0xd78a67['limit']==='undefined';var _0xf4e135=_0x387619['count'];var _0x3fcdc7=_0xc8084c?0x0:_0xd78a67[_0xa7f1('0x1d')];var _0x48cc96=_0xc8084c?_0x387619[_0xa7f1('0x1f')]:_0xd78a67[_0xa7f1('0x1d')]+_0xd78a67[_0xa7f1('0x20')];var _0xab3f87;if(_0x48cc96>=_0xf4e135){_0x48cc96=_0xf4e135;_0xab3f87=0xc8;}else{_0xab3f87=0xce;}_0x776a28[_0xa7f1('0x1c')](_0xab3f87);return _0x776a28[_0xa7f1('0x21')](_0xa7f1('0x22'),_0x3fcdc7+'-'+_0x48cc96+'/'+_0xf4e135)['json'](_0x387619);}return null;};}function patchUpdates(_0x376c35){return function(_0x5190b8){try{jsonpatch[_0xa7f1('0x23')](_0x5190b8,_0x376c35,!![]);}catch(_0x3b51cd){return BPromise[_0xa7f1('0x24')](_0x3b51cd);}return _0x5190b8[_0xa7f1('0x25')]();};}function saveUpdates(_0x57390d,_0x5f5106){return function(_0x13173b){if(_0x13173b){return _0x13173b[_0xa7f1('0x26')](_0x57390d)[_0xa7f1('0x27')](function(_0x5e7e2f){return _0x5e7e2f;});}return null;};}function removeEntity(_0x35e74e,_0x2de2f1){return function(_0x3f777b){if(_0x3f777b){return _0x3f777b[_0xa7f1('0x28')]()[_0xa7f1('0x27')](function(){var _0x592fb0=_0x3f777b['get']({'plain':!![]});var _0x9504e2=_0xa7f1('0x29');return db[_0xa7f1('0x2a')][_0xa7f1('0x28')]({'where':{'type':_0x9504e2,'resourceId':_0x592fb0['id']}})[_0xa7f1('0x27')](function(){return _0x3f777b;});})[_0xa7f1('0x27')](function(){_0x35e74e['status'](0xcc)[_0xa7f1('0x1b')]();});}};}function handleEntityNotFound(_0x50ed78,_0x385591){return function(_0x5a830d){if(!_0x5a830d){_0x50ed78[_0xa7f1('0x1a')](0x194);}return _0x5a830d;};}function handleError(_0x51dbf4,_0xa92e95){_0xa92e95=_0xa92e95||0x1f4;return function(_0x111d8a){logger[_0xa7f1('0x2b')](_0x111d8a['stack']);if(_0x111d8a[_0xa7f1('0x2c')]){delete _0x111d8a[_0xa7f1('0x2c')];}_0x51dbf4[_0xa7f1('0x1c')](_0xa92e95)[_0xa7f1('0x2d')](_0x111d8a);};}exports[_0xa7f1('0x2e')]=function(_0x34dbb7,_0x3a06a3){var _0x16e13a={},_0x1b032a={},_0x4df347={'count':0x0,'rows':[]};var _0x41197e=_[_0xa7f1('0x2f')](db[_0xa7f1('0x30')][_0xa7f1('0x31')],function(_0x5322ac){return{'name':_0x5322ac[_0xa7f1('0x32')],'type':_0x5322ac[_0xa7f1('0x33')][_0xa7f1('0x34')]};});_0x1b032a[_0xa7f1('0x35')]=_[_0xa7f1('0x2f')](_0x41197e,_0xa7f1('0x2c'));_0x1b032a[_0xa7f1('0x36')]=_[_0xa7f1('0x37')](_0x34dbb7[_0xa7f1('0x36')]);_0x1b032a[_0xa7f1('0x38')]=_[_0xa7f1('0x39')](_0x1b032a[_0xa7f1('0x35')],_0x1b032a['query']);_0x16e13a[_0xa7f1('0x3a')]=_[_0xa7f1('0x39')](_0x1b032a[_0xa7f1('0x35')],qs[_0xa7f1('0x3b')](_0x34dbb7[_0xa7f1('0x36')][_0xa7f1('0x3b')]));_0x16e13a[_0xa7f1('0x3a')]=_0x16e13a[_0xa7f1('0x3a')][_0xa7f1('0x3c')]?_0x16e13a[_0xa7f1('0x3a')]:_0x1b032a[_0xa7f1('0x35')];if(!_0x34dbb7['query']['hasOwnProperty'](_0xa7f1('0x3d'))){_0x16e13a[_0xa7f1('0x20')]=qs[_0xa7f1('0x20')](_0x34dbb7[_0xa7f1('0x36')][_0xa7f1('0x20')]);_0x16e13a[_0xa7f1('0x1d')]=qs['offset'](_0x34dbb7['query'][_0xa7f1('0x1d')]);}_0x16e13a['order']=qs[_0xa7f1('0x3e')](_0x34dbb7[_0xa7f1('0x36')][_0xa7f1('0x3e')]);_0x16e13a[_0xa7f1('0x3f')]=qs[_0xa7f1('0x38')](_[_0xa7f1('0x40')](_0x34dbb7[_0xa7f1('0x36')],_0x1b032a[_0xa7f1('0x38')]),_0x41197e);if(_0x34dbb7[_0xa7f1('0x36')][_0xa7f1('0x41')]){_0x16e13a[_0xa7f1('0x3f')]=_[_0xa7f1('0x42')](_0x16e13a['where'],{'$or':_[_0xa7f1('0x2f')](_0x41197e,function(_0x132517){if(_0x132517[_0xa7f1('0x33')]!=='VIRTUAL'){var _0x3338a9={};_0x3338a9[_0x132517[_0xa7f1('0x2c')]]={'$like':'%'+_0x34dbb7['query'][_0xa7f1('0x41')]+'%'};return _0x3338a9;}})});}_0x16e13a=_['merge']({},_0x16e13a,_0x34dbb7[_0xa7f1('0x43')]);var _0x310ca5={'where':_0x16e13a['where']};return db['Template'][_0xa7f1('0x1f')](_0x310ca5)[_0xa7f1('0x27')](function(_0x186306){_0x4df347['count']=_0x186306;if(_0x34dbb7[_0xa7f1('0x36')][_0xa7f1('0x44')]){_0x16e13a[_0xa7f1('0x45')]=[{'all':!![]}];}return db[_0xa7f1('0x30')][_0xa7f1('0x46')](_0x16e13a);})[_0xa7f1('0x27')](function(_0xaa92e5){_0x4df347['rows']=_0xaa92e5;return _0x4df347;})['then'](respondWithFilteredResult(_0x3a06a3,_0x16e13a))[_0xa7f1('0x47')](handleError(_0x3a06a3,null));};exports[_0xa7f1('0x48')]=function(_0xd49cc0,_0x59656d){var _0xc4680b={'raw':!![],'where':{'id':_0xd49cc0[_0xa7f1('0x49')]['id']}},_0x47a889={};_0x47a889[_0xa7f1('0x35')]=_[_0xa7f1('0x37')](db[_0xa7f1('0x30')][_0xa7f1('0x31')]);_0x47a889[_0xa7f1('0x36')]=_[_0xa7f1('0x37')](_0xd49cc0[_0xa7f1('0x36')]);_0x47a889['filters']=_[_0xa7f1('0x39')](_0x47a889['model'],_0x47a889[_0xa7f1('0x36')]);_0xc4680b[_0xa7f1('0x3a')]=_[_0xa7f1('0x39')](_0x47a889['model'],qs['fields'](_0xd49cc0[_0xa7f1('0x36')][_0xa7f1('0x3b')]));_0xc4680b['attributes']=_0xc4680b[_0xa7f1('0x3a')]['length']?_0xc4680b[_0xa7f1('0x3a')]:_0x47a889['model'];if(_0xd49cc0['query'][_0xa7f1('0x44')]){_0xc4680b[_0xa7f1('0x45')]=[{'all':!![]}];}_0xc4680b=_[_0xa7f1('0x42')]({},_0xc4680b,_0xd49cc0[_0xa7f1('0x43')]);return db['Template']['find'](_0xc4680b)['then'](handleEntityNotFound(_0x59656d,null))[_0xa7f1('0x27')](respondWithResult(_0x59656d,null))[_0xa7f1('0x47')](handleError(_0x59656d,null));};exports[_0xa7f1('0x4a')]=function(_0xb31064,_0x1bceaa){return db[_0xa7f1('0x30')][_0xa7f1('0x4a')](_0xb31064['body'],{})[_0xa7f1('0x27')](function(_0x32df4b){var _0x3c0a11=_0xb31064[_0xa7f1('0x4b')]['get']({'plain':!![]});if(!_0x3c0a11)throw new Error(_0xa7f1('0x4c'));if(_0x3c0a11[_0xa7f1('0x4d')]===_0xa7f1('0x4b')){var _0x595b92=_0x32df4b[_0xa7f1('0x4e')]({'plain':!![]});var _0x3b2606='Templates';return db[_0xa7f1('0x4f')][_0xa7f1('0x50')]({'where':{'name':_0x3b2606,'userProfileId':_0x3c0a11['userProfileId']},'raw':!![]})[_0xa7f1('0x27')](function(_0x3f5c21){if(_0x3f5c21&&_0x3f5c21['autoAssociation']===0x0){return db['UserProfileResource'][_0xa7f1('0x4a')]({'name':_0x595b92['name'],'resourceId':_0x595b92['id'],'type':_0x3f5c21['name'],'sectionId':_0x3f5c21['id']},{})[_0xa7f1('0x27')](function(){return _0x32df4b;});}else{return _0x32df4b;}})[_0xa7f1('0x47')](function(_0x2369c3){logger['error'](_0xa7f1('0x51'),_0x2369c3);throw _0x2369c3;});}return _0x32df4b;})['then'](respondWithResult(_0x1bceaa,0xc9))['catch'](handleError(_0x1bceaa,null));};exports[_0xa7f1('0x26')]=function(_0x18fed1,_0x33baf2){if(_0x18fed1['body']['id']){delete _0x18fed1[_0xa7f1('0x52')]['id'];}return db[_0xa7f1('0x30')][_0xa7f1('0x50')]({'where':{'id':_0x18fed1[_0xa7f1('0x49')]['id']}})[_0xa7f1('0x27')](handleEntityNotFound(_0x33baf2,null))['then'](saveUpdates(_0x18fed1[_0xa7f1('0x52')],null))[_0xa7f1('0x27')](respondWithResult(_0x33baf2,null))['catch'](handleError(_0x33baf2,null));};exports['destroy']=function(_0x53415b,_0x52bb49){return db['Template'][_0xa7f1('0x50')]({'where':{'id':_0x53415b[_0xa7f1('0x49')]['id']}})['then'](handleEntityNotFound(_0x52bb49,null))['then'](removeEntity(_0x52bb49,null))[_0xa7f1('0x47')](handleError(_0x52bb49,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index d326623..8e56208 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 _0xef9c=['path','rimraf','./template.attributes','exports','define','Template','tools_templates','lodash','util','api','request-promise'];(function(_0x21df37,_0x426666){var _0x1b4b9f=function(_0x4a7962){while(--_0x4a7962){_0x21df37['push'](_0x21df37['shift']());}};_0x1b4b9f(++_0x426666);}(_0xef9c,0x125));var _0xcef9=function(_0x39f34f,_0x298f45){_0x39f34f=_0x39f34f-0x0;var _0x59fee1=_0xef9c[_0x39f34f];return _0x59fee1;};'use strict';var _=require(_0xcef9('0x0'));var util=require(_0xcef9('0x1'));var logger=require('../../config/logger')(_0xcef9('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xcef9('0x3'));var fs=require('fs');var path=require(_0xcef9('0x4'));var rimraf=require(_0xcef9('0x5'));var config=require('../../config/environment');var attributes=require(_0xcef9('0x6'));module[_0xcef9('0x7')]=function(_0x4295f0,_0x2ce5df){return _0x4295f0[_0xcef9('0x8')](_0xcef9('0x9'),attributes,{'tableName':_0xcef9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa38c=['tools_templates','util','../../config/logger','moment','bluebird','request-promise','path','exports','define','Template'];(function(_0xf73c09,_0x4e424e){var _0xa8923c=function(_0x4831c1){while(--_0x4831c1){_0xf73c09['push'](_0xf73c09['shift']());}};_0xa8923c(++_0x4e424e);}(_0xa38c,0x8d));var _0xca38=function(_0x1c4782,_0x1e01ba){_0x1c4782=_0x1c4782-0x0;var _0x254980=_0xa38c[_0x1c4782];return _0x254980;};'use strict';var _=require('lodash');var util=require(_0xca38('0x0'));var logger=require(_0xca38('0x1'))('api');var moment=require(_0xca38('0x2'));var BPromise=require(_0xca38('0x3'));var rp=require(_0xca38('0x4'));var fs=require('fs');var path=require(_0xca38('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./template.attributes');module[_0xca38('0x6')]=function(_0x313e10,_0x140403){return _0x313e10[_0xca38('0x7')](_0xca38('0x8'),attributes,{'tableName':_0xca38('0x9'),'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 8898f8f..42de67b 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 _0x98f1=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetTemplate','Template','findAll','options','raw','limit','include','map','model','attributes','moment','bluebird'];(function(_0x5dba8e,_0x4bae0b){var _0x2abe77=function(_0x6ee09a){while(--_0x6ee09a){_0x5dba8e['push'](_0x5dba8e['shift']());}};_0x2abe77(++_0x4bae0b);}(_0x98f1,0x1cf));var _0x198f=function(_0x1b701a,_0x126512){_0x1b701a=_0x1b701a-0x0;var _0xb92894=_0x98f1[_0x1b701a];return _0xb92894;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x198f('0x0'));var BPromise=require(_0x198f('0x1'));var rs=require(_0x198f('0x2'));var fs=require('fs');var Redis=require(_0x198f('0x3'));var db=require(_0x198f('0x4'))['db'];var utils=require(_0x198f('0x5'));var logger=require('../../config/logger')(_0x198f('0x6'));var config=require(_0x198f('0x7'));var jayson=require(_0x198f('0x8'));var client=jayson['client'][_0x198f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x193097,_0x387f25,_0x5f55ad){return new BPromise(function(_0x36474d,_0x48d681){return client[_0x198f('0xa')](_0x193097,_0x5f55ad)[_0x198f('0xb')](function(_0x399405){logger[_0x198f('0xc')](_0x198f('0xd'),_0x387f25,_0x198f('0xe'));logger[_0x198f('0xf')](_0x198f('0x10'),_0x387f25,_0x198f('0xe'),JSON[_0x198f('0x11')](_0x399405));if(_0x399405[_0x198f('0x12')]){if(_0x399405[_0x198f('0x12')]['code']===0x1f4){logger[_0x198f('0x12')](_0x198f('0xd'),_0x387f25,_0x399405[_0x198f('0x12')][_0x198f('0x13')]);return _0x48d681(_0x399405[_0x198f('0x12')][_0x198f('0x13')]);}logger[_0x198f('0x12')]('Template,\x20%s,\x20%s',_0x387f25,_0x399405[_0x198f('0x12')][_0x198f('0x13')]);return _0x36474d(_0x399405['error'][_0x198f('0x13')]);}else{logger['info']('Template,\x20%s,\x20%s',_0x387f25,_0x198f('0xe'));_0x36474d(_0x399405['result'][_0x198f('0x13')]);}})[_0x198f('0x14')](function(_0x50cdd0){logger[_0x198f('0x12')]('Template,\x20%s,\x20%s',_0x387f25,_0x50cdd0);_0x48d681(_0x50cdd0);});});}exports[_0x198f('0x15')]=function(_0x4f2557){var _0x4a9d5d=this;return new Promise(function(_0x14cfb1,_0x2fa4cd){return db[_0x198f('0x16')][_0x198f('0x17')]({'raw':_0x4f2557['options']?_0x4f2557[_0x198f('0x18')][_0x198f('0x19')]===undefined?!![]:![]:!![],'where':_0x4f2557[_0x198f('0x18')]?_0x4f2557['options']['where']||null:null,'attributes':_0x4f2557[_0x198f('0x18')]?_0x4f2557[_0x198f('0x18')]['attributes']||null:null,'limit':_0x4f2557[_0x198f('0x18')]?_0x4f2557[_0x198f('0x18')][_0x198f('0x1a')]||null:null,'include':_0x4f2557[_0x198f('0x18')]?_0x4f2557[_0x198f('0x18')][_0x198f('0x1b')]?_[_0x198f('0x1c')](_0x4f2557[_0x198f('0x18')][_0x198f('0x1b')],function(_0x48b632){return{'model':db[_0x48b632[_0x198f('0x1d')]],'as':_0x48b632['as'],'attributes':_0x48b632[_0x198f('0x1e')],'include':_0x48b632[_0x198f('0x1b')]?_[_0x198f('0x1c')](_0x48b632[_0x198f('0x1b')],function(_0x5b0fdd){return{'model':db[_0x5b0fdd[_0x198f('0x1d')]],'as':_0x5b0fdd['as'],'attributes':_0x5b0fdd[_0x198f('0x1e')],'include':_0x5b0fdd[_0x198f('0x1b')]?_['map'](_0x5b0fdd[_0x198f('0x1b')],function(_0x511c32){return{'model':db[_0x511c32['model']],'as':_0x511c32['as'],'attributes':_0x511c32[_0x198f('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x198f('0xb')](function(_0x1f9707){logger['info']('GetTemplate',_0x4f2557);logger['debug']('GetTemplate',_0x4f2557,JSON[_0x198f('0x11')](_0x1f9707));_0x14cfb1(_0x1f9707);})['catch'](function(_0x15e9d8){logger[_0x198f('0x12')](_0x198f('0x15'),_0x15e9d8[_0x198f('0x13')],_0x4f2557);_0x2fa4cd(_0x4a9d5d['error'](0x1f4,_0x15e9d8[_0x198f('0x13')]));});});}; \ No newline at end of file +var _0xcf9d=['stringify','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','error','code','message','Template,\x20%s,\x20%s','result','catch','GetTemplate','findAll','options','raw','where','attributes','limit','include','map','model'];(function(_0xf2ab1c,_0x308826){var _0x210ffd=function(_0x101a2b){while(--_0x101a2b){_0xf2ab1c['push'](_0xf2ab1c['shift']());}};_0x210ffd(++_0x308826);}(_0xcf9d,0x1ae));var _0xdcf9=function(_0x2b3648,_0x490851){_0x2b3648=_0x2b3648-0x0;var _0x551f94=_0xcf9d[_0x2b3648];return _0x551f94;};'use strict';var _=require('lodash');var util=require(_0xdcf9('0x0'));var moment=require(_0xdcf9('0x1'));var BPromise=require(_0xdcf9('0x2'));var rs=require(_0xdcf9('0x3'));var fs=require('fs');var Redis=require(_0xdcf9('0x4'));var db=require(_0xdcf9('0x5'))['db'];var utils=require(_0xdcf9('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xdcf9('0x7'));var jayson=require(_0xdcf9('0x8'));var client=jayson['client'][_0xdcf9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x56efb2,_0xf78464,_0x9da4e2){return new BPromise(function(_0x54d1fd,_0x59621d){return client[_0xdcf9('0xa')](_0x56efb2,_0x9da4e2)[_0xdcf9('0xb')](function(_0x50f1b8){logger[_0xdcf9('0xc')]('Template,\x20%s,\x20%s',_0xf78464,_0xdcf9('0xd'));logger[_0xdcf9('0xe')](_0xdcf9('0xf'),_0xf78464,_0xdcf9('0xd'),JSON['stringify'](_0x50f1b8));if(_0x50f1b8[_0xdcf9('0x10')]){if(_0x50f1b8['error'][_0xdcf9('0x11')]===0x1f4){logger[_0xdcf9('0x10')]('Template,\x20%s,\x20%s',_0xf78464,_0x50f1b8[_0xdcf9('0x10')][_0xdcf9('0x12')]);return _0x59621d(_0x50f1b8['error'][_0xdcf9('0x12')]);}logger['error']('Template,\x20%s,\x20%s',_0xf78464,_0x50f1b8[_0xdcf9('0x10')]['message']);return _0x54d1fd(_0x50f1b8['error'][_0xdcf9('0x12')]);}else{logger[_0xdcf9('0xc')](_0xdcf9('0x13'),_0xf78464,_0xdcf9('0xd'));_0x54d1fd(_0x50f1b8[_0xdcf9('0x14')]['message']);}})[_0xdcf9('0x15')](function(_0x544ab1){logger[_0xdcf9('0x10')]('Template,\x20%s,\x20%s',_0xf78464,_0x544ab1);_0x59621d(_0x544ab1);});});}exports[_0xdcf9('0x16')]=function(_0x28cb5c){var _0x300a50=this;return new Promise(function(_0x5088bd,_0x3db447){return db['Template'][_0xdcf9('0x17')]({'raw':_0x28cb5c['options']?_0x28cb5c[_0xdcf9('0x18')][_0xdcf9('0x19')]===undefined?!![]:![]:!![],'where':_0x28cb5c[_0xdcf9('0x18')]?_0x28cb5c[_0xdcf9('0x18')][_0xdcf9('0x1a')]||null:null,'attributes':_0x28cb5c[_0xdcf9('0x18')]?_0x28cb5c[_0xdcf9('0x18')][_0xdcf9('0x1b')]||null:null,'limit':_0x28cb5c[_0xdcf9('0x18')]?_0x28cb5c['options'][_0xdcf9('0x1c')]||null:null,'include':_0x28cb5c[_0xdcf9('0x18')]?_0x28cb5c['options'][_0xdcf9('0x1d')]?_[_0xdcf9('0x1e')](_0x28cb5c[_0xdcf9('0x18')]['include'],function(_0x12688f){return{'model':db[_0x12688f[_0xdcf9('0x1f')]],'as':_0x12688f['as'],'attributes':_0x12688f[_0xdcf9('0x1b')],'include':_0x12688f[_0xdcf9('0x1d')]?_[_0xdcf9('0x1e')](_0x12688f['include'],function(_0x1051d3){return{'model':db[_0x1051d3[_0xdcf9('0x1f')]],'as':_0x1051d3['as'],'attributes':_0x1051d3['attributes'],'include':_0x1051d3[_0xdcf9('0x1d')]?_[_0xdcf9('0x1e')](_0x1051d3[_0xdcf9('0x1d')],function(_0x513651){return{'model':db[_0x513651['model']],'as':_0x513651['as'],'attributes':_0x513651[_0xdcf9('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xdcf9('0xb')](function(_0x57f405){logger[_0xdcf9('0xc')](_0xdcf9('0x16'),_0x28cb5c);logger[_0xdcf9('0xe')]('GetTemplate',_0x28cb5c,JSON[_0xdcf9('0x20')](_0x57f405));_0x5088bd(_0x57f405);})[_0xdcf9('0x15')](function(_0x473c66){logger['error'](_0xdcf9('0x16'),_0x473c66[_0xdcf9('0x12')],_0x28cb5c);_0x3db447(_0x300a50[_0xdcf9('0x10')](0x1f4,_0x473c66['message']));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index da40600..59138b8 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 _0x5692=['path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','get','isAuthenticated','index','show','/:id/all_conditions','/:id/any_conditions','/:id/actions','post','create','addAllCondition','addAnyCondition','addAction','put','/:id','update','delete','destroy','exports','multer'];(function(_0x3474c8,_0x433a13){var _0x41b56d=function(_0x44bf3a){while(--_0x44bf3a){_0x3474c8['push'](_0x3474c8['shift']());}};_0x41b56d(++_0x433a13);}(_0x5692,0x144));var _0x2569=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x5692[_0x126558];return _0x1f6d14;};'use strict';var multer=require(_0x2569('0x0'));var util=require('util');var path=require(_0x2569('0x1'));var timeout=require('connect-timeout');var express=require(_0x2569('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x2569('0x3'));var interaction=require(_0x2569('0x4'));var config=require(_0x2569('0x5'));var controller=require(_0x2569('0x6'));router[_0x2569('0x7')]('/',auth[_0x2569('0x8')](),controller[_0x2569('0x9')]);router[_0x2569('0x7')]('/:id',auth[_0x2569('0x8')](),controller[_0x2569('0xa')]);router['get'](_0x2569('0xb'),auth[_0x2569('0x8')](),controller['getAllConditions']);router[_0x2569('0x7')](_0x2569('0xc'),auth['isAuthenticated'](),controller['getAnyConditions']);router[_0x2569('0x7')](_0x2569('0xd'),auth[_0x2569('0x8')](),controller['getActions']);router[_0x2569('0xe')]('/',auth[_0x2569('0x8')](),controller[_0x2569('0xf')]);router['post'](_0x2569('0xb'),auth[_0x2569('0x8')](),controller[_0x2569('0x10')]);router[_0x2569('0xe')](_0x2569('0xc'),auth['isAuthenticated'](),controller[_0x2569('0x11')]);router[_0x2569('0xe')](_0x2569('0xd'),auth['isAuthenticated'](),controller[_0x2569('0x12')]);router[_0x2569('0x13')](_0x2569('0x14'),auth[_0x2569('0x8')](),controller[_0x2569('0x15')]);router[_0x2569('0x16')](_0x2569('0x14'),auth[_0x2569('0x8')](),controller[_0x2569('0x17')]);module[_0x2569('0x18')]=router; \ No newline at end of file +var _0x75a2=['update','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','get','isAuthenticated','/:id','/:id/all_conditions','getAnyConditions','getActions','post','create','addAllCondition','addAnyCondition','/:id/actions','addAction','put'];(function(_0x9aab40,_0x41367c){var _0x2bd78d=function(_0x2999cd){while(--_0x2999cd){_0x9aab40['push'](_0x9aab40['shift']());}};_0x2bd78d(++_0x41367c);}(_0x75a2,0x85));var _0x275a=function(_0x301d01,_0x5f14b2){_0x301d01=_0x301d01-0x0;var _0x4b3439=_0x75a2[_0x301d01];return _0x4b3439;};'use strict';var multer=require(_0x275a('0x0'));var util=require(_0x275a('0x1'));var path=require(_0x275a('0x2'));var timeout=require(_0x275a('0x3'));var express=require(_0x275a('0x4'));var router=express['Router']();var fs_extra=require(_0x275a('0x5'));var auth=require(_0x275a('0x6'));var interaction=require(_0x275a('0x7'));var config=require(_0x275a('0x8'));var controller=require(_0x275a('0x9'));router[_0x275a('0xa')]('/',auth[_0x275a('0xb')](),controller['index']);router[_0x275a('0xa')](_0x275a('0xc'),auth[_0x275a('0xb')](),controller['show']);router[_0x275a('0xa')](_0x275a('0xd'),auth[_0x275a('0xb')](),controller['getAllConditions']);router[_0x275a('0xa')]('/:id/any_conditions',auth['isAuthenticated'](),controller[_0x275a('0xe')]);router['get']('/:id/actions',auth['isAuthenticated'](),controller[_0x275a('0xf')]);router[_0x275a('0x10')]('/',auth[_0x275a('0xb')](),controller[_0x275a('0x11')]);router['post']('/:id/all_conditions',auth[_0x275a('0xb')](),controller[_0x275a('0x12')]);router[_0x275a('0x10')]('/:id/any_conditions',auth[_0x275a('0xb')](),controller[_0x275a('0x13')]);router[_0x275a('0x10')](_0x275a('0x14'),auth[_0x275a('0xb')](),controller[_0x275a('0x15')]);router[_0x275a('0x16')](_0x275a('0xc'),auth[_0x275a('0xb')](),controller[_0x275a('0x17')]);router[_0x275a('0x18')](_0x275a('0xc'),auth[_0x275a('0xb')](),controller[_0x275a('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index dfae6b7..da763ee 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 _0x245d=['sequelize','exports','STRING'];(function(_0x3faa78,_0x120a2b){var _0x1012bf=function(_0x56a9cf){while(--_0x56a9cf){_0x3faa78['push'](_0x3faa78['shift']());}};_0x1012bf(++_0x120a2b);}(_0x245d,0x126));var _0xd245=function(_0x2f6ea1,_0x1a5aa3){_0x2f6ea1=_0x2f6ea1-0x0;var _0x2e6309=_0x245d[_0x2f6ea1];return _0x2e6309;};'use strict';var Sequelize=require(_0xd245('0x0'));module[_0xd245('0x1')]={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xd245('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xd083=['exports','STRING','BOOLEAN','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd083,0x19b));var _0x3d08=function(_0x11ca63,_0xea9f9c){_0x11ca63=_0x11ca63-0x0;var _0x41f1f6=_0xd083[_0x11ca63];return _0x41f1f6;};'use strict';var Sequelize=require(_0x3d08('0x0'));module[_0x3d08('0x1')]={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x3d08('0x2')]},'status':{'type':Sequelize[_0x3d08('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 2d6de88..fe01acb 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 _0xdf81=['ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','count','limit','set','apply','reject','update','then','destroy','get','Triggers','UserProfileResource','name','index','map','Trigger','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','catch','show','params','model','includeAll','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','TriggerAllId','addAnyCondition','getAllConditions','findOne','Condition','getAnyConditions','addAction','getActions','Action','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','desk.js','to-csv','papaparse'];(function(_0x2203b3,_0x12aa65){var _0x3e095a=function(_0x1f9bfb){while(--_0x1f9bfb){_0x2203b3['push'](_0x2203b3['shift']());}};_0x3e095a(++_0x12aa65);}(_0xdf81,0x1ad));var _0x1df8=function(_0x101e7b,_0x4ef05b){_0x101e7b=_0x101e7b-0x0;var _0x4995c0=_0xdf81[_0x101e7b];return _0x4995c0;};'use strict';var emlformat=require(_0x1df8('0x0'));var rimraf=require(_0x1df8('0x1'));var zipdir=require(_0x1df8('0x2'));var jsonpatch=require(_0x1df8('0x3'));var rp=require('request-promise');var moment=require(_0x1df8('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x1df8('0x5'));var util=require(_0x1df8('0x6'));var path=require(_0x1df8('0x7'));var sox=require(_0x1df8('0x8'));var csv=require('to-csv');var ejs=require(_0x1df8('0x9'));var fs=require('fs');var fs_extra=require(_0x1df8('0xa'));var _=require(_0x1df8('0xb'));var squel=require('squel');var crypto=require(_0x1df8('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x1df8('0xd'));var toCsv=require(_0x1df8('0xe'));var querystring=require('querystring');var Papa=require(_0x1df8('0xf'));var Redis=require(_0x1df8('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x1df8('0x11'));var as=require(_0x1df8('0x12'));var hardwareService=require(_0x1df8('0x13'));var logger=require('../../config/logger')(_0x1df8('0x14'));var utils=require(_0x1df8('0x15'));var config=require(_0x1df8('0x16'));var licenseUtil=require(_0x1df8('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2d79ec,_0x798ef9){_0x798ef9=_0x798ef9||0xcc;return function(_0x59ff2a){if(_0x59ff2a){return _0x2d79ec[_0x1df8('0x18')](_0x798ef9);}return _0x2d79ec[_0x1df8('0x19')](_0x798ef9)['end']();};}function respondWithResult(_0x1a56cc,_0x173265){_0x173265=_0x173265||0xc8;return function(_0x14c598){if(_0x14c598){return _0x1a56cc['status'](_0x173265)[_0x1df8('0x1a')](_0x14c598);}};}function respondWithFilteredResult(_0x2b2bbf,_0x6c9b80){return function(_0x4e5a9c){if(_0x4e5a9c){var _0x411159=typeof _0x6c9b80[_0x1df8('0x1b')]===_0x1df8('0x1c')&&typeof _0x6c9b80['limit']===_0x1df8('0x1c');var _0xd5b277=_0x4e5a9c[_0x1df8('0x1d')];var _0x946fd1=_0x411159?0x0:_0x6c9b80[_0x1df8('0x1b')];var _0x4b5206=_0x411159?_0x4e5a9c['count']:_0x6c9b80['offset']+_0x6c9b80[_0x1df8('0x1e')];var _0x3e06c2;if(_0x4b5206>=_0xd5b277){_0x4b5206=_0xd5b277;_0x3e06c2=0xc8;}else{_0x3e06c2=0xce;}_0x2b2bbf[_0x1df8('0x19')](_0x3e06c2);return _0x2b2bbf[_0x1df8('0x1f')]('Content-Range',_0x946fd1+'-'+_0x4b5206+'/'+_0xd5b277)['json'](_0x4e5a9c);}return null;};}function patchUpdates(_0x25a113){return function(_0x268598){try{jsonpatch[_0x1df8('0x20')](_0x268598,_0x25a113,!![]);}catch(_0x5080ef){return BPromise[_0x1df8('0x21')](_0x5080ef);}return _0x268598['save']();};}function saveUpdates(_0x4e37af,_0x4dcae0){return function(_0x19e7e0){if(_0x19e7e0){return _0x19e7e0[_0x1df8('0x22')](_0x4e37af)[_0x1df8('0x23')](function(_0x5651a7){return _0x5651a7;});}return null;};}function removeEntity(_0x258089,_0x284966){return function(_0x2aaf22){if(_0x2aaf22){return _0x2aaf22[_0x1df8('0x24')]()[_0x1df8('0x23')](function(){var _0x3f18c8=_0x2aaf22[_0x1df8('0x25')]({'plain':!![]});var _0x20ea5e=_0x1df8('0x26');return db[_0x1df8('0x27')][_0x1df8('0x24')]({'where':{'type':_0x20ea5e,'resourceId':_0x3f18c8['id']}})['then'](function(){return _0x2aaf22;});})[_0x1df8('0x23')](function(){_0x258089[_0x1df8('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x30680b,_0x2c5210){return function(_0x5c6296){if(!_0x5c6296){_0x30680b[_0x1df8('0x18')](0x194);}return _0x5c6296;};}function handleError(_0x709d6f,_0x4f6116){_0x4f6116=_0x4f6116||0x1f4;return function(_0x35dc5f){logger['error'](_0x35dc5f['stack']);if(_0x35dc5f['name']){delete _0x35dc5f[_0x1df8('0x28')];}_0x709d6f['status'](_0x4f6116)['send'](_0x35dc5f);};}exports[_0x1df8('0x29')]=function(_0x486aa2,_0x446442){var _0x473c6b={},_0x3abf08={},_0x1c51a2={'count':0x0,'rows':[]};var _0x2fa8ae=_[_0x1df8('0x2a')](db[_0x1df8('0x2b')][_0x1df8('0x2c')],function(_0x2b4ee5){return{'name':_0x2b4ee5[_0x1df8('0x2d')],'type':_0x2b4ee5[_0x1df8('0x2e')][_0x1df8('0x2f')]};});_0x3abf08['model']=_['map'](_0x2fa8ae,'name');_0x3abf08[_0x1df8('0x30')]=_[_0x1df8('0x31')](_0x486aa2[_0x1df8('0x30')]);_0x3abf08[_0x1df8('0x32')]=_[_0x1df8('0x33')](_0x3abf08['model'],_0x3abf08['query']);_0x473c6b[_0x1df8('0x34')]=_[_0x1df8('0x33')](_0x3abf08['model'],qs[_0x1df8('0x35')](_0x486aa2[_0x1df8('0x30')][_0x1df8('0x35')]));_0x473c6b[_0x1df8('0x34')]=_0x473c6b[_0x1df8('0x34')][_0x1df8('0x36')]?_0x473c6b[_0x1df8('0x34')]:_0x3abf08['model'];if(!_0x486aa2[_0x1df8('0x30')][_0x1df8('0x37')](_0x1df8('0x38'))){_0x473c6b[_0x1df8('0x1e')]=qs[_0x1df8('0x1e')](_0x486aa2[_0x1df8('0x30')][_0x1df8('0x1e')]);_0x473c6b['offset']=qs[_0x1df8('0x1b')](_0x486aa2[_0x1df8('0x30')][_0x1df8('0x1b')]);}_0x473c6b[_0x1df8('0x39')]=qs[_0x1df8('0x3a')](_0x486aa2[_0x1df8('0x30')]['sort']);_0x473c6b[_0x1df8('0x3b')]=qs[_0x1df8('0x32')](_[_0x1df8('0x3c')](_0x486aa2['query'],_0x3abf08[_0x1df8('0x32')]),_0x2fa8ae);if(_0x486aa2[_0x1df8('0x30')][_0x1df8('0x3d')]){_0x473c6b[_0x1df8('0x3b')]=_['merge'](_0x473c6b[_0x1df8('0x3b')],{'$or':_[_0x1df8('0x2a')](_0x2fa8ae,function(_0x39f3fd){if(_0x39f3fd[_0x1df8('0x2e')]!==_0x1df8('0x3e')){var _0x4a8e9b={};_0x4a8e9b[_0x39f3fd[_0x1df8('0x28')]]={'$like':'%'+_0x486aa2[_0x1df8('0x30')]['filter']+'%'};return _0x4a8e9b;}})});}_0x473c6b=_[_0x1df8('0x3f')]({},_0x473c6b,_0x486aa2['options']);var _0x9de71={'where':_0x473c6b['where']};return db[_0x1df8('0x2b')]['count'](_0x9de71)[_0x1df8('0x23')](function(_0x2ea30b){_0x1c51a2[_0x1df8('0x1d')]=_0x2ea30b;if(_0x486aa2[_0x1df8('0x30')]['includeAll']){_0x473c6b['include']=[{'all':!![]}];}return db['Trigger']['findAll'](_0x473c6b);})[_0x1df8('0x23')](function(_0x262d19){_0x1c51a2['rows']=_0x262d19;return _0x1c51a2;})[_0x1df8('0x23')](respondWithFilteredResult(_0x446442,_0x473c6b))[_0x1df8('0x40')](handleError(_0x446442,null));};exports[_0x1df8('0x41')]=function(_0x19a4a0,_0x131394){var _0x5aa1a9={'raw':![],'where':{'id':_0x19a4a0[_0x1df8('0x42')]['id']}},_0x562914={};_0x562914[_0x1df8('0x43')]=_[_0x1df8('0x31')](db[_0x1df8('0x2b')]['rawAttributes']);_0x562914[_0x1df8('0x30')]=_['keys'](_0x19a4a0[_0x1df8('0x30')]);_0x562914[_0x1df8('0x32')]=_[_0x1df8('0x33')](_0x562914['model'],_0x562914[_0x1df8('0x30')]);_0x5aa1a9[_0x1df8('0x34')]=_[_0x1df8('0x33')](_0x562914[_0x1df8('0x43')],qs[_0x1df8('0x35')](_0x19a4a0[_0x1df8('0x30')][_0x1df8('0x35')]));_0x5aa1a9[_0x1df8('0x34')]=_0x5aa1a9[_0x1df8('0x34')][_0x1df8('0x36')]?_0x5aa1a9[_0x1df8('0x34')]:_0x562914[_0x1df8('0x43')];if(_0x19a4a0['query'][_0x1df8('0x44')]){_0x5aa1a9[_0x1df8('0x45')]=[{'all':!![]}];}_0x5aa1a9=_[_0x1df8('0x3f')]({},_0x5aa1a9,_0x19a4a0[_0x1df8('0x46')]);return db[_0x1df8('0x2b')][_0x1df8('0x47')](_0x5aa1a9)[_0x1df8('0x23')](handleEntityNotFound(_0x131394,null))[_0x1df8('0x23')](respondWithResult(_0x131394,null))[_0x1df8('0x40')](handleError(_0x131394,null));};exports[_0x1df8('0x48')]=function(_0x49c648,_0x4af87d){return db[_0x1df8('0x2b')]['create'](_0x49c648[_0x1df8('0x49')],{})['then'](function(_0x49f02e){var _0x1fdeb3=_0x49c648[_0x1df8('0x4a')][_0x1df8('0x25')]({'plain':!![]});if(!_0x1fdeb3)throw new Error(_0x1df8('0x4b'));if(_0x1fdeb3['role']===_0x1df8('0x4a')){var _0x586e55=_0x49f02e['get']({'plain':!![]});var _0x2f0ae1=_0x1df8('0x26');return db[_0x1df8('0x4c')][_0x1df8('0x47')]({'where':{'name':_0x2f0ae1,'userProfileId':_0x1fdeb3['userProfileId']},'raw':!![]})[_0x1df8('0x23')](function(_0x1b1498){if(_0x1b1498&&_0x1b1498['autoAssociation']===0x0){return db['UserProfileResource'][_0x1df8('0x48')]({'name':_0x586e55['name'],'resourceId':_0x586e55['id'],'type':_0x1b1498[_0x1df8('0x28')],'sectionId':_0x1b1498['id']},{})[_0x1df8('0x23')](function(){return _0x49f02e;});}else{return _0x49f02e;}})[_0x1df8('0x40')](function(_0x4648da){logger[_0x1df8('0x4d')](_0x1df8('0x4e'),_0x4648da);throw _0x4648da;});}return _0x49f02e;})[_0x1df8('0x23')](respondWithResult(_0x4af87d,0xc9))[_0x1df8('0x40')](handleError(_0x4af87d,null));};exports[_0x1df8('0x22')]=function(_0x4e110c,_0x20b3f8){if(_0x4e110c[_0x1df8('0x49')]['id']){delete _0x4e110c[_0x1df8('0x49')]['id'];}return db[_0x1df8('0x2b')][_0x1df8('0x47')]({'where':{'id':_0x4e110c['params']['id']}})[_0x1df8('0x23')](handleEntityNotFound(_0x20b3f8,null))[_0x1df8('0x23')](saveUpdates(_0x4e110c[_0x1df8('0x49')],null))['then'](respondWithResult(_0x20b3f8,null))[_0x1df8('0x40')](handleError(_0x20b3f8,null));};exports[_0x1df8('0x24')]=function(_0x4a2b73,_0x4b19e5){return db[_0x1df8('0x2b')][_0x1df8('0x47')]({'where':{'id':_0x4a2b73['params']['id']}})[_0x1df8('0x23')](handleEntityNotFound(_0x4b19e5,null))[_0x1df8('0x23')](removeEntity(_0x4b19e5,null))[_0x1df8('0x40')](handleError(_0x4b19e5,null));};exports[_0x1df8('0x4f')]=function(_0x6dd714,_0x58ab44,_0x54c6cf){if(_0x6dd714['body']['id']){delete _0x6dd714[_0x1df8('0x49')]['id'];}return db[_0x1df8('0x2b')][_0x1df8('0x47')]({'where':{'id':_0x6dd714[_0x1df8('0x42')]['id']}})[_0x1df8('0x23')](handleEntityNotFound(_0x58ab44,null))[_0x1df8('0x23')](function(_0x3760ca){if(_0x3760ca){_0x6dd714[_0x1df8('0x49')][_0x1df8('0x50')]=_0x3760ca['id'];return db['Condition'][_0x1df8('0x48')](_0x6dd714['body']);}})['then'](respondWithResult(_0x58ab44,null))[_0x1df8('0x40')](handleError(_0x58ab44,null));};exports[_0x1df8('0x51')]=function(_0x3fd93c,_0x1a8334,_0x41c9c3){if(_0x3fd93c[_0x1df8('0x49')]['id']){delete _0x3fd93c[_0x1df8('0x49')]['id'];}return db['Trigger'][_0x1df8('0x47')]({'where':{'id':_0x3fd93c[_0x1df8('0x42')]['id']}})[_0x1df8('0x23')](handleEntityNotFound(_0x1a8334,null))[_0x1df8('0x23')](function(_0x42bd7f){if(_0x42bd7f){_0x3fd93c[_0x1df8('0x49')]['TriggerAnyId']=_0x42bd7f['id'];return db['Condition'][_0x1df8('0x48')](_0x3fd93c[_0x1df8('0x49')]);}})[_0x1df8('0x23')](respondWithResult(_0x1a8334,null))[_0x1df8('0x40')](handleError(_0x1a8334,null));};exports[_0x1df8('0x52')]=function(_0x259d7a,_0x1c2d4e,_0xab67ee){var _0x55fc1b={};var _0x36ebba={};var _0x5600dc;var _0x4c2646;return db[_0x1df8('0x2b')][_0x1df8('0x53')]({'where':{'id':_0x259d7a[_0x1df8('0x42')]['id']}})[_0x1df8('0x23')](handleEntityNotFound(_0x1c2d4e,null))[_0x1df8('0x23')](function(_0x27118b){if(_0x27118b){_0x5600dc=_0x27118b;_0x36ebba[_0x1df8('0x43')]=_[_0x1df8('0x31')](db[_0x1df8('0x54')][_0x1df8('0x2c')]);_0x36ebba[_0x1df8('0x30')]=_[_0x1df8('0x31')](_0x259d7a[_0x1df8('0x30')]);_0x36ebba[_0x1df8('0x32')]=_[_0x1df8('0x33')](_0x36ebba[_0x1df8('0x43')],_0x36ebba[_0x1df8('0x30')]);_0x55fc1b[_0x1df8('0x34')]=_['intersection'](_0x36ebba[_0x1df8('0x43')],qs[_0x1df8('0x35')](_0x259d7a[_0x1df8('0x30')][_0x1df8('0x35')]));_0x55fc1b['attributes']=_0x55fc1b[_0x1df8('0x34')][_0x1df8('0x36')]?_0x55fc1b[_0x1df8('0x34')]:_0x36ebba[_0x1df8('0x43')];_0x55fc1b['order']=qs[_0x1df8('0x3a')](_0x259d7a[_0x1df8('0x30')][_0x1df8('0x3a')]);_0x55fc1b[_0x1df8('0x3b')]=qs[_0x1df8('0x32')](_[_0x1df8('0x3c')](_0x259d7a['query'],_0x36ebba[_0x1df8('0x32')]));if(_0x259d7a['query']['filter']){_0x55fc1b[_0x1df8('0x3b')]=_[_0x1df8('0x3f')](_0x55fc1b[_0x1df8('0x3b')],{'$or':_['map'](_0x55fc1b['attributes'],function(_0x322e65){var _0x4b9a91={};_0x4b9a91[_0x322e65]={'$like':'%'+_0x259d7a[_0x1df8('0x30')][_0x1df8('0x3d')]+'%'};return _0x4b9a91;})});}_0x55fc1b=_[_0x1df8('0x3f')]({},_0x55fc1b,_0x259d7a[_0x1df8('0x46')]);return _0x5600dc[_0x1df8('0x52')](_0x55fc1b);}})[_0x1df8('0x23')](function(_0x2b60e9){if(_0x2b60e9){_0x4c2646=_0x2b60e9['length'];if(!_0x259d7a['query'][_0x1df8('0x37')](_0x1df8('0x38'))){_0x55fc1b[_0x1df8('0x1e')]=qs['limit'](_0x259d7a[_0x1df8('0x30')][_0x1df8('0x1e')]);_0x55fc1b['offset']=qs['offset'](_0x259d7a[_0x1df8('0x30')][_0x1df8('0x1b')]);}return _0x5600dc[_0x1df8('0x52')](_0x55fc1b);}})[_0x1df8('0x23')](function(_0x2bd1f9){if(_0x2bd1f9){return _0x2bd1f9?{'count':_0x4c2646,'rows':_0x2bd1f9}:null;}})[_0x1df8('0x23')](respondWithResult(_0x1c2d4e,null))[_0x1df8('0x40')](handleError(_0x1c2d4e,null));};exports[_0x1df8('0x55')]=function(_0x4b4239,_0x41750f,_0x455b1b){var _0x4d6b07={};var _0x132294={};var _0x3ad57b;var _0x42dc62;return db[_0x1df8('0x2b')]['findOne']({'where':{'id':_0x4b4239[_0x1df8('0x42')]['id']}})[_0x1df8('0x23')](handleEntityNotFound(_0x41750f,null))[_0x1df8('0x23')](function(_0xd813fa){if(_0xd813fa){_0x3ad57b=_0xd813fa;_0x132294[_0x1df8('0x43')]=_[_0x1df8('0x31')](db[_0x1df8('0x54')][_0x1df8('0x2c')]);_0x132294['query']=_[_0x1df8('0x31')](_0x4b4239[_0x1df8('0x30')]);_0x132294[_0x1df8('0x32')]=_['intersection'](_0x132294[_0x1df8('0x43')],_0x132294[_0x1df8('0x30')]);_0x4d6b07[_0x1df8('0x34')]=_[_0x1df8('0x33')](_0x132294[_0x1df8('0x43')],qs['fields'](_0x4b4239[_0x1df8('0x30')][_0x1df8('0x35')]));_0x4d6b07[_0x1df8('0x34')]=_0x4d6b07['attributes'][_0x1df8('0x36')]?_0x4d6b07['attributes']:_0x132294[_0x1df8('0x43')];_0x4d6b07[_0x1df8('0x39')]=qs[_0x1df8('0x3a')](_0x4b4239[_0x1df8('0x30')][_0x1df8('0x3a')]);_0x4d6b07[_0x1df8('0x3b')]=qs[_0x1df8('0x32')](_[_0x1df8('0x3c')](_0x4b4239['query'],_0x132294[_0x1df8('0x32')]));if(_0x4b4239[_0x1df8('0x30')]['filter']){_0x4d6b07['where']=_[_0x1df8('0x3f')](_0x4d6b07[_0x1df8('0x3b')],{'$or':_[_0x1df8('0x2a')](_0x4d6b07[_0x1df8('0x34')],function(_0x22fe55){var _0xd0f0d4={};_0xd0f0d4[_0x22fe55]={'$like':'%'+_0x4b4239[_0x1df8('0x30')][_0x1df8('0x3d')]+'%'};return _0xd0f0d4;})});}_0x4d6b07=_['merge']({},_0x4d6b07,_0x4b4239['options']);return _0x3ad57b[_0x1df8('0x55')](_0x4d6b07);}})['then'](function(_0x5cb991){if(_0x5cb991){_0x42dc62=_0x5cb991[_0x1df8('0x36')];if(!_0x4b4239[_0x1df8('0x30')][_0x1df8('0x37')](_0x1df8('0x38'))){_0x4d6b07[_0x1df8('0x1e')]=qs['limit'](_0x4b4239[_0x1df8('0x30')][_0x1df8('0x1e')]);_0x4d6b07[_0x1df8('0x1b')]=qs['offset'](_0x4b4239['query'][_0x1df8('0x1b')]);}return _0x3ad57b[_0x1df8('0x55')](_0x4d6b07);}})[_0x1df8('0x23')](function(_0x598819){if(_0x598819){return _0x598819?{'count':_0x42dc62,'rows':_0x598819}:null;}})['then'](respondWithResult(_0x41750f,null))[_0x1df8('0x40')](handleError(_0x41750f,null));};exports[_0x1df8('0x56')]=function(_0x3bca7b,_0x2225fb,_0x3a2474){if(_0x3bca7b['body']['id']){delete _0x3bca7b[_0x1df8('0x49')]['id'];}return db['Trigger']['find']({'where':{'id':_0x3bca7b[_0x1df8('0x42')]['id']}})['then'](handleEntityNotFound(_0x2225fb,null))[_0x1df8('0x23')](function(_0x133538){if(_0x133538){_0x3bca7b[_0x1df8('0x49')]['TriggerId']=_0x133538['id'];return db['Action'][_0x1df8('0x48')](_0x3bca7b[_0x1df8('0x49')]);}})['then'](respondWithResult(_0x2225fb,null))[_0x1df8('0x40')](handleError(_0x2225fb,null));};exports[_0x1df8('0x57')]=function(_0x5da385,_0x105fd9,_0x1ccdab){var _0x16c590={};var _0x579ae5={};var _0x2f8026;var _0x4a183e;return db['Trigger']['findOne']({'where':{'id':_0x5da385['params']['id']}})[_0x1df8('0x23')](handleEntityNotFound(_0x105fd9,null))['then'](function(_0x1a66f8){if(_0x1a66f8){_0x2f8026=_0x1a66f8;_0x579ae5[_0x1df8('0x43')]=_[_0x1df8('0x31')](db[_0x1df8('0x58')][_0x1df8('0x2c')]);_0x579ae5[_0x1df8('0x30')]=_[_0x1df8('0x31')](_0x5da385[_0x1df8('0x30')]);_0x579ae5[_0x1df8('0x32')]=_[_0x1df8('0x33')](_0x579ae5[_0x1df8('0x43')],_0x579ae5[_0x1df8('0x30')]);_0x16c590[_0x1df8('0x34')]=_['intersection'](_0x579ae5['model'],qs['fields'](_0x5da385[_0x1df8('0x30')][_0x1df8('0x35')]));_0x16c590[_0x1df8('0x34')]=_0x16c590[_0x1df8('0x34')]['length']?_0x16c590[_0x1df8('0x34')]:_0x579ae5[_0x1df8('0x43')];_0x16c590[_0x1df8('0x39')]=qs['sort'](_0x5da385[_0x1df8('0x30')][_0x1df8('0x3a')]);_0x16c590[_0x1df8('0x3b')]=qs[_0x1df8('0x32')](_[_0x1df8('0x3c')](_0x5da385[_0x1df8('0x30')],_0x579ae5[_0x1df8('0x32')]));if(_0x5da385['query']['filter']){_0x16c590[_0x1df8('0x3b')]=_[_0x1df8('0x3f')](_0x16c590[_0x1df8('0x3b')],{'$or':_[_0x1df8('0x2a')](_0x16c590['attributes'],function(_0x5d9538){var _0x10942c={};_0x10942c[_0x5d9538]={'$like':'%'+_0x5da385[_0x1df8('0x30')][_0x1df8('0x3d')]+'%'};return _0x10942c;})});}_0x16c590=_[_0x1df8('0x3f')]({},_0x16c590,_0x5da385[_0x1df8('0x46')]);return _0x2f8026['getActions'](_0x16c590);}})[_0x1df8('0x23')](function(_0x59a0ae){if(_0x59a0ae){_0x4a183e=_0x59a0ae['length'];if(!_0x5da385[_0x1df8('0x30')][_0x1df8('0x37')](_0x1df8('0x38'))){_0x16c590[_0x1df8('0x1e')]=qs[_0x1df8('0x1e')](_0x5da385['query']['limit']);_0x16c590[_0x1df8('0x1b')]=qs[_0x1df8('0x1b')](_0x5da385[_0x1df8('0x30')][_0x1df8('0x1b')]);}return _0x2f8026[_0x1df8('0x57')](_0x16c590);}})[_0x1df8('0x23')](function(_0x29ea56){if(_0x29ea56){return _0x29ea56?{'count':_0x4a183e,'rows':_0x29ea56}:null;}})[_0x1df8('0x23')](respondWithResult(_0x105fd9,null))[_0x1df8('0x40')](handleError(_0x105fd9,null));}; \ No newline at end of file +var _0xe1f7=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../config/license/util','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','destroy','Triggers','UserProfileResource','sendStatus','error','stack','name','index','map','Trigger','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','find','catch','create','body','user','role','get','userProfileId','autoAssociation','addAllCondition','Condition','addAnyCondition','TriggerAnyId','findOne','rawAttributes','order','getAllConditions','addAction','TriggerId','Action','getActions'];(function(_0x4a972d,_0xff9622){var _0x54267c=function(_0x21135b){while(--_0x21135b){_0x4a972d['push'](_0x4a972d['shift']());}};_0x54267c(++_0xff9622);}(_0xe1f7,0x168));var _0x7e1f=function(_0x35b195,_0x8893d5){_0x35b195=_0x35b195-0x0;var _0x2433bf=_0xe1f7[_0x35b195];return _0x2433bf;};'use strict';var emlformat=require(_0x7e1f('0x0'));var rimraf=require(_0x7e1f('0x1'));var zipdir=require(_0x7e1f('0x2'));var jsonpatch=require(_0x7e1f('0x3'));var rp=require(_0x7e1f('0x4'));var moment=require(_0x7e1f('0x5'));var BPromise=require(_0x7e1f('0x6'));var Mustache=require(_0x7e1f('0x7'));var util=require(_0x7e1f('0x8'));var path=require('path');var sox=require(_0x7e1f('0x9'));var csv=require('to-csv');var ejs=require(_0x7e1f('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7e1f('0xb'));var squel=require('squel');var crypto=require(_0x7e1f('0xc'));var jsforce=require(_0x7e1f('0xd'));var deskjs=require(_0x7e1f('0xe'));var toCsv=require(_0x7e1f('0xf'));var querystring=require('querystring');var Papa=require(_0x7e1f('0x10'));var Redis=require(_0x7e1f('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x7e1f('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7e1f('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x7e1f('0x14'));var licenseUtil=require(_0x7e1f('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x47f9b0,_0x1e74dc){_0x1e74dc=_0x1e74dc||0xcc;return function(_0x296441){if(_0x296441){return _0x47f9b0['sendStatus'](_0x1e74dc);}return _0x47f9b0[_0x7e1f('0x16')](_0x1e74dc)[_0x7e1f('0x17')]();};}function respondWithResult(_0x405f66,_0xd1622a){_0xd1622a=_0xd1622a||0xc8;return function(_0x7e096b){if(_0x7e096b){return _0x405f66['status'](_0xd1622a)[_0x7e1f('0x18')](_0x7e096b);}};}function respondWithFilteredResult(_0x30fa00,_0x4654c5){return function(_0x358518){if(_0x358518){var _0x5dd5cb=typeof _0x4654c5[_0x7e1f('0x19')]==='undefined'&&typeof _0x4654c5[_0x7e1f('0x1a')]===_0x7e1f('0x1b');var _0x54f302=_0x358518[_0x7e1f('0x1c')];var _0x120800=_0x5dd5cb?0x0:_0x4654c5[_0x7e1f('0x19')];var _0x38f3be=_0x5dd5cb?_0x358518['count']:_0x4654c5[_0x7e1f('0x19')]+_0x4654c5[_0x7e1f('0x1a')];var _0x34a7c2;if(_0x38f3be>=_0x54f302){_0x38f3be=_0x54f302;_0x34a7c2=0xc8;}else{_0x34a7c2=0xce;}_0x30fa00[_0x7e1f('0x16')](_0x34a7c2);return _0x30fa00[_0x7e1f('0x1d')](_0x7e1f('0x1e'),_0x120800+'-'+_0x38f3be+'/'+_0x54f302)[_0x7e1f('0x18')](_0x358518);}return null;};}function patchUpdates(_0x13e0ad){return function(_0x5ec5db){try{jsonpatch[_0x7e1f('0x1f')](_0x5ec5db,_0x13e0ad,!![]);}catch(_0x207ca4){return BPromise['reject'](_0x207ca4);}return _0x5ec5db[_0x7e1f('0x20')]();};}function saveUpdates(_0x482551,_0x13a8fa){return function(_0x3cf89c){if(_0x3cf89c){return _0x3cf89c[_0x7e1f('0x21')](_0x482551)[_0x7e1f('0x22')](function(_0x202d23){return _0x202d23;});}return null;};}function removeEntity(_0x52c6da,_0x312544){return function(_0x1e6611){if(_0x1e6611){return _0x1e6611[_0x7e1f('0x23')]()['then'](function(){var _0x5cfe67=_0x1e6611['get']({'plain':!![]});var _0x16f03e=_0x7e1f('0x24');return db[_0x7e1f('0x25')][_0x7e1f('0x23')]({'where':{'type':_0x16f03e,'resourceId':_0x5cfe67['id']}})[_0x7e1f('0x22')](function(){return _0x1e6611;});})[_0x7e1f('0x22')](function(){_0x52c6da[_0x7e1f('0x16')](0xcc)[_0x7e1f('0x17')]();});}};}function handleEntityNotFound(_0x253f0e,_0x53b8aa){return function(_0x3cb307){if(!_0x3cb307){_0x253f0e[_0x7e1f('0x26')](0x194);}return _0x3cb307;};}function handleError(_0x15c033,_0x14d626){_0x14d626=_0x14d626||0x1f4;return function(_0x486ae5){logger[_0x7e1f('0x27')](_0x486ae5[_0x7e1f('0x28')]);if(_0x486ae5[_0x7e1f('0x29')]){delete _0x486ae5[_0x7e1f('0x29')];}_0x15c033[_0x7e1f('0x16')](_0x14d626)['send'](_0x486ae5);};}exports[_0x7e1f('0x2a')]=function(_0x2eae59,_0x1f4305){var _0x3cb4fe={},_0x1d7783={},_0x2dcac5={'count':0x0,'rows':[]};var _0x43e485=_[_0x7e1f('0x2b')](db[_0x7e1f('0x2c')]['rawAttributes'],function(_0x397fc4){return{'name':_0x397fc4[_0x7e1f('0x2d')],'type':_0x397fc4['type'][_0x7e1f('0x2e')]};});_0x1d7783[_0x7e1f('0x2f')]=_[_0x7e1f('0x2b')](_0x43e485,'name');_0x1d7783[_0x7e1f('0x30')]=_[_0x7e1f('0x31')](_0x2eae59[_0x7e1f('0x30')]);_0x1d7783[_0x7e1f('0x32')]=_['intersection'](_0x1d7783[_0x7e1f('0x2f')],_0x1d7783[_0x7e1f('0x30')]);_0x3cb4fe[_0x7e1f('0x33')]=_[_0x7e1f('0x34')](_0x1d7783[_0x7e1f('0x2f')],qs['fields'](_0x2eae59[_0x7e1f('0x30')][_0x7e1f('0x35')]));_0x3cb4fe[_0x7e1f('0x33')]=_0x3cb4fe[_0x7e1f('0x33')][_0x7e1f('0x36')]?_0x3cb4fe['attributes']:_0x1d7783[_0x7e1f('0x2f')];if(!_0x2eae59[_0x7e1f('0x30')][_0x7e1f('0x37')](_0x7e1f('0x38'))){_0x3cb4fe[_0x7e1f('0x1a')]=qs[_0x7e1f('0x1a')](_0x2eae59[_0x7e1f('0x30')][_0x7e1f('0x1a')]);_0x3cb4fe['offset']=qs[_0x7e1f('0x19')](_0x2eae59[_0x7e1f('0x30')]['offset']);}_0x3cb4fe['order']=qs[_0x7e1f('0x39')](_0x2eae59[_0x7e1f('0x30')]['sort']);_0x3cb4fe[_0x7e1f('0x3a')]=qs[_0x7e1f('0x32')](_[_0x7e1f('0x3b')](_0x2eae59[_0x7e1f('0x30')],_0x1d7783[_0x7e1f('0x32')]),_0x43e485);if(_0x2eae59[_0x7e1f('0x30')][_0x7e1f('0x3c')]){_0x3cb4fe[_0x7e1f('0x3a')]=_[_0x7e1f('0x3d')](_0x3cb4fe[_0x7e1f('0x3a')],{'$or':_[_0x7e1f('0x2b')](_0x43e485,function(_0x57bd7e){if(_0x57bd7e['type']!==_0x7e1f('0x3e')){var _0x48fc17={};_0x48fc17[_0x57bd7e[_0x7e1f('0x29')]]={'$like':'%'+_0x2eae59[_0x7e1f('0x30')][_0x7e1f('0x3c')]+'%'};return _0x48fc17;}})});}_0x3cb4fe=_[_0x7e1f('0x3d')]({},_0x3cb4fe,_0x2eae59[_0x7e1f('0x3f')]);var _0x32a24e={'where':_0x3cb4fe[_0x7e1f('0x3a')]};return db[_0x7e1f('0x2c')][_0x7e1f('0x1c')](_0x32a24e)[_0x7e1f('0x22')](function(_0x5c049c){_0x2dcac5[_0x7e1f('0x1c')]=_0x5c049c;if(_0x2eae59['query'][_0x7e1f('0x40')]){_0x3cb4fe[_0x7e1f('0x41')]=[{'all':!![]}];}return db[_0x7e1f('0x2c')]['findAll'](_0x3cb4fe);})[_0x7e1f('0x22')](function(_0x554663){_0x2dcac5[_0x7e1f('0x42')]=_0x554663;return _0x2dcac5;})['then'](respondWithFilteredResult(_0x1f4305,_0x3cb4fe))['catch'](handleError(_0x1f4305,null));};exports[_0x7e1f('0x43')]=function(_0x28f9bd,_0x594db6){var _0x1a8611={'raw':![],'where':{'id':_0x28f9bd[_0x7e1f('0x44')]['id']}},_0x4c63c7={};_0x4c63c7['model']=_[_0x7e1f('0x31')](db[_0x7e1f('0x2c')]['rawAttributes']);_0x4c63c7['query']=_[_0x7e1f('0x31')](_0x28f9bd[_0x7e1f('0x30')]);_0x4c63c7[_0x7e1f('0x32')]=_[_0x7e1f('0x34')](_0x4c63c7[_0x7e1f('0x2f')],_0x4c63c7[_0x7e1f('0x30')]);_0x1a8611[_0x7e1f('0x33')]=_[_0x7e1f('0x34')](_0x4c63c7[_0x7e1f('0x2f')],qs[_0x7e1f('0x35')](_0x28f9bd['query']['fields']));_0x1a8611[_0x7e1f('0x33')]=_0x1a8611[_0x7e1f('0x33')][_0x7e1f('0x36')]?_0x1a8611[_0x7e1f('0x33')]:_0x4c63c7['model'];if(_0x28f9bd['query'][_0x7e1f('0x40')]){_0x1a8611[_0x7e1f('0x41')]=[{'all':!![]}];}_0x1a8611=_[_0x7e1f('0x3d')]({},_0x1a8611,_0x28f9bd['options']);return db['Trigger'][_0x7e1f('0x45')](_0x1a8611)[_0x7e1f('0x22')](handleEntityNotFound(_0x594db6,null))['then'](respondWithResult(_0x594db6,null))[_0x7e1f('0x46')](handleError(_0x594db6,null));};exports['create']=function(_0x27b3d2,_0x406fad){return db['Trigger'][_0x7e1f('0x47')](_0x27b3d2[_0x7e1f('0x48')],{})[_0x7e1f('0x22')](function(_0x52b7a0){var _0x1a89f3=_0x27b3d2[_0x7e1f('0x49')]['get']({'plain':!![]});if(!_0x1a89f3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1a89f3[_0x7e1f('0x4a')]===_0x7e1f('0x49')){var _0x1b3035=_0x52b7a0[_0x7e1f('0x4b')]({'plain':!![]});var _0x4e9051=_0x7e1f('0x24');return db['UserProfileSection'][_0x7e1f('0x45')]({'where':{'name':_0x4e9051,'userProfileId':_0x1a89f3[_0x7e1f('0x4c')]},'raw':!![]})[_0x7e1f('0x22')](function(_0x2c67d8){if(_0x2c67d8&&_0x2c67d8[_0x7e1f('0x4d')]===0x0){return db[_0x7e1f('0x25')][_0x7e1f('0x47')]({'name':_0x1b3035[_0x7e1f('0x29')],'resourceId':_0x1b3035['id'],'type':_0x2c67d8['name'],'sectionId':_0x2c67d8['id']},{})[_0x7e1f('0x22')](function(){return _0x52b7a0;});}else{return _0x52b7a0;}})[_0x7e1f('0x46')](function(_0x4ad10e){logger[_0x7e1f('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4ad10e);throw _0x4ad10e;});}return _0x52b7a0;})[_0x7e1f('0x22')](respondWithResult(_0x406fad,0xc9))[_0x7e1f('0x46')](handleError(_0x406fad,null));};exports[_0x7e1f('0x21')]=function(_0x30b44d,_0x5b9a80){if(_0x30b44d[_0x7e1f('0x48')]['id']){delete _0x30b44d[_0x7e1f('0x48')]['id'];}return db[_0x7e1f('0x2c')][_0x7e1f('0x45')]({'where':{'id':_0x30b44d[_0x7e1f('0x44')]['id']}})[_0x7e1f('0x22')](handleEntityNotFound(_0x5b9a80,null))['then'](saveUpdates(_0x30b44d[_0x7e1f('0x48')],null))[_0x7e1f('0x22')](respondWithResult(_0x5b9a80,null))[_0x7e1f('0x46')](handleError(_0x5b9a80,null));};exports['destroy']=function(_0x5dd808,_0x19fa54){return db[_0x7e1f('0x2c')][_0x7e1f('0x45')]({'where':{'id':_0x5dd808[_0x7e1f('0x44')]['id']}})['then'](handleEntityNotFound(_0x19fa54,null))['then'](removeEntity(_0x19fa54,null))['catch'](handleError(_0x19fa54,null));};exports[_0x7e1f('0x4e')]=function(_0x591dd8,_0x2beac4,_0x576d87){if(_0x591dd8[_0x7e1f('0x48')]['id']){delete _0x591dd8[_0x7e1f('0x48')]['id'];}return db[_0x7e1f('0x2c')][_0x7e1f('0x45')]({'where':{'id':_0x591dd8[_0x7e1f('0x44')]['id']}})[_0x7e1f('0x22')](handleEntityNotFound(_0x2beac4,null))[_0x7e1f('0x22')](function(_0x3cfdac){if(_0x3cfdac){_0x591dd8['body']['TriggerAllId']=_0x3cfdac['id'];return db[_0x7e1f('0x4f')]['create'](_0x591dd8['body']);}})[_0x7e1f('0x22')](respondWithResult(_0x2beac4,null))[_0x7e1f('0x46')](handleError(_0x2beac4,null));};exports[_0x7e1f('0x50')]=function(_0x3e59f5,_0x27b2b9,_0x44b4a9){if(_0x3e59f5[_0x7e1f('0x48')]['id']){delete _0x3e59f5['body']['id'];}return db[_0x7e1f('0x2c')][_0x7e1f('0x45')]({'where':{'id':_0x3e59f5['params']['id']}})['then'](handleEntityNotFound(_0x27b2b9,null))[_0x7e1f('0x22')](function(_0x295644){if(_0x295644){_0x3e59f5[_0x7e1f('0x48')][_0x7e1f('0x51')]=_0x295644['id'];return db[_0x7e1f('0x4f')][_0x7e1f('0x47')](_0x3e59f5[_0x7e1f('0x48')]);}})['then'](respondWithResult(_0x27b2b9,null))[_0x7e1f('0x46')](handleError(_0x27b2b9,null));};exports['getAllConditions']=function(_0x442906,_0x10d8d2,_0x26b6ca){var _0x11c6aa={};var _0x491cf8={};var _0x3f4c4d;var _0x52d106;return db[_0x7e1f('0x2c')][_0x7e1f('0x52')]({'where':{'id':_0x442906[_0x7e1f('0x44')]['id']}})[_0x7e1f('0x22')](handleEntityNotFound(_0x10d8d2,null))['then'](function(_0x1bac2c){if(_0x1bac2c){_0x3f4c4d=_0x1bac2c;_0x491cf8['model']=_[_0x7e1f('0x31')](db['Condition'][_0x7e1f('0x53')]);_0x491cf8[_0x7e1f('0x30')]=_['keys'](_0x442906['query']);_0x491cf8[_0x7e1f('0x32')]=_[_0x7e1f('0x34')](_0x491cf8[_0x7e1f('0x2f')],_0x491cf8[_0x7e1f('0x30')]);_0x11c6aa[_0x7e1f('0x33')]=_[_0x7e1f('0x34')](_0x491cf8[_0x7e1f('0x2f')],qs[_0x7e1f('0x35')](_0x442906[_0x7e1f('0x30')][_0x7e1f('0x35')]));_0x11c6aa[_0x7e1f('0x33')]=_0x11c6aa[_0x7e1f('0x33')][_0x7e1f('0x36')]?_0x11c6aa[_0x7e1f('0x33')]:_0x491cf8[_0x7e1f('0x2f')];_0x11c6aa[_0x7e1f('0x54')]=qs[_0x7e1f('0x39')](_0x442906[_0x7e1f('0x30')][_0x7e1f('0x39')]);_0x11c6aa[_0x7e1f('0x3a')]=qs[_0x7e1f('0x32')](_[_0x7e1f('0x3b')](_0x442906[_0x7e1f('0x30')],_0x491cf8['filters']));if(_0x442906[_0x7e1f('0x30')]['filter']){_0x11c6aa[_0x7e1f('0x3a')]=_['merge'](_0x11c6aa[_0x7e1f('0x3a')],{'$or':_[_0x7e1f('0x2b')](_0x11c6aa[_0x7e1f('0x33')],function(_0x442f90){var _0x2f7b5b={};_0x2f7b5b[_0x442f90]={'$like':'%'+_0x442906[_0x7e1f('0x30')][_0x7e1f('0x3c')]+'%'};return _0x2f7b5b;})});}_0x11c6aa=_['merge']({},_0x11c6aa,_0x442906[_0x7e1f('0x3f')]);return _0x3f4c4d['getAllConditions'](_0x11c6aa);}})['then'](function(_0x39430a){if(_0x39430a){_0x52d106=_0x39430a[_0x7e1f('0x36')];if(!_0x442906['query'][_0x7e1f('0x37')](_0x7e1f('0x38'))){_0x11c6aa[_0x7e1f('0x1a')]=qs['limit'](_0x442906[_0x7e1f('0x30')]['limit']);_0x11c6aa[_0x7e1f('0x19')]=qs[_0x7e1f('0x19')](_0x442906[_0x7e1f('0x30')][_0x7e1f('0x19')]);}return _0x3f4c4d[_0x7e1f('0x55')](_0x11c6aa);}})[_0x7e1f('0x22')](function(_0x3e7297){if(_0x3e7297){return _0x3e7297?{'count':_0x52d106,'rows':_0x3e7297}:null;}})[_0x7e1f('0x22')](respondWithResult(_0x10d8d2,null))[_0x7e1f('0x46')](handleError(_0x10d8d2,null));};exports['getAnyConditions']=function(_0x3a4b38,_0x571b00,_0x3f3e5a){var _0x12b97a={};var _0x145111={};var _0x3d0ed0;var _0x2dc5c9;return db[_0x7e1f('0x2c')][_0x7e1f('0x52')]({'where':{'id':_0x3a4b38['params']['id']}})[_0x7e1f('0x22')](handleEntityNotFound(_0x571b00,null))[_0x7e1f('0x22')](function(_0x7431e6){if(_0x7431e6){_0x3d0ed0=_0x7431e6;_0x145111['model']=_[_0x7e1f('0x31')](db[_0x7e1f('0x4f')][_0x7e1f('0x53')]);_0x145111[_0x7e1f('0x30')]=_['keys'](_0x3a4b38[_0x7e1f('0x30')]);_0x145111[_0x7e1f('0x32')]=_['intersection'](_0x145111[_0x7e1f('0x2f')],_0x145111[_0x7e1f('0x30')]);_0x12b97a[_0x7e1f('0x33')]=_[_0x7e1f('0x34')](_0x145111[_0x7e1f('0x2f')],qs[_0x7e1f('0x35')](_0x3a4b38[_0x7e1f('0x30')][_0x7e1f('0x35')]));_0x12b97a[_0x7e1f('0x33')]=_0x12b97a[_0x7e1f('0x33')][_0x7e1f('0x36')]?_0x12b97a[_0x7e1f('0x33')]:_0x145111[_0x7e1f('0x2f')];_0x12b97a[_0x7e1f('0x54')]=qs[_0x7e1f('0x39')](_0x3a4b38[_0x7e1f('0x30')]['sort']);_0x12b97a[_0x7e1f('0x3a')]=qs[_0x7e1f('0x32')](_[_0x7e1f('0x3b')](_0x3a4b38[_0x7e1f('0x30')],_0x145111[_0x7e1f('0x32')]));if(_0x3a4b38['query'][_0x7e1f('0x3c')]){_0x12b97a[_0x7e1f('0x3a')]=_[_0x7e1f('0x3d')](_0x12b97a[_0x7e1f('0x3a')],{'$or':_[_0x7e1f('0x2b')](_0x12b97a[_0x7e1f('0x33')],function(_0x1dd4bc){var _0x17609c={};_0x17609c[_0x1dd4bc]={'$like':'%'+_0x3a4b38[_0x7e1f('0x30')][_0x7e1f('0x3c')]+'%'};return _0x17609c;})});}_0x12b97a=_[_0x7e1f('0x3d')]({},_0x12b97a,_0x3a4b38[_0x7e1f('0x3f')]);return _0x3d0ed0['getAnyConditions'](_0x12b97a);}})['then'](function(_0x2580b1){if(_0x2580b1){_0x2dc5c9=_0x2580b1[_0x7e1f('0x36')];if(!_0x3a4b38[_0x7e1f('0x30')][_0x7e1f('0x37')](_0x7e1f('0x38'))){_0x12b97a['limit']=qs['limit'](_0x3a4b38[_0x7e1f('0x30')][_0x7e1f('0x1a')]);_0x12b97a[_0x7e1f('0x19')]=qs[_0x7e1f('0x19')](_0x3a4b38[_0x7e1f('0x30')][_0x7e1f('0x19')]);}return _0x3d0ed0['getAnyConditions'](_0x12b97a);}})[_0x7e1f('0x22')](function(_0x5e8cbc){if(_0x5e8cbc){return _0x5e8cbc?{'count':_0x2dc5c9,'rows':_0x5e8cbc}:null;}})['then'](respondWithResult(_0x571b00,null))[_0x7e1f('0x46')](handleError(_0x571b00,null));};exports[_0x7e1f('0x56')]=function(_0x19968e,_0x3a23fa,_0xbbcfc7){if(_0x19968e[_0x7e1f('0x48')]['id']){delete _0x19968e[_0x7e1f('0x48')]['id'];}return db['Trigger'][_0x7e1f('0x45')]({'where':{'id':_0x19968e[_0x7e1f('0x44')]['id']}})[_0x7e1f('0x22')](handleEntityNotFound(_0x3a23fa,null))[_0x7e1f('0x22')](function(_0x3e2dc6){if(_0x3e2dc6){_0x19968e[_0x7e1f('0x48')][_0x7e1f('0x57')]=_0x3e2dc6['id'];return db[_0x7e1f('0x58')]['create'](_0x19968e[_0x7e1f('0x48')]);}})[_0x7e1f('0x22')](respondWithResult(_0x3a23fa,null))[_0x7e1f('0x46')](handleError(_0x3a23fa,null));};exports[_0x7e1f('0x59')]=function(_0x336ad5,_0x1c8a3c,_0xf7bffb){var _0xbcbd9f={};var _0x18fd39={};var _0x5d0e28;var _0x591d05;return db[_0x7e1f('0x2c')][_0x7e1f('0x52')]({'where':{'id':_0x336ad5[_0x7e1f('0x44')]['id']}})['then'](handleEntityNotFound(_0x1c8a3c,null))['then'](function(_0x74c3d9){if(_0x74c3d9){_0x5d0e28=_0x74c3d9;_0x18fd39[_0x7e1f('0x2f')]=_[_0x7e1f('0x31')](db[_0x7e1f('0x58')][_0x7e1f('0x53')]);_0x18fd39[_0x7e1f('0x30')]=_[_0x7e1f('0x31')](_0x336ad5[_0x7e1f('0x30')]);_0x18fd39['filters']=_['intersection'](_0x18fd39[_0x7e1f('0x2f')],_0x18fd39['query']);_0xbcbd9f['attributes']=_[_0x7e1f('0x34')](_0x18fd39[_0x7e1f('0x2f')],qs[_0x7e1f('0x35')](_0x336ad5[_0x7e1f('0x30')]['fields']));_0xbcbd9f[_0x7e1f('0x33')]=_0xbcbd9f[_0x7e1f('0x33')]['length']?_0xbcbd9f[_0x7e1f('0x33')]:_0x18fd39[_0x7e1f('0x2f')];_0xbcbd9f[_0x7e1f('0x54')]=qs[_0x7e1f('0x39')](_0x336ad5['query'][_0x7e1f('0x39')]);_0xbcbd9f[_0x7e1f('0x3a')]=qs['filters'](_[_0x7e1f('0x3b')](_0x336ad5[_0x7e1f('0x30')],_0x18fd39[_0x7e1f('0x32')]));if(_0x336ad5['query'][_0x7e1f('0x3c')]){_0xbcbd9f['where']=_['merge'](_0xbcbd9f[_0x7e1f('0x3a')],{'$or':_[_0x7e1f('0x2b')](_0xbcbd9f['attributes'],function(_0x5affd5){var _0x42ed5f={};_0x42ed5f[_0x5affd5]={'$like':'%'+_0x336ad5[_0x7e1f('0x30')]['filter']+'%'};return _0x42ed5f;})});}_0xbcbd9f=_[_0x7e1f('0x3d')]({},_0xbcbd9f,_0x336ad5[_0x7e1f('0x3f')]);return _0x5d0e28[_0x7e1f('0x59')](_0xbcbd9f);}})['then'](function(_0x1d24b5){if(_0x1d24b5){_0x591d05=_0x1d24b5[_0x7e1f('0x36')];if(!_0x336ad5[_0x7e1f('0x30')][_0x7e1f('0x37')](_0x7e1f('0x38'))){_0xbcbd9f[_0x7e1f('0x1a')]=qs[_0x7e1f('0x1a')](_0x336ad5[_0x7e1f('0x30')][_0x7e1f('0x1a')]);_0xbcbd9f[_0x7e1f('0x19')]=qs['offset'](_0x336ad5[_0x7e1f('0x30')]['offset']);}return _0x5d0e28[_0x7e1f('0x59')](_0xbcbd9f);}})[_0x7e1f('0x22')](function(_0x57fd87){if(_0x57fd87){return _0x57fd87?{'count':_0x591d05,'rows':_0x57fd87}:null;}})[_0x7e1f('0x22')](respondWithResult(_0x1c8a3c,null))[_0x7e1f('0x46')](handleError(_0x1c8a3c,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index c0e6b74..b6c7f15 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 _0xa8eb=['bluebird','request-promise','rimraf','../../config/environment','exports','Trigger','tools_triggers','lodash','../../config/logger','moment'];(function(_0xafee51,_0x200069){var _0x1e553b=function(_0x4a9c0e){while(--_0x4a9c0e){_0xafee51['push'](_0xafee51['shift']());}};_0x1e553b(++_0x200069);}(_0xa8eb,0x179));var _0xba8e=function(_0xec10a6,_0x5e1108){_0xec10a6=_0xec10a6-0x0;var _0x2e6f1e=_0xa8eb[_0xec10a6];return _0x2e6f1e;};'use strict';var _=require(_0xba8e('0x0'));var util=require('util');var logger=require(_0xba8e('0x1'))('api');var moment=require(_0xba8e('0x2'));var BPromise=require(_0xba8e('0x3'));var rp=require(_0xba8e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xba8e('0x5'));var config=require(_0xba8e('0x6'));var attributes=require('./trigger.attributes');module[_0xba8e('0x7')]=function(_0x57e345,_0x14c3ac){return _0x57e345['define'](_0xba8e('0x8'),attributes,{'tableName':_0xba8e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc770=['path','rimraf','../../config/environment','./trigger.attributes','exports','define','tools_triggers','lodash','util','moment','bluebird','request-promise'];(function(_0x429113,_0x5859eb){var _0x27fe3=function(_0x2f432f){while(--_0x2f432f){_0x429113['push'](_0x429113['shift']());}};_0x27fe3(++_0x5859eb);}(_0xc770,0xd3));var _0x0c77=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc770[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x0c77('0x0'));var util=require(_0x0c77('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x0c77('0x2'));var BPromise=require(_0x0c77('0x3'));var rp=require(_0x0c77('0x4'));var fs=require('fs');var path=require(_0x0c77('0x5'));var rimraf=require(_0x0c77('0x6'));var config=require(_0x0c77('0x7'));var attributes=require(_0x0c77('0x8'));module[_0x0c77('0x9')]=function(_0x575bb3,_0x26a0ff){return _0x575bb3[_0x0c77('0xa')]('Trigger',attributes,{'tableName':_0x0c77('0xb'),'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 fe0c9eb..986a3f1 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 _0x81aa=['include','model','map','then','ShowTrigger','find','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','info','Trigger,\x20%s,\x20%s','debug','Trigger,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetTrigger','Trigger','findAll','raw','options','where','attributes','limit'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x81aa,0xde));var _0xa81a=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x81aa[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0xa81a('0x0'));var util=require(_0xa81a('0x1'));var moment=require(_0xa81a('0x2'));var BPromise=require('bluebird');var rs=require(_0xa81a('0x3'));var fs=require('fs');var Redis=require(_0xa81a('0x4'));var db=require(_0xa81a('0x5'))['db'];var utils=require(_0xa81a('0x6'));var logger=require('../../config/logger')(_0xa81a('0x7'));var config=require(_0xa81a('0x8'));var jayson=require(_0xa81a('0x9'));var client=jayson['client'][_0xa81a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x22e4a8,_0x42c97d,_0x260c2a){return new BPromise(function(_0x31338c,_0x32b97b){return client[_0xa81a('0xb')](_0x22e4a8,_0x260c2a)['then'](function(_0x408e9c){logger[_0xa81a('0xc')](_0xa81a('0xd'),_0x42c97d,'request\x20sent');logger[_0xa81a('0xe')](_0xa81a('0xf'),_0x42c97d,_0xa81a('0x10'),JSON[_0xa81a('0x11')](_0x408e9c));if(_0x408e9c[_0xa81a('0x12')]){if(_0x408e9c[_0xa81a('0x12')]['code']===0x1f4){logger['error'](_0xa81a('0xd'),_0x42c97d,_0x408e9c[_0xa81a('0x12')]['message']);return _0x32b97b(_0x408e9c['error'][_0xa81a('0x13')]);}logger[_0xa81a('0x12')]('Trigger,\x20%s,\x20%s',_0x42c97d,_0x408e9c[_0xa81a('0x12')][_0xa81a('0x13')]);return _0x31338c(_0x408e9c[_0xa81a('0x12')]['message']);}else{logger[_0xa81a('0xc')](_0xa81a('0xd'),_0x42c97d,_0xa81a('0x10'));_0x31338c(_0x408e9c[_0xa81a('0x14')]['message']);}})[_0xa81a('0x15')](function(_0x45773a){logger[_0xa81a('0x12')](_0xa81a('0xd'),_0x42c97d,_0x45773a);_0x32b97b(_0x45773a);});});}exports[_0xa81a('0x16')]=function(_0x57da21){var _0x1c7b8b=this;return new Promise(function(_0x9b3db9,_0x129149){return db[_0xa81a('0x17')][_0xa81a('0x18')]({'raw':_0x57da21['options']?_0x57da21['options'][_0xa81a('0x19')]===undefined?!![]:![]:!![],'where':_0x57da21[_0xa81a('0x1a')]?_0x57da21['options'][_0xa81a('0x1b')]||null:null,'attributes':_0x57da21[_0xa81a('0x1a')]?_0x57da21[_0xa81a('0x1a')][_0xa81a('0x1c')]||null:null,'limit':_0x57da21[_0xa81a('0x1a')]?_0x57da21[_0xa81a('0x1a')][_0xa81a('0x1d')]||null:null,'include':_0x57da21[_0xa81a('0x1a')]?_0x57da21['options'][_0xa81a('0x1e')]?_['map'](_0x57da21[_0xa81a('0x1a')][_0xa81a('0x1e')],function(_0x561e6b){return{'model':db[_0x561e6b[_0xa81a('0x1f')]],'as':_0x561e6b['as'],'attributes':_0x561e6b['attributes'],'include':_0x561e6b['include']?_[_0xa81a('0x20')](_0x561e6b[_0xa81a('0x1e')],function(_0x50219b){return{'model':db[_0x50219b[_0xa81a('0x1f')]],'as':_0x50219b['as'],'attributes':_0x50219b[_0xa81a('0x1c')],'include':_0x50219b['include']?_[_0xa81a('0x20')](_0x50219b[_0xa81a('0x1e')],function(_0x34c434){return{'model':db[_0x34c434['model']],'as':_0x34c434['as'],'attributes':_0x34c434[_0xa81a('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa81a('0x21')](function(_0x236a4b){logger[_0xa81a('0xc')](_0xa81a('0x16'),_0x57da21);logger[_0xa81a('0xe')](_0xa81a('0x16'),_0x57da21,JSON[_0xa81a('0x11')](_0x236a4b));_0x9b3db9(_0x236a4b);})['catch'](function(_0x3e30a9){logger[_0xa81a('0x12')]('GetTrigger',_0x3e30a9[_0xa81a('0x13')],_0x57da21);_0x129149(_0x1c7b8b[_0xa81a('0x12')](0x1f4,_0x3e30a9['message']));});});};exports[_0xa81a('0x22')]=function(_0x25ce34){var _0xbf6baa=this;return new Promise(function(_0x2271ad,_0xa5c7af){return db[_0xa81a('0x17')][_0xa81a('0x23')]({'raw':_0x25ce34[_0xa81a('0x1a')]?_0x25ce34[_0xa81a('0x1a')][_0xa81a('0x19')]===undefined?!![]:![]:!![],'where':_0x25ce34[_0xa81a('0x1a')]?_0x25ce34[_0xa81a('0x1a')]['where']||null:null,'attributes':_0x25ce34[_0xa81a('0x1a')]?_0x25ce34['options']['attributes']||null:null,'include':_0x25ce34[_0xa81a('0x1a')]?_0x25ce34[_0xa81a('0x1a')]['include']?_[_0xa81a('0x20')](_0x25ce34[_0xa81a('0x1a')][_0xa81a('0x1e')],function(_0x54661c){return{'model':db[_0x54661c[_0xa81a('0x1f')]],'as':_0x54661c['as'],'attributes':_0x54661c[_0xa81a('0x1c')],'include':_0x54661c[_0xa81a('0x1e')]?_[_0xa81a('0x20')](_0x54661c[_0xa81a('0x1e')],function(_0x2fb567){return{'model':db[_0x2fb567[_0xa81a('0x1f')]],'as':_0x2fb567['as'],'attributes':_0x2fb567[_0xa81a('0x1c')],'include':_0x2fb567[_0xa81a('0x1e')]?_[_0xa81a('0x20')](_0x2fb567[_0xa81a('0x1e')],function(_0x11c122){return{'model':db[_0x11c122[_0xa81a('0x1f')]],'as':_0x11c122['as'],'attributes':_0x11c122[_0xa81a('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa81a('0x21')](function(_0xa45de0){logger[_0xa81a('0xc')]('ShowTrigger',_0x25ce34);logger[_0xa81a('0xe')](_0xa81a('0x22'),_0x25ce34,JSON[_0xa81a('0x11')](_0xa45de0));_0x2271ad(_0xa45de0);})[_0xa81a('0x15')](function(_0x391e1f){logger[_0xa81a('0x12')](_0xa81a('0x22'),_0x391e1f[_0xa81a('0x13')],_0x25ce34);_0xa5c7af(_0xbf6baa[_0xa81a('0x12')](0x1f4,_0x391e1f[_0xa81a('0x13')]));});});}; \ No newline at end of file +var _0x2185=['rpc','client','http','request','then','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','Trigger','options','raw','attributes','limit','map','include','model','GetTrigger','ShowTrigger','find','util','moment','bluebird','randomstring','../../config/utils','../../config/logger'];(function(_0x2a1f92,_0x4800bf){var _0x4e4962=function(_0x27e672){while(--_0x27e672){_0x2a1f92['push'](_0x2a1f92['shift']());}};_0x4e4962(++_0x4800bf);}(_0x2185,0xc0));var _0x5218=function(_0x55a284,_0x5c59cc){_0x55a284=_0x55a284-0x0;var _0x409fed=_0x2185[_0x55a284];return _0x409fed;};'use strict';var _=require('lodash');var util=require(_0x5218('0x0'));var moment=require(_0x5218('0x1'));var BPromise=require(_0x5218('0x2'));var rs=require(_0x5218('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5218('0x4'));var logger=require(_0x5218('0x5'))(_0x5218('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5218('0x7')][_0x5218('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x21aadc,_0x4d1f0e,_0x2a0edd){return new BPromise(function(_0xa7c697,_0x680957){return client[_0x5218('0x9')](_0x21aadc,_0x2a0edd)[_0x5218('0xa')](function(_0x67a52e){logger[_0x5218('0xb')](_0x5218('0xc'),_0x4d1f0e,_0x5218('0xd'));logger[_0x5218('0xe')](_0x5218('0xf'),_0x4d1f0e,'request\x20sent',JSON[_0x5218('0x10')](_0x67a52e));if(_0x67a52e['error']){if(_0x67a52e['error'][_0x5218('0x11')]===0x1f4){logger[_0x5218('0x12')](_0x5218('0xc'),_0x4d1f0e,_0x67a52e['error']['message']);return _0x680957(_0x67a52e['error'][_0x5218('0x13')]);}logger[_0x5218('0x12')](_0x5218('0xc'),_0x4d1f0e,_0x67a52e[_0x5218('0x12')][_0x5218('0x13')]);return _0xa7c697(_0x67a52e[_0x5218('0x12')]['message']);}else{logger['info']('Trigger,\x20%s,\x20%s',_0x4d1f0e,_0x5218('0xd'));_0xa7c697(_0x67a52e[_0x5218('0x14')][_0x5218('0x13')]);}})[_0x5218('0x15')](function(_0x21a43d){logger[_0x5218('0x12')]('Trigger,\x20%s,\x20%s',_0x4d1f0e,_0x21a43d);_0x680957(_0x21a43d);});});}exports['GetTrigger']=function(_0x5a4673){var _0x3aedb9=this;return new Promise(function(_0x4dbd43,_0x368929){return db[_0x5218('0x16')]['findAll']({'raw':_0x5a4673[_0x5218('0x17')]?_0x5a4673[_0x5218('0x17')][_0x5218('0x18')]===undefined?!![]:![]:!![],'where':_0x5a4673['options']?_0x5a4673[_0x5218('0x17')]['where']||null:null,'attributes':_0x5a4673[_0x5218('0x17')]?_0x5a4673['options'][_0x5218('0x19')]||null:null,'limit':_0x5a4673[_0x5218('0x17')]?_0x5a4673[_0x5218('0x17')][_0x5218('0x1a')]||null:null,'include':_0x5a4673[_0x5218('0x17')]?_0x5a4673[_0x5218('0x17')]['include']?_[_0x5218('0x1b')](_0x5a4673[_0x5218('0x17')][_0x5218('0x1c')],function(_0x2ce579){return{'model':db[_0x2ce579[_0x5218('0x1d')]],'as':_0x2ce579['as'],'attributes':_0x2ce579[_0x5218('0x19')],'include':_0x2ce579['include']?_[_0x5218('0x1b')](_0x2ce579[_0x5218('0x1c')],function(_0x3e3cb4){return{'model':db[_0x3e3cb4[_0x5218('0x1d')]],'as':_0x3e3cb4['as'],'attributes':_0x3e3cb4[_0x5218('0x19')],'include':_0x3e3cb4[_0x5218('0x1c')]?_['map'](_0x3e3cb4[_0x5218('0x1c')],function(_0x494223){return{'model':db[_0x494223[_0x5218('0x1d')]],'as':_0x494223['as'],'attributes':_0x494223['attributes']};}):[]};}):[]};}):[]:[]})[_0x5218('0xa')](function(_0x4bf229){logger[_0x5218('0xb')]('GetTrigger',_0x5a4673);logger[_0x5218('0xe')](_0x5218('0x1e'),_0x5a4673,JSON[_0x5218('0x10')](_0x4bf229));_0x4dbd43(_0x4bf229);})[_0x5218('0x15')](function(_0x4747ef){logger[_0x5218('0x12')](_0x5218('0x1e'),_0x4747ef[_0x5218('0x13')],_0x5a4673);_0x368929(_0x3aedb9[_0x5218('0x12')](0x1f4,_0x4747ef['message']));});});};exports[_0x5218('0x1f')]=function(_0x1bd78e){var _0x28617d=this;return new Promise(function(_0x3b7e8a,_0x5ef621){return db[_0x5218('0x16')][_0x5218('0x20')]({'raw':_0x1bd78e['options']?_0x1bd78e[_0x5218('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x1bd78e[_0x5218('0x17')]?_0x1bd78e['options']['where']||null:null,'attributes':_0x1bd78e[_0x5218('0x17')]?_0x1bd78e[_0x5218('0x17')][_0x5218('0x19')]||null:null,'include':_0x1bd78e['options']?_0x1bd78e['options']['include']?_[_0x5218('0x1b')](_0x1bd78e[_0x5218('0x17')][_0x5218('0x1c')],function(_0x3e8e3c){return{'model':db[_0x3e8e3c['model']],'as':_0x3e8e3c['as'],'attributes':_0x3e8e3c[_0x5218('0x19')],'include':_0x3e8e3c[_0x5218('0x1c')]?_[_0x5218('0x1b')](_0x3e8e3c[_0x5218('0x1c')],function(_0xde2d19){return{'model':db[_0xde2d19[_0x5218('0x1d')]],'as':_0xde2d19['as'],'attributes':_0xde2d19[_0x5218('0x19')],'include':_0xde2d19['include']?_[_0x5218('0x1b')](_0xde2d19['include'],function(_0x57cbba){return{'model':db[_0x57cbba[_0x5218('0x1d')]],'as':_0x57cbba['as'],'attributes':_0x57cbba[_0x5218('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3a28f4){logger[_0x5218('0xb')](_0x5218('0x1f'),_0x1bd78e);logger[_0x5218('0xe')](_0x5218('0x1f'),_0x1bd78e,JSON[_0x5218('0x10')](_0x3a28f4));_0x3b7e8a(_0x3a28f4);})[_0x5218('0x15')](function(_0x34c6bf){logger[_0x5218('0x12')](_0x5218('0x1f'),_0x34c6bf[_0x5218('0x13')],_0x1bd78e);_0x5ef621(_0x28617d[_0x5218('0x12')](0x1f4,_0x34c6bf[_0x5218('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 0bad704..bf38ce3 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 _0xa17c=['isAuthenticated','index','show','post','/:id/clone','clone','create','/:id','delete','destroy','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./trunk.controller'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0xa17c,0xea));var _0xca17=function(_0x512550,_0x6a8b6f){_0x512550=_0x512550-0x0;var _0x19f661=_0xa17c[_0x512550];return _0x19f661;};'use strict';var multer=require('multer');var util=require(_0xca17('0x0'));var path=require('path');var timeout=require(_0xca17('0x1'));var express=require('express');var router=express[_0xca17('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xca17('0x3'));var interaction=require(_0xca17('0x4'));var config=require('../../config/environment');var controller=require(_0xca17('0x5'));router['get']('/',auth[_0xca17('0x6')](),controller[_0xca17('0x7')]);router['get']('/:id',auth[_0xca17('0x6')](),controller[_0xca17('0x8')]);router[_0xca17('0x9')](_0xca17('0xa'),auth[_0xca17('0x6')](),controller[_0xca17('0xb')]);router[_0xca17('0x9')]('/',auth['isAuthenticated'](),controller[_0xca17('0xc')]);router['put'](_0xca17('0xd'),auth[_0xca17('0x6')](),controller['update']);router[_0xca17('0xe')](_0xca17('0xd'),auth[_0xca17('0x6')](),controller[_0xca17('0xf')]);module['exports']=router; \ No newline at end of file +var _0x3079=['clone','put','/:id','update','delete','destroy','exports','path','fs-extra','../../components/auth/service','./trunk.controller','get','isAuthenticated','index','post','/:id/clone'];(function(_0x121bed,_0x387a8f){var _0x4927e5=function(_0x86a801){while(--_0x86a801){_0x121bed['push'](_0x121bed['shift']());}};_0x4927e5(++_0x387a8f);}(_0x3079,0x117));var _0x9307=function(_0x45f41d,_0x58de63){_0x45f41d=_0x45f41d-0x0;var _0xd61905=_0x3079[_0x45f41d];return _0xd61905;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9307('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x9307('0x1'));var auth=require(_0x9307('0x2'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9307('0x3'));router[_0x9307('0x4')]('/',auth[_0x9307('0x5')](),controller[_0x9307('0x6')]);router[_0x9307('0x4')]('/:id',auth[_0x9307('0x5')](),controller['show']);router[_0x9307('0x7')](_0x9307('0x8'),auth[_0x9307('0x5')](),controller[_0x9307('0x9')]);router[_0x9307('0x7')]('/',auth[_0x9307('0x5')](),controller['create']);router[_0x9307('0xa')](_0x9307('0xb'),auth[_0x9307('0x5')](),controller[_0x9307('0xc')]);router[_0x9307('0xd')](_0x9307('0xb'),auth[_0x9307('0x5')](),controller[_0x9307('0xe')]);module[_0x9307('0xf')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index b90197f..219b11c 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 _0x7782=['\x22\x22\x20<>','always','refuse','uas','pai','fingerprint','certificate','passive','actpass','dynamic','sequelize','exports','STRING','name','ENUM','user','peer','friend','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','udp','setDataValue','transport','getDataValue','split','info','shortinfo','inband','auto','rfc2833','nonat','update','outgoing','yes','force_rport,comedia','nat','join','all','ulaw;alaw;gsm','allow','port,invite','insecure','INTEGER'];(function(_0x4c7b8a,_0x12540d){var _0x3fbc85=function(_0x854b1e){while(--_0x854b1e){_0x4c7b8a['push'](_0x4c7b8a['shift']());}};_0x3fbc85(++_0x12540d);}(_0x7782,0xfa));var _0x2778=function(_0x10fcf3,_0x24a4fd){_0x10fcf3=_0x10fcf3-0x0;var _0x244d86=_0x7782[_0x10fcf3];return _0x244d86;};'use strict';var Sequelize=require(_0x2778('0x0'));module[_0x2778('0x1')]={'name':{'type':Sequelize[_0x2778('0x2')],'allowNull':![],'unique':_0x2778('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x2778('0x4')]('friend',_0x2778('0x5'),_0x2778('0x6')),'allowNull':![],'defaultValue':_0x2778('0x7')},'context':{'type':Sequelize[_0x2778('0x2')],'allowNull':![],'defaultValue':_0x2778('0x8')},'callingpres':{'type':Sequelize[_0x2778('0x4')](_0x2778('0x9'),_0x2778('0xa'),_0x2778('0xb'),'ALLOWED',_0x2778('0xc'),_0x2778('0xd'),_0x2778('0xe'),'PROHIB')},'deny':{'type':Sequelize[_0x2778('0x2')]},'permit':{'type':Sequelize[_0x2778('0x2')]},'secret':{'type':Sequelize[_0x2778('0x2')]},'md5secret':{'type':Sequelize[_0x2778('0x2')]},'remotesecret':{'type':Sequelize[_0x2778('0x2')]},'transport':{'type':Sequelize[_0x2778('0x2')],'defaultValue':_0x2778('0xf'),'set':function(_0x82280b){this[_0x2778('0x10')](_0x2778('0x11'),_0x82280b?_0x82280b['join'](','):null);},'get':function(){return this[_0x2778('0x12')](_0x2778('0x11'))?this[_0x2778('0x12')](_0x2778('0x11'))[_0x2778('0x13')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0x2778('0x4')]('rfc2833',_0x2778('0x14'),_0x2778('0x15'),_0x2778('0x16'),_0x2778('0x17')),'defaultValue':_0x2778('0x18')},'directmedia':{'type':Sequelize[_0x2778('0x4')]('yes','no',_0x2778('0x19'),_0x2778('0x1a'),_0x2778('0x1b')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0x2778('0x1c'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x2778('0x2')]},'directmediadeny':{'type':Sequelize[_0x2778('0x2')]},'nat':{'type':Sequelize[_0x2778('0x2')],'defaultValue':_0x2778('0x1d'),'set':function(_0x4a1527){this['setDataValue'](_0x2778('0x1e'),_0x4a1527?_0x4a1527[_0x2778('0x1f')](','):null);},'get':function(){return this[_0x2778('0x12')](_0x2778('0x1e'))?this[_0x2778('0x12')](_0x2778('0x1e'))[_0x2778('0x13')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x2778('0x2')]},'pickupgroup':{'type':Sequelize[_0x2778('0x2')]},'namedpickupgroup':{'type':Sequelize[_0x2778('0x2')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize[_0x2778('0x2')],'defaultValue':_0x2778('0x20')},'allow':{'type':Sequelize[_0x2778('0x2')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x337e12){this[_0x2778('0x10')]('allow',_0x337e12?_0x337e12[_0x2778('0x1f')](';'):_0x2778('0x21'));},'get':function(){return this[_0x2778('0x12')](_0x2778('0x22'))?this[_0x2778('0x12')](_0x2778('0x22'))[_0x2778('0x13')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize[_0x2778('0x4')](_0x2778('0x1c'),'no')},'insecure':{'type':Sequelize[_0x2778('0x2')],'defaultValue':_0x2778('0x23'),'set':function(_0x2be0c3){this[_0x2778('0x10')](_0x2778('0x24'),_0x2be0c3?_0x2be0c3[_0x2778('0x1f')](','):null);},'get':function(){return this['getDataValue']('insecure')?this[_0x2778('0x12')](_0x2778('0x24'))[_0x2778('0x13')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x2778('0x4')](_0x2778('0x1c'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x2778('0x4')](_0x2778('0x1c'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x2778('0x4')]('yes','no','never')},'promiscredir':{'type':Sequelize['ENUM'](_0x2778('0x1c'),'no')},'useclientcode':{'type':Sequelize[_0x2778('0x4')]('yes','no')},'accountcode':{'type':Sequelize[_0x2778('0x25')](0xb)},'setvar':{'type':Sequelize[_0x2778('0x2')]},'callerid':{'type':Sequelize[_0x2778('0x2')],'defaultValue':_0x2778('0x26')},'amaflags':{'type':Sequelize[_0x2778('0x2')]},'callcounter':{'type':Sequelize['ENUM'](_0x2778('0x1c'),'no'),'defaultValue':_0x2778('0x1c')},'busylevel':{'type':Sequelize[_0x2778('0x25')](0xb)},'allowoverlap':{'type':Sequelize[_0x2778('0x4')](_0x2778('0x1c'),'no')},'allowsubscribe':{'type':Sequelize['ENUM'](_0x2778('0x1c'),'no')},'allowtransfer':{'type':Sequelize['ENUM'](_0x2778('0x1c'),'no')},'ignoresdpversion':{'type':Sequelize[_0x2778('0x4')](_0x2778('0x1c'),'no')},'subscribecontext':{'type':Sequelize[_0x2778('0x2')]},'template':{'type':Sequelize[_0x2778('0x2')]},'videosupport':{'type':Sequelize[_0x2778('0x4')](_0x2778('0x1c'),'no',_0x2778('0x27')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x2778('0x25')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x2778('0x4')](_0x2778('0x1c'),'no')},'mailbox':{'type':Sequelize[_0x2778('0x2')]},'session_timers':{'type':Sequelize[_0x2778('0x4')]('accept',_0x2778('0x28'),'originate')},'session_expires':{'type':Sequelize[_0x2778('0x25')](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize[_0x2778('0x4')]('uac',_0x2778('0x29')),'defaultValue':_0x2778('0x29')},'t38pt_usertpsource':{'type':Sequelize[_0x2778('0x2')]},'regexten':{'type':Sequelize[_0x2778('0x2')]},'fromdomain':{'type':Sequelize[_0x2778('0x2')]},'fromuser':{'type':Sequelize[_0x2778('0x2')]},'port':{'type':Sequelize[_0x2778('0x25')](0x5)},'qualify':{'type':Sequelize[_0x2778('0x4')](_0x2778('0x1c'),'no'),'defaultValue':_0x2778('0x1c')},'keepalive':{'type':Sequelize[_0x2778('0x25')](0xb)},'defaultip':{'type':Sequelize[_0x2778('0x2')]},'defaultuser':{'type':Sequelize[_0x2778('0x2')]},'rtptimeout':{'type':Sequelize[_0x2778('0x25')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x2778('0x25')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x2778('0x25')](0xb)},'sendrpid':{'type':Sequelize[_0x2778('0x4')](_0x2778('0x1c'),'no',_0x2778('0x2a')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING']},'callbackextension':{'type':Sequelize[_0x2778('0x2')]},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize[_0x2778('0x25')](0xb)},'qualifyfreq':{'type':Sequelize[_0x2778('0x25')](0xb)},'contactpermit':{'type':Sequelize[_0x2778('0x2')]},'contactdeny':{'type':Sequelize[_0x2778('0x2')]},'contactacl':{'type':Sequelize[_0x2778('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0x2778('0x2')]},'use_q850_reason':{'type':Sequelize[_0x2778('0x2')]},'maxforwards':{'type':Sequelize[_0x2778('0x25')](0xb)},'encryption':{'type':Sequelize[_0x2778('0x4')](_0x2778('0x1c'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x2778('0x4')](_0x2778('0x1c'),'no')},'force_avp':{'type':Sequelize[_0x2778('0x4')]('yes','no')},'icesupport':{'type':Sequelize[_0x2778('0x4')]('yes','no')},'dtlsenable':{'type':Sequelize[_0x2778('0x4')]('yes','no')},'dtlsverify':{'type':Sequelize[_0x2778('0x4')](_0x2778('0x1c'),'no',_0x2778('0x2b'),_0x2778('0x2c'))},'dtlsrekey':{'type':Sequelize[_0x2778('0x25')](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize[_0x2778('0x2')]},'dtlscipher':{'type':Sequelize[_0x2778('0x2')]},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize[_0x2778('0x2')]},'dtlssetup':{'type':Sequelize['ENUM']('active',_0x2778('0x2d'),_0x2778('0x2e')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize[_0x2778('0x4')](_0x2778('0x1c'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize[_0x2778('0x2')]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x2778('0x4')]('yes','no')},'subscribemwi':{'type':Sequelize[_0x2778('0x4')](_0x2778('0x1c'),'no')},'vmexten':{'type':Sequelize[_0x2778('0x2')]},'mohinterpret':{'type':Sequelize['STRING']},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize[_0x2778('0x2')]},'description':{'type':Sequelize[_0x2778('0x2')]},'host':{'type':Sequelize[_0x2778('0x2')],'defaultValue':_0x2778('0x2f')},'canreinvite':{'type':Sequelize[_0x2778('0x4')](_0x2778('0x1c'),'no','nonat',_0x2778('0x1a'),'update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize[_0x2778('0x2')]},'otherFields':{'type':Sequelize[_0x2778('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x2778('0x2')],'defaultValue':'no'}}; \ No newline at end of file +var _0xf9a7=['update','outgoing','nat','all','ulaw;alaw;gsm','setDataValue','allow','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','INTEGER','\x22\x22\x20<>','accept','originate','uac','uas','pai','fingerprint','certificate','active','passive','actpass','dynamic','update,nonat','sequelize','exports','STRING','name','ENUM','friend','user','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','shortinfo','inband','rfc2833','yes','nonat'];(function(_0x588901,_0x17249f){var _0x39c89c=function(_0x566dce){while(--_0x566dce){_0x588901['push'](_0x588901['shift']());}};_0x39c89c(++_0x17249f);}(_0xf9a7,0x1da));var _0x7f9a=function(_0x468d4f,_0x2096e7){_0x468d4f=_0x468d4f-0x0;var _0x1e6665=_0xf9a7[_0x468d4f];return _0x1e6665;};'use strict';var Sequelize=require(_0x7f9a('0x0'));module[_0x7f9a('0x1')]={'name':{'type':Sequelize[_0x7f9a('0x2')],'allowNull':![],'unique':_0x7f9a('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x7f9a('0x4')](_0x7f9a('0x5'),_0x7f9a('0x6'),'peer'),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize[_0x7f9a('0x2')],'allowNull':![],'defaultValue':_0x7f9a('0x7')},'callingpres':{'type':Sequelize[_0x7f9a('0x4')](_0x7f9a('0x8'),_0x7f9a('0x9'),'ALLOWED_FAILED_SCREEN',_0x7f9a('0xa'),_0x7f9a('0xb'),_0x7f9a('0xc'),_0x7f9a('0xd'),_0x7f9a('0xe'))},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize[_0x7f9a('0x2')]},'remotesecret':{'type':Sequelize[_0x7f9a('0x2')]},'transport':{'type':Sequelize['STRING'],'defaultValue':_0x7f9a('0xf'),'set':function(_0x289976){this['setDataValue'](_0x7f9a('0x10'),_0x289976?_0x289976[_0x7f9a('0x11')](','):null);},'get':function(){return this[_0x7f9a('0x12')](_0x7f9a('0x10'))?this[_0x7f9a('0x12')](_0x7f9a('0x10'))[_0x7f9a('0x13')](','):null;},'comment':_0x7f9a('0x14')},'dtmfmode':{'type':Sequelize[_0x7f9a('0x4')]('rfc2833','info',_0x7f9a('0x15'),_0x7f9a('0x16'),'auto'),'defaultValue':_0x7f9a('0x17')},'directmedia':{'type':Sequelize[_0x7f9a('0x4')](_0x7f9a('0x18'),'no',_0x7f9a('0x19'),_0x7f9a('0x1a'),_0x7f9a('0x1b')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x7f9a('0x4')](_0x7f9a('0x18'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x7f9a('0x2')]},'directmediadeny':{'type':Sequelize[_0x7f9a('0x2')]},'nat':{'type':Sequelize['STRING'],'defaultValue':'force_rport,comedia','set':function(_0x1d948b){this['setDataValue'](_0x7f9a('0x1c'),_0x1d948b?_0x1d948b[_0x7f9a('0x11')](','):null);},'get':function(){return this[_0x7f9a('0x12')](_0x7f9a('0x1c'))?this[_0x7f9a('0x12')](_0x7f9a('0x1c'))[_0x7f9a('0x13')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x7f9a('0x2')]},'namedcallgroup':{'type':Sequelize[_0x7f9a('0x2')]},'pickupgroup':{'type':Sequelize[_0x7f9a('0x2')]},'namedpickupgroup':{'type':Sequelize[_0x7f9a('0x2')]},'language':{'type':Sequelize[_0x7f9a('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x7f9a('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x7f9a('0x2')],'defaultValue':_0x7f9a('0x1d')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x7f9a('0x1e'),'set':function(_0x3a67bb){this[_0x7f9a('0x1f')](_0x7f9a('0x20'),_0x3a67bb?_0x3a67bb[_0x7f9a('0x11')](';'):_0x7f9a('0x1e'));},'get':function(){return this[_0x7f9a('0x12')](_0x7f9a('0x20'))?this['getDataValue']('allow')[_0x7f9a('0x13')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize['ENUM'](_0x7f9a('0x18'),'no')},'insecure':{'type':Sequelize[_0x7f9a('0x2')],'defaultValue':_0x7f9a('0x21'),'set':function(_0x58fbd7){this['setDataValue'](_0x7f9a('0x22'),_0x58fbd7?_0x58fbd7[_0x7f9a('0x11')](','):null);},'get':function(){return this[_0x7f9a('0x12')](_0x7f9a('0x22'))?this['getDataValue'](_0x7f9a('0x22'))[_0x7f9a('0x13')](','):null;},'comment':_0x7f9a('0x23')},'trustrpid':{'type':Sequelize['ENUM'](_0x7f9a('0x18'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x7f9a('0x4')]('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x7f9a('0x4')](_0x7f9a('0x18'),'no','never')},'promiscredir':{'type':Sequelize[_0x7f9a('0x4')](_0x7f9a('0x18'),'no')},'useclientcode':{'type':Sequelize['ENUM'](_0x7f9a('0x18'),'no')},'accountcode':{'type':Sequelize[_0x7f9a('0x24')](0xb)},'setvar':{'type':Sequelize[_0x7f9a('0x2')]},'callerid':{'type':Sequelize['STRING'],'defaultValue':_0x7f9a('0x25')},'amaflags':{'type':Sequelize[_0x7f9a('0x2')]},'callcounter':{'type':Sequelize[_0x7f9a('0x4')](_0x7f9a('0x18'),'no'),'defaultValue':_0x7f9a('0x18')},'busylevel':{'type':Sequelize[_0x7f9a('0x24')](0xb)},'allowoverlap':{'type':Sequelize[_0x7f9a('0x4')](_0x7f9a('0x18'),'no')},'allowsubscribe':{'type':Sequelize[_0x7f9a('0x4')](_0x7f9a('0x18'),'no')},'allowtransfer':{'type':Sequelize[_0x7f9a('0x4')](_0x7f9a('0x18'),'no')},'ignoresdpversion':{'type':Sequelize['ENUM']('yes','no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize[_0x7f9a('0x2')]},'videosupport':{'type':Sequelize['ENUM']('yes','no','always'),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x7f9a('0x24')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x7f9a('0x4')](_0x7f9a('0x18'),'no')},'mailbox':{'type':Sequelize[_0x7f9a('0x2')]},'session_timers':{'type':Sequelize[_0x7f9a('0x4')](_0x7f9a('0x26'),'refuse',_0x7f9a('0x27'))},'session_expires':{'type':Sequelize[_0x7f9a('0x24')](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize[_0x7f9a('0x4')](_0x7f9a('0x28'),_0x7f9a('0x29')),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x7f9a('0x2')]},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize[_0x7f9a('0x2')]},'port':{'type':Sequelize[_0x7f9a('0x24')](0x5)},'qualify':{'type':Sequelize[_0x7f9a('0x4')](_0x7f9a('0x18'),'no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize[_0x7f9a('0x2')]},'defaultuser':{'type':Sequelize['STRING']},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x7f9a('0x24')](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize['ENUM'](_0x7f9a('0x18'),'no',_0x7f9a('0x2a')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x7f9a('0x2')]},'callbackextension':{'type':Sequelize[_0x7f9a('0x2')]},'timert1':{'type':Sequelize[_0x7f9a('0x24')](0xb)},'timerb':{'type':Sequelize[_0x7f9a('0x24')](0xb)},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize[_0x7f9a('0x2')]},'contactacl':{'type':Sequelize[_0x7f9a('0x2')]},'unsolicited_mailbox':{'type':Sequelize['STRING']},'use_q850_reason':{'type':Sequelize[_0x7f9a('0x2')]},'maxforwards':{'type':Sequelize[_0x7f9a('0x24')](0xb)},'encryption':{'type':Sequelize[_0x7f9a('0x4')]('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x7f9a('0x4')](_0x7f9a('0x18'),'no')},'force_avp':{'type':Sequelize['ENUM']('yes','no')},'icesupport':{'type':Sequelize['ENUM'](_0x7f9a('0x18'),'no')},'dtlsenable':{'type':Sequelize[_0x7f9a('0x4')]('yes','no')},'dtlsverify':{'type':Sequelize[_0x7f9a('0x4')](_0x7f9a('0x18'),'no',_0x7f9a('0x2b'),_0x7f9a('0x2c'))},'dtlsrekey':{'type':Sequelize[_0x7f9a('0x24')](0xb)},'dtlscertfile':{'type':Sequelize[_0x7f9a('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0x7f9a('0x2')]},'dtlscipher':{'type':Sequelize[_0x7f9a('0x2')]},'dtlscafile':{'type':Sequelize[_0x7f9a('0x2')]},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize[_0x7f9a('0x4')](_0x7f9a('0x2d'),_0x7f9a('0x2e'),_0x7f9a('0x2f')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x7f9a('0x2')]},'usereqphone':{'type':Sequelize[_0x7f9a('0x4')](_0x7f9a('0x18'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x7f9a('0x2')]},'recordofffeature':{'type':Sequelize[_0x7f9a('0x2')]},'call_limit':{'type':Sequelize[_0x7f9a('0x24')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x7f9a('0x4')](_0x7f9a('0x18'),'no')},'subscribemwi':{'type':Sequelize[_0x7f9a('0x4')](_0x7f9a('0x18'),'no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize[_0x7f9a('0x2')]},'mohsuggest':{'type':Sequelize[_0x7f9a('0x2')]},'parkinglot':{'type':Sequelize[_0x7f9a('0x2')]},'description':{'type':Sequelize[_0x7f9a('0x2')]},'host':{'type':Sequelize['STRING'],'defaultValue':_0x7f9a('0x30')},'canreinvite':{'type':Sequelize[_0x7f9a('0x4')]('yes','no',_0x7f9a('0x19'),_0x7f9a('0x1a'),_0x7f9a('0x31')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x7f9a('0x2')]},'otherFields':{'type':Sequelize[_0x7f9a('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x7f9a('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 a9c8d6a..3a8e95f 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 _0x98a8=['../../mysqldb','jayson/promise','client','request','Trunk,\x20%s,\x20%s','debug','request\x20sent','error','code','message','info','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','destroy','get','Trunks','UserProfileResource','stack','name','map','fieldName','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','Trunk','include','show','params','keys','rawAttributes','includeAll','clone','find','createdAt','updatedAt','body','omit','create','user','role','UserProfileSection','userProfileId','autoAssociation','findAll','readFileSync','root','server/files/templates/trunk.ejs','join','server/files/templates/registry.ejs','utf8','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment'];(function(_0x439ed9,_0x581c3f){var _0x337d30=function(_0x57f8d0){while(--_0x57f8d0){_0x439ed9['push'](_0x439ed9['shift']());}};_0x337d30(++_0x581c3f);}(_0x98a8,0x12c));var _0x898a=function(_0x3070ac,_0x2ddbff){_0x3070ac=_0x3070ac-0x0;var _0x1172c0=_0x98a8[_0x3070ac];return _0x1172c0;};'use strict';var emlformat=require(_0x898a('0x0'));var rimraf=require(_0x898a('0x1'));var zipdir=require(_0x898a('0x2'));var jsonpatch=require(_0x898a('0x3'));var rp=require(_0x898a('0x4'));var moment=require(_0x898a('0x5'));var BPromise=require(_0x898a('0x6'));var Mustache=require('mustache');var util=require(_0x898a('0x7'));var path=require(_0x898a('0x8'));var sox=require(_0x898a('0x9'));var csv=require(_0x898a('0xa'));var ejs=require(_0x898a('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x898a('0xc'));var squel=require('squel');var crypto=require(_0x898a('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x898a('0xe'));var toCsv=require(_0x898a('0xa'));var querystring=require(_0x898a('0xf'));var Papa=require(_0x898a('0x10'));var Redis=require(_0x898a('0x11'));var authService=require(_0x898a('0x12'));var qs=require(_0x898a('0x13'));var as=require(_0x898a('0x14'));var hardwareService=require(_0x898a('0x15'));var logger=require('../../config/logger')(_0x898a('0x16'));var utils=require('../../config/utils');var config=require(_0x898a('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x898a('0x18'))['db'];var jayson=require(_0x898a('0x19'));var client=jayson[_0x898a('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5bfded,_0x5b5c9c,_0x373d53,_0x1f5be4){return new BPromise(function(_0xb24335,_0x116fbe){var _0x1873e9=_0x1f5be4||client;return _0x1873e9[_0x898a('0x1b')](_0x5bfded,_0x373d53)['then'](function(_0x47033c){logger['info'](_0x898a('0x1c'),_0x5b5c9c,'request\x20sent');logger[_0x898a('0x1d')]('Trunk,\x20%s,\x20%s,\x20%s',_0x5b5c9c,_0x898a('0x1e'),JSON['stringify'](_0x47033c));if(_0x47033c[_0x898a('0x1f')]){if(_0x47033c[_0x898a('0x1f')][_0x898a('0x20')]===0x1f4){logger['error'](_0x898a('0x1c'),_0x5b5c9c,_0x47033c['error']['message']);return _0x116fbe(_0x47033c[_0x898a('0x1f')][_0x898a('0x21')]);}logger['error']('Trunk,\x20%s,\x20%s',_0x5b5c9c,_0x47033c[_0x898a('0x1f')][_0x898a('0x21')]);return _0xb24335(_0x47033c[_0x898a('0x1f')][_0x898a('0x21')]);}else{logger[_0x898a('0x22')](_0x898a('0x1c'),_0x5b5c9c,_0x898a('0x1e'));_0xb24335(_0x47033c['result'][_0x898a('0x21')]);}})[_0x898a('0x23')](function(_0x11cae2){logger[_0x898a('0x1f')](_0x898a('0x1c'),_0x5b5c9c,_0x11cae2);_0x116fbe(_0x11cae2);});});}function respondWithStatusCode(_0x310bfa,_0x4e254d){_0x4e254d=_0x4e254d||0xcc;return function(_0x274cdf){if(_0x274cdf){return _0x310bfa[_0x898a('0x24')](_0x4e254d);}return _0x310bfa[_0x898a('0x25')](_0x4e254d)[_0x898a('0x26')]();};}function respondWithResult(_0x3901ab,_0x1426e3){_0x1426e3=_0x1426e3||0xc8;return function(_0x5b7719){if(_0x5b7719){return _0x3901ab[_0x898a('0x25')](_0x1426e3)['json'](_0x5b7719);}};}function respondWithFilteredResult(_0x513c6b,_0x53ddb2){return function(_0x3678be){if(_0x3678be){var _0x1f4d86=typeof _0x53ddb2[_0x898a('0x27')]===_0x898a('0x28')&&typeof _0x53ddb2[_0x898a('0x29')]===_0x898a('0x28');var _0x398e98=_0x3678be[_0x898a('0x2a')];var _0xd31922=_0x1f4d86?0x0:_0x53ddb2['offset'];var _0x4b3e68=_0x1f4d86?_0x3678be['count']:_0x53ddb2[_0x898a('0x27')]+_0x53ddb2[_0x898a('0x29')];var _0x3b7704;if(_0x4b3e68>=_0x398e98){_0x4b3e68=_0x398e98;_0x3b7704=0xc8;}else{_0x3b7704=0xce;}_0x513c6b[_0x898a('0x25')](_0x3b7704);return _0x513c6b[_0x898a('0x2b')](_0x898a('0x2c'),_0xd31922+'-'+_0x4b3e68+'/'+_0x398e98)[_0x898a('0x2d')](_0x3678be);}return null;};}function patchUpdates(_0xf74645){return function(_0x18773a){try{jsonpatch[_0x898a('0x2e')](_0x18773a,_0xf74645,!![]);}catch(_0x44c5d2){return BPromise[_0x898a('0x2f')](_0x44c5d2);}return _0x18773a['save']();};}function saveUpdates(_0x7a1eb5,_0x17a5f3){return function(_0x26eead){if(_0x26eead){return _0x26eead[_0x898a('0x30')](_0x7a1eb5)[_0x898a('0x31')](function(_0x47af5b){return _0x47af5b;});}return null;};}function removeEntity(_0x48cefb,_0x20a3fe){return function(_0x1e2fd4){if(_0x1e2fd4){return _0x1e2fd4[_0x898a('0x32')]()['then'](function(){var _0x105477=_0x1e2fd4[_0x898a('0x33')]({'plain':!![]});var _0x5eafc7=_0x898a('0x34');return db[_0x898a('0x35')][_0x898a('0x32')]({'where':{'type':_0x5eafc7,'resourceId':_0x105477['id']}})[_0x898a('0x31')](function(){return _0x1e2fd4;});})[_0x898a('0x31')](function(){_0x48cefb['status'](0xcc)[_0x898a('0x26')]();});}};}function handleEntityNotFound(_0x5baf5b,_0x573eb3){return function(_0x14e2dc){if(!_0x14e2dc){_0x5baf5b['sendStatus'](0x194);}return _0x14e2dc;};}function handleError(_0x3c9588,_0x4b3aac){_0x4b3aac=_0x4b3aac||0x1f4;return function(_0x37cb11){logger['error'](_0x37cb11[_0x898a('0x36')]);if(_0x37cb11[_0x898a('0x37')]){delete _0x37cb11[_0x898a('0x37')];}_0x3c9588['status'](_0x4b3aac)['send'](_0x37cb11);};}exports['index']=function(_0x1575d2,_0x429c32){var _0x5a228f={},_0xdd019d={},_0x3d3463={'count':0x0,'rows':[]};var _0xe84f7e=_[_0x898a('0x38')](db['Trunk']['rawAttributes'],function(_0x3aed01){return{'name':_0x3aed01[_0x898a('0x39')],'type':_0x3aed01['type']['key']};});_0xdd019d[_0x898a('0x3a')]=_[_0x898a('0x38')](_0xe84f7e,_0x898a('0x37'));_0xdd019d[_0x898a('0x3b')]=_['keys'](_0x1575d2[_0x898a('0x3b')]);_0xdd019d[_0x898a('0x3c')]=_['intersection'](_0xdd019d['model'],_0xdd019d['query']);_0x5a228f[_0x898a('0x3d')]=_[_0x898a('0x3e')](_0xdd019d[_0x898a('0x3a')],qs[_0x898a('0x3f')](_0x1575d2[_0x898a('0x3b')][_0x898a('0x3f')]));_0x5a228f[_0x898a('0x3d')]=_0x5a228f[_0x898a('0x3d')][_0x898a('0x40')]?_0x5a228f[_0x898a('0x3d')]:_0xdd019d[_0x898a('0x3a')];if(!_0x1575d2[_0x898a('0x3b')][_0x898a('0x41')](_0x898a('0x42'))){_0x5a228f[_0x898a('0x29')]=qs['limit'](_0x1575d2[_0x898a('0x3b')][_0x898a('0x29')]);_0x5a228f[_0x898a('0x27')]=qs['offset'](_0x1575d2[_0x898a('0x3b')][_0x898a('0x27')]);}_0x5a228f[_0x898a('0x43')]=qs[_0x898a('0x44')](_0x1575d2[_0x898a('0x3b')][_0x898a('0x44')]);_0x5a228f[_0x898a('0x45')]=qs[_0x898a('0x3c')](_['pick'](_0x1575d2[_0x898a('0x3b')],_0xdd019d[_0x898a('0x3c')]),_0xe84f7e);if(_0x1575d2[_0x898a('0x3b')][_0x898a('0x46')]){_0x5a228f['where']=_[_0x898a('0x47')](_0x5a228f[_0x898a('0x45')],{'$or':_['map'](_0xe84f7e,function(_0x241677){if(_0x241677['type']!==_0x898a('0x48')){var _0x5137c4={};_0x5137c4[_0x241677['name']]={'$like':'%'+_0x1575d2[_0x898a('0x3b')]['filter']+'%'};return _0x5137c4;}})});}_0x5a228f=_[_0x898a('0x47')]({},_0x5a228f,_0x1575d2[_0x898a('0x49')]);var _0x4d6ac0={'where':_0x5a228f[_0x898a('0x45')]};return db[_0x898a('0x4a')]['count'](_0x4d6ac0)[_0x898a('0x31')](function(_0x199437){_0x3d3463[_0x898a('0x2a')]=_0x199437;if(_0x1575d2[_0x898a('0x3b')]['includeAll']){_0x5a228f[_0x898a('0x4b')]=[{'all':!![]}];}return db[_0x898a('0x4a')]['findAll'](_0x5a228f);})[_0x898a('0x31')](function(_0x1d8c16){_0x3d3463['rows']=_0x1d8c16;return _0x3d3463;})[_0x898a('0x31')](respondWithFilteredResult(_0x429c32,_0x5a228f))['catch'](handleError(_0x429c32,null));};exports[_0x898a('0x4c')]=function(_0x41f291,_0x32ccb9){var _0x50f9e3={'raw':![],'where':{'id':_0x41f291[_0x898a('0x4d')]['id']}},_0x2f6cb3={};_0x2f6cb3[_0x898a('0x3a')]=_[_0x898a('0x4e')](db['Trunk'][_0x898a('0x4f')]);_0x2f6cb3['query']=_[_0x898a('0x4e')](_0x41f291[_0x898a('0x3b')]);_0x2f6cb3[_0x898a('0x3c')]=_['intersection'](_0x2f6cb3[_0x898a('0x3a')],_0x2f6cb3[_0x898a('0x3b')]);_0x50f9e3[_0x898a('0x3d')]=_['intersection'](_0x2f6cb3['model'],qs[_0x898a('0x3f')](_0x41f291[_0x898a('0x3b')][_0x898a('0x3f')]));_0x50f9e3[_0x898a('0x3d')]=_0x50f9e3[_0x898a('0x3d')][_0x898a('0x40')]?_0x50f9e3[_0x898a('0x3d')]:_0x2f6cb3[_0x898a('0x3a')];if(_0x41f291[_0x898a('0x3b')][_0x898a('0x50')]){_0x50f9e3[_0x898a('0x4b')]=[{'all':!![]}];}_0x50f9e3=_['merge']({},_0x50f9e3,_0x41f291[_0x898a('0x49')]);return db[_0x898a('0x4a')]['find'](_0x50f9e3)[_0x898a('0x31')](handleEntityNotFound(_0x32ccb9,null))['then'](respondWithResult(_0x32ccb9,null))['catch'](handleError(_0x32ccb9,null));};exports[_0x898a('0x51')]=function(_0x124f9b,_0x209529){var _0x5bfd61={'where':{'id':_0x124f9b[_0x898a('0x4d')]['id']}},_0x556fd8={};_0x556fd8[_0x898a('0x3a')]=_['keys'](db[_0x898a('0x4a')][_0x898a('0x4f')]);_0x5bfd61['attributes']=_[_0x898a('0x3e')](_0x556fd8[_0x898a('0x3a')],qs[_0x898a('0x3f')](_0x124f9b['query'][_0x898a('0x3f')]));_0x5bfd61[_0x898a('0x3d')]=_0x5bfd61[_0x898a('0x3d')][_0x898a('0x40')]?_0x5bfd61[_0x898a('0x3d')]:_0x556fd8[_0x898a('0x3a')];if(_0x124f9b['query'][_0x898a('0x50')]){_0x5bfd61['include']=[{'all':!![]}];}_0x5bfd61=_[_0x898a('0x47')]({},_0x5bfd61,_0x124f9b[_0x898a('0x49')]);return db[_0x898a('0x4a')][_0x898a('0x52')](_0x5bfd61)[_0x898a('0x31')](handleEntityNotFound(_0x209529,null))[_0x898a('0x31')](function(_0x2486a5){if(_0x2486a5){var _0x75ff57=_0x2486a5[_0x898a('0x33')]({'plain':!![]});_0x75ff57=qs['omit'](_0x75ff57,['id',_0x898a('0x53'),_0x898a('0x54')]);_0x124f9b[_0x898a('0x55')]=_[_0x898a('0x56')](_0x124f9b[_0x898a('0x55')],['id',_0x898a('0x53'),_0x898a('0x54')]);return db[_0x898a('0x4a')][_0x898a('0x57')](_[_0x898a('0x47')](_0x75ff57,_0x124f9b[_0x898a('0x55')]),{'include':_0x124f9b[_0x898a('0x3b')][_0x898a('0x50')]?[{'all':!![]}]:undefined})[_0x898a('0x31')](function(_0x22f9ba){var _0x5f42ae=_0x124f9b[_0x898a('0x58')][_0x898a('0x33')]({'plain':!![]});if(!_0x5f42ae)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5f42ae[_0x898a('0x59')]===_0x898a('0x58')){var _0x5f0944=_0x22f9ba[_0x898a('0x33')]({'plain':!![]});var _0x1daecd=_0x898a('0x34');return db[_0x898a('0x5a')]['find']({'where':{'name':_0x1daecd,'userProfileId':_0x5f42ae[_0x898a('0x5b')]},'raw':!![]})[_0x898a('0x31')](function(_0x137935){if(_0x137935&&_0x137935[_0x898a('0x5c')]===0x0){return db['UserProfileResource'][_0x898a('0x57')]({'name':_0x5f0944[_0x898a('0x37')],'resourceId':_0x5f0944['id'],'type':_0x137935['name'],'sectionId':_0x137935['id']},{})[_0x898a('0x31')](function(){return _0x22f9ba;});}else{return _0x22f9ba;}})[_0x898a('0x23')](function(_0x5b7019){logger[_0x898a('0x1f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5b7019);throw _0x5b7019;});}return _0x22f9ba;});}})[_0x898a('0x31')](respondWithResult(_0x209529,0xc9))['catch'](handleError(_0x209529,null));};exports['create']=function(_0x5ed35e,_0xfdd6d8,_0x473f5c){var _0x3909c5;return db[_0x898a('0x4a')]['create'](_0x5ed35e['body'],{'raw':!![]})[_0x898a('0x31')](function(_0x232be0){_0x3909c5=_0x232be0;return db[_0x898a('0x4a')][_0x898a('0x5d')]({'raw':!![]});})[_0x898a('0x31')](function(_0x41cf94){var _0x30051d=fs[_0x898a('0x5e')](path['join'](config[_0x898a('0x5f')],_0x898a('0x60')),'utf8');var _0x42fda8=fs[_0x898a('0x5e')](path[_0x898a('0x61')](config[_0x898a('0x5f')],_0x898a('0x62')),_0x898a('0x63'));var _0x3bcc3d=ejs[_0x898a('0x64')](_0x30051d,{'trunks':_0x41cf94||[]});fs[_0x898a('0x65')](_0x898a('0x66'),_0x3bcc3d);if(_0x3909c5[_0x898a('0x67')]){var _0x307849=ejs[_0x898a('0x64')](_0x42fda8,{'trunks':_0x41cf94||[]});fs['writeFileSync'](_0x898a('0x68'),_0x307849);}})['then'](function(){return respondWithRpcPromise(_0x898a('0x69'),_0x898a('0x57'),{'module':_0x898a('0x6a')});})['then'](function(){var _0x31102d=_0x5ed35e[_0x898a('0x58')][_0x898a('0x33')]({'plain':!![]});if(!_0x31102d)throw new Error(_0x898a('0x6b'));if(_0x31102d[_0x898a('0x59')]==='user'){var _0x4b9487=_0x3909c5[_0x898a('0x33')]({'plain':!![]});return db[_0x898a('0x5a')][_0x898a('0x52')]({'where':{'name':_0x898a('0x34'),'userProfileId':_0x31102d['userProfileId']},'raw':!![]})[_0x898a('0x31')](function(_0x3d3451){if(_0x3d3451&&_0x3d3451[_0x898a('0x5c')]===0x0){return db[_0x898a('0x35')][_0x898a('0x57')]({'name':_0x4b9487[_0x898a('0x37')],'resourceId':_0x4b9487['id'],'type':_0x3d3451[_0x898a('0x37')],'sectionId':_0x3d3451['id']},{})[_0x898a('0x31')](function(){return _0x3909c5;});}else{return _0x3909c5;}})['catch'](function(_0x32a207){logger[_0x898a('0x1f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x32a207);throw _0x32a207;});}return _0x3909c5;})[_0x898a('0x31')](respondWithResult(_0xfdd6d8,0xc9))['catch'](handleError(_0xfdd6d8,null));};exports[_0x898a('0x30')]=function(_0x4b2575,_0x2471d8,_0x387f2c){var _0x3b07dc;return db[_0x898a('0x4a')][_0x898a('0x52')]({'where':{'id':_0x4b2575[_0x898a('0x4d')]['id']}})[_0x898a('0x31')](handleEntityNotFound(_0x2471d8,null))[_0x898a('0x31')](saveUpdates(_0x4b2575[_0x898a('0x55')],null))['then'](function(_0x3fe54b){if(_0x3fe54b){_0x3b07dc=_0x3fe54b;return db[_0x898a('0x4a')][_0x898a('0x5d')]({'raw':!![]});}})[_0x898a('0x31')](function(_0x290972){if(_0x290972){var _0x1d594b=fs[_0x898a('0x5e')](path[_0x898a('0x61')](config[_0x898a('0x5f')],_0x898a('0x60')),'utf8');var _0x4fad03=fs[_0x898a('0x5e')](path[_0x898a('0x61')](config['root'],'server/files/templates/registry.ejs'),_0x898a('0x63'));var _0x4a79a4=ejs[_0x898a('0x64')](_0x1d594b,{'trunks':_0x290972||[]});fs[_0x898a('0x65')]('/etc/asterisk/sip_xcally_trunks.conf',_0x4a79a4);var _0x3f6815=ejs[_0x898a('0x64')](_0x4fad03,{'trunks':_0x290972||[]});fs[_0x898a('0x65')](_0x898a('0x68'),_0x3f6815);return respondWithRpcPromise(_0x898a('0x69'),_0x898a('0x30'),{'module':_0x898a('0x6a')});}return null;})['then'](function(_0x3237e8){if(_0x3237e8){return _0x3b07dc;}})[_0x898a('0x31')](respondWithResult(_0x2471d8,null))[_0x898a('0x23')](handleError(_0x2471d8,null));};exports['destroy']=function(_0x27560f,_0x61247c,_0x5c6247){var _0x39e917;return db['Trunk']['find']({'where':{'id':_0x27560f['params']['id']}})[_0x898a('0x31')](handleEntityNotFound(_0x61247c,null))[_0x898a('0x31')](removeEntity(_0x61247c,null))[_0x898a('0x31')](function(){return db[_0x898a('0x4a')][_0x898a('0x5d')]({'raw':!![]});})[_0x898a('0x31')](function(_0x12e54b){var _0x50dd52=fs[_0x898a('0x5e')](path['join'](config[_0x898a('0x5f')],_0x898a('0x60')),'utf8');var _0x24670c=fs[_0x898a('0x5e')](path[_0x898a('0x61')](config[_0x898a('0x5f')],_0x898a('0x62')),'utf8');var _0x5847cb=ejs['render'](_0x50dd52,{'trunks':_0x12e54b});var _0x3b8fb5=ejs[_0x898a('0x64')](_0x24670c,{'trunks':_0x12e54b});fs[_0x898a('0x65')]('/etc/asterisk/sip_xcally_trunks.conf',_0x5847cb);fs[_0x898a('0x65')]('/etc/asterisk/sip_xcally_registers.conf',_0x3b8fb5);return respondWithRpcPromise('Reload',_0x898a('0x32'),{'module':_0x898a('0x6a')});})[_0x898a('0x23')](handleError(_0x61247c,null));}; \ No newline at end of file +var _0x54ef=['intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','show','params','include','find','get','updatedAt','omit','body','createdAt','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','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','userProfileId','root','chan_sip.so','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','http','request','info','Trunk,\x20%s,\x20%s','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','Trunks','UserProfileResource','name','send','index','map','Trunk','rawAttributes','fieldName','type','key','model','query','keys','filters'];(function(_0x58903f,_0x3587d3){var _0x5226b1=function(_0x51a02a){while(--_0x51a02a){_0x58903f['push'](_0x58903f['shift']());}};_0x5226b1(++_0x3587d3);}(_0x54ef,0x112));var _0xf54e=function(_0x88c2f,_0x36c681){_0x88c2f=_0x88c2f-0x0;var _0x52f41c=_0x54ef[_0x88c2f];return _0x52f41c;};'use strict';var emlformat=require(_0xf54e('0x0'));var rimraf=require(_0xf54e('0x1'));var zipdir=require(_0xf54e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf54e('0x3'));var moment=require(_0xf54e('0x4'));var BPromise=require(_0xf54e('0x5'));var Mustache=require(_0xf54e('0x6'));var util=require(_0xf54e('0x7'));var path=require(_0xf54e('0x8'));var sox=require(_0xf54e('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf54e('0xa'));var _=require(_0xf54e('0xb'));var squel=require(_0xf54e('0xc'));var crypto=require('crypto');var jsforce=require(_0xf54e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf54e('0xe'));var querystring=require(_0xf54e('0xf'));var Papa=require('papaparse');var Redis=require(_0xf54e('0x10'));var authService=require(_0xf54e('0x11'));var qs=require(_0xf54e('0x12'));var as=require(_0xf54e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf54e('0x14'))(_0xf54e('0x15'));var utils=require(_0xf54e('0x16'));var config=require(_0xf54e('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xf54e('0x18'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0xf54e('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x2033e9,_0x28f776,_0x380f26,_0x5644aa){return new BPromise(function(_0x331732,_0x1bbeaa){var _0x1855fe=_0x5644aa||client;return _0x1855fe[_0xf54e('0x1a')](_0x2033e9,_0x380f26)['then'](function(_0x2366ee){logger[_0xf54e('0x1b')](_0xf54e('0x1c'),_0x28f776,'request\x20sent');logger['debug'](_0xf54e('0x1d'),_0x28f776,_0xf54e('0x1e'),JSON[_0xf54e('0x1f')](_0x2366ee));if(_0x2366ee[_0xf54e('0x20')]){if(_0x2366ee[_0xf54e('0x20')][_0xf54e('0x21')]===0x1f4){logger[_0xf54e('0x20')](_0xf54e('0x1c'),_0x28f776,_0x2366ee[_0xf54e('0x20')][_0xf54e('0x22')]);return _0x1bbeaa(_0x2366ee[_0xf54e('0x20')]['message']);}logger['error'](_0xf54e('0x1c'),_0x28f776,_0x2366ee['error'][_0xf54e('0x22')]);return _0x331732(_0x2366ee[_0xf54e('0x20')][_0xf54e('0x22')]);}else{logger[_0xf54e('0x1b')](_0xf54e('0x1c'),_0x28f776,_0xf54e('0x1e'));_0x331732(_0x2366ee[_0xf54e('0x23')][_0xf54e('0x22')]);}})[_0xf54e('0x24')](function(_0x5f9eea){logger[_0xf54e('0x20')]('Trunk,\x20%s,\x20%s',_0x28f776,_0x5f9eea);_0x1bbeaa(_0x5f9eea);});});}function respondWithStatusCode(_0x6f6d29,_0x54f914){_0x54f914=_0x54f914||0xcc;return function(_0x264a8f){if(_0x264a8f){return _0x6f6d29[_0xf54e('0x25')](_0x54f914);}return _0x6f6d29[_0xf54e('0x26')](_0x54f914)[_0xf54e('0x27')]();};}function respondWithResult(_0x3805a7,_0x160160){_0x160160=_0x160160||0xc8;return function(_0x1e08d1){if(_0x1e08d1){return _0x3805a7[_0xf54e('0x26')](_0x160160)[_0xf54e('0x28')](_0x1e08d1);}};}function respondWithFilteredResult(_0x33457f,_0xf6cdd7){return function(_0x39c0ae){if(_0x39c0ae){var _0x2ea001=typeof _0xf6cdd7['offset']===_0xf54e('0x29')&&typeof _0xf6cdd7['limit']===_0xf54e('0x29');var _0x5e63f4=_0x39c0ae[_0xf54e('0x2a')];var _0x269f47=_0x2ea001?0x0:_0xf6cdd7[_0xf54e('0x2b')];var _0xa13cd0=_0x2ea001?_0x39c0ae[_0xf54e('0x2a')]:_0xf6cdd7[_0xf54e('0x2b')]+_0xf6cdd7[_0xf54e('0x2c')];var _0x54bd8f;if(_0xa13cd0>=_0x5e63f4){_0xa13cd0=_0x5e63f4;_0x54bd8f=0xc8;}else{_0x54bd8f=0xce;}_0x33457f['status'](_0x54bd8f);return _0x33457f[_0xf54e('0x2d')](_0xf54e('0x2e'),_0x269f47+'-'+_0xa13cd0+'/'+_0x5e63f4)[_0xf54e('0x28')](_0x39c0ae);}return null;};}function patchUpdates(_0x16d00f){return function(_0xb2d4c4){try{jsonpatch[_0xf54e('0x2f')](_0xb2d4c4,_0x16d00f,!![]);}catch(_0x2b5408){return BPromise[_0xf54e('0x30')](_0x2b5408);}return _0xb2d4c4[_0xf54e('0x31')]();};}function saveUpdates(_0x12edc3,_0x5ea0cc){return function(_0x5f29d3){if(_0x5f29d3){return _0x5f29d3[_0xf54e('0x32')](_0x12edc3)[_0xf54e('0x33')](function(_0x4d8fdd){return _0x4d8fdd;});}return null;};}function removeEntity(_0x3e319c,_0x82e313){return function(_0x379110){if(_0x379110){return _0x379110[_0xf54e('0x34')]()['then'](function(){var _0x54bea4=_0x379110['get']({'plain':!![]});var _0x3c0cca=_0xf54e('0x35');return db[_0xf54e('0x36')][_0xf54e('0x34')]({'where':{'type':_0x3c0cca,'resourceId':_0x54bea4['id']}})[_0xf54e('0x33')](function(){return _0x379110;});})[_0xf54e('0x33')](function(){_0x3e319c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x530cee,_0xc04e04){return function(_0x734187){if(!_0x734187){_0x530cee['sendStatus'](0x194);}return _0x734187;};}function handleError(_0x4d9b06,_0xda1d10){_0xda1d10=_0xda1d10||0x1f4;return function(_0x2c0d30){logger[_0xf54e('0x20')](_0x2c0d30['stack']);if(_0x2c0d30[_0xf54e('0x37')]){delete _0x2c0d30[_0xf54e('0x37')];}_0x4d9b06['status'](_0xda1d10)[_0xf54e('0x38')](_0x2c0d30);};}exports[_0xf54e('0x39')]=function(_0x5af03,_0x1eeeb4){var _0x12ef97={},_0x199056={},_0x4e00b7={'count':0x0,'rows':[]};var _0x5d45cf=_[_0xf54e('0x3a')](db[_0xf54e('0x3b')][_0xf54e('0x3c')],function(_0x4b1f84){return{'name':_0x4b1f84[_0xf54e('0x3d')],'type':_0x4b1f84[_0xf54e('0x3e')][_0xf54e('0x3f')]};});_0x199056[_0xf54e('0x40')]=_[_0xf54e('0x3a')](_0x5d45cf,_0xf54e('0x37'));_0x199056[_0xf54e('0x41')]=_[_0xf54e('0x42')](_0x5af03[_0xf54e('0x41')]);_0x199056[_0xf54e('0x43')]=_[_0xf54e('0x44')](_0x199056[_0xf54e('0x40')],_0x199056[_0xf54e('0x41')]);_0x12ef97[_0xf54e('0x45')]=_[_0xf54e('0x44')](_0x199056['model'],qs['fields'](_0x5af03['query'][_0xf54e('0x46')]));_0x12ef97[_0xf54e('0x45')]=_0x12ef97['attributes'][_0xf54e('0x47')]?_0x12ef97[_0xf54e('0x45')]:_0x199056[_0xf54e('0x40')];if(!_0x5af03['query'][_0xf54e('0x48')](_0xf54e('0x49'))){_0x12ef97[_0xf54e('0x2c')]=qs[_0xf54e('0x2c')](_0x5af03[_0xf54e('0x41')][_0xf54e('0x2c')]);_0x12ef97[_0xf54e('0x2b')]=qs[_0xf54e('0x2b')](_0x5af03[_0xf54e('0x41')]['offset']);}_0x12ef97[_0xf54e('0x4a')]=qs[_0xf54e('0x4b')](_0x5af03[_0xf54e('0x41')][_0xf54e('0x4b')]);_0x12ef97[_0xf54e('0x4c')]=qs[_0xf54e('0x43')](_['pick'](_0x5af03[_0xf54e('0x41')],_0x199056['filters']),_0x5d45cf);if(_0x5af03[_0xf54e('0x41')]['filter']){_0x12ef97[_0xf54e('0x4c')]=_[_0xf54e('0x4d')](_0x12ef97[_0xf54e('0x4c')],{'$or':_['map'](_0x5d45cf,function(_0x1af35d){if(_0x1af35d[_0xf54e('0x3e')]!==_0xf54e('0x4e')){var _0x32fb46={};_0x32fb46[_0x1af35d[_0xf54e('0x37')]]={'$like':'%'+_0x5af03['query'][_0xf54e('0x4f')]+'%'};return _0x32fb46;}})});}_0x12ef97=_[_0xf54e('0x4d')]({},_0x12ef97,_0x5af03[_0xf54e('0x50')]);var _0x45592b={'where':_0x12ef97['where']};return db[_0xf54e('0x3b')][_0xf54e('0x2a')](_0x45592b)['then'](function(_0x22c842){_0x4e00b7[_0xf54e('0x2a')]=_0x22c842;if(_0x5af03[_0xf54e('0x41')][_0xf54e('0x51')]){_0x12ef97['include']=[{'all':!![]}];}return db[_0xf54e('0x3b')][_0xf54e('0x52')](_0x12ef97);})[_0xf54e('0x33')](function(_0xb4654f){_0x4e00b7[_0xf54e('0x53')]=_0xb4654f;return _0x4e00b7;})[_0xf54e('0x33')](respondWithFilteredResult(_0x1eeeb4,_0x12ef97))[_0xf54e('0x24')](handleError(_0x1eeeb4,null));};exports[_0xf54e('0x54')]=function(_0x15bfef,_0x21f2f8){var _0xaf9bf0={'raw':![],'where':{'id':_0x15bfef[_0xf54e('0x55')]['id']}},_0x1f4cf8={};_0x1f4cf8[_0xf54e('0x40')]=_[_0xf54e('0x42')](db[_0xf54e('0x3b')][_0xf54e('0x3c')]);_0x1f4cf8[_0xf54e('0x41')]=_[_0xf54e('0x42')](_0x15bfef[_0xf54e('0x41')]);_0x1f4cf8['filters']=_['intersection'](_0x1f4cf8[_0xf54e('0x40')],_0x1f4cf8[_0xf54e('0x41')]);_0xaf9bf0[_0xf54e('0x45')]=_[_0xf54e('0x44')](_0x1f4cf8[_0xf54e('0x40')],qs[_0xf54e('0x46')](_0x15bfef[_0xf54e('0x41')][_0xf54e('0x46')]));_0xaf9bf0[_0xf54e('0x45')]=_0xaf9bf0[_0xf54e('0x45')][_0xf54e('0x47')]?_0xaf9bf0['attributes']:_0x1f4cf8[_0xf54e('0x40')];if(_0x15bfef[_0xf54e('0x41')][_0xf54e('0x51')]){_0xaf9bf0[_0xf54e('0x56')]=[{'all':!![]}];}_0xaf9bf0=_[_0xf54e('0x4d')]({},_0xaf9bf0,_0x15bfef[_0xf54e('0x50')]);return db[_0xf54e('0x3b')]['find'](_0xaf9bf0)[_0xf54e('0x33')](handleEntityNotFound(_0x21f2f8,null))[_0xf54e('0x33')](respondWithResult(_0x21f2f8,null))[_0xf54e('0x24')](handleError(_0x21f2f8,null));};exports['clone']=function(_0x3ce832,_0x54ac1a){var _0x465a0f={'where':{'id':_0x3ce832[_0xf54e('0x55')]['id']}},_0x400ee0={};_0x400ee0['model']=_[_0xf54e('0x42')](db[_0xf54e('0x3b')][_0xf54e('0x3c')]);_0x465a0f[_0xf54e('0x45')]=_[_0xf54e('0x44')](_0x400ee0[_0xf54e('0x40')],qs[_0xf54e('0x46')](_0x3ce832['query']['fields']));_0x465a0f[_0xf54e('0x45')]=_0x465a0f[_0xf54e('0x45')]['length']?_0x465a0f[_0xf54e('0x45')]:_0x400ee0['model'];if(_0x3ce832[_0xf54e('0x41')]['includeAll']){_0x465a0f[_0xf54e('0x56')]=[{'all':!![]}];}_0x465a0f=_[_0xf54e('0x4d')]({},_0x465a0f,_0x3ce832[_0xf54e('0x50')]);return db[_0xf54e('0x3b')][_0xf54e('0x57')](_0x465a0f)[_0xf54e('0x33')](handleEntityNotFound(_0x54ac1a,null))['then'](function(_0x479572){if(_0x479572){var _0x79345=_0x479572[_0xf54e('0x58')]({'plain':!![]});_0x79345=qs['omit'](_0x79345,['id','createdAt',_0xf54e('0x59')]);_0x3ce832['body']=_[_0xf54e('0x5a')](_0x3ce832[_0xf54e('0x5b')],['id',_0xf54e('0x5c'),_0xf54e('0x59')]);return db[_0xf54e('0x3b')][_0xf54e('0x5d')](_[_0xf54e('0x4d')](_0x79345,_0x3ce832[_0xf54e('0x5b')]),{'include':_0x3ce832[_0xf54e('0x41')][_0xf54e('0x51')]?[{'all':!![]}]:undefined})[_0xf54e('0x33')](function(_0x2c6d0e){var _0x65bdf2=_0x3ce832[_0xf54e('0x5e')]['get']({'plain':!![]});if(!_0x65bdf2)throw new Error(_0xf54e('0x5f'));if(_0x65bdf2[_0xf54e('0x60')]===_0xf54e('0x5e')){var _0x11908b=_0x2c6d0e[_0xf54e('0x58')]({'plain':!![]});var _0x494629=_0xf54e('0x35');return db[_0xf54e('0x61')]['find']({'where':{'name':_0x494629,'userProfileId':_0x65bdf2['userProfileId']},'raw':!![]})[_0xf54e('0x33')](function(_0x4b4a2f){if(_0x4b4a2f&&_0x4b4a2f[_0xf54e('0x62')]===0x0){return db[_0xf54e('0x36')][_0xf54e('0x5d')]({'name':_0x11908b[_0xf54e('0x37')],'resourceId':_0x11908b['id'],'type':_0x4b4a2f['name'],'sectionId':_0x4b4a2f['id']},{})[_0xf54e('0x33')](function(){return _0x2c6d0e;});}else{return _0x2c6d0e;}})['catch'](function(_0x3800d4){logger[_0xf54e('0x20')](_0xf54e('0x63'),_0x3800d4);throw _0x3800d4;});}return _0x2c6d0e;});}})['then'](respondWithResult(_0x54ac1a,0xc9))[_0xf54e('0x24')](handleError(_0x54ac1a,null));};exports['create']=function(_0x3f7224,_0x3e2101,_0x5500d7){var _0x380b4f;return db['Trunk'][_0xf54e('0x5d')](_0x3f7224[_0xf54e('0x5b')],{'raw':!![]})[_0xf54e('0x33')](function(_0x38405c){_0x380b4f=_0x38405c;return db[_0xf54e('0x3b')]['findAll']({'raw':!![]});})[_0xf54e('0x33')](function(_0x1d18d3){var _0x57db6f=fs[_0xf54e('0x64')](path[_0xf54e('0x65')](config['root'],_0xf54e('0x66')),_0xf54e('0x67'));var _0x309895=fs['readFileSync'](path[_0xf54e('0x65')](config['root'],_0xf54e('0x68')),_0xf54e('0x67'));var _0x5e45e7=ejs[_0xf54e('0x69')](_0x57db6f,{'trunks':_0x1d18d3||[]});fs[_0xf54e('0x6a')](_0xf54e('0x6b'),_0x5e45e7);if(_0x380b4f[_0xf54e('0x6c')]){var _0x38bf71=ejs[_0xf54e('0x69')](_0x309895,{'trunks':_0x1d18d3||[]});fs[_0xf54e('0x6a')](_0xf54e('0x6d'),_0x38bf71);}})[_0xf54e('0x33')](function(){return respondWithRpcPromise(_0xf54e('0x6e'),_0xf54e('0x5d'),{'module':'chan_sip.so'});})[_0xf54e('0x33')](function(){var _0x2c20b5=_0x3f7224[_0xf54e('0x5e')]['get']({'plain':!![]});if(!_0x2c20b5)throw new Error(_0xf54e('0x5f'));if(_0x2c20b5[_0xf54e('0x60')]===_0xf54e('0x5e')){var _0x13db3e=_0x380b4f[_0xf54e('0x58')]({'plain':!![]});return db[_0xf54e('0x61')][_0xf54e('0x57')]({'where':{'name':'Trunks','userProfileId':_0x2c20b5[_0xf54e('0x6f')]},'raw':!![]})[_0xf54e('0x33')](function(_0x261c39){if(_0x261c39&&_0x261c39['autoAssociation']===0x0){return db[_0xf54e('0x36')][_0xf54e('0x5d')]({'name':_0x13db3e[_0xf54e('0x37')],'resourceId':_0x13db3e['id'],'type':_0x261c39[_0xf54e('0x37')],'sectionId':_0x261c39['id']},{})['then'](function(){return _0x380b4f;});}else{return _0x380b4f;}})['catch'](function(_0x25d05e){logger[_0xf54e('0x20')](_0xf54e('0x63'),_0x25d05e);throw _0x25d05e;});}return _0x380b4f;})[_0xf54e('0x33')](respondWithResult(_0x3e2101,0xc9))[_0xf54e('0x24')](handleError(_0x3e2101,null));};exports[_0xf54e('0x32')]=function(_0x35b5a4,_0x3b2a3e,_0xf5108b){var _0x205b47;return db['Trunk'][_0xf54e('0x57')]({'where':{'id':_0x35b5a4[_0xf54e('0x55')]['id']}})[_0xf54e('0x33')](handleEntityNotFound(_0x3b2a3e,null))[_0xf54e('0x33')](saveUpdates(_0x35b5a4['body'],null))[_0xf54e('0x33')](function(_0x1de6dd){if(_0x1de6dd){_0x205b47=_0x1de6dd;return db[_0xf54e('0x3b')][_0xf54e('0x52')]({'raw':!![]});}})['then'](function(_0x394862){if(_0x394862){var _0x4876b5=fs[_0xf54e('0x64')](path['join'](config['root'],_0xf54e('0x66')),_0xf54e('0x67'));var _0x1e2834=fs[_0xf54e('0x64')](path[_0xf54e('0x65')](config[_0xf54e('0x70')],_0xf54e('0x68')),_0xf54e('0x67'));var _0x8093bc=ejs['render'](_0x4876b5,{'trunks':_0x394862||[]});fs[_0xf54e('0x6a')](_0xf54e('0x6b'),_0x8093bc);var _0x4ce10=ejs[_0xf54e('0x69')](_0x1e2834,{'trunks':_0x394862||[]});fs[_0xf54e('0x6a')](_0xf54e('0x6d'),_0x4ce10);return respondWithRpcPromise(_0xf54e('0x6e'),_0xf54e('0x32'),{'module':_0xf54e('0x71')});}return null;})[_0xf54e('0x33')](function(_0x11dec2){if(_0x11dec2){return _0x205b47;}})[_0xf54e('0x33')](respondWithResult(_0x3b2a3e,null))['catch'](handleError(_0x3b2a3e,null));};exports[_0xf54e('0x34')]=function(_0x1cfa09,_0x59acbc,_0x4a0614){var _0x85b108;return db[_0xf54e('0x3b')][_0xf54e('0x57')]({'where':{'id':_0x1cfa09[_0xf54e('0x55')]['id']}})[_0xf54e('0x33')](handleEntityNotFound(_0x59acbc,null))[_0xf54e('0x33')](removeEntity(_0x59acbc,null))[_0xf54e('0x33')](function(){return db[_0xf54e('0x3b')][_0xf54e('0x52')]({'raw':!![]});})['then'](function(_0x2bb31f){var _0x3c222a=fs[_0xf54e('0x64')](path['join'](config[_0xf54e('0x70')],'server/files/templates/trunk.ejs'),_0xf54e('0x67'));var _0x57bc6f=fs[_0xf54e('0x64')](path[_0xf54e('0x65')](config['root'],'server/files/templates/registry.ejs'),_0xf54e('0x67'));var _0x632240=ejs[_0xf54e('0x69')](_0x3c222a,{'trunks':_0x2bb31f});var _0x406261=ejs[_0xf54e('0x69')](_0x57bc6f,{'trunks':_0x2bb31f});fs['writeFileSync']('/etc/asterisk/sip_xcally_trunks.conf',_0x632240);fs[_0xf54e('0x6a')](_0xf54e('0x6d'),_0x406261);return respondWithRpcPromise(_0xf54e('0x6e'),_0xf54e('0x34'),{'module':_0xf54e('0x71')});})[_0xf54e('0x24')](handleError(_0x59acbc,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 997cb14..c081227 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 _0xd82c=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./trunk.attributes','exports','define','Trunk','tools_trunks','lodash','../../config/logger'];(function(_0x17c38b,_0x201c48){var _0x52e7a4=function(_0x2fa956){while(--_0x2fa956){_0x17c38b['push'](_0x17c38b['shift']());}};_0x52e7a4(++_0x201c48);}(_0xd82c,0xb4));var _0xcd82=function(_0x82ef14,_0x298691){_0x82ef14=_0x82ef14-0x0;var _0x53f793=_0xd82c[_0x82ef14];return _0x53f793;};'use strict';var _=require(_0xcd82('0x0'));var util=require('util');var logger=require(_0xcd82('0x1'))(_0xcd82('0x2'));var moment=require(_0xcd82('0x3'));var BPromise=require(_0xcd82('0x4'));var rp=require(_0xcd82('0x5'));var fs=require('fs');var path=require(_0xcd82('0x6'));var rimraf=require(_0xcd82('0x7'));var config=require(_0xcd82('0x8'));var attributes=require(_0xcd82('0x9'));module[_0xcd82('0xa')]=function(_0x119551,_0x3be425){return _0x119551[_0xcd82('0xb')](_0xcd82('0xc'),attributes,{'tableName':_0xcd82('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd5cc=['lodash','util','../../config/logger','api','bluebird','rimraf','./trunk.attributes','define','Trunk'];(function(_0x198fc6,_0x5eaee9){var _0x4376bb=function(_0x4b3241){while(--_0x4b3241){_0x198fc6['push'](_0x198fc6['shift']());}};_0x4376bb(++_0x5eaee9);}(_0xd5cc,0x183));var _0xcd5c=function(_0x48f10d,_0x3ee406){_0x48f10d=_0x48f10d-0x0;var _0x3877ef=_0xd5cc[_0x48f10d];return _0x3877ef;};'use strict';var _=require(_0xcd5c('0x0'));var util=require(_0xcd5c('0x1'));var logger=require(_0xcd5c('0x2'))(_0xcd5c('0x3'));var moment=require('moment');var BPromise=require(_0xcd5c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xcd5c('0x5'));var config=require('../../config/environment');var attributes=require(_0xcd5c('0x6'));module['exports']=function(_0x2c10e2,_0x113d72){return _0x2c10e2[_0xcd5c('0x7')](_0xcd5c('0x8'),attributes,{'tableName':'tools_trunks','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 54d52fa..c04a165 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 _0x5c94=['Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetTrunk','findAll','options','raw','where','attributes','include','map','model','then','ShowTrunk','Trunk','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','info','Trunk,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x5c94,0xc2));var _0x45c9=function(_0xdac6b0,_0x52f950){_0xdac6b0=_0xdac6b0-0x0;var _0x4a73ef=_0x5c94[_0xdac6b0];return _0x4a73ef;};'use strict';var _=require(_0x45c9('0x0'));var util=require(_0x45c9('0x1'));var moment=require(_0x45c9('0x2'));var BPromise=require(_0x45c9('0x3'));var rs=require(_0x45c9('0x4'));var fs=require('fs');var Redis=require(_0x45c9('0x5'));var db=require(_0x45c9('0x6'))['db'];var utils=require(_0x45c9('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x45c9('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x45c9('0x9')][_0x45c9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3c3c51,_0x8b1ec1,_0x56aa7e){return new BPromise(function(_0x51e363,_0x2d9f6d){return client[_0x45c9('0xb')](_0x3c3c51,_0x56aa7e)['then'](function(_0x53e6c6){logger[_0x45c9('0xc')](_0x45c9('0xd'),_0x8b1ec1,_0x45c9('0xe'));logger[_0x45c9('0xf')](_0x45c9('0x10'),_0x8b1ec1,'request\x20sent',JSON[_0x45c9('0x11')](_0x53e6c6));if(_0x53e6c6[_0x45c9('0x12')]){if(_0x53e6c6['error'][_0x45c9('0x13')]===0x1f4){logger['error'](_0x45c9('0xd'),_0x8b1ec1,_0x53e6c6['error'][_0x45c9('0x14')]);return _0x2d9f6d(_0x53e6c6[_0x45c9('0x12')][_0x45c9('0x14')]);}logger[_0x45c9('0x12')]('Trunk,\x20%s,\x20%s',_0x8b1ec1,_0x53e6c6[_0x45c9('0x12')][_0x45c9('0x14')]);return _0x51e363(_0x53e6c6[_0x45c9('0x12')][_0x45c9('0x14')]);}else{logger[_0x45c9('0xc')](_0x45c9('0xd'),_0x8b1ec1,_0x45c9('0xe'));_0x51e363(_0x53e6c6['result'][_0x45c9('0x14')]);}})[_0x45c9('0x15')](function(_0x1e5965){logger['error'](_0x45c9('0xd'),_0x8b1ec1,_0x1e5965);_0x2d9f6d(_0x1e5965);});});}exports[_0x45c9('0x16')]=function(_0x39cda6){var _0x4a5518=this;return new Promise(function(_0x477b88,_0x20b79e){return db['Trunk'][_0x45c9('0x17')]({'raw':_0x39cda6[_0x45c9('0x18')]?_0x39cda6[_0x45c9('0x18')][_0x45c9('0x19')]===undefined?!![]:![]:!![],'where':_0x39cda6[_0x45c9('0x18')]?_0x39cda6[_0x45c9('0x18')][_0x45c9('0x1a')]||null:null,'attributes':_0x39cda6[_0x45c9('0x18')]?_0x39cda6[_0x45c9('0x18')][_0x45c9('0x1b')]||null:null,'limit':_0x39cda6['options']?_0x39cda6[_0x45c9('0x18')]['limit']||null:null,'include':_0x39cda6[_0x45c9('0x18')]?_0x39cda6['options'][_0x45c9('0x1c')]?_[_0x45c9('0x1d')](_0x39cda6['options'][_0x45c9('0x1c')],function(_0x257913){return{'model':db[_0x257913['model']],'as':_0x257913['as'],'attributes':_0x257913['attributes'],'include':_0x257913[_0x45c9('0x1c')]?_[_0x45c9('0x1d')](_0x257913[_0x45c9('0x1c')],function(_0x255293){return{'model':db[_0x255293[_0x45c9('0x1e')]],'as':_0x255293['as'],'attributes':_0x255293['attributes'],'include':_0x255293[_0x45c9('0x1c')]?_['map'](_0x255293[_0x45c9('0x1c')],function(_0x1b9290){return{'model':db[_0x1b9290[_0x45c9('0x1e')]],'as':_0x1b9290['as'],'attributes':_0x1b9290['attributes']};}):[]};}):[]};}):[]:[]})[_0x45c9('0x1f')](function(_0x3b51c1){logger[_0x45c9('0xc')](_0x45c9('0x16'),_0x39cda6);logger['debug']('GetTrunk',_0x39cda6,JSON['stringify'](_0x3b51c1));_0x477b88(_0x3b51c1);})[_0x45c9('0x15')](function(_0x288561){logger['error'](_0x45c9('0x16'),_0x288561[_0x45c9('0x14')],_0x39cda6);_0x20b79e(_0x4a5518[_0x45c9('0x12')](0x1f4,_0x288561[_0x45c9('0x14')]));});});};exports[_0x45c9('0x20')]=function(_0x5b2361){var _0x12cf3c=this;return new Promise(function(_0x31c9d1,_0x372b7a){return db[_0x45c9('0x21')][_0x45c9('0x22')]({'raw':_0x5b2361[_0x45c9('0x18')]?_0x5b2361[_0x45c9('0x18')][_0x45c9('0x19')]===undefined?!![]:![]:!![],'where':_0x5b2361[_0x45c9('0x18')]?_0x5b2361['options'][_0x45c9('0x1a')]||null:null,'attributes':_0x5b2361[_0x45c9('0x18')]?_0x5b2361[_0x45c9('0x18')]['attributes']||null:null,'include':_0x5b2361['options']?_0x5b2361['options'][_0x45c9('0x1c')]?_[_0x45c9('0x1d')](_0x5b2361[_0x45c9('0x18')][_0x45c9('0x1c')],function(_0xfd4f0){return{'model':db[_0xfd4f0[_0x45c9('0x1e')]],'as':_0xfd4f0['as'],'attributes':_0xfd4f0[_0x45c9('0x1b')],'include':_0xfd4f0[_0x45c9('0x1c')]?_['map'](_0xfd4f0[_0x45c9('0x1c')],function(_0x5e3c35){return{'model':db[_0x5e3c35[_0x45c9('0x1e')]],'as':_0x5e3c35['as'],'attributes':_0x5e3c35['attributes'],'include':_0x5e3c35[_0x45c9('0x1c')]?_[_0x45c9('0x1d')](_0x5e3c35[_0x45c9('0x1c')],function(_0x78e27){return{'model':db[_0x78e27[_0x45c9('0x1e')]],'as':_0x78e27['as'],'attributes':_0x78e27[_0x45c9('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x68fa57){logger[_0x45c9('0xc')](_0x45c9('0x20'),_0x5b2361);logger['debug'](_0x45c9('0x20'),_0x5b2361,JSON[_0x45c9('0x11')](_0x68fa57));_0x31c9d1(_0x68fa57);})[_0x45c9('0x15')](function(_0x4c31e6){logger[_0x45c9('0x12')](_0x45c9('0x20'),_0x4c31e6[_0x45c9('0x14')],_0x5b2361);_0x372b7a(_0x12cf3c[_0x45c9('0x12')](0x1f4,_0x4c31e6[_0x45c9('0x14')]));});});}; \ No newline at end of file +var _0xb095=['info','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','GetTrunk','Trunk','options','raw','attributes','limit','include','map','model','stringify','catch','find','where','lodash','randomstring','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then'];(function(_0x1b81ed,_0x239c78){var _0x3a78a4=function(_0x3ad52f){while(--_0x3ad52f){_0x1b81ed['push'](_0x1b81ed['shift']());}};_0x3a78a4(++_0x239c78);}(_0xb095,0x1b9));var _0x5b09=function(_0x19af8b,_0x30fb4d){_0x19af8b=_0x19af8b-0x0;var _0x39ec8b=_0xb095[_0x19af8b];return _0x39ec8b;};'use strict';var _=require(_0x5b09('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5b09('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5b09('0x2'))['db'];var utils=require(_0x5b09('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0x5b09('0x4'));var jayson=require('jayson/promise');var client=jayson[_0x5b09('0x5')][_0x5b09('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x26aaa8,_0x1eb4d1,_0x323cca){return new BPromise(function(_0x96006a,_0xe51017){return client[_0x5b09('0x7')](_0x26aaa8,_0x323cca)[_0x5b09('0x8')](function(_0x3946cd){logger[_0x5b09('0x9')](_0x5b09('0xa'),_0x1eb4d1,'request\x20sent');logger[_0x5b09('0xb')](_0x5b09('0xc'),_0x1eb4d1,_0x5b09('0xd'),JSON['stringify'](_0x3946cd));if(_0x3946cd['error']){if(_0x3946cd[_0x5b09('0xe')][_0x5b09('0xf')]===0x1f4){logger['error']('Trunk,\x20%s,\x20%s',_0x1eb4d1,_0x3946cd[_0x5b09('0xe')][_0x5b09('0x10')]);return _0xe51017(_0x3946cd[_0x5b09('0xe')][_0x5b09('0x10')]);}logger['error'](_0x5b09('0xa'),_0x1eb4d1,_0x3946cd[_0x5b09('0xe')][_0x5b09('0x10')]);return _0x96006a(_0x3946cd[_0x5b09('0xe')]['message']);}else{logger['info'](_0x5b09('0xa'),_0x1eb4d1,_0x5b09('0xd'));_0x96006a(_0x3946cd['result'][_0x5b09('0x10')]);}})['catch'](function(_0x30e5fb){logger[_0x5b09('0xe')](_0x5b09('0xa'),_0x1eb4d1,_0x30e5fb);_0xe51017(_0x30e5fb);});});}exports[_0x5b09('0x11')]=function(_0x3861cf){var _0x3720aa=this;return new Promise(function(_0x53f9c0,_0x4d2d72){return db[_0x5b09('0x12')]['findAll']({'raw':_0x3861cf[_0x5b09('0x13')]?_0x3861cf[_0x5b09('0x13')][_0x5b09('0x14')]===undefined?!![]:![]:!![],'where':_0x3861cf['options']?_0x3861cf[_0x5b09('0x13')]['where']||null:null,'attributes':_0x3861cf[_0x5b09('0x13')]?_0x3861cf[_0x5b09('0x13')][_0x5b09('0x15')]||null:null,'limit':_0x3861cf['options']?_0x3861cf['options'][_0x5b09('0x16')]||null:null,'include':_0x3861cf[_0x5b09('0x13')]?_0x3861cf['options'][_0x5b09('0x17')]?_[_0x5b09('0x18')](_0x3861cf[_0x5b09('0x13')][_0x5b09('0x17')],function(_0x8f5636){return{'model':db[_0x8f5636[_0x5b09('0x19')]],'as':_0x8f5636['as'],'attributes':_0x8f5636['attributes'],'include':_0x8f5636[_0x5b09('0x17')]?_[_0x5b09('0x18')](_0x8f5636[_0x5b09('0x17')],function(_0x37e7d3){return{'model':db[_0x37e7d3['model']],'as':_0x37e7d3['as'],'attributes':_0x37e7d3[_0x5b09('0x15')],'include':_0x37e7d3[_0x5b09('0x17')]?_['map'](_0x37e7d3[_0x5b09('0x17')],function(_0x339ab1){return{'model':db[_0x339ab1[_0x5b09('0x19')]],'as':_0x339ab1['as'],'attributes':_0x339ab1[_0x5b09('0x15')]};}):[]};}):[]};}):[]:[]})[_0x5b09('0x8')](function(_0x58f681){logger[_0x5b09('0x9')]('GetTrunk',_0x3861cf);logger[_0x5b09('0xb')]('GetTrunk',_0x3861cf,JSON[_0x5b09('0x1a')](_0x58f681));_0x53f9c0(_0x58f681);})[_0x5b09('0x1b')](function(_0x1a98d5){logger['error'](_0x5b09('0x11'),_0x1a98d5[_0x5b09('0x10')],_0x3861cf);_0x4d2d72(_0x3720aa['error'](0x1f4,_0x1a98d5[_0x5b09('0x10')]));});});};exports['ShowTrunk']=function(_0xa6797d){var _0x5bd340=this;return new Promise(function(_0xd37e75,_0x45d3d1){return db['Trunk'][_0x5b09('0x1c')]({'raw':_0xa6797d[_0x5b09('0x13')]?_0xa6797d[_0x5b09('0x13')][_0x5b09('0x14')]===undefined?!![]:![]:!![],'where':_0xa6797d[_0x5b09('0x13')]?_0xa6797d['options'][_0x5b09('0x1d')]||null:null,'attributes':_0xa6797d[_0x5b09('0x13')]?_0xa6797d[_0x5b09('0x13')][_0x5b09('0x15')]||null:null,'include':_0xa6797d[_0x5b09('0x13')]?_0xa6797d[_0x5b09('0x13')][_0x5b09('0x17')]?_['map'](_0xa6797d['options'][_0x5b09('0x17')],function(_0x33407a){return{'model':db[_0x33407a[_0x5b09('0x19')]],'as':_0x33407a['as'],'attributes':_0x33407a[_0x5b09('0x15')],'include':_0x33407a['include']?_[_0x5b09('0x18')](_0x33407a[_0x5b09('0x17')],function(_0x53960a){return{'model':db[_0x53960a['model']],'as':_0x53960a['as'],'attributes':_0x53960a['attributes'],'include':_0x53960a[_0x5b09('0x17')]?_[_0x5b09('0x18')](_0x53960a[_0x5b09('0x17')],function(_0x1eb624){return{'model':db[_0x1eb624[_0x5b09('0x19')]],'as':_0x1eb624['as'],'attributes':_0x1eb624[_0x5b09('0x15')]};}):[]};}):[]};}):[]:[]})[_0x5b09('0x8')](function(_0x60b5bd){logger[_0x5b09('0x9')]('ShowTrunk',_0xa6797d);logger[_0x5b09('0xb')]('ShowTrunk',_0xa6797d,JSON[_0x5b09('0x1a')](_0x60b5bd));_0xd37e75(_0x60b5bd);})[_0x5b09('0x1b')](function(_0x3b9c3d){logger['error']('ShowTrunk',_0x3b9c3d['message'],_0xa6797d);_0x45d3d1(_0x5bd340['error'](0x1f4,_0x3b9c3d[_0x5b09('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index 139917a..42b1a29 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 _0x823d=['Router','../../components/auth/service','put','update','exports','express'];(function(_0x3fd0cd,_0x25f157){var _0x521411=function(_0x236de0){while(--_0x236de0){_0x3fd0cd['push'](_0x3fd0cd['shift']());}};_0x521411(++_0x25f157);}(_0x823d,0x161));var _0xd823=function(_0xea343d,_0x311197){_0xea343d=_0xea343d-0x0;var _0x2c6e9c=_0x823d[_0xea343d];return _0x2c6e9c;};'use strict';var express=require(_0xd823('0x0'));var router=express[_0xd823('0x1')]();var auth=require(_0xd823('0x2'));var controller=require('./user-setting.controller');router[_0xd823('0x3')]('/:id',auth['isAuthenticated'](),controller[_0xd823('0x4')]);module[_0xd823('0x5')]=router; \ No newline at end of file +var _0xc27e=['put','/:id','isAuthenticated','exports','express','../../components/auth/service','./user-setting.controller'];(function(_0x3fed94,_0x261090){var _0x56834b=function(_0x3a7892){while(--_0x3a7892){_0x3fed94['push'](_0x3fed94['shift']());}};_0x56834b(++_0x261090);}(_0xc27e,0xd6));var _0xec27=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc27e[_0x3dd15e];return _0x231fd0;};'use strict';var express=require(_0xec27('0x0'));var router=express['Router']();var auth=require(_0xec27('0x1'));var controller=require(_0xec27('0x2'));router[_0xec27('0x3')](_0xec27('0x4'),auth[_0xec27('0x5')](),controller['update']);module[_0xec27('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 dae06d0..cb122fe 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 _0xe0ff=['DATE','INTEGER','sequelize','error','warning','exports','ENUM','TEXT'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xe0ff,0xc2));var _0xfe0f=function(_0x3b62e3,_0x403db8){_0x3b62e3=_0x3b62e3-0x0;var _0x3211fc=_0xe0ff[_0x3b62e3];return _0x3211fc;};'use strict';var Sequelize=require(_0xfe0f('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0xfe0f('0x1'),_0xfe0f('0x2'),'info','debug'];module[_0xfe0f('0x3')]={'clientSideLoggingLevel':{'type':Sequelize[_0xfe0f('0x4')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':'error','validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0xfe0f('0x5')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0xfe0f('0x6')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0xfe0f('0x7')],'unique':'UserId'}}; \ No newline at end of file +var _0xa892=['sequelize','warning','info','exports','ENUM','BOOLEAN','TEXT','DATE','INTEGER','UserId'];(function(_0x1210b7,_0x3cd395){var _0x527fd8=function(_0x17c334){while(--_0x17c334){_0x1210b7['push'](_0x1210b7['shift']());}};_0x527fd8(++_0x3cd395);}(_0xa892,0x8c));var _0x2a89=function(_0x5d3f71,_0x3dfdc6){_0x5d3f71=_0x5d3f71-0x0;var _0x1e1dad=_0xa892[_0x5d3f71];return _0x1e1dad;};'use strict';var Sequelize=require(_0x2a89('0x0'));const CLIENT_SIDE_LOG_LEVELS=['error',_0x2a89('0x1'),_0x2a89('0x2'),'debug'];module[_0x2a89('0x3')]={'clientSideLoggingLevel':{'type':Sequelize[_0x2a89('0x4')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':'error','validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x2a89('0x5')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0x2a89('0x6')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x2a89('0x7')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x2a89('0x8')],'unique':_0x2a89('0x9')}}; \ 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 ee16043..a2b33e8 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 _0xd691=['../../config/logger','../../config/environment','../../mysqldb','socket.io-emitter','redis','./user-setting.socket','register','defaults','localhost','json','update','sendStatus','error','stack','name','status','send','user','role','admin','Unauthorized','UserSetting','find','params','then','body','catch','lodash','ioredis'];(function(_0x45d50b,_0x25cfa9){var _0xba96f3=function(_0x54e414){while(--_0x54e414){_0x45d50b['push'](_0x45d50b['shift']());}};_0xba96f3(++_0x25cfa9);}(_0xd691,0xe6));var _0x1d69=function(_0x1d426f,_0x37e919){_0x1d426f=_0x1d426f-0x0;var _0x17f71a=_0xd691[_0x1d426f];return _0x17f71a;};'use strict';var _=require(_0x1d69('0x0'));var Redis=require(_0x1d69('0x1'));var logger=require(_0x1d69('0x2'))('api');var config=require(_0x1d69('0x3'));var db=require(_0x1d69('0x4'))['db'];var socket=require(_0x1d69('0x5'))(new Redis(config[_0x1d69('0x6')]));require(_0x1d69('0x7'))[_0x1d69('0x8')](socket);config[_0x1d69('0x6')]=_[_0x1d69('0x9')](config[_0x1d69('0x6')],{'host':_0x1d69('0xa'),'port':0x18eb});function respondWithResult(_0x5a5b0c,_0x520acb){_0x520acb=_0x520acb||0xc8;return function(_0x267da3){if(_0x267da3){return _0x5a5b0c['status'](_0x520acb)[_0x1d69('0xb')](_0x267da3);}};}function saveUpdates(_0x122b27){return function(_0x1a09f0){if(_0x1a09f0){return _0x1a09f0[_0x1d69('0xc')](_0x122b27)['then'](function(_0x298c17){return _0x298c17;});}return null;};}function handleEntityNotFound(_0xe9eae1){return function(_0x296541){if(!_0x296541){_0xe9eae1[_0x1d69('0xd')](0x194);}return _0x296541;};}function handleError(_0x294e75,_0x5d2092){_0x5d2092=_0x5d2092||0x1f4;return function(_0x5d1c82){logger[_0x1d69('0xe')](_0x5d1c82[_0x1d69('0xf')]);if(_0x5d1c82[_0x1d69('0x10')]){delete _0x5d1c82[_0x1d69('0x10')];}_0x294e75[_0x1d69('0x11')](_0x5d2092)[_0x1d69('0x12')](_0x5d1c82);};}exports[_0x1d69('0xc')]=function(_0x1d98be,_0x276389){if(_0x1d98be[_0x1d69('0x13')][_0x1d69('0x14')]!==_0x1d69('0x15'))throw new Error(_0x1d69('0x16'));if(isNaN(Number(_0x1d98be['params']['id'])))throw new Error('Invalid\x20user\x20setting\x20id');return db[_0x1d69('0x17')][_0x1d69('0x18')]({'where':{'id':_0x1d98be[_0x1d69('0x19')]['id']}})[_0x1d69('0x1a')](handleEntityNotFound(_0x276389,null))[_0x1d69('0x1a')](saveUpdates(_0x1d98be[_0x1d69('0x1b')],null))['then'](respondWithResult(_0x276389,null))[_0x1d69('0x1c')](handleError(_0x276389,null));}; \ No newline at end of file +var _0xc2cc=['send','user','role','params','UserSetting','find','catch','ioredis','../../config/logger','api','../../mysqldb','redis','register','defaults','json','update','then','sendStatus','error','name','status'];(function(_0x543d85,_0x17fe21){var _0x478ac1=function(_0x498ba4){while(--_0x498ba4){_0x543d85['push'](_0x543d85['shift']());}};_0x478ac1(++_0x17fe21);}(_0xc2cc,0x70));var _0xcc2c=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xc2cc[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require('lodash');var Redis=require(_0xcc2c('0x0'));var logger=require(_0xcc2c('0x1'))(_0xcc2c('0x2'));var config=require('../../config/environment');var db=require(_0xcc2c('0x3'))['db'];var socket=require('socket.io-emitter')(new Redis(config[_0xcc2c('0x4')]));require('./user-setting.socket')[_0xcc2c('0x5')](socket);config['redis']=_[_0xcc2c('0x6')](config['redis'],{'host':'localhost','port':0x18eb});function respondWithResult(_0x475a85,_0x4ab837){_0x4ab837=_0x4ab837||0xc8;return function(_0x144b90){if(_0x144b90){return _0x475a85['status'](_0x4ab837)[_0xcc2c('0x7')](_0x144b90);}};}function saveUpdates(_0x58c80c){return function(_0x56bb36){if(_0x56bb36){return _0x56bb36[_0xcc2c('0x8')](_0x58c80c)[_0xcc2c('0x9')](function(_0x233e31){return _0x233e31;});}return null;};}function handleEntityNotFound(_0x3b3481){return function(_0x2325be){if(!_0x2325be){_0x3b3481[_0xcc2c('0xa')](0x194);}return _0x2325be;};}function handleError(_0xb51804,_0x1c18a8){_0x1c18a8=_0x1c18a8||0x1f4;return function(_0x49853b){logger[_0xcc2c('0xb')](_0x49853b['stack']);if(_0x49853b[_0xcc2c('0xc')]){delete _0x49853b[_0xcc2c('0xc')];}_0xb51804[_0xcc2c('0xd')](_0x1c18a8)[_0xcc2c('0xe')](_0x49853b);};}exports['update']=function(_0x51bd29,_0x4d52fe){if(_0x51bd29[_0xcc2c('0xf')][_0xcc2c('0x10')]!=='admin')throw new Error('Unauthorized');if(isNaN(Number(_0x51bd29[_0xcc2c('0x11')]['id'])))throw new Error('Invalid\x20user\x20setting\x20id');return db[_0xcc2c('0x12')][_0xcc2c('0x13')]({'where':{'id':_0x51bd29[_0xcc2c('0x11')]['id']}})[_0xcc2c('0x9')](handleEntityNotFound(_0x4d52fe,null))['then'](saveUpdates(_0x51bd29['body'],null))[_0xcc2c('0x9')](respondWithResult(_0x4d52fe,null))[_0xcc2c('0x14')](handleError(_0x4d52fe,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 056beca..f594d2a 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 _0xafe0=['emit','hook','events','UserSetting','setMaxListeners','update','remove'];(function(_0x1e393b,_0x355f6b){var _0x3d0bfe=function(_0x320830){while(--_0x320830){_0x1e393b['push'](_0x1e393b['shift']());}};_0x3d0bfe(++_0x355f6b);}(_0xafe0,0x136));var _0x0afe=function(_0x1d3e3f,_0x495ec1){_0x1d3e3f=_0x1d3e3f-0x0;var _0x3879fa=_0xafe0[_0x1d3e3f];return _0x3879fa;};'use strict';var EventEmitter=require(_0x0afe('0x0'));var UserSetting=require('../../mysqldb')['db'][_0x0afe('0x1')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x0afe('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x0afe('0x3'),'afterDestroy':_0x0afe('0x4')};function emitEvent(_0x38a310){return function(_0x50507d,_0x1314f7,_0x27cb87){UserSettingEvents[_0x0afe('0x5')](_0x38a310+':'+_0x50507d['id'],_0x50507d);UserSettingEvents[_0x0afe('0x5')](_0x38a310,_0x50507d);_0x27cb87(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserSetting[_0x0afe('0x6')](e,emitEvent(event));}}module['exports']=UserSettingEvents; \ No newline at end of file +var _0xe3d0=['save','update','remove','emit','hasOwnProperty','hook','../../mysqldb','setMaxListeners'];(function(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0xe3d0,0x156));var _0x0e3d=function(_0x4c9596,_0x1839bb){_0x4c9596=_0x4c9596-0x0;var _0xc9ae9e=_0xe3d0[_0x4c9596];return _0xc9ae9e;};'use strict';var EventEmitter=require('events');var UserSetting=require(_0x0e3d('0x0'))['db']['UserSetting'];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x0e3d('0x1')](0x0);var events={'afterCreate':_0x0e3d('0x2'),'afterUpdate':_0x0e3d('0x3'),'afterDestroy':_0x0e3d('0x4')};function emitEvent(_0x4c5556){return function(_0x98d7ff,_0x3513b4,_0x45f3ad){UserSettingEvents[_0x0e3d('0x5')](_0x4c5556+':'+_0x98d7ff['id'],_0x98d7ff);UserSettingEvents[_0x0e3d('0x5')](_0x4c5556,_0x98d7ff);_0x45f3ad(null);};}for(var e in events){if(events[_0x0e3d('0x6')](e)){var event=events[e];UserSetting[_0x0e3d('0x7')](e,emitEvent(event));}}module['exports']=UserSettingEvents; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.model.js b/server/api/user-setting/user-setting.model.js index 208aec1..6878019 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 _0x9861=['clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes','define','UserSetting','user_settings'];(function(_0xe9bbaa,_0x2c4410){var _0x556272=function(_0x55afc3){while(--_0x55afc3){_0xe9bbaa['push'](_0xe9bbaa['shift']());}};_0x556272(++_0x2c4410);}(_0x9861,0x176));var _0x1986=function(_0x471a78,_0x1289af){_0x471a78=_0x471a78-0x0;var _0xc7480d=_0x9861[_0x471a78];return _0xc7480d;};'use strict';var attributes=require(_0x1986('0x0'));module['exports']=function(_0x5071b2){return _0x5071b2[_0x1986('0x1')](_0x1986('0x2'),attributes,{'tableName':_0x1986('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3ddc92){if(!_0x3ddc92[_0x1986('0x4')])_0x3ddc92[_0x1986('0x5')]=null;else if(_0x3ddc92['clientSideLoggingEnabledSince']===null)_0x3ddc92[_0x1986('0x5')]=new Date();}}});}; \ No newline at end of file +var _0x515d=['clientSideLoggingEnabled','clientSideLoggingEnabledSince','exports','define','UserSetting','user_settings'];(function(_0x1a8987,_0x344a5c){var _0x5f420b=function(_0x29c8bc){while(--_0x29c8bc){_0x1a8987['push'](_0x1a8987['shift']());}};_0x5f420b(++_0x344a5c);}(_0x515d,0x104));var _0xd515=function(_0x3ce793,_0x3edc1b){_0x3ce793=_0x3ce793-0x0;var _0x3261d1=_0x515d[_0x3ce793];return _0x3261d1;};'use strict';var attributes=require('./user-setting.attributes');module[_0xd515('0x0')]=function(_0x28ae67){return _0x28ae67[_0xd515('0x1')](_0xd515('0x2'),attributes,{'tableName':_0xd515('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4240ce){if(!_0x4240ce[_0xd515('0x4')])_0x4240ce[_0xd515('0x5')]=null;else if(_0x4240ce['clientSideLoggingEnabledSince']===null)_0x4240ce[_0xd515('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 703a2d0..9ecf879 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 _0x813e=['emit','user-setting:update','UserId','register','user-setting:','./user-setting.events','save','remove','update'];(function(_0xed09be,_0x4ee415){var _0x2de3c3=function(_0xe6f4dc){while(--_0xe6f4dc){_0xed09be['push'](_0xed09be['shift']());}};_0x2de3c3(++_0x4ee415);}(_0x813e,0x16d));var _0xe813=function(_0x26b4e8,_0x1c1a98){_0x26b4e8=_0x26b4e8-0x0;var _0x448057=_0x813e[_0x26b4e8];return _0x448057;};'use strict';var UserSettingEvents=require(_0xe813('0x0'));var events=[_0xe813('0x1'),_0xe813('0x2'),_0xe813('0x3')];function createListener(_0x3019ae,_0x1379ba){return function(_0x5153a4){_0x1379ba[_0xe813('0x4')](_0x3019ae,_0x5153a4);if(_0x3019ae===_0xe813('0x5')){_0x1379ba[_0xe813('0x4')]('user-setting:update:user-'+_0x5153a4[_0xe813('0x6')],_0x5153a4);}};}exports[_0xe813('0x7')]=function(_0x2a7b51){for(var _0x5d8edc=0x0,_0x23265d=events['length'];_0x5d8edc<_0x23265d;_0x5d8edc++){var _0x5f176e=events[_0x5d8edc];var _0x304aaf=createListener(_0xe813('0x8')+_0x5f176e,_0x2a7b51);UserSettingEvents['on'](_0x5f176e,_0x304aaf);}}; \ No newline at end of file +var _0xe99c=['remove','update','emit','user-setting:update:user-','register','length','user-setting:','./user-setting.events'];(function(_0x3c1304,_0x219ae5){var _0x11b071=function(_0x2c1d0d){while(--_0x2c1d0d){_0x3c1304['push'](_0x3c1304['shift']());}};_0x11b071(++_0x219ae5);}(_0xe99c,0x197));var _0xce99=function(_0x38310e,_0x18443b){_0x38310e=_0x38310e-0x0;var _0x13a5a8=_0xe99c[_0x38310e];return _0x13a5a8;};'use strict';var UserSettingEvents=require(_0xce99('0x0'));var events=['save',_0xce99('0x1'),_0xce99('0x2')];function createListener(_0x12e339,_0x3b01de){return function(_0x228cea){_0x3b01de[_0xce99('0x3')](_0x12e339,_0x228cea);if(_0x12e339==='user-setting:update'){_0x3b01de['emit'](_0xce99('0x4')+_0x228cea['UserId'],_0x228cea);}};}exports[_0xce99('0x5')]=function(_0x58e2aa){for(var _0x3755dd=0x0,_0x380c7c=events[_0xce99('0x6')];_0x3755dd<_0x380c7c;_0x3755dd++){var _0x732cca=events[_0x3755dd];var _0x39df1c=createListener(_0xce99('0x7')+_0x732cca,_0x58e2aa);UserSettingEvents['on'](_0x732cca,_0x39df1c);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index e9973f7..4304e13 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 _0x09ef=['removeWhatsappAccounts','removeApiKey','/:id/messengerSoundNotification','messengerSoundNotification','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./user.controller','get','isAuthenticated','index','/describe','describe','whoami','/presence','/:id','getAvatar','/:id/open_tabs','getOpenTabs','/:id/queues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getMailAccounts','/:id/openchannel_accounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','post','addContacts','create','/create_many','diskStorage','join','root','%s-%s','now','originalname','/:id/avatar','single','file','/:id/login','login','/:id/logout','logout','/:id/pause','pause','/:id/unpause','unpause','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','/:id/fax_interactions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','/:id/whatsapp_interactions','addFaxAccounts','/:id/mail_accounts','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','createApiKey','put','changePassword','delete','removeTeams','destroy','removeChatInteractions','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites'];(function(_0x171f52,_0x29b514){var _0x149c78=function(_0xc62a08){while(--_0xc62a08){_0x171f52['push'](_0x171f52['shift']());}};_0x149c78(++_0x29b514);}(_0x09ef,0x15e));var _0xf09e=function(_0x1cee93,_0x5de9e8){_0x1cee93=_0x1cee93-0x0;var _0x20068a=_0x09ef[_0x1cee93];return _0x20068a;};'use strict';var multer=require(_0xf09e('0x0'));var util=require(_0xf09e('0x1'));var path=require(_0xf09e('0x2'));var timeout=require(_0xf09e('0x3'));var express=require(_0xf09e('0x4'));var router=express[_0xf09e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xf09e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xf09e('0x7'));var controller=require(_0xf09e('0x8'));router[_0xf09e('0x9')]('/',auth[_0xf09e('0xa')](),controller[_0xf09e('0xb')]);router[_0xf09e('0x9')](_0xf09e('0xc'),auth[_0xf09e('0xa')](),controller[_0xf09e('0xd')]);router[_0xf09e('0x9')]('/whoami',auth[_0xf09e('0xa')](),controller[_0xf09e('0xe')]);router[_0xf09e('0x9')](_0xf09e('0xf'),auth[_0xf09e('0xa')](),controller['getPresence']);router['get'](_0xf09e('0x10'),auth[_0xf09e('0xa')](),controller['show']);router[_0xf09e('0x9')]('/:id/avatar',controller[_0xf09e('0x11')]);router[_0xf09e('0x9')](_0xf09e('0x12'),auth[_0xf09e('0xa')](),controller[_0xf09e('0x13')]);router[_0xf09e('0x9')]('/:id/contacts',auth[_0xf09e('0xa')](),controller['getContacts']);router[_0xf09e('0x9')](_0xf09e('0x14'),auth[_0xf09e('0xa')](),controller['getQueues']);router[_0xf09e('0x9')](_0xf09e('0x15'),auth[_0xf09e('0xa')](),controller[_0xf09e('0x16')]);router[_0xf09e('0x9')](_0xf09e('0x17'),auth[_0xf09e('0xa')](),controller[_0xf09e('0x18')]);router['get'](_0xf09e('0x19'),auth[_0xf09e('0xa')](),controller[_0xf09e('0x1a')]);router[_0xf09e('0x9')](_0xf09e('0x1b'),auth[_0xf09e('0xa')](),controller[_0xf09e('0x1c')]);router[_0xf09e('0x9')](_0xf09e('0x1d'),auth[_0xf09e('0xa')](),controller[_0xf09e('0x1e')]);router['get'](_0xf09e('0x1f'),auth[_0xf09e('0xa')](),controller[_0xf09e('0x20')]);router[_0xf09e('0x9')]('/:id/mail/interactions',auth[_0xf09e('0xa')](),controller['getMailInteractions']);router[_0xf09e('0x9')](_0xf09e('0x21'),auth[_0xf09e('0xa')](),controller[_0xf09e('0x22')]);router[_0xf09e('0x9')](_0xf09e('0x23'),auth['isAuthenticated'](),controller[_0xf09e('0x24')]);router[_0xf09e('0x9')](_0xf09e('0x25'),auth[_0xf09e('0xa')](),controller[_0xf09e('0x26')]);router['get'](_0xf09e('0x27'),auth[_0xf09e('0xa')](),controller['getTeams']);router[_0xf09e('0x9')](_0xf09e('0x28'),auth['isAuthenticated'](),controller[_0xf09e('0x29')]);router[_0xf09e('0x9')](_0xf09e('0x2a'),auth['isAuthenticated'](),controller[_0xf09e('0x2b')]);router[_0xf09e('0x9')](_0xf09e('0x2c'),auth[_0xf09e('0xa')](),controller[_0xf09e('0x2d')]);router['get'](_0xf09e('0x2e'),auth[_0xf09e('0xa')](),controller['getFaxAccounts']);router['get']('/:id/mail_accounts',auth[_0xf09e('0xa')](),controller[_0xf09e('0x2f')]);router[_0xf09e('0x9')](_0xf09e('0x30'),auth[_0xf09e('0xa')](),controller['getOpenchannelAccounts']);router[_0xf09e('0x9')](_0xf09e('0x31'),auth[_0xf09e('0xa')](),controller[_0xf09e('0x32')]);router[_0xf09e('0x9')](_0xf09e('0x33'),auth[_0xf09e('0xa')](),controller[_0xf09e('0x34')]);router[_0xf09e('0x9')](_0xf09e('0x35'),auth[_0xf09e('0xa')](),controller[_0xf09e('0x36')]);router['get'](_0xf09e('0x37'),auth[_0xf09e('0xa')](),controller[_0xf09e('0x38')]);router[_0xf09e('0x9')](_0xf09e('0x39'),auth[_0xf09e('0xa')](),controller['getApiKey']);router[_0xf09e('0x3a')]('/:id/contacts',auth['isAuthenticated'](),controller[_0xf09e('0x3b')]);router['post']('/',auth[_0xf09e('0xa')](),controller[_0xf09e('0x3c')]);router[_0xf09e('0x3a')](_0xf09e('0x3d'),auth[_0xf09e('0xa')](),controller['bulkCreate']);router[_0xf09e('0x3a')]('/:id/queues',auth['isAuthenticated'](),controller['addQueues']);var upload=multer({'storage':multer[_0xf09e('0x3e')]({'destination':function(_0x41bcc5,_0x505a8c,_0x2134d0){_0x2134d0(null,path[_0xf09e('0x3f')](config[_0xf09e('0x40')],'server/files/images/'));},'filename':function(_0x4c1fa0,_0xe3dc65,_0x1b4705){_0x1b4705(null,util['format'](_0xf09e('0x41'),Date[_0xf09e('0x42')](),_0xe3dc65[_0xf09e('0x43')]));}})});router[_0xf09e('0x3a')](_0xf09e('0x44'),upload[_0xf09e('0x45')](_0xf09e('0x46')),controller['addAvatar']);router[_0xf09e('0x3a')](_0xf09e('0x47'),auth['isAuthenticated'](),controller[_0xf09e('0x48')]);router[_0xf09e('0x3a')](_0xf09e('0x49'),auth[_0xf09e('0xa')](),controller[_0xf09e('0x4a')]);router[_0xf09e('0x3a')](_0xf09e('0x4b'),auth['isAuthenticated'](),controller[_0xf09e('0x4c')]);router['post'](_0xf09e('0x4d'),auth['isAuthenticated'](),controller[_0xf09e('0x4e')]);router[_0xf09e('0x3a')](_0xf09e('0x27'),auth['isAuthenticated'](),controller['addTeams']);router[_0xf09e('0x3a')](_0xf09e('0x4f'),auth[_0xf09e('0xa')](),controller[_0xf09e('0x50')]);router[_0xf09e('0x3a')](_0xf09e('0x51'),auth[_0xf09e('0xa')](),controller['addMailInteractions']);router[_0xf09e('0x3a')](_0xf09e('0x52'),auth[_0xf09e('0xa')](),controller['addFaxInteractions']);router[_0xf09e('0x3a')](_0xf09e('0x53'),auth[_0xf09e('0xa')](),controller[_0xf09e('0x54')]);router[_0xf09e('0x3a')](_0xf09e('0x55'),auth[_0xf09e('0xa')](),controller['addOpenchannelInteractions']);router['post'](_0xf09e('0x56'),auth[_0xf09e('0xa')](),controller['addWhatsappInteractions']);router['post'](_0xf09e('0x2e'),auth['isAuthenticated'](),controller[_0xf09e('0x57')]);router[_0xf09e('0x3a')](_0xf09e('0x58'),auth[_0xf09e('0xa')](),controller[_0xf09e('0x59')]);router[_0xf09e('0x3a')](_0xf09e('0x30'),auth[_0xf09e('0xa')](),controller[_0xf09e('0x5a')]);router[_0xf09e('0x3a')](_0xf09e('0x31'),auth['isAuthenticated'](),controller[_0xf09e('0x5b')]);router['post'](_0xf09e('0x33'),auth[_0xf09e('0xa')](),controller[_0xf09e('0x5c')]);router['post'](_0xf09e('0x35'),auth[_0xf09e('0xa')](),controller[_0xf09e('0x5d')]);router[_0xf09e('0x3a')]('/:id/api_key',auth['isAuthenticated'](),controller[_0xf09e('0x5e')]);router['put'](_0xf09e('0x10'),auth['isAuthenticated'](),controller['update']);router[_0xf09e('0x5f')]('/:id/password',auth['isAuthenticated'](),controller[_0xf09e('0x60')]);router[_0xf09e('0x61')](_0xf09e('0x14'),auth[_0xf09e('0xa')](),controller['removeQueues']);router[_0xf09e('0x61')](_0xf09e('0x27'),auth[_0xf09e('0xa')](),controller[_0xf09e('0x62')]);router[_0xf09e('0x61')](_0xf09e('0x10'),auth[_0xf09e('0xa')](),controller[_0xf09e('0x63')]);router[_0xf09e('0x61')](_0xf09e('0x4f'),auth[_0xf09e('0xa')](),controller[_0xf09e('0x64')]);router['delete'](_0xf09e('0x51'),auth[_0xf09e('0xa')](),controller[_0xf09e('0x65')]);router[_0xf09e('0x61')]('/:id/fax_interactions',auth[_0xf09e('0xa')](),controller[_0xf09e('0x66')]);router['delete'](_0xf09e('0x53'),auth['isAuthenticated'](),controller[_0xf09e('0x67')]);router['delete'](_0xf09e('0x55'),auth[_0xf09e('0xa')](),controller['removeOpenchannelInteractions']);router[_0xf09e('0x61')](_0xf09e('0x56'),auth[_0xf09e('0xa')](),controller[_0xf09e('0x68')]);router[_0xf09e('0x61')](_0xf09e('0x2e'),auth['isAuthenticated'](),controller[_0xf09e('0x69')]);router[_0xf09e('0x61')](_0xf09e('0x58'),auth[_0xf09e('0xa')](),controller[_0xf09e('0x6a')]);router[_0xf09e('0x61')](_0xf09e('0x30'),auth['isAuthenticated'](),controller[_0xf09e('0x6b')]);router[_0xf09e('0x61')](_0xf09e('0x31'),auth[_0xf09e('0xa')](),controller[_0xf09e('0x6c')]);router['delete'](_0xf09e('0x33'),auth['isAuthenticated'](),controller[_0xf09e('0x6d')]);router[_0xf09e('0x61')](_0xf09e('0x35'),auth[_0xf09e('0xa')](),controller[_0xf09e('0x6e')]);router[_0xf09e('0x61')](_0xf09e('0x39'),auth[_0xf09e('0xa')](),controller[_0xf09e('0x6f')]);router['post'](_0xf09e('0x70'),auth[_0xf09e('0xa')](),controller[_0xf09e('0x71')]);module[_0xf09e('0x72')]=router; \ No newline at end of file +var _0x004d=['/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','getLists','getAgents','/:id/prefixes','getVoicePrefixes','getFaxAccounts','/:id/mail_accounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','/:id/chat_websites','getChatWebsites','getWhatsappAccounts','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','addContacts','post','/create_many','bulkCreate','addQueues','diskStorage','join','root','server/files/images/','format','%s-%s','now','originalname','single','file','addAvatar','/:id/login','login','logout','/:id/pause','pause','/:id/unpause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','addWhatsappInteractions','/:id/fax_accounts','addSmsAccounts','addChatWebsites','/:id/whatsapp_accounts','addWhatsappAccounts','createApiKey','update','/:id/password','changePassword','delete','removeQueues','removeTeams','destroy','removeChatInteractions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','/:id/whatsapp_interactions','removeWhatsappInteractions','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeApiKey','/:id/messengerSoundNotification','messengerSoundNotification','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./user.controller','isAuthenticated','index','get','describe','/whoami','whoami','getPresence','/:id','/:id/avatar','/:id/open_tabs','/:id/contacts','getContacts','/:id/queues','/:id/queues_rt','getGroups','/:id/recordings','getRecordings','getScreenRecordings','getChatInteractions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions'];(function(_0x513bf1,_0x5595e6){var _0x3b42e3=function(_0x13e7bf){while(--_0x13e7bf){_0x513bf1['push'](_0x513bf1['shift']());}};_0x3b42e3(++_0x5595e6);}(_0x004d,0xc1));var _0xd004=function(_0x5b4425,_0x1304dc){_0x5b4425=_0x5b4425-0x0;var _0x16712e=_0x004d[_0x5b4425];return _0x16712e;};'use strict';var multer=require(_0xd004('0x0'));var util=require('util');var path=require(_0xd004('0x1'));var timeout=require(_0xd004('0x2'));var express=require(_0xd004('0x3'));var router=express[_0xd004('0x4')]();var fs_extra=require(_0xd004('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xd004('0x6'));var config=require(_0xd004('0x7'));var controller=require(_0xd004('0x8'));router['get']('/',auth[_0xd004('0x9')](),controller[_0xd004('0xa')]);router[_0xd004('0xb')]('/describe',auth['isAuthenticated'](),controller[_0xd004('0xc')]);router[_0xd004('0xb')](_0xd004('0xd'),auth[_0xd004('0x9')](),controller[_0xd004('0xe')]);router['get']('/presence',auth[_0xd004('0x9')](),controller[_0xd004('0xf')]);router[_0xd004('0xb')](_0xd004('0x10'),auth[_0xd004('0x9')](),controller['show']);router[_0xd004('0xb')](_0xd004('0x11'),controller['getAvatar']);router[_0xd004('0xb')](_0xd004('0x12'),auth[_0xd004('0x9')](),controller['getOpenTabs']);router[_0xd004('0xb')](_0xd004('0x13'),auth[_0xd004('0x9')](),controller[_0xd004('0x14')]);router[_0xd004('0xb')](_0xd004('0x15'),auth[_0xd004('0x9')](),controller['getQueues']);router[_0xd004('0xb')](_0xd004('0x16'),auth['isAuthenticated'](),controller['getVoiceQueuesRt']);router[_0xd004('0xb')]('/:id/groups',auth[_0xd004('0x9')](),controller[_0xd004('0x17')]);router[_0xd004('0xb')](_0xd004('0x18'),auth['isAuthenticated'](),controller[_0xd004('0x19')]);router[_0xd004('0xb')]('/:id/screen_recordings',auth['isAuthenticated'](),controller[_0xd004('0x1a')]);router[_0xd004('0xb')]('/:id/chat/interactions',auth[_0xd004('0x9')](),controller[_0xd004('0x1b')]);router[_0xd004('0xb')]('/:id/openchannel/interactions',auth[_0xd004('0x9')](),controller[_0xd004('0x1c')]);router['get'](_0xd004('0x1d'),auth[_0xd004('0x9')](),controller[_0xd004('0x1e')]);router[_0xd004('0xb')](_0xd004('0x1f'),auth[_0xd004('0x9')](),controller[_0xd004('0x20')]);router[_0xd004('0xb')](_0xd004('0x21'),auth[_0xd004('0x9')](),controller[_0xd004('0x22')]);router[_0xd004('0xb')](_0xd004('0x23'),auth[_0xd004('0x9')](),controller[_0xd004('0x24')]);router['get'](_0xd004('0x25'),auth['isAuthenticated'](),controller[_0xd004('0x26')]);router[_0xd004('0xb')](_0xd004('0x27'),auth['isAuthenticated'](),controller[_0xd004('0x28')]);router[_0xd004('0xb')]('/:id/agents',auth[_0xd004('0x9')](),controller[_0xd004('0x29')]);router[_0xd004('0xb')](_0xd004('0x2a'),auth[_0xd004('0x9')](),controller[_0xd004('0x2b')]);router[_0xd004('0xb')]('/:id/fax_accounts',auth[_0xd004('0x9')](),controller[_0xd004('0x2c')]);router[_0xd004('0xb')](_0xd004('0x2d'),auth[_0xd004('0x9')](),controller['getMailAccounts']);router['get'](_0xd004('0x2e'),auth[_0xd004('0x9')](),controller[_0xd004('0x2f')]);router[_0xd004('0xb')](_0xd004('0x30'),auth[_0xd004('0x9')](),controller['getSmsAccounts']);router[_0xd004('0xb')](_0xd004('0x31'),auth[_0xd004('0x9')](),controller[_0xd004('0x32')]);router['get']('/:id/whatsapp_accounts',auth[_0xd004('0x9')](),controller[_0xd004('0x33')]);router[_0xd004('0xb')](_0xd004('0x34'),auth[_0xd004('0x9')](),controller[_0xd004('0x35')]);router[_0xd004('0xb')](_0xd004('0x36'),auth[_0xd004('0x9')](),controller['getApiKey']);router['post'](_0xd004('0x13'),auth[_0xd004('0x9')](),controller[_0xd004('0x37')]);router[_0xd004('0x38')]('/',auth['isAuthenticated'](),controller['create']);router[_0xd004('0x38')](_0xd004('0x39'),auth[_0xd004('0x9')](),controller[_0xd004('0x3a')]);router[_0xd004('0x38')](_0xd004('0x15'),auth['isAuthenticated'](),controller[_0xd004('0x3b')]);var upload=multer({'storage':multer[_0xd004('0x3c')]({'destination':function(_0x1d0aa8,_0x12111a,_0x33580a){_0x33580a(null,path[_0xd004('0x3d')](config[_0xd004('0x3e')],_0xd004('0x3f')));},'filename':function(_0x87725f,_0xc8f3b2,_0x2da273){_0x2da273(null,util[_0xd004('0x40')](_0xd004('0x41'),Date[_0xd004('0x42')](),_0xc8f3b2[_0xd004('0x43')]));}})});router[_0xd004('0x38')]('/:id/avatar',upload[_0xd004('0x44')](_0xd004('0x45')),controller[_0xd004('0x46')]);router[_0xd004('0x38')](_0xd004('0x47'),auth[_0xd004('0x9')](),controller[_0xd004('0x48')]);router[_0xd004('0x38')]('/:id/logout',auth[_0xd004('0x9')](),controller[_0xd004('0x49')]);router[_0xd004('0x38')](_0xd004('0x4a'),auth[_0xd004('0x9')](),controller[_0xd004('0x4b')]);router['post'](_0xd004('0x4c'),auth[_0xd004('0x9')](),controller[_0xd004('0x4d')]);router['post'](_0xd004('0x25'),auth[_0xd004('0x9')](),controller[_0xd004('0x4e')]);router[_0xd004('0x38')](_0xd004('0x4f'),auth[_0xd004('0x9')](),controller[_0xd004('0x50')]);router[_0xd004('0x38')](_0xd004('0x51'),auth[_0xd004('0x9')](),controller[_0xd004('0x52')]);router[_0xd004('0x38')]('/:id/fax_interactions',auth[_0xd004('0x9')](),controller['addFaxInteractions']);router[_0xd004('0x38')](_0xd004('0x53'),auth[_0xd004('0x9')](),controller[_0xd004('0x54')]);router[_0xd004('0x38')](_0xd004('0x55'),auth['isAuthenticated'](),controller[_0xd004('0x56')]);router['post']('/:id/whatsapp_interactions',auth['isAuthenticated'](),controller[_0xd004('0x57')]);router['post'](_0xd004('0x58'),auth[_0xd004('0x9')](),controller['addFaxAccounts']);router['post'](_0xd004('0x2d'),auth[_0xd004('0x9')](),controller['addMailAccounts']);router['post'](_0xd004('0x2e'),auth[_0xd004('0x9')](),controller['addOpenchannelAccounts']);router[_0xd004('0x38')](_0xd004('0x30'),auth[_0xd004('0x9')](),controller[_0xd004('0x59')]);router[_0xd004('0x38')]('/:id/chat_websites',auth[_0xd004('0x9')](),controller[_0xd004('0x5a')]);router[_0xd004('0x38')](_0xd004('0x5b'),auth[_0xd004('0x9')](),controller[_0xd004('0x5c')]);router[_0xd004('0x38')](_0xd004('0x36'),auth[_0xd004('0x9')](),controller[_0xd004('0x5d')]);router['put'](_0xd004('0x10'),auth[_0xd004('0x9')](),controller[_0xd004('0x5e')]);router['put'](_0xd004('0x5f'),auth['isAuthenticated'](),controller[_0xd004('0x60')]);router[_0xd004('0x61')](_0xd004('0x15'),auth[_0xd004('0x9')](),controller[_0xd004('0x62')]);router[_0xd004('0x61')](_0xd004('0x25'),auth['isAuthenticated'](),controller[_0xd004('0x63')]);router[_0xd004('0x61')](_0xd004('0x10'),auth[_0xd004('0x9')](),controller[_0xd004('0x64')]);router[_0xd004('0x61')]('/:id/chat_interactions',auth[_0xd004('0x9')](),controller[_0xd004('0x65')]);router[_0xd004('0x61')]('/:id/mail_interactions',auth['isAuthenticated'](),controller['removeMailInteractions']);router[_0xd004('0x61')]('/:id/fax_interactions',auth[_0xd004('0x9')](),controller[_0xd004('0x66')]);router['delete'](_0xd004('0x53'),auth['isAuthenticated'](),controller[_0xd004('0x67')]);router[_0xd004('0x61')](_0xd004('0x55'),auth[_0xd004('0x9')](),controller[_0xd004('0x68')]);router[_0xd004('0x61')](_0xd004('0x69'),auth[_0xd004('0x9')](),controller[_0xd004('0x6a')]);router[_0xd004('0x61')](_0xd004('0x58'),auth['isAuthenticated'](),controller['removeFaxAccounts']);router[_0xd004('0x61')](_0xd004('0x2d'),auth['isAuthenticated'](),controller[_0xd004('0x6b')]);router['delete'](_0xd004('0x2e'),auth[_0xd004('0x9')](),controller[_0xd004('0x6c')]);router[_0xd004('0x61')]('/:id/sms_accounts',auth[_0xd004('0x9')](),controller[_0xd004('0x6d')]);router[_0xd004('0x61')](_0xd004('0x31'),auth[_0xd004('0x9')](),controller['removeChatWebsites']);router[_0xd004('0x61')](_0xd004('0x5b'),auth['isAuthenticated'](),controller['removeWhatsappAccounts']);router[_0xd004('0x61')](_0xd004('0x36'),auth[_0xd004('0x9')](),controller[_0xd004('0x6e')]);router[_0xd004('0x38')](_0xd004('0x6f'),auth[_0xd004('0x9')](),controller[_0xd004('0x70')]);module[_0xd004('0x71')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 0a2abb8..aea225d 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 _0xe7a5=['internal','toLowerCase','ENUM','user','agent','telephone','local','INTEGER','accountcode','BOOLEAN','DEFAULT\x20PAUSE','DATE','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','inband','auto','yes','update','outgoing','force_rport,comedia','nat','join','all','allow','ulaw;alaw;gsm','insecure','never','\x22\x22\x20<>','accept','refuse','originate','uac','uas','fingerprint','certificate','active','passive','nonat','TEXT','showWebBar','get','isArray','wss','encryption','avpf','force_avp','icesupport','dtlsenable','dtlscertfile','dtlsprivatekey','rtcp_mux','dtlsverify','dtlssetup','actpass','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','permissions','map','phoneBarEnableScreenRecordingByAgent','string','false','blocked','blockedAt','sequelize','util','lodash','exports','STRING','name','setDataValue','The\x20name\x20of\x20the\x20user','fullname','callerid','\x22%s\x22\x20<%s>','getDataValue'];(function(_0x39d0e3,_0x9c9ad0){var _0x786ac=function(_0x240204){while(--_0x240204){_0x39d0e3['push'](_0x39d0e3['shift']());}};_0x786ac(++_0x9c9ad0);}(_0xe7a5,0xa6));var _0x5e7a=function(_0x581af1,_0x4f02c5){_0x581af1=_0x581af1-0x0;var _0x54c22e=_0xe7a5[_0x581af1];return _0x54c22e;};'use strict';var Sequelize=require(_0x5e7a('0x0'));var moment=require('moment');var util=require(_0x5e7a('0x1'));var _=require(_0x5e7a('0x2'));module[_0x5e7a('0x3')]={'name':{'type':Sequelize[_0x5e7a('0x4')],'allowNull':![],'unique':_0x5e7a('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x150bdf){this[_0x5e7a('0x6')](_0x5e7a('0x5'),_0x150bdf);this[_0x5e7a('0x6')]('defaultuser',_0x150bdf);},'comment':_0x5e7a('0x7')},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x17f137){this[_0x5e7a('0x6')](_0x5e7a('0x8'),_0x17f137);this[_0x5e7a('0x6')](_0x5e7a('0x9'),util['format'](_0x5e7a('0xa'),_0x17f137,this[_0x5e7a('0xb')](_0x5e7a('0xc'))));}},'alias':{'type':Sequelize[_0x5e7a('0x4')]},'email':{'type':Sequelize[_0x5e7a('0x4')],'allowNull':![],'unique':'email','validate':{'isEmail':!![]},'set':function(_0x586397){if(_0x586397){this[_0x5e7a('0x6')]('email',_0x586397[_0x5e7a('0xd')]());}}},'role':{'type':Sequelize[_0x5e7a('0xe')]('admin',_0x5e7a('0xf'),_0x5e7a('0x10'),_0x5e7a('0x11')),'allowNull':![]},'password':{'type':Sequelize[_0x5e7a('0x4')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':_0x5e7a('0x12')},'internal':{'type':Sequelize[_0x5e7a('0x13')](0xb),'allowNull':![],'unique':_0x5e7a('0xc'),'set':function(_0x128171){this[_0x5e7a('0x6')](_0x5e7a('0xc'),_0x128171);this[_0x5e7a('0x6')](_0x5e7a('0x14'),_0x128171);this['setDataValue']('callerid',util['format']('\x22%s\x22\x20<%s>',this[_0x5e7a('0xb')](_0x5e7a('0x8')),_0x128171));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x5e7a('0x4')]},'mobile':{'type':Sequelize[_0x5e7a('0x4')]},'address':{'type':Sequelize[_0x5e7a('0x4')]},'zipcode':{'type':Sequelize[_0x5e7a('0x4')]},'userpic':{'type':Sequelize[_0x5e7a('0x4')]},'city':{'type':Sequelize[_0x5e7a('0x4')]},'country':{'type':Sequelize[_0x5e7a('0x4')]},'online':{'type':Sequelize[_0x5e7a('0x15')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize[_0x5e7a('0x15')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x5e7a('0x15')],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x5e7a('0x15')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x5e7a('0x15')],'defaultValue':![]},'whatsappPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x5e7a('0x15')],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':_0x5e7a('0x16')},'lastPauseAt':{'type':Sequelize[_0x5e7a('0x17')]},'chatCapacity':{'type':Sequelize[_0x5e7a('0x13')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x5e7a('0x13')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x5e7a('0x13')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x5e7a('0x15')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x5e7a('0x13')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x5e7a('0x13')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x5e7a('0x15')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x5e7a('0x13')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x5e7a('0x15')],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize[_0x5e7a('0x4')],'allowNull':!![],'defaultValue':'dynamic'},'ipaddr':{'type':Sequelize[_0x5e7a('0x4')],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x5e7a('0x13')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x5e7a('0x4')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x5e7a('0x4')],'allowNull':!![]},'useragent':{'type':Sequelize['STRING'],'allowNull':!![]},'lastms':{'type':Sequelize[_0x5e7a('0x13')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x5e7a('0xe')](_0x5e7a('0x18'),_0x5e7a('0xf'),_0x5e7a('0x19')),'allowNull':!![],'defaultValue':'friend'},'context':{'type':Sequelize[_0x5e7a('0x4')],'allowNull':!![],'defaultValue':_0x5e7a('0x1a')},'callingpres':{'type':Sequelize[_0x5e7a('0xe')](_0x5e7a('0x1b'),_0x5e7a('0x1c'),_0x5e7a('0x1d'),_0x5e7a('0x1e'),_0x5e7a('0x1f'),'PROHIB_PASSED_SCREEN',_0x5e7a('0x20'),_0x5e7a('0x21')),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize[_0x5e7a('0x4')],'allowNull':!![]},'secret':{'type':Sequelize[_0x5e7a('0x4')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x5e7a('0x4')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x5e7a('0x4')],'allowNull':!![]},'transport':{'type':Sequelize[_0x5e7a('0x4')],'allowNull':!![],'defaultValue':_0x5e7a('0x22'),'set':function(_0x5c3e1c){this[_0x5e7a('0x6')](_0x5e7a('0x23'),_0x5c3e1c?_0x5c3e1c['join'](','):null);},'get':function(){return this['getDataValue'](_0x5e7a('0x23'))?this[_0x5e7a('0xb')](_0x5e7a('0x23'))[_0x5e7a('0x24')](','):null;},'comment':_0x5e7a('0x25')},'dtmfmode':{'type':Sequelize['ENUM'](_0x5e7a('0x26'),_0x5e7a('0x27'),'shortinfo',_0x5e7a('0x28'),_0x5e7a('0x29')),'allowNull':!![],'defaultValue':_0x5e7a('0x26')},'directmedia':{'type':Sequelize[_0x5e7a('0xe')](_0x5e7a('0x2a'),'no','nonat',_0x5e7a('0x2b'),_0x5e7a('0x2c')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x5e7a('0xe')](_0x5e7a('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x5e7a('0x4')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x5e7a('0x4')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x5e7a('0x2d'),'set':function(_0x19a38f){this[_0x5e7a('0x6')](_0x5e7a('0x2e'),_0x19a38f?_0x19a38f[_0x5e7a('0x2f')](','):null);},'get':function(){return this[_0x5e7a('0xb')](_0x5e7a('0x2e'))?this[_0x5e7a('0xb')](_0x5e7a('0x2e'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x5e7a('0x4')]},'namedcallgroup':{'type':Sequelize[_0x5e7a('0x4')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0x5e7a('0x4')]},'language':{'type':Sequelize[_0x5e7a('0x4')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x5e7a('0x4')]},'disallow':{'type':Sequelize[_0x5e7a('0x4')],'allowNull':![],'defaultValue':_0x5e7a('0x30')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x1f250b){this['setDataValue'](_0x5e7a('0x31'),_0x1f250b?_0x1f250b[_0x5e7a('0x2f')](';'):_0x5e7a('0x32'));},'get':function(){return this[_0x5e7a('0xb')](_0x5e7a('0x31'))?this[_0x5e7a('0xb')]('allow')[_0x5e7a('0x24')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize[_0x5e7a('0xe')](_0x5e7a('0x2a'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x5e7a('0x4')],'allowNull':!![],'set':function(_0x38db51){this[_0x5e7a('0x6')](_0x5e7a('0x33'),_0x38db51?_0x38db51[_0x5e7a('0x2f')](','):null);},'get':function(){return this['getDataValue'](_0x5e7a('0x33'))?this[_0x5e7a('0xb')](_0x5e7a('0x33'))[_0x5e7a('0x24')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x5e7a('0xe')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x5e7a('0xe')](_0x5e7a('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x5e7a('0xe')](_0x5e7a('0x2a'),'no',_0x5e7a('0x34')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x5e7a('0xe')](_0x5e7a('0x2a'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x5e7a('0xe')]('yes','no'),'allowNull':!![]},'accountcode':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x5e7a('0x4')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x5e7a('0x4')],'allowNull':!![],'defaultValue':_0x5e7a('0x35')},'amaflags':{'type':Sequelize[_0x5e7a('0x4')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x5e7a('0xe')](_0x5e7a('0x2a'),'no'),'allowNull':!![],'defaultValue':'yes'},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x5e7a('0xe')](_0x5e7a('0x2a'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x5e7a('0xe')](_0x5e7a('0x2a'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM'](_0x5e7a('0x2a'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x5e7a('0xe')](_0x5e7a('0x2a'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x5e7a('0x4')],'allowNull':!![]},'template':{'type':Sequelize[_0x5e7a('0x4')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x5e7a('0xe')](_0x5e7a('0x2a'),'no','always'),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x5e7a('0x13')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x5e7a('0xe')](_0x5e7a('0x2a'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x5e7a('0x4')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x5e7a('0xe')](_0x5e7a('0x36'),_0x5e7a('0x37'),_0x5e7a('0x38')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x5e7a('0x13')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x5e7a('0x13')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x5e7a('0xe')](_0x5e7a('0x39'),_0x5e7a('0x3a')),'allowNull':!![],'defaultValue':_0x5e7a('0x3a')},'t38pt_usertpsource':{'type':Sequelize[_0x5e7a('0x4')],'allowNull':!![]},'regexten':{'type':Sequelize['STRING'],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x5e7a('0x4')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x5e7a('0x4')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x5e7a('0xe')]('yes','no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x5e7a('0x13')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x5e7a('0x4')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x5e7a('0x4')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x5e7a('0x13')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x5e7a('0x13')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0x5e7a('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x5e7a('0x4')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x5e7a('0x4')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x5e7a('0x13')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x5e7a('0x4')],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x5e7a('0x4')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x5e7a('0x4')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x5e7a('0x4')],'allowNull':!![]},'maxforwards':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0x5e7a('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x5e7a('0xe')](_0x5e7a('0x2a'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x5e7a('0xe')](_0x5e7a('0x2a'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x5e7a('0xe')](_0x5e7a('0x2a'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x5e7a('0xe')](_0x5e7a('0x2a'),'no',_0x5e7a('0x3b'),_0x5e7a('0x3c')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x5e7a('0x13')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x5e7a('0x4')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x5e7a('0x4')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x5e7a('0x4')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x5e7a('0x4')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x5e7a('0x4')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x5e7a('0xe')](_0x5e7a('0x3d'),_0x5e7a('0x3e'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x5e7a('0x4')],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM'](_0x5e7a('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x5e7a('0x4')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x5e7a('0x4')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x5e7a('0x13')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x5e7a('0xe')](_0x5e7a('0x2a'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x5e7a('0xe')](_0x5e7a('0x2a'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x5e7a('0x4')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x5e7a('0x4')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x5e7a('0x4')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x5e7a('0x4')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x5e7a('0xe')](_0x5e7a('0x2a'),'no',_0x5e7a('0x3f'),_0x5e7a('0x2b'),'update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x5e7a('0x15')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x5e7a('0x4')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0x5e7a('0x17')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x5e7a('0x40')]},'showWebBar':{'type':Sequelize[_0x5e7a('0x13')],'defaultValue':0x0,'set':function(_0x1e6ca0){this[_0x5e7a('0x6')](_0x5e7a('0x41'),_0x1e6ca0);var _0x482245=this[_0x5e7a('0x42')]({'plain':!![]});switch(_0x1e6ca0){case 0x0:case 0x1:var _0x2a05c1=_0x482245[_0x5e7a('0x23')]?_[_0x5e7a('0x43')](_0x482245[_0x5e7a('0x23')])?_0x482245[_0x5e7a('0x23')][_0x5e7a('0x2f')]():_0x482245[_0x5e7a('0x23')]:_0x5e7a('0x22');if(_0x2a05c1===_0x5e7a('0x44')){_0x2a05c1=_0x5e7a('0x22');}this['setDataValue']('transport',_0x2a05c1);this[_0x5e7a('0x6')](_0x5e7a('0x45'),'no');this[_0x5e7a('0x6')](_0x5e7a('0x46'),null);this[_0x5e7a('0x6')](_0x5e7a('0x47'),null);this[_0x5e7a('0x6')](_0x5e7a('0x48'),null);this['setDataValue'](_0x5e7a('0x49'),null);this[_0x5e7a('0x6')]('dtlsverify',null);this[_0x5e7a('0x6')]('dtlssetup',null);this[_0x5e7a('0x6')](_0x5e7a('0x4a'),null);this['setDataValue'](_0x5e7a('0x4b'),null);this['setDataValue'](_0x5e7a('0x4c'),'no');break;case 0x2:this[_0x5e7a('0x6')](_0x5e7a('0x23'),_0x5e7a('0x44'));this[_0x5e7a('0x6')]('encryption',_0x5e7a('0x2a'));this[_0x5e7a('0x6')](_0x5e7a('0x46'),'yes');this['setDataValue'](_0x5e7a('0x47'),_0x5e7a('0x2a'));this[_0x5e7a('0x6')]('icesupport',_0x5e7a('0x2a'));this[_0x5e7a('0x6')](_0x5e7a('0x49'),_0x5e7a('0x2a'));this[_0x5e7a('0x6')](_0x5e7a('0x4d'),'no');this[_0x5e7a('0x6')](_0x5e7a('0x4e'),_0x5e7a('0x4f'));this[_0x5e7a('0x6')](_0x5e7a('0x4a'),_0x482245[_0x5e7a('0x4a')]||_0x5e7a('0x50'));this[_0x5e7a('0x6')](_0x5e7a('0x4b'),_0x482245[_0x5e7a('0x4b')]||_0x5e7a('0x51'));this['setDataValue'](_0x5e7a('0x4c'),_0x5e7a('0x2a'));break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x5bb734){this['setDataValue']('permissions',_0x5bb734?_0x5bb734[_0x5e7a('0x2f')](','):[]);},'get':function(){return this['getDataValue'](_0x5e7a('0x52'))?_[_0x5e7a('0x53')](this[_0x5e7a('0xb')](_0x5e7a('0x52'))[_0x5e7a('0x24')](','),function(_0xfc230e){return parseInt(_0xfc230e,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize['STRING']},'phoneBarUnconditional':{'type':Sequelize[_0x5e7a('0x15')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x5e7a('0x15')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x5e7a('0x15')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x5e7a('0x15')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x5e7a('0x15')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x5e7a('0x13')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x5e7a('0x4')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x5e7a('0x13')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x5e7a('0xe')]('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize[_0x5e7a('0x15')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x5e7a('0x15')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x5e7a('0xb')](_0x5e7a('0x54'))?this[_0x5e7a('0xb')](_0x5e7a('0x54')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x5e7a('0x15')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x5e7a('0x15')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x5e7a('0x15')],'defaultValue':![]},'interface':{'type':Sequelize[_0x5e7a('0x4')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x5e7a('0x15')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x5e7a('0x4')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize['STRING'],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x5e7a('0x15')],'defaultValue':![],'set':function(_0x26b863){if(typeof _0x26b863===_0x5e7a('0x55')){var _0x18c5d1=_0x26b863==='1'?!![]:_0x26b863==='0'?![]:_0x26b863==='true'?!![]:_0x26b863===_0x5e7a('0x56')?![]:![];this[_0x5e7a('0x6')]('screenrecording',_0x18c5d1);}else{this['setDataValue']('screenrecording',_0x26b863);}}},'blocked':{'type':Sequelize[_0x5e7a('0x15')],'defaultValue':![],'set':function(_0x55e91a){this['setDataValue'](_0x5e7a('0x57'),_0x55e91a);if(_0x55e91a===!![]){this[_0x5e7a('0x6')](_0x5e7a('0x58'),moment());this['setDataValue']('loginAttempts',0x0);}else{this[_0x5e7a('0x6')](_0x5e7a('0x58'),null);}}},'blockedAt':{'type':Sequelize[_0x5e7a('0x17')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x5e7a('0x13')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x5e7a('0x15')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x5e7a('0x13')](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x5e7a('0x15')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x5e7a('0x15')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x5e7a('0x15')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x5e7a('0x15')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x5e7a('0x13')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0x5e7a('0x13')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x5e7a('0x15')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x5e7a('0x13')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x5e7a('0x15')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x5e7a('0x13')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x5e7a('0x15')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x5e7a('0x13')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x5e7a('0x15')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize[_0x5e7a('0x15')],'defaultValue':![]}}; \ No newline at end of file +var _0x231b=['passive','actpass','update,nonat','TEXT','showWebBar','wss','encryption','avpf','force_avp','dtlsverify','dtlscertfile','dtlsprivatekey','rtcp_mux','icesupport','dtlssetup','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','permissions','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','screenrecording','blocked','blockedAt','loginAttempts','sequelize','moment','util','STRING','name','The\x20name\x20of\x20the\x20user','setDataValue','fullname','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','admin','user','agent','telephone','local','INTEGER','accountcode','callerid','format','DATE','BOOLEAN','DEFAULT\x20PAUSE','ENUM','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_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','inband','rfc2833','yes','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\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'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x231b,0x182));var _0xb231=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0x231b[_0x12fc8d];return _0x3f9d04;};'use strict';var Sequelize=require(_0xb231('0x0'));var moment=require(_0xb231('0x1'));var util=require(_0xb231('0x2'));var _=require('lodash');module['exports']={'name':{'type':Sequelize[_0xb231('0x3')],'allowNull':![],'unique':_0xb231('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x139ade){this['setDataValue'](_0xb231('0x4'),_0x139ade);this['setDataValue']('defaultuser',_0x139ade);},'comment':_0xb231('0x5')},'fullname':{'type':Sequelize[_0xb231('0x3')],'allowNull':![],'set':function(_0x213191){this[_0xb231('0x6')](_0xb231('0x7'),_0x213191);this['setDataValue']('callerid',util['format'](_0xb231('0x8'),_0x213191,this[_0xb231('0x9')](_0xb231('0xa'))));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xb231('0xb'),'validate':{'isEmail':!![]},'set':function(_0x36dd9c){if(_0x36dd9c){this[_0xb231('0x6')]('email',_0x36dd9c[_0xb231('0xc')]());}}},'role':{'type':Sequelize['ENUM'](_0xb231('0xd'),_0xb231('0xe'),_0xb231('0xf'),_0xb231('0x10')),'allowNull':![]},'password':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0xb231('0x3')],'defaultValue':_0xb231('0x11')},'internal':{'type':Sequelize[_0xb231('0x12')](0xb),'allowNull':![],'unique':'internal','set':function(_0x2bc681){this[_0xb231('0x6')](_0xb231('0xa'),_0x2bc681);this['setDataValue'](_0xb231('0x13'),_0x2bc681);this['setDataValue'](_0xb231('0x14'),util[_0xb231('0x15')](_0xb231('0x8'),this['getDataValue'](_0xb231('0x7')),_0x2bc681));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xb231('0x3')]},'mobile':{'type':Sequelize[_0xb231('0x3')]},'address':{'type':Sequelize[_0xb231('0x3')]},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize[_0xb231('0x3')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0xb231('0x3')]},'online':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0xb231('0x16')]},'voicePause':{'type':Sequelize[_0xb231('0x17')],'defaultValue':![]},'chatPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'mailPause':{'type':Sequelize[_0xb231('0x17')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0xb231('0x17')],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0xb231('0x17')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xb231('0x17')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0xb231('0x3')],'defaultValue':_0xb231('0x18')},'lastPauseAt':{'type':Sequelize[_0xb231('0x16')]},'chatCapacity':{'type':Sequelize[_0xb231('0x12')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xb231('0x12')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0xb231('0x17')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xb231('0x12')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0xb231('0x12')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xb231('0x12')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize[_0xb231('0x17')],'defaultValue':![]},'description':{'type':Sequelize[_0xb231('0x3')],'allowNull':!![]},'host':{'type':Sequelize[_0xb231('0x3')],'allowNull':!![],'defaultValue':'dynamic'},'ipaddr':{'type':Sequelize[_0xb231('0x3')],'allowNull':!![]},'port':{'type':Sequelize[_0xb231('0x12')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0xb231('0x12')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0xb231('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize[_0xb231('0x3')],'allowNull':!![]},'useragent':{'type':Sequelize[_0xb231('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xb231('0x19')](_0xb231('0x1a'),_0xb231('0xe'),_0xb231('0x1b')),'allowNull':!![],'defaultValue':_0xb231('0x1a')},'context':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xb231('0x1c')},'callingpres':{'type':Sequelize[_0xb231('0x19')](_0xb231('0x1d'),_0xb231('0x1e'),'ALLOWED_FAILED_SCREEN',_0xb231('0x1f'),_0xb231('0x20'),_0xb231('0x21'),_0xb231('0x22'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0xb231('0x3')],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize[_0xb231('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0xb231('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xb231('0x23'),'set':function(_0x26bac9){this[_0xb231('0x6')]('transport',_0x26bac9?_0x26bac9[_0xb231('0x24')](','):null);},'get':function(){return this[_0xb231('0x9')](_0xb231('0x25'))?this['getDataValue'](_0xb231('0x25'))[_0xb231('0x26')](','):null;},'comment':_0xb231('0x27')},'dtmfmode':{'type':Sequelize[_0xb231('0x19')]('rfc2833',_0xb231('0x28'),_0xb231('0x29'),_0xb231('0x2a'),'auto'),'allowNull':!![],'defaultValue':_0xb231('0x2b')},'directmedia':{'type':Sequelize[_0xb231('0x19')](_0xb231('0x2c'),'no','nonat',_0xb231('0x2d'),_0xb231('0x2e')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xb231('0x19')](_0xb231('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xb231('0x3')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xb231('0x3')],'allowNull':!![]},'nat':{'type':Sequelize[_0xb231('0x3')],'allowNull':!![],'defaultValue':_0xb231('0x2f'),'set':function(_0xdc56eb){this[_0xb231('0x6')](_0xb231('0x30'),_0xdc56eb?_0xdc56eb[_0xb231('0x24')](','):null);},'get':function(){return this[_0xb231('0x9')]('nat')?this[_0xb231('0x9')](_0xb231('0x30'))[_0xb231('0x26')](','):null;},'comment':_0xb231('0x31')},'callgroup':{'type':Sequelize[_0xb231('0x3')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0xb231('0x3')]},'language':{'type':Sequelize[_0xb231('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING']},'disallow':{'type':Sequelize[_0xb231('0x3')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xb231('0x32'),'set':function(_0x2595ff){this[_0xb231('0x6')](_0xb231('0x33'),_0x2595ff?_0x2595ff[_0xb231('0x24')](';'):_0xb231('0x32'));},'get':function(){return this['getDataValue'](_0xb231('0x33'))?this[_0xb231('0x9')](_0xb231('0x33'))[_0xb231('0x26')](';'):null;},'comment':_0xb231('0x34')},'autoframing':{'type':Sequelize[_0xb231('0x19')](_0xb231('0x2c'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0xb231('0x3')],'allowNull':!![],'set':function(_0x2b6872){this[_0xb231('0x6')]('insecure',_0x2b6872?_0x2b6872[_0xb231('0x24')](','):null);},'get':function(){return this[_0xb231('0x9')]('insecure')?this[_0xb231('0x9')](_0xb231('0x35'))[_0xb231('0x26')](','):null;},'comment':_0xb231('0x36')},'trustrpid':{'type':Sequelize[_0xb231('0x19')](_0xb231('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xb231('0x19')](_0xb231('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM']('yes','no',_0xb231('0x37')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0xb231('0x19')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0xb231('0x19')](_0xb231('0x2c'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0xb231('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize[_0xb231('0x3')],'allowNull':!![],'defaultValue':_0xb231('0x38')},'amaflags':{'type':Sequelize[_0xb231('0x3')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0xb231('0x19')](_0xb231('0x2c'),'no'),'allowNull':!![],'defaultValue':_0xb231('0x2c')},'busylevel':{'type':Sequelize[_0xb231('0x12')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xb231('0x19')]('yes','no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0xb231('0x19')]('yes','no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0xb231('0x19')](_0xb231('0x2c'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0xb231('0x3')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xb231('0x19')]('yes','no',_0xb231('0x39')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xb231('0x12')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0xb231('0x19')](_0xb231('0x2c'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xb231('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0xb231('0x19')](_0xb231('0x3a'),_0xb231('0x3b'),_0xb231('0x3c')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xb231('0x12')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0xb231('0x12')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xb231('0x19')](_0xb231('0x3d'),_0xb231('0x3e')),'allowNull':!![],'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0xb231('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0xb231('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0xb231('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xb231('0x3')],'allowNull':!![]},'qualify':{'type':Sequelize[_0xb231('0x19')](_0xb231('0x2c'),'no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0xb231('0x3')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0xb231('0x3')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0xb231('0x12')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xb231('0x12')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xb231('0x12')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0xb231('0x19')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xb231('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0xb231('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0xb231('0x12')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xb231('0x12')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0xb231('0x3')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xb231('0x3')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0xb231('0x3')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xb231('0x3')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0xb231('0x3')],'allowNull':!![]},'maxforwards':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0xb231('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xb231('0x19')](_0xb231('0x2c'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xb231('0x19')](_0xb231('0x2c'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM'](_0xb231('0x2c'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0xb231('0x2c'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0xb231('0x19')](_0xb231('0x2c'),'no','fingerprint','certificate'),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0xb231('0x12')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xb231('0x3')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xb231('0x3')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xb231('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xb231('0x3')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0xb231('0x19')](_0xb231('0x3f'),_0xb231('0x40'),_0xb231('0x41')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xb231('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0xb231('0x19')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xb231('0x3')],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize[_0xb231('0x12')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0xb231('0x19')]('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0xb231('0x19')](_0xb231('0x2c'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xb231('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xb231('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize['STRING'],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xb231('0x3')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0xb231('0x19')](_0xb231('0x2c'),'no','nonat',_0xb231('0x2d'),_0xb231('0x42')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xb231('0x3')]},'resetPasswordExpires':{'type':Sequelize[_0xb231('0x16')]},'passwordResetAt':{'type':Sequelize['DATE'],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0xb231('0x43')]},'showWebBar':{'type':Sequelize[_0xb231('0x12')],'defaultValue':0x0,'set':function(_0x2be83a){this[_0xb231('0x6')](_0xb231('0x44'),_0x2be83a);var _0x50830e=this['get']({'plain':!![]});switch(_0x2be83a){case 0x0:case 0x1:var _0x39b556=_0x50830e[_0xb231('0x25')]?_['isArray'](_0x50830e['transport'])?_0x50830e['transport'][_0xb231('0x24')]():_0x50830e[_0xb231('0x25')]:'udp';if(_0x39b556===_0xb231('0x45')){_0x39b556='udp';}this[_0xb231('0x6')](_0xb231('0x25'),_0x39b556);this[_0xb231('0x6')](_0xb231('0x46'),'no');this[_0xb231('0x6')](_0xb231('0x47'),null);this[_0xb231('0x6')](_0xb231('0x48'),null);this['setDataValue']('icesupport',null);this[_0xb231('0x6')]('dtlsenable',null);this[_0xb231('0x6')](_0xb231('0x49'),null);this[_0xb231('0x6')]('dtlssetup',null);this[_0xb231('0x6')](_0xb231('0x4a'),null);this[_0xb231('0x6')](_0xb231('0x4b'),null);this[_0xb231('0x6')](_0xb231('0x4c'),'no');break;case 0x2:this[_0xb231('0x6')](_0xb231('0x25'),_0xb231('0x45'));this[_0xb231('0x6')](_0xb231('0x46'),'yes');this[_0xb231('0x6')](_0xb231('0x47'),_0xb231('0x2c'));this[_0xb231('0x6')](_0xb231('0x48'),'yes');this[_0xb231('0x6')](_0xb231('0x4d'),_0xb231('0x2c'));this[_0xb231('0x6')]('dtlsenable',_0xb231('0x2c'));this[_0xb231('0x6')](_0xb231('0x49'),'no');this['setDataValue'](_0xb231('0x4e'),'actpass');this[_0xb231('0x6')]('dtlscertfile',_0x50830e['dtlscertfile']||_0xb231('0x4f'));this['setDataValue'](_0xb231('0x4b'),_0x50830e[_0xb231('0x4b')]||_0xb231('0x50'));this['setDataValue'](_0xb231('0x4c'),_0xb231('0x2c'));break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x2a4cc2){this[_0xb231('0x6')](_0xb231('0x51'),_0x2a4cc2?_0x2a4cc2[_0xb231('0x24')](','):[]);},'get':function(){return this[_0xb231('0x9')](_0xb231('0x51'))?_['map'](this['getDataValue'](_0xb231('0x51'))[_0xb231('0x26')](','),function(_0x1ccf2e){return parseInt(_0x1ccf2e,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize[_0xb231('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0xb231('0x17')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0xb231('0x17')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0xb231('0x17')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xb231('0x17')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0xb231('0x17')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xb231('0x12')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0xb231('0x3')],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize['ENUM'](_0xb231('0x2c'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0xb231('0x17')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0xb231('0x3')]},'phoneBarEnableJaws':{'type':Sequelize[_0xb231('0x17')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0xb231('0x17')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xb231('0x52')],'get':function(){return this[_0xb231('0x9')]('phoneBarEnableScreenRecordingByAgent')?this[_0xb231('0x9')](_0xb231('0x53')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0xb231('0x17')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xb231('0x17')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0xb231('0x17')],'defaultValue':![]},'interface':{'type':Sequelize[_0xb231('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0xb231('0x17')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0xb231('0x3')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xb231('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0xb231('0x17')],'defaultValue':![],'set':function(_0x532f5c){if(typeof _0x532f5c===_0xb231('0x54')){var _0x3e30b8=_0x532f5c==='1'?!![]:_0x532f5c==='0'?![]:_0x532f5c===_0xb231('0x55')?!![]:_0x532f5c==='false'?![]:![];this[_0xb231('0x6')]('screenrecording',_0x3e30b8);}else{this[_0xb231('0x6')](_0xb231('0x56'),_0x532f5c);}}},'blocked':{'type':Sequelize[_0xb231('0x17')],'defaultValue':![],'set':function(_0x59e1d0){this[_0xb231('0x6')](_0xb231('0x57'),_0x59e1d0);if(_0x59e1d0===!![]){this[_0xb231('0x6')](_0xb231('0x58'),moment());this[_0xb231('0x6')](_0xb231('0x59'),0x0);}else{this[_0xb231('0x6')](_0xb231('0x58'),null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0xb231('0x12')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xb231('0x17')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0xb231('0x17')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0xb231('0x12')](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xb231('0x17')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xb231('0x17')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0xb231('0x17')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0xb231('0x17')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0xb231('0x12')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0xb231('0x17')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0xb231('0x17')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0xb231('0x12')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0xb231('0x17')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0xb231('0x12')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0xb231('0x17')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0xb231('0x17')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0xb231('0x12')],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize[_0xb231('0x17')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index a671a2e..9e9f96b 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 _0xe5cd=['Queues','penalty','QueueId','voice','VoiceQueue','interface','format','map','UserVoiceQueueRt','upsert','removeQueues','Unknown\x20channel','remove','isArray','Queue:remove','addAvatar','userpic','filename','getAvatar','join','root','server/files/images/logos/default_profile.png','download','existsSync','server/files/images/','getOpenTabs','createdAt','FaxOpenTabs','FAX','OpenchannelOpenTabs','OPENCHANNEL','MailOpenTabs','MAIL','SmsOpenTabs','SMS','WhatsappOpenTabs','WHATSAPP','concat','getContacts','User\x20with\x20id\x20%s\x20not\x20found','List','Tag','Tags','tag','getQueues','isValidChannel','model','keys','Queue','filters','intersection','fields','order','sort','where','pick','Unknown\x20role','hasOwnProperty','nolimit','getVoiceQueuesRt','getGroups','VoiceRecording','UserId','getScreenRecordings','ScreenRecording','getChatInteractions','getOpenchannelInteractions','getMailInteractions','MailInteraction','getSmsInteractions','getFaxInteractions','FaxInteraction','getWhatsappInteractions','WhatsappInteraction','login','phone','LOCAL/%s@from-sip/n','SIP/%s','intrf','headers','connection','remoteAddress','socket','commit','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','UserVoiceQueue.penalty','MemberReport','forEach','YYYY-MM-DD\x20HH:mm:ss','getChannels','LOGIN','device','LOGININPAUSE','isMiddleware','resolve','logout','pause','QueuePause','updateAttributes','PAUSE','DEFAULT\x20PAUSE','Channel\x20parameter\x20%s\x20is\x20invalid','chatPause','faxPause','openchannelPause','smsPause','whatsappPause','pauseType','lastPauseAt','unpause','getTeams','Team','addTeams','Body\x20parameter\x20\x27ids\x27\x20is\x20required','transaction','flattenDeep','addAgent','getDataValue','Voice','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','removeTeams','Query\x20parameter\x20\x27ids\x27\x20is\x20required','getAssociatedQueues','getLists','getAgents','getVoiceQueues','You\x20can\x27t\x20delete\x20yourself','CmHopper','addChatInteractions','spread','user_has_chat_interactions:save','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','removeOpenchannelInteractions','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','VoicePrefix','FaxAccount','getFaxAccounts','addFaxAccounts','removeFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','getSmsAccounts','addSmsAccounts','removeSmsAccounts','ChatWebsite','getChatWebsites','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','getScheduledCalls','$and','$or','$gt','$gte','$lt','$lte','$ne','$eq','$not','$between','$notBetween','$in','$like','$iLike','$notILike','$overlap','firstName','lastName','CmContact','Contact','dialActive','getApiKey','retrieveApiKey','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','iat','nonce','token','removeApiKey','apiKeyNonce','apiKeyIat','API\x20key\x20not\x20available','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','getUserSetting','getPresence','idle','unknown','teams','queues','inbound','flatten','lower','col','desc','asc','substring','uniqBy','getRealtimeAgents','offline','unavailable','voiceStatus','charAt','toUpperCase','slice','QueryTypes','select','field','ui.','InteractionId','ui.createdAt','user_has_','_interactions','ui.UserId\x20=\x20?','toString','OpenTabs','messengerSoundNotification','moment','util','path','lodash','squel','ioredis','jayson/promise','../../components/auth/service','../../components/contacts','../../components/parsers/qs','../../components/realtime/agents','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','APINotFoundError','../../errors/api','handleError','socket.io-emitter','redis','./user.socket','register','defaults','localhost','client','http','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','request','then','info','User,\x20%s,\x20%s','debug','User,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','update','role','agent','emit','userNotification:recalc:','destroy','get','admin','user','Agents','Telephones','telephone','ignore','value','includes','find','name','send','User','rawAttributes','fieldName','filter','password','previousPasswords','resetPasswordExpires','md5secret','index','getOptions','include','query','userSetting','true','UserSetting','attributes','push','findAll','rows','openTabs','length','chat','dataValues','sms','fax','mail','openchannel','whatsapp','all','show','params','includeAll','merge','options','body','describe','addContacts','ids','omit','internal','Setting','securePassword','validatePasswordPattern','max','isNil','min_internal','sequelize','SELECT','from','voicemail','mailbox','fullname','permissions','101','102','103','113','110','105','106','107','108','109','100','111','114','115','create','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','settingsEnabled','VoiceMail','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','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','checkUserLimits','some','isEmpty','compact','changePassword','oldPassword','newPassword','authenticate','Sequelize','ValidationError','Invalid\x20body\x20format.\x20Use\x20newPassword','findOne','enforcePasswordHistory','passwordHistoryLimit','validatePasswordHistory','updatePasswordsHistory','channel','online','loginInPause','voicePause','add','capitalize','toLowerCase'];(function(_0x18e26b,_0x3281d2){var _0x46e17a=function(_0x25c41f){while(--_0x25c41f){_0x18e26b['push'](_0x18e26b['shift']());}};_0x46e17a(++_0x3281d2);}(_0xe5cd,0xf5));var _0xde5c=function(_0xef3e80,_0x1edef3){_0xef3e80=_0xef3e80-0x0;var _0x47887d=_0xe5cd[_0xef3e80];return _0x47887d;};'use strict';var moment=require(_0xde5c('0x0'));var util=require(_0xde5c('0x1'));var path=require(_0xde5c('0x2'));var fs=require('fs');var _=require(_0xde5c('0x3'));var squel=require(_0xde5c('0x4'));var Redis=require(_0xde5c('0x5'));var jayson=require(_0xde5c('0x6'));var authService=require(_0xde5c('0x7'));var contacts=require(_0xde5c('0x8'));var qs=require(_0xde5c('0x9'));var rta=require(_0xde5c('0xa'));var logger=require(_0xde5c('0xb'))(_0xde5c('0xc'));var utils=require(_0xde5c('0xd'));var config=require(_0xde5c('0xe'));var licenseUtil=require(_0xde5c('0xf'));var APIBadRequestError=require('../../errors/api')['APIBadRequestError'];var APINotFoundError=require('../../errors/api')[_0xde5c('0x10')];var APIForbiddenError=require('../../errors/api')['APIForbiddenrror'];var APIHandleError=require(_0xde5c('0x11'))[_0xde5c('0x12')];var db=require('../../mysqldb')['db'];var socket=require(_0xde5c('0x13'))(new Redis(config[_0xde5c('0x14')]));require(_0xde5c('0x15'))[_0xde5c('0x16')](socket);config[_0xde5c('0x14')]=_[_0xde5c('0x17')](config[_0xde5c('0x14')],{'host':_0xde5c('0x18'),'port':0x18eb});var amiClient=jayson[_0xde5c('0x19')][_0xde5c('0x1a')]({'port':0x232a});var values;function respondWithStatusCode(_0x5c19b1,_0x3a53e5){_0x3a53e5=_0x3a53e5||0xcc;return function(_0x5b40d0){if(_0x5b40d0){return _0x5c19b1[_0xde5c('0x1b')](_0x3a53e5);}return _0x5c19b1[_0xde5c('0x1c')](_0x3a53e5)[_0xde5c('0x1d')]();};}function respondWithResult(_0x177ae1,_0x1bd7ad){_0x1bd7ad=_0x1bd7ad||0xc8;return function(_0x2257b1){if(_0x2257b1){return _0x177ae1[_0xde5c('0x1c')](_0x1bd7ad)['json'](_0x2257b1);}};}function respondWithFilteredResult(_0x5260a0,_0x103f8d){return function(_0x26ff24){if(_0x26ff24){var _0x36b49a=typeof _0x103f8d[_0xde5c('0x1e')]===_0xde5c('0x1f')&&typeof _0x103f8d[_0xde5c('0x20')]===_0xde5c('0x1f');var _0x50f81a=_0x26ff24['count'];var _0x1f9e87=_0x36b49a?0x0:_0x103f8d[_0xde5c('0x1e')];var _0x29b90f=_0x36b49a?_0x26ff24[_0xde5c('0x21')]:_0x103f8d[_0xde5c('0x1e')]+_0x103f8d[_0xde5c('0x20')];var _0x1aa97f;if(_0x29b90f>=_0x50f81a){_0x29b90f=_0x50f81a;_0x1aa97f=0xc8;}else{_0x1aa97f=0xce;}_0x5260a0[_0xde5c('0x1c')](_0x1aa97f);return _0x5260a0['set'](_0xde5c('0x22'),_0x1f9e87+'-'+_0x29b90f+'/'+_0x50f81a)[_0xde5c('0x23')](_0x26ff24);}return null;};}function respondWithRpcPromise(_0x2e1c64,_0x4ae687,_0x569de4,_0x6e9b7f){return new Promise(function(_0x348d6a,_0x4c245b){var _0x287c87=_0x6e9b7f||amiClient;return _0x287c87[_0xde5c('0x24')](_0x2e1c64,_0x569de4)[_0xde5c('0x25')](function(_0x43b10b){logger[_0xde5c('0x26')](_0xde5c('0x27'),_0x4ae687,'request\x20sent');logger[_0xde5c('0x28')](_0xde5c('0x29'),_0x4ae687,_0xde5c('0x2a'),JSON[_0xde5c('0x2b')](_0x43b10b));if(_0x43b10b['error']){if(_0x43b10b[_0xde5c('0x2c')][_0xde5c('0x2d')]===0x1f4){logger[_0xde5c('0x2c')](_0xde5c('0x27'),_0x4ae687,_0x43b10b[_0xde5c('0x2c')][_0xde5c('0x2e')]);return _0x4c245b(_0x43b10b['error'][_0xde5c('0x2e')]);}logger[_0xde5c('0x2c')](_0xde5c('0x27'),_0x4ae687,_0x43b10b['error']['message']);return _0x348d6a(_0x43b10b['error']['message']);}else{logger['info']('User,\x20%s,\x20%s',_0x4ae687,_0xde5c('0x2a'));_0x348d6a(_0x43b10b[_0xde5c('0x2f')][_0xde5c('0x2e')]);}})[_0xde5c('0x30')](function(_0x1b4cf6){logger[_0xde5c('0x2c')](_0xde5c('0x27'),_0x4ae687,_0x1b4cf6);_0x4c245b(_0x1b4cf6);});});}function saveUpdates(_0x166d17){return function(_0xe5d317){if(_0xe5d317){return _0xe5d317[_0xde5c('0x31')](_0x166d17)[_0xde5c('0x25')](function(_0x4acde1){if(_0x4acde1[_0xde5c('0x32')]===_0xde5c('0x33')){socket[_0xde5c('0x34')](_0xde5c('0x35')+_0x4acde1['id'],_0x4acde1);}return _0x4acde1;});}return null;};}function removeEntity(_0x4b7224,_0x916fe9){return function(_0x40f0c6){if(_0x40f0c6){return _0x40f0c6[_0xde5c('0x36')]({'transaction':_0x916fe9})[_0xde5c('0x25')](function(){var _0x17377a=_0x40f0c6[_0xde5c('0x37')]({'plain':!![]});if(_0x17377a['role']===_0xde5c('0x38'))return;var _0x120ed1=[{'name':'Users','value':_0xde5c('0x39'),'ignore':!![]},{'name':_0xde5c('0x3a'),'value':_0xde5c('0x33'),'ignore':![]},{'name':_0xde5c('0x3b'),'value':_0xde5c('0x3c'),'ignore':![]}];var _0x3d5cc4=_(_0x120ed1)['filter'](_0xde5c('0x3d'))['map'](_0xde5c('0x3e'))[_0xde5c('0x3e')]();if(_[_0xde5c('0x3f')](_0x3d5cc4,_0x17377a[_0xde5c('0x32')])){return;}var _0x226e58=_[_0xde5c('0x40')](_0x120ed1,[_0xde5c('0x3e'),_0x17377a[_0xde5c('0x32')]])[_0xde5c('0x41')];return db['UserProfileResource'][_0xde5c('0x36')]({'where':{'type':_0x226e58,'resourceId':_0x17377a['id']},'transaction':_0x916fe9})['then'](function(){return _0x40f0c6;});})['then'](function(){_0x4b7224['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ac156){return function(_0x3fc7eb){if(!_0x3fc7eb){_0x2ac156['sendStatus'](0x194);}return _0x3fc7eb;};}function handleError(_0x247fa9,_0x3a84db){_0x3a84db=_0x3a84db||0x1f4;return function(_0x4d46fc){logger[_0xde5c('0x2c')](_0x4d46fc['stack']);if(_0x4d46fc['name']){delete _0x4d46fc[_0xde5c('0x41')];}_0x247fa9[_0xde5c('0x1c')](_0x3a84db)[_0xde5c('0x42')](_0x4d46fc);};}function getUserAttributes(){return _(db[_0xde5c('0x43')][_0xde5c('0x44')])['map'](function(_0x6eaf12){return{'name':_0x6eaf12[_0xde5c('0x45')],'type':_0x6eaf12['type']['key']};})[_0xde5c('0x46')](function(_0x15fcfe){return![_0xde5c('0x47'),'salt',_0xde5c('0x48'),'resetPasswordToken',_0xde5c('0x49'),_0xde5c('0x4a')]['includes'](_0x15fcfe['name']);})['value']();}exports[_0xde5c('0x4b')]=function(_0x19c513,_0x15a297){var _0x5680fe={},_0x469c43={'count':0x0,'rows':[]};var _0x426804=getUserAttributes();_0x5680fe=qs[_0xde5c('0x4c')](_0x426804,_0x19c513);var _0x20c65d={'where':_0x5680fe['where']};return db['User'][_0xde5c('0x21')](_0x20c65d)[_0xde5c('0x25')](function(_0x46c11b){_0x469c43[_0xde5c('0x21')]=_0x46c11b;if(_0x19c513['query']['includeAll']){_0x5680fe[_0xde5c('0x4d')]=[{'all':!![]}];}if(_0x19c513[_0xde5c('0x4e')][_0xde5c('0x4f')]===_0xde5c('0x50')){_0x5680fe[_0xde5c('0x4d')]=[{'model':db[_0xde5c('0x51')],'as':'userSetting'}];}if(!_['includes'](_0x5680fe[_0xde5c('0x52')],'id')){_0x5680fe[_0xde5c('0x52')][_0xde5c('0x53')]('id');}return db[_0xde5c('0x43')][_0xde5c('0x54')](_0x5680fe);})[_0xde5c('0x25')](function(_0x3191ae){_0x469c43[_0xde5c('0x55')]=_0x3191ae;if(_0x19c513[_0xde5c('0x4e')][_0xde5c('0x56')]===_0xde5c('0x50')){var _0x387722=[];for(var _0x5ae98b=0x0;_0x5ae98b<_0x469c43[_0xde5c('0x55')][_0xde5c('0x57')];_0x5ae98b++){_0x387722[_0xde5c('0x53')](get_open_tabs(_0xde5c('0x58'),_0x469c43[_0xde5c('0x55')][_0x5ae98b][_0xde5c('0x59')]));_0x387722[_0xde5c('0x53')](get_open_tabs(_0xde5c('0x5a'),_0x469c43['rows'][_0x5ae98b][_0xde5c('0x59')]));_0x387722[_0xde5c('0x53')](get_open_tabs(_0xde5c('0x5b'),_0x469c43[_0xde5c('0x55')][_0x5ae98b][_0xde5c('0x59')]));_0x387722[_0xde5c('0x53')](get_open_tabs(_0xde5c('0x5c'),_0x469c43[_0xde5c('0x55')][_0x5ae98b][_0xde5c('0x59')]));_0x387722[_0xde5c('0x53')](get_open_tabs(_0xde5c('0x5d'),_0x469c43['rows'][_0x5ae98b][_0xde5c('0x59')]));_0x387722[_0xde5c('0x53')](get_open_tabs(_0xde5c('0x5e'),_0x469c43[_0xde5c('0x55')][_0x5ae98b]['dataValues']));}return Promise[_0xde5c('0x5f')](_0x387722)[_0xde5c('0x25')](function(){return _0x469c43;});}else{return _0x469c43;}})['then'](respondWithFilteredResult(_0x15a297,_0x5680fe))[_0xde5c('0x30')](handleError(_0x15a297,null));};exports[_0xde5c('0x60')]=function(_0x4677ee,_0x3c7c05){var _0x545252=getUserAttributes();_0x4677ee[_0xde5c('0x4e')]['id']=_0x4677ee[_0xde5c('0x61')]['id'];var _0x7fbcd=qs[_0xde5c('0x4c')](_0x545252,_0x4677ee);if(_0x4677ee['query'][_0xde5c('0x62')]){_0x7fbcd[_0xde5c('0x4d')]=[{'all':!![]}];}if(_0x4677ee[_0xde5c('0x4e')][_0xde5c('0x4f')]===_0xde5c('0x50')){_0x7fbcd['include']=[{'model':db['UserSetting'],'as':_0xde5c('0x4f')}];}_0x7fbcd=_[_0xde5c('0x63')]({},_0x7fbcd,_0x4677ee[_0xde5c('0x64')]);if(!_[_0xde5c('0x3f')](_0x7fbcd[_0xde5c('0x52')],'id')){_0x7fbcd['attributes'][_0xde5c('0x53')]('id');}return db[_0xde5c('0x43')]['find'](_0x7fbcd)[_0xde5c('0x25')](handleEntityNotFound(_0x3c7c05,null))[_0xde5c('0x25')](function(_0x5019c8){var _0x2018b4=[];values=_0x5019c8;if(_0x4677ee[_0xde5c('0x4e')]['openTabs']===_0xde5c('0x50')){_0x2018b4[_0xde5c('0x53')](get_open_tabs(_0xde5c('0x58'),_0x5019c8[_0xde5c('0x59')]));_0x2018b4['push'](get_open_tabs('sms',_0x5019c8[_0xde5c('0x59')]));_0x2018b4[_0xde5c('0x53')](get_open_tabs(_0xde5c('0x5d'),_0x5019c8[_0xde5c('0x59')]));_0x2018b4[_0xde5c('0x53')](get_open_tabs(_0xde5c('0x5e'),_0x5019c8[_0xde5c('0x59')]));_0x2018b4[_0xde5c('0x53')](get_open_tabs(_0xde5c('0x5b'),_0x5019c8['dataValues']));_0x2018b4[_0xde5c('0x53')](get_open_tabs(_0xde5c('0x5c'),_0x5019c8['dataValues']));return Promise['all'](_0x2018b4);}else{return values;}})['then'](function(){return values;})[_0xde5c('0x25')](respondWithResult(_0x3c7c05,null))[_0xde5c('0x30')](handleError(_0x3c7c05,null));};exports['update']=function(_0x21e0db,_0x949aa0){if(_0x21e0db['body']['id']){delete _0x21e0db[_0xde5c('0x65')]['id'];}delete _0x21e0db[_0xde5c('0x65')]['role'];return db[_0xde5c('0x43')][_0xde5c('0x40')]({'where':{'id':_0x21e0db[_0xde5c('0x61')]['id']}})[_0xde5c('0x25')](handleEntityNotFound(_0x949aa0,null))[_0xde5c('0x25')](saveUpdates(_0x21e0db[_0xde5c('0x65')],null))[_0xde5c('0x25')](respondWithResult(_0x949aa0,null))[_0xde5c('0x30')](handleError(_0x949aa0,null));};exports[_0xde5c('0x66')]=function(_0x348313,_0x3960d8){return db['User'][_0xde5c('0x66')]()[_0xde5c('0x25')](respondWithResult(_0x3960d8,null))[_0xde5c('0x30')](handleError(_0x3960d8,null));};exports[_0xde5c('0x67')]=function(_0x42bb50,_0x1afccd){return db[_0xde5c('0x43')]['find']({'where':{'id':_0x42bb50[_0xde5c('0x61')]['id']}})[_0xde5c('0x25')](handleEntityNotFound(_0x1afccd,null))[_0xde5c('0x25')](function(_0xf3ad11){if(_0xf3ad11){return _0xf3ad11[_0xde5c('0x67')](_0x42bb50[_0xde5c('0x65')][_0xde5c('0x68')],_[_0xde5c('0x69')](_0x42bb50['body'],[_0xde5c('0x68'),'id'])||{});}})[_0xde5c('0x25')](respondWithResult(_0x1afccd,null))[_0xde5c('0x30')](handleError(_0x1afccd,null));};function validateUser(_0x3cdc24){return new Promise(function(_0x4e8bcf,_0x2c0eba){if(_0x3cdc24[_0xde5c('0x6a')])return _0x4e8bcf(_0x3cdc24);return db[_0xde5c('0x6b')]['findById'](0x1)[_0xde5c('0x25')](function(_0x46d3c3){if(_0x46d3c3[_0xde5c('0x6c')])authService[_0xde5c('0x6d')](_0x3cdc24[_0xde5c('0x47')]);db[_0xde5c('0x43')][_0xde5c('0x6e')]('internal')[_0xde5c('0x25')](function(_0x515439){if(_[_0xde5c('0x6f')](_0x515439)){_0x3cdc24[_0xde5c('0x6a')]=_0x46d3c3[_0xde5c('0x70')]||0x1;return;}if(_[_0xde5c('0x6f')](_0x46d3c3['min_internal'])||_0x46d3c3[_0xde5c('0x70')]===_0x515439){_0x3cdc24[_0xde5c('0x6a')]=_0x515439+0x1;return;}if(_0x46d3c3[_0xde5c('0x70')]>_0x515439){_0x3cdc24['internal']=_0x46d3c3[_0xde5c('0x70')];return;}return db[_0xde5c('0x71')][_0xde5c('0x4e')]('select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)',{'type':db[_0xde5c('0x71')]['QueryTypes'][_0xde5c('0x72')]})[_0xde5c('0x25')](function(_0x57b6af){if(_0x57b6af&&_0x57b6af[_0xde5c('0x57')]){for(var _0x2d0cc2=0x0,_0x906d69=_0x57b6af[_0xde5c('0x57')];_0x2d0cc2<_0x906d69&&_[_0xde5c('0x6f')](_0x3cdc24[_0xde5c('0x6a')]);_0x2d0cc2++){if(_0x46d3c3[_0xde5c('0x70')]<=_0x57b6af[_0x2d0cc2][_0xde5c('0x73')]){_0x3cdc24[_0xde5c('0x6a')]=_0x57b6af[_0x2d0cc2][_0xde5c('0x73')];}else if(_0x46d3c3[_0xde5c('0x70')]>_0x57b6af[_0x2d0cc2][_0xde5c('0x73')]&&_0x46d3c3[_0xde5c('0x70')]<=_0x57b6af[_0x2d0cc2]['to']){_0x3cdc24['internal']=_0x46d3c3[_0xde5c('0x70')];}}}if(_[_0xde5c('0x6f')](_0x3cdc24[_0xde5c('0x6a')])){_0x3cdc24['internal']=_0x515439+0x1;}return _0x4e8bcf(_0x3cdc24);});});})[_0xde5c('0x30')](function(_0x12620b){_0x2c0eba(_0x12620b);});});}function updateUser(_0x3633ee){return new Promise(function(_0x55b708,_0x418e90){try{if(_0x3633ee[_0xde5c('0x74')]){_0x3633ee[_0xde5c('0x75')]=_0x3633ee['internal'];_0x3633ee['VoiceMail']={'mailbox':_0x3633ee[_0xde5c('0x6a')],'password':_0x3633ee[_0xde5c('0x47')],'fullname':_0x3633ee[_0xde5c('0x76')],'email':_0x3633ee['email']};}if(_0x3633ee[_0xde5c('0x32')]==='agent'){if(!_0x3633ee[_0xde5c('0x77')])_0x3633ee[_0xde5c('0x77')]=[_0xde5c('0x78'),_0xde5c('0x79'),_0xde5c('0x7a'),_0xde5c('0x7b'),_0xde5c('0x7c'),'104',_0xde5c('0x7d'),_0xde5c('0x7e'),_0xde5c('0x7f'),_0xde5c('0x80'),_0xde5c('0x81'),_0xde5c('0x82'),_0xde5c('0x83'),_0xde5c('0x84'),_0xde5c('0x85')];}_0x55b708(_0x3633ee);}catch(_0x467622){_0x418e90(_0x467622);}});}exports[_0xde5c('0x86')]=function(_0x1e8e40,_0x3a80ae){if(_0x1e8e40[_0xde5c('0x39')][_0xde5c('0x32')]==='agent')throw new Error('Unauthorized');if(_0x1e8e40[_0xde5c('0x65')][_0xde5c('0x32')]===_0xde5c('0x39')&&_0x1e8e40['user'][_0xde5c('0x32')]!==_0xde5c('0x38')){throw new Error(_0xde5c('0x87'));}if(_0x1e8e40[_0xde5c('0x65')]['role']==='admin'&&_0x1e8e40[_0xde5c('0x39')][_0xde5c('0x32')]!==_0xde5c('0x38')){throw new Error(_0xde5c('0x88'));}return licenseUtil['checkUserLimits']([_0x1e8e40[_0xde5c('0x65')]])[_0xde5c('0x25')](function(){return validateUser(_0x1e8e40['body']);})[_0xde5c('0x25')](function(_0x3904a5){return updateUser(_0x3904a5)[_0xde5c('0x25')](function(_0x56da01){if(_0x56da01['role']===_0xde5c('0x38')){_0x56da01[_0xde5c('0x89')]=_0x1e8e40['user'][_0xde5c('0x89')];delete _0x56da01['userProfileId'];}return _0x56da01;});})[_0xde5c('0x25')](function(_0x22fee1){return db['User']['create'](_0x22fee1,{'include':[{'model':db[_0xde5c('0x8a')],'as':_0xde5c('0x8a')}]});})['then'](function(_0x4985e5){if(_0x1e8e40[_0xde5c('0x65')][_0xde5c('0x32')]===_0xde5c('0x39'))return _0x4985e5;if(_0x1e8e40[_0xde5c('0x39')][_0xde5c('0x32')]!==_0xde5c('0x39'))return _0x4985e5;return db[_0xde5c('0x8b')][_0xde5c('0x40')]({'where':{'name':_0x4985e5['role']===_0xde5c('0x33')?_0xde5c('0x3a'):_0xde5c('0x3b'),'userProfileId':_0x1e8e40['user'][_0xde5c('0x8c')]},'raw':!![]})['then'](function(_0xd156e5){if(!_0xd156e5||_0xd156e5[_0xde5c('0x8d')]!=0x0)return _0x4985e5;return db[_0xde5c('0x8e')][_0xde5c('0x86')]({'name':_0x4985e5[_0xde5c('0x41')],'resourceId':_0x4985e5['id'],'type':_0xd156e5[_0xde5c('0x41')],'sectionId':_0xd156e5['id']},{})['then'](function(){return _0x4985e5;});})['catch'](function(_0x534b47){logger[_0xde5c('0x2c')](_0xde5c('0x8f'),_0x534b47);throw _0x534b47;});})[_0xde5c('0x25')](respondWithResult(_0x3a80ae,0xc9))[_0xde5c('0x30')](handleError(_0x3a80ae,null));};exports[_0xde5c('0x90')]=function(_0xd77a8,_0x4fca74){var _0x461cab=_0xd77a8[_0xde5c('0x65')];var _0x1c0c1d=[];if(_0xd77a8[_0xde5c('0x39')][_0xde5c('0x32')]==='agent')throw new Error(_0xde5c('0x91'));if(_['some'](_0x461cab,[_0xde5c('0x32'),'user'])&&_0xd77a8[_0xde5c('0x39')][_0xde5c('0x32')]!==_0xde5c('0x38')){throw new Error(_0xde5c('0x87'));}if(_['some'](_0x461cab,[_0xde5c('0x32'),_0xde5c('0x38')])&&_0xd77a8[_0xde5c('0x39')]['role']!==_0xde5c('0x38')){throw new Error(_0xde5c('0x92'));}return licenseUtil[_0xde5c('0x93')](_0x461cab)[_0xde5c('0x25')](function(){return validateUser(_0x461cab[0x0]);})[_0xde5c('0x25')](function(){for(var _0x50f624=0x1;_0x50f624<_0x461cab[_0xde5c('0x57')];_0x50f624++){var _0x1ab1dc=_0x461cab[_0x50f624-0x1][_0xde5c('0x6a')];if(!_0x461cab[_0x50f624][_0xde5c('0x6a')])_0x461cab[_0x50f624][_0xde5c('0x6a')]=_0x1ab1dc+0x1;_0x1c0c1d[_0xde5c('0x53')](validateUser(_0x461cab[_0x50f624]));}return Promise[_0xde5c('0x5f')](_0x1c0c1d);})[_0xde5c('0x25')](function(){_0x1c0c1d=[];for(var _0x27af5c=0x0;_0x27af5c<_0x461cab[_0xde5c('0x57')];_0x27af5c++){_0x1c0c1d[_0xde5c('0x53')](updateUser(_0x461cab[_0x27af5c]));}return Promise['all'](_0x1c0c1d);})[_0xde5c('0x25')](function(){_0x1c0c1d=_0x461cab['map'](function(_0x29c08b){return db[_0xde5c('0x43')]['create'](_0x29c08b,{'include':[{'model':db[_0xde5c('0x8a')],'as':_0xde5c('0x8a')}]})[_0xde5c('0x25')](function(_0x11f95b){_0x29c08b['id']=_0x11f95b['id'];return _0x29c08b;});});return Promise[_0xde5c('0x5f')](_0x1c0c1d);})['then'](function(_0x124c7b){if(_0xd77a8['body'][_0xde5c('0x32')]==='user')return _0x124c7b;if(_0xd77a8[_0xde5c('0x39')][_0xde5c('0x32')]!==_0xde5c('0x39'))return _0x124c7b;var _0xacf11e=_[_0xde5c('0x94')](_0x124c7b,function(_0x39b6e9){return _0x39b6e9['role']===_0xde5c('0x33')||_0x39b6e9[_0xde5c('0x32')]===_0xde5c('0x3c');});if(!_0xacf11e)return _0x124c7b;return db[_0xde5c('0x8b')][_0xde5c('0x54')]({'where':{'name':{'$or':[_0xde5c('0x3a'),_0xde5c('0x3b')]},'userProfileId':_0xd77a8['user']['userProfileId']},'raw':!![]})[_0xde5c('0x25')](function(_0x305d9f){if(_[_0xde5c('0x95')](_0x305d9f)||!_[_0xde5c('0x94')](_0x305d9f,[_0xde5c('0x8d'),0x0]))return _0x124c7b;_0x1c0c1d=[];var _0x547119=_(_0x305d9f)['map'](function(_0x5097c4){if(_0x5097c4[_0xde5c('0x8d')]===0x1)return;return _0x5097c4[_0xde5c('0x41')]==='Agents'?'agent':_0xde5c('0x3c');})[_0xde5c('0x96')]()[_0xde5c('0x3e')]();for(var _0x59b8d9=0x0;_0x59b8d9<_0x124c7b[_0xde5c('0x57')];_0x59b8d9++){if(!_[_0xde5c('0x3f')](_0x547119,_0x124c7b[_0x59b8d9]['role']))return;var _0xfea8f1=_0x124c7b[_0x59b8d9][_0xde5c('0x32')]==='agent'?'Agents':_0xde5c('0x3b');_0x1c0c1d['push'](db[_0xde5c('0x8e')][_0xde5c('0x86')]({'name':_0x124c7b[_0x59b8d9][_0xde5c('0x41')],'resourceId':_0x124c7b[_0x59b8d9]['id'],'type':_0xfea8f1,'sectionId':_[_0xde5c('0x40')](_0x305d9f,[_0xde5c('0x41'),_0xfea8f1])['id']},{}));}return Promise[_0xde5c('0x5f')](_0x1c0c1d);});})['then'](respondWithResult(_0x4fca74,0xc9))['catch'](handleError(_0x4fca74,null));};exports[_0xde5c('0x97')]=function(_0x9dacaa,_0x2296b4){if(_0x9dacaa[_0xde5c('0x65')]['id']){delete _0x9dacaa[_0xde5c('0x65')]['id'];}return db['User'][_0xde5c('0x40')]({'where':{'id':_0x9dacaa['params']['id']}})[_0xde5c('0x25')](function(_0x117622){if(!_0x117622)return null;if(_0x117622['id']===_0x9dacaa['user']['id']){if(!_0x9dacaa[_0xde5c('0x65')][_0xde5c('0x98')]||!_0x9dacaa[_0xde5c('0x65')][_0xde5c('0x99')]){throw new db['Sequelize']['ValidationError']('Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword');}if(!_0x117622[_0xde5c('0x9a')](_0x9dacaa[_0xde5c('0x65')]['oldPassword'])){throw new db[(_0xde5c('0x9b'))][(_0xde5c('0x9c'))]('Wrong\x20credentials');}if(_0x9dacaa['body'][_0xde5c('0x98')]===_0x9dacaa[_0xde5c('0x65')][_0xde5c('0x99')]){throw new db[(_0xde5c('0x9b'))][(_0xde5c('0x9c'))]('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}}else if(_0x9dacaa[_0xde5c('0x39')]['role']==='admin'){if(!_0x9dacaa[_0xde5c('0x65')]['newPassword']){throw new db[(_0xde5c('0x9b'))]['ValidationError'](_0xde5c('0x9d'));}}else if(_0x9dacaa['user']['role']===_0xde5c('0x39')){if(!_0x9dacaa[_0xde5c('0x65')][_0xde5c('0x99')]){throw new db['Sequelize']['ValidationError'](_0xde5c('0x9d'));}if(_0x117622[_0xde5c('0x32')]!==_0xde5c('0x33')){throw new db[(_0xde5c('0x9b'))][(_0xde5c('0x9c'))](_0xde5c('0x91'));}}else{throw new db[(_0xde5c('0x9b'))][(_0xde5c('0x9c'))](_0xde5c('0x91'));}return _0x117622;})[_0xde5c('0x25')](handleEntityNotFound(_0x2296b4,null))[_0xde5c('0x25')](function(_0x123e93){return db[_0xde5c('0x6b')][_0xde5c('0x9e')]({'attributes':['id',_0xde5c('0x6c'),_0xde5c('0x9f'),_0xde5c('0xa0')]})[_0xde5c('0x25')](function(_0x4bd7f7){if(_0x4bd7f7[_0xde5c('0x6c')])authService['validatePasswordPattern'](_0x9dacaa['body']['newPassword']);if(!_0x4bd7f7[_0xde5c('0x9f')]||!_0x123e93[_0xde5c('0x48')])return _0x123e93;authService[_0xde5c('0xa1')](_0x9dacaa[_0xde5c('0x65')]['newPassword'],_0x123e93[_0xde5c('0x48')],_0x4bd7f7['passwordHistoryLimit']);return _0x123e93;})[_0xde5c('0x25')](saveUpdates({'password':_0x9dacaa[_0xde5c('0x65')][_0xde5c('0x99')],'passwordResetAt':_0x9dacaa[_0xde5c('0x39')]['id']==_0x9dacaa[_0xde5c('0x61')]['id']?moment():null,'previousPasswords':authService[_0xde5c('0xa2')](_0x9dacaa[_0xde5c('0x65')][_0xde5c('0x99')],_0x123e93[_0xde5c('0x48')])},null));})[_0xde5c('0x25')](respondWithResult(_0x2296b4,null))['catch'](handleError(_0x2296b4,null));};exports['addQueues']=function(_0x32ea11,_0x448a69){var _0x5168fa=_0x32ea11['body'][_0xde5c('0xa3')];return db[_0xde5c('0x43')]['find']({'where':{'id':_0x32ea11['params']['id']},'attributes':['id',_0xde5c('0x41'),'role',_0xde5c('0xa4'),_0xde5c('0xa5'),_0xde5c('0xa6'),'interface']})[_0xde5c('0x25')](handleEntityNotFound(_0x448a69,null))['then'](function(_0x88bca6){if(_0x88bca6){if(!utils['isValidChannel'](_0x5168fa)){throw new db['Sequelize']['ValidationError']('Unknown\x20channel');}return _0x88bca6[_0xde5c('0xa7')+_[_0xde5c('0xa8')](_0x5168fa[_0xde5c('0xa9')]())+_0xde5c('0xaa')](_0x32ea11[_0xde5c('0x65')][_0xde5c('0x68')],{'penalty':_0x32ea11[_0xde5c('0x65')][_0xde5c('0xab')]||0x0})['spread'](function(_0x557d34){for(var _0x48d099=0x0;_0x48d099<_0x32ea11['body'][_0xde5c('0x68')][_0xde5c('0x57')];_0x48d099+=0x1){var _0x54b6c9={'UserId':Number(_0x32ea11[_0xde5c('0x61')]['id'])};_0x54b6c9[_[_0xde5c('0xa8')](_0x5168fa[_0xde5c('0xa9')]())+_0xde5c('0xac')]=Number(_0x32ea11[_0xde5c('0x65')][_0xde5c('0x68')][_0x48d099]);socket[_0xde5c('0x34')](_0xde5c('0x39')+_[_0xde5c('0xa8')](_0x5168fa['toLowerCase']())+'Queue:save',_0x54b6c9);}return _0x557d34;})[_0xde5c('0x25')](function(){if(_0x5168fa===_0xde5c('0xad')){return db[_0xde5c('0xae')][_0xde5c('0x54')]({'where':{'id':_0x32ea11[_0xde5c('0x65')][_0xde5c('0x68')]||[]},'raw':!![],'attributes':['id',_0xde5c('0x41')]});}})[_0xde5c('0x25')](function(_0x41f59){var _0x38a638=_0x88bca6[_0xde5c('0x37')]({'plain':!![]});var _0x28eff3=[];if(_0x5168fa===_0xde5c('0xad')&&_0x38a638[_0xde5c('0x32')]==='agent'&&_0x38a638[_0xde5c('0xa4')]){for(let _0x594241=0x0;_0x594241<_0x41f59[_0xde5c('0x57')];_0x594241+=0x1){_0x28eff3[_0xde5c('0x53')]({'membername':_0x38a638[_0xde5c('0x41')],'UserId':_0x38a638['id'],'queue_name':_0x41f59[_0x594241][_0xde5c('0x41')],'VoiceQueueId':_0x41f59[_0x594241]['id'],'interface':_[_0xde5c('0x6f')](_0x38a638[_0xde5c('0xaf')])?util[_0xde5c('0xb0')]('SIP/%s',_0x38a638['name']):_0x38a638[_0xde5c('0xaf')],'paused':_0x38a638[_0xde5c('0xa6')]||![],'penalty':_0x32ea11[_0xde5c('0x65')][_0xde5c('0xab')]||0x0});}return Promise[_0xde5c('0x5f')](_0x28eff3[_0xde5c('0xb1')](function(_0x16d4b4){return db[_0xde5c('0xb2')][_0xde5c('0xb3')](_0x16d4b4);}));}return _0x88bca6;});}})[_0xde5c('0x25')](respondWithStatusCode(_0x448a69,null))[_0xde5c('0x30')](handleError(_0x448a69,null));};exports[_0xde5c('0xb4')]=function(_0x5cca50,_0x39ac24){var _0x5f283a,_0x143e8;return db[_0xde5c('0x43')][_0xde5c('0x40')]({'where':{'id':_0x5cca50[_0xde5c('0x61')]['id']},'attributes':['id','name',_0xde5c('0x32')]})['then'](handleEntityNotFound(_0x39ac24,null))['then'](function(_0x451e0b){if(_0x451e0b){_0x5f283a=_0x451e0b;if(!_0x5cca50[_0xde5c('0x4e')][_0xde5c('0xa3')]||!utils['isValidChannel'](_0x5cca50[_0xde5c('0x4e')][_0xde5c('0xa3')])){throw new db[(_0xde5c('0x9b'))]['ValidationError'](_0xde5c('0xb5'));}return _0x451e0b[_0xde5c('0xb6')+_['capitalize'](_0x5cca50[_0xde5c('0x4e')][_0xde5c('0xa3')]['toLowerCase']())+_0xde5c('0xaa')](_0x5cca50[_0xde5c('0x4e')][_0xde5c('0x68')]);}})[_0xde5c('0x25')](function(_0x2bb715){if(_[_0xde5c('0xb7')](_0x5cca50[_0xde5c('0x4e')][_0xde5c('0x68')])){for(var _0x3bbede=0x0;_0x3bbede<_0x5cca50['query'][_0xde5c('0x68')]['length'];_0x3bbede+=0x1){_0x143e8={'UserId':Number(_0x5cca50['params']['id'])};_0x143e8[_[_0xde5c('0xa8')](_0x5cca50[_0xde5c('0x4e')][_0xde5c('0xa3')][_0xde5c('0xa9')]())+_0xde5c('0xac')]=Number(_0x5cca50['query'][_0xde5c('0x68')][_0x3bbede]);socket[_0xde5c('0x34')](_0xde5c('0x39')+_[_0xde5c('0xa8')](_0x5cca50[_0xde5c('0x4e')]['channel'][_0xde5c('0xa9')]())+'Queue:remove',_0x143e8);}}else{_0x143e8={'UserId':Number(_0x5cca50['params']['id'])};_0x143e8[_[_0xde5c('0xa8')](_0x5cca50[_0xde5c('0x4e')][_0xde5c('0xa3')][_0xde5c('0xa9')]())+_0xde5c('0xac')]=Number(_0x5cca50[_0xde5c('0x4e')][_0xde5c('0x68')]);socket['emit'](_0xde5c('0x39')+_[_0xde5c('0xa8')](_0x5cca50[_0xde5c('0x4e')][_0xde5c('0xa3')][_0xde5c('0xa9')]())+_0xde5c('0xb8'),_0x143e8);}return _0x2bb715;})['then'](function(){if(_0x5cca50['query'][_0xde5c('0xa3')]===_0xde5c('0xad')){return db[_0xde5c('0xb2')][_0xde5c('0x36')]({'where':{'UserId':_0x5cca50['params']['id'],'VoiceQueueId':_0x5cca50[_0xde5c('0x4e')][_0xde5c('0x68')]},'individualHooks':!![]})['then'](function(){return _0x5f283a;});}return _0x5f283a;})[_0xde5c('0x25')](respondWithStatusCode(_0x39ac24,null))[_0xde5c('0x30')](handleError(_0x39ac24,null));};exports[_0xde5c('0xb9')]=function(_0x1c7cc5,_0xef5ec8){_0x1c7cc5[_0xde5c('0x65')][_0xde5c('0xba')]=_0x1c7cc5['file'][_0xde5c('0xbb')];return db[_0xde5c('0x43')][_0xde5c('0x40')]({'where':{'id':_0x1c7cc5[_0xde5c('0x61')]['id']}})[_0xde5c('0x25')](handleEntityNotFound(_0xef5ec8,null))[_0xde5c('0x25')](saveUpdates(_0x1c7cc5[_0xde5c('0x65')],null))[_0xde5c('0x25')](respondWithResult(_0xef5ec8,null))[_0xde5c('0x30')](handleError(_0xef5ec8,null));};exports[_0xde5c('0xbc')]=function(_0x4b7bbc,_0x599794){var _0x4e3bc9=path[_0xde5c('0xbd')](config[_0xde5c('0xbe')],_0xde5c('0xbf'));return db['User'][_0xde5c('0x40')]({'where':{'id':_0x4b7bbc['params']['id']},'attributes':['id','userpic'],'raw':!![]})[_0xde5c('0x25')](handleEntityNotFound(_0x599794,null))[_0xde5c('0x25')](function(_0x560c90){if(_0x560c90){if(_[_0xde5c('0x6f')](_0x560c90[_0xde5c('0xba')])){return _0x599794[_0xde5c('0xc0')](_0x4e3bc9);}else{if(!fs[_0xde5c('0xc1')](path[_0xde5c('0xbd')](config[_0xde5c('0xbe')],'server/files/images/',_0x560c90['userpic']))){return _0x599794[_0xde5c('0xc0')](_0x4e3bc9);}return _0x599794['download'](path['join'](config[_0xde5c('0xbe')],_0xde5c('0xc2'),_0x560c90['userpic']));}}})['catch'](handleError(_0x599794,null));};exports[_0xde5c('0xc3')]=function(_0x57cdbe,_0x501470){return db['User']['find']({'where':{'id':_0x57cdbe['params']['id']},'attributes':['id']})[_0xde5c('0x25')](handleEntityNotFound(_0x501470,null))[_0xde5c('0x25')](function(_0x5bab14){var _0x3a40cd=[];values=_0x5bab14[_0xde5c('0x59')];_0x3a40cd[_0xde5c('0x53')](get_open_tabs(_0xde5c('0x58'),_0x5bab14[_0xde5c('0x59')]));_0x3a40cd['push'](get_open_tabs('sms',_0x5bab14[_0xde5c('0x59')]));_0x3a40cd['push'](get_open_tabs('openchannel',_0x5bab14['dataValues']));_0x3a40cd[_0xde5c('0x53')](get_open_tabs(_0xde5c('0x5e'),_0x5bab14[_0xde5c('0x59')]));_0x3a40cd['push'](get_open_tabs('fax',_0x5bab14['dataValues']));_0x3a40cd[_0xde5c('0x53')](get_open_tabs(_0xde5c('0x5c'),_0x5bab14[_0xde5c('0x59')]));return Promise['all'](_0x3a40cd);})['then'](function(_0xcb8793){if(_0xcb8793){var _0x4f25cf=_[_0xde5c('0xb1')](values['ChatOpenTabs'],function(_0x43408f){return{'channel':'CHAT','id':_0x43408f['id'],'createdAt':_0x43408f[_0xde5c('0xc4')]};});var _0x412d57=_[_0xde5c('0xb1')](values[_0xde5c('0xc5')],function(_0x361f60){return{'channel':_0xde5c('0xc6'),'id':_0x361f60['id'],'createdAt':_0x361f60[_0xde5c('0xc4')]};});var _0x100446=_['map'](values[_0xde5c('0xc7')],function(_0x237e10){return{'channel':_0xde5c('0xc8'),'id':_0x237e10['id'],'createdAt':_0x237e10[_0xde5c('0xc4')]};});var _0x3596b2=_['map'](values[_0xde5c('0xc9')],function(_0x85efd1){return{'channel':_0xde5c('0xca'),'id':_0x85efd1['id'],'createdAt':_0x85efd1[_0xde5c('0xc4')]};});var _0x5747b3=_[_0xde5c('0xb1')](values[_0xde5c('0xcb')],function(_0x1d3645){return{'channel':_0xde5c('0xcc'),'id':_0x1d3645['id'],'createdAt':_0x1d3645[_0xde5c('0xc4')]};});var _0x5e19e3=_[_0xde5c('0xb1')](values[_0xde5c('0xcd')],function(_0x49512d){return{'channel':_0xde5c('0xce'),'id':_0x49512d['id'],'createdAt':_0x49512d[_0xde5c('0xc4')]};});var _0x1f7a10=_[_0xde5c('0xcf')](_0x4f25cf,_0x412d57,_0x100446,_0x3596b2,_0x5747b3,_0x5e19e3);var _0xa2b7d9={'count':_0x1f7a10[_0xde5c('0x57')],'rows':_0x1f7a10};return _0xa2b7d9;}else return null;})[_0xde5c('0x25')](respondWithResult(_0x501470,null))[_0xde5c('0x30')](handleError(_0x501470,null));};exports[_0xde5c('0xd0')]=function(_0x429bda,_0x25dfa0){var _0x581a8d={};return db[_0xde5c('0x43')][_0xde5c('0x9e')]({'where':{'id':_0x429bda[_0xde5c('0x61')]['id']}})[_0xde5c('0x25')](function(_0x5cd84c){if(!_0x5cd84c){throw new APINotFoundError(util[_0xde5c('0xb0')](_0xde5c('0xd1'),_0x429bda[_0xde5c('0x61')]['id']));}return contacts[_0xde5c('0x66')]();})[_0xde5c('0x25')](function(_0x5f781f){_0x429bda['query']['User']=_0x429bda[_0xde5c('0x61')]['id'];_0x581a8d=qs[_0xde5c('0x4c')](_0x5f781f,_0x429bda);if(_0x429bda[_0xde5c('0x4e')]['hasOwnProperty']('includeAll')){_0x581a8d[_0xde5c('0x4d')]=[{'model':db['CmList'],'as':_0xde5c('0xd2'),'required':![]},{'model':db[_0xde5c('0xd3')],'as':_0xde5c('0xd4'),'attributes':['id',_0xde5c('0x41'),'color'],'where':_0x429bda[_0xde5c('0x4e')][_0xde5c('0xd5')]?{'id':_0x429bda[_0xde5c('0x4e')][_0xde5c('0xd5')]}:undefined,'required':_0x429bda[_0xde5c('0x4e')][_0xde5c('0xd5')]?!![]:![]}];}return contacts['findAll'](_0x429bda['query'],_0x429bda[_0xde5c('0x39')],_0x581a8d,_0x5f781f);})[_0xde5c('0x25')](respondWithFilteredResult(_0x25dfa0,_0x581a8d))[_0xde5c('0x30')](APIHandleError(_0x25dfa0));};exports[_0xde5c('0xd6')]=function(_0x4831b5,_0x24e198){var _0x277526;var _0xeeb6c5={};var _0xc3435d;return db[_0xde5c('0x43')]['findOne']({'where':{'id':_0x4831b5['params']['id']},'attributes':['id',_0xde5c('0x41'),_0xde5c('0x32')]})['then'](handleEntityNotFound(_0x24e198,null))[_0xde5c('0x25')](function(_0x13f885){if(!utils[_0xde5c('0xd7')](_0x4831b5[_0xde5c('0x4e')][_0xde5c('0xa3')])){throw new db[(_0xde5c('0x9b'))][(_0xde5c('0x9c'))](_0xde5c('0xb5'));}_0x277526=_0x13f885;var _0x2a039a={};_0x2a039a[_0xde5c('0xd8')]=_[_0xde5c('0xd9')](db[_[_0xde5c('0xa8')](_0x4831b5[_0xde5c('0x4e')][_0xde5c('0xa3')])+_0xde5c('0xda')]['rawAttributes']);_0x2a039a[_0xde5c('0x4e')]=_[_0xde5c('0xd9')](_0x4831b5[_0xde5c('0x4e')]);_0x2a039a[_0xde5c('0xdb')]=_[_0xde5c('0xdc')](_0x2a039a[_0xde5c('0xd8')],_0x2a039a[_0xde5c('0x4e')]);_0xeeb6c5['attributes']=_[_0xde5c('0xdc')](_0x2a039a['model'],qs['fields'](_0x4831b5[_0xde5c('0x4e')][_0xde5c('0xdd')]));_0xeeb6c5['attributes']=_0xeeb6c5[_0xde5c('0x52')][_0xde5c('0x57')]?_0xeeb6c5[_0xde5c('0x52')]:_0x2a039a[_0xde5c('0xd8')];_0xeeb6c5[_0xde5c('0xde')]=qs[_0xde5c('0xdf')](_0x4831b5[_0xde5c('0x4e')]['sort']);_0xeeb6c5[_0xde5c('0xe0')]=qs[_0xde5c('0xdb')](_[_0xde5c('0xe1')](_0x4831b5[_0xde5c('0x4e')],_0x2a039a['filters']));if(_0x4831b5[_0xde5c('0x4e')][_0xde5c('0x46')]){_0xeeb6c5[_0xde5c('0xe0')]=_[_0xde5c('0x63')](_0xeeb6c5[_0xde5c('0xe0')],{'$or':_['map'](_0xeeb6c5['attributes'],function(_0x24f111){var _0x30cb38={};_0x30cb38[_0x24f111]={'$like':'%'+_0x4831b5[_0xde5c('0x4e')]['filter']+'%'};return _0x30cb38;})});}_0xeeb6c5=_['merge']({},_0xeeb6c5,_0x4831b5['options']);switch(_0x277526[_0xde5c('0x32')]){case _0xde5c('0x38'):return db[_[_0xde5c('0xa8')](_0x4831b5[_0xde5c('0x4e')][_0xde5c('0xa3')])+_0xde5c('0xda')][_0xde5c('0x54')](_0xeeb6c5);case _0xde5c('0x39'):case _0xde5c('0x33'):return _0x277526[_0xde5c('0x37')+_[_0xde5c('0xa8')](_0x4831b5[_0xde5c('0x4e')]['channel'])+_0xde5c('0xaa')](_0xeeb6c5);default:throw new db[(_0xde5c('0x9b'))][(_0xde5c('0x9c'))](_0xde5c('0xe2'));}})[_0xde5c('0x25')](function(_0x4b396a){_0xc3435d=_0x4b396a[_0xde5c('0x57')];if(!_0x4831b5['query'][_0xde5c('0xe3')](_0xde5c('0xe4'))){_0xeeb6c5[_0xde5c('0x20')]=qs[_0xde5c('0x20')](_0x4831b5['query'][_0xde5c('0x20')]);_0xeeb6c5['offset']=qs[_0xde5c('0x1e')](_0x4831b5[_0xde5c('0x4e')][_0xde5c('0x1e')]);}switch(_0x277526[_0xde5c('0x32')]){case'admin':return db[_[_0xde5c('0xa8')](_0x4831b5[_0xde5c('0x4e')][_0xde5c('0xa3')])+'Queue'][_0xde5c('0x54')](_0xeeb6c5);case _0xde5c('0x39'):case _0xde5c('0x33'):return _0x277526[_0xde5c('0x37')+_[_0xde5c('0xa8')](_0x4831b5[_0xde5c('0x4e')]['channel'])+_0xde5c('0xaa')](_0xeeb6c5);}})[_0xde5c('0x25')](function(_0x6310be){return{'count':_0xc3435d,'rows':_0x6310be};})[_0xde5c('0x25')](respondWithResult(_0x24e198,null))[_0xde5c('0x30')](handleError(_0x24e198,null));};exports['getVoiceQueuesRt']=function(_0x428462,_0x293f98){var _0x18c38d={};var _0x5772cf={};var _0x173b80;var _0x1b529b;return db[_0xde5c('0x43')]['findOne']({'where':{'id':_0x428462[_0xde5c('0x61')]['id']}})[_0xde5c('0x25')](handleEntityNotFound(_0x293f98,null))['then'](function(_0x576eb1){if(_0x576eb1){_0x173b80=_0x576eb1;_0x5772cf['model']=_['keys'](db[_0xde5c('0xb2')]['rawAttributes']);_0x5772cf[_0xde5c('0x4e')]=_[_0xde5c('0xd9')](_0x428462[_0xde5c('0x4e')]);_0x5772cf[_0xde5c('0xdb')]=_[_0xde5c('0xdc')](_0x5772cf['model'],_0x5772cf[_0xde5c('0x4e')]);_0x18c38d[_0xde5c('0x52')]=_[_0xde5c('0xdc')](_0x5772cf[_0xde5c('0xd8')],qs['fields'](_0x428462[_0xde5c('0x4e')][_0xde5c('0xdd')]));_0x18c38d[_0xde5c('0x52')]=_0x18c38d[_0xde5c('0x52')][_0xde5c('0x57')]?_0x18c38d[_0xde5c('0x52')]:_0x5772cf[_0xde5c('0xd8')];_0x18c38d[_0xde5c('0xde')]=qs['sort'](_0x428462[_0xde5c('0x4e')][_0xde5c('0xdf')]);_0x18c38d[_0xde5c('0xe0')]=qs[_0xde5c('0xdb')](_[_0xde5c('0xe1')](_0x428462[_0xde5c('0x4e')],_0x5772cf[_0xde5c('0xdb')]));if(_0x428462[_0xde5c('0x4e')][_0xde5c('0x46')]){_0x18c38d[_0xde5c('0xe0')]=_[_0xde5c('0x63')](_0x18c38d[_0xde5c('0xe0')],{'$or':_['map'](_0x18c38d[_0xde5c('0x52')],function(_0x37dad9){var _0x7fe73b={};_0x7fe73b[_0x37dad9]={'$like':'%'+_0x428462[_0xde5c('0x4e')][_0xde5c('0x46')]+'%'};return _0x7fe73b;})});}_0x18c38d=_[_0xde5c('0x63')]({},_0x18c38d,_0x428462['options']);return _0x173b80[_0xde5c('0xe5')](_0x18c38d);}})[_0xde5c('0x25')](function(_0x50520a){if(_0x50520a){_0x1b529b=_0x50520a[_0xde5c('0x57')];if(!_0x428462[_0xde5c('0x4e')][_0xde5c('0xe3')](_0xde5c('0xe4'))){_0x18c38d[_0xde5c('0x20')]=qs[_0xde5c('0x20')](_0x428462[_0xde5c('0x4e')][_0xde5c('0x20')]);_0x18c38d[_0xde5c('0x1e')]=qs[_0xde5c('0x1e')](_0x428462[_0xde5c('0x4e')]['offset']);}return _0x173b80[_0xde5c('0xe5')](_0x18c38d);}})[_0xde5c('0x25')](function(_0x534411){if(_0x534411){return _0x534411?{'count':_0x1b529b,'rows':_0x534411}:null;}})['then'](respondWithResult(_0x293f98,null))[_0xde5c('0x30')](handleError(_0x293f98,null));};exports[_0xde5c('0xe6')]=function(_0x4686ec,_0x2e6fa5){var _0x562796={};var _0x496554={};var _0x161fef;var _0x45c317;return db['User'][_0xde5c('0x9e')]({'where':{'id':_0x4686ec[_0xde5c('0x61')]['id']}})['then'](handleEntityNotFound(_0x2e6fa5,null))[_0xde5c('0x25')](function(_0x2f646c){if(_0x2f646c){_0x161fef=_0x2f646c;_0x496554['model']=_['keys'](db['ChatGroup']['rawAttributes']);_0x496554[_0xde5c('0x4e')]=_['keys'](_0x4686ec[_0xde5c('0x4e')]);_0x496554[_0xde5c('0xdb')]=_['intersection'](_0x496554[_0xde5c('0xd8')],_0x496554[_0xde5c('0x4e')]);_0x562796[_0xde5c('0x52')]=_[_0xde5c('0xdc')](_0x496554[_0xde5c('0xd8')],qs[_0xde5c('0xdd')](_0x4686ec[_0xde5c('0x4e')][_0xde5c('0xdd')]));_0x562796['attributes']=_0x562796[_0xde5c('0x52')][_0xde5c('0x57')]?_0x562796[_0xde5c('0x52')]:_0x496554[_0xde5c('0xd8')];_0x562796[_0xde5c('0xde')]=qs[_0xde5c('0xdf')](_0x4686ec[_0xde5c('0x4e')][_0xde5c('0xdf')]);_0x562796[_0xde5c('0xe0')]=qs[_0xde5c('0xdb')](_['pick'](_0x4686ec[_0xde5c('0x4e')],_0x496554[_0xde5c('0xdb')]));if(_0x4686ec[_0xde5c('0x4e')][_0xde5c('0x46')]){_0x562796[_0xde5c('0xe0')]=_[_0xde5c('0x63')](_0x562796['where'],{'$or':_[_0xde5c('0xb1')](_0x562796[_0xde5c('0x52')],function(_0x18d241){var _0x3c4a11={};_0x3c4a11[_0x18d241]={'$like':'%'+_0x4686ec[_0xde5c('0x4e')]['filter']+'%'};return _0x3c4a11;})});}_0x562796=_[_0xde5c('0x63')]({},_0x562796,_0x4686ec[_0xde5c('0x64')]);return _0x161fef[_0xde5c('0xe6')](_0x562796);}})[_0xde5c('0x25')](function(_0x5062c4){if(_0x5062c4){_0x45c317=_0x5062c4[_0xde5c('0x57')];if(!_0x4686ec[_0xde5c('0x4e')][_0xde5c('0xe3')](_0xde5c('0xe4'))){_0x562796[_0xde5c('0x20')]=qs[_0xde5c('0x20')](_0x4686ec[_0xde5c('0x4e')][_0xde5c('0x20')]);_0x562796[_0xde5c('0x1e')]=qs['offset'](_0x4686ec[_0xde5c('0x4e')]['offset']);}return _0x161fef[_0xde5c('0xe6')](_0x562796);}})[_0xde5c('0x25')](function(_0x4b9261){if(_0x4b9261){return _0x4b9261?{'count':_0x45c317,'rows':_0x4b9261}:null;}})[_0xde5c('0x25')](respondWithResult(_0x2e6fa5,null))[_0xde5c('0x30')](handleError(_0x2e6fa5,null));};exports['getRecordings']=function(_0x174b6c,_0x30a4b5){var _0x5160a3={'raw':!![],'where':{}};var _0x1b470f={};var _0x3f0dd0={'count':0x0,'rows':[]};return db['User'][_0xde5c('0x9e')]({'where':{'id':_0x174b6c[_0xde5c('0x61')]['id']}})['then'](handleEntityNotFound(_0x30a4b5,null))['then'](function(_0x1cd3e5){if(_0x1cd3e5){_0x1b470f[_0xde5c('0xd8')]=_[_0xde5c('0xd9')](db[_0xde5c('0xe7')][_0xde5c('0x44')]);_0x1b470f['query']=_[_0xde5c('0xd9')](_0x174b6c[_0xde5c('0x4e')]);_0x1b470f['filters']=_['intersection'](_0x1b470f[_0xde5c('0xd8')],_0x1b470f['query']);_0x5160a3[_0xde5c('0x52')]=_[_0xde5c('0xdc')](_0x1b470f[_0xde5c('0xd8')],qs['fields'](_0x174b6c[_0xde5c('0x4e')]['fields']));_0x5160a3[_0xde5c('0x52')]=_0x5160a3['attributes']['length']?_0x5160a3[_0xde5c('0x52')]:_0x1b470f[_0xde5c('0xd8')];if(!_0x174b6c[_0xde5c('0x4e')][_0xde5c('0xe3')](_0xde5c('0xe4'))){_0x5160a3[_0xde5c('0x20')]=qs[_0xde5c('0x20')](_0x174b6c['query'][_0xde5c('0x20')]);_0x5160a3[_0xde5c('0x1e')]=qs[_0xde5c('0x1e')](_0x174b6c[_0xde5c('0x4e')]['offset']);}_0x5160a3[_0xde5c('0xde')]=qs[_0xde5c('0xdf')](_0x174b6c[_0xde5c('0x4e')]['sort']);_0x5160a3['where']=qs['filters'](_[_0xde5c('0xe1')](_0x174b6c[_0xde5c('0x4e')],_0x1b470f[_0xde5c('0xdb')]));_0x5160a3['where'][_0xde5c('0xe8')]=_0x1cd3e5['id'];if(_0x174b6c[_0xde5c('0x4e')][_0xde5c('0x46')]){_0x5160a3[_0xde5c('0xe0')]=_['merge'](_0x5160a3[_0xde5c('0xe0')],{'$or':_[_0xde5c('0xb1')](_0x5160a3[_0xde5c('0x52')],function(_0x22fe73){var _0x5a5e21={};_0x5a5e21[_0x22fe73]={'$like':'%'+_0x174b6c[_0xde5c('0x4e')][_0xde5c('0x46')]+'%'};return _0x5a5e21;})});}_0x5160a3=_[_0xde5c('0x63')]({},_0x5160a3,_0x174b6c[_0xde5c('0x64')]);return db[_0xde5c('0xe7')][_0xde5c('0x21')]({'where':_0x5160a3[_0xde5c('0xe0')]})['then'](function(_0x352882){_0x3f0dd0['count']=_0x352882;if(_0x174b6c[_0xde5c('0x4e')][_0xde5c('0x62')]){_0x5160a3['include']=[{'all':!![]}];}return db[_0xde5c('0xe7')][_0xde5c('0x54')](_0x5160a3);})[_0xde5c('0x25')](function(_0x1557ef){_0x3f0dd0[_0xde5c('0x55')]=_0x1557ef;return _0x3f0dd0;});}})[_0xde5c('0x25')](respondWithFilteredResult(_0x30a4b5,_0x5160a3))[_0xde5c('0x30')](handleError(_0x30a4b5,null));};exports[_0xde5c('0xe9')]=function(_0x26014f,_0x341c17){var _0x501d58={'raw':!![],'where':{}};var _0x1c2b70={};var _0x516094={'count':0x0,'rows':[]};return db[_0xde5c('0x43')]['findOne']({'where':{'id':_0x26014f[_0xde5c('0x61')]['id']}})[_0xde5c('0x25')](handleEntityNotFound(_0x341c17,null))['then'](function(_0x2d5bd8){if(_0x2d5bd8){_0x1c2b70[_0xde5c('0xd8')]=_['keys'](db['ScreenRecording'][_0xde5c('0x44')]);_0x1c2b70[_0xde5c('0x4e')]=_['keys'](_0x26014f[_0xde5c('0x4e')]);_0x1c2b70['filters']=_[_0xde5c('0xdc')](_0x1c2b70[_0xde5c('0xd8')],_0x1c2b70['query']);_0x501d58[_0xde5c('0x52')]=_[_0xde5c('0xdc')](_0x1c2b70[_0xde5c('0xd8')],qs[_0xde5c('0xdd')](_0x26014f[_0xde5c('0x4e')][_0xde5c('0xdd')]));_0x501d58[_0xde5c('0x52')]=_0x501d58[_0xde5c('0x52')][_0xde5c('0x57')]?_0x501d58[_0xde5c('0x52')]:_0x1c2b70[_0xde5c('0xd8')];if(!_0x26014f[_0xde5c('0x4e')][_0xde5c('0xe3')](_0xde5c('0xe4'))){_0x501d58['limit']=qs[_0xde5c('0x20')](_0x26014f[_0xde5c('0x4e')][_0xde5c('0x20')]);_0x501d58[_0xde5c('0x1e')]=qs['offset'](_0x26014f[_0xde5c('0x4e')][_0xde5c('0x1e')]);}_0x501d58[_0xde5c('0xde')]=qs['sort'](_0x26014f[_0xde5c('0x4e')][_0xde5c('0xdf')]);_0x501d58['where']=qs['filters'](_[_0xde5c('0xe1')](_0x26014f['query'],_0x1c2b70[_0xde5c('0xdb')]));_0x501d58['where']['UserId']=_0x2d5bd8['id'];if(_0x26014f['query'][_0xde5c('0x46')]){_0x501d58['where']=_['merge'](_0x501d58[_0xde5c('0xe0')],{'$or':_['map'](_0x501d58[_0xde5c('0x52')],function(_0x207ab1){var _0x42f0d4={};_0x42f0d4[_0x207ab1]={'$like':'%'+_0x26014f[_0xde5c('0x4e')]['filter']+'%'};return _0x42f0d4;})});}_0x501d58=_[_0xde5c('0x63')]({},_0x501d58,_0x26014f[_0xde5c('0x64')]);return db[_0xde5c('0xea')][_0xde5c('0x21')]({'where':_0x501d58['where']})[_0xde5c('0x25')](function(_0x5f5923){_0x516094[_0xde5c('0x21')]=_0x5f5923;if(_0x26014f[_0xde5c('0x4e')][_0xde5c('0x62')]){_0x501d58[_0xde5c('0x4d')]=[{'all':!![]}];}return db[_0xde5c('0xea')][_0xde5c('0x54')](_0x501d58);})[_0xde5c('0x25')](function(_0x1c82db){_0x516094[_0xde5c('0x55')]=_0x1c82db;return _0x516094;});}})[_0xde5c('0x25')](respondWithFilteredResult(_0x341c17,_0x501d58))[_0xde5c('0x30')](handleError(_0x341c17,null));};exports[_0xde5c('0xeb')]=function(_0x82783e,_0xaefcf2){var _0x506dd1={};var _0x301271={};var _0x34d3b2;var _0x51e262;return db[_0xde5c('0x43')][_0xde5c('0x9e')]({'where':{'id':_0x82783e[_0xde5c('0x61')]['id']}})[_0xde5c('0x25')](handleEntityNotFound(_0xaefcf2,null))[_0xde5c('0x25')](function(_0x61740d){if(_0x61740d){_0x34d3b2=_0x61740d;_0x301271[_0xde5c('0xd8')]=_[_0xde5c('0xd9')](db['ChatInteraction']['rawAttributes']);_0x301271['query']=_[_0xde5c('0xd9')](_0x82783e['query']);_0x301271['filters']=_[_0xde5c('0xdc')](_0x301271[_0xde5c('0xd8')],_0x301271[_0xde5c('0x4e')]);_0x506dd1[_0xde5c('0x52')]=_[_0xde5c('0xdc')](_0x301271['model'],qs[_0xde5c('0xdd')](_0x82783e[_0xde5c('0x4e')][_0xde5c('0xdd')]));_0x506dd1[_0xde5c('0x52')]=_0x506dd1[_0xde5c('0x52')][_0xde5c('0x57')]?_0x506dd1['attributes']:_0x301271[_0xde5c('0xd8')];_0x506dd1['order']=qs['sort'](_0x82783e[_0xde5c('0x4e')][_0xde5c('0xdf')]);_0x506dd1[_0xde5c('0xe0')]=qs[_0xde5c('0xdb')](_[_0xde5c('0xe1')](_0x82783e[_0xde5c('0x4e')],_0x301271['filters']));if(_0x82783e['query'][_0xde5c('0x46')]){_0x506dd1[_0xde5c('0xe0')]=_[_0xde5c('0x63')](_0x506dd1[_0xde5c('0xe0')],{'$or':_[_0xde5c('0xb1')](_0x506dd1[_0xde5c('0x52')],function(_0x18f477){var _0x46fc09={};_0x46fc09[_0x18f477]={'$like':'%'+_0x82783e['query'][_0xde5c('0x46')]+'%'};return _0x46fc09;})});}_0x506dd1=_[_0xde5c('0x63')]({},_0x506dd1,_0x82783e[_0xde5c('0x64')]);return _0x34d3b2[_0xde5c('0xeb')](_0x506dd1);}})[_0xde5c('0x25')](function(_0x4f9bb9){if(_0x4f9bb9){_0x51e262=_0x4f9bb9['length'];if(!_0x82783e[_0xde5c('0x4e')][_0xde5c('0xe3')](_0xde5c('0xe4'))){_0x506dd1[_0xde5c('0x20')]=qs['limit'](_0x82783e[_0xde5c('0x4e')][_0xde5c('0x20')]);_0x506dd1[_0xde5c('0x1e')]=qs[_0xde5c('0x1e')](_0x82783e[_0xde5c('0x4e')][_0xde5c('0x1e')]);}return _0x34d3b2[_0xde5c('0xeb')](_0x506dd1);}})[_0xde5c('0x25')](function(_0x3995b7){if(_0x3995b7){return _0x3995b7?{'count':_0x51e262,'rows':_0x3995b7}:null;}})[_0xde5c('0x25')](respondWithResult(_0xaefcf2,null))[_0xde5c('0x30')](handleError(_0xaefcf2,null));};exports['getOpenchannelInteractions']=function(_0x42e890,_0x38c723){var _0x9cf7c1={};var _0x41dbf3={};var _0x34bb8d;var _0x52581e;return db[_0xde5c('0x43')][_0xde5c('0x9e')]({'where':{'id':_0x42e890[_0xde5c('0x61')]['id']}})[_0xde5c('0x25')](handleEntityNotFound(_0x38c723,null))[_0xde5c('0x25')](function(_0x83b147){if(_0x83b147){_0x34bb8d=_0x83b147;_0x41dbf3[_0xde5c('0xd8')]=_[_0xde5c('0xd9')](db['OpenchannelInteraction']['rawAttributes']);_0x41dbf3[_0xde5c('0x4e')]=_['keys'](_0x42e890[_0xde5c('0x4e')]);_0x41dbf3[_0xde5c('0xdb')]=_[_0xde5c('0xdc')](_0x41dbf3[_0xde5c('0xd8')],_0x41dbf3[_0xde5c('0x4e')]);_0x9cf7c1[_0xde5c('0x52')]=_[_0xde5c('0xdc')](_0x41dbf3[_0xde5c('0xd8')],qs['fields'](_0x42e890[_0xde5c('0x4e')][_0xde5c('0xdd')]));_0x9cf7c1['attributes']=_0x9cf7c1[_0xde5c('0x52')][_0xde5c('0x57')]?_0x9cf7c1[_0xde5c('0x52')]:_0x41dbf3[_0xde5c('0xd8')];_0x9cf7c1['order']=qs[_0xde5c('0xdf')](_0x42e890[_0xde5c('0x4e')][_0xde5c('0xdf')]);_0x9cf7c1['where']=qs[_0xde5c('0xdb')](_[_0xde5c('0xe1')](_0x42e890[_0xde5c('0x4e')],_0x41dbf3[_0xde5c('0xdb')]));if(_0x42e890[_0xde5c('0x4e')]['filter']){_0x9cf7c1['where']=_[_0xde5c('0x63')](_0x9cf7c1['where'],{'$or':_[_0xde5c('0xb1')](_0x9cf7c1[_0xde5c('0x52')],function(_0x193908){var _0x37c06f={};_0x37c06f[_0x193908]={'$like':'%'+_0x42e890[_0xde5c('0x4e')][_0xde5c('0x46')]+'%'};return _0x37c06f;})});}_0x9cf7c1=_['merge']({},_0x9cf7c1,_0x42e890[_0xde5c('0x64')]);return _0x34bb8d[_0xde5c('0xec')](_0x9cf7c1);}})[_0xde5c('0x25')](function(_0x5df30b){if(_0x5df30b){_0x52581e=_0x5df30b['length'];if(!_0x42e890[_0xde5c('0x4e')][_0xde5c('0xe3')](_0xde5c('0xe4'))){_0x9cf7c1['limit']=qs[_0xde5c('0x20')](_0x42e890[_0xde5c('0x4e')][_0xde5c('0x20')]);_0x9cf7c1['offset']=qs['offset'](_0x42e890[_0xde5c('0x4e')][_0xde5c('0x1e')]);}return _0x34bb8d[_0xde5c('0xec')](_0x9cf7c1);}})[_0xde5c('0x25')](function(_0x73265e){if(_0x73265e){return _0x73265e?{'count':_0x52581e,'rows':_0x73265e}:null;}})['then'](respondWithResult(_0x38c723,null))[_0xde5c('0x30')](handleError(_0x38c723,null));};exports[_0xde5c('0xed')]=function(_0xa92ca1,_0x403ece){var _0x296190={'raw':!![],'where':{}};var _0x1bf1dd={};var _0x3036ce={'count':0x0,'rows':[]};return db[_0xde5c('0x43')][_0xde5c('0x9e')]({'where':{'id':_0xa92ca1[_0xde5c('0x61')]['id']}})[_0xde5c('0x25')](handleEntityNotFound(_0x403ece,null))['then'](function(_0xceee53){if(_0xceee53){_0x1bf1dd[_0xde5c('0xd8')]=_[_0xde5c('0xd9')](db['MailInteraction'][_0xde5c('0x44')]);_0x1bf1dd[_0xde5c('0x4e')]=_[_0xde5c('0xd9')](_0xa92ca1[_0xde5c('0x4e')]);_0x1bf1dd[_0xde5c('0xdb')]=_[_0xde5c('0xdc')](_0x1bf1dd[_0xde5c('0xd8')],_0x1bf1dd[_0xde5c('0x4e')]);_0x296190[_0xde5c('0x52')]=_[_0xde5c('0xdc')](_0x1bf1dd[_0xde5c('0xd8')],qs[_0xde5c('0xdd')](_0xa92ca1[_0xde5c('0x4e')][_0xde5c('0xdd')]));_0x296190['attributes']=_0x296190[_0xde5c('0x52')][_0xde5c('0x57')]?_0x296190['attributes']:_0x1bf1dd[_0xde5c('0xd8')];if(!_0xa92ca1[_0xde5c('0x4e')][_0xde5c('0xe3')](_0xde5c('0xe4'))){_0x296190['limit']=qs[_0xde5c('0x20')](_0xa92ca1['query']['limit']);_0x296190[_0xde5c('0x1e')]=qs['offset'](_0xa92ca1[_0xde5c('0x4e')][_0xde5c('0x1e')]);}_0x296190['order']=qs['sort'](_0xa92ca1[_0xde5c('0x4e')]['sort']);_0x296190[_0xde5c('0xe0')]=qs['filters'](_[_0xde5c('0xe1')](_0xa92ca1[_0xde5c('0x4e')],_0x1bf1dd[_0xde5c('0xdb')]));_0x296190[_0xde5c('0xe0')][_0xde5c('0xe8')]=_0xceee53['id'];if(_0xa92ca1['query']['filter']){_0x296190['where']=_['merge'](_0x296190['where'],{'$or':_[_0xde5c('0xb1')](_0x296190[_0xde5c('0x52')],function(_0xb78da2){var _0x3ebce4={};_0x3ebce4[_0xb78da2]={'$like':'%'+_0xa92ca1['query']['filter']+'%'};return _0x3ebce4;})});}_0x296190=_[_0xde5c('0x63')]({},_0x296190,_0xa92ca1['options']);return db[_0xde5c('0xee')]['count']({'where':_0x296190[_0xde5c('0xe0')]})['then'](function(_0x296ab1){_0x3036ce[_0xde5c('0x21')]=_0x296ab1;if(_0xa92ca1[_0xde5c('0x4e')]['includeAll']){_0x296190[_0xde5c('0x4d')]=[{'all':!![]}];}return db[_0xde5c('0xee')]['findAll'](_0x296190);})['then'](function(_0x30f0c9){_0x3036ce[_0xde5c('0x55')]=_0x30f0c9;return _0x3036ce;});}})[_0xde5c('0x25')](respondWithFilteredResult(_0x403ece,_0x296190))[_0xde5c('0x30')](handleError(_0x403ece,null));};exports[_0xde5c('0xef')]=function(_0x1e4e15,_0x39c0df){var _0x3d9c32={};var _0x2cf89f={};var _0x50c1e4;var _0x17f52f;return db[_0xde5c('0x43')]['findOne']({'where':{'id':_0x1e4e15['params']['id']}})[_0xde5c('0x25')](handleEntityNotFound(_0x39c0df,null))['then'](function(_0x424a2c){if(_0x424a2c){_0x50c1e4=_0x424a2c;_0x2cf89f[_0xde5c('0xd8')]=_[_0xde5c('0xd9')](db['SmsInteraction']['rawAttributes']);_0x2cf89f[_0xde5c('0x4e')]=_[_0xde5c('0xd9')](_0x1e4e15[_0xde5c('0x4e')]);_0x2cf89f[_0xde5c('0xdb')]=_['intersection'](_0x2cf89f['model'],_0x2cf89f['query']);_0x3d9c32[_0xde5c('0x52')]=_['intersection'](_0x2cf89f[_0xde5c('0xd8')],qs[_0xde5c('0xdd')](_0x1e4e15[_0xde5c('0x4e')]['fields']));_0x3d9c32[_0xde5c('0x52')]=_0x3d9c32[_0xde5c('0x52')][_0xde5c('0x57')]?_0x3d9c32[_0xde5c('0x52')]:_0x2cf89f[_0xde5c('0xd8')];_0x3d9c32['order']=qs[_0xde5c('0xdf')](_0x1e4e15[_0xde5c('0x4e')][_0xde5c('0xdf')]);_0x3d9c32[_0xde5c('0xe0')]=qs[_0xde5c('0xdb')](_[_0xde5c('0xe1')](_0x1e4e15['query'],_0x2cf89f[_0xde5c('0xdb')]));if(_0x1e4e15[_0xde5c('0x4e')]['filter']){_0x3d9c32['where']=_['merge'](_0x3d9c32[_0xde5c('0xe0')],{'$or':_['map'](_0x3d9c32['attributes'],function(_0x391c7e){var _0x41960e={};_0x41960e[_0x391c7e]={'$like':'%'+_0x1e4e15[_0xde5c('0x4e')]['filter']+'%'};return _0x41960e;})});}_0x3d9c32=_['merge']({},_0x3d9c32,_0x1e4e15[_0xde5c('0x64')]);return _0x50c1e4[_0xde5c('0xef')](_0x3d9c32);}})['then'](function(_0x398051){if(_0x398051){_0x17f52f=_0x398051['length'];if(!_0x1e4e15[_0xde5c('0x4e')][_0xde5c('0xe3')](_0xde5c('0xe4'))){_0x3d9c32[_0xde5c('0x20')]=qs[_0xde5c('0x20')](_0x1e4e15[_0xde5c('0x4e')][_0xde5c('0x20')]);_0x3d9c32[_0xde5c('0x1e')]=qs['offset'](_0x1e4e15['query'][_0xde5c('0x1e')]);}return _0x50c1e4[_0xde5c('0xef')](_0x3d9c32);}})[_0xde5c('0x25')](function(_0x308d86){if(_0x308d86){return _0x308d86?{'count':_0x17f52f,'rows':_0x308d86}:null;}})[_0xde5c('0x25')](respondWithResult(_0x39c0df,null))[_0xde5c('0x30')](handleError(_0x39c0df,null));};exports[_0xde5c('0xf0')]=function(_0x59ae6e,_0xb103d7){var _0x39f9e0={};var _0x44f810={};var _0x3e55b8;var _0xb39739;return db[_0xde5c('0x43')][_0xde5c('0x9e')]({'where':{'id':_0x59ae6e['params']['id']}})[_0xde5c('0x25')](handleEntityNotFound(_0xb103d7,null))[_0xde5c('0x25')](function(_0x403c35){if(_0x403c35){_0x3e55b8=_0x403c35;_0x44f810[_0xde5c('0xd8')]=_[_0xde5c('0xd9')](db[_0xde5c('0xf1')]['rawAttributes']);_0x44f810['query']=_[_0xde5c('0xd9')](_0x59ae6e[_0xde5c('0x4e')]);_0x44f810[_0xde5c('0xdb')]=_['intersection'](_0x44f810[_0xde5c('0xd8')],_0x44f810['query']);_0x39f9e0['attributes']=_[_0xde5c('0xdc')](_0x44f810[_0xde5c('0xd8')],qs[_0xde5c('0xdd')](_0x59ae6e[_0xde5c('0x4e')][_0xde5c('0xdd')]));_0x39f9e0[_0xde5c('0x52')]=_0x39f9e0[_0xde5c('0x52')][_0xde5c('0x57')]?_0x39f9e0[_0xde5c('0x52')]:_0x44f810[_0xde5c('0xd8')];_0x39f9e0[_0xde5c('0xde')]=qs[_0xde5c('0xdf')](_0x59ae6e[_0xde5c('0x4e')][_0xde5c('0xdf')]);_0x39f9e0[_0xde5c('0xe0')]=qs[_0xde5c('0xdb')](_[_0xde5c('0xe1')](_0x59ae6e[_0xde5c('0x4e')],_0x44f810[_0xde5c('0xdb')]));if(_0x59ae6e[_0xde5c('0x4e')][_0xde5c('0x46')]){_0x39f9e0[_0xde5c('0xe0')]=_[_0xde5c('0x63')](_0x39f9e0['where'],{'$or':_[_0xde5c('0xb1')](_0x39f9e0[_0xde5c('0x52')],function(_0x8fc9c7){var _0x1a3e2a={};_0x1a3e2a[_0x8fc9c7]={'$like':'%'+_0x59ae6e[_0xde5c('0x4e')][_0xde5c('0x46')]+'%'};return _0x1a3e2a;})});}_0x39f9e0=_[_0xde5c('0x63')]({},_0x39f9e0,_0x59ae6e['options']);return _0x3e55b8[_0xde5c('0xf0')](_0x39f9e0);}})[_0xde5c('0x25')](function(_0x3466ea){if(_0x3466ea){_0xb39739=_0x3466ea['length'];if(!_0x59ae6e['query'][_0xde5c('0xe3')](_0xde5c('0xe4'))){_0x39f9e0[_0xde5c('0x20')]=qs[_0xde5c('0x20')](_0x59ae6e[_0xde5c('0x4e')]['limit']);_0x39f9e0[_0xde5c('0x1e')]=qs['offset'](_0x59ae6e['query'][_0xde5c('0x1e')]);}return _0x3e55b8[_0xde5c('0xf0')](_0x39f9e0);}})[_0xde5c('0x25')](function(_0x457e91){if(_0x457e91){return _0x457e91?{'count':_0xb39739,'rows':_0x457e91}:null;}})[_0xde5c('0x25')](respondWithResult(_0xb103d7,null))['catch'](handleError(_0xb103d7,null));};exports[_0xde5c('0xf2')]=function(_0x4d15dd,_0x2e8111){var _0x4b25e7={};var _0x29de0e={};var _0x4169d5;var _0x99e79c;return db[_0xde5c('0x43')][_0xde5c('0x9e')]({'where':{'id':_0x4d15dd[_0xde5c('0x61')]['id']}})[_0xde5c('0x25')](handleEntityNotFound(_0x2e8111,null))[_0xde5c('0x25')](function(_0x264cd4){if(_0x264cd4){_0x4169d5=_0x264cd4;_0x29de0e['model']=_[_0xde5c('0xd9')](db[_0xde5c('0xf3')]['rawAttributes']);_0x29de0e[_0xde5c('0x4e')]=_[_0xde5c('0xd9')](_0x4d15dd[_0xde5c('0x4e')]);_0x29de0e['filters']=_[_0xde5c('0xdc')](_0x29de0e[_0xde5c('0xd8')],_0x29de0e['query']);_0x4b25e7[_0xde5c('0x52')]=_[_0xde5c('0xdc')](_0x29de0e[_0xde5c('0xd8')],qs[_0xde5c('0xdd')](_0x4d15dd[_0xde5c('0x4e')]['fields']));_0x4b25e7['attributes']=_0x4b25e7[_0xde5c('0x52')][_0xde5c('0x57')]?_0x4b25e7[_0xde5c('0x52')]:_0x29de0e['model'];_0x4b25e7[_0xde5c('0xde')]=qs['sort'](_0x4d15dd['query']['sort']);_0x4b25e7[_0xde5c('0xe0')]=qs['filters'](_[_0xde5c('0xe1')](_0x4d15dd[_0xde5c('0x4e')],_0x29de0e['filters']));if(_0x4d15dd[_0xde5c('0x4e')]['filter']){_0x4b25e7[_0xde5c('0xe0')]=_['merge'](_0x4b25e7[_0xde5c('0xe0')],{'$or':_['map'](_0x4b25e7[_0xde5c('0x52')],function(_0x1aa39e){var _0x59d1d7={};_0x59d1d7[_0x1aa39e]={'$like':'%'+_0x4d15dd[_0xde5c('0x4e')][_0xde5c('0x46')]+'%'};return _0x59d1d7;})});}_0x4b25e7=_['merge']({},_0x4b25e7,_0x4d15dd['options']);return _0x4169d5[_0xde5c('0xf2')](_0x4b25e7);}})[_0xde5c('0x25')](function(_0x21e425){if(_0x21e425){_0x99e79c=_0x21e425[_0xde5c('0x57')];if(!_0x4d15dd[_0xde5c('0x4e')][_0xde5c('0xe3')](_0xde5c('0xe4'))){_0x4b25e7['limit']=qs[_0xde5c('0x20')](_0x4d15dd['query']['limit']);_0x4b25e7[_0xde5c('0x1e')]=qs[_0xde5c('0x1e')](_0x4d15dd[_0xde5c('0x4e')]['offset']);}return _0x4169d5[_0xde5c('0xf2')](_0x4b25e7);}})[_0xde5c('0x25')](function(_0x6b52b4){if(_0x6b52b4){return _0x6b52b4?{'count':_0x99e79c,'rows':_0x6b52b4}:null;}})[_0xde5c('0x25')](respondWithResult(_0x2e8111,null))[_0xde5c('0x30')](handleError(_0x2e8111,null));};exports[_0xde5c('0xf4')]=function(_0x3b21ba,_0x4d3447,_0x14f721){var _0x50c63e;var _0x880a62;var _0x8e8e6c;var _0x5cd3f1=!_['isNil'](_0x3b21ba[_0xde5c('0x61')]['id'])?_0x3b21ba[_0xde5c('0x61')]['id']:!_['isNil'](_0x3b21ba[_0xde5c('0x39')]['id'])?_0x3b21ba[_0xde5c('0x39')]['id']:null;return db[_0xde5c('0x43')][_0xde5c('0x40')]({'where':{'id':_0x5cd3f1,'role':{'$or':[_0xde5c('0x38'),_0xde5c('0x39'),'agent']}},'attributes':['id','name',_0xde5c('0xf5'),'mobile',_0xde5c('0x32'),_0xde5c('0x6a'),_0xde5c('0xa5')]})[_0xde5c('0x25')](function(_0x4f6c8a){if(_0x4f6c8a){if(_0x4f6c8a[_0xde5c('0x32')]===_0xde5c('0x33')){_0x50c63e=_0x4f6c8a;if(_0x3b21ba[_0xde5c('0x65')]['interface']){_0x8e8e6c=util[_0xde5c('0xb0')](_0xde5c('0xf6'),_0x50c63e[_0x3b21ba[_0xde5c('0x65')][_0xde5c('0xaf')]]);}else if(_0x3b21ba[_0xde5c('0x65')]['intrf']){_0x8e8e6c=util[_0xde5c('0xb0')](_0xde5c('0xf7'),_0x3b21ba['body'][_0xde5c('0xf8')]);}else{_0x8e8e6c=util[_0xde5c('0xb0')](_0xde5c('0xf7'),_0x50c63e[_0xde5c('0x41')]);}socket['to'](util['format']('user:%s',_0x50c63e['name']))[_0xde5c('0x34')]('user:forcelogout',{'user':{'id':_0x50c63e['id'],'name':_0x50c63e[_0xde5c('0x41')]},'ip':_0x3b21ba[_0xde5c('0xf9')]['x-forwarded-for']||_0x3b21ba[_0xde5c('0xfa')][_0xde5c('0xfb')]||_0x3b21ba['socket'][_0xde5c('0xfb')]||_0x3b21ba['connection'][_0xde5c('0xfc')][_0xde5c('0xfb')]});return new Promise(function(_0x1a53a8,_0x277979){db['sequelize']['transaction']()[_0xde5c('0x25')](_0x32172d=>{db[_0xde5c('0xb2')][_0xde5c('0x36')]({'where':{'membername':_0x50c63e[_0xde5c('0x41')]},'individualHooks':!![]},{'transaction':_0x32172d})[_0xde5c('0x25')](function(){return _0x32172d[_0xde5c('0xfd')]();})[_0xde5c('0x25')](_0x1a53a8)[_0xde5c('0x30')](_0x277979);});});}}else{throw new db[(_0xde5c('0x9b'))][(_0xde5c('0x9c'))](_0xde5c('0xfe'));}})['then'](function(){if(_0x50c63e){return _0x50c63e['getVoiceQueues']({'raw':!![]});}})['then'](function(_0x1c5684){if(_0x50c63e){if(_0x1c5684){_0x880a62=_0x1c5684;if(_0x880a62[_0xde5c('0x57')]){var _0x1921f4=_0x880a62['map'](function(_0x1f16fd){return{'membername':_0x50c63e[_0xde5c('0x41')],'UserId':_0x50c63e['id'],'queue_name':_0x1f16fd[_0xde5c('0x41')],'VoiceQueueId':_0x1f16fd['id'],'interface':_0x8e8e6c,'paused':_0x50c63e[_0xde5c('0xa5')]||![],'penalty':_0x1f16fd[_0xde5c('0xff')]||0x0};});return db[_0xde5c('0xb2')][_0xde5c('0x90')](_0x1921f4);}}}})[_0xde5c('0x25')](function(){if(_0x50c63e){return db[_0xde5c('0x100')][_0xde5c('0x54')]({'where':{'membername':_0x50c63e['name'],'exitAt':null}});}})[_0xde5c('0x25')](function(_0x3c1d7e){if(_0x50c63e){var _0x2f71d6=[];_0x3c1d7e[_0xde5c('0x101')](function(_0x51692d){_0x2f71d6[_0xde5c('0x53')](_0x51692d['update']({'exitAt':moment()['format'](_0xde5c('0x102'))}));});return Promise[_0xde5c('0x5f')](_0x2f71d6);}})[_0xde5c('0x25')](function(){if(_0x50c63e){var _0x1d7d8d=[];var _0xb76238=[];var _0x27a243=utils[_0xde5c('0x103')]();var _0x2fb69f={'membername':_0x50c63e[_0xde5c('0x41')],'interface':_0x8e8e6c,'enterAt':moment()[_0xde5c('0xb0')](_0xde5c('0x102')),'role':_0x50c63e['role'],'internal':_0x50c63e[_0xde5c('0x6a')]};_0x27a243[_0xde5c('0x101')](function(_0x10a360){_0x1d7d8d[_0xde5c('0x53')](_[_0xde5c('0x63')]({'channel':_0x10a360,'type':_0xde5c('0x104'),'data1':_0x3b21ba[_0xde5c('0x65')][_0xde5c('0x105')],'data2':_0x8e8e6c},_0x2fb69f));if(_0x50c63e['loginInPause']){_0xb76238[_0xde5c('0x53')](_[_0xde5c('0x63')]({'channel':_0x10a360,'type':'PAUSE','data1':_0xde5c('0x106')},_0x2fb69f));}});return db[_0xde5c('0x100')][_0xde5c('0x90')](_0x1d7d8d[_0xde5c('0xcf')](_0xb76238),{'individualHooks':!![]});}})[_0xde5c('0x25')](function(){if(_0x50c63e){return _0x50c63e[_0xde5c('0x31')]({'online':!![],'lastLoginAt':moment()[_0xde5c('0xb0')](_0xde5c('0x102')),'voicePause':_0x50c63e[_0xde5c('0xa5')]||![],'mailPause':_0x50c63e[_0xde5c('0xa5')]||![],'chatPause':_0x50c63e[_0xde5c('0xa5')]||![],'faxPause':_0x50c63e[_0xde5c('0xa5')]||![],'smsPause':_0x50c63e['loginInPause']||![],'openchannelPause':_0x50c63e[_0xde5c('0xa5')]||![],'whatsappPause':_0x50c63e[_0xde5c('0xa5')]||![],'pauseType':_0x50c63e[_0xde5c('0xa5')]?'LOGININPAUSE':null,'interface':_0x8e8e6c,'lastPauseAt':moment()[_0xde5c('0xb0')](_0xde5c('0x102'))});}})[_0xde5c('0x25')](function(_0x49b3d5){if(_0x3b21ba[_0xde5c('0x107')]){return _0x14f721();}else{return Promise[_0xde5c('0x108')](_0x49b3d5)[_0xde5c('0x25')](respondWithResult(_0x4d3447,null));}})['catch'](handleError(_0x4d3447,null));};exports[_0xde5c('0x109')]=function(_0x5a301c,_0xb211e1){var _0x27a351;return db[_0xde5c('0x43')][_0xde5c('0x40')]({'where':{'id':_0x5a301c[_0xde5c('0x61')]['id'],'role':_0xde5c('0x33')},'attributes':['id',_0xde5c('0x41'),_0xde5c('0x32')]})[_0xde5c('0x25')](handleEntityNotFound(_0xb211e1,null))[_0xde5c('0x25')](function(_0x3c77e1){if(_0x3c77e1){_0x27a351=_0x3c77e1;return db[_0xde5c('0xb2')][_0xde5c('0x36')]({'where':{'membername':_0x27a351['name']},'individualHooks':!![]});}})[_0xde5c('0x25')](function(){return db[_0xde5c('0x100')][_0xde5c('0x54')]({'where':{'membername':_0x27a351[_0xde5c('0x41')],'exitAt':null}});})[_0xde5c('0x25')](function(_0x4d5e80){var _0x3306d1=[];_0x4d5e80[_0xde5c('0x101')](function(_0x3d0ab9){_0x3306d1[_0xde5c('0x53')](_0x3d0ab9['update']({'exitAt':moment()['format'](_0xde5c('0x102'))}));});return Promise[_0xde5c('0x5f')](_0x3306d1);})[_0xde5c('0x25')](function(){return _0x27a351[_0xde5c('0x31')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})['then'](respondWithResult(_0xb211e1,null))[_0xde5c('0x30')](handleError(_0xb211e1,null));};exports[_0xde5c('0x10a')]=function(_0x1b2170,_0x2ec809){var _0x56f91c;return db[_0xde5c('0xb2')][_0xde5c('0x31')]({'paused':0x1},{'where':{'UserId':_0x1b2170[_0xde5c('0x61')]['id']},'individualHooks':!![]})[_0xde5c('0x25')](function(){return db[_0xde5c('0x43')][_0xde5c('0x40')]({'where':{'id':_0x1b2170[_0xde5c('0x61')]['id'],'role':'agent'},'attributes':['id','name',_0xde5c('0x32'),_0xde5c('0x6a'),'interface',_0xde5c('0xa4')]});})['then'](handleEntityNotFound(_0x2ec809,null))[_0xde5c('0x25')](function(_0x360598){if(_0x360598){_0x56f91c=_0x360598;return respondWithRpcPromise(_0xde5c('0x10b'),_0xde5c('0x10a'),{'id':_0x56f91c['id'],'name':_0x56f91c[_0xde5c('0x41')],'pause':!![]});}})[_0xde5c('0x25')](function(){if(_0x56f91c){return db[_0xde5c('0x100')][_0xde5c('0x54')]({'where':{'membername':_0x56f91c[_0xde5c('0x41')],'type':'PAUSE','exitAt':null}});}})[_0xde5c('0x25')](function(_0x2cb0c3){if(_0x2cb0c3[_0xde5c('0x57')]){var _0x5a9bef=moment()[_0xde5c('0xb0')](_0xde5c('0x102'));for(var _0x2f5984=0x0,_0x5da6fa=_0x2cb0c3['length'];_0x2f5984<_0x5da6fa;_0x2f5984++){_0x2cb0c3[_0x2f5984][_0xde5c('0x10c')]({'exitAt':_0x5a9bef});}}})['then'](function(){var _0x490d3a=[];var _0x480932=utils[_0xde5c('0x103')]();_0x480932[_0xde5c('0x101')](function(_0x543724){_0x490d3a[_0xde5c('0x53')]({'channel':_0x543724,'membername':_0x56f91c[_0xde5c('0x41')],'interface':_[_0xde5c('0x6f')](_0x56f91c['interface'])?util['format'](_0xde5c('0xf7'),_0x56f91c[_0xde5c('0x41')]):_0x56f91c['interface'],'type':_0xde5c('0x10d'),'enterAt':moment()[_0xde5c('0xb0')](_0xde5c('0x102')),'data1':_0x1b2170['body']['type']||_0xde5c('0x10e'),'role':_0x56f91c['role'],'internal':_0x56f91c[_0xde5c('0x6a')]});});return db[_0xde5c('0x100')][_0xde5c('0x90')](_0x490d3a,{'individualHooks':!![]});})[_0xde5c('0x25')](function(){return _0x56f91c[_0xde5c('0x31')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x1b2170['body']['type']||_0xde5c('0x10e'),'lastPauseAt':moment()[_0xde5c('0xb0')](_0xde5c('0x102'))});})[_0xde5c('0x25')](respondWithResult(_0x2ec809,null))[_0xde5c('0x30')](handleError(_0x2ec809,null));};exports['unpause']=function(_0x6079c0,_0x1ebf10){if(_0x6079c0[_0xde5c('0x65')]['channel']&&!utils[_0xde5c('0xd7')](_0x6079c0['body'][_0xde5c('0xa3')])){throw new APIBadRequestError(util[_0xde5c('0xb0')](_0xde5c('0x10f'),_0x6079c0[_0xde5c('0x65')][_0xde5c('0xa3')]));}return db[_0xde5c('0x43')][_0xde5c('0x40')]({'where':{'id':_0x6079c0[_0xde5c('0x61')]['id']},'attributes':['id',_0xde5c('0x41'),_0xde5c('0x32'),'internal',_0xde5c('0xaf'),'online',_0xde5c('0xa6'),'mailPause',_0xde5c('0x110'),_0xde5c('0x111'),_0xde5c('0x112'),_0xde5c('0x113'),_0xde5c('0x114'),_0xde5c('0x115'),_0xde5c('0x116')]})['then'](function(_0x2f18ce){if(!_0x2f18ce){throw new APINotFoundError(util[_0xde5c('0xb0')](_0xde5c('0xd1'),_0x6079c0[_0xde5c('0x61')]['id']));}return _0x2f18ce[_0xde5c('0x117')](_0x6079c0[_0xde5c('0x65')][_0xde5c('0xa3')]);})[_0xde5c('0x25')](respondWithResult(_0x1ebf10,null))[_0xde5c('0x30')](APIHandleError(_0x1ebf10));};exports[_0xde5c('0x118')]=function(_0xee71e8,_0x54cdae){var _0x1c6e1a={};var _0x2e360e={};var _0x584c03;var _0x5ad19a;return db[_0xde5c('0x43')][_0xde5c('0x9e')]({'where':{'id':_0xee71e8[_0xde5c('0x61')]['id']}})[_0xde5c('0x25')](handleEntityNotFound(_0x54cdae,null))[_0xde5c('0x25')](function(_0x22a5c2){if(_0x22a5c2){_0x584c03=_0x22a5c2;_0x2e360e[_0xde5c('0xd8')]=_[_0xde5c('0xd9')](db[_0xde5c('0x119')][_0xde5c('0x44')]);_0x2e360e[_0xde5c('0x4e')]=_[_0xde5c('0xd9')](_0xee71e8[_0xde5c('0x4e')]);_0x2e360e['filters']=_['intersection'](_0x2e360e['model'],_0x2e360e[_0xde5c('0x4e')]);_0x1c6e1a[_0xde5c('0x52')]=_[_0xde5c('0xdc')](_0x2e360e[_0xde5c('0xd8')],qs[_0xde5c('0xdd')](_0xee71e8[_0xde5c('0x4e')]['fields']));_0x1c6e1a[_0xde5c('0x52')]=_0x1c6e1a[_0xde5c('0x52')][_0xde5c('0x57')]?_0x1c6e1a[_0xde5c('0x52')]:_0x2e360e[_0xde5c('0xd8')];_0x1c6e1a[_0xde5c('0xde')]=qs[_0xde5c('0xdf')](_0xee71e8['query'][_0xde5c('0xdf')]);_0x1c6e1a['where']=qs[_0xde5c('0xdb')](_[_0xde5c('0xe1')](_0xee71e8[_0xde5c('0x4e')],_0x2e360e[_0xde5c('0xdb')]));if(_0xee71e8[_0xde5c('0x4e')][_0xde5c('0x46')]){_0x1c6e1a[_0xde5c('0xe0')]=_[_0xde5c('0x63')](_0x1c6e1a[_0xde5c('0xe0')],{'$or':_['map'](_0x1c6e1a[_0xde5c('0x52')],function(_0x4c5618){var _0x43ce27={};_0x43ce27[_0x4c5618]={'$like':'%'+_0xee71e8[_0xde5c('0x4e')][_0xde5c('0x46')]+'%'};return _0x43ce27;})});}_0x1c6e1a=_[_0xde5c('0x63')]({},_0x1c6e1a,_0xee71e8[_0xde5c('0x64')]);return _0x584c03[_0xde5c('0x118')](_0x1c6e1a);}})['then'](function(_0x479317){if(_0x479317){_0x5ad19a=_0x479317[_0xde5c('0x57')];if(!_0xee71e8[_0xde5c('0x4e')][_0xde5c('0xe3')](_0xde5c('0xe4'))){_0x1c6e1a[_0xde5c('0x20')]=qs[_0xde5c('0x20')](_0xee71e8[_0xde5c('0x4e')][_0xde5c('0x20')]);_0x1c6e1a[_0xde5c('0x1e')]=qs[_0xde5c('0x1e')](_0xee71e8['query'][_0xde5c('0x1e')]);}return _0x584c03[_0xde5c('0x118')](_0x1c6e1a);}})['then'](function(_0x141338){if(_0x141338){return _0x141338?{'count':_0x5ad19a,'rows':_0x141338}:null;}})['then'](respondWithResult(_0x54cdae,null))['catch'](handleError(_0x54cdae,null));};exports[_0xde5c('0x11a')]=function(_0x4b4fa6,_0x115359){var _0x143f40=_0x4b4fa6[_0xde5c('0x61')]['id'];var _0x41d5f2=_0x4b4fa6[_0xde5c('0x65')]?_0x4b4fa6[_0xde5c('0x65')][_0xde5c('0x68')]:null;var _0x1e8050=[];return Promise[_0xde5c('0x108')]()[_0xde5c('0x25')](function(){if(!_0x41d5f2)throw new APIBadRequestError(_0xde5c('0x11b'));})[_0xde5c('0x25')](function(){return db[_0xde5c('0x43')][_0xde5c('0x9e')]({'where':{'id':_0x143f40}});})[_0xde5c('0x25')](function(_0x66695){if(!_0x66695)throw new APINotFoundError(util[_0xde5c('0xb0')](_0xde5c('0xd1'),_0x4b4fa6[_0xde5c('0x61')]['id']));return db[_0xde5c('0x71')][_0xde5c('0x11c')](function(_0x206432){return _0x66695[_0xde5c('0x11a')](_0x41d5f2,{'transaction':_0x206432})[_0xde5c('0x25')](function(){return db['Team']['findAll']({'where':{'id':{'$in':_0x41d5f2}}});})[_0xde5c('0x25')](function(_0x312746){var _0x2ca95d=_['map'](_0x312746,function(_0x55929e){return _0x55929e['getAssociatedQueues']();});return Promise[_0xde5c('0x5f')](_0x2ca95d);})[_0xde5c('0x25')](function(_0x2d0627){_0x1e8050=_[_0xde5c('0x11d')](_0x2d0627);var _0x2ffa1b=_['map'](_0x1e8050,function(_0x5166ea){return _0x5166ea[_0xde5c('0x11e')](_0x66695['id'],{'transaction':_0x206432});});return Promise['all'](_0x2ffa1b);})[_0xde5c('0x25')](function(){if(!_0x66695[_0xde5c('0xa4')])return;var _0x257b0a=_[_0xde5c('0x46')](_0x1e8050,function(_0x3fe5e8){return _0x3fe5e8[_0xde5c('0x11f')](_0xde5c('0xa3'))===_0xde5c('0x120');});var _0x4410ba=_[_0xde5c('0xb1')](_0x257b0a,function(_0x232651){return db['UserVoiceQueueRt'][_0xde5c('0xb3')]({'membername':_0x66695[_0xde5c('0x41')],'UserId':_0x66695['id'],'queue_name':_0x232651[_0xde5c('0x41')],'VoiceQueueId':_0x232651['id'],'interface':_[_0xde5c('0x6f')](_0x66695['interface'])?util['format'](_0xde5c('0xf7'),_0x66695[_0xde5c('0x41')]):_0x66695[_0xde5c('0xaf')],'paused':_0x66695[_0xde5c('0xa6')]||![],'penalty':_0x66695['penalty']},{'transaction':_0x206432});});return Promise[_0xde5c('0x5f')](_0x4410ba);})[_0xde5c('0x25')](function(){return db[_0xde5c('0x121')][_0xde5c('0x54')]({'where':{'teamId':{'$in':_0x41d5f2}}});})['then'](function(_0x24bf8d){var _0x51e22c=_[_0xde5c('0xb1')](_0x24bf8d,function(_0x384df5){return db[_0xde5c('0x122')]['create']({'UserId':_0x66695['id'],'VoicePrefixId':_0x384df5[_0xde5c('0x123')]},{'transaction':_0x206432});});return Promise[_0xde5c('0x5f')](_0x51e22c);});});})[_0xde5c('0x25')](function(){for(var _0x4f5998=0x0;_0x4f5998<_0x1e8050['length'];_0x4f5998++){var _0x52a10e=_0x1e8050[_0x4f5998][_0xde5c('0x11f')]('channel');var _0x34b7d2=_0x52a10e+'QueueId';socket[_0xde5c('0x34')](_0xde5c('0x39')+_0x52a10e+'Queue:save',{'UserId':_0x143f40,['queueField']:_0x1e8050[_0x4f5998]['id']});}})[_0xde5c('0x25')](respondWithStatusCode(_0x115359,null))[_0xde5c('0x30')](APIHandleError(_0x115359));};exports[_0xde5c('0x124')]=function(_0x1a616e,_0x25fa2e){var _0x3cf9eb=_0x1a616e[_0xde5c('0x61')]['id'];var _0x5dd9cf=null;if(_0x1a616e[_0xde5c('0x4e')][_0xde5c('0x68')]){_0x5dd9cf=_['isArray'](_0x1a616e[_0xde5c('0x4e')][_0xde5c('0x68')])?_0x1a616e['query'][_0xde5c('0x68')]:[_0x1a616e[_0xde5c('0x4e')][_0xde5c('0x68')]];}var _0x55805b=[];return Promise[_0xde5c('0x108')]()[_0xde5c('0x25')](function(){if(!_0x5dd9cf)throw new APIBadRequestError(_0xde5c('0x125'));})[_0xde5c('0x25')](function(){return db[_0xde5c('0x43')][_0xde5c('0x9e')]({'where':{'id':_0x3cf9eb}});})['then'](function(_0x435d6f){if(!_0x435d6f)throw new APINotFoundError(util[_0xde5c('0xb0')]('User\x20with\x20id\x20%s\x20not\x20found',_0x1a616e[_0xde5c('0x61')]['id']));return db['sequelize'][_0xde5c('0x11c')](function(_0x49a8ce){return _0x435d6f['removeTeams'](_0x5dd9cf,{'transaction':_0x49a8ce})['then'](function(){return db[_0xde5c('0x119')]['findAll']({'where':{'id':{'$in':_0x5dd9cf}}});})['then'](function(_0x2d3d6a){var _0x8cc700=_['map'](_0x2d3d6a,function(_0xa265b8){return _0xa265b8[_0xde5c('0x126')]();});return Promise[_0xde5c('0x5f')](_0x8cc700);})[_0xde5c('0x25')](function(_0x700ac3){_0x55805b=_[_0xde5c('0x11d')](_0x700ac3);var _0x134094=_['map'](_0x55805b,function(_0x276cfd){return _0x276cfd['removeAgent'](_0x435d6f['id'],{'transaction':_0x49a8ce});});return Promise[_0xde5c('0x5f')](_0x134094);})[_0xde5c('0x25')](function(){if(!_0x435d6f[_0xde5c('0xa4')])return;var _0x244a17=_[_0xde5c('0x46')](_0x55805b,function(_0x390c6b){return _0x390c6b[_0xde5c('0x11f')]('channel')===_0xde5c('0x120');});var _0x54da83=_['map'](_0x244a17,function(_0x575a24){return db['UserVoiceQueueRt'][_0xde5c('0x36')]({'where':{'VoiceQueueId':_0x575a24['id'],'UserId':_0x435d6f['id']},'transaction':_0x49a8ce});});return Promise[_0xde5c('0x5f')](_0x54da83);})['then'](function(){return db[_0xde5c('0x121')][_0xde5c('0x54')]({'where':{'teamId':{'$in':_0x5dd9cf}}});})[_0xde5c('0x25')](function(_0x449326){var _0x5851b1=_['map'](_0x449326,function(_0x243382){return db[_0xde5c('0x122')]['destroy']({'where':{'UserId':_0x435d6f['id'],'VoicePrefixId':_0x243382['VoicePrefixId']}},{'transaction':_0x49a8ce});});return Promise[_0xde5c('0x5f')](_0x5851b1);});});})[_0xde5c('0x25')](function(){for(var _0x5e085b=0x0;_0x5e085b<_0x55805b[_0xde5c('0x57')];_0x5e085b++){var _0xf47cff=_0x55805b[_0x5e085b][_0xde5c('0x11f')](_0xde5c('0xa3'));var _0x473078=_0xf47cff+_0xde5c('0xac');socket[_0xde5c('0x34')]('user'+_0xf47cff+_0xde5c('0xb8'),{'UserId':_0x3cf9eb,['queueField']:_0x55805b[_0x5e085b]['id']});}})[_0xde5c('0x25')](respondWithStatusCode(_0x25fa2e,null))[_0xde5c('0x30')](APIHandleError(_0x25fa2e));};exports['getLists']=function(_0x18bac6,_0x2ab799){var _0x88626c={};var _0x13bb6a={};var _0x31c8f0;var _0x3bb193;return db[_0xde5c('0x43')][_0xde5c('0x9e')]({'where':{'id':_0x18bac6['params']['id']}})[_0xde5c('0x25')](handleEntityNotFound(_0x2ab799,null))[_0xde5c('0x25')](function(_0x3f94df){if(_0x3f94df){_0x31c8f0=_0x3f94df;_0x13bb6a[_0xde5c('0xd8')]=_[_0xde5c('0xd9')](db['CmList'][_0xde5c('0x44')]);_0x13bb6a[_0xde5c('0x4e')]=_[_0xde5c('0xd9')](_0x18bac6[_0xde5c('0x4e')]);_0x13bb6a['filters']=_['intersection'](_0x13bb6a[_0xde5c('0xd8')],_0x13bb6a[_0xde5c('0x4e')]);_0x88626c['attributes']=_['intersection'](_0x13bb6a[_0xde5c('0xd8')],qs[_0xde5c('0xdd')](_0x18bac6[_0xde5c('0x4e')][_0xde5c('0xdd')]));_0x88626c['attributes']=_0x88626c[_0xde5c('0x52')][_0xde5c('0x57')]?_0x88626c[_0xde5c('0x52')]:_0x13bb6a[_0xde5c('0xd8')];_0x88626c['order']=qs['sort'](_0x18bac6['query']['sort']);_0x88626c['where']=qs['filters'](_[_0xde5c('0xe1')](_0x18bac6[_0xde5c('0x4e')],_0x13bb6a[_0xde5c('0xdb')]));if(_0x18bac6['query']['filter']){_0x88626c[_0xde5c('0xe0')]=_[_0xde5c('0x63')](_0x88626c[_0xde5c('0xe0')],{'$or':_[_0xde5c('0xb1')](_0x88626c[_0xde5c('0x52')],function(_0x2f438b){var _0x108673={};_0x108673[_0x2f438b]={'$like':'%'+_0x18bac6[_0xde5c('0x4e')]['filter']+'%'};return _0x108673;})});}_0x88626c=_[_0xde5c('0x63')]({},_0x88626c,_0x18bac6['options']);return _0x31c8f0[_0xde5c('0x127')](_0x88626c);}})[_0xde5c('0x25')](function(_0x128abf){if(_0x128abf){_0x3bb193=_0x128abf[_0xde5c('0x57')];if(!_0x18bac6[_0xde5c('0x4e')][_0xde5c('0xe3')](_0xde5c('0xe4'))){_0x88626c[_0xde5c('0x20')]=qs[_0xde5c('0x20')](_0x18bac6['query'][_0xde5c('0x20')]);_0x88626c[_0xde5c('0x1e')]=qs[_0xde5c('0x1e')](_0x18bac6['query']['offset']);}return _0x31c8f0[_0xde5c('0x127')](_0x88626c);}})[_0xde5c('0x25')](function(_0x456a65){if(_0x456a65){return _0x456a65?{'count':_0x3bb193,'rows':_0x456a65}:null;}})[_0xde5c('0x25')](respondWithResult(_0x2ab799,null))[_0xde5c('0x30')](handleError(_0x2ab799,null));};exports[_0xde5c('0x128')]=function(_0x3c833d,_0xf29aac){var _0x53c949={};var _0x3db338={};var _0x4d8734;return db['User'][_0xde5c('0x9e')]({'where':{'id':_0x3c833d[_0xde5c('0x61')]['id']}})['then'](handleEntityNotFound(_0xf29aac,null))[_0xde5c('0x25')](function(_0x34bd62){if(_0x34bd62){_0x4d8734=_0x34bd62;_0x3db338[_0xde5c('0xd8')]=_[_0xde5c('0xd9')](db['User'][_0xde5c('0x44')]);_0x3db338[_0xde5c('0x4e')]=_[_0xde5c('0xd9')](_0x3c833d[_0xde5c('0x4e')]);_0x3db338['filters']=_[_0xde5c('0xdc')](_0x3db338[_0xde5c('0xd8')],_0x3db338[_0xde5c('0x4e')]);_0x53c949[_0xde5c('0x52')]=_['intersection'](_0x3db338[_0xde5c('0xd8')],qs[_0xde5c('0xdd')](_0x3c833d[_0xde5c('0x4e')]['fields']));_0x53c949['attributes']=_0x53c949['attributes']['length']?_0x53c949[_0xde5c('0x52')]:_0x3db338['model'];_0x53c949[_0xde5c('0xde')]=qs[_0xde5c('0xdf')](_0x3c833d[_0xde5c('0x4e')][_0xde5c('0xdf')]);_0x53c949['where']=qs[_0xde5c('0xdb')](_[_0xde5c('0xe1')](_0x3c833d[_0xde5c('0x4e')],_0x3db338[_0xde5c('0xdb')]));if(_0x3c833d[_0xde5c('0x4e')][_0xde5c('0x46')]){_0x53c949[_0xde5c('0xe0')]=_[_0xde5c('0x63')](_0x53c949['where'],{'$or':_[_0xde5c('0xb1')](_0x53c949[_0xde5c('0x52')],function(_0x4f5acf){var _0x2e70f0={};_0x2e70f0[_0x4f5acf]={'$like':'%'+_0x3c833d[_0xde5c('0x4e')][_0xde5c('0x46')]+'%'};return _0x2e70f0;})});}_0x53c949[_0xde5c('0xd8')]=db['User'];_0x53c949['as']=_0xde5c('0x3a');_0x53c949=_[_0xde5c('0x63')]({},_0x53c949,_0x3c833d[_0xde5c('0x64')]);return _0x4d8734[_0xde5c('0x129')]({'include':[_0x53c949]});}})[_0xde5c('0x25')](function(_0x28cd86){if(_0x28cd86){var _0x128e42={},_0x3e8bb2=[];for(var _0x6c152e=0x0;_0x6c152e<_0x28cd86[_0xde5c('0x57')];_0x6c152e+=0x1){for(var _0xd2e6e4=0x0,_0x68f4f0;_0xd2e6e4<_0x28cd86[_0x6c152e][_0xde5c('0x3a')][_0xde5c('0x57')];_0xd2e6e4+=0x1){_0x68f4f0=_0x28cd86[_0x6c152e][_0xde5c('0x3a')][_0xd2e6e4][_0xde5c('0x37')]({'plain':!![]});_0x128e42[_0x68f4f0['id']]=_0x68f4f0;}}_0x128e42=_['values'](_0x128e42);for(var _0x2aab34=qs[_0xde5c('0x1e')](_0x3c833d['query'][_0xde5c('0x1e')]);_0x2aab34<_0x128e42[_0xde5c('0x57')]&&_0x3e8bb2['length']=_0x3309e3){_0x1f6497=_0x3309e3;_0x3f666a=0xc8;}else{_0x3f666a=0xce;}_0x51a35f[_0xd1ce('0x19')](_0x3f666a);return _0x51a35f['set']('Content-Range',_0x39ccda+'-'+_0x1f6497+'/'+_0x3309e3)[_0xd1ce('0x1a')](_0x3964cc);}return null;};}function respondWithRpcPromise(_0x27b554,_0xb27dfb,_0x8c17e8,_0x5aaf16){return new Promise(function(_0x526401,_0x3ded28){var _0x37db24=_0x5aaf16||amiClient;return _0x37db24[_0xd1ce('0x1f')](_0x27b554,_0x8c17e8)['then'](function(_0x3bc6fa){logger['info'](_0xd1ce('0x20'),_0xb27dfb,_0xd1ce('0x21'));logger[_0xd1ce('0x22')](_0xd1ce('0x23'),_0xb27dfb,_0xd1ce('0x21'),JSON['stringify'](_0x3bc6fa));if(_0x3bc6fa[_0xd1ce('0x24')]){if(_0x3bc6fa[_0xd1ce('0x24')][_0xd1ce('0x25')]===0x1f4){logger[_0xd1ce('0x24')]('User,\x20%s,\x20%s',_0xb27dfb,_0x3bc6fa[_0xd1ce('0x24')][_0xd1ce('0x26')]);return _0x3ded28(_0x3bc6fa[_0xd1ce('0x24')]['message']);}logger[_0xd1ce('0x24')](_0xd1ce('0x20'),_0xb27dfb,_0x3bc6fa[_0xd1ce('0x24')][_0xd1ce('0x26')]);return _0x526401(_0x3bc6fa[_0xd1ce('0x24')][_0xd1ce('0x26')]);}else{logger[_0xd1ce('0x27')](_0xd1ce('0x20'),_0xb27dfb,'request\x20sent');_0x526401(_0x3bc6fa[_0xd1ce('0x28')][_0xd1ce('0x26')]);}})[_0xd1ce('0x29')](function(_0x9241e5){logger[_0xd1ce('0x24')](_0xd1ce('0x20'),_0xb27dfb,_0x9241e5);_0x3ded28(_0x9241e5);});});}function saveUpdates(_0x1a7eda){return function(_0x50067d){if(_0x50067d){return _0x50067d[_0xd1ce('0x2a')](_0x1a7eda)[_0xd1ce('0x2b')](function(_0x123204){if(_0x123204[_0xd1ce('0x2c')]===_0xd1ce('0x2d')){socket[_0xd1ce('0x2e')](_0xd1ce('0x2f')+_0x123204['id'],_0x123204);}return _0x123204;});}return null;};}function removeEntity(_0x596955,_0x2079e3){return function(_0x22115c){if(_0x22115c){return _0x22115c[_0xd1ce('0x30')]({'transaction':_0x2079e3})[_0xd1ce('0x2b')](function(){var _0x1a68ff=_0x22115c[_0xd1ce('0x31')]({'plain':!![]});if(_0x1a68ff[_0xd1ce('0x2c')]===_0xd1ce('0x32'))return;var _0x3d9014=[{'name':_0xd1ce('0x33'),'value':_0xd1ce('0x34'),'ignore':!![]},{'name':_0xd1ce('0x35'),'value':_0xd1ce('0x2d'),'ignore':![]},{'name':'Telephones','value':_0xd1ce('0x36'),'ignore':![]}];var _0x45c1f7=_(_0x3d9014)[_0xd1ce('0x37')]('ignore')[_0xd1ce('0x38')](_0xd1ce('0x39'))[_0xd1ce('0x39')]();if(_[_0xd1ce('0x3a')](_0x45c1f7,_0x1a68ff[_0xd1ce('0x2c')])){return;}var _0x1ab5ee=_[_0xd1ce('0x3b')](_0x3d9014,[_0xd1ce('0x39'),_0x1a68ff[_0xd1ce('0x2c')]])[_0xd1ce('0x3c')];return db[_0xd1ce('0x3d')][_0xd1ce('0x30')]({'where':{'type':_0x1ab5ee,'resourceId':_0x1a68ff['id']},'transaction':_0x2079e3})['then'](function(){return _0x22115c;});})[_0xd1ce('0x2b')](function(){_0x596955['status'](0xcc)[_0xd1ce('0x3e')]();});}};}function handleEntityNotFound(_0xb01dab){return function(_0x28d332){if(!_0x28d332){_0xb01dab[_0xd1ce('0x18')](0x194);}return _0x28d332;};}function handleError(_0x224117,_0x46bda8){_0x46bda8=_0x46bda8||0x1f4;return function(_0x3a6491){logger[_0xd1ce('0x24')](_0x3a6491[_0xd1ce('0x3f')]);if(_0x3a6491[_0xd1ce('0x3c')]){delete _0x3a6491['name'];}_0x224117['status'](_0x46bda8)['send'](_0x3a6491);};}function getUserAttributes(){return _(db[_0xd1ce('0x40')]['rawAttributes'])[_0xd1ce('0x38')](function(_0x18fc98){return{'name':_0x18fc98[_0xd1ce('0x41')],'type':_0x18fc98[_0xd1ce('0x42')][_0xd1ce('0x43')]};})['filter'](function(_0xa6dea5){return!['password',_0xd1ce('0x44'),_0xd1ce('0x45'),_0xd1ce('0x46'),'resetPasswordExpires',_0xd1ce('0x47')]['includes'](_0xa6dea5[_0xd1ce('0x3c')]);})[_0xd1ce('0x39')]();}exports[_0xd1ce('0x48')]=function(_0x202652,_0x45c525){var _0x3cd1a4={},_0x5be2cf={'count':0x0,'rows':[]};var _0x28e2e7=getUserAttributes();_0x3cd1a4=qs[_0xd1ce('0x49')](_0x28e2e7,_0x202652);var _0x120f74={'where':_0x3cd1a4[_0xd1ce('0x4a')]};return db[_0xd1ce('0x40')]['count'](_0x120f74)['then'](function(_0x2fa131){_0x5be2cf[_0xd1ce('0x1e')]=_0x2fa131;if(_0x202652[_0xd1ce('0x4b')][_0xd1ce('0x4c')]){_0x3cd1a4[_0xd1ce('0x4d')]=[{'all':!![]}];}if(_0x202652[_0xd1ce('0x4b')]['userSetting']===_0xd1ce('0x4e')){_0x3cd1a4[_0xd1ce('0x4d')]=[{'model':db[_0xd1ce('0x4f')],'as':'userSetting'}];}if(!_[_0xd1ce('0x3a')](_0x3cd1a4[_0xd1ce('0x50')],'id')){_0x3cd1a4['attributes']['push']('id');}return db['User'][_0xd1ce('0x51')](_0x3cd1a4);})['then'](function(_0x4ebe73){_0x5be2cf[_0xd1ce('0x52')]=_0x4ebe73;if(_0x202652[_0xd1ce('0x4b')][_0xd1ce('0x53')]==='true'){var _0x5d0738=[];for(var _0x57050d=0x0;_0x57050d<_0x5be2cf[_0xd1ce('0x52')][_0xd1ce('0x54')];_0x57050d++){_0x5d0738[_0xd1ce('0x55')](get_open_tabs(_0xd1ce('0x56'),_0x5be2cf[_0xd1ce('0x52')][_0x57050d][_0xd1ce('0x57')]));_0x5d0738['push'](get_open_tabs('sms',_0x5be2cf['rows'][_0x57050d][_0xd1ce('0x57')]));_0x5d0738['push'](get_open_tabs(_0xd1ce('0x58'),_0x5be2cf[_0xd1ce('0x52')][_0x57050d][_0xd1ce('0x57')]));_0x5d0738[_0xd1ce('0x55')](get_open_tabs('mail',_0x5be2cf[_0xd1ce('0x52')][_0x57050d][_0xd1ce('0x57')]));_0x5d0738['push'](get_open_tabs('openchannel',_0x5be2cf['rows'][_0x57050d][_0xd1ce('0x57')]));_0x5d0738[_0xd1ce('0x55')](get_open_tabs(_0xd1ce('0x59'),_0x5be2cf[_0xd1ce('0x52')][_0x57050d][_0xd1ce('0x57')]));}return Promise[_0xd1ce('0x5a')](_0x5d0738)[_0xd1ce('0x2b')](function(){return _0x5be2cf;});}else{return _0x5be2cf;}})[_0xd1ce('0x2b')](respondWithFilteredResult(_0x45c525,_0x3cd1a4))[_0xd1ce('0x29')](handleError(_0x45c525,null));};exports[_0xd1ce('0x5b')]=function(_0x1bca26,_0x2ba88b){var _0x4f6c5f=getUserAttributes();_0x1bca26['query']['id']=_0x1bca26['params']['id'];var _0x136a9e=qs[_0xd1ce('0x49')](_0x4f6c5f,_0x1bca26);if(_0x1bca26[_0xd1ce('0x4b')][_0xd1ce('0x4c')]){_0x136a9e[_0xd1ce('0x4d')]=[{'all':!![]}];}if(_0x1bca26[_0xd1ce('0x4b')][_0xd1ce('0x5c')]===_0xd1ce('0x4e')){_0x136a9e[_0xd1ce('0x4d')]=[{'model':db[_0xd1ce('0x4f')],'as':_0xd1ce('0x5c')}];}_0x136a9e=_['merge']({},_0x136a9e,_0x1bca26[_0xd1ce('0x5d')]);if(!_['includes'](_0x136a9e[_0xd1ce('0x50')],'id')){_0x136a9e[_0xd1ce('0x50')][_0xd1ce('0x55')]('id');}return db[_0xd1ce('0x40')][_0xd1ce('0x3b')](_0x136a9e)[_0xd1ce('0x2b')](handleEntityNotFound(_0x2ba88b,null))[_0xd1ce('0x2b')](function(_0x71bc3a){var _0x52eb62=[];values=_0x71bc3a;if(_0x1bca26[_0xd1ce('0x4b')][_0xd1ce('0x53')]===_0xd1ce('0x4e')){_0x52eb62['push'](get_open_tabs(_0xd1ce('0x56'),_0x71bc3a[_0xd1ce('0x57')]));_0x52eb62[_0xd1ce('0x55')](get_open_tabs('sms',_0x71bc3a['dataValues']));_0x52eb62[_0xd1ce('0x55')](get_open_tabs(_0xd1ce('0x5e'),_0x71bc3a[_0xd1ce('0x57')]));_0x52eb62[_0xd1ce('0x55')](get_open_tabs(_0xd1ce('0x59'),_0x71bc3a['dataValues']));_0x52eb62[_0xd1ce('0x55')](get_open_tabs(_0xd1ce('0x58'),_0x71bc3a[_0xd1ce('0x57')]));_0x52eb62[_0xd1ce('0x55')](get_open_tabs('mail',_0x71bc3a[_0xd1ce('0x57')]));return Promise['all'](_0x52eb62);}else{return values;}})[_0xd1ce('0x2b')](function(){return values;})[_0xd1ce('0x2b')](respondWithResult(_0x2ba88b,null))[_0xd1ce('0x29')](handleError(_0x2ba88b,null));};exports['update']=function(_0x1bb6e5,_0x957bff){if(_0x1bb6e5[_0xd1ce('0x5f')]['id']){delete _0x1bb6e5[_0xd1ce('0x5f')]['id'];}delete _0x1bb6e5[_0xd1ce('0x5f')][_0xd1ce('0x2c')];return db[_0xd1ce('0x40')][_0xd1ce('0x3b')]({'where':{'id':_0x1bb6e5[_0xd1ce('0x60')]['id']}})['then'](handleEntityNotFound(_0x957bff,null))['then'](saveUpdates(_0x1bb6e5[_0xd1ce('0x5f')],null))[_0xd1ce('0x2b')](respondWithResult(_0x957bff,null))[_0xd1ce('0x29')](handleError(_0x957bff,null));};exports[_0xd1ce('0x61')]=function(_0x5cfa8c,_0x5cff51){return db[_0xd1ce('0x40')][_0xd1ce('0x61')]()[_0xd1ce('0x2b')](respondWithResult(_0x5cff51,null))['catch'](handleError(_0x5cff51,null));};exports[_0xd1ce('0x62')]=function(_0x53f92a,_0x574b35){return db[_0xd1ce('0x40')]['find']({'where':{'id':_0x53f92a[_0xd1ce('0x60')]['id']}})[_0xd1ce('0x2b')](handleEntityNotFound(_0x574b35,null))[_0xd1ce('0x2b')](function(_0x537652){if(_0x537652){return _0x537652[_0xd1ce('0x62')](_0x53f92a[_0xd1ce('0x5f')][_0xd1ce('0x63')],_[_0xd1ce('0x64')](_0x53f92a['body'],[_0xd1ce('0x63'),'id'])||{});}})['then'](respondWithResult(_0x574b35,null))[_0xd1ce('0x29')](handleError(_0x574b35,null));};function validateUser(_0x411bba){return new Promise(function(_0x2558c2,_0x5d68f9){if(_0x411bba[_0xd1ce('0x65')])return _0x2558c2(_0x411bba);return db[_0xd1ce('0x66')][_0xd1ce('0x67')](0x1)['then'](function(_0x119d8e){if(_0x119d8e['securePassword'])authService[_0xd1ce('0x68')](_0x411bba['password']);db[_0xd1ce('0x40')][_0xd1ce('0x69')]('internal')[_0xd1ce('0x2b')](function(_0x35684b){if(_[_0xd1ce('0x6a')](_0x35684b)){_0x411bba[_0xd1ce('0x65')]=_0x119d8e[_0xd1ce('0x6b')]||0x1;return;}if(_[_0xd1ce('0x6a')](_0x119d8e['min_internal'])||_0x119d8e[_0xd1ce('0x6b')]===_0x35684b){_0x411bba[_0xd1ce('0x65')]=_0x35684b+0x1;return;}if(_0x119d8e['min_internal']>_0x35684b){_0x411bba['internal']=_0x119d8e[_0xd1ce('0x6b')];return;}return db[_0xd1ce('0x6c')][_0xd1ce('0x4b')](_0xd1ce('0x6d'),{'type':db[_0xd1ce('0x6c')][_0xd1ce('0x6e')]['SELECT']})[_0xd1ce('0x2b')](function(_0x109d9a){if(_0x109d9a&&_0x109d9a[_0xd1ce('0x54')]){for(var _0x438638=0x0,_0xb86303=_0x109d9a['length'];_0x438638<_0xb86303&&_[_0xd1ce('0x6a')](_0x411bba[_0xd1ce('0x65')]);_0x438638++){if(_0x119d8e[_0xd1ce('0x6b')]<=_0x109d9a[_0x438638]['from']){_0x411bba['internal']=_0x109d9a[_0x438638][_0xd1ce('0x6f')];}else if(_0x119d8e['min_internal']>_0x109d9a[_0x438638][_0xd1ce('0x6f')]&&_0x119d8e[_0xd1ce('0x6b')]<=_0x109d9a[_0x438638]['to']){_0x411bba[_0xd1ce('0x65')]=_0x119d8e['min_internal'];}}}if(_[_0xd1ce('0x6a')](_0x411bba[_0xd1ce('0x65')])){_0x411bba[_0xd1ce('0x65')]=_0x35684b+0x1;}return _0x2558c2(_0x411bba);});});})[_0xd1ce('0x29')](function(_0x43520c){_0x5d68f9(_0x43520c);});});}function updateUser(_0x2e0aee){return new Promise(function(_0x35f041,_0x406559){try{if(_0x2e0aee[_0xd1ce('0x70')]){_0x2e0aee['mailbox']=_0x2e0aee[_0xd1ce('0x65')];_0x2e0aee[_0xd1ce('0x71')]={'mailbox':_0x2e0aee[_0xd1ce('0x65')],'password':_0x2e0aee[_0xd1ce('0x72')],'fullname':_0x2e0aee[_0xd1ce('0x73')],'email':_0x2e0aee[_0xd1ce('0x74')]};}if(_0x2e0aee[_0xd1ce('0x2c')]==='agent'){if(!_0x2e0aee['permissions'])_0x2e0aee[_0xd1ce('0x75')]=[_0xd1ce('0x76'),_0xd1ce('0x77'),'103','113','110',_0xd1ce('0x78'),'105',_0xd1ce('0x79'),'107',_0xd1ce('0x7a'),_0xd1ce('0x7b'),_0xd1ce('0x7c'),_0xd1ce('0x7d'),_0xd1ce('0x7e'),'115'];}_0x35f041(_0x2e0aee);}catch(_0x1c2d20){_0x406559(_0x1c2d20);}});}exports[_0xd1ce('0x7f')]=function(_0x285430,_0x30c741){if(_0x285430[_0xd1ce('0x34')][_0xd1ce('0x2c')]==='agent')throw new Error(_0xd1ce('0x80'));if(_0x285430['body']['role']===_0xd1ce('0x34')&&_0x285430['user'][_0xd1ce('0x2c')]!==_0xd1ce('0x32')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_0x285430[_0xd1ce('0x5f')][_0xd1ce('0x2c')]===_0xd1ce('0x32')&&_0x285430[_0xd1ce('0x34')][_0xd1ce('0x2c')]!==_0xd1ce('0x32')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator');}return licenseUtil[_0xd1ce('0x81')]([_0x285430[_0xd1ce('0x5f')]])[_0xd1ce('0x2b')](function(){return validateUser(_0x285430['body']);})[_0xd1ce('0x2b')](function(_0x3429bb){return updateUser(_0x3429bb)['then'](function(_0x4708cd){if(_0x4708cd[_0xd1ce('0x2c')]===_0xd1ce('0x32')){_0x4708cd['settingsEnabled']=_0x285430[_0xd1ce('0x34')][_0xd1ce('0x82')];delete _0x4708cd[_0xd1ce('0x83')];}return _0x4708cd;});})[_0xd1ce('0x2b')](function(_0x5013f8){return db['User'][_0xd1ce('0x7f')](_0x5013f8,{'include':[{'model':db[_0xd1ce('0x71')],'as':_0xd1ce('0x71')}]});})[_0xd1ce('0x2b')](function(_0x2489fc){if(_0x285430[_0xd1ce('0x5f')]['role']===_0xd1ce('0x34'))return _0x2489fc;if(_0x285430[_0xd1ce('0x34')][_0xd1ce('0x2c')]!==_0xd1ce('0x34'))return _0x2489fc;return db['UserProfileSection'][_0xd1ce('0x3b')]({'where':{'name':_0x2489fc[_0xd1ce('0x2c')]===_0xd1ce('0x2d')?_0xd1ce('0x35'):_0xd1ce('0x84'),'userProfileId':_0x285430[_0xd1ce('0x34')]['userProfileId']},'raw':!![]})[_0xd1ce('0x2b')](function(_0x922df6){if(!_0x922df6||_0x922df6[_0xd1ce('0x85')]!=0x0)return _0x2489fc;return db[_0xd1ce('0x3d')]['create']({'name':_0x2489fc[_0xd1ce('0x3c')],'resourceId':_0x2489fc['id'],'type':_0x922df6[_0xd1ce('0x3c')],'sectionId':_0x922df6['id']},{})['then'](function(){return _0x2489fc;});})[_0xd1ce('0x29')](function(_0x3e4e50){logger['error'](_0xd1ce('0x86'),_0x3e4e50);throw _0x3e4e50;});})[_0xd1ce('0x2b')](respondWithResult(_0x30c741,0xc9))[_0xd1ce('0x29')](handleError(_0x30c741,null));};exports[_0xd1ce('0x87')]=function(_0x566b69,_0x4e6774){var _0x2643c7=_0x566b69['body'];var _0x46dac4=[];if(_0x566b69[_0xd1ce('0x34')]['role']===_0xd1ce('0x2d'))throw new Error(_0xd1ce('0x80'));if(_[_0xd1ce('0x88')](_0x2643c7,['role',_0xd1ce('0x34')])&&_0x566b69[_0xd1ce('0x34')][_0xd1ce('0x2c')]!=='admin'){throw new Error(_0xd1ce('0x89'));}if(_[_0xd1ce('0x88')](_0x2643c7,['role',_0xd1ce('0x32')])&&_0x566b69[_0xd1ce('0x34')][_0xd1ce('0x2c')]!=='admin'){throw new Error(_0xd1ce('0x8a'));}return licenseUtil[_0xd1ce('0x81')](_0x2643c7)[_0xd1ce('0x2b')](function(){return validateUser(_0x2643c7[0x0]);})[_0xd1ce('0x2b')](function(){for(var _0x4d36bd=0x1;_0x4d36bd<_0x2643c7[_0xd1ce('0x54')];_0x4d36bd++){var _0x49860b=_0x2643c7[_0x4d36bd-0x1][_0xd1ce('0x65')];if(!_0x2643c7[_0x4d36bd]['internal'])_0x2643c7[_0x4d36bd][_0xd1ce('0x65')]=_0x49860b+0x1;_0x46dac4['push'](validateUser(_0x2643c7[_0x4d36bd]));}return Promise[_0xd1ce('0x5a')](_0x46dac4);})['then'](function(){_0x46dac4=[];for(var _0x3f43cb=0x0;_0x3f43cb<_0x2643c7[_0xd1ce('0x54')];_0x3f43cb++){_0x46dac4[_0xd1ce('0x55')](updateUser(_0x2643c7[_0x3f43cb]));}return Promise[_0xd1ce('0x5a')](_0x46dac4);})[_0xd1ce('0x2b')](function(){_0x46dac4=_0x2643c7[_0xd1ce('0x38')](function(_0x510b4c){return db[_0xd1ce('0x40')]['create'](_0x510b4c,{'include':[{'model':db[_0xd1ce('0x71')],'as':_0xd1ce('0x71')}]})[_0xd1ce('0x2b')](function(_0x344bcd){_0x510b4c['id']=_0x344bcd['id'];return _0x510b4c;});});return Promise[_0xd1ce('0x5a')](_0x46dac4);})[_0xd1ce('0x2b')](function(_0x393942){if(_0x566b69['body'][_0xd1ce('0x2c')]===_0xd1ce('0x34'))return _0x393942;if(_0x566b69[_0xd1ce('0x34')]['role']!==_0xd1ce('0x34'))return _0x393942;var _0x3cc96c=_['some'](_0x393942,function(_0x5ea575){return _0x5ea575[_0xd1ce('0x2c')]===_0xd1ce('0x2d')||_0x5ea575['role']===_0xd1ce('0x36');});if(!_0x3cc96c)return _0x393942;return db[_0xd1ce('0x8b')][_0xd1ce('0x51')]({'where':{'name':{'$or':[_0xd1ce('0x35'),_0xd1ce('0x84')]},'userProfileId':_0x566b69['user'][_0xd1ce('0x83')]},'raw':!![]})['then'](function(_0x1a0a44){if(_[_0xd1ce('0x8c')](_0x1a0a44)||!_[_0xd1ce('0x88')](_0x1a0a44,[_0xd1ce('0x85'),0x0]))return _0x393942;_0x46dac4=[];var _0x1ef110=_(_0x1a0a44)[_0xd1ce('0x38')](function(_0x1228df){if(_0x1228df[_0xd1ce('0x85')]===0x1)return;return _0x1228df[_0xd1ce('0x3c')]===_0xd1ce('0x35')?_0xd1ce('0x2d'):_0xd1ce('0x36');})[_0xd1ce('0x8d')]()[_0xd1ce('0x39')]();for(var _0x1b4625=0x0;_0x1b4625<_0x393942[_0xd1ce('0x54')];_0x1b4625++){if(!_[_0xd1ce('0x3a')](_0x1ef110,_0x393942[_0x1b4625]['role']))return;var _0x5a5128=_0x393942[_0x1b4625]['role']===_0xd1ce('0x2d')?_0xd1ce('0x35'):_0xd1ce('0x84');_0x46dac4[_0xd1ce('0x55')](db[_0xd1ce('0x3d')][_0xd1ce('0x7f')]({'name':_0x393942[_0x1b4625]['name'],'resourceId':_0x393942[_0x1b4625]['id'],'type':_0x5a5128,'sectionId':_[_0xd1ce('0x3b')](_0x1a0a44,['name',_0x5a5128])['id']},{}));}return Promise[_0xd1ce('0x5a')](_0x46dac4);});})[_0xd1ce('0x2b')](respondWithResult(_0x4e6774,0xc9))[_0xd1ce('0x29')](handleError(_0x4e6774,null));};exports['changePassword']=function(_0x333684,_0x41f77d){if(_0x333684[_0xd1ce('0x5f')]['id']){delete _0x333684[_0xd1ce('0x5f')]['id'];}return db['User'][_0xd1ce('0x3b')]({'where':{'id':_0x333684[_0xd1ce('0x60')]['id']}})[_0xd1ce('0x2b')](function(_0x5594fe){if(!_0x5594fe)return null;if(_0x5594fe['id']===_0x333684['user']['id']){if(!_0x333684[_0xd1ce('0x5f')][_0xd1ce('0x8e')]||!_0x333684[_0xd1ce('0x5f')][_0xd1ce('0x8f')]){throw new db[(_0xd1ce('0x90'))][(_0xd1ce('0x91'))](_0xd1ce('0x92'));}if(!_0x5594fe[_0xd1ce('0x93')](_0x333684[_0xd1ce('0x5f')][_0xd1ce('0x8e')])){throw new db[(_0xd1ce('0x90'))][(_0xd1ce('0x91'))](_0xd1ce('0x94'));}if(_0x333684[_0xd1ce('0x5f')][_0xd1ce('0x8e')]===_0x333684[_0xd1ce('0x5f')]['newPassword']){throw new db[(_0xd1ce('0x90'))][(_0xd1ce('0x91'))](_0xd1ce('0x95'));}}else if(_0x333684[_0xd1ce('0x34')][_0xd1ce('0x2c')]===_0xd1ce('0x32')){if(!_0x333684[_0xd1ce('0x5f')]['newPassword']){throw new db[(_0xd1ce('0x90'))][(_0xd1ce('0x91'))](_0xd1ce('0x96'));}}else if(_0x333684[_0xd1ce('0x34')][_0xd1ce('0x2c')]===_0xd1ce('0x34')){if(!_0x333684[_0xd1ce('0x5f')][_0xd1ce('0x8f')]){throw new db[(_0xd1ce('0x90'))][(_0xd1ce('0x91'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}if(_0x5594fe['role']!=='agent'){throw new db[(_0xd1ce('0x90'))]['ValidationError']('Unauthorized');}}else{throw new db[(_0xd1ce('0x90'))]['ValidationError'](_0xd1ce('0x80'));}return _0x5594fe;})[_0xd1ce('0x2b')](handleEntityNotFound(_0x41f77d,null))[_0xd1ce('0x2b')](function(_0x400765){return db[_0xd1ce('0x66')]['findOne']({'attributes':['id','securePassword','enforcePasswordHistory',_0xd1ce('0x97')]})[_0xd1ce('0x2b')](function(_0xc61494){if(_0xc61494['securePassword'])authService[_0xd1ce('0x68')](_0x333684[_0xd1ce('0x5f')]['newPassword']);if(!_0xc61494['enforcePasswordHistory']||!_0x400765['previousPasswords'])return _0x400765;authService[_0xd1ce('0x98')](_0x333684['body'][_0xd1ce('0x8f')],_0x400765[_0xd1ce('0x45')],_0xc61494['passwordHistoryLimit']);return _0x400765;})[_0xd1ce('0x2b')](saveUpdates({'password':_0x333684['body'][_0xd1ce('0x8f')],'passwordResetAt':_0x333684[_0xd1ce('0x34')]['id']==_0x333684[_0xd1ce('0x60')]['id']?moment():null,'previousPasswords':authService[_0xd1ce('0x99')](_0x333684['body'][_0xd1ce('0x8f')],_0x400765[_0xd1ce('0x45')])},null));})[_0xd1ce('0x2b')](respondWithResult(_0x41f77d,null))['catch'](handleError(_0x41f77d,null));};exports[_0xd1ce('0x9a')]=function(_0x412948,_0x2dec41){var _0x32a698=_0x412948['body'][_0xd1ce('0x9b')];return db['User'][_0xd1ce('0x3b')]({'where':{'id':_0x412948['params']['id']},'attributes':['id',_0xd1ce('0x3c'),_0xd1ce('0x2c'),_0xd1ce('0x9c'),_0xd1ce('0x9d'),_0xd1ce('0x9e'),'interface']})['then'](handleEntityNotFound(_0x2dec41,null))[_0xd1ce('0x2b')](function(_0x36f009){if(_0x36f009){if(!utils[_0xd1ce('0x9f')](_0x32a698)){throw new db[(_0xd1ce('0x90'))][(_0xd1ce('0x91'))](_0xd1ce('0xa0'));}return _0x36f009[_0xd1ce('0xa1')+_['capitalize'](_0x32a698['toLowerCase']())+_0xd1ce('0xa2')](_0x412948['body'][_0xd1ce('0x63')],{'penalty':_0x412948['body'][_0xd1ce('0xa3')]||0x0})[_0xd1ce('0xa4')](function(_0x273d6f){for(var _0x9c5182=0x0;_0x9c5182<_0x412948['body'][_0xd1ce('0x63')][_0xd1ce('0x54')];_0x9c5182+=0x1){var _0x1b4cae={'UserId':Number(_0x412948[_0xd1ce('0x60')]['id'])};_0x1b4cae[_['capitalize'](_0x32a698[_0xd1ce('0xa5')]())+_0xd1ce('0xa6')]=Number(_0x412948[_0xd1ce('0x5f')][_0xd1ce('0x63')][_0x9c5182]);socket[_0xd1ce('0x2e')](_0xd1ce('0x34')+_['capitalize'](_0x32a698['toLowerCase']())+'Queue:save',_0x1b4cae);}return _0x273d6f;})[_0xd1ce('0x2b')](function(){if(_0x32a698===_0xd1ce('0xa7')){return db['VoiceQueue']['findAll']({'where':{'id':_0x412948[_0xd1ce('0x5f')][_0xd1ce('0x63')]||[]},'raw':!![],'attributes':['id',_0xd1ce('0x3c')]});}})[_0xd1ce('0x2b')](function(_0x2fad2f){var _0x44f443=_0x36f009[_0xd1ce('0x31')]({'plain':!![]});var _0x21aebb=[];if(_0x32a698===_0xd1ce('0xa7')&&_0x44f443[_0xd1ce('0x2c')]===_0xd1ce('0x2d')&&_0x44f443[_0xd1ce('0x9c')]){for(let _0x3cf6bd=0x0;_0x3cf6bd<_0x2fad2f[_0xd1ce('0x54')];_0x3cf6bd+=0x1){_0x21aebb[_0xd1ce('0x55')]({'membername':_0x44f443[_0xd1ce('0x3c')],'UserId':_0x44f443['id'],'queue_name':_0x2fad2f[_0x3cf6bd][_0xd1ce('0x3c')],'VoiceQueueId':_0x2fad2f[_0x3cf6bd]['id'],'interface':_[_0xd1ce('0x6a')](_0x44f443[_0xd1ce('0xa8')])?util[_0xd1ce('0xa9')](_0xd1ce('0xaa'),_0x44f443['name']):_0x44f443[_0xd1ce('0xa8')],'paused':_0x44f443[_0xd1ce('0x9e')]||![],'penalty':_0x412948[_0xd1ce('0x5f')][_0xd1ce('0xa3')]||0x0});}return Promise[_0xd1ce('0x5a')](_0x21aebb['map'](function(_0x288956){return db[_0xd1ce('0xab')][_0xd1ce('0xac')](_0x288956);}));}return _0x36f009;});}})[_0xd1ce('0x2b')](respondWithStatusCode(_0x2dec41,null))[_0xd1ce('0x29')](handleError(_0x2dec41,null));};exports[_0xd1ce('0xad')]=function(_0x19fbde,_0xf0eb2){var _0x6a2c4d,_0x4a6792;return db['User'][_0xd1ce('0x3b')]({'where':{'id':_0x19fbde[_0xd1ce('0x60')]['id']},'attributes':['id',_0xd1ce('0x3c'),_0xd1ce('0x2c')]})[_0xd1ce('0x2b')](handleEntityNotFound(_0xf0eb2,null))[_0xd1ce('0x2b')](function(_0x3fda95){if(_0x3fda95){_0x6a2c4d=_0x3fda95;if(!_0x19fbde[_0xd1ce('0x4b')][_0xd1ce('0x9b')]||!utils[_0xd1ce('0x9f')](_0x19fbde[_0xd1ce('0x4b')]['channel'])){throw new db[(_0xd1ce('0x90'))][(_0xd1ce('0x91'))](_0xd1ce('0xa0'));}return _0x3fda95[_0xd1ce('0xae')+_['capitalize'](_0x19fbde['query']['channel']['toLowerCase']())+_0xd1ce('0xa2')](_0x19fbde[_0xd1ce('0x4b')][_0xd1ce('0x63')]);}})['then'](function(_0x9bb81c){if(_[_0xd1ce('0xaf')](_0x19fbde[_0xd1ce('0x4b')][_0xd1ce('0x63')])){for(var _0x4ff03f=0x0;_0x4ff03f<_0x19fbde['query'][_0xd1ce('0x63')][_0xd1ce('0x54')];_0x4ff03f+=0x1){_0x4a6792={'UserId':Number(_0x19fbde[_0xd1ce('0x60')]['id'])};_0x4a6792[_[_0xd1ce('0xb0')](_0x19fbde['query']['channel']['toLowerCase']())+_0xd1ce('0xa6')]=Number(_0x19fbde[_0xd1ce('0x4b')][_0xd1ce('0x63')][_0x4ff03f]);socket[_0xd1ce('0x2e')](_0xd1ce('0x34')+_[_0xd1ce('0xb0')](_0x19fbde[_0xd1ce('0x4b')][_0xd1ce('0x9b')][_0xd1ce('0xa5')]())+_0xd1ce('0xb1'),_0x4a6792);}}else{_0x4a6792={'UserId':Number(_0x19fbde[_0xd1ce('0x60')]['id'])};_0x4a6792[_[_0xd1ce('0xb0')](_0x19fbde['query'][_0xd1ce('0x9b')][_0xd1ce('0xa5')]())+_0xd1ce('0xa6')]=Number(_0x19fbde[_0xd1ce('0x4b')][_0xd1ce('0x63')]);socket[_0xd1ce('0x2e')](_0xd1ce('0x34')+_['capitalize'](_0x19fbde[_0xd1ce('0x4b')][_0xd1ce('0x9b')][_0xd1ce('0xa5')]())+_0xd1ce('0xb1'),_0x4a6792);}return _0x9bb81c;})[_0xd1ce('0x2b')](function(){if(_0x19fbde[_0xd1ce('0x4b')][_0xd1ce('0x9b')]===_0xd1ce('0xa7')){return db[_0xd1ce('0xab')]['destroy']({'where':{'UserId':_0x19fbde[_0xd1ce('0x60')]['id'],'VoiceQueueId':_0x19fbde['query']['ids']},'individualHooks':!![]})[_0xd1ce('0x2b')](function(){return _0x6a2c4d;});}return _0x6a2c4d;})[_0xd1ce('0x2b')](respondWithStatusCode(_0xf0eb2,null))['catch'](handleError(_0xf0eb2,null));};exports[_0xd1ce('0xb2')]=function(_0x3cd060,_0x2158d4){_0x3cd060['body'][_0xd1ce('0xb3')]=_0x3cd060['file']['filename'];return db[_0xd1ce('0x40')]['find']({'where':{'id':_0x3cd060['params']['id']}})[_0xd1ce('0x2b')](handleEntityNotFound(_0x2158d4,null))[_0xd1ce('0x2b')](saveUpdates(_0x3cd060['body'],null))[_0xd1ce('0x2b')](respondWithResult(_0x2158d4,null))[_0xd1ce('0x29')](handleError(_0x2158d4,null));};exports[_0xd1ce('0xb4')]=function(_0x1580bc,_0x4aefb3){var _0x544967=path[_0xd1ce('0xb5')](config[_0xd1ce('0xb6')],'server/files/images/logos/default_profile.png');return db[_0xd1ce('0x40')][_0xd1ce('0x3b')]({'where':{'id':_0x1580bc[_0xd1ce('0x60')]['id']},'attributes':['id',_0xd1ce('0xb3')],'raw':!![]})[_0xd1ce('0x2b')](handleEntityNotFound(_0x4aefb3,null))[_0xd1ce('0x2b')](function(_0x53e696){if(_0x53e696){if(_[_0xd1ce('0x6a')](_0x53e696['userpic'])){return _0x4aefb3[_0xd1ce('0xb7')](_0x544967);}else{if(!fs['existsSync'](path[_0xd1ce('0xb5')](config[_0xd1ce('0xb6')],_0xd1ce('0xb8'),_0x53e696['userpic']))){return _0x4aefb3[_0xd1ce('0xb7')](_0x544967);}return _0x4aefb3[_0xd1ce('0xb7')](path[_0xd1ce('0xb5')](config[_0xd1ce('0xb6')],_0xd1ce('0xb8'),_0x53e696[_0xd1ce('0xb3')]));}}})[_0xd1ce('0x29')](handleError(_0x4aefb3,null));};exports['getOpenTabs']=function(_0x5874c7,_0x4875f8){return db[_0xd1ce('0x40')][_0xd1ce('0x3b')]({'where':{'id':_0x5874c7[_0xd1ce('0x60')]['id']},'attributes':['id']})[_0xd1ce('0x2b')](handleEntityNotFound(_0x4875f8,null))[_0xd1ce('0x2b')](function(_0x1ac220){var _0x5acee0=[];values=_0x1ac220['dataValues'];_0x5acee0[_0xd1ce('0x55')](get_open_tabs(_0xd1ce('0x56'),_0x1ac220[_0xd1ce('0x57')]));_0x5acee0[_0xd1ce('0x55')](get_open_tabs('sms',_0x1ac220[_0xd1ce('0x57')]));_0x5acee0[_0xd1ce('0x55')](get_open_tabs('openchannel',_0x1ac220[_0xd1ce('0x57')]));_0x5acee0[_0xd1ce('0x55')](get_open_tabs(_0xd1ce('0x59'),_0x1ac220[_0xd1ce('0x57')]));_0x5acee0['push'](get_open_tabs(_0xd1ce('0x58'),_0x1ac220[_0xd1ce('0x57')]));_0x5acee0['push'](get_open_tabs(_0xd1ce('0xb9'),_0x1ac220[_0xd1ce('0x57')]));return Promise['all'](_0x5acee0);})['then'](function(_0x96d5bb){if(_0x96d5bb){var _0x2c6ab7=_['map'](values[_0xd1ce('0xba')],function(_0x2f9260){return{'channel':_0xd1ce('0xbb'),'id':_0x2f9260['id'],'createdAt':_0x2f9260[_0xd1ce('0xbc')]};});var _0x57459c=_[_0xd1ce('0x38')](values[_0xd1ce('0xbd')],function(_0x170012){return{'channel':_0xd1ce('0xbe'),'id':_0x170012['id'],'createdAt':_0x170012['createdAt']};});var _0x4c402c=_[_0xd1ce('0x38')](values[_0xd1ce('0xbf')],function(_0x4e2fb4){return{'channel':'OPENCHANNEL','id':_0x4e2fb4['id'],'createdAt':_0x4e2fb4[_0xd1ce('0xbc')]};});var _0x5868c3=_[_0xd1ce('0x38')](values['MailOpenTabs'],function(_0x381a1b){return{'channel':_0xd1ce('0xc0'),'id':_0x381a1b['id'],'createdAt':_0x381a1b[_0xd1ce('0xbc')]};});var _0x140e12=_[_0xd1ce('0x38')](values[_0xd1ce('0xc1')],function(_0x46213a){return{'channel':_0xd1ce('0xc2'),'id':_0x46213a['id'],'createdAt':_0x46213a[_0xd1ce('0xbc')]};});var _0x46ae0f=_['map'](values[_0xd1ce('0xc3')],function(_0x48b0e3){return{'channel':_0xd1ce('0xc4'),'id':_0x48b0e3['id'],'createdAt':_0x48b0e3[_0xd1ce('0xbc')]};});var _0xa92c73=_[_0xd1ce('0xc5')](_0x2c6ab7,_0x57459c,_0x4c402c,_0x5868c3,_0x140e12,_0x46ae0f);var _0x8f8193={'count':_0xa92c73[_0xd1ce('0x54')],'rows':_0xa92c73};return _0x8f8193;}else return null;})[_0xd1ce('0x2b')](respondWithResult(_0x4875f8,null))[_0xd1ce('0x29')](handleError(_0x4875f8,null));};exports[_0xd1ce('0xc6')]=function(_0xa54604,_0x552015){var _0x475125={};return db[_0xd1ce('0x40')][_0xd1ce('0xc7')]({'where':{'id':_0xa54604[_0xd1ce('0x60')]['id']}})[_0xd1ce('0x2b')](function(_0x5136f1){if(!_0x5136f1){throw new APINotFoundError(util[_0xd1ce('0xa9')](_0xd1ce('0xc8'),_0xa54604[_0xd1ce('0x60')]['id']));}return contacts[_0xd1ce('0x61')]();})[_0xd1ce('0x2b')](function(_0x358058){_0xa54604[_0xd1ce('0x4b')][_0xd1ce('0x40')]=_0xa54604[_0xd1ce('0x60')]['id'];_0x475125=qs['getOptions'](_0x358058,_0xa54604);if(_0xa54604[_0xd1ce('0x4b')][_0xd1ce('0xc9')]('includeAll')){_0x475125[_0xd1ce('0x4d')]=[{'model':db[_0xd1ce('0xca')],'as':_0xd1ce('0xcb'),'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0xd1ce('0x3c'),_0xd1ce('0xcc')],'where':_0xa54604['query']['tag']?{'id':_0xa54604['query'][_0xd1ce('0xcd')]}:undefined,'required':_0xa54604[_0xd1ce('0x4b')][_0xd1ce('0xcd')]?!![]:![]}];}return contacts['findAll'](_0xa54604[_0xd1ce('0x4b')],_0xa54604[_0xd1ce('0x34')],_0x475125,_0x358058);})['then'](respondWithFilteredResult(_0x552015,_0x475125))[_0xd1ce('0x29')](APIHandleError(_0x552015));};exports[_0xd1ce('0xce')]=function(_0x5c6a14,_0x3596fe){var _0x315d65;var _0x79d1ac={};var _0x2f4208;return db[_0xd1ce('0x40')][_0xd1ce('0xc7')]({'where':{'id':_0x5c6a14[_0xd1ce('0x60')]['id']},'attributes':['id',_0xd1ce('0x3c'),_0xd1ce('0x2c')]})[_0xd1ce('0x2b')](handleEntityNotFound(_0x3596fe,null))[_0xd1ce('0x2b')](function(_0xba3e4c){if(!utils[_0xd1ce('0x9f')](_0x5c6a14['query'][_0xd1ce('0x9b')])){throw new db['Sequelize']['ValidationError'](_0xd1ce('0xa0'));}_0x315d65=_0xba3e4c;var _0x5b740c={};_0x5b740c['model']=_[_0xd1ce('0xcf')](db[_['capitalize'](_0x5c6a14['query'][_0xd1ce('0x9b')])+_0xd1ce('0xd0')]['rawAttributes']);_0x5b740c['query']=_[_0xd1ce('0xcf')](_0x5c6a14[_0xd1ce('0x4b')]);_0x5b740c[_0xd1ce('0xd1')]=_[_0xd1ce('0xd2')](_0x5b740c[_0xd1ce('0xd3')],_0x5b740c[_0xd1ce('0x4b')]);_0x79d1ac[_0xd1ce('0x50')]=_['intersection'](_0x5b740c[_0xd1ce('0xd3')],qs['fields'](_0x5c6a14['query']['fields']));_0x79d1ac[_0xd1ce('0x50')]=_0x79d1ac[_0xd1ce('0x50')]['length']?_0x79d1ac[_0xd1ce('0x50')]:_0x5b740c[_0xd1ce('0xd3')];_0x79d1ac[_0xd1ce('0xd4')]=qs[_0xd1ce('0xd5')](_0x5c6a14[_0xd1ce('0x4b')][_0xd1ce('0xd5')]);_0x79d1ac[_0xd1ce('0x4a')]=qs[_0xd1ce('0xd1')](_['pick'](_0x5c6a14[_0xd1ce('0x4b')],_0x5b740c['filters']));if(_0x5c6a14[_0xd1ce('0x4b')][_0xd1ce('0x37')]){_0x79d1ac['where']=_[_0xd1ce('0xd6')](_0x79d1ac[_0xd1ce('0x4a')],{'$or':_[_0xd1ce('0x38')](_0x79d1ac[_0xd1ce('0x50')],function(_0x9db00e){var _0x59f8fb={};_0x59f8fb[_0x9db00e]={'$like':'%'+_0x5c6a14[_0xd1ce('0x4b')]['filter']+'%'};return _0x59f8fb;})});}_0x79d1ac=_['merge']({},_0x79d1ac,_0x5c6a14[_0xd1ce('0x5d')]);switch(_0x315d65[_0xd1ce('0x2c')]){case _0xd1ce('0x32'):return db[_[_0xd1ce('0xb0')](_0x5c6a14['query']['channel'])+_0xd1ce('0xd0')][_0xd1ce('0x51')](_0x79d1ac);case _0xd1ce('0x34'):case _0xd1ce('0x2d'):return _0x315d65['get'+_[_0xd1ce('0xb0')](_0x5c6a14[_0xd1ce('0x4b')]['channel'])+_0xd1ce('0xa2')](_0x79d1ac);default:throw new db['Sequelize'][(_0xd1ce('0x91'))]('Unknown\x20role');}})[_0xd1ce('0x2b')](function(_0x653aa5){_0x2f4208=_0x653aa5[_0xd1ce('0x54')];if(!_0x5c6a14[_0xd1ce('0x4b')]['hasOwnProperty'](_0xd1ce('0xd7'))){_0x79d1ac[_0xd1ce('0x1c')]=qs[_0xd1ce('0x1c')](_0x5c6a14[_0xd1ce('0x4b')][_0xd1ce('0x1c')]);_0x79d1ac['offset']=qs[_0xd1ce('0x1b')](_0x5c6a14[_0xd1ce('0x4b')][_0xd1ce('0x1b')]);}switch(_0x315d65[_0xd1ce('0x2c')]){case'admin':return db[_[_0xd1ce('0xb0')](_0x5c6a14[_0xd1ce('0x4b')][_0xd1ce('0x9b')])+_0xd1ce('0xd0')][_0xd1ce('0x51')](_0x79d1ac);case _0xd1ce('0x34'):case _0xd1ce('0x2d'):return _0x315d65[_0xd1ce('0x31')+_[_0xd1ce('0xb0')](_0x5c6a14[_0xd1ce('0x4b')]['channel'])+_0xd1ce('0xa2')](_0x79d1ac);}})[_0xd1ce('0x2b')](function(_0x5cb00a){return{'count':_0x2f4208,'rows':_0x5cb00a};})[_0xd1ce('0x2b')](respondWithResult(_0x3596fe,null))[_0xd1ce('0x29')](handleError(_0x3596fe,null));};exports[_0xd1ce('0xd8')]=function(_0x589d07,_0x128676){var _0x1759a5={};var _0x77077d={};var _0x590cbd;var _0xd780c8;return db['User']['findOne']({'where':{'id':_0x589d07['params']['id']}})[_0xd1ce('0x2b')](handleEntityNotFound(_0x128676,null))['then'](function(_0x3cb8c1){if(_0x3cb8c1){_0x590cbd=_0x3cb8c1;_0x77077d['model']=_[_0xd1ce('0xcf')](db[_0xd1ce('0xab')]['rawAttributes']);_0x77077d[_0xd1ce('0x4b')]=_[_0xd1ce('0xcf')](_0x589d07[_0xd1ce('0x4b')]);_0x77077d[_0xd1ce('0xd1')]=_[_0xd1ce('0xd2')](_0x77077d[_0xd1ce('0xd3')],_0x77077d['query']);_0x1759a5[_0xd1ce('0x50')]=_[_0xd1ce('0xd2')](_0x77077d[_0xd1ce('0xd3')],qs[_0xd1ce('0xd9')](_0x589d07[_0xd1ce('0x4b')]['fields']));_0x1759a5[_0xd1ce('0x50')]=_0x1759a5[_0xd1ce('0x50')][_0xd1ce('0x54')]?_0x1759a5[_0xd1ce('0x50')]:_0x77077d[_0xd1ce('0xd3')];_0x1759a5[_0xd1ce('0xd4')]=qs[_0xd1ce('0xd5')](_0x589d07[_0xd1ce('0x4b')]['sort']);_0x1759a5[_0xd1ce('0x4a')]=qs[_0xd1ce('0xd1')](_[_0xd1ce('0xda')](_0x589d07[_0xd1ce('0x4b')],_0x77077d[_0xd1ce('0xd1')]));if(_0x589d07[_0xd1ce('0x4b')][_0xd1ce('0x37')]){_0x1759a5[_0xd1ce('0x4a')]=_['merge'](_0x1759a5[_0xd1ce('0x4a')],{'$or':_[_0xd1ce('0x38')](_0x1759a5[_0xd1ce('0x50')],function(_0x1ce25c){var _0x532200={};_0x532200[_0x1ce25c]={'$like':'%'+_0x589d07[_0xd1ce('0x4b')][_0xd1ce('0x37')]+'%'};return _0x532200;})});}_0x1759a5=_['merge']({},_0x1759a5,_0x589d07[_0xd1ce('0x5d')]);return _0x590cbd['getVoiceQueuesRt'](_0x1759a5);}})['then'](function(_0x2cce4a){if(_0x2cce4a){_0xd780c8=_0x2cce4a['length'];if(!_0x589d07['query'][_0xd1ce('0xc9')](_0xd1ce('0xd7'))){_0x1759a5[_0xd1ce('0x1c')]=qs[_0xd1ce('0x1c')](_0x589d07[_0xd1ce('0x4b')][_0xd1ce('0x1c')]);_0x1759a5[_0xd1ce('0x1b')]=qs['offset'](_0x589d07['query']['offset']);}return _0x590cbd['getVoiceQueuesRt'](_0x1759a5);}})[_0xd1ce('0x2b')](function(_0x15d9bf){if(_0x15d9bf){return _0x15d9bf?{'count':_0xd780c8,'rows':_0x15d9bf}:null;}})[_0xd1ce('0x2b')](respondWithResult(_0x128676,null))[_0xd1ce('0x29')](handleError(_0x128676,null));};exports[_0xd1ce('0xdb')]=function(_0x4a3376,_0x54d433){var _0x257dce={};var _0x231af6={};var _0x411aa7;var _0x460389;return db[_0xd1ce('0x40')][_0xd1ce('0xc7')]({'where':{'id':_0x4a3376[_0xd1ce('0x60')]['id']}})[_0xd1ce('0x2b')](handleEntityNotFound(_0x54d433,null))[_0xd1ce('0x2b')](function(_0x340b1f){if(_0x340b1f){_0x411aa7=_0x340b1f;_0x231af6['model']=_[_0xd1ce('0xcf')](db['ChatGroup'][_0xd1ce('0xdc')]);_0x231af6[_0xd1ce('0x4b')]=_[_0xd1ce('0xcf')](_0x4a3376[_0xd1ce('0x4b')]);_0x231af6[_0xd1ce('0xd1')]=_['intersection'](_0x231af6['model'],_0x231af6[_0xd1ce('0x4b')]);_0x257dce[_0xd1ce('0x50')]=_[_0xd1ce('0xd2')](_0x231af6[_0xd1ce('0xd3')],qs['fields'](_0x4a3376[_0xd1ce('0x4b')]['fields']));_0x257dce['attributes']=_0x257dce[_0xd1ce('0x50')][_0xd1ce('0x54')]?_0x257dce[_0xd1ce('0x50')]:_0x231af6[_0xd1ce('0xd3')];_0x257dce['order']=qs['sort'](_0x4a3376[_0xd1ce('0x4b')][_0xd1ce('0xd5')]);_0x257dce[_0xd1ce('0x4a')]=qs[_0xd1ce('0xd1')](_[_0xd1ce('0xda')](_0x4a3376[_0xd1ce('0x4b')],_0x231af6[_0xd1ce('0xd1')]));if(_0x4a3376[_0xd1ce('0x4b')]['filter']){_0x257dce[_0xd1ce('0x4a')]=_['merge'](_0x257dce[_0xd1ce('0x4a')],{'$or':_[_0xd1ce('0x38')](_0x257dce['attributes'],function(_0x42e16d){var _0x19fb5a={};_0x19fb5a[_0x42e16d]={'$like':'%'+_0x4a3376[_0xd1ce('0x4b')]['filter']+'%'};return _0x19fb5a;})});}_0x257dce=_[_0xd1ce('0xd6')]({},_0x257dce,_0x4a3376[_0xd1ce('0x5d')]);return _0x411aa7['getGroups'](_0x257dce);}})[_0xd1ce('0x2b')](function(_0x1fae08){if(_0x1fae08){_0x460389=_0x1fae08[_0xd1ce('0x54')];if(!_0x4a3376[_0xd1ce('0x4b')]['hasOwnProperty'](_0xd1ce('0xd7'))){_0x257dce[_0xd1ce('0x1c')]=qs[_0xd1ce('0x1c')](_0x4a3376[_0xd1ce('0x4b')]['limit']);_0x257dce['offset']=qs[_0xd1ce('0x1b')](_0x4a3376[_0xd1ce('0x4b')]['offset']);}return _0x411aa7[_0xd1ce('0xdb')](_0x257dce);}})[_0xd1ce('0x2b')](function(_0x4fac7d){if(_0x4fac7d){return _0x4fac7d?{'count':_0x460389,'rows':_0x4fac7d}:null;}})[_0xd1ce('0x2b')](respondWithResult(_0x54d433,null))[_0xd1ce('0x29')](handleError(_0x54d433,null));};exports[_0xd1ce('0xdd')]=function(_0x47767a,_0x1fbd8a){var _0x235209={'raw':!![],'where':{}};var _0x4ca0cc={};var _0x38218e={'count':0x0,'rows':[]};return db[_0xd1ce('0x40')][_0xd1ce('0xc7')]({'where':{'id':_0x47767a[_0xd1ce('0x60')]['id']}})[_0xd1ce('0x2b')](handleEntityNotFound(_0x1fbd8a,null))[_0xd1ce('0x2b')](function(_0x2f7997){if(_0x2f7997){_0x4ca0cc[_0xd1ce('0xd3')]=_[_0xd1ce('0xcf')](db[_0xd1ce('0xde')][_0xd1ce('0xdc')]);_0x4ca0cc[_0xd1ce('0x4b')]=_['keys'](_0x47767a[_0xd1ce('0x4b')]);_0x4ca0cc[_0xd1ce('0xd1')]=_['intersection'](_0x4ca0cc[_0xd1ce('0xd3')],_0x4ca0cc[_0xd1ce('0x4b')]);_0x235209[_0xd1ce('0x50')]=_[_0xd1ce('0xd2')](_0x4ca0cc[_0xd1ce('0xd3')],qs[_0xd1ce('0xd9')](_0x47767a[_0xd1ce('0x4b')][_0xd1ce('0xd9')]));_0x235209['attributes']=_0x235209[_0xd1ce('0x50')][_0xd1ce('0x54')]?_0x235209[_0xd1ce('0x50')]:_0x4ca0cc[_0xd1ce('0xd3')];if(!_0x47767a['query'][_0xd1ce('0xc9')]('nolimit')){_0x235209[_0xd1ce('0x1c')]=qs[_0xd1ce('0x1c')](_0x47767a[_0xd1ce('0x4b')][_0xd1ce('0x1c')]);_0x235209[_0xd1ce('0x1b')]=qs[_0xd1ce('0x1b')](_0x47767a[_0xd1ce('0x4b')][_0xd1ce('0x1b')]);}_0x235209['order']=qs[_0xd1ce('0xd5')](_0x47767a[_0xd1ce('0x4b')][_0xd1ce('0xd5')]);_0x235209[_0xd1ce('0x4a')]=qs[_0xd1ce('0xd1')](_[_0xd1ce('0xda')](_0x47767a['query'],_0x4ca0cc[_0xd1ce('0xd1')]));_0x235209['where'][_0xd1ce('0xdf')]=_0x2f7997['id'];if(_0x47767a[_0xd1ce('0x4b')][_0xd1ce('0x37')]){_0x235209[_0xd1ce('0x4a')]=_['merge'](_0x235209[_0xd1ce('0x4a')],{'$or':_[_0xd1ce('0x38')](_0x235209[_0xd1ce('0x50')],function(_0x126c01){var _0x3ee8b8={};_0x3ee8b8[_0x126c01]={'$like':'%'+_0x47767a['query']['filter']+'%'};return _0x3ee8b8;})});}_0x235209=_['merge']({},_0x235209,_0x47767a[_0xd1ce('0x5d')]);return db['VoiceRecording'][_0xd1ce('0x1e')]({'where':_0x235209[_0xd1ce('0x4a')]})[_0xd1ce('0x2b')](function(_0x4ded38){_0x38218e['count']=_0x4ded38;if(_0x47767a['query'][_0xd1ce('0x4c')]){_0x235209[_0xd1ce('0x4d')]=[{'all':!![]}];}return db[_0xd1ce('0xde')][_0xd1ce('0x51')](_0x235209);})['then'](function(_0x4f216f){_0x38218e[_0xd1ce('0x52')]=_0x4f216f;return _0x38218e;});}})[_0xd1ce('0x2b')](respondWithFilteredResult(_0x1fbd8a,_0x235209))[_0xd1ce('0x29')](handleError(_0x1fbd8a,null));};exports[_0xd1ce('0xe0')]=function(_0x348291,_0x3bc9d2){var _0x39c4ce={'raw':!![],'where':{}};var _0xb6ab07={};var _0x4aca30={'count':0x0,'rows':[]};return db[_0xd1ce('0x40')][_0xd1ce('0xc7')]({'where':{'id':_0x348291[_0xd1ce('0x60')]['id']}})[_0xd1ce('0x2b')](handleEntityNotFound(_0x3bc9d2,null))[_0xd1ce('0x2b')](function(_0x6a97f6){if(_0x6a97f6){_0xb6ab07['model']=_[_0xd1ce('0xcf')](db[_0xd1ce('0xe1')][_0xd1ce('0xdc')]);_0xb6ab07['query']=_[_0xd1ce('0xcf')](_0x348291[_0xd1ce('0x4b')]);_0xb6ab07[_0xd1ce('0xd1')]=_[_0xd1ce('0xd2')](_0xb6ab07[_0xd1ce('0xd3')],_0xb6ab07[_0xd1ce('0x4b')]);_0x39c4ce[_0xd1ce('0x50')]=_[_0xd1ce('0xd2')](_0xb6ab07[_0xd1ce('0xd3')],qs[_0xd1ce('0xd9')](_0x348291[_0xd1ce('0x4b')]['fields']));_0x39c4ce['attributes']=_0x39c4ce[_0xd1ce('0x50')][_0xd1ce('0x54')]?_0x39c4ce[_0xd1ce('0x50')]:_0xb6ab07[_0xd1ce('0xd3')];if(!_0x348291[_0xd1ce('0x4b')][_0xd1ce('0xc9')](_0xd1ce('0xd7'))){_0x39c4ce[_0xd1ce('0x1c')]=qs[_0xd1ce('0x1c')](_0x348291[_0xd1ce('0x4b')]['limit']);_0x39c4ce[_0xd1ce('0x1b')]=qs[_0xd1ce('0x1b')](_0x348291[_0xd1ce('0x4b')][_0xd1ce('0x1b')]);}_0x39c4ce[_0xd1ce('0xd4')]=qs[_0xd1ce('0xd5')](_0x348291[_0xd1ce('0x4b')]['sort']);_0x39c4ce[_0xd1ce('0x4a')]=qs[_0xd1ce('0xd1')](_[_0xd1ce('0xda')](_0x348291[_0xd1ce('0x4b')],_0xb6ab07[_0xd1ce('0xd1')]));_0x39c4ce['where'][_0xd1ce('0xdf')]=_0x6a97f6['id'];if(_0x348291[_0xd1ce('0x4b')]['filter']){_0x39c4ce[_0xd1ce('0x4a')]=_[_0xd1ce('0xd6')](_0x39c4ce['where'],{'$or':_[_0xd1ce('0x38')](_0x39c4ce['attributes'],function(_0x58240c){var _0x84f13d={};_0x84f13d[_0x58240c]={'$like':'%'+_0x348291[_0xd1ce('0x4b')][_0xd1ce('0x37')]+'%'};return _0x84f13d;})});}_0x39c4ce=_['merge']({},_0x39c4ce,_0x348291['options']);return db[_0xd1ce('0xe1')][_0xd1ce('0x1e')]({'where':_0x39c4ce[_0xd1ce('0x4a')]})[_0xd1ce('0x2b')](function(_0x15bab8){_0x4aca30['count']=_0x15bab8;if(_0x348291[_0xd1ce('0x4b')][_0xd1ce('0x4c')]){_0x39c4ce['include']=[{'all':!![]}];}return db['ScreenRecording'][_0xd1ce('0x51')](_0x39c4ce);})['then'](function(_0x2316fa){_0x4aca30['rows']=_0x2316fa;return _0x4aca30;});}})['then'](respondWithFilteredResult(_0x3bc9d2,_0x39c4ce))['catch'](handleError(_0x3bc9d2,null));};exports['getChatInteractions']=function(_0x41d149,_0x36cd63){var _0x464d42={};var _0x44784c={};var _0x397b42;var _0x340f4a;return db[_0xd1ce('0x40')][_0xd1ce('0xc7')]({'where':{'id':_0x41d149[_0xd1ce('0x60')]['id']}})['then'](handleEntityNotFound(_0x36cd63,null))[_0xd1ce('0x2b')](function(_0x488679){if(_0x488679){_0x397b42=_0x488679;_0x44784c[_0xd1ce('0xd3')]=_[_0xd1ce('0xcf')](db['ChatInteraction']['rawAttributes']);_0x44784c[_0xd1ce('0x4b')]=_[_0xd1ce('0xcf')](_0x41d149[_0xd1ce('0x4b')]);_0x44784c[_0xd1ce('0xd1')]=_[_0xd1ce('0xd2')](_0x44784c[_0xd1ce('0xd3')],_0x44784c[_0xd1ce('0x4b')]);_0x464d42[_0xd1ce('0x50')]=_[_0xd1ce('0xd2')](_0x44784c['model'],qs[_0xd1ce('0xd9')](_0x41d149['query'][_0xd1ce('0xd9')]));_0x464d42[_0xd1ce('0x50')]=_0x464d42[_0xd1ce('0x50')][_0xd1ce('0x54')]?_0x464d42[_0xd1ce('0x50')]:_0x44784c[_0xd1ce('0xd3')];_0x464d42['order']=qs[_0xd1ce('0xd5')](_0x41d149['query'][_0xd1ce('0xd5')]);_0x464d42[_0xd1ce('0x4a')]=qs['filters'](_[_0xd1ce('0xda')](_0x41d149[_0xd1ce('0x4b')],_0x44784c[_0xd1ce('0xd1')]));if(_0x41d149[_0xd1ce('0x4b')]['filter']){_0x464d42[_0xd1ce('0x4a')]=_[_0xd1ce('0xd6')](_0x464d42[_0xd1ce('0x4a')],{'$or':_[_0xd1ce('0x38')](_0x464d42[_0xd1ce('0x50')],function(_0x2df22b){var _0x4f3258={};_0x4f3258[_0x2df22b]={'$like':'%'+_0x41d149[_0xd1ce('0x4b')][_0xd1ce('0x37')]+'%'};return _0x4f3258;})});}_0x464d42=_[_0xd1ce('0xd6')]({},_0x464d42,_0x41d149[_0xd1ce('0x5d')]);return _0x397b42[_0xd1ce('0xe2')](_0x464d42);}})[_0xd1ce('0x2b')](function(_0x3c7645){if(_0x3c7645){_0x340f4a=_0x3c7645['length'];if(!_0x41d149[_0xd1ce('0x4b')]['hasOwnProperty'](_0xd1ce('0xd7'))){_0x464d42['limit']=qs[_0xd1ce('0x1c')](_0x41d149['query']['limit']);_0x464d42['offset']=qs[_0xd1ce('0x1b')](_0x41d149['query'][_0xd1ce('0x1b')]);}return _0x397b42[_0xd1ce('0xe2')](_0x464d42);}})[_0xd1ce('0x2b')](function(_0x36afc4){if(_0x36afc4){return _0x36afc4?{'count':_0x340f4a,'rows':_0x36afc4}:null;}})[_0xd1ce('0x2b')](respondWithResult(_0x36cd63,null))[_0xd1ce('0x29')](handleError(_0x36cd63,null));};exports[_0xd1ce('0xe3')]=function(_0x34aee5,_0x17cd49){var _0x975a53={};var _0x282716={};var _0xc6c65;var _0x4c3271;return db[_0xd1ce('0x40')][_0xd1ce('0xc7')]({'where':{'id':_0x34aee5[_0xd1ce('0x60')]['id']}})[_0xd1ce('0x2b')](handleEntityNotFound(_0x17cd49,null))[_0xd1ce('0x2b')](function(_0x10e2d2){if(_0x10e2d2){_0xc6c65=_0x10e2d2;_0x282716[_0xd1ce('0xd3')]=_[_0xd1ce('0xcf')](db[_0xd1ce('0xe4')]['rawAttributes']);_0x282716[_0xd1ce('0x4b')]=_[_0xd1ce('0xcf')](_0x34aee5[_0xd1ce('0x4b')]);_0x282716[_0xd1ce('0xd1')]=_[_0xd1ce('0xd2')](_0x282716[_0xd1ce('0xd3')],_0x282716[_0xd1ce('0x4b')]);_0x975a53[_0xd1ce('0x50')]=_[_0xd1ce('0xd2')](_0x282716[_0xd1ce('0xd3')],qs[_0xd1ce('0xd9')](_0x34aee5[_0xd1ce('0x4b')][_0xd1ce('0xd9')]));_0x975a53[_0xd1ce('0x50')]=_0x975a53[_0xd1ce('0x50')][_0xd1ce('0x54')]?_0x975a53[_0xd1ce('0x50')]:_0x282716[_0xd1ce('0xd3')];_0x975a53[_0xd1ce('0xd4')]=qs[_0xd1ce('0xd5')](_0x34aee5[_0xd1ce('0x4b')][_0xd1ce('0xd5')]);_0x975a53[_0xd1ce('0x4a')]=qs[_0xd1ce('0xd1')](_[_0xd1ce('0xda')](_0x34aee5['query'],_0x282716[_0xd1ce('0xd1')]));if(_0x34aee5[_0xd1ce('0x4b')][_0xd1ce('0x37')]){_0x975a53[_0xd1ce('0x4a')]=_[_0xd1ce('0xd6')](_0x975a53['where'],{'$or':_['map'](_0x975a53[_0xd1ce('0x50')],function(_0x279ffd){var _0x11f1d7={};_0x11f1d7[_0x279ffd]={'$like':'%'+_0x34aee5[_0xd1ce('0x4b')]['filter']+'%'};return _0x11f1d7;})});}_0x975a53=_[_0xd1ce('0xd6')]({},_0x975a53,_0x34aee5[_0xd1ce('0x5d')]);return _0xc6c65['getOpenchannelInteractions'](_0x975a53);}})['then'](function(_0x5c7b87){if(_0x5c7b87){_0x4c3271=_0x5c7b87['length'];if(!_0x34aee5[_0xd1ce('0x4b')][_0xd1ce('0xc9')]('nolimit')){_0x975a53['limit']=qs[_0xd1ce('0x1c')](_0x34aee5[_0xd1ce('0x4b')][_0xd1ce('0x1c')]);_0x975a53['offset']=qs['offset'](_0x34aee5[_0xd1ce('0x4b')]['offset']);}return _0xc6c65[_0xd1ce('0xe3')](_0x975a53);}})['then'](function(_0x357d9e){if(_0x357d9e){return _0x357d9e?{'count':_0x4c3271,'rows':_0x357d9e}:null;}})[_0xd1ce('0x2b')](respondWithResult(_0x17cd49,null))[_0xd1ce('0x29')](handleError(_0x17cd49,null));};exports['getMailInteractions']=function(_0x4f5511,_0x15921d){var _0x4c6b3a={'raw':!![],'where':{}};var _0x5692bc={};var _0x4a7147={'count':0x0,'rows':[]};return db[_0xd1ce('0x40')][_0xd1ce('0xc7')]({'where':{'id':_0x4f5511['params']['id']}})[_0xd1ce('0x2b')](handleEntityNotFound(_0x15921d,null))[_0xd1ce('0x2b')](function(_0x29170e){if(_0x29170e){_0x5692bc[_0xd1ce('0xd3')]=_[_0xd1ce('0xcf')](db[_0xd1ce('0xe5')][_0xd1ce('0xdc')]);_0x5692bc['query']=_[_0xd1ce('0xcf')](_0x4f5511[_0xd1ce('0x4b')]);_0x5692bc['filters']=_[_0xd1ce('0xd2')](_0x5692bc[_0xd1ce('0xd3')],_0x5692bc[_0xd1ce('0x4b')]);_0x4c6b3a['attributes']=_[_0xd1ce('0xd2')](_0x5692bc[_0xd1ce('0xd3')],qs['fields'](_0x4f5511['query'][_0xd1ce('0xd9')]));_0x4c6b3a['attributes']=_0x4c6b3a[_0xd1ce('0x50')][_0xd1ce('0x54')]?_0x4c6b3a[_0xd1ce('0x50')]:_0x5692bc[_0xd1ce('0xd3')];if(!_0x4f5511[_0xd1ce('0x4b')]['hasOwnProperty']('nolimit')){_0x4c6b3a[_0xd1ce('0x1c')]=qs[_0xd1ce('0x1c')](_0x4f5511[_0xd1ce('0x4b')]['limit']);_0x4c6b3a[_0xd1ce('0x1b')]=qs['offset'](_0x4f5511[_0xd1ce('0x4b')][_0xd1ce('0x1b')]);}_0x4c6b3a[_0xd1ce('0xd4')]=qs['sort'](_0x4f5511[_0xd1ce('0x4b')]['sort']);_0x4c6b3a[_0xd1ce('0x4a')]=qs['filters'](_[_0xd1ce('0xda')](_0x4f5511['query'],_0x5692bc[_0xd1ce('0xd1')]));_0x4c6b3a[_0xd1ce('0x4a')][_0xd1ce('0xdf')]=_0x29170e['id'];if(_0x4f5511[_0xd1ce('0x4b')][_0xd1ce('0x37')]){_0x4c6b3a[_0xd1ce('0x4a')]=_[_0xd1ce('0xd6')](_0x4c6b3a[_0xd1ce('0x4a')],{'$or':_['map'](_0x4c6b3a[_0xd1ce('0x50')],function(_0x24562a){var _0x436ffa={};_0x436ffa[_0x24562a]={'$like':'%'+_0x4f5511[_0xd1ce('0x4b')][_0xd1ce('0x37')]+'%'};return _0x436ffa;})});}_0x4c6b3a=_['merge']({},_0x4c6b3a,_0x4f5511[_0xd1ce('0x5d')]);return db[_0xd1ce('0xe5')]['count']({'where':_0x4c6b3a[_0xd1ce('0x4a')]})['then'](function(_0x155b84){_0x4a7147['count']=_0x155b84;if(_0x4f5511[_0xd1ce('0x4b')][_0xd1ce('0x4c')]){_0x4c6b3a[_0xd1ce('0x4d')]=[{'all':!![]}];}return db[_0xd1ce('0xe5')]['findAll'](_0x4c6b3a);})[_0xd1ce('0x2b')](function(_0x403f8c){_0x4a7147['rows']=_0x403f8c;return _0x4a7147;});}})[_0xd1ce('0x2b')](respondWithFilteredResult(_0x15921d,_0x4c6b3a))[_0xd1ce('0x29')](handleError(_0x15921d,null));};exports[_0xd1ce('0xe6')]=function(_0x2f507d,_0x11180c){var _0xe9fcb8={};var _0x5693ef={};var _0x343c24;var _0x1ae40a;return db[_0xd1ce('0x40')][_0xd1ce('0xc7')]({'where':{'id':_0x2f507d[_0xd1ce('0x60')]['id']}})[_0xd1ce('0x2b')](handleEntityNotFound(_0x11180c,null))[_0xd1ce('0x2b')](function(_0x32c3da){if(_0x32c3da){_0x343c24=_0x32c3da;_0x5693ef[_0xd1ce('0xd3')]=_['keys'](db[_0xd1ce('0xe7')]['rawAttributes']);_0x5693ef[_0xd1ce('0x4b')]=_[_0xd1ce('0xcf')](_0x2f507d[_0xd1ce('0x4b')]);_0x5693ef['filters']=_[_0xd1ce('0xd2')](_0x5693ef[_0xd1ce('0xd3')],_0x5693ef[_0xd1ce('0x4b')]);_0xe9fcb8[_0xd1ce('0x50')]=_[_0xd1ce('0xd2')](_0x5693ef['model'],qs[_0xd1ce('0xd9')](_0x2f507d[_0xd1ce('0x4b')][_0xd1ce('0xd9')]));_0xe9fcb8[_0xd1ce('0x50')]=_0xe9fcb8[_0xd1ce('0x50')]['length']?_0xe9fcb8[_0xd1ce('0x50')]:_0x5693ef[_0xd1ce('0xd3')];_0xe9fcb8[_0xd1ce('0xd4')]=qs[_0xd1ce('0xd5')](_0x2f507d[_0xd1ce('0x4b')][_0xd1ce('0xd5')]);_0xe9fcb8['where']=qs[_0xd1ce('0xd1')](_[_0xd1ce('0xda')](_0x2f507d[_0xd1ce('0x4b')],_0x5693ef[_0xd1ce('0xd1')]));if(_0x2f507d[_0xd1ce('0x4b')][_0xd1ce('0x37')]){_0xe9fcb8[_0xd1ce('0x4a')]=_['merge'](_0xe9fcb8[_0xd1ce('0x4a')],{'$or':_[_0xd1ce('0x38')](_0xe9fcb8['attributes'],function(_0x57fa30){var _0x194385={};_0x194385[_0x57fa30]={'$like':'%'+_0x2f507d['query'][_0xd1ce('0x37')]+'%'};return _0x194385;})});}_0xe9fcb8=_[_0xd1ce('0xd6')]({},_0xe9fcb8,_0x2f507d[_0xd1ce('0x5d')]);return _0x343c24[_0xd1ce('0xe6')](_0xe9fcb8);}})[_0xd1ce('0x2b')](function(_0x4cef00){if(_0x4cef00){_0x1ae40a=_0x4cef00[_0xd1ce('0x54')];if(!_0x2f507d['query']['hasOwnProperty']('nolimit')){_0xe9fcb8[_0xd1ce('0x1c')]=qs['limit'](_0x2f507d[_0xd1ce('0x4b')][_0xd1ce('0x1c')]);_0xe9fcb8[_0xd1ce('0x1b')]=qs['offset'](_0x2f507d[_0xd1ce('0x4b')][_0xd1ce('0x1b')]);}return _0x343c24[_0xd1ce('0xe6')](_0xe9fcb8);}})[_0xd1ce('0x2b')](function(_0x34a3a5){if(_0x34a3a5){return _0x34a3a5?{'count':_0x1ae40a,'rows':_0x34a3a5}:null;}})[_0xd1ce('0x2b')](respondWithResult(_0x11180c,null))[_0xd1ce('0x29')](handleError(_0x11180c,null));};exports[_0xd1ce('0xe8')]=function(_0x54e46d,_0x44c3a6){var _0x2d14fc={};var _0x286a75={};var _0x1a0572;var _0x39e474;return db[_0xd1ce('0x40')][_0xd1ce('0xc7')]({'where':{'id':_0x54e46d[_0xd1ce('0x60')]['id']}})['then'](handleEntityNotFound(_0x44c3a6,null))[_0xd1ce('0x2b')](function(_0x1cf76e){if(_0x1cf76e){_0x1a0572=_0x1cf76e;_0x286a75[_0xd1ce('0xd3')]=_[_0xd1ce('0xcf')](db[_0xd1ce('0xe9')][_0xd1ce('0xdc')]);_0x286a75[_0xd1ce('0x4b')]=_[_0xd1ce('0xcf')](_0x54e46d[_0xd1ce('0x4b')]);_0x286a75[_0xd1ce('0xd1')]=_[_0xd1ce('0xd2')](_0x286a75[_0xd1ce('0xd3')],_0x286a75[_0xd1ce('0x4b')]);_0x2d14fc['attributes']=_[_0xd1ce('0xd2')](_0x286a75[_0xd1ce('0xd3')],qs[_0xd1ce('0xd9')](_0x54e46d[_0xd1ce('0x4b')][_0xd1ce('0xd9')]));_0x2d14fc['attributes']=_0x2d14fc['attributes'][_0xd1ce('0x54')]?_0x2d14fc[_0xd1ce('0x50')]:_0x286a75[_0xd1ce('0xd3')];_0x2d14fc[_0xd1ce('0xd4')]=qs[_0xd1ce('0xd5')](_0x54e46d['query']['sort']);_0x2d14fc[_0xd1ce('0x4a')]=qs[_0xd1ce('0xd1')](_['pick'](_0x54e46d[_0xd1ce('0x4b')],_0x286a75[_0xd1ce('0xd1')]));if(_0x54e46d['query'][_0xd1ce('0x37')]){_0x2d14fc[_0xd1ce('0x4a')]=_[_0xd1ce('0xd6')](_0x2d14fc[_0xd1ce('0x4a')],{'$or':_[_0xd1ce('0x38')](_0x2d14fc[_0xd1ce('0x50')],function(_0x3cc6d0){var _0x177cd4={};_0x177cd4[_0x3cc6d0]={'$like':'%'+_0x54e46d[_0xd1ce('0x4b')][_0xd1ce('0x37')]+'%'};return _0x177cd4;})});}_0x2d14fc=_[_0xd1ce('0xd6')]({},_0x2d14fc,_0x54e46d[_0xd1ce('0x5d')]);return _0x1a0572[_0xd1ce('0xe8')](_0x2d14fc);}})[_0xd1ce('0x2b')](function(_0x4cbfbe){if(_0x4cbfbe){_0x39e474=_0x4cbfbe[_0xd1ce('0x54')];if(!_0x54e46d[_0xd1ce('0x4b')][_0xd1ce('0xc9')](_0xd1ce('0xd7'))){_0x2d14fc[_0xd1ce('0x1c')]=qs[_0xd1ce('0x1c')](_0x54e46d[_0xd1ce('0x4b')][_0xd1ce('0x1c')]);_0x2d14fc[_0xd1ce('0x1b')]=qs[_0xd1ce('0x1b')](_0x54e46d[_0xd1ce('0x4b')][_0xd1ce('0x1b')]);}return _0x1a0572['getFaxInteractions'](_0x2d14fc);}})[_0xd1ce('0x2b')](function(_0x2ebacf){if(_0x2ebacf){return _0x2ebacf?{'count':_0x39e474,'rows':_0x2ebacf}:null;}})[_0xd1ce('0x2b')](respondWithResult(_0x44c3a6,null))[_0xd1ce('0x29')](handleError(_0x44c3a6,null));};exports[_0xd1ce('0xea')]=function(_0x303b1c,_0x564e62){var _0x323bba={};var _0xd5c34e={};var _0x585112;var _0x5039b8;return db[_0xd1ce('0x40')][_0xd1ce('0xc7')]({'where':{'id':_0x303b1c[_0xd1ce('0x60')]['id']}})[_0xd1ce('0x2b')](handleEntityNotFound(_0x564e62,null))[_0xd1ce('0x2b')](function(_0x25edcb){if(_0x25edcb){_0x585112=_0x25edcb;_0xd5c34e[_0xd1ce('0xd3')]=_[_0xd1ce('0xcf')](db['WhatsappInteraction']['rawAttributes']);_0xd5c34e[_0xd1ce('0x4b')]=_['keys'](_0x303b1c['query']);_0xd5c34e['filters']=_[_0xd1ce('0xd2')](_0xd5c34e[_0xd1ce('0xd3')],_0xd5c34e[_0xd1ce('0x4b')]);_0x323bba[_0xd1ce('0x50')]=_['intersection'](_0xd5c34e[_0xd1ce('0xd3')],qs[_0xd1ce('0xd9')](_0x303b1c[_0xd1ce('0x4b')][_0xd1ce('0xd9')]));_0x323bba[_0xd1ce('0x50')]=_0x323bba[_0xd1ce('0x50')][_0xd1ce('0x54')]?_0x323bba[_0xd1ce('0x50')]:_0xd5c34e['model'];_0x323bba[_0xd1ce('0xd4')]=qs[_0xd1ce('0xd5')](_0x303b1c[_0xd1ce('0x4b')]['sort']);_0x323bba[_0xd1ce('0x4a')]=qs[_0xd1ce('0xd1')](_[_0xd1ce('0xda')](_0x303b1c[_0xd1ce('0x4b')],_0xd5c34e['filters']));if(_0x303b1c[_0xd1ce('0x4b')][_0xd1ce('0x37')]){_0x323bba['where']=_[_0xd1ce('0xd6')](_0x323bba[_0xd1ce('0x4a')],{'$or':_[_0xd1ce('0x38')](_0x323bba[_0xd1ce('0x50')],function(_0x1471ce){var _0xfc487c={};_0xfc487c[_0x1471ce]={'$like':'%'+_0x303b1c[_0xd1ce('0x4b')][_0xd1ce('0x37')]+'%'};return _0xfc487c;})});}_0x323bba=_[_0xd1ce('0xd6')]({},_0x323bba,_0x303b1c[_0xd1ce('0x5d')]);return _0x585112[_0xd1ce('0xea')](_0x323bba);}})[_0xd1ce('0x2b')](function(_0x5ce444){if(_0x5ce444){_0x5039b8=_0x5ce444[_0xd1ce('0x54')];if(!_0x303b1c[_0xd1ce('0x4b')]['hasOwnProperty'](_0xd1ce('0xd7'))){_0x323bba[_0xd1ce('0x1c')]=qs[_0xd1ce('0x1c')](_0x303b1c[_0xd1ce('0x4b')]['limit']);_0x323bba[_0xd1ce('0x1b')]=qs[_0xd1ce('0x1b')](_0x303b1c['query'][_0xd1ce('0x1b')]);}return _0x585112[_0xd1ce('0xea')](_0x323bba);}})[_0xd1ce('0x2b')](function(_0xd64af2){if(_0xd64af2){return _0xd64af2?{'count':_0x5039b8,'rows':_0xd64af2}:null;}})['then'](respondWithResult(_0x564e62,null))[_0xd1ce('0x29')](handleError(_0x564e62,null));};exports[_0xd1ce('0xeb')]=function(_0x540ff7,_0x7a67b,_0x41223d){var _0xf251f9;var _0x12877d;var _0x3b9a99;var _0x86df0a=!_['isNil'](_0x540ff7[_0xd1ce('0x60')]['id'])?_0x540ff7['params']['id']:!_[_0xd1ce('0x6a')](_0x540ff7[_0xd1ce('0x34')]['id'])?_0x540ff7[_0xd1ce('0x34')]['id']:null;return db[_0xd1ce('0x40')][_0xd1ce('0x3b')]({'where':{'id':_0x86df0a,'role':{'$or':['admin',_0xd1ce('0x34'),_0xd1ce('0x2d')]}},'attributes':['id',_0xd1ce('0x3c'),_0xd1ce('0xec'),_0xd1ce('0xed'),_0xd1ce('0x2c'),_0xd1ce('0x65'),_0xd1ce('0x9d')]})['then'](function(_0x43d8b3){if(_0x43d8b3){if(_0x43d8b3[_0xd1ce('0x2c')]===_0xd1ce('0x2d')){_0xf251f9=_0x43d8b3;if(_0x540ff7[_0xd1ce('0x5f')][_0xd1ce('0xa8')]){_0x3b9a99=util[_0xd1ce('0xa9')]('LOCAL/%s@from-sip/n',_0xf251f9[_0x540ff7[_0xd1ce('0x5f')][_0xd1ce('0xa8')]]);}else if(_0x540ff7[_0xd1ce('0x5f')]['intrf']){_0x3b9a99=util[_0xd1ce('0xa9')](_0xd1ce('0xaa'),_0x540ff7[_0xd1ce('0x5f')][_0xd1ce('0xee')]);}else{_0x3b9a99=util['format'](_0xd1ce('0xaa'),_0xf251f9[_0xd1ce('0x3c')]);}socket['to'](util[_0xd1ce('0xa9')]('user:%s',_0xf251f9[_0xd1ce('0x3c')]))[_0xd1ce('0x2e')](_0xd1ce('0xef'),{'user':{'id':_0xf251f9['id'],'name':_0xf251f9[_0xd1ce('0x3c')]},'ip':_0x540ff7['headers'][_0xd1ce('0xf0')]||_0x540ff7['connection'][_0xd1ce('0xf1')]||_0x540ff7[_0xd1ce('0xf2')]['remoteAddress']||_0x540ff7[_0xd1ce('0xf3')][_0xd1ce('0xf2')]['remoteAddress']});return new Promise(function(_0x1c0ac6,_0x50e421){db[_0xd1ce('0x6c')]['transaction']()[_0xd1ce('0x2b')](_0x20256b=>{db[_0xd1ce('0xab')][_0xd1ce('0x30')]({'where':{'membername':_0xf251f9[_0xd1ce('0x3c')]},'individualHooks':!![]},{'transaction':_0x20256b})[_0xd1ce('0x2b')](function(){return _0x20256b['commit']();})[_0xd1ce('0x2b')](_0x1c0ac6)[_0xd1ce('0x29')](_0x50e421);});});}}else{throw new db[(_0xd1ce('0x90'))][(_0xd1ce('0x91'))](_0xd1ce('0xf4'));}})[_0xd1ce('0x2b')](function(){if(_0xf251f9){return _0xf251f9['getVoiceQueues']({'raw':!![]});}})[_0xd1ce('0x2b')](function(_0x39cc8e){if(_0xf251f9){if(_0x39cc8e){_0x12877d=_0x39cc8e;if(_0x12877d[_0xd1ce('0x54')]){var _0x402449=_0x12877d['map'](function(_0x3a42a9){return{'membername':_0xf251f9[_0xd1ce('0x3c')],'UserId':_0xf251f9['id'],'queue_name':_0x3a42a9[_0xd1ce('0x3c')],'VoiceQueueId':_0x3a42a9['id'],'interface':_0x3b9a99,'paused':_0xf251f9[_0xd1ce('0x9d')]||![],'penalty':_0x3a42a9[_0xd1ce('0xf5')]||0x0};});return db[_0xd1ce('0xab')][_0xd1ce('0x87')](_0x402449);}}}})[_0xd1ce('0x2b')](function(){if(_0xf251f9){return db['MemberReport']['findAll']({'where':{'membername':_0xf251f9[_0xd1ce('0x3c')],'exitAt':null}});}})['then'](function(_0xa64211){if(_0xf251f9){var _0xf57f2c=[];_0xa64211[_0xd1ce('0xf6')](function(_0x48fdee){_0xf57f2c[_0xd1ce('0x55')](_0x48fdee['update']({'exitAt':moment()[_0xd1ce('0xa9')](_0xd1ce('0xf7'))}));});return Promise[_0xd1ce('0x5a')](_0xf57f2c);}})[_0xd1ce('0x2b')](function(){if(_0xf251f9){var _0x37004d=[];var _0x37f90c=[];var _0x94114d=utils[_0xd1ce('0xf8')]();var _0x28bd8b={'membername':_0xf251f9[_0xd1ce('0x3c')],'interface':_0x3b9a99,'enterAt':moment()[_0xd1ce('0xa9')](_0xd1ce('0xf7')),'role':_0xf251f9[_0xd1ce('0x2c')],'internal':_0xf251f9[_0xd1ce('0x65')]};_0x94114d[_0xd1ce('0xf6')](function(_0x3eb4dd){_0x37004d[_0xd1ce('0x55')](_[_0xd1ce('0xd6')]({'channel':_0x3eb4dd,'type':_0xd1ce('0xf9'),'data1':_0x540ff7[_0xd1ce('0x5f')][_0xd1ce('0xfa')],'data2':_0x3b9a99},_0x28bd8b));if(_0xf251f9['loginInPause']){_0x37f90c[_0xd1ce('0x55')](_[_0xd1ce('0xd6')]({'channel':_0x3eb4dd,'type':'PAUSE','data1':_0xd1ce('0xfb')},_0x28bd8b));}});return db[_0xd1ce('0xfc')][_0xd1ce('0x87')](_0x37004d[_0xd1ce('0xc5')](_0x37f90c),{'individualHooks':!![]});}})['then'](function(){if(_0xf251f9){return _0xf251f9['update']({'online':!![],'lastLoginAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0xf251f9[_0xd1ce('0x9d')]||![],'mailPause':_0xf251f9[_0xd1ce('0x9d')]||![],'chatPause':_0xf251f9[_0xd1ce('0x9d')]||![],'faxPause':_0xf251f9[_0xd1ce('0x9d')]||![],'smsPause':_0xf251f9[_0xd1ce('0x9d')]||![],'openchannelPause':_0xf251f9[_0xd1ce('0x9d')]||![],'whatsappPause':_0xf251f9[_0xd1ce('0x9d')]||![],'pauseType':_0xf251f9[_0xd1ce('0x9d')]?_0xd1ce('0xfb'):null,'interface':_0x3b9a99,'lastPauseAt':moment()[_0xd1ce('0xa9')](_0xd1ce('0xf7'))});}})[_0xd1ce('0x2b')](function(_0xb65c10){if(_0x540ff7[_0xd1ce('0xfd')]){return _0x41223d();}else{return Promise[_0xd1ce('0xfe')](_0xb65c10)[_0xd1ce('0x2b')](respondWithResult(_0x7a67b,null));}})[_0xd1ce('0x29')](handleError(_0x7a67b,null));};exports[_0xd1ce('0xff')]=function(_0x462f77,_0x338c02){var _0x59b6da;return db[_0xd1ce('0x40')][_0xd1ce('0x3b')]({'where':{'id':_0x462f77[_0xd1ce('0x60')]['id'],'role':_0xd1ce('0x2d')},'attributes':['id',_0xd1ce('0x3c'),'role']})[_0xd1ce('0x2b')](handleEntityNotFound(_0x338c02,null))[_0xd1ce('0x2b')](function(_0x250fc8){if(_0x250fc8){_0x59b6da=_0x250fc8;return db[_0xd1ce('0xab')]['destroy']({'where':{'membername':_0x59b6da['name']},'individualHooks':!![]});}})[_0xd1ce('0x2b')](function(){return db[_0xd1ce('0xfc')][_0xd1ce('0x51')]({'where':{'membername':_0x59b6da[_0xd1ce('0x3c')],'exitAt':null}});})[_0xd1ce('0x2b')](function(_0x3690c1){var _0x5e276b=[];_0x3690c1[_0xd1ce('0xf6')](function(_0x2c8dd8){_0x5e276b[_0xd1ce('0x55')](_0x2c8dd8[_0xd1ce('0x2a')]({'exitAt':moment()[_0xd1ce('0xa9')]('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise[_0xd1ce('0x5a')](_0x5e276b);})[_0xd1ce('0x2b')](function(){return _0x59b6da[_0xd1ce('0x2a')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0xd1ce('0x2b')](respondWithResult(_0x338c02,null))[_0xd1ce('0x29')](handleError(_0x338c02,null));};exports[_0xd1ce('0x100')]=function(_0x158729,_0x4ea14d){var _0x2beaf7;return db[_0xd1ce('0xab')][_0xd1ce('0x2a')]({'paused':0x1},{'where':{'UserId':_0x158729[_0xd1ce('0x60')]['id']},'individualHooks':!![]})[_0xd1ce('0x2b')](function(){return db[_0xd1ce('0x40')][_0xd1ce('0x3b')]({'where':{'id':_0x158729[_0xd1ce('0x60')]['id'],'role':_0xd1ce('0x2d')},'attributes':['id',_0xd1ce('0x3c'),_0xd1ce('0x2c'),'internal',_0xd1ce('0xa8'),'online']});})[_0xd1ce('0x2b')](handleEntityNotFound(_0x4ea14d,null))['then'](function(_0x438967){if(_0x438967){_0x2beaf7=_0x438967;return respondWithRpcPromise(_0xd1ce('0x101'),_0xd1ce('0x100'),{'id':_0x2beaf7['id'],'name':_0x2beaf7[_0xd1ce('0x3c')],'pause':!![]});}})[_0xd1ce('0x2b')](function(){if(_0x2beaf7){return db[_0xd1ce('0xfc')]['findAll']({'where':{'membername':_0x2beaf7['name'],'type':'PAUSE','exitAt':null}});}})[_0xd1ce('0x2b')](function(_0x5adeea){if(_0x5adeea[_0xd1ce('0x54')]){var _0x1cff47=moment()[_0xd1ce('0xa9')](_0xd1ce('0xf7'));for(var _0x59ef80=0x0,_0x1a26f1=_0x5adeea[_0xd1ce('0x54')];_0x59ef80<_0x1a26f1;_0x59ef80++){_0x5adeea[_0x59ef80][_0xd1ce('0x102')]({'exitAt':_0x1cff47});}}})[_0xd1ce('0x2b')](function(){var _0x5957b8=[];var _0x2d2c90=utils[_0xd1ce('0xf8')]();_0x2d2c90['forEach'](function(_0x57c560){_0x5957b8[_0xd1ce('0x55')]({'channel':_0x57c560,'membername':_0x2beaf7[_0xd1ce('0x3c')],'interface':_[_0xd1ce('0x6a')](_0x2beaf7[_0xd1ce('0xa8')])?util[_0xd1ce('0xa9')]('SIP/%s',_0x2beaf7['name']):_0x2beaf7[_0xd1ce('0xa8')],'type':_0xd1ce('0x103'),'enterAt':moment()['format'](_0xd1ce('0xf7')),'data1':_0x158729['body'][_0xd1ce('0x42')]||_0xd1ce('0x104'),'role':_0x2beaf7['role'],'internal':_0x2beaf7['internal']});});return db[_0xd1ce('0xfc')][_0xd1ce('0x87')](_0x5957b8,{'individualHooks':!![]});})['then'](function(){return _0x2beaf7[_0xd1ce('0x2a')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x158729['body'][_0xd1ce('0x42')]||_0xd1ce('0x104'),'lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')});})[_0xd1ce('0x2b')](respondWithResult(_0x4ea14d,null))[_0xd1ce('0x29')](handleError(_0x4ea14d,null));};exports['unpause']=function(_0x1aac9a,_0x501a77){if(_0x1aac9a[_0xd1ce('0x5f')][_0xd1ce('0x9b')]&&!utils['isValidChannel'](_0x1aac9a[_0xd1ce('0x5f')]['channel'])){throw new APIBadRequestError(util[_0xd1ce('0xa9')](_0xd1ce('0x105'),_0x1aac9a[_0xd1ce('0x5f')]['channel']));}return db[_0xd1ce('0x40')][_0xd1ce('0x3b')]({'where':{'id':_0x1aac9a[_0xd1ce('0x60')]['id']},'attributes':['id',_0xd1ce('0x3c'),_0xd1ce('0x2c'),_0xd1ce('0x65'),'interface',_0xd1ce('0x9c'),_0xd1ce('0x9e'),_0xd1ce('0x106'),_0xd1ce('0x107'),_0xd1ce('0x108'),_0xd1ce('0x109'),_0xd1ce('0x10a'),_0xd1ce('0x10b'),_0xd1ce('0x10c'),_0xd1ce('0x10d')]})[_0xd1ce('0x2b')](function(_0x1beee8){if(!_0x1beee8){throw new APINotFoundError(util['format'](_0xd1ce('0xc8'),_0x1aac9a['params']['id']));}return _0x1beee8[_0xd1ce('0x10e')](_0x1aac9a[_0xd1ce('0x5f')][_0xd1ce('0x9b')]);})[_0xd1ce('0x2b')](respondWithResult(_0x501a77,null))[_0xd1ce('0x29')](APIHandleError(_0x501a77));};exports[_0xd1ce('0x10f')]=function(_0x5c6fd1,_0xf66c80){var _0x32bd4c={};var _0x201549={};var _0x3df822;var _0xb93c2b;return db[_0xd1ce('0x40')][_0xd1ce('0xc7')]({'where':{'id':_0x5c6fd1['params']['id']}})[_0xd1ce('0x2b')](handleEntityNotFound(_0xf66c80,null))[_0xd1ce('0x2b')](function(_0x95736f){if(_0x95736f){_0x3df822=_0x95736f;_0x201549[_0xd1ce('0xd3')]=_[_0xd1ce('0xcf')](db['Team']['rawAttributes']);_0x201549['query']=_['keys'](_0x5c6fd1[_0xd1ce('0x4b')]);_0x201549[_0xd1ce('0xd1')]=_['intersection'](_0x201549[_0xd1ce('0xd3')],_0x201549[_0xd1ce('0x4b')]);_0x32bd4c[_0xd1ce('0x50')]=_['intersection'](_0x201549[_0xd1ce('0xd3')],qs['fields'](_0x5c6fd1[_0xd1ce('0x4b')][_0xd1ce('0xd9')]));_0x32bd4c[_0xd1ce('0x50')]=_0x32bd4c[_0xd1ce('0x50')][_0xd1ce('0x54')]?_0x32bd4c[_0xd1ce('0x50')]:_0x201549['model'];_0x32bd4c[_0xd1ce('0xd4')]=qs[_0xd1ce('0xd5')](_0x5c6fd1['query'][_0xd1ce('0xd5')]);_0x32bd4c[_0xd1ce('0x4a')]=qs[_0xd1ce('0xd1')](_['pick'](_0x5c6fd1[_0xd1ce('0x4b')],_0x201549[_0xd1ce('0xd1')]));if(_0x5c6fd1[_0xd1ce('0x4b')][_0xd1ce('0x37')]){_0x32bd4c[_0xd1ce('0x4a')]=_[_0xd1ce('0xd6')](_0x32bd4c[_0xd1ce('0x4a')],{'$or':_[_0xd1ce('0x38')](_0x32bd4c['attributes'],function(_0x447754){var _0x35993c={};_0x35993c[_0x447754]={'$like':'%'+_0x5c6fd1[_0xd1ce('0x4b')][_0xd1ce('0x37')]+'%'};return _0x35993c;})});}_0x32bd4c=_[_0xd1ce('0xd6')]({},_0x32bd4c,_0x5c6fd1[_0xd1ce('0x5d')]);return _0x3df822[_0xd1ce('0x10f')](_0x32bd4c);}})[_0xd1ce('0x2b')](function(_0x2c906d){if(_0x2c906d){_0xb93c2b=_0x2c906d[_0xd1ce('0x54')];if(!_0x5c6fd1[_0xd1ce('0x4b')]['hasOwnProperty'](_0xd1ce('0xd7'))){_0x32bd4c[_0xd1ce('0x1c')]=qs[_0xd1ce('0x1c')](_0x5c6fd1['query'][_0xd1ce('0x1c')]);_0x32bd4c[_0xd1ce('0x1b')]=qs[_0xd1ce('0x1b')](_0x5c6fd1['query'][_0xd1ce('0x1b')]);}return _0x3df822['getTeams'](_0x32bd4c);}})[_0xd1ce('0x2b')](function(_0x2465eb){if(_0x2465eb){return _0x2465eb?{'count':_0xb93c2b,'rows':_0x2465eb}:null;}})[_0xd1ce('0x2b')](respondWithResult(_0xf66c80,null))['catch'](handleError(_0xf66c80,null));};exports[_0xd1ce('0x110')]=function(_0x510382,_0x33fcb0){var _0x3651b5=_0x510382[_0xd1ce('0x60')]['id'];var _0x1aaad9=_0x510382[_0xd1ce('0x5f')]?_0x510382[_0xd1ce('0x5f')][_0xd1ce('0x63')]:null;var _0x46dc69=[];return Promise[_0xd1ce('0xfe')]()[_0xd1ce('0x2b')](function(){if(!_0x1aaad9)throw new APIBadRequestError('Body\x20parameter\x20\x27ids\x27\x20is\x20required');})[_0xd1ce('0x2b')](function(){return db['User'][_0xd1ce('0xc7')]({'where':{'id':_0x3651b5}});})[_0xd1ce('0x2b')](function(_0x3ab50b){if(!_0x3ab50b)throw new APINotFoundError(util['format'](_0xd1ce('0xc8'),_0x510382[_0xd1ce('0x60')]['id']));return db[_0xd1ce('0x6c')][_0xd1ce('0x111')](function(_0x5e871e){return _0x3ab50b[_0xd1ce('0x110')](_0x1aaad9,{'transaction':_0x5e871e})['then'](function(){return db[_0xd1ce('0x112')]['findAll']({'where':{'id':{'$in':_0x1aaad9}}});})['then'](function(_0x289c54){var _0x3d191b=_[_0xd1ce('0x38')](_0x289c54,function(_0x512f4a){return _0x512f4a[_0xd1ce('0x113')]();});return Promise[_0xd1ce('0x5a')](_0x3d191b);})[_0xd1ce('0x2b')](function(_0xb1e3a1){_0x46dc69=_['flattenDeep'](_0xb1e3a1);var _0x2685b0=_['map'](_0x46dc69,function(_0x150bbf){return _0x150bbf['addAgent'](_0x3ab50b['id'],{'transaction':_0x5e871e});});return Promise[_0xd1ce('0x5a')](_0x2685b0);})[_0xd1ce('0x2b')](function(){if(!_0x3ab50b[_0xd1ce('0x9c')])return;var _0xfc8e41=_[_0xd1ce('0x37')](_0x46dc69,function(_0x82cba7){return _0x82cba7[_0xd1ce('0x114')]('channel')===_0xd1ce('0x115');});var _0x1d8b72=_['map'](_0xfc8e41,function(_0x2ee055){return db['UserVoiceQueueRt'][_0xd1ce('0xac')]({'membername':_0x3ab50b['name'],'UserId':_0x3ab50b['id'],'queue_name':_0x2ee055[_0xd1ce('0x3c')],'VoiceQueueId':_0x2ee055['id'],'interface':_[_0xd1ce('0x6a')](_0x3ab50b[_0xd1ce('0xa8')])?util[_0xd1ce('0xa9')](_0xd1ce('0xaa'),_0x3ab50b['name']):_0x3ab50b[_0xd1ce('0xa8')],'paused':_0x3ab50b[_0xd1ce('0x9e')]||![],'penalty':_0x3ab50b[_0xd1ce('0xa3')]},{'transaction':_0x5e871e});});return Promise[_0xd1ce('0x5a')](_0x1d8b72);})[_0xd1ce('0x2b')](function(){return db['TeamVoicePrefix'][_0xd1ce('0x51')]({'where':{'teamId':{'$in':_0x1aaad9}}});})['then'](function(_0x4bd0fc){var _0x17f623=_[_0xd1ce('0x38')](_0x4bd0fc,function(_0x30f8d5){return db[_0xd1ce('0x116')]['create']({'UserId':_0x3ab50b['id'],'VoicePrefixId':_0x30f8d5[_0xd1ce('0x117')]},{'transaction':_0x5e871e});});return Promise['all'](_0x17f623);});});})[_0xd1ce('0x2b')](function(){for(var _0x1052d2=0x0;_0x1052d2<_0x46dc69[_0xd1ce('0x54')];_0x1052d2++){var _0x2c1c28=_0x46dc69[_0x1052d2]['getDataValue'](_0xd1ce('0x9b'));var _0x35b479=_0x2c1c28+_0xd1ce('0xa6');socket[_0xd1ce('0x2e')](_0xd1ce('0x34')+_0x2c1c28+_0xd1ce('0x118'),{'UserId':_0x3651b5,['queueField']:_0x46dc69[_0x1052d2]['id']});}})[_0xd1ce('0x2b')](respondWithStatusCode(_0x33fcb0,null))[_0xd1ce('0x29')](APIHandleError(_0x33fcb0));};exports[_0xd1ce('0x119')]=function(_0x33c84c,_0x1bdd39){var _0x4ae26d=_0x33c84c['params']['id'];var _0x3b135=null;if(_0x33c84c[_0xd1ce('0x4b')]['ids']){_0x3b135=_['isArray'](_0x33c84c[_0xd1ce('0x4b')][_0xd1ce('0x63')])?_0x33c84c['query']['ids']:[_0x33c84c[_0xd1ce('0x4b')][_0xd1ce('0x63')]];}var _0x138a0a=[];return Promise['resolve']()[_0xd1ce('0x2b')](function(){if(!_0x3b135)throw new APIBadRequestError(_0xd1ce('0x11a'));})[_0xd1ce('0x2b')](function(){return db[_0xd1ce('0x40')][_0xd1ce('0xc7')]({'where':{'id':_0x4ae26d}});})[_0xd1ce('0x2b')](function(_0x26d50b){if(!_0x26d50b)throw new APINotFoundError(util[_0xd1ce('0xa9')](_0xd1ce('0xc8'),_0x33c84c['params']['id']));return db[_0xd1ce('0x6c')][_0xd1ce('0x111')](function(_0x5b296e){return _0x26d50b[_0xd1ce('0x119')](_0x3b135,{'transaction':_0x5b296e})[_0xd1ce('0x2b')](function(){return db[_0xd1ce('0x112')][_0xd1ce('0x51')]({'where':{'id':{'$in':_0x3b135}}});})[_0xd1ce('0x2b')](function(_0x15be85){var _0x45b48f=_[_0xd1ce('0x38')](_0x15be85,function(_0x58bcdb){return _0x58bcdb[_0xd1ce('0x113')]();});return Promise[_0xd1ce('0x5a')](_0x45b48f);})[_0xd1ce('0x2b')](function(_0x238303){_0x138a0a=_[_0xd1ce('0x11b')](_0x238303);var _0x30f23f=_[_0xd1ce('0x38')](_0x138a0a,function(_0x4a310c){return _0x4a310c['removeAgent'](_0x26d50b['id'],{'transaction':_0x5b296e});});return Promise[_0xd1ce('0x5a')](_0x30f23f);})[_0xd1ce('0x2b')](function(){if(!_0x26d50b['online'])return;var _0xcaf439=_[_0xd1ce('0x37')](_0x138a0a,function(_0x142a72){return _0x142a72[_0xd1ce('0x114')](_0xd1ce('0x9b'))===_0xd1ce('0x115');});var _0x265bd7=_[_0xd1ce('0x38')](_0xcaf439,function(_0x28f3f1){return db[_0xd1ce('0xab')][_0xd1ce('0x30')]({'where':{'VoiceQueueId':_0x28f3f1['id'],'UserId':_0x26d50b['id']},'transaction':_0x5b296e});});return Promise['all'](_0x265bd7);})[_0xd1ce('0x2b')](function(){return db['TeamVoicePrefix']['findAll']({'where':{'teamId':{'$in':_0x3b135}}});})[_0xd1ce('0x2b')](function(_0x304bbc){var _0x43e31c=_[_0xd1ce('0x38')](_0x304bbc,function(_0x389112){return db['UserVoicePrefix'][_0xd1ce('0x30')]({'where':{'UserId':_0x26d50b['id'],'VoicePrefixId':_0x389112[_0xd1ce('0x117')]}},{'transaction':_0x5b296e});});return Promise[_0xd1ce('0x5a')](_0x43e31c);});});})[_0xd1ce('0x2b')](function(){for(var _0x1d2c26=0x0;_0x1d2c26<_0x138a0a[_0xd1ce('0x54')];_0x1d2c26++){var _0x43b38e=_0x138a0a[_0x1d2c26][_0xd1ce('0x114')](_0xd1ce('0x9b'));var _0x325bfb=_0x43b38e+_0xd1ce('0xa6');socket[_0xd1ce('0x2e')](_0xd1ce('0x34')+_0x43b38e+'Queue:remove',{'UserId':_0x4ae26d,['queueField']:_0x138a0a[_0x1d2c26]['id']});}})[_0xd1ce('0x2b')](respondWithStatusCode(_0x1bdd39,null))[_0xd1ce('0x29')](APIHandleError(_0x1bdd39));};exports[_0xd1ce('0x11c')]=function(_0x40fe97,_0x433fe2){var _0x5c11bb={};var _0x263579={};var _0x1650f4;var _0x275852;return db[_0xd1ce('0x40')][_0xd1ce('0xc7')]({'where':{'id':_0x40fe97['params']['id']}})['then'](handleEntityNotFound(_0x433fe2,null))[_0xd1ce('0x2b')](function(_0x339d40){if(_0x339d40){_0x1650f4=_0x339d40;_0x263579[_0xd1ce('0xd3')]=_[_0xd1ce('0xcf')](db[_0xd1ce('0xca')]['rawAttributes']);_0x263579[_0xd1ce('0x4b')]=_[_0xd1ce('0xcf')](_0x40fe97[_0xd1ce('0x4b')]);_0x263579[_0xd1ce('0xd1')]=_['intersection'](_0x263579[_0xd1ce('0xd3')],_0x263579[_0xd1ce('0x4b')]);_0x5c11bb[_0xd1ce('0x50')]=_['intersection'](_0x263579[_0xd1ce('0xd3')],qs[_0xd1ce('0xd9')](_0x40fe97[_0xd1ce('0x4b')][_0xd1ce('0xd9')]));_0x5c11bb[_0xd1ce('0x50')]=_0x5c11bb['attributes'][_0xd1ce('0x54')]?_0x5c11bb[_0xd1ce('0x50')]:_0x263579[_0xd1ce('0xd3')];_0x5c11bb['order']=qs[_0xd1ce('0xd5')](_0x40fe97[_0xd1ce('0x4b')][_0xd1ce('0xd5')]);_0x5c11bb[_0xd1ce('0x4a')]=qs['filters'](_[_0xd1ce('0xda')](_0x40fe97['query'],_0x263579[_0xd1ce('0xd1')]));if(_0x40fe97[_0xd1ce('0x4b')][_0xd1ce('0x37')]){_0x5c11bb['where']=_[_0xd1ce('0xd6')](_0x5c11bb[_0xd1ce('0x4a')],{'$or':_[_0xd1ce('0x38')](_0x5c11bb['attributes'],function(_0xe54bb3){var _0x54c0e1={};_0x54c0e1[_0xe54bb3]={'$like':'%'+_0x40fe97[_0xd1ce('0x4b')][_0xd1ce('0x37')]+'%'};return _0x54c0e1;})});}_0x5c11bb=_['merge']({},_0x5c11bb,_0x40fe97['options']);return _0x1650f4[_0xd1ce('0x11c')](_0x5c11bb);}})[_0xd1ce('0x2b')](function(_0x50d0cf){if(_0x50d0cf){_0x275852=_0x50d0cf[_0xd1ce('0x54')];if(!_0x40fe97['query'][_0xd1ce('0xc9')](_0xd1ce('0xd7'))){_0x5c11bb[_0xd1ce('0x1c')]=qs[_0xd1ce('0x1c')](_0x40fe97[_0xd1ce('0x4b')]['limit']);_0x5c11bb['offset']=qs['offset'](_0x40fe97[_0xd1ce('0x4b')][_0xd1ce('0x1b')]);}return _0x1650f4['getLists'](_0x5c11bb);}})[_0xd1ce('0x2b')](function(_0x55caf7){if(_0x55caf7){return _0x55caf7?{'count':_0x275852,'rows':_0x55caf7}:null;}})[_0xd1ce('0x2b')](respondWithResult(_0x433fe2,null))['catch'](handleError(_0x433fe2,null));};exports['getAgents']=function(_0x2e8dfb,_0x3a98a4){var _0x12b604={};var _0x246ce2={};var _0x739364;return db[_0xd1ce('0x40')][_0xd1ce('0xc7')]({'where':{'id':_0x2e8dfb[_0xd1ce('0x60')]['id']}})[_0xd1ce('0x2b')](handleEntityNotFound(_0x3a98a4,null))[_0xd1ce('0x2b')](function(_0x1df666){if(_0x1df666){_0x739364=_0x1df666;_0x246ce2[_0xd1ce('0xd3')]=_[_0xd1ce('0xcf')](db[_0xd1ce('0x40')]['rawAttributes']);_0x246ce2[_0xd1ce('0x4b')]=_['keys'](_0x2e8dfb['query']);_0x246ce2[_0xd1ce('0xd1')]=_[_0xd1ce('0xd2')](_0x246ce2[_0xd1ce('0xd3')],_0x246ce2[_0xd1ce('0x4b')]);_0x12b604[_0xd1ce('0x50')]=_[_0xd1ce('0xd2')](_0x246ce2[_0xd1ce('0xd3')],qs['fields'](_0x2e8dfb['query'][_0xd1ce('0xd9')]));_0x12b604['attributes']=_0x12b604[_0xd1ce('0x50')][_0xd1ce('0x54')]?_0x12b604['attributes']:_0x246ce2[_0xd1ce('0xd3')];_0x12b604[_0xd1ce('0xd4')]=qs['sort'](_0x2e8dfb['query'][_0xd1ce('0xd5')]);_0x12b604[_0xd1ce('0x4a')]=qs[_0xd1ce('0xd1')](_[_0xd1ce('0xda')](_0x2e8dfb['query'],_0x246ce2[_0xd1ce('0xd1')]));if(_0x2e8dfb['query'][_0xd1ce('0x37')]){_0x12b604[_0xd1ce('0x4a')]=_['merge'](_0x12b604[_0xd1ce('0x4a')],{'$or':_[_0xd1ce('0x38')](_0x12b604['attributes'],function(_0x1a7c13){var _0x245fcd={};_0x245fcd[_0x1a7c13]={'$like':'%'+_0x2e8dfb['query'][_0xd1ce('0x37')]+'%'};return _0x245fcd;})});}_0x12b604[_0xd1ce('0xd3')]=db[_0xd1ce('0x40')];_0x12b604['as']='Agents';_0x12b604=_[_0xd1ce('0xd6')]({},_0x12b604,_0x2e8dfb[_0xd1ce('0x5d')]);return _0x739364[_0xd1ce('0x11d')]({'include':[_0x12b604]});}})[_0xd1ce('0x2b')](function(_0x32807f){if(_0x32807f){var _0xe87e55={},_0x51963d=[];for(var _0xcb9af4=0x0;_0xcb9af4<_0x32807f[_0xd1ce('0x54')];_0xcb9af4+=0x1){for(var _0x4ca98b=0x0,_0x37bf24;_0x4ca98b<_0x32807f[_0xcb9af4][_0xd1ce('0x35')][_0xd1ce('0x54')];_0x4ca98b+=0x1){_0x37bf24=_0x32807f[_0xcb9af4][_0xd1ce('0x35')][_0x4ca98b][_0xd1ce('0x31')]({'plain':!![]});_0xe87e55[_0x37bf24['id']]=_0x37bf24;}}_0xe87e55=_[_0xd1ce('0x11e')](_0xe87e55);for(var _0x330214=qs[_0xd1ce('0x1b')](_0x2e8dfb[_0xd1ce('0x4b')][_0xd1ce('0x1b')]);_0x330214<_0xe87e55['length']&&_0x51963d[_0xd1ce('0x54')]=_0x4c6a0f[_0x5e8f('0x46')]){throw new Error(_0x5e8f('0x47'));}})['then'](function(){if(_0x302ad8){return db[_0x5e8f('0x48')][_0x5e8f('0x49')]({'where':{'membername':_0x302ad8[_0x5e8f('0x25')]},'individualHooks':!![]});}})['then'](function(){if(_0x302ad8){return _0x302ad8['getVoiceQueues']({'raw':!![]});}})[_0x5e8f('0x14')](function(_0x1ab17a){if(_0x302ad8){if(_0x1ab17a){var _0x410323=[];_0x3b6735=_0x1ab17a;if(_0x3b6735[_0x5e8f('0x27')]){for(var _0x553d51=0x0;_0x553d51<_0x3b6735[_0x5e8f('0x27')];_0x553d51++){_0x410323['push'](db[_0x5e8f('0x48')][_0x5e8f('0x4a')]({'membername':_0x302ad8[_0x5e8f('0x25')],'UserId':_0x302ad8['id'],'queue_name':_0x3b6735[_0x553d51][_0x5e8f('0x25')],'VoiceQueueId':_0x3b6735[_0x553d51]['id'],'interface':_0x14aec5,'paused':_0x302ad8['loginInPause']||![],'penalty':_0x3b6735[_0x553d51][_0x5e8f('0x4b')]||0x0}));}return BPromise['all'](_0x410323);}}}})['then'](function(){if(_0x302ad8){return db['MemberReport'][_0x5e8f('0x24')]({'where':{'membername':_0x302ad8[_0x5e8f('0x25')],'exitAt':null}});}})[_0x5e8f('0x14')](function(_0x33de2b){if(_0x302ad8){if(_0x33de2b&&_0x33de2b[_0x5e8f('0x27')]){var _0xbbabf2=[];_0x33de2b[_0x5e8f('0x2a')](function(_0x13f242){_0xbbabf2[_0x5e8f('0x4c')](_0x13f242[_0x5e8f('0x22')]({'exitAt':moment()[_0x5e8f('0x20')](_0x5e8f('0x2d'))}));});return BPromise['all'](_0xbbabf2);}}})[_0x5e8f('0x14')](function(){if(_0x302ad8){var _0xd85b05=[];var _0x13f9cb=[];var _0x386c11=utils[_0x5e8f('0x29')]();var _0x341969={'membername':_0x302ad8[_0x5e8f('0x25')],'interface':_0x14aec5,'enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x302ad8[_0x5e8f('0x31')],'internal':_0x302ad8[_0x5e8f('0x1e')]};_0x386c11[_0x5e8f('0x2a')](function(_0xf02de3){_0xd85b05['push'](_[_0x5e8f('0x4d')]({'channel':_0xf02de3,'type':'LOGIN','data1':_0x5e8f('0x4e'),'data2':_0x14aec5},_0x341969));if(_0x302ad8['loginInPause']){_0x13f9cb[_0x5e8f('0x4c')](_[_0x5e8f('0x4d')]({'channel':_0xf02de3,'type':_0x5e8f('0x26'),'data1':_0x5e8f('0x4f')},_0x341969));}});return db['MemberReport']['bulkCreate'](_0xd85b05[_0x5e8f('0x50')](_0x13f9cb),{'individualHooks':!![]});}})[_0x5e8f('0x14')](function(){if(_0x302ad8){return _0x302ad8[_0x5e8f('0x22')]({'online':!![],'lastLoginAt':moment()[_0x5e8f('0x20')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x302ad8[_0x5e8f('0x51')]||![],'mailPause':_0x302ad8[_0x5e8f('0x51')]||![],'chatPause':_0x302ad8[_0x5e8f('0x51')]||![],'faxPause':_0x302ad8['loginInPause']||![],'smsPause':_0x302ad8[_0x5e8f('0x51')]||![],'openchannelPause':_0x302ad8[_0x5e8f('0x51')]||![],'pauseType':_0x302ad8['loginInPause']?'LOGININPAUSE':null,'lastPauseAt':moment()[_0x5e8f('0x20')](_0x5e8f('0x2d')),'interface':_0x14aec5});}})[_0x5e8f('0x14')](function(_0x2222bb){_0x6bdc67(_0x2222bb);})[_0x5e8f('0x18')](function(_0x275f1a){_0x24fefb(_0x3ccd1a[_0x5e8f('0x1a')](0x1f4,_0x275f1a[_0x5e8f('0x19')]));});});}; \ No newline at end of file +var _0xf991=['Channel\x20parameter\x20%s\x20is\x20invalid','findOne','online','voicePause','mailPause','whatsappPause','lastPauseAt','unpause','system','LogoutUser','destroy','all','LoginUser','mobile','loginInPause','SIP/%s','count','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','getVoiceQueues','push','upsert','UserVoiceQueue.penalty','merge','LOGIN','callysquare','LOGININPAUSE','concat','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','defaults','localhost','redis','./user.socket','register','GetUser','User','findAll','options','raw','where','limit','include','model','attributes','map','then','info','debug','stringify','catch','error','message','ShowUser','find','PauseUser','name','role','internal','interface','format','User\x20with\x20id\x20%s\x20not\x20found','params','UserVoiceQueueRt','update','PAUSE','length','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','getChannels','forEach','isNil','body','type','DEFAULT\x20PAUSE','uniqueid','MemberReport','UnpauseUser','channel'];(function(_0x49fbe2,_0x41b890){var _0x465c70=function(_0x2004a2){while(--_0x2004a2){_0x49fbe2['push'](_0x49fbe2['shift']());}};_0x465c70(++_0x41b890);}(_0xf991,0xce));var _0x1f99=function(_0x3a58ec,_0x4205bb){_0x3a58ec=_0x3a58ec-0x0;var _0x2e0660=_0xf991[_0x3a58ec];return _0x2e0660;};'use strict';var _=require(_0x1f99('0x0'));var util=require(_0x1f99('0x1'));var moment=require(_0x1f99('0x2'));var BPromise=require(_0x1f99('0x3'));var Redis=require(_0x1f99('0x4'));var db=require(_0x1f99('0x5'))['db'];var utils=require(_0x1f99('0x6'));var logger=require(_0x1f99('0x7'))('rpc');var config=require(_0x1f99('0x8'));config['redis']=_[_0x1f99('0x9')](config['redis'],{'host':_0x1f99('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1f99('0xb')]));require(_0x1f99('0xc'))[_0x1f99('0xd')](socket);exports[_0x1f99('0xe')]=function(_0x346d6c){var _0x5e962f=this;return new Promise(function(_0x1b4874,_0x255bbe){return db[_0x1f99('0xf')][_0x1f99('0x10')]({'raw':_0x346d6c[_0x1f99('0x11')]?_0x346d6c['options'][_0x1f99('0x12')]===undefined?!![]:![]:!![],'where':_0x346d6c[_0x1f99('0x11')]?_0x346d6c['options'][_0x1f99('0x13')]||null:null,'attributes':_0x346d6c[_0x1f99('0x11')]?_0x346d6c[_0x1f99('0x11')]['attributes']||null:null,'limit':_0x346d6c[_0x1f99('0x11')]?_0x346d6c[_0x1f99('0x11')][_0x1f99('0x14')]||null:null,'include':_0x346d6c[_0x1f99('0x11')]?_0x346d6c[_0x1f99('0x11')][_0x1f99('0x15')]?_['map'](_0x346d6c[_0x1f99('0x11')][_0x1f99('0x15')],function(_0xa51c24){return{'model':db[_0xa51c24[_0x1f99('0x16')]],'as':_0xa51c24['as'],'attributes':_0xa51c24[_0x1f99('0x17')],'include':_0xa51c24['include']?_[_0x1f99('0x18')](_0xa51c24[_0x1f99('0x15')],function(_0x2c7c6d){return{'model':db[_0x2c7c6d[_0x1f99('0x16')]],'as':_0x2c7c6d['as'],'attributes':_0x2c7c6d['attributes'],'include':_0x2c7c6d[_0x1f99('0x15')]?_[_0x1f99('0x18')](_0x2c7c6d[_0x1f99('0x15')],function(_0x345070){return{'model':db[_0x345070[_0x1f99('0x16')]],'as':_0x345070['as'],'attributes':_0x345070[_0x1f99('0x17')]};}):[]};}):[]};}):[]:[]})[_0x1f99('0x19')](function(_0x4f286a){logger[_0x1f99('0x1a')]('GetUser',_0x346d6c);logger[_0x1f99('0x1b')](_0x1f99('0xe'),_0x346d6c,JSON[_0x1f99('0x1c')](_0x4f286a));_0x1b4874(_0x4f286a);})[_0x1f99('0x1d')](function(_0x3c4423){logger[_0x1f99('0x1e')](_0x1f99('0xe'),_0x3c4423[_0x1f99('0x1f')],_0x346d6c);_0x255bbe(_0x5e962f[_0x1f99('0x1e')](0x1f4,_0x3c4423[_0x1f99('0x1f')]));});});};exports[_0x1f99('0x20')]=function(_0x580512){var _0x3b0938=this;return new Promise(function(_0x20b34e,_0x42d514){return db[_0x1f99('0xf')][_0x1f99('0x21')]({'raw':_0x580512[_0x1f99('0x11')]?_0x580512[_0x1f99('0x11')][_0x1f99('0x12')]===undefined?!![]:![]:!![],'where':_0x580512['options']?_0x580512['options'][_0x1f99('0x13')]||null:null,'attributes':_0x580512[_0x1f99('0x11')]?_0x580512[_0x1f99('0x11')][_0x1f99('0x17')]||null:null,'include':_0x580512[_0x1f99('0x11')]?_0x580512[_0x1f99('0x11')]['include']?_[_0x1f99('0x18')](_0x580512[_0x1f99('0x11')]['include'],function(_0x529abf){return{'model':db[_0x529abf['model']],'as':_0x529abf['as'],'attributes':_0x529abf[_0x1f99('0x17')],'include':_0x529abf[_0x1f99('0x15')]?_['map'](_0x529abf[_0x1f99('0x15')],function(_0x2de3f7){return{'model':db[_0x2de3f7[_0x1f99('0x16')]],'as':_0x2de3f7['as'],'attributes':_0x2de3f7['attributes'],'include':_0x2de3f7[_0x1f99('0x15')]?_[_0x1f99('0x18')](_0x2de3f7[_0x1f99('0x15')],function(_0x5aefb9){return{'model':db[_0x5aefb9[_0x1f99('0x16')]],'as':_0x5aefb9['as'],'attributes':_0x5aefb9[_0x1f99('0x17')]};}):[]};}):[]};}):[]:[]})[_0x1f99('0x19')](function(_0x3923fb){logger[_0x1f99('0x1a')](_0x1f99('0x20'),_0x580512);logger['debug'](_0x1f99('0x20'),_0x580512,JSON[_0x1f99('0x1c')](_0x3923fb));_0x20b34e(_0x3923fb);})[_0x1f99('0x1d')](function(_0x30f8c2){logger[_0x1f99('0x1e')](_0x1f99('0x20'),_0x30f8c2[_0x1f99('0x1f')],_0x580512);_0x42d514(_0x3b0938['error'](0x1f4,_0x30f8c2[_0x1f99('0x1f')]));});});};exports[_0x1f99('0x22')]=function(_0x254aad){var _0x49b3d4;return db[_0x1f99('0xf')][_0x1f99('0x21')]({'where':_0x254aad[_0x1f99('0x11')][_0x1f99('0x13')]||{},'attributes':['id',_0x1f99('0x23'),_0x1f99('0x24'),_0x1f99('0x25'),_0x1f99('0x26')]})[_0x1f99('0x19')](function(_0x276402){if(!_0x276402){throw new Error(util[_0x1f99('0x27')](_0x1f99('0x28'),_0x254aad[_0x1f99('0x29')]['id']));}_0x49b3d4=_0x276402;return db[_0x1f99('0x2a')][_0x1f99('0x2b')]({'paused':0x1},{'where':{'UserId':_0x49b3d4['id']},'individualHooks':!![]});})['then'](function(){return db['MemberReport']['findAll']({'where':{'membername':_0x49b3d4[_0x1f99('0x23')],'type':_0x1f99('0x2c'),'exitAt':null}});})[_0x1f99('0x19')](function(_0x478914){if(_0x478914&&_0x478914[_0x1f99('0x2d')]){var _0xc036d4=moment()[_0x1f99('0x27')](_0x1f99('0x2e'));for(var _0x54a9d6=0x0,_0x1d9421=_0x478914[_0x1f99('0x2d')];_0x54a9d6<_0x1d9421;_0x54a9d6++){_0x478914[_0x54a9d6][_0x1f99('0x2f')]({'exitAt':_0xc036d4});}}})['then'](function(){var _0x9134bf=[];var _0x2821b8=utils[_0x1f99('0x30')]();_0x2821b8[_0x1f99('0x31')](function(_0x15b095){_0x9134bf['push']({'channel':_0x15b095,'membername':_0x49b3d4[_0x1f99('0x23')],'interface':_[_0x1f99('0x32')](_0x49b3d4[_0x1f99('0x26')])?util[_0x1f99('0x27')]('SIP/%s',_0x49b3d4[_0x1f99('0x23')]):_0x49b3d4[_0x1f99('0x26')],'type':_0x1f99('0x2c'),'enterAt':moment()[_0x1f99('0x27')](_0x1f99('0x2e')),'data1':_0x254aad[_0x1f99('0x33')][_0x1f99('0x34')]||_0x1f99('0x35'),'role':_0x49b3d4['role'],'internal':_0x49b3d4[_0x1f99('0x25')],'uniqueid':_0x254aad[_0x1f99('0x33')][_0x1f99('0x36')]||null});});return db[_0x1f99('0x37')]['bulkCreate'](_0x9134bf,{'individualHooks':!![]});})['then'](function(){return _0x49b3d4[_0x1f99('0x2b')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x254aad['body'][_0x1f99('0x34')]||_0x1f99('0x35'),'lastPauseAt':moment()['format'](_0x1f99('0x2e'))});})['catch'](function(_0x5abad9){throw _0x5abad9;});};exports[_0x1f99('0x38')]=function(_0x78d3c0){return Promise['resolve']()[_0x1f99('0x19')](function(){if(_0x78d3c0[_0x1f99('0x33')][_0x1f99('0x39')]&&!utils['isValidChannel'](_0x78d3c0[_0x1f99('0x33')]['channel'])){throw new Error(util[_0x1f99('0x27')](_0x1f99('0x3a'),_0x78d3c0['body'][_0x1f99('0x39')]));}return db[_0x1f99('0xf')][_0x1f99('0x3b')]({'where':_0x78d3c0[_0x1f99('0x11')][_0x1f99('0x13')]||{},'attributes':['id',_0x1f99('0x23'),_0x1f99('0x24'),'internal',_0x1f99('0x26'),_0x1f99('0x3c'),_0x1f99('0x3d'),_0x1f99('0x3e'),'chatPause','faxPause','openchannelPause','smsPause',_0x1f99('0x3f'),'pauseType',_0x1f99('0x40')]});})[_0x1f99('0x19')](function(_0x18b845){if(!_0x18b845){throw new Error(util[_0x1f99('0x27')]('User\x20with\x20id\x20%s\x20not\x20found',_0x78d3c0['params']['id']));}return _0x18b845[_0x1f99('0x41')](_0x78d3c0[_0x1f99('0x33')][_0x1f99('0x39')],_0x1f99('0x42'));})[_0x1f99('0x1d')](function(_0x1ed410){throw _0x1ed410;});};exports[_0x1f99('0x43')]=function(_0x512350){var _0x4dded5=this;return new Promise(function(_0x598bfc,_0x58e3a3){var _0x28d2db;return db[_0x1f99('0xf')][_0x1f99('0x3b')]({'where':_0x512350[_0x1f99('0x11')][_0x1f99('0x13')]||{},'attributes':['id',_0x1f99('0x23')]})['then'](function(_0x4d1d40){if(_0x4d1d40){_0x28d2db=_0x4d1d40;return db[_0x1f99('0x2a')][_0x1f99('0x44')]({'where':{'membername':_0x28d2db[_0x1f99('0x23')]},'individualHooks':!![]});}})[_0x1f99('0x19')](function(){if(_0x28d2db){return db['MemberReport'][_0x1f99('0x10')]({'where':{'membername':_0x28d2db['name'],'exitAt':null}});}})[_0x1f99('0x19')](function(_0x168fa3){if(_0x28d2db){if(_0x168fa3&&_0x168fa3[_0x1f99('0x2d')]){var _0x34376e=[];_0x168fa3['forEach'](function(_0x4f4005){_0x34376e['push'](_0x4f4005[_0x1f99('0x2b')]({'exitAt':moment()[_0x1f99('0x27')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x1f99('0x45')](_0x34376e);}}})[_0x1f99('0x19')](function(){if(_0x28d2db){return _0x28d2db[_0x1f99('0x2b')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})['then'](function(_0x5f0362){_0x598bfc(_0x5f0362);})[_0x1f99('0x1d')](function(_0x279b02){_0x58e3a3(_0x4dded5[_0x1f99('0x1e')](0x1f4,_0x279b02[_0x1f99('0x1f')]));});});};exports[_0x1f99('0x46')]=function(_0x4f9be7){var _0x200878=this;return new Promise(function(_0x2fb1da,_0x26e18a){var _0x15bbc4;var _0x35baa7;var _0x492ebd;var _0x511085;return db[_0x1f99('0xf')][_0x1f99('0x3b')]({'where':_0x4f9be7[_0x1f99('0x11')][_0x1f99('0x13')]||{},'attributes':['id',_0x1f99('0x23'),_0x1f99('0x24'),_0x1f99('0x47'),'phone','internal',_0x1f99('0x48'),'interface']})[_0x1f99('0x19')](function(_0x50eef3){if(_0x50eef3){_0x15bbc4=_0x50eef3;_0x511085=_0x4f9be7[_0x1f99('0x33')][_0x1f99('0x26')]?_0x4f9be7['body'][_0x1f99('0x26')]:util[_0x1f99('0x27')](_0x1f99('0x49'),_0x15bbc4['name']);return db[_0x1f99('0xf')][_0x1f99('0x4a')]({'where':{'role':'agent','online':!![],'id':{'$ne':_0x15bbc4['id']}}});}})[_0x1f99('0x19')](function(_0x5f1cfb){if(_0x5f1cfb){_0x492ebd=_0x5f1cfb;return require(_0x1f99('0x4b'))[_0x1f99('0x4c')]();}})[_0x1f99('0x19')](function(_0x57e5eb){if(_0x57e5eb&&_0x57e5eb[_0x1f99('0x4d')]&&_0x492ebd>=_0x57e5eb[_0x1f99('0x4d')]){throw new Error(_0x1f99('0x4e'));}})[_0x1f99('0x19')](function(){if(_0x15bbc4){return db[_0x1f99('0x2a')][_0x1f99('0x44')]({'where':{'membername':_0x15bbc4['name']},'individualHooks':!![]});}})[_0x1f99('0x19')](function(){if(_0x15bbc4){return _0x15bbc4[_0x1f99('0x4f')]({'raw':!![]});}})[_0x1f99('0x19')](function(_0x1c2b93){if(_0x15bbc4){if(_0x1c2b93){var _0x4e0971=[];_0x35baa7=_0x1c2b93;if(_0x35baa7[_0x1f99('0x2d')]){for(var _0x49c088=0x0;_0x49c088<_0x35baa7[_0x1f99('0x2d')];_0x49c088++){_0x4e0971[_0x1f99('0x50')](db[_0x1f99('0x2a')][_0x1f99('0x51')]({'membername':_0x15bbc4[_0x1f99('0x23')],'UserId':_0x15bbc4['id'],'queue_name':_0x35baa7[_0x49c088][_0x1f99('0x23')],'VoiceQueueId':_0x35baa7[_0x49c088]['id'],'interface':_0x511085,'paused':_0x15bbc4['loginInPause']||![],'penalty':_0x35baa7[_0x49c088][_0x1f99('0x52')]||0x0}));}return BPromise['all'](_0x4e0971);}}}})['then'](function(){if(_0x15bbc4){return db[_0x1f99('0x37')][_0x1f99('0x10')]({'where':{'membername':_0x15bbc4[_0x1f99('0x23')],'exitAt':null}});}})[_0x1f99('0x19')](function(_0x1ee0d8){if(_0x15bbc4){if(_0x1ee0d8&&_0x1ee0d8[_0x1f99('0x2d')]){var _0x1a2643=[];_0x1ee0d8[_0x1f99('0x31')](function(_0x1f6f76){_0x1a2643[_0x1f99('0x50')](_0x1f6f76[_0x1f99('0x2b')]({'exitAt':moment()[_0x1f99('0x27')](_0x1f99('0x2e'))}));});return BPromise['all'](_0x1a2643);}}})[_0x1f99('0x19')](function(){if(_0x15bbc4){var _0x1283a8=[];var _0x595299=[];var _0x4092dc=utils[_0x1f99('0x30')]();var _0x3e1196={'membername':_0x15bbc4[_0x1f99('0x23')],'interface':_0x511085,'enterAt':moment()['format'](_0x1f99('0x2e')),'role':_0x15bbc4[_0x1f99('0x24')],'internal':_0x15bbc4[_0x1f99('0x25')]};_0x4092dc['forEach'](function(_0x1e7ae7){_0x1283a8[_0x1f99('0x50')](_[_0x1f99('0x53')]({'channel':_0x1e7ae7,'type':_0x1f99('0x54'),'data1':_0x1f99('0x55'),'data2':_0x511085},_0x3e1196));if(_0x15bbc4[_0x1f99('0x48')]){_0x595299[_0x1f99('0x50')](_[_0x1f99('0x53')]({'channel':_0x1e7ae7,'type':'PAUSE','data1':_0x1f99('0x56')},_0x3e1196));}});return db[_0x1f99('0x37')]['bulkCreate'](_0x1283a8[_0x1f99('0x57')](_0x595299),{'individualHooks':!![]});}})['then'](function(){if(_0x15bbc4){return _0x15bbc4[_0x1f99('0x2b')]({'online':!![],'lastLoginAt':moment()[_0x1f99('0x27')](_0x1f99('0x2e')),'voicePause':_0x15bbc4[_0x1f99('0x48')]||![],'mailPause':_0x15bbc4[_0x1f99('0x48')]||![],'chatPause':_0x15bbc4[_0x1f99('0x48')]||![],'faxPause':_0x15bbc4[_0x1f99('0x48')]||![],'smsPause':_0x15bbc4[_0x1f99('0x48')]||![],'openchannelPause':_0x15bbc4[_0x1f99('0x48')]||![],'pauseType':_0x15bbc4['loginInPause']?'LOGININPAUSE':null,'lastPauseAt':moment()[_0x1f99('0x27')](_0x1f99('0x2e')),'interface':_0x511085});}})[_0x1f99('0x19')](function(_0x13e38c){_0x2fb1da(_0x13e38c);})[_0x1f99('0x1d')](function(_0x204200){_0x26e18a(_0x200878['error'](0x1f4,_0x204200[_0x1f99('0x1f')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 82abf46..9de0944 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 _0x8c1b=['remove','emit','register','length','save'];(function(_0x50cf87,_0x4b5587){var _0x14f02e=function(_0x8f350b){while(--_0x8f350b){_0x50cf87['push'](_0x50cf87['shift']());}};_0x14f02e(++_0x4b5587);}(_0x8c1b,0xae));var _0xb8c1=function(_0x699b7e,_0x6132d9){_0x699b7e=_0x699b7e-0x0;var _0x7ac59f=_0x8c1b[_0x699b7e];return _0x7ac59f;};'use strict';var UserEvents=require('./user.events');var events=[_0xb8c1('0x0'),_0xb8c1('0x1'),'update'];function createListener(_0x154164,_0x17e97d){return function(_0x1c830a){_0x17e97d[_0xb8c1('0x2')](_0x154164,_0x1c830a);};}function removeListener(_0x5e111c,_0x13340a){return function(){UserEvents['removeListener'](_0x5e111c,_0x13340a);};}exports[_0xb8c1('0x3')]=function(_0x2972b5){for(var _0x329104=0x0,_0x4845ed=events[_0xb8c1('0x4')];_0x329104<_0x4845ed;_0x329104++){var _0x6d16d4=events[_0x329104];var _0x45bc17=createListener('user:'+_0x6d16d4,_0x2972b5);UserEvents['on'](_0x6d16d4,_0x45bc17);}}; \ No newline at end of file +var _0xe521=['update','emit','removeListener','length','user:','save','remove'];(function(_0x467e92,_0x52a4e1){var _0x29f7e0=function(_0x5e4339){while(--_0x5e4339){_0x467e92['push'](_0x467e92['shift']());}};_0x29f7e0(++_0x52a4e1);}(_0xe521,0x139));var _0x1e52=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe521[_0x3dd15e];return _0x231fd0;};'use strict';var UserEvents=require('./user.events');var events=[_0x1e52('0x0'),_0x1e52('0x1'),_0x1e52('0x2')];function createListener(_0x1b6bba,_0x20b5ae){return function(_0x229a2b){_0x20b5ae[_0x1e52('0x3')](_0x1b6bba,_0x229a2b);};}function removeListener(_0x1303c9,_0x5eb055){return function(){UserEvents[_0x1e52('0x4')](_0x1303c9,_0x5eb055);};}exports['register']=function(_0x3673c7){for(var _0x20ae8e=0x0,_0x3a5251=events[_0x1e52('0x5')];_0x20ae8e<_0x3a5251;_0x20ae8e++){var _0x4de1c5=events[_0x20ae8e];var _0x22d557=createListener(_0x1e52('0x6')+_0x4de1c5,_0x3673c7);UserEvents['on'](_0x4de1c5,_0x22d557);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 6e66c58..84c2a6d 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x2a1877,_0x1cd405){var _0x353b31=function(_0x376b9d){while(--_0x376b9d){_0x2a1877['push'](_0x2a1877['shift']());}};_0x353b31(++_0x1cd405);}(_0xe706,0xa3));var _0x6e70=function(_0x3132e8,_0x499a0e){_0x3132e8=_0x3132e8-0x0;var _0x43eb8c=_0xe706[_0x3132e8];return _0x43eb8c;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x5c5fa0,_0x1f6c00){var _0x4101fc=function(_0x8f79c0){while(--_0x8f79c0){_0x5c5fa0['push'](_0x5c5fa0['shift']());}};_0x4101fc(++_0x1f6c00);}(_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/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index b7fd398..b97d7d0 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 _0xc99a=['INTEGER','sequelize'];(function(_0x43b969,_0x4e0845){var _0xfb392c=function(_0x5259ee){while(--_0x5259ee){_0x43b969['push'](_0x43b969['shift']());}};_0xfb392c(++_0x4e0845);}(_0xc99a,0xef));var _0xac99=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc99a[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xac99('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xac99('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe617=['exports','INTEGER','sequelize'];(function(_0xa34669,_0x128815){var _0x65e5d2=function(_0x183d91){while(--_0x183d91){_0xa34669['push'](_0xa34669['shift']());}};_0x65e5d2(++_0x128815);}(_0xe617,0x17c));var _0x7e61=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xe617[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x7e61('0x0'));module[_0x7e61('0x1')]={'penalty':{'type':Sequelize[_0x7e61('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 561ca3c..72e1ddc 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 _0xb73a=['exports','define','UserChatQueue','user_has_chat_queues','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userChatQueue.attributes'];(function(_0x295204,_0x2104c0){var _0x45c97f=function(_0x22f0f8){while(--_0x22f0f8){_0x295204['push'](_0x295204['shift']());}};_0x45c97f(++_0x2104c0);}(_0xb73a,0x1ee));var _0xab73=function(_0x411cfc,_0x1a1488){_0x411cfc=_0x411cfc-0x0;var _0x5c83af=_0xb73a[_0x411cfc];return _0x5c83af;};'use strict';var _=require(_0xab73('0x0'));var util=require('util');var logger=require(_0xab73('0x1'))(_0xab73('0x2'));var moment=require(_0xab73('0x3'));var BPromise=require(_0xab73('0x4'));var rp=require(_0xab73('0x5'));var fs=require('fs');var path=require(_0xab73('0x6'));var rimraf=require(_0xab73('0x7'));var config=require(_0xab73('0x8'));var attributes=require(_0xab73('0x9'));module[_0xab73('0xa')]=function(_0x76c0aa,_0x8b5ec9){return _0x76c0aa[_0xab73('0xb')](_0xab73('0xc'),attributes,{'tableName':_0xab73('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc4d2=['exports','define','user_has_chat_queues','lodash','../../config/logger','api','moment','request-promise','rimraf','./userChatQueue.attributes'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc4d2,0x17f));var _0x2c4d=function(_0xe18561,_0x3884b0){_0xe18561=_0xe18561-0x0;var _0xc52ff4=_0xc4d2[_0xe18561];return _0xc52ff4;};'use strict';var _=require(_0x2c4d('0x0'));var util=require('util');var logger=require(_0x2c4d('0x1'))(_0x2c4d('0x2'));var moment=require(_0x2c4d('0x3'));var BPromise=require('bluebird');var rp=require(_0x2c4d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2c4d('0x5'));var config=require('../../config/environment');var attributes=require(_0x2c4d('0x6'));module[_0x2c4d('0x7')]=function(_0x3abb2a,_0x288e87){return _0x3abb2a[_0x2c4d('0x8')]('UserChatQueue',attributes,{'tableName':_0x2c4d('0x9'),'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 0dc5019..f3d6970 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 _0xedc3=['bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','request','then','info','UserChatQueue,\x20%s,\x20%s','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','result','lodash','util','moment'];(function(_0xe3803e,_0x37e9ce){var _0x312c82=function(_0xc129ff){while(--_0xc129ff){_0xe3803e['push'](_0xe3803e['shift']());}};_0x312c82(++_0x37e9ce);}(_0xedc3,0x14d));var _0x3edc=function(_0x5029f6,_0x118108){_0x5029f6=_0x5029f6-0x0;var _0xb1b7e1=_0xedc3[_0x5029f6];return _0xb1b7e1;};'use strict';var _=require(_0x3edc('0x0'));var util=require(_0x3edc('0x1'));var moment=require(_0x3edc('0x2'));var BPromise=require(_0x3edc('0x3'));var rs=require(_0x3edc('0x4'));var fs=require('fs');var Redis=require(_0x3edc('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3edc('0x6'));var config=require(_0x3edc('0x7'));var jayson=require(_0x3edc('0x8'));var client=jayson[_0x3edc('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1acf85,_0x27ca11,_0x4f4c13){return new BPromise(function(_0x20ef53,_0x47e0cb){return client[_0x3edc('0xa')](_0x1acf85,_0x4f4c13)[_0x3edc('0xb')](function(_0x147c94){logger[_0x3edc('0xc')](_0x3edc('0xd'),_0x27ca11,'request\x20sent');logger[_0x3edc('0xe')](_0x3edc('0xf'),_0x27ca11,_0x3edc('0x10'),JSON['stringify'](_0x147c94));if(_0x147c94['error']){if(_0x147c94['error'][_0x3edc('0x11')]===0x1f4){logger[_0x3edc('0x12')](_0x3edc('0xd'),_0x27ca11,_0x147c94[_0x3edc('0x12')][_0x3edc('0x13')]);return _0x47e0cb(_0x147c94[_0x3edc('0x12')][_0x3edc('0x13')]);}logger['error'](_0x3edc('0xd'),_0x27ca11,_0x147c94[_0x3edc('0x12')][_0x3edc('0x13')]);return _0x20ef53(_0x147c94['error'][_0x3edc('0x13')]);}else{logger[_0x3edc('0xc')](_0x3edc('0xd'),_0x27ca11,_0x3edc('0x10'));_0x20ef53(_0x147c94[_0x3edc('0x14')][_0x3edc('0x13')]);}})['catch'](function(_0x39225b){logger[_0x3edc('0x12')]('UserChatQueue,\x20%s,\x20%s',_0x27ca11,_0x39225b);_0x47e0cb(_0x39225b);});});} \ No newline at end of file +var _0x46e4=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','UserChatQueue,\x20%s,\x20%s','message','util','bluebird','ioredis'];(function(_0x33d431,_0xf591fb){var _0xad1bc8=function(_0x3c0b5a){while(--_0x3c0b5a){_0x33d431['push'](_0x33d431['shift']());}};_0xad1bc8(++_0xf591fb);}(_0x46e4,0x13d));var _0x446e=function(_0x27b4c7,_0xd847e6){_0x27b4c7=_0x27b4c7-0x0;var _0x3000b9=_0x46e4[_0x27b4c7];return _0x3000b9;};'use strict';var _=require('lodash');var util=require(_0x446e('0x0'));var moment=require('moment');var BPromise=require(_0x446e('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x446e('0x2'));var db=require(_0x446e('0x3'))['db'];var utils=require(_0x446e('0x4'));var logger=require(_0x446e('0x5'))(_0x446e('0x6'));var config=require(_0x446e('0x7'));var jayson=require(_0x446e('0x8'));var client=jayson['client'][_0x446e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x21f963,_0x646536,_0x26e9df){return new BPromise(function(_0x140920,_0x419e38){return client[_0x446e('0xa')](_0x21f963,_0x26e9df)[_0x446e('0xb')](function(_0x16b367){logger[_0x446e('0xc')]('UserChatQueue,\x20%s,\x20%s',_0x646536,_0x446e('0xd'));logger[_0x446e('0xe')](_0x446e('0xf'),_0x646536,_0x446e('0xd'),JSON[_0x446e('0x10')](_0x16b367));if(_0x16b367[_0x446e('0x11')]){if(_0x16b367[_0x446e('0x11')]['code']===0x1f4){logger[_0x446e('0x11')](_0x446e('0x12'),_0x646536,_0x16b367[_0x446e('0x11')]['message']);return _0x419e38(_0x16b367[_0x446e('0x11')][_0x446e('0x13')]);}logger[_0x446e('0x11')](_0x446e('0x12'),_0x646536,_0x16b367[_0x446e('0x11')][_0x446e('0x13')]);return _0x140920(_0x16b367[_0x446e('0x11')][_0x446e('0x13')]);}else{logger[_0x446e('0xc')]('UserChatQueue,\x20%s,\x20%s',_0x646536,_0x446e('0xd'));_0x140920(_0x16b367['result'][_0x446e('0x13')]);}})['catch'](function(_0x578aa0){logger[_0x446e('0x11')]('UserChatQueue,\x20%s,\x20%s',_0x646536,_0x578aa0);_0x419e38(_0x578aa0);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index bce26a2..cbe69a1 100644 --- a/server/api/userFaxQueue/index.js +++ b/server/api/userFaxQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x9b9c46,_0x3997a8){var _0x47ee52=function(_0x1b382f){while(--_0x1b382f){_0x9b9c46['push'](_0x9b9c46['shift']());}};_0x47ee52(++_0x3997a8);}(_0x9c44,0x178));var _0x49c4=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0x9c44[_0x3511d3];return _0x5d6321;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x41974d,_0x1e20a0){var _0x1985de=function(_0x41c676){while(--_0x41c676){_0x41974d['push'](_0x41974d['shift']());}};_0x1985de(++_0x1e20a0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index bca4027..5215d17 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 _0xb4fc=['STRING','sequelize','INTEGER'];(function(_0x80d5e8,_0x3be93c){var _0x3e8164=function(_0x138cf2){while(--_0x138cf2){_0x80d5e8['push'](_0x80d5e8['shift']());}};_0x3e8164(++_0x3be93c);}(_0xb4fc,0xeb));var _0xcb4f=function(_0x22656e,_0x1163dc){_0x22656e=_0x22656e-0x0;var _0x3e4255=_0xb4fc[_0x22656e];return _0x3e4255;};'use strict';var Sequelize=require(_0xcb4f('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xcb4f('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0xcb4f('0x2')]}}; \ No newline at end of file +var _0xe3d9=['sequelize','exports','INTEGER','STRING'];(function(_0x1e2475,_0x55a8fd){var _0x5e19cb=function(_0x25d2e2){while(--_0x25d2e2){_0x1e2475['push'](_0x1e2475['shift']());}};_0x5e19cb(++_0x55a8fd);}(_0xe3d9,0x9c));var _0x9e3d=function(_0x45de9f,_0x3aabdc){_0x45de9f=_0x45de9f-0x0;var _0x5c5712=_0xe3d9[_0x45de9f];return _0x5c5712;};'use strict';var Sequelize=require(_0x9e3d('0x0'));module[_0x9e3d('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x9e3d('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x9e3d('0x3')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 67fffb5..849ac4a 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 _0x1b24=['../../config/environment','./userFaxQueue.attributes','exports','UserFaxQueue','user_has_fax_queues','lodash','util','../../config/logger','moment','request-promise','path','rimraf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1b24,0x65));var _0x41b2=function(_0x4bc7b0,_0x461027){_0x4bc7b0=_0x4bc7b0-0x0;var _0xb35921=_0x1b24[_0x4bc7b0];return _0xb35921;};'use strict';var _=require(_0x41b2('0x0'));var util=require(_0x41b2('0x1'));var logger=require(_0x41b2('0x2'))('api');var moment=require(_0x41b2('0x3'));var BPromise=require('bluebird');var rp=require(_0x41b2('0x4'));var fs=require('fs');var path=require(_0x41b2('0x5'));var rimraf=require(_0x41b2('0x6'));var config=require(_0x41b2('0x7'));var attributes=require(_0x41b2('0x8'));module[_0x41b2('0x9')]=function(_0x4fb821,_0x373f8b){return _0x4fb821['define'](_0x41b2('0xa'),attributes,{'tableName':_0x41b2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9f0=['rimraf','../../config/environment','./userFaxQueue.attributes','UserFaxQueue','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x3d934e,_0x2a9c59){var _0x2c02c7=function(_0x375560){while(--_0x375560){_0x3d934e['push'](_0x3d934e['shift']());}};_0x2c02c7(++_0x2a9c59);}(_0xa9f0,0x1da));var _0x0a9f=function(_0x381389,_0x516390){_0x381389=_0x381389-0x0;var _0xa1c8eb=_0xa9f0[_0x381389];return _0xa1c8eb;};'use strict';var _=require('lodash');var util=require(_0x0a9f('0x0'));var logger=require(_0x0a9f('0x1'))('api');var moment=require(_0x0a9f('0x2'));var BPromise=require(_0x0a9f('0x3'));var rp=require(_0x0a9f('0x4'));var fs=require('fs');var path=require(_0x0a9f('0x5'));var rimraf=require(_0x0a9f('0x6'));var config=require(_0x0a9f('0x7'));var attributes=require(_0x0a9f('0x8'));module['exports']=function(_0x5b3998,_0x856a72){return _0x5b3998['define'](_0x0a9f('0x9'),attributes,{'tableName':'user_has_fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.rpc.js b/server/api/userFaxQueue/userFaxQueue.rpc.js index c148722..a5f4320 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 _0xe607=['../../config/utils','../../config/logger','rpc','jayson/promise','client','http','UserFaxQueue,\x20%s,\x20%s','debug','stringify','error','code','request\x20sent','result','message','catch','util','moment','randomstring','../../mysqldb'];(function(_0x1a2dce,_0x39f042){var _0x5d3e1f=function(_0x1c3e12){while(--_0x1c3e12){_0x1a2dce['push'](_0x1a2dce['shift']());}};_0x5d3e1f(++_0x39f042);}(_0xe607,0x6e));var _0x7e60=function(_0xbcbe17,_0x37fb59){_0xbcbe17=_0xbcbe17-0x0;var _0x15ddec=_0xe607[_0xbcbe17];return _0x15ddec;};'use strict';var _=require('lodash');var util=require(_0x7e60('0x0'));var moment=require(_0x7e60('0x1'));var BPromise=require('bluebird');var rs=require(_0x7e60('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7e60('0x3'))['db'];var utils=require(_0x7e60('0x4'));var logger=require(_0x7e60('0x5'))(_0x7e60('0x6'));var config=require('../../config/environment');var jayson=require(_0x7e60('0x7'));var client=jayson[_0x7e60('0x8')][_0x7e60('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x482fc8,_0x238eda,_0x5c45cd){return new BPromise(function(_0x3b8a07,_0x8c89a3){return client['request'](_0x482fc8,_0x5c45cd)['then'](function(_0x4164e1){logger['info'](_0x7e60('0xa'),_0x238eda,'request\x20sent');logger[_0x7e60('0xb')]('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x238eda,'request\x20sent',JSON[_0x7e60('0xc')](_0x4164e1));if(_0x4164e1['error']){if(_0x4164e1[_0x7e60('0xd')][_0x7e60('0xe')]===0x1f4){logger[_0x7e60('0xd')](_0x7e60('0xa'),_0x238eda,_0x4164e1[_0x7e60('0xd')]['message']);return _0x8c89a3(_0x4164e1[_0x7e60('0xd')]['message']);}logger[_0x7e60('0xd')]('UserFaxQueue,\x20%s,\x20%s',_0x238eda,_0x4164e1[_0x7e60('0xd')]['message']);return _0x3b8a07(_0x4164e1[_0x7e60('0xd')]['message']);}else{logger['info'](_0x7e60('0xa'),_0x238eda,_0x7e60('0xf'));_0x3b8a07(_0x4164e1[_0x7e60('0x10')][_0x7e60('0x11')]);}})[_0x7e60('0x12')](function(_0x32de8f){logger['error'](_0x7e60('0xa'),_0x238eda,_0x32de8f);_0x8c89a3(_0x32de8f);});});} \ No newline at end of file +var _0xbe4d=['message','UserFaxQueue,\x20%s,\x20%s','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','info','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xbe4d,0x1ba));var _0xdbe4=function(_0x235320,_0x40bb62){_0x235320=_0x235320-0x0;var _0x88857d=_0xbe4d[_0x235320];return _0x88857d;};'use strict';var _=require(_0xdbe4('0x0'));var util=require('util');var moment=require(_0xdbe4('0x1'));var BPromise=require(_0xdbe4('0x2'));var rs=require(_0xdbe4('0x3'));var fs=require('fs');var Redis=require(_0xdbe4('0x4'));var db=require(_0xdbe4('0x5'))['db'];var utils=require(_0xdbe4('0x6'));var logger=require(_0xdbe4('0x7'))('rpc');var config=require(_0xdbe4('0x8'));var jayson=require(_0xdbe4('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3fe59a,_0x22696f,_0x99283a){return new BPromise(function(_0x4e984b,_0x23a046){return client[_0xdbe4('0xa')](_0x3fe59a,_0x99283a)['then'](function(_0x4acdca){logger[_0xdbe4('0xb')]('UserFaxQueue,\x20%s,\x20%s',_0x22696f,_0xdbe4('0xc'));logger[_0xdbe4('0xd')](_0xdbe4('0xe'),_0x22696f,'request\x20sent',JSON[_0xdbe4('0xf')](_0x4acdca));if(_0x4acdca[_0xdbe4('0x10')]){if(_0x4acdca[_0xdbe4('0x10')][_0xdbe4('0x11')]===0x1f4){logger[_0xdbe4('0x10')]('UserFaxQueue,\x20%s,\x20%s',_0x22696f,_0x4acdca['error'][_0xdbe4('0x12')]);return _0x23a046(_0x4acdca[_0xdbe4('0x10')][_0xdbe4('0x12')]);}logger['error'](_0xdbe4('0x13'),_0x22696f,_0x4acdca[_0xdbe4('0x10')][_0xdbe4('0x12')]);return _0x4e984b(_0x4acdca[_0xdbe4('0x10')][_0xdbe4('0x12')]);}else{logger[_0xdbe4('0xb')](_0xdbe4('0x13'),_0x22696f,_0xdbe4('0xc'));_0x4e984b(_0x4acdca['result'][_0xdbe4('0x12')]);}})['catch'](function(_0x4f1d4b){logger[_0xdbe4('0x10')]('UserFaxQueue,\x20%s,\x20%s',_0x22696f,_0x4f1d4b);_0x23a046(_0x4f1d4b);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 8b2c52a..61b7831 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x15120c,_0x2a51b7){var _0x434b36=function(_0x39e6fe){while(--_0x39e6fe){_0x15120c['push'](_0x15120c['shift']());}};_0x434b36(++_0x2a51b7);}(_0xe706,0xa3));var _0x6e70=function(_0x2a97f7,_0x465e0c){_0x2a97f7=_0x2a97f7-0x0;var _0x13c258=_0xe706[_0x2a97f7];return _0x13c258;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x47d028,_0x32f0c7){var _0x4ddf14=function(_0x5c0041){while(--_0x5c0041){_0x47d028['push'](_0x47d028['shift']());}};_0x4ddf14(++_0x32f0c7);}(_0x70e0,0x17b));var _0x070e=function(_0x51fb84,_0x1c7f04){_0x51fb84=_0x51fb84-0x0;var _0x1ac65f=_0x70e0[_0x51fb84];return _0x1ac65f;};'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/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 8e910ad..ac9850c 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 _0xdcde=['INTEGER'];(function(_0x5e3b04,_0xbb6795){var _0x1fc44d=function(_0x3472a1){while(--_0x3472a1){_0x5e3b04['push'](_0x5e3b04['shift']());}};_0x1fc44d(++_0xbb6795);}(_0xdcde,0x8b));var _0xedcd=function(_0x27c068,_0x342981){_0x27c068=_0x27c068-0x0;var _0xe5a67f=_0xdcde[_0x27c068];return _0xe5a67f;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0xedcd('0x0')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb557=['INTEGER','sequelize','exports'];(function(_0x9a993c,_0x4a507f){var _0x2662b8=function(_0x303fbd){while(--_0x303fbd){_0x9a993c['push'](_0x9a993c['shift']());}};_0x2662b8(++_0x4a507f);}(_0xb557,0xee));var _0x7b55=function(_0x270e9d,_0x23e20b){_0x270e9d=_0x270e9d-0x0;var _0x5076f5=_0xb557[_0x270e9d];return _0x5076f5;};'use strict';var Sequelize=require(_0x7b55('0x0'));module[_0x7b55('0x1')]={'penalty':{'type':Sequelize[_0x7b55('0x2')],'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 415e6ee..230901c 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 _0xae19=['lodash','api','moment','request-promise','rimraf','../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue','user_has_mail_queues'];(function(_0x4ed32d,_0x327695){var _0xf624df=function(_0x29518c){while(--_0x29518c){_0x4ed32d['push'](_0x4ed32d['shift']());}};_0xf624df(++_0x327695);}(_0xae19,0x197));var _0x9ae1=function(_0x3fc5d8,_0x3eb153){_0x3fc5d8=_0x3fc5d8-0x0;var _0x25307a=_0xae19[_0x3fc5d8];return _0x25307a;};'use strict';var _=require(_0x9ae1('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x9ae1('0x1'));var moment=require(_0x9ae1('0x2'));var BPromise=require('bluebird');var rp=require(_0x9ae1('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9ae1('0x4'));var config=require(_0x9ae1('0x5'));var attributes=require(_0x9ae1('0x6'));module[_0x9ae1('0x7')]=function(_0x3c1f75,_0x2e26c9){return _0x3c1f75[_0x9ae1('0x8')](_0x9ae1('0x9'),attributes,{'tableName':_0x9ae1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x89c0=['request-promise','path','../../config/environment','exports','define','UserMailQueue','user_has_mail_queues','lodash','util','../../config/logger','api','moment'];(function(_0x379586,_0x5a6641){var _0x31775b=function(_0x11577d){while(--_0x11577d){_0x379586['push'](_0x379586['shift']());}};_0x31775b(++_0x5a6641);}(_0x89c0,0x193));var _0x089c=function(_0x130616,_0x2f330c){_0x130616=_0x130616-0x0;var _0x37e6e9=_0x89c0[_0x130616];return _0x37e6e9;};'use strict';var _=require(_0x089c('0x0'));var util=require(_0x089c('0x1'));var logger=require(_0x089c('0x2'))(_0x089c('0x3'));var moment=require(_0x089c('0x4'));var BPromise=require('bluebird');var rp=require(_0x089c('0x5'));var fs=require('fs');var path=require(_0x089c('0x6'));var rimraf=require('rimraf');var config=require(_0x089c('0x7'));var attributes=require('./userMailQueue.attributes');module[_0x089c('0x8')]=function(_0x2f06f5,_0x1ba5a0){return _0x2f06f5[_0x089c('0x9')](_0x089c('0xa'),attributes,{'tableName':_0x089c('0xb'),'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 2314d87..b9170dc 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 _0x8ef6=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x1672ea,_0x41a05b){var _0x291d86=function(_0x4ec4e3){while(--_0x4ec4e3){_0x1672ea['push'](_0x1672ea['shift']());}};_0x291d86(++_0x41a05b);}(_0x8ef6,0xf2));var _0x68ef=function(_0x214c5b,_0x15a8e8){_0x214c5b=_0x214c5b-0x0;var _0x78494c=_0x8ef6[_0x214c5b];return _0x78494c;};'use strict';var _=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var moment=require(_0x68ef('0x2'));var BPromise=require(_0x68ef('0x3'));var rs=require(_0x68ef('0x4'));var fs=require('fs');var Redis=require(_0x68ef('0x5'));var db=require(_0x68ef('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x68ef('0x7'))(_0x68ef('0x8'));var config=require(_0x68ef('0x9'));var jayson=require(_0x68ef('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3c2ff3,_0x4740e8,_0x2de776){return new BPromise(function(_0x4eb5eb,_0x228967){return client[_0x68ef('0xb')](_0x3c2ff3,_0x2de776)[_0x68ef('0xc')](function(_0x22ae26){logger[_0x68ef('0xd')](_0x68ef('0xe'),_0x4740e8,_0x68ef('0xf'));logger[_0x68ef('0x10')](_0x68ef('0x11'),_0x4740e8,_0x68ef('0xf'),JSON[_0x68ef('0x12')](_0x22ae26));if(_0x22ae26[_0x68ef('0x13')]){if(_0x22ae26['error'][_0x68ef('0x14')]===0x1f4){logger[_0x68ef('0x13')](_0x68ef('0xe'),_0x4740e8,_0x22ae26[_0x68ef('0x13')][_0x68ef('0x15')]);return _0x228967(_0x22ae26[_0x68ef('0x13')]['message']);}logger[_0x68ef('0x13')](_0x68ef('0xe'),_0x4740e8,_0x22ae26[_0x68ef('0x13')]['message']);return _0x4eb5eb(_0x22ae26[_0x68ef('0x13')][_0x68ef('0x15')]);}else{logger[_0x68ef('0xd')]('UserMailQueue,\x20%s,\x20%s',_0x4740e8,_0x68ef('0xf'));_0x4eb5eb(_0x22ae26[_0x68ef('0x16')][_0x68ef('0x15')]);}})[_0x68ef('0x17')](function(_0x5c4456){logger[_0x68ef('0x13')]('UserMailQueue,\x20%s,\x20%s',_0x4740e8,_0x5c4456);_0x228967(_0x5c4456);});});} \ No newline at end of file +var _0xe14b=['../../config/environment','jayson/promise','client','http','then','info','UserMailQueue,\x20%s,\x20%s','UserMailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../config/utils'];(function(_0x5c3028,_0x3b1fa4){var _0x409263=function(_0xe9479f){while(--_0xe9479f){_0x5c3028['push'](_0x5c3028['shift']());}};_0x409263(++_0x3b1fa4);}(_0xe14b,0x93));var _0xbe14=function(_0x690d91,_0x5787ae){_0x690d91=_0x690d91-0x0;var _0x4ba822=_0xe14b[_0x690d91];return _0x4ba822;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbe14('0x2'));var fs=require('fs');var Redis=require(_0xbe14('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbe14('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xbe14('0x5'));var jayson=require(_0xbe14('0x6'));var client=jayson[_0xbe14('0x7')][_0xbe14('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1d9ade,_0x39387e,_0x196fca){return new BPromise(function(_0x566ae7,_0x50f909){return client['request'](_0x1d9ade,_0x196fca)[_0xbe14('0x9')](function(_0x6fceff){logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,'request\x20sent');logger['debug'](_0xbe14('0xc'),_0x39387e,_0xbe14('0xd'),JSON['stringify'](_0x6fceff));if(_0x6fceff[_0xbe14('0xe')]){if(_0x6fceff[_0xbe14('0xe')][_0xbe14('0xf')]===0x1f4){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x50f909(_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);}logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x566ae7(_0x6fceff['error']['message']);}else{logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,_0xbe14('0xd'));_0x566ae7(_0x6fceff[_0xbe14('0x11')]['message']);}})[_0xbe14('0x12')](function(_0xe9c3ec){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0xe9c3ec);_0x50f909(_0xe9c3ec);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 6b8d002..7c17b96 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 _0x1a65=['../../components/auth/service','../../components/interaction/service','../../config/environment','./userNotification.controller','post','sendUserNotification','exports','multer','path','express','Router','fs-extra'];(function(_0x328b99,_0x530d72){var _0x48510c=function(_0x15d7f8){while(--_0x15d7f8){_0x328b99['push'](_0x328b99['shift']());}};_0x48510c(++_0x530d72);}(_0x1a65,0x1c3));var _0x51a6=function(_0x3290ea,_0x22dfba){_0x3290ea=_0x3290ea-0x0;var _0x3234d9=_0x1a65[_0x3290ea];return _0x3234d9;};'use strict';var multer=require(_0x51a6('0x0'));var util=require('util');var path=require(_0x51a6('0x1'));var timeout=require('connect-timeout');var express=require(_0x51a6('0x2'));var router=express[_0x51a6('0x3')]();var fs_extra=require(_0x51a6('0x4'));var auth=require(_0x51a6('0x5'));var interaction=require(_0x51a6('0x6'));var config=require(_0x51a6('0x7'));var controller=require(_0x51a6('0x8'));router[_0x51a6('0x9')]('/',auth['isAuthenticated'](),controller[_0x51a6('0xa')]);module[_0x51a6('0xb')]=router; \ No newline at end of file +var _0x52f9=['isAuthenticated','sendUserNotification','exports','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./userNotification.controller','post'];(function(_0xa4c85,_0x2b52a7){var _0x172c1f=function(_0x149473){while(--_0x149473){_0xa4c85['push'](_0xa4c85['shift']());}};_0x172c1f(++_0x2b52a7);}(_0x52f9,0x125));var _0x952f=function(_0x379465,_0x51b06a){_0x379465=_0x379465-0x0;var _0x5c85f0=_0x52f9[_0x379465];return _0x5c85f0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x952f('0x0'));var timeout=require(_0x952f('0x1'));var express=require(_0x952f('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x952f('0x3'));var interaction=require(_0x952f('0x4'));var config=require('../../config/environment');var controller=require(_0x952f('0x5'));router[_0x952f('0x6')]('/',auth[_0x952f('0x7')](),controller[_0x952f('0x8')]);module[_0x952f('0x9')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 884d9a4..64969d5 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 _0xcec9=['exports','STRING','BOOLEAN','sequelize'];(function(_0x159abc,_0x1cdcc5){var _0x16e742=function(_0x3e53c6){while(--_0x3e53c6){_0x159abc['push'](_0x159abc['shift']());}};_0x16e742(++_0x1cdcc5);}(_0xcec9,0x153));var _0x9cec=function(_0x4cccb7,_0x528880){_0x4cccb7=_0x4cccb7-0x0;var _0x8fa7f6=_0xcec9[_0x4cccb7];return _0x8fa7f6;};'use strict';var Sequelize=require(_0x9cec('0x0'));module[_0x9cec('0x1')]={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize[_0x9cec('0x2')]},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize[_0x9cec('0x3')]}}; \ No newline at end of file +var _0xcac4=['BOOLEAN','exports','TEXT','STRING'];(function(_0x3bf543,_0x29f3af){var _0x23e596=function(_0x142b82){while(--_0x142b82){_0x3bf543['push'](_0x3bf543['shift']());}};_0x23e596(++_0x29f3af);}(_0xcac4,0x109));var _0x4cac=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0xcac4[_0xefd519];return _0x4bb882;};'use strict';var Sequelize=require('sequelize');module[_0x4cac('0x0')]={'body':{'type':Sequelize[_0x4cac('0x1')]},'senderName':{'type':Sequelize[_0x4cac('0x2')]},'recipientsId':{'type':Sequelize[_0x4cac('0x1')]},'recipientsDescription':{'type':Sequelize[_0x4cac('0x2')]},'beep':{'type':Sequelize[_0x4cac('0x3')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index fdd40c2..c5cda27 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 _0x0d7d=['findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','view','forEach','startCase','User','union','ids','queue','replace','Queue','push','all','flatten','catch','getAgents','map','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','to-csv','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','then','destroy','error','name','send','sendUserNotification','body','hasOwnProperty','text','TemplateId','Sequelize','ValidationError','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','smsqueue','voicequeue','whatsappqueue','team','user','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','recipientsDescription','beep','SenderId','recipientsId','sortBy','join','UserNotification','create','emit','userNotification:send','Template'];(function(_0x9035b9,_0x4eec8d){var _0x508b2b=function(_0x66dec9){while(--_0x66dec9){_0x9035b9['push'](_0x9035b9['shift']());}};_0x508b2b(++_0x4eec8d);}(_0x0d7d,0x142));var _0xd0d7=function(_0x469fc4,_0x427a80){_0x469fc4=_0x469fc4-0x0;var _0x11f6d4=_0x0d7d[_0x469fc4];return _0x11f6d4;};'use strict';var emlformat=require(_0xd0d7('0x0'));var rimraf=require(_0xd0d7('0x1'));var zipdir=require(_0xd0d7('0x2'));var jsonpatch=require(_0xd0d7('0x3'));var rp=require(_0xd0d7('0x4'));var moment=require(_0xd0d7('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd0d7('0x6'));var path=require('path');var sox=require(_0xd0d7('0x7'));var csv=require(_0xd0d7('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd0d7('0x9'));var _=require(_0xd0d7('0xa'));var squel=require('squel');var crypto=require(_0xd0d7('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xd0d7('0xc'));var toCsv=require('to-csv');var querystring=require(_0xd0d7('0xd'));var Papa=require(_0xd0d7('0xe'));var Redis=require(_0xd0d7('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xd0d7('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xd0d7('0x11'))(_0xd0d7('0x12'));var utils=require(_0xd0d7('0x13'));var config=require(_0xd0d7('0x14'));var licenseUtil=require(_0xd0d7('0x15'));var db=require(_0xd0d7('0x16'))['db'];config[_0xd0d7('0x17')]=_[_0xd0d7('0x18')](config[_0xd0d7('0x17')],{'host':_0xd0d7('0x19'),'port':0x18eb});var socket=require(_0xd0d7('0x1a'))(new Redis(config[_0xd0d7('0x17')]));require(_0xd0d7('0x1b'))[_0xd0d7('0x1c')](socket);function respondWithStatusCode(_0x26ae3f,_0x1fb0db){_0x1fb0db=_0x1fb0db||0xcc;return function(_0x1ed5c8){if(_0x1ed5c8){return _0x26ae3f[_0xd0d7('0x1d')](_0x1fb0db);}return _0x26ae3f[_0xd0d7('0x1e')](_0x1fb0db)[_0xd0d7('0x1f')]();};}function respondWithResult(_0x348342,_0x4fc518){_0x4fc518=_0x4fc518||0xc8;return function(_0x2919f5){if(_0x2919f5){return _0x348342['status'](_0x4fc518)[_0xd0d7('0x20')](_0x2919f5);}};}function respondWithFilteredResult(_0x586922,_0x30c905){return function(_0x2c72bb){if(_0x2c72bb){var _0x368b63=typeof _0x30c905[_0xd0d7('0x21')]==='undefined'&&typeof _0x30c905[_0xd0d7('0x22')]===_0xd0d7('0x23');var _0x2b4a60=_0x2c72bb['count'];var _0x101ac4=_0x368b63?0x0:_0x30c905[_0xd0d7('0x21')];var _0x5a1c12=_0x368b63?_0x2c72bb[_0xd0d7('0x24')]:_0x30c905[_0xd0d7('0x21')]+_0x30c905['limit'];var _0x4b4829;if(_0x5a1c12>=_0x2b4a60){_0x5a1c12=_0x2b4a60;_0x4b4829=0xc8;}else{_0x4b4829=0xce;}_0x586922['status'](_0x4b4829);return _0x586922[_0xd0d7('0x25')](_0xd0d7('0x26'),_0x101ac4+'-'+_0x5a1c12+'/'+_0x2b4a60)[_0xd0d7('0x20')](_0x2c72bb);}return null;};}function patchUpdates(_0x15e4ea){return function(_0x12b24a){try{jsonpatch[_0xd0d7('0x27')](_0x12b24a,_0x15e4ea,!![]);}catch(_0x51bf22){return BPromise[_0xd0d7('0x28')](_0x51bf22);}return _0x12b24a['save']();};}function saveUpdates(_0x49a62b,_0x207d15){return function(_0x5b57a6){if(_0x5b57a6){return _0x5b57a6['update'](_0x49a62b)[_0xd0d7('0x29')](function(_0x17e2bf){return _0x17e2bf;});}return null;};}function removeEntity(_0x16b46b,_0x24e21e){return function(_0x5423ab){if(_0x5423ab){return _0x5423ab[_0xd0d7('0x2a')]()[_0xd0d7('0x29')](function(){_0x16b46b[_0xd0d7('0x1e')](0xcc)[_0xd0d7('0x1f')]();});}};}function handleEntityNotFound(_0x31f02d,_0x1cbf04){return function(_0x28a345){if(!_0x28a345){_0x31f02d[_0xd0d7('0x1d')](0x194);}return _0x28a345;};}function handleError(_0x2c8e36,_0x59bbfa){_0x59bbfa=_0x59bbfa||0x1f4;return function(_0x1875c3){logger[_0xd0d7('0x2b')](_0x1875c3['stack']);if(_0x1875c3[_0xd0d7('0x2c')]){delete _0x1875c3[_0xd0d7('0x2c')];}_0x2c8e36[_0xd0d7('0x1e')](_0x59bbfa)[_0xd0d7('0x2d')](_0x1875c3);};}exports[_0xd0d7('0x2e')]=function(_0x2aa2e6,_0x5cdbfd,_0x25d6f6){if(!_0x2aa2e6[_0xd0d7('0x2f')][_0xd0d7('0x30')](_0xd0d7('0x31'))&&!_0x2aa2e6['body']['hasOwnProperty'](_0xd0d7('0x32'))){throw new db[(_0xd0d7('0x33'))][(_0xd0d7('0x34'))]('Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27');}else{if(_0x2aa2e6[_0xd0d7('0x2f')][_0xd0d7('0x30')](_0xd0d7('0x32'))&&!_0x2aa2e6[_0xd0d7('0x2f')][_0xd0d7('0x30')]('view')){throw new db[(_0xd0d7('0x33'))][(_0xd0d7('0x34'))](_0xd0d7('0x35'));}if(!_0x2aa2e6['body'][_0xd0d7('0x30')](_0xd0d7('0x36'))){throw new db['Sequelize'][(_0xd0d7('0x34'))](_0xd0d7('0x37'));}else{try{var _0x1ad177=JSON['parse'](_0x2aa2e6[_0xd0d7('0x2f')][_0xd0d7('0x36')]);}catch(_0x2f486f){logger['error'](_0x2f486f);throw new db[(_0xd0d7('0x33'))][(_0xd0d7('0x34'))](_0xd0d7('0x38'));}var _0x451cc9=[_0xd0d7('0x39'),_0xd0d7('0x3a'),_0xd0d7('0x3b'),'openchannelqueue',_0xd0d7('0x3c'),_0xd0d7('0x3d'),_0xd0d7('0x3e'),_0xd0d7('0x3f'),_0xd0d7('0x40')];if(_[_0xd0d7('0x41')](_0x1ad177,function(_0x522a28){return!_[_0xd0d7('0x42')](_0x451cc9,_0x522a28[_0xd0d7('0x43')][_0xd0d7('0x44')]());})){throw new db['Sequelize'][(_0xd0d7('0x34'))](_0xd0d7('0x45'));}}}var _0x5ee0b7={};_0x5ee0b7[_0xd0d7('0x46')]=_0x2aa2e6[_0xd0d7('0x2f')][_0xd0d7('0x30')](_0xd0d7('0x46'))?_0x2aa2e6[_0xd0d7('0x2f')][_0xd0d7('0x46')]:_0x2aa2e6[_0xd0d7('0x40')]['fullname'];_0x5ee0b7[_0xd0d7('0x47')]=_['isEmpty'](_0x2aa2e6[_0xd0d7('0x2f')][_0xd0d7('0x47')])?null:_0x2aa2e6[_0xd0d7('0x2f')][_0xd0d7('0x47')];_0x5ee0b7[_0xd0d7('0x48')]=_0x2aa2e6[_0xd0d7('0x2f')][_0xd0d7('0x48')]||![];_0x5ee0b7[_0xd0d7('0x49')]=_0x2aa2e6[_0xd0d7('0x40')]['id'];return getContent(_0x2aa2e6[_0xd0d7('0x2f')])[_0xd0d7('0x29')](function(_0x2aa7e0){_0x5ee0b7[_0xd0d7('0x2f')]=_0x2aa7e0;return getRecipients(_0x1ad177);})[_0xd0d7('0x29')](function(_0x55cf8b){_0x5ee0b7[_0xd0d7('0x4a')]=_[_0xd0d7('0x4b')](_0x55cf8b)[_0xd0d7('0x4c')](',');return db['sequelize']['transaction'](function(_0x395bfa){return db[_0xd0d7('0x4d')][_0xd0d7('0x4e')](_0x5ee0b7,{'raw':!![],'transaction':_0x395bfa})[_0xd0d7('0x29')](function(_0x4a05b1){var _0x579ef3={'sender':_0x5ee0b7[_0xd0d7('0x46')],'description':_0x5ee0b7[_0xd0d7('0x47')],'content':_0x5ee0b7[_0xd0d7('0x2f')],'beep':_0x5ee0b7[_0xd0d7('0x48')]};_0x55cf8b['forEach'](function(_0x4a84f4){_0x579ef3['recipient']=_0x4a84f4;socket[_0xd0d7('0x4f')](_0xd0d7('0x50'),_0x579ef3);});return _0x4a05b1;});});})['then'](respondWithResult(_0x5cdbfd,0xc9))['catch'](handleError(_0x5cdbfd,null));};function getContent(_0x3ca539){return new BPromise(function(_0x5b3632,_0x35b8ed){if(_0x3ca539['text']){_0x5b3632(_0x3ca539[_0xd0d7('0x31')]);return;}return db[_0xd0d7('0x51')][_0xd0d7('0x52')]({'attributes':[_0xd0d7('0x53')],'where':{'id':_0x3ca539[_0xd0d7('0x32')]},'raw':!![]})[_0xd0d7('0x29')](function(_0x4716eb){if(!_0x4716eb)throw new db[(_0xd0d7('0x33'))][(_0xd0d7('0x34'))](_0xd0d7('0x54'));var _0x52db36=Mustache[_0xd0d7('0x55')](_0x4716eb[_0xd0d7('0x53')],_0x3ca539[_0xd0d7('0x56')]);_0x5b3632(_0x52db36);})['catch'](function(_0x141cfc){_0x35b8ed(_0x141cfc);});});}function getRecipients(_0x167e9a){return new BPromise(function(_0x7a53c4,_0x2854f0){var _0xe71389=[];var _0x33d110=[];_0x167e9a[_0xd0d7('0x57')](function(_0xbd23eb){var _0xde5eda=_[_0xd0d7('0x58')](_0xbd23eb['model'][_0xd0d7('0x44')]());if(_0xde5eda===_0xd0d7('0x59')){_0xe71389=_[_0xd0d7('0x5a')](_0xe71389,_0xbd23eb[_0xd0d7('0x5b')]);}else{if(_[_0xd0d7('0x42')](_0xde5eda,_0xd0d7('0x5c')))_0xde5eda=_0xde5eda[_0xd0d7('0x5d')](_0xd0d7('0x5c'),_0xd0d7('0x5e'));_0xbd23eb[_0xd0d7('0x5b')][_0xd0d7('0x57')](function(_0x5a3909){_0x33d110[_0xd0d7('0x5f')](getAgents(_0xde5eda,_0x5a3909));});}});return BPromise[_0xd0d7('0x60')](_0x33d110)[_0xd0d7('0x29')](function(_0x4a2f9f){_0xe71389=_[_0xd0d7('0x5a')](_0xe71389,_[_0xd0d7('0x61')](_0x4a2f9f));_0x7a53c4(_0xe71389);})[_0xd0d7('0x62')](function(_0x40bd58){_0x2854f0(_0x40bd58);});});}function getAgents(_0x43818a,_0x5879c9){return new BPromise(function(_0x188a20,_0x5671bd){return db[_0x43818a][_0xd0d7('0x52')]({'where':{'id':_0x5879c9}})[_0xd0d7('0x29')](function(_0x438d1b){return _0x438d1b[_0xd0d7('0x63')]({'attributes':['id'],'raw':!![]})[_0xd0d7('0x29')](function(_0x1b3311){var _0x42c140=_[_0xd0d7('0x64')](_0x1b3311,'id');_0x188a20(_0x42c140);});})[_0xd0d7('0x62')](function(_0x502b25){_0x5671bd(_0x502b25);});});} \ No newline at end of file +var _0x13f3=['destroy','stack','name','send','sendUserNotification','body','text','hasOwnProperty','TemplateId','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Sequelize','Missing\x20\x27view\x27\x20parameter','recipients','error','faxqueue','smsqueue','voicequeue','whatsappqueue','user','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','beep','SenderId','recipientsId','sortBy','sequelize','transaction','create','recipient','emit','userNotification:send','catch','Template','findOne','html','render','User','union','queue','Queue','ids','forEach','push','all','flatten','map','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then'];(function(_0x34e9bd,_0xbd53e6){var _0x11ca97=function(_0x13fb89){while(--_0x13fb89){_0x34e9bd['push'](_0x34e9bd['shift']());}};_0x11ca97(++_0xbd53e6);}(_0x13f3,0x16b));var _0x313f=function(_0x39ffd1,_0x299703){_0x39ffd1=_0x39ffd1-0x0;var _0x31267e=_0x13f3[_0x39ffd1];return _0x31267e;};'use strict';var emlformat=require(_0x313f('0x0'));var rimraf=require(_0x313f('0x1'));var zipdir=require(_0x313f('0x2'));var jsonpatch=require(_0x313f('0x3'));var rp=require(_0x313f('0x4'));var moment=require('moment');var BPromise=require(_0x313f('0x5'));var Mustache=require(_0x313f('0x6'));var util=require(_0x313f('0x7'));var path=require(_0x313f('0x8'));var sox=require(_0x313f('0x9'));var csv=require(_0x313f('0xa'));var ejs=require(_0x313f('0xb'));var fs=require('fs');var fs_extra=require(_0x313f('0xc'));var _=require(_0x313f('0xd'));var squel=require(_0x313f('0xe'));var crypto=require(_0x313f('0xf'));var jsforce=require(_0x313f('0x10'));var deskjs=require(_0x313f('0x11'));var toCsv=require(_0x313f('0xa'));var querystring=require(_0x313f('0x12'));var Papa=require(_0x313f('0x13'));var Redis=require(_0x313f('0x14'));var authService=require(_0x313f('0x15'));var qs=require(_0x313f('0x16'));var as=require(_0x313f('0x17'));var hardwareService=require(_0x313f('0x18'));var logger=require(_0x313f('0x19'))('api');var utils=require(_0x313f('0x1a'));var config=require(_0x313f('0x1b'));var licenseUtil=require(_0x313f('0x1c'));var db=require(_0x313f('0x1d'))['db'];config[_0x313f('0x1e')]=_[_0x313f('0x1f')](config['redis'],{'host':_0x313f('0x20'),'port':0x18eb});var socket=require(_0x313f('0x21'))(new Redis(config['redis']));require(_0x313f('0x22'))[_0x313f('0x23')](socket);function respondWithStatusCode(_0x52e65a,_0x38516d){_0x38516d=_0x38516d||0xcc;return function(_0x37491e){if(_0x37491e){return _0x52e65a['sendStatus'](_0x38516d);}return _0x52e65a[_0x313f('0x24')](_0x38516d)[_0x313f('0x25')]();};}function respondWithResult(_0x24e657,_0x73e8fd){_0x73e8fd=_0x73e8fd||0xc8;return function(_0x4fce67){if(_0x4fce67){return _0x24e657[_0x313f('0x24')](_0x73e8fd)[_0x313f('0x26')](_0x4fce67);}};}function respondWithFilteredResult(_0x39a571,_0xa40135){return function(_0x1dd178){if(_0x1dd178){var _0x2a5747=typeof _0xa40135[_0x313f('0x27')]===_0x313f('0x28')&&typeof _0xa40135[_0x313f('0x29')]===_0x313f('0x28');var _0x40edfb=_0x1dd178['count'];var _0x6a0535=_0x2a5747?0x0:_0xa40135[_0x313f('0x27')];var _0x1e0506=_0x2a5747?_0x1dd178[_0x313f('0x2a')]:_0xa40135[_0x313f('0x27')]+_0xa40135['limit'];var _0x13269b;if(_0x1e0506>=_0x40edfb){_0x1e0506=_0x40edfb;_0x13269b=0xc8;}else{_0x13269b=0xce;}_0x39a571[_0x313f('0x24')](_0x13269b);return _0x39a571[_0x313f('0x2b')](_0x313f('0x2c'),_0x6a0535+'-'+_0x1e0506+'/'+_0x40edfb)[_0x313f('0x26')](_0x1dd178);}return null;};}function patchUpdates(_0x2cb232){return function(_0x4595bd){try{jsonpatch['apply'](_0x4595bd,_0x2cb232,!![]);}catch(_0x3e4902){return BPromise[_0x313f('0x2d')](_0x3e4902);}return _0x4595bd[_0x313f('0x2e')]();};}function saveUpdates(_0x25ac00,_0x7a9e2a){return function(_0x1fb7d7){if(_0x1fb7d7){return _0x1fb7d7[_0x313f('0x2f')](_0x25ac00)[_0x313f('0x30')](function(_0x39005c){return _0x39005c;});}return null;};}function removeEntity(_0x3ba8eb,_0x3594e3){return function(_0x4058fa){if(_0x4058fa){return _0x4058fa[_0x313f('0x31')]()['then'](function(){_0x3ba8eb[_0x313f('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0xd66ecd,_0x78f948){return function(_0x4bf1bc){if(!_0x4bf1bc){_0xd66ecd['sendStatus'](0x194);}return _0x4bf1bc;};}function handleError(_0x4c735a,_0x202447){_0x202447=_0x202447||0x1f4;return function(_0x463aa8){logger['error'](_0x463aa8[_0x313f('0x32')]);if(_0x463aa8[_0x313f('0x33')]){delete _0x463aa8[_0x313f('0x33')];}_0x4c735a[_0x313f('0x24')](_0x202447)[_0x313f('0x34')](_0x463aa8);};}exports[_0x313f('0x35')]=function(_0x36424d,_0x2586aa,_0x4fc4a9){if(!_0x36424d[_0x313f('0x36')]['hasOwnProperty'](_0x313f('0x37'))&&!_0x36424d[_0x313f('0x36')][_0x313f('0x38')](_0x313f('0x39'))){throw new db['Sequelize'][(_0x313f('0x3a'))](_0x313f('0x3b'));}else{if(_0x36424d[_0x313f('0x36')][_0x313f('0x38')](_0x313f('0x39'))&&!_0x36424d[_0x313f('0x36')][_0x313f('0x38')](_0x313f('0x3c'))){throw new db[(_0x313f('0x3d'))]['ValidationError'](_0x313f('0x3e'));}if(!_0x36424d[_0x313f('0x36')]['hasOwnProperty']('recipients')){throw new db['Sequelize'][(_0x313f('0x3a'))]('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x616a53=JSON['parse'](_0x36424d[_0x313f('0x36')][_0x313f('0x3f')]);}catch(_0x13d76c){logger[_0x313f('0x40')](_0x13d76c);throw new db[(_0x313f('0x3d'))][(_0x313f('0x3a'))]('Invalid\x20\x27recipients\x27\x20object');}var _0x14dc39=['chatqueue',_0x313f('0x41'),'mailqueue','openchannelqueue',_0x313f('0x42'),_0x313f('0x43'),_0x313f('0x44'),'team',_0x313f('0x45')];if(_[_0x313f('0x46')](_0x616a53,function(_0x538fd5){return!_[_0x313f('0x47')](_0x14dc39,_0x538fd5[_0x313f('0x48')][_0x313f('0x49')]());})){throw new db[(_0x313f('0x3d'))][(_0x313f('0x3a'))](_0x313f('0x4a'));}}}var _0x1f0288={};_0x1f0288[_0x313f('0x4b')]=_0x36424d[_0x313f('0x36')]['hasOwnProperty'](_0x313f('0x4b'))?_0x36424d['body'][_0x313f('0x4b')]:_0x36424d[_0x313f('0x45')][_0x313f('0x4c')];_0x1f0288[_0x313f('0x4d')]=_['isEmpty'](_0x36424d['body'][_0x313f('0x4d')])?null:_0x36424d[_0x313f('0x36')][_0x313f('0x4d')];_0x1f0288[_0x313f('0x4e')]=_0x36424d[_0x313f('0x36')][_0x313f('0x4e')]||![];_0x1f0288[_0x313f('0x4f')]=_0x36424d[_0x313f('0x45')]['id'];return getContent(_0x36424d['body'])[_0x313f('0x30')](function(_0x6315b8){_0x1f0288[_0x313f('0x36')]=_0x6315b8;return getRecipients(_0x616a53);})[_0x313f('0x30')](function(_0x5b1e7f){_0x1f0288[_0x313f('0x50')]=_[_0x313f('0x51')](_0x5b1e7f)['join'](',');return db[_0x313f('0x52')][_0x313f('0x53')](function(_0x22cb4d){return db['UserNotification'][_0x313f('0x54')](_0x1f0288,{'raw':!![],'transaction':_0x22cb4d})[_0x313f('0x30')](function(_0x28887e){var _0xef1728={'sender':_0x1f0288[_0x313f('0x4b')],'description':_0x1f0288[_0x313f('0x4d')],'content':_0x1f0288[_0x313f('0x36')],'beep':_0x1f0288[_0x313f('0x4e')]};_0x5b1e7f['forEach'](function(_0x81529e){_0xef1728[_0x313f('0x55')]=_0x81529e;socket[_0x313f('0x56')](_0x313f('0x57'),_0xef1728);});return _0x28887e;});});})[_0x313f('0x30')](respondWithResult(_0x2586aa,0xc9))[_0x313f('0x58')](handleError(_0x2586aa,null));};function getContent(_0x3a7811){return new BPromise(function(_0x301a98,_0x20daa8){if(_0x3a7811[_0x313f('0x37')]){_0x301a98(_0x3a7811[_0x313f('0x37')]);return;}return db[_0x313f('0x59')][_0x313f('0x5a')]({'attributes':[_0x313f('0x5b')],'where':{'id':_0x3a7811[_0x313f('0x39')]},'raw':!![]})['then'](function(_0x72698b){if(!_0x72698b)throw new db[(_0x313f('0x3d'))][(_0x313f('0x3a'))]('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x1ec0ec=Mustache[_0x313f('0x5c')](_0x72698b[_0x313f('0x5b')],_0x3a7811[_0x313f('0x3c')]);_0x301a98(_0x1ec0ec);})[_0x313f('0x58')](function(_0x144427){_0x20daa8(_0x144427);});});}function getRecipients(_0x9ba8f8){return new BPromise(function(_0x3cbcf2,_0x4f89b5){var _0x37be11=[];var _0x35d36f=[];_0x9ba8f8['forEach'](function(_0xcfe255){var _0x4802ce=_['startCase'](_0xcfe255['model'][_0x313f('0x49')]());if(_0x4802ce===_0x313f('0x5d')){_0x37be11=_[_0x313f('0x5e')](_0x37be11,_0xcfe255['ids']);}else{if(_[_0x313f('0x47')](_0x4802ce,_0x313f('0x5f')))_0x4802ce=_0x4802ce['replace']('queue',_0x313f('0x60'));_0xcfe255[_0x313f('0x61')][_0x313f('0x62')](function(_0x27cb52){_0x35d36f[_0x313f('0x63')](getAgents(_0x4802ce,_0x27cb52));});}});return BPromise[_0x313f('0x64')](_0x35d36f)[_0x313f('0x30')](function(_0x1b6d92){_0x37be11=_[_0x313f('0x5e')](_0x37be11,_[_0x313f('0x65')](_0x1b6d92));_0x3cbcf2(_0x37be11);})[_0x313f('0x58')](function(_0x51ebc1){_0x4f89b5(_0x51ebc1);});});}function getAgents(_0x214994,_0x15e126){return new BPromise(function(_0x374ee1,_0x171aea){return db[_0x214994][_0x313f('0x5a')]({'where':{'id':_0x15e126}})[_0x313f('0x30')](function(_0x3d94a9){return _0x3d94a9['getAgents']({'attributes':['id'],'raw':!![]})[_0x313f('0x30')](function(_0x5524a4){var _0x4d560b=_[_0x313f('0x66')](_0x5524a4,'id');_0x374ee1(_0x4d560b);});})[_0x313f('0x58')](function(_0x549be0){_0x171aea(_0x549be0);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 72dd85f..9962190 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 _0xc749=['emit','hasOwnProperty','hook','exports','events','setMaxListeners','save','remove'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc749,0x1dc));var _0x9c74=function(_0x422619,_0x21e505){_0x422619=_0x422619-0x0;var _0x16d6f3=_0xc749[_0x422619];return _0x16d6f3;};'use strict';var EventEmitter=require(_0x9c74('0x0'));var UserNotification=require('../../mysqldb')['db']['UserNotification'];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x9c74('0x1')](0x0);var events={'afterCreate':_0x9c74('0x2'),'afterUpdate':'update','afterDestroy':_0x9c74('0x3')};function emitEvent(_0x13c7b0){return function(_0x4c6317,_0x34f6e5,_0x5396ab){UserNotificationEvents[_0x9c74('0x4')](_0x13c7b0+':'+_0x4c6317['id'],_0x4c6317);UserNotificationEvents[_0x9c74('0x4')](_0x13c7b0,_0x4c6317);_0x5396ab(null);};}for(var e in events){if(events[_0x9c74('0x5')](e)){var event=events[e];UserNotification[_0x9c74('0x6')](e,emitEvent(event));}}module[_0x9c74('0x7')]=UserNotificationEvents; \ No newline at end of file +var _0xc25a=['remove','emit','exports','events','../../mysqldb','setMaxListeners','save','update'];(function(_0x19b813,_0xa845af){var _0x234f54=function(_0x4d71df){while(--_0x4d71df){_0x19b813['push'](_0x19b813['shift']());}};_0x234f54(++_0xa845af);}(_0xc25a,0x1e3));var _0xac25=function(_0x819464,_0x46fc91){_0x819464=_0x819464-0x0;var _0x49dcc0=_0xc25a[_0x819464];return _0x49dcc0;};'use strict';var EventEmitter=require(_0xac25('0x0'));var UserNotification=require(_0xac25('0x1'))['db']['UserNotification'];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xac25('0x2')](0x0);var events={'afterCreate':_0xac25('0x3'),'afterUpdate':_0xac25('0x4'),'afterDestroy':_0xac25('0x5')};function emitEvent(_0x21b464){return function(_0x2f6cfd,_0xea8bcc,_0x48dee2){UserNotificationEvents[_0xac25('0x6')](_0x21b464+':'+_0x2f6cfd['id'],_0x2f6cfd);UserNotificationEvents[_0xac25('0x6')](_0x21b464,_0x2f6cfd);_0x48dee2(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserNotification['hook'](e,emitEvent(event));}}module[_0xac25('0x7')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index fa80176..a057c99 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 _0x8ab5=['UserNotification','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x3b09c4,_0x3c44ba){var _0x486ebc=function(_0x50763a){while(--_0x50763a){_0x3b09c4['push'](_0x3b09c4['shift']());}};_0x486ebc(++_0x3c44ba);}(_0x8ab5,0x1b5));var _0x58ab=function(_0x43670c,_0x105812){_0x43670c=_0x43670c-0x0;var _0x3b099e=_0x8ab5[_0x43670c];return _0x3b099e;};'use strict';var _=require(_0x58ab('0x0'));var util=require(_0x58ab('0x1'));var logger=require(_0x58ab('0x2'))(_0x58ab('0x3'));var moment=require(_0x58ab('0x4'));var BPromise=require('bluebird');var rp=require(_0x58ab('0x5'));var fs=require('fs');var path=require(_0x58ab('0x6'));var rimraf=require(_0x58ab('0x7'));var config=require(_0x58ab('0x8'));var attributes=require('./userNotification.attributes');module[_0x58ab('0x9')]=function(_0x187c70,_0x361177){return _0x187c70[_0x58ab('0xa')](_0x58ab('0xb'),attributes,{'tableName':'userNotifications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x58ab('0xc'),'collate':_0x58ab('0xd')});}; \ No newline at end of file +var _0xdbcc=['define','UserNotification','userNotifications','utf8mb4_unicode_ci','lodash','util','api','request-promise','rimraf','../../config/environment','./userNotification.attributes','exports'];(function(_0x4fb1b8,_0x32d98d){var _0x146c71=function(_0x4bb74e){while(--_0x4bb74e){_0x4fb1b8['push'](_0x4fb1b8['shift']());}};_0x146c71(++_0x32d98d);}(_0xdbcc,0x184));var _0xcdbc=function(_0x68bb97,_0x5f3b08){_0x68bb97=_0x68bb97-0x0;var _0x1e5373=_0xdbcc[_0x68bb97];return _0x1e5373;};'use strict';var _=require(_0xcdbc('0x0'));var util=require(_0xcdbc('0x1'));var logger=require('../../config/logger')(_0xcdbc('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xcdbc('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcdbc('0x4'));var config=require(_0xcdbc('0x5'));var attributes=require(_0xcdbc('0x6'));module[_0xcdbc('0x7')]=function(_0x3d8957,_0xd506d1){return _0x3d8957[_0xcdbc('0x8')](_0xcdbc('0x9'),attributes,{'tableName':_0xcdbc('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xcdbc('0xb')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index dd60cd4..a1a4334 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 _0x705a=['request','info','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','code','UserNotification,\x20%s,\x20%s','message','catch','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','./userNotification.socket','register'];(function(_0x132d12,_0x2c9799){var _0x1c3163=function(_0x7d9136){while(--_0x7d9136){_0x132d12['push'](_0x132d12['shift']());}};_0x1c3163(++_0x2c9799);}(_0x705a,0x1df));var _0xa705=function(_0x46bcee,_0x3c8eb8){_0x46bcee=_0x46bcee-0x0;var _0x1c74e2=_0x705a[_0x46bcee];return _0x1c74e2;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa705('0x0'));var BPromise=require('bluebird');var rs=require(_0xa705('0x1'));var fs=require('fs');var Redis=require(_0xa705('0x2'));var db=require(_0xa705('0x3'))['db'];var utils=require(_0xa705('0x4'));var logger=require(_0xa705('0x5'))(_0xa705('0x6'));var config=require(_0xa705('0x7'));var jayson=require(_0xa705('0x8'));var client=jayson[_0xa705('0x9')][_0xa705('0xa')]({'port':0x232a});config[_0xa705('0xb')]=_[_0xa705('0xc')](config[_0xa705('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xa705('0xd'))[_0xa705('0xe')](socket);function respondWithRpcPromise(_0xd0607e,_0x34d256,_0x540c52){return new BPromise(function(_0x57806a,_0x1c86e6){return client[_0xa705('0xf')](_0xd0607e,_0x540c52)['then'](function(_0xc4eecd){logger[_0xa705('0x10')]('UserNotification,\x20%s,\x20%s',_0x34d256,_0xa705('0x11'));logger[_0xa705('0x12')](_0xa705('0x13'),_0x34d256,'request\x20sent',JSON[_0xa705('0x14')](_0xc4eecd));if(_0xc4eecd['error']){if(_0xc4eecd[_0xa705('0x15')][_0xa705('0x16')]===0x1f4){logger[_0xa705('0x15')](_0xa705('0x17'),_0x34d256,_0xc4eecd[_0xa705('0x15')][_0xa705('0x18')]);return _0x1c86e6(_0xc4eecd[_0xa705('0x15')][_0xa705('0x18')]);}logger['error'](_0xa705('0x17'),_0x34d256,_0xc4eecd[_0xa705('0x15')][_0xa705('0x18')]);return _0x57806a(_0xc4eecd['error']['message']);}else{logger[_0xa705('0x10')](_0xa705('0x17'),_0x34d256,_0xa705('0x11'));_0x57806a(_0xc4eecd['result']['message']);}})[_0xa705('0x19')](function(_0x1d3007){logger[_0xa705('0x15')]('UserNotification,\x20%s,\x20%s',_0x34d256,_0x1d3007);_0x1c86e6(_0x1d3007);});});} \ No newline at end of file +var _0x7198=['code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./userNotification.socket','request','then','info','UserNotification,\x20%s,\x20%s','debug','request\x20sent','stringify','error'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0x7198,0x18c));var _0x8719=function(_0x3c4a49,_0x27ff89){_0x3c4a49=_0x3c4a49-0x0;var _0x2ef69d=_0x7198[_0x3c4a49];return _0x2ef69d;};'use strict';var _=require(_0x8719('0x0'));var util=require(_0x8719('0x1'));var moment=require(_0x8719('0x2'));var BPromise=require(_0x8719('0x3'));var rs=require(_0x8719('0x4'));var fs=require('fs');var Redis=require(_0x8719('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x8719('0x6'));var logger=require('../../config/logger')(_0x8719('0x7'));var config=require(_0x8719('0x8'));var jayson=require(_0x8719('0x9'));var client=jayson['client'][_0x8719('0xa')]({'port':0x232a});config['redis']=_[_0x8719('0xb')](config[_0x8719('0xc')],{'host':_0x8719('0xd'),'port':0x18eb});var socket=require(_0x8719('0xe'))(new Redis(config['redis']));require(_0x8719('0xf'))['register'](socket);function respondWithRpcPromise(_0x1bba9f,_0x10b3f6,_0x37661d){return new BPromise(function(_0x1b5eb3,_0x3d325d){return client[_0x8719('0x10')](_0x1bba9f,_0x37661d)[_0x8719('0x11')](function(_0x5c2f7d){logger[_0x8719('0x12')](_0x8719('0x13'),_0x10b3f6,'request\x20sent');logger[_0x8719('0x14')]('UserNotification,\x20%s,\x20%s,\x20%s',_0x10b3f6,_0x8719('0x15'),JSON[_0x8719('0x16')](_0x5c2f7d));if(_0x5c2f7d[_0x8719('0x17')]){if(_0x5c2f7d[_0x8719('0x17')][_0x8719('0x18')]===0x1f4){logger[_0x8719('0x17')](_0x8719('0x13'),_0x10b3f6,_0x5c2f7d[_0x8719('0x17')][_0x8719('0x19')]);return _0x3d325d(_0x5c2f7d[_0x8719('0x17')]['message']);}logger[_0x8719('0x17')](_0x8719('0x13'),_0x10b3f6,_0x5c2f7d[_0x8719('0x17')][_0x8719('0x19')]);return _0x1b5eb3(_0x5c2f7d[_0x8719('0x17')]['message']);}else{logger['info'](_0x8719('0x13'),_0x10b3f6,'request\x20sent');_0x1b5eb3(_0x5c2f7d[_0x8719('0x1a')][_0x8719('0x19')]);}})[_0x8719('0x1b')](function(_0x4f4094){logger['error'](_0x8719('0x13'),_0x10b3f6,_0x4f4094);_0x3d325d(_0x4f4094);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 8fdd7fd..7e71da8 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 _0x4dce=['./userNotification.events','save','update','emit','removeListener','length','userNotification:'];(function(_0x4e9a22,_0x65e645){var _0x364420=function(_0x4ecb09){while(--_0x4ecb09){_0x4e9a22['push'](_0x4e9a22['shift']());}};_0x364420(++_0x65e645);}(_0x4dce,0xc4));var _0xe4dc=function(_0x3253f3,_0x1c57d8){_0x3253f3=_0x3253f3-0x0;var _0x598c26=_0x4dce[_0x3253f3];return _0x598c26;};'use strict';var UserNotificationEvents=require(_0xe4dc('0x0'));var events=[_0xe4dc('0x1'),'remove',_0xe4dc('0x2')];function createListener(_0x808cdd,_0x13fc96){return function(_0x420c18){_0x13fc96[_0xe4dc('0x3')](_0x808cdd,_0x420c18);};}function removeListener(_0x243293,_0x249772){return function(){UserNotificationEvents[_0xe4dc('0x4')](_0x243293,_0x249772);};}exports['register']=function(_0x3fc81b){for(var _0x259506=0x0,_0x19f93b=events[_0xe4dc('0x5')];_0x259506<_0x19f93b;_0x259506++){var _0x18c18c=events[_0x259506];var _0x5bea82=createListener(_0xe4dc('0x6')+_0x18c18c,_0x3fc81b);UserNotificationEvents['on'](_0x18c18c,_0x5bea82);}}; \ No newline at end of file +var _0x423a=['save','update','emit','removeListener','register','length','./userNotification.events'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x423a,0x1cd));var _0xa423=function(_0x4b4d09,_0x2da2ba){_0x4b4d09=_0x4b4d09-0x0;var _0x4769dd=_0x423a[_0x4b4d09];return _0x4769dd;};'use strict';var UserNotificationEvents=require(_0xa423('0x0'));var events=[_0xa423('0x1'),'remove',_0xa423('0x2')];function createListener(_0x5ca797,_0x31d6ca){return function(_0x5d31c2){_0x31d6ca[_0xa423('0x3')](_0x5ca797,_0x5d31c2);};}function removeListener(_0x426f4c,_0x5f9c88){return function(){UserNotificationEvents[_0xa423('0x4')](_0x426f4c,_0x5f9c88);};}exports[_0xa423('0x5')]=function(_0x1211d3){for(var _0x696f0f=0x0,_0x577268=events[_0xa423('0x6')];_0x696f0f<_0x577268;_0x696f0f++){var _0x2b0497=events[_0x696f0f];var _0x301a69=createListener('userNotification:'+_0x2b0497,_0x1211d3);UserNotificationEvents['on'](_0x2b0497,_0x301a69);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 6de6837..9d70f87 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x536c66,_0x570b6b){var _0x221d57=function(_0x34af51){while(--_0x34af51){_0x536c66['push'](_0x536c66['shift']());}};_0x221d57(++_0x570b6b);}(_0x9c44,0x178));var _0x49c4=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0x9c44[_0x273c39];return _0x46d6b5;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x23e9af,_0x29c52c){var _0x2c4f8b=function(_0x1beca1){while(--_0x1beca1){_0x23e9af['push'](_0x23e9af['shift']());}};_0x2c4f8b(++_0x29c52c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xa9e0[_0x37c22c];return _0x119d79;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index d31a2b5..e53d4c4 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 _0x6ca2=['exports','INTEGER'];(function(_0x165789,_0x51d9e1){var _0x29fac7=function(_0x45cd7f){while(--_0x45cd7f){_0x165789['push'](_0x165789['shift']());}};_0x29fac7(++_0x51d9e1);}(_0x6ca2,0xc8));var _0x26ca=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6ca2[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require('sequelize');module[_0x26ca('0x0')]={'penalty':{'type':Sequelize[_0x26ca('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x09f4=['INTEGER','exports'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x09f4,0x1a5));var _0x409f=function(_0x581ff8,_0x1f7b92){_0x581ff8=_0x581ff8-0x0;var _0x4e30b7=_0x09f4[_0x581ff8];return _0x4e30b7;};'use strict';var Sequelize=require('sequelize');module[_0x409f('0x0')]={'penalty':{'type':Sequelize[_0x409f('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index cbf9dc0..6674717 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 _0xb328=['./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue','user_has_openchannel_queues','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb328,0x91));var _0x8b32=function(_0x4a4178,_0x546619){_0x4a4178=_0x4a4178-0x0;var _0x51eccd=_0xb328[_0x4a4178];return _0x51eccd;};'use strict';var _=require(_0x8b32('0x0'));var util=require(_0x8b32('0x1'));var logger=require(_0x8b32('0x2'))(_0x8b32('0x3'));var moment=require(_0x8b32('0x4'));var BPromise=require(_0x8b32('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8b32('0x6'));var rimraf=require(_0x8b32('0x7'));var config=require(_0x8b32('0x8'));var attributes=require(_0x8b32('0x9'));module[_0x8b32('0xa')]=function(_0x21e31a,_0x594ba1){return _0x21e31a[_0x8b32('0xb')](_0x8b32('0xc'),attributes,{'tableName':_0x8b32('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeaf4=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./userOpenchannelQueue.attributes','UserOpenchannelQueue','user_has_openchannel_queues','lodash','util'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0xeaf4,0x9a));var _0x4eaf=function(_0x3728ca,_0x4ab0b9){_0x3728ca=_0x3728ca-0x0;var _0x32eade=_0xeaf4[_0x3728ca];return _0x32eade;};'use strict';var _=require(_0x4eaf('0x0'));var util=require(_0x4eaf('0x1'));var logger=require(_0x4eaf('0x2'))(_0x4eaf('0x3'));var moment=require(_0x4eaf('0x4'));var BPromise=require(_0x4eaf('0x5'));var rp=require(_0x4eaf('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4eaf('0x7'));var config=require(_0x4eaf('0x8'));var attributes=require(_0x4eaf('0x9'));module['exports']=function(_0x14bb6a,_0x2eda71){return _0x14bb6a['define'](_0x4eaf('0xa'),attributes,{'tableName':_0x4eaf('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js index 78290b2..616fe79 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 _0x5561=['message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x5561,0x9d));var _0x1556=function(_0x3e34a3,_0x1072ea){_0x3e34a3=_0x3e34a3-0x0;var _0x301f7e=_0x5561[_0x3e34a3];return _0x301f7e;};'use strict';var _=require(_0x1556('0x0'));var util=require(_0x1556('0x1'));var moment=require('moment');var BPromise=require(_0x1556('0x2'));var rs=require(_0x1556('0x3'));var fs=require('fs');var Redis=require(_0x1556('0x4'));var db=require(_0x1556('0x5'))['db'];var utils=require(_0x1556('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x1556('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x1556('0x8')][_0x1556('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xf375a8,_0x34cc19,_0x1ebd53){return new BPromise(function(_0xfa385c,_0x6b6fff){return client[_0x1556('0xa')](_0xf375a8,_0x1ebd53)[_0x1556('0xb')](function(_0x34c89c){logger[_0x1556('0xc')](_0x1556('0xd'),_0x34cc19,_0x1556('0xe'));logger[_0x1556('0xf')]('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x34cc19,_0x1556('0xe'),JSON[_0x1556('0x10')](_0x34c89c));if(_0x34c89c[_0x1556('0x11')]){if(_0x34c89c[_0x1556('0x11')][_0x1556('0x12')]===0x1f4){logger[_0x1556('0x11')](_0x1556('0xd'),_0x34cc19,_0x34c89c[_0x1556('0x11')][_0x1556('0x13')]);return _0x6b6fff(_0x34c89c['error'][_0x1556('0x13')]);}logger['error']('UserOpenchannelQueue,\x20%s,\x20%s',_0x34cc19,_0x34c89c[_0x1556('0x11')][_0x1556('0x13')]);return _0xfa385c(_0x34c89c[_0x1556('0x11')][_0x1556('0x13')]);}else{logger[_0x1556('0xc')](_0x1556('0xd'),_0x34cc19,_0x1556('0xe'));_0xfa385c(_0x34c89c[_0x1556('0x14')]['message']);}})[_0x1556('0x15')](function(_0x5764d4){logger[_0x1556('0x11')](_0x1556('0xd'),_0x34cc19,_0x5764d4);_0x6b6fff(_0x5764d4);});});} \ No newline at end of file +var _0x58c8=['request','then','UserOpenchannelQueue,\x20%s,\x20%s','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','info','request\x20sent','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x5e247f,_0x1007f8){var _0x16bf0a=function(_0x493496){while(--_0x493496){_0x5e247f['push'](_0x5e247f['shift']());}};_0x16bf0a(++_0x1007f8);}(_0x58c8,0x1d9));var _0x858c=function(_0x496f22,_0x3ab002){_0x496f22=_0x496f22-0x0;var _0x58d4f8=_0x58c8[_0x496f22];return _0x58d4f8;};'use strict';var _=require('lodash');var util=require(_0x858c('0x0'));var moment=require('moment');var BPromise=require(_0x858c('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x858c('0x2'));var db=require(_0x858c('0x3'))['db'];var utils=require(_0x858c('0x4'));var logger=require(_0x858c('0x5'))(_0x858c('0x6'));var config=require(_0x858c('0x7'));var jayson=require(_0x858c('0x8'));var client=jayson[_0x858c('0x9')][_0x858c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x44ea8e,_0x505ba8,_0x54e592){return new BPromise(function(_0xa04765,_0x3d6b4c){return client[_0x858c('0xb')](_0x44ea8e,_0x54e592)[_0x858c('0xc')](function(_0x1a35ac){logger['info'](_0x858c('0xd'),_0x505ba8,'request\x20sent');logger[_0x858c('0xe')](_0x858c('0xf'),_0x505ba8,'request\x20sent',JSON[_0x858c('0x10')](_0x1a35ac));if(_0x1a35ac[_0x858c('0x11')]){if(_0x1a35ac[_0x858c('0x11')]['code']===0x1f4){logger['error'](_0x858c('0xd'),_0x505ba8,_0x1a35ac[_0x858c('0x11')]['message']);return _0x3d6b4c(_0x1a35ac[_0x858c('0x11')][_0x858c('0x12')]);}logger[_0x858c('0x11')](_0x858c('0xd'),_0x505ba8,_0x1a35ac[_0x858c('0x11')][_0x858c('0x12')]);return _0xa04765(_0x1a35ac[_0x858c('0x11')][_0x858c('0x12')]);}else{logger[_0x858c('0x13')](_0x858c('0xd'),_0x505ba8,_0x858c('0x14'));_0xa04765(_0x1a35ac['result'][_0x858c('0x12')]);}})[_0x858c('0x15')](function(_0x2ac60a){logger[_0x858c('0x11')](_0x858c('0xd'),_0x505ba8,_0x2ac60a);_0x3d6b4c(_0x2ac60a);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 40fc27e..d500869 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 _0xa9b7=['show','/:id/sections','/:id/resources','getResources','post','create','/:id/clone','clone','addSections','update','delete','destroy','removeSections','removeResources','exports','multer','util','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','get','isAuthenticated','index','describe','/:id'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xa9b7,0x147));var _0x7a9b=function(_0x2e8bd8,_0x181160){_0x2e8bd8=_0x2e8bd8-0x0;var _0x43fb04=_0xa9b7[_0x2e8bd8];return _0x43fb04;};'use strict';var multer=require(_0x7a9b('0x0'));var util=require(_0x7a9b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x7a9b('0x2'));var interaction=require(_0x7a9b('0x3'));var config=require(_0x7a9b('0x4'));var controller=require(_0x7a9b('0x5'));router[_0x7a9b('0x6')]('/',auth[_0x7a9b('0x7')](),controller[_0x7a9b('0x8')]);router['get']('/describe',auth[_0x7a9b('0x7')](),controller[_0x7a9b('0x9')]);router[_0x7a9b('0x6')](_0x7a9b('0xa'),auth[_0x7a9b('0x7')](),controller[_0x7a9b('0xb')]);router['get'](_0x7a9b('0xc'),auth[_0x7a9b('0x7')](),controller['getSections']);router['get'](_0x7a9b('0xd'),auth[_0x7a9b('0x7')](),controller[_0x7a9b('0xe')]);router[_0x7a9b('0xf')]('/',auth[_0x7a9b('0x7')](),controller[_0x7a9b('0x10')]);router['post'](_0x7a9b('0x11'),auth[_0x7a9b('0x7')](),controller[_0x7a9b('0x12')]);router[_0x7a9b('0xf')](_0x7a9b('0xc'),auth[_0x7a9b('0x7')](),controller[_0x7a9b('0x13')]);router[_0x7a9b('0xf')](_0x7a9b('0xd'),auth[_0x7a9b('0x7')](),controller['addResources']);router['put'](_0x7a9b('0xa'),auth[_0x7a9b('0x7')](),controller[_0x7a9b('0x14')]);router[_0x7a9b('0x15')](_0x7a9b('0xa'),auth[_0x7a9b('0x7')](),controller[_0x7a9b('0x16')]);router[_0x7a9b('0x15')](_0x7a9b('0xc'),auth[_0x7a9b('0x7')](),controller[_0x7a9b('0x17')]);router['delete'](_0x7a9b('0xd'),auth[_0x7a9b('0x7')](),controller[_0x7a9b('0x18')]);module[_0x7a9b('0x19')]=router; \ No newline at end of file +var _0x580f=['/:id/resources','getResources','post','create','clone','addSections','put','destroy','delete','removeResources','exports','multer','util','path','express','Router','fs-extra','../../config/environment','./userProfile.controller','isAuthenticated','index','get','describe','/:id','/:id/sections','getSections'];(function(_0x997fc1,_0x5c50a9){var _0x3dbf14=function(_0x392a0d){while(--_0x392a0d){_0x997fc1['push'](_0x997fc1['shift']());}};_0x3dbf14(++_0x5c50a9);}(_0x580f,0x129));var _0xf580=function(_0x53892d,_0x5217a5){_0x53892d=_0x53892d-0x0;var _0x239f82=_0x580f[_0x53892d];return _0x239f82;};'use strict';var multer=require(_0xf580('0x0'));var util=require(_0xf580('0x1'));var path=require(_0xf580('0x2'));var timeout=require('connect-timeout');var express=require(_0xf580('0x3'));var router=express[_0xf580('0x4')]();var fs_extra=require(_0xf580('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf580('0x6'));var controller=require(_0xf580('0x7'));router['get']('/',auth[_0xf580('0x8')](),controller[_0xf580('0x9')]);router[_0xf580('0xa')]('/describe',auth[_0xf580('0x8')](),controller[_0xf580('0xb')]);router[_0xf580('0xa')](_0xf580('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xf580('0xa')](_0xf580('0xd'),auth[_0xf580('0x8')](),controller[_0xf580('0xe')]);router[_0xf580('0xa')](_0xf580('0xf'),auth[_0xf580('0x8')](),controller[_0xf580('0x10')]);router[_0xf580('0x11')]('/',auth[_0xf580('0x8')](),controller[_0xf580('0x12')]);router[_0xf580('0x11')]('/:id/clone',auth[_0xf580('0x8')](),controller[_0xf580('0x13')]);router[_0xf580('0x11')]('/:id/sections',auth[_0xf580('0x8')](),controller[_0xf580('0x14')]);router['post']('/:id/resources',auth[_0xf580('0x8')](),controller['addResources']);router[_0xf580('0x15')]('/:id',auth[_0xf580('0x8')](),controller['update']);router['delete']('/:id',auth[_0xf580('0x8')](),controller[_0xf580('0x16')]);router['delete'](_0xf580('0xd'),auth['isAuthenticated'](),controller['removeSections']);router[_0xf580('0x17')]('/:id/resources',auth['isAuthenticated'](),controller[_0xf580('0x18')]);module[_0xf580('0x19')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 321c64a..71491c6 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 _0x61ae=['join','getDataValue','BOOLEAN','sequelize','STRING','name','setDataValue','crudPermissions'];(function(_0x17f268,_0xfc2d5a){var _0x160510=function(_0x3c6f31){while(--_0x3c6f31){_0x17f268['push'](_0x17f268['shift']());}};_0x160510(++_0xfc2d5a);}(_0x61ae,0x14b));var _0xe61a=function(_0x38b1fe,_0x53aedb){_0x38b1fe=_0x38b1fe-0x0;var _0x1b3f86=_0x61ae[_0x38b1fe];return _0x1b3f86;};'use strict';var Sequelize=require(_0xe61a('0x0'));module['exports']={'name':{'type':Sequelize[_0xe61a('0x1')],'allowNull':![],'unique':_0xe61a('0x2')},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x4560cb){this[_0xe61a('0x3')](_0xe61a('0x4'),_0x4560cb?_0x4560cb[_0xe61a('0x5')](''):[]);},'get':function(){return this[_0xe61a('0x6')](_0xe61a('0x4'))?this[_0xe61a('0x6')]('crudPermissions')['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0xe61a('0x7')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xe61a('0x7')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0xe61a('0x7')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0xe61a('0x7')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xe61a('0x7')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0xe61a('0x7')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xe61a('0x7')],'defaultValue':!![]}}; \ No newline at end of file +var _0x7a5b=['split','BOOLEAN','sequelize','name','STRING','crudPermissions','join','getDataValue'];(function(_0x3d8ca8,_0x1a9764){var _0x517e45=function(_0x641ad9){while(--_0x641ad9){_0x3d8ca8['push'](_0x3d8ca8['shift']());}};_0x517e45(++_0x1a9764);}(_0x7a5b,0x182));var _0xb7a5=function(_0x842063,_0x418163){_0x842063=_0x842063-0x0;var _0x3e5d72=_0x7a5b[_0x842063];return _0x3e5d72;};'use strict';var Sequelize=require(_0xb7a5('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xb7a5('0x1')},'crudPermissions':{'type':Sequelize[_0xb7a5('0x2')],'set':function(_0x329323){this['setDataValue'](_0xb7a5('0x3'),_0x329323?_0x329323[_0xb7a5('0x4')](''):[]);},'get':function(){return this['getDataValue'](_0xb7a5('0x3'))?this[_0xb7a5('0x5')]('crudPermissions')[_0xb7a5('0x6')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xb7a5('0x7')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xb7a5('0x7')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0xb7a5('0x7')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xb7a5('0x7')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 6073649..efc5737 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 _0xbbf2=['catch','show','rawAttributes','find','create','clone','params','length','get','crudPermissions','body','sequelize','transaction','UserProfileSection','each','autoAssociation','UserProfileResource','omit','createdAt','updatedAt','sectionId','userProfileId','Resources','update','destroy','describe','push','removeSections','getSections','enabled','includes','isEmpty','subsections','concat','findOne','Dashboard','forEach','resourceId','addResources','removeResources','getResources','section','Missing\x20section\x20parameter','nolimit','No\x20User\x20Profile\x20found\x20for\x20id\x20','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','then','sendStatus','error','stack','name','index','UserProfile','type','key','model','map','query','keys','intersection','fields','attributes','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows'];(function(_0x145e8e,_0x13fe3a){var _0x44658e=function(_0x35a43d){while(--_0x35a43d){_0x145e8e['push'](_0x145e8e['shift']());}};_0x44658e(++_0x13fe3a);}(_0xbbf2,0x1e9));var _0x2bbf=function(_0x176d14,_0x3984ea){_0x176d14=_0x176d14-0x0;var _0x89522c=_0xbbf2[_0x176d14];return _0x89522c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2bbf('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x2bbf('0x1'));var moment=require(_0x2bbf('0x2'));var BPromise=require(_0x2bbf('0x3'));var Mustache=require(_0x2bbf('0x4'));var util=require(_0x2bbf('0x5'));var path=require(_0x2bbf('0x6'));var sox=require(_0x2bbf('0x7'));var csv=require(_0x2bbf('0x8'));var ejs=require(_0x2bbf('0x9'));var fs=require('fs');var fs_extra=require(_0x2bbf('0xa'));var _=require(_0x2bbf('0xb'));var squel=require(_0x2bbf('0xc'));var crypto=require('crypto');var jsforce=require(_0x2bbf('0xd'));var deskjs=require(_0x2bbf('0xe'));var toCsv=require(_0x2bbf('0x8'));var querystring=require(_0x2bbf('0xf'));var Papa=require(_0x2bbf('0x10'));var Redis=require(_0x2bbf('0x11'));var authService=require(_0x2bbf('0x12'));var qs=require(_0x2bbf('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2bbf('0x14'));var utils=require('../../config/utils');var config=require(_0x2bbf('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x2bbf('0x16'))['db'];config[_0x2bbf('0x17')]=_[_0x2bbf('0x18')](config[_0x2bbf('0x17')],{'host':_0x2bbf('0x19'),'port':0x18eb});var socket=require(_0x2bbf('0x1a'))(new Redis(config[_0x2bbf('0x17')]));require('./userProfile.socket')[_0x2bbf('0x1b')](socket);function respondWithStatusCode(_0x37397b,_0xf544f2){_0xf544f2=_0xf544f2||0xcc;return function(_0x42a3f5){if(_0x42a3f5){return _0x37397b['sendStatus'](_0xf544f2);}return _0x37397b[_0x2bbf('0x1c')](_0xf544f2)[_0x2bbf('0x1d')]();};}function respondWithResult(_0x23219b,_0x2bb890){_0x2bb890=_0x2bb890||0xc8;return function(_0x409c6e){if(_0x409c6e){return _0x23219b[_0x2bbf('0x1c')](_0x2bb890)[_0x2bbf('0x1e')](_0x409c6e);}};}function respondWithFilteredResult(_0x3931ed,_0x4178c5){return function(_0x43670c){if(_0x43670c){var _0x419a7e=typeof _0x4178c5[_0x2bbf('0x1f')]===_0x2bbf('0x20')&&typeof _0x4178c5[_0x2bbf('0x21')]===_0x2bbf('0x20');var _0x439806=_0x43670c[_0x2bbf('0x22')];var _0xa3cad9=_0x419a7e?0x0:_0x4178c5['offset'];var _0x47bb7b=_0x419a7e?_0x43670c[_0x2bbf('0x22')]:_0x4178c5[_0x2bbf('0x1f')]+_0x4178c5[_0x2bbf('0x21')];var _0x5adb25;if(_0x47bb7b>=_0x439806){_0x47bb7b=_0x439806;_0x5adb25=0xc8;}else{_0x5adb25=0xce;}_0x3931ed[_0x2bbf('0x1c')](_0x5adb25);return _0x3931ed['set'](_0x2bbf('0x23'),_0xa3cad9+'-'+_0x47bb7b+'/'+_0x439806)['json'](_0x43670c);}return null;};}function patchUpdates(_0x1e5799){return function(_0x3c0f30){try{jsonpatch[_0x2bbf('0x24')](_0x3c0f30,_0x1e5799,!![]);}catch(_0x54f352){return BPromise[_0x2bbf('0x25')](_0x54f352);}return _0x3c0f30['save']();};}function saveUpdates(_0x454fed,_0x4a6bba){return function(_0x9f9ed2){if(_0x9f9ed2){return _0x9f9ed2['update'](_0x454fed)[_0x2bbf('0x26')](function(_0x501d7){return _0x501d7;});}return null;};}function removeEntity(_0x54db46,_0x3a0dae){return function(_0x33eddb){if(_0x33eddb){return _0x33eddb['destroy']()['then'](function(){_0x54db46[_0x2bbf('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x453885,_0x4e95fa){return function(_0x415a79){if(!_0x415a79){_0x453885[_0x2bbf('0x27')](0x194);}return _0x415a79;};}function handleError(_0x1a4bc0,_0x49119c){_0x49119c=_0x49119c||0x1f4;return function(_0x3f7f8b){logger[_0x2bbf('0x28')](_0x3f7f8b[_0x2bbf('0x29')]);if(_0x3f7f8b[_0x2bbf('0x2a')]){delete _0x3f7f8b[_0x2bbf('0x2a')];}_0x1a4bc0['status'](_0x49119c)['send'](_0x3f7f8b);};}exports[_0x2bbf('0x2b')]=function(_0x3c2322,_0x556bc4){var _0x1e263d={},_0x21052f={},_0x548402={'count':0x0,'rows':[]};var _0x2e7ad0=_['map'](db[_0x2bbf('0x2c')]['rawAttributes'],function(_0x3043c7){return{'name':_0x3043c7['fieldName'],'type':_0x3043c7[_0x2bbf('0x2d')][_0x2bbf('0x2e')]};});_0x21052f[_0x2bbf('0x2f')]=_[_0x2bbf('0x30')](_0x2e7ad0,'name');_0x21052f[_0x2bbf('0x31')]=_[_0x2bbf('0x32')](_0x3c2322[_0x2bbf('0x31')]);_0x21052f['filters']=_[_0x2bbf('0x33')](_0x21052f[_0x2bbf('0x2f')],_0x21052f[_0x2bbf('0x31')]);_0x1e263d['attributes']=_[_0x2bbf('0x33')](_0x21052f[_0x2bbf('0x2f')],qs[_0x2bbf('0x34')](_0x3c2322[_0x2bbf('0x31')][_0x2bbf('0x34')]));_0x1e263d[_0x2bbf('0x35')]=_0x1e263d['attributes']['length']?_0x1e263d[_0x2bbf('0x35')]:_0x21052f[_0x2bbf('0x2f')];if(!_0x3c2322[_0x2bbf('0x31')]['hasOwnProperty']('nolimit')){_0x1e263d[_0x2bbf('0x21')]=qs[_0x2bbf('0x21')](_0x3c2322['query']['limit']);_0x1e263d['offset']=qs[_0x2bbf('0x1f')](_0x3c2322['query'][_0x2bbf('0x1f')]);}_0x1e263d['order']=qs[_0x2bbf('0x36')](_0x3c2322[_0x2bbf('0x31')][_0x2bbf('0x36')]);_0x1e263d[_0x2bbf('0x37')]=qs[_0x2bbf('0x38')](_[_0x2bbf('0x39')](_0x3c2322[_0x2bbf('0x31')],_0x21052f[_0x2bbf('0x38')]),_0x2e7ad0);if(_0x3c2322[_0x2bbf('0x31')][_0x2bbf('0x3a')]){_0x1e263d['where']=_[_0x2bbf('0x3b')](_0x1e263d[_0x2bbf('0x37')],{'$or':_[_0x2bbf('0x30')](_0x2e7ad0,function(_0x18a0a3){if(_0x18a0a3['type']!==_0x2bbf('0x3c')){var _0x13ad25={};_0x13ad25[_0x18a0a3[_0x2bbf('0x2a')]]={'$like':'%'+_0x3c2322[_0x2bbf('0x31')]['filter']+'%'};return _0x13ad25;}})});}_0x1e263d=_[_0x2bbf('0x3b')]({},_0x1e263d,_0x3c2322[_0x2bbf('0x3d')]);var _0x226a93={'where':_0x1e263d[_0x2bbf('0x37')]};return db['UserProfile']['count'](_0x226a93)[_0x2bbf('0x26')](function(_0x2284dc){_0x548402[_0x2bbf('0x22')]=_0x2284dc;if(_0x3c2322[_0x2bbf('0x31')][_0x2bbf('0x3e')]){_0x1e263d[_0x2bbf('0x3f')]=[{'all':!![]}];}return db['UserProfile'][_0x2bbf('0x40')](_0x1e263d);})['then'](function(_0x54b286){_0x548402[_0x2bbf('0x41')]=_0x54b286;return _0x548402;})[_0x2bbf('0x26')](respondWithFilteredResult(_0x556bc4,_0x1e263d))[_0x2bbf('0x42')](handleError(_0x556bc4,null));};exports[_0x2bbf('0x43')]=function(_0x42cbec,_0x1ccfc8){var _0x3fe787={'raw':![],'where':{'id':_0x42cbec['params']['id']}},_0x563608={};_0x563608[_0x2bbf('0x2f')]=_[_0x2bbf('0x32')](db[_0x2bbf('0x2c')][_0x2bbf('0x44')]);_0x563608[_0x2bbf('0x31')]=_['keys'](_0x42cbec['query']);_0x563608[_0x2bbf('0x38')]=_[_0x2bbf('0x33')](_0x563608['model'],_0x563608[_0x2bbf('0x31')]);_0x3fe787[_0x2bbf('0x35')]=_[_0x2bbf('0x33')](_0x563608[_0x2bbf('0x2f')],qs[_0x2bbf('0x34')](_0x42cbec['query'][_0x2bbf('0x34')]));_0x3fe787[_0x2bbf('0x35')]=_0x3fe787[_0x2bbf('0x35')]['length']?_0x3fe787[_0x2bbf('0x35')]:_0x563608[_0x2bbf('0x2f')];if(_0x42cbec['query'][_0x2bbf('0x3e')]){_0x3fe787[_0x2bbf('0x3f')]=[{'all':!![]}];}_0x3fe787=_[_0x2bbf('0x3b')]({},_0x3fe787,_0x42cbec[_0x2bbf('0x3d')]);return db[_0x2bbf('0x2c')][_0x2bbf('0x45')](_0x3fe787)[_0x2bbf('0x26')](handleEntityNotFound(_0x1ccfc8,null))[_0x2bbf('0x26')](respondWithResult(_0x1ccfc8,null))['catch'](handleError(_0x1ccfc8,null));};exports[_0x2bbf('0x46')]=function(_0x5cf275,_0x43a701){return db[_0x2bbf('0x2c')][_0x2bbf('0x46')](_0x5cf275['body'],{})[_0x2bbf('0x26')](respondWithResult(_0x43a701,0xc9))[_0x2bbf('0x42')](handleError(_0x43a701,null));};exports[_0x2bbf('0x47')]=function(_0x571597,_0x1fcecb){var _0x1a8f61={'where':{'id':_0x571597[_0x2bbf('0x48')]['id']}},_0x3991bc={};_0x3991bc['model']=_[_0x2bbf('0x32')](db[_0x2bbf('0x2c')][_0x2bbf('0x44')]);_0x1a8f61[_0x2bbf('0x35')]=_['intersection'](_0x3991bc[_0x2bbf('0x2f')],qs[_0x2bbf('0x34')](_0x571597[_0x2bbf('0x31')]['fields']));_0x1a8f61[_0x2bbf('0x35')]=_0x1a8f61[_0x2bbf('0x35')][_0x2bbf('0x49')]?_0x1a8f61[_0x2bbf('0x35')]:_0x3991bc[_0x2bbf('0x2f')];if(_0x571597[_0x2bbf('0x31')][_0x2bbf('0x3e')]){_0x1a8f61[_0x2bbf('0x3f')]=[{'all':!![]}];}_0x1a8f61=_['merge']({},_0x1a8f61,_0x571597[_0x2bbf('0x3d')]);return db['UserProfile']['find'](_0x1a8f61)[_0x2bbf('0x26')](handleEntityNotFound(_0x1fcecb,null))[_0x2bbf('0x26')](function(_0x3eb1e1){if(_0x3eb1e1){var _0x389372=_0x3eb1e1[_0x2bbf('0x4a')]({'plain':!![]});_0x389372=qs['omit'](_0x389372,['id','createdAt','updatedAt',_0x2bbf('0x4b')]);_0x571597[_0x2bbf('0x4c')]=_['omit'](_0x571597[_0x2bbf('0x4c')],['id','createdAt','updatedAt']);return db[_0x2bbf('0x4d')][_0x2bbf('0x4e')](function(_0x1e93bd){return db['UserProfile'][_0x2bbf('0x46')](_[_0x2bbf('0x3b')](_0x389372,_0x571597[_0x2bbf('0x4c')]),{'include':_0x571597[_0x2bbf('0x31')][_0x2bbf('0x3e')]?[{'all':!![]}]:undefined,'transaction':_0x1e93bd})[_0x2bbf('0x26')](function(_0x1f1414){var _0x285966=_0x1f1414[_0x2bbf('0x4a')]({'plain':!![]});return db[_0x2bbf('0x4f')][_0x2bbf('0x40')]({'where':{'userProfileId':_0x571597['params']['id']},'raw':!![]})[_0x2bbf('0x26')](function(_0x259fb7){if(_0x259fb7){return BPromise[_0x2bbf('0x50')](_0x259fb7,function(_0x2b012b){return new BPromise(function(_0x256d61,_0x2cefcd){if(_0x2b012b[_0x2bbf('0x51')]===null||_0x2b012b[_0x2bbf('0x51')]===0x1)_0x256d61(null);return db[_0x2bbf('0x52')][_0x2bbf('0x40')]({'where':{'sectionId':_0x2b012b['id']},'raw':!![]})[_0x2bbf('0x26')](function(_0x31c20f){var _0x4a7ea5=_[_0x2bbf('0x30')](_0x31c20f,function(_0x533ca3){return qs[_0x2bbf('0x53')](_0x533ca3,['id',_0x2bbf('0x54'),_0x2bbf('0x55'),_0x2bbf('0x56')]);});_0x256d61(_0x4a7ea5);})[_0x2bbf('0x42')](function(_0x3cf486){_0x2cefcd(_0x3cf486);});})['then'](function(_0x5de931){var _0x18dfe6=qs[_0x2bbf('0x53')](_0x2b012b,['id',_0x2bbf('0x54'),_0x2bbf('0x55')]);_0x18dfe6[_0x2bbf('0x57')]=_0x285966['id'];if(_0x5de931)_0x18dfe6[_0x2bbf('0x58')]=_0x5de931;return _0x18dfe6;})[_0x2bbf('0x26')](function(_0x15898b){return db['UserProfileSection'][_0x2bbf('0x46')](_0x15898b,{'include':[{'model':db['UserProfileResource'],'as':_0x2bbf('0x58')}],'raw':!![],'transaction':_0x1e93bd});});})['then'](function(){return _0x285966;});}});});});}})[_0x2bbf('0x26')](respondWithResult(_0x1fcecb,0xc9))[_0x2bbf('0x42')](handleError(_0x1fcecb,null));};exports[_0x2bbf('0x59')]=function(_0x78dd18,_0xf4cc10){if(_0x78dd18[_0x2bbf('0x4c')]['id']){delete _0x78dd18[_0x2bbf('0x4c')]['id'];}return db[_0x2bbf('0x2c')][_0x2bbf('0x45')]({'where':{'id':_0x78dd18[_0x2bbf('0x48')]['id']}})[_0x2bbf('0x26')](handleEntityNotFound(_0xf4cc10,null))[_0x2bbf('0x26')](saveUpdates(_0x78dd18[_0x2bbf('0x4c')],null))[_0x2bbf('0x26')](respondWithResult(_0xf4cc10,null))[_0x2bbf('0x42')](handleError(_0xf4cc10,null));};exports[_0x2bbf('0x5a')]=function(_0x111c31,_0x2c2502){return db[_0x2bbf('0x2c')][_0x2bbf('0x45')]({'where':{'id':_0x111c31[_0x2bbf('0x48')]['id']}})[_0x2bbf('0x26')](handleEntityNotFound(_0x2c2502,null))[_0x2bbf('0x26')](removeEntity(_0x2c2502,null))[_0x2bbf('0x42')](handleError(_0x2c2502,null));};exports['describe']=function(_0x306fe0,_0x86f675){return db[_0x2bbf('0x2c')][_0x2bbf('0x5b')]()[_0x2bbf('0x26')](respondWithResult(_0x86f675,null))[_0x2bbf('0x42')](handleError(_0x86f675,null));};exports['addSections']=function(_0x487c41,_0x57dc32){var _0x2fc7bc=_0x487c41['body'];return db[_0x2bbf('0x2c')][_0x2bbf('0x45')]({'where':{'id':_0x487c41[_0x2bbf('0x48')]['id']}})[_0x2bbf('0x26')](handleEntityNotFound(_0x57dc32,null))[_0x2bbf('0x26')](function(_0x1ea07e){if(_0x1ea07e){return db[_0x2bbf('0x4d')][_0x2bbf('0x4e')](function(_0x1d46fe){return db[_0x2bbf('0x4f')][_0x2bbf('0x5a')]({'where':{'userProfileId':_0x487c41['params']['id'],'sectionId':_[_0x2bbf('0x30')](_0x2fc7bc,function(_0x84656){return _0x84656[_0x2bbf('0x56')];})},'transaction':_0x1d46fe})[_0x2bbf('0x26')](function(){var _0xb6c26=_[_0x2bbf('0x30')](_0x2fc7bc,function(_0x3af60c){_0x3af60c['userProfileId']=_0x487c41[_0x2bbf('0x48')]['id'];return _0x3af60c;});var _0x2c2da9=[];return BPromise['each'](_0xb6c26,function(_0x192f45){return db[_0x2bbf('0x4f')][_0x2bbf('0x46')](_0x192f45,{'include':[{'model':db[_0x2bbf('0x52')],'as':_0x2bbf('0x58')}],'raw':!![],'transaction':_0x1d46fe})['then'](function(_0x2b61f8){_0x2c2da9[_0x2bbf('0x5c')](_0x2b61f8[_0x2bbf('0x4a')]({'plain':!![]}));});})[_0x2bbf('0x26')](function(){return _0x2c2da9;});});});}})[_0x2bbf('0x26')](function(_0x7befdc){return _0x7befdc;})[_0x2bbf('0x26')](respondWithResult(_0x57dc32,null))[_0x2bbf('0x42')](handleError(_0x57dc32,null));};exports[_0x2bbf('0x5d')]=function(_0x3afc5a,_0x195ad7){var _0x1ca966;return db[_0x2bbf('0x2c')][_0x2bbf('0x45')]({'where':{'id':_0x3afc5a['params']['id']},'attributes':['id',_0x2bbf('0x2a')]})[_0x2bbf('0x26')](handleEntityNotFound(_0x195ad7,null))[_0x2bbf('0x26')](function(_0x14ba1d){if(_0x14ba1d){_0x1ca966=_0x14ba1d;return db[_0x2bbf('0x4f')][_0x2bbf('0x5a')]({'where':{'userProfileId':_0x3afc5a['params']['id'],'sectionId':_0x3afc5a[_0x2bbf('0x31')]['ids']}});}})['then'](function(){return _0x1ca966;})[_0x2bbf('0x26')](respondWithStatusCode(_0x195ad7,null))['catch'](handleError(_0x195ad7,null));};exports[_0x2bbf('0x5e')]=function(_0x27ad66,_0x540347){var _0x28fd66=[];var _0x76ca24=[];return db[_0x2bbf('0x4f')]['findAll']({'where':{'userProfileId':_0x27ad66[_0x2bbf('0x48')]['id']},'raw':!![]})[_0x2bbf('0x26')](function(_0x5f4136){_0x28fd66=_[_0x2bbf('0x3a')](_0x5f4136,function(_0x1238c5){return _0x1238c5[_0x2bbf('0x5f')]===0x1||_[_0x2bbf('0x60')]([0x3eb,0x709],_0x1238c5['sectionId']);});if(!_[_0x2bbf('0x61')](_0x28fd66)){return _[_0x2bbf('0x30')](_0x28fd66,function(_0x1fa85b){return _0x1fa85b[_0x2bbf('0x56')];});}else{return;}})[_0x2bbf('0x26')](function(_0x27bf3b){if(_0x27bf3b)_0x76ca24=_0x27bf3b;if(_[_0x2bbf('0x60')](_0x76ca24,0x64)){var _0x110922=_[_0x2bbf('0x45')](_0x28fd66,{'sectionId':0x64});return hasDefaultDashboard(_0x110922)[_0x2bbf('0x26')](function(_0x8f5612){return _['map'](_0x28fd66,function(_0x5bfa9a){if(_0x5bfa9a[_0x2bbf('0x56')]===0x64){_0x5bfa9a[_0x2bbf('0x62')]=_0x8f5612;}return _0x5bfa9a;});});}else{return;}})[_0x2bbf('0x26')](function(_0x4ab692){if(_0x4ab692)_0x28fd66=_0x4ab692;if(_[_0x2bbf('0x60')](_0x76ca24,0x3eb)){var _0x1ab949=_[_0x2bbf('0x45')](_0x28fd66,{'sectionId':0x3eb});return getCustomDashboards(_0x1ab949)[_0x2bbf('0x26')](function(_0x2d6e2f){return _[_0x2bbf('0x30')](_0x28fd66,function(_0x4429cd){if(_0x1ab949[_0x2bbf('0x5f')]){if(_0x4429cd[_0x2bbf('0x56')]===0x3eb){_0x4429cd[_0x2bbf('0x62')]=_0x2d6e2f;}}else{if(_0x4429cd[_0x2bbf('0x56')]===0x64){if(!_0x4429cd[_0x2bbf('0x62')]){_0x4429cd[_0x2bbf('0x62')]=[];}_0x4429cd[_0x2bbf('0x62')]=_0x4429cd[_0x2bbf('0x62')][_0x2bbf('0x63')](_0x2d6e2f);}}return _0x4429cd;});});}else{return;}})[_0x2bbf('0x26')](function(_0xbbe5b4){if(_0xbbe5b4)_0x28fd66=_0xbbe5b4;if(_[_0x2bbf('0x60')](_0x76ca24,0x709)){var _0x26fec3=_[_0x2bbf('0x45')](_0x28fd66,{'sectionId':0x709});return getPlugins(_0x26fec3)[_0x2bbf('0x26')](function(_0x54cfb0){if(_0x26fec3[_0x2bbf('0x5f')]){return _[_0x2bbf('0x30')](_0x28fd66,function(_0x24f853){if(_0x24f853[_0x2bbf('0x56')]===0x709){_0x24f853[_0x2bbf('0x62')]=_0x54cfb0;}return _0x24f853;});}else{var _0x366184={'sectionId':0x76c,'enabled':0x1,'subsections':_0x54cfb0};var _0x5ca57d=_[_0x2bbf('0x30')](_0x28fd66);_0x5ca57d[_0x2bbf('0x5c')](_0x366184);return _0x5ca57d;}});}else{return;}})[_0x2bbf('0x26')](function(_0x57b808){if(_0x57b808)_0x28fd66=_0x57b808;return _[_0x2bbf('0x3a')](_0x28fd66,[_0x2bbf('0x5f'),0x1]);})['then'](respondWithResult(_0x540347,null))['catch'](handleError(_0x540347,null));};function hasDefaultDashboard(_0x2dbca8){var _0x1891a0=[0x65];return new BPromise(function(_0x515ff7,_0x43e146){try{if(_0x2dbca8[_0x2bbf('0x51')]){_0x515ff7(_0x1891a0);}else{return db[_0x2bbf('0x52')][_0x2bbf('0x64')]({'where':{'sectionId':_0x2dbca8['id']},'raw':!![]})[_0x2bbf('0x26')](function(_0x3e095b){_0x3e095b?_0x515ff7(_0x1891a0):_0x515ff7();});}}catch(_0x4f31e5){_0x43e146(_0x4f31e5);}});}function getCustomDashboards(_0x56bca3){var _0x41a007=[];return new BPromise(function(_0xf01c59,_0x3ec5bd){try{if(_0x56bca3[_0x2bbf('0x51')]){return db[_0x2bbf('0x65')][_0x2bbf('0x40')]({'raw':!![]})['then'](function(_0x3ed8c9){_0x3ed8c9[_0x2bbf('0x66')](function(_0x41aca1){_0x41a007[_0x2bbf('0x5c')](_0x41aca1['id']+0x1869f);});_0xf01c59(_0x41a007);});}else{return db[_0x2bbf('0x52')][_0x2bbf('0x40')]({'where':{'sectionId':_0x56bca3['id']},'raw':!![]})[_0x2bbf('0x26')](function(_0x4b420d){_0x4b420d['forEach'](function(_0x36637f){_0x41a007[_0x2bbf('0x5c')](_0x36637f[_0x2bbf('0x67')]+0x1869f);});_0xf01c59(_0x41a007);});}}catch(_0x20a674){_0x3ec5bd(_0x20a674);}});}function getPlugins(_0x49a8fd){var _0x837394=[];return new BPromise(function(_0x5dc162,_0x40a90e){try{if(_0x49a8fd[_0x2bbf('0x51')]){return db['Plugin'][_0x2bbf('0x40')]({'raw':!![]})[_0x2bbf('0x26')](function(_0x5c3b1f){_0x5c3b1f['forEach'](function(_0x559923){_0x837394['push'](_0x559923['id']+0x15b38);});_0x5dc162(_0x837394);});}else{return db[_0x2bbf('0x52')][_0x2bbf('0x40')]({'where':{'sectionId':_0x49a8fd['id']},'raw':!![]})['then'](function(_0xcd80c9){_0xcd80c9['forEach'](function(_0x37483a){_0x837394[_0x2bbf('0x5c')](_0x37483a[_0x2bbf('0x67')]+0x15b38);});_0x5dc162(_0x837394);});}}catch(_0x4db31b){_0x40a90e(_0x4db31b);}});}exports[_0x2bbf('0x68')]=function(_0x586b5a,_0x342a25){return db['UserProfile'][_0x2bbf('0x45')]({'where':{'id':_0x586b5a[_0x2bbf('0x48')]['id']}})[_0x2bbf('0x26')](handleEntityNotFound(_0x342a25,null))['then'](function(_0x2d2cd1){if(_0x2d2cd1){return db[_0x2bbf('0x4d')][_0x2bbf('0x4e')](function(_0x54f52a){return db['UserProfileSection'][_0x2bbf('0x40')]({'where':{'userProfileId':_0x586b5a[_0x2bbf('0x48')]['id']},'attributes':['id'],'raw':!![]})[_0x2bbf('0x26')](function(_0x5a95f9){if(_0x5a95f9){return db[_0x2bbf('0x4f')][_0x2bbf('0x5a')]({'where':{'userProfileId':_0x586b5a['params']['id'],'id':_[_0x2bbf('0x30')](_0x5a95f9,function(_0x4b3cf7){return _0x4b3cf7['id'];})},'transaction':_0x54f52a});}})['then'](function(_0x312cb4){var _0x40b3ce=_['map'](_0x586b5a[_0x2bbf('0x4c')],function(_0x1c9854){_0x1c9854[_0x2bbf('0x57')]=_0x586b5a[_0x2bbf('0x48')]['id'];return _0x1c9854;});return db[_0x2bbf('0x4f')]['bulkCreate'](_0x40b3ce,{'raw':!![],'transaction':_0x54f52a});})[_0x2bbf('0x26')](function(_0x56e507){var _0x1fc6df=_[_0x2bbf('0x3a')](_['map'](_0x56e507,function(_0x40c95b){return _0x40c95b[_0x2bbf('0x4a')]({'plain':!![]});}),{'includeAll':![]});if(_0x1fc6df){return db[_0x2bbf('0x4f')][_0x2bbf('0x40')]({'where':{'userProfileId':_0x586b5a[_0x2bbf('0x48')]['id'],'sectionId':_[_0x2bbf('0x30')](_0x1fc6df,function(_0x1cea9d){return _0x1cea9d[_0x2bbf('0x56')];})},'attributes':['id','sectionId'],'raw':!![]})[_0x2bbf('0x26')](function(_0x1b985d){var _0x578725=_['map'](_0x586b5a['body'],function(_0x2007a1){_0x2007a1[_0x2bbf('0x57')]=_0x586b5a[_0x2bbf('0x48')]['id'];return _0x2007a1;});return db[_0x2bbf('0x52')]['bulkCreate'](_0x578725,{'raw':!![],'transaction':_0x54f52a});});}})['catch'](handleError(_0x342a25,null));});}})['then'](function(_0x5568fa){var _0x14d2ed=_[_0x2bbf('0x30')](_0x5568fa,function(_0xcf648b){return _0xcf648b[_0x2bbf('0x4a')]({'plain':!![]});});})[_0x2bbf('0x26')](respondWithResult(_0x342a25,null))['catch'](handleError(_0x342a25,null));};exports[_0x2bbf('0x69')]=function(_0x1569dc,_0x446256,_0x4b2819){return db[_0x2bbf('0x2c')][_0x2bbf('0x45')]({'where':{'id':_0x1569dc[_0x2bbf('0x48')]['id']}})[_0x2bbf('0x26')](handleEntityNotFound(_0x446256,null))['then'](function(_0x58c73e){if(_0x58c73e){return _0x58c73e[_0x2bbf('0x69')](_0x1569dc['query']['ids']);}})[_0x2bbf('0x26')](respondWithStatusCode(_0x446256,null))[_0x2bbf('0x42')](handleError(_0x446256,null));};exports[_0x2bbf('0x6a')]=function(_0x68e88b,_0x19fe7c){var _0x5159b2={};if(!_0x68e88b['query'][_0x2bbf('0x6b')])throw new Error(_0x2bbf('0x6c'));if(!_0x68e88b['query']['hasOwnProperty'](_0x2bbf('0x6d'))){_0x5159b2['limit']=qs['limit'](_0x68e88b['query'][_0x2bbf('0x21')]);_0x5159b2['offset']=qs[_0x2bbf('0x1f')](_0x68e88b[_0x2bbf('0x31')][_0x2bbf('0x1f')]);}return db[_0x2bbf('0x2c')][_0x2bbf('0x45')]({'where':{'id':_0x68e88b[_0x2bbf('0x48')]['id']}})['then'](function(_0x468e9f){if(!_0x468e9f)throw new Error(_0x2bbf('0x6e')+_0x68e88b[_0x2bbf('0x48')]['id']);return db['UserProfile']['getResources'](_0x68e88b);})[_0x2bbf('0x26')](respondWithFilteredResult(_0x19fe7c,_0x5159b2))['catch'](handleError(_0x19fe7c,null));}; \ No newline at end of file +var _0xa9bd=['sequelize','transaction','UserProfileSection','each','autoAssociation','UserProfileResource','userProfileId','Resources','addSections','push','removeSections','ids','enabled','includes','sectionId','subsections','concat','findOne','Dashboard','forEach','resourceId','Plugin','addResources','bulkCreate','removeResources','getResources','section','Missing\x20section\x20parameter','nolimit','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','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','api','../../config/license/util','localhost','socket.io-emitter','redis','register','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','then','destroy','error','stack','name','send','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','pick','filter','merge','where','VIRTUAL','includeAll','include','UserProfile','findAll','rows','catch','show','params','options','find','create','body','clone','get','omit','createdAt','updatedAt'];(function(_0x132d9e,_0x4a0839){var _0x40b733=function(_0x30c113){while(--_0x30c113){_0x132d9e['push'](_0x132d9e['shift']());}};_0x40b733(++_0x4a0839);}(_0xa9bd,0x1d6));var _0xda9b=function(_0x3110c6,_0x49b355){_0x3110c6=_0x3110c6-0x0;var _0x442977=_0xa9bd[_0x3110c6];return _0x442977;};'use strict';var emlformat=require(_0xda9b('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xda9b('0x1'));var rp=require(_0xda9b('0x2'));var moment=require(_0xda9b('0x3'));var BPromise=require(_0xda9b('0x4'));var Mustache=require(_0xda9b('0x5'));var util=require(_0xda9b('0x6'));var path=require(_0xda9b('0x7'));var sox=require(_0xda9b('0x8'));var csv=require(_0xda9b('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xda9b('0xa'));var _=require(_0xda9b('0xb'));var squel=require(_0xda9b('0xc'));var crypto=require(_0xda9b('0xd'));var jsforce=require(_0xda9b('0xe'));var deskjs=require(_0xda9b('0xf'));var toCsv=require('to-csv');var querystring=require(_0xda9b('0x10'));var Papa=require(_0xda9b('0x11'));var Redis=require(_0xda9b('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xda9b('0x13'));var as=require(_0xda9b('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xda9b('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xda9b('0x16'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config['redis'],{'host':_0xda9b('0x17'),'port':0x18eb});var socket=require(_0xda9b('0x18'))(new Redis(config[_0xda9b('0x19')]));require('./userProfile.socket')[_0xda9b('0x1a')](socket);function respondWithStatusCode(_0x240db8,_0x3dd888){_0x3dd888=_0x3dd888||0xcc;return function(_0x13f5d8){if(_0x13f5d8){return _0x240db8['sendStatus'](_0x3dd888);}return _0x240db8[_0xda9b('0x1b')](_0x3dd888)[_0xda9b('0x1c')]();};}function respondWithResult(_0x22fb1f,_0x4030da){_0x4030da=_0x4030da||0xc8;return function(_0x3d1971){if(_0x3d1971){return _0x22fb1f[_0xda9b('0x1b')](_0x4030da)[_0xda9b('0x1d')](_0x3d1971);}};}function respondWithFilteredResult(_0x3aeddb,_0xf4a06a){return function(_0x54b5b2){if(_0x54b5b2){var _0x38b9d6=typeof _0xf4a06a[_0xda9b('0x1e')]===_0xda9b('0x1f')&&typeof _0xf4a06a[_0xda9b('0x20')]===_0xda9b('0x1f');var _0x49b52d=_0x54b5b2['count'];var _0x33e225=_0x38b9d6?0x0:_0xf4a06a[_0xda9b('0x1e')];var _0x5a4bcb=_0x38b9d6?_0x54b5b2[_0xda9b('0x21')]:_0xf4a06a[_0xda9b('0x1e')]+_0xf4a06a[_0xda9b('0x20')];var _0x5818f4;if(_0x5a4bcb>=_0x49b52d){_0x5a4bcb=_0x49b52d;_0x5818f4=0xc8;}else{_0x5818f4=0xce;}_0x3aeddb[_0xda9b('0x1b')](_0x5818f4);return _0x3aeddb[_0xda9b('0x22')](_0xda9b('0x23'),_0x33e225+'-'+_0x5a4bcb+'/'+_0x49b52d)['json'](_0x54b5b2);}return null;};}function patchUpdates(_0x3881fc){return function(_0xb48841){try{jsonpatch['apply'](_0xb48841,_0x3881fc,!![]);}catch(_0x5771cf){return BPromise['reject'](_0x5771cf);}return _0xb48841[_0xda9b('0x24')]();};}function saveUpdates(_0x3b3dd8,_0x1d27c2){return function(_0x41cfc3){if(_0x41cfc3){return _0x41cfc3[_0xda9b('0x25')](_0x3b3dd8)[_0xda9b('0x26')](function(_0x230e5c){return _0x230e5c;});}return null;};}function removeEntity(_0x52098b,_0x469017){return function(_0x422f91){if(_0x422f91){return _0x422f91[_0xda9b('0x27')]()[_0xda9b('0x26')](function(){_0x52098b[_0xda9b('0x1b')](0xcc)[_0xda9b('0x1c')]();});}};}function handleEntityNotFound(_0x1c860f,_0x296796){return function(_0x218d06){if(!_0x218d06){_0x1c860f['sendStatus'](0x194);}return _0x218d06;};}function handleError(_0x36613c,_0x4f1436){_0x4f1436=_0x4f1436||0x1f4;return function(_0xd89dbb){logger[_0xda9b('0x28')](_0xd89dbb[_0xda9b('0x29')]);if(_0xd89dbb[_0xda9b('0x2a')]){delete _0xd89dbb['name'];}_0x36613c[_0xda9b('0x1b')](_0x4f1436)[_0xda9b('0x2b')](_0xd89dbb);};}exports['index']=function(_0xc8391b,_0x36e4ef){var _0x2ccbc7={},_0x40deef={},_0x5d4b6b={'count':0x0,'rows':[]};var _0x3450d0=_['map'](db['UserProfile'][_0xda9b('0x2c')],function(_0x106be8){return{'name':_0x106be8[_0xda9b('0x2d')],'type':_0x106be8[_0xda9b('0x2e')][_0xda9b('0x2f')]};});_0x40deef[_0xda9b('0x30')]=_[_0xda9b('0x31')](_0x3450d0,_0xda9b('0x2a'));_0x40deef[_0xda9b('0x32')]=_[_0xda9b('0x33')](_0xc8391b['query']);_0x40deef[_0xda9b('0x34')]=_[_0xda9b('0x35')](_0x40deef[_0xda9b('0x30')],_0x40deef['query']);_0x2ccbc7[_0xda9b('0x36')]=_['intersection'](_0x40deef[_0xda9b('0x30')],qs[_0xda9b('0x37')](_0xc8391b[_0xda9b('0x32')][_0xda9b('0x37')]));_0x2ccbc7[_0xda9b('0x36')]=_0x2ccbc7[_0xda9b('0x36')][_0xda9b('0x38')]?_0x2ccbc7['attributes']:_0x40deef[_0xda9b('0x30')];if(!_0xc8391b[_0xda9b('0x32')][_0xda9b('0x39')]('nolimit')){_0x2ccbc7[_0xda9b('0x20')]=qs['limit'](_0xc8391b['query'][_0xda9b('0x20')]);_0x2ccbc7[_0xda9b('0x1e')]=qs[_0xda9b('0x1e')](_0xc8391b[_0xda9b('0x32')][_0xda9b('0x1e')]);}_0x2ccbc7['order']=qs['sort'](_0xc8391b[_0xda9b('0x32')]['sort']);_0x2ccbc7['where']=qs[_0xda9b('0x34')](_[_0xda9b('0x3a')](_0xc8391b[_0xda9b('0x32')],_0x40deef[_0xda9b('0x34')]),_0x3450d0);if(_0xc8391b[_0xda9b('0x32')][_0xda9b('0x3b')]){_0x2ccbc7['where']=_[_0xda9b('0x3c')](_0x2ccbc7[_0xda9b('0x3d')],{'$or':_['map'](_0x3450d0,function(_0x6e03c3){if(_0x6e03c3[_0xda9b('0x2e')]!==_0xda9b('0x3e')){var _0x2b8b2b={};_0x2b8b2b[_0x6e03c3[_0xda9b('0x2a')]]={'$like':'%'+_0xc8391b[_0xda9b('0x32')][_0xda9b('0x3b')]+'%'};return _0x2b8b2b;}})});}_0x2ccbc7=_[_0xda9b('0x3c')]({},_0x2ccbc7,_0xc8391b['options']);var _0x57f6b7={'where':_0x2ccbc7[_0xda9b('0x3d')]};return db['UserProfile']['count'](_0x57f6b7)[_0xda9b('0x26')](function(_0x1badf1){_0x5d4b6b['count']=_0x1badf1;if(_0xc8391b['query'][_0xda9b('0x3f')]){_0x2ccbc7[_0xda9b('0x40')]=[{'all':!![]}];}return db[_0xda9b('0x41')][_0xda9b('0x42')](_0x2ccbc7);})[_0xda9b('0x26')](function(_0x4bd7a8){_0x5d4b6b[_0xda9b('0x43')]=_0x4bd7a8;return _0x5d4b6b;})['then'](respondWithFilteredResult(_0x36e4ef,_0x2ccbc7))[_0xda9b('0x44')](handleError(_0x36e4ef,null));};exports[_0xda9b('0x45')]=function(_0x37cc5a,_0x3aeb72){var _0x2d60fd={'raw':![],'where':{'id':_0x37cc5a[_0xda9b('0x46')]['id']}},_0x437836={};_0x437836[_0xda9b('0x30')]=_['keys'](db[_0xda9b('0x41')][_0xda9b('0x2c')]);_0x437836[_0xda9b('0x32')]=_[_0xda9b('0x33')](_0x37cc5a['query']);_0x437836[_0xda9b('0x34')]=_[_0xda9b('0x35')](_0x437836[_0xda9b('0x30')],_0x437836[_0xda9b('0x32')]);_0x2d60fd[_0xda9b('0x36')]=_[_0xda9b('0x35')](_0x437836['model'],qs['fields'](_0x37cc5a[_0xda9b('0x32')][_0xda9b('0x37')]));_0x2d60fd[_0xda9b('0x36')]=_0x2d60fd['attributes'][_0xda9b('0x38')]?_0x2d60fd['attributes']:_0x437836[_0xda9b('0x30')];if(_0x37cc5a[_0xda9b('0x32')][_0xda9b('0x3f')]){_0x2d60fd[_0xda9b('0x40')]=[{'all':!![]}];}_0x2d60fd=_[_0xda9b('0x3c')]({},_0x2d60fd,_0x37cc5a[_0xda9b('0x47')]);return db[_0xda9b('0x41')][_0xda9b('0x48')](_0x2d60fd)[_0xda9b('0x26')](handleEntityNotFound(_0x3aeb72,null))[_0xda9b('0x26')](respondWithResult(_0x3aeb72,null))[_0xda9b('0x44')](handleError(_0x3aeb72,null));};exports[_0xda9b('0x49')]=function(_0xa0d0c3,_0x5d06ff){return db[_0xda9b('0x41')][_0xda9b('0x49')](_0xa0d0c3[_0xda9b('0x4a')],{})[_0xda9b('0x26')](respondWithResult(_0x5d06ff,0xc9))[_0xda9b('0x44')](handleError(_0x5d06ff,null));};exports[_0xda9b('0x4b')]=function(_0x4e3ab7,_0x3da320){var _0x2e76c0={'where':{'id':_0x4e3ab7[_0xda9b('0x46')]['id']}},_0x10f6d8={};_0x10f6d8[_0xda9b('0x30')]=_[_0xda9b('0x33')](db[_0xda9b('0x41')][_0xda9b('0x2c')]);_0x2e76c0['attributes']=_[_0xda9b('0x35')](_0x10f6d8['model'],qs['fields'](_0x4e3ab7[_0xda9b('0x32')][_0xda9b('0x37')]));_0x2e76c0['attributes']=_0x2e76c0[_0xda9b('0x36')][_0xda9b('0x38')]?_0x2e76c0['attributes']:_0x10f6d8[_0xda9b('0x30')];if(_0x4e3ab7['query'][_0xda9b('0x3f')]){_0x2e76c0[_0xda9b('0x40')]=[{'all':!![]}];}_0x2e76c0=_['merge']({},_0x2e76c0,_0x4e3ab7['options']);return db[_0xda9b('0x41')][_0xda9b('0x48')](_0x2e76c0)[_0xda9b('0x26')](handleEntityNotFound(_0x3da320,null))[_0xda9b('0x26')](function(_0x48867e){if(_0x48867e){var _0x4479c9=_0x48867e[_0xda9b('0x4c')]({'plain':!![]});_0x4479c9=qs[_0xda9b('0x4d')](_0x4479c9,['id',_0xda9b('0x4e'),_0xda9b('0x4f'),'crudPermissions']);_0x4e3ab7['body']=_['omit'](_0x4e3ab7[_0xda9b('0x4a')],['id',_0xda9b('0x4e'),'updatedAt']);return db[_0xda9b('0x50')][_0xda9b('0x51')](function(_0x5a4fb5){return db[_0xda9b('0x41')]['create'](_[_0xda9b('0x3c')](_0x4479c9,_0x4e3ab7['body']),{'include':_0x4e3ab7[_0xda9b('0x32')][_0xda9b('0x3f')]?[{'all':!![]}]:undefined,'transaction':_0x5a4fb5})[_0xda9b('0x26')](function(_0xe5a97c){var _0x47ec9d=_0xe5a97c['get']({'plain':!![]});return db[_0xda9b('0x52')]['findAll']({'where':{'userProfileId':_0x4e3ab7['params']['id']},'raw':!![]})[_0xda9b('0x26')](function(_0x144438){if(_0x144438){return BPromise[_0xda9b('0x53')](_0x144438,function(_0x53999b){return new BPromise(function(_0x20c391,_0x47eeaa){if(_0x53999b[_0xda9b('0x54')]===null||_0x53999b[_0xda9b('0x54')]===0x1)_0x20c391(null);return db[_0xda9b('0x55')][_0xda9b('0x42')]({'where':{'sectionId':_0x53999b['id']},'raw':!![]})[_0xda9b('0x26')](function(_0xe8f733){var _0x21b28b=_[_0xda9b('0x31')](_0xe8f733,function(_0x42c547){return qs[_0xda9b('0x4d')](_0x42c547,['id',_0xda9b('0x4e'),_0xda9b('0x4f'),'sectionId']);});_0x20c391(_0x21b28b);})[_0xda9b('0x44')](function(_0x481df0){_0x47eeaa(_0x481df0);});})[_0xda9b('0x26')](function(_0xe8ac8f){var _0x252c17=qs[_0xda9b('0x4d')](_0x53999b,['id',_0xda9b('0x4e'),_0xda9b('0x4f')]);_0x252c17[_0xda9b('0x56')]=_0x47ec9d['id'];if(_0xe8ac8f)_0x252c17[_0xda9b('0x57')]=_0xe8ac8f;return _0x252c17;})[_0xda9b('0x26')](function(_0x3d2bbd){return db[_0xda9b('0x52')][_0xda9b('0x49')](_0x3d2bbd,{'include':[{'model':db[_0xda9b('0x55')],'as':_0xda9b('0x57')}],'raw':!![],'transaction':_0x5a4fb5});});})[_0xda9b('0x26')](function(){return _0x47ec9d;});}});});});}})[_0xda9b('0x26')](respondWithResult(_0x3da320,0xc9))[_0xda9b('0x44')](handleError(_0x3da320,null));};exports['update']=function(_0x1ff0e8,_0xbb2691){if(_0x1ff0e8['body']['id']){delete _0x1ff0e8[_0xda9b('0x4a')]['id'];}return db[_0xda9b('0x41')][_0xda9b('0x48')]({'where':{'id':_0x1ff0e8['params']['id']}})['then'](handleEntityNotFound(_0xbb2691,null))['then'](saveUpdates(_0x1ff0e8['body'],null))[_0xda9b('0x26')](respondWithResult(_0xbb2691,null))[_0xda9b('0x44')](handleError(_0xbb2691,null));};exports[_0xda9b('0x27')]=function(_0x28bf8c,_0x3212e6){return db[_0xda9b('0x41')]['find']({'where':{'id':_0x28bf8c[_0xda9b('0x46')]['id']}})[_0xda9b('0x26')](handleEntityNotFound(_0x3212e6,null))[_0xda9b('0x26')](removeEntity(_0x3212e6,null))[_0xda9b('0x44')](handleError(_0x3212e6,null));};exports['describe']=function(_0x4cc1e6,_0x5c15a4){return db[_0xda9b('0x41')]['describe']()[_0xda9b('0x26')](respondWithResult(_0x5c15a4,null))[_0xda9b('0x44')](handleError(_0x5c15a4,null));};exports[_0xda9b('0x58')]=function(_0x10fd56,_0x35382e){var _0x5cc0a8=_0x10fd56[_0xda9b('0x4a')];return db['UserProfile'][_0xda9b('0x48')]({'where':{'id':_0x10fd56[_0xda9b('0x46')]['id']}})[_0xda9b('0x26')](handleEntityNotFound(_0x35382e,null))['then'](function(_0x1f78b3){if(_0x1f78b3){return db[_0xda9b('0x50')]['transaction'](function(_0x56baf8){return db['UserProfileSection'][_0xda9b('0x27')]({'where':{'userProfileId':_0x10fd56['params']['id'],'sectionId':_[_0xda9b('0x31')](_0x5cc0a8,function(_0x34af01){return _0x34af01['sectionId'];})},'transaction':_0x56baf8})['then'](function(){var _0x49ed92=_[_0xda9b('0x31')](_0x5cc0a8,function(_0x27690f){_0x27690f['userProfileId']=_0x10fd56['params']['id'];return _0x27690f;});var _0x275c92=[];return BPromise['each'](_0x49ed92,function(_0x43e83b){return db[_0xda9b('0x52')][_0xda9b('0x49')](_0x43e83b,{'include':[{'model':db[_0xda9b('0x55')],'as':'Resources'}],'raw':!![],'transaction':_0x56baf8})[_0xda9b('0x26')](function(_0x485210){_0x275c92[_0xda9b('0x59')](_0x485210['get']({'plain':!![]}));});})['then'](function(){return _0x275c92;});});});}})['then'](function(_0x637e7b){return _0x637e7b;})[_0xda9b('0x26')](respondWithResult(_0x35382e,null))[_0xda9b('0x44')](handleError(_0x35382e,null));};exports[_0xda9b('0x5a')]=function(_0x360342,_0x44aece){var _0x2452cc;return db[_0xda9b('0x41')]['find']({'where':{'id':_0x360342[_0xda9b('0x46')]['id']},'attributes':['id',_0xda9b('0x2a')]})[_0xda9b('0x26')](handleEntityNotFound(_0x44aece,null))[_0xda9b('0x26')](function(_0x3dc281){if(_0x3dc281){_0x2452cc=_0x3dc281;return db[_0xda9b('0x52')][_0xda9b('0x27')]({'where':{'userProfileId':_0x360342[_0xda9b('0x46')]['id'],'sectionId':_0x360342['query'][_0xda9b('0x5b')]}});}})[_0xda9b('0x26')](function(){return _0x2452cc;})[_0xda9b('0x26')](respondWithStatusCode(_0x44aece,null))[_0xda9b('0x44')](handleError(_0x44aece,null));};exports['getSections']=function(_0x4e778b,_0x3a6dbd){var _0x30ceae=[];var _0x1010eb=[];return db[_0xda9b('0x52')]['findAll']({'where':{'userProfileId':_0x4e778b['params']['id']},'raw':!![]})[_0xda9b('0x26')](function(_0x34937f){_0x30ceae=_[_0xda9b('0x3b')](_0x34937f,function(_0x1fb1f8){return _0x1fb1f8[_0xda9b('0x5c')]===0x1||_[_0xda9b('0x5d')]([0x3eb,0x709],_0x1fb1f8[_0xda9b('0x5e')]);});if(!_['isEmpty'](_0x30ceae)){return _[_0xda9b('0x31')](_0x30ceae,function(_0x25ac01){return _0x25ac01['sectionId'];});}else{return;}})['then'](function(_0x48685c){if(_0x48685c)_0x1010eb=_0x48685c;if(_[_0xda9b('0x5d')](_0x1010eb,0x64)){var _0x1ac399=_[_0xda9b('0x48')](_0x30ceae,{'sectionId':0x64});return hasDefaultDashboard(_0x1ac399)[_0xda9b('0x26')](function(_0x373e68){return _[_0xda9b('0x31')](_0x30ceae,function(_0xbc002f){if(_0xbc002f[_0xda9b('0x5e')]===0x64){_0xbc002f[_0xda9b('0x5f')]=_0x373e68;}return _0xbc002f;});});}else{return;}})[_0xda9b('0x26')](function(_0x4933c6){if(_0x4933c6)_0x30ceae=_0x4933c6;if(_[_0xda9b('0x5d')](_0x1010eb,0x3eb)){var _0x963ea1=_[_0xda9b('0x48')](_0x30ceae,{'sectionId':0x3eb});return getCustomDashboards(_0x963ea1)['then'](function(_0x53b5b7){return _[_0xda9b('0x31')](_0x30ceae,function(_0x324b56){if(_0x963ea1[_0xda9b('0x5c')]){if(_0x324b56['sectionId']===0x3eb){_0x324b56[_0xda9b('0x5f')]=_0x53b5b7;}}else{if(_0x324b56[_0xda9b('0x5e')]===0x64){if(!_0x324b56[_0xda9b('0x5f')]){_0x324b56['subsections']=[];}_0x324b56['subsections']=_0x324b56['subsections'][_0xda9b('0x60')](_0x53b5b7);}}return _0x324b56;});});}else{return;}})[_0xda9b('0x26')](function(_0x4d1137){if(_0x4d1137)_0x30ceae=_0x4d1137;if(_[_0xda9b('0x5d')](_0x1010eb,0x709)){var _0x2e4df9=_['find'](_0x30ceae,{'sectionId':0x709});return getPlugins(_0x2e4df9)[_0xda9b('0x26')](function(_0x1900b1){if(_0x2e4df9[_0xda9b('0x5c')]){return _[_0xda9b('0x31')](_0x30ceae,function(_0x181b35){if(_0x181b35[_0xda9b('0x5e')]===0x709){_0x181b35[_0xda9b('0x5f')]=_0x1900b1;}return _0x181b35;});}else{var _0x48ea7e={'sectionId':0x76c,'enabled':0x1,'subsections':_0x1900b1};var _0x4478a3=_['map'](_0x30ceae);_0x4478a3['push'](_0x48ea7e);return _0x4478a3;}});}else{return;}})[_0xda9b('0x26')](function(_0xa50e7){if(_0xa50e7)_0x30ceae=_0xa50e7;return _[_0xda9b('0x3b')](_0x30ceae,[_0xda9b('0x5c'),0x1]);})['then'](respondWithResult(_0x3a6dbd,null))[_0xda9b('0x44')](handleError(_0x3a6dbd,null));};function hasDefaultDashboard(_0x546bbd){var _0x286187=[0x65];return new BPromise(function(_0x1ab387,_0x5d58e5){try{if(_0x546bbd[_0xda9b('0x54')]){_0x1ab387(_0x286187);}else{return db[_0xda9b('0x55')][_0xda9b('0x61')]({'where':{'sectionId':_0x546bbd['id']},'raw':!![]})[_0xda9b('0x26')](function(_0x572b59){_0x572b59?_0x1ab387(_0x286187):_0x1ab387();});}}catch(_0x2dfcc1){_0x5d58e5(_0x2dfcc1);}});}function getCustomDashboards(_0x4cb888){var _0x2eae36=[];return new BPromise(function(_0x203274,_0x553506){try{if(_0x4cb888[_0xda9b('0x54')]){return db[_0xda9b('0x62')][_0xda9b('0x42')]({'raw':!![]})[_0xda9b('0x26')](function(_0x441843){_0x441843[_0xda9b('0x63')](function(_0x5b8564){_0x2eae36[_0xda9b('0x59')](_0x5b8564['id']+0x1869f);});_0x203274(_0x2eae36);});}else{return db[_0xda9b('0x55')]['findAll']({'where':{'sectionId':_0x4cb888['id']},'raw':!![]})[_0xda9b('0x26')](function(_0x5cf320){_0x5cf320['forEach'](function(_0x1f612f){_0x2eae36[_0xda9b('0x59')](_0x1f612f[_0xda9b('0x64')]+0x1869f);});_0x203274(_0x2eae36);});}}catch(_0x1a115f){_0x553506(_0x1a115f);}});}function getPlugins(_0x4db009){var _0x312987=[];return new BPromise(function(_0x1ab6f4,_0x1c570e){try{if(_0x4db009['autoAssociation']){return db[_0xda9b('0x65')]['findAll']({'raw':!![]})[_0xda9b('0x26')](function(_0x5154da){_0x5154da[_0xda9b('0x63')](function(_0xc6bef2){_0x312987[_0xda9b('0x59')](_0xc6bef2['id']+0x15b38);});_0x1ab6f4(_0x312987);});}else{return db[_0xda9b('0x55')][_0xda9b('0x42')]({'where':{'sectionId':_0x4db009['id']},'raw':!![]})['then'](function(_0xdda288){_0xdda288[_0xda9b('0x63')](function(_0x57cc28){_0x312987['push'](_0x57cc28['resourceId']+0x15b38);});_0x1ab6f4(_0x312987);});}}catch(_0x56f221){_0x1c570e(_0x56f221);}});}exports[_0xda9b('0x66')]=function(_0x388201,_0x7a0deb){return db[_0xda9b('0x41')]['find']({'where':{'id':_0x388201['params']['id']}})[_0xda9b('0x26')](handleEntityNotFound(_0x7a0deb,null))[_0xda9b('0x26')](function(_0x57dc71){if(_0x57dc71){return db[_0xda9b('0x50')]['transaction'](function(_0x477767){return db[_0xda9b('0x52')]['findAll']({'where':{'userProfileId':_0x388201['params']['id']},'attributes':['id'],'raw':!![]})[_0xda9b('0x26')](function(_0x22e19f){if(_0x22e19f){return db[_0xda9b('0x52')][_0xda9b('0x27')]({'where':{'userProfileId':_0x388201[_0xda9b('0x46')]['id'],'id':_[_0xda9b('0x31')](_0x22e19f,function(_0x4f355c){return _0x4f355c['id'];})},'transaction':_0x477767});}})[_0xda9b('0x26')](function(_0x19018b){var _0x549a45=_[_0xda9b('0x31')](_0x388201['body'],function(_0x9abb67){_0x9abb67[_0xda9b('0x56')]=_0x388201['params']['id'];return _0x9abb67;});return db['UserProfileSection'][_0xda9b('0x67')](_0x549a45,{'raw':!![],'transaction':_0x477767});})[_0xda9b('0x26')](function(_0x470d5d){var _0x420448=_[_0xda9b('0x3b')](_[_0xda9b('0x31')](_0x470d5d,function(_0x40ded4){return _0x40ded4['get']({'plain':!![]});}),{'includeAll':![]});if(_0x420448){return db['UserProfileSection'][_0xda9b('0x42')]({'where':{'userProfileId':_0x388201['params']['id'],'sectionId':_[_0xda9b('0x31')](_0x420448,function(_0x299f80){return _0x299f80[_0xda9b('0x5e')];})},'attributes':['id',_0xda9b('0x5e')],'raw':!![]})[_0xda9b('0x26')](function(_0x4370cd){var _0x314f7d=_['map'](_0x388201[_0xda9b('0x4a')],function(_0x27215d){_0x27215d[_0xda9b('0x56')]=_0x388201[_0xda9b('0x46')]['id'];return _0x27215d;});return db['UserProfileResource'][_0xda9b('0x67')](_0x314f7d,{'raw':!![],'transaction':_0x477767});});}})[_0xda9b('0x44')](handleError(_0x7a0deb,null));});}})['then'](function(_0x1d5ec0){var _0x596183=_['map'](_0x1d5ec0,function(_0x3bd2df){return _0x3bd2df[_0xda9b('0x4c')]({'plain':!![]});});})[_0xda9b('0x26')](respondWithResult(_0x7a0deb,null))[_0xda9b('0x44')](handleError(_0x7a0deb,null));};exports[_0xda9b('0x68')]=function(_0x300440,_0x594767,_0x41b01b){return db[_0xda9b('0x41')][_0xda9b('0x48')]({'where':{'id':_0x300440[_0xda9b('0x46')]['id']}})[_0xda9b('0x26')](handleEntityNotFound(_0x594767,null))[_0xda9b('0x26')](function(_0x32a7d4){if(_0x32a7d4){return _0x32a7d4[_0xda9b('0x68')](_0x300440[_0xda9b('0x32')][_0xda9b('0x5b')]);}})[_0xda9b('0x26')](respondWithStatusCode(_0x594767,null))[_0xda9b('0x44')](handleError(_0x594767,null));};exports[_0xda9b('0x69')]=function(_0x222b5f,_0x298843){var _0xf933c7={};if(!_0x222b5f['query'][_0xda9b('0x6a')])throw new Error(_0xda9b('0x6b'));if(!_0x222b5f[_0xda9b('0x32')][_0xda9b('0x39')](_0xda9b('0x6c'))){_0xf933c7[_0xda9b('0x20')]=qs[_0xda9b('0x20')](_0x222b5f[_0xda9b('0x32')][_0xda9b('0x20')]);_0xf933c7[_0xda9b('0x1e')]=qs[_0xda9b('0x1e')](_0x222b5f['query']['offset']);}return db[_0xda9b('0x41')][_0xda9b('0x48')]({'where':{'id':_0x222b5f[_0xda9b('0x46')]['id']}})[_0xda9b('0x26')](function(_0x204a89){if(!_0x204a89)throw new Error(_0xda9b('0x6d')+_0x222b5f[_0xda9b('0x46')]['id']);return db[_0xda9b('0x41')][_0xda9b('0x69')](_0x222b5f);})[_0xda9b('0x26')](respondWithFilteredResult(_0x298843,_0xf933c7))['catch'](handleError(_0x298843,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index a6dc792..ee2ed0a 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 _0x4888=['emit','hasOwnProperty','hook','../../mysqldb','UserProfile','setMaxListeners','save','update','remove'];(function(_0x58c7fa,_0x8cf29e){var _0x4f0f5b=function(_0x38ff58){while(--_0x38ff58){_0x58c7fa['push'](_0x58c7fa['shift']());}};_0x4f0f5b(++_0x8cf29e);}(_0x4888,0x198));var _0x8488=function(_0x231b09,_0x4342ab){_0x231b09=_0x231b09-0x0;var _0x407bb6=_0x4888[_0x231b09];return _0x407bb6;};'use strict';var EventEmitter=require('events');var UserProfile=require(_0x8488('0x0'))['db'][_0x8488('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x8488('0x2')](0x0);var events={'afterCreate':_0x8488('0x3'),'afterUpdate':_0x8488('0x4'),'afterDestroy':_0x8488('0x5')};function emitEvent(_0x19e51d){return function(_0x571e4b,_0x267093,_0xf45c3f){UserProfileEvents[_0x8488('0x6')](_0x19e51d+':'+_0x571e4b['id'],_0x571e4b);UserProfileEvents[_0x8488('0x6')](_0x19e51d,_0x571e4b);_0xf45c3f(null);};}for(var e in events){if(events[_0x8488('0x7')](e)){var event=events[e];UserProfile[_0x8488('0x8')](e,emitEvent(event));}}module['exports']=UserProfileEvents; \ No newline at end of file +var _0xcf71=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','UserProfile','setMaxListeners'];(function(_0x47123a,_0x5dd137){var _0x2546cb=function(_0x110f67){while(--_0x110f67){_0x47123a['push'](_0x47123a['shift']());}};_0x2546cb(++_0x5dd137);}(_0xcf71,0xba));var _0x1cf7=function(_0x8a2dae,_0x2a21a7){_0x8a2dae=_0x8a2dae-0x0;var _0x308f20=_0xcf71[_0x8a2dae];return _0x308f20;};'use strict';var EventEmitter=require(_0x1cf7('0x0'));var UserProfile=require(_0x1cf7('0x1'))['db'][_0x1cf7('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x1cf7('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x1cf7('0x4'),'afterDestroy':_0x1cf7('0x5')};function emitEvent(_0xcc31bf){return function(_0x21307d,_0x11e462,_0x14d074){UserProfileEvents[_0x1cf7('0x6')](_0xcc31bf+':'+_0x21307d['id'],_0x21307d);UserProfileEvents[_0x1cf7('0x6')](_0xcc31bf,_0x21307d);_0x14d074(null);};}for(var e in events){if(events[_0x1cf7('0x7')](e)){var event=events[e];UserProfile[_0x1cf7('0x8')](e,emitEvent(event));}}module[_0x1cf7('0x9')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 1df4eef..b302ced 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 _0xc7f8=['model','map','catch','UserProfileResource','AnalyticExtractedReport','squareprojects','childModel','odbc','SquareOdbc','squarerecordings','SquareRecording','parentSections','SquareProjects','projectName','contacts','CmContact','Lists','ListId','lists','companies','CmCompany','globalcustomfields','chatqueues','chatwebsites','ChatWebsite','faxqueues','FaxQueue','faxaccounts','FaxAccount','inboundroutes','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','Agents','name','membername','User','agent','Telephones','role','telephone','VoiceQueues','queue','VoiceQueue','type','inbound','QueueCampaigns','musiconholds','chanspies','VoiceChanSpy','voiceprefixes','ivrcampaigns','Campaign','MailQueue','mailaccounts','MailAccount','MailSubstatus','openchannelqueues','openchannelaccounts','OpenchannelAccount','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','voicequeues','queuecampaigns','users','agents','telephones','user','zendeskaccounts','ZendeskAccount','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','cannedanswers','intervals','Interval','Pause','scheduler','sounds','Sound','tags','Tag','templates','Template','triggers','Trigger','trunks','Trunk','variables','Variable','plugins','Plugin','extractedreports','reportId','metrics','AnalyticMetric','charAt','toUpperCase','slice','QueryTypes','ui.','InteractionId','ui.createdAt','from','user_has_','_interactions','where','ui.UserId\x20=\x20?','query','toString','define','user_profiles','section','Invalid\x20section\x20\x27','isEmpty','length','push','UserProfileSection','find','params','all','union','ignore','autoAssociation','rawAttributes','keys','intersection','attributes','fields','hasOwnProperty','limit','offset','order','sort','pick','key','VIRTUAL','foreignKey','forEach','merge','options','includeAll','include','reportType','DefaultReports','count','rows','ids','customSorting','Tags','color','tag','ThroughTags','openTabs','true','chat','dataValues','fax','mail','openchannel','whatsapp','lodash','./userProfile.attributes','squel','exports','models','filter','field','value','findAll','then','associatedResources'];(function(_0x2a45d0,_0x4a89f1){var _0x5c4e2f=function(_0x3af60d){while(--_0x3af60d){_0x2a45d0['push'](_0x2a45d0['shift']());}};_0x5c4e2f(++_0x4a89f1);}(_0xc7f8,0xb2));var _0x8c7f=function(_0x378963,_0x362640){_0x378963=_0x378963-0x0;var _0x247e5e=_0xc7f8[_0x378963];return _0x247e5e;};'use strict';var _=require(_0x8c7f('0x0'));var attributes=require(_0x8c7f('0x1'));var squel=require(_0x8c7f('0x2'));module[_0x8c7f('0x3')]=function(_0x3ccde4){var _0x1065c2=_0x3ccde4[_0x8c7f('0x4')];function _0x3e3ec2(_0x42e8bb,_0x58cf62){return new Promise(function(_0x27cf2c,_0x202449){if(!_0x58cf62)return _0x27cf2c(null);var _0xc6d6f2=_0x58cf62['filter']?{[_0x58cf62[_0x8c7f('0x5')][_0x8c7f('0x6')]]:_0x58cf62[_0x8c7f('0x5')][_0x8c7f('0x7')]}:undefined;return _0x1065c2[_0x42e8bb][_0x8c7f('0x8')]({'where':_0xc6d6f2,'raw':!![]})[_0x8c7f('0x9')](function(_0xee7b8){_0x58cf62[_0x8c7f('0xa')]=_['map'](_0xee7b8,'id');_0x27cf2c(_0x58cf62);})['catch'](function(_0x4433b9){_0x202449(_0x4433b9);});});}function _0x40facc(_0x501d4e,_0x23f86){return new Promise(function(_0x412610,_0x5a8b1a){var _0x3a27ed=_0x501d4e[_0x8c7f('0x5')]?{[_0x501d4e['filter'][_0x8c7f('0x6')]]:_0x501d4e[_0x8c7f('0x5')][_0x8c7f('0x7')]}:undefined;return _0x1065c2[_0x501d4e[_0x8c7f('0xb')]][_0x8c7f('0x8')]({'where':_0x3a27ed,'raw':!![]})[_0x8c7f('0x9')](function(_0x386fbf){_0x23f86[_0x8c7f('0xa')]=_[_0x8c7f('0xc')](_0x386fbf,function(_0x57d2de){return _0x57d2de['name'];});_0x412610(_0x23f86);})[_0x8c7f('0xd')](function(_0x3431a6){_0x5a8b1a(_0x3431a6);});});}function _0x14494a(_0x4454c6,_0x262955,_0x4a3092){if(!_0x262955)return Promise['resolve'](null);return new Promise(function(_0x35f096,_0x22c0ba){return _0x1065c2[_0x8c7f('0xe')][_0x8c7f('0x8')]({'where':{'sectionId':_0x262955['id']},'raw':!![]})[_0x8c7f('0x9')](function(_0x47b590){if(_0x4454c6[_0x8c7f('0x6')]&&_0x4454c6[_0x8c7f('0x6')]!=='id'){_0x262955['associatedResources']=_['map'](_0x47b590,function(_0x4b55a9){return _0x4b55a9[_0x4454c6[_0x8c7f('0x6')]];});}else{if(_0x4a3092===_0x8c7f('0xf')){_0x262955[_0x8c7f('0xa')]=_[_0x8c7f('0xc')](_0x47b590,function(_0x43143e){return{'id':_0x43143e['resourceId'],'type':_0x43143e['type']};});}else{_0x262955['associatedResources']=_[_0x8c7f('0xc')](_0x47b590,function(_0x3f8b94){return _0x3f8b94['resourceId'];});}}_0x35f096(_0x262955);})[_0x8c7f('0xd')](function(_0x4d1f95){_0x22c0ba(_0x4d1f95);});});}function _0x52f95f(_0x1b81ca,_0x358b2c){var _0xb2598={'parentSections':[]};switch(_0x1b81ca['toLowerCase']()){case _0x8c7f('0x10'):_0xb2598[_0x8c7f('0x11')]='SquareProject';break;case _0x8c7f('0x12'):_0xb2598[_0x8c7f('0x11')]=_0x8c7f('0x13');break;case _0x8c7f('0x14'):_0xb2598[_0x8c7f('0x11')]=_0x8c7f('0x15');_0xb2598[_0x8c7f('0x16')]=[{'name':_0x8c7f('0x17'),'field':'name','foreignKey':_0x8c7f('0x18')}];break;case'projects':_0xb2598[_0x8c7f('0x11')]='JscriptyProject';break;case _0x8c7f('0x19'):_0xb2598[_0x8c7f('0x11')]=_0x8c7f('0x1a');_0xb2598[_0x8c7f('0x16')]=[{'name':_0x8c7f('0x1b'),'field':'id','foreignKey':_0x8c7f('0x1c')}];break;case _0x8c7f('0x1d'):_0xb2598[_0x8c7f('0x11')]='CmList';break;case _0x8c7f('0x1e'):_0xb2598[_0x8c7f('0x11')]=_0x8c7f('0x1f');break;case _0x8c7f('0x20'):_0xb2598[_0x8c7f('0x11')]='CmCustomField';break;case _0x8c7f('0x21'):_0xb2598[_0x8c7f('0x11')]='ChatQueue';break;case _0x8c7f('0x22'):_0xb2598[_0x8c7f('0x11')]=_0x8c7f('0x23');break;case _0x8c7f('0x24'):_0xb2598[_0x8c7f('0x11')]=_0x8c7f('0x25');break;case _0x8c7f('0x26'):_0xb2598[_0x8c7f('0x11')]=_0x8c7f('0x27');break;case _0x8c7f('0x28'):case _0x8c7f('0x29'):case _0x8c7f('0x2a'):_0xb2598['childModel']=_0x8c7f('0x2b');break;case _0x8c7f('0x2c'):_0xb2598[_0x8c7f('0x11')]=_0x8c7f('0x2d');break;case _0x8c7f('0x2e'):_0xb2598[_0x8c7f('0x11')]=_0x8c7f('0x2f');break;case _0x8c7f('0x30'):_0xb2598[_0x8c7f('0x11')]='VoiceRecording';_0xb2598[_0x8c7f('0x16')]=[{'name':_0x8c7f('0x31'),'field':_0x8c7f('0x32'),'foreignKey':_0x8c7f('0x33'),'model':_0x8c7f('0x34'),'filter':{'field':'role','value':[_0x8c7f('0x35')]}},{'name':_0x8c7f('0x36'),'field':'name','foreignKey':_0x8c7f('0x33'),'model':_0x8c7f('0x34'),'filter':{'field':_0x8c7f('0x37'),'value':[_0x8c7f('0x38')]}},{'name':_0x8c7f('0x39'),'field':'name','foreignKey':_0x8c7f('0x3a'),'model':_0x8c7f('0x3b'),'filter':{'field':_0x8c7f('0x3c'),'value':[_0x8c7f('0x3d')]}},{'name':_0x8c7f('0x3e'),'field':_0x8c7f('0x32'),'foreignKey':_0x8c7f('0x3a'),'model':_0x8c7f('0x3b'),'filter':{'field':_0x8c7f('0x3c'),'value':['outbound']}}];break;case _0x8c7f('0x3f'):_0xb2598['childModel']='VoiceMusicOnHold';break;case _0x8c7f('0x40'):_0xb2598[_0x8c7f('0x11')]=_0x8c7f('0x41');break;case _0x8c7f('0x42'):_0xb2598[_0x8c7f('0x11')]='VoicePrefix';break;case _0x8c7f('0x43'):_0xb2598[_0x8c7f('0x11')]=_0x8c7f('0x44');break;case'mailqueues':_0xb2598[_0x8c7f('0x11')]=_0x8c7f('0x45');break;case _0x8c7f('0x46'):_0xb2598[_0x8c7f('0x11')]=_0x8c7f('0x47');break;case'mailsubstatuses':_0xb2598[_0x8c7f('0x11')]=_0x8c7f('0x48');break;case _0x8c7f('0x49'):_0xb2598['childModel']='OpenchannelQueue';break;case _0x8c7f('0x4a'):_0xb2598[_0x8c7f('0x11')]=_0x8c7f('0x4b');break;case'smsqueues':_0xb2598[_0x8c7f('0x11')]=_0x8c7f('0x4c');break;case _0x8c7f('0x4d'):_0xb2598[_0x8c7f('0x11')]=_0x8c7f('0x4e');break;case _0x8c7f('0x4f'):_0xb2598[_0x8c7f('0x11')]=_0x8c7f('0x50');break;case _0x8c7f('0x51'):_0xb2598[_0x8c7f('0x11')]=_0x8c7f('0x52');break;case _0x8c7f('0x53'):_0xb2598[_0x8c7f('0x11')]=_0x8c7f('0x54');break;case _0x8c7f('0x55'):case _0x8c7f('0x56'):_0xb2598[_0x8c7f('0x11')]=_0x8c7f('0x3b');if(_0x358b2c){_0xb2598[_0x8c7f('0x16')]=[{'name':_0x8c7f('0x39')},{'name':_0x8c7f('0x3e')}];}break;case _0x8c7f('0x57'):case _0x8c7f('0x58'):case _0x8c7f('0x59'):_0xb2598[_0x8c7f('0x11')]='User';if(_0x358b2c){_0xb2598[_0x8c7f('0x16')]=[{'name':'Users','filter':{'field':'role','value':['admin',_0x8c7f('0x5a')]},'ignore':!![]},{'name':_0x8c7f('0x31')},{'name':_0x8c7f('0x36')}];}break;case _0x8c7f('0x5b'):_0xb2598['childModel']=_0x8c7f('0x5c');break;case'salesforceaccounts':_0xb2598['childModel']=_0x8c7f('0x5d');break;case _0x8c7f('0x5e'):_0xb2598[_0x8c7f('0x11')]=_0x8c7f('0x5f');break;case _0x8c7f('0x60'):_0xb2598[_0x8c7f('0x11')]=_0x8c7f('0x61');break;case _0x8c7f('0x62'):_0xb2598['childModel']=_0x8c7f('0x63');break;case _0x8c7f('0x64'):_0xb2598['childModel']='ZohoAccount';break;case'vtigeraccounts':_0xb2598[_0x8c7f('0x11')]=_0x8c7f('0x34');break;case _0x8c7f('0x65'):_0xb2598[_0x8c7f('0x11')]='CannedAnswer';break;case'dispositions':_0xb2598[_0x8c7f('0x11')]='Disposition';break;case'customdashboards':_0xb2598['childModel']='Dashboard';break;case _0x8c7f('0x66'):_0xb2598['childModel']=_0x8c7f('0x67');break;case'pauses':_0xb2598[_0x8c7f('0x11')]=_0x8c7f('0x68');break;case _0x8c7f('0x69'):_0xb2598['childModel']='Schedule';break;case _0x8c7f('0x6a'):_0xb2598['childModel']=_0x8c7f('0x6b');break;case _0x8c7f('0x6c'):_0xb2598[_0x8c7f('0x11')]=_0x8c7f('0x6d');break;case _0x8c7f('0x6e'):_0xb2598['childModel']=_0x8c7f('0x6f');break;case _0x8c7f('0x70'):_0xb2598[_0x8c7f('0x11')]=_0x8c7f('0x71');break;case _0x8c7f('0x72'):_0xb2598[_0x8c7f('0x11')]=_0x8c7f('0x73');break;case _0x8c7f('0x74'):_0xb2598[_0x8c7f('0x11')]=_0x8c7f('0x75');break;case _0x8c7f('0x76'):_0xb2598[_0x8c7f('0x11')]=_0x8c7f('0x77');break;case _0x8c7f('0x78'):_0xb2598[_0x8c7f('0x11')]=_0x8c7f('0xf');_0xb2598[_0x8c7f('0x16')]=[{'name':'Reports','field':'id','foreignKey':_0x8c7f('0x79')}];break;case _0x8c7f('0x7a'):_0xb2598['childModel']=_0x8c7f('0x7b');break;}return _0xb2598;}function _0x332178(_0x2bd1f1,_0x4d2063){var _0x57b8e1=_0x2bd1f1[_0x8c7f('0x7c')](0x0)[_0x8c7f('0x7d')]()+_0x2bd1f1[_0x8c7f('0x7e')](0x1);var _0x9ceb2c={'type':_0x1065c2['Sequelize'][_0x8c7f('0x7f')]['SELECT'],'raw':!![]};return new Promise(function(_0x4ceb01,_0x57d44e){var _0x2c0880=squel['select']()[_0x8c7f('0x6')](_0x8c7f('0x80')+_0x57b8e1+_0x8c7f('0x81'),'id')[_0x8c7f('0x6')](_0x8c7f('0x82'))[_0x8c7f('0x83')](_0x8c7f('0x84')+_0x2bd1f1+_0x8c7f('0x85'),'ui')[_0x8c7f('0x86')](_0x8c7f('0x87'),_0x4d2063['id']);return _0x1065c2['sequelize'][_0x8c7f('0x88')](_0x2c0880[_0x8c7f('0x89')](),_0x9ceb2c)['then'](function(_0x33addc){_0x4d2063[_0x57b8e1+'OpenTabs']=_0x33addc;_0x4ceb01(_0x33addc);})[_0x8c7f('0xd')](function(_0x558f32){_0x57d44e(_0x558f32);});});}return _0x3ccde4[_0x8c7f('0x8a')]('UserProfile',attributes,{'tableName':_0x8c7f('0x8b'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0xee1731){var _0x1b7e48=require('../../components/parsers/qs');var _0x15e362={'raw':_0xee1731[_0x8c7f('0x88')]['raw'],'where':{}};var _0x4d5421={};var _0x7ab73b={'count':0x0,'rows':[]};var _0x5dcffb=_0xee1731['query'][_0x8c7f('0x8c')];var _0x5a7977=_0xee1731['query']['mergeResources']||![];var _0xe5dcda=_0x52f95f(_0x5dcffb,_0x5a7977);if(!_0xe5dcda[_0x8c7f('0x11')])throw new Error(_0x8c7f('0x8d')+_0x5dcffb+'\x27');var _0x54feb8=[{'name':_0x5dcffb}];if(!_[_0x8c7f('0x8e')](_0xe5dcda[_0x8c7f('0x16')]))_0x54feb8=_0xe5dcda[_0x8c7f('0x16')];var _0xe79e34=[];for(var _0x2c7a37=0x0;_0x2c7a37<_0x54feb8[_0x8c7f('0x8f')];_0x2c7a37++){_0xe79e34[_0x8c7f('0x90')](_0x1065c2[_0x8c7f('0x91')][_0x8c7f('0x92')]({'where':{'userProfileId':_0xee1731[_0x8c7f('0x93')]['id'],'name':_0x54feb8[_0x2c7a37][_0x8c7f('0x32')]},'raw':!![]}));}return Promise[_0x8c7f('0x94')](_0xe79e34)[_0x8c7f('0x9')](function(_0x5edd88){var _0x57d0aa=_[_0x8c7f('0x5')](_0x5edd88,function(_0x48352d){return _0x48352d?_0x48352d:undefined;});var _0x1d528f=_[_0x8c7f('0x5')](_0x54feb8,['ignore',!![]]);var _0x391858=_[_0x8c7f('0x8e')](_0x57d0aa)&&_[_0x8c7f('0x8e')](_0x1d528f)?null:_[_0x8c7f('0x95')](_0x1d528f,_0x57d0aa);if(!_0x391858)return null;var _0x128d43=[];for(var _0x3641d1=0x0;_0x3641d1<_0x391858[_0x8c7f('0x8f')];_0x3641d1++){var _0x3931fb=_['find'](_0x54feb8,function(_0x361a6c){return _0x391858[_0x3641d1]?_0x361a6c[_0x8c7f('0x32')]===_0x391858[_0x3641d1][_0x8c7f('0x32')]:null;});if(_0x3931fb){if(_0x391858[_0x3641d1][_0x8c7f('0x96')]){_0x128d43[_0x8c7f('0x90')](_0x3e3ec2(_0xe5dcda[_0x8c7f('0x11')],_0x391858[_0x3641d1]));}else{if(!_0x391858[_0x3641d1][_0x8c7f('0x97')]){_0x128d43[_0x8c7f('0x90')](_0x14494a(_0x3931fb,_0x391858[_0x3641d1],_0xe5dcda['childModel']));}else{if(_0x3931fb['model']){_0x128d43['push'](_0x40facc(_0x3931fb,_0x391858[_0x3641d1]));}}}}}return Promise[_0x8c7f('0x94')](_0x128d43);})[_0x8c7f('0x9')](function(_0x5edf48){var _0x53d6f9=_0x5edf48;var _0x13da8b=null;if(_0x53d6f9){_0x13da8b=_0x53d6f9[_0x8c7f('0x8f')]===0x1?_0x53d6f9[0x0]:null;}if(!_0x13da8b&&!_0x53d6f9)return _0x7ab73b;var _0x3a31a2=_0x1065c2[_0xe5dcda['childModel']][_0x8c7f('0x98')];_0x4d5421[_0x8c7f('0xb')]=_[_0x8c7f('0x99')](_0x3a31a2);_0x4d5421[_0x8c7f('0x88')]=_[_0x8c7f('0x99')](_0xee1731[_0x8c7f('0x88')]);_0x4d5421['filters']=_[_0x8c7f('0x9a')](_0x4d5421['model'],_0x4d5421['query']);_0x15e362[_0x8c7f('0x9b')]=_[_0x8c7f('0x9a')](_0x4d5421[_0x8c7f('0xb')],_0x1b7e48['fields'](_0xee1731[_0x8c7f('0x88')][_0x8c7f('0x9c')]));_0x15e362[_0x8c7f('0x9b')]=_0x15e362[_0x8c7f('0x9b')][_0x8c7f('0x8f')]?_0x15e362[_0x8c7f('0x9b')]:_0x4d5421[_0x8c7f('0xb')];if(!_0xee1731[_0x8c7f('0x88')][_0x8c7f('0x9d')]('nolimit')){_0x15e362[_0x8c7f('0x9e')]=_0x1b7e48[_0x8c7f('0x9e')](_0xee1731[_0x8c7f('0x88')][_0x8c7f('0x9e')]);_0x15e362[_0x8c7f('0x9f')]=_0x1b7e48[_0x8c7f('0x9f')](_0xee1731[_0x8c7f('0x88')][_0x8c7f('0x9f')]);}_0x15e362[_0x8c7f('0xa0')]=_0x1b7e48['sort'](_0xee1731[_0x8c7f('0x88')][_0x8c7f('0xa1')]);_0x15e362[_0x8c7f('0x86')]=_0x1b7e48['filters'](_[_0x8c7f('0xa2')](_0xee1731[_0x8c7f('0x88')],_0x4d5421['filters']));if(_0xee1731['query'][_0x8c7f('0x5')]){_0x15e362[_0x8c7f('0x86')]=_['merge'](_0x15e362[_0x8c7f('0x86')],{'$or':_[_0x8c7f('0xc')](_0x3a31a2,function(_0x58480){if(_0x58480[_0x8c7f('0x3c')][_0x8c7f('0xa3')]!==_0x8c7f('0xa4')){var _0x18f3f7={};_0x18f3f7[_0x58480['field']]={'$like':'%'+_0xee1731[_0x8c7f('0x88')][_0x8c7f('0x5')]+'%'};return _0x18f3f7;}})});}var _0x1c53fc=[];var _0x407d69=null;var _0x13cea0={};if(_0x13da8b){_0x407d69=_[_0x8c7f('0x92')](_0x54feb8,['name',_0x13da8b[_0x8c7f('0x32')]]);if(_0x407d69[_0x8c7f('0x6')]){_0x13cea0={};if(_0xe5dcda['childModel']==='AnalyticExtractedReport'){_0x13cea0[_0x407d69[_0x8c7f('0xa5')]]=_[_0x8c7f('0xc')](_0x13da8b[_0x8c7f('0xa')],'id');}else{_0x13cea0[_0x407d69[_0x8c7f('0xa5')]]=_0x13da8b[_0x8c7f('0xa')];}_0x1c53fc['push'](_0x13cea0);}else{_0x15e362[_0x8c7f('0x86')]['id']=_0x13da8b[_0x8c7f('0xa')];}}else{for(var _0x7e32cb=0x0;_0x7e32cb<_0x53d6f9[_0x8c7f('0x8f')];_0x7e32cb++){_0x407d69=_[_0x8c7f('0x92')](_0x54feb8,['name',_0x53d6f9[_0x7e32cb][_0x8c7f('0x32')]]);if(_0x407d69[_0x8c7f('0x6')]){_0x13cea0={};_0x13cea0[_0x407d69[_0x8c7f('0xa5')]]=_0x53d6f9[_0x7e32cb][_0x8c7f('0xa')];_0x1c53fc[_0x8c7f('0x90')](_0x13cea0);}else{if(!_0x15e362[_0x8c7f('0x86')]['id'])_0x15e362[_0x8c7f('0x86')]['id']=[];_0x53d6f9[_0x7e32cb][_0x8c7f('0xa')][_0x8c7f('0xa6')](function(_0x580409){_0x15e362['where']['id'][_0x8c7f('0x90')](_0x580409);});}}}if(!_['isEmpty'](_0x1c53fc)){_0x15e362[_0x8c7f('0x86')]=_[_0x8c7f('0xa7')](_0x15e362['where'],{'$and':{'$or':_0x1c53fc}});}_0x15e362=_[_0x8c7f('0xa7')]({},_0x15e362,_0xee1731[_0x8c7f('0xa8')]);if(_0x13da8b&&!_0x13da8b[_0x8c7f('0x97')]&&_0xe5dcda['childModel']===_0x8c7f('0xf')){if(_0xee1731[_0x8c7f('0x88')][_0x8c7f('0xa9')]){_0x15e362[_0x8c7f('0xaa')]=[{'all':!![]}];}return _0x1065c2[_0xe5dcda[_0x8c7f('0x11')]][_0x8c7f('0x8')](_0x15e362)['then'](function(_0x4d3019){var _0x34e721=[];_0x4d3019['forEach'](function(_0x486e5a){var _0x1d54a4;switch(_0x486e5a[_0x8c7f('0xab')]){case'default':_0x1d54a4=_[_0x8c7f('0x92')](_0x13da8b[_0x8c7f('0xa')],function(_0x34f6db){return _0x34f6db['id']===_0x486e5a[_0x8c7f('0x79')]&&_0x34f6db[_0x8c7f('0x3c')]===_0x8c7f('0xac');});break;case'custom':_0x1d54a4=_[_0x8c7f('0x92')](_0x13da8b[_0x8c7f('0xa')],function(_0x4027d1){return _0x4027d1['id']===_0x486e5a[_0x8c7f('0x79')]&&_0x4027d1['type']==='CustomReports';});break;}if(_0x1d54a4)_0x34e721[_0x8c7f('0x90')](_0x486e5a);});_0x7ab73b[_0x8c7f('0xad')]=_0x34e721[_0x8c7f('0x8f')];_0x7ab73b[_0x8c7f('0xae')]=_0x34e721;return _0x7ab73b;});}else{if(!_[_0x8c7f('0x8e')](_0xee1731[_0x8c7f('0x88')][_0x8c7f('0xaf')])){_0x15e362['where']['id']=_0x15e362[_0x8c7f('0x86')]['id']?_[_0x8c7f('0x9a')](_0x15e362[_0x8c7f('0x86')]['id'],_0xee1731[_0x8c7f('0x88')]['ids']):_0xee1731[_0x8c7f('0x88')][_0x8c7f('0xaf')];if(_0xee1731[_0x8c7f('0x88')]['customSorting']){_0x15e362[_0x8c7f('0xa0')]=_0xee1731[_0x8c7f('0x88')][_0x8c7f('0xb0')];}}if(_0xee1731[_0x8c7f('0x88')]['extraQueryConditions']){_0x15e362[_0x8c7f('0x86')]=_[_0x8c7f('0xa7')](_0x15e362[_0x8c7f('0x86')],{'$and':_0xee1731[_0x8c7f('0x88')]['extraQueryConditions']});}return _0x1065c2[_0xe5dcda['childModel']][_0x8c7f('0xad')]({'where':_0x15e362[_0x8c7f('0x86')]})[_0x8c7f('0x9')](function(_0x27c7af){_0x7ab73b[_0x8c7f('0xad')]=_0x27c7af;if(_0xee1731[_0x8c7f('0x88')]['includeAll']){if(_0xe5dcda[_0x8c7f('0x11')]===_0x8c7f('0x1a')){_0x15e362[_0x8c7f('0xaa')]=[{'model':_0x1065c2['Tag'],'as':_0x8c7f('0xb1'),'attributes':['id',_0x8c7f('0x32'),_0x8c7f('0xb2')],'required':_0xee1731[_0x8c7f('0x88')][_0x8c7f('0xb3')]?!![]:![]},{'model':_0x1065c2['Tag'],'as':_0x8c7f('0xb4'),'attributes':['id',_0x8c7f('0x32'),_0x8c7f('0xb2')],'through':_0xee1731[_0x8c7f('0x88')][_0x8c7f('0xb3')]?{'attributes':[],'where':{'TagId':_0xee1731[_0x8c7f('0x88')][_0x8c7f('0xb3')]||undefined}}:{},'required':_0xee1731['query'][_0x8c7f('0xb3')]?!![]:![]}];}else{_0x15e362['include']=[{'all':!![]}];}}return _0x1065c2[_0xe5dcda[_0x8c7f('0x11')]][_0x8c7f('0x8')](_0x15e362);})[_0x8c7f('0x9')](function(_0xb33be9){_0x7ab73b['rows']=_0xb33be9;if(_0x5dcffb===_0x8c7f('0x31')&&_0xee1731[_0x8c7f('0x88')][_0x8c7f('0xb5')]===_0x8c7f('0xb6')){var _0x1c7adf=[];for(var _0x28d89a=0x0;_0x28d89a<_0x7ab73b['rows'][_0x8c7f('0x8f')];_0x28d89a++){_0x1c7adf['push'](_0x332178(_0x8c7f('0xb7'),_0x7ab73b['rows'][_0x28d89a][_0x8c7f('0xb8')]));_0x1c7adf[_0x8c7f('0x90')](_0x332178('sms',_0x7ab73b[_0x8c7f('0xae')][_0x28d89a]['dataValues']));_0x1c7adf[_0x8c7f('0x90')](_0x332178(_0x8c7f('0xb9'),_0x7ab73b[_0x8c7f('0xae')][_0x28d89a][_0x8c7f('0xb8')]));_0x1c7adf['push'](_0x332178(_0x8c7f('0xba'),_0x7ab73b[_0x8c7f('0xae')][_0x28d89a][_0x8c7f('0xb8')]));_0x1c7adf[_0x8c7f('0x90')](_0x332178(_0x8c7f('0xbb'),_0x7ab73b[_0x8c7f('0xae')][_0x28d89a]['dataValues']));_0x1c7adf[_0x8c7f('0x90')](_0x332178(_0x8c7f('0xbc'),_0x7ab73b[_0x8c7f('0xae')][_0x28d89a][_0x8c7f('0xb8')]));}return Promise[_0x8c7f('0x94')](_0x1c7adf)['then'](function(){return _0x7ab73b;});}return _0x7ab73b;});}});}}});}; \ No newline at end of file +var _0x4523=['MailAccount','mailsubstatuses','openchannelqueues','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','teams','Team','voicequeues','users','agents','telephones','admin','zendeskaccounts','ZendeskAccount','salesforceaccounts','freshdeskaccounts','FreshdeskAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','dispositions','customdashboards','intervals','pauses','Pause','scheduler','sounds','tags','templates','Template','triggers','Trigger','trunks','variables','plugins','Plugin','extractedreports','metrics','AnalyticMetric','charAt','slice','Sequelize','QueryTypes','SELECT','select','ui.','InteractionId','ui.createdAt','from','where','ui.UserId\x20=\x20?','sequelize','toString','OpenTabs','define','../../components/parsers/qs','query','mergeResources','Invalid\x20section\x20\x27','length','push','UserProfileSection','find','params','all','ignore','isEmpty','autoAssociation','rawAttributes','keys','filters','attributes','fields','nolimit','limit','offset','order','sort','pick','merge','key','VIRTUAL','foreignKey','forEach','options','includeAll','include','reportType','reportId','DefaultReports','custom','CustomReports','rows','ids','customSorting','extraQueryConditions','count','Tag','Tags','color','tag','openTabs','true','chat','dataValues','fax','openchannel','lodash','./userProfile.attributes','filter','value','findAll','then','associatedResources','map','catch','field','model','name','resolve','UserProfileResource','AnalyticExtractedReport','resourceId','type','toLowerCase','squareprojects','childModel','SquareProject','SquareOdbc','squarerecordings','SquareRecording','parentSections','SquareProjects','JscriptyProject','contacts','CmContact','Lists','ListId','lists','CmList','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','FaxQueue','faxaccounts','FaxAccount','inboundroutes','internalroutes','outboundroutes','contexts','voicemails','VoiceMail','voicerecordings','Agents','membername','User','role','agent','Telephones','telephone','VoiceQueues','queue','VoiceQueue','QueueCampaigns','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','ivrcampaigns','Campaign','MailQueue','mailaccounts'];(function(_0x113afc,_0x2c7d5a){var _0x3a9219=function(_0xca2d6b){while(--_0xca2d6b){_0x113afc['push'](_0x113afc['shift']());}};_0x3a9219(++_0x2c7d5a);}(_0x4523,0x1ea));var _0x3452=function(_0x5abbc8,_0xdfe0d6){_0x5abbc8=_0x5abbc8-0x0;var _0x2195d1=_0x4523[_0x5abbc8];return _0x2195d1;};'use strict';var _=require(_0x3452('0x0'));var attributes=require(_0x3452('0x1'));var squel=require('squel');module['exports']=function(_0x7b84a3){var _0x5e0f6b=_0x7b84a3['models'];function _0x69c96b(_0x3e3c9c,_0x42fdd5){return new Promise(function(_0x34aea5,_0x14d6fa){if(!_0x42fdd5)return _0x34aea5(null);var _0x1adde2=_0x42fdd5[_0x3452('0x2')]?{[_0x42fdd5[_0x3452('0x2')]['field']]:_0x42fdd5['filter'][_0x3452('0x3')]}:undefined;return _0x5e0f6b[_0x3e3c9c][_0x3452('0x4')]({'where':_0x1adde2,'raw':!![]})[_0x3452('0x5')](function(_0x573a96){_0x42fdd5[_0x3452('0x6')]=_[_0x3452('0x7')](_0x573a96,'id');_0x34aea5(_0x42fdd5);})[_0x3452('0x8')](function(_0x369d7a){_0x14d6fa(_0x369d7a);});});}function _0x33ef4c(_0x600a8a,_0x2d71df){return new Promise(function(_0x531e0a,_0xde0315){var _0x528eae=_0x600a8a[_0x3452('0x2')]?{[_0x600a8a[_0x3452('0x2')][_0x3452('0x9')]]:_0x600a8a[_0x3452('0x2')]['value']}:undefined;return _0x5e0f6b[_0x600a8a[_0x3452('0xa')]][_0x3452('0x4')]({'where':_0x528eae,'raw':!![]})[_0x3452('0x5')](function(_0x21e93f){_0x2d71df[_0x3452('0x6')]=_[_0x3452('0x7')](_0x21e93f,function(_0x4f5c9c){return _0x4f5c9c[_0x3452('0xb')];});_0x531e0a(_0x2d71df);})[_0x3452('0x8')](function(_0x5bb58a){_0xde0315(_0x5bb58a);});});}function _0x371f50(_0x28c61d,_0x1b0f03,_0x419cd5){if(!_0x1b0f03)return Promise[_0x3452('0xc')](null);return new Promise(function(_0x56e94f,_0x5564b7){return _0x5e0f6b[_0x3452('0xd')][_0x3452('0x4')]({'where':{'sectionId':_0x1b0f03['id']},'raw':!![]})[_0x3452('0x5')](function(_0x3a210c){if(_0x28c61d[_0x3452('0x9')]&&_0x28c61d[_0x3452('0x9')]!=='id'){_0x1b0f03['associatedResources']=_[_0x3452('0x7')](_0x3a210c,function(_0x35de40){return _0x35de40[_0x28c61d['field']];});}else{if(_0x419cd5===_0x3452('0xe')){_0x1b0f03[_0x3452('0x6')]=_[_0x3452('0x7')](_0x3a210c,function(_0x274bfc){return{'id':_0x274bfc[_0x3452('0xf')],'type':_0x274bfc[_0x3452('0x10')]};});}else{_0x1b0f03[_0x3452('0x6')]=_[_0x3452('0x7')](_0x3a210c,function(_0x29c22f){return _0x29c22f['resourceId'];});}}_0x56e94f(_0x1b0f03);})['catch'](function(_0x25e317){_0x5564b7(_0x25e317);});});}function _0x357c8f(_0x42e679,_0x2232c3){var _0x3aa4b6={'parentSections':[]};switch(_0x42e679[_0x3452('0x11')]()){case _0x3452('0x12'):_0x3aa4b6[_0x3452('0x13')]=_0x3452('0x14');break;case'odbc':_0x3aa4b6[_0x3452('0x13')]=_0x3452('0x15');break;case _0x3452('0x16'):_0x3aa4b6['childModel']=_0x3452('0x17');_0x3aa4b6[_0x3452('0x18')]=[{'name':_0x3452('0x19'),'field':_0x3452('0xb'),'foreignKey':'projectName'}];break;case'projects':_0x3aa4b6[_0x3452('0x13')]=_0x3452('0x1a');break;case _0x3452('0x1b'):_0x3aa4b6[_0x3452('0x13')]=_0x3452('0x1c');_0x3aa4b6['parentSections']=[{'name':_0x3452('0x1d'),'field':'id','foreignKey':_0x3452('0x1e')}];break;case _0x3452('0x1f'):_0x3aa4b6[_0x3452('0x13')]=_0x3452('0x20');break;case'companies':_0x3aa4b6[_0x3452('0x13')]=_0x3452('0x21');break;case _0x3452('0x22'):_0x3aa4b6[_0x3452('0x13')]=_0x3452('0x23');break;case _0x3452('0x24'):_0x3aa4b6[_0x3452('0x13')]=_0x3452('0x25');break;case _0x3452('0x26'):_0x3aa4b6[_0x3452('0x13')]=_0x3452('0x27');break;case'faxqueues':_0x3aa4b6['childModel']=_0x3452('0x28');break;case _0x3452('0x29'):_0x3aa4b6[_0x3452('0x13')]=_0x3452('0x2a');break;case _0x3452('0x2b'):case _0x3452('0x2c'):case _0x3452('0x2d'):_0x3aa4b6[_0x3452('0x13')]='VoiceExtension';break;case _0x3452('0x2e'):_0x3aa4b6['childModel']='VoiceContext';break;case _0x3452('0x2f'):_0x3aa4b6[_0x3452('0x13')]=_0x3452('0x30');break;case _0x3452('0x31'):_0x3aa4b6[_0x3452('0x13')]='VoiceRecording';_0x3aa4b6[_0x3452('0x18')]=[{'name':_0x3452('0x32'),'field':_0x3452('0xb'),'foreignKey':_0x3452('0x33'),'model':_0x3452('0x34'),'filter':{'field':_0x3452('0x35'),'value':[_0x3452('0x36')]}},{'name':_0x3452('0x37'),'field':_0x3452('0xb'),'foreignKey':'membername','model':_0x3452('0x34'),'filter':{'field':_0x3452('0x35'),'value':[_0x3452('0x38')]}},{'name':_0x3452('0x39'),'field':_0x3452('0xb'),'foreignKey':_0x3452('0x3a'),'model':_0x3452('0x3b'),'filter':{'field':_0x3452('0x10'),'value':['inbound']}},{'name':_0x3452('0x3c'),'field':_0x3452('0xb'),'foreignKey':_0x3452('0x3a'),'model':_0x3452('0x3b'),'filter':{'field':_0x3452('0x10'),'value':[_0x3452('0x3d')]}}];break;case _0x3452('0x3e'):_0x3aa4b6[_0x3452('0x13')]=_0x3452('0x3f');break;case _0x3452('0x40'):_0x3aa4b6[_0x3452('0x13')]=_0x3452('0x41');break;case _0x3452('0x42'):_0x3aa4b6[_0x3452('0x13')]='VoicePrefix';break;case _0x3452('0x43'):_0x3aa4b6['childModel']=_0x3452('0x44');break;case'mailqueues':_0x3aa4b6[_0x3452('0x13')]=_0x3452('0x45');break;case _0x3452('0x46'):_0x3aa4b6[_0x3452('0x13')]=_0x3452('0x47');break;case _0x3452('0x48'):_0x3aa4b6[_0x3452('0x13')]='MailSubstatus';break;case _0x3452('0x49'):_0x3aa4b6['childModel']='OpenchannelQueue';break;case'openchannelaccounts':_0x3aa4b6[_0x3452('0x13')]=_0x3452('0x4a');break;case _0x3452('0x4b'):_0x3aa4b6[_0x3452('0x13')]=_0x3452('0x4c');break;case _0x3452('0x4d'):_0x3aa4b6[_0x3452('0x13')]=_0x3452('0x4e');break;case _0x3452('0x4f'):_0x3aa4b6[_0x3452('0x13')]=_0x3452('0x50');break;case _0x3452('0x51'):_0x3aa4b6['childModel']='WhatsappAccount';break;case _0x3452('0x52'):_0x3aa4b6[_0x3452('0x13')]=_0x3452('0x53');break;case _0x3452('0x54'):case'queuecampaigns':_0x3aa4b6[_0x3452('0x13')]=_0x3452('0x3b');if(_0x2232c3){_0x3aa4b6[_0x3452('0x18')]=[{'name':'VoiceQueues'},{'name':'QueueCampaigns'}];}break;case _0x3452('0x55'):case _0x3452('0x56'):case _0x3452('0x57'):_0x3aa4b6[_0x3452('0x13')]=_0x3452('0x34');if(_0x2232c3){_0x3aa4b6[_0x3452('0x18')]=[{'name':'Users','filter':{'field':_0x3452('0x35'),'value':[_0x3452('0x58'),'user']},'ignore':!![]},{'name':_0x3452('0x32')},{'name':_0x3452('0x37')}];}break;case _0x3452('0x59'):_0x3aa4b6[_0x3452('0x13')]=_0x3452('0x5a');break;case _0x3452('0x5b'):_0x3aa4b6['childModel']='SalesforceAccount';break;case _0x3452('0x5c'):_0x3aa4b6[_0x3452('0x13')]=_0x3452('0x5d');break;case'sugarcrmaccounts':_0x3aa4b6[_0x3452('0x13')]='SugarcrmAccount';break;case _0x3452('0x5e'):_0x3aa4b6[_0x3452('0x13')]=_0x3452('0x5f');break;case _0x3452('0x60'):_0x3aa4b6[_0x3452('0x13')]=_0x3452('0x61');break;case _0x3452('0x62'):_0x3aa4b6[_0x3452('0x13')]=_0x3452('0x34');break;case _0x3452('0x63'):_0x3aa4b6[_0x3452('0x13')]='CannedAnswer';break;case _0x3452('0x64'):_0x3aa4b6[_0x3452('0x13')]='Disposition';break;case _0x3452('0x65'):_0x3aa4b6[_0x3452('0x13')]='Dashboard';break;case _0x3452('0x66'):_0x3aa4b6['childModel']='Interval';break;case _0x3452('0x67'):_0x3aa4b6[_0x3452('0x13')]=_0x3452('0x68');break;case _0x3452('0x69'):_0x3aa4b6[_0x3452('0x13')]='Schedule';break;case _0x3452('0x6a'):_0x3aa4b6[_0x3452('0x13')]='Sound';break;case _0x3452('0x6b'):_0x3aa4b6[_0x3452('0x13')]='Tag';break;case _0x3452('0x6c'):_0x3aa4b6[_0x3452('0x13')]=_0x3452('0x6d');break;case _0x3452('0x6e'):_0x3aa4b6[_0x3452('0x13')]=_0x3452('0x6f');break;case _0x3452('0x70'):_0x3aa4b6[_0x3452('0x13')]='Trunk';break;case _0x3452('0x71'):_0x3aa4b6[_0x3452('0x13')]='Variable';break;case _0x3452('0x72'):_0x3aa4b6[_0x3452('0x13')]=_0x3452('0x73');break;case _0x3452('0x74'):_0x3aa4b6[_0x3452('0x13')]=_0x3452('0xe');_0x3aa4b6[_0x3452('0x18')]=[{'name':'Reports','field':'id','foreignKey':'reportId'}];break;case _0x3452('0x75'):_0x3aa4b6['childModel']=_0x3452('0x76');break;}return _0x3aa4b6;}function _0x440648(_0x32563d,_0x25df29){var _0xe20c79=_0x32563d[_0x3452('0x77')](0x0)['toUpperCase']()+_0x32563d[_0x3452('0x78')](0x1);var _0x432f66={'type':_0x5e0f6b[_0x3452('0x79')][_0x3452('0x7a')][_0x3452('0x7b')],'raw':!![]};return new Promise(function(_0x5999e7,_0x5b17f3){var _0x9be59a=squel[_0x3452('0x7c')]()[_0x3452('0x9')](_0x3452('0x7d')+_0xe20c79+_0x3452('0x7e'),'id')[_0x3452('0x9')](_0x3452('0x7f'))[_0x3452('0x80')]('user_has_'+_0x32563d+'_interactions','ui')[_0x3452('0x81')](_0x3452('0x82'),_0x25df29['id']);return _0x5e0f6b[_0x3452('0x83')]['query'](_0x9be59a[_0x3452('0x84')](),_0x432f66)[_0x3452('0x5')](function(_0x2ba902){_0x25df29[_0xe20c79+_0x3452('0x85')]=_0x2ba902;_0x5999e7(_0x2ba902);})['catch'](function(_0x44d189){_0x5b17f3(_0x44d189);});});}return _0x7b84a3[_0x3452('0x86')]('UserProfile',attributes,{'tableName':'user_profiles','paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x5af87b){var _0x29318d=require(_0x3452('0x87'));var _0x56bb05={'raw':_0x5af87b[_0x3452('0x88')]['raw'],'where':{}};var _0x245c54={};var _0x41f92={'count':0x0,'rows':[]};var _0x54427e=_0x5af87b[_0x3452('0x88')]['section'];var _0x35580c=_0x5af87b['query'][_0x3452('0x89')]||![];var _0x2ed631=_0x357c8f(_0x54427e,_0x35580c);if(!_0x2ed631[_0x3452('0x13')])throw new Error(_0x3452('0x8a')+_0x54427e+'\x27');var _0x1abb3a=[{'name':_0x54427e}];if(!_['isEmpty'](_0x2ed631[_0x3452('0x18')]))_0x1abb3a=_0x2ed631[_0x3452('0x18')];var _0x187676=[];for(var _0x220b66=0x0;_0x220b66<_0x1abb3a[_0x3452('0x8b')];_0x220b66++){_0x187676[_0x3452('0x8c')](_0x5e0f6b[_0x3452('0x8d')][_0x3452('0x8e')]({'where':{'userProfileId':_0x5af87b[_0x3452('0x8f')]['id'],'name':_0x1abb3a[_0x220b66]['name']},'raw':!![]}));}return Promise[_0x3452('0x90')](_0x187676)[_0x3452('0x5')](function(_0x2ef3cb){var _0x73d214=_['filter'](_0x2ef3cb,function(_0x1b54c2){return _0x1b54c2?_0x1b54c2:undefined;});var _0x265205=_[_0x3452('0x2')](_0x1abb3a,[_0x3452('0x91'),!![]]);var _0x1f408e=_[_0x3452('0x92')](_0x73d214)&&_['isEmpty'](_0x265205)?null:_['union'](_0x265205,_0x73d214);if(!_0x1f408e)return null;var _0x2dd751=[];for(var _0x1eb22a=0x0;_0x1eb22a<_0x1f408e[_0x3452('0x8b')];_0x1eb22a++){var _0x442767=_[_0x3452('0x8e')](_0x1abb3a,function(_0x576e04){return _0x1f408e[_0x1eb22a]?_0x576e04['name']===_0x1f408e[_0x1eb22a][_0x3452('0xb')]:null;});if(_0x442767){if(_0x1f408e[_0x1eb22a]['ignore']){_0x2dd751[_0x3452('0x8c')](_0x69c96b(_0x2ed631[_0x3452('0x13')],_0x1f408e[_0x1eb22a]));}else{if(!_0x1f408e[_0x1eb22a][_0x3452('0x93')]){_0x2dd751['push'](_0x371f50(_0x442767,_0x1f408e[_0x1eb22a],_0x2ed631[_0x3452('0x13')]));}else{if(_0x442767[_0x3452('0xa')]){_0x2dd751[_0x3452('0x8c')](_0x33ef4c(_0x442767,_0x1f408e[_0x1eb22a]));}}}}}return Promise['all'](_0x2dd751);})[_0x3452('0x5')](function(_0x3a7874){var _0x45ad03=_0x3a7874;var _0x47f006=null;if(_0x45ad03){_0x47f006=_0x45ad03[_0x3452('0x8b')]===0x1?_0x45ad03[0x0]:null;}if(!_0x47f006&&!_0x45ad03)return _0x41f92;var _0x652114=_0x5e0f6b[_0x2ed631[_0x3452('0x13')]][_0x3452('0x94')];_0x245c54['model']=_['keys'](_0x652114);_0x245c54[_0x3452('0x88')]=_[_0x3452('0x95')](_0x5af87b[_0x3452('0x88')]);_0x245c54[_0x3452('0x96')]=_['intersection'](_0x245c54[_0x3452('0xa')],_0x245c54[_0x3452('0x88')]);_0x56bb05[_0x3452('0x97')]=_['intersection'](_0x245c54[_0x3452('0xa')],_0x29318d['fields'](_0x5af87b['query'][_0x3452('0x98')]));_0x56bb05[_0x3452('0x97')]=_0x56bb05[_0x3452('0x97')]['length']?_0x56bb05[_0x3452('0x97')]:_0x245c54[_0x3452('0xa')];if(!_0x5af87b[_0x3452('0x88')]['hasOwnProperty'](_0x3452('0x99'))){_0x56bb05[_0x3452('0x9a')]=_0x29318d[_0x3452('0x9a')](_0x5af87b[_0x3452('0x88')][_0x3452('0x9a')]);_0x56bb05['offset']=_0x29318d[_0x3452('0x9b')](_0x5af87b['query'][_0x3452('0x9b')]);}_0x56bb05[_0x3452('0x9c')]=_0x29318d[_0x3452('0x9d')](_0x5af87b[_0x3452('0x88')][_0x3452('0x9d')]);_0x56bb05[_0x3452('0x81')]=_0x29318d[_0x3452('0x96')](_[_0x3452('0x9e')](_0x5af87b[_0x3452('0x88')],_0x245c54[_0x3452('0x96')]));if(_0x5af87b['query'][_0x3452('0x2')]){_0x56bb05['where']=_[_0x3452('0x9f')](_0x56bb05[_0x3452('0x81')],{'$or':_['map'](_0x652114,function(_0x57d0f4){if(_0x57d0f4[_0x3452('0x10')][_0x3452('0xa0')]!==_0x3452('0xa1')){var _0x3b6e7b={};_0x3b6e7b[_0x57d0f4['field']]={'$like':'%'+_0x5af87b[_0x3452('0x88')][_0x3452('0x2')]+'%'};return _0x3b6e7b;}})});}var _0x148688=[];var _0x6bdca7=null;var _0x4dbd40={};if(_0x47f006){_0x6bdca7=_[_0x3452('0x8e')](_0x1abb3a,[_0x3452('0xb'),_0x47f006[_0x3452('0xb')]]);if(_0x6bdca7['field']){_0x4dbd40={};if(_0x2ed631[_0x3452('0x13')]===_0x3452('0xe')){_0x4dbd40[_0x6bdca7[_0x3452('0xa2')]]=_[_0x3452('0x7')](_0x47f006['associatedResources'],'id');}else{_0x4dbd40[_0x6bdca7['foreignKey']]=_0x47f006['associatedResources'];}_0x148688[_0x3452('0x8c')](_0x4dbd40);}else{_0x56bb05['where']['id']=_0x47f006[_0x3452('0x6')];}}else{for(var _0x4302b2=0x0;_0x4302b2<_0x45ad03[_0x3452('0x8b')];_0x4302b2++){_0x6bdca7=_[_0x3452('0x8e')](_0x1abb3a,[_0x3452('0xb'),_0x45ad03[_0x4302b2][_0x3452('0xb')]]);if(_0x6bdca7[_0x3452('0x9')]){_0x4dbd40={};_0x4dbd40[_0x6bdca7[_0x3452('0xa2')]]=_0x45ad03[_0x4302b2][_0x3452('0x6')];_0x148688[_0x3452('0x8c')](_0x4dbd40);}else{if(!_0x56bb05[_0x3452('0x81')]['id'])_0x56bb05[_0x3452('0x81')]['id']=[];_0x45ad03[_0x4302b2][_0x3452('0x6')][_0x3452('0xa3')](function(_0x1d87f0){_0x56bb05[_0x3452('0x81')]['id'][_0x3452('0x8c')](_0x1d87f0);});}}}if(!_[_0x3452('0x92')](_0x148688)){_0x56bb05['where']=_[_0x3452('0x9f')](_0x56bb05[_0x3452('0x81')],{'$and':{'$or':_0x148688}});}_0x56bb05=_['merge']({},_0x56bb05,_0x5af87b[_0x3452('0xa4')]);if(_0x47f006&&!_0x47f006[_0x3452('0x93')]&&_0x2ed631[_0x3452('0x13')]===_0x3452('0xe')){if(_0x5af87b[_0x3452('0x88')][_0x3452('0xa5')]){_0x56bb05[_0x3452('0xa6')]=[{'all':!![]}];}return _0x5e0f6b[_0x2ed631['childModel']]['findAll'](_0x56bb05)[_0x3452('0x5')](function(_0x5748e3){var _0x433723=[];_0x5748e3[_0x3452('0xa3')](function(_0x45db28){var _0xa1a814;switch(_0x45db28[_0x3452('0xa7')]){case'default':_0xa1a814=_[_0x3452('0x8e')](_0x47f006['associatedResources'],function(_0x542bf1){return _0x542bf1['id']===_0x45db28[_0x3452('0xa8')]&&_0x542bf1[_0x3452('0x10')]===_0x3452('0xa9');});break;case _0x3452('0xaa'):_0xa1a814=_[_0x3452('0x8e')](_0x47f006['associatedResources'],function(_0x23ba32){return _0x23ba32['id']===_0x45db28[_0x3452('0xa8')]&&_0x23ba32[_0x3452('0x10')]===_0x3452('0xab');});break;}if(_0xa1a814)_0x433723[_0x3452('0x8c')](_0x45db28);});_0x41f92['count']=_0x433723['length'];_0x41f92[_0x3452('0xac')]=_0x433723;return _0x41f92;});}else{if(!_[_0x3452('0x92')](_0x5af87b[_0x3452('0x88')][_0x3452('0xad')])){_0x56bb05[_0x3452('0x81')]['id']=_0x56bb05[_0x3452('0x81')]['id']?_['intersection'](_0x56bb05[_0x3452('0x81')]['id'],_0x5af87b[_0x3452('0x88')]['ids']):_0x5af87b[_0x3452('0x88')]['ids'];if(_0x5af87b['query'][_0x3452('0xae')]){_0x56bb05['order']=_0x5af87b['query'][_0x3452('0xae')];}}if(_0x5af87b['query'][_0x3452('0xaf')]){_0x56bb05[_0x3452('0x81')]=_[_0x3452('0x9f')](_0x56bb05[_0x3452('0x81')],{'$and':_0x5af87b[_0x3452('0x88')][_0x3452('0xaf')]});}return _0x5e0f6b[_0x2ed631['childModel']]['count']({'where':_0x56bb05[_0x3452('0x81')]})['then'](function(_0x2df46f){_0x41f92[_0x3452('0xb0')]=_0x2df46f;if(_0x5af87b[_0x3452('0x88')][_0x3452('0xa5')]){if(_0x2ed631[_0x3452('0x13')]===_0x3452('0x1c')){_0x56bb05[_0x3452('0xa6')]=[{'model':_0x5e0f6b[_0x3452('0xb1')],'as':_0x3452('0xb2'),'attributes':['id',_0x3452('0xb'),_0x3452('0xb3')],'required':_0x5af87b[_0x3452('0x88')][_0x3452('0xb4')]?!![]:![]},{'model':_0x5e0f6b[_0x3452('0xb1')],'as':'ThroughTags','attributes':['id','name','color'],'through':_0x5af87b[_0x3452('0x88')]['tag']?{'attributes':[],'where':{'TagId':_0x5af87b[_0x3452('0x88')]['tag']||undefined}}:{},'required':_0x5af87b[_0x3452('0x88')][_0x3452('0xb4')]?!![]:![]}];}else{_0x56bb05[_0x3452('0xa6')]=[{'all':!![]}];}}return _0x5e0f6b[_0x2ed631[_0x3452('0x13')]][_0x3452('0x4')](_0x56bb05);})[_0x3452('0x5')](function(_0x19ebc6){_0x41f92['rows']=_0x19ebc6;if(_0x54427e===_0x3452('0x32')&&_0x5af87b[_0x3452('0x88')][_0x3452('0xb5')]===_0x3452('0xb6')){var _0x3d1609=[];for(var _0xd50abc=0x0;_0xd50abc<_0x41f92['rows'][_0x3452('0x8b')];_0xd50abc++){_0x3d1609[_0x3452('0x8c')](_0x440648(_0x3452('0xb7'),_0x41f92[_0x3452('0xac')][_0xd50abc][_0x3452('0xb8')]));_0x3d1609['push'](_0x440648('sms',_0x41f92[_0x3452('0xac')][_0xd50abc][_0x3452('0xb8')]));_0x3d1609[_0x3452('0x8c')](_0x440648(_0x3452('0xb9'),_0x41f92['rows'][_0xd50abc][_0x3452('0xb8')]));_0x3d1609[_0x3452('0x8c')](_0x440648('mail',_0x41f92['rows'][_0xd50abc][_0x3452('0xb8')]));_0x3d1609[_0x3452('0x8c')](_0x440648(_0x3452('0xba'),_0x41f92[_0x3452('0xac')][_0xd50abc][_0x3452('0xb8')]));_0x3d1609[_0x3452('0x8c')](_0x440648('whatsapp',_0x41f92[_0x3452('0xac')][_0xd50abc]['dataValues']));}return Promise[_0x3452('0x90')](_0x3d1609)[_0x3452('0x5')](function(){return _0x41f92;});}return _0x41f92;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 664fbb8..5590991 100644 --- a/server/api/userProfile/userProfile.rpc.js +++ b/server/api/userProfile/userProfile.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x110e=['info','UserProfile,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','UserProfile,\x20%s,\x20%s','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','client','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','request','then'];(function(_0x55f315,_0x2c11db){var _0x55624b=function(_0x241aea){while(--_0x241aea){_0x55f315['push'](_0x55f315['shift']());}};_0x55624b(++_0x2c11db);}(_0x110e,0x68));var _0xe110=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x110e[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xe110('0x0'));var util=require(_0xe110('0x1'));var moment=require('moment');var BPromise=require(_0xe110('0x2'));var rs=require(_0xe110('0x3'));var fs=require('fs');var Redis=require(_0xe110('0x4'));var db=require(_0xe110('0x5'))['db'];var utils=require(_0xe110('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe110('0x7')]['http']({'port':0x232a});config[_0xe110('0x8')]=_[_0xe110('0x9')](config[_0xe110('0x8')],{'host':_0xe110('0xa'),'port':0x18eb});var socket=require(_0xe110('0xb'))(new Redis(config[_0xe110('0x8')]));require(_0xe110('0xc'))[_0xe110('0xd')](socket);function respondWithRpcPromise(_0x3985c9,_0x47a535,_0x2df21e){return new BPromise(function(_0x435722,_0x5ebe72){return client[_0xe110('0xe')](_0x3985c9,_0x2df21e)[_0xe110('0xf')](function(_0x326a5a){logger[_0xe110('0x10')]('UserProfile,\x20%s,\x20%s',_0x47a535,'request\x20sent');logger['debug'](_0xe110('0x11'),_0x47a535,_0xe110('0x12'),JSON['stringify'](_0x326a5a));if(_0x326a5a['error']){if(_0x326a5a['error'][_0xe110('0x13')]===0x1f4){logger[_0xe110('0x14')]('UserProfile,\x20%s,\x20%s',_0x47a535,_0x326a5a['error'][_0xe110('0x15')]);return _0x5ebe72(_0x326a5a['error'][_0xe110('0x15')]);}logger[_0xe110('0x14')](_0xe110('0x16'),_0x47a535,_0x326a5a[_0xe110('0x14')]['message']);return _0x435722(_0x326a5a[_0xe110('0x14')][_0xe110('0x15')]);}else{logger['info']('UserProfile,\x20%s,\x20%s',_0x47a535,_0xe110('0x12'));_0x435722(_0x326a5a['result'][_0xe110('0x15')]);}})[_0xe110('0x17')](function(_0x47fff8){logger[_0xe110('0x14')](_0xe110('0x16'),_0x47a535,_0x47fff8);_0x5ebe72(_0x47fff8);});});} \ No newline at end of file +var _0xf811=['http','defaults','redis','localhost','./userProfile.socket','request','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x33c3f7,_0x530749){var _0x56158a=function(_0x2c53f3){while(--_0x2c53f3){_0x33c3f7['push'](_0x33c3f7['shift']());}};_0x56158a(++_0x530749);}(_0xf811,0x6f));var _0x1f81=function(_0x5317b5,_0x4dfd6e){_0x5317b5=_0x5317b5-0x0;var _0x3b7ce2=_0xf811[_0x5317b5];return _0x3b7ce2;};'use strict';var _=require(_0x1f81('0x0'));var util=require(_0x1f81('0x1'));var moment=require(_0x1f81('0x2'));var BPromise=require(_0x1f81('0x3'));var rs=require(_0x1f81('0x4'));var fs=require('fs');var Redis=require(_0x1f81('0x5'));var db=require(_0x1f81('0x6'))['db'];var utils=require(_0x1f81('0x7'));var logger=require(_0x1f81('0x8'))(_0x1f81('0x9'));var config=require(_0x1f81('0xa'));var jayson=require(_0x1f81('0xb'));var client=jayson[_0x1f81('0xc')][_0x1f81('0xd')]({'port':0x232a});config['redis']=_[_0x1f81('0xe')](config[_0x1f81('0xf')],{'host':_0x1f81('0x10'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1f81('0xf')]));require(_0x1f81('0x11'))['register'](socket);function respondWithRpcPromise(_0x2ce4d7,_0x56b05d,_0x1978e5){return new BPromise(function(_0xf59298,_0x12859d){return client[_0x1f81('0x12')](_0x2ce4d7,_0x1978e5)[_0x1f81('0x13')](function(_0x36ccd8){logger[_0x1f81('0x14')](_0x1f81('0x15'),_0x56b05d,_0x1f81('0x16'));logger[_0x1f81('0x17')](_0x1f81('0x18'),_0x56b05d,_0x1f81('0x16'),JSON[_0x1f81('0x19')](_0x36ccd8));if(_0x36ccd8[_0x1f81('0x1a')]){if(_0x36ccd8[_0x1f81('0x1a')][_0x1f81('0x1b')]===0x1f4){logger['error'](_0x1f81('0x15'),_0x56b05d,_0x36ccd8[_0x1f81('0x1a')]['message']);return _0x12859d(_0x36ccd8['error'][_0x1f81('0x1c')]);}logger[_0x1f81('0x1a')]('UserProfile,\x20%s,\x20%s',_0x56b05d,_0x36ccd8[_0x1f81('0x1a')][_0x1f81('0x1c')]);return _0xf59298(_0x36ccd8[_0x1f81('0x1a')][_0x1f81('0x1c')]);}else{logger['info']('UserProfile,\x20%s,\x20%s',_0x56b05d,_0x1f81('0x16'));_0xf59298(_0x36ccd8[_0x1f81('0x1d')]['message']);}})[_0x1f81('0x1e')](function(_0x5310fb){logger[_0x1f81('0x1a')](_0x1f81('0x15'),_0x56b05d,_0x5310fb);_0x12859d(_0x5310fb);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 0b69b4f..d4af528 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 _0x4a31=['userProfile:','save','remove','update','emit','removeListener','register','length'];(function(_0x27e8f2,_0x19c3ed){var _0x3aff23=function(_0x3366ac){while(--_0x3366ac){_0x27e8f2['push'](_0x27e8f2['shift']());}};_0x3aff23(++_0x19c3ed);}(_0x4a31,0xf1));var _0x14a3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4a31[_0x3dd15e];return _0x231fd0;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=[_0x14a3('0x0'),_0x14a3('0x1'),_0x14a3('0x2')];function createListener(_0x594d02,_0x2efaa5){return function(_0x2404f2){_0x2efaa5[_0x14a3('0x3')](_0x594d02,_0x2404f2);};}function removeListener(_0x4c3c1d,_0x223a94){return function(){UserProfileEvents[_0x14a3('0x4')](_0x4c3c1d,_0x223a94);};}exports[_0x14a3('0x5')]=function(_0x51cc86){for(var _0x2f6b58=0x0,_0x5530d7=events[_0x14a3('0x6')];_0x2f6b58<_0x5530d7;_0x2f6b58++){var _0x10d5b1=events[_0x2f6b58];var _0x18bb02=createListener(_0x14a3('0x7')+_0x10d5b1,_0x51cc86);UserProfileEvents['on'](_0x10d5b1,_0x18bb02);}}; \ No newline at end of file +var _0xfdb1=['removeListener','register','length','userProfile:','./userProfile.events','save','remove','update','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfdb1,0xb8));var _0x1fdb=function(_0x451c2c,_0x5c5f2d){_0x451c2c=_0x451c2c-0x0;var _0x50fb6d=_0xfdb1[_0x451c2c];return _0x50fb6d;};'use strict';var UserProfileEvents=require(_0x1fdb('0x0'));var events=[_0x1fdb('0x1'),_0x1fdb('0x2'),_0x1fdb('0x3')];function createListener(_0x189379,_0x289688){return function(_0x57ac63){_0x289688[_0x1fdb('0x4')](_0x189379,_0x57ac63);};}function removeListener(_0x2e6200,_0x4fec6e){return function(){UserProfileEvents[_0x1fdb('0x5')](_0x2e6200,_0x4fec6e);};}exports[_0x1fdb('0x6')]=function(_0x5b1b48){for(var _0x4d7ca5=0x0,_0xaa42ab=events[_0x1fdb('0x7')];_0x4d7ca5<_0xaa42ab;_0x4d7ca5++){var _0x44d3cb=events[_0x4d7ca5];var _0xc4936a=createListener(_0x1fdb('0x8')+_0x44d3cb,_0x5b1b48);UserProfileEvents['on'](_0x44d3cb,_0xc4936a);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 1c6e883..f06877a 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 _0xc260=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','destroy','exports','multer','util'];(function(_0x2baca1,_0x2f3557){var _0x9aa62a=function(_0x5c47d5){while(--_0x5c47d5){_0x2baca1['push'](_0x2baca1['shift']());}};_0x9aa62a(++_0x2f3557);}(_0xc260,0x10f));var _0x0c26=function(_0x5e6d61,_0x44e9c7){_0x5e6d61=_0x5e6d61-0x0;var _0x4aec58=_0xc260[_0x5e6d61];return _0x4aec58;};'use strict';var multer=require(_0x0c26('0x0'));var util=require(_0x0c26('0x1'));var path=require(_0x0c26('0x2'));var timeout=require(_0x0c26('0x3'));var express=require(_0x0c26('0x4'));var router=express['Router']();var fs_extra=require(_0x0c26('0x5'));var auth=require(_0x0c26('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x0c26('0x7'));var controller=require('./userProfileResource.controller');router[_0x0c26('0x8')]('/',auth['isAuthenticated'](),controller[_0x0c26('0x9')]);router[_0x0c26('0x8')](_0x0c26('0xa'),auth[_0x0c26('0xb')](),controller[_0x0c26('0xc')]);router['get'](_0x0c26('0xd'),auth[_0x0c26('0xb')](),controller[_0x0c26('0xe')]);router[_0x0c26('0xf')]('/',auth[_0x0c26('0xb')](),controller[_0x0c26('0x10')]);router[_0x0c26('0x11')](_0x0c26('0xd'),auth[_0x0c26('0xb')](),controller[_0x0c26('0x12')]);router['delete'](_0x0c26('0xd'),auth[_0x0c26('0xb')](),controller[_0x0c26('0x13')]);module[_0x0c26('0x14')]=router; \ No newline at end of file +var _0x1b30=['show','post','isAuthenticated','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','index','/describe','describe','/:id'];(function(_0x2c6e49,_0x3da2b3){var _0x22bc43=function(_0x5765fc){while(--_0x5765fc){_0x2c6e49['push'](_0x2c6e49['shift']());}};_0x22bc43(++_0x3da2b3);}(_0x1b30,0x194));var _0x01b3=function(_0x2b50e8,_0x580617){_0x2b50e8=_0x2b50e8-0x0;var _0x6fe287=_0x1b30[_0x2b50e8];return _0x6fe287;};'use strict';var multer=require(_0x01b3('0x0'));var util=require('util');var path=require(_0x01b3('0x1'));var timeout=require(_0x01b3('0x2'));var express=require(_0x01b3('0x3'));var router=express[_0x01b3('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x01b3('0x5'));var interaction=require(_0x01b3('0x6'));var config=require(_0x01b3('0x7'));var controller=require(_0x01b3('0x8'));router[_0x01b3('0x9')]('/',auth['isAuthenticated'](),controller[_0x01b3('0xa')]);router[_0x01b3('0x9')](_0x01b3('0xb'),auth['isAuthenticated'](),controller[_0x01b3('0xc')]);router[_0x01b3('0x9')](_0x01b3('0xd'),auth['isAuthenticated'](),controller[_0x01b3('0xe')]);router[_0x01b3('0xf')]('/',auth[_0x01b3('0x10')](),controller['create']);router[_0x01b3('0x11')](_0x01b3('0xd'),auth[_0x01b3('0x10')](),controller[_0x01b3('0x12')]);router[_0x01b3('0x13')](_0x01b3('0xd'),auth[_0x01b3('0x10')](),controller[_0x01b3('0x14')]);module[_0x01b3('0x15')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index f2ba331..8e3bf74 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 _0x0d8f=['INTEGER','STRING','sequelize','exports'];(function(_0x3869fa,_0x16ef3f){var _0x209652=function(_0x527167){while(--_0x527167){_0x3869fa['push'](_0x3869fa['shift']());}};_0x209652(++_0x16ef3f);}(_0x0d8f,0x11e));var _0xf0d8=function(_0x4c98b9,_0x1ad11b){_0x4c98b9=_0x4c98b9-0x0;var _0x3a257a=_0x0d8f[_0x4c98b9];return _0x3a257a;};'use strict';var Sequelize=require(_0xf0d8('0x0'));module[_0xf0d8('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize[_0xf0d8('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xf0d8('0x3')],'allowNull':![]}}; \ No newline at end of file +var _0x5c7b=['exports','INTEGER'];(function(_0x2a6f2f,_0x512904){var _0x335dfc=function(_0x1bab2b){while(--_0x1bab2b){_0x2a6f2f['push'](_0x2a6f2f['shift']());}};_0x335dfc(++_0x512904);}(_0x5c7b,0xac));var _0xb5c7=function(_0x1ccdf7,_0x215d5a){_0x1ccdf7=_0x1ccdf7-0x0;var _0x52a0ae=_0x5c7b[_0x1ccdf7];return _0x52a0ae;};'use strict';var Sequelize=require('sequelize');module[_0xb5c7('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize[_0xb5c7('0x1')],'allowNull':![]},'type':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index a828068..fccafbc 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 _0x4c60=['../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','then','destroy','end','error','stack','name','index','map','UserProfileResource','rawAttributes','key','keys','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','rows','catch','show','includeAll','find','create','update','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util'];(function(_0x1f184a,_0x19ff0c){var _0x5780b1=function(_0x290490){while(--_0x290490){_0x1f184a['push'](_0x1f184a['shift']());}};_0x5780b1(++_0x19ff0c);}(_0x4c60,0xc1));var _0x04c6=function(_0x327351,_0x6c9e7d){_0x327351=_0x327351-0x0;var _0x54d1e8=_0x4c60[_0x327351];return _0x54d1e8;};'use strict';var emlformat=require(_0x04c6('0x0'));var rimraf=require(_0x04c6('0x1'));var zipdir=require(_0x04c6('0x2'));var jsonpatch=require(_0x04c6('0x3'));var rp=require('request-promise');var moment=require(_0x04c6('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x04c6('0x5'));var csv=require(_0x04c6('0x6'));var ejs=require(_0x04c6('0x7'));var fs=require('fs');var fs_extra=require(_0x04c6('0x8'));var _=require(_0x04c6('0x9'));var squel=require(_0x04c6('0xa'));var crypto=require(_0x04c6('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x04c6('0xc'));var toCsv=require(_0x04c6('0x6'));var querystring=require(_0x04c6('0xd'));var Papa=require(_0x04c6('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x04c6('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x04c6('0x10'))(_0x04c6('0x11'));var utils=require('../../config/utils');var config=require(_0x04c6('0x12'));var licenseUtil=require(_0x04c6('0x13'));var db=require(_0x04c6('0x14'))['db'];function respondWithStatusCode(_0x4e5e6,_0x52cdcf){_0x52cdcf=_0x52cdcf||0xcc;return function(_0x257a0a){if(_0x257a0a){return _0x4e5e6[_0x04c6('0x15')](_0x52cdcf);}return _0x4e5e6[_0x04c6('0x16')](_0x52cdcf)['end']();};}function respondWithResult(_0x12d1c5,_0x15cbe0){_0x15cbe0=_0x15cbe0||0xc8;return function(_0x28632e){if(_0x28632e){return _0x12d1c5[_0x04c6('0x16')](_0x15cbe0)[_0x04c6('0x17')](_0x28632e);}};}function respondWithFilteredResult(_0x19a26f,_0x1cd963){return function(_0x3d46a9){if(_0x3d46a9){var _0x5a5a66=typeof _0x1cd963[_0x04c6('0x18')]===_0x04c6('0x19')&&typeof _0x1cd963[_0x04c6('0x1a')]===_0x04c6('0x19');var _0x43596a=_0x3d46a9[_0x04c6('0x1b')];var _0x21674a=_0x5a5a66?0x0:_0x1cd963[_0x04c6('0x18')];var _0x47f400=_0x5a5a66?_0x3d46a9[_0x04c6('0x1b')]:_0x1cd963[_0x04c6('0x18')]+_0x1cd963[_0x04c6('0x1a')];var _0x558b43;if(_0x47f400>=_0x43596a){_0x47f400=_0x43596a;_0x558b43=0xc8;}else{_0x558b43=0xce;}_0x19a26f['status'](_0x558b43);return _0x19a26f['set'](_0x04c6('0x1c'),_0x21674a+'-'+_0x47f400+'/'+_0x43596a)[_0x04c6('0x17')](_0x3d46a9);}return null;};}function patchUpdates(_0x50dd61){return function(_0x5a5e9e){try{jsonpatch[_0x04c6('0x1d')](_0x5a5e9e,_0x50dd61,!![]);}catch(_0x2eed94){return BPromise[_0x04c6('0x1e')](_0x2eed94);}return _0x5a5e9e['save']();};}function saveUpdates(_0x33a0f7,_0x13f2dc){return function(_0x9d41f8){if(_0x9d41f8){return _0x9d41f8['update'](_0x33a0f7)[_0x04c6('0x1f')](function(_0x41e29f){return _0x41e29f;});}return null;};}function removeEntity(_0x562491,_0x54a8b0){return function(_0x4c8d72){if(_0x4c8d72){return _0x4c8d72[_0x04c6('0x20')]()[_0x04c6('0x1f')](function(){_0x562491[_0x04c6('0x16')](0xcc)[_0x04c6('0x21')]();});}};}function handleEntityNotFound(_0x3e1328,_0x52e5f5){return function(_0x562952){if(!_0x562952){_0x3e1328[_0x04c6('0x15')](0x194);}return _0x562952;};}function handleError(_0x2ab1d2,_0x9acfa){_0x9acfa=_0x9acfa||0x1f4;return function(_0x3233d7){logger[_0x04c6('0x22')](_0x3233d7[_0x04c6('0x23')]);if(_0x3233d7['name']){delete _0x3233d7[_0x04c6('0x24')];}_0x2ab1d2[_0x04c6('0x16')](_0x9acfa)['send'](_0x3233d7);};}exports[_0x04c6('0x25')]=function(_0x1cd16a,_0x5f1331){var _0x5c9003={},_0x115d84={},_0x3a6d92={'count':0x0,'rows':[]};var _0x2a191f=_[_0x04c6('0x26')](db[_0x04c6('0x27')][_0x04c6('0x28')],function(_0x49c4ed){return{'name':_0x49c4ed['fieldName'],'type':_0x49c4ed['type'][_0x04c6('0x29')]};});_0x115d84['model']=_[_0x04c6('0x26')](_0x2a191f,_0x04c6('0x24'));_0x115d84['query']=_[_0x04c6('0x2a')](_0x1cd16a[_0x04c6('0x2b')]);_0x115d84[_0x04c6('0x2c')]=_[_0x04c6('0x2d')](_0x115d84['model'],_0x115d84[_0x04c6('0x2b')]);_0x5c9003[_0x04c6('0x2e')]=_[_0x04c6('0x2d')](_0x115d84[_0x04c6('0x2f')],qs[_0x04c6('0x30')](_0x1cd16a[_0x04c6('0x2b')][_0x04c6('0x30')]));_0x5c9003[_0x04c6('0x2e')]=_0x5c9003[_0x04c6('0x2e')][_0x04c6('0x31')]?_0x5c9003[_0x04c6('0x2e')]:_0x115d84[_0x04c6('0x2f')];if(!_0x1cd16a[_0x04c6('0x2b')][_0x04c6('0x32')](_0x04c6('0x33'))){_0x5c9003['limit']=qs[_0x04c6('0x1a')](_0x1cd16a[_0x04c6('0x2b')][_0x04c6('0x1a')]);_0x5c9003[_0x04c6('0x18')]=qs['offset'](_0x1cd16a[_0x04c6('0x2b')][_0x04c6('0x18')]);}_0x5c9003['order']=qs['sort'](_0x1cd16a['query'][_0x04c6('0x34')]);_0x5c9003[_0x04c6('0x35')]=qs['filters'](_[_0x04c6('0x36')](_0x1cd16a['query'],_0x115d84[_0x04c6('0x2c')]),_0x2a191f);if(_0x1cd16a[_0x04c6('0x2b')][_0x04c6('0x37')]){_0x5c9003[_0x04c6('0x35')]=_['merge'](_0x5c9003['where'],{'$or':_[_0x04c6('0x26')](_0x2a191f,function(_0x3a9a3b){if(_0x3a9a3b['type']!==_0x04c6('0x38')){var _0x5ce4b0={};_0x5ce4b0[_0x3a9a3b['name']]={'$like':'%'+_0x1cd16a[_0x04c6('0x2b')]['filter']+'%'};return _0x5ce4b0;}})});}_0x5c9003=_[_0x04c6('0x39')]({},_0x5c9003,_0x1cd16a[_0x04c6('0x3a')]);var _0x59ca18={'where':_0x5c9003[_0x04c6('0x35')]};return db['UserProfileResource'][_0x04c6('0x1b')](_0x59ca18)[_0x04c6('0x1f')](function(_0x2d83eb){_0x3a6d92[_0x04c6('0x1b')]=_0x2d83eb;if(_0x1cd16a[_0x04c6('0x2b')]['includeAll']){_0x5c9003[_0x04c6('0x3b')]=[{'all':!![]}];}return db['UserProfileResource'][_0x04c6('0x3c')](_0x5c9003);})['then'](function(_0x1f7ead){_0x3a6d92[_0x04c6('0x3d')]=_0x1f7ead;return _0x3a6d92;})[_0x04c6('0x1f')](respondWithFilteredResult(_0x5f1331,_0x5c9003))[_0x04c6('0x3e')](handleError(_0x5f1331,null));};exports[_0x04c6('0x3f')]=function(_0x2cdf34,_0x40477f){var _0x4a3c45={'raw':![],'where':{'id':_0x2cdf34['params']['id']}},_0xdfdc34={};_0xdfdc34[_0x04c6('0x2f')]=_['keys'](db['UserProfileResource'][_0x04c6('0x28')]);_0xdfdc34['query']=_[_0x04c6('0x2a')](_0x2cdf34[_0x04c6('0x2b')]);_0xdfdc34[_0x04c6('0x2c')]=_['intersection'](_0xdfdc34[_0x04c6('0x2f')],_0xdfdc34[_0x04c6('0x2b')]);_0x4a3c45[_0x04c6('0x2e')]=_[_0x04c6('0x2d')](_0xdfdc34[_0x04c6('0x2f')],qs[_0x04c6('0x30')](_0x2cdf34[_0x04c6('0x2b')]['fields']));_0x4a3c45['attributes']=_0x4a3c45[_0x04c6('0x2e')][_0x04c6('0x31')]?_0x4a3c45[_0x04c6('0x2e')]:_0xdfdc34['model'];if(_0x2cdf34[_0x04c6('0x2b')][_0x04c6('0x40')]){_0x4a3c45[_0x04c6('0x3b')]=[{'all':!![]}];}_0x4a3c45=_['merge']({},_0x4a3c45,_0x2cdf34['options']);return db['UserProfileResource'][_0x04c6('0x41')](_0x4a3c45)[_0x04c6('0x1f')](handleEntityNotFound(_0x40477f,null))['then'](respondWithResult(_0x40477f,null))[_0x04c6('0x3e')](handleError(_0x40477f,null));};exports[_0x04c6('0x42')]=function(_0x2bd045,_0x4ef366){return db[_0x04c6('0x27')][_0x04c6('0x42')](_0x2bd045['body'],{})[_0x04c6('0x1f')](respondWithResult(_0x4ef366,0xc9))[_0x04c6('0x3e')](handleError(_0x4ef366,null));};exports[_0x04c6('0x43')]=function(_0xee2822,_0x4cfde2){if(_0xee2822[_0x04c6('0x44')]['id']){delete _0xee2822[_0x04c6('0x44')]['id'];}return db[_0x04c6('0x27')][_0x04c6('0x41')]({'where':{'id':_0xee2822['params']['id']}})[_0x04c6('0x1f')](handleEntityNotFound(_0x4cfde2,null))[_0x04c6('0x1f')](saveUpdates(_0xee2822[_0x04c6('0x44')],null))[_0x04c6('0x1f')](respondWithResult(_0x4cfde2,null))['catch'](handleError(_0x4cfde2,null));};exports[_0x04c6('0x20')]=function(_0x42273e,_0x15ec61){return db['UserProfileResource'][_0x04c6('0x41')]({'where':{'id':_0x42273e[_0x04c6('0x45')]['id']}})[_0x04c6('0x1f')](handleEntityNotFound(_0x15ec61,null))[_0x04c6('0x1f')](removeEntity(_0x15ec61,null))[_0x04c6('0x3e')](handleError(_0x15ec61,null));};exports[_0x04c6('0x46')]=function(_0x1b8fa4,_0x160f91){return db[_0x04c6('0x27')][_0x04c6('0x46')]()[_0x04c6('0x1f')](respondWithResult(_0x160f91,null))[_0x04c6('0x3e')](handleError(_0x160f91,null));}; \ No newline at end of file +var _0x7880=['destroy','error','stack','name','send','index','UserProfileResource','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','create','body','describe','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'];(function(_0xe6beba,_0x3f15d1){var _0x2f1c08=function(_0x2e7d9f){while(--_0x2e7d9f){_0xe6beba['push'](_0xe6beba['shift']());}};_0x2f1c08(++_0x3f15d1);}(_0x7880,0x1f4));var _0x0788=function(_0x3e9ef3,_0x21a7e4){_0x3e9ef3=_0x3e9ef3-0x0;var _0x333748=_0x7880[_0x3e9ef3];return _0x333748;};'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['UserProfileResource'][_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['create']=function(_0x4c6366,_0x39c3cc){return db[_0x0788('0x2d')][_0x0788('0x4a')](_0x4c6366['body'],{})[_0x0788('0x26')](respondWithResult(_0x39c3cc,0xc9))[_0x0788('0x44')](handleError(_0x39c3cc,null));};exports[_0x0788('0x25')]=function(_0x4563cd,_0x2395ad){if(_0x4563cd['body']['id']){delete _0x4563cd['body']['id'];}return db[_0x0788('0x2d')][_0x0788('0x49')]({'where':{'id':_0x4563cd['params']['id']}})[_0x0788('0x26')](handleEntityNotFound(_0x2395ad,null))['then'](saveUpdates(_0x4563cd[_0x0788('0x4b')],null))[_0x0788('0x26')](respondWithResult(_0x2395ad,null))[_0x0788('0x44')](handleError(_0x2395ad,null));};exports[_0x0788('0x27')]=function(_0x3c757a,_0x379928){return db[_0x0788('0x2d')][_0x0788('0x49')]({'where':{'id':_0x3c757a['params']['id']}})[_0x0788('0x26')](handleEntityNotFound(_0x379928,null))[_0x0788('0x26')](removeEntity(_0x379928,null))[_0x0788('0x44')](handleError(_0x379928,null));};exports['describe']=function(_0x1693d0,_0x5d32ae){return db['UserProfileResource'][_0x0788('0x4c')]()[_0x0788('0x26')](respondWithResult(_0x5d32ae,null))[_0x0788('0x44')](handleError(_0x5d32ae,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index dca1f30..f3e040b 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 _0xe2d2=['exports','UserProfileResource','compositeIndex','resourceId','sectionId','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2a41fb,_0x149269){var _0x44b1b8=function(_0x5e9024){while(--_0x5e9024){_0x2a41fb['push'](_0x2a41fb['shift']());}};_0x44b1b8(++_0x149269);}(_0xe2d2,0x1a9));var _0x2e2d=function(_0x28b836,_0x2ce2d){_0x28b836=_0x28b836-0x0;var _0x347ea8=_0xe2d2[_0x28b836];return _0x347ea8;};'use strict';var _=require('lodash');var util=require(_0x2e2d('0x0'));var logger=require(_0x2e2d('0x1'))(_0x2e2d('0x2'));var moment=require(_0x2e2d('0x3'));var BPromise=require(_0x2e2d('0x4'));var rp=require(_0x2e2d('0x5'));var fs=require('fs');var path=require(_0x2e2d('0x6'));var rimraf=require(_0x2e2d('0x7'));var config=require(_0x2e2d('0x8'));var attributes=require('./userProfileResource.attributes');module[_0x2e2d('0x9')]=function(_0xe8c1ca,_0x1fc125){return _0xe8c1ca['define'](_0x2e2d('0xa'),attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':_0x2e2d('0xb'),'fields':[_0x2e2d('0xc'),_0x2e2d('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7d5a=['compositeIndex','resourceId','sectionId','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','define','UserProfileResource','user_profile_has_resources'];(function(_0x2c449c,_0x4c5246){var _0x28716e=function(_0x4689b4){while(--_0x4689b4){_0x2c449c['push'](_0x2c449c['shift']());}};_0x28716e(++_0x4c5246);}(_0x7d5a,0xb3));var _0xa7d5=function(_0x2f9158,_0x2c4a50){_0x2f9158=_0x2f9158-0x0;var _0x137a95=_0x7d5a[_0x2f9158];return _0x137a95;};'use strict';var _=require(_0xa7d5('0x0'));var util=require(_0xa7d5('0x1'));var logger=require(_0xa7d5('0x2'))(_0xa7d5('0x3'));var moment=require(_0xa7d5('0x4'));var BPromise=require('bluebird');var rp=require(_0xa7d5('0x5'));var fs=require('fs');var path=require(_0xa7d5('0x6'));var rimraf=require(_0xa7d5('0x7'));var config=require(_0xa7d5('0x8'));var attributes=require('./userProfileResource.attributes');module[_0xa7d5('0x9')]=function(_0x4dba85,_0x429820){return _0x4dba85[_0xa7d5('0xa')](_0xa7d5('0xb'),attributes,{'tableName':_0xa7d5('0xc'),'paranoid':![],'indexes':[{'name':_0xa7d5('0xd'),'fields':[_0xa7d5('0xe'),_0xa7d5('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 88f4656..e06f26b 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 _0xf474=['http','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','message','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x4fcc4a,_0x4aaa88){var _0x50f8fa=function(_0x24abf6){while(--_0x24abf6){_0x4fcc4a['push'](_0x4fcc4a['shift']());}};_0x50f8fa(++_0x4aaa88);}(_0xf474,0x1ba));var _0x4f47=function(_0x411017,_0x4a8117){_0x411017=_0x411017-0x0;var _0x2adeea=_0xf474[_0x411017];return _0x2adeea;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4f47('0x0'));var fs=require('fs');var Redis=require(_0x4f47('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0x4f47('0x2'));var logger=require(_0x4f47('0x3'))(_0x4f47('0x4'));var config=require(_0x4f47('0x5'));var jayson=require(_0x4f47('0x6'));var client=jayson[_0x4f47('0x7')][_0x4f47('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x58f525,_0x23ebd5,_0x4f6d32){return new BPromise(function(_0x4f7862,_0x3f0832){return client['request'](_0x58f525,_0x4f6d32)['then'](function(_0x3ef184){logger[_0x4f47('0x9')](_0x4f47('0xa'),_0x23ebd5,_0x4f47('0xb'));logger[_0x4f47('0xc')](_0x4f47('0xd'),_0x23ebd5,_0x4f47('0xb'),JSON[_0x4f47('0xe')](_0x3ef184));if(_0x3ef184[_0x4f47('0xf')]){if(_0x3ef184[_0x4f47('0xf')][_0x4f47('0x10')]===0x1f4){logger[_0x4f47('0xf')]('UserProfileResource,\x20%s,\x20%s',_0x23ebd5,_0x3ef184[_0x4f47('0xf')][_0x4f47('0x11')]);return _0x3f0832(_0x3ef184[_0x4f47('0xf')][_0x4f47('0x11')]);}logger[_0x4f47('0xf')]('UserProfileResource,\x20%s,\x20%s',_0x23ebd5,_0x3ef184[_0x4f47('0xf')]['message']);return _0x4f7862(_0x3ef184[_0x4f47('0xf')]['message']);}else{logger['info'](_0x4f47('0xa'),_0x23ebd5,'request\x20sent');_0x4f7862(_0x3ef184['result']['message']);}})['catch'](function(_0x222f80){logger[_0x4f47('0xf')]('UserProfileResource,\x20%s,\x20%s',_0x23ebd5,_0x222f80);_0x3f0832(_0x222f80);});});} \ No newline at end of file +var _0x0b1d=['then','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x4402e5,_0x584d28){var _0x3f67f8=function(_0xf93cf9){while(--_0xf93cf9){_0x4402e5['push'](_0x4402e5['shift']());}};_0x3f67f8(++_0x584d28);}(_0x0b1d,0x108));var _0xd0b1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0b1d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd0b1('0x0'));var util=require(_0xd0b1('0x1'));var moment=require('moment');var BPromise=require(_0xd0b1('0x2'));var rs=require(_0xd0b1('0x3'));var fs=require('fs');var Redis=require(_0xd0b1('0x4'));var db=require(_0xd0b1('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd0b1('0x6'))(_0xd0b1('0x7'));var config=require(_0xd0b1('0x8'));var jayson=require(_0xd0b1('0x9'));var client=jayson[_0xd0b1('0xa')][_0xd0b1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3faf65,_0x1dadb5,_0x53994c){return new BPromise(function(_0x2cff2f,_0x52b7ce){return client['request'](_0x3faf65,_0x53994c)[_0xd0b1('0xc')](function(_0x965bbc){logger['info'](_0xd0b1('0xd'),_0x1dadb5,_0xd0b1('0xe'));logger[_0xd0b1('0xf')](_0xd0b1('0x10'),_0x1dadb5,_0xd0b1('0xe'),JSON[_0xd0b1('0x11')](_0x965bbc));if(_0x965bbc['error']){if(_0x965bbc['error'][_0xd0b1('0x12')]===0x1f4){logger['error'](_0xd0b1('0xd'),_0x1dadb5,_0x965bbc[_0xd0b1('0x13')][_0xd0b1('0x14')]);return _0x52b7ce(_0x965bbc[_0xd0b1('0x13')]['message']);}logger[_0xd0b1('0x13')](_0xd0b1('0xd'),_0x1dadb5,_0x965bbc['error']['message']);return _0x2cff2f(_0x965bbc[_0xd0b1('0x13')][_0xd0b1('0x14')]);}else{logger[_0xd0b1('0x15')](_0xd0b1('0xd'),_0x1dadb5,_0xd0b1('0xe'));_0x2cff2f(_0x965bbc['result']['message']);}})[_0xd0b1('0x16')](function(_0x179e80){logger[_0xd0b1('0x13')](_0xd0b1('0xd'),_0x1dadb5,_0x179e80);_0x52b7ce(_0x179e80);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 4407d44..c3cb63f 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 _0x2261=['delete','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated','index','/describe','describe','/:id','post','update'];(function(_0x18a15d,_0x151ed8){var _0x106897=function(_0x28687e){while(--_0x28687e){_0x18a15d['push'](_0x18a15d['shift']());}};_0x106897(++_0x151ed8);}(_0x2261,0x92));var _0x1226=function(_0x37829b,_0x383b5c){_0x37829b=_0x37829b-0x0;var _0x101a25=_0x2261[_0x37829b];return _0x101a25;};'use strict';var multer=require(_0x1226('0x0'));var util=require(_0x1226('0x1'));var path=require(_0x1226('0x2'));var timeout=require(_0x1226('0x3'));var express=require('express');var router=express[_0x1226('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x1226('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x1226('0x6'));var controller=require(_0x1226('0x7'));router[_0x1226('0x8')]('/',auth[_0x1226('0x9')](),controller[_0x1226('0xa')]);router[_0x1226('0x8')](_0x1226('0xb'),auth[_0x1226('0x9')](),controller[_0x1226('0xc')]);router['get'](_0x1226('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x1226('0xe')]('/',auth[_0x1226('0x9')](),controller['create']);router['put'](_0x1226('0xd'),auth[_0x1226('0x9')](),controller[_0x1226('0xf')]);router[_0x1226('0x10')](_0x1226('0xd'),auth[_0x1226('0x9')](),controller[_0x1226('0x11')]);module['exports']=router; \ No newline at end of file +var _0x0d43=['update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','/:id','show','post','create','put'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x0d43,0xa4));var _0x30d4=function(_0x506cbf,_0xb7e1d8){_0x506cbf=_0x506cbf-0x0;var _0x5513f1=_0x0d43[_0x506cbf];return _0x5513f1;};'use strict';var multer=require('multer');var util=require(_0x30d4('0x0'));var path=require(_0x30d4('0x1'));var timeout=require(_0x30d4('0x2'));var express=require(_0x30d4('0x3'));var router=express[_0x30d4('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x30d4('0x5'));var interaction=require(_0x30d4('0x6'));var config=require(_0x30d4('0x7'));var controller=require('./userProfileSection.controller');router[_0x30d4('0x8')]('/',auth[_0x30d4('0x9')](),controller['index']);router[_0x30d4('0x8')](_0x30d4('0xa'),auth[_0x30d4('0x9')](),controller['describe']);router[_0x30d4('0x8')](_0x30d4('0xb'),auth[_0x30d4('0x9')](),controller[_0x30d4('0xc')]);router[_0x30d4('0xd')]('/',auth[_0x30d4('0x9')](),controller[_0x30d4('0xe')]);router[_0x30d4('0xf')](_0x30d4('0xb'),auth[_0x30d4('0x9')](),controller[_0x30d4('0x10')]);router[_0x30d4('0x11')](_0x30d4('0xb'),auth['isAuthenticated'](),controller[_0x30d4('0x12')]);module[_0x30d4('0x13')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 2be8549..38476b7 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 _0xb688=['STRING','INTEGER','BOOLEAN','setDataValue','crudPermissions','join','split','exports'];(function(_0x4dd2bc,_0x1068b0){var _0x271bc4=function(_0x2e249e){while(--_0x2e249e){_0x4dd2bc['push'](_0x4dd2bc['shift']());}};_0x271bc4(++_0x1068b0);}(_0xb688,0xcf));var _0x8b68=function(_0xc48deb,_0x3be5f4){_0xc48deb=_0xc48deb-0x0;var _0x5a4831=_0xb688[_0xc48deb];return _0x5a4831;};'use strict';var Sequelize=require('sequelize');module[_0x8b68('0x0')]={'name':{'type':Sequelize[_0x8b68('0x1')],'allowNull':![]},'category':{'type':Sequelize[_0x8b68('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x8b68('0x2')],'allowNull':![]},'enabled':{'type':Sequelize[_0x8b68('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x8b68('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x41030e){this[_0x8b68('0x4')](_0x8b68('0x5'),_0x41030e?_0x41030e[_0x8b68('0x6')](''):[]);},'get':function(){return this['getDataValue'](_0x8b68('0x5'))?this['getDataValue'](_0x8b68('0x5'))[_0x8b68('0x7')](''):[];}}}; \ No newline at end of file +var _0x63a5=['STRING','INTEGER','BOOLEAN','setDataValue','getDataValue','crudPermissions','sequelize','exports'];(function(_0x48b5e0,_0xb3826){var _0x4287ea=function(_0x14519e){while(--_0x14519e){_0x48b5e0['push'](_0x48b5e0['shift']());}};_0x4287ea(++_0xb3826);}(_0x63a5,0x18e));var _0x563a=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x63a5[_0x53ccf2];return _0x5a2964;};'use strict';var Sequelize=require(_0x563a('0x0'));module[_0x563a('0x1')]={'name':{'type':Sequelize[_0x563a('0x2')],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize[_0x563a('0x3')],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x563a('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x563a('0x2')],'set':function(_0x386400){this[_0x563a('0x5')]('crudPermissions',_0x386400?_0x386400['join'](''):[]);},'get':function(){return this[_0x563a('0x6')]('crudPermissions')?this[_0x563a('0x6')](_0x563a('0x7'))['split'](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 6fe86ee..b46b98b 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 _0x3054=['api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','send','index','map','rawAttributes','fieldName','key','model','name','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','UserProfileSection','includeAll','include','findAll','show','params','catch','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0xc1a7d3,_0x6ac180){var _0x576e8d=function(_0x46d9cb){while(--_0x46d9cb){_0xc1a7d3['push'](_0xc1a7d3['shift']());}};_0x576e8d(++_0x6ac180);}(_0x3054,0x87));var _0x4305=function(_0x2b46db,_0x27b86a){_0x2b46db=_0x2b46db-0x0;var _0x12a5fc=_0x3054[_0x2b46db];return _0x12a5fc;};'use strict';var emlformat=require(_0x4305('0x0'));var rimraf=require(_0x4305('0x1'));var zipdir=require(_0x4305('0x2'));var jsonpatch=require(_0x4305('0x3'));var rp=require(_0x4305('0x4'));var moment=require(_0x4305('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x4305('0x6'));var util=require('util');var path=require('path');var sox=require(_0x4305('0x7'));var csv=require(_0x4305('0x8'));var ejs=require(_0x4305('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4305('0xa'));var squel=require('squel');var crypto=require(_0x4305('0xb'));var jsforce=require(_0x4305('0xc'));var deskjs=require(_0x4305('0xd'));var toCsv=require(_0x4305('0x8'));var querystring=require(_0x4305('0xe'));var Papa=require('papaparse');var Redis=require(_0x4305('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x4305('0x10'));var hardwareService=require(_0x4305('0x11'));var logger=require(_0x4305('0x12'))(_0x4305('0x13'));var utils=require(_0x4305('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x4305('0x15'));var db=require(_0x4305('0x16'))['db'];function respondWithStatusCode(_0x4e5e5d,_0x2be2d2){_0x2be2d2=_0x2be2d2||0xcc;return function(_0x2ef926){if(_0x2ef926){return _0x4e5e5d[_0x4305('0x17')](_0x2be2d2);}return _0x4e5e5d[_0x4305('0x18')](_0x2be2d2)[_0x4305('0x19')]();};}function respondWithResult(_0x3b8229,_0x3f863b){_0x3f863b=_0x3f863b||0xc8;return function(_0x3a02ae){if(_0x3a02ae){return _0x3b8229[_0x4305('0x18')](_0x3f863b)[_0x4305('0x1a')](_0x3a02ae);}};}function respondWithFilteredResult(_0x2687c8,_0x73070c){return function(_0x125a7a){if(_0x125a7a){var _0x2f6a6e=typeof _0x73070c[_0x4305('0x1b')]===_0x4305('0x1c')&&typeof _0x73070c['limit']===_0x4305('0x1c');var _0x3903aa=_0x125a7a['count'];var _0x50429b=_0x2f6a6e?0x0:_0x73070c['offset'];var _0x3f9624=_0x2f6a6e?_0x125a7a[_0x4305('0x1d')]:_0x73070c[_0x4305('0x1b')]+_0x73070c['limit'];var _0x1be8cb;if(_0x3f9624>=_0x3903aa){_0x3f9624=_0x3903aa;_0x1be8cb=0xc8;}else{_0x1be8cb=0xce;}_0x2687c8[_0x4305('0x18')](_0x1be8cb);return _0x2687c8[_0x4305('0x1e')](_0x4305('0x1f'),_0x50429b+'-'+_0x3f9624+'/'+_0x3903aa)['json'](_0x125a7a);}return null;};}function patchUpdates(_0x130038){return function(_0x1fb798){try{jsonpatch[_0x4305('0x20')](_0x1fb798,_0x130038,!![]);}catch(_0x5850a2){return BPromise[_0x4305('0x21')](_0x5850a2);}return _0x1fb798[_0x4305('0x22')]();};}function saveUpdates(_0x2af7c3,_0x3521fa){return function(_0x3bbb27){if(_0x3bbb27){return _0x3bbb27[_0x4305('0x23')](_0x2af7c3)['then'](function(_0x37f9b8){return _0x37f9b8;});}return null;};}function removeEntity(_0x187b2f,_0x130aca){return function(_0x4194a4){if(_0x4194a4){return _0x4194a4[_0x4305('0x24')]()[_0x4305('0x25')](function(){_0x187b2f[_0x4305('0x18')](0xcc)[_0x4305('0x19')]();});}};}function handleEntityNotFound(_0x110dda,_0x40d160){return function(_0x3b6d6b){if(!_0x3b6d6b){_0x110dda[_0x4305('0x17')](0x194);}return _0x3b6d6b;};}function handleError(_0x23fbb2,_0x5cf7f2){_0x5cf7f2=_0x5cf7f2||0x1f4;return function(_0x333cf9){logger[_0x4305('0x26')](_0x333cf9[_0x4305('0x27')]);if(_0x333cf9['name']){delete _0x333cf9['name'];}_0x23fbb2[_0x4305('0x18')](_0x5cf7f2)[_0x4305('0x28')](_0x333cf9);};}exports[_0x4305('0x29')]=function(_0x18cce2,_0x9bc9c){var _0x1731f5={},_0x186d86={},_0x515b6b={'count':0x0,'rows':[]};var _0x1de460=_[_0x4305('0x2a')](db['UserProfileSection'][_0x4305('0x2b')],function(_0x536aab){return{'name':_0x536aab[_0x4305('0x2c')],'type':_0x536aab['type'][_0x4305('0x2d')]};});_0x186d86[_0x4305('0x2e')]=_[_0x4305('0x2a')](_0x1de460,_0x4305('0x2f'));_0x186d86[_0x4305('0x30')]=_[_0x4305('0x31')](_0x18cce2[_0x4305('0x30')]);_0x186d86['filters']=_['intersection'](_0x186d86[_0x4305('0x2e')],_0x186d86[_0x4305('0x30')]);_0x1731f5['attributes']=_[_0x4305('0x32')](_0x186d86[_0x4305('0x2e')],qs[_0x4305('0x33')](_0x18cce2[_0x4305('0x30')][_0x4305('0x33')]));_0x1731f5[_0x4305('0x34')]=_0x1731f5[_0x4305('0x34')][_0x4305('0x35')]?_0x1731f5['attributes']:_0x186d86[_0x4305('0x2e')];if(!_0x18cce2[_0x4305('0x30')][_0x4305('0x36')](_0x4305('0x37'))){_0x1731f5['limit']=qs['limit'](_0x18cce2[_0x4305('0x30')][_0x4305('0x38')]);_0x1731f5[_0x4305('0x1b')]=qs[_0x4305('0x1b')](_0x18cce2['query'][_0x4305('0x1b')]);}_0x1731f5[_0x4305('0x39')]=qs[_0x4305('0x3a')](_0x18cce2[_0x4305('0x30')][_0x4305('0x3a')]);_0x1731f5[_0x4305('0x3b')]=qs[_0x4305('0x3c')](_[_0x4305('0x3d')](_0x18cce2[_0x4305('0x30')],_0x186d86['filters']),_0x1de460);if(_0x18cce2['query'][_0x4305('0x3e')]){_0x1731f5[_0x4305('0x3b')]=_[_0x4305('0x3f')](_0x1731f5['where'],{'$or':_[_0x4305('0x2a')](_0x1de460,function(_0x531f58){if(_0x531f58['type']!==_0x4305('0x40')){var _0x4a424b={};_0x4a424b[_0x531f58[_0x4305('0x2f')]]={'$like':'%'+_0x18cce2[_0x4305('0x30')][_0x4305('0x3e')]+'%'};return _0x4a424b;}})});}_0x1731f5=_[_0x4305('0x3f')]({},_0x1731f5,_0x18cce2[_0x4305('0x41')]);var _0x2e9ae4={'where':_0x1731f5['where']};return db[_0x4305('0x42')]['count'](_0x2e9ae4)[_0x4305('0x25')](function(_0x47ce98){_0x515b6b[_0x4305('0x1d')]=_0x47ce98;if(_0x18cce2[_0x4305('0x30')][_0x4305('0x43')]){_0x1731f5[_0x4305('0x44')]=[{'all':!![]}];}return db['UserProfileSection'][_0x4305('0x45')](_0x1731f5);})[_0x4305('0x25')](function(_0x467732){_0x515b6b['rows']=_0x467732;return _0x515b6b;})[_0x4305('0x25')](respondWithFilteredResult(_0x9bc9c,_0x1731f5))['catch'](handleError(_0x9bc9c,null));};exports[_0x4305('0x46')]=function(_0x146fef,_0x36179a){var _0x4b12d1={'raw':![],'where':{'id':_0x146fef[_0x4305('0x47')]['id']}},_0x1f572c={};_0x1f572c[_0x4305('0x2e')]=_['keys'](db[_0x4305('0x42')][_0x4305('0x2b')]);_0x1f572c[_0x4305('0x30')]=_[_0x4305('0x31')](_0x146fef[_0x4305('0x30')]);_0x1f572c['filters']=_['intersection'](_0x1f572c['model'],_0x1f572c[_0x4305('0x30')]);_0x4b12d1['attributes']=_['intersection'](_0x1f572c[_0x4305('0x2e')],qs[_0x4305('0x33')](_0x146fef[_0x4305('0x30')][_0x4305('0x33')]));_0x4b12d1[_0x4305('0x34')]=_0x4b12d1['attributes']['length']?_0x4b12d1[_0x4305('0x34')]:_0x1f572c['model'];if(_0x146fef['query'][_0x4305('0x43')]){_0x4b12d1['include']=[{'all':!![]}];}_0x4b12d1=_[_0x4305('0x3f')]({},_0x4b12d1,_0x146fef['options']);return db[_0x4305('0x42')]['find'](_0x4b12d1)[_0x4305('0x25')](handleEntityNotFound(_0x36179a,null))[_0x4305('0x25')](respondWithResult(_0x36179a,null))[_0x4305('0x48')](handleError(_0x36179a,null));};exports[_0x4305('0x49')]=function(_0x2ea04c,_0x2990bf){return db[_0x4305('0x42')][_0x4305('0x49')](_0x2ea04c[_0x4305('0x4a')],{})[_0x4305('0x25')](respondWithResult(_0x2990bf,0xc9))[_0x4305('0x48')](handleError(_0x2990bf,null));};exports[_0x4305('0x23')]=function(_0x1750e4,_0x515bd7){if(_0x1750e4[_0x4305('0x4a')]['id']){delete _0x1750e4[_0x4305('0x4a')]['id'];}return db[_0x4305('0x42')][_0x4305('0x4b')]({'where':{'id':_0x1750e4[_0x4305('0x47')]['id']}})[_0x4305('0x25')](handleEntityNotFound(_0x515bd7,null))[_0x4305('0x25')](saveUpdates(_0x1750e4[_0x4305('0x4a')],null))[_0x4305('0x25')](respondWithResult(_0x515bd7,null))[_0x4305('0x48')](handleError(_0x515bd7,null));};exports[_0x4305('0x24')]=function(_0xd0eda4,_0x24fc55){return db[_0x4305('0x42')][_0x4305('0x4b')]({'where':{'id':_0xd0eda4[_0x4305('0x47')]['id']}})[_0x4305('0x25')](handleEntityNotFound(_0x24fc55,null))['then'](removeEntity(_0x24fc55,null))[_0x4305('0x48')](handleError(_0x24fc55,null));};exports[_0x4305('0x4c')]=function(_0x20354e,_0x28808a){return db[_0x4305('0x42')][_0x4305('0x4c')]()[_0x4305('0x25')](respondWithResult(_0x28808a,null))[_0x4305('0x48')](handleError(_0x28808a,null));}; \ No newline at end of file +var _0xda09=['query','keys','attributes','intersection','hasOwnProperty','nolimit','order','sort','where','filters','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','UserProfileSection','fields','length','find','create','body','params','eml-format','rimraf','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','end','json','offset','undefined','limit','count','status','set','apply','save','update','then','destroy','sendStatus','name','send','index','map','rawAttributes','fieldName','key','model'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xda09,0xa9));var _0x9da0=function(_0x42ca44,_0x526db0){_0x42ca44=_0x42ca44-0x0;var _0x396f9a=_0xda09[_0x42ca44];return _0x396f9a;};'use strict';var emlformat=require(_0x9da0('0x0'));var rimraf=require(_0x9da0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9da0('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x9da0('0x3'));var util=require(_0x9da0('0x4'));var path=require(_0x9da0('0x5'));var sox=require(_0x9da0('0x6'));var csv=require(_0x9da0('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9da0('0x8'));var _=require('lodash');var squel=require(_0x9da0('0x9'));var crypto=require(_0x9da0('0xa'));var jsforce=require(_0x9da0('0xb'));var deskjs=require(_0x9da0('0xc'));var toCsv=require('to-csv');var querystring=require(_0x9da0('0xd'));var Papa=require(_0x9da0('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x9da0('0xf'));var as=require(_0x9da0('0x10'));var hardwareService=require(_0x9da0('0x11'));var logger=require(_0x9da0('0x12'))(_0x9da0('0x13'));var utils=require('../../config/utils');var config=require(_0x9da0('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x9da0('0x15'))['db'];function respondWithStatusCode(_0xf3362b,_0x5a5d71){_0x5a5d71=_0x5a5d71||0xcc;return function(_0x257f76){if(_0x257f76){return _0xf3362b['sendStatus'](_0x5a5d71);}return _0xf3362b['status'](_0x5a5d71)[_0x9da0('0x16')]();};}function respondWithResult(_0x50fc2e,_0x4e5f4a){_0x4e5f4a=_0x4e5f4a||0xc8;return function(_0x55f46f){if(_0x55f46f){return _0x50fc2e['status'](_0x4e5f4a)[_0x9da0('0x17')](_0x55f46f);}};}function respondWithFilteredResult(_0x47c19c,_0x56ca75){return function(_0x21c810){if(_0x21c810){var _0x3871e3=typeof _0x56ca75[_0x9da0('0x18')]===_0x9da0('0x19')&&typeof _0x56ca75[_0x9da0('0x1a')]==='undefined';var _0x51122b=_0x21c810[_0x9da0('0x1b')];var _0x46d736=_0x3871e3?0x0:_0x56ca75[_0x9da0('0x18')];var _0x41e5ca=_0x3871e3?_0x21c810[_0x9da0('0x1b')]:_0x56ca75[_0x9da0('0x18')]+_0x56ca75[_0x9da0('0x1a')];var _0x21c512;if(_0x41e5ca>=_0x51122b){_0x41e5ca=_0x51122b;_0x21c512=0xc8;}else{_0x21c512=0xce;}_0x47c19c[_0x9da0('0x1c')](_0x21c512);return _0x47c19c[_0x9da0('0x1d')]('Content-Range',_0x46d736+'-'+_0x41e5ca+'/'+_0x51122b)[_0x9da0('0x17')](_0x21c810);}return null;};}function patchUpdates(_0xd8a85d){return function(_0x286f4d){try{jsonpatch[_0x9da0('0x1e')](_0x286f4d,_0xd8a85d,!![]);}catch(_0x2e19d5){return BPromise['reject'](_0x2e19d5);}return _0x286f4d[_0x9da0('0x1f')]();};}function saveUpdates(_0x2d0117,_0x46a5bd){return function(_0x5ce2ef){if(_0x5ce2ef){return _0x5ce2ef[_0x9da0('0x20')](_0x2d0117)[_0x9da0('0x21')](function(_0x1c9657){return _0x1c9657;});}return null;};}function removeEntity(_0x445d20,_0x237395){return function(_0x402265){if(_0x402265){return _0x402265[_0x9da0('0x22')]()[_0x9da0('0x21')](function(){_0x445d20[_0x9da0('0x1c')](0xcc)[_0x9da0('0x16')]();});}};}function handleEntityNotFound(_0x19e4e3,_0x46705e){return function(_0x592089){if(!_0x592089){_0x19e4e3[_0x9da0('0x23')](0x194);}return _0x592089;};}function handleError(_0x2a6e38,_0x444a15){_0x444a15=_0x444a15||0x1f4;return function(_0x1e2b8f){logger['error'](_0x1e2b8f['stack']);if(_0x1e2b8f[_0x9da0('0x24')]){delete _0x1e2b8f['name'];}_0x2a6e38['status'](_0x444a15)[_0x9da0('0x25')](_0x1e2b8f);};}exports[_0x9da0('0x26')]=function(_0x1465fa,_0x591768){var _0x3aba4d={},_0x7985bf={},_0x216b50={'count':0x0,'rows':[]};var _0x474e13=_[_0x9da0('0x27')](db['UserProfileSection'][_0x9da0('0x28')],function(_0x2e0503){return{'name':_0x2e0503[_0x9da0('0x29')],'type':_0x2e0503['type'][_0x9da0('0x2a')]};});_0x7985bf[_0x9da0('0x2b')]=_[_0x9da0('0x27')](_0x474e13,_0x9da0('0x24'));_0x7985bf[_0x9da0('0x2c')]=_[_0x9da0('0x2d')](_0x1465fa[_0x9da0('0x2c')]);_0x7985bf['filters']=_['intersection'](_0x7985bf[_0x9da0('0x2b')],_0x7985bf[_0x9da0('0x2c')]);_0x3aba4d[_0x9da0('0x2e')]=_[_0x9da0('0x2f')](_0x7985bf[_0x9da0('0x2b')],qs['fields'](_0x1465fa[_0x9da0('0x2c')]['fields']));_0x3aba4d[_0x9da0('0x2e')]=_0x3aba4d['attributes']['length']?_0x3aba4d['attributes']:_0x7985bf[_0x9da0('0x2b')];if(!_0x1465fa[_0x9da0('0x2c')][_0x9da0('0x30')](_0x9da0('0x31'))){_0x3aba4d[_0x9da0('0x1a')]=qs[_0x9da0('0x1a')](_0x1465fa[_0x9da0('0x2c')][_0x9da0('0x1a')]);_0x3aba4d[_0x9da0('0x18')]=qs[_0x9da0('0x18')](_0x1465fa[_0x9da0('0x2c')][_0x9da0('0x18')]);}_0x3aba4d[_0x9da0('0x32')]=qs[_0x9da0('0x33')](_0x1465fa[_0x9da0('0x2c')][_0x9da0('0x33')]);_0x3aba4d[_0x9da0('0x34')]=qs[_0x9da0('0x35')](_['pick'](_0x1465fa[_0x9da0('0x2c')],_0x7985bf['filters']),_0x474e13);if(_0x1465fa['query']['filter']){_0x3aba4d[_0x9da0('0x34')]=_[_0x9da0('0x36')](_0x3aba4d[_0x9da0('0x34')],{'$or':_[_0x9da0('0x27')](_0x474e13,function(_0x6d849c){if(_0x6d849c[_0x9da0('0x37')]!==_0x9da0('0x38')){var _0x717ab={};_0x717ab[_0x6d849c[_0x9da0('0x24')]]={'$like':'%'+_0x1465fa[_0x9da0('0x2c')]['filter']+'%'};return _0x717ab;}})});}_0x3aba4d=_[_0x9da0('0x36')]({},_0x3aba4d,_0x1465fa[_0x9da0('0x39')]);var _0x5979bd={'where':_0x3aba4d['where']};return db['UserProfileSection']['count'](_0x5979bd)[_0x9da0('0x21')](function(_0x22273e){_0x216b50[_0x9da0('0x1b')]=_0x22273e;if(_0x1465fa['query'][_0x9da0('0x3a')]){_0x3aba4d[_0x9da0('0x3b')]=[{'all':!![]}];}return db['UserProfileSection'][_0x9da0('0x3c')](_0x3aba4d);})[_0x9da0('0x21')](function(_0xebbd5d){_0x216b50[_0x9da0('0x3d')]=_0xebbd5d;return _0x216b50;})[_0x9da0('0x21')](respondWithFilteredResult(_0x591768,_0x3aba4d))[_0x9da0('0x3e')](handleError(_0x591768,null));};exports[_0x9da0('0x3f')]=function(_0x460743,_0x414f5d){var _0x3dd539={'raw':![],'where':{'id':_0x460743['params']['id']}},_0x27c84d={};_0x27c84d[_0x9da0('0x2b')]=_['keys'](db[_0x9da0('0x40')][_0x9da0('0x28')]);_0x27c84d['query']=_['keys'](_0x460743[_0x9da0('0x2c')]);_0x27c84d[_0x9da0('0x35')]=_[_0x9da0('0x2f')](_0x27c84d[_0x9da0('0x2b')],_0x27c84d[_0x9da0('0x2c')]);_0x3dd539[_0x9da0('0x2e')]=_[_0x9da0('0x2f')](_0x27c84d[_0x9da0('0x2b')],qs[_0x9da0('0x41')](_0x460743['query'][_0x9da0('0x41')]));_0x3dd539[_0x9da0('0x2e')]=_0x3dd539[_0x9da0('0x2e')][_0x9da0('0x42')]?_0x3dd539[_0x9da0('0x2e')]:_0x27c84d['model'];if(_0x460743[_0x9da0('0x2c')][_0x9da0('0x3a')]){_0x3dd539[_0x9da0('0x3b')]=[{'all':!![]}];}_0x3dd539=_['merge']({},_0x3dd539,_0x460743[_0x9da0('0x39')]);return db[_0x9da0('0x40')][_0x9da0('0x43')](_0x3dd539)[_0x9da0('0x21')](handleEntityNotFound(_0x414f5d,null))['then'](respondWithResult(_0x414f5d,null))[_0x9da0('0x3e')](handleError(_0x414f5d,null));};exports['create']=function(_0x54f300,_0x59c958){return db[_0x9da0('0x40')][_0x9da0('0x44')](_0x54f300[_0x9da0('0x45')],{})['then'](respondWithResult(_0x59c958,0xc9))['catch'](handleError(_0x59c958,null));};exports['update']=function(_0x1a70af,_0x571f91){if(_0x1a70af[_0x9da0('0x45')]['id']){delete _0x1a70af['body']['id'];}return db[_0x9da0('0x40')][_0x9da0('0x43')]({'where':{'id':_0x1a70af[_0x9da0('0x46')]['id']}})[_0x9da0('0x21')](handleEntityNotFound(_0x571f91,null))[_0x9da0('0x21')](saveUpdates(_0x1a70af['body'],null))['then'](respondWithResult(_0x571f91,null))[_0x9da0('0x3e')](handleError(_0x571f91,null));};exports[_0x9da0('0x22')]=function(_0x4b3b3d,_0x1c0526){return db[_0x9da0('0x40')][_0x9da0('0x43')]({'where':{'id':_0x4b3b3d[_0x9da0('0x46')]['id']}})[_0x9da0('0x21')](handleEntityNotFound(_0x1c0526,null))['then'](removeEntity(_0x1c0526,null))[_0x9da0('0x3e')](handleError(_0x1c0526,null));};exports['describe']=function(_0x533fcf,_0x38e8a4){return db[_0x9da0('0x40')]['describe']()[_0x9da0('0x21')](respondWithResult(_0x38e8a4,null))['catch'](handleError(_0x38e8a4,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index a3c4f63..a9caad3 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 _0xab17=['../../config/environment','exports','UserProfileSection','user_profile_has_sections','compositeIndex','sectionId','lodash','util','../../config/logger','api','moment','bluebird','rimraf'];(function(_0x325fa4,_0x1dcf06){var _0x5e20a2=function(_0x55036e){while(--_0x55036e){_0x325fa4['push'](_0x325fa4['shift']());}};_0x5e20a2(++_0x1dcf06);}(_0xab17,0x17f));var _0x7ab1=function(_0x2ea46f,_0x33cfea){_0x2ea46f=_0x2ea46f-0x0;var _0x5d40fd=_0xab17[_0x2ea46f];return _0x5d40fd;};'use strict';var _=require(_0x7ab1('0x0'));var util=require(_0x7ab1('0x1'));var logger=require(_0x7ab1('0x2'))(_0x7ab1('0x3'));var moment=require(_0x7ab1('0x4'));var BPromise=require(_0x7ab1('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7ab1('0x6'));var config=require(_0x7ab1('0x7'));var attributes=require('./userProfileSection.attributes');module[_0x7ab1('0x8')]=function(_0x52516c,_0x2fe6c8){return _0x52516c['define'](_0x7ab1('0x9'),attributes,{'tableName':_0x7ab1('0xa'),'paranoid':![],'indexes':[{'name':_0x7ab1('0xb'),'fields':[_0x7ab1('0xc'),'userProfileId']}],'timestamps':!![]});}; \ No newline at end of file +var _0x0d79=['../../config/logger','api','moment','bluebird','request-promise','path','./userProfileSection.attributes','exports','define','UserProfileSection','user_profile_has_sections','compositeIndex','sectionId','userProfileId','lodash','util'];(function(_0x50b37a,_0x538054){var _0xf9328=function(_0x54bbc7){while(--_0x54bbc7){_0x50b37a['push'](_0x50b37a['shift']());}};_0xf9328(++_0x538054);}(_0x0d79,0x6e));var _0x90d7=function(_0x21f2cf,_0x1417ea){_0x21f2cf=_0x21f2cf-0x0;var _0x50d69c=_0x0d79[_0x21f2cf];return _0x50d69c;};'use strict';var _=require(_0x90d7('0x0'));var util=require(_0x90d7('0x1'));var logger=require(_0x90d7('0x2'))(_0x90d7('0x3'));var moment=require(_0x90d7('0x4'));var BPromise=require(_0x90d7('0x5'));var rp=require(_0x90d7('0x6'));var fs=require('fs');var path=require(_0x90d7('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x90d7('0x8'));module[_0x90d7('0x9')]=function(_0x5dbac8,_0x165f83){return _0x5dbac8[_0x90d7('0xa')](_0x90d7('0xb'),attributes,{'tableName':_0x90d7('0xc'),'paranoid':![],'indexes':[{'name':_0x90d7('0xd'),'fields':[_0x90d7('0xe'),_0x90d7('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index d6debd7..29bad43 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 _0xb980=['ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','request','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring'];(function(_0x5923be,_0x3023ae){var _0x303700=function(_0x13d05c){while(--_0x13d05c){_0x5923be['push'](_0x5923be['shift']());}};_0x303700(++_0x3023ae);}(_0xb980,0xf9));var _0x0b98=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb980[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x0b98('0x0'));var util=require(_0x0b98('0x1'));var moment=require('moment');var BPromise=require(_0x0b98('0x2'));var rs=require(_0x0b98('0x3'));var fs=require('fs');var Redis=require(_0x0b98('0x4'));var db=require(_0x0b98('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0b98('0x6'))(_0x0b98('0x7'));var config=require('../../config/environment');var jayson=require(_0x0b98('0x8'));var client=jayson['client'][_0x0b98('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x326028,_0x10aa2a,_0x514c62){return new BPromise(function(_0x1274ee,_0x4f9455){return client[_0x0b98('0xa')](_0x326028,_0x514c62)[_0x0b98('0xb')](function(_0x2deebd){logger[_0x0b98('0xc')](_0x0b98('0xd'),_0x10aa2a,_0x0b98('0xe'));logger[_0x0b98('0xf')](_0x0b98('0x10'),_0x10aa2a,'request\x20sent',JSON[_0x0b98('0x11')](_0x2deebd));if(_0x2deebd[_0x0b98('0x12')]){if(_0x2deebd['error'][_0x0b98('0x13')]===0x1f4){logger[_0x0b98('0x12')](_0x0b98('0xd'),_0x10aa2a,_0x2deebd[_0x0b98('0x12')][_0x0b98('0x14')]);return _0x4f9455(_0x2deebd['error'][_0x0b98('0x14')]);}logger[_0x0b98('0x12')](_0x0b98('0xd'),_0x10aa2a,_0x2deebd[_0x0b98('0x12')][_0x0b98('0x14')]);return _0x1274ee(_0x2deebd[_0x0b98('0x12')][_0x0b98('0x14')]);}else{logger['info'](_0x0b98('0xd'),_0x10aa2a,_0x0b98('0xe'));_0x1274ee(_0x2deebd[_0x0b98('0x15')][_0x0b98('0x14')]);}})[_0x0b98('0x16')](function(_0x466a20){logger[_0x0b98('0x12')](_0x0b98('0xd'),_0x10aa2a,_0x466a20);_0x4f9455(_0x466a20);});});} \ No newline at end of file +var _0xa25d=['code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','request','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x5bf3ca,_0x49d7a9){var _0x315700=function(_0x5e50b6){while(--_0x5e50b6){_0x5bf3ca['push'](_0x5bf3ca['shift']());}};_0x315700(++_0x49d7a9);}(_0xa25d,0xca));var _0xda25=function(_0x421c11,_0xcf7560){_0x421c11=_0x421c11-0x0;var _0x317709=_0xa25d[_0x421c11];return _0x317709;};'use strict';var _=require(_0xda25('0x0'));var util=require(_0xda25('0x1'));var moment=require(_0xda25('0x2'));var BPromise=require('bluebird');var rs=require(_0xda25('0x3'));var fs=require('fs');var Redis=require(_0xda25('0x4'));var db=require(_0xda25('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xda25('0x6'));var config=require(_0xda25('0x7'));var jayson=require(_0xda25('0x8'));var client=jayson[_0xda25('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2d7bec,_0x33006e,_0x3b9286){return new BPromise(function(_0x15a1eb,_0x2d2aa8){return client[_0xda25('0xa')](_0x2d7bec,_0x3b9286)[_0xda25('0xb')](function(_0x595620){logger[_0xda25('0xc')](_0xda25('0xd'),_0x33006e,_0xda25('0xe'));logger[_0xda25('0xf')]('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x33006e,_0xda25('0xe'),JSON[_0xda25('0x10')](_0x595620));if(_0x595620[_0xda25('0x11')]){if(_0x595620['error'][_0xda25('0x12')]===0x1f4){logger['error'](_0xda25('0xd'),_0x33006e,_0x595620['error']['message']);return _0x2d2aa8(_0x595620[_0xda25('0x11')][_0xda25('0x13')]);}logger[_0xda25('0x11')](_0xda25('0xd'),_0x33006e,_0x595620['error']['message']);return _0x15a1eb(_0x595620[_0xda25('0x11')]['message']);}else{logger[_0xda25('0xc')](_0xda25('0xd'),_0x33006e,_0xda25('0xe'));_0x15a1eb(_0x595620[_0xda25('0x14')]['message']);}})[_0xda25('0x15')](function(_0x499392){logger[_0xda25('0x11')]('UserProfileSection,\x20%s,\x20%s',_0x33006e,_0x499392);_0x2d2aa8(_0x499392);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index febd055..5c52a65 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x267c3d,_0x23a5bd){var _0x3d7e69=function(_0x6f0cf){while(--_0x6f0cf){_0x267c3d['push'](_0x267c3d['shift']());}};_0x3d7e69(++_0x23a5bd);}(_0xe706,0xa3));var _0x6e70=function(_0x13b3f2,_0x1f230e){_0x13b3f2=_0x13b3f2-0x0;var _0x476495=_0xe706[_0x13b3f2];return _0x476495;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x4369c3,_0x43b3b0){var _0x464a8f=function(_0x509da1){while(--_0x509da1){_0x4369c3['push'](_0x4369c3['shift']());}};_0x464a8f(++_0x43b3b0);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x55e1d1,_0x3c9376){_0x55e1d1=_0x55e1d1-0x0;var _0x1165db=_0xcb91[_0x55e1d1];return _0x1165db;};'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 6cf7eb3..58ec2c7 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 _0xbf03=['INTEGER','sequelize'];(function(_0x15499e,_0x439ea4){var _0x576da6=function(_0x510cdc){while(--_0x510cdc){_0x15499e['push'](_0x15499e['shift']());}};_0x576da6(++_0x439ea4);}(_0xbf03,0x1e1));var _0x3bf0=function(_0xe041a7,_0xb8812f){_0xe041a7=_0xe041a7-0x0;var _0x4608cc=_0xbf03[_0xe041a7];return _0x4608cc;};'use strict';var Sequelize=require(_0x3bf0('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x3bf0('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xdbb3=['sequelize','exports','INTEGER'];(function(_0x33fda5,_0x11c4f6){var _0x48d0b6=function(_0x4bcdd6){while(--_0x4bcdd6){_0x33fda5['push'](_0x33fda5['shift']());}};_0x48d0b6(++_0x11c4f6);}(_0xdbb3,0x1c2));var _0x3dbb=function(_0x257642,_0x270a80){_0x257642=_0x257642-0x0;var _0x3d813b=_0xdbb3[_0x257642];return _0x3d813b;};'use strict';var Sequelize=require(_0x3dbb('0x0'));module[_0x3dbb('0x1')]={'penalty':{'type':Sequelize[_0x3dbb('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index 1d8a8bf..837262d 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 _0x5d0a=['user_has_sms_queues','lodash','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./userSmsQueue.attributes','exports','define','UserSmsQueue'];(function(_0x3e55ff,_0x579048){var _0x30ca1a=function(_0xa2642c){while(--_0xa2642c){_0x3e55ff['push'](_0x3e55ff['shift']());}};_0x30ca1a(++_0x579048);}(_0x5d0a,0x175));var _0xa5d0=function(_0x350ccf,_0x41e4cc){_0x350ccf=_0x350ccf-0x0;var _0x3cf8a3=_0x5d0a[_0x350ccf];return _0x3cf8a3;};'use strict';var _=require(_0xa5d0('0x0'));var util=require('util');var logger=require(_0xa5d0('0x1'))('api');var moment=require(_0xa5d0('0x2'));var BPromise=require(_0xa5d0('0x3'));var rp=require(_0xa5d0('0x4'));var fs=require('fs');var path=require(_0xa5d0('0x5'));var rimraf=require('rimraf');var config=require(_0xa5d0('0x6'));var attributes=require(_0xa5d0('0x7'));module[_0xa5d0('0x8')]=function(_0x1e90c4,_0x406289){return _0x1e90c4[_0xa5d0('0x9')](_0xa5d0('0xa'),attributes,{'tableName':_0xa5d0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6363=['define','UserSmsQueue','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userSmsQueue.attributes','exports'];(function(_0x20c0aa,_0x270220){var _0x61fb00=function(_0x2f9b3a){while(--_0x2f9b3a){_0x20c0aa['push'](_0x20c0aa['shift']());}};_0x61fb00(++_0x270220);}(_0x6363,0x13a));var _0x3636=function(_0x3e60d5,_0x545ca8){_0x3e60d5=_0x3e60d5-0x0;var _0x3c31e7=_0x6363[_0x3e60d5];return _0x3c31e7;};'use strict';var _=require(_0x3636('0x0'));var util=require('util');var logger=require(_0x3636('0x1'))(_0x3636('0x2'));var moment=require(_0x3636('0x3'));var BPromise=require(_0x3636('0x4'));var rp=require(_0x3636('0x5'));var fs=require('fs');var path=require(_0x3636('0x6'));var rimraf=require(_0x3636('0x7'));var config=require(_0x3636('0x8'));var attributes=require(_0x3636('0x9'));module[_0x3636('0xa')]=function(_0x15728f,_0x1f94ef){return _0x15728f[_0x3636('0xb')](_0x3636('0xc'),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 1c2bb2a..10ccbb1 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 _0xcee1=['then','info','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','error','code','UserSmsQueue,\x20%s,\x20%s','message','result','catch','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request'];(function(_0x2bcc58,_0x2ff8d4){var _0x31d9a5=function(_0x14ebfa){while(--_0x14ebfa){_0x2bcc58['push'](_0x2bcc58['shift']());}};_0x31d9a5(++_0x2ff8d4);}(_0xcee1,0x9e));var _0x1cee=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcee1[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1cee('0x0'));var fs=require('fs');var Redis=require(_0x1cee('0x1'));var db=require(_0x1cee('0x2'))['db'];var utils=require(_0x1cee('0x3'));var logger=require(_0x1cee('0x4'))(_0x1cee('0x5'));var config=require(_0x1cee('0x6'));var jayson=require(_0x1cee('0x7'));var client=jayson[_0x1cee('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1fc602,_0x31142a,_0xa9e0a4){return new BPromise(function(_0x3e6b26,_0x52845a){return client[_0x1cee('0x9')](_0x1fc602,_0xa9e0a4)[_0x1cee('0xa')](function(_0x90fdf5){logger[_0x1cee('0xb')]('UserSmsQueue,\x20%s,\x20%s',_0x31142a,_0x1cee('0xc'));logger[_0x1cee('0xd')](_0x1cee('0xe'),_0x31142a,_0x1cee('0xc'),JSON['stringify'](_0x90fdf5));if(_0x90fdf5['error']){if(_0x90fdf5[_0x1cee('0xf')][_0x1cee('0x10')]===0x1f4){logger[_0x1cee('0xf')](_0x1cee('0x11'),_0x31142a,_0x90fdf5[_0x1cee('0xf')][_0x1cee('0x12')]);return _0x52845a(_0x90fdf5[_0x1cee('0xf')][_0x1cee('0x12')]);}logger['error']('UserSmsQueue,\x20%s,\x20%s',_0x31142a,_0x90fdf5[_0x1cee('0xf')][_0x1cee('0x12')]);return _0x3e6b26(_0x90fdf5[_0x1cee('0xf')]['message']);}else{logger[_0x1cee('0xb')](_0x1cee('0x11'),_0x31142a,_0x1cee('0xc'));_0x3e6b26(_0x90fdf5[_0x1cee('0x13')][_0x1cee('0x12')]);}})[_0x1cee('0x14')](function(_0x377f0e){logger[_0x1cee('0xf')](_0x1cee('0x11'),_0x31142a,_0x377f0e);_0x52845a(_0x377f0e);});});} \ No newline at end of file +var _0x6976=['UserSmsQueue,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x207c3a,_0x3f7ced){var _0x4bc16a=function(_0x30bbfb){while(--_0x30bbfb){_0x207c3a['push'](_0x207c3a['shift']());}};_0x4bc16a(++_0x3f7ced);}(_0x6976,0x94));var _0x6697=function(_0x59c0bf,_0x4bb8dd){_0x59c0bf=_0x59c0bf-0x0;var _0x27f763=_0x6976[_0x59c0bf];return _0x27f763;};'use strict';var _=require('lodash');var util=require(_0x6697('0x0'));var moment=require(_0x6697('0x1'));var BPromise=require(_0x6697('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6697('0x3'));var db=require(_0x6697('0x4'))['db'];var utils=require(_0x6697('0x5'));var logger=require('../../config/logger')(_0x6697('0x6'));var config=require(_0x6697('0x7'));var jayson=require(_0x6697('0x8'));var client=jayson[_0x6697('0x9')][_0x6697('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x276440,_0x10207f,_0x305d33){return new BPromise(function(_0xd94080,_0x2b5084){return client[_0x6697('0xb')](_0x276440,_0x305d33)[_0x6697('0xc')](function(_0x12d1b6){logger[_0x6697('0xd')]('UserSmsQueue,\x20%s,\x20%s',_0x10207f,_0x6697('0xe'));logger[_0x6697('0xf')](_0x6697('0x10'),_0x10207f,'request\x20sent',JSON[_0x6697('0x11')](_0x12d1b6));if(_0x12d1b6['error']){if(_0x12d1b6[_0x6697('0x12')][_0x6697('0x13')]===0x1f4){logger[_0x6697('0x12')](_0x6697('0x14'),_0x10207f,_0x12d1b6[_0x6697('0x12')][_0x6697('0x15')]);return _0x2b5084(_0x12d1b6[_0x6697('0x12')]['message']);}logger[_0x6697('0x12')]('UserSmsQueue,\x20%s,\x20%s',_0x10207f,_0x12d1b6[_0x6697('0x12')][_0x6697('0x15')]);return _0xd94080(_0x12d1b6[_0x6697('0x12')][_0x6697('0x15')]);}else{logger[_0x6697('0xd')]('UserSmsQueue,\x20%s,\x20%s',_0x10207f,_0x6697('0xe'));_0xd94080(_0x12d1b6[_0x6697('0x16')][_0x6697('0x15')]);}})[_0x6697('0x17')](function(_0x5cacc2){logger[_0x6697('0x12')](_0x6697('0x14'),_0x10207f,_0x5cacc2);_0x2b5084(_0x5cacc2);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index 3f8d318..44c0b52 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 _0xfcbd=['sequelize','INTEGER'];(function(_0x35f85d,_0x1810c4){var _0x48a0d4=function(_0x52af94){while(--_0x52af94){_0x35f85d['push'](_0x35f85d['shift']());}};_0x48a0d4(++_0x1810c4);}(_0xfcbd,0x172));var _0xdfcb=function(_0x59ac3b,_0x1f7e06){_0x59ac3b=_0x59ac3b-0x0;var _0x366174=_0xfcbd[_0x59ac3b];return _0x366174;};'use strict';var Sequelize=require(_0xdfcb('0x0'));module['exports']={'UserId':{'type':Sequelize[_0xdfcb('0x1')]},'VoicePrefixId':{'type':Sequelize[_0xdfcb('0x1')]}}; \ No newline at end of file +var _0xe6b5=['exports','INTEGER','sequelize'];(function(_0x1445bd,_0x2f9f08){var _0x52d18=function(_0x3819f8){while(--_0x3819f8){_0x1445bd['push'](_0x1445bd['shift']());}};_0x52d18(++_0x2f9f08);}(_0xe6b5,0x15e));var _0x5e6b=function(_0x53c393,_0x2cd57a){_0x53c393=_0x53c393-0x0;var _0xc1ae94=_0xe6b5[_0x53c393];return _0xc1ae94;};'use strict';var Sequelize=require(_0x5e6b('0x0'));module[_0x5e6b('0x1')]={'UserId':{'type':Sequelize[_0x5e6b('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x5e6b('0x2')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index 23c51d5..57eaf1d 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(_0x5b6437,_0xb2f9dd){var _0x3a3afc=function(_0x3f8a8e){while(--_0x3f8a8e){_0x5b6437['push'](_0x5b6437['shift']());}};_0x3a3afc(++_0xb2f9dd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xa9e0[_0x49ca18];return _0x145d54;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'user_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['../../config/environment','./userVoicePrefix.attributes','exports','define','UserVoicePrefix','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x49bc80,_0x1a6618){var _0x1e991e=function(_0x4623eb){while(--_0x4623eb){_0x49bc80['push'](_0x49bc80['shift']());}};_0x1e991e(++_0x1a6618);}(_0xa9e0,0x123));var _0x0a9e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa9e0[_0x501510];return _0x1e6ee5;};'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 493e1ff..dd5d10b 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x5961d9,_0x440dab){var _0x35dbd1=function(_0x1d08f2){while(--_0x1d08f2){_0x5961d9['push'](_0x5961d9['shift']());}};_0x35dbd1(++_0x440dab);}(_0x70e0,0x17b));var _0x070e=function(_0xe1ef1d,_0x51c03b){_0xe1ef1d=_0xe1ef1d-0x0;var _0x650f6b=_0x70e0[_0xe1ef1d];return _0x650f6b;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x233d1b,_0x29b05f){var _0x351a6a=function(_0x5b3124){while(--_0x5b3124){_0x233d1b['push'](_0x233d1b['shift']());}};_0x351a6a(++_0x29b05f);}(_0xedd9,0xfc));var _0x9edd=function(_0x4d3287,_0xe83871){_0x4d3287=_0x4d3287-0x0;var _0x3e46fc=_0xedd9[_0x4d3287];return _0x3e46fc;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index e41f66f..6d76c86 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 _0xed39=['exports','INTEGER','sequelize'];(function(_0x9b6a5,_0x32fb13){var _0x11da45=function(_0x284eea){while(--_0x284eea){_0x9b6a5['push'](_0x9b6a5['shift']());}};_0x11da45(++_0x32fb13);}(_0xed39,0xa7));var _0x9ed3=function(_0x3098cc,_0xd0179c){_0x3098cc=_0x3098cc-0x0;var _0x5246e4=_0xed39[_0x3098cc];return _0x5246e4;};'use strict';var Sequelize=require(_0x9ed3('0x0'));module[_0x9ed3('0x1')]={'penalty':{'type':Sequelize[_0x9ed3('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x295e=['sequelize','exports','INTEGER'];(function(_0x3f3dbe,_0x53a140){var _0x32f74a=function(_0x27fd91){while(--_0x27fd91){_0x3f3dbe['push'](_0x3f3dbe['shift']());}};_0x32f74a(++_0x53a140);}(_0x295e,0x18c));var _0xe295=function(_0x2757d3,_0xccc660){_0x2757d3=_0x2757d3-0x0;var _0x363899=_0x295e[_0x2757d3];return _0x363899;};'use strict';var Sequelize=require(_0xe295('0x0'));module[_0xe295('0x1')]={'penalty':{'type':Sequelize[_0xe295('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index 745c71d..5afd6e6 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 _0x00fc=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','exports','define','user_has_voice_queues'];(function(_0x3355c4,_0x5b8ac1){var _0xcdccfc=function(_0x1fbb8c){while(--_0x1fbb8c){_0x3355c4['push'](_0x3355c4['shift']());}};_0xcdccfc(++_0x5b8ac1);}(_0x00fc,0x1ea));var _0xc00f=function(_0x1e4150,_0x55b02a){_0x1e4150=_0x1e4150-0x0;var _0x1ce3ee=_0x00fc[_0x1e4150];return _0x1ce3ee;};'use strict';var _=require('lodash');var util=require(_0xc00f('0x0'));var logger=require(_0xc00f('0x1'))(_0xc00f('0x2'));var moment=require('moment');var BPromise=require(_0xc00f('0x3'));var rp=require(_0xc00f('0x4'));var fs=require('fs');var path=require(_0xc00f('0x5'));var rimraf=require(_0xc00f('0x6'));var config=require('../../config/environment');var attributes=require('./userVoiceQueue.attributes');module[_0xc00f('0x7')]=function(_0x11955e,_0x207de2){return _0x11955e[_0xc00f('0x8')]('UserVoiceQueue',attributes,{'tableName':_0xc00f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x38f3=['define','UserVoiceQueue','user_has_voice_queues','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./userVoiceQueue.attributes'];(function(_0x38aa40,_0x995dd6){var _0x76fb8a=function(_0x2d0ac2){while(--_0x2d0ac2){_0x38aa40['push'](_0x38aa40['shift']());}};_0x76fb8a(++_0x995dd6);}(_0x38f3,0x1e4));var _0x338f=function(_0x423e15,_0x12b2b2){_0x423e15=_0x423e15-0x0;var _0x184279=_0x38f3[_0x423e15];return _0x184279;};'use strict';var _=require(_0x338f('0x0'));var util=require(_0x338f('0x1'));var logger=require(_0x338f('0x2'))(_0x338f('0x3'));var moment=require(_0x338f('0x4'));var BPromise=require(_0x338f('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x338f('0x6'));var rimraf=require(_0x338f('0x7'));var config=require(_0x338f('0x8'));var attributes=require(_0x338f('0x9'));module['exports']=function(_0x19e30a,_0x5afbf6){return _0x19e30a[_0x338f('0xa')](_0x338f('0xb'),attributes,{'tableName':_0x338f('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 486474f..0258363 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 _0xd3fa=['error','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0xd3fa,0x1b8));var _0xad3f=function(_0x347363,_0x4ce556){_0x347363=_0x347363-0x0;var _0x598819=_0xd3fa[_0x347363];return _0x598819;};'use strict';var _=require(_0xad3f('0x0'));var util=require(_0xad3f('0x1'));var moment=require('moment');var BPromise=require(_0xad3f('0x2'));var rs=require(_0xad3f('0x3'));var fs=require('fs');var Redis=require(_0xad3f('0x4'));var db=require(_0xad3f('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xad3f('0x6'));var config=require(_0xad3f('0x7'));var jayson=require(_0xad3f('0x8'));var client=jayson[_0xad3f('0x9')][_0xad3f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x528f03,_0x4e2723,_0x200147){return new BPromise(function(_0x21de91,_0x53c5a7){return client['request'](_0x528f03,_0x200147)[_0xad3f('0xb')](function(_0x1a8486){logger[_0xad3f('0xc')](_0xad3f('0xd'),_0x4e2723,_0xad3f('0xe'));logger['debug']('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x4e2723,_0xad3f('0xe'),JSON[_0xad3f('0xf')](_0x1a8486));if(_0x1a8486[_0xad3f('0x10')]){if(_0x1a8486['error']['code']===0x1f4){logger[_0xad3f('0x10')](_0xad3f('0xd'),_0x4e2723,_0x1a8486[_0xad3f('0x10')]['message']);return _0x53c5a7(_0x1a8486[_0xad3f('0x10')][_0xad3f('0x11')]);}logger[_0xad3f('0x10')](_0xad3f('0xd'),_0x4e2723,_0x1a8486[_0xad3f('0x10')][_0xad3f('0x11')]);return _0x21de91(_0x1a8486[_0xad3f('0x10')][_0xad3f('0x11')]);}else{logger[_0xad3f('0xc')](_0xad3f('0xd'),_0x4e2723,'request\x20sent');_0x21de91(_0x1a8486['result'][_0xad3f('0x11')]);}})[_0xad3f('0x12')](function(_0x30bd20){logger[_0xad3f('0x10')](_0xad3f('0xd'),_0x4e2723,_0x30bd20);_0x53c5a7(_0x30bd20);});});} \ No newline at end of file +var _0x206f=['info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then'];(function(_0x54dc1b,_0x4414d2){var _0x1fa39f=function(_0x4a4250){while(--_0x4a4250){_0x54dc1b['push'](_0x54dc1b['shift']());}};_0x1fa39f(++_0x4414d2);}(_0x206f,0x169));var _0xf206=function(_0x4e7600,_0x48966d){_0x4e7600=_0x4e7600-0x0;var _0x40d38f=_0x206f[_0x4e7600];return _0x40d38f;};'use strict';var _=require(_0xf206('0x0'));var util=require('util');var moment=require(_0xf206('0x1'));var BPromise=require(_0xf206('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf206('0x3'));var db=require(_0xf206('0x4'))['db'];var utils=require(_0xf206('0x5'));var logger=require(_0xf206('0x6'))(_0xf206('0x7'));var config=require(_0xf206('0x8'));var jayson=require(_0xf206('0x9'));var client=jayson[_0xf206('0xa')][_0xf206('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3f16c9,_0x49767d,_0x194391){return new BPromise(function(_0x400c23,_0x4c99ab){return client['request'](_0x3f16c9,_0x194391)[_0xf206('0xc')](function(_0x572734){logger[_0xf206('0xd')](_0xf206('0xe'),_0x49767d,_0xf206('0xf'));logger[_0xf206('0x10')]('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x49767d,'request\x20sent',JSON['stringify'](_0x572734));if(_0x572734[_0xf206('0x11')]){if(_0x572734[_0xf206('0x11')][_0xf206('0x12')]===0x1f4){logger[_0xf206('0x11')](_0xf206('0xe'),_0x49767d,_0x572734[_0xf206('0x11')][_0xf206('0x13')]);return _0x4c99ab(_0x572734[_0xf206('0x11')][_0xf206('0x13')]);}logger[_0xf206('0x11')]('UserVoiceQueue,\x20%s,\x20%s',_0x49767d,_0x572734[_0xf206('0x11')]['message']);return _0x400c23(_0x572734[_0xf206('0x11')][_0xf206('0x13')]);}else{logger[_0xf206('0xd')](_0xf206('0xe'),_0x49767d,'request\x20sent');_0x400c23(_0x572734[_0xf206('0x14')][_0xf206('0x13')]);}})[_0xf206('0x15')](function(_0x52e598){logger[_0xf206('0x11')](_0xf206('0xe'),_0x49767d,_0x52e598);_0x4c99ab(_0x52e598);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 1f17eb4..b33a8e0 100644 --- a/server/api/userVoiceQueueRt/index.js +++ b/server/api/userVoiceQueueRt/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x179c7e,_0x3c62ed){var _0xb2dcbb=function(_0x3829ff){while(--_0x3829ff){_0x179c7e['push'](_0x179c7e['shift']());}};_0xb2dcbb(++_0x3c62ed);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x4c58fd,_0x34e817){var _0x5eef21=function(_0x2a8b58){while(--_0x2a8b58){_0x4c58fd['push'](_0x4c58fd['shift']());}};_0x5eef21(++_0x34e817);}(_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'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 868e6b7..f6a6900 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 _0x982f=['STRING','queue_interface','exports','INTEGER','Required\x20by\x20Asterisk'];(function(_0x82d959,_0x2287e6){var _0x23db20=function(_0x330be1){while(--_0x330be1){_0x82d959['push'](_0x82d959['shift']());}};_0x23db20(++_0x2287e6);}(_0x982f,0x1b5));var _0xf982=function(_0x320f2b,_0x469bfd){_0x320f2b=_0x320f2b-0x0;var _0x2de381=_0x982f[_0x320f2b];return _0x2de381;};'use strict';var Sequelize=require('sequelize');module[_0xf982('0x0')]={'uniqueid':{'type':Sequelize[_0xf982('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0xf982('0x2')},'membername':{'type':Sequelize[_0xf982('0x3')],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize[_0xf982('0x1')],'allowNull':![]},'queue_name':{'type':Sequelize[_0xf982('0x3')],'allowNull':![],'unique':_0xf982('0x4'),'comment':_0xf982('0x2')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':'queue_interface','comment':_0xf982('0x2')},'penalty':{'type':Sequelize[_0xf982('0x1')](0xb),'defaultValue':0x0,'comment':_0xf982('0x2')},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0xf982('0x2')}}; \ No newline at end of file +var _0x0f50=['queue_interface','exports','INTEGER','Required\x20by\x20Asterisk','STRING'];(function(_0x3f0f60,_0x521048){var _0x3e955f=function(_0x1d9db8){while(--_0x1d9db8){_0x3f0f60['push'](_0x3f0f60['shift']());}};_0x3e955f(++_0x521048);}(_0x0f50,0x6f));var _0x00f5=function(_0x3b9ae3,_0x7f545e){_0x3b9ae3=_0x3b9ae3-0x0;var _0x2a0d41=_0x0f50[_0x3b9ae3];return _0x2a0d41;};'use strict';var Sequelize=require('sequelize');module[_0x00f5('0x0')]={'uniqueid':{'type':Sequelize[_0x00f5('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x00f5('0x2')},'membername':{'type':Sequelize[_0x00f5('0x3')],'allowNull':![],'comment':_0x00f5('0x2')},'UserId':{'type':Sequelize[_0x00f5('0x1')],'allowNull':![]},'queue_name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x00f5('0x4'),'comment':_0x00f5('0x2')},'VoiceQueueId':{'type':Sequelize[_0x00f5('0x1')],'allowNull':![]},'interface':{'type':Sequelize[_0x00f5('0x3')],'allowNull':![],'unique':'queue_interface','comment':_0x00f5('0x2')},'penalty':{'type':Sequelize[_0x00f5('0x1')](0xb),'defaultValue':0x0,'comment':_0x00f5('0x2')},'paused':{'type':Sequelize[_0x00f5('0x1')](0xb),'defaultValue':0x0,'comment':_0x00f5('0x2')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 691f192..57e9fcb 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 _0xd4f0=['../../mysqldb','UserVoiceQueueRt','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0xd4f0,0x15e));var _0x0d4f=function(_0xbf5e16,_0x146ce3){_0xbf5e16=_0xbf5e16-0x0;var _0x5975a5=_0xd4f0[_0xbf5e16];return _0x5975a5;};'use strict';var EventEmitter=require(_0x0d4f('0x0'));var UserVoiceQueueRt=require(_0x0d4f('0x1'))['db'][_0x0d4f('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0d4f('0x3'),'afterUpdate':_0x0d4f('0x4'),'afterDestroy':_0x0d4f('0x5')};function emitEvent(_0x2f05bc){return function(_0x47a6a9,_0x22d7f1,_0x2b9009){UserVoiceQueueRtEvents[_0x0d4f('0x6')](_0x2f05bc+':'+_0x47a6a9['id'],_0x47a6a9);UserVoiceQueueRtEvents[_0x0d4f('0x6')](_0x2f05bc,_0x47a6a9);_0x2b9009(null);};}for(var e in events){if(events[_0x0d4f('0x7')](e)){var event=events[e];UserVoiceQueueRt[_0x0d4f('0x8')](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x283a=['save','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','UserVoiceQueueRt','setMaxListeners'];(function(_0x3815f0,_0x1dd83c){var _0xeaa08b=function(_0x461e0d){while(--_0x461e0d){_0x3815f0['push'](_0x3815f0['shift']());}};_0xeaa08b(++_0x1dd83c);}(_0x283a,0x150));var _0xa283=function(_0xb24fad,_0xd58756){_0xb24fad=_0xb24fad-0x0;var _0x173226=_0x283a[_0xb24fad];return _0x173226;};'use strict';var EventEmitter=require(_0xa283('0x0'));var UserVoiceQueueRt=require(_0xa283('0x1'))['db'][_0xa283('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xa283('0x3')](0x0);var events={'afterCreate':_0xa283('0x4'),'afterUpdate':_0xa283('0x5'),'afterDestroy':_0xa283('0x6')};function emitEvent(_0x1cf23b){return function(_0xb8a01f,_0x557927,_0x435934){UserVoiceQueueRtEvents[_0xa283('0x7')](_0x1cf23b+':'+_0xb8a01f['id'],_0xb8a01f);UserVoiceQueueRtEvents[_0xa283('0x7')](_0x1cf23b,_0xb8a01f);_0x435934(null);};}for(var e in events){if(events[_0xa283('0x8')](e)){var event=events[e];UserVoiceQueueRt['hook'](e,emitEvent(event));}}module[_0xa283('0x9')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 76ef14d..ab5350d 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 _0x5675=['./userVoiceQueueRt.attributes','define','UserVoiceQueueRt','util','../../config/logger','request-promise','path','rimraf'];(function(_0x4186ae,_0x5548e5){var _0x31d4b0=function(_0xf394a9){while(--_0xf394a9){_0x4186ae['push'](_0x4186ae['shift']());}};_0x31d4b0(++_0x5548e5);}(_0x5675,0xe3));var _0x5567=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0x5675[_0x2e4aa2];return _0x5e6092;};'use strict';var _=require('lodash');var util=require(_0x5567('0x0'));var logger=require(_0x5567('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5567('0x2'));var fs=require('fs');var path=require(_0x5567('0x3'));var rimraf=require(_0x5567('0x4'));var config=require('../../config/environment');var attributes=require(_0x5567('0x5'));module['exports']=function(_0x45a022,_0x558187){return _0x45a022[_0x5567('0x6')](_0x5567('0x7'),attributes,{'tableName':'user_has_voice_queues_rt','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8c14=['exports','define','user_has_voice_queues_rt','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./userVoiceQueueRt.attributes'];(function(_0x4a920c,_0x54b35e){var _0x3f7c0c=function(_0x109aa2){while(--_0x109aa2){_0x4a920c['push'](_0x4a920c['shift']());}};_0x3f7c0c(++_0x54b35e);}(_0x8c14,0xff));var _0x48c1=function(_0x383cdb,_0x1470f9){_0x383cdb=_0x383cdb-0x0;var _0x379295=_0x8c14[_0x383cdb];return _0x379295;};'use strict';var _=require(_0x48c1('0x0'));var util=require(_0x48c1('0x1'));var logger=require('../../config/logger')(_0x48c1('0x2'));var moment=require(_0x48c1('0x3'));var BPromise=require(_0x48c1('0x4'));var rp=require(_0x48c1('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x48c1('0x6'));var config=require(_0x48c1('0x7'));var attributes=require(_0x48c1('0x8'));module[_0x48c1('0x9')]=function(_0xfaa511,_0x22fa5a){return _0xfaa511[_0x48c1('0xa')]('UserVoiceQueueRt',attributes,{'tableName':_0x48c1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js index a732740..b429bd0 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 _0x40e7=['stringify','error','code','UserVoiceQueueRt,\x20%s,\x20%s','message','result','catch','GetVoiceQueueRtPauses','findAll','options','raw','where','COUNT','sequelize','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','info','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s'];(function(_0x490cb2,_0x54a8a4){var _0x305401=function(_0x34ad0f){while(--_0x34ad0f){_0x490cb2['push'](_0x490cb2['shift']());}};_0x305401(++_0x54a8a4);}(_0x40e7,0x83));var _0x740e=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x40e7[_0x31e29a];return _0x32d892;};'use strict';var _=require(_0x740e('0x0'));var util=require(_0x740e('0x1'));var moment=require(_0x740e('0x2'));var BPromise=require(_0x740e('0x3'));var rs=require(_0x740e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x740e('0x5'))['db'];var utils=require(_0x740e('0x6'));var logger=require(_0x740e('0x7'))(_0x740e('0x8'));var config=require(_0x740e('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x740e('0xa')]({'port':0x232a});config[_0x740e('0xb')]=_[_0x740e('0xc')](config[_0x740e('0xb')],{'host':_0x740e('0xd'),'port':0x18eb});var socket=require(_0x740e('0xe'))(new Redis(config['redis']));require(_0x740e('0xf'))[_0x740e('0x10')](socket);function respondWithRpcPromise(_0x3c8ac6,_0x5081db,_0xe5a64b){return new BPromise(function(_0x3c5f87,_0x427ca5){return client['request'](_0x3c8ac6,_0xe5a64b)['then'](function(_0x1f8935){logger[_0x740e('0x11')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x5081db,_0x740e('0x12'));logger[_0x740e('0x13')](_0x740e('0x14'),_0x5081db,_0x740e('0x12'),JSON[_0x740e('0x15')](_0x1f8935));if(_0x1f8935[_0x740e('0x16')]){if(_0x1f8935['error'][_0x740e('0x17')]===0x1f4){logger[_0x740e('0x16')](_0x740e('0x18'),_0x5081db,_0x1f8935['error'][_0x740e('0x19')]);return _0x427ca5(_0x1f8935[_0x740e('0x16')][_0x740e('0x19')]);}logger[_0x740e('0x16')](_0x740e('0x18'),_0x5081db,_0x1f8935[_0x740e('0x16')][_0x740e('0x19')]);return _0x3c5f87(_0x1f8935[_0x740e('0x16')][_0x740e('0x19')]);}else{logger['info'](_0x740e('0x18'),_0x5081db,_0x740e('0x12'));_0x3c5f87(_0x1f8935[_0x740e('0x1a')][_0x740e('0x19')]);}})[_0x740e('0x1b')](function(_0x483cd0){logger[_0x740e('0x16')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x5081db,_0x483cd0);_0x427ca5(_0x483cd0);});});}exports[_0x740e('0x1c')]=function(_0x2cfa6c){var _0x647d29=this;return new Promise(function(_0x137e39,_0x42c22f){return db['UserVoiceQueueRt'][_0x740e('0x1d')]({'raw':_0x2cfa6c[_0x740e('0x1e')]?_0x2cfa6c['options'][_0x740e('0x1f')]===undefined?!![]:![]:!![],'where':_0x2cfa6c[_0x740e('0x1e')]?_0x2cfa6c[_0x740e('0x1e')][_0x740e('0x20')]||null:null,'attributes':[[db['sequelize']['fn'](_0x740e('0x21'),db[_0x740e('0x22')]['fn']('IF',db[_0x740e('0x22')][_0x740e('0x23')](_0x740e('0x24')))),_0x740e('0x25')]]})['then'](function(_0x5a69b5){logger['info'](_0x740e('0x1c'),_0x2cfa6c);logger[_0x740e('0x13')](_0x740e('0x1c'),_0x2cfa6c,JSON[_0x740e('0x15')](_0x5a69b5));_0x137e39(_0x5a69b5);})[_0x740e('0x1b')](function(_0x598950){logger[_0x740e('0x16')](_0x740e('0x1c'),_0x598950[_0x740e('0x19')],_0x2cfa6c);_0x42c22f(_0x647d29[_0x740e('0x16')](0x1f4,_0x598950[_0x740e('0x19')]));});});}; \ No newline at end of file +var _0xc051=['error','code','message','result','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','sequelize','COUNT','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','then','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','./userVoiceQueueRt.socket','register','request','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2d84ee,_0x27624d){var _0x148672=function(_0x39396f){while(--_0x39396f){_0x2d84ee['push'](_0x2d84ee['shift']());}};_0x148672(++_0x27624d);}(_0xc051,0xc8));var _0x1c05=function(_0x5ac2f9,_0x40298b){_0x5ac2f9=_0x5ac2f9-0x0;var _0x342cc3=_0xc051[_0x5ac2f9];return _0x342cc3;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1c05('0x0'));var BPromise=require(_0x1c05('0x1'));var rs=require(_0x1c05('0x2'));var fs=require('fs');var Redis=require(_0x1c05('0x3'));var db=require(_0x1c05('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1c05('0x5'))(_0x1c05('0x6'));var config=require('../../config/environment');var jayson=require(_0x1c05('0x7'));var client=jayson[_0x1c05('0x8')][_0x1c05('0x9')]({'port':0x232a});config[_0x1c05('0xa')]=_[_0x1c05('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x1c05('0xc'))(new Redis(config[_0x1c05('0xa')]));require(_0x1c05('0xd'))[_0x1c05('0xe')](socket);function respondWithRpcPromise(_0xad1f7a,_0x1d2cc5,_0x43556e){return new BPromise(function(_0x193692,_0x4bd341){return client[_0x1c05('0xf')](_0xad1f7a,_0x43556e)['then'](function(_0x1fb9b0){logger[_0x1c05('0x10')](_0x1c05('0x11'),_0x1d2cc5,_0x1c05('0x12'));logger[_0x1c05('0x13')](_0x1c05('0x14'),_0x1d2cc5,_0x1c05('0x12'),JSON[_0x1c05('0x15')](_0x1fb9b0));if(_0x1fb9b0[_0x1c05('0x16')]){if(_0x1fb9b0[_0x1c05('0x16')][_0x1c05('0x17')]===0x1f4){logger[_0x1c05('0x16')](_0x1c05('0x11'),_0x1d2cc5,_0x1fb9b0[_0x1c05('0x16')][_0x1c05('0x18')]);return _0x4bd341(_0x1fb9b0[_0x1c05('0x16')][_0x1c05('0x18')]);}logger[_0x1c05('0x16')](_0x1c05('0x11'),_0x1d2cc5,_0x1fb9b0[_0x1c05('0x16')][_0x1c05('0x18')]);return _0x193692(_0x1fb9b0[_0x1c05('0x16')][_0x1c05('0x18')]);}else{logger[_0x1c05('0x10')](_0x1c05('0x11'),_0x1d2cc5,_0x1c05('0x12'));_0x193692(_0x1fb9b0[_0x1c05('0x19')][_0x1c05('0x18')]);}})['catch'](function(_0x9e6337){logger[_0x1c05('0x16')](_0x1c05('0x11'),_0x1d2cc5,_0x9e6337);_0x4bd341(_0x9e6337);});});}exports[_0x1c05('0x1a')]=function(_0x3a99dc){var _0x5c917e=this;return new Promise(function(_0x37e7cb,_0x4224f9){return db[_0x1c05('0x1b')][_0x1c05('0x1c')]({'raw':_0x3a99dc[_0x1c05('0x1d')]?_0x3a99dc[_0x1c05('0x1d')][_0x1c05('0x1e')]===undefined?!![]:![]:!![],'where':_0x3a99dc[_0x1c05('0x1d')]?_0x3a99dc[_0x1c05('0x1d')]['where']||null:null,'attributes':[[db[_0x1c05('0x1f')]['fn'](_0x1c05('0x20'),db[_0x1c05('0x1f')]['fn']('IF',db[_0x1c05('0x1f')]['literal'](_0x1c05('0x21')))),_0x1c05('0x22')]]})[_0x1c05('0x23')](function(_0x5810ca){logger['info']('GetVoiceQueueRtPauses',_0x3a99dc);logger[_0x1c05('0x13')]('GetVoiceQueueRtPauses',_0x3a99dc,JSON['stringify'](_0x5810ca));_0x37e7cb(_0x5810ca);})[_0x1c05('0x24')](function(_0x25a01e){logger[_0x1c05('0x16')]('GetVoiceQueueRtPauses',_0x25a01e['message'],_0x3a99dc);_0x4224f9(_0x5c917e[_0x1c05('0x16')](0x1f4,_0x25a01e[_0x1c05('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 0312474..4d71fca 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 _0x737d=['length','userVoiceQueueRt:','./userVoiceQueueRt.events','save','removeListener','register'];(function(_0x532aef,_0x4e1065){var _0x11998c=function(_0x42f48a){while(--_0x42f48a){_0x532aef['push'](_0x532aef['shift']());}};_0x11998c(++_0x4e1065);}(_0x737d,0xbc));var _0xd737=function(_0x2024b8,_0x9bafab){_0x2024b8=_0x2024b8-0x0;var _0x3c5ace=_0x737d[_0x2024b8];return _0x3c5ace;};'use strict';var UserVoiceQueueRtEvents=require(_0xd737('0x0'));var events=[_0xd737('0x1'),'remove','update'];function createListener(_0x58b187,_0x47ae10){return function(_0x2e966e){_0x47ae10['emit'](_0x58b187,_0x2e966e);};}function removeListener(_0x2f8396,_0x4a19e0){return function(){UserVoiceQueueRtEvents[_0xd737('0x2')](_0x2f8396,_0x4a19e0);};}exports[_0xd737('0x3')]=function(_0x1cf86e){for(var _0x2e7d75=0x0,_0x46f559=events[_0xd737('0x4')];_0x2e7d75<_0x46f559;_0x2e7d75++){var _0x3a78be=events[_0x2e7d75];var _0xb077fb=createListener(_0xd737('0x5')+_0x3a78be,_0x1cf86e);UserVoiceQueueRtEvents['on'](_0x3a78be,_0xb077fb);}}; \ No newline at end of file +var _0x304b=['remove','update','emit','register','length','userVoiceQueueRt:','save'];(function(_0x13673e,_0x19ffa0){var _0x27f039=function(_0x5a1047){while(--_0x5a1047){_0x13673e['push'](_0x13673e['shift']());}};_0x27f039(++_0x19ffa0);}(_0x304b,0xfb));var _0xb304=function(_0x3a7d7c,_0x4f1d94){_0x3a7d7c=_0x3a7d7c-0x0;var _0x40e5c8=_0x304b[_0x3a7d7c];return _0x40e5c8;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=[_0xb304('0x0'),_0xb304('0x1'),_0xb304('0x2')];function createListener(_0x61902e,_0x2c36b9){return function(_0x1a54ea){_0x2c36b9[_0xb304('0x3')](_0x61902e,_0x1a54ea);};}function removeListener(_0xedd10a,_0x546729){return function(){UserVoiceQueueRtEvents['removeListener'](_0xedd10a,_0x546729);};}exports[_0xb304('0x4')]=function(_0x301a2e){for(var _0x1eef78=0x0,_0x3eb6e0=events[_0xb304('0x5')];_0x1eef78<_0x3eb6e0;_0x1eef78++){var _0xded429=events[_0x1eef78];var _0x1ce82e=createListener(_0xb304('0x6')+_0xded429,_0x301a2e);UserVoiceQueueRtEvents['on'](_0xded429,_0x1ce82e);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 856e039..d62f051 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x4458b3,_0x5e191b){var _0x4994e2=function(_0x405032){while(--_0x405032){_0x4458b3['push'](_0x4458b3['shift']());}};_0x4994e2(++_0x5e191b);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4c3ffe,_0x457374){_0x4c3ffe=_0x4c3ffe-0x0;var _0x28d3eb=_0xcb91[_0x4c3ffe];return _0x28d3eb;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x1cdf5b,_0x178f8f){var _0x37e4cc=function(_0x580450){while(--_0x580450){_0x1cdf5b['push'](_0x1cdf5b['shift']());}};_0x37e4cc(++_0x178f8f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xa9e0[_0x34bf97];return _0x292719;};'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 70354fe..496aba6 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 _0x2c79=['sequelize','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2c79,0x102));var _0x92c7=function(_0x33f0f9,_0x3c6430){_0x33f0f9=_0x33f0f9-0x0;var _0x2cd35f=_0x2c79[_0x33f0f9];return _0x2cd35f;};'use strict';var Sequelize=require(_0x92c7('0x0'));module[_0x92c7('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x7076=['INTEGER','sequelize'];(function(_0x3e7804,_0x121853){var _0x56efda=function(_0x1996f3){while(--_0x1996f3){_0x3e7804['push'](_0x3e7804['shift']());}};_0x56efda(++_0x121853);}(_0x7076,0x1b9));var _0x6707=function(_0x5134bc,_0x5eb834){_0x5134bc=_0x5134bc-0x0;var _0x3fb0ab=_0x7076[_0x5134bc];return _0x3fb0ab;};'use strict';var Sequelize=require(_0x6707('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x6707('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index 5580868..75d85a6 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 _0xb81e=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','UserWhatsappQueue','user_has_whatsapp_queues','lodash','util','../../config/logger','api','moment'];(function(_0x1d5987,_0x43b206){var _0x47bf64=function(_0x2542c5){while(--_0x2542c5){_0x1d5987['push'](_0x1d5987['shift']());}};_0x47bf64(++_0x43b206);}(_0xb81e,0x1ad));var _0xeb81=function(_0x187661,_0x18b11b){_0x187661=_0x187661-0x0;var _0x372a57=_0xb81e[_0x187661];return _0x372a57;};'use strict';var _=require(_0xeb81('0x0'));var util=require(_0xeb81('0x1'));var logger=require(_0xeb81('0x2'))(_0xeb81('0x3'));var moment=require(_0xeb81('0x4'));var BPromise=require(_0xeb81('0x5'));var rp=require(_0xeb81('0x6'));var fs=require('fs');var path=require(_0xeb81('0x7'));var rimraf=require(_0xeb81('0x8'));var config=require(_0xeb81('0x9'));var attributes=require('./userWhatsappQueue.attributes');module[_0xeb81('0xa')]=function(_0x42c550,_0x12adf5){return _0x42c550[_0xeb81('0xb')](_0xeb81('0xc'),attributes,{'tableName':_0xeb81('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf31d=['lodash','util','../../config/logger','moment','bluebird','../../config/environment','./userWhatsappQueue.attributes','exports','define','UserWhatsappQueue','user_has_whatsapp_queues'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf31d,0x9a));var _0xdf31=function(_0x8560d3,_0x26a504){_0x8560d3=_0x8560d3-0x0;var _0x33b1b5=_0xf31d[_0x8560d3];return _0x33b1b5;};'use strict';var _=require(_0xdf31('0x0'));var util=require(_0xdf31('0x1'));var logger=require(_0xdf31('0x2'))('api');var moment=require(_0xdf31('0x3'));var BPromise=require(_0xdf31('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xdf31('0x5'));var attributes=require(_0xdf31('0x6'));module[_0xdf31('0x7')]=function(_0x18dcc7,_0x122474){return _0x18dcc7[_0xdf31('0x8')](_0xdf31('0x9'),attributes,{'tableName':_0xdf31('0xa'),'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 d019692..ffaccd3 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 _0x5cf1=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','request\x20sent','stringify','error','UserWhatsappQueue,\x20%s,\x20%s','message','result','lodash','moment','bluebird','randomstring'];(function(_0x55528f,_0x4d225f){var _0x46500e=function(_0x233104){while(--_0x233104){_0x55528f['push'](_0x55528f['shift']());}};_0x46500e(++_0x4d225f);}(_0x5cf1,0x165));var _0x15cf=function(_0x2b35ca,_0x4943ce){_0x2b35ca=_0x2b35ca-0x0;var _0x68389e=_0x5cf1[_0x2b35ca];return _0x68389e;};'use strict';var _=require(_0x15cf('0x0'));var util=require('util');var moment=require(_0x15cf('0x1'));var BPromise=require(_0x15cf('0x2'));var rs=require(_0x15cf('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x15cf('0x4'))['db'];var utils=require(_0x15cf('0x5'));var logger=require(_0x15cf('0x6'))(_0x15cf('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x15cf('0x8')][_0x15cf('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x494558,_0x56e16c,_0x86a12e){return new BPromise(function(_0x4f29e4,_0xf035fa){return client[_0x15cf('0xa')](_0x494558,_0x86a12e)[_0x15cf('0xb')](function(_0x20f01d){logger[_0x15cf('0xc')]('UserWhatsappQueue,\x20%s,\x20%s',_0x56e16c,_0x15cf('0xd'));logger['debug']('UserWhatsappQueue,\x20%s,\x20%s,\x20%s',_0x56e16c,_0x15cf('0xd'),JSON[_0x15cf('0xe')](_0x20f01d));if(_0x20f01d[_0x15cf('0xf')]){if(_0x20f01d[_0x15cf('0xf')]['code']===0x1f4){logger['error'](_0x15cf('0x10'),_0x56e16c,_0x20f01d[_0x15cf('0xf')][_0x15cf('0x11')]);return _0xf035fa(_0x20f01d[_0x15cf('0xf')]['message']);}logger[_0x15cf('0xf')](_0x15cf('0x10'),_0x56e16c,_0x20f01d['error'][_0x15cf('0x11')]);return _0x4f29e4(_0x20f01d[_0x15cf('0xf')][_0x15cf('0x11')]);}else{logger['info'](_0x15cf('0x10'),_0x56e16c,_0x15cf('0xd'));_0x4f29e4(_0x20f01d[_0x15cf('0x12')][_0x15cf('0x11')]);}})['catch'](function(_0x5ebd4c){logger[_0x15cf('0xf')]('UserWhatsappQueue,\x20%s,\x20%s',_0x56e16c,_0x5ebd4c);_0xf035fa(_0x5ebd4c);});});} \ No newline at end of file +var _0x5854=['jayson/promise','request','then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x1e10c7,_0x2521d7){var _0x4ddd08=function(_0x5e76d3){while(--_0x5e76d3){_0x1e10c7['push'](_0x1e10c7['shift']());}};_0x4ddd08(++_0x2521d7);}(_0x5854,0x1c2));var _0x4585=function(_0x58df25,_0xb28c5f){_0x58df25=_0x58df25-0x0;var _0x2778ee=_0x5854[_0x58df25];return _0x2778ee;};'use strict';var _=require(_0x4585('0x0'));var util=require(_0x4585('0x1'));var moment=require(_0x4585('0x2'));var BPromise=require(_0x4585('0x3'));var rs=require(_0x4585('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4585('0x5'))['db'];var utils=require(_0x4585('0x6'));var logger=require(_0x4585('0x7'))(_0x4585('0x8'));var config=require(_0x4585('0x9'));var jayson=require(_0x4585('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x48b267,_0x263481,_0x3509a8){return new BPromise(function(_0x3d57f3,_0x26a666){return client[_0x4585('0xb')](_0x48b267,_0x3509a8)[_0x4585('0xc')](function(_0x145557){logger[_0x4585('0xd')](_0x4585('0xe'),_0x263481,_0x4585('0xf'));logger[_0x4585('0x10')](_0x4585('0x11'),_0x263481,_0x4585('0xf'),JSON[_0x4585('0x12')](_0x145557));if(_0x145557[_0x4585('0x13')]){if(_0x145557[_0x4585('0x13')]['code']===0x1f4){logger['error'](_0x4585('0xe'),_0x263481,_0x145557[_0x4585('0x13')][_0x4585('0x14')]);return _0x26a666(_0x145557['error'][_0x4585('0x14')]);}logger[_0x4585('0x13')]('UserWhatsappQueue,\x20%s,\x20%s',_0x263481,_0x145557['error']['message']);return _0x3d57f3(_0x145557[_0x4585('0x13')][_0x4585('0x14')]);}else{logger[_0x4585('0xd')](_0x4585('0xe'),_0x263481,'request\x20sent');_0x3d57f3(_0x145557[_0x4585('0x15')][_0x4585('0x14')]);}})[_0x4585('0x16')](function(_0x6bc12e){logger[_0x4585('0x13')](_0x4585('0xe'),_0x263481,_0x6bc12e);_0x26a666(_0x6bc12e);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index a555db7..d525260 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 _0x26bc=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./variable.controller','isAuthenticated','index','get','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','path'];(function(_0x135b26,_0x55cf7e){var _0x2170f7=function(_0x12b4a3){while(--_0x12b4a3){_0x135b26['push'](_0x135b26['shift']());}};_0x2170f7(++_0x55cf7e);}(_0x26bc,0x162));var _0xc26b=function(_0x2de182,_0x402b38){_0x2de182=_0x2de182-0x0;var _0x2e5854=_0x26bc[_0x2de182];return _0x2e5854;};'use strict';var multer=require(_0xc26b('0x0'));var util=require(_0xc26b('0x1'));var path=require(_0xc26b('0x2'));var timeout=require(_0xc26b('0x3'));var express=require(_0xc26b('0x4'));var router=express['Router']();var fs_extra=require(_0xc26b('0x5'));var auth=require(_0xc26b('0x6'));var interaction=require(_0xc26b('0x7'));var config=require('../../config/environment');var controller=require(_0xc26b('0x8'));router['get']('/',auth[_0xc26b('0x9')](),controller[_0xc26b('0xa')]);router[_0xc26b('0xb')]('/:id',auth[_0xc26b('0x9')](),controller[_0xc26b('0xc')]);router[_0xc26b('0xd')]('/',auth[_0xc26b('0x9')](),controller[_0xc26b('0xe')]);router[_0xc26b('0xf')](_0xc26b('0x10'),auth[_0xc26b('0x9')](),controller[_0xc26b('0x11')]);router[_0xc26b('0x12')]('/:id',auth[_0xc26b('0x9')](),controller[_0xc26b('0x13')]);module[_0xc26b('0x14')]=router; \ No newline at end of file +var _0xb079=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','get','index','isAuthenticated','create','put','/:id','update','delete','destroy','exports','util','path','connect-timeout'];(function(_0x486283,_0x3d4f06){var _0x8c94cb=function(_0x174861){while(--_0x174861){_0x486283['push'](_0x486283['shift']());}};_0x8c94cb(++_0x3d4f06);}(_0xb079,0x1c9));var _0x9b07=function(_0xe68e3f,_0x5edcf8){_0xe68e3f=_0xe68e3f-0x0;var _0xb6b653=_0xb079[_0xe68e3f];return _0xb6b653;};'use strict';var multer=require('multer');var util=require(_0x9b07('0x0'));var path=require(_0x9b07('0x1'));var timeout=require(_0x9b07('0x2'));var express=require(_0x9b07('0x3'));var router=express[_0x9b07('0x4')]();var fs_extra=require(_0x9b07('0x5'));var auth=require(_0x9b07('0x6'));var interaction=require(_0x9b07('0x7'));var config=require(_0x9b07('0x8'));var controller=require(_0x9b07('0x9'));router[_0x9b07('0xa')]('/',auth['isAuthenticated'](),controller[_0x9b07('0xb')]);router[_0x9b07('0xa')]('/:id',auth[_0x9b07('0xc')](),controller['show']);router['post']('/',auth[_0x9b07('0xc')](),controller[_0x9b07('0xd')]);router[_0x9b07('0xe')](_0x9b07('0xf'),auth['isAuthenticated'](),controller[_0x9b07('0x10')]);router[_0x9b07('0x11')](_0x9b07('0xf'),auth[_0x9b07('0xc')](),controller[_0x9b07('0x12')]);module[_0x9b07('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 06fbfae..64f01bb 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 _0x20fd=['exports','STRING','sequelize'];(function(_0x152449,_0x49f41d){var _0x5b58b2=function(_0x226c30){while(--_0x226c30){_0x152449['push'](_0x152449['shift']());}};_0x5b58b2(++_0x49f41d);}(_0x20fd,0x125));var _0xd20f=function(_0x1173d2,_0x4a1c6a){_0x1173d2=_0x1173d2-0x0;var _0x2c55ae=_0x20fd[_0x1173d2];return _0x2c55ae;};'use strict';var Sequelize=require(_0xd20f('0x0'));module[_0xd20f('0x1')]={'name':{'type':Sequelize[_0xd20f('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xd20f('0x2')]}}; \ No newline at end of file +var _0xb66c=['STRING','sequelize'];(function(_0x2af621,_0x243c1a){var _0x1b3f01=function(_0x41be05){while(--_0x41be05){_0x2af621['push'](_0x2af621['shift']());}};_0x1b3f01(++_0x243c1a);}(_0xb66c,0x175));var _0xcb66=function(_0x28cf6f,_0xdade93){_0x28cf6f=_0x28cf6f-0x0;var _0x2bb1dc=_0xb66c[_0x28cf6f];return _0x2bb1dc;};'use strict';var Sequelize=require(_0xcb66('0x0'));module['exports']={'name':{'type':Sequelize[_0xcb66('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xcb66('0x1')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 89a1e46..b05e383 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 _0x5881=['ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','then','get','Variables','status','error','stack','name','index','map','rawAttributes','fieldName','type','key','filters','intersection','model','query','fields','attributes','length','hasOwnProperty','sort','where','pick','VIRTUAL','filter','merge','Variable','include','findAll','rows','catch','show','keys','includeAll','options','find','create','body','user','role','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring'];(function(_0x4abf13,_0x28742a){var _0x27b0e5=function(_0x3a0aa5){while(--_0x3a0aa5){_0x4abf13['push'](_0x4abf13['shift']());}};_0x27b0e5(++_0x28742a);}(_0x5881,0x1ca));var _0x1588=function(_0x32cde2,_0x238559){_0x32cde2=_0x32cde2-0x0;var _0x10b4b0=_0x5881[_0x32cde2];return _0x10b4b0;};'use strict';var emlformat=require(_0x1588('0x0'));var rimraf=require(_0x1588('0x1'));var zipdir=require(_0x1588('0x2'));var jsonpatch=require(_0x1588('0x3'));var rp=require(_0x1588('0x4'));var moment=require(_0x1588('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1588('0x6'));var path=require(_0x1588('0x7'));var sox=require(_0x1588('0x8'));var csv=require(_0x1588('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1588('0xa'));var _=require(_0x1588('0xb'));var squel=require(_0x1588('0xc'));var crypto=require('crypto');var jsforce=require(_0x1588('0xd'));var deskjs=require(_0x1588('0xe'));var toCsv=require(_0x1588('0x9'));var querystring=require(_0x1588('0xf'));var Papa=require('papaparse');var Redis=require(_0x1588('0x10'));var authService=require(_0x1588('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1588('0x12'));var logger=require('../../config/logger')(_0x1588('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x1588('0x14'));var db=require(_0x1588('0x15'))['db'];function respondWithStatusCode(_0x25a331,_0x15c37e){_0x15c37e=_0x15c37e||0xcc;return function(_0x57a2b1){if(_0x57a2b1){return _0x25a331[_0x1588('0x16')](_0x15c37e);}return _0x25a331['status'](_0x15c37e)[_0x1588('0x17')]();};}function respondWithResult(_0xf467a0,_0x34092b){_0x34092b=_0x34092b||0xc8;return function(_0x67ed52){if(_0x67ed52){return _0xf467a0['status'](_0x34092b)[_0x1588('0x18')](_0x67ed52);}};}function respondWithFilteredResult(_0x2567da,_0x3f9be6){return function(_0x5637f6){if(_0x5637f6){var _0x17bc21=typeof _0x3f9be6[_0x1588('0x19')]===_0x1588('0x1a')&&typeof _0x3f9be6[_0x1588('0x1b')]==='undefined';var _0x142bb1=_0x5637f6[_0x1588('0x1c')];var _0x382b4d=_0x17bc21?0x0:_0x3f9be6['offset'];var _0x3ed628=_0x17bc21?_0x5637f6[_0x1588('0x1c')]:_0x3f9be6[_0x1588('0x19')]+_0x3f9be6[_0x1588('0x1b')];var _0x31f780;if(_0x3ed628>=_0x142bb1){_0x3ed628=_0x142bb1;_0x31f780=0xc8;}else{_0x31f780=0xce;}_0x2567da['status'](_0x31f780);return _0x2567da[_0x1588('0x1d')]('Content-Range',_0x382b4d+'-'+_0x3ed628+'/'+_0x142bb1)[_0x1588('0x18')](_0x5637f6);}return null;};}function patchUpdates(_0x493820){return function(_0x392223){try{jsonpatch[_0x1588('0x1e')](_0x392223,_0x493820,!![]);}catch(_0x587611){return BPromise[_0x1588('0x1f')](_0x587611);}return _0x392223[_0x1588('0x20')]();};}function saveUpdates(_0x552465,_0x1aec0a){return function(_0x2d2eea){if(_0x2d2eea){return _0x2d2eea[_0x1588('0x21')](_0x552465)['then'](function(_0x5e8647){return _0x5e8647;});}return null;};}function removeEntity(_0x51ce76,_0xe97392){return function(_0x16dca7){if(_0x16dca7){return _0x16dca7[_0x1588('0x22')]()[_0x1588('0x23')](function(){var _0x273f32=_0x16dca7[_0x1588('0x24')]({'plain':!![]});var _0x462806=_0x1588('0x25');return db['UserProfileResource']['destroy']({'where':{'type':_0x462806,'resourceId':_0x273f32['id']}})[_0x1588('0x23')](function(){return _0x16dca7;});})[_0x1588('0x23')](function(){_0x51ce76[_0x1588('0x26')](0xcc)[_0x1588('0x17')]();});}};}function handleEntityNotFound(_0x2d892e,_0x39d65a){return function(_0xf3721){if(!_0xf3721){_0x2d892e[_0x1588('0x16')](0x194);}return _0xf3721;};}function handleError(_0x120455,_0x135aca){_0x135aca=_0x135aca||0x1f4;return function(_0x155ede){logger[_0x1588('0x27')](_0x155ede[_0x1588('0x28')]);if(_0x155ede[_0x1588('0x29')]){delete _0x155ede[_0x1588('0x29')];}_0x120455['status'](_0x135aca)['send'](_0x155ede);};}exports[_0x1588('0x2a')]=function(_0x5bc6e0,_0x5acae4){var _0x37bca9={},_0x3edc9c={},_0x1d7a1e={'count':0x0,'rows':[]};var _0x3b27b1=_[_0x1588('0x2b')](db['Variable'][_0x1588('0x2c')],function(_0x415c08){return{'name':_0x415c08[_0x1588('0x2d')],'type':_0x415c08[_0x1588('0x2e')][_0x1588('0x2f')]};});_0x3edc9c['model']=_[_0x1588('0x2b')](_0x3b27b1,'name');_0x3edc9c['query']=_['keys'](_0x5bc6e0['query']);_0x3edc9c[_0x1588('0x30')]=_[_0x1588('0x31')](_0x3edc9c[_0x1588('0x32')],_0x3edc9c[_0x1588('0x33')]);_0x37bca9['attributes']=_['intersection'](_0x3edc9c[_0x1588('0x32')],qs[_0x1588('0x34')](_0x5bc6e0['query'][_0x1588('0x34')]));_0x37bca9[_0x1588('0x35')]=_0x37bca9[_0x1588('0x35')][_0x1588('0x36')]?_0x37bca9[_0x1588('0x35')]:_0x3edc9c['model'];if(!_0x5bc6e0[_0x1588('0x33')][_0x1588('0x37')]('nolimit')){_0x37bca9[_0x1588('0x1b')]=qs[_0x1588('0x1b')](_0x5bc6e0[_0x1588('0x33')][_0x1588('0x1b')]);_0x37bca9[_0x1588('0x19')]=qs[_0x1588('0x19')](_0x5bc6e0['query'][_0x1588('0x19')]);}_0x37bca9['order']=qs[_0x1588('0x38')](_0x5bc6e0['query'][_0x1588('0x38')]);_0x37bca9[_0x1588('0x39')]=qs[_0x1588('0x30')](_[_0x1588('0x3a')](_0x5bc6e0['query'],_0x3edc9c[_0x1588('0x30')]),_0x3b27b1);if(_0x5bc6e0['query']['filter']){_0x37bca9[_0x1588('0x39')]=_['merge'](_0x37bca9[_0x1588('0x39')],{'$or':_[_0x1588('0x2b')](_0x3b27b1,function(_0x5d8808){if(_0x5d8808[_0x1588('0x2e')]!==_0x1588('0x3b')){var _0x1da4d7={};_0x1da4d7[_0x5d8808[_0x1588('0x29')]]={'$like':'%'+_0x5bc6e0[_0x1588('0x33')][_0x1588('0x3c')]+'%'};return _0x1da4d7;}})});}_0x37bca9=_[_0x1588('0x3d')]({},_0x37bca9,_0x5bc6e0['options']);var _0x46721b={'where':_0x37bca9[_0x1588('0x39')]};return db[_0x1588('0x3e')][_0x1588('0x1c')](_0x46721b)[_0x1588('0x23')](function(_0x2eeef4){_0x1d7a1e[_0x1588('0x1c')]=_0x2eeef4;if(_0x5bc6e0[_0x1588('0x33')]['includeAll']){_0x37bca9[_0x1588('0x3f')]=[{'all':!![]}];}return db[_0x1588('0x3e')][_0x1588('0x40')](_0x37bca9);})['then'](function(_0x28d8b2){_0x1d7a1e[_0x1588('0x41')]=_0x28d8b2;return _0x1d7a1e;})['then'](respondWithFilteredResult(_0x5acae4,_0x37bca9))[_0x1588('0x42')](handleError(_0x5acae4,null));};exports[_0x1588('0x43')]=function(_0x83d96e,_0x54b0d8){var _0x59d12d={'raw':!![],'where':{'id':_0x83d96e['params']['id']}},_0xab49d2={};_0xab49d2[_0x1588('0x32')]=_['keys'](db['Variable'][_0x1588('0x2c')]);_0xab49d2[_0x1588('0x33')]=_[_0x1588('0x44')](_0x83d96e[_0x1588('0x33')]);_0xab49d2[_0x1588('0x30')]=_[_0x1588('0x31')](_0xab49d2['model'],_0xab49d2[_0x1588('0x33')]);_0x59d12d['attributes']=_[_0x1588('0x31')](_0xab49d2[_0x1588('0x32')],qs[_0x1588('0x34')](_0x83d96e[_0x1588('0x33')][_0x1588('0x34')]));_0x59d12d[_0x1588('0x35')]=_0x59d12d[_0x1588('0x35')][_0x1588('0x36')]?_0x59d12d[_0x1588('0x35')]:_0xab49d2[_0x1588('0x32')];if(_0x83d96e[_0x1588('0x33')][_0x1588('0x45')]){_0x59d12d[_0x1588('0x3f')]=[{'all':!![]}];}_0x59d12d=_['merge']({},_0x59d12d,_0x83d96e[_0x1588('0x46')]);return db[_0x1588('0x3e')][_0x1588('0x47')](_0x59d12d)[_0x1588('0x23')](handleEntityNotFound(_0x54b0d8,null))[_0x1588('0x23')](respondWithResult(_0x54b0d8,null))[_0x1588('0x42')](handleError(_0x54b0d8,null));};exports[_0x1588('0x48')]=function(_0x499678,_0x1a765e){return db[_0x1588('0x3e')][_0x1588('0x48')](_0x499678[_0x1588('0x49')],{})[_0x1588('0x23')](function(_0x334d6a){var _0x1f2be8=_0x499678[_0x1588('0x4a')][_0x1588('0x24')]({'plain':!![]});if(!_0x1f2be8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1f2be8[_0x1588('0x4b')]===_0x1588('0x4a')){var _0x5cefff=_0x334d6a[_0x1588('0x24')]({'plain':!![]});var _0x250eea=_0x1588('0x25');return db['UserProfileSection'][_0x1588('0x47')]({'where':{'name':_0x250eea,'userProfileId':_0x1f2be8[_0x1588('0x4c')]},'raw':!![]})[_0x1588('0x23')](function(_0x52e24a){if(_0x52e24a&&_0x52e24a['autoAssociation']===0x0){return db[_0x1588('0x4d')][_0x1588('0x48')]({'name':_0x5cefff[_0x1588('0x29')],'resourceId':_0x5cefff['id'],'type':_0x52e24a[_0x1588('0x29')],'sectionId':_0x52e24a['id']},{})[_0x1588('0x23')](function(){return _0x334d6a;});}else{return _0x334d6a;}})[_0x1588('0x42')](function(_0x402355){logger[_0x1588('0x27')](_0x1588('0x4e'),_0x402355);throw _0x402355;});}return _0x334d6a;})[_0x1588('0x23')](respondWithResult(_0x1a765e,0xc9))['catch'](handleError(_0x1a765e,null));};exports[_0x1588('0x21')]=function(_0x2c596c,_0xa9778d){if(_0x2c596c['body']['id']){delete _0x2c596c[_0x1588('0x49')]['id'];}return db[_0x1588('0x3e')]['find']({'where':{'id':_0x2c596c['params']['id']}})['then'](handleEntityNotFound(_0xa9778d,null))[_0x1588('0x23')](saveUpdates(_0x2c596c[_0x1588('0x49')],null))['then'](respondWithResult(_0xa9778d,null))['catch'](handleError(_0xa9778d,null));};exports[_0x1588('0x22')]=function(_0x82803d,_0x26ba8d){return db[_0x1588('0x3e')][_0x1588('0x47')]({'where':{'id':_0x82803d['params']['id']}})['then'](handleEntityNotFound(_0x26ba8d,null))[_0x1588('0x23')](removeEntity(_0x26ba8d,null))[_0x1588('0x42')](handleError(_0x26ba8d,null));}; \ No newline at end of file +var _0xba90=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','save','update','then','destroy','Variables','UserProfileResource','error','index','map','Variable','rawAttributes','fieldName','type','key','model','name','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','catch','show','params','includeAll','find','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0xba90,0x151));var _0x0ba9=function(_0x54669a,_0x46c23e){_0x54669a=_0x54669a-0x0;var _0x5a49fc=_0xba90[_0x54669a];return _0x5a49fc;};'use strict';var emlformat=require(_0x0ba9('0x0'));var rimraf=require(_0x0ba9('0x1'));var zipdir=require(_0x0ba9('0x2'));var jsonpatch=require(_0x0ba9('0x3'));var rp=require('request-promise');var moment=require(_0x0ba9('0x4'));var BPromise=require(_0x0ba9('0x5'));var Mustache=require(_0x0ba9('0x6'));var util=require('util');var path=require(_0x0ba9('0x7'));var sox=require(_0x0ba9('0x8'));var csv=require(_0x0ba9('0x9'));var ejs=require(_0x0ba9('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0ba9('0xb'));var squel=require(_0x0ba9('0xc'));var crypto=require(_0x0ba9('0xd'));var jsforce=require(_0x0ba9('0xe'));var deskjs=require(_0x0ba9('0xf'));var toCsv=require('to-csv');var querystring=require(_0x0ba9('0x10'));var Papa=require(_0x0ba9('0x11'));var Redis=require(_0x0ba9('0x12'));var authService=require(_0x0ba9('0x13'));var qs=require(_0x0ba9('0x14'));var as=require(_0x0ba9('0x15'));var hardwareService=require(_0x0ba9('0x16'));var logger=require(_0x0ba9('0x17'))(_0x0ba9('0x18'));var utils=require(_0x0ba9('0x19'));var config=require(_0x0ba9('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x0ba9('0x1b'))['db'];function respondWithStatusCode(_0x5351c2,_0x3706b7){_0x3706b7=_0x3706b7||0xcc;return function(_0x83fdb1){if(_0x83fdb1){return _0x5351c2[_0x0ba9('0x1c')](_0x3706b7);}return _0x5351c2[_0x0ba9('0x1d')](_0x3706b7)[_0x0ba9('0x1e')]();};}function respondWithResult(_0x4c330e,_0x5e2d29){_0x5e2d29=_0x5e2d29||0xc8;return function(_0xc20403){if(_0xc20403){return _0x4c330e[_0x0ba9('0x1d')](_0x5e2d29)[_0x0ba9('0x1f')](_0xc20403);}};}function respondWithFilteredResult(_0x537747,_0x43036e){return function(_0x254535){if(_0x254535){var _0x3a0536=typeof _0x43036e[_0x0ba9('0x20')]===_0x0ba9('0x21')&&typeof _0x43036e['limit']==='undefined';var _0x14eed6=_0x254535['count'];var _0x37ae3d=_0x3a0536?0x0:_0x43036e['offset'];var _0x226c38=_0x3a0536?_0x254535[_0x0ba9('0x22')]:_0x43036e[_0x0ba9('0x20')]+_0x43036e['limit'];var _0x32a433;if(_0x226c38>=_0x14eed6){_0x226c38=_0x14eed6;_0x32a433=0xc8;}else{_0x32a433=0xce;}_0x537747[_0x0ba9('0x1d')](_0x32a433);return _0x537747[_0x0ba9('0x23')](_0x0ba9('0x24'),_0x37ae3d+'-'+_0x226c38+'/'+_0x14eed6)['json'](_0x254535);}return null;};}function patchUpdates(_0x6af6b4){return function(_0x2ce168){try{jsonpatch[_0x0ba9('0x25')](_0x2ce168,_0x6af6b4,!![]);}catch(_0x52854b){return BPromise['reject'](_0x52854b);}return _0x2ce168[_0x0ba9('0x26')]();};}function saveUpdates(_0x38777e,_0x2f904f){return function(_0x39814e){if(_0x39814e){return _0x39814e[_0x0ba9('0x27')](_0x38777e)[_0x0ba9('0x28')](function(_0x920fa4){return _0x920fa4;});}return null;};}function removeEntity(_0x22da96,_0x5e8c62){return function(_0x39d1a4){if(_0x39d1a4){return _0x39d1a4[_0x0ba9('0x29')]()[_0x0ba9('0x28')](function(){var _0x37804e=_0x39d1a4['get']({'plain':!![]});var _0x2214de=_0x0ba9('0x2a');return db[_0x0ba9('0x2b')][_0x0ba9('0x29')]({'where':{'type':_0x2214de,'resourceId':_0x37804e['id']}})[_0x0ba9('0x28')](function(){return _0x39d1a4;});})[_0x0ba9('0x28')](function(){_0x22da96['status'](0xcc)[_0x0ba9('0x1e')]();});}};}function handleEntityNotFound(_0x2ae8fb,_0x179f59){return function(_0x56c0bc){if(!_0x56c0bc){_0x2ae8fb[_0x0ba9('0x1c')](0x194);}return _0x56c0bc;};}function handleError(_0x317a7d,_0x323622){_0x323622=_0x323622||0x1f4;return function(_0xc640ed){logger[_0x0ba9('0x2c')](_0xc640ed['stack']);if(_0xc640ed['name']){delete _0xc640ed['name'];}_0x317a7d['status'](_0x323622)['send'](_0xc640ed);};}exports[_0x0ba9('0x2d')]=function(_0x1b223c,_0x3395e1){var _0x33d08e={},_0x2643c6={},_0xfde7ad={'count':0x0,'rows':[]};var _0x2cdf6f=_[_0x0ba9('0x2e')](db[_0x0ba9('0x2f')][_0x0ba9('0x30')],function(_0xe67b26){return{'name':_0xe67b26[_0x0ba9('0x31')],'type':_0xe67b26[_0x0ba9('0x32')][_0x0ba9('0x33')]};});_0x2643c6[_0x0ba9('0x34')]=_['map'](_0x2cdf6f,_0x0ba9('0x35'));_0x2643c6['query']=_[_0x0ba9('0x36')](_0x1b223c[_0x0ba9('0x37')]);_0x2643c6[_0x0ba9('0x38')]=_[_0x0ba9('0x39')](_0x2643c6[_0x0ba9('0x34')],_0x2643c6['query']);_0x33d08e[_0x0ba9('0x3a')]=_[_0x0ba9('0x39')](_0x2643c6[_0x0ba9('0x34')],qs[_0x0ba9('0x3b')](_0x1b223c[_0x0ba9('0x37')][_0x0ba9('0x3b')]));_0x33d08e[_0x0ba9('0x3a')]=_0x33d08e['attributes'][_0x0ba9('0x3c')]?_0x33d08e[_0x0ba9('0x3a')]:_0x2643c6[_0x0ba9('0x34')];if(!_0x1b223c[_0x0ba9('0x37')][_0x0ba9('0x3d')](_0x0ba9('0x3e'))){_0x33d08e[_0x0ba9('0x3f')]=qs[_0x0ba9('0x3f')](_0x1b223c[_0x0ba9('0x37')][_0x0ba9('0x3f')]);_0x33d08e[_0x0ba9('0x20')]=qs[_0x0ba9('0x20')](_0x1b223c[_0x0ba9('0x37')][_0x0ba9('0x20')]);}_0x33d08e[_0x0ba9('0x40')]=qs[_0x0ba9('0x41')](_0x1b223c[_0x0ba9('0x37')][_0x0ba9('0x41')]);_0x33d08e[_0x0ba9('0x42')]=qs[_0x0ba9('0x38')](_[_0x0ba9('0x43')](_0x1b223c[_0x0ba9('0x37')],_0x2643c6[_0x0ba9('0x38')]),_0x2cdf6f);if(_0x1b223c[_0x0ba9('0x37')][_0x0ba9('0x44')]){_0x33d08e[_0x0ba9('0x42')]=_[_0x0ba9('0x45')](_0x33d08e[_0x0ba9('0x42')],{'$or':_[_0x0ba9('0x2e')](_0x2cdf6f,function(_0x5d5747){if(_0x5d5747[_0x0ba9('0x32')]!==_0x0ba9('0x46')){var _0x1a3b30={};_0x1a3b30[_0x5d5747[_0x0ba9('0x35')]]={'$like':'%'+_0x1b223c[_0x0ba9('0x37')][_0x0ba9('0x44')]+'%'};return _0x1a3b30;}})});}_0x33d08e=_['merge']({},_0x33d08e,_0x1b223c[_0x0ba9('0x47')]);var _0x426860={'where':_0x33d08e[_0x0ba9('0x42')]};return db['Variable'][_0x0ba9('0x22')](_0x426860)[_0x0ba9('0x28')](function(_0x2dca16){_0xfde7ad['count']=_0x2dca16;if(_0x1b223c[_0x0ba9('0x37')]['includeAll']){_0x33d08e[_0x0ba9('0x48')]=[{'all':!![]}];}return db['Variable']['findAll'](_0x33d08e);})['then'](function(_0x583ec1){_0xfde7ad[_0x0ba9('0x49')]=_0x583ec1;return _0xfde7ad;})['then'](respondWithFilteredResult(_0x3395e1,_0x33d08e))[_0x0ba9('0x4a')](handleError(_0x3395e1,null));};exports[_0x0ba9('0x4b')]=function(_0x359433,_0x291013){var _0x17ad76={'raw':!![],'where':{'id':_0x359433[_0x0ba9('0x4c')]['id']}},_0x51efe4={};_0x51efe4[_0x0ba9('0x34')]=_[_0x0ba9('0x36')](db[_0x0ba9('0x2f')][_0x0ba9('0x30')]);_0x51efe4[_0x0ba9('0x37')]=_[_0x0ba9('0x36')](_0x359433[_0x0ba9('0x37')]);_0x51efe4[_0x0ba9('0x38')]=_[_0x0ba9('0x39')](_0x51efe4[_0x0ba9('0x34')],_0x51efe4[_0x0ba9('0x37')]);_0x17ad76[_0x0ba9('0x3a')]=_[_0x0ba9('0x39')](_0x51efe4[_0x0ba9('0x34')],qs[_0x0ba9('0x3b')](_0x359433[_0x0ba9('0x37')][_0x0ba9('0x3b')]));_0x17ad76[_0x0ba9('0x3a')]=_0x17ad76[_0x0ba9('0x3a')]['length']?_0x17ad76[_0x0ba9('0x3a')]:_0x51efe4[_0x0ba9('0x34')];if(_0x359433[_0x0ba9('0x37')][_0x0ba9('0x4d')]){_0x17ad76[_0x0ba9('0x48')]=[{'all':!![]}];}_0x17ad76=_['merge']({},_0x17ad76,_0x359433[_0x0ba9('0x47')]);return db[_0x0ba9('0x2f')][_0x0ba9('0x4e')](_0x17ad76)[_0x0ba9('0x28')](handleEntityNotFound(_0x291013,null))[_0x0ba9('0x28')](respondWithResult(_0x291013,null))['catch'](handleError(_0x291013,null));};exports[_0x0ba9('0x4f')]=function(_0x2e28b8,_0xbe7fc2){return db[_0x0ba9('0x2f')][_0x0ba9('0x4f')](_0x2e28b8['body'],{})[_0x0ba9('0x28')](function(_0x2510cc){var _0x4f3ffd=_0x2e28b8['user'][_0x0ba9('0x50')]({'plain':!![]});if(!_0x4f3ffd)throw new Error(_0x0ba9('0x51'));if(_0x4f3ffd[_0x0ba9('0x52')]===_0x0ba9('0x53')){var _0x454443=_0x2510cc[_0x0ba9('0x50')]({'plain':!![]});var _0x41e700=_0x0ba9('0x2a');return db[_0x0ba9('0x54')][_0x0ba9('0x4e')]({'where':{'name':_0x41e700,'userProfileId':_0x4f3ffd[_0x0ba9('0x55')]},'raw':!![]})[_0x0ba9('0x28')](function(_0x23d239){if(_0x23d239&&_0x23d239[_0x0ba9('0x56')]===0x0){return db[_0x0ba9('0x2b')]['create']({'name':_0x454443[_0x0ba9('0x35')],'resourceId':_0x454443['id'],'type':_0x23d239[_0x0ba9('0x35')],'sectionId':_0x23d239['id']},{})[_0x0ba9('0x28')](function(){return _0x2510cc;});}else{return _0x2510cc;}})[_0x0ba9('0x4a')](function(_0x36698c){logger[_0x0ba9('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x36698c);throw _0x36698c;});}return _0x2510cc;})[_0x0ba9('0x28')](respondWithResult(_0xbe7fc2,0xc9))[_0x0ba9('0x4a')](handleError(_0xbe7fc2,null));};exports['update']=function(_0x4a8d13,_0x500132){if(_0x4a8d13[_0x0ba9('0x57')]['id']){delete _0x4a8d13[_0x0ba9('0x57')]['id'];}return db['Variable']['find']({'where':{'id':_0x4a8d13[_0x0ba9('0x4c')]['id']}})['then'](handleEntityNotFound(_0x500132,null))[_0x0ba9('0x28')](saveUpdates(_0x4a8d13[_0x0ba9('0x57')],null))[_0x0ba9('0x28')](respondWithResult(_0x500132,null))[_0x0ba9('0x4a')](handleError(_0x500132,null));};exports[_0x0ba9('0x29')]=function(_0x5bbb94,_0x46b2d7){return db[_0x0ba9('0x2f')][_0x0ba9('0x4e')]({'where':{'id':_0x5bbb94[_0x0ba9('0x4c')]['id']}})[_0x0ba9('0x28')](handleEntityNotFound(_0x46b2d7,null))['then'](removeEntity(_0x46b2d7,null))[_0x0ba9('0x4a')](handleError(_0x46b2d7,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 06cdb6a..c680b8f 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 _0xeabc=['path','rimraf','exports','define','tools_variables','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x22964c,_0x281f37){var _0x4eccca=function(_0x5b57e2){while(--_0x5b57e2){_0x22964c['push'](_0x22964c['shift']());}};_0x4eccca(++_0x281f37);}(_0xeabc,0x94));var _0xceab=function(_0x327f55,_0x2e1966){_0x327f55=_0x327f55-0x0;var _0x439a9b=_0xeabc[_0x327f55];return _0x439a9b;};'use strict';var _=require(_0xceab('0x0'));var util=require('util');var logger=require(_0xceab('0x1'))(_0xceab('0x2'));var moment=require(_0xceab('0x3'));var BPromise=require(_0xceab('0x4'));var rp=require(_0xceab('0x5'));var fs=require('fs');var path=require(_0xceab('0x6'));var rimraf=require(_0xceab('0x7'));var config=require('../../config/environment');var attributes=require('./variable.attributes');module[_0xceab('0x8')]=function(_0x572145,_0x7d1408){return _0x572145[_0xceab('0x9')]('Variable',attributes,{'tableName':_0xceab('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x13a8=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','Variable'];(function(_0x4dec3a,_0x2abfe8){var _0x2e23d1=function(_0x309bea){while(--_0x309bea){_0x4dec3a['push'](_0x4dec3a['shift']());}};_0x2e23d1(++_0x2abfe8);}(_0x13a8,0x197));var _0x813a=function(_0x4419fb,_0xba456){_0x4419fb=_0x4419fb-0x0;var _0x4eda5c=_0x13a8[_0x4419fb];return _0x4eda5c;};'use strict';var _=require(_0x813a('0x0'));var util=require(_0x813a('0x1'));var logger=require(_0x813a('0x2'))(_0x813a('0x3'));var moment=require(_0x813a('0x4'));var BPromise=require(_0x813a('0x5'));var rp=require(_0x813a('0x6'));var fs=require('fs');var path=require(_0x813a('0x7'));var rimraf=require(_0x813a('0x8'));var config=require('../../config/environment');var attributes=require('./variable.attributes');module[_0x813a('0x9')]=function(_0x209850,_0x2b5684){return _0x209850['define'](_0x813a('0xa'),attributes,{'tableName':'tools_variables','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 d1d256a..07ea2cc 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 _0x3e74=['catch','Variable','find','options','raw','where','attributes','include','map','model','then','ShowVariable','stringify','lodash','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','error','Variable,\x20%s,\x20%s','message','info'];(function(_0x340da7,_0x13d6fc){var _0x43b466=function(_0x59e11e){while(--_0x59e11e){_0x340da7['push'](_0x340da7['shift']());}};_0x43b466(++_0x13d6fc);}(_0x3e74,0x175));var _0x43e7=function(_0x48a184,_0x77d0b1){_0x48a184=_0x48a184-0x0;var _0x4c5ff6=_0x3e74[_0x48a184];return _0x4c5ff6;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var moment=require(_0x43e7('0x1'));var BPromise=require(_0x43e7('0x2'));var rs=require(_0x43e7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x43e7('0x4'));var logger=require('../../config/logger')(_0x43e7('0x5'));var config=require(_0x43e7('0x6'));var jayson=require(_0x43e7('0x7'));var client=jayson[_0x43e7('0x8')][_0x43e7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x503698,_0x45a0d1,_0x3491d6){return new BPromise(function(_0x2ede2d,_0x8528fc){return client[_0x43e7('0xa')](_0x503698,_0x3491d6)['then'](function(_0x212c6c){logger['info']('Variable,\x20%s,\x20%s',_0x45a0d1,_0x43e7('0xb'));logger[_0x43e7('0xc')]('Variable,\x20%s,\x20%s,\x20%s',_0x45a0d1,_0x43e7('0xb'),JSON['stringify'](_0x212c6c));if(_0x212c6c[_0x43e7('0xd')]){if(_0x212c6c[_0x43e7('0xd')]['code']===0x1f4){logger[_0x43e7('0xd')](_0x43e7('0xe'),_0x45a0d1,_0x212c6c[_0x43e7('0xd')][_0x43e7('0xf')]);return _0x8528fc(_0x212c6c['error']['message']);}logger[_0x43e7('0xd')](_0x43e7('0xe'),_0x45a0d1,_0x212c6c[_0x43e7('0xd')]['message']);return _0x2ede2d(_0x212c6c['error'][_0x43e7('0xf')]);}else{logger[_0x43e7('0x10')](_0x43e7('0xe'),_0x45a0d1,_0x43e7('0xb'));_0x2ede2d(_0x212c6c['result']['message']);}})[_0x43e7('0x11')](function(_0x264575){logger[_0x43e7('0xd')]('Variable,\x20%s,\x20%s',_0x45a0d1,_0x264575);_0x8528fc(_0x264575);});});}exports['ShowVariable']=function(_0x446986){var _0x1ca758=this;return new Promise(function(_0x9037d3,_0x140657){return db[_0x43e7('0x12')][_0x43e7('0x13')]({'raw':_0x446986[_0x43e7('0x14')]?_0x446986[_0x43e7('0x14')][_0x43e7('0x15')]===undefined?!![]:![]:!![],'where':_0x446986[_0x43e7('0x14')]?_0x446986[_0x43e7('0x14')][_0x43e7('0x16')]||null:null,'attributes':_0x446986['options']?_0x446986[_0x43e7('0x14')][_0x43e7('0x17')]||null:null,'include':_0x446986['options']?_0x446986[_0x43e7('0x14')][_0x43e7('0x18')]?_[_0x43e7('0x19')](_0x446986[_0x43e7('0x14')][_0x43e7('0x18')],function(_0x2f4cb4){return{'model':db[_0x2f4cb4['model']],'as':_0x2f4cb4['as'],'attributes':_0x2f4cb4[_0x43e7('0x17')],'include':_0x2f4cb4['include']?_['map'](_0x2f4cb4[_0x43e7('0x18')],function(_0x43f4ff){return{'model':db[_0x43f4ff['model']],'as':_0x43f4ff['as'],'attributes':_0x43f4ff[_0x43e7('0x17')],'include':_0x43f4ff['include']?_[_0x43e7('0x19')](_0x43f4ff['include'],function(_0x1af208){return{'model':db[_0x1af208[_0x43e7('0x1a')]],'as':_0x1af208['as'],'attributes':_0x1af208[_0x43e7('0x17')]};}):[]};}):[]};}):[]:[]})[_0x43e7('0x1b')](function(_0x51f4d7){logger['info'](_0x43e7('0x1c'),_0x446986);logger['debug'](_0x43e7('0x1c'),_0x446986,JSON[_0x43e7('0x1d')](_0x51f4d7));_0x9037d3(_0x51f4d7);})[_0x43e7('0x11')](function(_0xb1fc63){logger['error'](_0x43e7('0x1c'),_0xb1fc63[_0x43e7('0xf')],_0x446986);_0x140657(_0x1ca758[_0x43e7('0xd')](0x1f4,_0xb1fc63[_0x43e7('0xf')]));});});}; \ No newline at end of file +var _0x326f=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','Variable,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','ShowVariable','Variable','raw','options','include','model','attributes','map','then','stringify','lodash'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x326f,0xd1));var _0xf326=function(_0x17d761,_0x43503f){_0x17d761=_0x17d761-0x0;var _0x4ec52e=_0x326f[_0x17d761];return _0x4ec52e;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf326('0x1'));var rs=require(_0xf326('0x2'));var fs=require('fs');var Redis=require(_0xf326('0x3'));var db=require(_0xf326('0x4'))['db'];var utils=require(_0xf326('0x5'));var logger=require(_0xf326('0x6'))(_0xf326('0x7'));var config=require(_0xf326('0x8'));var jayson=require(_0xf326('0x9'));var client=jayson[_0xf326('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c254d,_0x3851eb,_0x165f95){return new BPromise(function(_0x1e7b8a,_0x515bfa){return client['request'](_0x3c254d,_0x165f95)['then'](function(_0x3bacf2){logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));logger[_0xf326('0xe')]('Variable,\x20%s,\x20%s,\x20%s',_0x3851eb,_0xf326('0xd'),JSON['stringify'](_0x3bacf2));if(_0x3bacf2[_0xf326('0xf')]){if(_0x3bacf2['error'][_0xf326('0x10')]===0x1f4){logger['error'](_0xf326('0xc'),_0x3851eb,_0x3bacf2[_0xf326('0xf')]['message']);return _0x515bfa(_0x3bacf2[_0xf326('0xf')][_0xf326('0x11')]);}logger[_0xf326('0xf')](_0xf326('0xc'),_0x3851eb,_0x3bacf2['error'][_0xf326('0x11')]);return _0x1e7b8a(_0x3bacf2['error']['message']);}else{logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));_0x1e7b8a(_0x3bacf2[_0xf326('0x12')][_0xf326('0x11')]);}})[_0xf326('0x13')](function(_0x34128e){logger[_0xf326('0xf')]('Variable,\x20%s,\x20%s',_0x3851eb,_0x34128e);_0x515bfa(_0x34128e);});});}exports[_0xf326('0x14')]=function(_0x453100){var _0x18bee3=this;return new Promise(function(_0x31ffb9,_0xcef2b5){return db[_0xf326('0x15')]['find']({'raw':_0x453100['options']?_0x453100['options'][_0xf326('0x16')]===undefined?!![]:![]:!![],'where':_0x453100[_0xf326('0x17')]?_0x453100['options']['where']||null:null,'attributes':_0x453100[_0xf326('0x17')]?_0x453100['options']['attributes']||null:null,'include':_0x453100[_0xf326('0x17')]?_0x453100[_0xf326('0x17')]['include']?_['map'](_0x453100[_0xf326('0x17')][_0xf326('0x18')],function(_0x5f21a2){return{'model':db[_0x5f21a2[_0xf326('0x19')]],'as':_0x5f21a2['as'],'attributes':_0x5f21a2[_0xf326('0x1a')],'include':_0x5f21a2[_0xf326('0x18')]?_[_0xf326('0x1b')](_0x5f21a2[_0xf326('0x18')],function(_0x2049ec){return{'model':db[_0x2049ec['model']],'as':_0x2049ec['as'],'attributes':_0x2049ec['attributes'],'include':_0x2049ec['include']?_[_0xf326('0x1b')](_0x2049ec[_0xf326('0x18')],function(_0x2cd45a){return{'model':db[_0x2cd45a[_0xf326('0x19')]],'as':_0x2cd45a['as'],'attributes':_0x2cd45a[_0xf326('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xf326('0x1c')](function(_0x5217d4){logger[_0xf326('0xb')](_0xf326('0x14'),_0x453100);logger[_0xf326('0xe')]('ShowVariable',_0x453100,JSON[_0xf326('0x1d')](_0x5217d4));_0x31ffb9(_0x5217d4);})['catch'](function(_0x4a9abf){logger[_0xf326('0xf')](_0xf326('0x14'),_0x4a9abf[_0xf326('0x11')],_0x453100);_0xcef2b5(_0x18bee3['error'](0x1f4,_0x4a9abf[_0xf326('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 4a2b642..8a0cb2f 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 _0xfbf7=['./version.controller','get','index','/fetch','isAuthenticated','fetch','/reset','canUpdate','reset','pull','restart','migrations','exports','express','Router','../../components/auth/service'];(function(_0x838813,_0x448f0f){var _0x2bd32d=function(_0x57b589){while(--_0x57b589){_0x838813['push'](_0x838813['shift']());}};_0x2bd32d(++_0x448f0f);}(_0xfbf7,0x16d));var _0x7fbf=function(_0x5265a8,_0x4c9b3c){_0x5265a8=_0x5265a8-0x0;var _0x9ef318=_0xfbf7[_0x5265a8];return _0x9ef318;};'use strict';var express=require(_0x7fbf('0x0'));var router=express[_0x7fbf('0x1')]();var auth=require(_0x7fbf('0x2'));var controller=require(_0x7fbf('0x3'));router[_0x7fbf('0x4')]('/',controller[_0x7fbf('0x5')]);router[_0x7fbf('0x4')](_0x7fbf('0x6'),auth[_0x7fbf('0x7')](),auth['canUpdate'](),controller[_0x7fbf('0x8')]);router['get'](_0x7fbf('0x9'),auth[_0x7fbf('0x7')](),auth[_0x7fbf('0xa')](),controller[_0x7fbf('0xb')]);router[_0x7fbf('0x4')]('/pull',auth[_0x7fbf('0x7')](),auth[_0x7fbf('0xa')](),controller[_0x7fbf('0xc')]);router['get']('/restart',auth[_0x7fbf('0x7')](),controller[_0x7fbf('0xd')]);router['get']('/migrations',controller[_0x7fbf('0xe')]);module[_0x7fbf('0xf')]=router; \ No newline at end of file +var _0x7519=['restart','migrations','express','get','index','isAuthenticated','fetch','/reset','reset','/pull','canUpdate','pull','/restart'];(function(_0x51f475,_0x17a3be){var _0x59f8c3=function(_0x5e2486){while(--_0x5e2486){_0x51f475['push'](_0x51f475['shift']());}};_0x59f8c3(++_0x17a3be);}(_0x7519,0xb8));var _0x9751=function(_0x4103fe,_0xf55e0e){_0x4103fe=_0x4103fe-0x0;var _0xd53a00=_0x7519[_0x4103fe];return _0xd53a00;};'use strict';var express=require(_0x9751('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require('./version.controller');router[_0x9751('0x1')]('/',controller[_0x9751('0x2')]);router[_0x9751('0x1')]('/fetch',auth[_0x9751('0x3')](),auth['canUpdate'](),controller[_0x9751('0x4')]);router[_0x9751('0x1')](_0x9751('0x5'),auth[_0x9751('0x3')](),auth['canUpdate'](),controller[_0x9751('0x6')]);router['get'](_0x9751('0x7'),auth[_0x9751('0x3')](),auth[_0x9751('0x8')](),controller[_0x9751('0x9')]);router[_0x9751('0x1')](_0x9751('0xa'),auth[_0x9751('0x3')](),controller[_0x9751('0xb')]);router['get']('/migrations',controller[_0x9751('0xc')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 712fab7..ab1dfb8 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 _0xd61d=['error','info','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','server','length','replace','.js','push','sequelize','Migration','getQueryInterface','map','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','join','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','version','compare-versions','child_process','exec','../../mysqldb','../../config/pm2','../../config/logger','update','root','index','exports','query','latest','tags','status','json','fetch'];(function(_0x4a0d07,_0x4b198a){var _0xfbce68=function(_0x2ef218){while(--_0x2ef218){_0x4a0d07['push'](_0x4a0d07['shift']());}};_0xfbce68(++_0x4b198a);}(_0xd61d,0x18c));var _0xdd61=function(_0x60072e,_0x3ce032){_0x60072e=_0x60072e-0x0;var _0x4920c3=_0xd61d[_0x60072e];return _0x4920c3;};'use strict';var Umzug=require(_0xdd61('0x0'));var path=require(_0xdd61('0x1'));var fs=require('fs');var _=require(_0xdd61('0x2'));var pkginfo=require('pkginfo')(module,_0xdd61('0x3'));var compareVersions=require(_0xdd61('0x4'));var exec=require(_0xdd61('0x5'))[_0xdd61('0x6')];var db=require(_0xdd61('0x7'))['db'];var config=require('../../config/environment');var pm2=require(_0xdd61('0x8'));var logger=require(_0xdd61('0x9'))(_0xdd61('0xa'));var git=require('simple-git')(config[_0xdd61('0xb')]);exports[_0xdd61('0xc')]=function(_0x4cff98,_0x5813e6){var _0x25e409={'current':module[_0xdd61('0xd')]['version'],'phonebar':0x2};if(_0x4cff98[_0xdd61('0xe')]&&_0x4cff98['query'][_0xdd61('0xf')]){return git['fetch']()[_0xdd61('0x10')](function(_0x2b0ca5,_0x321855){_0x25e409[_0xdd61('0xf')]=(_0x2b0ca5?module['exports'][_0xdd61('0x3')]:_0x321855[_0xdd61('0xf')])||'2.0.0';return _0x5813e6[_0xdd61('0x11')](0xc8)[_0xdd61('0x12')](_0x25e409);});}else{return _0x5813e6[_0xdd61('0x11')](0xc8)[_0xdd61('0x12')](_0x25e409);}};exports['fetch']=function(_0x4444bc,_0xe8f7c5){return git[_0xdd61('0x13')](['origin','master'],function(_0x26737d){if(_0x26737d){logger[_0xdd61('0x14')](_0x26737d);return _0xe8f7c5['status'](0x1f4)[_0xdd61('0x12')](_0x26737d);}logger[_0xdd61('0x15')]('git\x20fetch');return _0xe8f7c5['status'](0xc8)['json']({'output':_0xdd61('0x16')});});};exports[_0xdd61('0x17')]=function(_0x41534d,_0x3ed825){return git[_0xdd61('0x17')]([_0xdd61('0x18'),_0xdd61('0x19')],function(_0x1f1a56){if(_0x1f1a56){logger['error'](_0x1f1a56);return _0x3ed825[_0xdd61('0x11')](0x1f4)[_0xdd61('0x12')](_0x1f1a56);}logger[_0xdd61('0x15')](_0xdd61('0x1a'));return _0x3ed825[_0xdd61('0x11')](0xc8)[_0xdd61('0x12')]({'output':_0xdd61('0x1b')});});};exports[_0xdd61('0x1c')]=function(_0x21def3,_0x19eb77){exec('npm\x20install\x20--production',function(_0x4a8048,_0x152964,_0x4c7d82){logger['info'](_0x152964);logger[_0xdd61('0x15')](_0x4c7d82);if(_0x4a8048){logger[_0xdd61('0x14')](_0x4a8048);return _0x19eb77[_0xdd61('0x11')](0x1f4)[_0xdd61('0x12')](_0x4a8048);}return _0x19eb77['status'](0xc8)[_0xdd61('0x12')]({'output':_0x152964});});};exports[_0xdd61('0x1d')]=function(_0xd091ad,_0x71743f){return pm2[_0xdd61('0x1d')](_0xdd61('0x1e'))[_0xdd61('0x1f')](function(_0x2d980b){logger[_0xdd61('0x15')](_0xdd61('0x20'),_0x2d980b);return _0x71743f[_0xdd61('0x11')](0xc8)[_0xdd61('0x12')]({'output':_0xdd61('0x21')});})[_0xdd61('0x22')](function(_0x5c5a85){logger[_0xdd61('0x14')](_0x5c5a85);return _0x71743f['status'](0x1f4)[_0xdd61('0x12')](_0x5c5a85);});};exports[_0xdd61('0x23')]=function(_0x5b1cb1,_0x1247b6){var _0x342b3b=fs[_0xdd61('0x24')](path['join'](config[_0xdd61('0xb')],_0xdd61('0x25'),_0xdd61('0x23')));var _0xb69698=[];for(var _0x597f34=0x0;_0x597f34<_0x342b3b[_0xdd61('0x26')];_0x597f34++){var _0x242384=_0x342b3b[_0x597f34][_0xdd61('0x27')](_0xdd61('0x28'),'');if(compareVersions(module[_0xdd61('0xd')]['version'],_0x242384)===-0x1){_0xb69698[_0xdd61('0x29')](_0x242384);}}if(_0xb69698['length']){var _0x2d9621=_0xb69698['sort'](compareVersions);var _0x4ff00a=new Umzug({'storage':_0xdd61('0x2a'),'storageOptions':{'model':db[_0xdd61('0x2b')],'modelName':_0xdd61('0x2b'),'columnName':_0xdd61('0x3')},'migrations':{'params':[db[_0xdd61('0x2a')][_0xdd61('0x2c')](),db[_0xdd61('0x2a')]['constructor'],function(){throw new Error('Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.');}],'path':path['join'](config[_0xdd61('0xb')],_0xdd61('0x25'),_0xdd61('0x23')),'pattern':/\.js$/}});_0x4ff00a['up']({'migrations':_[_0xdd61('0x2d')](_0x2d9621,function(_0x30fafa){return _0x30fafa+_0xdd61('0x28');})})[_0xdd61('0x1f')](function(){return _0x1247b6[_0xdd61('0x11')](0xc8)['json']({'output':_0xdd61('0x2e')+module[_0xdd61('0xd')]['version']+_0xdd61('0x2f')+_[_0xdd61('0x30')](_0x2d9621),'migrations':_[_0xdd61('0x31')](_0x2d9621)});})[_0xdd61('0x22')](function(_0x293c6d){if(_0x293c6d instanceof db[_0xdd61('0x2a')][_0xdd61('0x32')]){return _0x1247b6[_0xdd61('0x11')](0xc8)['json']({'output':_0xdd61('0x33')});}else{return _0x1247b6['status'](0x1f4)[_0xdd61('0x12')](_0x293c6d);}});}else{return _0x1247b6[_0xdd61('0x11')](0xc8)[_0xdd61('0x12')]({'output':_0xdd61('0x33')});}}; \ No newline at end of file +var _0x3c57=['\x20to\x20','Database\x20already\x20up-to-date','path','lodash','child_process','exec','../../mysqldb','../../config/environment','update','simple-git','index','exports','version','query','latest','fetch','tags','status','json','origin','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','readdirSync','join','root','server','migrations','length','.js','push','sort','sequelize','Migration','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','Database\x20migrated\x20successfully\x20from\x20version\x20'];(function(_0x2867a6,_0x10d905){var _0x4afc2b=function(_0x457840){while(--_0x457840){_0x2867a6['push'](_0x2867a6['shift']());}};_0x4afc2b(++_0x10d905);}(_0x3c57,0x1c4));var _0x73c5=function(_0x57e2ec,_0x2fb0b2){_0x57e2ec=_0x57e2ec-0x0;var _0x13848b=_0x3c57[_0x57e2ec];return _0x13848b;};'use strict';var Umzug=require('umzug');var path=require(_0x73c5('0x0'));var fs=require('fs');var _=require(_0x73c5('0x1'));var pkginfo=require('pkginfo')(module,'version');var compareVersions=require('compare-versions');var exec=require(_0x73c5('0x2'))[_0x73c5('0x3')];var db=require(_0x73c5('0x4'))['db'];var config=require(_0x73c5('0x5'));var pm2=require('../../config/pm2');var logger=require('../../config/logger')(_0x73c5('0x6'));var git=require(_0x73c5('0x7'))(config['root']);exports[_0x73c5('0x8')]=function(_0x26a400,_0xcfbb32){var _0x5c9dd3={'current':module[_0x73c5('0x9')][_0x73c5('0xa')],'phonebar':0x2};if(_0x26a400[_0x73c5('0xb')]&&_0x26a400[_0x73c5('0xb')][_0x73c5('0xc')]){return git[_0x73c5('0xd')]()[_0x73c5('0xe')](function(_0xa36a3,_0xe2490b){_0x5c9dd3[_0x73c5('0xc')]=(_0xa36a3?module[_0x73c5('0x9')]['version']:_0xe2490b[_0x73c5('0xc')])||'2.0.0';return _0xcfbb32[_0x73c5('0xf')](0xc8)[_0x73c5('0x10')](_0x5c9dd3);});}else{return _0xcfbb32[_0x73c5('0xf')](0xc8)[_0x73c5('0x10')](_0x5c9dd3);}};exports[_0x73c5('0xd')]=function(_0x223a3e,_0x3bc1d3){return git[_0x73c5('0xd')]([_0x73c5('0x11'),'master'],function(_0x562ac8){if(_0x562ac8){logger[_0x73c5('0x12')](_0x562ac8);return _0x3bc1d3[_0x73c5('0xf')](0x1f4)['json'](_0x562ac8);}logger[_0x73c5('0x13')](_0x73c5('0x14'));return _0x3bc1d3['status'](0xc8)[_0x73c5('0x10')]({'output':_0x73c5('0x15')});});};exports[_0x73c5('0x16')]=function(_0xf818c5,_0x3d2e03){return git[_0x73c5('0x16')]([_0x73c5('0x17'),'FETCH_HEAD'],function(_0x28e758){if(_0x28e758){logger[_0x73c5('0x12')](_0x28e758);return _0x3d2e03[_0x73c5('0xf')](0x1f4)[_0x73c5('0x10')](_0x28e758);}logger['info'](_0x73c5('0x18'));return _0x3d2e03[_0x73c5('0xf')](0xc8)[_0x73c5('0x10')]({'output':_0x73c5('0x19')});});};exports[_0x73c5('0x1a')]=function(_0x7e81c2,_0x2e1e5d){exec('npm\x20install\x20--production',function(_0x387ff7,_0x3fc297,_0x547b26){logger['info'](_0x3fc297);logger['info'](_0x547b26);if(_0x387ff7){logger[_0x73c5('0x12')](_0x387ff7);return _0x2e1e5d[_0x73c5('0xf')](0x1f4)[_0x73c5('0x10')](_0x387ff7);}return _0x2e1e5d['status'](0xc8)['json']({'output':_0x3fc297});});};exports[_0x73c5('0x1b')]=function(_0xeb0318,_0x5b2612){return pm2[_0x73c5('0x1b')](_0x73c5('0x1c'))[_0x73c5('0x1d')](function(_0x1d7137){logger['info'](_0x73c5('0x1e'),_0x1d7137);return _0x5b2612[_0x73c5('0xf')](0xc8)['json']({'output':_0x73c5('0x1f')});})[_0x73c5('0x20')](function(_0x358d61){logger[_0x73c5('0x12')](_0x358d61);return _0x5b2612['status'](0x1f4)[_0x73c5('0x10')](_0x358d61);});};exports['migrations']=function(_0x2f0043,_0x25a10d){var _0xe4e2a1=fs[_0x73c5('0x21')](path[_0x73c5('0x22')](config[_0x73c5('0x23')],_0x73c5('0x24'),_0x73c5('0x25')));var _0x24bfa3=[];for(var _0x32de0b=0x0;_0x32de0b<_0xe4e2a1[_0x73c5('0x26')];_0x32de0b++){var _0x2c5e73=_0xe4e2a1[_0x32de0b]['replace'](_0x73c5('0x27'),'');if(compareVersions(module[_0x73c5('0x9')]['version'],_0x2c5e73)===-0x1){_0x24bfa3[_0x73c5('0x28')](_0x2c5e73);}}if(_0x24bfa3['length']){var _0x1e3dfa=_0x24bfa3[_0x73c5('0x29')](compareVersions);var _0x2044e9=new Umzug({'storage':_0x73c5('0x2a'),'storageOptions':{'model':db[_0x73c5('0x2b')],'modelName':_0x73c5('0x2b'),'columnName':'version'},'migrations':{'params':[db['sequelize'][_0x73c5('0x2c')](),db[_0x73c5('0x2a')][_0x73c5('0x2d')],function(){throw new Error(_0x73c5('0x2e'));}],'path':path[_0x73c5('0x22')](config[_0x73c5('0x23')],_0x73c5('0x24'),_0x73c5('0x25')),'pattern':/\.js$/}});_0x2044e9['up']({'migrations':_['map'](_0x1e3dfa,function(_0x46cc5a){return _0x46cc5a+'.js';})})[_0x73c5('0x1d')](function(){return _0x25a10d[_0x73c5('0xf')](0xc8)[_0x73c5('0x10')]({'output':_0x73c5('0x2f')+module['exports']['version']+_0x73c5('0x30')+_['last'](_0x1e3dfa),'migrations':_[_0x73c5('0x22')](_0x1e3dfa)});})[_0x73c5('0x20')](function(_0x57430c){if(_0x57430c instanceof db[_0x73c5('0x2a')]['UniqueConstraintError']){return _0x25a10d[_0x73c5('0xf')](0xc8)[_0x73c5('0x10')]({'output':_0x73c5('0x31')});}else{return _0x25a10d[_0x73c5('0xf')](0x1f4)['json'](_0x57430c);}});}else{return _0x25a10d[_0x73c5('0xf')](0xc8)[_0x73c5('0x10')]({'output':_0x73c5('0x31')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 5728f35..4db43ba 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 _0xbeba=['describe','/:id','show','post','create','update','delete','destroy','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xbeba,0x7a));var _0xabeb=function(_0x393855,_0x320ac8){_0x393855=_0x393855-0x0;var _0x16cee3=_0xbeba[_0x393855];return _0x16cee3;};'use strict';var multer=require(_0xabeb('0x0'));var util=require('util');var path=require(_0xabeb('0x1'));var timeout=require('connect-timeout');var express=require(_0xabeb('0x2'));var router=express[_0xabeb('0x3')]();var fs_extra=require(_0xabeb('0x4'));var auth=require(_0xabeb('0x5'));var interaction=require(_0xabeb('0x6'));var config=require(_0xabeb('0x7'));var controller=require('./voiceAgentReport.controller');router[_0xabeb('0x8')]('/',auth['isAuthenticated'](),controller[_0xabeb('0x9')]);router[_0xabeb('0x8')]('/describe',auth[_0xabeb('0xa')](),controller[_0xabeb('0xb')]);router[_0xabeb('0x8')](_0xabeb('0xc'),auth[_0xabeb('0xa')](),controller[_0xabeb('0xd')]);router[_0xabeb('0xe')]('/',auth[_0xabeb('0xa')](),controller[_0xabeb('0xf')]);router['put'](_0xabeb('0xc'),auth['isAuthenticated'](),controller[_0xabeb('0x10')]);router[_0xabeb('0x11')]('/:id',auth[_0xabeb('0xa')](),controller[_0xabeb('0x12')]);module['exports']=router; \ No newline at end of file +var _0xa5fd=['describe','get','/:id','post','put','update','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index'];(function(_0x2e84ee,_0x283c59){var _0x5c82d0=function(_0x9cf8ca){while(--_0x9cf8ca){_0x2e84ee['push'](_0x2e84ee['shift']());}};_0x5c82d0(++_0x283c59);}(_0xa5fd,0x106));var _0xda5f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa5fd[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0xda5f('0x0'));var path=require(_0xda5f('0x1'));var timeout=require(_0xda5f('0x2'));var express=require(_0xda5f('0x3'));var router=express[_0xda5f('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xda5f('0x5'));var interaction=require(_0xda5f('0x6'));var config=require(_0xda5f('0x7'));var controller=require('./voiceAgentReport.controller');router['get']('/',auth[_0xda5f('0x8')](),controller[_0xda5f('0x9')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0xda5f('0xa')]);router[_0xda5f('0xb')](_0xda5f('0xc'),auth[_0xda5f('0x8')](),controller['show']);router[_0xda5f('0xd')]('/',auth[_0xda5f('0x8')](),controller['create']);router[_0xda5f('0xe')](_0xda5f('0xc'),auth[_0xda5f('0x8')](),controller[_0xda5f('0xf')]);router['delete'](_0xda5f('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0xda5f('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 7b8fe7b..7912fbb 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 _0x1c52=['STRING','DATE','BOOLEAN','INTEGER','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports'];(function(_0x4c4037,_0x15054b){var _0x357862=function(_0x480015){while(--_0x480015){_0x4c4037['push'](_0x4c4037['shift']());}};_0x357862(++_0x15054b);}(_0x1c52,0x7c));var _0x21c5=function(_0x3c7475,_0x24f8df){_0x3c7475=_0x3c7475-0x0;var _0x2f3a8d=_0x1c52[_0x3c7475];return _0x2f3a8d;};'use strict';var Sequelize=require(_0x21c5('0x0'));module[_0x21c5('0x1')]={'type':{'type':Sequelize[_0x21c5('0x2')]},'uniqueid':{'type':Sequelize[_0x21c5('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x21c5('0x2')]},'membername':{'type':Sequelize[_0x21c5('0x2')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0x21c5('0x3')]},'agentcompleteAt':{'type':Sequelize[_0x21c5('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0x21c5('0x3')]},'agentdumpAt':{'type':Sequelize[_0x21c5('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x21c5('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x21c5('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize[_0x21c5('0x5')]},'agentacw':{'type':Sequelize[_0x21c5('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x21c5('0x5')]},'reason':{'type':Sequelize[_0x21c5('0x2')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x21c5('0x2')]},'channelstate':{'type':Sequelize[_0x21c5('0x5')]},'channelstatedesc':{'type':Sequelize[_0x21c5('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x21c5('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x21c5('0x2')]},'context':{'type':Sequelize[_0x21c5('0x2')]},'exten':{'type':Sequelize[_0x21c5('0x2')]},'priority':{'type':Sequelize[_0x21c5('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x21c5('0x5')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x21c5('0x2')]},'destcalleridname':{'type':Sequelize[_0x21c5('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x21c5('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x21c5('0x2')]},'destexten':{'type':Sequelize[_0x21c5('0x2')]},'destpriority':{'type':Sequelize[_0x21c5('0x2')]},'destuniqueid':{'type':Sequelize[_0x21c5('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x21c5('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0x21c5('0x2')]},'transfer':{'type':Sequelize[_0x21c5('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0x21c5('0x6')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize[_0x21c5('0x5')],'defaultValue':0x0}}; \ No newline at end of file +var _0x01d3=['FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE','INTEGER','BOOLEAN'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0x01d3,0xa2));var _0x301d=function(_0x495484,_0x4b43e0){_0x495484=_0x495484-0x0;var _0x4d628e=_0x01d3[_0x495484];return _0x4d628e;};'use strict';var Sequelize=require(_0x301d('0x0'));module[_0x301d('0x1')]={'type':{'type':Sequelize[_0x301d('0x2')]},'uniqueid':{'type':Sequelize[_0x301d('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x301d('0x2')]},'queue':{'type':Sequelize[_0x301d('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x301d('0x2')]},'agentcalledAt':{'type':Sequelize[_0x301d('0x3')]},'agentconnectAt':{'type':Sequelize[_0x301d('0x3')]},'agentcompleteAt':{'type':Sequelize[_0x301d('0x3')]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize[_0x301d('0x3')]},'holdtime':{'type':Sequelize[_0x301d('0x4')]},'agentcomplete':{'type':Sequelize[_0x301d('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x301d('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x301d('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x301d('0x4')]},'agentacw':{'type':Sequelize[_0x301d('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x301d('0x4')]},'reason':{'type':Sequelize[_0x301d('0x2')]},'lastevent':{'type':Sequelize[_0x301d('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x301d('0x4')]},'channelstatedesc':{'type':Sequelize[_0x301d('0x2')]},'connectedlinenum':{'type':Sequelize[_0x301d('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x301d('0x2')]},'accountcode':{'type':Sequelize[_0x301d('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x301d('0x2')]},'destchannelstate':{'type':Sequelize[_0x301d('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x301d('0x2')]},'destcalleridnum':{'type':Sequelize[_0x301d('0x2')]},'destcalleridname':{'type':Sequelize[_0x301d('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x301d('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x301d('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x301d('0x2')]},'destexten':{'type':Sequelize[_0x301d('0x2')]},'destpriority':{'type':Sequelize[_0x301d('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'answeredelsewheredestinationuniqueid':{'type':Sequelize['STRING']},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x301d('0x2')],'comment':_0x301d('0x6')},'transferexten':{'type':Sequelize[_0x301d('0x2')]},'transferuniqueid':{'type':Sequelize[_0x301d('0x2')]},'agententerreason':{'type':Sequelize[_0x301d('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 21bfda9..79c6c42 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(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xa9e0[_0x2160a9];return _0xa88cf7;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=typeof _0x22dccb['offset']===_0x0a9e('0x19')&&typeof _0x22dccb[_0x0a9e('0x1a')]==='undefined';var _0x225616=_0x5d0880['count'];var _0x459eb1=_0x1985b6?0x0:_0x22dccb[_0x0a9e('0x1b')];var _0x106033=_0x1985b6?_0x5d0880[_0x0a9e('0x1c')]:_0x22dccb[_0x0a9e('0x1b')]+_0x22dccb[_0x0a9e('0x1a')];var _0x530eb7;if(_0x106033>=_0x225616){_0x106033=_0x225616;_0x530eb7=0xc8;}else{_0x530eb7=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x530eb7);return _0x52a03d[_0x0a9e('0x1d')](_0x0a9e('0x1e'),_0x459eb1+'-'+_0x106033+'/'+_0x225616)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x105080){return function(_0x4bb1e3){try{jsonpatch[_0x0a9e('0x1f')](_0x4bb1e3,_0x105080,!![]);}catch(_0x155cce){return BPromise['reject'](_0x155cce);}return _0x4bb1e3[_0x0a9e('0x20')]();};}function saveUpdates(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')](_0x5a09ef)[_0x0a9e('0x22')](function(_0x30bae6){return _0x30bae6;});}return null;};}function removeEntity(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(_0x2fb0e4){return _0x2fb0e4[_0x0a9e('0x23')]()[_0x0a9e('0x22')](function(){_0x4abc77[_0x0a9e('0x17')](0xcc)[_0x0a9e('0x16')]();});}};}function handleEntityNotFound(_0x16b1ca,_0x5ea472){return function(_0x59181e){if(!_0x59181e){_0x16b1ca[_0x0a9e('0x15')](0x194);}return _0x59181e;};}function handleError(_0x3a8e58,_0x40c424){_0x40c424=_0x40c424||0x1f4;return function(_0x33161b){logger['error'](_0x33161b[_0x0a9e('0x24')]);if(_0x33161b['name']){delete _0x33161b[_0x0a9e('0x25')];}_0x3a8e58['status'](_0x40c424)[_0x0a9e('0x26')](_0x33161b);};}exports[_0x0a9e('0x27')]=function(_0x25fba9,_0x14433c){var _0x140511={},_0x1538a4={},_0x11c3b6={'count':0x0,'rows':[]};var _0x14de77=_['map'](db[_0x0a9e('0x28')][_0x0a9e('0x29')],function(_0x2b1f27){return{'name':_0x2b1f27[_0x0a9e('0x2a')],'type':_0x2b1f27['type'][_0x0a9e('0x2b')]};});_0x1538a4[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x14de77,_0x0a9e('0x25'));_0x1538a4[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x25fba9[_0x0a9e('0x2e')]);_0x1538a4[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x1538a4['model'],_0x1538a4[_0x0a9e('0x2e')]);_0x140511['attributes']=_[_0x0a9e('0x31')](_0x1538a4[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0x140511['attributes']=_0x140511[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0x140511[_0x0a9e('0x33')]:_0x1538a4[_0x0a9e('0x2c')];if(!_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x35')](_0x0a9e('0x36'))){_0x140511[_0x0a9e('0x1a')]=qs['limit'](_0x25fba9[_0x0a9e('0x2e')]['limit']);_0x140511[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x1b')]);}_0x140511['order']=qs[_0x0a9e('0x37')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x37')]);_0x140511[_0x0a9e('0x38')]=qs['filters'](_['pick'](_0x25fba9[_0x0a9e('0x2e')],_0x1538a4['filters']),_0x14de77);if(_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x39')]){_0x140511[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](_0x140511['where'],{'$or':_[_0x0a9e('0x2d')](_0x14de77,function(_0x3bfce8){if(_0x3bfce8[_0x0a9e('0x3b')]!=='VIRTUAL'){var _0x1dbf74={};_0x1dbf74[_0x3bfce8[_0x0a9e('0x25')]]={'$like':'%'+_0x25fba9[_0x0a9e('0x2e')]['filter']+'%'};return _0x1dbf74;}})});}_0x140511=_['merge']({},_0x140511,_0x25fba9[_0x0a9e('0x3c')]);var _0x40d766={'where':_0x140511['where']};return db[_0x0a9e('0x28')][_0x0a9e('0x1c')](_0x40d766)[_0x0a9e('0x22')](function(_0x148f55){_0x11c3b6['count']=_0x148f55;if(_0x25fba9['query'][_0x0a9e('0x3d')]){_0x140511[_0x0a9e('0x3e')]=[{'all':!![]}];}return db['VoiceAgentReport'][_0x0a9e('0x3f')](_0x140511);})[_0x0a9e('0x22')](function(_0x1459bb){_0x11c3b6['rows']=_0x1459bb;return _0x11c3b6;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x14433c,_0x140511))[_0x0a9e('0x40')](handleError(_0x14433c,null));};exports[_0x0a9e('0x41')]=function(_0x43dd5b,_0x13cb1f){var _0xeaa5e5={'raw':![],'where':{'id':_0x43dd5b[_0x0a9e('0x42')]['id']}},_0x2881b3={};_0x2881b3[_0x0a9e('0x2c')]=_[_0x0a9e('0x2f')](db[_0x0a9e('0x28')][_0x0a9e('0x29')]);_0x2881b3[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x43dd5b[_0x0a9e('0x2e')]);_0x2881b3['filters']=_['intersection'](_0x2881b3[_0x0a9e('0x2c')],_0x2881b3[_0x0a9e('0x2e')]);_0xeaa5e5[_0x0a9e('0x33')]=_[_0x0a9e('0x31')](_0x2881b3[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0xeaa5e5[_0x0a9e('0x33')]=_0xeaa5e5[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0xeaa5e5[_0x0a9e('0x33')]:_0x2881b3['model'];if(_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x3d')]){_0xeaa5e5[_0x0a9e('0x3e')]=[{'all':!![]}];}_0xeaa5e5=_[_0x0a9e('0x3a')]({},_0xeaa5e5,_0x43dd5b[_0x0a9e('0x3c')]);return db[_0x0a9e('0x28')][_0x0a9e('0x43')](_0xeaa5e5)[_0x0a9e('0x22')](handleEntityNotFound(_0x13cb1f,null))['then'](respondWithResult(_0x13cb1f,null))[_0x0a9e('0x40')](handleError(_0x13cb1f,null));};exports['create']=function(_0x473dc8,_0x476688){return db[_0x0a9e('0x28')]['create'](_0x473dc8[_0x0a9e('0x44')],{})[_0x0a9e('0x22')](respondWithResult(_0x476688,0xc9))[_0x0a9e('0x40')](handleError(_0x476688,null));};exports[_0x0a9e('0x21')]=function(_0x45c845,_0x37be73){if(_0x45c845[_0x0a9e('0x44')]['id']){delete _0x45c845['body']['id'];}return db[_0x0a9e('0x28')][_0x0a9e('0x43')]({'where':{'id':_0x45c845[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x37be73,null))[_0x0a9e('0x22')](saveUpdates(_0x45c845[_0x0a9e('0x44')],null))[_0x0a9e('0x22')](respondWithResult(_0x37be73,null))[_0x0a9e('0x40')](handleError(_0x37be73,null));};exports[_0x0a9e('0x23')]=function(_0x58a5c2,_0xe401a){return db[_0x0a9e('0x28')]['find']({'where':{'id':_0x58a5c2['params']['id']}})['then'](handleEntityNotFound(_0xe401a,null))[_0x0a9e('0x22')](removeEntity(_0xe401a,null))[_0x0a9e('0x40')](handleError(_0xe401a,null));};exports[_0x0a9e('0x45')]=function(_0x11545a,_0x61bb17){return db[_0x0a9e('0x28')][_0x0a9e('0x45')]()[_0x0a9e('0x22')](respondWithResult(_0x61bb17,null))['catch'](handleError(_0x61bb17,null));}; \ No newline at end of file +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(_0x220f3f,_0x11c540){var _0x1f170e=function(_0x2c0ec9){while(--_0x2c0ec9){_0x220f3f['push'](_0x220f3f['shift']());}};_0x1f170e(++_0x11c540);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa9e0[_0x1ac595];return _0x455fff;};'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 4cca2e3..bc05702 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 _0x6bac=['lodash','../../config/logger','api','moment','bluebird','../../config/environment','./voiceAgentReport.attributes','define','VoiceAgentReport','report_agent','uniqueid'];(function(_0x3fb420,_0x135179){var _0x43fff8=function(_0x353b93){while(--_0x353b93){_0x3fb420['push'](_0x3fb420['shift']());}};_0x43fff8(++_0x135179);}(_0x6bac,0xa5));var _0xc6ba=function(_0xcf5837,_0x518ad6){_0xcf5837=_0xcf5837-0x0;var _0x252da3=_0x6bac[_0xcf5837];return _0x252da3;};'use strict';var _=require(_0xc6ba('0x0'));var util=require('util');var logger=require(_0xc6ba('0x1'))(_0xc6ba('0x2'));var moment=require(_0xc6ba('0x3'));var BPromise=require(_0xc6ba('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc6ba('0x5'));var attributes=require(_0xc6ba('0x6'));module['exports']=function(_0x222f20,_0x2a16af){return _0x222f20[_0xc6ba('0x7')](_0xc6ba('0x8'),attributes,{'tableName':_0xc6ba('0x9'),'paranoid':![],'indexes':[{'fields':[_0xc6ba('0xa'),'destuniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xd8a7=['VoiceAgentReport','report_agent','destuniqueid','lodash','moment','bluebird','request-promise','rimraf','./voiceAgentReport.attributes','define'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xd8a7,0xdf));var _0x7d8a=function(_0x590e6a,_0x192460){_0x590e6a=_0x590e6a-0x0;var _0x300e4f=_0xd8a7[_0x590e6a];return _0x300e4f;};'use strict';var _=require(_0x7d8a('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x7d8a('0x1'));var BPromise=require(_0x7d8a('0x2'));var rp=require(_0x7d8a('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7d8a('0x4'));var config=require('../../config/environment');var attributes=require(_0x7d8a('0x5'));module['exports']=function(_0x27ef8e,_0x530308){return _0x27ef8e[_0x7d8a('0x6')](_0x7d8a('0x7'),attributes,{'tableName':_0x7d8a('0x8'),'paranoid':![],'indexes':[{'fields':['uniqueid',_0x7d8a('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index d79aa11..1dc2e18 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 _0xd3b0=['debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoiceAgentReport,\x20%s,\x20%s','result','catch','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','raw','UpdateVoiceAgentReport','update','where','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xd3b0,0x11a));var _0x0d3b=function(_0x528c98,_0x185c88){_0x528c98=_0x528c98-0x0;var _0x526594=_0xd3b0[_0x528c98];return _0x526594;};'use strict';var _=require('lodash');var util=require(_0x0d3b('0x0'));var moment=require(_0x0d3b('0x1'));var BPromise=require(_0x0d3b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d3b('0x3'));var db=require(_0x0d3b('0x4'))['db'];var utils=require(_0x0d3b('0x5'));var logger=require(_0x0d3b('0x6'))(_0x0d3b('0x7'));var config=require('../../config/environment');var jayson=require(_0x0d3b('0x8'));var client=jayson[_0x0d3b('0x9')][_0x0d3b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x23f811,_0x1d24a9,_0x586756){return new BPromise(function(_0x43e600,_0x17e26e){return client[_0x0d3b('0xb')](_0x23f811,_0x586756)[_0x0d3b('0xc')](function(_0x2145d6){logger[_0x0d3b('0xd')]('VoiceAgentReport,\x20%s,\x20%s',_0x1d24a9,_0x0d3b('0xe'));logger[_0x0d3b('0xf')](_0x0d3b('0x10'),_0x1d24a9,'request\x20sent',JSON[_0x0d3b('0x11')](_0x2145d6));if(_0x2145d6[_0x0d3b('0x12')]){if(_0x2145d6[_0x0d3b('0x12')][_0x0d3b('0x13')]===0x1f4){logger[_0x0d3b('0x12')]('VoiceAgentReport,\x20%s,\x20%s',_0x1d24a9,_0x2145d6[_0x0d3b('0x12')][_0x0d3b('0x14')]);return _0x17e26e(_0x2145d6[_0x0d3b('0x12')][_0x0d3b('0x14')]);}logger[_0x0d3b('0x12')](_0x0d3b('0x15'),_0x1d24a9,_0x2145d6['error'][_0x0d3b('0x14')]);return _0x43e600(_0x2145d6[_0x0d3b('0x12')]['message']);}else{logger[_0x0d3b('0xd')]('VoiceAgentReport,\x20%s,\x20%s',_0x1d24a9,_0x0d3b('0xe'));_0x43e600(_0x2145d6[_0x0d3b('0x16')]['message']);}})[_0x0d3b('0x17')](function(_0x1fae22){logger[_0x0d3b('0x12')](_0x0d3b('0x15'),_0x1d24a9,_0x1fae22);_0x17e26e(_0x1fae22);});});}exports[_0x0d3b('0x18')]=function(_0x3766c3){var _0x32444f=this;return new Promise(function(_0x4b6eb2,_0x379e75){return db[_0x0d3b('0x19')][_0x0d3b('0x1a')](_0x3766c3[_0x0d3b('0x1b')],{'raw':_0x3766c3[_0x0d3b('0x1c')]?_0x3766c3[_0x0d3b('0x1c')][_0x0d3b('0x1d')]===undefined?!![]:![]:!![]})[_0x0d3b('0xc')](function(_0x2fdb73){logger['info'](_0x0d3b('0x18'),_0x3766c3);logger['debug'](_0x0d3b('0x18'),_0x3766c3,JSON[_0x0d3b('0x11')](_0x2fdb73));_0x4b6eb2(_0x2fdb73);})[_0x0d3b('0x17')](function(_0x337f0f){logger[_0x0d3b('0x12')](_0x0d3b('0x18'),_0x337f0f['message'],_0x3766c3);_0x379e75(_0x32444f[_0x0d3b('0x12')](0x1f4,_0x337f0f[_0x0d3b('0x14')]));});});};exports[_0x0d3b('0x1e')]=function(_0xd4eca){var _0x44bd11=this;return new Promise(function(_0x4e58ad,_0x34aadb){return db[_0x0d3b('0x19')][_0x0d3b('0x1f')](_0xd4eca[_0x0d3b('0x1b')],{'raw':_0xd4eca[_0x0d3b('0x1c')]?_0xd4eca[_0x0d3b('0x1c')][_0x0d3b('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xd4eca[_0x0d3b('0x1c')]?_0xd4eca[_0x0d3b('0x1c')][_0x0d3b('0x20')]||null:null,'attributes':_0xd4eca['options']?_0xd4eca[_0x0d3b('0x1c')]['attributes']||null:null,'limit':_0xd4eca[_0x0d3b('0x1c')]?_0xd4eca['options']['limit']||null:null})['then'](function(_0x4f4dc3){logger[_0x0d3b('0xd')](_0x0d3b('0x1e'),_0xd4eca);logger[_0x0d3b('0xf')](_0x0d3b('0x1e'),_0xd4eca,JSON[_0x0d3b('0x11')](_0x4f4dc3));_0x4e58ad(_0x4f4dc3);})['catch'](function(_0x16a371){logger['error']('UpdateVoiceAgentReport',_0x16a371[_0x0d3b('0x14')],_0xd4eca);_0x34aadb(_0x44bd11[_0x0d3b('0x12')](0x1f4,_0x16a371[_0x0d3b('0x14')]));});});}; \ No newline at end of file +var _0x8c4e=['request\x20sent','debug','stringify','error','code','message','info','result','VoiceAgentReport','create','body','options','raw','then','CreateVoiceAgentReport','catch','UpdateVoiceAgentReport','update','where','attributes','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','VoiceAgentReport,\x20%s,\x20%s'];(function(_0x5e8906,_0x18f1e7){var _0x3b6622=function(_0x47ca57){while(--_0x47ca57){_0x5e8906['push'](_0x5e8906['shift']());}};_0x3b6622(++_0x18f1e7);}(_0x8c4e,0x1f1));var _0xe8c4=function(_0x5c511d,_0x3c8fca){_0x5c511d=_0x5c511d-0x0;var _0x50aba2=_0x8c4e[_0x5c511d];return _0x50aba2;};'use strict';var _=require(_0xe8c4('0x0'));var util=require(_0xe8c4('0x1'));var moment=require('moment');var BPromise=require(_0xe8c4('0x2'));var rs=require(_0xe8c4('0x3'));var fs=require('fs');var Redis=require(_0xe8c4('0x4'));var db=require(_0xe8c4('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe8c4('0x6'))(_0xe8c4('0x7'));var config=require(_0xe8c4('0x8'));var jayson=require(_0xe8c4('0x9'));var client=jayson['client'][_0xe8c4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5770b8,_0xe01fe,_0x483692){return new BPromise(function(_0x20f323,_0x409c2c){return client[_0xe8c4('0xb')](_0x5770b8,_0x483692)['then'](function(_0x492845){logger['info'](_0xe8c4('0xc'),_0xe01fe,_0xe8c4('0xd'));logger[_0xe8c4('0xe')]('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0xe01fe,'request\x20sent',JSON[_0xe8c4('0xf')](_0x492845));if(_0x492845[_0xe8c4('0x10')]){if(_0x492845['error'][_0xe8c4('0x11')]===0x1f4){logger['error'](_0xe8c4('0xc'),_0xe01fe,_0x492845[_0xe8c4('0x10')][_0xe8c4('0x12')]);return _0x409c2c(_0x492845[_0xe8c4('0x10')]['message']);}logger[_0xe8c4('0x10')]('VoiceAgentReport,\x20%s,\x20%s',_0xe01fe,_0x492845[_0xe8c4('0x10')][_0xe8c4('0x12')]);return _0x20f323(_0x492845[_0xe8c4('0x10')][_0xe8c4('0x12')]);}else{logger[_0xe8c4('0x13')]('VoiceAgentReport,\x20%s,\x20%s',_0xe01fe,_0xe8c4('0xd'));_0x20f323(_0x492845[_0xe8c4('0x14')]['message']);}})['catch'](function(_0x5f0ec5){logger['error'](_0xe8c4('0xc'),_0xe01fe,_0x5f0ec5);_0x409c2c(_0x5f0ec5);});});}exports['CreateVoiceAgentReport']=function(_0x41a06c){var _0x49c5c4=this;return new Promise(function(_0x20303e,_0x384aa8){return db[_0xe8c4('0x15')][_0xe8c4('0x16')](_0x41a06c[_0xe8c4('0x17')],{'raw':_0x41a06c[_0xe8c4('0x18')]?_0x41a06c[_0xe8c4('0x18')][_0xe8c4('0x19')]===undefined?!![]:![]:!![]})[_0xe8c4('0x1a')](function(_0x57718f){logger[_0xe8c4('0x13')](_0xe8c4('0x1b'),_0x41a06c);logger[_0xe8c4('0xe')](_0xe8c4('0x1b'),_0x41a06c,JSON['stringify'](_0x57718f));_0x20303e(_0x57718f);})[_0xe8c4('0x1c')](function(_0x61dee4){logger[_0xe8c4('0x10')]('CreateVoiceAgentReport',_0x61dee4[_0xe8c4('0x12')],_0x41a06c);_0x384aa8(_0x49c5c4['error'](0x1f4,_0x61dee4[_0xe8c4('0x12')]));});});};exports[_0xe8c4('0x1d')]=function(_0x4ad615){var _0x2e190c=this;return new Promise(function(_0x400671,_0x21c651){return db[_0xe8c4('0x15')][_0xe8c4('0x1e')](_0x4ad615[_0xe8c4('0x17')],{'raw':_0x4ad615['options']?_0x4ad615[_0xe8c4('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4ad615[_0xe8c4('0x18')]?_0x4ad615[_0xe8c4('0x18')][_0xe8c4('0x1f')]||null:null,'attributes':_0x4ad615[_0xe8c4('0x18')]?_0x4ad615[_0xe8c4('0x18')][_0xe8c4('0x20')]||null:null,'limit':_0x4ad615[_0xe8c4('0x18')]?_0x4ad615['options'][_0xe8c4('0x21')]||null:null})['then'](function(_0x23cdfe){logger['info'](_0xe8c4('0x1d'),_0x4ad615);logger['debug']('UpdateVoiceAgentReport',_0x4ad615,JSON[_0xe8c4('0xf')](_0x23cdfe));_0x400671(_0x23cdfe);})['catch'](function(_0x1ef062){logger[_0xe8c4('0x10')](_0xe8c4('0x1d'),_0x1ef062[_0xe8c4('0x12')],_0x4ad615);_0x21c651(_0x2e190c[_0xe8c4('0x10')](0x1f4,_0x1ef062[_0xe8c4('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index b9bae71..730144f 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 _0x5ffd=['express','Router','../../components/auth/service','./voiceCallReport.controller','get','isAuthenticated','index','/describe','describe','show','post','create','put','/:id','update','updateWithRetry','delete'];(function(_0x36305b,_0x261db5){var _0x50cfb5=function(_0x582d5d){while(--_0x582d5d){_0x36305b['push'](_0x36305b['shift']());}};_0x50cfb5(++_0x261db5);}(_0x5ffd,0x88));var _0xd5ff=function(_0x3e8da1,_0x577c14){_0x3e8da1=_0x3e8da1-0x0;var _0x255176=_0x5ffd[_0x3e8da1];return _0x255176;};'use strict';var express=require(_0xd5ff('0x0'));var router=express[_0xd5ff('0x1')]();var auth=require(_0xd5ff('0x2'));var controller=require(_0xd5ff('0x3'));router[_0xd5ff('0x4')]('/',auth[_0xd5ff('0x5')](),controller[_0xd5ff('0x6')]);router['get'](_0xd5ff('0x7'),auth['isAuthenticated'](),controller[_0xd5ff('0x8')]);router['get']('/:id',auth[_0xd5ff('0x5')](),controller[_0xd5ff('0x9')]);router[_0xd5ff('0xa')]('/',auth['isAuthenticated'](),controller[_0xd5ff('0xb')]);router[_0xd5ff('0xc')](_0xd5ff('0xd'),auth[_0xd5ff('0x5')](),controller[_0xd5ff('0xe')]);router['put']('/with-retry/:id',auth[_0xd5ff('0x5')](),controller[_0xd5ff('0xf')]);router[_0xd5ff('0x10')]('/:id',auth[_0xd5ff('0x5')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x19ab=['delete','destroy','express','Router','../../components/auth/service','./voiceCallReport.controller','isAuthenticated','/describe','describe','/:id','show','post','update','put','/with-retry/:id','updateWithRetry'];(function(_0x3b7a08,_0x3761fe){var _0x258003=function(_0x1bb5b3){while(--_0x1bb5b3){_0x3b7a08['push'](_0x3b7a08['shift']());}};_0x258003(++_0x3761fe);}(_0x19ab,0x1f2));var _0xb19a=function(_0x4a629d,_0x3eba6d){_0x4a629d=_0x4a629d-0x0;var _0x46b786=_0x19ab[_0x4a629d];return _0x46b786;};'use strict';var express=require(_0xb19a('0x0'));var router=express[_0xb19a('0x1')]();var auth=require(_0xb19a('0x2'));var controller=require(_0xb19a('0x3'));router['get']('/',auth[_0xb19a('0x4')](),controller['index']);router['get'](_0xb19a('0x5'),auth[_0xb19a('0x4')](),controller[_0xb19a('0x6')]);router['get'](_0xb19a('0x7'),auth[_0xb19a('0x4')](),controller[_0xb19a('0x8')]);router[_0xb19a('0x9')]('/',auth[_0xb19a('0x4')](),controller['create']);router['put'](_0xb19a('0x7'),auth['isAuthenticated'](),controller[_0xb19a('0xa')]);router[_0xb19a('0xb')](_0xb19a('0xc'),auth[_0xb19a('0x4')](),controller[_0xb19a('0xd')]);router[_0xb19a('0xe')]('/:id',auth[_0xb19a('0x4')](),controller[_0xb19a('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 68f881d..87662d9 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 _0xc4e9=['sequelize','exports','ENUM','inbound','internal','outbound','inbound-fax','outbound-fax','STRING','TEXT','DATE','INTEGER'];(function(_0x5f09c5,_0x2bfca0){var _0x426ad9=function(_0x18fe5f){while(--_0x18fe5f){_0x5f09c5['push'](_0x5f09c5['shift']());}};_0x426ad9(++_0x2bfca0);}(_0xc4e9,0x144));var _0x9c4e=function(_0x1b69aa,_0x5aa147){_0x1b69aa=_0x1b69aa-0x0;var _0x42647d=_0xc4e9[_0x1b69aa];return _0x42647d;};'use strict';var Sequelize=require(_0x9c4e('0x0'));module[_0x9c4e('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x9c4e('0x2')](_0x9c4e('0x3'),_0x9c4e('0x4'),_0x9c4e('0x5'),_0x9c4e('0x6'),_0x9c4e('0x7'),'dialer')},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x9c4e('0x8')]},'source':{'type':Sequelize[_0x9c4e('0x8')]},'destination':{'type':Sequelize[_0x9c4e('0x8')]},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x9c4e('0x8')]},'channel':{'type':Sequelize[_0x9c4e('0x8')]},'destinationchannel':{'type':Sequelize[_0x9c4e('0x8')]},'lastapplication':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0x9c4e('0x9')]},'starttime':{'type':Sequelize[_0x9c4e('0xa')]},'systemanswertime':{'type':Sequelize[_0x9c4e('0xa')]},'answertime':{'type':Sequelize[_0x9c4e('0xa')]},'endtime':{'type':Sequelize[_0x9c4e('0xa')]},'duration':{'type':Sequelize[_0x9c4e('0xb')]},'billableseconds':{'type':Sequelize[_0x9c4e('0xb')]},'mohtime':{'type':Sequelize[_0x9c4e('0xb')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x9c4e('0x8')]},'amaflags':{'type':Sequelize[_0x9c4e('0x8')]},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize[_0x9c4e('0x8')]},'userSecondDisposition':{'type':Sequelize[_0x9c4e('0x8')]},'userThirdDisposition':{'type':Sequelize[_0x9c4e('0x8')]},'note':{'type':Sequelize[_0x9c4e('0x8')]},'prefix':{'type':Sequelize['STRING']},'routeid':{'type':Sequelize[_0x9c4e('0xb')]},'sipcallid':{'type':Sequelize[_0x9c4e('0x8')]}}; \ No newline at end of file +var _0x88a6=['INTEGER','exports','STRING','inbound','internal','outbound','inbound-fax','DATE'];(function(_0x48ac3c,_0x481f3c){var _0x51958a=function(_0x50985b){while(--_0x50985b){_0x48ac3c['push'](_0x48ac3c['shift']());}};_0x51958a(++_0x481f3c);}(_0x88a6,0x121));var _0x688a=function(_0x648163,_0x241576){_0x648163=_0x648163-0x0;var _0x199d4d=_0x88a6[_0x648163];return _0x199d4d;};'use strict';var Sequelize=require('sequelize');module[_0x688a('0x0')]={'uniqueid':{'type':Sequelize[_0x688a('0x1')]},'type':{'type':Sequelize['ENUM'](_0x688a('0x2'),_0x688a('0x3'),_0x688a('0x4'),_0x688a('0x5'),'outbound-fax','dialer')},'tag':{'type':Sequelize[_0x688a('0x1')]},'accountcode':{'type':Sequelize['STRING']},'source':{'type':Sequelize[_0x688a('0x1')]},'destination':{'type':Sequelize[_0x688a('0x1')]},'destinationcontext':{'type':Sequelize[_0x688a('0x1')]},'callerid':{'type':Sequelize[_0x688a('0x1')]},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize[_0x688a('0x1')]},'lastapplication':{'type':Sequelize[_0x688a('0x1')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize[_0x688a('0x6')]},'systemanswertime':{'type':Sequelize[_0x688a('0x6')]},'answertime':{'type':Sequelize[_0x688a('0x6')]},'endtime':{'type':Sequelize[_0x688a('0x6')]},'duration':{'type':Sequelize[_0x688a('0x7')]},'billableseconds':{'type':Sequelize[_0x688a('0x7')]},'mohtime':{'type':Sequelize[_0x688a('0x7')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x688a('0x1')]},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize[_0x688a('0x1')]},'userSecondDisposition':{'type':Sequelize[_0x688a('0x1')]},'userThirdDisposition':{'type':Sequelize[_0x688a('0x1')]},'note':{'type':Sequelize[_0x688a('0x1')]},'prefix':{'type':Sequelize[_0x688a('0x1')]},'routeid':{'type':Sequelize['INTEGER']},'sipcallid':{'type':Sequelize[_0x688a('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index e1caa95..d2ce5dc 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 _0x11c8=['rows','include','find','create','body','catch','describe','params','user','uniqueid','updateWithRetry','../../components/parsers/qs','../../config/logger','../../mysqldb','promise-retry','status','offset','undefined','limit','count','set','Content-Range','json','update','then','end','sendStatus','error','stack','name','send','index','VoiceCallReport','rawAttributes','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','type','filter','merge','options','includeAll','alias','User','findAll'];(function(_0x19921b,_0x5c0c2d){var _0x273545=function(_0x387462){while(--_0x387462){_0x19921b['push'](_0x19921b['shift']());}};_0x273545(++_0x5c0c2d);}(_0x11c8,0x19a));var _0x811c=function(_0x3a8bf9,_0x5f2c5e){_0x3a8bf9=_0x3a8bf9-0x0;var _0x1f9611=_0x11c8[_0x3a8bf9];return _0x1f9611;};'use strict';var _=require('lodash');var qs=require(_0x811c('0x0'));var logger=require(_0x811c('0x1'))('api');var db=require(_0x811c('0x2'))['db'];const promiseRetry=require(_0x811c('0x3'));function respondWithResult(_0x46f72b,_0x85a54c){_0x85a54c=_0x85a54c||0xc8;return function(_0x16f1d6){if(_0x16f1d6){return _0x46f72b[_0x811c('0x4')](_0x85a54c)['json'](_0x16f1d6);}};}function respondWithFilteredResult(_0x10fecb,_0x40cc07){return function(_0x537216){if(_0x537216){var _0x126cc2=typeof _0x40cc07[_0x811c('0x5')]===_0x811c('0x6')&&typeof _0x40cc07[_0x811c('0x7')]==='undefined';var _0x47b070=_0x537216['count'];var _0x5be7fc=_0x126cc2?0x0:_0x40cc07['offset'];var _0x4ce7c4=_0x126cc2?_0x537216[_0x811c('0x8')]:_0x40cc07[_0x811c('0x5')]+_0x40cc07['limit'];var _0xd3eaf9;if(_0x4ce7c4>=_0x47b070){_0x4ce7c4=_0x47b070;_0xd3eaf9=0xc8;}else{_0xd3eaf9=0xce;}_0x10fecb[_0x811c('0x4')](_0xd3eaf9);return _0x10fecb[_0x811c('0x9')](_0x811c('0xa'),_0x5be7fc+'-'+_0x4ce7c4+'/'+_0x47b070)[_0x811c('0xb')](_0x537216);}return null;};}function saveUpdates(_0x5959e8){return function(_0x4daca7){if(_0x4daca7){return _0x4daca7[_0x811c('0xc')](_0x5959e8)['then'](function(_0x375244){return _0x375244;});}return null;};}function removeEntity(_0x5f20f7){return function(_0x5a1262){if(_0x5a1262){return _0x5a1262['destroy']()[_0x811c('0xd')](function(){_0x5f20f7[_0x811c('0x4')](0xcc)[_0x811c('0xe')]();});}};}function handleEntityNotFound(_0x12b12e){return function(_0xfd8681){if(!_0xfd8681){_0x12b12e[_0x811c('0xf')](0x194);}return _0xfd8681;};}function handleError(_0x520242,_0x585d94){_0x585d94=_0x585d94||0x1f4;return function(_0x7b7fd7){logger[_0x811c('0x10')](_0x7b7fd7[_0x811c('0x11')]);if(_0x7b7fd7[_0x811c('0x12')]){delete _0x7b7fd7[_0x811c('0x12')];}_0x520242[_0x811c('0x4')](_0x585d94)[_0x811c('0x13')](_0x7b7fd7);};}exports[_0x811c('0x14')]=function(_0x179636,_0x503bbc){var _0xb8a210={},_0x5686f1={},_0x291660={'count':0x0,'rows':[]};var _0x63a81f=_['map'](db[_0x811c('0x15')][_0x811c('0x16')],function(_0x3bcc6b){return{'name':_0x3bcc6b['fieldName'],'type':_0x3bcc6b['type']['key']};});_0x5686f1[_0x811c('0x17')]=_[_0x811c('0x18')](_0x63a81f,_0x811c('0x12'));_0x5686f1['query']=_[_0x811c('0x19')](_0x179636[_0x811c('0x1a')]);_0x5686f1[_0x811c('0x1b')]=_[_0x811c('0x1c')](_0x5686f1['model'],_0x5686f1[_0x811c('0x1a')]);_0xb8a210[_0x811c('0x1d')]=_[_0x811c('0x1c')](_0x5686f1[_0x811c('0x17')],qs[_0x811c('0x1e')](_0x179636[_0x811c('0x1a')]['fields']));_0xb8a210[_0x811c('0x1d')]=_0xb8a210['attributes'][_0x811c('0x1f')]?_0xb8a210[_0x811c('0x1d')]:_0x5686f1[_0x811c('0x17')];if(!_0x179636[_0x811c('0x1a')][_0x811c('0x20')](_0x811c('0x21'))){_0xb8a210['limit']=qs[_0x811c('0x7')](_0x179636[_0x811c('0x1a')][_0x811c('0x7')]);_0xb8a210[_0x811c('0x5')]=qs[_0x811c('0x5')](_0x179636[_0x811c('0x1a')]['offset']);}_0xb8a210[_0x811c('0x22')]=qs[_0x811c('0x23')](_0x179636['query']['sort']);_0xb8a210[_0x811c('0x24')]=qs[_0x811c('0x1b')](_[_0x811c('0x25')](_0x179636['query'],_0x5686f1[_0x811c('0x1b')]),_0x63a81f);if(_0x179636[_0x811c('0x1a')]['filter']){_0xb8a210['where']=_['merge'](_0xb8a210[_0x811c('0x24')],{'$or':_[_0x811c('0x18')](_0x63a81f,function(_0x55e3e7){if(_0x55e3e7[_0x811c('0x26')]!=='VIRTUAL'){var _0x4c43a1={};_0x4c43a1[_0x55e3e7[_0x811c('0x12')]]={'$like':'%'+_0x179636[_0x811c('0x1a')][_0x811c('0x27')]+'%'};return _0x4c43a1;}})});}_0xb8a210=_[_0x811c('0x28')]({},_0xb8a210,_0x179636[_0x811c('0x29')]);var _0x3a2c6f={'where':_0xb8a210[_0x811c('0x24')]};return db[_0x811c('0x15')]['count'](_0x3a2c6f)['then'](function(_0x368dd0){_0x291660[_0x811c('0x8')]=_0x368dd0;if(_0x179636['query'][_0x811c('0x2a')]){_0xb8a210['include']=[{'attributes':['id',_0x811c('0x12'),'fullname',_0x811c('0x2b')],'model':db[_0x811c('0x2c')],'as':'User'}];}return db[_0x811c('0x15')][_0x811c('0x2d')](_0xb8a210);})[_0x811c('0xd')](function(_0x54719d){_0x291660[_0x811c('0x2e')]=_0x54719d;return _0x291660;})['then'](respondWithFilteredResult(_0x503bbc,_0xb8a210))['catch'](handleError(_0x503bbc,null));};exports['show']=function(_0x200a91,_0x226dd7){var _0x5c961a={'raw':!![],'where':{'id':_0x200a91['params']['id']}},_0x5c6a90={};_0x5c6a90[_0x811c('0x17')]=_[_0x811c('0x19')](db[_0x811c('0x15')][_0x811c('0x16')]);_0x5c6a90[_0x811c('0x1a')]=_['keys'](_0x200a91[_0x811c('0x1a')]);_0x5c6a90['filters']=_[_0x811c('0x1c')](_0x5c6a90['model'],_0x5c6a90['query']);_0x5c961a[_0x811c('0x1d')]=_[_0x811c('0x1c')](_0x5c6a90['model'],qs[_0x811c('0x1e')](_0x200a91[_0x811c('0x1a')][_0x811c('0x1e')]));_0x5c961a[_0x811c('0x1d')]=_0x5c961a['attributes'][_0x811c('0x1f')]?_0x5c961a[_0x811c('0x1d')]:_0x5c6a90[_0x811c('0x17')];if(_0x200a91['query']['includeAll']){_0x5c961a[_0x811c('0x2f')]=[{'all':!![]}];}_0x5c961a=_[_0x811c('0x28')]({},_0x5c961a,_0x200a91[_0x811c('0x29')]);return db[_0x811c('0x15')][_0x811c('0x30')](_0x5c961a)[_0x811c('0xd')](handleEntityNotFound(_0x226dd7,null))[_0x811c('0xd')](respondWithResult(_0x226dd7,null))['catch'](handleError(_0x226dd7,null));};exports[_0x811c('0x31')]=function(_0x4a955e,_0x568995){return db[_0x811c('0x15')][_0x811c('0x31')](_0x4a955e[_0x811c('0x32')],{})[_0x811c('0xd')](respondWithResult(_0x568995,0xc9))[_0x811c('0x33')](handleError(_0x568995,null));};exports['destroy']=function(_0x5ca8ec,_0x2123c1){return db['VoiceCallReport'][_0x811c('0x30')]({'where':{'id':_0x5ca8ec['params']['id']}})[_0x811c('0xd')](handleEntityNotFound(_0x2123c1,null))['then'](removeEntity(_0x2123c1,null))['catch'](handleError(_0x2123c1,null));};exports[_0x811c('0x34')]=function(_0x35843e,_0x5589eb){return db[_0x811c('0x15')][_0x811c('0x34')]()[_0x811c('0xd')](respondWithResult(_0x5589eb,null))[_0x811c('0x33')](handleError(_0x5589eb,null));};function findForUpdate(_0x18d5c6){return db[_0x811c('0x15')][_0x811c('0x30')]({'where':{'uniqueid':_0x18d5c6[_0x811c('0x35')]['id'],'UserId':{'$or':[null,_0x18d5c6[_0x811c('0x36')]['id']]}}});}exports[_0x811c('0xc')]=function(_0x31ede3,_0x543d2d){if(_0x31ede3[_0x811c('0x32')][_0x811c('0x37')]){delete _0x31ede3[_0x811c('0x32')][_0x811c('0x37')];}return findForUpdate(_0x31ede3)[_0x811c('0xd')](handleEntityNotFound(_0x543d2d,null))['then'](saveUpdates(_0x31ede3['body'],null))[_0x811c('0xd')](respondWithResult(_0x543d2d,null))[_0x811c('0x33')](handleError(_0x543d2d,null));};exports[_0x811c('0x38')]=function(_0x1d82e7,_0x3b1bb8,_0x12583a){if(_0x1d82e7['body'][_0x811c('0x37')]){delete _0x1d82e7[_0x811c('0x32')][_0x811c('0x37')];}promiseRetry(function(_0x11c154){return findForUpdate(_0x1d82e7)[_0x811c('0xd')](function(_0x2c8ddb){if(_0x2c8ddb!==null){return _0x2c8ddb;}else{_0x11c154(new Error('No\x20such\x20report'));}});},{'retries':0x4,'minTimeout':0xfa})[_0x811c('0xd')](function(_0x25eff2){if(!_0x25eff2){return new Promise(function(_0x4d8415){_0x4d8415(handleEntityNotFound(_0x3b1bb8)());});}else{return _0x25eff2[_0x811c('0xc')](_0x1d82e7[_0x811c('0x32')])[_0x811c('0xd')](function(_0x250123){return respondWithResult(_0x3b1bb8)(_0x250123);});}},function(){handleEntityNotFound(_0x3b1bb8)();});}; \ No newline at end of file +var _0x2ace=['name','send','index','map','VoiceCallReport','rawAttributes','key','query','keys','filters','intersection','model','fields','attributes','nolimit','order','sort','where','pick','type','VIRTUAL','options','includeAll','include','fullname','alias','User','findAll','catch','show','length','merge','find','create','body','params','describe','user','uniqueid','updateWithRetry','../../components/parsers/qs','../../config/logger','api','promise-retry','status','json','offset','undefined','limit','count','set','Content-Range','update','then','end','sendStatus','stack'];(function(_0x54aea3,_0xae7d81){var _0x21ae46=function(_0xe16dbc){while(--_0xe16dbc){_0x54aea3['push'](_0x54aea3['shift']());}};_0x21ae46(++_0xae7d81);}(_0x2ace,0x17e));var _0xe2ac=function(_0x5538d5,_0x190032){_0x5538d5=_0x5538d5-0x0;var _0x323b1a=_0x2ace[_0x5538d5];return _0x323b1a;};'use strict';var _=require('lodash');var qs=require(_0xe2ac('0x0'));var logger=require(_0xe2ac('0x1'))(_0xe2ac('0x2'));var db=require('../../mysqldb')['db'];const promiseRetry=require(_0xe2ac('0x3'));function respondWithResult(_0x22580b,_0x47c3a2){_0x47c3a2=_0x47c3a2||0xc8;return function(_0x171092){if(_0x171092){return _0x22580b[_0xe2ac('0x4')](_0x47c3a2)[_0xe2ac('0x5')](_0x171092);}};}function respondWithFilteredResult(_0x2d2241,_0x386b18){return function(_0x46e9f3){if(_0x46e9f3){var _0x2f1f8c=typeof _0x386b18[_0xe2ac('0x6')]===_0xe2ac('0x7')&&typeof _0x386b18[_0xe2ac('0x8')]===_0xe2ac('0x7');var _0x3ae734=_0x46e9f3[_0xe2ac('0x9')];var _0x4fb111=_0x2f1f8c?0x0:_0x386b18['offset'];var _0x3c2572=_0x2f1f8c?_0x46e9f3['count']:_0x386b18[_0xe2ac('0x6')]+_0x386b18[_0xe2ac('0x8')];var _0x540a1e;if(_0x3c2572>=_0x3ae734){_0x3c2572=_0x3ae734;_0x540a1e=0xc8;}else{_0x540a1e=0xce;}_0x2d2241[_0xe2ac('0x4')](_0x540a1e);return _0x2d2241[_0xe2ac('0xa')](_0xe2ac('0xb'),_0x4fb111+'-'+_0x3c2572+'/'+_0x3ae734)['json'](_0x46e9f3);}return null;};}function saveUpdates(_0x37347b){return function(_0x41e1b0){if(_0x41e1b0){return _0x41e1b0[_0xe2ac('0xc')](_0x37347b)[_0xe2ac('0xd')](function(_0x346dc4){return _0x346dc4;});}return null;};}function removeEntity(_0x5ee9ca){return function(_0x76dab9){if(_0x76dab9){return _0x76dab9['destroy']()[_0xe2ac('0xd')](function(){_0x5ee9ca[_0xe2ac('0x4')](0xcc)[_0xe2ac('0xe')]();});}};}function handleEntityNotFound(_0x290584){return function(_0x3bec11){if(!_0x3bec11){_0x290584[_0xe2ac('0xf')](0x194);}return _0x3bec11;};}function handleError(_0x445bca,_0x2f3caf){_0x2f3caf=_0x2f3caf||0x1f4;return function(_0x170693){logger['error'](_0x170693[_0xe2ac('0x10')]);if(_0x170693[_0xe2ac('0x11')]){delete _0x170693['name'];}_0x445bca[_0xe2ac('0x4')](_0x2f3caf)[_0xe2ac('0x12')](_0x170693);};}exports[_0xe2ac('0x13')]=function(_0x2f5d32,_0x5000ba){var _0x5095dd={},_0x5bafe4={},_0x19784b={'count':0x0,'rows':[]};var _0x190983=_[_0xe2ac('0x14')](db[_0xe2ac('0x15')][_0xe2ac('0x16')],function(_0x279a90){return{'name':_0x279a90['fieldName'],'type':_0x279a90['type'][_0xe2ac('0x17')]};});_0x5bafe4['model']=_[_0xe2ac('0x14')](_0x190983,_0xe2ac('0x11'));_0x5bafe4[_0xe2ac('0x18')]=_[_0xe2ac('0x19')](_0x2f5d32[_0xe2ac('0x18')]);_0x5bafe4[_0xe2ac('0x1a')]=_[_0xe2ac('0x1b')](_0x5bafe4[_0xe2ac('0x1c')],_0x5bafe4[_0xe2ac('0x18')]);_0x5095dd['attributes']=_['intersection'](_0x5bafe4[_0xe2ac('0x1c')],qs['fields'](_0x2f5d32[_0xe2ac('0x18')][_0xe2ac('0x1d')]));_0x5095dd['attributes']=_0x5095dd[_0xe2ac('0x1e')]['length']?_0x5095dd[_0xe2ac('0x1e')]:_0x5bafe4[_0xe2ac('0x1c')];if(!_0x2f5d32[_0xe2ac('0x18')]['hasOwnProperty'](_0xe2ac('0x1f'))){_0x5095dd[_0xe2ac('0x8')]=qs['limit'](_0x2f5d32['query'][_0xe2ac('0x8')]);_0x5095dd[_0xe2ac('0x6')]=qs[_0xe2ac('0x6')](_0x2f5d32[_0xe2ac('0x18')]['offset']);}_0x5095dd[_0xe2ac('0x20')]=qs['sort'](_0x2f5d32[_0xe2ac('0x18')][_0xe2ac('0x21')]);_0x5095dd[_0xe2ac('0x22')]=qs[_0xe2ac('0x1a')](_[_0xe2ac('0x23')](_0x2f5d32[_0xe2ac('0x18')],_0x5bafe4['filters']),_0x190983);if(_0x2f5d32[_0xe2ac('0x18')]['filter']){_0x5095dd['where']=_['merge'](_0x5095dd[_0xe2ac('0x22')],{'$or':_[_0xe2ac('0x14')](_0x190983,function(_0x5d25d3){if(_0x5d25d3[_0xe2ac('0x24')]!==_0xe2ac('0x25')){var _0x4e7286={};_0x4e7286[_0x5d25d3[_0xe2ac('0x11')]]={'$like':'%'+_0x2f5d32[_0xe2ac('0x18')]['filter']+'%'};return _0x4e7286;}})});}_0x5095dd=_['merge']({},_0x5095dd,_0x2f5d32[_0xe2ac('0x26')]);var _0x5d34a2={'where':_0x5095dd[_0xe2ac('0x22')]};return db[_0xe2ac('0x15')][_0xe2ac('0x9')](_0x5d34a2)[_0xe2ac('0xd')](function(_0x1f68a6){_0x19784b[_0xe2ac('0x9')]=_0x1f68a6;if(_0x2f5d32[_0xe2ac('0x18')][_0xe2ac('0x27')]){_0x5095dd[_0xe2ac('0x28')]=[{'attributes':['id','name',_0xe2ac('0x29'),_0xe2ac('0x2a')],'model':db[_0xe2ac('0x2b')],'as':_0xe2ac('0x2b')}];}return db[_0xe2ac('0x15')][_0xe2ac('0x2c')](_0x5095dd);})['then'](function(_0x43732d){_0x19784b['rows']=_0x43732d;return _0x19784b;})[_0xe2ac('0xd')](respondWithFilteredResult(_0x5000ba,_0x5095dd))[_0xe2ac('0x2d')](handleError(_0x5000ba,null));};exports[_0xe2ac('0x2e')]=function(_0x15f6d8,_0x5a2025){var _0x630034={'raw':!![],'where':{'id':_0x15f6d8['params']['id']}},_0x59a4d6={};_0x59a4d6['model']=_['keys'](db[_0xe2ac('0x15')][_0xe2ac('0x16')]);_0x59a4d6['query']=_[_0xe2ac('0x19')](_0x15f6d8[_0xe2ac('0x18')]);_0x59a4d6[_0xe2ac('0x1a')]=_[_0xe2ac('0x1b')](_0x59a4d6[_0xe2ac('0x1c')],_0x59a4d6[_0xe2ac('0x18')]);_0x630034[_0xe2ac('0x1e')]=_['intersection'](_0x59a4d6[_0xe2ac('0x1c')],qs['fields'](_0x15f6d8['query'][_0xe2ac('0x1d')]));_0x630034[_0xe2ac('0x1e')]=_0x630034[_0xe2ac('0x1e')][_0xe2ac('0x2f')]?_0x630034[_0xe2ac('0x1e')]:_0x59a4d6[_0xe2ac('0x1c')];if(_0x15f6d8[_0xe2ac('0x18')][_0xe2ac('0x27')]){_0x630034['include']=[{'all':!![]}];}_0x630034=_[_0xe2ac('0x30')]({},_0x630034,_0x15f6d8[_0xe2ac('0x26')]);return db[_0xe2ac('0x15')][_0xe2ac('0x31')](_0x630034)[_0xe2ac('0xd')](handleEntityNotFound(_0x5a2025,null))['then'](respondWithResult(_0x5a2025,null))[_0xe2ac('0x2d')](handleError(_0x5a2025,null));};exports[_0xe2ac('0x32')]=function(_0x483c4f,_0x510c38){return db[_0xe2ac('0x15')][_0xe2ac('0x32')](_0x483c4f[_0xe2ac('0x33')],{})[_0xe2ac('0xd')](respondWithResult(_0x510c38,0xc9))[_0xe2ac('0x2d')](handleError(_0x510c38,null));};exports['destroy']=function(_0x2e92fc,_0x543f98){return db[_0xe2ac('0x15')][_0xe2ac('0x31')]({'where':{'id':_0x2e92fc[_0xe2ac('0x34')]['id']}})['then'](handleEntityNotFound(_0x543f98,null))[_0xe2ac('0xd')](removeEntity(_0x543f98,null))[_0xe2ac('0x2d')](handleError(_0x543f98,null));};exports[_0xe2ac('0x35')]=function(_0xbb443a,_0xfef752){return db[_0xe2ac('0x15')][_0xe2ac('0x35')]()[_0xe2ac('0xd')](respondWithResult(_0xfef752,null))['catch'](handleError(_0xfef752,null));};function findForUpdate(_0x1aebb0){return db['VoiceCallReport']['find']({'where':{'uniqueid':_0x1aebb0[_0xe2ac('0x34')]['id'],'UserId':{'$or':[null,_0x1aebb0[_0xe2ac('0x36')]['id']]}}});}exports[_0xe2ac('0xc')]=function(_0xb9f59,_0x43b7d7){if(_0xb9f59[_0xe2ac('0x33')][_0xe2ac('0x37')]){delete _0xb9f59[_0xe2ac('0x33')]['uniqueid'];}return findForUpdate(_0xb9f59)[_0xe2ac('0xd')](handleEntityNotFound(_0x43b7d7,null))['then'](saveUpdates(_0xb9f59[_0xe2ac('0x33')],null))[_0xe2ac('0xd')](respondWithResult(_0x43b7d7,null))[_0xe2ac('0x2d')](handleError(_0x43b7d7,null));};exports[_0xe2ac('0x38')]=function(_0x3e3ac9,_0x10b973,_0x56a26e){if(_0x3e3ac9['body']['uniqueid']){delete _0x3e3ac9[_0xe2ac('0x33')][_0xe2ac('0x37')];}promiseRetry(function(_0x32a422){return findForUpdate(_0x3e3ac9)[_0xe2ac('0xd')](function(_0x1ac14b){if(_0x1ac14b!==null){return _0x1ac14b;}else{_0x32a422(new Error('No\x20such\x20report'));}});},{'retries':0x4,'minTimeout':0xfa})['then'](function(_0x75d51e){if(!_0x75d51e){return new Promise(function(_0x49cfbe){_0x49cfbe(handleEntityNotFound(_0x10b973)());});}else{return _0x75d51e['update'](_0x3e3ac9[_0xe2ac('0x33')])[_0xe2ac('0xd')](function(_0x2ad3ff){return respondWithResult(_0x10b973)(_0x2ad3ff);});}},function(){handleEntityNotFound(_0x10b973)();});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 0200d9d..4a7dfd3 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 _0x2f57=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceCallReport.attributes','exports','define','VoiceCallReport','report_call','uniqueid','lodash','util'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0x2f57,0x1a2));var _0x72f5=function(_0x480d67,_0x3110a9){_0x480d67=_0x480d67-0x0;var _0x32752b=_0x2f57[_0x480d67];return _0x32752b;};'use strict';var _=require(_0x72f5('0x0'));var util=require(_0x72f5('0x1'));var logger=require('../../config/logger')(_0x72f5('0x2'));var moment=require(_0x72f5('0x3'));var BPromise=require(_0x72f5('0x4'));var rp=require(_0x72f5('0x5'));var fs=require('fs');var path=require(_0x72f5('0x6'));var rimraf=require(_0x72f5('0x7'));var config=require(_0x72f5('0x8'));var attributes=require(_0x72f5('0x9'));module[_0x72f5('0xa')]=function(_0x253d27,_0x51fc13){return _0x253d27[_0x72f5('0xb')](_0x72f5('0xc'),attributes,{'tableName':_0x72f5('0xd'),'paranoid':![],'indexes':[{'fields':[_0x72f5('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xefd9=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','VoiceCallReport','lodash','../../config/logger','api'];(function(_0x4af859,_0x73b4ed){var _0x85d557=function(_0xb86211){while(--_0xb86211){_0x4af859['push'](_0x4af859['shift']());}};_0x85d557(++_0x73b4ed);}(_0xefd9,0x1dd));var _0x9efd=function(_0x9e35b6,_0x751f78){_0x9e35b6=_0x9e35b6-0x0;var _0x1b4bc6=_0xefd9[_0x9e35b6];return _0x1b4bc6;};'use strict';var _=require(_0x9efd('0x0'));var util=require('util');var logger=require(_0x9efd('0x1'))(_0x9efd('0x2'));var moment=require(_0x9efd('0x3'));var BPromise=require(_0x9efd('0x4'));var rp=require(_0x9efd('0x5'));var fs=require('fs');var path=require(_0x9efd('0x6'));var rimraf=require(_0x9efd('0x7'));var config=require(_0x9efd('0x8'));var attributes=require('./voiceCallReport.attributes');module[_0x9efd('0x9')]=function(_0x1900a6,_0x2ce4fb){return _0x1900a6[_0x9efd('0xa')](_0x9efd('0xb'),attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index c635caf..83f9085 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 _0x6d8c=['message','result','catch','GetVoiceCallReport','VoiceCallReport','options','raw','where','attributes','limit','include','map','model','then','stringify','create','body','CreateVoiceCallReport','UpdateVoiceCallReport','update','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x1d309b,_0x5f56f0){var _0x22d997=function(_0x3023be){while(--_0x3023be){_0x1d309b['push'](_0x1d309b['shift']());}};_0x22d997(++_0x5f56f0);}(_0x6d8c,0x89));var _0xc6d8=function(_0x24da33,_0xc48a65){_0x24da33=_0x24da33-0x0;var _0x189cda=_0x6d8c[_0x24da33];return _0x189cda;};'use strict';var _=require(_0xc6d8('0x0'));var util=require(_0xc6d8('0x1'));var moment=require(_0xc6d8('0x2'));var BPromise=require(_0xc6d8('0x3'));var rs=require(_0xc6d8('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc6d8('0x5'));var logger=require(_0xc6d8('0x6'))('rpc');var config=require(_0xc6d8('0x7'));var jayson=require(_0xc6d8('0x8'));var client=jayson[_0xc6d8('0x9')][_0xc6d8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x12077d,_0xb39154,_0x7767f8){return new BPromise(function(_0x32b600,_0x204bf9){return client[_0xc6d8('0xb')](_0x12077d,_0x7767f8)['then'](function(_0xc3ba0a){logger[_0xc6d8('0xc')](_0xc6d8('0xd'),_0xb39154,_0xc6d8('0xe'));logger[_0xc6d8('0xf')](_0xc6d8('0x10'),_0xb39154,'request\x20sent',JSON['stringify'](_0xc3ba0a));if(_0xc3ba0a['error']){if(_0xc3ba0a[_0xc6d8('0x11')][_0xc6d8('0x12')]===0x1f4){logger[_0xc6d8('0x11')](_0xc6d8('0xd'),_0xb39154,_0xc3ba0a['error'][_0xc6d8('0x13')]);return _0x204bf9(_0xc3ba0a[_0xc6d8('0x11')][_0xc6d8('0x13')]);}logger[_0xc6d8('0x11')](_0xc6d8('0xd'),_0xb39154,_0xc3ba0a['error']['message']);return _0x32b600(_0xc3ba0a['error']['message']);}else{logger['info'](_0xc6d8('0xd'),_0xb39154,'request\x20sent');_0x32b600(_0xc3ba0a[_0xc6d8('0x14')][_0xc6d8('0x13')]);}})[_0xc6d8('0x15')](function(_0x1cce59){logger[_0xc6d8('0x11')]('VoiceCallReport,\x20%s,\x20%s',_0xb39154,_0x1cce59);_0x204bf9(_0x1cce59);});});}exports[_0xc6d8('0x16')]=function(_0x175a74){var _0x16b75f=this;return new Promise(function(_0x258022,_0x459149){return db[_0xc6d8('0x17')]['findAll']({'raw':_0x175a74[_0xc6d8('0x18')]?_0x175a74[_0xc6d8('0x18')][_0xc6d8('0x19')]===undefined?!![]:![]:!![],'where':_0x175a74[_0xc6d8('0x18')]?_0x175a74[_0xc6d8('0x18')][_0xc6d8('0x1a')]||null:null,'attributes':_0x175a74['options']?_0x175a74['options'][_0xc6d8('0x1b')]||null:null,'limit':_0x175a74[_0xc6d8('0x18')]?_0x175a74[_0xc6d8('0x18')][_0xc6d8('0x1c')]||null:null,'include':_0x175a74[_0xc6d8('0x18')]?_0x175a74[_0xc6d8('0x18')][_0xc6d8('0x1d')]?_[_0xc6d8('0x1e')](_0x175a74[_0xc6d8('0x18')]['include'],function(_0x13d01f){return{'model':db[_0x13d01f[_0xc6d8('0x1f')]],'as':_0x13d01f['as'],'attributes':_0x13d01f[_0xc6d8('0x1b')],'include':_0x13d01f[_0xc6d8('0x1d')]?_[_0xc6d8('0x1e')](_0x13d01f['include'],function(_0x569949){return{'model':db[_0x569949[_0xc6d8('0x1f')]],'as':_0x569949['as'],'attributes':_0x569949[_0xc6d8('0x1b')],'include':_0x569949[_0xc6d8('0x1d')]?_[_0xc6d8('0x1e')](_0x569949['include'],function(_0x451a7e){return{'model':db[_0x451a7e[_0xc6d8('0x1f')]],'as':_0x451a7e['as'],'attributes':_0x451a7e[_0xc6d8('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xc6d8('0x20')](function(_0x35fdf9){logger['info'](_0xc6d8('0x16'),_0x175a74);logger['debug'](_0xc6d8('0x16'),_0x175a74,JSON[_0xc6d8('0x21')](_0x35fdf9));_0x258022(_0x35fdf9);})[_0xc6d8('0x15')](function(_0x34c8d7){logger[_0xc6d8('0x11')](_0xc6d8('0x16'),_0x34c8d7[_0xc6d8('0x13')],_0x175a74);_0x459149(_0x16b75f[_0xc6d8('0x11')](0x1f4,_0x34c8d7['message']));});});};exports['CreateVoiceCallReport']=function(_0x5e4929){var _0x51ed9b=this;return new Promise(function(_0x2262cc,_0xf9671c){return db[_0xc6d8('0x17')][_0xc6d8('0x22')](_0x5e4929[_0xc6d8('0x23')],{'raw':_0x5e4929[_0xc6d8('0x18')]?_0x5e4929['options']['raw']===undefined?!![]:![]:!![]})[_0xc6d8('0x20')](function(_0x3d4568){logger[_0xc6d8('0xc')](_0xc6d8('0x24'),_0x5e4929);logger[_0xc6d8('0xf')](_0xc6d8('0x24'),_0x5e4929,JSON[_0xc6d8('0x21')](_0x3d4568));_0x2262cc(_0x3d4568);})['catch'](function(_0xe4ac76){logger['error'](_0xc6d8('0x24'),_0xe4ac76[_0xc6d8('0x13')],_0x5e4929);_0xf9671c(_0x51ed9b[_0xc6d8('0x11')](0x1f4,_0xe4ac76['message']));});});};exports[_0xc6d8('0x25')]=function(_0x37584e){var _0x230292=this;return new Promise(function(_0x3217f3,_0x3ffe9e){return db[_0xc6d8('0x17')][_0xc6d8('0x26')](_0x37584e['body'],{'raw':_0x37584e['options']?_0x37584e['options'][_0xc6d8('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x37584e['options']?_0x37584e[_0xc6d8('0x18')][_0xc6d8('0x1a')]||null:null,'attributes':_0x37584e['options']?_0x37584e[_0xc6d8('0x18')][_0xc6d8('0x1b')]||null:null,'limit':_0x37584e[_0xc6d8('0x18')]?_0x37584e[_0xc6d8('0x18')][_0xc6d8('0x1c')]||null:null})[_0xc6d8('0x20')](function(_0x412586){logger['info'](_0xc6d8('0x25'),_0x37584e);logger[_0xc6d8('0xf')](_0xc6d8('0x25'),_0x37584e,JSON['stringify'](_0x412586));_0x3217f3(_0x412586);})[_0xc6d8('0x15')](function(_0x2b602a){logger[_0xc6d8('0x11')](_0xc6d8('0x25'),_0x2b602a[_0xc6d8('0x13')],_0x37584e);_0x3ffe9e(_0x230292['error'](0x1f4,_0x2b602a['message']));});});}; \ No newline at end of file +var _0x45e5=['VoiceCallReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','findAll','options','raw','where','attributes','include','map','model','GetVoiceCallReport','stringify','VoiceCallReport','create','body','CreateVoiceCallReport','UpdateVoiceCallReport','update','limit','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','client','http','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x5a69ee,_0x2722a7){var _0x2dd358=function(_0x41d819){while(--_0x41d819){_0x5a69ee['push'](_0x5a69ee['shift']());}};_0x2dd358(++_0x2722a7);}(_0x45e5,0x13f));var _0x545e=function(_0x1e243b,_0x272660){_0x1e243b=_0x1e243b-0x0;var _0xffe8af=_0x45e5[_0x1e243b];return _0xffe8af;};'use strict';var _=require(_0x545e('0x0'));var util=require(_0x545e('0x1'));var moment=require('moment');var BPromise=require(_0x545e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x545e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x545e('0x4'));var logger=require(_0x545e('0x5'))(_0x545e('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x545e('0x7')][_0x545e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1f60ce,_0x3ac7d5,_0x56f32e){return new BPromise(function(_0x1220c5,_0x340ce3){return client['request'](_0x1f60ce,_0x56f32e)[_0x545e('0x9')](function(_0x452027){logger[_0x545e('0xa')](_0x545e('0xb'),_0x3ac7d5,_0x545e('0xc'));logger[_0x545e('0xd')](_0x545e('0xe'),_0x3ac7d5,_0x545e('0xc'),JSON['stringify'](_0x452027));if(_0x452027['error']){if(_0x452027[_0x545e('0xf')][_0x545e('0x10')]===0x1f4){logger[_0x545e('0xf')](_0x545e('0xb'),_0x3ac7d5,_0x452027[_0x545e('0xf')][_0x545e('0x11')]);return _0x340ce3(_0x452027[_0x545e('0xf')][_0x545e('0x11')]);}logger[_0x545e('0xf')](_0x545e('0xb'),_0x3ac7d5,_0x452027['error'][_0x545e('0x11')]);return _0x1220c5(_0x452027[_0x545e('0xf')][_0x545e('0x11')]);}else{logger[_0x545e('0xa')](_0x545e('0xb'),_0x3ac7d5,_0x545e('0xc'));_0x1220c5(_0x452027[_0x545e('0x12')][_0x545e('0x11')]);}})[_0x545e('0x13')](function(_0x26bb2d){logger[_0x545e('0xf')](_0x545e('0xb'),_0x3ac7d5,_0x26bb2d);_0x340ce3(_0x26bb2d);});});}exports['GetVoiceCallReport']=function(_0x3f03a3){var _0x26a2f6=this;return new Promise(function(_0x1af93e,_0x37b74a){return db['VoiceCallReport'][_0x545e('0x14')]({'raw':_0x3f03a3[_0x545e('0x15')]?_0x3f03a3[_0x545e('0x15')][_0x545e('0x16')]===undefined?!![]:![]:!![],'where':_0x3f03a3[_0x545e('0x15')]?_0x3f03a3[_0x545e('0x15')][_0x545e('0x17')]||null:null,'attributes':_0x3f03a3[_0x545e('0x15')]?_0x3f03a3[_0x545e('0x15')][_0x545e('0x18')]||null:null,'limit':_0x3f03a3['options']?_0x3f03a3[_0x545e('0x15')]['limit']||null:null,'include':_0x3f03a3[_0x545e('0x15')]?_0x3f03a3[_0x545e('0x15')][_0x545e('0x19')]?_[_0x545e('0x1a')](_0x3f03a3[_0x545e('0x15')][_0x545e('0x19')],function(_0x58f486){return{'model':db[_0x58f486[_0x545e('0x1b')]],'as':_0x58f486['as'],'attributes':_0x58f486[_0x545e('0x18')],'include':_0x58f486[_0x545e('0x19')]?_['map'](_0x58f486['include'],function(_0x15e5bf){return{'model':db[_0x15e5bf[_0x545e('0x1b')]],'as':_0x15e5bf['as'],'attributes':_0x15e5bf[_0x545e('0x18')],'include':_0x15e5bf[_0x545e('0x19')]?_['map'](_0x15e5bf['include'],function(_0x4e5d9d){return{'model':db[_0x4e5d9d[_0x545e('0x1b')]],'as':_0x4e5d9d['as'],'attributes':_0x4e5d9d['attributes']};}):[]};}):[]};}):[]:[]})[_0x545e('0x9')](function(_0x17e482){logger[_0x545e('0xa')](_0x545e('0x1c'),_0x3f03a3);logger[_0x545e('0xd')]('GetVoiceCallReport',_0x3f03a3,JSON[_0x545e('0x1d')](_0x17e482));_0x1af93e(_0x17e482);})[_0x545e('0x13')](function(_0x33dca3){logger[_0x545e('0xf')](_0x545e('0x1c'),_0x33dca3[_0x545e('0x11')],_0x3f03a3);_0x37b74a(_0x26a2f6['error'](0x1f4,_0x33dca3[_0x545e('0x11')]));});});};exports['CreateVoiceCallReport']=function(_0x26b7cf){var _0x4a698a=this;return new Promise(function(_0x56e09c,_0x2576c5){return db[_0x545e('0x1e')][_0x545e('0x1f')](_0x26b7cf[_0x545e('0x20')],{'raw':_0x26b7cf[_0x545e('0x15')]?_0x26b7cf['options'][_0x545e('0x16')]===undefined?!![]:![]:!![]})[_0x545e('0x9')](function(_0xdff3a){logger[_0x545e('0xa')]('CreateVoiceCallReport',_0x26b7cf);logger[_0x545e('0xd')](_0x545e('0x21'),_0x26b7cf,JSON[_0x545e('0x1d')](_0xdff3a));_0x56e09c(_0xdff3a);})[_0x545e('0x13')](function(_0xfdcb43){logger['error'](_0x545e('0x21'),_0xfdcb43[_0x545e('0x11')],_0x26b7cf);_0x2576c5(_0x4a698a[_0x545e('0xf')](0x1f4,_0xfdcb43[_0x545e('0x11')]));});});};exports[_0x545e('0x22')]=function(_0x276f11){var _0x449dd6=this;return new Promise(function(_0x32d5db,_0x582851){return db[_0x545e('0x1e')][_0x545e('0x23')](_0x276f11[_0x545e('0x20')],{'raw':_0x276f11['options']?_0x276f11[_0x545e('0x15')][_0x545e('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x276f11[_0x545e('0x15')]?_0x276f11[_0x545e('0x15')][_0x545e('0x17')]||null:null,'attributes':_0x276f11[_0x545e('0x15')]?_0x276f11[_0x545e('0x15')][_0x545e('0x18')]||null:null,'limit':_0x276f11[_0x545e('0x15')]?_0x276f11[_0x545e('0x15')][_0x545e('0x24')]||null:null})['then'](function(_0x51c0a3){logger['info'](_0x545e('0x22'),_0x276f11);logger[_0x545e('0xd')]('UpdateVoiceCallReport',_0x276f11,JSON['stringify'](_0x51c0a3));_0x32d5db(_0x51c0a3);})[_0x545e('0x13')](function(_0x4a95c8){logger[_0x545e('0xf')]('UpdateVoiceCallReport',_0x4a95c8[_0x545e('0x11')],_0x276f11);_0x582851(_0x449dd6[_0x545e('0xf')](0x1f4,_0x4a95c8[_0x545e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 01b1014..cfcb11d 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 _0x4097=['exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','show','post','isAuthenticated','create','put','update','delete'];(function(_0x1100e0,_0x4d8ae5){var _0x303353=function(_0x4d21f6){while(--_0x4d21f6){_0x1100e0['push'](_0x1100e0['shift']());}};_0x303353(++_0x4d8ae5);}(_0x4097,0x169));var _0x7409=function(_0x628729,_0x4b3aca){_0x628729=_0x628729-0x0;var _0x5b5dad=_0x4097[_0x628729];return _0x5b5dad;};'use strict';var multer=require(_0x7409('0x0'));var util=require(_0x7409('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x7409('0x2'));var router=express[_0x7409('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x7409('0x4'));var interaction=require(_0x7409('0x5'));var config=require(_0x7409('0x6'));var controller=require('./voiceChanSpy.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller[_0x7409('0x7')]);router[_0x7409('0x8')]('/',auth[_0x7409('0x9')](),controller[_0x7409('0xa')]);router[_0x7409('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x7409('0xc')]);router[_0x7409('0xd')]('/:id',auth[_0x7409('0x9')](),controller['destroy']);module[_0x7409('0xe')]=router; \ No newline at end of file +var _0xad5c=['post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show'];(function(_0x47aa64,_0xfb8a07){var _0x549c7a=function(_0x266165){while(--_0x266165){_0x47aa64['push'](_0x47aa64['shift']());}};_0x549c7a(++_0xfb8a07);}(_0xad5c,0x1ce));var _0xcad5=function(_0x38c4b2,_0x551354){_0x38c4b2=_0x38c4b2-0x0;var _0x5b0759=_0xad5c[_0x38c4b2];return _0x5b0759;};'use strict';var multer=require(_0xcad5('0x0'));var util=require(_0xcad5('0x1'));var path=require(_0xcad5('0x2'));var timeout=require(_0xcad5('0x3'));var express=require('express');var router=express[_0xcad5('0x4')]();var fs_extra=require(_0xcad5('0x5'));var auth=require(_0xcad5('0x6'));var interaction=require(_0xcad5('0x7'));var config=require('../../config/environment');var controller=require('./voiceChanSpy.controller');router[_0xcad5('0x8')]('/',auth[_0xcad5('0x9')](),controller[_0xcad5('0xa')]);router[_0xcad5('0x8')](_0xcad5('0xb'),auth[_0xcad5('0x9')](),controller[_0xcad5('0xc')]);router[_0xcad5('0xd')]('/',auth[_0xcad5('0x9')](),controller[_0xcad5('0xe')]);router[_0xcad5('0xf')](_0xcad5('0xb'),auth[_0xcad5('0x9')](),controller['update']);router[_0xcad5('0x10')](_0xcad5('0xb'),auth[_0xcad5('0x9')](),controller[_0xcad5('0x11')]);module[_0xcad5('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index a650548..30e2411 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 _0x14d6=['sequelize','STRING','name','options','getDataValue','BOOLEAN'];(function(_0x1363a6,_0x5b71e6){var _0x41f342=function(_0x20d2e6){while(--_0x20d2e6){_0x1363a6['push'](_0x1363a6['shift']());}};_0x41f342(++_0x5b71e6);}(_0x14d6,0x66));var _0x614d=function(_0x35e1f8,_0x5501d9){_0x35e1f8=_0x35e1f8-0x0;var _0x497b8d=_0x14d6[_0x35e1f8];return _0x497b8d;};'use strict';var Sequelize=require(_0x614d('0x0'));module['exports']={'name':{'type':Sequelize[_0x614d('0x1')]},'prefix':{'type':Sequelize['STRING'],'unique':_0x614d('0x2'),'allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x16e2a8){this['setDataValue'](_0x614d('0x3'),_0x16e2a8?_0x16e2a8['join'](''):[]);},'get':function(){return this[_0x614d('0x4')](_0x614d('0x3'))?this[_0x614d('0x4')]('options')['split'](''):[];}},'auth':{'type':Sequelize[_0x614d('0x5')],'defaultValue':![]},'password':{'type':Sequelize[_0x614d('0x1')]},'record':{'type':Sequelize[_0x614d('0x5')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x614d('0x1')]},'description':{'type':Sequelize[_0x614d('0x1')]}}; \ No newline at end of file +var _0x8d1a=['split','BOOLEAN','sequelize','exports','STRING','name','options','join','getDataValue'];(function(_0xbcd801,_0xc054){var _0x461981=function(_0x22fa9c){while(--_0x22fa9c){_0xbcd801['push'](_0xbcd801['shift']());}};_0x461981(++_0xc054);}(_0x8d1a,0x1a9));var _0xa8d1=function(_0x4d843f,_0x4a4401){_0x4d843f=_0x4d843f-0x0;var _0x58a99e=_0x8d1a[_0x4d843f];return _0x58a99e;};'use strict';var Sequelize=require(_0xa8d1('0x0'));module[_0xa8d1('0x1')]={'name':{'type':Sequelize[_0xa8d1('0x2')]},'prefix':{'type':Sequelize[_0xa8d1('0x2')],'unique':_0xa8d1('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0xa8d1('0x2')],'set':function(_0x35394f){this['setDataValue'](_0xa8d1('0x4'),_0x35394f?_0x35394f[_0xa8d1('0x5')](''):[]);},'get':function(){return this['getDataValue'](_0xa8d1('0x4'))?this[_0xa8d1('0x6')](_0xa8d1('0x4'))[_0xa8d1('0x7')](''):[];}},'auth':{'type':Sequelize[_0xa8d1('0x8')],'defaultValue':![]},'password':{'type':Sequelize[_0xa8d1('0x2')]},'record':{'type':Sequelize[_0xa8d1('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa8d1('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index d798505..ab557d2 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 _0xcfac=['keys','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','limit','count','offset','reject','update','then','get','ChanSpies','UserProfileResource','destroy','error','stack','name','send','index','map','VoiceChanSpy','rawAttributes','fieldName','type','key','model','filters','intersection','query','fields','attributes','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','catch','params'];(function(_0x59cb2c,_0x5b452c){var _0x552034=function(_0x29556c){while(--_0x29556c){_0x59cb2c['push'](_0x59cb2c['shift']());}};_0x552034(++_0x5b452c);}(_0xcfac,0x105));var _0xccfa=function(_0x215d3a,_0x59e31e){_0x215d3a=_0x215d3a-0x0;var _0x274f0c=_0xcfac[_0x215d3a];return _0x274f0c;};'use strict';var emlformat=require(_0xccfa('0x0'));var rimraf=require(_0xccfa('0x1'));var zipdir=require(_0xccfa('0x2'));var jsonpatch=require(_0xccfa('0x3'));var rp=require(_0xccfa('0x4'));var moment=require(_0xccfa('0x5'));var BPromise=require(_0xccfa('0x6'));var Mustache=require(_0xccfa('0x7'));var util=require(_0xccfa('0x8'));var path=require('path');var sox=require(_0xccfa('0x9'));var csv=require(_0xccfa('0xa'));var ejs=require(_0xccfa('0xb'));var fs=require('fs');var fs_extra=require(_0xccfa('0xc'));var _=require(_0xccfa('0xd'));var squel=require(_0xccfa('0xe'));var crypto=require(_0xccfa('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xccfa('0x10'));var toCsv=require(_0xccfa('0xa'));var querystring=require(_0xccfa('0x11'));var Papa=require(_0xccfa('0x12'));var Redis=require(_0xccfa('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xccfa('0x14'));var as=require(_0xccfa('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xccfa('0x16'))(_0xccfa('0x17'));var utils=require(_0xccfa('0x18'));var config=require(_0xccfa('0x19'));var licenseUtil=require(_0xccfa('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x29d643,_0x28d4e9){_0x28d4e9=_0x28d4e9||0xcc;return function(_0x73ab6d){if(_0x73ab6d){return _0x29d643[_0xccfa('0x1b')](_0x28d4e9);}return _0x29d643[_0xccfa('0x1c')](_0x28d4e9)[_0xccfa('0x1d')]();};}function respondWithResult(_0x11e577,_0xc43ebe){_0xc43ebe=_0xc43ebe||0xc8;return function(_0x411a73){if(_0x411a73){return _0x11e577[_0xccfa('0x1c')](_0xc43ebe)[_0xccfa('0x1e')](_0x411a73);}};}function respondWithFilteredResult(_0x2bcf8e,_0x4e83d6){return function(_0x89103f){if(_0x89103f){var _0x258db6=typeof _0x4e83d6['offset']==='undefined'&&typeof _0x4e83d6[_0xccfa('0x1f')]==='undefined';var _0x46cca0=_0x89103f[_0xccfa('0x20')];var _0x59c660=_0x258db6?0x0:_0x4e83d6['offset'];var _0xa3658=_0x258db6?_0x89103f[_0xccfa('0x20')]:_0x4e83d6[_0xccfa('0x21')]+_0x4e83d6[_0xccfa('0x1f')];var _0x3cc107;if(_0xa3658>=_0x46cca0){_0xa3658=_0x46cca0;_0x3cc107=0xc8;}else{_0x3cc107=0xce;}_0x2bcf8e[_0xccfa('0x1c')](_0x3cc107);return _0x2bcf8e['set']('Content-Range',_0x59c660+'-'+_0xa3658+'/'+_0x46cca0)['json'](_0x89103f);}return null;};}function patchUpdates(_0x23d235){return function(_0x4bdb04){try{jsonpatch['apply'](_0x4bdb04,_0x23d235,!![]);}catch(_0x4ff928){return BPromise[_0xccfa('0x22')](_0x4ff928);}return _0x4bdb04['save']();};}function saveUpdates(_0x5abfb6,_0x471e59){return function(_0x39b373){if(_0x39b373){return _0x39b373[_0xccfa('0x23')](_0x5abfb6)[_0xccfa('0x24')](function(_0x56b53c){return _0x56b53c;});}return null;};}function removeEntity(_0xbedc9,_0x485e6f){return function(_0x58cc2c){if(_0x58cc2c){return _0x58cc2c['destroy']()[_0xccfa('0x24')](function(){var _0x2b4a96=_0x58cc2c[_0xccfa('0x25')]({'plain':!![]});var _0x5cae20=_0xccfa('0x26');return db[_0xccfa('0x27')][_0xccfa('0x28')]({'where':{'type':_0x5cae20,'resourceId':_0x2b4a96['id']}})[_0xccfa('0x24')](function(){return _0x58cc2c;});})[_0xccfa('0x24')](function(){_0xbedc9[_0xccfa('0x1c')](0xcc)[_0xccfa('0x1d')]();});}};}function handleEntityNotFound(_0x40b2a4,_0x5c843c){return function(_0x113ef1){if(!_0x113ef1){_0x40b2a4[_0xccfa('0x1b')](0x194);}return _0x113ef1;};}function handleError(_0x18dccb,_0xae8934){_0xae8934=_0xae8934||0x1f4;return function(_0x1ae5a2){logger[_0xccfa('0x29')](_0x1ae5a2[_0xccfa('0x2a')]);if(_0x1ae5a2[_0xccfa('0x2b')]){delete _0x1ae5a2[_0xccfa('0x2b')];}_0x18dccb['status'](_0xae8934)[_0xccfa('0x2c')](_0x1ae5a2);};}exports[_0xccfa('0x2d')]=function(_0x28d008,_0x3b1488){var _0xfae349={},_0x29327b={},_0xb6d80a={'count':0x0,'rows':[]};var _0x1c140c=_[_0xccfa('0x2e')](db[_0xccfa('0x2f')][_0xccfa('0x30')],function(_0x321354){return{'name':_0x321354[_0xccfa('0x31')],'type':_0x321354[_0xccfa('0x32')][_0xccfa('0x33')]};});_0x29327b[_0xccfa('0x34')]=_[_0xccfa('0x2e')](_0x1c140c,_0xccfa('0x2b'));_0x29327b['query']=_['keys'](_0x28d008['query']);_0x29327b[_0xccfa('0x35')]=_[_0xccfa('0x36')](_0x29327b[_0xccfa('0x34')],_0x29327b[_0xccfa('0x37')]);_0xfae349['attributes']=_['intersection'](_0x29327b[_0xccfa('0x34')],qs[_0xccfa('0x38')](_0x28d008['query']['fields']));_0xfae349['attributes']=_0xfae349[_0xccfa('0x39')]['length']?_0xfae349['attributes']:_0x29327b[_0xccfa('0x34')];if(!_0x28d008[_0xccfa('0x37')][_0xccfa('0x3a')](_0xccfa('0x3b'))){_0xfae349[_0xccfa('0x1f')]=qs[_0xccfa('0x1f')](_0x28d008[_0xccfa('0x37')][_0xccfa('0x1f')]);_0xfae349[_0xccfa('0x21')]=qs[_0xccfa('0x21')](_0x28d008[_0xccfa('0x37')]['offset']);}_0xfae349[_0xccfa('0x3c')]=qs['sort'](_0x28d008['query']['sort']);_0xfae349[_0xccfa('0x3d')]=qs[_0xccfa('0x35')](_[_0xccfa('0x3e')](_0x28d008['query'],_0x29327b['filters']),_0x1c140c);if(_0x28d008['query'][_0xccfa('0x3f')]){_0xfae349[_0xccfa('0x3d')]=_[_0xccfa('0x40')](_0xfae349[_0xccfa('0x3d')],{'$or':_[_0xccfa('0x2e')](_0x1c140c,function(_0x122fc7){if(_0x122fc7[_0xccfa('0x32')]!==_0xccfa('0x41')){var _0xc51cc6={};_0xc51cc6[_0x122fc7[_0xccfa('0x2b')]]={'$like':'%'+_0x28d008[_0xccfa('0x37')]['filter']+'%'};return _0xc51cc6;}})});}_0xfae349=_['merge']({},_0xfae349,_0x28d008['options']);var _0x52b93c={'where':_0xfae349[_0xccfa('0x3d')]};return db[_0xccfa('0x2f')][_0xccfa('0x20')](_0x52b93c)[_0xccfa('0x24')](function(_0x51b0a0){_0xb6d80a[_0xccfa('0x20')]=_0x51b0a0;if(_0x28d008[_0xccfa('0x37')][_0xccfa('0x42')]){_0xfae349[_0xccfa('0x43')]=[{'all':!![]}];}return db['VoiceChanSpy']['findAll'](_0xfae349);})[_0xccfa('0x24')](function(_0x2d19fb){_0xb6d80a[_0xccfa('0x44')]=_0x2d19fb;return _0xb6d80a;})[_0xccfa('0x24')](respondWithFilteredResult(_0x3b1488,_0xfae349))[_0xccfa('0x45')](handleError(_0x3b1488,null));};exports['show']=function(_0x237b76,_0x14aa03){var _0x7a2990={'raw':![],'where':{'id':_0x237b76[_0xccfa('0x46')]['id']}},_0x492366={};_0x492366['model']=_['keys'](db[_0xccfa('0x2f')][_0xccfa('0x30')]);_0x492366[_0xccfa('0x37')]=_[_0xccfa('0x47')](_0x237b76[_0xccfa('0x37')]);_0x492366[_0xccfa('0x35')]=_['intersection'](_0x492366[_0xccfa('0x34')],_0x492366['query']);_0x7a2990['attributes']=_[_0xccfa('0x36')](_0x492366[_0xccfa('0x34')],qs[_0xccfa('0x38')](_0x237b76[_0xccfa('0x37')][_0xccfa('0x38')]));_0x7a2990[_0xccfa('0x39')]=_0x7a2990[_0xccfa('0x39')][_0xccfa('0x48')]?_0x7a2990[_0xccfa('0x39')]:_0x492366[_0xccfa('0x34')];if(_0x237b76[_0xccfa('0x37')][_0xccfa('0x42')]){_0x7a2990[_0xccfa('0x43')]=[{'all':!![]}];}_0x7a2990=_[_0xccfa('0x40')]({},_0x7a2990,_0x237b76['options']);return db[_0xccfa('0x2f')][_0xccfa('0x49')](_0x7a2990)[_0xccfa('0x24')](handleEntityNotFound(_0x14aa03,null))['then'](respondWithResult(_0x14aa03,null))['catch'](handleError(_0x14aa03,null));};exports[_0xccfa('0x4a')]=function(_0x291061,_0x3d9d85){return db['VoiceChanSpy']['create'](_0x291061[_0xccfa('0x4b')],{})['then'](function(_0xbac28c){var _0x5c2fa8=_0x291061[_0xccfa('0x4c')][_0xccfa('0x25')]({'plain':!![]});if(!_0x5c2fa8)throw new Error(_0xccfa('0x4d'));if(_0x5c2fa8[_0xccfa('0x4e')]===_0xccfa('0x4c')){var _0x3ad03a=_0xbac28c[_0xccfa('0x25')]({'plain':!![]});var _0x24bc69=_0xccfa('0x26');return db[_0xccfa('0x4f')]['find']({'where':{'name':_0x24bc69,'userProfileId':_0x5c2fa8[_0xccfa('0x50')]},'raw':!![]})[_0xccfa('0x24')](function(_0x531c0f){if(_0x531c0f&&_0x531c0f[_0xccfa('0x51')]===0x0){return db[_0xccfa('0x27')][_0xccfa('0x4a')]({'name':_0x3ad03a[_0xccfa('0x2b')],'resourceId':_0x3ad03a['id'],'type':_0x531c0f[_0xccfa('0x2b')],'sectionId':_0x531c0f['id']},{})[_0xccfa('0x24')](function(){return _0xbac28c;});}else{return _0xbac28c;}})[_0xccfa('0x45')](function(_0x15e661){logger['error'](_0xccfa('0x52'),_0x15e661);throw _0x15e661;});}return _0xbac28c;})[_0xccfa('0x24')](respondWithResult(_0x3d9d85,0xc9))['catch'](handleError(_0x3d9d85,null));};exports[_0xccfa('0x23')]=function(_0x1099c7,_0xb6cea9){if(_0x1099c7[_0xccfa('0x4b')]['id']){delete _0x1099c7[_0xccfa('0x4b')]['id'];}return db['VoiceChanSpy']['find']({'where':{'id':_0x1099c7[_0xccfa('0x46')]['id']}})[_0xccfa('0x24')](handleEntityNotFound(_0xb6cea9,null))[_0xccfa('0x24')](saveUpdates(_0x1099c7['body'],null))[_0xccfa('0x24')](respondWithResult(_0xb6cea9,null))[_0xccfa('0x45')](handleError(_0xb6cea9,null));};exports['destroy']=function(_0x3d2999,_0x58cf3e){return db['VoiceChanSpy'][_0xccfa('0x49')]({'where':{'id':_0x3d2999['params']['id']}})[_0xccfa('0x24')](handleEntityNotFound(_0x58cf3e,null))[_0xccfa('0x24')](removeEntity(_0x58cf3e,null))[_0xccfa('0x45')](handleError(_0x58cf3e,null));}; \ No newline at end of file +var _0x99e9=['show','params','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','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','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','destroy','then','get','UserProfileResource','error','name','send','index','map','VoiceChanSpy','rawAttributes','fieldName','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','where','merge','type','VIRTUAL','options','include','findAll','rows','catch'];(function(_0x1edab9,_0x466cf1){var _0x15e66b=function(_0x3e3263){while(--_0x3e3263){_0x1edab9['push'](_0x1edab9['shift']());}};_0x15e66b(++_0x466cf1);}(_0x99e9,0xb4));var _0x999e=function(_0xa8369a,_0x3d2319){_0xa8369a=_0xa8369a-0x0;var _0x4b74b7=_0x99e9[_0xa8369a];return _0x4b74b7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x999e('0x0'));var zipdir=require(_0x999e('0x1'));var jsonpatch=require(_0x999e('0x2'));var rp=require(_0x999e('0x3'));var moment=require('moment');var BPromise=require(_0x999e('0x4'));var Mustache=require(_0x999e('0x5'));var util=require(_0x999e('0x6'));var path=require('path');var sox=require(_0x999e('0x7'));var csv=require('to-csv');var ejs=require(_0x999e('0x8'));var fs=require('fs');var fs_extra=require(_0x999e('0x9'));var _=require(_0x999e('0xa'));var squel=require(_0x999e('0xb'));var crypto=require('crypto');var jsforce=require(_0x999e('0xc'));var deskjs=require(_0x999e('0xd'));var toCsv=require(_0x999e('0xe'));var querystring=require(_0x999e('0xf'));var Papa=require(_0x999e('0x10'));var Redis=require(_0x999e('0x11'));var authService=require(_0x999e('0x12'));var qs=require(_0x999e('0x13'));var as=require(_0x999e('0x14'));var hardwareService=require(_0x999e('0x15'));var logger=require(_0x999e('0x16'))(_0x999e('0x17'));var utils=require(_0x999e('0x18'));var config=require(_0x999e('0x19'));var licenseUtil=require(_0x999e('0x1a'));var db=require(_0x999e('0x1b'))['db'];function respondWithStatusCode(_0x26b55a,_0x47a3c1){_0x47a3c1=_0x47a3c1||0xcc;return function(_0x15f771){if(_0x15f771){return _0x26b55a['sendStatus'](_0x47a3c1);}return _0x26b55a[_0x999e('0x1c')](_0x47a3c1)[_0x999e('0x1d')]();};}function respondWithResult(_0x2fbc3e,_0x538a92){_0x538a92=_0x538a92||0xc8;return function(_0x28bdd1){if(_0x28bdd1){return _0x2fbc3e['status'](_0x538a92)[_0x999e('0x1e')](_0x28bdd1);}};}function respondWithFilteredResult(_0x539598,_0x549ad4){return function(_0x1eee64){if(_0x1eee64){var _0x22feac=typeof _0x549ad4[_0x999e('0x1f')]===_0x999e('0x20')&&typeof _0x549ad4[_0x999e('0x21')]===_0x999e('0x20');var _0x4aac66=_0x1eee64['count'];var _0x4fcdfb=_0x22feac?0x0:_0x549ad4[_0x999e('0x1f')];var _0x43b09e=_0x22feac?_0x1eee64[_0x999e('0x22')]:_0x549ad4[_0x999e('0x1f')]+_0x549ad4[_0x999e('0x21')];var _0x3ece5e;if(_0x43b09e>=_0x4aac66){_0x43b09e=_0x4aac66;_0x3ece5e=0xc8;}else{_0x3ece5e=0xce;}_0x539598['status'](_0x3ece5e);return _0x539598['set'](_0x999e('0x23'),_0x4fcdfb+'-'+_0x43b09e+'/'+_0x4aac66)[_0x999e('0x1e')](_0x1eee64);}return null;};}function patchUpdates(_0x3b3642){return function(_0x510fa2){try{jsonpatch[_0x999e('0x24')](_0x510fa2,_0x3b3642,!![]);}catch(_0x42e167){return BPromise[_0x999e('0x25')](_0x42e167);}return _0x510fa2[_0x999e('0x26')]();};}function saveUpdates(_0x373b80,_0x3750a0){return function(_0x427bcf){if(_0x427bcf){return _0x427bcf['update'](_0x373b80)['then'](function(_0x11a6bf){return _0x11a6bf;});}return null;};}function removeEntity(_0x4f0091,_0x4c5491){return function(_0x452acd){if(_0x452acd){return _0x452acd[_0x999e('0x27')]()[_0x999e('0x28')](function(){var _0x13027c=_0x452acd[_0x999e('0x29')]({'plain':!![]});var _0x320634='ChanSpies';return db[_0x999e('0x2a')][_0x999e('0x27')]({'where':{'type':_0x320634,'resourceId':_0x13027c['id']}})[_0x999e('0x28')](function(){return _0x452acd;});})[_0x999e('0x28')](function(){_0x4f0091[_0x999e('0x1c')](0xcc)[_0x999e('0x1d')]();});}};}function handleEntityNotFound(_0x44b790,_0x5798f3){return function(_0x28f803){if(!_0x28f803){_0x44b790['sendStatus'](0x194);}return _0x28f803;};}function handleError(_0x4fed13,_0x3dff6b){_0x3dff6b=_0x3dff6b||0x1f4;return function(_0x1059bd){logger[_0x999e('0x2b')](_0x1059bd['stack']);if(_0x1059bd[_0x999e('0x2c')]){delete _0x1059bd[_0x999e('0x2c')];}_0x4fed13[_0x999e('0x1c')](_0x3dff6b)[_0x999e('0x2d')](_0x1059bd);};}exports[_0x999e('0x2e')]=function(_0x327079,_0x82e067){var _0x2e9b0e={},_0x27102b={},_0x3ddacb={'count':0x0,'rows':[]};var _0x53ece1=_[_0x999e('0x2f')](db[_0x999e('0x30')][_0x999e('0x31')],function(_0x4c2ce8){return{'name':_0x4c2ce8[_0x999e('0x32')],'type':_0x4c2ce8['type']['key']};});_0x27102b[_0x999e('0x33')]=_[_0x999e('0x2f')](_0x53ece1,'name');_0x27102b['query']=_[_0x999e('0x34')](_0x327079[_0x999e('0x35')]);_0x27102b[_0x999e('0x36')]=_[_0x999e('0x37')](_0x27102b['model'],_0x27102b[_0x999e('0x35')]);_0x2e9b0e[_0x999e('0x38')]=_[_0x999e('0x37')](_0x27102b[_0x999e('0x33')],qs['fields'](_0x327079['query'][_0x999e('0x39')]));_0x2e9b0e['attributes']=_0x2e9b0e[_0x999e('0x38')][_0x999e('0x3a')]?_0x2e9b0e[_0x999e('0x38')]:_0x27102b[_0x999e('0x33')];if(!_0x327079['query'][_0x999e('0x3b')](_0x999e('0x3c'))){_0x2e9b0e['limit']=qs['limit'](_0x327079[_0x999e('0x35')]['limit']);_0x2e9b0e[_0x999e('0x1f')]=qs['offset'](_0x327079['query']['offset']);}_0x2e9b0e['order']=qs[_0x999e('0x3d')](_0x327079['query'][_0x999e('0x3d')]);_0x2e9b0e['where']=qs['filters'](_['pick'](_0x327079[_0x999e('0x35')],_0x27102b[_0x999e('0x36')]),_0x53ece1);if(_0x327079[_0x999e('0x35')][_0x999e('0x3e')]){_0x2e9b0e[_0x999e('0x3f')]=_[_0x999e('0x40')](_0x2e9b0e[_0x999e('0x3f')],{'$or':_[_0x999e('0x2f')](_0x53ece1,function(_0x54866a){if(_0x54866a[_0x999e('0x41')]!==_0x999e('0x42')){var _0x1e1229={};_0x1e1229[_0x54866a[_0x999e('0x2c')]]={'$like':'%'+_0x327079['query'][_0x999e('0x3e')]+'%'};return _0x1e1229;}})});}_0x2e9b0e=_['merge']({},_0x2e9b0e,_0x327079[_0x999e('0x43')]);var _0x35b318={'where':_0x2e9b0e[_0x999e('0x3f')]};return db[_0x999e('0x30')]['count'](_0x35b318)[_0x999e('0x28')](function(_0x108c96){_0x3ddacb[_0x999e('0x22')]=_0x108c96;if(_0x327079['query']['includeAll']){_0x2e9b0e[_0x999e('0x44')]=[{'all':!![]}];}return db[_0x999e('0x30')][_0x999e('0x45')](_0x2e9b0e);})[_0x999e('0x28')](function(_0x1009a0){_0x3ddacb[_0x999e('0x46')]=_0x1009a0;return _0x3ddacb;})[_0x999e('0x28')](respondWithFilteredResult(_0x82e067,_0x2e9b0e))[_0x999e('0x47')](handleError(_0x82e067,null));};exports[_0x999e('0x48')]=function(_0xf4fa,_0x55da0b){var _0x4c8b36={'raw':![],'where':{'id':_0xf4fa[_0x999e('0x49')]['id']}},_0xa5742d={};_0xa5742d[_0x999e('0x33')]=_[_0x999e('0x34')](db[_0x999e('0x30')][_0x999e('0x31')]);_0xa5742d['query']=_[_0x999e('0x34')](_0xf4fa['query']);_0xa5742d['filters']=_[_0x999e('0x37')](_0xa5742d['model'],_0xa5742d['query']);_0x4c8b36['attributes']=_['intersection'](_0xa5742d[_0x999e('0x33')],qs[_0x999e('0x39')](_0xf4fa['query'][_0x999e('0x39')]));_0x4c8b36[_0x999e('0x38')]=_0x4c8b36[_0x999e('0x38')]['length']?_0x4c8b36['attributes']:_0xa5742d[_0x999e('0x33')];if(_0xf4fa[_0x999e('0x35')][_0x999e('0x4a')]){_0x4c8b36['include']=[{'all':!![]}];}_0x4c8b36=_['merge']({},_0x4c8b36,_0xf4fa['options']);return db['VoiceChanSpy'][_0x999e('0x4b')](_0x4c8b36)['then'](handleEntityNotFound(_0x55da0b,null))['then'](respondWithResult(_0x55da0b,null))[_0x999e('0x47')](handleError(_0x55da0b,null));};exports[_0x999e('0x4c')]=function(_0x5843f1,_0xa50dc6){return db[_0x999e('0x30')]['create'](_0x5843f1[_0x999e('0x4d')],{})['then'](function(_0x9322ca){var _0x42dfea=_0x5843f1['user'][_0x999e('0x29')]({'plain':!![]});if(!_0x42dfea)throw new Error(_0x999e('0x4e'));if(_0x42dfea['role']==='user'){var _0x254292=_0x9322ca['get']({'plain':!![]});var _0x5ebc95='ChanSpies';return db[_0x999e('0x4f')][_0x999e('0x4b')]({'where':{'name':_0x5ebc95,'userProfileId':_0x42dfea[_0x999e('0x50')]},'raw':!![]})[_0x999e('0x28')](function(_0x37c3ff){if(_0x37c3ff&&_0x37c3ff[_0x999e('0x51')]===0x0){return db['UserProfileResource'][_0x999e('0x4c')]({'name':_0x254292[_0x999e('0x2c')],'resourceId':_0x254292['id'],'type':_0x37c3ff['name'],'sectionId':_0x37c3ff['id']},{})[_0x999e('0x28')](function(){return _0x9322ca;});}else{return _0x9322ca;}})[_0x999e('0x47')](function(_0x4169eb){logger[_0x999e('0x2b')](_0x999e('0x52'),_0x4169eb);throw _0x4169eb;});}return _0x9322ca;})[_0x999e('0x28')](respondWithResult(_0xa50dc6,0xc9))[_0x999e('0x47')](handleError(_0xa50dc6,null));};exports[_0x999e('0x53')]=function(_0x290c7a,_0x53932a){if(_0x290c7a[_0x999e('0x4d')]['id']){delete _0x290c7a[_0x999e('0x4d')]['id'];}return db[_0x999e('0x30')][_0x999e('0x4b')]({'where':{'id':_0x290c7a['params']['id']}})[_0x999e('0x28')](handleEntityNotFound(_0x53932a,null))[_0x999e('0x28')](saveUpdates(_0x290c7a[_0x999e('0x4d')],null))[_0x999e('0x28')](respondWithResult(_0x53932a,null))[_0x999e('0x47')](handleError(_0x53932a,null));};exports[_0x999e('0x27')]=function(_0x3f5790,_0x1a6925){return db['VoiceChanSpy']['find']({'where':{'id':_0x3f5790[_0x999e('0x49')]['id']}})[_0x999e('0x28')](handleEntityNotFound(_0x1a6925,null))[_0x999e('0x28')](removeEntity(_0x1a6925,null))[_0x999e('0x47')](handleError(_0x1a6925,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index ba876bc..ce56017 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 _0x95cc=['./voiceChanSpy.attributes','context','from-sip','format','%s%s','prefix','system','push','merge','CDR(type)=%s','record','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','password','SIP/%s,%s','name','options','join','StopMixMonitor','length','concat','internal','User','findAll','then','exports','models','define','VoiceChanSpy','voice_chanspy','VoiceExtension','bulkCreate','catch','destroy','util','bluebird'];(function(_0x2533e3,_0xc740b5){var _0x203b68=function(_0x1395c4){while(--_0x1395c4){_0x2533e3['push'](_0x2533e3['shift']());}};_0x203b68(++_0xc740b5);}(_0x95cc,0xbc));var _0xc95c=function(_0x51e353,_0x485e7e){_0x51e353=_0x51e353-0x0;var _0x4c7c2d=_0x95cc[_0x51e353];return _0x4c7c2d;};'use strict';var _=require('lodash');var util=require(_0xc95c('0x0'));var BPromise=require(_0xc95c('0x1'));var attributes=require(_0xc95c('0x2'));var getUserApplications=function(_0x24e867,_0x111a5a,_0x6d106c){var _0x2c43e3=0x1;var _0x57670b=[];var _0xa5ac0e={'context':_0x111a5a[_0xc95c('0x3')]||_0xc95c('0x4'),'exten':util[_0xc95c('0x5')](_0xc95c('0x6'),_0x24e867[_0xc95c('0x7')],_0x6d106c),'type':_0xc95c('0x8'),'isApp':![],'ChanSpyId':_0x24e867['id'],'UserId':_0x111a5a['id']};_0x57670b[_0xc95c('0x9')](_[_0xc95c('0xa')]({'app':'Set','appdata':util[_0xc95c('0x5')](_0xc95c('0xb'),'chanspy'),'priority':_0x2c43e3++},_0xa5ac0e));if(_0x24e867[_0xc95c('0xc')]){_0x57670b[_0xc95c('0x9')](_[_0xc95c('0xa')]({'app':'MixMonitor','appdata':util[_0xc95c('0x5')](_0xc95c('0xd'),_0x24e867[_0xc95c('0xe')]),'priority':_0x2c43e3++},_0xa5ac0e));}if(_0x24e867[_0xc95c('0xf')]){_0x57670b[_0xc95c('0x9')](_[_0xc95c('0xa')]({'app':_0xc95c('0x10'),'appdata':_0x24e867[_0xc95c('0x11')],'priority':_0x2c43e3++},_0xa5ac0e));}_0x57670b['push'](_[_0xc95c('0xa')]({'app':'ChanSpy','appdata':util['format'](_0xc95c('0x12'),_0x111a5a[_0xc95c('0x13')],_0x24e867[_0xc95c('0x14')]?_0x24e867[_0xc95c('0x14')][_0xc95c('0x15')](''):''),'priority':_0x2c43e3++},_0xa5ac0e));if(_0x24e867[_0xc95c('0xc')]){_0x57670b[_0xc95c('0x9')](_[_0xc95c('0xa')]({'app':_0xc95c('0x16'),'priority':_0x2c43e3++},_0xa5ac0e));}return _0x57670b;};var getChanSpyApplications=function(_0xf06678,_0x3f91ed){var _0x502110=[];for(var _0x451873=0x0,_0x288b6b=0x1;_0x451873<_0x3f91ed[_0xc95c('0x17')];_0x451873++,_0x288b6b=0x1){_0x502110=_0x502110[_0xc95c('0x18')](getUserApplications(_0xf06678,_0x3f91ed[_0x451873],_0x3f91ed[_0x451873][_0xc95c('0x19')]));if(_0x3f91ed[_0x451873][_0xc95c('0x19')]!=_0x3f91ed[_0x451873][_0xc95c('0x13')]){_0x502110=_0x502110['concat'](getUserApplications(_0xf06678,_0x3f91ed[_0x451873],_0x3f91ed[_0x451873]['name']));}}return _0x502110;};var getChanSpyPromise=function(_0x1e6e58,_0x3d2ab6){return new BPromise(function(_0x2c28c5,_0x46b75f){return _0x1e6e58[_0xc95c('0x1a')][_0xc95c('0x1b')]({'attributes':['id','name',_0xc95c('0x19')],'where':{'role':'agent','chanspy':!![]},'raw':!![]})[_0xc95c('0x1c')](function(_0x3b1b86){if(_0x3b1b86){return _0x2c28c5(getChanSpyApplications(_0x3d2ab6,_0x3b1b86));}return _0x2c28c5([]);})['catch'](function(_0x37b5fb){_0x46b75f(_0x37b5fb);});});};module[_0xc95c('0x1d')]=function(_0x311f09,_0x1a749c){var _0x15d03f=_0x311f09[_0xc95c('0x1e')];return _0x311f09[_0xc95c('0x1f')](_0xc95c('0x20'),attributes,{'tableName':_0xc95c('0x21'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x448230,_0x2ab9d6,_0x107d2f){return getChanSpyPromise(_0x15d03f,_0x448230)['then'](function(_0x21543a){if(_0x21543a&&_0x21543a['length']){return _0x15d03f[_0xc95c('0x22')][_0xc95c('0x23')](_0x21543a);}})[_0xc95c('0x1c')](function(){_0x107d2f();})[_0xc95c('0x24')](function(_0x3ace89){_0x107d2f(_0x3ace89);});},'afterUpdate':function(_0x27c2af,_0x46f551,_0x5b0b7f){return _0x15d03f[_0xc95c('0x22')][_0xc95c('0x25')]({'where':{'ChanSpyId':_0x27c2af['id']}})[_0xc95c('0x1c')](function(){return getChanSpyPromise(_0x15d03f,_0x27c2af);})['then'](function(_0xdf3b36){if(_0xdf3b36&&_0xdf3b36['length']){return _0x15d03f[_0xc95c('0x22')]['bulkCreate'](_0xdf3b36);}})[_0xc95c('0x1c')](function(){_0x5b0b7f();})['catch'](function(_0x5da8ee){_0x5b0b7f(_0x5da8ee);});},'afterDestroy':function(_0x1d07f6,_0x222b46,_0x33c57a){return _0x15d03f[_0xc95c('0x22')][_0xc95c('0x25')]({'where':{'ChanSpyId':_0x1d07f6['id']}})[_0xc95c('0x1c')](function(){_0x33c57a();})[_0xc95c('0x24')](function(_0x2c9fed){_0x33c57a(_0x2c9fed);});}}});}; \ No newline at end of file +var _0x0136=['catch','destroy','util','bluebird','./voiceChanSpy.attributes','context','from-sip','format','%s%s','system','push','merge','Set','CDR(type)=%s','chanspy','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','join','record','StopMixMonitor','length','concat','internal','User','findAll','then','models','define','VoiceChanSpy','voice_chanspy','VoiceExtension','bulkCreate'];(function(_0x5e47ff,_0x11eba6){var _0x622ae0=function(_0x3bc131){while(--_0x3bc131){_0x5e47ff['push'](_0x5e47ff['shift']());}};_0x622ae0(++_0x11eba6);}(_0x0136,0x1ba));var _0x6013=function(_0x448a5c,_0x222a52){_0x448a5c=_0x448a5c-0x0;var _0x1fc0f2=_0x0136[_0x448a5c];return _0x1fc0f2;};'use strict';var _=require('lodash');var util=require(_0x6013('0x0'));var BPromise=require(_0x6013('0x1'));var attributes=require(_0x6013('0x2'));var getUserApplications=function(_0x2bbfb0,_0x1415d6,_0x35ef73){var _0x4ea407=0x1;var _0x5bd009=[];var _0xbeaa15={'context':_0x1415d6[_0x6013('0x3')]||_0x6013('0x4'),'exten':util[_0x6013('0x5')](_0x6013('0x6'),_0x2bbfb0['prefix'],_0x35ef73),'type':_0x6013('0x7'),'isApp':![],'ChanSpyId':_0x2bbfb0['id'],'UserId':_0x1415d6['id']};_0x5bd009[_0x6013('0x8')](_[_0x6013('0x9')]({'app':_0x6013('0xa'),'appdata':util[_0x6013('0x5')](_0x6013('0xb'),_0x6013('0xc')),'priority':_0x4ea407++},_0xbeaa15));if(_0x2bbfb0['record']){_0x5bd009[_0x6013('0x8')](_[_0x6013('0x9')]({'app':_0x6013('0xd'),'appdata':util['format'](_0x6013('0xe'),_0x2bbfb0[_0x6013('0xf')]),'priority':_0x4ea407++},_0xbeaa15));}if(_0x2bbfb0[_0x6013('0x10')]){_0x5bd009['push'](_['merge']({'app':_0x6013('0x11'),'appdata':_0x2bbfb0[_0x6013('0x12')],'priority':_0x4ea407++},_0xbeaa15));}_0x5bd009['push'](_[_0x6013('0x9')]({'app':_0x6013('0x13'),'appdata':util[_0x6013('0x5')](_0x6013('0x14'),_0x1415d6[_0x6013('0x15')],_0x2bbfb0['options']?_0x2bbfb0[_0x6013('0x16')][_0x6013('0x17')](''):''),'priority':_0x4ea407++},_0xbeaa15));if(_0x2bbfb0[_0x6013('0x18')]){_0x5bd009[_0x6013('0x8')](_[_0x6013('0x9')]({'app':_0x6013('0x19'),'priority':_0x4ea407++},_0xbeaa15));}return _0x5bd009;};var getChanSpyApplications=function(_0x38c853,_0xe9f32b){var _0x42e188=[];for(var _0x580e7c=0x0,_0x3d496d=0x1;_0x580e7c<_0xe9f32b[_0x6013('0x1a')];_0x580e7c++,_0x3d496d=0x1){_0x42e188=_0x42e188[_0x6013('0x1b')](getUserApplications(_0x38c853,_0xe9f32b[_0x580e7c],_0xe9f32b[_0x580e7c][_0x6013('0x1c')]));if(_0xe9f32b[_0x580e7c][_0x6013('0x1c')]!=_0xe9f32b[_0x580e7c][_0x6013('0x15')]){_0x42e188=_0x42e188[_0x6013('0x1b')](getUserApplications(_0x38c853,_0xe9f32b[_0x580e7c],_0xe9f32b[_0x580e7c][_0x6013('0x15')]));}}return _0x42e188;};var getChanSpyPromise=function(_0x2284d4,_0x4f39c8){return new BPromise(function(_0x10d535,_0x40ed78){return _0x2284d4[_0x6013('0x1d')][_0x6013('0x1e')]({'attributes':['id',_0x6013('0x15'),_0x6013('0x1c')],'where':{'role':'agent','chanspy':!![]},'raw':!![]})[_0x6013('0x1f')](function(_0x16f1e5){if(_0x16f1e5){return _0x10d535(getChanSpyApplications(_0x4f39c8,_0x16f1e5));}return _0x10d535([]);})['catch'](function(_0x12667f){_0x40ed78(_0x12667f);});});};module['exports']=function(_0x24c8de,_0x2d1ba5){var _0x5e9ccc=_0x24c8de[_0x6013('0x20')];return _0x24c8de[_0x6013('0x21')](_0x6013('0x22'),attributes,{'tableName':_0x6013('0x23'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x5cbf06,_0x4a9697,_0x1415be){return getChanSpyPromise(_0x5e9ccc,_0x5cbf06)[_0x6013('0x1f')](function(_0x8bec90){if(_0x8bec90&&_0x8bec90[_0x6013('0x1a')]){return _0x5e9ccc[_0x6013('0x24')][_0x6013('0x25')](_0x8bec90);}})['then'](function(){_0x1415be();})[_0x6013('0x26')](function(_0x3fc038){_0x1415be(_0x3fc038);});},'afterUpdate':function(_0xa0ae8,_0x4d56a7,_0x1f6912){return _0x5e9ccc[_0x6013('0x24')][_0x6013('0x27')]({'where':{'ChanSpyId':_0xa0ae8['id']}})[_0x6013('0x1f')](function(){return getChanSpyPromise(_0x5e9ccc,_0xa0ae8);})['then'](function(_0x537692){if(_0x537692&&_0x537692[_0x6013('0x1a')]){return _0x5e9ccc[_0x6013('0x24')][_0x6013('0x25')](_0x537692);}})[_0x6013('0x1f')](function(){_0x1f6912();})[_0x6013('0x26')](function(_0x5d3600){_0x1f6912(_0x5d3600);});},'afterDestroy':function(_0x3f42f6,_0x2fc4c2,_0x4e9ee3){return _0x5e9ccc[_0x6013('0x24')][_0x6013('0x27')]({'where':{'ChanSpyId':_0x3f42f6['id']}})[_0x6013('0x1f')](function(){_0x4e9ee3();})['catch'](function(_0x14baa2){_0x4e9ee3(_0x14baa2);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 4d3e347..2fb8641 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 _0xa699=['request','then','info','VoiceChanSpy,\x20%s,\x20%s','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x2f37aa,_0x13f4ed){var _0x36956d=function(_0x49f578){while(--_0x49f578){_0x2f37aa['push'](_0x2f37aa['shift']());}};_0x36956d(++_0x13f4ed);}(_0xa699,0x6b));var _0x9a69=function(_0x23a79e,_0x235f89){_0x23a79e=_0x23a79e-0x0;var _0x3dab57=_0xa699[_0x23a79e];return _0x3dab57;};'use strict';var _=require(_0x9a69('0x0'));var util=require(_0x9a69('0x1'));var moment=require(_0x9a69('0x2'));var BPromise=require(_0x9a69('0x3'));var rs=require(_0x9a69('0x4'));var fs=require('fs');var Redis=require(_0x9a69('0x5'));var db=require(_0x9a69('0x6'))['db'];var utils=require(_0x9a69('0x7'));var logger=require(_0x9a69('0x8'))(_0x9a69('0x9'));var config=require(_0x9a69('0xa'));var jayson=require(_0x9a69('0xb'));var client=jayson[_0x9a69('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x26b842,_0x3f9bce,_0x3bb021){return new BPromise(function(_0x4665a9,_0x5031b0){return client[_0x9a69('0xd')](_0x26b842,_0x3bb021)[_0x9a69('0xe')](function(_0x3fb953){logger[_0x9a69('0xf')](_0x9a69('0x10'),_0x3f9bce,'request\x20sent');logger['debug'](_0x9a69('0x11'),_0x3f9bce,'request\x20sent',JSON[_0x9a69('0x12')](_0x3fb953));if(_0x3fb953[_0x9a69('0x13')]){if(_0x3fb953['error'][_0x9a69('0x14')]===0x1f4){logger[_0x9a69('0x13')]('VoiceChanSpy,\x20%s,\x20%s',_0x3f9bce,_0x3fb953[_0x9a69('0x13')][_0x9a69('0x15')]);return _0x5031b0(_0x3fb953[_0x9a69('0x13')][_0x9a69('0x15')]);}logger[_0x9a69('0x13')](_0x9a69('0x10'),_0x3f9bce,_0x3fb953[_0x9a69('0x13')][_0x9a69('0x15')]);return _0x4665a9(_0x3fb953[_0x9a69('0x13')]['message']);}else{logger[_0x9a69('0xf')](_0x9a69('0x10'),_0x3f9bce,_0x9a69('0x16'));_0x4665a9(_0x3fb953['result'][_0x9a69('0x15')]);}})[_0x9a69('0x17')](function(_0x380e46){logger[_0x9a69('0x13')](_0x9a69('0x10'),_0x3f9bce,_0x380e46);_0x5031b0(_0x380e46);});});} \ No newline at end of file +var _0x235a=['http','then','VoiceChanSpy,\x20%s,\x20%s','debug','error','code','message','info','request\x20sent','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x1a0799,_0xff43ac){var _0x3c47b5=function(_0x1f4359){while(--_0x1f4359){_0x1a0799['push'](_0x1a0799['shift']());}};_0x3c47b5(++_0xff43ac);}(_0x235a,0x1ef));var _0xa235=function(_0x29ea35,_0x1baf95){_0x29ea35=_0x29ea35-0x0;var _0x5702f4=_0x235a[_0x29ea35];return _0x5702f4;};'use strict';var _=require(_0xa235('0x0'));var util=require(_0xa235('0x1'));var moment=require(_0xa235('0x2'));var BPromise=require('bluebird');var rs=require(_0xa235('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa235('0x4'))['db'];var utils=require(_0xa235('0x5'));var logger=require(_0xa235('0x6'))(_0xa235('0x7'));var config=require(_0xa235('0x8'));var jayson=require(_0xa235('0x9'));var client=jayson[_0xa235('0xa')][_0xa235('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4b849b,_0x2e535e,_0x2dc1ba){return new BPromise(function(_0x450e27,_0x2f3403){return client['request'](_0x4b849b,_0x2dc1ba)[_0xa235('0xc')](function(_0x561602){logger['info'](_0xa235('0xd'),_0x2e535e,'request\x20sent');logger[_0xa235('0xe')]('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x2e535e,'request\x20sent',JSON['stringify'](_0x561602));if(_0x561602[_0xa235('0xf')]){if(_0x561602[_0xa235('0xf')][_0xa235('0x10')]===0x1f4){logger[_0xa235('0xf')]('VoiceChanSpy,\x20%s,\x20%s',_0x2e535e,_0x561602['error']['message']);return _0x2f3403(_0x561602[_0xa235('0xf')][_0xa235('0x11')]);}logger[_0xa235('0xf')](_0xa235('0xd'),_0x2e535e,_0x561602[_0xa235('0xf')][_0xa235('0x11')]);return _0x450e27(_0x561602[_0xa235('0xf')][_0xa235('0x11')]);}else{logger[_0xa235('0x12')]('VoiceChanSpy,\x20%s,\x20%s',_0x2e535e,_0xa235('0x13'));_0x450e27(_0x561602[_0xa235('0x14')][_0xa235('0x11')]);}})[_0xa235('0x15')](function(_0x16dbe9){logger[_0xa235('0xf')]('VoiceChanSpy,\x20%s,\x20%s',_0x2e535e,_0x16dbe9);_0x2f3403(_0x16dbe9);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index ae13862..7799e0e 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 _0xe2d0=['../../config/environment','./voiceContext.controller','isAuthenticated','get','/:id','show','post','put','update','delete','destroy','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x2e805d,_0x448766){var _0x5e474d=function(_0x253f30){while(--_0x253f30){_0x2e805d['push'](_0x2e805d['shift']());}};_0x5e474d(++_0x448766);}(_0xe2d0,0x65));var _0x0e2d=function(_0x6e4fa0,_0x5eebd1){_0x6e4fa0=_0x6e4fa0-0x0;var _0x347582=_0xe2d0[_0x6e4fa0];return _0x347582;};'use strict';var multer=require(_0x0e2d('0x0'));var util=require(_0x0e2d('0x1'));var path=require('path');var timeout=require(_0x0e2d('0x2'));var express=require(_0x0e2d('0x3'));var router=express['Router']();var fs_extra=require(_0x0e2d('0x4'));var auth=require(_0x0e2d('0x5'));var interaction=require(_0x0e2d('0x6'));var config=require(_0x0e2d('0x7'));var controller=require(_0x0e2d('0x8'));router['get']('/',auth[_0x0e2d('0x9')](),controller['index']);router[_0x0e2d('0xa')](_0x0e2d('0xb'),auth[_0x0e2d('0x9')](),controller[_0x0e2d('0xc')]);router[_0x0e2d('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0e2d('0xe')](_0x0e2d('0xb'),auth['isAuthenticated'](),controller[_0x0e2d('0xf')]);router[_0x0e2d('0x10')](_0x0e2d('0xb'),auth['isAuthenticated'](),controller[_0x0e2d('0x11')]);module['exports']=router; \ No newline at end of file +var _0xc351=['multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete'];(function(_0x496965,_0x2c5da3){var _0x2ffe82=function(_0x2d4fd5){while(--_0x2d4fd5){_0x496965['push'](_0x496965['shift']());}};_0x2ffe82(++_0x2c5da3);}(_0xc351,0x1cb));var _0x1c35=function(_0x56c4de,_0xf1c874){_0x56c4de=_0x56c4de-0x0;var _0xd799af=_0xc351[_0x56c4de];return _0xd799af;};'use strict';var multer=require(_0x1c35('0x0'));var util=require('util');var path=require(_0x1c35('0x1'));var timeout=require(_0x1c35('0x2'));var express=require('express');var router=express[_0x1c35('0x3')]();var fs_extra=require(_0x1c35('0x4'));var auth=require(_0x1c35('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x1c35('0x6'));var controller=require(_0x1c35('0x7'));router[_0x1c35('0x8')]('/',auth[_0x1c35('0x9')](),controller[_0x1c35('0xa')]);router[_0x1c35('0x8')](_0x1c35('0xb'),auth[_0x1c35('0x9')](),controller[_0x1c35('0xc')]);router[_0x1c35('0xd')]('/',auth[_0x1c35('0x9')](),controller[_0x1c35('0xe')]);router[_0x1c35('0xf')]('/:id',auth[_0x1c35('0x9')](),controller['update']);router[_0x1c35('0x10')](_0x1c35('0xb'),auth[_0x1c35('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 9564157..596190e 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 _0xfa5d=['STRING','BOOLEAN','sequelize'];(function(_0x70fbac,_0x306e7c){var _0x437103=function(_0x4b4d37){while(--_0x4b4d37){_0x70fbac['push'](_0x70fbac['shift']());}};_0x437103(++_0x306e7c);}(_0xfa5d,0x140));var _0xdfa5=function(_0x424b31,_0x4182b4){_0x424b31=_0x424b31-0x0;var _0x7dcf7d=_0xfa5d[_0x424b31];return _0x7dcf7d;};'use strict';var Sequelize=require(_0xdfa5('0x0'));module['exports']={'name':{'type':Sequelize[_0xdfa5('0x1')],'unique':'name'},'description':{'type':Sequelize[_0xdfa5('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xdfa5('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x4472=['exports','STRING','name','sequelize'];(function(_0x83fd92,_0x5b36f1){var _0x381193=function(_0x5f2147){while(--_0x5f2147){_0x83fd92['push'](_0x83fd92['shift']());}};_0x381193(++_0x5b36f1);}(_0x4472,0x15f));var _0x2447=function(_0x54872a,_0x3a1c1e){_0x54872a=_0x54872a-0x0;var _0x3ef3cd=_0x4472[_0x54872a];return _0x3ef3cd;};'use strict';var Sequelize=require(_0x2447('0x0'));module[_0x2447('0x1')]={'name':{'type':Sequelize[_0x2447('0x2')],'unique':_0x2447('0x3')},'description':{'type':Sequelize[_0x2447('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize['BOOLEAN'],'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 56bcff9..594edd6 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 _0x845c=['Reload','chan_sip.so','user','role','UserProfileSection','Contexts','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','readFileSync','server/files/templates/context.ejs','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','client','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','get','UserProfileResource','end','stack','name','send','map','VoiceContext','fieldName','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','filters','pick','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','params','rawAttributes','create','body','join','root','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf'];(function(_0x3b67d4,_0x5894b2){var _0x5eb7d4=function(_0x593f2a){while(--_0x593f2a){_0x3b67d4['push'](_0x3b67d4['shift']());}};_0x5eb7d4(++_0x5894b2);}(_0x845c,0xe4));var _0xc845=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x845c[_0x42cae2];return _0x5f256f;};'use strict';var emlformat=require(_0xc845('0x0'));var rimraf=require(_0xc845('0x1'));var zipdir=require(_0xc845('0x2'));var jsonpatch=require(_0xc845('0x3'));var rp=require(_0xc845('0x4'));var moment=require(_0xc845('0x5'));var BPromise=require(_0xc845('0x6'));var Mustache=require(_0xc845('0x7'));var util=require('util');var path=require('path');var sox=require(_0xc845('0x8'));var csv=require(_0xc845('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc845('0xa'));var _=require(_0xc845('0xb'));var squel=require(_0xc845('0xc'));var crypto=require('crypto');var jsforce=require(_0xc845('0xd'));var deskjs=require(_0xc845('0xe'));var toCsv=require(_0xc845('0x9'));var querystring=require(_0xc845('0xf'));var Papa=require(_0xc845('0x10'));var Redis=require(_0xc845('0x11'));var authService=require(_0xc845('0x12'));var qs=require(_0xc845('0x13'));var as=require(_0xc845('0x14'));var hardwareService=require(_0xc845('0x15'));var logger=require('../../config/logger')(_0xc845('0x16'));var utils=require(_0xc845('0x17'));var config=require(_0xc845('0x18'));var licenseUtil=require(_0xc845('0x19'));var db=require('../../mysqldb')['db'];var jayson=require(_0xc845('0x1a'));var client=jayson[_0xc845('0x1b')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5e8745,_0x1b6e81,_0x13356c,_0x1cd9cf){return new BPromise(function(_0x2bb7cd,_0x1b2d3c){var _0x1d046a=_0x1cd9cf||client;return _0x1d046a[_0xc845('0x1c')](_0x5e8745,_0x13356c)[_0xc845('0x1d')](function(_0x4d25e7){logger[_0xc845('0x1e')](_0xc845('0x1f'),_0x1b6e81,_0xc845('0x20'));logger[_0xc845('0x21')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x1b6e81,'request\x20sent',JSON[_0xc845('0x22')](_0x4d25e7));if(_0x4d25e7['error']){if(_0x4d25e7[_0xc845('0x23')][_0xc845('0x24')]===0x1f4){logger[_0xc845('0x23')](_0xc845('0x1f'),_0x1b6e81,_0x4d25e7[_0xc845('0x23')][_0xc845('0x25')]);return _0x1b2d3c(_0x4d25e7[_0xc845('0x23')][_0xc845('0x25')]);}logger[_0xc845('0x23')]('VoiceContext,\x20%s,\x20%s',_0x1b6e81,_0x4d25e7[_0xc845('0x23')][_0xc845('0x25')]);return _0x2bb7cd(_0x4d25e7[_0xc845('0x23')][_0xc845('0x25')]);}else{logger[_0xc845('0x1e')](_0xc845('0x1f'),_0x1b6e81,'request\x20sent');_0x2bb7cd(_0x4d25e7[_0xc845('0x26')]['message']);}})[_0xc845('0x27')](function(_0x3a2839){logger[_0xc845('0x23')](_0xc845('0x1f'),_0x1b6e81,_0x3a2839);_0x1b2d3c(_0x3a2839);});});}function respondWithStatusCode(_0x5e8b11,_0xb6b3ba){_0xb6b3ba=_0xb6b3ba||0xcc;return function(_0x557812){if(_0x557812){return _0x5e8b11[_0xc845('0x28')](_0xb6b3ba);}return _0x5e8b11[_0xc845('0x29')](_0xb6b3ba)['end']();};}function respondWithResult(_0x12d775,_0x5d2ab7){_0x5d2ab7=_0x5d2ab7||0xc8;return function(_0x4c5415){if(_0x4c5415){return _0x12d775[_0xc845('0x29')](_0x5d2ab7)['json'](_0x4c5415);}};}function respondWithFilteredResult(_0x200dd9,_0xba2f0c){return function(_0x5028ef){if(_0x5028ef){var _0x5ba574=typeof _0xba2f0c[_0xc845('0x2a')]===_0xc845('0x2b')&&typeof _0xba2f0c[_0xc845('0x2c')]==='undefined';var _0x31717b=_0x5028ef[_0xc845('0x2d')];var _0x467ce3=_0x5ba574?0x0:_0xba2f0c[_0xc845('0x2a')];var _0x10263c=_0x5ba574?_0x5028ef[_0xc845('0x2d')]:_0xba2f0c[_0xc845('0x2a')]+_0xba2f0c[_0xc845('0x2c')];var _0x329eca;if(_0x10263c>=_0x31717b){_0x10263c=_0x31717b;_0x329eca=0xc8;}else{_0x329eca=0xce;}_0x200dd9[_0xc845('0x29')](_0x329eca);return _0x200dd9[_0xc845('0x2e')](_0xc845('0x2f'),_0x467ce3+'-'+_0x10263c+'/'+_0x31717b)[_0xc845('0x30')](_0x5028ef);}return null;};}function patchUpdates(_0x9bd678){return function(_0x59fb71){try{jsonpatch[_0xc845('0x31')](_0x59fb71,_0x9bd678,!![]);}catch(_0x1807ba){return BPromise[_0xc845('0x32')](_0x1807ba);}return _0x59fb71[_0xc845('0x33')]();};}function saveUpdates(_0x56a640,_0x4e1944){return function(_0x12323d){if(_0x12323d){return _0x12323d[_0xc845('0x34')](_0x56a640)['then'](function(_0x4fb753){return _0x4fb753;});}return null;};}function removeEntity(_0x458f50,_0x57f7da){return function(_0x46805a){if(_0x46805a){return _0x46805a[_0xc845('0x35')]()[_0xc845('0x1d')](function(){var _0x404180=_0x46805a[_0xc845('0x36')]({'plain':!![]});var _0x48422a='Contexts';return db[_0xc845('0x37')]['destroy']({'where':{'type':_0x48422a,'resourceId':_0x404180['id']}})[_0xc845('0x1d')](function(){return _0x46805a;});})[_0xc845('0x1d')](function(){_0x458f50[_0xc845('0x29')](0xcc)[_0xc845('0x38')]();});}};}function handleEntityNotFound(_0x1040a5,_0x19bde2){return function(_0x626748){if(!_0x626748){_0x1040a5[_0xc845('0x28')](0x194);}return _0x626748;};}function handleError(_0x9e5dcf,_0x15562e){_0x15562e=_0x15562e||0x1f4;return function(_0x1d0c05){logger[_0xc845('0x23')](_0x1d0c05[_0xc845('0x39')]);if(_0x1d0c05[_0xc845('0x3a')]){delete _0x1d0c05[_0xc845('0x3a')];}_0x9e5dcf['status'](_0x15562e)[_0xc845('0x3b')](_0x1d0c05);};}exports['index']=function(_0x48aa0f,_0x26d84a){var _0x593982={},_0x223aa2={},_0x2ef191={'count':0x0,'rows':[]};var _0x1b1491=_[_0xc845('0x3c')](db[_0xc845('0x3d')]['rawAttributes'],function(_0x1b050a){return{'name':_0x1b050a[_0xc845('0x3e')],'type':_0x1b050a[_0xc845('0x3f')][_0xc845('0x40')]};});_0x223aa2[_0xc845('0x41')]=_[_0xc845('0x3c')](_0x1b1491,_0xc845('0x3a'));_0x223aa2[_0xc845('0x42')]=_[_0xc845('0x43')](_0x48aa0f[_0xc845('0x42')]);_0x223aa2['filters']=_[_0xc845('0x44')](_0x223aa2[_0xc845('0x41')],_0x223aa2[_0xc845('0x42')]);_0x593982['attributes']=_['intersection'](_0x223aa2['model'],qs[_0xc845('0x45')](_0x48aa0f['query'][_0xc845('0x45')]));_0x593982[_0xc845('0x46')]=_0x593982[_0xc845('0x46')]['length']?_0x593982[_0xc845('0x46')]:_0x223aa2[_0xc845('0x41')];if(!_0x48aa0f[_0xc845('0x42')][_0xc845('0x47')](_0xc845('0x48'))){_0x593982[_0xc845('0x2c')]=qs[_0xc845('0x2c')](_0x48aa0f['query']['limit']);_0x593982[_0xc845('0x2a')]=qs['offset'](_0x48aa0f['query'][_0xc845('0x2a')]);}_0x593982[_0xc845('0x49')]=qs[_0xc845('0x4a')](_0x48aa0f[_0xc845('0x42')][_0xc845('0x4a')]);_0x593982['where']=qs[_0xc845('0x4b')](_[_0xc845('0x4c')](_0x48aa0f['query'],_0x223aa2[_0xc845('0x4b')]),_0x1b1491);if(_0x48aa0f[_0xc845('0x42')][_0xc845('0x4d')]){_0x593982['where']=_[_0xc845('0x4e')](_0x593982[_0xc845('0x4f')],{'$or':_[_0xc845('0x3c')](_0x1b1491,function(_0x18463f){if(_0x18463f['type']!==_0xc845('0x50')){var _0x2c49d3={};_0x2c49d3[_0x18463f[_0xc845('0x3a')]]={'$like':'%'+_0x48aa0f[_0xc845('0x42')]['filter']+'%'};return _0x2c49d3;}})});}_0x593982=_[_0xc845('0x4e')]({},_0x593982,_0x48aa0f[_0xc845('0x51')]);var _0xab474d={'where':_0x593982[_0xc845('0x4f')]};return db[_0xc845('0x3d')][_0xc845('0x2d')](_0xab474d)['then'](function(_0x474472){_0x2ef191[_0xc845('0x2d')]=_0x474472;if(_0x48aa0f[_0xc845('0x42')][_0xc845('0x52')]){_0x593982[_0xc845('0x53')]=[{'all':!![]}];}return db[_0xc845('0x3d')][_0xc845('0x54')](_0x593982);})['then'](function(_0x4b4fb4){_0x2ef191[_0xc845('0x55')]=_0x4b4fb4;return _0x2ef191;})[_0xc845('0x1d')](respondWithFilteredResult(_0x26d84a,_0x593982))['catch'](handleError(_0x26d84a,null));};exports['show']=function(_0x49aee6,_0x5b0b9d){var _0x5ecd5c={'raw':![],'where':{'id':_0x49aee6[_0xc845('0x56')]['id']}},_0x151888={};_0x151888[_0xc845('0x41')]=_[_0xc845('0x43')](db[_0xc845('0x3d')][_0xc845('0x57')]);_0x151888[_0xc845('0x42')]=_[_0xc845('0x43')](_0x49aee6[_0xc845('0x42')]);_0x151888[_0xc845('0x4b')]=_[_0xc845('0x44')](_0x151888['model'],_0x151888[_0xc845('0x42')]);_0x5ecd5c['attributes']=_[_0xc845('0x44')](_0x151888[_0xc845('0x41')],qs[_0xc845('0x45')](_0x49aee6[_0xc845('0x42')][_0xc845('0x45')]));_0x5ecd5c['attributes']=_0x5ecd5c[_0xc845('0x46')]['length']?_0x5ecd5c[_0xc845('0x46')]:_0x151888['model'];if(_0x49aee6[_0xc845('0x42')][_0xc845('0x52')]){_0x5ecd5c[_0xc845('0x53')]=[{'all':!![]}];}_0x5ecd5c=_[_0xc845('0x4e')]({},_0x5ecd5c,_0x49aee6['options']);return db[_0xc845('0x3d')]['find'](_0x5ecd5c)[_0xc845('0x1d')](handleEntityNotFound(_0x5b0b9d,null))['then'](respondWithResult(_0x5b0b9d,null))[_0xc845('0x27')](handleError(_0x5b0b9d,null));};exports[_0xc845('0x58')]=function(_0x2691e1,_0x2e9073,_0x3fcfc1){var _0x1a6ebb;return db[_0xc845('0x3d')][_0xc845('0x58')](_0x2691e1[_0xc845('0x59')],{'raw':!![]})[_0xc845('0x1d')](function(_0x5e1dd1){_0x1a6ebb=_0x5e1dd1;return db[_0xc845('0x3d')][_0xc845('0x54')]({'raw':!![]});})[_0xc845('0x1d')](function(_0x33b073){var _0x6cd332=fs['readFileSync'](path[_0xc845('0x5a')](config[_0xc845('0x5b')],'server/files/templates/context.ejs'),_0xc845('0x5c'));var _0x50c266=ejs[_0xc845('0x5d')](_0x6cd332,{'contexts':_0x33b073||[]});fs[_0xc845('0x5e')](_0xc845('0x5f'),_0x50c266);})['then'](function(){return respondWithRpcPromise(_0xc845('0x60'),_0xc845('0x58'),{'module':_0xc845('0x61')});})['then'](function(){var _0x58e53a=_0x2691e1[_0xc845('0x62')][_0xc845('0x36')]({'plain':!![]});if(!_0x58e53a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x58e53a[_0xc845('0x63')]===_0xc845('0x62')){var _0x307946=_0x1a6ebb[_0xc845('0x36')]({'plain':!![]});return db[_0xc845('0x64')]['find']({'where':{'name':_0xc845('0x65'),'userProfileId':_0x58e53a[_0xc845('0x66')]},'raw':!![]})[_0xc845('0x1d')](function(_0xe9aec){if(_0xe9aec&&_0xe9aec[_0xc845('0x67')]===0x0){return db[_0xc845('0x37')][_0xc845('0x58')]({'name':_0x307946[_0xc845('0x3a')],'resourceId':_0x307946['id'],'type':_0xe9aec[_0xc845('0x3a')],'sectionId':_0xe9aec['id']},{})[_0xc845('0x1d')](function(){return _0x1a6ebb;});}else{return _0x1a6ebb;}})[_0xc845('0x27')](function(_0x3bfbde){logger[_0xc845('0x23')](_0xc845('0x68'),_0x3bfbde);throw _0x3bfbde;});}return _0x1a6ebb;})['then'](respondWithResult(_0x2e9073,0xc9))[_0xc845('0x27')](handleError(_0x2e9073,null));};exports['update']=function(_0xe23907,_0x36af6a,_0x343ac5){var _0x414a0d;return db[_0xc845('0x3d')][_0xc845('0x69')]({'where':{'id':_0xe23907[_0xc845('0x56')]['id']}})[_0xc845('0x1d')](handleEntityNotFound(_0x36af6a,null))['then'](saveUpdates(_0xe23907[_0xc845('0x59')],null))[_0xc845('0x1d')](function(_0x55588c){if(_0x55588c){_0x414a0d=_0x55588c;return db['VoiceContext']['findAll']({'raw':!![]});}})[_0xc845('0x1d')](function(_0x3d3b61){var _0x5a5433=fs[_0xc845('0x6a')](path[_0xc845('0x5a')](config[_0xc845('0x5b')],_0xc845('0x6b')),'utf8');var _0x171b99=ejs['render'](_0x5a5433,{'contexts':_0x3d3b61||[]});fs[_0xc845('0x5e')](_0xc845('0x5f'),_0x171b99);})[_0xc845('0x1d')](function(){return respondWithRpcPromise(_0xc845('0x60'),_0xc845('0x34'),{'module':_0xc845('0x61')});})['then'](function(){return _0x414a0d;})[_0xc845('0x1d')](respondWithResult(_0x36af6a,null))[_0xc845('0x27')](handleError(_0x36af6a,null));};exports[_0xc845('0x35')]=function(_0x4b638a,_0x2f9f77,_0x5288a0){var _0x5c973c;return db[_0xc845('0x3d')]['find']({'where':{'id':_0x4b638a[_0xc845('0x56')]['id']}})['then'](handleEntityNotFound(_0x2f9f77,null))[_0xc845('0x1d')](removeEntity(_0x2f9f77,null))[_0xc845('0x1d')](function(){return db[_0xc845('0x3d')]['findAll']({'raw':!![]});})[_0xc845('0x1d')](function(_0x245e6a){var _0xb5261c=fs[_0xc845('0x6a')](path[_0xc845('0x5a')](config['root'],_0xc845('0x6b')),_0xc845('0x5c'));var _0x44be69=ejs['render'](_0xb5261c,{'contexts':_0x245e6a});fs[_0xc845('0x5e')](_0xc845('0x5f'),_0x44be69);return respondWithRpcPromise(_0xc845('0x60'),_0xc845('0x35'),{'module':'chan_sip.so'});})[_0xc845('0x27')](handleError(_0x2f9f77,null));}; \ No newline at end of file +var _0xfe9d=['show','params','keys','intersection','find','create','readFileSync','root','server/files/templates/context.ejs','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','body','join','utf8','Reload','chan_sip.so','eml-format','rimraf','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','http','then','info','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceContext,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','update','destroy','get','Contexts','stack','name','map','VoiceContext','rawAttributes','fieldName','type','key','model','filters','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows'];(function(_0x4854d6,_0x2f1264){var _0x3885c0=function(_0x4d564d){while(--_0x4d564d){_0x4854d6['push'](_0x4854d6['shift']());}};_0x3885c0(++_0x2f1264);}(_0xfe9d,0xe3));var _0xdfe9=function(_0x4d42ef,_0x4bb24f){_0x4d42ef=_0x4d42ef-0x0;var _0x87ee38=_0xfe9d[_0x4d42ef];return _0x87ee38;};'use strict';var emlformat=require(_0xdfe9('0x0'));var rimraf=require(_0xdfe9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xdfe9('0x2'));var BPromise=require(_0xdfe9('0x3'));var Mustache=require(_0xdfe9('0x4'));var util=require('util');var path=require(_0xdfe9('0x5'));var sox=require('sox');var csv=require(_0xdfe9('0x6'));var ejs=require(_0xdfe9('0x7'));var fs=require('fs');var fs_extra=require(_0xdfe9('0x8'));var _=require(_0xdfe9('0x9'));var squel=require(_0xdfe9('0xa'));var crypto=require(_0xdfe9('0xb'));var jsforce=require(_0xdfe9('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xdfe9('0x6'));var querystring=require(_0xdfe9('0xd'));var Papa=require(_0xdfe9('0xe'));var Redis=require('ioredis');var authService=require(_0xdfe9('0xf'));var qs=require(_0xdfe9('0x10'));var as=require(_0xdfe9('0x11'));var hardwareService=require(_0xdfe9('0x12'));var logger=require(_0xdfe9('0x13'))(_0xdfe9('0x14'));var utils=require(_0xdfe9('0x15'));var config=require(_0xdfe9('0x16'));var licenseUtil=require(_0xdfe9('0x17'));var db=require(_0xdfe9('0x18'))['db'];var jayson=require(_0xdfe9('0x19'));var client=jayson['client'][_0xdfe9('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x515de1,_0x3d4200,_0x38ceae,_0x264bf4){return new BPromise(function(_0x1a5c01,_0x5a1e4b){var _0x547af2=_0x264bf4||client;return _0x547af2['request'](_0x515de1,_0x38ceae)[_0xdfe9('0x1b')](function(_0xc2c7fc){logger[_0xdfe9('0x1c')]('VoiceContext,\x20%s,\x20%s',_0x3d4200,_0xdfe9('0x1d'));logger[_0xdfe9('0x1e')](_0xdfe9('0x1f'),_0x3d4200,_0xdfe9('0x1d'),JSON[_0xdfe9('0x20')](_0xc2c7fc));if(_0xc2c7fc[_0xdfe9('0x21')]){if(_0xc2c7fc[_0xdfe9('0x21')][_0xdfe9('0x22')]===0x1f4){logger[_0xdfe9('0x21')](_0xdfe9('0x23'),_0x3d4200,_0xc2c7fc[_0xdfe9('0x21')]['message']);return _0x5a1e4b(_0xc2c7fc['error']['message']);}logger[_0xdfe9('0x21')](_0xdfe9('0x23'),_0x3d4200,_0xc2c7fc[_0xdfe9('0x21')]['message']);return _0x1a5c01(_0xc2c7fc[_0xdfe9('0x21')][_0xdfe9('0x24')]);}else{logger[_0xdfe9('0x1c')](_0xdfe9('0x23'),_0x3d4200,_0xdfe9('0x1d'));_0x1a5c01(_0xc2c7fc[_0xdfe9('0x25')][_0xdfe9('0x24')]);}})[_0xdfe9('0x26')](function(_0x5bea9b){logger[_0xdfe9('0x21')](_0xdfe9('0x23'),_0x3d4200,_0x5bea9b);_0x5a1e4b(_0x5bea9b);});});}function respondWithStatusCode(_0x3c361c,_0x37f89c){_0x37f89c=_0x37f89c||0xcc;return function(_0xf1783){if(_0xf1783){return _0x3c361c[_0xdfe9('0x27')](_0x37f89c);}return _0x3c361c[_0xdfe9('0x28')](_0x37f89c)[_0xdfe9('0x29')]();};}function respondWithResult(_0x2d2941,_0x2359ee){_0x2359ee=_0x2359ee||0xc8;return function(_0x33e8e9){if(_0x33e8e9){return _0x2d2941['status'](_0x2359ee)[_0xdfe9('0x2a')](_0x33e8e9);}};}function respondWithFilteredResult(_0x46b600,_0x17fa95){return function(_0x55ae68){if(_0x55ae68){var _0xcd9991=typeof _0x17fa95[_0xdfe9('0x2b')]===_0xdfe9('0x2c')&&typeof _0x17fa95['limit']===_0xdfe9('0x2c');var _0x3fa6c9=_0x55ae68[_0xdfe9('0x2d')];var _0x444d0a=_0xcd9991?0x0:_0x17fa95[_0xdfe9('0x2b')];var _0x23104b=_0xcd9991?_0x55ae68['count']:_0x17fa95[_0xdfe9('0x2b')]+_0x17fa95[_0xdfe9('0x2e')];var _0x56e447;if(_0x23104b>=_0x3fa6c9){_0x23104b=_0x3fa6c9;_0x56e447=0xc8;}else{_0x56e447=0xce;}_0x46b600['status'](_0x56e447);return _0x46b600[_0xdfe9('0x2f')](_0xdfe9('0x30'),_0x444d0a+'-'+_0x23104b+'/'+_0x3fa6c9)['json'](_0x55ae68);}return null;};}function patchUpdates(_0x94b512){return function(_0x52b3fe){try{jsonpatch['apply'](_0x52b3fe,_0x94b512,!![]);}catch(_0x197da7){return BPromise['reject'](_0x197da7);}return _0x52b3fe['save']();};}function saveUpdates(_0x2baa5e,_0xe4ae0d){return function(_0x153b4b){if(_0x153b4b){return _0x153b4b[_0xdfe9('0x31')](_0x2baa5e)['then'](function(_0x150fcc){return _0x150fcc;});}return null;};}function removeEntity(_0x46ba93,_0x2855c2){return function(_0x2feefb){if(_0x2feefb){return _0x2feefb[_0xdfe9('0x32')]()[_0xdfe9('0x1b')](function(){var _0xe0c25a=_0x2feefb[_0xdfe9('0x33')]({'plain':!![]});var _0x1d8803=_0xdfe9('0x34');return db['UserProfileResource'][_0xdfe9('0x32')]({'where':{'type':_0x1d8803,'resourceId':_0xe0c25a['id']}})[_0xdfe9('0x1b')](function(){return _0x2feefb;});})[_0xdfe9('0x1b')](function(){_0x46ba93[_0xdfe9('0x28')](0xcc)[_0xdfe9('0x29')]();});}};}function handleEntityNotFound(_0x1911c3,_0x5331f6){return function(_0x1042a9){if(!_0x1042a9){_0x1911c3[_0xdfe9('0x27')](0x194);}return _0x1042a9;};}function handleError(_0x2fb4e6,_0x50be00){_0x50be00=_0x50be00||0x1f4;return function(_0x2315a1){logger[_0xdfe9('0x21')](_0x2315a1[_0xdfe9('0x35')]);if(_0x2315a1[_0xdfe9('0x36')]){delete _0x2315a1[_0xdfe9('0x36')];}_0x2fb4e6[_0xdfe9('0x28')](_0x50be00)['send'](_0x2315a1);};}exports['index']=function(_0xfa5af9,_0x19f249){var _0x1fad1a={},_0xa54c7a={},_0x1d3bce={'count':0x0,'rows':[]};var _0x1cb62e=_[_0xdfe9('0x37')](db[_0xdfe9('0x38')][_0xdfe9('0x39')],function(_0x27b6f9){return{'name':_0x27b6f9[_0xdfe9('0x3a')],'type':_0x27b6f9[_0xdfe9('0x3b')][_0xdfe9('0x3c')]};});_0xa54c7a[_0xdfe9('0x3d')]=_[_0xdfe9('0x37')](_0x1cb62e,_0xdfe9('0x36'));_0xa54c7a['query']=_['keys'](_0xfa5af9['query']);_0xa54c7a[_0xdfe9('0x3e')]=_['intersection'](_0xa54c7a[_0xdfe9('0x3d')],_0xa54c7a[_0xdfe9('0x3f')]);_0x1fad1a[_0xdfe9('0x40')]=_['intersection'](_0xa54c7a[_0xdfe9('0x3d')],qs[_0xdfe9('0x41')](_0xfa5af9['query'][_0xdfe9('0x41')]));_0x1fad1a['attributes']=_0x1fad1a[_0xdfe9('0x40')][_0xdfe9('0x42')]?_0x1fad1a[_0xdfe9('0x40')]:_0xa54c7a['model'];if(!_0xfa5af9[_0xdfe9('0x3f')][_0xdfe9('0x43')](_0xdfe9('0x44'))){_0x1fad1a[_0xdfe9('0x2e')]=qs[_0xdfe9('0x2e')](_0xfa5af9[_0xdfe9('0x3f')]['limit']);_0x1fad1a[_0xdfe9('0x2b')]=qs[_0xdfe9('0x2b')](_0xfa5af9['query'][_0xdfe9('0x2b')]);}_0x1fad1a['order']=qs[_0xdfe9('0x45')](_0xfa5af9[_0xdfe9('0x3f')]['sort']);_0x1fad1a[_0xdfe9('0x46')]=qs[_0xdfe9('0x3e')](_[_0xdfe9('0x47')](_0xfa5af9[_0xdfe9('0x3f')],_0xa54c7a[_0xdfe9('0x3e')]),_0x1cb62e);if(_0xfa5af9[_0xdfe9('0x3f')][_0xdfe9('0x48')]){_0x1fad1a[_0xdfe9('0x46')]=_['merge'](_0x1fad1a['where'],{'$or':_[_0xdfe9('0x37')](_0x1cb62e,function(_0x281615){if(_0x281615[_0xdfe9('0x3b')]!=='VIRTUAL'){var _0x45df37={};_0x45df37[_0x281615['name']]={'$like':'%'+_0xfa5af9[_0xdfe9('0x3f')]['filter']+'%'};return _0x45df37;}})});}_0x1fad1a=_[_0xdfe9('0x49')]({},_0x1fad1a,_0xfa5af9[_0xdfe9('0x4a')]);var _0x91d93c={'where':_0x1fad1a[_0xdfe9('0x46')]};return db[_0xdfe9('0x38')][_0xdfe9('0x2d')](_0x91d93c)[_0xdfe9('0x1b')](function(_0x5dd6d4){_0x1d3bce[_0xdfe9('0x2d')]=_0x5dd6d4;if(_0xfa5af9[_0xdfe9('0x3f')][_0xdfe9('0x4b')]){_0x1fad1a[_0xdfe9('0x4c')]=[{'all':!![]}];}return db[_0xdfe9('0x38')][_0xdfe9('0x4d')](_0x1fad1a);})[_0xdfe9('0x1b')](function(_0x28c71b){_0x1d3bce[_0xdfe9('0x4e')]=_0x28c71b;return _0x1d3bce;})[_0xdfe9('0x1b')](respondWithFilteredResult(_0x19f249,_0x1fad1a))[_0xdfe9('0x26')](handleError(_0x19f249,null));};exports[_0xdfe9('0x4f')]=function(_0x4259b0,_0x2bcc40){var _0x160879={'raw':![],'where':{'id':_0x4259b0[_0xdfe9('0x50')]['id']}},_0x2aba8a={};_0x2aba8a[_0xdfe9('0x3d')]=_[_0xdfe9('0x51')](db['VoiceContext']['rawAttributes']);_0x2aba8a['query']=_[_0xdfe9('0x51')](_0x4259b0[_0xdfe9('0x3f')]);_0x2aba8a['filters']=_[_0xdfe9('0x52')](_0x2aba8a[_0xdfe9('0x3d')],_0x2aba8a['query']);_0x160879['attributes']=_[_0xdfe9('0x52')](_0x2aba8a['model'],qs[_0xdfe9('0x41')](_0x4259b0[_0xdfe9('0x3f')]['fields']));_0x160879[_0xdfe9('0x40')]=_0x160879[_0xdfe9('0x40')][_0xdfe9('0x42')]?_0x160879[_0xdfe9('0x40')]:_0x2aba8a[_0xdfe9('0x3d')];if(_0x4259b0['query']['includeAll']){_0x160879[_0xdfe9('0x4c')]=[{'all':!![]}];}_0x160879=_[_0xdfe9('0x49')]({},_0x160879,_0x4259b0['options']);return db[_0xdfe9('0x38')][_0xdfe9('0x53')](_0x160879)[_0xdfe9('0x1b')](handleEntityNotFound(_0x2bcc40,null))[_0xdfe9('0x1b')](respondWithResult(_0x2bcc40,null))[_0xdfe9('0x26')](handleError(_0x2bcc40,null));};exports['create']=function(_0xab1d3,_0x5a33b1,_0x2b13d6){var _0x495b63;return db['VoiceContext'][_0xdfe9('0x54')](_0xab1d3['body'],{'raw':!![]})['then'](function(_0x52cd63){_0x495b63=_0x52cd63;return db['VoiceContext'][_0xdfe9('0x4d')]({'raw':!![]});})[_0xdfe9('0x1b')](function(_0x298335){var _0x38d402=fs[_0xdfe9('0x55')](path['join'](config[_0xdfe9('0x56')],_0xdfe9('0x57')),'utf8');var _0x17582e=ejs[_0xdfe9('0x58')](_0x38d402,{'contexts':_0x298335||[]});fs[_0xdfe9('0x59')](_0xdfe9('0x5a'),_0x17582e);})[_0xdfe9('0x1b')](function(){return respondWithRpcPromise('Reload',_0xdfe9('0x54'),{'module':'chan_sip.so'});})[_0xdfe9('0x1b')](function(){var _0x1bd0fe=_0xab1d3[_0xdfe9('0x5b')][_0xdfe9('0x33')]({'plain':!![]});if(!_0x1bd0fe)throw new Error(_0xdfe9('0x5c'));if(_0x1bd0fe['role']===_0xdfe9('0x5b')){var _0x488a8f=_0x495b63[_0xdfe9('0x33')]({'plain':!![]});return db[_0xdfe9('0x5d')][_0xdfe9('0x53')]({'where':{'name':_0xdfe9('0x34'),'userProfileId':_0x1bd0fe[_0xdfe9('0x5e')]},'raw':!![]})[_0xdfe9('0x1b')](function(_0x318f5d){if(_0x318f5d&&_0x318f5d[_0xdfe9('0x5f')]===0x0){return db[_0xdfe9('0x60')]['create']({'name':_0x488a8f[_0xdfe9('0x36')],'resourceId':_0x488a8f['id'],'type':_0x318f5d[_0xdfe9('0x36')],'sectionId':_0x318f5d['id']},{})[_0xdfe9('0x1b')](function(){return _0x495b63;});}else{return _0x495b63;}})['catch'](function(_0x768d72){logger[_0xdfe9('0x21')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x768d72);throw _0x768d72;});}return _0x495b63;})[_0xdfe9('0x1b')](respondWithResult(_0x5a33b1,0xc9))[_0xdfe9('0x26')](handleError(_0x5a33b1,null));};exports['update']=function(_0x5d2d63,_0xf6a67,_0x35052b){var _0x177044;return db[_0xdfe9('0x38')][_0xdfe9('0x53')]({'where':{'id':_0x5d2d63[_0xdfe9('0x50')]['id']}})[_0xdfe9('0x1b')](handleEntityNotFound(_0xf6a67,null))[_0xdfe9('0x1b')](saveUpdates(_0x5d2d63[_0xdfe9('0x61')],null))[_0xdfe9('0x1b')](function(_0x13d53f){if(_0x13d53f){_0x177044=_0x13d53f;return db['VoiceContext'][_0xdfe9('0x4d')]({'raw':!![]});}})[_0xdfe9('0x1b')](function(_0x3f282f){var _0x1aa523=fs[_0xdfe9('0x55')](path[_0xdfe9('0x62')](config['root'],_0xdfe9('0x57')),_0xdfe9('0x63'));var _0x4b011b=ejs[_0xdfe9('0x58')](_0x1aa523,{'contexts':_0x3f282f||[]});fs[_0xdfe9('0x59')](_0xdfe9('0x5a'),_0x4b011b);})[_0xdfe9('0x1b')](function(){return respondWithRpcPromise(_0xdfe9('0x64'),_0xdfe9('0x31'),{'module':_0xdfe9('0x65')});})[_0xdfe9('0x1b')](function(){return _0x177044;})[_0xdfe9('0x1b')](respondWithResult(_0xf6a67,null))['catch'](handleError(_0xf6a67,null));};exports[_0xdfe9('0x32')]=function(_0x560bec,_0x32987b,_0x33f35c){var _0x27cc88;return db[_0xdfe9('0x38')][_0xdfe9('0x53')]({'where':{'id':_0x560bec[_0xdfe9('0x50')]['id']}})['then'](handleEntityNotFound(_0x32987b,null))[_0xdfe9('0x1b')](removeEntity(_0x32987b,null))['then'](function(){return db[_0xdfe9('0x38')]['findAll']({'raw':!![]});})['then'](function(_0x383f29){var _0x17e4fc=fs[_0xdfe9('0x55')](path[_0xdfe9('0x62')](config[_0xdfe9('0x56')],_0xdfe9('0x57')),'utf8');var _0x3e4798=ejs[_0xdfe9('0x58')](_0x17e4fc,{'contexts':_0x383f29});fs['writeFileSync'](_0xdfe9('0x5a'),_0x3e4798);return respondWithRpcPromise(_0xdfe9('0x64'),_0xdfe9('0x32'),{'module':'chan_sip.so'});})[_0xdfe9('0x26')](handleError(_0x32987b,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index f1fd1a9..82f077f 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 _0x8556=['rimraf','../../config/environment','./voiceContext.attributes','exports','define','voice_contexts','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x2b3bb6,_0x521fdc){var _0x28d643=function(_0x10ddc2){while(--_0x10ddc2){_0x2b3bb6['push'](_0x2b3bb6['shift']());}};_0x28d643(++_0x521fdc);}(_0x8556,0x1da));var _0x6855=function(_0xbeb3fb,_0x289ba7){_0xbeb3fb=_0xbeb3fb-0x0;var _0x4b45d5=_0x8556[_0xbeb3fb];return _0x4b45d5;};'use strict';var _=require(_0x6855('0x0'));var util=require(_0x6855('0x1'));var logger=require(_0x6855('0x2'))('api');var moment=require(_0x6855('0x3'));var BPromise=require(_0x6855('0x4'));var rp=require(_0x6855('0x5'));var fs=require('fs');var path=require(_0x6855('0x6'));var rimraf=require(_0x6855('0x7'));var config=require(_0x6855('0x8'));var attributes=require(_0x6855('0x9'));module[_0x6855('0xa')]=function(_0x346b22,_0x2b02bf){return _0x346b22[_0x6855('0xb')]('VoiceContext',attributes,{'tableName':_0x6855('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6abc=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceContext.attributes','exports','VoiceContext'];(function(_0x29fa3d,_0x45d24f){var _0x5d4bbf=function(_0x5b89ef){while(--_0x5b89ef){_0x29fa3d['push'](_0x29fa3d['shift']());}};_0x5d4bbf(++_0x45d24f);}(_0x6abc,0x9c));var _0xc6ab=function(_0x4966ff,_0x1f2858){_0x4966ff=_0x4966ff-0x0;var _0x35619b=_0x6abc[_0x4966ff];return _0x35619b;};'use strict';var _=require('lodash');var util=require(_0xc6ab('0x0'));var logger=require(_0xc6ab('0x1'))(_0xc6ab('0x2'));var moment=require(_0xc6ab('0x3'));var BPromise=require(_0xc6ab('0x4'));var rp=require(_0xc6ab('0x5'));var fs=require('fs');var path=require(_0xc6ab('0x6'));var rimraf=require(_0xc6ab('0x7'));var config=require(_0xc6ab('0x8'));var attributes=require(_0xc6ab('0x9'));module[_0xc6ab('0xa')]=function(_0x511c66,_0x50a80d){return _0x511c66['define'](_0xc6ab('0xb'),attributes,{'tableName':'voice_contexts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.rpc.js b/server/api/voiceContext/voiceContext.rpc.js index 0faab2b..4cb06f6 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 _0x345e=['request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','VoiceContext,\x20%s,\x20%s'];(function(_0x2384f6,_0x167775){var _0x370294=function(_0x8f68f4){while(--_0x8f68f4){_0x2384f6['push'](_0x2384f6['shift']());}};_0x370294(++_0x167775);}(_0x345e,0x168));var _0xe345=function(_0x282ff9,_0x268bfe){_0x282ff9=_0x282ff9-0x0;var _0x542612=_0x345e[_0x282ff9];return _0x542612;};'use strict';var _=require(_0xe345('0x0'));var util=require(_0xe345('0x1'));var moment=require('moment');var BPromise=require(_0xe345('0x2'));var rs=require(_0xe345('0x3'));var fs=require('fs');var Redis=require(_0xe345('0x4'));var db=require(_0xe345('0x5'))['db'];var utils=require(_0xe345('0x6'));var logger=require(_0xe345('0x7'))(_0xe345('0x8'));var config=require(_0xe345('0x9'));var jayson=require(_0xe345('0xa'));var client=jayson['client'][_0xe345('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x38cc87,_0x27fc55,_0x246b2f){return new BPromise(function(_0x24f14f,_0x18f9a3){return client['request'](_0x38cc87,_0x246b2f)['then'](function(_0x41bd55){logger[_0xe345('0xc')](_0xe345('0xd'),_0x27fc55,_0xe345('0xe'));logger[_0xe345('0xf')](_0xe345('0x10'),_0x27fc55,_0xe345('0xe'),JSON[_0xe345('0x11')](_0x41bd55));if(_0x41bd55[_0xe345('0x12')]){if(_0x41bd55[_0xe345('0x12')]['code']===0x1f4){logger[_0xe345('0x12')](_0xe345('0xd'),_0x27fc55,_0x41bd55['error']['message']);return _0x18f9a3(_0x41bd55[_0xe345('0x12')]['message']);}logger[_0xe345('0x12')]('VoiceContext,\x20%s,\x20%s',_0x27fc55,_0x41bd55['error'][_0xe345('0x13')]);return _0x24f14f(_0x41bd55[_0xe345('0x12')][_0xe345('0x13')]);}else{logger[_0xe345('0xc')](_0xe345('0xd'),_0x27fc55,_0xe345('0xe'));_0x24f14f(_0x41bd55[_0xe345('0x14')][_0xe345('0x13')]);}})[_0xe345('0x15')](function(_0x1f983c){logger['error']('VoiceContext,\x20%s,\x20%s',_0x27fc55,_0x1f983c);_0x18f9a3(_0x1f983c);});});} \ No newline at end of file +var _0xe35d=['rpc','../../config/environment','jayson/promise','client','http','request','info','VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x187d54,_0x30ea6b){var _0x1fcde9=function(_0x4776fc){while(--_0x4776fc){_0x187d54['push'](_0x187d54['shift']());}};_0x1fcde9(++_0x30ea6b);}(_0xe35d,0xd5));var _0xde35=function(_0x32aaa2,_0x3e4922){_0x32aaa2=_0x32aaa2-0x0;var _0x521d68=_0xe35d[_0x32aaa2];return _0x521d68;};'use strict';var _=require(_0xde35('0x0'));var util=require(_0xde35('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xde35('0x2'));var fs=require('fs');var Redis=require(_0xde35('0x3'));var db=require(_0xde35('0x4'))['db'];var utils=require(_0xde35('0x5'));var logger=require(_0xde35('0x6'))(_0xde35('0x7'));var config=require(_0xde35('0x8'));var jayson=require(_0xde35('0x9'));var client=jayson[_0xde35('0xa')][_0xde35('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x57c5a7,_0x1f0541,_0xe542e){return new BPromise(function(_0x3200e1,_0x25c8a1){return client[_0xde35('0xc')](_0x57c5a7,_0xe542e)['then'](function(_0xa3af60){logger[_0xde35('0xd')](_0xde35('0xe'),_0x1f0541,'request\x20sent');logger[_0xde35('0xf')](_0xde35('0x10'),_0x1f0541,'request\x20sent',JSON[_0xde35('0x11')](_0xa3af60));if(_0xa3af60['error']){if(_0xa3af60[_0xde35('0x12')]['code']===0x1f4){logger[_0xde35('0x12')]('VoiceContext,\x20%s,\x20%s',_0x1f0541,_0xa3af60['error']['message']);return _0x25c8a1(_0xa3af60['error']['message']);}logger[_0xde35('0x12')](_0xde35('0xe'),_0x1f0541,_0xa3af60['error']['message']);return _0x3200e1(_0xa3af60[_0xde35('0x12')][_0xde35('0x13')]);}else{logger[_0xde35('0xd')](_0xde35('0xe'),_0x1f0541,_0xde35('0x14'));_0x3200e1(_0xa3af60['result'][_0xde35('0x13')]);}})[_0xde35('0x15')](function(_0x274de6){logger[_0xde35('0x12')](_0xde35('0xe'),_0x1f0541,_0x274de6);_0x25c8a1(_0x274de6);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index f4f74e6..7d53e55 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 _0x62c8=['describe','/:id','show','post','create','put','update','destroy','exports','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','isAuthenticated','index','get','/describe'];(function(_0x485b5a,_0x2b289b){var _0xd2b34d=function(_0x34dcbd){while(--_0x34dcbd){_0x485b5a['push'](_0x485b5a['shift']());}};_0xd2b34d(++_0x2b289b);}(_0x62c8,0x1ad));var _0x862c=function(_0x16509d,_0x304198){_0x16509d=_0x16509d-0x0;var _0x2186bf=_0x62c8[_0x16509d];return _0x2186bf;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x862c('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x862c('0x1')]();var fs_extra=require(_0x862c('0x2'));var auth=require(_0x862c('0x3'));var interaction=require(_0x862c('0x4'));var config=require(_0x862c('0x5'));var controller=require(_0x862c('0x6'));router['get']('/',auth[_0x862c('0x7')](),controller[_0x862c('0x8')]);router[_0x862c('0x9')](_0x862c('0xa'),auth[_0x862c('0x7')](),controller[_0x862c('0xb')]);router[_0x862c('0x9')](_0x862c('0xc'),auth[_0x862c('0x7')](),controller[_0x862c('0xd')]);router[_0x862c('0xe')]('/',auth['isAuthenticated'](),controller[_0x862c('0xf')]);router[_0x862c('0x10')](_0x862c('0xc'),auth[_0x862c('0x7')](),controller[_0x862c('0x11')]);router['delete'](_0x862c('0xc'),auth[_0x862c('0x7')](),controller[_0x862c('0x12')]);module[_0x862c('0x13')]=router; \ No newline at end of file +var _0xc62c=['get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc62c,0x1c2));var _0xcc62=function(_0x2b1194,_0xa3b63c){_0x2b1194=_0x2b1194-0x0;var _0x419c1c=_0xc62c[_0x2b1194];return _0x419c1c;};'use strict';var multer=require(_0xcc62('0x0'));var util=require(_0xcc62('0x1'));var path=require(_0xcc62('0x2'));var timeout=require(_0xcc62('0x3'));var express=require('express');var router=express[_0xcc62('0x4')]();var fs_extra=require(_0xcc62('0x5'));var auth=require(_0xcc62('0x6'));var interaction=require(_0xcc62('0x7'));var config=require(_0xcc62('0x8'));var controller=require(_0xcc62('0x9'));router[_0xcc62('0xa')]('/',auth[_0xcc62('0xb')](),controller[_0xcc62('0xc')]);router['get'](_0xcc62('0xd'),auth['isAuthenticated'](),controller[_0xcc62('0xe')]);router['get'](_0xcc62('0xf'),auth[_0xcc62('0xb')](),controller[_0xcc62('0x10')]);router[_0xcc62('0x11')]('/',auth[_0xcc62('0xb')](),controller[_0xcc62('0x12')]);router[_0xcc62('0x13')]('/:id',auth['isAuthenticated'](),controller[_0xcc62('0x14')]);router['delete'](_0xcc62('0xf'),auth[_0xcc62('0xb')](),controller[_0xcc62('0x15')]);module[_0xcc62('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 1216bb2..5bc1cf4 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 _0x4b84=['INTEGER','STRING','DATE','called,connect,complete','sequelize','exports'];(function(_0xa86554,_0x48cad0){var _0xa8b033=function(_0x2ab23a){while(--_0x2ab23a){_0xa86554['push'](_0xa86554['shift']());}};_0xa8b033(++_0x48cad0);}(_0x4b84,0x1cc));var _0x44b8=function(_0x5c4585,_0x3d0eab){_0x5c4585=_0x5c4585-0x0;var _0x21dede=_0x4b84[_0x5c4585];return _0x21dede;};'use strict';var Sequelize=require(_0x44b8('0x0'));module[_0x44b8('0x1')]={'privilege':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x44b8('0x2')]},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x44b8('0x3')]},'connectedlinenum':{'type':Sequelize[_0x44b8('0x3')]},'connectedlinename':{'type':Sequelize[_0x44b8('0x3')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x44b8('0x3')]},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x44b8('0x3')]},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x44b8('0x3')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x44b8('0x3')]},'destcalleridname':{'type':Sequelize[_0x44b8('0x3')]},'destconnectedlinenum':{'type':Sequelize[_0x44b8('0x3')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x44b8('0x3')]},'destaccountcode':{'type':Sequelize[_0x44b8('0x3')]},'destcontext':{'type':Sequelize[_0x44b8('0x3')]},'destexten':{'type':Sequelize[_0x44b8('0x3')]},'destpriority':{'type':Sequelize[_0x44b8('0x2')]},'destuniqueid':{'type':Sequelize[_0x44b8('0x3')]},'destlinkedid':{'type':Sequelize[_0x44b8('0x3')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0x44b8('0x3')]},'starttime':{'type':Sequelize[_0x44b8('0x4')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x44b8('0x4')]},'lastevent':{'type':Sequelize['STRING'],'comment':_0x44b8('0x5')},'routeId':{'type':Sequelize[_0x44b8('0x2')]},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize[_0x44b8('0x2')]},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x8d0e=['INTEGER','DATE','called,connect,complete','sequelize','exports','STRING'];(function(_0x3f55a9,_0x4f946c){var _0x14b097=function(_0x232927){while(--_0x232927){_0x3f55a9['push'](_0x3f55a9['shift']());}};_0x14b097(++_0x4f946c);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x506d5d,_0x2c94aa){_0x506d5d=_0x506d5d-0x0;var _0x2ceee5=_0x8d0e[_0x506d5d];return _0x2ceee5;};'use strict';var Sequelize=require(_0xe8d0('0x0'));module[_0xe8d0('0x1')]={'privilege':{'type':Sequelize[_0xe8d0('0x2')]},'channel':{'type':Sequelize[_0xe8d0('0x2')]},'channelstate':{'type':Sequelize[_0xe8d0('0x3')]},'channelstatedesc':{'type':Sequelize[_0xe8d0('0x2')]},'calleridnum':{'type':Sequelize[_0xe8d0('0x2')]},'calleridname':{'type':Sequelize[_0xe8d0('0x2')]},'connectedlinenum':{'type':Sequelize[_0xe8d0('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xe8d0('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xe8d0('0x2')]},'priority':{'type':Sequelize[_0xe8d0('0x3')]},'uniqueid':{'type':Sequelize[_0xe8d0('0x2')]},'linkedid':{'type':Sequelize[_0xe8d0('0x2')]},'destchannel':{'type':Sequelize[_0xe8d0('0x2')]},'destchannelstate':{'type':Sequelize[_0xe8d0('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xe8d0('0x2')]},'destcalleridnum':{'type':Sequelize[_0xe8d0('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xe8d0('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xe8d0('0x2')]},'destlanguage':{'type':Sequelize[_0xe8d0('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0xe8d0('0x2')]},'destpriority':{'type':Sequelize[_0xe8d0('0x3')]},'destuniqueid':{'type':Sequelize[_0xe8d0('0x2')]},'destlinkedid':{'type':Sequelize[_0xe8d0('0x2')]},'dialstring':{'type':Sequelize[_0xe8d0('0x2')]},'dialstatus':{'type':Sequelize[_0xe8d0('0x2')]},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xe8d0('0x4')]},'endtime':{'type':Sequelize[_0xe8d0('0x4')]},'lastevent':{'type':Sequelize['STRING'],'comment':_0xe8d0('0x5')},'routeId':{'type':Sequelize['INTEGER']},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize[_0xe8d0('0x3')]},'billableseconds':{'type':Sequelize[_0xe8d0('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 9b0977d..f0af815 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 _0x6f29=['params','keys','includeAll','include','options','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','limit','undefined','count','set','apply','reject','save','update','destroy','then','end','error','stack','name','send','index','map','VoiceDialReport','rawAttributes','type','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','rows','catch','show'];(function(_0x8bb4c1,_0x2d6e53){var _0x67a6e1=function(_0x1155e5){while(--_0x1155e5){_0x8bb4c1['push'](_0x8bb4c1['shift']());}};_0x67a6e1(++_0x2d6e53);}(_0x6f29,0xa5));var _0x96f2=function(_0x373f3c,_0x44e12b){_0x373f3c=_0x373f3c-0x0;var _0x555326=_0x6f29[_0x373f3c];return _0x555326;};'use strict';var emlformat=require(_0x96f2('0x0'));var rimraf=require(_0x96f2('0x1'));var zipdir=require(_0x96f2('0x2'));var jsonpatch=require(_0x96f2('0x3'));var rp=require(_0x96f2('0x4'));var moment=require('moment');var BPromise=require(_0x96f2('0x5'));var Mustache=require(_0x96f2('0x6'));var util=require(_0x96f2('0x7'));var path=require(_0x96f2('0x8'));var sox=require(_0x96f2('0x9'));var csv=require(_0x96f2('0xa'));var ejs=require(_0x96f2('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x96f2('0xc'));var crypto=require(_0x96f2('0xd'));var jsforce=require(_0x96f2('0xe'));var deskjs=require(_0x96f2('0xf'));var toCsv=require(_0x96f2('0xa'));var querystring=require(_0x96f2('0x10'));var Papa=require(_0x96f2('0x11'));var Redis=require(_0x96f2('0x12'));var authService=require(_0x96f2('0x13'));var qs=require(_0x96f2('0x14'));var as=require(_0x96f2('0x15'));var hardwareService=require(_0x96f2('0x16'));var logger=require(_0x96f2('0x17'))(_0x96f2('0x18'));var utils=require(_0x96f2('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x96f2('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x12e56a,_0x2636df){_0x2636df=_0x2636df||0xcc;return function(_0xfa95e4){if(_0xfa95e4){return _0x12e56a[_0x96f2('0x1b')](_0x2636df);}return _0x12e56a['status'](_0x2636df)['end']();};}function respondWithResult(_0x20d328,_0x4302cf){_0x4302cf=_0x4302cf||0xc8;return function(_0x2c10f1){if(_0x2c10f1){return _0x20d328[_0x96f2('0x1c')](_0x4302cf)[_0x96f2('0x1d')](_0x2c10f1);}};}function respondWithFilteredResult(_0x34278b,_0x3c653b){return function(_0x1a2746){if(_0x1a2746){var _0x139d40=typeof _0x3c653b[_0x96f2('0x1e')]==='undefined'&&typeof _0x3c653b[_0x96f2('0x1f')]===_0x96f2('0x20');var _0x497d71=_0x1a2746[_0x96f2('0x21')];var _0x31135f=_0x139d40?0x0:_0x3c653b[_0x96f2('0x1e')];var _0x4ef915=_0x139d40?_0x1a2746[_0x96f2('0x21')]:_0x3c653b[_0x96f2('0x1e')]+_0x3c653b[_0x96f2('0x1f')];var _0x3aebe8;if(_0x4ef915>=_0x497d71){_0x4ef915=_0x497d71;_0x3aebe8=0xc8;}else{_0x3aebe8=0xce;}_0x34278b[_0x96f2('0x1c')](_0x3aebe8);return _0x34278b[_0x96f2('0x22')]('Content-Range',_0x31135f+'-'+_0x4ef915+'/'+_0x497d71)['json'](_0x1a2746);}return null;};}function patchUpdates(_0x350a4a){return function(_0x492666){try{jsonpatch[_0x96f2('0x23')](_0x492666,_0x350a4a,!![]);}catch(_0x228750){return BPromise[_0x96f2('0x24')](_0x228750);}return _0x492666[_0x96f2('0x25')]();};}function saveUpdates(_0x51b008,_0x5084cd){return function(_0x394b73){if(_0x394b73){return _0x394b73[_0x96f2('0x26')](_0x51b008)['then'](function(_0x1a089b){return _0x1a089b;});}return null;};}function removeEntity(_0x10a715,_0x2ffdc6){return function(_0x39b2a3){if(_0x39b2a3){return _0x39b2a3[_0x96f2('0x27')]()[_0x96f2('0x28')](function(){_0x10a715[_0x96f2('0x1c')](0xcc)[_0x96f2('0x29')]();});}};}function handleEntityNotFound(_0x1bc41a,_0x55fb81){return function(_0x42076c){if(!_0x42076c){_0x1bc41a[_0x96f2('0x1b')](0x194);}return _0x42076c;};}function handleError(_0x2281e9,_0x10acb3){_0x10acb3=_0x10acb3||0x1f4;return function(_0x544557){logger[_0x96f2('0x2a')](_0x544557[_0x96f2('0x2b')]);if(_0x544557[_0x96f2('0x2c')]){delete _0x544557['name'];}_0x2281e9[_0x96f2('0x1c')](_0x10acb3)[_0x96f2('0x2d')](_0x544557);};}exports[_0x96f2('0x2e')]=function(_0x496a68,_0x588ccf){var _0x176de7={},_0xb0fcb={},_0x416fd9={'count':0x0,'rows':[]};var _0x441de9=_[_0x96f2('0x2f')](db[_0x96f2('0x30')][_0x96f2('0x31')],function(_0x3c4688){return{'name':_0x3c4688['fieldName'],'type':_0x3c4688[_0x96f2('0x32')]['key']};});_0xb0fcb[_0x96f2('0x33')]=_[_0x96f2('0x2f')](_0x441de9,'name');_0xb0fcb['query']=_['keys'](_0x496a68[_0x96f2('0x34')]);_0xb0fcb[_0x96f2('0x35')]=_['intersection'](_0xb0fcb[_0x96f2('0x33')],_0xb0fcb[_0x96f2('0x34')]);_0x176de7[_0x96f2('0x36')]=_[_0x96f2('0x37')](_0xb0fcb[_0x96f2('0x33')],qs[_0x96f2('0x38')](_0x496a68[_0x96f2('0x34')][_0x96f2('0x38')]));_0x176de7['attributes']=_0x176de7[_0x96f2('0x36')][_0x96f2('0x39')]?_0x176de7[_0x96f2('0x36')]:_0xb0fcb[_0x96f2('0x33')];if(!_0x496a68[_0x96f2('0x34')][_0x96f2('0x3a')](_0x96f2('0x3b'))){_0x176de7[_0x96f2('0x1f')]=qs['limit'](_0x496a68[_0x96f2('0x34')]['limit']);_0x176de7[_0x96f2('0x1e')]=qs['offset'](_0x496a68[_0x96f2('0x34')]['offset']);}_0x176de7[_0x96f2('0x3c')]=qs[_0x96f2('0x3d')](_0x496a68[_0x96f2('0x34')][_0x96f2('0x3d')]);_0x176de7[_0x96f2('0x3e')]=qs[_0x96f2('0x35')](_[_0x96f2('0x3f')](_0x496a68[_0x96f2('0x34')],_0xb0fcb[_0x96f2('0x35')]),_0x441de9);if(_0x496a68[_0x96f2('0x34')][_0x96f2('0x40')]){_0x176de7[_0x96f2('0x3e')]=_[_0x96f2('0x41')](_0x176de7[_0x96f2('0x3e')],{'$or':_[_0x96f2('0x2f')](_0x441de9,function(_0x2a74e3){if(_0x2a74e3[_0x96f2('0x32')]!=='VIRTUAL'){var _0x55fa89={};_0x55fa89[_0x2a74e3[_0x96f2('0x2c')]]={'$like':'%'+_0x496a68[_0x96f2('0x34')]['filter']+'%'};return _0x55fa89;}})});}_0x176de7=_[_0x96f2('0x41')]({},_0x176de7,_0x496a68['options']);var _0x2fb60b={'where':_0x176de7[_0x96f2('0x3e')]};return db[_0x96f2('0x30')][_0x96f2('0x21')](_0x2fb60b)[_0x96f2('0x28')](function(_0x44d303){_0x416fd9[_0x96f2('0x21')]=_0x44d303;if(_0x496a68[_0x96f2('0x34')]['includeAll']){_0x176de7['include']=[{'all':!![]}];}return db[_0x96f2('0x30')]['findAll'](_0x176de7);})[_0x96f2('0x28')](function(_0x178bf0){_0x416fd9[_0x96f2('0x42')]=_0x178bf0;return _0x416fd9;})[_0x96f2('0x28')](respondWithFilteredResult(_0x588ccf,_0x176de7))[_0x96f2('0x43')](handleError(_0x588ccf,null));};exports[_0x96f2('0x44')]=function(_0x51f2f1,_0x58c09f){var _0x4c004f={'raw':!![],'where':{'id':_0x51f2f1[_0x96f2('0x45')]['id']}},_0xc82562={};_0xc82562[_0x96f2('0x33')]=_[_0x96f2('0x46')](db['VoiceDialReport'][_0x96f2('0x31')]);_0xc82562[_0x96f2('0x34')]=_['keys'](_0x51f2f1[_0x96f2('0x34')]);_0xc82562[_0x96f2('0x35')]=_[_0x96f2('0x37')](_0xc82562[_0x96f2('0x33')],_0xc82562[_0x96f2('0x34')]);_0x4c004f[_0x96f2('0x36')]=_[_0x96f2('0x37')](_0xc82562[_0x96f2('0x33')],qs[_0x96f2('0x38')](_0x51f2f1[_0x96f2('0x34')][_0x96f2('0x38')]));_0x4c004f[_0x96f2('0x36')]=_0x4c004f[_0x96f2('0x36')][_0x96f2('0x39')]?_0x4c004f['attributes']:_0xc82562[_0x96f2('0x33')];if(_0x51f2f1[_0x96f2('0x34')][_0x96f2('0x47')]){_0x4c004f[_0x96f2('0x48')]=[{'all':!![]}];}_0x4c004f=_['merge']({},_0x4c004f,_0x51f2f1[_0x96f2('0x49')]);return db[_0x96f2('0x30')]['find'](_0x4c004f)[_0x96f2('0x28')](handleEntityNotFound(_0x58c09f,null))[_0x96f2('0x28')](respondWithResult(_0x58c09f,null))[_0x96f2('0x43')](handleError(_0x58c09f,null));};exports['create']=function(_0x3a0eb6,_0x24ceda){return db['VoiceDialReport'][_0x96f2('0x4a')](_0x3a0eb6[_0x96f2('0x4b')],{})['then'](respondWithResult(_0x24ceda,0xc9))[_0x96f2('0x43')](handleError(_0x24ceda,null));};exports[_0x96f2('0x26')]=function(_0x465d2a,_0x379042){if(_0x465d2a[_0x96f2('0x4b')]['id']){delete _0x465d2a[_0x96f2('0x4b')]['id'];}return db['VoiceDialReport'][_0x96f2('0x4c')]({'where':{'id':_0x465d2a['params']['id']}})[_0x96f2('0x28')](handleEntityNotFound(_0x379042,null))[_0x96f2('0x28')](saveUpdates(_0x465d2a['body'],null))[_0x96f2('0x28')](respondWithResult(_0x379042,null))['catch'](handleError(_0x379042,null));};exports[_0x96f2('0x27')]=function(_0x267e79,_0x5129e5){return db[_0x96f2('0x30')][_0x96f2('0x4c')]({'where':{'id':_0x267e79[_0x96f2('0x45')]['id']}})['then'](handleEntityNotFound(_0x5129e5,null))[_0x96f2('0x28')](removeEntity(_0x5129e5,null))[_0x96f2('0x43')](handleError(_0x5129e5,null));};exports[_0x96f2('0x4d')]=function(_0x14e2dc,_0x39f21b){return db[_0x96f2('0x30')][_0x96f2('0x4d')]()[_0x96f2('0x28')](respondWithResult(_0x39f21b,null))[_0x96f2('0x43')](handleError(_0x39f21b,null));}; \ No newline at end of file +var _0xca5a=['stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','VoiceDialReport','rows','catch','show','create','body','find','params','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','end','error'];(function(_0xb0ef57,_0x22011d){var _0x3ddf63=function(_0x3aa64f){while(--_0x3aa64f){_0xb0ef57['push'](_0xb0ef57['shift']());}};_0x3ddf63(++_0x22011d);}(_0xca5a,0x1a5));var _0xaca5=function(_0x1c4006,_0x2524d4){_0x1c4006=_0x1c4006-0x0;var _0x19586e=_0xca5a[_0x1c4006];return _0x19586e;};'use strict';var emlformat=require(_0xaca5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xaca5('0x1'));var jsonpatch=require(_0xaca5('0x2'));var rp=require('request-promise');var moment=require(_0xaca5('0x3'));var BPromise=require(_0xaca5('0x4'));var Mustache=require(_0xaca5('0x5'));var util=require(_0xaca5('0x6'));var path=require(_0xaca5('0x7'));var sox=require(_0xaca5('0x8'));var csv=require(_0xaca5('0x9'));var ejs=require(_0xaca5('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xaca5('0xb'));var squel=require(_0xaca5('0xc'));var crypto=require('crypto');var jsforce=require(_0xaca5('0xd'));var deskjs=require(_0xaca5('0xe'));var toCsv=require(_0xaca5('0x9'));var querystring=require(_0xaca5('0xf'));var Papa=require(_0xaca5('0x10'));var Redis=require(_0xaca5('0x11'));var authService=require(_0xaca5('0x12'));var qs=require(_0xaca5('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaca5('0x14'));var logger=require(_0xaca5('0x15'))('api');var utils=require(_0xaca5('0x16'));var config=require(_0xaca5('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xaca5('0x18'))['db'];function respondWithStatusCode(_0x1ba04a,_0x539225){_0x539225=_0x539225||0xcc;return function(_0x20097d){if(_0x20097d){return _0x1ba04a[_0xaca5('0x19')](_0x539225);}return _0x1ba04a['status'](_0x539225)['end']();};}function respondWithResult(_0x5d96ad,_0xd52cd1){_0xd52cd1=_0xd52cd1||0xc8;return function(_0x9297d2){if(_0x9297d2){return _0x5d96ad[_0xaca5('0x1a')](_0xd52cd1)[_0xaca5('0x1b')](_0x9297d2);}};}function respondWithFilteredResult(_0x2ea080,_0x17135d){return function(_0x2e4512){if(_0x2e4512){var _0x33085d=typeof _0x17135d['offset']===_0xaca5('0x1c')&&typeof _0x17135d[_0xaca5('0x1d')]===_0xaca5('0x1c');var _0x193ff7=_0x2e4512[_0xaca5('0x1e')];var _0x5d2da0=_0x33085d?0x0:_0x17135d['offset'];var _0xe50ccc=_0x33085d?_0x2e4512[_0xaca5('0x1e')]:_0x17135d[_0xaca5('0x1f')]+_0x17135d[_0xaca5('0x1d')];var _0x19cca3;if(_0xe50ccc>=_0x193ff7){_0xe50ccc=_0x193ff7;_0x19cca3=0xc8;}else{_0x19cca3=0xce;}_0x2ea080[_0xaca5('0x1a')](_0x19cca3);return _0x2ea080[_0xaca5('0x20')](_0xaca5('0x21'),_0x5d2da0+'-'+_0xe50ccc+'/'+_0x193ff7)[_0xaca5('0x1b')](_0x2e4512);}return null;};}function patchUpdates(_0x1efcd7){return function(_0x5f0eba){try{jsonpatch['apply'](_0x5f0eba,_0x1efcd7,!![]);}catch(_0xe711e2){return BPromise[_0xaca5('0x22')](_0xe711e2);}return _0x5f0eba[_0xaca5('0x23')]();};}function saveUpdates(_0x57490a,_0x2e6c3c){return function(_0x2cdeac){if(_0x2cdeac){return _0x2cdeac[_0xaca5('0x24')](_0x57490a)[_0xaca5('0x25')](function(_0x5946b6){return _0x5946b6;});}return null;};}function removeEntity(_0x5bcea4,_0x179023){return function(_0x2947d0){if(_0x2947d0){return _0x2947d0[_0xaca5('0x26')]()[_0xaca5('0x25')](function(){_0x5bcea4[_0xaca5('0x1a')](0xcc)[_0xaca5('0x27')]();});}};}function handleEntityNotFound(_0xdc072,_0x253adc){return function(_0x2eab40){if(!_0x2eab40){_0xdc072[_0xaca5('0x19')](0x194);}return _0x2eab40;};}function handleError(_0x45aa04,_0x437490){_0x437490=_0x437490||0x1f4;return function(_0x3e2d1){logger[_0xaca5('0x28')](_0x3e2d1[_0xaca5('0x29')]);if(_0x3e2d1[_0xaca5('0x2a')]){delete _0x3e2d1['name'];}_0x45aa04[_0xaca5('0x1a')](_0x437490)[_0xaca5('0x2b')](_0x3e2d1);};}exports[_0xaca5('0x2c')]=function(_0x245523,_0x361a37){var _0x3f4d7e={},_0x1708fe={},_0x23d87f={'count':0x0,'rows':[]};var _0x22c441=_['map'](db['VoiceDialReport'][_0xaca5('0x2d')],function(_0xb062ed){return{'name':_0xb062ed[_0xaca5('0x2e')],'type':_0xb062ed[_0xaca5('0x2f')][_0xaca5('0x30')]};});_0x1708fe[_0xaca5('0x31')]=_[_0xaca5('0x32')](_0x22c441,'name');_0x1708fe[_0xaca5('0x33')]=_[_0xaca5('0x34')](_0x245523['query']);_0x1708fe[_0xaca5('0x35')]=_['intersection'](_0x1708fe[_0xaca5('0x31')],_0x1708fe['query']);_0x3f4d7e[_0xaca5('0x36')]=_[_0xaca5('0x37')](_0x1708fe[_0xaca5('0x31')],qs[_0xaca5('0x38')](_0x245523[_0xaca5('0x33')]['fields']));_0x3f4d7e[_0xaca5('0x36')]=_0x3f4d7e[_0xaca5('0x36')][_0xaca5('0x39')]?_0x3f4d7e[_0xaca5('0x36')]:_0x1708fe[_0xaca5('0x31')];if(!_0x245523['query'][_0xaca5('0x3a')]('nolimit')){_0x3f4d7e[_0xaca5('0x1d')]=qs[_0xaca5('0x1d')](_0x245523[_0xaca5('0x33')][_0xaca5('0x1d')]);_0x3f4d7e[_0xaca5('0x1f')]=qs[_0xaca5('0x1f')](_0x245523['query'][_0xaca5('0x1f')]);}_0x3f4d7e[_0xaca5('0x3b')]=qs['sort'](_0x245523[_0xaca5('0x33')][_0xaca5('0x3c')]);_0x3f4d7e[_0xaca5('0x3d')]=qs[_0xaca5('0x35')](_[_0xaca5('0x3e')](_0x245523[_0xaca5('0x33')],_0x1708fe[_0xaca5('0x35')]),_0x22c441);if(_0x245523[_0xaca5('0x33')][_0xaca5('0x3f')]){_0x3f4d7e[_0xaca5('0x3d')]=_[_0xaca5('0x40')](_0x3f4d7e[_0xaca5('0x3d')],{'$or':_[_0xaca5('0x32')](_0x22c441,function(_0x51d557){if(_0x51d557[_0xaca5('0x2f')]!==_0xaca5('0x41')){var _0x504341={};_0x504341[_0x51d557[_0xaca5('0x2a')]]={'$like':'%'+_0x245523[_0xaca5('0x33')][_0xaca5('0x3f')]+'%'};return _0x504341;}})});}_0x3f4d7e=_[_0xaca5('0x40')]({},_0x3f4d7e,_0x245523[_0xaca5('0x42')]);var _0x2a4986={'where':_0x3f4d7e[_0xaca5('0x3d')]};return db['VoiceDialReport']['count'](_0x2a4986)[_0xaca5('0x25')](function(_0x597262){_0x23d87f[_0xaca5('0x1e')]=_0x597262;if(_0x245523['query'][_0xaca5('0x43')]){_0x3f4d7e[_0xaca5('0x44')]=[{'all':!![]}];}return db[_0xaca5('0x45')]['findAll'](_0x3f4d7e);})[_0xaca5('0x25')](function(_0x2ec764){_0x23d87f[_0xaca5('0x46')]=_0x2ec764;return _0x23d87f;})[_0xaca5('0x25')](respondWithFilteredResult(_0x361a37,_0x3f4d7e))[_0xaca5('0x47')](handleError(_0x361a37,null));};exports[_0xaca5('0x48')]=function(_0x2e470e,_0x391c9e){var _0x2157b4={'raw':!![],'where':{'id':_0x2e470e['params']['id']}},_0x17f491={};_0x17f491['model']=_[_0xaca5('0x34')](db[_0xaca5('0x45')][_0xaca5('0x2d')]);_0x17f491['query']=_['keys'](_0x2e470e[_0xaca5('0x33')]);_0x17f491[_0xaca5('0x35')]=_[_0xaca5('0x37')](_0x17f491[_0xaca5('0x31')],_0x17f491[_0xaca5('0x33')]);_0x2157b4[_0xaca5('0x36')]=_[_0xaca5('0x37')](_0x17f491[_0xaca5('0x31')],qs[_0xaca5('0x38')](_0x2e470e[_0xaca5('0x33')][_0xaca5('0x38')]));_0x2157b4['attributes']=_0x2157b4[_0xaca5('0x36')]['length']?_0x2157b4[_0xaca5('0x36')]:_0x17f491[_0xaca5('0x31')];if(_0x2e470e[_0xaca5('0x33')]['includeAll']){_0x2157b4[_0xaca5('0x44')]=[{'all':!![]}];}_0x2157b4=_[_0xaca5('0x40')]({},_0x2157b4,_0x2e470e[_0xaca5('0x42')]);return db[_0xaca5('0x45')]['find'](_0x2157b4)[_0xaca5('0x25')](handleEntityNotFound(_0x391c9e,null))[_0xaca5('0x25')](respondWithResult(_0x391c9e,null))[_0xaca5('0x47')](handleError(_0x391c9e,null));};exports[_0xaca5('0x49')]=function(_0x4f70cf,_0x22f24d){return db[_0xaca5('0x45')][_0xaca5('0x49')](_0x4f70cf[_0xaca5('0x4a')],{})[_0xaca5('0x25')](respondWithResult(_0x22f24d,0xc9))[_0xaca5('0x47')](handleError(_0x22f24d,null));};exports[_0xaca5('0x24')]=function(_0x6e70ba,_0x4f6fcf){if(_0x6e70ba[_0xaca5('0x4a')]['id']){delete _0x6e70ba[_0xaca5('0x4a')]['id'];}return db[_0xaca5('0x45')][_0xaca5('0x4b')]({'where':{'id':_0x6e70ba[_0xaca5('0x4c')]['id']}})[_0xaca5('0x25')](handleEntityNotFound(_0x4f6fcf,null))[_0xaca5('0x25')](saveUpdates(_0x6e70ba['body'],null))[_0xaca5('0x25')](respondWithResult(_0x4f6fcf,null))[_0xaca5('0x47')](handleError(_0x4f6fcf,null));};exports[_0xaca5('0x26')]=function(_0x5c2a78,_0x15b3dc){return db[_0xaca5('0x45')][_0xaca5('0x4b')]({'where':{'id':_0x5c2a78[_0xaca5('0x4c')]['id']}})['then'](handleEntityNotFound(_0x15b3dc,null))[_0xaca5('0x25')](removeEntity(_0x15b3dc,null))[_0xaca5('0x47')](handleError(_0x15b3dc,null));};exports['describe']=function(_0x42cbd4,_0x3b022d){return db[_0xaca5('0x45')]['describe']()['then'](respondWithResult(_0x3b022d,null))['catch'](handleError(_0x3b022d,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 3963191..7ff55a1 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 _0x388e=['VoiceDialReport','report_dial','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./voiceDialReport.attributes','exports','define'];(function(_0x1b0c0a,_0x152846){var _0x275c61=function(_0x1f1300){while(--_0x1f1300){_0x1b0c0a['push'](_0x1b0c0a['shift']());}};_0x275c61(++_0x152846);}(_0x388e,0x17d));var _0xe388=function(_0x1969d3,_0x35ffa1){_0x1969d3=_0x1969d3-0x0;var _0x363e76=_0x388e[_0x1969d3];return _0x363e76;};'use strict';var _=require(_0xe388('0x0'));var util=require(_0xe388('0x1'));var logger=require(_0xe388('0x2'))(_0xe388('0x3'));var moment=require(_0xe388('0x4'));var BPromise=require(_0xe388('0x5'));var rp=require(_0xe388('0x6'));var fs=require('fs');var path=require(_0xe388('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe388('0x8'));module[_0xe388('0x9')]=function(_0x55918f,_0x49345e){return _0x55918f[_0xe388('0xa')](_0xe388('0xb'),attributes,{'tableName':_0xe388('0xc'),'paranoid':![],'indexes':[{'fields':[_0xe388('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x750c=['./voiceDialReport.attributes','exports','define','VoiceDialReport','util','../../config/logger','api','moment','path','rimraf','../../config/environment'];(function(_0x651909,_0x15c6b4){var _0x572299=function(_0x5e8a48){while(--_0x5e8a48){_0x651909['push'](_0x651909['shift']());}};_0x572299(++_0x15c6b4);}(_0x750c,0x1d2));var _0xc750=function(_0x45c712,_0x2e68b2){_0x45c712=_0x45c712-0x0;var _0xb612e0=_0x750c[_0x45c712];return _0xb612e0;};'use strict';var _=require('lodash');var util=require(_0xc750('0x0'));var logger=require(_0xc750('0x1'))(_0xc750('0x2'));var moment=require(_0xc750('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xc750('0x4'));var rimraf=require(_0xc750('0x5'));var config=require(_0xc750('0x6'));var attributes=require(_0xc750('0x7'));module[_0xc750('0x8')]=function(_0x59c655,_0x53111a){return _0x59c655[_0xc750('0x9')](_0xc750('0xa'),attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 88eeab4..6cc3f53 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 _0xebcc=['raw','catch','UpdateVoiceDialReport','update','where','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','VoiceDialReport,\x20%s,\x20%s','message','result','CreateVoiceDialReport','VoiceDialReport','create','body','options'];(function(_0x363ef8,_0x4ecb1a){var _0x148822=function(_0x232634){while(--_0x232634){_0x363ef8['push'](_0x363ef8['shift']());}};_0x148822(++_0x4ecb1a);}(_0xebcc,0x69));var _0xcebc=function(_0x4ae578,_0x47156f){_0x4ae578=_0x4ae578-0x0;var _0x386e83=_0xebcc[_0x4ae578];return _0x386e83;};'use strict';var _=require(_0xcebc('0x0'));var util=require(_0xcebc('0x1'));var moment=require(_0xcebc('0x2'));var BPromise=require(_0xcebc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcebc('0x4'));var db=require(_0xcebc('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xcebc('0x6'));var config=require(_0xcebc('0x7'));var jayson=require(_0xcebc('0x8'));var client=jayson[_0xcebc('0x9')][_0xcebc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3ef8c4,_0x20275d,_0x30d3f8){return new BPromise(function(_0x4762d4,_0x40c027){return client[_0xcebc('0xb')](_0x3ef8c4,_0x30d3f8)[_0xcebc('0xc')](function(_0x199b58){logger[_0xcebc('0xd')]('VoiceDialReport,\x20%s,\x20%s',_0x20275d,_0xcebc('0xe'));logger[_0xcebc('0xf')](_0xcebc('0x10'),_0x20275d,_0xcebc('0xe'),JSON[_0xcebc('0x11')](_0x199b58));if(_0x199b58[_0xcebc('0x12')]){if(_0x199b58[_0xcebc('0x12')]['code']===0x1f4){logger[_0xcebc('0x12')](_0xcebc('0x13'),_0x20275d,_0x199b58[_0xcebc('0x12')][_0xcebc('0x14')]);return _0x40c027(_0x199b58['error']['message']);}logger['error'](_0xcebc('0x13'),_0x20275d,_0x199b58[_0xcebc('0x12')][_0xcebc('0x14')]);return _0x4762d4(_0x199b58['error'][_0xcebc('0x14')]);}else{logger[_0xcebc('0xd')](_0xcebc('0x13'),_0x20275d,'request\x20sent');_0x4762d4(_0x199b58[_0xcebc('0x15')][_0xcebc('0x14')]);}})['catch'](function(_0x57dc0c){logger['error'](_0xcebc('0x13'),_0x20275d,_0x57dc0c);_0x40c027(_0x57dc0c);});});}exports[_0xcebc('0x16')]=function(_0x4be227){var _0x53470a=this;return new Promise(function(_0x3d2eea,_0x2a745f){return db[_0xcebc('0x17')][_0xcebc('0x18')](_0x4be227[_0xcebc('0x19')],{'raw':_0x4be227[_0xcebc('0x1a')]?_0x4be227[_0xcebc('0x1a')][_0xcebc('0x1b')]===undefined?!![]:![]:!![]})[_0xcebc('0xc')](function(_0x363b1c){logger[_0xcebc('0xd')](_0xcebc('0x16'),_0x4be227);logger[_0xcebc('0xf')](_0xcebc('0x16'),_0x4be227,JSON[_0xcebc('0x11')](_0x363b1c));_0x3d2eea(_0x363b1c);})[_0xcebc('0x1c')](function(_0x3a55c5){logger[_0xcebc('0x12')](_0xcebc('0x16'),_0x3a55c5['message'],_0x4be227);_0x2a745f(_0x53470a['error'](0x1f4,_0x3a55c5[_0xcebc('0x14')]));});});};exports[_0xcebc('0x1d')]=function(_0x3440d3){var _0x1bb4f2=this;return new Promise(function(_0x5e7bae,_0x517fc0){return db['VoiceDialReport'][_0xcebc('0x1e')](_0x3440d3[_0xcebc('0x19')],{'raw':_0x3440d3[_0xcebc('0x1a')]?_0x3440d3[_0xcebc('0x1a')][_0xcebc('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3440d3[_0xcebc('0x1a')]?_0x3440d3[_0xcebc('0x1a')][_0xcebc('0x1f')]||null:null,'attributes':_0x3440d3[_0xcebc('0x1a')]?_0x3440d3[_0xcebc('0x1a')]['attributes']||null:null,'limit':_0x3440d3[_0xcebc('0x1a')]?_0x3440d3[_0xcebc('0x1a')][_0xcebc('0x20')]||null:null})[_0xcebc('0xc')](function(_0x1a05ad){logger['info'](_0xcebc('0x1d'),_0x3440d3);logger[_0xcebc('0xf')](_0xcebc('0x1d'),_0x3440d3,JSON[_0xcebc('0x11')](_0x1a05ad));_0x5e7bae(_0x1a05ad);})[_0xcebc('0x1c')](function(_0x23e774){logger[_0xcebc('0x12')](_0xcebc('0x1d'),_0x23e774[_0xcebc('0x14')],_0x3440d3);_0x517fc0(_0x1bb4f2[_0xcebc('0x12')](0x1f4,_0x23e774[_0xcebc('0x14')]));});});}; \ No newline at end of file +var _0x076f=['result','catch','VoiceDialReport','create','body','options','raw','then','CreateVoiceDialReport','UpdateVoiceDialReport','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x42858b,_0x4eba05){var _0x731031=function(_0x57538d){while(--_0x57538d){_0x42858b['push'](_0x42858b['shift']());}};_0x731031(++_0x4eba05);}(_0x076f,0x9b));var _0xf076=function(_0xba0c2,_0x54cc50){_0xba0c2=_0xba0c2-0x0;var _0x5a9fa0=_0x076f[_0xba0c2];return _0x5a9fa0;};'use strict';var _=require(_0xf076('0x0'));var util=require('util');var moment=require(_0xf076('0x1'));var BPromise=require(_0xf076('0x2'));var rs=require(_0xf076('0x3'));var fs=require('fs');var Redis=require(_0xf076('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf076('0x5'));var logger=require(_0xf076('0x6'))(_0xf076('0x7'));var config=require(_0xf076('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf076('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xb66978,_0x439efc,_0x224cf5){return new BPromise(function(_0x3e61ab,_0x1910bb){return client['request'](_0xb66978,_0x224cf5)['then'](function(_0x40d946){logger[_0xf076('0xa')](_0xf076('0xb'),_0x439efc,_0xf076('0xc'));logger[_0xf076('0xd')](_0xf076('0xe'),_0x439efc,'request\x20sent',JSON[_0xf076('0xf')](_0x40d946));if(_0x40d946[_0xf076('0x10')]){if(_0x40d946['error'][_0xf076('0x11')]===0x1f4){logger[_0xf076('0x10')](_0xf076('0xb'),_0x439efc,_0x40d946[_0xf076('0x10')]['message']);return _0x1910bb(_0x40d946[_0xf076('0x10')][_0xf076('0x12')]);}logger[_0xf076('0x10')](_0xf076('0xb'),_0x439efc,_0x40d946['error'][_0xf076('0x12')]);return _0x3e61ab(_0x40d946['error'][_0xf076('0x12')]);}else{logger['info']('VoiceDialReport,\x20%s,\x20%s',_0x439efc,'request\x20sent');_0x3e61ab(_0x40d946[_0xf076('0x13')][_0xf076('0x12')]);}})[_0xf076('0x14')](function(_0x525cdc){logger['error'](_0xf076('0xb'),_0x439efc,_0x525cdc);_0x1910bb(_0x525cdc);});});}exports['CreateVoiceDialReport']=function(_0x58d655){var _0x1bd4f2=this;return new Promise(function(_0x78cf99,_0x186b4d){return db[_0xf076('0x15')][_0xf076('0x16')](_0x58d655[_0xf076('0x17')],{'raw':_0x58d655[_0xf076('0x18')]?_0x58d655[_0xf076('0x18')][_0xf076('0x19')]===undefined?!![]:![]:!![]})[_0xf076('0x1a')](function(_0xabe8f9){logger[_0xf076('0xa')](_0xf076('0x1b'),_0x58d655);logger[_0xf076('0xd')]('CreateVoiceDialReport',_0x58d655,JSON[_0xf076('0xf')](_0xabe8f9));_0x78cf99(_0xabe8f9);})[_0xf076('0x14')](function(_0x534bc4){logger[_0xf076('0x10')]('CreateVoiceDialReport',_0x534bc4[_0xf076('0x12')],_0x58d655);_0x186b4d(_0x1bd4f2[_0xf076('0x10')](0x1f4,_0x534bc4[_0xf076('0x12')]));});});};exports[_0xf076('0x1c')]=function(_0x1623c9){var _0x265fa0=this;return new Promise(function(_0x171ff2,_0x1b93f8){return db[_0xf076('0x15')]['update'](_0x1623c9[_0xf076('0x17')],{'raw':_0x1623c9['options']?_0x1623c9[_0xf076('0x18')][_0xf076('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1623c9[_0xf076('0x18')]?_0x1623c9['options']['where']||null:null,'attributes':_0x1623c9[_0xf076('0x18')]?_0x1623c9['options']['attributes']||null:null,'limit':_0x1623c9['options']?_0x1623c9[_0xf076('0x18')]['limit']||null:null})[_0xf076('0x1a')](function(_0x18092a){logger[_0xf076('0xa')]('UpdateVoiceDialReport',_0x1623c9);logger[_0xf076('0xd')](_0xf076('0x1c'),_0x1623c9,JSON[_0xf076('0xf')](_0x18092a));_0x171ff2(_0x18092a);})[_0xf076('0x14')](function(_0x190b4e){logger[_0xf076('0x10')](_0xf076('0x1c'),_0x190b4e[_0xf076('0x12')],_0x1623c9);_0x1b93f8(_0x265fa0[_0xf076('0x10')](0x1f4,_0x190b4e['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 990b931..6429acd 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 _0x4031=['destroy','multer','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','/:id','isAuthenticated','post','create','/:id/applications','addApplications','put','update','delete'];(function(_0x28aebc,_0xd247dc){var _0x82d4ac=function(_0x2f491a){while(--_0x2f491a){_0x28aebc['push'](_0x28aebc['shift']());}};_0x82d4ac(++_0xd247dc);}(_0x4031,0x169));var _0x1403=function(_0x39e3eb,_0x352020){_0x39e3eb=_0x39e3eb-0x0;var _0x444c91=_0x4031[_0x39e3eb];return _0x444c91;};'use strict';var multer=require(_0x1403('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x1403('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x1403('0x2'));var auth=require(_0x1403('0x3'));var interaction=require(_0x1403('0x4'));var config=require(_0x1403('0x5'));var controller=require(_0x1403('0x6'));router[_0x1403('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x1403('0x7')](_0x1403('0x8'),auth[_0x1403('0x9')](),controller['show']);router[_0x1403('0xa')]('/',auth[_0x1403('0x9')](),controller[_0x1403('0xb')]);router[_0x1403('0xa')](_0x1403('0xc'),auth[_0x1403('0x9')](),controller[_0x1403('0xd')]);router[_0x1403('0xe')](_0x1403('0x8'),auth['isAuthenticated'](),controller[_0x1403('0xf')]);router[_0x1403('0x10')](_0x1403('0x8'),auth[_0x1403('0x9')](),controller[_0x1403('0x11')]);module['exports']=router; \ No newline at end of file +var _0xb197=['../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated','index','/:id','show','create','post','addApplications','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x46fcb2,_0x2d0872){var _0x403d25=function(_0x294b40){while(--_0x294b40){_0x46fcb2['push'](_0x46fcb2['shift']());}};_0x403d25(++_0x2d0872);}(_0xb197,0xa9));var _0x7b19=function(_0x44946b,_0xf874ec){_0x44946b=_0x44946b-0x0;var _0x249bc4=_0xb197[_0x44946b];return _0x249bc4;};'use strict';var multer=require(_0x7b19('0x0'));var util=require(_0x7b19('0x1'));var path=require(_0x7b19('0x2'));var timeout=require(_0x7b19('0x3'));var express=require(_0x7b19('0x4'));var router=express[_0x7b19('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x7b19('0x6'));var interaction=require(_0x7b19('0x7'));var config=require(_0x7b19('0x8'));var controller=require(_0x7b19('0x9'));router[_0x7b19('0xa')]('/',auth[_0x7b19('0xb')](),controller[_0x7b19('0xc')]);router[_0x7b19('0xa')](_0x7b19('0xd'),auth['isAuthenticated'](),controller[_0x7b19('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x7b19('0xf')]);router[_0x7b19('0x10')]('/:id/applications',auth[_0x7b19('0xb')](),controller[_0x7b19('0x11')]);router[_0x7b19('0x12')](_0x7b19('0xd'),auth[_0x7b19('0xb')](),controller[_0x7b19('0x13')]);router['delete']('/:id',auth[_0x7b19('0xb')](),controller[_0x7b19('0x14')]);module[_0x7b19('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 d431754..ee74821 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 _0xbaf0=['outbound','internal','inbound-fax','system','*,*,*,*','INTEGER','BOOLEAN','wav','getDataValue','exten','exports','STRING','compositeIndex','NoOp','ENUM','inbound'];(function(_0x15fe15,_0x220851){var _0x25e4c6=function(_0x5be2dd){while(--_0x5be2dd){_0x15fe15['push'](_0x15fe15['shift']());}};_0x25e4c6(++_0x220851);}(_0xbaf0,0x12a));var _0x0baf=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xbaf0[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'context':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'unique':_0x0baf('0x2'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'unique':_0x0baf('0x2')},'priority':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'defaultValue':_0x0baf('0x3')},'appdata':{'type':Sequelize[_0x0baf('0x1')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x0baf('0x4')](_0x0baf('0x5'),_0x0baf('0x6'),_0x0baf('0x7'),_0x0baf('0x8'),'outbound-fax',_0x0baf('0x9'),'any'),'allowNull':![]},'description':{'type':Sequelize[_0x0baf('0x1')]},'interval':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'defaultValue':_0x0baf('0xa')},'IntervalId':{'type':Sequelize[_0x0baf('0xb')]},'isApp':{'type':Sequelize[_0x0baf('0xc')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':null},'callerID':{'type':Sequelize[_0x0baf('0x1')],'allowNull':!![]},'record':{'type':Sequelize[_0x0baf('0xc')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x0baf('0xb')]},'recordingFormat':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':_0x0baf('0xd')},'answer':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x0baf('0xe')](_0x0baf('0xf'));}}}; \ No newline at end of file +var _0xe706=['VIRTUAL','getDataValue','exten','sequelize','exports','STRING','compositeIndex','NoOp','ENUM','inbound','outbound','internal','inbound-fax','outbound-fax','system','any','*,*,*,*','INTEGER','BOOLEAN','wav'];(function(_0xb00e90,_0x1c74bb){var _0x2a7db2=function(_0x131ff0){while(--_0x131ff0){_0xb00e90['push'](_0xb00e90['shift']());}};_0x2a7db2(++_0x1c74bb);}(_0xe706,0xa3));var _0x6e70=function(_0x3ab687,_0x2f3a18){_0x3ab687=_0x3ab687-0x0;var _0x512596=_0xe706[_0x3ab687];return _0x512596;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'context':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'unique':_0x6e70('0x3')},'priority':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'defaultValue':'1','unique':_0x6e70('0x3')},'tag':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'defaultValue':_0x6e70('0x4')},'appdata':{'type':Sequelize[_0x6e70('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x6e70('0x5')](_0x6e70('0x6'),_0x6e70('0x7'),_0x6e70('0x8'),_0x6e70('0x9'),_0x6e70('0xa'),_0x6e70('0xb'),_0x6e70('0xc')),'allowNull':![]},'description':{'type':Sequelize[_0x6e70('0x2')]},'interval':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'defaultValue':_0x6e70('0xd')},'IntervalId':{'type':Sequelize[_0x6e70('0xe')]},'isApp':{'type':Sequelize[_0x6e70('0xf')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0x6e70('0x2')],'allowNull':!![]},'record':{'type':Sequelize[_0x6e70('0xf')],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':_0x6e70('0x10')},'answer':{'type':Sequelize[_0x6e70('0xf')],'defaultValue':!![]},'name':{'type':Sequelize[_0x6e70('0x11')],'get':function(){return this[_0x6e70('0x12')](_0x6e70('0x13'));}}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index a3f3f42..60fe0e4 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 _0x27f4=['Transaction','READ_COMMITTED','findOne','VoiceExtensionId','isApp','createRouting','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','finally','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','count','limit','set','then','get','InboundRoutes','OutboundRoutes','outbound','InternalRoutes','internal','filter','ignore','map','value','find','name','UserProfileResource','destroy','error','stack','send','index','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','merge','VIRTUAL','options','VoiceExtension','include','findAll','rows','params','includeAll','catch','create','body','startsWith','exten','concat','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','inbound','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','description','recordingFormat','cutdigits','mandatoryDisposition','alias','addApplications','sequelize','transaction'];(function(_0x3e74f7,_0x17b946){var _0xfd6763=function(_0x5e6185){while(--_0x5e6185){_0x3e74f7['push'](_0x3e74f7['shift']());}};_0xfd6763(++_0x17b946);}(_0x27f4,0xd0));var _0x427f=function(_0x5c8628,_0x2fc5f5){_0x5c8628=_0x5c8628-0x0;var _0xcbd50e=_0x27f4[_0x5c8628];return _0xcbd50e;};'use strict';var _=require(_0x427f('0x0'));var Redis=require(_0x427f('0x1'));var qs=require(_0x427f('0x2'));var logger=require(_0x427f('0x3'))(_0x427f('0x4'));var config=require(_0x427f('0x5'));var db=require(_0x427f('0x6'))['db'];config[_0x427f('0x7')]=_['defaults'](config[_0x427f('0x7')],{'host':_0x427f('0x8'),'port':0x18eb});var socket=require(_0x427f('0x9'))(new Redis(config[_0x427f('0x7')]));require('./voiceExtension.socket')[_0x427f('0xa')](socket);function respondWithStatusCode(_0x1a603c,_0x2d3c26){_0x2d3c26=_0x2d3c26||0xcc;return function(_0x5e398a){if(_0x5e398a){return _0x1a603c[_0x427f('0xb')](_0x2d3c26);}return _0x1a603c[_0x427f('0xc')](_0x2d3c26)[_0x427f('0xd')]();};}function respondWithResult(_0x7949e7,_0x5dc7a2){_0x5dc7a2=_0x5dc7a2||0xc8;return function(_0x2dfd83){if(_0x2dfd83){return _0x7949e7['status'](_0x5dc7a2)[_0x427f('0xe')](_0x2dfd83);}};}function respondWithFilteredResult(_0x44b953,_0x3cbca3){return function(_0x35c7df){if(_0x35c7df){var _0x3f7103=typeof _0x3cbca3[_0x427f('0xf')]===_0x427f('0x10')&&typeof _0x3cbca3['limit']===_0x427f('0x10');var _0x499d58=_0x35c7df['count'];var _0x1abac7=_0x3f7103?0x0:_0x3cbca3[_0x427f('0xf')];var _0x4172a2=_0x3f7103?_0x35c7df[_0x427f('0x11')]:_0x3cbca3[_0x427f('0xf')]+_0x3cbca3[_0x427f('0x12')];var _0x3879b0;if(_0x4172a2>=_0x499d58){_0x4172a2=_0x499d58;_0x3879b0=0xc8;}else{_0x3879b0=0xce;}_0x44b953['status'](_0x3879b0);return _0x44b953[_0x427f('0x13')]('Content-Range',_0x1abac7+'-'+_0x4172a2+'/'+_0x499d58)['json'](_0x35c7df);}return null;};}function removeEntity(_0x299db1){return function(_0x50162c){if(_0x50162c){return _0x50162c['destroy']()[_0x427f('0x14')](function(){var _0x23b672=_0x50162c[_0x427f('0x15')]({'plain':!![]});var _0x4a8d85=[{'name':_0x427f('0x16'),'value':'inbound','ignore':![]},{'name':_0x427f('0x17'),'value':_0x427f('0x18'),'ignore':![]},{'name':_0x427f('0x19'),'value':_0x427f('0x1a'),'ignore':![]}];var _0x290a96=_(_0x4a8d85)[_0x427f('0x1b')](_0x427f('0x1c'))[_0x427f('0x1d')](_0x427f('0x1e'))[_0x427f('0x1e')]();if(_['includes'](_0x290a96,_0x23b672['type'])){return;}var _0x3ef807=_[_0x427f('0x1f')](_0x4a8d85,['value',_0x23b672['type']])[_0x427f('0x20')];return db[_0x427f('0x21')][_0x427f('0x22')]({'where':{'type':_0x3ef807,'resourceId':_0x23b672['id']}})[_0x427f('0x14')](function(){return _0x50162c;});})['then'](function(){_0x299db1[_0x427f('0xc')](0xcc)[_0x427f('0xd')]();});}};}function handleEntityNotFound(_0x2684ce){return function(_0x93a8e9){if(!_0x93a8e9){_0x2684ce['sendStatus'](0x194);}return _0x93a8e9;};}function handleError(_0x4dd0f9,_0x25f47f){_0x25f47f=_0x25f47f||0x1f4;return function(_0x4cecc9){logger[_0x427f('0x23')](_0x4cecc9[_0x427f('0x24')]);if(_0x4cecc9[_0x427f('0x20')]){delete _0x4cecc9[_0x427f('0x20')];}_0x4dd0f9['status'](_0x25f47f)[_0x427f('0x25')](_0x4cecc9);};}exports[_0x427f('0x26')]=function(_0x5e65d5,_0x137cf0){var _0x40d482={},_0x101c9b={},_0x1b63a2={'count':0x0,'rows':[]};var _0xe5c736=_[_0x427f('0x1d')](db['VoiceExtension'][_0x427f('0x27')],function(_0x1a900b){return{'name':_0x1a900b[_0x427f('0x28')],'type':_0x1a900b[_0x427f('0x29')][_0x427f('0x2a')]};});_0x101c9b[_0x427f('0x2b')]=_[_0x427f('0x1d')](_0xe5c736,'name');_0x101c9b['query']=_[_0x427f('0x2c')](_0x5e65d5[_0x427f('0x2d')]);_0x101c9b['filters']=_[_0x427f('0x2e')](_0x101c9b[_0x427f('0x2b')],_0x101c9b['query']);_0x40d482[_0x427f('0x2f')]=_['intersection'](_0x101c9b[_0x427f('0x2b')],qs[_0x427f('0x30')](_0x5e65d5['query'][_0x427f('0x30')]));_0x40d482[_0x427f('0x2f')]=_0x40d482['attributes'][_0x427f('0x31')]?_0x40d482['attributes']:_0x101c9b[_0x427f('0x2b')];if(!_0x5e65d5['query'][_0x427f('0x32')](_0x427f('0x33'))){_0x40d482[_0x427f('0x12')]=qs['limit'](_0x5e65d5[_0x427f('0x2d')]['limit']);_0x40d482['offset']=qs[_0x427f('0xf')](_0x5e65d5[_0x427f('0x2d')][_0x427f('0xf')]);}_0x40d482['order']=qs[_0x427f('0x34')](_0x5e65d5['query'][_0x427f('0x34')]);_0x40d482[_0x427f('0x35')]=qs[_0x427f('0x36')](_[_0x427f('0x37')](_0x5e65d5[_0x427f('0x2d')],_0x101c9b[_0x427f('0x36')]),_0xe5c736);if(_0x5e65d5[_0x427f('0x2d')]['filter']){_0x40d482[_0x427f('0x35')]=_[_0x427f('0x38')](_0x40d482[_0x427f('0x35')],{'$or':_['map'](_0xe5c736,function(_0x337b98){if(_0x337b98[_0x427f('0x29')]!==_0x427f('0x39')){var _0x1446e9={};_0x1446e9[_0x337b98[_0x427f('0x20')]]={'$like':'%'+_0x5e65d5[_0x427f('0x2d')][_0x427f('0x1b')]+'%'};return _0x1446e9;}})});}_0x40d482=_[_0x427f('0x38')]({},_0x40d482,_0x5e65d5[_0x427f('0x3a')]);var _0x16f872={'where':_0x40d482[_0x427f('0x35')]};return db[_0x427f('0x3b')][_0x427f('0x11')](_0x16f872)[_0x427f('0x14')](function(_0x2851a5){_0x1b63a2[_0x427f('0x11')]=_0x2851a5;if(_0x5e65d5[_0x427f('0x2d')]['includeAll']){_0x40d482[_0x427f('0x3c')]=[{'all':!![]}];}return db[_0x427f('0x3b')][_0x427f('0x3d')](_0x40d482);})[_0x427f('0x14')](function(_0x44fe13){_0x1b63a2[_0x427f('0x3e')]=_0x44fe13;return _0x1b63a2;})[_0x427f('0x14')](respondWithFilteredResult(_0x137cf0,_0x40d482))['catch'](handleError(_0x137cf0,null));};exports['show']=function(_0x245704,_0x11be85){var _0x4a3511={'raw':![],'where':{'id':_0x245704[_0x427f('0x3f')]['id']}},_0x2bb168={};_0x2bb168['model']=_[_0x427f('0x2c')](db[_0x427f('0x3b')][_0x427f('0x27')]);_0x2bb168[_0x427f('0x2d')]=_[_0x427f('0x2c')](_0x245704[_0x427f('0x2d')]);_0x2bb168[_0x427f('0x36')]=_[_0x427f('0x2e')](_0x2bb168[_0x427f('0x2b')],_0x2bb168[_0x427f('0x2d')]);_0x4a3511[_0x427f('0x2f')]=_[_0x427f('0x2e')](_0x2bb168['model'],qs[_0x427f('0x30')](_0x245704[_0x427f('0x2d')][_0x427f('0x30')]));_0x4a3511[_0x427f('0x2f')]=_0x4a3511[_0x427f('0x2f')][_0x427f('0x31')]?_0x4a3511[_0x427f('0x2f')]:_0x2bb168[_0x427f('0x2b')];if(_0x245704[_0x427f('0x2d')][_0x427f('0x40')]){_0x4a3511['include']=[{'all':!![]}];}_0x4a3511=_[_0x427f('0x38')]({},_0x4a3511,_0x245704[_0x427f('0x3a')]);return db[_0x427f('0x3b')][_0x427f('0x1f')](_0x4a3511)[_0x427f('0x14')](handleEntityNotFound(_0x11be85,null))['then'](respondWithResult(_0x11be85,null))[_0x427f('0x41')](handleError(_0x11be85,null));};exports[_0x427f('0x22')]=function(_0x47304c,_0x109ebe){return db[_0x427f('0x3b')][_0x427f('0x1f')]({'where':{'id':_0x47304c[_0x427f('0x3f')]['id']}})[_0x427f('0x14')](handleEntityNotFound(_0x109ebe,null))[_0x427f('0x14')](removeEntity(_0x109ebe,null))[_0x427f('0x41')](handleError(_0x109ebe,null));};exports[_0x427f('0x42')]=function(_0xf9cbad,_0x4b1ec5){if(_0xf9cbad[_0x427f('0x43')][_0x427f('0x29')]===_0x427f('0x18')&&!_[_0x427f('0x44')](_0xf9cbad[_0x427f('0x43')][_0x427f('0x45')],'_')){_0xf9cbad['body'][_0x427f('0x45')]='_'[_0x427f('0x46')](_0xf9cbad[_0x427f('0x43')]['exten']);}return db[_0x427f('0x3b')][_0x427f('0x42')](_0xf9cbad['body'],{'raw':![]})[_0x427f('0x14')](function(_0x2ec2aa){var _0x4c8076=_0xf9cbad['user']['get']({'plain':!![]});if(!_0x4c8076)throw new Error(_0x427f('0x47'));if(_0x4c8076[_0x427f('0x48')]===_0x427f('0x49')){var _0x3c901c=_0x2ec2aa[_0x427f('0x15')]({'plain':!![]});var _0x22c90f=[{'name':_0x427f('0x16'),'value':_0x427f('0x4a')},{'name':_0x427f('0x17'),'value':_0x427f('0x18')},{'name':_0x427f('0x19'),'value':_0x427f('0x1a')}];var _0x4861a4=_[_0x427f('0x1f')](_0x22c90f,[_0x427f('0x1e'),_0x3c901c['type']])[_0x427f('0x20')];return db[_0x427f('0x4b')][_0x427f('0x1f')]({'where':{'name':_0x4861a4,'userProfileId':_0x4c8076[_0x427f('0x4c')]},'raw':!![]})[_0x427f('0x14')](function(_0x544deb){if(_0x544deb&&_0x544deb[_0x427f('0x4d')]===0x0){return db[_0x427f('0x21')][_0x427f('0x42')]({'name':_0x3c901c[_0x427f('0x20')],'resourceId':_0x3c901c['id'],'type':_0x544deb['name'],'sectionId':_0x544deb['id']},{})['then'](function(){return _0x2ec2aa;});}else{return _0x2ec2aa;}})[_0x427f('0x41')](function(_0x66f091){logger[_0x427f('0x23')](_0x427f('0x4e'),_0x66f091);throw _0x66f091;});}return _0x2ec2aa;})['then'](respondWithResult(_0x4b1ec5,0xc9))[_0x427f('0x41')](handleError(_0x4b1ec5,null));};exports[_0x427f('0x4f')]=function(_0x4250d8,_0x481eb9){if(_0x4250d8[_0x427f('0x43')]['id']){delete _0x4250d8[_0x427f('0x43')]['id'];}return db[_0x427f('0x3b')][_0x427f('0x1f')]({'where':{'id':_0x4250d8[_0x427f('0x3f')]['id']}})['then'](handleEntityNotFound(_0x481eb9,null))['then'](function(_0x1c301c){if(_0x1c301c){return db['VoiceExtension'][_0x427f('0x4f')](_[_0x427f('0x37')](_0x4250d8[_0x427f('0x43')],[_0x427f('0x45'),_0x427f('0x50'),_0x427f('0x51'),_0x427f('0x52'),_0x427f('0x53'),_0x427f('0x54'),_0x427f('0x55')]),{'where':{'context':_0x1c301c['context'],'exten':_0x1c301c[_0x427f('0x45')]},'individualHooks':!![]})[_0x427f('0x14')](function(_0x3bd695){return _0x3bd695;});}return null;})[_0x427f('0x14')](respondWithStatusCode(_0x481eb9,null))[_0x427f('0x41')](handleError(_0x481eb9,null));};exports[_0x427f('0x56')]=function(_0x50b36b,_0x5184b5){var _0x22a0c7=_0x50b36b[_0x427f('0x3f')]['id'];var _0x1f6083=_0x50b36b[_0x427f('0x43')];var _0x556d5d=0xc8;var _0x4791e8=null;return db[_0x427f('0x57')][_0x427f('0x58')]({'isolationLevel':db[_0x427f('0x57')][_0x427f('0x59')]['ISOLATION_LEVELS'][_0x427f('0x5a')]},function(_0x15eb43){return db[_0x427f('0x3b')][_0x427f('0x5b')]({'where':{'id':_0x22a0c7},'transaction':_0x15eb43})[_0x427f('0x14')](function(_0x3ba2c9){if(_0x3ba2c9){return db[_0x427f('0x3b')]['destroy']({'where':{'VoiceExtensionId':_0x22a0c7},'transaction':_0x15eb43})['then'](function(){var _0x58e9a5=_[_0x427f('0x1d')](_0x1f6083,function(_0x3ce2f8){_0x3ce2f8[_0x427f('0x5c')]=_0x22a0c7;_0x3ce2f8[_0x427f('0x5d')]=!![];return _0x3ce2f8;});return _0x3ba2c9[_0x427f('0x5e')](_0x58e9a5);})[_0x427f('0x14')](function(_0x19235f){return db[_0x427f('0x3b')][_0x427f('0x5f')](_0x19235f,{'transaction':_0x15eb43});});}else{_0x556d5d=0x194;_0x4791e8=[];}});})['then'](function(){if(_0x556d5d!==0x194){return db[_0x427f('0x3b')][_0x427f('0x60')]({'where':{'isApp':!![],'VoiceExtensionId':_0x22a0c7},'order':_0x427f('0x61')})[_0x427f('0x14')](function(_0x14cbce){_0x4791e8=_0x14cbce;});}})[_0x427f('0x41')](function(_0x4037d6){_0x556d5d=0x1f4;logger[_0x427f('0x23')](_0x4037d6[_0x427f('0x24')]);if(_0x4037d6[_0x427f('0x20')]){delete _0x4037d6[_0x427f('0x20')];}_0x4791e8=_0x4037d6;})[_0x427f('0x62')](function(){if(_0x4791e8===null){_0x5184b5[_0x427f('0xb')](_0x556d5d);}else{if(_0x556d5d===0x1f4){_0x5184b5[_0x427f('0xc')](_0x556d5d)[_0x427f('0x25')](_0x4791e8);}else{_0x5184b5[_0x427f('0xc')](_0x556d5d)[_0x427f('0xe')](_0x4791e8);}}});}; \ No newline at end of file +var _0xdeb3=['json','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','status','end','offset','undefined','limit','count','destroy','get','InboundRoutes','inbound','OutboundRoutes','outbound','filter','ignore','map','value','includes','type','find','name','UserProfileResource','then','error','stack','index','VoiceExtension','rawAttributes','fieldName','model','keys','query','intersection','attributes','fields','length','nolimit','sort','filters','pick','merge','VIRTUAL','where','includeAll','include','rows','catch','show','params','options','body','exten','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','InternalRoutes','internal','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','description','mandatoryDisposition','alias','context','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','VoiceExtensionId','isApp','createRouting','findAndCountAll','cast(priority\x20as\x20unsigned)'];(function(_0x10a718,_0x1de534){var _0x3974b9=function(_0x514d01){while(--_0x514d01){_0x10a718['push'](_0x10a718['shift']());}};_0x3974b9(++_0x1de534);}(_0xdeb3,0x10c));var _0x3deb=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xdeb3[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x3deb('0x0'));var Redis=require(_0x3deb('0x1'));var qs=require(_0x3deb('0x2'));var logger=require(_0x3deb('0x3'))(_0x3deb('0x4'));var config=require(_0x3deb('0x5'));var db=require('../../mysqldb')['db'];config[_0x3deb('0x6')]=_[_0x3deb('0x7')](config[_0x3deb('0x6')],{'host':_0x3deb('0x8'),'port':0x18eb});var socket=require(_0x3deb('0x9'))(new Redis(config[_0x3deb('0x6')]));require(_0x3deb('0xa'))[_0x3deb('0xb')](socket);function respondWithStatusCode(_0x21d9c2,_0x3b26b6){_0x3b26b6=_0x3b26b6||0xcc;return function(_0x508eb9){if(_0x508eb9){return _0x21d9c2[_0x3deb('0xc')](_0x3b26b6);}return _0x21d9c2[_0x3deb('0xd')](_0x3b26b6)[_0x3deb('0xe')]();};}function respondWithResult(_0xd7ad55,_0x53fcf1){_0x53fcf1=_0x53fcf1||0xc8;return function(_0x20ddc6){if(_0x20ddc6){return _0xd7ad55[_0x3deb('0xd')](_0x53fcf1)['json'](_0x20ddc6);}};}function respondWithFilteredResult(_0x3f4684,_0x67a717){return function(_0x4acf8b){if(_0x4acf8b){var _0x33ea4f=typeof _0x67a717[_0x3deb('0xf')]===_0x3deb('0x10')&&typeof _0x67a717[_0x3deb('0x11')]===_0x3deb('0x10');var _0x4b7de3=_0x4acf8b[_0x3deb('0x12')];var _0x1313a0=_0x33ea4f?0x0:_0x67a717['offset'];var _0x2c7445=_0x33ea4f?_0x4acf8b[_0x3deb('0x12')]:_0x67a717['offset']+_0x67a717[_0x3deb('0x11')];var _0xd6280c;if(_0x2c7445>=_0x4b7de3){_0x2c7445=_0x4b7de3;_0xd6280c=0xc8;}else{_0xd6280c=0xce;}_0x3f4684[_0x3deb('0xd')](_0xd6280c);return _0x3f4684['set']('Content-Range',_0x1313a0+'-'+_0x2c7445+'/'+_0x4b7de3)['json'](_0x4acf8b);}return null;};}function removeEntity(_0x339ba2){return function(_0x4f2a3c){if(_0x4f2a3c){return _0x4f2a3c[_0x3deb('0x13')]()['then'](function(){var _0x365f8e=_0x4f2a3c[_0x3deb('0x14')]({'plain':!![]});var _0x3186f4=[{'name':_0x3deb('0x15'),'value':_0x3deb('0x16'),'ignore':![]},{'name':_0x3deb('0x17'),'value':_0x3deb('0x18'),'ignore':![]},{'name':'InternalRoutes','value':'internal','ignore':![]}];var _0x52e02d=_(_0x3186f4)[_0x3deb('0x19')](_0x3deb('0x1a'))[_0x3deb('0x1b')](_0x3deb('0x1c'))[_0x3deb('0x1c')]();if(_[_0x3deb('0x1d')](_0x52e02d,_0x365f8e[_0x3deb('0x1e')])){return;}var _0x503124=_[_0x3deb('0x1f')](_0x3186f4,[_0x3deb('0x1c'),_0x365f8e[_0x3deb('0x1e')]])[_0x3deb('0x20')];return db[_0x3deb('0x21')]['destroy']({'where':{'type':_0x503124,'resourceId':_0x365f8e['id']}})[_0x3deb('0x22')](function(){return _0x4f2a3c;});})[_0x3deb('0x22')](function(){_0x339ba2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x58f4ed){return function(_0x4abaa1){if(!_0x4abaa1){_0x58f4ed['sendStatus'](0x194);}return _0x4abaa1;};}function handleError(_0x413578,_0x29b4ff){_0x29b4ff=_0x29b4ff||0x1f4;return function(_0x4bddb4){logger[_0x3deb('0x23')](_0x4bddb4[_0x3deb('0x24')]);if(_0x4bddb4[_0x3deb('0x20')]){delete _0x4bddb4[_0x3deb('0x20')];}_0x413578[_0x3deb('0xd')](_0x29b4ff)['send'](_0x4bddb4);};}exports[_0x3deb('0x25')]=function(_0x27632d,_0x255dcd){var _0x3e91be={},_0x11f0d8={},_0x3f2e7c={'count':0x0,'rows':[]};var _0x406be5=_[_0x3deb('0x1b')](db[_0x3deb('0x26')][_0x3deb('0x27')],function(_0x3fd06d){return{'name':_0x3fd06d[_0x3deb('0x28')],'type':_0x3fd06d[_0x3deb('0x1e')]['key']};});_0x11f0d8[_0x3deb('0x29')]=_['map'](_0x406be5,_0x3deb('0x20'));_0x11f0d8['query']=_[_0x3deb('0x2a')](_0x27632d[_0x3deb('0x2b')]);_0x11f0d8['filters']=_[_0x3deb('0x2c')](_0x11f0d8[_0x3deb('0x29')],_0x11f0d8[_0x3deb('0x2b')]);_0x3e91be[_0x3deb('0x2d')]=_['intersection'](_0x11f0d8[_0x3deb('0x29')],qs[_0x3deb('0x2e')](_0x27632d[_0x3deb('0x2b')]['fields']));_0x3e91be[_0x3deb('0x2d')]=_0x3e91be['attributes'][_0x3deb('0x2f')]?_0x3e91be[_0x3deb('0x2d')]:_0x11f0d8[_0x3deb('0x29')];if(!_0x27632d[_0x3deb('0x2b')]['hasOwnProperty'](_0x3deb('0x30'))){_0x3e91be[_0x3deb('0x11')]=qs[_0x3deb('0x11')](_0x27632d[_0x3deb('0x2b')][_0x3deb('0x11')]);_0x3e91be[_0x3deb('0xf')]=qs[_0x3deb('0xf')](_0x27632d[_0x3deb('0x2b')][_0x3deb('0xf')]);}_0x3e91be['order']=qs[_0x3deb('0x31')](_0x27632d[_0x3deb('0x2b')][_0x3deb('0x31')]);_0x3e91be['where']=qs[_0x3deb('0x32')](_[_0x3deb('0x33')](_0x27632d[_0x3deb('0x2b')],_0x11f0d8[_0x3deb('0x32')]),_0x406be5);if(_0x27632d[_0x3deb('0x2b')][_0x3deb('0x19')]){_0x3e91be['where']=_[_0x3deb('0x34')](_0x3e91be['where'],{'$or':_[_0x3deb('0x1b')](_0x406be5,function(_0x4b5879){if(_0x4b5879[_0x3deb('0x1e')]!==_0x3deb('0x35')){var _0x428f2e={};_0x428f2e[_0x4b5879[_0x3deb('0x20')]]={'$like':'%'+_0x27632d[_0x3deb('0x2b')]['filter']+'%'};return _0x428f2e;}})});}_0x3e91be=_['merge']({},_0x3e91be,_0x27632d['options']);var _0x26a1ac={'where':_0x3e91be[_0x3deb('0x36')]};return db[_0x3deb('0x26')][_0x3deb('0x12')](_0x26a1ac)[_0x3deb('0x22')](function(_0x5d7d0e){_0x3f2e7c['count']=_0x5d7d0e;if(_0x27632d['query'][_0x3deb('0x37')]){_0x3e91be[_0x3deb('0x38')]=[{'all':!![]}];}return db[_0x3deb('0x26')]['findAll'](_0x3e91be);})['then'](function(_0xcb71b2){_0x3f2e7c[_0x3deb('0x39')]=_0xcb71b2;return _0x3f2e7c;})[_0x3deb('0x22')](respondWithFilteredResult(_0x255dcd,_0x3e91be))[_0x3deb('0x3a')](handleError(_0x255dcd,null));};exports[_0x3deb('0x3b')]=function(_0x4a0321,_0x746483){var _0x487286={'raw':![],'where':{'id':_0x4a0321[_0x3deb('0x3c')]['id']}},_0x3a7b86={};_0x3a7b86[_0x3deb('0x29')]=_['keys'](db['VoiceExtension'][_0x3deb('0x27')]);_0x3a7b86[_0x3deb('0x2b')]=_['keys'](_0x4a0321[_0x3deb('0x2b')]);_0x3a7b86[_0x3deb('0x32')]=_['intersection'](_0x3a7b86[_0x3deb('0x29')],_0x3a7b86['query']);_0x487286[_0x3deb('0x2d')]=_[_0x3deb('0x2c')](_0x3a7b86[_0x3deb('0x29')],qs[_0x3deb('0x2e')](_0x4a0321[_0x3deb('0x2b')]['fields']));_0x487286[_0x3deb('0x2d')]=_0x487286[_0x3deb('0x2d')][_0x3deb('0x2f')]?_0x487286['attributes']:_0x3a7b86[_0x3deb('0x29')];if(_0x4a0321[_0x3deb('0x2b')][_0x3deb('0x37')]){_0x487286[_0x3deb('0x38')]=[{'all':!![]}];}_0x487286=_[_0x3deb('0x34')]({},_0x487286,_0x4a0321[_0x3deb('0x3d')]);return db[_0x3deb('0x26')]['find'](_0x487286)[_0x3deb('0x22')](handleEntityNotFound(_0x746483,null))[_0x3deb('0x22')](respondWithResult(_0x746483,null))[_0x3deb('0x3a')](handleError(_0x746483,null));};exports['destroy']=function(_0x336a9b,_0x4b6a2e){return db['VoiceExtension'][_0x3deb('0x1f')]({'where':{'id':_0x336a9b[_0x3deb('0x3c')]['id']}})['then'](handleEntityNotFound(_0x4b6a2e,null))[_0x3deb('0x22')](removeEntity(_0x4b6a2e,null))[_0x3deb('0x3a')](handleError(_0x4b6a2e,null));};exports['create']=function(_0x4f2d67,_0x4bb246){if(_0x4f2d67[_0x3deb('0x3e')]['type']==='outbound'&&!_['startsWith'](_0x4f2d67['body'][_0x3deb('0x3f')],'_')){_0x4f2d67[_0x3deb('0x3e')][_0x3deb('0x3f')]='_'['concat'](_0x4f2d67[_0x3deb('0x3e')][_0x3deb('0x3f')]);}return db['VoiceExtension'][_0x3deb('0x40')](_0x4f2d67['body'],{'raw':![]})['then'](function(_0x488ce9){var _0x3f07f7=_0x4f2d67[_0x3deb('0x41')][_0x3deb('0x14')]({'plain':!![]});if(!_0x3f07f7)throw new Error(_0x3deb('0x42'));if(_0x3f07f7[_0x3deb('0x43')]==='user'){var _0x990611=_0x488ce9['get']({'plain':!![]});var _0x1e89b7=[{'name':'InboundRoutes','value':'inbound'},{'name':_0x3deb('0x17'),'value':_0x3deb('0x18')},{'name':_0x3deb('0x44'),'value':_0x3deb('0x45')}];var _0x53c257=_[_0x3deb('0x1f')](_0x1e89b7,[_0x3deb('0x1c'),_0x990611[_0x3deb('0x1e')]])['name'];return db['UserProfileSection'][_0x3deb('0x1f')]({'where':{'name':_0x53c257,'userProfileId':_0x3f07f7['userProfileId']},'raw':!![]})[_0x3deb('0x22')](function(_0x2b31a2){if(_0x2b31a2&&_0x2b31a2[_0x3deb('0x46')]===0x0){return db[_0x3deb('0x21')][_0x3deb('0x40')]({'name':_0x990611[_0x3deb('0x20')],'resourceId':_0x990611['id'],'type':_0x2b31a2[_0x3deb('0x20')],'sectionId':_0x2b31a2['id']},{})[_0x3deb('0x22')](function(){return _0x488ce9;});}else{return _0x488ce9;}})[_0x3deb('0x3a')](function(_0x288440){logger[_0x3deb('0x23')](_0x3deb('0x47'),_0x288440);throw _0x288440;});}return _0x488ce9;})[_0x3deb('0x22')](respondWithResult(_0x4bb246,0xc9))['catch'](handleError(_0x4bb246,null));};exports[_0x3deb('0x48')]=function(_0x3271af,_0x24636d){if(_0x3271af[_0x3deb('0x3e')]['id']){delete _0x3271af[_0x3deb('0x3e')]['id'];}return db['VoiceExtension']['find']({'where':{'id':_0x3271af['params']['id']}})[_0x3deb('0x22')](handleEntityNotFound(_0x24636d,null))['then'](function(_0x56a7ac){if(_0x56a7ac){return db['VoiceExtension'][_0x3deb('0x48')](_[_0x3deb('0x33')](_0x3271af[_0x3deb('0x3e')],['exten','context',_0x3deb('0x49'),'recordingFormat','cutdigits',_0x3deb('0x4a'),_0x3deb('0x4b')]),{'where':{'context':_0x56a7ac[_0x3deb('0x4c')],'exten':_0x56a7ac['exten']},'individualHooks':!![]})[_0x3deb('0x22')](function(_0x5cbcad){return _0x5cbcad;});}return null;})[_0x3deb('0x22')](respondWithStatusCode(_0x24636d,null))[_0x3deb('0x3a')](handleError(_0x24636d,null));};exports[_0x3deb('0x4d')]=function(_0x39c0ae,_0x14ea37){var _0x2ecb77=_0x39c0ae[_0x3deb('0x3c')]['id'];var _0x13ec60=_0x39c0ae[_0x3deb('0x3e')];var _0x33a29f=0xc8;var _0x1cc0bd=null;return db[_0x3deb('0x4e')]['transaction']({'isolationLevel':db[_0x3deb('0x4e')][_0x3deb('0x4f')][_0x3deb('0x50')][_0x3deb('0x51')]},function(_0x556d34){return db[_0x3deb('0x26')][_0x3deb('0x52')]({'where':{'id':_0x2ecb77},'transaction':_0x556d34})['then'](function(_0x294ef9){if(_0x294ef9){return db[_0x3deb('0x26')]['destroy']({'where':{'VoiceExtensionId':_0x2ecb77},'transaction':_0x556d34})[_0x3deb('0x22')](function(){var _0x3ce96c=_[_0x3deb('0x1b')](_0x13ec60,function(_0x553a77){_0x553a77[_0x3deb('0x53')]=_0x2ecb77;_0x553a77[_0x3deb('0x54')]=!![];return _0x553a77;});return _0x294ef9[_0x3deb('0x55')](_0x3ce96c);})[_0x3deb('0x22')](function(_0x299e80){return db['VoiceExtension']['bulkCreate'](_0x299e80,{'transaction':_0x556d34});});}else{_0x33a29f=0x194;_0x1cc0bd=[];}});})[_0x3deb('0x22')](function(){if(_0x33a29f!==0x194){return db[_0x3deb('0x26')][_0x3deb('0x56')]({'where':{'isApp':!![],'VoiceExtensionId':_0x2ecb77},'order':_0x3deb('0x57')})[_0x3deb('0x22')](function(_0x200015){_0x1cc0bd=_0x200015;});}})['catch'](function(_0x41b36f){_0x33a29f=0x1f4;logger['error'](_0x41b36f[_0x3deb('0x24')]);if(_0x41b36f['name']){delete _0x41b36f[_0x3deb('0x20')];}_0x1cc0bd=_0x41b36f;})['finally'](function(){if(_0x1cc0bd===null){_0x14ea37['sendStatus'](_0x33a29f);}else{if(_0x33a29f===0x1f4){_0x14ea37['status'](_0x33a29f)['send'](_0x1cc0bd);}else{_0x14ea37[_0x3deb('0xd')](_0x33a29f)[_0x3deb('0x58')](_0x1cc0bd);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 9876058..9299362 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 _0x3026=['../../mysqldb','VoiceExtension','setMaxListeners','save','emit','hasOwnProperty','hook'];(function(_0x2b89e3,_0x4a8c51){var _0x54119a=function(_0x2ea97a){while(--_0x2ea97a){_0x2b89e3['push'](_0x2b89e3['shift']());}};_0x54119a(++_0x4a8c51);}(_0x3026,0xa8));var _0x6302=function(_0x3fac8e,_0x1e2634){_0x3fac8e=_0x3fac8e-0x0;var _0x21fcd9=_0x3026[_0x3fac8e];return _0x21fcd9;};'use strict';var EventEmitter=require('events');var VoiceExtension=require(_0x6302('0x0'))['db'][_0x6302('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x6302('0x2')](0x0);var events={'afterCreate':_0x6302('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xc0c1bd){return function(_0x1b3fe6,_0x4a786e,_0x553365){VoiceExtensionEvents[_0x6302('0x4')](_0xc0c1bd+':'+_0x1b3fe6['id'],_0x1b3fe6);VoiceExtensionEvents[_0x6302('0x4')](_0xc0c1bd,_0x1b3fe6);_0x553365(null);};}for(var e in events){if(events[_0x6302('0x5')](e)){var event=events[e];VoiceExtension[_0x6302('0x6')](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file +var _0x4ab1=['update','remove','emit','hasOwnProperty','hook','exports','events','VoiceExtension','save'];(function(_0x31797d,_0x4d3a22){var _0x42c8f5=function(_0x4cdc9e){while(--_0x4cdc9e){_0x31797d['push'](_0x31797d['shift']());}};_0x42c8f5(++_0x4d3a22);}(_0x4ab1,0x165));var _0x14ab=function(_0x4c8eed,_0x51f7ce){_0x4c8eed=_0x4c8eed-0x0;var _0x3990ec=_0x4ab1[_0x4c8eed];return _0x3990ec;};'use strict';var EventEmitter=require(_0x14ab('0x0'));var VoiceExtension=require('../../mysqldb')['db'][_0x14ab('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x14ab('0x2'),'afterUpdate':_0x14ab('0x3'),'afterDestroy':_0x14ab('0x4')};function emitEvent(_0x49092d){return function(_0x5e25b4,_0x19a9c7,_0x5dc0eb){VoiceExtensionEvents[_0x14ab('0x5')](_0x49092d+':'+_0x5e25b4['id'],_0x5e25b4);VoiceExtensionEvents['emit'](_0x49092d,_0x5e25b4);_0x5dc0eb(null);};}for(var e in events){if(events[_0x14ab('0x6')](e)){var event=events[e];VoiceExtension[_0x14ab('0x7')](e,emitEvent(event));}}module[_0x14ab('0x8')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index a870e19..b670388 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 _0x3a3b=['interval','IntervalId','then','intervals','map','filter','toLowerCase','hasOwnProperty','tag','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','playback','includes','app','appType','answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','outboundDial','appdata','priority','last','concat','catch','define','VoiceExtension','voice_extensions','get','Hangup','lodash','exports','models','type','Set','CDR(type)=','context','exten','inbound','push','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','options','url','length','name','split','phone','param','prefix','SIP','join','indexOf','replace','U(xcally-mixmonitor-context)'];(function(_0x2eb162,_0x495823){var _0x1a4ad9=function(_0x39aa10){while(--_0x39aa10){_0x2eb162['push'](_0x2eb162['shift']());}};_0x1a4ad9(++_0x495823);}(_0x3a3b,0x110));var _0xb3a3=function(_0x49ae3d,_0x45727a){_0x49ae3d=_0x49ae3d-0x0;var _0x172d78=_0x3a3b[_0x49ae3d];return _0x172d78;};'use strict';var _=require(_0xb3a3('0x0'));var attributes=require('./voiceExtension.attributes');module[_0xb3a3('0x1')]=function(_0x1012c1){var _0x26b03e=_0x1012c1[_0xb3a3('0x2')];function _0x409904(_0x554b2c){var _0x2e64f7=0x2;var _0x273460=[{'type':_0x554b2c[_0xb3a3('0x3')],'app':_0xb3a3('0x4'),'appdata':_0xb3a3('0x5')+_0x554b2c[_0xb3a3('0x3')],'context':_0x554b2c[_0xb3a3('0x6')],'exten':_0x554b2c[_0xb3a3('0x7')],'priority':_0x2e64f7++,'VoiceExtensionId':_0x554b2c['id']}];if(_0x554b2c[_0xb3a3('0x3')]===_0xb3a3('0x8')){_0x273460[_0xb3a3('0x9')]({'type':_0xb3a3('0x8'),'app':_0xb3a3('0x4'),'appdata':_0xb3a3('0xa')+_0x554b2c['id'],'context':_0x554b2c[_0xb3a3('0x6')],'exten':_0x554b2c[_0xb3a3('0x7')],'priority':_0x2e64f7++,'VoiceExtensionId':_0x554b2c['id']});}_0x273460['push']({'type':_0x554b2c[_0xb3a3('0x3')],'app':'Set','appdata':_0xb3a3('0xb'),'context':_0x554b2c[_0xb3a3('0x6')],'exten':_0x554b2c[_0xb3a3('0x7')],'priority':_0x2e64f7++,'VoiceExtensionId':_0x554b2c['id']},{'type':_0x554b2c[_0xb3a3('0x3')],'app':_0xb3a3('0x4'),'appdata':_0xb3a3('0xc'),'context':_0x554b2c[_0xb3a3('0x6')],'exten':_0x554b2c[_0xb3a3('0x7')],'priority':_0x2e64f7++,'VoiceExtensionId':_0x554b2c['id']},{'type':_0x554b2c[_0xb3a3('0x3')],'app':'Set','appdata':_0xb3a3('0xd'),'context':_0x554b2c[_0xb3a3('0x6')],'exten':_0x554b2c[_0xb3a3('0x7')],'priority':_0x2e64f7++,'VoiceExtensionId':_0x554b2c['id']});return _0x273460;}function _0x44d8c0(_0x5a83a5){var _0x1cda3c=0x2;var _0x4afe52=[{'type':_0xb3a3('0xe'),'app':_0xb3a3('0x4'),'appdata':_0xb3a3('0xf'),'context':_0x5a83a5[_0xb3a3('0x6')],'exten':_0x5a83a5[_0xb3a3('0x7')],'priority':_0x1cda3c++,'VoiceExtensionId':_0x5a83a5['id']},{'type':_0xb3a3('0xe'),'app':'Set','appdata':_0xb3a3('0x10')+(_0x5a83a5[_0xb3a3('0x11')]?_0xb3a3('0x12')+_0x5a83a5[_0xb3a3('0x11')]+'}':_0xb3a3('0x13')),'context':_0x5a83a5[_0xb3a3('0x6')],'exten':_0x5a83a5[_0xb3a3('0x7')],'priority':_0x1cda3c++,'VoiceExtensionId':_0x5a83a5['id']},{'type':_0xb3a3('0xe'),'app':_0xb3a3('0x4'),'appdata':_0xb3a3('0xa')+_0x5a83a5['id'],'context':_0x5a83a5['context'],'exten':_0x5a83a5[_0xb3a3('0x7')],'priority':_0x1cda3c++,'VoiceExtensionId':_0x5a83a5['id']},{'type':_0xb3a3('0xe'),'app':_0xb3a3('0x14'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x1cda3c+0x2)+_0xb3a3('0x15')+(_0x1cda3c+0x1)+')','context':_0x5a83a5['context'],'exten':_0x5a83a5['exten'],'priority':_0x1cda3c++,'VoiceExtensionId':_0x5a83a5['id']},{'type':_0xb3a3('0xe'),'app':'Set','appdata':_0x5a83a5[_0xb3a3('0x11')]?_0xb3a3('0x16')+_0x5a83a5[_0xb3a3('0x11')]+'}':_0xb3a3('0x17'),'context':_0x5a83a5[_0xb3a3('0x6')],'exten':_0x5a83a5[_0xb3a3('0x7')],'priority':_0x1cda3c++,'VoiceExtensionId':_0x5a83a5['id']},{'type':'outbound','app':_0xb3a3('0x4'),'appdata':_0xb3a3('0xb'),'context':_0x5a83a5[_0xb3a3('0x6')],'exten':_0x5a83a5[_0xb3a3('0x7')],'priority':_0x1cda3c++,'VoiceExtensionId':_0x5a83a5['id']},{'type':_0xb3a3('0xe'),'app':_0xb3a3('0x4'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x5a83a5[_0xb3a3('0x6')],'exten':_0x5a83a5[_0xb3a3('0x7')],'priority':_0x1cda3c++,'VoiceExtensionId':_0x5a83a5['id']},{'type':_0xb3a3('0xe'),'app':_0xb3a3('0x4'),'appdata':_0xb3a3('0xd'),'context':_0x5a83a5[_0xb3a3('0x6')],'exten':_0x5a83a5[_0xb3a3('0x7')],'priority':_0x1cda3c++,'VoiceExtensionId':_0x5a83a5['id']},{'type':_0xb3a3('0xe'),'app':_0xb3a3('0x4'),'appdata':_0xb3a3('0x18')+_0x5a83a5['id'],'context':_0x5a83a5[_0xb3a3('0x6')],'exten':_0x5a83a5['exten'],'priority':_0x1cda3c++,'VoiceExtensionId':_0x5a83a5['id']}];if(_0x5a83a5['hasOwnProperty'](_0xb3a3('0x19'))&&_0x5a83a5['recordingFormat']!==_0xb3a3('0x1a')){_0x4afe52['push']({'type':'outbound','app':'Set','appdata':_0xb3a3('0x1b'),'context':_0x5a83a5['context'],'exten':_0x5a83a5[_0xb3a3('0x7')],'priority':_0x1cda3c++,'VoiceExtensionId':_0x5a83a5['id']},{'type':'outbound','app':_0xb3a3('0x4'),'appdata':_0xb3a3('0x1c')+_0x5a83a5[_0xb3a3('0x19')]||_0xb3a3('0x1d'),'context':_0x5a83a5[_0xb3a3('0x6')],'exten':_0x5a83a5['exten'],'priority':_0x1cda3c++,'VoiceExtensionId':_0x5a83a5['id']});}return _0x4afe52;}function _0x1c04aa(_0x4fc968,_0x173691){var _0x39fdcd=[{'name':_0xb3a3('0x1e'),'param':0x0},{'name':'timeout','param':0x1},{'name':_0xb3a3('0x1f'),'param':0x2},{'name':_0xb3a3('0x20'),'param':0x3}];var _0x26abcf={};var _0x4f59dd=_0x173691['split'](',');var _0x2b863f=[];for(var _0x573f0e=0x0;_0x573f0e<_0x39fdcd[_0xb3a3('0x21')];_0x573f0e++){switch(_0x39fdcd[_0x573f0e][_0xb3a3('0x22')]){case'trunk':_0x26abcf['trunk']=_0x4f59dd[_0x39fdcd[_0x573f0e]['param']][_0xb3a3('0x23')]('/')[0x1];_0x26abcf[_0xb3a3('0x24')]=_0x4f59dd[_0x39fdcd[_0x573f0e][_0xb3a3('0x25')]]['split']('/')[0x2];_0x26abcf[_0xb3a3('0x26')]=_0x26abcf[_0xb3a3('0x24')]?_0x26abcf[_0xb3a3('0x24')][_0xb3a3('0x23')]('$')[0x0]:undefined;_0x26abcf[_0xb3a3('0x24')]=_0x4fc968['cutdigits']?(_0x26abcf[_0xb3a3('0x26')]||'')+_0xb3a3('0x12')+_0x4fc968[_0xb3a3('0x11')]+'}':(_0x26abcf[_0xb3a3('0x26')]||'')+_0xb3a3('0x13');_0x2b863f[_0x39fdcd[_0x573f0e][_0xb3a3('0x25')]]=[_0xb3a3('0x27'),_0x26abcf[_0xb3a3('0x1e')],_0x26abcf[_0xb3a3('0x24')]][_0xb3a3('0x28')]('/');break;case'options':_0x26abcf[_0xb3a3('0x1f')]=_0x4f59dd[_0x39fdcd[_0x573f0e][_0xb3a3('0x25')]];if(_0x4fc968[_0xb3a3('0x19')]!==_0xb3a3('0x1a')){if(_0x26abcf[_0xb3a3('0x1f')][_0xb3a3('0x29')]('U(xcally-mixmonitor-context)')<0x0){_0x26abcf[_0xb3a3('0x1f')]+='U(xcally-mixmonitor-context)';}}else{_0x26abcf['options']=_0x26abcf[_0xb3a3('0x1f')][_0xb3a3('0x2a')](_0xb3a3('0x2b'),'');}_0x2b863f[_0x39fdcd[_0x573f0e][_0xb3a3('0x25')]]=_0x26abcf['options'];break;default:_0x2b863f[_0x39fdcd[_0x573f0e][_0xb3a3('0x25')]]=_0x4f59dd[_0x39fdcd[_0x573f0e]['param']];}}return _0x2b863f[_0xb3a3('0x28')](',');}function _0x514602(_0x429adb,_0x44fe63,_0x4ed801){return new Promise(function(_0x78fc5e,_0x290c52){var _0x1e553c=[];if(_['isEmpty'](_0x44fe63))return _0x78fc5e(_0x1e553c);_0x26b03e['Interval']['findAll']({'attributes':['id',_0xb3a3('0x2c'),_0xb3a3('0x2d')],'raw':!![]})[_0xb3a3('0x2e')](function(_0x10149a){for(var _0x1a776d=0x0,_0xc9d2f4=0x0;_0x1a776d<_0x44fe63[_0xb3a3('0x21')];_0x1a776d++,_0xc9d2f4=0x0){var _0x39d882=_0x44fe63[_0x1a776d];var _0x258b98=[];var _0x1b8fbb=[];delete _0x39d882['id'];if(_0x39d882['interval']!=='*,*,*,*'){_0x39d882[_0xb3a3('0x2f')]=[_0x39d882[_0xb3a3('0x2c')]];}else{_0x39d882[_0xb3a3('0x2f')]=_0x39d882[_0xb3a3('0x2d')]?_[_0xb3a3('0x30')](_[_0xb3a3('0x31')](_0x10149a,{'IntervalId':_0x39d882[_0xb3a3('0x2d')]}),_0xb3a3('0x2c')):[];}_0x39d882['context']=_0x429adb[_0xb3a3('0x6')];_0x39d882[_0xb3a3('0x7')]=_0x429adb[_0xb3a3('0x7')];if(_0x39d882[_0xb3a3('0x3')])_0x39d882[_0xb3a3('0x3')]=_0x39d882[_0xb3a3('0x3')][_0xb3a3('0x32')]();if(_0x429adb[_0xb3a3('0x3')]===_0xb3a3('0xe')){if(_0x39d882[_0xb3a3('0x33')](_0xb3a3('0x34'))&&_0x39d882[_0xb3a3('0x34')]&&_0x39d882[_0xb3a3('0x34')]!=='--'){_0x258b98[_0xb3a3('0x9')]({'type':_0x39d882['type']['toLowerCase'](),'app':_0xb3a3('0x4'),'appdata':'CDR(tag)='+_0x39d882[_0xb3a3('0x34')],'context':_0x429adb[_0xb3a3('0x6')],'exten':_0x429adb[_0xb3a3('0x7')],'priority':_0x39d882[_0xb3a3('0x2f')][_0xb3a3('0x21')]+_0x4ed801+_0xc9d2f4++,'VoiceExtensionId':_0x429adb['id']});}_0x258b98['push']({'type':_0x39d882[_0xb3a3('0x3')][_0xb3a3('0x32')](),'app':_0xb3a3('0x14'),'appdata':_0xb3a3('0x35')+(_0x39d882[_0xb3a3('0x36')]?_0xb3a3('0x37')+_0x39d882['callerID']+')':_0xb3a3('0x38')),'context':_0x429adb[_0xb3a3('0x6')],'exten':_0x429adb[_0xb3a3('0x7')],'priority':_0x39d882[_0xb3a3('0x2f')][_0xb3a3('0x21')]+_0x4ed801+_0xc9d2f4++,'VoiceExtensionId':_0x429adb['id']});}else{if(_0x39d882[_0xb3a3('0x33')]('answer')){if(['queue',_0xb3a3('0x39')][_0xb3a3('0x3a')](_0x39d882[_0xb3a3('0x3b')][_0xb3a3('0x32')]())&&_0x39d882[_0xb3a3('0x3c')]!=='custom'){if(_0x39d882[_0xb3a3('0x3d')]){_0x258b98['push']({'type':_0x39d882['type'][_0xb3a3('0x32')](),'app':_0xb3a3('0x14'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x429adb[_0xb3a3('0x6')],'exten':_0x429adb['exten'],'priority':_0x39d882[_0xb3a3('0x2f')][_0xb3a3('0x21')]+_0x4ed801+_0xc9d2f4++,'VoiceExtensionId':_0x429adb['id']});_0x258b98[_0xb3a3('0x9')]({'type':_0x39d882[_0xb3a3('0x3')][_0xb3a3('0x32')](),'app':'Set','appdata':_0xb3a3('0x3e'),'context':_0x429adb[_0xb3a3('0x6')],'exten':_0x429adb['exten'],'priority':_0x39d882[_0xb3a3('0x2f')][_0xb3a3('0x21')]+_0x4ed801+_0xc9d2f4++,'VoiceExtensionId':_0x429adb['id']});}else{_0x258b98[_0xb3a3('0x9')]({'type':_0x39d882[_0xb3a3('0x3')][_0xb3a3('0x32')](),'app':_0xb3a3('0x14'),'appdata':_0xb3a3('0x3f'),'context':_0x429adb[_0xb3a3('0x6')],'exten':_0x429adb[_0xb3a3('0x7')],'priority':_0x39d882[_0xb3a3('0x2f')][_0xb3a3('0x21')]+_0x4ed801+_0xc9d2f4++,'VoiceExtensionId':_0x429adb['id']});_0x258b98['push']({'type':_0x39d882[_0xb3a3('0x3')][_0xb3a3('0x32')](),'app':_0xb3a3('0x4'),'appdata':_0xb3a3('0x40'),'context':_0x429adb[_0xb3a3('0x6')],'exten':_0x429adb[_0xb3a3('0x7')],'priority':_0x39d882[_0xb3a3('0x2f')]['length']+_0x4ed801+_0xc9d2f4++,'VoiceExtensionId':_0x429adb['id']});}}}}for(var _0xc4c746=0x0;_0xc4c746<_0x39d882[_0xb3a3('0x2f')]['length'];_0xc4c746++){var _0x8d3864=_0x4ed801+_0x39d882[_0xb3a3('0x2f')][_0xb3a3('0x21')];var _0x3dfcb4=_0xc4c746===_0x39d882[_0xb3a3('0x2f')][_0xb3a3('0x21')]-0x1?_0x4ed801+_0x258b98[_0xb3a3('0x21')]+_0x1b8fbb['length']+0x2:_0x4ed801+_0xc4c746+0x1;_0x258b98[_0xb3a3('0x41')](_0xc4c746,0x0,{'type':_0x429adb[_0xb3a3('0x3')],'app':_0xb3a3('0x42'),'appdata':_0x39d882['intervals'][_0xc4c746]+'?'+_0x429adb[_0xb3a3('0x6')]+_0xb3a3('0x43')+_0x8d3864+':'+_0x429adb[_0xb3a3('0x6')]+_0xb3a3('0x43')+_0x3dfcb4,'exten':_0x429adb[_0xb3a3('0x7')],'context':_0x429adb[_0xb3a3('0x6')],'priority':_0x4ed801+_0xc4c746,'VoiceExtensionId':_0x429adb['id']});}if(_0x39d882[_0xb3a3('0x3c')]===_0xb3a3('0x44')){_0x39d882[_0xb3a3('0x45')]=_0x1c04aa(_0x429adb,_0x39d882['appdata']);}if(_0x39d882[_0xb3a3('0x3c')]==='agi'){_0x258b98[_0xb3a3('0x9')]({'type':_0x39d882[_0xb3a3('0x3')][_0xb3a3('0x32')](),'app':_0xb3a3('0x4'),'appdata':'XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','context':_0x429adb['context'],'exten':_0x429adb[_0xb3a3('0x7')],'priority':_0x39d882[_0xb3a3('0x2f')][_0xb3a3('0x21')]+_0x4ed801+_0xc9d2f4++,'VoiceExtensionId':_0x429adb['id']});}_0x39d882[_0xb3a3('0x46')]=_0x258b98['length']?_[_0xb3a3('0x47')](_0x258b98)[_0xb3a3('0x46')]+0x1:_0x4ed801;_0x1e553c=_[_0xb3a3('0x48')](_0x1e553c,_0x258b98,[_0x39d882],_0x1b8fbb);_0x4ed801=_[_0xb3a3('0x47')](_0x1e553c)['priority']+0x1;}return _0x78fc5e(_0x1e553c);})[_0xb3a3('0x49')](function(_0x2167bc){_0x290c52(_0x2167bc);});});}return _0x1012c1[_0xb3a3('0x4a')](_0xb3a3('0x4b'),attributes,{'tableName':_0xb3a3('0x4c'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x24b3b3){var _0x195e86=this[_0xb3a3('0x4d')]({'plain':!![]});var _0x30ec82=_0x195e86[_0xb3a3('0x3')]===_0xb3a3('0xe')?_0x44d8c0(_0x195e86):_0x409904(_0x195e86);return _0x514602(_0x195e86,_0x24b3b3,_[_0xb3a3('0x47')](_0x30ec82)['priority']+0x1)[_0xb3a3('0x2e')](function(_0x56427a){var _0xc1c8ce=_[_0xb3a3('0x48')](_0x30ec82,_0x56427a);_0xc1c8ce[_0xb3a3('0x9')]({'type':_0x195e86[_0xb3a3('0x3')],'app':_0xb3a3('0x4e'),'exten':_0x195e86[_0xb3a3('0x7')],'context':_0x195e86[_0xb3a3('0x6')],'priority':_[_0xb3a3('0x47')](_0xc1c8ce)[_0xb3a3('0x46')]+0x1,'VoiceExtensionId':_0x195e86['id']});return _0xc1c8ce;});}}});}; \ No newline at end of file +var _0xa69f=['$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','outboundDial','appdata','agi','priority','last','concat','catch','define','VoiceExtension','voice_extensions','get','Hangup','lodash','models','type','Set','CDR(type)=','exten','inbound','push','CDR(routeid)=','context','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','CDR(type)=outbound','outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','CDR(prefix)=${EXTEN:0:','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','options','url','length','split','phone','prefix','param','join','indexOf','U(xcally-mixmonitor-context)','isEmpty','findAll','IntervalId','*,*,*,*','intervals','interval','map','filter','hasOwnProperty','tag','toLowerCase','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','NoOp(No\x20number\x20available)','answer','queue','playback','includes','app','appType','custom'];(function(_0xa0c67e,_0x254ed7){var _0x36e853=function(_0x295c43){while(--_0x295c43){_0xa0c67e['push'](_0xa0c67e['shift']());}};_0x36e853(++_0x254ed7);}(_0xa69f,0x1df));var _0xfa69=function(_0x2c7e0f,_0x159224){_0x2c7e0f=_0x2c7e0f-0x0;var _0x1a4015=_0xa69f[_0x2c7e0f];return _0x1a4015;};'use strict';var _=require(_0xfa69('0x0'));var attributes=require('./voiceExtension.attributes');module['exports']=function(_0x30c19b){var _0x55777d=_0x30c19b[_0xfa69('0x1')];function _0x37b730(_0x21578c){var _0x1a7dc9=0x2;var _0x509a92=[{'type':_0x21578c[_0xfa69('0x2')],'app':_0xfa69('0x3'),'appdata':_0xfa69('0x4')+_0x21578c[_0xfa69('0x2')],'context':_0x21578c['context'],'exten':_0x21578c[_0xfa69('0x5')],'priority':_0x1a7dc9++,'VoiceExtensionId':_0x21578c['id']}];if(_0x21578c[_0xfa69('0x2')]===_0xfa69('0x6')){_0x509a92[_0xfa69('0x7')]({'type':_0xfa69('0x6'),'app':_0xfa69('0x3'),'appdata':_0xfa69('0x8')+_0x21578c['id'],'context':_0x21578c[_0xfa69('0x9')],'exten':_0x21578c[_0xfa69('0x5')],'priority':_0x1a7dc9++,'VoiceExtensionId':_0x21578c['id']});}_0x509a92[_0xfa69('0x7')]({'type':_0x21578c['type'],'app':_0xfa69('0x3'),'appdata':_0xfa69('0xa'),'context':_0x21578c[_0xfa69('0x9')],'exten':_0x21578c[_0xfa69('0x5')],'priority':_0x1a7dc9++,'VoiceExtensionId':_0x21578c['id']},{'type':_0x21578c[_0xfa69('0x2')],'app':_0xfa69('0x3'),'appdata':_0xfa69('0xb'),'context':_0x21578c[_0xfa69('0x9')],'exten':_0x21578c['exten'],'priority':_0x1a7dc9++,'VoiceExtensionId':_0x21578c['id']},{'type':_0x21578c[_0xfa69('0x2')],'app':'Set','appdata':_0xfa69('0xc'),'context':_0x21578c[_0xfa69('0x9')],'exten':_0x21578c[_0xfa69('0x5')],'priority':_0x1a7dc9++,'VoiceExtensionId':_0x21578c['id']});return _0x509a92;}function _0x36db9a(_0x231c01){var _0x4c7afb=0x2;var _0x10e3da=[{'type':'outbound','app':_0xfa69('0x3'),'appdata':_0xfa69('0xd'),'context':_0x231c01[_0xfa69('0x9')],'exten':_0x231c01[_0xfa69('0x5')],'priority':_0x4c7afb++,'VoiceExtensionId':_0x231c01['id']},{'type':_0xfa69('0xe'),'app':_0xfa69('0x3'),'appdata':_0xfa69('0xf')+(_0x231c01[_0xfa69('0x10')]?_0xfa69('0x11')+_0x231c01[_0xfa69('0x10')]+'}':_0xfa69('0x12')),'context':_0x231c01[_0xfa69('0x9')],'exten':_0x231c01[_0xfa69('0x5')],'priority':_0x4c7afb++,'VoiceExtensionId':_0x231c01['id']},{'type':'outbound','app':_0xfa69('0x3'),'appdata':_0xfa69('0x8')+_0x231c01['id'],'context':_0x231c01[_0xfa69('0x9')],'exten':_0x231c01[_0xfa69('0x5')],'priority':_0x4c7afb++,'VoiceExtensionId':_0x231c01['id']},{'type':_0xfa69('0xe'),'app':_0xfa69('0x13'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x4c7afb+0x2)+'):Goto('+(_0x4c7afb+0x1)+')','context':_0x231c01[_0xfa69('0x9')],'exten':_0x231c01[_0xfa69('0x5')],'priority':_0x4c7afb++,'VoiceExtensionId':_0x231c01['id']},{'type':_0xfa69('0xe'),'app':_0xfa69('0x3'),'appdata':_0x231c01[_0xfa69('0x10')]?_0xfa69('0x14')+_0x231c01[_0xfa69('0x10')]+'}':'CDR(prefix)=noprefix','context':_0x231c01[_0xfa69('0x9')],'exten':_0x231c01[_0xfa69('0x5')],'priority':_0x4c7afb++,'VoiceExtensionId':_0x231c01['id']},{'type':'outbound','app':_0xfa69('0x3'),'appdata':_0xfa69('0xa'),'context':_0x231c01['context'],'exten':_0x231c01['exten'],'priority':_0x4c7afb++,'VoiceExtensionId':_0x231c01['id']},{'type':_0xfa69('0xe'),'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x231c01[_0xfa69('0x9')],'exten':_0x231c01[_0xfa69('0x5')],'priority':_0x4c7afb++,'VoiceExtensionId':_0x231c01['id']},{'type':_0xfa69('0xe'),'app':_0xfa69('0x3'),'appdata':_0xfa69('0xc'),'context':_0x231c01[_0xfa69('0x9')],'exten':_0x231c01['exten'],'priority':_0x4c7afb++,'VoiceExtensionId':_0x231c01['id']},{'type':_0xfa69('0xe'),'app':_0xfa69('0x3'),'appdata':_0xfa69('0x15')+_0x231c01['id'],'context':_0x231c01[_0xfa69('0x9')],'exten':_0x231c01[_0xfa69('0x5')],'priority':_0x4c7afb++,'VoiceExtensionId':_0x231c01['id']}];if(_0x231c01['hasOwnProperty'](_0xfa69('0x16'))&&_0x231c01[_0xfa69('0x16')]!==_0xfa69('0x17')){_0x10e3da[_0xfa69('0x7')]({'type':_0xfa69('0xe'),'app':_0xfa69('0x3'),'appdata':_0xfa69('0x18'),'context':_0x231c01[_0xfa69('0x9')],'exten':_0x231c01[_0xfa69('0x5')],'priority':_0x4c7afb++,'VoiceExtensionId':_0x231c01['id']},{'type':_0xfa69('0xe'),'app':_0xfa69('0x3'),'appdata':_0xfa69('0x19')+_0x231c01['recordingFormat']||_0xfa69('0x1a'),'context':_0x231c01[_0xfa69('0x9')],'exten':_0x231c01['exten'],'priority':_0x4c7afb++,'VoiceExtensionId':_0x231c01['id']});}return _0x10e3da;}function _0x4dafca(_0x51c585,_0x232ffc){var _0x3ad2b4=[{'name':_0xfa69('0x1b'),'param':0x0},{'name':_0xfa69('0x1c'),'param':0x1},{'name':_0xfa69('0x1d'),'param':0x2},{'name':_0xfa69('0x1e'),'param':0x3}];var _0x590ccc={};var _0x58206e=_0x232ffc['split'](',');var _0x196adf=[];for(var _0x121161=0x0;_0x121161<_0x3ad2b4[_0xfa69('0x1f')];_0x121161++){switch(_0x3ad2b4[_0x121161]['name']){case'trunk':_0x590ccc[_0xfa69('0x1b')]=_0x58206e[_0x3ad2b4[_0x121161]['param']][_0xfa69('0x20')]('/')[0x1];_0x590ccc[_0xfa69('0x21')]=_0x58206e[_0x3ad2b4[_0x121161]['param']]['split']('/')[0x2];_0x590ccc[_0xfa69('0x22')]=_0x590ccc[_0xfa69('0x21')]?_0x590ccc[_0xfa69('0x21')][_0xfa69('0x20')]('$')[0x0]:undefined;_0x590ccc[_0xfa69('0x21')]=_0x51c585[_0xfa69('0x10')]?(_0x590ccc[_0xfa69('0x22')]||'')+_0xfa69('0x11')+_0x51c585[_0xfa69('0x10')]+'}':(_0x590ccc[_0xfa69('0x22')]||'')+_0xfa69('0x12');_0x196adf[_0x3ad2b4[_0x121161][_0xfa69('0x23')]]=['SIP',_0x590ccc[_0xfa69('0x1b')],_0x590ccc[_0xfa69('0x21')]][_0xfa69('0x24')]('/');break;case _0xfa69('0x1d'):_0x590ccc[_0xfa69('0x1d')]=_0x58206e[_0x3ad2b4[_0x121161]['param']];if(_0x51c585[_0xfa69('0x16')]!==_0xfa69('0x17')){if(_0x590ccc[_0xfa69('0x1d')][_0xfa69('0x25')](_0xfa69('0x26'))<0x0){_0x590ccc[_0xfa69('0x1d')]+=_0xfa69('0x26');}}else{_0x590ccc[_0xfa69('0x1d')]=_0x590ccc[_0xfa69('0x1d')]['replace']('U(xcally-mixmonitor-context)','');}_0x196adf[_0x3ad2b4[_0x121161][_0xfa69('0x23')]]=_0x590ccc[_0xfa69('0x1d')];break;default:_0x196adf[_0x3ad2b4[_0x121161][_0xfa69('0x23')]]=_0x58206e[_0x3ad2b4[_0x121161]['param']];}}return _0x196adf[_0xfa69('0x24')](',');}function _0x5e15e9(_0x3f91b1,_0x5c3723,_0x35880c){return new Promise(function(_0x50c1d8,_0x5c1a59){var _0x526a1e=[];if(_[_0xfa69('0x27')](_0x5c3723))return _0x50c1d8(_0x526a1e);_0x55777d['Interval'][_0xfa69('0x28')]({'attributes':['id','interval',_0xfa69('0x29')],'raw':!![]})['then'](function(_0x3c1f46){for(var _0x54ebd5=0x0,_0x876f60=0x0;_0x54ebd5<_0x5c3723[_0xfa69('0x1f')];_0x54ebd5++,_0x876f60=0x0){var _0xf9c1db=_0x5c3723[_0x54ebd5];var _0x5005f4=[];var _0x43abc3=[];delete _0xf9c1db['id'];if(_0xf9c1db['interval']!==_0xfa69('0x2a')){_0xf9c1db[_0xfa69('0x2b')]=[_0xf9c1db[_0xfa69('0x2c')]];}else{_0xf9c1db[_0xfa69('0x2b')]=_0xf9c1db[_0xfa69('0x29')]?_[_0xfa69('0x2d')](_[_0xfa69('0x2e')](_0x3c1f46,{'IntervalId':_0xf9c1db[_0xfa69('0x29')]}),'interval'):[];}_0xf9c1db['context']=_0x3f91b1['context'];_0xf9c1db[_0xfa69('0x5')]=_0x3f91b1[_0xfa69('0x5')];if(_0xf9c1db[_0xfa69('0x2')])_0xf9c1db[_0xfa69('0x2')]=_0xf9c1db[_0xfa69('0x2')]['toLowerCase']();if(_0x3f91b1[_0xfa69('0x2')]===_0xfa69('0xe')){if(_0xf9c1db[_0xfa69('0x2f')](_0xfa69('0x30'))&&_0xf9c1db['tag']&&_0xf9c1db['tag']!=='--'){_0x5005f4['push']({'type':_0xf9c1db['type'][_0xfa69('0x31')](),'app':'Set','appdata':'CDR(tag)='+_0xf9c1db['tag'],'context':_0x3f91b1['context'],'exten':_0x3f91b1[_0xfa69('0x5')],'priority':_0xf9c1db[_0xfa69('0x2b')][_0xfa69('0x1f')]+_0x35880c+_0x876f60++,'VoiceExtensionId':_0x3f91b1['id']});}_0x5005f4[_0xfa69('0x7')]({'type':_0xf9c1db[_0xfa69('0x2')][_0xfa69('0x31')](),'app':_0xfa69('0x13'),'appdata':_0xfa69('0x32')+(_0xf9c1db['callerID']?'Set(CALLERID(all)='+_0xf9c1db[_0xfa69('0x33')]+')':_0xfa69('0x34')),'context':_0x3f91b1['context'],'exten':_0x3f91b1[_0xfa69('0x5')],'priority':_0xf9c1db['intervals']['length']+_0x35880c+_0x876f60++,'VoiceExtensionId':_0x3f91b1['id']});}else{if(_0xf9c1db['hasOwnProperty'](_0xfa69('0x35'))){if([_0xfa69('0x36'),_0xfa69('0x37')][_0xfa69('0x38')](_0xf9c1db[_0xfa69('0x39')]['toLowerCase']())&&_0xf9c1db[_0xfa69('0x3a')]!==_0xfa69('0x3b')){if(_0xf9c1db[_0xfa69('0x35')]){_0x5005f4[_0xfa69('0x7')]({'type':_0xf9c1db[_0xfa69('0x2')][_0xfa69('0x31')](),'app':_0xfa69('0x13'),'appdata':_0xfa69('0x3c'),'context':_0x3f91b1[_0xfa69('0x9')],'exten':_0x3f91b1[_0xfa69('0x5')],'priority':_0xf9c1db[_0xfa69('0x2b')][_0xfa69('0x1f')]+_0x35880c+_0x876f60++,'VoiceExtensionId':_0x3f91b1['id']});_0x5005f4[_0xfa69('0x7')]({'type':_0xf9c1db[_0xfa69('0x2')][_0xfa69('0x31')](),'app':_0xfa69('0x3'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x3f91b1[_0xfa69('0x9')],'exten':_0x3f91b1[_0xfa69('0x5')],'priority':_0xf9c1db['intervals'][_0xfa69('0x1f')]+_0x35880c+_0x876f60++,'VoiceExtensionId':_0x3f91b1['id']});}else{_0x5005f4[_0xfa69('0x7')]({'type':_0xf9c1db[_0xfa69('0x2')][_0xfa69('0x31')](),'app':_0xfa69('0x13'),'appdata':_0xfa69('0x3d'),'context':_0x3f91b1[_0xfa69('0x9')],'exten':_0x3f91b1['exten'],'priority':_0xf9c1db[_0xfa69('0x2b')][_0xfa69('0x1f')]+_0x35880c+_0x876f60++,'VoiceExtensionId':_0x3f91b1['id']});_0x5005f4[_0xfa69('0x7')]({'type':_0xf9c1db['type'][_0xfa69('0x31')](),'app':_0xfa69('0x3'),'appdata':_0xfa69('0x3e'),'context':_0x3f91b1[_0xfa69('0x9')],'exten':_0x3f91b1['exten'],'priority':_0xf9c1db[_0xfa69('0x2b')][_0xfa69('0x1f')]+_0x35880c+_0x876f60++,'VoiceExtensionId':_0x3f91b1['id']});}}}}for(var _0x2b3f43=0x0;_0x2b3f43<_0xf9c1db['intervals']['length'];_0x2b3f43++){var _0x4f8c6b=_0x35880c+_0xf9c1db['intervals']['length'];var _0x32c304=_0x2b3f43===_0xf9c1db['intervals'][_0xfa69('0x1f')]-0x1?_0x35880c+_0x5005f4['length']+_0x43abc3[_0xfa69('0x1f')]+0x2:_0x35880c+_0x2b3f43+0x1;_0x5005f4['splice'](_0x2b3f43,0x0,{'type':_0x3f91b1[_0xfa69('0x2')],'app':_0xfa69('0x3f'),'appdata':_0xf9c1db[_0xfa69('0x2b')][_0x2b3f43]+'?'+_0x3f91b1[_0xfa69('0x9')]+_0xfa69('0x40')+_0x4f8c6b+':'+_0x3f91b1[_0xfa69('0x9')]+_0xfa69('0x40')+_0x32c304,'exten':_0x3f91b1[_0xfa69('0x5')],'context':_0x3f91b1['context'],'priority':_0x35880c+_0x2b3f43,'VoiceExtensionId':_0x3f91b1['id']});}if(_0xf9c1db[_0xfa69('0x3a')]===_0xfa69('0x41')){_0xf9c1db[_0xfa69('0x42')]=_0x4dafca(_0x3f91b1,_0xf9c1db[_0xfa69('0x42')]);}if(_0xf9c1db[_0xfa69('0x3a')]===_0xfa69('0x43')){_0x5005f4[_0xfa69('0x7')]({'type':_0xf9c1db[_0xfa69('0x2')][_0xfa69('0x31')](),'app':_0xfa69('0x3'),'appdata':'XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','context':_0x3f91b1[_0xfa69('0x9')],'exten':_0x3f91b1[_0xfa69('0x5')],'priority':_0xf9c1db[_0xfa69('0x2b')][_0xfa69('0x1f')]+_0x35880c+_0x876f60++,'VoiceExtensionId':_0x3f91b1['id']});}_0xf9c1db[_0xfa69('0x44')]=_0x5005f4[_0xfa69('0x1f')]?_[_0xfa69('0x45')](_0x5005f4)[_0xfa69('0x44')]+0x1:_0x35880c;_0x526a1e=_[_0xfa69('0x46')](_0x526a1e,_0x5005f4,[_0xf9c1db],_0x43abc3);_0x35880c=_[_0xfa69('0x45')](_0x526a1e)[_0xfa69('0x44')]+0x1;}return _0x50c1d8(_0x526a1e);})[_0xfa69('0x47')](function(_0x29f887){_0x5c1a59(_0x29f887);});});}return _0x30c19b[_0xfa69('0x48')](_0xfa69('0x49'),attributes,{'tableName':_0xfa69('0x4a'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x450c7d){var _0x3057db=this[_0xfa69('0x4b')]({'plain':!![]});var _0x4248fa=_0x3057db[_0xfa69('0x2')]===_0xfa69('0xe')?_0x36db9a(_0x3057db):_0x37b730(_0x3057db);return _0x5e15e9(_0x3057db,_0x450c7d,_[_0xfa69('0x45')](_0x4248fa)[_0xfa69('0x44')]+0x1)['then'](function(_0x3b4d64){var _0x4b0794=_[_0xfa69('0x46')](_0x4248fa,_0x3b4d64);_0x4b0794['push']({'type':_0x3057db['type'],'app':_0xfa69('0x4c'),'exten':_0x3057db[_0xfa69('0x5')],'context':_0x3057db['context'],'priority':_[_0xfa69('0x45')](_0x4b0794)['priority']+0x1,'VoiceExtensionId':_0x3057db['id']});return _0x4b0794;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 03bbcff..878399f 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 _0x9fc5=['localhost','socket.io-emitter','./voiceExtension.socket','register','request','then','info','VoiceExtension,\x20%s,\x20%s','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetVoiceExtension','findAll','options','raw','limit','include','map','attributes','model','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults'];(function(_0x4e444b,_0x193e6b){var _0x38d910=function(_0x44f762){while(--_0x44f762){_0x4e444b['push'](_0x4e444b['shift']());}};_0x38d910(++_0x193e6b);}(_0x9fc5,0xb6));var _0x59fc=function(_0x404cde,_0x27b51c){_0x404cde=_0x404cde-0x0;var _0x139882=_0x9fc5[_0x404cde];return _0x139882;};'use strict';var _=require('lodash');var util=require(_0x59fc('0x0'));var moment=require(_0x59fc('0x1'));var BPromise=require('bluebird');var rs=require(_0x59fc('0x2'));var fs=require('fs');var Redis=require(_0x59fc('0x3'));var db=require(_0x59fc('0x4'))['db'];var utils=require(_0x59fc('0x5'));var logger=require(_0x59fc('0x6'))(_0x59fc('0x7'));var config=require(_0x59fc('0x8'));var jayson=require(_0x59fc('0x9'));var client=jayson['client'][_0x59fc('0xa')]({'port':0x232a});config[_0x59fc('0xb')]=_[_0x59fc('0xc')](config['redis'],{'host':_0x59fc('0xd'),'port':0x18eb});var socket=require(_0x59fc('0xe'))(new Redis(config[_0x59fc('0xb')]));require(_0x59fc('0xf'))[_0x59fc('0x10')](socket);function respondWithRpcPromise(_0x212ec8,_0x2556f8,_0x4afc93){return new BPromise(function(_0x2de019,_0x33364e){return client[_0x59fc('0x11')](_0x212ec8,_0x4afc93)[_0x59fc('0x12')](function(_0x29e599){logger[_0x59fc('0x13')](_0x59fc('0x14'),_0x2556f8,'request\x20sent');logger[_0x59fc('0x15')](_0x59fc('0x16'),_0x2556f8,_0x59fc('0x17'),JSON[_0x59fc('0x18')](_0x29e599));if(_0x29e599[_0x59fc('0x19')]){if(_0x29e599[_0x59fc('0x19')][_0x59fc('0x1a')]===0x1f4){logger[_0x59fc('0x19')](_0x59fc('0x14'),_0x2556f8,_0x29e599[_0x59fc('0x19')][_0x59fc('0x1b')]);return _0x33364e(_0x29e599['error'][_0x59fc('0x1b')]);}logger[_0x59fc('0x19')]('VoiceExtension,\x20%s,\x20%s',_0x2556f8,_0x29e599[_0x59fc('0x19')][_0x59fc('0x1b')]);return _0x2de019(_0x29e599[_0x59fc('0x19')][_0x59fc('0x1b')]);}else{logger[_0x59fc('0x13')]('VoiceExtension,\x20%s,\x20%s',_0x2556f8,_0x59fc('0x17'));_0x2de019(_0x29e599[_0x59fc('0x1c')][_0x59fc('0x1b')]);}})[_0x59fc('0x1d')](function(_0x395ede){logger[_0x59fc('0x19')](_0x59fc('0x14'),_0x2556f8,_0x395ede);_0x33364e(_0x395ede);});});}exports[_0x59fc('0x1e')]=function(_0x58a0bb){var _0x153c58=this;return new Promise(function(_0x530c11,_0xdcfddb){return db['VoiceExtension'][_0x59fc('0x1f')]({'raw':_0x58a0bb[_0x59fc('0x20')]?_0x58a0bb[_0x59fc('0x20')][_0x59fc('0x21')]===undefined?!![]:![]:!![],'where':_0x58a0bb[_0x59fc('0x20')]?_0x58a0bb[_0x59fc('0x20')]['where']||null:null,'attributes':_0x58a0bb[_0x59fc('0x20')]?_0x58a0bb[_0x59fc('0x20')]['attributes']||null:null,'limit':_0x58a0bb['options']?_0x58a0bb[_0x59fc('0x20')][_0x59fc('0x22')]||null:null,'include':_0x58a0bb[_0x59fc('0x20')]?_0x58a0bb[_0x59fc('0x20')][_0x59fc('0x23')]?_[_0x59fc('0x24')](_0x58a0bb[_0x59fc('0x20')][_0x59fc('0x23')],function(_0x1bfbe0){return{'model':db[_0x1bfbe0['model']],'as':_0x1bfbe0['as'],'attributes':_0x1bfbe0[_0x59fc('0x25')],'include':_0x1bfbe0['include']?_[_0x59fc('0x24')](_0x1bfbe0['include'],function(_0x2b9e06){return{'model':db[_0x2b9e06[_0x59fc('0x26')]],'as':_0x2b9e06['as'],'attributes':_0x2b9e06['attributes'],'include':_0x2b9e06[_0x59fc('0x23')]?_[_0x59fc('0x24')](_0x2b9e06['include'],function(_0x1304ae){return{'model':db[_0x1304ae[_0x59fc('0x26')]],'as':_0x1304ae['as'],'attributes':_0x1304ae[_0x59fc('0x25')]};}):[]};}):[]};}):[]:[]})[_0x59fc('0x12')](function(_0x252fa4){logger['info'](_0x59fc('0x1e'),_0x58a0bb);logger[_0x59fc('0x15')](_0x59fc('0x1e'),_0x58a0bb,JSON['stringify'](_0x252fa4));_0x530c11(_0x252fa4);})[_0x59fc('0x1d')](function(_0x1dd1a1){logger[_0x59fc('0x19')](_0x59fc('0x1e'),_0x1dd1a1[_0x59fc('0x1b')],_0x58a0bb);_0xdcfddb(_0x153c58[_0x59fc('0x19')](0x1f4,_0x1dd1a1[_0x59fc('0x1b')]));});});}; \ No newline at end of file +var _0x78d3=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./voiceExtension.socket','register','request','request\x20sent','debug','stringify','error','code','VoiceExtension,\x20%s,\x20%s','message','info','result','catch','GetVoiceExtension','VoiceExtension','findAll','options','raw','where','limit','include','map','model','attributes','lodash','util','moment','bluebird','randomstring'];(function(_0x432c60,_0x5681ed){var _0x3d6dd7=function(_0x364423){while(--_0x364423){_0x432c60['push'](_0x432c60['shift']());}};_0x3d6dd7(++_0x5681ed);}(_0x78d3,0x73));var _0x378d=function(_0x21e21c,_0x2e30a5){_0x21e21c=_0x21e21c-0x0;var _0x5b9e41=_0x78d3[_0x21e21c];return _0x5b9e41;};'use strict';var _=require(_0x378d('0x0'));var util=require(_0x378d('0x1'));var moment=require(_0x378d('0x2'));var BPromise=require(_0x378d('0x3'));var rs=require(_0x378d('0x4'));var fs=require('fs');var Redis=require(_0x378d('0x5'));var db=require(_0x378d('0x6'))['db'];var utils=require(_0x378d('0x7'));var logger=require(_0x378d('0x8'))(_0x378d('0x9'));var config=require(_0x378d('0xa'));var jayson=require(_0x378d('0xb'));var client=jayson[_0x378d('0xc')][_0x378d('0xd')]({'port':0x232a});config['redis']=_['defaults'](config[_0x378d('0xe')],{'host':'localhost','port':0x18eb});var socket=require(_0x378d('0xf'))(new Redis(config[_0x378d('0xe')]));require(_0x378d('0x10'))[_0x378d('0x11')](socket);function respondWithRpcPromise(_0x43da5f,_0x12d960,_0x53a4b6){return new BPromise(function(_0x1c4d11,_0x21bf21){return client[_0x378d('0x12')](_0x43da5f,_0x53a4b6)['then'](function(_0x378254){logger['info']('VoiceExtension,\x20%s,\x20%s',_0x12d960,_0x378d('0x13'));logger[_0x378d('0x14')]('VoiceExtension,\x20%s,\x20%s,\x20%s',_0x12d960,_0x378d('0x13'),JSON[_0x378d('0x15')](_0x378254));if(_0x378254[_0x378d('0x16')]){if(_0x378254['error'][_0x378d('0x17')]===0x1f4){logger['error'](_0x378d('0x18'),_0x12d960,_0x378254[_0x378d('0x16')][_0x378d('0x19')]);return _0x21bf21(_0x378254[_0x378d('0x16')][_0x378d('0x19')]);}logger['error'](_0x378d('0x18'),_0x12d960,_0x378254['error'][_0x378d('0x19')]);return _0x1c4d11(_0x378254[_0x378d('0x16')][_0x378d('0x19')]);}else{logger[_0x378d('0x1a')](_0x378d('0x18'),_0x12d960,'request\x20sent');_0x1c4d11(_0x378254[_0x378d('0x1b')]['message']);}})[_0x378d('0x1c')](function(_0x4067d9){logger[_0x378d('0x16')](_0x378d('0x18'),_0x12d960,_0x4067d9);_0x21bf21(_0x4067d9);});});}exports[_0x378d('0x1d')]=function(_0x11584b){var _0x1c9244=this;return new Promise(function(_0x521d40,_0x5a936c){return db[_0x378d('0x1e')][_0x378d('0x1f')]({'raw':_0x11584b['options']?_0x11584b[_0x378d('0x20')][_0x378d('0x21')]===undefined?!![]:![]:!![],'where':_0x11584b[_0x378d('0x20')]?_0x11584b[_0x378d('0x20')][_0x378d('0x22')]||null:null,'attributes':_0x11584b['options']?_0x11584b[_0x378d('0x20')]['attributes']||null:null,'limit':_0x11584b[_0x378d('0x20')]?_0x11584b[_0x378d('0x20')][_0x378d('0x23')]||null:null,'include':_0x11584b['options']?_0x11584b[_0x378d('0x20')][_0x378d('0x24')]?_[_0x378d('0x25')](_0x11584b['options'][_0x378d('0x24')],function(_0x22fee7){return{'model':db[_0x22fee7[_0x378d('0x26')]],'as':_0x22fee7['as'],'attributes':_0x22fee7[_0x378d('0x27')],'include':_0x22fee7[_0x378d('0x24')]?_[_0x378d('0x25')](_0x22fee7[_0x378d('0x24')],function(_0x34ffa7){return{'model':db[_0x34ffa7['model']],'as':_0x34ffa7['as'],'attributes':_0x34ffa7['attributes'],'include':_0x34ffa7[_0x378d('0x24')]?_['map'](_0x34ffa7[_0x378d('0x24')],function(_0x292b73){return{'model':db[_0x292b73[_0x378d('0x26')]],'as':_0x292b73['as'],'attributes':_0x292b73[_0x378d('0x27')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x59945b){logger[_0x378d('0x1a')]('GetVoiceExtension',_0x11584b);logger['debug']('GetVoiceExtension',_0x11584b,JSON[_0x378d('0x15')](_0x59945b));_0x521d40(_0x59945b);})['catch'](function(_0x4d1de5){logger[_0x378d('0x16')]('GetVoiceExtension',_0x4d1de5[_0x378d('0x19')],_0x11584b);_0x5a936c(_0x1c9244[_0x378d('0x16')](0x1f4,_0x4d1de5[_0x378d('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 839218c..c986dfb 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 _0x2ef3=['update','emit','removeListener','register','length','voiceExtension:','./voiceExtension.events','save','remove'];(function(_0x363974,_0x34a5ef){var _0x524fdc=function(_0x6477af){while(--_0x6477af){_0x363974['push'](_0x363974['shift']());}};_0x524fdc(++_0x34a5ef);}(_0x2ef3,0xba));var _0x32ef=function(_0xe56e4a,_0x521cce){_0xe56e4a=_0xe56e4a-0x0;var _0x260672=_0x2ef3[_0xe56e4a];return _0x260672;};'use strict';var VoiceExtensionEvents=require(_0x32ef('0x0'));var events=[_0x32ef('0x1'),_0x32ef('0x2'),_0x32ef('0x3')];function createListener(_0x3944df,_0x38047b){return function(_0x48106c){_0x38047b[_0x32ef('0x4')](_0x3944df,_0x48106c);};}function removeListener(_0x38b7f3,_0x524ab6){return function(){VoiceExtensionEvents[_0x32ef('0x5')](_0x38b7f3,_0x524ab6);};}exports[_0x32ef('0x6')]=function(_0x4c8104){for(var _0x5dfa09=0x0,_0x2c0089=events[_0x32ef('0x7')];_0x5dfa09<_0x2c0089;_0x5dfa09++){var _0x367c39=events[_0x5dfa09];var _0x2fb8eb=createListener(_0x32ef('0x8')+_0x367c39,_0x4c8104);VoiceExtensionEvents['on'](_0x367c39,_0x2fb8eb);}}; \ No newline at end of file +var _0xe14b=['removeListener','register','length','./voiceExtension.events','save','emit'];(function(_0x4282b1,_0x520de8){var _0x13d98a=function(_0x25fb96){while(--_0x25fb96){_0x4282b1['push'](_0x4282b1['shift']());}};_0x13d98a(++_0x520de8);}(_0xe14b,0x93));var _0xbe14=function(_0x97d5c7,_0x2b340b){_0x97d5c7=_0x97d5c7-0x0;var _0xce6d47=_0xe14b[_0x97d5c7];return _0xce6d47;};'use strict';var VoiceExtensionEvents=require(_0xbe14('0x0'));var events=[_0xbe14('0x1'),'remove','update'];function createListener(_0x11c3a0,_0x36393a){return function(_0x48a116){_0x36393a[_0xbe14('0x2')](_0x11c3a0,_0x48a116);};}function removeListener(_0x5ce8fb,_0x496c04){return function(){VoiceExtensionEvents[_0xbe14('0x3')](_0x5ce8fb,_0x496c04);};}exports[_0xbe14('0x4')]=function(_0x1fe204){for(var _0x1ff100=0x0,_0x1d9ade=events[_0xbe14('0x5')];_0x1ff100<_0x1d9ade;_0x1ff100++){var _0x196fca=events[_0x1ff100];var _0x566ae7=createListener('voiceExtension:'+_0x196fca,_0x1fe204);VoiceExtensionEvents['on'](_0x196fca,_0x566ae7);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index c51fb6c..1aeba61 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 _0x27a0=['exports','util','path','connect-timeout','express','Router','./voiceMail.controller','get','isAuthenticated','index','/:id','show','/:id/messages','getMessages','post','put','update','delete','destroy'];(function(_0x3dee92,_0x55e1eb){var _0x44d36e=function(_0x34de1a){while(--_0x34de1a){_0x3dee92['push'](_0x3dee92['shift']());}};_0x44d36e(++_0x55e1eb);}(_0x27a0,0xbf));var _0x027a=function(_0x12236a,_0x403ece){_0x12236a=_0x12236a-0x0;var _0x155ca4=_0x27a0[_0x12236a];return _0x155ca4;};'use strict';var multer=require('multer');var util=require(_0x027a('0x0'));var path=require(_0x027a('0x1'));var timeout=require(_0x027a('0x2'));var express=require(_0x027a('0x3'));var router=express[_0x027a('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x027a('0x5'));router[_0x027a('0x6')]('/',auth[_0x027a('0x7')](),controller[_0x027a('0x8')]);router[_0x027a('0x6')](_0x027a('0x9'),auth['isAuthenticated'](),controller[_0x027a('0xa')]);router[_0x027a('0x6')](_0x027a('0xb'),auth['isAuthenticated'](),controller[_0x027a('0xc')]);router[_0x027a('0xd')]('/',auth[_0x027a('0x7')](),controller['create']);router[_0x027a('0xe')](_0x027a('0x9'),auth[_0x027a('0x7')](),controller[_0x027a('0xf')]);router[_0x027a('0x10')](_0x027a('0x9'),auth[_0x027a('0x7')](),controller[_0x027a('0x11')]);module[_0x027a('0x12')]=router; \ No newline at end of file +var _0xa46e=['delete','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','index','isAuthenticated','show','/:id/messages','create','put','update'];(function(_0x50827e,_0x235f53){var _0x249c67=function(_0x397d1e){while(--_0x397d1e){_0x50827e['push'](_0x50827e['shift']());}};_0x249c67(++_0x235f53);}(_0xa46e,0x8a));var _0xea46=function(_0x118139,_0x7ce965){_0x118139=_0x118139-0x0;var _0x2fece9=_0xa46e[_0x118139];return _0x2fece9;};'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('./voiceMail.controller');router[_0xea46('0x7')]('/',auth['isAuthenticated'](),controller[_0xea46('0x8')]);router[_0xea46('0x7')]('/:id',auth[_0xea46('0x9')](),controller[_0xea46('0xa')]);router[_0xea46('0x7')](_0xea46('0xb'),auth[_0xea46('0x9')](),controller['getMessages']);router['post']('/',auth['isAuthenticated'](),controller[_0xea46('0xc')]);router[_0xea46('0xd')]('/:id',auth[_0xea46('0x9')](),controller[_0xea46('0xe')]);router[_0xea46('0xf')]('/:id',auth[_0xea46('0x9')](),controller[_0xea46('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index a20cc48..9f0d104 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 _0x04f3=['yes','TIMESTAMP','INTEGER','VIRTUAL','fullname','\x20-\x20','getDataValue','sequelize','exports','STRING','from-voicemail','contest_mailbox','setDataValue','email','string','trim','ENUM'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0x04f3,0xf5));var _0x304f=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x04f3[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require(_0x304f('0x0'));module[_0x304f('0x1')]={'customer_id':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x304f('0x2')],'defaultValue':_0x304f('0x3'),'unique':_0x304f('0x4')},'mailbox':{'type':Sequelize[_0x304f('0x2')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize['STRING']},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x304f('0x2')],'validate':{'isEmail':!![]},'set':function(_0x5d9cb0){this[_0x304f('0x5')](_0x304f('0x6'),typeof _0x5d9cb0===_0x304f('0x7')&&_0x5d9cb0['trim']()?_0x5d9cb0[_0x304f('0x8')]():null);}},'pager':{'type':Sequelize[_0x304f('0x2')]},'tz':{'type':Sequelize[_0x304f('0x2')],'defaultValue':'central'},'attach':{'type':Sequelize[_0x304f('0x9')](_0x304f('0xa'),'no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize[_0x304f('0x9')](_0x304f('0xa'),'no'),'defaultValue':_0x304f('0xa'),'allowNull':![]},'dialout':{'type':Sequelize[_0x304f('0x2')]},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize[_0x304f('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x304f('0x9')](_0x304f('0xa'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM'](_0x304f('0xa'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x304f('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x304f('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM'](_0x304f('0xa'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x304f('0x9')](_0x304f('0xa'),'no'),'defaultValue':_0x304f('0xa'),'allowNull':![]},'forcename':{'type':Sequelize['ENUM'](_0x304f('0xa'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x304f('0x9')](_0x304f('0xa'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x304f('0x9')](_0x304f('0xa'),'no'),'defaultValue':_0x304f('0xa'),'allowNull':![]},'stamp':{'type':_0x304f('0xb')},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize[_0x304f('0x2')]},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x304f('0xc')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x304f('0xd')],'get':function(){return this['getDataValue'](_0x304f('0xe'))+_0x304f('0xf')+this[_0x304f('0x10')]('mailbox');}}}; \ No newline at end of file +var _0xf7b9=['trim','central','ENUM','yes','INTEGER','VIRTUAL','getDataValue','\x20-\x20','mailbox','exports','STRING','from-voicemail','contest_mailbox','setDataValue','email','string'];(function(_0x483fea,_0x54b1d0){var _0x1a910e=function(_0x5d266f){while(--_0x5d266f){_0x483fea['push'](_0x483fea['shift']());}};_0x1a910e(++_0x54b1d0);}(_0xf7b9,0x129));var _0x9f7b=function(_0x1716b4,_0x56cee4){_0x1716b4=_0x1716b4-0x0;var _0x54bd16=_0xf7b9[_0x1716b4];return _0x54bd16;};'use strict';var Sequelize=require('sequelize');module[_0x9f7b('0x0')]={'customer_id':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x9f7b('0x1')],'defaultValue':_0x9f7b('0x2'),'unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0x9f7b('0x1')],'defaultValue':'','allowNull':![],'unique':_0x9f7b('0x3')},'password':{'type':Sequelize['STRING']},'fullname':{'type':Sequelize[_0x9f7b('0x1')]},'email':{'type':Sequelize[_0x9f7b('0x1')],'validate':{'isEmail':!![]},'set':function(_0x101239){this[_0x9f7b('0x4')](_0x9f7b('0x5'),typeof _0x101239===_0x9f7b('0x6')&&_0x101239[_0x9f7b('0x7')]()?_0x101239['trim']():null);}},'pager':{'type':Sequelize[_0x9f7b('0x1')]},'tz':{'type':Sequelize[_0x9f7b('0x1')],'defaultValue':_0x9f7b('0x8')},'attach':{'type':Sequelize[_0x9f7b('0x9')](_0x9f7b('0xa'),'no'),'defaultValue':_0x9f7b('0xa'),'allowNull':![]},'saycid':{'type':Sequelize[_0x9f7b('0x9')](_0x9f7b('0xa'),'no'),'defaultValue':_0x9f7b('0xa'),'allowNull':![]},'dialout':{'type':Sequelize[_0x9f7b('0x1')]},'callback':{'type':Sequelize[_0x9f7b('0x1')]},'review':{'type':Sequelize[_0x9f7b('0x9')](_0x9f7b('0xa'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM'](_0x9f7b('0xa'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM'](_0x9f7b('0xa'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x9f7b('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x9f7b('0x9')](_0x9f7b('0xa'),'no'),'defaultValue':'yes','allowNull':![]},'forcename':{'type':Sequelize['ENUM'](_0x9f7b('0xa'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x9f7b('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x9f7b('0x9')](_0x9f7b('0xa'),'no'),'defaultValue':_0x9f7b('0xa'),'allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize[_0x9f7b('0x1')]},'emailbody':{'type':Sequelize['STRING']},'maxsecs':{'type':Sequelize[_0x9f7b('0xb')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x9f7b('0xb')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x9f7b('0xc')],'get':function(){return this[_0x9f7b('0xd')]('fullname')+_0x9f7b('0xe')+this[_0x9f7b('0xd')](_0x9f7b('0xf'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 217e511..ba128f3 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 _0x97c1=['error','stack','name','VoiceMail','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','findAll','rows','catch','show','params','keys','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','getMessages','pick','mailbox','VoiceMailMessage','findAndCountAll','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','get','Voicemails','sendStatus'];(function(_0x1f78ad,_0x161e1e){var _0x2012d1=function(_0xd601fa){while(--_0xd601fa){_0x1f78ad['push'](_0x1f78ad['shift']());}};_0x2012d1(++_0x161e1e);}(_0x97c1,0xdf));var _0x197c=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x97c1[_0x59ee6f];return _0x4c0979;};'use strict';var emlformat=require(_0x197c('0x0'));var rimraf=require(_0x197c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x197c('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x197c('0x3'));var Mustache=require(_0x197c('0x4'));var util=require(_0x197c('0x5'));var path=require(_0x197c('0x6'));var sox=require(_0x197c('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x197c('0x8'));var _=require(_0x197c('0x9'));var squel=require(_0x197c('0xa'));var crypto=require(_0x197c('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x197c('0xc'));var querystring=require('querystring');var Papa=require(_0x197c('0xd'));var Redis=require(_0x197c('0xe'));var authService=require(_0x197c('0xf'));var qs=require(_0x197c('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x197c('0x11'));var logger=require(_0x197c('0x12'))(_0x197c('0x13'));var utils=require(_0x197c('0x14'));var config=require(_0x197c('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x197c('0x16'))['db'];function respondWithStatusCode(_0x668f8,_0x27e46f){_0x27e46f=_0x27e46f||0xcc;return function(_0x1adcfa){if(_0x1adcfa){return _0x668f8['sendStatus'](_0x27e46f);}return _0x668f8[_0x197c('0x17')](_0x27e46f)[_0x197c('0x18')]();};}function respondWithResult(_0x5a7e1c,_0xf735ce){_0xf735ce=_0xf735ce||0xc8;return function(_0x188ff2){if(_0x188ff2){return _0x5a7e1c[_0x197c('0x17')](_0xf735ce)['json'](_0x188ff2);}};}function respondWithFilteredResult(_0x5194c3,_0x422dfa){return function(_0x2bc612){if(_0x2bc612){var _0x2083d4=typeof _0x422dfa[_0x197c('0x19')]===_0x197c('0x1a')&&typeof _0x422dfa[_0x197c('0x1b')]===_0x197c('0x1a');var _0x75beba=_0x2bc612['count'];var _0x372311=_0x2083d4?0x0:_0x422dfa['offset'];var _0x50ac52=_0x2083d4?_0x2bc612[_0x197c('0x1c')]:_0x422dfa[_0x197c('0x19')]+_0x422dfa[_0x197c('0x1b')];var _0x2ce10d;if(_0x50ac52>=_0x75beba){_0x50ac52=_0x75beba;_0x2ce10d=0xc8;}else{_0x2ce10d=0xce;}_0x5194c3['status'](_0x2ce10d);return _0x5194c3[_0x197c('0x1d')](_0x197c('0x1e'),_0x372311+'-'+_0x50ac52+'/'+_0x75beba)[_0x197c('0x1f')](_0x2bc612);}return null;};}function patchUpdates(_0x5c278a){return function(_0x1adb43){try{jsonpatch[_0x197c('0x20')](_0x1adb43,_0x5c278a,!![]);}catch(_0x3b5c4c){return BPromise[_0x197c('0x21')](_0x3b5c4c);}return _0x1adb43[_0x197c('0x22')]();};}function saveUpdates(_0x3c2151,_0x362bbf){return function(_0x2092a0){if(_0x2092a0){return _0x2092a0[_0x197c('0x23')](_0x3c2151)[_0x197c('0x24')](function(_0x29b266){return _0x29b266;});}return null;};}function removeEntity(_0x177bc9,_0x174942){return function(_0x2a1310){if(_0x2a1310){return _0x2a1310[_0x197c('0x25')]()[_0x197c('0x24')](function(){var _0x5f4a02=_0x2a1310[_0x197c('0x26')]({'plain':!![]});var _0x2911dd=_0x197c('0x27');return db['UserProfileResource'][_0x197c('0x25')]({'where':{'type':_0x2911dd,'resourceId':_0x5f4a02['id']}})[_0x197c('0x24')](function(){return _0x2a1310;});})['then'](function(){_0x177bc9['status'](0xcc)[_0x197c('0x18')]();});}};}function handleEntityNotFound(_0x48f759,_0xfbca7a){return function(_0x14b0aa){if(!_0x14b0aa){_0x48f759[_0x197c('0x28')](0x194);}return _0x14b0aa;};}function handleError(_0x16e026,_0x2f031c){_0x2f031c=_0x2f031c||0x1f4;return function(_0x3cdcd8){logger[_0x197c('0x29')](_0x3cdcd8[_0x197c('0x2a')]);if(_0x3cdcd8[_0x197c('0x2b')]){delete _0x3cdcd8['name'];}_0x16e026['status'](_0x2f031c)['send'](_0x3cdcd8);};}exports['index']=function(_0x5f7425,_0x4c9256){var _0x252cde={},_0x35dbf3={},_0x58bc60={'count':0x0,'rows':[]};var _0x422ac6=_['map'](db[_0x197c('0x2c')][_0x197c('0x2d')],function(_0x2ace33){return{'name':_0x2ace33[_0x197c('0x2e')],'type':_0x2ace33[_0x197c('0x2f')][_0x197c('0x30')]};});_0x35dbf3[_0x197c('0x31')]=_[_0x197c('0x32')](_0x422ac6,_0x197c('0x2b'));_0x35dbf3['query']=_['keys'](_0x5f7425[_0x197c('0x33')]);_0x35dbf3[_0x197c('0x34')]=_[_0x197c('0x35')](_0x35dbf3[_0x197c('0x31')],_0x35dbf3[_0x197c('0x33')]);_0x252cde[_0x197c('0x36')]=_[_0x197c('0x35')](_0x35dbf3['model'],qs['fields'](_0x5f7425[_0x197c('0x33')][_0x197c('0x37')]));_0x252cde['attributes']=_0x252cde['attributes'][_0x197c('0x38')]?_0x252cde[_0x197c('0x36')]:_0x35dbf3[_0x197c('0x31')];if(!_0x5f7425[_0x197c('0x33')][_0x197c('0x39')](_0x197c('0x3a'))){_0x252cde[_0x197c('0x1b')]=qs[_0x197c('0x1b')](_0x5f7425[_0x197c('0x33')]['limit']);_0x252cde[_0x197c('0x19')]=qs[_0x197c('0x19')](_0x5f7425[_0x197c('0x33')][_0x197c('0x19')]);}_0x252cde[_0x197c('0x3b')]=qs[_0x197c('0x3c')](_0x5f7425['query'][_0x197c('0x3c')]);_0x252cde[_0x197c('0x3d')]=qs[_0x197c('0x34')](_['pick'](_0x5f7425[_0x197c('0x33')],_0x35dbf3[_0x197c('0x34')]),_0x422ac6);if(_0x5f7425[_0x197c('0x33')][_0x197c('0x3e')]){_0x252cde[_0x197c('0x3d')]=_[_0x197c('0x3f')](_0x252cde[_0x197c('0x3d')],{'$or':_[_0x197c('0x32')](_0x422ac6,function(_0x323a14){if(_0x323a14[_0x197c('0x2f')]!=='VIRTUAL'){var _0x2705f5={};_0x2705f5[_0x323a14[_0x197c('0x2b')]]={'$like':'%'+_0x5f7425['query']['filter']+'%'};return _0x2705f5;}})});}_0x252cde=_[_0x197c('0x3f')]({},_0x252cde,_0x5f7425[_0x197c('0x40')]);var _0x3517a6={'where':_0x252cde[_0x197c('0x3d')]};return db[_0x197c('0x2c')]['count'](_0x3517a6)[_0x197c('0x24')](function(_0x3efae){_0x58bc60[_0x197c('0x1c')]=_0x3efae;if(_0x5f7425[_0x197c('0x33')][_0x197c('0x41')]){_0x252cde['include']=[{'all':!![]}];}return db[_0x197c('0x2c')][_0x197c('0x42')](_0x252cde);})[_0x197c('0x24')](function(_0x197b27){_0x58bc60[_0x197c('0x43')]=_0x197b27;return _0x58bc60;})['then'](respondWithFilteredResult(_0x4c9256,_0x252cde))[_0x197c('0x44')](handleError(_0x4c9256,null));};exports[_0x197c('0x45')]=function(_0x3b7fc1,_0x35f36d){var _0x3e6d6e={'raw':!![],'where':{'id':_0x3b7fc1[_0x197c('0x46')]['id']}},_0x41eb51={};_0x41eb51[_0x197c('0x31')]=_[_0x197c('0x47')](db[_0x197c('0x2c')][_0x197c('0x2d')]);_0x41eb51['query']=_['keys'](_0x3b7fc1['query']);_0x41eb51['filters']=_[_0x197c('0x35')](_0x41eb51[_0x197c('0x31')],_0x41eb51['query']);_0x3e6d6e[_0x197c('0x36')]=_[_0x197c('0x35')](_0x41eb51['model'],qs[_0x197c('0x37')](_0x3b7fc1[_0x197c('0x33')]['fields']));_0x3e6d6e[_0x197c('0x36')]=_0x3e6d6e[_0x197c('0x36')]['length']?_0x3e6d6e[_0x197c('0x36')]:_0x41eb51[_0x197c('0x31')];if(_0x3b7fc1[_0x197c('0x33')]['includeAll']){_0x3e6d6e[_0x197c('0x48')]=[{'all':!![]}];}_0x3e6d6e=_[_0x197c('0x3f')]({},_0x3e6d6e,_0x3b7fc1[_0x197c('0x40')]);return db[_0x197c('0x2c')]['find'](_0x3e6d6e)[_0x197c('0x24')](handleEntityNotFound(_0x35f36d,null))[_0x197c('0x24')](respondWithResult(_0x35f36d,null))[_0x197c('0x44')](handleError(_0x35f36d,null));};exports['create']=function(_0x5994bf,_0x3a5089){return db[_0x197c('0x2c')][_0x197c('0x49')](_0x5994bf[_0x197c('0x4a')],{})[_0x197c('0x24')](function(_0x28fac4){var _0x4c82d5=_0x5994bf[_0x197c('0x4b')]['get']({'plain':!![]});if(!_0x4c82d5)throw new Error(_0x197c('0x4c'));if(_0x4c82d5[_0x197c('0x4d')]===_0x197c('0x4b')){var _0x9e8c6a=_0x28fac4[_0x197c('0x26')]({'plain':!![]});var _0x2ab21f=_0x197c('0x27');return db[_0x197c('0x4e')]['find']({'where':{'name':_0x2ab21f,'userProfileId':_0x4c82d5[_0x197c('0x4f')]},'raw':!![]})[_0x197c('0x24')](function(_0x43e9b7){if(_0x43e9b7&&_0x43e9b7['autoAssociation']===0x0){return db[_0x197c('0x50')]['create']({'name':_0x9e8c6a[_0x197c('0x2b')],'resourceId':_0x9e8c6a['id'],'type':_0x43e9b7[_0x197c('0x2b')],'sectionId':_0x43e9b7['id']},{})[_0x197c('0x24')](function(){return _0x28fac4;});}else{return _0x28fac4;}})[_0x197c('0x44')](function(_0x1d7cdd){logger[_0x197c('0x29')](_0x197c('0x51'),_0x1d7cdd);throw _0x1d7cdd;});}return _0x28fac4;})[_0x197c('0x24')](respondWithResult(_0x3a5089,0xc9))['catch'](handleError(_0x3a5089,null));};exports[_0x197c('0x23')]=function(_0x3a9261,_0x275294){if(_0x3a9261['body']['id']){delete _0x3a9261[_0x197c('0x4a')]['id'];}return db[_0x197c('0x2c')][_0x197c('0x52')]({'where':{'id':_0x3a9261[_0x197c('0x46')]['id']}})[_0x197c('0x24')](handleEntityNotFound(_0x275294,null))['then'](saveUpdates(_0x3a9261['body'],null))[_0x197c('0x24')](respondWithResult(_0x275294,null))[_0x197c('0x44')](handleError(_0x275294,null));};exports[_0x197c('0x25')]=function(_0x42a13f,_0x15e50f){return db['VoiceMail']['find']({'where':{'id':_0x42a13f[_0x197c('0x46')]['id']}})[_0x197c('0x24')](handleEntityNotFound(_0x15e50f,null))['then'](removeEntity(_0x15e50f,null))[_0x197c('0x44')](handleError(_0x15e50f,null));};exports[_0x197c('0x53')]=function(_0x1a607c,_0x40867c,_0xc10419){return db[_0x197c('0x2c')]['findOne']({'where':{'id':_0x1a607c[_0x197c('0x46')]['id']}})[_0x197c('0x24')](handleEntityNotFound(_0x40867c,null))['then'](function(_0x480cab){var _0x1b71cf;var _0x5a70dd={},_0xfc9461={};_0xfc9461[_0x197c('0x31')]=_[_0x197c('0x47')](db['VoiceMailMessage'][_0x197c('0x2d')]);_0xfc9461[_0x197c('0x33')]=_['keys'](_0x1a607c[_0x197c('0x33')]);_0xfc9461[_0x197c('0x34')]=_[_0x197c('0x35')](_0xfc9461['model'],_0xfc9461[_0x197c('0x33')]);_0x5a70dd[_0x197c('0x36')]=_['intersection'](_0xfc9461['model'],qs[_0x197c('0x37')](_0x1a607c[_0x197c('0x33')][_0x197c('0x37')]));_0x5a70dd['attributes']=_0x5a70dd[_0x197c('0x36')][_0x197c('0x38')]?_0x5a70dd[_0x197c('0x36')]:_0xfc9461['model'];if(!_0x1a607c[_0x197c('0x33')][_0x197c('0x39')](_0x197c('0x3a'))){_0x5a70dd[_0x197c('0x1b')]=qs[_0x197c('0x1b')](_0x1a607c[_0x197c('0x33')][_0x197c('0x1b')]);_0x5a70dd[_0x197c('0x19')]=qs[_0x197c('0x19')](_0x1a607c[_0x197c('0x33')]['offset']);}_0x5a70dd[_0x197c('0x3b')]=qs['sort'](_0x1a607c['query']['sort']);_0x5a70dd['where']=qs[_0x197c('0x34')](_[_0x197c('0x54')](_0x1a607c[_0x197c('0x33')],_0xfc9461[_0x197c('0x34')]));if(_0x1a607c['query'][_0x197c('0x3e')]){_0x5a70dd['where']=_[_0x197c('0x3f')](_0x5a70dd['where'],{'$or':_[_0x197c('0x32')](_0x5a70dd['attributes'],function(_0x12d31a){var _0x1f6c6f={};_0x1f6c6f[_0x12d31a]={'$like':'%'+_0x1a607c[_0x197c('0x33')][_0x197c('0x3e')]+'%'};return _0x1f6c6f;})});}_0x5a70dd['where']=_[_0x197c('0x3f')](_0x5a70dd[_0x197c('0x3d')],{'mailboxuser':_0x480cab[_0x197c('0x55')]});_0x5a70dd=_['merge']({},_0x5a70dd,_0x1a607c[_0x197c('0x40')]);return db[_0x197c('0x56')][_0x197c('0x57')](_0x5a70dd)[_0x197c('0x24')](respondWithFilteredResult(_0x40867c,_0x5a70dd));})[_0x197c('0x44')](handleError(_0x40867c,null));}; \ No newline at end of file +var _0x3c81=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','get','end','error','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','intersection','fields','attributes','length','nolimit','order','sort','where','filters','pick','merge','filter','options','VoiceMail','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Voicemails','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMessages','findOne','VoiceMailMessage','hasOwnProperty','mailbox','findAndCountAll','eml-format','rimraf','fast-json-patch','request-promise','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x1241b1,_0x55a7c8){var _0x3aa14d=function(_0x334b40){while(--_0x334b40){_0x1241b1['push'](_0x1241b1['shift']());}};_0x3aa14d(++_0x55a7c8);}(_0x3c81,0x102));var _0x13c8=function(_0x24ac8a,_0x4ab065){_0x24ac8a=_0x24ac8a-0x0;var _0x38cd87=_0x3c81[_0x24ac8a];return _0x38cd87;};'use strict';var emlformat=require(_0x13c8('0x0'));var rimraf=require(_0x13c8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x13c8('0x2'));var rp=require(_0x13c8('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x13c8('0x4'));var sox=require(_0x13c8('0x5'));var csv=require(_0x13c8('0x6'));var ejs=require(_0x13c8('0x7'));var fs=require('fs');var fs_extra=require(_0x13c8('0x8'));var _=require(_0x13c8('0x9'));var squel=require(_0x13c8('0xa'));var crypto=require('crypto');var jsforce=require(_0x13c8('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x13c8('0x6'));var querystring=require(_0x13c8('0xc'));var Papa=require(_0x13c8('0xd'));var Redis=require(_0x13c8('0xe'));var authService=require(_0x13c8('0xf'));var qs=require(_0x13c8('0x10'));var as=require(_0x13c8('0x11'));var hardwareService=require(_0x13c8('0x12'));var logger=require(_0x13c8('0x13'))(_0x13c8('0x14'));var utils=require(_0x13c8('0x15'));var config=require(_0x13c8('0x16'));var licenseUtil=require(_0x13c8('0x17'));var db=require(_0x13c8('0x18'))['db'];function respondWithStatusCode(_0x5ab91d,_0x21442d){_0x21442d=_0x21442d||0xcc;return function(_0x7b6da8){if(_0x7b6da8){return _0x5ab91d[_0x13c8('0x19')](_0x21442d);}return _0x5ab91d[_0x13c8('0x1a')](_0x21442d)['end']();};}function respondWithResult(_0x42955d,_0x515681){_0x515681=_0x515681||0xc8;return function(_0x4d7a88){if(_0x4d7a88){return _0x42955d['status'](_0x515681)[_0x13c8('0x1b')](_0x4d7a88);}};}function respondWithFilteredResult(_0x5e0e06,_0x337397){return function(_0x17a3c1){if(_0x17a3c1){var _0x23f64e=typeof _0x337397[_0x13c8('0x1c')]==='undefined'&&typeof _0x337397[_0x13c8('0x1d')]===_0x13c8('0x1e');var _0x31ae02=_0x17a3c1[_0x13c8('0x1f')];var _0xce1ad2=_0x23f64e?0x0:_0x337397[_0x13c8('0x1c')];var _0x346417=_0x23f64e?_0x17a3c1[_0x13c8('0x1f')]:_0x337397[_0x13c8('0x1c')]+_0x337397[_0x13c8('0x1d')];var _0xe9386a;if(_0x346417>=_0x31ae02){_0x346417=_0x31ae02;_0xe9386a=0xc8;}else{_0xe9386a=0xce;}_0x5e0e06['status'](_0xe9386a);return _0x5e0e06[_0x13c8('0x20')](_0x13c8('0x21'),_0xce1ad2+'-'+_0x346417+'/'+_0x31ae02)[_0x13c8('0x1b')](_0x17a3c1);}return null;};}function patchUpdates(_0x313ea3){return function(_0x513085){try{jsonpatch[_0x13c8('0x22')](_0x513085,_0x313ea3,!![]);}catch(_0x3c4603){return BPromise[_0x13c8('0x23')](_0x3c4603);}return _0x513085[_0x13c8('0x24')]();};}function saveUpdates(_0x436d5d,_0x2fc123){return function(_0x5ab47f){if(_0x5ab47f){return _0x5ab47f[_0x13c8('0x25')](_0x436d5d)[_0x13c8('0x26')](function(_0x315d6c){return _0x315d6c;});}return null;};}function removeEntity(_0xcf41d2,_0x577df6){return function(_0x1770e5){if(_0x1770e5){return _0x1770e5[_0x13c8('0x27')]()['then'](function(){var _0x49b552=_0x1770e5[_0x13c8('0x28')]({'plain':!![]});var _0x4aff35='Voicemails';return db['UserProfileResource'][_0x13c8('0x27')]({'where':{'type':_0x4aff35,'resourceId':_0x49b552['id']}})[_0x13c8('0x26')](function(){return _0x1770e5;});})['then'](function(){_0xcf41d2['status'](0xcc)[_0x13c8('0x29')]();});}};}function handleEntityNotFound(_0x596166,_0x545b47){return function(_0x1c7dc4){if(!_0x1c7dc4){_0x596166[_0x13c8('0x19')](0x194);}return _0x1c7dc4;};}function handleError(_0x34fdbe,_0x560ede){_0x560ede=_0x560ede||0x1f4;return function(_0x5ef2f7){logger[_0x13c8('0x2a')](_0x5ef2f7[_0x13c8('0x2b')]);if(_0x5ef2f7[_0x13c8('0x2c')]){delete _0x5ef2f7[_0x13c8('0x2c')];}_0x34fdbe[_0x13c8('0x1a')](_0x560ede)[_0x13c8('0x2d')](_0x5ef2f7);};}exports[_0x13c8('0x2e')]=function(_0x4a1b9c,_0x109cb8){var _0xcbc9b7={},_0x5a5911={},_0x5c85e4={'count':0x0,'rows':[]};var _0x23a725=_[_0x13c8('0x2f')](db['VoiceMail'][_0x13c8('0x30')],function(_0x355ddc){return{'name':_0x355ddc['fieldName'],'type':_0x355ddc[_0x13c8('0x31')][_0x13c8('0x32')]};});_0x5a5911[_0x13c8('0x33')]=_[_0x13c8('0x2f')](_0x23a725,_0x13c8('0x2c'));_0x5a5911[_0x13c8('0x34')]=_[_0x13c8('0x35')](_0x4a1b9c[_0x13c8('0x34')]);_0x5a5911['filters']=_['intersection'](_0x5a5911[_0x13c8('0x33')],_0x5a5911[_0x13c8('0x34')]);_0xcbc9b7['attributes']=_[_0x13c8('0x36')](_0x5a5911['model'],qs[_0x13c8('0x37')](_0x4a1b9c['query'][_0x13c8('0x37')]));_0xcbc9b7[_0x13c8('0x38')]=_0xcbc9b7[_0x13c8('0x38')][_0x13c8('0x39')]?_0xcbc9b7[_0x13c8('0x38')]:_0x5a5911[_0x13c8('0x33')];if(!_0x4a1b9c[_0x13c8('0x34')]['hasOwnProperty'](_0x13c8('0x3a'))){_0xcbc9b7[_0x13c8('0x1d')]=qs['limit'](_0x4a1b9c[_0x13c8('0x34')][_0x13c8('0x1d')]);_0xcbc9b7[_0x13c8('0x1c')]=qs['offset'](_0x4a1b9c['query']['offset']);}_0xcbc9b7[_0x13c8('0x3b')]=qs[_0x13c8('0x3c')](_0x4a1b9c[_0x13c8('0x34')][_0x13c8('0x3c')]);_0xcbc9b7[_0x13c8('0x3d')]=qs[_0x13c8('0x3e')](_[_0x13c8('0x3f')](_0x4a1b9c[_0x13c8('0x34')],_0x5a5911[_0x13c8('0x3e')]),_0x23a725);if(_0x4a1b9c['query']['filter']){_0xcbc9b7[_0x13c8('0x3d')]=_[_0x13c8('0x40')](_0xcbc9b7[_0x13c8('0x3d')],{'$or':_[_0x13c8('0x2f')](_0x23a725,function(_0x4f1bed){if(_0x4f1bed[_0x13c8('0x31')]!=='VIRTUAL'){var _0x343dba={};_0x343dba[_0x4f1bed[_0x13c8('0x2c')]]={'$like':'%'+_0x4a1b9c[_0x13c8('0x34')][_0x13c8('0x41')]+'%'};return _0x343dba;}})});}_0xcbc9b7=_[_0x13c8('0x40')]({},_0xcbc9b7,_0x4a1b9c[_0x13c8('0x42')]);var _0xb272c0={'where':_0xcbc9b7[_0x13c8('0x3d')]};return db[_0x13c8('0x43')][_0x13c8('0x1f')](_0xb272c0)[_0x13c8('0x26')](function(_0x416169){_0x5c85e4[_0x13c8('0x1f')]=_0x416169;if(_0x4a1b9c[_0x13c8('0x34')][_0x13c8('0x44')]){_0xcbc9b7[_0x13c8('0x45')]=[{'all':!![]}];}return db[_0x13c8('0x43')][_0x13c8('0x46')](_0xcbc9b7);})[_0x13c8('0x26')](function(_0x1cff99){_0x5c85e4[_0x13c8('0x47')]=_0x1cff99;return _0x5c85e4;})[_0x13c8('0x26')](respondWithFilteredResult(_0x109cb8,_0xcbc9b7))[_0x13c8('0x48')](handleError(_0x109cb8,null));};exports[_0x13c8('0x49')]=function(_0x44ee66,_0x57e65f){var _0x3ef04e={'raw':!![],'where':{'id':_0x44ee66[_0x13c8('0x4a')]['id']}},_0x3fcb7f={};_0x3fcb7f[_0x13c8('0x33')]=_[_0x13c8('0x35')](db['VoiceMail']['rawAttributes']);_0x3fcb7f[_0x13c8('0x34')]=_[_0x13c8('0x35')](_0x44ee66[_0x13c8('0x34')]);_0x3fcb7f['filters']=_['intersection'](_0x3fcb7f['model'],_0x3fcb7f[_0x13c8('0x34')]);_0x3ef04e['attributes']=_[_0x13c8('0x36')](_0x3fcb7f['model'],qs[_0x13c8('0x37')](_0x44ee66[_0x13c8('0x34')][_0x13c8('0x37')]));_0x3ef04e[_0x13c8('0x38')]=_0x3ef04e[_0x13c8('0x38')][_0x13c8('0x39')]?_0x3ef04e['attributes']:_0x3fcb7f[_0x13c8('0x33')];if(_0x44ee66[_0x13c8('0x34')]['includeAll']){_0x3ef04e[_0x13c8('0x45')]=[{'all':!![]}];}_0x3ef04e=_[_0x13c8('0x40')]({},_0x3ef04e,_0x44ee66[_0x13c8('0x42')]);return db[_0x13c8('0x43')][_0x13c8('0x4b')](_0x3ef04e)['then'](handleEntityNotFound(_0x57e65f,null))[_0x13c8('0x26')](respondWithResult(_0x57e65f,null))[_0x13c8('0x48')](handleError(_0x57e65f,null));};exports[_0x13c8('0x4c')]=function(_0x38418b,_0x185d18){return db['VoiceMail'][_0x13c8('0x4c')](_0x38418b[_0x13c8('0x4d')],{})[_0x13c8('0x26')](function(_0x6b042b){var _0x2d4f87=_0x38418b[_0x13c8('0x4e')][_0x13c8('0x28')]({'plain':!![]});if(!_0x2d4f87)throw new Error(_0x13c8('0x4f'));if(_0x2d4f87[_0x13c8('0x50')]===_0x13c8('0x4e')){var _0x266f4e=_0x6b042b['get']({'plain':!![]});var _0x10ba7c=_0x13c8('0x51');return db[_0x13c8('0x52')][_0x13c8('0x4b')]({'where':{'name':_0x10ba7c,'userProfileId':_0x2d4f87[_0x13c8('0x53')]},'raw':!![]})[_0x13c8('0x26')](function(_0x48b7f6){if(_0x48b7f6&&_0x48b7f6[_0x13c8('0x54')]===0x0){return db[_0x13c8('0x55')][_0x13c8('0x4c')]({'name':_0x266f4e['name'],'resourceId':_0x266f4e['id'],'type':_0x48b7f6['name'],'sectionId':_0x48b7f6['id']},{})[_0x13c8('0x26')](function(){return _0x6b042b;});}else{return _0x6b042b;}})[_0x13c8('0x48')](function(_0x55d353){logger[_0x13c8('0x2a')](_0x13c8('0x56'),_0x55d353);throw _0x55d353;});}return _0x6b042b;})['then'](respondWithResult(_0x185d18,0xc9))[_0x13c8('0x48')](handleError(_0x185d18,null));};exports['update']=function(_0x242791,_0x1f67bd){if(_0x242791[_0x13c8('0x4d')]['id']){delete _0x242791['body']['id'];}return db[_0x13c8('0x43')][_0x13c8('0x4b')]({'where':{'id':_0x242791['params']['id']}})[_0x13c8('0x26')](handleEntityNotFound(_0x1f67bd,null))['then'](saveUpdates(_0x242791[_0x13c8('0x4d')],null))[_0x13c8('0x26')](respondWithResult(_0x1f67bd,null))[_0x13c8('0x48')](handleError(_0x1f67bd,null));};exports[_0x13c8('0x27')]=function(_0x3760e4,_0x5f4884){return db[_0x13c8('0x43')]['find']({'where':{'id':_0x3760e4['params']['id']}})['then'](handleEntityNotFound(_0x5f4884,null))['then'](removeEntity(_0x5f4884,null))['catch'](handleError(_0x5f4884,null));};exports[_0x13c8('0x57')]=function(_0x46074c,_0x1515a5,_0x1f383f){return db[_0x13c8('0x43')][_0x13c8('0x58')]({'where':{'id':_0x46074c[_0x13c8('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1515a5,null))['then'](function(_0x41f9d7){var _0x30e3e4;var _0x27760b={},_0x11b3ba={};_0x11b3ba[_0x13c8('0x33')]=_[_0x13c8('0x35')](db[_0x13c8('0x59')][_0x13c8('0x30')]);_0x11b3ba['query']=_[_0x13c8('0x35')](_0x46074c[_0x13c8('0x34')]);_0x11b3ba['filters']=_[_0x13c8('0x36')](_0x11b3ba[_0x13c8('0x33')],_0x11b3ba[_0x13c8('0x34')]);_0x27760b[_0x13c8('0x38')]=_[_0x13c8('0x36')](_0x11b3ba[_0x13c8('0x33')],qs[_0x13c8('0x37')](_0x46074c[_0x13c8('0x34')][_0x13c8('0x37')]));_0x27760b[_0x13c8('0x38')]=_0x27760b[_0x13c8('0x38')][_0x13c8('0x39')]?_0x27760b[_0x13c8('0x38')]:_0x11b3ba[_0x13c8('0x33')];if(!_0x46074c[_0x13c8('0x34')][_0x13c8('0x5a')]('nolimit')){_0x27760b[_0x13c8('0x1d')]=qs['limit'](_0x46074c[_0x13c8('0x34')][_0x13c8('0x1d')]);_0x27760b['offset']=qs[_0x13c8('0x1c')](_0x46074c[_0x13c8('0x34')]['offset']);}_0x27760b[_0x13c8('0x3b')]=qs[_0x13c8('0x3c')](_0x46074c[_0x13c8('0x34')][_0x13c8('0x3c')]);_0x27760b[_0x13c8('0x3d')]=qs[_0x13c8('0x3e')](_[_0x13c8('0x3f')](_0x46074c[_0x13c8('0x34')],_0x11b3ba[_0x13c8('0x3e')]));if(_0x46074c[_0x13c8('0x34')][_0x13c8('0x41')]){_0x27760b['where']=_[_0x13c8('0x40')](_0x27760b[_0x13c8('0x3d')],{'$or':_[_0x13c8('0x2f')](_0x27760b[_0x13c8('0x38')],function(_0x372ae4){var _0x23c67e={};_0x23c67e[_0x372ae4]={'$like':'%'+_0x46074c['query'][_0x13c8('0x41')]+'%'};return _0x23c67e;})});}_0x27760b[_0x13c8('0x3d')]=_[_0x13c8('0x40')](_0x27760b['where'],{'mailboxuser':_0x41f9d7[_0x13c8('0x5b')]});_0x27760b=_[_0x13c8('0x40')]({},_0x27760b,_0x46074c[_0x13c8('0x42')]);return db[_0x13c8('0x59')][_0x13c8('0x5c')](_0x27760b)[_0x13c8('0x26')](respondWithFilteredResult(_0x1515a5,_0x27760b));})['catch'](handleError(_0x1515a5,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 7ce45d8..f81f226 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 _0x22e0=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMail.attributes','exports','VoiceMail','voice_voicemail','mailbox_context','context','util','../../config/logger'];(function(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0x22e0,0x178));var _0x022e=function(_0x1c2c84,_0x508d10){_0x1c2c84=_0x1c2c84-0x0;var _0x4d3105=_0x22e0[_0x1c2c84];return _0x4d3105;};'use strict';var _=require('lodash');var util=require(_0x022e('0x0'));var logger=require(_0x022e('0x1'))('api');var moment=require(_0x022e('0x2'));var BPromise=require(_0x022e('0x3'));var rp=require(_0x022e('0x4'));var fs=require('fs');var path=require(_0x022e('0x5'));var rimraf=require(_0x022e('0x6'));var config=require(_0x022e('0x7'));var attributes=require(_0x022e('0x8'));module[_0x022e('0x9')]=function(_0x4851aa,_0x3c1a1e){return _0x4851aa['define'](_0x022e('0xa'),attributes,{'tableName':_0x022e('0xb'),'paranoid':![],'indexes':[{'name':_0x022e('0xc'),'fields':['mailbox',_0x022e('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5a63=['rimraf','../../config/environment','./voiceMail.attributes','exports','VoiceMail','mailbox_context','context','lodash','util','moment','path'];(function(_0x446879,_0x5220e8){var _0x1f466e=function(_0x2042ca){while(--_0x2042ca){_0x446879['push'](_0x446879['shift']());}};_0x1f466e(++_0x5220e8);}(_0x5a63,0xe3));var _0x35a6=function(_0x396dcb,_0x29c598){_0x396dcb=_0x396dcb-0x0;var _0x373006=_0x5a63[_0x396dcb];return _0x373006;};'use strict';var _=require(_0x35a6('0x0'));var util=require(_0x35a6('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x35a6('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x35a6('0x3'));var rimraf=require(_0x35a6('0x4'));var config=require(_0x35a6('0x5'));var attributes=require(_0x35a6('0x6'));module[_0x35a6('0x7')]=function(_0x489043,_0x25e5a6){return _0x489043['define'](_0x35a6('0x8'),attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':_0x35a6('0x9'),'fields':['mailbox',_0x35a6('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 78461d3..02e3c93 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 _0xbc60=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','jayson/promise','client','request','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch'];(function(_0x139a3c,_0x4fc883){var _0x2b375b=function(_0x525dbf){while(--_0x525dbf){_0x139a3c['push'](_0x139a3c['shift']());}};_0x2b375b(++_0x4fc883);}(_0xbc60,0x1b5));var _0x0bc6=function(_0x39e694,_0x1192c2){_0x39e694=_0x39e694-0x0;var _0x56c35f=_0xbc60[_0x39e694];return _0x56c35f;};'use strict';var _=require(_0x0bc6('0x0'));var util=require(_0x0bc6('0x1'));var moment=require(_0x0bc6('0x2'));var BPromise=require(_0x0bc6('0x3'));var rs=require(_0x0bc6('0x4'));var fs=require('fs');var Redis=require(_0x0bc6('0x5'));var db=require(_0x0bc6('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x0bc6('0x7'));var client=jayson[_0x0bc6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x24eb81,_0x1f8a6c,_0x64163e){return new BPromise(function(_0x538256,_0xd38920){return client[_0x0bc6('0x9')](_0x24eb81,_0x64163e)[_0x0bc6('0xa')](function(_0x53337b){logger[_0x0bc6('0xb')](_0x0bc6('0xc'),_0x1f8a6c,_0x0bc6('0xd'));logger['debug']('VoiceMail,\x20%s,\x20%s,\x20%s',_0x1f8a6c,'request\x20sent',JSON[_0x0bc6('0xe')](_0x53337b));if(_0x53337b['error']){if(_0x53337b['error']['code']===0x1f4){logger['error'](_0x0bc6('0xc'),_0x1f8a6c,_0x53337b[_0x0bc6('0xf')][_0x0bc6('0x10')]);return _0xd38920(_0x53337b[_0x0bc6('0xf')][_0x0bc6('0x10')]);}logger[_0x0bc6('0xf')](_0x0bc6('0xc'),_0x1f8a6c,_0x53337b[_0x0bc6('0xf')][_0x0bc6('0x10')]);return _0x538256(_0x53337b[_0x0bc6('0xf')][_0x0bc6('0x10')]);}else{logger['info'](_0x0bc6('0xc'),_0x1f8a6c,_0x0bc6('0xd'));_0x538256(_0x53337b[_0x0bc6('0x11')]['message']);}})[_0x0bc6('0x12')](function(_0x489ba0){logger[_0x0bc6('0xf')](_0x0bc6('0xc'),_0x1f8a6c,_0x489ba0);_0xd38920(_0x489ba0);});});} \ No newline at end of file +var _0xe249=['info','request\x20sent','debug','stringify','code','error','VoiceMail,\x20%s,\x20%s','message','result','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then'];(function(_0x31bfd6,_0x3ca078){var _0x332588=function(_0x26629c){while(--_0x26629c){_0x31bfd6['push'](_0x31bfd6['shift']());}};_0x332588(++_0x3ca078);}(_0xe249,0xf0));var _0x9e24=function(_0x7df195,_0x8d167b){_0x7df195=_0x7df195-0x0;var _0x187a3c=_0xe249[_0x7df195];return _0x187a3c;};'use strict';var _=require(_0x9e24('0x0'));var util=require(_0x9e24('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9e24('0x2'));var fs=require('fs');var Redis=require(_0x9e24('0x3'));var db=require(_0x9e24('0x4'))['db'];var utils=require(_0x9e24('0x5'));var logger=require(_0x9e24('0x6'))('rpc');var config=require(_0x9e24('0x7'));var jayson=require(_0x9e24('0x8'));var client=jayson[_0x9e24('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1f6b55,_0x3c2b0b,_0x1f477e){return new BPromise(function(_0x1add06,_0x547cb5){return client[_0x9e24('0xa')](_0x1f6b55,_0x1f477e)[_0x9e24('0xb')](function(_0x51403e){logger[_0x9e24('0xc')]('VoiceMail,\x20%s,\x20%s',_0x3c2b0b,_0x9e24('0xd'));logger[_0x9e24('0xe')]('VoiceMail,\x20%s,\x20%s,\x20%s',_0x3c2b0b,'request\x20sent',JSON[_0x9e24('0xf')](_0x51403e));if(_0x51403e['error']){if(_0x51403e['error'][_0x9e24('0x10')]===0x1f4){logger[_0x9e24('0x11')](_0x9e24('0x12'),_0x3c2b0b,_0x51403e[_0x9e24('0x11')][_0x9e24('0x13')]);return _0x547cb5(_0x51403e[_0x9e24('0x11')][_0x9e24('0x13')]);}logger[_0x9e24('0x11')]('VoiceMail,\x20%s,\x20%s',_0x3c2b0b,_0x51403e[_0x9e24('0x11')]['message']);return _0x1add06(_0x51403e[_0x9e24('0x11')]['message']);}else{logger[_0x9e24('0xc')](_0x9e24('0x12'),_0x3c2b0b,'request\x20sent');_0x1add06(_0x51403e[_0x9e24('0x14')][_0x9e24('0x13')]);}})['catch'](function(_0x1700ab){logger['error'](_0x9e24('0x12'),_0x3c2b0b,_0x1700ab);_0x547cb5(_0x1700ab);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 026c076..631faed 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 _0x3ebd=['get','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x420845,_0x3e037b){var _0x4a69bb=function(_0x534144){while(--_0x534144){_0x420845['push'](_0x420845['shift']());}};_0x4a69bb(++_0x3e037b);}(_0x3ebd,0x107));var _0xd3eb=function(_0x54f434,_0x14534e){_0x54f434=_0x54f434-0x0;var _0x5df143=_0x3ebd[_0x54f434];return _0x5df143;};'use strict';var multer=require(_0xd3eb('0x0'));var util=require(_0xd3eb('0x1'));var path=require(_0xd3eb('0x2'));var timeout=require(_0xd3eb('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xd3eb('0x4'));var auth=require(_0xd3eb('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xd3eb('0x6'));var controller=require('./voiceMailMessage.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xd3eb('0x7')](_0xd3eb('0x8'),auth[_0xd3eb('0x9')](),controller[_0xd3eb('0xa')]);router[_0xd3eb('0x7')]('/:id/download',auth[_0xd3eb('0x9')](),controller['download']);router[_0xd3eb('0xb')]('/',auth['isAuthenticated'](),controller[_0xd3eb('0xc')]);router[_0xd3eb('0xd')](_0xd3eb('0x8'),auth[_0xd3eb('0x9')](),controller[_0xd3eb('0xe')]);router[_0xd3eb('0xf')]('/:id',auth[_0xd3eb('0x9')](),controller[_0xd3eb('0x10')]);module[_0xd3eb('0x11')]=router; \ No newline at end of file +var _0xdca2=['Router','fs-extra','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','index','/:id','download','post','create','put','update','delete','destroy','exports','multer','connect-timeout'];(function(_0x2ac229,_0x47655){var _0x1d876f=function(_0xa988b){while(--_0xa988b){_0x2ac229['push'](_0x2ac229['shift']());}};_0x1d876f(++_0x47655);}(_0xdca2,0x10c));var _0x2dca=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0xdca2[_0x3d42d8];return _0x27fc41;};'use strict';var multer=require(_0x2dca('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x2dca('0x1'));var express=require('express');var router=express[_0x2dca('0x2')]();var fs_extra=require(_0x2dca('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2dca('0x4'));var controller=require(_0x2dca('0x5'));router[_0x2dca('0x6')]('/',auth[_0x2dca('0x7')](),controller[_0x2dca('0x8')]);router[_0x2dca('0x6')](_0x2dca('0x9'),auth[_0x2dca('0x7')](),controller['show']);router[_0x2dca('0x6')]('/:id/download',auth['isAuthenticated'](),controller[_0x2dca('0xa')]);router[_0x2dca('0xb')]('/',auth[_0x2dca('0x7')](),controller[_0x2dca('0xc')]);router[_0x2dca('0xd')](_0x2dca('0x9'),auth['isAuthenticated'](),controller[_0x2dca('0xe')]);router[_0x2dca('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x2dca('0x10')]);module[_0x2dca('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index c8e46e6..3aa3621 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 _0x12c0=['exports','VIRTUAL','STRING','BLOB','long','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize'];(function(_0x40221e,_0x1a8b60){var _0x46fa3a=function(_0x59f108){while(--_0x59f108){_0x40221e['push'](_0x40221e['shift']());}};_0x46fa3a(++_0x1a8b60);}(_0x12c0,0x1ee));var _0x012c=function(_0x4f22ff,_0x961200){_0x4f22ff=_0x4f22ff-0x0;var _0x1add2d=_0x12c0[_0x4f22ff];return _0x1add2d;};'use strict';var Sequelize=require(_0x012c('0x0'));module[_0x012c('0x1')]={'name':{'type':Sequelize[_0x012c('0x2')],'get':function(_0x39d095){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x012c('0x3')],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x012c('0x3')],'defaultValue':''},'callerid':{'type':Sequelize[_0x012c('0x3')],'defaultValue':''},'origtime':{'type':Sequelize[_0x012c('0x3')],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x012c('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x012c('0x3')],'defaultValue':''},'recording':{'type':Sequelize[_0x012c('0x4')](_0x012c('0x5')),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize[_0x012c('0x3')],'defaultValue':''},'stamp':{'type':_0x012c('0x6'),'defaultValue':Sequelize[_0x012c('0x7')](_0x012c('0x8'))}}; \ No newline at end of file +var _0x8745=['BLOB','long','TIMESTAMP','literal','sequelize','exports','getDataValue','INTEGER','STRING'];(function(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0x8745,0x1e1));var _0x5874=function(_0x3c3f04,_0x3b2ad2){_0x3c3f04=_0x3c3f04-0x0;var _0x2c6f83=_0x8745[_0x3c3f04];return _0x2c6f83;};'use strict';var Sequelize=require(_0x5874('0x0'));module[_0x5874('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x2ed84c){return this[_0x5874('0x2')]('id');}},'msgnum':{'type':Sequelize[_0x5874('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x5874('0x4')],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x5874('0x4')],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize[_0x5874('0x4')],'defaultValue':''},'duration':{'type':Sequelize[_0x5874('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x5874('0x4')],'defaultValue':''},'recording':{'type':Sequelize[_0x5874('0x5')](_0x5874('0x6')),'defaultValue':null},'flag':{'type':Sequelize[_0x5874('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x5874('0x4')],'defaultValue':''},'stamp':{'type':_0x5874('0x7'),'defaultValue':Sequelize[_0x5874('0x8')]('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 9f45ee5..f4242db 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 _0xacf8=['Content-Range','apply','reject','update','then','destroy','end','stack','send','map','rawAttributes','fieldName','type','key','differenceBy','name','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','includeAll','VoiceMailMessage','findAll','rows','catch','show','include','options','find','create','body','download','params','msg_id','recording','ValidationError','VoiceMailMessage\x20not\x20found','attachment','Content-Disposition','attachment;\x20filename=\x22','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set'];(function(_0x4bb66f,_0x3cd682){var _0xf2772f=function(_0x2e3698){while(--_0x2e3698){_0x4bb66f['push'](_0x4bb66f['shift']());}};_0xf2772f(++_0x3cd682);}(_0xacf8,0x180));var _0x8acf=function(_0x45c61e,_0x59694d){_0x45c61e=_0x45c61e-0x0;var _0x19033c=_0xacf8[_0x45c61e];return _0x19033c;};'use strict';var emlformat=require(_0x8acf('0x0'));var rimraf=require(_0x8acf('0x1'));var zipdir=require(_0x8acf('0x2'));var jsonpatch=require(_0x8acf('0x3'));var rp=require('request-promise');var moment=require(_0x8acf('0x4'));var BPromise=require(_0x8acf('0x5'));var Mustache=require(_0x8acf('0x6'));var util=require(_0x8acf('0x7'));var path=require(_0x8acf('0x8'));var sox=require('sox');var csv=require(_0x8acf('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8acf('0xa'));var _=require('lodash');var squel=require(_0x8acf('0xb'));var crypto=require(_0x8acf('0xc'));var jsforce=require(_0x8acf('0xd'));var deskjs=require(_0x8acf('0xe'));var toCsv=require(_0x8acf('0x9'));var querystring=require(_0x8acf('0xf'));var Papa=require('papaparse');var Redis=require(_0x8acf('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8acf('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8acf('0x12'));var utils=require(_0x8acf('0x13'));var config=require(_0x8acf('0x14'));var licenseUtil=require(_0x8acf('0x15'));var db=require(_0x8acf('0x16'))['db'];function respondWithStatusCode(_0x1e92ce,_0x2d6175){_0x2d6175=_0x2d6175||0xcc;return function(_0x23bbc2){if(_0x23bbc2){return _0x1e92ce[_0x8acf('0x17')](_0x2d6175);}return _0x1e92ce[_0x8acf('0x18')](_0x2d6175)['end']();};}function respondWithResult(_0x2f496b,_0x34d808){_0x34d808=_0x34d808||0xc8;return function(_0x21d2b4){if(_0x21d2b4){return _0x2f496b[_0x8acf('0x18')](_0x34d808)[_0x8acf('0x19')](_0x21d2b4);}};}function respondWithFilteredResult(_0x206763,_0xd6a263){return function(_0x291b5b){if(_0x291b5b){var _0x47b568=typeof _0xd6a263[_0x8acf('0x1a')]===_0x8acf('0x1b')&&typeof _0xd6a263[_0x8acf('0x1c')]===_0x8acf('0x1b');var _0x26c50f=_0x291b5b['count'];var _0x306a81=_0x47b568?0x0:_0xd6a263['offset'];var _0x3bcb30=_0x47b568?_0x291b5b[_0x8acf('0x1d')]:_0xd6a263['offset']+_0xd6a263[_0x8acf('0x1c')];var _0x5212f3;if(_0x3bcb30>=_0x26c50f){_0x3bcb30=_0x26c50f;_0x5212f3=0xc8;}else{_0x5212f3=0xce;}_0x206763[_0x8acf('0x18')](_0x5212f3);return _0x206763[_0x8acf('0x1e')](_0x8acf('0x1f'),_0x306a81+'-'+_0x3bcb30+'/'+_0x26c50f)[_0x8acf('0x19')](_0x291b5b);}return null;};}function patchUpdates(_0x5b7d77){return function(_0x573b90){try{jsonpatch[_0x8acf('0x20')](_0x573b90,_0x5b7d77,!![]);}catch(_0x401ead){return BPromise[_0x8acf('0x21')](_0x401ead);}return _0x573b90['save']();};}function saveUpdates(_0x49582e,_0x1f8d9e){return function(_0x3af0f0){if(_0x3af0f0){return _0x3af0f0[_0x8acf('0x22')](_0x49582e)[_0x8acf('0x23')](function(_0x242229){return _0x242229;});}return null;};}function removeEntity(_0x23bc94,_0x547e5b){return function(_0x131a6b){if(_0x131a6b){return _0x131a6b[_0x8acf('0x24')]()[_0x8acf('0x23')](function(){_0x23bc94[_0x8acf('0x18')](0xcc)[_0x8acf('0x25')]();});}};}function handleEntityNotFound(_0x359bc1,_0x46b644){return function(_0x1ecbe2){if(!_0x1ecbe2){_0x359bc1[_0x8acf('0x17')](0x194);}return _0x1ecbe2;};}function handleError(_0x4997fb,_0x233a32){_0x233a32=_0x233a32||0x1f4;return function(_0x168e9d){logger['error'](_0x168e9d[_0x8acf('0x26')]);if(_0x168e9d['name']){delete _0x168e9d['name'];}_0x4997fb[_0x8acf('0x18')](_0x233a32)[_0x8acf('0x27')](_0x168e9d);};}exports['index']=function(_0xa03505,_0x3de581){var _0x1dec44={},_0x37a57d={},_0x4f721e={'count':0x0,'rows':[]};var _0xea65b7=_[_0x8acf('0x28')](db['VoiceMailMessage'][_0x8acf('0x29')],function(_0x497cfc){return{'name':_0x497cfc[_0x8acf('0x2a')],'type':_0x497cfc[_0x8acf('0x2b')][_0x8acf('0x2c')]};});_0x37a57d['model']=_[_0x8acf('0x2d')](_[_0x8acf('0x28')](_0xea65b7,'name'),[_0x8acf('0x2e')]);_0x37a57d['query']=_[_0x8acf('0x2f')](_0xa03505[_0x8acf('0x30')]);_0x37a57d[_0x8acf('0x31')]=_[_0x8acf('0x32')](_0x37a57d[_0x8acf('0x33')],_0x37a57d[_0x8acf('0x30')]);_0x1dec44['attributes']=_['intersection'](_0x37a57d['model'],qs[_0x8acf('0x34')](_0xa03505[_0x8acf('0x30')][_0x8acf('0x34')]));_0x1dec44[_0x8acf('0x35')]=_0x1dec44[_0x8acf('0x35')][_0x8acf('0x36')]?_0x1dec44[_0x8acf('0x35')]:_0x37a57d[_0x8acf('0x33')];if(!_0xa03505[_0x8acf('0x30')][_0x8acf('0x37')](_0x8acf('0x38'))){_0x1dec44[_0x8acf('0x1c')]=qs[_0x8acf('0x1c')](_0xa03505[_0x8acf('0x30')][_0x8acf('0x1c')]);_0x1dec44[_0x8acf('0x1a')]=qs['offset'](_0xa03505['query']['offset']);}_0x1dec44['order']=qs['sort'](_0xa03505[_0x8acf('0x30')][_0x8acf('0x39')]);_0x1dec44[_0x8acf('0x3a')]=qs[_0x8acf('0x31')](_[_0x8acf('0x3b')](_0xa03505[_0x8acf('0x30')],_0x37a57d[_0x8acf('0x31')]),_0xea65b7);if(_0xa03505[_0x8acf('0x30')]['filter']){_0x1dec44[_0x8acf('0x3a')]=_[_0x8acf('0x3c')](_0x1dec44['where'],{'$or':_[_0x8acf('0x28')](_0xea65b7,function(_0x20ae3c){if(_0x20ae3c[_0x8acf('0x2b')]!==_0x8acf('0x3d')){var _0x5615e4={};_0x5615e4[_0x20ae3c[_0x8acf('0x2e')]]={'$like':'%'+_0xa03505[_0x8acf('0x30')][_0x8acf('0x3e')]+'%'};return _0x5615e4;}})});}_0x1dec44=_[_0x8acf('0x3c')]({},_0x1dec44,_0xa03505['options']);var _0x2ec46c={'where':_0x1dec44[_0x8acf('0x3a')]};return db['VoiceMailMessage'][_0x8acf('0x1d')](_0x2ec46c)[_0x8acf('0x23')](function(_0x253473){_0x4f721e[_0x8acf('0x1d')]=_0x253473;if(_0xa03505[_0x8acf('0x30')][_0x8acf('0x3f')]){_0x1dec44['include']=[{'all':!![]}];}return db[_0x8acf('0x40')][_0x8acf('0x41')](_0x1dec44);})[_0x8acf('0x23')](function(_0x1f09bc){_0x4f721e[_0x8acf('0x42')]=_0x1f09bc;return _0x4f721e;})[_0x8acf('0x23')](respondWithFilteredResult(_0x3de581,_0x1dec44))[_0x8acf('0x43')](handleError(_0x3de581,null));};exports[_0x8acf('0x44')]=function(_0x378a8f,_0x2e0c7d){var _0x539210={'raw':!![],'where':{'id':_0x378a8f['params']['id']}},_0xe35f9b={};_0xe35f9b[_0x8acf('0x33')]=_['keys'](db['VoiceMailMessage'][_0x8acf('0x29')]);_0xe35f9b['query']=_[_0x8acf('0x2f')](_0x378a8f[_0x8acf('0x30')]);_0xe35f9b[_0x8acf('0x31')]=_[_0x8acf('0x32')](_0xe35f9b[_0x8acf('0x33')],_0xe35f9b[_0x8acf('0x30')]);_0x539210[_0x8acf('0x35')]=_['intersection'](_0xe35f9b['model'],qs['fields'](_0x378a8f['query'][_0x8acf('0x34')]));_0x539210[_0x8acf('0x35')]=_0x539210['attributes'][_0x8acf('0x36')]?_0x539210[_0x8acf('0x35')]:_0xe35f9b['model'];if(_0x378a8f[_0x8acf('0x30')][_0x8acf('0x3f')]){_0x539210[_0x8acf('0x45')]=[{'all':!![]}];}_0x539210=_[_0x8acf('0x3c')]({},_0x539210,_0x378a8f[_0x8acf('0x46')]);return db[_0x8acf('0x40')][_0x8acf('0x47')](_0x539210)['then'](handleEntityNotFound(_0x2e0c7d,null))[_0x8acf('0x23')](respondWithResult(_0x2e0c7d,null))['catch'](handleError(_0x2e0c7d,null));};exports[_0x8acf('0x48')]=function(_0x5de8a2,_0x56803d){return db['VoiceMailMessage'][_0x8acf('0x48')](_0x5de8a2['body'],{})[_0x8acf('0x23')](respondWithResult(_0x56803d,0xc9))['catch'](handleError(_0x56803d,null));};exports[_0x8acf('0x22')]=function(_0x3e6125,_0x50b21b){if(_0x3e6125[_0x8acf('0x49')]['id']){delete _0x3e6125[_0x8acf('0x49')]['id'];}return db[_0x8acf('0x40')][_0x8acf('0x47')]({'where':{'id':_0x3e6125['params']['id']}})[_0x8acf('0x23')](handleEntityNotFound(_0x50b21b,null))[_0x8acf('0x23')](saveUpdates(_0x3e6125[_0x8acf('0x49')],null))[_0x8acf('0x23')](respondWithResult(_0x50b21b,null))[_0x8acf('0x43')](handleError(_0x50b21b,null));};exports['destroy']=function(_0x33d656,_0x128a19){return db[_0x8acf('0x40')][_0x8acf('0x47')]({'where':{'id':_0x33d656['params']['id']}})[_0x8acf('0x23')](handleEntityNotFound(_0x128a19,null))[_0x8acf('0x23')](removeEntity(_0x128a19,null))[_0x8acf('0x43')](handleError(_0x128a19,null));};exports[_0x8acf('0x4a')]=function(_0x3aa551,_0x4e3cd0,_0x464ef5){return db[_0x8acf('0x40')]['find']({'where':{'id':_0x3aa551[_0x8acf('0x4b')]['id']},'attributes':['id','recording',_0x8acf('0x4c')]})['then'](handleEntityNotFound(_0x4e3cd0,null))[_0x8acf('0x23')](function(_0x25a627){if(_0x25a627){if(!_0x25a627[_0x8acf('0x4d')]){throw new db['Sequelize'][(_0x8acf('0x4e'))](_0x8acf('0x4f'));}var _0x52e521={'Content-Type':'audio/wav','Content-Disposition':_0x8acf('0x50')};if(_0x25a627['msg_id']){_0x52e521[_0x8acf('0x51')]=_0x8acf('0x52')+_0x25a627[_0x8acf('0x4c')]+'.wav\x22';}_0x4e3cd0[_0x8acf('0x1e')](_0x52e521);return _0x4e3cd0[_0x8acf('0x27')](new Buffer(_0x25a627[_0x8acf('0x4d')]));}})[_0x8acf('0x43')](handleError(_0x4e3cd0,null));}; \ No newline at end of file +var _0xa2a5=['index','map','VoiceMailMessage','rawAttributes','fieldName','type','key','model','differenceBy','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','show','params','find','catch','body','download','recording','ValidationError','VoiceMailMessage\x20not\x20found','Content-Disposition','msg_id','send','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','limit','undefined','set','Content-Range','apply','update','then','end','sendStatus','stack','name'];(function(_0x1b4695,_0x3a90e3){var _0x376a90=function(_0x13811c){while(--_0x13811c){_0x1b4695['push'](_0x1b4695['shift']());}};_0x376a90(++_0x3a90e3);}(_0xa2a5,0x177));var _0x5a2a=function(_0x3e169f,_0x33dbfd){_0x3e169f=_0x3e169f-0x0;var _0x435e9d=_0xa2a5[_0x3e169f];return _0x435e9d;};'use strict';var emlformat=require(_0x5a2a('0x0'));var rimraf=require(_0x5a2a('0x1'));var zipdir=require(_0x5a2a('0x2'));var jsonpatch=require(_0x5a2a('0x3'));var rp=require(_0x5a2a('0x4'));var moment=require('moment');var BPromise=require(_0x5a2a('0x5'));var Mustache=require(_0x5a2a('0x6'));var util=require(_0x5a2a('0x7'));var path=require('path');var sox=require(_0x5a2a('0x8'));var csv=require(_0x5a2a('0x9'));var ejs=require(_0x5a2a('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5a2a('0xb'));var squel=require(_0x5a2a('0xc'));var crypto=require(_0x5a2a('0xd'));var jsforce=require(_0x5a2a('0xe'));var deskjs=require(_0x5a2a('0xf'));var toCsv=require(_0x5a2a('0x9'));var querystring=require(_0x5a2a('0x10'));var Papa=require(_0x5a2a('0x11'));var Redis=require(_0x5a2a('0x12'));var authService=require(_0x5a2a('0x13'));var qs=require(_0x5a2a('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5a2a('0x15'))(_0x5a2a('0x16'));var utils=require(_0x5a2a('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x5a2a('0x18'));var db=require(_0x5a2a('0x19'))['db'];function respondWithStatusCode(_0x4f50be,_0x2e37f4){_0x2e37f4=_0x2e37f4||0xcc;return function(_0x4560a6){if(_0x4560a6){return _0x4f50be['sendStatus'](_0x2e37f4);}return _0x4f50be[_0x5a2a('0x1a')](_0x2e37f4)['end']();};}function respondWithResult(_0x4589f3,_0x3ef03f){_0x3ef03f=_0x3ef03f||0xc8;return function(_0x323301){if(_0x323301){return _0x4589f3[_0x5a2a('0x1a')](_0x3ef03f)[_0x5a2a('0x1b')](_0x323301);}};}function respondWithFilteredResult(_0x163f49,_0x27710c){return function(_0x3873ea){if(_0x3873ea){var _0x2afd3b=typeof _0x27710c[_0x5a2a('0x1c')]==='undefined'&&typeof _0x27710c[_0x5a2a('0x1d')]===_0x5a2a('0x1e');var _0x25e843=_0x3873ea['count'];var _0x44755f=_0x2afd3b?0x0:_0x27710c['offset'];var _0x319f60=_0x2afd3b?_0x3873ea['count']:_0x27710c['offset']+_0x27710c[_0x5a2a('0x1d')];var _0xa77913;if(_0x319f60>=_0x25e843){_0x319f60=_0x25e843;_0xa77913=0xc8;}else{_0xa77913=0xce;}_0x163f49[_0x5a2a('0x1a')](_0xa77913);return _0x163f49[_0x5a2a('0x1f')](_0x5a2a('0x20'),_0x44755f+'-'+_0x319f60+'/'+_0x25e843)['json'](_0x3873ea);}return null;};}function patchUpdates(_0x3a9682){return function(_0x588520){try{jsonpatch[_0x5a2a('0x21')](_0x588520,_0x3a9682,!![]);}catch(_0xa3c968){return BPromise['reject'](_0xa3c968);}return _0x588520['save']();};}function saveUpdates(_0x346bc0,_0x50b88b){return function(_0x24937c){if(_0x24937c){return _0x24937c[_0x5a2a('0x22')](_0x346bc0)['then'](function(_0x4ffbe3){return _0x4ffbe3;});}return null;};}function removeEntity(_0x2aadd1,_0x41aaf3){return function(_0x3d39f5){if(_0x3d39f5){return _0x3d39f5['destroy']()[_0x5a2a('0x23')](function(){_0x2aadd1['status'](0xcc)[_0x5a2a('0x24')]();});}};}function handleEntityNotFound(_0x3a97cb,_0x2a24aa){return function(_0x2649f2){if(!_0x2649f2){_0x3a97cb[_0x5a2a('0x25')](0x194);}return _0x2649f2;};}function handleError(_0x4ec277,_0x46564c){_0x46564c=_0x46564c||0x1f4;return function(_0x50ba92){logger['error'](_0x50ba92[_0x5a2a('0x26')]);if(_0x50ba92[_0x5a2a('0x27')]){delete _0x50ba92[_0x5a2a('0x27')];}_0x4ec277[_0x5a2a('0x1a')](_0x46564c)['send'](_0x50ba92);};}exports[_0x5a2a('0x28')]=function(_0xd54fce,_0x33ceeb){var _0x3286a3={},_0x10d12f={},_0x5e99a2={'count':0x0,'rows':[]};var _0x54fed8=_[_0x5a2a('0x29')](db[_0x5a2a('0x2a')][_0x5a2a('0x2b')],function(_0x78156e){return{'name':_0x78156e[_0x5a2a('0x2c')],'type':_0x78156e[_0x5a2a('0x2d')][_0x5a2a('0x2e')]};});_0x10d12f[_0x5a2a('0x2f')]=_[_0x5a2a('0x30')](_[_0x5a2a('0x29')](_0x54fed8,_0x5a2a('0x27')),['name']);_0x10d12f[_0x5a2a('0x31')]=_[_0x5a2a('0x32')](_0xd54fce[_0x5a2a('0x31')]);_0x10d12f[_0x5a2a('0x33')]=_[_0x5a2a('0x34')](_0x10d12f['model'],_0x10d12f['query']);_0x3286a3[_0x5a2a('0x35')]=_['intersection'](_0x10d12f[_0x5a2a('0x2f')],qs[_0x5a2a('0x36')](_0xd54fce[_0x5a2a('0x31')][_0x5a2a('0x36')]));_0x3286a3[_0x5a2a('0x35')]=_0x3286a3[_0x5a2a('0x35')][_0x5a2a('0x37')]?_0x3286a3['attributes']:_0x10d12f['model'];if(!_0xd54fce[_0x5a2a('0x31')][_0x5a2a('0x38')](_0x5a2a('0x39'))){_0x3286a3[_0x5a2a('0x1d')]=qs[_0x5a2a('0x1d')](_0xd54fce[_0x5a2a('0x31')][_0x5a2a('0x1d')]);_0x3286a3[_0x5a2a('0x1c')]=qs['offset'](_0xd54fce[_0x5a2a('0x31')]['offset']);}_0x3286a3[_0x5a2a('0x3a')]=qs[_0x5a2a('0x3b')](_0xd54fce[_0x5a2a('0x31')][_0x5a2a('0x3b')]);_0x3286a3[_0x5a2a('0x3c')]=qs['filters'](_[_0x5a2a('0x3d')](_0xd54fce[_0x5a2a('0x31')],_0x10d12f[_0x5a2a('0x33')]),_0x54fed8);if(_0xd54fce['query'][_0x5a2a('0x3e')]){_0x3286a3[_0x5a2a('0x3c')]=_[_0x5a2a('0x3f')](_0x3286a3[_0x5a2a('0x3c')],{'$or':_['map'](_0x54fed8,function(_0x28d57b){if(_0x28d57b[_0x5a2a('0x2d')]!==_0x5a2a('0x40')){var _0x5497bc={};_0x5497bc[_0x28d57b[_0x5a2a('0x27')]]={'$like':'%'+_0xd54fce[_0x5a2a('0x31')][_0x5a2a('0x3e')]+'%'};return _0x5497bc;}})});}_0x3286a3=_[_0x5a2a('0x3f')]({},_0x3286a3,_0xd54fce[_0x5a2a('0x41')]);var _0x101d1b={'where':_0x3286a3[_0x5a2a('0x3c')]};return db[_0x5a2a('0x2a')][_0x5a2a('0x42')](_0x101d1b)[_0x5a2a('0x23')](function(_0x3c3b77){_0x5e99a2[_0x5a2a('0x42')]=_0x3c3b77;if(_0xd54fce[_0x5a2a('0x31')][_0x5a2a('0x43')]){_0x3286a3[_0x5a2a('0x44')]=[{'all':!![]}];}return db[_0x5a2a('0x2a')][_0x5a2a('0x45')](_0x3286a3);})['then'](function(_0x164245){_0x5e99a2[_0x5a2a('0x46')]=_0x164245;return _0x5e99a2;})[_0x5a2a('0x23')](respondWithFilteredResult(_0x33ceeb,_0x3286a3))['catch'](handleError(_0x33ceeb,null));};exports[_0x5a2a('0x47')]=function(_0x3a2f07,_0x3a4f0d){var _0x97ce54={'raw':!![],'where':{'id':_0x3a2f07[_0x5a2a('0x48')]['id']}},_0x52ad58={};_0x52ad58[_0x5a2a('0x2f')]=_[_0x5a2a('0x32')](db['VoiceMailMessage'][_0x5a2a('0x2b')]);_0x52ad58[_0x5a2a('0x31')]=_[_0x5a2a('0x32')](_0x3a2f07['query']);_0x52ad58[_0x5a2a('0x33')]=_[_0x5a2a('0x34')](_0x52ad58[_0x5a2a('0x2f')],_0x52ad58[_0x5a2a('0x31')]);_0x97ce54[_0x5a2a('0x35')]=_['intersection'](_0x52ad58[_0x5a2a('0x2f')],qs[_0x5a2a('0x36')](_0x3a2f07[_0x5a2a('0x31')][_0x5a2a('0x36')]));_0x97ce54[_0x5a2a('0x35')]=_0x97ce54['attributes'][_0x5a2a('0x37')]?_0x97ce54[_0x5a2a('0x35')]:_0x52ad58[_0x5a2a('0x2f')];if(_0x3a2f07[_0x5a2a('0x31')][_0x5a2a('0x43')]){_0x97ce54['include']=[{'all':!![]}];}_0x97ce54=_[_0x5a2a('0x3f')]({},_0x97ce54,_0x3a2f07[_0x5a2a('0x41')]);return db[_0x5a2a('0x2a')][_0x5a2a('0x49')](_0x97ce54)[_0x5a2a('0x23')](handleEntityNotFound(_0x3a4f0d,null))[_0x5a2a('0x23')](respondWithResult(_0x3a4f0d,null))[_0x5a2a('0x4a')](handleError(_0x3a4f0d,null));};exports['create']=function(_0x51729c,_0x4674f5){return db[_0x5a2a('0x2a')]['create'](_0x51729c['body'],{})[_0x5a2a('0x23')](respondWithResult(_0x4674f5,0xc9))['catch'](handleError(_0x4674f5,null));};exports['update']=function(_0x145b07,_0x16bf6c){if(_0x145b07[_0x5a2a('0x4b')]['id']){delete _0x145b07[_0x5a2a('0x4b')]['id'];}return db['VoiceMailMessage'][_0x5a2a('0x49')]({'where':{'id':_0x145b07[_0x5a2a('0x48')]['id']}})[_0x5a2a('0x23')](handleEntityNotFound(_0x16bf6c,null))[_0x5a2a('0x23')](saveUpdates(_0x145b07[_0x5a2a('0x4b')],null))[_0x5a2a('0x23')](respondWithResult(_0x16bf6c,null))['catch'](handleError(_0x16bf6c,null));};exports['destroy']=function(_0x1d6ff0,_0x10e4e3){return db[_0x5a2a('0x2a')]['find']({'where':{'id':_0x1d6ff0[_0x5a2a('0x48')]['id']}})[_0x5a2a('0x23')](handleEntityNotFound(_0x10e4e3,null))[_0x5a2a('0x23')](removeEntity(_0x10e4e3,null))[_0x5a2a('0x4a')](handleError(_0x10e4e3,null));};exports[_0x5a2a('0x4c')]=function(_0x67db38,_0x509bf0,_0x1148c6){return db['VoiceMailMessage'][_0x5a2a('0x49')]({'where':{'id':_0x67db38[_0x5a2a('0x48')]['id']},'attributes':['id',_0x5a2a('0x4d'),'msg_id']})[_0x5a2a('0x23')](handleEntityNotFound(_0x509bf0,null))[_0x5a2a('0x23')](function(_0x3055f3){if(_0x3055f3){if(!_0x3055f3[_0x5a2a('0x4d')]){throw new db['Sequelize'][(_0x5a2a('0x4e'))](_0x5a2a('0x4f'));}var _0x2185d0={'Content-Type':'audio/wav','Content-Disposition':'attachment'};if(_0x3055f3['msg_id']){_0x2185d0[_0x5a2a('0x50')]='attachment;\x20filename=\x22'+_0x3055f3[_0x5a2a('0x51')]+'.wav\x22';}_0x509bf0[_0x5a2a('0x1f')](_0x2185d0);return _0x509bf0[_0x5a2a('0x52')](new Buffer(_0x3055f3[_0x5a2a('0x4d')]));}})[_0x5a2a('0x4a')](handleError(_0x509bf0,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index f39b944..10ac878 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 _0x0e6d=['define','VoiceMailMessage','voice_voicemail_messages','dir','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./voiceMailMessage.attributes','exports'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x0e6d,0x100));var _0xd0e6=function(_0x115b95,_0xa1f8b9){_0x115b95=_0x115b95-0x0;var _0x460b3d=_0x0e6d[_0x115b95];return _0x460b3d;};'use strict';var _=require(_0xd0e6('0x0'));var util=require(_0xd0e6('0x1'));var logger=require(_0xd0e6('0x2'))(_0xd0e6('0x3'));var moment=require(_0xd0e6('0x4'));var BPromise=require(_0xd0e6('0x5'));var rp=require(_0xd0e6('0x6'));var fs=require('fs');var path=require(_0xd0e6('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd0e6('0x8'));module[_0xd0e6('0x9')]=function(_0x19b6c6,_0x520cb9){return _0x19b6c6[_0xd0e6('0xa')](_0xd0e6('0xb'),attributes,{'tableName':_0xd0e6('0xc'),'paranoid':![],'indexes':[{'name':'dir','fields':[_0xd0e6('0xd')]}],'timestamps':![]});}; \ No newline at end of file +var _0x6642=['voice_voicemail_messages','dir','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./voiceMailMessage.attributes','exports','define','VoiceMailMessage'];(function(_0x43ab62,_0x125844){var _0x307e31=function(_0x52ce34){while(--_0x52ce34){_0x43ab62['push'](_0x43ab62['shift']());}};_0x307e31(++_0x125844);}(_0x6642,0x1c2));var _0x2664=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6642[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2664('0x0'));var util=require(_0x2664('0x1'));var logger=require(_0x2664('0x2'))(_0x2664('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2664('0x4'));var fs=require('fs');var path=require(_0x2664('0x5'));var rimraf=require(_0x2664('0x6'));var config=require(_0x2664('0x7'));var attributes=require(_0x2664('0x8'));module[_0x2664('0x9')]=function(_0x304dbf,_0x563b68){return _0x304dbf[_0x2664('0xa')](_0x2664('0xb'),attributes,{'tableName':_0x2664('0xc'),'paranoid':![],'indexes':[{'name':_0x2664('0xd'),'fields':[_0x2664('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 944add7..dbcbbac 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 _0x65f9=['VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent'];(function(_0x26c6c4,_0x12bdab){var _0x1ff6de=function(_0xd7f08a){while(--_0xd7f08a){_0x26c6c4['push'](_0x26c6c4['shift']());}};_0x1ff6de(++_0x12bdab);}(_0x65f9,0x131));var _0x965f=function(_0x14edd3,_0x3ac403){_0x14edd3=_0x14edd3-0x0;var _0x440f07=_0x65f9[_0x14edd3];return _0x440f07;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x965f('0x0'));var BPromise=require('bluebird');var rs=require(_0x965f('0x1'));var fs=require('fs');var Redis=require(_0x965f('0x2'));var db=require(_0x965f('0x3'))['db'];var utils=require(_0x965f('0x4'));var logger=require(_0x965f('0x5'))(_0x965f('0x6'));var config=require(_0x965f('0x7'));var jayson=require(_0x965f('0x8'));var client=jayson[_0x965f('0x9')][_0x965f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x32e099,_0x23eaba,_0x218a21){return new BPromise(function(_0x629282,_0x503e7b){return client[_0x965f('0xb')](_0x32e099,_0x218a21)['then'](function(_0xf1028a){logger[_0x965f('0xc')](_0x965f('0xd'),_0x23eaba,_0x965f('0xe'));logger['debug'](_0x965f('0xf'),_0x23eaba,_0x965f('0xe'),JSON[_0x965f('0x10')](_0xf1028a));if(_0xf1028a[_0x965f('0x11')]){if(_0xf1028a[_0x965f('0x11')]['code']===0x1f4){logger[_0x965f('0x11')]('VoiceMailMessage,\x20%s,\x20%s',_0x23eaba,_0xf1028a['error'][_0x965f('0x12')]);return _0x503e7b(_0xf1028a['error'][_0x965f('0x12')]);}logger[_0x965f('0x11')](_0x965f('0xd'),_0x23eaba,_0xf1028a[_0x965f('0x11')][_0x965f('0x12')]);return _0x629282(_0xf1028a['error'][_0x965f('0x12')]);}else{logger[_0x965f('0xc')](_0x965f('0xd'),_0x23eaba,'request\x20sent');_0x629282(_0xf1028a['result']['message']);}})[_0x965f('0x13')](function(_0x2ecea2){logger[_0x965f('0x11')]('VoiceMailMessage,\x20%s,\x20%s',_0x23eaba,_0x2ecea2);_0x503e7b(_0x2ecea2);});});} \ No newline at end of file +var _0x5e14=['then','VoiceMailMessage,\x20%s,\x20%s','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request'];(function(_0x138cc1,_0x54f6c6){var _0x3490d7=function(_0x33e56b){while(--_0x33e56b){_0x138cc1['push'](_0x138cc1['shift']());}};_0x3490d7(++_0x54f6c6);}(_0x5e14,0x199));var _0x45e1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5e14[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x45e1('0x0'));var util=require(_0x45e1('0x1'));var moment=require('moment');var BPromise=require(_0x45e1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x45e1('0x3'));var db=require(_0x45e1('0x4'))['db'];var utils=require(_0x45e1('0x5'));var logger=require('../../config/logger')(_0x45e1('0x6'));var config=require(_0x45e1('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x45e1('0x8')][_0x45e1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x49a17a,_0x5504a1,_0x215229){return new BPromise(function(_0x4a09c8,_0x51c80a){return client[_0x45e1('0xa')](_0x49a17a,_0x215229)[_0x45e1('0xb')](function(_0x44f551){logger['info'](_0x45e1('0xc'),_0x5504a1,'request\x20sent');logger[_0x45e1('0xd')](_0x45e1('0xe'),_0x5504a1,_0x45e1('0xf'),JSON[_0x45e1('0x10')](_0x44f551));if(_0x44f551['error']){if(_0x44f551[_0x45e1('0x11')][_0x45e1('0x12')]===0x1f4){logger[_0x45e1('0x11')](_0x45e1('0xc'),_0x5504a1,_0x44f551['error']['message']);return _0x51c80a(_0x44f551['error'][_0x45e1('0x13')]);}logger[_0x45e1('0x11')](_0x45e1('0xc'),_0x5504a1,_0x44f551[_0x45e1('0x11')]['message']);return _0x4a09c8(_0x44f551[_0x45e1('0x11')][_0x45e1('0x13')]);}else{logger['info']('VoiceMailMessage,\x20%s,\x20%s',_0x5504a1,_0x45e1('0xf'));_0x4a09c8(_0x44f551['result'][_0x45e1('0x13')]);}})[_0x45e1('0x14')](function(_0x5ac0d2){logger[_0x45e1('0x11')](_0x45e1('0xc'),_0x5504a1,_0x5ac0d2);_0x51c80a(_0x5ac0d2);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 0887567..6d32247 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 _0xf140=['isAuthenticated','/:id','show','getSounds','post','create','/:id/sounds','addSound','put','update','delete','destroy','/:id/sounds/:id2','removeSound','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','./voiceMusicOnHold.controller','get'];(function(_0xd19c12,_0xcd273b){var _0x1f64dd=function(_0x4ca44b){while(--_0x4ca44b){_0xd19c12['push'](_0xd19c12['shift']());}};_0x1f64dd(++_0xcd273b);}(_0xf140,0xcf));var _0x0f14=function(_0x1e5ad0,_0x58ffe3){_0x1e5ad0=_0x1e5ad0-0x0;var _0x46da3b=_0xf140[_0x1e5ad0];return _0x46da3b;};'use strict';var multer=require(_0x0f14('0x0'));var util=require(_0x0f14('0x1'));var path=require(_0x0f14('0x2'));var timeout=require(_0x0f14('0x3'));var express=require('express');var router=express[_0x0f14('0x4')]();var fs_extra=require(_0x0f14('0x5'));var auth=require(_0x0f14('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x0f14('0x7'));router[_0x0f14('0x8')]('/',auth[_0x0f14('0x9')](),controller['index']);router['get'](_0x0f14('0xa'),auth[_0x0f14('0x9')](),controller[_0x0f14('0xb')]);router[_0x0f14('0x8')]('/:id/sounds',auth[_0x0f14('0x9')](),controller[_0x0f14('0xc')]);router[_0x0f14('0xd')]('/',auth[_0x0f14('0x9')](),controller[_0x0f14('0xe')]);router[_0x0f14('0xd')](_0x0f14('0xf'),auth[_0x0f14('0x9')](),controller[_0x0f14('0x10')]);router[_0x0f14('0x11')]('/:id',auth[_0x0f14('0x9')](),controller[_0x0f14('0x12')]);router[_0x0f14('0x13')]('/:id',auth[_0x0f14('0x9')](),controller[_0x0f14('0x14')]);router[_0x0f14('0x13')](_0x0f14('0x15'),auth[_0x0f14('0x9')](),controller[_0x0f14('0x16')]);module[_0x0f14('0x17')]=router; \ No newline at end of file +var _0x1fac=['create','update','delete','destroy','removeSound','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','index','/:id','show','/:id/sounds','post'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x1fac,0x98));var _0xc1fa=function(_0x299cf2,_0xeb446){_0x299cf2=_0x299cf2-0x0;var _0x5116f2=_0x1fac[_0x299cf2];return _0x5116f2;};'use strict';var multer=require(_0xc1fa('0x0'));var util=require(_0xc1fa('0x1'));var path=require(_0xc1fa('0x2'));var timeout=require(_0xc1fa('0x3'));var express=require(_0xc1fa('0x4'));var router=express[_0xc1fa('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xc1fa('0x6'));var config=require(_0xc1fa('0x7'));var controller=require(_0xc1fa('0x8'));router[_0xc1fa('0x9')]('/',auth[_0xc1fa('0xa')](),controller[_0xc1fa('0xb')]);router['get'](_0xc1fa('0xc'),auth[_0xc1fa('0xa')](),controller[_0xc1fa('0xd')]);router['get'](_0xc1fa('0xe'),auth[_0xc1fa('0xa')](),controller['getSounds']);router[_0xc1fa('0xf')]('/',auth['isAuthenticated'](),controller[_0xc1fa('0x10')]);router[_0xc1fa('0xf')](_0xc1fa('0xe'),auth[_0xc1fa('0xa')](),controller['addSound']);router['put'](_0xc1fa('0xc'),auth[_0xc1fa('0xa')](),controller[_0xc1fa('0x11')]);router[_0xc1fa('0x12')](_0xc1fa('0xc'),auth[_0xc1fa('0xa')](),controller[_0xc1fa('0x13')]);router['delete']('/:id/sounds/:id2',auth[_0xc1fa('0xa')](),controller[_0xc1fa('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 7634467..55493d3 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 _0xdaee=['STRING','name','custom','files','quietmp3nb','quietmp3','mp3','alpha','TIMESTAMP','BOOLEAN','sequelize','exports'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xdaee,0xee));var _0xedae=function(_0x25f4c6,_0x5ab218){_0x25f4c6=_0x25f4c6-0x0;var _0x1988b2=_0xdaee[_0x25f4c6];return _0x1988b2;};'use strict';var Sequelize=require(_0xedae('0x0'));module[_0xedae('0x1')]={'name':{'type':Sequelize[_0xedae('0x2')],'allowNull':![],'unique':_0xedae('0x3')},'mode':{'type':Sequelize['ENUM'](_0xedae('0x4'),_0xedae('0x5'),'mp3nb',_0xedae('0x6'),_0xedae('0x7'),_0xedae('0x8')),'allowNull':!![],'defaultValue':_0xedae('0x5')},'directory':{'type':Sequelize[_0xedae('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0xedae('0x2')],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xedae('0x9')},'format':{'type':Sequelize['STRING'],'allowNull':!![]},'stamp':{'type':_0xedae('0xa')},'defaultEntry':{'type':Sequelize[_0xedae('0xb')],'defaultValue':0x0}}; \ No newline at end of file +var _0x8bca=['exports','STRING','name','ENUM','custom','files','mp3nb','quietmp3','alpha','TIMESTAMP','BOOLEAN','sequelize'];(function(_0x31236c,_0x34f702){var _0x12eb2f=function(_0x6bb9a){while(--_0x6bb9a){_0x31236c['push'](_0x31236c['shift']());}};_0x12eb2f(++_0x34f702);}(_0x8bca,0x137));var _0xa8bc=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0x8bca[_0x5d4607];return _0x5e4a86;};'use strict';var Sequelize=require(_0xa8bc('0x0'));module[_0xa8bc('0x1')]={'name':{'type':Sequelize[_0xa8bc('0x2')],'allowNull':![],'unique':_0xa8bc('0x3')},'mode':{'type':Sequelize[_0xa8bc('0x4')](_0xa8bc('0x5'),_0xa8bc('0x6'),_0xa8bc('0x7'),'quietmp3nb',_0xa8bc('0x8'),'mp3'),'allowNull':!![],'defaultValue':_0xa8bc('0x6')},'directory':{'type':Sequelize[_0xa8bc('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0xa8bc('0x2')],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xa8bc('0x9')},'format':{'type':Sequelize[_0xa8bc('0x2')],'allowNull':!![]},'stamp':{'type':_0xa8bc('0xa')},'defaultEntry':{'type':Sequelize[_0xa8bc('0xb')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js index af990a9..2cf7358 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 _0x322d=['sequelize','transaction','mode','files','directory','join','root','server/files/moh','create','mkdirSync','0777','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','forEach','unlinkSync','Sequelize','ValidationError','Sound','findOne','converted_format','createdAt','server/files/sounds/converted','format','%s.%s','basename','save_name','extname','message','removeSound','id2','getSounds','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','apply','reject','save','update','then','destroy','get','MusicOnHolds','UserProfileResource','sendStatus','error','stack','name','send','map','VoiceMusicOnHold','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','show','params','length','body','find','catch'];(function(_0x645624,_0x5e26cb){var _0x25cd27=function(_0x2d5699){while(--_0x2d5699){_0x645624['push'](_0x645624['shift']());}};_0x25cd27(++_0x5e26cb);}(_0x322d,0x1e3));var _0xd322=function(_0x61b4c7,_0xf6eafa){_0x61b4c7=_0x61b4c7-0x0;var _0x5f57a1=_0x322d[_0x61b4c7];return _0x5f57a1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd322('0x0'));var zipdir=require(_0xd322('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd322('0x2'));var moment=require(_0xd322('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xd322('0x4'));var util=require(_0xd322('0x5'));var path=require(_0xd322('0x6'));var sox=require(_0xd322('0x7'));var csv=require(_0xd322('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd322('0x9'));var _=require(_0xd322('0xa'));var squel=require(_0xd322('0xb'));var crypto=require(_0xd322('0xc'));var jsforce=require(_0xd322('0xd'));var deskjs=require(_0xd322('0xe'));var toCsv=require(_0xd322('0x8'));var querystring=require(_0xd322('0xf'));var Papa=require(_0xd322('0x10'));var Redis=require('ioredis');var authService=require(_0xd322('0x11'));var qs=require(_0xd322('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd322('0x13'));var logger=require('../../config/logger')(_0xd322('0x14'));var utils=require(_0xd322('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xd322('0x16'));var db=require(_0xd322('0x17'))['db'];function respondWithStatusCode(_0x32b51c,_0x536036){_0x536036=_0x536036||0xcc;return function(_0x3a402b){if(_0x3a402b){return _0x32b51c['sendStatus'](_0x536036);}return _0x32b51c[_0xd322('0x18')](_0x536036)[_0xd322('0x19')]();};}function respondWithResult(_0x30032a,_0x3908b4){_0x3908b4=_0x3908b4||0xc8;return function(_0x132a3c){if(_0x132a3c){return _0x30032a['status'](_0x3908b4)[_0xd322('0x1a')](_0x132a3c);}};}function respondWithFilteredResult(_0x8f7e85,_0x370e88){return function(_0x146edb){if(_0x146edb){var _0x38fff9=typeof _0x370e88[_0xd322('0x1b')]==='undefined'&&typeof _0x370e88[_0xd322('0x1c')]===_0xd322('0x1d');var _0x5b1e9c=_0x146edb[_0xd322('0x1e')];var _0x1099bc=_0x38fff9?0x0:_0x370e88[_0xd322('0x1b')];var _0x21ebb9=_0x38fff9?_0x146edb[_0xd322('0x1e')]:_0x370e88[_0xd322('0x1b')]+_0x370e88[_0xd322('0x1c')];var _0x5baabe;if(_0x21ebb9>=_0x5b1e9c){_0x21ebb9=_0x5b1e9c;_0x5baabe=0xc8;}else{_0x5baabe=0xce;}_0x8f7e85[_0xd322('0x18')](_0x5baabe);return _0x8f7e85[_0xd322('0x1f')]('Content-Range',_0x1099bc+'-'+_0x21ebb9+'/'+_0x5b1e9c)[_0xd322('0x1a')](_0x146edb);}return null;};}function patchUpdates(_0x4b39a5){return function(_0x2cb8f8){try{jsonpatch[_0xd322('0x20')](_0x2cb8f8,_0x4b39a5,!![]);}catch(_0x1802c1){return BPromise[_0xd322('0x21')](_0x1802c1);}return _0x2cb8f8[_0xd322('0x22')]();};}function saveUpdates(_0x57beaf,_0x3b21b0){return function(_0x1bc570){if(_0x1bc570){return _0x1bc570[_0xd322('0x23')](_0x57beaf)[_0xd322('0x24')](function(_0x53d173){return _0x53d173;});}return null;};}function removeEntity(_0x245a34,_0x4383ed){return function(_0x4c6927){if(_0x4c6927){return _0x4c6927[_0xd322('0x25')]()['then'](function(){var _0x173b4f=_0x4c6927[_0xd322('0x26')]({'plain':!![]});var _0x159c3a=_0xd322('0x27');return db[_0xd322('0x28')][_0xd322('0x25')]({'where':{'type':_0x159c3a,'resourceId':_0x173b4f['id']}})[_0xd322('0x24')](function(){return _0x4c6927;});})[_0xd322('0x24')](function(){_0x245a34[_0xd322('0x18')](0xcc)[_0xd322('0x19')]();});}};}function handleEntityNotFound(_0x5d73d0,_0x182266){return function(_0x3b5573){if(!_0x3b5573){_0x5d73d0[_0xd322('0x29')](0x194);}return _0x3b5573;};}function handleError(_0x102955,_0x202d01){_0x202d01=_0x202d01||0x1f4;return function(_0x1f9fd5){logger[_0xd322('0x2a')](_0x1f9fd5[_0xd322('0x2b')]);if(_0x1f9fd5['name']){delete _0x1f9fd5[_0xd322('0x2c')];}_0x102955[_0xd322('0x18')](_0x202d01)[_0xd322('0x2d')](_0x1f9fd5);};}exports['index']=function(_0x4d3d09,_0x336ae7){var _0x16ce9e={},_0x1c3bb5={},_0x345b8b={'count':0x0,'rows':[]};var _0x3e9470=_[_0xd322('0x2e')](db[_0xd322('0x2f')][_0xd322('0x30')],function(_0xeb34be){return{'name':_0xeb34be[_0xd322('0x31')],'type':_0xeb34be[_0xd322('0x32')][_0xd322('0x33')]};});_0x1c3bb5[_0xd322('0x34')]=_[_0xd322('0x2e')](_0x3e9470,_0xd322('0x2c'));_0x1c3bb5[_0xd322('0x35')]=_[_0xd322('0x36')](_0x4d3d09[_0xd322('0x35')]);_0x1c3bb5[_0xd322('0x37')]=_[_0xd322('0x38')](_0x1c3bb5['model'],_0x1c3bb5[_0xd322('0x35')]);_0x16ce9e[_0xd322('0x39')]=_['intersection'](_0x1c3bb5[_0xd322('0x34')],qs[_0xd322('0x3a')](_0x4d3d09[_0xd322('0x35')][_0xd322('0x3a')]));_0x16ce9e[_0xd322('0x39')]=_0x16ce9e[_0xd322('0x39')]['length']?_0x16ce9e[_0xd322('0x39')]:_0x1c3bb5[_0xd322('0x34')];if(!_0x4d3d09[_0xd322('0x35')][_0xd322('0x3b')](_0xd322('0x3c'))){_0x16ce9e[_0xd322('0x1c')]=qs[_0xd322('0x1c')](_0x4d3d09[_0xd322('0x35')][_0xd322('0x1c')]);_0x16ce9e['offset']=qs[_0xd322('0x1b')](_0x4d3d09[_0xd322('0x35')]['offset']);}_0x16ce9e[_0xd322('0x3d')]=qs[_0xd322('0x3e')](_0x4d3d09[_0xd322('0x35')][_0xd322('0x3e')]);delete _0x4d3d09[_0xd322('0x35')][_0xd322('0x3e')];_0x16ce9e[_0xd322('0x3f')]=qs['filters'](_[_0xd322('0x40')](_0x4d3d09[_0xd322('0x35')],_0x1c3bb5[_0xd322('0x37')]),_0x3e9470);if(_0x4d3d09[_0xd322('0x35')][_0xd322('0x41')]){_0x16ce9e[_0xd322('0x3f')]=_[_0xd322('0x42')](_0x16ce9e[_0xd322('0x3f')],{'$or':_['map'](_0x3e9470,function(_0x51c776){if(_0x51c776['type']!=='VIRTUAL'){var _0x49993b={};_0x49993b[_0x51c776['name']]={'$like':'%'+_0x4d3d09[_0xd322('0x35')][_0xd322('0x41')]+'%'};return _0x49993b;}})});}_0x16ce9e=_['merge']({},_0x16ce9e,_0x4d3d09[_0xd322('0x43')]);var _0x8d5c54={'where':_0x16ce9e[_0xd322('0x3f')]};return db[_0xd322('0x2f')][_0xd322('0x1e')](_0x8d5c54)[_0xd322('0x24')](function(_0x2d55d4){_0x345b8b['count']=_0x2d55d4;if(_0x4d3d09['query'][_0xd322('0x44')]){_0x16ce9e['include']=[{'all':!![]}];}return db[_0xd322('0x2f')][_0xd322('0x45')](_0x16ce9e);})[_0xd322('0x24')](function(_0x5a3a99){_0x345b8b[_0xd322('0x46')]=_0x5a3a99;return _0x345b8b;})[_0xd322('0x24')](respondWithFilteredResult(_0x336ae7,_0x16ce9e))['catch'](handleError(_0x336ae7,null));};exports[_0xd322('0x47')]=function(_0x3e41c8,_0x32512c){var _0x58aaaa={'raw':![],'where':{'id':_0x3e41c8[_0xd322('0x48')]['id']}},_0x5f574e={};_0x5f574e[_0xd322('0x34')]=_[_0xd322('0x36')](db[_0xd322('0x2f')][_0xd322('0x30')]);_0x5f574e['query']=_['keys'](_0x3e41c8['query']);_0x5f574e[_0xd322('0x37')]=_[_0xd322('0x38')](_0x5f574e['model'],_0x5f574e[_0xd322('0x35')]);_0x58aaaa[_0xd322('0x39')]=_['intersection'](_0x5f574e['model'],qs[_0xd322('0x3a')](_0x3e41c8[_0xd322('0x35')][_0xd322('0x3a')]));_0x58aaaa[_0xd322('0x39')]=_0x58aaaa[_0xd322('0x39')][_0xd322('0x49')]?_0x58aaaa[_0xd322('0x39')]:_0x5f574e['model'];if(_0x3e41c8[_0xd322('0x35')][_0xd322('0x44')]){_0x58aaaa['include']=[{'all':!![]}];}_0x58aaaa=_[_0xd322('0x42')]({},_0x58aaaa,_0x3e41c8[_0xd322('0x43')]);return db['VoiceMusicOnHold']['find'](_0x58aaaa)['then'](handleEntityNotFound(_0x32512c,null))[_0xd322('0x24')](respondWithResult(_0x32512c,null))['catch'](handleError(_0x32512c,null));};exports[_0xd322('0x23')]=function(_0x2e94d0,_0x35c533){if(_0x2e94d0['body']['id']){delete _0x2e94d0[_0xd322('0x4a')]['id'];}return db[_0xd322('0x2f')][_0xd322('0x4b')]({'where':{'id':_0x2e94d0[_0xd322('0x48')]['id']}})[_0xd322('0x24')](handleEntityNotFound(_0x35c533,null))['then'](saveUpdates(_0x2e94d0[_0xd322('0x4a')],null))[_0xd322('0x24')](respondWithResult(_0x35c533,null))[_0xd322('0x4c')](handleError(_0x35c533,null));};exports['create']=function(_0x312fd5,_0x53abd9,_0x37734f){return db[_0xd322('0x4d')][_0xd322('0x4e')](function(_0x64c0a6){if(_0x312fd5[_0xd322('0x4a')][_0xd322('0x4f')]===_0xd322('0x50')){_0x312fd5['body'][_0xd322('0x51')]=path[_0xd322('0x52')](config[_0xd322('0x53')],_0xd322('0x54'),_0x312fd5[_0xd322('0x4a')][_0xd322('0x2c')]);}return db[_0xd322('0x2f')][_0xd322('0x55')](_0x312fd5['body'],{'transaction':_0x64c0a6})[_0xd322('0x24')](function(_0x30ab51){if(_0x312fd5['body'][_0xd322('0x4f')]===_0xd322('0x50')){fs[_0xd322('0x56')](_0x30ab51['directory'],parseInt(_0xd322('0x57'),0x8));}var _0xa3f9c4=_0x312fd5[_0xd322('0x58')][_0xd322('0x26')]({'plain':!![]});if(!_0xa3f9c4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xa3f9c4[_0xd322('0x59')]==='user'){var _0x40f29c=_0x30ab51['get']({'plain':!![]});return db[_0xd322('0x5a')][_0xd322('0x4b')]({'where':{'name':'MusicOnHolds','userProfileId':_0xa3f9c4[_0xd322('0x5b')]},'raw':!![]})['then'](function(_0x1cb268){if(_0x1cb268&&_0x1cb268[_0xd322('0x5c')]===0x0){return db[_0xd322('0x28')][_0xd322('0x55')]({'name':_0x40f29c[_0xd322('0x2c')],'resourceId':_0x40f29c['id'],'type':_0x1cb268[_0xd322('0x2c')],'sectionId':_0x1cb268['id']},{})['then'](function(){return _0x30ab51;});}else{return _0x30ab51;}})['catch'](function(_0x1c24ec){logger['error'](_0xd322('0x5d'),_0x1c24ec);});}return _0x30ab51;});})[_0xd322('0x24')](respondWithResult(_0x53abd9,0xc9))[_0xd322('0x4c')](handleError(_0x53abd9,null));};exports[_0xd322('0x25')]=function(_0xbf8a22,_0x530211,_0x11d490){var _0x27e0b7;return db[_0xd322('0x2f')][_0xd322('0x4b')]({'where':{'id':_0xbf8a22[_0xd322('0x48')]['id']}})[_0xd322('0x24')](function(_0x4404a8){if(_0x4404a8){return db[_0xd322('0x4d')]['transaction'](function(_0x3ed1be){return _0x4404a8['destroy']({'transaction':_0x3ed1be,'raw':!![]})[_0xd322('0x24')](function(_0x19d1e0){if(_0x19d1e0[_0xd322('0x51')]){fs['readdirSync'](_0x19d1e0[_0xd322('0x51')])[_0xd322('0x5e')](function(_0x255708){fs[_0xd322('0x5f')](path[_0xd322('0x52')](_0x19d1e0['directory'],_0x255708));});fs['rmdirSync'](_0x19d1e0[_0xd322('0x51')]);}return _0x19d1e0;});})[_0xd322('0x4c')](function(_0x32e3c9){throw new db[(_0xd322('0x60'))][(_0xd322('0x61'))](_0x32e3c9['message']);});}})[_0xd322('0x24')](handleEntityNotFound(_0x530211,null))[_0xd322('0x24')](removeEntity(_0x530211,null))['catch'](handleError(_0x530211,null));};exports['addSound']=function(_0x1cd2bc,_0x33e809,_0x5b3357){return db[_0xd322('0x4d')][_0xd322('0x4e')](function(_0x6396c){var _0x4d87f8;return db[_0xd322('0x2f')][_0xd322('0x4b')]({'where':{'id':_0x1cd2bc[_0xd322('0x48')]['id']}})[_0xd322('0x24')](function(_0x4f0ae4){if(_0x4f0ae4){_0x4d87f8=_0x4f0ae4;return _0x4f0ae4['addSound'](_0x1cd2bc['body']['id'],{'transaction':_0x6396c});}})[_0xd322('0x24')](function(_0x5cbee8){if(_0x5cbee8){return db[_0xd322('0x62')][_0xd322('0x63')]({'where':{'id':_0x1cd2bc['body']['id']},'attributes':['id','name','save_name',_0xd322('0x64'),_0xd322('0x65')],'raw':!![]});}})[_0xd322('0x24')](function(_0x427539){if(_0x427539){var _0x8d8f1b=path[_0xd322('0x52')](config[_0xd322('0x53')],_0xd322('0x66'),util[_0xd322('0x67')](_0xd322('0x68'),path[_0xd322('0x69')](_0x427539[_0xd322('0x6a')],path[_0xd322('0x6b')](_0x427539[_0xd322('0x6a')])),_0x427539[_0xd322('0x64')]));var _0x2eb189=path['join'](config[_0xd322('0x53')],_0xd322('0x54'),_0x4d87f8[_0xd322('0x2c')],util['format']('%s.%s',_0x427539[_0xd322('0x2c')],_0x427539[_0xd322('0x64')]));fs['symlinkSync'](_0x8d8f1b,_0x2eb189);return _0x427539;}})[_0xd322('0x4c')](function(_0x35c3fa){throw new db['Sequelize'][(_0xd322('0x61'))](_0x35c3fa[_0xd322('0x6c')]);});})[_0xd322('0x24')](handleEntityNotFound(_0x33e809,null))[_0xd322('0x24')](respondWithResult(_0x33e809,0xc9))['catch'](handleError(_0x33e809,null));};exports[_0xd322('0x6d')]=function(_0x41384e,_0x2204a9,_0x5cb077){return db[_0xd322('0x4d')]['transaction'](function(_0x38c773){var _0x3d01eb;return db[_0xd322('0x2f')]['findOne']({'where':{'id':_0x41384e[_0xd322('0x48')]['id']}})[_0xd322('0x24')](handleEntityNotFound(_0x2204a9,null))[_0xd322('0x24')](function(_0x586444){if(_0x586444){_0x3d01eb=_0x586444;return _0x586444['removeSound'](_0x41384e['params'][_0xd322('0x6e')]);}})['then'](function(_0x2c0bbe){if(_0x2c0bbe){return db[_0xd322('0x62')][_0xd322('0x63')]({'where':{'id':_0x41384e[_0xd322('0x48')][_0xd322('0x6e')]},'attributes':['id','name',_0xd322('0x6a'),'converted_format',_0xd322('0x65')],'raw':!![]});}})[_0xd322('0x24')](function(_0x556260){if(_0x556260){fs[_0xd322('0x5f')](path['join'](_0x3d01eb[_0xd322('0x51')],util[_0xd322('0x67')](_0xd322('0x68'),_0x556260[_0xd322('0x2c')],_0x556260[_0xd322('0x64')])));return _0x556260;}})[_0xd322('0x4c')](function(_0x4dbba8){throw new db[(_0xd322('0x60'))][(_0xd322('0x61'))](_0x4dbba8[_0xd322('0x6c')]);});})['then'](handleEntityNotFound(_0x2204a9,null))[_0xd322('0x24')](respondWithStatusCode(_0x2204a9,0xcc))[_0xd322('0x4c')](handleError(_0x2204a9,null));};exports[_0xd322('0x6f')]=function(_0x30569f,_0x49cbcd,_0x440197){var _0x175c85={};var _0x404a2d={};var _0x572df9;var _0x18b12b;return db[_0xd322('0x2f')]['findOne']({'where':{'id':_0x30569f['params']['id']}})[_0xd322('0x24')](handleEntityNotFound(_0x49cbcd,null))[_0xd322('0x24')](function(_0x156aae){if(_0x156aae){_0x572df9=_0x156aae;_0x404a2d[_0xd322('0x34')]=_[_0xd322('0x36')](db['Sound'][_0xd322('0x30')]);_0x404a2d[_0xd322('0x35')]=_[_0xd322('0x36')](_0x30569f['query']);_0x404a2d[_0xd322('0x37')]=_['intersection'](_0x404a2d[_0xd322('0x34')],_0x404a2d[_0xd322('0x35')]);_0x175c85[_0xd322('0x39')]=_[_0xd322('0x38')](_0x404a2d['model'],qs[_0xd322('0x3a')](_0x30569f[_0xd322('0x35')]['fields']));_0x175c85['attributes']=_0x175c85[_0xd322('0x39')][_0xd322('0x49')]?_0x175c85[_0xd322('0x39')]:_0x404a2d[_0xd322('0x34')];_0x175c85['order']=qs['sort'](_0x30569f['query'][_0xd322('0x3e')]);_0x175c85[_0xd322('0x3f')]=qs['filters'](_[_0xd322('0x40')](_0x30569f[_0xd322('0x35')],_0x404a2d[_0xd322('0x37')]));if(_0x30569f['query'][_0xd322('0x41')]){_0x175c85[_0xd322('0x3f')]=_['merge'](_0x175c85[_0xd322('0x3f')],{'$or':_[_0xd322('0x2e')](_0x175c85[_0xd322('0x39')],function(_0x486481){var _0x44f17d={};_0x44f17d[_0x486481]={'$like':'%'+_0x30569f['query'][_0xd322('0x41')]+'%'};return _0x44f17d;})});}_0x175c85=_[_0xd322('0x42')]({},_0x175c85,_0x30569f[_0xd322('0x43')]);return _0x572df9['getSounds'](_0x175c85);}})['then'](function(_0x3ee2a4){if(_0x3ee2a4){_0x18b12b=_0x3ee2a4[_0xd322('0x49')];if(!_0x30569f[_0xd322('0x35')][_0xd322('0x3b')]('nolimit')){_0x175c85[_0xd322('0x1c')]=qs['limit'](_0x30569f[_0xd322('0x35')][_0xd322('0x1c')]);_0x175c85[_0xd322('0x1b')]=qs['offset'](_0x30569f[_0xd322('0x35')][_0xd322('0x1b')]);}return _0x572df9[_0xd322('0x6f')](_0x175c85);}})[_0xd322('0x24')](function(_0x381fac){if(_0x381fac){return _0x381fac?{'count':_0x18b12b,'rows':_0x381fac}:null;}})[_0xd322('0x24')](respondWithResult(_0x49cbcd,null))[_0xd322('0x4c')](handleError(_0x49cbcd,null));}; \ No newline at end of file +var _0xd0b7=['../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','options','VoiceMusicOnHold','includeAll','findAll','rows','catch','show','params','include','find','body','transaction','mode','directory','root','server/files/moh','create','files','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','MusicOnHolds','autoAssociation','sequelize','readdirSync','unlinkSync','join','rmdirSync','Sequelize','ValidationError','message','addSound','findOne','save_name','converted_format','createdAt','format','%s.%s','extname','symlinkSync','id2','Sound','getSounds','rawAttributes','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x4fa665,_0x1ae12a){var _0x62ccff=function(_0x4f0bb8){while(--_0x4f0bb8){_0x4fa665['push'](_0x4fa665['shift']());}};_0x62ccff(++_0x1ae12a);}(_0xd0b7,0x1ab));var _0x7d0b=function(_0x246f0d,_0x365b6e){_0x246f0d=_0x246f0d-0x0;var _0x1c1d8e=_0xd0b7[_0x246f0d];return _0x1c1d8e;};'use strict';var emlformat=require(_0x7d0b('0x0'));var rimraf=require(_0x7d0b('0x1'));var zipdir=require(_0x7d0b('0x2'));var jsonpatch=require(_0x7d0b('0x3'));var rp=require(_0x7d0b('0x4'));var moment=require('moment');var BPromise=require(_0x7d0b('0x5'));var Mustache=require(_0x7d0b('0x6'));var util=require(_0x7d0b('0x7'));var path=require(_0x7d0b('0x8'));var sox=require(_0x7d0b('0x9'));var csv=require(_0x7d0b('0xa'));var ejs=require(_0x7d0b('0xb'));var fs=require('fs');var fs_extra=require(_0x7d0b('0xc'));var _=require(_0x7d0b('0xd'));var squel=require(_0x7d0b('0xe'));var crypto=require(_0x7d0b('0xf'));var jsforce=require(_0x7d0b('0x10'));var deskjs=require(_0x7d0b('0x11'));var toCsv=require('to-csv');var querystring=require(_0x7d0b('0x12'));var Papa=require(_0x7d0b('0x13'));var Redis=require(_0x7d0b('0x14'));var authService=require(_0x7d0b('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0x7d0b('0x16'));var hardwareService=require(_0x7d0b('0x17'));var logger=require(_0x7d0b('0x18'))('api');var utils=require(_0x7d0b('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x7d0b('0x1a'));var db=require(_0x7d0b('0x1b'))['db'];function respondWithStatusCode(_0x17ee60,_0x254efc){_0x254efc=_0x254efc||0xcc;return function(_0x5bd25f){if(_0x5bd25f){return _0x17ee60[_0x7d0b('0x1c')](_0x254efc);}return _0x17ee60[_0x7d0b('0x1d')](_0x254efc)[_0x7d0b('0x1e')]();};}function respondWithResult(_0x177d2c,_0x3520d4){_0x3520d4=_0x3520d4||0xc8;return function(_0x216289){if(_0x216289){return _0x177d2c[_0x7d0b('0x1d')](_0x3520d4)['json'](_0x216289);}};}function respondWithFilteredResult(_0x2e6479,_0x48f685){return function(_0x1e4fa5){if(_0x1e4fa5){var _0x193c44=typeof _0x48f685[_0x7d0b('0x1f')]===_0x7d0b('0x20')&&typeof _0x48f685[_0x7d0b('0x21')]==='undefined';var _0x41a9dc=_0x1e4fa5[_0x7d0b('0x22')];var _0x1fbc4b=_0x193c44?0x0:_0x48f685[_0x7d0b('0x1f')];var _0x38521e=_0x193c44?_0x1e4fa5['count']:_0x48f685[_0x7d0b('0x1f')]+_0x48f685['limit'];var _0x37dd78;if(_0x38521e>=_0x41a9dc){_0x38521e=_0x41a9dc;_0x37dd78=0xc8;}else{_0x37dd78=0xce;}_0x2e6479[_0x7d0b('0x1d')](_0x37dd78);return _0x2e6479[_0x7d0b('0x23')](_0x7d0b('0x24'),_0x1fbc4b+'-'+_0x38521e+'/'+_0x41a9dc)['json'](_0x1e4fa5);}return null;};}function patchUpdates(_0x3de78c){return function(_0x13b983){try{jsonpatch['apply'](_0x13b983,_0x3de78c,!![]);}catch(_0x22daae){return BPromise[_0x7d0b('0x25')](_0x22daae);}return _0x13b983[_0x7d0b('0x26')]();};}function saveUpdates(_0x5c2aa1,_0x2499ea){return function(_0x421d94){if(_0x421d94){return _0x421d94[_0x7d0b('0x27')](_0x5c2aa1)[_0x7d0b('0x28')](function(_0x49cd4a){return _0x49cd4a;});}return null;};}function removeEntity(_0x45f0a9,_0x521fb7){return function(_0x2c2b8a){if(_0x2c2b8a){return _0x2c2b8a[_0x7d0b('0x29')]()[_0x7d0b('0x28')](function(){var _0x42d69e=_0x2c2b8a[_0x7d0b('0x2a')]({'plain':!![]});var _0x15eb0d='MusicOnHolds';return db[_0x7d0b('0x2b')][_0x7d0b('0x29')]({'where':{'type':_0x15eb0d,'resourceId':_0x42d69e['id']}})[_0x7d0b('0x28')](function(){return _0x2c2b8a;});})[_0x7d0b('0x28')](function(){_0x45f0a9[_0x7d0b('0x1d')](0xcc)[_0x7d0b('0x1e')]();});}};}function handleEntityNotFound(_0x19689f,_0x2699da){return function(_0x452579){if(!_0x452579){_0x19689f['sendStatus'](0x194);}return _0x452579;};}function handleError(_0x19dcb0,_0x4dd27e){_0x4dd27e=_0x4dd27e||0x1f4;return function(_0x25da85){logger[_0x7d0b('0x2c')](_0x25da85[_0x7d0b('0x2d')]);if(_0x25da85['name']){delete _0x25da85[_0x7d0b('0x2e')];}_0x19dcb0[_0x7d0b('0x1d')](_0x4dd27e)[_0x7d0b('0x2f')](_0x25da85);};}exports[_0x7d0b('0x30')]=function(_0x1fb31c,_0x29572b){var _0x4b92ab={},_0x25bbea={},_0x9a0860={'count':0x0,'rows':[]};var _0x2c711c=_['map'](db['VoiceMusicOnHold']['rawAttributes'],function(_0x1f059c){return{'name':_0x1f059c['fieldName'],'type':_0x1f059c['type'][_0x7d0b('0x31')]};});_0x25bbea[_0x7d0b('0x32')]=_[_0x7d0b('0x33')](_0x2c711c,_0x7d0b('0x2e'));_0x25bbea[_0x7d0b('0x34')]=_[_0x7d0b('0x35')](_0x1fb31c['query']);_0x25bbea[_0x7d0b('0x36')]=_[_0x7d0b('0x37')](_0x25bbea[_0x7d0b('0x32')],_0x25bbea['query']);_0x4b92ab[_0x7d0b('0x38')]=_[_0x7d0b('0x37')](_0x25bbea['model'],qs[_0x7d0b('0x39')](_0x1fb31c['query'][_0x7d0b('0x39')]));_0x4b92ab['attributes']=_0x4b92ab[_0x7d0b('0x38')][_0x7d0b('0x3a')]?_0x4b92ab[_0x7d0b('0x38')]:_0x25bbea[_0x7d0b('0x32')];if(!_0x1fb31c['query'][_0x7d0b('0x3b')](_0x7d0b('0x3c'))){_0x4b92ab['limit']=qs[_0x7d0b('0x21')](_0x1fb31c['query'][_0x7d0b('0x21')]);_0x4b92ab[_0x7d0b('0x1f')]=qs[_0x7d0b('0x1f')](_0x1fb31c['query']['offset']);}_0x4b92ab[_0x7d0b('0x3d')]=qs[_0x7d0b('0x3e')](_0x1fb31c[_0x7d0b('0x34')][_0x7d0b('0x3e')]);delete _0x1fb31c['query']['sort'];_0x4b92ab[_0x7d0b('0x3f')]=qs[_0x7d0b('0x36')](_['pick'](_0x1fb31c[_0x7d0b('0x34')],_0x25bbea[_0x7d0b('0x36')]),_0x2c711c);if(_0x1fb31c[_0x7d0b('0x34')][_0x7d0b('0x40')]){_0x4b92ab[_0x7d0b('0x3f')]=_[_0x7d0b('0x41')](_0x4b92ab[_0x7d0b('0x3f')],{'$or':_[_0x7d0b('0x33')](_0x2c711c,function(_0x525214){if(_0x525214[_0x7d0b('0x42')]!=='VIRTUAL'){var _0x508f5c={};_0x508f5c[_0x525214[_0x7d0b('0x2e')]]={'$like':'%'+_0x1fb31c[_0x7d0b('0x34')][_0x7d0b('0x40')]+'%'};return _0x508f5c;}})});}_0x4b92ab=_[_0x7d0b('0x41')]({},_0x4b92ab,_0x1fb31c[_0x7d0b('0x43')]);var _0x5d81ef={'where':_0x4b92ab[_0x7d0b('0x3f')]};return db[_0x7d0b('0x44')][_0x7d0b('0x22')](_0x5d81ef)[_0x7d0b('0x28')](function(_0x3b2d8c){_0x9a0860['count']=_0x3b2d8c;if(_0x1fb31c[_0x7d0b('0x34')][_0x7d0b('0x45')]){_0x4b92ab['include']=[{'all':!![]}];}return db['VoiceMusicOnHold'][_0x7d0b('0x46')](_0x4b92ab);})[_0x7d0b('0x28')](function(_0x3e6fc8){_0x9a0860[_0x7d0b('0x47')]=_0x3e6fc8;return _0x9a0860;})[_0x7d0b('0x28')](respondWithFilteredResult(_0x29572b,_0x4b92ab))[_0x7d0b('0x48')](handleError(_0x29572b,null));};exports[_0x7d0b('0x49')]=function(_0x67b92f,_0x326ee2){var _0x5e296f={'raw':![],'where':{'id':_0x67b92f[_0x7d0b('0x4a')]['id']}},_0x7c3f5c={};_0x7c3f5c[_0x7d0b('0x32')]=_[_0x7d0b('0x35')](db['VoiceMusicOnHold']['rawAttributes']);_0x7c3f5c[_0x7d0b('0x34')]=_['keys'](_0x67b92f[_0x7d0b('0x34')]);_0x7c3f5c[_0x7d0b('0x36')]=_[_0x7d0b('0x37')](_0x7c3f5c[_0x7d0b('0x32')],_0x7c3f5c['query']);_0x5e296f[_0x7d0b('0x38')]=_[_0x7d0b('0x37')](_0x7c3f5c[_0x7d0b('0x32')],qs[_0x7d0b('0x39')](_0x67b92f[_0x7d0b('0x34')][_0x7d0b('0x39')]));_0x5e296f[_0x7d0b('0x38')]=_0x5e296f[_0x7d0b('0x38')][_0x7d0b('0x3a')]?_0x5e296f[_0x7d0b('0x38')]:_0x7c3f5c['model'];if(_0x67b92f[_0x7d0b('0x34')]['includeAll']){_0x5e296f[_0x7d0b('0x4b')]=[{'all':!![]}];}_0x5e296f=_['merge']({},_0x5e296f,_0x67b92f[_0x7d0b('0x43')]);return db[_0x7d0b('0x44')][_0x7d0b('0x4c')](_0x5e296f)[_0x7d0b('0x28')](handleEntityNotFound(_0x326ee2,null))['then'](respondWithResult(_0x326ee2,null))[_0x7d0b('0x48')](handleError(_0x326ee2,null));};exports[_0x7d0b('0x27')]=function(_0x3c3be7,_0x1bc62f){if(_0x3c3be7[_0x7d0b('0x4d')]['id']){delete _0x3c3be7['body']['id'];}return db[_0x7d0b('0x44')]['find']({'where':{'id':_0x3c3be7['params']['id']}})[_0x7d0b('0x28')](handleEntityNotFound(_0x1bc62f,null))[_0x7d0b('0x28')](saveUpdates(_0x3c3be7['body'],null))[_0x7d0b('0x28')](respondWithResult(_0x1bc62f,null))[_0x7d0b('0x48')](handleError(_0x1bc62f,null));};exports['create']=function(_0x1721bf,_0x334b59,_0x2ad983){return db['sequelize'][_0x7d0b('0x4e')](function(_0x15178a){if(_0x1721bf[_0x7d0b('0x4d')][_0x7d0b('0x4f')]==='files'){_0x1721bf[_0x7d0b('0x4d')][_0x7d0b('0x50')]=path['join'](config[_0x7d0b('0x51')],_0x7d0b('0x52'),_0x1721bf[_0x7d0b('0x4d')][_0x7d0b('0x2e')]);}return db[_0x7d0b('0x44')][_0x7d0b('0x53')](_0x1721bf[_0x7d0b('0x4d')],{'transaction':_0x15178a})['then'](function(_0x2cb8a6){if(_0x1721bf[_0x7d0b('0x4d')][_0x7d0b('0x4f')]===_0x7d0b('0x54')){fs['mkdirSync'](_0x2cb8a6[_0x7d0b('0x50')],parseInt('0777',0x8));}var _0x56524a=_0x1721bf[_0x7d0b('0x55')][_0x7d0b('0x2a')]({'plain':!![]});if(!_0x56524a)throw new Error(_0x7d0b('0x56'));if(_0x56524a[_0x7d0b('0x57')]===_0x7d0b('0x55')){var _0x244689=_0x2cb8a6[_0x7d0b('0x2a')]({'plain':!![]});return db[_0x7d0b('0x58')][_0x7d0b('0x4c')]({'where':{'name':_0x7d0b('0x59'),'userProfileId':_0x56524a['userProfileId']},'raw':!![]})['then'](function(_0x31d665){if(_0x31d665&&_0x31d665[_0x7d0b('0x5a')]===0x0){return db[_0x7d0b('0x2b')][_0x7d0b('0x53')]({'name':_0x244689[_0x7d0b('0x2e')],'resourceId':_0x244689['id'],'type':_0x31d665[_0x7d0b('0x2e')],'sectionId':_0x31d665['id']},{})[_0x7d0b('0x28')](function(){return _0x2cb8a6;});}else{return _0x2cb8a6;}})[_0x7d0b('0x48')](function(_0x49a055){logger[_0x7d0b('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x49a055);});}return _0x2cb8a6;});})[_0x7d0b('0x28')](respondWithResult(_0x334b59,0xc9))['catch'](handleError(_0x334b59,null));};exports[_0x7d0b('0x29')]=function(_0x48c422,_0x3f9018,_0x59692c){var _0xdaecf0;return db[_0x7d0b('0x44')][_0x7d0b('0x4c')]({'where':{'id':_0x48c422[_0x7d0b('0x4a')]['id']}})[_0x7d0b('0x28')](function(_0x4acc85){if(_0x4acc85){return db[_0x7d0b('0x5b')][_0x7d0b('0x4e')](function(_0x3bc05f){return _0x4acc85[_0x7d0b('0x29')]({'transaction':_0x3bc05f,'raw':!![]})[_0x7d0b('0x28')](function(_0x2075f0){if(_0x2075f0['directory']){fs[_0x7d0b('0x5c')](_0x2075f0[_0x7d0b('0x50')])['forEach'](function(_0x379e35){fs[_0x7d0b('0x5d')](path[_0x7d0b('0x5e')](_0x2075f0['directory'],_0x379e35));});fs[_0x7d0b('0x5f')](_0x2075f0[_0x7d0b('0x50')]);}return _0x2075f0;});})[_0x7d0b('0x48')](function(_0x13c128){throw new db[(_0x7d0b('0x60'))][(_0x7d0b('0x61'))](_0x13c128[_0x7d0b('0x62')]);});}})[_0x7d0b('0x28')](handleEntityNotFound(_0x3f9018,null))['then'](removeEntity(_0x3f9018,null))['catch'](handleError(_0x3f9018,null));};exports[_0x7d0b('0x63')]=function(_0x1c5d8a,_0x15d356,_0x4fb458){return db[_0x7d0b('0x5b')][_0x7d0b('0x4e')](function(_0x1d0049){var _0x2ef8d2;return db[_0x7d0b('0x44')][_0x7d0b('0x4c')]({'where':{'id':_0x1c5d8a[_0x7d0b('0x4a')]['id']}})[_0x7d0b('0x28')](function(_0x4d226c){if(_0x4d226c){_0x2ef8d2=_0x4d226c;return _0x4d226c[_0x7d0b('0x63')](_0x1c5d8a[_0x7d0b('0x4d')]['id'],{'transaction':_0x1d0049});}})[_0x7d0b('0x28')](function(_0x386c18){if(_0x386c18){return db['Sound'][_0x7d0b('0x64')]({'where':{'id':_0x1c5d8a['body']['id']},'attributes':['id','name',_0x7d0b('0x65'),_0x7d0b('0x66'),_0x7d0b('0x67')],'raw':!![]});}})[_0x7d0b('0x28')](function(_0x297db0){if(_0x297db0){var _0x4579c6=path['join'](config[_0x7d0b('0x51')],'server/files/sounds/converted',util[_0x7d0b('0x68')](_0x7d0b('0x69'),path['basename'](_0x297db0[_0x7d0b('0x65')],path[_0x7d0b('0x6a')](_0x297db0[_0x7d0b('0x65')])),_0x297db0[_0x7d0b('0x66')]));var _0x3be20c=path[_0x7d0b('0x5e')](config[_0x7d0b('0x51')],'server/files/moh',_0x2ef8d2[_0x7d0b('0x2e')],util[_0x7d0b('0x68')](_0x7d0b('0x69'),_0x297db0[_0x7d0b('0x2e')],_0x297db0[_0x7d0b('0x66')]));fs[_0x7d0b('0x6b')](_0x4579c6,_0x3be20c);return _0x297db0;}})['catch'](function(_0xbd8854){throw new db['Sequelize'][(_0x7d0b('0x61'))](_0xbd8854[_0x7d0b('0x62')]);});})['then'](handleEntityNotFound(_0x15d356,null))[_0x7d0b('0x28')](respondWithResult(_0x15d356,0xc9))[_0x7d0b('0x48')](handleError(_0x15d356,null));};exports['removeSound']=function(_0x1446c0,_0x1ee7f1,_0x36195d){return db['sequelize'][_0x7d0b('0x4e')](function(_0x37944a){var _0x469bd0;return db[_0x7d0b('0x44')]['findOne']({'where':{'id':_0x1446c0[_0x7d0b('0x4a')]['id']}})[_0x7d0b('0x28')](handleEntityNotFound(_0x1ee7f1,null))[_0x7d0b('0x28')](function(_0x218882){if(_0x218882){_0x469bd0=_0x218882;return _0x218882['removeSound'](_0x1446c0[_0x7d0b('0x4a')][_0x7d0b('0x6c')]);}})[_0x7d0b('0x28')](function(_0x2a3671){if(_0x2a3671){return db[_0x7d0b('0x6d')][_0x7d0b('0x64')]({'where':{'id':_0x1446c0[_0x7d0b('0x4a')]['id2']},'attributes':['id',_0x7d0b('0x2e'),_0x7d0b('0x65'),_0x7d0b('0x66'),'createdAt'],'raw':!![]});}})[_0x7d0b('0x28')](function(_0x212245){if(_0x212245){fs[_0x7d0b('0x5d')](path[_0x7d0b('0x5e')](_0x469bd0[_0x7d0b('0x50')],util[_0x7d0b('0x68')](_0x7d0b('0x69'),_0x212245[_0x7d0b('0x2e')],_0x212245['converted_format'])));return _0x212245;}})[_0x7d0b('0x48')](function(_0x154eb8){throw new db[(_0x7d0b('0x60'))]['ValidationError'](_0x154eb8['message']);});})[_0x7d0b('0x28')](handleEntityNotFound(_0x1ee7f1,null))[_0x7d0b('0x28')](respondWithStatusCode(_0x1ee7f1,0xcc))['catch'](handleError(_0x1ee7f1,null));};exports[_0x7d0b('0x6e')]=function(_0x238c6a,_0x551855,_0x348ee6){var _0x216a14={};var _0x291216={};var _0xe186e5;var _0x586ee3;return db['VoiceMusicOnHold'][_0x7d0b('0x64')]({'where':{'id':_0x238c6a[_0x7d0b('0x4a')]['id']}})[_0x7d0b('0x28')](handleEntityNotFound(_0x551855,null))[_0x7d0b('0x28')](function(_0x2ec2e2){if(_0x2ec2e2){_0xe186e5=_0x2ec2e2;_0x291216[_0x7d0b('0x32')]=_[_0x7d0b('0x35')](db['Sound'][_0x7d0b('0x6f')]);_0x291216[_0x7d0b('0x34')]=_[_0x7d0b('0x35')](_0x238c6a[_0x7d0b('0x34')]);_0x291216[_0x7d0b('0x36')]=_[_0x7d0b('0x37')](_0x291216['model'],_0x291216[_0x7d0b('0x34')]);_0x216a14[_0x7d0b('0x38')]=_[_0x7d0b('0x37')](_0x291216[_0x7d0b('0x32')],qs['fields'](_0x238c6a['query'][_0x7d0b('0x39')]));_0x216a14['attributes']=_0x216a14[_0x7d0b('0x38')][_0x7d0b('0x3a')]?_0x216a14[_0x7d0b('0x38')]:_0x291216[_0x7d0b('0x32')];_0x216a14[_0x7d0b('0x3d')]=qs[_0x7d0b('0x3e')](_0x238c6a[_0x7d0b('0x34')][_0x7d0b('0x3e')]);_0x216a14[_0x7d0b('0x3f')]=qs[_0x7d0b('0x36')](_['pick'](_0x238c6a[_0x7d0b('0x34')],_0x291216[_0x7d0b('0x36')]));if(_0x238c6a[_0x7d0b('0x34')][_0x7d0b('0x40')]){_0x216a14[_0x7d0b('0x3f')]=_[_0x7d0b('0x41')](_0x216a14[_0x7d0b('0x3f')],{'$or':_['map'](_0x216a14[_0x7d0b('0x38')],function(_0x2670db){var _0x5d8a51={};_0x5d8a51[_0x2670db]={'$like':'%'+_0x238c6a[_0x7d0b('0x34')]['filter']+'%'};return _0x5d8a51;})});}_0x216a14=_['merge']({},_0x216a14,_0x238c6a[_0x7d0b('0x43')]);return _0xe186e5[_0x7d0b('0x6e')](_0x216a14);}})[_0x7d0b('0x28')](function(_0x7e71da){if(_0x7e71da){_0x586ee3=_0x7e71da[_0x7d0b('0x3a')];if(!_0x238c6a[_0x7d0b('0x34')][_0x7d0b('0x3b')](_0x7d0b('0x3c'))){_0x216a14[_0x7d0b('0x21')]=qs[_0x7d0b('0x21')](_0x238c6a[_0x7d0b('0x34')]['limit']);_0x216a14[_0x7d0b('0x1f')]=qs[_0x7d0b('0x1f')](_0x238c6a['query']['offset']);}return _0xe186e5['getSounds'](_0x216a14);}})['then'](function(_0x261610){if(_0x261610){return _0x261610?{'count':_0x586ee3,'rows':_0x261610}:null;}})[_0x7d0b('0x28')](respondWithResult(_0x551855,null))[_0x7d0b('0x48')](handleError(_0x551855,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 3e4e50a..451d714 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 _0x483a=['../../config/environment','./voiceMusicOnHold.attributes','define','VoiceMusicOnHold','voice_musiconhold','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x4e6131,_0x3c7e5c){var _0x26fee0=function(_0x2b98ea){while(--_0x2b98ea){_0x4e6131['push'](_0x4e6131['shift']());}};_0x26fee0(++_0x3c7e5c);}(_0x483a,0x18b));var _0xa483=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x483a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xa483('0x0'));var util=require(_0xa483('0x1'));var logger=require(_0xa483('0x2'))(_0xa483('0x3'));var moment=require(_0xa483('0x4'));var BPromise=require(_0xa483('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa483('0x6'));var rimraf=require(_0xa483('0x7'));var config=require(_0xa483('0x8'));var attributes=require(_0xa483('0x9'));module['exports']=function(_0x80a82a,_0xb8b604){return _0x80a82a[_0xa483('0xa')](_0xa483('0xb'),attributes,{'tableName':_0xa483('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9084=['rimraf','../../config/environment','exports','define','VoiceMusicOnHold','voice_musiconhold','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x257f0c,_0x28006d){var _0x330946=function(_0x32b72f){while(--_0x32b72f){_0x257f0c['push'](_0x257f0c['shift']());}};_0x330946(++_0x28006d);}(_0x9084,0x72));var _0x4908=function(_0x40381e,_0x393856){_0x40381e=_0x40381e-0x0;var _0x4e9af6=_0x9084[_0x40381e];return _0x4e9af6;};'use strict';var _=require(_0x4908('0x0'));var util=require(_0x4908('0x1'));var logger=require(_0x4908('0x2'))(_0x4908('0x3'));var moment=require(_0x4908('0x4'));var BPromise=require(_0x4908('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4908('0x6'));var config=require(_0x4908('0x7'));var attributes=require('./voiceMusicOnHold.attributes');module[_0x4908('0x8')]=function(_0xb4fe14,_0x41a00e){return _0xb4fe14[_0x4908('0x9')](_0x4908('0xa'),attributes,{'tableName':_0x4908('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js index 2fd9322..8eaa77f 100644 --- a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js +++ b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','request\x20sent','debug','stringify','code','error','message','VoiceMusicOnHold,\x20%s,\x20%s','info','result','catch','moment','bluebird'];(function(_0x2e1f4a,_0x40a526){var _0x254438=function(_0x1624de){while(--_0x1624de){_0x2e1f4a['push'](_0x2e1f4a['shift']());}};_0x254438(++_0x40a526);}(_0x9c44,0x178));var _0x49c4=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0x9c44[_0x273c39];return _0x46d6b5;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x49c4('0x0'));var BPromise=require(_0x49c4('0x1'));var rs=require(_0x49c4('0x2'));var fs=require('fs');var Redis=require(_0x49c4('0x3'));var db=require(_0x49c4('0x4'))['db'];var utils=require(_0x49c4('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x49c4('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x49c4('0x7')][_0x49c4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x69bc41,_0x2c4e2e,_0x436234){return new BPromise(function(_0x511d53,_0x11c586){return client[_0x49c4('0x9')](_0x69bc41,_0x436234)[_0x49c4('0xa')](function(_0x4487ca){logger['info']('VoiceMusicOnHold,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));logger[_0x49c4('0xc')]('VoiceMusicOnHold,\x20%s,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'),JSON[_0x49c4('0xd')](_0x4487ca));if(_0x4487ca['error']){if(_0x4487ca['error'][_0x49c4('0xe')]===0x1f4){logger[_0x49c4('0xf')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x11c586(_0x4487ca['error'][_0x49c4('0x10')]);}logger[_0x49c4('0xf')](_0x49c4('0x11'),_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x511d53(_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);}else{logger[_0x49c4('0x12')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));_0x511d53(_0x4487ca[_0x49c4('0x13')][_0x49c4('0x10')]);}})[_0x49c4('0x14')](function(_0x2abc78){logger['error'](_0x49c4('0x11'),_0x2c4e2e,_0x2abc78);_0x11c586(_0x2abc78);});});} \ No newline at end of file +var _0x9c44=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','request\x20sent','debug','stringify','code','error','message','VoiceMusicOnHold,\x20%s,\x20%s','info','result','catch','moment','bluebird'];(function(_0x595f9e,_0x799115){var _0x450f6a=function(_0x18bf3d){while(--_0x18bf3d){_0x595f9e['push'](_0x595f9e['shift']());}};_0x450f6a(++_0x799115);}(_0x9c44,0x178));var _0x49c4=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0x9c44[_0x36c5b0];return _0xf19333;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x49c4('0x0'));var BPromise=require(_0x49c4('0x1'));var rs=require(_0x49c4('0x2'));var fs=require('fs');var Redis=require(_0x49c4('0x3'));var db=require(_0x49c4('0x4'))['db'];var utils=require(_0x49c4('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x49c4('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x49c4('0x7')][_0x49c4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x69bc41,_0x2c4e2e,_0x436234){return new BPromise(function(_0x511d53,_0x11c586){return client[_0x49c4('0x9')](_0x69bc41,_0x436234)[_0x49c4('0xa')](function(_0x4487ca){logger['info']('VoiceMusicOnHold,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));logger[_0x49c4('0xc')]('VoiceMusicOnHold,\x20%s,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'),JSON[_0x49c4('0xd')](_0x4487ca));if(_0x4487ca['error']){if(_0x4487ca['error'][_0x49c4('0xe')]===0x1f4){logger[_0x49c4('0xf')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x11c586(_0x4487ca['error'][_0x49c4('0x10')]);}logger[_0x49c4('0xf')](_0x49c4('0x11'),_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x511d53(_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);}else{logger[_0x49c4('0x12')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));_0x511d53(_0x4487ca[_0x49c4('0x13')][_0x49c4('0x10')]);}})[_0x49c4('0x14')](function(_0x2abc78){logger['error'](_0x49c4('0x11'),_0x2c4e2e,_0x2abc78);_0x11c586(_0x2abc78);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index b5f9e13..d5404d5 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 _0x7edb=['get','isAuthenticated','index','/describe','describe','/:id','show','/:id/users','getAgents','/:id/teams','getTeams','post','create','addAgents','addTeams','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','./voicePrefix.controller'];(function(_0x375d37,_0x4f4032){var _0xdb1fae=function(_0x1c1c74){while(--_0x1c1c74){_0x375d37['push'](_0x375d37['shift']());}};_0xdb1fae(++_0x4f4032);}(_0x7edb,0x158));var _0xb7ed=function(_0x2e4416,_0x2e1d21){_0x2e4416=_0x2e4416-0x0;var _0xe35b8=_0x7edb[_0x2e4416];return _0xe35b8;};'use strict';var multer=require('multer');var util=require(_0xb7ed('0x0'));var path=require(_0xb7ed('0x1'));var timeout=require(_0xb7ed('0x2'));var express=require(_0xb7ed('0x3'));var router=express[_0xb7ed('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xb7ed('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb7ed('0x6'));router[_0xb7ed('0x7')]('/',auth[_0xb7ed('0x8')](),controller[_0xb7ed('0x9')]);router[_0xb7ed('0x7')](_0xb7ed('0xa'),auth[_0xb7ed('0x8')](),controller[_0xb7ed('0xb')]);router[_0xb7ed('0x7')](_0xb7ed('0xc'),auth['isAuthenticated'](),controller[_0xb7ed('0xd')]);router[_0xb7ed('0x7')](_0xb7ed('0xe'),auth[_0xb7ed('0x8')](),controller[_0xb7ed('0xf')]);router[_0xb7ed('0x7')](_0xb7ed('0x10'),auth['isAuthenticated'](),controller[_0xb7ed('0x11')]);router[_0xb7ed('0x12')]('/',auth[_0xb7ed('0x8')](),controller[_0xb7ed('0x13')]);router[_0xb7ed('0x12')]('/:id/users',auth['isAuthenticated'](),controller[_0xb7ed('0x14')]);router['post'](_0xb7ed('0x10'),auth[_0xb7ed('0x8')](),controller[_0xb7ed('0x15')]);router[_0xb7ed('0x16')](_0xb7ed('0xc'),auth[_0xb7ed('0x8')](),controller[_0xb7ed('0x17')]);router[_0xb7ed('0x18')](_0xb7ed('0xc'),auth[_0xb7ed('0x8')](),controller[_0xb7ed('0x19')]);router[_0xb7ed('0x18')]('/:id/users',auth[_0xb7ed('0x8')](),controller['removeAgents']);router[_0xb7ed('0x18')](_0xb7ed('0x10'),auth['isAuthenticated'](),controller['removeTeams']);module[_0xb7ed('0x1a')]=router; \ No newline at end of file +var _0xc305=['destroy','removeAgents','removeTeams','exports','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','isAuthenticated','index','get','/describe','describe','/:id','show','getAgents','/:id/teams','post','create','/:id/users','addAgents','addTeams','put','update','delete'];(function(_0x2d6c1a,_0x2eba95){var _0x530d7f=function(_0x42676d){while(--_0x42676d){_0x2d6c1a['push'](_0x2d6c1a['shift']());}};_0x530d7f(++_0x2eba95);}(_0xc305,0xcf));var _0x5c30=function(_0xf04c6d,_0xe98786){_0xf04c6d=_0xf04c6d-0x0;var _0x4a804e=_0xc305[_0xf04c6d];return _0x4a804e;};'use strict';var multer=require(_0x5c30('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5c30('0x1'));var express=require(_0x5c30('0x2'));var router=express['Router']();var fs_extra=require(_0x5c30('0x3'));var auth=require(_0x5c30('0x4'));var interaction=require(_0x5c30('0x5'));var config=require(_0x5c30('0x6'));var controller=require(_0x5c30('0x7'));router['get']('/',auth[_0x5c30('0x8')](),controller[_0x5c30('0x9')]);router[_0x5c30('0xa')](_0x5c30('0xb'),auth[_0x5c30('0x8')](),controller[_0x5c30('0xc')]);router[_0x5c30('0xa')](_0x5c30('0xd'),auth['isAuthenticated'](),controller[_0x5c30('0xe')]);router[_0x5c30('0xa')]('/:id/users',auth[_0x5c30('0x8')](),controller[_0x5c30('0xf')]);router[_0x5c30('0xa')](_0x5c30('0x10'),auth[_0x5c30('0x8')](),controller['getTeams']);router[_0x5c30('0x11')]('/',auth[_0x5c30('0x8')](),controller[_0x5c30('0x12')]);router['post'](_0x5c30('0x13'),auth[_0x5c30('0x8')](),controller[_0x5c30('0x14')]);router[_0x5c30('0x11')](_0x5c30('0x10'),auth['isAuthenticated'](),controller[_0x5c30('0x15')]);router[_0x5c30('0x16')](_0x5c30('0xd'),auth[_0x5c30('0x8')](),controller[_0x5c30('0x17')]);router[_0x5c30('0x18')](_0x5c30('0xd'),auth['isAuthenticated'](),controller[_0x5c30('0x19')]);router['delete'](_0x5c30('0x13'),auth[_0x5c30('0x8')](),controller[_0x5c30('0x1a')]);router[_0x5c30('0x18')](_0x5c30('0x10'),auth[_0x5c30('0x8')](),controller[_0x5c30('0x1b')]);module[_0x5c30('0x1c')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index d221664..e9d51da 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 _0xb030=['INTEGER','sequelize','exports','STRING','name','system-','getDataValue'];(function(_0x3879d6,_0xe3cca0){var _0x473c88=function(_0x3e18f0){while(--_0x3e18f0){_0x3879d6['push'](_0x3879d6['shift']());}};_0x473c88(++_0xe3cca0);}(_0xb030,0xa2));var _0x0b03=function(_0x34c3ac,_0x40a7f4){_0x34c3ac=_0x34c3ac-0x0;var _0x6661a1=_0xb030[_0x34c3ac];return _0x6661a1;};'use strict';var Sequelize=require(_0x0b03('0x0'));module[_0x0b03('0x1')]={'name':{'type':Sequelize[_0x0b03('0x2')],'allowNull':![],'unique':_0x0b03('0x3')},'prefix':{'type':Sequelize['VIRTUAL'],'get':function(_0x41f440){return _0x0b03('0x4')+this[_0x0b03('0x5')](_0x0b03('0x3'))+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize[_0x0b03('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0x0b03('0x6')]}}; \ No newline at end of file +var _0xf2dc=['name','VIRTUAL','system-','getDataValue','STRING','INTEGER','sequelize'];(function(_0x5b236a,_0x29a67f){var _0x3495e1=function(_0x5662cf){while(--_0x5662cf){_0x5b236a['push'](_0x5b236a['shift']());}};_0x3495e1(++_0x29a67f);}(_0xf2dc,0x1aa));var _0xcf2d=function(_0x3f6b49,_0x349e07){_0x3f6b49=_0x3f6b49-0x0;var _0x5b5fb8=_0xf2dc[_0x3f6b49];return _0x5b5fb8;};'use strict';var Sequelize=require(_0xcf2d('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xcf2d('0x1')},'prefix':{'type':Sequelize[_0xcf2d('0x2')],'get':function(_0x570189){return _0xcf2d('0x3')+this[_0xcf2d('0x4')](_0xcf2d('0x1'))+'-';}},'description':{'type':Sequelize[_0xcf2d('0x5')]},'callerIdAll':{'type':Sequelize['STRING']},'VoiceExtensionId':{'type':Sequelize[_0xcf2d('0x6')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index f7f8319..4937034 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 _0xe820=['appdata','NoOp','VoicePrefixId','Extensions\x20creation\x20failed','prefix','CDR(prefix)=','callerIdAll','push','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','${EXTEN:','charAt','body','system-','VoiceExtensionId','findById','addAgents','ids','omit','spread','emit','userVoicePrefix:save','removeAgents','userVoicePrefix:remove','getAgents','findOne','nolimit','getTeams','Team','User','Agents','online','voicePause','flatMap','addTeams','each','TeamVoicePrefix','upsert','UserVoicePrefix','findOrCreate','removeTeams','field','tq.TeamId','from','team_has_voice_prefixes','join','user_has_teams','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','SELECT','every','TeamId','includes','value','eml-format','zip-dir','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','get','VoicePrefixes','UserProfileResource','destroy','sendStatus','error','name','send','map','VoicePrefix','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','findAll','rows','catch','show','params','includeAll','include','find','describe','create','sequelize','transaction','VoiceExtension','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','app','system','Voice\x20Prefix\x20Extension','priority'];(function(_0x22b597,_0x3c4ee0){var _0x4129b5=function(_0x2f87c7){while(--_0x2f87c7){_0x22b597['push'](_0x22b597['shift']());}};_0x4129b5(++_0x3c4ee0);}(_0xe820,0xd2));var _0x0e82=function(_0x40bcb3,_0x17e6e0){_0x40bcb3=_0x40bcb3-0x0;var _0x1032df=_0xe820[_0x40bcb3];return _0x1032df;};'use strict';var emlformat=require(_0x0e82('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0e82('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0e82('0x2'));var BPromise=require(_0x0e82('0x3'));var Mustache=require(_0x0e82('0x4'));var util=require('util');var path=require(_0x0e82('0x5'));var sox=require('sox');var csv=require(_0x0e82('0x6'));var ejs=require(_0x0e82('0x7'));var fs=require('fs');var fs_extra=require(_0x0e82('0x8'));var _=require(_0x0e82('0x9'));var squel=require(_0x0e82('0xa'));var crypto=require('crypto');var jsforce=require(_0x0e82('0xb'));var deskjs=require(_0x0e82('0xc'));var toCsv=require(_0x0e82('0x6'));var querystring=require(_0x0e82('0xd'));var Papa=require(_0x0e82('0xe'));var Redis=require('ioredis');var authService=require(_0x0e82('0xf'));var qs=require(_0x0e82('0x10'));var as=require(_0x0e82('0x11'));var hardwareService=require(_0x0e82('0x12'));var logger=require(_0x0e82('0x13'))(_0x0e82('0x14'));var utils=require(_0x0e82('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x0e82('0x16'));var db=require(_0x0e82('0x17'))['db'];config[_0x0e82('0x18')]=_[_0x0e82('0x19')](config[_0x0e82('0x18')],{'host':_0x0e82('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0e82('0x18')]));require('./voicePrefix.socket')['register'](socket);function respondWithStatusCode(_0x1e4ddb,_0x4b748a){_0x4b748a=_0x4b748a||0xcc;return function(_0x5b4ffd){if(_0x5b4ffd){return _0x1e4ddb['sendStatus'](_0x4b748a);}return _0x1e4ddb[_0x0e82('0x1b')](_0x4b748a)['end']();};}function respondWithResult(_0x585b9b,_0x1149b1){_0x1149b1=_0x1149b1||0xc8;return function(_0x582f45){if(_0x582f45){return _0x585b9b[_0x0e82('0x1b')](_0x1149b1)[_0x0e82('0x1c')](_0x582f45);}};}function respondWithFilteredResult(_0x233c6d,_0x315ce4){return function(_0x53622b){if(_0x53622b){var _0x25ac21=typeof _0x315ce4[_0x0e82('0x1d')]===_0x0e82('0x1e')&&typeof _0x315ce4[_0x0e82('0x1f')]===_0x0e82('0x1e');var _0x1230e6=_0x53622b[_0x0e82('0x20')];var _0x3735c0=_0x25ac21?0x0:_0x315ce4[_0x0e82('0x1d')];var _0x224455=_0x25ac21?_0x53622b[_0x0e82('0x20')]:_0x315ce4['offset']+_0x315ce4['limit'];var _0x294696;if(_0x224455>=_0x1230e6){_0x224455=_0x1230e6;_0x294696=0xc8;}else{_0x294696=0xce;}_0x233c6d[_0x0e82('0x1b')](_0x294696);return _0x233c6d[_0x0e82('0x21')](_0x0e82('0x22'),_0x3735c0+'-'+_0x224455+'/'+_0x1230e6)[_0x0e82('0x1c')](_0x53622b);}return null;};}function patchUpdates(_0x1bdad4){return function(_0x39fcbe){try{jsonpatch[_0x0e82('0x23')](_0x39fcbe,_0x1bdad4,!![]);}catch(_0x56b3ad){return BPromise[_0x0e82('0x24')](_0x56b3ad);}return _0x39fcbe[_0x0e82('0x25')]();};}function saveUpdates(_0x3d6c28,_0x24f883){return function(_0x507f08){if(_0x507f08){return _0x507f08[_0x0e82('0x26')](_0x3d6c28)[_0x0e82('0x27')](function(_0x7a9399){return _0x7a9399;});}return null;};}function removeEntity(_0x16e11c,_0x4900d3){return function(_0x1ef751){if(_0x1ef751){return _0x1ef751['destroy']()['then'](function(){var _0x384f88=_0x1ef751[_0x0e82('0x28')]({'plain':!![]});var _0x4c5fc1=_0x0e82('0x29');return db[_0x0e82('0x2a')][_0x0e82('0x2b')]({'where':{'type':_0x4c5fc1,'resourceId':_0x384f88['id']}})['then'](function(){return _0x1ef751;});})[_0x0e82('0x27')](function(){_0x16e11c[_0x0e82('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0xabc536,_0x59a5b6){return function(_0x4300f9){if(!_0x4300f9){_0xabc536[_0x0e82('0x2c')](0x194);}return _0x4300f9;};}function handleError(_0x551f96,_0x38cbbc){_0x38cbbc=_0x38cbbc||0x1f4;return function(_0x268af5){logger[_0x0e82('0x2d')](_0x268af5['stack']);if(_0x268af5['name']){delete _0x268af5[_0x0e82('0x2e')];}_0x551f96['status'](_0x38cbbc)[_0x0e82('0x2f')](_0x268af5);};}exports['index']=function(_0x1a3b2e,_0x264022){var _0x44e177={},_0x56ca79={},_0x45a40e={'count':0x0,'rows':[]};var _0x59d2f8=_[_0x0e82('0x30')](db[_0x0e82('0x31')][_0x0e82('0x32')],function(_0x30c993){return{'name':_0x30c993[_0x0e82('0x33')],'type':_0x30c993[_0x0e82('0x34')]['key']};});_0x56ca79[_0x0e82('0x35')]=_[_0x0e82('0x30')](_0x59d2f8,_0x0e82('0x2e'));_0x56ca79[_0x0e82('0x36')]=_[_0x0e82('0x37')](_0x1a3b2e[_0x0e82('0x36')]);_0x56ca79[_0x0e82('0x38')]=_[_0x0e82('0x39')](_0x56ca79[_0x0e82('0x35')],_0x56ca79[_0x0e82('0x36')]);_0x44e177[_0x0e82('0x3a')]=_[_0x0e82('0x39')](_0x56ca79[_0x0e82('0x35')],qs[_0x0e82('0x3b')](_0x1a3b2e[_0x0e82('0x36')]['fields']));_0x44e177[_0x0e82('0x3a')]=_0x44e177[_0x0e82('0x3a')][_0x0e82('0x3c')]?_0x44e177[_0x0e82('0x3a')]:_0x56ca79['model'];if(!_0x1a3b2e[_0x0e82('0x36')][_0x0e82('0x3d')]('nolimit')){_0x44e177[_0x0e82('0x1f')]=qs['limit'](_0x1a3b2e['query'][_0x0e82('0x1f')]);_0x44e177[_0x0e82('0x1d')]=qs[_0x0e82('0x1d')](_0x1a3b2e[_0x0e82('0x36')][_0x0e82('0x1d')]);}_0x44e177[_0x0e82('0x3e')]=qs[_0x0e82('0x3f')](_0x1a3b2e['query']['sort']);_0x44e177[_0x0e82('0x40')]=qs[_0x0e82('0x38')](_[_0x0e82('0x41')](_0x1a3b2e[_0x0e82('0x36')],_0x56ca79[_0x0e82('0x38')]),_0x59d2f8);if(_0x1a3b2e[_0x0e82('0x36')][_0x0e82('0x42')]){_0x44e177[_0x0e82('0x40')]=_['merge'](_0x44e177[_0x0e82('0x40')],{'$or':_[_0x0e82('0x30')](_0x59d2f8,function(_0x233a18){if(_0x233a18[_0x0e82('0x34')]!==_0x0e82('0x43')){var _0x3d0a45={};_0x3d0a45[_0x233a18[_0x0e82('0x2e')]]={'$like':'%'+_0x1a3b2e['query'][_0x0e82('0x42')]+'%'};return _0x3d0a45;}})});}_0x44e177=_[_0x0e82('0x44')]({},_0x44e177,_0x1a3b2e[_0x0e82('0x45')]);var _0x36fe4c={'where':_0x44e177[_0x0e82('0x40')]};return db[_0x0e82('0x31')][_0x0e82('0x20')](_0x36fe4c)['then'](function(_0x581764){_0x45a40e['count']=_0x581764;if(_0x1a3b2e['query']['includeAll']){_0x44e177['include']=[{'all':!![]}];}return db[_0x0e82('0x31')][_0x0e82('0x46')](_0x44e177);})[_0x0e82('0x27')](function(_0x199495){_0x45a40e[_0x0e82('0x47')]=_0x199495;return _0x45a40e;})[_0x0e82('0x27')](respondWithFilteredResult(_0x264022,_0x44e177))[_0x0e82('0x48')](handleError(_0x264022,null));};exports[_0x0e82('0x49')]=function(_0x55b53a,_0x484f94){var _0x2ae914={'raw':![],'where':{'id':_0x55b53a[_0x0e82('0x4a')]['id']}},_0x36a0c2={};_0x36a0c2[_0x0e82('0x35')]=_[_0x0e82('0x37')](db[_0x0e82('0x31')][_0x0e82('0x32')]);_0x36a0c2[_0x0e82('0x36')]=_['keys'](_0x55b53a[_0x0e82('0x36')]);_0x36a0c2['filters']=_[_0x0e82('0x39')](_0x36a0c2['model'],_0x36a0c2[_0x0e82('0x36')]);_0x2ae914['attributes']=_[_0x0e82('0x39')](_0x36a0c2[_0x0e82('0x35')],qs[_0x0e82('0x3b')](_0x55b53a['query']['fields']));_0x2ae914[_0x0e82('0x3a')]=_0x2ae914[_0x0e82('0x3a')][_0x0e82('0x3c')]?_0x2ae914['attributes']:_0x36a0c2[_0x0e82('0x35')];if(_0x55b53a['query'][_0x0e82('0x4b')]){_0x2ae914[_0x0e82('0x4c')]=[{'all':!![]}];}_0x2ae914=_[_0x0e82('0x44')]({},_0x2ae914,_0x55b53a[_0x0e82('0x45')]);return db[_0x0e82('0x31')][_0x0e82('0x4d')](_0x2ae914)[_0x0e82('0x27')](handleEntityNotFound(_0x484f94,null))[_0x0e82('0x27')](respondWithResult(_0x484f94,null))[_0x0e82('0x48')](handleError(_0x484f94,null));};exports[_0x0e82('0x2b')]=function(_0x41e27e,_0x22c249){return db['VoicePrefix'][_0x0e82('0x4d')]({'where':{'id':_0x41e27e[_0x0e82('0x4a')]['id']}})['then'](handleEntityNotFound(_0x22c249,null))[_0x0e82('0x27')](removeEntity(_0x22c249,null))['catch'](handleError(_0x22c249,null));};exports['describe']=function(_0x42a535,_0x505663){return db[_0x0e82('0x31')][_0x0e82('0x4e')]()[_0x0e82('0x27')](respondWithResult(_0x505663,null))[_0x0e82('0x48')](handleError(_0x505663,null));};exports[_0x0e82('0x4f')]=function(_0x535f6d,_0x104bfe){var _0x4cb6e7;return db[_0x0e82('0x50')][_0x0e82('0x51')](function(_0x42c4a7){return db[_0x0e82('0x31')][_0x0e82('0x4f')](_0x535f6d['body'],{'transaction':_0x42c4a7})[_0x0e82('0x27')](function(_0x22d56b){_0x4cb6e7=_0x22d56b[_0x0e82('0x28')]({'plain':!![]});return db[_0x0e82('0x52')][_0x0e82('0x4d')]({'where':{'id':_0x4cb6e7['VoiceExtensionId']},'raw':!![]})[_0x0e82('0x27')](function(_0x348b00){return createVoicePrefixExtensions(_0x4cb6e7,_0x348b00,_0x42c4a7);});});})[_0x0e82('0x27')](function(){var _0x1e6d69=_0x535f6d[_0x0e82('0x53')][_0x0e82('0x28')]({'plain':!![]});if(!_0x1e6d69)throw new Error(_0x0e82('0x54'));if(_0x1e6d69[_0x0e82('0x55')]===_0x0e82('0x53')){var _0x2852d4=_0x4cb6e7;return db['UserProfileSection']['find']({'where':{'name':'VoicePrefixes','userProfileId':_0x1e6d69[_0x0e82('0x56')]},'raw':!![]})['then'](function(_0x23741c){if(_0x23741c&&_0x23741c[_0x0e82('0x57')]===0x0){return db['UserProfileResource']['create']({'name':_0x2852d4[_0x0e82('0x2e')],'resourceId':_0x2852d4['id'],'type':_0x23741c[_0x0e82('0x2e')],'sectionId':_0x23741c['id']},{})[_0x0e82('0x27')](function(){return _0x4cb6e7;});}else{return _0x4cb6e7;}})[_0x0e82('0x48')](function(_0x174da5){logger[_0x0e82('0x2d')](_0x0e82('0x58'),_0x174da5);throw _0x174da5;});}return _0x4cb6e7;})[_0x0e82('0x27')](respondWithResult(_0x104bfe,null))[_0x0e82('0x48')](handleError(_0x104bfe,null));};function Extension(_0x3b35e0,_0x4ce423,_0x30e9f1,_0x21aaac){this[_0x0e82('0x59')]=_0x0e82('0x5a');this[_0x0e82('0x5b')]=_0x3b35e0;this[_0x0e82('0x5c')]=_0x30e9f1;this[_0x0e82('0x34')]=_0x0e82('0x5d');this['description']=_0x0e82('0x5e');this[_0x0e82('0x5f')]=_0x4ce423;this[_0x0e82('0x60')]=_0x21aaac;}function createVoicePrefixExtensions(_0x1ea2fc,_0x21c870,_0x28f3b7){return new BPromise(function(_0x2d1e59,_0x11ef9e){var _0x20bf0c=new Extension(formatPrefixName(_0x1ea2fc['prefix']),0x1,_0x0e82('0x61'),'Voice\x20Prefix');_0x20bf0c[_0x0e82('0x62')]=_0x1ea2fc['id'];return db['VoiceExtension'][_0x0e82('0x4f')](_0x20bf0c,{'transaction':_0x28f3b7})[_0x0e82('0x27')](function(_0x5f3ec3){var _0x30e0a3=_0x5f3ec3[_0x0e82('0x28')]({'plain':!![]});var _0x244b42=_[_0x0e82('0x30')](addVoicePrefixExtensions(_0x1ea2fc,_0x21c870),function(_0x336df1){_0x336df1['VoiceExtensionId']=_0x30e0a3['id'];_0x336df1[_0x0e82('0x62')]=_0x1ea2fc['id'];return _0x336df1;});return db['VoiceExtension']['bulkCreate'](_0x244b42,{'transaction':_0x28f3b7})[_0x0e82('0x27')](function(_0x2cf29f){if(!_0x2cf29f){return _0x11ef9e(_0x0e82('0x63'));}else{return _0x2d1e59(_0x2cf29f);}})[_0x0e82('0x48')](function(_0x2bdca1){return _0x11ef9e(_0x2bdca1);});});;});};function addVoicePrefixExtensions(_0xa4fe1f,_0xb1a061){var _0x41ef93=[];var _0x277327=formatPrefixName(_0xa4fe1f[_0x0e82('0x64')]);_0x41ef93['push'](new Extension(_0x277327,0x2,'Set',_0x0e82('0x65')+_0xa4fe1f['name']));if(_0xa4fe1f[_0x0e82('0x66')]){_0x41ef93[_0x0e82('0x67')](new Extension(_0x277327,0x3,'Set',_0x0e82('0x68')+_0xa4fe1f[_0x0e82('0x66')]));}else{_0x41ef93['push'](new Extension(_0x277327,0x3,_0x0e82('0x61'),_0x0e82('0x69')));}_0x41ef93['push'](new Extension(_0x277327,0x4,_0x0e82('0x6a'),_0xb1a061['context']+','+_0x0e82('0x6b')+(0x8+_0xa4fe1f[_0x0e82('0x2e')][_0x0e82('0x3c')])+'}'+','+0x1));return _0x41ef93;}function formatPrefixName(_0x3bdc68){var _0x34faf5='_';for(var _0x75a64d=0x0;_0x75a64d<_0x3bdc68[_0x0e82('0x3c')];_0x75a64d++){if(_0x3bdc68[_0x0e82('0x6c')](_0x75a64d)=='-'){_0x34faf5+=_0x3bdc68[_0x0e82('0x6c')](_0x75a64d);}else{_0x34faf5+='['+_0x3bdc68[_0x0e82('0x6c')](_0x75a64d)+']';}}_0x34faf5+='.';return _0x34faf5;}exports['update']=function(_0x39911a,_0x4a696b,_0x131698){var _0x2dfd03=_0x39911a[_0x0e82('0x6d')];_0x2dfd03['prefix']=_0x0e82('0x6e')+_0x2dfd03[_0x0e82('0x2e')]+'-';return db[_0x0e82('0x50')][_0x0e82('0x51')](function(_0x1a67bc){return db['VoicePrefix'][_0x0e82('0x26')](_0x2dfd03,{'where':{'id':_0x2dfd03['id']},'transaction':_0x1a67bc})['then'](function(){return db[_0x0e82('0x52')][_0x0e82('0x2b')]({'where':{'VoicePrefixId':_0x2dfd03['id']},'transaction':_0x1a67bc})['then'](function(){return db['VoiceExtension'][_0x0e82('0x4d')]({'where':{'id':_0x2dfd03[_0x0e82('0x6f')]},'raw':!![]})[_0x0e82('0x27')](function(_0x22791b){return createVoicePrefixExtensions(_0x2dfd03,_0x22791b,_0x1a67bc);});});});})[_0x0e82('0x27')](function(){return db[_0x0e82('0x31')][_0x0e82('0x70')](_0x2dfd03['id']);})[_0x0e82('0x27')](respondWithResult(_0x4a696b,null))[_0x0e82('0x48')](handleError(_0x4a696b,null));};exports['addAgents']=function(_0x4249fd,_0x328d74,_0x480d15){return db['VoicePrefix']['find']({'where':{'id':_0x4249fd[_0x0e82('0x4a')]['id']}})[_0x0e82('0x27')](handleEntityNotFound(_0x328d74,null))[_0x0e82('0x27')](function(_0x542b28){if(_0x542b28){return _0x542b28[_0x0e82('0x71')](_0x4249fd['body'][_0x0e82('0x72')],_[_0x0e82('0x73')](_0x4249fd[_0x0e82('0x6d')],[_0x0e82('0x72'),'id'])||{})[_0x0e82('0x74')](function(_0x48ac18){for(var _0x28097c=0x0;_0x28097c<_0x4249fd[_0x0e82('0x6d')]['ids'][_0x0e82('0x3c')];_0x28097c+=0x1){socket[_0x0e82('0x75')](_0x0e82('0x76'),{'UserId':Number(_0x4249fd['body'][_0x0e82('0x72')][_0x28097c]),'VoicePrefixId':Number(_0x4249fd['params']['id'])});}return _0x48ac18;});}})[_0x0e82('0x27')](respondWithResult(_0x328d74,null))[_0x0e82('0x48')](handleError(_0x328d74,null));};exports[_0x0e82('0x77')]=function(_0x5ca20d,_0xe258d4,_0x115800){return db[_0x0e82('0x31')][_0x0e82('0x4d')]({'where':{'id':_0x5ca20d['params']['id']}})[_0x0e82('0x27')](handleEntityNotFound(_0xe258d4,null))[_0x0e82('0x27')](function(_0x168bf1){if(_0x168bf1){return _0x168bf1[_0x0e82('0x77')](_0x5ca20d[_0x0e82('0x36')]['ids'])[_0x0e82('0x27')](function(){if(_['isArray'](_0x5ca20d[_0x0e82('0x36')]['ids'])){for(var _0x40e10c=0x0;_0x40e10c<_0x5ca20d[_0x0e82('0x36')]['ids'][_0x0e82('0x3c')];_0x40e10c+=0x1){socket[_0x0e82('0x75')](_0x0e82('0x78'),{'UserId':Number(_0x5ca20d['query']['ids'][_0x40e10c]),'VoicePrefixId':Number(_0x5ca20d['params']['id'])});}}else{socket[_0x0e82('0x75')](_0x0e82('0x78'),{'UserId':Number(_0x5ca20d[_0x0e82('0x36')]['ids']),'VoicePrefixId':Number(_0x5ca20d[_0x0e82('0x4a')]['id'])});}});}})[_0x0e82('0x27')](respondWithStatusCode(_0xe258d4,null))[_0x0e82('0x48')](handleError(_0xe258d4,null));};exports[_0x0e82('0x79')]=function(_0x183fe7,_0x27928f,_0x6fcbe1){var _0x446a39={};var _0x556a2d={};var _0x445d82;var _0x384428;return db[_0x0e82('0x31')][_0x0e82('0x7a')]({'where':{'id':_0x183fe7[_0x0e82('0x4a')]['id']}})[_0x0e82('0x27')](handleEntityNotFound(_0x27928f,null))[_0x0e82('0x27')](function(_0x42b39c){if(_0x42b39c){_0x445d82=_0x42b39c;_0x556a2d['model']=_[_0x0e82('0x37')](db['User']['rawAttributes']);_0x556a2d['query']=_[_0x0e82('0x37')](_0x183fe7[_0x0e82('0x36')]);_0x556a2d[_0x0e82('0x38')]=_[_0x0e82('0x39')](_0x556a2d['model'],_0x556a2d[_0x0e82('0x36')]);_0x446a39['attributes']=_[_0x0e82('0x39')](_0x556a2d[_0x0e82('0x35')],qs['fields'](_0x183fe7[_0x0e82('0x36')]['fields']));_0x446a39['attributes']=_0x446a39[_0x0e82('0x3a')][_0x0e82('0x3c')]?_0x446a39['attributes']:_0x556a2d['model'];_0x446a39[_0x0e82('0x3e')]=qs[_0x0e82('0x3f')](_0x183fe7[_0x0e82('0x36')][_0x0e82('0x3f')]);_0x446a39[_0x0e82('0x40')]=qs[_0x0e82('0x38')](_[_0x0e82('0x41')](_0x183fe7[_0x0e82('0x36')],_0x556a2d['filters']));if(_0x183fe7['query'][_0x0e82('0x42')]){_0x446a39[_0x0e82('0x40')]=_[_0x0e82('0x44')](_0x446a39[_0x0e82('0x40')],{'$or':_[_0x0e82('0x30')](_0x446a39[_0x0e82('0x3a')],function(_0x350b6c){var _0x56804d={};_0x56804d[_0x350b6c]={'$like':'%'+_0x183fe7[_0x0e82('0x36')]['filter']+'%'};return _0x56804d;})});}_0x446a39=_['merge']({},_0x446a39,_0x183fe7[_0x0e82('0x45')]);return _0x445d82['getAgents'](_0x446a39);}})[_0x0e82('0x27')](function(_0x2ca1e2){if(_0x2ca1e2){_0x384428=_0x2ca1e2['length'];if(!_0x183fe7[_0x0e82('0x36')][_0x0e82('0x3d')](_0x0e82('0x7b'))){_0x446a39[_0x0e82('0x1f')]=qs[_0x0e82('0x1f')](_0x183fe7[_0x0e82('0x36')][_0x0e82('0x1f')]);_0x446a39['offset']=qs[_0x0e82('0x1d')](_0x183fe7['query']['offset']);}return _0x445d82['getAgents'](_0x446a39);}})[_0x0e82('0x27')](function(_0x30f947){if(_0x30f947){return _0x30f947?{'count':_0x384428,'rows':_0x30f947}:null;}})[_0x0e82('0x27')](respondWithResult(_0x27928f,null))[_0x0e82('0x48')](handleError(_0x27928f,null));};exports[_0x0e82('0x7c')]=function(_0x33eaa3,_0x57d238,_0x890f08){var _0x4a5773={};var _0x5f59f1={};var _0x48bd88;var _0x1fad5a;return db['VoicePrefix']['findOne']({'where':{'id':_0x33eaa3[_0x0e82('0x4a')]['id']}})[_0x0e82('0x27')](handleEntityNotFound(_0x57d238,null))['then'](function(_0x5800a5){if(_0x5800a5){_0x48bd88=_0x5800a5;_0x5f59f1[_0x0e82('0x35')]=_['keys'](db[_0x0e82('0x7d')][_0x0e82('0x32')]);_0x5f59f1[_0x0e82('0x36')]=_['keys'](_0x33eaa3[_0x0e82('0x36')]);_0x5f59f1[_0x0e82('0x38')]=_['intersection'](_0x5f59f1[_0x0e82('0x35')],_0x5f59f1[_0x0e82('0x36')]);_0x4a5773['attributes']=_[_0x0e82('0x39')](_0x5f59f1[_0x0e82('0x35')],qs['fields'](_0x33eaa3[_0x0e82('0x36')][_0x0e82('0x3b')]));_0x4a5773[_0x0e82('0x3a')]=_0x4a5773[_0x0e82('0x3a')]['length']?_0x4a5773['attributes']:_0x5f59f1[_0x0e82('0x35')];_0x4a5773[_0x0e82('0x3e')]=qs[_0x0e82('0x3f')](_0x33eaa3[_0x0e82('0x36')][_0x0e82('0x3f')]);_0x4a5773[_0x0e82('0x40')]=qs[_0x0e82('0x38')](_[_0x0e82('0x41')](_0x33eaa3[_0x0e82('0x36')],_0x5f59f1['filters']));if(_0x33eaa3[_0x0e82('0x36')][_0x0e82('0x42')]){_0x4a5773[_0x0e82('0x40')]=_[_0x0e82('0x44')](_0x4a5773['where'],{'$or':_[_0x0e82('0x30')](_0x4a5773[_0x0e82('0x3a')],function(_0x51b943){var _0x148a2f={};_0x148a2f[_0x51b943]={'$like':'%'+_0x33eaa3[_0x0e82('0x36')][_0x0e82('0x42')]+'%'};return _0x148a2f;})});}_0x4a5773=_[_0x0e82('0x44')]({},_0x4a5773,_0x33eaa3[_0x0e82('0x45')]);return _0x48bd88[_0x0e82('0x7c')](_0x4a5773);}})['then'](function(_0x17a56d){if(_0x17a56d){_0x1fad5a=_0x17a56d['length'];if(!_0x33eaa3[_0x0e82('0x36')][_0x0e82('0x3d')](_0x0e82('0x7b'))){_0x4a5773[_0x0e82('0x1f')]=qs[_0x0e82('0x1f')](_0x33eaa3[_0x0e82('0x36')][_0x0e82('0x1f')]);_0x4a5773[_0x0e82('0x1d')]=qs['offset'](_0x33eaa3[_0x0e82('0x36')][_0x0e82('0x1d')]);}return _0x48bd88[_0x0e82('0x7c')](_0x4a5773);}})['then'](function(_0x273036){if(_0x273036){return _0x273036?{'count':_0x1fad5a,'rows':_0x273036}:null;}})['then'](respondWithResult(_0x57d238,null))[_0x0e82('0x48')](handleError(_0x57d238,null));};exports['addTeams']=function(_0x317358,_0x3691ac,_0x436572){var _0x532041=_0x317358[_0x0e82('0x6d')][_0x0e82('0x72')];var _0xae4be5;return db[_0x0e82('0x7d')]['findAll']({'where':{'id':_0x532041},'attributes':['id'],'include':[{'model':db[_0x0e82('0x7e')],'as':_0x0e82('0x7f'),'attributes':['id',_0x0e82('0x2e'),_0x0e82('0x80'),_0x0e82('0x81'),'interface'],'raw':!![]}]})[_0x0e82('0x27')](function(_0x252df2){if(_0x252df2){_0xae4be5=_0x252df2;var _0xca734b=_[_0x0e82('0x82')](_0x252df2,function(_0x456bad){var _0x4ed7ba=_0x456bad['get']({'plain':!![]});return _0x4ed7ba[_0x0e82('0x7f')];});return db[_0x0e82('0x31')]['find']({'where':{'id':_0x317358['params']['id']}})[_0x0e82('0x27')](function(_0x226726){return db[_0x0e82('0x50')][_0x0e82('0x51')](function(_0x326ed0){return _0x226726[_0x0e82('0x83')](_0x532041,{'transaction':_0x326ed0})['then'](function(){return BPromise[_0x0e82('0x84')](_0xae4be5,function(_0x270ad0){return db[_0x0e82('0x85')][_0x0e82('0x86')]({'TeamId':_0x270ad0['id'],'VoicePrefixId':_0x317358['params']['id']},{'transaction':_0x326ed0});});})['then'](function(){return BPromise[_0x0e82('0x84')](_0xca734b,function(_0x38a73a){return db[_0x0e82('0x87')][_0x0e82('0x88')]({'where':{'UserId':_0x38a73a['id'],'VoicePrefixId':_0x317358[_0x0e82('0x4a')]['id']},'transaction':_0x326ed0});});})['then'](function(){_0xca734b['forEach'](function(_0x3ab464){socket['emit'](_0x0e82('0x76'),{'UserId':_0x3ab464['id'],'VoicePrefixId':_0x226726['id']});});});});});}})['then'](respondWithStatusCode(_0x3691ac,null))[_0x0e82('0x48')](handleError(_0x3691ac,null));};exports[_0x0e82('0x89')]=function(_0x33d446,_0x34d730,_0x1c1a0d){return db[_0x0e82('0x7d')]['findAll']({'where':{'id':_0x33d446['query'][_0x0e82('0x72')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x0e82('0x7f'),'attributes':['id'],'raw':!![]}]})[_0x0e82('0x27')](handleEntityNotFound(_0x34d730,null))[_0x0e82('0x27')](function(_0x1c5350){var _0x396f44=_[_0x0e82('0x30')](_0x1c5350,'id');var _0x1d79b5=[];var _0x1e305f=[];var _0x25c63b=squel['select']();_0x25c63b[_0x0e82('0x8a')](_0x0e82('0x8b'))[_0x0e82('0x8c')](_0x0e82('0x8d'),'tq')[_0x0e82('0x8e')](_0x0e82('0x8f'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x0e82('0x40')](_0x0e82('0x90'),_0x33d446[_0x0e82('0x4a')]['id']);for(var _0x5d13ab=0x0;_0x5d13ab<_0x1c5350[_0x0e82('0x3c')];_0x5d13ab+=0x1){let _0xf8b029=_0x1c5350[_0x5d13ab];for(var _0x5581e6=0x0;_0x5581e6<_0xf8b029[_0x0e82('0x7f')][_0x0e82('0x3c')];_0x5581e6+=0x1){let _0x524665=_0xf8b029[_0x0e82('0x7f')][_0x5581e6];var _0x32264b=_0x25c63b[_0x0e82('0x91')]();_0x32264b[_0x0e82('0x40')](_0x0e82('0x92'),_0x524665['id']);_0x1e305f[_0x0e82('0x67')](db[_0x0e82('0x50')][_0x0e82('0x36')](_0x32264b[_0x0e82('0x93')](),{'type':db[_0x0e82('0x50')]['QueryTypes'][_0x0e82('0x94')]})['then'](function(_0x546f99){if(_0x546f99[_0x0e82('0x3c')]===0x1){return _0x524665['id'];}else{var _0x4b3009=_[_0x0e82('0x95')](_[_0x0e82('0x30')](_0x546f99,_0x0e82('0x96')),function(_0x414250){return _[_0x0e82('0x97')](_0x396f44,_0x414250);});if(_0x4b3009){return _0x524665['id'];}}}));}}return BPromise['all'](_0x1e305f)[_0x0e82('0x27')](function(_0x1df810){_0x1d79b5=_(_0x1d79b5)['union'](_0x1df810)['compact']()[_0x0e82('0x98')]();return db['VoicePrefix'][_0x0e82('0x4d')]({'where':{'id':_0x33d446[_0x0e82('0x4a')]['id']}})[_0x0e82('0x27')](function(_0x4f2118){return db['sequelize'][_0x0e82('0x51')](function(_0x5e7f11){return _0x4f2118[_0x0e82('0x89')](_0x33d446['query'][_0x0e82('0x72')],{'transaction':_0x5e7f11})[_0x0e82('0x27')](function(){if(!_['isEmpty'](_0x1d79b5)){return _0x4f2118[_0x0e82('0x77')](_0x1d79b5,{'transaction':_0x5e7f11});}})[_0x0e82('0x27')](function(){_0x1d79b5['forEach'](function(_0x22da22){socket[_0x0e82('0x75')]('userVoicePrefix:remove',{'UserId':_0x22da22,'VoicePrefixId':_0x4f2118['id']});});});});});});})['then'](respondWithStatusCode(_0x34d730,null))[_0x0e82('0x48')](handleError(_0x34d730,null));}; \ No newline at end of file +var _0xed3c=['apply','save','then','destroy','get','error','stack','name','send','index','map','VoicePrefix','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filters','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','keys','find','params','describe','create','sequelize','transaction','body','VoiceExtensionId','role','user','UserProfileSection','VoicePrefixes','userProfileId','autoAssociation','UserProfileResource','from-sip','app','system','description','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','VoiceExtension','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','${EXTEN:','charAt','update','system-','findById','addAgents','ids','omit','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','findOne','User','getAgents','getTeams','addTeams','findAll','Agents','interface','flatMap','each','upsert','UserVoicePrefix','forEach','Team','select','field','tq.TeamId','from','join','user_has_teams','VoicePrefixId\x20=\x20?','ut.UserId\x20=\x20?','toString','QueryTypes','every','TeamId','union','compact','value','removeTeams','isEmpty','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range'];(function(_0xd91423,_0x1b1079){var _0x5102a6=function(_0x55462f){while(--_0x55462f){_0xd91423['push'](_0xd91423['shift']());}};_0x5102a6(++_0x1b1079);}(_0xed3c,0x1a6));var _0xced3=function(_0x73a84b,_0x23d3bb){_0x73a84b=_0x73a84b-0x0;var _0x9e2a66=_0xed3c[_0x73a84b];return _0x9e2a66;};'use strict';var emlformat=require(_0xced3('0x0'));var rimraf=require(_0xced3('0x1'));var zipdir=require(_0xced3('0x2'));var jsonpatch=require(_0xced3('0x3'));var rp=require('request-promise');var moment=require(_0xced3('0x4'));var BPromise=require(_0xced3('0x5'));var Mustache=require(_0xced3('0x6'));var util=require('util');var path=require('path');var sox=require(_0xced3('0x7'));var csv=require(_0xced3('0x8'));var ejs=require(_0xced3('0x9'));var fs=require('fs');var fs_extra=require(_0xced3('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xced3('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xced3('0xc'));var Redis=require(_0xced3('0xd'));var authService=require(_0xced3('0xe'));var qs=require(_0xced3('0xf'));var as=require(_0xced3('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xced3('0x11'))(_0xced3('0x12'));var utils=require(_0xced3('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xced3('0x14'));var db=require(_0xced3('0x15'))['db'];config[_0xced3('0x16')]=_[_0xced3('0x17')](config[_0xced3('0x16')],{'host':_0xced3('0x18'),'port':0x18eb});var socket=require(_0xced3('0x19'))(new Redis(config['redis']));require(_0xced3('0x1a'))['register'](socket);function respondWithStatusCode(_0xf2db6f,_0x435616){_0x435616=_0x435616||0xcc;return function(_0x20d099){if(_0x20d099){return _0xf2db6f[_0xced3('0x1b')](_0x435616);}return _0xf2db6f['status'](_0x435616)[_0xced3('0x1c')]();};}function respondWithResult(_0x322c2d,_0x4acae6){_0x4acae6=_0x4acae6||0xc8;return function(_0x3b5962){if(_0x3b5962){return _0x322c2d[_0xced3('0x1d')](_0x4acae6)[_0xced3('0x1e')](_0x3b5962);}};}function respondWithFilteredResult(_0x17f611,_0x55dbd5){return function(_0x4569af){if(_0x4569af){var _0x4a3afe=typeof _0x55dbd5[_0xced3('0x1f')]===_0xced3('0x20')&&typeof _0x55dbd5[_0xced3('0x21')]===_0xced3('0x20');var _0x44143f=_0x4569af[_0xced3('0x22')];var _0xe0cf2e=_0x4a3afe?0x0:_0x55dbd5[_0xced3('0x1f')];var _0x3f688c=_0x4a3afe?_0x4569af[_0xced3('0x22')]:_0x55dbd5[_0xced3('0x1f')]+_0x55dbd5['limit'];var _0x5b8b1f;if(_0x3f688c>=_0x44143f){_0x3f688c=_0x44143f;_0x5b8b1f=0xc8;}else{_0x5b8b1f=0xce;}_0x17f611['status'](_0x5b8b1f);return _0x17f611[_0xced3('0x23')](_0xced3('0x24'),_0xe0cf2e+'-'+_0x3f688c+'/'+_0x44143f)[_0xced3('0x1e')](_0x4569af);}return null;};}function patchUpdates(_0x4bf915){return function(_0x19d15c){try{jsonpatch[_0xced3('0x25')](_0x19d15c,_0x4bf915,!![]);}catch(_0x526854){return BPromise['reject'](_0x526854);}return _0x19d15c[_0xced3('0x26')]();};}function saveUpdates(_0x101708,_0x219fa8){return function(_0x15c6c5){if(_0x15c6c5){return _0x15c6c5['update'](_0x101708)[_0xced3('0x27')](function(_0x23f92b){return _0x23f92b;});}return null;};}function removeEntity(_0x4fc285,_0x3fb4f9){return function(_0x4da7ce){if(_0x4da7ce){return _0x4da7ce[_0xced3('0x28')]()[_0xced3('0x27')](function(){var _0x3b728d=_0x4da7ce[_0xced3('0x29')]({'plain':!![]});var _0x2ec2c4='VoicePrefixes';return db['UserProfileResource'][_0xced3('0x28')]({'where':{'type':_0x2ec2c4,'resourceId':_0x3b728d['id']}})['then'](function(){return _0x4da7ce;});})[_0xced3('0x27')](function(){_0x4fc285[_0xced3('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3db664,_0x4024fa){return function(_0x196956){if(!_0x196956){_0x3db664[_0xced3('0x1b')](0x194);}return _0x196956;};}function handleError(_0x4389f8,_0x38f594){_0x38f594=_0x38f594||0x1f4;return function(_0x895a32){logger[_0xced3('0x2a')](_0x895a32[_0xced3('0x2b')]);if(_0x895a32['name']){delete _0x895a32[_0xced3('0x2c')];}_0x4389f8[_0xced3('0x1d')](_0x38f594)[_0xced3('0x2d')](_0x895a32);};}exports[_0xced3('0x2e')]=function(_0x111769,_0x21e4a2){var _0x41ce44={},_0x4f2439={},_0xc8e557={'count':0x0,'rows':[]};var _0x30cd7f=_[_0xced3('0x2f')](db[_0xced3('0x30')][_0xced3('0x31')],function(_0x407a24){return{'name':_0x407a24[_0xced3('0x32')],'type':_0x407a24[_0xced3('0x33')][_0xced3('0x34')]};});_0x4f2439[_0xced3('0x35')]=_[_0xced3('0x2f')](_0x30cd7f,_0xced3('0x2c'));_0x4f2439[_0xced3('0x36')]=_['keys'](_0x111769[_0xced3('0x36')]);_0x4f2439['filters']=_[_0xced3('0x37')](_0x4f2439[_0xced3('0x35')],_0x4f2439[_0xced3('0x36')]);_0x41ce44[_0xced3('0x38')]=_[_0xced3('0x37')](_0x4f2439[_0xced3('0x35')],qs[_0xced3('0x39')](_0x111769[_0xced3('0x36')][_0xced3('0x39')]));_0x41ce44[_0xced3('0x38')]=_0x41ce44['attributes'][_0xced3('0x3a')]?_0x41ce44[_0xced3('0x38')]:_0x4f2439['model'];if(!_0x111769[_0xced3('0x36')][_0xced3('0x3b')](_0xced3('0x3c'))){_0x41ce44['limit']=qs['limit'](_0x111769[_0xced3('0x36')]['limit']);_0x41ce44[_0xced3('0x1f')]=qs[_0xced3('0x1f')](_0x111769['query'][_0xced3('0x1f')]);}_0x41ce44[_0xced3('0x3d')]=qs[_0xced3('0x3e')](_0x111769['query'][_0xced3('0x3e')]);_0x41ce44['where']=qs['filters'](_[_0xced3('0x3f')](_0x111769[_0xced3('0x36')],_0x4f2439[_0xced3('0x40')]),_0x30cd7f);if(_0x111769['query'][_0xced3('0x41')]){_0x41ce44[_0xced3('0x42')]=_[_0xced3('0x43')](_0x41ce44[_0xced3('0x42')],{'$or':_[_0xced3('0x2f')](_0x30cd7f,function(_0x2a8e0e){if(_0x2a8e0e[_0xced3('0x33')]!==_0xced3('0x44')){var _0x9c8a07={};_0x9c8a07[_0x2a8e0e[_0xced3('0x2c')]]={'$like':'%'+_0x111769[_0xced3('0x36')][_0xced3('0x41')]+'%'};return _0x9c8a07;}})});}_0x41ce44=_[_0xced3('0x43')]({},_0x41ce44,_0x111769[_0xced3('0x45')]);var _0x1ced3a={'where':_0x41ce44['where']};return db[_0xced3('0x30')][_0xced3('0x22')](_0x1ced3a)[_0xced3('0x27')](function(_0x1a6c1f){_0xc8e557[_0xced3('0x22')]=_0x1a6c1f;if(_0x111769[_0xced3('0x36')][_0xced3('0x46')]){_0x41ce44[_0xced3('0x47')]=[{'all':!![]}];}return db[_0xced3('0x30')]['findAll'](_0x41ce44);})[_0xced3('0x27')](function(_0x47ab23){_0xc8e557[_0xced3('0x48')]=_0x47ab23;return _0xc8e557;})[_0xced3('0x27')](respondWithFilteredResult(_0x21e4a2,_0x41ce44))[_0xced3('0x49')](handleError(_0x21e4a2,null));};exports['show']=function(_0x11e733,_0x34f24a){var _0x3569f3={'raw':![],'where':{'id':_0x11e733['params']['id']}},_0x26b8ac={};_0x26b8ac[_0xced3('0x35')]=_[_0xced3('0x4a')](db[_0xced3('0x30')][_0xced3('0x31')]);_0x26b8ac[_0xced3('0x36')]=_['keys'](_0x11e733[_0xced3('0x36')]);_0x26b8ac[_0xced3('0x40')]=_[_0xced3('0x37')](_0x26b8ac[_0xced3('0x35')],_0x26b8ac[_0xced3('0x36')]);_0x3569f3[_0xced3('0x38')]=_[_0xced3('0x37')](_0x26b8ac['model'],qs[_0xced3('0x39')](_0x11e733[_0xced3('0x36')]['fields']));_0x3569f3['attributes']=_0x3569f3[_0xced3('0x38')]['length']?_0x3569f3[_0xced3('0x38')]:_0x26b8ac[_0xced3('0x35')];if(_0x11e733[_0xced3('0x36')][_0xced3('0x46')]){_0x3569f3[_0xced3('0x47')]=[{'all':!![]}];}_0x3569f3=_[_0xced3('0x43')]({},_0x3569f3,_0x11e733[_0xced3('0x45')]);return db[_0xced3('0x30')][_0xced3('0x4b')](_0x3569f3)['then'](handleEntityNotFound(_0x34f24a,null))[_0xced3('0x27')](respondWithResult(_0x34f24a,null))[_0xced3('0x49')](handleError(_0x34f24a,null));};exports[_0xced3('0x28')]=function(_0x469b6,_0x24ee62){return db[_0xced3('0x30')]['find']({'where':{'id':_0x469b6[_0xced3('0x4c')]['id']}})[_0xced3('0x27')](handleEntityNotFound(_0x24ee62,null))[_0xced3('0x27')](removeEntity(_0x24ee62,null))[_0xced3('0x49')](handleError(_0x24ee62,null));};exports[_0xced3('0x4d')]=function(_0x14dbfe,_0x1543b0){return db[_0xced3('0x30')][_0xced3('0x4d')]()[_0xced3('0x27')](respondWithResult(_0x1543b0,null))[_0xced3('0x49')](handleError(_0x1543b0,null));};exports[_0xced3('0x4e')]=function(_0x4a9111,_0x1c69df){var _0x4bd3cb;return db[_0xced3('0x4f')][_0xced3('0x50')](function(_0xc93e05){return db['VoicePrefix']['create'](_0x4a9111[_0xced3('0x51')],{'transaction':_0xc93e05})[_0xced3('0x27')](function(_0x53724a){_0x4bd3cb=_0x53724a[_0xced3('0x29')]({'plain':!![]});return db['VoiceExtension'][_0xced3('0x4b')]({'where':{'id':_0x4bd3cb[_0xced3('0x52')]},'raw':!![]})['then'](function(_0x1627f9){return createVoicePrefixExtensions(_0x4bd3cb,_0x1627f9,_0xc93e05);});});})[_0xced3('0x27')](function(){var _0xf4d7bf=_0x4a9111['user'][_0xced3('0x29')]({'plain':!![]});if(!_0xf4d7bf)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xf4d7bf[_0xced3('0x53')]===_0xced3('0x54')){var _0x4694b8=_0x4bd3cb;return db[_0xced3('0x55')][_0xced3('0x4b')]({'where':{'name':_0xced3('0x56'),'userProfileId':_0xf4d7bf[_0xced3('0x57')]},'raw':!![]})[_0xced3('0x27')](function(_0x1b2592){if(_0x1b2592&&_0x1b2592[_0xced3('0x58')]===0x0){return db[_0xced3('0x59')]['create']({'name':_0x4694b8[_0xced3('0x2c')],'resourceId':_0x4694b8['id'],'type':_0x1b2592[_0xced3('0x2c')],'sectionId':_0x1b2592['id']},{})[_0xced3('0x27')](function(){return _0x4bd3cb;});}else{return _0x4bd3cb;}})[_0xced3('0x49')](function(_0x21a22d){logger[_0xced3('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x21a22d);throw _0x21a22d;});}return _0x4bd3cb;})[_0xced3('0x27')](respondWithResult(_0x1c69df,null))[_0xced3('0x49')](handleError(_0x1c69df,null));};function Extension(_0x21ea6a,_0x440a0f,_0x443469,_0x1537ca){this['context']=_0xced3('0x5a');this['exten']=_0x21ea6a;this[_0xced3('0x5b')]=_0x443469;this['type']=_0xced3('0x5c');this[_0xced3('0x5d')]='Voice\x20Prefix\x20Extension';this[_0xced3('0x5e')]=_0x440a0f;this[_0xced3('0x5f')]=_0x1537ca;}function createVoicePrefixExtensions(_0x76d1f6,_0x3bb7d5,_0x1ec94b){return new BPromise(function(_0x21eeec,_0x2318a0){var _0x206dd3=new Extension(formatPrefixName(_0x76d1f6[_0xced3('0x60')]),0x1,_0xced3('0x61'),_0xced3('0x62'));_0x206dd3[_0xced3('0x63')]=_0x76d1f6['id'];return db[_0xced3('0x64')]['create'](_0x206dd3,{'transaction':_0x1ec94b})[_0xced3('0x27')](function(_0xb2b5d7){var _0x2857c8=_0xb2b5d7[_0xced3('0x29')]({'plain':!![]});var _0x4f8a3f=_[_0xced3('0x2f')](addVoicePrefixExtensions(_0x76d1f6,_0x3bb7d5),function(_0x979b24){_0x979b24[_0xced3('0x52')]=_0x2857c8['id'];_0x979b24[_0xced3('0x63')]=_0x76d1f6['id'];return _0x979b24;});return db[_0xced3('0x64')][_0xced3('0x65')](_0x4f8a3f,{'transaction':_0x1ec94b})[_0xced3('0x27')](function(_0x4df923){if(!_0x4df923){return _0x2318a0(_0xced3('0x66'));}else{return _0x21eeec(_0x4df923);}})[_0xced3('0x49')](function(_0x5db4eb){return _0x2318a0(_0x5db4eb);});});;});};function addVoicePrefixExtensions(_0x1630d7,_0xde15b5){var _0x3a9dac=[];var _0x2ac060=formatPrefixName(_0x1630d7['prefix']);_0x3a9dac[_0xced3('0x67')](new Extension(_0x2ac060,0x2,_0xced3('0x68'),_0xced3('0x69')+_0x1630d7[_0xced3('0x2c')]));if(_0x1630d7[_0xced3('0x6a')]){_0x3a9dac[_0xced3('0x67')](new Extension(_0x2ac060,0x3,_0xced3('0x68'),_0xced3('0x6b')+_0x1630d7[_0xced3('0x6a')]));}else{_0x3a9dac[_0xced3('0x67')](new Extension(_0x2ac060,0x3,'NoOp',_0xced3('0x6c')));}_0x3a9dac[_0xced3('0x67')](new Extension(_0x2ac060,0x4,'goto',_0xde15b5['context']+','+_0xced3('0x6d')+(0x8+_0x1630d7['name'][_0xced3('0x3a')])+'}'+','+0x1));return _0x3a9dac;}function formatPrefixName(_0x256216){var _0x5e3d3d='_';for(var _0x2936b5=0x0;_0x2936b5<_0x256216[_0xced3('0x3a')];_0x2936b5++){if(_0x256216['charAt'](_0x2936b5)=='-'){_0x5e3d3d+=_0x256216[_0xced3('0x6e')](_0x2936b5);}else{_0x5e3d3d+='['+_0x256216['charAt'](_0x2936b5)+']';}}_0x5e3d3d+='.';return _0x5e3d3d;}exports[_0xced3('0x6f')]=function(_0x58b66b,_0xf8ccc6,_0x3c9de8){var _0x11f393=_0x58b66b['body'];_0x11f393[_0xced3('0x60')]=_0xced3('0x70')+_0x11f393[_0xced3('0x2c')]+'-';return db['sequelize'][_0xced3('0x50')](function(_0x1abe1a){return db[_0xced3('0x30')][_0xced3('0x6f')](_0x11f393,{'where':{'id':_0x11f393['id']},'transaction':_0x1abe1a})['then'](function(){return db['VoiceExtension'][_0xced3('0x28')]({'where':{'VoicePrefixId':_0x11f393['id']},'transaction':_0x1abe1a})[_0xced3('0x27')](function(){return db[_0xced3('0x64')][_0xced3('0x4b')]({'where':{'id':_0x11f393[_0xced3('0x52')]},'raw':!![]})[_0xced3('0x27')](function(_0x55da18){return createVoicePrefixExtensions(_0x11f393,_0x55da18,_0x1abe1a);});});});})[_0xced3('0x27')](function(){return db['VoicePrefix'][_0xced3('0x71')](_0x11f393['id']);})[_0xced3('0x27')](respondWithResult(_0xf8ccc6,null))[_0xced3('0x49')](handleError(_0xf8ccc6,null));};exports[_0xced3('0x72')]=function(_0x569055,_0x24d0ad,_0x22e74d){return db['VoicePrefix']['find']({'where':{'id':_0x569055[_0xced3('0x4c')]['id']}})[_0xced3('0x27')](handleEntityNotFound(_0x24d0ad,null))[_0xced3('0x27')](function(_0x138e25){if(_0x138e25){return _0x138e25[_0xced3('0x72')](_0x569055['body'][_0xced3('0x73')],_[_0xced3('0x74')](_0x569055[_0xced3('0x51')],[_0xced3('0x73'),'id'])||{})['spread'](function(_0x13020d){for(var _0x1777eb=0x0;_0x1777eb<_0x569055[_0xced3('0x51')][_0xced3('0x73')][_0xced3('0x3a')];_0x1777eb+=0x1){socket[_0xced3('0x75')](_0xced3('0x76'),{'UserId':Number(_0x569055[_0xced3('0x51')][_0xced3('0x73')][_0x1777eb]),'VoicePrefixId':Number(_0x569055[_0xced3('0x4c')]['id'])});}return _0x13020d;});}})['then'](respondWithResult(_0x24d0ad,null))[_0xced3('0x49')](handleError(_0x24d0ad,null));};exports[_0xced3('0x77')]=function(_0x498ea9,_0x284cf2,_0xeef6f4){return db[_0xced3('0x30')][_0xced3('0x4b')]({'where':{'id':_0x498ea9[_0xced3('0x4c')]['id']}})['then'](handleEntityNotFound(_0x284cf2,null))[_0xced3('0x27')](function(_0x3e561e){if(_0x3e561e){return _0x3e561e['removeAgents'](_0x498ea9[_0xced3('0x36')][_0xced3('0x73')])[_0xced3('0x27')](function(){if(_[_0xced3('0x78')](_0x498ea9[_0xced3('0x36')][_0xced3('0x73')])){for(var _0x5c68e1=0x0;_0x5c68e1<_0x498ea9[_0xced3('0x36')][_0xced3('0x73')][_0xced3('0x3a')];_0x5c68e1+=0x1){socket[_0xced3('0x75')](_0xced3('0x79'),{'UserId':Number(_0x498ea9[_0xced3('0x36')]['ids'][_0x5c68e1]),'VoicePrefixId':Number(_0x498ea9['params']['id'])});}}else{socket[_0xced3('0x75')](_0xced3('0x79'),{'UserId':Number(_0x498ea9[_0xced3('0x36')][_0xced3('0x73')]),'VoicePrefixId':Number(_0x498ea9[_0xced3('0x4c')]['id'])});}});}})[_0xced3('0x27')](respondWithStatusCode(_0x284cf2,null))[_0xced3('0x49')](handleError(_0x284cf2,null));};exports['getAgents']=function(_0x3d64ec,_0x290ca3,_0x51979a){var _0x5de22d={};var _0x12de12={};var _0x29f8b5;var _0x3b07ac;return db[_0xced3('0x30')][_0xced3('0x7a')]({'where':{'id':_0x3d64ec['params']['id']}})[_0xced3('0x27')](handleEntityNotFound(_0x290ca3,null))['then'](function(_0x34edbf){if(_0x34edbf){_0x29f8b5=_0x34edbf;_0x12de12[_0xced3('0x35')]=_[_0xced3('0x4a')](db[_0xced3('0x7b')][_0xced3('0x31')]);_0x12de12['query']=_[_0xced3('0x4a')](_0x3d64ec[_0xced3('0x36')]);_0x12de12[_0xced3('0x40')]=_[_0xced3('0x37')](_0x12de12['model'],_0x12de12['query']);_0x5de22d[_0xced3('0x38')]=_[_0xced3('0x37')](_0x12de12[_0xced3('0x35')],qs[_0xced3('0x39')](_0x3d64ec[_0xced3('0x36')][_0xced3('0x39')]));_0x5de22d[_0xced3('0x38')]=_0x5de22d[_0xced3('0x38')]['length']?_0x5de22d['attributes']:_0x12de12[_0xced3('0x35')];_0x5de22d[_0xced3('0x3d')]=qs[_0xced3('0x3e')](_0x3d64ec[_0xced3('0x36')][_0xced3('0x3e')]);_0x5de22d[_0xced3('0x42')]=qs[_0xced3('0x40')](_[_0xced3('0x3f')](_0x3d64ec[_0xced3('0x36')],_0x12de12[_0xced3('0x40')]));if(_0x3d64ec[_0xced3('0x36')]['filter']){_0x5de22d[_0xced3('0x42')]=_['merge'](_0x5de22d[_0xced3('0x42')],{'$or':_[_0xced3('0x2f')](_0x5de22d[_0xced3('0x38')],function(_0x3ad616){var _0x1df2d1={};_0x1df2d1[_0x3ad616]={'$like':'%'+_0x3d64ec[_0xced3('0x36')][_0xced3('0x41')]+'%'};return _0x1df2d1;})});}_0x5de22d=_[_0xced3('0x43')]({},_0x5de22d,_0x3d64ec[_0xced3('0x45')]);return _0x29f8b5[_0xced3('0x7c')](_0x5de22d);}})[_0xced3('0x27')](function(_0x3869f3){if(_0x3869f3){_0x3b07ac=_0x3869f3[_0xced3('0x3a')];if(!_0x3d64ec[_0xced3('0x36')][_0xced3('0x3b')](_0xced3('0x3c'))){_0x5de22d[_0xced3('0x21')]=qs['limit'](_0x3d64ec['query']['limit']);_0x5de22d[_0xced3('0x1f')]=qs[_0xced3('0x1f')](_0x3d64ec[_0xced3('0x36')][_0xced3('0x1f')]);}return _0x29f8b5[_0xced3('0x7c')](_0x5de22d);}})[_0xced3('0x27')](function(_0x587891){if(_0x587891){return _0x587891?{'count':_0x3b07ac,'rows':_0x587891}:null;}})[_0xced3('0x27')](respondWithResult(_0x290ca3,null))[_0xced3('0x49')](handleError(_0x290ca3,null));};exports['getTeams']=function(_0x5e6a80,_0x451c1a,_0x3284da){var _0x34ebbd={};var _0x4412cc={};var _0x3e5f7f;var _0x3b3a5c;return db['VoicePrefix'][_0xced3('0x7a')]({'where':{'id':_0x5e6a80['params']['id']}})[_0xced3('0x27')](handleEntityNotFound(_0x451c1a,null))[_0xced3('0x27')](function(_0x44a80b){if(_0x44a80b){_0x3e5f7f=_0x44a80b;_0x4412cc['model']=_['keys'](db['Team'][_0xced3('0x31')]);_0x4412cc[_0xced3('0x36')]=_['keys'](_0x5e6a80[_0xced3('0x36')]);_0x4412cc[_0xced3('0x40')]=_['intersection'](_0x4412cc[_0xced3('0x35')],_0x4412cc[_0xced3('0x36')]);_0x34ebbd[_0xced3('0x38')]=_[_0xced3('0x37')](_0x4412cc[_0xced3('0x35')],qs[_0xced3('0x39')](_0x5e6a80[_0xced3('0x36')][_0xced3('0x39')]));_0x34ebbd['attributes']=_0x34ebbd[_0xced3('0x38')][_0xced3('0x3a')]?_0x34ebbd[_0xced3('0x38')]:_0x4412cc[_0xced3('0x35')];_0x34ebbd[_0xced3('0x3d')]=qs[_0xced3('0x3e')](_0x5e6a80[_0xced3('0x36')][_0xced3('0x3e')]);_0x34ebbd[_0xced3('0x42')]=qs[_0xced3('0x40')](_[_0xced3('0x3f')](_0x5e6a80[_0xced3('0x36')],_0x4412cc[_0xced3('0x40')]));if(_0x5e6a80[_0xced3('0x36')][_0xced3('0x41')]){_0x34ebbd['where']=_[_0xced3('0x43')](_0x34ebbd[_0xced3('0x42')],{'$or':_[_0xced3('0x2f')](_0x34ebbd[_0xced3('0x38')],function(_0x2c59f5){var _0x5874b5={};_0x5874b5[_0x2c59f5]={'$like':'%'+_0x5e6a80['query'][_0xced3('0x41')]+'%'};return _0x5874b5;})});}_0x34ebbd=_[_0xced3('0x43')]({},_0x34ebbd,_0x5e6a80[_0xced3('0x45')]);return _0x3e5f7f[_0xced3('0x7d')](_0x34ebbd);}})[_0xced3('0x27')](function(_0x26920d){if(_0x26920d){_0x3b3a5c=_0x26920d[_0xced3('0x3a')];if(!_0x5e6a80['query']['hasOwnProperty'](_0xced3('0x3c'))){_0x34ebbd['limit']=qs[_0xced3('0x21')](_0x5e6a80[_0xced3('0x36')][_0xced3('0x21')]);_0x34ebbd[_0xced3('0x1f')]=qs[_0xced3('0x1f')](_0x5e6a80[_0xced3('0x36')][_0xced3('0x1f')]);}return _0x3e5f7f[_0xced3('0x7d')](_0x34ebbd);}})[_0xced3('0x27')](function(_0x2b688c){if(_0x2b688c){return _0x2b688c?{'count':_0x3b3a5c,'rows':_0x2b688c}:null;}})[_0xced3('0x27')](respondWithResult(_0x451c1a,null))[_0xced3('0x49')](handleError(_0x451c1a,null));};exports[_0xced3('0x7e')]=function(_0xbd91ef,_0x561aca,_0x4b2f62){var _0x361c6f=_0xbd91ef['body'][_0xced3('0x73')];var _0x4f0fcb;return db['Team'][_0xced3('0x7f')]({'where':{'id':_0x361c6f},'attributes':['id'],'include':[{'model':db[_0xced3('0x7b')],'as':_0xced3('0x80'),'attributes':['id',_0xced3('0x2c'),'online','voicePause',_0xced3('0x81')],'raw':!![]}]})[_0xced3('0x27')](function(_0x2f2f77){if(_0x2f2f77){_0x4f0fcb=_0x2f2f77;var _0x5448d5=_[_0xced3('0x82')](_0x2f2f77,function(_0x50cc83){var _0x4b6afc=_0x50cc83[_0xced3('0x29')]({'plain':!![]});return _0x4b6afc[_0xced3('0x80')];});return db[_0xced3('0x30')][_0xced3('0x4b')]({'where':{'id':_0xbd91ef[_0xced3('0x4c')]['id']}})[_0xced3('0x27')](function(_0x420c12){return db[_0xced3('0x4f')]['transaction'](function(_0x566191){return _0x420c12[_0xced3('0x7e')](_0x361c6f,{'transaction':_0x566191})['then'](function(){return BPromise[_0xced3('0x83')](_0x4f0fcb,function(_0x239dda){return db['TeamVoicePrefix'][_0xced3('0x84')]({'TeamId':_0x239dda['id'],'VoicePrefixId':_0xbd91ef[_0xced3('0x4c')]['id']},{'transaction':_0x566191});});})[_0xced3('0x27')](function(){return BPromise[_0xced3('0x83')](_0x5448d5,function(_0x7fb3c7){return db[_0xced3('0x85')]['findOrCreate']({'where':{'UserId':_0x7fb3c7['id'],'VoicePrefixId':_0xbd91ef[_0xced3('0x4c')]['id']},'transaction':_0x566191});});})[_0xced3('0x27')](function(){_0x5448d5[_0xced3('0x86')](function(_0x3d88fc){socket[_0xced3('0x75')](_0xced3('0x76'),{'UserId':_0x3d88fc['id'],'VoicePrefixId':_0x420c12['id']});});});});});}})['then'](respondWithStatusCode(_0x561aca,null))['catch'](handleError(_0x561aca,null));};exports['removeTeams']=function(_0x4074b9,_0x2e2303,_0x26af34){return db[_0xced3('0x87')][_0xced3('0x7f')]({'where':{'id':_0x4074b9['query']['ids']},'attributes':['id'],'include':[{'model':db[_0xced3('0x7b')],'as':_0xced3('0x80'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x2e2303,null))['then'](function(_0xdec3b0){var _0x38a06b=_[_0xced3('0x2f')](_0xdec3b0,'id');var _0xbeffe6=[];var _0x2211ed=[];var _0x22ab59=squel[_0xced3('0x88')]();_0x22ab59[_0xced3('0x89')](_0xced3('0x8a'))[_0xced3('0x8b')]('team_has_voice_prefixes','tq')[_0xced3('0x8c')](_0xced3('0x8d'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xced3('0x42')](_0xced3('0x8e'),_0x4074b9[_0xced3('0x4c')]['id']);for(var _0x268c72=0x0;_0x268c72<_0xdec3b0[_0xced3('0x3a')];_0x268c72+=0x1){let _0x26daab=_0xdec3b0[_0x268c72];for(var _0x1ab60d=0x0;_0x1ab60d<_0x26daab[_0xced3('0x80')]['length'];_0x1ab60d+=0x1){let _0x5dd10b=_0x26daab[_0xced3('0x80')][_0x1ab60d];var _0x173a37=_0x22ab59['clone']();_0x173a37[_0xced3('0x42')](_0xced3('0x8f'),_0x5dd10b['id']);_0x2211ed[_0xced3('0x67')](db[_0xced3('0x4f')][_0xced3('0x36')](_0x173a37[_0xced3('0x90')](),{'type':db['sequelize'][_0xced3('0x91')]['SELECT']})['then'](function(_0x2ed48f){if(_0x2ed48f[_0xced3('0x3a')]===0x1){return _0x5dd10b['id'];}else{var _0x21f013=_[_0xced3('0x92')](_['map'](_0x2ed48f,_0xced3('0x93')),function(_0x1082c0){return _['includes'](_0x38a06b,_0x1082c0);});if(_0x21f013){return _0x5dd10b['id'];}}}));}}return BPromise['all'](_0x2211ed)['then'](function(_0x3e8ed7){_0xbeffe6=_(_0xbeffe6)[_0xced3('0x94')](_0x3e8ed7)[_0xced3('0x95')]()[_0xced3('0x96')]();return db[_0xced3('0x30')][_0xced3('0x4b')]({'where':{'id':_0x4074b9[_0xced3('0x4c')]['id']}})[_0xced3('0x27')](function(_0x235faa){return db[_0xced3('0x4f')]['transaction'](function(_0x5e9fba){return _0x235faa[_0xced3('0x97')](_0x4074b9[_0xced3('0x36')]['ids'],{'transaction':_0x5e9fba})['then'](function(){if(!_[_0xced3('0x98')](_0xbeffe6)){return _0x235faa[_0xced3('0x77')](_0xbeffe6,{'transaction':_0x5e9fba});}})[_0xced3('0x27')](function(){_0xbeffe6['forEach'](function(_0x473c70){socket['emit'](_0xced3('0x79'),{'UserId':_0x473c70,'VoicePrefixId':_0x235faa['id']});});});});});});})['then'](respondWithStatusCode(_0x2e2303,null))[_0xced3('0x49')](handleError(_0x2e2303,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 0a6d6f6..fc8a038 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 _0x8e47=['remove','hasOwnProperty','exports','events','../../mysqldb','VoicePrefix','setMaxListeners','save','update'];(function(_0x567647,_0x6e3e0d){var _0x440702=function(_0x1edaa0){while(--_0x1edaa0){_0x567647['push'](_0x567647['shift']());}};_0x440702(++_0x6e3e0d);}(_0x8e47,0xdb));var _0x78e4=function(_0xf9b7a3,_0x2a66f4){_0xf9b7a3=_0xf9b7a3-0x0;var _0x25f0a2=_0x8e47[_0xf9b7a3];return _0x25f0a2;};'use strict';var EventEmitter=require(_0x78e4('0x0'));var VoicePrefix=require(_0x78e4('0x1'))['db'][_0x78e4('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x78e4('0x3')](0x0);var events={'afterCreate':_0x78e4('0x4'),'afterUpdate':_0x78e4('0x5'),'afterDestroy':_0x78e4('0x6')};function emitEvent(_0x235d3e){return function(_0x2bf9d2,_0x32905d,_0x1c2818){VoicePrefixEvents['emit'](_0x235d3e+':'+_0x2bf9d2['id'],_0x2bf9d2);VoicePrefixEvents['emit'](_0x235d3e,_0x2bf9d2);_0x1c2818(null);};}for(var e in events){if(events[_0x78e4('0x7')](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module[_0x78e4('0x8')]=VoicePrefixEvents; \ No newline at end of file +var _0xa77c=['VoicePrefix','save','update','remove','emit','hook','exports','events','../../mysqldb'];(function(_0x8c8176,_0x5360a1){var _0x4dc47b=function(_0x1a7f65){while(--_0x1a7f65){_0x8c8176['push'](_0x8c8176['shift']());}};_0x4dc47b(++_0x5360a1);}(_0xa77c,0x19c));var _0xca77=function(_0x27520b,_0x2cffba){_0x27520b=_0x27520b-0x0;var _0x473104=_0xa77c[_0x27520b];return _0x473104;};'use strict';var EventEmitter=require(_0xca77('0x0'));var VoicePrefix=require(_0xca77('0x1'))['db'][_0xca77('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xca77('0x3'),'afterUpdate':_0xca77('0x4'),'afterDestroy':_0xca77('0x5')};function emitEvent(_0x4b25b5){return function(_0x21b595,_0x3f4023,_0x1c3b36){VoicePrefixEvents[_0xca77('0x6')](_0x4b25b5+':'+_0x21b595['id'],_0x21b595);VoicePrefixEvents[_0xca77('0x6')](_0x4b25b5,_0x21b595);_0x1c3b36(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoicePrefix[_0xca77('0x7')](e,emitEvent(event));}}module[_0xca77('0x8')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 2a6b82b..7588f44 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 _0x393f=['request-promise','path','rimraf','./voicePrefix.attributes','exports','voice_prefixes','util','../../config/logger','api','moment'];(function(_0x31b9cf,_0x1a809b){var _0x357b8a=function(_0x50a273){while(--_0x50a273){_0x31b9cf['push'](_0x31b9cf['shift']());}};_0x357b8a(++_0x1a809b);}(_0x393f,0x74));var _0xf393=function(_0x121985,_0x252db3){_0x121985=_0x121985-0x0;var _0x20bc79=_0x393f[_0x121985];return _0x20bc79;};'use strict';var _=require('lodash');var util=require(_0xf393('0x0'));var logger=require(_0xf393('0x1'))(_0xf393('0x2'));var moment=require(_0xf393('0x3'));var BPromise=require('bluebird');var rp=require(_0xf393('0x4'));var fs=require('fs');var path=require(_0xf393('0x5'));var rimraf=require(_0xf393('0x6'));var config=require('../../config/environment');var attributes=require(_0xf393('0x7'));module[_0xf393('0x8')]=function(_0x4d1fc3,_0x329a86){return _0x4d1fc3['define']('VoicePrefix',attributes,{'tableName':_0xf393('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe158=['voice_prefixes','lodash','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./voicePrefix.attributes','exports','VoicePrefix'];(function(_0x2b9236,_0x2d42c7){var _0x17e247=function(_0x2fb533){while(--_0x2fb533){_0x2b9236['push'](_0x2b9236['shift']());}};_0x17e247(++_0x2d42c7);}(_0xe158,0xb1));var _0x8e15=function(_0x4067ac,_0x363603){_0x4067ac=_0x4067ac-0x0;var _0x53d74d=_0xe158[_0x4067ac];return _0x53d74d;};'use strict';var _=require(_0x8e15('0x0'));var util=require('util');var logger=require(_0x8e15('0x1'))(_0x8e15('0x2'));var moment=require('moment');var BPromise=require(_0x8e15('0x3'));var rp=require(_0x8e15('0x4'));var fs=require('fs');var path=require(_0x8e15('0x5'));var rimraf=require('rimraf');var config=require(_0x8e15('0x6'));var attributes=require(_0x8e15('0x7'));module[_0x8e15('0x8')]=function(_0x35204a,_0x163170){return _0x35204a['define'](_0x8e15('0x9'),attributes,{'tableName':_0x8e15('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 bb4db5c..64a2764 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 _0xffd6=['../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','request','then','VoicePrefix,\x20%s,\x20%s','request\x20sent','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','lodash','util','moment','ioredis','../../mysqldb'];(function(_0x4f027d,_0x3f9587){var _0xc46890=function(_0x27d06c){while(--_0x27d06c){_0x4f027d['push'](_0x4f027d['shift']());}};_0xc46890(++_0x3f9587);}(_0xffd6,0x97));var _0x6ffd=function(_0x1e4150,_0x55b02a){_0x1e4150=_0x1e4150-0x0;var _0x1ce3ee=_0xffd6[_0x1e4150];return _0x1ce3ee;};'use strict';var _=require(_0x6ffd('0x0'));var util=require(_0x6ffd('0x1'));var moment=require(_0x6ffd('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6ffd('0x3'));var db=require(_0x6ffd('0x4'))['db'];var utils=require(_0x6ffd('0x5'));var logger=require('../../config/logger')(_0x6ffd('0x6'));var config=require(_0x6ffd('0x7'));var jayson=require(_0x6ffd('0x8'));var client=jayson[_0x6ffd('0x9')]['http']({'port':0x232a});config[_0x6ffd('0xa')]=_[_0x6ffd('0xb')](config[_0x6ffd('0xa')],{'host':_0x6ffd('0xc'),'port':0x18eb});var socket=require(_0x6ffd('0xd'))(new Redis(config['redis']));require(_0x6ffd('0xe'))[_0x6ffd('0xf')](socket);function respondWithRpcPromise(_0x4e57f5,_0x469d0d,_0x38fc68){return new BPromise(function(_0x23f7f2,_0x3dda1e){return client[_0x6ffd('0x10')](_0x4e57f5,_0x38fc68)[_0x6ffd('0x11')](function(_0x836501){logger['info'](_0x6ffd('0x12'),_0x469d0d,_0x6ffd('0x13'));logger['debug'](_0x6ffd('0x14'),_0x469d0d,_0x6ffd('0x13'),JSON[_0x6ffd('0x15')](_0x836501));if(_0x836501[_0x6ffd('0x16')]){if(_0x836501['error'][_0x6ffd('0x17')]===0x1f4){logger['error'](_0x6ffd('0x12'),_0x469d0d,_0x836501['error'][_0x6ffd('0x18')]);return _0x3dda1e(_0x836501[_0x6ffd('0x16')][_0x6ffd('0x18')]);}logger['error'](_0x6ffd('0x12'),_0x469d0d,_0x836501[_0x6ffd('0x16')][_0x6ffd('0x18')]);return _0x23f7f2(_0x836501[_0x6ffd('0x16')][_0x6ffd('0x18')]);}else{logger[_0x6ffd('0x19')](_0x6ffd('0x12'),_0x469d0d,_0x6ffd('0x13'));_0x23f7f2(_0x836501['result'][_0x6ffd('0x18')]);}})['catch'](function(_0x587d0b){logger[_0x6ffd('0x16')](_0x6ffd('0x12'),_0x469d0d,_0x587d0b);_0x3dda1e(_0x587d0b);});});} \ No newline at end of file +var _0x63d4=['../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','register','request','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x63d4,0x117));var _0x463d=function(_0x51dbdb,_0x23f064){_0x51dbdb=_0x51dbdb-0x0;var _0x4394de=_0x63d4[_0x51dbdb];return _0x4394de;};'use strict';var _=require(_0x463d('0x0'));var util=require(_0x463d('0x1'));var moment=require(_0x463d('0x2'));var BPromise=require('bluebird');var rs=require(_0x463d('0x3'));var fs=require('fs');var Redis=require(_0x463d('0x4'));var db=require(_0x463d('0x5'))['db'];var utils=require(_0x463d('0x6'));var logger=require(_0x463d('0x7'))('rpc');var config=require(_0x463d('0x8'));var jayson=require(_0x463d('0x9'));var client=jayson['client'][_0x463d('0xa')]({'port':0x232a});config[_0x463d('0xb')]=_[_0x463d('0xc')](config[_0x463d('0xb')],{'host':_0x463d('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x463d('0xb')]));require('./voicePrefix.socket')[_0x463d('0xe')](socket);function respondWithRpcPromise(_0x2d714b,_0x1f5d4a,_0xecad46){return new BPromise(function(_0x4c7bcc,_0x4c7afd){return client[_0x463d('0xf')](_0x2d714b,_0xecad46)['then'](function(_0x39d97c){logger[_0x463d('0x10')](_0x463d('0x11'),_0x1f5d4a,_0x463d('0x12'));logger[_0x463d('0x13')](_0x463d('0x14'),_0x1f5d4a,_0x463d('0x12'),JSON['stringify'](_0x39d97c));if(_0x39d97c[_0x463d('0x15')]){if(_0x39d97c[_0x463d('0x15')][_0x463d('0x16')]===0x1f4){logger['error'](_0x463d('0x11'),_0x1f5d4a,_0x39d97c[_0x463d('0x15')][_0x463d('0x17')]);return _0x4c7afd(_0x39d97c[_0x463d('0x15')][_0x463d('0x17')]);}logger[_0x463d('0x15')]('VoicePrefix,\x20%s,\x20%s',_0x1f5d4a,_0x39d97c[_0x463d('0x15')]['message']);return _0x4c7bcc(_0x39d97c[_0x463d('0x15')][_0x463d('0x17')]);}else{logger[_0x463d('0x10')](_0x463d('0x11'),_0x1f5d4a,_0x463d('0x12'));_0x4c7bcc(_0x39d97c[_0x463d('0x18')]['message']);}})[_0x463d('0x19')](function(_0x1091ac){logger[_0x463d('0x15')](_0x463d('0x11'),_0x1f5d4a,_0x1091ac);_0x4c7afd(_0x1091ac);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 6c76916..af6e991 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 _0x4e61=['removeListener','register','length','voicePrefix:','./voicePrefix.events','save','remove','emit'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x4e61,0x8c));var _0x14e6=function(_0x16dbcd,_0x274516){_0x16dbcd=_0x16dbcd-0x0;var _0x34706e=_0x4e61[_0x16dbcd];return _0x34706e;};'use strict';var VoicePrefixEvents=require(_0x14e6('0x0'));var events=[_0x14e6('0x1'),_0x14e6('0x2'),'update'];function createListener(_0x53cf7e,_0x1fc8bf){return function(_0x3ff2fb){_0x1fc8bf[_0x14e6('0x3')](_0x53cf7e,_0x3ff2fb);};}function removeListener(_0xdcdb2a,_0x1cef29){return function(){VoicePrefixEvents[_0x14e6('0x4')](_0xdcdb2a,_0x1cef29);};}exports[_0x14e6('0x5')]=function(_0x5ae983){for(var _0x78f960=0x0,_0x9f9c31=events[_0x14e6('0x6')];_0x78f960<_0x9f9c31;_0x78f960++){var _0x91ca48=events[_0x78f960];var _0x34b4eb=createListener(_0x14e6('0x7')+_0x91ca48,_0x5ae983);VoicePrefixEvents['on'](_0x91ca48,_0x34b4eb);}}; \ No newline at end of file +var _0xd71d=['update','emit','removeListener','register','length','./voicePrefix.events','save','remove'];(function(_0x320b8e,_0x1da3fe){var _0x55a10a=function(_0x148a56){while(--_0x148a56){_0x320b8e['push'](_0x320b8e['shift']());}};_0x55a10a(++_0x1da3fe);}(_0xd71d,0x1a5));var _0xdd71=function(_0x1e500e,_0x2c9d74){_0x1e500e=_0x1e500e-0x0;var _0x10dc5e=_0xd71d[_0x1e500e];return _0x10dc5e;};'use strict';var VoicePrefixEvents=require(_0xdd71('0x0'));var events=[_0xdd71('0x1'),_0xdd71('0x2'),_0xdd71('0x3')];function createListener(_0x375b72,_0x5916bc){return function(_0x419635){_0x5916bc[_0xdd71('0x4')](_0x375b72,_0x419635);};}function removeListener(_0x19415e,_0x598d89){return function(){VoicePrefixEvents[_0xdd71('0x5')](_0x19415e,_0x598d89);};}exports[_0xdd71('0x6')]=function(_0x3a06df){for(var _0x48fa17=0x0,_0x12d8a7=events[_0xdd71('0x7')];_0x48fa17<_0x12d8a7;_0x48fa17++){var _0x2b3698=events[_0x48fa17];var _0x147f9e=createListener('voicePrefix:'+_0x2b3698,_0x3a06df);VoicePrefixEvents['on'](_0x2b3698,_0x147f9e);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index d352682..12b9d3b 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(_0x2fecd5,_0x26c4cb){var _0x220b9b=function(_0x224fb3){while(--_0x224fb3){_0x2fecd5['push'](_0x2fecd5['shift']());}};_0x220b9b(++_0x26c4cb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xa9e0[_0x13ea00];return _0x1f7347;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getTeams']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x8')]('/:id/blacklists',auth[_0x0a9e('0xd')](),controller['getBlackLists']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/users',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller['addLists']);router[_0x0a9e('0x18')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x22')]);router['delete']('/:id/teams',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router[_0x0a9e('0x21')](_0x0a9e('0x12'),auth['isAuthenticated'](),controller[_0x0a9e('0x24')]);router['delete'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x21')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x26')]);module[_0x0a9e('0x27')]=router; \ No newline at end of file +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(_0x2566a0,_0x10a41d){var _0x1ba3fc=function(_0x1f2498){while(--_0x1f2498){_0x2566a0['push'](_0x2566a0['shift']());}};_0x1ba3fc(++_0x10a41d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa9e0[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getTeams']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x8')]('/:id/blacklists',auth[_0x0a9e('0xd')](),controller['getBlackLists']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/users',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller['addLists']);router[_0x0a9e('0x18')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x22')]);router['delete']('/:id/teams',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router[_0x0a9e('0x21')](_0x0a9e('0x12'),auth['isAuthenticated'](),controller[_0x0a9e('0x24')]);router['delete'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x21')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x26')]);module[_0x0a9e('0x27')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 91c0701..65d2433 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 _0xd121=['dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','always','never','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','sequelize','exports','STRING','name','inbound','default','ENUM','ringall','leastrecent','fewestcalls','random','rrmemory','linear','wrandom','rrordered','setDataValue','strategy','getDataValue','outbound','preview','booked','roundrobin','INTEGER','yes','all','TEXT','periodic_announce','split','joinempty','join','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','power','predictive','progressive','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xd121,0x186));var _0x1d12=function(_0x2582f1,_0x5210fd){_0x2582f1=_0x2582f1-0x0;var _0x2a2252=_0xd121[_0x2582f1];return _0x2a2252;};'use strict';var Sequelize=require(_0x1d12('0x0'));module[_0x1d12('0x1')]={'name':{'type':Sequelize[_0x1d12('0x2')],'allowNull':![],'unique':_0x1d12('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x1d12('0x4'),'outbound'),'allowNull':![],'defaultValue':'inbound'},'musiconhold':{'type':Sequelize[_0x1d12('0x2')],'defaultValue':_0x1d12('0x5')},'announce':{'type':Sequelize['STRING'],'defaultValue':''},'strategy':{'type':Sequelize[_0x1d12('0x6')]('rr',_0x1d12('0x7'),_0x1d12('0x8'),_0x1d12('0x9'),_0x1d12('0xa'),_0x1d12('0xb'),_0x1d12('0xc'),_0x1d12('0xd'),_0x1d12('0xe')),'allowNull':![],'defaultValue':_0x1d12('0x7'),'set':function(_0x4eed85){this[_0x1d12('0xf')](_0x1d12('0x10'),_0x4eed85?_0x4eed85:'rrmemory');},'get':function(){var _0xe1c3e8=this[_0x1d12('0x11')]('type');var _0x444566=this[_0x1d12('0x11')]('dialMethod');var _0x24b80a=this[_0x1d12('0x11')](_0x1d12('0x10'));if(_0xe1c3e8===_0x1d12('0x12')){if(_0x444566===_0x1d12('0x13')){return null;}if(_0x444566===_0x1d12('0x14')&&![_0x1d12('0xb'),_0x1d12('0x15')]['includes'](_0x24b80a)){this['setDataValue'](_0x1d12('0x10'),'rrmemory');}}return _0x24b80a;}},'servicelevel':{'type':Sequelize[_0x1d12('0x16')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x1d12('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x1d12('0x16')](0xb)},'timeout':{'type':Sequelize[_0x1d12('0x16')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x1d12('0x16')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x1d12('0x2')]},'weight':{'type':Sequelize[_0x1d12('0x16')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x1d12('0x16')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x1d12('0x6')]('yes','no'),'defaultValue':_0x1d12('0x17')},'autopause':{'type':Sequelize['ENUM'](_0x1d12('0x17'),'no',_0x1d12('0x18')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x1d12('0x16')](0xb)},'autopausebusy':{'type':Sequelize[_0x1d12('0x6')]('yes','no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x1d12('0x6')]('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x1d12('0x16')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize['ENUM'](_0x1d12('0x17'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize['ENUM']('yes','no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x1d12('0x6')](_0x1d12('0x17'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize['ENUM'](_0x1d12('0x17'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x1d12('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x1d12('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x1d12('0x16')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x1d12('0x16')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize['ENUM'](_0x1d12('0x17'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x1d12('0x6')](_0x1d12('0x17'),'no'),'defaultValue':_0x1d12('0x17')},'announce_holdtime':{'type':Sequelize[_0x1d12('0x6')](_0x1d12('0x17'),'no','once'),'defaultValue':'no'},'announce_position':{'type':Sequelize['STRING'],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x1d12('0x6')](_0x1d12('0x17'),'no')},'announce_position_limit':{'type':Sequelize[_0x1d12('0x16')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x1d12('0x6')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x1d12('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x1d12('0x2')]},'queue_youarenext':{'type':Sequelize[_0x1d12('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x1d12('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize['STRING'],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x1d12('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x1d12('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x1d12('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x1d12('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x1d12('0x2')]},'queue_quantity1':{'type':Sequelize[_0x1d12('0x2')]},'queue_quantity2':{'type':Sequelize[_0x1d12('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0x1d12('0x2')]},'queue_less_than':{'type':Sequelize['STRING']},'periodic_announce':{'type':Sequelize[_0x1d12('0x19')],'set':function(_0x18a7e5){this[_0x1d12('0xf')]('periodic_announce',_0x18a7e5?_0x18a7e5['join'](','):[]);},'get':function(){return this['getDataValue'](_0x1d12('0x1a'))?this[_0x1d12('0x11')](_0x1d12('0x1a'))[_0x1d12('0x1b')](','):[];}},'joinempty':{'type':Sequelize['STRING'],'defaultValue':_0x1d12('0x17'),'set':function(_0x4ea12b){this[_0x1d12('0xf')](_0x1d12('0x1c'),_0x4ea12b?_0x4ea12b[_0x1d12('0x1d')](','):undefined);},'get':function(){return this[_0x1d12('0x11')]('joinempty')?this['getDataValue'](_0x1d12('0x1c'))[_0x1d12('0x1b')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x1d12('0x2')],'defaultValue':'no','set':function(_0x470003){this[_0x1d12('0xf')](_0x1d12('0x1e'),_0x470003?_0x470003[_0x1d12('0x1d')](','):undefined);},'get':function(){return this[_0x1d12('0x11')](_0x1d12('0x1e'))?this[_0x1d12('0x11')](_0x1d12('0x1e'))['split'](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x1d12('0x6')](_0x1d12('0x17'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x1d12('0x6')]('yes','no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x1d12('0x16')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x1d12('0x6')](_0x1d12('0x17'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x1d12('0x2')]},'description':{'type':Sequelize[_0x1d12('0x2')]},'acw':{'type':Sequelize[_0x1d12('0x1f')],'defaultValue':0x0,'set':function(_0x216013){this[_0x1d12('0xf')](_0x1d12('0x20'),_0x216013);if(_0x216013){if(this[_0x1d12('0x11')](_0x1d12('0x21'))<0x2){this[_0x1d12('0xf')](_0x1d12('0x21'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x1d12('0x16')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x1d12('0x22')},'dialMethod':{'type':Sequelize[_0x1d12('0x6')]('preview','progressive',_0x1d12('0x23'),_0x1d12('0x24'),_0x1d12('0x14')),'defaultValue':_0x1d12('0x25'),'comment':_0x1d12('0x26')},'dialLimitChannel':{'type':Sequelize['INTEGER'](0x4)[_0x1d12('0x27')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x1d12('0x28')},'dialLimitQueue':{'type':Sequelize[_0x1d12('0x16')](0x4)[_0x1d12('0x27')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x1d12('0x29')},'dialPowerLevel':{'type':Sequelize[_0x1d12('0x2a')](0x2)[_0x1d12('0x27')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x1d12('0x2b')},'dialPredictiveOptimization':{'type':Sequelize[_0x1d12('0x6')](_0x1d12('0x2c'),'dropRate'),'defaultValue':_0x1d12('0x2d'),'comment':_0x1d12('0x2e')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x1d12('0x2a')](0x2)[_0x1d12('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x1d12('0x2f')},'dialPredictiveInterval':{'type':Sequelize[_0x1d12('0x16')](0x3)[_0x1d12('0x27')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x1d12('0x30')},'dialOriginateCallerIdName':{'type':Sequelize[_0x1d12('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x1d12('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x1d12('0x16')](0x3)[_0x1d12('0x27')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueOptions':{'type':Sequelize[_0x1d12('0x2')],'defaultValue':_0x1d12('0x31'),'comment':_0x1d12('0x32')},'dialQueueTimeout':{'type':Sequelize[_0x1d12('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1d12('0x33')},'dialQueueProject':{'type':Sequelize[_0x1d12('0x2')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x1d12('0x16')](0x3)[_0x1d12('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1d12('0x34')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x1d12('0x16')](0x5)[_0x1d12('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1d12('0x35')},'dialBusyMaxRetry':{'type':Sequelize[_0x1d12('0x16')](0x3)[_0x1d12('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1d12('0x36')},'dialBusyRetryFrequency':{'type':Sequelize[_0x1d12('0x16')](0x5)[_0x1d12('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1d12('0x37')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x1d12('0x16')](0x3)[_0x1d12('0x27')],'defaultValue':0x3,'comment':_0x1d12('0x38')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1d12('0x39')},'dialGlobalMaxRetry':{'type':Sequelize[_0x1d12('0x16')](0x3)[_0x1d12('0x27')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0x1d12('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x1d12('0x2')],'defaultValue':'07:00-22:00,*,*,*'},'dialPrefix':{'type':Sequelize[_0x1d12('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x1d12('0x6')](_0x1d12('0x3a'),_0x1d12('0x3b'),'onlyIfOpen'),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x1d12('0x3c')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0x1d12('0x27')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x1d12('0x3d')},'dialAMDGreeting':{'type':Sequelize[_0x1d12('0x16')](0x9)[_0x1d12('0x27')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x1d12('0x3e')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x1d12('0x16')](0x9)[_0x1d12('0x27')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x1d12('0x3f')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x1d12('0x16')](0x9)[_0x1d12('0x27')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x1d12('0x40')},'dialAMDMinWordLength':{'type':Sequelize[_0x1d12('0x16')](0x9)[_0x1d12('0x27')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x1d12('0x41')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x1d12('0x16')](0x9)[_0x1d12('0x27')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x1d12('0x42')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x1d12('0x16')](0x9)[_0x1d12('0x27')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x1d12('0x43')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x1d12('0x27')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x1d12('0x44')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x1d12('0x16')](0x9)[_0x1d12('0x27')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x1d12('0x45')},'dialRecallMeTimeout':{'type':Sequelize[_0x1d12('0x16')](0x5)[_0x1d12('0x27')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x1d12('0x46')},'dialRecallInQueue':{'type':Sequelize[_0x1d12('0x1f')],'defaultValue':0x0,'comment':_0x1d12('0x47')},'dialOrderByScheduledAt':{'type':Sequelize[_0x1d12('0x6')](_0x1d12('0x48'),_0x1d12('0x49')),'defaultValue':'DESC'},'dialQueueProject2':{'type':Sequelize[_0x1d12('0x2')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize[_0x1d12('0x1f')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x1d12('0x1f')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x1d12('0x16')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x1d12('0x4a')},'dialCutDigit':{'type':Sequelize[_0x1d12('0x16')](0x3)[_0x1d12('0x27')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x1d12('0x4b')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x1d12('0x16')](0x3)[_0x1d12('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1d12('0x4c')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x1d12('0x16')](0x5)[_0x1d12('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1d12('0x4d')},'dialDropMaxRetry':{'type':Sequelize[_0x1d12('0x16')](0x3)[_0x1d12('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1d12('0x4e')},'dialDropRetryFrequency':{'type':Sequelize[_0x1d12('0x16')](0x5)[_0x1d12('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0x1d12('0x16')](0x3)[_0x1d12('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1d12('0x4f')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x1d12('0x16')](0x5)[_0x1d12('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1d12('0x50')},'dialMachineMaxRetry':{'type':Sequelize[_0x1d12('0x16')](0x3)[_0x1d12('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1d12('0x51')},'dialMachineRetryFrequency':{'type':Sequelize[_0x1d12('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x1d12('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1d12('0x52')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1d12('0x53')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x1d12('0x16')],'allowNull':!![],'comment':_0x1d12('0x54')},'mandatoryDisposition':{'type':Sequelize[_0x1d12('0x1f')],'defaultValue':![],'comment':_0x1d12('0x55'),'set':function(_0x28d544){if(!_0x28d544)this[_0x1d12('0xf')]('mandatoryDispositionPauseId',null);this[_0x1d12('0xf')](_0x1d12('0x56'),_0x28d544);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x1d12('0x16')](0x3)[_0x1d12('0x27')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x1d12('0x16')](0x3)[_0x1d12('0x27')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x1d12('0x1f')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x5d3c=['STRING','yes','once','TEXT','periodic_announce','split','joinempty','join','leavewhenempty','BOOLEAN','acw','wrapuptime','preview','progressive','power','Dial\x20Method.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','07:00-22:00,*,*,*','never','onlyIfOpen','always','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','#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)','mandatoryDispositionPauseId','sequelize','exports','name','ENUM','inbound','outbound','default','ringall','leastrecent','fewestcalls','random','rrmemory','linear','wrandom','rrordered','setDataValue','strategy','getDataValue','type','dialMethod','booked','roundrobin','includes','INTEGER'];(function(_0x51c9d2,_0x2364a8){var _0x2af9db=function(_0x442da3){while(--_0x442da3){_0x51c9d2['push'](_0x51c9d2['shift']());}};_0x2af9db(++_0x2364a8);}(_0x5d3c,0x1c8));var _0xc5d3=function(_0x56fe68,_0x868a48){_0x56fe68=_0x56fe68-0x0;var _0x368d2d=_0x5d3c[_0x56fe68];return _0x368d2d;};'use strict';var Sequelize=require(_0xc5d3('0x0'));module[_0xc5d3('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xc5d3('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xc5d3('0x3')](_0xc5d3('0x4'),_0xc5d3('0x5')),'allowNull':![],'defaultValue':_0xc5d3('0x4')},'musiconhold':{'type':Sequelize['STRING'],'defaultValue':_0xc5d3('0x6')},'announce':{'type':Sequelize['STRING'],'defaultValue':''},'strategy':{'type':Sequelize[_0xc5d3('0x3')]('rr',_0xc5d3('0x7'),_0xc5d3('0x8'),_0xc5d3('0x9'),_0xc5d3('0xa'),_0xc5d3('0xb'),_0xc5d3('0xc'),_0xc5d3('0xd'),_0xc5d3('0xe')),'allowNull':![],'defaultValue':_0xc5d3('0x7'),'set':function(_0x818211){this[_0xc5d3('0xf')](_0xc5d3('0x10'),_0x818211?_0x818211:_0xc5d3('0xb'));},'get':function(){var _0x95708=this[_0xc5d3('0x11')](_0xc5d3('0x12'));var _0x3895a6=this[_0xc5d3('0x11')](_0xc5d3('0x13'));var _0x4715bc=this[_0xc5d3('0x11')](_0xc5d3('0x10'));if(_0x95708===_0xc5d3('0x5')){if(_0x3895a6==='preview'){return null;}if(_0x3895a6===_0xc5d3('0x14')&&!['rrmemory',_0xc5d3('0x15')][_0xc5d3('0x16')](_0x4715bc)){this[_0xc5d3('0xf')](_0xc5d3('0x10'),_0xc5d3('0xb'));}}return _0x4715bc;}},'servicelevel':{'type':Sequelize[_0xc5d3('0x17')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0xc5d3('0x18')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xc5d3('0x17')](0xb)},'timeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0xc5d3('0x17')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0xc5d3('0x18')]},'weight':{'type':Sequelize[_0xc5d3('0x17')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0xc5d3('0x17')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize['ENUM'](_0xc5d3('0x19'),'no'),'defaultValue':_0xc5d3('0x19')},'autopause':{'type':Sequelize[_0xc5d3('0x3')](_0xc5d3('0x19'),'no','all'),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0xc5d3('0x17')](0xb)},'autopausebusy':{'type':Sequelize[_0xc5d3('0x3')](_0xc5d3('0x19'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0xc5d3('0x17')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0xc5d3('0x3')]('yes','no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0xc5d3('0x3')]('yes','no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM'](_0xc5d3('0x19'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0xc5d3('0x3')](_0xc5d3('0x19'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0xc5d3('0x18')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0xc5d3('0x18')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0xc5d3('0x17')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0xc5d3('0x3')](_0xc5d3('0x19'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM'](_0xc5d3('0x19'),'no'),'defaultValue':'yes'},'announce_holdtime':{'type':Sequelize[_0xc5d3('0x3')](_0xc5d3('0x19'),'no',_0xc5d3('0x1a')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0xc5d3('0x18')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize['ENUM'](_0xc5d3('0x19'),'no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize[_0xc5d3('0x3')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize['STRING'],'defaultValue':''},'monitor_type':{'type':Sequelize['STRING']},'queue_youarenext':{'type':Sequelize[_0xc5d3('0x18')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0xc5d3('0x18')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize['STRING'],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize[_0xc5d3('0x18')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0xc5d3('0x18')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0xc5d3('0x18')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xc5d3('0x18')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0xc5d3('0x18')]},'queue_quantity1':{'type':Sequelize['STRING']},'queue_quantity2':{'type':Sequelize['STRING']},'queue_periodic_announce':{'type':Sequelize['STRING']},'queue_less_than':{'type':Sequelize[_0xc5d3('0x18')]},'periodic_announce':{'type':Sequelize[_0xc5d3('0x1b')],'set':function(_0x144ecb){this[_0xc5d3('0xf')](_0xc5d3('0x1c'),_0x144ecb?_0x144ecb['join'](','):[]);},'get':function(){return this[_0xc5d3('0x11')](_0xc5d3('0x1c'))?this[_0xc5d3('0x11')]('periodic_announce')[_0xc5d3('0x1d')](','):[];}},'joinempty':{'type':Sequelize[_0xc5d3('0x18')],'defaultValue':_0xc5d3('0x19'),'set':function(_0x4b77f3){this['setDataValue'](_0xc5d3('0x1e'),_0x4b77f3?_0x4b77f3[_0xc5d3('0x1f')](','):undefined);},'get':function(){return this[_0xc5d3('0x11')](_0xc5d3('0x1e'))?this['getDataValue'](_0xc5d3('0x1e'))[_0xc5d3('0x1d')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0xc5d3('0x18')],'defaultValue':'no','set':function(_0x5afe4b){this[_0xc5d3('0xf')](_0xc5d3('0x20'),_0x5afe4b?_0x5afe4b[_0xc5d3('0x1f')](','):undefined);},'get':function(){return this[_0xc5d3('0x11')](_0xc5d3('0x20'))?this[_0xc5d3('0x11')]('leavewhenempty')[_0xc5d3('0x1d')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0xc5d3('0x3')]('yes','no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0xc5d3('0x3')](_0xc5d3('0x19'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0xc5d3('0x17')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize['ENUM'](_0xc5d3('0x19'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0xc5d3('0x18')]},'description':{'type':Sequelize[_0xc5d3('0x18')]},'acw':{'type':Sequelize[_0xc5d3('0x21')],'defaultValue':0x0,'set':function(_0x3e2179){this[_0xc5d3('0xf')](_0xc5d3('0x22'),_0x3e2179);if(_0x3e2179){if(this['getDataValue'](_0xc5d3('0x23'))<0x2){this[_0xc5d3('0xf')](_0xc5d3('0x23'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0xc5d3('0x17')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0xc5d3('0x21')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'dialMethod':{'type':Sequelize[_0xc5d3('0x3')](_0xc5d3('0x24'),_0xc5d3('0x25'),_0xc5d3('0x26'),'predictive',_0xc5d3('0x14')),'defaultValue':'progressive','comment':_0xc5d3('0x27')},'dialLimitChannel':{'type':Sequelize[_0xc5d3('0x17')](0x4)[_0xc5d3('0x28')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize[_0xc5d3('0x17')](0x4)[_0xc5d3('0x28')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xc5d3('0x29')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)[_0xc5d3('0x28')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0xc5d3('0x2a')},'dialPredictiveOptimization':{'type':Sequelize[_0xc5d3('0x3')](_0xc5d3('0x2b'),'dropRate'),'defaultValue':'dropRate','comment':_0xc5d3('0x2c')},'dialPredictiveOptimizationPercentage':{'type':Sequelize['FLOAT'](0x2)[_0xc5d3('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0xc5d3('0x2d')},'dialPredictiveInterval':{'type':Sequelize['INTEGER'](0x3)[_0xc5d3('0x28')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0xc5d3('0x18')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0xc5d3('0x28')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc5d3('0x2e')},'dialQueueOptions':{'type':Sequelize[_0xc5d3('0x18')],'defaultValue':'tTxX','comment':'https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue'},'dialQueueTimeout':{'type':Sequelize[_0xc5d3('0x17')](0x3)[_0xc5d3('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueProject':{'type':Sequelize[_0xc5d3('0x18')],'comment':_0xc5d3('0x2f')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0xc5d3('0x17')](0x5)[_0xc5d3('0x28')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc5d3('0x30')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xc5d3('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc5d3('0x31')},'dialBusyRetryFrequency':{'type':Sequelize[_0xc5d3('0x17')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc5d3('0x32')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xc5d3('0x17')](0x3)[_0xc5d3('0x28')],'defaultValue':0x3,'comment':_0xc5d3('0x33')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xc5d3('0x17')](0x5)[_0xc5d3('0x28')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc5d3('0x34')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xc5d3('0x28')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0xc5d3('0x35')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0xc5d3('0x3')]('always',_0xc5d3('0x36'),_0xc5d3('0x37')),'defaultValue':_0xc5d3('0x38')},'dialAMDActive':{'type':Sequelize[_0xc5d3('0x21')],'defaultValue':0x0,'comment':_0xc5d3('0x39')},'dialAMDInitialSilence':{'type':Sequelize[_0xc5d3('0x17')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xc5d3('0x3a')},'dialAMDGreeting':{'type':Sequelize[_0xc5d3('0x17')](0x9)[_0xc5d3('0x28')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xc5d3('0x3b')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xc5d3('0x17')](0x9)[_0xc5d3('0x28')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xc5d3('0x3c')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0xc5d3('0x28')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xc5d3('0x3d')},'dialAMDMinWordLength':{'type':Sequelize[_0xc5d3('0x17')](0x9)[_0xc5d3('0x28')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xc5d3('0x3e')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xc5d3('0x17')](0x9)[_0xc5d3('0x28')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xc5d3('0x3f')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xc5d3('0x17')](0x9)[_0xc5d3('0x28')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xc5d3('0x40')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xc5d3('0x17')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0xc5d3('0x17')](0x9)[_0xc5d3('0x28')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize[_0xc5d3('0x17')](0x5)['UNSIGNED'],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0xc5d3('0x41')},'dialRecallInQueue':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xc5d3('0x42')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0xc5d3('0x43'),_0xc5d3('0x44')),'defaultValue':'DESC'},'dialQueueProject2':{'type':Sequelize[_0xc5d3('0x18')],'comment':_0xc5d3('0x2f')},'dialAgiAfterHangupClient':{'type':Sequelize[_0xc5d3('0x21')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0xc5d3('0x21')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xc5d3('0x17')](0x3)[_0xc5d3('0x28')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xc5d3('0x45')},'dialCutDigit':{'type':Sequelize[_0xc5d3('0x17')](0x3)[_0xc5d3('0x28')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xc5d3('0x46')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xc5d3('0x17')](0x3)[_0xc5d3('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc5d3('0x47')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xc5d3('0x17')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc5d3('0x48')},'dialDropMaxRetry':{'type':Sequelize[_0xc5d3('0x17')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc5d3('0x49')},'dialDropRetryFrequency':{'type':Sequelize[_0xc5d3('0x17')](0x5)[_0xc5d3('0x28')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0xc5d3('0x17')](0x3)[_0xc5d3('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc5d3('0x4a')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xc5d3('0x17')](0x5)[_0xc5d3('0x28')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0xc5d3('0x17')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc5d3('0x4b')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xc5d3('0x28')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc5d3('0x4c')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xc5d3('0x17')](0x3)[_0xc5d3('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc5d3('0x4d')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc5d3('0x4e')},'mandatoryDispositionPauseId':{'type':Sequelize[_0xc5d3('0x17')],'allowNull':!![],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xc5d3('0x21')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x407954){if(!_0x407954)this[_0xc5d3('0xf')](_0xc5d3('0x4f'),null);this[_0xc5d3('0xf')]('mandatoryDisposition',_0x407954);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0xc5d3('0x17')](0x3)[_0xc5d3('0x28')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)[_0xc5d3('0x28')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0xc5d3('0x21')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize['INTEGER'](0x3)[_0xc5d3('0x28')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0xc5d3('0x21')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 3986324..71a2e35 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 _0xe14b=['QueueCampaigns','outbound','filter','map','value','type','find','name','end','error','stack','index','VoiceQueue','rawAttributes','fieldName','key','getOptions','where','include','show','params','model','keys','query','intersection','attributes','fields','length','includeAll','options','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','VoiceQueues','UserProfileSection','autoAssociation','UserProfileResource','clone','merge','omit','createdAt','updatedAt','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getHoppers','CmHopper','filters','hasOwnProperty','nolimit','order','sort','pick','VoiceQueueId','findAll','rows','getHopperHistories','findOne','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','Agents','online','interface','flatMap','penalty','sequelize','UserVoiceQueue','UserVoiceQueueRt','upsert','isNil','format','voicePause','forEach','emit','userVoiceQueue:save','ids','User','select','field','tq.TeamId','from','team_has_voice_queues','join','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','compact','transaction','removeTeams','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','spread','isArray','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','CmListId','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','cm_contacts','deletedAt\x20IS\x20NULL','cm_hopper_additional_phones','CmHopperId','OrderBy','ci.item','ci.OrderBy+1','cm_contact_has_items','h.scheduledat=?','ci.ItemClass=?','PHONE','removeLists','getBlackLists','cm_hopper_black','NOW()','removeBlackLists','moment','bluebird','squel','ioredis','../../config/logger','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','json','offset','undefined','limit','count','Content-Range','update','then','destroy','get','inbound'];(function(_0x35055e,_0x5ada66){var _0x1475aa=function(_0x1e2dbd){while(--_0x1e2dbd){_0x35055e['push'](_0x35055e['shift']());}};_0x1475aa(++_0x5ada66);}(_0xe14b,0x93));var _0xbe14=function(_0x3c9c5a,_0x476407){_0x3c9c5a=_0x3c9c5a-0x0;var _0x565441=_0xe14b[_0x3c9c5a];return _0x565441;};'use strict';var moment=require(_0xbe14('0x0'));var BPromise=require(_0xbe14('0x1'));var util=require('util');var _=require('lodash');var squel=require(_0xbe14('0x2'));var Redis=require(_0xbe14('0x3'));var qs=require('../../components/parsers/qs');var logger=require(_0xbe14('0x4'))('api');var config=require('../../config/environment');var db=require(_0xbe14('0x5'))['db'];config[_0xbe14('0x6')]=_[_0xbe14('0x7')](config[_0xbe14('0x6')],{'host':_0xbe14('0x8'),'port':0x18eb});var socket=require(_0xbe14('0x9'))(new Redis(config[_0xbe14('0x6')]));require('./voiceQueue.socket')['register'](socket);function respondWithStatusCode(_0x496063,_0x30c355){_0x30c355=_0x30c355||0xcc;return function(_0x6fceff){if(_0x6fceff){return _0x496063[_0xbe14('0xa')](_0x30c355);}return _0x496063[_0xbe14('0xb')](_0x30c355)['end']();};}function respondWithResult(_0x5b9fc6,_0x113243){_0x113243=_0x113243||0xc8;return function(_0x3f70cb){if(_0x3f70cb){return _0x5b9fc6['status'](_0x113243)[_0xbe14('0xc')](_0x3f70cb);}};}function respondWithFilteredResult(_0x35aa19,_0x886a5e){return function(_0x3d38c2){if(_0x3d38c2){var _0x27792f=typeof _0x886a5e[_0xbe14('0xd')]===_0xbe14('0xe')&&typeof _0x886a5e[_0xbe14('0xf')]===_0xbe14('0xe');var _0xa2cf72=_0x3d38c2[_0xbe14('0x10')];var _0x33fd54=_0x27792f?0x0:_0x886a5e[_0xbe14('0xd')];var _0x530538=_0x27792f?_0x3d38c2['count']:_0x886a5e[_0xbe14('0xd')]+_0x886a5e[_0xbe14('0xf')];var _0xf4ac9;if(_0x530538>=_0xa2cf72){_0x530538=_0xa2cf72;_0xf4ac9=0xc8;}else{_0xf4ac9=0xce;}_0x35aa19[_0xbe14('0xb')](_0xf4ac9);return _0x35aa19['set'](_0xbe14('0x11'),_0x33fd54+'-'+_0x530538+'/'+_0xa2cf72)[_0xbe14('0xc')](_0x3d38c2);}return null;};}function saveUpdates(_0xfd7b8f){return function(_0x123ede){if(_0x123ede){return _0x123ede[_0xbe14('0x12')](_0xfd7b8f)[_0xbe14('0x13')](function(_0x17ae86){return _0x17ae86;});}return null;};}function removeEntity(_0x5ea1f8){return function(_0x137ee5){if(_0x137ee5){return _0x137ee5[_0xbe14('0x14')]()[_0xbe14('0x13')](function(){var _0x433459=_0x137ee5[_0xbe14('0x15')]({'plain':!![]});var _0x37e4c1=[{'name':'VoiceQueues','value':_0xbe14('0x16'),'ignore':![]},{'name':_0xbe14('0x17'),'value':_0xbe14('0x18'),'ignore':![]}];var _0xc12977=_(_0x37e4c1)[_0xbe14('0x19')]('ignore')[_0xbe14('0x1a')]('value')[_0xbe14('0x1b')]();if(_['includes'](_0xc12977,_0x433459[_0xbe14('0x1c')])){return;}var _0x4a25fa=_[_0xbe14('0x1d')](_0x37e4c1,[_0xbe14('0x1b'),_0x433459['type']])[_0xbe14('0x1e')];return db['UserProfileResource'][_0xbe14('0x14')]({'where':{'type':_0x4a25fa,'resourceId':_0x433459['id']}})['then'](function(){return _0x137ee5;});})[_0xbe14('0x13')](function(){_0x5ea1f8[_0xbe14('0xb')](0xcc)[_0xbe14('0x1f')]();});}};}function handleEntityNotFound(_0x39cc81){return function(_0x15ef02){if(!_0x15ef02){_0x39cc81[_0xbe14('0xa')](0x194);}return _0x15ef02;};}function handleError(_0x55d001,_0x1822e0){_0x1822e0=_0x1822e0||0x1f4;return function(_0x1ba46a){logger[_0xbe14('0x20')](_0x1ba46a[_0xbe14('0x21')]);if(_0x1ba46a['name']){delete _0x1ba46a[_0xbe14('0x1e')];}_0x55d001[_0xbe14('0xb')](_0x1822e0)['send'](_0x1ba46a);};}exports[_0xbe14('0x22')]=function(_0x3b3e84,_0x1c7cc7){var _0x19252f={};var _0x34d648={'count':0x0,'rows':[]};var _0x36d4b2=_[_0xbe14('0x1a')](db[_0xbe14('0x23')][_0xbe14('0x24')],function(_0x16a159){return{'name':_0x16a159[_0xbe14('0x25')],'type':_0x16a159[_0xbe14('0x1c')][_0xbe14('0x26')]};});_0x19252f=qs[_0xbe14('0x27')](_0x36d4b2,_0x3b3e84);var _0x223f7a={'where':_0x19252f[_0xbe14('0x28')]};return db[_0xbe14('0x23')][_0xbe14('0x10')](_0x223f7a)[_0xbe14('0x13')](function(_0x14e7c4){_0x34d648['count']=_0x14e7c4;_0x19252f[_0xbe14('0x29')]=qs['include'](_0x3b3e84['query']);return db[_0xbe14('0x23')]['findAll'](_0x19252f);})[_0xbe14('0x13')](function(_0x345b0){_0x34d648['rows']=_0x345b0;return _0x34d648;})['then'](respondWithFilteredResult(_0x1c7cc7,_0x19252f))['catch'](handleError(_0x1c7cc7,null));};exports[_0xbe14('0x2a')]=function(_0xa3d24,_0x5f27b6){var _0x46c570={'raw':![],'where':{'id':_0xa3d24[_0xbe14('0x2b')]['id']}},_0x1faf3e={};_0x1faf3e[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db['VoiceQueue']['rawAttributes']);_0x1faf3e[_0xbe14('0x2e')]=_['keys'](_0xa3d24['query']);_0x1faf3e['filters']=_[_0xbe14('0x2f')](_0x1faf3e[_0xbe14('0x2c')],_0x1faf3e[_0xbe14('0x2e')]);_0x46c570[_0xbe14('0x30')]=_[_0xbe14('0x2f')](_0x1faf3e[_0xbe14('0x2c')],qs[_0xbe14('0x31')](_0xa3d24[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x46c570[_0xbe14('0x30')]=_0x46c570[_0xbe14('0x30')][_0xbe14('0x32')]?_0x46c570['attributes']:_0x1faf3e['model'];if(_0xa3d24[_0xbe14('0x2e')][_0xbe14('0x33')]){_0x46c570[_0xbe14('0x29')]=[{'all':!![]}];}_0x46c570=_['merge']({},_0x46c570,_0xa3d24[_0xbe14('0x34')]);return db[_0xbe14('0x23')][_0xbe14('0x1d')](_0x46c570)[_0xbe14('0x13')](handleEntityNotFound(_0x5f27b6,null))[_0xbe14('0x13')](respondWithResult(_0x5f27b6,null))[_0xbe14('0x35')](handleError(_0x5f27b6,null));};exports[_0xbe14('0x36')]=function(_0x128843,_0x1b2608){return db['VoiceQueue'][_0xbe14('0x36')](_0x128843[_0xbe14('0x37')],{})[_0xbe14('0x13')](function(_0x1b3118){var _0x3287b9=_0x128843[_0xbe14('0x38')]['get']({'plain':!![]});if(!_0x3287b9)throw new Error(_0xbe14('0x39'));if(_0x3287b9[_0xbe14('0x3a')]===_0xbe14('0x38')){var _0x36263c=_0x1b3118['get']({'plain':!![]});var _0x4bfa96=[{'name':_0xbe14('0x3b'),'value':_0xbe14('0x16')},{'name':_0xbe14('0x17'),'value':'outbound'}];var _0x5d5318=_[_0xbe14('0x1d')](_0x4bfa96,['value',_0x36263c['type']])[_0xbe14('0x1e')];return db[_0xbe14('0x3c')][_0xbe14('0x1d')]({'where':{'name':_0x5d5318,'userProfileId':_0x3287b9['userProfileId']},'raw':!![]})['then'](function(_0x5aaa4f){if(_0x5aaa4f&&_0x5aaa4f[_0xbe14('0x3d')]===0x0){return db[_0xbe14('0x3e')][_0xbe14('0x36')]({'name':_0x36263c['name'],'resourceId':_0x36263c['id'],'type':_0x5aaa4f[_0xbe14('0x1e')],'sectionId':_0x5aaa4f['id']},{})[_0xbe14('0x13')](function(){return _0x1b3118;});}else{return _0x1b3118;}})[_0xbe14('0x35')](function(_0x3ab0f6){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3ab0f6);throw _0x3ab0f6;});}return _0x1b3118;})[_0xbe14('0x13')](respondWithResult(_0x1b2608,0xc9))[_0xbe14('0x35')](handleError(_0x1b2608,null));};exports[_0xbe14('0x3f')]=function(_0xb2b285,_0x2550dc){var _0x4f2d95={'where':{'id':_0xb2b285[_0xbe14('0x2b')]['id']}},_0x51023a={};_0x51023a[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db[_0xbe14('0x23')]['rawAttributes']);_0x4f2d95[_0xbe14('0x30')]=_[_0xbe14('0x2f')](_0x51023a['model'],qs[_0xbe14('0x31')](_0xb2b285[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x4f2d95[_0xbe14('0x30')]=_0x4f2d95['attributes']['length']?_0x4f2d95[_0xbe14('0x30')]:_0x51023a[_0xbe14('0x2c')];if(_0xb2b285['query']['includeAll']){_0x4f2d95[_0xbe14('0x29')]=[{'all':!![]}];}_0x4f2d95=_[_0xbe14('0x40')]({},_0x4f2d95,_0xb2b285[_0xbe14('0x34')]);return db[_0xbe14('0x23')][_0xbe14('0x1d')](_0x4f2d95)[_0xbe14('0x13')](handleEntityNotFound(_0x2550dc,null))[_0xbe14('0x13')](function(_0x5a4068){if(_0x5a4068){var _0xf32e93=_0x5a4068[_0xbe14('0x15')]({'plain':!![]});_0xf32e93=qs[_0xbe14('0x41')](_0xf32e93,['id',_0xbe14('0x42'),_0xbe14('0x43')]);_0xb2b285['body']=_[_0xbe14('0x41')](_0xb2b285[_0xbe14('0x37')],['id',_0xbe14('0x42'),_0xbe14('0x43')]);return db[_0xbe14('0x23')][_0xbe14('0x36')](_['merge'](_0xf32e93,_0xb2b285['body']),{'include':_0xb2b285[_0xbe14('0x2e')][_0xbe14('0x33')]?[{'all':!![]}]:undefined})[_0xbe14('0x13')](function(_0x48554a){var _0x497b00=_0xb2b285[_0xbe14('0x38')][_0xbe14('0x15')]({'plain':!![]});if(!_0x497b00)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x497b00[_0xbe14('0x3a')]===_0xbe14('0x38')){var _0x50c2a0=_0x48554a[_0xbe14('0x15')]({'plain':!![]});var _0x4a40d2=[{'name':_0xbe14('0x3b'),'value':_0xbe14('0x16')},{'name':_0xbe14('0x17'),'value':'outbound'}];var _0x435c8d=_[_0xbe14('0x1d')](_0x4a40d2,['value',_0x50c2a0[_0xbe14('0x1c')]])[_0xbe14('0x1e')];return db[_0xbe14('0x3c')][_0xbe14('0x1d')]({'where':{'name':_0x435c8d,'userProfileId':_0x497b00[_0xbe14('0x44')]},'raw':!![]})['then'](function(_0x42a346){if(_0x42a346&&_0x42a346[_0xbe14('0x3d')]===0x0){return db[_0xbe14('0x3e')][_0xbe14('0x36')]({'name':_0x50c2a0[_0xbe14('0x1e')],'resourceId':_0x50c2a0['id'],'type':_0x42a346[_0xbe14('0x1e')],'sectionId':_0x42a346['id']},{})[_0xbe14('0x13')](function(){return _0x48554a;});}else{return _0x48554a;}})['catch'](function(_0x72c875){logger[_0xbe14('0x20')](_0xbe14('0x45'),_0x72c875);throw _0x72c875;});}return _0x48554a;});}})[_0xbe14('0x13')](respondWithResult(_0x2550dc,0xc9))[_0xbe14('0x35')](handleError(_0x2550dc,null));};exports[_0xbe14('0x12')]=function(_0xd8f78f,_0x32df3c){if(_0xd8f78f[_0xbe14('0x37')]['id']){delete _0xd8f78f[_0xbe14('0x37')]['id'];}return db[_0xbe14('0x23')]['find']({'where':{'id':_0xd8f78f['params']['id']}})['then'](handleEntityNotFound(_0x32df3c,null))[_0xbe14('0x13')](saveUpdates(_0xd8f78f[_0xbe14('0x37')],null))[_0xbe14('0x13')](respondWithResult(_0x32df3c,null))[_0xbe14('0x35')](handleError(_0x32df3c,null));};exports[_0xbe14('0x14')]=function(_0x66ddf,_0x16ee48){return db[_0xbe14('0x23')][_0xbe14('0x1d')]({'where':{'id':_0x66ddf[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x16ee48,null))[_0xbe14('0x13')](removeEntity(_0x16ee48,null))[_0xbe14('0x35')](handleError(_0x16ee48,null));};exports[_0xbe14('0x46')]=function(_0x1c831a,_0xcef8e3){var _0x179077={'raw':![],'where':{}};var _0x2225d9={};var _0x29761b={'count':0x0,'rows':[]};return db[_0xbe14('0x23')]['findOne']({'where':{'id':_0x1c831a[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0xcef8e3,null))[_0xbe14('0x13')](function(_0x46b49c){if(_0x46b49c){_0x2225d9[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db[_0xbe14('0x47')][_0xbe14('0x24')]);_0x2225d9[_0xbe14('0x2e')]=_[_0xbe14('0x2d')](_0x1c831a['query']);_0x2225d9[_0xbe14('0x48')]=_[_0xbe14('0x2f')](_0x2225d9[_0xbe14('0x2c')],_0x2225d9[_0xbe14('0x2e')]);_0x179077[_0xbe14('0x30')]=_['intersection'](_0x2225d9[_0xbe14('0x2c')],qs[_0xbe14('0x31')](_0x1c831a[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x179077[_0xbe14('0x30')]=_0x179077['attributes'][_0xbe14('0x32')]?_0x179077[_0xbe14('0x30')]:_0x2225d9[_0xbe14('0x2c')];if(!_0x1c831a[_0xbe14('0x2e')][_0xbe14('0x49')](_0xbe14('0x4a'))){_0x179077[_0xbe14('0xf')]=qs[_0xbe14('0xf')](_0x1c831a['query'][_0xbe14('0xf')]);_0x179077[_0xbe14('0xd')]=qs[_0xbe14('0xd')](_0x1c831a[_0xbe14('0x2e')][_0xbe14('0xd')]);}_0x179077[_0xbe14('0x4b')]=qs[_0xbe14('0x4c')](_0x1c831a['query']['sort']);_0x179077[_0xbe14('0x28')]=qs[_0xbe14('0x48')](_[_0xbe14('0x4d')](_0x1c831a[_0xbe14('0x2e')],_0x2225d9[_0xbe14('0x48')]));_0x179077[_0xbe14('0x28')][_0xbe14('0x4e')]=_0x46b49c['id'];if(_0x1c831a[_0xbe14('0x2e')]['filter']){_0x179077['where']=_[_0xbe14('0x40')](_0x179077[_0xbe14('0x28')],{'$or':_[_0xbe14('0x1a')](_0x179077['attributes'],function(_0x76e91e){var _0x16bca1={};_0x16bca1[_0x76e91e]={'$like':'%'+_0x1c831a[_0xbe14('0x2e')][_0xbe14('0x19')]+'%'};return _0x16bca1;})});}_0x179077=_[_0xbe14('0x40')]({},_0x179077,_0x1c831a[_0xbe14('0x34')]);return db[_0xbe14('0x47')]['count']({'where':_0x179077[_0xbe14('0x28')]})[_0xbe14('0x13')](function(_0x3baa26){_0x29761b[_0xbe14('0x10')]=_0x3baa26;if(_0x1c831a[_0xbe14('0x2e')][_0xbe14('0x33')]){_0x179077[_0xbe14('0x29')]=[{'all':!![]}];}return db['CmHopper'][_0xbe14('0x4f')](_0x179077);})[_0xbe14('0x13')](function(_0x3cd17e){_0x29761b[_0xbe14('0x50')]=_0x3cd17e;return _0x29761b;});}})[_0xbe14('0x13')](respondWithFilteredResult(_0xcef8e3,_0x179077))[_0xbe14('0x35')](handleError(_0xcef8e3,null));};exports[_0xbe14('0x51')]=function(_0xd756b2,_0x5d064e){var _0x1e5ce1={'raw':!![],'where':{}};var _0x401968={};var _0x362999={'count':0x0,'rows':[]};return db[_0xbe14('0x23')][_0xbe14('0x52')]({'where':{'id':_0xd756b2[_0xbe14('0x2b')]['id']}})['then'](handleEntityNotFound(_0x5d064e,null))[_0xbe14('0x13')](function(_0x175213){if(_0x175213){_0x401968[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db['CmHopperHistory'][_0xbe14('0x24')]);_0x401968[_0xbe14('0x2e')]=_[_0xbe14('0x2d')](_0xd756b2[_0xbe14('0x2e')]);_0x401968[_0xbe14('0x48')]=_[_0xbe14('0x2f')](_0x401968[_0xbe14('0x2c')],_0x401968['query']);_0x1e5ce1[_0xbe14('0x30')]=_['intersection'](_0x401968[_0xbe14('0x2c')],qs['fields'](_0xd756b2[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x1e5ce1[_0xbe14('0x30')]=_0x1e5ce1['attributes'][_0xbe14('0x32')]?_0x1e5ce1[_0xbe14('0x30')]:_0x401968[_0xbe14('0x2c')];if(!_0xd756b2['query'][_0xbe14('0x49')](_0xbe14('0x4a'))){_0x1e5ce1[_0xbe14('0xf')]=qs[_0xbe14('0xf')](_0xd756b2['query'][_0xbe14('0xf')]);_0x1e5ce1[_0xbe14('0xd')]=qs[_0xbe14('0xd')](_0xd756b2[_0xbe14('0x2e')][_0xbe14('0xd')]);}_0x1e5ce1[_0xbe14('0x4b')]=qs[_0xbe14('0x4c')](_0xd756b2['query'][_0xbe14('0x4c')]);_0x1e5ce1[_0xbe14('0x28')]=qs[_0xbe14('0x48')](_['pick'](_0xd756b2[_0xbe14('0x2e')],_0x401968[_0xbe14('0x48')]));_0x1e5ce1[_0xbe14('0x28')]['VoiceQueueId']=_0x175213['id'];if(_0xd756b2[_0xbe14('0x2e')][_0xbe14('0x19')]){_0x1e5ce1['where']=_[_0xbe14('0x40')](_0x1e5ce1['where'],{'$or':_[_0xbe14('0x1a')](_0x1e5ce1[_0xbe14('0x30')],function(_0x4dfa19){var _0x55d729={};_0x55d729[_0x4dfa19]={'$like':'%'+_0xd756b2[_0xbe14('0x2e')][_0xbe14('0x19')]+'%'};return _0x55d729;})});}_0x1e5ce1=_[_0xbe14('0x40')]({},_0x1e5ce1,_0xd756b2['options']);return db[_0xbe14('0x53')][_0xbe14('0x10')]({'where':_0x1e5ce1[_0xbe14('0x28')]})[_0xbe14('0x13')](function(_0x5ee624){_0x362999['count']=_0x5ee624;if(_0xd756b2[_0xbe14('0x2e')][_0xbe14('0x33')]){_0x1e5ce1[_0xbe14('0x29')]=[{'all':!![]}];}return db[_0xbe14('0x53')][_0xbe14('0x4f')](_0x1e5ce1);})[_0xbe14('0x13')](function(_0x139aab){_0x362999['rows']=_0x139aab;return _0x362999;});}})[_0xbe14('0x13')](respondWithFilteredResult(_0x5d064e,_0x1e5ce1))['catch'](handleError(_0x5d064e,null));};exports[_0xbe14('0x54')]=function(_0x3a01bb,_0x8d47f2){var _0x2382c4={'raw':!![],'where':{}};var _0x55a3ae={};var _0x1e160b={'count':0x0,'rows':[]};return db[_0xbe14('0x23')][_0xbe14('0x52')]({'where':{'id':_0x3a01bb['params']['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x8d47f2,null))[_0xbe14('0x13')](function(_0x4090bc){if(_0x4090bc){_0x55a3ae[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db[_0xbe14('0x55')][_0xbe14('0x24')]);_0x55a3ae[_0xbe14('0x2e')]=_[_0xbe14('0x2d')](_0x3a01bb[_0xbe14('0x2e')]);_0x55a3ae[_0xbe14('0x48')]=_[_0xbe14('0x2f')](_0x55a3ae[_0xbe14('0x2c')],_0x55a3ae[_0xbe14('0x2e')]);_0x2382c4[_0xbe14('0x30')]=_[_0xbe14('0x2f')](_0x55a3ae[_0xbe14('0x2c')],qs[_0xbe14('0x31')](_0x3a01bb[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x2382c4['attributes']=_0x2382c4[_0xbe14('0x30')]['length']?_0x2382c4[_0xbe14('0x30')]:_0x55a3ae[_0xbe14('0x2c')];if(!_0x3a01bb[_0xbe14('0x2e')][_0xbe14('0x49')](_0xbe14('0x4a'))){_0x2382c4['limit']=qs['limit'](_0x3a01bb[_0xbe14('0x2e')][_0xbe14('0xf')]);_0x2382c4[_0xbe14('0xd')]=qs[_0xbe14('0xd')](_0x3a01bb['query'][_0xbe14('0xd')]);}_0x2382c4[_0xbe14('0x4b')]=qs['sort'](_0x3a01bb[_0xbe14('0x2e')][_0xbe14('0x4c')]);_0x2382c4[_0xbe14('0x28')]=qs[_0xbe14('0x48')](_['pick'](_0x3a01bb[_0xbe14('0x2e')],_0x55a3ae['filters']));_0x2382c4['where'][_0xbe14('0x4e')]=_0x4090bc['id'];if(_0x3a01bb[_0xbe14('0x2e')][_0xbe14('0x19')]){_0x2382c4[_0xbe14('0x28')]=_[_0xbe14('0x40')](_0x2382c4['where'],{'$or':_[_0xbe14('0x1a')](_0x2382c4[_0xbe14('0x30')],function(_0x5dc793){var _0x4e35ed={};_0x4e35ed[_0x5dc793]={'$like':'%'+_0x3a01bb[_0xbe14('0x2e')][_0xbe14('0x19')]+'%'};return _0x4e35ed;})});}_0x2382c4=_['merge']({},_0x2382c4,_0x3a01bb[_0xbe14('0x34')]);return db['CmHopperFinal'][_0xbe14('0x10')]({'where':_0x2382c4['where']})[_0xbe14('0x13')](function(_0x5d4431){_0x1e160b[_0xbe14('0x10')]=_0x5d4431;if(_0x3a01bb['query'][_0xbe14('0x33')]){_0x2382c4[_0xbe14('0x29')]=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x2382c4);})[_0xbe14('0x13')](function(_0x4db7e8){_0x1e160b['rows']=_0x4db7e8;return _0x1e160b;});}})[_0xbe14('0x13')](respondWithFilteredResult(_0x8d47f2,_0x2382c4))[_0xbe14('0x35')](handleError(_0x8d47f2,null));};exports[_0xbe14('0x56')]=function(_0x11c341,_0x1a780a){var _0x313a87={'raw':!![],'where':{}};var _0x30d2b0={};var _0x57ad22={'count':0x0,'rows':[]};return db[_0xbe14('0x23')][_0xbe14('0x52')]({'where':{'id':_0x11c341[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x1a780a,null))['then'](function(_0x26372a){if(_0x26372a){_0x30d2b0[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db['CmHopperBlack'][_0xbe14('0x24')]);_0x30d2b0[_0xbe14('0x2e')]=_['keys'](_0x11c341[_0xbe14('0x2e')]);_0x30d2b0['filters']=_[_0xbe14('0x2f')](_0x30d2b0[_0xbe14('0x2c')],_0x30d2b0[_0xbe14('0x2e')]);_0x313a87['attributes']=_[_0xbe14('0x2f')](_0x30d2b0['model'],qs[_0xbe14('0x31')](_0x11c341['query']['fields']));_0x313a87[_0xbe14('0x30')]=_0x313a87['attributes'][_0xbe14('0x32')]?_0x313a87['attributes']:_0x30d2b0[_0xbe14('0x2c')];if(!_0x11c341[_0xbe14('0x2e')][_0xbe14('0x49')](_0xbe14('0x4a'))){_0x313a87[_0xbe14('0xf')]=qs[_0xbe14('0xf')](_0x11c341[_0xbe14('0x2e')][_0xbe14('0xf')]);_0x313a87[_0xbe14('0xd')]=qs[_0xbe14('0xd')](_0x11c341[_0xbe14('0x2e')][_0xbe14('0xd')]);}_0x313a87[_0xbe14('0x4b')]=qs['sort'](_0x11c341[_0xbe14('0x2e')][_0xbe14('0x4c')]);_0x313a87[_0xbe14('0x28')]=qs[_0xbe14('0x48')](_[_0xbe14('0x4d')](_0x11c341['query'],_0x30d2b0['filters']));_0x313a87[_0xbe14('0x28')][_0xbe14('0x4e')]=_0x26372a['id'];if(_0x11c341[_0xbe14('0x2e')][_0xbe14('0x19')]){_0x313a87[_0xbe14('0x28')]=_[_0xbe14('0x40')](_0x313a87[_0xbe14('0x28')],{'$or':_[_0xbe14('0x1a')](_0x313a87[_0xbe14('0x30')],function(_0x26e7a7){var _0x761b3d={};_0x761b3d[_0x26e7a7]={'$like':'%'+_0x11c341[_0xbe14('0x2e')][_0xbe14('0x19')]+'%'};return _0x761b3d;})});}_0x313a87=_[_0xbe14('0x40')]({},_0x313a87,_0x11c341[_0xbe14('0x34')]);return db[_0xbe14('0x57')][_0xbe14('0x10')]({'where':_0x313a87[_0xbe14('0x28')]})[_0xbe14('0x13')](function(_0x28a1e9){_0x57ad22[_0xbe14('0x10')]=_0x28a1e9;if(_0x11c341[_0xbe14('0x2e')][_0xbe14('0x33')]){_0x313a87[_0xbe14('0x29')]=[{'all':!![]}];}return db[_0xbe14('0x57')]['findAll'](_0x313a87);})[_0xbe14('0x13')](function(_0x3303a4){_0x57ad22[_0xbe14('0x50')]=_0x3303a4;return _0x57ad22;});}})[_0xbe14('0x13')](respondWithFilteredResult(_0x1a780a,_0x313a87))[_0xbe14('0x35')](handleError(_0x1a780a,null));};exports[_0xbe14('0x58')]=function(_0x52b75d,_0x5b161c){var _0x165b7a={};var _0x4a44e0={};var _0x3730d1;var _0x4babba;return db[_0xbe14('0x23')]['findOne']({'where':{'id':_0x52b75d[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x5b161c,null))[_0xbe14('0x13')](function(_0x12498f){if(_0x12498f){_0x3730d1=_0x12498f;_0x4a44e0[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db[_0xbe14('0x59')][_0xbe14('0x24')]);_0x4a44e0[_0xbe14('0x2e')]=_['keys'](_0x52b75d[_0xbe14('0x2e')]);_0x4a44e0[_0xbe14('0x48')]=_[_0xbe14('0x2f')](_0x4a44e0[_0xbe14('0x2c')],_0x4a44e0['query']);_0x165b7a[_0xbe14('0x30')]=_['intersection'](_0x4a44e0[_0xbe14('0x2c')],qs['fields'](_0x52b75d[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x165b7a[_0xbe14('0x30')]=_0x165b7a['attributes'][_0xbe14('0x32')]?_0x165b7a['attributes']:_0x4a44e0[_0xbe14('0x2c')];_0x165b7a[_0xbe14('0x4b')]=qs[_0xbe14('0x4c')](_0x52b75d[_0xbe14('0x2e')][_0xbe14('0x4c')]);_0x165b7a[_0xbe14('0x28')]=qs[_0xbe14('0x48')](_[_0xbe14('0x4d')](_0x52b75d[_0xbe14('0x2e')],_0x4a44e0['filters']));if(_0x52b75d[_0xbe14('0x2e')]['filter']){_0x165b7a[_0xbe14('0x28')]=_[_0xbe14('0x40')](_0x165b7a[_0xbe14('0x28')],{'$or':_['map'](_0x165b7a[_0xbe14('0x30')],function(_0x1c5fbc){var _0x219403={};_0x219403[_0x1c5fbc]={'$like':'%'+_0x52b75d[_0xbe14('0x2e')][_0xbe14('0x19')]+'%'};return _0x219403;})});}_0x165b7a=_['merge']({},_0x165b7a,_0x52b75d['options']);return _0x3730d1[_0xbe14('0x58')](_0x165b7a);}})['then'](function(_0x16b1c8){if(_0x16b1c8){_0x4babba=_0x16b1c8[_0xbe14('0x32')];if(!_0x52b75d[_0xbe14('0x2e')][_0xbe14('0x49')]('nolimit')){_0x165b7a[_0xbe14('0xf')]=qs[_0xbe14('0xf')](_0x52b75d['query'][_0xbe14('0xf')]);_0x165b7a[_0xbe14('0xd')]=qs[_0xbe14('0xd')](_0x52b75d[_0xbe14('0x2e')]['offset']);}return _0x3730d1[_0xbe14('0x58')](_0x165b7a);}})[_0xbe14('0x13')](function(_0x37aff6){if(_0x37aff6){return _0x37aff6?{'count':_0x4babba,'rows':_0x37aff6}:null;}})[_0xbe14('0x13')](respondWithResult(_0x5b161c,null))[_0xbe14('0x35')](handleError(_0x5b161c,null));};exports[_0xbe14('0x5a')]=function(_0x208fae,_0x310d42){var _0x9c229f=_0x208fae[_0xbe14('0x37')]['teams'];var _0xdb5515=_[_0xbe14('0x1a')](_0x9c229f,'id');return db[_0xbe14('0x59')][_0xbe14('0x4f')]({'where':{'id':_0xdb5515},'attributes':['id'],'include':[{'model':db['User'],'as':_0xbe14('0x5b'),'attributes':['id',_0xbe14('0x1e'),_0xbe14('0x5c'),'voicePause',_0xbe14('0x5d')],'raw':!![]}]})[_0xbe14('0x13')](function(_0x1ec868){if(_0x1ec868){var _0x1a7321=_[_0xbe14('0x5e')](_0x1ec868,function(_0x2306f6){var _0x426189=_0x2306f6['get']({'plain':!![]});_0x426189[_0xbe14('0x5b')]['forEach'](function(_0x24d528){_0x24d528[_0xbe14('0x5f')]=_[_0xbe14('0x1d')](_0x9c229f,{'id':_0x426189['id']})[_0xbe14('0x5f')];});return _0x426189[_0xbe14('0x5b')];});return db['VoiceQueue']['find']({'where':{'id':_0x208fae[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](function(_0x29a892){return db[_0xbe14('0x60')]['transaction'](function(_0x46a251){return _0x29a892[_0xbe14('0x5a')](_0xdb5515,{'transaction':_0x46a251})[_0xbe14('0x13')](function(){return BPromise['each'](_0x9c229f,function(_0xe69b0e){return db['TeamVoiceQueue']['upsert']({'TeamId':_0xe69b0e['id'],'VoiceQueueId':_0x208fae[_0xbe14('0x2b')]['id'],'penalty':_0xe69b0e[_0xbe14('0x5f')]},{'transaction':_0x46a251});});})[_0xbe14('0x13')](function(){return BPromise['each'](_0x1a7321,function(_0x3ea9c2){return db[_0xbe14('0x61')]['findOrCreate']({'where':{'UserId':_0x3ea9c2['id'],'VoiceQueueId':_0x208fae[_0xbe14('0x2b')]['id']},'defaults':{'penalty':_0x3ea9c2[_0xbe14('0x5f')]},'transaction':_0x46a251});});})[_0xbe14('0x13')](function(){return BPromise['each'](_[_0xbe14('0x19')](_0x1a7321,{'online':!![]}),function(_0x1e2559){return db[_0xbe14('0x62')][_0xbe14('0x63')]({'membername':_0x1e2559[_0xbe14('0x1e')],'UserId':_0x1e2559['id'],'queue_name':_0x29a892['name'],'VoiceQueueId':_0x29a892['id'],'interface':_[_0xbe14('0x64')](_0x1e2559[_0xbe14('0x5d')])?util[_0xbe14('0x65')]('SIP/%s',_0x1e2559[_0xbe14('0x1e')]):_0x1e2559[_0xbe14('0x5d')],'paused':_0x1e2559[_0xbe14('0x66')]||![],'penalty':_0x1e2559[_0xbe14('0x5f')]},{'transaction':_0x46a251});});})[_0xbe14('0x13')](function(){_0x1a7321[_0xbe14('0x67')](function(_0x1b22a0){socket[_0xbe14('0x68')](_0xbe14('0x69'),{'UserId':_0x1b22a0['id'],'VoiceQueueId':_0x29a892['id']});});});});});}})[_0xbe14('0x13')](respondWithStatusCode(_0x310d42,null))[_0xbe14('0x35')](handleError(_0x310d42,null));};exports['removeTeams']=function(_0xf549ec,_0x2c3647){return db[_0xbe14('0x59')]['findAll']({'where':{'id':_0xf549ec[_0xbe14('0x2e')][_0xbe14('0x6a')]},'attributes':['id'],'include':[{'model':db[_0xbe14('0x6b')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xbe14('0x13')](handleEntityNotFound(_0x2c3647,null))['then'](function(_0x2d4b18){var _0xcd8cf6=_['map'](_0x2d4b18,'id');var _0x269e5a=[];var _0x4c7e2b=[];var _0x587f58=squel[_0xbe14('0x6c')]();_0x587f58[_0xbe14('0x6d')](_0xbe14('0x6e'))[_0xbe14('0x6f')](_0xbe14('0x70'),'tq')[_0xbe14('0x71')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0xbe14('0x28')](_0xbe14('0x72'),_0xf549ec[_0xbe14('0x2b')]['id']);for(var _0x3c23fc=0x0;_0x3c23fc<_0x2d4b18['length'];_0x3c23fc+=0x1){let _0x1d5333=_0x2d4b18[_0x3c23fc];for(var _0x4cb29c=0x0;_0x4cb29c<_0x1d5333[_0xbe14('0x5b')][_0xbe14('0x32')];_0x4cb29c+=0x1){let _0x5270b2=_0x1d5333[_0xbe14('0x5b')][_0x4cb29c];var _0x273df5=_0x587f58[_0xbe14('0x3f')]();_0x273df5[_0xbe14('0x28')](_0xbe14('0x73'),_0x5270b2['id']);_0x4c7e2b[_0xbe14('0x74')](db[_0xbe14('0x60')][_0xbe14('0x2e')](_0x273df5[_0xbe14('0x75')](),{'type':db[_0xbe14('0x60')][_0xbe14('0x76')][_0xbe14('0x77')]})['then'](function(_0x20f196){if(_0x20f196[_0xbe14('0x32')]===0x1){return _0x5270b2['id'];}else{var _0x1eb33b=_[_0xbe14('0x78')](_['map'](_0x20f196,_0xbe14('0x79')),function(_0xede1c1){return _['includes'](_0xcd8cf6,_0xede1c1);});if(_0x1eb33b){return _0x5270b2['id'];}}}));}}return BPromise[_0xbe14('0x7a')](_0x4c7e2b)[_0xbe14('0x13')](function(_0x11085c){_0x269e5a=_(_0x269e5a)['union'](_0x11085c)[_0xbe14('0x7b')]()[_0xbe14('0x1b')]();return db[_0xbe14('0x23')][_0xbe14('0x1d')]({'where':{'id':_0xf549ec[_0xbe14('0x2b')]['id']}})['then'](function(_0x23208d){return db[_0xbe14('0x60')][_0xbe14('0x7c')](function(_0x3f7732){return _0x23208d[_0xbe14('0x7d')](_0xf549ec['query'][_0xbe14('0x6a')],{'transaction':_0x3f7732})[_0xbe14('0x13')](function(){if(!_[_0xbe14('0x7e')](_0x269e5a)){return _0x23208d[_0xbe14('0x7f')](_0x269e5a,{'transaction':_0x3f7732})[_0xbe14('0x13')](function(){return db[_0xbe14('0x62')][_0xbe14('0x14')]({'where':{'VoiceQueueId':_0xf549ec[_0xbe14('0x2b')]['id'],'UserId':_0x269e5a},'transaction':_0x3f7732});});}})['then'](function(){_0x269e5a['forEach'](function(_0x129ef6){socket[_0xbe14('0x68')](_0xbe14('0x80'),{'UserId':_0x129ef6,'VoiceQueueId':_0x23208d['id']});});});});});});})[_0xbe14('0x13')](respondWithStatusCode(_0x2c3647,null))[_0xbe14('0x35')](handleError(_0x2c3647,null));};exports['addAgents']=function(_0x15c93c,_0xf6ff8){var _0x3eaabe,_0x1ea11a;return db[_0xbe14('0x23')][_0xbe14('0x1d')]({'where':{'id':_0x15c93c[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0xf6ff8,null))['then'](function(_0xf6da38){if(_0xf6da38){_0x1ea11a=_0xf6da38;return _0xf6da38[_0xbe14('0x81')](_0x15c93c['body']['ids'],_[_0xbe14('0x41')](_0x15c93c['body'],[_0xbe14('0x6a'),'id'])||{})[_0xbe14('0x82')](function(_0x776e93){for(var _0x3f5ca3=0x0;_0x3f5ca3<_0x15c93c[_0xbe14('0x37')]['ids'][_0xbe14('0x32')];_0x3f5ca3+=0x1){socket[_0xbe14('0x68')](_0xbe14('0x69'),{'UserId':Number(_0x15c93c[_0xbe14('0x37')][_0xbe14('0x6a')][_0x3f5ca3]),'VoiceQueueId':Number(_0x15c93c[_0xbe14('0x2b')]['id'])});}return _0x776e93;});}})['then'](function(_0x4eea48){_0x3eaabe=_0x4eea48||[];if(_0x1ea11a){return db[_0xbe14('0x6b')]['findAll']({'where':{'id':_0x15c93c[_0xbe14('0x37')][_0xbe14('0x6a')]},'attributes':['id',_0xbe14('0x1e'),'online',_0xbe14('0x66'),_0xbe14('0x5d')],'raw':!![]});}})[_0xbe14('0x13')](function(_0x1ad15d){if(!_[_0xbe14('0x7e')](_0x1ad15d)){var _0x2e5106=[];for(var _0x156fb3=0x0;_0x156fb3<_0x1ad15d['length'];_0x156fb3++){if(_0x1ad15d[_0x156fb3][_0xbe14('0x5c')]){_0x2e5106['push'](db['UserVoiceQueueRt']['upsert']({'membername':_0x1ad15d[_0x156fb3]['name'],'UserId':_0x1ad15d[_0x156fb3]['id'],'queue_name':_0x1ea11a[_0xbe14('0x1e')],'VoiceQueueId':_0x1ea11a['id'],'interface':_[_0xbe14('0x64')](_0x1ad15d[_0x156fb3]['interface'])?util[_0xbe14('0x65')]('SIP/%s',_0x1ad15d[_0x156fb3][_0xbe14('0x1e')]):_0x1ad15d[_0x156fb3]['interface'],'paused':_0x1ad15d[_0x156fb3][_0xbe14('0x66')]||![],'penalty':_0x15c93c[_0xbe14('0x37')][_0xbe14('0x5f')]||0x0}));}}return BPromise[_0xbe14('0x7a')](_0x2e5106);}})[_0xbe14('0x13')](function(){return _0x3eaabe;})['then'](respondWithResult(_0xf6ff8,null))[_0xbe14('0x35')](handleError(_0xf6ff8,null));};exports[_0xbe14('0x7f')]=function(_0x3aaa54,_0x413893){return db['VoiceQueue']['find']({'where':{'id':_0x3aaa54['params']['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x413893,null))[_0xbe14('0x13')](function(_0x3826cf){if(_0x3826cf){return _0x3826cf[_0xbe14('0x7f')](_0x3aaa54[_0xbe14('0x2e')]['ids'])['then'](function(){if(_[_0xbe14('0x83')](_0x3aaa54[_0xbe14('0x2e')][_0xbe14('0x6a')])){for(var _0x26092b=0x0;_0x26092b<_0x3aaa54[_0xbe14('0x2e')]['ids'][_0xbe14('0x32')];_0x26092b+=0x1){socket['emit'](_0xbe14('0x80'),{'UserId':Number(_0x3aaa54[_0xbe14('0x2e')][_0xbe14('0x6a')][_0x26092b]),'VoiceQueueId':Number(_0x3aaa54[_0xbe14('0x2b')]['id'])});}}else{socket['emit'](_0xbe14('0x80'),{'UserId':Number(_0x3aaa54[_0xbe14('0x2e')][_0xbe14('0x6a')]),'VoiceQueueId':Number(_0x3aaa54[_0xbe14('0x2b')]['id'])});}});}})['then'](function(_0x44c341){return db[_0xbe14('0x62')][_0xbe14('0x14')]({'where':{'VoiceQueueId':_0x3aaa54['params']['id'],'UserId':_0x3aaa54['query'][_0xbe14('0x6a')]}})[_0xbe14('0x13')](function(){return _0x44c341;});})[_0xbe14('0x13')](respondWithStatusCode(_0x413893,null))['catch'](handleError(_0x413893,null));};exports[_0xbe14('0x84')]=function(_0x2f0d14,_0x180e61){var _0x952322={};var _0x3ae00b={};var _0x41962a;var _0x4ebf01;return db[_0xbe14('0x23')][_0xbe14('0x52')]({'where':{'id':_0x2f0d14[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x180e61,null))[_0xbe14('0x13')](function(_0x5f28dd){if(_0x5f28dd){_0x41962a=_0x5f28dd;_0x3ae00b['model']=_[_0xbe14('0x2d')](db['User'][_0xbe14('0x24')]);_0x3ae00b['query']=_[_0xbe14('0x2d')](_0x2f0d14[_0xbe14('0x2e')]);_0x3ae00b[_0xbe14('0x48')]=_['intersection'](_0x3ae00b[_0xbe14('0x2c')],_0x3ae00b[_0xbe14('0x2e')]);_0x952322[_0xbe14('0x30')]=_[_0xbe14('0x2f')](_0x3ae00b[_0xbe14('0x2c')],qs[_0xbe14('0x31')](_0x2f0d14[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x952322[_0xbe14('0x30')]=_0x952322[_0xbe14('0x30')]['length']?_0x952322[_0xbe14('0x30')]:_0x3ae00b[_0xbe14('0x2c')];_0x952322[_0xbe14('0x4b')]=qs[_0xbe14('0x4c')](_0x2f0d14[_0xbe14('0x2e')][_0xbe14('0x4c')]);_0x952322[_0xbe14('0x28')]=qs[_0xbe14('0x48')](_['pick'](_0x2f0d14[_0xbe14('0x2e')],_0x3ae00b[_0xbe14('0x48')]));if(_0x2f0d14[_0xbe14('0x2e')][_0xbe14('0x19')]){_0x952322[_0xbe14('0x28')]=_[_0xbe14('0x40')](_0x952322['where'],{'$or':_['map'](_0x952322['attributes'],function(_0x598ccc){var _0x446b3f={};_0x446b3f[_0x598ccc]={'$like':'%'+_0x2f0d14[_0xbe14('0x2e')]['filter']+'%'};return _0x446b3f;})});}_0x952322=_[_0xbe14('0x40')]({},_0x952322,_0x2f0d14['options']);return _0x41962a[_0xbe14('0x84')](_0x952322);}})[_0xbe14('0x13')](function(_0x111ff0){if(_0x111ff0){_0x4ebf01=_0x111ff0[_0xbe14('0x32')];if(!_0x2f0d14[_0xbe14('0x2e')][_0xbe14('0x49')]('nolimit')){_0x952322[_0xbe14('0xf')]=qs[_0xbe14('0xf')](_0x2f0d14[_0xbe14('0x2e')][_0xbe14('0xf')]);_0x952322[_0xbe14('0xd')]=qs[_0xbe14('0xd')](_0x2f0d14[_0xbe14('0x2e')][_0xbe14('0xd')]);}return _0x41962a[_0xbe14('0x84')](_0x952322);}})['then'](function(_0x2eb5e6){if(_0x2eb5e6){return _0x2eb5e6?{'count':_0x4ebf01,'rows':_0x2eb5e6}:null;}})['then'](respondWithResult(_0x180e61,null))[_0xbe14('0x35')](handleError(_0x180e61,null));};exports['getMembers']=function(_0x49cddc,_0x3bdbf7){var _0x19a1ae={};var _0x167dee={};var _0x4f6252;var _0x4536b9;return db['VoiceQueue'][_0xbe14('0x52')]({'where':{'id':_0x49cddc['params']['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x3bdbf7,null))[_0xbe14('0x13')](function(_0x21f14e){if(_0x21f14e){_0x4f6252=_0x21f14e;_0x167dee[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db[_0xbe14('0x62')]['rawAttributes']);_0x167dee[_0xbe14('0x2e')]=_[_0xbe14('0x2d')](_0x49cddc['query']);_0x167dee['filters']=_['intersection'](_0x167dee[_0xbe14('0x2c')],_0x167dee[_0xbe14('0x2e')]);_0x19a1ae[_0xbe14('0x30')]=_[_0xbe14('0x2f')](_0x167dee[_0xbe14('0x2c')],qs[_0xbe14('0x31')](_0x49cddc[_0xbe14('0x2e')]['fields']));_0x19a1ae[_0xbe14('0x30')]=_0x19a1ae[_0xbe14('0x30')][_0xbe14('0x32')]?_0x19a1ae['attributes']:_0x167dee[_0xbe14('0x2c')];_0x19a1ae[_0xbe14('0x4b')]=qs[_0xbe14('0x4c')](_0x49cddc['query']['sort']);_0x19a1ae[_0xbe14('0x28')]=qs['filters'](_[_0xbe14('0x4d')](_0x49cddc[_0xbe14('0x2e')],_0x167dee[_0xbe14('0x48')]));if(_0x49cddc[_0xbe14('0x2e')][_0xbe14('0x19')]){_0x19a1ae[_0xbe14('0x28')]=_['merge'](_0x19a1ae[_0xbe14('0x28')],{'$or':_['map'](_0x19a1ae[_0xbe14('0x30')],function(_0x2d0568){var _0x26bb56={};_0x26bb56[_0x2d0568]={'$like':'%'+_0x49cddc['query'][_0xbe14('0x19')]+'%'};return _0x26bb56;})});}_0x19a1ae=_[_0xbe14('0x40')]({},_0x19a1ae,_0x49cddc['options']);return _0x4f6252['getMembers'](_0x19a1ae);}})[_0xbe14('0x13')](function(_0x3d9061){if(_0x3d9061){_0x4536b9=_0x3d9061[_0xbe14('0x32')];if(!_0x49cddc['query'][_0xbe14('0x49')](_0xbe14('0x4a'))){_0x19a1ae['limit']=qs['limit'](_0x49cddc['query']['limit']);_0x19a1ae[_0xbe14('0xd')]=qs[_0xbe14('0xd')](_0x49cddc['query']['offset']);}return _0x4f6252[_0xbe14('0x85')](_0x19a1ae);}})[_0xbe14('0x13')](function(_0x1046a0){return _0x1046a0?{'count':_0x4536b9,'rows':_0x1046a0}:null;})['then'](respondWithResult(_0x3bdbf7,null))[_0xbe14('0x35')](handleError(_0x3bdbf7,null));};exports[_0xbe14('0x86')]=function(_0x3933c7,_0x416c65){var _0x56f870={};var _0x28b3c4={};var _0x6fe862;var _0x5f4675;return db[_0xbe14('0x23')][_0xbe14('0x52')]({'where':{'id':_0x3933c7[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x416c65,null))[_0xbe14('0x13')](function(_0x4c4ab9){if(_0x4c4ab9){_0x6fe862=_0x4c4ab9;_0x28b3c4['model']=_[_0xbe14('0x2d')](db[_0xbe14('0x87')][_0xbe14('0x24')]);_0x28b3c4[_0xbe14('0x2e')]=_['keys'](_0x3933c7[_0xbe14('0x2e')]);_0x28b3c4[_0xbe14('0x48')]=_['intersection'](_0x28b3c4[_0xbe14('0x2c')],_0x28b3c4['query']);_0x56f870[_0xbe14('0x30')]=_[_0xbe14('0x2f')](_0x28b3c4['model'],qs[_0xbe14('0x31')](_0x3933c7[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x56f870[_0xbe14('0x30')]=_0x56f870[_0xbe14('0x30')][_0xbe14('0x32')]?_0x56f870[_0xbe14('0x30')]:_0x28b3c4[_0xbe14('0x2c')];_0x56f870['order']=qs[_0xbe14('0x4c')](_0x3933c7[_0xbe14('0x2e')][_0xbe14('0x4c')]);_0x56f870['where']=qs['filters'](_['pick'](_0x3933c7[_0xbe14('0x2e')],_0x28b3c4[_0xbe14('0x48')]));if(_0x3933c7[_0xbe14('0x2e')]['filter']){_0x56f870['where']=_[_0xbe14('0x40')](_0x56f870[_0xbe14('0x28')],{'$or':_[_0xbe14('0x1a')](_0x56f870[_0xbe14('0x30')],function(_0x2ac6c0){var _0x3d381e={};_0x3d381e[_0x2ac6c0]={'$like':'%'+_0x3933c7[_0xbe14('0x2e')][_0xbe14('0x19')]+'%'};return _0x3d381e;})});}_0x56f870=_[_0xbe14('0x40')]({},_0x56f870,_0x3933c7['options']);return _0x6fe862[_0xbe14('0x86')](_0x56f870);}})[_0xbe14('0x13')](function(_0x2ca4de){if(_0x2ca4de){_0x5f4675=_0x2ca4de[_0xbe14('0x32')];if(!_0x3933c7[_0xbe14('0x2e')]['hasOwnProperty'](_0xbe14('0x4a'))){_0x56f870['limit']=qs['limit'](_0x3933c7[_0xbe14('0x2e')][_0xbe14('0xf')]);_0x56f870['offset']=qs['offset'](_0x3933c7[_0xbe14('0x2e')][_0xbe14('0xd')]);}return _0x6fe862[_0xbe14('0x86')](_0x56f870);}})[_0xbe14('0x13')](function(_0x2e7c31){if(_0x2e7c31){return _0x2e7c31?{'count':_0x5f4675,'rows':_0x2e7c31}:null;}})['then'](respondWithResult(_0x416c65,null))['catch'](handleError(_0x416c65,null));};exports[_0xbe14('0x88')]=function(_0x4b07fc,_0x76e84){var _0x3f687f=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x4f4b69,_0x43d760;return db['VoiceQueue'][_0xbe14('0x1d')]({'where':{'id':_0x4b07fc[_0xbe14('0x2b')]['id']}})['then'](handleEntityNotFound(_0x76e84,null))[_0xbe14('0x13')](function(_0x30657c){if(_0x30657c){_0x43d760=_0x30657c;return _0x30657c[_0xbe14('0x88')](_0x4b07fc[_0xbe14('0x37')][_0xbe14('0x6a')],_['omit'](_0x4b07fc[_0xbe14('0x37')],[_0xbe14('0x6a'),'id'])||{});}return null;})[_0xbe14('0x82')](function(_0xd97d02){var _0x15082b;_0x4f4b69=_0xd97d02||[];var _0x5d15c7=[];if(_0xd97d02){for(var _0x66b6a7=0x0;_0x66b6a7<_0xd97d02[_0xbe14('0x32')];_0x66b6a7+=0x1){var _0x4dfe2c=_0xd97d02[_0x66b6a7][_0xbe14('0x15')]({'plain':!![]});_0x43d760['dialCheckDuplicateType']=_0x4b07fc[_0xbe14('0x37')][_0xbe14('0x89')]?_0x4b07fc[_0xbe14('0x37')][_0xbe14('0x89')]:_0x43d760[_0xbe14('0x89')];switch(_0x43d760[_0xbe14('0x89')]){case'always':_0x15082b=squel[_0xbe14('0x8a')]()[_0xbe14('0x8b')](_0xbe14('0x8c'))[_0xbe14('0x8d')]([_0xbe14('0x8e'),_0xbe14('0x8f'),_0xbe14('0x90'),_0xbe14('0x91'),_0xbe14('0x4e'),_0xbe14('0x42'),'updatedAt'],squel[_0xbe14('0x6c')]()[_0xbe14('0x6d')]('phone',_0xbe14('0x8e'))[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x8f'))[_0xbe14('0x6d')]('id',_0xbe14('0x90'))[_0xbe14('0x6d')](_0x4dfe2c[_0xbe14('0x92')][_0xbe14('0x75')](),'ListId')[_0xbe14('0x6d')](_0x4b07fc['params']['id'][_0xbe14('0x75')](),_0xbe14('0x4e'))[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x42'))[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x43'))[_0xbe14('0x6f')]('cm_contacts')['where']('deletedAt\x20IS\x20NULL')[_0xbe14('0x28')](_0xbe14('0x93'),_0x4dfe2c['CmListId'][_0xbe14('0x75')]())[_0xbe14('0x28')](_0xbe14('0x94'))[_0xbe14('0x28')](_0xbe14('0x95'),squel[_0xbe14('0x6c')]()[_0xbe14('0x6d')](_0xbe14('0x96'))[_0xbe14('0x6f')](_0xbe14('0x97'))[_0xbe14('0x28')]('VoiceQueueId\x20=\x20?',_0x4b07fc[_0xbe14('0x2b')]['id']['toString']()))[_0xbe14('0x28')](_0xbe14('0x95'),squel[_0xbe14('0x6c')]()['field'](_0xbe14('0x98'))[_0xbe14('0x6f')]('cm_hopper')[_0xbe14('0x28')](_0xbe14('0x72'),_0x4b07fc[_0xbe14('0x2b')]['id']['toString']())))[_0xbe14('0x75')]();break;case _0xbe14('0x99'):_0x15082b=squel['insert']()[_0xbe14('0x8b')]('cm_hopper')[_0xbe14('0x8d')]([_0xbe14('0x8e'),_0xbe14('0x8f'),_0xbe14('0x90'),'ListId','VoiceQueueId',_0xbe14('0x42'),_0xbe14('0x43')],squel['select']()['field'](_0xbe14('0x8e'),'phone')[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x8f'))[_0xbe14('0x6d')]('id',_0xbe14('0x90'))[_0xbe14('0x6d')](_0x4dfe2c[_0xbe14('0x92')][_0xbe14('0x75')](),_0xbe14('0x91'))[_0xbe14('0x6d')](_0x4b07fc[_0xbe14('0x2b')]['id']['toString'](),'VoiceQueueId')['field']('\x27'+_0x3f687f+'\x27',_0xbe14('0x42'))[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x43'))[_0xbe14('0x6f')](_0xbe14('0x9a'))[_0xbe14('0x28')](_0xbe14('0x9b'))[_0xbe14('0x28')](_0xbe14('0x93'),_0x4dfe2c['CmListId'][_0xbe14('0x75')]())[_0xbe14('0x28')](_0xbe14('0x94'))['where'](_0xbe14('0x95'),squel[_0xbe14('0x6c')]()[_0xbe14('0x6d')](_0xbe14('0x98'))[_0xbe14('0x6f')](_0xbe14('0x8c'))[_0xbe14('0x28')]('VoiceQueueId\x20=\x20?',_0x4b07fc[_0xbe14('0x2b')]['id'][_0xbe14('0x75')]())))['toString']();break;default:_0x15082b=squel['insert']()[_0xbe14('0x8b')](_0xbe14('0x8c'))[_0xbe14('0x8d')](['phone',_0xbe14('0x8f'),_0xbe14('0x90'),_0xbe14('0x91'),_0xbe14('0x4e'),_0xbe14('0x42'),_0xbe14('0x43')],squel['select']()[_0xbe14('0x6d')]('phone',_0xbe14('0x8e'))[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x8f'))['field']('id',_0xbe14('0x90'))[_0xbe14('0x6d')](_0x4dfe2c['CmListId'][_0xbe14('0x75')](),'ListId')[_0xbe14('0x6d')](_0x4b07fc['params']['id'][_0xbe14('0x75')](),'VoiceQueueId')[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x42'))[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x43'))[_0xbe14('0x6f')]('cm_contacts')[_0xbe14('0x28')](_0xbe14('0x9b'))['where'](_0xbe14('0x93'),_0x4dfe2c[_0xbe14('0x92')]['toString']())[_0xbe14('0x28')](_0xbe14('0x94')))[_0xbe14('0x75')]();}_0x5d15c7['push'](db[_0xbe14('0x60')][_0xbe14('0x2e')](_0x15082b));}return BPromise[_0xbe14('0x7a')](_0x5d15c7);}})[_0xbe14('0x13')](function(){var _0x4bc564=[];var _0x19e7ce=squel[_0xbe14('0x8a')]()[_0xbe14('0x8b')](_0xbe14('0x9c'))[_0xbe14('0x8d')]([_0xbe14('0x9d'),_0xbe14('0x8e'),_0xbe14('0x9e'),_0xbe14('0x42'),'updatedAt'],squel[_0xbe14('0x6c')]()['field']('h.id')[_0xbe14('0x6d')](_0xbe14('0x9f'))['field'](_0xbe14('0xa0'))[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27','createdAt')[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x43'))[_0xbe14('0x6f')](_0xbe14('0xa1'),'ci')[_0xbe14('0x71')](_0xbe14('0x8c'),'h','h.ContactId=ci.CmContactId')['where'](_0xbe14('0xa2'),_0x3f687f)['where'](_0xbe14('0xa3'),_0xbe14('0xa4')))['toString']();_0x4bc564[_0xbe14('0x74')](db[_0xbe14('0x60')][_0xbe14('0x2e')](_0x19e7ce));return BPromise[_0xbe14('0x7a')](_0x4bc564);})[_0xbe14('0x13')](function(){return _0x4f4b69;})[_0xbe14('0x13')](respondWithResult(_0x76e84,null))[_0xbe14('0x35')](handleError(_0x76e84,null));};exports['removeLists']=function(_0x4ceca6,_0x23f4a3){return db[_0xbe14('0x23')][_0xbe14('0x1d')]({'where':{'id':_0x4ceca6[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x23f4a3,null))[_0xbe14('0x13')](function(_0x2fe8b0){if(_0x2fe8b0){return _0x2fe8b0[_0xbe14('0xa5')](_0x4ceca6['query'][_0xbe14('0x6a')]);}})[_0xbe14('0x13')](function(_0x186284){if(_0x186284){return db['CmHopper'][_0xbe14('0x14')]({'where':{'ListId':_0x4ceca6[_0xbe14('0x2e')][_0xbe14('0x6a')],'VoiceQueueId':_0x4ceca6[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](function(){return _0x186284;});}})['then'](respondWithStatusCode(_0x23f4a3,null))[_0xbe14('0x35')](handleError(_0x23f4a3,null));};exports[_0xbe14('0xa6')]=function(_0x4c9319,_0x1173f0){var _0x1e0c81={};var _0x5349a7={};var _0x5e3819;var _0x28c5fe;return db[_0xbe14('0x23')][_0xbe14('0x52')]({'where':{'id':_0x4c9319['params']['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x1173f0,null))[_0xbe14('0x13')](function(_0x59434a){if(_0x59434a){_0x5e3819=_0x59434a;_0x5349a7[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db[_0xbe14('0x87')]['rawAttributes']);_0x5349a7[_0xbe14('0x2e')]=_[_0xbe14('0x2d')](_0x4c9319[_0xbe14('0x2e')]);_0x5349a7[_0xbe14('0x48')]=_[_0xbe14('0x2f')](_0x5349a7[_0xbe14('0x2c')],_0x5349a7[_0xbe14('0x2e')]);_0x1e0c81[_0xbe14('0x30')]=_['intersection'](_0x5349a7[_0xbe14('0x2c')],qs[_0xbe14('0x31')](_0x4c9319[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x1e0c81[_0xbe14('0x30')]=_0x1e0c81['attributes'][_0xbe14('0x32')]?_0x1e0c81[_0xbe14('0x30')]:_0x5349a7[_0xbe14('0x2c')];_0x1e0c81[_0xbe14('0x4b')]=qs[_0xbe14('0x4c')](_0x4c9319[_0xbe14('0x2e')]['sort']);_0x1e0c81['where']=qs['filters'](_[_0xbe14('0x4d')](_0x4c9319[_0xbe14('0x2e')],_0x5349a7['filters']));if(_0x4c9319[_0xbe14('0x2e')][_0xbe14('0x19')]){_0x1e0c81[_0xbe14('0x28')]=_[_0xbe14('0x40')](_0x1e0c81['where'],{'$or':_[_0xbe14('0x1a')](_0x1e0c81[_0xbe14('0x30')],function(_0x52bbc1){var _0x2797ef={};_0x2797ef[_0x52bbc1]={'$like':'%'+_0x4c9319['query']['filter']+'%'};return _0x2797ef;})});}_0x1e0c81=_[_0xbe14('0x40')]({},_0x1e0c81,_0x4c9319[_0xbe14('0x34')]);return _0x5e3819[_0xbe14('0xa6')](_0x1e0c81);}})[_0xbe14('0x13')](function(_0x47bba1){if(_0x47bba1){_0x28c5fe=_0x47bba1[_0xbe14('0x32')];if(!_0x4c9319[_0xbe14('0x2e')][_0xbe14('0x49')](_0xbe14('0x4a'))){_0x1e0c81['limit']=qs[_0xbe14('0xf')](_0x4c9319[_0xbe14('0x2e')][_0xbe14('0xf')]);_0x1e0c81[_0xbe14('0xd')]=qs[_0xbe14('0xd')](_0x4c9319[_0xbe14('0x2e')][_0xbe14('0xd')]);}return _0x5e3819[_0xbe14('0xa6')](_0x1e0c81);}})['then'](function(_0x2592ab){if(_0x2592ab){return _0x2592ab?{'count':_0x28c5fe,'rows':_0x2592ab}:null;}})[_0xbe14('0x13')](respondWithResult(_0x1173f0,null))['catch'](handleError(_0x1173f0,null));};exports['addBlackLists']=function(_0x6a0f29,_0x3d04b9){var _0x21f793;return db[_0xbe14('0x23')][_0xbe14('0x1d')]({'where':{'id':_0x6a0f29[_0xbe14('0x2b')]['id']}})['then'](handleEntityNotFound(_0x3d04b9,null))[_0xbe14('0x13')](function(_0x37e5e8){if(_0x37e5e8){return _0x37e5e8['addBlackLists'](_0x6a0f29[_0xbe14('0x37')][_0xbe14('0x6a')],_[_0xbe14('0x41')](_0x6a0f29[_0xbe14('0x37')],[_0xbe14('0x6a'),'id'])||{});}return null;})[_0xbe14('0x82')](function(_0x14cec7){var _0x524603;_0x21f793=_0x14cec7||[];var _0x38d720=[];if(_0x14cec7){for(var _0x379446=0x0;_0x379446<_0x14cec7[_0xbe14('0x32')];_0x379446+=0x1){var _0x1489c9=_0x14cec7[_0x379446][_0xbe14('0x15')]({'plain':!![]});_0x524603=squel[_0xbe14('0x8a')]()[_0xbe14('0x8b')](_0xbe14('0xa7'))['fromQuery']([_0xbe14('0x8e'),_0xbe14('0x90'),_0xbe14('0x91'),'VoiceQueueId',_0xbe14('0x42'),_0xbe14('0x43')],squel[_0xbe14('0x6c')]()['field'](_0xbe14('0x8e'),'phone')[_0xbe14('0x6d')]('id',_0xbe14('0x90'))[_0xbe14('0x6d')](_0x1489c9[_0xbe14('0x92')][_0xbe14('0x75')](),_0xbe14('0x91'))[_0xbe14('0x6d')](_0x6a0f29['params']['id'][_0xbe14('0x75')](),_0xbe14('0x4e'))[_0xbe14('0x6d')](_0xbe14('0xa8'),_0xbe14('0x42'))[_0xbe14('0x6d')](_0xbe14('0xa8'),'updatedAt')[_0xbe14('0x6f')](_0xbe14('0x9a'))[_0xbe14('0x28')](_0xbe14('0x9b'))[_0xbe14('0x28')](_0xbe14('0x93'),_0x1489c9[_0xbe14('0x92')][_0xbe14('0x75')]())[_0xbe14('0x28')](_0xbe14('0x94')))[_0xbe14('0x75')]();_0x38d720[_0xbe14('0x74')](db['sequelize'][_0xbe14('0x2e')](_0x524603));}return BPromise[_0xbe14('0x7a')](_0x38d720);}})['then'](function(){return _0x21f793;})['then'](respondWithResult(_0x3d04b9,null))[_0xbe14('0x35')](handleError(_0x3d04b9,null));};exports[_0xbe14('0xa9')]=function(_0x7533c3,_0x3ec670){return db[_0xbe14('0x23')][_0xbe14('0x1d')]({'where':{'id':_0x7533c3[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x3ec670,null))['then'](function(_0x3ee9e2){if(_0x3ee9e2){return _0x3ee9e2['removeBlackLists'](_0x7533c3[_0xbe14('0x2e')][_0xbe14('0x6a')]);}})[_0xbe14('0x13')](function(_0x1d343a){if(_0x1d343a){return db[_0xbe14('0x57')][_0xbe14('0x14')]({'where':{'ListId':_0x7533c3['query']['ids'],'VoiceQueueId':_0x7533c3['params']['id']}})['then'](function(){return _0x1d343a;});}})['then'](respondWithStatusCode(_0x3ec670,null))[_0xbe14('0x35')](handleError(_0x3ec670,null));}; \ No newline at end of file +var _0x9957=['includes','find','type','name','UserProfileResource','destroy','stack','send','fieldName','key','getOptions','include','query','findAll','catch','show','params','model','rawAttributes','filters','attributes','intersection','fields','includeAll','merge','VoiceQueue','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','inbound','UserProfileSection','userProfileId','autoAssociation','error','clone','length','options','omit','updatedAt','user','role','outbound','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getHoppers','findOne','keys','order','sort','where','pick','CmHopper','rows','getHopperHistories','CmHopperHistory','hasOwnProperty','VoiceQueueId','getHopperFinals','CmHopperFinal','nolimit','getHopperBlacks','CmHopperBlack','getTeams','addTeams','Team','Agents','voicePause','interface','penalty','transaction','each','upsert','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','isNil','format','forEach','emit','userVoiceQueue:save','ids','User','field','tq.TeamId','team_has_voice_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','toString','sequelize','QueryTypes','every','all','union','compact','removeTeams','isEmpty','userVoiceQueue:remove','addAgents','online','SIP/%s','removeAgents','isArray','getAgents','getMembers','getLists','addLists','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','createdAt','select','ContactId','CmListId','ListId','from','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','VoiceQueueId\x20=\x20?','onlyIfOpen','cm_contacts','deletedAt\x20IS\x20NULL','COALESCE(phone,\x27\x27)','OrderBy','h.id','ci.item','ci.OrderBy+1','cm_contact_has_items','join','h.scheduledat=?','ci.ItemClass=?','PHONE','removeLists','getBlackLists','CmList','addBlackLists','cm_hopper_black','removeBlackLists','moment','bluebird','util','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','update','then','VoiceQueues','QueueCampaigns','filter','ignore','map','value'];(function(_0x3e3527,_0x4f9564){var _0x1465cb=function(_0x16031d){while(--_0x16031d){_0x3e3527['push'](_0x3e3527['shift']());}};_0x1465cb(++_0x4f9564);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var moment=require(_0x7995('0x0'));var BPromise=require(_0x7995('0x1'));var util=require(_0x7995('0x2'));var _=require(_0x7995('0x3'));var squel=require('squel');var Redis=require(_0x7995('0x4'));var qs=require(_0x7995('0x5'));var logger=require(_0x7995('0x6'))(_0x7995('0x7'));var config=require('../../config/environment');var db=require(_0x7995('0x8'))['db'];config[_0x7995('0x9')]=_[_0x7995('0xa')](config[_0x7995('0x9')],{'host':_0x7995('0xb'),'port':0x18eb});var socket=require(_0x7995('0xc'))(new Redis(config['redis']));require(_0x7995('0xd'))[_0x7995('0xe')](socket);function respondWithStatusCode(_0x4a64f7,_0xa2e5f0){_0xa2e5f0=_0xa2e5f0||0xcc;return function(_0x3116fb){if(_0x3116fb){return _0x4a64f7[_0x7995('0xf')](_0xa2e5f0);}return _0x4a64f7[_0x7995('0x10')](_0xa2e5f0)[_0x7995('0x11')]();};}function respondWithResult(_0x1e400a,_0x341672){_0x341672=_0x341672||0xc8;return function(_0x524f7b){if(_0x524f7b){return _0x1e400a[_0x7995('0x10')](_0x341672)[_0x7995('0x12')](_0x524f7b);}};}function respondWithFilteredResult(_0x581f22,_0xb0c872){return function(_0x2cb37a){if(_0x2cb37a){var _0x19a27e=typeof _0xb0c872[_0x7995('0x13')]===_0x7995('0x14')&&typeof _0xb0c872[_0x7995('0x15')]===_0x7995('0x14');var _0x4cc004=_0x2cb37a['count'];var _0x2b4e94=_0x19a27e?0x0:_0xb0c872[_0x7995('0x13')];var _0x24b5bb=_0x19a27e?_0x2cb37a[_0x7995('0x16')]:_0xb0c872[_0x7995('0x13')]+_0xb0c872[_0x7995('0x15')];var _0x2202ce;if(_0x24b5bb>=_0x4cc004){_0x24b5bb=_0x4cc004;_0x2202ce=0xc8;}else{_0x2202ce=0xce;}_0x581f22[_0x7995('0x10')](_0x2202ce);return _0x581f22['set'](_0x7995('0x17'),_0x2b4e94+'-'+_0x24b5bb+'/'+_0x4cc004)['json'](_0x2cb37a);}return null;};}function saveUpdates(_0x2f832e){return function(_0x37f297){if(_0x37f297){return _0x37f297[_0x7995('0x18')](_0x2f832e)[_0x7995('0x19')](function(_0x1e1415){return _0x1e1415;});}return null;};}function removeEntity(_0x37a7d4){return function(_0x4faa60){if(_0x4faa60){return _0x4faa60['destroy']()[_0x7995('0x19')](function(){var _0x5e6f90=_0x4faa60['get']({'plain':!![]});var _0x3ec178=[{'name':_0x7995('0x1a'),'value':'inbound','ignore':![]},{'name':_0x7995('0x1b'),'value':'outbound','ignore':![]}];var _0x4b1a8e=_(_0x3ec178)[_0x7995('0x1c')](_0x7995('0x1d'))[_0x7995('0x1e')](_0x7995('0x1f'))[_0x7995('0x1f')]();if(_[_0x7995('0x20')](_0x4b1a8e,_0x5e6f90['type'])){return;}var _0x32a09a=_[_0x7995('0x21')](_0x3ec178,[_0x7995('0x1f'),_0x5e6f90[_0x7995('0x22')]])[_0x7995('0x23')];return db[_0x7995('0x24')][_0x7995('0x25')]({'where':{'type':_0x32a09a,'resourceId':_0x5e6f90['id']}})[_0x7995('0x19')](function(){return _0x4faa60;});})['then'](function(){_0x37a7d4[_0x7995('0x10')](0xcc)[_0x7995('0x11')]();});}};}function handleEntityNotFound(_0x401dc3){return function(_0x268ce7){if(!_0x268ce7){_0x401dc3[_0x7995('0xf')](0x194);}return _0x268ce7;};}function handleError(_0x2a307e,_0x56691a){_0x56691a=_0x56691a||0x1f4;return function(_0x47625f){logger['error'](_0x47625f[_0x7995('0x26')]);if(_0x47625f[_0x7995('0x23')]){delete _0x47625f[_0x7995('0x23')];}_0x2a307e[_0x7995('0x10')](_0x56691a)[_0x7995('0x27')](_0x47625f);};}exports['index']=function(_0x9b2a15,_0x514445){var _0x456a28={};var _0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['VoiceQueue']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x28')],'type':_0x3573be[_0x7995('0x22')][_0x7995('0x29')]};});_0x456a28=qs[_0x7995('0x2a')](_0x4253e5,_0x9b2a15);var _0x1ca460={'where':_0x456a28['where']};return db['VoiceQueue'][_0x7995('0x16')](_0x1ca460)['then'](function(_0x553671){_0x3250e0[_0x7995('0x16')]=_0x553671;_0x456a28[_0x7995('0x2b')]=qs[_0x7995('0x2b')](_0x9b2a15[_0x7995('0x2c')]);return db['VoiceQueue'][_0x7995('0x2d')](_0x456a28);})[_0x7995('0x19')](function(_0x5dd802){_0x3250e0['rows']=_0x5dd802;return _0x3250e0;})['then'](respondWithFilteredResult(_0x514445,_0x456a28))[_0x7995('0x2e')](handleError(_0x514445,null));};exports[_0x7995('0x2f')]=function(_0x4a176f,_0x3e7020){var _0x51b95d={'raw':![],'where':{'id':_0x4a176f[_0x7995('0x30')]['id']}},_0x37917b={};_0x37917b[_0x7995('0x31')]=_['keys'](db['VoiceQueue'][_0x7995('0x32')]);_0x37917b['query']=_['keys'](_0x4a176f[_0x7995('0x2c')]);_0x37917b[_0x7995('0x33')]=_['intersection'](_0x37917b[_0x7995('0x31')],_0x37917b[_0x7995('0x2c')]);_0x51b95d[_0x7995('0x34')]=_[_0x7995('0x35')](_0x37917b[_0x7995('0x31')],qs['fields'](_0x4a176f[_0x7995('0x2c')][_0x7995('0x36')]));_0x51b95d[_0x7995('0x34')]=_0x51b95d[_0x7995('0x34')]['length']?_0x51b95d[_0x7995('0x34')]:_0x37917b[_0x7995('0x31')];if(_0x4a176f[_0x7995('0x2c')][_0x7995('0x37')]){_0x51b95d[_0x7995('0x2b')]=[{'all':!![]}];}_0x51b95d=_[_0x7995('0x38')]({},_0x51b95d,_0x4a176f['options']);return db[_0x7995('0x39')][_0x7995('0x21')](_0x51b95d)[_0x7995('0x19')](handleEntityNotFound(_0x3e7020,null))[_0x7995('0x19')](respondWithResult(_0x3e7020,null))[_0x7995('0x2e')](handleError(_0x3e7020,null));};exports[_0x7995('0x3a')]=function(_0x14d638,_0x270c0e){return db[_0x7995('0x39')][_0x7995('0x3a')](_0x14d638[_0x7995('0x3b')],{})[_0x7995('0x19')](function(_0x7b4e67){var _0x53cda2=_0x14d638['user'][_0x7995('0x3c')]({'plain':!![]});if(!_0x53cda2)throw new Error(_0x7995('0x3d'));if(_0x53cda2['role']==='user'){var _0x3f8522=_0x7b4e67['get']({'plain':!![]});var _0x504a33=[{'name':_0x7995('0x1a'),'value':_0x7995('0x3e')},{'name':_0x7995('0x1b'),'value':'outbound'}];var _0x46ac4f=_['find'](_0x504a33,[_0x7995('0x1f'),_0x3f8522['type']])['name'];return db[_0x7995('0x3f')][_0x7995('0x21')]({'where':{'name':_0x46ac4f,'userProfileId':_0x53cda2[_0x7995('0x40')]},'raw':!![]})[_0x7995('0x19')](function(_0x599ecb){if(_0x599ecb&&_0x599ecb[_0x7995('0x41')]===0x0){return db[_0x7995('0x24')][_0x7995('0x3a')]({'name':_0x3f8522[_0x7995('0x23')],'resourceId':_0x3f8522['id'],'type':_0x599ecb['name'],'sectionId':_0x599ecb['id']},{})['then'](function(){return _0x7b4e67;});}else{return _0x7b4e67;}})[_0x7995('0x2e')](function(_0x55791b){logger[_0x7995('0x42')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x55791b);throw _0x55791b;});}return _0x7b4e67;})[_0x7995('0x19')](respondWithResult(_0x270c0e,0xc9))['catch'](handleError(_0x270c0e,null));};exports[_0x7995('0x43')]=function(_0x1b0373,_0x4d9245){var _0x3e9e62={'where':{'id':_0x1b0373[_0x7995('0x30')]['id']}},_0x336ff2={};_0x336ff2[_0x7995('0x31')]=_['keys'](db[_0x7995('0x39')][_0x7995('0x32')]);_0x3e9e62[_0x7995('0x34')]=_['intersection'](_0x336ff2[_0x7995('0x31')],qs[_0x7995('0x36')](_0x1b0373[_0x7995('0x2c')][_0x7995('0x36')]));_0x3e9e62[_0x7995('0x34')]=_0x3e9e62['attributes'][_0x7995('0x44')]?_0x3e9e62[_0x7995('0x34')]:_0x336ff2['model'];if(_0x1b0373[_0x7995('0x2c')]['includeAll']){_0x3e9e62[_0x7995('0x2b')]=[{'all':!![]}];}_0x3e9e62=_[_0x7995('0x38')]({},_0x3e9e62,_0x1b0373[_0x7995('0x45')]);return db[_0x7995('0x39')][_0x7995('0x21')](_0x3e9e62)[_0x7995('0x19')](handleEntityNotFound(_0x4d9245,null))[_0x7995('0x19')](function(_0x4d46bc){if(_0x4d46bc){var _0x427dcf=_0x4d46bc[_0x7995('0x3c')]({'plain':!![]});_0x427dcf=qs[_0x7995('0x46')](_0x427dcf,['id','createdAt',_0x7995('0x47')]);_0x1b0373[_0x7995('0x3b')]=_[_0x7995('0x46')](_0x1b0373['body'],['id','createdAt','updatedAt']);return db[_0x7995('0x39')][_0x7995('0x3a')](_['merge'](_0x427dcf,_0x1b0373[_0x7995('0x3b')]),{'include':_0x1b0373[_0x7995('0x2c')][_0x7995('0x37')]?[{'all':!![]}]:undefined})[_0x7995('0x19')](function(_0xc04004){var _0x528c8e=_0x1b0373[_0x7995('0x48')]['get']({'plain':!![]});if(!_0x528c8e)throw new Error(_0x7995('0x3d'));if(_0x528c8e[_0x7995('0x49')]===_0x7995('0x48')){var _0x50c7b5=_0xc04004['get']({'plain':!![]});var _0x54e2b1=[{'name':'VoiceQueues','value':_0x7995('0x3e')},{'name':_0x7995('0x1b'),'value':_0x7995('0x4a')}];var _0x150261=_[_0x7995('0x21')](_0x54e2b1,[_0x7995('0x1f'),_0x50c7b5[_0x7995('0x22')]])[_0x7995('0x23')];return db[_0x7995('0x3f')][_0x7995('0x21')]({'where':{'name':_0x150261,'userProfileId':_0x528c8e[_0x7995('0x40')]},'raw':!![]})[_0x7995('0x19')](function(_0x3da72b){if(_0x3da72b&&_0x3da72b[_0x7995('0x41')]===0x0){return db[_0x7995('0x24')][_0x7995('0x3a')]({'name':_0x50c7b5[_0x7995('0x23')],'resourceId':_0x50c7b5['id'],'type':_0x3da72b[_0x7995('0x23')],'sectionId':_0x3da72b['id']},{})[_0x7995('0x19')](function(){return _0xc04004;});}else{return _0xc04004;}})['catch'](function(_0x56a374){logger[_0x7995('0x42')](_0x7995('0x4b'),_0x56a374);throw _0x56a374;});}return _0xc04004;});}})[_0x7995('0x19')](respondWithResult(_0x4d9245,0xc9))['catch'](handleError(_0x4d9245,null));};exports['update']=function(_0x402fa0,_0x197b52){if(_0x402fa0[_0x7995('0x3b')]['id']){delete _0x402fa0[_0x7995('0x3b')]['id'];}return db['VoiceQueue'][_0x7995('0x21')]({'where':{'id':_0x402fa0[_0x7995('0x30')]['id']}})[_0x7995('0x19')](handleEntityNotFound(_0x197b52,null))[_0x7995('0x19')](saveUpdates(_0x402fa0['body'],null))['then'](respondWithResult(_0x197b52,null))[_0x7995('0x2e')](handleError(_0x197b52,null));};exports[_0x7995('0x25')]=function(_0x6c0221,_0x1d69ce){return db[_0x7995('0x39')][_0x7995('0x21')]({'where':{'id':_0x6c0221[_0x7995('0x30')]['id']}})[_0x7995('0x19')](handleEntityNotFound(_0x1d69ce,null))[_0x7995('0x19')](removeEntity(_0x1d69ce,null))['catch'](handleError(_0x1d69ce,null));};exports[_0x7995('0x4c')]=function(_0x3ec5a8,_0xdf9e38){var _0x1ecfdb={'raw':![],'where':{}};var _0x59c5aa={};var _0x51bf6a={'count':0x0,'rows':[]};return db[_0x7995('0x39')][_0x7995('0x4d')]({'where':{'id':_0x3ec5a8['params']['id']}})[_0x7995('0x19')](handleEntityNotFound(_0xdf9e38,null))[_0x7995('0x19')](function(_0x2e3421){if(_0x2e3421){_0x59c5aa[_0x7995('0x31')]=_[_0x7995('0x4e')](db['CmHopper'][_0x7995('0x32')]);_0x59c5aa['query']=_[_0x7995('0x4e')](_0x3ec5a8[_0x7995('0x2c')]);_0x59c5aa[_0x7995('0x33')]=_[_0x7995('0x35')](_0x59c5aa[_0x7995('0x31')],_0x59c5aa[_0x7995('0x2c')]);_0x1ecfdb[_0x7995('0x34')]=_[_0x7995('0x35')](_0x59c5aa[_0x7995('0x31')],qs[_0x7995('0x36')](_0x3ec5a8[_0x7995('0x2c')][_0x7995('0x36')]));_0x1ecfdb['attributes']=_0x1ecfdb[_0x7995('0x34')][_0x7995('0x44')]?_0x1ecfdb[_0x7995('0x34')]:_0x59c5aa[_0x7995('0x31')];if(!_0x3ec5a8[_0x7995('0x2c')]['hasOwnProperty']('nolimit')){_0x1ecfdb[_0x7995('0x15')]=qs[_0x7995('0x15')](_0x3ec5a8[_0x7995('0x2c')][_0x7995('0x15')]);_0x1ecfdb['offset']=qs[_0x7995('0x13')](_0x3ec5a8['query']['offset']);}_0x1ecfdb[_0x7995('0x4f')]=qs[_0x7995('0x50')](_0x3ec5a8[_0x7995('0x2c')][_0x7995('0x50')]);_0x1ecfdb[_0x7995('0x51')]=qs[_0x7995('0x33')](_[_0x7995('0x52')](_0x3ec5a8[_0x7995('0x2c')],_0x59c5aa[_0x7995('0x33')]));_0x1ecfdb[_0x7995('0x51')]['VoiceQueueId']=_0x2e3421['id'];if(_0x3ec5a8[_0x7995('0x2c')][_0x7995('0x1c')]){_0x1ecfdb[_0x7995('0x51')]=_['merge'](_0x1ecfdb[_0x7995('0x51')],{'$or':_[_0x7995('0x1e')](_0x1ecfdb[_0x7995('0x34')],function(_0x3a7d9d){var _0x3b0d30={};_0x3b0d30[_0x3a7d9d]={'$like':'%'+_0x3ec5a8[_0x7995('0x2c')][_0x7995('0x1c')]+'%'};return _0x3b0d30;})});}_0x1ecfdb=_[_0x7995('0x38')]({},_0x1ecfdb,_0x3ec5a8[_0x7995('0x45')]);return db[_0x7995('0x53')][_0x7995('0x16')]({'where':_0x1ecfdb['where']})['then'](function(_0xd07c1c){_0x51bf6a[_0x7995('0x16')]=_0xd07c1c;if(_0x3ec5a8[_0x7995('0x2c')][_0x7995('0x37')]){_0x1ecfdb['include']=[{'all':!![]}];}return db[_0x7995('0x53')][_0x7995('0x2d')](_0x1ecfdb);})['then'](function(_0x480fdb){_0x51bf6a[_0x7995('0x54')]=_0x480fdb;return _0x51bf6a;});}})[_0x7995('0x19')](respondWithFilteredResult(_0xdf9e38,_0x1ecfdb))['catch'](handleError(_0xdf9e38,null));};exports[_0x7995('0x55')]=function(_0x5b1cba,_0x3758f9){var _0xea9aba={'raw':!![],'where':{}};var _0x4ff9ff={};var _0x5d9d33={'count':0x0,'rows':[]};return db[_0x7995('0x39')]['findOne']({'where':{'id':_0x5b1cba[_0x7995('0x30')]['id']}})[_0x7995('0x19')](handleEntityNotFound(_0x3758f9,null))[_0x7995('0x19')](function(_0x45bd8a){if(_0x45bd8a){_0x4ff9ff[_0x7995('0x31')]=_[_0x7995('0x4e')](db[_0x7995('0x56')][_0x7995('0x32')]);_0x4ff9ff[_0x7995('0x2c')]=_[_0x7995('0x4e')](_0x5b1cba[_0x7995('0x2c')]);_0x4ff9ff[_0x7995('0x33')]=_[_0x7995('0x35')](_0x4ff9ff[_0x7995('0x31')],_0x4ff9ff[_0x7995('0x2c')]);_0xea9aba[_0x7995('0x34')]=_[_0x7995('0x35')](_0x4ff9ff[_0x7995('0x31')],qs[_0x7995('0x36')](_0x5b1cba[_0x7995('0x2c')][_0x7995('0x36')]));_0xea9aba[_0x7995('0x34')]=_0xea9aba[_0x7995('0x34')][_0x7995('0x44')]?_0xea9aba[_0x7995('0x34')]:_0x4ff9ff[_0x7995('0x31')];if(!_0x5b1cba[_0x7995('0x2c')][_0x7995('0x57')]('nolimit')){_0xea9aba[_0x7995('0x15')]=qs[_0x7995('0x15')](_0x5b1cba['query']['limit']);_0xea9aba[_0x7995('0x13')]=qs[_0x7995('0x13')](_0x5b1cba[_0x7995('0x2c')][_0x7995('0x13')]);}_0xea9aba[_0x7995('0x4f')]=qs[_0x7995('0x50')](_0x5b1cba['query'][_0x7995('0x50')]);_0xea9aba[_0x7995('0x51')]=qs[_0x7995('0x33')](_[_0x7995('0x52')](_0x5b1cba[_0x7995('0x2c')],_0x4ff9ff[_0x7995('0x33')]));_0xea9aba[_0x7995('0x51')][_0x7995('0x58')]=_0x45bd8a['id'];if(_0x5b1cba['query'][_0x7995('0x1c')]){_0xea9aba[_0x7995('0x51')]=_['merge'](_0xea9aba['where'],{'$or':_[_0x7995('0x1e')](_0xea9aba[_0x7995('0x34')],function(_0x18e1a2){var _0x3db7a9={};_0x3db7a9[_0x18e1a2]={'$like':'%'+_0x5b1cba[_0x7995('0x2c')]['filter']+'%'};return _0x3db7a9;})});}_0xea9aba=_[_0x7995('0x38')]({},_0xea9aba,_0x5b1cba[_0x7995('0x45')]);return db['CmHopperHistory'][_0x7995('0x16')]({'where':_0xea9aba[_0x7995('0x51')]})['then'](function(_0x1535a3){_0x5d9d33['count']=_0x1535a3;if(_0x5b1cba[_0x7995('0x2c')][_0x7995('0x37')]){_0xea9aba[_0x7995('0x2b')]=[{'all':!![]}];}return db[_0x7995('0x56')][_0x7995('0x2d')](_0xea9aba);})['then'](function(_0x1f0506){_0x5d9d33[_0x7995('0x54')]=_0x1f0506;return _0x5d9d33;});}})[_0x7995('0x19')](respondWithFilteredResult(_0x3758f9,_0xea9aba))['catch'](handleError(_0x3758f9,null));};exports[_0x7995('0x59')]=function(_0x3f3434,_0x350ed3){var _0x308a26={'raw':!![],'where':{}};var _0x5d7018={};var _0x3356fd={'count':0x0,'rows':[]};return db[_0x7995('0x39')][_0x7995('0x4d')]({'where':{'id':_0x3f3434['params']['id']}})['then'](handleEntityNotFound(_0x350ed3,null))[_0x7995('0x19')](function(_0x333379){if(_0x333379){_0x5d7018['model']=_['keys'](db[_0x7995('0x5a')][_0x7995('0x32')]);_0x5d7018[_0x7995('0x2c')]=_[_0x7995('0x4e')](_0x3f3434[_0x7995('0x2c')]);_0x5d7018['filters']=_['intersection'](_0x5d7018[_0x7995('0x31')],_0x5d7018['query']);_0x308a26['attributes']=_[_0x7995('0x35')](_0x5d7018[_0x7995('0x31')],qs[_0x7995('0x36')](_0x3f3434['query'][_0x7995('0x36')]));_0x308a26[_0x7995('0x34')]=_0x308a26[_0x7995('0x34')][_0x7995('0x44')]?_0x308a26[_0x7995('0x34')]:_0x5d7018['model'];if(!_0x3f3434[_0x7995('0x2c')][_0x7995('0x57')](_0x7995('0x5b'))){_0x308a26[_0x7995('0x15')]=qs['limit'](_0x3f3434[_0x7995('0x2c')][_0x7995('0x15')]);_0x308a26['offset']=qs[_0x7995('0x13')](_0x3f3434[_0x7995('0x2c')]['offset']);}_0x308a26[_0x7995('0x4f')]=qs['sort'](_0x3f3434[_0x7995('0x2c')]['sort']);_0x308a26[_0x7995('0x51')]=qs['filters'](_[_0x7995('0x52')](_0x3f3434[_0x7995('0x2c')],_0x5d7018['filters']));_0x308a26[_0x7995('0x51')]['VoiceQueueId']=_0x333379['id'];if(_0x3f3434['query'][_0x7995('0x1c')]){_0x308a26[_0x7995('0x51')]=_[_0x7995('0x38')](_0x308a26[_0x7995('0x51')],{'$or':_['map'](_0x308a26[_0x7995('0x34')],function(_0x35044a){var _0x4bd29f={};_0x4bd29f[_0x35044a]={'$like':'%'+_0x3f3434['query'][_0x7995('0x1c')]+'%'};return _0x4bd29f;})});}_0x308a26=_['merge']({},_0x308a26,_0x3f3434[_0x7995('0x45')]);return db[_0x7995('0x5a')][_0x7995('0x16')]({'where':_0x308a26['where']})['then'](function(_0x2b7852){_0x3356fd['count']=_0x2b7852;if(_0x3f3434[_0x7995('0x2c')][_0x7995('0x37')]){_0x308a26[_0x7995('0x2b')]=[{'all':!![]}];}return db[_0x7995('0x5a')]['findAll'](_0x308a26);})['then'](function(_0x50f880){_0x3356fd[_0x7995('0x54')]=_0x50f880;return _0x3356fd;});}})[_0x7995('0x19')](respondWithFilteredResult(_0x350ed3,_0x308a26))[_0x7995('0x2e')](handleError(_0x350ed3,null));};exports[_0x7995('0x5c')]=function(_0x265f07,_0x168e7f){var _0x59a793={'raw':!![],'where':{}};var _0x53cbec={};var _0x1a2902={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x265f07[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x168e7f,null))['then'](function(_0x35c3f3){if(_0x35c3f3){_0x53cbec[_0x7995('0x31')]=_[_0x7995('0x4e')](db['CmHopperBlack'][_0x7995('0x32')]);_0x53cbec[_0x7995('0x2c')]=_[_0x7995('0x4e')](_0x265f07[_0x7995('0x2c')]);_0x53cbec[_0x7995('0x33')]=_[_0x7995('0x35')](_0x53cbec[_0x7995('0x31')],_0x53cbec[_0x7995('0x2c')]);_0x59a793[_0x7995('0x34')]=_['intersection'](_0x53cbec[_0x7995('0x31')],qs[_0x7995('0x36')](_0x265f07[_0x7995('0x2c')][_0x7995('0x36')]));_0x59a793[_0x7995('0x34')]=_0x59a793['attributes'][_0x7995('0x44')]?_0x59a793[_0x7995('0x34')]:_0x53cbec[_0x7995('0x31')];if(!_0x265f07['query']['hasOwnProperty']('nolimit')){_0x59a793[_0x7995('0x15')]=qs[_0x7995('0x15')](_0x265f07[_0x7995('0x2c')][_0x7995('0x15')]);_0x59a793[_0x7995('0x13')]=qs[_0x7995('0x13')](_0x265f07['query'][_0x7995('0x13')]);}_0x59a793['order']=qs[_0x7995('0x50')](_0x265f07[_0x7995('0x2c')][_0x7995('0x50')]);_0x59a793[_0x7995('0x51')]=qs[_0x7995('0x33')](_[_0x7995('0x52')](_0x265f07[_0x7995('0x2c')],_0x53cbec[_0x7995('0x33')]));_0x59a793[_0x7995('0x51')][_0x7995('0x58')]=_0x35c3f3['id'];if(_0x265f07[_0x7995('0x2c')]['filter']){_0x59a793[_0x7995('0x51')]=_['merge'](_0x59a793[_0x7995('0x51')],{'$or':_[_0x7995('0x1e')](_0x59a793['attributes'],function(_0x493e74){var _0x2a25eb={};_0x2a25eb[_0x493e74]={'$like':'%'+_0x265f07[_0x7995('0x2c')][_0x7995('0x1c')]+'%'};return _0x2a25eb;})});}_0x59a793=_[_0x7995('0x38')]({},_0x59a793,_0x265f07[_0x7995('0x45')]);return db[_0x7995('0x5d')][_0x7995('0x16')]({'where':_0x59a793[_0x7995('0x51')]})[_0x7995('0x19')](function(_0x3c9b3c){_0x1a2902[_0x7995('0x16')]=_0x3c9b3c;if(_0x265f07[_0x7995('0x2c')]['includeAll']){_0x59a793['include']=[{'all':!![]}];}return db[_0x7995('0x5d')][_0x7995('0x2d')](_0x59a793);})[_0x7995('0x19')](function(_0x1531a9){_0x1a2902[_0x7995('0x54')]=_0x1531a9;return _0x1a2902;});}})['then'](respondWithFilteredResult(_0x168e7f,_0x59a793))[_0x7995('0x2e')](handleError(_0x168e7f,null));};exports[_0x7995('0x5e')]=function(_0x5ebf5e,_0x46fc1c){var _0x53d693={};var _0x37416c={};var _0x30cda5;var _0x234a40;return db['VoiceQueue'][_0x7995('0x4d')]({'where':{'id':_0x5ebf5e[_0x7995('0x30')]['id']}})[_0x7995('0x19')](handleEntityNotFound(_0x46fc1c,null))[_0x7995('0x19')](function(_0x11f9fb){if(_0x11f9fb){_0x30cda5=_0x11f9fb;_0x37416c[_0x7995('0x31')]=_[_0x7995('0x4e')](db['Team']['rawAttributes']);_0x37416c['query']=_[_0x7995('0x4e')](_0x5ebf5e[_0x7995('0x2c')]);_0x37416c['filters']=_['intersection'](_0x37416c[_0x7995('0x31')],_0x37416c[_0x7995('0x2c')]);_0x53d693['attributes']=_['intersection'](_0x37416c['model'],qs['fields'](_0x5ebf5e[_0x7995('0x2c')][_0x7995('0x36')]));_0x53d693[_0x7995('0x34')]=_0x53d693[_0x7995('0x34')]['length']?_0x53d693[_0x7995('0x34')]:_0x37416c[_0x7995('0x31')];_0x53d693['order']=qs[_0x7995('0x50')](_0x5ebf5e[_0x7995('0x2c')][_0x7995('0x50')]);_0x53d693['where']=qs[_0x7995('0x33')](_[_0x7995('0x52')](_0x5ebf5e['query'],_0x37416c[_0x7995('0x33')]));if(_0x5ebf5e[_0x7995('0x2c')][_0x7995('0x1c')]){_0x53d693[_0x7995('0x51')]=_[_0x7995('0x38')](_0x53d693[_0x7995('0x51')],{'$or':_[_0x7995('0x1e')](_0x53d693[_0x7995('0x34')],function(_0x4254de){var _0x278004={};_0x278004[_0x4254de]={'$like':'%'+_0x5ebf5e[_0x7995('0x2c')][_0x7995('0x1c')]+'%'};return _0x278004;})});}_0x53d693=_[_0x7995('0x38')]({},_0x53d693,_0x5ebf5e['options']);return _0x30cda5[_0x7995('0x5e')](_0x53d693);}})[_0x7995('0x19')](function(_0x3603e8){if(_0x3603e8){_0x234a40=_0x3603e8[_0x7995('0x44')];if(!_0x5ebf5e['query'][_0x7995('0x57')](_0x7995('0x5b'))){_0x53d693[_0x7995('0x15')]=qs['limit'](_0x5ebf5e[_0x7995('0x2c')][_0x7995('0x15')]);_0x53d693[_0x7995('0x13')]=qs[_0x7995('0x13')](_0x5ebf5e[_0x7995('0x2c')][_0x7995('0x13')]);}return _0x30cda5[_0x7995('0x5e')](_0x53d693);}})['then'](function(_0x35dbd7){if(_0x35dbd7){return _0x35dbd7?{'count':_0x234a40,'rows':_0x35dbd7}:null;}})['then'](respondWithResult(_0x46fc1c,null))[_0x7995('0x2e')](handleError(_0x46fc1c,null));};exports[_0x7995('0x5f')]=function(_0x2190d1,_0x4cae1c){var _0xd012b9=_0x2190d1['body']['teams'];var _0x4ee5ee=_['map'](_0xd012b9,'id');return db[_0x7995('0x60')][_0x7995('0x2d')]({'where':{'id':_0x4ee5ee},'attributes':['id'],'include':[{'model':db['User'],'as':_0x7995('0x61'),'attributes':['id',_0x7995('0x23'),'online',_0x7995('0x62'),_0x7995('0x63')],'raw':!![]}]})[_0x7995('0x19')](function(_0x45a479){if(_0x45a479){var _0x443863=_['flatMap'](_0x45a479,function(_0x38ea3e){var _0x1df81d=_0x38ea3e[_0x7995('0x3c')]({'plain':!![]});_0x1df81d[_0x7995('0x61')]['forEach'](function(_0x428d5a){_0x428d5a[_0x7995('0x64')]=_[_0x7995('0x21')](_0xd012b9,{'id':_0x1df81d['id']})[_0x7995('0x64')];});return _0x1df81d[_0x7995('0x61')];});return db[_0x7995('0x39')][_0x7995('0x21')]({'where':{'id':_0x2190d1[_0x7995('0x30')]['id']}})[_0x7995('0x19')](function(_0x1fda95){return db['sequelize'][_0x7995('0x65')](function(_0x521712){return _0x1fda95[_0x7995('0x5f')](_0x4ee5ee,{'transaction':_0x521712})[_0x7995('0x19')](function(){return BPromise[_0x7995('0x66')](_0xd012b9,function(_0x50eb5e){return db['TeamVoiceQueue'][_0x7995('0x67')]({'TeamId':_0x50eb5e['id'],'VoiceQueueId':_0x2190d1[_0x7995('0x30')]['id'],'penalty':_0x50eb5e['penalty']},{'transaction':_0x521712});});})[_0x7995('0x19')](function(){return BPromise['each'](_0x443863,function(_0x43de18){return db[_0x7995('0x68')][_0x7995('0x69')]({'where':{'UserId':_0x43de18['id'],'VoiceQueueId':_0x2190d1[_0x7995('0x30')]['id']},'defaults':{'penalty':_0x43de18['penalty']},'transaction':_0x521712});});})['then'](function(){return BPromise[_0x7995('0x66')](_[_0x7995('0x1c')](_0x443863,{'online':!![]}),function(_0x365318){return db[_0x7995('0x6a')]['upsert']({'membername':_0x365318[_0x7995('0x23')],'UserId':_0x365318['id'],'queue_name':_0x1fda95[_0x7995('0x23')],'VoiceQueueId':_0x1fda95['id'],'interface':_[_0x7995('0x6b')](_0x365318[_0x7995('0x63')])?util[_0x7995('0x6c')]('SIP/%s',_0x365318['name']):_0x365318['interface'],'paused':_0x365318[_0x7995('0x62')]||![],'penalty':_0x365318[_0x7995('0x64')]},{'transaction':_0x521712});});})['then'](function(){_0x443863[_0x7995('0x6d')](function(_0x5635d6){socket[_0x7995('0x6e')](_0x7995('0x6f'),{'UserId':_0x5635d6['id'],'VoiceQueueId':_0x1fda95['id']});});});});});}})[_0x7995('0x19')](respondWithStatusCode(_0x4cae1c,null))[_0x7995('0x2e')](handleError(_0x4cae1c,null));};exports['removeTeams']=function(_0x3fbafb,_0x2caacd){return db[_0x7995('0x60')][_0x7995('0x2d')]({'where':{'id':_0x3fbafb[_0x7995('0x2c')][_0x7995('0x70')]},'attributes':['id'],'include':[{'model':db[_0x7995('0x71')],'as':_0x7995('0x61'),'attributes':['id'],'raw':!![]}]})[_0x7995('0x19')](handleEntityNotFound(_0x2caacd,null))[_0x7995('0x19')](function(_0x30893a){var _0x2b8d90=_[_0x7995('0x1e')](_0x30893a,'id');var _0x2122af=[];var _0x4ff0b6=[];var _0x764245=squel['select']();_0x764245[_0x7995('0x72')](_0x7995('0x73'))['from'](_0x7995('0x74'),'tq')['join'](_0x7995('0x75'),'ut',_0x7995('0x76'))['where']('VoiceQueueId\x20=\x20?',_0x3fbafb['params']['id']);for(var _0x8f5ecd=0x0;_0x8f5ecd<_0x30893a[_0x7995('0x44')];_0x8f5ecd+=0x1){let _0x139f76=_0x30893a[_0x8f5ecd];for(var _0x2b7bc2=0x0;_0x2b7bc2<_0x139f76['Agents'][_0x7995('0x44')];_0x2b7bc2+=0x1){let _0x2b2814=_0x139f76[_0x7995('0x61')][_0x2b7bc2];var _0x2de960=_0x764245[_0x7995('0x43')]();_0x2de960[_0x7995('0x51')](_0x7995('0x77'),_0x2b2814['id']);_0x4ff0b6[_0x7995('0x78')](db['sequelize'][_0x7995('0x2c')](_0x2de960[_0x7995('0x79')](),{'type':db[_0x7995('0x7a')][_0x7995('0x7b')]['SELECT']})[_0x7995('0x19')](function(_0x3a2958){if(_0x3a2958[_0x7995('0x44')]===0x1){return _0x2b2814['id'];}else{var _0x339e6b=_[_0x7995('0x7c')](_[_0x7995('0x1e')](_0x3a2958,'TeamId'),function(_0x1bc617){return _[_0x7995('0x20')](_0x2b8d90,_0x1bc617);});if(_0x339e6b){return _0x2b2814['id'];}}}));}}return BPromise[_0x7995('0x7d')](_0x4ff0b6)[_0x7995('0x19')](function(_0x3fcc49){_0x2122af=_(_0x2122af)[_0x7995('0x7e')](_0x3fcc49)[_0x7995('0x7f')]()[_0x7995('0x1f')]();return db[_0x7995('0x39')][_0x7995('0x21')]({'where':{'id':_0x3fbafb[_0x7995('0x30')]['id']}})[_0x7995('0x19')](function(_0x64a62d){return db[_0x7995('0x7a')][_0x7995('0x65')](function(_0x370984){return _0x64a62d[_0x7995('0x80')](_0x3fbafb[_0x7995('0x2c')][_0x7995('0x70')],{'transaction':_0x370984})[_0x7995('0x19')](function(){if(!_[_0x7995('0x81')](_0x2122af)){return _0x64a62d['removeAgents'](_0x2122af,{'transaction':_0x370984})['then'](function(){return db[_0x7995('0x6a')][_0x7995('0x25')]({'where':{'VoiceQueueId':_0x3fbafb['params']['id'],'UserId':_0x2122af},'transaction':_0x370984});});}})[_0x7995('0x19')](function(){_0x2122af['forEach'](function(_0x2ce103){socket['emit'](_0x7995('0x82'),{'UserId':_0x2ce103,'VoiceQueueId':_0x64a62d['id']});});});});});});})[_0x7995('0x19')](respondWithStatusCode(_0x2caacd,null))[_0x7995('0x2e')](handleError(_0x2caacd,null));};exports[_0x7995('0x83')]=function(_0x3aa676,_0x1df2a2){var _0xd82313,_0x1fa59d;return db[_0x7995('0x39')][_0x7995('0x21')]({'where':{'id':_0x3aa676['params']['id']}})[_0x7995('0x19')](handleEntityNotFound(_0x1df2a2,null))[_0x7995('0x19')](function(_0x1d0481){if(_0x1d0481){_0x1fa59d=_0x1d0481;return _0x1d0481[_0x7995('0x83')](_0x3aa676['body'][_0x7995('0x70')],_[_0x7995('0x46')](_0x3aa676[_0x7995('0x3b')],[_0x7995('0x70'),'id'])||{})['spread'](function(_0x32c550){for(var _0x37e647=0x0;_0x37e647<_0x3aa676[_0x7995('0x3b')][_0x7995('0x70')][_0x7995('0x44')];_0x37e647+=0x1){socket[_0x7995('0x6e')](_0x7995('0x6f'),{'UserId':Number(_0x3aa676[_0x7995('0x3b')][_0x7995('0x70')][_0x37e647]),'VoiceQueueId':Number(_0x3aa676['params']['id'])});}return _0x32c550;});}})[_0x7995('0x19')](function(_0x5f5496){_0xd82313=_0x5f5496||[];if(_0x1fa59d){return db[_0x7995('0x71')][_0x7995('0x2d')]({'where':{'id':_0x3aa676[_0x7995('0x3b')][_0x7995('0x70')]},'attributes':['id','name',_0x7995('0x84'),_0x7995('0x62'),_0x7995('0x63')],'raw':!![]});}})[_0x7995('0x19')](function(_0x2c715){if(!_[_0x7995('0x81')](_0x2c715)){var _0x3661ab=[];for(var _0x408692=0x0;_0x408692<_0x2c715[_0x7995('0x44')];_0x408692++){if(_0x2c715[_0x408692][_0x7995('0x84')]){_0x3661ab[_0x7995('0x78')](db[_0x7995('0x6a')][_0x7995('0x67')]({'membername':_0x2c715[_0x408692][_0x7995('0x23')],'UserId':_0x2c715[_0x408692]['id'],'queue_name':_0x1fa59d['name'],'VoiceQueueId':_0x1fa59d['id'],'interface':_['isNil'](_0x2c715[_0x408692][_0x7995('0x63')])?util[_0x7995('0x6c')](_0x7995('0x85'),_0x2c715[_0x408692]['name']):_0x2c715[_0x408692][_0x7995('0x63')],'paused':_0x2c715[_0x408692][_0x7995('0x62')]||![],'penalty':_0x3aa676[_0x7995('0x3b')]['penalty']||0x0}));}}return BPromise[_0x7995('0x7d')](_0x3661ab);}})[_0x7995('0x19')](function(){return _0xd82313;})[_0x7995('0x19')](respondWithResult(_0x1df2a2,null))[_0x7995('0x2e')](handleError(_0x1df2a2,null));};exports[_0x7995('0x86')]=function(_0x3d42a3,_0x29fb77){return db[_0x7995('0x39')][_0x7995('0x21')]({'where':{'id':_0x3d42a3[_0x7995('0x30')]['id']}})[_0x7995('0x19')](handleEntityNotFound(_0x29fb77,null))['then'](function(_0x580571){if(_0x580571){return _0x580571[_0x7995('0x86')](_0x3d42a3['query'][_0x7995('0x70')])[_0x7995('0x19')](function(){if(_[_0x7995('0x87')](_0x3d42a3[_0x7995('0x2c')][_0x7995('0x70')])){for(var _0x4eebf4=0x0;_0x4eebf4<_0x3d42a3['query'][_0x7995('0x70')][_0x7995('0x44')];_0x4eebf4+=0x1){socket[_0x7995('0x6e')](_0x7995('0x82'),{'UserId':Number(_0x3d42a3[_0x7995('0x2c')][_0x7995('0x70')][_0x4eebf4]),'VoiceQueueId':Number(_0x3d42a3[_0x7995('0x30')]['id'])});}}else{socket[_0x7995('0x6e')](_0x7995('0x82'),{'UserId':Number(_0x3d42a3[_0x7995('0x2c')]['ids']),'VoiceQueueId':Number(_0x3d42a3[_0x7995('0x30')]['id'])});}});}})[_0x7995('0x19')](function(_0x38e67a){return db[_0x7995('0x6a')]['destroy']({'where':{'VoiceQueueId':_0x3d42a3['params']['id'],'UserId':_0x3d42a3['query']['ids']}})['then'](function(){return _0x38e67a;});})[_0x7995('0x19')](respondWithStatusCode(_0x29fb77,null))['catch'](handleError(_0x29fb77,null));};exports['getAgents']=function(_0x32f19d,_0x44dbb8){var _0x181ed6={};var _0x48b807={};var _0xba00af;var _0x4f008a;return db[_0x7995('0x39')][_0x7995('0x4d')]({'where':{'id':_0x32f19d[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x44dbb8,null))[_0x7995('0x19')](function(_0x14be06){if(_0x14be06){_0xba00af=_0x14be06;_0x48b807[_0x7995('0x31')]=_['keys'](db[_0x7995('0x71')][_0x7995('0x32')]);_0x48b807[_0x7995('0x2c')]=_[_0x7995('0x4e')](_0x32f19d[_0x7995('0x2c')]);_0x48b807['filters']=_[_0x7995('0x35')](_0x48b807[_0x7995('0x31')],_0x48b807[_0x7995('0x2c')]);_0x181ed6['attributes']=_[_0x7995('0x35')](_0x48b807[_0x7995('0x31')],qs[_0x7995('0x36')](_0x32f19d[_0x7995('0x2c')][_0x7995('0x36')]));_0x181ed6['attributes']=_0x181ed6[_0x7995('0x34')][_0x7995('0x44')]?_0x181ed6[_0x7995('0x34')]:_0x48b807[_0x7995('0x31')];_0x181ed6[_0x7995('0x4f')]=qs[_0x7995('0x50')](_0x32f19d[_0x7995('0x2c')]['sort']);_0x181ed6['where']=qs[_0x7995('0x33')](_[_0x7995('0x52')](_0x32f19d['query'],_0x48b807['filters']));if(_0x32f19d[_0x7995('0x2c')][_0x7995('0x1c')]){_0x181ed6[_0x7995('0x51')]=_[_0x7995('0x38')](_0x181ed6[_0x7995('0x51')],{'$or':_[_0x7995('0x1e')](_0x181ed6[_0x7995('0x34')],function(_0x4dca11){var _0xf90cd8={};_0xf90cd8[_0x4dca11]={'$like':'%'+_0x32f19d[_0x7995('0x2c')][_0x7995('0x1c')]+'%'};return _0xf90cd8;})});}_0x181ed6=_[_0x7995('0x38')]({},_0x181ed6,_0x32f19d[_0x7995('0x45')]);return _0xba00af[_0x7995('0x88')](_0x181ed6);}})['then'](function(_0x1d7c33){if(_0x1d7c33){_0x4f008a=_0x1d7c33[_0x7995('0x44')];if(!_0x32f19d[_0x7995('0x2c')][_0x7995('0x57')](_0x7995('0x5b'))){_0x181ed6[_0x7995('0x15')]=qs[_0x7995('0x15')](_0x32f19d['query'][_0x7995('0x15')]);_0x181ed6[_0x7995('0x13')]=qs[_0x7995('0x13')](_0x32f19d[_0x7995('0x2c')]['offset']);}return _0xba00af[_0x7995('0x88')](_0x181ed6);}})['then'](function(_0x21ba9b){if(_0x21ba9b){return _0x21ba9b?{'count':_0x4f008a,'rows':_0x21ba9b}:null;}})[_0x7995('0x19')](respondWithResult(_0x44dbb8,null))['catch'](handleError(_0x44dbb8,null));};exports['getMembers']=function(_0x478c12,_0x3b22ec){var _0xf503d5={};var _0x7d2ccf={};var _0x18a3dc;var _0x503b32;return db[_0x7995('0x39')][_0x7995('0x4d')]({'where':{'id':_0x478c12[_0x7995('0x30')]['id']}})[_0x7995('0x19')](handleEntityNotFound(_0x3b22ec,null))[_0x7995('0x19')](function(_0x1fa484){if(_0x1fa484){_0x18a3dc=_0x1fa484;_0x7d2ccf[_0x7995('0x31')]=_['keys'](db['UserVoiceQueueRt'][_0x7995('0x32')]);_0x7d2ccf['query']=_['keys'](_0x478c12[_0x7995('0x2c')]);_0x7d2ccf[_0x7995('0x33')]=_[_0x7995('0x35')](_0x7d2ccf[_0x7995('0x31')],_0x7d2ccf[_0x7995('0x2c')]);_0xf503d5[_0x7995('0x34')]=_[_0x7995('0x35')](_0x7d2ccf[_0x7995('0x31')],qs[_0x7995('0x36')](_0x478c12[_0x7995('0x2c')][_0x7995('0x36')]));_0xf503d5[_0x7995('0x34')]=_0xf503d5['attributes'][_0x7995('0x44')]?_0xf503d5[_0x7995('0x34')]:_0x7d2ccf[_0x7995('0x31')];_0xf503d5[_0x7995('0x4f')]=qs[_0x7995('0x50')](_0x478c12[_0x7995('0x2c')][_0x7995('0x50')]);_0xf503d5['where']=qs[_0x7995('0x33')](_[_0x7995('0x52')](_0x478c12[_0x7995('0x2c')],_0x7d2ccf[_0x7995('0x33')]));if(_0x478c12[_0x7995('0x2c')]['filter']){_0xf503d5[_0x7995('0x51')]=_['merge'](_0xf503d5[_0x7995('0x51')],{'$or':_[_0x7995('0x1e')](_0xf503d5[_0x7995('0x34')],function(_0x5150aa){var _0x260e84={};_0x260e84[_0x5150aa]={'$like':'%'+_0x478c12[_0x7995('0x2c')][_0x7995('0x1c')]+'%'};return _0x260e84;})});}_0xf503d5=_[_0x7995('0x38')]({},_0xf503d5,_0x478c12[_0x7995('0x45')]);return _0x18a3dc[_0x7995('0x89')](_0xf503d5);}})[_0x7995('0x19')](function(_0x4fb899){if(_0x4fb899){_0x503b32=_0x4fb899['length'];if(!_0x478c12[_0x7995('0x2c')][_0x7995('0x57')](_0x7995('0x5b'))){_0xf503d5[_0x7995('0x15')]=qs[_0x7995('0x15')](_0x478c12[_0x7995('0x2c')]['limit']);_0xf503d5[_0x7995('0x13')]=qs[_0x7995('0x13')](_0x478c12[_0x7995('0x2c')][_0x7995('0x13')]);}return _0x18a3dc['getMembers'](_0xf503d5);}})['then'](function(_0x5b93e6){return _0x5b93e6?{'count':_0x503b32,'rows':_0x5b93e6}:null;})[_0x7995('0x19')](respondWithResult(_0x3b22ec,null))['catch'](handleError(_0x3b22ec,null));};exports[_0x7995('0x8a')]=function(_0x1b6411,_0x54e348){var _0x390bd3={};var _0x3f0a01={};var _0x45d8a2;var _0x26ab59;return db[_0x7995('0x39')]['findOne']({'where':{'id':_0x1b6411['params']['id']}})[_0x7995('0x19')](handleEntityNotFound(_0x54e348,null))[_0x7995('0x19')](function(_0x2cfa1d){if(_0x2cfa1d){_0x45d8a2=_0x2cfa1d;_0x3f0a01[_0x7995('0x31')]=_[_0x7995('0x4e')](db['CmList'][_0x7995('0x32')]);_0x3f0a01[_0x7995('0x2c')]=_[_0x7995('0x4e')](_0x1b6411[_0x7995('0x2c')]);_0x3f0a01[_0x7995('0x33')]=_['intersection'](_0x3f0a01['model'],_0x3f0a01['query']);_0x390bd3['attributes']=_[_0x7995('0x35')](_0x3f0a01[_0x7995('0x31')],qs['fields'](_0x1b6411[_0x7995('0x2c')][_0x7995('0x36')]));_0x390bd3['attributes']=_0x390bd3['attributes'][_0x7995('0x44')]?_0x390bd3[_0x7995('0x34')]:_0x3f0a01[_0x7995('0x31')];_0x390bd3[_0x7995('0x4f')]=qs[_0x7995('0x50')](_0x1b6411[_0x7995('0x2c')][_0x7995('0x50')]);_0x390bd3['where']=qs['filters'](_[_0x7995('0x52')](_0x1b6411[_0x7995('0x2c')],_0x3f0a01[_0x7995('0x33')]));if(_0x1b6411['query'][_0x7995('0x1c')]){_0x390bd3[_0x7995('0x51')]=_[_0x7995('0x38')](_0x390bd3[_0x7995('0x51')],{'$or':_[_0x7995('0x1e')](_0x390bd3[_0x7995('0x34')],function(_0x28ac7c){var _0x1b4cab={};_0x1b4cab[_0x28ac7c]={'$like':'%'+_0x1b6411[_0x7995('0x2c')]['filter']+'%'};return _0x1b4cab;})});}_0x390bd3=_['merge']({},_0x390bd3,_0x1b6411[_0x7995('0x45')]);return _0x45d8a2['getLists'](_0x390bd3);}})[_0x7995('0x19')](function(_0x5953d1){if(_0x5953d1){_0x26ab59=_0x5953d1[_0x7995('0x44')];if(!_0x1b6411[_0x7995('0x2c')][_0x7995('0x57')]('nolimit')){_0x390bd3['limit']=qs[_0x7995('0x15')](_0x1b6411[_0x7995('0x2c')][_0x7995('0x15')]);_0x390bd3[_0x7995('0x13')]=qs[_0x7995('0x13')](_0x1b6411[_0x7995('0x2c')][_0x7995('0x13')]);}return _0x45d8a2[_0x7995('0x8a')](_0x390bd3);}})[_0x7995('0x19')](function(_0x35403c){if(_0x35403c){return _0x35403c?{'count':_0x26ab59,'rows':_0x35403c}:null;}})[_0x7995('0x19')](respondWithResult(_0x54e348,null))['catch'](handleError(_0x54e348,null));};exports[_0x7995('0x8b')]=function(_0xe43c99,_0x1b7e44){var _0x442c6d=moment()[_0x7995('0x6c')]('YYYY-MM-DD\x20HH:mm:ss');var _0x3b5edf,_0x44068f;return db[_0x7995('0x39')][_0x7995('0x21')]({'where':{'id':_0xe43c99[_0x7995('0x30')]['id']}})[_0x7995('0x19')](handleEntityNotFound(_0x1b7e44,null))[_0x7995('0x19')](function(_0x2b812f){if(_0x2b812f){_0x44068f=_0x2b812f;return _0x2b812f[_0x7995('0x8b')](_0xe43c99['body']['ids'],_[_0x7995('0x46')](_0xe43c99[_0x7995('0x3b')],[_0x7995('0x70'),'id'])||{});}return null;})[_0x7995('0x8c')](function(_0x17fd98){var _0x498d7c;_0x3b5edf=_0x17fd98||[];var _0x341024=[];if(_0x17fd98){for(var _0x2bcbc6=0x0;_0x2bcbc6<_0x17fd98[_0x7995('0x44')];_0x2bcbc6+=0x1){var _0x2dd6c7=_0x17fd98[_0x2bcbc6][_0x7995('0x3c')]({'plain':!![]});_0x44068f[_0x7995('0x8d')]=_0xe43c99[_0x7995('0x3b')][_0x7995('0x8d')]?_0xe43c99[_0x7995('0x3b')]['dialCheckDuplicateType']:_0x44068f['dialCheckDuplicateType'];switch(_0x44068f[_0x7995('0x8d')]){case _0x7995('0x8e'):_0x498d7c=squel[_0x7995('0x8f')]()[_0x7995('0x90')](_0x7995('0x91'))[_0x7995('0x92')]([_0x7995('0x93'),_0x7995('0x94'),'ContactId','ListId',_0x7995('0x58'),_0x7995('0x95'),_0x7995('0x47')],squel[_0x7995('0x96')]()['field']('phone',_0x7995('0x93'))[_0x7995('0x72')]('\x27'+_0x442c6d+'\x27',_0x7995('0x94'))[_0x7995('0x72')]('id',_0x7995('0x97'))[_0x7995('0x72')](_0x2dd6c7[_0x7995('0x98')][_0x7995('0x79')](),_0x7995('0x99'))[_0x7995('0x72')](_0xe43c99[_0x7995('0x30')]['id'][_0x7995('0x79')](),'VoiceQueueId')['field']('\x27'+_0x442c6d+'\x27',_0x7995('0x95'))[_0x7995('0x72')]('\x27'+_0x442c6d+'\x27',_0x7995('0x47'))[_0x7995('0x9a')]('cm_contacts')[_0x7995('0x51')]('deletedAt\x20IS\x20NULL')[_0x7995('0x51')](_0x7995('0x9b'),_0x2dd6c7[_0x7995('0x98')][_0x7995('0x79')]())[_0x7995('0x51')](_0x7995('0x9c'))['where'](_0x7995('0x9d'),squel[_0x7995('0x96')]()[_0x7995('0x72')](_0x7995('0x9e'))['from']('cm_hopper_final')[_0x7995('0x51')](_0x7995('0x9f'),_0xe43c99[_0x7995('0x30')]['id'][_0x7995('0x79')]()))['where'](_0x7995('0x9d'),squel[_0x7995('0x96')]()[_0x7995('0x72')]('COALESCE(phone,\x27\x27)')[_0x7995('0x9a')](_0x7995('0x91'))[_0x7995('0x51')]('VoiceQueueId\x20=\x20?',_0xe43c99[_0x7995('0x30')]['id'][_0x7995('0x79')]())))[_0x7995('0x79')]();break;case _0x7995('0xa0'):_0x498d7c=squel[_0x7995('0x8f')]()[_0x7995('0x90')](_0x7995('0x91'))[_0x7995('0x92')]([_0x7995('0x93'),'scheduledAt',_0x7995('0x97'),_0x7995('0x99'),_0x7995('0x58'),_0x7995('0x95'),'updatedAt'],squel[_0x7995('0x96')]()[_0x7995('0x72')](_0x7995('0x93'),_0x7995('0x93'))['field']('\x27'+_0x442c6d+'\x27',_0x7995('0x94'))[_0x7995('0x72')]('id',_0x7995('0x97'))[_0x7995('0x72')](_0x2dd6c7[_0x7995('0x98')][_0x7995('0x79')](),_0x7995('0x99'))['field'](_0xe43c99[_0x7995('0x30')]['id'][_0x7995('0x79')](),_0x7995('0x58'))[_0x7995('0x72')]('\x27'+_0x442c6d+'\x27',_0x7995('0x95'))['field']('\x27'+_0x442c6d+'\x27',_0x7995('0x47'))['from'](_0x7995('0xa1'))[_0x7995('0x51')](_0x7995('0xa2'))['where']('ListId\x20=\x20?',_0x2dd6c7['CmListId'][_0x7995('0x79')]())[_0x7995('0x51')](_0x7995('0x9c'))[_0x7995('0x51')](_0x7995('0x9d'),squel[_0x7995('0x96')]()['field'](_0x7995('0xa3'))[_0x7995('0x9a')](_0x7995('0x91'))[_0x7995('0x51')]('VoiceQueueId\x20=\x20?',_0xe43c99[_0x7995('0x30')]['id'][_0x7995('0x79')]())))['toString']();break;default:_0x498d7c=squel[_0x7995('0x8f')]()['into'](_0x7995('0x91'))[_0x7995('0x92')]([_0x7995('0x93'),'scheduledAt','ContactId',_0x7995('0x99'),_0x7995('0x58'),_0x7995('0x95'),_0x7995('0x47')],squel[_0x7995('0x96')]()[_0x7995('0x72')](_0x7995('0x93'),_0x7995('0x93'))[_0x7995('0x72')]('\x27'+_0x442c6d+'\x27',_0x7995('0x94'))[_0x7995('0x72')]('id','ContactId')['field'](_0x2dd6c7[_0x7995('0x98')][_0x7995('0x79')](),_0x7995('0x99'))[_0x7995('0x72')](_0xe43c99['params']['id']['toString'](),_0x7995('0x58'))[_0x7995('0x72')]('\x27'+_0x442c6d+'\x27','createdAt')['field']('\x27'+_0x442c6d+'\x27',_0x7995('0x47'))[_0x7995('0x9a')](_0x7995('0xa1'))[_0x7995('0x51')](_0x7995('0xa2'))['where'](_0x7995('0x9b'),_0x2dd6c7[_0x7995('0x98')]['toString']())[_0x7995('0x51')](_0x7995('0x9c')))[_0x7995('0x79')]();}_0x341024['push'](db[_0x7995('0x7a')][_0x7995('0x2c')](_0x498d7c));}return BPromise[_0x7995('0x7d')](_0x341024);}})[_0x7995('0x19')](function(){var _0x113e03=[];var _0x5348b1=squel['insert']()[_0x7995('0x90')]('cm_hopper_additional_phones')[_0x7995('0x92')](['CmHopperId',_0x7995('0x93'),_0x7995('0xa4'),_0x7995('0x95'),'updatedAt'],squel['select']()['field'](_0x7995('0xa5'))[_0x7995('0x72')](_0x7995('0xa6'))['field'](_0x7995('0xa7'))[_0x7995('0x72')]('\x27'+_0x442c6d+'\x27','createdAt')[_0x7995('0x72')]('\x27'+_0x442c6d+'\x27',_0x7995('0x47'))[_0x7995('0x9a')](_0x7995('0xa8'),'ci')[_0x7995('0xa9')]('cm_hopper','h','h.ContactId=ci.CmContactId')[_0x7995('0x51')](_0x7995('0xaa'),_0x442c6d)[_0x7995('0x51')](_0x7995('0xab'),_0x7995('0xac')))[_0x7995('0x79')]();_0x113e03[_0x7995('0x78')](db[_0x7995('0x7a')][_0x7995('0x2c')](_0x5348b1));return BPromise[_0x7995('0x7d')](_0x113e03);})['then'](function(){return _0x3b5edf;})[_0x7995('0x19')](respondWithResult(_0x1b7e44,null))[_0x7995('0x2e')](handleError(_0x1b7e44,null));};exports[_0x7995('0xad')]=function(_0xff759b,_0x39ee00){return db[_0x7995('0x39')][_0x7995('0x21')]({'where':{'id':_0xff759b['params']['id']}})['then'](handleEntityNotFound(_0x39ee00,null))[_0x7995('0x19')](function(_0x2aec8d){if(_0x2aec8d){return _0x2aec8d[_0x7995('0xad')](_0xff759b[_0x7995('0x2c')]['ids']);}})['then'](function(_0x4b477a){if(_0x4b477a){return db[_0x7995('0x53')][_0x7995('0x25')]({'where':{'ListId':_0xff759b['query'][_0x7995('0x70')],'VoiceQueueId':_0xff759b[_0x7995('0x30')]['id']}})[_0x7995('0x19')](function(){return _0x4b477a;});}})[_0x7995('0x19')](respondWithStatusCode(_0x39ee00,null))[_0x7995('0x2e')](handleError(_0x39ee00,null));};exports[_0x7995('0xae')]=function(_0x35229d,_0x22d392){var _0x57438e={};var _0x463c25={};var _0x13d525;var _0x37b7e7;return db['VoiceQueue'][_0x7995('0x4d')]({'where':{'id':_0x35229d['params']['id']}})['then'](handleEntityNotFound(_0x22d392,null))['then'](function(_0x507bf3){if(_0x507bf3){_0x13d525=_0x507bf3;_0x463c25[_0x7995('0x31')]=_['keys'](db[_0x7995('0xaf')][_0x7995('0x32')]);_0x463c25['query']=_[_0x7995('0x4e')](_0x35229d[_0x7995('0x2c')]);_0x463c25[_0x7995('0x33')]=_[_0x7995('0x35')](_0x463c25['model'],_0x463c25[_0x7995('0x2c')]);_0x57438e['attributes']=_[_0x7995('0x35')](_0x463c25[_0x7995('0x31')],qs[_0x7995('0x36')](_0x35229d[_0x7995('0x2c')][_0x7995('0x36')]));_0x57438e[_0x7995('0x34')]=_0x57438e[_0x7995('0x34')][_0x7995('0x44')]?_0x57438e[_0x7995('0x34')]:_0x463c25[_0x7995('0x31')];_0x57438e['order']=qs[_0x7995('0x50')](_0x35229d[_0x7995('0x2c')]['sort']);_0x57438e[_0x7995('0x51')]=qs[_0x7995('0x33')](_[_0x7995('0x52')](_0x35229d[_0x7995('0x2c')],_0x463c25[_0x7995('0x33')]));if(_0x35229d[_0x7995('0x2c')]['filter']){_0x57438e[_0x7995('0x51')]=_['merge'](_0x57438e[_0x7995('0x51')],{'$or':_[_0x7995('0x1e')](_0x57438e[_0x7995('0x34')],function(_0xb79b0b){var _0x259bf2={};_0x259bf2[_0xb79b0b]={'$like':'%'+_0x35229d[_0x7995('0x2c')]['filter']+'%'};return _0x259bf2;})});}_0x57438e=_[_0x7995('0x38')]({},_0x57438e,_0x35229d[_0x7995('0x45')]);return _0x13d525[_0x7995('0xae')](_0x57438e);}})['then'](function(_0x1176cd){if(_0x1176cd){_0x37b7e7=_0x1176cd[_0x7995('0x44')];if(!_0x35229d[_0x7995('0x2c')][_0x7995('0x57')](_0x7995('0x5b'))){_0x57438e[_0x7995('0x15')]=qs[_0x7995('0x15')](_0x35229d[_0x7995('0x2c')][_0x7995('0x15')]);_0x57438e[_0x7995('0x13')]=qs[_0x7995('0x13')](_0x35229d['query'][_0x7995('0x13')]);}return _0x13d525[_0x7995('0xae')](_0x57438e);}})['then'](function(_0x3098ef){if(_0x3098ef){return _0x3098ef?{'count':_0x37b7e7,'rows':_0x3098ef}:null;}})[_0x7995('0x19')](respondWithResult(_0x22d392,null))[_0x7995('0x2e')](handleError(_0x22d392,null));};exports[_0x7995('0xb0')]=function(_0x258f87,_0x5a5cc4){var _0x37af6b;return db[_0x7995('0x39')][_0x7995('0x21')]({'where':{'id':_0x258f87[_0x7995('0x30')]['id']}})[_0x7995('0x19')](handleEntityNotFound(_0x5a5cc4,null))[_0x7995('0x19')](function(_0x120bef){if(_0x120bef){return _0x120bef[_0x7995('0xb0')](_0x258f87[_0x7995('0x3b')][_0x7995('0x70')],_[_0x7995('0x46')](_0x258f87[_0x7995('0x3b')],[_0x7995('0x70'),'id'])||{});}return null;})['spread'](function(_0x247b71){var _0x1ecb6f;_0x37af6b=_0x247b71||[];var _0x225a37=[];if(_0x247b71){for(var _0x1a9f59=0x0;_0x1a9f59<_0x247b71['length'];_0x1a9f59+=0x1){var _0x92a561=_0x247b71[_0x1a9f59][_0x7995('0x3c')]({'plain':!![]});_0x1ecb6f=squel[_0x7995('0x8f')]()[_0x7995('0x90')](_0x7995('0xb1'))[_0x7995('0x92')]([_0x7995('0x93'),'ContactId',_0x7995('0x99'),'VoiceQueueId',_0x7995('0x95'),_0x7995('0x47')],squel[_0x7995('0x96')]()['field']('phone',_0x7995('0x93'))[_0x7995('0x72')]('id',_0x7995('0x97'))['field'](_0x92a561[_0x7995('0x98')]['toString'](),_0x7995('0x99'))[_0x7995('0x72')](_0x258f87[_0x7995('0x30')]['id'][_0x7995('0x79')](),_0x7995('0x58'))[_0x7995('0x72')]('NOW()',_0x7995('0x95'))[_0x7995('0x72')]('NOW()',_0x7995('0x47'))[_0x7995('0x9a')](_0x7995('0xa1'))[_0x7995('0x51')](_0x7995('0xa2'))[_0x7995('0x51')](_0x7995('0x9b'),_0x92a561[_0x7995('0x98')][_0x7995('0x79')]())[_0x7995('0x51')](_0x7995('0x9c')))[_0x7995('0x79')]();_0x225a37[_0x7995('0x78')](db[_0x7995('0x7a')][_0x7995('0x2c')](_0x1ecb6f));}return BPromise[_0x7995('0x7d')](_0x225a37);}})[_0x7995('0x19')](function(){return _0x37af6b;})['then'](respondWithResult(_0x5a5cc4,null))['catch'](handleError(_0x5a5cc4,null));};exports[_0x7995('0xb2')]=function(_0x2f3c17,_0x4fe5eb){return db[_0x7995('0x39')][_0x7995('0x21')]({'where':{'id':_0x2f3c17['params']['id']}})['then'](handleEntityNotFound(_0x4fe5eb,null))[_0x7995('0x19')](function(_0x31a3d6){if(_0x31a3d6){return _0x31a3d6[_0x7995('0xb2')](_0x2f3c17[_0x7995('0x2c')][_0x7995('0x70')]);}})[_0x7995('0x19')](function(_0x1b3920){if(_0x1b3920){return db[_0x7995('0x5d')][_0x7995('0x25')]({'where':{'ListId':_0x2f3c17[_0x7995('0x2c')]['ids'],'VoiceQueueId':_0x2f3c17[_0x7995('0x30')]['id']}})[_0x7995('0x19')](function(){return _0x1b3920;});}})[_0x7995('0x19')](respondWithStatusCode(_0x4fe5eb,null))[_0x7995('0x2e')](handleError(_0x4fe5eb,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 1f553f6..5b9d285 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 _0x62be=['update','remove','hasOwnProperty','hook','exports','events','VoiceQueue','setMaxListeners','save'];(function(_0x1707c9,_0x13a573){var _0x19b212=function(_0x57ecc2){while(--_0x57ecc2){_0x1707c9['push'](_0x1707c9['shift']());}};_0x19b212(++_0x13a573);}(_0x62be,0x83));var _0xe62b=function(_0x33ebd4,_0x294358){_0x33ebd4=_0x33ebd4-0x0;var _0xad487a=_0x62be[_0x33ebd4];return _0xad487a;};'use strict';var EventEmitter=require(_0xe62b('0x0'));var VoiceQueue=require('../../mysqldb')['db'][_0xe62b('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xe62b('0x2')](0x0);var events={'afterCreate':_0xe62b('0x3'),'afterUpdate':_0xe62b('0x4'),'afterDestroy':_0xe62b('0x5')};function emitEvent(_0x5880f6){return function(_0x2c99b9,_0x5b0e90,_0x1e856d){VoiceQueueEvents['emit'](_0x5880f6+':'+_0x2c99b9['id'],_0x2c99b9);VoiceQueueEvents['emit'](_0x5880f6,_0x2c99b9);_0x1e856d(null);};}for(var e in events){if(events[_0xe62b('0x6')](e)){var event=events[e];VoiceQueue[_0xe62b('0x7')](e,emitEvent(event));}}module[_0xe62b('0x8')]=VoiceQueueEvents; \ No newline at end of file +var _0x1436=['setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x19d24c,_0x62bc50){var _0x2fae8d=function(_0x419856){while(--_0x419856){_0x19d24c['push'](_0x19d24c['shift']());}};_0x2fae8d(++_0x62bc50);}(_0x1436,0x159));var _0x6143=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x1436[_0x57b54c];return _0x59cc19;};'use strict';var EventEmitter=require('events');var VoiceQueue=require('../../mysqldb')['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x6143('0x0')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6143('0x1'),'afterDestroy':_0x6143('0x2')};function emitEvent(_0x3b94a8){return function(_0x5cd1a6,_0x10e978,_0x2d44c7){VoiceQueueEvents['emit'](_0x3b94a8+':'+_0x5cd1a6['id'],_0x5cd1a6);VoiceQueueEvents[_0x6143('0x3')](_0x3b94a8,_0x5cd1a6);_0x2d44c7(null);};}for(var e in events){if(events[_0x6143('0x4')](e)){var event=events[e];VoiceQueue['hook'](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 6128e29..14ee8e2 100644 --- a/server/api/voiceQueue/voiceQueue.model.js +++ b/server/api/voiceQueue/voiceQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../config/environment','./voiceQueue.attributes','exports','define','VoiceQueue','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x1d7645,_0x27aa61){var _0x3aebe9=function(_0x4b8bfb){while(--_0x4b8bfb){_0x1d7645['push'](_0x1d7645['shift']());}};_0x3aebe9(++_0x27aa61);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3e74=['exports','VoiceQueue','voice_queues','lodash','../../config/logger','api','moment','path','../../config/environment','./voiceQueue.attributes'];(function(_0x2695ab,_0x3f4b39){var _0x3eaf50=function(_0x2ada55){while(--_0x2ada55){_0x2695ab['push'](_0x2695ab['shift']());}};_0x3eaf50(++_0x3f4b39);}(_0x3e74,0x175));var _0x43e7=function(_0x4b0c29,_0x321019){_0x4b0c29=_0x4b0c29-0x0;var _0x4e4e05=_0x3e74[_0x4b0c29];return _0x4e4e05;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var logger=require(_0x43e7('0x1'))(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x43e7('0x4'));var rimraf=require('rimraf');var config=require(_0x43e7('0x5'));var attributes=require(_0x43e7('0x6'));module[_0x43e7('0x7')]=function(_0x1c503b,_0xc98b9c){return _0x1c503b['define'](_0x43e7('0x8'),attributes,{'tableName':_0x43e7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index e8fb600..b7f9852 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 _0x8ca1=['jayson/promise','client','http','redis','socket.io-emitter','./voiceQueue.socket','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetVoiceQueue','VoiceQueue','findAll','options','raw','attributes','limit','include','map','model','then','catch','find','where','ShowVoiceQueue','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x8ca1,0x91));var _0x18ca=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x8ca1[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x18ca('0x0'));var BPromise=require(_0x18ca('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x18ca('0x2'));var db=require(_0x18ca('0x3'))['db'];var utils=require(_0x18ca('0x4'));var logger=require(_0x18ca('0x5'))(_0x18ca('0x6'));var config=require('../../config/environment');var jayson=require(_0x18ca('0x7'));var client=jayson[_0x18ca('0x8')][_0x18ca('0x9')]({'port':0x232a});config[_0x18ca('0xa')]=_['defaults'](config[_0x18ca('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x18ca('0xb'))(new Redis(config[_0x18ca('0xa')]));require(_0x18ca('0xc'))['register'](socket);function respondWithRpcPromise(_0x350a19,_0x5bc02f,_0x5f0631){return new BPromise(function(_0x49d596,_0x348958){return client['request'](_0x350a19,_0x5f0631)['then'](function(_0xf8ffe6){logger[_0x18ca('0xd')](_0x18ca('0xe'),_0x5bc02f,_0x18ca('0xf'));logger[_0x18ca('0x10')](_0x18ca('0x11'),_0x5bc02f,'request\x20sent',JSON[_0x18ca('0x12')](_0xf8ffe6));if(_0xf8ffe6['error']){if(_0xf8ffe6[_0x18ca('0x13')][_0x18ca('0x14')]===0x1f4){logger[_0x18ca('0x13')]('VoiceQueue,\x20%s,\x20%s',_0x5bc02f,_0xf8ffe6[_0x18ca('0x13')][_0x18ca('0x15')]);return _0x348958(_0xf8ffe6[_0x18ca('0x13')]['message']);}logger[_0x18ca('0x13')]('VoiceQueue,\x20%s,\x20%s',_0x5bc02f,_0xf8ffe6[_0x18ca('0x13')][_0x18ca('0x15')]);return _0x49d596(_0xf8ffe6[_0x18ca('0x13')]['message']);}else{logger[_0x18ca('0xd')](_0x18ca('0xe'),_0x5bc02f,_0x18ca('0xf'));_0x49d596(_0xf8ffe6[_0x18ca('0x16')]['message']);}})['catch'](function(_0x32e410){logger[_0x18ca('0x13')](_0x18ca('0xe'),_0x5bc02f,_0x32e410);_0x348958(_0x32e410);});});}exports[_0x18ca('0x17')]=function(_0x99b0c8){var _0x2666cb=this;return new Promise(function(_0x408a64,_0x30fd05){return db[_0x18ca('0x18')][_0x18ca('0x19')]({'raw':_0x99b0c8[_0x18ca('0x1a')]?_0x99b0c8[_0x18ca('0x1a')][_0x18ca('0x1b')]===undefined?!![]:![]:!![],'where':_0x99b0c8[_0x18ca('0x1a')]?_0x99b0c8[_0x18ca('0x1a')]['where']||null:null,'attributes':_0x99b0c8[_0x18ca('0x1a')]?_0x99b0c8[_0x18ca('0x1a')][_0x18ca('0x1c')]||null:null,'limit':_0x99b0c8['options']?_0x99b0c8[_0x18ca('0x1a')][_0x18ca('0x1d')]||null:null,'include':_0x99b0c8['options']?_0x99b0c8[_0x18ca('0x1a')][_0x18ca('0x1e')]?_[_0x18ca('0x1f')](_0x99b0c8[_0x18ca('0x1a')]['include'],function(_0x1e84e9){return{'model':db[_0x1e84e9['model']],'as':_0x1e84e9['as'],'attributes':_0x1e84e9[_0x18ca('0x1c')],'include':_0x1e84e9[_0x18ca('0x1e')]?_[_0x18ca('0x1f')](_0x1e84e9[_0x18ca('0x1e')],function(_0x2ecee2){return{'model':db[_0x2ecee2['model']],'as':_0x2ecee2['as'],'attributes':_0x2ecee2[_0x18ca('0x1c')],'include':_0x2ecee2[_0x18ca('0x1e')]?_[_0x18ca('0x1f')](_0x2ecee2[_0x18ca('0x1e')],function(_0x3c234b){return{'model':db[_0x3c234b[_0x18ca('0x20')]],'as':_0x3c234b['as'],'attributes':_0x3c234b[_0x18ca('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x18ca('0x21')](function(_0x578b55){logger[_0x18ca('0xd')](_0x18ca('0x17'),_0x99b0c8);logger[_0x18ca('0x10')]('GetVoiceQueue',_0x99b0c8,JSON[_0x18ca('0x12')](_0x578b55));_0x408a64(_0x578b55);})[_0x18ca('0x22')](function(_0x1b8d99){logger[_0x18ca('0x13')](_0x18ca('0x17'),_0x1b8d99[_0x18ca('0x15')],_0x99b0c8);_0x30fd05(_0x2666cb[_0x18ca('0x13')](0x1f4,_0x1b8d99['message']));});});};exports['ShowVoiceQueue']=function(_0x49548c){var _0x290fc9=this;return new Promise(function(_0x5d0f7d,_0xc68d55){return db[_0x18ca('0x18')][_0x18ca('0x23')]({'raw':_0x49548c[_0x18ca('0x1a')]?_0x49548c[_0x18ca('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x49548c[_0x18ca('0x1a')]?_0x49548c['options'][_0x18ca('0x24')]||null:null,'attributes':_0x49548c['options']?_0x49548c[_0x18ca('0x1a')][_0x18ca('0x1c')]||null:null,'include':_0x49548c[_0x18ca('0x1a')]?_0x49548c['options'][_0x18ca('0x1e')]?_[_0x18ca('0x1f')](_0x49548c['options'][_0x18ca('0x1e')],function(_0x7e8861){return{'model':db[_0x7e8861['model']],'as':_0x7e8861['as'],'attributes':_0x7e8861[_0x18ca('0x1c')],'include':_0x7e8861[_0x18ca('0x1e')]?_[_0x18ca('0x1f')](_0x7e8861[_0x18ca('0x1e')],function(_0x470d98){return{'model':db[_0x470d98[_0x18ca('0x20')]],'as':_0x470d98['as'],'attributes':_0x470d98['attributes'],'include':_0x470d98['include']?_['map'](_0x470d98['include'],function(_0x581d99){return{'model':db[_0x581d99[_0x18ca('0x20')]],'as':_0x581d99['as'],'attributes':_0x581d99[_0x18ca('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x18ca('0x21')](function(_0x303a45){logger['info']('ShowVoiceQueue',_0x49548c);logger['debug']('ShowVoiceQueue',_0x49548c,JSON[_0x18ca('0x12')](_0x303a45));_0x5d0f7d(_0x303a45);})[_0x18ca('0x22')](function(_0x5ddcdf){logger[_0x18ca('0x13')](_0x18ca('0x25'),_0x5ddcdf['message'],_0x49548c);_0xc68d55(_0x290fc9[_0x18ca('0x13')](0x1f4,_0x5ddcdf[_0x18ca('0x15')]));});});}; \ No newline at end of file +var _0x8981=['map','model','then','stringify','ShowVoiceQueue','VoiceQueue','find','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','http','defaults','redis','localhost','./voiceQueue.socket','register','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','GetVoiceQueue','findAll','options','raw','where','limit','include','attributes'];(function(_0x3d5ddd,_0x570d2e){var _0x5c908e=function(_0x3a46df){while(--_0x3a46df){_0x3d5ddd['push'](_0x3d5ddd['shift']());}};_0x5c908e(++_0x570d2e);}(_0x8981,0x19e));var _0x1898=function(_0x3c9f69,_0x10a0bc){_0x3c9f69=_0x3c9f69-0x0;var _0x210e68=_0x8981[_0x3c9f69];return _0x210e68;};'use strict';var _=require(_0x1898('0x0'));var util=require(_0x1898('0x1'));var moment=require('moment');var BPromise=require(_0x1898('0x2'));var rs=require(_0x1898('0x3'));var fs=require('fs');var Redis=require(_0x1898('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1898('0x5'));var logger=require(_0x1898('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x1898('0x7'));var client=jayson['client'][_0x1898('0x8')]({'port':0x232a});config['redis']=_[_0x1898('0x9')](config[_0x1898('0xa')],{'host':_0x1898('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x1898('0xc'))[_0x1898('0xd')](socket);function respondWithRpcPromise(_0x2debdd,_0x1fb40c,_0x41143d){return new BPromise(function(_0x4971d1,_0x57ecce){return client['request'](_0x2debdd,_0x41143d)['then'](function(_0x5d82fb){logger[_0x1898('0xe')](_0x1898('0xf'),_0x1fb40c,_0x1898('0x10'));logger[_0x1898('0x11')]('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x1fb40c,_0x1898('0x10'),JSON['stringify'](_0x5d82fb));if(_0x5d82fb[_0x1898('0x12')]){if(_0x5d82fb[_0x1898('0x12')]['code']===0x1f4){logger[_0x1898('0x12')]('VoiceQueue,\x20%s,\x20%s',_0x1fb40c,_0x5d82fb[_0x1898('0x12')][_0x1898('0x13')]);return _0x57ecce(_0x5d82fb[_0x1898('0x12')]['message']);}logger[_0x1898('0x12')]('VoiceQueue,\x20%s,\x20%s',_0x1fb40c,_0x5d82fb[_0x1898('0x12')]['message']);return _0x4971d1(_0x5d82fb[_0x1898('0x12')][_0x1898('0x13')]);}else{logger[_0x1898('0xe')]('VoiceQueue,\x20%s,\x20%s',_0x1fb40c,_0x1898('0x10'));_0x4971d1(_0x5d82fb[_0x1898('0x14')][_0x1898('0x13')]);}})[_0x1898('0x15')](function(_0x5dde0a){logger[_0x1898('0x12')]('VoiceQueue,\x20%s,\x20%s',_0x1fb40c,_0x5dde0a);_0x57ecce(_0x5dde0a);});});}exports[_0x1898('0x16')]=function(_0x44b0fd){var _0x2252bd=this;return new Promise(function(_0x5e98de,_0x5237bc){return db['VoiceQueue'][_0x1898('0x17')]({'raw':_0x44b0fd[_0x1898('0x18')]?_0x44b0fd[_0x1898('0x18')][_0x1898('0x19')]===undefined?!![]:![]:!![],'where':_0x44b0fd[_0x1898('0x18')]?_0x44b0fd[_0x1898('0x18')][_0x1898('0x1a')]||null:null,'attributes':_0x44b0fd['options']?_0x44b0fd[_0x1898('0x18')]['attributes']||null:null,'limit':_0x44b0fd[_0x1898('0x18')]?_0x44b0fd[_0x1898('0x18')][_0x1898('0x1b')]||null:null,'include':_0x44b0fd[_0x1898('0x18')]?_0x44b0fd[_0x1898('0x18')][_0x1898('0x1c')]?_['map'](_0x44b0fd['options']['include'],function(_0x311775){return{'model':db[_0x311775['model']],'as':_0x311775['as'],'attributes':_0x311775[_0x1898('0x1d')],'include':_0x311775['include']?_[_0x1898('0x1e')](_0x311775[_0x1898('0x1c')],function(_0x510378){return{'model':db[_0x510378[_0x1898('0x1f')]],'as':_0x510378['as'],'attributes':_0x510378[_0x1898('0x1d')],'include':_0x510378['include']?_[_0x1898('0x1e')](_0x510378[_0x1898('0x1c')],function(_0x1b7bc7){return{'model':db[_0x1b7bc7[_0x1898('0x1f')]],'as':_0x1b7bc7['as'],'attributes':_0x1b7bc7['attributes']};}):[]};}):[]};}):[]:[]})[_0x1898('0x20')](function(_0x6ccee7){logger[_0x1898('0xe')](_0x1898('0x16'),_0x44b0fd);logger['debug'](_0x1898('0x16'),_0x44b0fd,JSON[_0x1898('0x21')](_0x6ccee7));_0x5e98de(_0x6ccee7);})[_0x1898('0x15')](function(_0x265d78){logger[_0x1898('0x12')]('GetVoiceQueue',_0x265d78[_0x1898('0x13')],_0x44b0fd);_0x5237bc(_0x2252bd[_0x1898('0x12')](0x1f4,_0x265d78[_0x1898('0x13')]));});});};exports[_0x1898('0x22')]=function(_0x4fad16){var _0x2fcb24=this;return new Promise(function(_0x123ebf,_0x35a0fc){return db[_0x1898('0x23')][_0x1898('0x24')]({'raw':_0x4fad16[_0x1898('0x18')]?_0x4fad16['options']['raw']===undefined?!![]:![]:!![],'where':_0x4fad16[_0x1898('0x18')]?_0x4fad16[_0x1898('0x18')][_0x1898('0x1a')]||null:null,'attributes':_0x4fad16[_0x1898('0x18')]?_0x4fad16[_0x1898('0x18')][_0x1898('0x1d')]||null:null,'include':_0x4fad16['options']?_0x4fad16[_0x1898('0x18')]['include']?_[_0x1898('0x1e')](_0x4fad16[_0x1898('0x18')][_0x1898('0x1c')],function(_0x1b9e0e){return{'model':db[_0x1b9e0e['model']],'as':_0x1b9e0e['as'],'attributes':_0x1b9e0e[_0x1898('0x1d')],'include':_0x1b9e0e[_0x1898('0x1c')]?_['map'](_0x1b9e0e[_0x1898('0x1c')],function(_0xa2ac29){return{'model':db[_0xa2ac29[_0x1898('0x1f')]],'as':_0xa2ac29['as'],'attributes':_0xa2ac29[_0x1898('0x1d')],'include':_0xa2ac29[_0x1898('0x1c')]?_[_0x1898('0x1e')](_0xa2ac29[_0x1898('0x1c')],function(_0x333dbe){return{'model':db[_0x333dbe[_0x1898('0x1f')]],'as':_0x333dbe['as'],'attributes':_0x333dbe[_0x1898('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x46316f){logger['info']('ShowVoiceQueue',_0x4fad16);logger[_0x1898('0x11')]('ShowVoiceQueue',_0x4fad16,JSON[_0x1898('0x21')](_0x46316f));_0x123ebf(_0x46316f);})[_0x1898('0x15')](function(_0x23533d){logger[_0x1898('0x12')](_0x1898('0x22'),_0x23533d[_0x1898('0x13')],_0x4fad16);_0x35a0fc(_0x2fcb24[_0x1898('0x12')](0x1f4,_0x23533d[_0x1898('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 792d04c..fbac48f 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 _0xb01f=['update','emit','removeListener','register','length','./voiceQueue.events','remove'];(function(_0x49c32c,_0x250fdf){var _0x4fa641=function(_0xf882f7){while(--_0xf882f7){_0x49c32c['push'](_0x49c32c['shift']());}};_0x4fa641(++_0x250fdf);}(_0xb01f,0xd7));var _0xfb01=function(_0x386008,_0x384dab){_0x386008=_0x386008-0x0;var _0x31e3ef=_0xb01f[_0x386008];return _0x31e3ef;};'use strict';var VoiceQueueEvents=require(_0xfb01('0x0'));var events=['save',_0xfb01('0x1'),_0xfb01('0x2')];function createListener(_0x321378,_0x2b708e){return function(_0x3d5a34){_0x2b708e[_0xfb01('0x3')](_0x321378,_0x3d5a34);};}function removeListener(_0x4d4dfa,_0x1c2266){return function(){VoiceQueueEvents[_0xfb01('0x4')](_0x4d4dfa,_0x1c2266);};}exports[_0xfb01('0x5')]=function(_0x4a2fa6){for(var _0x42cab0=0x0,_0x34c340=events[_0xfb01('0x6')];_0x42cab0<_0x34c340;_0x42cab0++){var _0x5aa03b=events[_0x42cab0];var _0x3bf3a9=createListener('voiceQueue:'+_0x5aa03b,_0x4a2fa6);VoiceQueueEvents['on'](_0x5aa03b,_0x3bf3a9);}}; \ No newline at end of file +var _0xb6da=['emit','removeListener','register','length','voiceQueue:','save','remove','update'];(function(_0x6f4c31,_0x11cf01){var _0x191a9c=function(_0x85b741){while(--_0x85b741){_0x6f4c31['push'](_0x6f4c31['shift']());}};_0x191a9c(++_0x11cf01);}(_0xb6da,0xed));var _0xab6d=function(_0x55b709,_0x4a8b6c){_0x55b709=_0x55b709-0x0;var _0x2db908=_0xb6da[_0x55b709];return _0x2db908;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=[_0xab6d('0x0'),_0xab6d('0x1'),_0xab6d('0x2')];function createListener(_0x2d206f,_0x5247c1){return function(_0x26bdf8){_0x5247c1[_0xab6d('0x3')](_0x2d206f,_0x26bdf8);};}function removeListener(_0x2a4845,_0xa2093){return function(){VoiceQueueEvents[_0xab6d('0x4')](_0x2a4845,_0xa2093);};}exports[_0xab6d('0x5')]=function(_0x1d9354){for(var _0x17f3e8=0x0,_0x24fdd3=events[_0xab6d('0x6')];_0x17f3e8<_0x24fdd3;_0x17f3e8++){var _0x48bdce=events[_0x17f3e8];var _0x1d6f79=createListener(_0xab6d('0x7')+_0x48bdce,_0x1d9354);VoiceQueueEvents['on'](_0x48bdce,_0x1d6f79);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index bca42b0..1e94e1c 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 _0x30bf=['express','fs-extra','../../components/auth/service','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','index','/describe','describe','/index','getVoiceQueuesReport','show','create','put','/:id','update','delete','destroy','multer','util'];(function(_0x28fe4f,_0x28205c){var _0x2ad93e=function(_0x319848){while(--_0x319848){_0x28fe4f['push'](_0x28fe4f['shift']());}};_0x2ad93e(++_0x28205c);}(_0x30bf,0x67));var _0xf30b=function(_0x3ea5a4,_0x4ab044){_0x3ea5a4=_0x3ea5a4-0x0;var _0x2fcdfb=_0x30bf[_0x3ea5a4];return _0x2fcdfb;};'use strict';var multer=require(_0xf30b('0x0'));var util=require(_0xf30b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xf30b('0x2'));var router=express['Router']();var fs_extra=require(_0xf30b('0x3'));var auth=require(_0xf30b('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xf30b('0x5'));var controller=require(_0xf30b('0x6'));router[_0xf30b('0x7')]('/',auth[_0xf30b('0x8')](),controller[_0xf30b('0x9')]);router[_0xf30b('0x7')](_0xf30b('0xa'),auth[_0xf30b('0x8')](),controller[_0xf30b('0xb')]);router[_0xf30b('0x7')](_0xf30b('0xc'),auth['isAuthenticated'](),controller[_0xf30b('0xd')]);router[_0xf30b('0x7')]('/:id',auth[_0xf30b('0x8')](),controller[_0xf30b('0xe')]);router['post']('/',auth[_0xf30b('0x8')](),controller[_0xf30b('0xf')]);router[_0xf30b('0x10')](_0xf30b('0x11'),auth['isAuthenticated'](),controller[_0xf30b('0x12')]);router[_0xf30b('0x13')](_0xf30b('0x11'),auth['isAuthenticated'](),controller[_0xf30b('0x14')]);module['exports']=router; \ No newline at end of file +var _0x478a=['/index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe'];(function(_0x293473,_0x36661e){var _0x1b2700=function(_0x337666){while(--_0x337666){_0x293473['push'](_0x293473['shift']());}};_0x1b2700(++_0x36661e);}(_0x478a,0x154));var _0xa478=function(_0x40a563,_0x2b5610){_0x40a563=_0x40a563-0x0;var _0x449134=_0x478a[_0x40a563];return _0x449134;};'use strict';var multer=require(_0xa478('0x0'));var util=require(_0xa478('0x1'));var path=require(_0xa478('0x2'));var timeout=require(_0xa478('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xa478('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xa478('0x5'));var config=require(_0xa478('0x6'));var controller=require('./voiceQueueReport.controller');router['get']('/',auth[_0xa478('0x7')](),controller[_0xa478('0x8')]);router[_0xa478('0x9')](_0xa478('0xa'),auth[_0xa478('0x7')](),controller[_0xa478('0xb')]);router[_0xa478('0x9')](_0xa478('0xc'),auth[_0xa478('0x7')](),controller['getVoiceQueuesReport']);router['get'](_0xa478('0xd'),auth[_0xa478('0x7')](),controller[_0xa478('0xe')]);router[_0xa478('0xf')]('/',auth[_0xa478('0x7')](),controller[_0xa478('0x10')]);router[_0xa478('0x11')](_0xa478('0xd'),auth[_0xa478('0x7')](),controller[_0xa478('0x12')]);router[_0xa478('0x13')]('/:id',auth['isAuthenticated'](),controller[_0xa478('0x14')]);module[_0xa478('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index ada3d3d..739f983 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 _0x0262=['format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports','STRING','DATE','getDataValue','queuecallerjoinAt'];(function(_0x3e0b8f,_0x1cddeb){var _0x22f742=function(_0xacb1bc){while(--_0xacb1bc){_0x3e0b8f['push'](_0x3e0b8f['shift']());}};_0x22f742(++_0x1cddeb);}(_0x0262,0x1e6));var _0x2026=function(_0x15f540,_0x12d887){_0x15f540=_0x15f540-0x0;var _0x533516=_0x0262[_0x15f540];return _0x533516;};'use strict';var Sequelize=require(_0x2026('0x0'));var moment=require(_0x2026('0x1'));module[_0x2026('0x2')]={'type':{'type':Sequelize[_0x2026('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x2026('0x3')]},'calleridname':{'type':Sequelize[_0x2026('0x3')]},'queue':{'type':Sequelize[_0x2026('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0x2026('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0x2026('0x4')],'set':function(_0x35d4b0){var _0x3caa34=moment(_0x35d4b0);var _0x3a198e=moment(this[_0x2026('0x5')](_0x2026('0x6')))[_0x2026('0x7')](_0x2026('0x8'));var _0x1d572d=_0x3caa34[_0x2026('0x9')](_0x3a198e,_0x2026('0xa'));this['setDataValue'](_0x2026('0xb'),_0x35d4b0);this['setDataValue'](_0x2026('0xc'),_0x1d572d||null);}},'position':{'type':Sequelize[_0x2026('0xd')]},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize[_0x2026('0xe')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x2026('0x4')]},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x2026('0x4')]},'queuecallerexit':{'type':Sequelize[_0x2026('0xe')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize['DATE']},'queuecallerexitreason':{'type':Sequelize[_0x2026('0x3')],'comment':_0x2026('0xf')},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x2026('0x3')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x2026('0x3')]},'context':{'type':Sequelize[_0x2026('0x3')]},'exten':{'type':Sequelize[_0x2026('0x3')]},'priority':{'type':Sequelize[_0x2026('0x3')]},'holdtime':{'type':Sequelize[_0x2026('0xd')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x2026('0x3')]},'transfer':{'type':Sequelize[_0x2026('0xe')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x2026('0x3')],'comment':_0x2026('0x10')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0x2026('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x2026('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize[_0x2026('0xd')],'defaultValue':0x0},'note':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3aaa=['COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','sequelize','exports','STRING','DATE','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','seconds','setDataValue','holdtime','INTEGER','BOOLEAN'];(function(_0x5ded96,_0x35805c){var _0x3cd145=function(_0x324285){while(--_0x324285){_0x5ded96['push'](_0x5ded96['shift']());}};_0x3cd145(++_0x35805c);}(_0x3aaa,0xfd));var _0xa3aa=function(_0x57e68b,_0x582e9a){_0x57e68b=_0x57e68b-0x0;var _0x10ba9c=_0x3aaa[_0x57e68b];return _0x10ba9c;};'use strict';var Sequelize=require(_0xa3aa('0x0'));var moment=require('moment');module[_0xa3aa('0x1')]={'type':{'type':Sequelize[_0xa3aa('0x2')]},'uniqueid':{'type':Sequelize[_0xa3aa('0x2')]},'calleridnum':{'type':Sequelize[_0xa3aa('0x2')]},'calleridname':{'type':Sequelize[_0xa3aa('0x2')]},'queue':{'type':Sequelize[_0xa3aa('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0xa3aa('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0xa3aa('0x3')],'set':function(_0x51387a){var _0x52ee45=moment(_0x51387a);var _0x3dec93=moment(this['getDataValue'](_0xa3aa('0x4')))['format'](_0xa3aa('0x5'));var _0x358981=_0x52ee45['diff'](_0x3dec93,_0xa3aa('0x6'));this[_0xa3aa('0x7')]('queuecallerleaveAt',_0x51387a);this[_0xa3aa('0x7')](_0xa3aa('0x8'),_0x358981||null);}},'position':{'type':Sequelize[_0xa3aa('0x9')]},'count':{'type':Sequelize[_0xa3aa('0x9')]},'queuecallerabandon':{'type':Sequelize[_0xa3aa('0xa')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0xa3aa('0x3')]},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize[_0xa3aa('0xa')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0xa3aa('0x3')]},'queuecallerexitreason':{'type':Sequelize[_0xa3aa('0x2')],'comment':_0xa3aa('0xb')},'originalposition':{'type':Sequelize[_0xa3aa('0x9')]},'channel':{'type':Sequelize[_0xa3aa('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xa3aa('0x2')]},'context':{'type':Sequelize[_0xa3aa('0x2')]},'exten':{'type':Sequelize[_0xa3aa('0x2')]},'priority':{'type':Sequelize[_0xa3aa('0x2')]},'holdtime':{'type':Sequelize[_0xa3aa('0x9')]},'mohtime':{'type':Sequelize[_0xa3aa('0x9')],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0xa3aa('0x2')]},'transfer':{'type':Sequelize[_0xa3aa('0xa')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xa3aa('0x2')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0xa3aa('0x2')]},'transferuniqueid':{'type':Sequelize[_0xa3aa('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xa3aa('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0xa3aa('0x9')],'defaultValue':0x0},'note':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 275bbb7..8c85ec0 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 _0x2b51=['set','Content-Range','json','apply','save','update','then','destroy','stack','name','send','index','map','VoiceQueueReport','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','order','sort','filter','where','type','VIRTUAL','merge','options','count','includeAll','include','findAll','rows','catch','params','find','create','body','describe','getVoiceQueuesReport','hasOwnProperty','nolimit','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','undefined','limit','offset'];(function(_0x52b155,_0x59d90f){var _0x47e348=function(_0x13211a){while(--_0x13211a){_0x52b155['push'](_0x52b155['shift']());}};_0x47e348(++_0x59d90f);}(_0x2b51,0x1d3));var _0x12b5=function(_0x4bae0e,_0x4b0f52){_0x4bae0e=_0x4bae0e-0x0;var _0x450e1f=_0x2b51[_0x4bae0e];return _0x450e1f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x12b5('0x0'));var zipdir=require(_0x12b5('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x12b5('0x2'));var moment=require(_0x12b5('0x3'));var BPromise=require(_0x12b5('0x4'));var Mustache=require('mustache');var util=require(_0x12b5('0x5'));var path=require(_0x12b5('0x6'));var sox=require(_0x12b5('0x7'));var csv=require(_0x12b5('0x8'));var ejs=require(_0x12b5('0x9'));var fs=require('fs');var fs_extra=require(_0x12b5('0xa'));var _=require(_0x12b5('0xb'));var squel=require(_0x12b5('0xc'));var crypto=require(_0x12b5('0xd'));var jsforce=require(_0x12b5('0xe'));var deskjs=require(_0x12b5('0xf'));var toCsv=require(_0x12b5('0x8'));var querystring=require(_0x12b5('0x10'));var Papa=require(_0x12b5('0x11'));var Redis=require(_0x12b5('0x12'));var authService=require(_0x12b5('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x12b5('0x14'));var logger=require(_0x12b5('0x15'))(_0x12b5('0x16'));var utils=require('../../config/utils');var config=require(_0x12b5('0x17'));var licenseUtil=require(_0x12b5('0x18'));var db=require(_0x12b5('0x19'))['db'];config[_0x12b5('0x1a')]=_[_0x12b5('0x1b')](config[_0x12b5('0x1a')],{'host':_0x12b5('0x1c'),'port':0x18eb});var socket=require(_0x12b5('0x1d'))(new Redis(config[_0x12b5('0x1a')]));require('./voiceQueueReport.socket')[_0x12b5('0x1e')](socket);function respondWithStatusCode(_0x5c5185,_0x4602cf){_0x4602cf=_0x4602cf||0xcc;return function(_0x2f1ac5){if(_0x2f1ac5){return _0x5c5185[_0x12b5('0x1f')](_0x4602cf);}return _0x5c5185[_0x12b5('0x20')](_0x4602cf)[_0x12b5('0x21')]();};}function respondWithResult(_0x2f6612,_0x4463bd){_0x4463bd=_0x4463bd||0xc8;return function(_0x58b68c){if(_0x58b68c){return _0x2f6612['status'](_0x4463bd)['json'](_0x58b68c);}};}function respondWithFilteredResult(_0x33957d,_0x355b0c){return function(_0x5ce452){if(_0x5ce452){var _0xe50d2b=typeof _0x355b0c['offset']===_0x12b5('0x22')&&typeof _0x355b0c[_0x12b5('0x23')]===_0x12b5('0x22');var _0x3f6b02=_0x5ce452['count'];var _0x320dda=_0xe50d2b?0x0:_0x355b0c[_0x12b5('0x24')];var _0x1790af=_0xe50d2b?_0x5ce452['count']:_0x355b0c['offset']+_0x355b0c[_0x12b5('0x23')];var _0x37e74a;if(_0x1790af>=_0x3f6b02){_0x1790af=_0x3f6b02;_0x37e74a=0xc8;}else{_0x37e74a=0xce;}_0x33957d[_0x12b5('0x20')](_0x37e74a);return _0x33957d[_0x12b5('0x25')](_0x12b5('0x26'),_0x320dda+'-'+_0x1790af+'/'+_0x3f6b02)[_0x12b5('0x27')](_0x5ce452);}return null;};}function patchUpdates(_0x455c68){return function(_0x40908b){try{jsonpatch[_0x12b5('0x28')](_0x40908b,_0x455c68,!![]);}catch(_0x449ddc){return BPromise['reject'](_0x449ddc);}return _0x40908b[_0x12b5('0x29')]();};}function saveUpdates(_0x4371be,_0x18b2f8){return function(_0x2e7e3e){if(_0x2e7e3e){return _0x2e7e3e[_0x12b5('0x2a')](_0x4371be)[_0x12b5('0x2b')](function(_0x1a2874){return _0x1a2874;});}return null;};}function removeEntity(_0x4e6f5a,_0x5b9e3d){return function(_0x2ac34a){if(_0x2ac34a){return _0x2ac34a[_0x12b5('0x2c')]()[_0x12b5('0x2b')](function(){_0x4e6f5a[_0x12b5('0x20')](0xcc)[_0x12b5('0x21')]();});}};}function handleEntityNotFound(_0x1ab522,_0x1393a2){return function(_0x320f13){if(!_0x320f13){_0x1ab522[_0x12b5('0x1f')](0x194);}return _0x320f13;};}function handleError(_0x302ebb,_0x197550){_0x197550=_0x197550||0x1f4;return function(_0x3935b0){logger['error'](_0x3935b0[_0x12b5('0x2d')]);if(_0x3935b0['name']){delete _0x3935b0[_0x12b5('0x2e')];}_0x302ebb[_0x12b5('0x20')](_0x197550)[_0x12b5('0x2f')](_0x3935b0);};}exports[_0x12b5('0x30')]=function(_0x324b23,_0x5dbb3a){var _0x43671c={},_0x4110be={},_0x5ec4f0={'count':0x0,'rows':[]};var _0x45c322=_[_0x12b5('0x31')](db[_0x12b5('0x32')][_0x12b5('0x33')],function(_0x4f0090){return{'name':_0x4f0090[_0x12b5('0x34')],'type':_0x4f0090['type'][_0x12b5('0x35')]};});_0x4110be['model']=_['map'](_0x45c322,_0x12b5('0x2e'));_0x4110be[_0x12b5('0x36')]=_[_0x12b5('0x37')](_0x324b23[_0x12b5('0x36')]);_0x4110be[_0x12b5('0x38')]=_[_0x12b5('0x39')](_0x4110be[_0x12b5('0x3a')],_0x4110be[_0x12b5('0x36')]);_0x43671c[_0x12b5('0x3b')]=_[_0x12b5('0x39')](_0x4110be[_0x12b5('0x3a')],qs[_0x12b5('0x3c')](_0x324b23[_0x12b5('0x36')]['fields']));_0x43671c[_0x12b5('0x3b')]=_0x43671c[_0x12b5('0x3b')][_0x12b5('0x3d')]?_0x43671c[_0x12b5('0x3b')]:_0x4110be[_0x12b5('0x3a')];if(!_0x324b23[_0x12b5('0x36')]['hasOwnProperty']('nolimit')){_0x43671c[_0x12b5('0x23')]=qs['limit'](_0x324b23[_0x12b5('0x36')]['limit']);_0x43671c[_0x12b5('0x24')]=qs[_0x12b5('0x24')](_0x324b23[_0x12b5('0x36')][_0x12b5('0x24')]);}_0x43671c[_0x12b5('0x3e')]=qs[_0x12b5('0x3f')](_0x324b23[_0x12b5('0x36')][_0x12b5('0x3f')]);_0x43671c['where']=qs[_0x12b5('0x38')](_['pick'](_0x324b23[_0x12b5('0x36')],_0x4110be[_0x12b5('0x38')]),_0x45c322);if(_0x324b23[_0x12b5('0x36')][_0x12b5('0x40')]){_0x43671c[_0x12b5('0x41')]=_['merge'](_0x43671c[_0x12b5('0x41')],{'$or':_[_0x12b5('0x31')](_0x45c322,function(_0x38e602){if(_0x38e602[_0x12b5('0x42')]!==_0x12b5('0x43')){var _0x25dd65={};_0x25dd65[_0x38e602[_0x12b5('0x2e')]]={'$like':'%'+_0x324b23[_0x12b5('0x36')][_0x12b5('0x40')]+'%'};return _0x25dd65;}})});}_0x43671c=_[_0x12b5('0x44')]({},_0x43671c,_0x324b23[_0x12b5('0x45')]);var _0x30309a={'where':_0x43671c[_0x12b5('0x41')]};return db['VoiceQueueReport']['count'](_0x30309a)[_0x12b5('0x2b')](function(_0x47544d){_0x5ec4f0[_0x12b5('0x46')]=_0x47544d;if(_0x324b23[_0x12b5('0x36')][_0x12b5('0x47')]){_0x43671c[_0x12b5('0x48')]=[{'all':!![]}];}return db[_0x12b5('0x32')][_0x12b5('0x49')](_0x43671c);})['then'](function(_0x559b21){_0x5ec4f0[_0x12b5('0x4a')]=_0x559b21;return _0x5ec4f0;})[_0x12b5('0x2b')](respondWithFilteredResult(_0x5dbb3a,_0x43671c))[_0x12b5('0x4b')](handleError(_0x5dbb3a,null));};exports['show']=function(_0x2d4cee,_0x219265){var _0x15864a={'raw':![],'where':{'id':_0x2d4cee[_0x12b5('0x4c')]['id']}},_0x1a8b0a={};_0x1a8b0a['model']=_[_0x12b5('0x37')](db[_0x12b5('0x32')][_0x12b5('0x33')]);_0x1a8b0a['query']=_[_0x12b5('0x37')](_0x2d4cee[_0x12b5('0x36')]);_0x1a8b0a[_0x12b5('0x38')]=_[_0x12b5('0x39')](_0x1a8b0a[_0x12b5('0x3a')],_0x1a8b0a[_0x12b5('0x36')]);_0x15864a[_0x12b5('0x3b')]=_['intersection'](_0x1a8b0a[_0x12b5('0x3a')],qs[_0x12b5('0x3c')](_0x2d4cee[_0x12b5('0x36')][_0x12b5('0x3c')]));_0x15864a[_0x12b5('0x3b')]=_0x15864a[_0x12b5('0x3b')][_0x12b5('0x3d')]?_0x15864a[_0x12b5('0x3b')]:_0x1a8b0a[_0x12b5('0x3a')];if(_0x2d4cee['query']['includeAll']){_0x15864a['include']=[{'all':!![]}];}_0x15864a=_[_0x12b5('0x44')]({},_0x15864a,_0x2d4cee['options']);return db['VoiceQueueReport'][_0x12b5('0x4d')](_0x15864a)[_0x12b5('0x2b')](handleEntityNotFound(_0x219265,null))[_0x12b5('0x2b')](respondWithResult(_0x219265,null))['catch'](handleError(_0x219265,null));};exports['create']=function(_0xed0825,_0x3d1021){return db[_0x12b5('0x32')][_0x12b5('0x4e')](_0xed0825['body'],{})[_0x12b5('0x2b')](respondWithResult(_0x3d1021,0xc9))[_0x12b5('0x4b')](handleError(_0x3d1021,null));};exports[_0x12b5('0x2a')]=function(_0x1cca87,_0x4da699){if(_0x1cca87['body']['id']){delete _0x1cca87[_0x12b5('0x4f')]['id'];}return db[_0x12b5('0x32')][_0x12b5('0x4d')]({'where':{'id':_0x1cca87[_0x12b5('0x4c')]['id']}})[_0x12b5('0x2b')](handleEntityNotFound(_0x4da699,null))[_0x12b5('0x2b')](saveUpdates(_0x1cca87[_0x12b5('0x4f')],null))[_0x12b5('0x2b')](respondWithResult(_0x4da699,null))[_0x12b5('0x4b')](handleError(_0x4da699,null));};exports[_0x12b5('0x2c')]=function(_0x35feb0,_0x588286){return db[_0x12b5('0x32')]['find']({'where':{'id':_0x35feb0[_0x12b5('0x4c')]['id']}})[_0x12b5('0x2b')](handleEntityNotFound(_0x588286,null))[_0x12b5('0x2b')](removeEntity(_0x588286,null))[_0x12b5('0x4b')](handleError(_0x588286,null));};exports[_0x12b5('0x50')]=function(_0x546774,_0xe14632){return db[_0x12b5('0x32')]['describe']()['then'](respondWithResult(_0xe14632,null))[_0x12b5('0x4b')](handleError(_0xe14632,null));};exports[_0x12b5('0x51')]=function(_0x1b59a3,_0x10dad1){var _0x281dc9={},_0x3670d6={},_0x234f8f={'count':0x0,'rows':[]};_0x3670d6['model']=_[_0x12b5('0x37')](db[_0x12b5('0x32')]['rawAttributes']);_0x3670d6[_0x12b5('0x36')]=_[_0x12b5('0x37')](_0x1b59a3[_0x12b5('0x36')]);_0x3670d6[_0x12b5('0x38')]=_[_0x12b5('0x39')](_0x3670d6[_0x12b5('0x3a')],_0x3670d6[_0x12b5('0x36')]);_0x281dc9['attributes']=_['intersection'](_0x3670d6[_0x12b5('0x3a')],qs[_0x12b5('0x3c')](_0x1b59a3['query'][_0x12b5('0x3c')]));_0x281dc9[_0x12b5('0x3b')]=_0x281dc9['attributes'][_0x12b5('0x3d')]?_0x281dc9[_0x12b5('0x3b')]:_0x3670d6[_0x12b5('0x3a')];if(!_0x1b59a3[_0x12b5('0x36')][_0x12b5('0x52')](_0x12b5('0x53'))){_0x281dc9['limit']=qs[_0x12b5('0x23')](_0x1b59a3[_0x12b5('0x36')][_0x12b5('0x23')]);_0x281dc9[_0x12b5('0x24')]=qs['offset'](_0x1b59a3['query'][_0x12b5('0x24')]);}_0x281dc9['order']=qs[_0x12b5('0x3f')](_0x1b59a3[_0x12b5('0x36')][_0x12b5('0x3f')]);_0x281dc9['where']=qs[_0x12b5('0x38')](_['pick'](_0x1b59a3[_0x12b5('0x36')],_0x3670d6['filters']));if(_0x1b59a3['query'][_0x12b5('0x40')]){_0x281dc9[_0x12b5('0x41')]=_['merge'](_0x281dc9[_0x12b5('0x41')],{'$or':_[_0x12b5('0x31')](_0x281dc9[_0x12b5('0x3b')],function(_0x29e2c5){var _0x3792ac={};_0x3792ac[_0x29e2c5]={'$like':'%'+_0x1b59a3[_0x12b5('0x36')][_0x12b5('0x40')]+'%'};return _0x3792ac;})});}_0x281dc9=_[_0x12b5('0x44')]({},_0x281dc9,_0x1b59a3[_0x12b5('0x45')]);var _0x343d7f={'where':_0x281dc9[_0x12b5('0x41')]};return db[_0x12b5('0x32')][_0x12b5('0x46')](_0x343d7f)[_0x12b5('0x2b')](function(_0x302060){_0x234f8f[_0x12b5('0x46')]=_0x302060;if(_0x1b59a3[_0x12b5('0x36')]['includeAll']){_0x281dc9[_0x12b5('0x48')]=[{'all':!![]}];}return db['VoiceQueueReport']['findAll'](_0x281dc9);})[_0x12b5('0x2b')](function(_0x52333d){_0x234f8f['rows']=_0x52333d;return _0x234f8f;})[_0x12b5('0x2b')](respondWithFilteredResult(_0x10dad1,_0x281dc9,_0x12b5('0x51')))[_0x12b5('0x4b')](handleError(_0x10dad1,null,_0x12b5('0x51')));}; \ No newline at end of file +var _0x1a74=['catch','create','body','update','describe','getVoiceQueuesReport','eml-format','fast-json-patch','request-promise','mustache','path','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','count','limit','set','apply','reject','save','then','destroy','error','stack','name','send','index','map','VoiceQueueReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','include','findAll','rows','show','params','includeAll','find'];(function(_0x5074a5,_0x22081e){var _0x5e1dce=function(_0x3b1b4d){while(--_0x3b1b4d){_0x5074a5['push'](_0x5074a5['shift']());}};_0x5e1dce(++_0x22081e);}(_0x1a74,0x182));var _0x41a7=function(_0x3ac152,_0x1de6ec){_0x3ac152=_0x3ac152-0x0;var _0x49361f=_0x1a74[_0x3ac152];return _0x49361f;};'use strict';var emlformat=require(_0x41a7('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x41a7('0x1'));var rp=require(_0x41a7('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x41a7('0x3'));var util=require('util');var path=require(_0x41a7('0x4'));var sox=require('sox');var csv=require(_0x41a7('0x5'));var ejs=require(_0x41a7('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x41a7('0x7'));var crypto=require(_0x41a7('0x8'));var jsforce=require('jsforce');var deskjs=require(_0x41a7('0x9'));var toCsv=require(_0x41a7('0x5'));var querystring=require(_0x41a7('0xa'));var Papa=require(_0x41a7('0xb'));var Redis=require(_0x41a7('0xc'));var authService=require(_0x41a7('0xd'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x41a7('0xe'));var utils=require(_0x41a7('0xf'));var config=require(_0x41a7('0x10'));var licenseUtil=require('../../config/license/util');var db=require(_0x41a7('0x11'))['db'];config[_0x41a7('0x12')]=_[_0x41a7('0x13')](config[_0x41a7('0x12')],{'host':_0x41a7('0x14'),'port':0x18eb});var socket=require(_0x41a7('0x15'))(new Redis(config[_0x41a7('0x12')]));require('./voiceQueueReport.socket')[_0x41a7('0x16')](socket);function respondWithStatusCode(_0x28ad14,_0x4f95dc){_0x4f95dc=_0x4f95dc||0xcc;return function(_0x331f5c){if(_0x331f5c){return _0x28ad14[_0x41a7('0x17')](_0x4f95dc);}return _0x28ad14[_0x41a7('0x18')](_0x4f95dc)[_0x41a7('0x19')]();};}function respondWithResult(_0x1070fe,_0x29239a){_0x29239a=_0x29239a||0xc8;return function(_0x49602b){if(_0x49602b){return _0x1070fe['status'](_0x29239a)[_0x41a7('0x1a')](_0x49602b);}};}function respondWithFilteredResult(_0x17a3c9,_0x4d1f94){return function(_0x5e640e){if(_0x5e640e){var _0x342c22=typeof _0x4d1f94[_0x41a7('0x1b')]==='undefined'&&typeof _0x4d1f94['limit']==='undefined';var _0x1ff696=_0x5e640e[_0x41a7('0x1c')];var _0x10babe=_0x342c22?0x0:_0x4d1f94['offset'];var _0x4581b9=_0x342c22?_0x5e640e['count']:_0x4d1f94[_0x41a7('0x1b')]+_0x4d1f94[_0x41a7('0x1d')];var _0x570593;if(_0x4581b9>=_0x1ff696){_0x4581b9=_0x1ff696;_0x570593=0xc8;}else{_0x570593=0xce;}_0x17a3c9[_0x41a7('0x18')](_0x570593);return _0x17a3c9[_0x41a7('0x1e')]('Content-Range',_0x10babe+'-'+_0x4581b9+'/'+_0x1ff696)['json'](_0x5e640e);}return null;};}function patchUpdates(_0x2b0849){return function(_0x525dc9){try{jsonpatch[_0x41a7('0x1f')](_0x525dc9,_0x2b0849,!![]);}catch(_0xb014f8){return BPromise[_0x41a7('0x20')](_0xb014f8);}return _0x525dc9[_0x41a7('0x21')]();};}function saveUpdates(_0x36cdd6,_0x47cd95){return function(_0x185d0d){if(_0x185d0d){return _0x185d0d['update'](_0x36cdd6)[_0x41a7('0x22')](function(_0x259f9c){return _0x259f9c;});}return null;};}function removeEntity(_0x395697,_0x1418aa){return function(_0x347c2){if(_0x347c2){return _0x347c2[_0x41a7('0x23')]()[_0x41a7('0x22')](function(){_0x395697[_0x41a7('0x18')](0xcc)[_0x41a7('0x19')]();});}};}function handleEntityNotFound(_0x400577,_0x4e2e43){return function(_0xb2f524){if(!_0xb2f524){_0x400577[_0x41a7('0x17')](0x194);}return _0xb2f524;};}function handleError(_0x578814,_0x211adc){_0x211adc=_0x211adc||0x1f4;return function(_0x4ecff6){logger[_0x41a7('0x24')](_0x4ecff6[_0x41a7('0x25')]);if(_0x4ecff6['name']){delete _0x4ecff6[_0x41a7('0x26')];}_0x578814[_0x41a7('0x18')](_0x211adc)[_0x41a7('0x27')](_0x4ecff6);};}exports[_0x41a7('0x28')]=function(_0x596f60,_0x55ccfc){var _0x256602={},_0x35219e={},_0x2bf044={'count':0x0,'rows':[]};var _0x754924=_[_0x41a7('0x29')](db[_0x41a7('0x2a')][_0x41a7('0x2b')],function(_0x254b4f){return{'name':_0x254b4f[_0x41a7('0x2c')],'type':_0x254b4f[_0x41a7('0x2d')][_0x41a7('0x2e')]};});_0x35219e[_0x41a7('0x2f')]=_[_0x41a7('0x29')](_0x754924,_0x41a7('0x26'));_0x35219e['query']=_[_0x41a7('0x30')](_0x596f60[_0x41a7('0x31')]);_0x35219e[_0x41a7('0x32')]=_[_0x41a7('0x33')](_0x35219e[_0x41a7('0x2f')],_0x35219e[_0x41a7('0x31')]);_0x256602[_0x41a7('0x34')]=_['intersection'](_0x35219e[_0x41a7('0x2f')],qs[_0x41a7('0x35')](_0x596f60[_0x41a7('0x31')][_0x41a7('0x35')]));_0x256602[_0x41a7('0x34')]=_0x256602['attributes'][_0x41a7('0x36')]?_0x256602[_0x41a7('0x34')]:_0x35219e['model'];if(!_0x596f60['query'][_0x41a7('0x37')](_0x41a7('0x38'))){_0x256602[_0x41a7('0x1d')]=qs[_0x41a7('0x1d')](_0x596f60[_0x41a7('0x31')][_0x41a7('0x1d')]);_0x256602['offset']=qs[_0x41a7('0x1b')](_0x596f60['query'][_0x41a7('0x1b')]);}_0x256602['order']=qs[_0x41a7('0x39')](_0x596f60[_0x41a7('0x31')][_0x41a7('0x39')]);_0x256602[_0x41a7('0x3a')]=qs[_0x41a7('0x32')](_[_0x41a7('0x3b')](_0x596f60[_0x41a7('0x31')],_0x35219e[_0x41a7('0x32')]),_0x754924);if(_0x596f60[_0x41a7('0x31')]['filter']){_0x256602[_0x41a7('0x3a')]=_['merge'](_0x256602[_0x41a7('0x3a')],{'$or':_[_0x41a7('0x29')](_0x754924,function(_0x26c253){if(_0x26c253[_0x41a7('0x2d')]!=='VIRTUAL'){var _0xe9f4e9={};_0xe9f4e9[_0x26c253[_0x41a7('0x26')]]={'$like':'%'+_0x596f60['query'][_0x41a7('0x3c')]+'%'};return _0xe9f4e9;}})});}_0x256602=_[_0x41a7('0x3d')]({},_0x256602,_0x596f60[_0x41a7('0x3e')]);var _0x4099f8={'where':_0x256602[_0x41a7('0x3a')]};return db[_0x41a7('0x2a')][_0x41a7('0x1c')](_0x4099f8)[_0x41a7('0x22')](function(_0xc1fa3){_0x2bf044[_0x41a7('0x1c')]=_0xc1fa3;if(_0x596f60[_0x41a7('0x31')]['includeAll']){_0x256602[_0x41a7('0x3f')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0x41a7('0x40')](_0x256602);})[_0x41a7('0x22')](function(_0x2d61b4){_0x2bf044[_0x41a7('0x41')]=_0x2d61b4;return _0x2bf044;})['then'](respondWithFilteredResult(_0x55ccfc,_0x256602))['catch'](handleError(_0x55ccfc,null));};exports[_0x41a7('0x42')]=function(_0x3325fc,_0x21647e){var _0x59fa05={'raw':![],'where':{'id':_0x3325fc[_0x41a7('0x43')]['id']}},_0x4fbde3={};_0x4fbde3['model']=_[_0x41a7('0x30')](db[_0x41a7('0x2a')][_0x41a7('0x2b')]);_0x4fbde3['query']=_[_0x41a7('0x30')](_0x3325fc[_0x41a7('0x31')]);_0x4fbde3[_0x41a7('0x32')]=_[_0x41a7('0x33')](_0x4fbde3[_0x41a7('0x2f')],_0x4fbde3[_0x41a7('0x31')]);_0x59fa05[_0x41a7('0x34')]=_[_0x41a7('0x33')](_0x4fbde3['model'],qs[_0x41a7('0x35')](_0x3325fc[_0x41a7('0x31')][_0x41a7('0x35')]));_0x59fa05['attributes']=_0x59fa05['attributes'][_0x41a7('0x36')]?_0x59fa05[_0x41a7('0x34')]:_0x4fbde3[_0x41a7('0x2f')];if(_0x3325fc['query'][_0x41a7('0x44')]){_0x59fa05[_0x41a7('0x3f')]=[{'all':!![]}];}_0x59fa05=_[_0x41a7('0x3d')]({},_0x59fa05,_0x3325fc[_0x41a7('0x3e')]);return db[_0x41a7('0x2a')][_0x41a7('0x45')](_0x59fa05)['then'](handleEntityNotFound(_0x21647e,null))[_0x41a7('0x22')](respondWithResult(_0x21647e,null))[_0x41a7('0x46')](handleError(_0x21647e,null));};exports[_0x41a7('0x47')]=function(_0x2dae57,_0x19b9ce){return db['VoiceQueueReport']['create'](_0x2dae57[_0x41a7('0x48')],{})['then'](respondWithResult(_0x19b9ce,0xc9))[_0x41a7('0x46')](handleError(_0x19b9ce,null));};exports[_0x41a7('0x49')]=function(_0x210a05,_0x5d4f96){if(_0x210a05['body']['id']){delete _0x210a05[_0x41a7('0x48')]['id'];}return db[_0x41a7('0x2a')]['find']({'where':{'id':_0x210a05[_0x41a7('0x43')]['id']}})[_0x41a7('0x22')](handleEntityNotFound(_0x5d4f96,null))['then'](saveUpdates(_0x210a05[_0x41a7('0x48')],null))[_0x41a7('0x22')](respondWithResult(_0x5d4f96,null))[_0x41a7('0x46')](handleError(_0x5d4f96,null));};exports[_0x41a7('0x23')]=function(_0x26e0c1,_0x119c3a){return db[_0x41a7('0x2a')][_0x41a7('0x45')]({'where':{'id':_0x26e0c1['params']['id']}})[_0x41a7('0x22')](handleEntityNotFound(_0x119c3a,null))[_0x41a7('0x22')](removeEntity(_0x119c3a,null))[_0x41a7('0x46')](handleError(_0x119c3a,null));};exports[_0x41a7('0x4a')]=function(_0x22a251,_0x2b8d0e){return db[_0x41a7('0x2a')][_0x41a7('0x4a')]()[_0x41a7('0x22')](respondWithResult(_0x2b8d0e,null))[_0x41a7('0x46')](handleError(_0x2b8d0e,null));};exports['getVoiceQueuesReport']=function(_0x3556f0,_0x4157e1){var _0x92ca86={},_0x46bb34={},_0x301295={'count':0x0,'rows':[]};_0x46bb34['model']=_[_0x41a7('0x30')](db[_0x41a7('0x2a')]['rawAttributes']);_0x46bb34[_0x41a7('0x31')]=_['keys'](_0x3556f0['query']);_0x46bb34[_0x41a7('0x32')]=_['intersection'](_0x46bb34['model'],_0x46bb34[_0x41a7('0x31')]);_0x92ca86[_0x41a7('0x34')]=_[_0x41a7('0x33')](_0x46bb34[_0x41a7('0x2f')],qs[_0x41a7('0x35')](_0x3556f0[_0x41a7('0x31')][_0x41a7('0x35')]));_0x92ca86[_0x41a7('0x34')]=_0x92ca86[_0x41a7('0x34')][_0x41a7('0x36')]?_0x92ca86[_0x41a7('0x34')]:_0x46bb34[_0x41a7('0x2f')];if(!_0x3556f0['query'][_0x41a7('0x37')](_0x41a7('0x38'))){_0x92ca86[_0x41a7('0x1d')]=qs[_0x41a7('0x1d')](_0x3556f0[_0x41a7('0x31')][_0x41a7('0x1d')]);_0x92ca86[_0x41a7('0x1b')]=qs[_0x41a7('0x1b')](_0x3556f0[_0x41a7('0x31')]['offset']);}_0x92ca86['order']=qs[_0x41a7('0x39')](_0x3556f0[_0x41a7('0x31')]['sort']);_0x92ca86[_0x41a7('0x3a')]=qs['filters'](_[_0x41a7('0x3b')](_0x3556f0[_0x41a7('0x31')],_0x46bb34['filters']));if(_0x3556f0[_0x41a7('0x31')][_0x41a7('0x3c')]){_0x92ca86['where']=_[_0x41a7('0x3d')](_0x92ca86[_0x41a7('0x3a')],{'$or':_[_0x41a7('0x29')](_0x92ca86['attributes'],function(_0x403329){var _0x58eb02={};_0x58eb02[_0x403329]={'$like':'%'+_0x3556f0[_0x41a7('0x31')][_0x41a7('0x3c')]+'%'};return _0x58eb02;})});}_0x92ca86=_[_0x41a7('0x3d')]({},_0x92ca86,_0x3556f0['options']);var _0x364d0d={'where':_0x92ca86[_0x41a7('0x3a')]};return db[_0x41a7('0x2a')][_0x41a7('0x1c')](_0x364d0d)[_0x41a7('0x22')](function(_0x376438){_0x301295['count']=_0x376438;if(_0x3556f0[_0x41a7('0x31')][_0x41a7('0x44')]){_0x92ca86[_0x41a7('0x3f')]=[{'all':!![]}];}return db['VoiceQueueReport']['findAll'](_0x92ca86);})[_0x41a7('0x22')](function(_0x2ef5ed){_0x301295[_0x41a7('0x41')]=_0x2ef5ed;return _0x301295;})[_0x41a7('0x22')](respondWithFilteredResult(_0x4157e1,_0x92ca86,_0x41a7('0x4b')))[_0x41a7('0x46')](handleError(_0x4157e1,null,_0x41a7('0x4b')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 5f787bb..d4123b6 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 _0x6f4c=['save','update','remove','hasOwnProperty','hook','events','../../mysqldb','VoiceQueueReport','setMaxListeners'];(function(_0x5c47d6,_0x52cc9e){var _0x17eb3a=function(_0x164930){while(--_0x164930){_0x5c47d6['push'](_0x5c47d6['shift']());}};_0x17eb3a(++_0x52cc9e);}(_0x6f4c,0x10a));var _0xc6f4=function(_0x2178ec,_0x1f4c66){_0x2178ec=_0x2178ec-0x0;var _0x117c34=_0x6f4c[_0x2178ec];return _0x117c34;};'use strict';var EventEmitter=require(_0xc6f4('0x0'));var VoiceQueueReport=require(_0xc6f4('0x1'))['db'][_0xc6f4('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xc6f4('0x3')](0x0);var events={'afterCreate':_0xc6f4('0x4'),'afterUpdate':_0xc6f4('0x5'),'afterDestroy':_0xc6f4('0x6')};function emitEvent(_0x8f95df){return function(_0x2ec78a,_0x1c9ac4,_0x49d897){VoiceQueueReportEvents['emit'](_0x8f95df+':'+_0x2ec78a['id'],_0x2ec78a);VoiceQueueReportEvents['emit'](_0x8f95df,_0x2ec78a);_0x49d897(null);};}for(var e in events){if(events[_0xc6f4('0x7')](e)){var event=events[e];VoiceQueueReport[_0xc6f4('0x8')](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file +var _0x9f38=['hasOwnProperty','hook','exports','VoiceQueueReport','setMaxListeners','save','remove','emit'];(function(_0x39d767,_0xdfe6cd){var _0x69feca=function(_0x1e5316){while(--_0x1e5316){_0x39d767['push'](_0x39d767['shift']());}};_0x69feca(++_0xdfe6cd);}(_0x9f38,0x153));var _0x89f3=function(_0x18c2c6,_0x88ecb7){_0x18c2c6=_0x18c2c6-0x0;var _0x497ad4=_0x9f38[_0x18c2c6];return _0x497ad4;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require('../../mysqldb')['db'][_0x89f3('0x0')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x89f3('0x1')](0x0);var events={'afterCreate':_0x89f3('0x2'),'afterUpdate':'update','afterDestroy':_0x89f3('0x3')};function emitEvent(_0x5c662d){return function(_0x54098c,_0x42ecf8,_0x4b20ef){VoiceQueueReportEvents[_0x89f3('0x4')](_0x5c662d+':'+_0x54098c['id'],_0x54098c);VoiceQueueReportEvents[_0x89f3('0x4')](_0x5c662d,_0x54098c);_0x4b20ef(null);};}for(var e in events){if(events[_0x89f3('0x5')](e)){var event=events[e];VoiceQueueReport[_0x89f3('0x6')](e,emitEvent(event));}}module[_0x89f3('0x7')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index f388c54..9259de6 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 _0xfbce=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./voiceQueueReport.attributes','VoiceQueueReport','report_queue','calleridnum','lodash'];(function(_0x3fa9b5,_0x288393){var _0xaa38b=function(_0x3cf094){while(--_0x3cf094){_0x3fa9b5['push'](_0x3fa9b5['shift']());}};_0xaa38b(++_0x288393);}(_0xfbce,0x1a3));var _0xefbc=function(_0x283ef3,_0x136ad1){_0x283ef3=_0x283ef3-0x0;var _0x1d4c24=_0xfbce[_0x283ef3];return _0x1d4c24;};'use strict';var _=require(_0xefbc('0x0'));var util=require(_0xefbc('0x1'));var logger=require(_0xefbc('0x2'))(_0xefbc('0x3'));var moment=require(_0xefbc('0x4'));var BPromise=require(_0xefbc('0x5'));var rp=require(_0xefbc('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xefbc('0x7'));var config=require('../../config/environment');var attributes=require(_0xefbc('0x8'));module['exports']=function(_0x156666,_0x590379){return _0x156666['define'](_0xefbc('0x9'),attributes,{'tableName':_0xefbc('0xa'),'paranoid':![],'indexes':[{'fields':['uniqueid']},{'fields':[_0xefbc('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x06e4=['util','moment','request-promise','path','../../config/environment','./voiceQueueReport.attributes','exports','define','report_queue','uniqueid','calleridnum'];(function(_0x41412f,_0x225259){var _0x4a553a=function(_0x17fee2){while(--_0x17fee2){_0x41412f['push'](_0x41412f['shift']());}};_0x4a553a(++_0x225259);}(_0x06e4,0x1ef));var _0x406e=function(_0x45fe9c,_0x55e0d7){_0x45fe9c=_0x45fe9c-0x0;var _0x233d48=_0x06e4[_0x45fe9c];return _0x233d48;};'use strict';var _=require('lodash');var util=require(_0x406e('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x406e('0x1'));var BPromise=require('bluebird');var rp=require(_0x406e('0x2'));var fs=require('fs');var path=require(_0x406e('0x3'));var rimraf=require('rimraf');var config=require(_0x406e('0x4'));var attributes=require(_0x406e('0x5'));module[_0x406e('0x6')]=function(_0x3b4197,_0x53fc17){return _0x3b4197[_0x406e('0x7')]('VoiceQueueReport',attributes,{'tableName':_0x406e('0x8'),'paranoid':![],'indexes':[{'fields':[_0x406e('0x9')]},{'fields':[_0x406e('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index a6c6bf1..913659a 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 _0xe228=['../../config/environment','jayson/promise','defaults','redis','localhost','socket.io-emitter','request','info','VoiceQueueReport,\x20%s,\x20%s','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','where','limit','include','map','model','attributes','then','CreateVoiceQueueReport','create','body','raw','UpdateVoiceQueueReport','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0xe228,0xf4));var _0x8e22=function(_0x4fc60d,_0x1e801c){_0x4fc60d=_0x4fc60d-0x0;var _0x500740=_0xe228[_0x4fc60d];return _0x500740;};'use strict';var _=require(_0x8e22('0x0'));var util=require(_0x8e22('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8e22('0x2'));var fs=require('fs');var Redis=require(_0x8e22('0x3'));var db=require(_0x8e22('0x4'))['db'];var utils=require(_0x8e22('0x5'));var logger=require(_0x8e22('0x6'))(_0x8e22('0x7'));var config=require(_0x8e22('0x8'));var jayson=require(_0x8e22('0x9'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x8e22('0xa')](config[_0x8e22('0xb')],{'host':_0x8e22('0xc'),'port':0x18eb});var socket=require(_0x8e22('0xd'))(new Redis(config[_0x8e22('0xb')]));require('./voiceQueueReport.socket')['register'](socket);function respondWithRpcPromise(_0x581b6c,_0x13ffe6,_0x5a1a3d){return new BPromise(function(_0x24bd17,_0x12dfc3){return client[_0x8e22('0xe')](_0x581b6c,_0x5a1a3d)['then'](function(_0x380ad4){logger[_0x8e22('0xf')](_0x8e22('0x10'),_0x13ffe6,'request\x20sent');logger[_0x8e22('0x11')](_0x8e22('0x12'),_0x13ffe6,_0x8e22('0x13'),JSON[_0x8e22('0x14')](_0x380ad4));if(_0x380ad4[_0x8e22('0x15')]){if(_0x380ad4[_0x8e22('0x15')][_0x8e22('0x16')]===0x1f4){logger[_0x8e22('0x15')](_0x8e22('0x10'),_0x13ffe6,_0x380ad4[_0x8e22('0x15')][_0x8e22('0x17')]);return _0x12dfc3(_0x380ad4['error'][_0x8e22('0x17')]);}logger['error'](_0x8e22('0x10'),_0x13ffe6,_0x380ad4[_0x8e22('0x15')][_0x8e22('0x17')]);return _0x24bd17(_0x380ad4['error'][_0x8e22('0x17')]);}else{logger[_0x8e22('0xf')]('VoiceQueueReport,\x20%s,\x20%s',_0x13ffe6,_0x8e22('0x13'));_0x24bd17(_0x380ad4[_0x8e22('0x18')]['message']);}})[_0x8e22('0x19')](function(_0x29f444){logger[_0x8e22('0x15')]('VoiceQueueReport,\x20%s,\x20%s',_0x13ffe6,_0x29f444);_0x12dfc3(_0x29f444);});});}exports[_0x8e22('0x1a')]=function(_0x3b3c7d){var _0x14540b=this;return new Promise(function(_0x26ecaf,_0x393bab){return db[_0x8e22('0x1b')][_0x8e22('0x1c')]({'raw':_0x3b3c7d[_0x8e22('0x1d')]?_0x3b3c7d['options']['raw']===undefined?!![]:![]:!![],'where':_0x3b3c7d['options']?_0x3b3c7d[_0x8e22('0x1d')][_0x8e22('0x1e')]||null:null,'attributes':_0x3b3c7d[_0x8e22('0x1d')]?_0x3b3c7d['options']['attributes']||null:null,'limit':_0x3b3c7d[_0x8e22('0x1d')]?_0x3b3c7d[_0x8e22('0x1d')][_0x8e22('0x1f')]||null:null,'include':_0x3b3c7d[_0x8e22('0x1d')]?_0x3b3c7d[_0x8e22('0x1d')][_0x8e22('0x20')]?_[_0x8e22('0x21')](_0x3b3c7d[_0x8e22('0x1d')][_0x8e22('0x20')],function(_0x3c915f){return{'model':db[_0x3c915f[_0x8e22('0x22')]],'as':_0x3c915f['as'],'attributes':_0x3c915f[_0x8e22('0x23')],'include':_0x3c915f[_0x8e22('0x20')]?_['map'](_0x3c915f[_0x8e22('0x20')],function(_0x3be28b){return{'model':db[_0x3be28b[_0x8e22('0x22')]],'as':_0x3be28b['as'],'attributes':_0x3be28b[_0x8e22('0x23')],'include':_0x3be28b[_0x8e22('0x20')]?_[_0x8e22('0x21')](_0x3be28b[_0x8e22('0x20')],function(_0x4f7c53){return{'model':db[_0x4f7c53[_0x8e22('0x22')]],'as':_0x4f7c53['as'],'attributes':_0x4f7c53['attributes']};}):[]};}):[]};}):[]:[]})[_0x8e22('0x24')](function(_0x3f2a49){logger[_0x8e22('0xf')](_0x8e22('0x1a'),_0x3b3c7d);logger[_0x8e22('0x11')](_0x8e22('0x1a'),_0x3b3c7d,JSON[_0x8e22('0x14')](_0x3f2a49));_0x26ecaf(_0x3f2a49);})[_0x8e22('0x19')](function(_0x3be217){logger[_0x8e22('0x15')](_0x8e22('0x1a'),_0x3be217['message'],_0x3b3c7d);_0x393bab(_0x14540b[_0x8e22('0x15')](0x1f4,_0x3be217['message']));});});};exports[_0x8e22('0x25')]=function(_0x5239fb){var _0x4213ca=this;return new Promise(function(_0x53add6,_0x223c60){return db[_0x8e22('0x1b')][_0x8e22('0x26')](_0x5239fb[_0x8e22('0x27')],{'raw':_0x5239fb[_0x8e22('0x1d')]?_0x5239fb['options'][_0x8e22('0x28')]===undefined?!![]:![]:!![]})[_0x8e22('0x24')](function(_0x41d2ee){logger[_0x8e22('0xf')](_0x8e22('0x25'),_0x5239fb);logger[_0x8e22('0x11')]('CreateVoiceQueueReport',_0x5239fb,JSON['stringify'](_0x41d2ee));_0x53add6(_0x41d2ee);})[_0x8e22('0x19')](function(_0x307156){logger[_0x8e22('0x15')]('CreateVoiceQueueReport',_0x307156[_0x8e22('0x17')],_0x5239fb);_0x223c60(_0x4213ca[_0x8e22('0x15')](0x1f4,_0x307156[_0x8e22('0x17')]));});});};exports['UpdateVoiceQueueReport']=function(_0x3b9699){var _0x572a3d=this;return new Promise(function(_0x2a4480,_0x2f815c){return db[_0x8e22('0x1b')]['update'](_0x3b9699['body'],{'raw':_0x3b9699[_0x8e22('0x1d')]?_0x3b9699[_0x8e22('0x1d')][_0x8e22('0x28')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3b9699[_0x8e22('0x1d')]?_0x3b9699['options']['where']||null:null,'attributes':_0x3b9699['options']?_0x3b9699[_0x8e22('0x1d')]['attributes']||null:null,'limit':_0x3b9699[_0x8e22('0x1d')]?_0x3b9699['options'][_0x8e22('0x1f')]||null:null})[_0x8e22('0x24')](function(_0x4b7b75){logger[_0x8e22('0xf')](_0x8e22('0x29'),_0x3b9699);logger[_0x8e22('0x11')](_0x8e22('0x29'),_0x3b9699,JSON['stringify'](_0x4b7b75));_0x2a4480(_0x4b7b75);})['catch'](function(_0x334836){logger[_0x8e22('0x15')]('UpdateVoiceQueueReport',_0x334836[_0x8e22('0x17')],_0x3b9699);_0x2f815c(_0x572a3d[_0x8e22('0x15')](0x1f4,_0x334836['message']));});});}; \ No newline at end of file +var _0x0c09=['include','model','map','GetVoiceQueueReport','CreateVoiceQueueReport','create','body','stringify','UpdateVoiceQueueReport','update','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','defaults','localhost','socket.io-emitter','redis','./voiceQueueReport.socket','register','request','then','info','VoiceQueueReport,\x20%s,\x20%s','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','catch','VoiceQueueReport','findAll','options','raw','where','attributes','limit'];(function(_0x5e3593,_0x4888a7){var _0x513e9d=function(_0x3e44a2){while(--_0x3e44a2){_0x5e3593['push'](_0x5e3593['shift']());}};_0x513e9d(++_0x4888a7);}(_0x0c09,0x10c));var _0x90c0=function(_0x10edba,_0x478726){_0x10edba=_0x10edba-0x0;var _0xd9c093=_0x0c09[_0x10edba];return _0xd9c093;};'use strict';var _=require('lodash');var util=require(_0x90c0('0x0'));var moment=require('moment');var BPromise=require(_0x90c0('0x1'));var rs=require(_0x90c0('0x2'));var fs=require('fs');var Redis=require(_0x90c0('0x3'));var db=require(_0x90c0('0x4'))['db'];var utils=require(_0x90c0('0x5'));var logger=require('../../config/logger')(_0x90c0('0x6'));var config=require(_0x90c0('0x7'));var jayson=require(_0x90c0('0x8'));var client=jayson['client'][_0x90c0('0x9')]({'port':0x232a});config['redis']=_[_0x90c0('0xa')](config['redis'],{'host':_0x90c0('0xb'),'port':0x18eb});var socket=require(_0x90c0('0xc'))(new Redis(config[_0x90c0('0xd')]));require(_0x90c0('0xe'))[_0x90c0('0xf')](socket);function respondWithRpcPromise(_0x1fa993,_0x25721b,_0x47353e){return new BPromise(function(_0xd842ac,_0x1d66b7){return client[_0x90c0('0x10')](_0x1fa993,_0x47353e)[_0x90c0('0x11')](function(_0x4ae6b7){logger[_0x90c0('0x12')](_0x90c0('0x13'),_0x25721b,'request\x20sent');logger[_0x90c0('0x14')](_0x90c0('0x15'),_0x25721b,_0x90c0('0x16'),JSON['stringify'](_0x4ae6b7));if(_0x4ae6b7[_0x90c0('0x17')]){if(_0x4ae6b7[_0x90c0('0x17')]['code']===0x1f4){logger[_0x90c0('0x17')](_0x90c0('0x13'),_0x25721b,_0x4ae6b7['error']['message']);return _0x1d66b7(_0x4ae6b7[_0x90c0('0x17')][_0x90c0('0x18')]);}logger[_0x90c0('0x17')]('VoiceQueueReport,\x20%s,\x20%s',_0x25721b,_0x4ae6b7[_0x90c0('0x17')][_0x90c0('0x18')]);return _0xd842ac(_0x4ae6b7[_0x90c0('0x17')][_0x90c0('0x18')]);}else{logger[_0x90c0('0x12')]('VoiceQueueReport,\x20%s,\x20%s',_0x25721b,'request\x20sent');_0xd842ac(_0x4ae6b7['result'][_0x90c0('0x18')]);}})[_0x90c0('0x19')](function(_0x1c39a9){logger[_0x90c0('0x17')](_0x90c0('0x13'),_0x25721b,_0x1c39a9);_0x1d66b7(_0x1c39a9);});});}exports['GetVoiceQueueReport']=function(_0x4654d5){var _0x5bb2b4=this;return new Promise(function(_0x1e6130,_0x11a3a0){return db[_0x90c0('0x1a')][_0x90c0('0x1b')]({'raw':_0x4654d5[_0x90c0('0x1c')]?_0x4654d5[_0x90c0('0x1c')][_0x90c0('0x1d')]===undefined?!![]:![]:!![],'where':_0x4654d5['options']?_0x4654d5[_0x90c0('0x1c')][_0x90c0('0x1e')]||null:null,'attributes':_0x4654d5['options']?_0x4654d5[_0x90c0('0x1c')][_0x90c0('0x1f')]||null:null,'limit':_0x4654d5[_0x90c0('0x1c')]?_0x4654d5[_0x90c0('0x1c')][_0x90c0('0x20')]||null:null,'include':_0x4654d5[_0x90c0('0x1c')]?_0x4654d5[_0x90c0('0x1c')][_0x90c0('0x21')]?_['map'](_0x4654d5[_0x90c0('0x1c')]['include'],function(_0x39ee24){return{'model':db[_0x39ee24[_0x90c0('0x22')]],'as':_0x39ee24['as'],'attributes':_0x39ee24[_0x90c0('0x1f')],'include':_0x39ee24[_0x90c0('0x21')]?_['map'](_0x39ee24[_0x90c0('0x21')],function(_0x9e8060){return{'model':db[_0x9e8060[_0x90c0('0x22')]],'as':_0x9e8060['as'],'attributes':_0x9e8060[_0x90c0('0x1f')],'include':_0x9e8060['include']?_[_0x90c0('0x23')](_0x9e8060[_0x90c0('0x21')],function(_0x32939b){return{'model':db[_0x32939b[_0x90c0('0x22')]],'as':_0x32939b['as'],'attributes':_0x32939b[_0x90c0('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x58ff0f){logger[_0x90c0('0x12')]('GetVoiceQueueReport',_0x4654d5);logger['debug'](_0x90c0('0x24'),_0x4654d5,JSON['stringify'](_0x58ff0f));_0x1e6130(_0x58ff0f);})[_0x90c0('0x19')](function(_0x2d543b){logger[_0x90c0('0x17')](_0x90c0('0x24'),_0x2d543b[_0x90c0('0x18')],_0x4654d5);_0x11a3a0(_0x5bb2b4['error'](0x1f4,_0x2d543b[_0x90c0('0x18')]));});});};exports[_0x90c0('0x25')]=function(_0x55cfd6){var _0xf371b8=this;return new Promise(function(_0x3979a9,_0x53502e){return db[_0x90c0('0x1a')][_0x90c0('0x26')](_0x55cfd6[_0x90c0('0x27')],{'raw':_0x55cfd6['options']?_0x55cfd6[_0x90c0('0x1c')][_0x90c0('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x3e97a3){logger['info'](_0x90c0('0x25'),_0x55cfd6);logger[_0x90c0('0x14')](_0x90c0('0x25'),_0x55cfd6,JSON[_0x90c0('0x28')](_0x3e97a3));_0x3979a9(_0x3e97a3);})[_0x90c0('0x19')](function(_0x38e0fa){logger[_0x90c0('0x17')](_0x90c0('0x25'),_0x38e0fa['message'],_0x55cfd6);_0x53502e(_0xf371b8[_0x90c0('0x17')](0x1f4,_0x38e0fa[_0x90c0('0x18')]));});});};exports[_0x90c0('0x29')]=function(_0x3b819b){var _0x29c3d9=this;return new Promise(function(_0x4c0fae,_0x3922e0){return db[_0x90c0('0x1a')][_0x90c0('0x2a')](_0x3b819b[_0x90c0('0x27')],{'raw':_0x3b819b[_0x90c0('0x1c')]?_0x3b819b[_0x90c0('0x1c')][_0x90c0('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3b819b[_0x90c0('0x1c')]?_0x3b819b[_0x90c0('0x1c')][_0x90c0('0x1e')]||null:null,'attributes':_0x3b819b[_0x90c0('0x1c')]?_0x3b819b[_0x90c0('0x1c')][_0x90c0('0x1f')]||null:null,'limit':_0x3b819b[_0x90c0('0x1c')]?_0x3b819b[_0x90c0('0x1c')][_0x90c0('0x20')]||null:null})[_0x90c0('0x11')](function(_0x10a0da){logger[_0x90c0('0x12')](_0x90c0('0x29'),_0x3b819b);logger[_0x90c0('0x14')]('UpdateVoiceQueueReport',_0x3b819b,JSON[_0x90c0('0x28')](_0x10a0da));_0x4c0fae(_0x10a0da);})['catch'](function(_0x17fe11){logger[_0x90c0('0x17')](_0x90c0('0x29'),_0x17fe11[_0x90c0('0x18')],_0x3b819b);_0x3922e0(_0x29c3d9[_0x90c0('0x17')](0x1f4,_0x17fe11['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 8f1dbfc..7bd772d 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 _0x6dc0=['./voiceQueueReport.events','remove','update','removeListener','length','voiceQueueReport:'];(function(_0x1757f2,_0x1b09fa){var _0x5e7212=function(_0x4f1794){while(--_0x4f1794){_0x1757f2['push'](_0x1757f2['shift']());}};_0x5e7212(++_0x1b09fa);}(_0x6dc0,0x18c));var _0x06dc=function(_0x24ee4d,_0x346b64){_0x24ee4d=_0x24ee4d-0x0;var _0x305b6d=_0x6dc0[_0x24ee4d];return _0x305b6d;};'use strict';var VoiceQueueReportEvents=require(_0x06dc('0x0'));var events=['save',_0x06dc('0x1'),_0x06dc('0x2')];function createListener(_0x4434e2,_0xc40894){return function(_0x414760){_0xc40894['emit'](_0x4434e2,_0x414760);};}function removeListener(_0x4effcf,_0x2cad0f){return function(){VoiceQueueReportEvents[_0x06dc('0x3')](_0x4effcf,_0x2cad0f);};}exports['register']=function(_0x45a093){for(var _0x26b287=0x0,_0x4ac3b4=events[_0x06dc('0x4')];_0x26b287<_0x4ac3b4;_0x26b287++){var _0x523fb5=events[_0x26b287];var _0xeac52b=createListener(_0x06dc('0x5')+_0x523fb5,_0x45a093);VoiceQueueReportEvents['on'](_0x523fb5,_0xeac52b);}}; \ No newline at end of file +var _0x8bda=['emit','removeListener','length','voiceQueueReport:','./voiceQueueReport.events','save','remove','update'];(function(_0x4c4abb,_0x39bae7){var _0x29ce07=function(_0x215186){while(--_0x215186){_0x4c4abb['push'](_0x4c4abb['shift']());}};_0x29ce07(++_0x39bae7);}(_0x8bda,0x104));var _0xa8bd=function(_0x53abe5,_0x33a9e5){_0x53abe5=_0x53abe5-0x0;var _0xc1c37e=_0x8bda[_0x53abe5];return _0xc1c37e;};'use strict';var VoiceQueueReportEvents=require(_0xa8bd('0x0'));var events=[_0xa8bd('0x1'),_0xa8bd('0x2'),_0xa8bd('0x3')];function createListener(_0x15602b,_0x476e72){return function(_0x4936a2){_0x476e72[_0xa8bd('0x4')](_0x15602b,_0x4936a2);};}function removeListener(_0x825d86,_0x51db69){return function(){VoiceQueueReportEvents[_0xa8bd('0x5')](_0x825d86,_0x51db69);};}exports['register']=function(_0x36bc1b){for(var _0x2e1aba=0x0,_0x554897=events[_0xa8bd('0x6')];_0x2e1aba<_0x554897;_0x2e1aba++){var _0x2613be=events[_0x2e1aba];var _0x1c4540=createListener(_0xa8bd('0x7')+_0x2613be,_0x36bc1b);VoiceQueueReportEvents['on'](_0x2613be,_0x1c4540);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 5732473..82bd14c 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 _0x12c0=['./voiceQueuesLog.controller','get','index','/:id','isAuthenticated','show','post','create','update','delete','exports','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x204e63,_0x26854f){var _0x4b3a35=function(_0x41b2cb){while(--_0x41b2cb){_0x204e63['push'](_0x204e63['shift']());}};_0x4b3a35(++_0x26854f);}(_0x12c0,0x197));var _0x012c=function(_0x73946a,_0xb8a2cd){_0x73946a=_0x73946a-0x0;var _0x563574=_0x12c0[_0x73946a];return _0x563574;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x012c('0x0'));var timeout=require(_0x012c('0x1'));var express=require(_0x012c('0x2'));var router=express['Router']();var fs_extra=require(_0x012c('0x3'));var auth=require(_0x012c('0x4'));var interaction=require(_0x012c('0x5'));var config=require(_0x012c('0x6'));var controller=require(_0x012c('0x7'));router[_0x012c('0x8')]('/',auth['isAuthenticated'](),controller[_0x012c('0x9')]);router['get'](_0x012c('0xa'),auth[_0x012c('0xb')](),controller[_0x012c('0xc')]);router[_0x012c('0xd')]('/',auth[_0x012c('0xb')](),controller[_0x012c('0xe')]);router['put']('/:id',auth[_0x012c('0xb')](),controller[_0x012c('0xf')]);router[_0x012c('0x10')](_0x012c('0xa'),auth[_0x012c('0xb')](),controller['destroy']);module[_0x012c('0x11')]=router; \ No newline at end of file +var _0x1cd5=['isAuthenticated','index','/:id','create','update','delete','destroy','exports','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','get'];(function(_0x28cca1,_0x3a14c3){var _0x46a835=function(_0xefdb72){while(--_0xefdb72){_0x28cca1['push'](_0x28cca1['shift']());}};_0x46a835(++_0x3a14c3);}(_0x1cd5,0x107));var _0x51cd=function(_0x405f4f,_0x5cee39){_0x405f4f=_0x405f4f-0x0;var _0x531fee=_0x1cd5[_0x405f4f];return _0x531fee;};'use strict';var multer=require('multer');var util=require(_0x51cd('0x0'));var path=require('path');var timeout=require(_0x51cd('0x1'));var express=require(_0x51cd('0x2'));var router=express['Router']();var fs_extra=require(_0x51cd('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x51cd('0x4'));var config=require(_0x51cd('0x5'));var controller=require('./voiceQueuesLog.controller');router[_0x51cd('0x6')]('/',auth[_0x51cd('0x7')](),controller[_0x51cd('0x8')]);router[_0x51cd('0x6')](_0x51cd('0x9'),auth[_0x51cd('0x7')](),controller['show']);router['post']('/',auth[_0x51cd('0x7')](),controller[_0x51cd('0xa')]);router['put'](_0x51cd('0x9'),auth[_0x51cd('0x7')](),controller[_0x51cd('0xb')]);router[_0x51cd('0xc')](_0x51cd('0x9'),auth[_0x51cd('0x7')](),controller[_0x51cd('0xd')]);module[_0x51cd('0xe')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 76d5e71..84053b0 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 _0x4a4a=['sequelize','moment','exports','STRING','DATE','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP'];(function(_0x4e6ae6,_0x49dba6){var _0x23c108=function(_0x1bc103){while(--_0x1bc103){_0x4e6ae6['push'](_0x4e6ae6['shift']());}};_0x23c108(++_0x49dba6);}(_0x4a4a,0x157));var _0xa4a4=function(_0x2bf51f,_0x280711){_0x2bf51f=_0x2bf51f-0x0;var _0x467f2c=_0x4a4a[_0x2bf51f];return _0x467f2c;};'use strict';var Sequelize=require(_0xa4a4('0x0'));var moment=require(_0xa4a4('0x1'));module[_0xa4a4('0x2')]={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xa4a4('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xa4a4('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xa4a4('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xa4a4('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xa4a4('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xa4a4('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xa4a4('0x4')],'allowNull':![],'defaultValue':Sequelize[_0xa4a4('0x5')](_0xa4a4('0x6'))}}; \ No newline at end of file +var _0x6473=['CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','STRING','DATE','literal'];(function(_0x5ec6a5,_0x51d22b){var _0x2ffceb=function(_0x80ec06){while(--_0x80ec06){_0x5ec6a5['push'](_0x5ec6a5['shift']());}};_0x2ffceb(++_0x51d22b);}(_0x6473,0x1ab));var _0x3647=function(_0x1ebfba,_0x5c7da1){_0x1ebfba=_0x1ebfba-0x0;var _0xac7f9c=_0x6473[_0x1ebfba];return _0xac7f9c;};'use strict';var Sequelize=require(_0x3647('0x0'));var moment=require('moment');module[_0x3647('0x1')]={'time':{'type':Sequelize[_0x3647('0x2')]},'callid':{'type':Sequelize[_0x3647('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x3647('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x3647('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x3647('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x3647('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x3647('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x3647('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x3647('0x3')],'allowNull':![],'defaultValue':Sequelize[_0x3647('0x4')](_0x3647('0x5'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 68a522d..b510932 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 _0x46c3=['show','length','catch','create','body','params','find','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','name','send','index','map','VoiceQueuesLog','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll'];(function(_0x50f0a9,_0x2b0c57){var _0x5a33d9=function(_0x40338e){while(--_0x40338e){_0x50f0a9['push'](_0x50f0a9['shift']());}};_0x5a33d9(++_0x2b0c57);}(_0x46c3,0x99));var _0x346c=function(_0x1ebdd1,_0x4dde9d){_0x1ebdd1=_0x1ebdd1-0x0;var _0x32efb6=_0x46c3[_0x1ebdd1];return _0x32efb6;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x346c('0x0'));var moment=require(_0x346c('0x1'));var BPromise=require(_0x346c('0x2'));var Mustache=require(_0x346c('0x3'));var util=require(_0x346c('0x4'));var path=require(_0x346c('0x5'));var sox=require('sox');var csv=require(_0x346c('0x6'));var ejs=require(_0x346c('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x346c('0x8'));var squel=require(_0x346c('0x9'));var crypto=require('crypto');var jsforce=require(_0x346c('0xa'));var deskjs=require(_0x346c('0xb'));var toCsv=require(_0x346c('0x6'));var querystring=require(_0x346c('0xc'));var Papa=require(_0x346c('0xd'));var Redis=require(_0x346c('0xe'));var authService=require(_0x346c('0xf'));var qs=require(_0x346c('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x346c('0x11'));var logger=require(_0x346c('0x12'))('api');var utils=require(_0x346c('0x13'));var config=require(_0x346c('0x14'));var licenseUtil=require(_0x346c('0x15'));var db=require(_0x346c('0x16'))['db'];function respondWithStatusCode(_0x4c89b4,_0x58d8f1){_0x58d8f1=_0x58d8f1||0xcc;return function(_0x1cf694){if(_0x1cf694){return _0x4c89b4[_0x346c('0x17')](_0x58d8f1);}return _0x4c89b4[_0x346c('0x18')](_0x58d8f1)[_0x346c('0x19')]();};}function respondWithResult(_0x4ff02b,_0x551f2f){_0x551f2f=_0x551f2f||0xc8;return function(_0x57b37d){if(_0x57b37d){return _0x4ff02b['status'](_0x551f2f)[_0x346c('0x1a')](_0x57b37d);}};}function respondWithFilteredResult(_0xf965f5,_0x15721a){return function(_0x3b83cb){if(_0x3b83cb){var _0x1530ac=typeof _0x15721a[_0x346c('0x1b')]===_0x346c('0x1c')&&typeof _0x15721a[_0x346c('0x1d')]===_0x346c('0x1c');var _0x532881=_0x3b83cb['count'];var _0x45a3ff=_0x1530ac?0x0:_0x15721a[_0x346c('0x1b')];var _0x525a3f=_0x1530ac?_0x3b83cb[_0x346c('0x1e')]:_0x15721a['offset']+_0x15721a[_0x346c('0x1d')];var _0x2e059b;if(_0x525a3f>=_0x532881){_0x525a3f=_0x532881;_0x2e059b=0xc8;}else{_0x2e059b=0xce;}_0xf965f5[_0x346c('0x18')](_0x2e059b);return _0xf965f5[_0x346c('0x1f')](_0x346c('0x20'),_0x45a3ff+'-'+_0x525a3f+'/'+_0x532881)[_0x346c('0x1a')](_0x3b83cb);}return null;};}function patchUpdates(_0x392e34){return function(_0x550d9c){try{jsonpatch[_0x346c('0x21')](_0x550d9c,_0x392e34,!![]);}catch(_0x4d822d){return BPromise[_0x346c('0x22')](_0x4d822d);}return _0x550d9c[_0x346c('0x23')]();};}function saveUpdates(_0x2e0d42,_0x26e04b){return function(_0x12d22a){if(_0x12d22a){return _0x12d22a[_0x346c('0x24')](_0x2e0d42)[_0x346c('0x25')](function(_0x1bf310){return _0x1bf310;});}return null;};}function removeEntity(_0x32a4e9,_0x557044){return function(_0x250c5e){if(_0x250c5e){return _0x250c5e['destroy']()['then'](function(){_0x32a4e9[_0x346c('0x18')](0xcc)[_0x346c('0x19')]();});}};}function handleEntityNotFound(_0x55bdec,_0x2c9b47){return function(_0x4c6c29){if(!_0x4c6c29){_0x55bdec[_0x346c('0x17')](0x194);}return _0x4c6c29;};}function handleError(_0x45cefb,_0x4975a4){_0x4975a4=_0x4975a4||0x1f4;return function(_0x3758b7){logger[_0x346c('0x26')](_0x3758b7['stack']);if(_0x3758b7[_0x346c('0x27')]){delete _0x3758b7[_0x346c('0x27')];}_0x45cefb[_0x346c('0x18')](_0x4975a4)[_0x346c('0x28')](_0x3758b7);};}exports[_0x346c('0x29')]=function(_0x1505c6,_0x55cb9f){var _0x1b177d={},_0x5ed1ae={},_0x5ecfb3={'count':0x0,'rows':[]};var _0x67db93=_[_0x346c('0x2a')](db[_0x346c('0x2b')][_0x346c('0x2c')],function(_0x4ca640){return{'name':_0x4ca640[_0x346c('0x2d')],'type':_0x4ca640[_0x346c('0x2e')][_0x346c('0x2f')]};});_0x5ed1ae[_0x346c('0x30')]=_[_0x346c('0x2a')](_0x67db93,_0x346c('0x27'));_0x5ed1ae[_0x346c('0x31')]=_[_0x346c('0x32')](_0x1505c6['query']);_0x5ed1ae[_0x346c('0x33')]=_['intersection'](_0x5ed1ae[_0x346c('0x30')],_0x5ed1ae[_0x346c('0x31')]);_0x1b177d[_0x346c('0x34')]=_[_0x346c('0x35')](_0x5ed1ae['model'],qs[_0x346c('0x36')](_0x1505c6['query']['fields']));_0x1b177d[_0x346c('0x34')]=_0x1b177d[_0x346c('0x34')]['length']?_0x1b177d[_0x346c('0x34')]:_0x5ed1ae[_0x346c('0x30')];if(!_0x1505c6[_0x346c('0x31')][_0x346c('0x37')](_0x346c('0x38'))){_0x1b177d[_0x346c('0x1d')]=qs['limit'](_0x1505c6['query'][_0x346c('0x1d')]);_0x1b177d['offset']=qs[_0x346c('0x1b')](_0x1505c6[_0x346c('0x31')][_0x346c('0x1b')]);}_0x1b177d['order']=qs[_0x346c('0x39')](_0x1505c6[_0x346c('0x31')]['sort']);_0x1b177d[_0x346c('0x3a')]=qs[_0x346c('0x33')](_['pick'](_0x1505c6[_0x346c('0x31')],_0x5ed1ae[_0x346c('0x33')]),_0x67db93);if(_0x1505c6['query'][_0x346c('0x3b')]){_0x1b177d[_0x346c('0x3a')]=_[_0x346c('0x3c')](_0x1b177d[_0x346c('0x3a')],{'$or':_[_0x346c('0x2a')](_0x67db93,function(_0x3f679c){if(_0x3f679c[_0x346c('0x2e')]!==_0x346c('0x3d')){var _0x13bd5e={};_0x13bd5e[_0x3f679c[_0x346c('0x27')]]={'$like':'%'+_0x1505c6[_0x346c('0x31')]['filter']+'%'};return _0x13bd5e;}})});}_0x1b177d=_[_0x346c('0x3c')]({},_0x1b177d,_0x1505c6[_0x346c('0x3e')]);var _0x38114d={'where':_0x1b177d[_0x346c('0x3a')]};return db['VoiceQueuesLog']['count'](_0x38114d)[_0x346c('0x25')](function(_0x2fc13c){_0x5ecfb3['count']=_0x2fc13c;if(_0x1505c6[_0x346c('0x31')][_0x346c('0x3f')]){_0x1b177d[_0x346c('0x40')]=[{'all':!![]}];}return db[_0x346c('0x2b')][_0x346c('0x41')](_0x1b177d);})[_0x346c('0x25')](function(_0x4e58df){_0x5ecfb3['rows']=_0x4e58df;return _0x5ecfb3;})['then'](respondWithFilteredResult(_0x55cb9f,_0x1b177d))['catch'](handleError(_0x55cb9f,null));};exports[_0x346c('0x42')]=function(_0x57ce7d,_0x33b3ff){var _0x387955={'raw':!![],'where':{'id':_0x57ce7d['params']['id']}},_0x156670={};_0x156670[_0x346c('0x30')]=_[_0x346c('0x32')](db['VoiceQueuesLog'][_0x346c('0x2c')]);_0x156670[_0x346c('0x31')]=_[_0x346c('0x32')](_0x57ce7d[_0x346c('0x31')]);_0x156670[_0x346c('0x33')]=_[_0x346c('0x35')](_0x156670[_0x346c('0x30')],_0x156670[_0x346c('0x31')]);_0x387955['attributes']=_[_0x346c('0x35')](_0x156670[_0x346c('0x30')],qs['fields'](_0x57ce7d['query'][_0x346c('0x36')]));_0x387955['attributes']=_0x387955[_0x346c('0x34')][_0x346c('0x43')]?_0x387955[_0x346c('0x34')]:_0x156670[_0x346c('0x30')];if(_0x57ce7d['query'][_0x346c('0x3f')]){_0x387955[_0x346c('0x40')]=[{'all':!![]}];}_0x387955=_['merge']({},_0x387955,_0x57ce7d[_0x346c('0x3e')]);return db['VoiceQueuesLog']['find'](_0x387955)[_0x346c('0x25')](handleEntityNotFound(_0x33b3ff,null))[_0x346c('0x25')](respondWithResult(_0x33b3ff,null))[_0x346c('0x44')](handleError(_0x33b3ff,null));};exports[_0x346c('0x45')]=function(_0x91e41b,_0x2e19c9){return db['VoiceQueuesLog']['create'](_0x91e41b['body'],{})[_0x346c('0x25')](respondWithResult(_0x2e19c9,0xc9))[_0x346c('0x44')](handleError(_0x2e19c9,null));};exports['update']=function(_0x3417d9,_0x539667){if(_0x3417d9['body']['id']){delete _0x3417d9[_0x346c('0x46')]['id'];}return db[_0x346c('0x2b')]['find']({'where':{'id':_0x3417d9[_0x346c('0x47')]['id']}})[_0x346c('0x25')](handleEntityNotFound(_0x539667,null))[_0x346c('0x25')](saveUpdates(_0x3417d9[_0x346c('0x46')],null))[_0x346c('0x25')](respondWithResult(_0x539667,null))['catch'](handleError(_0x539667,null));};exports['destroy']=function(_0x1b47dc,_0x2bd5d4){return db[_0x346c('0x2b')][_0x346c('0x48')]({'where':{'id':_0x1b47dc[_0x346c('0x47')]['id']}})[_0x346c('0x25')](handleEntityNotFound(_0x2bd5d4,null))[_0x346c('0x25')](removeEntity(_0x2bd5d4,null))[_0x346c('0x44')](handleError(_0x2bd5d4,null));}; \ No newline at end of file +var _0xc91c=['model','keys','query','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','VoiceQueuesLog','includeAll','include','catch','show','find','create','body','params','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','crypto','jsforce','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','map','rawAttributes','key'];(function(_0x37b546,_0x8c85de){var _0x24a3b5=function(_0x337bc5){while(--_0x337bc5){_0x37b546['push'](_0x37b546['shift']());}};_0x24a3b5(++_0x8c85de);}(_0xc91c,0xe5));var _0xcc91=function(_0x460fd7,_0x2012db){_0x460fd7=_0x460fd7-0x0;var _0x44d1c2=_0xc91c[_0x460fd7];return _0x44d1c2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcc91('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcc91('0x1'));var rp=require(_0xcc91('0x2'));var moment=require(_0xcc91('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xcc91('0x4'));var util=require(_0xcc91('0x5'));var path=require('path');var sox=require(_0xcc91('0x6'));var csv=require(_0xcc91('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcc91('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xcc91('0x9'));var jsforce=require(_0xcc91('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xcc91('0x7'));var querystring=require('querystring');var Papa=require(_0xcc91('0xb'));var Redis=require('ioredis');var authService=require(_0xcc91('0xc'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcc91('0xd'));var logger=require(_0xcc91('0xe'))(_0xcc91('0xf'));var utils=require('../../config/utils');var config=require(_0xcc91('0x10'));var licenseUtil=require(_0xcc91('0x11'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x53632b,_0x27406b){_0x27406b=_0x27406b||0xcc;return function(_0x45bd5e){if(_0x45bd5e){return _0x53632b[_0xcc91('0x12')](_0x27406b);}return _0x53632b['status'](_0x27406b)['end']();};}function respondWithResult(_0x6aeb78,_0x50694e){_0x50694e=_0x50694e||0xc8;return function(_0x4305b5){if(_0x4305b5){return _0x6aeb78[_0xcc91('0x13')](_0x50694e)[_0xcc91('0x14')](_0x4305b5);}};}function respondWithFilteredResult(_0x3ad458,_0x19fdd8){return function(_0x506275){if(_0x506275){var _0x2a4d9e=typeof _0x19fdd8[_0xcc91('0x15')]==='undefined'&&typeof _0x19fdd8['limit']===_0xcc91('0x16');var _0x30b824=_0x506275['count'];var _0x54152c=_0x2a4d9e?0x0:_0x19fdd8[_0xcc91('0x15')];var _0x5b9ba7=_0x2a4d9e?_0x506275[_0xcc91('0x17')]:_0x19fdd8[_0xcc91('0x15')]+_0x19fdd8['limit'];var _0x337b31;if(_0x5b9ba7>=_0x30b824){_0x5b9ba7=_0x30b824;_0x337b31=0xc8;}else{_0x337b31=0xce;}_0x3ad458[_0xcc91('0x13')](_0x337b31);return _0x3ad458[_0xcc91('0x18')](_0xcc91('0x19'),_0x54152c+'-'+_0x5b9ba7+'/'+_0x30b824)['json'](_0x506275);}return null;};}function patchUpdates(_0xbb208){return function(_0x16f65b){try{jsonpatch[_0xcc91('0x1a')](_0x16f65b,_0xbb208,!![]);}catch(_0x2e9fea){return BPromise[_0xcc91('0x1b')](_0x2e9fea);}return _0x16f65b[_0xcc91('0x1c')]();};}function saveUpdates(_0x1ead83,_0x29bd49){return function(_0x2d8b5d){if(_0x2d8b5d){return _0x2d8b5d[_0xcc91('0x1d')](_0x1ead83)[_0xcc91('0x1e')](function(_0x4ce6ea){return _0x4ce6ea;});}return null;};}function removeEntity(_0x1fb79a,_0x119012){return function(_0xa5ae14){if(_0xa5ae14){return _0xa5ae14[_0xcc91('0x1f')]()[_0xcc91('0x1e')](function(){_0x1fb79a[_0xcc91('0x13')](0xcc)[_0xcc91('0x20')]();});}};}function handleEntityNotFound(_0xa43f8a,_0x4903f9){return function(_0xc33eba){if(!_0xc33eba){_0xa43f8a['sendStatus'](0x194);}return _0xc33eba;};}function handleError(_0x108d55,_0x5d4ded){_0x5d4ded=_0x5d4ded||0x1f4;return function(_0x144b58){logger[_0xcc91('0x21')](_0x144b58['stack']);if(_0x144b58[_0xcc91('0x22')]){delete _0x144b58['name'];}_0x108d55['status'](_0x5d4ded)[_0xcc91('0x23')](_0x144b58);};}exports['index']=function(_0x2d3276,_0x1c2cfb){var _0x4a58ee={},_0x2e66b7={},_0x1faf78={'count':0x0,'rows':[]};var _0x27a976=_[_0xcc91('0x24')](db['VoiceQueuesLog'][_0xcc91('0x25')],function(_0x3141b1){return{'name':_0x3141b1['fieldName'],'type':_0x3141b1['type'][_0xcc91('0x26')]};});_0x2e66b7[_0xcc91('0x27')]=_[_0xcc91('0x24')](_0x27a976,_0xcc91('0x22'));_0x2e66b7['query']=_[_0xcc91('0x28')](_0x2d3276[_0xcc91('0x29')]);_0x2e66b7[_0xcc91('0x2a')]=_[_0xcc91('0x2b')](_0x2e66b7[_0xcc91('0x27')],_0x2e66b7[_0xcc91('0x29')]);_0x4a58ee[_0xcc91('0x2c')]=_[_0xcc91('0x2b')](_0x2e66b7[_0xcc91('0x27')],qs['fields'](_0x2d3276[_0xcc91('0x29')][_0xcc91('0x2d')]));_0x4a58ee[_0xcc91('0x2c')]=_0x4a58ee[_0xcc91('0x2c')][_0xcc91('0x2e')]?_0x4a58ee[_0xcc91('0x2c')]:_0x2e66b7[_0xcc91('0x27')];if(!_0x2d3276['query']['hasOwnProperty'](_0xcc91('0x2f'))){_0x4a58ee[_0xcc91('0x30')]=qs[_0xcc91('0x30')](_0x2d3276['query'][_0xcc91('0x30')]);_0x4a58ee[_0xcc91('0x15')]=qs['offset'](_0x2d3276['query'][_0xcc91('0x15')]);}_0x4a58ee[_0xcc91('0x31')]=qs[_0xcc91('0x32')](_0x2d3276[_0xcc91('0x29')][_0xcc91('0x32')]);_0x4a58ee[_0xcc91('0x33')]=qs[_0xcc91('0x2a')](_[_0xcc91('0x34')](_0x2d3276[_0xcc91('0x29')],_0x2e66b7['filters']),_0x27a976);if(_0x2d3276['query'][_0xcc91('0x35')]){_0x4a58ee['where']=_[_0xcc91('0x36')](_0x4a58ee['where'],{'$or':_[_0xcc91('0x24')](_0x27a976,function(_0x39a391){if(_0x39a391[_0xcc91('0x37')]!==_0xcc91('0x38')){var _0x367643={};_0x367643[_0x39a391[_0xcc91('0x22')]]={'$like':'%'+_0x2d3276[_0xcc91('0x29')]['filter']+'%'};return _0x367643;}})});}_0x4a58ee=_[_0xcc91('0x36')]({},_0x4a58ee,_0x2d3276[_0xcc91('0x39')]);var _0x5f12b9={'where':_0x4a58ee['where']};return db[_0xcc91('0x3a')][_0xcc91('0x17')](_0x5f12b9)[_0xcc91('0x1e')](function(_0xa0cae3){_0x1faf78[_0xcc91('0x17')]=_0xa0cae3;if(_0x2d3276[_0xcc91('0x29')][_0xcc91('0x3b')]){_0x4a58ee[_0xcc91('0x3c')]=[{'all':!![]}];}return db[_0xcc91('0x3a')]['findAll'](_0x4a58ee);})[_0xcc91('0x1e')](function(_0xdfdfae){_0x1faf78['rows']=_0xdfdfae;return _0x1faf78;})[_0xcc91('0x1e')](respondWithFilteredResult(_0x1c2cfb,_0x4a58ee))[_0xcc91('0x3d')](handleError(_0x1c2cfb,null));};exports[_0xcc91('0x3e')]=function(_0x5a8ffa,_0x41097b){var _0x1ac7a7={'raw':!![],'where':{'id':_0x5a8ffa['params']['id']}},_0xe8a7ce={};_0xe8a7ce[_0xcc91('0x27')]=_[_0xcc91('0x28')](db[_0xcc91('0x3a')][_0xcc91('0x25')]);_0xe8a7ce[_0xcc91('0x29')]=_['keys'](_0x5a8ffa[_0xcc91('0x29')]);_0xe8a7ce[_0xcc91('0x2a')]=_[_0xcc91('0x2b')](_0xe8a7ce[_0xcc91('0x27')],_0xe8a7ce[_0xcc91('0x29')]);_0x1ac7a7[_0xcc91('0x2c')]=_['intersection'](_0xe8a7ce[_0xcc91('0x27')],qs[_0xcc91('0x2d')](_0x5a8ffa[_0xcc91('0x29')][_0xcc91('0x2d')]));_0x1ac7a7[_0xcc91('0x2c')]=_0x1ac7a7[_0xcc91('0x2c')]['length']?_0x1ac7a7['attributes']:_0xe8a7ce['model'];if(_0x5a8ffa[_0xcc91('0x29')][_0xcc91('0x3b')]){_0x1ac7a7[_0xcc91('0x3c')]=[{'all':!![]}];}_0x1ac7a7=_[_0xcc91('0x36')]({},_0x1ac7a7,_0x5a8ffa[_0xcc91('0x39')]);return db[_0xcc91('0x3a')][_0xcc91('0x3f')](_0x1ac7a7)['then'](handleEntityNotFound(_0x41097b,null))[_0xcc91('0x1e')](respondWithResult(_0x41097b,null))['catch'](handleError(_0x41097b,null));};exports['create']=function(_0x5c4c61,_0x8b164c){return db[_0xcc91('0x3a')][_0xcc91('0x40')](_0x5c4c61['body'],{})[_0xcc91('0x1e')](respondWithResult(_0x8b164c,0xc9))[_0xcc91('0x3d')](handleError(_0x8b164c,null));};exports[_0xcc91('0x1d')]=function(_0x50d991,_0x4a08b4){if(_0x50d991['body']['id']){delete _0x50d991[_0xcc91('0x41')]['id'];}return db[_0xcc91('0x3a')]['find']({'where':{'id':_0x50d991[_0xcc91('0x42')]['id']}})[_0xcc91('0x1e')](handleEntityNotFound(_0x4a08b4,null))['then'](saveUpdates(_0x50d991['body'],null))[_0xcc91('0x1e')](respondWithResult(_0x4a08b4,null))[_0xcc91('0x3d')](handleError(_0x4a08b4,null));};exports[_0xcc91('0x1f')]=function(_0x4da4c7,_0xc70b3b){return db[_0xcc91('0x3a')][_0xcc91('0x3f')]({'where':{'id':_0x4da4c7[_0xcc91('0x42')]['id']}})[_0xcc91('0x1e')](handleEntityNotFound(_0xc70b3b,null))[_0xcc91('0x1e')](removeEntity(_0xc70b3b,null))[_0xcc91('0x3d')](handleError(_0xc70b3b,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index c3c86d3..6cc659e 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 _0x067d=['bluebird','request-promise','path','./voiceQueuesLog.attributes','exports','VoiceQueuesLog','voice_queues_log','event_dtm','event','dtm','lodash','util','../../config/logger','api','moment'];(function(_0x259b24,_0x17127a){var _0x3dec70=function(_0x40a937){while(--_0x40a937){_0x259b24['push'](_0x259b24['shift']());}};_0x3dec70(++_0x17127a);}(_0x067d,0x1db));var _0xd067=function(_0x5c12f2,_0x5de043){_0x5c12f2=_0x5c12f2-0x0;var _0x5e8344=_0x067d[_0x5c12f2];return _0x5e8344;};'use strict';var _=require(_0xd067('0x0'));var util=require(_0xd067('0x1'));var logger=require(_0xd067('0x2'))(_0xd067('0x3'));var moment=require(_0xd067('0x4'));var BPromise=require(_0xd067('0x5'));var rp=require(_0xd067('0x6'));var fs=require('fs');var path=require(_0xd067('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd067('0x8'));module[_0xd067('0x9')]=function(_0x169cc4,_0x9b246){return _0x169cc4['define'](_0xd067('0xa'),attributes,{'tableName':_0xd067('0xb'),'paranoid':![],'indexes':[{'name':_0xd067('0xc'),'fields':[_0xd067('0xd'),_0xd067('0xe')]}],'timestamps':![]});}; \ No newline at end of file +var _0x97dd=['dtm','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./voiceQueuesLog.attributes','define','VoiceQueuesLog','voice_queues_log','event_dtm'];(function(_0xe940fb,_0x210c05){var _0x56b783=function(_0x172997){while(--_0x172997){_0xe940fb['push'](_0xe940fb['shift']());}};_0x56b783(++_0x210c05);}(_0x97dd,0x71));var _0xd97d=function(_0x56f617,_0x69b0cf){_0x56f617=_0x56f617-0x0;var _0x2d881a=_0x97dd[_0x56f617];return _0x2d881a;};'use strict';var _=require(_0xd97d('0x0'));var util=require(_0xd97d('0x1'));var logger=require(_0xd97d('0x2'))(_0xd97d('0x3'));var moment=require('moment');var BPromise=require(_0xd97d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd97d('0x5'));var rimraf=require(_0xd97d('0x6'));var config=require(_0xd97d('0x7'));var attributes=require(_0xd97d('0x8'));module['exports']=function(_0x2e2760,_0x5aaeb9){return _0x2e2760[_0xd97d('0x9')](_0xd97d('0xa'),attributes,{'tableName':_0xd97d('0xb'),'paranoid':![],'indexes':[{'name':_0xd97d('0xc'),'fields':['event',_0xd97d('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 16d92a8..0544b9e 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 _0xd136=['request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','error','code','VoiceQueuesLog,\x20%s,\x20%s','message','info','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xd136,0x94));var _0x6d13=function(_0x522528,_0x405111){_0x522528=_0x522528-0x0;var _0x47de1d=_0xd136[_0x522528];return _0x47de1d;};'use strict';var _=require('lodash');var util=require(_0x6d13('0x0'));var moment=require(_0x6d13('0x1'));var BPromise=require('bluebird');var rs=require(_0x6d13('0x2'));var fs=require('fs');var Redis=require(_0x6d13('0x3'));var db=require(_0x6d13('0x4'))['db'];var utils=require(_0x6d13('0x5'));var logger=require(_0x6d13('0x6'))(_0x6d13('0x7'));var config=require(_0x6d13('0x8'));var jayson=require(_0x6d13('0x9'));var client=jayson[_0x6d13('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x335482,_0xdf6760,_0x4c563a){return new BPromise(function(_0x598021,_0x1af16f){return client[_0x6d13('0xb')](_0x335482,_0x4c563a)[_0x6d13('0xc')](function(_0x2216d7){logger['info']('VoiceQueuesLog,\x20%s,\x20%s',_0xdf6760,_0x6d13('0xd'));logger[_0x6d13('0xe')](_0x6d13('0xf'),_0xdf6760,'request\x20sent',JSON['stringify'](_0x2216d7));if(_0x2216d7[_0x6d13('0x10')]){if(_0x2216d7[_0x6d13('0x10')][_0x6d13('0x11')]===0x1f4){logger['error'](_0x6d13('0x12'),_0xdf6760,_0x2216d7[_0x6d13('0x10')][_0x6d13('0x13')]);return _0x1af16f(_0x2216d7[_0x6d13('0x10')]['message']);}logger['error']('VoiceQueuesLog,\x20%s,\x20%s',_0xdf6760,_0x2216d7[_0x6d13('0x10')][_0x6d13('0x13')]);return _0x598021(_0x2216d7[_0x6d13('0x10')][_0x6d13('0x13')]);}else{logger[_0x6d13('0x14')]('VoiceQueuesLog,\x20%s,\x20%s',_0xdf6760,_0x6d13('0xd'));_0x598021(_0x2216d7[_0x6d13('0x15')][_0x6d13('0x13')]);}})[_0x6d13('0x16')](function(_0x348cab){logger[_0x6d13('0x10')](_0x6d13('0x12'),_0xdf6760,_0x348cab);_0x1af16f(_0x348cab);});});} \ No newline at end of file +var _0x8150=['error','code','message','result','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x1956c9,_0x2ad6b4){var _0x499d4=function(_0x2fa03f){while(--_0x2fa03f){_0x1956c9['push'](_0x1956c9['shift']());}};_0x499d4(++_0x2ad6b4);}(_0x8150,0x1a7));var _0x0815=function(_0x422a09,_0x318d15){_0x422a09=_0x422a09-0x0;var _0x515375=_0x8150[_0x422a09];return _0x515375;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x0815('0x0'));var rs=require(_0x0815('0x1'));var fs=require('fs');var Redis=require(_0x0815('0x2'));var db=require(_0x0815('0x3'))['db'];var utils=require(_0x0815('0x4'));var logger=require('../../config/logger')(_0x0815('0x5'));var config=require('../../config/environment');var jayson=require(_0x0815('0x6'));var client=jayson[_0x0815('0x7')][_0x0815('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x47cf9c,_0x3c2014,_0x37c337){return new BPromise(function(_0xa3e790,_0x2fe044){return client[_0x0815('0x9')](_0x47cf9c,_0x37c337)[_0x0815('0xa')](function(_0x2b53a3){logger[_0x0815('0xb')](_0x0815('0xc'),_0x3c2014,_0x0815('0xd'));logger[_0x0815('0xe')](_0x0815('0xf'),_0x3c2014,'request\x20sent',JSON[_0x0815('0x10')](_0x2b53a3));if(_0x2b53a3[_0x0815('0x11')]){if(_0x2b53a3['error'][_0x0815('0x12')]===0x1f4){logger[_0x0815('0x11')](_0x0815('0xc'),_0x3c2014,_0x2b53a3['error'][_0x0815('0x13')]);return _0x2fe044(_0x2b53a3[_0x0815('0x11')][_0x0815('0x13')]);}logger[_0x0815('0x11')](_0x0815('0xc'),_0x3c2014,_0x2b53a3['error'][_0x0815('0x13')]);return _0xa3e790(_0x2b53a3[_0x0815('0x11')][_0x0815('0x13')]);}else{logger[_0x0815('0xb')](_0x0815('0xc'),_0x3c2014,_0x0815('0xd'));_0xa3e790(_0x2b53a3[_0x0815('0x14')][_0x0815('0x13')]);}})[_0x0815('0x15')](function(_0x1eb43d){logger[_0x0815('0x11')](_0x0815('0xc'),_0x3c2014,_0x1eb43d);_0x2fe044(_0x1eb43d);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 314c613..8b0f5cd 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 _0xe2ed=['downloads','/:id/transcribe','downloadTranscribe','post','runTranscribe','put','/:id','destroy','exports','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get','isAuthenticated','index','/describe','describe','show','/:id/download','download'];(function(_0x2eee5e,_0x4509eb){var _0x3f98bb=function(_0x423abe){while(--_0x423abe){_0x2eee5e['push'](_0x2eee5e['shift']());}};_0x3f98bb(++_0x4509eb);}(_0xe2ed,0x6d));var _0xde2e=function(_0x3a125e,_0x514908){_0x3a125e=_0x3a125e-0x0;var _0x47f020=_0xe2ed[_0x3a125e];return _0x47f020;};'use strict';var multer=require('multer');var util=require(_0xde2e('0x0'));var path=require('path');var timeout=require(_0xde2e('0x1'));var express=require(_0xde2e('0x2'));var router=express['Router']();var fs_extra=require(_0xde2e('0x3'));var auth=require(_0xde2e('0x4'));var interaction=require(_0xde2e('0x5'));var config=require(_0xde2e('0x6'));var controller=require(_0xde2e('0x7'));router[_0xde2e('0x8')]('/',auth[_0xde2e('0x9')](),controller[_0xde2e('0xa')]);router[_0xde2e('0x8')](_0xde2e('0xb'),auth['isAuthenticated'](),controller[_0xde2e('0xc')]);router[_0xde2e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xde2e('0xd')]);router[_0xde2e('0x8')](_0xde2e('0xe'),auth[_0xde2e('0x9')](),controller[_0xde2e('0xf')]);router[_0xde2e('0x8')]('/:id/downloads',controller[_0xde2e('0x10')]);router['get'](_0xde2e('0x11'),auth[_0xde2e('0x9')](),controller[_0xde2e('0x12')]);router[_0xde2e('0x13')]('/',auth[_0xde2e('0x9')](),controller['create']);router[_0xde2e('0x13')]('/:id/transcribe',auth['isAuthenticated'](),controller[_0xde2e('0x14')]);router[_0xde2e('0x15')](_0xde2e('0x16'),auth[_0xde2e('0x9')](),controller['update']);router['delete'](_0xde2e('0x16'),auth[_0xde2e('0x9')](),controller[_0xde2e('0x17')]);module[_0xde2e('0x18')]=router; \ No newline at end of file +var _0xd1bb=['destroy','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./voiceRecording.controller','get','isAuthenticated','index','/describe','show','/:id/download','download','downloads','/:id/transcribe','downloadTranscribe','post','create','runTranscribe','put','/:id','delete'];(function(_0x1f935c,_0x26ec37){var _0x14eb3d=function(_0x3d1381){while(--_0x3d1381){_0x1f935c['push'](_0x1f935c['shift']());}};_0x14eb3d(++_0x26ec37);}(_0xd1bb,0x146));var _0xbd1b=function(_0xa351a0,_0x2f250a){_0xa351a0=_0xa351a0-0x0;var _0xae347b=_0xd1bb[_0xa351a0];return _0xae347b;};'use strict';var multer=require('multer');var util=require(_0xbd1b('0x0'));var path=require(_0xbd1b('0x1'));var timeout=require(_0xbd1b('0x2'));var express=require(_0xbd1b('0x3'));var router=express[_0xbd1b('0x4')]();var fs_extra=require(_0xbd1b('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xbd1b('0x6'));var controller=require(_0xbd1b('0x7'));router[_0xbd1b('0x8')]('/',auth[_0xbd1b('0x9')](),controller[_0xbd1b('0xa')]);router[_0xbd1b('0x8')](_0xbd1b('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0xbd1b('0x8')]('/:id',auth[_0xbd1b('0x9')](),controller[_0xbd1b('0xc')]);router['get'](_0xbd1b('0xd'),auth[_0xbd1b('0x9')](),controller[_0xbd1b('0xe')]);router[_0xbd1b('0x8')]('/:id/downloads',controller[_0xbd1b('0xf')]);router[_0xbd1b('0x8')](_0xbd1b('0x10'),auth[_0xbd1b('0x9')](),controller[_0xbd1b('0x11')]);router[_0xbd1b('0x12')]('/',auth[_0xbd1b('0x9')](),controller[_0xbd1b('0x13')]);router['post'](_0xbd1b('0x10'),auth[_0xbd1b('0x9')](),controller[_0xbd1b('0x14')]);router[_0xbd1b('0x15')](_0xbd1b('0x16'),auth['isAuthenticated'](),controller['update']);router[_0xbd1b('0x17')]('/:id',auth['isAuthenticated'](),controller[_0xbd1b('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 77335ee..713f7b8 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(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0xa9e0,0x123));var _0x0a9e=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xa9e0[_0xea8947];return _0x2455e9;};'use strict';var Sequelize=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));module['exports']={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x0a9e('0x3')]('value')?path[_0x0a9e('0x4')](this[_0x0a9e('0x3')](_0x0a9e('0x5'))):undefined;}},'uniqueid':{'type':Sequelize[_0x0a9e('0x6')]},'channel':{'type':Sequelize[_0x0a9e('0x6')],'set':function(_0x57b080){if(_0x57b080){this[_0x0a9e('0x7')](_0x0a9e('0x8'),_0x57b080);this[_0x0a9e('0x7')]('membername',_0x57b080['split'](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x0a9e('0x6')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x0a9e('0x6')]},'connectedlinename':{'type':Sequelize[_0x0a9e('0x6')]},'accountcode':{'type':Sequelize[_0x0a9e('0x6')]},'context':{'type':Sequelize[_0x0a9e('0x6')]},'exten':{'type':Sequelize[_0x0a9e('0x6')]},'value':{'type':Sequelize[_0x0a9e('0x6')]},'type':{'type':Sequelize['STRING']},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'userThirdDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'location':{'type':Sequelize[_0x0a9e('0x9')]},'transcribeName':{'type':Sequelize[_0x0a9e('0x6')]},'transcribeStatus':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':_0x0a9e('0xa')},'fileUri':{'type':Sequelize['TEXT']},'fileText':{'type':Sequelize[_0x0a9e('0x9')]},'failureReason':{'type':Sequelize[_0x0a9e('0x9')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')]},'sPositive':{'type':Sequelize[_0x0a9e('0xb')]},'sNegative':{'type':Sequelize[_0x0a9e('0xb')]},'sNeutral':{'type':Sequelize[_0x0a9e('0xb')]},'sMixed':{'type':Sequelize['FLOAT']},'tempSentiment':{'type':Sequelize[_0x0a9e('0xc')],'defaultValue':![]},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x0a9e('0x3')]('createdAt'))[_0x0a9e('0xd')](_0x0a9e('0xe'))['toString']();}},'updatedAt':{'type':Sequelize[_0x0a9e('0xf')],'get':function(){return moment(this['getDataValue'](_0x0a9e('0x10')))[_0x0a9e('0xd')](_0x0a9e('0xe'))[_0x0a9e('0x11')]();}}}; \ No newline at end of file +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(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'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 626abe9..f61c608 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 _0xbae1=['decryptFile','ValidationError','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','listBuckets','createBucket','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','runTranscribe','findOne','transcribe','transcribeAccountId','Transcribe\x20not\x20configured','runSentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','data1','data2','transcribeRegion','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','transcribeStatus','NEW','language','IN_PROGRESS','tempSentiment','writeFile','root','.txt','Transcript\x20not\x20available','eml-format','rimraf','fast-json-patch','bluebird','util','path','sox','to-csv','fs-extra','lodash','crypto','desk.js','querystring','papaparse','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','offset','undefined','count','limit','Content-Range','json','apply','reject','save','update','destroy','then','error','name','index','map','VoiceRecording','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','show','intersection','options','catch','create','body','find','params','describe','download','../../components/encryptor','uniqueid','value','format','%s.cypher','existsSync','secrets','recording','Sequelize','VoiceRecording\x20not\x20found','filename','extname','unlink','message','send','Not\x20found','sequelize','col','$and'];(function(_0x2509c7,_0x36e452){var _0x4e9c91=function(_0x59ca63){while(--_0x59ca63){_0x2509c7['push'](_0x2509c7['shift']());}};_0x4e9c91(++_0x36e452);}(_0xbae1,0x1e2));var _0x1bae=function(_0x55ab83,_0x1223b5){_0x55ab83=_0x55ab83-0x0;var _0x3d9c8f=_0xbae1[_0x55ab83];return _0x3d9c8f;};'use strict';var emlformat=require(_0x1bae('0x0'));var rimraf=require(_0x1bae('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1bae('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x1bae('0x3'));var Mustache=require('mustache');var util=require(_0x1bae('0x4'));var path=require(_0x1bae('0x5'));var sox=require(_0x1bae('0x6'));var csv=require(_0x1bae('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1bae('0x8'));var _=require(_0x1bae('0x9'));var squel=require('squel');var crypto=require(_0x1bae('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x1bae('0xb'));var toCsv=require(_0x1bae('0x7'));var querystring=require(_0x1bae('0xc'));var Papa=require(_0x1bae('0xd'));var AWS=require('aws-sdk');var uuidv4=require(_0x1bae('0xe'));var Redis=require(_0x1bae('0xf'));var authService=require(_0x1bae('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x1bae('0x11'));var hardwareService=require(_0x1bae('0x12'));var logger=require(_0x1bae('0x13'))('api');var utils=require(_0x1bae('0x14'));var config=require(_0x1bae('0x15'));var licenseUtil=require(_0x1bae('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3da007,_0x5e1cd8){_0x5e1cd8=_0x5e1cd8||0xcc;return function(_0x5ad3e1){if(_0x5ad3e1){return _0x3da007[_0x1bae('0x17')](_0x5e1cd8);}return _0x3da007['status'](_0x5e1cd8)[_0x1bae('0x18')]();};}function respondWithResult(_0x2a0065,_0x1435a9){_0x1435a9=_0x1435a9||0xc8;return function(_0x24fba8){if(_0x24fba8){return _0x2a0065[_0x1bae('0x19')](_0x1435a9)['json'](_0x24fba8);}};}function respondWithFilteredResult(_0x405c2e,_0x5e4187){return function(_0x1fcbfc){if(_0x1fcbfc){var _0xa0a922=typeof _0x5e4187[_0x1bae('0x1a')]===_0x1bae('0x1b')&&typeof _0x5e4187['limit']==='undefined';var _0x3414df=_0x1fcbfc[_0x1bae('0x1c')];var _0x1de58e=_0xa0a922?0x0:_0x5e4187[_0x1bae('0x1a')];var _0x250838=_0xa0a922?_0x1fcbfc[_0x1bae('0x1c')]:_0x5e4187[_0x1bae('0x1a')]+_0x5e4187[_0x1bae('0x1d')];var _0x435da9;if(_0x250838>=_0x3414df){_0x250838=_0x3414df;_0x435da9=0xc8;}else{_0x435da9=0xce;}_0x405c2e[_0x1bae('0x19')](_0x435da9);return _0x405c2e['set'](_0x1bae('0x1e'),_0x1de58e+'-'+_0x250838+'/'+_0x3414df)[_0x1bae('0x1f')](_0x1fcbfc);}return null;};}function patchUpdates(_0x42cd39){return function(_0x1e10d9){try{jsonpatch[_0x1bae('0x20')](_0x1e10d9,_0x42cd39,!![]);}catch(_0x20a6e2){return BPromise[_0x1bae('0x21')](_0x20a6e2);}return _0x1e10d9[_0x1bae('0x22')]();};}function saveUpdates(_0x41bc42,_0x4391b9){return function(_0x1d9615){if(_0x1d9615){return _0x1d9615[_0x1bae('0x23')](_0x41bc42)['then'](function(_0x5d7cc0){return _0x5d7cc0;});}return null;};}function removeEntity(_0x26f137,_0x5784d4){return function(_0x40f84c){if(_0x40f84c){return _0x40f84c[_0x1bae('0x24')]()[_0x1bae('0x25')](function(){_0x26f137[_0x1bae('0x19')](0xcc)[_0x1bae('0x18')]();});}};}function handleEntityNotFound(_0x34dc81,_0x25500a){return function(_0x332ef0){if(!_0x332ef0){_0x34dc81['sendStatus'](0x194);}return _0x332ef0;};}function handleError(_0x2cd196,_0x58b8b5){_0x58b8b5=_0x58b8b5||0x1f4;return function(_0x38a48a){logger[_0x1bae('0x26')](_0x38a48a['stack']);if(_0x38a48a['name']){delete _0x38a48a[_0x1bae('0x27')];}_0x2cd196['status'](_0x58b8b5)['send'](_0x38a48a);};}exports[_0x1bae('0x28')]=function(_0x2dd61a,_0xb3fadd){var _0x43d8a7={},_0x2203d7={},_0x2cacf2={'count':0x0,'rows':[]};var _0x35df17=_[_0x1bae('0x29')](db[_0x1bae('0x2a')][_0x1bae('0x2b')],function(_0x486368){return{'name':_0x486368[_0x1bae('0x2c')],'type':_0x486368[_0x1bae('0x2d')][_0x1bae('0x2e')]};});_0x2203d7[_0x1bae('0x2f')]=_['differenceBy'](_[_0x1bae('0x29')](_0x35df17,'name'),['format']);_0x2203d7['query']=_[_0x1bae('0x30')](_0x2dd61a[_0x1bae('0x31')]);_0x2203d7[_0x1bae('0x32')]=_['intersection'](_0x2203d7['model'],_0x2203d7[_0x1bae('0x31')]);_0x43d8a7[_0x1bae('0x33')]=_['intersection'](_0x2203d7['model'],qs[_0x1bae('0x34')](_0x2dd61a[_0x1bae('0x31')][_0x1bae('0x34')]));_0x43d8a7[_0x1bae('0x33')]=_0x43d8a7['attributes'][_0x1bae('0x35')]?_0x43d8a7['attributes']:_0x2203d7['model'];if(!_0x2dd61a[_0x1bae('0x31')][_0x1bae('0x36')](_0x1bae('0x37'))){_0x43d8a7[_0x1bae('0x1d')]=qs[_0x1bae('0x1d')](_0x2dd61a[_0x1bae('0x31')][_0x1bae('0x1d')]);_0x43d8a7[_0x1bae('0x1a')]=qs[_0x1bae('0x1a')](_0x2dd61a['query'][_0x1bae('0x1a')]);}_0x43d8a7['order']=qs[_0x1bae('0x38')](_0x2dd61a[_0x1bae('0x31')]['sort']);_0x43d8a7['where']=qs[_0x1bae('0x32')](_[_0x1bae('0x39')](_0x2dd61a['query'],_0x2203d7['filters']),_0x35df17);if(_0x2dd61a[_0x1bae('0x31')][_0x1bae('0x3a')]){_0x43d8a7[_0x1bae('0x3b')]=_[_0x1bae('0x3c')](_0x43d8a7[_0x1bae('0x3b')],{'$or':_['map'](_0x35df17,function(_0x2e6682){if(_0x2e6682[_0x1bae('0x2d')]!==_0x1bae('0x3d')){var _0x47bc62={};_0x47bc62[_0x2e6682[_0x1bae('0x27')]]={'$like':'%'+_0x2dd61a[_0x1bae('0x31')][_0x1bae('0x3a')]+'%'};return _0x47bc62;}})});}_0x43d8a7=_[_0x1bae('0x3c')]({},_0x43d8a7,_0x2dd61a['options']);var _0xf02e77={'where':_0x43d8a7[_0x1bae('0x3b')]};return db[_0x1bae('0x2a')][_0x1bae('0x1c')](_0xf02e77)['then'](function(_0x5cfcb6){_0x2cacf2[_0x1bae('0x1c')]=_0x5cfcb6;if(_0x2dd61a[_0x1bae('0x31')][_0x1bae('0x3e')]){_0x43d8a7[_0x1bae('0x3f')]=[{'all':!![]}];}return db[_0x1bae('0x2a')][_0x1bae('0x40')](_0x43d8a7);})[_0x1bae('0x25')](function(_0x5e1e6c){_0x2cacf2['rows']=_0x5e1e6c;return _0x2cacf2;})[_0x1bae('0x25')](respondWithFilteredResult(_0xb3fadd,_0x43d8a7))['catch'](handleError(_0xb3fadd,null));};exports[_0x1bae('0x41')]=function(_0x566866,_0x5473c4){var _0x317559={'raw':![],'where':{'id':_0x566866['params']['id']}},_0xe4ed8a={};_0xe4ed8a[_0x1bae('0x2f')]=_[_0x1bae('0x30')](db['VoiceRecording'][_0x1bae('0x2b')]);_0xe4ed8a['query']=_[_0x1bae('0x30')](_0x566866[_0x1bae('0x31')]);_0xe4ed8a[_0x1bae('0x32')]=_[_0x1bae('0x42')](_0xe4ed8a[_0x1bae('0x2f')],_0xe4ed8a[_0x1bae('0x31')]);_0x317559[_0x1bae('0x33')]=_['intersection'](_0xe4ed8a[_0x1bae('0x2f')],qs[_0x1bae('0x34')](_0x566866[_0x1bae('0x31')][_0x1bae('0x34')]));_0x317559[_0x1bae('0x33')]=_0x317559['attributes'][_0x1bae('0x35')]?_0x317559['attributes']:_0xe4ed8a['model'];if(_0x566866[_0x1bae('0x31')]['includeAll']){_0x317559[_0x1bae('0x3f')]=[{'all':!![]}];}_0x317559=_['merge']({},_0x317559,_0x566866[_0x1bae('0x43')]);return db[_0x1bae('0x2a')]['find'](_0x317559)[_0x1bae('0x25')](handleEntityNotFound(_0x5473c4,null))[_0x1bae('0x25')](respondWithResult(_0x5473c4,null))[_0x1bae('0x44')](handleError(_0x5473c4,null));};exports[_0x1bae('0x45')]=function(_0x12daa4,_0x4c2285){return db['VoiceRecording']['create'](_0x12daa4[_0x1bae('0x46')],{})['then'](respondWithResult(_0x4c2285,0xc9))[_0x1bae('0x44')](handleError(_0x4c2285,null));};exports[_0x1bae('0x23')]=function(_0x24891f,_0x28ccc0){if(_0x24891f[_0x1bae('0x46')]['id']){delete _0x24891f['body']['id'];}return db[_0x1bae('0x2a')][_0x1bae('0x47')]({'where':{'id':_0x24891f[_0x1bae('0x48')]['id']}})[_0x1bae('0x25')](handleEntityNotFound(_0x28ccc0,null))['then'](saveUpdates(_0x24891f[_0x1bae('0x46')],null))[_0x1bae('0x25')](respondWithResult(_0x28ccc0,null))[_0x1bae('0x44')](handleError(_0x28ccc0,null));};exports[_0x1bae('0x49')]=function(_0x1a61cf,_0x333ef6){return db[_0x1bae('0x2a')][_0x1bae('0x49')]()[_0x1bae('0x25')](respondWithResult(_0x333ef6,null))[_0x1bae('0x44')](handleError(_0x333ef6,null));};exports[_0x1bae('0x4a')]=function(_0x4f3e3,_0x5a407e,_0x1287e0){var _0x6192f6=require(_0x1bae('0x4b'));var _0x22f51a=![];var _0x488935={};if(_0x4f3e3['query'][_0x1bae('0x2d')]&&_0x4f3e3[_0x1bae('0x31')]['type']===_0x1bae('0x4c')){_0x488935[_0x1bae('0x4c')]=_0x4f3e3['params']['id'];}else{_0x488935['id']=_0x4f3e3['params']['id'];}return db[_0x1bae('0x2a')][_0x1bae('0x47')]({'where':_0x488935,'attributes':['id',_0x1bae('0x4d')],'raw':!![]})[_0x1bae('0x25')](handleEntityNotFound(_0x5a407e,null))[_0x1bae('0x25')](function(_0x39a8ae){if(_0x39a8ae){var _0x5d1669=_0x39a8ae[_0x1bae('0x4d')];var _0x15b327=util[_0x1bae('0x4e')](_0x1bae('0x4f'),_0x5d1669);if(fs[_0x1bae('0x50')](_0x15b327)){_0x22f51a=!![];return _0x6192f6['decryptFile'](_0x15b327,_0x5d1669,config[_0x1bae('0x51')][_0x1bae('0x52')])['then'](function(){return _0x39a8ae;});}return _0x39a8ae;}})[_0x1bae('0x25')](function(_0x1d598a){if(_0x1d598a){var _0x33d652=_0x1d598a[_0x1bae('0x4d')];if(!fs[_0x1bae('0x50')](_0x33d652)){throw new db[(_0x1bae('0x53'))]['ValidationError'](_0x1bae('0x54'));}if(_0x1d598a[_0x1bae('0x55')]){return _0x5a407e[_0x1bae('0x4a')](_0x33d652,_0x1d598a['filename']+path[_0x1bae('0x56')](_0x33d652),function(){if(_0x22f51a){fs['unlink'](_0x33d652);}});}else{return _0x5a407e[_0x1bae('0x4a')](_0x33d652,function(_0x89582f){if(_0x22f51a){fs[_0x1bae('0x57')](_0x33d652);}});}}})[_0x1bae('0x44')](function(_0x1cab1a){if(_0x1cab1a[_0x1bae('0x58')]===_0x1bae('0x54')){_0x5a407e[_0x1bae('0x19')](0x194)[_0x1bae('0x59')](_0x1bae('0x5a'));}else{return handleError(_0x5a407e,null);}});};exports['downloads']=function(_0x35dae8,_0x35e44a,_0x4861a1){var _0x120a4c=require(_0x1bae('0x4b'));var _0x2d5342=![];var _0x177565={'$and':[db[_0x1bae('0x5b')]['where'](db[_0x1bae('0x5b')]['fn']('MD5',db[_0x1bae('0x5b')][_0x1bae('0x5c')](_0x1bae('0x4c'))),_0x35dae8['query']['token'])]};if(_0x35dae8['query'][_0x1bae('0x2d')]&&_0x35dae8[_0x1bae('0x31')]['type']===_0x1bae('0x4c')){_0x177565[_0x1bae('0x5d')]['push']({'uniqueid':_0x35dae8[_0x1bae('0x48')]['id']});}else{_0x177565[_0x1bae('0x5d')]['push']({'id':_0x35dae8[_0x1bae('0x48')]['id']});}return db['VoiceRecording'][_0x1bae('0x47')]({'where':_0x177565,'attributes':['id',_0x1bae('0x4d')],'raw':!![]})[_0x1bae('0x25')](handleEntityNotFound(_0x35e44a,null))[_0x1bae('0x25')](function(_0x4fd795){if(_0x4fd795){var _0x2e1133=util[_0x1bae('0x4e')](_0x1bae('0x4f'),_0x4fd795[_0x1bae('0x4d')]);if(fs[_0x1bae('0x50')](_0x2e1133)){_0x2d5342=!![];return _0x120a4c[_0x1bae('0x5e')](_0x2e1133,_0x4fd795[_0x1bae('0x4d')],config[_0x1bae('0x51')][_0x1bae('0x52')])[_0x1bae('0x25')](function(){return _0x4fd795;});}return _0x4fd795;}})['then'](function(_0x286acf){if(_0x286acf){if(!fs[_0x1bae('0x50')](_0x286acf['value'])){throw new db[(_0x1bae('0x53'))][(_0x1bae('0x5f'))](_0x1bae('0x54'));}if(_0x286acf[_0x1bae('0x55')]){return _0x35e44a[_0x1bae('0x4a')](_0x286acf['value'],_0x286acf[_0x1bae('0x55')]+path[_0x1bae('0x56')](_0x286acf['value']),function(){if(_0x2d5342){fs[_0x1bae('0x57')](_0x286acf[_0x1bae('0x4d')]);}});}else{return _0x35e44a['download'](_0x286acf['value'],function(_0x293450){if(_0x2d5342){fs[_0x1bae('0x57')](_0x286acf['value']);}});}}})[_0x1bae('0x44')](handleError(_0x35e44a,null));};exports[_0x1bae('0x24')]=function(_0x417f6f,_0x49f63d){return db[_0x1bae('0x2a')][_0x1bae('0x47')]({'where':{'id':_0x417f6f[_0x1bae('0x48')]['id']}})[_0x1bae('0x25')](function(_0xb71a11){if(_[_0x1bae('0x60')](_0xb71a11)){throw new ReferenceError(_0x1bae('0x61'));}return _0xb71a11;})[_0x1bae('0x25')](function(_0x2a7b1e){var _0x141430=_0x2a7b1e[_0x1bae('0x4d')];logger[_0x1bae('0x62')](_0x1bae('0x63'),_0x141430);if(!_[_0x1bae('0x60')](_0x2a7b1e[_0x1bae('0x4d')])&&fs[_0x1bae('0x50')](_0x141430)){logger[_0x1bae('0x62')](_0x1bae('0x64')+_0x141430+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x141430);}_0x141430=_0x141430+_0x1bae('0x65');if(!_[_0x1bae('0x60')](_0x2a7b1e[_0x1bae('0x4d')])&&fs[_0x1bae('0x50')](_0x141430)){logger['info'](_0x1bae('0x64')+_0x141430+_0x1bae('0x66'));fs[_0x1bae('0x67')](_0x141430);}return _0x2a7b1e;})[_0x1bae('0x25')](function(_0xd4722d){if(!_0xd4722d)throw new InternalError();return _0xd4722d[_0x1bae('0x24')]();})[_0x1bae('0x25')](function(){_0x49f63d['status'](0xcc)['end']();})['catch'](handleError(_0x49f63d,null));};function getBucketslist(_0x89320e,_0x1afeab,_0x362f39){return new Promise(function(_0x41924a,_0x2842fc){var _0x2244a1=new AWS['S3']({'accessKeyId':_0x1afeab,'secretAccessKey':_0x89320e,'region':_0x362f39});_0x2244a1[_0x1bae('0x68')]({},function(_0x2149e0,_0x401787){if(_0x2149e0){return _0x2842fc(_0x2149e0);}else{return _0x41924a(_0x401787);}});});}function createBucket(_0x566a98,_0x413e49,_0xcf0a45,_0x1241ff){return new Promise(function(_0x2c042f,_0x3f8b2f){var _0x1baf3d=new AWS['S3']({'accessKeyId':_0x413e49,'secretAccessKey':_0x566a98,'region':_0xcf0a45});_0x1baf3d[_0x1bae('0x69')]({'Bucket':_0x1241ff},function(_0x7e11ba,_0x4b771b){if(_0x7e11ba){return _0x3f8b2f(_0x7e11ba);}else{return _0x2c042f(_0x4b771b);}});});}function uploadFile(_0x212b43,_0x17d397,_0xdf21a9,_0x578f18,_0x499158,_0xb3dde4){return new Promise(function(_0x10053f,_0x248493){var _0x49d251=new AWS['S3']({'accessKeyId':_0x17d397,'secretAccessKey':_0x212b43,'region':_0xdf21a9});_0x49d251[_0x1bae('0x6a')]({'Bucket':_0x578f18,'Key':_0x499158,'Body':_0xb3dde4},function(_0x3e9d01,_0xb927d4){if(_0x3e9d01){return _0x248493(_0x3e9d01);}else{return _0x10053f(_0xb927d4);}});});}function startTranscribe(_0x38c3c6,_0x1733ce,_0x22ac17,_0x499501,_0x1ae877,_0x5c97c1){return new Promise(function(_0x340b13,_0x5d4f53){var _0x150c9a=new AWS[(_0x1bae('0x6b'))]({'accessKeyId':_0x1733ce,'secretAccessKey':_0x38c3c6,'region':_0x22ac17});_0x150c9a[_0x1bae('0x6c')]({'TranscriptionJobName':_0x499501,'LanguageCode':_0x1ae877,'Media':{'MediaFileUri':_0x5c97c1}},function(_0x1840f9,_0x2e3209){if(_0x1840f9){return _0x5d4f53(_0x1840f9);}else{return _0x340b13(_0x2e3209);}});});}function transcribe(_0x5dbc80,_0x57c2cc,_0x437452,_0x243ce8,_0x2e4902,_0x472935,_0x184bea){return new Promise(function(_0x36766e,_0x3eafae){var _0x2ceba5={};logger[_0x1bae('0x62')](util[_0x1bae('0x4e')]('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x5dbc80,_0x2e4902));return uploadFile(_0x57c2cc,_0x437452,_0x243ce8,_0x2e4902,path['basename'](_0x472935),fs['readFileSync'](_0x472935))[_0x1bae('0x25')](function(_0xf7fdfa){logger[_0x1bae('0x62')](util[_0x1bae('0x4e')](_0x1bae('0x6d'),_0x5dbc80,_0x2e4902,_0xf7fdfa[_0x1bae('0x6e')]));_0x2ceba5[_0x1bae('0x6f')]=_0xf7fdfa[_0x1bae('0x70')];_0x2ceba5[_0x1bae('0x71')]=_0xf7fdfa[_0x1bae('0x6e')];logger['info'](util['format'](_0x1bae('0x72'),_0x5dbc80));return startTranscribe(_0x57c2cc,_0x437452,_0x243ce8,uuidv4(),_0x184bea,_0xf7fdfa[_0x1bae('0x6e')]);})[_0x1bae('0x25')](function(_0x4fd1ab){logger[_0x1bae('0x62')](util[_0x1bae('0x4e')](_0x1bae('0x73'),_0x5dbc80,_0x4fd1ab[_0x1bae('0x74')][_0x1bae('0x75')]));_0x2ceba5[_0x1bae('0x76')]=_0x4fd1ab['TranscriptionJob'][_0x1bae('0x75')];_0x2ceba5['transcribeStatus']=_0x4fd1ab[_0x1bae('0x74')]['TranscriptionJobStatus'];return _0x36766e(_0x2ceba5);})['catch'](function(_0xb88683){return _0x3eafae(_0xb88683);});});}exports[_0x1bae('0x77')]=function(_0x5c1ce3,_0x1a86d8,_0x1529dc){var _0x1e9b47;var _0x20b4ec;var _0x509a5;var _0x5ae008=require(_0x1bae('0x4b'));return db[_0x1bae('0x2a')]['findOne']({'where':{'id':_0x5c1ce3['params']['id']}})['then'](function(_0x74db75){if(_0x74db75){var _0x26aeec=util[_0x1bae('0x4e')](_0x1bae('0x4f'),_0x74db75[_0x1bae('0x4d')]);if(fs[_0x1bae('0x50')](_0x26aeec)){cypher=!![];return _0x5ae008[_0x1bae('0x5e')](_0x26aeec,_0x74db75['value'],config[_0x1bae('0x51')]['recording'])['then'](function(){return _0x74db75;});}return _0x74db75;}})['then'](function(_0x46c240){if(!_0x46c240){throw new db[(_0x1bae('0x53'))][(_0x1bae('0x5f'))]('Voice\x20Recording\x20not\x20found');}_0x20b4ec=_0x46c240;return db['Setting'][_0x1bae('0x78')]({'where':{'id':0x1}});})[_0x1bae('0x25')](handleEntityNotFound(_0x1a86d8,null))['then'](function(_0x5cba8a){if(_0x5cba8a){_0x1e9b47=_0x5cba8a;if(!_0x1e9b47[_0x1bae('0x79')]||!_0x1e9b47[_0x1bae('0x7a')]||!_0x1e9b47['transcribeRegion']||!_0x1e9b47['language']||!_0x1e9b47[_0x1bae('0x6f')]){throw new db['Sequelize'][(_0x1bae('0x5f'))](_0x1bae('0x7b'));}if(_0x5c1ce3[_0x1bae('0x46')][_0x1bae('0x7c')]&&(!_0x1e9b47['sentiment']||!_0x1e9b47[_0x1bae('0x7d')]||!_0x1e9b47[_0x1bae('0x7e')]||!_0x1e9b47['language']||!_0x1e9b47[_0x1bae('0x6f')])){throw new db[(_0x1bae('0x53'))][(_0x1bae('0x5f'))](_0x1bae('0x7f'));}return db['CloudProvider'][_0x1bae('0x78')]({'where':{'id':_0x1e9b47[_0x1bae('0x7a')]}});}})[_0x1bae('0x25')](function(_0x5f4a03){if(!_0x5f4a03){throw new db['Sequelize'][(_0x1bae('0x5f'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x5f4a03[_0x1bae('0x80')]||!_0x5f4a03['data2']){throw new db['Sequelize'][(_0x1bae('0x5f'))]('Cloud\x20Provider\x20not\x20configured');}_0x509a5=_0x5f4a03;return getBucketslist(_0x509a5[_0x1bae('0x80')],_0x509a5[_0x1bae('0x81')],_0x1e9b47[_0x1bae('0x82')]);})[_0x1bae('0x25')](function(_0xad7810){if(_0xad7810&&_0xad7810['Buckets']){var _0x4512d4=_[_0x1bae('0x47')](_0xad7810[_0x1bae('0x83')],function(_0x47a1e9){return _0x47a1e9[_0x1bae('0x84')]===_0x1e9b47[_0x1bae('0x6f')];});if(!_0x4512d4){logger[_0x1bae('0x62')](util['format'](_0x1bae('0x85'),_0x5c1ce3[_0x1bae('0x48')]['id'],_0x1e9b47['bucket']));return createBucket(_0x509a5[_0x1bae('0x80')],_0x509a5['data2'],_0x1e9b47['transcribeRegion'],_0x1e9b47[_0x1bae('0x6f')]);}logger[_0x1bae('0x62')](util[_0x1bae('0x4e')](_0x1bae('0x86'),_0x5c1ce3[_0x1bae('0x48')]['id'],_0x1e9b47[_0x1bae('0x6f')]));return;}})[_0x1bae('0x25')](function(_0x459f13){if(_0x20b4ec[_0x1bae('0x87')]===_0x1bae('0x88')){return transcribe(_0x5c1ce3[_0x1bae('0x48')]['id'],_0x509a5[_0x1bae('0x80')],_0x509a5['data2'],_0x1e9b47[_0x1bae('0x82')],_0x1e9b47[_0x1bae('0x6f')],_0x20b4ec[_0x1bae('0x4d')],_0x1e9b47[_0x1bae('0x89')]);}else{logger[_0x1bae('0x62')](util[_0x1bae('0x4e')]('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x5c1ce3['params']['id']));return{'transcribeStatus':_0x1bae('0x8a')};}})['then'](function(_0x1705cd){if(_0x1705cd){_0x1705cd[_0x1bae('0x8b')]=_0x5c1ce3['body'][_0x1bae('0x7c')];return _0x20b4ec['updateAttributes'](_0x1705cd);}})[_0x1bae('0x25')](respondWithResult(_0x1a86d8,null))[_0x1bae('0x44')](handleError(_0x1a86d8,null));};function writeFile(_0x5b433d,_0x2fd567){return new Promise(function(_0x5ba630,_0x359e67){fs[_0x1bae('0x8c')](_0x2fd567,_0x5b433d,function(_0x53bf23,_0x9fcf2d){if(_0x53bf23){return _0x359e67(_0x53bf23);}else{return _0x5ba630(_0x9fcf2d);}});});}exports['downloadTranscribe']=function(_0x3b5803,_0x3a893a,_0x33964e){return db[_0x1bae('0x2a')][_0x1bae('0x78')]({'where':{'id':_0x3b5803[_0x1bae('0x48')]['id']}})[_0x1bae('0x25')](handleEntityNotFound(_0x3a893a))[_0x1bae('0x25')](function(_0x200ca4){if(_0x200ca4&&_0x200ca4['fileText']){var _0x1f7f9=_0x200ca4['fileText'];var _0x4b6a1b=config[_0x1bae('0x8d')]+'/server/files/transcribes/transcribe_'+_0x200ca4['id']+_0x1bae('0x8e');if(fs[_0x1bae('0x50')](_0x4b6a1b)){return _0x4b6a1b;}return writeFile(_0x1f7f9,_0x4b6a1b)[_0x1bae('0x25')](function(){return _0x4b6a1b;});}else{throw new db[(_0x1bae('0x53'))][(_0x1bae('0x5f'))](_0x1bae('0x8f'));}})[_0x1bae('0x25')](function(_0x10c210){return _0x3a893a[_0x1bae('0x4a')](_0x10c210);})[_0x1bae('0x44')](handleError(_0x3a893a));}; \ No newline at end of file +var _0x7c94=['recording','ValidationError','destroy','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','unlinkSync','.cypher','listBuckets','createBucket','upload','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','location','Location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJobName','transcribeName','TranscriptionJob','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','Setting','transcribe','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Buckets','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','fileText','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','rimraf','request-promise','moment','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','uuid/v4','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','count','limit','set','Content-Range','json','apply','save','then','error','stack','name','send','index','map','VoiceRecording','rawAttributes','type','key','model','format','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','intersection','create','body','update','find','describe','uniqueid','value','existsSync','decryptFile','secrets','Sequelize','VoiceRecording\x20not\x20found','filename','download','extname','unlink','message','Not\x20found','downloads','../../components/encryptor','sequelize','token','push','$and','%s.cypher'];(function(_0x4ca7b7,_0x546d63){var _0x39bf8d=function(_0xd5e9d9){while(--_0xd5e9d9){_0x4ca7b7['push'](_0x4ca7b7['shift']());}};_0x39bf8d(++_0x546d63);}(_0x7c94,0x167));var _0x47c9=function(_0x560ace,_0x244b87){_0x560ace=_0x560ace-0x0;var _0x316a3e=_0x7c94[_0x560ace];return _0x316a3e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x47c9('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x47c9('0x1'));var moment=require(_0x47c9('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x47c9('0x3'));var util=require(_0x47c9('0x4'));var path=require('path');var sox=require(_0x47c9('0x5'));var csv=require('to-csv');var ejs=require(_0x47c9('0x6'));var fs=require('fs');var fs_extra=require(_0x47c9('0x7'));var _=require(_0x47c9('0x8'));var squel=require(_0x47c9('0x9'));var crypto=require(_0x47c9('0xa'));var jsforce=require(_0x47c9('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x47c9('0xc'));var Papa=require('papaparse');var AWS=require('aws-sdk');var uuidv4=require(_0x47c9('0xd'));var Redis=require('ioredis');var authService=require(_0x47c9('0xe'));var qs=require(_0x47c9('0xf'));var as=require(_0x47c9('0x10'));var hardwareService=require(_0x47c9('0x11'));var logger=require('../../config/logger')(_0x47c9('0x12'));var utils=require('../../config/utils');var config=require(_0x47c9('0x13'));var licenseUtil=require(_0x47c9('0x14'));var db=require(_0x47c9('0x15'))['db'];function respondWithStatusCode(_0xf33d1b,_0x493e2c){_0x493e2c=_0x493e2c||0xcc;return function(_0xe4a27a){if(_0xe4a27a){return _0xf33d1b[_0x47c9('0x16')](_0x493e2c);}return _0xf33d1b['status'](_0x493e2c)[_0x47c9('0x17')]();};}function respondWithResult(_0x4f08a9,_0x43f072){_0x43f072=_0x43f072||0xc8;return function(_0x57565a){if(_0x57565a){return _0x4f08a9[_0x47c9('0x18')](_0x43f072)['json'](_0x57565a);}};}function respondWithFilteredResult(_0x529b00,_0x25def6){return function(_0x118462){if(_0x118462){var _0x4eb2ec=typeof _0x25def6[_0x47c9('0x19')]===_0x47c9('0x1a')&&typeof _0x25def6['limit']===_0x47c9('0x1a');var _0x2087c7=_0x118462[_0x47c9('0x1b')];var _0x411d77=_0x4eb2ec?0x0:_0x25def6[_0x47c9('0x19')];var _0x2ae488=_0x4eb2ec?_0x118462['count']:_0x25def6[_0x47c9('0x19')]+_0x25def6[_0x47c9('0x1c')];var _0x899e0b;if(_0x2ae488>=_0x2087c7){_0x2ae488=_0x2087c7;_0x899e0b=0xc8;}else{_0x899e0b=0xce;}_0x529b00[_0x47c9('0x18')](_0x899e0b);return _0x529b00[_0x47c9('0x1d')](_0x47c9('0x1e'),_0x411d77+'-'+_0x2ae488+'/'+_0x2087c7)[_0x47c9('0x1f')](_0x118462);}return null;};}function patchUpdates(_0x20381a){return function(_0x551a60){try{jsonpatch[_0x47c9('0x20')](_0x551a60,_0x20381a,!![]);}catch(_0x59f5b7){return BPromise['reject'](_0x59f5b7);}return _0x551a60[_0x47c9('0x21')]();};}function saveUpdates(_0x23ad46,_0x545067){return function(_0x4197d1){if(_0x4197d1){return _0x4197d1['update'](_0x23ad46)['then'](function(_0x3489ad){return _0x3489ad;});}return null;};}function removeEntity(_0x4ec992,_0x3d49fa){return function(_0x1ceb06){if(_0x1ceb06){return _0x1ceb06['destroy']()[_0x47c9('0x22')](function(){_0x4ec992['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x134c76,_0x43d416){return function(_0x24cb53){if(!_0x24cb53){_0x134c76[_0x47c9('0x16')](0x194);}return _0x24cb53;};}function handleError(_0x1db1aa,_0x5c84e3){_0x5c84e3=_0x5c84e3||0x1f4;return function(_0x240796){logger[_0x47c9('0x23')](_0x240796[_0x47c9('0x24')]);if(_0x240796[_0x47c9('0x25')]){delete _0x240796['name'];}_0x1db1aa[_0x47c9('0x18')](_0x5c84e3)[_0x47c9('0x26')](_0x240796);};}exports[_0x47c9('0x27')]=function(_0x188e68,_0x451c40){var _0x55ab02={},_0x436d89={},_0xf271ac={'count':0x0,'rows':[]};var _0x2f3fa3=_[_0x47c9('0x28')](db[_0x47c9('0x29')][_0x47c9('0x2a')],function(_0x543526){return{'name':_0x543526['fieldName'],'type':_0x543526[_0x47c9('0x2b')][_0x47c9('0x2c')]};});_0x436d89[_0x47c9('0x2d')]=_['differenceBy'](_[_0x47c9('0x28')](_0x2f3fa3,_0x47c9('0x25')),[_0x47c9('0x2e')]);_0x436d89[_0x47c9('0x2f')]=_[_0x47c9('0x30')](_0x188e68[_0x47c9('0x2f')]);_0x436d89[_0x47c9('0x31')]=_['intersection'](_0x436d89[_0x47c9('0x2d')],_0x436d89[_0x47c9('0x2f')]);_0x55ab02[_0x47c9('0x32')]=_['intersection'](_0x436d89[_0x47c9('0x2d')],qs[_0x47c9('0x33')](_0x188e68[_0x47c9('0x2f')]['fields']));_0x55ab02[_0x47c9('0x32')]=_0x55ab02[_0x47c9('0x32')][_0x47c9('0x34')]?_0x55ab02[_0x47c9('0x32')]:_0x436d89[_0x47c9('0x2d')];if(!_0x188e68[_0x47c9('0x2f')][_0x47c9('0x35')](_0x47c9('0x36'))){_0x55ab02['limit']=qs['limit'](_0x188e68[_0x47c9('0x2f')][_0x47c9('0x1c')]);_0x55ab02[_0x47c9('0x19')]=qs[_0x47c9('0x19')](_0x188e68[_0x47c9('0x2f')][_0x47c9('0x19')]);}_0x55ab02['order']=qs[_0x47c9('0x37')](_0x188e68[_0x47c9('0x2f')][_0x47c9('0x37')]);_0x55ab02[_0x47c9('0x38')]=qs[_0x47c9('0x31')](_[_0x47c9('0x39')](_0x188e68[_0x47c9('0x2f')],_0x436d89[_0x47c9('0x31')]),_0x2f3fa3);if(_0x188e68[_0x47c9('0x2f')][_0x47c9('0x3a')]){_0x55ab02['where']=_[_0x47c9('0x3b')](_0x55ab02[_0x47c9('0x38')],{'$or':_[_0x47c9('0x28')](_0x2f3fa3,function(_0x4ce652){if(_0x4ce652[_0x47c9('0x2b')]!==_0x47c9('0x3c')){var _0x494981={};_0x494981[_0x4ce652[_0x47c9('0x25')]]={'$like':'%'+_0x188e68[_0x47c9('0x2f')][_0x47c9('0x3a')]+'%'};return _0x494981;}})});}_0x55ab02=_['merge']({},_0x55ab02,_0x188e68[_0x47c9('0x3d')]);var _0x30ca47={'where':_0x55ab02['where']};return db[_0x47c9('0x29')][_0x47c9('0x1b')](_0x30ca47)['then'](function(_0x2176f2){_0xf271ac[_0x47c9('0x1b')]=_0x2176f2;if(_0x188e68[_0x47c9('0x2f')][_0x47c9('0x3e')]){_0x55ab02[_0x47c9('0x3f')]=[{'all':!![]}];}return db['VoiceRecording']['findAll'](_0x55ab02);})['then'](function(_0x2d4af7){_0xf271ac[_0x47c9('0x40')]=_0x2d4af7;return _0xf271ac;})[_0x47c9('0x22')](respondWithFilteredResult(_0x451c40,_0x55ab02))[_0x47c9('0x41')](handleError(_0x451c40,null));};exports[_0x47c9('0x42')]=function(_0x431927,_0x2d5ffd){var _0x4fce7d={'raw':![],'where':{'id':_0x431927[_0x47c9('0x43')]['id']}},_0x2cab={};_0x2cab[_0x47c9('0x2d')]=_[_0x47c9('0x30')](db[_0x47c9('0x29')][_0x47c9('0x2a')]);_0x2cab['query']=_['keys'](_0x431927[_0x47c9('0x2f')]);_0x2cab[_0x47c9('0x31')]=_[_0x47c9('0x44')](_0x2cab['model'],_0x2cab[_0x47c9('0x2f')]);_0x4fce7d[_0x47c9('0x32')]=_[_0x47c9('0x44')](_0x2cab['model'],qs['fields'](_0x431927[_0x47c9('0x2f')][_0x47c9('0x33')]));_0x4fce7d[_0x47c9('0x32')]=_0x4fce7d[_0x47c9('0x32')][_0x47c9('0x34')]?_0x4fce7d[_0x47c9('0x32')]:_0x2cab[_0x47c9('0x2d')];if(_0x431927[_0x47c9('0x2f')]['includeAll']){_0x4fce7d[_0x47c9('0x3f')]=[{'all':!![]}];}_0x4fce7d=_[_0x47c9('0x3b')]({},_0x4fce7d,_0x431927[_0x47c9('0x3d')]);return db[_0x47c9('0x29')]['find'](_0x4fce7d)[_0x47c9('0x22')](handleEntityNotFound(_0x2d5ffd,null))[_0x47c9('0x22')](respondWithResult(_0x2d5ffd,null))[_0x47c9('0x41')](handleError(_0x2d5ffd,null));};exports[_0x47c9('0x45')]=function(_0x2c9494,_0x4a6af5){return db[_0x47c9('0x29')][_0x47c9('0x45')](_0x2c9494[_0x47c9('0x46')],{})[_0x47c9('0x22')](respondWithResult(_0x4a6af5,0xc9))[_0x47c9('0x41')](handleError(_0x4a6af5,null));};exports[_0x47c9('0x47')]=function(_0x355822,_0x135d66){if(_0x355822[_0x47c9('0x46')]['id']){delete _0x355822[_0x47c9('0x46')]['id'];}return db['VoiceRecording'][_0x47c9('0x48')]({'where':{'id':_0x355822[_0x47c9('0x43')]['id']}})[_0x47c9('0x22')](handleEntityNotFound(_0x135d66,null))[_0x47c9('0x22')](saveUpdates(_0x355822[_0x47c9('0x46')],null))['then'](respondWithResult(_0x135d66,null))[_0x47c9('0x41')](handleError(_0x135d66,null));};exports['describe']=function(_0x4c7261,_0x35453a){return db[_0x47c9('0x29')][_0x47c9('0x49')]()[_0x47c9('0x22')](respondWithResult(_0x35453a,null))[_0x47c9('0x41')](handleError(_0x35453a,null));};exports['download']=function(_0x1f2058,_0x558490,_0x928db){var _0x55db78=require('../../components/encryptor');var _0x45f0ca=![];var _0xa94c79={};if(_0x1f2058['query']['type']&&_0x1f2058[_0x47c9('0x2f')][_0x47c9('0x2b')]===_0x47c9('0x4a')){_0xa94c79[_0x47c9('0x4a')]=_0x1f2058['params']['id'];}else{_0xa94c79['id']=_0x1f2058[_0x47c9('0x43')]['id'];}return db[_0x47c9('0x29')]['find']({'where':_0xa94c79,'attributes':['id','value'],'raw':!![]})[_0x47c9('0x22')](handleEntityNotFound(_0x558490,null))[_0x47c9('0x22')](function(_0x5519a1){if(_0x5519a1){var _0x3996af=_0x5519a1[_0x47c9('0x4b')];var _0x1b96a4=util[_0x47c9('0x2e')]('%s.cypher',_0x3996af);if(fs[_0x47c9('0x4c')](_0x1b96a4)){_0x45f0ca=!![];return _0x55db78[_0x47c9('0x4d')](_0x1b96a4,_0x3996af,config[_0x47c9('0x4e')]['recording'])['then'](function(){return _0x5519a1;});}return _0x5519a1;}})[_0x47c9('0x22')](function(_0x5ea557){if(_0x5ea557){var _0x292c1d=_0x5ea557[_0x47c9('0x4b')];if(!fs[_0x47c9('0x4c')](_0x292c1d)){throw new db[(_0x47c9('0x4f'))]['ValidationError'](_0x47c9('0x50'));}if(_0x5ea557[_0x47c9('0x51')]){return _0x558490[_0x47c9('0x52')](_0x292c1d,_0x5ea557[_0x47c9('0x51')]+path[_0x47c9('0x53')](_0x292c1d),function(){if(_0x45f0ca){fs['unlink'](_0x292c1d);}});}else{return _0x558490['download'](_0x292c1d,function(_0x1b10b5){if(_0x45f0ca){fs[_0x47c9('0x54')](_0x292c1d);}});}}})['catch'](function(_0x4ed7fd){if(_0x4ed7fd[_0x47c9('0x55')]===_0x47c9('0x50')){_0x558490[_0x47c9('0x18')](0x194)[_0x47c9('0x26')](_0x47c9('0x56'));}else{return handleError(_0x558490,null);}});};exports[_0x47c9('0x57')]=function(_0x371be0,_0x4ba064,_0xe4c7ff){var _0xd2f054=require(_0x47c9('0x58'));var _0x51ffe2=![];var _0x319e7f={'$and':[db[_0x47c9('0x59')]['where'](db[_0x47c9('0x59')]['fn']('MD5',db[_0x47c9('0x59')]['col'](_0x47c9('0x4a'))),_0x371be0[_0x47c9('0x2f')][_0x47c9('0x5a')])]};if(_0x371be0['query'][_0x47c9('0x2b')]&&_0x371be0[_0x47c9('0x2f')][_0x47c9('0x2b')]===_0x47c9('0x4a')){_0x319e7f['$and'][_0x47c9('0x5b')]({'uniqueid':_0x371be0[_0x47c9('0x43')]['id']});}else{_0x319e7f[_0x47c9('0x5c')][_0x47c9('0x5b')]({'id':_0x371be0[_0x47c9('0x43')]['id']});}return db[_0x47c9('0x29')][_0x47c9('0x48')]({'where':_0x319e7f,'attributes':['id',_0x47c9('0x4b')],'raw':!![]})[_0x47c9('0x22')](handleEntityNotFound(_0x4ba064,null))[_0x47c9('0x22')](function(_0x50ed45){if(_0x50ed45){var _0x3a26b1=util[_0x47c9('0x2e')](_0x47c9('0x5d'),_0x50ed45[_0x47c9('0x4b')]);if(fs['existsSync'](_0x3a26b1)){_0x51ffe2=!![];return _0xd2f054[_0x47c9('0x4d')](_0x3a26b1,_0x50ed45[_0x47c9('0x4b')],config['secrets'][_0x47c9('0x5e')])['then'](function(){return _0x50ed45;});}return _0x50ed45;}})[_0x47c9('0x22')](function(_0x46be59){if(_0x46be59){if(!fs['existsSync'](_0x46be59[_0x47c9('0x4b')])){throw new db[(_0x47c9('0x4f'))][(_0x47c9('0x5f'))](_0x47c9('0x50'));}if(_0x46be59[_0x47c9('0x51')]){return _0x4ba064[_0x47c9('0x52')](_0x46be59['value'],_0x46be59[_0x47c9('0x51')]+path[_0x47c9('0x53')](_0x46be59[_0x47c9('0x4b')]),function(){if(_0x51ffe2){fs['unlink'](_0x46be59[_0x47c9('0x4b')]);}});}else{return _0x4ba064[_0x47c9('0x52')](_0x46be59[_0x47c9('0x4b')],function(_0x5909fe){if(_0x51ffe2){fs[_0x47c9('0x54')](_0x46be59[_0x47c9('0x4b')]);}});}}})['catch'](handleError(_0x4ba064,null));};exports[_0x47c9('0x60')]=function(_0x74683,_0x2aefc5){return db['VoiceRecording'][_0x47c9('0x48')]({'where':{'id':_0x74683[_0x47c9('0x43')]['id']}})[_0x47c9('0x22')](function(_0x44ecf0){if(_[_0x47c9('0x61')](_0x44ecf0)){throw new ReferenceError(_0x47c9('0x62'));}return _0x44ecf0;})[_0x47c9('0x22')](function(_0xa3bf2f){var _0x560f85=_0xa3bf2f['value'];logger[_0x47c9('0x63')](_0x47c9('0x64'),_0x560f85);if(!_[_0x47c9('0x61')](_0xa3bf2f[_0x47c9('0x4b')])&&fs[_0x47c9('0x4c')](_0x560f85)){logger[_0x47c9('0x63')](_0x47c9('0x65')+_0x560f85+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x47c9('0x66')](_0x560f85);}_0x560f85=_0x560f85+_0x47c9('0x67');if(!_[_0x47c9('0x61')](_0xa3bf2f[_0x47c9('0x4b')])&&fs['existsSync'](_0x560f85)){logger['info']('File:\x20\x22'+_0x560f85+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x47c9('0x66')](_0x560f85);}return _0xa3bf2f;})[_0x47c9('0x22')](function(_0x24a471){if(!_0x24a471)throw new InternalError();return _0x24a471['destroy']();})[_0x47c9('0x22')](function(){_0x2aefc5[_0x47c9('0x18')](0xcc)[_0x47c9('0x17')]();})[_0x47c9('0x41')](handleError(_0x2aefc5,null));};function getBucketslist(_0x1aed6a,_0x361592,_0x5ef59f){return new Promise(function(_0x3778e7,_0x25b8bb){var _0x1ffd73=new AWS['S3']({'accessKeyId':_0x361592,'secretAccessKey':_0x1aed6a,'region':_0x5ef59f});_0x1ffd73[_0x47c9('0x68')]({},function(_0x8f08d6,_0x4d53e2){if(_0x8f08d6){return _0x25b8bb(_0x8f08d6);}else{return _0x3778e7(_0x4d53e2);}});});}function createBucket(_0x19f87f,_0x3b7d29,_0x4141c2,_0x3910b2){return new Promise(function(_0x2946fa,_0x35bb1e){var _0x15396f=new AWS['S3']({'accessKeyId':_0x3b7d29,'secretAccessKey':_0x19f87f,'region':_0x4141c2});_0x15396f[_0x47c9('0x69')]({'Bucket':_0x3910b2},function(_0xd8ab0f,_0x3d3de2){if(_0xd8ab0f){return _0x35bb1e(_0xd8ab0f);}else{return _0x2946fa(_0x3d3de2);}});});}function uploadFile(_0x86dd58,_0x392ca5,_0x6d0995,_0x424fb3,_0x43bd94,_0xea22c4){return new Promise(function(_0x3a9e7d,_0x2aa463){var _0x35abb6=new AWS['S3']({'accessKeyId':_0x392ca5,'secretAccessKey':_0x86dd58,'region':_0x6d0995});_0x35abb6[_0x47c9('0x6a')]({'Bucket':_0x424fb3,'Key':_0x43bd94,'Body':_0xea22c4},function(_0x3b1a8a,_0x2bc615){if(_0x3b1a8a){return _0x2aa463(_0x3b1a8a);}else{return _0x3a9e7d(_0x2bc615);}});});}function startTranscribe(_0x12d1fd,_0x2cef8c,_0x31cc63,_0x414e4f,_0x3efc00,_0x381433){return new Promise(function(_0xbacf1e,_0x2a99df){var _0x3078a0=new AWS[(_0x47c9('0x6b'))]({'accessKeyId':_0x2cef8c,'secretAccessKey':_0x12d1fd,'region':_0x31cc63});_0x3078a0[_0x47c9('0x6c')]({'TranscriptionJobName':_0x414e4f,'LanguageCode':_0x3efc00,'Media':{'MediaFileUri':_0x381433}},function(_0x32403f,_0xc22f1e){if(_0x32403f){return _0x2a99df(_0x32403f);}else{return _0xbacf1e(_0xc22f1e);}});});}function transcribe(_0x12d24b,_0x658432,_0x534d55,_0xb88245,_0x1537a8,_0x1c9608,_0x261450){return new Promise(function(_0x540fb9,_0x57f9ee){var _0x24e69c={};logger['info'](util[_0x47c9('0x2e')](_0x47c9('0x6d'),_0x12d24b,_0x1537a8));return uploadFile(_0x658432,_0x534d55,_0xb88245,_0x1537a8,path[_0x47c9('0x6e')](_0x1c9608),fs[_0x47c9('0x6f')](_0x1c9608))[_0x47c9('0x22')](function(_0xfe9286){logger[_0x47c9('0x63')](util[_0x47c9('0x2e')](_0x47c9('0x70'),_0x12d24b,_0x1537a8,_0xfe9286['Location']));_0x24e69c[_0x47c9('0x71')]=_0xfe9286['Bucket'];_0x24e69c[_0x47c9('0x72')]=_0xfe9286[_0x47c9('0x73')];logger[_0x47c9('0x63')](util[_0x47c9('0x2e')](_0x47c9('0x74'),_0x12d24b));return startTranscribe(_0x658432,_0x534d55,_0xb88245,uuidv4(),_0x261450,_0xfe9286[_0x47c9('0x73')]);})[_0x47c9('0x22')](function(_0x468760){logger[_0x47c9('0x63')](util[_0x47c9('0x2e')](_0x47c9('0x75'),_0x12d24b,_0x468760['TranscriptionJob'][_0x47c9('0x76')]));_0x24e69c[_0x47c9('0x77')]=_0x468760[_0x47c9('0x78')][_0x47c9('0x76')];_0x24e69c[_0x47c9('0x79')]=_0x468760['TranscriptionJob'][_0x47c9('0x7a')];return _0x540fb9(_0x24e69c);})[_0x47c9('0x41')](function(_0x155476){return _0x57f9ee(_0x155476);});});}exports[_0x47c9('0x7b')]=function(_0x1e57ca,_0x31b377,_0x5d9986){var _0x579b2c;var _0x293115;var _0x108748;var _0x313c92=require('../../components/encryptor');return db[_0x47c9('0x29')][_0x47c9('0x7c')]({'where':{'id':_0x1e57ca[_0x47c9('0x43')]['id']}})[_0x47c9('0x22')](function(_0x1a1920){if(_0x1a1920){var _0x3634ea=util[_0x47c9('0x2e')]('%s.cypher',_0x1a1920[_0x47c9('0x4b')]);if(fs[_0x47c9('0x4c')](_0x3634ea)){cypher=!![];return _0x313c92[_0x47c9('0x4d')](_0x3634ea,_0x1a1920[_0x47c9('0x4b')],config['secrets'][_0x47c9('0x5e')])['then'](function(){return _0x1a1920;});}return _0x1a1920;}})[_0x47c9('0x22')](function(_0x70db79){if(!_0x70db79){throw new db[(_0x47c9('0x4f'))]['ValidationError']('Voice\x20Recording\x20not\x20found');}_0x293115=_0x70db79;return db[_0x47c9('0x7d')][_0x47c9('0x7c')]({'where':{'id':0x1}});})[_0x47c9('0x22')](handleEntityNotFound(_0x31b377,null))[_0x47c9('0x22')](function(_0x180f90){if(_0x180f90){_0x579b2c=_0x180f90;if(!_0x579b2c[_0x47c9('0x7e')]||!_0x579b2c[_0x47c9('0x7f')]||!_0x579b2c[_0x47c9('0x80')]||!_0x579b2c[_0x47c9('0x81')]||!_0x579b2c[_0x47c9('0x71')]){throw new db[(_0x47c9('0x4f'))][(_0x47c9('0x5f'))](_0x47c9('0x82'));}if(_0x1e57ca[_0x47c9('0x46')][_0x47c9('0x83')]&&(!_0x579b2c[_0x47c9('0x84')]||!_0x579b2c['sentimentAccountId']||!_0x579b2c[_0x47c9('0x85')]||!_0x579b2c['language']||!_0x579b2c[_0x47c9('0x71')])){throw new db[(_0x47c9('0x4f'))][(_0x47c9('0x5f'))](_0x47c9('0x86'));}return db[_0x47c9('0x87')][_0x47c9('0x7c')]({'where':{'id':_0x579b2c['transcribeAccountId']}});}})[_0x47c9('0x22')](function(_0x489cc6){if(!_0x489cc6){throw new db[(_0x47c9('0x4f'))]['ValidationError'](_0x47c9('0x88'));}if(!_0x489cc6[_0x47c9('0x89')]||!_0x489cc6[_0x47c9('0x8a')]){throw new db['Sequelize'][(_0x47c9('0x5f'))]('Cloud\x20Provider\x20not\x20configured');}_0x108748=_0x489cc6;return getBucketslist(_0x108748[_0x47c9('0x89')],_0x108748[_0x47c9('0x8a')],_0x579b2c[_0x47c9('0x80')]);})[_0x47c9('0x22')](function(_0x4e3f12){if(_0x4e3f12&&_0x4e3f12[_0x47c9('0x8b')]){var _0x408789=_[_0x47c9('0x48')](_0x4e3f12[_0x47c9('0x8b')],function(_0x1be79b){return _0x1be79b['Name']===_0x579b2c[_0x47c9('0x71')];});if(!_0x408789){logger['info'](util[_0x47c9('0x2e')](_0x47c9('0x8c'),_0x1e57ca[_0x47c9('0x43')]['id'],_0x579b2c[_0x47c9('0x71')]));return createBucket(_0x108748['data1'],_0x108748[_0x47c9('0x8a')],_0x579b2c[_0x47c9('0x80')],_0x579b2c[_0x47c9('0x71')]);}logger['info'](util['format'](_0x47c9('0x8d'),_0x1e57ca[_0x47c9('0x43')]['id'],_0x579b2c[_0x47c9('0x71')]));return;}})[_0x47c9('0x22')](function(_0x5d19a2){if(_0x293115[_0x47c9('0x79')]===_0x47c9('0x8e')){return transcribe(_0x1e57ca['params']['id'],_0x108748[_0x47c9('0x89')],_0x108748[_0x47c9('0x8a')],_0x579b2c[_0x47c9('0x80')],_0x579b2c['bucket'],_0x293115['value'],_0x579b2c[_0x47c9('0x81')]);}else{logger[_0x47c9('0x63')](util['format'](_0x47c9('0x8f'),_0x1e57ca[_0x47c9('0x43')]['id']));return{'transcribeStatus':_0x47c9('0x90')};}})[_0x47c9('0x22')](function(_0x415902){if(_0x415902){_0x415902[_0x47c9('0x91')]=_0x1e57ca['body']['runSentiment'];return _0x293115['updateAttributes'](_0x415902);}})[_0x47c9('0x22')](respondWithResult(_0x31b377,null))[_0x47c9('0x41')](handleError(_0x31b377,null));};function writeFile(_0x1d0e61,_0x12ee35){return new Promise(function(_0x283b78,_0x1af9a8){fs['writeFile'](_0x12ee35,_0x1d0e61,function(_0x44044d,_0x529002){if(_0x44044d){return _0x1af9a8(_0x44044d);}else{return _0x283b78(_0x529002);}});});}exports['downloadTranscribe']=function(_0x26fac4,_0x197edf,_0x4258e4){return db[_0x47c9('0x29')]['findOne']({'where':{'id':_0x26fac4[_0x47c9('0x43')]['id']}})[_0x47c9('0x22')](handleEntityNotFound(_0x197edf))[_0x47c9('0x22')](function(_0x20563b){if(_0x20563b&&_0x20563b['fileText']){var _0x2d0483=_0x20563b[_0x47c9('0x92')];var _0xa0b5a9=config[_0x47c9('0x93')]+_0x47c9('0x94')+_0x20563b['id']+_0x47c9('0x95');if(fs[_0x47c9('0x4c')](_0xa0b5a9)){return _0xa0b5a9;}return writeFile(_0x2d0483,_0xa0b5a9)[_0x47c9('0x22')](function(){return _0xa0b5a9;});}else{throw new db[(_0x47c9('0x4f'))]['ValidationError'](_0x47c9('0x96'));}})[_0x47c9('0x22')](function(_0x838f21){return _0x197edf[_0x47c9('0x52')](_0x838f21);})[_0x47c9('0x41')](handleError(_0x197edf));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index b3ad9c9..6bb83c3 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 _0x2b37=['define','VoiceRecording','voice_recordings','uniqueid','transcribeStatus','./voiceRecording.attributes','exports'];(function(_0x181707,_0x47d753){var _0x1d2b7a=function(_0x508991){while(--_0x508991){_0x181707['push'](_0x181707['shift']());}};_0x1d2b7a(++_0x47d753);}(_0x2b37,0x12b));var _0x72b3=function(_0x34acae,_0x1472d8){_0x34acae=_0x34acae-0x0;var _0x2d475f=_0x2b37[_0x34acae];return _0x2d475f;};'use strict';var attributes=require(_0x72b3('0x0'));module[_0x72b3('0x1')]=function(_0x3fbc04,_0x22f924){return _0x3fbc04[_0x72b3('0x2')](_0x72b3('0x3'),attributes,{'tableName':_0x72b3('0x4'),'paranoid':![],'indexes':[{'name':_0x72b3('0x5'),'fields':[_0x72b3('0x5')]},{'name':_0x72b3('0x6'),'fields':['transcribeStatus']}],'timestamps':!![]});}; \ No newline at end of file +var _0x8d9b=['./voiceRecording.attributes','exports','define','uniqueid','transcribeStatus'];(function(_0x22e529,_0x380432){var _0x1f13f9=function(_0x1b58c7){while(--_0x1b58c7){_0x22e529['push'](_0x22e529['shift']());}};_0x1f13f9(++_0x380432);}(_0x8d9b,0x104));var _0xb8d9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8d9b[_0x3dd15e];return _0x231fd0;};'use strict';var attributes=require(_0xb8d9('0x0'));module[_0xb8d9('0x1')]=function(_0x2a3616,_0x8360b6){return _0x2a3616[_0xb8d9('0x2')]('VoiceRecording',attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':_0xb8d9('0x3'),'fields':['uniqueid']},{'name':_0xb8d9('0x4'),'fields':[_0xb8d9('0x4')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index e90f236..4dd773c 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 _0x7096=['raw','where','attributes','limit','CreateVoiceRecording','../../components/encryptor','findOne','create','existsSync','format','encryptFile','value','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','UpdateVoiceRecording','VoiceRecording','body','options'];(function(_0x446026,_0x22647e){var _0x1b4681=function(_0x37503b){while(--_0x37503b){_0x446026['push'](_0x446026['shift']());}};_0x1b4681(++_0x22647e);}(_0x7096,0x10c));var _0x6709=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0x7096[_0x4baae2];return _0x1a2285;};'use strict';var _=require('lodash');var util=require(_0x6709('0x0'));var moment=require('moment');var BPromise=require(_0x6709('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6709('0x2'));var db=require(_0x6709('0x3'))['db'];var utils=require(_0x6709('0x4'));var logger=require(_0x6709('0x5'))(_0x6709('0x6'));var config=require(_0x6709('0x7'));var jayson=require(_0x6709('0x8'));var client=jayson[_0x6709('0x9')][_0x6709('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3e2223,_0x11ad23,_0x985814){return new BPromise(function(_0x30147f,_0x513ab6){return client['request'](_0x3e2223,_0x985814)[_0x6709('0xb')](function(_0x2d8c0b){logger[_0x6709('0xc')](_0x6709('0xd'),_0x11ad23,_0x6709('0xe'));logger[_0x6709('0xf')]('VoiceRecording,\x20%s,\x20%s,\x20%s',_0x11ad23,'request\x20sent',JSON[_0x6709('0x10')](_0x2d8c0b));if(_0x2d8c0b[_0x6709('0x11')]){if(_0x2d8c0b[_0x6709('0x11')][_0x6709('0x12')]===0x1f4){logger[_0x6709('0x11')](_0x6709('0xd'),_0x11ad23,_0x2d8c0b[_0x6709('0x11')][_0x6709('0x13')]);return _0x513ab6(_0x2d8c0b['error'][_0x6709('0x13')]);}logger[_0x6709('0x11')](_0x6709('0xd'),_0x11ad23,_0x2d8c0b[_0x6709('0x11')]['message']);return _0x30147f(_0x2d8c0b[_0x6709('0x11')]['message']);}else{logger[_0x6709('0xc')]('VoiceRecording,\x20%s,\x20%s',_0x11ad23,_0x6709('0xe'));_0x30147f(_0x2d8c0b[_0x6709('0x14')][_0x6709('0x13')]);}})[_0x6709('0x15')](function(_0x4cab30){logger['error']('VoiceRecording,\x20%s,\x20%s',_0x11ad23,_0x4cab30);_0x513ab6(_0x4cab30);});});}exports[_0x6709('0x16')]=function(_0x235a54){var _0x4a732e=this;return new Promise(function(_0x9c1fd8,_0x166c97){return db[_0x6709('0x17')]['update'](_0x235a54[_0x6709('0x18')],{'raw':_0x235a54[_0x6709('0x19')]?_0x235a54[_0x6709('0x19')][_0x6709('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x235a54['options']?_0x235a54[_0x6709('0x19')][_0x6709('0x1b')]||null:null,'attributes':_0x235a54[_0x6709('0x19')]?_0x235a54[_0x6709('0x19')][_0x6709('0x1c')]||null:null,'limit':_0x235a54[_0x6709('0x19')]?_0x235a54[_0x6709('0x19')][_0x6709('0x1d')]||null:null})[_0x6709('0xb')](function(_0x1c5153){logger[_0x6709('0xc')](_0x6709('0x16'),_0x235a54);logger['debug'](_0x6709('0x16'),_0x235a54,JSON[_0x6709('0x10')](_0x1c5153));_0x9c1fd8(_0x1c5153);})[_0x6709('0x15')](function(_0x5c7982){logger[_0x6709('0x11')](_0x6709('0x16'),_0x5c7982[_0x6709('0x13')],_0x235a54);_0x166c97(_0x4a732e[_0x6709('0x11')](0x1f4,_0x5c7982['message']));});});};exports[_0x6709('0x1e')]=function(_0x3076fe){var _0x50f7d6=this;return new Promise(function(_0x585073,_0x39f6a9){var _0x5dbb87=require(_0x6709('0x1f'));var _0x2499a2;return db['Setting'][_0x6709('0x20')]({'attributes':['id','callRecordingEncryption'],'where':{'id':0x1},'raw':!![]})[_0x6709('0xb')](function(_0x3cd555){_0x2499a2=_0x3cd555;return db['VoiceRecording'][_0x6709('0x21')](_0x3076fe['body']);})[_0x6709('0xb')](function(_0x388aee){if(_0x2499a2['callRecordingEncryption']&&fs[_0x6709('0x22')](_0x388aee['value'])){var _0x138318=util[_0x6709('0x23')]('%s.cypher',_0x388aee['value']);return _0x5dbb87[_0x6709('0x24')](_0x388aee[_0x6709('0x25')],_0x138318,config[_0x6709('0x26')][_0x6709('0x27')])[_0x6709('0xb')](function(){fs[_0x6709('0x28')](_0x388aee[_0x6709('0x25')]);logger[_0x6709('0xc')](_0x6709('0x29'));return _0x388aee;});}return _0x388aee;})['then'](function(_0x3d9501){logger[_0x6709('0xc')](_0x6709('0x1e'),_0x3076fe);logger[_0x6709('0xf')]('CreateVoiceRecording',_0x3076fe,JSON[_0x6709('0x10')](_0x3d9501));_0x585073(_0x3d9501);})[_0x6709('0x15')](function(_0x124e01){logger[_0x6709('0x11')]('CreateVoiceRecording',_0x124e01[_0x6709('0x13')],_0x3076fe);_0x39f6a9(_0x50f7d6[_0x6709('0x11')](0x1f4,_0x124e01['message']));});});}; \ No newline at end of file +var _0x2272=['client','http','request','then','info','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceRecording,\x20%s,\x20%s','message','result','catch','UpdateVoiceRecording','VoiceRecording','update','body','options','raw','where','attributes','limit','CreateVoiceRecording','Setting','findOne','callRecordingEncryption','format','%s.cypher','encryptFile','secrets','recording','unlink','value','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise'];(function(_0x999b85,_0x1edc2b){var _0x1d7124=function(_0x59cd29){while(--_0x59cd29){_0x999b85['push'](_0x999b85['shift']());}};_0x1d7124(++_0x1edc2b);}(_0x2272,0xd8));var _0x2227=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x2272[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0x2227('0x0'));var util=require(_0x2227('0x1'));var moment=require(_0x2227('0x2'));var BPromise=require(_0x2227('0x3'));var rs=require(_0x2227('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2227('0x5'))['db'];var utils=require(_0x2227('0x6'));var logger=require(_0x2227('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x2227('0x8'));var client=jayson[_0x2227('0x9')][_0x2227('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2591db,_0xaec623,_0x1413d2){return new BPromise(function(_0x41fc3f,_0x34bdd0){return client[_0x2227('0xb')](_0x2591db,_0x1413d2)[_0x2227('0xc')](function(_0x496bbd){logger[_0x2227('0xd')]('VoiceRecording,\x20%s,\x20%s',_0xaec623,_0x2227('0xe'));logger[_0x2227('0xf')](_0x2227('0x10'),_0xaec623,_0x2227('0xe'),JSON[_0x2227('0x11')](_0x496bbd));if(_0x496bbd['error']){if(_0x496bbd[_0x2227('0x12')][_0x2227('0x13')]===0x1f4){logger[_0x2227('0x12')](_0x2227('0x14'),_0xaec623,_0x496bbd[_0x2227('0x12')][_0x2227('0x15')]);return _0x34bdd0(_0x496bbd['error']['message']);}logger['error'](_0x2227('0x14'),_0xaec623,_0x496bbd['error'][_0x2227('0x15')]);return _0x41fc3f(_0x496bbd[_0x2227('0x12')]['message']);}else{logger[_0x2227('0xd')](_0x2227('0x14'),_0xaec623,_0x2227('0xe'));_0x41fc3f(_0x496bbd[_0x2227('0x16')][_0x2227('0x15')]);}})[_0x2227('0x17')](function(_0x508e92){logger[_0x2227('0x12')](_0x2227('0x14'),_0xaec623,_0x508e92);_0x34bdd0(_0x508e92);});});}exports[_0x2227('0x18')]=function(_0x531f75){var _0x11bf80=this;return new Promise(function(_0x620012,_0x65e3b6){return db[_0x2227('0x19')][_0x2227('0x1a')](_0x531f75[_0x2227('0x1b')],{'raw':_0x531f75[_0x2227('0x1c')]?_0x531f75['options'][_0x2227('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x531f75['options']?_0x531f75[_0x2227('0x1c')][_0x2227('0x1e')]||null:null,'attributes':_0x531f75[_0x2227('0x1c')]?_0x531f75[_0x2227('0x1c')][_0x2227('0x1f')]||null:null,'limit':_0x531f75[_0x2227('0x1c')]?_0x531f75[_0x2227('0x1c')][_0x2227('0x20')]||null:null})[_0x2227('0xc')](function(_0x34c090){logger[_0x2227('0xd')]('UpdateVoiceRecording',_0x531f75);logger[_0x2227('0xf')](_0x2227('0x18'),_0x531f75,JSON['stringify'](_0x34c090));_0x620012(_0x34c090);})[_0x2227('0x17')](function(_0xbfdce1){logger['error']('UpdateVoiceRecording',_0xbfdce1[_0x2227('0x15')],_0x531f75);_0x65e3b6(_0x11bf80[_0x2227('0x12')](0x1f4,_0xbfdce1[_0x2227('0x15')]));});});};exports[_0x2227('0x21')]=function(_0x5be889){var _0x191a3e=this;return new Promise(function(_0x301304,_0x2d8ea0){var _0x1957ee=require('../../components/encryptor');var _0x204def;return db[_0x2227('0x22')][_0x2227('0x23')]({'attributes':['id',_0x2227('0x24')],'where':{'id':0x1},'raw':!![]})[_0x2227('0xc')](function(_0x4789eb){_0x204def=_0x4789eb;return db['VoiceRecording']['create'](_0x5be889[_0x2227('0x1b')]);})['then'](function(_0x2ba581){if(_0x204def[_0x2227('0x24')]&&fs['existsSync'](_0x2ba581['value'])){var _0x1f1ba7=util[_0x2227('0x25')](_0x2227('0x26'),_0x2ba581['value']);return _0x1957ee[_0x2227('0x27')](_0x2ba581['value'],_0x1f1ba7,config[_0x2227('0x28')][_0x2227('0x29')])[_0x2227('0xc')](function(){fs[_0x2227('0x2a')](_0x2ba581[_0x2227('0x2b')]);logger[_0x2227('0xd')](_0x2227('0x2c'));return _0x2ba581;});}return _0x2ba581;})[_0x2227('0xc')](function(_0xd38f59){logger[_0x2227('0xd')](_0x2227('0x21'),_0x5be889);logger['debug'](_0x2227('0x21'),_0x5be889,JSON[_0x2227('0x11')](_0xd38f59));_0x301304(_0xd38f59);})[_0x2227('0x17')](function(_0x6cd5d7){logger['error'](_0x2227('0x21'),_0x6cd5d7[_0x2227('0x15')],_0x5be889);_0x2d8ea0(_0x191a3e[_0x2227('0x12')](0x1f4,_0x6cd5d7[_0x2227('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index dfd7af2..010f9e2 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 _0x723f=['../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','put','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x8d739d,_0x3504c4){var _0x39dc07=function(_0x48bb29){while(--_0x48bb29){_0x8d739d['push'](_0x8d739d['shift']());}};_0x39dc07(++_0x3504c4);}(_0x723f,0x1d4));var _0xf723=function(_0x34cfdb,_0x34594b){_0x34cfdb=_0x34cfdb-0x0;var _0x17fa18=_0x723f[_0x34cfdb];return _0x17fa18;};'use strict';var multer=require(_0xf723('0x0'));var util=require(_0xf723('0x1'));var path=require(_0xf723('0x2'));var timeout=require(_0xf723('0x3'));var express=require(_0xf723('0x4'));var router=express['Router']();var fs_extra=require(_0xf723('0x5'));var auth=require(_0xf723('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xf723('0x7'));var controller=require(_0xf723('0x8'));router[_0xf723('0x9')]('/',auth[_0xf723('0xa')](),controller['index']);router[_0xf723('0x9')](_0xf723('0xb'),auth['isAuthenticated'](),controller[_0xf723('0xc')]);router[_0xf723('0x9')](_0xf723('0xd'),auth[_0xf723('0xa')](),controller[_0xf723('0xe')]);router[_0xf723('0xf')]('/',auth[_0xf723('0xa')](),controller[_0xf723('0x10')]);router[_0xf723('0x11')](_0xf723('0xd'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0xf723('0xa')](),controller[_0xf723('0x12')]);module['exports']=router; \ No newline at end of file +var _0x3898=['connect-timeout','express','Router','fs-extra','./voiceTransferReport.controller','get','describe','/:id','isAuthenticated','show','post','put','update','delete','destroy','exports','multer','util'];(function(_0xd2943,_0x202719){var _0x42abb0=function(_0x2e5e06){while(--_0x2e5e06){_0xd2943['push'](_0xd2943['shift']());}};_0x42abb0(++_0x202719);}(_0x3898,0xb2));var _0x8389=function(_0x593d6c,_0x58b198){_0x593d6c=_0x593d6c-0x0;var _0x2ed34e=_0x3898[_0x593d6c];return _0x2ed34e;};'use strict';var multer=require(_0x8389('0x0'));var util=require(_0x8389('0x1'));var path=require('path');var timeout=require(_0x8389('0x2'));var express=require(_0x8389('0x3'));var router=express[_0x8389('0x4')]();var fs_extra=require(_0x8389('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x8389('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x8389('0x7')]('/describe',auth['isAuthenticated'](),controller[_0x8389('0x8')]);router[_0x8389('0x7')](_0x8389('0x9'),auth[_0x8389('0xa')](),controller[_0x8389('0xb')]);router[_0x8389('0xc')]('/',auth[_0x8389('0xa')](),controller['create']);router[_0x8389('0xd')]('/:id',auth[_0x8389('0xa')](),controller[_0x8389('0xe')]);router[_0x8389('0xf')](_0x8389('0x9'),auth[_0x8389('0xa')](),controller[_0x8389('0x10')]);module[_0x8389('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index c9cc72a..f284b28 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 _0x88cb=['sequelize','moment','exports','blind','attended','STRING','ENUM','Yes'];(function(_0x26738b,_0x54f231){var _0x2851c8=function(_0x5b6768){while(--_0x5b6768){_0x26738b['push'](_0x26738b['shift']());}};_0x2851c8(++_0x54f231);}(_0x88cb,0x1a8));var _0xb88c=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x88cb[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require(_0xb88c('0x0'));var moment=require(_0xb88c('0x1'));module[_0xb88c('0x2')]={'type':{'type':Sequelize['ENUM'](_0xb88c('0x3'),_0xb88c('0x4'))},'result':{'type':Sequelize[_0xb88c('0x5')]},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize[_0xb88c('0x5')]},'transferercalleridname':{'type':Sequelize[_0xb88c('0x5')]},'transfererconnectedlinenum':{'type':Sequelize[_0xb88c('0x5')]},'transfererconnectedlinename':{'type':Sequelize[_0xb88c('0x5')]},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize[_0xb88c('0x5')]},'transfererexten':{'type':Sequelize[_0xb88c('0x5')]},'transfererlinkedid':{'type':Sequelize[_0xb88c('0x5')]},'transfereechannel':{'type':Sequelize[_0xb88c('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0xb88c('0x5')]},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize['STRING']},'transfereeconnectedlinename':{'type':Sequelize[_0xb88c('0x5')]},'transfereeaccountcode':{'type':Sequelize[_0xb88c('0x5')]},'transfereecontext':{'type':Sequelize[_0xb88c('0x5')]},'transfereeexten':{'type':Sequelize[_0xb88c('0x5')]},'transfereelinkedid':{'type':Sequelize[_0xb88c('0x5')]},'isexternal':{'type':Sequelize[_0xb88c('0x6')](_0xb88c('0x7'),'No')},'context':{'type':Sequelize[_0xb88c('0x5')]},'extension':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5c61=['STRING','sequelize','exports','ENUM','blind','attended'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0x5c61,0x163));var _0x15c6=function(_0x488520,_0x3f197f){_0x488520=_0x488520-0x0;var _0x4330a9=_0x5c61[_0x488520];return _0x4330a9;};'use strict';var Sequelize=require(_0x15c6('0x0'));var moment=require('moment');module[_0x15c6('0x1')]={'type':{'type':Sequelize[_0x15c6('0x2')](_0x15c6('0x3'),_0x15c6('0x4'))},'result':{'type':Sequelize[_0x15c6('0x5')]},'transfererchannel':{'type':Sequelize[_0x15c6('0x5')]},'transferercalleridnum':{'type':Sequelize[_0x15c6('0x5')]},'transferercalleridname':{'type':Sequelize[_0x15c6('0x5')]},'transfererconnectedlinenum':{'type':Sequelize[_0x15c6('0x5')]},'transfererconnectedlinename':{'type':Sequelize[_0x15c6('0x5')]},'transfereraccountcode':{'type':Sequelize[_0x15c6('0x5')]},'transferercontext':{'type':Sequelize[_0x15c6('0x5')]},'transfererexten':{'type':Sequelize[_0x15c6('0x5')]},'transfererlinkedid':{'type':Sequelize[_0x15c6('0x5')]},'transfereechannel':{'type':Sequelize[_0x15c6('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0x15c6('0x5')]},'transfereecalleridname':{'type':Sequelize[_0x15c6('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x15c6('0x5')]},'transfereeconnectedlinename':{'type':Sequelize[_0x15c6('0x5')]},'transfereeaccountcode':{'type':Sequelize[_0x15c6('0x5')]},'transfereecontext':{'type':Sequelize[_0x15c6('0x5')]},'transfereeexten':{'type':Sequelize[_0x15c6('0x5')]},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize[_0x15c6('0x2')]('Yes','No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x15c6('0x5')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 8c7bc5f..b144890 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 _0x073b=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','then','destroy','end','stack','name','map','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','filters','pick','merge','filter','options','VoiceTransferReport','includeAll','include','findAll','rows','catch','show','params','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch'];(function(_0x27fcdf,_0x46d60e){var _0x1d9175=function(_0x290931){while(--_0x290931){_0x27fcdf['push'](_0x27fcdf['shift']());}};_0x1d9175(++_0x46d60e);}(_0x073b,0x16b));var _0xb073=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x073b[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require(_0xb073('0x0'));var rimraf=require(_0xb073('0x1'));var zipdir=require(_0xb073('0x2'));var jsonpatch=require(_0xb073('0x3'));var rp=require(_0xb073('0x4'));var moment=require(_0xb073('0x5'));var BPromise=require(_0xb073('0x6'));var Mustache=require('mustache');var util=require(_0xb073('0x7'));var path=require(_0xb073('0x8'));var sox=require(_0xb073('0x9'));var csv=require('to-csv');var ejs=require(_0xb073('0xa'));var fs=require('fs');var fs_extra=require(_0xb073('0xb'));var _=require(_0xb073('0xc'));var squel=require('squel');var crypto=require(_0xb073('0xd'));var jsforce=require(_0xb073('0xe'));var deskjs=require(_0xb073('0xf'));var toCsv=require(_0xb073('0x10'));var querystring=require(_0xb073('0x11'));var Papa=require(_0xb073('0x12'));var Redis=require(_0xb073('0x13'));var authService=require(_0xb073('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xb073('0x15'));var hardwareService=require(_0xb073('0x16'));var logger=require(_0xb073('0x17'))(_0xb073('0x18'));var utils=require(_0xb073('0x19'));var config=require(_0xb073('0x1a'));var licenseUtil=require(_0xb073('0x1b'));var db=require(_0xb073('0x1c'))['db'];function respondWithStatusCode(_0x281249,_0x107533){_0x107533=_0x107533||0xcc;return function(_0x54ad85){if(_0x54ad85){return _0x281249[_0xb073('0x1d')](_0x107533);}return _0x281249[_0xb073('0x1e')](_0x107533)['end']();};}function respondWithResult(_0x5728f5,_0x520716){_0x520716=_0x520716||0xc8;return function(_0x44d2a2){if(_0x44d2a2){return _0x5728f5[_0xb073('0x1e')](_0x520716)[_0xb073('0x1f')](_0x44d2a2);}};}function respondWithFilteredResult(_0x3eae60,_0x2d56c0){return function(_0x3c5fd8){if(_0x3c5fd8){var _0x28a152=typeof _0x2d56c0[_0xb073('0x20')]===_0xb073('0x21')&&typeof _0x2d56c0[_0xb073('0x22')]==='undefined';var _0x2f3ba3=_0x3c5fd8[_0xb073('0x23')];var _0x5b2da0=_0x28a152?0x0:_0x2d56c0[_0xb073('0x20')];var _0x23cc6e=_0x28a152?_0x3c5fd8['count']:_0x2d56c0[_0xb073('0x20')]+_0x2d56c0[_0xb073('0x22')];var _0x56858a;if(_0x23cc6e>=_0x2f3ba3){_0x23cc6e=_0x2f3ba3;_0x56858a=0xc8;}else{_0x56858a=0xce;}_0x3eae60[_0xb073('0x1e')](_0x56858a);return _0x3eae60[_0xb073('0x24')](_0xb073('0x25'),_0x5b2da0+'-'+_0x23cc6e+'/'+_0x2f3ba3)[_0xb073('0x1f')](_0x3c5fd8);}return null;};}function patchUpdates(_0x28e3b3){return function(_0x26749e){try{jsonpatch['apply'](_0x26749e,_0x28e3b3,!![]);}catch(_0x1a52f2){return BPromise[_0xb073('0x26')](_0x1a52f2);}return _0x26749e['save']();};}function saveUpdates(_0x581fc1,_0x4d3a2f){return function(_0x17fc62){if(_0x17fc62){return _0x17fc62['update'](_0x581fc1)[_0xb073('0x27')](function(_0x48803a){return _0x48803a;});}return null;};}function removeEntity(_0x4cd30d,_0x312245){return function(_0x4b66f1){if(_0x4b66f1){return _0x4b66f1[_0xb073('0x28')]()['then'](function(){_0x4cd30d[_0xb073('0x1e')](0xcc)[_0xb073('0x29')]();});}};}function handleEntityNotFound(_0x567700,_0x329270){return function(_0xee3863){if(!_0xee3863){_0x567700[_0xb073('0x1d')](0x194);}return _0xee3863;};}function handleError(_0x1c43d5,_0x2f1fe0){_0x2f1fe0=_0x2f1fe0||0x1f4;return function(_0x27976e){logger['error'](_0x27976e[_0xb073('0x2a')]);if(_0x27976e[_0xb073('0x2b')]){delete _0x27976e[_0xb073('0x2b')];}_0x1c43d5[_0xb073('0x1e')](_0x2f1fe0)['send'](_0x27976e);};}exports['index']=function(_0x5139f2,_0x47eaaa){var _0x28f8c5={},_0x424fa9={},_0x3eec63={'count':0x0,'rows':[]};var _0x38d694=_[_0xb073('0x2c')](db['VoiceTransferReport'][_0xb073('0x2d')],function(_0x3e0b0a){return{'name':_0x3e0b0a[_0xb073('0x2e')],'type':_0x3e0b0a[_0xb073('0x2f')][_0xb073('0x30')]};});_0x424fa9[_0xb073('0x31')]=_[_0xb073('0x2c')](_0x38d694,_0xb073('0x2b'));_0x424fa9[_0xb073('0x32')]=_[_0xb073('0x33')](_0x5139f2[_0xb073('0x32')]);_0x424fa9['filters']=_['intersection'](_0x424fa9['model'],_0x424fa9[_0xb073('0x32')]);_0x28f8c5[_0xb073('0x34')]=_[_0xb073('0x35')](_0x424fa9[_0xb073('0x31')],qs[_0xb073('0x36')](_0x5139f2[_0xb073('0x32')][_0xb073('0x36')]));_0x28f8c5['attributes']=_0x28f8c5[_0xb073('0x34')]['length']?_0x28f8c5['attributes']:_0x424fa9[_0xb073('0x31')];if(!_0x5139f2[_0xb073('0x32')][_0xb073('0x37')](_0xb073('0x38'))){_0x28f8c5[_0xb073('0x22')]=qs[_0xb073('0x22')](_0x5139f2[_0xb073('0x32')][_0xb073('0x22')]);_0x28f8c5[_0xb073('0x20')]=qs['offset'](_0x5139f2['query']['offset']);}_0x28f8c5['order']=qs[_0xb073('0x39')](_0x5139f2['query'][_0xb073('0x39')]);_0x28f8c5[_0xb073('0x3a')]=qs[_0xb073('0x3b')](_[_0xb073('0x3c')](_0x5139f2['query'],_0x424fa9['filters']),_0x38d694);if(_0x5139f2[_0xb073('0x32')]['filter']){_0x28f8c5[_0xb073('0x3a')]=_[_0xb073('0x3d')](_0x28f8c5[_0xb073('0x3a')],{'$or':_['map'](_0x38d694,function(_0x2911c8){if(_0x2911c8[_0xb073('0x2f')]!=='VIRTUAL'){var _0x1483ce={};_0x1483ce[_0x2911c8[_0xb073('0x2b')]]={'$like':'%'+_0x5139f2['query'][_0xb073('0x3e')]+'%'};return _0x1483ce;}})});}_0x28f8c5=_[_0xb073('0x3d')]({},_0x28f8c5,_0x5139f2[_0xb073('0x3f')]);var _0x2dc2de={'where':_0x28f8c5[_0xb073('0x3a')]};return db[_0xb073('0x40')][_0xb073('0x23')](_0x2dc2de)['then'](function(_0x45f265){_0x3eec63[_0xb073('0x23')]=_0x45f265;if(_0x5139f2[_0xb073('0x32')][_0xb073('0x41')]){_0x28f8c5[_0xb073('0x42')]=[{'all':!![]}];}return db[_0xb073('0x40')][_0xb073('0x43')](_0x28f8c5);})[_0xb073('0x27')](function(_0x29d0e2){_0x3eec63[_0xb073('0x44')]=_0x29d0e2;return _0x3eec63;})[_0xb073('0x27')](respondWithFilteredResult(_0x47eaaa,_0x28f8c5))[_0xb073('0x45')](handleError(_0x47eaaa,null));};exports[_0xb073('0x46')]=function(_0x3ede9e,_0x261d87){var _0x4a4523={'raw':!![],'where':{'id':_0x3ede9e[_0xb073('0x47')]['id']}},_0x4e6adb={};_0x4e6adb[_0xb073('0x31')]=_[_0xb073('0x33')](db[_0xb073('0x40')][_0xb073('0x2d')]);_0x4e6adb[_0xb073('0x32')]=_[_0xb073('0x33')](_0x3ede9e['query']);_0x4e6adb[_0xb073('0x3b')]=_[_0xb073('0x35')](_0x4e6adb[_0xb073('0x31')],_0x4e6adb[_0xb073('0x32')]);_0x4a4523[_0xb073('0x34')]=_[_0xb073('0x35')](_0x4e6adb[_0xb073('0x31')],qs['fields'](_0x3ede9e['query'][_0xb073('0x36')]));_0x4a4523[_0xb073('0x34')]=_0x4a4523[_0xb073('0x34')]['length']?_0x4a4523[_0xb073('0x34')]:_0x4e6adb['model'];if(_0x3ede9e['query']['includeAll']){_0x4a4523[_0xb073('0x42')]=[{'all':!![]}];}_0x4a4523=_['merge']({},_0x4a4523,_0x3ede9e[_0xb073('0x3f')]);return db[_0xb073('0x40')][_0xb073('0x48')](_0x4a4523)[_0xb073('0x27')](handleEntityNotFound(_0x261d87,null))[_0xb073('0x27')](respondWithResult(_0x261d87,null))['catch'](handleError(_0x261d87,null));};exports[_0xb073('0x49')]=function(_0x5e209e,_0xcafe42){return db['VoiceTransferReport'][_0xb073('0x49')](_0x5e209e[_0xb073('0x4a')],{})[_0xb073('0x27')](respondWithResult(_0xcafe42,0xc9))[_0xb073('0x45')](handleError(_0xcafe42,null));};exports[_0xb073('0x4b')]=function(_0x418f87,_0x22796e){if(_0x418f87[_0xb073('0x4a')]['id']){delete _0x418f87['body']['id'];}return db[_0xb073('0x40')][_0xb073('0x48')]({'where':{'id':_0x418f87[_0xb073('0x47')]['id']}})[_0xb073('0x27')](handleEntityNotFound(_0x22796e,null))['then'](saveUpdates(_0x418f87[_0xb073('0x4a')],null))[_0xb073('0x27')](respondWithResult(_0x22796e,null))[_0xb073('0x45')](handleError(_0x22796e,null));};exports[_0xb073('0x28')]=function(_0x21f7b9,_0x394225){return db['VoiceTransferReport']['find']({'where':{'id':_0x21f7b9[_0xb073('0x47')]['id']}})['then'](handleEntityNotFound(_0x394225,null))[_0xb073('0x27')](removeEntity(_0x394225,null))['catch'](handleError(_0x394225,null));};exports[_0xb073('0x4c')]=function(_0x479cef,_0x45ec94){return db[_0xb073('0x40')][_0xb073('0x4c')]()[_0xb073('0x27')](respondWithResult(_0x45ec94,null))[_0xb073('0x45')](handleError(_0x45ec94,null));}; \ No newline at end of file +var _0x7bf2=['error','stack','name','send','index','map','VoiceTransferReport','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','params','rawAttributes','find','create','catch','update','body','describe','eml-format','rimraf','zip-dir','bluebird','mustache','util','path','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','count','offset','limit','apply','reject','save','then','destroy','end'];(function(_0x292c51,_0x1532a2){var _0xf7c1a5=function(_0x493864){while(--_0x493864){_0x292c51['push'](_0x292c51['shift']());}};_0xf7c1a5(++_0x1532a2);}(_0x7bf2,0x103));var _0x27bf=function(_0x3aa529,_0x32e3f3){_0x3aa529=_0x3aa529-0x0;var _0x5069c5=_0x7bf2[_0x3aa529];return _0x5069c5;};'use strict';var emlformat=require(_0x27bf('0x0'));var rimraf=require(_0x27bf('0x1'));var zipdir=require(_0x27bf('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x27bf('0x3'));var Mustache=require(_0x27bf('0x4'));var util=require(_0x27bf('0x5'));var path=require(_0x27bf('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x27bf('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x27bf('0x8'));var squel=require('squel');var crypto=require(_0x27bf('0x9'));var jsforce=require(_0x27bf('0xa'));var deskjs=require(_0x27bf('0xb'));var toCsv=require(_0x27bf('0xc'));var querystring=require(_0x27bf('0xd'));var Papa=require(_0x27bf('0xe'));var Redis=require(_0x27bf('0xf'));var authService=require(_0x27bf('0x10'));var qs=require(_0x27bf('0x11'));var as=require(_0x27bf('0x12'));var hardwareService=require(_0x27bf('0x13'));var logger=require('../../config/logger')(_0x27bf('0x14'));var utils=require(_0x27bf('0x15'));var config=require(_0x27bf('0x16'));var licenseUtil=require(_0x27bf('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1ee5e5,_0xe49474){_0xe49474=_0xe49474||0xcc;return function(_0x37fb4a){if(_0x37fb4a){return _0x1ee5e5[_0x27bf('0x18')](_0xe49474);}return _0x1ee5e5[_0x27bf('0x19')](_0xe49474)['end']();};}function respondWithResult(_0x132385,_0x4c2a5d){_0x4c2a5d=_0x4c2a5d||0xc8;return function(_0x16b881){if(_0x16b881){return _0x132385['status'](_0x4c2a5d)[_0x27bf('0x1a')](_0x16b881);}};}function respondWithFilteredResult(_0x341f54,_0x516591){return function(_0xd196dd){if(_0xd196dd){var _0x4a16d1=typeof _0x516591['offset']==='undefined'&&typeof _0x516591['limit']===_0x27bf('0x1b');var _0x35a70d=_0xd196dd[_0x27bf('0x1c')];var _0x8d4d5a=_0x4a16d1?0x0:_0x516591[_0x27bf('0x1d')];var _0x190d6a=_0x4a16d1?_0xd196dd['count']:_0x516591[_0x27bf('0x1d')]+_0x516591[_0x27bf('0x1e')];var _0x2d3ed5;if(_0x190d6a>=_0x35a70d){_0x190d6a=_0x35a70d;_0x2d3ed5=0xc8;}else{_0x2d3ed5=0xce;}_0x341f54[_0x27bf('0x19')](_0x2d3ed5);return _0x341f54['set']('Content-Range',_0x8d4d5a+'-'+_0x190d6a+'/'+_0x35a70d)[_0x27bf('0x1a')](_0xd196dd);}return null;};}function patchUpdates(_0x342a7e){return function(_0x544973){try{jsonpatch[_0x27bf('0x1f')](_0x544973,_0x342a7e,!![]);}catch(_0x24708e){return BPromise[_0x27bf('0x20')](_0x24708e);}return _0x544973[_0x27bf('0x21')]();};}function saveUpdates(_0x3cdc2c,_0xfbfe02){return function(_0x8f7f9){if(_0x8f7f9){return _0x8f7f9['update'](_0x3cdc2c)[_0x27bf('0x22')](function(_0x385461){return _0x385461;});}return null;};}function removeEntity(_0x3a2b9,_0x14c65e){return function(_0x50b595){if(_0x50b595){return _0x50b595[_0x27bf('0x23')]()[_0x27bf('0x22')](function(){_0x3a2b9[_0x27bf('0x19')](0xcc)[_0x27bf('0x24')]();});}};}function handleEntityNotFound(_0x44c0cd,_0x5b5ecf){return function(_0x1b0f9a){if(!_0x1b0f9a){_0x44c0cd[_0x27bf('0x18')](0x194);}return _0x1b0f9a;};}function handleError(_0x2ead67,_0xbeb21c){_0xbeb21c=_0xbeb21c||0x1f4;return function(_0x2d3477){logger[_0x27bf('0x25')](_0x2d3477[_0x27bf('0x26')]);if(_0x2d3477['name']){delete _0x2d3477[_0x27bf('0x27')];}_0x2ead67[_0x27bf('0x19')](_0xbeb21c)[_0x27bf('0x28')](_0x2d3477);};}exports[_0x27bf('0x29')]=function(_0x2c138a,_0x47573c){var _0x4d0ae2={},_0x3e5a2c={},_0xfd251e={'count':0x0,'rows':[]};var _0x23e3de=_[_0x27bf('0x2a')](db[_0x27bf('0x2b')]['rawAttributes'],function(_0x5a93a8){return{'name':_0x5a93a8[_0x27bf('0x2c')],'type':_0x5a93a8[_0x27bf('0x2d')][_0x27bf('0x2e')]};});_0x3e5a2c[_0x27bf('0x2f')]=_[_0x27bf('0x2a')](_0x23e3de,'name');_0x3e5a2c[_0x27bf('0x30')]=_[_0x27bf('0x31')](_0x2c138a[_0x27bf('0x30')]);_0x3e5a2c['filters']=_[_0x27bf('0x32')](_0x3e5a2c[_0x27bf('0x2f')],_0x3e5a2c[_0x27bf('0x30')]);_0x4d0ae2[_0x27bf('0x33')]=_[_0x27bf('0x32')](_0x3e5a2c[_0x27bf('0x2f')],qs[_0x27bf('0x34')](_0x2c138a['query']['fields']));_0x4d0ae2[_0x27bf('0x33')]=_0x4d0ae2[_0x27bf('0x33')][_0x27bf('0x35')]?_0x4d0ae2['attributes']:_0x3e5a2c[_0x27bf('0x2f')];if(!_0x2c138a[_0x27bf('0x30')][_0x27bf('0x36')](_0x27bf('0x37'))){_0x4d0ae2[_0x27bf('0x1e')]=qs[_0x27bf('0x1e')](_0x2c138a[_0x27bf('0x30')][_0x27bf('0x1e')]);_0x4d0ae2[_0x27bf('0x1d')]=qs[_0x27bf('0x1d')](_0x2c138a[_0x27bf('0x30')][_0x27bf('0x1d')]);}_0x4d0ae2['order']=qs[_0x27bf('0x38')](_0x2c138a[_0x27bf('0x30')][_0x27bf('0x38')]);_0x4d0ae2[_0x27bf('0x39')]=qs[_0x27bf('0x3a')](_[_0x27bf('0x3b')](_0x2c138a[_0x27bf('0x30')],_0x3e5a2c[_0x27bf('0x3a')]),_0x23e3de);if(_0x2c138a[_0x27bf('0x30')][_0x27bf('0x3c')]){_0x4d0ae2[_0x27bf('0x39')]=_[_0x27bf('0x3d')](_0x4d0ae2[_0x27bf('0x39')],{'$or':_[_0x27bf('0x2a')](_0x23e3de,function(_0x297073){if(_0x297073['type']!==_0x27bf('0x3e')){var _0x1835cc={};_0x1835cc[_0x297073['name']]={'$like':'%'+_0x2c138a[_0x27bf('0x30')][_0x27bf('0x3c')]+'%'};return _0x1835cc;}})});}_0x4d0ae2=_[_0x27bf('0x3d')]({},_0x4d0ae2,_0x2c138a[_0x27bf('0x3f')]);var _0x1eebe4={'where':_0x4d0ae2[_0x27bf('0x39')]};return db[_0x27bf('0x2b')]['count'](_0x1eebe4)['then'](function(_0x39a819){_0xfd251e[_0x27bf('0x1c')]=_0x39a819;if(_0x2c138a[_0x27bf('0x30')][_0x27bf('0x40')]){_0x4d0ae2['include']=[{'all':!![]}];}return db[_0x27bf('0x2b')][_0x27bf('0x41')](_0x4d0ae2);})[_0x27bf('0x22')](function(_0x4d2ba2){_0xfd251e['rows']=_0x4d2ba2;return _0xfd251e;})[_0x27bf('0x22')](respondWithFilteredResult(_0x47573c,_0x4d0ae2))['catch'](handleError(_0x47573c,null));};exports['show']=function(_0x173e73,_0x53a9f8){var _0x44a50f={'raw':!![],'where':{'id':_0x173e73[_0x27bf('0x42')]['id']}},_0x509e91={};_0x509e91[_0x27bf('0x2f')]=_['keys'](db['VoiceTransferReport'][_0x27bf('0x43')]);_0x509e91['query']=_[_0x27bf('0x31')](_0x173e73[_0x27bf('0x30')]);_0x509e91[_0x27bf('0x3a')]=_['intersection'](_0x509e91[_0x27bf('0x2f')],_0x509e91[_0x27bf('0x30')]);_0x44a50f[_0x27bf('0x33')]=_[_0x27bf('0x32')](_0x509e91['model'],qs[_0x27bf('0x34')](_0x173e73[_0x27bf('0x30')][_0x27bf('0x34')]));_0x44a50f[_0x27bf('0x33')]=_0x44a50f[_0x27bf('0x33')][_0x27bf('0x35')]?_0x44a50f[_0x27bf('0x33')]:_0x509e91[_0x27bf('0x2f')];if(_0x173e73[_0x27bf('0x30')][_0x27bf('0x40')]){_0x44a50f['include']=[{'all':!![]}];}_0x44a50f=_[_0x27bf('0x3d')]({},_0x44a50f,_0x173e73['options']);return db['VoiceTransferReport'][_0x27bf('0x44')](_0x44a50f)[_0x27bf('0x22')](handleEntityNotFound(_0x53a9f8,null))['then'](respondWithResult(_0x53a9f8,null))['catch'](handleError(_0x53a9f8,null));};exports[_0x27bf('0x45')]=function(_0x5989b4,_0x5d718b){return db[_0x27bf('0x2b')][_0x27bf('0x45')](_0x5989b4['body'],{})[_0x27bf('0x22')](respondWithResult(_0x5d718b,0xc9))[_0x27bf('0x46')](handleError(_0x5d718b,null));};exports[_0x27bf('0x47')]=function(_0x463a94,_0x1cf3af){if(_0x463a94[_0x27bf('0x48')]['id']){delete _0x463a94['body']['id'];}return db[_0x27bf('0x2b')][_0x27bf('0x44')]({'where':{'id':_0x463a94['params']['id']}})[_0x27bf('0x22')](handleEntityNotFound(_0x1cf3af,null))[_0x27bf('0x22')](saveUpdates(_0x463a94['body'],null))[_0x27bf('0x22')](respondWithResult(_0x1cf3af,null))[_0x27bf('0x46')](handleError(_0x1cf3af,null));};exports[_0x27bf('0x23')]=function(_0x1aaf6c,_0x4199db){return db['VoiceTransferReport'][_0x27bf('0x44')]({'where':{'id':_0x1aaf6c[_0x27bf('0x42')]['id']}})[_0x27bf('0x22')](handleEntityNotFound(_0x4199db,null))[_0x27bf('0x22')](removeEntity(_0x4199db,null))[_0x27bf('0x46')](handleError(_0x4199db,null));};exports[_0x27bf('0x49')]=function(_0x47d52d,_0x266ab0){return db['VoiceTransferReport'][_0x27bf('0x49')]()['then'](respondWithResult(_0x266ab0,null))['catch'](handleError(_0x266ab0,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 4e350f8..f4550fb 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 _0x4772=['request-promise','path','../../config/environment','./voiceTransferReport.attributes','define','report_call_transfer','lodash','util','../../config/logger','moment','bluebird'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x4772,0x10e));var _0x2477=function(_0x4a4717,_0x3ed1ed){_0x4a4717=_0x4a4717-0x0;var _0x4ecaaa=_0x4772[_0x4a4717];return _0x4ecaaa;};'use strict';var _=require(_0x2477('0x0'));var util=require(_0x2477('0x1'));var logger=require(_0x2477('0x2'))('api');var moment=require(_0x2477('0x3'));var BPromise=require(_0x2477('0x4'));var rp=require(_0x2477('0x5'));var fs=require('fs');var path=require(_0x2477('0x6'));var rimraf=require('rimraf');var config=require(_0x2477('0x7'));var attributes=require(_0x2477('0x8'));module['exports']=function(_0x20b2a2,_0x55124b){return _0x20b2a2[_0x2477('0x9')]('VoiceTransferReport',attributes,{'tableName':_0x2477('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0de8=['rimraf','../../config/environment','./voiceTransferReport.attributes','exports','define','VoiceTransferReport','report_call_transfer','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x5055f0,_0x41e2ce){var _0x21e361=function(_0x3d7292){while(--_0x3d7292){_0x5055f0['push'](_0x5055f0['shift']());}};_0x21e361(++_0x41e2ce);}(_0x0de8,0x93));var _0x80de=function(_0x386812,_0x27c823){_0x386812=_0x386812-0x0;var _0x4704d2=_0x0de8[_0x386812];return _0x4704d2;};'use strict';var _=require(_0x80de('0x0'));var util=require(_0x80de('0x1'));var logger=require(_0x80de('0x2'))(_0x80de('0x3'));var moment=require('moment');var BPromise=require(_0x80de('0x4'));var rp=require(_0x80de('0x5'));var fs=require('fs');var path=require(_0x80de('0x6'));var rimraf=require(_0x80de('0x7'));var config=require(_0x80de('0x8'));var attributes=require(_0x80de('0x9'));module[_0x80de('0xa')]=function(_0x2816c5,_0x123d80){return _0x2816c5[_0x80de('0xb')](_0x80de('0xc'),attributes,{'tableName':_0x80de('0xd'),'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 1f46f17..9e16462 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 _0x4f91=['stringify','error','message','VoiceTransferReport,\x20%s,\x20%s','result','body','options','raw','CreateVoiceTransferReport','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','jayson/promise','client','http','request','info','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0x25afe5,_0x169ade){var _0x5899ba=function(_0x1f8373){while(--_0x1f8373){_0x25afe5['push'](_0x25afe5['shift']());}};_0x5899ba(++_0x169ade);}(_0x4f91,0xeb));var _0x14f9=function(_0xc0cabe,_0xc81a11){_0xc0cabe=_0xc0cabe-0x0;var _0x4116b0=_0x4f91[_0xc0cabe];return _0x4116b0;};'use strict';var _=require(_0x14f9('0x0'));var util=require(_0x14f9('0x1'));var moment=require(_0x14f9('0x2'));var BPromise=require(_0x14f9('0x3'));var rs=require(_0x14f9('0x4'));var fs=require('fs');var Redis=require(_0x14f9('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x14f9('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x14f9('0x7'));var client=jayson[_0x14f9('0x8')][_0x14f9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3f3e32,_0x36ecb3,_0x524e2c){return new BPromise(function(_0x23a3da,_0x46fe23){return client[_0x14f9('0xa')](_0x3f3e32,_0x524e2c)['then'](function(_0x3d5626){logger[_0x14f9('0xb')]('VoiceTransferReport,\x20%s,\x20%s',_0x36ecb3,_0x14f9('0xc'));logger[_0x14f9('0xd')](_0x14f9('0xe'),_0x36ecb3,_0x14f9('0xc'),JSON[_0x14f9('0xf')](_0x3d5626));if(_0x3d5626[_0x14f9('0x10')]){if(_0x3d5626[_0x14f9('0x10')]['code']===0x1f4){logger[_0x14f9('0x10')]('VoiceTransferReport,\x20%s,\x20%s',_0x36ecb3,_0x3d5626[_0x14f9('0x10')][_0x14f9('0x11')]);return _0x46fe23(_0x3d5626[_0x14f9('0x10')][_0x14f9('0x11')]);}logger[_0x14f9('0x10')]('VoiceTransferReport,\x20%s,\x20%s',_0x36ecb3,_0x3d5626['error'][_0x14f9('0x11')]);return _0x23a3da(_0x3d5626['error'][_0x14f9('0x11')]);}else{logger[_0x14f9('0xb')](_0x14f9('0x12'),_0x36ecb3,_0x14f9('0xc'));_0x23a3da(_0x3d5626[_0x14f9('0x13')][_0x14f9('0x11')]);}})['catch'](function(_0x576011){logger[_0x14f9('0x10')]('VoiceTransferReport,\x20%s,\x20%s',_0x36ecb3,_0x576011);_0x46fe23(_0x576011);});});}exports['CreateVoiceTransferReport']=function(_0x14bfe1){var _0x5ac144=this;return new Promise(function(_0x55a77d,_0x5cac16){return db['VoiceTransferReport']['create'](_0x14bfe1[_0x14f9('0x14')],{'raw':_0x14bfe1[_0x14f9('0x15')]?_0x14bfe1[_0x14f9('0x15')][_0x14f9('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0x30c977){logger[_0x14f9('0xb')](_0x14f9('0x17'),_0x14bfe1);logger['debug']('CreateVoiceTransferReport',_0x14bfe1,JSON[_0x14f9('0xf')](_0x30c977));_0x55a77d(_0x30c977);})[_0x14f9('0x18')](function(_0x5b2dce){logger[_0x14f9('0x10')](_0x14f9('0x17'),_0x5b2dce['message'],_0x14bfe1);_0x5cac16(_0x5ac144[_0x14f9('0x10')](0x1f4,_0x5b2dce[_0x14f9('0x11')]));});});}; \ No newline at end of file +var _0x7184=['options','then','stringify','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','CreateVoiceTransferReport','VoiceTransferReport','create','body'];(function(_0x4d5a38,_0x4bf584){var _0x35ebf2=function(_0x4d6a9d){while(--_0x4d6a9d){_0x4d5a38['push'](_0x4d5a38['shift']());}};_0x35ebf2(++_0x4bf584);}(_0x7184,0x1f1));var _0x4718=function(_0x4cdbc8,_0x4d8e1d){_0x4cdbc8=_0x4cdbc8-0x0;var _0x311448=_0x7184[_0x4cdbc8];return _0x311448;};'use strict';var _=require(_0x4718('0x0'));var util=require(_0x4718('0x1'));var moment=require(_0x4718('0x2'));var BPromise=require(_0x4718('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4718('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4718('0x5'));var logger=require(_0x4718('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x4718('0x7'));var client=jayson[_0x4718('0x8')][_0x4718('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x346ee5,_0xbdecef,_0x8b6cce){return new BPromise(function(_0x5ce2e1,_0x37e035){return client['request'](_0x346ee5,_0x8b6cce)['then'](function(_0x4579bd){logger[_0x4718('0xa')](_0x4718('0xb'),_0xbdecef,_0x4718('0xc'));logger[_0x4718('0xd')](_0x4718('0xe'),_0xbdecef,'request\x20sent',JSON['stringify'](_0x4579bd));if(_0x4579bd[_0x4718('0xf')]){if(_0x4579bd[_0x4718('0xf')]['code']===0x1f4){logger['error'](_0x4718('0xb'),_0xbdecef,_0x4579bd['error'][_0x4718('0x10')]);return _0x37e035(_0x4579bd['error'][_0x4718('0x10')]);}logger[_0x4718('0xf')]('VoiceTransferReport,\x20%s,\x20%s',_0xbdecef,_0x4579bd['error'][_0x4718('0x10')]);return _0x5ce2e1(_0x4579bd['error']['message']);}else{logger[_0x4718('0xa')](_0x4718('0xb'),_0xbdecef,_0x4718('0xc'));_0x5ce2e1(_0x4579bd[_0x4718('0x11')]['message']);}})[_0x4718('0x12')](function(_0x3e9412){logger['error']('VoiceTransferReport,\x20%s,\x20%s',_0xbdecef,_0x3e9412);_0x37e035(_0x3e9412);});});}exports[_0x4718('0x13')]=function(_0x9c3bb8){var _0x3ffae5=this;return new Promise(function(_0x2a8ae9,_0x3e1395){return db[_0x4718('0x14')][_0x4718('0x15')](_0x9c3bb8[_0x4718('0x16')],{'raw':_0x9c3bb8[_0x4718('0x17')]?_0x9c3bb8[_0x4718('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x4718('0x18')](function(_0x10ba4d){logger[_0x4718('0xa')](_0x4718('0x13'),_0x9c3bb8);logger[_0x4718('0xd')](_0x4718('0x13'),_0x9c3bb8,JSON[_0x4718('0x19')](_0x10ba4d));_0x2a8ae9(_0x10ba4d);})[_0x4718('0x12')](function(_0x476399){logger[_0x4718('0xf')](_0x4718('0x13'),_0x476399[_0x4718('0x10')],_0x9c3bb8);_0x3e1395(_0x3ffae5['error'](0x1f4,_0x476399['message']));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 5fb1796..c9abf7b 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 _0xcb91=['/unhold','unhold','/calls','transfer','exports','../../components/auth/service','./webbar.controller','post','/originate','isWebrtcLicence','originate','/hangup','isAuthenticated','hangup','hold'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x576266,_0x4002b0){_0x576266=_0x576266-0x0;var _0x18234f=_0xcb91[_0x576266];return _0x18234f;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0x1cb9('0x0'));var controller=require(_0x1cb9('0x1'));router[_0x1cb9('0x2')](_0x1cb9('0x3'),auth['isAuthenticated'](),auth[_0x1cb9('0x4')](),controller[_0x1cb9('0x5')]);router['post'](_0x1cb9('0x6'),auth[_0x1cb9('0x7')](),auth['isWebrtcLicence'](),controller[_0x1cb9('0x8')]);router[_0x1cb9('0x2')]('/answer',auth[_0x1cb9('0x7')](),auth[_0x1cb9('0x4')](),controller['answer']);router[_0x1cb9('0x2')]('/hold',auth['isAuthenticated'](),auth[_0x1cb9('0x4')](),controller[_0x1cb9('0x9')]);router[_0x1cb9('0x2')](_0x1cb9('0xa'),auth[_0x1cb9('0x7')](),auth['isWebrtcLicence'](),controller[_0x1cb9('0xb')]);router[_0x1cb9('0x2')](_0x1cb9('0xc'),auth[_0x1cb9('0x7')](),auth[_0x1cb9('0x4')](),controller['calls']);router['post']('/transfer',auth[_0x1cb9('0x7')](),auth[_0x1cb9('0x4')](),controller[_0x1cb9('0xd')]);module[_0x1cb9('0xe')]=router; \ No newline at end of file +var _0xdace=['unhold','calls','/transfer','transfer','exports','express','../../components/auth/service','./webbar.controller','post','isAuthenticated','isWebrtcLicence','originate','hangup','/answer','/hold','/unhold'];(function(_0x3e6707,_0x37475e){var _0x12b38d=function(_0x54c152){while(--_0x54c152){_0x3e6707['push'](_0x3e6707['shift']());}};_0x12b38d(++_0x37475e);}(_0xdace,0xc5));var _0xedac=function(_0x14e27a,_0x3b4136){_0x14e27a=_0x14e27a-0x0;var _0x288688=_0xdace[_0x14e27a];return _0x288688;};'use strict';var express=require(_0xedac('0x0'));var router=express['Router']();var auth=require(_0xedac('0x1'));var controller=require(_0xedac('0x2'));router[_0xedac('0x3')]('/originate',auth[_0xedac('0x4')](),auth[_0xedac('0x5')](),controller[_0xedac('0x6')]);router[_0xedac('0x3')]('/hangup',auth[_0xedac('0x4')](),auth[_0xedac('0x5')](),controller[_0xedac('0x7')]);router['post'](_0xedac('0x8'),auth[_0xedac('0x4')](),auth[_0xedac('0x5')](),controller['answer']);router[_0xedac('0x3')](_0xedac('0x9'),auth[_0xedac('0x4')](),auth['isWebrtcLicence'](),controller['hold']);router[_0xedac('0x3')](_0xedac('0xa'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0xedac('0xb')]);router[_0xedac('0x3')]('/calls',auth[_0xedac('0x4')](),auth['isWebrtcLicence'](),controller[_0xedac('0xc')]);router[_0xedac('0x3')](_0xedac('0xd'),auth[_0xedac('0x4')](),auth[_0xedac('0x5')](),controller[_0xedac('0xe')]);module[_0xedac('0xf')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index b6ef4df..5941d79 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 _0xb344=['length','user:%s','hangup\x20executed!','answer','answer\x20executed!','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','calls','calls\x20fired:','conference\x20fired:','conference\x20executed!','transfer','transferNumber','transfer\x20executed!','path','lodash','../../config/environment','util','jayson/promise','client','../../config/logger','webbarapi','ioredis','redis','defaults','localhost','validate','string','number','userId\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','stringify','log','error','status','send','NotFound','request','then','code','message','result','catch','User','VoiceChannels','all','filter','rows','UserId','sessionId','sessionId\x20','originate\x20fired:','body','json','userId','callNumber','callerId','entityFound:','name','format','webbar:originate','originate\x20executed!','hangup','info'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xb344,0x99));var _0x4b34=function(_0x3ba095,_0x445aef){_0x3ba095=_0x3ba095-0x0;var _0x135e8c=_0xb344[_0x3ba095];return _0x135e8c;};'use strict';var path=require(_0x4b34('0x0'));var fs=require('fs');var _=require(_0x4b34('0x1'));var db=require('../../mysqldb')['db'];var config=require(_0x4b34('0x2'));var util=require(_0x4b34('0x3'));var BPromise=require('bluebird');var jayson=require(_0x4b34('0x4'));var amiClient=jayson[_0x4b34('0x5')]['http']({'port':0x232a});var logger=require(_0x4b34('0x6'))(_0x4b34('0x7'));var Redis=require(_0x4b34('0x8'));config[_0x4b34('0x9')]=_[_0x4b34('0xa')](config[_0x4b34('0x9')],{'host':_0x4b34('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x4b34('0x9')]));var Schema=require(_0x4b34('0xc'));var originateValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'callNumber':{'type':'string','required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':_0x4b34('0xd')},'callbackUrl':{'type':_0x4b34('0xd')}});var hangupValidation=new Schema({'userId':{'type':_0x4b34('0xe'),'required':[!![],_0x4b34('0xf')]},'sessionId':{'type':_0x4b34('0xd'),'required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],_0x4b34('0xf')]},'sessionId':{'type':_0x4b34('0xd'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x4b34('0xe'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x4b34('0xd'),'required':[!![],_0x4b34('0x10')]},'transferNumber':{'type':_0x4b34('0xd'),'required':[!![],_0x4b34('0x11')]}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],_0x4b34('0xf')]},'sessionId':{'type':_0x4b34('0xd'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x4b34('0xd'),'required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],_0x4b34('0xf')]}});var conferenceValidation=new Schema({'userId':{'type':_0x4b34('0xe'),'required':[!![],_0x4b34('0xf')]}});function emit(_0x1ed068,_0x2092f3,_0x577ac4){logger['info'](_0x1ed068,_0x2092f3,JSON[_0x4b34('0x12')](_0x577ac4));io['to'](_0x1ed068)['emit'](_0x2092f3,_0x577ac4);}function handleError(_0x3e1e0d){return function(_0x114899){console[_0x4b34('0x13')]('handleError:',_0x114899,_0x114899 instanceof RangeError);logger[_0x4b34('0x14')](_0x114899['stack']);if(_0x114899 instanceof RangeError){if(_0x114899['name']){delete _0x114899['name'];}_0x3e1e0d[_0x4b34('0x15')](0x194)[_0x4b34('0x16')](_0x114899);}else{if(_0x114899['name']){delete _0x114899['name'];}_0x3e1e0d[_0x4b34('0x15')](0x1f4)[_0x4b34('0x16')](_0x114899);}};}function checkError(){return function(_0x355482){if(!_0x355482){throw new RangeError(_0x4b34('0x17'));}return _0x355482;};}function respondWithRpcPromise(_0x4b191f,_0x5c0174){return new BPromise(function(_0x483fcb,_0x9a8ccf){var _0x36feb6=amiClient;return _0x36feb6[_0x4b34('0x18')](_0x4b191f,_0x5c0174)[_0x4b34('0x19')](function(_0x396edd){if(_0x396edd[_0x4b34('0x14')]){if(_0x396edd['error'][_0x4b34('0x1a')]===0x1f4){return _0x9a8ccf(_0x396edd[_0x4b34('0x14')][_0x4b34('0x1b')]);}return _0x483fcb(_0x396edd[_0x4b34('0x14')][_0x4b34('0x1b')]);}else{_0x483fcb(_0x396edd[_0x4b34('0x1c')]);}})[_0x4b34('0x1d')](function(_0x545b0a){_0x9a8ccf(_0x545b0a);});});}function getAgent(_0x5aff22){return db[_0x4b34('0x1e')]['findOne']({'where':{'id':_0x5aff22,'role':'agent'}})[_0x4b34('0x19')](checkError());}function getAgentCheckSession(_0x190555,_0x3bebb4){return new BPromise(function(_0x827b74,_0x2f2100){var _0xcd2ff6=respondWithRpcPromise(_0x4b34('0x1f'));var _0x1835ef=getAgent(_0x190555);Promise[_0x4b34('0x20')]([_0xcd2ff6,_0x1835ef])[_0x4b34('0x19')](function(_0x30bf7e){var _0x3c82d3=_0x30bf7e[0x0];var _0x3eaad0=_0x30bf7e[0x1];var _0x248de9=_[_0x4b34('0x21')](_0x3c82d3[_0x4b34('0x22')],function(_0x2aab1){return _0x2aab1[_0x4b34('0x23')]==_0x3eaad0['id']&&_0x2aab1[_0x4b34('0x24')]==_0x3bebb4;});if(_0x248de9['length']==0x1){_0x827b74(_0x3eaad0);}else{_0x2f2100(new RangeError(_0x4b34('0x25')+_0x3bebb4+'\x20not\x20found!'));}});});}exports['originate']=function(_0xb4846d,_0x10f211){logger['info'](_0x4b34('0x26'),_0xb4846d[_0x4b34('0x27')]);var _0x4fa531=originateValidation[_0x4b34('0xc')](_0xb4846d[_0x4b34('0x27')]);if(_0x4fa531['length']>0x0){return _0x10f211['status'](0x190)[_0x4b34('0x28')](_0x4fa531);}var _0x55f694=_0xb4846d['body'][_0x4b34('0x29')];var _0xfee938=_0xb4846d[_0x4b34('0x27')][_0x4b34('0x2a')];var _0xb1e96a=_0xb4846d['body'][_0x4b34('0x2b')];var _0xaf8c32=_0xb4846d[_0x4b34('0x27')]['callbackUrl'];return getAgent(_0x55f694)[_0x4b34('0x19')](function(_0x32eed2){logger['info'](_0x4b34('0x2c'),_0x32eed2[_0x4b34('0x2d')]);emit(util[_0x4b34('0x2e')]('user:%s',_0x32eed2[_0x4b34('0x2d')]),_0x4b34('0x2f'),{'callNumber':_0xfee938,'callerId':_0xb1e96a,'callbackUrl':_0xaf8c32});return _0x10f211[_0x4b34('0x15')](0xc8)[_0x4b34('0x28')]({'error':![],'message':_0x4b34('0x30')});})[_0x4b34('0x1d')](handleError(_0x10f211));};exports[_0x4b34('0x31')]=function(_0xe7224c,_0x4dbbb8){logger[_0x4b34('0x32')]('hangup\x20fired:',_0xe7224c[_0x4b34('0x27')]);var _0x37a4fc=hangupValidation[_0x4b34('0xc')](_0xe7224c[_0x4b34('0x27')]);if(_0x37a4fc[_0x4b34('0x33')]>0x0){return _0x4dbbb8['status'](0x190)[_0x4b34('0x28')](_0x37a4fc);}var _0x536e0b=_0xe7224c[_0x4b34('0x27')]['userId'];var _0x4fabf9=_0xe7224c[_0x4b34('0x27')][_0x4b34('0x24')];return getAgent(_0x536e0b)[_0x4b34('0x19')](function(_0x459a31){logger['info']('entityFound:',_0x459a31['name']);emit(util['format'](_0x4b34('0x34'),_0x459a31[_0x4b34('0x2d')]),'webbar:hangup',{'sessionId':_0x4fabf9});return _0x4dbbb8[_0x4b34('0x15')](0xc8)[_0x4b34('0x28')]({'error':![],'message':_0x4b34('0x35')});})['catch'](handleError(_0x4dbbb8));};exports[_0x4b34('0x36')]=function(_0x2f1167,_0x375203){logger['info']('answer\x20fired:',_0x2f1167['body']);var _0x3f9c27=answerValidation[_0x4b34('0xc')](_0x2f1167['body']);if(_0x3f9c27[_0x4b34('0x33')]>0x0){return _0x375203['status'](0x190)[_0x4b34('0x28')](_0x3f9c27);}var _0x5bc0dd=_0x2f1167[_0x4b34('0x27')][_0x4b34('0x29')];var _0x30d7c5=_0x2f1167[_0x4b34('0x27')]['sessionId'];return getAgent(_0x5bc0dd)[_0x4b34('0x19')](function(_0x90cac3){logger[_0x4b34('0x32')](_0x4b34('0x2c'),_0x90cac3[_0x4b34('0x2d')]);emit(util[_0x4b34('0x2e')]('user:%s',_0x90cac3[_0x4b34('0x2d')]),'webbar:answer',{'sessionId':_0x30d7c5});return _0x375203[_0x4b34('0x15')](0xc8)[_0x4b34('0x28')]({'error':![],'message':_0x4b34('0x37')});})[_0x4b34('0x1d')](handleError(_0x375203));};exports[_0x4b34('0x38')]=function(_0x364202,_0x5d6901){logger[_0x4b34('0x32')](_0x4b34('0x39'),_0x364202[_0x4b34('0x27')]);var _0x29574d=holdValidation[_0x4b34('0xc')](_0x364202[_0x4b34('0x27')]);if(_0x29574d[_0x4b34('0x33')]>0x0){return _0x5d6901[_0x4b34('0x15')](0x190)[_0x4b34('0x28')](_0x29574d);}var _0xbb37f2=_0x364202[_0x4b34('0x27')][_0x4b34('0x29')];var _0x1b4518=_0x364202['body']['sessionId'];return getAgent(_0xbb37f2)['then'](function(_0x1019b4){logger[_0x4b34('0x32')](_0x4b34('0x2c'),_0x1019b4[_0x4b34('0x2d')]);emit(util['format'](_0x4b34('0x34'),_0x1019b4['name']),_0x4b34('0x3a'),{'sessionId':_0x1b4518});return _0x5d6901[_0x4b34('0x15')](0xc8)[_0x4b34('0x28')]({'error':![],'message':_0x4b34('0x3b')});})[_0x4b34('0x1d')](handleError(_0x5d6901));};exports[_0x4b34('0x3c')]=function(_0x1fc1e5,_0x20b824){logger[_0x4b34('0x32')]('unhold\x20fired:',_0x1fc1e5[_0x4b34('0x27')]);var _0xfab413=unholdValidation[_0x4b34('0xc')](_0x1fc1e5['body']);if(_0xfab413[_0x4b34('0x33')]>0x0){return _0x20b824[_0x4b34('0x15')](0x190)[_0x4b34('0x28')](_0xfab413);}var _0x310b7d=_0x1fc1e5[_0x4b34('0x27')]['userId'];var _0x10c599=_0x1fc1e5['body'][_0x4b34('0x24')];return getAgent(_0x310b7d)[_0x4b34('0x19')](function(_0x2e807b){logger['info'](_0x4b34('0x2c'),_0x2e807b[_0x4b34('0x2d')]);emit(util['format'](_0x4b34('0x34'),_0x2e807b['name']),'webbar:unhold',{'sessionId':_0x10c599});return _0x20b824[_0x4b34('0x15')](0xc8)[_0x4b34('0x28')]({'error':![],'message':'unhold\x20executed!'});})['catch'](handleError(_0x20b824));};exports[_0x4b34('0x3d')]=function(_0x461e07,_0x4c044a){logger[_0x4b34('0x32')](_0x4b34('0x3e'),_0x4c044a[_0x4b34('0x27')]);var _0x50b478=callsValidation[_0x4b34('0xc')](_0x461e07['body']);if(_0x50b478[_0x4b34('0x33')]>0x0){return _0x4c044a[_0x4b34('0x15')](0x190)['json'](_0x50b478);}var _0xea542e=_0x461e07[_0x4b34('0x27')][_0x4b34('0x29')];var _0x1c625d=respondWithRpcPromise(_0x4b34('0x1f'));var _0x1408b2=getAgent(_0xea542e);return Promise[_0x4b34('0x20')]([_0x1c625d,_0x1408b2])[_0x4b34('0x19')](function(_0x269813){var _0x47f055=_0x269813[0x0];var _0x4013b9=_0x269813[0x1];var _0x32ea0c=_['filter'](_0x47f055['rows'],function(_0x359017){return _0x359017[_0x4b34('0x23')]==_0x4013b9['id'];});return _0x4c044a[_0x4b34('0x15')](0xc8)[_0x4b34('0x28')]({'count':_0x32ea0c[_0x4b34('0x33')],'rows':_0x32ea0c});})[_0x4b34('0x1d')](handleError(_0x4c044a));};exports['conference']=function(_0x3571cf,_0xffd9f){logger['info'](_0x4b34('0x3f'),_0x3571cf[_0x4b34('0x27')]);var _0xde6f8c=conferenceValidation[_0x4b34('0xc')](_0x3571cf[_0x4b34('0x27')]);if(_0xde6f8c[_0x4b34('0x33')]>0x0){return _0xffd9f[_0x4b34('0x15')](0x190)['json'](_0xde6f8c);}var _0x149fd0=_0x3571cf[_0x4b34('0x27')][_0x4b34('0x29')];return getAgent(_0x149fd0)['then'](function(_0x50233d){logger[_0x4b34('0x32')](_0x4b34('0x2c'),_0x50233d[_0x4b34('0x2d')]);emit(util['format']('user:%s',_0x50233d[_0x4b34('0x2d')]),'webbar:conference');return _0xffd9f['status'](0xc8)[_0x4b34('0x28')]({'error':![],'message':_0x4b34('0x40')});})[_0x4b34('0x1d')](handleError(_0xffd9f));};exports[_0x4b34('0x41')]=function(_0x376017,_0x39c6ed){logger['info']('transfer\x20fired:',_0x376017[_0x4b34('0x27')]);var _0x32912b=transferValidation[_0x4b34('0xc')](_0x376017[_0x4b34('0x27')]);if(_0x32912b[_0x4b34('0x33')]>0x0){return _0x39c6ed[_0x4b34('0x15')](0x190)[_0x4b34('0x28')](_0x32912b);}var _0x4888a9=_0x376017[_0x4b34('0x27')][_0x4b34('0x29')];var _0xbfed98=_0x376017[_0x4b34('0x27')][_0x4b34('0x24')];var _0x1d3e85=_0x376017['body'][_0x4b34('0x42')];return getAgent(_0x4888a9)[_0x4b34('0x19')](function(_0x13b186){logger[_0x4b34('0x32')](_0x4b34('0x2c'),_0x13b186['name']);emit(util[_0x4b34('0x2e')](_0x4b34('0x34'),_0x13b186[_0x4b34('0x2d')]),'webbar:transfer',{'sessionId':_0xbfed98,'transferNumber':_0x1d3e85});return _0x39c6ed[_0x4b34('0x15')](0xc8)[_0x4b34('0x28')]({'error':![],'message':_0x4b34('0x43')});})[_0x4b34('0x1d')](handleError(_0x39c6ed));}; \ No newline at end of file +var _0x53f7=['../../config/logger','webbarapi','ioredis','redis','defaults','localhost','socket.io-emitter','userId\x20is\x20required','string','callNumber\x20is\x20required','number','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','emit','handleError:','name','send','status','NotFound','then','code','error','message','User','findOne','agent','VoiceChannels','all','filter','rows','UserId','sessionId','length','sessionId\x20','\x20not\x20found!','originate\x20fired:','body','validate','json','userId','callNumber','callerId','callbackUrl','entityFound:','webbar:originate','originate\x20executed!','hangup\x20fired:','format','user:%s','webbar:hangup','catch','answer','answer\x20fired:','webbar:answer','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','calls','conference','conference\x20fired:','transfer','transfer\x20fired:','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','../../config/environment','util','bluebird','jayson/promise','http'];(function(_0x2c088d,_0x42e53e){var _0x44c8bc=function(_0x210387){while(--_0x210387){_0x2c088d['push'](_0x2c088d['shift']());}};_0x44c8bc(++_0x42e53e);}(_0x53f7,0x12c));var _0x753f=function(_0x1589dd,_0x2b9d22){_0x1589dd=_0x1589dd-0x0;var _0x1bddd1=_0x53f7[_0x1589dd];return _0x1bddd1;};'use strict';var path=require(_0x753f('0x0'));var fs=require('fs');var _=require(_0x753f('0x1'));var db=require(_0x753f('0x2'))['db'];var config=require(_0x753f('0x3'));var util=require(_0x753f('0x4'));var BPromise=require(_0x753f('0x5'));var jayson=require(_0x753f('0x6'));var amiClient=jayson['client'][_0x753f('0x7')]({'port':0x232a});var logger=require(_0x753f('0x8'))(_0x753f('0x9'));var Redis=require(_0x753f('0xa'));config[_0x753f('0xb')]=_[_0x753f('0xc')](config[_0x753f('0xb')],{'host':_0x753f('0xd'),'port':0x18eb});var io=require(_0x753f('0xe'))(new Redis(config['redis']));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':'number','required':[!![],_0x753f('0xf')]},'callNumber':{'type':_0x753f('0x10'),'required':[!![],_0x753f('0x11')]},'callerId':{'type':_0x753f('0x10')},'callbackUrl':{'type':_0x753f('0x10')}});var hangupValidation=new Schema({'userId':{'type':_0x753f('0x12'),'required':[!![],_0x753f('0xf')]},'sessionId':{'type':_0x753f('0x10'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x753f('0x12'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x753f('0x10'),'required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],_0x753f('0xf')]},'sessionId':{'type':_0x753f('0x10'),'required':[!![],_0x753f('0x13')]},'transferNumber':{'type':_0x753f('0x10'),'required':[!![],_0x753f('0x14')]}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],_0x753f('0xf')]},'sessionId':{'type':_0x753f('0x10'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x753f('0x12'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x753f('0x10'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x753f('0x12'),'required':[!![],_0x753f('0xf')]}});var conferenceValidation=new Schema({'userId':{'type':_0x753f('0x12'),'required':[!![],_0x753f('0xf')]}});function emit(_0x20dff1,_0x4f2917,_0x53be13){logger[_0x753f('0x15')](_0x20dff1,_0x4f2917,JSON[_0x753f('0x16')](_0x53be13));io['to'](_0x20dff1)[_0x753f('0x17')](_0x4f2917,_0x53be13);}function handleError(_0x3f0c5e){return function(_0x39e35b){console['log'](_0x753f('0x18'),_0x39e35b,_0x39e35b instanceof RangeError);logger['error'](_0x39e35b['stack']);if(_0x39e35b instanceof RangeError){if(_0x39e35b['name']){delete _0x39e35b[_0x753f('0x19')];}_0x3f0c5e['status'](0x194)[_0x753f('0x1a')](_0x39e35b);}else{if(_0x39e35b['name']){delete _0x39e35b['name'];}_0x3f0c5e[_0x753f('0x1b')](0x1f4)[_0x753f('0x1a')](_0x39e35b);}};}function checkError(){return function(_0x593c51){if(!_0x593c51){throw new RangeError(_0x753f('0x1c'));}return _0x593c51;};}function respondWithRpcPromise(_0x4894e9,_0x2427ee){return new BPromise(function(_0x159124,_0x408e2f){var _0x56cf29=amiClient;return _0x56cf29['request'](_0x4894e9,_0x2427ee)[_0x753f('0x1d')](function(_0xff68){if(_0xff68['error']){if(_0xff68['error'][_0x753f('0x1e')]===0x1f4){return _0x408e2f(_0xff68[_0x753f('0x1f')]['message']);}return _0x159124(_0xff68[_0x753f('0x1f')][_0x753f('0x20')]);}else{_0x159124(_0xff68['result']);}})['catch'](function(_0x14067a){_0x408e2f(_0x14067a);});});}function getAgent(_0x555cfb){return db[_0x753f('0x21')][_0x753f('0x22')]({'where':{'id':_0x555cfb,'role':_0x753f('0x23')}})['then'](checkError());}function getAgentCheckSession(_0x56d4a5,_0x304c79){return new BPromise(function(_0x43ab0e,_0x271267){var _0x253bc7=respondWithRpcPromise(_0x753f('0x24'));var _0x101559=getAgent(_0x56d4a5);Promise[_0x753f('0x25')]([_0x253bc7,_0x101559])[_0x753f('0x1d')](function(_0x22947a){var _0x1769c0=_0x22947a[0x0];var _0x474bfb=_0x22947a[0x1];var _0x5b36ca=_[_0x753f('0x26')](_0x1769c0[_0x753f('0x27')],function(_0x424e8a){return _0x424e8a[_0x753f('0x28')]==_0x474bfb['id']&&_0x424e8a[_0x753f('0x29')]==_0x304c79;});if(_0x5b36ca[_0x753f('0x2a')]==0x1){_0x43ab0e(_0x474bfb);}else{_0x271267(new RangeError(_0x753f('0x2b')+_0x304c79+_0x753f('0x2c')));}});});}exports['originate']=function(_0x2fcd6b,_0x307dab){logger[_0x753f('0x15')](_0x753f('0x2d'),_0x2fcd6b[_0x753f('0x2e')]);var _0x2039f6=originateValidation[_0x753f('0x2f')](_0x2fcd6b['body']);if(_0x2039f6[_0x753f('0x2a')]>0x0){return _0x307dab['status'](0x190)[_0x753f('0x30')](_0x2039f6);}var _0xe168af=_0x2fcd6b[_0x753f('0x2e')][_0x753f('0x31')];var _0xeca38b=_0x2fcd6b['body'][_0x753f('0x32')];var _0x502474=_0x2fcd6b[_0x753f('0x2e')][_0x753f('0x33')];var _0x1c4116=_0x2fcd6b['body'][_0x753f('0x34')];return getAgent(_0xe168af)[_0x753f('0x1d')](function(_0x26af0e){logger[_0x753f('0x15')](_0x753f('0x35'),_0x26af0e[_0x753f('0x19')]);emit(util['format']('user:%s',_0x26af0e['name']),_0x753f('0x36'),{'callNumber':_0xeca38b,'callerId':_0x502474,'callbackUrl':_0x1c4116});return _0x307dab[_0x753f('0x1b')](0xc8)[_0x753f('0x30')]({'error':![],'message':_0x753f('0x37')});})['catch'](handleError(_0x307dab));};exports['hangup']=function(_0x1e34a1,_0x36a73e){logger[_0x753f('0x15')](_0x753f('0x38'),_0x1e34a1[_0x753f('0x2e')]);var _0x1d779d=hangupValidation[_0x753f('0x2f')](_0x1e34a1[_0x753f('0x2e')]);if(_0x1d779d[_0x753f('0x2a')]>0x0){return _0x36a73e[_0x753f('0x1b')](0x190)[_0x753f('0x30')](_0x1d779d);}var _0x4e676c=_0x1e34a1['body'][_0x753f('0x31')];var _0x10baec=_0x1e34a1[_0x753f('0x2e')][_0x753f('0x29')];return getAgent(_0x4e676c)[_0x753f('0x1d')](function(_0x92d6d2){logger[_0x753f('0x15')](_0x753f('0x35'),_0x92d6d2[_0x753f('0x19')]);emit(util[_0x753f('0x39')](_0x753f('0x3a'),_0x92d6d2['name']),_0x753f('0x3b'),{'sessionId':_0x10baec});return _0x36a73e[_0x753f('0x1b')](0xc8)[_0x753f('0x30')]({'error':![],'message':'hangup\x20executed!'});})[_0x753f('0x3c')](handleError(_0x36a73e));};exports[_0x753f('0x3d')]=function(_0x300661,_0x64fd36){logger['info'](_0x753f('0x3e'),_0x300661['body']);var _0x540cdb=answerValidation['validate'](_0x300661['body']);if(_0x540cdb[_0x753f('0x2a')]>0x0){return _0x64fd36[_0x753f('0x1b')](0x190)['json'](_0x540cdb);}var _0x229a0c=_0x300661[_0x753f('0x2e')]['userId'];var _0x329e82=_0x300661[_0x753f('0x2e')][_0x753f('0x29')];return getAgent(_0x229a0c)[_0x753f('0x1d')](function(_0x24270b){logger[_0x753f('0x15')](_0x753f('0x35'),_0x24270b[_0x753f('0x19')]);emit(util[_0x753f('0x39')](_0x753f('0x3a'),_0x24270b[_0x753f('0x19')]),_0x753f('0x3f'),{'sessionId':_0x329e82});return _0x64fd36['status'](0xc8)['json']({'error':![],'message':'answer\x20executed!'});})[_0x753f('0x3c')](handleError(_0x64fd36));};exports[_0x753f('0x40')]=function(_0x2a44d9,_0xad679b){logger[_0x753f('0x15')](_0x753f('0x41'),_0x2a44d9[_0x753f('0x2e')]);var _0x1000c0=holdValidation['validate'](_0x2a44d9[_0x753f('0x2e')]);if(_0x1000c0[_0x753f('0x2a')]>0x0){return _0xad679b[_0x753f('0x1b')](0x190)[_0x753f('0x30')](_0x1000c0);}var _0x3943d8=_0x2a44d9['body']['userId'];var _0x136bfb=_0x2a44d9[_0x753f('0x2e')]['sessionId'];return getAgent(_0x3943d8)[_0x753f('0x1d')](function(_0x38243f){logger['info']('entityFound:',_0x38243f[_0x753f('0x19')]);emit(util[_0x753f('0x39')](_0x753f('0x3a'),_0x38243f[_0x753f('0x19')]),_0x753f('0x42'),{'sessionId':_0x136bfb});return _0xad679b[_0x753f('0x1b')](0xc8)[_0x753f('0x30')]({'error':![],'message':_0x753f('0x43')});})[_0x753f('0x3c')](handleError(_0xad679b));};exports[_0x753f('0x44')]=function(_0x527421,_0xd3e6b){logger[_0x753f('0x15')](_0x753f('0x45'),_0x527421[_0x753f('0x2e')]);var _0x163dc8=unholdValidation['validate'](_0x527421[_0x753f('0x2e')]);if(_0x163dc8[_0x753f('0x2a')]>0x0){return _0xd3e6b[_0x753f('0x1b')](0x190)[_0x753f('0x30')](_0x163dc8);}var _0x4402f0=_0x527421['body'][_0x753f('0x31')];var _0xc1caa9=_0x527421['body'][_0x753f('0x29')];return getAgent(_0x4402f0)[_0x753f('0x1d')](function(_0x57cde4){logger[_0x753f('0x15')](_0x753f('0x35'),_0x57cde4['name']);emit(util[_0x753f('0x39')](_0x753f('0x3a'),_0x57cde4[_0x753f('0x19')]),'webbar:unhold',{'sessionId':_0xc1caa9});return _0xd3e6b[_0x753f('0x1b')](0xc8)[_0x753f('0x30')]({'error':![],'message':'unhold\x20executed!'});})[_0x753f('0x3c')](handleError(_0xd3e6b));};exports[_0x753f('0x46')]=function(_0x478131,_0x4a23b8){logger[_0x753f('0x15')]('calls\x20fired:',_0x4a23b8[_0x753f('0x2e')]);var _0x281efd=callsValidation[_0x753f('0x2f')](_0x478131['body']);if(_0x281efd[_0x753f('0x2a')]>0x0){return _0x4a23b8[_0x753f('0x1b')](0x190)['json'](_0x281efd);}var _0x487ac6=_0x478131[_0x753f('0x2e')][_0x753f('0x31')];var _0x4fb02d=respondWithRpcPromise(_0x753f('0x24'));var _0x1779ce=getAgent(_0x487ac6);return Promise['all']([_0x4fb02d,_0x1779ce])[_0x753f('0x1d')](function(_0x59d990){var _0x3d6665=_0x59d990[0x0];var _0x294f6a=_0x59d990[0x1];var _0x19bc8b=_[_0x753f('0x26')](_0x3d6665[_0x753f('0x27')],function(_0x10d653){return _0x10d653[_0x753f('0x28')]==_0x294f6a['id'];});return _0x4a23b8[_0x753f('0x1b')](0xc8)[_0x753f('0x30')]({'count':_0x19bc8b[_0x753f('0x2a')],'rows':_0x19bc8b});})['catch'](handleError(_0x4a23b8));};exports[_0x753f('0x47')]=function(_0x425c39,_0x5c3d74){logger['info'](_0x753f('0x48'),_0x425c39['body']);var _0x4b21e3=conferenceValidation[_0x753f('0x2f')](_0x425c39['body']);if(_0x4b21e3[_0x753f('0x2a')]>0x0){return _0x5c3d74[_0x753f('0x1b')](0x190)['json'](_0x4b21e3);}var _0x4ee3bb=_0x425c39[_0x753f('0x2e')][_0x753f('0x31')];return getAgent(_0x4ee3bb)[_0x753f('0x1d')](function(_0x437880){logger['info']('entityFound:',_0x437880[_0x753f('0x19')]);emit(util[_0x753f('0x39')]('user:%s',_0x437880[_0x753f('0x19')]),'webbar:conference');return _0x5c3d74[_0x753f('0x1b')](0xc8)[_0x753f('0x30')]({'error':![],'message':'conference\x20executed!'});})['catch'](handleError(_0x5c3d74));};exports[_0x753f('0x49')]=function(_0x565bdd,_0x5e9795){logger[_0x753f('0x15')](_0x753f('0x4a'),_0x565bdd[_0x753f('0x2e')]);var _0x44435e=transferValidation[_0x753f('0x2f')](_0x565bdd['body']);if(_0x44435e['length']>0x0){return _0x5e9795[_0x753f('0x1b')](0x190)[_0x753f('0x30')](_0x44435e);}var _0x292515=_0x565bdd[_0x753f('0x2e')][_0x753f('0x31')];var _0x1aaf60=_0x565bdd[_0x753f('0x2e')]['sessionId'];var _0x14156f=_0x565bdd[_0x753f('0x2e')]['transferNumber'];return getAgent(_0x292515)[_0x753f('0x1d')](function(_0x130f21){logger[_0x753f('0x15')](_0x753f('0x35'),_0x130f21['name']);emit(util['format'](_0x753f('0x3a'),_0x130f21[_0x753f('0x19')]),_0x753f('0x4b'),{'sessionId':_0x1aaf60,'transferNumber':_0x14156f});return _0x5e9795[_0x753f('0x1b')](0xc8)[_0x753f('0x30')]({'error':![],'message':_0x753f('0x4c')});})[_0x753f('0x3c')](handleError(_0x5e9795));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 46f58e8..9ca97ba 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 _0x4d32=['express','fs-extra','../../components/auth/service','../../config/environment','index','/describe','describe','get','/:id','isAuthenticated','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/users','getAgents','/:id/applications','getApplications','create','post','addDisposition','addAnswer','addAgents','addApplications','notify','delete','removeDispositions','exports','multer','util','connect-timeout'];(function(_0x1a20bd,_0x536b6e){var _0x3824a4=function(_0x274756){while(--_0x274756){_0x1a20bd['push'](_0x1a20bd['shift']());}};_0x3824a4(++_0x536b6e);}(_0x4d32,0x79));var _0x24d3=function(_0x47cd84,_0x3056b9){_0x47cd84=_0x47cd84-0x0;var _0x800299=_0x4d32[_0x47cd84];return _0x800299;};'use strict';var multer=require(_0x24d3('0x0'));var util=require(_0x24d3('0x1'));var path=require('path');var timeout=require(_0x24d3('0x2'));var express=require(_0x24d3('0x3'));var router=express['Router']();var fs_extra=require(_0x24d3('0x4'));var auth=require(_0x24d3('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x24d3('0x6'));var controller=require('./whatsappAccount.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x24d3('0x7')]);router['get'](_0x24d3('0x8'),auth['isAuthenticated'](),controller[_0x24d3('0x9')]);router[_0x24d3('0xa')](_0x24d3('0xb'),auth[_0x24d3('0xc')](),controller[_0x24d3('0xd')]);router[_0x24d3('0xa')](_0x24d3('0xe'),auth['isAuthenticated'](),controller['getDispositions']);router[_0x24d3('0xa')](_0x24d3('0xf'),auth[_0x24d3('0xc')](),controller[_0x24d3('0x10')]);router[_0x24d3('0xa')](_0x24d3('0x11'),auth[_0x24d3('0xc')](),controller[_0x24d3('0x12')]);router['get'](_0x24d3('0x13'),auth[_0x24d3('0xc')](),controller[_0x24d3('0x14')]);router['post']('/',auth[_0x24d3('0xc')](),controller[_0x24d3('0x15')]);router[_0x24d3('0x16')](_0x24d3('0xe'),auth[_0x24d3('0xc')](),controller[_0x24d3('0x17')]);router[_0x24d3('0x16')]('/:id/canned_answers',auth[_0x24d3('0xc')](),controller[_0x24d3('0x18')]);router['post'](_0x24d3('0x11'),auth['isAuthenticated'](),controller[_0x24d3('0x19')]);router['post'](_0x24d3('0x13'),auth['isAuthenticated'](),controller[_0x24d3('0x1a')]);router[_0x24d3('0x16')]('/:id/notify',controller[_0x24d3('0x1b')]);router[_0x24d3('0x16')]('/:id/send',auth[_0x24d3('0xc')](),controller['send']);router['put']('/:id',auth[_0x24d3('0xc')](),controller['update']);router['delete'](_0x24d3('0xb'),auth[_0x24d3('0xc')](),controller['destroy']);router[_0x24d3('0x1c')](_0x24d3('0xe'),auth['isAuthenticated'](),controller[_0x24d3('0x1d')]);router[_0x24d3('0x1c')](_0x24d3('0xf'),auth['isAuthenticated'](),controller['removeAnswers']);router[_0x24d3('0x1c')](_0x24d3('0x11'),auth[_0x24d3('0xc')](),controller['removeAgents']);module[_0x24d3('0x1e')]=router; \ No newline at end of file +var _0xcf5c=['multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','/:id/dispositions','getDispositions','getAnswers','getAgents','/:id/applications','getApplications','create','addDisposition','/:id/canned_answers','post','/:id/users','addApplications','notify','/:id/send','update','destroy','delete','removeDispositions','removeAgents','exports'];(function(_0x1d638f,_0x370f10){var _0x27f549=function(_0x131909){while(--_0x131909){_0x1d638f['push'](_0x1d638f['shift']());}};_0x27f549(++_0x370f10);}(_0xcf5c,0xcc));var _0xccf5=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xcf5c[_0x6131cd];return _0x47e916;};'use strict';var multer=require(_0xccf5('0x0'));var util=require('util');var path=require(_0xccf5('0x1'));var timeout=require(_0xccf5('0x2'));var express=require('express');var router=express[_0xccf5('0x3')]();var fs_extra=require(_0xccf5('0x4'));var auth=require(_0xccf5('0x5'));var interaction=require(_0xccf5('0x6'));var config=require(_0xccf5('0x7'));var controller=require('./whatsappAccount.controller');router[_0xccf5('0x8')]('/',auth[_0xccf5('0x9')](),controller[_0xccf5('0xa')]);router['get'](_0xccf5('0xb'),auth[_0xccf5('0x9')](),controller[_0xccf5('0xc')]);router[_0xccf5('0x8')](_0xccf5('0xd'),auth[_0xccf5('0x9')](),controller['show']);router[_0xccf5('0x8')](_0xccf5('0xe'),auth[_0xccf5('0x9')](),controller[_0xccf5('0xf')]);router[_0xccf5('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0xccf5('0x10')]);router[_0xccf5('0x8')]('/:id/users',auth[_0xccf5('0x9')](),controller[_0xccf5('0x11')]);router[_0xccf5('0x8')](_0xccf5('0x12'),auth['isAuthenticated'](),controller[_0xccf5('0x13')]);router['post']('/',auth['isAuthenticated'](),controller[_0xccf5('0x14')]);router['post'](_0xccf5('0xe'),auth[_0xccf5('0x9')](),controller[_0xccf5('0x15')]);router['post'](_0xccf5('0x16'),auth[_0xccf5('0x9')](),controller['addAnswer']);router[_0xccf5('0x17')](_0xccf5('0x18'),auth[_0xccf5('0x9')](),controller['addAgents']);router[_0xccf5('0x17')](_0xccf5('0x12'),auth['isAuthenticated'](),controller[_0xccf5('0x19')]);router[_0xccf5('0x17')]('/:id/notify',controller[_0xccf5('0x1a')]);router[_0xccf5('0x17')](_0xccf5('0x1b'),auth[_0xccf5('0x9')](),controller['send']);router['put'](_0xccf5('0xd'),auth[_0xccf5('0x9')](),controller[_0xccf5('0x1c')]);router['delete'](_0xccf5('0xd'),auth[_0xccf5('0x9')](),controller[_0xccf5('0x1d')]);router[_0xccf5('0x1e')](_0xccf5('0xe'),auth['isAuthenticated'](),controller[_0xccf5('0x1f')]);router['delete'](_0xccf5('0x16'),auth[_0xccf5('0x9')](),controller['removeAnswers']);router[_0xccf5('0x1e')](_0xccf5('0x18'),auth['isAuthenticated'](),controller[_0xccf5('0x20')]);module[_0xccf5('0x21')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 89bc3e7..ab17273 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 _0x8bbb=['Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','exports','STRING','name','generate','ENUM','sinch'];(function(_0x23c33c,_0x1d1aad){var _0x2c6c21=function(_0x5bfdb9){while(--_0x5bfdb9){_0x23c33c['push'](_0x23c33c['shift']());}};_0x2c6c21(++_0x1d1aad);}(_0x8bbb,0x18e));var _0xb8bb=function(_0x48b5e0,_0xb3826){_0x48b5e0=_0x48b5e0-0x0;var _0x4287ea=_0x8bbb[_0x48b5e0];return _0x4287ea;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xb8bb('0x0'));module[_0xb8bb('0x1')]={'name':{'type':Sequelize[_0xb8bb('0x2')],'unique':_0xb8bb('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0xb8bb('0x2')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0xb8bb('0x2')],'defaultValue':function(){return rs[_0xb8bb('0x4')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xb8bb('0x5')]('twilio',_0xb8bb('0x6'))},'accountSid':{'type':Sequelize['STRING']},'baseUrl':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xb8bb('0x7');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xb8bb('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xb8bb('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xb8bb('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xb8bb('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xb8bb('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xb8bb('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xb8bb('0x9')],'comment':_0xb8bb('0xa')},'mandatoryDisposition':{'type':Sequelize[_0xb8bb('0x8')],'defaultValue':![],'comment':_0xb8bb('0xb'),'set':function(_0x206312){if(!_0x206312){this[_0xb8bb('0xc')](_0xb8bb('0xd'),null);}this['setDataValue'](_0xb8bb('0xe'),_0x206312);}},'description':{'type':Sequelize[_0xb8bb('0x2')]}}; \ No newline at end of file +var _0x39f0=['BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','generate','ENUM','twilio','sinch','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}'];(function(_0x370035,_0x428ff8){var _0x499abd=function(_0x2a2ac1){while(--_0x2a2ac1){_0x370035['push'](_0x370035['shift']());}};_0x499abd(++_0x428ff8);}(_0x39f0,0x1d1));var _0x039f=function(_0x768ec5,_0x2b808e){_0x768ec5=_0x768ec5-0x0;var _0x2f6cf7=_0x39f0[_0x768ec5];return _0x2f6cf7;};'use strict';var Sequelize=require(_0x039f('0x0'));var rs=require(_0x039f('0x1'));module[_0x039f('0x2')]={'name':{'type':Sequelize[_0x039f('0x3')],'unique':_0x039f('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x039f('0x3')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0x039f('0x3')],'defaultValue':function(){return rs[_0x039f('0x5')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x039f('0x6')](_0x039f('0x7'),_0x039f('0x8'))},'accountSid':{'type':Sequelize[_0x039f('0x3')]},'baseUrl':{'type':Sequelize[_0x039f('0x3')]},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x039f('0x9')],'defaultValue':function(){return _0x039f('0xa');}},'notificationSound':{'type':Sequelize[_0x039f('0xb')],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x039f('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x039f('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x039f('0xb')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x039f('0xc')],'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[_0x039f('0xc')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x039f('0xb')],'defaultValue':![],'comment':_0x039f('0xd'),'set':function(_0x4206ba){if(!_0x4206ba){this[_0x039f('0xe')](_0x039f('0xf'),null);}this[_0x039f('0xe')](_0x039f('0x10'),_0x4206ba);}},'description':{'type':Sequelize[_0x039f('0x3')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index e08cf52..3bdc6c0 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 _0x5934=['hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','merge','find','WhatsappAccount','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','WhatsappAccountId','Disposition','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','addAgents','spread','userWhatsappAccount:save','removeAgents','isArray','emit','findOne','User','getAgents','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','notify','whatsapp','Applications','account','sinch','statuses','state','read','WhatsappMessage','update','timestamp','message_id','orderBy','asc','CmContact','describe','Sequelize','difference','createdAt','updatedAt','CompanyId','ListId','twilio','From','replace','whatsapp:','Body','messageId','MessageSid','from','notifications','isNil','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','list','omit','Contacts','mapKey','contact','WhatsappInteraction','created','autoclose','applications','unmanaged','*,*,*,*','interaction','ContactId','AttachmentId','UserId','agent','waitForTheAssignedAgent','queueId','unshift','queue','waitForTheAssignedQueue','Start','startRouting','entity\x20found','debug','stringify','Content-Type','text/xml','\x0a','send','to\x20is\x20mandatory','List','DESC','out','dataValues','Messages','push','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./whatsappAccount.socket','register','client','http','request','then','info','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','WhatsappAccount,\x20%s,\x20%s','message','result','sendStatus','status','json','undefined','limit','offset','count','set','Content-Range','apply','reject','destroy','get','WhatsappAccounts','UserProfileResource','end','stack','name','index','Pause','mandatoryDispositionPause','fieldName','type','key','model','map','keys','query','intersection','fields','attributes','length'];(function(_0x1521b5,_0x51ec2d){var _0x152e4b=function(_0x36f3cc){while(--_0x36f3cc){_0x1521b5['push'](_0x1521b5['shift']());}};_0x152e4b(++_0x51ec2d);}(_0x5934,0x84));var _0x4593=function(_0x1dc2e2,_0x4948ef){_0x1dc2e2=_0x1dc2e2-0x0;var _0xdca95b=_0x5934[_0x1dc2e2];return _0xdca95b;};'use strict';var emlformat=require(_0x4593('0x0'));var rimraf=require(_0x4593('0x1'));var zipdir=require(_0x4593('0x2'));var jsonpatch=require(_0x4593('0x3'));var rp=require(_0x4593('0x4'));var moment=require(_0x4593('0x5'));var BPromise=require(_0x4593('0x6'));var Mustache=require('mustache');var util=require(_0x4593('0x7'));var path=require(_0x4593('0x8'));var sox=require(_0x4593('0x9'));var csv=require(_0x4593('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x4593('0xb'));var jsforce=require(_0x4593('0xc'));var deskjs=require(_0x4593('0xd'));var toCsv=require(_0x4593('0xa'));var querystring=require(_0x4593('0xe'));var Papa=require('papaparse');var Redis=require(_0x4593('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x4593('0x10'));var as=require(_0x4593('0x11'));var hardwareService=require(_0x4593('0x12'));var logger=require('../../config/logger')(_0x4593('0x13'));var utils=require('../../config/utils');var config=require(_0x4593('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x4593('0x15'))['db'];config[_0x4593('0x16')]=_[_0x4593('0x17')](config[_0x4593('0x16')],{'host':_0x4593('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x4593('0x19'))[_0x4593('0x1a')](socket);var jayson=require('jayson/promise');var client=jayson[_0x4593('0x1b')][_0x4593('0x1c')]({'port':0x232c});function respondWithRpcPromise(_0x2e773d,_0x294c1,_0xd0553c,_0x51a264){return new BPromise(function(_0x412e56,_0xf7b735){var _0x5c4b10=_0x51a264||client;return _0x5c4b10[_0x4593('0x1d')](_0x2e773d,_0xd0553c)[_0x4593('0x1e')](function(_0x538e4a){logger[_0x4593('0x1f')]('WhatsappAccount,\x20%s,\x20%s',_0x294c1,_0x4593('0x20'));logger['debug'](_0x4593('0x21'),_0x294c1,_0x4593('0x20'),JSON['stringify'](_0x538e4a));if(_0x538e4a['error']){if(_0x538e4a[_0x4593('0x22')]['code']===0x1f4){logger[_0x4593('0x22')](_0x4593('0x23'),_0x294c1,_0x538e4a[_0x4593('0x22')][_0x4593('0x24')]);return _0xf7b735(_0x538e4a[_0x4593('0x22')][_0x4593('0x24')]);}logger['error'](_0x4593('0x23'),_0x294c1,_0x538e4a['error']['message']);return _0x412e56(_0x538e4a[_0x4593('0x22')]['message']);}else{logger[_0x4593('0x1f')]('WhatsappAccount,\x20%s,\x20%s',_0x294c1,_0x4593('0x20'));_0x412e56(_0x538e4a[_0x4593('0x25')][_0x4593('0x24')]);}})['catch'](function(_0x5f43de){logger[_0x4593('0x22')](_0x4593('0x23'),_0x294c1,_0x5f43de);_0xf7b735(_0x5f43de);});});}function respondWithStatusCode(_0x4458ae,_0x5a078a){_0x5a078a=_0x5a078a||0xcc;return function(_0x551aec){if(_0x551aec){return _0x4458ae[_0x4593('0x26')](_0x5a078a);}return _0x4458ae['status'](_0x5a078a)['end']();};}function respondWithResult(_0x1f12cf,_0x5cc52e){_0x5cc52e=_0x5cc52e||0xc8;return function(_0xdebb23){if(_0xdebb23){return _0x1f12cf[_0x4593('0x27')](_0x5cc52e)[_0x4593('0x28')](_0xdebb23);}};}function respondWithFilteredResult(_0x5559f9,_0x151691){return function(_0x1c469b){if(_0x1c469b){var _0x2bf78d=typeof _0x151691['offset']===_0x4593('0x29')&&typeof _0x151691[_0x4593('0x2a')]===_0x4593('0x29');var _0x3d1dda=_0x1c469b['count'];var _0x45ddb7=_0x2bf78d?0x0:_0x151691[_0x4593('0x2b')];var _0x42f96d=_0x2bf78d?_0x1c469b[_0x4593('0x2c')]:_0x151691[_0x4593('0x2b')]+_0x151691[_0x4593('0x2a')];var _0x3916ad;if(_0x42f96d>=_0x3d1dda){_0x42f96d=_0x3d1dda;_0x3916ad=0xc8;}else{_0x3916ad=0xce;}_0x5559f9[_0x4593('0x27')](_0x3916ad);return _0x5559f9[_0x4593('0x2d')](_0x4593('0x2e'),_0x45ddb7+'-'+_0x42f96d+'/'+_0x3d1dda)[_0x4593('0x28')](_0x1c469b);}return null;};}function patchUpdates(_0x55bbef){return function(_0x12d60d){try{jsonpatch[_0x4593('0x2f')](_0x12d60d,_0x55bbef,!![]);}catch(_0x1ad323){return BPromise[_0x4593('0x30')](_0x1ad323);}return _0x12d60d['save']();};}function saveUpdates(_0xb5c97,_0x3355b3){return function(_0x498689){if(_0x498689){return _0x498689['update'](_0xb5c97)[_0x4593('0x1e')](function(_0x2fc4a3){return _0x2fc4a3;});}return null;};}function removeEntity(_0x27aee5,_0x58e672){return function(_0x7097e4){if(_0x7097e4){return _0x7097e4[_0x4593('0x31')]()['then'](function(){var _0x155c22=_0x7097e4[_0x4593('0x32')]({'plain':!![]});var _0x579cce=_0x4593('0x33');return db[_0x4593('0x34')][_0x4593('0x31')]({'where':{'type':_0x579cce,'resourceId':_0x155c22['id']}})[_0x4593('0x1e')](function(){return _0x7097e4;});})['then'](function(){_0x27aee5[_0x4593('0x27')](0xcc)[_0x4593('0x35')]();});}};}function handleEntityNotFound(_0x1ba353,_0x1b3ae9){return function(_0x194aaf){if(!_0x194aaf){_0x1ba353[_0x4593('0x26')](0x194);}return _0x194aaf;};}function handleError(_0x23bbac,_0x409ca5){_0x409ca5=_0x409ca5||0x1f4;return function(_0x1fe564){logger['error'](_0x1fe564[_0x4593('0x36')]);if(_0x1fe564[_0x4593('0x37')]){delete _0x1fe564[_0x4593('0x37')];}_0x23bbac[_0x4593('0x27')](_0x409ca5)['send'](_0x1fe564);};}exports[_0x4593('0x38')]=function(_0x1c9bfa,_0x1015b4){var _0x40aa1e={'include':[{'model':db[_0x4593('0x39')],'as':_0x4593('0x3a')}]},_0x48ace0={},_0x18abf3={'count':0x0,'rows':[]};var _0x258e70=_['map'](db['WhatsappAccount']['rawAttributes'],function(_0x4daa44){return{'name':_0x4daa44[_0x4593('0x3b')],'type':_0x4daa44[_0x4593('0x3c')][_0x4593('0x3d')]};});_0x48ace0[_0x4593('0x3e')]=_[_0x4593('0x3f')](_0x258e70,_0x4593('0x37'));_0x48ace0['query']=_[_0x4593('0x40')](_0x1c9bfa[_0x4593('0x41')]);_0x48ace0['filters']=_[_0x4593('0x42')](_0x48ace0[_0x4593('0x3e')],_0x48ace0['query']);_0x40aa1e['attributes']=_['intersection'](_0x48ace0['model'],qs[_0x4593('0x43')](_0x1c9bfa[_0x4593('0x41')][_0x4593('0x43')]));_0x40aa1e[_0x4593('0x44')]=_0x40aa1e[_0x4593('0x44')][_0x4593('0x45')]?_0x40aa1e['attributes']:_0x48ace0['model'];if(!_0x1c9bfa['query'][_0x4593('0x46')](_0x4593('0x47'))){_0x40aa1e['limit']=qs[_0x4593('0x2a')](_0x1c9bfa['query'][_0x4593('0x2a')]);_0x40aa1e[_0x4593('0x2b')]=qs[_0x4593('0x2b')](_0x1c9bfa[_0x4593('0x41')]['offset']);}_0x40aa1e[_0x4593('0x48')]=qs[_0x4593('0x49')](_0x1c9bfa['query'][_0x4593('0x49')]);_0x40aa1e[_0x4593('0x4a')]=qs[_0x4593('0x4b')](_[_0x4593('0x4c')](_0x1c9bfa[_0x4593('0x41')],_0x48ace0[_0x4593('0x4b')]),_0x258e70);if(_0x1c9bfa['query'][_0x4593('0x4d')]){_0x40aa1e[_0x4593('0x4a')]=_['merge'](_0x40aa1e[_0x4593('0x4a')],{'$or':_[_0x4593('0x3f')](_0x258e70,function(_0x3284dc){if(_0x3284dc[_0x4593('0x3c')]!=='VIRTUAL'){var _0x5a4672={};_0x5a4672[_0x3284dc[_0x4593('0x37')]]={'$like':'%'+_0x1c9bfa[_0x4593('0x41')][_0x4593('0x4d')]+'%'};return _0x5a4672;}})});}_0x40aa1e=_['merge']({},_0x40aa1e,_0x1c9bfa[_0x4593('0x4e')]);var _0xc0b91a={'where':_0x40aa1e[_0x4593('0x4a')]};return db['WhatsappAccount']['count'](_0xc0b91a)[_0x4593('0x1e')](function(_0x260c54){_0x18abf3[_0x4593('0x2c')]=_0x260c54;if(_0x1c9bfa[_0x4593('0x41')][_0x4593('0x4f')]){_0x40aa1e[_0x4593('0x50')]=[{'all':!![]}];}return db['WhatsappAccount'][_0x4593('0x51')](_0x40aa1e);})[_0x4593('0x1e')](function(_0x3974d9){_0x18abf3[_0x4593('0x52')]=_0x3974d9;return _0x18abf3;})[_0x4593('0x1e')](respondWithFilteredResult(_0x1015b4,_0x40aa1e))[_0x4593('0x53')](handleError(_0x1015b4,null));};exports[_0x4593('0x54')]=function(_0xdd3023,_0x4a0c46){var _0x5b616b={'raw':![],'where':{'id':_0xdd3023[_0x4593('0x55')]['id']},'include':[{'model':db[_0x4593('0x39')],'as':'mandatoryDispositionPause'}]},_0x450be0={};_0x450be0['model']=_['keys'](db['WhatsappAccount'][_0x4593('0x56')]);_0x450be0[_0x4593('0x41')]=_[_0x4593('0x40')](_0xdd3023[_0x4593('0x41')]);_0x450be0[_0x4593('0x4b')]=_[_0x4593('0x42')](_0x450be0[_0x4593('0x3e')],_0x450be0[_0x4593('0x41')]);_0x5b616b[_0x4593('0x44')]=_[_0x4593('0x42')](_0x450be0['model'],qs[_0x4593('0x43')](_0xdd3023[_0x4593('0x41')]['fields']));_0x5b616b['attributes']=_0x5b616b[_0x4593('0x44')][_0x4593('0x45')]?_0x5b616b[_0x4593('0x44')]:_0x450be0[_0x4593('0x3e')];if(_0xdd3023[_0x4593('0x41')][_0x4593('0x4f')]){_0x5b616b['include']=[{'all':!![]}];}_0x5b616b=_[_0x4593('0x57')]({},_0x5b616b,_0xdd3023[_0x4593('0x4e')]);return db['WhatsappAccount'][_0x4593('0x58')](_0x5b616b)[_0x4593('0x1e')](handleEntityNotFound(_0x4a0c46,null))[_0x4593('0x1e')](respondWithResult(_0x4a0c46,null))[_0x4593('0x53')](handleError(_0x4a0c46,null));};exports['create']=function(_0x1aebd6,_0x1cab5a){return db[_0x4593('0x59')][_0x4593('0x5a')](_0x1aebd6['body'],{})['then'](function(_0x2fef9f){var _0x23d770=_0x1aebd6[_0x4593('0x5b')][_0x4593('0x32')]({'plain':!![]});if(!_0x23d770)throw new Error(_0x4593('0x5c'));if(_0x23d770[_0x4593('0x5d')]===_0x4593('0x5b')){var _0x5ee311=_0x2fef9f['get']({'plain':!![]});var _0x326448='WhatsappAccounts';return db[_0x4593('0x5e')][_0x4593('0x58')]({'where':{'name':_0x326448,'userProfileId':_0x23d770[_0x4593('0x5f')]},'raw':!![]})[_0x4593('0x1e')](function(_0x20258e){if(_0x20258e&&_0x20258e[_0x4593('0x60')]===0x0){return db[_0x4593('0x34')][_0x4593('0x5a')]({'name':_0x5ee311['name'],'resourceId':_0x5ee311['id'],'type':_0x20258e[_0x4593('0x37')],'sectionId':_0x20258e['id']},{})[_0x4593('0x1e')](function(){return _0x2fef9f;});}else{return _0x2fef9f;}})[_0x4593('0x53')](function(_0x31d6a6){logger[_0x4593('0x22')](_0x4593('0x61'),_0x31d6a6);throw _0x31d6a6;});}return _0x2fef9f;})[_0x4593('0x1e')](respondWithResult(_0x1cab5a,0xc9))[_0x4593('0x53')](handleError(_0x1cab5a,null));};exports['update']=function(_0x502a5f,_0xe438d1){if(_0x502a5f[_0x4593('0x62')]['id']){delete _0x502a5f[_0x4593('0x62')]['id'];}return db[_0x4593('0x59')][_0x4593('0x58')]({'where':{'id':_0x502a5f[_0x4593('0x55')]['id']},'include':[{'model':db[_0x4593('0x39')],'as':_0x4593('0x3a')}]})[_0x4593('0x1e')](handleEntityNotFound(_0xe438d1,null))['then'](saveUpdates(_0x502a5f[_0x4593('0x62')],null))['then'](respondWithResult(_0xe438d1,null))[_0x4593('0x53')](handleError(_0xe438d1,null));};exports['destroy']=function(_0x7155af,_0x118c87){return db[_0x4593('0x59')][_0x4593('0x58')]({'where':{'id':_0x7155af[_0x4593('0x55')]['id']}})[_0x4593('0x1e')](handleEntityNotFound(_0x118c87,null))['then'](removeEntity(_0x118c87,null))[_0x4593('0x53')](handleError(_0x118c87,null));};exports['describe']=function(_0xd3bf0f,_0x56cbcc){return db[_0x4593('0x59')]['describe']()[_0x4593('0x1e')](respondWithResult(_0x56cbcc,null))[_0x4593('0x53')](handleError(_0x56cbcc,null));};exports['addDisposition']=function(_0x4bff88,_0x2392ef,_0x41a685){if(_0x4bff88[_0x4593('0x62')]['id']){delete _0x4bff88[_0x4593('0x62')]['id'];}return db['WhatsappAccount']['find']({'where':{'id':_0x4bff88[_0x4593('0x55')]['id']}})[_0x4593('0x1e')](handleEntityNotFound(_0x2392ef,null))[_0x4593('0x1e')](function(_0x45a8eb){if(_0x45a8eb){_0x4bff88[_0x4593('0x62')][_0x4593('0x63')]=_0x45a8eb['id'];return db[_0x4593('0x64')][_0x4593('0x5a')](_0x4bff88[_0x4593('0x62')]);}})[_0x4593('0x1e')](respondWithResult(_0x2392ef,null))['catch'](handleError(_0x2392ef,null));};exports['getDispositions']=function(_0x4a109e,_0x36bc7a,_0x172a94){var _0x509880={'raw':![],'where':{}};var _0x46e8fa={};var _0x15e107={'count':0x0,'rows':[]};return db[_0x4593('0x59')]['findOne']({'where':{'id':_0x4a109e[_0x4593('0x55')]['id']}})[_0x4593('0x1e')](handleEntityNotFound(_0x36bc7a,null))[_0x4593('0x1e')](function(_0x35ff5a){if(_0x35ff5a){_0x46e8fa[_0x4593('0x3e')]=_['keys'](db[_0x4593('0x64')][_0x4593('0x56')]);_0x46e8fa[_0x4593('0x41')]=_[_0x4593('0x40')](_0x4a109e[_0x4593('0x41')]);_0x46e8fa['filters']=_[_0x4593('0x42')](_0x46e8fa['model'],_0x46e8fa[_0x4593('0x41')]);_0x509880[_0x4593('0x44')]=_[_0x4593('0x42')](_0x46e8fa[_0x4593('0x3e')],qs[_0x4593('0x43')](_0x4a109e['query'][_0x4593('0x43')]));_0x509880['attributes']=_0x509880[_0x4593('0x44')][_0x4593('0x45')]?_0x509880[_0x4593('0x44')]:_0x46e8fa[_0x4593('0x3e')];if(!_0x4a109e['query']['hasOwnProperty'](_0x4593('0x47'))){_0x509880[_0x4593('0x2a')]=qs['limit'](_0x4a109e[_0x4593('0x41')][_0x4593('0x2a')]);_0x509880[_0x4593('0x2b')]=qs[_0x4593('0x2b')](_0x4a109e[_0x4593('0x41')][_0x4593('0x2b')]);}_0x509880[_0x4593('0x48')]=qs['sort'](_0x4a109e['query'][_0x4593('0x49')]);_0x509880[_0x4593('0x4a')]=qs[_0x4593('0x4b')](_[_0x4593('0x4c')](_0x4a109e[_0x4593('0x41')],_0x46e8fa[_0x4593('0x4b')]));_0x509880[_0x4593('0x4a')][_0x4593('0x63')]=_0x35ff5a['id'];if(_0x4a109e[_0x4593('0x41')][_0x4593('0x4d')]){_0x509880[_0x4593('0x4a')]=_[_0x4593('0x57')](_0x509880['where'],{'$or':_['map'](_0x509880[_0x4593('0x44')],function(_0x54db75){var _0xac7dae={};_0xac7dae[_0x54db75]={'$like':'%'+_0x4a109e[_0x4593('0x41')][_0x4593('0x4d')]+'%'};return _0xac7dae;})});}_0x509880=_[_0x4593('0x57')]({},_0x509880,_0x4a109e['options']);return db['Disposition']['count']({'where':_0x509880['where']})[_0x4593('0x1e')](function(_0x20f2ec){_0x15e107['count']=_0x20f2ec;if(_0x4a109e[_0x4593('0x41')][_0x4593('0x4f')]){_0x509880[_0x4593('0x50')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x509880);})[_0x4593('0x1e')](function(_0x2e9233){_0x15e107[_0x4593('0x52')]=_0x2e9233;return _0x15e107;});}})[_0x4593('0x1e')](respondWithFilteredResult(_0x36bc7a,_0x509880))['catch'](handleError(_0x36bc7a,null));};exports[_0x4593('0x65')]=function(_0x411f5e,_0x2ce372,_0x2c5b23){return db['WhatsappAccount']['find']({'where':{'id':_0x411f5e[_0x4593('0x55')]['id']}})[_0x4593('0x1e')](handleEntityNotFound(_0x2ce372,null))['then'](function(_0x515c7c){if(_0x515c7c){return _0x515c7c[_0x4593('0x65')](_0x411f5e['query'][_0x4593('0x66')]);}})[_0x4593('0x1e')](respondWithStatusCode(_0x2ce372,null))[_0x4593('0x53')](handleError(_0x2ce372,null));};exports['addAnswer']=function(_0x44d6fa,_0x5976a7,_0x2fb308){if(_0x44d6fa[_0x4593('0x62')]['id']){delete _0x44d6fa[_0x4593('0x62')]['id'];}return db[_0x4593('0x59')][_0x4593('0x58')]({'where':{'id':_0x44d6fa[_0x4593('0x55')]['id']}})[_0x4593('0x1e')](handleEntityNotFound(_0x5976a7,null))[_0x4593('0x1e')](function(_0x5c2034){if(_0x5c2034){_0x44d6fa[_0x4593('0x62')][_0x4593('0x63')]=_0x5c2034['id'];return db[_0x4593('0x67')][_0x4593('0x5a')](_0x44d6fa['body']);}})['then'](respondWithResult(_0x5976a7,null))[_0x4593('0x53')](handleError(_0x5976a7,null));};exports[_0x4593('0x68')]=function(_0x4d17c0,_0x33c8e1,_0x1779d2){var _0x47b3b9={'raw':![],'where':{}};var _0x462351={};var _0x13bdec={'count':0x0,'rows':[]};return db[_0x4593('0x59')]['findOne']({'where':{'id':_0x4d17c0['params']['id']}})[_0x4593('0x1e')](handleEntityNotFound(_0x33c8e1,null))[_0x4593('0x1e')](function(_0x2b462c){if(_0x2b462c){_0x462351[_0x4593('0x3e')]=_[_0x4593('0x40')](db[_0x4593('0x67')]['rawAttributes']);_0x462351[_0x4593('0x41')]=_[_0x4593('0x40')](_0x4d17c0[_0x4593('0x41')]);_0x462351[_0x4593('0x4b')]=_['intersection'](_0x462351[_0x4593('0x3e')],_0x462351[_0x4593('0x41')]);_0x47b3b9['attributes']=_['intersection'](_0x462351[_0x4593('0x3e')],qs[_0x4593('0x43')](_0x4d17c0[_0x4593('0x41')][_0x4593('0x43')]));_0x47b3b9[_0x4593('0x44')]=_0x47b3b9[_0x4593('0x44')][_0x4593('0x45')]?_0x47b3b9[_0x4593('0x44')]:_0x462351[_0x4593('0x3e')];if(!_0x4d17c0[_0x4593('0x41')][_0x4593('0x46')]('nolimit')){_0x47b3b9[_0x4593('0x2a')]=qs['limit'](_0x4d17c0['query']['limit']);_0x47b3b9[_0x4593('0x2b')]=qs[_0x4593('0x2b')](_0x4d17c0[_0x4593('0x41')][_0x4593('0x2b')]);}_0x47b3b9[_0x4593('0x48')]=qs[_0x4593('0x49')](_0x4d17c0[_0x4593('0x41')][_0x4593('0x49')]);_0x47b3b9[_0x4593('0x4a')]=qs[_0x4593('0x4b')](_[_0x4593('0x4c')](_0x4d17c0[_0x4593('0x41')],_0x462351[_0x4593('0x4b')]));_0x47b3b9[_0x4593('0x4a')][_0x4593('0x63')]=_0x2b462c['id'];if(_0x4d17c0[_0x4593('0x41')][_0x4593('0x4d')]){_0x47b3b9[_0x4593('0x4a')]=_[_0x4593('0x57')](_0x47b3b9[_0x4593('0x4a')],{'$or':_[_0x4593('0x3f')](_0x47b3b9[_0x4593('0x44')],function(_0x51a101){var _0x505117={};_0x505117[_0x51a101]={'$like':'%'+_0x4d17c0[_0x4593('0x41')][_0x4593('0x4d')]+'%'};return _0x505117;})});}_0x47b3b9=_[_0x4593('0x57')]({},_0x47b3b9,_0x4d17c0[_0x4593('0x4e')]);return db[_0x4593('0x67')][_0x4593('0x2c')]({'where':_0x47b3b9[_0x4593('0x4a')]})[_0x4593('0x1e')](function(_0x318aa9){_0x13bdec['count']=_0x318aa9;if(_0x4d17c0[_0x4593('0x41')][_0x4593('0x4f')]){_0x47b3b9['include']=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x47b3b9);})[_0x4593('0x1e')](function(_0x266224){_0x13bdec['rows']=_0x266224;return _0x13bdec;});}})[_0x4593('0x1e')](respondWithFilteredResult(_0x33c8e1,_0x47b3b9))[_0x4593('0x53')](handleError(_0x33c8e1,null));};exports[_0x4593('0x69')]=function(_0x1d49e7,_0x4e8b13,_0x1d6f89){return db['WhatsappAccount']['find']({'where':{'id':_0x1d49e7[_0x4593('0x55')]['id']}})[_0x4593('0x1e')](handleEntityNotFound(_0x4e8b13,null))['then'](function(_0x23c173){if(_0x23c173){return _0x23c173[_0x4593('0x69')](_0x1d49e7[_0x4593('0x41')][_0x4593('0x66')]);}})['then'](respondWithStatusCode(_0x4e8b13,null))['catch'](handleError(_0x4e8b13,null));};exports[_0x4593('0x6a')]=function(_0x5665a2,_0x4c9e45,_0x450a4e){return db[_0x4593('0x59')]['find']({'where':{'id':_0x5665a2[_0x4593('0x55')]['id']}})[_0x4593('0x1e')](handleEntityNotFound(_0x4c9e45,null))[_0x4593('0x1e')](function(_0x25ba97){if(_0x25ba97){return _0x25ba97[_0x4593('0x6a')](_0x5665a2[_0x4593('0x62')][_0x4593('0x66')],_['omit'](_0x5665a2[_0x4593('0x62')],[_0x4593('0x66'),'id'])||{})[_0x4593('0x6b')](function(_0x1bd7dd){for(var _0x31a0c9=0x0;_0x31a0c9<_0x5665a2[_0x4593('0x62')]['ids'][_0x4593('0x45')];_0x31a0c9+=0x1){socket['emit'](_0x4593('0x6c'),{'UserId':Number(_0x5665a2['body'][_0x4593('0x66')][_0x31a0c9]),'WhatsappAccountId':Number(_0x5665a2[_0x4593('0x55')]['id'])});}return _0x1bd7dd;});}})[_0x4593('0x1e')](respondWithResult(_0x4c9e45,null))[_0x4593('0x53')](handleError(_0x4c9e45,null));};exports[_0x4593('0x6d')]=function(_0x16297f,_0x1ce519,_0x25719d){return db[_0x4593('0x59')][_0x4593('0x58')]({'where':{'id':_0x16297f['params']['id']}})[_0x4593('0x1e')](handleEntityNotFound(_0x1ce519,null))[_0x4593('0x1e')](function(_0x271d24){if(_0x271d24){return _0x271d24[_0x4593('0x6d')](_0x16297f['query'][_0x4593('0x66')])[_0x4593('0x1e')](function(){if(_[_0x4593('0x6e')](_0x16297f['query'][_0x4593('0x66')])){for(var _0x36990d=0x0;_0x36990d<_0x16297f[_0x4593('0x41')][_0x4593('0x66')]['length'];_0x36990d+=0x1){socket[_0x4593('0x6f')]('userWhatsappAccount:remove',{'UserId':Number(_0x16297f['query']['ids'][_0x36990d]),'WhatsappAccountId':Number(_0x16297f[_0x4593('0x55')]['id'])});}}else{socket[_0x4593('0x6f')]('userWhatsappAccount:remove',{'UserId':Number(_0x16297f[_0x4593('0x41')][_0x4593('0x66')]),'WhatsappAccountId':Number(_0x16297f[_0x4593('0x55')]['id'])});}});}})[_0x4593('0x1e')](respondWithStatusCode(_0x1ce519,null))[_0x4593('0x53')](handleError(_0x1ce519,null));};exports['getAgents']=function(_0x2681bf,_0x545867,_0xfde5c0){var _0x59e598={};var _0x19cbce={};var _0x51fd2f;var _0x43c944;return db[_0x4593('0x59')][_0x4593('0x70')]({'where':{'id':_0x2681bf[_0x4593('0x55')]['id']}})['then'](handleEntityNotFound(_0x545867,null))[_0x4593('0x1e')](function(_0x33499f){if(_0x33499f){_0x51fd2f=_0x33499f;_0x19cbce[_0x4593('0x3e')]=_['keys'](db[_0x4593('0x71')]['rawAttributes']);_0x19cbce[_0x4593('0x41')]=_[_0x4593('0x40')](_0x2681bf[_0x4593('0x41')]);_0x19cbce['filters']=_[_0x4593('0x42')](_0x19cbce[_0x4593('0x3e')],_0x19cbce[_0x4593('0x41')]);_0x59e598[_0x4593('0x44')]=_[_0x4593('0x42')](_0x19cbce['model'],qs[_0x4593('0x43')](_0x2681bf[_0x4593('0x41')][_0x4593('0x43')]));_0x59e598[_0x4593('0x44')]=_0x59e598[_0x4593('0x44')]['length']?_0x59e598[_0x4593('0x44')]:_0x19cbce[_0x4593('0x3e')];_0x59e598['order']=qs['sort'](_0x2681bf[_0x4593('0x41')]['sort']);_0x59e598['where']=qs[_0x4593('0x4b')](_[_0x4593('0x4c')](_0x2681bf[_0x4593('0x41')],_0x19cbce['filters']));if(_0x2681bf[_0x4593('0x41')][_0x4593('0x4d')]){_0x59e598[_0x4593('0x4a')]=_[_0x4593('0x57')](_0x59e598['where'],{'$or':_[_0x4593('0x3f')](_0x59e598[_0x4593('0x44')],function(_0x11388a){var _0x1a509d={};_0x1a509d[_0x11388a]={'$like':'%'+_0x2681bf['query'][_0x4593('0x4d')]+'%'};return _0x1a509d;})});}_0x59e598=_['merge']({},_0x59e598,_0x2681bf[_0x4593('0x4e')]);return _0x51fd2f[_0x4593('0x72')](_0x59e598);}})[_0x4593('0x1e')](function(_0x47bc40){if(_0x47bc40){_0x43c944=_0x47bc40[_0x4593('0x45')];if(!_0x2681bf[_0x4593('0x41')][_0x4593('0x46')](_0x4593('0x47'))){_0x59e598[_0x4593('0x2a')]=qs['limit'](_0x2681bf['query'][_0x4593('0x2a')]);_0x59e598[_0x4593('0x2b')]=qs['offset'](_0x2681bf[_0x4593('0x41')][_0x4593('0x2b')]);}return _0x51fd2f['getAgents'](_0x59e598);}})[_0x4593('0x1e')](function(_0x4b91a7){if(_0x4b91a7){return _0x4b91a7?{'count':_0x43c944,'rows':_0x4b91a7}:null;}})[_0x4593('0x1e')](respondWithResult(_0x545867,null))[_0x4593('0x53')](handleError(_0x545867,null));};exports[_0x4593('0x73')]=function(_0x28f8b1,_0xcad172){var _0x4f158f=_0x28f8b1['params']['id'];var _0x1416d4=_0x28f8b1[_0x4593('0x62')];var _0x2b83f9=0xc8;var _0x517fd3=null;return db[_0x4593('0x74')][_0x4593('0x75')]({'isolationLevel':db['sequelize'][_0x4593('0x76')][_0x4593('0x77')][_0x4593('0x78')]},function(_0x3af7fc){return db['WhatsappAccount'][_0x4593('0x70')]({'where':{'id':_0x4f158f},'transaction':_0x3af7fc})[_0x4593('0x1e')](function(_0x342a97){if(_0x342a97){return db[_0x4593('0x79')][_0x4593('0x31')]({'where':{'WhatsappAccountId':_0x4f158f},'transaction':_0x3af7fc})['then'](function(){var _0xb0a3a9=_[_0x4593('0x3f')](_0x1416d4,function(_0x5aa1ac){_0x5aa1ac[_0x4593('0x63')]=_0x4f158f;return _0x5aa1ac;});return db[_0x4593('0x79')][_0x4593('0x7a')](_0xb0a3a9,{'transaction':_0x3af7fc});});}else{_0x2b83f9=0x194;_0x517fd3=[];}});})[_0x4593('0x1e')](function(){if(_0x2b83f9!==0x194){return db[_0x4593('0x79')][_0x4593('0x7b')]({'where':{'WhatsappAccountId':_0x4f158f},'order':_0x4593('0x7c')})[_0x4593('0x1e')](function(_0x4b296c){_0x517fd3=_0x4b296c;});}})[_0x4593('0x53')](function(_0xf12eb9){_0x2b83f9=0x1f4;logger['error'](_0xf12eb9[_0x4593('0x36')]);if(_0xf12eb9[_0x4593('0x37')]){delete _0xf12eb9[_0x4593('0x37')];}_0x517fd3=_0xf12eb9;})[_0x4593('0x7d')](function(){if(_0x517fd3===null){_0xcad172[_0x4593('0x26')](_0x2b83f9);}else{if(_0x2b83f9===0x1f4){_0xcad172[_0x4593('0x27')](_0x2b83f9)['send'](_0x517fd3);}else{_0xcad172['status'](_0x2b83f9)['json'](_0x517fd3);}}});};exports[_0x4593('0x7e')]=function(_0xdcf281,_0x12f09d,_0x24df9b){var _0x50947a={};var _0x38cb1b={};var _0x2c3c90;var _0x154ecf;return db[_0x4593('0x59')][_0x4593('0x70')]({'where':{'id':_0xdcf281[_0x4593('0x55')]['id']}})[_0x4593('0x1e')](handleEntityNotFound(_0x12f09d,null))[_0x4593('0x1e')](function(_0x129612){if(_0x129612){_0x2c3c90=_0x129612;_0x38cb1b['model']=_[_0x4593('0x40')](db[_0x4593('0x79')]['rawAttributes']);_0x38cb1b[_0x4593('0x41')]=_[_0x4593('0x40')](_0xdcf281['query']);_0x38cb1b[_0x4593('0x4b')]=_[_0x4593('0x42')](_0x38cb1b['model'],_0x38cb1b['query']);_0x50947a[_0x4593('0x44')]=_[_0x4593('0x42')](_0x38cb1b[_0x4593('0x3e')],qs[_0x4593('0x43')](_0xdcf281[_0x4593('0x41')]['fields']));_0x50947a['attributes']=_0x50947a[_0x4593('0x44')][_0x4593('0x45')]?_0x50947a[_0x4593('0x44')]:_0x38cb1b[_0x4593('0x3e')];_0x50947a[_0x4593('0x48')]=qs[_0x4593('0x49')](_0xdcf281[_0x4593('0x41')][_0x4593('0x49')]);_0x50947a['where']=qs[_0x4593('0x4b')](_[_0x4593('0x4c')](_0xdcf281[_0x4593('0x41')],_0x38cb1b[_0x4593('0x4b')]));if(_0xdcf281['query'][_0x4593('0x4d')]){_0x50947a[_0x4593('0x4a')]=_[_0x4593('0x57')](_0x50947a['where'],{'$or':_[_0x4593('0x3f')](_0x50947a[_0x4593('0x44')],function(_0x2dd6ff){var _0xaf495c={};_0xaf495c[_0x2dd6ff]={'$like':'%'+_0xdcf281[_0x4593('0x41')]['filter']+'%'};return _0xaf495c;})});}_0x50947a=_[_0x4593('0x57')]({},_0x50947a,_0xdcf281[_0x4593('0x4e')]);return _0x2c3c90[_0x4593('0x7e')](_0x50947a);}})[_0x4593('0x1e')](function(_0x447036){if(_0x447036){_0x154ecf=_0x447036[_0x4593('0x45')];if(!_0xdcf281[_0x4593('0x41')][_0x4593('0x46')]('nolimit')){_0x50947a[_0x4593('0x2a')]=qs[_0x4593('0x2a')](_0xdcf281[_0x4593('0x41')][_0x4593('0x2a')]);_0x50947a['offset']=qs['offset'](_0xdcf281[_0x4593('0x41')][_0x4593('0x2b')]);}return _0x2c3c90[_0x4593('0x7e')](_0x50947a);}})[_0x4593('0x1e')](function(_0x4ce758){if(_0x4ce758){return _0x4ce758?{'count':_0x154ecf,'rows':_0x4ce758}:null;}})[_0x4593('0x1e')](respondWithResult(_0x12f09d,null))[_0x4593('0x53')](handleError(_0x12f09d,null));};exports[_0x4593('0x7f')]=function(_0x2db598,_0x9775f9,_0x423c10){var _0x2422fb={'channel':_0x4593('0x80')};var _0x2cd2b4=[];var _0x4935d8=[];var _0x5e6585={};return db[_0x4593('0x59')][_0x4593('0x58')]({'where':{'id':_0x2db598[_0x4593('0x55')]['id']},'include':[{'model':db[_0x4593('0x79')],'as':_0x4593('0x81')}]})[_0x4593('0x1e')](handleEntityNotFound(_0x9775f9,null))['then'](function(_0x2f8b32){_0x2422fb[_0x4593('0x82')]=_0x2f8b32;if(_0x2422fb['account']&&_0x2422fb['account'][_0x4593('0x3c')]===_0x4593('0x83')&&_0x2db598[_0x4593('0x62')][_0x4593('0x84')]){if(_0x2db598[_0x4593('0x62')]['statuses'][_0x4593('0x45')]===0x0)return;if(_0x2db598['body'][_0x4593('0x84')][0x0][_0x4593('0x85')]!==_0x4593('0x86'))return;return db[_0x4593('0x87')][_0x4593('0x88')]({'read':!![],'readAt':_0x2db598[_0x4593('0x62')][_0x4593('0x84')][0x0][_0x4593('0x89')]},{'where':{'messageId':_0x2db598[_0x4593('0x62')][_0x4593('0x84')][0x0][_0x4593('0x8a')]},'individualHooks':!![]})['then'](function(_0x3bb228){return _0x9775f9[_0x4593('0x27')](0xc8)[_0x4593('0x28')](_0x3bb228);});}_0x2422fb['applications']=_[_0x4593('0x8b')](_0x2f8b32[_0x4593('0x81')],[_0x4593('0x7c')],[_0x4593('0x8c')]);if(_0x2422fb[_0x4593('0x82')]['Applications']){delete _0x2422fb[_0x4593('0x82')][_0x4593('0x81')];}return db[_0x4593('0x8d')][_0x4593('0x8e')]()[_0x4593('0x1e')](function(_0x1ccdb5){if(!_0x1ccdb5){throw new db[(_0x4593('0x8f'))]['ValidationError']('no\x20available\x20attributes');}_0x2cd2b4=_[_0x4593('0x90')](_[_0x4593('0x40')](_0x1ccdb5),[_0x4593('0x91'),_0x4593('0x92')]);_0x4935d8=_['difference'](_[_0x4593('0x40')](_0x1ccdb5),['createdAt',_0x4593('0x92'),_0x4593('0x93'),_0x4593('0x94')]);_0x2422fb['body']={'mapKey':'mobile'};if(_0x2422fb['account']&&_0x2422fb['account'][_0x4593('0x3c')]===_0x4593('0x95')){_0x2422fb[_0x4593('0x62')]['from']=_0x2db598[_0x4593('0x62')][_0x4593('0x96')][_0x4593('0x97')](_0x4593('0x98'),'');_0x2422fb[_0x4593('0x62')]['body']=_0x2db598['body'][_0x4593('0x99')];_0x2422fb[_0x4593('0x62')][_0x4593('0x9a')]=_0x2db598[_0x4593('0x62')][_0x4593('0x9b')];}if(_0x2422fb[_0x4593('0x82')]&&_0x2422fb[_0x4593('0x82')][_0x4593('0x3c')]==='sinch'){_0x2422fb[_0x4593('0x62')][_0x4593('0x9c')]=_0x2db598[_0x4593('0x62')][_0x4593('0x9d')][0x0]['from'];_0x2422fb['body'][_0x4593('0x62')]=_0x2db598[_0x4593('0x62')][_0x4593('0x9d')][0x0][_0x4593('0x24')][_0x4593('0x62')];_0x2422fb['body'][_0x4593('0x9a')]=_0x2db598[_0x4593('0x62')]['notifications'][0x0][_0x4593('0x8a')];}if(_0x2422fb[_0x4593('0x62')]['id']){delete _0x2422fb[_0x4593('0x62')]['id'];}if(_[_0x4593('0x9e')](_0x2422fb[_0x4593('0x62')][_0x4593('0x9c')])){throw new db[(_0x4593('0x8f'))][(_0x4593('0x9f'))](_0x4593('0xa0'));}if(_[_0x4593('0x9e')](_0x2422fb[_0x4593('0x62')][_0x4593('0x62')])||_0x2422fb[_0x4593('0x62')][_0x4593('0x62')]===''){throw new db[(_0x4593('0x8f'))][(_0x4593('0x9f'))](_0x4593('0xa1'));}if(_[_0x4593('0x9e')](_0x2422fb[_0x4593('0x62')]['mapKey'])){throw new db[(_0x4593('0x8f'))][(_0x4593('0x9f'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4935d8);}if(!_[_0x4593('0xa2')](_0x4935d8,_0x2422fb['body']['mapKey'])){throw new db['Sequelize'][(_0x4593('0x9f'))](_0x4593('0xa3')+_0x4935d8);}_0x5e6585[_0x2422fb[_0x4593('0x62')]['mapKey']]=_0x2422fb[_0x4593('0x62')][_0x4593('0x9c')];return db[_0x4593('0xa4')][_0x4593('0x58')]({'where':{'id':_0x2422fb[_0x4593('0x82')][_0x4593('0x94')]},'include':[{'model':db[_0x4593('0x8d')],'as':'Contacts','where':_0x5e6585,'limit':0x1,'order':[['updatedAt','DESC']]}]});})['then'](handleEntityNotFound(_0x9775f9,null))['then'](function(_0x174005){if(_0x174005){_0x2422fb[_0x4593('0xa5')]=_[_0x4593('0xa6')](_0x174005,[_0x4593('0xa7')]);if(_0x174005[_0x4593('0xa7')][_0x4593('0x45')]){return _0x174005['Contacts'][0x0];}var _0xf943c0=_[_0x4593('0x17')](_0x2422fb[_0x4593('0x62')],{'firstName':_0x2422fb[_0x4593('0x62')][_0x4593('0x9c')],'ListId':_0x174005['id']});_0xf943c0[_0x2422fb['body'][_0x4593('0xa8')]]=_0x2422fb[_0x4593('0x62')][_0x4593('0x9c')];return db['CmContact'][_0x4593('0x5a')](_0xf943c0,{'fields':_0x2cd2b4,'raw':!![]});}})['then'](handleEntityNotFound(_0x9775f9,null))[_0x4593('0x1e')](function(_0x154f13){if(_0x154f13){_0x2422fb[_0x4593('0xa9')]=_0x154f13;var _0xdb85ae={'ContactId':_0x154f13['id'],'phone':_0x2422fb[_0x4593('0x62')][_0x4593('0x9c')],'WhatsappAccountId':_0x2db598[_0x4593('0x55')]['id']};var _0x572010={'ContactId':_0x154f13['id'],'WhatsappAccountId':_0x2db598[_0x4593('0x55')]['id'],'closed':![]};return db[_0x4593('0xaa')][_0x4593('0x58')]({'where':_0x572010})[_0x4593('0x1e')](function(_0x4208e4){if(_0x4208e4){return[_0x4208e4,![]];}return db[_0x4593('0xaa')][_0x4593('0x5a')](_0xdb85ae)['then'](function(_0x40b809){return[_0x40b809,!![]];});});}})['spread'](function(_0xd4c6af,_0x3af30c){_0x2422fb['interaction']=_0xd4c6af[_0x4593('0x32')]({'plain':!![]});_0x2422fb['interaction'][_0x4593('0xab')]=![];if(_0x3af30c){if(_0x2422fb[_0x4593('0x82')][_0x4593('0xac')]){_0x2422fb[_0x4593('0xad')]['push']({'id':0x0,'priority':_0x2422fb[_0x4593('0xad')]['length']+0x1,'app':'close','appdata':_0x4593('0xae'),'interval':_0x4593('0xaf')});}_0x2422fb[_0x4593('0xb0')]['created']=!![];}return db['WhatsappMessage']['create']({'phone':_0x2422fb[_0x4593('0x62')][_0x4593('0x9c')],'messageId':_0x2422fb[_0x4593('0x62')][_0x4593('0x9a')],'body':_0x2422fb[_0x4593('0x62')][_0x4593('0x62')],'WhatsappAccountId':_0x2db598['params']['id'],'WhatsappInteractionId':_0xd4c6af['id'],'direction':'in','ContactId':_0xd4c6af[_0x4593('0xb1')],'AttachmentId':_0x2422fb[_0x4593('0x62')][_0x4593('0xb2')]});})['then'](function(_0x3d4efb){_0x2422fb['message']=_0x3d4efb;if(!_0x2422fb[_0x4593('0xb0')]['UserId'])return;return db[_0x4593('0x71')][_0x4593('0x58')]({'attributes':['id',_0x4593('0x37')],'where':{'id':_0x2422fb['interaction'][_0x4593('0xb3')]}});})['then'](function(_0x564903){if(_0x564903){_0x2422fb[_0x4593('0xad')]['unshift']({'id':0x0,'priority':0x0,'app':_0x4593('0xb4'),'appdata':_0x564903['name']+','+(_0x2422fb['account'][_0x4593('0xb5')]||0xa),'interval':'*,*,*,*'});}if(!_0x2422fb[_0x4593('0xb0')]['queueId'])return;return db['WhatsappQueue'][_0x4593('0x58')]({'attributes':['id','name'],'where':{'id':_0x2422fb[_0x4593('0xb0')][_0x4593('0xb6')]}});})[_0x4593('0x1e')](function(_0x2e5726){if(_0x2e5726){_0x2422fb[_0x4593('0xad')][_0x4593('0xb7')]({'id':0x0,'priority':0x1,'app':_0x4593('0xb8'),'appdata':_0x2e5726[_0x4593('0x37')]+','+(_0x2422fb[_0x4593('0x82')][_0x4593('0xb9')]||0x12c),'interval':_0x4593('0xaf')});}return respondWithRpcPromise(_0x4593('0xba'),_0x4593('0xbb'),_0x2422fb);})['then'](function(_0x4199e0){if(_0x4199e0){var _0x4ab0ef=0xc8;var _0x26ef3a='receiveMessage';logger['info'](_0x4593('0x21'),_0x26ef3a,_0x4ab0ef,_0x4593('0xbc'));logger[_0x4593('0xbd')]('WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x26ef3a,_0x4ab0ef,_0x4593('0xbc'),JSON[_0x4593('0xbe')](_0x4199e0));if(_0x2422fb['account'][_0x4593('0x3c')]===_0x4593('0x95')){return _0x9775f9[_0x4593('0x27')](_0x4ab0ef)[_0x4593('0x2d')](_0x4593('0xbf'),_0x4593('0xc0'))['send'](_0x4593('0xc1'));}else{return _0x9775f9[_0x4593('0x27')](_0x4ab0ef)[_0x4593('0x28')](_0x4199e0);}}});})[_0x4593('0x53')](handleError(_0x9775f9,null));};exports[_0x4593('0xc2')]=function(_0x5978ec,_0x1ebea5,_0x5abd7c){var _0x1d2376,_0x26337d,_0x1da911;if(_['isNil'](_0x5978ec[_0x4593('0x62')]['body'])||_0x5978ec['body'][_0x4593('0x62')]===''){throw new db[(_0x4593('0x8f'))]['ValidationError'](_0x4593('0xa1'));}if(_[_0x4593('0x9e')](_0x5978ec[_0x4593('0x62')]['to'])){throw new db[(_0x4593('0x8f'))][(_0x4593('0x9f'))](_0x4593('0xc3'));}_0x1d2376=_0x5978ec['body']['to'];return db[_0x4593('0x59')][_0x4593('0x58')]({'where':{'id':_0x5978ec['params']['id']},'include':[{'model':db[_0x4593('0xa4')],'as':_0x4593('0xc4'),'include':[{'model':db[_0x4593('0x8d')],'as':'Contacts','where':{'mobile':_0x1d2376},'limit':0x1,'order':[['updatedAt',_0x4593('0xc5')]]}]}]})[_0x4593('0x1e')](handleEntityNotFound(_0x1ebea5,null))[_0x4593('0x1e')](function(_0x56ff24){if(_0x56ff24&&_0x56ff24[_0x4593('0xc4')]){_0x26337d=_0x56ff24[_0x4593('0x32')]({'plain':!![]});if(_0x26337d['List']&&_0x26337d[_0x4593('0xc4')][_0x4593('0xa7')][_0x4593('0x45')]){return _0x26337d[_0x4593('0xc4')][_0x4593('0xa7')][0x0];}return db['CmContact'][_0x4593('0x5a')](_[_0x4593('0x17')](_0x5978ec['body'],{'firstName':_0x1d2376,'mobile':_0x1d2376,'phone':_0x1d2376,'ListId':_0x26337d[_0x4593('0x94')]}));}})[_0x4593('0x1e')](handleEntityNotFound(_0x1ebea5,null))['then'](function(_0x1bf5b1){if(_0x1bf5b1){_0x1da911=_0x1bf5b1;return db['WhatsappInteraction'][_0x4593('0x58')]({'where':{'ContactId':_0x1da911['id'],'closed':![],'WhatsappAccountId':_0x26337d['id']}})[_0x4593('0x1e')](function(_0x53a8db){if(_0x53a8db){return[_0x53a8db,![]];}return db[_0x4593('0xaa')][_0x4593('0x5a')]({'UserId':_0x5978ec['user']['id'],'ContactId':_0x1da911['id'],'WhatsappAccountId':_0x26337d['id'],'phone':_0x1d2376,'firstMsgDirection':_0x4593('0xc6'),'Messages':[_[_0x4593('0x57')](_0x5978ec['body'],{'read':![],'body':_0x5978ec['body'][_0x4593('0x62')],'phone':_0x1d2376,'WhatsappAccountId':_0x26337d['id'],'UserId':_0x5978ec[_0x4593('0x5b')]['id'],'ContactId':_0x1da911['id']})]},{'include':[{'model':db['WhatsappMessage'],'as':'Messages'}]})[_0x4593('0x1e')](function(_0x49eea5){return[_0x49eea5,!![]];});});}})['spread'](function(_0x29fbb4,_0x5571e0){if(_0x5571e0){return _0x29fbb4;}return db[_0x4593('0x87')][_0x4593('0x5a')](_[_0x4593('0x57')](_0x5978ec[_0x4593('0x62')],{'read':![],'body':_0x5978ec[_0x4593('0x62')]['body'],'phone':_0x1d2376,'WhatsappAccountId':_0x26337d['id'],'WhatsappInteractionId':_0x29fbb4['id'],'UserId':_0x5978ec['user']['id'],'ContactId':_0x1da911['id']}))[_0x4593('0x1e')](function(_0x4e99bd){_0x29fbb4[_0x4593('0xc7')][_0x4593('0xc8')]=[];_0x29fbb4['dataValues'][_0x4593('0xc8')][_0x4593('0xc9')](_0x4e99bd[_0x4593('0xc7')]);return _0x29fbb4;});})['then'](respondWithResult(_0x1ebea5,null))[_0x4593('0x53')](handleError(_0x1ebea5,null));}; \ No newline at end of file +var _0xd527=['list','contact','WhatsappInteraction','interaction','push','*,*,*,*','created','ContactId','AttachmentId','UserId','applications','unshift','agent','queueId','WhatsappQueue','waitForTheAssignedQueue','Start','startRouting','info','entity\x20found','set','Content-Type','text/xml','\x0a','to\x20is\x20mandatory','CmList','List','out','Messages','spread','dataValues','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','defaults','redis','localhost','http','request','then','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappAccount,\x20%s,\x20%s','result','message','catch','sendStatus','status','end','json','undefined','limit','offset','count','Content-Range','save','destroy','get','WhatsappAccounts','index','Pause','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','nolimit','order','sort','pick','filter','where','merge','name','options','WhatsappAccount','includeAll','findAll','show','params','mandatoryDispositionPause','include','find','create','body','user','role','UserProfileSection','UserProfileResource','update','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','hasOwnProperty','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','rows','removeAnswers','addAgents','omit','userWhatsappAccount:save','removeAgents','emit','userWhatsappAccount:remove','getAgents','findOne','User','addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','findAndCountAll','priority','stack','send','getApplications','whatsapp','Applications','account','sinch','statuses','state','read','WhatsappMessage','message_id','asc','CmContact','Sequelize','ValidationError','updatedAt','difference','createdAt','ListId','mobile','twilio','From','replace','Body','messageId','MessageSid','from','notifications','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','Contacts','DESC'];(function(_0x3c2731,_0x1ddfb5){var _0x1a851b=function(_0x1e7bbc){while(--_0x1e7bbc){_0x3c2731['push'](_0x3c2731['shift']());}};_0x1a851b(++_0x1ddfb5);}(_0xd527,0x195));var _0x7d52=function(_0x359377,_0x1a63ef){_0x359377=_0x359377-0x0;var _0x8be18a=_0xd527[_0x359377];return _0x8be18a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7d52('0x0'));var zipdir=require(_0x7d52('0x1'));var jsonpatch=require(_0x7d52('0x2'));var rp=require(_0x7d52('0x3'));var moment=require(_0x7d52('0x4'));var BPromise=require(_0x7d52('0x5'));var Mustache=require(_0x7d52('0x6'));var util=require(_0x7d52('0x7'));var path=require(_0x7d52('0x8'));var sox=require(_0x7d52('0x9'));var csv=require(_0x7d52('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x7d52('0xb'));var jsforce=require(_0x7d52('0xc'));var deskjs=require(_0x7d52('0xd'));var toCsv=require(_0x7d52('0xa'));var querystring=require('querystring');var Papa=require(_0x7d52('0xe'));var Redis=require('ioredis');var authService=require(_0x7d52('0xf'));var qs=require(_0x7d52('0x10'));var as=require(_0x7d52('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7d52('0x12'))(_0x7d52('0x13'));var utils=require(_0x7d52('0x14'));var config=require(_0x7d52('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0x7d52('0x16')](config[_0x7d52('0x17')],{'host':_0x7d52('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./whatsappAccount.socket')['register'](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x7d52('0x19')]({'port':0x232c});function respondWithRpcPromise(_0x4730ba,_0x36a8fb,_0x242e0a,_0x38762f){return new BPromise(function(_0x4a8cb1,_0x44cf57){var _0x383368=_0x38762f||client;return _0x383368[_0x7d52('0x1a')](_0x4730ba,_0x242e0a)[_0x7d52('0x1b')](function(_0x3a244e){logger['info']('WhatsappAccount,\x20%s,\x20%s',_0x36a8fb,_0x7d52('0x1c'));logger[_0x7d52('0x1d')](_0x7d52('0x1e'),_0x36a8fb,_0x7d52('0x1c'),JSON[_0x7d52('0x1f')](_0x3a244e));if(_0x3a244e[_0x7d52('0x20')]){if(_0x3a244e[_0x7d52('0x20')][_0x7d52('0x21')]===0x1f4){logger[_0x7d52('0x20')](_0x7d52('0x22'),_0x36a8fb,_0x3a244e['error']['message']);return _0x44cf57(_0x3a244e[_0x7d52('0x20')]['message']);}logger[_0x7d52('0x20')](_0x7d52('0x22'),_0x36a8fb,_0x3a244e['error']['message']);return _0x4a8cb1(_0x3a244e[_0x7d52('0x20')]['message']);}else{logger['info'](_0x7d52('0x22'),_0x36a8fb,_0x7d52('0x1c'));_0x4a8cb1(_0x3a244e[_0x7d52('0x23')][_0x7d52('0x24')]);}})[_0x7d52('0x25')](function(_0x17f7c4){logger['error'](_0x7d52('0x22'),_0x36a8fb,_0x17f7c4);_0x44cf57(_0x17f7c4);});});}function respondWithStatusCode(_0x5063fe,_0x45847a){_0x45847a=_0x45847a||0xcc;return function(_0x546267){if(_0x546267){return _0x5063fe[_0x7d52('0x26')](_0x45847a);}return _0x5063fe[_0x7d52('0x27')](_0x45847a)[_0x7d52('0x28')]();};}function respondWithResult(_0x18d3d2,_0x379a55){_0x379a55=_0x379a55||0xc8;return function(_0x54881b){if(_0x54881b){return _0x18d3d2[_0x7d52('0x27')](_0x379a55)[_0x7d52('0x29')](_0x54881b);}};}function respondWithFilteredResult(_0x2de71a,_0x441ca0){return function(_0x3b2dda){if(_0x3b2dda){var _0xa618b0=typeof _0x441ca0['offset']===_0x7d52('0x2a')&&typeof _0x441ca0[_0x7d52('0x2b')]===_0x7d52('0x2a');var _0x4c15f3=_0x3b2dda['count'];var _0x2164ff=_0xa618b0?0x0:_0x441ca0[_0x7d52('0x2c')];var _0x253c4b=_0xa618b0?_0x3b2dda[_0x7d52('0x2d')]:_0x441ca0[_0x7d52('0x2c')]+_0x441ca0['limit'];var _0x6bb51c;if(_0x253c4b>=_0x4c15f3){_0x253c4b=_0x4c15f3;_0x6bb51c=0xc8;}else{_0x6bb51c=0xce;}_0x2de71a[_0x7d52('0x27')](_0x6bb51c);return _0x2de71a['set'](_0x7d52('0x2e'),_0x2164ff+'-'+_0x253c4b+'/'+_0x4c15f3)[_0x7d52('0x29')](_0x3b2dda);}return null;};}function patchUpdates(_0xe5edd2){return function(_0x2d6f13){try{jsonpatch['apply'](_0x2d6f13,_0xe5edd2,!![]);}catch(_0x1a091d){return BPromise['reject'](_0x1a091d);}return _0x2d6f13[_0x7d52('0x2f')]();};}function saveUpdates(_0x1ee5dc,_0x324ea8){return function(_0x31d739){if(_0x31d739){return _0x31d739['update'](_0x1ee5dc)[_0x7d52('0x1b')](function(_0x14d2ad){return _0x14d2ad;});}return null;};}function removeEntity(_0x249d99,_0x528662){return function(_0x1267cb){if(_0x1267cb){return _0x1267cb[_0x7d52('0x30')]()[_0x7d52('0x1b')](function(){var _0x5824ac=_0x1267cb[_0x7d52('0x31')]({'plain':!![]});var _0x1811a2=_0x7d52('0x32');return db['UserProfileResource'][_0x7d52('0x30')]({'where':{'type':_0x1811a2,'resourceId':_0x5824ac['id']}})[_0x7d52('0x1b')](function(){return _0x1267cb;});})['then'](function(){_0x249d99[_0x7d52('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x139c5a,_0xfa81b9){return function(_0x277c8a){if(!_0x277c8a){_0x139c5a['sendStatus'](0x194);}return _0x277c8a;};}function handleError(_0x2910c,_0x5ecd32){_0x5ecd32=_0x5ecd32||0x1f4;return function(_0x27df90){logger['error'](_0x27df90['stack']);if(_0x27df90['name']){delete _0x27df90['name'];}_0x2910c[_0x7d52('0x27')](_0x5ecd32)['send'](_0x27df90);};}exports[_0x7d52('0x33')]=function(_0x495b4e,_0x5b9d54){var _0x2ac657={'include':[{'model':db[_0x7d52('0x34')],'as':'mandatoryDispositionPause'}]},_0x22ddf3={},_0x4e8c71={'count':0x0,'rows':[]};var _0x1a5e42=_[_0x7d52('0x35')](db['WhatsappAccount'][_0x7d52('0x36')],function(_0x7000ea){return{'name':_0x7000ea[_0x7d52('0x37')],'type':_0x7000ea[_0x7d52('0x38')][_0x7d52('0x39')]};});_0x22ddf3['model']=_[_0x7d52('0x35')](_0x1a5e42,'name');_0x22ddf3[_0x7d52('0x3a')]=_[_0x7d52('0x3b')](_0x495b4e['query']);_0x22ddf3[_0x7d52('0x3c')]=_[_0x7d52('0x3d')](_0x22ddf3[_0x7d52('0x3e')],_0x22ddf3[_0x7d52('0x3a')]);_0x2ac657['attributes']=_['intersection'](_0x22ddf3['model'],qs['fields'](_0x495b4e[_0x7d52('0x3a')][_0x7d52('0x3f')]));_0x2ac657[_0x7d52('0x40')]=_0x2ac657[_0x7d52('0x40')][_0x7d52('0x41')]?_0x2ac657[_0x7d52('0x40')]:_0x22ddf3[_0x7d52('0x3e')];if(!_0x495b4e['query']['hasOwnProperty'](_0x7d52('0x42'))){_0x2ac657[_0x7d52('0x2b')]=qs[_0x7d52('0x2b')](_0x495b4e['query']['limit']);_0x2ac657['offset']=qs[_0x7d52('0x2c')](_0x495b4e[_0x7d52('0x3a')][_0x7d52('0x2c')]);}_0x2ac657[_0x7d52('0x43')]=qs[_0x7d52('0x44')](_0x495b4e[_0x7d52('0x3a')][_0x7d52('0x44')]);_0x2ac657['where']=qs[_0x7d52('0x3c')](_[_0x7d52('0x45')](_0x495b4e[_0x7d52('0x3a')],_0x22ddf3['filters']),_0x1a5e42);if(_0x495b4e[_0x7d52('0x3a')][_0x7d52('0x46')]){_0x2ac657[_0x7d52('0x47')]=_[_0x7d52('0x48')](_0x2ac657[_0x7d52('0x47')],{'$or':_[_0x7d52('0x35')](_0x1a5e42,function(_0x1020db){if(_0x1020db[_0x7d52('0x38')]!=='VIRTUAL'){var _0x210466={};_0x210466[_0x1020db[_0x7d52('0x49')]]={'$like':'%'+_0x495b4e['query'][_0x7d52('0x46')]+'%'};return _0x210466;}})});}_0x2ac657=_[_0x7d52('0x48')]({},_0x2ac657,_0x495b4e[_0x7d52('0x4a')]);var _0x35a383={'where':_0x2ac657[_0x7d52('0x47')]};return db[_0x7d52('0x4b')][_0x7d52('0x2d')](_0x35a383)[_0x7d52('0x1b')](function(_0x1442ff){_0x4e8c71[_0x7d52('0x2d')]=_0x1442ff;if(_0x495b4e['query'][_0x7d52('0x4c')]){_0x2ac657['include']=[{'all':!![]}];}return db[_0x7d52('0x4b')][_0x7d52('0x4d')](_0x2ac657);})[_0x7d52('0x1b')](function(_0x5e3b14){_0x4e8c71['rows']=_0x5e3b14;return _0x4e8c71;})[_0x7d52('0x1b')](respondWithFilteredResult(_0x5b9d54,_0x2ac657))[_0x7d52('0x25')](handleError(_0x5b9d54,null));};exports[_0x7d52('0x4e')]=function(_0x468191,_0x15b64c){var _0x4c7c93={'raw':![],'where':{'id':_0x468191[_0x7d52('0x4f')]['id']},'include':[{'model':db[_0x7d52('0x34')],'as':_0x7d52('0x50')}]},_0x1c1f53={};_0x1c1f53[_0x7d52('0x3e')]=_[_0x7d52('0x3b')](db[_0x7d52('0x4b')][_0x7d52('0x36')]);_0x1c1f53[_0x7d52('0x3a')]=_[_0x7d52('0x3b')](_0x468191[_0x7d52('0x3a')]);_0x1c1f53[_0x7d52('0x3c')]=_['intersection'](_0x1c1f53[_0x7d52('0x3e')],_0x1c1f53['query']);_0x4c7c93['attributes']=_[_0x7d52('0x3d')](_0x1c1f53[_0x7d52('0x3e')],qs[_0x7d52('0x3f')](_0x468191[_0x7d52('0x3a')][_0x7d52('0x3f')]));_0x4c7c93['attributes']=_0x4c7c93[_0x7d52('0x40')][_0x7d52('0x41')]?_0x4c7c93[_0x7d52('0x40')]:_0x1c1f53['model'];if(_0x468191['query'][_0x7d52('0x4c')]){_0x4c7c93[_0x7d52('0x51')]=[{'all':!![]}];}_0x4c7c93=_[_0x7d52('0x48')]({},_0x4c7c93,_0x468191[_0x7d52('0x4a')]);return db[_0x7d52('0x4b')][_0x7d52('0x52')](_0x4c7c93)[_0x7d52('0x1b')](handleEntityNotFound(_0x15b64c,null))[_0x7d52('0x1b')](respondWithResult(_0x15b64c,null))[_0x7d52('0x25')](handleError(_0x15b64c,null));};exports[_0x7d52('0x53')]=function(_0x44fb0e,_0x977f69){return db[_0x7d52('0x4b')]['create'](_0x44fb0e[_0x7d52('0x54')],{})['then'](function(_0x306f6b){var _0x4edb22=_0x44fb0e[_0x7d52('0x55')][_0x7d52('0x31')]({'plain':!![]});if(!_0x4edb22)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4edb22[_0x7d52('0x56')]===_0x7d52('0x55')){var _0x1a28ed=_0x306f6b[_0x7d52('0x31')]({'plain':!![]});var _0x3a5e9e='WhatsappAccounts';return db[_0x7d52('0x57')][_0x7d52('0x52')]({'where':{'name':_0x3a5e9e,'userProfileId':_0x4edb22['userProfileId']},'raw':!![]})[_0x7d52('0x1b')](function(_0x149aa6){if(_0x149aa6&&_0x149aa6['autoAssociation']===0x0){return db[_0x7d52('0x58')]['create']({'name':_0x1a28ed[_0x7d52('0x49')],'resourceId':_0x1a28ed['id'],'type':_0x149aa6['name'],'sectionId':_0x149aa6['id']},{})[_0x7d52('0x1b')](function(){return _0x306f6b;});}else{return _0x306f6b;}})[_0x7d52('0x25')](function(_0x13536c){logger[_0x7d52('0x20')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x13536c);throw _0x13536c;});}return _0x306f6b;})[_0x7d52('0x1b')](respondWithResult(_0x977f69,0xc9))[_0x7d52('0x25')](handleError(_0x977f69,null));};exports[_0x7d52('0x59')]=function(_0x1764ab,_0xab62c2){if(_0x1764ab[_0x7d52('0x54')]['id']){delete _0x1764ab[_0x7d52('0x54')]['id'];}return db[_0x7d52('0x4b')][_0x7d52('0x52')]({'where':{'id':_0x1764ab['params']['id']},'include':[{'model':db['Pause'],'as':_0x7d52('0x50')}]})[_0x7d52('0x1b')](handleEntityNotFound(_0xab62c2,null))[_0x7d52('0x1b')](saveUpdates(_0x1764ab[_0x7d52('0x54')],null))[_0x7d52('0x1b')](respondWithResult(_0xab62c2,null))[_0x7d52('0x25')](handleError(_0xab62c2,null));};exports[_0x7d52('0x30')]=function(_0x11e202,_0x1f0004){return db[_0x7d52('0x4b')][_0x7d52('0x52')]({'where':{'id':_0x11e202[_0x7d52('0x4f')]['id']}})[_0x7d52('0x1b')](handleEntityNotFound(_0x1f0004,null))['then'](removeEntity(_0x1f0004,null))[_0x7d52('0x25')](handleError(_0x1f0004,null));};exports[_0x7d52('0x5a')]=function(_0x3abeb2,_0x26ab0b){return db[_0x7d52('0x4b')][_0x7d52('0x5a')]()[_0x7d52('0x1b')](respondWithResult(_0x26ab0b,null))['catch'](handleError(_0x26ab0b,null));};exports[_0x7d52('0x5b')]=function(_0x115f46,_0x3b77d8,_0x3b51f8){if(_0x115f46['body']['id']){delete _0x115f46[_0x7d52('0x54')]['id'];}return db['WhatsappAccount'][_0x7d52('0x52')]({'where':{'id':_0x115f46['params']['id']}})[_0x7d52('0x1b')](handleEntityNotFound(_0x3b77d8,null))[_0x7d52('0x1b')](function(_0x5d04d0){if(_0x5d04d0){_0x115f46[_0x7d52('0x54')][_0x7d52('0x5c')]=_0x5d04d0['id'];return db[_0x7d52('0x5d')][_0x7d52('0x53')](_0x115f46['body']);}})[_0x7d52('0x1b')](respondWithResult(_0x3b77d8,null))[_0x7d52('0x25')](handleError(_0x3b77d8,null));};exports[_0x7d52('0x5e')]=function(_0xde3d4a,_0xaee02c,_0x393198){var _0x3980ea={'raw':![],'where':{}};var _0x514c98={};var _0x584adb={'count':0x0,'rows':[]};return db['WhatsappAccount']['findOne']({'where':{'id':_0xde3d4a[_0x7d52('0x4f')]['id']}})[_0x7d52('0x1b')](handleEntityNotFound(_0xaee02c,null))[_0x7d52('0x1b')](function(_0x4e812a){if(_0x4e812a){_0x514c98[_0x7d52('0x3e')]=_['keys'](db[_0x7d52('0x5d')][_0x7d52('0x36')]);_0x514c98['query']=_[_0x7d52('0x3b')](_0xde3d4a[_0x7d52('0x3a')]);_0x514c98[_0x7d52('0x3c')]=_[_0x7d52('0x3d')](_0x514c98[_0x7d52('0x3e')],_0x514c98['query']);_0x3980ea['attributes']=_['intersection'](_0x514c98[_0x7d52('0x3e')],qs['fields'](_0xde3d4a['query']['fields']));_0x3980ea['attributes']=_0x3980ea[_0x7d52('0x40')][_0x7d52('0x41')]?_0x3980ea[_0x7d52('0x40')]:_0x514c98[_0x7d52('0x3e')];if(!_0xde3d4a[_0x7d52('0x3a')][_0x7d52('0x5f')]('nolimit')){_0x3980ea[_0x7d52('0x2b')]=qs[_0x7d52('0x2b')](_0xde3d4a['query'][_0x7d52('0x2b')]);_0x3980ea['offset']=qs[_0x7d52('0x2c')](_0xde3d4a[_0x7d52('0x3a')]['offset']);}_0x3980ea[_0x7d52('0x43')]=qs[_0x7d52('0x44')](_0xde3d4a['query']['sort']);_0x3980ea[_0x7d52('0x47')]=qs['filters'](_[_0x7d52('0x45')](_0xde3d4a[_0x7d52('0x3a')],_0x514c98['filters']));_0x3980ea[_0x7d52('0x47')][_0x7d52('0x5c')]=_0x4e812a['id'];if(_0xde3d4a['query']['filter']){_0x3980ea[_0x7d52('0x47')]=_[_0x7d52('0x48')](_0x3980ea['where'],{'$or':_[_0x7d52('0x35')](_0x3980ea[_0x7d52('0x40')],function(_0x4ea1ac){var _0x18051a={};_0x18051a[_0x4ea1ac]={'$like':'%'+_0xde3d4a[_0x7d52('0x3a')][_0x7d52('0x46')]+'%'};return _0x18051a;})});}_0x3980ea=_[_0x7d52('0x48')]({},_0x3980ea,_0xde3d4a[_0x7d52('0x4a')]);return db[_0x7d52('0x5d')][_0x7d52('0x2d')]({'where':_0x3980ea['where']})[_0x7d52('0x1b')](function(_0x47f74f){_0x584adb[_0x7d52('0x2d')]=_0x47f74f;if(_0xde3d4a[_0x7d52('0x3a')][_0x7d52('0x4c')]){_0x3980ea[_0x7d52('0x51')]=[{'all':!![]}];}return db[_0x7d52('0x5d')][_0x7d52('0x4d')](_0x3980ea);})[_0x7d52('0x1b')](function(_0x3d8c0c){_0x584adb['rows']=_0x3d8c0c;return _0x584adb;});}})[_0x7d52('0x1b')](respondWithFilteredResult(_0xaee02c,_0x3980ea))[_0x7d52('0x25')](handleError(_0xaee02c,null));};exports[_0x7d52('0x60')]=function(_0x522744,_0x5ee5e3,_0x495c67){return db[_0x7d52('0x4b')][_0x7d52('0x52')]({'where':{'id':_0x522744[_0x7d52('0x4f')]['id']}})[_0x7d52('0x1b')](handleEntityNotFound(_0x5ee5e3,null))['then'](function(_0x2ec1c){if(_0x2ec1c){return _0x2ec1c[_0x7d52('0x60')](_0x522744['query'][_0x7d52('0x61')]);}})['then'](respondWithStatusCode(_0x5ee5e3,null))['catch'](handleError(_0x5ee5e3,null));};exports[_0x7d52('0x62')]=function(_0x18bd06,_0x50bdd1,_0x104b05){if(_0x18bd06[_0x7d52('0x54')]['id']){delete _0x18bd06['body']['id'];}return db[_0x7d52('0x4b')][_0x7d52('0x52')]({'where':{'id':_0x18bd06[_0x7d52('0x4f')]['id']}})[_0x7d52('0x1b')](handleEntityNotFound(_0x50bdd1,null))[_0x7d52('0x1b')](function(_0x4acbdd){if(_0x4acbdd){_0x18bd06[_0x7d52('0x54')][_0x7d52('0x5c')]=_0x4acbdd['id'];return db['CannedAnswer']['create'](_0x18bd06[_0x7d52('0x54')]);}})['then'](respondWithResult(_0x50bdd1,null))['catch'](handleError(_0x50bdd1,null));};exports[_0x7d52('0x63')]=function(_0x15b895,_0x585884,_0x4939fa){var _0x28e510={'raw':![],'where':{}};var _0x843f5d={};var _0x50b990={'count':0x0,'rows':[]};return db[_0x7d52('0x4b')]['findOne']({'where':{'id':_0x15b895['params']['id']}})[_0x7d52('0x1b')](handleEntityNotFound(_0x585884,null))['then'](function(_0x950490){if(_0x950490){_0x843f5d[_0x7d52('0x3e')]=_[_0x7d52('0x3b')](db[_0x7d52('0x64')][_0x7d52('0x36')]);_0x843f5d[_0x7d52('0x3a')]=_[_0x7d52('0x3b')](_0x15b895[_0x7d52('0x3a')]);_0x843f5d['filters']=_[_0x7d52('0x3d')](_0x843f5d[_0x7d52('0x3e')],_0x843f5d[_0x7d52('0x3a')]);_0x28e510['attributes']=_[_0x7d52('0x3d')](_0x843f5d[_0x7d52('0x3e')],qs[_0x7d52('0x3f')](_0x15b895[_0x7d52('0x3a')][_0x7d52('0x3f')]));_0x28e510['attributes']=_0x28e510[_0x7d52('0x40')][_0x7d52('0x41')]?_0x28e510['attributes']:_0x843f5d[_0x7d52('0x3e')];if(!_0x15b895[_0x7d52('0x3a')][_0x7d52('0x5f')](_0x7d52('0x42'))){_0x28e510[_0x7d52('0x2b')]=qs[_0x7d52('0x2b')](_0x15b895[_0x7d52('0x3a')][_0x7d52('0x2b')]);_0x28e510['offset']=qs[_0x7d52('0x2c')](_0x15b895[_0x7d52('0x3a')][_0x7d52('0x2c')]);}_0x28e510[_0x7d52('0x43')]=qs[_0x7d52('0x44')](_0x15b895[_0x7d52('0x3a')]['sort']);_0x28e510[_0x7d52('0x47')]=qs['filters'](_[_0x7d52('0x45')](_0x15b895[_0x7d52('0x3a')],_0x843f5d[_0x7d52('0x3c')]));_0x28e510[_0x7d52('0x47')]['WhatsappAccountId']=_0x950490['id'];if(_0x15b895[_0x7d52('0x3a')][_0x7d52('0x46')]){_0x28e510[_0x7d52('0x47')]=_[_0x7d52('0x48')](_0x28e510[_0x7d52('0x47')],{'$or':_[_0x7d52('0x35')](_0x28e510[_0x7d52('0x40')],function(_0xdc8f3){var _0x3665a8={};_0x3665a8[_0xdc8f3]={'$like':'%'+_0x15b895[_0x7d52('0x3a')]['filter']+'%'};return _0x3665a8;})});}_0x28e510=_[_0x7d52('0x48')]({},_0x28e510,_0x15b895['options']);return db[_0x7d52('0x64')][_0x7d52('0x2d')]({'where':_0x28e510[_0x7d52('0x47')]})[_0x7d52('0x1b')](function(_0x5deb63){_0x50b990[_0x7d52('0x2d')]=_0x5deb63;if(_0x15b895[_0x7d52('0x3a')][_0x7d52('0x4c')]){_0x28e510[_0x7d52('0x51')]=[{'all':!![]}];}return db[_0x7d52('0x64')][_0x7d52('0x4d')](_0x28e510);})[_0x7d52('0x1b')](function(_0x59abcd){_0x50b990[_0x7d52('0x65')]=_0x59abcd;return _0x50b990;});}})[_0x7d52('0x1b')](respondWithFilteredResult(_0x585884,_0x28e510))[_0x7d52('0x25')](handleError(_0x585884,null));};exports[_0x7d52('0x66')]=function(_0xf24b7,_0x4a0bbe,_0x314228){return db[_0x7d52('0x4b')][_0x7d52('0x52')]({'where':{'id':_0xf24b7[_0x7d52('0x4f')]['id']}})[_0x7d52('0x1b')](handleEntityNotFound(_0x4a0bbe,null))['then'](function(_0x287360){if(_0x287360){return _0x287360[_0x7d52('0x66')](_0xf24b7[_0x7d52('0x3a')][_0x7d52('0x61')]);}})['then'](respondWithStatusCode(_0x4a0bbe,null))['catch'](handleError(_0x4a0bbe,null));};exports[_0x7d52('0x67')]=function(_0x3f38be,_0x2abb17,_0x3238f6){return db[_0x7d52('0x4b')]['find']({'where':{'id':_0x3f38be[_0x7d52('0x4f')]['id']}})['then'](handleEntityNotFound(_0x2abb17,null))[_0x7d52('0x1b')](function(_0x43c3fd){if(_0x43c3fd){return _0x43c3fd[_0x7d52('0x67')](_0x3f38be['body'][_0x7d52('0x61')],_[_0x7d52('0x68')](_0x3f38be[_0x7d52('0x54')],[_0x7d52('0x61'),'id'])||{})['spread'](function(_0x2ec51e){for(var _0x360ec5=0x0;_0x360ec5<_0x3f38be[_0x7d52('0x54')][_0x7d52('0x61')]['length'];_0x360ec5+=0x1){socket['emit'](_0x7d52('0x69'),{'UserId':Number(_0x3f38be[_0x7d52('0x54')][_0x7d52('0x61')][_0x360ec5]),'WhatsappAccountId':Number(_0x3f38be[_0x7d52('0x4f')]['id'])});}return _0x2ec51e;});}})[_0x7d52('0x1b')](respondWithResult(_0x2abb17,null))['catch'](handleError(_0x2abb17,null));};exports[_0x7d52('0x6a')]=function(_0x11dbb3,_0x46151c,_0x38b96e){return db['WhatsappAccount']['find']({'where':{'id':_0x11dbb3[_0x7d52('0x4f')]['id']}})['then'](handleEntityNotFound(_0x46151c,null))[_0x7d52('0x1b')](function(_0x3b60e0){if(_0x3b60e0){return _0x3b60e0['removeAgents'](_0x11dbb3['query']['ids'])[_0x7d52('0x1b')](function(){if(_['isArray'](_0x11dbb3[_0x7d52('0x3a')]['ids'])){for(var _0x2a8965=0x0;_0x2a8965<_0x11dbb3[_0x7d52('0x3a')][_0x7d52('0x61')][_0x7d52('0x41')];_0x2a8965+=0x1){socket[_0x7d52('0x6b')](_0x7d52('0x6c'),{'UserId':Number(_0x11dbb3[_0x7d52('0x3a')][_0x7d52('0x61')][_0x2a8965]),'WhatsappAccountId':Number(_0x11dbb3['params']['id'])});}}else{socket[_0x7d52('0x6b')](_0x7d52('0x6c'),{'UserId':Number(_0x11dbb3[_0x7d52('0x3a')]['ids']),'WhatsappAccountId':Number(_0x11dbb3[_0x7d52('0x4f')]['id'])});}});}})[_0x7d52('0x1b')](respondWithStatusCode(_0x46151c,null))[_0x7d52('0x25')](handleError(_0x46151c,null));};exports[_0x7d52('0x6d')]=function(_0x14c764,_0x43ba42,_0x797177){var _0x4d3694={};var _0x3763f4={};var _0x3ebea1;var _0x5a1d76;return db[_0x7d52('0x4b')][_0x7d52('0x6e')]({'where':{'id':_0x14c764['params']['id']}})['then'](handleEntityNotFound(_0x43ba42,null))[_0x7d52('0x1b')](function(_0x5bb787){if(_0x5bb787){_0x3ebea1=_0x5bb787;_0x3763f4[_0x7d52('0x3e')]=_['keys'](db[_0x7d52('0x6f')][_0x7d52('0x36')]);_0x3763f4[_0x7d52('0x3a')]=_['keys'](_0x14c764[_0x7d52('0x3a')]);_0x3763f4[_0x7d52('0x3c')]=_[_0x7d52('0x3d')](_0x3763f4[_0x7d52('0x3e')],_0x3763f4[_0x7d52('0x3a')]);_0x4d3694[_0x7d52('0x40')]=_['intersection'](_0x3763f4[_0x7d52('0x3e')],qs[_0x7d52('0x3f')](_0x14c764['query'][_0x7d52('0x3f')]));_0x4d3694[_0x7d52('0x40')]=_0x4d3694[_0x7d52('0x40')][_0x7d52('0x41')]?_0x4d3694[_0x7d52('0x40')]:_0x3763f4[_0x7d52('0x3e')];_0x4d3694['order']=qs['sort'](_0x14c764[_0x7d52('0x3a')]['sort']);_0x4d3694['where']=qs['filters'](_[_0x7d52('0x45')](_0x14c764['query'],_0x3763f4[_0x7d52('0x3c')]));if(_0x14c764[_0x7d52('0x3a')][_0x7d52('0x46')]){_0x4d3694[_0x7d52('0x47')]=_[_0x7d52('0x48')](_0x4d3694['where'],{'$or':_[_0x7d52('0x35')](_0x4d3694[_0x7d52('0x40')],function(_0x456dba){var _0x20b162={};_0x20b162[_0x456dba]={'$like':'%'+_0x14c764[_0x7d52('0x3a')]['filter']+'%'};return _0x20b162;})});}_0x4d3694=_[_0x7d52('0x48')]({},_0x4d3694,_0x14c764['options']);return _0x3ebea1[_0x7d52('0x6d')](_0x4d3694);}})[_0x7d52('0x1b')](function(_0x1b4ac6){if(_0x1b4ac6){_0x5a1d76=_0x1b4ac6['length'];if(!_0x14c764[_0x7d52('0x3a')][_0x7d52('0x5f')](_0x7d52('0x42'))){_0x4d3694['limit']=qs['limit'](_0x14c764[_0x7d52('0x3a')][_0x7d52('0x2b')]);_0x4d3694[_0x7d52('0x2c')]=qs[_0x7d52('0x2c')](_0x14c764['query'][_0x7d52('0x2c')]);}return _0x3ebea1[_0x7d52('0x6d')](_0x4d3694);}})[_0x7d52('0x1b')](function(_0x5b1af9){if(_0x5b1af9){return _0x5b1af9?{'count':_0x5a1d76,'rows':_0x5b1af9}:null;}})[_0x7d52('0x1b')](respondWithResult(_0x43ba42,null))[_0x7d52('0x25')](handleError(_0x43ba42,null));};exports[_0x7d52('0x70')]=function(_0x53f9dc,_0x3a6faf){var _0x51d997=_0x53f9dc[_0x7d52('0x4f')]['id'];var _0x278fb2=_0x53f9dc[_0x7d52('0x54')];var _0x5eb3a7=0xc8;var _0x57458b=null;return db[_0x7d52('0x71')][_0x7d52('0x72')]({'isolationLevel':db['sequelize']['Transaction'][_0x7d52('0x73')][_0x7d52('0x74')]},function(_0x244a07){return db[_0x7d52('0x4b')][_0x7d52('0x6e')]({'where':{'id':_0x51d997},'transaction':_0x244a07})[_0x7d52('0x1b')](function(_0x3b7d6d){if(_0x3b7d6d){return db[_0x7d52('0x75')][_0x7d52('0x30')]({'where':{'WhatsappAccountId':_0x51d997},'transaction':_0x244a07})[_0x7d52('0x1b')](function(){var _0x41c0e5=_[_0x7d52('0x35')](_0x278fb2,function(_0x1e095b){_0x1e095b[_0x7d52('0x5c')]=_0x51d997;return _0x1e095b;});return db['WhatsappApplication']['bulkCreate'](_0x41c0e5,{'transaction':_0x244a07});});}else{_0x5eb3a7=0x194;_0x57458b=[];}});})['then'](function(){if(_0x5eb3a7!==0x194){return db['WhatsappApplication'][_0x7d52('0x76')]({'where':{'WhatsappAccountId':_0x51d997},'order':_0x7d52('0x77')})['then'](function(_0x164e67){_0x57458b=_0x164e67;});}})[_0x7d52('0x25')](function(_0x1f0357){_0x5eb3a7=0x1f4;logger[_0x7d52('0x20')](_0x1f0357[_0x7d52('0x78')]);if(_0x1f0357[_0x7d52('0x49')]){delete _0x1f0357[_0x7d52('0x49')];}_0x57458b=_0x1f0357;})['finally'](function(){if(_0x57458b===null){_0x3a6faf[_0x7d52('0x26')](_0x5eb3a7);}else{if(_0x5eb3a7===0x1f4){_0x3a6faf[_0x7d52('0x27')](_0x5eb3a7)[_0x7d52('0x79')](_0x57458b);}else{_0x3a6faf[_0x7d52('0x27')](_0x5eb3a7)[_0x7d52('0x29')](_0x57458b);}}});};exports[_0x7d52('0x7a')]=function(_0x24ebbb,_0x51b7ec,_0x11e036){var _0x37198f={};var _0x335f92={};var _0x163cdf;var _0x5770a8;return db[_0x7d52('0x4b')][_0x7d52('0x6e')]({'where':{'id':_0x24ebbb[_0x7d52('0x4f')]['id']}})['then'](handleEntityNotFound(_0x51b7ec,null))[_0x7d52('0x1b')](function(_0xd67697){if(_0xd67697){_0x163cdf=_0xd67697;_0x335f92[_0x7d52('0x3e')]=_[_0x7d52('0x3b')](db['WhatsappApplication'][_0x7d52('0x36')]);_0x335f92['query']=_['keys'](_0x24ebbb['query']);_0x335f92[_0x7d52('0x3c')]=_[_0x7d52('0x3d')](_0x335f92['model'],_0x335f92[_0x7d52('0x3a')]);_0x37198f[_0x7d52('0x40')]=_[_0x7d52('0x3d')](_0x335f92[_0x7d52('0x3e')],qs['fields'](_0x24ebbb[_0x7d52('0x3a')]['fields']));_0x37198f[_0x7d52('0x40')]=_0x37198f[_0x7d52('0x40')][_0x7d52('0x41')]?_0x37198f[_0x7d52('0x40')]:_0x335f92[_0x7d52('0x3e')];_0x37198f[_0x7d52('0x43')]=qs['sort'](_0x24ebbb[_0x7d52('0x3a')][_0x7d52('0x44')]);_0x37198f[_0x7d52('0x47')]=qs[_0x7d52('0x3c')](_[_0x7d52('0x45')](_0x24ebbb[_0x7d52('0x3a')],_0x335f92[_0x7d52('0x3c')]));if(_0x24ebbb['query'][_0x7d52('0x46')]){_0x37198f[_0x7d52('0x47')]=_['merge'](_0x37198f[_0x7d52('0x47')],{'$or':_[_0x7d52('0x35')](_0x37198f[_0x7d52('0x40')],function(_0x54a33f){var _0x11112c={};_0x11112c[_0x54a33f]={'$like':'%'+_0x24ebbb[_0x7d52('0x3a')][_0x7d52('0x46')]+'%'};return _0x11112c;})});}_0x37198f=_[_0x7d52('0x48')]({},_0x37198f,_0x24ebbb[_0x7d52('0x4a')]);return _0x163cdf[_0x7d52('0x7a')](_0x37198f);}})[_0x7d52('0x1b')](function(_0x45d484){if(_0x45d484){_0x5770a8=_0x45d484[_0x7d52('0x41')];if(!_0x24ebbb[_0x7d52('0x3a')][_0x7d52('0x5f')](_0x7d52('0x42'))){_0x37198f[_0x7d52('0x2b')]=qs[_0x7d52('0x2b')](_0x24ebbb[_0x7d52('0x3a')][_0x7d52('0x2b')]);_0x37198f[_0x7d52('0x2c')]=qs[_0x7d52('0x2c')](_0x24ebbb[_0x7d52('0x3a')][_0x7d52('0x2c')]);}return _0x163cdf[_0x7d52('0x7a')](_0x37198f);}})['then'](function(_0x3f8a5e){if(_0x3f8a5e){return _0x3f8a5e?{'count':_0x5770a8,'rows':_0x3f8a5e}:null;}})[_0x7d52('0x1b')](respondWithResult(_0x51b7ec,null))[_0x7d52('0x25')](handleError(_0x51b7ec,null));};exports['notify']=function(_0x273942,_0x288a99,_0x27f8a2){var _0x532805={'channel':_0x7d52('0x7b')};var _0x466bba=[];var _0x2ba25f=[];var _0x1ad827={};return db['WhatsappAccount']['find']({'where':{'id':_0x273942[_0x7d52('0x4f')]['id']},'include':[{'model':db[_0x7d52('0x75')],'as':_0x7d52('0x7c')}]})[_0x7d52('0x1b')](handleEntityNotFound(_0x288a99,null))['then'](function(_0x5c5c4a){_0x532805[_0x7d52('0x7d')]=_0x5c5c4a;if(_0x532805[_0x7d52('0x7d')]&&_0x532805['account'][_0x7d52('0x38')]===_0x7d52('0x7e')&&_0x273942[_0x7d52('0x54')][_0x7d52('0x7f')]){if(_0x273942['body'][_0x7d52('0x7f')]['length']===0x0)return;if(_0x273942[_0x7d52('0x54')][_0x7d52('0x7f')][0x0][_0x7d52('0x80')]!==_0x7d52('0x81'))return;return db[_0x7d52('0x82')][_0x7d52('0x59')]({'read':!![],'readAt':_0x273942[_0x7d52('0x54')][_0x7d52('0x7f')][0x0]['timestamp']},{'where':{'messageId':_0x273942[_0x7d52('0x54')][_0x7d52('0x7f')][0x0][_0x7d52('0x83')]},'individualHooks':!![]})['then'](function(_0x4854b5){return _0x288a99[_0x7d52('0x27')](0xc8)[_0x7d52('0x29')](_0x4854b5);});}_0x532805['applications']=_['orderBy'](_0x5c5c4a[_0x7d52('0x7c')],[_0x7d52('0x77')],[_0x7d52('0x84')]);if(_0x532805[_0x7d52('0x7d')]['Applications']){delete _0x532805[_0x7d52('0x7d')][_0x7d52('0x7c')];}return db[_0x7d52('0x85')][_0x7d52('0x5a')]()['then'](function(_0x476683){if(!_0x476683){throw new db[(_0x7d52('0x86'))][(_0x7d52('0x87'))]('no\x20available\x20attributes');}_0x466bba=_['difference'](_[_0x7d52('0x3b')](_0x476683),['createdAt',_0x7d52('0x88')]);_0x2ba25f=_[_0x7d52('0x89')](_[_0x7d52('0x3b')](_0x476683),[_0x7d52('0x8a'),_0x7d52('0x88'),'CompanyId',_0x7d52('0x8b')]);_0x532805[_0x7d52('0x54')]={'mapKey':_0x7d52('0x8c')};if(_0x532805[_0x7d52('0x7d')]&&_0x532805['account'][_0x7d52('0x38')]===_0x7d52('0x8d')){_0x532805['body']['from']=_0x273942['body'][_0x7d52('0x8e')][_0x7d52('0x8f')]('whatsapp:','');_0x532805['body']['body']=_0x273942[_0x7d52('0x54')][_0x7d52('0x90')];_0x532805[_0x7d52('0x54')][_0x7d52('0x91')]=_0x273942[_0x7d52('0x54')][_0x7d52('0x92')];}if(_0x532805['account']&&_0x532805[_0x7d52('0x7d')][_0x7d52('0x38')]===_0x7d52('0x7e')){_0x532805[_0x7d52('0x54')][_0x7d52('0x93')]=_0x273942[_0x7d52('0x54')][_0x7d52('0x94')][0x0][_0x7d52('0x93')];_0x532805['body'][_0x7d52('0x54')]=_0x273942[_0x7d52('0x54')]['notifications'][0x0][_0x7d52('0x24')][_0x7d52('0x54')];_0x532805[_0x7d52('0x54')][_0x7d52('0x91')]=_0x273942[_0x7d52('0x54')][_0x7d52('0x94')][0x0][_0x7d52('0x83')];}if(_0x532805['body']['id']){delete _0x532805[_0x7d52('0x54')]['id'];}if(_[_0x7d52('0x95')](_0x532805[_0x7d52('0x54')][_0x7d52('0x93')])){throw new db[(_0x7d52('0x86'))][(_0x7d52('0x87'))](_0x7d52('0x96'));}if(_[_0x7d52('0x95')](_0x532805[_0x7d52('0x54')]['body'])||_0x532805['body'][_0x7d52('0x54')]===''){throw new db['Sequelize']['ValidationError'](_0x7d52('0x97'));}if(_[_0x7d52('0x95')](_0x532805[_0x7d52('0x54')][_0x7d52('0x98')])){throw new db[(_0x7d52('0x86'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2ba25f);}if(!_[_0x7d52('0x99')](_0x2ba25f,_0x532805[_0x7d52('0x54')]['mapKey'])){throw new db[(_0x7d52('0x86'))][(_0x7d52('0x87'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2ba25f);}_0x1ad827[_0x532805[_0x7d52('0x54')]['mapKey']]=_0x532805[_0x7d52('0x54')][_0x7d52('0x93')];return db['CmList'][_0x7d52('0x52')]({'where':{'id':_0x532805[_0x7d52('0x7d')][_0x7d52('0x8b')]},'include':[{'model':db[_0x7d52('0x85')],'as':_0x7d52('0x9a'),'where':_0x1ad827,'limit':0x1,'order':[['updatedAt',_0x7d52('0x9b')]]}]});})[_0x7d52('0x1b')](handleEntityNotFound(_0x288a99,null))[_0x7d52('0x1b')](function(_0x23b72d){if(_0x23b72d){_0x532805[_0x7d52('0x9c')]=_[_0x7d52('0x68')](_0x23b72d,[_0x7d52('0x9a')]);if(_0x23b72d[_0x7d52('0x9a')][_0x7d52('0x41')]){return _0x23b72d[_0x7d52('0x9a')][0x0];}var _0x191fe1=_[_0x7d52('0x16')](_0x532805[_0x7d52('0x54')],{'firstName':_0x532805[_0x7d52('0x54')][_0x7d52('0x93')],'ListId':_0x23b72d['id']});_0x191fe1[_0x532805['body']['mapKey']]=_0x532805[_0x7d52('0x54')]['from'];return db['CmContact'][_0x7d52('0x53')](_0x191fe1,{'fields':_0x466bba,'raw':!![]});}})[_0x7d52('0x1b')](handleEntityNotFound(_0x288a99,null))[_0x7d52('0x1b')](function(_0x446a0e){if(_0x446a0e){_0x532805[_0x7d52('0x9d')]=_0x446a0e;var _0x288d9b={'ContactId':_0x446a0e['id'],'phone':_0x532805[_0x7d52('0x54')][_0x7d52('0x93')],'WhatsappAccountId':_0x273942[_0x7d52('0x4f')]['id']};var _0x37eb7a={'ContactId':_0x446a0e['id'],'WhatsappAccountId':_0x273942[_0x7d52('0x4f')]['id'],'closed':![]};return db[_0x7d52('0x9e')][_0x7d52('0x52')]({'where':_0x37eb7a})['then'](function(_0x3619cc){if(_0x3619cc){return[_0x3619cc,![]];}return db[_0x7d52('0x9e')][_0x7d52('0x53')](_0x288d9b)[_0x7d52('0x1b')](function(_0x1af785){return[_0x1af785,!![]];});});}})['spread'](function(_0x132256,_0x262682){_0x532805[_0x7d52('0x9f')]=_0x132256[_0x7d52('0x31')]({'plain':!![]});_0x532805[_0x7d52('0x9f')]['created']=![];if(_0x262682){if(_0x532805[_0x7d52('0x7d')]['autoclose']){_0x532805['applications'][_0x7d52('0xa0')]({'id':0x0,'priority':_0x532805['applications']['length']+0x1,'app':'close','appdata':'unmanaged','interval':_0x7d52('0xa1')});}_0x532805[_0x7d52('0x9f')][_0x7d52('0xa2')]=!![];}return db[_0x7d52('0x82')]['create']({'phone':_0x532805[_0x7d52('0x54')][_0x7d52('0x93')],'messageId':_0x532805[_0x7d52('0x54')]['messageId'],'body':_0x532805[_0x7d52('0x54')]['body'],'WhatsappAccountId':_0x273942['params']['id'],'WhatsappInteractionId':_0x132256['id'],'direction':'in','ContactId':_0x132256[_0x7d52('0xa3')],'AttachmentId':_0x532805['body'][_0x7d52('0xa4')]});})[_0x7d52('0x1b')](function(_0x121641){_0x532805[_0x7d52('0x24')]=_0x121641;if(!_0x532805[_0x7d52('0x9f')][_0x7d52('0xa5')])return;return db['User']['find']({'attributes':['id',_0x7d52('0x49')],'where':{'id':_0x532805[_0x7d52('0x9f')][_0x7d52('0xa5')]}});})[_0x7d52('0x1b')](function(_0x19b57d){if(_0x19b57d){_0x532805[_0x7d52('0xa6')][_0x7d52('0xa7')]({'id':0x0,'priority':0x0,'app':_0x7d52('0xa8'),'appdata':_0x19b57d[_0x7d52('0x49')]+','+(_0x532805[_0x7d52('0x7d')]['waitForTheAssignedAgent']||0xa),'interval':_0x7d52('0xa1')});}if(!_0x532805[_0x7d52('0x9f')][_0x7d52('0xa9')])return;return db[_0x7d52('0xaa')]['find']({'attributes':['id',_0x7d52('0x49')],'where':{'id':_0x532805[_0x7d52('0x9f')][_0x7d52('0xa9')]}});})['then'](function(_0x2ec76a){if(_0x2ec76a){_0x532805[_0x7d52('0xa6')][_0x7d52('0xa7')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x2ec76a[_0x7d52('0x49')]+','+(_0x532805['account'][_0x7d52('0xab')]||0x12c),'interval':_0x7d52('0xa1')});}return respondWithRpcPromise(_0x7d52('0xac'),_0x7d52('0xad'),_0x532805);})['then'](function(_0x20bd07){if(_0x20bd07){var _0x1ea726=0xc8;var _0x4f02c7='receiveMessage';logger[_0x7d52('0xae')](_0x7d52('0x1e'),_0x4f02c7,_0x1ea726,_0x7d52('0xaf'));logger[_0x7d52('0x1d')]('WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x4f02c7,_0x1ea726,_0x7d52('0xaf'),JSON[_0x7d52('0x1f')](_0x20bd07));if(_0x532805['account']['type']===_0x7d52('0x8d')){return _0x288a99['status'](_0x1ea726)[_0x7d52('0xb0')](_0x7d52('0xb1'),_0x7d52('0xb2'))['send'](_0x7d52('0xb3'));}else{return _0x288a99[_0x7d52('0x27')](_0x1ea726)['json'](_0x20bd07);}}});})['catch'](handleError(_0x288a99,null));};exports[_0x7d52('0x79')]=function(_0x705874,_0x2638b2,_0x5b2ff5){var _0x1c4b58,_0x57e1de,_0x3b7da1;if(_[_0x7d52('0x95')](_0x705874['body'][_0x7d52('0x54')])||_0x705874[_0x7d52('0x54')][_0x7d52('0x54')]===''){throw new db[(_0x7d52('0x86'))][(_0x7d52('0x87'))](_0x7d52('0x97'));}if(_[_0x7d52('0x95')](_0x705874[_0x7d52('0x54')]['to'])){throw new db['Sequelize'][(_0x7d52('0x87'))](_0x7d52('0xb4'));}_0x1c4b58=_0x705874[_0x7d52('0x54')]['to'];return db[_0x7d52('0x4b')][_0x7d52('0x52')]({'where':{'id':_0x705874['params']['id']},'include':[{'model':db[_0x7d52('0xb5')],'as':_0x7d52('0xb6'),'include':[{'model':db['CmContact'],'as':_0x7d52('0x9a'),'where':{'mobile':_0x1c4b58},'limit':0x1,'order':[[_0x7d52('0x88'),'DESC']]}]}]})['then'](handleEntityNotFound(_0x2638b2,null))[_0x7d52('0x1b')](function(_0x1be999){if(_0x1be999&&_0x1be999[_0x7d52('0xb6')]){_0x57e1de=_0x1be999[_0x7d52('0x31')]({'plain':!![]});if(_0x57e1de[_0x7d52('0xb6')]&&_0x57e1de['List']['Contacts'][_0x7d52('0x41')]){return _0x57e1de[_0x7d52('0xb6')][_0x7d52('0x9a')][0x0];}return db[_0x7d52('0x85')][_0x7d52('0x53')](_[_0x7d52('0x16')](_0x705874[_0x7d52('0x54')],{'firstName':_0x1c4b58,'mobile':_0x1c4b58,'phone':_0x1c4b58,'ListId':_0x57e1de['ListId']}));}})['then'](handleEntityNotFound(_0x2638b2,null))['then'](function(_0x153b9a){if(_0x153b9a){_0x3b7da1=_0x153b9a;return db[_0x7d52('0x9e')][_0x7d52('0x52')]({'where':{'ContactId':_0x3b7da1['id'],'closed':![],'WhatsappAccountId':_0x57e1de['id']}})[_0x7d52('0x1b')](function(_0x2a1018){if(_0x2a1018){return[_0x2a1018,![]];}return db[_0x7d52('0x9e')][_0x7d52('0x53')]({'UserId':_0x705874[_0x7d52('0x55')]['id'],'ContactId':_0x3b7da1['id'],'WhatsappAccountId':_0x57e1de['id'],'phone':_0x1c4b58,'firstMsgDirection':_0x7d52('0xb7'),'Messages':[_[_0x7d52('0x48')](_0x705874['body'],{'read':![],'body':_0x705874[_0x7d52('0x54')][_0x7d52('0x54')],'phone':_0x1c4b58,'WhatsappAccountId':_0x57e1de['id'],'UserId':_0x705874[_0x7d52('0x55')]['id'],'ContactId':_0x3b7da1['id']})]},{'include':[{'model':db['WhatsappMessage'],'as':_0x7d52('0xb8')}]})[_0x7d52('0x1b')](function(_0x194999){return[_0x194999,!![]];});});}})[_0x7d52('0xb9')](function(_0x83cb74,_0x539b48){if(_0x539b48){return _0x83cb74;}return db[_0x7d52('0x82')]['create'](_[_0x7d52('0x48')](_0x705874['body'],{'read':![],'body':_0x705874[_0x7d52('0x54')]['body'],'phone':_0x1c4b58,'WhatsappAccountId':_0x57e1de['id'],'WhatsappInteractionId':_0x83cb74['id'],'UserId':_0x705874[_0x7d52('0x55')]['id'],'ContactId':_0x3b7da1['id']}))[_0x7d52('0x1b')](function(_0x90486b){_0x83cb74[_0x7d52('0xba')][_0x7d52('0xb8')]=[];_0x83cb74[_0x7d52('0xba')]['Messages'][_0x7d52('0xa0')](_0x90486b[_0x7d52('0xba')]);return _0x83cb74;});})[_0x7d52('0x1b')](respondWithResult(_0x2638b2,null))['catch'](handleError(_0x2638b2,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index eaef045..2aaa749 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 _0x1ba7=['hook','exports','../../mysqldb','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x4e1d03,_0x786f3a){var _0x362d4b=function(_0x1924d2){while(--_0x1924d2){_0x4e1d03['push'](_0x4e1d03['shift']());}};_0x362d4b(++_0x786f3a);}(_0x1ba7,0xc2));var _0x71ba=function(_0x4d0812,_0x3dd7a8){_0x4d0812=_0x4d0812-0x0;var _0x505107=_0x1ba7[_0x4d0812];return _0x505107;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require(_0x71ba('0x0'))['db']['WhatsappAccount'];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x71ba('0x1')](0x0);var events={'afterCreate':_0x71ba('0x2'),'afterUpdate':_0x71ba('0x3'),'afterDestroy':'remove'};function emitEvent(_0x4b2ed7){return function(_0x24f9e1,_0x192fa9,_0x4f1797){WhatsappAccountEvents['emit'](_0x4b2ed7+':'+_0x24f9e1['id'],_0x24f9e1);WhatsappAccountEvents[_0x71ba('0x4')](_0x4b2ed7,_0x24f9e1);_0x4f1797(null);};}for(var e in events){if(events[_0x71ba('0x5')](e)){var event=events[e];WhatsappAccount[_0x71ba('0x6')](e,emitEvent(event));}}module[_0x71ba('0x7')]=WhatsappAccountEvents; \ No newline at end of file +var _0x5181=['WhatsappAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x1c90aa,_0x1343a0){var _0x1a4416=function(_0x491907){while(--_0x491907){_0x1c90aa['push'](_0x1c90aa['shift']());}};_0x1a4416(++_0x1343a0);}(_0x5181,0xd0));var _0x1518=function(_0x298632,_0xfaac03){_0x298632=_0x298632-0x0;var _0xfa7deb=_0x5181[_0x298632];return _0xfa7deb;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require('../../mysqldb')['db'][_0x1518('0x0')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x1518('0x1')](0x0);var events={'afterCreate':_0x1518('0x2'),'afterUpdate':_0x1518('0x3'),'afterDestroy':_0x1518('0x4')};function emitEvent(_0x1cc72d){return function(_0x15d198,_0xf159aa,_0x482ef8){WhatsappAccountEvents[_0x1518('0x5')](_0x1cc72d+':'+_0x15d198['id'],_0x15d198);WhatsappAccountEvents[_0x1518('0x5')](_0x1cc72d,_0x15d198);_0x482ef8(null);};}for(var e in events){if(events[_0x1518('0x6')](e)){var event=events[e];WhatsappAccount['hook'](e,emitEvent(event));}}module[_0x1518('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 d7f5436..a189c9c 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 _0x536a=['./whatsappAccount.attributes','exports','define','WhatsappAccount','whatsapp_accounts','util','../../config/logger','bluebird','path','rimraf','../../config/environment'];(function(_0x2aa316,_0x4191bf){var _0x55a546=function(_0x3211fc){while(--_0x3211fc){_0x2aa316['push'](_0x2aa316['shift']());}};_0x55a546(++_0x4191bf);}(_0x536a,0x102));var _0xa536=function(_0x43d89b,_0x3f7d13){_0x43d89b=_0x43d89b-0x0;var _0x174ffe=_0x536a[_0x43d89b];return _0x174ffe;};'use strict';var _=require('lodash');var util=require(_0xa536('0x0'));var logger=require(_0xa536('0x1'))('api');var moment=require('moment');var BPromise=require(_0xa536('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa536('0x3'));var rimraf=require(_0xa536('0x4'));var config=require(_0xa536('0x5'));var attributes=require(_0xa536('0x6'));module[_0xa536('0x7')]=function(_0xe7be1d,_0xf2ee6a){return _0xe7be1d[_0xa536('0x8')](_0xa536('0x9'),attributes,{'tableName':_0xa536('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbc8e=['WhatsappAccount','whatsapp_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappAccount.attributes','exports','define'];(function(_0x4c440b,_0x3ea627){var _0x2d48cf=function(_0x56bac7){while(--_0x56bac7){_0x4c440b['push'](_0x4c440b['shift']());}};_0x2d48cf(++_0x3ea627);}(_0xbc8e,0x1d0));var _0xebc8=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xbc8e[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0xebc8('0x0'));var util=require('util');var logger=require(_0xebc8('0x1'))(_0xebc8('0x2'));var moment=require(_0xebc8('0x3'));var BPromise=require(_0xebc8('0x4'));var rp=require(_0xebc8('0x5'));var fs=require('fs');var path=require(_0xebc8('0x6'));var rimraf=require(_0xebc8('0x7'));var config=require(_0xebc8('0x8'));var attributes=require(_0xebc8('0x9'));module[_0xebc8('0xa')]=function(_0x158ebd,_0x55438d){return _0x158ebd[_0xebc8('0xb')](_0xebc8('0xc'),attributes,{'tableName':_0xebc8('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 c948da6..a061669 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 _0xe51d=['find','options','raw','where','attributes','include','map','model','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','register','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowWhatsappAccount'];(function(_0x54086c,_0x386657){var _0x4ea3e0=function(_0x117ffd){while(--_0x117ffd){_0x54086c['push'](_0x54086c['shift']());}};_0x4ea3e0(++_0x386657);}(_0xe51d,0x9c));var _0xde51=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe51d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xde51('0x0'));var util=require(_0xde51('0x1'));var moment=require('moment');var BPromise=require(_0xde51('0x2'));var rs=require(_0xde51('0x3'));var fs=require('fs');var Redis=require(_0xde51('0x4'));var db=require(_0xde51('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xde51('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xde51('0x7'));var client=jayson[_0xde51('0x8')][_0xde51('0x9')]({'port':0x232a});config['redis']=_[_0xde51('0xa')](config[_0xde51('0xb')],{'host':_0xde51('0xc'),'port':0x18eb});var socket=require(_0xde51('0xd'))(new Redis(config[_0xde51('0xb')]));require('./whatsappAccount.socket')[_0xde51('0xe')](socket);function respondWithRpcPromise(_0x52ab38,_0x4dbda5,_0x4a5999){return new BPromise(function(_0x5e1b5a,_0x49c5ef){return client[_0xde51('0xf')](_0x52ab38,_0x4a5999)[_0xde51('0x10')](function(_0x4a203f){logger[_0xde51('0x11')](_0xde51('0x12'),_0x4dbda5,_0xde51('0x13'));logger[_0xde51('0x14')](_0xde51('0x15'),_0x4dbda5,_0xde51('0x13'),JSON[_0xde51('0x16')](_0x4a203f));if(_0x4a203f[_0xde51('0x17')]){if(_0x4a203f[_0xde51('0x17')][_0xde51('0x18')]===0x1f4){logger[_0xde51('0x17')](_0xde51('0x12'),_0x4dbda5,_0x4a203f['error'][_0xde51('0x19')]);return _0x49c5ef(_0x4a203f[_0xde51('0x17')][_0xde51('0x19')]);}logger['error'](_0xde51('0x12'),_0x4dbda5,_0x4a203f[_0xde51('0x17')]['message']);return _0x5e1b5a(_0x4a203f[_0xde51('0x17')][_0xde51('0x19')]);}else{logger[_0xde51('0x11')](_0xde51('0x12'),_0x4dbda5,_0xde51('0x13'));_0x5e1b5a(_0x4a203f[_0xde51('0x1a')][_0xde51('0x19')]);}})[_0xde51('0x1b')](function(_0x513efc){logger[_0xde51('0x17')](_0xde51('0x12'),_0x4dbda5,_0x513efc);_0x49c5ef(_0x513efc);});});}exports[_0xde51('0x1c')]=function(_0x240d21){var _0x103ae3=this;return new Promise(function(_0x4052c1,_0x3bb692){return db['WhatsappAccount'][_0xde51('0x1d')]({'raw':_0x240d21[_0xde51('0x1e')]?_0x240d21[_0xde51('0x1e')][_0xde51('0x1f')]===undefined?!![]:![]:!![],'where':_0x240d21[_0xde51('0x1e')]?_0x240d21['options'][_0xde51('0x20')]||null:null,'attributes':_0x240d21[_0xde51('0x1e')]?_0x240d21['options'][_0xde51('0x21')]||null:null,'include':_0x240d21[_0xde51('0x1e')]?_0x240d21[_0xde51('0x1e')][_0xde51('0x22')]?_[_0xde51('0x23')](_0x240d21[_0xde51('0x1e')][_0xde51('0x22')],function(_0x241dc5){return{'model':db[_0x241dc5[_0xde51('0x24')]],'as':_0x241dc5['as'],'attributes':_0x241dc5[_0xde51('0x21')],'include':_0x241dc5[_0xde51('0x22')]?_[_0xde51('0x23')](_0x241dc5[_0xde51('0x22')],function(_0xc62246){return{'model':db[_0xc62246[_0xde51('0x24')]],'as':_0xc62246['as'],'attributes':_0xc62246[_0xde51('0x21')],'include':_0xc62246[_0xde51('0x22')]?_[_0xde51('0x23')](_0xc62246[_0xde51('0x22')],function(_0xdc6d31){return{'model':db[_0xdc6d31['model']],'as':_0xdc6d31['as'],'attributes':_0xdc6d31[_0xde51('0x21')]};}):[]};}):[]};}):[]:[]})[_0xde51('0x10')](function(_0x322bbc){logger[_0xde51('0x11')](_0xde51('0x1c'),_0x240d21);logger[_0xde51('0x14')](_0xde51('0x1c'),_0x240d21,JSON[_0xde51('0x16')](_0x322bbc));_0x4052c1(_0x322bbc);})[_0xde51('0x1b')](function(_0x36a663){logger[_0xde51('0x17')](_0xde51('0x1c'),_0x36a663[_0xde51('0x19')],_0x240d21);_0x3bb692(_0x103ae3['error'](0x1f4,_0x36a663[_0xde51('0x19')]));});});}; \ No newline at end of file +var _0x1507=['map','include','model','attributes','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','redis','localhost','./whatsappAccount.socket','register','request','then','info','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappAccount,\x20%s,\x20%s','message','result','ShowWhatsappAccount','find','options'];(function(_0x380e75,_0x486360){var _0x444d96=function(_0x32c8f8){while(--_0x32c8f8){_0x380e75['push'](_0x380e75['shift']());}};_0x444d96(++_0x486360);}(_0x1507,0x1bf));var _0x7150=function(_0x78db5e,_0x3b9804){_0x78db5e=_0x78db5e-0x0;var _0x250b88=_0x1507[_0x78db5e];return _0x250b88;};'use strict';var _=require(_0x7150('0x0'));var util=require(_0x7150('0x1'));var moment=require(_0x7150('0x2'));var BPromise=require(_0x7150('0x3'));var rs=require(_0x7150('0x4'));var fs=require('fs');var Redis=require(_0x7150('0x5'));var db=require(_0x7150('0x6'))['db'];var utils=require(_0x7150('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x7150('0x8'));var jayson=require(_0x7150('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x7150('0xa')]=_['defaults'](config['redis'],{'host':_0x7150('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x7150('0xc'))[_0x7150('0xd')](socket);function respondWithRpcPromise(_0x460b13,_0x29b015,_0x31d2af){return new BPromise(function(_0x505ccc,_0x4dcdce){return client[_0x7150('0xe')](_0x460b13,_0x31d2af)[_0x7150('0xf')](function(_0x5e67ad){logger[_0x7150('0x10')]('WhatsappAccount,\x20%s,\x20%s',_0x29b015,_0x7150('0x11'));logger[_0x7150('0x12')](_0x7150('0x13'),_0x29b015,_0x7150('0x11'),JSON[_0x7150('0x14')](_0x5e67ad));if(_0x5e67ad[_0x7150('0x15')]){if(_0x5e67ad['error'][_0x7150('0x16')]===0x1f4){logger[_0x7150('0x15')](_0x7150('0x17'),_0x29b015,_0x5e67ad['error'][_0x7150('0x18')]);return _0x4dcdce(_0x5e67ad[_0x7150('0x15')][_0x7150('0x18')]);}logger['error'](_0x7150('0x17'),_0x29b015,_0x5e67ad['error'][_0x7150('0x18')]);return _0x505ccc(_0x5e67ad[_0x7150('0x15')][_0x7150('0x18')]);}else{logger[_0x7150('0x10')](_0x7150('0x17'),_0x29b015,_0x7150('0x11'));_0x505ccc(_0x5e67ad[_0x7150('0x19')][_0x7150('0x18')]);}})['catch'](function(_0x316a3a){logger['error'](_0x7150('0x17'),_0x29b015,_0x316a3a);_0x4dcdce(_0x316a3a);});});}exports[_0x7150('0x1a')]=function(_0x51ce96){var _0xe879ae=this;return new Promise(function(_0x5e3a45,_0x1b8284){return db['WhatsappAccount'][_0x7150('0x1b')]({'raw':_0x51ce96[_0x7150('0x1c')]?_0x51ce96[_0x7150('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x51ce96[_0x7150('0x1c')]?_0x51ce96['options']['where']||null:null,'attributes':_0x51ce96[_0x7150('0x1c')]?_0x51ce96['options']['attributes']||null:null,'include':_0x51ce96['options']?_0x51ce96[_0x7150('0x1c')]['include']?_[_0x7150('0x1d')](_0x51ce96[_0x7150('0x1c')][_0x7150('0x1e')],function(_0xd5d455){return{'model':db[_0xd5d455[_0x7150('0x1f')]],'as':_0xd5d455['as'],'attributes':_0xd5d455[_0x7150('0x20')],'include':_0xd5d455[_0x7150('0x1e')]?_['map'](_0xd5d455['include'],function(_0x23f53b){return{'model':db[_0x23f53b[_0x7150('0x1f')]],'as':_0x23f53b['as'],'attributes':_0x23f53b[_0x7150('0x20')],'include':_0x23f53b[_0x7150('0x1e')]?_['map'](_0x23f53b[_0x7150('0x1e')],function(_0x59d032){return{'model':db[_0x59d032[_0x7150('0x1f')]],'as':_0x59d032['as'],'attributes':_0x59d032[_0x7150('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x35292a){logger['info'](_0x7150('0x1a'),_0x51ce96);logger[_0x7150('0x12')](_0x7150('0x1a'),_0x51ce96,JSON[_0x7150('0x14')](_0x35292a));_0x5e3a45(_0x35292a);})[_0x7150('0x21')](function(_0x7302d6){logger['error'](_0x7150('0x1a'),_0x7302d6['message'],_0x51ce96);_0x1b8284(_0xe879ae[_0x7150('0x15')](0x1f4,_0x7302d6[_0x7150('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 8951c29..f22a048 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 _0x7cd9=['update','removeListener','register','length','remove'];(function(_0x470b24,_0x58a01e){var _0xde9b3d=function(_0x445f8c){while(--_0x445f8c){_0x470b24['push'](_0x470b24['shift']());}};_0xde9b3d(++_0x58a01e);}(_0x7cd9,0x7c));var _0x97cd=function(_0x1cefa3,_0x40aed0){_0x1cefa3=_0x1cefa3-0x0;var _0x45ab2e=_0x7cd9[_0x1cefa3];return _0x45ab2e;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=['save',_0x97cd('0x0'),_0x97cd('0x1')];function createListener(_0x2e335d,_0x3b00ce){return function(_0x3461f7){_0x3b00ce['emit'](_0x2e335d,_0x3461f7);};}function removeListener(_0x458503,_0x135f60){return function(){WhatsappAccountEvents[_0x97cd('0x2')](_0x458503,_0x135f60);};}exports[_0x97cd('0x3')]=function(_0xf98e13){for(var _0x120f24=0x0,_0x343568=events[_0x97cd('0x4')];_0x120f24<_0x343568;_0x120f24++){var _0x285d5d=events[_0x120f24];var _0x4e484b=createListener('whatsappAccount:'+_0x285d5d,_0xf98e13);WhatsappAccountEvents['on'](_0x285d5d,_0x4e484b);}}; \ No newline at end of file +var _0x1260=['removeListener','register','length','whatsappAccount:','./whatsappAccount.events','save','remove','emit'];(function(_0x566bdf,_0x1f4861){var _0x331215=function(_0x524d0d){while(--_0x524d0d){_0x566bdf['push'](_0x566bdf['shift']());}};_0x331215(++_0x1f4861);}(_0x1260,0x1dc));var _0x0126=function(_0x1a2d49,_0x19d780){_0x1a2d49=_0x1a2d49-0x0;var _0x3e34a0=_0x1260[_0x1a2d49];return _0x3e34a0;};'use strict';var WhatsappAccountEvents=require(_0x0126('0x0'));var events=[_0x0126('0x1'),_0x0126('0x2'),'update'];function createListener(_0x104fe9,_0x1bee86){return function(_0x41a9b7){_0x1bee86[_0x0126('0x3')](_0x104fe9,_0x41a9b7);};}function removeListener(_0x3a9fca,_0x267761){return function(){WhatsappAccountEvents[_0x0126('0x4')](_0x3a9fca,_0x267761);};}exports[_0x0126('0x5')]=function(_0x3e87bb){for(var _0x51c5f5=0x0,_0x1f03fd=events[_0x0126('0x6')];_0x51c5f5<_0x1f03fd;_0x51c5f5++){var _0x2a47b4=events[_0x51c5f5];var _0x36831f=createListener(_0x0126('0x7')+_0x2a47b4,_0x3e87bb);WhatsappAccountEvents['on'](_0x2a47b4,_0x36831f);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 1a81998..0990b40 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 _0x4bd7=['../../components/auth/service','../../components/interaction/service','./whatsappApplication.controller','get','isAuthenticated','/:id','show','create','put','update','delete','destroy','exports','util','connect-timeout','express','Router'];(function(_0x4191bc,_0x3096c5){var _0x1ffd4e=function(_0x36faed){while(--_0x36faed){_0x4191bc['push'](_0x4191bc['shift']());}};_0x1ffd4e(++_0x3096c5);}(_0x4bd7,0xd9));var _0x74bd=function(_0x2db59f,_0x236c36){_0x2db59f=_0x2db59f-0x0;var _0x8e74b8=_0x4bd7[_0x2db59f];return _0x8e74b8;};'use strict';var multer=require('multer');var util=require(_0x74bd('0x0'));var path=require('path');var timeout=require(_0x74bd('0x1'));var express=require(_0x74bd('0x2'));var router=express[_0x74bd('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x74bd('0x4'));var interaction=require(_0x74bd('0x5'));var config=require('../../config/environment');var controller=require(_0x74bd('0x6'));router[_0x74bd('0x7')]('/',auth[_0x74bd('0x8')](),controller['index']);router[_0x74bd('0x7')](_0x74bd('0x9'),auth['isAuthenticated'](),controller[_0x74bd('0xa')]);router['post']('/',auth[_0x74bd('0x8')](),controller[_0x74bd('0xb')]);router[_0x74bd('0xc')](_0x74bd('0x9'),auth[_0x74bd('0x8')](),controller[_0x74bd('0xd')]);router[_0x74bd('0xe')]('/:id',auth[_0x74bd('0x8')](),controller[_0x74bd('0xf')]);module[_0x74bd('0x10')]=router; \ No newline at end of file +var _0x3359=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','index','/:id','show','post','isAuthenticated','create','put','update','delete','destroy','exports','util','path','connect-timeout'];(function(_0x46e0e0,_0x55b8e8){var _0x5efbcc=function(_0x135ac8){while(--_0x135ac8){_0x46e0e0['push'](_0x46e0e0['shift']());}};_0x5efbcc(++_0x55b8e8);}(_0x3359,0xf9));var _0x9335=function(_0x58dc50,_0x2af0b7){_0x58dc50=_0x58dc50-0x0;var _0x1fda34=_0x3359[_0x58dc50];return _0x1fda34;};'use strict';var multer=require('multer');var util=require(_0x9335('0x0'));var path=require(_0x9335('0x1'));var timeout=require(_0x9335('0x2'));var express=require(_0x9335('0x3'));var router=express['Router']();var fs_extra=require(_0x9335('0x4'));var auth=require(_0x9335('0x5'));var interaction=require(_0x9335('0x6'));var config=require(_0x9335('0x7'));var controller=require(_0x9335('0x8'));router[_0x9335('0x9')]('/',auth['isAuthenticated'](),controller[_0x9335('0xa')]);router[_0x9335('0x9')](_0x9335('0xb'),auth['isAuthenticated'](),controller[_0x9335('0xc')]);router[_0x9335('0xd')]('/',auth[_0x9335('0xe')](),controller[_0x9335('0xf')]);router[_0x9335('0x10')](_0x9335('0xb'),auth[_0x9335('0xe')](),controller[_0x9335('0x11')]);router[_0x9335('0x12')](_0x9335('0xb'),auth[_0x9335('0xe')](),controller[_0x9335('0x13')]);module[_0x9335('0x14')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 41a5e1c..28df67d 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 _0x78b7=['TEXT','STRING','*,*,*,*','sequelize','exports','INTEGER','noop'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x78b7,0x14c));var _0x778b=function(_0x243e52,_0x1915d9){_0x243e52=_0x243e52-0x0;var _0x1d42ab=_0x78b7[_0x243e52];return _0x1d42ab;};'use strict';var Sequelize=require(_0x778b('0x0'));module[_0x778b('0x1')]={'priority':{'type':Sequelize[_0x778b('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x778b('0x3')},'appdata':{'type':Sequelize[_0x778b('0x4')]()},'description':{'type':Sequelize[_0x778b('0x5')]},'interval':{'type':Sequelize[_0x778b('0x5')],'defaultValue':_0x778b('0x6')}}; \ No newline at end of file +var _0x79ba=['sequelize','exports','INTEGER','STRING','*,*,*,*'];(function(_0x59945a,_0x57fecd){var _0x2864e5=function(_0x179a37){while(--_0x179a37){_0x59945a['push'](_0x59945a['shift']());}};_0x2864e5(++_0x57fecd);}(_0x79ba,0x87));var _0xa79b=function(_0x158f01,_0x12af3e){_0x158f01=_0x158f01-0x0;var _0x5ef74e=_0x79ba[_0x158f01];return _0x5ef74e;};'use strict';var Sequelize=require(_0xa79b('0x0'));module[_0xa79b('0x1')]={'priority':{'type':Sequelize[_0xa79b('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xa79b('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xa79b('0x3')]},'interval':{'type':Sequelize[_0xa79b('0x3')],'defaultValue':_0xa79b('0x4')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 78ca7a9..269e8e3 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 _0xfa94=['order','sort','where','pick','filter','merge','rows','show','params','length','includeAll','include','options','find','catch','create','body','eml-format','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','destroy','end','error','stack','name','send','index','map','WhatsappApplication','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit'];(function(_0x5ea417,_0x309035){var _0x4e9bce=function(_0x2151a7){while(--_0x2151a7){_0x5ea417['push'](_0x5ea417['shift']());}};_0x4e9bce(++_0x309035);}(_0xfa94,0xef));var _0x4fa9=function(_0x398d85,_0x2465d7){_0x398d85=_0x398d85-0x0;var _0x33c2bb=_0xfa94[_0x398d85];return _0x33c2bb;};'use strict';var emlformat=require(_0x4fa9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4fa9('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4fa9('0x2'));var moment=require(_0x4fa9('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x4fa9('0x4'));var util=require(_0x4fa9('0x5'));var path=require(_0x4fa9('0x6'));var sox=require(_0x4fa9('0x7'));var csv=require(_0x4fa9('0x8'));var ejs=require(_0x4fa9('0x9'));var fs=require('fs');var fs_extra=require(_0x4fa9('0xa'));var _=require('lodash');var squel=require(_0x4fa9('0xb'));var crypto=require(_0x4fa9('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4fa9('0x8'));var querystring=require('querystring');var Papa=require(_0x4fa9('0xd'));var Redis=require(_0x4fa9('0xe'));var authService=require(_0x4fa9('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x4fa9('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4fa9('0x11'))(_0x4fa9('0x12'));var utils=require('../../config/utils');var config=require(_0x4fa9('0x13'));var licenseUtil=require(_0x4fa9('0x14'));var db=require(_0x4fa9('0x15'))['db'];function respondWithStatusCode(_0x57df6a,_0x85f1e5){_0x85f1e5=_0x85f1e5||0xcc;return function(_0x54d8c5){if(_0x54d8c5){return _0x57df6a[_0x4fa9('0x16')](_0x85f1e5);}return _0x57df6a[_0x4fa9('0x17')](_0x85f1e5)['end']();};}function respondWithResult(_0x47953e,_0x4279c0){_0x4279c0=_0x4279c0||0xc8;return function(_0x43b71d){if(_0x43b71d){return _0x47953e[_0x4fa9('0x17')](_0x4279c0)[_0x4fa9('0x18')](_0x43b71d);}};}function respondWithFilteredResult(_0x36af3a,_0x438850){return function(_0x2c28be){if(_0x2c28be){var _0x328770=typeof _0x438850['offset']===_0x4fa9('0x19')&&typeof _0x438850[_0x4fa9('0x1a')]==='undefined';var _0x56cf7d=_0x2c28be[_0x4fa9('0x1b')];var _0x4f58bd=_0x328770?0x0:_0x438850[_0x4fa9('0x1c')];var _0x416e08=_0x328770?_0x2c28be['count']:_0x438850[_0x4fa9('0x1c')]+_0x438850['limit'];var _0x3f8036;if(_0x416e08>=_0x56cf7d){_0x416e08=_0x56cf7d;_0x3f8036=0xc8;}else{_0x3f8036=0xce;}_0x36af3a[_0x4fa9('0x17')](_0x3f8036);return _0x36af3a[_0x4fa9('0x1d')](_0x4fa9('0x1e'),_0x4f58bd+'-'+_0x416e08+'/'+_0x56cf7d)[_0x4fa9('0x18')](_0x2c28be);}return null;};}function patchUpdates(_0x5e2576){return function(_0x2e5142){try{jsonpatch[_0x4fa9('0x1f')](_0x2e5142,_0x5e2576,!![]);}catch(_0xa43250){return BPromise['reject'](_0xa43250);}return _0x2e5142[_0x4fa9('0x20')]();};}function saveUpdates(_0x1544b1,_0x31333c){return function(_0x475624){if(_0x475624){return _0x475624[_0x4fa9('0x21')](_0x1544b1)[_0x4fa9('0x22')](function(_0x360262){return _0x360262;});}return null;};}function removeEntity(_0x261db9,_0x185806){return function(_0x1189c6){if(_0x1189c6){return _0x1189c6[_0x4fa9('0x23')]()[_0x4fa9('0x22')](function(){_0x261db9[_0x4fa9('0x17')](0xcc)[_0x4fa9('0x24')]();});}};}function handleEntityNotFound(_0x1d00c9,_0x244c95){return function(_0x1bac66){if(!_0x1bac66){_0x1d00c9[_0x4fa9('0x16')](0x194);}return _0x1bac66;};}function handleError(_0x1fe8ba,_0x31a3fb){_0x31a3fb=_0x31a3fb||0x1f4;return function(_0x498a6f){logger[_0x4fa9('0x25')](_0x498a6f[_0x4fa9('0x26')]);if(_0x498a6f[_0x4fa9('0x27')]){delete _0x498a6f[_0x4fa9('0x27')];}_0x1fe8ba[_0x4fa9('0x17')](_0x31a3fb)[_0x4fa9('0x28')](_0x498a6f);};}exports[_0x4fa9('0x29')]=function(_0x5545b9,_0x384d4e){var _0x1185df={},_0x13cf76={},_0x383d27={'count':0x0,'rows':[]};var _0x112673=_[_0x4fa9('0x2a')](db[_0x4fa9('0x2b')][_0x4fa9('0x2c')],function(_0xa9932f){return{'name':_0xa9932f[_0x4fa9('0x2d')],'type':_0xa9932f[_0x4fa9('0x2e')][_0x4fa9('0x2f')]};});_0x13cf76[_0x4fa9('0x30')]=_[_0x4fa9('0x2a')](_0x112673,_0x4fa9('0x27'));_0x13cf76[_0x4fa9('0x31')]=_[_0x4fa9('0x32')](_0x5545b9['query']);_0x13cf76[_0x4fa9('0x33')]=_[_0x4fa9('0x34')](_0x13cf76[_0x4fa9('0x30')],_0x13cf76[_0x4fa9('0x31')]);_0x1185df[_0x4fa9('0x35')]=_[_0x4fa9('0x34')](_0x13cf76['model'],qs[_0x4fa9('0x36')](_0x5545b9[_0x4fa9('0x31')][_0x4fa9('0x36')]));_0x1185df['attributes']=_0x1185df[_0x4fa9('0x35')]['length']?_0x1185df['attributes']:_0x13cf76[_0x4fa9('0x30')];if(!_0x5545b9['query'][_0x4fa9('0x37')](_0x4fa9('0x38'))){_0x1185df[_0x4fa9('0x1a')]=qs[_0x4fa9('0x1a')](_0x5545b9['query'][_0x4fa9('0x1a')]);_0x1185df[_0x4fa9('0x1c')]=qs[_0x4fa9('0x1c')](_0x5545b9['query'][_0x4fa9('0x1c')]);}_0x1185df[_0x4fa9('0x39')]=qs[_0x4fa9('0x3a')](_0x5545b9[_0x4fa9('0x31')][_0x4fa9('0x3a')]);_0x1185df[_0x4fa9('0x3b')]=qs[_0x4fa9('0x33')](_[_0x4fa9('0x3c')](_0x5545b9[_0x4fa9('0x31')],_0x13cf76[_0x4fa9('0x33')]),_0x112673);if(_0x5545b9[_0x4fa9('0x31')][_0x4fa9('0x3d')]){_0x1185df['where']=_[_0x4fa9('0x3e')](_0x1185df['where'],{'$or':_['map'](_0x112673,function(_0x21578d){if(_0x21578d['type']!=='VIRTUAL'){var _0x4b05a6={};_0x4b05a6[_0x21578d[_0x4fa9('0x27')]]={'$like':'%'+_0x5545b9[_0x4fa9('0x31')]['filter']+'%'};return _0x4b05a6;}})});}_0x1185df=_[_0x4fa9('0x3e')]({},_0x1185df,_0x5545b9['options']);var _0x493c4f={'where':_0x1185df[_0x4fa9('0x3b')]};return db[_0x4fa9('0x2b')][_0x4fa9('0x1b')](_0x493c4f)[_0x4fa9('0x22')](function(_0x167112){_0x383d27[_0x4fa9('0x1b')]=_0x167112;if(_0x5545b9[_0x4fa9('0x31')]['includeAll']){_0x1185df['include']=[{'all':!![]}];}return db[_0x4fa9('0x2b')]['findAll'](_0x1185df);})[_0x4fa9('0x22')](function(_0x19fe0f){_0x383d27[_0x4fa9('0x3f')]=_0x19fe0f;return _0x383d27;})[_0x4fa9('0x22')](respondWithFilteredResult(_0x384d4e,_0x1185df))['catch'](handleError(_0x384d4e,null));};exports[_0x4fa9('0x40')]=function(_0x51e105,_0xd28126){var _0x2c39bf={'raw':!![],'where':{'id':_0x51e105[_0x4fa9('0x41')]['id']}},_0x14eb12={};_0x14eb12[_0x4fa9('0x30')]=_[_0x4fa9('0x32')](db[_0x4fa9('0x2b')][_0x4fa9('0x2c')]);_0x14eb12['query']=_[_0x4fa9('0x32')](_0x51e105[_0x4fa9('0x31')]);_0x14eb12[_0x4fa9('0x33')]=_['intersection'](_0x14eb12[_0x4fa9('0x30')],_0x14eb12[_0x4fa9('0x31')]);_0x2c39bf[_0x4fa9('0x35')]=_[_0x4fa9('0x34')](_0x14eb12[_0x4fa9('0x30')],qs[_0x4fa9('0x36')](_0x51e105[_0x4fa9('0x31')][_0x4fa9('0x36')]));_0x2c39bf[_0x4fa9('0x35')]=_0x2c39bf[_0x4fa9('0x35')][_0x4fa9('0x42')]?_0x2c39bf[_0x4fa9('0x35')]:_0x14eb12['model'];if(_0x51e105[_0x4fa9('0x31')][_0x4fa9('0x43')]){_0x2c39bf[_0x4fa9('0x44')]=[{'all':!![]}];}_0x2c39bf=_[_0x4fa9('0x3e')]({},_0x2c39bf,_0x51e105[_0x4fa9('0x45')]);return db[_0x4fa9('0x2b')][_0x4fa9('0x46')](_0x2c39bf)[_0x4fa9('0x22')](handleEntityNotFound(_0xd28126,null))[_0x4fa9('0x22')](respondWithResult(_0xd28126,null))[_0x4fa9('0x47')](handleError(_0xd28126,null));};exports[_0x4fa9('0x48')]=function(_0x5d3b12,_0x5d838c){return db[_0x4fa9('0x2b')]['create'](_0x5d3b12[_0x4fa9('0x49')],{})[_0x4fa9('0x22')](respondWithResult(_0x5d838c,0xc9))[_0x4fa9('0x47')](handleError(_0x5d838c,null));};exports[_0x4fa9('0x21')]=function(_0x306096,_0x12e735){if(_0x306096['body']['id']){delete _0x306096['body']['id'];}return db['WhatsappApplication'][_0x4fa9('0x46')]({'where':{'id':_0x306096['params']['id']}})[_0x4fa9('0x22')](handleEntityNotFound(_0x12e735,null))[_0x4fa9('0x22')](saveUpdates(_0x306096[_0x4fa9('0x49')],null))[_0x4fa9('0x22')](respondWithResult(_0x12e735,null))['catch'](handleError(_0x12e735,null));};exports[_0x4fa9('0x23')]=function(_0x463bd4,_0x5cd8d1){return db[_0x4fa9('0x2b')][_0x4fa9('0x46')]({'where':{'id':_0x463bd4[_0x4fa9('0x41')]['id']}})[_0x4fa9('0x22')](handleEntityNotFound(_0x5cd8d1,null))[_0x4fa9('0x22')](removeEntity(_0x5cd8d1,null))[_0x4fa9('0x47')](handleError(_0x5cd8d1,null));}; \ No newline at end of file +var _0x2faf=['key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','sort','where','filters','filter','merge','options','then','includeAll','include','findAll','rows','catch','params','rawAttributes','create','update','body','destroy','find','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','limit','undefined','count','offset','set','Content-Range','json','reject','error','stack','name','send','map','WhatsappApplication','fieldName','type'];(function(_0x3f28a6,_0x3f045e){var _0x4a999d=function(_0x3d3ed7){while(--_0x3d3ed7){_0x3f28a6['push'](_0x3f28a6['shift']());}};_0x4a999d(++_0x3f045e);}(_0x2faf,0xb0));var _0xf2fa=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x2faf[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0xf2fa('0x0'));var rimraf=require(_0xf2fa('0x1'));var zipdir=require(_0xf2fa('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf2fa('0x3'));var moment=require(_0xf2fa('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf2fa('0x5'));var util=require(_0xf2fa('0x6'));var path=require(_0xf2fa('0x7'));var sox=require(_0xf2fa('0x8'));var csv=require(_0xf2fa('0x9'));var ejs=require(_0xf2fa('0xa'));var fs=require('fs');var fs_extra=require(_0xf2fa('0xb'));var _=require('lodash');var squel=require(_0xf2fa('0xc'));var crypto=require(_0xf2fa('0xd'));var jsforce=require(_0xf2fa('0xe'));var deskjs=require(_0xf2fa('0xf'));var toCsv=require('to-csv');var querystring=require(_0xf2fa('0x10'));var Papa=require('papaparse');var Redis=require(_0xf2fa('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xf2fa('0x12'));var as=require(_0xf2fa('0x13'));var hardwareService=require(_0xf2fa('0x14'));var logger=require(_0xf2fa('0x15'))(_0xf2fa('0x16'));var utils=require(_0xf2fa('0x17'));var config=require(_0xf2fa('0x18'));var licenseUtil=require(_0xf2fa('0x19'));var db=require(_0xf2fa('0x1a'))['db'];function respondWithStatusCode(_0x15a15f,_0x4fe6e9){_0x4fe6e9=_0x4fe6e9||0xcc;return function(_0x2dabbb){if(_0x2dabbb){return _0x15a15f[_0xf2fa('0x1b')](_0x4fe6e9);}return _0x15a15f[_0xf2fa('0x1c')](_0x4fe6e9)[_0xf2fa('0x1d')]();};}function respondWithResult(_0x13ca94,_0x416ca6){_0x416ca6=_0x416ca6||0xc8;return function(_0x30a8b1){if(_0x30a8b1){return _0x13ca94[_0xf2fa('0x1c')](_0x416ca6)['json'](_0x30a8b1);}};}function respondWithFilteredResult(_0x2d8fc2,_0x4fea4a){return function(_0x2aa797){if(_0x2aa797){var _0x9e3bc8=typeof _0x4fea4a['offset']==='undefined'&&typeof _0x4fea4a[_0xf2fa('0x1e')]===_0xf2fa('0x1f');var _0xd9c050=_0x2aa797[_0xf2fa('0x20')];var _0x2b8f69=_0x9e3bc8?0x0:_0x4fea4a[_0xf2fa('0x21')];var _0x551b3d=_0x9e3bc8?_0x2aa797[_0xf2fa('0x20')]:_0x4fea4a[_0xf2fa('0x21')]+_0x4fea4a[_0xf2fa('0x1e')];var _0x57bca1;if(_0x551b3d>=_0xd9c050){_0x551b3d=_0xd9c050;_0x57bca1=0xc8;}else{_0x57bca1=0xce;}_0x2d8fc2[_0xf2fa('0x1c')](_0x57bca1);return _0x2d8fc2[_0xf2fa('0x22')](_0xf2fa('0x23'),_0x2b8f69+'-'+_0x551b3d+'/'+_0xd9c050)[_0xf2fa('0x24')](_0x2aa797);}return null;};}function patchUpdates(_0x25f5d3){return function(_0x536a2d){try{jsonpatch['apply'](_0x536a2d,_0x25f5d3,!![]);}catch(_0x568448){return BPromise[_0xf2fa('0x25')](_0x568448);}return _0x536a2d['save']();};}function saveUpdates(_0x2ddb2c,_0x4034ab){return function(_0x599c7b){if(_0x599c7b){return _0x599c7b['update'](_0x2ddb2c)['then'](function(_0x453c9d){return _0x453c9d;});}return null;};}function removeEntity(_0x17a54f,_0x2b753e){return function(_0x2e809d){if(_0x2e809d){return _0x2e809d['destroy']()['then'](function(){_0x17a54f[_0xf2fa('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x557631,_0x4ab17d){return function(_0x319b68){if(!_0x319b68){_0x557631['sendStatus'](0x194);}return _0x319b68;};}function handleError(_0x5ba4dd,_0xb18557){_0xb18557=_0xb18557||0x1f4;return function(_0x5553fa){logger[_0xf2fa('0x26')](_0x5553fa[_0xf2fa('0x27')]);if(_0x5553fa[_0xf2fa('0x28')]){delete _0x5553fa['name'];}_0x5ba4dd['status'](_0xb18557)[_0xf2fa('0x29')](_0x5553fa);};}exports['index']=function(_0x1b8532,_0xd4a340){var _0x18fefb={},_0x3e631d={},_0x50ead8={'count':0x0,'rows':[]};var _0x19a4ad=_[_0xf2fa('0x2a')](db[_0xf2fa('0x2b')]['rawAttributes'],function(_0xd01492){return{'name':_0xd01492[_0xf2fa('0x2c')],'type':_0xd01492[_0xf2fa('0x2d')][_0xf2fa('0x2e')]};});_0x3e631d[_0xf2fa('0x2f')]=_[_0xf2fa('0x2a')](_0x19a4ad,_0xf2fa('0x28'));_0x3e631d[_0xf2fa('0x30')]=_[_0xf2fa('0x31')](_0x1b8532[_0xf2fa('0x30')]);_0x3e631d['filters']=_['intersection'](_0x3e631d[_0xf2fa('0x2f')],_0x3e631d[_0xf2fa('0x30')]);_0x18fefb[_0xf2fa('0x32')]=_[_0xf2fa('0x33')](_0x3e631d[_0xf2fa('0x2f')],qs['fields'](_0x1b8532['query'][_0xf2fa('0x34')]));_0x18fefb[_0xf2fa('0x32')]=_0x18fefb[_0xf2fa('0x32')][_0xf2fa('0x35')]?_0x18fefb[_0xf2fa('0x32')]:_0x3e631d[_0xf2fa('0x2f')];if(!_0x1b8532['query'][_0xf2fa('0x36')]('nolimit')){_0x18fefb[_0xf2fa('0x1e')]=qs[_0xf2fa('0x1e')](_0x1b8532[_0xf2fa('0x30')][_0xf2fa('0x1e')]);_0x18fefb[_0xf2fa('0x21')]=qs[_0xf2fa('0x21')](_0x1b8532[_0xf2fa('0x30')][_0xf2fa('0x21')]);}_0x18fefb['order']=qs[_0xf2fa('0x37')](_0x1b8532['query'][_0xf2fa('0x37')]);_0x18fefb[_0xf2fa('0x38')]=qs[_0xf2fa('0x39')](_['pick'](_0x1b8532['query'],_0x3e631d[_0xf2fa('0x39')]),_0x19a4ad);if(_0x1b8532['query'][_0xf2fa('0x3a')]){_0x18fefb[_0xf2fa('0x38')]=_[_0xf2fa('0x3b')](_0x18fefb[_0xf2fa('0x38')],{'$or':_[_0xf2fa('0x2a')](_0x19a4ad,function(_0x8ab728){if(_0x8ab728[_0xf2fa('0x2d')]!=='VIRTUAL'){var _0x5a324e={};_0x5a324e[_0x8ab728['name']]={'$like':'%'+_0x1b8532[_0xf2fa('0x30')][_0xf2fa('0x3a')]+'%'};return _0x5a324e;}})});}_0x18fefb=_[_0xf2fa('0x3b')]({},_0x18fefb,_0x1b8532[_0xf2fa('0x3c')]);var _0x178f84={'where':_0x18fefb[_0xf2fa('0x38')]};return db[_0xf2fa('0x2b')][_0xf2fa('0x20')](_0x178f84)[_0xf2fa('0x3d')](function(_0x166668){_0x50ead8[_0xf2fa('0x20')]=_0x166668;if(_0x1b8532[_0xf2fa('0x30')][_0xf2fa('0x3e')]){_0x18fefb[_0xf2fa('0x3f')]=[{'all':!![]}];}return db[_0xf2fa('0x2b')][_0xf2fa('0x40')](_0x18fefb);})['then'](function(_0x4dc672){_0x50ead8[_0xf2fa('0x41')]=_0x4dc672;return _0x50ead8;})['then'](respondWithFilteredResult(_0xd4a340,_0x18fefb))[_0xf2fa('0x42')](handleError(_0xd4a340,null));};exports['show']=function(_0x38aed5,_0x1005f4){var _0x110902={'raw':!![],'where':{'id':_0x38aed5[_0xf2fa('0x43')]['id']}},_0x44c14d={};_0x44c14d[_0xf2fa('0x2f')]=_['keys'](db['WhatsappApplication'][_0xf2fa('0x44')]);_0x44c14d[_0xf2fa('0x30')]=_[_0xf2fa('0x31')](_0x38aed5[_0xf2fa('0x30')]);_0x44c14d['filters']=_[_0xf2fa('0x33')](_0x44c14d[_0xf2fa('0x2f')],_0x44c14d[_0xf2fa('0x30')]);_0x110902['attributes']=_[_0xf2fa('0x33')](_0x44c14d['model'],qs[_0xf2fa('0x34')](_0x38aed5[_0xf2fa('0x30')][_0xf2fa('0x34')]));_0x110902[_0xf2fa('0x32')]=_0x110902[_0xf2fa('0x32')][_0xf2fa('0x35')]?_0x110902[_0xf2fa('0x32')]:_0x44c14d[_0xf2fa('0x2f')];if(_0x38aed5[_0xf2fa('0x30')][_0xf2fa('0x3e')]){_0x110902[_0xf2fa('0x3f')]=[{'all':!![]}];}_0x110902=_[_0xf2fa('0x3b')]({},_0x110902,_0x38aed5['options']);return db['WhatsappApplication']['find'](_0x110902)[_0xf2fa('0x3d')](handleEntityNotFound(_0x1005f4,null))[_0xf2fa('0x3d')](respondWithResult(_0x1005f4,null))['catch'](handleError(_0x1005f4,null));};exports[_0xf2fa('0x45')]=function(_0x158d43,_0x3769cf){return db[_0xf2fa('0x2b')]['create'](_0x158d43['body'],{})[_0xf2fa('0x3d')](respondWithResult(_0x3769cf,0xc9))['catch'](handleError(_0x3769cf,null));};exports[_0xf2fa('0x46')]=function(_0x534c5f,_0x5b62a3){if(_0x534c5f['body']['id']){delete _0x534c5f[_0xf2fa('0x47')]['id'];}return db[_0xf2fa('0x2b')]['find']({'where':{'id':_0x534c5f['params']['id']}})[_0xf2fa('0x3d')](handleEntityNotFound(_0x5b62a3,null))['then'](saveUpdates(_0x534c5f[_0xf2fa('0x47')],null))[_0xf2fa('0x3d')](respondWithResult(_0x5b62a3,null))[_0xf2fa('0x42')](handleError(_0x5b62a3,null));};exports[_0xf2fa('0x48')]=function(_0x30a57b,_0x3366df){return db[_0xf2fa('0x2b')][_0xf2fa('0x49')]({'where':{'id':_0x30a57b[_0xf2fa('0x43')]['id']}})[_0xf2fa('0x3d')](handleEntityNotFound(_0x3366df,null))[_0xf2fa('0x3d')](removeEntity(_0x3366df,null))[_0xf2fa('0x42')](handleError(_0x3366df,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 8d219bb..b88c17a 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 _0xb903=['api','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappApplication.attributes','exports','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x500785,_0x15e5ff){var _0x1f8bcc=function(_0x406983){while(--_0x406983){_0x500785['push'](_0x500785['shift']());}};_0x1f8bcc(++_0x15e5ff);}(_0xb903,0x185));var _0x3b90=function(_0x1a70fa,_0x4d1bc1){_0x1a70fa=_0x1a70fa-0x0;var _0x5d1257=_0xb903[_0x1a70fa];return _0x5d1257;};'use strict';var _=require(_0x3b90('0x0'));var util=require(_0x3b90('0x1'));var logger=require(_0x3b90('0x2'))(_0x3b90('0x3'));var moment=require('moment');var BPromise=require(_0x3b90('0x4'));var rp=require(_0x3b90('0x5'));var fs=require('fs');var path=require(_0x3b90('0x6'));var rimraf=require(_0x3b90('0x7'));var config=require(_0x3b90('0x8'));var attributes=require(_0x3b90('0x9'));module[_0x3b90('0xa')]=function(_0x5acd76,_0x15b68f){return _0x5acd76['define']('WhatsappApplication',attributes,{'tableName':_0x3b90('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3b90('0xc'),'collate':_0x3b90('0xd')});}; \ No newline at end of file +var _0x79d3=['WhatsappApplication','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./whatsappApplication.attributes','exports'];(function(_0x54d4a8,_0x585a59){var _0x3b321b=function(_0x245c6a){while(--_0x245c6a){_0x54d4a8['push'](_0x54d4a8['shift']());}};_0x3b321b(++_0x585a59);}(_0x79d3,0x15f));var _0x379d=function(_0x152678,_0x11e0ac){_0x152678=_0x152678-0x0;var _0x311a9=_0x79d3[_0x152678];return _0x311a9;};'use strict';var _=require(_0x379d('0x0'));var util=require('util');var logger=require(_0x379d('0x1'))('api');var moment=require(_0x379d('0x2'));var BPromise=require(_0x379d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x379d('0x4'));var rimraf=require(_0x379d('0x5'));var config=require(_0x379d('0x6'));var attributes=require(_0x379d('0x7'));module[_0x379d('0x8')]=function(_0x2078a6,_0x2a1b43){return _0x2078a6['define'](_0x379d('0x9'),attributes,{'tableName':'whatsapp_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x379d('0xa'),'collate':_0x379d('0xb')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 9ba8a63..cb451b4 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 _0x70e0=['code','WhatsappApplication,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x47b858,_0x26f9d8){var _0x26ad0f=function(_0x4af27b){while(--_0x4af27b){_0x47b858['push'](_0x47b858['shift']());}};_0x26ad0f(++_0x26f9d8);}(_0x70e0,0x17b));var _0x070e=function(_0x42d188,_0x43f531){_0x42d188=_0x42d188-0x0;var _0x14a4af=_0x70e0[_0x42d188];return _0x14a4af;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x070e('0x3'));var db=require(_0x070e('0x4'))['db'];var utils=require(_0x070e('0x5'));var logger=require(_0x070e('0x6'))('rpc');var config=require(_0x070e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x070e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56e420,_0x5032e5,_0x35ab0c){return new BPromise(function(_0x1e11f0,_0x604664){return client[_0x070e('0x9')](_0x56e420,_0x35ab0c)[_0x070e('0xa')](function(_0x68a09e){logger[_0x070e('0xb')]('WhatsappApplication,\x20%s,\x20%s',_0x5032e5,'request\x20sent');logger[_0x070e('0xc')](_0x070e('0xd'),_0x5032e5,_0x070e('0xe'),JSON[_0x070e('0xf')](_0x68a09e));if(_0x68a09e[_0x070e('0x10')]){if(_0x68a09e[_0x070e('0x10')][_0x070e('0x11')]===0x1f4){logger[_0x070e('0x10')](_0x070e('0x12'),_0x5032e5,_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);return _0x604664(_0x68a09e['error']['message']);}logger[_0x070e('0x10')]('WhatsappApplication,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('WhatsappApplication,\x20%s,\x20%s',_0x5032e5,_0x070e('0xe'));_0x1e11f0(_0x68a09e[_0x070e('0x14')][_0x070e('0x13')]);}})[_0x070e('0x15')](function(_0x5bc71e){logger['error'](_0x070e('0x12'),_0x5032e5,_0x5bc71e);_0x604664(_0x5bc71e);});});} \ No newline at end of file +var _0xe5b3=['request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','WhatsappApplication,\x20%s,\x20%s'];(function(_0x3542dc,_0x1688a7){var _0x565444=function(_0x573905){while(--_0x573905){_0x3542dc['push'](_0x3542dc['shift']());}};_0x565444(++_0x1688a7);}(_0xe5b3,0x133));var _0x3e5b=function(_0x6dc1be,_0x22e567){_0x6dc1be=_0x6dc1be-0x0;var _0x2bcdcf=_0xe5b3[_0x6dc1be];return _0x2bcdcf;};'use strict';var _=require('lodash');var util=require(_0x3e5b('0x0'));var moment=require(_0x3e5b('0x1'));var BPromise=require(_0x3e5b('0x2'));var rs=require(_0x3e5b('0x3'));var fs=require('fs');var Redis=require(_0x3e5b('0x4'));var db=require(_0x3e5b('0x5'))['db'];var utils=require(_0x3e5b('0x6'));var logger=require(_0x3e5b('0x7'))(_0x3e5b('0x8'));var config=require(_0x3e5b('0x9'));var jayson=require(_0x3e5b('0xa'));var client=jayson['client'][_0x3e5b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5dcf55,_0x534e7d,_0x41d46f){return new BPromise(function(_0x3901c2,_0x3c7c2e){return client[_0x3e5b('0xc')](_0x5dcf55,_0x41d46f)['then'](function(_0x4ed6bc){logger[_0x3e5b('0xd')](_0x3e5b('0xe'),_0x534e7d,_0x3e5b('0xf'));logger[_0x3e5b('0x10')](_0x3e5b('0x11'),_0x534e7d,'request\x20sent',JSON[_0x3e5b('0x12')](_0x4ed6bc));if(_0x4ed6bc['error']){if(_0x4ed6bc[_0x3e5b('0x13')][_0x3e5b('0x14')]===0x1f4){logger[_0x3e5b('0x13')](_0x3e5b('0xe'),_0x534e7d,_0x4ed6bc[_0x3e5b('0x13')][_0x3e5b('0x15')]);return _0x3c7c2e(_0x4ed6bc[_0x3e5b('0x13')]['message']);}logger[_0x3e5b('0x13')]('WhatsappApplication,\x20%s,\x20%s',_0x534e7d,_0x4ed6bc['error']['message']);return _0x3901c2(_0x4ed6bc[_0x3e5b('0x13')][_0x3e5b('0x15')]);}else{logger[_0x3e5b('0xd')]('WhatsappApplication,\x20%s,\x20%s',_0x534e7d,_0x3e5b('0xf'));_0x3901c2(_0x4ed6bc['result']['message']);}})[_0x3e5b('0x16')](function(_0x11b41b){logger['error'](_0x3e5b('0xe'),_0x534e7d,_0x11b41b);_0x3c7c2e(_0x11b41b);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 672d923..3e655c1 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 _0xa46e=['get','index','isAuthenticated','describe','/:id','getMessages','/:id/download','download','create','/:id/messages','post','tracked','whatsapp','whatsappinteraction:addtags','addTags','put','whatsappinteraction:update','update','delete','/:id/tags','removeTags','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment'];(function(_0x3efcd5,_0x9bbba3){var _0x54e50a=function(_0x34d7f4){while(--_0x34d7f4){_0x3efcd5['push'](_0x3efcd5['shift']());}};_0x54e50a(++_0x9bbba3);}(_0xa46e,0x8a));var _0xea46=function(_0x18b344,_0x271f68){_0x18b344=_0x18b344-0x0;var _0x5ef6bb=_0xa46e[_0x18b344];return _0x5ef6bb;};'use strict';var multer=require(_0xea46('0x0'));var util=require(_0xea46('0x1'));var path=require('path');var timeout=require(_0xea46('0x2'));var express=require(_0xea46('0x3'));var router=express[_0xea46('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xea46('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xea46('0x6'));var controller=require('./whatsappInteraction.controller');router[_0xea46('0x7')]('/',auth['isAuthenticated'](),controller[_0xea46('0x8')]);router[_0xea46('0x7')]('/describe',auth[_0xea46('0x9')](),controller[_0xea46('0xa')]);router[_0xea46('0x7')](_0xea46('0xb'),auth[_0xea46('0x9')](),controller['show']);router['get']('/:id/messages',auth[_0xea46('0x9')](),controller[_0xea46('0xc')]);router['get'](_0xea46('0xd'),auth[_0xea46('0x9')](),controller[_0xea46('0xe')]);router['post']('/',auth[_0xea46('0x9')](),controller[_0xea46('0xf')]);router['post'](_0xea46('0x10'),auth[_0xea46('0x9')](),controller['addMessage']);router[_0xea46('0x11')]('/:id/tags',auth[_0xea46('0x9')](),interaction[_0xea46('0x12')](_0xea46('0x13'),_0xea46('0x14')),controller[_0xea46('0x15')]);router[_0xea46('0x16')](_0xea46('0xb'),auth[_0xea46('0x9')](),interaction[_0xea46('0x12')]('whatsapp',_0xea46('0x17')),controller[_0xea46('0x18')]);router[_0xea46('0x19')]('/:id',auth['isAuthenticated'](),interaction[_0xea46('0x12')](_0xea46('0x13'),'whatsappinteraction:destroy'),controller['destroy']);router[_0xea46('0x19')](_0xea46('0x1a'),auth['isAuthenticated'](),controller[_0xea46('0x1b')]);module[_0xea46('0x1c')]=router; \ No newline at end of file +var _0xeda8=['get','isAuthenticated','index','describe','/:id','getMessages','post','create','/:id/messages','addMessage','tracked','whatsapp','addTags','put','whatsappinteraction:update','delete','destroy','/:id/tags','removeTags','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller'];(function(_0x3da95c,_0x33a8cb){var _0x112db0=function(_0x2ac6f8){while(--_0x2ac6f8){_0x3da95c['push'](_0x3da95c['shift']());}};_0x112db0(++_0x33a8cb);}(_0xeda8,0x104));var _0x8eda=function(_0x7d04e6,_0x57731){_0x7d04e6=_0x7d04e6-0x0;var _0x5ac53b=_0xeda8[_0x7d04e6];return _0x5ac53b;};'use strict';var multer=require(_0x8eda('0x0'));var util=require(_0x8eda('0x1'));var path=require('path');var timeout=require(_0x8eda('0x2'));var express=require(_0x8eda('0x3'));var router=express[_0x8eda('0x4')]();var fs_extra=require(_0x8eda('0x5'));var auth=require(_0x8eda('0x6'));var interaction=require(_0x8eda('0x7'));var config=require(_0x8eda('0x8'));var controller=require(_0x8eda('0x9'));router[_0x8eda('0xa')]('/',auth[_0x8eda('0xb')](),controller[_0x8eda('0xc')]);router[_0x8eda('0xa')]('/describe',auth[_0x8eda('0xb')](),controller[_0x8eda('0xd')]);router[_0x8eda('0xa')](_0x8eda('0xe'),auth['isAuthenticated'](),controller['show']);router['get']('/:id/messages',auth[_0x8eda('0xb')](),controller[_0x8eda('0xf')]);router[_0x8eda('0xa')]('/:id/download',auth[_0x8eda('0xb')](),controller['download']);router[_0x8eda('0x10')]('/',auth[_0x8eda('0xb')](),controller[_0x8eda('0x11')]);router[_0x8eda('0x10')](_0x8eda('0x12'),auth[_0x8eda('0xb')](),controller[_0x8eda('0x13')]);router[_0x8eda('0x10')]('/:id/tags',auth['isAuthenticated'](),interaction[_0x8eda('0x14')](_0x8eda('0x15'),'whatsappinteraction:addtags'),controller[_0x8eda('0x16')]);router[_0x8eda('0x17')](_0x8eda('0xe'),auth['isAuthenticated'](),interaction[_0x8eda('0x14')]('whatsapp',_0x8eda('0x18')),controller['update']);router[_0x8eda('0x19')]('/:id',auth[_0x8eda('0xb')](),interaction[_0x8eda('0x14')]('whatsapp','whatsappinteraction:destroy'),controller[_0x8eda('0x1a')]);router[_0x8eda('0x19')](_0x8eda('0x1b'),auth[_0x8eda('0xb')](),controller[_0x8eda('0x1c')]);module[_0x8eda('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 c3ef2fa..dd7d900 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 _0xad9f=['exports','DATE','STRING','ENUM','out','BOOLEAN','sequelize','moment'];(function(_0x2fba6f,_0x46cea4){var _0x4731c9=function(_0x1c08ad){while(--_0x1c08ad){_0x2fba6f['push'](_0x2fba6f['shift']());}};_0x4731c9(++_0x46cea4);}(_0xad9f,0x1be));var _0xfad9=function(_0x235f8f,_0x20898a){_0x235f8f=_0x235f8f-0x0;var _0x2c28bd=_0xad9f[_0x235f8f];return _0x2c28bd;};'use strict';var Sequelize=require(_0xfad9('0x0'));var moment=require(_0xfad9('0x1'));module[_0xfad9('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xfad9('0x3')]},'disposition':{'type':Sequelize[_0xfad9('0x4')]},'secondDisposition':{'type':Sequelize[_0xfad9('0x4')]},'thirdDisposition':{'type':Sequelize[_0xfad9('0x4')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xfad9('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xfad9('0x5')]('in',_0xfad9('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xfad9('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xfad9('0x5')]('in',_0xfad9('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xfad9('0x7')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x110e=['sequelize','moment','BOOLEAN','DATE','STRING','out','ENUM','INTEGER'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x110e,0x68));var _0xe110=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0x110e[_0x25e7cb];return _0x375d92;};'use strict';var Sequelize=require(_0xe110('0x0'));var moment=require(_0xe110('0x1'));module['exports']={'closed':{'type':Sequelize[_0xe110('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xe110('0x3')]},'disposition':{'type':Sequelize[_0xe110('0x4')]},'secondDisposition':{'type':Sequelize[_0xe110('0x4')]},'thirdDisposition':{'type':Sequelize[_0xe110('0x4')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xe110('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xe110('0x6')]('in',_0xe110('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xe110('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xe110('0x7')]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index 7b884a6..c2f8d30 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 _0x5fb7=['filters','intersection','fields','attributes','includeAll','include','merge','find','create','body','update','params','describe','addMessage','ids','omit','getMessages','findOne','WhatsappMessage','rawAttributes','length','hasOwnProperty','nolimit','order','pick','where','WhatsappInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','options','rows','addTags','setTags','spread','Tag','color','emit','removeTags','unix','toString','join','tmp','server','files','attachments','format','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','firstName','Attachment','Messages','createdAt','read','WhatsappAccount','Account','get','mkdirSync','Whatsapp','Owner','N.A.','closed','closedAt','disposition','createReadStream','pipe','direction','out','System','lastName','basename','secret','value','renderFile','transcript-','.pdf','createPdfFromHTML','download','log','err','unlinkSync','rimraf','moment','bluebird','util','ejs','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','then','destroy','error','stack','name','send','index','map','type','getOptions','findAll','whatsapp','catch','show','model','keys','WhatsappInteraction','query'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5fb7,0xd8));var _0x75fb=function(_0x344a3f,_0x579a22){_0x344a3f=_0x344a3f-0x0;var _0x264712=_0x5fb7[_0x344a3f];return _0x264712;};'use strict';var rimraf=require(_0x75fb('0x0'));var zipdir=require('zip-dir');var moment=require(_0x75fb('0x1'));var BPromise=require(_0x75fb('0x2'));var util=require(_0x75fb('0x3'));var path=require('path');var ejs=require(_0x75fb('0x4'));var fs=require('fs');var _=require('lodash');var Redis=require(_0x75fb('0x5'));var interaction=require(_0x75fb('0x6'));var qs=require(_0x75fb('0x7'));var pdf=require('../../components/export/pdf');var logger=require(_0x75fb('0x8'))(_0x75fb('0x9'));var config=require(_0x75fb('0xa'));var db=require(_0x75fb('0xb'))['db'];config[_0x75fb('0xc')]=_[_0x75fb('0xd')](config[_0x75fb('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x75fb('0xe'))(new Redis(config[_0x75fb('0xc')]));require(_0x75fb('0xf'))[_0x75fb('0x10')](socket);function respondWithStatusCode(_0x2cece0,_0x3ed86b){_0x3ed86b=_0x3ed86b||0xcc;return function(_0x1a7368){if(_0x1a7368){return _0x2cece0[_0x75fb('0x11')](_0x3ed86b);}return _0x2cece0[_0x75fb('0x12')](_0x3ed86b)['end']();};}function respondWithResult(_0x2cf160,_0x23597e){_0x23597e=_0x23597e||0xc8;return function(_0x185a9f){if(_0x185a9f){return _0x2cf160['status'](_0x23597e)[_0x75fb('0x13')](_0x185a9f);}};}function respondWithFilteredResult(_0x36558a,_0xb83552){return function(_0x45f607){if(_0x45f607){var _0x1ecd64=typeof _0xb83552[_0x75fb('0x14')]===_0x75fb('0x15')&&typeof _0xb83552[_0x75fb('0x16')]==='undefined';var _0x88722d=_0x45f607[_0x75fb('0x17')];var _0x29d9b3=_0x1ecd64?0x0:_0xb83552['offset'];var _0x7236cc=_0x1ecd64?_0x45f607['count']:_0xb83552[_0x75fb('0x14')]+_0xb83552['limit'];var _0x399d6f;if(_0x7236cc>=_0x88722d){_0x7236cc=_0x88722d;_0x399d6f=0xc8;}else{_0x399d6f=0xce;}_0x36558a[_0x75fb('0x12')](_0x399d6f);return _0x36558a[_0x75fb('0x18')](_0x75fb('0x19'),_0x29d9b3+'-'+_0x7236cc+'/'+_0x88722d)[_0x75fb('0x13')](_0x45f607);}return null;};}function saveUpdates(_0xa30d0f){return function(_0x24ab0e){if(_0x24ab0e){return _0x24ab0e['update'](_0xa30d0f)[_0x75fb('0x1a')](function(_0x35a8d5){return _0x35a8d5;});}return null;};}function removeEntity(_0x5cf8ba){return function(_0x48a747){if(_0x48a747){return _0x48a747[_0x75fb('0x1b')]()['then'](function(){_0x5cf8ba[_0x75fb('0x12')](0xcc)['end']();});}};}function handleEntityNotFound(_0x581104){return function(_0x14d782){if(!_0x14d782){_0x581104[_0x75fb('0x11')](0x194);}return _0x14d782;};}function handleError(_0x5729ac,_0x5e12b2){_0x5e12b2=_0x5e12b2||0x1f4;return function(_0x6021f3){logger[_0x75fb('0x1c')](_0x6021f3[_0x75fb('0x1d')]);if(_0x6021f3['name']){delete _0x6021f3[_0x75fb('0x1e')];}_0x5729ac['status'](_0x5e12b2)[_0x75fb('0x1f')](_0x6021f3);};}exports[_0x75fb('0x20')]=function(_0x21eb03,_0x10f2ad){var _0x3e3725={};var _0x565c61=_[_0x75fb('0x21')](db['WhatsappInteraction']['rawAttributes'],function(_0x175a3e){return{'name':_0x175a3e['fieldName'],'type':_0x175a3e[_0x75fb('0x22')]['key']};});_0x3e3725=qs[_0x75fb('0x23')](_0x565c61,_0x21eb03);return interaction[_0x75fb('0x24')](_0x75fb('0x25'),_0x21eb03['query'],_0x21eb03['user'],_0x3e3725,_0x565c61)['then'](respondWithFilteredResult(_0x10f2ad,_0x3e3725))[_0x75fb('0x26')](handleError(_0x10f2ad,null));};exports[_0x75fb('0x27')]=function(_0x21a9aa,_0x4d64ee){var _0x3cac11={'raw':![],'where':{'id':_0x21a9aa['params']['id']}},_0x2c3386={};_0x2c3386[_0x75fb('0x28')]=_[_0x75fb('0x29')](db[_0x75fb('0x2a')]['rawAttributes']);_0x2c3386[_0x75fb('0x2b')]=_['keys'](_0x21a9aa[_0x75fb('0x2b')]);_0x2c3386[_0x75fb('0x2c')]=_[_0x75fb('0x2d')](_0x2c3386[_0x75fb('0x28')],_0x2c3386[_0x75fb('0x2b')]);_0x3cac11['attributes']=_[_0x75fb('0x2d')](_0x2c3386[_0x75fb('0x28')],qs[_0x75fb('0x2e')](_0x21a9aa[_0x75fb('0x2b')][_0x75fb('0x2e')]));_0x3cac11[_0x75fb('0x2f')]=_0x3cac11['attributes']['length']?_0x3cac11[_0x75fb('0x2f')]:_0x2c3386[_0x75fb('0x28')];if(_0x21a9aa[_0x75fb('0x2b')][_0x75fb('0x30')]){_0x3cac11[_0x75fb('0x31')]=[{'all':!![]}];}_0x3cac11=_[_0x75fb('0x32')]({},_0x3cac11,_0x21a9aa['options']);return db[_0x75fb('0x2a')][_0x75fb('0x33')](_0x3cac11)[_0x75fb('0x1a')](handleEntityNotFound(_0x4d64ee,null))[_0x75fb('0x1a')](respondWithResult(_0x4d64ee,null))['catch'](handleError(_0x4d64ee,null));};exports['create']=function(_0x3c6e53,_0x372819){return db[_0x75fb('0x2a')][_0x75fb('0x34')](_0x3c6e53[_0x75fb('0x35')],{})[_0x75fb('0x1a')](respondWithResult(_0x372819,0xc9))[_0x75fb('0x26')](handleError(_0x372819,null));};exports[_0x75fb('0x36')]=function(_0x951a84,_0x2e5803){if(_0x951a84[_0x75fb('0x35')]['id']){delete _0x951a84[_0x75fb('0x35')]['id'];}return db[_0x75fb('0x2a')][_0x75fb('0x33')]({'where':{'id':_0x951a84[_0x75fb('0x37')]['id']}})[_0x75fb('0x1a')](handleEntityNotFound(_0x2e5803,null))[_0x75fb('0x1a')](saveUpdates(_0x951a84[_0x75fb('0x35')],null))['then'](respondWithResult(_0x2e5803,null))[_0x75fb('0x26')](handleError(_0x2e5803,null));};exports['destroy']=function(_0x30e45d,_0x3f8779){return db[_0x75fb('0x2a')][_0x75fb('0x33')]({'where':{'id':_0x30e45d[_0x75fb('0x37')]['id']}})[_0x75fb('0x1a')](handleEntityNotFound(_0x3f8779,null))[_0x75fb('0x1a')](removeEntity(_0x3f8779,null))['catch'](handleError(_0x3f8779,null));};exports['describe']=function(_0x4f4e32,_0x546e47){return db['WhatsappInteraction'][_0x75fb('0x38')]()[_0x75fb('0x1a')](respondWithResult(_0x546e47,null))['catch'](handleError(_0x546e47,null));};exports[_0x75fb('0x39')]=function(_0x4209b4,_0x51b74e){return db['WhatsappMessage'][_0x75fb('0x33')]({'where':{'id':_0x4209b4[_0x75fb('0x37')]['id']}})[_0x75fb('0x1a')](handleEntityNotFound(_0x51b74e,null))['then'](function(_0x10d2ac){if(_0x10d2ac){return _0x10d2ac[_0x75fb('0x39')](_0x4209b4['body'][_0x75fb('0x3a')],_[_0x75fb('0x3b')](_0x4209b4[_0x75fb('0x35')],['ids','id'])||{});}})[_0x75fb('0x1a')](respondWithResult(_0x51b74e,null))['catch'](handleError(_0x51b74e,null));};exports[_0x75fb('0x3c')]=function(_0x20e2ce,_0x586b6b){var _0x327ec9={'raw':![],'where':{}};var _0x28c85a={};var _0x39b517={'count':0x0,'rows':[]};return db['WhatsappInteraction'][_0x75fb('0x3d')]({'where':{'id':_0x20e2ce[_0x75fb('0x37')]['id']}})[_0x75fb('0x1a')](handleEntityNotFound(_0x586b6b,null))[_0x75fb('0x1a')](function(_0x4fdbb0){if(_0x4fdbb0){_0x28c85a[_0x75fb('0x28')]=_['keys'](db[_0x75fb('0x3e')][_0x75fb('0x3f')]);_0x28c85a[_0x75fb('0x2b')]=_[_0x75fb('0x29')](_0x20e2ce[_0x75fb('0x2b')]);_0x28c85a[_0x75fb('0x2c')]=_[_0x75fb('0x2d')](_0x28c85a[_0x75fb('0x28')],_0x28c85a['query']);_0x327ec9[_0x75fb('0x2f')]=_['intersection'](_0x28c85a[_0x75fb('0x28')],qs[_0x75fb('0x2e')](_0x20e2ce['query'][_0x75fb('0x2e')]));_0x327ec9[_0x75fb('0x2f')]=_0x327ec9[_0x75fb('0x2f')][_0x75fb('0x40')]?_0x327ec9[_0x75fb('0x2f')]:_0x28c85a[_0x75fb('0x28')];if(!_0x20e2ce['query'][_0x75fb('0x41')](_0x75fb('0x42'))){_0x327ec9['limit']=qs[_0x75fb('0x16')](_0x20e2ce['query']['limit']);_0x327ec9[_0x75fb('0x14')]=qs[_0x75fb('0x14')](_0x20e2ce['query'][_0x75fb('0x14')]);}_0x327ec9[_0x75fb('0x43')]=qs['sort'](_0x20e2ce[_0x75fb('0x2b')]['sort']);_0x327ec9['where']=qs[_0x75fb('0x2c')](_[_0x75fb('0x44')](_0x20e2ce[_0x75fb('0x2b')],_0x28c85a[_0x75fb('0x2c')]));_0x327ec9[_0x75fb('0x45')][_0x75fb('0x46')]=_0x4fdbb0['id'];if(_0x20e2ce[_0x75fb('0x2b')][_0x75fb('0x47')]){_0x327ec9[_0x75fb('0x45')]=_[_0x75fb('0x32')](_0x327ec9['where'],{'$or':_[_0x75fb('0x21')](_0x327ec9[_0x75fb('0x2f')],function(_0x8160a9){var _0x1e65f1={};_0x1e65f1[_0x8160a9]={'$like':'%'+_0x20e2ce['query']['filter']+'%'};return _0x1e65f1;})});}if(_0x20e2ce[_0x75fb('0x2b')]['$gte']){var _0x27a7f4=_0x20e2ce['query'][_0x75fb('0x48')][_0x75fb('0x49')](',');var _0x5dd70a={};_0x5dd70a[_0x27a7f4[0x0]]={'$gte':moment(_0x27a7f4[0x1])['format'](_0x75fb('0x4a'))};_0x327ec9[_0x75fb('0x45')]=_['merge'](_0x327ec9[_0x75fb('0x45')],_0x5dd70a);}_0x327ec9=_[_0x75fb('0x32')]({},_0x327ec9,_0x20e2ce[_0x75fb('0x4b')]);return db[_0x75fb('0x3e')][_0x75fb('0x17')]({'where':_0x327ec9['where']})['then'](function(_0x3996eb){_0x39b517['count']=_0x3996eb;if(_0x20e2ce[_0x75fb('0x2b')][_0x75fb('0x30')]){_0x327ec9[_0x75fb('0x31')]=[{'all':!![]}];}return db[_0x75fb('0x3e')][_0x75fb('0x24')](_0x327ec9);})[_0x75fb('0x1a')](function(_0x503a56){_0x39b517[_0x75fb('0x4c')]=_0x503a56;return _0x39b517;});}})[_0x75fb('0x1a')](respondWithFilteredResult(_0x586b6b,_0x327ec9))[_0x75fb('0x26')](handleError(_0x586b6b,null));};exports[_0x75fb('0x4d')]=function(_0xf7b702,_0x2eef85){return db['WhatsappInteraction'][_0x75fb('0x33')]({'where':{'id':_0xf7b702[_0x75fb('0x37')]['id']}})[_0x75fb('0x1a')](handleEntityNotFound(_0x2eef85,null))[_0x75fb('0x1a')](function(_0x56fd9a){if(_0x56fd9a){return _0x56fd9a[_0x75fb('0x4e')](_0xf7b702['body'][_0x75fb('0x3a')],_[_0x75fb('0x3b')](_0xf7b702['body'],[_0x75fb('0x3a'),'id'])||{})[_0x75fb('0x4f')](function(){return db[_0x75fb('0x50')][_0x75fb('0x24')]({'attributes':['id',_0x75fb('0x1e'),_0x75fb('0x51')],'where':{'id':_0xf7b702[_0x75fb('0x35')][_0x75fb('0x3a')]}});})[_0x75fb('0x1a')](function(_0x1e47a7){socket[_0x75fb('0x52')]('whatsappInteractionTags:save',{'id':Number(_0xf7b702[_0x75fb('0x37')]['id']),'tags':_0x1e47a7||[]});return{'id':Number(_0xf7b702[_0x75fb('0x37')]['id']),'tags':_0x1e47a7||[]};});}})[_0x75fb('0x1a')](respondWithResult(_0x2eef85,null))[_0x75fb('0x26')](handleError(_0x2eef85,null));};exports[_0x75fb('0x53')]=function(_0x76e7d8,_0x246024){return db[_0x75fb('0x2a')]['find']({'where':{'id':_0x76e7d8[_0x75fb('0x37')]['id']}})[_0x75fb('0x1a')](handleEntityNotFound(_0x246024,null))[_0x75fb('0x1a')](function(_0x5dce58){if(_0x5dce58){return _0x5dce58['removeTags'](_0x76e7d8['query'][_0x75fb('0x3a')]);}})[_0x75fb('0x1a')](respondWithStatusCode(_0x246024,null))[_0x75fb('0x26')](handleError(_0x246024,null));};exports['download']=function(_0x1e6319,_0x14acaf){var _0x1a3933=moment()[_0x75fb('0x54')]()[_0x75fb('0x55')]();var _0x58876e=path[_0x75fb('0x56')](config['root'],'server','files',_0x75fb('0x57'));var _0x39f015=path['join'](config['root'],_0x75fb('0x58'),_0x75fb('0x59'),_0x75fb('0x5a'));var _0x17001d=path[_0x75fb('0x56')](_0x58876e,_0x1a3933);var _0x210ffa=util[_0x75fb('0x5b')](_0x75fb('0x5c'),_0x1e6319[_0x75fb('0x37')]['id'],_0x1a3933);var _0x4eef9a=path['join'](_0x58876e,_0x210ffa);var _0x3e4672=[];_0x3e4672[_0x75fb('0x5d')]({'model':db[_0x75fb('0x5e')],'as':_0x75fb('0x5e'),'attributes':['id',_0x75fb('0x5f')],'raw':!![]});_0x3e4672[_0x75fb('0x5d')]({'model':db[_0x75fb('0x60')],'as':_0x75fb('0x61'),'attributes':['id',_0x75fb('0x62'),'lastName'],'raw':!![]});if(_0x1e6319[_0x75fb('0x2b')][_0x75fb('0x5a')]){_0x3e4672['push']({'model':db['Attachment'],'as':_0x75fb('0x63'),'raw':!![]});}var _0x481357=[{'model':db['WhatsappMessage'],'as':_0x75fb('0x64'),'attributes':['id',_0x75fb('0x35'),_0x75fb('0x65'),'direction','secret',_0x75fb('0x66')],'include':_0x3e4672}];_0x481357[_0x75fb('0x5d')]({'model':db[_0x75fb('0x67')],'as':_0x75fb('0x68'),'attributes':['id','name']});_0x481357[_0x75fb('0x5d')]({'model':db[_0x75fb('0x5e')],'as':'Owner','attributes':['id',_0x75fb('0x5f')]});return db['WhatsappInteraction'][_0x75fb('0x33')]({'where':{'id':_0x1e6319[_0x75fb('0x37')]['id']},'include':_0x481357})['then'](handleEntityNotFound(_0x14acaf,null))['then'](function(_0x1fa6dd){if(_0x1fa6dd){var _0x54e427=_0x1fa6dd[_0x75fb('0x69')]({'plain':!![]});fs[_0x75fb('0x6a')](_0x17001d);var _0x217373={'channel':_0x75fb('0x6b'),'account':_0x54e427[_0x75fb('0x68')][_0x75fb('0x1e')],'agent':_0x54e427['Owner']?_0x54e427[_0x75fb('0x6c')][_0x75fb('0x5f')]:_0x75fb('0x6d'),'createdAt':moment(_0x54e427[_0x75fb('0x65')])[_0x75fb('0x5b')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x54e427[_0x75fb('0x6e')]?moment(_0x54e427[_0x75fb('0x6f')])[_0x75fb('0x5b')](_0x75fb('0x4a'))['toString']():'','disposition':_0x54e427[_0x75fb('0x70')],'messages':_(_0x54e427[_0x75fb('0x64')])[_0x75fb('0x47')]({'secret':![]})[_0x75fb('0x21')](function(_0x155b26){if(_0x155b26[_0x75fb('0x63')]){var _0x701b73=path[_0x75fb('0x56')](_0x39f015,_0x155b26[_0x75fb('0x63')]['basename']);if(fs['existsSync'](_0x701b73)){fs[_0x75fb('0x71')](_0x701b73)[_0x75fb('0x72')](fs['createWriteStream'](path[_0x75fb('0x56')](_0x17001d,_0x155b26[_0x75fb('0x63')]['basename'])));}}return{'date':moment(_0x155b26[_0x75fb('0x65')])['format'](_0x75fb('0x4a'))[_0x75fb('0x55')](),'sender':_0x155b26[_0x75fb('0x73')]===_0x75fb('0x74')?_0x155b26[_0x75fb('0x5e')]?_0x155b26[_0x75fb('0x5e')][_0x75fb('0x5f')]:_0x75fb('0x75'):_0x155b26[_0x75fb('0x61')]['firstName']+(_0x155b26['Contact'][_0x75fb('0x76')]?'\x20'+_0x155b26['Contact']['lastName']:''),'body':_0x155b26[_0x75fb('0x63')]?_0x155b26[_0x75fb('0x63')][_0x75fb('0x77')]:_0x155b26[_0x75fb('0x35')],'direction':_0x155b26[_0x75fb('0x73')]==='out'?'A':'C','secret':_0x155b26[_0x75fb('0x78')],'read':_0x155b26[_0x75fb('0x66')],'attachment':_0x155b26[_0x75fb('0x63')]};})[_0x75fb('0x79')]()};return ejs[_0x75fb('0x7a')](path['join'](config['root'],_0x75fb('0x58'),'views','downloadInteraction.ejs'),{'interaction':_0x217373})[_0x75fb('0x1a')](function(_0x49acca){var _0x4eeaee=path[_0x75fb('0x56')](_0x17001d,_0x75fb('0x7b')+_0x54e427['id']+'-'+_0x1a3933+_0x75fb('0x7c'));var _0x1c53a8={'path':_0x4eeaee,'channel':'Whatsapp','interactionId':_0x54e427['id']};return pdf[_0x75fb('0x7d')](_0x49acca,_0x1c53a8);})['then'](function(){return new BPromise(function(_0x4bf789,_0x30eec9){zipdir(_0x17001d,{'saveTo':_0x4eef9a},function(_0x3aa628,_0xb252ec){if(_0x3aa628)return _0x30eec9(_0x3aa628);return _0x4bf789(_0xb252ec);});})[_0x75fb('0x1a')](function(){return new BPromise(function(_0x2b4b38,_0x1dddb1){rimraf(_0x17001d,function(_0x258cb4){if(_0x258cb4)_0x1dddb1(_0x258cb4);return _0x2b4b38();});});})[_0x75fb('0x1a')](function(){return _0x14acaf[_0x75fb('0x7e')](_0x4eef9a,_0x210ffa,function(_0x3e5567){if(_0x3e5567){console[_0x75fb('0x7f')](_0x75fb('0x80'),_0x3e5567);}else{fs[_0x75fb('0x81')](_0x4eef9a);}});});});}else{return _0x14acaf[_0x75fb('0x11')](0xc8);}})[_0x75fb('0x26')](handleError(_0x14acaf,null));}; \ No newline at end of file +var _0x571e=['rows','setTags','omit','spread','Tag','emit','removeTags','download','unix','toString','root','files','tmp','join','server','attachments','transcript-%d-%s.zip','push','User','fullname','Contact','Attachment','Messages','direction','secret','read','WhatsappAccount','Account','Owner','get','closed','closedAt','format','disposition','basename','existsSync','createReadStream','pipe','createWriteStream','createdAt','out','System','lastName','renderFile','.pdf','Whatsapp','createPdfFromHTML','unlinkSync','rimraf','zip-dir','bluebird','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/export/pdf','../../config/environment','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','update','then','error','name','send','index','map','WhatsappInteraction','fieldName','type','key','getOptions','findAll','whatsapp','query','show','params','keys','rawAttributes','model','attributes','intersection','fields','length','includeAll','include','merge','catch','create','body','find','destroy','describe','WhatsappMessage','ids','getMessages','findOne','filters','hasOwnProperty','nolimit','order','sort','where','pick','WhatsappInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','count'];(function(_0x370ea2,_0x18390e){var _0x183043=function(_0x2c492b){while(--_0x2c492b){_0x370ea2['push'](_0x370ea2['shift']());}};_0x183043(++_0x18390e);}(_0x571e,0x1a4));var _0xe571=function(_0x58e181,_0x47c76c){_0x58e181=_0x58e181-0x0;var _0x34248d=_0x571e[_0x58e181];return _0x34248d;};'use strict';var rimraf=require(_0xe571('0x0'));var zipdir=require(_0xe571('0x1'));var moment=require('moment');var BPromise=require(_0xe571('0x2'));var util=require(_0xe571('0x3'));var path=require(_0xe571('0x4'));var ejs=require(_0xe571('0x5'));var fs=require('fs');var _=require(_0xe571('0x6'));var Redis=require(_0xe571('0x7'));var interaction=require(_0xe571('0x8'));var qs=require('../../components/parsers/qs');var pdf=require(_0xe571('0x9'));var logger=require('../../config/logger')('api');var config=require(_0xe571('0xa'));var db=require('../../mysqldb')['db'];config[_0xe571('0xb')]=_[_0xe571('0xc')](config[_0xe571('0xb')],{'host':_0xe571('0xd'),'port':0x18eb});var socket=require(_0xe571('0xe'))(new Redis(config['redis']));require(_0xe571('0xf'))[_0xe571('0x10')](socket);function respondWithStatusCode(_0x1bae9d,_0x361680){_0x361680=_0x361680||0xcc;return function(_0x41b8e6){if(_0x41b8e6){return _0x1bae9d[_0xe571('0x11')](_0x361680);}return _0x1bae9d[_0xe571('0x12')](_0x361680)[_0xe571('0x13')]();};}function respondWithResult(_0x2b2806,_0x516a0b){_0x516a0b=_0x516a0b||0xc8;return function(_0x25f88c){if(_0x25f88c){return _0x2b2806['status'](_0x516a0b)[_0xe571('0x14')](_0x25f88c);}};}function respondWithFilteredResult(_0x4bd322,_0x45b112){return function(_0x34238f){if(_0x34238f){var _0x43e9bd=typeof _0x45b112[_0xe571('0x15')]===_0xe571('0x16')&&typeof _0x45b112[_0xe571('0x17')]===_0xe571('0x16');var _0x1bcdce=_0x34238f['count'];var _0x54d6d0=_0x43e9bd?0x0:_0x45b112[_0xe571('0x15')];var _0x2f9f10=_0x43e9bd?_0x34238f['count']:_0x45b112['offset']+_0x45b112[_0xe571('0x17')];var _0x223070;if(_0x2f9f10>=_0x1bcdce){_0x2f9f10=_0x1bcdce;_0x223070=0xc8;}else{_0x223070=0xce;}_0x4bd322[_0xe571('0x12')](_0x223070);return _0x4bd322[_0xe571('0x18')](_0xe571('0x19'),_0x54d6d0+'-'+_0x2f9f10+'/'+_0x1bcdce)[_0xe571('0x14')](_0x34238f);}return null;};}function saveUpdates(_0x2e3c4b){return function(_0x4bc6b4){if(_0x4bc6b4){return _0x4bc6b4[_0xe571('0x1a')](_0x2e3c4b)[_0xe571('0x1b')](function(_0x30b0fe){return _0x30b0fe;});}return null;};}function removeEntity(_0x2a713a){return function(_0x48e27e){if(_0x48e27e){return _0x48e27e['destroy']()[_0xe571('0x1b')](function(){_0x2a713a['status'](0xcc)[_0xe571('0x13')]();});}};}function handleEntityNotFound(_0x20100b){return function(_0xe78a5f){if(!_0xe78a5f){_0x20100b[_0xe571('0x11')](0x194);}return _0xe78a5f;};}function handleError(_0x319b78,_0x508e8f){_0x508e8f=_0x508e8f||0x1f4;return function(_0x257fdc){logger[_0xe571('0x1c')](_0x257fdc['stack']);if(_0x257fdc[_0xe571('0x1d')]){delete _0x257fdc['name'];}_0x319b78[_0xe571('0x12')](_0x508e8f)[_0xe571('0x1e')](_0x257fdc);};}exports[_0xe571('0x1f')]=function(_0x24efe9,_0x4341bb){var _0xf59292={};var _0x5f0fcb=_[_0xe571('0x20')](db[_0xe571('0x21')]['rawAttributes'],function(_0x9ae173){return{'name':_0x9ae173[_0xe571('0x22')],'type':_0x9ae173[_0xe571('0x23')][_0xe571('0x24')]};});_0xf59292=qs[_0xe571('0x25')](_0x5f0fcb,_0x24efe9);return interaction[_0xe571('0x26')](_0xe571('0x27'),_0x24efe9[_0xe571('0x28')],_0x24efe9['user'],_0xf59292,_0x5f0fcb)[_0xe571('0x1b')](respondWithFilteredResult(_0x4341bb,_0xf59292))['catch'](handleError(_0x4341bb,null));};exports[_0xe571('0x29')]=function(_0x1e676d,_0x25c4e0){var _0x19f763={'raw':![],'where':{'id':_0x1e676d[_0xe571('0x2a')]['id']}},_0x2b6351={};_0x2b6351['model']=_[_0xe571('0x2b')](db[_0xe571('0x21')][_0xe571('0x2c')]);_0x2b6351['query']=_['keys'](_0x1e676d[_0xe571('0x28')]);_0x2b6351['filters']=_['intersection'](_0x2b6351[_0xe571('0x2d')],_0x2b6351[_0xe571('0x28')]);_0x19f763[_0xe571('0x2e')]=_[_0xe571('0x2f')](_0x2b6351['model'],qs['fields'](_0x1e676d['query'][_0xe571('0x30')]));_0x19f763['attributes']=_0x19f763[_0xe571('0x2e')][_0xe571('0x31')]?_0x19f763[_0xe571('0x2e')]:_0x2b6351[_0xe571('0x2d')];if(_0x1e676d[_0xe571('0x28')][_0xe571('0x32')]){_0x19f763[_0xe571('0x33')]=[{'all':!![]}];}_0x19f763=_[_0xe571('0x34')]({},_0x19f763,_0x1e676d['options']);return db['WhatsappInteraction']['find'](_0x19f763)['then'](handleEntityNotFound(_0x25c4e0,null))[_0xe571('0x1b')](respondWithResult(_0x25c4e0,null))[_0xe571('0x35')](handleError(_0x25c4e0,null));};exports[_0xe571('0x36')]=function(_0x2e19d3,_0x4e5126){return db[_0xe571('0x21')][_0xe571('0x36')](_0x2e19d3[_0xe571('0x37')],{})['then'](respondWithResult(_0x4e5126,0xc9))[_0xe571('0x35')](handleError(_0x4e5126,null));};exports[_0xe571('0x1a')]=function(_0x5d7dce,_0x2559ef){if(_0x5d7dce['body']['id']){delete _0x5d7dce[_0xe571('0x37')]['id'];}return db[_0xe571('0x21')][_0xe571('0x38')]({'where':{'id':_0x5d7dce[_0xe571('0x2a')]['id']}})['then'](handleEntityNotFound(_0x2559ef,null))['then'](saveUpdates(_0x5d7dce[_0xe571('0x37')],null))[_0xe571('0x1b')](respondWithResult(_0x2559ef,null))[_0xe571('0x35')](handleError(_0x2559ef,null));};exports[_0xe571('0x39')]=function(_0x11a101,_0x1fc99e){return db['WhatsappInteraction'][_0xe571('0x38')]({'where':{'id':_0x11a101[_0xe571('0x2a')]['id']}})['then'](handleEntityNotFound(_0x1fc99e,null))[_0xe571('0x1b')](removeEntity(_0x1fc99e,null))[_0xe571('0x35')](handleError(_0x1fc99e,null));};exports['describe']=function(_0x897d5c,_0x201e69){return db[_0xe571('0x21')][_0xe571('0x3a')]()[_0xe571('0x1b')](respondWithResult(_0x201e69,null))[_0xe571('0x35')](handleError(_0x201e69,null));};exports['addMessage']=function(_0x485b1e,_0x4bb2a3){return db[_0xe571('0x3b')]['find']({'where':{'id':_0x485b1e[_0xe571('0x2a')]['id']}})[_0xe571('0x1b')](handleEntityNotFound(_0x4bb2a3,null))['then'](function(_0x27779e){if(_0x27779e){return _0x27779e['addMessage'](_0x485b1e[_0xe571('0x37')][_0xe571('0x3c')],_['omit'](_0x485b1e[_0xe571('0x37')],[_0xe571('0x3c'),'id'])||{});}})['then'](respondWithResult(_0x4bb2a3,null))[_0xe571('0x35')](handleError(_0x4bb2a3,null));};exports[_0xe571('0x3d')]=function(_0x2c0817,_0x45d4b8){var _0x331e95={'raw':![],'where':{}};var _0x4e99e9={};var _0x496662={'count':0x0,'rows':[]};return db['WhatsappInteraction'][_0xe571('0x3e')]({'where':{'id':_0x2c0817[_0xe571('0x2a')]['id']}})['then'](handleEntityNotFound(_0x45d4b8,null))['then'](function(_0x872a3a){if(_0x872a3a){_0x4e99e9[_0xe571('0x2d')]=_[_0xe571('0x2b')](db['WhatsappMessage'][_0xe571('0x2c')]);_0x4e99e9[_0xe571('0x28')]=_[_0xe571('0x2b')](_0x2c0817[_0xe571('0x28')]);_0x4e99e9[_0xe571('0x3f')]=_[_0xe571('0x2f')](_0x4e99e9[_0xe571('0x2d')],_0x4e99e9[_0xe571('0x28')]);_0x331e95[_0xe571('0x2e')]=_['intersection'](_0x4e99e9[_0xe571('0x2d')],qs[_0xe571('0x30')](_0x2c0817[_0xe571('0x28')][_0xe571('0x30')]));_0x331e95['attributes']=_0x331e95[_0xe571('0x2e')][_0xe571('0x31')]?_0x331e95[_0xe571('0x2e')]:_0x4e99e9[_0xe571('0x2d')];if(!_0x2c0817[_0xe571('0x28')][_0xe571('0x40')](_0xe571('0x41'))){_0x331e95[_0xe571('0x17')]=qs[_0xe571('0x17')](_0x2c0817[_0xe571('0x28')][_0xe571('0x17')]);_0x331e95[_0xe571('0x15')]=qs[_0xe571('0x15')](_0x2c0817[_0xe571('0x28')][_0xe571('0x15')]);}_0x331e95[_0xe571('0x42')]=qs[_0xe571('0x43')](_0x2c0817[_0xe571('0x28')]['sort']);_0x331e95[_0xe571('0x44')]=qs['filters'](_[_0xe571('0x45')](_0x2c0817['query'],_0x4e99e9['filters']));_0x331e95['where'][_0xe571('0x46')]=_0x872a3a['id'];if(_0x2c0817[_0xe571('0x28')][_0xe571('0x47')]){_0x331e95[_0xe571('0x44')]=_[_0xe571('0x34')](_0x331e95[_0xe571('0x44')],{'$or':_[_0xe571('0x20')](_0x331e95[_0xe571('0x2e')],function(_0x5a9f9b){var _0x279f3a={};_0x279f3a[_0x5a9f9b]={'$like':'%'+_0x2c0817[_0xe571('0x28')][_0xe571('0x47')]+'%'};return _0x279f3a;})});}if(_0x2c0817[_0xe571('0x28')][_0xe571('0x48')]){var _0x2c4419=_0x2c0817[_0xe571('0x28')][_0xe571('0x48')][_0xe571('0x49')](',');var _0x4f0791={};_0x4f0791[_0x2c4419[0x0]]={'$gte':moment(_0x2c4419[0x1])['format'](_0xe571('0x4a'))};_0x331e95[_0xe571('0x44')]=_['merge'](_0x331e95[_0xe571('0x44')],_0x4f0791);}_0x331e95=_['merge']({},_0x331e95,_0x2c0817['options']);return db['WhatsappMessage'][_0xe571('0x4b')]({'where':_0x331e95[_0xe571('0x44')]})[_0xe571('0x1b')](function(_0x77f4b4){_0x496662[_0xe571('0x4b')]=_0x77f4b4;if(_0x2c0817['query']['includeAll']){_0x331e95[_0xe571('0x33')]=[{'all':!![]}];}return db[_0xe571('0x3b')]['findAll'](_0x331e95);})[_0xe571('0x1b')](function(_0x25510f){_0x496662[_0xe571('0x4c')]=_0x25510f;return _0x496662;});}})[_0xe571('0x1b')](respondWithFilteredResult(_0x45d4b8,_0x331e95))[_0xe571('0x35')](handleError(_0x45d4b8,null));};exports['addTags']=function(_0xe9bf8c,_0x93bf1e){return db[_0xe571('0x21')][_0xe571('0x38')]({'where':{'id':_0xe9bf8c[_0xe571('0x2a')]['id']}})[_0xe571('0x1b')](handleEntityNotFound(_0x93bf1e,null))['then'](function(_0x4f83d7){if(_0x4f83d7){return _0x4f83d7[_0xe571('0x4d')](_0xe9bf8c[_0xe571('0x37')][_0xe571('0x3c')],_[_0xe571('0x4e')](_0xe9bf8c[_0xe571('0x37')],[_0xe571('0x3c'),'id'])||{})[_0xe571('0x4f')](function(){return db[_0xe571('0x50')][_0xe571('0x26')]({'attributes':['id',_0xe571('0x1d'),'color'],'where':{'id':_0xe9bf8c['body'][_0xe571('0x3c')]}});})['then'](function(_0x507266){socket[_0xe571('0x51')]('whatsappInteractionTags:save',{'id':Number(_0xe9bf8c[_0xe571('0x2a')]['id']),'tags':_0x507266||[]});return{'id':Number(_0xe9bf8c['params']['id']),'tags':_0x507266||[]};});}})[_0xe571('0x1b')](respondWithResult(_0x93bf1e,null))[_0xe571('0x35')](handleError(_0x93bf1e,null));};exports[_0xe571('0x52')]=function(_0x3c3795,_0x43007e){return db[_0xe571('0x21')][_0xe571('0x38')]({'where':{'id':_0x3c3795[_0xe571('0x2a')]['id']}})[_0xe571('0x1b')](handleEntityNotFound(_0x43007e,null))['then'](function(_0x1e5f77){if(_0x1e5f77){return _0x1e5f77[_0xe571('0x52')](_0x3c3795['query'][_0xe571('0x3c')]);}})['then'](respondWithStatusCode(_0x43007e,null))[_0xe571('0x35')](handleError(_0x43007e,null));};exports[_0xe571('0x53')]=function(_0x24597c,_0x375aed){var _0x111ee7=moment()[_0xe571('0x54')]()[_0xe571('0x55')]();var _0x42028d=path['join'](config[_0xe571('0x56')],'server',_0xe571('0x57'),_0xe571('0x58'));var _0x206199=path[_0xe571('0x59')](config[_0xe571('0x56')],_0xe571('0x5a'),_0xe571('0x57'),_0xe571('0x5b'));var _0x49a9a2=path['join'](_0x42028d,_0x111ee7);var _0x249783=util['format'](_0xe571('0x5c'),_0x24597c['params']['id'],_0x111ee7);var _0x2fa9c8=path['join'](_0x42028d,_0x249783);var _0x515a4f=[];_0x515a4f[_0xe571('0x5d')]({'model':db[_0xe571('0x5e')],'as':'User','attributes':['id',_0xe571('0x5f')],'raw':!![]});_0x515a4f[_0xe571('0x5d')]({'model':db['CmContact'],'as':_0xe571('0x60'),'attributes':['id','firstName','lastName'],'raw':!![]});if(_0x24597c[_0xe571('0x28')]['attachments']){_0x515a4f[_0xe571('0x5d')]({'model':db[_0xe571('0x61')],'as':_0xe571('0x61'),'raw':!![]});}var _0x58bf34=[{'model':db[_0xe571('0x3b')],'as':_0xe571('0x62'),'attributes':['id','body','createdAt',_0xe571('0x63'),_0xe571('0x64'),_0xe571('0x65')],'include':_0x515a4f}];_0x58bf34[_0xe571('0x5d')]({'model':db[_0xe571('0x66')],'as':_0xe571('0x67'),'attributes':['id',_0xe571('0x1d')]});_0x58bf34['push']({'model':db['User'],'as':_0xe571('0x68'),'attributes':['id','fullname']});return db[_0xe571('0x21')][_0xe571('0x38')]({'where':{'id':_0x24597c[_0xe571('0x2a')]['id']},'include':_0x58bf34})[_0xe571('0x1b')](handleEntityNotFound(_0x375aed,null))[_0xe571('0x1b')](function(_0x589068){if(_0x589068){var _0x248e08=_0x589068[_0xe571('0x69')]({'plain':!![]});fs['mkdirSync'](_0x49a9a2);var _0x3c374b={'channel':'Whatsapp','account':_0x248e08[_0xe571('0x67')][_0xe571('0x1d')],'agent':_0x248e08[_0xe571('0x68')]?_0x248e08['Owner'][_0xe571('0x5f')]:'N.A.','createdAt':moment(_0x248e08['createdAt'])['format'](_0xe571('0x4a'))[_0xe571('0x55')](),'closedAt':_0x248e08[_0xe571('0x6a')]?moment(_0x248e08[_0xe571('0x6b')])[_0xe571('0x6c')](_0xe571('0x4a'))[_0xe571('0x55')]():'','disposition':_0x248e08[_0xe571('0x6d')],'messages':_(_0x248e08['Messages'])[_0xe571('0x47')]({'secret':![]})['map'](function(_0x542af6){if(_0x542af6[_0xe571('0x61')]){var _0x41c1a4=path['join'](_0x206199,_0x542af6[_0xe571('0x61')][_0xe571('0x6e')]);if(fs[_0xe571('0x6f')](_0x41c1a4)){fs[_0xe571('0x70')](_0x41c1a4)[_0xe571('0x71')](fs[_0xe571('0x72')](path[_0xe571('0x59')](_0x49a9a2,_0x542af6[_0xe571('0x61')][_0xe571('0x6e')])));}}return{'date':moment(_0x542af6[_0xe571('0x73')])[_0xe571('0x6c')]('YYYY-MM-DD\x20HH:mm:ss')[_0xe571('0x55')](),'sender':_0x542af6[_0xe571('0x63')]===_0xe571('0x74')?_0x542af6[_0xe571('0x5e')]?_0x542af6['User'][_0xe571('0x5f')]:_0xe571('0x75'):_0x542af6[_0xe571('0x60')]['firstName']+(_0x542af6['Contact']['lastName']?'\x20'+_0x542af6['Contact'][_0xe571('0x76')]:''),'body':_0x542af6[_0xe571('0x61')]?_0x542af6['Attachment']['basename']:_0x542af6['body'],'direction':_0x542af6['direction']===_0xe571('0x74')?'A':'C','secret':_0x542af6[_0xe571('0x64')],'read':_0x542af6['read'],'attachment':_0x542af6[_0xe571('0x61')]};})['value']()};return ejs[_0xe571('0x77')](path[_0xe571('0x59')](config[_0xe571('0x56')],_0xe571('0x5a'),'views','downloadInteraction.ejs'),{'interaction':_0x3c374b})[_0xe571('0x1b')](function(_0x78d7c2){var _0x309b38=path[_0xe571('0x59')](_0x49a9a2,'transcript-'+_0x248e08['id']+'-'+_0x111ee7+_0xe571('0x78'));var _0x1a9ea6={'path':_0x309b38,'channel':_0xe571('0x79'),'interactionId':_0x248e08['id']};return pdf[_0xe571('0x7a')](_0x78d7c2,_0x1a9ea6);})['then'](function(){return new BPromise(function(_0x20c934,_0x153b05){zipdir(_0x49a9a2,{'saveTo':_0x2fa9c8},function(_0x139914,_0x16a81c){if(_0x139914)return _0x153b05(_0x139914);return _0x20c934(_0x16a81c);});})[_0xe571('0x1b')](function(){return new BPromise(function(_0xa53f3,_0x403d71){rimraf(_0x49a9a2,function(_0x2a43cd){if(_0x2a43cd)_0x403d71(_0x2a43cd);return _0xa53f3();});});})['then'](function(){return _0x375aed[_0xe571('0x53')](_0x2fa9c8,_0x249783,function(_0x9826ac){if(_0x9826ac){console['log']('err',_0x9826ac);}else{fs[_0xe571('0x7b')](_0x2fa9c8);}});});});}else{return _0x375aed['sendStatus'](0xc8);}})[_0xe571('0x35')](handleError(_0x375aed,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index d9ba60b..e0e670e 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 _0xfaa4=['then','map','findAll','setDataValue','unreadMessages','length','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners','update','remove','getUsers'];(function(_0x900cfd,_0x139881){var _0x106425=function(_0x29a8a3){while(--_0x29a8a3){_0x900cfd['push'](_0x900cfd['shift']());}};_0x106425(++_0x139881);}(_0xfaa4,0x1a8));var _0x4faa=function(_0xe69010,_0x2e650b){_0xe69010=_0xe69010-0x0;var _0x2b44d6=_0xfaa4[_0xe69010];return _0x2b44d6;};'use strict';var EventEmitter=require(_0x4faa('0x0'));var WhatsappInteraction=require(_0x4faa('0x1'))['db'][_0x4faa('0x2')];var WhatsappMessage=require(_0x4faa('0x1'))['db'][_0x4faa('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x4faa('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x4faa('0x5'),'afterDestroy':_0x4faa('0x6')};function emitEvent(_0x144600){return function(_0x349d09,_0x5d753f,_0x8117c3){_0x349d09[_0x4faa('0x7')]({'attributes':['id'],'raw':!![]})[_0x4faa('0x8')](function(_0x504f83){_0x349d09['setDataValue']('Users',_0x504f83[_0x4faa('0x9')](function(_0xa0edee){return{'id':_0xa0edee['id']};}));return WhatsappMessage[_0x4faa('0xa')]({'where':{'WhatsappInteractionId':_0x349d09['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x37dad5){_0x349d09[_0x4faa('0xb')](_0x4faa('0xc'),_0x37dad5[_0x4faa('0xd')]);WhatsappInteractionEvents[_0x4faa('0xe')](_0x144600+':'+_0x349d09['id'],_0x349d09);WhatsappInteractionEvents['emit'](_0x144600,_0x349d09);_0x8117c3(null);})['catch'](_0x8117c3(null));};}for(var e in events){if(events[_0x4faa('0xf')](e)){var event=events[e];WhatsappInteraction[_0x4faa('0x10')](e,emitEvent(event));}}module[_0x4faa('0x11')]=WhatsappInteractionEvents; \ No newline at end of file +var _0x151b=['../../mysqldb','setMaxListeners','save','update','getUsers','setDataValue','Users','findAll','then','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events'];(function(_0x2d627b,_0x33f5af){var _0x58d33e=function(_0x55f32e){while(--_0x55f32e){_0x2d627b['push'](_0x2d627b['shift']());}};_0x58d33e(++_0x33f5af);}(_0x151b,0x153));var _0xb151=function(_0x14ea4d,_0x351394){_0x14ea4d=_0x14ea4d-0x0;var _0x3da69f=_0x151b[_0x14ea4d];return _0x3da69f;};'use strict';var EventEmitter=require(_0xb151('0x0'));var WhatsappInteraction=require('../../mysqldb')['db']['WhatsappInteraction'];var WhatsappMessage=require(_0xb151('0x1'))['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xb151('0x2')](0x0);var events={'afterCreate':_0xb151('0x3'),'afterUpdate':_0xb151('0x4'),'afterDestroy':'remove'};function emitEvent(_0x4a9d3f){return function(_0x3adedf,_0x2780a8,_0x56b93e){_0x3adedf[_0xb151('0x5')]({'attributes':['id'],'raw':!![]})['then'](function(_0xd89657){_0x3adedf[_0xb151('0x6')](_0xb151('0x7'),_0xd89657['map'](function(_0x47baa2){return{'id':_0x47baa2['id']};}));return WhatsappMessage[_0xb151('0x8')]({'where':{'WhatsappInteractionId':_0x3adedf['id'],'direction':'in','read':![]},'raw':!![]});})[_0xb151('0x9')](function(_0x493540){_0x3adedf['setDataValue'](_0xb151('0xa'),_0x493540[_0xb151('0xb')]);WhatsappInteractionEvents[_0xb151('0xc')](_0x4a9d3f+':'+_0x3adedf['id'],_0x3adedf);WhatsappInteractionEvents[_0xb151('0xc')](_0x4a9d3f,_0x3adedf);_0x56b93e(null);})[_0xb151('0xd')](_0x56b93e(null));};}for(var e in events){if(events[_0xb151('0xe')](e)){var event=events[e];WhatsappInteraction[_0xb151('0xf')](e,emitEvent(event));}}module[_0xb151('0x10')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 283f9ca..0d6cbe9 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 _0x72e2=['exports','define','WhatsappInteraction','whatsapp_interactions','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','path','rimraf'];(function(_0x1c3b15,_0x280290){var _0x44329a=function(_0x529157){while(--_0x529157){_0x1c3b15['push'](_0x1c3b15['shift']());}};_0x44329a(++_0x280290);}(_0x72e2,0x1c3));var _0x272e=function(_0x422e9b,_0x2d73f2){_0x422e9b=_0x422e9b-0x0;var _0x243924=_0x72e2[_0x422e9b];return _0x243924;};'use strict';var _=require(_0x272e('0x0'));var util=require('util');var logger=require(_0x272e('0x1'))(_0x272e('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x272e('0x3'));var rimraf=require(_0x272e('0x4'));var config=require('../../config/environment');var attributes=require('./whatsappInteraction.attributes');module[_0x272e('0x5')]=function(_0x1f6c6e,_0x2f9ae5){return _0x1f6c6e[_0x272e('0x6')](_0x272e('0x7'),attributes,{'tableName':_0x272e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x31cb05,_0x50ca45,_0x16685d){if(_0x31cb05['changed']('closed')){_0x31cb05[_0x272e('0x9')]=moment()[_0x272e('0xa')](_0x272e('0xb'));}_0x16685d(null,_0x31cb05);}}});}; \ No newline at end of file +var _0xf454=['lodash','util','../../config/logger','moment','request-promise','./whatsappInteraction.attributes','exports','define','WhatsappInteraction','whatsapp_interactions','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x1fb212,_0x5a6eb2){var _0x55b071=function(_0x372aa8){while(--_0x372aa8){_0x1fb212['push'](_0x1fb212['shift']());}};_0x55b071(++_0x5a6eb2);}(_0xf454,0xe0));var _0x4f45=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xf454[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0x4f45('0x0'));var util=require(_0x4f45('0x1'));var logger=require(_0x4f45('0x2'))('api');var moment=require(_0x4f45('0x3'));var BPromise=require('bluebird');var rp=require(_0x4f45('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4f45('0x5'));module[_0x4f45('0x6')]=function(_0x837c19,_0x1cf479){return _0x837c19[_0x4f45('0x7')](_0x4f45('0x8'),attributes,{'tableName':_0x4f45('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4903b1,_0x47fff2,_0x4b4f0a){if(_0x4903b1['changed'](_0x4f45('0xa'))){_0x4903b1[_0x4f45('0xb')]=moment()[_0x4f45('0xc')](_0x4f45('0xd'));}_0x4b4f0a(null,_0x4903b1);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 674c3b2..46ad283 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 _0xff75=['stringify','error','code','WhatsappInteraction,\x20%s,\x20%s','message','info','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','raw','where','attributes','limit','then','AddTagsToWhatsappInteraction','find','ids','spread','AddTags','debug','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','request','request\x20sent','WhatsappInteraction,\x20%s,\x20%s,\x20%s'];(function(_0x2eed96,_0x3acd75){var _0x2fffd8=function(_0x43df82){while(--_0x43df82){_0x2eed96['push'](_0x2eed96['shift']());}};_0x2fffd8(++_0x3acd75);}(_0xff75,0x1da));var _0x5ff7=function(_0x28cab5,_0x312218){_0x28cab5=_0x28cab5-0x0;var _0x4c85e1=_0xff75[_0x28cab5];return _0x4c85e1;};'use strict';var _=require(_0x5ff7('0x0'));var util=require(_0x5ff7('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5ff7('0x2'));var fs=require('fs');var Redis=require(_0x5ff7('0x3'));var db=require(_0x5ff7('0x4'))['db'];var utils=require(_0x5ff7('0x5'));var logger=require(_0x5ff7('0x6'))(_0x5ff7('0x7'));var config=require(_0x5ff7('0x8'));var jayson=require(_0x5ff7('0x9'));var client=jayson[_0x5ff7('0xa')][_0x5ff7('0xb')]({'port':0x232a});config[_0x5ff7('0xc')]=_[_0x5ff7('0xd')](config[_0x5ff7('0xc')],{'host':_0x5ff7('0xe'),'port':0x18eb});var socket=require(_0x5ff7('0xf'))(new Redis(config[_0x5ff7('0xc')]));require(_0x5ff7('0x10'))[_0x5ff7('0x11')](socket);function respondWithRpcPromise(_0x3048e8,_0x4d5307,_0x343e41){return new BPromise(function(_0x41b64b,_0xdc8979){return client[_0x5ff7('0x12')](_0x3048e8,_0x343e41)['then'](function(_0x10843a){logger['info']('WhatsappInteraction,\x20%s,\x20%s',_0x4d5307,_0x5ff7('0x13'));logger['debug'](_0x5ff7('0x14'),_0x4d5307,_0x5ff7('0x13'),JSON[_0x5ff7('0x15')](_0x10843a));if(_0x10843a['error']){if(_0x10843a[_0x5ff7('0x16')][_0x5ff7('0x17')]===0x1f4){logger['error'](_0x5ff7('0x18'),_0x4d5307,_0x10843a[_0x5ff7('0x16')][_0x5ff7('0x19')]);return _0xdc8979(_0x10843a[_0x5ff7('0x16')][_0x5ff7('0x19')]);}logger[_0x5ff7('0x16')](_0x5ff7('0x18'),_0x4d5307,_0x10843a[_0x5ff7('0x16')][_0x5ff7('0x19')]);return _0x41b64b(_0x10843a[_0x5ff7('0x16')][_0x5ff7('0x19')]);}else{logger[_0x5ff7('0x1a')]('WhatsappInteraction,\x20%s,\x20%s',_0x4d5307,'request\x20sent');_0x41b64b(_0x10843a[_0x5ff7('0x1b')]['message']);}})[_0x5ff7('0x1c')](function(_0x4ead16){logger['error']('WhatsappInteraction,\x20%s,\x20%s',_0x4d5307,_0x4ead16);_0xdc8979(_0x4ead16);});});}exports[_0x5ff7('0x1d')]=function(_0x58637b){var _0x333ec9=this;return new Promise(function(_0x44174d,_0x10d8eb){return db[_0x5ff7('0x1e')][_0x5ff7('0x1f')](_0x58637b[_0x5ff7('0x20')],{'raw':_0x58637b[_0x5ff7('0x21')]?_0x58637b['options'][_0x5ff7('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x58637b['options']?_0x58637b['options'][_0x5ff7('0x23')]||null:null,'attributes':_0x58637b[_0x5ff7('0x21')]?_0x58637b['options'][_0x5ff7('0x24')]||null:null,'limit':_0x58637b[_0x5ff7('0x21')]?_0x58637b['options'][_0x5ff7('0x25')]||null:null})[_0x5ff7('0x26')](function(_0x4e64d6){logger['info'](_0x5ff7('0x1d'),_0x58637b);logger['debug'](_0x5ff7('0x1d'),_0x58637b,JSON[_0x5ff7('0x15')](_0x4e64d6));_0x44174d(_0x4e64d6);})[_0x5ff7('0x1c')](function(_0x3a09f1){logger[_0x5ff7('0x16')](_0x5ff7('0x1d'),_0x3a09f1['message'],_0x58637b);_0x10d8eb(_0x333ec9[_0x5ff7('0x16')](0x1f4,_0x3a09f1[_0x5ff7('0x19')]));});});};exports[_0x5ff7('0x27')]=function(_0x34a47a){return new Promise(function(_0x5ccc1a,_0x27be34){return db[_0x5ff7('0x1e')][_0x5ff7('0x28')]({'where':_0x34a47a[_0x5ff7('0x21')]?_0x34a47a[_0x5ff7('0x21')]['where']||null:null})['then'](function(_0x4aea1c){if(_0x4aea1c){return _0x4aea1c['addTags'](_0x34a47a[_0x5ff7('0x20')][_0x5ff7('0x29')],_['omit'](_0x34a47a[_0x5ff7('0x20')],[_0x5ff7('0x29'),'id'])||{});}})[_0x5ff7('0x2a')](function(_0x532eb5){logger[_0x5ff7('0x1a')](_0x5ff7('0x2b'),_0x34a47a);logger[_0x5ff7('0x2c')](_0x5ff7('0x2b'),_0x34a47a,JSON['stringify'](_0x532eb5));_0x5ccc1a(_0x532eb5);})['catch'](function(_0x1ce94b){logger[_0x5ff7('0x16')](_0x5ff7('0x2b'),_0x1ce94b[_0x5ff7('0x19')],_0x34a47a);_0x27be34(_this[_0x5ff7('0x16')](0x1f4,_0x1ce94b[_0x5ff7('0x19')]));});});}; \ No newline at end of file +var _0x2706=['where','attributes','then','UpdateWhatsappInteraction','debug','AddTagsToWhatsappInteraction','addTags','body','ids','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','./whatsappInteraction.socket','request','info','request\x20sent','stringify','error','code','WhatsappInteraction,\x20%s,\x20%s','message','result','WhatsappInteraction','update','options'];(function(_0x559ac8,_0xde3c12){var _0x2c8f66=function(_0x72f311){while(--_0x72f311){_0x559ac8['push'](_0x559ac8['shift']());}};_0x2c8f66(++_0xde3c12);}(_0x2706,0x1a1));var _0x6270=function(_0x3df2f8,_0x16ca27){_0x3df2f8=_0x3df2f8-0x0;var _0x3d32ec=_0x2706[_0x3df2f8];return _0x3d32ec;};'use strict';var _=require(_0x6270('0x0'));var util=require(_0x6270('0x1'));var moment=require(_0x6270('0x2'));var BPromise=require(_0x6270('0x3'));var rs=require(_0x6270('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6270('0x5'))['db'];var utils=require(_0x6270('0x6'));var logger=require(_0x6270('0x7'))('rpc');var config=require(_0x6270('0x8'));var jayson=require(_0x6270('0x9'));var client=jayson[_0x6270('0xa')][_0x6270('0xb')]({'port':0x232a});config[_0x6270('0xc')]=_['defaults'](config[_0x6270('0xc')],{'host':_0x6270('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6270('0xc')]));require(_0x6270('0xe'))['register'](socket);function respondWithRpcPromise(_0x1d02ec,_0x51a4cc,_0x577f36){return new BPromise(function(_0x1817d6,_0x577ce8){return client[_0x6270('0xf')](_0x1d02ec,_0x577f36)['then'](function(_0x4eac49){logger[_0x6270('0x10')]('WhatsappInteraction,\x20%s,\x20%s',_0x51a4cc,_0x6270('0x11'));logger['debug']('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x51a4cc,_0x6270('0x11'),JSON[_0x6270('0x12')](_0x4eac49));if(_0x4eac49[_0x6270('0x13')]){if(_0x4eac49[_0x6270('0x13')][_0x6270('0x14')]===0x1f4){logger[_0x6270('0x13')](_0x6270('0x15'),_0x51a4cc,_0x4eac49[_0x6270('0x13')][_0x6270('0x16')]);return _0x577ce8(_0x4eac49[_0x6270('0x13')][_0x6270('0x16')]);}logger[_0x6270('0x13')](_0x6270('0x15'),_0x51a4cc,_0x4eac49[_0x6270('0x13')]['message']);return _0x1817d6(_0x4eac49['error'][_0x6270('0x16')]);}else{logger[_0x6270('0x10')]('WhatsappInteraction,\x20%s,\x20%s',_0x51a4cc,'request\x20sent');_0x1817d6(_0x4eac49[_0x6270('0x17')][_0x6270('0x16')]);}})['catch'](function(_0x43d6dd){logger['error'](_0x6270('0x15'),_0x51a4cc,_0x43d6dd);_0x577ce8(_0x43d6dd);});});}exports['UpdateWhatsappInteraction']=function(_0xa7703e){var _0x33892a=this;return new Promise(function(_0x135a72,_0x250851){return db[_0x6270('0x18')][_0x6270('0x19')](_0xa7703e['body'],{'raw':_0xa7703e[_0x6270('0x1a')]?_0xa7703e[_0x6270('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xa7703e[_0x6270('0x1a')]?_0xa7703e[_0x6270('0x1a')][_0x6270('0x1b')]||null:null,'attributes':_0xa7703e[_0x6270('0x1a')]?_0xa7703e['options'][_0x6270('0x1c')]||null:null,'limit':_0xa7703e['options']?_0xa7703e[_0x6270('0x1a')]['limit']||null:null})[_0x6270('0x1d')](function(_0x2e92b7){logger[_0x6270('0x10')](_0x6270('0x1e'),_0xa7703e);logger[_0x6270('0x1f')](_0x6270('0x1e'),_0xa7703e,JSON[_0x6270('0x12')](_0x2e92b7));_0x135a72(_0x2e92b7);})['catch'](function(_0x2118be){logger[_0x6270('0x13')](_0x6270('0x1e'),_0x2118be['message'],_0xa7703e);_0x250851(_0x33892a[_0x6270('0x13')](0x1f4,_0x2118be[_0x6270('0x16')]));});});};exports[_0x6270('0x20')]=function(_0x44a031){return new Promise(function(_0x1ac2f8,_0x3ef18b){return db[_0x6270('0x18')]['find']({'where':_0x44a031[_0x6270('0x1a')]?_0x44a031[_0x6270('0x1a')][_0x6270('0x1b')]||null:null})[_0x6270('0x1d')](function(_0x5d9e97){if(_0x5d9e97){return _0x5d9e97[_0x6270('0x21')](_0x44a031[_0x6270('0x22')][_0x6270('0x23')],_['omit'](_0x44a031[_0x6270('0x22')],[_0x6270('0x23'),'id'])||{});}})['spread'](function(_0x2c320b){logger[_0x6270('0x10')](_0x6270('0x24'),_0x44a031);logger[_0x6270('0x1f')](_0x6270('0x24'),_0x44a031,JSON[_0x6270('0x12')](_0x2c320b));_0x1ac2f8(_0x2c320b);})['catch'](function(_0x44f308){logger[_0x6270('0x13')](_0x6270('0x24'),_0x44f308[_0x6270('0x16')],_0x44a031);_0x3ef18b(_this[_0x6270('0x13')](0x1f4,_0x44f308[_0x6270('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index d47b196..60b081c 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 _0x970c=['update','emit','removeListener','length','./whatsappInteraction.events','save','remove'];(function(_0x36f00d,_0x350098){var _0x526479=function(_0x4c2645){while(--_0x4c2645){_0x36f00d['push'](_0x36f00d['shift']());}};_0x526479(++_0x350098);}(_0x970c,0x131));var _0xc970=function(_0x5ec5c0,_0x32ceea){_0x5ec5c0=_0x5ec5c0-0x0;var _0x49781c=_0x970c[_0x5ec5c0];return _0x49781c;};'use strict';var WhatsappInteractionEvents=require(_0xc970('0x0'));var events=[_0xc970('0x1'),_0xc970('0x2'),_0xc970('0x3')];function createListener(_0x1bfe68,_0x4309ce){return function(_0x574328){_0x4309ce[_0xc970('0x4')](_0x1bfe68,_0x574328);};}function removeListener(_0x573281,_0x3c0289){return function(){WhatsappInteractionEvents[_0xc970('0x5')](_0x573281,_0x3c0289);};}exports['register']=function(_0x39f7db){for(var _0x534901=0x0,_0x38a037=events[_0xc970('0x6')];_0x534901<_0x38a037;_0x534901++){var _0xab857f=events[_0x534901];var _0x2a2403=createListener('whatsappInteraction:'+_0xab857f,_0x39f7db);WhatsappInteractionEvents['on'](_0xab857f,_0x2a2403);}}; \ No newline at end of file +var _0xb5ec=['emit','removeListener','register','length','./whatsappInteraction.events','remove'];(function(_0x5483e9,_0x5eb493){var _0x285770=function(_0x5a08e4){while(--_0x5a08e4){_0x5483e9['push'](_0x5483e9['shift']());}};_0x285770(++_0x5eb493);}(_0xb5ec,0x112));var _0xcb5e=function(_0x27330f,_0x43f081){_0x27330f=_0x27330f-0x0;var _0x611c4d=_0xb5ec[_0x27330f];return _0x611c4d;};'use strict';var WhatsappInteractionEvents=require(_0xcb5e('0x0'));var events=['save',_0xcb5e('0x1'),'update'];function createListener(_0x5aa313,_0x629893){return function(_0x5171a3){_0x629893[_0xcb5e('0x2')](_0x5aa313,_0x5171a3);};}function removeListener(_0x5cf599,_0x3de9b7){return function(){WhatsappInteractionEvents[_0xcb5e('0x3')](_0x5cf599,_0x3de9b7);};}exports[_0xcb5e('0x4')]=function(_0x14114e){for(var _0x1cd280=0x0,_0xff2ec8=events[_0xcb5e('0x5')];_0x1cd280<_0xff2ec8;_0x1cd280++){var _0x42ff9a=events[_0x1cd280];var _0x180665=createListener('whatsappInteraction:'+_0x42ff9a,_0x14114e);WhatsappInteractionEvents['on'](_0x42ff9a,_0x180665);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 9cefbbe..d42dcff 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 _0x86cd=['destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','post','tracked','whatsappmessage:create','create','status','put','/:id/accept','/:id/reject','reject','delete'];(function(_0x3e81cc,_0x3b5204){var _0x542413=function(_0x3bcbb0){while(--_0x3bcbb0){_0x3e81cc['push'](_0x3e81cc['shift']());}};_0x542413(++_0x3b5204);}(_0x86cd,0x12e));var _0xd86c=function(_0x87b0ff,_0x314389){_0x87b0ff=_0x87b0ff-0x0;var _0x3bc0b2=_0x86cd[_0x87b0ff];return _0x3bc0b2;};'use strict';var multer=require(_0xd86c('0x0'));var util=require('util');var path=require(_0xd86c('0x1'));var timeout=require(_0xd86c('0x2'));var express=require(_0xd86c('0x3'));var router=express[_0xd86c('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd86c('0x5'));var interaction=require(_0xd86c('0x6'));var config=require('../../config/environment');var controller=require('./whatsappMessage.controller');router[_0xd86c('0x7')]('/',auth[_0xd86c('0x8')](),controller[_0xd86c('0x9')]);router[_0xd86c('0x7')](_0xd86c('0xa'),auth[_0xd86c('0x8')](),controller[_0xd86c('0xb')]);router[_0xd86c('0x7')](_0xd86c('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xd86c('0xd')]('/',auth['isAuthenticated'](),interaction[_0xd86c('0xe')]('whatsapp',_0xd86c('0xf')),controller[_0xd86c('0x10')]);router[_0xd86c('0xd')]('/:id/status',controller[_0xd86c('0x11')]);router[_0xd86c('0x12')](_0xd86c('0xc'),auth[_0xd86c('0x8')](),controller['update']);router['put'](_0xd86c('0x13'),auth[_0xd86c('0x8')](),controller['accept']);router['put'](_0xd86c('0x14'),auth[_0xd86c('0x8')](),controller[_0xd86c('0x15')]);router[_0xd86c('0x16')](_0xd86c('0xc'),auth[_0xd86c('0x8')](),controller[_0xd86c('0x17')]);module[_0xd86c('0x18')]=router; \ No newline at end of file +var _0x77dd=['get','/describe','describe','/:id','show','post','tracked','whatsappmessage:create','create','/:id/status','put','update','/:id/accept','accept','/:id/reject','delete','destroy','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','isAuthenticated','index'];(function(_0x136aae,_0x21f34e){var _0x592cdc=function(_0x473d5c){while(--_0x473d5c){_0x136aae['push'](_0x136aae['shift']());}};_0x592cdc(++_0x21f34e);}(_0x77dd,0x1a6));var _0xd77d=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0x77dd[_0x54d4fe];return _0x1ab5bb;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xd77d('0x0'));var timeout=require('connect-timeout');var express=require(_0xd77d('0x1'));var router=express[_0xd77d('0x2')]();var fs_extra=require(_0xd77d('0x3'));var auth=require(_0xd77d('0x4'));var interaction=require(_0xd77d('0x5'));var config=require(_0xd77d('0x6'));var controller=require(_0xd77d('0x7'));router['get']('/',auth[_0xd77d('0x8')](),controller[_0xd77d('0x9')]);router[_0xd77d('0xa')](_0xd77d('0xb'),auth[_0xd77d('0x8')](),controller[_0xd77d('0xc')]);router[_0xd77d('0xa')](_0xd77d('0xd'),auth[_0xd77d('0x8')](),controller[_0xd77d('0xe')]);router[_0xd77d('0xf')]('/',auth['isAuthenticated'](),interaction[_0xd77d('0x10')]('whatsapp',_0xd77d('0x11')),controller[_0xd77d('0x12')]);router['post'](_0xd77d('0x13'),controller['status']);router[_0xd77d('0x14')](_0xd77d('0xd'),auth[_0xd77d('0x8')](),controller[_0xd77d('0x15')]);router[_0xd77d('0x14')](_0xd77d('0x16'),auth[_0xd77d('0x8')](),controller[_0xd77d('0x17')]);router[_0xd77d('0x14')](_0xd77d('0x18'),auth['isAuthenticated'](),controller['reject']);router[_0xd77d('0x19')](_0xd77d('0xd'),auth[_0xd77d('0x8')](),controller[_0xd77d('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index d250fc7..06e64de 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 _0x889d=['sequelize','exports','TEXT','BOOLEAN','out','STRING','DATE'];(function(_0x4294da,_0x1c4b0f){var _0x33ea8a=function(_0x5559d7){while(--_0x5559d7){_0x4294da['push'](_0x4294da['shift']());}};_0x33ea8a(++_0x1c4b0f);}(_0x889d,0x142));var _0xd889=function(_0x176231,_0x43db84){_0x176231=_0x176231-0x0;var _0x456c46=_0x889d[_0x176231];return _0x456c46;};'use strict';var Sequelize=require(_0xd889('0x0'));module[_0xd889('0x1')]={'body':{'type':Sequelize[_0xd889('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xd889('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0xd889('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0xd889('0x5')](0xbe)},'phone':{'type':Sequelize[_0xd889('0x5')]},'readAt':{'type':Sequelize[_0xd889('0x6')]},'secret':{'type':Sequelize[_0xd889('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xd889('0x5')]},'providerResponse':{'type':Sequelize[_0xd889('0x2')]}}; \ No newline at end of file +var _0x27f6=['ENUM','out','STRING','DATE','exports','TEXT','BOOLEAN'];(function(_0x51b4f6,_0x2470a6){var _0x5ae8ee=function(_0xc5e8ae){while(--_0xc5e8ae){_0x51b4f6['push'](_0x51b4f6['shift']());}};_0x5ae8ee(++_0x2470a6);}(_0x27f6,0x170));var _0x627f=function(_0x2c42cb,_0x403723){_0x2c42cb=_0x2c42cb-0x0;var _0x36a538=_0x27f6[_0x2c42cb];return _0x36a538;};'use strict';var Sequelize=require('sequelize');module[_0x627f('0x0')]={'body':{'type':Sequelize[_0x627f('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x627f('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x627f('0x3')]('in','out'),'defaultValue':_0x627f('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0x627f('0x5')](0xbe)},'phone':{'type':Sequelize[_0x627f('0x5')]},'readAt':{'type':Sequelize[_0x627f('0x6')]},'secret':{'type':Sequelize[_0x627f('0x2')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x627f('0x5')]},'providerResponse':{'type':Sequelize[_0x627f('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 0b51cf8..b217ea3 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 _0x085d=['internal','interface','format','channel','EventManager','rejectmessage','WhatsappAccount','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','read','WhatsappAccount,\x20%s,\x20%s,\x20%s','util','lodash','ioredis','../../components/interaction/service','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./whatsappMessage.socket','jayson/promise','client','http','whatsapp-interactions','request','then','info','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappMessage,\x20%s,\x20%s','message','catch','status','json','offset','undefined','limit','count','set','Content-Range','update','end','sendStatus','stack','name','index','map','WhatsappMessage','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','rawAttributes','length','find','create','body','destroy','describe','accept','reject','whatsapp','UserId','user','agent','WhatsappInteractionId','get','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','rejectMessage','ContactId','sequelize','Sequelize','QueryTypes','User','fullname','email'];(function(_0x153676,_0x47a834){var _0x4752dd=function(_0x162d90){while(--_0x162d90){_0x153676['push'](_0x153676['shift']());}};_0x4752dd(++_0x47a834);}(_0x085d,0xed));var _0xd085=function(_0x3df871,_0xda2e11){_0x3df871=_0x3df871-0x0;var _0x570f7b=_0x085d[_0x3df871];return _0x570f7b;};'use strict';var util=require(_0xd085('0x0'));var _=require(_0xd085('0x1'));var Redis=require(_0xd085('0x2'));var interactionService=require(_0xd085('0x3'));var qs=require('../../components/parsers/qs');var logger=require(_0xd085('0x4'))(_0xd085('0x5'));var config=require(_0xd085('0x6'));var db=require(_0xd085('0x7'))['db'];config[_0xd085('0x8')]=_[_0xd085('0x9')](config[_0xd085('0x8')],{'host':_0xd085('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd085('0x8')]));require(_0xd085('0xb'))['register'](socket);var jayson=require(_0xd085('0xc'));var client=jayson[_0xd085('0xd')]['http']({'port':0x232c});var client9002=jayson[_0xd085('0xd')][_0xd085('0xe')]({'port':0x232a});var interaction_log=require('../../config/logger')(_0xd085('0xf'));function respondWithRpcPromise(_0x2703a3,_0x5b7db8,_0x572873,_0x1fbaeb){return new Promise(function(_0x15a4af,_0x70fb27){var _0x55ac85=_0x1fbaeb||client;return _0x55ac85[_0xd085('0x10')](_0x2703a3,_0x572873)[_0xd085('0x11')](function(_0x1c22ef){logger[_0xd085('0x12')]('WhatsappMessage,\x20%s,\x20%s',_0x5b7db8,_0xd085('0x13'));logger[_0xd085('0x14')](_0xd085('0x15'),_0x5b7db8,_0xd085('0x13'),JSON[_0xd085('0x16')](_0x1c22ef));if(_0x1c22ef[_0xd085('0x17')]){if(_0x1c22ef[_0xd085('0x17')][_0xd085('0x18')]===0x1f4){logger[_0xd085('0x17')](_0xd085('0x19'),_0x5b7db8,_0x1c22ef['error'][_0xd085('0x1a')]);return _0x70fb27(_0x1c22ef[_0xd085('0x17')][_0xd085('0x1a')]);}logger[_0xd085('0x17')](_0xd085('0x19'),_0x5b7db8,_0x1c22ef[_0xd085('0x17')][_0xd085('0x1a')]);return _0x15a4af(_0x1c22ef['error'][_0xd085('0x1a')]);}else{logger[_0xd085('0x12')](_0xd085('0x19'),_0x5b7db8,_0xd085('0x13'));_0x15a4af(_0x1c22ef['result'][_0xd085('0x1a')]);}})[_0xd085('0x1b')](function(_0x4236ad){logger[_0xd085('0x17')](_0xd085('0x19'),_0x5b7db8,_0x4236ad);_0x70fb27(_0x4236ad);});});}function respondWithResult(_0x2e7bac,_0x54835c){_0x54835c=_0x54835c||0xc8;return function(_0x31c312){if(_0x31c312){return _0x2e7bac[_0xd085('0x1c')](_0x54835c)[_0xd085('0x1d')](_0x31c312);}};}function respondWithFilteredResult(_0x4080b5,_0x42f638){return function(_0x253efb){if(_0x253efb){var _0xfec688=typeof _0x42f638[_0xd085('0x1e')]===_0xd085('0x1f')&&typeof _0x42f638[_0xd085('0x20')]==='undefined';var _0x5b004b=_0x253efb[_0xd085('0x21')];var _0x41b997=_0xfec688?0x0:_0x42f638[_0xd085('0x1e')];var _0x5bb438=_0xfec688?_0x253efb[_0xd085('0x21')]:_0x42f638[_0xd085('0x1e')]+_0x42f638[_0xd085('0x20')];var _0x11d882;if(_0x5bb438>=_0x5b004b){_0x5bb438=_0x5b004b;_0x11d882=0xc8;}else{_0x11d882=0xce;}_0x4080b5[_0xd085('0x1c')](_0x11d882);return _0x4080b5[_0xd085('0x22')](_0xd085('0x23'),_0x41b997+'-'+_0x5bb438+'/'+_0x5b004b)[_0xd085('0x1d')](_0x253efb);}return null;};}function saveUpdates(_0xe15ebe){return function(_0x52627a){if(_0x52627a){return _0x52627a[_0xd085('0x24')](_0xe15ebe)[_0xd085('0x11')](function(_0xfbb092){return _0xfbb092;});}return null;};}function removeEntity(_0x3d69f6){return function(_0x42bf9a){if(_0x42bf9a){return _0x42bf9a['destroy']()[_0xd085('0x11')](function(){_0x3d69f6['status'](0xcc)[_0xd085('0x25')]();});}};}function handleEntityNotFound(_0x427481){return function(_0x55c372){if(!_0x55c372){_0x427481[_0xd085('0x26')](0x194);}return _0x55c372;};}function handleError(_0x7f71cf,_0x566a88){_0x566a88=_0x566a88||0x1f4;return function(_0x8cafa){logger[_0xd085('0x17')](_0x8cafa[_0xd085('0x27')]);if(_0x8cafa[_0xd085('0x28')]){delete _0x8cafa[_0xd085('0x28')];}_0x7f71cf['status'](_0x566a88)['send'](_0x8cafa);};}exports[_0xd085('0x29')]=function(_0x33cee9,_0x5842bd){var _0x5b9688={},_0x29024b={},_0x14ffd1={'count':0x0,'rows':[]};var _0x10408b=_[_0xd085('0x2a')](db[_0xd085('0x2b')]['rawAttributes'],function(_0x3fcb93){return{'name':_0x3fcb93[_0xd085('0x2c')],'type':_0x3fcb93[_0xd085('0x2d')][_0xd085('0x2e')]};});_0x29024b[_0xd085('0x2f')]=_[_0xd085('0x2a')](_0x10408b,'name');_0x29024b[_0xd085('0x30')]=_[_0xd085('0x31')](_0x33cee9[_0xd085('0x30')]);_0x29024b['filters']=_[_0xd085('0x32')](_0x29024b['model'],_0x29024b[_0xd085('0x30')]);_0x5b9688[_0xd085('0x33')]=_['intersection'](_0x29024b['model'],qs[_0xd085('0x34')](_0x33cee9[_0xd085('0x30')][_0xd085('0x34')]));_0x5b9688[_0xd085('0x33')]=_0x5b9688[_0xd085('0x33')]['length']?_0x5b9688[_0xd085('0x33')]:_0x29024b[_0xd085('0x2f')];if(!_0x33cee9[_0xd085('0x30')][_0xd085('0x35')](_0xd085('0x36'))){_0x5b9688[_0xd085('0x20')]=qs[_0xd085('0x20')](_0x33cee9['query'][_0xd085('0x20')]);_0x5b9688['offset']=qs[_0xd085('0x1e')](_0x33cee9[_0xd085('0x30')][_0xd085('0x1e')]);}_0x5b9688[_0xd085('0x37')]=qs['sort'](_0x33cee9[_0xd085('0x30')][_0xd085('0x38')]);_0x5b9688[_0xd085('0x39')]=qs[_0xd085('0x3a')](_[_0xd085('0x3b')](_0x33cee9['query'],_0x29024b[_0xd085('0x3a')]),_0x10408b);if(_0x33cee9[_0xd085('0x30')][_0xd085('0x3c')]){_0x5b9688[_0xd085('0x39')]=_[_0xd085('0x3d')](_0x5b9688[_0xd085('0x39')],{'$or':_[_0xd085('0x2a')](_0x10408b,function(_0x187016){if(_0x187016[_0xd085('0x2d')]!=='VIRTUAL'){var _0x50f1ed={};_0x50f1ed[_0x187016[_0xd085('0x28')]]={'$like':'%'+_0x33cee9[_0xd085('0x30')]['filter']+'%'};return _0x50f1ed;}})});}_0x5b9688=_[_0xd085('0x3d')]({},_0x5b9688,_0x33cee9[_0xd085('0x3e')]);var _0x1ed809={'where':_0x5b9688[_0xd085('0x39')]};return db[_0xd085('0x2b')][_0xd085('0x21')](_0x1ed809)[_0xd085('0x11')](function(_0x2d18c9){_0x14ffd1[_0xd085('0x21')]=_0x2d18c9;if(_0x33cee9[_0xd085('0x30')][_0xd085('0x3f')]){_0x5b9688[_0xd085('0x40')]=[{'all':!![]}];}return db[_0xd085('0x2b')][_0xd085('0x41')](_0x5b9688);})[_0xd085('0x11')](function(_0x139ae8){_0x14ffd1[_0xd085('0x42')]=_0x139ae8;return _0x14ffd1;})[_0xd085('0x11')](respondWithFilteredResult(_0x5842bd,_0x5b9688))['catch'](handleError(_0x5842bd,null));};exports[_0xd085('0x43')]=function(_0x4f651c,_0x1b0226){var _0x216126={'raw':!![],'where':{'id':_0x4f651c[_0xd085('0x44')]['id']}},_0xc7465b={};_0xc7465b[_0xd085('0x2f')]=_[_0xd085('0x31')](db[_0xd085('0x2b')][_0xd085('0x45')]);_0xc7465b[_0xd085('0x30')]=_[_0xd085('0x31')](_0x4f651c[_0xd085('0x30')]);_0xc7465b['filters']=_[_0xd085('0x32')](_0xc7465b[_0xd085('0x2f')],_0xc7465b[_0xd085('0x30')]);_0x216126['attributes']=_[_0xd085('0x32')](_0xc7465b['model'],qs[_0xd085('0x34')](_0x4f651c[_0xd085('0x30')][_0xd085('0x34')]));_0x216126[_0xd085('0x33')]=_0x216126[_0xd085('0x33')][_0xd085('0x46')]?_0x216126[_0xd085('0x33')]:_0xc7465b[_0xd085('0x2f')];if(_0x4f651c[_0xd085('0x30')][_0xd085('0x3f')]){_0x216126[_0xd085('0x40')]=[{'all':!![]}];}_0x216126=_['merge']({},_0x216126,_0x4f651c[_0xd085('0x3e')]);return db[_0xd085('0x2b')][_0xd085('0x47')](_0x216126)[_0xd085('0x11')](handleEntityNotFound(_0x1b0226,null))[_0xd085('0x11')](respondWithResult(_0x1b0226,null))['catch'](handleError(_0x1b0226,null));};exports[_0xd085('0x48')]=function(_0x74cd4f,_0x52e6e4){return db[_0xd085('0x2b')][_0xd085('0x48')](_0x74cd4f['body'],{})[_0xd085('0x11')](respondWithResult(_0x52e6e4,0xc9))['catch'](handleError(_0x52e6e4,null));};exports[_0xd085('0x24')]=function(_0x5342eb,_0x1b50ba){if(_0x5342eb[_0xd085('0x49')]['id']){delete _0x5342eb[_0xd085('0x49')]['id'];}return db[_0xd085('0x2b')][_0xd085('0x47')]({'where':{'id':_0x5342eb['params']['id']}})[_0xd085('0x11')](handleEntityNotFound(_0x1b50ba,null))[_0xd085('0x11')](saveUpdates(_0x5342eb[_0xd085('0x49')],null))[_0xd085('0x11')](respondWithResult(_0x1b50ba,null))[_0xd085('0x1b')](handleError(_0x1b50ba,null));};exports[_0xd085('0x4a')]=function(_0x344d5c,_0x589cd2){return db['WhatsappMessage'][_0xd085('0x47')]({'where':{'id':_0x344d5c[_0xd085('0x44')]['id']}})['then'](handleEntityNotFound(_0x589cd2,null))['then'](removeEntity(_0x589cd2,null))[_0xd085('0x1b')](handleError(_0x589cd2,null));};exports['describe']=function(_0x3f7afe,_0x3c9c1e){return db[_0xd085('0x2b')][_0xd085('0x4b')]()['then'](respondWithResult(_0x3c9c1e,null))[_0xd085('0x1b')](handleError(_0x3c9c1e,null));};exports[_0xd085('0x4c')]=function(_0x649f55,_0x281539){var _0x2c1aa5='whatsapp';return interactionService['acceptMessage'](_0x649f55,_0x2c1aa5)[_0xd085('0x11')](respondWithResult(_0x281539,null))[_0xd085('0x1b')](handleError(_0x281539,null));};exports[_0xd085('0x4d')]=function(_0x279fad,_0x20f19c){var _0x4fc7e4={'agent':{},'channel':_0xd085('0x4e')};if(_0x279fad[_0xd085('0x49')]['id']){delete _0x279fad['body']['id'];}_0x279fad[_0xd085('0x49')][_0xd085('0x4f')]=_0x279fad[_0xd085('0x49')][_0xd085('0x4f')]||_0x279fad[_0xd085('0x50')]['id'];_0x4fc7e4[_0xd085('0x51')]['id']=_0x279fad[_0xd085('0x49')]['UserId'];return db[_0xd085('0x2b')][_0xd085('0x47')]({'where':{'id':_0x279fad[_0xd085('0x44')]['id'],'UserId':null}})[_0xd085('0x11')](handleEntityNotFound(_0x20f19c,null))['then'](function(_0x399a91){if(_0x399a91){_0x4fc7e4['message']=_0x399a91['get']({'plain':!![]});return db['WhatsappInteraction'][_0xd085('0x47')]({'where':{'id':_0x399a91[_0xd085('0x52')]}});}return null;})[_0xd085('0x11')](handleEntityNotFound(_0x20f19c,null))['then'](function(_0x5a6304){if(_0x5a6304){_0x4fc7e4['interaction']=_0x5a6304[_0xd085('0x53')]({'plain':!![]});interaction_log[_0xd085('0x12')](_0xd085('0x54'),_0x279fad[_0xd085('0x50')]['id'],_0x279fad['user']['name'],_0x279fad[_0xd085('0x50')][_0xd085('0x55')],_0x4fc7e4[_0xd085('0x56')]['id'],_0x279fad['body']?JSON['stringify'](_0x279fad[_0xd085('0x49')]):_0xd085('0x57'));return respondWithRpcPromise('RejectMessage',_0xd085('0x58'),_0x4fc7e4);}return null;})[_0xd085('0x11')](function(_0x1c3352){var _0x3ef583='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x1c3352['message'][_0xd085('0x59')];return db[_0xd085('0x5a')][_0xd085('0x30')](_0x3ef583,{'type':db[_0xd085('0x5b')][_0xd085('0x5c')]['SELECT'],'raw':!![]})[_0xd085('0x11')](function(_0x546e93){return _0x546e93;});})['then'](function(_0x4ca2ef){if(_0x4ca2ef){_0x4fc7e4['message']['contact']=_0x4ca2ef[0x0];if(!_0x279fad[_0xd085('0x49')][_0xd085('0x4f')])return;return db[_0xd085('0x5d')][_0xd085('0x47')]({'where':{'id':_0x279fad[_0xd085('0x49')]['UserId'],'role':_0xd085('0x51')},'attributes':['id','name',_0xd085('0x5e'),_0xd085('0x5f'),_0xd085('0x60')],'raw':!![]});}return null;})[_0xd085('0x11')](function(_0x36bc7f){if(!_0x36bc7f)return null;_0x4fc7e4['message'][_0xd085('0x51')]=_0x36bc7f;return _0x4fc7e4;})[_0xd085('0x11')](function(_0x458875){if(_0x458875){_0x458875[_0xd085('0x1a')][_0xd085('0x61')]=util[_0xd085('0x62')]('SIP/%s',_0x279fad[_0xd085('0x50')]['name']);_0x458875[_0xd085('0x1a')][_0xd085('0x63')]=_0x4fc7e4[_0xd085('0x63')];_0x458875[_0xd085('0x1a')]['motionChannel']=_0x4fc7e4[_0xd085('0x63')];_0x458875['message']['event']='reject';respondWithRpcPromise(_0xd085('0x64'),'EventManager',{'event':_0xd085('0x65'),'message':_0x458875[_0xd085('0x1a')]},client9002);return _0x4fc7e4;}return null;})['then'](respondWithResult(_0x20f19c,null))['catch'](handleError(_0x20f19c,null));};exports['status']=function(_0x5bd444,_0x552010){if(_0x5bd444[_0xd085('0x49')]['id']){delete _0x5bd444['body']['id'];}var _0x1139e2;return db['WhatsappMessage']['find']({'where':{'id':_0x5bd444[_0xd085('0x44')]['id']}})['then'](handleEntityNotFound(_0x552010,null))[_0xd085('0x11')](function(_0x3abb05){if(_0x3abb05){_0x1139e2=_0x3abb05;return db[_0xd085('0x66')][_0xd085('0x47')]({'where':{'id':_0x3abb05['WhatsappAccountId']}});}})[_0xd085('0x11')](handleEntityNotFound(_0x552010,null))['then'](function(_0x4bebba){if(_0x4bebba){logger[_0xd085('0x14')]('WhatsppMessage,\x20%s,\x20%s,\x20%s','status',_0xd085('0x67'),_0x4bebba[_0xd085('0x2d')],util[_0xd085('0x68')](_0x5bd444['body'],{'showHidden':![],'depth':null}));switch(_0x4bebba[_0xd085('0x2d')]){case _0xd085('0x69'):if(_0x5bd444[_0xd085('0x49')][_0xd085('0x6a')]&&_0x5bd444['body']['MessageSid']===_0x1139e2[_0xd085('0x6b')]&&_0x5bd444['body'][_0xd085('0x6c')]&&_0x5bd444['body']['MessageStatus']===_0xd085('0x6d')){return _0x1139e2['update']({'read':!![]});}else{logger[_0xd085('0x17')](_0xd085('0x6e'),_0xd085('0x1c'),_0xd085('0x69'),util[_0xd085('0x68')](_0x5bd444[_0xd085('0x49')],{'showHidden':![],'depth':null}));}break;}return _0x1139e2;}})[_0xd085('0x11')](respondWithResult(_0x552010,null))[_0xd085('0x1b')](handleError(_0x552010,null));}; \ No newline at end of file +var _0x32bc=['status','end','sendStatus','stack','name','send','index','map','WhatsappMessage','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','options','count','includeAll','findAll','rows','show','params','include','create','body','update','destroy','describe','whatsapp','acceptMessage','reject','UserId','user','agent','get','WhatsappInteraction','WhatsappInteractionId','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','contact','find','fullname','email','internal','interface','format','SIP/%s','channel','motionChannel','event','EventManager','rejectmessage','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','read','WhatsappAccount,\x20%s,\x20%s,\x20%s','util','../../components/interaction/service','../../config/logger','api','../../config/environment','redis','defaults','localhost','./whatsappMessage.socket','http','whatsapp-interactions','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','json','offset','undefined','limit','set','Content-Range'];(function(_0x1a177c,_0x4ec861){var _0x49f901=function(_0x4be7ce){while(--_0x4be7ce){_0x1a177c['push'](_0x1a177c['shift']());}};_0x49f901(++_0x4ec861);}(_0x32bc,0xc2));var _0xc32b=function(_0x2489de,_0x1e1ad2){_0x2489de=_0x2489de-0x0;var _0x36c6a3=_0x32bc[_0x2489de];return _0x36c6a3;};'use strict';var util=require(_0xc32b('0x0'));var _=require('lodash');var Redis=require('ioredis');var interactionService=require(_0xc32b('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0xc32b('0x2'))(_0xc32b('0x3'));var config=require(_0xc32b('0x4'));var db=require('../../mysqldb')['db'];config[_0xc32b('0x5')]=_[_0xc32b('0x6')](config[_0xc32b('0x5')],{'host':_0xc32b('0x7'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc32b('0x5')]));require(_0xc32b('0x8'))['register'](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xc32b('0x9')]({'port':0x232c});var client9002=jayson['client'][_0xc32b('0x9')]({'port':0x232a});var interaction_log=require(_0xc32b('0x2'))(_0xc32b('0xa'));function respondWithRpcPromise(_0xf84585,_0x5b21ad,_0x5a706a,_0x4fa4ef){return new Promise(function(_0x42a2ba,_0x2cef7c){var _0xb3e860=_0x4fa4ef||client;return _0xb3e860[_0xc32b('0xb')](_0xf84585,_0x5a706a)[_0xc32b('0xc')](function(_0x497069){logger[_0xc32b('0xd')](_0xc32b('0xe'),_0x5b21ad,_0xc32b('0xf'));logger[_0xc32b('0x10')](_0xc32b('0x11'),_0x5b21ad,_0xc32b('0xf'),JSON[_0xc32b('0x12')](_0x497069));if(_0x497069[_0xc32b('0x13')]){if(_0x497069[_0xc32b('0x13')][_0xc32b('0x14')]===0x1f4){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x5b21ad,_0x497069[_0xc32b('0x13')][_0xc32b('0x15')]);return _0x2cef7c(_0x497069[_0xc32b('0x13')][_0xc32b('0x15')]);}logger[_0xc32b('0x13')]('WhatsappMessage,\x20%s,\x20%s',_0x5b21ad,_0x497069[_0xc32b('0x13')][_0xc32b('0x15')]);return _0x42a2ba(_0x497069[_0xc32b('0x13')]['message']);}else{logger[_0xc32b('0xd')](_0xc32b('0xe'),_0x5b21ad,_0xc32b('0xf'));_0x42a2ba(_0x497069[_0xc32b('0x16')][_0xc32b('0x15')]);}})[_0xc32b('0x17')](function(_0x411144){logger['error'](_0xc32b('0xe'),_0x5b21ad,_0x411144);_0x2cef7c(_0x411144);});});}function respondWithResult(_0x4bedfb,_0x10c2f0){_0x10c2f0=_0x10c2f0||0xc8;return function(_0x161d22){if(_0x161d22){return _0x4bedfb['status'](_0x10c2f0)[_0xc32b('0x18')](_0x161d22);}};}function respondWithFilteredResult(_0x5b9b3a,_0x229766){return function(_0x8d9b88){if(_0x8d9b88){var _0x3d88ea=typeof _0x229766[_0xc32b('0x19')]===_0xc32b('0x1a')&&typeof _0x229766['limit']===_0xc32b('0x1a');var _0x13ea4e=_0x8d9b88['count'];var _0x55579d=_0x3d88ea?0x0:_0x229766[_0xc32b('0x19')];var _0xa62ebf=_0x3d88ea?_0x8d9b88['count']:_0x229766[_0xc32b('0x19')]+_0x229766[_0xc32b('0x1b')];var _0x4a5dbc;if(_0xa62ebf>=_0x13ea4e){_0xa62ebf=_0x13ea4e;_0x4a5dbc=0xc8;}else{_0x4a5dbc=0xce;}_0x5b9b3a['status'](_0x4a5dbc);return _0x5b9b3a[_0xc32b('0x1c')](_0xc32b('0x1d'),_0x55579d+'-'+_0xa62ebf+'/'+_0x13ea4e)[_0xc32b('0x18')](_0x8d9b88);}return null;};}function saveUpdates(_0x597aab){return function(_0x332717){if(_0x332717){return _0x332717['update'](_0x597aab)[_0xc32b('0xc')](function(_0x7535ac){return _0x7535ac;});}return null;};}function removeEntity(_0x485b51){return function(_0x214654){if(_0x214654){return _0x214654['destroy']()[_0xc32b('0xc')](function(){_0x485b51[_0xc32b('0x1e')](0xcc)[_0xc32b('0x1f')]();});}};}function handleEntityNotFound(_0x56ee73){return function(_0x491923){if(!_0x491923){_0x56ee73[_0xc32b('0x20')](0x194);}return _0x491923;};}function handleError(_0x182f71,_0x2c137c){_0x2c137c=_0x2c137c||0x1f4;return function(_0x300763){logger[_0xc32b('0x13')](_0x300763[_0xc32b('0x21')]);if(_0x300763[_0xc32b('0x22')]){delete _0x300763[_0xc32b('0x22')];}_0x182f71[_0xc32b('0x1e')](_0x2c137c)[_0xc32b('0x23')](_0x300763);};}exports[_0xc32b('0x24')]=function(_0x48276f,_0x75abef){var _0x421c09={},_0x1493c0={},_0x4f6e75={'count':0x0,'rows':[]};var _0x2bf147=_[_0xc32b('0x25')](db[_0xc32b('0x26')][_0xc32b('0x27')],function(_0x318563){return{'name':_0x318563[_0xc32b('0x28')],'type':_0x318563[_0xc32b('0x29')]['key']};});_0x1493c0[_0xc32b('0x2a')]=_[_0xc32b('0x25')](_0x2bf147,_0xc32b('0x22'));_0x1493c0[_0xc32b('0x2b')]=_[_0xc32b('0x2c')](_0x48276f[_0xc32b('0x2b')]);_0x1493c0[_0xc32b('0x2d')]=_[_0xc32b('0x2e')](_0x1493c0[_0xc32b('0x2a')],_0x1493c0[_0xc32b('0x2b')]);_0x421c09[_0xc32b('0x2f')]=_[_0xc32b('0x2e')](_0x1493c0['model'],qs[_0xc32b('0x30')](_0x48276f[_0xc32b('0x2b')]['fields']));_0x421c09['attributes']=_0x421c09[_0xc32b('0x2f')][_0xc32b('0x31')]?_0x421c09[_0xc32b('0x2f')]:_0x1493c0[_0xc32b('0x2a')];if(!_0x48276f[_0xc32b('0x2b')][_0xc32b('0x32')](_0xc32b('0x33'))){_0x421c09[_0xc32b('0x1b')]=qs[_0xc32b('0x1b')](_0x48276f[_0xc32b('0x2b')][_0xc32b('0x1b')]);_0x421c09['offset']=qs['offset'](_0x48276f[_0xc32b('0x2b')][_0xc32b('0x19')]);}_0x421c09[_0xc32b('0x34')]=qs['sort'](_0x48276f['query']['sort']);_0x421c09[_0xc32b('0x35')]=qs[_0xc32b('0x2d')](_[_0xc32b('0x36')](_0x48276f['query'],_0x1493c0[_0xc32b('0x2d')]),_0x2bf147);if(_0x48276f[_0xc32b('0x2b')][_0xc32b('0x37')]){_0x421c09[_0xc32b('0x35')]=_[_0xc32b('0x38')](_0x421c09[_0xc32b('0x35')],{'$or':_['map'](_0x2bf147,function(_0x1df21d){if(_0x1df21d[_0xc32b('0x29')]!=='VIRTUAL'){var _0x383d81={};_0x383d81[_0x1df21d[_0xc32b('0x22')]]={'$like':'%'+_0x48276f[_0xc32b('0x2b')][_0xc32b('0x37')]+'%'};return _0x383d81;}})});}_0x421c09=_[_0xc32b('0x38')]({},_0x421c09,_0x48276f[_0xc32b('0x39')]);var _0x48a815={'where':_0x421c09[_0xc32b('0x35')]};return db['WhatsappMessage'][_0xc32b('0x3a')](_0x48a815)[_0xc32b('0xc')](function(_0x3795c9){_0x4f6e75[_0xc32b('0x3a')]=_0x3795c9;if(_0x48276f[_0xc32b('0x2b')][_0xc32b('0x3b')]){_0x421c09['include']=[{'all':!![]}];}return db['WhatsappMessage'][_0xc32b('0x3c')](_0x421c09);})[_0xc32b('0xc')](function(_0x526b53){_0x4f6e75[_0xc32b('0x3d')]=_0x526b53;return _0x4f6e75;})[_0xc32b('0xc')](respondWithFilteredResult(_0x75abef,_0x421c09))[_0xc32b('0x17')](handleError(_0x75abef,null));};exports[_0xc32b('0x3e')]=function(_0xe9de19,_0x35e6b2){var _0x3bb5f7={'raw':!![],'where':{'id':_0xe9de19[_0xc32b('0x3f')]['id']}},_0x1983b8={};_0x1983b8[_0xc32b('0x2a')]=_[_0xc32b('0x2c')](db[_0xc32b('0x26')][_0xc32b('0x27')]);_0x1983b8[_0xc32b('0x2b')]=_['keys'](_0xe9de19['query']);_0x1983b8['filters']=_[_0xc32b('0x2e')](_0x1983b8[_0xc32b('0x2a')],_0x1983b8[_0xc32b('0x2b')]);_0x3bb5f7[_0xc32b('0x2f')]=_['intersection'](_0x1983b8[_0xc32b('0x2a')],qs[_0xc32b('0x30')](_0xe9de19[_0xc32b('0x2b')]['fields']));_0x3bb5f7[_0xc32b('0x2f')]=_0x3bb5f7['attributes'][_0xc32b('0x31')]?_0x3bb5f7[_0xc32b('0x2f')]:_0x1983b8[_0xc32b('0x2a')];if(_0xe9de19[_0xc32b('0x2b')][_0xc32b('0x3b')]){_0x3bb5f7[_0xc32b('0x40')]=[{'all':!![]}];}_0x3bb5f7=_[_0xc32b('0x38')]({},_0x3bb5f7,_0xe9de19[_0xc32b('0x39')]);return db[_0xc32b('0x26')]['find'](_0x3bb5f7)['then'](handleEntityNotFound(_0x35e6b2,null))[_0xc32b('0xc')](respondWithResult(_0x35e6b2,null))['catch'](handleError(_0x35e6b2,null));};exports[_0xc32b('0x41')]=function(_0x373d8c,_0x2d3f37){return db['WhatsappMessage'][_0xc32b('0x41')](_0x373d8c[_0xc32b('0x42')],{})[_0xc32b('0xc')](respondWithResult(_0x2d3f37,0xc9))[_0xc32b('0x17')](handleError(_0x2d3f37,null));};exports[_0xc32b('0x43')]=function(_0x193d83,_0x216dc1){if(_0x193d83[_0xc32b('0x42')]['id']){delete _0x193d83[_0xc32b('0x42')]['id'];}return db['WhatsappMessage']['find']({'where':{'id':_0x193d83[_0xc32b('0x3f')]['id']}})['then'](handleEntityNotFound(_0x216dc1,null))[_0xc32b('0xc')](saveUpdates(_0x193d83[_0xc32b('0x42')],null))[_0xc32b('0xc')](respondWithResult(_0x216dc1,null))[_0xc32b('0x17')](handleError(_0x216dc1,null));};exports[_0xc32b('0x44')]=function(_0x55efbc,_0x2039f9){return db[_0xc32b('0x26')]['find']({'where':{'id':_0x55efbc['params']['id']}})[_0xc32b('0xc')](handleEntityNotFound(_0x2039f9,null))['then'](removeEntity(_0x2039f9,null))[_0xc32b('0x17')](handleError(_0x2039f9,null));};exports[_0xc32b('0x45')]=function(_0x403a9e,_0x111d04){return db['WhatsappMessage'][_0xc32b('0x45')]()[_0xc32b('0xc')](respondWithResult(_0x111d04,null))[_0xc32b('0x17')](handleError(_0x111d04,null));};exports['accept']=function(_0x53317c,_0x345442){var _0x239d2e=_0xc32b('0x46');return interactionService[_0xc32b('0x47')](_0x53317c,_0x239d2e)[_0xc32b('0xc')](respondWithResult(_0x345442,null))[_0xc32b('0x17')](handleError(_0x345442,null));};exports[_0xc32b('0x48')]=function(_0x37e2ca,_0x1aacdd){var _0x4b3909={'agent':{},'channel':'whatsapp'};if(_0x37e2ca[_0xc32b('0x42')]['id']){delete _0x37e2ca['body']['id'];}_0x37e2ca[_0xc32b('0x42')][_0xc32b('0x49')]=_0x37e2ca['body']['UserId']||_0x37e2ca[_0xc32b('0x4a')]['id'];_0x4b3909[_0xc32b('0x4b')]['id']=_0x37e2ca['body']['UserId'];return db[_0xc32b('0x26')]['find']({'where':{'id':_0x37e2ca['params']['id'],'UserId':null}})[_0xc32b('0xc')](handleEntityNotFound(_0x1aacdd,null))['then'](function(_0x3933a4){if(_0x3933a4){_0x4b3909[_0xc32b('0x15')]=_0x3933a4[_0xc32b('0x4c')]({'plain':!![]});return db[_0xc32b('0x4d')]['find']({'where':{'id':_0x3933a4[_0xc32b('0x4e')]}});}return null;})[_0xc32b('0xc')](handleEntityNotFound(_0x1aacdd,null))[_0xc32b('0xc')](function(_0x419cd7){if(_0x419cd7){_0x4b3909['interaction']=_0x419cd7['get']({'plain':!![]});interaction_log[_0xc32b('0xd')](_0xc32b('0x4f'),_0x37e2ca[_0xc32b('0x4a')]['id'],_0x37e2ca[_0xc32b('0x4a')][_0xc32b('0x22')],_0x37e2ca[_0xc32b('0x4a')][_0xc32b('0x50')],_0x4b3909['interaction']['id'],_0x37e2ca[_0xc32b('0x42')]?JSON[_0xc32b('0x12')](_0x37e2ca['body']):_0xc32b('0x51'));return respondWithRpcPromise(_0xc32b('0x52'),_0xc32b('0x53'),_0x4b3909);}return null;})[_0xc32b('0xc')](function(_0x97936c){var _0x36b301=_0xc32b('0x54')+_0x97936c['message'][_0xc32b('0x55')];return db['sequelize'][_0xc32b('0x2b')](_0x36b301,{'type':db[_0xc32b('0x56')][_0xc32b('0x57')][_0xc32b('0x58')],'raw':!![]})[_0xc32b('0xc')](function(_0x30fbca){return _0x30fbca;});})[_0xc32b('0xc')](function(_0x1ebd54){if(_0x1ebd54){_0x4b3909[_0xc32b('0x15')][_0xc32b('0x59')]=_0x1ebd54[0x0];if(!_0x37e2ca[_0xc32b('0x42')][_0xc32b('0x49')])return;return db['User'][_0xc32b('0x5a')]({'where':{'id':_0x37e2ca['body'][_0xc32b('0x49')],'role':_0xc32b('0x4b')},'attributes':['id',_0xc32b('0x22'),_0xc32b('0x5b'),_0xc32b('0x5c'),_0xc32b('0x5d')],'raw':!![]});}return null;})[_0xc32b('0xc')](function(_0x57e6c7){if(!_0x57e6c7)return null;_0x4b3909['message']['agent']=_0x57e6c7;return _0x4b3909;})['then'](function(_0x5cf7b2){if(_0x5cf7b2){_0x5cf7b2[_0xc32b('0x15')][_0xc32b('0x5e')]=util[_0xc32b('0x5f')](_0xc32b('0x60'),_0x37e2ca[_0xc32b('0x4a')][_0xc32b('0x22')]);_0x5cf7b2[_0xc32b('0x15')][_0xc32b('0x61')]=_0x4b3909['channel'];_0x5cf7b2[_0xc32b('0x15')][_0xc32b('0x62')]=_0x4b3909[_0xc32b('0x61')];_0x5cf7b2[_0xc32b('0x15')][_0xc32b('0x63')]=_0xc32b('0x48');respondWithRpcPromise('EventManager',_0xc32b('0x64'),{'event':_0xc32b('0x65'),'message':_0x5cf7b2['message']},client9002);return _0x4b3909;}return null;})[_0xc32b('0xc')](respondWithResult(_0x1aacdd,null))[_0xc32b('0x17')](handleError(_0x1aacdd,null));};exports[_0xc32b('0x1e')]=function(_0x16cfd5,_0x18080a){if(_0x16cfd5[_0xc32b('0x42')]['id']){delete _0x16cfd5[_0xc32b('0x42')]['id'];}var _0x365621;return db[_0xc32b('0x26')]['find']({'where':{'id':_0x16cfd5[_0xc32b('0x3f')]['id']}})[_0xc32b('0xc')](handleEntityNotFound(_0x18080a,null))[_0xc32b('0xc')](function(_0xf83b75){if(_0xf83b75){_0x365621=_0xf83b75;return db['WhatsappAccount'][_0xc32b('0x5a')]({'where':{'id':_0xf83b75[_0xc32b('0x66')]}});}})[_0xc32b('0xc')](handleEntityNotFound(_0x18080a,null))[_0xc32b('0xc')](function(_0x1a5624){if(_0x1a5624){logger['debug'](_0xc32b('0x67'),_0xc32b('0x1e'),_0xc32b('0x68'),_0x1a5624[_0xc32b('0x29')],util[_0xc32b('0x69')](_0x16cfd5['body'],{'showHidden':![],'depth':null}));switch(_0x1a5624[_0xc32b('0x29')]){case _0xc32b('0x6a'):if(_0x16cfd5['body']['MessageSid']&&_0x16cfd5[_0xc32b('0x42')][_0xc32b('0x6b')]===_0x365621[_0xc32b('0x6c')]&&_0x16cfd5[_0xc32b('0x42')]['MessageStatus']&&_0x16cfd5[_0xc32b('0x42')][_0xc32b('0x6d')]===_0xc32b('0x6e')){return _0x365621[_0xc32b('0x43')]({'read':!![]});}else{logger['error'](_0xc32b('0x6f'),_0xc32b('0x1e'),_0xc32b('0x6a'),util['inspect'](_0x16cfd5[_0xc32b('0x42')],{'showHidden':![],'depth':null}));}break;}return _0x365621;}})[_0xc32b('0xc')](respondWithResult(_0x18080a,null))[_0xc32b('0x17')](handleError(_0x18080a,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 3ea0810..efcf599 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 _0x49f8=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x49f8,0xff));var _0x849f=function(_0x4cca9e,_0x2ce3c3){_0x4cca9e=_0x4cca9e-0x0;var _0x2ee98e=_0x49f8[_0x4cca9e];return _0x2ee98e;};'use strict';var EventEmitter=require(_0x849f('0x0'));var WhatsappMessage=require('../../mysqldb')['db']['WhatsappMessage'];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x849f('0x1')](0x0);var events={'afterCreate':_0x849f('0x2'),'afterUpdate':'update','afterDestroy':_0x849f('0x3')};function emitEvent(_0x5bd156){return function(_0xdf19d3,_0x59d2a8,_0x4786cc){WhatsappMessageEvents['emit'](_0x5bd156+':'+_0xdf19d3['id'],_0xdf19d3);WhatsappMessageEvents[_0x849f('0x4')](_0x5bd156,_0xdf19d3);_0x4786cc(null);};}for(var e in events){if(events[_0x849f('0x5')](e)){var event=events[e];WhatsappMessage[_0x849f('0x6')](e,emitEvent(event));}}module[_0x849f('0x7')]=WhatsappMessageEvents; \ No newline at end of file +var _0x8a5c=['hook','exports','events','../../mysqldb','WhatsappMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0xff0da2,_0x48c76d){var _0x5849dc=function(_0x3ebe6d){while(--_0x3ebe6d){_0xff0da2['push'](_0xff0da2['shift']());}};_0x5849dc(++_0x48c76d);}(_0x8a5c,0x136));var _0xc8a5=function(_0x2a0538,_0x4c32c0){_0x2a0538=_0x2a0538-0x0;var _0x3083d5=_0x8a5c[_0x2a0538];return _0x3083d5;};'use strict';var EventEmitter=require(_0xc8a5('0x0'));var WhatsappMessage=require(_0xc8a5('0x1'))['db'][_0xc8a5('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xc8a5('0x3')](0x0);var events={'afterCreate':_0xc8a5('0x4'),'afterUpdate':_0xc8a5('0x5'),'afterDestroy':_0xc8a5('0x6')};function emitEvent(_0x3e2f37){return function(_0x84a3f4,_0x4dd6e0,_0x2b253c){WhatsappMessageEvents[_0xc8a5('0x7')](_0x3e2f37+':'+_0x84a3f4['id'],_0x84a3f4);WhatsappMessageEvents['emit'](_0x3e2f37,_0x84a3f4);_0x2b253c(null);};}for(var e in events){if(events[_0xc8a5('0x8')](e)){var event=events[e];WhatsappMessage[_0xc8a5('0x9')](e,emitEvent(event));}}module[_0xc8a5('0xa')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index b023be9..a2b0c5f 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 _0x0698=['exports','define','WhatsappMessage','messageId','fti_whatsapp_messages','FULLTEXT','get','direction','toLowerCase','out','isNil','UserId','WhatsappInteractionId','then','update','createdAt','catch','find','WhatsappAccountId','twilio','authToken','phone','messages','body','whatsapp:','remote','token','sid','error','WhatsappMessage,\x20%s,\x20%s,\x20%s','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','/whatsapp/v1/','/messages/','text','POST','Bearer\x20','application/json','statuses','message_id','WhatsappMessage,\x20%s','utf8mb4','utf8mb4_unicode_ci','lodash','util','moment','bluebird','request-promise','node-fetch','../../config/environment','./whatsappMessage.attributes'];(function(_0x2e7c69,_0x24a2c5){var _0xb28b40=function(_0x166325){while(--_0x166325){_0x2e7c69['push'](_0x2e7c69['shift']());}};_0xb28b40(++_0x24a2c5);}(_0x0698,0xc4));var _0x8069=function(_0x452502,_0x11f2a9){_0x452502=_0x452502-0x0;var _0x386ac0=_0x0698[_0x452502];return _0x386ac0;};'use strict';var _=require(_0x8069('0x0'));var util=require(_0x8069('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x8069('0x2'));var BPromise=require(_0x8069('0x3'));var rp=require(_0x8069('0x4'));var fetch=require(_0x8069('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8069('0x6'));var attributes=require(_0x8069('0x7'));module[_0x8069('0x8')]=function(_0x54bb0d,_0x58507c){return _0x54bb0d[_0x8069('0x9')](_0x8069('0xa'),attributes,{'tableName':'whatsapp_messages','paranoid':![],'indexes':[{'name':_0x8069('0xb'),'fields':['messageId']},{'name':_0x8069('0xc'),'fields':['body'],'type':_0x8069('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1174e5,_0x52b5a7,_0x1228ff){var _0x54bdb8=_0x54bb0d['models'];var _0x3269e5=_0x1174e5[_0x8069('0xe')]({'plain':!![]});if(_0x3269e5[_0x8069('0xf')][_0x8069('0x10')]()==='in'||_0x3269e5[_0x8069('0xf')]['toLowerCase']()===_0x8069('0x11')&&!_0x3269e5['secret']&&!_[_0x8069('0x12')](_0x3269e5[_0x8069('0x13')])){_0x54bdb8['WhatsappInteraction']['findOne']({'where':{'id':_0x3269e5[_0x8069('0x14')]}})[_0x8069('0x15')](function(_0x131e3b){if(_0x131e3b){_0x131e3b[_0x8069('0x16')]({'lastMsgAt':_0x3269e5[_0x8069('0x17')],'lastMsgDirection':_0x3269e5[_0x8069('0xf')][_0x8069('0x10')]()});}})[_0x8069('0x18')](function(_0x2c252b){console['error'](_0x2c252b);});}if(_0x3269e5['direction']===_0x8069('0x11')&&!_0x3269e5['secret']){var _0x29aadf;_0x54bdb8['WhatsappAccount'][_0x8069('0x19')]({'where':{'id':_0x3269e5[_0x8069('0x1a')]},'raw':!![]})[_0x8069('0x15')](function(_0x17fd65){_0x29aadf=_0x17fd65;if(_0x29aadf&&_0x29aadf['type']){switch(_0x29aadf['type']){case _0x8069('0x1b'):var _0x1aef99=require(_0x8069('0x1b'));if(_0x29aadf['accountSid']&&_0x29aadf[_0x8069('0x1c')]&&_0x29aadf[_0x8069('0x1d')]){var _0x254138=new _0x1aef99(_0x29aadf['accountSid'],_0x29aadf[_0x8069('0x1c')]);_0x254138[_0x8069('0x1e')]['create']({'body':_0x3269e5[_0x8069('0x1f')],'to':_0x8069('0x20')+_0x3269e5[_0x8069('0x1d')],'from':'whatsapp:'+_0x29aadf[_0x8069('0x1d')],'statusCallback':_0x29aadf[_0x8069('0x21')]+'/api/whatsapp/messages/'+_0x3269e5['id']+'/status?token='+_0x29aadf[_0x8069('0x22')]})[_0x8069('0x15')](function(_0x4c3566){if(_0x4c3566[_0x8069('0x23')]){return _0x1174e5[_0x8069('0x16')]({'messageId':_0x4c3566[_0x8069('0x23')]});}})['catch'](function(_0x1e496f){logger[_0x8069('0x24')](_0x8069('0x25'),'afterCreate',_0x8069('0x1b'),util[_0x8069('0x26')](_0x1e496f,{'showHidden':![],'depth':null}));});}else{logger[_0x8069('0x24')](_0x8069('0x25'),'afterCreate','twilio',_0x8069('0x27'));}break;case'sinch':var _0x56bed4=_0x29aadf['accountSid'];var _0x29584=_0x29aadf[_0x8069('0x1c')];var _0x395f5a=_0x29aadf['baseUrl']+_0x8069('0x28')+_0x56bed4+_0x8069('0x29');var _0xb7e946={'to':[_0x3269e5[_0x8069('0x1d')]],'message':{'type':_0x8069('0x2a'),'text':_0x3269e5[_0x8069('0x1f')]}};var _0x25a341={'method':_0x8069('0x2b'),'uri':_0x395f5a,'headers':{'Authorization':_0x8069('0x2c')+_0x29584,'Content-Type':_0x8069('0x2d')},'body':_0xb7e946,'json':!![]};rp(_0x25a341)[_0x8069('0x15')](function(_0x1ca228){if(_0x1ca228[_0x8069('0x2e')][0x0][_0x8069('0x2f')]){return _0x1174e5['update']({'messageId':_0x1ca228['statuses'][0x0][_0x8069('0x2f')]});}})[_0x8069('0x18')](function(_0x52e30c){logger['err'](_0x8069('0x30'),_0x52e30c);});break;}}})['finally'](function(){_0x1228ff();});}else{_0x1228ff();}}},'charset':_0x8069('0x31'),'collate':_0x8069('0x32')});}; \ No newline at end of file +var _0xd0b1=['update','createdAt','error','WhatsappAccount','find','type','phone','accountSid','messages','whatsapp:','/api/whatsapp/messages/','/status?token=','sid','catch','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','twilio','inspect','authToken','baseUrl','/whatsapp/v1/','text','POST','Bearer\x20','application/json','statuses','message_id','WhatsappMessage,\x20%s','finally','utf8mb4','lodash','util','api','moment','request-promise','node-fetch','path','rimraf','../../config/environment','exports','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','models','direction','toLowerCase','out','secret','isNil','WhatsappInteraction','WhatsappInteractionId','then'];(function(_0x29acef,_0x3fa99b){var _0x66385d=function(_0x1571ec){while(--_0x1571ec){_0x29acef['push'](_0x29acef['shift']());}};_0x66385d(++_0x3fa99b);}(_0xd0b1,0x16e));var _0x1d0b=function(_0x405ace,_0x39b7f2){_0x405ace=_0x405ace-0x0;var _0x515f36=_0xd0b1[_0x405ace];return _0x515f36;};'use strict';var _=require(_0x1d0b('0x0'));var util=require(_0x1d0b('0x1'));var logger=require('../../config/logger')(_0x1d0b('0x2'));var moment=require(_0x1d0b('0x3'));var BPromise=require('bluebird');var rp=require(_0x1d0b('0x4'));var fetch=require(_0x1d0b('0x5'));var fs=require('fs');var path=require(_0x1d0b('0x6'));var rimraf=require(_0x1d0b('0x7'));var config=require(_0x1d0b('0x8'));var attributes=require('./whatsappMessage.attributes');module[_0x1d0b('0x9')]=function(_0x2c3e5d,_0x15786b){return _0x2c3e5d[_0x1d0b('0xa')](_0x1d0b('0xb'),attributes,{'tableName':_0x1d0b('0xc'),'paranoid':![],'indexes':[{'name':_0x1d0b('0xd'),'fields':['messageId']},{'name':_0x1d0b('0xe'),'fields':[_0x1d0b('0xf')],'type':_0x1d0b('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4b136e,_0x1b520a,_0x5ef099){var _0x196c3b=_0x2c3e5d[_0x1d0b('0x11')];var _0x4791e3=_0x4b136e['get']({'plain':!![]});if(_0x4791e3[_0x1d0b('0x12')]['toLowerCase']()==='in'||_0x4791e3[_0x1d0b('0x12')][_0x1d0b('0x13')]()===_0x1d0b('0x14')&&!_0x4791e3[_0x1d0b('0x15')]&&!_[_0x1d0b('0x16')](_0x4791e3['UserId'])){_0x196c3b[_0x1d0b('0x17')]['findOne']({'where':{'id':_0x4791e3[_0x1d0b('0x18')]}})[_0x1d0b('0x19')](function(_0x3cdd93){if(_0x3cdd93){_0x3cdd93[_0x1d0b('0x1a')]({'lastMsgAt':_0x4791e3[_0x1d0b('0x1b')],'lastMsgDirection':_0x4791e3[_0x1d0b('0x12')][_0x1d0b('0x13')]()});}})['catch'](function(_0x2c9462){console[_0x1d0b('0x1c')](_0x2c9462);});}if(_0x4791e3['direction']===_0x1d0b('0x14')&&!_0x4791e3[_0x1d0b('0x15')]){var _0x51ada7;_0x196c3b[_0x1d0b('0x1d')][_0x1d0b('0x1e')]({'where':{'id':_0x4791e3['WhatsappAccountId']},'raw':!![]})[_0x1d0b('0x19')](function(_0x1f874){_0x51ada7=_0x1f874;if(_0x51ada7&&_0x51ada7[_0x1d0b('0x1f')]){switch(_0x51ada7[_0x1d0b('0x1f')]){case'twilio':var _0x4ce71f=require('twilio');if(_0x51ada7['accountSid']&&_0x51ada7['authToken']&&_0x51ada7[_0x1d0b('0x20')]){var _0x1fe333=new _0x4ce71f(_0x51ada7[_0x1d0b('0x21')],_0x51ada7['authToken']);_0x1fe333[_0x1d0b('0x22')]['create']({'body':_0x4791e3[_0x1d0b('0xf')],'to':'whatsapp:'+_0x4791e3[_0x1d0b('0x20')],'from':_0x1d0b('0x23')+_0x51ada7[_0x1d0b('0x20')],'statusCallback':_0x51ada7['remote']+_0x1d0b('0x24')+_0x4791e3['id']+_0x1d0b('0x25')+_0x51ada7['token']})[_0x1d0b('0x19')](function(_0x583d26){if(_0x583d26[_0x1d0b('0x26')]){return _0x4b136e[_0x1d0b('0x1a')]({'messageId':_0x583d26[_0x1d0b('0x26')]});}})[_0x1d0b('0x27')](function(_0x23c762){logger[_0x1d0b('0x1c')](_0x1d0b('0x28'),_0x1d0b('0x29'),_0x1d0b('0x2a'),util[_0x1d0b('0x2b')](_0x23c762,{'showHidden':![],'depth':null}));});}else{logger[_0x1d0b('0x1c')](_0x1d0b('0x28'),_0x1d0b('0x29'),'twilio','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case'sinch':var _0x4f9cd6=_0x51ada7[_0x1d0b('0x21')];var _0x4bbd37=_0x51ada7[_0x1d0b('0x2c')];var _0x27a3e2=_0x51ada7[_0x1d0b('0x2d')]+_0x1d0b('0x2e')+_0x4f9cd6+'/messages/';var _0x1123ee={'to':[_0x4791e3[_0x1d0b('0x20')]],'message':{'type':_0x1d0b('0x2f'),'text':_0x4791e3[_0x1d0b('0xf')]}};var _0x127ac3={'method':_0x1d0b('0x30'),'uri':_0x27a3e2,'headers':{'Authorization':_0x1d0b('0x31')+_0x4bbd37,'Content-Type':_0x1d0b('0x32')},'body':_0x1123ee,'json':!![]};rp(_0x127ac3)[_0x1d0b('0x19')](function(_0x4a5248){if(_0x4a5248[_0x1d0b('0x33')][0x0][_0x1d0b('0x34')]){return _0x4b136e[_0x1d0b('0x1a')]({'messageId':_0x4a5248[_0x1d0b('0x33')][0x0][_0x1d0b('0x34')]});}})[_0x1d0b('0x27')](function(_0x5d5654){logger['err'](_0x1d0b('0x35'),_0x5d5654);});break;}}})[_0x1d0b('0x36')](function(){_0x5ef099();});}else{_0x5ef099();}}},'charset':_0x1d0b('0x37'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index bf2a7e3..ad06ab1 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 _0x5d40=['message','result','catch','CreateWhatsappMessage','options','stringify','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','info','WhatsappMessage,\x20%s,\x20%s','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code'];(function(_0x2a9b63,_0x27b47d){var _0x1dfd9a=function(_0xfba043){while(--_0xfba043){_0x2a9b63['push'](_0x2a9b63['shift']());}};_0x1dfd9a(++_0x27b47d);}(_0x5d40,0x114));var _0x05d4=function(_0x454000,_0x3499a0){_0x454000=_0x454000-0x0;var _0x2bdffd=_0x5d40[_0x454000];return _0x2bdffd;};'use strict';var _=require(_0x05d4('0x0'));var util=require(_0x05d4('0x1'));var moment=require(_0x05d4('0x2'));var BPromise=require(_0x05d4('0x3'));var rs=require(_0x05d4('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x05d4('0x5'))['db'];var utils=require(_0x05d4('0x6'));var logger=require(_0x05d4('0x7'))(_0x05d4('0x8'));var config=require(_0x05d4('0x9'));var jayson=require(_0x05d4('0xa'));var client=jayson[_0x05d4('0xb')]['http']({'port':0x232a});config[_0x05d4('0xc')]=_[_0x05d4('0xd')](config['redis'],{'host':_0x05d4('0xe'),'port':0x18eb});var socket=require(_0x05d4('0xf'))(new Redis(config['redis']));require('./whatsappMessage.socket')[_0x05d4('0x10')](socket);function respondWithRpcPromise(_0x12fc35,_0x4c9ee5,_0x2fdb94){return new BPromise(function(_0x5110f0,_0x708f3f){return client['request'](_0x12fc35,_0x2fdb94)['then'](function(_0x25a880){logger[_0x05d4('0x11')](_0x05d4('0x12'),_0x4c9ee5,'request\x20sent');logger[_0x05d4('0x13')](_0x05d4('0x14'),_0x4c9ee5,_0x05d4('0x15'),JSON['stringify'](_0x25a880));if(_0x25a880[_0x05d4('0x16')]){if(_0x25a880[_0x05d4('0x16')][_0x05d4('0x17')]===0x1f4){logger['error'](_0x05d4('0x12'),_0x4c9ee5,_0x25a880['error'][_0x05d4('0x18')]);return _0x708f3f(_0x25a880['error'][_0x05d4('0x18')]);}logger['error'](_0x05d4('0x12'),_0x4c9ee5,_0x25a880[_0x05d4('0x16')][_0x05d4('0x18')]);return _0x5110f0(_0x25a880[_0x05d4('0x16')][_0x05d4('0x18')]);}else{logger[_0x05d4('0x11')](_0x05d4('0x12'),_0x4c9ee5,'request\x20sent');_0x5110f0(_0x25a880[_0x05d4('0x19')]['message']);}})[_0x05d4('0x1a')](function(_0x290079){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x4c9ee5,_0x290079);_0x708f3f(_0x290079);});});}exports[_0x05d4('0x1b')]=function(_0x4e0bcc){var _0x33f064=this;return new Promise(function(_0x55e8cf,_0x3df2ad){return db['WhatsappMessage']['create'](_0x4e0bcc['body'],{'raw':_0x4e0bcc[_0x05d4('0x1c')]?_0x4e0bcc['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x5c8f96){logger[_0x05d4('0x11')](_0x05d4('0x1b'),_0x4e0bcc);logger[_0x05d4('0x13')](_0x05d4('0x1b'),_0x4e0bcc,JSON[_0x05d4('0x1d')](_0x5c8f96));_0x55e8cf(_0x5c8f96);})[_0x05d4('0x1a')](function(_0xaa7467){logger['error'](_0x05d4('0x1b'),_0xaa7467[_0x05d4('0x18')],_0x4e0bcc);_0x3df2ad(_0x33f064['error'](0x1f4,_0xaa7467[_0x05d4('0x18')]));});});}; \ No newline at end of file +var _0x67c0=['../../config/utils','rpc','client','http','redis','defaults','localhost','./whatsappMessage.socket','register','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateWhatsappMessage','WhatsappMessage','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x3e7ba2,_0x2fbe83){var _0x3c2606=function(_0x12642c){while(--_0x12642c){_0x3e7ba2['push'](_0x3e7ba2['shift']());}};_0x3c2606(++_0x2fbe83);}(_0x67c0,0x191));var _0x067c=function(_0x38e660,_0x59bb24){_0x38e660=_0x38e660-0x0;var _0xc9a1ea=_0x67c0[_0x38e660];return _0xc9a1ea;};'use strict';var _=require(_0x067c('0x0'));var util=require(_0x067c('0x1'));var moment=require(_0x067c('0x2'));var BPromise=require(_0x067c('0x3'));var rs=require(_0x067c('0x4'));var fs=require('fs');var Redis=require(_0x067c('0x5'));var db=require(_0x067c('0x6'))['db'];var utils=require(_0x067c('0x7'));var logger=require('../../config/logger')(_0x067c('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x067c('0x9')][_0x067c('0xa')]({'port':0x232a});config[_0x067c('0xb')]=_[_0x067c('0xc')](config[_0x067c('0xb')],{'host':_0x067c('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x067c('0xb')]));require(_0x067c('0xe'))[_0x067c('0xf')](socket);function respondWithRpcPromise(_0x5782e7,_0x258ed3,_0x11fe1f){return new BPromise(function(_0x28f9f2,_0x41bfdd){return client[_0x067c('0x10')](_0x5782e7,_0x11fe1f)[_0x067c('0x11')](function(_0x45ffe4){logger[_0x067c('0x12')](_0x067c('0x13'),_0x258ed3,_0x067c('0x14'));logger[_0x067c('0x15')](_0x067c('0x16'),_0x258ed3,_0x067c('0x14'),JSON[_0x067c('0x17')](_0x45ffe4));if(_0x45ffe4[_0x067c('0x18')]){if(_0x45ffe4[_0x067c('0x18')][_0x067c('0x19')]===0x1f4){logger[_0x067c('0x18')](_0x067c('0x13'),_0x258ed3,_0x45ffe4[_0x067c('0x18')][_0x067c('0x1a')]);return _0x41bfdd(_0x45ffe4['error'][_0x067c('0x1a')]);}logger[_0x067c('0x18')](_0x067c('0x13'),_0x258ed3,_0x45ffe4[_0x067c('0x18')]['message']);return _0x28f9f2(_0x45ffe4['error'][_0x067c('0x1a')]);}else{logger[_0x067c('0x12')](_0x067c('0x13'),_0x258ed3,_0x067c('0x14'));_0x28f9f2(_0x45ffe4[_0x067c('0x1b')]['message']);}})[_0x067c('0x1c')](function(_0x31ffb3){logger[_0x067c('0x18')](_0x067c('0x13'),_0x258ed3,_0x31ffb3);_0x41bfdd(_0x31ffb3);});});}exports[_0x067c('0x1d')]=function(_0x8eb57b){var _0x235822=this;return new Promise(function(_0x1b8a25,_0x29d737){return db[_0x067c('0x1e')]['create'](_0x8eb57b[_0x067c('0x1f')],{'raw':_0x8eb57b[_0x067c('0x20')]?_0x8eb57b[_0x067c('0x20')][_0x067c('0x21')]===undefined?!![]:![]:!![]})[_0x067c('0x11')](function(_0x292a10){logger['info'](_0x067c('0x1d'),_0x8eb57b);logger[_0x067c('0x15')](_0x067c('0x1d'),_0x8eb57b,JSON[_0x067c('0x17')](_0x292a10));_0x1b8a25(_0x292a10);})[_0x067c('0x1c')](function(_0x19b083){logger['error'](_0x067c('0x1d'),_0x19b083[_0x067c('0x1a')],_0x8eb57b);_0x29d737(_0x235822[_0x067c('0x18')](0x1f4,_0x19b083[_0x067c('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 8ce091b..c1cdf00 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 _0x1e7a=['register','length','whatsappMessage:','./whatsappMessage.events','save','remove','update','emit','removeListener'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x1e7a,0x1a1));var _0xa1e7=function(_0x2c34b2,_0x1d9ecf){_0x2c34b2=_0x2c34b2-0x0;var _0x1d31b8=_0x1e7a[_0x2c34b2];return _0x1d31b8;};'use strict';var WhatsappMessageEvents=require(_0xa1e7('0x0'));var events=[_0xa1e7('0x1'),_0xa1e7('0x2'),_0xa1e7('0x3')];function createListener(_0x2a1e52,_0x5d00d6){return function(_0x79da7d){_0x5d00d6[_0xa1e7('0x4')](_0x2a1e52,_0x79da7d);};}function removeListener(_0x22e59c,_0x9fd539){return function(){WhatsappMessageEvents[_0xa1e7('0x5')](_0x22e59c,_0x9fd539);};}exports[_0xa1e7('0x6')]=function(_0x2741bb){for(var _0x520352=0x0,_0x300c3c=events[_0xa1e7('0x7')];_0x520352<_0x300c3c;_0x520352++){var _0x447b24=events[_0x520352];var _0x4117f4=createListener(_0xa1e7('0x8')+_0x447b24,_0x2741bb);WhatsappMessageEvents['on'](_0x447b24,_0x4117f4);}}; \ No newline at end of file +var _0xda06=['length','whatsappMessage:','remove','update','emit','removeListener'];(function(_0x1a033a,_0x1c37b4){var _0x2564ad=function(_0x1fd553){while(--_0x1fd553){_0x1a033a['push'](_0x1a033a['shift']());}};_0x2564ad(++_0x1c37b4);}(_0xda06,0xbc));var _0x6da0=function(_0x3d593d,_0x1dec8d){_0x3d593d=_0x3d593d-0x0;var _0x501ec5=_0xda06[_0x3d593d];return _0x501ec5;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=['save',_0x6da0('0x0'),_0x6da0('0x1')];function createListener(_0x1d56af,_0x577531){return function(_0x4267c3){_0x577531[_0x6da0('0x2')](_0x1d56af,_0x4267c3);};}function removeListener(_0x20f4b9,_0x5f472b){return function(){WhatsappMessageEvents[_0x6da0('0x3')](_0x20f4b9,_0x5f472b);};}exports['register']=function(_0x400c65){for(var _0x3b1649=0x0,_0x14729=events[_0x6da0('0x4')];_0x3b1649<_0x14729;_0x3b1649++){var _0x373aeb=events[_0x3b1649];var _0x4856db=createListener(_0x6da0('0x5')+_0x373aeb,_0x400c65);WhatsappMessageEvents['on'](_0x373aeb,_0x4856db);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index cc1fd6a..c171728 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 _0xadb3=['show','/:id/members','/:id/teams','/:id/users','getAgents','post','create','addTeams','addAgents','update','delete','destroy','removeTeams','removeAgents','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id'];(function(_0x289891,_0x49a0fa){var _0x31cf2e=function(_0x8cebce){while(--_0x8cebce){_0x289891['push'](_0x289891['shift']());}};_0x31cf2e(++_0x49a0fa);}(_0xadb3,0x1b2));var _0x3adb=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xadb3[_0x502c7d];return _0x30b7ed;};'use strict';var multer=require(_0x3adb('0x0'));var util=require('util');var path=require(_0x3adb('0x1'));var timeout=require(_0x3adb('0x2'));var express=require('express');var router=express[_0x3adb('0x3')]();var fs_extra=require(_0x3adb('0x4'));var auth=require(_0x3adb('0x5'));var interaction=require(_0x3adb('0x6'));var config=require(_0x3adb('0x7'));var controller=require('./whatsappQueue.controller');router['get']('/',auth[_0x3adb('0x8')](),controller[_0x3adb('0x9')]);router[_0x3adb('0xa')](_0x3adb('0xb'),auth[_0x3adb('0x8')](),controller[_0x3adb('0xc')]);router[_0x3adb('0xa')](_0x3adb('0xd'),auth[_0x3adb('0x8')](),controller[_0x3adb('0xe')]);router[_0x3adb('0xa')](_0x3adb('0xf'),auth[_0x3adb('0x8')](),controller['getMembers']);router['get'](_0x3adb('0x10'),auth[_0x3adb('0x8')](),controller['getTeams']);router[_0x3adb('0xa')](_0x3adb('0x11'),auth[_0x3adb('0x8')](),controller[_0x3adb('0x12')]);router[_0x3adb('0x13')]('/',auth[_0x3adb('0x8')](),controller[_0x3adb('0x14')]);router[_0x3adb('0x13')](_0x3adb('0x10'),auth['isAuthenticated'](),controller[_0x3adb('0x15')]);router[_0x3adb('0x13')](_0x3adb('0x11'),auth['isAuthenticated'](),controller[_0x3adb('0x16')]);router['put'](_0x3adb('0xd'),auth[_0x3adb('0x8')](),controller[_0x3adb('0x17')]);router[_0x3adb('0x18')](_0x3adb('0xd'),auth[_0x3adb('0x8')](),controller[_0x3adb('0x19')]);router[_0x3adb('0x18')](_0x3adb('0x10'),auth['isAuthenticated'](),controller[_0x3adb('0x1a')]);router[_0x3adb('0x18')]('/:id/users',auth['isAuthenticated'](),controller[_0x3adb('0x1b')]);module['exports']=router; \ No newline at end of file +var _0x1a70=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappQueue.controller','get','index','/describe','isAuthenticated','/:id','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','multer'];(function(_0x2bb9cb,_0x3e2c0f){var _0x1ab28b=function(_0x1b344a){while(--_0x1b344a){_0x2bb9cb['push'](_0x2bb9cb['shift']());}};_0x1ab28b(++_0x3e2c0f);}(_0x1a70,0x1df));var _0x01a7=function(_0x40d078,_0x210a77){_0x40d078=_0x40d078-0x0;var _0x46fc81=_0x1a70[_0x40d078];return _0x46fc81;};'use strict';var multer=require(_0x01a7('0x0'));var util=require(_0x01a7('0x1'));var path=require(_0x01a7('0x2'));var timeout=require(_0x01a7('0x3'));var express=require(_0x01a7('0x4'));var router=express[_0x01a7('0x5')]();var fs_extra=require(_0x01a7('0x6'));var auth=require(_0x01a7('0x7'));var interaction=require(_0x01a7('0x8'));var config=require('../../config/environment');var controller=require(_0x01a7('0x9'));router[_0x01a7('0xa')]('/',auth['isAuthenticated'](),controller[_0x01a7('0xb')]);router[_0x01a7('0xa')](_0x01a7('0xc'),auth[_0x01a7('0xd')](),controller['describe']);router[_0x01a7('0xa')](_0x01a7('0xe'),auth['isAuthenticated'](),controller['show']);router[_0x01a7('0xa')](_0x01a7('0xf'),auth[_0x01a7('0xd')](),controller['getMembers']);router[_0x01a7('0xa')](_0x01a7('0x10'),auth[_0x01a7('0xd')](),controller[_0x01a7('0x11')]);router['get'](_0x01a7('0x12'),auth[_0x01a7('0xd')](),controller[_0x01a7('0x13')]);router[_0x01a7('0x14')]('/',auth['isAuthenticated'](),controller['create']);router[_0x01a7('0x14')](_0x01a7('0x10'),auth[_0x01a7('0xd')](),controller[_0x01a7('0x15')]);router['post']('/:id/users',auth[_0x01a7('0xd')](),controller[_0x01a7('0x16')]);router[_0x01a7('0x17')]('/:id',auth['isAuthenticated'](),controller[_0x01a7('0x18')]);router[_0x01a7('0x19')](_0x01a7('0xe'),auth['isAuthenticated'](),controller[_0x01a7('0x1a')]);router['delete'](_0x01a7('0x10'),auth[_0x01a7('0xd')](),controller[_0x01a7('0x1b')]);router[_0x01a7('0x19')](_0x01a7('0x12'),auth[_0x01a7('0xd')](),controller[_0x01a7('0x1c')]);module[_0x01a7('0x1d')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index bce1b6a..31bfc37 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(_0x4bb2b9,_0x459c78){var _0x40e2a2=function(_0x19a26c){while(--_0x19a26c){_0x4bb2b9['push'](_0x4bb2b9['shift']());}};_0x40e2a2(++_0x459c78);}(_0x3140,0xaf));var _0x0314=function(_0x1546c2,_0x22e822){_0x1546c2=_0x1546c2-0x0;var _0x24583c=_0x3140[_0x1546c2];return _0x24583c;};'use strict';var Sequelize=require(_0x0314('0x0'));module[_0x0314('0x1')]={'name':{'type':Sequelize[_0x0314('0x2')],'unique':_0x0314('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x0314('0x4'),_0x0314('0x5'),_0x0314('0x6'))},'description':{'type':Sequelize[_0x0314('0x2')]}}; \ No newline at end of file +var _0x5d31=['INTEGER','ENUM','beepall','sequelize','exports','STRING'];(function(_0x2ea14f,_0x5c6fec){var _0x15db0d=function(_0x9bee37){while(--_0x9bee37){_0x2ea14f['push'](_0x2ea14f['shift']());}};_0x15db0d(++_0x5c6fec);}(_0x5d31,0xb7));var _0x15d3=function(_0x5967c0,_0x452377){_0x5967c0=_0x5967c0-0x0;var _0x2ad249=_0x5d31[_0x5967c0];return _0x2ad249;};'use strict';var Sequelize=require(_0x15d3('0x0'));module[_0x15d3('0x1')]={'name':{'type':Sequelize[_0x15d3('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x15d3('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x15d3('0x4')]('rrmemory',_0x15d3('0x5'),'roundrobin')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index d826853..c236456 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 _0x3372=['addAgents','omit','isArray','getAgents','bluebird','util','squel','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','end','json','offset','undefined','limit','count','status','Content-Range','update','then','get','UserProfileResource','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','where','WhatsappQueue','include','query','findAll','rows','catch','params','model','keys','filters','intersection','attributes','fields','merge','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','WhatsappQueues','UserProfileSection','userProfileId','autoAssociation','describe','findOne','nolimit','order','sort','pick','WhatsappQueueId','filter','UserWhatsappQueue','User','findAndCountAll','UserId','agent','whatsappPause','createdAt','format','SIP','updatedAt','getTeams','Team','length','hasOwnProperty','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','addTeams','each','findOrCreate','forEach','emit','userWhatsappQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_whatsapp_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','SELECT','every','TeamId','includes','all','union','compact','isEmpty','removeAgents','userWhatsappQueue:remove'];(function(_0x7b7a8c,_0x7e6e0){var _0x1b3486=function(_0x46c4ee){while(--_0x46c4ee){_0x7b7a8c['push'](_0x7b7a8c['shift']());}};_0x1b3486(++_0x7e6e0);}(_0x3372,0x1f4));var _0x2337=function(_0x26a0a4,_0x5be4cb){_0x26a0a4=_0x26a0a4-0x0;var _0x2481a3=_0x3372[_0x26a0a4];return _0x2481a3;};'use strict';var BPromise=require(_0x2337('0x0'));var util=require(_0x2337('0x1'));var _=require('lodash');var squel=require(_0x2337('0x2'));var Redis=require(_0x2337('0x3'));var qs=require(_0x2337('0x4'));var logger=require(_0x2337('0x5'))('api');var config=require(_0x2337('0x6'));var db=require(_0x2337('0x7'))['db'];config[_0x2337('0x8')]=_[_0x2337('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x2337('0xa'))(new Redis(config['redis']));require(_0x2337('0xb'))[_0x2337('0xc')](socket);function respondWithStatusCode(_0x5d5a7c,_0x524a1b){_0x524a1b=_0x524a1b||0xcc;return function(_0x2792e3){if(_0x2792e3){return _0x5d5a7c[_0x2337('0xd')](_0x524a1b);}return _0x5d5a7c['status'](_0x524a1b)[_0x2337('0xe')]();};}function respondWithResult(_0x5ee82a,_0x516543){_0x516543=_0x516543||0xc8;return function(_0x351188){if(_0x351188){return _0x5ee82a['status'](_0x516543)[_0x2337('0xf')](_0x351188);}};}function respondWithFilteredResult(_0x2defba,_0x2b3584){return function(_0x3565a5){if(_0x3565a5){var _0x4c0b01=typeof _0x2b3584[_0x2337('0x10')]===_0x2337('0x11')&&typeof _0x2b3584[_0x2337('0x12')]===_0x2337('0x11');var _0x1ba094=_0x3565a5[_0x2337('0x13')];var _0x108235=_0x4c0b01?0x0:_0x2b3584['offset'];var _0x2137d3=_0x4c0b01?_0x3565a5[_0x2337('0x13')]:_0x2b3584[_0x2337('0x10')]+_0x2b3584[_0x2337('0x12')];var _0x4c889b;if(_0x2137d3>=_0x1ba094){_0x2137d3=_0x1ba094;_0x4c889b=0xc8;}else{_0x4c889b=0xce;}_0x2defba[_0x2337('0x14')](_0x4c889b);return _0x2defba['set'](_0x2337('0x15'),_0x108235+'-'+_0x2137d3+'/'+_0x1ba094)[_0x2337('0xf')](_0x3565a5);}return null;};}function saveUpdates(_0x56bb3a){return function(_0x4311c4){if(_0x4311c4){return _0x4311c4[_0x2337('0x16')](_0x56bb3a)[_0x2337('0x17')](function(_0x89e569){return _0x89e569;});}return null;};}function removeEntity(_0x18c243){return function(_0x113373){if(_0x113373){return _0x113373['destroy']()[_0x2337('0x17')](function(){var _0x5a1229=_0x113373[_0x2337('0x18')]({'plain':!![]});var _0x11f5cb='WhatsappQueues';return db[_0x2337('0x19')][_0x2337('0x1a')]({'where':{'type':_0x11f5cb,'resourceId':_0x5a1229['id']}})[_0x2337('0x17')](function(){return _0x113373;});})[_0x2337('0x17')](function(){_0x18c243[_0x2337('0x14')](0xcc)[_0x2337('0xe')]();});}};}function handleEntityNotFound(_0x3cce8d){return function(_0x3cdcef){if(!_0x3cdcef){_0x3cce8d[_0x2337('0xd')](0x194);}return _0x3cdcef;};}function handleError(_0x53dd8f,_0x49baf1){_0x49baf1=_0x49baf1||0x1f4;return function(_0x599975){logger[_0x2337('0x1b')](_0x599975[_0x2337('0x1c')]);if(_0x599975[_0x2337('0x1d')]){delete _0x599975[_0x2337('0x1d')];}_0x53dd8f['status'](_0x49baf1)[_0x2337('0x1e')](_0x599975);};}exports[_0x2337('0x1f')]=function(_0x5c977f,_0x5d5d2e){var _0x44a5b0={};var _0x4259e1={'count':0x0,'rows':[]};var _0x188264=_[_0x2337('0x20')](db['WhatsappQueue'][_0x2337('0x21')],function(_0x539abf){return{'name':_0x539abf[_0x2337('0x22')],'type':_0x539abf[_0x2337('0x23')]['key']};});_0x44a5b0=qs['getOptions'](_0x188264,_0x5c977f);var _0x4e0885={'where':_0x44a5b0[_0x2337('0x24')]};return db[_0x2337('0x25')][_0x2337('0x13')](_0x4e0885)[_0x2337('0x17')](function(_0x4973ae){_0x4259e1[_0x2337('0x13')]=_0x4973ae;_0x44a5b0['include']=qs[_0x2337('0x26')](_0x5c977f[_0x2337('0x27')]);return db[_0x2337('0x25')][_0x2337('0x28')](_0x44a5b0);})[_0x2337('0x17')](function(_0x1d3e96){_0x4259e1[_0x2337('0x29')]=_0x1d3e96;return _0x4259e1;})[_0x2337('0x17')](respondWithFilteredResult(_0x5d5d2e,_0x44a5b0))[_0x2337('0x2a')](handleError(_0x5d5d2e,null));};exports['show']=function(_0xaaf7c5,_0x1e3117){var _0x2ae26f={'raw':!![],'where':{'id':_0xaaf7c5[_0x2337('0x2b')]['id']}},_0x32ebcc={};_0x32ebcc[_0x2337('0x2c')]=_['keys'](db[_0x2337('0x25')][_0x2337('0x21')]);_0x32ebcc[_0x2337('0x27')]=_[_0x2337('0x2d')](_0xaaf7c5[_0x2337('0x27')]);_0x32ebcc[_0x2337('0x2e')]=_[_0x2337('0x2f')](_0x32ebcc['model'],_0x32ebcc[_0x2337('0x27')]);_0x2ae26f[_0x2337('0x30')]=_[_0x2337('0x2f')](_0x32ebcc[_0x2337('0x2c')],qs[_0x2337('0x31')](_0xaaf7c5[_0x2337('0x27')][_0x2337('0x31')]));_0x2ae26f[_0x2337('0x30')]=_0x2ae26f[_0x2337('0x30')]['length']?_0x2ae26f['attributes']:_0x32ebcc[_0x2337('0x2c')];if(_0xaaf7c5[_0x2337('0x27')]['includeAll']){_0x2ae26f[_0x2337('0x26')]=[{'all':!![]}];}_0x2ae26f=_[_0x2337('0x32')]({},_0x2ae26f,_0xaaf7c5[_0x2337('0x33')]);return db[_0x2337('0x25')][_0x2337('0x34')](_0x2ae26f)['then'](handleEntityNotFound(_0x1e3117,null))[_0x2337('0x17')](respondWithResult(_0x1e3117,null))['catch'](handleError(_0x1e3117,null));};exports[_0x2337('0x35')]=function(_0x3e7302,_0x102293){return db[_0x2337('0x25')]['create'](_0x3e7302[_0x2337('0x36')],{})[_0x2337('0x17')](function(_0x5167d8){var _0x469c21=_0x3e7302[_0x2337('0x37')][_0x2337('0x18')]({'plain':!![]});if(!_0x469c21)throw new Error(_0x2337('0x38'));if(_0x469c21[_0x2337('0x39')]===_0x2337('0x37')){var _0x4e01fa=_0x5167d8[_0x2337('0x18')]({'plain':!![]});var _0xbb2e08=_0x2337('0x3a');return db[_0x2337('0x3b')][_0x2337('0x34')]({'where':{'name':_0xbb2e08,'userProfileId':_0x469c21[_0x2337('0x3c')]},'raw':!![]})['then'](function(_0x33436e){if(_0x33436e&&_0x33436e[_0x2337('0x3d')]===0x0){return db['UserProfileResource'][_0x2337('0x35')]({'name':_0x4e01fa[_0x2337('0x1d')],'resourceId':_0x4e01fa['id'],'type':_0x33436e[_0x2337('0x1d')],'sectionId':_0x33436e['id']},{})['then'](function(){return _0x5167d8;});}else{return _0x5167d8;}})[_0x2337('0x2a')](function(_0x2ef1bf){logger[_0x2337('0x1b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2ef1bf);throw _0x2ef1bf;});}return _0x5167d8;})[_0x2337('0x17')](respondWithResult(_0x102293,0xc9))['catch'](handleError(_0x102293,null));};exports[_0x2337('0x16')]=function(_0x580ffb,_0x58251a){if(_0x580ffb['body']['id']){delete _0x580ffb['body']['id'];}return db[_0x2337('0x25')][_0x2337('0x34')]({'where':{'id':_0x580ffb[_0x2337('0x2b')]['id']}})[_0x2337('0x17')](handleEntityNotFound(_0x58251a,null))[_0x2337('0x17')](saveUpdates(_0x580ffb['body'],null))[_0x2337('0x17')](respondWithResult(_0x58251a,null))[_0x2337('0x2a')](handleError(_0x58251a,null));};exports['destroy']=function(_0x197f2e,_0x51703b){return db[_0x2337('0x25')][_0x2337('0x34')]({'where':{'id':_0x197f2e['params']['id']}})['then'](handleEntityNotFound(_0x51703b,null))[_0x2337('0x17')](removeEntity(_0x51703b,null))[_0x2337('0x2a')](handleError(_0x51703b,null));};exports[_0x2337('0x3e')]=function(_0x46c4e4,_0x26ba1){return db[_0x2337('0x25')][_0x2337('0x3e')]()[_0x2337('0x17')](respondWithResult(_0x26ba1,null))[_0x2337('0x2a')](handleError(_0x26ba1,null));};exports['getMembers']=function(_0x2f0787,_0x573807){var _0x462f4c={'raw':!![],'where':{}},_0x474067={},_0x82d3c1;return db[_0x2337('0x25')][_0x2337('0x3f')]({'where':{'id':_0x2f0787[_0x2337('0x2b')]['id']}})['then'](handleEntityNotFound(_0x573807,null))[_0x2337('0x17')](function(_0x38d74e){if(_0x38d74e){_0x82d3c1=_0x38d74e['get']({'plain':!![]});_0x474067[_0x2337('0x2c')]=_[_0x2337('0x2d')](db['UserWhatsappQueue'][_0x2337('0x21')]);_0x474067[_0x2337('0x27')]=_['keys'](_0x2f0787['query']);_0x474067[_0x2337('0x2e')]=_[_0x2337('0x2f')](_0x474067[_0x2337('0x2c')],_0x474067[_0x2337('0x27')]);_0x462f4c['attributes']=_['intersection'](_0x474067[_0x2337('0x2c')],qs[_0x2337('0x31')](_0x2f0787[_0x2337('0x27')][_0x2337('0x31')]));_0x462f4c['attributes']=_0x462f4c['attributes']['length']?_0x462f4c[_0x2337('0x30')]:_0x474067['model'];if(!_0x2f0787[_0x2337('0x27')]['hasOwnProperty'](_0x2337('0x40'))){_0x462f4c[_0x2337('0x12')]=qs[_0x2337('0x12')](_0x2f0787[_0x2337('0x27')][_0x2337('0x12')]);_0x462f4c[_0x2337('0x10')]=qs[_0x2337('0x10')](_0x2f0787[_0x2337('0x27')]['offset']);}_0x462f4c[_0x2337('0x41')]=qs[_0x2337('0x42')](_0x2f0787[_0x2337('0x27')][_0x2337('0x42')]);_0x462f4c[_0x2337('0x24')]=qs[_0x2337('0x2e')](_[_0x2337('0x43')](_0x2f0787[_0x2337('0x27')],_0x474067[_0x2337('0x2e')]));_0x462f4c['where'][_0x2337('0x44')]=_0x38d74e['id'];if(_0x2f0787[_0x2337('0x27')][_0x2337('0x45')]){_0x462f4c[_0x2337('0x24')]=_['merge'](_0x462f4c[_0x2337('0x24')],{'$or':_[_0x2337('0x20')](_0x462f4c[_0x2337('0x30')],function(_0x32007b){var _0x17c282={};_0x17c282[_0x32007b]={'$like':'%'+_0x2f0787['query']['filter']+'%'};return _0x17c282;})});}_0x462f4c=_[_0x2337('0x32')]({},_0x462f4c,_0x2f0787[_0x2337('0x33')]);return db[_0x2337('0x46')]['findAll'](_0x462f4c);}})['then'](function(_0x421da9){if(_0x421da9){return db[_0x2337('0x47')][_0x2337('0x48')]({'where':{'id':_[_0x2337('0x20')](_0x421da9,_0x2337('0x49')),'role':_0x2337('0x4a')},'attributes':['id',_0x2337('0x1d'),_0x2337('0x4b'),'updatedAt',_0x2337('0x4c')]});}})[_0x2337('0x17')](function(_0x4705a1){if(_0x4705a1){return{'count':_0x4705a1[_0x2337('0x13')],'rows':_[_0x2337('0x20')](_0x4705a1['rows'],function(_0x46b16a){return{'membername':_0x46b16a[_0x2337('0x1d')],'UserId':_0x46b16a['id'],'queue_name':_0x82d3c1[_0x2337('0x1d')],'WhatsappQueueId':_0x82d3c1['id'],'interface':util[_0x2337('0x4d')]('%s/%s',_0x2337('0x4e'),_0x46b16a['name']),'penalty':0x0,'paused':_0x46b16a[_0x2337('0x4b')],'createdAt':_0x46b16a[_0x2337('0x4c')],'updatedAt':_0x46b16a[_0x2337('0x4f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x2337('0x17')](respondWithFilteredResult(_0x573807,_0x462f4c))[_0x2337('0x2a')](handleError(_0x573807,null));};exports[_0x2337('0x50')]=function(_0x126bb3,_0x1fb922){var _0x3cee31={};var _0x5e58cb={};var _0x4d04bd;var _0x5e7072;return db[_0x2337('0x25')]['findOne']({'where':{'id':_0x126bb3[_0x2337('0x2b')]['id']}})[_0x2337('0x17')](handleEntityNotFound(_0x1fb922,null))[_0x2337('0x17')](function(_0x54ca6c){if(_0x54ca6c){_0x4d04bd=_0x54ca6c;_0x5e58cb[_0x2337('0x2c')]=_[_0x2337('0x2d')](db[_0x2337('0x51')]['rawAttributes']);_0x5e58cb['query']=_[_0x2337('0x2d')](_0x126bb3['query']);_0x5e58cb[_0x2337('0x2e')]=_[_0x2337('0x2f')](_0x5e58cb[_0x2337('0x2c')],_0x5e58cb['query']);_0x3cee31[_0x2337('0x30')]=_[_0x2337('0x2f')](_0x5e58cb[_0x2337('0x2c')],qs[_0x2337('0x31')](_0x126bb3[_0x2337('0x27')][_0x2337('0x31')]));_0x3cee31[_0x2337('0x30')]=_0x3cee31['attributes'][_0x2337('0x52')]?_0x3cee31[_0x2337('0x30')]:_0x5e58cb[_0x2337('0x2c')];_0x3cee31[_0x2337('0x41')]=qs['sort'](_0x126bb3[_0x2337('0x27')][_0x2337('0x42')]);_0x3cee31['where']=qs[_0x2337('0x2e')](_[_0x2337('0x43')](_0x126bb3[_0x2337('0x27')],_0x5e58cb[_0x2337('0x2e')]));if(_0x126bb3[_0x2337('0x27')][_0x2337('0x45')]){_0x3cee31[_0x2337('0x24')]=_[_0x2337('0x32')](_0x3cee31[_0x2337('0x24')],{'$or':_['map'](_0x3cee31[_0x2337('0x30')],function(_0x5e0142){var _0x306a52={};_0x306a52[_0x5e0142]={'$like':'%'+_0x126bb3['query'][_0x2337('0x45')]+'%'};return _0x306a52;})});}_0x3cee31=_[_0x2337('0x32')]({},_0x3cee31,_0x126bb3[_0x2337('0x33')]);return _0x4d04bd[_0x2337('0x50')](_0x3cee31);}})[_0x2337('0x17')](function(_0x5b4a66){if(_0x5b4a66){_0x5e7072=_0x5b4a66[_0x2337('0x52')];if(!_0x126bb3[_0x2337('0x27')][_0x2337('0x53')](_0x2337('0x40'))){_0x3cee31[_0x2337('0x12')]=qs[_0x2337('0x12')](_0x126bb3['query']['limit']);_0x3cee31[_0x2337('0x10')]=qs[_0x2337('0x10')](_0x126bb3[_0x2337('0x27')][_0x2337('0x10')]);}return _0x4d04bd[_0x2337('0x50')](_0x3cee31);}})['then'](function(_0x5b287e){if(_0x5b287e){return _0x5b287e?{'count':_0x5e7072,'rows':_0x5b287e}:null;}})[_0x2337('0x17')](respondWithResult(_0x1fb922,null))[_0x2337('0x2a')](handleError(_0x1fb922,null));};exports['addTeams']=function(_0x4c7b6c,_0x791942){var _0x10fbcf=_0x4c7b6c['body'][_0x2337('0x54')];return db[_0x2337('0x51')]['findAll']({'where':{'id':_0x10fbcf},'attributes':['id'],'include':[{'model':db[_0x2337('0x47')],'as':_0x2337('0x55'),'attributes':['id','name',_0x2337('0x56'),_0x2337('0x57'),_0x2337('0x58')],'raw':!![]}]})['then'](function(_0x1e679e){if(_0x1e679e){var _0x35776b=_[_0x2337('0x59')](_0x1e679e,function(_0x2b8cee){var _0x2627d5=_0x2b8cee['get']({'plain':!![]});return _0x2627d5[_0x2337('0x55')];});return db['WhatsappQueue'][_0x2337('0x34')]({'where':{'id':_0x4c7b6c[_0x2337('0x2b')]['id']}})[_0x2337('0x17')](function(_0x26a1a1){return db[_0x2337('0x5a')][_0x2337('0x5b')](function(_0x4045fc){return _0x26a1a1[_0x2337('0x5c')](_0x10fbcf,{'transaction':_0x4045fc})['then'](function(){return BPromise[_0x2337('0x5d')](_0x35776b,function(_0x3b15df){return db['UserWhatsappQueue'][_0x2337('0x5e')]({'where':{'UserId':_0x3b15df['id'],'WhatsappQueueId':_0x4c7b6c['params']['id']},'transaction':_0x4045fc});});})[_0x2337('0x17')](function(){_0x35776b[_0x2337('0x5f')](function(_0xe4d1e8){socket[_0x2337('0x60')](_0x2337('0x61'),{'UserId':_0xe4d1e8['id'],'WhatsappQueueId':_0x26a1a1['id']});});});});});}})['then'](respondWithStatusCode(_0x791942,null))[_0x2337('0x2a')](handleError(_0x791942,null));};exports[_0x2337('0x62')]=function(_0x274f7a,_0x3793bc){return db[_0x2337('0x51')][_0x2337('0x28')]({'where':{'id':_0x274f7a[_0x2337('0x27')][_0x2337('0x54')]},'attributes':['id'],'include':[{'model':db[_0x2337('0x47')],'as':_0x2337('0x55'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x3793bc,null))[_0x2337('0x17')](function(_0x5a9363){var _0x3587a4=_[_0x2337('0x20')](_0x5a9363,'id');var _0x346444=[];var _0x2bdcd8=[];var _0x443739=squel[_0x2337('0x63')]();_0x443739[_0x2337('0x64')](_0x2337('0x65'))[_0x2337('0x66')](_0x2337('0x67'),'tq')['join'](_0x2337('0x68'),'ut',_0x2337('0x69'))[_0x2337('0x24')](_0x2337('0x6a'),_0x274f7a[_0x2337('0x2b')]['id']);for(var _0x16c121=0x0;_0x16c121<_0x5a9363[_0x2337('0x52')];_0x16c121+=0x1){let _0x3af7c6=_0x5a9363[_0x16c121];for(var _0x1ba30f=0x0;_0x1ba30f<_0x3af7c6[_0x2337('0x55')][_0x2337('0x52')];_0x1ba30f+=0x1){let _0x273af1=_0x3af7c6['Agents'][_0x1ba30f];var _0x39c47f=_0x443739[_0x2337('0x6b')]();_0x39c47f[_0x2337('0x24')](_0x2337('0x6c'),_0x273af1['id']);_0x2bdcd8['push'](db[_0x2337('0x5a')][_0x2337('0x27')](_0x39c47f[_0x2337('0x6d')](),{'type':db[_0x2337('0x5a')]['QueryTypes'][_0x2337('0x6e')]})[_0x2337('0x17')](function(_0x54793c){if(_0x54793c[_0x2337('0x52')]===0x1){return _0x273af1['id'];}else{var _0x5956a6=_[_0x2337('0x6f')](_[_0x2337('0x20')](_0x54793c,_0x2337('0x70')),function(_0x843db6){return _[_0x2337('0x71')](_0x3587a4,_0x843db6);});if(_0x5956a6){return _0x273af1['id'];}}}));}}return BPromise[_0x2337('0x72')](_0x2bdcd8)[_0x2337('0x17')](function(_0x43e9){_0x346444=_(_0x346444)[_0x2337('0x73')](_0x43e9)[_0x2337('0x74')]()['value']();return db[_0x2337('0x25')][_0x2337('0x34')]({'where':{'id':_0x274f7a[_0x2337('0x2b')]['id']}})['then'](function(_0x48e936){return db[_0x2337('0x5a')][_0x2337('0x5b')](function(_0x12189a){return _0x48e936[_0x2337('0x62')](_0x274f7a[_0x2337('0x27')][_0x2337('0x54')],{'transaction':_0x12189a})['then'](function(){if(!_[_0x2337('0x75')](_0x346444)){return _0x48e936[_0x2337('0x76')](_0x346444,{'transaction':_0x12189a});}})[_0x2337('0x17')](function(){_0x346444[_0x2337('0x5f')](function(_0x168053){socket[_0x2337('0x60')](_0x2337('0x77'),{'UserId':_0x168053,'WhatsappQueueId':_0x48e936['id']});});});});});});})['then'](respondWithStatusCode(_0x3793bc,null))[_0x2337('0x2a')](handleError(_0x3793bc,null));};exports['addAgents']=function(_0x3a13ed,_0x59b356){return db[_0x2337('0x25')][_0x2337('0x34')]({'where':{'id':_0x3a13ed['params']['id']}})[_0x2337('0x17')](handleEntityNotFound(_0x59b356,null))[_0x2337('0x17')](function(_0x30151a){if(_0x30151a){return _0x30151a[_0x2337('0x78')](_0x3a13ed[_0x2337('0x36')][_0x2337('0x54')],_[_0x2337('0x79')](_0x3a13ed[_0x2337('0x36')],['ids','id'])||{})['spread'](function(_0xe3e987){for(var _0x5d123e=0x0;_0x5d123e<_0x3a13ed[_0x2337('0x36')][_0x2337('0x54')][_0x2337('0x52')];_0x5d123e+=0x1){socket[_0x2337('0x60')](_0x2337('0x61'),{'UserId':Number(_0x3a13ed[_0x2337('0x36')][_0x2337('0x54')][_0x5d123e]),'WhatsappQueueId':Number(_0x3a13ed[_0x2337('0x2b')]['id'])});}return _0xe3e987;});}})[_0x2337('0x17')](respondWithResult(_0x59b356,null))[_0x2337('0x2a')](handleError(_0x59b356,null));};exports['removeAgents']=function(_0x4f4267,_0x181736){return db[_0x2337('0x25')]['find']({'where':{'id':_0x4f4267[_0x2337('0x2b')]['id']}})[_0x2337('0x17')](handleEntityNotFound(_0x181736,null))[_0x2337('0x17')](function(_0x57a8fd){if(_0x57a8fd){return _0x57a8fd['removeAgents'](_0x4f4267['query'][_0x2337('0x54')])[_0x2337('0x17')](function(){if(_[_0x2337('0x7a')](_0x4f4267[_0x2337('0x27')][_0x2337('0x54')])){for(var _0x1f70e0=0x0;_0x1f70e0<_0x4f4267[_0x2337('0x27')][_0x2337('0x54')][_0x2337('0x52')];_0x1f70e0+=0x1){socket[_0x2337('0x60')](_0x2337('0x77'),{'UserId':Number(_0x4f4267[_0x2337('0x27')][_0x2337('0x54')][_0x1f70e0]),'WhatsappQueueId':Number(_0x4f4267[_0x2337('0x2b')]['id'])});}}else{socket[_0x2337('0x60')](_0x2337('0x77'),{'UserId':Number(_0x4f4267[_0x2337('0x27')]['ids']),'WhatsappQueueId':Number(_0x4f4267[_0x2337('0x2b')]['id'])});}});}})[_0x2337('0x17')](respondWithStatusCode(_0x181736,null))[_0x2337('0x2a')](handleError(_0x181736,null));};exports[_0x2337('0x7b')]=function(_0x3aec94,_0x19d9ab){var _0x493e99={};var _0x569bff={};var _0x29b1a4;var _0x49fa49;return db[_0x2337('0x25')][_0x2337('0x3f')]({'where':{'id':_0x3aec94['params']['id']}})[_0x2337('0x17')](handleEntityNotFound(_0x19d9ab,null))['then'](function(_0x1a92a2){if(_0x1a92a2){_0x29b1a4=_0x1a92a2;_0x569bff[_0x2337('0x2c')]=_[_0x2337('0x2d')](db[_0x2337('0x47')]['rawAttributes']);_0x569bff['query']=_[_0x2337('0x2d')](_0x3aec94[_0x2337('0x27')]);_0x569bff[_0x2337('0x2e')]=_['intersection'](_0x569bff[_0x2337('0x2c')],_0x569bff[_0x2337('0x27')]);_0x493e99[_0x2337('0x30')]=_['intersection'](_0x569bff[_0x2337('0x2c')],qs[_0x2337('0x31')](_0x3aec94[_0x2337('0x27')][_0x2337('0x31')]));_0x493e99[_0x2337('0x30')]=_0x493e99[_0x2337('0x30')][_0x2337('0x52')]?_0x493e99[_0x2337('0x30')]:_0x569bff[_0x2337('0x2c')];_0x493e99[_0x2337('0x41')]=qs[_0x2337('0x42')](_0x3aec94['query'][_0x2337('0x42')]);_0x493e99['where']=qs[_0x2337('0x2e')](_[_0x2337('0x43')](_0x3aec94[_0x2337('0x27')],_0x569bff[_0x2337('0x2e')]));if(_0x3aec94[_0x2337('0x27')][_0x2337('0x45')]){_0x493e99[_0x2337('0x24')]=_[_0x2337('0x32')](_0x493e99['where'],{'$or':_['map'](_0x493e99[_0x2337('0x30')],function(_0xca3616){var _0x5249d8={};_0x5249d8[_0xca3616]={'$like':'%'+_0x3aec94['query'][_0x2337('0x45')]+'%'};return _0x5249d8;})});}_0x493e99=_[_0x2337('0x32')]({},_0x493e99,_0x3aec94['options']);return _0x29b1a4[_0x2337('0x7b')](_0x493e99);}})[_0x2337('0x17')](function(_0x17e549){if(_0x17e549){_0x49fa49=_0x17e549[_0x2337('0x52')];if(!_0x3aec94['query'][_0x2337('0x53')](_0x2337('0x40'))){_0x493e99[_0x2337('0x12')]=qs[_0x2337('0x12')](_0x3aec94[_0x2337('0x27')]['limit']);_0x493e99[_0x2337('0x10')]=qs[_0x2337('0x10')](_0x3aec94[_0x2337('0x27')][_0x2337('0x10')]);}return _0x29b1a4[_0x2337('0x7b')](_0x493e99);}})[_0x2337('0x17')](function(_0x39d405){if(_0x39d405){return _0x39d405?{'count':_0x49fa49,'rows':_0x39d405}:null;}})[_0x2337('0x17')](respondWithResult(_0x19d9ab,null))['catch'](handleError(_0x19d9ab,null));}; \ No newline at end of file +var _0x224f=['omit','spread','removeAgents','isArray','getAgents','sort','util','lodash','squel','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','then','destroy','get','WhatsappQueues','UserProfileResource','error','name','send','index','map','WhatsappQueue','type','key','include','show','params','model','rawAttributes','filters','intersection','attributes','fields','query','length','merge','options','find','catch','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','findOne','keys','UserWhatsappQueue','hasOwnProperty','nolimit','order','pick','where','filter','findAll','User','findAndCountAll','UserId','agent','whatsappPause','updatedAt','createdAt','format','%s/%s','getTeams','Team','addTeams','ids','Agents','online','voicePause','interface','sequelize','each','findOrCreate','emit','userWhatsappQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_whatsapp_queues','join','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','union','compact','value','transaction','isEmpty','forEach','userWhatsappQueue:remove','addAgents'];(function(_0x26eb18,_0x545bf7){var _0x10e4c5=function(_0x162e2d){while(--_0x162e2d){_0x26eb18['push'](_0x26eb18['shift']());}};_0x10e4c5(++_0x545bf7);}(_0x224f,0x180));var _0xf224=function(_0x5216e0,_0x4f8cb9){_0x5216e0=_0x5216e0-0x0;var _0x5b3f40=_0x224f[_0x5216e0];return _0x5b3f40;};'use strict';var BPromise=require('bluebird');var util=require(_0xf224('0x0'));var _=require(_0xf224('0x1'));var squel=require(_0xf224('0x2'));var Redis=require(_0xf224('0x3'));var qs=require(_0xf224('0x4'));var logger=require('../../config/logger')(_0xf224('0x5'));var config=require(_0xf224('0x6'));var db=require(_0xf224('0x7'))['db'];config['redis']=_[_0xf224('0x8')](config[_0xf224('0x9')],{'host':_0xf224('0xa'),'port':0x18eb});var socket=require(_0xf224('0xb'))(new Redis(config[_0xf224('0x9')]));require(_0xf224('0xc'))[_0xf224('0xd')](socket);function respondWithStatusCode(_0x4bf276,_0x51ee2b){_0x51ee2b=_0x51ee2b||0xcc;return function(_0x2de82a){if(_0x2de82a){return _0x4bf276[_0xf224('0xe')](_0x51ee2b);}return _0x4bf276[_0xf224('0xf')](_0x51ee2b)['end']();};}function respondWithResult(_0xcfab84,_0x237612){_0x237612=_0x237612||0xc8;return function(_0x2761d8){if(_0x2761d8){return _0xcfab84[_0xf224('0xf')](_0x237612)[_0xf224('0x10')](_0x2761d8);}};}function respondWithFilteredResult(_0x356584,_0x2ff069){return function(_0x54ebba){if(_0x54ebba){var _0x646f3a=typeof _0x2ff069['offset']===_0xf224('0x11')&&typeof _0x2ff069['limit']===_0xf224('0x11');var _0x51751f=_0x54ebba[_0xf224('0x12')];var _0xbfd8d3=_0x646f3a?0x0:_0x2ff069[_0xf224('0x13')];var _0x11e8e7=_0x646f3a?_0x54ebba[_0xf224('0x12')]:_0x2ff069[_0xf224('0x13')]+_0x2ff069[_0xf224('0x14')];var _0xe910d7;if(_0x11e8e7>=_0x51751f){_0x11e8e7=_0x51751f;_0xe910d7=0xc8;}else{_0xe910d7=0xce;}_0x356584[_0xf224('0xf')](_0xe910d7);return _0x356584[_0xf224('0x15')](_0xf224('0x16'),_0xbfd8d3+'-'+_0x11e8e7+'/'+_0x51751f)[_0xf224('0x10')](_0x54ebba);}return null;};}function saveUpdates(_0x3dfc1d){return function(_0x5da674){if(_0x5da674){return _0x5da674['update'](_0x3dfc1d)[_0xf224('0x17')](function(_0x588703){return _0x588703;});}return null;};}function removeEntity(_0x365916){return function(_0x4f19be){if(_0x4f19be){return _0x4f19be[_0xf224('0x18')]()[_0xf224('0x17')](function(){var _0x2cb6c5=_0x4f19be[_0xf224('0x19')]({'plain':!![]});var _0x29ccc3=_0xf224('0x1a');return db[_0xf224('0x1b')][_0xf224('0x18')]({'where':{'type':_0x29ccc3,'resourceId':_0x2cb6c5['id']}})['then'](function(){return _0x4f19be;});})[_0xf224('0x17')](function(){_0x365916[_0xf224('0xf')](0xcc)['end']();});}};}function handleEntityNotFound(_0x567327){return function(_0x54afa8){if(!_0x54afa8){_0x567327[_0xf224('0xe')](0x194);}return _0x54afa8;};}function handleError(_0x1303b3,_0x40a3b2){_0x40a3b2=_0x40a3b2||0x1f4;return function(_0x5ea026){logger[_0xf224('0x1c')](_0x5ea026['stack']);if(_0x5ea026[_0xf224('0x1d')]){delete _0x5ea026[_0xf224('0x1d')];}_0x1303b3['status'](_0x40a3b2)[_0xf224('0x1e')](_0x5ea026);};}exports[_0xf224('0x1f')]=function(_0x5b69ea,_0x4c04d6){var _0x48605a={};var _0x186854={'count':0x0,'rows':[]};var _0x427993=_[_0xf224('0x20')](db[_0xf224('0x21')]['rawAttributes'],function(_0x5172b3){return{'name':_0x5172b3['fieldName'],'type':_0x5172b3[_0xf224('0x22')][_0xf224('0x23')]};});_0x48605a=qs['getOptions'](_0x427993,_0x5b69ea);var _0x5ae94a={'where':_0x48605a['where']};return db[_0xf224('0x21')][_0xf224('0x12')](_0x5ae94a)[_0xf224('0x17')](function(_0x3aaca0){_0x186854[_0xf224('0x12')]=_0x3aaca0;_0x48605a[_0xf224('0x24')]=qs['include'](_0x5b69ea['query']);return db['WhatsappQueue']['findAll'](_0x48605a);})[_0xf224('0x17')](function(_0x2ead57){_0x186854['rows']=_0x2ead57;return _0x186854;})[_0xf224('0x17')](respondWithFilteredResult(_0x4c04d6,_0x48605a))['catch'](handleError(_0x4c04d6,null));};exports[_0xf224('0x25')]=function(_0x7f283e,_0x527200){var _0x5078f9={'raw':!![],'where':{'id':_0x7f283e[_0xf224('0x26')]['id']}},_0xbaf0e2={};_0xbaf0e2[_0xf224('0x27')]=_['keys'](db[_0xf224('0x21')][_0xf224('0x28')]);_0xbaf0e2['query']=_['keys'](_0x7f283e['query']);_0xbaf0e2[_0xf224('0x29')]=_[_0xf224('0x2a')](_0xbaf0e2[_0xf224('0x27')],_0xbaf0e2['query']);_0x5078f9[_0xf224('0x2b')]=_[_0xf224('0x2a')](_0xbaf0e2[_0xf224('0x27')],qs[_0xf224('0x2c')](_0x7f283e[_0xf224('0x2d')][_0xf224('0x2c')]));_0x5078f9[_0xf224('0x2b')]=_0x5078f9[_0xf224('0x2b')][_0xf224('0x2e')]?_0x5078f9[_0xf224('0x2b')]:_0xbaf0e2['model'];if(_0x7f283e[_0xf224('0x2d')]['includeAll']){_0x5078f9['include']=[{'all':!![]}];}_0x5078f9=_[_0xf224('0x2f')]({},_0x5078f9,_0x7f283e[_0xf224('0x30')]);return db[_0xf224('0x21')][_0xf224('0x31')](_0x5078f9)[_0xf224('0x17')](handleEntityNotFound(_0x527200,null))['then'](respondWithResult(_0x527200,null))[_0xf224('0x32')](handleError(_0x527200,null));};exports['create']=function(_0x3fdd6d,_0x667e30){return db[_0xf224('0x21')]['create'](_0x3fdd6d[_0xf224('0x33')],{})['then'](function(_0x18d335){var _0x153290=_0x3fdd6d[_0xf224('0x34')][_0xf224('0x19')]({'plain':!![]});if(!_0x153290)throw new Error(_0xf224('0x35'));if(_0x153290[_0xf224('0x36')]==='user'){var _0x3c37d5=_0x18d335[_0xf224('0x19')]({'plain':!![]});var _0x495d99='WhatsappQueues';return db[_0xf224('0x37')]['find']({'where':{'name':_0x495d99,'userProfileId':_0x153290[_0xf224('0x38')]},'raw':!![]})['then'](function(_0xc2ef6e){if(_0xc2ef6e&&_0xc2ef6e['autoAssociation']===0x0){return db['UserProfileResource'][_0xf224('0x39')]({'name':_0x3c37d5[_0xf224('0x1d')],'resourceId':_0x3c37d5['id'],'type':_0xc2ef6e[_0xf224('0x1d')],'sectionId':_0xc2ef6e['id']},{})[_0xf224('0x17')](function(){return _0x18d335;});}else{return _0x18d335;}})[_0xf224('0x32')](function(_0x270f46){logger[_0xf224('0x1c')](_0xf224('0x3a'),_0x270f46);throw _0x270f46;});}return _0x18d335;})['then'](respondWithResult(_0x667e30,0xc9))[_0xf224('0x32')](handleError(_0x667e30,null));};exports[_0xf224('0x3b')]=function(_0x3ba3aa,_0x28bf4e){if(_0x3ba3aa[_0xf224('0x33')]['id']){delete _0x3ba3aa[_0xf224('0x33')]['id'];}return db[_0xf224('0x21')][_0xf224('0x31')]({'where':{'id':_0x3ba3aa[_0xf224('0x26')]['id']}})[_0xf224('0x17')](handleEntityNotFound(_0x28bf4e,null))[_0xf224('0x17')](saveUpdates(_0x3ba3aa[_0xf224('0x33')],null))[_0xf224('0x17')](respondWithResult(_0x28bf4e,null))[_0xf224('0x32')](handleError(_0x28bf4e,null));};exports[_0xf224('0x18')]=function(_0xf24f3,_0x245c19){return db[_0xf224('0x21')][_0xf224('0x31')]({'where':{'id':_0xf24f3['params']['id']}})[_0xf224('0x17')](handleEntityNotFound(_0x245c19,null))[_0xf224('0x17')](removeEntity(_0x245c19,null))[_0xf224('0x32')](handleError(_0x245c19,null));};exports[_0xf224('0x3c')]=function(_0x5203fa,_0x1f0601){return db[_0xf224('0x21')]['describe']()[_0xf224('0x17')](respondWithResult(_0x1f0601,null))[_0xf224('0x32')](handleError(_0x1f0601,null));};exports[_0xf224('0x3d')]=function(_0x275495,_0x3c0f33){var _0x98b4a4={'raw':!![],'where':{}},_0x457fcb={},_0x595e4a;return db[_0xf224('0x21')][_0xf224('0x3e')]({'where':{'id':_0x275495['params']['id']}})[_0xf224('0x17')](handleEntityNotFound(_0x3c0f33,null))['then'](function(_0x239105){if(_0x239105){_0x595e4a=_0x239105[_0xf224('0x19')]({'plain':!![]});_0x457fcb[_0xf224('0x27')]=_[_0xf224('0x3f')](db[_0xf224('0x40')][_0xf224('0x28')]);_0x457fcb[_0xf224('0x2d')]=_[_0xf224('0x3f')](_0x275495['query']);_0x457fcb[_0xf224('0x29')]=_[_0xf224('0x2a')](_0x457fcb[_0xf224('0x27')],_0x457fcb['query']);_0x98b4a4[_0xf224('0x2b')]=_[_0xf224('0x2a')](_0x457fcb[_0xf224('0x27')],qs[_0xf224('0x2c')](_0x275495[_0xf224('0x2d')][_0xf224('0x2c')]));_0x98b4a4[_0xf224('0x2b')]=_0x98b4a4[_0xf224('0x2b')]['length']?_0x98b4a4['attributes']:_0x457fcb[_0xf224('0x27')];if(!_0x275495['query'][_0xf224('0x41')](_0xf224('0x42'))){_0x98b4a4[_0xf224('0x14')]=qs[_0xf224('0x14')](_0x275495[_0xf224('0x2d')][_0xf224('0x14')]);_0x98b4a4['offset']=qs[_0xf224('0x13')](_0x275495['query'][_0xf224('0x13')]);}_0x98b4a4[_0xf224('0x43')]=qs['sort'](_0x275495['query']['sort']);_0x98b4a4['where']=qs[_0xf224('0x29')](_[_0xf224('0x44')](_0x275495['query'],_0x457fcb['filters']));_0x98b4a4[_0xf224('0x45')]['WhatsappQueueId']=_0x239105['id'];if(_0x275495[_0xf224('0x2d')][_0xf224('0x46')]){_0x98b4a4[_0xf224('0x45')]=_[_0xf224('0x2f')](_0x98b4a4[_0xf224('0x45')],{'$or':_[_0xf224('0x20')](_0x98b4a4['attributes'],function(_0x2061e6){var _0xcfcd26={};_0xcfcd26[_0x2061e6]={'$like':'%'+_0x275495[_0xf224('0x2d')][_0xf224('0x46')]+'%'};return _0xcfcd26;})});}_0x98b4a4=_[_0xf224('0x2f')]({},_0x98b4a4,_0x275495['options']);return db[_0xf224('0x40')][_0xf224('0x47')](_0x98b4a4);}})['then'](function(_0x4b863d){if(_0x4b863d){return db[_0xf224('0x48')][_0xf224('0x49')]({'where':{'id':_[_0xf224('0x20')](_0x4b863d,_0xf224('0x4a')),'role':_0xf224('0x4b')},'attributes':['id',_0xf224('0x1d'),_0xf224('0x4c'),_0xf224('0x4d'),_0xf224('0x4e')]});}})['then'](function(_0x7723d1){if(_0x7723d1){return{'count':_0x7723d1[_0xf224('0x12')],'rows':_['map'](_0x7723d1['rows'],function(_0x4b9895){return{'membername':_0x4b9895[_0xf224('0x1d')],'UserId':_0x4b9895['id'],'queue_name':_0x595e4a[_0xf224('0x1d')],'WhatsappQueueId':_0x595e4a['id'],'interface':util[_0xf224('0x4f')](_0xf224('0x50'),'SIP',_0x4b9895[_0xf224('0x1d')]),'penalty':0x0,'paused':_0x4b9895['whatsappPause'],'createdAt':_0x4b9895[_0xf224('0x4e')],'updatedAt':_0x4b9895[_0xf224('0x4d')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x3c0f33,_0x98b4a4))[_0xf224('0x32')](handleError(_0x3c0f33,null));};exports[_0xf224('0x51')]=function(_0x1ef165,_0x5d010b){var _0x420cbc={};var _0x15f122={};var _0x47c4de;var _0x19fd1b;return db['WhatsappQueue']['findOne']({'where':{'id':_0x1ef165[_0xf224('0x26')]['id']}})['then'](handleEntityNotFound(_0x5d010b,null))['then'](function(_0x1c4185){if(_0x1c4185){_0x47c4de=_0x1c4185;_0x15f122[_0xf224('0x27')]=_[_0xf224('0x3f')](db[_0xf224('0x52')][_0xf224('0x28')]);_0x15f122['query']=_[_0xf224('0x3f')](_0x1ef165[_0xf224('0x2d')]);_0x15f122['filters']=_['intersection'](_0x15f122[_0xf224('0x27')],_0x15f122['query']);_0x420cbc[_0xf224('0x2b')]=_['intersection'](_0x15f122[_0xf224('0x27')],qs[_0xf224('0x2c')](_0x1ef165[_0xf224('0x2d')][_0xf224('0x2c')]));_0x420cbc['attributes']=_0x420cbc[_0xf224('0x2b')]['length']?_0x420cbc[_0xf224('0x2b')]:_0x15f122[_0xf224('0x27')];_0x420cbc['order']=qs['sort'](_0x1ef165['query']['sort']);_0x420cbc[_0xf224('0x45')]=qs[_0xf224('0x29')](_[_0xf224('0x44')](_0x1ef165[_0xf224('0x2d')],_0x15f122[_0xf224('0x29')]));if(_0x1ef165['query']['filter']){_0x420cbc['where']=_[_0xf224('0x2f')](_0x420cbc[_0xf224('0x45')],{'$or':_[_0xf224('0x20')](_0x420cbc[_0xf224('0x2b')],function(_0x1b198f){var _0x2b7e43={};_0x2b7e43[_0x1b198f]={'$like':'%'+_0x1ef165[_0xf224('0x2d')][_0xf224('0x46')]+'%'};return _0x2b7e43;})});}_0x420cbc=_[_0xf224('0x2f')]({},_0x420cbc,_0x1ef165[_0xf224('0x30')]);return _0x47c4de[_0xf224('0x51')](_0x420cbc);}})['then'](function(_0x2c85be){if(_0x2c85be){_0x19fd1b=_0x2c85be[_0xf224('0x2e')];if(!_0x1ef165[_0xf224('0x2d')][_0xf224('0x41')](_0xf224('0x42'))){_0x420cbc[_0xf224('0x14')]=qs[_0xf224('0x14')](_0x1ef165['query'][_0xf224('0x14')]);_0x420cbc[_0xf224('0x13')]=qs[_0xf224('0x13')](_0x1ef165[_0xf224('0x2d')][_0xf224('0x13')]);}return _0x47c4de[_0xf224('0x51')](_0x420cbc);}})[_0xf224('0x17')](function(_0x2465a8){if(_0x2465a8){return _0x2465a8?{'count':_0x19fd1b,'rows':_0x2465a8}:null;}})[_0xf224('0x17')](respondWithResult(_0x5d010b,null))[_0xf224('0x32')](handleError(_0x5d010b,null));};exports[_0xf224('0x53')]=function(_0x5853d8,_0xe52090){var _0x5248ee=_0x5853d8[_0xf224('0x33')][_0xf224('0x54')];return db[_0xf224('0x52')][_0xf224('0x47')]({'where':{'id':_0x5248ee},'attributes':['id'],'include':[{'model':db[_0xf224('0x48')],'as':_0xf224('0x55'),'attributes':['id','name',_0xf224('0x56'),_0xf224('0x57'),_0xf224('0x58')],'raw':!![]}]})[_0xf224('0x17')](function(_0x1ddbb4){if(_0x1ddbb4){var _0x25b402=_['flatMap'](_0x1ddbb4,function(_0x2bfe15){var _0x347281=_0x2bfe15['get']({'plain':!![]});return _0x347281['Agents'];});return db[_0xf224('0x21')]['find']({'where':{'id':_0x5853d8[_0xf224('0x26')]['id']}})[_0xf224('0x17')](function(_0x508387){return db[_0xf224('0x59')]['transaction'](function(_0x19e0f5){return _0x508387[_0xf224('0x53')](_0x5248ee,{'transaction':_0x19e0f5})[_0xf224('0x17')](function(){return BPromise[_0xf224('0x5a')](_0x25b402,function(_0x4fece1){return db[_0xf224('0x40')][_0xf224('0x5b')]({'where':{'UserId':_0x4fece1['id'],'WhatsappQueueId':_0x5853d8[_0xf224('0x26')]['id']},'transaction':_0x19e0f5});});})[_0xf224('0x17')](function(){_0x25b402['forEach'](function(_0x4106ce){socket[_0xf224('0x5c')](_0xf224('0x5d'),{'UserId':_0x4106ce['id'],'WhatsappQueueId':_0x508387['id']});});});});});}})[_0xf224('0x17')](respondWithStatusCode(_0xe52090,null))['catch'](handleError(_0xe52090,null));};exports[_0xf224('0x5e')]=function(_0x4b31e7,_0x415f8f){return db[_0xf224('0x52')][_0xf224('0x47')]({'where':{'id':_0x4b31e7[_0xf224('0x2d')][_0xf224('0x54')]},'attributes':['id'],'include':[{'model':db[_0xf224('0x48')],'as':_0xf224('0x55'),'attributes':['id'],'raw':!![]}]})[_0xf224('0x17')](handleEntityNotFound(_0x415f8f,null))[_0xf224('0x17')](function(_0x265317){var _0xc8c41a=_[_0xf224('0x20')](_0x265317,'id');var _0x5b7cab=[];var _0x4bed90=[];var _0x223506=squel[_0xf224('0x5f')]();_0x223506[_0xf224('0x60')](_0xf224('0x61'))[_0xf224('0x62')](_0xf224('0x63'),'tq')[_0xf224('0x64')]('user_has_teams','ut',_0xf224('0x65'))[_0xf224('0x45')](_0xf224('0x66'),_0x4b31e7[_0xf224('0x26')]['id']);for(var _0x167bcd=0x0;_0x167bcd<_0x265317[_0xf224('0x2e')];_0x167bcd+=0x1){let _0x3dfd45=_0x265317[_0x167bcd];for(var _0x2ba4ef=0x0;_0x2ba4ef<_0x3dfd45[_0xf224('0x55')][_0xf224('0x2e')];_0x2ba4ef+=0x1){let _0x5aefa5=_0x3dfd45[_0xf224('0x55')][_0x2ba4ef];var _0x1aab21=_0x223506[_0xf224('0x67')]();_0x1aab21['where'](_0xf224('0x68'),_0x5aefa5['id']);_0x4bed90[_0xf224('0x69')](db['sequelize'][_0xf224('0x2d')](_0x1aab21[_0xf224('0x6a')](),{'type':db[_0xf224('0x59')][_0xf224('0x6b')][_0xf224('0x6c')]})[_0xf224('0x17')](function(_0x44c931){if(_0x44c931[_0xf224('0x2e')]===0x1){return _0x5aefa5['id'];}else{var _0x2394a4=_[_0xf224('0x6d')](_[_0xf224('0x20')](_0x44c931,_0xf224('0x6e')),function(_0x296c45){return _[_0xf224('0x6f')](_0xc8c41a,_0x296c45);});if(_0x2394a4){return _0x5aefa5['id'];}}}));}}return BPromise['all'](_0x4bed90)[_0xf224('0x17')](function(_0x1f07d4){_0x5b7cab=_(_0x5b7cab)[_0xf224('0x70')](_0x1f07d4)[_0xf224('0x71')]()[_0xf224('0x72')]();return db[_0xf224('0x21')][_0xf224('0x31')]({'where':{'id':_0x4b31e7[_0xf224('0x26')]['id']}})[_0xf224('0x17')](function(_0x5382d6){return db[_0xf224('0x59')][_0xf224('0x73')](function(_0x1ff74e){return _0x5382d6[_0xf224('0x5e')](_0x4b31e7[_0xf224('0x2d')][_0xf224('0x54')],{'transaction':_0x1ff74e})['then'](function(){if(!_[_0xf224('0x74')](_0x5b7cab)){return _0x5382d6['removeAgents'](_0x5b7cab,{'transaction':_0x1ff74e});}})[_0xf224('0x17')](function(){_0x5b7cab[_0xf224('0x75')](function(_0x3026e7){socket[_0xf224('0x5c')](_0xf224('0x76'),{'UserId':_0x3026e7,'WhatsappQueueId':_0x5382d6['id']});});});});});});})[_0xf224('0x17')](respondWithStatusCode(_0x415f8f,null))['catch'](handleError(_0x415f8f,null));};exports[_0xf224('0x77')]=function(_0x54a3ad,_0x1b512e){return db['WhatsappQueue']['find']({'where':{'id':_0x54a3ad[_0xf224('0x26')]['id']}})[_0xf224('0x17')](handleEntityNotFound(_0x1b512e,null))[_0xf224('0x17')](function(_0x20f8b4){if(_0x20f8b4){return _0x20f8b4[_0xf224('0x77')](_0x54a3ad[_0xf224('0x33')][_0xf224('0x54')],_[_0xf224('0x78')](_0x54a3ad['body'],['ids','id'])||{})[_0xf224('0x79')](function(_0x28854f){for(var _0x35c1f6=0x0;_0x35c1f6<_0x54a3ad[_0xf224('0x33')]['ids'][_0xf224('0x2e')];_0x35c1f6+=0x1){socket[_0xf224('0x5c')](_0xf224('0x5d'),{'UserId':Number(_0x54a3ad['body'][_0xf224('0x54')][_0x35c1f6]),'WhatsappQueueId':Number(_0x54a3ad[_0xf224('0x26')]['id'])});}return _0x28854f;});}})[_0xf224('0x17')](respondWithResult(_0x1b512e,null))[_0xf224('0x32')](handleError(_0x1b512e,null));};exports[_0xf224('0x7a')]=function(_0xe49d8b,_0x5edab7){return db['WhatsappQueue']['find']({'where':{'id':_0xe49d8b[_0xf224('0x26')]['id']}})[_0xf224('0x17')](handleEntityNotFound(_0x5edab7,null))[_0xf224('0x17')](function(_0x4d9693){if(_0x4d9693){return _0x4d9693[_0xf224('0x7a')](_0xe49d8b[_0xf224('0x2d')][_0xf224('0x54')])['then'](function(){if(_[_0xf224('0x7b')](_0xe49d8b['query'][_0xf224('0x54')])){for(var _0x5db567=0x0;_0x5db567<_0xe49d8b['query'][_0xf224('0x54')][_0xf224('0x2e')];_0x5db567+=0x1){socket['emit'](_0xf224('0x76'),{'UserId':Number(_0xe49d8b[_0xf224('0x2d')][_0xf224('0x54')][_0x5db567]),'WhatsappQueueId':Number(_0xe49d8b['params']['id'])});}}else{socket['emit']('userWhatsappQueue:remove',{'UserId':Number(_0xe49d8b[_0xf224('0x2d')][_0xf224('0x54')]),'WhatsappQueueId':Number(_0xe49d8b[_0xf224('0x26')]['id'])});}});}})[_0xf224('0x17')](respondWithStatusCode(_0x5edab7,null))[_0xf224('0x32')](handleError(_0x5edab7,null));};exports[_0xf224('0x7c')]=function(_0x4974bc,_0x2aaf5a){var _0xca3ab0={};var _0x34417d={};var _0xaab838;var _0x78f720;return db[_0xf224('0x21')]['findOne']({'where':{'id':_0x4974bc['params']['id']}})[_0xf224('0x17')](handleEntityNotFound(_0x2aaf5a,null))['then'](function(_0x33ee51){if(_0x33ee51){_0xaab838=_0x33ee51;_0x34417d[_0xf224('0x27')]=_[_0xf224('0x3f')](db['User']['rawAttributes']);_0x34417d[_0xf224('0x2d')]=_[_0xf224('0x3f')](_0x4974bc[_0xf224('0x2d')]);_0x34417d[_0xf224('0x29')]=_[_0xf224('0x2a')](_0x34417d['model'],_0x34417d['query']);_0xca3ab0['attributes']=_[_0xf224('0x2a')](_0x34417d['model'],qs[_0xf224('0x2c')](_0x4974bc[_0xf224('0x2d')][_0xf224('0x2c')]));_0xca3ab0[_0xf224('0x2b')]=_0xca3ab0[_0xf224('0x2b')]['length']?_0xca3ab0[_0xf224('0x2b')]:_0x34417d[_0xf224('0x27')];_0xca3ab0['order']=qs[_0xf224('0x7d')](_0x4974bc[_0xf224('0x2d')][_0xf224('0x7d')]);_0xca3ab0[_0xf224('0x45')]=qs['filters'](_['pick'](_0x4974bc[_0xf224('0x2d')],_0x34417d['filters']));if(_0x4974bc['query']['filter']){_0xca3ab0[_0xf224('0x45')]=_['merge'](_0xca3ab0[_0xf224('0x45')],{'$or':_[_0xf224('0x20')](_0xca3ab0['attributes'],function(_0x8c8d29){var _0x57dedf={};_0x57dedf[_0x8c8d29]={'$like':'%'+_0x4974bc[_0xf224('0x2d')][_0xf224('0x46')]+'%'};return _0x57dedf;})});}_0xca3ab0=_[_0xf224('0x2f')]({},_0xca3ab0,_0x4974bc[_0xf224('0x30')]);return _0xaab838[_0xf224('0x7c')](_0xca3ab0);}})[_0xf224('0x17')](function(_0x4b0b07){if(_0x4b0b07){_0x78f720=_0x4b0b07['length'];if(!_0x4974bc[_0xf224('0x2d')]['hasOwnProperty'](_0xf224('0x42'))){_0xca3ab0[_0xf224('0x14')]=qs[_0xf224('0x14')](_0x4974bc['query'][_0xf224('0x14')]);_0xca3ab0['offset']=qs[_0xf224('0x13')](_0x4974bc[_0xf224('0x2d')]['offset']);}return _0xaab838[_0xf224('0x7c')](_0xca3ab0);}})[_0xf224('0x17')](function(_0x4d20df){if(_0x4d20df){return _0x4d20df?{'count':_0x78f720,'rows':_0x4d20df}:null;}})[_0xf224('0x17')](respondWithResult(_0x2aaf5a,null))[_0xf224('0x32')](handleError(_0x2aaf5a,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 6f231bf..7956538 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 _0x9072=['hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit'];(function(_0x16787a,_0x1038d1){var _0x465ccb=function(_0x378066){while(--_0x378066){_0x16787a['push'](_0x16787a['shift']());}};_0x465ccb(++_0x1038d1);}(_0x9072,0x1e3));var _0x2907=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9072[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x2907('0x0'));var WhatsappQueue=require(_0x2907('0x1'))['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x2907('0x2')](0x0);var events={'afterCreate':_0x2907('0x3'),'afterUpdate':_0x2907('0x4'),'afterDestroy':_0x2907('0x5')};function emitEvent(_0x1e1168){return function(_0xc0de29,_0x1ce2cf,_0x21ab71){WhatsappQueueEvents['emit'](_0x1e1168+':'+_0xc0de29['id'],_0xc0de29);WhatsappQueueEvents[_0x2907('0x6')](_0x1e1168,_0xc0de29);_0x21ab71(null);};}for(var e in events){if(events[_0x2907('0x7')](e)){var event=events[e];WhatsappQueue[_0x2907('0x8')](e,emitEvent(event));}}module[_0x2907('0x9')]=WhatsappQueueEvents; \ No newline at end of file +var _0x0796=['remove','emit','hasOwnProperty','hook','exports','events','WhatsappQueue','save','update'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x0796,0x68));var _0x6079=function(_0x61f31a,_0x3a4f21){_0x61f31a=_0x61f31a-0x0;var _0x188828=_0x0796[_0x61f31a];return _0x188828;};'use strict';var EventEmitter=require(_0x6079('0x0'));var WhatsappQueue=require('../../mysqldb')['db'][_0x6079('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6079('0x2'),'afterUpdate':_0x6079('0x3'),'afterDestroy':_0x6079('0x4')};function emitEvent(_0x18453e){return function(_0x4c09b7,_0x4f7407,_0x587c10){WhatsappQueueEvents[_0x6079('0x5')](_0x18453e+':'+_0x4c09b7['id'],_0x4c09b7);WhatsappQueueEvents[_0x6079('0x5')](_0x18453e,_0x4c09b7);_0x587c10(null);};}for(var e in events){if(events[_0x6079('0x6')](e)){var event=events[e];WhatsappQueue[_0x6079('0x7')](e,emitEvent(event));}}module[_0x6079('0x8')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 0cffb60..cabd25a 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 _0xf592=['define','WhatsappQueue','whatsapp_queues','lodash','api','path','rimraf'];(function(_0x3b4cbb,_0x40e989){var _0x35ae45=function(_0x11e53b){while(--_0x11e53b){_0x3b4cbb['push'](_0x3b4cbb['shift']());}};_0x35ae45(++_0x40e989);}(_0xf592,0x7a));var _0x2f59=function(_0x578b52,_0x26ffe1){_0x578b52=_0x578b52-0x0;var _0x4702b5=_0xf592[_0x578b52];return _0x4702b5;};'use strict';var _=require(_0x2f59('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x2f59('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2f59('0x2'));var rimraf=require(_0x2f59('0x3'));var config=require('../../config/environment');var attributes=require('./whatsappQueue.attributes');module['exports']=function(_0x2c1446,_0x5384f9){return _0x2c1446[_0x2f59('0x4')](_0x2f59('0x5'),attributes,{'tableName':_0x2f59('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3cb7=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./whatsappQueue.attributes','exports','define','WhatsappQueue','whatsapp_queues'];(function(_0x57fa7e,_0xd0b5ce){var _0x320671=function(_0x3392cc){while(--_0x3392cc){_0x57fa7e['push'](_0x57fa7e['shift']());}};_0x320671(++_0xd0b5ce);}(_0x3cb7,0x1c7));var _0x73cb=function(_0x1aeda2,_0x1217eb){_0x1aeda2=_0x1aeda2-0x0;var _0x32dc6d=_0x3cb7[_0x1aeda2];return _0x32dc6d;};'use strict';var _=require(_0x73cb('0x0'));var util=require(_0x73cb('0x1'));var logger=require(_0x73cb('0x2'))('api');var moment=require(_0x73cb('0x3'));var BPromise=require(_0x73cb('0x4'));var rp=require(_0x73cb('0x5'));var fs=require('fs');var path=require(_0x73cb('0x6'));var rimraf=require(_0x73cb('0x7'));var config=require('../../config/environment');var attributes=require(_0x73cb('0x8'));module[_0x73cb('0x9')]=function(_0x421f78,_0x4cd650){return _0x421f78[_0x73cb('0xa')](_0x73cb('0xb'),attributes,{'tableName':_0x73cb('0xc'),'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 9b6dd50..c8173ba 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 _0x8f01=['stringify','error','code','message','result','WhatsappQueue','findAll','raw','options','where','attributes','limit','include','map','model','info','debug','GetWhatsappQueue','ShowWhatsappQueue','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./whatsappQueue.socket','register','then','WhatsappQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x4ca333,_0x1218a3){var _0x13b2e1=function(_0x1eaf45){while(--_0x1eaf45){_0x4ca333['push'](_0x4ca333['shift']());}};_0x13b2e1(++_0x1218a3);}(_0x8f01,0x144));var _0x18f0=function(_0x4b5813,_0x5769de){_0x4b5813=_0x4b5813-0x0;var _0x423465=_0x8f01[_0x4b5813];return _0x423465;};'use strict';var _=require('lodash');var util=require(_0x18f0('0x0'));var moment=require(_0x18f0('0x1'));var BPromise=require('bluebird');var rs=require(_0x18f0('0x2'));var fs=require('fs');var Redis=require(_0x18f0('0x3'));var db=require(_0x18f0('0x4'))['db'];var utils=require(_0x18f0('0x5'));var logger=require(_0x18f0('0x6'))('rpc');var config=require(_0x18f0('0x7'));var jayson=require(_0x18f0('0x8'));var client=jayson[_0x18f0('0x9')]['http']({'port':0x232a});config[_0x18f0('0xa')]=_[_0x18f0('0xb')](config[_0x18f0('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x18f0('0xc'))(new Redis(config[_0x18f0('0xa')]));require(_0x18f0('0xd'))[_0x18f0('0xe')](socket);function respondWithRpcPromise(_0xf92cf0,_0x2bf8ff,_0x30bdcd){return new BPromise(function(_0x25450a,_0x193a20){return client['request'](_0xf92cf0,_0x30bdcd)[_0x18f0('0xf')](function(_0x3b06b0){logger['info'](_0x18f0('0x10'),_0x2bf8ff,_0x18f0('0x11'));logger['debug']('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0x2bf8ff,_0x18f0('0x11'),JSON[_0x18f0('0x12')](_0x3b06b0));if(_0x3b06b0[_0x18f0('0x13')]){if(_0x3b06b0[_0x18f0('0x13')][_0x18f0('0x14')]===0x1f4){logger[_0x18f0('0x13')]('WhatsappQueue,\x20%s,\x20%s',_0x2bf8ff,_0x3b06b0[_0x18f0('0x13')][_0x18f0('0x15')]);return _0x193a20(_0x3b06b0[_0x18f0('0x13')][_0x18f0('0x15')]);}logger['error'](_0x18f0('0x10'),_0x2bf8ff,_0x3b06b0[_0x18f0('0x13')][_0x18f0('0x15')]);return _0x25450a(_0x3b06b0[_0x18f0('0x13')][_0x18f0('0x15')]);}else{logger['info'](_0x18f0('0x10'),_0x2bf8ff,_0x18f0('0x11'));_0x25450a(_0x3b06b0[_0x18f0('0x16')][_0x18f0('0x15')]);}})['catch'](function(_0x219877){logger[_0x18f0('0x13')](_0x18f0('0x10'),_0x2bf8ff,_0x219877);_0x193a20(_0x219877);});});}exports['GetWhatsappQueue']=function(_0x564d89){var _0x237ff3=this;return new Promise(function(_0x27fd29,_0x2a1bfb){return db[_0x18f0('0x17')][_0x18f0('0x18')]({'raw':_0x564d89['options']?_0x564d89['options'][_0x18f0('0x19')]===undefined?!![]:![]:!![],'where':_0x564d89[_0x18f0('0x1a')]?_0x564d89['options'][_0x18f0('0x1b')]||null:null,'attributes':_0x564d89[_0x18f0('0x1a')]?_0x564d89[_0x18f0('0x1a')][_0x18f0('0x1c')]||null:null,'limit':_0x564d89['options']?_0x564d89[_0x18f0('0x1a')][_0x18f0('0x1d')]||null:null,'include':_0x564d89[_0x18f0('0x1a')]?_0x564d89['options'][_0x18f0('0x1e')]?_[_0x18f0('0x1f')](_0x564d89[_0x18f0('0x1a')][_0x18f0('0x1e')],function(_0x6a534f){return{'model':db[_0x6a534f[_0x18f0('0x20')]],'as':_0x6a534f['as'],'attributes':_0x6a534f['attributes'],'include':_0x6a534f[_0x18f0('0x1e')]?_['map'](_0x6a534f['include'],function(_0x5e0fbc){return{'model':db[_0x5e0fbc[_0x18f0('0x20')]],'as':_0x5e0fbc['as'],'attributes':_0x5e0fbc['attributes'],'include':_0x5e0fbc[_0x18f0('0x1e')]?_[_0x18f0('0x1f')](_0x5e0fbc[_0x18f0('0x1e')],function(_0x3a7e0d){return{'model':db[_0x3a7e0d[_0x18f0('0x20')]],'as':_0x3a7e0d['as'],'attributes':_0x3a7e0d[_0x18f0('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x18f0('0xf')](function(_0x575b20){logger[_0x18f0('0x21')]('GetWhatsappQueue',_0x564d89);logger[_0x18f0('0x22')](_0x18f0('0x23'),_0x564d89,JSON[_0x18f0('0x12')](_0x575b20));_0x27fd29(_0x575b20);})['catch'](function(_0x35ec1d){logger[_0x18f0('0x13')](_0x18f0('0x23'),_0x35ec1d[_0x18f0('0x15')],_0x564d89);_0x2a1bfb(_0x237ff3[_0x18f0('0x13')](0x1f4,_0x35ec1d['message']));});});};exports[_0x18f0('0x24')]=function(_0x15d76c){var _0x836e95=this;return new Promise(function(_0xfd828e,_0x37d6b7){return db[_0x18f0('0x17')]['find']({'raw':_0x15d76c[_0x18f0('0x1a')]?_0x15d76c[_0x18f0('0x1a')][_0x18f0('0x19')]===undefined?!![]:![]:!![],'where':_0x15d76c[_0x18f0('0x1a')]?_0x15d76c[_0x18f0('0x1a')][_0x18f0('0x1b')]||null:null,'attributes':_0x15d76c[_0x18f0('0x1a')]?_0x15d76c[_0x18f0('0x1a')][_0x18f0('0x1c')]||null:null,'include':_0x15d76c['options']?_0x15d76c['options'][_0x18f0('0x1e')]?_[_0x18f0('0x1f')](_0x15d76c['options'][_0x18f0('0x1e')],function(_0x2fba1f){return{'model':db[_0x2fba1f['model']],'as':_0x2fba1f['as'],'attributes':_0x2fba1f[_0x18f0('0x1c')],'include':_0x2fba1f[_0x18f0('0x1e')]?_['map'](_0x2fba1f[_0x18f0('0x1e')],function(_0x53064d){return{'model':db[_0x53064d[_0x18f0('0x20')]],'as':_0x53064d['as'],'attributes':_0x53064d[_0x18f0('0x1c')],'include':_0x53064d[_0x18f0('0x1e')]?_[_0x18f0('0x1f')](_0x53064d[_0x18f0('0x1e')],function(_0x93d21b){return{'model':db[_0x93d21b[_0x18f0('0x20')]],'as':_0x93d21b['as'],'attributes':_0x93d21b[_0x18f0('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x18f0('0xf')](function(_0x924951){logger[_0x18f0('0x21')](_0x18f0('0x24'),_0x15d76c);logger[_0x18f0('0x22')]('ShowWhatsappQueue',_0x15d76c,JSON[_0x18f0('0x12')](_0x924951));_0xfd828e(_0x924951);})[_0x18f0('0x25')](function(_0x546d74){logger[_0x18f0('0x13')](_0x18f0('0x24'),_0x546d74[_0x18f0('0x15')],_0x15d76c);_0x37d6b7(_0x836e95[_0x18f0('0x13')](0x1f4,_0x546d74[_0x18f0('0x15')]));});});}; \ No newline at end of file +var _0xb313=['info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','WhatsappQueue','findAll','options','raw','limit','include','model','attributes','map','GetWhatsappQueue','ShowWhatsappQueue','find','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','socket.io-emitter','./whatsappQueue.socket','request','then'];(function(_0x5f382f,_0x3f1432){var _0x3bb11b=function(_0x4daf9b){while(--_0x4daf9b){_0x5f382f['push'](_0x5f382f['shift']());}};_0x3bb11b(++_0x3f1432);}(_0xb313,0x6c));var _0x3b31=function(_0x104112,_0x342eb6){_0x104112=_0x104112-0x0;var _0x394ab4=_0xb313[_0x104112];return _0x394ab4;};'use strict';var _=require(_0x3b31('0x0'));var util=require(_0x3b31('0x1'));var moment=require(_0x3b31('0x2'));var BPromise=require(_0x3b31('0x3'));var rs=require(_0x3b31('0x4'));var fs=require('fs');var Redis=require(_0x3b31('0x5'));var db=require(_0x3b31('0x6'))['db'];var utils=require(_0x3b31('0x7'));var logger=require(_0x3b31('0x8'))(_0x3b31('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3b31('0xa')][_0x3b31('0xb')]({'port':0x232a});config[_0x3b31('0xc')]=_[_0x3b31('0xd')](config[_0x3b31('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x3b31('0xe'))(new Redis(config[_0x3b31('0xc')]));require(_0x3b31('0xf'))['register'](socket);function respondWithRpcPromise(_0x1cf0e1,_0x4154cb,_0x206fef){return new BPromise(function(_0x55abb3,_0x2e6632){return client[_0x3b31('0x10')](_0x1cf0e1,_0x206fef)[_0x3b31('0x11')](function(_0x334a3d){logger[_0x3b31('0x12')](_0x3b31('0x13'),_0x4154cb,_0x3b31('0x14'));logger[_0x3b31('0x15')](_0x3b31('0x16'),_0x4154cb,_0x3b31('0x14'),JSON[_0x3b31('0x17')](_0x334a3d));if(_0x334a3d[_0x3b31('0x18')]){if(_0x334a3d[_0x3b31('0x18')][_0x3b31('0x19')]===0x1f4){logger[_0x3b31('0x18')](_0x3b31('0x13'),_0x4154cb,_0x334a3d['error'][_0x3b31('0x1a')]);return _0x2e6632(_0x334a3d[_0x3b31('0x18')][_0x3b31('0x1a')]);}logger[_0x3b31('0x18')](_0x3b31('0x13'),_0x4154cb,_0x334a3d[_0x3b31('0x18')]['message']);return _0x55abb3(_0x334a3d[_0x3b31('0x18')]['message']);}else{logger[_0x3b31('0x12')](_0x3b31('0x13'),_0x4154cb,_0x3b31('0x14'));_0x55abb3(_0x334a3d[_0x3b31('0x1b')][_0x3b31('0x1a')]);}})[_0x3b31('0x1c')](function(_0x56e897){logger[_0x3b31('0x18')](_0x3b31('0x13'),_0x4154cb,_0x56e897);_0x2e6632(_0x56e897);});});}exports['GetWhatsappQueue']=function(_0x555381){var _0x52104a=this;return new Promise(function(_0x12a5d7,_0x38c6ac){return db[_0x3b31('0x1d')][_0x3b31('0x1e')]({'raw':_0x555381['options']?_0x555381[_0x3b31('0x1f')][_0x3b31('0x20')]===undefined?!![]:![]:!![],'where':_0x555381[_0x3b31('0x1f')]?_0x555381['options']['where']||null:null,'attributes':_0x555381[_0x3b31('0x1f')]?_0x555381[_0x3b31('0x1f')]['attributes']||null:null,'limit':_0x555381[_0x3b31('0x1f')]?_0x555381[_0x3b31('0x1f')][_0x3b31('0x21')]||null:null,'include':_0x555381[_0x3b31('0x1f')]?_0x555381[_0x3b31('0x1f')][_0x3b31('0x22')]?_['map'](_0x555381[_0x3b31('0x1f')][_0x3b31('0x22')],function(_0x531792){return{'model':db[_0x531792[_0x3b31('0x23')]],'as':_0x531792['as'],'attributes':_0x531792[_0x3b31('0x24')],'include':_0x531792[_0x3b31('0x22')]?_['map'](_0x531792[_0x3b31('0x22')],function(_0x16f7cf){return{'model':db[_0x16f7cf[_0x3b31('0x23')]],'as':_0x16f7cf['as'],'attributes':_0x16f7cf['attributes'],'include':_0x16f7cf[_0x3b31('0x22')]?_[_0x3b31('0x25')](_0x16f7cf[_0x3b31('0x22')],function(_0x3a1a72){return{'model':db[_0x3a1a72[_0x3b31('0x23')]],'as':_0x3a1a72['as'],'attributes':_0x3a1a72[_0x3b31('0x24')]};}):[]};}):[]};}):[]:[]})[_0x3b31('0x11')](function(_0x4fd3db){logger['info'](_0x3b31('0x26'),_0x555381);logger[_0x3b31('0x15')](_0x3b31('0x26'),_0x555381,JSON[_0x3b31('0x17')](_0x4fd3db));_0x12a5d7(_0x4fd3db);})[_0x3b31('0x1c')](function(_0x5f1a83){logger[_0x3b31('0x18')](_0x3b31('0x26'),_0x5f1a83[_0x3b31('0x1a')],_0x555381);_0x38c6ac(_0x52104a[_0x3b31('0x18')](0x1f4,_0x5f1a83[_0x3b31('0x1a')]));});});};exports[_0x3b31('0x27')]=function(_0x5e1100){var _0x130159=this;return new Promise(function(_0x55139b,_0x134edd){return db[_0x3b31('0x1d')][_0x3b31('0x28')]({'raw':_0x5e1100[_0x3b31('0x1f')]?_0x5e1100[_0x3b31('0x1f')][_0x3b31('0x20')]===undefined?!![]:![]:!![],'where':_0x5e1100[_0x3b31('0x1f')]?_0x5e1100['options'][_0x3b31('0x29')]||null:null,'attributes':_0x5e1100[_0x3b31('0x1f')]?_0x5e1100['options'][_0x3b31('0x24')]||null:null,'include':_0x5e1100[_0x3b31('0x1f')]?_0x5e1100['options']['include']?_['map'](_0x5e1100[_0x3b31('0x1f')]['include'],function(_0x23ee1f){return{'model':db[_0x23ee1f['model']],'as':_0x23ee1f['as'],'attributes':_0x23ee1f[_0x3b31('0x24')],'include':_0x23ee1f[_0x3b31('0x22')]?_[_0x3b31('0x25')](_0x23ee1f['include'],function(_0x35bab8){return{'model':db[_0x35bab8[_0x3b31('0x23')]],'as':_0x35bab8['as'],'attributes':_0x35bab8[_0x3b31('0x24')],'include':_0x35bab8[_0x3b31('0x22')]?_[_0x3b31('0x25')](_0x35bab8[_0x3b31('0x22')],function(_0x5f15f3){return{'model':db[_0x5f15f3[_0x3b31('0x23')]],'as':_0x5f15f3['as'],'attributes':_0x5f15f3[_0x3b31('0x24')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x11800b){logger[_0x3b31('0x12')]('ShowWhatsappQueue',_0x5e1100);logger['debug'](_0x3b31('0x27'),_0x5e1100,JSON['stringify'](_0x11800b));_0x55139b(_0x11800b);})['catch'](function(_0x14cd5e){logger[_0x3b31('0x18')](_0x3b31('0x27'),_0x14cd5e['message'],_0x5e1100);_0x134edd(_0x130159[_0x3b31('0x18')](0x1f4,_0x14cd5e[_0x3b31('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 352ba09..0149ec3 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 _0xe06a=['register','length','whatsappQueue:','./whatsappQueue.events','save','remove','update','emit','removeListener'];(function(_0x37747c,_0x54c385){var _0x4b841d=function(_0x3ae596){while(--_0x3ae596){_0x37747c['push'](_0x37747c['shift']());}};_0x4b841d(++_0x54c385);}(_0xe06a,0x66));var _0xae06=function(_0x5cf7a4,_0x3e4531){_0x5cf7a4=_0x5cf7a4-0x0;var _0x2af8aa=_0xe06a[_0x5cf7a4];return _0x2af8aa;};'use strict';var WhatsappQueueEvents=require(_0xae06('0x0'));var events=[_0xae06('0x1'),_0xae06('0x2'),_0xae06('0x3')];function createListener(_0x17651e,_0x4f0b4f){return function(_0xf5c87d){_0x4f0b4f[_0xae06('0x4')](_0x17651e,_0xf5c87d);};}function removeListener(_0x435226,_0x34111f){return function(){WhatsappQueueEvents[_0xae06('0x5')](_0x435226,_0x34111f);};}exports[_0xae06('0x6')]=function(_0x1d375a){for(var _0x42b5ff=0x0,_0x13d490=events[_0xae06('0x7')];_0x42b5ff<_0x13d490;_0x42b5ff++){var _0x25b829=events[_0x42b5ff];var _0x202af6=createListener(_0xae06('0x8')+_0x25b829,_0x1d375a);WhatsappQueueEvents['on'](_0x25b829,_0x202af6);}}; \ No newline at end of file +var _0x257e=['emit','removeListener','length','whatsappQueue:','./whatsappQueue.events','save','update'];(function(_0x40f220,_0xa0d87f){var _0x34bb8a=function(_0x92c52f){while(--_0x92c52f){_0x40f220['push'](_0x40f220['shift']());}};_0x34bb8a(++_0xa0d87f);}(_0x257e,0x74));var _0xe257=function(_0x46f1a6,_0xc7a582){_0x46f1a6=_0x46f1a6-0x0;var _0x38429a=_0x257e[_0x46f1a6];return _0x38429a;};'use strict';var WhatsappQueueEvents=require(_0xe257('0x0'));var events=[_0xe257('0x1'),'remove',_0xe257('0x2')];function createListener(_0x41d17a,_0x4825ba){return function(_0x57d64b){_0x4825ba[_0xe257('0x3')](_0x41d17a,_0x57d64b);};}function removeListener(_0x18bc46,_0x4e498c){return function(){WhatsappQueueEvents[_0xe257('0x4')](_0x18bc46,_0x4e498c);};}exports['register']=function(_0x29dc27){for(var _0x408d47=0x0,_0x1b0782=events[_0xe257('0x5')];_0x408d47<_0x1b0782;_0x408d47++){var _0x336d7a=events[_0x408d47];var _0x2a9e44=createListener(_0xe257('0x6')+_0x336d7a,_0x29dc27);WhatsappQueueEvents['on'](_0x336d7a,_0x2a9e44);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index c29cd79..72e27e8 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 _0x4b33=['show','post','delete','exports','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x5b9cc5,_0x18e69b){var _0x2d679f=function(_0x3fdb98){while(--_0x3fdb98){_0x5b9cc5['push'](_0x5b9cc5['shift']());}};_0x2d679f(++_0x18e69b);}(_0x4b33,0x1be));var _0x34b3=function(_0x11c951,_0x43f94d){_0x11c951=_0x11c951-0x0;var _0x2e767f=_0x4b33[_0x11c951];return _0x2e767f;};'use strict';var multer=require(_0x34b3('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x34b3('0x1'));var express=require('express');var router=express[_0x34b3('0x2')]();var fs_extra=require(_0x34b3('0x3'));var auth=require(_0x34b3('0x4'));var interaction=require(_0x34b3('0x5'));var config=require('../../config/environment');var controller=require(_0x34b3('0x6'));router[_0x34b3('0x7')]('/',auth[_0x34b3('0x8')](),controller[_0x34b3('0x9')]);router[_0x34b3('0x7')](_0x34b3('0xa'),auth[_0x34b3('0x8')](),controller[_0x34b3('0xb')]);router[_0x34b3('0x7')](_0x34b3('0xc'),auth[_0x34b3('0x8')](),controller[_0x34b3('0xd')]);router[_0x34b3('0xe')]('/',auth[_0x34b3('0x8')](),controller['create']);router['put']('/:id',auth[_0x34b3('0x8')](),controller['update']);router[_0x34b3('0xf')](_0x34b3('0xc'),auth[_0x34b3('0x8')](),controller['destroy']);module[_0x34b3('0x10')]=router; \ No newline at end of file +var _0xeb06=['create','put','/:id','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','isAuthenticated','/describe','describe','show','post'];(function(_0x59b9d2,_0x25abee){var _0x41a78c=function(_0x44ca06){while(--_0x44ca06){_0x59b9d2['push'](_0x59b9d2['shift']());}};_0x41a78c(++_0x25abee);}(_0xeb06,0x148));var _0x6eb0=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xeb06[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require(_0x6eb0('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x6eb0('0x1'));var express=require(_0x6eb0('0x2'));var router=express[_0x6eb0('0x3')]();var fs_extra=require(_0x6eb0('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x6eb0('0x5'));var config=require(_0x6eb0('0x6'));var controller=require(_0x6eb0('0x7'));router[_0x6eb0('0x8')]('/',auth[_0x6eb0('0x9')](),controller['index']);router[_0x6eb0('0x8')](_0x6eb0('0xa'),auth[_0x6eb0('0x9')](),controller[_0x6eb0('0xb')]);router[_0x6eb0('0x8')]('/:id',auth[_0x6eb0('0x9')](),controller[_0x6eb0('0xc')]);router[_0x6eb0('0xd')]('/',auth[_0x6eb0('0x9')](),controller[_0x6eb0('0xe')]);router[_0x6eb0('0xf')](_0x6eb0('0x10'),auth[_0x6eb0('0x9')](),controller['update']);router['delete'](_0x6eb0('0x10'),auth[_0x6eb0('0x9')](),controller[_0x6eb0('0x11')]);module[_0x6eb0('0x12')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index f2f0e4d..ca2ba15 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['STRING','DATE','sequelize','exports'];(function(_0x1a7768,_0x22bdcf){var _0x230019=function(_0x1b8cc9){while(--_0x1b8cc9){_0x1a7768['push'](_0x1a7768['shift']());}};_0x230019(++_0x22bdcf);}(_0x7a54,0x106));var _0x47a5=function(_0xe49cf6,_0x38840f){_0xe49cf6=_0xe49cf6-0x0;var _0x212e79=_0x7a54[_0xe49cf6];return _0x212e79;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'uniqueid':{'type':Sequelize[_0x47a5('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x47a5('0x3')]},'leaveAt':{'type':Sequelize[_0x47a5('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x47a5('0x3')]},'reason':{'type':Sequelize[_0x47a5('0x2')]}}; \ No newline at end of file +var _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x1f859b,_0x1a0be4){var _0x488035=function(_0xba1a3c){while(--_0xba1a3c){_0x1f859b['push'](_0x1f859b['shift']());}};_0x488035(++_0x1a0be4);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'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 8ff96f2..d29db53 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 _0x2547=['order','where','pick','filter','merge','VIRTUAL','options','WhatsappQueueReport','includeAll','include','rows','catch','params','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2547,0x1cd));var _0x7254=function(_0x4e56f2,_0x27075d){_0x4e56f2=_0x4e56f2-0x0;var _0x51f1c5=_0x2547[_0x4e56f2];return _0x51f1c5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7254('0x0'));var zipdir=require(_0x7254('0x1'));var jsonpatch=require(_0x7254('0x2'));var rp=require(_0x7254('0x3'));var moment=require(_0x7254('0x4'));var BPromise=require(_0x7254('0x5'));var Mustache=require(_0x7254('0x6'));var util=require(_0x7254('0x7'));var path=require('path');var sox=require(_0x7254('0x8'));var csv=require(_0x7254('0x9'));var ejs=require(_0x7254('0xa'));var fs=require('fs');var fs_extra=require(_0x7254('0xb'));var _=require('lodash');var squel=require(_0x7254('0xc'));var crypto=require(_0x7254('0xd'));var jsforce=require(_0x7254('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x7254('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7254('0xf'));var qs=require(_0x7254('0x10'));var as=require(_0x7254('0x11'));var hardwareService=require(_0x7254('0x12'));var logger=require(_0x7254('0x13'))(_0x7254('0x14'));var utils=require('../../config/utils');var config=require(_0x7254('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x7254('0x16'))['db'];function respondWithStatusCode(_0x53fc4f,_0x16c08e){_0x16c08e=_0x16c08e||0xcc;return function(_0x2bfff8){if(_0x2bfff8){return _0x53fc4f[_0x7254('0x17')](_0x16c08e);}return _0x53fc4f[_0x7254('0x18')](_0x16c08e)[_0x7254('0x19')]();};}function respondWithResult(_0x395a8a,_0x124192){_0x124192=_0x124192||0xc8;return function(_0x21cecc){if(_0x21cecc){return _0x395a8a[_0x7254('0x18')](_0x124192)[_0x7254('0x1a')](_0x21cecc);}};}function respondWithFilteredResult(_0x38a99c,_0x1ee5cb){return function(_0x163c8c){if(_0x163c8c){var _0x535065=typeof _0x1ee5cb[_0x7254('0x1b')]===_0x7254('0x1c')&&typeof _0x1ee5cb[_0x7254('0x1d')]===_0x7254('0x1c');var _0x3b5f06=_0x163c8c[_0x7254('0x1e')];var _0x2737e0=_0x535065?0x0:_0x1ee5cb['offset'];var _0x1f48f6=_0x535065?_0x163c8c[_0x7254('0x1e')]:_0x1ee5cb[_0x7254('0x1b')]+_0x1ee5cb[_0x7254('0x1d')];var _0x2a1ddc;if(_0x1f48f6>=_0x3b5f06){_0x1f48f6=_0x3b5f06;_0x2a1ddc=0xc8;}else{_0x2a1ddc=0xce;}_0x38a99c[_0x7254('0x18')](_0x2a1ddc);return _0x38a99c[_0x7254('0x1f')](_0x7254('0x20'),_0x2737e0+'-'+_0x1f48f6+'/'+_0x3b5f06)[_0x7254('0x1a')](_0x163c8c);}return null;};}function patchUpdates(_0x3b6cb6){return function(_0x2594b8){try{jsonpatch[_0x7254('0x21')](_0x2594b8,_0x3b6cb6,!![]);}catch(_0xc617b6){return BPromise[_0x7254('0x22')](_0xc617b6);}return _0x2594b8[_0x7254('0x23')]();};}function saveUpdates(_0x95ceaa,_0x2bb2fe){return function(_0x46c0a2){if(_0x46c0a2){return _0x46c0a2[_0x7254('0x24')](_0x95ceaa)[_0x7254('0x25')](function(_0x1be69b){return _0x1be69b;});}return null;};}function removeEntity(_0x50c34b,_0x493bfd){return function(_0x136ea3){if(_0x136ea3){return _0x136ea3[_0x7254('0x26')]()[_0x7254('0x25')](function(){_0x50c34b[_0x7254('0x18')](0xcc)[_0x7254('0x19')]();});}};}function handleEntityNotFound(_0x36b5d5,_0x133aee){return function(_0x5d6df5){if(!_0x5d6df5){_0x36b5d5[_0x7254('0x17')](0x194);}return _0x5d6df5;};}function handleError(_0x21a579,_0x2b4f46){_0x2b4f46=_0x2b4f46||0x1f4;return function(_0x494cdb){logger[_0x7254('0x27')](_0x494cdb['stack']);if(_0x494cdb[_0x7254('0x28')]){delete _0x494cdb[_0x7254('0x28')];}_0x21a579['status'](_0x2b4f46)[_0x7254('0x29')](_0x494cdb);};}exports[_0x7254('0x2a')]=function(_0x4f684c,_0x14cbea){var _0x6c4927={},_0x37cb5c={},_0xb9198b={'count':0x0,'rows':[]};var _0x43bf02=_[_0x7254('0x2b')](db['WhatsappQueueReport'][_0x7254('0x2c')],function(_0x2dba3f){return{'name':_0x2dba3f['fieldName'],'type':_0x2dba3f[_0x7254('0x2d')][_0x7254('0x2e')]};});_0x37cb5c[_0x7254('0x2f')]=_['map'](_0x43bf02,_0x7254('0x28'));_0x37cb5c[_0x7254('0x30')]=_[_0x7254('0x31')](_0x4f684c[_0x7254('0x30')]);_0x37cb5c[_0x7254('0x32')]=_[_0x7254('0x33')](_0x37cb5c[_0x7254('0x2f')],_0x37cb5c['query']);_0x6c4927[_0x7254('0x34')]=_['intersection'](_0x37cb5c['model'],qs[_0x7254('0x35')](_0x4f684c[_0x7254('0x30')][_0x7254('0x35')]));_0x6c4927[_0x7254('0x34')]=_0x6c4927[_0x7254('0x34')][_0x7254('0x36')]?_0x6c4927[_0x7254('0x34')]:_0x37cb5c[_0x7254('0x2f')];if(!_0x4f684c[_0x7254('0x30')][_0x7254('0x37')](_0x7254('0x38'))){_0x6c4927[_0x7254('0x1d')]=qs[_0x7254('0x1d')](_0x4f684c[_0x7254('0x30')]['limit']);_0x6c4927[_0x7254('0x1b')]=qs[_0x7254('0x1b')](_0x4f684c[_0x7254('0x30')][_0x7254('0x1b')]);}_0x6c4927[_0x7254('0x39')]=qs['sort'](_0x4f684c[_0x7254('0x30')]['sort']);_0x6c4927[_0x7254('0x3a')]=qs[_0x7254('0x32')](_[_0x7254('0x3b')](_0x4f684c[_0x7254('0x30')],_0x37cb5c[_0x7254('0x32')]),_0x43bf02);if(_0x4f684c['query'][_0x7254('0x3c')]){_0x6c4927['where']=_[_0x7254('0x3d')](_0x6c4927[_0x7254('0x3a')],{'$or':_['map'](_0x43bf02,function(_0x1485a0){if(_0x1485a0[_0x7254('0x2d')]!==_0x7254('0x3e')){var _0x9273ee={};_0x9273ee[_0x1485a0[_0x7254('0x28')]]={'$like':'%'+_0x4f684c[_0x7254('0x30')]['filter']+'%'};return _0x9273ee;}})});}_0x6c4927=_[_0x7254('0x3d')]({},_0x6c4927,_0x4f684c[_0x7254('0x3f')]);var _0x105b8c={'where':_0x6c4927['where']};return db[_0x7254('0x40')][_0x7254('0x1e')](_0x105b8c)[_0x7254('0x25')](function(_0x4824d5){_0xb9198b[_0x7254('0x1e')]=_0x4824d5;if(_0x4f684c[_0x7254('0x30')][_0x7254('0x41')]){_0x6c4927[_0x7254('0x42')]=[{'all':!![]}];}return db[_0x7254('0x40')]['findAll'](_0x6c4927);})['then'](function(_0x25004f){_0xb9198b[_0x7254('0x43')]=_0x25004f;return _0xb9198b;})[_0x7254('0x25')](respondWithFilteredResult(_0x14cbea,_0x6c4927))[_0x7254('0x44')](handleError(_0x14cbea,null));};exports['show']=function(_0x53a7a7,_0x29821a){var _0x565cd8={'raw':!![],'where':{'id':_0x53a7a7[_0x7254('0x45')]['id']}},_0x2ae22e={};_0x2ae22e[_0x7254('0x2f')]=_[_0x7254('0x31')](db['WhatsappQueueReport']['rawAttributes']);_0x2ae22e[_0x7254('0x30')]=_[_0x7254('0x31')](_0x53a7a7[_0x7254('0x30')]);_0x2ae22e[_0x7254('0x32')]=_[_0x7254('0x33')](_0x2ae22e['model'],_0x2ae22e['query']);_0x565cd8[_0x7254('0x34')]=_[_0x7254('0x33')](_0x2ae22e[_0x7254('0x2f')],qs['fields'](_0x53a7a7[_0x7254('0x30')][_0x7254('0x35')]));_0x565cd8['attributes']=_0x565cd8[_0x7254('0x34')][_0x7254('0x36')]?_0x565cd8[_0x7254('0x34')]:_0x2ae22e[_0x7254('0x2f')];if(_0x53a7a7['query'][_0x7254('0x41')]){_0x565cd8[_0x7254('0x42')]=[{'all':!![]}];}_0x565cd8=_['merge']({},_0x565cd8,_0x53a7a7[_0x7254('0x3f')]);return db[_0x7254('0x40')][_0x7254('0x46')](_0x565cd8)['then'](handleEntityNotFound(_0x29821a,null))[_0x7254('0x25')](respondWithResult(_0x29821a,null))[_0x7254('0x44')](handleError(_0x29821a,null));};exports['create']=function(_0x5f101e,_0x10b32f){return db['WhatsappQueueReport'][_0x7254('0x47')](_0x5f101e[_0x7254('0x48')],{})['then'](respondWithResult(_0x10b32f,0xc9))['catch'](handleError(_0x10b32f,null));};exports[_0x7254('0x24')]=function(_0xc40bc5,_0x38bcd5){if(_0xc40bc5[_0x7254('0x48')]['id']){delete _0xc40bc5[_0x7254('0x48')]['id'];}return db[_0x7254('0x40')]['find']({'where':{'id':_0xc40bc5[_0x7254('0x45')]['id']}})['then'](handleEntityNotFound(_0x38bcd5,null))[_0x7254('0x25')](saveUpdates(_0xc40bc5[_0x7254('0x48')],null))[_0x7254('0x25')](respondWithResult(_0x38bcd5,null))['catch'](handleError(_0x38bcd5,null));};exports[_0x7254('0x26')]=function(_0x1c1a0e,_0x252758){return db['WhatsappQueueReport'][_0x7254('0x46')]({'where':{'id':_0x1c1a0e[_0x7254('0x45')]['id']}})[_0x7254('0x25')](handleEntityNotFound(_0x252758,null))[_0x7254('0x25')](removeEntity(_0x252758,null))[_0x7254('0x44')](handleError(_0x252758,null));};exports['describe']=function(_0x5e66c6,_0x24c532){return db[_0x7254('0x40')][_0x7254('0x49')]()[_0x7254('0x25')](respondWithResult(_0x24c532,null))[_0x7254('0x44')](handleError(_0x24c532,null));}; \ No newline at end of file +var _0xea28=['end','stack','name','map','WhatsappQueueReport','rawAttributes','fieldName','type','query','intersection','model','attributes','length','hasOwnProperty','nolimit','order','where','filters','pick','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','keys','fields','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','reject','update','then'];(function(_0x25e7ee,_0x4d8966){var _0x1251f2=function(_0x165472){while(--_0x165472){_0x25e7ee['push'](_0x25e7ee['shift']());}};_0x1251f2(++_0x4d8966);}(_0xea28,0x13a));var _0x8ea2=function(_0x1d340a,_0x521ab6){_0x1d340a=_0x1d340a-0x0;var _0x30a4db=_0xea28[_0x1d340a];return _0x30a4db;};'use strict';var emlformat=require(_0x8ea2('0x0'));var rimraf=require(_0x8ea2('0x1'));var zipdir=require(_0x8ea2('0x2'));var jsonpatch=require(_0x8ea2('0x3'));var rp=require(_0x8ea2('0x4'));var moment=require(_0x8ea2('0x5'));var BPromise=require(_0x8ea2('0x6'));var Mustache=require(_0x8ea2('0x7'));var util=require('util');var path=require(_0x8ea2('0x8'));var sox=require(_0x8ea2('0x9'));var csv=require(_0x8ea2('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8ea2('0xb'));var _=require(_0x8ea2('0xc'));var squel=require(_0x8ea2('0xd'));var crypto=require(_0x8ea2('0xe'));var jsforce=require(_0x8ea2('0xf'));var deskjs=require(_0x8ea2('0x10'));var toCsv=require(_0x8ea2('0xa'));var querystring=require(_0x8ea2('0x11'));var Papa=require(_0x8ea2('0x12'));var Redis=require(_0x8ea2('0x13'));var authService=require(_0x8ea2('0x14'));var qs=require(_0x8ea2('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8ea2('0x16'))(_0x8ea2('0x17'));var utils=require(_0x8ea2('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x8ea2('0x19'));var db=require(_0x8ea2('0x1a'))['db'];function respondWithStatusCode(_0x1dfb6e,_0x10aead){_0x10aead=_0x10aead||0xcc;return function(_0xe47c0e){if(_0xe47c0e){return _0x1dfb6e['sendStatus'](_0x10aead);}return _0x1dfb6e[_0x8ea2('0x1b')](_0x10aead)['end']();};}function respondWithResult(_0x4b2192,_0x772bad){_0x772bad=_0x772bad||0xc8;return function(_0x4726a7){if(_0x4726a7){return _0x4b2192[_0x8ea2('0x1b')](_0x772bad)[_0x8ea2('0x1c')](_0x4726a7);}};}function respondWithFilteredResult(_0x393faf,_0xbb9bd1){return function(_0x3cff96){if(_0x3cff96){var _0x11f5e8=typeof _0xbb9bd1[_0x8ea2('0x1d')]===_0x8ea2('0x1e')&&typeof _0xbb9bd1[_0x8ea2('0x1f')]===_0x8ea2('0x1e');var _0x3bc774=_0x3cff96[_0x8ea2('0x20')];var _0x1b64cf=_0x11f5e8?0x0:_0xbb9bd1[_0x8ea2('0x1d')];var _0x467045=_0x11f5e8?_0x3cff96[_0x8ea2('0x20')]:_0xbb9bd1[_0x8ea2('0x1d')]+_0xbb9bd1[_0x8ea2('0x1f')];var _0x134cbe;if(_0x467045>=_0x3bc774){_0x467045=_0x3bc774;_0x134cbe=0xc8;}else{_0x134cbe=0xce;}_0x393faf[_0x8ea2('0x1b')](_0x134cbe);return _0x393faf['set']('Content-Range',_0x1b64cf+'-'+_0x467045+'/'+_0x3bc774)[_0x8ea2('0x1c')](_0x3cff96);}return null;};}function patchUpdates(_0x248c18){return function(_0x29151a){try{jsonpatch['apply'](_0x29151a,_0x248c18,!![]);}catch(_0x46f4fe){return BPromise[_0x8ea2('0x21')](_0x46f4fe);}return _0x29151a['save']();};}function saveUpdates(_0x3d593b,_0x283f00){return function(_0x37229a){if(_0x37229a){return _0x37229a[_0x8ea2('0x22')](_0x3d593b)[_0x8ea2('0x23')](function(_0xe5c943){return _0xe5c943;});}return null;};}function removeEntity(_0x199417,_0x1e4cc9){return function(_0x18ec34){if(_0x18ec34){return _0x18ec34['destroy']()[_0x8ea2('0x23')](function(){_0x199417['status'](0xcc)[_0x8ea2('0x24')]();});}};}function handleEntityNotFound(_0x42bec8,_0x29b38f){return function(_0x4e2106){if(!_0x4e2106){_0x42bec8['sendStatus'](0x194);}return _0x4e2106;};}function handleError(_0x2e4da3,_0x4dc7bf){_0x4dc7bf=_0x4dc7bf||0x1f4;return function(_0x200a49){logger['error'](_0x200a49[_0x8ea2('0x25')]);if(_0x200a49[_0x8ea2('0x26')]){delete _0x200a49[_0x8ea2('0x26')];}_0x2e4da3[_0x8ea2('0x1b')](_0x4dc7bf)['send'](_0x200a49);};}exports['index']=function(_0xacaa6c,_0x4da5b3){var _0x4a9875={},_0x287078={},_0x24f187={'count':0x0,'rows':[]};var _0x41f482=_[_0x8ea2('0x27')](db[_0x8ea2('0x28')][_0x8ea2('0x29')],function(_0x316707){return{'name':_0x316707[_0x8ea2('0x2a')],'type':_0x316707[_0x8ea2('0x2b')]['key']};});_0x287078['model']=_[_0x8ea2('0x27')](_0x41f482,_0x8ea2('0x26'));_0x287078['query']=_['keys'](_0xacaa6c[_0x8ea2('0x2c')]);_0x287078['filters']=_[_0x8ea2('0x2d')](_0x287078[_0x8ea2('0x2e')],_0x287078['query']);_0x4a9875[_0x8ea2('0x2f')]=_[_0x8ea2('0x2d')](_0x287078[_0x8ea2('0x2e')],qs['fields'](_0xacaa6c['query']['fields']));_0x4a9875[_0x8ea2('0x2f')]=_0x4a9875[_0x8ea2('0x2f')][_0x8ea2('0x30')]?_0x4a9875['attributes']:_0x287078[_0x8ea2('0x2e')];if(!_0xacaa6c[_0x8ea2('0x2c')][_0x8ea2('0x31')](_0x8ea2('0x32'))){_0x4a9875[_0x8ea2('0x1f')]=qs[_0x8ea2('0x1f')](_0xacaa6c[_0x8ea2('0x2c')][_0x8ea2('0x1f')]);_0x4a9875['offset']=qs[_0x8ea2('0x1d')](_0xacaa6c[_0x8ea2('0x2c')][_0x8ea2('0x1d')]);}_0x4a9875[_0x8ea2('0x33')]=qs['sort'](_0xacaa6c[_0x8ea2('0x2c')]['sort']);_0x4a9875[_0x8ea2('0x34')]=qs[_0x8ea2('0x35')](_[_0x8ea2('0x36')](_0xacaa6c[_0x8ea2('0x2c')],_0x287078['filters']),_0x41f482);if(_0xacaa6c[_0x8ea2('0x2c')]['filter']){_0x4a9875['where']=_[_0x8ea2('0x37')](_0x4a9875['where'],{'$or':_[_0x8ea2('0x27')](_0x41f482,function(_0x2f0779){if(_0x2f0779[_0x8ea2('0x2b')]!==_0x8ea2('0x38')){var _0x134584={};_0x134584[_0x2f0779['name']]={'$like':'%'+_0xacaa6c[_0x8ea2('0x2c')]['filter']+'%'};return _0x134584;}})});}_0x4a9875=_[_0x8ea2('0x37')]({},_0x4a9875,_0xacaa6c[_0x8ea2('0x39')]);var _0x6d0e0c={'where':_0x4a9875[_0x8ea2('0x34')]};return db['WhatsappQueueReport'][_0x8ea2('0x20')](_0x6d0e0c)['then'](function(_0x3f0c78){_0x24f187['count']=_0x3f0c78;if(_0xacaa6c[_0x8ea2('0x2c')][_0x8ea2('0x3a')]){_0x4a9875[_0x8ea2('0x3b')]=[{'all':!![]}];}return db[_0x8ea2('0x28')][_0x8ea2('0x3c')](_0x4a9875);})[_0x8ea2('0x23')](function(_0x2f4fa8){_0x24f187['rows']=_0x2f4fa8;return _0x24f187;})['then'](respondWithFilteredResult(_0x4da5b3,_0x4a9875))[_0x8ea2('0x3d')](handleError(_0x4da5b3,null));};exports['show']=function(_0x4b03fa,_0x59e2fa){var _0x3cbc09={'raw':!![],'where':{'id':_0x4b03fa[_0x8ea2('0x3e')]['id']}},_0x5d9ba0={};_0x5d9ba0[_0x8ea2('0x2e')]=_[_0x8ea2('0x3f')](db[_0x8ea2('0x28')][_0x8ea2('0x29')]);_0x5d9ba0[_0x8ea2('0x2c')]=_[_0x8ea2('0x3f')](_0x4b03fa[_0x8ea2('0x2c')]);_0x5d9ba0['filters']=_[_0x8ea2('0x2d')](_0x5d9ba0[_0x8ea2('0x2e')],_0x5d9ba0[_0x8ea2('0x2c')]);_0x3cbc09['attributes']=_[_0x8ea2('0x2d')](_0x5d9ba0[_0x8ea2('0x2e')],qs[_0x8ea2('0x40')](_0x4b03fa[_0x8ea2('0x2c')][_0x8ea2('0x40')]));_0x3cbc09['attributes']=_0x3cbc09[_0x8ea2('0x2f')][_0x8ea2('0x30')]?_0x3cbc09[_0x8ea2('0x2f')]:_0x5d9ba0['model'];if(_0x4b03fa[_0x8ea2('0x2c')][_0x8ea2('0x3a')]){_0x3cbc09[_0x8ea2('0x3b')]=[{'all':!![]}];}_0x3cbc09=_[_0x8ea2('0x37')]({},_0x3cbc09,_0x4b03fa[_0x8ea2('0x39')]);return db[_0x8ea2('0x28')][_0x8ea2('0x41')](_0x3cbc09)[_0x8ea2('0x23')](handleEntityNotFound(_0x59e2fa,null))[_0x8ea2('0x23')](respondWithResult(_0x59e2fa,null))[_0x8ea2('0x3d')](handleError(_0x59e2fa,null));};exports[_0x8ea2('0x42')]=function(_0x52d203,_0x220970){return db[_0x8ea2('0x28')]['create'](_0x52d203[_0x8ea2('0x43')],{})[_0x8ea2('0x23')](respondWithResult(_0x220970,0xc9))[_0x8ea2('0x3d')](handleError(_0x220970,null));};exports[_0x8ea2('0x22')]=function(_0x182a46,_0x1daa25){if(_0x182a46[_0x8ea2('0x43')]['id']){delete _0x182a46[_0x8ea2('0x43')]['id'];}return db['WhatsappQueueReport'][_0x8ea2('0x41')]({'where':{'id':_0x182a46[_0x8ea2('0x3e')]['id']}})[_0x8ea2('0x23')](handleEntityNotFound(_0x1daa25,null))['then'](saveUpdates(_0x182a46['body'],null))[_0x8ea2('0x23')](respondWithResult(_0x1daa25,null))[_0x8ea2('0x3d')](handleError(_0x1daa25,null));};exports[_0x8ea2('0x44')]=function(_0x5e5c37,_0x3d86f3){return db[_0x8ea2('0x28')][_0x8ea2('0x41')]({'where':{'id':_0x5e5c37[_0x8ea2('0x3e')]['id']}})[_0x8ea2('0x23')](handleEntityNotFound(_0x3d86f3,null))['then'](removeEntity(_0x3d86f3,null))['catch'](handleError(_0x3d86f3,null));};exports[_0x8ea2('0x45')]=function(_0x4148c1,_0x1b8c4b){return db['WhatsappQueueReport'][_0x8ea2('0x45')]()[_0x8ea2('0x23')](respondWithResult(_0x1b8c4b,null))[_0x8ea2('0x3d')](handleError(_0x1b8c4b,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 0efec32..fe1a072 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 _0xcda2=['moment','bluebird','request-promise','path','rimraf','../../config/environment','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','util','../../config/logger','api'];(function(_0x1c5976,_0x409f3d){var _0x350ea1=function(_0x3f7658){while(--_0x3f7658){_0x1c5976['push'](_0x1c5976['shift']());}};_0x350ea1(++_0x409f3d);}(_0xcda2,0xf8));var _0x2cda=function(_0x4deb18,_0x5e76b0){_0x4deb18=_0x4deb18-0x0;var _0x571a30=_0xcda2[_0x4deb18];return _0x571a30;};'use strict';var _=require(_0x2cda('0x0'));var util=require(_0x2cda('0x1'));var logger=require(_0x2cda('0x2'))(_0x2cda('0x3'));var moment=require(_0x2cda('0x4'));var BPromise=require(_0x2cda('0x5'));var rp=require(_0x2cda('0x6'));var fs=require('fs');var path=require(_0x2cda('0x7'));var rimraf=require(_0x2cda('0x8'));var config=require(_0x2cda('0x9'));var attributes=require('./whatsappQueueReport.attributes');module['exports']=function(_0x3a7ea0,_0xaed8c0){return _0x3a7ea0[_0x2cda('0xa')](_0x2cda('0xb'),attributes,{'tableName':_0x2cda('0xc'),'paranoid':![],'indexes':[{'name':_0x2cda('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xc39c=['../../config/environment','./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','util','../../config/logger','api','moment','path'];(function(_0x34bcc3,_0x227cfd){var _0x2e8776=function(_0x13eb85){while(--_0x13eb85){_0x34bcc3['push'](_0x34bcc3['shift']());}};_0x2e8776(++_0x227cfd);}(_0xc39c,0x96));var _0xcc39=function(_0xbd02fb,_0x43c283){_0xbd02fb=_0xbd02fb-0x0;var _0x32a5cf=_0xc39c[_0xbd02fb];return _0x32a5cf;};'use strict';var _=require(_0xcc39('0x0'));var util=require(_0xcc39('0x1'));var logger=require(_0xcc39('0x2'))(_0xcc39('0x3'));var moment=require(_0xcc39('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xcc39('0x5'));var rimraf=require('rimraf');var config=require(_0xcc39('0x6'));var attributes=require(_0xcc39('0x7'));module[_0xcc39('0x8')]=function(_0x320352,_0x4f00a7){return _0x320352[_0xcc39('0x9')](_0xcc39('0xa'),attributes,{'tableName':_0xcc39('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xcc39('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 1bd58ef..94a051f 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 _0x4d01=['UpdateWhatsappQueueReport','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','CreateWhatsappQueueReport','WhatsappQueueReport','options','raw','catch','body','where','attributes','limit'];(function(_0xf79bae,_0x263b2a){var _0x5d2cb7=function(_0x27c86b){while(--_0x27c86b){_0xf79bae['push'](_0xf79bae['shift']());}};_0x5d2cb7(++_0x263b2a);}(_0x4d01,0x1f1));var _0x14d0=function(_0x1ff575,_0xdba21f){_0x1ff575=_0x1ff575-0x0;var _0x48fc9e=_0x4d01[_0x1ff575];return _0x48fc9e;};'use strict';var _=require(_0x14d0('0x0'));var util=require(_0x14d0('0x1'));var moment=require(_0x14d0('0x2'));var BPromise=require('bluebird');var rs=require(_0x14d0('0x3'));var fs=require('fs');var Redis=require(_0x14d0('0x4'));var db=require(_0x14d0('0x5'))['db'];var utils=require(_0x14d0('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x14d0('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x14d0('0x8')][_0x14d0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1c2fc7,_0x189f4c,_0x590f6e){return new BPromise(function(_0x21309d,_0x54b35f){return client[_0x14d0('0xa')](_0x1c2fc7,_0x590f6e)[_0x14d0('0xb')](function(_0x3d8f1f){logger[_0x14d0('0xc')](_0x14d0('0xd'),_0x189f4c,_0x14d0('0xe'));logger[_0x14d0('0xf')](_0x14d0('0x10'),_0x189f4c,_0x14d0('0xe'),JSON[_0x14d0('0x11')](_0x3d8f1f));if(_0x3d8f1f['error']){if(_0x3d8f1f[_0x14d0('0x12')]['code']===0x1f4){logger[_0x14d0('0x12')](_0x14d0('0xd'),_0x189f4c,_0x3d8f1f[_0x14d0('0x12')][_0x14d0('0x13')]);return _0x54b35f(_0x3d8f1f[_0x14d0('0x12')][_0x14d0('0x13')]);}logger['error'](_0x14d0('0xd'),_0x189f4c,_0x3d8f1f[_0x14d0('0x12')][_0x14d0('0x13')]);return _0x21309d(_0x3d8f1f[_0x14d0('0x12')][_0x14d0('0x13')]);}else{logger[_0x14d0('0xc')]('WhatsappQueueReport,\x20%s,\x20%s',_0x189f4c,_0x14d0('0xe'));_0x21309d(_0x3d8f1f[_0x14d0('0x14')][_0x14d0('0x13')]);}})['catch'](function(_0x2ac0e1){logger['error'](_0x14d0('0xd'),_0x189f4c,_0x2ac0e1);_0x54b35f(_0x2ac0e1);});});}exports[_0x14d0('0x15')]=function(_0x5e079b){var _0x4da504=this;return new Promise(function(_0x502d19,_0x2e7780){return db[_0x14d0('0x16')]['create'](_0x5e079b['body'],{'raw':_0x5e079b['options']?_0x5e079b[_0x14d0('0x17')][_0x14d0('0x18')]===undefined?!![]:![]:!![]})[_0x14d0('0xb')](function(_0x41cfc0){logger[_0x14d0('0xc')](_0x14d0('0x15'),_0x5e079b);logger[_0x14d0('0xf')](_0x14d0('0x15'),_0x5e079b,JSON[_0x14d0('0x11')](_0x41cfc0));_0x502d19(_0x41cfc0);})[_0x14d0('0x19')](function(_0x3004aa){logger[_0x14d0('0x12')](_0x14d0('0x15'),_0x3004aa[_0x14d0('0x13')],_0x5e079b);_0x2e7780(_0x4da504['error'](0x1f4,_0x3004aa[_0x14d0('0x13')]));});});};exports['UpdateWhatsappQueueReport']=function(_0x20d37a){var _0x921855=this;return new Promise(function(_0x1a81d3,_0x2a47b9){return db['WhatsappQueueReport']['update'](_0x20d37a[_0x14d0('0x1a')],{'raw':_0x20d37a[_0x14d0('0x17')]?_0x20d37a['options'][_0x14d0('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x20d37a[_0x14d0('0x17')]?_0x20d37a[_0x14d0('0x17')][_0x14d0('0x1b')]||null:null,'attributes':_0x20d37a[_0x14d0('0x17')]?_0x20d37a[_0x14d0('0x17')][_0x14d0('0x1c')]||null:null,'limit':_0x20d37a[_0x14d0('0x17')]?_0x20d37a[_0x14d0('0x17')][_0x14d0('0x1d')]||null:null})[_0x14d0('0xb')](function(_0xe48871){logger['info'](_0x14d0('0x1e'),_0x20d37a);logger[_0x14d0('0xf')](_0x14d0('0x1e'),_0x20d37a,JSON[_0x14d0('0x11')](_0xe48871));_0x1a81d3(_0xe48871);})[_0x14d0('0x19')](function(_0x87fb25){logger[_0x14d0('0x12')](_0x14d0('0x1e'),_0x87fb25[_0x14d0('0x13')],_0x20d37a);_0x2a47b9(_0x921855[_0x14d0('0x12')](0x1f4,_0x87fb25['message']));});});}; \ No newline at end of file +var _0xfc45=['update','body','options','where','attributes','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','info','WhatsappQueueReport,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','raw','stringify','UpdateWhatsappQueueReport'];(function(_0x22bee0,_0x412ecb){var _0x2d295b=function(_0x59d4b5){while(--_0x59d4b5){_0x22bee0['push'](_0x22bee0['shift']());}};_0x2d295b(++_0x412ecb);}(_0xfc45,0xab));var _0x5fc4=function(_0x176ead,_0x5286fd){_0x176ead=_0x176ead-0x0;var _0x51104f=_0xfc45[_0x176ead];return _0x51104f;};'use strict';var _=require(_0x5fc4('0x0'));var util=require(_0x5fc4('0x1'));var moment=require('moment');var BPromise=require(_0x5fc4('0x2'));var rs=require(_0x5fc4('0x3'));var fs=require('fs');var Redis=require(_0x5fc4('0x4'));var db=require(_0x5fc4('0x5'))['db'];var utils=require(_0x5fc4('0x6'));var logger=require(_0x5fc4('0x7'))('rpc');var config=require(_0x5fc4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x5fc4('0x9')][_0x5fc4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x387ea8,_0xaa1de9,_0x39ffc0){return new BPromise(function(_0x416534,_0x3b5303){return client['request'](_0x387ea8,_0x39ffc0)[_0x5fc4('0xb')](function(_0x1fe614){logger[_0x5fc4('0xc')](_0x5fc4('0xd'),_0xaa1de9,'request\x20sent');logger[_0x5fc4('0xe')]('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0xaa1de9,_0x5fc4('0xf'),JSON['stringify'](_0x1fe614));if(_0x1fe614[_0x5fc4('0x10')]){if(_0x1fe614[_0x5fc4('0x10')][_0x5fc4('0x11')]===0x1f4){logger[_0x5fc4('0x10')](_0x5fc4('0xd'),_0xaa1de9,_0x1fe614['error']['message']);return _0x3b5303(_0x1fe614['error']['message']);}logger['error'](_0x5fc4('0xd'),_0xaa1de9,_0x1fe614['error'][_0x5fc4('0x12')]);return _0x416534(_0x1fe614['error'][_0x5fc4('0x12')]);}else{logger[_0x5fc4('0xc')](_0x5fc4('0xd'),_0xaa1de9,_0x5fc4('0xf'));_0x416534(_0x1fe614[_0x5fc4('0x13')][_0x5fc4('0x12')]);}})[_0x5fc4('0x14')](function(_0x2990b2){logger['error'](_0x5fc4('0xd'),_0xaa1de9,_0x2990b2);_0x3b5303(_0x2990b2);});});}exports[_0x5fc4('0x15')]=function(_0x497b05){var _0x2faefb=this;return new Promise(function(_0x1f0156,_0x520e99){return db[_0x5fc4('0x16')][_0x5fc4('0x17')](_0x497b05['body'],{'raw':_0x497b05['options']?_0x497b05['options'][_0x5fc4('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x2d1a2e){logger['info'](_0x5fc4('0x15'),_0x497b05);logger[_0x5fc4('0xe')](_0x5fc4('0x15'),_0x497b05,JSON[_0x5fc4('0x19')](_0x2d1a2e));_0x1f0156(_0x2d1a2e);})[_0x5fc4('0x14')](function(_0x32da45){logger[_0x5fc4('0x10')](_0x5fc4('0x15'),_0x32da45['message'],_0x497b05);_0x520e99(_0x2faefb['error'](0x1f4,_0x32da45[_0x5fc4('0x12')]));});});};exports[_0x5fc4('0x1a')]=function(_0x5e7126){var _0x5d6996=this;return new Promise(function(_0x17c4db,_0x10769e){return db[_0x5fc4('0x16')][_0x5fc4('0x1b')](_0x5e7126[_0x5fc4('0x1c')],{'raw':_0x5e7126[_0x5fc4('0x1d')]?_0x5e7126[_0x5fc4('0x1d')][_0x5fc4('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5e7126[_0x5fc4('0x1d')]?_0x5e7126[_0x5fc4('0x1d')][_0x5fc4('0x1e')]||null:null,'attributes':_0x5e7126['options']?_0x5e7126['options'][_0x5fc4('0x1f')]||null:null,'limit':_0x5e7126[_0x5fc4('0x1d')]?_0x5e7126[_0x5fc4('0x1d')][_0x5fc4('0x20')]||null:null})[_0x5fc4('0xb')](function(_0x5f20e4){logger['info'](_0x5fc4('0x1a'),_0x5e7126);logger[_0x5fc4('0xe')](_0x5fc4('0x1a'),_0x5e7126,JSON[_0x5fc4('0x19')](_0x5f20e4));_0x17c4db(_0x5f20e4);})[_0x5fc4('0x14')](function(_0x112c3f){logger['error'](_0x5fc4('0x1a'),_0x112c3f[_0x5fc4('0x12')],_0x5e7126);_0x10769e(_0x5d6996[_0x5fc4('0x10')](0x1f4,_0x112c3f[_0x5fc4('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 78f7b20..4a291f9 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 _0x141b=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated','/describe','describe','show','post','create','put','/:id','destroy','exports','multer','util'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x141b,0x1ca));var _0xb141=function(_0x78a4ef,_0x59b9a1){_0x78a4ef=_0x78a4ef-0x0;var _0x515092=_0x141b[_0x78a4ef];return _0x515092;};'use strict';var multer=require(_0xb141('0x0'));var util=require(_0xb141('0x1'));var path=require(_0xb141('0x2'));var timeout=require(_0xb141('0x3'));var express=require('express');var router=express[_0xb141('0x4')]();var fs_extra=require(_0xb141('0x5'));var auth=require(_0xb141('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xb141('0x7'));var controller=require(_0xb141('0x8'));router[_0xb141('0x9')]('/',auth[_0xb141('0xa')](),controller['index']);router['get'](_0xb141('0xb'),auth[_0xb141('0xa')](),controller[_0xb141('0xc')]);router['get']('/:id',auth[_0xb141('0xa')](),controller[_0xb141('0xd')]);router[_0xb141('0xe')]('/',auth[_0xb141('0xa')](),controller[_0xb141('0xf')]);router[_0xb141('0x10')](_0xb141('0x11'),auth[_0xb141('0xa')](),controller['update']);router['delete'](_0xb141('0x11'),auth[_0xb141('0xa')](),controller[_0xb141('0x12')]);module[_0xb141('0x13')]=router; \ No newline at end of file +var _0x0cf4=['index','/describe','describe','/:id','show','post','create','update','delete','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','./whatsappTransferReport.controller','get','isAuthenticated'];(function(_0x4c9cd5,_0x4432a0){var _0x1118d8=function(_0x5cb7e9){while(--_0x5cb7e9){_0x4c9cd5['push'](_0x4c9cd5['shift']());}};_0x1118d8(++_0x4432a0);}(_0x0cf4,0x1d2));var _0x40cf=function(_0x3330b8,_0x19b32a){_0x3330b8=_0x3330b8-0x0;var _0x191799=_0x0cf4[_0x3330b8];return _0x191799;};'use strict';var multer=require(_0x40cf('0x0'));var util=require(_0x40cf('0x1'));var path=require(_0x40cf('0x2'));var timeout=require(_0x40cf('0x3'));var express=require('express');var router=express[_0x40cf('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x40cf('0x5'));var config=require('../../config/environment');var controller=require(_0x40cf('0x6'));router[_0x40cf('0x7')]('/',auth[_0x40cf('0x8')](),controller[_0x40cf('0x9')]);router[_0x40cf('0x7')](_0x40cf('0xa'),auth['isAuthenticated'](),controller[_0x40cf('0xb')]);router['get'](_0x40cf('0xc'),auth[_0x40cf('0x8')](),controller[_0x40cf('0xd')]);router[_0x40cf('0xe')]('/',auth[_0x40cf('0x8')](),controller[_0x40cf('0xf')]);router['put'](_0x40cf('0xc'),auth['isAuthenticated'](),controller[_0x40cf('0x10')]);router[_0x40cf('0x11')]('/:id',auth[_0x40cf('0x8')](),controller['destroy']);module[_0x40cf('0x12')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 37f66eb..8f2d833 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 _0xa32b=['STRING','agent','queue','DATE','sequelize'];(function(_0x5426d0,_0x4a4f10){var _0x37be89=function(_0x1fc9e1){while(--_0x1fc9e1){_0x5426d0['push'](_0x5426d0['shift']());}};_0x37be89(++_0x4a4f10);}(_0xa32b,0x68));var _0xba32=function(_0x3c8832,_0x16e93e){_0x3c8832=_0x3c8832-0x0;var _0xacf303=_0xa32b[_0x3c8832];return _0xacf303;};'use strict';var Sequelize=require(_0xba32('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xba32('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('account',_0xba32('0x2'),_0xba32('0x3')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xba32('0x4')]}}; \ No newline at end of file +var _0xd05a=['STRING','DATE','exports'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0xd05a,0x143));var _0xad05=function(_0xea8af,_0x19a569){_0xea8af=_0xea8af-0x0;var _0x54bdcc=_0xd05a[_0xea8af];return _0x54bdcc;};'use strict';var Sequelize=require('sequelize');module[_0xad05('0x0')]={'uniqueid':{'type':Sequelize[_0xad05('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('account','agent','queue'),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xad05('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index edec918..9885de1 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 _0x3391=['count','offset','set','Content-Range','apply','reject','save','then','destroy','stack','name','index','WhatsappTransferReport','fieldName','type','key','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','filter','options','includeAll','include','catch','show','params','find','create','body','update','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','crypto','jsforce','desk.js','to-csv','querystring','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit'];(function(_0x5184bd,_0x164321){var _0x231940=function(_0xe7b7a7){while(--_0xe7b7a7){_0x5184bd['push'](_0x5184bd['shift']());}};_0x231940(++_0x164321);}(_0x3391,0x13f));var _0x1339=function(_0x53d6f3,_0x31f6c4){_0x53d6f3=_0x53d6f3-0x0;var _0x2d6876=_0x3391[_0x53d6f3];return _0x2d6876;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1339('0x0'));var zipdir=require(_0x1339('0x1'));var jsonpatch=require(_0x1339('0x2'));var rp=require(_0x1339('0x3'));var moment=require(_0x1339('0x4'));var BPromise=require(_0x1339('0x5'));var Mustache=require(_0x1339('0x6'));var util=require('util');var path=require(_0x1339('0x7'));var sox=require(_0x1339('0x8'));var csv=require('to-csv');var ejs=require(_0x1339('0x9'));var fs=require('fs');var fs_extra=require(_0x1339('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x1339('0xb'));var jsforce=require(_0x1339('0xc'));var deskjs=require(_0x1339('0xd'));var toCsv=require(_0x1339('0xe'));var querystring=require(_0x1339('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x1339('0x10'));var config=require(_0x1339('0x11'));var licenseUtil=require(_0x1339('0x12'));var db=require(_0x1339('0x13'))['db'];function respondWithStatusCode(_0x52fc6d,_0x45bf72){_0x45bf72=_0x45bf72||0xcc;return function(_0x57b5f9){if(_0x57b5f9){return _0x52fc6d[_0x1339('0x14')](_0x45bf72);}return _0x52fc6d[_0x1339('0x15')](_0x45bf72)[_0x1339('0x16')]();};}function respondWithResult(_0x23e26f,_0x2943d6){_0x2943d6=_0x2943d6||0xc8;return function(_0x1113a3){if(_0x1113a3){return _0x23e26f[_0x1339('0x15')](_0x2943d6)[_0x1339('0x17')](_0x1113a3);}};}function respondWithFilteredResult(_0x5258ff,_0x47ec95){return function(_0x20dd43){if(_0x20dd43){var _0x3168a4=typeof _0x47ec95['offset']===_0x1339('0x18')&&typeof _0x47ec95[_0x1339('0x19')]===_0x1339('0x18');var _0x136c9a=_0x20dd43[_0x1339('0x1a')];var _0x2dc63e=_0x3168a4?0x0:_0x47ec95['offset'];var _0x5872e1=_0x3168a4?_0x20dd43['count']:_0x47ec95[_0x1339('0x1b')]+_0x47ec95[_0x1339('0x19')];var _0x28c3b8;if(_0x5872e1>=_0x136c9a){_0x5872e1=_0x136c9a;_0x28c3b8=0xc8;}else{_0x28c3b8=0xce;}_0x5258ff[_0x1339('0x15')](_0x28c3b8);return _0x5258ff[_0x1339('0x1c')](_0x1339('0x1d'),_0x2dc63e+'-'+_0x5872e1+'/'+_0x136c9a)[_0x1339('0x17')](_0x20dd43);}return null;};}function patchUpdates(_0x24a6e1){return function(_0x28ba02){try{jsonpatch[_0x1339('0x1e')](_0x28ba02,_0x24a6e1,!![]);}catch(_0x1129af){return BPromise[_0x1339('0x1f')](_0x1129af);}return _0x28ba02[_0x1339('0x20')]();};}function saveUpdates(_0x4a2257,_0x1f71c4){return function(_0x1b97b4){if(_0x1b97b4){return _0x1b97b4['update'](_0x4a2257)[_0x1339('0x21')](function(_0x220a4d){return _0x220a4d;});}return null;};}function removeEntity(_0x35afbe,_0x227058){return function(_0x3d32bc){if(_0x3d32bc){return _0x3d32bc[_0x1339('0x22')]()[_0x1339('0x21')](function(){_0x35afbe[_0x1339('0x15')](0xcc)[_0x1339('0x16')]();});}};}function handleEntityNotFound(_0x4f4695,_0x5ce012){return function(_0x3ec89e){if(!_0x3ec89e){_0x4f4695[_0x1339('0x14')](0x194);}return _0x3ec89e;};}function handleError(_0x20adcc,_0x20e506){_0x20e506=_0x20e506||0x1f4;return function(_0x5cd5ae){logger['error'](_0x5cd5ae[_0x1339('0x23')]);if(_0x5cd5ae[_0x1339('0x24')]){delete _0x5cd5ae[_0x1339('0x24')];}_0x20adcc['status'](_0x20e506)['send'](_0x5cd5ae);};}exports[_0x1339('0x25')]=function(_0x47b71f,_0x950861){var _0x488955={},_0x55df89={},_0x29e519={'count':0x0,'rows':[]};var _0x539c54=_['map'](db[_0x1339('0x26')]['rawAttributes'],function(_0x44773e){return{'name':_0x44773e[_0x1339('0x27')],'type':_0x44773e[_0x1339('0x28')][_0x1339('0x29')]};});_0x55df89[_0x1339('0x2a')]=_[_0x1339('0x2b')](_0x539c54,'name');_0x55df89['query']=_[_0x1339('0x2c')](_0x47b71f[_0x1339('0x2d')]);_0x55df89[_0x1339('0x2e')]=_[_0x1339('0x2f')](_0x55df89[_0x1339('0x2a')],_0x55df89[_0x1339('0x2d')]);_0x488955['attributes']=_['intersection'](_0x55df89['model'],qs[_0x1339('0x30')](_0x47b71f[_0x1339('0x2d')][_0x1339('0x30')]));_0x488955['attributes']=_0x488955[_0x1339('0x31')][_0x1339('0x32')]?_0x488955[_0x1339('0x31')]:_0x55df89['model'];if(!_0x47b71f[_0x1339('0x2d')][_0x1339('0x33')](_0x1339('0x34'))){_0x488955[_0x1339('0x19')]=qs['limit'](_0x47b71f[_0x1339('0x2d')][_0x1339('0x19')]);_0x488955[_0x1339('0x1b')]=qs[_0x1339('0x1b')](_0x47b71f['query'][_0x1339('0x1b')]);}_0x488955[_0x1339('0x35')]=qs[_0x1339('0x36')](_0x47b71f[_0x1339('0x2d')][_0x1339('0x36')]);_0x488955[_0x1339('0x37')]=qs[_0x1339('0x2e')](_['pick'](_0x47b71f[_0x1339('0x2d')],_0x55df89[_0x1339('0x2e')]),_0x539c54);if(_0x47b71f['query']['filter']){_0x488955[_0x1339('0x37')]=_[_0x1339('0x38')](_0x488955[_0x1339('0x37')],{'$or':_['map'](_0x539c54,function(_0x470dd6){if(_0x470dd6[_0x1339('0x28')]!=='VIRTUAL'){var _0x3671de={};_0x3671de[_0x470dd6[_0x1339('0x24')]]={'$like':'%'+_0x47b71f[_0x1339('0x2d')][_0x1339('0x39')]+'%'};return _0x3671de;}})});}_0x488955=_['merge']({},_0x488955,_0x47b71f[_0x1339('0x3a')]);var _0x36ccb6={'where':_0x488955[_0x1339('0x37')]};return db[_0x1339('0x26')]['count'](_0x36ccb6)[_0x1339('0x21')](function(_0x26520f){_0x29e519[_0x1339('0x1a')]=_0x26520f;if(_0x47b71f[_0x1339('0x2d')][_0x1339('0x3b')]){_0x488955[_0x1339('0x3c')]=[{'all':!![]}];}return db['WhatsappTransferReport']['findAll'](_0x488955);})[_0x1339('0x21')](function(_0x123284){_0x29e519['rows']=_0x123284;return _0x29e519;})[_0x1339('0x21')](respondWithFilteredResult(_0x950861,_0x488955))[_0x1339('0x3d')](handleError(_0x950861,null));};exports[_0x1339('0x3e')]=function(_0x5a9ee3,_0x2a424c){var _0x27f1f8={'raw':!![],'where':{'id':_0x5a9ee3[_0x1339('0x3f')]['id']}},_0x24aab3={};_0x24aab3['model']=_[_0x1339('0x2c')](db['WhatsappTransferReport']['rawAttributes']);_0x24aab3[_0x1339('0x2d')]=_['keys'](_0x5a9ee3['query']);_0x24aab3[_0x1339('0x2e')]=_[_0x1339('0x2f')](_0x24aab3['model'],_0x24aab3[_0x1339('0x2d')]);_0x27f1f8[_0x1339('0x31')]=_['intersection'](_0x24aab3[_0x1339('0x2a')],qs[_0x1339('0x30')](_0x5a9ee3[_0x1339('0x2d')][_0x1339('0x30')]));_0x27f1f8[_0x1339('0x31')]=_0x27f1f8[_0x1339('0x31')][_0x1339('0x32')]?_0x27f1f8[_0x1339('0x31')]:_0x24aab3['model'];if(_0x5a9ee3[_0x1339('0x2d')][_0x1339('0x3b')]){_0x27f1f8['include']=[{'all':!![]}];}_0x27f1f8=_[_0x1339('0x38')]({},_0x27f1f8,_0x5a9ee3[_0x1339('0x3a')]);return db[_0x1339('0x26')][_0x1339('0x40')](_0x27f1f8)[_0x1339('0x21')](handleEntityNotFound(_0x2a424c,null))[_0x1339('0x21')](respondWithResult(_0x2a424c,null))[_0x1339('0x3d')](handleError(_0x2a424c,null));};exports[_0x1339('0x41')]=function(_0xd349ed,_0x3a8a75){return db[_0x1339('0x26')][_0x1339('0x41')](_0xd349ed[_0x1339('0x42')],{})['then'](respondWithResult(_0x3a8a75,0xc9))[_0x1339('0x3d')](handleError(_0x3a8a75,null));};exports[_0x1339('0x43')]=function(_0x2fc36e,_0x3bf12a){if(_0x2fc36e[_0x1339('0x42')]['id']){delete _0x2fc36e[_0x1339('0x42')]['id'];}return db[_0x1339('0x26')][_0x1339('0x40')]({'where':{'id':_0x2fc36e[_0x1339('0x3f')]['id']}})[_0x1339('0x21')](handleEntityNotFound(_0x3bf12a,null))['then'](saveUpdates(_0x2fc36e[_0x1339('0x42')],null))[_0x1339('0x21')](respondWithResult(_0x3bf12a,null))[_0x1339('0x3d')](handleError(_0x3bf12a,null));};exports[_0x1339('0x22')]=function(_0xd8b5eb,_0x4f8d6e){return db[_0x1339('0x26')][_0x1339('0x40')]({'where':{'id':_0xd8b5eb[_0x1339('0x3f')]['id']}})[_0x1339('0x21')](handleEntityNotFound(_0x4f8d6e,null))[_0x1339('0x21')](removeEntity(_0x4f8d6e,null))['catch'](handleError(_0x4f8d6e,null));};exports[_0x1339('0x44')]=function(_0x2f3b6c,_0xb179){return db[_0x1339('0x26')][_0x1339('0x44')]()[_0x1339('0x21')](respondWithResult(_0xb179,null))[_0x1339('0x3d')](handleError(_0xb179,null));}; \ No newline at end of file +var _0xd35e=['WhatsappTransferReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','pick','filter','merge','options','where','include','findAll','rows','catch','show','rawAttributes','includeAll','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','papaparse','../../components/parsers/qs','../../config/logger','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','index','map'];(function(_0x419e8f,_0x7ccc7b){var _0x55cceb=function(_0x1bf86b){while(--_0x1bf86b){_0x419e8f['push'](_0x419e8f['shift']());}};_0x55cceb(++_0x7ccc7b);}(_0xd35e,0x14a));var _0xed35=function(_0x4d3a2b,_0x32a224){_0x4d3a2b=_0x4d3a2b-0x0;var _0xdd32c8=_0xd35e[_0x4d3a2b];return _0xdd32c8;};'use strict';var emlformat=require(_0xed35('0x0'));var rimraf=require(_0xed35('0x1'));var zipdir=require(_0xed35('0x2'));var jsonpatch=require(_0xed35('0x3'));var rp=require(_0xed35('0x4'));var moment=require(_0xed35('0x5'));var BPromise=require(_0xed35('0x6'));var Mustache=require(_0xed35('0x7'));var util=require(_0xed35('0x8'));var path=require(_0xed35('0x9'));var sox=require(_0xed35('0xa'));var csv=require(_0xed35('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xed35('0xc'));var _=require(_0xed35('0xd'));var squel=require(_0xed35('0xe'));var crypto=require('crypto');var jsforce=require(_0xed35('0xf'));var deskjs=require(_0xed35('0x10'));var toCsv=require(_0xed35('0xb'));var querystring=require('querystring');var Papa=require(_0xed35('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xed35('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xed35('0x13'))(_0xed35('0x14'));var utils=require(_0xed35('0x15'));var config=require(_0xed35('0x16'));var licenseUtil=require(_0xed35('0x17'));var db=require(_0xed35('0x18'))['db'];function respondWithStatusCode(_0x4c16df,_0x46f1be){_0x46f1be=_0x46f1be||0xcc;return function(_0x1a708e){if(_0x1a708e){return _0x4c16df[_0xed35('0x19')](_0x46f1be);}return _0x4c16df[_0xed35('0x1a')](_0x46f1be)[_0xed35('0x1b')]();};}function respondWithResult(_0x521525,_0x535e76){_0x535e76=_0x535e76||0xc8;return function(_0x17bc91){if(_0x17bc91){return _0x521525['status'](_0x535e76)[_0xed35('0x1c')](_0x17bc91);}};}function respondWithFilteredResult(_0x10e9f0,_0x5f1ac7){return function(_0x35f195){if(_0x35f195){var _0x1cfc00=typeof _0x5f1ac7['offset']===_0xed35('0x1d')&&typeof _0x5f1ac7[_0xed35('0x1e')]===_0xed35('0x1d');var _0x393481=_0x35f195[_0xed35('0x1f')];var _0x489804=_0x1cfc00?0x0:_0x5f1ac7[_0xed35('0x20')];var _0x1f49c3=_0x1cfc00?_0x35f195[_0xed35('0x1f')]:_0x5f1ac7[_0xed35('0x20')]+_0x5f1ac7[_0xed35('0x1e')];var _0x3deedb;if(_0x1f49c3>=_0x393481){_0x1f49c3=_0x393481;_0x3deedb=0xc8;}else{_0x3deedb=0xce;}_0x10e9f0[_0xed35('0x1a')](_0x3deedb);return _0x10e9f0['set']('Content-Range',_0x489804+'-'+_0x1f49c3+'/'+_0x393481)[_0xed35('0x1c')](_0x35f195);}return null;};}function patchUpdates(_0x20ae85){return function(_0x4ff391){try{jsonpatch[_0xed35('0x21')](_0x4ff391,_0x20ae85,!![]);}catch(_0x62d5cb){return BPromise[_0xed35('0x22')](_0x62d5cb);}return _0x4ff391[_0xed35('0x23')]();};}function saveUpdates(_0x145cd2,_0x3b9f6e){return function(_0x2dde67){if(_0x2dde67){return _0x2dde67[_0xed35('0x24')](_0x145cd2)[_0xed35('0x25')](function(_0x2e1305){return _0x2e1305;});}return null;};}function removeEntity(_0xadb1e4,_0x43f53e){return function(_0x31d0eb){if(_0x31d0eb){return _0x31d0eb[_0xed35('0x26')]()['then'](function(){_0xadb1e4[_0xed35('0x1a')](0xcc)[_0xed35('0x1b')]();});}};}function handleEntityNotFound(_0x57f023,_0x58ea52){return function(_0x34efd6){if(!_0x34efd6){_0x57f023['sendStatus'](0x194);}return _0x34efd6;};}function handleError(_0x50370b,_0xdeb774){_0xdeb774=_0xdeb774||0x1f4;return function(_0x2f9a99){logger[_0xed35('0x27')](_0x2f9a99[_0xed35('0x28')]);if(_0x2f9a99[_0xed35('0x29')]){delete _0x2f9a99[_0xed35('0x29')];}_0x50370b['status'](_0xdeb774)[_0xed35('0x2a')](_0x2f9a99);};}exports[_0xed35('0x2b')]=function(_0x332853,_0x5c38e5){var _0x16f005={},_0x23d552={},_0x37825f={'count':0x0,'rows':[]};var _0xbfb3e=_[_0xed35('0x2c')](db[_0xed35('0x2d')]['rawAttributes'],function(_0xaacf48){return{'name':_0xaacf48[_0xed35('0x2e')],'type':_0xaacf48[_0xed35('0x2f')][_0xed35('0x30')]};});_0x23d552[_0xed35('0x31')]=_[_0xed35('0x2c')](_0xbfb3e,_0xed35('0x29'));_0x23d552[_0xed35('0x32')]=_[_0xed35('0x33')](_0x332853[_0xed35('0x32')]);_0x23d552[_0xed35('0x34')]=_[_0xed35('0x35')](_0x23d552[_0xed35('0x31')],_0x23d552[_0xed35('0x32')]);_0x16f005[_0xed35('0x36')]=_['intersection'](_0x23d552[_0xed35('0x31')],qs[_0xed35('0x37')](_0x332853[_0xed35('0x32')]['fields']));_0x16f005['attributes']=_0x16f005[_0xed35('0x36')][_0xed35('0x38')]?_0x16f005[_0xed35('0x36')]:_0x23d552[_0xed35('0x31')];if(!_0x332853[_0xed35('0x32')]['hasOwnProperty'](_0xed35('0x39'))){_0x16f005[_0xed35('0x1e')]=qs['limit'](_0x332853[_0xed35('0x32')][_0xed35('0x1e')]);_0x16f005[_0xed35('0x20')]=qs[_0xed35('0x20')](_0x332853[_0xed35('0x32')]['offset']);}_0x16f005['order']=qs[_0xed35('0x3a')](_0x332853[_0xed35('0x32')][_0xed35('0x3a')]);_0x16f005['where']=qs[_0xed35('0x34')](_[_0xed35('0x3b')](_0x332853[_0xed35('0x32')],_0x23d552['filters']),_0xbfb3e);if(_0x332853['query']['filter']){_0x16f005['where']=_['merge'](_0x16f005['where'],{'$or':_[_0xed35('0x2c')](_0xbfb3e,function(_0x1beb38){if(_0x1beb38['type']!=='VIRTUAL'){var _0x2bcaa9={};_0x2bcaa9[_0x1beb38[_0xed35('0x29')]]={'$like':'%'+_0x332853[_0xed35('0x32')][_0xed35('0x3c')]+'%'};return _0x2bcaa9;}})});}_0x16f005=_[_0xed35('0x3d')]({},_0x16f005,_0x332853[_0xed35('0x3e')]);var _0x3c94d2={'where':_0x16f005[_0xed35('0x3f')]};return db['WhatsappTransferReport'][_0xed35('0x1f')](_0x3c94d2)[_0xed35('0x25')](function(_0x39782d){_0x37825f[_0xed35('0x1f')]=_0x39782d;if(_0x332853[_0xed35('0x32')]['includeAll']){_0x16f005[_0xed35('0x40')]=[{'all':!![]}];}return db['WhatsappTransferReport'][_0xed35('0x41')](_0x16f005);})[_0xed35('0x25')](function(_0x26cc3c){_0x37825f[_0xed35('0x42')]=_0x26cc3c;return _0x37825f;})[_0xed35('0x25')](respondWithFilteredResult(_0x5c38e5,_0x16f005))[_0xed35('0x43')](handleError(_0x5c38e5,null));};exports[_0xed35('0x44')]=function(_0x5b7fef,_0x247f7f){var _0x304fdb={'raw':!![],'where':{'id':_0x5b7fef['params']['id']}},_0x59fe4b={};_0x59fe4b[_0xed35('0x31')]=_['keys'](db[_0xed35('0x2d')][_0xed35('0x45')]);_0x59fe4b['query']=_[_0xed35('0x33')](_0x5b7fef[_0xed35('0x32')]);_0x59fe4b['filters']=_[_0xed35('0x35')](_0x59fe4b['model'],_0x59fe4b[_0xed35('0x32')]);_0x304fdb['attributes']=_[_0xed35('0x35')](_0x59fe4b['model'],qs['fields'](_0x5b7fef[_0xed35('0x32')][_0xed35('0x37')]));_0x304fdb[_0xed35('0x36')]=_0x304fdb[_0xed35('0x36')][_0xed35('0x38')]?_0x304fdb[_0xed35('0x36')]:_0x59fe4b[_0xed35('0x31')];if(_0x5b7fef[_0xed35('0x32')][_0xed35('0x46')]){_0x304fdb[_0xed35('0x40')]=[{'all':!![]}];}_0x304fdb=_[_0xed35('0x3d')]({},_0x304fdb,_0x5b7fef[_0xed35('0x3e')]);return db['WhatsappTransferReport'][_0xed35('0x47')](_0x304fdb)[_0xed35('0x25')](handleEntityNotFound(_0x247f7f,null))['then'](respondWithResult(_0x247f7f,null))['catch'](handleError(_0x247f7f,null));};exports[_0xed35('0x48')]=function(_0x30eb83,_0x3d2556){return db[_0xed35('0x2d')][_0xed35('0x48')](_0x30eb83[_0xed35('0x49')],{})[_0xed35('0x25')](respondWithResult(_0x3d2556,0xc9))[_0xed35('0x43')](handleError(_0x3d2556,null));};exports[_0xed35('0x24')]=function(_0x5db168,_0x4a2a58){if(_0x5db168[_0xed35('0x49')]['id']){delete _0x5db168[_0xed35('0x49')]['id'];}return db[_0xed35('0x2d')][_0xed35('0x47')]({'where':{'id':_0x5db168[_0xed35('0x4a')]['id']}})[_0xed35('0x25')](handleEntityNotFound(_0x4a2a58,null))[_0xed35('0x25')](saveUpdates(_0x5db168[_0xed35('0x49')],null))[_0xed35('0x25')](respondWithResult(_0x4a2a58,null))[_0xed35('0x43')](handleError(_0x4a2a58,null));};exports[_0xed35('0x26')]=function(_0xa92d5,_0x575ec2){return db['WhatsappTransferReport']['find']({'where':{'id':_0xa92d5[_0xed35('0x4a')]['id']}})['then'](handleEntityNotFound(_0x575ec2,null))[_0xed35('0x25')](removeEntity(_0x575ec2,null))[_0xed35('0x43')](handleError(_0x575ec2,null));};exports['describe']=function(_0x40fecf,_0x42629e){return db[_0xed35('0x2d')]['describe']()[_0xed35('0x25')](respondWithResult(_0x42629e,null))['catch'](handleError(_0x42629e,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index ae33ecf..7480f33 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 _0xa445=['../../config/logger','api','moment','bluebird','rimraf','./whatsappTransferReport.attributes','define','report_whatsapp_transfer','uniqueid'];(function(_0x33e9cc,_0x4ac288){var _0x4603fd=function(_0x21eb18){while(--_0x21eb18){_0x33e9cc['push'](_0x33e9cc['shift']());}};_0x4603fd(++_0x4ac288);}(_0xa445,0x168));var _0x5a44=function(_0x4b510d,_0x7830d0){_0x4b510d=_0x4b510d-0x0;var _0x2f9dd1=_0xa445[_0x4b510d];return _0x2f9dd1;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5a44('0x0'))(_0x5a44('0x1'));var moment=require(_0x5a44('0x2'));var BPromise=require(_0x5a44('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5a44('0x4'));var config=require('../../config/environment');var attributes=require(_0x5a44('0x5'));module['exports']=function(_0x889438,_0x28a619){return _0x889438[_0x5a44('0x6')]('WhatsappTransferReport',attributes,{'tableName':_0x5a44('0x7'),'paranoid':![],'indexes':[{'name':_0x5a44('0x8'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x6e32=['../../config/environment','./whatsappTransferReport.attributes','define','WhatsappTransferReport','uniqueid','util','../../config/logger','api','moment','request-promise'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x6e32,0x163));var _0x26e3=function(_0xa56838,_0x4cc85d){_0xa56838=_0xa56838-0x0;var _0x37fbdb=_0x6e32[_0xa56838];return _0x37fbdb;};'use strict';var _=require('lodash');var util=require(_0x26e3('0x0'));var logger=require(_0x26e3('0x1'))(_0x26e3('0x2'));var moment=require(_0x26e3('0x3'));var BPromise=require('bluebird');var rp=require(_0x26e3('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x26e3('0x5'));var attributes=require(_0x26e3('0x6'));module['exports']=function(_0x4e1c01,_0x220cf5){return _0x4e1c01[_0x26e3('0x7')](_0x26e3('0x8'),attributes,{'tableName':'report_whatsapp_transfer','paranoid':![],'indexes':[{'name':_0x26e3('0x9'),'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 a604a46..7179d46 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 _0xad21=['request\x20sent','stringify','error','code','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','WhatsappTransferReport,\x20%s,\x20%s'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xad21,0x18e));var _0x1ad2=function(_0x170772,_0x1f1ee7){_0x170772=_0x170772-0x0;var _0x3ef69c=_0xad21[_0x170772];return _0x3ef69c;};'use strict';var _=require(_0x1ad2('0x0'));var util=require(_0x1ad2('0x1'));var moment=require('moment');var BPromise=require(_0x1ad2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1ad2('0x3'));var db=require(_0x1ad2('0x4'))['db'];var utils=require(_0x1ad2('0x5'));var logger=require(_0x1ad2('0x6'))(_0x1ad2('0x7'));var config=require(_0x1ad2('0x8'));var jayson=require(_0x1ad2('0x9'));var client=jayson[_0x1ad2('0xa')][_0x1ad2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3a7b51,_0x22eb81,_0x32c003){return new BPromise(function(_0x2c96b3,_0x197e07){return client[_0x1ad2('0xc')](_0x3a7b51,_0x32c003)[_0x1ad2('0xd')](function(_0x98ff69){logger[_0x1ad2('0xe')](_0x1ad2('0xf'),_0x22eb81,_0x1ad2('0x10'));logger['debug']('WhatsappTransferReport,\x20%s,\x20%s,\x20%s',_0x22eb81,_0x1ad2('0x10'),JSON[_0x1ad2('0x11')](_0x98ff69));if(_0x98ff69['error']){if(_0x98ff69[_0x1ad2('0x12')][_0x1ad2('0x13')]===0x1f4){logger[_0x1ad2('0x12')](_0x1ad2('0xf'),_0x22eb81,_0x98ff69[_0x1ad2('0x12')][_0x1ad2('0x14')]);return _0x197e07(_0x98ff69[_0x1ad2('0x12')][_0x1ad2('0x14')]);}logger['error'](_0x1ad2('0xf'),_0x22eb81,_0x98ff69['error'][_0x1ad2('0x14')]);return _0x2c96b3(_0x98ff69[_0x1ad2('0x12')][_0x1ad2('0x14')]);}else{logger[_0x1ad2('0xe')](_0x1ad2('0xf'),_0x22eb81,_0x1ad2('0x10'));_0x2c96b3(_0x98ff69[_0x1ad2('0x15')]['message']);}})[_0x1ad2('0x16')](function(_0x2122e4){logger['error'](_0x1ad2('0xf'),_0x22eb81,_0x2122e4);_0x197e07(_0x2122e4);});});} \ No newline at end of file +var _0xaeed=['error','code','WhatsappTransferReport,\x20%s,\x20%s','message','result','catch','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','request\x20sent','stringify'];(function(_0x393203,_0x28ca31){var _0x3394b6=function(_0x5cc9ca){while(--_0x5cc9ca){_0x393203['push'](_0x393203['shift']());}};_0x3394b6(++_0x28ca31);}(_0xaeed,0x84));var _0xdaee=function(_0x236206,_0xbcc14f){_0x236206=_0x236206-0x0;var _0x9ea003=_0xaeed[_0x236206];return _0x9ea003;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xdaee('0x0'));var rs=require(_0xdaee('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xdaee('0x2'));var logger=require(_0xdaee('0x3'))(_0xdaee('0x4'));var config=require(_0xdaee('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xdaee('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0xfd4f50,_0x1c1343,_0x995ef8){return new BPromise(function(_0x5d653e,_0x35e645){return client[_0xdaee('0x7')](_0xfd4f50,_0x995ef8)[_0xdaee('0x8')](function(_0x4fc6c8){logger[_0xdaee('0x9')]('WhatsappTransferReport,\x20%s,\x20%s',_0x1c1343,'request\x20sent');logger['debug']('WhatsappTransferReport,\x20%s,\x20%s,\x20%s',_0x1c1343,_0xdaee('0xa'),JSON[_0xdaee('0xb')](_0x4fc6c8));if(_0x4fc6c8[_0xdaee('0xc')]){if(_0x4fc6c8[_0xdaee('0xc')][_0xdaee('0xd')]===0x1f4){logger[_0xdaee('0xc')](_0xdaee('0xe'),_0x1c1343,_0x4fc6c8[_0xdaee('0xc')][_0xdaee('0xf')]);return _0x35e645(_0x4fc6c8[_0xdaee('0xc')][_0xdaee('0xf')]);}logger['error'](_0xdaee('0xe'),_0x1c1343,_0x4fc6c8['error'][_0xdaee('0xf')]);return _0x5d653e(_0x4fc6c8[_0xdaee('0xc')][_0xdaee('0xf')]);}else{logger['info'](_0xdaee('0xe'),_0x1c1343,_0xdaee('0xa'));_0x5d653e(_0x4fc6c8[_0xdaee('0x10')][_0xdaee('0xf')]);}})[_0xdaee('0x11')](function(_0x114d9f){logger['error'](_0xdaee('0xe'),_0x1c1343,_0x114d9f);_0x35e645(_0x114d9f);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 02f9a79..2caf8f7 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34f2=['./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','./config/schedule/cloud-provider','sequelize','sync','then','default','listen','info','start','exitCode','number','length','\x20processes\x20failed\x20at\x20startup:\x20','map','pm2_env','name','Online\x20apps:','filter','online','join','Offline\x20apps:','log','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./config/license','./rpc','./config/environment'];(function(_0x17c483,_0xc69535){var _0x112bdb=function(_0x19adb9){while(--_0x19adb9){_0x17c483['push'](_0x17c483['shift']());}};_0x112bdb(++_0xc69535);}(_0x34f2,0x15a));var _0x234f=function(_0x17f89a,_0x366c7f){_0x17f89a=_0x17f89a-0x0;var _0xaf4d56=_0x34f2[_0x17f89a];return _0xaf4d56;};'use strict';var _=require(_0x234f('0x0'));var db=require(_0x234f('0x1'))['db'];var seedDb=require('./config/seedDB');var checkLicense=require(_0x234f('0x2'));var rpc=require(_0x234f('0x3'));var config=require(_0x234f('0x4'));var logger=require(_0x234f('0x5'))(_0x234f('0x6'));var pm2=require(_0x234f('0x7'));var pm2Config=require(_0x234f('0x8'));var schedule=require(_0x234f('0x9'));var chat=require(_0x234f('0xa'));var whatsapp=require(_0x234f('0xb'));var transcribe=require(_0x234f('0xc'));var provider=require(_0x234f('0xd'));function main(){return db[_0x234f('0xe')][_0x234f('0xf')]()[_0x234f('0x10')](function(){if(config['seedDB']){return seedDb[_0x234f('0x11')]();}})[_0x234f('0x10')](function(){return checkLicense['default']();})['then'](function(){return rpc[_0x234f('0x12')]();})[_0x234f('0x10')](function(_0x128c04){logger[_0x234f('0x13')](_0x128c04);return chat[_0x234f('0x14')]();})['then'](function(){return whatsapp[_0x234f('0x14')]();})[_0x234f('0x10')](function(){return schedule[_0x234f('0x14')]();})[_0x234f('0x10')](function(){return transcribe['start']();})[_0x234f('0x10')](function(){return provider['start']();})[_0x234f('0x10')](function(_0x1d4899){logger[_0x234f('0x13')](_0x1d4899);return pm2[_0x234f('0x14')](pm2Config);})[_0x234f('0x10')](function(_0x10ee30){var _0x296c3a=_0x10ee30['filter'](function(_0x5ada71){return typeof _0x5ada71[_0x234f('0x15')]===_0x234f('0x16')&&_0x5ada71['exitCode']>=0x0;});if(_0x296c3a[_0x234f('0x17')]>0x0){throw new Error(_0x296c3a[_0x234f('0x17')]+_0x234f('0x18')+_[_0x234f('0x19')](_0x296c3a,function(_0x304c08){return'\x22'+_0x304c08[_0x234f('0x1a')][_0x234f('0x1b')]+'\x22';}));}logger[_0x234f('0x13')](_0x234f('0x1c'),_['map'](_[_0x234f('0x1d')](_0x10ee30,{'status':_0x234f('0x1e')}),_0x234f('0x1b'))[_0x234f('0x1f')]());logger[_0x234f('0x13')](_0x234f('0x20'),_[_0x234f('0x19')](_[_0x234f('0x1d')](_0x10ee30,function(_0x45b3c0){return _0x45b3c0['status']!=='online';}),_0x234f('0x1b'))[_0x234f('0x1f')]()||'None');console[_0x234f('0x21')]('App\x20Ready!');})[_0x234f('0x22')](function(_0x3f441a){console[_0x234f('0x21')](_0x234f('0x23'),_0x3f441a);logger[_0x234f('0x24')](_0x234f('0x25'),_0x3f441a);process[_0x234f('0x26')](0x1);});}main(); \ No newline at end of file +var _0x1354=['catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./config/seedDB','./config/license','./rpc','./config/environment','./config/logger','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/whatsapp','./config/schedule/transcribe','sequelize','sync','then','default','listen','info','start','filter','number','exitCode','\x20processes\x20failed\x20at\x20startup:\x20','map','online','name','join','Offline\x20apps:','status','None','log'];(function(_0x439c3e,_0x403b18){var _0x119053=function(_0x379483){while(--_0x379483){_0x439c3e['push'](_0x439c3e['shift']());}};_0x119053(++_0x403b18);}(_0x1354,0x95));var _0x4135=function(_0x294f3d,_0x1b0f82){_0x294f3d=_0x294f3d-0x0;var _0x2c8f6c=_0x1354[_0x294f3d];return _0x2c8f6c;};'use strict';var _=require(_0x4135('0x0'));var db=require(_0x4135('0x1'))['db'];var seedDb=require(_0x4135('0x2'));var checkLicense=require(_0x4135('0x3'));var rpc=require(_0x4135('0x4'));var config=require(_0x4135('0x5'));var logger=require(_0x4135('0x6'))('app');var pm2=require(_0x4135('0x7'));var pm2Config=require(_0x4135('0x8'));var schedule=require(_0x4135('0x9'));var chat=require('./config/schedule/chat');var whatsapp=require(_0x4135('0xa'));var transcribe=require(_0x4135('0xb'));var provider=require('./config/schedule/cloud-provider');function main(){return db[_0x4135('0xc')][_0x4135('0xd')]()[_0x4135('0xe')](function(){if(config['seedDB']){return seedDb[_0x4135('0xf')]();}})['then'](function(){return checkLicense[_0x4135('0xf')]();})[_0x4135('0xe')](function(){return rpc[_0x4135('0x10')]();})[_0x4135('0xe')](function(_0x5dd78a){logger[_0x4135('0x11')](_0x5dd78a);return chat['start']();})['then'](function(){return whatsapp[_0x4135('0x12')]();})[_0x4135('0xe')](function(){return schedule[_0x4135('0x12')]();})['then'](function(){return transcribe[_0x4135('0x12')]();})[_0x4135('0xe')](function(){return provider[_0x4135('0x12')]();})[_0x4135('0xe')](function(_0x3731e8){logger[_0x4135('0x11')](_0x3731e8);return pm2['start'](pm2Config);})['then'](function(_0x249c86){var _0x3c90cf=_0x249c86[_0x4135('0x13')](function(_0x17179a){return typeof _0x17179a['exitCode']===_0x4135('0x14')&&_0x17179a[_0x4135('0x15')]>=0x0;});if(_0x3c90cf['length']>0x0){throw new Error(_0x3c90cf['length']+_0x4135('0x16')+_['map'](_0x3c90cf,function(_0x2f2600){return'\x22'+_0x2f2600['pm2_env']['name']+'\x22';}));}logger['info']('Online\x20apps:',_[_0x4135('0x17')](_['filter'](_0x249c86,{'status':_0x4135('0x18')}),_0x4135('0x19'))[_0x4135('0x1a')]());logger['info'](_0x4135('0x1b'),_[_0x4135('0x17')](_[_0x4135('0x13')](_0x249c86,function(_0x485395){return _0x485395[_0x4135('0x1c')]!=='online';}),_0x4135('0x19'))[_0x4135('0x1a')]()||_0x4135('0x1d'));console[_0x4135('0x1e')]('App\x20Ready!');})[_0x4135('0x1f')](function(_0x126527){console[_0x4135('0x1e')](_0x4135('0x20'),_0x126527);logger[_0x4135('0x21')](_0x4135('0x22'),_0x126527);process[_0x4135('0x23')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index faa9b73..d4d8dcb 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 _0x38e7=['update','Forbidden','webrtc','isMiddleware','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','motion.token','/dashboards/general','send','retrieveApiKey','isNil','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','split','splice','join','promisify','sign','secret','options','verify','randomBytes','hex','floor','now','toString','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','basic-auth','crypto','bluebird','util','moment','secrets','session','role','permissions','md5secret','voicePause','chatPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','phoneBarDnd','phoneBarEnableRecording','phoneBarExpires','phoneBarPrefixRequired','hotdesk','interface','userProfileId','privacyEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','chatAutoanswer','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','openchannelAutoanswerDelay','whatsappAutoanswerDelay','messengerSoundNotification','isChatInteractionAuthorized','isAuthenticated','use','user','params','closed','disposition','then','query','forceDownload','status','unmanaged','Unmanaged.','catch','headers','startsWith','authorization','User','find','name','authenticate','pass','json','Wrong\x20credentials.','Bearer','Unknown\x20authorization\x20format','getUuid','apikey','sub','findOne','allowedLoginAttempts','blockDuration','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','add','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense'];(function(_0x18a794,_0x335c63){var _0x4fadaa=function(_0x49b618){while(--_0x49b618){_0x18a794['push'](_0x18a794['shift']());}};_0x4fadaa(++_0x335c63);}(_0x38e7,0xa7));var _0x738e=function(_0x1e393b,_0x355f6b){_0x1e393b=_0x1e393b-0x0;var _0x3d0bfe=_0x38e7[_0x1e393b];return _0x3d0bfe;};'use strict';var db=require(_0x738e('0x0'))['db'];var config=require(_0x738e('0x1'));var hardwareConf=require(_0x738e('0x2'));var licenseUtil=require(_0x738e('0x3'));var encryptor=require('../encryptor');var _=require('lodash');var jwt=require('jsonwebtoken');var expressJwt=require('express-jwt');var compose=require('composable-middleware');var basicAuth=require(_0x738e('0x4'));var crypto=require(_0x738e('0x5'));var BPromise=require(_0x738e('0x6'));var util=require(_0x738e('0x7'));var moment=require(_0x738e('0x8'));var validateJwt=expressJwt({'secret':config[_0x738e('0x9')][_0x738e('0xa')]});var userAttributes=['id',_0x738e('0xb'),'fullname','name','internal','email','userpic',_0x738e('0xc'),_0x738e('0xd'),_0x738e('0xe'),_0x738e('0xf'),'mailPause',_0x738e('0x10'),_0x738e('0x11'),_0x738e('0x12'),_0x738e('0x13'),_0x738e('0x14'),_0x738e('0x15'),_0x738e('0x16'),_0x738e('0x17'),_0x738e('0x18'),'passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay',_0x738e('0x19'),_0x738e('0x1a'),'phoneBarEnableDtmfTone','phoneBarEnableSettings',_0x738e('0x1b'),_0x738e('0x1c'),'phoneBarRemoteControl','phoneBarRemoteControlPort',_0x738e('0x1d'),_0x738e('0x1e'),_0x738e('0x1f'),_0x738e('0x20'),'settingsEnabled',_0x738e('0x21'),_0x738e('0x22'),_0x738e('0x23'),_0x738e('0x24'),_0x738e('0x25'),'selectRecallMeCampaign',_0x738e('0x26'),_0x738e('0x27'),_0x738e('0x28'),_0x738e('0x29'),_0x738e('0x2a'),_0x738e('0x2b'),_0x738e('0x2c'),_0x738e('0x2d'),'faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswer',_0x738e('0x2e'),_0x738e('0x2f')];exports[_0x738e('0x30')]=function(){return this[_0x738e('0x31')](!![])[_0x738e('0x32')](function(_0x1dbaa2,_0x3bc810,_0x204f57){if(_0x1dbaa2[_0x738e('0x33')]){_0x204f57();}else{return db['ChatInteraction']['findOne']({'where':{'id':_0x1dbaa2[_0x738e('0x34')]['id']},'attributes':['id',_0x738e('0x35'),_0x738e('0x36')],'raw':!![]})[_0x738e('0x37')](function(_0x231370){if(_0x231370&&_0x231370[_0x738e('0x35')]&&!_0x1dbaa2[_0x738e('0x38')][_0x738e('0x39')]){return _0x3bc810[_0x738e('0x3a')](_0x231370[_0x738e('0x36')]===_0x738e('0x3b')?0x195:0x193)['json']({'message':_0x231370[_0x738e('0x36')]===_0x738e('0x3b')?_0x738e('0x3c'):'Forbidden.'});}else{_0x204f57();}})[_0x738e('0x3d')](function(_0x522acf){_0x204f57(_0x522acf);});}});};exports[_0x738e('0x31')]=function isAuthenticated(_0x39efff){return compose()[_0x738e('0x32')](function(_0x10d04d,_0x120774,_0x56acb8){var _0x113ab1;if(_0x10d04d[_0x738e('0x3e')]['authorization']){if(_[_0x738e('0x3f')](_0x10d04d[_0x738e('0x3e')][_0x738e('0x40')],'Basic')){var _0x5109f0=basicAuth(_0x10d04d);db[_0x738e('0x41')][_0x738e('0x42')]({'where':{'name':_0x5109f0[_0x738e('0x43')]}})[_0x738e('0x37')](function(_0x805056){if(!_0x805056||!_0x805056[_0x738e('0x44')](_0x5109f0[_0x738e('0x45')])){return _0x120774['status'](0x191)[_0x738e('0x46')]({'message':_0x738e('0x47')});}_0x10d04d[_0x738e('0x33')]={'id':_0x805056['id']};_0x56acb8();})[_0x738e('0x3d')](function(_0x1c6a3a){_0x56acb8(_0x1c6a3a);});}else if(_[_0x738e('0x3f')](_0x10d04d[_0x738e('0x3e')][_0x738e('0x40')],_0x738e('0x48'))){validateJwt(_0x10d04d,_0x120774,_0x56acb8);}else{if(_0x39efff){_0x56acb8();}else{return _0x120774[_0x738e('0x3a')](0x193)['json']({'message':_0x738e('0x49')});}}}else if(_0x10d04d['query']['apikey']){try{var _0x5b7d20={'audience':hardwareConf[_0x738e('0x4a')](),'issuer':hardwareConf['getUuid']()};verifyJwt(_0x10d04d[_0x738e('0x38')][_0x738e('0x4b')],_0x5b7d20)[_0x738e('0x37')](function(_0x26c992){return db[_0x738e('0x41')][_0x738e('0x42')]({'where':{'id':_0x26c992[_0x738e('0x4c')]}})['then'](function(_0x56e906){_0x113ab1=_0x56e906;return db['Setting'][_0x738e('0x4d')]({'where':{'id':0x1},'attributes':[_0x738e('0x4e'),_0x738e('0x4f')],'raw':!![]});})['then'](function(_0x124c5f){if(!_0x113ab1||!_[_0x738e('0x50')](_0x113ab1[_0x738e('0x51')],_0x26c992[_0x738e('0x52')])){return _0x120774[_0x738e('0x3a')](0x191)[_0x738e('0x46')]({'message':_0x738e('0x53')});}if(_0x113ab1[_0x738e('0x54')]){return _0x120774[_0x738e('0x3a')](0x191)[_0x738e('0x46')]({'message':_0x738e('0x55')});}if(_0x113ab1['blocked']){if(_0x124c5f['blockDuration']>0x0){if(moment(_0x113ab1['blockedAt'])[_0x738e('0x56')](_0x124c5f[_0x738e('0x4f')],'minutes')>moment()){return _0x120774[_0x738e('0x3a')](0x191)['json']({'message':'Invalid\x20API\x20access\x20key'});}}else{return _0x120774[_0x738e('0x3a')](0x191)[_0x738e('0x46')]({'message':_0x738e('0x55')});}}_0x10d04d[_0x738e('0x33')]={'id':_0x113ab1['id']};_0x56acb8();});})['catch'](function(){return _0x120774['status'](0x191)[_0x738e('0x46')]({'message':'Invalid\x20API\x20access\x20key'});});}catch(_0x466679){_0x56acb8(_0x466679);}}else if(_0x39efff){_0x56acb8();}else{return _0x120774['status'](0x193)[_0x738e('0x46')]({'message':_0x738e('0x49')});}})[_0x738e('0x32')](function(_0x8009a8,_0x177a40,_0x5df901){if(_0x8009a8[_0x738e('0x33')]){db['User']['find']({'where':{'id':_0x8009a8['user']['id']},'attributes':userAttributes})[_0x738e('0x37')](function(_0x441a0d){if(!_0x441a0d){return _0x177a40['status'](0x194)[_0x738e('0x46')]({'message':_0x738e('0x57')});}_0x8009a8[_0x738e('0x33')]=_0x441a0d;_0x5df901();})['catch'](function(_0x3b75e0){_0x5df901(_0x3b75e0);});}else if(_0x39efff){_0x5df901();}else{return _0x177a40[_0x738e('0x3a')](0x194)[_0x738e('0x46')]({'message':_0x738e('0x58')});}});};exports[_0x738e('0x59')]=function canUpdate(){return compose()[_0x738e('0x32')](function(_0x1d2b0e,_0x22f201,_0x91044b){return licenseUtil[_0x738e('0x5a')]()['then'](function(_0x233473){if(_0x233473[_0x738e('0x5b')]){_0x91044b();}else{return _0x22f201['status'](0x193)[_0x738e('0x46')]({'message':_0x738e('0x5c')});}})[_0x738e('0x3d')](function(_0x191bfb){_0x91044b(_0x191bfb);});});};exports['isWebrtcLicence']=function isWebrtcLicence(){return compose()[_0x738e('0x32')](function(_0x22c019,_0x351ee5,_0x1eace9){return licenseUtil[_0x738e('0x5a')]()['then'](function(_0x25e848){if(_0x25e848[_0x738e('0x5d')]){_0x1eace9();}else{return _0x351ee5[_0x738e('0x3a')](0x193)[_0x738e('0x46')]({'message':_0x738e('0x5c')});}})[_0x738e('0x3d')](function(_0xf166a4){_0x1eace9(_0xf166a4);});});};exports[_0x738e('0x5e')]=function(_0x4abd51,_0x5a5ce3,_0x19e846){_0x4abd51[_0x738e('0x5e')]=!![];return _0x19e846();};exports['signToken']=function signToken(_0x59524c){return signJwt(_0x59524c);};exports[_0x738e('0x5f')]=function(_0x12cbf0,_0x5b6b2c){if(!_0x12cbf0[_0x738e('0x33')]){return _0x5b6b2c[_0x738e('0x3a')](0x194)[_0x738e('0x46')]({'message':_0x738e('0x60')});}var _0x5a5329={'payload':{'id':_0x12cbf0[_0x738e('0x33')]['id'],'role':_0x12cbf0[_0x738e('0x33')][_0x738e('0xb')]},'options':{'expiresIn':0x15180}};return signJwt(_0x5a5329)[_0x738e('0x37')](function(_0x51652a){_0x5b6b2c['cookie'](_0x738e('0x61'),_0x51652a);_0x5b6b2c['redirect'](_0x738e('0x62'));})[_0x738e('0x3d')](function(_0x3b273f){return _0x5b6b2c['status'](0x1f4)[_0x738e('0x63')](_0x3b273f);});};exports[_0x738e('0x64')]=function(_0x4f9317){if(_[_0x738e('0x65')](_0x4f9317['apiKeyNonce'])||_['isNil'](_0x4f9317[_0x738e('0x66')])){return null;}else{return createJwt(_0x4f9317);}};exports[_0x738e('0x67')]=function(_0x46bb1d){_0x46bb1d[_0x738e('0x51')]=generateNonce();_0x46bb1d[_0x738e('0x66')]=generateIssuedAt();return createJwt(_0x46bb1d);};exports[_0x738e('0x68')]=function(_0x1e6e41,_0x4c2218){var _0x51218b=_0x1e6e41[_0x738e('0x38')][_0x738e('0x4b')];if(_0x51218b){var _0x20d617={'nonce':_0x4c2218['apiKeyNonce'],'iat':_0x4c2218[_0x738e('0x66')],'audience':hardwareConf[_0x738e('0x4a')](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x51218b,_0x20d617)[_0x738e('0x37')](function(){return generateApiKey(_0x4c2218);});}else{throw{'message':_0x738e('0x69')};}};exports[_0x738e('0x6a')]=function(_0x121c59){var _0x2e0f26=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x2e0f26['test'](_0x121c59))throw new db[(_0x738e('0x6b'))][(_0x738e('0x6c'))](_0x738e('0x6d'));return;};exports[_0x738e('0x6e')]=function(_0x23b17e,_0x52cbe0,_0x233adb){var _0xbf3bd=encryptor['decryptString'](_0x52cbe0)['split'](',');for(var _0x434aa7=0x0;_0x434aa7<_0x233adb;_0x434aa7++){if(!_0xbf3bd[_0x434aa7])break;if(_0x23b17e['toLowerCase']()===_0xbf3bd[_0x434aa7][_0x738e('0x6f')]()){var _0x16f3ce=util[_0x738e('0x70')](_0x738e('0x71'),_0x233adb);if(_0x233adb===0x1){_0x16f3ce='The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.';}throw new db[(_0x738e('0x6b'))][(_0x738e('0x6c'))](_0x16f3ce);}}return;};exports[_0x738e('0x72')]=function(_0x3c4dee,_0x3134cf){var _0x59c66c=_0x3134cf?encryptor['decryptString'](_0x3134cf)[_0x738e('0x73')](','):[];if(_0x59c66c['length']===0x5){_0x59c66c[_0x738e('0x74')](-0x1,0x1);}_0x59c66c['unshift'](_0x3c4dee);return encryptor['encryptString'](_0x59c66c[_0x738e('0x75')](','));};function signJwt(_0x4d2573){var _0x5bc8c9=BPromise[_0x738e('0x76')](jwt[_0x738e('0x77')],{'context':jwt});var _0x2327ed=_0x4d2573[_0x738e('0x78')]||config[_0x738e('0x9')][_0x738e('0xa')];return new BPromise(function(_0x4e28c5,_0x477b45){_0x5bc8c9(_0x4d2573['payload'],_0x2327ed,_0x4d2573[_0x738e('0x79')])[_0x738e('0x37')](function(_0x40b80b){_0x4e28c5(_0x40b80b);})['catch'](function(_0x564210){_0x477b45(_0x564210);});});}function verifyJwt(_0xc52ca2,_0x7027a,_0x266b60){var _0x125e2b=BPromise[_0x738e('0x76')](jwt[_0x738e('0x7a')],{'context':jwt});var _0x515954=_0x266b60||config[_0x738e('0x9')][_0x738e('0xa')];return new BPromise(function(_0x2f5e8e,_0x1b4605){_0x125e2b(_0xc52ca2,_0x515954,_0x7027a)[_0x738e('0x37')](function(_0x669dfa){_0x2f5e8e(_0x669dfa);})[_0x738e('0x3d')](function(_0x4987d7){_0x1b4605(_0x4987d7);});});}function generateNonce(){return crypto[_0x738e('0x7b')](0x10)['toString'](_0x738e('0x7c'));}function generateIssuedAt(){return Math[_0x738e('0x7d')](Date[_0x738e('0x7e')]()/0x3e8)[_0x738e('0x7f')]();}function createJwt(_0x4bbc52){var _0x2ddfe6={'payload':{'iat':_0x4bbc52[_0x738e('0x66')],'nonce':_0x4bbc52[_0x738e('0x51')]},'options':{'algorithm':_0x738e('0x80'),'subject':_0x4bbc52['id'][_0x738e('0x7f')](),'issuer':hardwareConf[_0x738e('0x4a')](),'audience':hardwareConf[_0x738e('0x4a')]()}};return signJwt(_0x2ddfe6)['then'](function(_0x231f5a){return{'iat':_0x4bbc52['apiKeyIat'],'nonce':_0x4bbc52['apiKeyNonce'],'token':_0x231f5a};});} \ No newline at end of file +var _0x743a=['isAuthenticated','use','user','findOne','params','disposition','then','closed','query','forceDownload','unmanaged','json','Unmanaged.','Forbidden.','catch','startsWith','headers','authorization','User','find','pass','status','Bearer','Unknown\x20authorization\x20format','apikey','getUuid','Setting','blockDuration','isEqual','disabled','Invalid\x20API\x20access\x20key','blocked','blockedAt','add','minutes','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','update','Forbidden','isWebrtcLicence','webrtc','isMiddleware','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','/dashboards/general','retrieveApiKey','isNil','apiKeyIat','generateApiKey','apiKeyNonce','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','validatePasswordHistory','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','Sequelize','ValidationError','updatePasswordsHistory','length','splice','unshift','join','promisify','sign','secret','payload','verify','toString','hex','now','HS512','../../mysqldb','../../config/environment','../../config/license/util','../encryptor','jsonwebtoken','express-jwt','composable-middleware','basic-auth','bluebird','util','moment','secrets','session','role','fullname','name','internal','userpic','permissions','md5secret','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','phoneBarAutoAnswerDelay','phoneBarEnableRecording','phoneBarEnableSettings','phoneBarPrefixRequired','phoneBarRemoteControl','hotdesk','userProfileId','privacyEnabled','settingsEnabled','downloadVoiceRecordings','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswer','emailAutoanswer','emailAutoanswerDelay','smsAutoanswerDelay','openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswer','whatsappAutoanswerDelay','messengerSoundNotification'];(function(_0x5eff1a,_0x2bb961){var _0x13dec1=function(_0x55093b){while(--_0x55093b){_0x5eff1a['push'](_0x5eff1a['shift']());}};_0x13dec1(++_0x2bb961);}(_0x743a,0x1ec));var _0xa743=function(_0x2218ae,_0x5464e3){_0x2218ae=_0x2218ae-0x0;var _0x2068d0=_0x743a[_0x2218ae];return _0x2068d0;};'use strict';var db=require(_0xa743('0x0'))['db'];var config=require(_0xa743('0x1'));var hardwareConf=require('../../config/license/hardware');var licenseUtil=require(_0xa743('0x2'));var encryptor=require(_0xa743('0x3'));var _=require('lodash');var jwt=require(_0xa743('0x4'));var expressJwt=require(_0xa743('0x5'));var compose=require(_0xa743('0x6'));var basicAuth=require(_0xa743('0x7'));var crypto=require('crypto');var BPromise=require(_0xa743('0x8'));var util=require(_0xa743('0x9'));var moment=require(_0xa743('0xa'));var validateJwt=expressJwt({'secret':config[_0xa743('0xb')][_0xa743('0xc')]});var userAttributes=['id',_0xa743('0xd'),_0xa743('0xe'),_0xa743('0xf'),_0xa743('0x10'),'email',_0xa743('0x11'),_0xa743('0x12'),_0xa743('0x13'),_0xa743('0x14'),_0xa743('0x15'),_0xa743('0x16'),_0xa743('0x17'),_0xa743('0x18'),_0xa743('0x19'),'pauseType',_0xa743('0x1a'),_0xa743('0x1b'),_0xa743('0x1c'),_0xa743('0x1d'),_0xa743('0x1e'),_0xa743('0x1f'),'alias','phoneBarAutoAnswer',_0xa743('0x20'),'phoneBarDnd',_0xa743('0x21'),'phoneBarEnableDtmfTone',_0xa743('0x22'),'phoneBarExpires',_0xa743('0x23'),_0xa743('0x24'),'phoneBarRemoteControlPort',_0xa743('0x25'),'interface',_0xa743('0x26'),_0xa743('0x27'),_0xa743('0x28'),'wssPort',_0xa743('0x29'),'downloadOmnichannelInteractions',_0xa743('0x2a'),_0xa743('0x2b'),_0xa743('0x2c'),_0xa743('0x2d'),'chatAutoanswerDelay',_0xa743('0x2e'),_0xa743('0x2f'),'smsAutoanswer',_0xa743('0x30'),_0xa743('0x31'),_0xa743('0x32'),_0xa743('0x33'),_0xa743('0x34'),_0xa743('0x35'),_0xa743('0x36'),_0xa743('0x37')];exports['isChatInteractionAuthorized']=function(){return this[_0xa743('0x38')](!![])[_0xa743('0x39')](function(_0x3feba4,_0x3f4223,_0xde984){if(_0x3feba4[_0xa743('0x3a')]){_0xde984();}else{return db['ChatInteraction'][_0xa743('0x3b')]({'where':{'id':_0x3feba4[_0xa743('0x3c')]['id']},'attributes':['id','closed',_0xa743('0x3d')],'raw':!![]})[_0xa743('0x3e')](function(_0x2a33fe){if(_0x2a33fe&&_0x2a33fe[_0xa743('0x3f')]&&!_0x3feba4[_0xa743('0x40')][_0xa743('0x41')]){return _0x3f4223['status'](_0x2a33fe['disposition']===_0xa743('0x42')?0x195:0x193)[_0xa743('0x43')]({'message':_0x2a33fe['disposition']===_0xa743('0x42')?_0xa743('0x44'):_0xa743('0x45')});}else{_0xde984();}})[_0xa743('0x46')](function(_0x1a315c){_0xde984(_0x1a315c);});}});};exports['isAuthenticated']=function isAuthenticated(_0x2aacb4){return compose()[_0xa743('0x39')](function(_0x439659,_0x5370de,_0x16e238){var _0x54b9aa;if(_0x439659['headers']['authorization']){if(_[_0xa743('0x47')](_0x439659[_0xa743('0x48')][_0xa743('0x49')],'Basic')){var _0x36b04a=basicAuth(_0x439659);db[_0xa743('0x4a')][_0xa743('0x4b')]({'where':{'name':_0x36b04a[_0xa743('0xf')]}})[_0xa743('0x3e')](function(_0x12b450){if(!_0x12b450||!_0x12b450['authenticate'](_0x36b04a[_0xa743('0x4c')])){return _0x5370de[_0xa743('0x4d')](0x191)[_0xa743('0x43')]({'message':'Wrong\x20credentials.'});}_0x439659[_0xa743('0x3a')]={'id':_0x12b450['id']};_0x16e238();})[_0xa743('0x46')](function(_0x501266){_0x16e238(_0x501266);});}else if(_[_0xa743('0x47')](_0x439659[_0xa743('0x48')][_0xa743('0x49')],_0xa743('0x4e'))){validateJwt(_0x439659,_0x5370de,_0x16e238);}else{if(_0x2aacb4){_0x16e238();}else{return _0x5370de[_0xa743('0x4d')](0x193)['json']({'message':_0xa743('0x4f')});}}}else if(_0x439659[_0xa743('0x40')][_0xa743('0x50')]){try{var _0x13921d={'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0xa743('0x51')]()};verifyJwt(_0x439659[_0xa743('0x40')][_0xa743('0x50')],_0x13921d)[_0xa743('0x3e')](function(_0xc797fd){return db[_0xa743('0x4a')][_0xa743('0x4b')]({'where':{'id':_0xc797fd['sub']}})['then'](function(_0xa7621){_0x54b9aa=_0xa7621;return db[_0xa743('0x52')][_0xa743('0x3b')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0xa743('0x53')],'raw':!![]});})[_0xa743('0x3e')](function(_0x55b0ae){if(!_0x54b9aa||!_[_0xa743('0x54')](_0x54b9aa['apiKeyNonce'],_0xc797fd['nonce'])){return _0x5370de[_0xa743('0x4d')](0x191)[_0xa743('0x43')]({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}if(_0x54b9aa[_0xa743('0x55')]){return _0x5370de[_0xa743('0x4d')](0x191)['json']({'message':_0xa743('0x56')});}if(_0x54b9aa[_0xa743('0x57')]){if(_0x55b0ae['blockDuration']>0x0){if(moment(_0x54b9aa[_0xa743('0x58')])[_0xa743('0x59')](_0x55b0ae['blockDuration'],_0xa743('0x5a'))>moment()){return _0x5370de[_0xa743('0x4d')](0x191)[_0xa743('0x43')]({'message':_0xa743('0x56')});}}else{return _0x5370de[_0xa743('0x4d')](0x191)['json']({'message':_0xa743('0x56')});}}_0x439659[_0xa743('0x3a')]={'id':_0x54b9aa['id']};_0x16e238();});})[_0xa743('0x46')](function(){return _0x5370de[_0xa743('0x4d')](0x191)['json']({'message':_0xa743('0x56')});});}catch(_0x439941){_0x16e238(_0x439941);}}else if(_0x2aacb4){_0x16e238();}else{return _0x5370de[_0xa743('0x4d')](0x193)[_0xa743('0x43')]({'message':_0xa743('0x4f')});}})[_0xa743('0x39')](function(_0x4ba7ee,_0x457f37,_0xf02186){if(_0x4ba7ee[_0xa743('0x3a')]){db[_0xa743('0x4a')]['find']({'where':{'id':_0x4ba7ee[_0xa743('0x3a')]['id']},'attributes':userAttributes})[_0xa743('0x3e')](function(_0x285fa4){if(!_0x285fa4){return _0x457f37[_0xa743('0x4d')](0x194)[_0xa743('0x43')]({'message':_0xa743('0x5b')});}_0x4ba7ee[_0xa743('0x3a')]=_0x285fa4;_0xf02186();})[_0xa743('0x46')](function(_0x27ca6b){_0xf02186(_0x27ca6b);});}else if(_0x2aacb4){_0xf02186();}else{return _0x457f37[_0xa743('0x4d')](0x194)[_0xa743('0x43')]({'message':_0xa743('0x5c')});}});};exports[_0xa743('0x5d')]=function canUpdate(){return compose()[_0xa743('0x39')](function(_0x43fd06,_0x39d6d4,_0x3b79b4){return licenseUtil[_0xa743('0x5e')]()[_0xa743('0x3e')](function(_0x3f9d15){if(_0x3f9d15[_0xa743('0x5f')]){_0x3b79b4();}else{return _0x39d6d4[_0xa743('0x4d')](0x193)[_0xa743('0x43')]({'message':_0xa743('0x60')});}})[_0xa743('0x46')](function(_0x558071){_0x3b79b4(_0x558071);});});};exports[_0xa743('0x61')]=function isWebrtcLicence(){return compose()[_0xa743('0x39')](function(_0x3d3063,_0x463ea5,_0xa2121a){return licenseUtil[_0xa743('0x5e')]()['then'](function(_0x41fcee){if(_0x41fcee[_0xa743('0x62')]){_0xa2121a();}else{return _0x463ea5[_0xa743('0x4d')](0x193)[_0xa743('0x43')]({'message':_0xa743('0x60')});}})['catch'](function(_0x4317e1){_0xa2121a(_0x4317e1);});});};exports[_0xa743('0x63')]=function(_0x44521b,_0x451652,_0x16f740){_0x44521b[_0xa743('0x63')]=!![];return _0x16f740();};exports['signToken']=function signToken(_0x363018){return signJwt(_0x363018);};exports[_0xa743('0x64')]=function(_0xb947f,_0xdd8fd5){if(!_0xb947f[_0xa743('0x3a')]){return _0xdd8fd5[_0xa743('0x4d')](0x194)['json']({'message':_0xa743('0x65')});}var _0x3a8652={'payload':{'id':_0xb947f['user']['id'],'role':_0xb947f['user'][_0xa743('0xd')]},'options':{'expiresIn':0x15180}};return signJwt(_0x3a8652)[_0xa743('0x3e')](function(_0x35db89){_0xdd8fd5[_0xa743('0x66')](_0xa743('0x67'),_0x35db89);_0xdd8fd5[_0xa743('0x68')](_0xa743('0x69'));})['catch'](function(_0x13e87e){return _0xdd8fd5[_0xa743('0x4d')](0x1f4)['send'](_0x13e87e);});};exports[_0xa743('0x6a')]=function(_0x16a323){if(_[_0xa743('0x6b')](_0x16a323['apiKeyNonce'])||_['isNil'](_0x16a323[_0xa743('0x6c')])){return null;}else{return createJwt(_0x16a323);}};exports[_0xa743('0x6d')]=function(_0xd47c62){_0xd47c62[_0xa743('0x6e')]=generateNonce();_0xd47c62[_0xa743('0x6c')]=generateIssuedAt();return createJwt(_0xd47c62);};exports[_0xa743('0x6f')]=function(_0xb80e14,_0x5eabdf){var _0x145042=_0xb80e14[_0xa743('0x40')][_0xa743('0x50')];if(_0x145042){var _0x26f087={'nonce':_0x5eabdf[_0xa743('0x6e')],'iat':_0x5eabdf[_0xa743('0x6c')],'audience':hardwareConf[_0xa743('0x51')](),'issuer':hardwareConf[_0xa743('0x51')]()};return verifyJwt(_0x145042,_0x26f087)[_0xa743('0x3e')](function(){return generateApiKey(_0x5eabdf);});}else{throw{'message':_0xa743('0x70')};}};exports[_0xa743('0x71')]=function(_0x5302ca){var _0x3e2b8e=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x3e2b8e[_0xa743('0x72')](_0x5302ca))throw new db['Sequelize']['ValidationError']('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');return;};exports[_0xa743('0x73')]=function(_0x355822,_0x472a9,_0x54f402){var _0x56e06e=encryptor[_0xa743('0x74')](_0x472a9)[_0xa743('0x75')](',');for(var _0xa83eb4=0x0;_0xa83eb4<_0x54f402;_0xa83eb4++){if(!_0x56e06e[_0xa83eb4])break;if(_0x355822[_0xa743('0x76')]()===_0x56e06e[_0xa83eb4][_0xa743('0x76')]()){var _0x11e36f=util[_0xa743('0x77')]('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0x54f402);if(_0x54f402===0x1){_0x11e36f=_0xa743('0x78');}throw new db[(_0xa743('0x79'))][(_0xa743('0x7a'))](_0x11e36f);}}return;};exports[_0xa743('0x7b')]=function(_0x4d4a4b,_0x293ceb){var _0x5a9aee=_0x293ceb?encryptor[_0xa743('0x74')](_0x293ceb)[_0xa743('0x75')](','):[];if(_0x5a9aee[_0xa743('0x7c')]===0x5){_0x5a9aee[_0xa743('0x7d')](-0x1,0x1);}_0x5a9aee[_0xa743('0x7e')](_0x4d4a4b);return encryptor['encryptString'](_0x5a9aee[_0xa743('0x7f')](','));};function signJwt(_0x5369a4){var _0x1a5213=BPromise[_0xa743('0x80')](jwt[_0xa743('0x81')],{'context':jwt});var _0x112dbe=_0x5369a4[_0xa743('0x82')]||config[_0xa743('0xb')][_0xa743('0xc')];return new BPromise(function(_0x1b0174,_0x3dd5c8){_0x1a5213(_0x5369a4[_0xa743('0x83')],_0x112dbe,_0x5369a4['options'])[_0xa743('0x3e')](function(_0x2d3fc8){_0x1b0174(_0x2d3fc8);})[_0xa743('0x46')](function(_0x5daa52){_0x3dd5c8(_0x5daa52);});});}function verifyJwt(_0x4d3400,_0x43a3fd,_0x26d0e5){var _0x4f9c77=BPromise[_0xa743('0x80')](jwt[_0xa743('0x84')],{'context':jwt});var _0x4d8575=_0x26d0e5||config['secrets']['session'];return new BPromise(function(_0x24eca7,_0x1a39ed){_0x4f9c77(_0x4d3400,_0x4d8575,_0x43a3fd)[_0xa743('0x3e')](function(_0x1d72c8){_0x24eca7(_0x1d72c8);})[_0xa743('0x46')](function(_0x2cc20c){_0x1a39ed(_0x2cc20c);});});}function generateNonce(){return crypto['randomBytes'](0x10)[_0xa743('0x85')](_0xa743('0x86'));}function generateIssuedAt(){return Math['floor'](Date[_0xa743('0x87')]()/0x3e8)[_0xa743('0x85')]();}function createJwt(_0x9a23f5){var _0x389892={'payload':{'iat':_0x9a23f5['apiKeyIat'],'nonce':_0x9a23f5[_0xa743('0x6e')]},'options':{'algorithm':_0xa743('0x88'),'subject':_0x9a23f5['id'][_0xa743('0x85')](),'issuer':hardwareConf[_0xa743('0x51')](),'audience':hardwareConf['getUuid']()}};return signJwt(_0x389892)[_0xa743('0x3e')](function(_0x1adf7a){return{'iat':_0x9a23f5[_0xa743('0x6c')],'nonce':_0x9a23f5[_0xa743('0x6e')],'token':_0x1adf7a};});} \ No newline at end of file diff --git a/server/components/contacts/index.js b/server/components/contacts/index.js index f8336f1..c684411 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 _0xd96b=['fields','filter','clause','tags','user','skip','checkListsRestrictions','ids','countFilteredContacts','count','User','buildContactsQuery','getFilteredContacts','rows','catch','describe','CmContact','keys','startsWith','cf_','map','CmCustomField','findOne','all','length','fieldType','type','lodash','../../mysqldb','findAll','skipContactsQuery','resolve','getContactsSubquery','then','search','parseAdvancedSearchFilter','where','default'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd96b,0x67));var _0xbd96=function(_0x31e5bf,_0x3d8b97){_0x31e5bf=_0x31e5bf-0x0;var _0x5a32d1=_0xd96b[_0x31e5bf];return _0x5a32d1;};'use strict';var _=require(_0xbd96('0x0'));var sqlUtils=require('./sql-utils');var db=require(_0xbd96('0x1'))['db'];exports[_0xbd96('0x2')]=function(_0x167355,_0x171f40,_0x356974,_0x479d39){var _0x53e132={'count':0x0,'rows':[]};var _0x37a8a3=sqlUtils[_0xbd96('0x3')](_0x171f40,_0x167355);if(_0x37a8a3){return Promise[_0xbd96('0x4')](_0x53e132);}var _0xe39154=sqlUtils[_0xbd96('0x5')]();var _0x154a38={};var _0x2f9bab=![];var _0x4da6db=![];return Promise[_0xbd96('0x4')]()[_0xbd96('0x6')](function(){if(_0x167355[_0xbd96('0x7')]){return sqlUtils[_0xbd96('0x8')](_0x167355[_0xbd96('0x7')],_0x479d39);}else{return sqlUtils['parseQueryParameters'](_0x167355,_0x479d39);}})['then'](function(_0x41d3d7){_0xe39154[_0xbd96('0x9')](_0x41d3d7[_0xbd96('0xa')]);_0xe39154[_0xbd96('0x9')](_0x41d3d7[_0xbd96('0xb')]);_0xe39154[_0xbd96('0x9')](_0x41d3d7[_0xbd96('0xc')]);_0xe39154[_0xbd96('0x9')](_0x41d3d7['user'][_0xbd96('0xd')]);_0x154a38=_0x41d3d7[_0xbd96('0xe')];_0x4da6db=_0x41d3d7[_0xbd96('0xf')][_0xbd96('0x10')];return sqlUtils[_0xbd96('0x11')](_0x171f40,_0x167355,_0x4da6db);})[_0xbd96('0x6')](function(_0x310948){_0xe39154[_0xbd96('0x9')](_0x310948);var _0x1c3d5a=_0x167355[_0xbd96('0x7')]?_0x154a38[_0xbd96('0x12')]:_0x167355['tag'];_0x2f9bab=_0x1c3d5a?!![]:![];return sqlUtils[_0xbd96('0x13')](_0xe39154,_0x1c3d5a);})['then'](function(_0x1a0cfd){_0x53e132[_0xbd96('0x14')]=_0x1a0cfd;if(_0x53e132[_0xbd96('0x14')]===0x0){return;}if(_0x167355[_0xbd96('0x15')]){_0x4da6db=!![];}return sqlUtils[_0xbd96('0x16')](_0xe39154,_0x167355[_0xbd96('0xb')],_0x356974,_0x2f9bab,_0x154a38[_0xbd96('0xd')],_0x4da6db);})[_0xbd96('0x6')](function(_0x2fad9b){if(!_0x2fad9b){return[];}return sqlUtils[_0xbd96('0x17')](_0x2fad9b,_0x167355,_0x356974);})[_0xbd96('0x6')](function(_0x595055){_0x53e132[_0xbd96('0x18')]=_0x595055;return _0x53e132;})[_0xbd96('0x19')](function(_0x205b2e){throw _0x205b2e;});};exports[_0xbd96('0x1a')]=function(){var _0x3206ed={};var _0xab5f6b=[];return db[_0xbd96('0x1b')]['describe']()[_0xbd96('0x6')](function(_0x1fb35e){_0x3206ed=_0x1fb35e;var _0x458778=Object[_0xbd96('0x1c')](_0x3206ed)['filter'](function(_0x1ddc98){return _[_0xbd96('0x1d')](_0x1ddc98,_0xbd96('0x1e'))?_0x1ddc98:undefined;});var _0x3e32b1=_0x458778[_0xbd96('0x1f')](function(_0x1c70e2){return db[_0xbd96('0x20')][_0xbd96('0x21')]({'where':{'id':_0x1c70e2['slice'](0x3)},'raw':!![]});});return Promise[_0xbd96('0x22')](_0x3e32b1);})[_0xbd96('0x6')](function(_0x2d26cd){for(var _0x519f46=0x0;_0x519f46<_0x2d26cd[_0xbd96('0x23')];_0x519f46++){if(_0x2d26cd[_0x519f46]){var _0x23bae1=_0xbd96('0x1e')+_0x2d26cd[_0x519f46]['id'];_0x3206ed[_0x23bae1][_0xbd96('0x24')]=_0x2d26cd[_0x519f46][_0xbd96('0x25')];}}_0xab5f6b=_[_0xbd96('0x1f')](Object[_0xbd96('0x1c')](_0x3206ed),function(_0x42a3ab){return{'name':_0x42a3ab,'type':_0x3206ed[_0x42a3ab][_0xbd96('0x25')]};});return _0xab5f6b;})[_0xbd96('0x19')](function(_0x33ddcb){throw _0x33ddcb;});}; \ No newline at end of file +var _0xbe50=['default','fields','filter','user','clause','tags','ids','tag','countFilteredContacts','User','rows','describe','CmContact','keys','startsWith','cf_','map','CmCustomField','findOne','slice','all','fieldType','type','catch','lodash','./sql-utils','skipContactsQuery','resolve','getContactsSubquery','then','search','parseAdvancedSearchFilter','parseQueryParameters','where'];(function(_0x2c4511,_0x1ba92d){var _0x2868c6=function(_0x56e45c){while(--_0x56e45c){_0x2c4511['push'](_0x2c4511['shift']());}};_0x2868c6(++_0x1ba92d);}(_0xbe50,0x106));var _0x0be5=function(_0x11daf2,_0x294aba){_0x11daf2=_0x11daf2-0x0;var _0xf9068d=_0xbe50[_0x11daf2];return _0xf9068d;};'use strict';var _=require(_0x0be5('0x0'));var sqlUtils=require(_0x0be5('0x1'));var db=require('../../mysqldb')['db'];exports['findAll']=function(_0x5ae268,_0x5f3fb2,_0x4ee017,_0x4b3b16){var _0x47ec94={'count':0x0,'rows':[]};var _0xa128ac=sqlUtils[_0x0be5('0x2')](_0x5f3fb2,_0x5ae268);if(_0xa128ac){return Promise[_0x0be5('0x3')](_0x47ec94);}var _0x7e3a1d=sqlUtils[_0x0be5('0x4')]();var _0x307191={};var _0x13016b=![];var _0x25d1b7=![];return Promise[_0x0be5('0x3')]()[_0x0be5('0x5')](function(){if(_0x5ae268[_0x0be5('0x6')]){return sqlUtils[_0x0be5('0x7')](_0x5ae268['search'],_0x4b3b16);}else{return sqlUtils[_0x0be5('0x8')](_0x5ae268,_0x4b3b16);}})[_0x0be5('0x5')](function(_0x2e4cc7){_0x7e3a1d[_0x0be5('0x9')](_0x2e4cc7[_0x0be5('0xa')]);_0x7e3a1d[_0x0be5('0x9')](_0x2e4cc7[_0x0be5('0xb')]);_0x7e3a1d['where'](_0x2e4cc7[_0x0be5('0xc')]);_0x7e3a1d[_0x0be5('0x9')](_0x2e4cc7[_0x0be5('0xd')][_0x0be5('0xe')]);_0x307191=_0x2e4cc7[_0x0be5('0xf')];_0x25d1b7=_0x2e4cc7['user']['skip'];return sqlUtils['checkListsRestrictions'](_0x5f3fb2,_0x5ae268,_0x25d1b7);})[_0x0be5('0x5')](function(_0x455d02){_0x7e3a1d['where'](_0x455d02);var _0xb7a157=_0x5ae268[_0x0be5('0x6')]?_0x307191[_0x0be5('0x10')]:_0x5ae268[_0x0be5('0x11')];_0x13016b=_0xb7a157?!![]:![];return sqlUtils[_0x0be5('0x12')](_0x7e3a1d,_0xb7a157);})[_0x0be5('0x5')](function(_0x2757f8){_0x47ec94['count']=_0x2757f8;if(_0x47ec94['count']===0x0){return;}if(_0x5ae268[_0x0be5('0x13')]){_0x25d1b7=!![];}return sqlUtils['buildContactsQuery'](_0x7e3a1d,_0x5ae268[_0x0be5('0xb')],_0x4ee017,_0x13016b,_0x307191[_0x0be5('0xe')],_0x25d1b7);})[_0x0be5('0x5')](function(_0x62d5f1){if(!_0x62d5f1){return[];}return sqlUtils['getFilteredContacts'](_0x62d5f1,_0x5ae268,_0x4ee017);})[_0x0be5('0x5')](function(_0x360f6b){_0x47ec94[_0x0be5('0x14')]=_0x360f6b;return _0x47ec94;})['catch'](function(_0x3dc5ca){throw _0x3dc5ca;});};exports[_0x0be5('0x15')]=function(){var _0x4dd1ae={};var _0x193c8d=[];return db[_0x0be5('0x16')][_0x0be5('0x15')]()['then'](function(_0x540980){_0x4dd1ae=_0x540980;var _0x446aa5=Object[_0x0be5('0x17')](_0x4dd1ae)[_0x0be5('0xc')](function(_0x2fee5b){return _[_0x0be5('0x18')](_0x2fee5b,_0x0be5('0x19'))?_0x2fee5b:undefined;});var _0xc1ccdb=_0x446aa5[_0x0be5('0x1a')](function(_0x39d1d6){return db[_0x0be5('0x1b')][_0x0be5('0x1c')]({'where':{'id':_0x39d1d6[_0x0be5('0x1d')](0x3)},'raw':!![]});});return Promise[_0x0be5('0x1e')](_0xc1ccdb);})['then'](function(_0x3c7ca6){for(var _0x2e020e=0x0;_0x2e020e<_0x3c7ca6['length'];_0x2e020e++){if(_0x3c7ca6[_0x2e020e]){var _0x32b203=_0x0be5('0x19')+_0x3c7ca6[_0x2e020e]['id'];_0x4dd1ae[_0x32b203][_0x0be5('0x1f')]=_0x3c7ca6[_0x2e020e][_0x0be5('0x20')];}}_0x193c8d=_[_0x0be5('0x1a')](Object[_0x0be5('0x17')](_0x4dd1ae),function(_0x5169d8){return{'name':_0x5169d8,'type':_0x4dd1ae[_0x5169d8][_0x0be5('0x20')]};});return _0x193c8d;})[_0x0be5('0x21')](function(_0x3fdd6a){throw _0x3fdd6a;});}; \ No newline at end of file diff --git a/server/components/contacts/sql-utils.js b/server/components/contacts/sql-utils.js index d274826..63b04df 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 _0x5171=['../interaction/utils','../../mysqldb','role','agent','search','ListId','true','cm_contacts','c.deletedAt\x20IS\x20NULL','subqry','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20','.id','tools_tags','firstName','lastName','mobile','fax','CompanyId','createdAt','updatedAt','deletedAt','includes','push','field','GROUP_CONCAT(DISTINCT\x20t.id)','expr','getSelectedTags','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','split','length','getFullTextValue','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','parseSearch','conditions','find','name','dateOfBirth','fieldType','buildExpression','type','default','text','start','value','end','map','and','tags','User','user','clause','uc.UserId\x20=\x20?','skip','some','compact','Contact','forEach','c.ListId\x20IN\x20?','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','resolve','then','fields','filter','getLists','c.ListId\x20IS\x20NULL','attributes','select','group','c.id','limit','offset','having','order','DESC','subqry.','findAll','color','keyBy','QueryTypes','SELECT','CmContact','sequelize','query','toString','TagIds','Tags','clone','COUNT(*)','isEmpty','t.id\x20IN\x20?','Sequelize','exports','lodash','squel','../parsers/advancedSearch','../parsers/qs'];(function(_0x161c51,_0x2d6bb3){var _0x7c222d=function(_0x1dce53){while(--_0x1dce53){_0x161c51['push'](_0x161c51['shift']());}};_0x7c222d(++_0x2d6bb3);}(_0x5171,0x1a4));var _0x1517=function(_0x2d34d6,_0x397ff9){_0x2d34d6=_0x2d34d6-0x0;var _0x1d3d12=_0x5171[_0x2d34d6];return _0x1d3d12;};'use strict';var _=require(_0x1517('0x0'));var squel=require(_0x1517('0x1'));var as=require(_0x1517('0x2'));var qs=require(_0x1517('0x3'));var utils=require(_0x1517('0x4'));var db=require(_0x1517('0x5'))['db'];function skipContactsQuery(_0x5cc5cb,_0x2bef31){var _0x24bd94=![];if(_0x5cc5cb[_0x1517('0x6')]===_0x1517('0x7')&&!_0x2bef31[_0x1517('0x8')]&&!_0x2bef31[_0x1517('0x9')]&&_0x2bef31['autocomplete']!==_0x1517('0xa')){_0x24bd94=!![];}return _0x24bd94;}function getContactsSubquery(){return squel['select']()['from'](_0x1517('0xb'),'c')['where'](_0x1517('0xc'));}function applyJoinClauses(_0x3f34e0,_0x462f9d){var _0x5464c8=_0x462f9d?'c':_0x1517('0xd');_0x3f34e0[_0x1517('0xe')](_0x1517('0xf'),'uc',_0x1517('0x10')+_0x5464c8+_0x1517('0x11'))['left_join']('cm_contact_has_tags','ct','ct.CmContactId\x20=\x20'+_0x5464c8+_0x1517('0x11'))[_0x1517('0xe')](_0x1517('0x12'),'t','t.id\x20=\x20ct.TagId');return _0x3f34e0;}function addFieldsToQuery(_0x45c767,_0x1c3846,_0x1d2f86,_0x12dcc3,_0x4673){var _0x410bb9=_0x4673?'c':'subqry';if(!_0x1c3846){_0x1c3846=['id',_0x1517('0x13'),_0x1517('0x14'),'phone',_0x1517('0x15'),_0x1517('0x16'),'email',_0x1517('0x9'),_0x1517('0x17'),_0x1517('0x18'),_0x1517('0x19'),_0x1517('0x1a'),'TagIds'];}else if(!_0x1c3846[_0x1517('0x1b')]('id')){_0x1c3846[_0x1517('0x1c')]('id');}var _0x1a6607=_0x1d2f86&&_0x4673||!_0x1d2f86&&!_0x4673;if(_0x12dcc3){_0x1a6607=_0x12dcc3&&_0x4673||!_0x12dcc3&&!_0x4673;}_0x1c3846['forEach'](function(_0x59acc9){if(_0x59acc9==='TagIds'){if(_0x1a6607){_0x45c767[_0x1517('0x1d')](_0x1517('0x1e'),_0x59acc9);}else if(_0x1d2f86||_0x12dcc3){_0x45c767[_0x1517('0x1d')](_0x410bb9+'.'+_0x59acc9);}}else{_0x45c767['field'](_0x410bb9+'.'+_0x59acc9);}});return _0x45c767;}function getSqlClauses(){var _0x5bebf4={'default':squel[_0x1517('0x1f')](),'fields':squel[_0x1517('0x1f')](),'filter':squel[_0x1517('0x1f')](),'tags':{'clause':squel[_0x1517('0x1f')](),'ids':null},'user':{'clause':squel['expr'](),'skip':![]}};return _0x5bebf4;}function parseTagParameter(_0x3a5beb){var _0x180923=squel[_0x1517('0x1f')]();if(_0x3a5beb){var _0x1ea2bb=utils[_0x1517('0x20')](_0x3a5beb);_0x1ea2bb['forEach'](function(_0x202adb){_0x180923['or'](_0x1517('0x21'),'%,'+_0x202adb+',%');});}return _0x180923;}function parseSearchFilter(_0x5bd057){var _0x1232b9=squel[_0x1517('0x1f')]();if(_0x5bd057){var _0x7bff05=_0x5bd057[_0x1517('0x22')]('\x5c','\x5c\x5c')[_0x1517('0x22')](/'/g,'\x27\x27');var _0x3f4b39=qs['escapeLIKESpecialChars'](_0x7bff05);if(_0x7bff05[_0x1517('0x23')]('\x20')[_0x1517('0x24')]>0x1){_0x1232b9['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x1517('0x25')](_0x7bff05,!![]),null);}else{if(qs['isNumeric'](_0x7bff05)){_0x1232b9['or'](_0x1517('0x26'),_0x3f4b39+'%');_0x1232b9['or'](_0x1517('0x27'),_0x3f4b39+'%');_0x1232b9['or'](_0x1517('0x28'),_0x3f4b39+'%');_0x1232b9['or'](_0x1517('0x29'),_0x3f4b39+'%');}else if(qs[_0x1517('0x2a')](_0x7bff05)){_0x1232b9['or'](_0x1517('0x2b'),_0x3f4b39+'%');}else{_0x1232b9['or'](_0x1517('0x2c'),'%'+_0x3f4b39+'%');_0x1232b9['or']('c.lastName\x20LIKE\x20?','%'+_0x3f4b39+'%');_0x1232b9['or'](_0x1517('0x2b'),'%'+_0x3f4b39+'%');}}}return _0x1232b9;}function parseAdvancedSearchFilter(_0x582881,_0xdf99aa){var _0x280978=getSqlClauses();var _0x9ef275=as[_0x1517('0x2d')](_0x582881);var _0x5584ad=_0x9ef275['sqlOperator'];for(var _0x50e1b5=0x0;_0x50e1b5<_0x9ef275[_0x1517('0x2e')][_0x1517('0x24')];_0x50e1b5++){var _0x2e4309=_0x9ef275[_0x1517('0x2e')][_0x50e1b5];var _0x2b4c31='c';var _0x1f8cc7=_[_0x1517('0x2f')](_0xdf99aa,[_0x1517('0x30'),_0x2e4309[_0x1517('0x1d')]]);if(_0x1f8cc7){if(_0x2e4309['field']===_0x1517('0x31')||_0x1f8cc7[_0x1517('0x32')]==='datetime'){_0x2e4309['castTo']='DATE';}var _0x44ddcd=as[_0x1517('0x33')](_0x2b4c31,_0x1f8cc7[_0x1517('0x34')],_0x2e4309);_0x280978[_0x1517('0x35')][_0x5584ad](_0x44ddcd[_0x1517('0x36')],_0x44ddcd['value'][_0x1517('0x37')],_0x44ddcd[_0x1517('0x38')][_0x1517('0x39')]);}else{if(_0x2e4309[_0x1517('0x1d')]==='Tag'){var _0x6189f0=_0x2e4309[_0x1517('0x38')][_0x1517('0x23')](',')[_0x1517('0x3a')](function(_0x59e718){return Number(_0x59e718);});var _0x343ad5=parseTagParameter(_0x6189f0);_0x280978['tags']['clause'][_0x1517('0x3b')](_0x343ad5);_0x280978[_0x1517('0x3c')]['ids']=_0x6189f0;}else if(_0x2e4309[_0x1517('0x1d')]===_0x1517('0x3d')){_0x280978[_0x1517('0x3e')][_0x1517('0x3f')][_0x1517('0x3b')](_0x1517('0x40'),_0x2e4309[_0x1517('0x38')]);_0x280978[_0x1517('0x3e')][_0x1517('0x41')]=!![];}}}return _0x280978;}function parseModelFields(_0x5e9146,_0x14ce78){var _0x21f5a5=squel[_0x1517('0x1f')]();var _0x151d13=_(_0x5e9146)['keys']()[_0x1517('0x3a')](function(_0x14d5db){return _[_0x1517('0x42')](_0x14ce78,[_0x1517('0x30'),_0x14d5db])?_0x14d5db:undefined;})[_0x1517('0x43')]()[_0x1517('0x38')]();if(_0x5e9146['Contact']){_0x151d13[_0x1517('0x1c')](_0x1517('0x44'));}if(_0x5e9146[_0x1517('0x3d')]){_0x151d13[_0x1517('0x1c')](_0x1517('0x3d'));}if(_0x151d13[_0x1517('0x24')]>0x0){_0x151d13[_0x1517('0x45')](function(_0x30c867){if(_0x30c867===_0x1517('0x9')){_0x21f5a5[_0x1517('0x3b')](_0x1517('0x46'),[]['concat'](_0x5e9146[_0x30c867]));}else if(_0x30c867===_0x1517('0x44')){var _0x4e8ce8='%'+_0x5e9146[_0x30c867]+'%';_0x21f5a5['and'](_0x1517('0x47'),_0x4e8ce8);}else if(_0x30c867===_0x1517('0x3d')){_0x21f5a5[_0x1517('0x3b')]('uc.UserId\x20=\x20?',_0x5e9146[_0x30c867]);}else{_0x21f5a5['and']('c.'+_0x30c867+_0x1517('0x48'),_0x5e9146[_0x30c867]);}});}return _0x21f5a5;}function parseQueryParameters(_0x2ac577,_0x5199e0){var _0x2d97f0=getSqlClauses();return Promise[_0x1517('0x49')]()[_0x1517('0x4a')](function(){return parseModelFields(_0x2ac577,_0x5199e0);})[_0x1517('0x4a')](function(_0x385ba2){_0x2d97f0[_0x1517('0x4b')]['and'](_0x385ba2);return parseTagParameter(_0x2ac577['tag']);})[_0x1517('0x4a')](function(_0x4d81bc){_0x2d97f0['tags'][_0x1517('0x3f')][_0x1517('0x3b')](_0x4d81bc);return parseSearchFilter(_0x2ac577[_0x1517('0x4c')]);})['then'](function(_0x51de8f){_0x2d97f0[_0x1517('0x4c')]=_0x51de8f;return _0x2d97f0;});}function checkListsRestrictions(_0x1bce2d,_0x3d09ae,_0x1695b6){var _0x3a1f74=squel[_0x1517('0x1f')]();return Promise[_0x1517('0x49')]()['then'](function(){if(_0x3d09ae[_0x1517('0x8')]&&_0x1bce2d[_0x1517('0x6')]===_0x1517('0x7')&&!_0x1695b6){return _0x1bce2d[_0x1517('0x4d')]({'attributes':['id'],'raw':!![]});}})[_0x1517('0x4a')](function(_0x3bc4cf){if(_0x3bc4cf){if(_0x3bc4cf['length']===0x0){_0x3a1f74[_0x1517('0x3b')](_0x1517('0x4e'));}else{_0x3a1f74[_0x1517('0x3b')]('c.ListId\x20IN\x20?',_[_0x1517('0x3a')](_0x3bc4cf,'id'));}}})[_0x1517('0x4a')](function(){return _0x3a1f74;});}function buildContactsQuery(_0x1e3509,_0x39c1e7,_0x19a773,_0x2fffb1,_0x367316,_0x82af01){if(_0x39c1e7){_0x39c1e7=_0x19a773[_0x1517('0x4f')];}_0x1e3509=addFieldsToQuery(_0x1e3509,_0x39c1e7,_0x2fffb1,_0x82af01,!![]);var _0x189330=squel[_0x1517('0x50')]();_0x189330=addFieldsToQuery(_0x189330,_0x39c1e7,_0x2fffb1,_0x82af01,![]);if(_0x2fffb1||_0x82af01){_0x1e3509=applyJoinClauses(_0x1e3509,!![]);_0x1e3509[_0x1517('0x51')](_0x1517('0x52'));if(_0x19a773[_0x1517('0x53')]){_0x189330[_0x1517('0x53')](_0x19a773[_0x1517('0x53')]);}if(_0x19a773[_0x1517('0x54')]){_0x189330[_0x1517('0x54')](_0x19a773[_0x1517('0x54')]);}}else{_0x189330=applyJoinClauses(_0x189330,![]);_0x189330['group']('subqry.id');if(_0x19a773[_0x1517('0x53')]){_0x1e3509[_0x1517('0x53')](_0x19a773['limit']);}if(_0x19a773[_0x1517('0x54')]){_0x1e3509[_0x1517('0x54')](_0x19a773[_0x1517('0x54')]);}}_0x189330[_0x1517('0x55')](_0x367316);if(_0x19a773[_0x1517('0x56')]){_0x19a773[_0x1517('0x56')][_0x1517('0x45')](function(_0x38657c){_0x1e3509[_0x1517('0x56')]('c.'+_0x38657c[0x0],_0x38657c[0x1]===_0x1517('0x57')?![]:!![]);_0x189330[_0x1517('0x56')](_0x1517('0x58')+_0x38657c[0x0],_0x38657c[0x1]===_0x1517('0x57')?![]:!![]);});}_0x189330['from'](_0x1e3509,_0x1517('0xd'));return _0x189330;}function getFilteredContacts(_0x59aedf){var _0x5e2410=[];return db['Tag'][_0x1517('0x59')]({'attributes':['id','name',_0x1517('0x5a')],'raw':!![]})[_0x1517('0x4a')](function(_0x2c1ba0){_0x5e2410=_[_0x1517('0x5b')](_0x2c1ba0,'id');var _0x3f4fa0={'type':db['Sequelize'][_0x1517('0x5c')][_0x1517('0x5d')],'model':db[_0x1517('0x5e')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0x1517('0x5f')][_0x1517('0x60')](_0x59aedf[_0x1517('0x61')](),_0x3f4fa0);})[_0x1517('0x4a')](function(_0x3fddd0){_0x3fddd0['forEach'](function(_0x210f23){if(_0x210f23[_0x1517('0x62')]){_0x210f23[_0x1517('0x63')]=[];_0x210f23[_0x1517('0x62')]['split'](',')[_0x1517('0x45')](function(_0x5d6659){_0x210f23[_0x1517('0x63')][_0x1517('0x1c')](_0x5e2410[_0x5d6659]);});}delete _0x210f23[_0x1517('0x62')];});return _0x3fddd0;});}function countFilteredContacts(_0x32a622,_0x42a290){var _0x568ee4=_0x32a622[_0x1517('0x64')]();_0x568ee4[_0x1517('0x1d')](_0x1517('0x65'));_0x568ee4=applyJoinClauses(_0x568ee4,!![]);_0x32a622[_0x1517('0x51')](_0x1517('0x52'));var _0x43ed55=utils[_0x1517('0x20')](_0x42a290);if(!_[_0x1517('0x66')](_0x43ed55)){_0x568ee4['where'](_0x1517('0x67'),_0x43ed55);}var _0x1f3c71={'type':db[_0x1517('0x68')]['QueryTypes'][_0x1517('0x5d')],'raw':!![]};return db[_0x1517('0x5f')]['query'](_0x568ee4[_0x1517('0x61')](),_0x1f3c71)['then'](function(_0xd3dd5a){return _0xd3dd5a[0x0]['COUNT(*)'];});}module[_0x1517('0x69')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file +var _0xe461=['map','clause','and','ids','User','uc.UserId\x20=\x20?','user','skip','keys','compact','Contact','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','then','fields','tag','tags','filter','search','getLists','c.ListId\x20IS\x20NULL','attributes','group','c.id','limit','offset','subqry.id','having','order','DESC','findAll','color','SELECT','sequelize','query','toString','Tags','clone','COUNT(*)','isEmpty','t.id\x20IN\x20?','QueryTypes','exports','squel','../parsers/advancedSearch','../interaction/utils','../../mysqldb','role','agent','ListId','autocomplete','true','select','from','c.deletedAt\x20IS\x20NULL','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20','.id','cm_contact_has_tags','ct.CmContactId\x20=\x20','t.id\x20=\x20ct.TagId','subqry','lastName','phone','mobile','fax','email','CompanyId','updatedAt','deletedAt','TagIds','includes','push','GROUP_CONCAT(DISTINCT\x20t.id)','field','expr','getSelectedTags','forEach','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','escapeLIKESpecialChars','split','c.id\x20LIKE\x20?','c.mobile\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','parseSearch','sqlOperator','conditions','length','find','name','fieldType','datetime','castTo','DATE','default','text','start','value','end','Tag'];(function(_0x3d253b,_0x54a4d4){var _0x1be55c=function(_0x3ebc9f){while(--_0x3ebc9f){_0x3d253b['push'](_0x3d253b['shift']());}};_0x1be55c(++_0x54a4d4);}(_0xe461,0x101));var _0x1e46=function(_0x288cf6,_0x5adc93){_0x288cf6=_0x288cf6-0x0;var _0x5d5d5c=_0xe461[_0x288cf6];return _0x5d5d5c;};'use strict';var _=require('lodash');var squel=require(_0x1e46('0x0'));var as=require(_0x1e46('0x1'));var qs=require('../parsers/qs');var utils=require(_0x1e46('0x2'));var db=require(_0x1e46('0x3'))['db'];function skipContactsQuery(_0x8d783,_0x93e4ae){var _0x54ce76=![];if(_0x8d783[_0x1e46('0x4')]===_0x1e46('0x5')&&!_0x93e4ae['search']&&!_0x93e4ae[_0x1e46('0x6')]&&_0x93e4ae[_0x1e46('0x7')]!==_0x1e46('0x8')){_0x54ce76=!![];}return _0x54ce76;}function getContactsSubquery(){return squel[_0x1e46('0x9')]()[_0x1e46('0xa')]('cm_contacts','c')['where'](_0x1e46('0xb'));}function applyJoinClauses(_0x1ed9c0,_0x27b54a){var _0x14086a=_0x27b54a?'c':'subqry';_0x1ed9c0[_0x1e46('0xc')](_0x1e46('0xd'),'uc',_0x1e46('0xe')+_0x14086a+_0x1e46('0xf'))['left_join'](_0x1e46('0x10'),'ct',_0x1e46('0x11')+_0x14086a+'.id')[_0x1e46('0xc')]('tools_tags','t',_0x1e46('0x12'));return _0x1ed9c0;}function addFieldsToQuery(_0x2f8d52,_0x32726d,_0x329641,_0x396704,_0x58c49d){var _0x4ff15d=_0x58c49d?'c':_0x1e46('0x13');if(!_0x32726d){_0x32726d=['id','firstName',_0x1e46('0x14'),_0x1e46('0x15'),_0x1e46('0x16'),_0x1e46('0x17'),_0x1e46('0x18'),_0x1e46('0x6'),_0x1e46('0x19'),'createdAt',_0x1e46('0x1a'),_0x1e46('0x1b'),_0x1e46('0x1c')];}else if(!_0x32726d[_0x1e46('0x1d')]('id')){_0x32726d[_0x1e46('0x1e')]('id');}var _0x4f7395=_0x329641&&_0x58c49d||!_0x329641&&!_0x58c49d;if(_0x396704){_0x4f7395=_0x396704&&_0x58c49d||!_0x396704&&!_0x58c49d;}_0x32726d['forEach'](function(_0x4b636a){if(_0x4b636a==='TagIds'){if(_0x4f7395){_0x2f8d52['field'](_0x1e46('0x1f'),_0x4b636a);}else if(_0x329641||_0x396704){_0x2f8d52[_0x1e46('0x20')](_0x4ff15d+'.'+_0x4b636a);}}else{_0x2f8d52['field'](_0x4ff15d+'.'+_0x4b636a);}});return _0x2f8d52;}function getSqlClauses(){var _0x34bfb6={'default':squel['expr'](),'fields':squel['expr'](),'filter':squel[_0x1e46('0x21')](),'tags':{'clause':squel[_0x1e46('0x21')](),'ids':null},'user':{'clause':squel[_0x1e46('0x21')](),'skip':![]}};return _0x34bfb6;}function parseTagParameter(_0x5c0588){var _0x482858=squel[_0x1e46('0x21')]();if(_0x5c0588){var _0x42664d=utils[_0x1e46('0x22')](_0x5c0588);_0x42664d[_0x1e46('0x23')](function(_0x164441){_0x482858['or'](_0x1e46('0x24'),'%,'+_0x164441+',%');});}return _0x482858;}function parseSearchFilter(_0x265a7f){var _0x29ef3f=squel[_0x1e46('0x21')]();if(_0x265a7f){var _0x1eef6d=_0x265a7f[_0x1e46('0x25')]('\x5c','\x5c\x5c')[_0x1e46('0x25')](/'/g,'\x27\x27');var _0x132f90=qs[_0x1e46('0x26')](_0x1eef6d);if(_0x1eef6d[_0x1e46('0x27')]('\x20')['length']>0x1){_0x29ef3f['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x1eef6d,!![]),null);}else{if(qs['isNumeric'](_0x1eef6d)){_0x29ef3f['or'](_0x1e46('0x28'),_0x132f90+'%');_0x29ef3f['or']('c.phone\x20LIKE\x20?',_0x132f90+'%');_0x29ef3f['or'](_0x1e46('0x29'),_0x132f90+'%');_0x29ef3f['or']('c.fax\x20LIKE\x20?',_0x132f90+'%');}else if(qs[_0x1e46('0x2a')](_0x1eef6d)){_0x29ef3f['or'](_0x1e46('0x2b'),_0x132f90+'%');}else{_0x29ef3f['or'](_0x1e46('0x2c'),'%'+_0x132f90+'%');_0x29ef3f['or']('c.lastName\x20LIKE\x20?','%'+_0x132f90+'%');_0x29ef3f['or']('c.email\x20LIKE\x20?','%'+_0x132f90+'%');}}}return _0x29ef3f;}function parseAdvancedSearchFilter(_0x3beb01,_0x54156a){var _0x35bef0=getSqlClauses();var _0x4e8840=as[_0x1e46('0x2d')](_0x3beb01);var _0x5483ac=_0x4e8840[_0x1e46('0x2e')];for(var _0x2e1eb9=0x0;_0x2e1eb9<_0x4e8840[_0x1e46('0x2f')][_0x1e46('0x30')];_0x2e1eb9++){var _0xe7142c=_0x4e8840[_0x1e46('0x2f')][_0x2e1eb9];var _0xc9d0e0='c';var _0x16b2fa=_[_0x1e46('0x31')](_0x54156a,[_0x1e46('0x32'),_0xe7142c[_0x1e46('0x20')]]);if(_0x16b2fa){if(_0xe7142c[_0x1e46('0x20')]==='dateOfBirth'||_0x16b2fa[_0x1e46('0x33')]===_0x1e46('0x34')){_0xe7142c[_0x1e46('0x35')]=_0x1e46('0x36');}var _0x35d11b=as['buildExpression'](_0xc9d0e0,_0x16b2fa['type'],_0xe7142c);_0x35bef0[_0x1e46('0x37')][_0x5483ac](_0x35d11b[_0x1e46('0x38')],_0x35d11b['value'][_0x1e46('0x39')],_0x35d11b[_0x1e46('0x3a')][_0x1e46('0x3b')]);}else{if(_0xe7142c[_0x1e46('0x20')]===_0x1e46('0x3c')){var _0x1d77f8=_0xe7142c[_0x1e46('0x3a')][_0x1e46('0x27')](',')[_0x1e46('0x3d')](function(_0x56f66f){return Number(_0x56f66f);});var _0x30739e=parseTagParameter(_0x1d77f8);_0x35bef0['tags'][_0x1e46('0x3e')][_0x1e46('0x3f')](_0x30739e);_0x35bef0['tags'][_0x1e46('0x40')]=_0x1d77f8;}else if(_0xe7142c['field']===_0x1e46('0x41')){_0x35bef0['user']['clause'][_0x1e46('0x3f')](_0x1e46('0x42'),_0xe7142c[_0x1e46('0x3a')]);_0x35bef0[_0x1e46('0x43')][_0x1e46('0x44')]=!![];}}}return _0x35bef0;}function parseModelFields(_0x6945f7,_0x30f049){var _0xadc8e8=squel['expr']();var _0x2c9981=_(_0x6945f7)[_0x1e46('0x45')]()['map'](function(_0x4c77a5){return _['some'](_0x30f049,[_0x1e46('0x32'),_0x4c77a5])?_0x4c77a5:undefined;})[_0x1e46('0x46')]()[_0x1e46('0x3a')]();if(_0x6945f7[_0x1e46('0x47')]){_0x2c9981[_0x1e46('0x1e')](_0x1e46('0x47'));}if(_0x6945f7['User']){_0x2c9981[_0x1e46('0x1e')](_0x1e46('0x41'));}if(_0x2c9981[_0x1e46('0x30')]>0x0){_0x2c9981[_0x1e46('0x23')](function(_0x218c7b){if(_0x218c7b===_0x1e46('0x6')){_0xadc8e8[_0x1e46('0x3f')](_0x1e46('0x48'),[][_0x1e46('0x49')](_0x6945f7[_0x218c7b]));}else if(_0x218c7b==='Contact'){var _0x239e98='%'+_0x6945f7[_0x218c7b]+'%';_0xadc8e8['and'](_0x1e46('0x4a'),_0x239e98);}else if(_0x218c7b===_0x1e46('0x41')){_0xadc8e8[_0x1e46('0x3f')](_0x1e46('0x42'),_0x6945f7[_0x218c7b]);}else{_0xadc8e8[_0x1e46('0x3f')]('c.'+_0x218c7b+_0x1e46('0x4b'),_0x6945f7[_0x218c7b]);}});}return _0xadc8e8;}function parseQueryParameters(_0x42bc60,_0x167917){var _0x4bbe64=getSqlClauses();return Promise['resolve']()[_0x1e46('0x4c')](function(){return parseModelFields(_0x42bc60,_0x167917);})[_0x1e46('0x4c')](function(_0x3fd07d){_0x4bbe64[_0x1e46('0x4d')][_0x1e46('0x3f')](_0x3fd07d);return parseTagParameter(_0x42bc60[_0x1e46('0x4e')]);})[_0x1e46('0x4c')](function(_0x224f6c){_0x4bbe64[_0x1e46('0x4f')][_0x1e46('0x3e')][_0x1e46('0x3f')](_0x224f6c);return parseSearchFilter(_0x42bc60[_0x1e46('0x50')]);})[_0x1e46('0x4c')](function(_0x3e773e){_0x4bbe64[_0x1e46('0x50')]=_0x3e773e;return _0x4bbe64;});}function checkListsRestrictions(_0x2ba50a,_0xd431c8,_0x493df5){var _0x220cb9=squel[_0x1e46('0x21')]();return Promise['resolve']()[_0x1e46('0x4c')](function(){if(_0xd431c8[_0x1e46('0x51')]&&_0x2ba50a[_0x1e46('0x4')]===_0x1e46('0x5')&&!_0x493df5){return _0x2ba50a[_0x1e46('0x52')]({'attributes':['id'],'raw':!![]});}})[_0x1e46('0x4c')](function(_0x4f44db){if(_0x4f44db){if(_0x4f44db[_0x1e46('0x30')]===0x0){_0x220cb9[_0x1e46('0x3f')](_0x1e46('0x53'));}else{_0x220cb9[_0x1e46('0x3f')](_0x1e46('0x48'),_[_0x1e46('0x3d')](_0x4f44db,'id'));}}})[_0x1e46('0x4c')](function(){return _0x220cb9;});}function buildContactsQuery(_0x35f349,_0x276b17,_0x1bfcca,_0x416b3c,_0xe9718c,_0x3c8a3a){if(_0x276b17){_0x276b17=_0x1bfcca[_0x1e46('0x54')];}_0x35f349=addFieldsToQuery(_0x35f349,_0x276b17,_0x416b3c,_0x3c8a3a,!![]);var _0x5e2603=squel[_0x1e46('0x9')]();_0x5e2603=addFieldsToQuery(_0x5e2603,_0x276b17,_0x416b3c,_0x3c8a3a,![]);if(_0x416b3c||_0x3c8a3a){_0x35f349=applyJoinClauses(_0x35f349,!![]);_0x35f349[_0x1e46('0x55')](_0x1e46('0x56'));if(_0x1bfcca[_0x1e46('0x57')]){_0x5e2603[_0x1e46('0x57')](_0x1bfcca[_0x1e46('0x57')]);}if(_0x1bfcca[_0x1e46('0x58')]){_0x5e2603['offset'](_0x1bfcca[_0x1e46('0x58')]);}}else{_0x5e2603=applyJoinClauses(_0x5e2603,![]);_0x5e2603[_0x1e46('0x55')](_0x1e46('0x59'));if(_0x1bfcca['limit']){_0x35f349['limit'](_0x1bfcca[_0x1e46('0x57')]);}if(_0x1bfcca[_0x1e46('0x58')]){_0x35f349[_0x1e46('0x58')](_0x1bfcca['offset']);}}_0x5e2603[_0x1e46('0x5a')](_0xe9718c);if(_0x1bfcca[_0x1e46('0x5b')]){_0x1bfcca['order'][_0x1e46('0x23')](function(_0x27c4c3){_0x35f349['order']('c.'+_0x27c4c3[0x0],_0x27c4c3[0x1]===_0x1e46('0x5c')?![]:!![]);_0x5e2603[_0x1e46('0x5b')]('subqry.'+_0x27c4c3[0x0],_0x27c4c3[0x1]==='DESC'?![]:!![]);});}_0x5e2603[_0x1e46('0xa')](_0x35f349,'subqry');return _0x5e2603;}function getFilteredContacts(_0x108281){var _0x2af1f2=[];return db[_0x1e46('0x3c')][_0x1e46('0x5d')]({'attributes':['id',_0x1e46('0x32'),_0x1e46('0x5e')],'raw':!![]})[_0x1e46('0x4c')](function(_0x1f7214){_0x2af1f2=_['keyBy'](_0x1f7214,'id');var _0x280e19={'type':db['Sequelize']['QueryTypes'][_0x1e46('0x5f')],'model':db['CmContact'],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0x1e46('0x60')][_0x1e46('0x61')](_0x108281[_0x1e46('0x62')](),_0x280e19);})['then'](function(_0x45e022){_0x45e022[_0x1e46('0x23')](function(_0x1f9c35){if(_0x1f9c35['TagIds']){_0x1f9c35[_0x1e46('0x63')]=[];_0x1f9c35[_0x1e46('0x1c')][_0x1e46('0x27')](',')[_0x1e46('0x23')](function(_0x5c3099){_0x1f9c35['Tags']['push'](_0x2af1f2[_0x5c3099]);});}delete _0x1f9c35[_0x1e46('0x1c')];});return _0x45e022;});}function countFilteredContacts(_0x20ccdd,_0x1bc9cf){var _0x56c316=_0x20ccdd[_0x1e46('0x64')]();_0x56c316[_0x1e46('0x20')](_0x1e46('0x65'));_0x56c316=applyJoinClauses(_0x56c316,!![]);_0x20ccdd[_0x1e46('0x55')](_0x1e46('0x56'));var _0x39a256=utils[_0x1e46('0x22')](_0x1bc9cf);if(!_[_0x1e46('0x66')](_0x39a256)){_0x56c316['where'](_0x1e46('0x67'),_0x39a256);}var _0xb22153={'type':db['Sequelize'][_0x1e46('0x68')][_0x1e46('0x5f')],'raw':!![]};return db[_0x1e46('0x60')][_0x1e46('0x61')](_0x56c316[_0x1e46('0x62')](),_0xb22153)['then'](function(_0x52f011){return _0x52f011[0x0]['COUNT(*)'];});}module[_0x1e46('0x69')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 38d4847..d1854c5 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 _0x7900=['binary','write','end','unlink','decryptFile','update','final','close','encryptString','secret','createCipher','utf8','base64','decryptString','crypto','bluebird','lodash','../../config/logger','secrets','session','aes-256-ctr','aes192','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','filter','indexOf','hasOwnProperty','createReadStream','data'];(function(_0xa052d4,_0x88006f){var _0x3f56b9=function(_0x5554d7){while(--_0x5554d7){_0xa052d4['push'](_0xa052d4['shift']());}};_0x3f56b9(++_0x88006f);}(_0x7900,0x6e));var _0x0790=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7900[_0x20a584];return _0x4b41a8;};'use strict';var crypto=require(_0x0790('0x0'));var fs=require('fs');var BPromise=require(_0x0790('0x1'));var _=require(_0x0790('0x2'));var config=require('../../config/environment');var logger=require(_0x0790('0x3'))('app');const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x0790('0x4')][_0x0790('0x5')],'algorithm':_0x0790('0x6')};const fileOptions={'algorithm':_0x0790('0x7')};if(config['encrypt']&&config[_0x0790('0x8')][_0x0790('0x9')]){var isSupported=isAlgorithmSupported(config[_0x0790('0x8')][_0x0790('0x9')]);if(isSupported){fileOptions[_0x0790('0x9')]=config[_0x0790('0x8')]['algorithm'];}else{var supportedAlgorithms=getSupportedCiphers()[_0x0790('0xa')](',\x20');logger[_0x0790('0xb')](config[_0x0790('0x8')]['algorithm'],_0x0790('0xc'),supportedAlgorithms);}}function isASupportedCipher(_0x441b3e){return AES_SUPPORTED_RX['test'](_0x441b3e);}function getSupportedCiphers(){return crypto['getCiphers']()[_0x0790('0xd')](isASupportedCipher);}function isAlgorithmSupported(_0x3232c7){return getSupportedCiphers()[_0x0790('0xe')](_0x3232c7)>-0x1;}function combineOptions(_0x3e69c7){var _0x51af8e={};for(var _0x38403d in fileOptions){if(fileOptions[_0x0790('0xf')](_0x38403d)){_0x51af8e[_0x38403d]=fileOptions[_0x38403d];}}if(_0x3e69c7){for(var _0x1f9852 in _0x3e69c7){if(_0x3e69c7['hasOwnProperty'](_0x1f9852)){_0x51af8e[_0x1f9852]=_0x3e69c7[_0x1f9852];}}}return _0x51af8e;}exports['encryptFile']=function(_0x99bbc9,_0x499463,_0x4c581a,_0x169a6b){return new BPromise(function(_0x92f5ff,_0x51c57e){_0x169a6b=combineOptions(_0x169a6b);var _0x3d1e6a=new Buffer(_0x4c581a);var _0x339544=fs[_0x0790('0x10')](_0x99bbc9);var _0x26de10=fs['createWriteStream'](_0x499463);var _0x2e1c7f=crypto['createCipher'](_0x169a6b[_0x0790('0x9')],_0x3d1e6a);_0x339544['on'](_0x0790('0x11'),function(_0x12f54f){var _0x56f2ef=new Buffer(_0x2e1c7f['update'](_0x12f54f),_0x0790('0x12'));_0x26de10[_0x0790('0x13')](_0x56f2ef);});_0x339544['on'](_0x0790('0x14'),function(){try{var _0x11f235=new Buffer(_0x2e1c7f['final'](_0x0790('0x12')),_0x0790('0x12'));_0x26de10[_0x0790('0x13')](_0x11f235);_0x26de10[_0x0790('0x14')]();_0x26de10['on']('close',function(){return _0x92f5ff(_0x499463);});}catch(_0x1b9827){fs[_0x0790('0x15')](_0x499463);return _0x51c57e(_0x1b9827);}});});};exports[_0x0790('0x16')]=function(_0x1e61b3,_0x2525d4,_0x1c4d95,_0x3303bb){return new BPromise(function(_0x14d9b0,_0x524bc6){_0x3303bb=combineOptions(_0x3303bb);var _0x4518b0=new Buffer(_0x1c4d95);var _0x582f87=fs[_0x0790('0x10')](_0x1e61b3);var _0x3cfae2=fs['createWriteStream'](_0x2525d4);var _0xa67ae4=crypto['createDecipher'](_0x3303bb[_0x0790('0x9')],_0x4518b0);_0x582f87['on']('data',function(_0x3f276d){var _0x4ffa73=new Buffer(_0xa67ae4[_0x0790('0x17')](_0x3f276d),_0x0790('0x12'));_0x3cfae2[_0x0790('0x13')](_0x4ffa73);});_0x582f87['on'](_0x0790('0x14'),function(){try{var _0x126f13=new Buffer(_0xa67ae4[_0x0790('0x18')](_0x0790('0x12')),_0x0790('0x12'));_0x3cfae2[_0x0790('0x13')](_0x126f13);_0x3cfae2[_0x0790('0x14')]();_0x3cfae2['on'](_0x0790('0x19'),function(){return _0x14d9b0(_0x2525d4);});}catch(_0x387d49){fs['unlink'](_0x2525d4);return _0x524bc6(_0x387d49);}});});};exports[_0x0790('0x1a')]=function(_0x310676,_0x115b75,_0x5f1b37){var _0x104d2e=_0x5f1b37||stringOptions[_0x0790('0x9')];var _0x29c132=_0x115b75||stringOptions[_0x0790('0x1b')];var _0x1a73ad=crypto[_0x0790('0x1c')](_0x104d2e,_0x29c132);var _0x5be98a=_0x1a73ad[_0x0790('0x17')](_0x310676,_0x0790('0x1d'),_0x0790('0x1e'));_0x5be98a+=_0x1a73ad[_0x0790('0x18')]('base64');return _0x5be98a;};exports[_0x0790('0x1f')]=function(_0x2de836,_0x3b5d96,_0x3c2df1){var _0x56adce=_0x3c2df1||stringOptions[_0x0790('0x9')];var _0x4d7b09=_0x3b5d96||stringOptions[_0x0790('0x1b')];var _0x4548ae=crypto['createDecipher'](_0x56adce,_0x4d7b09);var _0x409807=_0x4548ae[_0x0790('0x17')](_0x2de836,_0x0790('0x1e'),_0x0790('0x1d'));_0x409807+=_0x4548ae[_0x0790('0x18')]('utf8');return _0x409807;}; \ No newline at end of file +var _0xb6b4=['app','secrets','session','aes-256-ctr','aes192','encrypt','algorithm','join','error','test','getCiphers','indexOf','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','data','binary','write','end','final','close','decryptFile','createDecipher','update','unlink','secret','utf8','base64','lodash','../../config/environment','../../config/logger'];(function(_0x3d6591,_0x3f0085){var _0x57e3ea=function(_0x1d96ed){while(--_0x1d96ed){_0x3d6591['push'](_0x3d6591['shift']());}};_0x57e3ea(++_0x3f0085);}(_0xb6b4,0xc3));var _0x4b6b=function(_0x240a9a,_0x2489e5){_0x240a9a=_0x240a9a-0x0;var _0x27818a=_0xb6b4[_0x240a9a];return _0x27818a;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require('bluebird');var _=require(_0x4b6b('0x0'));var config=require(_0x4b6b('0x1'));var logger=require(_0x4b6b('0x2'))(_0x4b6b('0x3'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x4b6b('0x4')][_0x4b6b('0x5')],'algorithm':_0x4b6b('0x6')};const fileOptions={'algorithm':_0x4b6b('0x7')};if(config[_0x4b6b('0x8')]&&config[_0x4b6b('0x8')][_0x4b6b('0x9')]){var isSupported=isAlgorithmSupported(config['encrypt']['algorithm']);if(isSupported){fileOptions['algorithm']=config[_0x4b6b('0x8')][_0x4b6b('0x9')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x4b6b('0xa')](',\x20');logger[_0x4b6b('0xb')](config[_0x4b6b('0x8')][_0x4b6b('0x9')],'is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:',supportedAlgorithms);}}function isASupportedCipher(_0x4458f2){return AES_SUPPORTED_RX[_0x4b6b('0xc')](_0x4458f2);}function getSupportedCiphers(){return crypto[_0x4b6b('0xd')]()['filter'](isASupportedCipher);}function isAlgorithmSupported(_0x477697){return getSupportedCiphers()[_0x4b6b('0xe')](_0x477697)>-0x1;}function combineOptions(_0x310fed){var _0x40a48b={};for(var _0x373499 in fileOptions){if(fileOptions[_0x4b6b('0xf')](_0x373499)){_0x40a48b[_0x373499]=fileOptions[_0x373499];}}if(_0x310fed){for(var _0xaca0ef in _0x310fed){if(_0x310fed[_0x4b6b('0xf')](_0xaca0ef)){_0x40a48b[_0xaca0ef]=_0x310fed[_0xaca0ef];}}}return _0x40a48b;}exports[_0x4b6b('0x10')]=function(_0x328f26,_0x4f4762,_0xdf62ed,_0x5ea312){return new BPromise(function(_0x44ae3d,_0x36ba89){_0x5ea312=combineOptions(_0x5ea312);var _0x39d8a7=new Buffer(_0xdf62ed);var _0x58cf15=fs[_0x4b6b('0x11')](_0x328f26);var _0x553f5e=fs[_0x4b6b('0x12')](_0x4f4762);var _0x1f2dd4=crypto[_0x4b6b('0x13')](_0x5ea312['algorithm'],_0x39d8a7);_0x58cf15['on'](_0x4b6b('0x14'),function(_0x13398c){var _0x5017cb=new Buffer(_0x1f2dd4['update'](_0x13398c),_0x4b6b('0x15'));_0x553f5e[_0x4b6b('0x16')](_0x5017cb);});_0x58cf15['on'](_0x4b6b('0x17'),function(){try{var _0x51c9ea=new Buffer(_0x1f2dd4[_0x4b6b('0x18')]('binary'),_0x4b6b('0x15'));_0x553f5e[_0x4b6b('0x16')](_0x51c9ea);_0x553f5e[_0x4b6b('0x17')]();_0x553f5e['on'](_0x4b6b('0x19'),function(){return _0x44ae3d(_0x4f4762);});}catch(_0x295181){fs['unlink'](_0x4f4762);return _0x36ba89(_0x295181);}});});};exports[_0x4b6b('0x1a')]=function(_0x19a57c,_0x550ce1,_0xf32020,_0x2536a7){return new BPromise(function(_0x10b8df,_0x1e888f){_0x2536a7=combineOptions(_0x2536a7);var _0x4db5f3=new Buffer(_0xf32020);var _0x40e40e=fs['createReadStream'](_0x19a57c);var _0x2b8a3a=fs[_0x4b6b('0x12')](_0x550ce1);var _0x2c6339=crypto[_0x4b6b('0x1b')](_0x2536a7[_0x4b6b('0x9')],_0x4db5f3);_0x40e40e['on']('data',function(_0x1f2ae2){var _0x382675=new Buffer(_0x2c6339[_0x4b6b('0x1c')](_0x1f2ae2),_0x4b6b('0x15'));_0x2b8a3a[_0x4b6b('0x16')](_0x382675);});_0x40e40e['on'](_0x4b6b('0x17'),function(){try{var _0x384213=new Buffer(_0x2c6339[_0x4b6b('0x18')](_0x4b6b('0x15')),_0x4b6b('0x15'));_0x2b8a3a[_0x4b6b('0x16')](_0x384213);_0x2b8a3a[_0x4b6b('0x17')]();_0x2b8a3a['on'](_0x4b6b('0x19'),function(){return _0x10b8df(_0x550ce1);});}catch(_0x24d970){fs[_0x4b6b('0x1d')](_0x550ce1);return _0x1e888f(_0x24d970);}});});};exports['encryptString']=function(_0x427661,_0xc581d9,_0x595b38){var _0x4001d8=_0x595b38||stringOptions[_0x4b6b('0x9')];var _0x281393=_0xc581d9||stringOptions[_0x4b6b('0x1e')];var _0x59cce8=crypto[_0x4b6b('0x13')](_0x4001d8,_0x281393);var _0x5a0b76=_0x59cce8['update'](_0x427661,_0x4b6b('0x1f'),_0x4b6b('0x20'));_0x5a0b76+=_0x59cce8['final'](_0x4b6b('0x20'));return _0x5a0b76;};exports['decryptString']=function(_0x1ffca9,_0x3719bb,_0x59adb7){var _0x4835d4=_0x59adb7||stringOptions['algorithm'];var _0x1d1bd4=_0x3719bb||stringOptions[_0x4b6b('0x1e')];var _0x476036=crypto[_0x4b6b('0x1b')](_0x4835d4,_0x1d1bd4);var _0x42b4ae=_0x476036['update'](_0x1ffca9,_0x4b6b('0x20'),_0x4b6b('0x1f'));_0x42b4ae+=_0x476036['final'](_0x4b6b('0x1f'));return _0x42b4ae;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index ea2a195..b2bc0d2 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 _0x608e=['analytics','argv','savename','AnalyticExtractedReport','info','format','CSV','find','splitSizeCsv','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','then','split','length','range','num','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','sequelize','dirname','basename','.csv','existsSync','mkdirSync','join','each','%s.%s','csv','writeFileSync','zip','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','util','path','bluebird','rimraf','../../mysqldb','dbH','../../config/logger'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x608e,0x86));var _0xe608=function(_0x38d438,_0x5a2309){_0x38d438=_0x38d438-0x0;var _0x5af2b6=_0x608e[_0x38d438];return _0x5af2b6;};'use strict';var util=require(_0xe608('0x0'));var path=require(_0xe608('0x1'));var _=require('lodash');var csv=require('to-csv');var fs=require('fs');var BPromise=require(_0xe608('0x2'));var zipdir=require('zip-dir');var rimraf=require(_0xe608('0x3'));var db=require(_0xe608('0x4'))['db'];var dbH=require('../../mysqldb')[_0xe608('0x5')];var logger=require(_0xe608('0x6'))(_0xe608('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0xe608('0x8')][0x2]);var QUERY=process[_0xe608('0x8')][0x3];var PATH=process[_0xe608('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0xd711e3,_0x3e99f8){var _0x534539={'status':_0xd711e3};var _0x47a9f1={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3e99f8){_0x534539[_0xe608('0x9')]=_0x3e99f8;}return db[_0xe608('0xa')]['update'](_0x534539,_0x47a9f1);}function main(){var _0x574611=0x1388;var _0x2add55;logger[_0xe608('0xb')](util[_0xe608('0xc')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xe608('0xd')));return db['Setting'][_0xe608('0xe')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0xe608('0xf')]})['then'](function(_0x36d203){if(_0x36d203){_0x2add55=_0x36d203;_0x574611=_0x2add55['splitSizeCsv']||0x1388;}})['then'](function(){return dbH['sequelize'][_0xe608('0x10')](util[_0xe608('0xc')](_0xe608('0x11'),QUERY),{'type':dbH['sequelize'][_0xe608('0x12')][_0xe608('0x13')]});})[_0xe608('0x14')](function(_0x3959d4){if(!_0x3959d4[0x0]['num']){return analyticExtractedReport('Empty');}var _0x607cb6=[];var _0x2e4ad9=0x0;if(_0x2add55[_0xe608('0x15')]){if(_0x3959d4&&_0x3959d4[_0xe608('0x16')]){var _0xe39089=_[_0xe608('0x17')](_0x3959d4[0x0][_0xe608('0x18')]/_0x574611);var _0x136738=Number[_0xe608('0x19')](_0x3959d4[0x0]['num']/_0x574611)?_0x3959d4[0x0][_0xe608('0x18')]%_0x574611:0x0;_0xe39089[_0xe608('0x1a')](function(_0x3d137d){if(_0x3d137d>0x0){_0x2e4ad9+=_0x574611;}_0x607cb6[_0xe608('0x1b')](dbH['sequelize'][_0xe608('0x10')](util['format'](_0xe608('0x1c'),QUERY,_0x574611,_0x2e4ad9),{'type':dbH['sequelize'][_0xe608('0x12')][_0xe608('0x13')]}));});if(_0x136738>0x0){_0x2e4ad9+=_0x574611;_0x607cb6[_0xe608('0x1b')](dbH[_0xe608('0x1d')][_0xe608('0x10')](util[_0xe608('0xc')](_0xe608('0x1c'),QUERY,_0x136738,_0x2e4ad9),{'type':dbH[_0xe608('0x1d')]['QueryTypes'][_0xe608('0x13')]}));}}}else{_0x607cb6[_0xe608('0x1b')](dbH[_0xe608('0x1d')][_0xe608('0x10')](QUERY,{'type':dbH[_0xe608('0x1d')][_0xe608('0x12')]['SELECT']}));}var _0x651c06=path[_0xe608('0x1e')](PATH);var _0x1fcacf=path[_0xe608('0x1f')](PATH,_0xe608('0x20'));var _0x4ddba4=_0x2add55[_0xe608('0x15')]&&_0x607cb6[_0xe608('0x16')]>0x1;var _0xf319ef=[];if(!fs[_0xe608('0x21')](path['join'](_0x651c06,_0x1fcacf))&&_0x4ddba4){fs[_0xe608('0x22')](path[_0xe608('0x23')](_0x651c06,_0x1fcacf));}return BPromise[_0xe608('0x24')](_0x607cb6,function(_0x9f83){_0xf319ef[_0xe608('0x1b')](_0x9f83);})['then'](function(){for(var _0x37b007=0x0;_0x37b007<_0xf319ef[_0xe608('0x16')];_0x37b007+=0x1){var _0x474ff4;var _0x49639c=_0xf319ef[_0x37b007];if(_0x4ddba4){_0x474ff4=path[_0xe608('0x23')](_0x651c06,_0x1fcacf,util[_0xe608('0xc')]('%s%d.%s',_0x1fcacf,_0x37b007,'csv'));}else{_0x474ff4=path[_0xe608('0x23')](_0x651c06,util['format'](_0xe608('0x25'),_0x1fcacf,_0xe608('0x26')));}fs[_0xe608('0x27')](_0x474ff4,csv(_0x49639c));}})[_0xe608('0x14')](function(){if(_0x4ddba4){return new Promise(function(_0x52f206){zipdir(path[_0xe608('0x23')](_0x651c06,_0x1fcacf),{'saveTo':path['join'](_0x651c06,util[_0xe608('0xc')](_0xe608('0x25'),_0x1fcacf,_0xe608('0x28')))},function(_0x279b2f,_0x59c2d7){rimraf(path[_0xe608('0x23')](_0x651c06,_0x1fcacf),function(){});_0x52f206('zip\x20finished');});});}})[_0xe608('0x14')](function(){logger[_0xe608('0xb')](util[_0xe608('0xc')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0xe608('0xd')));return analyticExtractedReport('Completed',_0x4ddba4?util[_0xe608('0xc')]('%s.%s',_0x1fcacf,_0x4ddba4?_0xe608('0x28'):_0xe608('0x26')):null);});})[_0xe608('0x29')](function(_0xc6f1e5){logger[_0xe608('0xb')](util[_0xe608('0xc')](_0xe608('0x2a'),EXTRACTED_REPORT_ID,'CSV'),util[_0xe608('0x2b')](_0xc6f1e5,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xe608('0x2c'));})[_0xe608('0x2d')](function(){process[_0xe608('0x2e')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x6a7d=['update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','split','splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','Empty','num','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.csv','existsSync','join','mkdirSync','each','length','csv','%s.%s','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','Completed','zip','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','path','lodash','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','AnalyticExtractedReport'];(function(_0x6532c8,_0x47506b){var _0x102f57=function(_0x223cd7){while(--_0x223cd7){_0x6532c8['push'](_0x6532c8['shift']());}};_0x102f57(++_0x47506b);}(_0x6a7d,0xf3));var _0xd6a7=function(_0x3490c2,_0x548c5e){_0x3490c2=_0x3490c2-0x0;var _0x891d41=_0x6a7d[_0x3490c2];return _0x891d41;};'use strict';var util=require('util');var path=require(_0xd6a7('0x0'));var _=require(_0xd6a7('0x1'));var csv=require(_0xd6a7('0x2'));var fs=require('fs');var BPromise=require(_0xd6a7('0x3'));var zipdir=require(_0xd6a7('0x4'));var rimraf=require(_0xd6a7('0x5'));var db=require(_0xd6a7('0x6'))['db'];var dbH=require(_0xd6a7('0x6'))[_0xd6a7('0x7')];var logger=require(_0xd6a7('0x8'))(_0xd6a7('0x9'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0xd6a7('0xa')][0x3];var PATH=process[_0xd6a7('0xa')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x32f115,_0x2869c3){var _0x3baa8e={'status':_0x32f115};var _0x412ff9={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2869c3){_0x3baa8e['savename']=_0x2869c3;}return db[_0xd6a7('0xb')][_0xd6a7('0xc')](_0x3baa8e,_0x412ff9);}function main(){var _0x364514=0x1388;var _0x42bbff;logger[_0xd6a7('0xd')](util[_0xd6a7('0xe')](_0xd6a7('0xf'),EXTRACTED_REPORT_ID,'CSV'));return db[_0xd6a7('0x10')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xd6a7('0x11'),'splitSizeCsv']})['then'](function(_0x511405){if(_0x511405){_0x42bbff=_0x511405;_0x364514=_0x42bbff[_0xd6a7('0x12')]||0x1388;}})[_0xd6a7('0x13')](function(){return dbH[_0xd6a7('0x14')][_0xd6a7('0x15')](util[_0xd6a7('0xe')](_0xd6a7('0x16'),QUERY),{'type':dbH[_0xd6a7('0x14')][_0xd6a7('0x17')][_0xd6a7('0x18')]});})[_0xd6a7('0x13')](function(_0x3f46ef){if(!_0x3f46ef[0x0]['num']){return analyticExtractedReport(_0xd6a7('0x19'));}var _0x21672b=[];var _0x11ea74=0x0;if(_0x42bbff['split']){if(_0x3f46ef&&_0x3f46ef['length']){var _0x2af4c1=_['range'](_0x3f46ef[0x0][_0xd6a7('0x1a')]/_0x364514);var _0x1ae18d=Number[_0xd6a7('0x1b')](_0x3f46ef[0x0][_0xd6a7('0x1a')]/_0x364514)?_0x3f46ef[0x0]['num']%_0x364514:0x0;_0x2af4c1[_0xd6a7('0x1c')](function(_0x98369b){if(_0x98369b>0x0){_0x11ea74+=_0x364514;}_0x21672b[_0xd6a7('0x1d')](dbH[_0xd6a7('0x14')][_0xd6a7('0x15')](util[_0xd6a7('0xe')](_0xd6a7('0x1e'),QUERY,_0x364514,_0x11ea74),{'type':dbH['sequelize'][_0xd6a7('0x17')][_0xd6a7('0x18')]}));});if(_0x1ae18d>0x0){_0x11ea74+=_0x364514;_0x21672b[_0xd6a7('0x1d')](dbH[_0xd6a7('0x14')][_0xd6a7('0x15')](util[_0xd6a7('0xe')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x1ae18d,_0x11ea74),{'type':dbH['sequelize']['QueryTypes']['SELECT']}));}}}else{_0x21672b[_0xd6a7('0x1d')](dbH['sequelize'][_0xd6a7('0x15')](QUERY,{'type':dbH[_0xd6a7('0x14')]['QueryTypes'][_0xd6a7('0x18')]}));}var _0x1b56a4=path[_0xd6a7('0x1f')](PATH);var _0x468839=path[_0xd6a7('0x20')](PATH,_0xd6a7('0x21'));var _0x310de5=_0x42bbff[_0xd6a7('0x11')]&&_0x21672b['length']>0x1;var _0x19768b=[];if(!fs[_0xd6a7('0x22')](path[_0xd6a7('0x23')](_0x1b56a4,_0x468839))&&_0x310de5){fs[_0xd6a7('0x24')](path[_0xd6a7('0x23')](_0x1b56a4,_0x468839));}return BPromise[_0xd6a7('0x25')](_0x21672b,function(_0x51da4a){_0x19768b[_0xd6a7('0x1d')](_0x51da4a);})[_0xd6a7('0x13')](function(){for(var _0x2faba6=0x0;_0x2faba6<_0x19768b[_0xd6a7('0x26')];_0x2faba6+=0x1){var _0x40a6b6;var _0x42edeb=_0x19768b[_0x2faba6];if(_0x310de5){_0x40a6b6=path[_0xd6a7('0x23')](_0x1b56a4,_0x468839,util[_0xd6a7('0xe')]('%s%d.%s',_0x468839,_0x2faba6,_0xd6a7('0x27')));}else{_0x40a6b6=path[_0xd6a7('0x23')](_0x1b56a4,util[_0xd6a7('0xe')]('%s.%s',_0x468839,_0xd6a7('0x27')));}fs['writeFileSync'](_0x40a6b6,csv(_0x42edeb));}})[_0xd6a7('0x13')](function(){if(_0x310de5){return new Promise(function(_0x3ac40c){zipdir(path[_0xd6a7('0x23')](_0x1b56a4,_0x468839),{'saveTo':path[_0xd6a7('0x23')](_0x1b56a4,util[_0xd6a7('0xe')](_0xd6a7('0x28'),_0x468839,'zip'))},function(_0x2a3663,_0xea7cf8){rimraf(path[_0xd6a7('0x23')](_0x1b56a4,_0x468839),function(){});_0x3ac40c(_0xd6a7('0x29'));});});}})[_0xd6a7('0x13')](function(){logger[_0xd6a7('0xd')](util[_0xd6a7('0xe')](_0xd6a7('0x2a'),EXTRACTED_REPORT_ID,_0xd6a7('0x2b')));return analyticExtractedReport(_0xd6a7('0x2c'),_0x310de5?util[_0xd6a7('0xe')](_0xd6a7('0x28'),_0x468839,_0x310de5?_0xd6a7('0x2d'):_0xd6a7('0x27')):null);});})['catch'](function(_0x46916e){logger[_0xd6a7('0xd')](util[_0xd6a7('0xe')](_0xd6a7('0x2e'),EXTRACTED_REPORT_ID,'CSV'),util[_0xd6a7('0x2f')](_0x46916e,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xd6a7('0x30'));})[_0xd6a7('0x31')](function(){process[_0xd6a7('0x32')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 4e2e46c..d91121e 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 _0x416c=['fill','length','body','chunk','forEach','push','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','format','before','margin','\x20/\x20','footer','black','Empty','Setting','split','splitSizePdf','then','range','num','isInteger','sequelize','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','query','dirname','basename','.pdf','mkdirSync','join','each','flatten','createPdfKitDocument','%s%d.%s','%s.%s','pdf','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','interactionId','Arial','center','Interaction\x20Transcript','header','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','createWriteStream','finish','error','end','createPdfFromHTML','path','html-to-pdfmake','jsdom','JSDOM','window','bluebird','../../mysqldb','analytics','argv','savename','AnalyticExtractedReport','update','map','tableHeader','toString','value'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x416c,0x199));var _0xc416=function(_0x1d6e98,_0x589a34){_0x1d6e98=_0x1d6e98-0x0;var _0x126cca=_0x416c[_0x1d6e98];return _0x126cca;};'use strict';var _=require('lodash');var fs=require('fs');var util=require('util');var path=require(_0xc416('0x0'));var moment=require('moment');var htmlToPdfmake=require(_0xc416('0x1'));var PdfPrinter=require('pdfmake/src/printer');var zipdir=require('zip-dir');var rimraf=require('rimraf');var JSDOM=require(_0xc416('0x2'))[_0xc416('0x3')];var window=new JSDOM('')[_0xc416('0x4')];var BPromise=require(_0xc416('0x5'));var db=require(_0xc416('0x6'))['db'];var dbH=require(_0xc416('0x6'))['dbH'];var logger=require('../../config/logger')(_0xc416('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0xc416('0x8')][0x2]);var QUERY=process[_0xc416('0x8')][0x3];var PATH=process[_0xc416('0x8')][0x4];var NAME=process[_0xc416('0x8')][0x5];var FORMAT='MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a';var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x534fa9,_0xe46134){var _0x253a5a={'status':_0x534fa9};var _0x58b031={'where':{'id':EXTRACTED_REPORT_ID}};if(_0xe46134){_0x253a5a[_0xc416('0x9')]=_0xe46134;}return db[_0xc416('0xa')][_0xc416('0xb')](_0x253a5a,_0x58b031);}function getHeaders(_0x2682e4){return _[_0xc416('0xc')](_0x2682e4,function(_0x1beead){return{'text':_0x1beead,'style':_0xc416('0xd')};});}function getRows(_0x168cc7,_0x568c20){return _[_0xc416('0xc')](_0x568c20,function(_0x3ecd77){return _(_0x3ecd77)['pick'](_0x168cc7)['map'](function(_0x18840f){return _0x18840f?_[_0xc416('0xe')](_0x18840f):'';})[_0xc416('0xf')]();});}function createTable(_0x9296c7,_0x2e9c4b){var _0x25d104={'widths':_[_0xc416('0x10')](Array(_0x9296c7[_0xc416('0x11')]),0x91),'heights':function(_0x33e3e0){return _0x33e3e0===0x0?'auto':0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x1cf5ab=getHeaders(_0x9296c7);_0x25d104[_0xc416('0x12')]['push'](_0x1cf5ab);var _0x2b582b=getRows(_0x9296c7,_0x2e9c4b);_0x25d104[_0xc416('0x12')]=_0x25d104[_0xc416('0x12')]['concat'](_0x2b582b);return _0x25d104;}function createTables(_0x2033f3){var _0x44d1fa=[];var _0x5e17f9=_[_0xc416('0x13')](Object['keys'](_0x2033f3[0x0]),0x5);_0x5e17f9[_0xc416('0x14')](function(_0xb6c1){_0x44d1fa[_0xc416('0x15')](createTable(_0xb6c1,_0x2033f3));});return _0x44d1fa;}function getPDFDocDefinition(_0x467c30){var _0x289789=util['format'](_0xc416('0x16'),NAME,EXTRACTED_REPORT[_0xc416('0x17')],moment(EXTRACTED_REPORT[_0xc416('0x18')])[_0xc416('0x19')](FORMAT),moment(EXTRACTED_REPORT['endDate'])['format'](FORMAT));var _0x25d27b=[];for(var _0xa8f46e=0x0;_0xa8f46e<_0x467c30[_0xc416('0x11')];_0xa8f46e++){var _0x3c0c52=[];if(_0xa8f46e===0x0){_0x3c0c52[_0xc416('0x15')]({'text':_0x289789,'style':'header'});}var _0x4efb07={'table':_0x467c30[_0xa8f46e]};if(_0xa8f46e>0x0){_0x4efb07['pageBreak']=_0xc416('0x1a');_0x4efb07[_0xc416('0x1b')]=[0x0,0x46,0x0,0x0];}_0x3c0c52[_0xc416('0x15')](_0x4efb07);_0x25d27b[_0xc416('0x15')](_0x3c0c52);}return{'pageSize':'A4','pageOrientation':'landscape','content':_0x25d27b,'footer':function(_0x3e5c1a,_0x58a217){return{'text':_0x3e5c1a[_0xc416('0xe')]()+_0xc416('0x1c')+_0x58a217,'style':_0xc416('0x1d')};},'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xc416('0x1e')},'footer':{'alignment':'right','margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x450589){var _0x33f5d2=0x1388;var _0x23a238;if(!_0x450589[0x0]['num']){return analyticExtractedReport(_0xc416('0x1f'));}return db[_0xc416('0x20')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xc416('0x21'),_0xc416('0x22')]})[_0xc416('0x23')](function(_0x4d3327){if(_0x4d3327){_0x23a238=_0x4d3327;_0x33f5d2=_0x23a238[_0xc416('0x22')]||0x3e8;}})[_0xc416('0x23')](function(){var _0x4318a5=[];var _0x4f5b32=0x0;if(_0x23a238['split']){if(_0x450589&&_0x450589['length']){var _0x37b209=_[_0xc416('0x24')](_0x450589[0x0][_0xc416('0x25')]/_0x33f5d2);var _0x2728c9=Number[_0xc416('0x26')](_0x450589[0x0][_0xc416('0x25')]/_0x33f5d2)?_0x450589[0x0][_0xc416('0x25')]%_0x33f5d2:0x0;_0x37b209[_0xc416('0x14')](function(_0x353d3e){if(_0x353d3e>0x0){_0x4f5b32+=_0x33f5d2;}_0x4318a5[_0xc416('0x15')](dbH[_0xc416('0x27')]['query'](util['format'](_0xc416('0x28'),QUERY,_0x33f5d2,_0x4f5b32),{'type':dbH[_0xc416('0x27')][_0xc416('0x29')][_0xc416('0x2a')]}));});if(_0x2728c9>0x0){_0x4f5b32+=_0x33f5d2;_0x4318a5[_0xc416('0x15')](dbH['sequelize'][_0xc416('0x2b')](util['format'](_0xc416('0x28'),QUERY,_0x2728c9,_0x4f5b32),{'type':dbH[_0xc416('0x27')][_0xc416('0x29')][_0xc416('0x2a')]}));}}}else{_0x4318a5[_0xc416('0x15')](dbH[_0xc416('0x27')][_0xc416('0x2b')](QUERY,{'type':dbH[_0xc416('0x27')][_0xc416('0x29')][_0xc416('0x2a')]}));}var _0x5b85d5=path[_0xc416('0x2c')](PATH);var _0xbd6407=path[_0xc416('0x2d')](PATH,_0xc416('0x2e'));var _0xc7436b=_0x23a238[_0xc416('0x21')]&&_0x4318a5[_0xc416('0x11')]>0x1;var _0x1113be=[];if(!fs['existsSync'](path['join'](_0x5b85d5,_0xbd6407))&&_0xc7436b){fs[_0xc416('0x2f')](path[_0xc416('0x30')](_0x5b85d5,_0xbd6407));}return BPromise[_0xc416('0x31')](_0x4318a5,function(_0xe6c9e){_0x1113be['push'](_0xe6c9e);})[_0xc416('0x23')](function(){var _0x2f600e=[];for(var _0x36e542=0x0;_0x36e542<_0x1113be['length'];_0x36e542+=0x1){var _0x36c636=_0x1113be[_0x36e542];var _0x3e4222=createTables(_[_0xc416('0x32')](_0x36c636));var _0x317eef;var _0x1be4d5=getPDFDocDefinition(_0x3e4222);var _0x3e5589=getPDFPrinter();var _0x2507d3=_0x3e5589[_0xc416('0x33')](_0x1be4d5);if(_0xc7436b){_0x317eef=path[_0xc416('0x30')](_0x5b85d5,_0xbd6407,util['format'](_0xc416('0x34'),_0xbd6407,_0x36e542,'pdf'));}else{_0x317eef=path[_0xc416('0x30')](_0x5b85d5,util[_0xc416('0x19')](_0xc416('0x35'),_0xbd6407,_0xc416('0x36')));}_0x2f600e[_0xc416('0x15')](writePDFDocument(_0x2507d3,_0x317eef));}return Promise['all'](_0x2f600e);})['then'](function(){if(_0xc7436b){return new Promise(function(_0x5b66b9){zipdir(path['join'](_0x5b85d5,_0xbd6407),{'saveTo':path['join'](_0x5b85d5,util['format'](_0xc416('0x35'),_0xbd6407,_0xc416('0x37')))},function(){rimraf(path[_0xc416('0x30')](_0x5b85d5,_0xbd6407),function(){});_0x5b66b9(_0xc416('0x38'));});});}})['then'](function(){if(!_0xc7436b)return;rimraf(path['join'](_0x5b85d5,_0xbd6407),function(){});})['then'](function(){logger['info'](util[_0xc416('0x19')](_0xc416('0x39'),EXTRACTED_REPORT_ID,_0xc416('0x3a')));return analyticExtractedReport(_0xc416('0x3b'),_0xc7436b?util[_0xc416('0x19')](_0xc416('0x35'),_0xbd6407,_0xc7436b?_0xc416('0x37'):_0xc416('0x36')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0xc416('0x3c')](util[_0xc416('0x19')](_0xc416('0x3d'),EXTRACTED_REPORT_ID,_0xc416('0x3a')));return db[_0xc416('0xa')]['findOne']({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x51c802){EXTRACTED_REPORT=_0x51c802;return dbH[_0xc416('0x27')][_0xc416('0x2b')](util[_0xc416('0x19')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0xc416('0x27')][_0xc416('0x29')][_0xc416('0x2a')]});})[_0xc416('0x23')](extractReport)[_0xc416('0x3e')](function(_0x54cea3){logger[_0xc416('0x3c')](util[_0xc416('0x19')](_0xc416('0x3f'),EXTRACTED_REPORT_ID,'PDF'),util[_0xc416('0x40')](_0x54cea3,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xc416('0x41'));})[_0xc416('0x42')](function(){process[_0xc416('0x43')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x401409=new PdfPrinter({'Arial':{'normal':__dirname+_0xc416('0x44'),'bold':__dirname+'/fonts/arial-bold.ttf','italics':__dirname+_0xc416('0x45'),'bolditalics':__dirname+_0xc416('0x46')}});return _0x401409;}function getPDFDocDefinitionFromHTML(_0x50912d,_0x384d85){var _0x4d321e=util[_0xc416('0x19')](_0xc416('0x47'),_0x384d85[_0xc416('0x48')],_0x384d85[_0xc416('0x49')]);var _0x5cb996=moment()['format']('YYYY-MM-DD')['toString']();var _0x1129aa=htmlToPdfmake(_0x50912d,{'window':window,'tableAutoSize':!![]});return{'content':[_0x1129aa],'defaultStyle':{'font':_0xc416('0x4a')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0xc416('0x4b'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0xc416('0x4b'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0xc416('0x4b')}},'header':function(){return[{'text':_0xc416('0x4c'),'style':_0xc416('0x4d')}];},'footer':function(_0x59ce36,_0x5a3c32){return[{'text':util[_0xc416('0x19')](_0xc416('0x4e'),_0x4d321e,_0x59ce36,_0x5a3c32,_0x5cb996),'style':_0xc416('0x1d')}];}};}function writePDFDocument(_0xf6d20a,_0x599e84){return new Promise(function(_0x52d2fb,_0x44bb4c){var _0x210873=_0xf6d20a[_0xc416('0x4f')](fs[_0xc416('0x50')](_0x599e84));_0x210873['on'](_0xc416('0x51'),function(){_0x52d2fb(_0xc416('0x51'));});_0x210873['on'](_0xc416('0x52'),function(_0x38f6c2){_0x44bb4c(_0x38f6c2);});_0xf6d20a[_0xc416('0x53')]();});}exports[_0xc416('0x54')]=function(_0x38e794,_0x4781b9){var _0x3fc5ad=getPDFPrinter();var _0x410a02=getPDFDocDefinitionFromHTML(_0x38e794,_0x4781b9);var _0x58ee7f=_0x3fc5ad['createPdfKitDocument'](_0x410a02);return writePDFDocument(_0x58ee7f,_0x4781b9['path'])[_0xc416('0x3e')](function(_0x38e9fa){throw _0x38e9fa;});}; \ No newline at end of file +var _0xb89f=['SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','%s\x20#%d','channel','interactionId','YYYY-MM-DD','center','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','footer','createWriteStream','finish','error','end','createPdfFromHTML','catch','util','moment','html-to-pdfmake','pdfmake/src/printer','zip-dir','JSDOM','window','bluebird','../../mysqldb','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','tableHeader','map','toString','value','fill','length','auto','body','concat','chunk','keys','forEach','push','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','endDate','header','margin','landscape','\x20/\x20','Arial','black','right','num','find','split','then','splitSizePdf','isInteger','query','%s\x20limit\x20%d\x20OFFSET\x20%d','sequelize','QueryTypes','SELECT','dirname','basename','existsSync','join','mkdirSync','flatten','createPdfKitDocument','pdf','%s.%s','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','findOne'];(function(_0x1d4b33,_0x206bca){var _0x5e6625=function(_0xd27ff0){while(--_0xd27ff0){_0x1d4b33['push'](_0x1d4b33['shift']());}};_0x5e6625(++_0x206bca);}(_0xb89f,0x6b));var _0xfb89=function(_0x394236,_0x5dfb42){_0x394236=_0x394236-0x0;var _0x2c6989=_0xb89f[_0x394236];return _0x2c6989;};'use strict';var _=require('lodash');var fs=require('fs');var util=require(_0xfb89('0x0'));var path=require('path');var moment=require(_0xfb89('0x1'));var htmlToPdfmake=require(_0xfb89('0x2'));var PdfPrinter=require(_0xfb89('0x3'));var zipdir=require(_0xfb89('0x4'));var rimraf=require('rimraf');var JSDOM=require('jsdom')[_0xfb89('0x5')];var window=new JSDOM('')[_0xfb89('0x6')];var BPromise=require(_0xfb89('0x7'));var db=require(_0xfb89('0x8'))['db'];var dbH=require(_0xfb89('0x8'))['dbH'];var logger=require('../../config/logger')(_0xfb89('0x9'));var EXTRACTED_REPORT_ID=Number(process[_0xfb89('0xa')][0x2]);var QUERY=process[_0xfb89('0xa')][0x3];var PATH=process[_0xfb89('0xa')][0x4];var NAME=process[_0xfb89('0xa')][0x5];var FORMAT=_0xfb89('0xb');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x3e4e3c,_0x5174ee){var _0x8a0d0c={'status':_0x3e4e3c};var _0x3dd492={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5174ee){_0x8a0d0c[_0xfb89('0xc')]=_0x5174ee;}return db[_0xfb89('0xd')][_0xfb89('0xe')](_0x8a0d0c,_0x3dd492);}function getHeaders(_0x592153){return _['map'](_0x592153,function(_0x189021){return{'text':_0x189021,'style':_0xfb89('0xf')};});}function getRows(_0x5bb9e7,_0x2e52e4){return _[_0xfb89('0x10')](_0x2e52e4,function(_0xf7f11){return _(_0xf7f11)['pick'](_0x5bb9e7)[_0xfb89('0x10')](function(_0x32506b){return _0x32506b?_[_0xfb89('0x11')](_0x32506b):'';})[_0xfb89('0x12')]();});}function createTable(_0x3268f9,_0xa7927e){var _0xcb32e8={'widths':_[_0xfb89('0x13')](Array(_0x3268f9[_0xfb89('0x14')]),0x91),'heights':function(_0x235de7){return _0x235de7===0x0?_0xfb89('0x15'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x397adc=getHeaders(_0x3268f9);_0xcb32e8['body']['push'](_0x397adc);var _0x1ac7b7=getRows(_0x3268f9,_0xa7927e);_0xcb32e8['body']=_0xcb32e8[_0xfb89('0x16')][_0xfb89('0x17')](_0x1ac7b7);return _0xcb32e8;}function createTables(_0x25a303){var _0x5cf2cf=[];var _0x3edf20=_[_0xfb89('0x18')](Object[_0xfb89('0x19')](_0x25a303[0x0]),0x5);_0x3edf20[_0xfb89('0x1a')](function(_0x57e21c){_0x5cf2cf[_0xfb89('0x1b')](createTable(_0x57e21c,_0x25a303));});return _0x5cf2cf;}function getPDFDocDefinition(_0x40fedc){var _0x3e9a90=util[_0xfb89('0x1c')](_0xfb89('0x1d'),NAME,EXTRACTED_REPORT[_0xfb89('0x1e')],moment(EXTRACTED_REPORT['startDate'])['format'](FORMAT),moment(EXTRACTED_REPORT[_0xfb89('0x1f')])[_0xfb89('0x1c')](FORMAT));var _0x2f554c=[];for(var _0x3836fa=0x0;_0x3836fa<_0x40fedc[_0xfb89('0x14')];_0x3836fa++){var _0x103d83=[];if(_0x3836fa===0x0){_0x103d83[_0xfb89('0x1b')]({'text':_0x3e9a90,'style':_0xfb89('0x20')});}var _0x27e566={'table':_0x40fedc[_0x3836fa]};if(_0x3836fa>0x0){_0x27e566['pageBreak']='before';_0x27e566[_0xfb89('0x21')]=[0x0,0x46,0x0,0x0];}_0x103d83[_0xfb89('0x1b')](_0x27e566);_0x2f554c[_0xfb89('0x1b')](_0x103d83);}return{'pageSize':'A4','pageOrientation':_0xfb89('0x22'),'content':_0x2f554c,'footer':function(_0x177a32,_0x107b60){return{'text':_0x177a32[_0xfb89('0x11')]()+_0xfb89('0x23')+_0x107b60,'style':'footer'};},'defaultStyle':{'font':_0xfb89('0x24')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xfb89('0x25')},'footer':{'alignment':_0xfb89('0x26'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x51e2c5){var _0x44370f=0x1388;var _0x3606ab;if(!_0x51e2c5[0x0][_0xfb89('0x27')]){return analyticExtractedReport('Empty');}return db['Setting'][_0xfb89('0x28')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xfb89('0x29'),'splitSizePdf']})[_0xfb89('0x2a')](function(_0x31e693){if(_0x31e693){_0x3606ab=_0x31e693;_0x44370f=_0x3606ab[_0xfb89('0x2b')]||0x3e8;}})[_0xfb89('0x2a')](function(){var _0x17f1a3=[];var _0x40a0fd=0x0;if(_0x3606ab[_0xfb89('0x29')]){if(_0x51e2c5&&_0x51e2c5[_0xfb89('0x14')]){var _0x3ad74b=_['range'](_0x51e2c5[0x0][_0xfb89('0x27')]/_0x44370f);var _0x4e2bcb=Number[_0xfb89('0x2c')](_0x51e2c5[0x0][_0xfb89('0x27')]/_0x44370f)?_0x51e2c5[0x0][_0xfb89('0x27')]%_0x44370f:0x0;_0x3ad74b[_0xfb89('0x1a')](function(_0x420c7e){if(_0x420c7e>0x0){_0x40a0fd+=_0x44370f;}_0x17f1a3[_0xfb89('0x1b')](dbH['sequelize'][_0xfb89('0x2d')](util[_0xfb89('0x1c')](_0xfb89('0x2e'),QUERY,_0x44370f,_0x40a0fd),{'type':dbH[_0xfb89('0x2f')][_0xfb89('0x30')]['SELECT']}));});if(_0x4e2bcb>0x0){_0x40a0fd+=_0x44370f;_0x17f1a3['push'](dbH[_0xfb89('0x2f')][_0xfb89('0x2d')](util[_0xfb89('0x1c')](_0xfb89('0x2e'),QUERY,_0x4e2bcb,_0x40a0fd),{'type':dbH[_0xfb89('0x2f')]['QueryTypes'][_0xfb89('0x31')]}));}}}else{_0x17f1a3[_0xfb89('0x1b')](dbH[_0xfb89('0x2f')][_0xfb89('0x2d')](QUERY,{'type':dbH[_0xfb89('0x2f')][_0xfb89('0x30')][_0xfb89('0x31')]}));}var _0x4d0f21=path[_0xfb89('0x32')](PATH);var _0x4128e9=path[_0xfb89('0x33')](PATH,'.pdf');var _0x4a0fed=_0x3606ab[_0xfb89('0x29')]&&_0x17f1a3[_0xfb89('0x14')]>0x1;var _0xd5e0fc=[];if(!fs[_0xfb89('0x34')](path[_0xfb89('0x35')](_0x4d0f21,_0x4128e9))&&_0x4a0fed){fs[_0xfb89('0x36')](path[_0xfb89('0x35')](_0x4d0f21,_0x4128e9));}return BPromise['each'](_0x17f1a3,function(_0x553372){_0xd5e0fc[_0xfb89('0x1b')](_0x553372);})[_0xfb89('0x2a')](function(){var _0x8c9eec=[];for(var _0x5eed45=0x0;_0x5eed45<_0xd5e0fc[_0xfb89('0x14')];_0x5eed45+=0x1){var _0x3fa943=_0xd5e0fc[_0x5eed45];var _0x3810bb=createTables(_[_0xfb89('0x37')](_0x3fa943));var _0x1a4bc8;var _0x35c40e=getPDFDocDefinition(_0x3810bb);var _0x4c6a03=getPDFPrinter();var _0x122c54=_0x4c6a03[_0xfb89('0x38')](_0x35c40e);if(_0x4a0fed){_0x1a4bc8=path[_0xfb89('0x35')](_0x4d0f21,_0x4128e9,util['format']('%s%d.%s',_0x4128e9,_0x5eed45,_0xfb89('0x39')));}else{_0x1a4bc8=path[_0xfb89('0x35')](_0x4d0f21,util[_0xfb89('0x1c')](_0xfb89('0x3a'),_0x4128e9,'pdf'));}_0x8c9eec[_0xfb89('0x1b')](writePDFDocument(_0x122c54,_0x1a4bc8));}return Promise['all'](_0x8c9eec);})[_0xfb89('0x2a')](function(){if(_0x4a0fed){return new Promise(function(_0x3730ef){zipdir(path['join'](_0x4d0f21,_0x4128e9),{'saveTo':path['join'](_0x4d0f21,util['format'](_0xfb89('0x3a'),_0x4128e9,_0xfb89('0x3b')))},function(){rimraf(path[_0xfb89('0x35')](_0x4d0f21,_0x4128e9),function(){});_0x3730ef(_0xfb89('0x3c'));});});}})[_0xfb89('0x2a')](function(){if(!_0x4a0fed)return;rimraf(path[_0xfb89('0x35')](_0x4d0f21,_0x4128e9),function(){});})[_0xfb89('0x2a')](function(){logger['info'](util[_0xfb89('0x1c')](_0xfb89('0x3d'),EXTRACTED_REPORT_ID,_0xfb89('0x3e')));return analyticExtractedReport(_0xfb89('0x3f'),_0x4a0fed?util['format'](_0xfb89('0x3a'),_0x4128e9,_0x4a0fed?'zip':_0xfb89('0x39')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0xfb89('0x40')](util[_0xfb89('0x1c')](_0xfb89('0x41'),EXTRACTED_REPORT_ID,_0xfb89('0x3e')));return db[_0xfb89('0xd')][_0xfb89('0x42')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xfb89('0x2a')](function(_0x27e3c4){EXTRACTED_REPORT=_0x27e3c4;return dbH[_0xfb89('0x2f')][_0xfb89('0x2d')](util[_0xfb89('0x1c')](_0xfb89('0x43'),QUERY),{'type':dbH[_0xfb89('0x2f')]['QueryTypes'][_0xfb89('0x31')]});})['then'](extractReport)['catch'](function(_0x300329){logger[_0xfb89('0x40')](util[_0xfb89('0x1c')](_0xfb89('0x44'),EXTRACTED_REPORT_ID,'PDF'),util['inspect'](_0x300329,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0xfb89('0x45')](function(){process[_0xfb89('0x46')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x5250a0=new PdfPrinter({'Arial':{'normal':__dirname+_0xfb89('0x47'),'bold':__dirname+_0xfb89('0x48'),'italics':__dirname+_0xfb89('0x49'),'bolditalics':__dirname+'/fonts/arial-bold-italic.ttf'}});return _0x5250a0;}function getPDFDocDefinitionFromHTML(_0x42177e,_0x43e7b3){var _0x3c228f=util[_0xfb89('0x1c')](_0xfb89('0x4a'),_0x43e7b3[_0xfb89('0x4b')],_0x43e7b3[_0xfb89('0x4c')]);var _0x3a1923=moment()[_0xfb89('0x1c')](_0xfb89('0x4d'))[_0xfb89('0x11')]();var _0x268e6a=htmlToPdfmake(_0x42177e,{'window':window,'tableAutoSize':!![]});return{'content':[_0x268e6a],'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0xfb89('0x4e'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0xfb89('0x4e'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':'center'}},'header':function(){return[{'text':'Interaction\x20Transcript','style':_0xfb89('0x20')}];},'footer':function(_0x3adc1c,_0x56d619){return[{'text':util['format'](_0xfb89('0x4f'),_0x3c228f,_0x3adc1c,_0x56d619,_0x3a1923),'style':_0xfb89('0x50')}];}};}function writePDFDocument(_0x1f6a10,_0x326bf5){return new Promise(function(_0x3564ef,_0x1434fe){var _0x579ca8=_0x1f6a10['pipe'](fs[_0xfb89('0x51')](_0x326bf5));_0x579ca8['on'](_0xfb89('0x52'),function(){_0x3564ef(_0xfb89('0x52'));});_0x579ca8['on'](_0xfb89('0x53'),function(_0x270a96){_0x1434fe(_0x270a96);});_0x1f6a10[_0xfb89('0x54')]();});}exports[_0xfb89('0x55')]=function(_0x5daa19,_0x2ecec0){var _0x3940a5=getPDFPrinter();var _0x19e5ca=getPDFDocDefinitionFromHTML(_0x5daa19,_0x2ecec0);var _0x5d3151=_0x3940a5[_0xfb89('0x38')](_0x19e5ca);return writePDFDocument(_0x5d3151,_0x2ecec0['path'])[_0xfb89('0x56')](function(_0x6d579c){throw _0x6d579c;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index d2ead92..292c5fe 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 _0x93b5=['format','XLSX','find','split','then','splitSizeXlsx','sequelize','QueryTypes','SELECT','Empty','length','num','isInteger','push','query','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.xlsx','join','mkdirSync','each','xlsx','%s.%s','writeFileSync','binary','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','util','path','bluebird','zip-dir','rimraf','../../mysqldb','dbH','argv','savename','update','info'];(function(_0x2eec39,_0x24b14d){var _0x429715=function(_0x5def86){while(--_0x5def86){_0x2eec39['push'](_0x2eec39['shift']());}};_0x429715(++_0x24b14d);}(_0x93b5,0x178));var _0x593b=function(_0xb9121d,_0xd091ca){_0xb9121d=_0xb9121d-0x0;var _0x4d2fc4=_0x93b5[_0xb9121d];return _0x4d2fc4;};'use strict';var util=require(_0x593b('0x0'));var path=require(_0x593b('0x1'));var _=require('lodash');var fs=require('fs');var json2xls=require('json2xls');var BPromise=require(_0x593b('0x2'));var zipdir=require(_0x593b('0x3'));var rimraf=require(_0x593b('0x4'));var db=require(_0x593b('0x5'))['db'];var dbH=require('../../mysqldb')[_0x593b('0x6')];var logger=require('../../config/logger')('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x593b('0x7')][0x2]);var QUERY=process[_0x593b('0x7')][0x3];var PATH=process[_0x593b('0x7')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x11f366,_0x1ba963){var _0x5dddbc={'status':_0x11f366};var _0x53dddf={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1ba963){_0x5dddbc[_0x593b('0x8')]=_0x1ba963;}return db['AnalyticExtractedReport'][_0x593b('0x9')](_0x5dddbc,_0x53dddf);}function main(){var _0xfeb441=0x1388;var _0x3b0162;logger[_0x593b('0xa')](util[_0x593b('0xb')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x593b('0xc')));return db['Setting'][_0x593b('0xd')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x593b('0xe'),'splitSizeXlsx']})[_0x593b('0xf')](function(_0x127148){if(_0x127148){_0x3b0162=_0x127148;_0xfeb441=_0x3b0162[_0x593b('0x10')]||0x1388;}})[_0x593b('0xf')](function(){return dbH[_0x593b('0x11')]['query'](util[_0x593b('0xb')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x593b('0x11')][_0x593b('0x12')][_0x593b('0x13')]});})[_0x593b('0xf')](function(_0x2d7631){if(!_0x2d7631[0x0]['num']){return analyticExtractedReport(_0x593b('0x14'));}var _0x16311e=[];var _0x4d9b9d=0x0;if(_0x3b0162[_0x593b('0xe')]){if(_0x2d7631&&_0x2d7631[_0x593b('0x15')]){var _0x388f1f=_['range'](_0x2d7631[0x0][_0x593b('0x16')]/_0xfeb441);var _0x280de5=Number[_0x593b('0x17')](_0x2d7631[0x0][_0x593b('0x16')]/_0xfeb441)?_0x2d7631[0x0][_0x593b('0x16')]%_0xfeb441:0x0;_0x388f1f['forEach'](function(_0x532f7e){if(_0x532f7e>0x0){_0x4d9b9d+=_0xfeb441;}_0x16311e[_0x593b('0x18')](dbH[_0x593b('0x11')][_0x593b('0x19')](util['format'](_0x593b('0x1a'),QUERY,_0xfeb441,_0x4d9b9d),{'type':dbH['sequelize'][_0x593b('0x12')]['SELECT']}));});if(_0x280de5>0x0){_0x4d9b9d+=_0xfeb441;_0x16311e[_0x593b('0x18')](dbH[_0x593b('0x11')][_0x593b('0x19')](util[_0x593b('0xb')](_0x593b('0x1a'),QUERY,_0x280de5,_0x4d9b9d),{'type':dbH[_0x593b('0x11')][_0x593b('0x12')][_0x593b('0x13')]}));}}}else{_0x16311e['push'](dbH[_0x593b('0x11')][_0x593b('0x19')](QUERY,{'type':dbH[_0x593b('0x11')][_0x593b('0x12')][_0x593b('0x13')]}));}var _0x55c813=path[_0x593b('0x1b')](PATH);var _0x3a34d2=path[_0x593b('0x1c')](PATH,_0x593b('0x1d'));var _0x4bb67b=_0x3b0162[_0x593b('0xe')]&&_0x16311e[_0x593b('0x15')]>0x1;var _0x189863=[];if(!fs['existsSync'](path[_0x593b('0x1e')](_0x55c813,_0x3a34d2))&&_0x4bb67b){fs[_0x593b('0x1f')](path[_0x593b('0x1e')](_0x55c813,_0x3a34d2));}return BPromise[_0x593b('0x20')](_0x16311e,function(_0x4f3917){_0x189863['push'](_0x4f3917);})[_0x593b('0xf')](function(){for(var _0x3341d1=0x0;_0x3341d1<_0x189863[_0x593b('0x15')];_0x3341d1+=0x1){var _0x781630;var _0x335d55=_0x189863[_0x3341d1];if(_0x4bb67b){_0x781630=path[_0x593b('0x1e')](_0x55c813,_0x3a34d2,util[_0x593b('0xb')]('%s%d.%s',_0x3a34d2,_0x3341d1,_0x593b('0x21')));}else{_0x781630=path['join'](_0x55c813,util[_0x593b('0xb')](_0x593b('0x22'),_0x3a34d2,_0x593b('0x21')));}fs[_0x593b('0x23')](_0x781630,json2xls(_0x335d55),_0x593b('0x24'));}})[_0x593b('0xf')](function(){if(_0x4bb67b){return new Promise(function(_0x19b84b){zipdir(path['join'](_0x55c813,_0x3a34d2),{'saveTo':path['join'](_0x55c813,util[_0x593b('0xb')](_0x593b('0x22'),_0x3a34d2,_0x593b('0x25')))},function(_0x4f73e4,_0x28b78a){rimraf(path['join'](_0x55c813,_0x3a34d2),function(){});_0x19b84b('zip\x20finished');});});}})[_0x593b('0xf')](function(){logger[_0x593b('0xa')](util[_0x593b('0xb')](_0x593b('0x26'),EXTRACTED_REPORT_ID,_0x593b('0xc')));return analyticExtractedReport(_0x593b('0x27'),_0x4bb67b?util[_0x593b('0xb')](_0x593b('0x22'),_0x3a34d2,_0x4bb67b?_0x593b('0x25'):_0x593b('0x21')):null);});})[_0x593b('0x28')](function(_0x477ffc){logger[_0x593b('0xa')](util[_0x593b('0xb')](_0x593b('0x29'),EXTRACTED_REPORT_ID,_0x593b('0xc')),util[_0x593b('0x2a')](_0x477ffc,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})['finally'](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file +var _0x953d=['zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','XLSX','Completed','%s.%s','inspect','Failed','finally','exit','path','lodash','json2xls','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','savename','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','find','split','splitSizeXlsx','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','range','isInteger','forEach','push','basename','.xlsx','length','existsSync','join','mkdirSync','xlsx'];(function(_0x215b36,_0x1c1dba){var _0xefc45e=function(_0x3c4faf){while(--_0x3c4faf){_0x215b36['push'](_0x215b36['shift']());}};_0xefc45e(++_0x1c1dba);}(_0x953d,0x93));var _0xd953=function(_0x9c0817,_0x50058d){_0x9c0817=_0x9c0817-0x0;var _0x396086=_0x953d[_0x9c0817];return _0x396086;};'use strict';var util=require('util');var path=require(_0xd953('0x0'));var _=require(_0xd953('0x1'));var fs=require('fs');var json2xls=require(_0xd953('0x2'));var BPromise=require('bluebird');var zipdir=require(_0xd953('0x3'));var rimraf=require(_0xd953('0x4'));var db=require(_0xd953('0x5'))['db'];var dbH=require(_0xd953('0x5'))[_0xd953('0x6')];var logger=require(_0xd953('0x7'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xd953('0x8')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0xd953('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x5d3207,_0x4fe408){var _0x4a77b6={'status':_0x5d3207};var _0x4a4116={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x4fe408){_0x4a77b6[_0xd953('0x9')]=_0x4fe408;}return db['AnalyticExtractedReport'][_0xd953('0xa')](_0x4a77b6,_0x4a4116);}function main(){var _0x353826=0x1388;var _0x4747c2;logger[_0xd953('0xb')](util[_0xd953('0xc')](_0xd953('0xd'),EXTRACTED_REPORT_ID,'XLSX'));return db[_0xd953('0xe')][_0xd953('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xd953('0x10'),_0xd953('0x11')]})[_0xd953('0x12')](function(_0xec346d){if(_0xec346d){_0x4747c2=_0xec346d;_0x353826=_0x4747c2[_0xd953('0x11')]||0x1388;}})[_0xd953('0x12')](function(){return dbH[_0xd953('0x13')][_0xd953('0x14')](util['format'](_0xd953('0x15'),QUERY),{'type':dbH['sequelize'][_0xd953('0x16')][_0xd953('0x17')]});})['then'](function(_0x350386){if(!_0x350386[0x0][_0xd953('0x18')]){return analyticExtractedReport(_0xd953('0x19'));}var _0x2e268f=[];var _0x8dcf90=0x0;if(_0x4747c2['split']){if(_0x350386&&_0x350386['length']){var _0x131ccd=_[_0xd953('0x1a')](_0x350386[0x0][_0xd953('0x18')]/_0x353826);var _0x2e6e21=Number[_0xd953('0x1b')](_0x350386[0x0]['num']/_0x353826)?_0x350386[0x0]['num']%_0x353826:0x0;_0x131ccd[_0xd953('0x1c')](function(_0x3beeea){if(_0x3beeea>0x0){_0x8dcf90+=_0x353826;}_0x2e268f['push'](dbH[_0xd953('0x13')][_0xd953('0x14')](util[_0xd953('0xc')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x353826,_0x8dcf90),{'type':dbH[_0xd953('0x13')]['QueryTypes'][_0xd953('0x17')]}));});if(_0x2e6e21>0x0){_0x8dcf90+=_0x353826;_0x2e268f[_0xd953('0x1d')](dbH[_0xd953('0x13')]['query'](util[_0xd953('0xc')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x2e6e21,_0x8dcf90),{'type':dbH[_0xd953('0x13')]['QueryTypes'][_0xd953('0x17')]}));}}}else{_0x2e268f[_0xd953('0x1d')](dbH['sequelize'][_0xd953('0x14')](QUERY,{'type':dbH[_0xd953('0x13')]['QueryTypes'][_0xd953('0x17')]}));}var _0x5a9411=path['dirname'](PATH);var _0x982bde=path[_0xd953('0x1e')](PATH,_0xd953('0x1f'));var _0x335233=_0x4747c2[_0xd953('0x10')]&&_0x2e268f[_0xd953('0x20')]>0x1;var _0x3218c0=[];if(!fs[_0xd953('0x21')](path[_0xd953('0x22')](_0x5a9411,_0x982bde))&&_0x335233){fs[_0xd953('0x23')](path[_0xd953('0x22')](_0x5a9411,_0x982bde));}return BPromise['each'](_0x2e268f,function(_0x25a18b){_0x3218c0[_0xd953('0x1d')](_0x25a18b);})[_0xd953('0x12')](function(){for(var _0x37c8aa=0x0;_0x37c8aa<_0x3218c0[_0xd953('0x20')];_0x37c8aa+=0x1){var _0x237941;var _0x248643=_0x3218c0[_0x37c8aa];if(_0x335233){_0x237941=path[_0xd953('0x22')](_0x5a9411,_0x982bde,util[_0xd953('0xc')]('%s%d.%s',_0x982bde,_0x37c8aa,_0xd953('0x24')));}else{_0x237941=path['join'](_0x5a9411,util[_0xd953('0xc')]('%s.%s',_0x982bde,_0xd953('0x24')));}fs['writeFileSync'](_0x237941,json2xls(_0x248643),'binary');}})[_0xd953('0x12')](function(){if(_0x335233){return new Promise(function(_0x5eeed3){zipdir(path[_0xd953('0x22')](_0x5a9411,_0x982bde),{'saveTo':path[_0xd953('0x22')](_0x5a9411,util[_0xd953('0xc')]('%s.%s',_0x982bde,_0xd953('0x25')))},function(_0x44aae4,_0x25537f){rimraf(path[_0xd953('0x22')](_0x5a9411,_0x982bde),function(){});_0x5eeed3('zip\x20finished');});});}})[_0xd953('0x12')](function(){logger[_0xd953('0xb')](util[_0xd953('0xc')](_0xd953('0x26'),EXTRACTED_REPORT_ID,_0xd953('0x27')));return analyticExtractedReport(_0xd953('0x28'),_0x335233?util[_0xd953('0xc')](_0xd953('0x29'),_0x982bde,_0x335233?_0xd953('0x25'):'xlsx'):null);});})['catch'](function(_0x4d6115){logger[_0xd953('0xb')](util[_0xd953('0xc')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'XLSX'),util[_0xd953('0x2a')](_0x4d6115,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xd953('0x2b'));})[_0xd953('0x2c')](function(){process[_0xd953('0x2d')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 6775738..d44ca0d 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 _0xde9e=['then','intervals','IntervalId','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback','hasOwnProperty','priority','extensions','extension','find','format','CDR(type)=%s','type','context','VoiceExtensionId','inbound','CDR(routeid)=','outbound','push','Set','CDR(destination)=','cutdigits','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','length','toLowerCase','createdAt','updatedAt','interval','*,*,*,*','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','transaction','VoiceExtension','destroy','sortBy','error','rewrite','lodash','util','models','Interval','findAll'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0xde9e,0xe2));var _0xede9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xde9e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xede9('0x0'));var util=require(_0xede9('0x1'));function rewrite(_0x1c819b,_0xcd01d){var _0x24ac4f=this;return _0x1c819b[_0xede9('0x2')][_0xede9('0x3')][_0xede9('0x4')]({'raw':!![]})[_0xede9('0x5')](function(_0x19ae72){_0x24ac4f[_0xede9('0x6')]=_0x19ae72;return _0x1c819b[_0xede9('0x2')]['VoiceExtension'][_0xede9('0x4')]({'where':{'IntervalId':_0xcd01d[_0xede9('0x7')]},'raw':!![]});})[_0xede9('0x5')](function(_0x3e03d7){return _0x1c819b[_0xede9('0x2')]['VoiceExtension'][_0xede9('0x4')]({'where':{'exten':{'$in':_[_0xede9('0x8')](_[_0xede9('0x9')](_0x3e03d7,_0xede9('0xa')))}},'order':[{'raw':_0xede9('0xb')}],'raw':!![]});})['then'](function(_0x41f3f8){var _0x5ada3=_[_0xede9('0xc')](_0x41f3f8,{'priority':'1'});var _0x5482f2=_[_0xede9('0xc')](_0x41f3f8,{'isApp':0x1});var _0x4fc681=_[_0xede9('0xd')](_0x5482f2,_0xede9('0xa'));var _0x27f277=[_0xede9('0xe'),_0xede9('0xf')];var _0x5688a6=[];var _0x198e4b=[];for(var _0xa231b1 in _0x4fc681){if(_0x4fc681[_0xede9('0x10')](_0xa231b1)){_0x24ac4f[_0xede9('0x11')]=0x2;_0x24ac4f[_0xede9('0x12')]=[];_0x24ac4f[_0xede9('0x13')]=_[_0xede9('0x14')](_0x5ada3,{'exten':_0x4fc681[_0xa231b1][0x0][_0xede9('0xa')]});_0x24ac4f[_0xede9('0x12')]['push']({'type':_0x4fc681[_0xa231b1][0x0]['type'],'app':'Set','appdata':util[_0xede9('0x15')](_0xede9('0x16'),_0x4fc681[_0xa231b1][0x0][_0xede9('0x17')]),'context':_0x4fc681[_0xa231b1][0x0][_0xede9('0x18')],'exten':_0x4fc681[_0xa231b1][0x0][_0xede9('0xa')],'priority':_0x24ac4f[_0xede9('0x11')]++,'VoiceExtensionId':_0x4fc681[_0xa231b1][0x0][_0xede9('0x19')]});if(_0x4fc681[_0xa231b1][0x0][_0xede9('0x17')]===_0xede9('0x1a')){_0x24ac4f['extensions']['push']({'type':_0x4fc681[_0xa231b1][0x0]['type'],'app':'Set','appdata':_0xede9('0x1b')+_0x4fc681[_0xa231b1][0x0][_0xede9('0x19')],'context':_0x4fc681[_0xa231b1][0x0][_0xede9('0x18')],'exten':_0x4fc681[_0xa231b1][0x0]['exten'],'priority':_0x24ac4f['priority']++,'VoiceExtensionId':_0x4fc681[_0xa231b1][0x0][_0xede9('0x19')]});}else if(_0x4fc681[_0xa231b1][0x0][_0xede9('0x17')]===_0xede9('0x1c')){if(_0x24ac4f[_0xede9('0x13')]){_0x24ac4f['extensions'][_0xede9('0x1d')]({'type':_0x4fc681[_0xa231b1][0x0][_0xede9('0x17')],'app':_0xede9('0x1e'),'appdata':_0xede9('0x1f')+(_0x24ac4f[_0xede9('0x13')]['cutdigits']?'${EXTEN:'+_0x24ac4f[_0xede9('0x13')][_0xede9('0x20')]+'}':_0xede9('0x21')),'context':_0x4fc681[_0xa231b1][0x0][_0xede9('0x18')],'exten':_0x4fc681[_0xa231b1][0x0][_0xede9('0xa')],'priority':_0x24ac4f[_0xede9('0x11')]++,'VoiceExtensionId':_0x4fc681[_0xa231b1][0x0]['VoiceExtensionId']});}_0x24ac4f[_0xede9('0x12')][_0xede9('0x1d')]({'type':_0x4fc681[_0xa231b1][0x0][_0xede9('0x17')],'app':_0xede9('0x1e'),'appdata':'CDR(routeid)='+_0x4fc681[_0xa231b1][0x0][_0xede9('0x19')],'context':_0x4fc681[_0xa231b1][0x0][_0xede9('0x18')],'exten':_0x4fc681[_0xa231b1][0x0]['exten'],'priority':_0x24ac4f['priority']++,'VoiceExtensionId':_0x4fc681[_0xa231b1][0x0][_0xede9('0x19')]});var _0xab5c80=_0x24ac4f['priority']++;_0x24ac4f['extensions'][_0xede9('0x1d')]({'type':_0x4fc681[_0xa231b1][0x0][_0xede9('0x17')],'app':_0xede9('0x22'),'appdata':_0xede9('0x23')+(_0xab5c80+0x2)+_0xede9('0x24')+(_0xab5c80+0x1)+')','context':_0x4fc681[_0xa231b1][0x0][_0xede9('0x18')],'exten':_0x4fc681[_0xa231b1][0x0][_0xede9('0xa')],'priority':_0xab5c80,'VoiceExtensionId':_0x4fc681[_0xa231b1][0x0][_0xede9('0x19')]});if(_0x24ac4f[_0xede9('0x13')]){_0x24ac4f[_0xede9('0x12')][_0xede9('0x1d')]({'type':_0x4fc681[_0xa231b1][0x0][_0xede9('0x17')],'app':'Set','appdata':_0x24ac4f[_0xede9('0x13')][_0xede9('0x20')]?_0xede9('0x25')+_0x24ac4f[_0xede9('0x13')]['cutdigits']+'}':_0xede9('0x26'),'context':_0x4fc681[_0xa231b1][0x0][_0xede9('0x18')],'exten':_0x4fc681[_0xa231b1][0x0][_0xede9('0xa')],'priority':_0x24ac4f[_0xede9('0x11')]++,'VoiceExtensionId':_0x4fc681[_0xa231b1][0x0][_0xede9('0x19')]});}_0x24ac4f[_0xede9('0x12')][_0xede9('0x1d')]({'type':_0x4fc681[_0xa231b1][0x0][_0xede9('0x17')],'app':'Set','appdata':_0xede9('0x27')+_0x4fc681[_0xa231b1][0x0][_0xede9('0x19')],'context':_0x4fc681[_0xa231b1][0x0][_0xede9('0x18')],'exten':_0x4fc681[_0xa231b1][0x0]['exten'],'priority':_0x24ac4f[_0xede9('0x11')]++,'VoiceExtensionId':_0x4fc681[_0xa231b1][0x0][_0xede9('0x19')]});if(_0x24ac4f[_0xede9('0x13')]&&_0x24ac4f[_0xede9('0x13')]['hasOwnProperty'](_0xede9('0x28'))&&_0x24ac4f['extension'][_0xede9('0x28')]!==_0xede9('0x29')){_0x24ac4f[_0xede9('0x12')][_0xede9('0x1d')]({'type':_0x4fc681[_0xa231b1][0x0][_0xede9('0x17')],'app':'Set','appdata':_0xede9('0x2a'),'context':_0x4fc681[_0xa231b1][0x0][_0xede9('0x18')],'exten':_0x4fc681[_0xa231b1][0x0][_0xede9('0xa')],'priority':_0x24ac4f[_0xede9('0x11')]++,'VoiceExtensionId':_0x4fc681[_0xa231b1][0x0][_0xede9('0x19')]});_0x24ac4f[_0xede9('0x12')][_0xede9('0x1d')]({'type':_0x4fc681[_0xa231b1][0x0][_0xede9('0x17')],'app':_0xede9('0x1e'),'appdata':_0xede9('0x2b')+_0x24ac4f[_0xede9('0x13')][_0xede9('0x28')]||_0xede9('0x2c'),'context':_0x4fc681[_0xa231b1][0x0][_0xede9('0x18')],'exten':_0x4fc681[_0xa231b1][0x0][_0xede9('0xa')],'priority':_0x24ac4f[_0xede9('0x11')]++,'VoiceExtensionId':_0x4fc681[_0xa231b1][0x0]['VoiceExtensionId']});}}_0x24ac4f[_0xede9('0x12')][_0xede9('0x1d')]({'type':_0x4fc681[_0xa231b1][0x0][_0xede9('0x17')],'app':_0xede9('0x1e'),'appdata':_0xede9('0x2d'),'context':_0x4fc681[_0xa231b1][0x0][_0xede9('0x18')],'exten':_0x4fc681[_0xa231b1][0x0]['exten'],'priority':_0x24ac4f[_0xede9('0x11')]++,'VoiceExtensionId':_0x4fc681[_0xa231b1][0x0][_0xede9('0x19')]});_0x24ac4f['extensions'][_0xede9('0x1d')]({'type':_0x4fc681[_0xa231b1][0x0]['type'],'app':_0xede9('0x1e'),'appdata':_0xede9('0x2e'),'context':_0x4fc681[_0xa231b1][0x0][_0xede9('0x18')],'exten':_0x4fc681[_0xa231b1][0x0][_0xede9('0xa')],'priority':_0x24ac4f['priority']++,'VoiceExtensionId':_0x4fc681[_0xa231b1][0x0][_0xede9('0x19')]});_0x24ac4f[_0xede9('0x12')]['push']({'type':_0x4fc681[_0xa231b1][0x0][_0xede9('0x17')],'app':'Set','appdata':'MONITOR_OPTIONS=ab','context':_0x4fc681[_0xa231b1][0x0][_0xede9('0x18')],'exten':_0x4fc681[_0xa231b1][0x0][_0xede9('0xa')],'priority':_0x24ac4f[_0xede9('0x11')]++,'VoiceExtensionId':_0x4fc681[_0xa231b1][0x0][_0xede9('0x19')]});for(var _0xd4a0fb=0x0,_0x248aae=0x0;_0xd4a0fb<_0x4fc681[_0xa231b1][_0xede9('0x2f')];_0xd4a0fb+=0x1,_0x248aae=0x0){var _0x4bc4b9=_0x4fc681[_0xa231b1][_0xd4a0fb];if(_0x4bc4b9[_0xede9('0x17')]){_0x4bc4b9['type']=_0x4bc4b9['type'][_0xede9('0x30')]();}var _0x8e3a1a=[];var _0x3286f6=[];delete _0x4bc4b9['id'];delete _0x4bc4b9[_0xede9('0x31')];delete _0x4bc4b9[_0xede9('0x32')];var _0x3b370d=_0x4bc4b9[_0xede9('0x33')]!==_0xede9('0x34')?[_0x4bc4b9[_0xede9('0x33')]]:_0x4bc4b9[_0xede9('0x7')]?_[_0xede9('0x9')](_[_0xede9('0xc')](_0x24ac4f[_0xede9('0x6')],{'IntervalId':_0x4bc4b9[_0xede9('0x7')]}),_0xede9('0x33')):[];if(_0x4bc4b9['hasOwnProperty'](_0xede9('0x35'))){if(_0x4bc4b9[_0xede9('0x35')]&&_0x4bc4b9[_0xede9('0x35')]!=='--'){_0x8e3a1a[_0xede9('0x1d')]({'type':_0x4bc4b9[_0xede9('0x17')],'app':_0xede9('0x1e'),'appdata':_0xede9('0x36')+_0x4bc4b9['tag'],'context':_0x4bc4b9[_0xede9('0x18')],'exten':_0x4bc4b9[_0xede9('0xa')],'priority':_0x3b370d[_0xede9('0x2f')]+_0x24ac4f[_0xede9('0x11')]+_0x248aae++,'VoiceExtensionId':_0x4bc4b9[_0xede9('0x19')]});}}if(_0x4bc4b9[_0xede9('0x17')]===_0xede9('0x1c')&&_0x4bc4b9[_0xede9('0x10')](_0xede9('0x37'))){if(_0x4bc4b9[_0xede9('0x37')]){_0x8e3a1a[_0xede9('0x1d')]({'type':_0x4bc4b9[_0xede9('0x17')],'app':'ExecIf','appdata':_0xede9('0x38')+_0x4bc4b9['callerID']+')','context':_0x4bc4b9[_0xede9('0x18')],'exten':_0x4bc4b9[_0xede9('0xa')],'priority':_0x3b370d['length']+_0x24ac4f[_0xede9('0x11')]+_0x248aae++,'VoiceExtensionId':_0x4bc4b9['VoiceExtensionId']});}else{_0x8e3a1a['push']({'type':_0x4bc4b9[_0xede9('0x17')],'app':_0xede9('0x22'),'appdata':_0xede9('0x39'),'context':_0x4bc4b9['context'],'exten':_0x4bc4b9[_0xede9('0xa')],'priority':_0x3b370d[_0xede9('0x2f')]+_0x24ac4f['priority']+_0x248aae++,'VoiceExtensionId':_0x4bc4b9['VoiceExtensionId']});}}if(_0x4bc4b9[_0xede9('0x10')](_0xede9('0x3a'))){if(_0x27f277[_0xede9('0x3b')](_0x4bc4b9[_0xede9('0x3c')][_0xede9('0x30')]())>=0x0&&_0x4bc4b9[_0xede9('0x3d')]!==_0xede9('0x3e')){if(_0x4bc4b9[_0xede9('0x3a')]){_0x8e3a1a[_0xede9('0x1d')]({'type':_0x4bc4b9['type'],'app':_0xede9('0x22'),'appdata':_0xede9('0x3f'),'context':_0x4bc4b9[_0xede9('0x18')],'exten':_0x4bc4b9[_0xede9('0xa')],'priority':_0x3b370d[_0xede9('0x2f')]+_0x24ac4f[_0xede9('0x11')]+_0x248aae++,'VoiceExtensionId':_0x4bc4b9[_0xede9('0x19')]});_0x8e3a1a['push']({'type':_0x4bc4b9[_0xede9('0x17')],'app':_0xede9('0x1e'),'appdata':_0xede9('0x40'),'context':_0x4bc4b9['context'],'exten':_0x4bc4b9[_0xede9('0xa')],'priority':_0x3b370d[_0xede9('0x2f')]+_0x24ac4f[_0xede9('0x11')]+_0x248aae++,'VoiceExtensionId':_0x4bc4b9[_0xede9('0x19')]});}else{_0x8e3a1a['push']({'type':_0x4bc4b9['type'],'app':_0xede9('0x22'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x4bc4b9['context'],'exten':_0x4bc4b9[_0xede9('0xa')],'priority':_0x3b370d[_0xede9('0x2f')]+_0x24ac4f[_0xede9('0x11')]+_0x248aae++,'VoiceExtensionId':_0x4bc4b9[_0xede9('0x19')]});_0x8e3a1a[_0xede9('0x1d')]({'type':_0x4bc4b9[_0xede9('0x17')],'app':_0xede9('0x1e'),'appdata':_0xede9('0x41'),'context':_0x4bc4b9[_0xede9('0x18')],'exten':_0x4bc4b9['exten'],'priority':_0x3b370d['length']+_0x24ac4f['priority']+_0x248aae++,'VoiceExtensionId':_0x4bc4b9[_0xede9('0x19')]});}}}for(var _0x1bbfa4=0x0;_0x1bbfa4<_0x3b370d[_0xede9('0x2f')];_0x1bbfa4+=0x1){var _0x133d39=_0x24ac4f[_0xede9('0x11')]+_0x3b370d['length'];var _0xd8eb7f=_0x1bbfa4===_0x3b370d['length']-0x1?_0x24ac4f['priority']+_0x8e3a1a[_0xede9('0x2f')]+_0x3286f6[_0xede9('0x2f')]+0x2:_0x24ac4f[_0xede9('0x11')]+_0x1bbfa4+0x1;_0x8e3a1a[_0xede9('0x42')](_0x1bbfa4,0x0,{'type':_0x4bc4b9[_0xede9('0x17')],'app':_0xede9('0x43'),'appdata':_0x3b370d[_0x1bbfa4]+'?'+_0x4bc4b9[_0xede9('0x18')]+',${EXTEN},'+_0x133d39+':'+_0x4bc4b9[_0xede9('0x18')]+_0xede9('0x44')+_0xd8eb7f,'exten':_0x4bc4b9[_0xede9('0xa')],'context':_0x4bc4b9[_0xede9('0x18')],'priority':_0x24ac4f[_0xede9('0x11')]+_0x1bbfa4,'VoiceExtensionId':_0x4fc681[_0xa231b1][0x0][_0xede9('0x19')]});}_0x4bc4b9[_0xede9('0x11')]=_0x8e3a1a[_0xede9('0x2f')]?_['last'](_0x8e3a1a)[_0xede9('0x11')]+0x1:_0x24ac4f[_0xede9('0x11')];_0x24ac4f[_0xede9('0x11')]=(_0x3286f6[_0xede9('0x2f')]?_[_0xede9('0x45')](_0x3286f6)[_0xede9('0x11')]:_0x4bc4b9[_0xede9('0x11')])+0x1;_0x24ac4f[_0xede9('0x12')]=_[_0xede9('0x46')](_0x24ac4f[_0xede9('0x12')],_0x8e3a1a,[_0x4bc4b9],_0x3286f6);}_0x24ac4f['extensions'][_0xede9('0x1d')]({'type':_0x4fc681[_0xa231b1][0x0][_0xede9('0x17')],'app':'Hangup','exten':_0x4fc681[_0xa231b1][0x0][_0xede9('0xa')],'context':_0x4fc681[_0xa231b1][0x0][_0xede9('0x18')],'priority':_0x24ac4f[_0xede9('0x11')],'VoiceExtensionId':_0x4fc681[_0xa231b1][0x0][_0xede9('0x19')]});_0x5688a6[_0xede9('0x1d')](_0x4fc681[_0xa231b1][0x0]['VoiceExtensionId']);_0x198e4b=_['concat'](_0x198e4b,_0x24ac4f[_0xede9('0x12')]);}}return _0x1c819b[_0xede9('0x47')](function(_0x49a5af){return _0x1c819b[_0xede9('0x2')][_0xede9('0x48')][_0xede9('0x49')]({'where':{'VoiceExtensionId':{'$in':_0x5688a6}},'transaction':_0x49a5af})[_0xede9('0x5')](function(_0x59ba43){return _0x1c819b[_0xede9('0x2')][_0xede9('0x48')]['bulkCreate'](_[_0xede9('0x4a')](_0x198e4b,_0xede9('0x11')),{'transaction':_0x49a5af});});});})['catch'](function(_0xb86b07){console[_0xede9('0x4b')](_0xb86b07);});}exports[_0xede9('0x4c')]=rewrite; \ No newline at end of file +var _0xafe9=['exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','hasOwnProperty','extensions','extension','find','type','Set','context','priority','VoiceExtensionId','inbound','push','CDR(routeid)=','outbound','CDR(destination)=','cutdigits','${EXTEN:','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','updatedAt','interval','*,*,*,*','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','destroy','bulkCreate','sortBy','catch','rewrite','lodash','util','models','Interval','findAll','then','intervals','VoiceExtension','IntervalId','uniq'];(function(_0x2ccddc,_0x40c85c){var _0x3d508c=function(_0x34cf02){while(--_0x34cf02){_0x2ccddc['push'](_0x2ccddc['shift']());}};_0x3d508c(++_0x40c85c);}(_0xafe9,0x112));var _0x9afe=function(_0xbbadb8,_0x6301aa){_0xbbadb8=_0xbbadb8-0x0;var _0x47f4a2=_0xafe9[_0xbbadb8];return _0x47f4a2;};'use strict';var _=require(_0x9afe('0x0'));var util=require(_0x9afe('0x1'));function rewrite(_0x5f5ba2,_0x72d327){var _0x482d5a=this;return _0x5f5ba2[_0x9afe('0x2')][_0x9afe('0x3')][_0x9afe('0x4')]({'raw':!![]})[_0x9afe('0x5')](function(_0x547cb1){_0x482d5a[_0x9afe('0x6')]=_0x547cb1;return _0x5f5ba2[_0x9afe('0x2')][_0x9afe('0x7')][_0x9afe('0x4')]({'where':{'IntervalId':_0x72d327[_0x9afe('0x8')]},'raw':!![]});})['then'](function(_0x35e99f){return _0x5f5ba2['models'][_0x9afe('0x7')][_0x9afe('0x4')]({'where':{'exten':{'$in':_[_0x9afe('0x9')](_['map'](_0x35e99f,_0x9afe('0xa')))}},'order':[{'raw':_0x9afe('0xb')}],'raw':!![]});})[_0x9afe('0x5')](function(_0x314dba){var _0x3dc928=_[_0x9afe('0xc')](_0x314dba,{'priority':'1'});var _0x2404ac=_[_0x9afe('0xc')](_0x314dba,{'isApp':0x1});var _0x3c9832=_[_0x9afe('0xd')](_0x2404ac,_0x9afe('0xa'));var _0x1ac8ac=['queue','playback'];var _0x4792a8=[];var _0x4ff3ac=[];for(var _0x33567f in _0x3c9832){if(_0x3c9832[_0x9afe('0xe')](_0x33567f)){_0x482d5a['priority']=0x2;_0x482d5a[_0x9afe('0xf')]=[];_0x482d5a[_0x9afe('0x10')]=_[_0x9afe('0x11')](_0x3dc928,{'exten':_0x3c9832[_0x33567f][0x0][_0x9afe('0xa')]});_0x482d5a[_0x9afe('0xf')]['push']({'type':_0x3c9832[_0x33567f][0x0][_0x9afe('0x12')],'app':_0x9afe('0x13'),'appdata':util['format']('CDR(type)=%s',_0x3c9832[_0x33567f][0x0][_0x9afe('0x12')]),'context':_0x3c9832[_0x33567f][0x0][_0x9afe('0x14')],'exten':_0x3c9832[_0x33567f][0x0][_0x9afe('0xa')],'priority':_0x482d5a[_0x9afe('0x15')]++,'VoiceExtensionId':_0x3c9832[_0x33567f][0x0][_0x9afe('0x16')]});if(_0x3c9832[_0x33567f][0x0]['type']===_0x9afe('0x17')){_0x482d5a['extensions'][_0x9afe('0x18')]({'type':_0x3c9832[_0x33567f][0x0][_0x9afe('0x12')],'app':_0x9afe('0x13'),'appdata':_0x9afe('0x19')+_0x3c9832[_0x33567f][0x0][_0x9afe('0x16')],'context':_0x3c9832[_0x33567f][0x0][_0x9afe('0x14')],'exten':_0x3c9832[_0x33567f][0x0][_0x9afe('0xa')],'priority':_0x482d5a['priority']++,'VoiceExtensionId':_0x3c9832[_0x33567f][0x0][_0x9afe('0x16')]});}else if(_0x3c9832[_0x33567f][0x0][_0x9afe('0x12')]===_0x9afe('0x1a')){if(_0x482d5a['extension']){_0x482d5a[_0x9afe('0xf')][_0x9afe('0x18')]({'type':_0x3c9832[_0x33567f][0x0][_0x9afe('0x12')],'app':_0x9afe('0x13'),'appdata':_0x9afe('0x1b')+(_0x482d5a[_0x9afe('0x10')][_0x9afe('0x1c')]?_0x9afe('0x1d')+_0x482d5a[_0x9afe('0x10')][_0x9afe('0x1c')]+'}':'${EXTEN}'),'context':_0x3c9832[_0x33567f][0x0][_0x9afe('0x14')],'exten':_0x3c9832[_0x33567f][0x0][_0x9afe('0xa')],'priority':_0x482d5a[_0x9afe('0x15')]++,'VoiceExtensionId':_0x3c9832[_0x33567f][0x0]['VoiceExtensionId']});}_0x482d5a[_0x9afe('0xf')]['push']({'type':_0x3c9832[_0x33567f][0x0]['type'],'app':_0x9afe('0x13'),'appdata':_0x9afe('0x19')+_0x3c9832[_0x33567f][0x0]['VoiceExtensionId'],'context':_0x3c9832[_0x33567f][0x0][_0x9afe('0x14')],'exten':_0x3c9832[_0x33567f][0x0]['exten'],'priority':_0x482d5a[_0x9afe('0x15')]++,'VoiceExtensionId':_0x3c9832[_0x33567f][0x0]['VoiceExtensionId']});var _0x18d7c8=_0x482d5a[_0x9afe('0x15')]++;_0x482d5a[_0x9afe('0xf')][_0x9afe('0x18')]({'type':_0x3c9832[_0x33567f][0x0][_0x9afe('0x12')],'app':'ExecIf','appdata':_0x9afe('0x1e')+(_0x18d7c8+0x2)+_0x9afe('0x1f')+(_0x18d7c8+0x1)+')','context':_0x3c9832[_0x33567f][0x0][_0x9afe('0x14')],'exten':_0x3c9832[_0x33567f][0x0]['exten'],'priority':_0x18d7c8,'VoiceExtensionId':_0x3c9832[_0x33567f][0x0][_0x9afe('0x16')]});if(_0x482d5a[_0x9afe('0x10')]){_0x482d5a['extensions'][_0x9afe('0x18')]({'type':_0x3c9832[_0x33567f][0x0][_0x9afe('0x12')],'app':_0x9afe('0x13'),'appdata':_0x482d5a[_0x9afe('0x10')][_0x9afe('0x1c')]?_0x9afe('0x20')+_0x482d5a[_0x9afe('0x10')][_0x9afe('0x1c')]+'}':_0x9afe('0x21'),'context':_0x3c9832[_0x33567f][0x0][_0x9afe('0x14')],'exten':_0x3c9832[_0x33567f][0x0]['exten'],'priority':_0x482d5a[_0x9afe('0x15')]++,'VoiceExtensionId':_0x3c9832[_0x33567f][0x0][_0x9afe('0x16')]});}_0x482d5a['extensions']['push']({'type':_0x3c9832[_0x33567f][0x0][_0x9afe('0x12')],'app':_0x9afe('0x13'),'appdata':_0x9afe('0x22')+_0x3c9832[_0x33567f][0x0]['VoiceExtensionId'],'context':_0x3c9832[_0x33567f][0x0]['context'],'exten':_0x3c9832[_0x33567f][0x0][_0x9afe('0xa')],'priority':_0x482d5a[_0x9afe('0x15')]++,'VoiceExtensionId':_0x3c9832[_0x33567f][0x0][_0x9afe('0x16')]});if(_0x482d5a[_0x9afe('0x10')]&&_0x482d5a[_0x9afe('0x10')]['hasOwnProperty']('recordingFormat')&&_0x482d5a[_0x9afe('0x10')]['recordingFormat']!=='none'){_0x482d5a[_0x9afe('0xf')]['push']({'type':_0x3c9832[_0x33567f][0x0][_0x9afe('0x12')],'app':_0x9afe('0x13'),'appdata':_0x9afe('0x23'),'context':_0x3c9832[_0x33567f][0x0][_0x9afe('0x14')],'exten':_0x3c9832[_0x33567f][0x0]['exten'],'priority':_0x482d5a[_0x9afe('0x15')]++,'VoiceExtensionId':_0x3c9832[_0x33567f][0x0][_0x9afe('0x16')]});_0x482d5a[_0x9afe('0xf')][_0x9afe('0x18')]({'type':_0x3c9832[_0x33567f][0x0]['type'],'app':_0x9afe('0x13'),'appdata':_0x9afe('0x24')+_0x482d5a[_0x9afe('0x10')]['recordingFormat']||_0x9afe('0x25'),'context':_0x3c9832[_0x33567f][0x0][_0x9afe('0x14')],'exten':_0x3c9832[_0x33567f][0x0][_0x9afe('0xa')],'priority':_0x482d5a[_0x9afe('0x15')]++,'VoiceExtensionId':_0x3c9832[_0x33567f][0x0]['VoiceExtensionId']});}}_0x482d5a['extensions'][_0x9afe('0x18')]({'type':_0x3c9832[_0x33567f][0x0]['type'],'app':_0x9afe('0x13'),'appdata':_0x9afe('0x26'),'context':_0x3c9832[_0x33567f][0x0][_0x9afe('0x14')],'exten':_0x3c9832[_0x33567f][0x0][_0x9afe('0xa')],'priority':_0x482d5a[_0x9afe('0x15')]++,'VoiceExtensionId':_0x3c9832[_0x33567f][0x0][_0x9afe('0x16')]});_0x482d5a['extensions'][_0x9afe('0x18')]({'type':_0x3c9832[_0x33567f][0x0]['type'],'app':_0x9afe('0x13'),'appdata':_0x9afe('0x27'),'context':_0x3c9832[_0x33567f][0x0][_0x9afe('0x14')],'exten':_0x3c9832[_0x33567f][0x0][_0x9afe('0xa')],'priority':_0x482d5a[_0x9afe('0x15')]++,'VoiceExtensionId':_0x3c9832[_0x33567f][0x0][_0x9afe('0x16')]});_0x482d5a[_0x9afe('0xf')][_0x9afe('0x18')]({'type':_0x3c9832[_0x33567f][0x0][_0x9afe('0x12')],'app':'Set','appdata':_0x9afe('0x28'),'context':_0x3c9832[_0x33567f][0x0][_0x9afe('0x14')],'exten':_0x3c9832[_0x33567f][0x0][_0x9afe('0xa')],'priority':_0x482d5a[_0x9afe('0x15')]++,'VoiceExtensionId':_0x3c9832[_0x33567f][0x0]['VoiceExtensionId']});for(var _0x279861=0x0,_0x121a5=0x0;_0x279861<_0x3c9832[_0x33567f][_0x9afe('0x29')];_0x279861+=0x1,_0x121a5=0x0){var _0x50f4b6=_0x3c9832[_0x33567f][_0x279861];if(_0x50f4b6['type']){_0x50f4b6['type']=_0x50f4b6[_0x9afe('0x12')][_0x9afe('0x2a')]();}var _0x39c640=[];var _0x100504=[];delete _0x50f4b6['id'];delete _0x50f4b6[_0x9afe('0x2b')];delete _0x50f4b6[_0x9afe('0x2c')];var _0x2f2918=_0x50f4b6[_0x9afe('0x2d')]!==_0x9afe('0x2e')?[_0x50f4b6[_0x9afe('0x2d')]]:_0x50f4b6[_0x9afe('0x8')]?_['map'](_[_0x9afe('0xc')](_0x482d5a[_0x9afe('0x6')],{'IntervalId':_0x50f4b6[_0x9afe('0x8')]}),_0x9afe('0x2d')):[];if(_0x50f4b6[_0x9afe('0xe')](_0x9afe('0x2f'))){if(_0x50f4b6[_0x9afe('0x2f')]&&_0x50f4b6[_0x9afe('0x2f')]!=='--'){_0x39c640['push']({'type':_0x50f4b6['type'],'app':_0x9afe('0x13'),'appdata':_0x9afe('0x30')+_0x50f4b6[_0x9afe('0x2f')],'context':_0x50f4b6['context'],'exten':_0x50f4b6[_0x9afe('0xa')],'priority':_0x2f2918[_0x9afe('0x29')]+_0x482d5a[_0x9afe('0x15')]+_0x121a5++,'VoiceExtensionId':_0x50f4b6['VoiceExtensionId']});}}if(_0x50f4b6[_0x9afe('0x12')]===_0x9afe('0x1a')&&_0x50f4b6[_0x9afe('0xe')](_0x9afe('0x31'))){if(_0x50f4b6[_0x9afe('0x31')]){_0x39c640[_0x9afe('0x18')]({'type':_0x50f4b6[_0x9afe('0x12')],'app':'ExecIf','appdata':_0x9afe('0x32')+_0x50f4b6['callerID']+')','context':_0x50f4b6[_0x9afe('0x14')],'exten':_0x50f4b6[_0x9afe('0xa')],'priority':_0x2f2918[_0x9afe('0x29')]+_0x482d5a[_0x9afe('0x15')]+_0x121a5++,'VoiceExtensionId':_0x50f4b6['VoiceExtensionId']});}else{_0x39c640['push']({'type':_0x50f4b6[_0x9afe('0x12')],'app':_0x9afe('0x33'),'appdata':_0x9afe('0x34'),'context':_0x50f4b6[_0x9afe('0x14')],'exten':_0x50f4b6[_0x9afe('0xa')],'priority':_0x2f2918[_0x9afe('0x29')]+_0x482d5a['priority']+_0x121a5++,'VoiceExtensionId':_0x50f4b6['VoiceExtensionId']});}}if(_0x50f4b6[_0x9afe('0xe')](_0x9afe('0x35'))){if(_0x1ac8ac[_0x9afe('0x36')](_0x50f4b6[_0x9afe('0x37')][_0x9afe('0x2a')]())>=0x0&&_0x50f4b6[_0x9afe('0x38')]!==_0x9afe('0x39')){if(_0x50f4b6['answer']){_0x39c640[_0x9afe('0x18')]({'type':_0x50f4b6['type'],'app':_0x9afe('0x33'),'appdata':_0x9afe('0x3a'),'context':_0x50f4b6[_0x9afe('0x14')],'exten':_0x50f4b6[_0x9afe('0xa')],'priority':_0x2f2918[_0x9afe('0x29')]+_0x482d5a[_0x9afe('0x15')]+_0x121a5++,'VoiceExtensionId':_0x50f4b6['VoiceExtensionId']});_0x39c640[_0x9afe('0x18')]({'type':_0x50f4b6['type'],'app':'Set','appdata':'XCALLY-MOTION-ANSWER=1','context':_0x50f4b6[_0x9afe('0x14')],'exten':_0x50f4b6[_0x9afe('0xa')],'priority':_0x2f2918[_0x9afe('0x29')]+_0x482d5a[_0x9afe('0x15')]+_0x121a5++,'VoiceExtensionId':_0x50f4b6['VoiceExtensionId']});}else{_0x39c640[_0x9afe('0x18')]({'type':_0x50f4b6['type'],'app':_0x9afe('0x33'),'appdata':_0x9afe('0x3b'),'context':_0x50f4b6['context'],'exten':_0x50f4b6['exten'],'priority':_0x2f2918[_0x9afe('0x29')]+_0x482d5a[_0x9afe('0x15')]+_0x121a5++,'VoiceExtensionId':_0x50f4b6[_0x9afe('0x16')]});_0x39c640[_0x9afe('0x18')]({'type':_0x50f4b6[_0x9afe('0x12')],'app':_0x9afe('0x13'),'appdata':_0x9afe('0x3c'),'context':_0x50f4b6[_0x9afe('0x14')],'exten':_0x50f4b6['exten'],'priority':_0x2f2918['length']+_0x482d5a[_0x9afe('0x15')]+_0x121a5++,'VoiceExtensionId':_0x50f4b6['VoiceExtensionId']});}}}for(var _0x540b41=0x0;_0x540b41<_0x2f2918[_0x9afe('0x29')];_0x540b41+=0x1){var _0x1a81d8=_0x482d5a[_0x9afe('0x15')]+_0x2f2918['length'];var _0x6168c=_0x540b41===_0x2f2918[_0x9afe('0x29')]-0x1?_0x482d5a[_0x9afe('0x15')]+_0x39c640[_0x9afe('0x29')]+_0x100504['length']+0x2:_0x482d5a[_0x9afe('0x15')]+_0x540b41+0x1;_0x39c640[_0x9afe('0x3d')](_0x540b41,0x0,{'type':_0x50f4b6[_0x9afe('0x12')],'app':_0x9afe('0x3e'),'appdata':_0x2f2918[_0x540b41]+'?'+_0x50f4b6['context']+_0x9afe('0x3f')+_0x1a81d8+':'+_0x50f4b6[_0x9afe('0x14')]+_0x9afe('0x3f')+_0x6168c,'exten':_0x50f4b6[_0x9afe('0xa')],'context':_0x50f4b6[_0x9afe('0x14')],'priority':_0x482d5a[_0x9afe('0x15')]+_0x540b41,'VoiceExtensionId':_0x3c9832[_0x33567f][0x0][_0x9afe('0x16')]});}_0x50f4b6['priority']=_0x39c640[_0x9afe('0x29')]?_[_0x9afe('0x40')](_0x39c640)['priority']+0x1:_0x482d5a[_0x9afe('0x15')];_0x482d5a[_0x9afe('0x15')]=(_0x100504[_0x9afe('0x29')]?_['last'](_0x100504)['priority']:_0x50f4b6[_0x9afe('0x15')])+0x1;_0x482d5a['extensions']=_['concat'](_0x482d5a[_0x9afe('0xf')],_0x39c640,[_0x50f4b6],_0x100504);}_0x482d5a[_0x9afe('0xf')][_0x9afe('0x18')]({'type':_0x3c9832[_0x33567f][0x0][_0x9afe('0x12')],'app':'Hangup','exten':_0x3c9832[_0x33567f][0x0][_0x9afe('0xa')],'context':_0x3c9832[_0x33567f][0x0][_0x9afe('0x14')],'priority':_0x482d5a[_0x9afe('0x15')],'VoiceExtensionId':_0x3c9832[_0x33567f][0x0][_0x9afe('0x16')]});_0x4792a8[_0x9afe('0x18')](_0x3c9832[_0x33567f][0x0][_0x9afe('0x16')]);_0x4ff3ac=_[_0x9afe('0x41')](_0x4ff3ac,_0x482d5a['extensions']);}}return _0x5f5ba2['transaction'](function(_0x4e0c04){return _0x5f5ba2[_0x9afe('0x2')]['VoiceExtension'][_0x9afe('0x42')]({'where':{'VoiceExtensionId':{'$in':_0x4792a8}},'transaction':_0x4e0c04})[_0x9afe('0x5')](function(_0x54eeed){return _0x5f5ba2['models'][_0x9afe('0x7')][_0x9afe('0x43')](_[_0x9afe('0x44')](_0x4ff3ac,'priority'),{'transaction':_0x4e0c04});});});})[_0x9afe('0x45')](function(_0x29c33f){console['error'](_0x29c33f);});}exports[_0x9afe('0x46')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index a6f1ec7..b134bbb 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 _0x24a6=['keys','then','pick','catch','Error\x20while\x20creating\x20contact:\x20','stringify','checkHopper','insert','into','cm_hopper','scheduledAt','ContactId','select','field','NOW()','toString','createdAt','updatedAt','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','fromQuery','str','cm_hopper_final','id\x20IN\x20?','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','get','always','push','sequelize','query','VoiceQueueId','onlyIfOpen','CmList','BlackLists','all','CampaignId','Campaign','cmContact,\x20%s,\x20%s','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resume','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','CSV\x20import\x20process\x20stopped!','createReadStream','parse','duplicate','pause','info','bluebird','util','lodash','squel','papaparse','ioredis','../../../mysqldb','../../../config/logger','redis','defaults','localhost','socket.io-emitter','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20socket_timestamp\x20parameter!','error','contact','index','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','join','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','Duplicate\x20Contact','CmContact','create'];(function(_0x174715,_0x4e9e3a){var _0x591b6e=function(_0x1f2112){while(--_0x1f2112){_0x174715['push'](_0x174715['shift']());}};_0x591b6e(++_0x4e9e3a);}(_0x24a6,0x122));var _0x624a=function(_0x25b03e,_0xe5c5e5){_0x25b03e=_0x25b03e-0x0;var _0x1a9129=_0x24a6[_0x25b03e];return _0x1a9129;};'use strict';var BPromise=require(_0x624a('0x0'));var util=require(_0x624a('0x1'));var _=require(_0x624a('0x2'));var fs=require('fs');var squel=require(_0x624a('0x3'));var Papa=require(_0x624a('0x4'));var Redis=require(_0x624a('0x5'));var db=require(_0x624a('0x6'))['db'];var config=require('../../../config/environment');var logger=require(_0x624a('0x7'))('api');config[_0x624a('0x8')]=_[_0x624a('0x9')](config[_0x624a('0x8')],{'host':_0x624a('0xa'),'port':0x18eb});var socket=require(_0x624a('0xb'))(new Redis(config['redis']));require('../../../api/cmContact/cmContact.socket')[_0x624a('0xc')](socket);try{if(!process[_0x624a('0xd')][0x2]||process[_0x624a('0xd')][0x2]===_0x624a('0xe')||process[_0x624a('0xd')][0x2]===_0x624a('0xf')){throw new Error(_0x624a('0x10'));}var FILEPATH=process['argv'][0x2];if(!process[_0x624a('0xd')][0x3]||process[_0x624a('0xd')][0x3]==='undefined'||process[_0x624a('0xd')][0x3]===_0x624a('0xf')||!process[_0x624a('0xd')][0x4]||process['argv'][0x4]==='undefined'||process[_0x624a('0xd')][0x4]===_0x624a('0xf')){throw new Error(_0x624a('0x11'));}var FIELDS=_[_0x624a('0x12')](process[_0x624a('0xd')][0x3][_0x624a('0x13')](','),process[_0x624a('0xd')][0x4][_0x624a('0x13')](','));if(!process['argv'][0x5]||process[_0x624a('0xd')][0x5]===_0x624a('0xe')||process[_0x624a('0xd')][0x5]===_0x624a('0xf')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process['argv'][0x5];var COMPANYID=process[_0x624a('0xd')][0x6]&&process['argv'][0x6]!==_0x624a('0xe')&&process['argv'][0x6]!==_0x624a('0xf')?process[_0x624a('0xd')][0x6]:null;var DUPLICATES=process[_0x624a('0xd')][0x7]&&process[_0x624a('0xd')][0x7]!=='undefined'&&process[_0x624a('0xd')][0x7]!=='null'?process[_0x624a('0xd')][0x7]:null;if(!process[_0x624a('0xd')][0x8]||process[_0x624a('0xd')][0x8]===_0x624a('0xe')||process[_0x624a('0xd')][0x8]===_0x624a('0xf')){throw new Error(_0x624a('0x14'));}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0x2ef66b){logger[_0x624a('0x15')](_0x2ef66b);endCsv();}var total=0x0;var pTotal=0x0;var success=0x0;var errors=0x0;var duplicates=0x0;var rows=[];var hopperContacts='';var promises=[];var index=0x0;var alreadyInvalid=![];function handleCheckRowError(_0xdf5bbe,_0x234e25,_0x17e34b,_0x438bac){var _0x52a4e0={'message':_0x234e25};_0x52a4e0[_0xdf5bbe]=!![];if(_0x17e34b){_0x52a4e0[_0x624a('0x16')]=_0x17e34b;}if(_0x438bac){_0x52a4e0[_0x624a('0x17')]=_0x438bac;}return _0x52a4e0;}function isEmail(_0x1c6563){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/[_0x624a('0x18')](_0x1c6563);}function checkRow(_0x25e2b5,_0x21f59b,_0x2b827c){return new BPromise(function(_0x4451fd,_0x2e3eeb){if(_[_0x624a('0x19')](_0x25e2b5)){return _0x2e3eeb(handleCheckRowError(_0x624a('0x15'),_0x624a('0x1a'),null,_0x2b827c));}if(_0x25e2b5[_0x624a('0x1b')]&&_0x25e2b5['errors'][_0x624a('0x1c')]){var _0x1371e5=_[_0x624a('0x1d')](_0x25e2b5[_0x624a('0x1b')],_0x624a('0x1e'))[_0x624a('0x1f')](';');return _0x2e3eeb(handleCheckRowError(_0x624a('0x15'),_0x1371e5,null,_0x2b827c));}var _0x3c52c8={};for(var _0x1a2660 in FIELDS){if(FIELDS['hasOwnProperty'](_0x1a2660)&&FIELDS[_0x1a2660]){_0x3c52c8[_0x1a2660]=_0x25e2b5[_0x624a('0x20')][0x0][FIELDS[_0x1a2660]]||_0x25e2b5[_0x624a('0x20')][0x0]['\ufeff'+FIELDS[_0x1a2660]];}}if(!_0x3c52c8[_0x624a('0x21')]){return _0x2e3eeb(handleCheckRowError('error',_0x624a('0x22'),null,_0x2b827c));}if(!_0x3c52c8[_0x624a('0x23')]){return _0x2e3eeb(handleCheckRowError('error',_0x624a('0x24'),null,_0x2b827c));}if(_0x3c52c8[_0x624a('0x25')]){var _0xfd78b6=moment(_0x3c52c8[_0x624a('0x25')],_0x624a('0x26'));if(!_0xfd78b6[_0x624a('0x27')]()){return _0x2e3eeb(handleCheckRowError('error',_0x624a('0x28'),null,_0x2b827c));}}if(_0x3c52c8[_0x624a('0x29')]){if(!isEmail(_0x3c52c8[_0x624a('0x29')])){return _0x2e3eeb(handleCheckRowError(_0x624a('0x15'),_0x624a('0x2a'),null,_0x2b827c));}}_0x3c52c8[_0x624a('0x2b')]=LISTID;_0x3c52c8[_0x624a('0x2c')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x624a('0x1c')]&&_0x21f59b){var _0x259096={};for(var _0x124e6a=0x0,_0x57e166=DUPLICATES[_0x624a('0x1c')];_0x124e6a<_0x57e166;_0x124e6a+=0x1){_0x259096[DUPLICATES[_0x124e6a]]=_0x3c52c8[DUPLICATES[_0x124e6a]];}var _0x527fbc=_[_0x624a('0x2d')](_0x21f59b,_0x259096);if(_0x527fbc){return _0x2e3eeb(handleCheckRowError('duplicate',_0x624a('0x2e'),_0x527fbc,_0x2b827c));}}return db[_0x624a('0x2f')][_0x624a('0x30')](_0x3c52c8,{'raw':!![],'hooks':![],'fields':_[_0x624a('0x31')](_0x3c52c8)})[_0x624a('0x32')](function(_0x2ab1cf){if(DUPLICATES&&DUPLICATES[_0x624a('0x1c')]&&_0x21f59b){_0x21f59b['push'](_[_0x624a('0x33')](_0x3c52c8,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x2ab1cf['id'];return _0x4451fd();})[_0x624a('0x34')](function(_0x386c16){return _0x2e3eeb(handleCheckRowError(_0x624a('0x15'),_0x624a('0x35')+(_0x386c16[_0x624a('0x1e')]||JSON[_0x624a('0x36')](_0x386c16)),null,_0x2b827c));});});}function checkHopper(){function _0x9df37(){return function(_0x111256){logger[_0x624a('0x15')]('cmContact',_0x624a('0x37'),util['inspect'](_0x111256,{'showHidden':![],'depth':null}));};}var _0x2e062d=function(_0x31ae7f,_0x1e991){var _0xd7168f=squel[_0x624a('0x38')]()[_0x624a('0x39')](_0x624a('0x3a'))['fromQuery'](['phone',_0x624a('0x3b'),_0x624a('0x3c'),_0x624a('0x2b'),_0x1e991,'createdAt','updatedAt'],squel[_0x624a('0x3d')]()[_0x624a('0x3e')](_0x624a('0x23'),'phone')[_0x624a('0x3e')](_0x624a('0x3f'),_0x624a('0x3b'))[_0x624a('0x3e')]('id',_0x624a('0x3c'))[_0x624a('0x3e')](LISTID['toString'](),_0x624a('0x2b'))[_0x624a('0x3e')](_0x31ae7f['id'][_0x624a('0x40')](),_0x1e991)[_0x624a('0x3e')](_0x624a('0x3f'),_0x624a('0x41'))[_0x624a('0x3e')](_0x624a('0x3f'),_0x624a('0x42'))[_0x624a('0x43')](_0x624a('0x44'))[_0x624a('0x45')](_0x624a('0x46'))[_0x624a('0x45')](_0x624a('0x47'),LISTID[_0x624a('0x40')]())[_0x624a('0x45')](_0x624a('0x48'))[_0x624a('0x45')](_0x624a('0x49'),squel[_0x624a('0x3d')]()[_0x624a('0x3e')](_0x624a('0x23'))[_0x624a('0x43')](_0x624a('0x3a'))[_0x624a('0x45')](_0x1e991+_0x624a('0x4a'),_0x31ae7f['id']['toString']())))[_0x624a('0x40')]();return _0xd7168f;};var _0x2c07bd=function(_0xb4b42,_0xbdccdc){var _0x1ef061=squel[_0x624a('0x38')]()['into']('cm_hopper')[_0x624a('0x4b')]([_0x624a('0x23'),_0x624a('0x3b'),'ContactId',_0x624a('0x2b'),_0xbdccdc,_0x624a('0x41'),'updatedAt'],squel[_0x624a('0x3d')]()[_0x624a('0x3e')]('phone','phone')[_0x624a('0x3e')](_0x624a('0x3f'),'scheduledAt')[_0x624a('0x3e')]('id',_0x624a('0x3c'))['field'](LISTID[_0x624a('0x40')](),_0x624a('0x2b'))[_0x624a('0x3e')](_0xb4b42['id'][_0x624a('0x40')](),_0xbdccdc)[_0x624a('0x3e')]('NOW()',_0x624a('0x41'))[_0x624a('0x3e')](_0x624a('0x3f'),_0x624a('0x42'))[_0x624a('0x43')](_0x624a('0x44'))[_0x624a('0x45')](_0x624a('0x46'))['where'](_0x624a('0x47'),LISTID[_0x624a('0x40')]())[_0x624a('0x45')]('id\x20IN\x20?',squel[_0x624a('0x4c')](hopperContacts))['where'](_0x624a('0x48'))[_0x624a('0x45')]('phone\x20NOT\x20IN\x20(?)',squel[_0x624a('0x3d')]()[_0x624a('0x3e')]('calleridnum')[_0x624a('0x43')](_0x624a('0x4d'))['where'](_0xbdccdc+_0x624a('0x4a'),_0xb4b42['id'][_0x624a('0x40')]()))[_0x624a('0x45')](_0x624a('0x49'),squel[_0x624a('0x3d')]()['field'](_0x624a('0x23'))[_0x624a('0x43')](_0x624a('0x3a'))[_0x624a('0x45')](_0xbdccdc+'\x20=\x20?',_0xb4b42['id'][_0x624a('0x40')]())))[_0x624a('0x40')]();return _0x1ef061;};function _0x1d3687(_0x8f3d45,_0xafcba4){var _0x5da0c3=squel[_0x624a('0x38')]()[_0x624a('0x39')]('cm_hopper')[_0x624a('0x4b')]([_0x624a('0x23'),_0x624a('0x3b'),_0x624a('0x3c'),'ListId',_0xafcba4,_0x624a('0x41'),_0x624a('0x42')],squel['select']()[_0x624a('0x3e')](_0x624a('0x23'),'phone')[_0x624a('0x3e')]('NOW()',_0x624a('0x3b'))[_0x624a('0x3e')]('id',_0x624a('0x3c'))['field'](LISTID[_0x624a('0x40')](),_0x624a('0x2b'))[_0x624a('0x3e')](_0x8f3d45['id'][_0x624a('0x40')](),_0xafcba4)[_0x624a('0x3e')](_0x624a('0x3f'),'createdAt')['field']('NOW()',_0x624a('0x42'))['from']('cm_contacts')['where'](_0x624a('0x46'))[_0x624a('0x45')](_0x624a('0x47'),LISTID['toString']())[_0x624a('0x45')](_0x624a('0x4e'),squel[_0x624a('0x4c')](hopperContacts))[_0x624a('0x45')]('phone\x20IS\x20NOT\x20NULL'))[_0x624a('0x40')]();return _0x5da0c3;}function _0x4da107(_0x914401,_0x259438){var _0x2442a2=squel['insert']()[_0x624a('0x39')](_0x624a('0x4f'))[_0x624a('0x4b')]([_0x624a('0x23'),'ContactId',_0x624a('0x2b'),_0x259438,'createdAt',_0x624a('0x42')],squel['select']()[_0x624a('0x3e')](_0x624a('0x23'),'phone')[_0x624a('0x3e')]('id',_0x624a('0x3c'))['field'](LISTID[_0x624a('0x40')](),_0x624a('0x2b'))[_0x624a('0x3e')](_0x914401['id']['toString'](),_0x259438)[_0x624a('0x3e')](_0x624a('0x3f'),_0x624a('0x41'))[_0x624a('0x3e')](_0x624a('0x3f'),'updatedAt')['from'](_0x624a('0x44'))['where'](_0x624a('0x46'))[_0x624a('0x45')](_0x624a('0x47'),LISTID[_0x624a('0x40')]())['where'](_0x624a('0x4e'),squel[_0x624a('0x4c')](hopperContacts))['where'](_0x624a('0x48')))[_0x624a('0x40')]();return _0x2442a2;}return db[_0x624a('0x50')][_0x624a('0x51')]({'where':{'type':_0x624a('0x52')},'attributes':['id',_0x624a('0x53')],'include':[{'model':db['CmList'],'as':'Lists','where':{'id':LISTID}}]})[_0x624a('0x32')](function(_0x5745c7){var _0x1d7755=[];if(_0x5745c7){var _0x10d939;for(var _0x5ac99f=0x0,_0x3d8cc0;_0x5ac99f<_0x5745c7['length'];_0x5ac99f+=0x1){_0x3d8cc0=_0x5745c7[_0x5ac99f][_0x624a('0x54')]({'plain':!![]});switch(_0x3d8cc0[_0x624a('0x53')]){case _0x624a('0x55'):_0x1d7755[_0x624a('0x56')](db[_0x624a('0x57')][_0x624a('0x58')](_0x2c07bd(_0x3d8cc0,_0x624a('0x59')))[_0x624a('0x32')](function(){})[_0x624a('0x34')](_0x9df37()));break;case _0x624a('0x5a'):_0x1d7755[_0x624a('0x56')](db[_0x624a('0x57')][_0x624a('0x58')](_0x2e062d(_0x3d8cc0,'VoiceQueueId'))[_0x624a('0x32')](function(){})[_0x624a('0x34')](_0x9df37()));break;default:_0x1d7755[_0x624a('0x56')](db[_0x624a('0x57')][_0x624a('0x58')](_0x1d3687(_0x3d8cc0,'VoiceQueueId'))[_0x624a('0x32')](function(){})[_0x624a('0x34')](_0x9df37()));}}}return _0x1d7755;})['all']()[_0x624a('0x32')](function(){return db[_0x624a('0x50')][_0x624a('0x51')]({'where':{'type':_0x624a('0x52')},'attributes':['id'],'include':[{'model':db[_0x624a('0x5b')],'as':_0x624a('0x5c'),'where':{'id':LISTID}}]})['then'](function(_0x514d33){var _0x283db3=[];if(_0x514d33){var _0x313791;for(var _0x17c56e=0x0,_0x300b75;_0x17c56e<_0x514d33['length'];_0x17c56e+=0x1){_0x300b75=_0x514d33[_0x17c56e]['get']({'plain':!![]});_0x283db3[_0x624a('0x56')](db[_0x624a('0x57')][_0x624a('0x58')](_0x4da107(_0x300b75,'VoiceQueueId'))[_0x624a('0x32')](function(){})[_0x624a('0x34')](_0x9df37()));}}return _0x283db3;})[_0x624a('0x5d')]();})[_0x624a('0x32')](function(){return db['Campaign'][_0x624a('0x51')]({'attributes':['id',_0x624a('0x53')],'include':[{'model':db['CmList'],'as':'Lists','where':{'id':LISTID}}]})['then'](function(_0x50f6cd){var _0xe4bef2=[];if(_0x50f6cd){for(var _0x1f0755=0x0,_0x100207;_0x1f0755<_0x50f6cd[_0x624a('0x1c')];_0x1f0755+=0x1){_0x100207=_0x50f6cd[_0x1f0755][_0x624a('0x54')]({'plain':!![]});switch(_0x100207[_0x624a('0x53')]){case _0x624a('0x55'):_0xe4bef2['push'](db[_0x624a('0x57')]['query'](_0x2c07bd(_0x100207,_0x624a('0x5e')))['then'](function(){})['catch'](_0x9df37()));break;case _0x624a('0x5a'):_0xe4bef2[_0x624a('0x56')](db[_0x624a('0x57')][_0x624a('0x58')](_0x2e062d(_0x100207,_0x624a('0x5e')))[_0x624a('0x32')](function(){})['catch'](_0x9df37()));break;default:_0xe4bef2[_0x624a('0x56')](db[_0x624a('0x57')][_0x624a('0x58')](_0x1d3687(_0x100207,'CampaignId'))[_0x624a('0x32')](function(){})[_0x624a('0x34')](_0x9df37()));}}}return _0xe4bef2;})[_0x624a('0x5d')]();})[_0x624a('0x32')](function(){return db[_0x624a('0x5f')][_0x624a('0x51')]({'attributes':['id'],'include':[{'model':db[_0x624a('0x5b')],'as':_0x624a('0x5c'),'where':{'id':LISTID}}]})[_0x624a('0x32')](function(_0x324294){var _0xd20af4=[];if(_0x324294){for(var _0xbf9158=0x0,_0x142224;_0xbf9158<_0x324294[_0x624a('0x1c')];_0xbf9158+=0x1){_0x142224=_0x324294[_0xbf9158][_0x624a('0x54')]({'plain':!![]});_0xd20af4['push'](db[_0x624a('0x57')][_0x624a('0x58')](_0x4da107(_0x142224,_0x624a('0x5e')))[_0x624a('0x32')](function(){})[_0x624a('0x34')](_0x9df37()));}}return _0xd20af4;})['all']();})[_0x624a('0x34')](function(_0x4b77dd){logger['error'](_0x624a('0x60'),'generalCheckHopper',_0x4b77dd[_0x624a('0x1e')]);});}var processPromises=function(_0x32396a){return BPromise[_0x624a('0x5d')](promises)[_0x624a('0x32')](function(_0x21d6c7){})[_0x624a('0x34')](function(_0x52ea7d){logger[_0x624a('0x15')](_0x624a('0x61'),JSON['stringify'](_0x52ea7d));})[_0x624a('0x62')](function(){socket[_0x624a('0x63')](_0x624a('0x64')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x32396a){return _0x32396a[_0x624a('0x65')]();}});};var endCsv=function(){return BPromise[_0x624a('0x66')]()[_0x624a('0x32')](function(){if(hopperContacts){return checkHopper();}})[_0x624a('0x32')](function(){socket['emit'](_0x624a('0x64')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x624a('0x67')](FILEPATH);}catch(_0x762a89){logger['error'](_0x624a('0x68'),JSON[_0x624a('0x36')](_0x762a89));}finally{process[_0x624a('0x69')](0x0);}});};process['on'](_0x624a('0x6a'),function(){logger['info'](_0x624a('0x6b'));endCsv();});function main(){return BPromise[_0x624a('0x66')]()[_0x624a('0x32')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES['split'](',');return db[_0x624a('0x2f')][_0x624a('0x51')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x624a('0x32')](function(_0x15db7b){var _0x5e6ca1=fs[_0x624a('0x6c')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x624a('0x6d')](_0x5e6ca1,{'header':!![],'skipEmptyLines':!![],'step':function(_0xb140a7,_0xc99407){total+=0x1;var _0x3cef54=total;promises[_0x624a('0x56')](checkRow(_0xb140a7,_0x15db7b,_0x3cef54)[_0x624a('0x32')](function(){success+=0x1;})[_0x624a('0x34')](function(_0x6b9206){if(_0x6b9206[_0x624a('0x15')]){errors+=0x1;delete _0x6b9206['error'];}else if(_0x6b9206[_0x624a('0x6e')]){duplicates+=0x1;delete _0x6b9206[_0x624a('0x6e')];}rows[_0x624a('0x56')](_0x6b9206);}));if(total%0xc8===0x0){_0xc99407[_0x624a('0x6f')]();return processPromises(_0xc99407);}},'complete':function(){return processPromises()[_0x624a('0x32')](function(){logger[_0x624a('0x70')]('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x35f4ac,_0x57159b){logger[_0x624a('0x70')]('CSV\x20parse\x20error',JSON[_0x624a('0x36')](_0x35f4ac));endCsv();}});})[_0x624a('0x34')](function(_0x8461ed){logger[_0x624a('0x15')]('Error\x20executing\x20contact\x20csv\x20import:',JSON[_0x624a('0x36')](_0x8461ed));});}main(); \ No newline at end of file +var _0xdead=['from','cm_contacts','where','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','fromQuery','id\x20IN\x20?','str','select','calleridnum','cm_hopper_final','insert','deletedAt\x20IS\x20NULL','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','Lists','get','sequelize','VoiceQueueId','onlyIfOpen','query','catch','all','CmList','BlackLists','Campaign','always','CampaignId','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resume','resolve','exit','SIGINT','info','createReadStream','pause','Error\x20executing\x20contact\x20csv\x20import:','bluebird','lodash','squel','papaparse','../../../mysqldb','../../../config/logger','api','redis','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','argv','null','Missing\x20filepath\x20parameter!','undefined','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','contact','isNil','errors','length','message','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','YYYY-MM-DD','isValid','email','email\x20format\x20is\x20not\x20valid!','ListId','find','duplicate','Duplicate\x20Contact','CmContact','create','keys','then','push','stringify','cmContact','checkHopper','into','cm_hopper','scheduledAt','ContactId','createdAt','updatedAt','field','NOW()','toString'];(function(_0x39e101,_0x1d328c){var _0x11919b=function(_0x5a7c2f){while(--_0x5a7c2f){_0x39e101['push'](_0x39e101['shift']());}};_0x11919b(++_0x1d328c);}(_0xdead,0x93));var _0xddea=function(_0x2ef49b,_0x9661a7){_0x2ef49b=_0x2ef49b-0x0;var _0x663f4b=_0xdead[_0x2ef49b];return _0x663f4b;};'use strict';var BPromise=require(_0xddea('0x0'));var util=require('util');var _=require(_0xddea('0x1'));var fs=require('fs');var squel=require(_0xddea('0x2'));var Papa=require(_0xddea('0x3'));var Redis=require('ioredis');var db=require(_0xddea('0x4'))['db'];var config=require('../../../config/environment');var logger=require(_0xddea('0x5'))(_0xddea('0x6'));config['redis']=_['defaults'](config[_0xddea('0x7')],{'host':_0xddea('0x8'),'port':0x18eb});var socket=require(_0xddea('0x9'))(new Redis(config[_0xddea('0x7')]));require(_0xddea('0xa'))['register'](socket);try{if(!process[_0xddea('0xb')][0x2]||process[_0xddea('0xb')][0x2]==='undefined'||process[_0xddea('0xb')][0x2]===_0xddea('0xc')){throw new Error(_0xddea('0xd'));}var FILEPATH=process[_0xddea('0xb')][0x2];if(!process[_0xddea('0xb')][0x3]||process['argv'][0x3]===_0xddea('0xe')||process[_0xddea('0xb')][0x3]===_0xddea('0xc')||!process[_0xddea('0xb')][0x4]||process[_0xddea('0xb')][0x4]===_0xddea('0xe')||process['argv'][0x4]===_0xddea('0xc')){throw new Error('Missing\x20binding\x20parameters!');}var FIELDS=_[_0xddea('0xf')](process[_0xddea('0xb')][0x3][_0xddea('0x10')](','),process[_0xddea('0xb')][0x4][_0xddea('0x10')](','));if(!process['argv'][0x5]||process[_0xddea('0xb')][0x5]==='undefined'||process['argv'][0x5]===_0xddea('0xc')){throw new Error(_0xddea('0x11'));}var LISTID=process[_0xddea('0xb')][0x5];var COMPANYID=process[_0xddea('0xb')][0x6]&&process['argv'][0x6]!==_0xddea('0xe')&&process[_0xddea('0xb')][0x6]!==_0xddea('0xc')?process[_0xddea('0xb')][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process[_0xddea('0xb')][0x7]!=='undefined'&&process[_0xddea('0xb')][0x7]!==_0xddea('0xc')?process[_0xddea('0xb')][0x7]:null;if(!process[_0xddea('0xb')][0x8]||process['argv'][0x8]==='undefined'||process['argv'][0x8]===_0xddea('0xc')){throw new Error(_0xddea('0x12'));}var SOCKET_TIMESTAMP=process[_0xddea('0xb')][0x8];}catch(_0x153e7b){logger[_0xddea('0x13')](_0x153e7b);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(_0x1f3fbb,_0x1f905a,_0x3933fc,_0x32aeac){var _0x462945={'message':_0x1f905a};_0x462945[_0x1f3fbb]=!![];if(_0x3933fc){_0x462945[_0xddea('0x14')]=_0x3933fc;}if(_0x32aeac){_0x462945['index']=_0x32aeac;}return _0x462945;}function isEmail(_0xf95343){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'](_0xf95343);}function checkRow(_0x157c1a,_0x123eb8,_0x215b90){return new BPromise(function(_0x4d4e51,_0x5a6dc8){if(_[_0xddea('0x15')](_0x157c1a)){return _0x5a6dc8(handleCheckRowError('error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x215b90));}if(_0x157c1a[_0xddea('0x16')]&&_0x157c1a['errors'][_0xddea('0x17')]){var _0x50c569=_['map'](_0x157c1a[_0xddea('0x16')],_0xddea('0x18'))[_0xddea('0x19')](';');return _0x5a6dc8(handleCheckRowError(_0xddea('0x13'),_0x50c569,null,_0x215b90));}var _0x3e4dde={};for(var _0x39d142 in FIELDS){if(FIELDS[_0xddea('0x1a')](_0x39d142)&&FIELDS[_0x39d142]){_0x3e4dde[_0x39d142]=_0x157c1a['data'][0x0][FIELDS[_0x39d142]]||_0x157c1a[_0xddea('0x1b')][0x0]['\ufeff'+FIELDS[_0x39d142]];}}if(!_0x3e4dde[_0xddea('0x1c')]){return _0x5a6dc8(handleCheckRowError(_0xddea('0x13'),_0xddea('0x1d'),null,_0x215b90));}if(!_0x3e4dde[_0xddea('0x1e')]){return _0x5a6dc8(handleCheckRowError(_0xddea('0x13'),_0xddea('0x1f'),null,_0x215b90));}if(_0x3e4dde['birthDate']){var _0xade1e6=moment(_0x3e4dde['birthDate'],_0xddea('0x20'));if(!_0xade1e6[_0xddea('0x21')]()){return _0x5a6dc8(handleCheckRowError('error','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x215b90));}}if(_0x3e4dde[_0xddea('0x22')]){if(!isEmail(_0x3e4dde[_0xddea('0x22')])){return _0x5a6dc8(handleCheckRowError('error',_0xddea('0x23'),null,_0x215b90));}}_0x3e4dde[_0xddea('0x24')]=LISTID;_0x3e4dde['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0xddea('0x17')]&&_0x123eb8){var _0x378c13={};for(var _0x479f50=0x0,_0x4de244=DUPLICATES['length'];_0x479f50<_0x4de244;_0x479f50+=0x1){_0x378c13[DUPLICATES[_0x479f50]]=_0x3e4dde[DUPLICATES[_0x479f50]];}var _0x4cdfad=_[_0xddea('0x25')](_0x123eb8,_0x378c13);if(_0x4cdfad){return _0x5a6dc8(handleCheckRowError(_0xddea('0x26'),_0xddea('0x27'),_0x4cdfad,_0x215b90));}}return db[_0xddea('0x28')][_0xddea('0x29')](_0x3e4dde,{'raw':!![],'hooks':![],'fields':_[_0xddea('0x2a')](_0x3e4dde)})[_0xddea('0x2b')](function(_0x4906f8){if(DUPLICATES&&DUPLICATES['length']&&_0x123eb8){_0x123eb8[_0xddea('0x2c')](_['pick'](_0x3e4dde,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x4906f8['id'];return _0x4d4e51();})['catch'](function(_0x2eefa9){return _0x5a6dc8(handleCheckRowError(_0xddea('0x13'),'Error\x20while\x20creating\x20contact:\x20'+(_0x2eefa9[_0xddea('0x18')]||JSON[_0xddea('0x2d')](_0x2eefa9)),null,_0x215b90));});});}function checkHopper(){function _0x11cc09(){return function(_0x4d6093){logger[_0xddea('0x13')](_0xddea('0x2e'),_0xddea('0x2f'),util['inspect'](_0x4d6093,{'showHidden':![],'depth':null}));};}var _0x3c3f8c=function(_0x18d4f7,_0x15b5d3){var _0x41af33=squel['insert']()[_0xddea('0x30')](_0xddea('0x31'))['fromQuery'](['phone',_0xddea('0x32'),_0xddea('0x33'),_0xddea('0x24'),_0x15b5d3,_0xddea('0x34'),_0xddea('0x35')],squel['select']()[_0xddea('0x36')](_0xddea('0x1e'),_0xddea('0x1e'))[_0xddea('0x36')](_0xddea('0x37'),_0xddea('0x32'))['field']('id',_0xddea('0x33'))[_0xddea('0x36')](LISTID['toString'](),_0xddea('0x24'))[_0xddea('0x36')](_0x18d4f7['id'][_0xddea('0x38')](),_0x15b5d3)['field']('NOW()',_0xddea('0x34'))[_0xddea('0x36')]('NOW()',_0xddea('0x35'))[_0xddea('0x39')](_0xddea('0x3a'))[_0xddea('0x3b')]('deletedAt\x20IS\x20NULL')['where'](_0xddea('0x3c'),LISTID[_0xddea('0x38')]())[_0xddea('0x3b')](_0xddea('0x3d'))[_0xddea('0x3b')](_0xddea('0x3e'),squel['select']()[_0xddea('0x36')](_0xddea('0x1e'))[_0xddea('0x39')](_0xddea('0x31'))[_0xddea('0x3b')](_0x15b5d3+_0xddea('0x3f'),_0x18d4f7['id'][_0xddea('0x38')]())))[_0xddea('0x38')]();return _0x41af33;};var _0x3311b0=function(_0x200f11,_0x44ef61){var _0x43d496=squel['insert']()[_0xddea('0x30')](_0xddea('0x31'))[_0xddea('0x40')]([_0xddea('0x1e'),_0xddea('0x32'),_0xddea('0x33'),_0xddea('0x24'),_0x44ef61,_0xddea('0x34'),_0xddea('0x35')],squel['select']()[_0xddea('0x36')](_0xddea('0x1e'),_0xddea('0x1e'))[_0xddea('0x36')](_0xddea('0x37'),_0xddea('0x32'))[_0xddea('0x36')]('id',_0xddea('0x33'))[_0xddea('0x36')](LISTID['toString'](),_0xddea('0x24'))[_0xddea('0x36')](_0x200f11['id'][_0xddea('0x38')](),_0x44ef61)['field']('NOW()','createdAt')[_0xddea('0x36')]('NOW()',_0xddea('0x35'))['from'](_0xddea('0x3a'))[_0xddea('0x3b')]('deletedAt\x20IS\x20NULL')[_0xddea('0x3b')](_0xddea('0x3c'),LISTID[_0xddea('0x38')]())[_0xddea('0x3b')](_0xddea('0x41'),squel[_0xddea('0x42')](hopperContacts))['where'](_0xddea('0x3d'))[_0xddea('0x3b')](_0xddea('0x3e'),squel[_0xddea('0x43')]()[_0xddea('0x36')](_0xddea('0x44'))[_0xddea('0x39')](_0xddea('0x45'))['where'](_0x44ef61+_0xddea('0x3f'),_0x200f11['id'][_0xddea('0x38')]()))[_0xddea('0x3b')](_0xddea('0x3e'),squel[_0xddea('0x43')]()[_0xddea('0x36')]('phone')['from'](_0xddea('0x31'))[_0xddea('0x3b')](_0x44ef61+'\x20=\x20?',_0x200f11['id'][_0xddea('0x38')]())))[_0xddea('0x38')]();return _0x43d496;};function _0x810f6d(_0x24f5a8,_0x5c8525){var _0x16ccd3=squel[_0xddea('0x46')]()['into'](_0xddea('0x31'))[_0xddea('0x40')](['phone',_0xddea('0x32'),_0xddea('0x33'),_0xddea('0x24'),_0x5c8525,'createdAt',_0xddea('0x35')],squel['select']()[_0xddea('0x36')]('phone',_0xddea('0x1e'))[_0xddea('0x36')](_0xddea('0x37'),_0xddea('0x32'))[_0xddea('0x36')]('id','ContactId')[_0xddea('0x36')](LISTID['toString'](),'ListId')['field'](_0x24f5a8['id']['toString'](),_0x5c8525)[_0xddea('0x36')](_0xddea('0x37'),_0xddea('0x34'))[_0xddea('0x36')](_0xddea('0x37'),_0xddea('0x35'))[_0xddea('0x39')](_0xddea('0x3a'))['where'](_0xddea('0x47'))['where']('ListId\x20=\x20?',LISTID['toString']())[_0xddea('0x3b')](_0xddea('0x41'),squel[_0xddea('0x42')](hopperContacts))['where'](_0xddea('0x3d')))[_0xddea('0x38')]();return _0x16ccd3;}function _0x1b3996(_0x38f427,_0x2aec72){var _0xbe753f=squel[_0xddea('0x46')]()[_0xddea('0x30')](_0xddea('0x48'))[_0xddea('0x40')]([_0xddea('0x1e'),'ContactId',_0xddea('0x24'),_0x2aec72,'createdAt',_0xddea('0x35')],squel[_0xddea('0x43')]()[_0xddea('0x36')](_0xddea('0x1e'),_0xddea('0x1e'))[_0xddea('0x36')]('id',_0xddea('0x33'))['field'](LISTID['toString'](),_0xddea('0x24'))[_0xddea('0x36')](_0x38f427['id'][_0xddea('0x38')](),_0x2aec72)['field'](_0xddea('0x37'),'createdAt')[_0xddea('0x36')](_0xddea('0x37'),_0xddea('0x35'))['from'](_0xddea('0x3a'))['where'](_0xddea('0x47'))['where']('ListId\x20=\x20?',LISTID[_0xddea('0x38')]())['where']('id\x20IN\x20?',squel[_0xddea('0x42')](hopperContacts))[_0xddea('0x3b')](_0xddea('0x3d')))[_0xddea('0x38')]();return _0xbe753f;}return db[_0xddea('0x49')][_0xddea('0x4a')]({'where':{'type':_0xddea('0x4b')},'attributes':['id',_0xddea('0x4c')],'include':[{'model':db['CmList'],'as':_0xddea('0x4d'),'where':{'id':LISTID}}]})[_0xddea('0x2b')](function(_0x4938be){var _0x3d322c=[];if(_0x4938be){var _0x17d0c7;for(var _0x4db1aa=0x0,_0x8ab9a8;_0x4db1aa<_0x4938be[_0xddea('0x17')];_0x4db1aa+=0x1){_0x8ab9a8=_0x4938be[_0x4db1aa][_0xddea('0x4e')]({'plain':!![]});switch(_0x8ab9a8[_0xddea('0x4c')]){case'always':_0x3d322c['push'](db[_0xddea('0x4f')]['query'](_0x3311b0(_0x8ab9a8,_0xddea('0x50')))[_0xddea('0x2b')](function(){})['catch'](_0x11cc09()));break;case _0xddea('0x51'):_0x3d322c[_0xddea('0x2c')](db[_0xddea('0x4f')][_0xddea('0x52')](_0x3c3f8c(_0x8ab9a8,_0xddea('0x50')))['then'](function(){})['catch'](_0x11cc09()));break;default:_0x3d322c[_0xddea('0x2c')](db[_0xddea('0x4f')][_0xddea('0x52')](_0x810f6d(_0x8ab9a8,'VoiceQueueId'))[_0xddea('0x2b')](function(){})[_0xddea('0x53')](_0x11cc09()));}}}return _0x3d322c;})[_0xddea('0x54')]()['then'](function(){return db[_0xddea('0x49')][_0xddea('0x4a')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':db[_0xddea('0x55')],'as':_0xddea('0x56'),'where':{'id':LISTID}}]})[_0xddea('0x2b')](function(_0x556662){var _0x1f8b64=[];if(_0x556662){var _0x3195ba;for(var _0x6c300d=0x0,_0x514ab1;_0x6c300d<_0x556662[_0xddea('0x17')];_0x6c300d+=0x1){_0x514ab1=_0x556662[_0x6c300d][_0xddea('0x4e')]({'plain':!![]});_0x1f8b64[_0xddea('0x2c')](db[_0xddea('0x4f')][_0xddea('0x52')](_0x1b3996(_0x514ab1,_0xddea('0x50')))['then'](function(){})[_0xddea('0x53')](_0x11cc09()));}}return _0x1f8b64;})['all']();})[_0xddea('0x2b')](function(){return db[_0xddea('0x57')][_0xddea('0x4a')]({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db['CmList'],'as':'Lists','where':{'id':LISTID}}]})[_0xddea('0x2b')](function(_0x22629b){var _0x1f8e8c=[];if(_0x22629b){for(var _0x460b75=0x0,_0x2d2da2;_0x460b75<_0x22629b[_0xddea('0x17')];_0x460b75+=0x1){_0x2d2da2=_0x22629b[_0x460b75][_0xddea('0x4e')]({'plain':!![]});switch(_0x2d2da2[_0xddea('0x4c')]){case _0xddea('0x58'):_0x1f8e8c[_0xddea('0x2c')](db[_0xddea('0x4f')][_0xddea('0x52')](_0x3311b0(_0x2d2da2,_0xddea('0x59')))[_0xddea('0x2b')](function(){})[_0xddea('0x53')](_0x11cc09()));break;case _0xddea('0x51'):_0x1f8e8c[_0xddea('0x2c')](db[_0xddea('0x4f')][_0xddea('0x52')](_0x3c3f8c(_0x2d2da2,'CampaignId'))['then'](function(){})[_0xddea('0x53')](_0x11cc09()));break;default:_0x1f8e8c[_0xddea('0x2c')](db[_0xddea('0x4f')]['query'](_0x810f6d(_0x2d2da2,_0xddea('0x59')))['then'](function(){})[_0xddea('0x53')](_0x11cc09()));}}}return _0x1f8e8c;})[_0xddea('0x54')]();})[_0xddea('0x2b')](function(){return db[_0xddea('0x57')]['findAll']({'attributes':['id'],'include':[{'model':db['CmList'],'as':_0xddea('0x56'),'where':{'id':LISTID}}]})[_0xddea('0x2b')](function(_0x1bde43){var _0x3f5027=[];if(_0x1bde43){for(var _0x5a4654=0x0,_0x464b1a;_0x5a4654<_0x1bde43[_0xddea('0x17')];_0x5a4654+=0x1){_0x464b1a=_0x1bde43[_0x5a4654][_0xddea('0x4e')]({'plain':!![]});_0x3f5027['push'](db[_0xddea('0x4f')][_0xddea('0x52')](_0x1b3996(_0x464b1a,_0xddea('0x59')))[_0xddea('0x2b')](function(){})[_0xddea('0x53')](_0x11cc09()));}}return _0x3f5027;})[_0xddea('0x54')]();})['catch'](function(_0x193f62){logger[_0xddea('0x13')]('cmContact,\x20%s,\x20%s','generalCheckHopper',_0x193f62[_0xddea('0x18')]);});}var processPromises=function(_0x1aef20){return BPromise[_0xddea('0x54')](promises)[_0xddea('0x2b')](function(_0x2089f9){})['catch'](function(_0x116a4a){logger[_0xddea('0x13')](_0xddea('0x5a'),JSON[_0xddea('0x2d')](_0x116a4a));})[_0xddea('0x5b')](function(){socket[_0xddea('0x5c')](_0xddea('0x5d')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x1aef20){return _0x1aef20[_0xddea('0x5e')]();}});};var endCsv=function(){return BPromise[_0xddea('0x5f')]()['then'](function(){if(hopperContacts){return checkHopper();}})[_0xddea('0x2b')](function(){socket[_0xddea('0x5c')]('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs['unlinkSync'](FILEPATH);}catch(_0x137269){logger[_0xddea('0x13')]('Unable\x20to\x20delete\x20temp\x20file:',JSON[_0xddea('0x2d')](_0x137269));}finally{process[_0xddea('0x60')](0x0);}});};process['on'](_0xddea('0x61'),function(){logger[_0xddea('0x62')]('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise[_0xddea('0x5f')]()[_0xddea('0x2b')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES['split'](',');return db['CmContact'][_0xddea('0x4a')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0xddea('0x2b')](function(_0x5a3a9f){var _0x4a3251=fs[_0xddea('0x63')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x4a3251,{'header':!![],'skipEmptyLines':!![],'step':function(_0x4df4a0,_0x39e37b){total+=0x1;var _0x3fca93=total;promises[_0xddea('0x2c')](checkRow(_0x4df4a0,_0x5a3a9f,_0x3fca93)[_0xddea('0x2b')](function(){success+=0x1;})[_0xddea('0x53')](function(_0x3a70a9){if(_0x3a70a9[_0xddea('0x13')]){errors+=0x1;delete _0x3a70a9[_0xddea('0x13')];}else if(_0x3a70a9[_0xddea('0x26')]){duplicates+=0x1;delete _0x3a70a9[_0xddea('0x26')];}rows[_0xddea('0x2c')](_0x3a70a9);}));if(total%0xc8===0x0){_0x39e37b[_0xddea('0x64')]();return processPromises(_0x39e37b);}},'complete':function(){return processPromises()[_0xddea('0x2b')](function(){logger['info']('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x26c1fe,_0x498976){logger['info']('CSV\x20parse\x20error',JSON[_0xddea('0x2d')](_0x26c1fe));endCsv();}});})[_0xddea('0x53')](function(_0x582c4a){logger[_0xddea('0x13')](_0xddea('0x65'),JSON[_0xddea('0x2d')](_0x582c4a));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index a0eeae4..5391f3a 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 _0x040c=['send','start','binding','clone','root','.csv','header','ContactItemType','name','_description','writeFileSync','parse','data','rows','find','trim','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNumber','includes','email','email\x20wrong\x20format','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','utcOffset','firstName','\x20not\x20specified','hasOwnProperty','itemTypeId','description','replace','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);','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','CompanyId','DROP\x20TABLE\x20','contactId','orderBy','VoiceQueueId','voice_queues_has_cm_blacklists','CampaignId','campaigns_has_cm_blacklists','finish','affectedRows','unlink','complete','argv','server/files/tmp','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','ListId\x20is\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','lodash','util','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/environment/shared','../../../config/logger','redis','defaults','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field','phone','from','join','.id\x20=\x20','where','\x20=\x20','CmContact','findAll','AdditionalPhones','then','push','all','split','length','isNil','filter','findOne','update','inserted','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.priority','insert','into','fromQuery','scheduledat','priority','UserId','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','cm_hopper','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.updatedAt','ContactId','ListId','createdAt','updatedAt','cm_hopper_black','ListId\x20=\x20?','toString','.offset-cm_contacts.utcOffset\x20minute)','cm_contacts.UserId','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','keys','scheduledAt',')\x20NOT\x20IN\x20?','MIN(id)','min_id','group','info','Received\x20SIGINT','exit','errors','message','query','spread','campaigns.id','campaigns.dialTimezone','campaigns','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','sequelize','error','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=','timezones','set','offset','dialTimezone','catch','main','stringify'];(function(_0x226cf9,_0x42cdf7){var _0x1927a1=function(_0x365137){while(--_0x365137){_0x226cf9['push'](_0x226cf9['shift']());}};_0x1927a1(++_0x42cdf7);}(_0x040c,0x1b5));var _0xc040=function(_0x3850c1,_0x28e14e){_0x3850c1=_0x3850c1-0x0;var _0x55d3f2=_0x040c[_0x3850c1];return _0x55d3f2;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0xc040('0x0'));var Papa=require('papaparse');var util=require(_0xc040('0x1'));var BPromise=require(_0xc040('0x2'));var moment=require(_0xc040('0x3'));var squel=require(_0xc040('0x4'));var Redis=require(_0xc040('0x5'));var db=require(_0xc040('0x6'))['db'];var config=require(_0xc040('0x7'));var shared=require(_0xc040('0x8'));var logger=require(_0xc040('0x9'))('import');config[_0xc040('0xa')]=_[_0xc040('0xb')](config[_0xc040('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xc040('0xc'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0xc040('0xd')](_0xc040('0xe'));function isEmail(_0x37ed27){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))*$/[_0xc040('0xf')](_0x37ed27);}function selectNotIn(_0x335a75,_0x5237c0,_0x32c7cb,_0x4bb789,_0x30a6f1){return squel[_0xc040('0x10')]()[_0xc040('0x11')](_0xc040('0x12'))[_0xc040('0x13')](_0x4bb789)[_0xc040('0x14')](_0x5237c0,null,_0x5237c0+_0xc040('0x15')+_0x4bb789+'.'+_0x32c7cb)[_0xc040('0x16')](_0x4bb789+'.'+_0x32c7cb+_0xc040('0x17')+_0x335a75+'.'+_0x32c7cb)[_0xc040('0x16')](_0x5237c0+'.dialCheckDuplicateType\x20IN\x20('+_0x30a6f1['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x509ae1,_0x11fa8a){promisesAdditionalPhones=[];return db[_0xc040('0x18')][_0xc040('0x19')]({'raw':!![],'attributes':['id',_0xc040('0x1a')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0xc040('0x1b')](function(_0x37e5df){if(_0x37e5df!==null){var _0x3b6442=[];for(var _0x4e00db=0x0;_0x4e00db<_0x37e5df['length'];_0x4e00db++){var _0x447487=_0x37e5df[_0x4e00db];_0x3b6442[_0xc040('0x1c')](insertAdditionalPhones(_0x447487));}}Promise[_0xc040('0x1d')](_0x3b6442)[_0xc040('0x1b')](function(){_0x509ae1({'val':0x1});});});});}function insertAdditionalPhones(_0x1ad6d6){return new Promise(function(_0x118b1e,_0x3bdd51){var _0x55c81f=_0x1ad6d6[_0xc040('0x1a')];var _0x3d7ded=_0x55c81f[_0xc040('0x1e')](';');var _0x4e36ee=[];orderBy=0x0;for(var _0x2c51fe=0x0;_0x2c51fe<_0x3d7ded[_0xc040('0x1f')];_0x2c51fe++){_0x4e36ee[_0xc040('0x1c')](splitAdditionalPhone(_0x1ad6d6['id'],_0x3d7ded[_0x2c51fe]));}Promise['all'](_0x4e36ee)[_0xc040('0x1b')](function(){_0x118b1e({'val':_0x3d7ded[_0xc040('0x1f')]});});});}function splitAdditionalPhone(_0x23db3c,_0x1261e5){return new Promise(function(_0x2c72fa,_0x5ef42f){var _0xaba101=_0x1261e5[_0xc040('0x1e')](':');var _0x21f1cc=_0xaba101[0x0];var _0x4ed604=_0xaba101[0x1];if(!_[_0xc040('0x20')](_0x4ed604)){var _0x4d392f=_0x4ed604['split']('|');var _0x5853f5=[];for(var _0x105c38=0x0;_0x105c38<_0x4d392f['length'];_0x105c38++){if(_0x4d392f[_0x105c38]!==''){var _0x16b992=_[_0xc040('0x21')](promisesAdditionalPhones,{'contactId':_0x23db3c,'phone':_0x4d392f[_0x105c38]});if(_0x16b992['length']==0x0){orderBy++;promisesAdditionalPhones[_0xc040('0x1c')]({'contactId':_0x23db3c,'contactTypeId':_0x21f1cc,'phone':_0x4d392f[_0x105c38],'orderBy':orderBy});}}}_0x2c72fa({'ok':0x1});}else _0x2c72fa({'res':0x0});});}function createAdditionalPhone(_0x5c30e4,_0x5f1770,_0x3192ca,_0x365657){var _0x4bb348='';var _0x945c30='';var _0x297987=_0x3192ca[_0xc040('0x1e')]('§');_0x4bb348=_0x297987[0x0];if(_0x297987[_0xc040('0x1f')]==0x2)_0x945c30=_0x297987[0x1];return new Promise(function(_0x3d69c4,_0x4c3317){return db['CmContactHasItem'][_0xc040('0x22')]({'where':{'CmContactId':_0x5c30e4,'item':_0x4bb348}})[_0xc040('0x1b')](function(_0x2a0812){if(_0x2a0812){return db['CmContactHasItem'][_0xc040('0x23')]({'ItemTypeId':_0x5f1770,'description':_0x945c30,'OrderBy':_0x365657},{'where':{'CmContactId':_0x5c30e4,'item':_0x4bb348}})[_0xc040('0x1b')](function(_0x146428){_0x3d69c4({'res':'updated'});});}else{return db['CmContactHasItem']['create']({'CmContactId':_0x5c30e4,'item':_0x4bb348,'description':_0x945c30,'ItemTypeId':_0x5f1770,'OrderBy':_0x365657,'ItemClass':'PHONE'})[_0xc040('0x1b')](function(_0x502617){_0x3d69c4({'res':_0xc040('0x24')});});}});});}function insertCmHopper(_0x40adb8,_0x3d7ece,_0x44f5ee,_0x27218f,_0x75e7c5){var _0x2579cb=[_0xc040('0x25'),_0xc040('0x26'),_0xc040('0x27'),_0xc040('0x28'),_0x3d7ece+'.'+_0x27218f,_0xc040('0x29'),'cm_contacts.updatedAt',_0xc040('0x2a'),'cm_contacts.UserId','\x22'+_0x75e7c5+'\x22'];return squel[_0xc040('0x2b')]()[_0xc040('0x2c')]('cm_hopper')[_0xc040('0x2d')]([_0xc040('0x12'),_0xc040('0x2e'),'ContactId','ListId',_0x27218f,'createdAt','updatedAt',_0xc040('0x2f'),_0xc040('0x30'),'recallme'],squel[_0xc040('0x10')]()[_0xc040('0x31')](_0x2579cb)[_0xc040('0x13')](_0x3d7ece)['join'](_0xc040('0x32'),null,_0xc040('0x33')+_0x3d7ece+_0xc040('0x34'))[_0xc040('0x14')](_0x44f5ee,null,_0x44f5ee+'.id\x20=\x20'+_0x3d7ece+'.'+_0x27218f)[_0xc040('0x16')](_0x3d7ece+_0xc040('0x35'),_0x40adb8)[_0xc040('0x16')](_0xc040('0x36'),NOW)[_0xc040('0x16')](_0xc040('0x37'),selectNotIn(_0x3d7ece,_0x44f5ee,_0x27218f,_0xc040('0x38'),[_0xc040('0x39'),_0xc040('0x3a')]))[_0xc040('0x16')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x3d7ece,_0x44f5ee,_0x27218f,_0xc040('0x38'),[_0xc040('0x39')])))['toString']();}function insertCmHopperBlack(_0x310ff9,_0x1721c8,_0x464d9b,_0x4ebc3f){var _0x21b09e=[_0xc040('0x25'),'cm_contacts.id',_0xc040('0x28'),_0x1721c8+'.'+_0x4ebc3f,'cm_contacts.createdAt',_0xc040('0x3b')];return squel[_0xc040('0x2b')]()[_0xc040('0x2c')]('cm_hopper_black')[_0xc040('0x2d')]([_0xc040('0x12'),_0xc040('0x3c'),_0xc040('0x3d'),_0x4ebc3f,_0xc040('0x3e'),_0xc040('0x3f')],squel[_0xc040('0x10')]()[_0xc040('0x31')](_0x21b09e)[_0xc040('0x13')](_0x1721c8)[_0xc040('0x14')](_0xc040('0x32'),null,_0xc040('0x33')+_0x1721c8+_0xc040('0x34'))['join'](_0x464d9b,null,_0x464d9b+'.id\x20=\x20'+_0x1721c8+'.'+_0x4ebc3f)[_0xc040('0x16')](_0x1721c8+_0xc040('0x35'),_0x310ff9)[_0xc040('0x16')](_0xc040('0x36'),NOW)[_0xc040('0x16')](_0xc040('0x37'),squel[_0xc040('0x10')]()[_0xc040('0x11')](_0xc040('0x12'))['from'](_0xc040('0x40'))[_0xc040('0x16')](_0xc040('0x41'),_0x310ff9)[_0xc040('0x16')](_0x4ebc3f+_0xc040('0x17')+_0x1721c8+'.'+_0x4ebc3f)))[_0xc040('0x42')]();}function insertTzCmHopper(_0x49cc62,_0x1c6136,_0x3af8e8,_0x4aa81d,_0x20cfb9,_0x2758f5){var _0x1b9c7b=[_0xc040('0x25'),'date_add(cm_contacts.scheduledat,interval\x20'+_0x2758f5+_0xc040('0x43'),_0xc040('0x27'),_0xc040('0x28'),_0x1c6136+'.'+_0x4aa81d,_0xc040('0x29'),'cm_contacts.updatedAt',_0xc040('0x2a'),_0xc040('0x44'),'\x22'+_0x20cfb9+'\x22'];var _0x4a86a7=squel[_0xc040('0x2b')]()['into'](_0xc040('0x38'))['fromQuery'](['phone',_0xc040('0x2e'),_0xc040('0x3c'),_0xc040('0x3d'),_0x4aa81d,'createdAt',_0xc040('0x3f'),_0xc040('0x2f'),_0xc040('0x30'),'recallme'],squel[_0xc040('0x10')]()['fields'](_0x1b9c7b)['from'](_0x1c6136)[_0xc040('0x14')]('cm_contacts',null,_0xc040('0x33')+_0x1c6136+'.CmListId')[_0xc040('0x14')](_0x3af8e8,null,_0x3af8e8+'.id\x20=\x20'+_0x1c6136+'.'+_0x4aa81d)[_0xc040('0x14')](_0x2758f5,null,_0x2758f5+'.id\x20=\x20'+_0x1c6136+'.'+_0x4aa81d)['where'](_0x1c6136+'.CmListId\x20=\x20?',_0x49cc62)[_0xc040('0x16')](_0xc040('0x36'),NOW)[_0xc040('0x16')](_0xc040('0x37'),selectNotIn(_0x1c6136,_0x3af8e8,_0x4aa81d,_0xc040('0x38'),['\x22always\x22','\x22onlyIfOpen\x22']))[_0xc040('0x16')](_0xc040('0x37'),selectNotIn(_0x1c6136,_0x3af8e8,_0x4aa81d,_0xc040('0x38'),[_0xc040('0x39')])))[_0xc040('0x42')]();return _0x4a86a7;}function insertTzCmHopperBlack(_0x39a0f2,_0x42d408,_0x990c60,_0x46331d){var _0x3286c5=[_0xc040('0x25'),_0xc040('0x27'),_0xc040('0x28'),_0x42d408+'.'+_0x46331d,_0xc040('0x29'),_0xc040('0x3b')];return squel[_0xc040('0x2b')]()[_0xc040('0x2c')](_0xc040('0x40'))[_0xc040('0x2d')](['phone',_0xc040('0x3c'),_0xc040('0x3d'),_0x46331d,_0xc040('0x3e'),_0xc040('0x3f')],squel[_0xc040('0x10')]()[_0xc040('0x31')](_0x3286c5)[_0xc040('0x13')](_0x42d408)['join']('cm_contacts',null,_0xc040('0x33')+_0x42d408+_0xc040('0x34'))[_0xc040('0x14')](_0x990c60,null,_0x990c60+'.id\x20=\x20'+_0x42d408+'.'+_0x46331d)[_0xc040('0x16')](_0x42d408+_0xc040('0x35'),_0x39a0f2)[_0xc040('0x16')](_0xc040('0x36'),NOW)[_0xc040('0x16')](_0xc040('0x37'),squel['select']()[_0xc040('0x11')](_0xc040('0x12'))[_0xc040('0x13')](_0xc040('0x40'))[_0xc040('0x16')](_0xc040('0x41'),_0x39a0f2)[_0xc040('0x16')](_0x46331d+_0xc040('0x17')+_0x42d408+'.'+_0x46331d)))['toString']();}function insertCmHopperAdditionalPhones(_0x49ded1){var _0x356294=[_0xc040('0x45'),'cm_contact_has_items.item',_0xc040('0x46'),_0xc040('0x47'),_0xc040('0x48')];return squel[_0xc040('0x2b')]()[_0xc040('0x2c')](_0xc040('0x49'))[_0xc040('0x2d')]([_0xc040('0x4a'),_0xc040('0x12'),_0xc040('0x4b'),_0xc040('0x3e'),'updatedAt'],squel[_0xc040('0x10')]()[_0xc040('0x31')](_0x356294)['from'](_0xc040('0x38'))[_0xc040('0x14')](_0xc040('0x32'),null,_0xc040('0x4c'))['join'](_0xc040('0x4d'),null,_0xc040('0x4e'))[_0xc040('0x16')](_0xc040('0x4f'),_0x49ded1)[_0xc040('0x16')](_0xc040('0x36'),NOW))[_0xc040('0x42')]();}function insertCmContact(_0x474f9e,_0x428cd2,_0x245e2d,_0x31457b){var _0x3507e1=_[_0xc040('0x50')](_[_0xc040('0x51')](_0x31457b),['ListId','CompanyId',_0xc040('0x3e'),'updatedAt',_0xc040('0x52')]);return squel[_0xc040('0x2b')]()[_0xc040('0x2c')](_0xc040('0x32'))[_0xc040('0x2d')](_0x3507e1,squel[_0xc040('0x10')]()[_0xc040('0x31')](_0x3507e1)[_0xc040('0x13')](_0x428cd2)[_0xc040('0x16')]('('+_0x245e2d['join'](',')+_0xc040('0x53'),squel[_0xc040('0x10')]()[_0xc040('0x31')](_0x245e2d)[_0xc040('0x13')](_0xc040('0x32'))['where'](_0xc040('0x41'),_0x474f9e)['where']('deletedAt\x20IS\x20NULL'))[_0xc040('0x16')]('id\x20IN\x20?',squel[_0xc040('0x10')]()['field'](_0xc040('0x54'),_0xc040('0x55'))[_0xc040('0x13')](_0x428cd2)[_0xc040('0x56')](_0x245e2d['join'](','))))[_0xc040('0x42')]();}function handleStop(){logger[_0xc040('0x57')](_0xc040('0x58'));stopped=!![];}function handleUncaughtException(_0x3b0a91){logger['error'](_0x3b0a91['message']);process[_0xc040('0x59')](0x1);}function handleError(_0x1daa6b,_0x171996){stats[_0xc040('0x5a')][_0xc040('0x1c')]({'name':_0x171996['code'],'message':_0x171996[_0xc040('0x5b')],'row':_0x1daa6b});}function handleQuery(_0x24950e){logger[_0xc040('0x57')](_0x24950e);return db['sequelize'][_0xc040('0x5c')](_0x24950e)[_0xc040('0x5d')](function(_0x104ce5){results[_0xc040('0x1c')](_0x104ce5);})['catch'](function(_0x29506a){logger['error'](_0x29506a[_0xc040('0x5b')]);});}function updateTzCampaigns(_0x2ed9e7){return new Promise(function(_0x4eab3a,_0x382759){var _0x2eb440=squel[_0xc040('0x10')]()[_0xc040('0x31')]([_0xc040('0x5e'),_0xc040('0x5f')])[_0xc040('0x13')](_0xc040('0x60'))[_0xc040('0x14')](_0xc040('0x61'),null,_0xc040('0x62'))['where'](_0xc040('0x63')+_0x2ed9e7);db[_0xc040('0x64')][_0xc040('0x5c')](_0x2eb440[_0xc040('0x42')]())[_0xc040('0x5d')](function(_0x55cbe8){var _0x99f7cc=[];for(var _0x85398a=0x0;_0x85398a<_0x55cbe8[_0xc040('0x1f')];_0x85398a++){_0x99f7cc[_0xc040('0x1c')](getTimezoneData(_0x55cbe8[_0x85398a],tmp_campaigns));}BPromise[_0xc040('0x1d')](_0x99f7cc)[_0xc040('0x1b')](function(){_0x4eab3a({'val':0x1});});})['catch'](function(_0x31898f){logger[_0xc040('0x65')](_0x31898f['message']);_0x4eab3a({'val':0x0});});});}function updateTzVoiceQueues(_0x51d4a7){return new Promise(function(_0x47da44,_0x338f98){var _0x598c62=squel[_0xc040('0x10')]()[_0xc040('0x31')]([_0xc040('0x66'),_0xc040('0x67')])[_0xc040('0x13')](_0xc040('0x68'))['join'](_0xc040('0x69'),null,_0xc040('0x6a'))[_0xc040('0x16')](_0xc040('0x6b')+_0x51d4a7);db[_0xc040('0x64')][_0xc040('0x5c')](_0x598c62[_0xc040('0x42')]())[_0xc040('0x5d')](function(_0x34a14e){var _0x268e79=[];for(var _0x1ed23f=0x0;_0x1ed23f<_0x34a14e[_0xc040('0x1f')];_0x1ed23f++){_0x268e79[_0xc040('0x1c')](getTimezoneData(_0x34a14e[_0x1ed23f],tmp_voice_queues));}BPromise[_0xc040('0x1d')](_0x268e79)['then'](function(){_0x47da44({'val':0x1});});})['catch'](function(_0x4199d1){logger[_0xc040('0x65')](_0x4199d1[_0xc040('0x5b')]);_0x47da44({'val':0x0});});});}function getTimezoneData(_0x205509,_0x2fcff4){return new Promise(function(_0x4e8457,_0xcbcde){var _0x5cf618=shared[_0xc040('0x6c')];var _0x4c43f9=_0x5cf618[_0x205509['dialTimezone']];if(_[_0xc040('0x20')](_0x4c43f9)){_0x4e8457({'ret':0x1});}else{var _0x2f242e=_0x4c43f9['utcOffset'];var _0x434d5b=squel[_0xc040('0x2b')]()[_0xc040('0x2c')](_0x2fcff4)[_0xc040('0x6d')]('id',_0x205509['id'])[_0xc040('0x6d')](_0xc040('0x6e'),_0x2f242e)[_0xc040('0x6d')](_0xc040('0x6f'),_0x205509[_0xc040('0x6f')])[_0xc040('0x42')]();return db[_0xc040('0x64')][_0xc040('0x5c')](_0x434d5b)[_0xc040('0x5d')](function(_0x29815c){_0x4e8457({'ret':0x1});})[_0xc040('0x70')](function(_0x246367){logger[_0xc040('0x65')](_0x246367[_0xc040('0x5b')]);_0xcbcde({'ret':0x1});});}});}function handleTZQuery(_0x33d937){logger['info'](_0x33d937);return db[_0xc040('0x64')][_0xc040('0x5c')](_0x33d937)[_0xc040('0x5d')](function(_0x18bd62){})[_0xc040('0x70')](function(_0xa9f81c){logger[_0xc040('0x65')](_0xa9f81c[_0xc040('0x5b')]);});}function main(_0x1d9afd,_0x2af864,_0x274cb2,_0x4356cf){logger[_0xc040('0x57')](_0xc040('0x71'),_0x1d9afd,JSON[_0xc040('0x72')](_0x2af864));process[_0xc040('0x73')](_0xc040('0x74'));var _0x4e5d85=_0x2af864[_0xc040('0x75')];var _0x294a2b=_[_0xc040('0x76')](_0x4e5d85);var _0x4b94c3=_0x2af864['socket_timestamp'];var _0x2b32aa=path['join'](config[_0xc040('0x77')],'server/files/tmp',_0x4b94c3+_0xc040('0x78'));hasTZ=_[_0xc040('0x51')](_0x4e5d85)['includes'](_0xc040('0x6f'));var _0x16da7c=_[_0xc040('0x51')](_0x4e5d85)['join']();logger[_0xc040('0x57')](_0xc040('0x79'),_0x16da7c);db[_0xc040('0x7a')][_0xc040('0x19')]({'raw':!![],'attributes':['id','name']})['then'](function(_0x6a83b6){for(var _0x84d785=0x0;_0x84d785<_0x6a83b6[_0xc040('0x1f')];_0x84d785++){if(_0x6a83b6[_0x84d785][_0xc040('0x7b')]in _0x4e5d85){contactItemTypes[_0xc040('0x1c')](_0x6a83b6[_0x84d785]);delete _0x294a2b[_0x6a83b6[_0x84d785][_0xc040('0x7b')]];hasAdditionalPhones=!![];}for(var _0x5b4af4 in _0x4e5d85){if(_0x6a83b6[_0x84d785][_0xc040('0x7b')]+_0xc040('0x7c')===_0x5b4af4){phoneDescriptions['push']({'itemTypeId':_0x6a83b6[_0x84d785]['id'],'description':_0x5b4af4});delete _0x294a2b[_0x5b4af4];}}}if(hasAdditionalPhones)_0x294a2b[_0xc040('0x1a')]='';var _0x50da0e=_[_0xc040('0x51')](_0x294a2b)['join']();logger[_0xc040('0x57')](_0xc040('0x79'),_0x50da0e);fs[_0xc040('0x7d')](_0x2b32aa,_0x50da0e+'\x0a');Papa[_0xc040('0x7e')](fs['createReadStream'](_0x1d9afd),{'header':!![],'skipEmptyLines':!![],'step':function(_0x13d3ea,_0x5641b0){try{for(var _0x45d2e5=0x0,_0x36f14a=[];_0x45d2e5<_0x13d3ea[_0xc040('0x7f')][_0xc040('0x1f')];_0x45d2e5++){stats[_0xc040('0x80')]+=0x1;if(_0x13d3ea[_0xc040('0x5a')][_0x45d2e5]){handleError(_0x13d3ea[_0xc040('0x7f')][_0x45d2e5],_0x13d3ea[_0xc040('0x5a')][_0x45d2e5]);}else{var _0x43d783=[];var _0x58de77=[];var _0x488592={};for(var _0x390d20 in _0x4e5d85){let _0x2d7005=contactItemTypes[_0xc040('0x81')](_0x419808=>_0x419808['name']===_0x390d20);let _0x2792e3=contactItemTypes[_0xc040('0x81')](_0x4dbb0a=>_0x4dbb0a[_0xc040('0x7b')]+_0xc040('0x7c')===_0x390d20);if(_[_0xc040('0x20')](_0x2d7005)&&_['isNil'](_0x2792e3)){if(_0x4e5d85['hasOwnProperty'](_0x390d20)){if(_0x13d3ea[_0xc040('0x7f')][_0x45d2e5][_0x4e5d85[_0x390d20]]){var _0x5d12e2=_[_0xc040('0x82')](_0x13d3ea['data'][_0x45d2e5][_0x4e5d85[_0x390d20]]['replace'](/"/g,'\x27'));switch(_0x390d20){case _0xc040('0x2e'):var _0x5c8ae3=moment(_0x5d12e2,_0xc040('0xe'),!![]);if(_0x5c8ae3[_0xc040('0x83')]()){_0x36f14a[_0xc040('0x1c')]('\x22'+_0x5d12e2+'\x22');}else{_0x43d783['push'](_0xc040('0x84'));}break;case _0xc040('0x2f'):var _0x12628e=parseInt(_0x5d12e2);_0x5d12e2=_['isNaN'](_0x12628e)||_0x12628e<0x0||_0x12628e>0x4?_0x4356cf?0x3:0x2:_0x12628e;_0x36f14a[_0xc040('0x1c')]('\x22'+_0x5d12e2+'\x22');break;case'UserId':var _0x586f72=parseInt(_0x5d12e2);if(_[_0xc040('0x85')](_0x586f72)&&_[_0xc040('0x86')](_0x274cb2,_0x586f72)){_0x36f14a[_0xc040('0x1c')]('\x22'+_0x586f72+'\x22');}else{_0x43d783['push']('agent\x20not\x20exists');}break;case _0xc040('0x87'):if(isEmail(_0x5d12e2)){_0x36f14a[_0xc040('0x1c')]('\x22'+_0x5d12e2+'\x22');}else{_0x43d783[_0xc040('0x1c')](_0xc040('0x88'));}break;case'dateOfBirth':var _0x3b9905=moment(_0x5d12e2,_0xc040('0x89'),!![]);if(_0x3b9905[_0xc040('0x83')]()){_0x36f14a[_0xc040('0x1c')]('\x22'+_0x5d12e2+'\x22');}else{_0x43d783['push'](_0xc040('0x8a'));}break;case _0xc040('0x6f'):var _0x379533=shared[_0xc040('0x6c')];var _0x3dfeea=_0x379533[_0x5d12e2];if(!_[_0xc040('0x20')](_0x3dfeea)){var _0x3d7e77=_0x3dfeea[_0xc040('0x8b')];_0x36f14a[_0xc040('0x1c')]('\x22'+_0x5d12e2+'\x22');_0x36f14a[_0xc040('0x1c')]('\x22'+_0x3d7e77+'\x22');}break;default:_0x36f14a[_0xc040('0x1c')]('\x22'+_0x5d12e2+'\x22');}}else{switch(_0x390d20){case _0xc040('0x8c'):case _0xc040('0x12'):_0x43d783['push'](_0x390d20+_0xc040('0x8d'));break;default:_0x36f14a[_0xc040('0x1c')]('\x22\x22');}}}}else{var _0x490368='';if(!_[_0xc040('0x20')](_0x2d7005)){if(!_0x488592[_0xc040('0x8e')](_0x2d7005['id'])){if(!_[_0xc040('0x20')](_0x13d3ea[_0xc040('0x7f')][_0x45d2e5][_0x4e5d85[_0x390d20]])){var _0x5d12e2=_['trim'](_0x13d3ea[_0xc040('0x7f')][_0x45d2e5][_0x4e5d85[_0x390d20]]['replace'](/"/g,'\x27'));var _0x4d3aaf=phoneDescriptions['find'](_0xf5fedd=>_0xf5fedd[_0xc040('0x8f')]===_0x2d7005['id']);if(!_[_0xc040('0x20')](_0x4d3aaf)){var _0xf649f6=_['trim'](_0x13d3ea[_0xc040('0x7f')][_0x45d2e5][_0x4e5d85[_0x4d3aaf[_0xc040('0x90')]]][_0xc040('0x91')](/"/g,'\x27'));if(!_['isNil'](_0xf649f6))_0x5d12e2=_0x5d12e2+'§'+_0xf649f6;}if(_0x490368=='')_0x490368=_0x5d12e2;else _0x490368+='|'+_0x5d12e2;}_0x58de77[_0xc040('0x1c')](_0x2d7005['id']+':'+_0x490368);_0x488592[_0x2d7005['id']]=0x1;}}}}if(hasAdditionalPhones){_0x36f14a[_0xc040('0x1c')]('\x22'+_0x58de77['join'](';')+'\x22');}if(_0x43d783['length']){handleError(_0x13d3ea[_0xc040('0x7f')][_0x45d2e5],{'code':'SystemRow','message':_0x43d783[_0xc040('0x14')]()});}else{fs['appendFileSync'](_0x2b32aa,_0x36f14a[_0xc040('0x14')]()+'\x0a');}_0x36f14a=[];}if(!(stats['rows']%0xc8)){socket[_0xc040('0x92')](_0xc040('0x93')+_0x4b94c3,stats);stats['errors']=[];}}if(stopped){logger[_0xc040('0x57')](_0xc040('0x94'));_0x5641b0[_0xc040('0x95')]();}}catch(_0x19c099){handleError(_0x13d3ea[_0xc040('0x7f')][_0x45d2e5],{'code':_0xc040('0x96'),'message':_0x19c099[_0xc040('0x5b')]});logger[_0xc040('0x65')](_0xc040('0x97'),_0x19c099[_0xc040('0x5b')]);}},'complete':function(){try{var _0x5c9021=[];var _0x1e2f25=[];var _0x4f7bcf='cm_contacts';if(_0x2af864['duplicates']&&_0x2af864[_0xc040('0x98')][_0xc040('0x1f')]){_0x4f7bcf=_0xc040('0x99')+_0x4b94c3;_0x5c9021['push'](_0xc040('0x9a')+_0x4f7bcf+_0xc040('0x9b'));}tmp_campaigns=_0xc040('0x9c')+_0x4b94c3;tmp_voice_queues='voice_queues_'+_0x4b94c3;_0x1e2f25[_0xc040('0x1c')](_0xc040('0x9a')+tmp_campaigns+_0xc040('0x9d'));_0x1e2f25['push'](_0xc040('0x9a')+tmp_voice_queues+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');BPromise[_0xc040('0x9e')](_0x1e2f25,handleTZQuery)[_0xc040('0x1b')](function(_0x3599b0){updateTzCampaigns(_0x2af864[_0xc040('0x3d')])[_0xc040('0x1b')](function(_0xd64033){updateTzVoiceQueues(_0x2af864[_0xc040('0x3d')])['then'](function(_0x373abe){if(hasTZ)_0x50da0e=_0x50da0e[_0xc040('0x91')](_0xc040('0x6f'),_0xc040('0x9f'));var _0x24e147=util[_0xc040('0xd')](_0xc040('0xa0'),_0x2b32aa,_0x4f7bcf,_0x50da0e,_0x2af864[_0xc040('0x3d')],_0x2af864[_0xc040('0xa1')]||null,NOW,NOW);if(_[_0xc040('0x20')](_0x4e5d85[_0xc040('0x2e')])){_0x24e147+=',\x20scheduledAt\x20=\x20NOW()';}_0x5c9021[_0xc040('0x1c')](_0x24e147);if(_0x2af864[_0xc040('0x98')]&&_0x2af864[_0xc040('0x98')]['length']){_0x5c9021[_0xc040('0x1c')](insertCmContact(_0x2af864[_0xc040('0x3d')],_0x4f7bcf,_0x2af864[_0xc040('0x98')],_0x4e5d85));_0x5c9021[_0xc040('0x1c')](_0xc040('0xa2')+_0x4f7bcf+';');}BPromise[_0xc040('0x9e')](_0x5c9021,handleQuery)['then'](function(_0x4d41aa){BPromise[_0xc040('0x1d')]([handleAdditionalPhones()])[_0xc040('0x1b')](function(){_0x5c9021=[];for(var _0xa7ae10=0x0;_0xa7ae10\x20\x20');}var _0x28c5fc=path[_0xc040('0x14')](config[_0xc040('0x77')],_0xc040('0xae'),process[_0xc040('0xad')][0x2]);if(!fs[_0xc040('0xaf')](_0x28c5fc)){throw new Error(_0xc040('0xb0'));}var _0x33f6d4={};try{_0x33f6d4=JSON[_0xc040('0x7e')](process[_0xc040('0xad')][0x3]);if(!_0x33f6d4[_0xc040('0x75')]){throw new Error(_0xc040('0xb1'));}if(!_0x33f6d4[_0xc040('0x75')][_0xc040('0x12')]){throw new Error(_0xc040('0xb2'));}if(!_0x33f6d4[_0xc040('0x75')][_0xc040('0x8c')]){throw new Error('firstName\x20is\x20mandatory');}var _0x13084c=0x0;if(_0x33f6d4[_0xc040('0x75')]['UserId']){_0x13084c=0x1;}if(!_0x33f6d4[_0xc040('0x3d')]){throw new Error(_0xc040('0xb3'));}}catch(_0x171dcc){throw new Error('body\x20id\x20mandatory');}var _0x5c7872=[];try{_0x5c7872=_[_0xc040('0xb4')](JSON[_0xc040('0x7e')](process[_0xc040('0xad')][0x4]),'id');}catch(_0x218eb5){logger[_0xc040('0x57')](_0xc040('0xb5'));}main(_0x28c5fc,_0x33f6d4,_0x5c7872,_0x13084c);}validate();process['on'](_0xc040('0xb6'),handleStop);process['on'](_0xc040('0xb7'),handleUncaughtException); \ No newline at end of file +var _0xa7bf=['cm_contacts.priority','into','cm_hopper','fromQuery','scheduledat','ListId','createdAt','updatedAt','priority','UserId','recallme','fields','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.phone\x20NOT\x20IN\x20(?)','toString','insert','cm_hopper_black','ContactId','cm_contacts','\x20=\x20','cm_contacts.phone','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','keys','CompanyId','scheduledAt','ListId\x20=\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','min_id','group','info','Received\x20SIGINT','error','exit','errors','code','sequelize','query','message','campaigns.id','campaigns.dialTimezone','campaigns','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','spread','voice_queues.id','voice_queues.dialTimezone','voice_queues','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','timezones','dialTimezone','isNil','set','offset','catch','main','stringify','send','start','binding','socket_timestamp','root','server/files/tmp','.csv','includes','header','ContactItemType','name','_description','writeFileSync','parse','data','rows','find','trim','agent\x20not\x20exists','email\x20wrong\x20format','dateOfBirth','isValid','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','hasOwnProperty','replace','itemTypeId','description','appendFileSync','emit','contact:import:','Abort\x20parser','abort','SystemError','duplicates','CREATE\x20TABLE\x20','campaigns_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','dialTimezone,utcOffset','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','DROP\x20TABLE\x20','contactId','contactTypeId','orderBy','voice_queues_has_cm_lists','VoiceQueueId','campaigns_has_cm_blacklists','CampaignId','voice_queues_has_cm_blacklists','finish','affectedRows','unlink','complete','argv','arguments\x20\x20\x20','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','SIGINT','path','lodash','papaparse','util','moment','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/environment/shared','../../../config/logger','import','redis','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field','phone','from','join','.id\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','CmContact','findAll','AdditionalPhones','then','length','push','all','split','filter','CmContactHasItem','findOne','update','PHONE','inserted','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt'];(function(_0x336efa,_0xd807a7){var _0x3cfafa=function(_0x3b12f9){while(--_0x3b12f9){_0x336efa['push'](_0x336efa['shift']());}};_0x3cfafa(++_0xd807a7);}(_0xa7bf,0x140));var _0xfa7b=function(_0x9bb6ad,_0x3bc83a){_0x9bb6ad=_0x9bb6ad-0x0;var _0x49c448=_0xa7bf[_0x9bb6ad];return _0x49c448;};'use strict';var fs=require('fs');var path=require(_0xfa7b('0x0'));var _=require(_0xfa7b('0x1'));var Papa=require(_0xfa7b('0x2'));var util=require(_0xfa7b('0x3'));var BPromise=require('bluebird');var moment=require(_0xfa7b('0x4'));var squel=require(_0xfa7b('0x5'));var Redis=require(_0xfa7b('0x6'));var db=require(_0xfa7b('0x7'))['db'];var config=require(_0xfa7b('0x8'));var shared=require(_0xfa7b('0x9'));var logger=require(_0xfa7b('0xa'))(_0xfa7b('0xb'));config[_0xfa7b('0xc')]=_['defaults'](config[_0xfa7b('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfa7b('0xc')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0xfa7b('0xd')](_0xfa7b('0xe'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0xfa7b('0xd')]('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x48e055){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))*$/[_0xfa7b('0xf')](_0x48e055);}function selectNotIn(_0x4fcc86,_0x2e94f4,_0x906929,_0x144c34,_0x169f5f){return squel[_0xfa7b('0x10')]()[_0xfa7b('0x11')](_0xfa7b('0x12'))[_0xfa7b('0x13')](_0x144c34)[_0xfa7b('0x14')](_0x2e94f4,null,_0x2e94f4+_0xfa7b('0x15')+_0x144c34+'.'+_0x906929)[_0xfa7b('0x16')](_0x144c34+'.'+_0x906929+'\x20=\x20'+_0x4fcc86+'.'+_0x906929)[_0xfa7b('0x16')](_0x2e94f4+_0xfa7b('0x17')+_0x169f5f['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x2c26de,_0x32f065){promisesAdditionalPhones=[];return db[_0xfa7b('0x18')][_0xfa7b('0x19')]({'raw':!![],'attributes':['id',_0xfa7b('0x1a')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0xfa7b('0x1b')](function(_0x1e1308){if(_0x1e1308!==null){var _0xe49f01=[];for(var _0x379839=0x0;_0x379839<_0x1e1308[_0xfa7b('0x1c')];_0x379839++){var _0x25085d=_0x1e1308[_0x379839];_0xe49f01[_0xfa7b('0x1d')](insertAdditionalPhones(_0x25085d));}}Promise[_0xfa7b('0x1e')](_0xe49f01)[_0xfa7b('0x1b')](function(){_0x2c26de({'val':0x1});});});});}function insertAdditionalPhones(_0x4e37bc){return new Promise(function(_0x153839,_0xf8d0ef){var _0x5eaba0=_0x4e37bc[_0xfa7b('0x1a')];var _0x2dae7e=_0x5eaba0[_0xfa7b('0x1f')](';');var _0x2b40f0=[];orderBy=0x0;for(var _0xe715a1=0x0;_0xe715a1<_0x2dae7e[_0xfa7b('0x1c')];_0xe715a1++){_0x2b40f0[_0xfa7b('0x1d')](splitAdditionalPhone(_0x4e37bc['id'],_0x2dae7e[_0xe715a1]));}Promise[_0xfa7b('0x1e')](_0x2b40f0)[_0xfa7b('0x1b')](function(){_0x153839({'val':_0x2dae7e[_0xfa7b('0x1c')]});});});}function splitAdditionalPhone(_0x1f5c7,_0x2d5401){return new Promise(function(_0x37eb33,_0x180e43){var _0x34cbb2=_0x2d5401[_0xfa7b('0x1f')](':');var _0x10e7bf=_0x34cbb2[0x0];var _0x1a2632=_0x34cbb2[0x1];if(!_['isNil'](_0x1a2632)){var _0x13892a=_0x1a2632[_0xfa7b('0x1f')]('|');var _0x1cc9dc=[];for(var _0x440037=0x0;_0x440037<_0x13892a[_0xfa7b('0x1c')];_0x440037++){if(_0x13892a[_0x440037]!==''){var _0xe25be4=_[_0xfa7b('0x20')](promisesAdditionalPhones,{'contactId':_0x1f5c7,'phone':_0x13892a[_0x440037]});if(_0xe25be4[_0xfa7b('0x1c')]==0x0){orderBy++;promisesAdditionalPhones[_0xfa7b('0x1d')]({'contactId':_0x1f5c7,'contactTypeId':_0x10e7bf,'phone':_0x13892a[_0x440037],'orderBy':orderBy});}}}_0x37eb33({'ok':0x1});}else _0x37eb33({'res':0x0});});}function createAdditionalPhone(_0x1a3047,_0x8b8342,_0x3e2518,_0x555204){var _0x43cc29='';var _0x1b95da='';var _0x15d530=_0x3e2518[_0xfa7b('0x1f')]('§');_0x43cc29=_0x15d530[0x0];if(_0x15d530[_0xfa7b('0x1c')]==0x2)_0x1b95da=_0x15d530[0x1];return new Promise(function(_0x129994,_0x3a22ce){return db[_0xfa7b('0x21')][_0xfa7b('0x22')]({'where':{'CmContactId':_0x1a3047,'item':_0x43cc29}})['then'](function(_0x3f8ebe){if(_0x3f8ebe){return db[_0xfa7b('0x21')][_0xfa7b('0x23')]({'ItemTypeId':_0x8b8342,'description':_0x1b95da,'OrderBy':_0x555204},{'where':{'CmContactId':_0x1a3047,'item':_0x43cc29}})['then'](function(_0x57b381){_0x129994({'res':'updated'});});}else{return db[_0xfa7b('0x21')]['create']({'CmContactId':_0x1a3047,'item':_0x43cc29,'description':_0x1b95da,'ItemTypeId':_0x8b8342,'OrderBy':_0x555204,'ItemClass':_0xfa7b('0x24')})['then'](function(_0x29a353){_0x129994({'res':_0xfa7b('0x25')});});}});});}function insertCmHopper(_0x158c90,_0x3022f6,_0x4707d1,_0x3f1d16,_0x120e83){var _0x443eb7=['cm_contacts.phone','cm_contacts.scheduledat',_0xfa7b('0x26'),_0xfa7b('0x27'),_0x3022f6+'.'+_0x3f1d16,_0xfa7b('0x28'),_0xfa7b('0x29'),_0xfa7b('0x2a'),'cm_contacts.UserId','\x22'+_0x120e83+'\x22'];return squel['insert']()[_0xfa7b('0x2b')](_0xfa7b('0x2c'))[_0xfa7b('0x2d')]([_0xfa7b('0x12'),_0xfa7b('0x2e'),'ContactId',_0xfa7b('0x2f'),_0x3f1d16,_0xfa7b('0x30'),_0xfa7b('0x31'),_0xfa7b('0x32'),_0xfa7b('0x33'),_0xfa7b('0x34')],squel[_0xfa7b('0x10')]()[_0xfa7b('0x35')](_0x443eb7)['from'](_0x3022f6)[_0xfa7b('0x14')]('cm_contacts',null,_0xfa7b('0x36')+_0x3022f6+_0xfa7b('0x37'))[_0xfa7b('0x14')](_0x4707d1,null,_0x4707d1+'.id\x20=\x20'+_0x3022f6+'.'+_0x3f1d16)[_0xfa7b('0x16')](_0x3022f6+_0xfa7b('0x38'),_0x158c90)[_0xfa7b('0x16')](_0xfa7b('0x39'),NOW)[_0xfa7b('0x16')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x3022f6,_0x4707d1,_0x3f1d16,_0xfa7b('0x2c'),[_0xfa7b('0x3a'),_0xfa7b('0x3b')]))[_0xfa7b('0x16')](_0xfa7b('0x3c'),selectNotIn(_0x3022f6,_0x4707d1,_0x3f1d16,'cm_hopper',[_0xfa7b('0x3a')])))[_0xfa7b('0x3d')]();}function insertCmHopperBlack(_0x3dcdce,_0x1c1b5d,_0x53d44b,_0x480a5c){var _0x2d97ba=['cm_contacts.phone',_0xfa7b('0x26'),'cm_contacts.ListId',_0x1c1b5d+'.'+_0x480a5c,'cm_contacts.createdAt',_0xfa7b('0x29')];return squel[_0xfa7b('0x3e')]()[_0xfa7b('0x2b')](_0xfa7b('0x3f'))['fromQuery']([_0xfa7b('0x12'),_0xfa7b('0x40'),_0xfa7b('0x2f'),_0x480a5c,_0xfa7b('0x30'),'updatedAt'],squel[_0xfa7b('0x10')]()[_0xfa7b('0x35')](_0x2d97ba)['from'](_0x1c1b5d)[_0xfa7b('0x14')](_0xfa7b('0x41'),null,'cm_contacts.ListId\x20=\x20'+_0x1c1b5d+'.CmListId')[_0xfa7b('0x14')](_0x53d44b,null,_0x53d44b+'.id\x20=\x20'+_0x1c1b5d+'.'+_0x480a5c)[_0xfa7b('0x16')](_0x1c1b5d+_0xfa7b('0x38'),_0x3dcdce)[_0xfa7b('0x16')](_0xfa7b('0x39'),NOW)[_0xfa7b('0x16')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0xfa7b('0x10')]()[_0xfa7b('0x11')]('phone')[_0xfa7b('0x13')](_0xfa7b('0x3f'))[_0xfa7b('0x16')]('ListId\x20=\x20?',_0x3dcdce)[_0xfa7b('0x16')](_0x480a5c+_0xfa7b('0x42')+_0x1c1b5d+'.'+_0x480a5c)))[_0xfa7b('0x3d')]();}function insertTzCmHopper(_0x7bffbf,_0x219ea0,_0x39140c,_0x2b6007,_0x468315,_0x113a78){var _0x26be99=[_0xfa7b('0x43'),_0xfa7b('0x44')+_0x113a78+_0xfa7b('0x45'),_0xfa7b('0x26'),_0xfa7b('0x27'),_0x219ea0+'.'+_0x2b6007,_0xfa7b('0x28'),_0xfa7b('0x29'),'cm_contacts.priority','cm_contacts.UserId','\x22'+_0x468315+'\x22'];var _0x16ba38=squel['insert']()[_0xfa7b('0x2b')](_0xfa7b('0x2c'))[_0xfa7b('0x2d')]([_0xfa7b('0x12'),_0xfa7b('0x2e'),_0xfa7b('0x40'),_0xfa7b('0x2f'),_0x2b6007,_0xfa7b('0x30'),_0xfa7b('0x31'),'priority',_0xfa7b('0x33'),'recallme'],squel['select']()['fields'](_0x26be99)[_0xfa7b('0x13')](_0x219ea0)['join'](_0xfa7b('0x41'),null,'cm_contacts.ListId\x20=\x20'+_0x219ea0+_0xfa7b('0x37'))[_0xfa7b('0x14')](_0x39140c,null,_0x39140c+_0xfa7b('0x15')+_0x219ea0+'.'+_0x2b6007)[_0xfa7b('0x14')](_0x113a78,null,_0x113a78+_0xfa7b('0x15')+_0x219ea0+'.'+_0x2b6007)['where'](_0x219ea0+_0xfa7b('0x38'),_0x7bffbf)[_0xfa7b('0x16')](_0xfa7b('0x39'),NOW)[_0xfa7b('0x16')](_0xfa7b('0x3c'),selectNotIn(_0x219ea0,_0x39140c,_0x2b6007,'cm_hopper',[_0xfa7b('0x3a'),_0xfa7b('0x3b')]))[_0xfa7b('0x16')](_0xfa7b('0x3c'),selectNotIn(_0x219ea0,_0x39140c,_0x2b6007,_0xfa7b('0x2c'),[_0xfa7b('0x3a')])))[_0xfa7b('0x3d')]();return _0x16ba38;}function insertTzCmHopperBlack(_0x28e96b,_0x46cf46,_0x5e3a7f,_0x1df92b){var _0x494f8e=['cm_contacts.phone',_0xfa7b('0x26'),_0xfa7b('0x27'),_0x46cf46+'.'+_0x1df92b,_0xfa7b('0x28'),_0xfa7b('0x29')];return squel[_0xfa7b('0x3e')]()[_0xfa7b('0x2b')](_0xfa7b('0x3f'))[_0xfa7b('0x2d')]([_0xfa7b('0x12'),_0xfa7b('0x40'),_0xfa7b('0x2f'),_0x1df92b,'createdAt',_0xfa7b('0x31')],squel[_0xfa7b('0x10')]()[_0xfa7b('0x35')](_0x494f8e)[_0xfa7b('0x13')](_0x46cf46)[_0xfa7b('0x14')](_0xfa7b('0x41'),null,_0xfa7b('0x36')+_0x46cf46+_0xfa7b('0x37'))[_0xfa7b('0x14')](_0x5e3a7f,null,_0x5e3a7f+'.id\x20=\x20'+_0x46cf46+'.'+_0x1df92b)[_0xfa7b('0x16')](_0x46cf46+_0xfa7b('0x38'),_0x28e96b)[_0xfa7b('0x16')](_0xfa7b('0x39'),NOW)['where'](_0xfa7b('0x3c'),squel['select']()[_0xfa7b('0x11')]('phone')[_0xfa7b('0x13')]('cm_hopper_black')['where']('ListId\x20=\x20?',_0x28e96b)['where'](_0x1df92b+_0xfa7b('0x42')+_0x46cf46+'.'+_0x1df92b)))[_0xfa7b('0x3d')]();}function insertCmHopperAdditionalPhones(_0x53f9c6){var _0x2fafbc=[_0xfa7b('0x46'),_0xfa7b('0x47'),_0xfa7b('0x48'),_0xfa7b('0x49'),_0xfa7b('0x4a')];return squel[_0xfa7b('0x3e')]()[_0xfa7b('0x2b')](_0xfa7b('0x4b'))[_0xfa7b('0x2d')]([_0xfa7b('0x4c'),_0xfa7b('0x12'),_0xfa7b('0x4d'),_0xfa7b('0x30'),_0xfa7b('0x31')],squel['select']()[_0xfa7b('0x35')](_0x2fafbc)[_0xfa7b('0x13')](_0xfa7b('0x2c'))[_0xfa7b('0x14')]('cm_contacts',null,_0xfa7b('0x4e'))[_0xfa7b('0x14')](_0xfa7b('0x4f'),null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')[_0xfa7b('0x16')]('cm_hopper.ListId\x20=\x20?',_0x53f9c6)['where'](_0xfa7b('0x39'),NOW))[_0xfa7b('0x3d')]();}function insertCmContact(_0xed51b4,_0x21cf13,_0x40c7e8,_0x55bfc4){var _0x30a85c=_['concat'](_[_0xfa7b('0x50')](_0x55bfc4),[_0xfa7b('0x2f'),_0xfa7b('0x51'),_0xfa7b('0x30'),_0xfa7b('0x31'),_0xfa7b('0x52')]);return squel[_0xfa7b('0x3e')]()[_0xfa7b('0x2b')]('cm_contacts')['fromQuery'](_0x30a85c,squel[_0xfa7b('0x10')]()['fields'](_0x30a85c)[_0xfa7b('0x13')](_0x21cf13)[_0xfa7b('0x16')]('('+_0x40c7e8[_0xfa7b('0x14')](',')+')\x20NOT\x20IN\x20?',squel[_0xfa7b('0x10')]()[_0xfa7b('0x35')](_0x40c7e8)[_0xfa7b('0x13')](_0xfa7b('0x41'))[_0xfa7b('0x16')](_0xfa7b('0x53'),_0xed51b4)[_0xfa7b('0x16')](_0xfa7b('0x54')))[_0xfa7b('0x16')](_0xfa7b('0x55'),squel['select']()[_0xfa7b('0x11')]('MIN(id)',_0xfa7b('0x56'))['from'](_0x21cf13)[_0xfa7b('0x57')](_0x40c7e8['join'](','))))[_0xfa7b('0x3d')]();}function handleStop(){logger[_0xfa7b('0x58')](_0xfa7b('0x59'));stopped=!![];}function handleUncaughtException(_0x4dcb46){logger[_0xfa7b('0x5a')](_0x4dcb46['message']);process[_0xfa7b('0x5b')](0x1);}function handleError(_0x5d6c37,_0x3bfac8){stats[_0xfa7b('0x5c')]['push']({'name':_0x3bfac8[_0xfa7b('0x5d')],'message':_0x3bfac8['message'],'row':_0x5d6c37});}function handleQuery(_0x556878){logger['info'](_0x556878);return db[_0xfa7b('0x5e')][_0xfa7b('0x5f')](_0x556878)['spread'](function(_0x1f4e90){results[_0xfa7b('0x1d')](_0x1f4e90);})['catch'](function(_0xd3cc10){logger[_0xfa7b('0x5a')](_0xd3cc10[_0xfa7b('0x60')]);});}function updateTzCampaigns(_0x45ed21){return new Promise(function(_0x3b5da1,_0x9f1563){var _0x4899f6=squel[_0xfa7b('0x10')]()['fields']([_0xfa7b('0x61'),_0xfa7b('0x62')])[_0xfa7b('0x13')](_0xfa7b('0x63'))[_0xfa7b('0x14')](_0xfa7b('0x64'),null,_0xfa7b('0x65'))[_0xfa7b('0x16')](_0xfa7b('0x66')+_0x45ed21);db['sequelize'][_0xfa7b('0x5f')](_0x4899f6[_0xfa7b('0x3d')]())[_0xfa7b('0x67')](function(_0x4ede5b){var _0x46afdf=[];for(var _0x1d0382=0x0;_0x1d0382<_0x4ede5b['length'];_0x1d0382++){_0x46afdf[_0xfa7b('0x1d')](getTimezoneData(_0x4ede5b[_0x1d0382],tmp_campaigns));}BPromise[_0xfa7b('0x1e')](_0x46afdf)[_0xfa7b('0x1b')](function(){_0x3b5da1({'val':0x1});});})['catch'](function(_0x310351){logger[_0xfa7b('0x5a')](_0x310351[_0xfa7b('0x60')]);_0x3b5da1({'val':0x0});});});}function updateTzVoiceQueues(_0x1a4402){return new Promise(function(_0x58ee2f,_0x4de69e){var _0x3090d0=squel[_0xfa7b('0x10')]()['fields']([_0xfa7b('0x68'),_0xfa7b('0x69')])['from'](_0xfa7b('0x6a'))[_0xfa7b('0x14')]('voice_queues_has_cm_lists',null,_0xfa7b('0x6b'))[_0xfa7b('0x16')](_0xfa7b('0x6c')+_0x1a4402);db[_0xfa7b('0x5e')][_0xfa7b('0x5f')](_0x3090d0[_0xfa7b('0x3d')]())[_0xfa7b('0x67')](function(_0x19699e){var _0x62cd8b=[];for(var _0x24af66=0x0;_0x24af66<_0x19699e['length'];_0x24af66++){_0x62cd8b[_0xfa7b('0x1d')](getTimezoneData(_0x19699e[_0x24af66],tmp_voice_queues));}BPromise['all'](_0x62cd8b)[_0xfa7b('0x1b')](function(){_0x58ee2f({'val':0x1});});})['catch'](function(_0xe4c8ad){logger['error'](_0xe4c8ad['message']);_0x58ee2f({'val':0x0});});});}function getTimezoneData(_0x353b77,_0x7b8ff8){return new Promise(function(_0x1b6fdc,_0x380cc4){var _0xb657c1=shared[_0xfa7b('0x6d')];var _0x5155b6=_0xb657c1[_0x353b77[_0xfa7b('0x6e')]];if(_[_0xfa7b('0x6f')](_0x5155b6)){_0x1b6fdc({'ret':0x1});}else{var _0x5dc07a=_0x5155b6['utcOffset'];var _0x892f0e=squel[_0xfa7b('0x3e')]()[_0xfa7b('0x2b')](_0x7b8ff8)[_0xfa7b('0x70')]('id',_0x353b77['id'])[_0xfa7b('0x70')](_0xfa7b('0x71'),_0x5dc07a)[_0xfa7b('0x70')](_0xfa7b('0x6e'),_0x353b77[_0xfa7b('0x6e')])['toString']();return db[_0xfa7b('0x5e')][_0xfa7b('0x5f')](_0x892f0e)[_0xfa7b('0x67')](function(_0x1977fa){_0x1b6fdc({'ret':0x1});})[_0xfa7b('0x72')](function(_0x1a14ba){logger[_0xfa7b('0x5a')](_0x1a14ba[_0xfa7b('0x60')]);_0x380cc4({'ret':0x1});});}});}function handleTZQuery(_0x5893ea){logger['info'](_0x5893ea);return db[_0xfa7b('0x5e')][_0xfa7b('0x5f')](_0x5893ea)['spread'](function(_0x6d597b){})[_0xfa7b('0x72')](function(_0x5d12c6){logger[_0xfa7b('0x5a')](_0x5d12c6[_0xfa7b('0x60')]);});}function main(_0x2fc50a,_0x187050,_0x3cd3b1,_0x3bf12a){logger[_0xfa7b('0x58')](_0xfa7b('0x73'),_0x2fc50a,JSON[_0xfa7b('0x74')](_0x187050));process[_0xfa7b('0x75')](_0xfa7b('0x76'));var _0x250a5c=_0x187050[_0xfa7b('0x77')];var _0x128f0f=_['clone'](_0x250a5c);var _0x10401f=_0x187050[_0xfa7b('0x78')];var _0xaef88f=path['join'](config[_0xfa7b('0x79')],_0xfa7b('0x7a'),_0x10401f+_0xfa7b('0x7b'));hasTZ=_[_0xfa7b('0x50')](_0x250a5c)[_0xfa7b('0x7c')](_0xfa7b('0x6e'));var _0x484841=_[_0xfa7b('0x50')](_0x250a5c)[_0xfa7b('0x14')]();logger[_0xfa7b('0x58')](_0xfa7b('0x7d'),_0x484841);db[_0xfa7b('0x7e')][_0xfa7b('0x19')]({'raw':!![],'attributes':['id',_0xfa7b('0x7f')]})[_0xfa7b('0x1b')](function(_0x1e5080){for(var _0x1da0eb=0x0;_0x1da0eb<_0x1e5080[_0xfa7b('0x1c')];_0x1da0eb++){if(_0x1e5080[_0x1da0eb][_0xfa7b('0x7f')]in _0x250a5c){contactItemTypes[_0xfa7b('0x1d')](_0x1e5080[_0x1da0eb]);delete _0x128f0f[_0x1e5080[_0x1da0eb]['name']];hasAdditionalPhones=!![];}for(var _0x438e17 in _0x250a5c){if(_0x1e5080[_0x1da0eb]['name']+_0xfa7b('0x80')===_0x438e17){phoneDescriptions[_0xfa7b('0x1d')]({'itemTypeId':_0x1e5080[_0x1da0eb]['id'],'description':_0x438e17});delete _0x128f0f[_0x438e17];}}}if(hasAdditionalPhones)_0x128f0f[_0xfa7b('0x1a')]='';var _0x206388=_[_0xfa7b('0x50')](_0x128f0f)[_0xfa7b('0x14')]();logger[_0xfa7b('0x58')]('header',_0x206388);fs[_0xfa7b('0x81')](_0xaef88f,_0x206388+'\x0a');Papa[_0xfa7b('0x82')](fs['createReadStream'](_0x2fc50a),{'header':!![],'skipEmptyLines':!![],'step':function(_0x14283e,_0x38aaa1){try{for(var _0x3cfbfa=0x0,_0x2fff0f=[];_0x3cfbfa<_0x14283e[_0xfa7b('0x83')][_0xfa7b('0x1c')];_0x3cfbfa++){stats[_0xfa7b('0x84')]+=0x1;if(_0x14283e[_0xfa7b('0x5c')][_0x3cfbfa]){handleError(_0x14283e[_0xfa7b('0x83')][_0x3cfbfa],_0x14283e[_0xfa7b('0x5c')][_0x3cfbfa]);}else{var _0x341582=[];var _0x1e6a7e=[];var _0x5d9aed={};for(var _0x437d2e in _0x250a5c){let _0x1bd8c4=contactItemTypes[_0xfa7b('0x85')](_0x2f23ab=>_0x2f23ab['name']===_0x437d2e);let _0x261bed=contactItemTypes[_0xfa7b('0x85')](_0x3eb48e=>_0x3eb48e['name']+_0xfa7b('0x80')===_0x437d2e);if(_[_0xfa7b('0x6f')](_0x1bd8c4)&&_[_0xfa7b('0x6f')](_0x261bed)){if(_0x250a5c['hasOwnProperty'](_0x437d2e)){if(_0x14283e[_0xfa7b('0x83')][_0x3cfbfa][_0x250a5c[_0x437d2e]]){var _0x3598d6=_[_0xfa7b('0x86')](_0x14283e[_0xfa7b('0x83')][_0x3cfbfa][_0x250a5c[_0x437d2e]]['replace'](/"/g,'\x27'));switch(_0x437d2e){case _0xfa7b('0x2e'):var _0x1eead0=moment(_0x3598d6,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x1eead0['isValid']()){_0x2fff0f[_0xfa7b('0x1d')]('\x22'+_0x3598d6+'\x22');}else{_0x341582['push']('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0xfa7b('0x32'):var _0x5a7aa7=parseInt(_0x3598d6);_0x3598d6=_['isNaN'](_0x5a7aa7)||_0x5a7aa7<0x0||_0x5a7aa7>0x4?_0x3bf12a?0x3:0x2:_0x5a7aa7;_0x2fff0f[_0xfa7b('0x1d')]('\x22'+_0x3598d6+'\x22');break;case _0xfa7b('0x33'):var _0x3b5cc6=parseInt(_0x3598d6);if(_['isNumber'](_0x3b5cc6)&&_[_0xfa7b('0x7c')](_0x3cd3b1,_0x3b5cc6)){_0x2fff0f[_0xfa7b('0x1d')]('\x22'+_0x3b5cc6+'\x22');}else{_0x341582['push'](_0xfa7b('0x87'));}break;case'email':if(isEmail(_0x3598d6)){_0x2fff0f[_0xfa7b('0x1d')]('\x22'+_0x3598d6+'\x22');}else{_0x341582['push'](_0xfa7b('0x88'));}break;case _0xfa7b('0x89'):var _0x3554aa=moment(_0x3598d6,'YYYY-MM-DD',!![]);if(_0x3554aa[_0xfa7b('0x8a')]()){_0x2fff0f[_0xfa7b('0x1d')]('\x22'+_0x3598d6+'\x22');}else{_0x341582[_0xfa7b('0x1d')](_0xfa7b('0x8b'));}break;case _0xfa7b('0x6e'):var _0x36f271=shared[_0xfa7b('0x6d')];var _0x2f578f=_0x36f271[_0x3598d6];if(!_[_0xfa7b('0x6f')](_0x2f578f)){var _0x182f15=_0x2f578f['utcOffset'];_0x2fff0f['push']('\x22'+_0x3598d6+'\x22');_0x2fff0f[_0xfa7b('0x1d')]('\x22'+_0x182f15+'\x22');}break;default:_0x2fff0f[_0xfa7b('0x1d')]('\x22'+_0x3598d6+'\x22');}}else{switch(_0x437d2e){case _0xfa7b('0x8c'):case _0xfa7b('0x12'):_0x341582[_0xfa7b('0x1d')](_0x437d2e+'\x20not\x20specified');break;default:_0x2fff0f[_0xfa7b('0x1d')]('\x22\x22');}}}}else{var _0x366638='';if(!_[_0xfa7b('0x6f')](_0x1bd8c4)){if(!_0x5d9aed[_0xfa7b('0x8d')](_0x1bd8c4['id'])){if(!_[_0xfa7b('0x6f')](_0x14283e[_0xfa7b('0x83')][_0x3cfbfa][_0x250a5c[_0x437d2e]])){var _0x3598d6=_['trim'](_0x14283e[_0xfa7b('0x83')][_0x3cfbfa][_0x250a5c[_0x437d2e]][_0xfa7b('0x8e')](/"/g,'\x27'));var _0x219ff0=phoneDescriptions[_0xfa7b('0x85')](_0x2a0848=>_0x2a0848[_0xfa7b('0x8f')]===_0x1bd8c4['id']);if(!_['isNil'](_0x219ff0)){var _0x249f44=_['trim'](_0x14283e[_0xfa7b('0x83')][_0x3cfbfa][_0x250a5c[_0x219ff0[_0xfa7b('0x90')]]][_0xfa7b('0x8e')](/"/g,'\x27'));if(!_['isNil'](_0x249f44))_0x3598d6=_0x3598d6+'§'+_0x249f44;}if(_0x366638=='')_0x366638=_0x3598d6;else _0x366638+='|'+_0x3598d6;}_0x1e6a7e[_0xfa7b('0x1d')](_0x1bd8c4['id']+':'+_0x366638);_0x5d9aed[_0x1bd8c4['id']]=0x1;}}}}if(hasAdditionalPhones){_0x2fff0f['push']('\x22'+_0x1e6a7e[_0xfa7b('0x14')](';')+'\x22');}if(_0x341582['length']){handleError(_0x14283e[_0xfa7b('0x83')][_0x3cfbfa],{'code':'SystemRow','message':_0x341582[_0xfa7b('0x14')]()});}else{fs[_0xfa7b('0x91')](_0xaef88f,_0x2fff0f[_0xfa7b('0x14')]()+'\x0a');}_0x2fff0f=[];}if(!(stats[_0xfa7b('0x84')]%0xc8)){socket[_0xfa7b('0x92')](_0xfa7b('0x93')+_0x10401f,stats);stats[_0xfa7b('0x5c')]=[];}}if(stopped){logger[_0xfa7b('0x58')](_0xfa7b('0x94'));_0x38aaa1[_0xfa7b('0x95')]();}}catch(_0x444efa){handleError(_0x14283e[_0xfa7b('0x83')][_0x3cfbfa],{'code':_0xfa7b('0x96'),'message':_0x444efa[_0xfa7b('0x60')]});logger[_0xfa7b('0x5a')]('step',_0x444efa[_0xfa7b('0x60')]);}},'complete':function(){try{var _0x1197e5=[];var _0x2cb218=[];var _0x7a0aa='cm_contacts';if(_0x187050[_0xfa7b('0x97')]&&_0x187050[_0xfa7b('0x97')][_0xfa7b('0x1c')]){_0x7a0aa='cm_contacts_'+_0x10401f;_0x1197e5[_0xfa7b('0x1d')](_0xfa7b('0x98')+_0x7a0aa+'\x20LIKE\x20cm_contacts;');}tmp_campaigns=_0xfa7b('0x99')+_0x10401f;tmp_voice_queues='voice_queues_'+_0x10401f;_0x2cb218[_0xfa7b('0x1d')](_0xfa7b('0x98')+tmp_campaigns+_0xfa7b('0x9a'));_0x2cb218['push'](_0xfa7b('0x98')+tmp_voice_queues+_0xfa7b('0x9a'));BPromise[_0xfa7b('0x9b')](_0x2cb218,handleTZQuery)[_0xfa7b('0x1b')](function(_0x61d294){updateTzCampaigns(_0x187050[_0xfa7b('0x2f')])[_0xfa7b('0x1b')](function(_0x4dcce1){updateTzVoiceQueues(_0x187050[_0xfa7b('0x2f')])[_0xfa7b('0x1b')](function(_0x19cfe6){if(hasTZ)_0x206388=_0x206388[_0xfa7b('0x8e')](_0xfa7b('0x6e'),_0xfa7b('0x9c'));var _0x3300ef=util[_0xfa7b('0xd')](_0xfa7b('0x9d'),_0xaef88f,_0x7a0aa,_0x206388,_0x187050[_0xfa7b('0x2f')],_0x187050['CompanyId']||null,NOW,NOW);if(_['isNil'](_0x250a5c['scheduledat'])){_0x3300ef+=',\x20scheduledAt\x20=\x20NOW()';}_0x1197e5['push'](_0x3300ef);if(_0x187050[_0xfa7b('0x97')]&&_0x187050[_0xfa7b('0x97')][_0xfa7b('0x1c')]){_0x1197e5[_0xfa7b('0x1d')](insertCmContact(_0x187050['ListId'],_0x7a0aa,_0x187050[_0xfa7b('0x97')],_0x250a5c));_0x1197e5[_0xfa7b('0x1d')](_0xfa7b('0x9e')+_0x7a0aa+';');}BPromise['each'](_0x1197e5,handleQuery)[_0xfa7b('0x1b')](function(_0x216692){BPromise['all']([handleAdditionalPhones()])[_0xfa7b('0x1b')](function(){_0x1197e5=[];for(var _0x24b5db=0x0;_0x24b5db\x20\x20','argv','existsSync','file\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','map','No\x20agent\x20available'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa321,0x9d));var _0x1a32=function(_0x4c0622,_0x5dacaf){_0x4c0622=_0x4c0622-0x0;var _0x1799d8=_0xa321[_0x4c0622];return _0x1799d8;};'use strict';var fs=require('fs');var path=require(_0x1a32('0x0'));var _=require(_0x1a32('0x1'));var Papa=require(_0x1a32('0x2'));var util=require(_0x1a32('0x3'));var BPromise=require('bluebird');var moment=require(_0x1a32('0x4'));var squel=require(_0x1a32('0x5'));var Redis=require('ioredis');var db=require(_0x1a32('0x6'))['db'];var config=require(_0x1a32('0x7'));var logger=require('../../../config/logger')('import');config['redis']=_[_0x1a32('0x8')](config['redis'],{'host':_0x1a32('0x9'),'port':0x18eb});var socket=require(_0x1a32('0xa'))(new Redis(config[_0x1a32('0xb')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()[_0x1a32('0xc')](_0x1a32('0xd'));var tempTableName='cm_contacts_temp_'+moment()[_0x1a32('0xc')](_0x1a32('0xe'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x5d034a){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/[_0x1a32('0xf')](_0x5d034a);}function selectNotIn(_0x3cf338,_0x1ce64e,_0x1d2439,_0x2d99fc,_0x31f14f){return squel['select']()[_0x1a32('0x10')](_0x1a32('0x11'))[_0x1a32('0x12')](_0x2d99fc)['join'](_0x1ce64e,null,_0x1ce64e+_0x1a32('0x13')+_0x2d99fc+'.'+_0x1d2439)[_0x1a32('0x14')](_0x2d99fc+'.'+_0x1d2439+_0x1a32('0x15')+_0x3cf338+'.'+_0x1d2439)[_0x1a32('0x14')](_0x1ce64e+_0x1a32('0x16')+_0x31f14f['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x4498c7,_0x456e81){promisesAdditionalPhones=[];promisesContact=[];return db[_0x1a32('0x17')][_0x1a32('0x18')](_0x1a32('0x19')+tempTableName)[_0x1a32('0x1a')](function(_0x5c272a){if(_0x5c272a!==null){var _0x29c53d=[];for(var _0x463763=0x0;_0x463763<_0x5c272a['length'];_0x463763++){var _0x2954a4=_0x5c272a[_0x463763];if(!_[_0x1a32('0x1b')](_0x2954a4[_0x1a32('0x11')])){if(!_[_0x1a32('0x1b')](_0x2954a4[_0x1a32('0x1c')]))_0x29c53d[_0x1a32('0x1d')](insertAdditionalPhones(_0x2954a4));promisesContact[_0x1a32('0x1d')]({'contact':_0x2954a4});}}}Promise[_0x1a32('0x1e')](_0x29c53d)[_0x1a32('0x1f')](function(){_0x4498c7({'val':0x1});});})[_0x1a32('0x20')](function(_0x2f6381){logger['error'](_0x2f6381[_0x1a32('0x21')]);});});}function insertAdditionalPhones(_0x16896e){return new Promise(function(_0x235fd0,_0x5a12d5){var _0x17e938=_0x16896e[_0x1a32('0x1c')];if(_['isNil'](_0x17e938))_0x5a12d5({'val':0x0});else{var _0x1250dc=_0x17e938['split'](';');var _0x125504=[];orderBy=0x0;for(var _0x3f1409=0x0;_0x3f1409<_0x1250dc['length'];_0x3f1409++){_0x125504[_0x1a32('0x1d')](splitAdditionalPhone(_0x16896e['id'],_0x1250dc[_0x3f1409]));}Promise[_0x1a32('0x1e')](_0x125504)[_0x1a32('0x1f')](function(){_0x235fd0({'val':_0x1250dc['length']});});}});}function splitAdditionalPhone(_0x2d6637,_0x1fe746){return new Promise(function(_0x4bf0a0,_0x372b95){var _0x3b46e4=_0x1fe746['split'](':');var _0x41c892=_0x3b46e4[0x0];var _0x4b3b33=_0x3b46e4[0x1];if(_0x4b3b33!==''){var _0x4c183c=_0x4b3b33['split']('|');var _0x4c24b0=[];for(var _0x57eb3c=0x0;_0x57eb3c<_0x4c183c[_0x1a32('0x22')];_0x57eb3c++){if(_0x4c183c[_0x57eb3c]!==''){var _0x2309b3=_[_0x1a32('0x23')](promisesAdditionalPhones,{'contactId':_0x2d6637,'phone':_0x4c183c[_0x57eb3c]});if(_0x2309b3[_0x1a32('0x22')]==0x0){orderBy++;promisesAdditionalPhones[_0x1a32('0x1d')]({'contactId':_0x2d6637,'contactTypeId':_0x41c892,'phone':_0x4c183c[_0x57eb3c],'orderBy':orderBy});}}}_0x4bf0a0({'ok':0x1});}else _0x4bf0a0({'res':0x0});});}function createAdditionalPhone(_0x35af58,_0x19e0e6,_0x2edc3e,_0x48d69d){var _0x3a51e2='';var _0x2fe917='';var _0x37d660=_0x2edc3e[_0x1a32('0x24')]('§');_0x3a51e2=_0x37d660[0x0];if(_0x37d660[_0x1a32('0x22')]==0x2)_0x2fe917=_0x37d660[0x1];return new Promise(function(_0x1a8b5c,_0x821dbf){return db[_0x1a32('0x25')][_0x1a32('0x26')]({'where':{'CmContactId':_0x35af58,'item':_0x3a51e2}})['then'](function(_0x1af0dc){if(_0x1af0dc){return db[_0x1a32('0x25')]['update']({'ItemTypeId':_0x19e0e6,'description':_0x2fe917,'OrderBy':_0x48d69d},{'where':{'CmContactId':_0x35af58,'item':_0x3a51e2}})['then'](function(_0xd3bf6e){_0x1a8b5c({'res':'updated'});});}else{return db['CmContactHasItem'][_0x1a32('0x27')]({'CmContactId':_0x35af58,'item':_0x3a51e2,'ItemTypeId':_0x19e0e6,'description':_0x2fe917,'OrderBy':_0x48d69d,'ItemClass':'PHONE'})['then'](function(_0x488d58){_0x1a8b5c({'res':'inserted'});});}});});}function updateContact(_0x23015f){return new Promise(function(_0x1eeec4,_0x7c255c){var _0x277359=_0x23015f['id'];delete _0x23015f['id'];return db[_0x1a32('0x28')]['update'](_0x23015f,{'where':{'id':_0x277359}})['then'](function(_0x3d6385){updatedRows+=0x1;return db['CmHopper'][_0x1a32('0x29')]({'phone':_0x23015f[_0x1a32('0x11')]},{'where':{'ContactId':_0x277359}})[_0x1a32('0x1f')](function(_0x4cecdc){_0x1eeec4({'ret':'OK'});});});});}function insertCmHopper(_0x24afda,_0x276626,_0x2121e2,_0x4648b7,_0x3acb50){var _0x454e69=[_0x1a32('0x2a'),_0x1a32('0x2b'),_0x1a32('0x2c'),'cm_contacts.ListId',_0x276626+'.'+_0x4648b7,_0x1a32('0x2d'),_0x1a32('0x2e'),_0x1a32('0x2f'),'cm_contacts.UserId','\x22'+_0x3acb50+'\x22'];return squel[_0x1a32('0x30')]()[_0x1a32('0x31')](_0x1a32('0x32'))[_0x1a32('0x33')]([_0x1a32('0x11'),_0x1a32('0x34'),_0x1a32('0x35'),_0x1a32('0x36'),_0x4648b7,_0x1a32('0x37'),_0x1a32('0x38'),_0x1a32('0x39'),_0x1a32('0x3a'),_0x1a32('0x3b')],squel[_0x1a32('0x3c')]()[_0x1a32('0x3d')](_0x454e69)['from'](_0x276626)['join']('cm_contacts',null,_0x1a32('0x3e')+_0x276626+_0x1a32('0x3f'))[_0x1a32('0x40')](_0x2121e2,null,_0x2121e2+_0x1a32('0x13')+_0x276626+'.'+_0x4648b7)[_0x1a32('0x14')](_0x276626+'.CmListId\x20=\x20?',_0x24afda)[_0x1a32('0x14')](_0x1a32('0x41'),NOW)[_0x1a32('0x14')](_0x1a32('0x42'),selectNotIn(_0x276626,_0x2121e2,_0x4648b7,_0x1a32('0x32'),[_0x1a32('0x43'),'\x22onlyIfOpen\x22']))[_0x1a32('0x14')](_0x1a32('0x42'),selectNotIn(_0x276626,_0x2121e2,_0x4648b7,_0x1a32('0x32'),[_0x1a32('0x43')])))[_0x1a32('0x44')]();}function insertCmHopperBlack(_0x4d779c,_0x4b8551,_0x4dbab5,_0x5e58f7){var _0x3ce446=[_0x1a32('0x2a'),'cm_contacts.id',_0x1a32('0x45'),_0x4b8551+'.'+_0x5e58f7,_0x1a32('0x2d'),_0x1a32('0x2e')];return squel[_0x1a32('0x30')]()[_0x1a32('0x31')](_0x1a32('0x46'))[_0x1a32('0x33')]([_0x1a32('0x11'),_0x1a32('0x35'),_0x1a32('0x36'),_0x5e58f7,_0x1a32('0x37'),_0x1a32('0x38')],squel[_0x1a32('0x3c')]()['fields'](_0x3ce446)[_0x1a32('0x12')](_0x4b8551)['join']('cm_contacts',null,_0x1a32('0x3e')+_0x4b8551+'.CmListId')[_0x1a32('0x40')](_0x4dbab5,null,_0x4dbab5+'.id\x20=\x20'+_0x4b8551+'.'+_0x5e58f7)[_0x1a32('0x14')](_0x4b8551+_0x1a32('0x47'),_0x4d779c)[_0x1a32('0x14')](_0x1a32('0x41'),NOW)[_0x1a32('0x14')](_0x1a32('0x42'),squel[_0x1a32('0x3c')]()[_0x1a32('0x10')](_0x1a32('0x11'))['from'](_0x1a32('0x46'))[_0x1a32('0x14')](_0x1a32('0x48'),_0x4d779c)['where'](_0x5e58f7+_0x1a32('0x49'),_0x4b8551+'.'+_0x5e58f7)))[_0x1a32('0x44')]();}function insertCmHopperAdditionalPhones(_0x3eb072){var _0x2862d6=[_0x1a32('0x4a'),'cm_contact_has_items.item',_0x1a32('0x4b'),_0x1a32('0x4c'),_0x1a32('0x4d')];return squel[_0x1a32('0x30')]()[_0x1a32('0x31')](_0x1a32('0x4e'))[_0x1a32('0x33')]([_0x1a32('0x4f'),_0x1a32('0x11'),'OrderBy',_0x1a32('0x37'),_0x1a32('0x38')],squel[_0x1a32('0x3c')]()['fields'](_0x2862d6)[_0x1a32('0x12')](_0x1a32('0x32'))['join'](_0x1a32('0x50'),null,_0x1a32('0x51'))[_0x1a32('0x40')]('cm_contact_has_items',null,_0x1a32('0x52'))[_0x1a32('0x14')]('cm_hopper.ListId\x20=\x20?',_0x3eb072)[_0x1a32('0x14')]('cm_contacts.createdAt\x20=\x20?',NOW))['toString']();}function insertCmContact(_0x196206,_0x4bf957,_0x5b4235,_0x1970b0){var _0xde3465=_[_0x1a32('0x53')](_[_0x1a32('0x54')](_0x1970b0),[_0x1a32('0x36'),_0x1a32('0x55'),_0x1a32('0x37'),'updatedAt']);return squel['insert']()[_0x1a32('0x31')]('cm_contacts')[_0x1a32('0x33')](_0xde3465,squel[_0x1a32('0x3c')]()[_0x1a32('0x3d')](_0xde3465)[_0x1a32('0x12')](_0x4bf957)[_0x1a32('0x14')]('('+_0x5b4235['join'](',')+_0x1a32('0x56'),squel[_0x1a32('0x3c')]()[_0x1a32('0x3d')](_0x5b4235)['from']('cm_contacts')['where'](_0x1a32('0x48'),_0x196206))[_0x1a32('0x14')](_0x1a32('0x57'),squel[_0x1a32('0x3c')]()[_0x1a32('0x10')](_0x1a32('0x58'),'min_id')['from'](_0x4bf957)[_0x1a32('0x59')](_0x5b4235[_0x1a32('0x40')](','))))[_0x1a32('0x44')]();}function handleStop(){logger[_0x1a32('0x5a')](_0x1a32('0x5b'));stopped=!![];}function handleUncaughtException(_0x3d1f6a){logger[_0x1a32('0x5c')](_0x3d1f6a['message']);process[_0x1a32('0x5d')](0x1);}function handleError(_0x142d88,_0x15a37c){stats[_0x1a32('0x5e')]['push']({'name':_0x15a37c[_0x1a32('0x5f')],'message':_0x15a37c[_0x1a32('0x21')],'row':_0x142d88});}function handleQuery(_0x5c1cb6){logger[_0x1a32('0x5a')](_0x5c1cb6);return db[_0x1a32('0x17')][_0x1a32('0x18')](_0x5c1cb6)[_0x1a32('0x1a')](function(_0x2bc60f){results[_0x1a32('0x1d')](_0x2bc60f);})[_0x1a32('0x20')](function(_0x3d55c8){logger[_0x1a32('0x5c')](_0x3d55c8[_0x1a32('0x21')]);});}function main(_0x493194,_0x11f231,_0x3d0b2e,_0x5b6bc8){logger[_0x1a32('0x5a')](_0x1a32('0x60'),_0x493194,JSON['stringify'](_0x11f231));process['send'](_0x1a32('0x61'));var _0x3f0803=_0x11f231[_0x1a32('0x62')];var _0x32b3cb=_[_0x1a32('0x63')](_0x3f0803);var _0x3b5084=_0x11f231[_0x1a32('0x64')];var _0x552536=path[_0x1a32('0x40')](config[_0x1a32('0x65')],'server/files/tmp',_0x3b5084+_0x1a32('0x66'));logger[_0x1a32('0x5a')](_0x1a32('0x67'),_0x11f231);db[_0x1a32('0x68')][_0x1a32('0x69')]({'raw':!![],'attributes':['id',_0x1a32('0x6a')]})[_0x1a32('0x1f')](function(_0x3ea785){for(var _0x2c6405=0x0;_0x2c6405<_0x3ea785[_0x1a32('0x22')];_0x2c6405++){if(_0x3ea785[_0x2c6405][_0x1a32('0x6a')]in _0x3f0803){contactItemTypes[_0x1a32('0x1d')](_0x3ea785[_0x2c6405]);delete _0x32b3cb[_0x3ea785[_0x2c6405]['name']];hasAdditionalPhones=!![];}for(var _0x573c03 in _0x3f0803){if(_0x3ea785[_0x2c6405][_0x1a32('0x6a')]+_0x1a32('0x6b')===_0x573c03){phoneDescriptions[_0x1a32('0x1d')]({'itemTypeId':_0x3ea785[_0x2c6405]['id'],'description':_0x573c03});delete _0x32b3cb[_0x573c03];}}}if(hasAdditionalPhones)_0x32b3cb[_0x1a32('0x1c')]='';var _0x27e088=_['keys'](_0x32b3cb)['join']();logger[_0x1a32('0x5a')](_0x1a32('0x6c'),_0x27e088);fs['writeFileSync'](_0x552536,_0x27e088+'\x0a');Papa[_0x1a32('0x6d')](fs[_0x1a32('0x6e')](_0x493194),{'header':!![],'skipEmptyLines':!![],'step':function(_0x3d32f1,_0x5d2de7){try{for(var _0x4bd526=0x0,_0x322f79=[];_0x4bd526<_0x3d32f1[_0x1a32('0x6f')][_0x1a32('0x22')];_0x4bd526++){stats[_0x1a32('0x70')]+=0x1;if(_0x3d32f1[_0x1a32('0x5e')][_0x4bd526]){handleError(_0x3d32f1['data'][_0x4bd526],_0x3d32f1['errors'][_0x4bd526]);}else{var _0x241d6b=[];var _0x125b2=[];var _0x297a79={};for(var _0x539e38 in _0x3f0803){let _0x46b333=contactItemTypes[_0x1a32('0x71')](_0x2276c1=>_0x2276c1['name']===_0x539e38);let _0x4bc025=contactItemTypes['find'](_0x26c6b3=>_0x26c6b3[_0x1a32('0x6a')]+_0x1a32('0x6b')===_0x539e38);if(_['isNil'](_0x46b333)&&_[_0x1a32('0x1b')](_0x4bc025)){if(_0x3f0803[_0x1a32('0x72')](_0x539e38)){if(_0x3d32f1[_0x1a32('0x6f')][_0x4bd526][_0x3f0803[_0x539e38]]){var _0x1fbe2a=_[_0x1a32('0x73')](_0x3d32f1[_0x1a32('0x6f')][_0x4bd526][_0x3f0803[_0x539e38]][_0x1a32('0x74')](/"/g,'\x27'));switch(_0x539e38){case _0x1a32('0x34'):var _0x242090=moment(_0x1fbe2a,_0x1a32('0xd'),!![]);if(_0x242090['isValid']()){_0x322f79[_0x1a32('0x1d')]('\x22'+_0x1fbe2a+'\x22');}else{_0x241d6b[_0x1a32('0x1d')](_0x1a32('0x75'));}break;case _0x1a32('0x39'):var _0x3109d6=parseInt(_0x1fbe2a);_0x1fbe2a=_[_0x1a32('0x76')](_0x3109d6)||_0x3109d6<0x0||_0x3109d6>0x4?_0x5b6bc8?0x3:0x2:_0x3109d6;_0x322f79[_0x1a32('0x1d')]('\x22'+_0x1fbe2a+'\x22');break;case _0x1a32('0x3a'):var _0x1aee45=parseInt(_0x1fbe2a);if(_[_0x1a32('0x77')](_0x1aee45)&&_[_0x1a32('0x78')](_0x3d0b2e,_0x1aee45)){_0x322f79[_0x1a32('0x1d')]('\x22'+_0x1aee45+'\x22');}else{_0x241d6b[_0x1a32('0x1d')](_0x1a32('0x79'));}break;case'email':if(isEmail(_0x1fbe2a)){_0x322f79[_0x1a32('0x1d')]('\x22'+_0x1fbe2a+'\x22');}else{_0x241d6b[_0x1a32('0x1d')]('email\x20wrong\x20format');}break;case'dateOfBirth':var _0x104ddb=moment(_0x1fbe2a,_0x1a32('0x7a'),!![]);if(_0x104ddb[_0x1a32('0x7b')]()){_0x322f79[_0x1a32('0x1d')]('\x22'+_0x1fbe2a+'\x22');}else{_0x241d6b[_0x1a32('0x1d')](_0x1a32('0x7c'));}break;default:_0x322f79[_0x1a32('0x1d')]('\x22'+_0x1fbe2a+'\x22');}}else{switch(_0x539e38){case _0x1a32('0x7d'):case _0x1a32('0x11'):_0x241d6b[_0x1a32('0x1d')](_0x539e38+_0x1a32('0x7e'));break;default:_0x322f79[_0x1a32('0x1d')]('\x22\x22');}}}}else{var _0x46de0f='';if(!_[_0x1a32('0x1b')](_0x46b333)){if(!_0x297a79[_0x1a32('0x72')](_0x46b333['id'])){for(var _0x1439d0=0x0;_0x1439d0<_0x3f0803[_0x539e38][_0x1a32('0x22')];_0x1439d0++){var _0x1fbe2a=_[_0x1a32('0x73')](_0x3d32f1[_0x1a32('0x6f')][_0x4bd526][_0x3f0803[_0x539e38][_0x1439d0]][_0x1a32('0x74')](/"/g,'\x27'));var _0x139d47=phoneDescriptions[_0x1a32('0x71')](_0x3adbf9=>_0x3adbf9['itemTypeId']===_0x46b333['id']);if(!_['isNil'](_0x139d47)){var _0xffd369=_['trim'](_0x3d32f1[_0x1a32('0x6f')][_0x4bd526][_0x3f0803[_0x139d47[_0x1a32('0x7f')]][0x0]][_0x1a32('0x74')](/"/g,'\x27'));if(!_[_0x1a32('0x1b')](_0xffd369))_0x1fbe2a=_0x1fbe2a+'§'+_0xffd369;}if(_0x46de0f=='')_0x46de0f=_0x1fbe2a;else _0x46de0f+='|'+_0x1fbe2a;}_0x125b2[_0x1a32('0x1d')](_0x46b333['id']+':'+_0x46de0f);_0x297a79[_0x46b333['id']]=0x1;}}}}if(hasAdditionalPhones){_0x322f79[_0x1a32('0x1d')]('\x22'+_0x125b2[_0x1a32('0x40')](';')+'\x22');}if(_0x241d6b['length']){handleError(_0x3d32f1[_0x1a32('0x6f')][_0x4bd526],{'code':_0x1a32('0x80'),'message':_0x241d6b[_0x1a32('0x40')]()});}else{fs[_0x1a32('0x81')](_0x552536,_0x322f79[_0x1a32('0x40')]()+'\x0a');}_0x322f79=[];}if(!(stats[_0x1a32('0x70')]%0xc8)){socket[_0x1a32('0x82')](_0x1a32('0x83')+_0x3b5084,stats);stats[_0x1a32('0x5e')]=[];}}if(stopped){logger[_0x1a32('0x5a')](_0x1a32('0x84'));_0x5d2de7['abort']();}}catch(_0x55d980){handleError(_0x3d32f1[_0x1a32('0x6f')][_0x4bd526],{'code':_0x1a32('0x85'),'message':_0x55d980[_0x1a32('0x21')]});logger[_0x1a32('0x5c')](_0x1a32('0x86'),_0x55d980[_0x1a32('0x21')]);}},'complete':function(){try{var _0x346493=[];var _0x8f3c6b=tempTableName;_0x346493['push']('CREATE\x20TABLE\x20'+_0x8f3c6b+_0x1a32('0x87'));logger[_0x1a32('0x5a')](_0x1a32('0x88'),contactItemTypes['length']);var _0x31be82=util['format'](_0x1a32('0x89'),_0x552536,_0x8f3c6b,_0x27e088,_0x11f231['ListId'],_0x11f231[_0x1a32('0x55')]||null,NOW,NOW);if(_[_0x1a32('0x1b')](_0x3f0803[_0x1a32('0x34')])){_0x31be82+=_0x1a32('0x8a');}_0x346493[_0x1a32('0x1d')](_0x31be82);BPromise['each'](_0x346493,handleQuery)['then'](function(_0x37dde6){BPromise[_0x1a32('0x1e')]([handleAdditionalPhones()])[_0x1a32('0x1f')](function(){_0x346493=[];for(var _0xbdd559=0x0;_0xbdd559\x20\x20','root','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','papaparse','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','import','redis','defaults','format','YYYY-MM-DD\x20HH:mm:ss','cm_contacts_temp_','YYYYMMDDHHmmss','select','phone','from','join','.id\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','query','spread','isNil','AdditionalPhones','then','error','push','all','length','split','filter','findOne','update','updated','CmContactHasItem','PHONE','inserted','CmContact','CmHopper','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_hopper','fromQuery','ContactId','ListId','createdAt','updatedAt','UserId','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.phone\x20NOT\x20IN\x20(?)','toString','insert','into','cm_hopper_black','ListId\x20=\x20?','\x20=\x20?','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.createdAt'];(function(_0x52c9cc,_0xd7d1e8){var _0x160e6b=function(_0x59b5e0){while(--_0x59b5e0){_0x52c9cc['push'](_0x52c9cc['shift']());}};_0x160e6b(++_0xd7d1e8);}(_0x0b0e,0x187));var _0xe0b0=function(_0x5c3ae9,_0x450f9a){_0x5c3ae9=_0x5c3ae9-0x0;var _0x3f5950=_0x0b0e[_0x5c3ae9];return _0x3f5950;};'use strict';var fs=require('fs');var path=require(_0xe0b0('0x0'));var _=require('lodash');var Papa=require(_0xe0b0('0x1'));var util=require('util');var BPromise=require(_0xe0b0('0x2'));var moment=require(_0xe0b0('0x3'));var squel=require(_0xe0b0('0x4'));var Redis=require(_0xe0b0('0x5'));var db=require(_0xe0b0('0x6'))['db'];var config=require(_0xe0b0('0x7'));var logger=require(_0xe0b0('0x8'))(_0xe0b0('0x9'));config[_0xe0b0('0xa')]=_[_0xe0b0('0xb')](config[_0xe0b0('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe0b0('0xa')]));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()[_0xe0b0('0xc')](_0xe0b0('0xd'));var tempTableName=_0xe0b0('0xe')+moment()['format'](_0xe0b0('0xf'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x1dd3b8){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'](_0x1dd3b8);}function selectNotIn(_0x1fef28,_0x2f32b6,_0x574d96,_0x399320,_0x2cdad2){return squel[_0xe0b0('0x10')]()['field'](_0xe0b0('0x11'))[_0xe0b0('0x12')](_0x399320)[_0xe0b0('0x13')](_0x2f32b6,null,_0x2f32b6+_0xe0b0('0x14')+_0x399320+'.'+_0x574d96)[_0xe0b0('0x15')](_0x399320+'.'+_0x574d96+'\x20=\x20'+_0x1fef28+'.'+_0x574d96)[_0xe0b0('0x15')](_0x2f32b6+_0xe0b0('0x16')+_0x2cdad2[_0xe0b0('0x13')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x24babd,_0x177c24){promisesAdditionalPhones=[];promisesContact=[];return db['sequelize'][_0xe0b0('0x17')]('select\x20*\x20from\x20'+tempTableName)[_0xe0b0('0x18')](function(_0xadee6e){if(_0xadee6e!==null){var _0x519ae8=[];for(var _0x11fdca=0x0;_0x11fdca<_0xadee6e['length'];_0x11fdca++){var _0x2d6fb6=_0xadee6e[_0x11fdca];if(!_[_0xe0b0('0x19')](_0x2d6fb6['phone'])){if(!_['isNil'](_0x2d6fb6[_0xe0b0('0x1a')]))_0x519ae8['push'](insertAdditionalPhones(_0x2d6fb6));promisesContact['push']({'contact':_0x2d6fb6});}}}Promise['all'](_0x519ae8)[_0xe0b0('0x1b')](function(){_0x24babd({'val':0x1});});})['catch'](function(_0x52598b){logger[_0xe0b0('0x1c')](_0x52598b['message']);});});}function insertAdditionalPhones(_0x472286){return new Promise(function(_0x5dba2f,_0x2c84cc){var _0x1cd7c4=_0x472286[_0xe0b0('0x1a')];if(_[_0xe0b0('0x19')](_0x1cd7c4))_0x2c84cc({'val':0x0});else{var _0x2cf6a1=_0x1cd7c4['split'](';');var _0x4cae54=[];orderBy=0x0;for(var _0x2fa820=0x0;_0x2fa820<_0x2cf6a1['length'];_0x2fa820++){_0x4cae54[_0xe0b0('0x1d')](splitAdditionalPhone(_0x472286['id'],_0x2cf6a1[_0x2fa820]));}Promise[_0xe0b0('0x1e')](_0x4cae54)['then'](function(){_0x5dba2f({'val':_0x2cf6a1[_0xe0b0('0x1f')]});});}});}function splitAdditionalPhone(_0x503883,_0x2208d0){return new Promise(function(_0x49a727,_0x28586d){var _0x576352=_0x2208d0[_0xe0b0('0x20')](':');var _0x4de537=_0x576352[0x0];var _0x4700cc=_0x576352[0x1];if(_0x4700cc!==''){var _0x4aafbe=_0x4700cc[_0xe0b0('0x20')]('|');var _0x5c5317=[];for(var _0x362aba=0x0;_0x362aba<_0x4aafbe[_0xe0b0('0x1f')];_0x362aba++){if(_0x4aafbe[_0x362aba]!==''){var _0x1f1ebd=_[_0xe0b0('0x21')](promisesAdditionalPhones,{'contactId':_0x503883,'phone':_0x4aafbe[_0x362aba]});if(_0x1f1ebd[_0xe0b0('0x1f')]==0x0){orderBy++;promisesAdditionalPhones[_0xe0b0('0x1d')]({'contactId':_0x503883,'contactTypeId':_0x4de537,'phone':_0x4aafbe[_0x362aba],'orderBy':orderBy});}}}_0x49a727({'ok':0x1});}else _0x49a727({'res':0x0});});}function createAdditionalPhone(_0x5200a6,_0x1444b9,_0x1b8aa8,_0x5b7a64){var _0x15e13b='';var _0x419b1f='';var _0x36d137=_0x1b8aa8[_0xe0b0('0x20')]('§');_0x15e13b=_0x36d137[0x0];if(_0x36d137[_0xe0b0('0x1f')]==0x2)_0x419b1f=_0x36d137[0x1];return new Promise(function(_0x254cad,_0x136bd4){return db['CmContactHasItem'][_0xe0b0('0x22')]({'where':{'CmContactId':_0x5200a6,'item':_0x15e13b}})[_0xe0b0('0x1b')](function(_0x48a9b5){if(_0x48a9b5){return db['CmContactHasItem'][_0xe0b0('0x23')]({'ItemTypeId':_0x1444b9,'description':_0x419b1f,'OrderBy':_0x5b7a64},{'where':{'CmContactId':_0x5200a6,'item':_0x15e13b}})[_0xe0b0('0x1b')](function(_0x422575){_0x254cad({'res':_0xe0b0('0x24')});});}else{return db[_0xe0b0('0x25')]['create']({'CmContactId':_0x5200a6,'item':_0x15e13b,'ItemTypeId':_0x1444b9,'description':_0x419b1f,'OrderBy':_0x5b7a64,'ItemClass':_0xe0b0('0x26')})[_0xe0b0('0x1b')](function(_0x7867c4){_0x254cad({'res':_0xe0b0('0x27')});});}});});}function updateContact(_0x27158f){return new Promise(function(_0x4fe835,_0x3ebf2a){var _0x208945=_0x27158f['id'];delete _0x27158f['id'];return db[_0xe0b0('0x28')][_0xe0b0('0x23')](_0x27158f,{'where':{'id':_0x208945}})[_0xe0b0('0x1b')](function(_0x12eeb8){updatedRows+=0x1;return db[_0xe0b0('0x29')][_0xe0b0('0x23')]({'phone':_0x27158f[_0xe0b0('0x11')]},{'where':{'ContactId':_0x208945}})[_0xe0b0('0x1b')](function(_0xd56467){_0x4fe835({'ret':'OK'});});});});}function insertCmHopper(_0x1a0c90,_0x1d35bc,_0x2a1c44,_0xca25d,_0x4cf80c){var _0x121608=[_0xe0b0('0x2a'),_0xe0b0('0x2b'),_0xe0b0('0x2c'),_0xe0b0('0x2d'),_0x1d35bc+'.'+_0xca25d,_0xe0b0('0x2e'),_0xe0b0('0x2f'),'cm_contacts.priority','cm_contacts.UserId','\x22'+_0x4cf80c+'\x22'];return squel['insert']()['into'](_0xe0b0('0x30'))[_0xe0b0('0x31')]([_0xe0b0('0x11'),'scheduledat',_0xe0b0('0x32'),_0xe0b0('0x33'),_0xca25d,_0xe0b0('0x34'),_0xe0b0('0x35'),'priority',_0xe0b0('0x36'),_0xe0b0('0x37')],squel[_0xe0b0('0x10')]()[_0xe0b0('0x38')](_0x121608)[_0xe0b0('0x12')](_0x1d35bc)[_0xe0b0('0x13')](_0xe0b0('0x39'),null,_0xe0b0('0x3a')+_0x1d35bc+_0xe0b0('0x3b'))['join'](_0x2a1c44,null,_0x2a1c44+_0xe0b0('0x14')+_0x1d35bc+'.'+_0xca25d)['where'](_0x1d35bc+_0xe0b0('0x3c'),_0x1a0c90)[_0xe0b0('0x15')](_0xe0b0('0x3d'),NOW)[_0xe0b0('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x1d35bc,_0x2a1c44,_0xca25d,_0xe0b0('0x30'),[_0xe0b0('0x3e'),_0xe0b0('0x3f')]))[_0xe0b0('0x15')](_0xe0b0('0x40'),selectNotIn(_0x1d35bc,_0x2a1c44,_0xca25d,_0xe0b0('0x30'),[_0xe0b0('0x3e')])))[_0xe0b0('0x41')]();}function insertCmHopperBlack(_0x52ffe4,_0x2aad80,_0x309bbf,_0x528818){var _0x515bd2=[_0xe0b0('0x2a'),_0xe0b0('0x2c'),'cm_contacts.ListId',_0x2aad80+'.'+_0x528818,_0xe0b0('0x2e'),_0xe0b0('0x2f')];return squel[_0xe0b0('0x42')]()[_0xe0b0('0x43')](_0xe0b0('0x44'))['fromQuery'](['phone','ContactId',_0xe0b0('0x33'),_0x528818,_0xe0b0('0x34'),'updatedAt'],squel[_0xe0b0('0x10')]()[_0xe0b0('0x38')](_0x515bd2)[_0xe0b0('0x12')](_0x2aad80)[_0xe0b0('0x13')](_0xe0b0('0x39'),null,'cm_contacts.ListId\x20=\x20'+_0x2aad80+'.CmListId')[_0xe0b0('0x13')](_0x309bbf,null,_0x309bbf+_0xe0b0('0x14')+_0x2aad80+'.'+_0x528818)[_0xe0b0('0x15')](_0x2aad80+_0xe0b0('0x3c'),_0x52ffe4)[_0xe0b0('0x15')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0xe0b0('0x15')](_0xe0b0('0x40'),squel['select']()['field']('phone')[_0xe0b0('0x12')](_0xe0b0('0x44'))[_0xe0b0('0x15')](_0xe0b0('0x45'),_0x52ffe4)['where'](_0x528818+_0xe0b0('0x46'),_0x2aad80+'.'+_0x528818)))[_0xe0b0('0x41')]();}function insertCmHopperAdditionalPhones(_0x483f12){var _0x58b69c=[_0xe0b0('0x47'),_0xe0b0('0x48'),'cm_contact_has_items.OrderBy',_0xe0b0('0x49'),_0xe0b0('0x4a')];return squel['insert']()['into'](_0xe0b0('0x4b'))['fromQuery']([_0xe0b0('0x4c'),_0xe0b0('0x11'),_0xe0b0('0x4d'),_0xe0b0('0x34'),_0xe0b0('0x35')],squel[_0xe0b0('0x10')]()['fields'](_0x58b69c)['from'](_0xe0b0('0x30'))['join']('cm_contacts',null,_0xe0b0('0x4e'))[_0xe0b0('0x13')]('cm_contact_has_items',null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')[_0xe0b0('0x15')](_0xe0b0('0x4f'),_0x483f12)[_0xe0b0('0x15')](_0xe0b0('0x3d'),NOW))[_0xe0b0('0x41')]();}function insertCmContact(_0x24115f,_0x84fabb,_0x4ebb0f,_0x22c7bc){var _0x5ec880=_[_0xe0b0('0x50')](_['keys'](_0x22c7bc),['ListId',_0xe0b0('0x51'),_0xe0b0('0x34'),_0xe0b0('0x35')]);return squel[_0xe0b0('0x42')]()[_0xe0b0('0x43')](_0xe0b0('0x39'))[_0xe0b0('0x31')](_0x5ec880,squel[_0xe0b0('0x10')]()[_0xe0b0('0x38')](_0x5ec880)['from'](_0x84fabb)[_0xe0b0('0x15')]('('+_0x4ebb0f['join'](',')+_0xe0b0('0x52'),squel[_0xe0b0('0x10')]()[_0xe0b0('0x38')](_0x4ebb0f)[_0xe0b0('0x12')](_0xe0b0('0x39'))[_0xe0b0('0x15')]('ListId\x20=\x20?',_0x24115f))[_0xe0b0('0x15')](_0xe0b0('0x53'),squel[_0xe0b0('0x10')]()[_0xe0b0('0x54')](_0xe0b0('0x55'),_0xe0b0('0x56'))[_0xe0b0('0x12')](_0x84fabb)[_0xe0b0('0x57')](_0x4ebb0f[_0xe0b0('0x13')](','))))[_0xe0b0('0x41')]();}function handleStop(){logger[_0xe0b0('0x58')](_0xe0b0('0x59'));stopped=!![];}function handleUncaughtException(_0xc719d2){logger[_0xe0b0('0x1c')](_0xc719d2[_0xe0b0('0x5a')]);process[_0xe0b0('0x5b')](0x1);}function handleError(_0x4c7661,_0x155738){stats['errors'][_0xe0b0('0x1d')]({'name':_0x155738[_0xe0b0('0x5c')],'message':_0x155738[_0xe0b0('0x5a')],'row':_0x4c7661});}function handleQuery(_0x2f24e6){logger[_0xe0b0('0x58')](_0x2f24e6);return db[_0xe0b0('0x5d')][_0xe0b0('0x17')](_0x2f24e6)['spread'](function(_0x47dcc4){results[_0xe0b0('0x1d')](_0x47dcc4);})[_0xe0b0('0x5e')](function(_0x157556){logger['error'](_0x157556[_0xe0b0('0x5a')]);});}function main(_0x13fb4b,_0x309efb,_0x3d820c,_0x3537e7){logger['info'](_0xe0b0('0x5f'),_0x13fb4b,JSON[_0xe0b0('0x60')](_0x309efb));process[_0xe0b0('0x61')]('start');var _0x3604e6=_0x309efb[_0xe0b0('0x62')];var _0x5aa850=_[_0xe0b0('0x63')](_0x3604e6);var _0x4c5478=_0x309efb['socket_timestamp'];var _0x4474ac=path['join'](config['root'],_0xe0b0('0x64'),_0x4c5478+_0xe0b0('0x65'));logger[_0xe0b0('0x58')](_0xe0b0('0x66'),_0x309efb);db['ContactItemType'][_0xe0b0('0x67')]({'raw':!![],'attributes':['id',_0xe0b0('0x68')]})[_0xe0b0('0x1b')](function(_0x41ec8e){for(var _0x1b29c=0x0;_0x1b29c<_0x41ec8e[_0xe0b0('0x1f')];_0x1b29c++){if(_0x41ec8e[_0x1b29c][_0xe0b0('0x68')]in _0x3604e6){contactItemTypes[_0xe0b0('0x1d')](_0x41ec8e[_0x1b29c]);delete _0x5aa850[_0x41ec8e[_0x1b29c]['name']];hasAdditionalPhones=!![];}for(var _0x51940f in _0x3604e6){if(_0x41ec8e[_0x1b29c][_0xe0b0('0x68')]+_0xe0b0('0x69')===_0x51940f){phoneDescriptions[_0xe0b0('0x1d')]({'itemTypeId':_0x41ec8e[_0x1b29c]['id'],'description':_0x51940f});delete _0x5aa850[_0x51940f];}}}if(hasAdditionalPhones)_0x5aa850['AdditionalPhones']='';var _0x49b754=_[_0xe0b0('0x6a')](_0x5aa850)[_0xe0b0('0x13')]();logger['info']('header',_0x49b754);fs[_0xe0b0('0x6b')](_0x4474ac,_0x49b754+'\x0a');Papa[_0xe0b0('0x6c')](fs[_0xe0b0('0x6d')](_0x13fb4b),{'header':!![],'skipEmptyLines':!![],'step':function(_0x29175a,_0x3b263f){try{for(var _0x15f0f8=0x0,_0x1bc7a6=[];_0x15f0f8<_0x29175a[_0xe0b0('0x6e')]['length'];_0x15f0f8++){stats[_0xe0b0('0x6f')]+=0x1;if(_0x29175a[_0xe0b0('0x70')][_0x15f0f8]){handleError(_0x29175a[_0xe0b0('0x6e')][_0x15f0f8],_0x29175a['errors'][_0x15f0f8]);}else{var _0x4fbf44=[];var _0x4f4b45=[];var _0x56ee83={};for(var _0x5d5c93 in _0x3604e6){let _0x567c06=contactItemTypes[_0xe0b0('0x71')](_0x51b492=>_0x51b492['name']===_0x5d5c93);let _0x369d03=contactItemTypes[_0xe0b0('0x71')](_0x3bae8c=>_0x3bae8c[_0xe0b0('0x68')]+_0xe0b0('0x69')===_0x5d5c93);if(_[_0xe0b0('0x19')](_0x567c06)&&_[_0xe0b0('0x19')](_0x369d03)){if(_0x3604e6[_0xe0b0('0x72')](_0x5d5c93)){if(_0x29175a['data'][_0x15f0f8][_0x3604e6[_0x5d5c93]]){var _0x948708=_[_0xe0b0('0x73')](_0x29175a[_0xe0b0('0x6e')][_0x15f0f8][_0x3604e6[_0x5d5c93]][_0xe0b0('0x74')](/"/g,'\x27'));switch(_0x5d5c93){case _0xe0b0('0x75'):var _0x1f70fb=moment(_0x948708,_0xe0b0('0xd'),!![]);if(_0x1f70fb['isValid']()){_0x1bc7a6[_0xe0b0('0x1d')]('\x22'+_0x948708+'\x22');}else{_0x4fbf44['push'](_0xe0b0('0x76'));}break;case _0xe0b0('0x77'):var _0x255200=parseInt(_0x948708);_0x948708=_[_0xe0b0('0x78')](_0x255200)||_0x255200<0x0||_0x255200>0x4?_0x3537e7?0x3:0x2:_0x255200;_0x1bc7a6['push']('\x22'+_0x948708+'\x22');break;case _0xe0b0('0x36'):var _0x429ac3=parseInt(_0x948708);if(_['isNumber'](_0x429ac3)&&_['includes'](_0x3d820c,_0x429ac3)){_0x1bc7a6[_0xe0b0('0x1d')]('\x22'+_0x429ac3+'\x22');}else{_0x4fbf44[_0xe0b0('0x1d')](_0xe0b0('0x79'));}break;case _0xe0b0('0x7a'):if(isEmail(_0x948708)){_0x1bc7a6[_0xe0b0('0x1d')]('\x22'+_0x948708+'\x22');}else{_0x4fbf44[_0xe0b0('0x1d')](_0xe0b0('0x7b'));}break;case _0xe0b0('0x7c'):var _0x1eed55=moment(_0x948708,_0xe0b0('0x7d'),!![]);if(_0x1eed55['isValid']()){_0x1bc7a6['push']('\x22'+_0x948708+'\x22');}else{_0x4fbf44[_0xe0b0('0x1d')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x1bc7a6['push']('\x22'+_0x948708+'\x22');}}else{switch(_0x5d5c93){case'firstName':case'phone':_0x4fbf44[_0xe0b0('0x1d')](_0x5d5c93+'\x20not\x20specified');break;default:_0x1bc7a6[_0xe0b0('0x1d')]('\x22\x22');}}}}else{var _0x3e7859='';if(!_[_0xe0b0('0x19')](_0x567c06)){if(!_0x56ee83[_0xe0b0('0x72')](_0x567c06['id'])){for(var _0x5b1b6b=0x0;_0x5b1b6b<_0x3604e6[_0x5d5c93][_0xe0b0('0x1f')];_0x5b1b6b++){var _0x948708=_['trim'](_0x29175a[_0xe0b0('0x6e')][_0x15f0f8][_0x3604e6[_0x5d5c93][_0x5b1b6b]][_0xe0b0('0x74')](/"/g,'\x27'));var _0x1ac31f=phoneDescriptions[_0xe0b0('0x71')](_0x27af09=>_0x27af09['itemTypeId']===_0x567c06['id']);if(!_['isNil'](_0x1ac31f)){var _0x55aef7=_['trim'](_0x29175a['data'][_0x15f0f8][_0x3604e6[_0x1ac31f[_0xe0b0('0x7e')]][0x0]]['replace'](/"/g,'\x27'));if(!_[_0xe0b0('0x19')](_0x55aef7))_0x948708=_0x948708+'§'+_0x55aef7;}if(_0x3e7859=='')_0x3e7859=_0x948708;else _0x3e7859+='|'+_0x948708;}_0x4f4b45['push'](_0x567c06['id']+':'+_0x3e7859);_0x56ee83[_0x567c06['id']]=0x1;}}}}if(hasAdditionalPhones){_0x1bc7a6[_0xe0b0('0x1d')]('\x22'+_0x4f4b45[_0xe0b0('0x13')](';')+'\x22');}if(_0x4fbf44[_0xe0b0('0x1f')]){handleError(_0x29175a[_0xe0b0('0x6e')][_0x15f0f8],{'code':_0xe0b0('0x7f'),'message':_0x4fbf44[_0xe0b0('0x13')]()});}else{fs['appendFileSync'](_0x4474ac,_0x1bc7a6['join']()+'\x0a');}_0x1bc7a6=[];}if(!(stats['rows']%0xc8)){socket['emit'](_0xe0b0('0x80')+_0x4c5478,stats);stats[_0xe0b0('0x70')]=[];}}if(stopped){logger[_0xe0b0('0x58')](_0xe0b0('0x81'));_0x3b263f[_0xe0b0('0x82')]();}}catch(_0x534881){handleError(_0x29175a[_0xe0b0('0x6e')][_0x15f0f8],{'code':_0xe0b0('0x83'),'message':_0x534881[_0xe0b0('0x5a')]});logger[_0xe0b0('0x1c')](_0xe0b0('0x84'),_0x534881[_0xe0b0('0x5a')]);}},'complete':function(){try{var _0x3ef24a=[];var _0x7beacf=tempTableName;_0x3ef24a[_0xe0b0('0x1d')]('CREATE\x20TABLE\x20'+_0x7beacf+'\x20LIKE\x20cm_contacts;');logger[_0xe0b0('0x58')](_0xe0b0('0x85'),contactItemTypes['length']);var _0x7feff4=util[_0xe0b0('0xc')](_0xe0b0('0x86'),_0x4474ac,_0x7beacf,_0x49b754,_0x309efb[_0xe0b0('0x33')],_0x309efb[_0xe0b0('0x51')]||null,NOW,NOW);if(_[_0xe0b0('0x19')](_0x3604e6[_0xe0b0('0x75')])){_0x7feff4+=_0xe0b0('0x87');}_0x3ef24a['push'](_0x7feff4);BPromise['each'](_0x3ef24a,handleQuery)['then'](function(_0xc19743){BPromise[_0xe0b0('0x1e')]([handleAdditionalPhones()])['then'](function(){_0x3ef24a=[];for(var _0x36b67c=0x0;_0x36b67c\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','c.firstName','c.lastName','Contact.lastName','c.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset','sequelize','findOne','enableEmailPreview','clone','COUNT(*)','isEmpty','t.id\x20IN\x20?','SELECT','exports','squel','../parsers/advancedSearch','../parsers/qs','updateInteraction','../../mysqldb','getAccountFK','agent','search','select','field','from','user_has_','u.id','u.fullname','ui.','u.id\x20=\x20ui.UserId','where','\x20IN\x20?','map','getInteractionsTables','getInteractionFK','interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','left_join','users','accounts','a.id\x20=\x20i.','messages','me.','\x20=\x20i.id','interactionsTags'];(function(_0x53481c,_0x411919){var _0x15bd43=function(_0x209111){while(--_0x209111){_0x53481c['push'](_0x53481c['shift']());}};_0x15bd43(++_0x411919);}(_0xd424,0x115));var _0x4d42=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xd424[_0x2b4411];return _0x8e41ef;};'use strict';var _=require('lodash');var squel=require(_0x4d42('0x0'));var as=require(_0x4d42('0x1'));var qs=require(_0x4d42('0x2'));var updateInteraction=require('./update-interaction')[_0x4d42('0x3')];var utils=require('./utils');var db=require(_0x4d42('0x4'))['db'];function skipInteractionsQuery(_0x1d2b72,_0x4c3d9b,_0x3918d5){var _0xc234fc=![];var _0x904bcd=utils[_0x4d42('0x5')](_0x1d2b72);if(_0x4c3d9b['role']===_0x4d42('0x6')&&!_0x3918d5[_0x4d42('0x7')]&&!_0x3918d5[_0x904bcd]){_0xc234fc=!![];}return _0xc234fc;}function getTagsQuery(){return squel[_0x4d42('0x8')]()[_0x4d42('0x9')]('id')[_0x4d42('0x9')]('name')[_0x4d42('0x9')]('color')[_0x4d42('0xa')]('tools_tags');}function getUsersQuery(_0x40c868,_0x5d9568){var _0x2d0f50=utils['getInteractionFK'](_0x40c868);var _0x584703=_0x4d42('0xb')+_0x40c868+'_interactions';var _0x2ac3fa=squel[_0x4d42('0x8')]()[_0x4d42('0x9')](_0x4d42('0xc'))['field'](_0x4d42('0xd'))[_0x4d42('0x9')](_0x4d42('0xe')+_0x2d0f50)[_0x4d42('0xa')](_0x584703,'ui')['left_join']('users','u',_0x4d42('0xf'));if(_0x5d9568['length']>0x0){_0x2ac3fa[_0x4d42('0x10')]('ui.'+_0x2d0f50+_0x4d42('0x11'),_[_0x4d42('0x12')](_0x5d9568,'id'));}return _0x2ac3fa;}function getInteractionsQuery(_0x212e5e){var _0x2950f4=utils[_0x4d42('0x13')](_0x212e5e);var _0x4340a5=utils[_0x4d42('0x5')](_0x212e5e);var _0x35d776=utils[_0x4d42('0x14')](_0x212e5e);return squel['select']()[_0x4d42('0xa')](_0x2950f4[_0x4d42('0x15')],'i')['left_join']('cm_contacts','c',_0x4d42('0x16'))[_0x4d42('0x17')](_0x4d42('0x18'),'o','o.id\x20=\x20i.UserId')[_0x4d42('0x17')](_0x2950f4[_0x4d42('0x19')],'a',_0x4d42('0x1a')+_0x4340a5)[_0x4d42('0x17')](_0x2950f4[_0x4d42('0x1b')],'me',_0x4d42('0x1c')+_0x35d776+_0x4d42('0x1d'))[_0x4d42('0x17')](_0x2950f4[_0x4d42('0x1e')],'it',_0x4d42('0x1f')+_0x35d776+'\x20=\x20i.id')[_0x4d42('0x17')](_0x4d42('0x20'),'t',_0x4d42('0x21'));}function getSqlClauses(){var _0x35713b={'body':squel[_0x4d42('0x22')](),'contact':squel['expr'](),'default':squel[_0x4d42('0x22')](),'fields':squel[_0x4d42('0x22')](),'filter':squel[_0x4d42('0x22')](),'read':squel[_0x4d42('0x22')](),'tags':{'clause':squel[_0x4d42('0x22')](),'ids':null},'user':squel[_0x4d42('0x22')]()};return _0x35713b;}function parseTagParameter(_0x3989b8){var _0x440bf8=squel['expr']();if(_0x3989b8){var _0x5200c8=utils[_0x4d42('0x23')](_0x3989b8);_0x5200c8[_0x4d42('0x24')](function(_0x1509eb){_0x440bf8['or'](_0x4d42('0x25'),'%,'+_0x1509eb+',%');});}return _0x440bf8;}function parseReadParameter(_0xb47fc4){var _0xd5777c='';if(_0xb47fc4){_0xd5777c='unreadMessages\x20{OPERATOR}\x200';if(_0xb47fc4==='1'){_0xd5777c=_0xd5777c['replace'](_0x4d42('0x26'),'=');}else{_0xd5777c=_0xd5777c[_0x4d42('0x27')](_0x4d42('0x26'),'>');}}return _0xd5777c;}function parseSearchFilter(_0x3f5052,_0x33036e){var _0x5b4836=squel[_0x4d42('0x22')]();if(_0x33036e){var _0x3b7fb6=_0x33036e[_0x4d42('0x27')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');var _0x30a871=qs[_0x4d42('0x28')](_0x3b7fb6);if(qs['isNumeric'](_0x3b7fb6)){_0x5b4836['or'](_0x4d42('0x29'),_0x30a871+'%');if([_0x4d42('0x2a'),_0x4d42('0x2b')][_0x4d42('0x2c')](_0x3f5052)){_0x5b4836['or']('i.phone\x20LIKE\x20?',_0x30a871+'%');}else if(_0x3f5052===_0x4d42('0x2d')){_0x5b4836['or']('i.fax\x20LIKE\x20?',_0x30a871+'%');}else if(_0x3f5052===_0x4d42('0x2e')){_0x5b4836['or']('i.from\x20LIKE\x20?',_0x30a871+'%');}}else if(_0x3f5052===_0x4d42('0x2f')&&qs[_0x4d42('0x30')](_0x3b7fb6)){_0x5b4836['or'](_0x4d42('0x31'),_0x30a871+'%');}else{if(_0x3f5052===_0x4d42('0x2f')){_0x5b4836['or'](_0x4d42('0x32'),qs[_0x4d42('0x33')](_0x3b7fb6,!![]))['or'](_0x4d42('0x34'),qs[_0x4d42('0x33')](_0x3b7fb6));}else if(_0x3f5052!==_0x4d42('0x2d')){_0x5b4836['or'](_0x4d42('0x35'),qs['getFullTextValue'](_0x3b7fb6));}_0x5b4836['or'](_0x4d42('0x36'),qs[_0x4d42('0x33')](_0x3b7fb6,!![]),null);}}return _0x5b4836;}function parseAdvancedSearchFilter(_0x41e1e4,_0x498d74){var _0x2195da=getSqlClauses();var _0x4a65c8=as['parseSearch'](_0x41e1e4);var _0x122e37=_0x4a65c8[_0x4d42('0x37')];for(var _0x2a02c7=0x0;_0x2a02c7<_0x4a65c8[_0x4d42('0x38')][_0x4d42('0x39')];_0x2a02c7++){var _0x566e36=_0x4a65c8[_0x4d42('0x38')][_0x2a02c7];var _0x4450f4='i';var _0x16bf82=_[_0x4d42('0x3a')](_0x498d74,[_0x4d42('0x3b'),_0x566e36[_0x4d42('0x9')]]);if(_0x16bf82){var _0x524841=as[_0x4d42('0x3c')](_0x4450f4,_0x16bf82['type'],_0x566e36);_0x2195da[_0x4d42('0x3d')][_0x122e37](_0x524841[_0x4d42('0x3e')],_0x524841[_0x4d42('0x3f')][_0x4d42('0x40')],_0x524841[_0x4d42('0x3f')]['end']);}else{switch(_0x566e36[_0x4d42('0x9')]){case _0x4d42('0x41'):var _0x135ff8=parseReadParameter(_0x566e36['value']);_0x2195da[_0x4d42('0x42')][_0x4d42('0x43')](_0x135ff8);break;case _0x4d42('0x44'):if(_0x566e36[_0x4d42('0x45')]==='$substring'){if(_0x566e36[_0x4d42('0x3f')][_0x4d42('0x46')]('\x20')[_0x4d42('0x39')]>0x1){_0x2195da[_0x4d42('0x47')][_0x122e37](_0x4d42('0x36'),qs[_0x4d42('0x33')](_0x566e36['value'],!![]),null);}else{var _0x31e257='%'+_0x566e36[_0x4d42('0x3f')]+'%';_0x2195da[_0x4d42('0x47')][_0x122e37](_0x4d42('0x48'),_0x31e257,_0x31e257,_0x31e257);}}else{_0x16bf82=_[_0x4d42('0x3a')](_0x498d74,['name',_0x4d42('0x49')]);_0x566e36[_0x4d42('0x9')]=_0x4d42('0x49');_0x524841=as[_0x4d42('0x3c')](_0x4450f4,_0x16bf82[_0x4d42('0x4a')],_0x566e36);_0x2195da['contact'][_0x122e37](_0x524841['text'],_0x524841[_0x4d42('0x3f')][_0x4d42('0x40')],_0x524841['value'][_0x4d42('0x4b')]);}break;case _0x4d42('0x4c'):var _0x1b8994=_0x566e36['value'][_0x4d42('0x46')](',')['map'](function(_0x1cfdc4){return Number(_0x1cfdc4);});var _0x3b7f39=parseTagParameter(_0x1b8994);_0x2195da[_0x4d42('0x4d')][_0x4d42('0x4e')]['and'](_0x3b7f39);_0x2195da['tags'][_0x4d42('0x4f')]=_0x1b8994;break;case'User':if(_0x566e36[_0x4d42('0x45')]==='$substring'){_0x2195da['user'][_0x122e37](_0x4d42('0x50'),'%'+_0x566e36[_0x4d42('0x3f')]+'%',null);}else{_0x16bf82=_[_0x4d42('0x3a')](_0x498d74,[_0x4d42('0x3b'),_0x4d42('0x51')]);_0x566e36[_0x4d42('0x9')]='UserId';_0x524841=as[_0x4d42('0x3c')](_0x4450f4,_0x16bf82[_0x4d42('0x4a')],_0x566e36);_0x2195da['user'][_0x122e37](_0x524841['text'],_0x524841[_0x4d42('0x3f')][_0x4d42('0x40')],_0x524841['value']['end']);}break;case'body':case'plainBody':_0x524841=as[_0x4d42('0x3c')]('me',null,_0x566e36);_0x2195da[_0x4d42('0x52')][_0x122e37](_0x524841[_0x4d42('0x3e')],_0x524841['value'][_0x4d42('0x40')],_0x524841[_0x4d42('0x3f')][_0x4d42('0x4b')]);break;}}}return _0x2195da;}function parseModelFields(_0x363ab1,_0x311687,_0x183a3a){var _0x30c967=utils['getAccountFK'](_0x363ab1);var _0x361089=squel[_0x4d42('0x22')]();var _0x941ffc=_(_0x311687)[_0x4d42('0x53')]()['map'](function(_0x2ae5e0){return _[_0x4d42('0x54')](_0x183a3a,['name',_0x2ae5e0])?_0x2ae5e0:undefined;})[_0x4d42('0x55')]()[_0x4d42('0x3f')]();if(_0x941ffc['length']>0x0){_0x941ffc[_0x4d42('0x24')](function(_0x231727){if(_0x231727===_0x30c967){_0x361089['and']('i.'+_0x30c967+_0x4d42('0x11'),[][_0x4d42('0x56')](_0x311687[_0x231727]));}else if(_0x231727===_0x4d42('0x57')){var _0x1b6efe=JSON[_0x4d42('0x58')](_0x311687[_0x231727])[_0x4d42('0x59')];var _0x500c57=JSON[_0x4d42('0x58')](_0x311687[_0x231727])['$lte'];_0x361089[_0x4d42('0x43')](_0x4d42('0x5a'),_0x1b6efe,_0x500c57);}else{if(_0x311687[_0x231727]===_0x4d42('0x5b')){_0x361089[_0x4d42('0x43')]('i.'+_0x231727+_0x4d42('0x5c'));}else{_0x361089['and']('i.'+_0x231727+_0x4d42('0x5d'),_0x311687[_0x231727]);}}});}return _0x361089;}function parseQueryParameters(_0x2b1637,_0xeff49b,_0x1a71a0){var _0x56f669=getSqlClauses();return Promise[_0x4d42('0x5e')]()['then'](function(){return parseModelFields(_0x2b1637,_0xeff49b,_0x1a71a0);})[_0x4d42('0x5f')](function(_0xf077c4){_0x56f669[_0x4d42('0x60')][_0x4d42('0x43')](_0xf077c4);return parseReadParameter(_0xeff49b['read']);})[_0x4d42('0x5f')](function(_0x48e5dc){_0x56f669[_0x4d42('0x42')][_0x4d42('0x43')](_0x48e5dc);return parseTagParameter(_0xeff49b[_0x4d42('0x61')]);})[_0x4d42('0x5f')](function(_0x3babf4){_0x56f669[_0x4d42('0x4d')]['clause'][_0x4d42('0x43')](_0x3babf4);return parseSearchFilter(_0x2b1637,_0xeff49b['filter']);})['then'](function(_0x2a4490){_0x56f669['filter']=_0x2a4490;return _0x56f669;});}function checkAccountsRestrictions(_0x202c26,_0x82d945,_0x3213d8){var _0xf0fddd=utils[_0x4d42('0x5')](_0x202c26);var _0x3fc12e='get'+_[_0x4d42('0x62')](_0x202c26)+(_0x202c26==='chat'?_0x4d42('0x63'):'Accounts');var _0x22fb3a=squel['expr']();return Promise[_0x4d42('0x5e')]()[_0x4d42('0x5f')](function(){if(_0x3213d8[_0x4d42('0x7')]&&_0x82d945[_0x4d42('0x64')]===_0x4d42('0x6')){return _0x82d945[_0x3fc12e]({'attributes':['id'],'raw':!![]});}})[_0x4d42('0x5f')](function(_0x36530a){if(_0x36530a){if(_0x36530a['length']===0x0){_0x22fb3a[_0x4d42('0x43')]('i.'+_0xf0fddd+_0x4d42('0x5c'));}else{_0x22fb3a['and']('i.'+_0xf0fddd+_0x4d42('0x11'),_[_0x4d42('0x12')](_0x36530a,'id'));}}else if(!_0x3213d8[_0xf0fddd]){_0x22fb3a[_0x4d42('0x43')]('i.'+_0xf0fddd+_0x4d42('0x65'));}})[_0x4d42('0x5f')](function(){return _0x22fb3a;});}function getClosedOrderClause(_0x397772,_0x374d8e){var _0x5ddbed='';var _0x20f6c9=[_0x4d42('0x66'),_0x4d42('0x67'),_0x4d42('0x68')];if(_0x397772==='mail'){_0x20f6c9[_0x4d42('0x69')]('i.substatus');}if(_0x374d8e[_0x4d42('0x6a')]==='0'&&_0x397772===_0x4d42('0x2f')){_0x5ddbed='i.substatus';}else{if(_0x374d8e[_0x4d42('0x6a')]==='1'){_0x20f6c9['shift']();}_0x5ddbed='CONCAT_WS(\x27\x27,\x20'+_0x20f6c9['join'](',\x20')+')';}return _0x5ddbed;}function getFilteredInteractions(_0x263b0b,_0x5b6805,_0x31d7e4,_0x5858b4){var _0x1c6f98=utils[_0x4d42('0x14')](_0x263b0b);var _0x1c3f62=_[_0x4d42('0x62')](_0x263b0b)+_0x4d42('0x6b');var _0xa10d1d=[];var _0x534816=getTagsQuery();var _0x357009={'type':db[_0x4d42('0x6c')][_0x4d42('0x6d')]['SELECT'],'raw':!![]};var _0x3e7856=[];var _0x103867=[];return db['sequelize'][_0x4d42('0x6e')](_0x534816[_0x4d42('0x6f')](),_0x357009)[_0x4d42('0x5f')](function(_0x3fa983){_0xa10d1d=_['keyBy'](_0x3fa983,'id');_0x357009=_[_0x4d42('0x70')](_0x357009,{'model':db[_0x1c3f62],'mapToModel':!![],'nest':!![]});if(_0x31d7e4[_0x4d42('0x60')]){_0x5858b4[_0x4d42('0x71')][_0x4d42('0x24')](function(_0x506294){_0x5b6805[_0x4d42('0x9')]('i.'+_0x506294);});}else{_0x5b6805[_0x4d42('0x9')](_0x4d42('0x72'),_0x4d42('0x41'));_0x5b6805['field'](_0x4d42('0x73'),_0x4d42('0x74'));_0x5b6805[_0x4d42('0x9')]('a.mandatoryDisposition',_0x4d42('0x75'));if(_0x263b0b===_0x4d42('0x2f')){_0x5b6805[_0x4d42('0x9')]('a.email',_0x4d42('0x76'));_0x5b6805[_0x4d42('0x9')]('CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END',_0x4d42('0x77'));_0x5b6805['field']('i.id');_0x5b6805[_0x4d42('0x9')](_0x4d42('0x78'));_0x5b6805['field'](_0x4d42('0x79'));_0x5b6805[_0x4d42('0x9')]('i.closed');_0x5b6805[_0x4d42('0x9')](_0x4d42('0x7a'));_0x5b6805[_0x4d42('0x9')](_0x4d42('0x7b'));_0x5b6805[_0x4d42('0x9')]('i.lastMsgAt');_0x5b6805[_0x4d42('0x9')](_0x4d42('0x7c'));_0x5b6805[_0x4d42('0x9')](_0x4d42('0x7d'));_0x5b6805[_0x4d42('0x9')]('i.disposition');_0x5b6805[_0x4d42('0x9')]('i.secondDisposition');_0x5b6805[_0x4d42('0x9')](_0x4d42('0x66'));_0x5b6805['field'](_0x4d42('0x7e'));_0x5b6805['field']('i.to');_0x5b6805['field'](_0x4d42('0x7f'));_0x5b6805['field'](_0x4d42('0x80'));_0x5b6805[_0x4d42('0x9')](_0x4d42('0x81'));}else if(_0x263b0b==='openchannel'){_0x5b6805[_0x4d42('0x9')]('CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END',_0x4d42('0x77'));}else{_0x5b6805[_0x4d42('0x9')](_0x4d42('0x82'),_0x4d42('0x77'));}if(_0x263b0b!==_0x4d42('0x2f')){_0x5b6805[_0x4d42('0x9')]('i.*');}_0x5b6805[_0x4d42('0x9')](_0x4d42('0x83'),'Contact.firstName');_0x5b6805[_0x4d42('0x9')](_0x4d42('0x84'),_0x4d42('0x85'));_0x5b6805[_0x4d42('0x9')](_0x4d42('0x86'),'Contact.email');_0x5b6805[_0x4d42('0x9')](_0x4d42('0x87'),_0x4d42('0x88'));_0x5b6805[_0x4d42('0x9')](_0x4d42('0x89'),_0x4d42('0x8a'));_0x5b6805[_0x4d42('0x9')](_0x4d42('0x8b'),'Contact.fax');_0x5b6805[_0x4d42('0x9')](_0x4d42('0x8c'),'Owner.fullname');_0x5b6805[_0x4d42('0x9')]('o.internal','Owner.internal');_0x5b6805[_0x4d42('0x9')](_0x4d42('0x8d'),_0x4d42('0x8e'));}if(_0x5858b4['limit']){_0x5b6805[_0x4d42('0x8f')](_0x5858b4[_0x4d42('0x8f')]);}if(_0x5858b4[_0x4d42('0x90')]){_0x5b6805['offset'](_0x5858b4[_0x4d42('0x90')]);}return db[_0x4d42('0x91')][_0x4d42('0x6e')](_0x5b6805[_0x4d42('0x6f')](),_0x357009);})[_0x4d42('0x5f')](function(_0x1b796e){_0x3e7856=_0x1b796e;var _0x105e5d=getUsersQuery(_0x263b0b,_0x3e7856);return db[_0x4d42('0x91')][_0x4d42('0x6e')](_0x105e5d[_0x4d42('0x6f')](),_0x357009);})['then'](function(_0x53ae8c){_0x103867=_['groupBy'](_0x53ae8c,_0x1c6f98);if(_0x263b0b===_0x4d42('0x2f')){return db['Setting'][_0x4d42('0x92')]({'attributes':['enableEmailPreview'],'raw':!![]});}})[_0x4d42('0x5f')](function(_0x72efd1){var _0x538c8b=_0x72efd1?_0x72efd1[_0x4d42('0x93')]:undefined;var _0x26aea1=_0x3e7856[_0x4d42('0x12')](function(_0x39c540){return updateInteraction(_0x39c540,_0xa10d1d,_0x103867,_0x538c8b);});return Promise['all'](_0x26aea1);});}function countFilteredInteractions(_0x183b22,_0x4a13d2){var _0x3dad4a=_0x183b22[_0x4d42('0x94')]();_0x3dad4a['field'](_0x4d42('0x95'));_0x3dad4a[_0x4d42('0x9')](_0x4d42('0x72'),'unreadMessages');var _0x2d3221=utils[_0x4d42('0x23')](_0x4a13d2);if(!_[_0x4d42('0x96')](_0x2d3221)){_0x3dad4a[_0x4d42('0x10')](_0x4d42('0x97'),_0x2d3221);}var _0x1665d0={'type':db[_0x4d42('0x6c')][_0x4d42('0x6d')][_0x4d42('0x98')],'raw':!![]};return db['sequelize'][_0x4d42('0x6e')](_0x3dad4a[_0x4d42('0x6f')](),_0x1665d0);}module[_0x4d42('0x99')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file +var _0x7cbb=['i.id','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.lastMsgDirection','i.subject','i.secondDisposition','i.to','i.MailAccountId','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','limit','offset','findOne','enableEmailPreview','all','getSelectedTags','isEmpty','t.id\x20IN\x20?','QueryTypes','lodash','../parsers/qs','./update-interaction','updateInteraction','./utils','../../mysqldb','getAccountFK','role','agent','search','select','field','name','color','from','tools_tags','getInteractionFK','user_has_','_interactions','u.id','u.fullname','ui.','left_join','length','where','map','o.id\x20=\x20i.UserId','accounts','a.id\x20=\x20i.','messages','me.','interactionsTags','\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','forEach','unreadMessages\x20{OPERATOR}\x200','replace','{OPERATOR}','escapeLIKESpecialChars','isNumeric','i.id\x20LIKE\x20?','whatsapp','includes','i.phone\x20LIKE\x20?','fax','i.fax\x20LIKE\x20?','openchannel','i.from\x20LIKE\x20?','mail','isEmail','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','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)','getFullTextValue','sqlOperator','find','buildExpression','default','text','start','end','read','and','Contact','operator','$substring','split','value','contact','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','type','tags','clause','user','body','plainBody','keys','some','concat','createdAt','$gte','parse','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','resolve','then','fields','tag','filter','capitalize','chat','Websites','Accounts','\x20IN\x20?','\x20IS\x20NOT\x20NULL','i.thirdDisposition','unshift','closed','shift','CONCAT_WS(\x27\x27,\x20','join','Interaction','SELECT','sequelize','query','toString','keyBy','merge','attributes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','a.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'];(function(_0x488a28,_0x267632){var _0x3dece1=function(_0x34c885){while(--_0x34c885){_0x488a28['push'](_0x488a28['shift']());}};_0x3dece1(++_0x267632);}(_0x7cbb,0xbf));var _0xb7cb=function(_0x24bbe9,_0x5c1f85){_0x24bbe9=_0x24bbe9-0x0;var _0x12d9cb=_0x7cbb[_0x24bbe9];return _0x12d9cb;};'use strict';var _=require(_0xb7cb('0x0'));var squel=require('squel');var as=require('../parsers/advancedSearch');var qs=require(_0xb7cb('0x1'));var updateInteraction=require(_0xb7cb('0x2'))[_0xb7cb('0x3')];var utils=require(_0xb7cb('0x4'));var db=require(_0xb7cb('0x5'))['db'];function skipInteractionsQuery(_0x52fb2d,_0x210b41,_0x24e8ef){var _0x3c8535=![];var _0x108d32=utils[_0xb7cb('0x6')](_0x52fb2d);if(_0x210b41[_0xb7cb('0x7')]===_0xb7cb('0x8')&&!_0x24e8ef[_0xb7cb('0x9')]&&!_0x24e8ef[_0x108d32]){_0x3c8535=!![];}return _0x3c8535;}function getTagsQuery(){return squel[_0xb7cb('0xa')]()[_0xb7cb('0xb')]('id')['field'](_0xb7cb('0xc'))[_0xb7cb('0xb')](_0xb7cb('0xd'))[_0xb7cb('0xe')](_0xb7cb('0xf'));}function getUsersQuery(_0x1848a7,_0x45af59){var _0x2ca9af=utils[_0xb7cb('0x10')](_0x1848a7);var _0x244109=_0xb7cb('0x11')+_0x1848a7+_0xb7cb('0x12');var _0x363129=squel[_0xb7cb('0xa')]()[_0xb7cb('0xb')](_0xb7cb('0x13'))[_0xb7cb('0xb')](_0xb7cb('0x14'))[_0xb7cb('0xb')](_0xb7cb('0x15')+_0x2ca9af)[_0xb7cb('0xe')](_0x244109,'ui')[_0xb7cb('0x16')]('users','u','u.id\x20=\x20ui.UserId');if(_0x45af59[_0xb7cb('0x17')]>0x0){_0x363129[_0xb7cb('0x18')](_0xb7cb('0x15')+_0x2ca9af+'\x20IN\x20?',_[_0xb7cb('0x19')](_0x45af59,'id'));}return _0x363129;}function getInteractionsQuery(_0x3e438b){var _0x850d92=utils['getInteractionsTables'](_0x3e438b);var _0x4648c6=utils['getAccountFK'](_0x3e438b);var _0xda147a=utils[_0xb7cb('0x10')](_0x3e438b);return squel['select']()[_0xb7cb('0xe')](_0x850d92['interactions'],'i')[_0xb7cb('0x16')]('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join']('users','o',_0xb7cb('0x1a'))[_0xb7cb('0x16')](_0x850d92[_0xb7cb('0x1b')],'a',_0xb7cb('0x1c')+_0x4648c6)[_0xb7cb('0x16')](_0x850d92[_0xb7cb('0x1d')],'me',_0xb7cb('0x1e')+_0xda147a+'\x20=\x20i.id')[_0xb7cb('0x16')](_0x850d92[_0xb7cb('0x1f')],'it','it.'+_0xda147a+_0xb7cb('0x20'))[_0xb7cb('0x16')](_0xb7cb('0xf'),'t',_0xb7cb('0x21'));}function getSqlClauses(){var _0x48ce31={'body':squel[_0xb7cb('0x22')](),'contact':squel[_0xb7cb('0x22')](),'default':squel[_0xb7cb('0x22')](),'fields':squel[_0xb7cb('0x22')](),'filter':squel[_0xb7cb('0x22')](),'read':squel[_0xb7cb('0x22')](),'tags':{'clause':squel['expr'](),'ids':null},'user':squel[_0xb7cb('0x22')]()};return _0x48ce31;}function parseTagParameter(_0x21e1ef){var _0xc05b87=squel[_0xb7cb('0x22')]();if(_0x21e1ef){var _0x16e547=utils['getSelectedTags'](_0x21e1ef);_0x16e547[_0xb7cb('0x23')](function(_0x3a7304){_0xc05b87['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x3a7304+',%');});}return _0xc05b87;}function parseReadParameter(_0x126b26){var _0x36abae='';if(_0x126b26){_0x36abae=_0xb7cb('0x24');if(_0x126b26==='1'){_0x36abae=_0x36abae[_0xb7cb('0x25')]('{OPERATOR}','=');}else{_0x36abae=_0x36abae['replace'](_0xb7cb('0x26'),'>');}}return _0x36abae;}function parseSearchFilter(_0x2086ad,_0x3d3a80){var _0x13054b=squel[_0xb7cb('0x22')]();if(_0x3d3a80){var _0x2e2e74=_0x3d3a80[_0xb7cb('0x25')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');var _0x22c3d2=qs[_0xb7cb('0x27')](_0x2e2e74);if(qs[_0xb7cb('0x28')](_0x2e2e74)){_0x13054b['or'](_0xb7cb('0x29'),_0x22c3d2+'%');if(['sms',_0xb7cb('0x2a')][_0xb7cb('0x2b')](_0x2086ad)){_0x13054b['or'](_0xb7cb('0x2c'),_0x22c3d2+'%');}else if(_0x2086ad===_0xb7cb('0x2d')){_0x13054b['or'](_0xb7cb('0x2e'),_0x22c3d2+'%');}else if(_0x2086ad===_0xb7cb('0x2f')){_0x13054b['or'](_0xb7cb('0x30'),_0x22c3d2+'%');}}else if(_0x2086ad===_0xb7cb('0x31')&&qs[_0xb7cb('0x32')](_0x2e2e74)){_0x13054b['or']('c.email\x20LIKE\x20?',_0x22c3d2+'%');}else{if(_0x2086ad==='mail'){_0x13054b['or'](_0xb7cb('0x33'),qs['getFullTextValue'](_0x2e2e74,!![]))['or'](_0xb7cb('0x34'),qs['getFullTextValue'](_0x2e2e74));}else if(_0x2086ad!==_0xb7cb('0x2d')){_0x13054b['or'](_0xb7cb('0x35'),qs['getFullTextValue'](_0x2e2e74));}_0x13054b['or'](_0xb7cb('0x36'),qs[_0xb7cb('0x37')](_0x2e2e74,!![]),null);}}return _0x13054b;}function parseAdvancedSearchFilter(_0x470d88,_0x5973ab){var _0x5ab540=getSqlClauses();var _0x2a1ba4=as['parseSearch'](_0x470d88);var _0x2d2f29=_0x2a1ba4[_0xb7cb('0x38')];for(var _0x5a9022=0x0;_0x5a9022<_0x2a1ba4['conditions'][_0xb7cb('0x17')];_0x5a9022++){var _0xbb9ee1=_0x2a1ba4['conditions'][_0x5a9022];var _0x540295='i';var _0x20156b=_[_0xb7cb('0x39')](_0x5973ab,[_0xb7cb('0xc'),_0xbb9ee1[_0xb7cb('0xb')]]);if(_0x20156b){var _0x4b37ba=as[_0xb7cb('0x3a')](_0x540295,_0x20156b['type'],_0xbb9ee1);_0x5ab540[_0xb7cb('0x3b')][_0x2d2f29](_0x4b37ba[_0xb7cb('0x3c')],_0x4b37ba['value'][_0xb7cb('0x3d')],_0x4b37ba['value'][_0xb7cb('0x3e')]);}else{switch(_0xbb9ee1['field']){case'unreadMessages':var _0x3c4dca=parseReadParameter(_0xbb9ee1['value']);_0x5ab540[_0xb7cb('0x3f')][_0xb7cb('0x40')](_0x3c4dca);break;case _0xb7cb('0x41'):if(_0xbb9ee1[_0xb7cb('0x42')]===_0xb7cb('0x43')){if(_0xbb9ee1['value'][_0xb7cb('0x44')]('\x20')['length']>0x1){_0x5ab540['contact'][_0x2d2f29](_0xb7cb('0x36'),qs[_0xb7cb('0x37')](_0xbb9ee1[_0xb7cb('0x45')],!![]),null);}else{var _0x10954a='%'+_0xbb9ee1[_0xb7cb('0x45')]+'%';_0x5ab540[_0xb7cb('0x46')][_0x2d2f29](_0xb7cb('0x47'),_0x10954a,_0x10954a,_0x10954a);}}else{_0x20156b=_[_0xb7cb('0x39')](_0x5973ab,[_0xb7cb('0xc'),'ContactId']);_0xbb9ee1['field']='ContactId';_0x4b37ba=as['buildExpression'](_0x540295,_0x20156b[_0xb7cb('0x48')],_0xbb9ee1);_0x5ab540['contact'][_0x2d2f29](_0x4b37ba[_0xb7cb('0x3c')],_0x4b37ba[_0xb7cb('0x45')][_0xb7cb('0x3d')],_0x4b37ba[_0xb7cb('0x45')]['end']);}break;case'Tag':var _0x5f1fcb=_0xbb9ee1[_0xb7cb('0x45')][_0xb7cb('0x44')](',')[_0xb7cb('0x19')](function(_0x231e89){return Number(_0x231e89);});var _0xb0b0dc=parseTagParameter(_0x5f1fcb);_0x5ab540[_0xb7cb('0x49')][_0xb7cb('0x4a')][_0xb7cb('0x40')](_0xb0b0dc);_0x5ab540[_0xb7cb('0x49')]['ids']=_0x5f1fcb;break;case'User':if(_0xbb9ee1[_0xb7cb('0x42')]===_0xb7cb('0x43')){_0x5ab540['user'][_0x2d2f29]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname,\x20o.internal)\x20LIKE\x20?','%'+_0xbb9ee1[_0xb7cb('0x45')]+'%',null);}else{_0x20156b=_[_0xb7cb('0x39')](_0x5973ab,[_0xb7cb('0xc'),'UserId']);_0xbb9ee1[_0xb7cb('0xb')]='UserId';_0x4b37ba=as[_0xb7cb('0x3a')](_0x540295,_0x20156b[_0xb7cb('0x48')],_0xbb9ee1);_0x5ab540[_0xb7cb('0x4b')][_0x2d2f29](_0x4b37ba[_0xb7cb('0x3c')],_0x4b37ba[_0xb7cb('0x45')][_0xb7cb('0x3d')],_0x4b37ba[_0xb7cb('0x45')][_0xb7cb('0x3e')]);}break;case _0xb7cb('0x4c'):case _0xb7cb('0x4d'):_0x4b37ba=as[_0xb7cb('0x3a')]('me',null,_0xbb9ee1);_0x5ab540[_0xb7cb('0x4c')][_0x2d2f29](_0x4b37ba[_0xb7cb('0x3c')],_0x4b37ba['value']['start'],_0x4b37ba[_0xb7cb('0x45')][_0xb7cb('0x3e')]);break;}}}return _0x5ab540;}function parseModelFields(_0x53f25b,_0x3e9e0a,_0x2fcdca){var _0x2c19c7=utils[_0xb7cb('0x6')](_0x53f25b);var _0x267569=squel[_0xb7cb('0x22')]();var _0x5167bf=_(_0x3e9e0a)[_0xb7cb('0x4e')]()[_0xb7cb('0x19')](function(_0x3d46db){return _[_0xb7cb('0x4f')](_0x2fcdca,[_0xb7cb('0xc'),_0x3d46db])?_0x3d46db:undefined;})['compact']()['value']();if(_0x5167bf[_0xb7cb('0x17')]>0x0){_0x5167bf['forEach'](function(_0x9cd6c1){if(_0x9cd6c1===_0x2c19c7){_0x267569['and']('i.'+_0x2c19c7+'\x20IN\x20?',[][_0xb7cb('0x50')](_0x3e9e0a[_0x9cd6c1]));}else if(_0x9cd6c1===_0xb7cb('0x51')){var _0x3045dd=JSON['parse'](_0x3e9e0a[_0x9cd6c1])[_0xb7cb('0x52')];var _0x19d5b0=JSON[_0xb7cb('0x53')](_0x3e9e0a[_0x9cd6c1])['$lte'];_0x267569[_0xb7cb('0x40')](_0xb7cb('0x54'),_0x3045dd,_0x19d5b0);}else{if(_0x3e9e0a[_0x9cd6c1]===_0xb7cb('0x55')){_0x267569[_0xb7cb('0x40')]('i.'+_0x9cd6c1+_0xb7cb('0x56'));}else{_0x267569[_0xb7cb('0x40')]('i.'+_0x9cd6c1+'\x20=\x20?',_0x3e9e0a[_0x9cd6c1]);}}});}return _0x267569;}function parseQueryParameters(_0x2781ac,_0x3e9dbb,_0x29a3a8){var _0x48e51a=getSqlClauses();return Promise[_0xb7cb('0x57')]()['then'](function(){return parseModelFields(_0x2781ac,_0x3e9dbb,_0x29a3a8);})[_0xb7cb('0x58')](function(_0x3ffb4a){_0x48e51a[_0xb7cb('0x59')][_0xb7cb('0x40')](_0x3ffb4a);return parseReadParameter(_0x3e9dbb[_0xb7cb('0x3f')]);})['then'](function(_0x35c756){_0x48e51a[_0xb7cb('0x3f')][_0xb7cb('0x40')](_0x35c756);return parseTagParameter(_0x3e9dbb[_0xb7cb('0x5a')]);})[_0xb7cb('0x58')](function(_0x315eef){_0x48e51a[_0xb7cb('0x49')][_0xb7cb('0x4a')]['and'](_0x315eef);return parseSearchFilter(_0x2781ac,_0x3e9dbb['filter']);})['then'](function(_0x4ca41c){_0x48e51a[_0xb7cb('0x5b')]=_0x4ca41c;return _0x48e51a;});}function checkAccountsRestrictions(_0x529126,_0x5987e8,_0x8ba9b){var _0x1e65e8=utils[_0xb7cb('0x6')](_0x529126);var _0x22f604='get'+_[_0xb7cb('0x5c')](_0x529126)+(_0x529126===_0xb7cb('0x5d')?_0xb7cb('0x5e'):_0xb7cb('0x5f'));var _0x1cfeef=squel[_0xb7cb('0x22')]();return Promise[_0xb7cb('0x57')]()[_0xb7cb('0x58')](function(){if(_0x8ba9b['search']&&_0x5987e8['role']===_0xb7cb('0x8')){return _0x5987e8[_0x22f604]({'attributes':['id'],'raw':!![]});}})[_0xb7cb('0x58')](function(_0x1a5666){if(_0x1a5666){if(_0x1a5666[_0xb7cb('0x17')]===0x0){_0x1cfeef[_0xb7cb('0x40')]('i.'+_0x1e65e8+'\x20IS\x20NULL');}else{_0x1cfeef[_0xb7cb('0x40')]('i.'+_0x1e65e8+_0xb7cb('0x60'),_[_0xb7cb('0x19')](_0x1a5666,'id'));}}else if(!_0x8ba9b[_0x1e65e8]){_0x1cfeef['and']('i.'+_0x1e65e8+_0xb7cb('0x61'));}})['then'](function(){return _0x1cfeef;});}function getClosedOrderClause(_0x264ba9,_0x576bf1){var _0x31251a='';var _0x24dbc1=[_0xb7cb('0x62'),'i.secondDisposition','i.disposition'];if(_0x264ba9===_0xb7cb('0x31')){_0x24dbc1[_0xb7cb('0x63')]('i.substatus');}if(_0x576bf1[_0xb7cb('0x64')]==='0'&&_0x264ba9===_0xb7cb('0x31')){_0x31251a='i.substatus';}else{if(_0x576bf1[_0xb7cb('0x64')]==='1'){_0x24dbc1[_0xb7cb('0x65')]();}_0x31251a=_0xb7cb('0x66')+_0x24dbc1[_0xb7cb('0x67')](',\x20')+')';}return _0x31251a;}function getFilteredInteractions(_0x206e53,_0x4fe1ce,_0x414ad2,_0x532434){var _0x7573f0=utils[_0xb7cb('0x10')](_0x206e53);var _0x234148=_[_0xb7cb('0x5c')](_0x206e53)+_0xb7cb('0x68');var _0x20ce8e=[];var _0x396597=getTagsQuery();var _0x589307={'type':db['Sequelize']['QueryTypes'][_0xb7cb('0x69')],'raw':!![]};var _0x32fd4a=[];var _0x220f49=[];return db[_0xb7cb('0x6a')][_0xb7cb('0x6b')](_0x396597[_0xb7cb('0x6c')](),_0x589307)[_0xb7cb('0x58')](function(_0x36109e){_0x20ce8e=_[_0xb7cb('0x6d')](_0x36109e,'id');_0x589307=_[_0xb7cb('0x6e')](_0x589307,{'model':db[_0x234148],'mapToModel':!![],'nest':!![]});if(_0x414ad2['fields']){_0x532434[_0xb7cb('0x6f')][_0xb7cb('0x23')](function(_0x103fbd){_0x4fe1ce['field']('i.'+_0x103fbd);});}else{_0x4fe1ce['field'](_0xb7cb('0x70'),_0xb7cb('0x71'));_0x4fe1ce[_0xb7cb('0xb')](_0xb7cb('0x72'),_0xb7cb('0x73'));_0x4fe1ce[_0xb7cb('0xb')](_0xb7cb('0x74'),_0xb7cb('0x75'));if(_0x206e53===_0xb7cb('0x31')){_0x4fe1ce[_0xb7cb('0xb')](_0xb7cb('0x76'),'Account.email');_0x4fe1ce[_0xb7cb('0xb')](_0xb7cb('0x77'),_0xb7cb('0x78'));_0x4fe1ce['field'](_0xb7cb('0x79'));_0x4fe1ce[_0xb7cb('0xb')](_0xb7cb('0x7a'));_0x4fe1ce[_0xb7cb('0xb')](_0xb7cb('0x7b'));_0x4fe1ce['field'](_0xb7cb('0x7c'));_0x4fe1ce[_0xb7cb('0xb')](_0xb7cb('0x7d'));_0x4fe1ce[_0xb7cb('0xb')](_0xb7cb('0x7e'));_0x4fe1ce[_0xb7cb('0xb')](_0xb7cb('0x7f'));_0x4fe1ce[_0xb7cb('0xb')](_0xb7cb('0x80'));_0x4fe1ce[_0xb7cb('0xb')](_0xb7cb('0x81'));_0x4fe1ce['field']('i.disposition');_0x4fe1ce[_0xb7cb('0xb')](_0xb7cb('0x82'));_0x4fe1ce['field']('i.thirdDisposition');_0x4fe1ce[_0xb7cb('0xb')]('i.substatus');_0x4fe1ce[_0xb7cb('0xb')](_0xb7cb('0x83'));_0x4fe1ce[_0xb7cb('0xb')]('i.ContactId');_0x4fe1ce['field'](_0xb7cb('0x84'));_0x4fe1ce[_0xb7cb('0xb')]('i.UserId');}else if(_0x206e53==='openchannel'){_0x4fe1ce[_0xb7cb('0xb')](_0xb7cb('0x85'),_0xb7cb('0x78'));}else{_0x4fe1ce[_0xb7cb('0xb')]('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',_0xb7cb('0x78'));}if(_0x206e53!==_0xb7cb('0x31')){_0x4fe1ce[_0xb7cb('0xb')](_0xb7cb('0x86'));}_0x4fe1ce[_0xb7cb('0xb')](_0xb7cb('0x87'),_0xb7cb('0x88'));_0x4fe1ce[_0xb7cb('0xb')]('c.lastName',_0xb7cb('0x89'));_0x4fe1ce['field'](_0xb7cb('0x8a'),_0xb7cb('0x8b'));_0x4fe1ce[_0xb7cb('0xb')](_0xb7cb('0x8c'),_0xb7cb('0x8d'));_0x4fe1ce[_0xb7cb('0xb')](_0xb7cb('0x8e'),'Contact.mobile');_0x4fe1ce[_0xb7cb('0xb')]('c.fax','Contact.fax');_0x4fe1ce[_0xb7cb('0xb')](_0xb7cb('0x8f'),'Owner.fullname');_0x4fe1ce['field'](_0xb7cb('0x90'),_0xb7cb('0x91'));_0x4fe1ce['field'](_0xb7cb('0x92'),'TagIds');}if(_0x532434[_0xb7cb('0x93')]){_0x4fe1ce[_0xb7cb('0x93')](_0x532434[_0xb7cb('0x93')]);}if(_0x532434[_0xb7cb('0x94')]){_0x4fe1ce['offset'](_0x532434[_0xb7cb('0x94')]);}return db['sequelize']['query'](_0x4fe1ce[_0xb7cb('0x6c')](),_0x589307);})[_0xb7cb('0x58')](function(_0x2ac47a){_0x32fd4a=_0x2ac47a;var _0x4caf1f=getUsersQuery(_0x206e53,_0x32fd4a);return db[_0xb7cb('0x6a')]['query'](_0x4caf1f[_0xb7cb('0x6c')](),_0x589307);})[_0xb7cb('0x58')](function(_0x3a64c1){_0x220f49=_['groupBy'](_0x3a64c1,_0x7573f0);if(_0x206e53===_0xb7cb('0x31')){return db['Setting'][_0xb7cb('0x95')]({'attributes':[_0xb7cb('0x96')],'raw':!![]});}})[_0xb7cb('0x58')](function(_0x188e09){var _0x3b7371=_0x188e09?_0x188e09[_0xb7cb('0x96')]:undefined;var _0x14b6bc=_0x32fd4a[_0xb7cb('0x19')](function(_0x2e99a4){return updateInteraction(_0x2e99a4,_0x20ce8e,_0x220f49,_0x3b7371);});return Promise[_0xb7cb('0x97')](_0x14b6bc);});}function countFilteredInteractions(_0x190802,_0x4b27cd){var _0x10db6d=_0x190802['clone']();_0x10db6d[_0xb7cb('0xb')]('COUNT(*)');_0x10db6d[_0xb7cb('0xb')](_0xb7cb('0x70'),_0xb7cb('0x71'));var _0x3f1ee9=utils[_0xb7cb('0x98')](_0x4b27cd);if(!_[_0xb7cb('0x99')](_0x3f1ee9)){_0x10db6d['where'](_0xb7cb('0x9a'),_0x3f1ee9);}var _0x5d9af2={'type':db['Sequelize'][_0xb7cb('0x9b')]['SELECT'],'raw':!![]};return db[_0xb7cb('0x6a')][_0xb7cb('0x6b')](_0x10db6d[_0xb7cb('0x6c')](),_0x5d9af2);}module['exports']={'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 67b301a..64ad1f2 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 _0x6d31=['MailMessage','out','-id','then','lastMsgText','trimStart','plainBody','catch','updateInteraction','Users','Tags','TagIds','lodash','map','fullname','forEach','push','talking','answered','abandoned','total','closed','disposition','UserId','unmanaged','waiting'];(function(_0x3bccaf,_0xf6a282){var _0x20de01=function(_0x5349a1){while(--_0x5349a1){_0x3bccaf['push'](_0x3bccaf['shift']());}};_0x20de01(++_0xf6a282);}(_0x6d31,0xa8));var _0x16d3=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x6d31[_0x4154a6];return _0x3b2786;};'use strict';var _=require(_0x16d3('0x0'));var db=require('../../mysqldb')['db'];function getInteractionUsers(_0x595d39,_0x53c870){return new Promise(function(_0x32c3d0,_0x11974e){try{var _0x3e5966=[];if(_0x53c870[_0x595d39]){_0x3e5966=_0x53c870[_0x595d39][_0x16d3('0x1')](function(_0x25b638){return{'id':_0x25b638['id'],'fullname':_0x25b638[_0x16d3('0x2')]};});}return _0x32c3d0(_0x3e5966);}catch(_0x26aac7){_0x11974e(_0x26aac7);}});}function getInteractionTags(_0x1d4657,_0x3ca72e){var _0x5a5d55=[];if(_0x1d4657){_0x1d4657['split'](',')[_0x16d3('0x3')](function(_0x4efffd){_0x5a5d55[_0x16d3('0x4')](_0x3ca72e[_0x4efffd]);});}return _0x5a5d55;}function updateWaitingCounter(_0x19b1ba){if(_0x19b1ba['waiting']){_0x19b1ba['waiting']-=0x1;}}function updateInteractionCounters(_0x3ea4aa){_0x3ea4aa['waiting']=0x0;_0x3ea4aa[_0x16d3('0x5')]=0x0;_0x3ea4aa[_0x16d3('0x6')]=0x0;_0x3ea4aa['unmanaged']=0x0;_0x3ea4aa[_0x16d3('0x7')]=0x0;_0x3ea4aa[_0x16d3('0x8')]=0x0;if(_0x3ea4aa[_0x16d3('0x9')]){if(_0x3ea4aa[_0x16d3('0xa')]===_0x16d3('0x7')){_0x3ea4aa[_0x16d3('0x7')]+=0x1;updateWaitingCounter(_0x3ea4aa);}if(_0x3ea4aa[_0x16d3('0xb')]){_0x3ea4aa[_0x16d3('0x6')]+=0x1;if(_0x3ea4aa[_0x16d3('0x5')]){_0x3ea4aa[_0x16d3('0x5')]-=0x1;}}else{if(_0x3ea4aa[_0x16d3('0xa')]){_0x3ea4aa[_0x16d3('0xc')]+=0x1;updateWaitingCounter(_0x3ea4aa);}}}else{if(!_0x3ea4aa[_0x16d3('0xb')]){_0x3ea4aa[_0x16d3('0xd')]+=0x1;}if(_0x3ea4aa[_0x16d3('0xb')]){_0x3ea4aa[_0x16d3('0x5')]+=0x1;updateWaitingCounter(_0x3ea4aa);}}_0x3ea4aa['total']+=0x1;return _0x3ea4aa;}function getLastMessageText(_0x4d9650){return db[_0x16d3('0xe')]['findOne']({'where':{'$and':[{'MailInteractionId':_0x4d9650['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x16d3('0xf')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':_0x16d3('0x10'),'raw':!![]})[_0x16d3('0x11')](function(_0x582a40){if(_0x582a40&&_0x582a40['plainBody']){_0x4d9650[_0x16d3('0x12')]=_[_0x16d3('0x13')](_0x582a40[_0x16d3('0x14')]);}return _0x4d9650;})[_0x16d3('0x15')](function(_0x1035fc){throw _0x1035fc;});}exports[_0x16d3('0x16')]=function(_0xb19c2c,_0x58e6e9,_0x71fd56,_0x40dca3){return new Promise(function(_0x3a7fa7,_0x453ad3){return getInteractionUsers(_0xb19c2c['id'],_0x71fd56)['then'](function(_0x584983){_0xb19c2c[_0x16d3('0x17')]=_0x584983;return getInteractionTags(_0xb19c2c['TagIds'],_0x58e6e9);})[_0x16d3('0x11')](function(_0x61775e){_0xb19c2c[_0x16d3('0x18')]=_0x61775e;delete _0xb19c2c[_0x16d3('0x19')];return updateInteractionCounters(_0xb19c2c);})[_0x16d3('0x11')](function(_0x1c9a31){if(_0x40dca3){return getLastMessageText(_0x1c9a31);}else{return _0x1c9a31;}})[_0x16d3('0x11')](function(_0x52e162){_0x3a7fa7(_0x52e162);})['catch'](function(_0x24ab2a){_0x453ad3(_0x24ab2a);});});}; \ No newline at end of file +var _0xfb29=['out','plainBody','then','lastMsgText','trimStart','catch','updateInteraction','Users','Tags','TagIds','lodash','../../mysqldb','map','fullname','forEach','push','waiting','answered','unmanaged','abandoned','total','closed','disposition','UserId','MailMessage'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xfb29,0x104));var _0x9fb2=function(_0x591ce6,_0x1c93e4){_0x591ce6=_0x591ce6-0x0;var _0x10ee0e=_0xfb29[_0x591ce6];return _0x10ee0e;};'use strict';var _=require(_0x9fb2('0x0'));var db=require(_0x9fb2('0x1'))['db'];function getInteractionUsers(_0x34d82a,_0x1b960b){return new Promise(function(_0x542d9d,_0x58be75){try{var _0x2f2d57=[];if(_0x1b960b[_0x34d82a]){_0x2f2d57=_0x1b960b[_0x34d82a][_0x9fb2('0x2')](function(_0x340f33){return{'id':_0x340f33['id'],'fullname':_0x340f33[_0x9fb2('0x3')]};});}return _0x542d9d(_0x2f2d57);}catch(_0x5a80d4){_0x58be75(_0x5a80d4);}});}function getInteractionTags(_0x341e2e,_0x3f1023){var _0x16c91b=[];if(_0x341e2e){_0x341e2e['split'](',')[_0x9fb2('0x4')](function(_0x24b351){_0x16c91b[_0x9fb2('0x5')](_0x3f1023[_0x24b351]);});}return _0x16c91b;}function updateWaitingCounter(_0x31ad05){if(_0x31ad05[_0x9fb2('0x6')]){_0x31ad05[_0x9fb2('0x6')]-=0x1;}}function updateInteractionCounters(_0x15871a){_0x15871a[_0x9fb2('0x6')]=0x0;_0x15871a['talking']=0x0;_0x15871a[_0x9fb2('0x7')]=0x0;_0x15871a[_0x9fb2('0x8')]=0x0;_0x15871a[_0x9fb2('0x9')]=0x0;_0x15871a[_0x9fb2('0xa')]=0x0;if(_0x15871a[_0x9fb2('0xb')]){if(_0x15871a[_0x9fb2('0xc')]==='abandoned'){_0x15871a[_0x9fb2('0x9')]+=0x1;updateWaitingCounter(_0x15871a);}if(_0x15871a['UserId']){_0x15871a[_0x9fb2('0x7')]+=0x1;if(_0x15871a['talking']){_0x15871a['talking']-=0x1;}}else{if(_0x15871a[_0x9fb2('0xc')]){_0x15871a[_0x9fb2('0x8')]+=0x1;updateWaitingCounter(_0x15871a);}}}else{if(!_0x15871a[_0x9fb2('0xd')]){_0x15871a[_0x9fb2('0x6')]+=0x1;}if(_0x15871a[_0x9fb2('0xd')]){_0x15871a['talking']+=0x1;updateWaitingCounter(_0x15871a);}}_0x15871a[_0x9fb2('0xa')]+=0x1;return _0x15871a;}function getLastMessageText(_0x5d1d50){return db[_0x9fb2('0xe')]['findOne']({'where':{'$and':[{'MailInteractionId':_0x5d1d50['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x9fb2('0xf')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x9fb2('0x10')],'order':'-id','raw':!![]})[_0x9fb2('0x11')](function(_0x5c8b27){if(_0x5c8b27&&_0x5c8b27[_0x9fb2('0x10')]){_0x5d1d50[_0x9fb2('0x12')]=_[_0x9fb2('0x13')](_0x5c8b27[_0x9fb2('0x10')]);}return _0x5d1d50;})[_0x9fb2('0x14')](function(_0x8e9962){throw _0x8e9962;});}exports[_0x9fb2('0x15')]=function(_0x239d61,_0x1f5f19,_0x3447fb,_0x14e057){return new Promise(function(_0x205a0e,_0x561b14){return getInteractionUsers(_0x239d61['id'],_0x3447fb)[_0x9fb2('0x11')](function(_0x113428){_0x239d61[_0x9fb2('0x16')]=_0x113428;return getInteractionTags(_0x239d61['TagIds'],_0x1f5f19);})['then'](function(_0x3d8093){_0x239d61[_0x9fb2('0x17')]=_0x3d8093;delete _0x239d61[_0x9fb2('0x18')];return updateInteractionCounters(_0x239d61);})[_0x9fb2('0x11')](function(_0x4e5be2){if(_0x14e057){return getLastMessageText(_0x4e5be2);}else{return _0x4e5be2;}})['then'](function(_0x5965b9){_0x205a0e(_0x5965b9);})[_0x9fb2('0x14')](function(_0x3dadb1){_0x561b14(_0x3dadb1);});});}; \ No newline at end of file diff --git a/server/components/interaction/utils.js b/server/components/interaction/utils.js index 1f5b9f4..8f46631 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 _0x09c6=['InteractionId','unknown','websites','accounts','_interaction_has_tags','_messages','user_has_','_interactions','isArray','toLowerCase','name','role','stringify','upperFirst','Interaction','findOne','then','update','info','catch','error','toUpperCase','\x20name=','\x20role=','\x20interaction=','exports','../../mysqldb','openchannel-interactions','../../config/logger','mail-interactions','fax-interactions','sms-interactions','chat-interactions','chat','Website','Account'];(function(_0x3b1e6f,_0x17e752){var _0x5760a2=function(_0x271694){while(--_0x271694){_0x3b1e6f['push'](_0x3b1e6f['shift']());}};_0x5760a2(++_0x17e752);}(_0x09c6,0x116));var _0x609c=function(_0xa01175,_0x3fa71a){_0xa01175=_0xa01175-0x0;var _0x303748=_0x09c6[_0xa01175];return _0x303748;};'use strict';var _=require('lodash');var db=require(_0x609c('0x0'))['db'];var loggers={'openchannel':require('../../config/logger')(_0x609c('0x1')),'mail':require(_0x609c('0x2'))(_0x609c('0x3')),'fax':require(_0x609c('0x2'))(_0x609c('0x4')),'sms':require(_0x609c('0x2'))(_0x609c('0x5')),'chat':require('../../config/logger')(_0x609c('0x6')),'whatsapp':require('../../config/logger')('whatsapp-interactions')};function getAccountFK(_0x190a7f){return _['capitalize'](_0x190a7f)+(_0x190a7f===_0x609c('0x7')?_0x609c('0x8'):_0x609c('0x9'))+'Id';}function getInteractionFK(_0x13eaf2){return _['capitalize'](_0x13eaf2)+_0x609c('0xa');}function getInteractionId(_0x344630,_0x2462d7,_0x42c91b){if(_0x344630&&_0x344630[_['upperFirst'](_0x42c91b)+_0x609c('0xa')]){return _0x344630[_['upperFirst'](_0x42c91b)+_0x609c('0xa')];}else if(_0x344630&&_0x344630['id']){return _0x344630['id'];}else if(_0x2462d7&&_0x2462d7['id']){return _0x2462d7['id'];}else{return _0x609c('0xb');}}function getInteractionsTables(_0x3c8cd3){return{'accounts':_0x3c8cd3+'_'+(_0x3c8cd3===_0x609c('0x7')?_0x609c('0xc'):_0x609c('0xd')),'interactions':_0x3c8cd3+'_interactions','interactionsTags':_0x3c8cd3+_0x609c('0xe'),'messages':_0x3c8cd3+_0x609c('0xf'),'userInteractions':_0x609c('0x10')+_0x3c8cd3+_0x609c('0x11')};}function getSelectedTags(_0x30c9ab){var _0x5656a3=[];if(_0x30c9ab){_0x5656a3=Array[_0x609c('0x12')](_0x30c9ab)?_0x30c9ab:[_0x30c9ab];}return _0x5656a3;}function log(_0x43b5e8,_0x269390,_0xd84cef,_0x5c242c,_0x88cd1c,_0x4c0f06){loggers[_0x88cd1c[_0x609c('0x13')]()][_0x43b5e8]('[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4c0f06['toUpperCase'](),_0x269390?_0x269390['id']:null,_0x269390?_0x269390[_0x609c('0x14')]:null,_0x269390?_0x269390[_0x609c('0x15')]:null,getInteractionId(_0xd84cef,_0x5c242c,_0x88cd1c),_0xd84cef?JSON[_0x609c('0x16')](_0xd84cef):'null');}function updateUser(_0x3d37e5,_0x5d65a0,_0x17f342,_0x262fc0,_0xd124ee){db[_[_0x609c('0x17')](_0x262fc0)+_0x609c('0x18')][_0x609c('0x19')]({'where':{'id':getInteractionId(_0x5d65a0,_0x17f342,_0x262fc0)}})[_0x609c('0x1a')](function(_0x32f221){if(_0x32f221){return _0x32f221[_0x609c('0x1b')]({'UserId':_0x3d37e5?_0x3d37e5['id']:null});}})[_0x609c('0x1a')](function(_0x43df24){if(_0x43df24){log(_0x609c('0x1c'),_0x3d37e5,_0x5d65a0,_0x17f342,_0x262fc0,_0xd124ee);}})[_0x609c('0x1d')](function(){log(_0x609c('0x1e'),_0x3d37e5,_0x5d65a0,_0x17f342,_0x262fc0,_0xd124ee);});}function logAcceptMessage(_0x123aba,_0x466808,_0x10c461,_0x2e24da){var _0x29331b=loggers[_0x123aba['toLowerCase']()];var _0x14ecb1=_0x466808['id'];var _0x20c1b1=_0x466808['name'];var _0x30d399=_0x466808['role'];var _0x4e7836=JSON[_0x609c('0x16')](_0x2e24da||null);_0x29331b['info']('['+_0x123aba[_0x609c('0x1f')]()+'MESSAGE:ACCEPT]\x20id='+_0x14ecb1+_0x609c('0x20')+_0x20c1b1+_0x609c('0x21')+_0x30d399+_0x609c('0x22')+_0x10c461+'\x20body='+_0x4e7836);}module[_0x609c('0x23')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'logAcceptMessage':logAcceptMessage,'updateUser':updateUser}; \ No newline at end of file +var _0x364d=['toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','stringify','null','Interaction','findOne','then','update','info','MESSAGE:ACCEPT]\x20id=','\x20name=','\x20body=','exports','lodash','../../mysqldb','../../config/logger','mail-interactions','sms-interactions','chat-interactions','capitalize','chat','Website','InteractionId','upperFirst','unknown','accounts','_interactions','_interaction_has_tags','user_has_','isArray'];(function(_0x4f517f,_0x15e66f){var _0x48bc81=function(_0x275f58){while(--_0x275f58){_0x4f517f['push'](_0x4f517f['shift']());}};_0x48bc81(++_0x15e66f);}(_0x364d,0xb5));var _0xd364=function(_0x871ccd,_0x225e43){_0x871ccd=_0x871ccd-0x0;var _0x5d2acd=_0x364d[_0x871ccd];return _0x5d2acd;};'use strict';var _=require(_0xd364('0x0'));var db=require(_0xd364('0x1'))['db'];var loggers={'openchannel':require(_0xd364('0x2'))('openchannel-interactions'),'mail':require(_0xd364('0x2'))(_0xd364('0x3')),'fax':require(_0xd364('0x2'))('fax-interactions'),'sms':require('../../config/logger')(_0xd364('0x4')),'chat':require('../../config/logger')(_0xd364('0x5')),'whatsapp':require(_0xd364('0x2'))('whatsapp-interactions')};function getAccountFK(_0x1f915b){return _[_0xd364('0x6')](_0x1f915b)+(_0x1f915b===_0xd364('0x7')?_0xd364('0x8'):'Account')+'Id';}function getInteractionFK(_0x490bc9){return _[_0xd364('0x6')](_0x490bc9)+_0xd364('0x9');}function getInteractionId(_0x19184b,_0x407cfd,_0x5b747b){if(_0x19184b&&_0x19184b[_['upperFirst'](_0x5b747b)+_0xd364('0x9')]){return _0x19184b[_[_0xd364('0xa')](_0x5b747b)+'InteractionId'];}else if(_0x19184b&&_0x19184b['id']){return _0x19184b['id'];}else if(_0x407cfd&&_0x407cfd['id']){return _0x407cfd['id'];}else{return _0xd364('0xb');}}function getInteractionsTables(_0x13c102){return{'accounts':_0x13c102+'_'+(_0x13c102===_0xd364('0x7')?'websites':_0xd364('0xc')),'interactions':_0x13c102+_0xd364('0xd'),'interactionsTags':_0x13c102+_0xd364('0xe'),'messages':_0x13c102+'_messages','userInteractions':_0xd364('0xf')+_0x13c102+_0xd364('0xd')};}function getSelectedTags(_0x383259){var _0x1f010b=[];if(_0x383259){_0x1f010b=Array[_0xd364('0x10')](_0x383259)?_0x383259:[_0x383259];}return _0x1f010b;}function log(_0xe6c66c,_0x57a30b,_0x43d90b,_0x3f1be1,_0x532971,_0x3572a7){loggers[_0x532971[_0xd364('0x11')]()][_0xe6c66c](_0xd364('0x12'),_0x3572a7[_0xd364('0x13')](),_0x57a30b?_0x57a30b['id']:null,_0x57a30b?_0x57a30b[_0xd364('0x14')]:null,_0x57a30b?_0x57a30b[_0xd364('0x15')]:null,getInteractionId(_0x43d90b,_0x3f1be1,_0x532971),_0x43d90b?JSON[_0xd364('0x16')](_0x43d90b):_0xd364('0x17'));}function updateUser(_0x1e1082,_0x366918,_0x5e316b,_0x1fa9f3,_0x55d7ea){db[_[_0xd364('0xa')](_0x1fa9f3)+_0xd364('0x18')][_0xd364('0x19')]({'where':{'id':getInteractionId(_0x366918,_0x5e316b,_0x1fa9f3)}})[_0xd364('0x1a')](function(_0x1e7cbf){if(_0x1e7cbf){return _0x1e7cbf[_0xd364('0x1b')]({'UserId':_0x1e1082?_0x1e1082['id']:null});}})[_0xd364('0x1a')](function(_0x53643f){if(_0x53643f){log(_0xd364('0x1c'),_0x1e1082,_0x366918,_0x5e316b,_0x1fa9f3,_0x55d7ea);}})['catch'](function(){log('error',_0x1e1082,_0x366918,_0x5e316b,_0x1fa9f3,_0x55d7ea);});}function logAcceptMessage(_0x377bc3,_0x3f68ca,_0x32571e,_0x3dc817){var _0x26d635=loggers[_0x377bc3[_0xd364('0x11')]()];var _0x332bd1=_0x3f68ca['id'];var _0x107b50=_0x3f68ca[_0xd364('0x14')];var _0x4f63fa=_0x3f68ca[_0xd364('0x15')];var _0x14fa92=JSON['stringify'](_0x3dc817||null);_0x26d635[_0xd364('0x1c')]('['+_0x377bc3[_0xd364('0x13')]()+_0xd364('0x1d')+_0x332bd1+_0xd364('0x1e')+_0x107b50+'\x20role='+_0x4f63fa+'\x20interaction='+_0x32571e+_0xd364('0x1f')+_0x14fa92);}module[_0xd364('0x20')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'logAcceptMessage':logAcceptMessage,'updateUser':updateUser}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index b68f12d..c0470f2 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 _0x0ab7=['license','data1','split','aes-256-ctr','format','%s:%s:%s','update','base64','utf8','final','parse','hasOwnProperty','use','License','findOne','then','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','admin','user','isUserLimit','crypto','../../mysqldb'];(function(_0x47aa64,_0xfb8a07){var _0x549c7a=function(_0x266165){while(--_0x266165){_0x47aa64['push'](_0x47aa64['shift']());}};_0x549c7a(++_0xfb8a07);}(_0x0ab7,0x136));var _0x70ab=function(_0x18e713,_0x3fcdfa){_0x18e713=_0x18e713-0x0;var _0x1d9f38=_0x0ab7[_0x18e713];return _0x1d9f38;};'use strict';var crypto=require(_0x70ab('0x0'));var util=require('util');var compose=require('composable-middleware');var db=require(_0x70ab('0x1'))['db'];var config=require('../../config/environment');function getValueFromLicense(_0x4ca3cd,_0x725965){if(_0x4ca3cd&&_0x725965){if(_0x725965['data1']&&_0x725965[_0x70ab('0x2')]){var _0x49cd43=_0x725965[_0x70ab('0x3')];var _0x24a0f5=_0x725965[_0x70ab('0x2')];var _0x973c2a=_0x49cd43[_0x70ab('0x4')]('-')[0x4];var _0x1823b3=_0x49cd43[_0x70ab('0x4')]('-')[0x0];var _0x105c12=crypto['createDecipher'](_0x70ab('0x5'),util[_0x70ab('0x6')](_0x70ab('0x7'),_0x973c2a,_0x49cd43,_0x1823b3));var _0x987fb0=_0x105c12[_0x70ab('0x8')](_0x24a0f5,_0x70ab('0x9'),_0x70ab('0xa'));_0x987fb0+=_0x105c12[_0x70ab('0xb')](_0x70ab('0xa'));var _0x3150f6=JSON[_0x70ab('0xc')](_0x987fb0);return _0x3150f6[_0x70ab('0xd')](_0x4ca3cd)?_0x3150f6[_0x4ca3cd]:null;}}return null;}function isLimit(_0x444f62,_0x335943,_0x295720,_0xd143f6){var _0xc2723a=_0x335943;return compose()[_0x70ab('0xe')](function(_0x1099cd,_0x406fdb,_0x23900a){return db[_0x70ab('0xf')][_0x70ab('0x10')]({'where':{'id':0x1},'raw':!![]})['then'](function(_0x48b07d){var _0x3e4f1d=getValueFromLicense(_0x444f62,_0x48b07d);return _0x3e4f1d?_0x3e4f1d:_0xc2723a;})['then'](function(_0x8c51ce){_0xc2723a=_0x8c51ce;return _0x295720['count'](_0xd143f6);})[_0x70ab('0x11')](function(_0x37dd2a){if(_0x37dd2a>=_0xc2723a){return _0x406fdb['status'](0x193)[_0x70ab('0x12')]({'message':util[_0x70ab('0x6')](_0x70ab('0x13'),_0x444f62)});}_0x23900a();})[_0x70ab('0x14')](function(_0x19f05a){_0x23900a(_0x19f05a);});});}function isUserLimit(){return isLimit('users',0x1,db['User'],{'where':{'$or':[{'role':_0x70ab('0x15')},{'role':_0x70ab('0x16')}]}});}exports[_0x70ab('0x17')]=isUserLimit; \ No newline at end of file +var _0x91d2=['crypto','util','composable-middleware','../../config/environment','data1','split','createDecipher','aes-256-ctr','%s:%s:%s','update','base64','utf8','final','parse','License','findOne','then','count','status','json','format','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','admin','user','isUserLimit'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0x91d2,0x188));var _0x291d=function(_0x231567,_0x3617fc){_0x231567=_0x231567-0x0;var _0x37e4ee=_0x91d2[_0x231567];return _0x37e4ee;};'use strict';var crypto=require(_0x291d('0x0'));var util=require(_0x291d('0x1'));var compose=require(_0x291d('0x2'));var db=require('../../mysqldb')['db'];var config=require(_0x291d('0x3'));function getValueFromLicense(_0x1595e6,_0x4af37a){if(_0x1595e6&&_0x4af37a){if(_0x4af37a[_0x291d('0x4')]&&_0x4af37a['license']){var _0xc2febe=_0x4af37a[_0x291d('0x4')];var _0x18ae71=_0x4af37a['license'];var _0x10031f=_0xc2febe[_0x291d('0x5')]('-')[0x4];var _0x3b934c=_0xc2febe[_0x291d('0x5')]('-')[0x0];var _0x3a76df=crypto[_0x291d('0x6')](_0x291d('0x7'),util['format'](_0x291d('0x8'),_0x10031f,_0xc2febe,_0x3b934c));var _0x411c93=_0x3a76df[_0x291d('0x9')](_0x18ae71,_0x291d('0xa'),_0x291d('0xb'));_0x411c93+=_0x3a76df[_0x291d('0xc')](_0x291d('0xb'));var _0x44141d=JSON[_0x291d('0xd')](_0x411c93);return _0x44141d['hasOwnProperty'](_0x1595e6)?_0x44141d[_0x1595e6]:null;}}return null;}function isLimit(_0xafd357,_0x376435,_0x484550,_0x30f2da){var _0x245673=_0x376435;return compose()['use'](function(_0xd61ee2,_0x4ff7e6,_0x35fd59){return db[_0x291d('0xe')][_0x291d('0xf')]({'where':{'id':0x1},'raw':!![]})[_0x291d('0x10')](function(_0x134611){var _0x367368=getValueFromLicense(_0xafd357,_0x134611);return _0x367368?_0x367368:_0x245673;})['then'](function(_0x2be9ef){_0x245673=_0x2be9ef;return _0x484550[_0x291d('0x11')](_0x30f2da);})[_0x291d('0x10')](function(_0x12d16d){if(_0x12d16d>=_0x245673){return _0x4ff7e6[_0x291d('0x12')](0x193)[_0x291d('0x13')]({'message':util[_0x291d('0x14')](_0x291d('0x15'),_0xafd357)});}_0x35fd59();})[_0x291d('0x16')](function(_0x572146){_0x35fd59(_0x572146);});});}function isUserLimit(){return isLimit(_0x291d('0x17'),0x1,db[_0x291d('0x18')],{'where':{'$or':[{'role':_0x291d('0x19')},{'role':_0x291d('0x1a')}]}});}exports[_0x291d('0x1b')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 1ec39f8..e6a2e3a 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 _0xb623=['$startsWith','LIKE\x20?','$lt','$lte','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','$in','start','$endsWith','pop','utcOffset','hours','seconds','lodash','moment','parseSearch','sqlOperator','startsWith','[$or]','and','replace','[$and]','split','length','slice','forEach','shift','match','indexOf','map','conditions','push','buildExpression','DATE','operator','$between','value','$gt','add','days','format','YYYY-MM-DD','castTo','CAST(','\x20AS\x20','text','includes','$ne','$notIn','field','\x20IS\x20NULL)','NOT\x20IN\x20?','$eq','=\x20?','<>\x20?','$substring'];(function(_0x1011f8,_0x26294c){var _0x51d5f9=function(_0x328304){while(--_0x328304){_0x1011f8['push'](_0x1011f8['shift']());}};_0x51d5f9(++_0x26294c);}(_0xb623,0x16b));var _0x3b62=function(_0x472414,_0x43e7d2){_0x472414=_0x472414-0x0;var _0x54345e=_0xb623[_0x472414];return _0x54345e;};'use strict';var _=require(_0x3b62('0x0'));var moment=require(_0x3b62('0x1'));exports[_0x3b62('0x2')]=function(_0x196d2a){var _0x5b4ef5={'conditions':[]};_0x5b4ef5[_0x3b62('0x3')]=_[_0x3b62('0x4')](_0x196d2a,_0x3b62('0x5'))?'or':_0x3b62('0x6');var _0x2606c3=_0x196d2a[_0x3b62('0x7')](_0x3b62('0x8'),'')['replace'](_0x3b62('0x5'),'')[_0x3b62('0x9')]('||');for(var _0x18de05=0x0;_0x18de05<_0x2606c3[_0x3b62('0xa')];_0x18de05++){var _0x21895b=_0x2606c3[_0x18de05]['split'](':=');var _0x549120=_0x21895b[0x0];var _0x4c72eb=_0x21895b[_0x3b62('0xb')](0x1);_0x4c72eb[_0x3b62('0xc')](function(_0x37ca34){var _0x3ef088=_0x37ca34[_0x3b62('0x9')]('[')[_0x3b62('0xd')]();var _0x572011=_0x37ca34[_0x3b62('0xe')](/\[(.*?)\]/g);_0x572011['forEach'](function(_0x1e3349){var _0x2eed1a=_0x1e3349['split']('[')['filter'](function(_0x318add){return _0x318add[_0x3b62('0xf')](']')>-0x1;})[_0x3b62('0x10')](function(_0x311391){return _0x311391[_0x3b62('0x9')](']')[0x0];})[0x0];_0x5b4ef5[_0x3b62('0x11')][_0x3b62('0x12')]({'field':_0x549120,'operator':_0x3ef088,'value':_0x2eed1a});});});}return _0x5b4ef5;};exports[_0x3b62('0x13')]=function(_0x55f1f7,_0x1174ed,_0x45e222){var _0x445f12={};if(_0x1174ed===_0x3b62('0x14')){if(_0x45e222[_0x3b62('0x15')]==='$eq'){_0x45e222[_0x3b62('0x15')]=_0x3b62('0x16');_0x45e222[_0x3b62('0x17')]+=','+_0x45e222[_0x3b62('0x17')];}else if(_['includes']([_0x3b62('0x18'),'$lte'],_0x45e222[_0x3b62('0x15')])){_0x45e222[_0x3b62('0x17')]=moment(_0x45e222['value'])[_0x3b62('0x19')](0x1,_0x3b62('0x1a'))[_0x3b62('0x1b')](_0x3b62('0x1c'));}}if(_0x45e222[_0x3b62('0x1d')]){_0x1174ed=_0x45e222[_0x3b62('0x1d')];_0x445f12['text']=_0x3b62('0x1e')+_0x55f1f7+'.'+_0x45e222['field']+_0x3b62('0x1f')+_0x45e222[_0x3b62('0x1d')]+')\x20'+parseOperator(_0x45e222[_0x3b62('0x15')]);}else{_0x445f12[_0x3b62('0x20')]=_0x55f1f7+'.'+_0x45e222['field']+'\x20'+parseOperator(_0x45e222['operator']);}if(_[_0x3b62('0x21')]([_0x3b62('0x22'),_0x3b62('0x23')],_0x45e222[_0x3b62('0x15')]))_0x445f12[_0x3b62('0x20')]='('+_0x445f12[_0x3b62('0x20')]+'\x20OR\x20'+_0x55f1f7+'.'+_0x45e222[_0x3b62('0x24')]+_0x3b62('0x25');_0x445f12[_0x3b62('0x17')]=parseValue(_0x1174ed,_0x45e222['operator'],_0x45e222['value']);return _0x445f12;};function parseOperator(_0x24e9c6){var _0x67ad4b;switch(_0x24e9c6){case'$in':_0x67ad4b='IN\x20?';break;case _0x3b62('0x23'):_0x67ad4b=_0x3b62('0x26');break;case _0x3b62('0x27'):_0x67ad4b=_0x3b62('0x28');break;case'$ne':_0x67ad4b=_0x3b62('0x29');break;case _0x3b62('0x2a'):case _0x3b62('0x2b'):case'$endsWith':_0x67ad4b=_0x3b62('0x2c');break;case _0x3b62('0x2d'):_0x67ad4b='<\x20?';break;case _0x3b62('0x18'):_0x67ad4b='>\x20?';break;case _0x3b62('0x2e'):_0x67ad4b=_0x3b62('0x2f');break;case _0x3b62('0x30'):_0x67ad4b=_0x3b62('0x31');break;case'$between':_0x67ad4b=_0x3b62('0x32');break;}return _0x67ad4b;}function parseValue(_0x3123fc,_0x13e02c,_0x20f2f8){var _0x50bfbc={'start':undefined,'end':undefined};switch(_0x13e02c){case _0x3b62('0x33'):case _0x3b62('0x23'):_0x50bfbc[_0x3b62('0x34')]=_0x20f2f8[_0x3b62('0x9')](',');break;case _0x3b62('0x2a'):_0x50bfbc['start']='%'+_0x20f2f8+'%';break;case _0x3b62('0x2b'):_0x50bfbc[_0x3b62('0x34')]=_0x20f2f8+'%';break;case _0x3b62('0x35'):_0x50bfbc[_0x3b62('0x34')]='%'+_0x20f2f8;break;case _0x3b62('0x16'):var _0x45c018=_0x20f2f8[_0x3b62('0x9')](',');var _0x20f2f8=_0x45c018['shift']();var _0x204ff8=_0x45c018[_0x3b62('0x36')]();if(_0x3123fc===_0x3b62('0x14')){_0x20f2f8=moment(_0x20f2f8)['utcOffset'](0x0,!![])[_0x3b62('0x1b')]();_0x204ff8=moment(_0x204ff8)[_0x3b62('0x37')](0x0,!![])[_0x3b62('0x19')](0x17,_0x3b62('0x38'))[_0x3b62('0x19')](0x3b,'minutes')[_0x3b62('0x19')](0x3b,_0x3b62('0x39'))['format']();}_0x50bfbc={'start':_0x20f2f8,'end':_0x204ff8};break;default:_0x50bfbc['start']=_0x20f2f8;break;}return _0x50bfbc;} \ No newline at end of file +var _0xaf17=['push','DATE','operator','$eq','$between','value','includes','$gt','add','text','CAST(','field','\x20AS\x20','castTo','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','=\x20?','<>\x20?','$substring','$startsWith','$endsWith','$lt','<\x20?','>\x20?','$lte','>=\x20?','start','pop','format','hours','minutes','seconds','lodash','moment','parseSearch','sqlOperator','startsWith','and','replace','[$and]','[$or]','split','forEach','shift','match','filter','map','conditions'];(function(_0x2e7a43,_0x3b3df4){var _0x52e9e1=function(_0x2c08cf){while(--_0x2c08cf){_0x2e7a43['push'](_0x2e7a43['shift']());}};_0x52e9e1(++_0x3b3df4);}(_0xaf17,0x8f));var _0x7af1=function(_0x77650a,_0x467483){_0x77650a=_0x77650a-0x0;var _0x53f0d3=_0xaf17[_0x77650a];return _0x53f0d3;};'use strict';var _=require(_0x7af1('0x0'));var moment=require(_0x7af1('0x1'));exports[_0x7af1('0x2')]=function(_0x36ed75){var _0x1d760c={'conditions':[]};_0x1d760c[_0x7af1('0x3')]=_[_0x7af1('0x4')](_0x36ed75,'[$or]')?'or':_0x7af1('0x5');var _0x1934c9=_0x36ed75[_0x7af1('0x6')](_0x7af1('0x7'),'')[_0x7af1('0x6')](_0x7af1('0x8'),'')[_0x7af1('0x9')]('||');for(var _0x108884=0x0;_0x108884<_0x1934c9['length'];_0x108884++){var _0x4ba1f1=_0x1934c9[_0x108884]['split'](':=');var _0x7a2992=_0x4ba1f1[0x0];var _0x39c138=_0x4ba1f1['slice'](0x1);_0x39c138[_0x7af1('0xa')](function(_0x48260c){var _0x3773d0=_0x48260c[_0x7af1('0x9')]('[')[_0x7af1('0xb')]();var _0x395189=_0x48260c[_0x7af1('0xc')](/\[(.*?)\]/g);_0x395189['forEach'](function(_0x30f774){var _0x30819d=_0x30f774[_0x7af1('0x9')]('[')[_0x7af1('0xd')](function(_0x26169e){return _0x26169e['indexOf'](']')>-0x1;})[_0x7af1('0xe')](function(_0x9ea70d){return _0x9ea70d[_0x7af1('0x9')](']')[0x0];})[0x0];_0x1d760c[_0x7af1('0xf')][_0x7af1('0x10')]({'field':_0x7a2992,'operator':_0x3773d0,'value':_0x30819d});});});}return _0x1d760c;};exports['buildExpression']=function(_0x438eaf,_0x58f0d9,_0x418037){var _0x46ac99={};if(_0x58f0d9===_0x7af1('0x11')){if(_0x418037[_0x7af1('0x12')]===_0x7af1('0x13')){_0x418037['operator']=_0x7af1('0x14');_0x418037['value']+=','+_0x418037[_0x7af1('0x15')];}else if(_[_0x7af1('0x16')]([_0x7af1('0x17'),'$lte'],_0x418037['operator'])){_0x418037['value']=moment(_0x418037[_0x7af1('0x15')])[_0x7af1('0x18')](0x1,'days')['format']('YYYY-MM-DD');}}if(_0x418037['castTo']){_0x58f0d9=_0x418037['castTo'];_0x46ac99[_0x7af1('0x19')]=_0x7af1('0x1a')+_0x438eaf+'.'+_0x418037[_0x7af1('0x1b')]+_0x7af1('0x1c')+_0x418037[_0x7af1('0x1d')]+')\x20'+parseOperator(_0x418037[_0x7af1('0x12')]);}else{_0x46ac99[_0x7af1('0x19')]=_0x438eaf+'.'+_0x418037[_0x7af1('0x1b')]+'\x20'+parseOperator(_0x418037['operator']);}if(_[_0x7af1('0x16')]([_0x7af1('0x1e'),_0x7af1('0x1f')],_0x418037[_0x7af1('0x12')]))_0x46ac99['text']='('+_0x46ac99[_0x7af1('0x19')]+_0x7af1('0x20')+_0x438eaf+'.'+_0x418037[_0x7af1('0x1b')]+_0x7af1('0x21');_0x46ac99[_0x7af1('0x15')]=parseValue(_0x58f0d9,_0x418037[_0x7af1('0x12')],_0x418037[_0x7af1('0x15')]);return _0x46ac99;};function parseOperator(_0x10af68){var _0xf276d3;switch(_0x10af68){case _0x7af1('0x22'):_0xf276d3=_0x7af1('0x23');break;case _0x7af1('0x1f'):_0xf276d3=_0x7af1('0x24');break;case _0x7af1('0x13'):_0xf276d3=_0x7af1('0x25');break;case'$ne':_0xf276d3=_0x7af1('0x26');break;case _0x7af1('0x27'):case _0x7af1('0x28'):case _0x7af1('0x29'):_0xf276d3='LIKE\x20?';break;case _0x7af1('0x2a'):_0xf276d3=_0x7af1('0x2b');break;case _0x7af1('0x17'):_0xf276d3=_0x7af1('0x2c');break;case _0x7af1('0x2d'):_0xf276d3='<=\x20?';break;case'$gte':_0xf276d3=_0x7af1('0x2e');break;case _0x7af1('0x14'):_0xf276d3='BETWEEN\x20?\x20AND\x20?';break;}return _0xf276d3;}function parseValue(_0x3cc84e,_0x53be27,_0xf05e11){var _0x596d82={'start':undefined,'end':undefined};switch(_0x53be27){case _0x7af1('0x22'):case _0x7af1('0x1f'):_0x596d82['start']=_0xf05e11[_0x7af1('0x9')](',');break;case _0x7af1('0x27'):_0x596d82[_0x7af1('0x2f')]='%'+_0xf05e11+'%';break;case'$startsWith':_0x596d82[_0x7af1('0x2f')]=_0xf05e11+'%';break;case _0x7af1('0x29'):_0x596d82[_0x7af1('0x2f')]='%'+_0xf05e11;break;case _0x7af1('0x14'):var _0xfef031=_0xf05e11[_0x7af1('0x9')](',');var _0xf05e11=_0xfef031[_0x7af1('0xb')]();var _0x5e967a=_0xfef031[_0x7af1('0x30')]();if(_0x3cc84e===_0x7af1('0x11')){_0xf05e11=moment(_0xf05e11)['utcOffset'](0x0,!![])[_0x7af1('0x31')]();_0x5e967a=moment(_0x5e967a)['utcOffset'](0x0,!![])[_0x7af1('0x18')](0x17,_0x7af1('0x32'))[_0x7af1('0x18')](0x3b,_0x7af1('0x33'))[_0x7af1('0x18')](0x3b,_0x7af1('0x34'))['format']();}_0x596d82={'start':_0xf05e11,'end':_0x5e967a};break;default:_0x596d82[_0x7af1('0x2f')]=_0xf05e11;break;}return _0x596d82;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index dc01c81..ada1451 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 _0xc6b9=['match','\x22{EXPR}\x22','replace','trim','forEach','push','query','$id','intersection','attributes','hasOwnProperty','nolimit','limit','order','sort','where','filters','filter','object','includes','columns','value','merge','VIRTUAL','lower','options','include','includeAll','escapeLIKESpecialChars','lodash','sequelize','keys','parse','model','alias','fields','raw','split','isEmpty','forOwn','find','type','DATE','isPlainObject','$gte','format','YYYY-MM-DD','utc','$lte','subtract','name','uniqueid','isArray','offset','map','cast','col','priority','unsigned','substr','DESC','omit','length','isObject','isString','unset'];(function(_0x39c2cc,_0x21d2f1){var _0x51e14b=function(_0x1c0820){while(--_0x1c0820){_0x39c2cc['push'](_0x39c2cc['shift']());}};_0x51e14b(++_0x21d2f1);}(_0xc6b9,0x167));var _0x9c6b=function(_0x1d87fc,_0x1e5321){_0x1d87fc=_0x1d87fc-0x0;var _0x492b56=_0xc6b9[_0x1d87fc];return _0x492b56;};'use strict';var _=require(_0x9c6b('0x0'));var sequelize=require(_0x9c6b('0x1'));var moment=require('moment');var db=require('../../mysqldb')['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x4fd05a){var _0x1e1c7f=['ne'];try{var _0x5833f9=JSON['parse'](_0x4fd05a);var _0x2c5bf6=Object[_0x9c6b('0x2')](_0x5833f9)[0x0];return _0x1e1c7f['includes'](_0x2c5bf6);}catch(_0x259ec1){return![];}}function getOperatorValue(_0x4ac523){var _0x1c463c=JSON['parse'](_0x4ac523);var _0x4287aa=Object[_0x9c6b('0x2')](_0x1c463c)[0x0];var _0x238bd9=_0x1c463c[_0x4287aa];return{['$'+_0x4287aa]:_0x238bd9};}function parseIncludeModel(_0x102968){var _0x32a65f=JSON[_0x9c6b('0x3')](_0x102968);return{'model':db[_0x32a65f[_0x9c6b('0x4')]],'as':_0x32a65f[_0x9c6b('0x5')],'attributes':_0x32a65f[_0x9c6b('0x6')],'raw':_0x32a65f[_0x9c6b('0x7')]};}exports[_0x9c6b('0x6')]=function(_0x10fa0b){var _0x1a8536=null;if(_0x10fa0b){_0x1a8536=_0x10fa0b[_0x9c6b('0x8')](',');}return _0x1a8536;};exports['filters']=function(_0x47e5c8,_0xa734d2){var _0x367701={};if(!_[_0x9c6b('0x9')](_0x47e5c8)){_[_0x9c6b('0xa')](_0x47e5c8,function(_0x1f5218,_0x2a6126){try{if(_0xa734d2){var _0x2ae238=_[_0x9c6b('0xb')](_0xa734d2,{'name':_0x2a6126})||{};if(hasSequelizeOperator(_0x1f5218)){_0x367701[_0x2a6126]=getOperatorValue(_0x1f5218);}else if(_0x2ae238[_0x9c6b('0xc')]===_0x9c6b('0xd')&&_[_0x9c6b('0xe')](_0x1f5218)){var _0x41c206=JSON[_0x9c6b('0x3')](_0x1f5218);var _0x57d8a3={'$gte':moment(moment(_0x41c206[_0x9c6b('0xf')])[_0x9c6b('0x10')](_0x9c6b('0x11')))[_0x9c6b('0x12')]()[_0x9c6b('0x10')](),'$lte':moment(moment(_0x41c206[_0x9c6b('0x13')])[_0x9c6b('0x10')](_0x9c6b('0x11')))[_0x9c6b('0x12')]()[_0x9c6b('0x14')](0x1,'s')[_0x9c6b('0x10')]()};_0x367701[_0x2a6126]=_0x57d8a3;}else if(_0x2ae238[_0x9c6b('0x15')]===_0x9c6b('0x16')){_0x367701[_0x2a6126]=_0x1f5218;}else{_0x367701[_0x2a6126]=_['isArray'](_0x1f5218)?_0x1f5218:JSON['parse'](_0x1f5218);}}else{_0x367701[_0x2a6126]=_[_0x9c6b('0x17')](_0x1f5218)?_0x1f5218:JSON[_0x9c6b('0x3')](_0x1f5218);}}catch(_0x34bd45){_0x367701[_0x2a6126]=_0x1f5218[_0x9c6b('0x8')](',');}});}return _0x367701;};exports['limit']=function(_0x5b522d){_0x5b522d=parseInt(_0x5b522d,0xa);if(!_0x5b522d||_0x5b522d<0x0){_0x5b522d=LIMIT_VALUE;}return _0x5b522d;};exports[_0x9c6b('0x18')]=function(_0x4a73de){_0x4a73de=parseInt(_0x4a73de,0xa);if(!_0x4a73de||_0x4a73de<0x0){_0x4a73de=0x0;}return _0x4a73de;};exports['sort']=function(_0x452a68){var _0x4d6b42,_0x51c463=null;if(_0x452a68){_0x4d6b42=_0x452a68[_0x9c6b('0x8')](',');_0x51c463=_[_0x9c6b('0x19')](_0x4d6b42,function(_0x1212f4){if(_0x1212f4['indexOf']('-')===0x0){return[_0x1212f4==='priority'?sequelize[_0x9c6b('0x1a')](sequelize[_0x9c6b('0x1b')](_0x9c6b('0x1c')),_0x9c6b('0x1d')):_0x1212f4[_0x9c6b('0x1e')](0x1),_0x9c6b('0x1f')];}else{return[_0x1212f4===_0x9c6b('0x1c')?sequelize[_0x9c6b('0x1a')](sequelize[_0x9c6b('0x1b')](_0x9c6b('0x1c')),'unsigned'):_0x1212f4,'ASC'];}});}return _0x51c463;};exports[_0x9c6b('0x20')]=function(_0x5ae8e7,_0x1ea7c4){if(_[_0x9c6b('0x9')](_0x5ae8e7)){return _0x5ae8e7;}if(_[_0x9c6b('0x17')](_0x5ae8e7)){for(var _0x78f45e=0x0;_0x78f45e<_0x5ae8e7[_0x9c6b('0x21')];_0x78f45e+=0x1){_0x5ae8e7[_0x78f45e]=this[_0x9c6b('0x20')](_0x5ae8e7[_0x78f45e],_0x1ea7c4);}return _0x5ae8e7;}if(!_[_0x9c6b('0x22')](_0x5ae8e7)){return _0x5ae8e7;}if(_[_0x9c6b('0x23')](_0x1ea7c4)){_0x1ea7c4=[_0x1ea7c4];}if(!_[_0x9c6b('0x17')](_0x1ea7c4)){return _0x5ae8e7;}for(var _0x3831d1=0x0;_0x3831d1<_0x1ea7c4[_0x9c6b('0x21')];_0x3831d1+=0x1){_[_0x9c6b('0x24')](_0x5ae8e7,_0x1ea7c4[_0x3831d1]);}for(var _0x21f447 in _0x5ae8e7){if(_0x5ae8e7['hasOwnProperty'](_0x21f447)){_0x5ae8e7[_0x21f447]=this[_0x9c6b('0x20')](_0x5ae8e7[_0x21f447],_0x1ea7c4);}}return _0x5ae8e7;};exports['isNumeric']=function(_0x4b15a2){return _0x4b15a2[_0x9c6b('0x25')](RegExp('^[+]?[0-9]*$'))?!![]:![];};exports['isEmail']=function(_0xac80b2){return _0xac80b2[_0x9c6b('0x25')](/^\S+@\S+$/)?!![]:![];};exports['getFullTextValue']=function(_0x3df8a2,_0x493ddf){var _0x18a203=[];var _0x8643bc=/([^:]")"+/g;var _0x4743c6=/[*<>~@-]/g;var _0x48e19b=/[ `!@#$%^&*()_\-?~<>]/;var _0x127e74=/[ ,]+/;var _0x12dc16=_0x493ddf?_0x9c6b('0x26'):'{EXPR}';if(_0x493ddf){_0x3df8a2=_0x3df8a2[_0x9c6b('0x27')](_0x4743c6,'\x20')[_0x9c6b('0x28')]();}_0x3df8a2[_0x9c6b('0x8')](_0x127e74)[_0x9c6b('0x29')](function(_0x20ecb2){_0x20ecb2=_0x20ecb2['replace'](_0x8643bc,'$1');_0x20ecb2='+'+_0x20ecb2+'*';var _0x55c16e=_0x20ecb2[_0x9c6b('0x25')](_0x48e19b);if(_0x55c16e){_0x20ecb2='\x22'+_0x20ecb2+'\x22';}_0x18a203[_0x9c6b('0x2a')](_0x20ecb2);});_0x12dc16=_0x12dc16['replace']('{EXPR}',_0x18a203['join']('\x20'));return _0x12dc16;};exports['getOptions']=function(_0x413ac6,_0x26f428,_0x3de6b4){var _0x280683={},_0x468801={};if(_0x26f428[_0x9c6b('0x2b')][_0x9c6b('0x2c')]){_0x26f428[_0x9c6b('0x2b')]['id']=_0x26f428[_0x9c6b('0x2b')][_0x9c6b('0x2c')];delete _0x26f428[_0x9c6b('0x2b')][_0x9c6b('0x2c')];}_0x280683[_0x9c6b('0x4')]=_[_0x9c6b('0x19')](_0x413ac6,_0x9c6b('0x15'));_0x280683[_0x9c6b('0x2b')]=_['keys'](_0x26f428[_0x9c6b('0x2b')]);_0x280683['filters']=_[_0x9c6b('0x2d')](_0x280683[_0x9c6b('0x4')],_0x280683[_0x9c6b('0x2b')]);_0x468801[_0x9c6b('0x2e')]=_[_0x9c6b('0x2d')](_0x280683[_0x9c6b('0x4')],this[_0x9c6b('0x6')](_0x26f428['query']['fields']));_0x468801['attributes']=_0x468801[_0x9c6b('0x2e')]['length']?_0x468801[_0x9c6b('0x2e')]:_0x280683[_0x9c6b('0x4')];if(!_0x26f428[_0x9c6b('0x2b')][_0x9c6b('0x2f')](_0x9c6b('0x30'))){_0x468801[_0x9c6b('0x31')]=this[_0x9c6b('0x31')](_0x26f428[_0x9c6b('0x2b')][_0x9c6b('0x31')]);_0x468801['offset']=this[_0x9c6b('0x18')](_0x26f428[_0x9c6b('0x2b')][_0x9c6b('0x18')]);}_0x468801[_0x9c6b('0x32')]=this[_0x9c6b('0x33')](_0x26f428[_0x9c6b('0x2b')][_0x9c6b('0x33')]);_0x468801[_0x9c6b('0x34')]=this['filters'](_['pick'](_0x26f428[_0x9c6b('0x2b')],_0x280683[_0x9c6b('0x35')]),_0x413ac6);if(_0x26f428[_0x9c6b('0x2b')][_0x9c6b('0x36')]){var _0x528ba2=_0x413ac6;var _0x5082a4=_0x26f428[_0x9c6b('0x2b')][_0x9c6b('0x36')];if(typeof _0x5082a4===_0x9c6b('0x37')){_0x528ba2=_[_0x9c6b('0x36')](_0x413ac6,function(_0x498fdc){return _[_0x9c6b('0x38')](_0x5082a4[_0x9c6b('0x39')],_0x498fdc[_0x9c6b('0x15')]);});_0x5082a4=_0x5082a4[_0x9c6b('0x3a')];}_0x468801[_0x9c6b('0x34')]=_[_0x9c6b('0x3b')](_0x468801[_0x9c6b('0x34')],{'$or':_['map'](_0x528ba2,function(_0x32acd0){if(_0x32acd0[_0x9c6b('0xc')]!==_0x9c6b('0x3c')){if(_0x3de6b4){return sequelize[_0x9c6b('0x34')](sequelize['fn'](_0x9c6b('0x3d'),sequelize[_0x9c6b('0x1b')](_0x32acd0[_0x9c6b('0x15')])),{'$like':sequelize['fn'](_0x9c6b('0x3d'),'%'+_0x26f428[_0x9c6b('0x2b')]['filter']+'%')});}else{var _0x4707be={};_0x4707be[_0x32acd0['name']]={'$like':'%'+_0x26f428['query']['filter']+'%'};return _0x4707be;}}})});}_0x468801=_[_0x9c6b('0x3b')]({},_0x468801,_0x26f428[_0x9c6b('0x3e')]);return _0x468801;};exports[_0x9c6b('0x3f')]=function(_0xe9d9){var _0x4ee127=[];if(_0xe9d9[_0x9c6b('0x40')]){_0x4ee127[_0x9c6b('0x2a')]({'all':!![]});}else if(_0xe9d9['include']){if(Array['isArray'](_0xe9d9[_0x9c6b('0x3f')])){_0x4ee127=Object[_0x9c6b('0x2')](_0xe9d9[_0x9c6b('0x3f')])[_0x9c6b('0x19')](function(_0x40bbf1){return parseIncludeModel(_0xe9d9['include'][_0x40bbf1]);});}else{var _0x491604=parseIncludeModel(_0xe9d9['include']);_0x4ee127[_0x9c6b('0x2a')](_0x491604);}}return _0x4ee127;};exports[_0x9c6b('0x41')]=function(_0x469b46){return _0x469b46[_0x9c6b('0x27')](/[%_^-]/g,function(_0x3fd62a){return'\x5c'+_0x3fd62a;});}; \ No newline at end of file +var _0xbc09=['alias','fields','raw','split','filters','isEmpty','forOwn','type','DATE','isPlainObject','format','YYYY-MM-DD','utc','$lte','subtract','name','uniqueid','isArray','limit','offset','sort','priority','cast','col','DESC','unsigned','ASC','omit','length','isObject','unset','hasOwnProperty','match','^[+]?[0-9]*$','getFullTextValue','{EXPR}','replace','trim','forEach','push','join','getOptions','$id','query','map','intersection','attributes','nolimit','where','pick','filter','object','columns','merge','VIRTUAL','lower','options','include','includeAll','lodash','sequelize','moment','../../mysqldb','parse','keys','model'];(function(_0x19a2e7,_0x5c8201){var _0x489671=function(_0x3223ec){while(--_0x3223ec){_0x19a2e7['push'](_0x19a2e7['shift']());}};_0x489671(++_0x5c8201);}(_0xbc09,0x1c7));var _0x9bc0=function(_0x25eaef,_0x4da8d1){_0x25eaef=_0x25eaef-0x0;var _0x48a079=_0xbc09[_0x25eaef];return _0x48a079;};'use strict';var _=require(_0x9bc0('0x0'));var sequelize=require(_0x9bc0('0x1'));var moment=require(_0x9bc0('0x2'));var db=require(_0x9bc0('0x3'))['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x5dd39d){var _0x1ace67=['ne'];try{var _0x5db5fa=JSON[_0x9bc0('0x4')](_0x5dd39d);var _0x12178e=Object[_0x9bc0('0x5')](_0x5db5fa)[0x0];return _0x1ace67['includes'](_0x12178e);}catch(_0x2c3dad){return![];}}function getOperatorValue(_0x3716bf){var _0x4825ca=JSON[_0x9bc0('0x4')](_0x3716bf);var _0x5c2af2=Object[_0x9bc0('0x5')](_0x4825ca)[0x0];var _0x1dfc97=_0x4825ca[_0x5c2af2];return{['$'+_0x5c2af2]:_0x1dfc97};}function parseIncludeModel(_0x4e4599){var _0x4cc5f1=JSON[_0x9bc0('0x4')](_0x4e4599);return{'model':db[_0x4cc5f1[_0x9bc0('0x6')]],'as':_0x4cc5f1[_0x9bc0('0x7')],'attributes':_0x4cc5f1[_0x9bc0('0x8')],'raw':_0x4cc5f1[_0x9bc0('0x9')]};}exports[_0x9bc0('0x8')]=function(_0x2be53e){var _0x14524a=null;if(_0x2be53e){_0x14524a=_0x2be53e[_0x9bc0('0xa')](',');}return _0x14524a;};exports[_0x9bc0('0xb')]=function(_0x5e70c5,_0x28d0fa){var _0x46f7d6={};if(!_[_0x9bc0('0xc')](_0x5e70c5)){_[_0x9bc0('0xd')](_0x5e70c5,function(_0x22996a,_0x11a739){try{if(_0x28d0fa){var _0x22c08f=_['find'](_0x28d0fa,{'name':_0x11a739})||{};if(hasSequelizeOperator(_0x22996a)){_0x46f7d6[_0x11a739]=getOperatorValue(_0x22996a);}else if(_0x22c08f[_0x9bc0('0xe')]===_0x9bc0('0xf')&&_[_0x9bc0('0x10')](_0x22996a)){var _0x54e856=JSON[_0x9bc0('0x4')](_0x22996a);var _0x25dfdc={'$gte':moment(moment(_0x54e856['$gte'])[_0x9bc0('0x11')](_0x9bc0('0x12')))[_0x9bc0('0x13')]()['format'](),'$lte':moment(moment(_0x54e856[_0x9bc0('0x14')])['format'](_0x9bc0('0x12')))[_0x9bc0('0x13')]()[_0x9bc0('0x15')](0x1,'s')[_0x9bc0('0x11')]()};_0x46f7d6[_0x11a739]=_0x25dfdc;}else if(_0x22c08f[_0x9bc0('0x16')]===_0x9bc0('0x17')){_0x46f7d6[_0x11a739]=_0x22996a;}else{_0x46f7d6[_0x11a739]=_['isArray'](_0x22996a)?_0x22996a:JSON[_0x9bc0('0x4')](_0x22996a);}}else{_0x46f7d6[_0x11a739]=_[_0x9bc0('0x18')](_0x22996a)?_0x22996a:JSON[_0x9bc0('0x4')](_0x22996a);}}catch(_0x598308){_0x46f7d6[_0x11a739]=_0x22996a[_0x9bc0('0xa')](',');}});}return _0x46f7d6;};exports[_0x9bc0('0x19')]=function(_0x3972a5){_0x3972a5=parseInt(_0x3972a5,0xa);if(!_0x3972a5||_0x3972a5<0x0){_0x3972a5=LIMIT_VALUE;}return _0x3972a5;};exports[_0x9bc0('0x1a')]=function(_0x1ebbf3){_0x1ebbf3=parseInt(_0x1ebbf3,0xa);if(!_0x1ebbf3||_0x1ebbf3<0x0){_0x1ebbf3=0x0;}return _0x1ebbf3;};exports[_0x9bc0('0x1b')]=function(_0x4bc65a){var _0x14cd57,_0x451a03=null;if(_0x4bc65a){_0x14cd57=_0x4bc65a['split'](',');_0x451a03=_['map'](_0x14cd57,function(_0x54ade6){if(_0x54ade6['indexOf']('-')===0x0){return[_0x54ade6===_0x9bc0('0x1c')?sequelize[_0x9bc0('0x1d')](sequelize[_0x9bc0('0x1e')](_0x9bc0('0x1c')),'unsigned'):_0x54ade6['substr'](0x1),_0x9bc0('0x1f')];}else{return[_0x54ade6===_0x9bc0('0x1c')?sequelize['cast'](sequelize[_0x9bc0('0x1e')]('priority'),_0x9bc0('0x20')):_0x54ade6,_0x9bc0('0x21')];}});}return _0x451a03;};exports[_0x9bc0('0x22')]=function(_0x307d4a,_0x463206){if(_[_0x9bc0('0xc')](_0x307d4a)){return _0x307d4a;}if(_['isArray'](_0x307d4a)){for(var _0x237f80=0x0;_0x237f80<_0x307d4a[_0x9bc0('0x23')];_0x237f80+=0x1){_0x307d4a[_0x237f80]=this[_0x9bc0('0x22')](_0x307d4a[_0x237f80],_0x463206);}return _0x307d4a;}if(!_[_0x9bc0('0x24')](_0x307d4a)){return _0x307d4a;}if(_['isString'](_0x463206)){_0x463206=[_0x463206];}if(!_[_0x9bc0('0x18')](_0x463206)){return _0x307d4a;}for(var _0x289e97=0x0;_0x289e97<_0x463206[_0x9bc0('0x23')];_0x289e97+=0x1){_[_0x9bc0('0x25')](_0x307d4a,_0x463206[_0x289e97]);}for(var _0x2df456 in _0x307d4a){if(_0x307d4a[_0x9bc0('0x26')](_0x2df456)){_0x307d4a[_0x2df456]=this[_0x9bc0('0x22')](_0x307d4a[_0x2df456],_0x463206);}}return _0x307d4a;};exports['isNumeric']=function(_0x4bfe0c){return _0x4bfe0c[_0x9bc0('0x27')](RegExp(_0x9bc0('0x28')))?!![]:![];};exports['isEmail']=function(_0x116ff2){return _0x116ff2['match'](/^\S+@\S+$/)?!![]:![];};exports[_0x9bc0('0x29')]=function(_0x5120c9,_0x5c2d28){var _0x2327f2=[];var _0x52c906=/([^:]")"+/g;var _0x3ed29a=/[*<>~@-]/g;var _0x2bae61=/[ `!@#$%^&*()_\-?~<>]/;var _0x5c69c4=/[ ,]+/;var _0xa86b4=_0x5c2d28?'\x22{EXPR}\x22':_0x9bc0('0x2a');if(_0x5c2d28){_0x5120c9=_0x5120c9[_0x9bc0('0x2b')](_0x3ed29a,'\x20')[_0x9bc0('0x2c')]();}_0x5120c9[_0x9bc0('0xa')](_0x5c69c4)[_0x9bc0('0x2d')](function(_0x4d0a4b){_0x4d0a4b=_0x4d0a4b['replace'](_0x52c906,'$1');_0x4d0a4b='+'+_0x4d0a4b+'*';var _0x103090=_0x4d0a4b['match'](_0x2bae61);if(_0x103090){_0x4d0a4b='\x22'+_0x4d0a4b+'\x22';}_0x2327f2[_0x9bc0('0x2e')](_0x4d0a4b);});_0xa86b4=_0xa86b4[_0x9bc0('0x2b')](_0x9bc0('0x2a'),_0x2327f2[_0x9bc0('0x2f')]('\x20'));return _0xa86b4;};exports[_0x9bc0('0x30')]=function(_0x1bad90,_0x3257b0,_0x54d2a3){var _0x3cb8b9={},_0x167add={};if(_0x3257b0['query'][_0x9bc0('0x31')]){_0x3257b0[_0x9bc0('0x32')]['id']=_0x3257b0[_0x9bc0('0x32')][_0x9bc0('0x31')];delete _0x3257b0['query'][_0x9bc0('0x31')];}_0x3cb8b9[_0x9bc0('0x6')]=_[_0x9bc0('0x33')](_0x1bad90,_0x9bc0('0x16'));_0x3cb8b9[_0x9bc0('0x32')]=_[_0x9bc0('0x5')](_0x3257b0[_0x9bc0('0x32')]);_0x3cb8b9['filters']=_[_0x9bc0('0x34')](_0x3cb8b9['model'],_0x3cb8b9[_0x9bc0('0x32')]);_0x167add[_0x9bc0('0x35')]=_['intersection'](_0x3cb8b9[_0x9bc0('0x6')],this[_0x9bc0('0x8')](_0x3257b0[_0x9bc0('0x32')]['fields']));_0x167add['attributes']=_0x167add[_0x9bc0('0x35')][_0x9bc0('0x23')]?_0x167add['attributes']:_0x3cb8b9[_0x9bc0('0x6')];if(!_0x3257b0[_0x9bc0('0x32')][_0x9bc0('0x26')](_0x9bc0('0x36'))){_0x167add[_0x9bc0('0x19')]=this['limit'](_0x3257b0['query'][_0x9bc0('0x19')]);_0x167add['offset']=this[_0x9bc0('0x1a')](_0x3257b0['query'][_0x9bc0('0x1a')]);}_0x167add['order']=this[_0x9bc0('0x1b')](_0x3257b0[_0x9bc0('0x32')][_0x9bc0('0x1b')]);_0x167add[_0x9bc0('0x37')]=this['filters'](_[_0x9bc0('0x38')](_0x3257b0[_0x9bc0('0x32')],_0x3cb8b9[_0x9bc0('0xb')]),_0x1bad90);if(_0x3257b0['query'][_0x9bc0('0x39')]){var _0x1063a1=_0x1bad90;var _0x4d0981=_0x3257b0[_0x9bc0('0x32')][_0x9bc0('0x39')];if(typeof _0x4d0981===_0x9bc0('0x3a')){_0x1063a1=_[_0x9bc0('0x39')](_0x1bad90,function(_0x19f539){return _['includes'](_0x4d0981[_0x9bc0('0x3b')],_0x19f539[_0x9bc0('0x16')]);});_0x4d0981=_0x4d0981['value'];}_0x167add[_0x9bc0('0x37')]=_[_0x9bc0('0x3c')](_0x167add['where'],{'$or':_[_0x9bc0('0x33')](_0x1063a1,function(_0x233796){if(_0x233796[_0x9bc0('0xe')]!==_0x9bc0('0x3d')){if(_0x54d2a3){return sequelize[_0x9bc0('0x37')](sequelize['fn'](_0x9bc0('0x3e'),sequelize[_0x9bc0('0x1e')](_0x233796[_0x9bc0('0x16')])),{'$like':sequelize['fn'](_0x9bc0('0x3e'),'%'+_0x3257b0[_0x9bc0('0x32')][_0x9bc0('0x39')]+'%')});}else{var _0x6fe148={};_0x6fe148[_0x233796['name']]={'$like':'%'+_0x3257b0[_0x9bc0('0x32')][_0x9bc0('0x39')]+'%'};return _0x6fe148;}}})});}_0x167add=_[_0x9bc0('0x3c')]({},_0x167add,_0x3257b0[_0x9bc0('0x3f')]);return _0x167add;};exports[_0x9bc0('0x40')]=function(_0x5c9e85){var _0x53a952=[];if(_0x5c9e85[_0x9bc0('0x41')]){_0x53a952[_0x9bc0('0x2e')]({'all':!![]});}else if(_0x5c9e85[_0x9bc0('0x40')]){if(Array[_0x9bc0('0x18')](_0x5c9e85[_0x9bc0('0x40')])){_0x53a952=Object[_0x9bc0('0x5')](_0x5c9e85[_0x9bc0('0x40')])[_0x9bc0('0x33')](function(_0x33ed13){return parseIncludeModel(_0x5c9e85[_0x9bc0('0x40')][_0x33ed13]);});}else{var _0x7ff024=parseIncludeModel(_0x5c9e85[_0x9bc0('0x40')]);_0x53a952[_0x9bc0('0x2e')](_0x7ff024);}}return _0x53a952;};exports['escapeLIKESpecialChars']=function(_0x1cd737){return _0x1cd737[_0x9bc0('0x2b')](/[%_^-]/g,function(_0x2ccd68){return'\x5c'+_0x2ccd68;});}; \ No newline at end of file diff --git a/server/components/realtime/agents.js b/server/components/realtime/agents.js index c0ecf09..6735e53 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 _0x530f=['mailPause','whatsappPause','pauseType','find','split','fields','globalStatus','order','startsWith','DESC','ASC','getUpdatedSortOptions','internal','substring','indexOf','sort','toLowerCase','sortAgentsByStatus','userpic','online','lastLoginAt','lastPauseAt','address','chatCapacity','openchannelCapacity','mailCapacity','smsCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','chatStatusTime','openchannelStatusTime','mailStatusTime','whatsappStatusTime','faxStatusTime','voiceStatusTime','queue','destconnectedlinenum','screenrecording','phoneBarEnableAutomaticScreenRecording','omit','filterAgentAttributes','role','faxStatus','smsStatusTime','mailCurrentCapacity','jayson/promise','http','client','chatPause','faxPause','openchannelPause','smsPause','voicePause','every','filter','length','idle','unknown','unavailable','ringing','isNil','voiceStatus','pause','chatStatus','mailStatus','openchannelStatus','smsStatus','whatsappStatus','request','Agents','then','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','catch','getRealtimeAgents','*pause','busy','isArray','startCase','Queue','map','findOne','getAgents','all','flatten','uniq','value','getAgentIdsByQueues','includes','getAgentIdsByStatus','resolve','User','findAll','name','fullname'];(function(_0x1dee62,_0x275e18){var _0x37c117=function(_0x3f7c8c){while(--_0x3f7c8c){_0x1dee62['push'](_0x1dee62['shift']());}};_0x37c117(++_0x275e18);}(_0x530f,0x167));var _0xf530=function(_0x32faa6,_0x231c1f){_0x32faa6=_0x32faa6-0x0;var _0x1526dd=_0x530f[_0x32faa6];return _0x1526dd;};'use strict';var _=require('lodash');var jayson=require(_0xf530('0x0'));var db=require('../../mysqldb')['db'];var amiClient=jayson['client'][_0xf530('0x1')]({'port':0x232a});var routingClient=jayson[_0xf530('0x2')][_0xf530('0x1')]({'port':0x232c});function isAgentPaused(_0x206a5d,_0x464b2e){var _0x2bacf8=[_0x206a5d[_0xf530('0x3')],_0x206a5d[_0xf530('0x4')],_0x206a5d['mailPause'],_0x206a5d[_0xf530('0x5')],_0x206a5d[_0xf530('0x6')],_0x206a5d[_0xf530('0x7')],_0x206a5d['whatsappPause']];if(!_0x464b2e)return _[_0xf530('0x8')](_0x2bacf8);var _0xf205be=_[_0xf530('0x9')](_0x2bacf8);return _0xf205be[_0xf530('0xa')]>0x0&&_0xf205be[_0xf530('0xa')]<_0x2bacf8[_0xf530('0xa')]?!![]:![];}function isIdle(_0x4b8336){return _0x4b8336===_0xf530('0xb')||_0x4b8336===_0xf530('0xc')||_0x4b8336===_0xf530('0xd')||_0x4b8336===_0xf530('0xe')||_[_0xf530('0xf')](_0x4b8336);}function isAgentIdle(_0x39912f){if(_0x39912f['voiceStatus']!=='idle'&&_0x39912f[_0xf530('0x7')]){_0x39912f[_0xf530('0x10')]=_0xf530('0x11');return![];}return _[_0xf530('0x8')]([_0x39912f[_0xf530('0x12')],_0x39912f['faxStatus'],_0x39912f[_0xf530('0x13')],_0x39912f[_0xf530('0x14')],_0x39912f[_0xf530('0x15')],_0x39912f[_0xf530('0x10')],_0x39912f[_0xf530('0x16')]],isIdle);}function getRealtimeAgents(){return amiClient[_0xf530('0x17')](_0xf530('0x18'),{})[_0xf530('0x19')](function(_0x4cbfc0){if(_0x4cbfc0[_0xf530('0x1a')]){throw new Error(_0xf530('0x1b'));}var _0x47e156=_0x4cbfc0[_0xf530('0x1c')];return routingClient[_0xf530('0x17')]('Agents',{})[_0xf530('0x19')](function(_0x255bb3){if(_0x255bb3[_0xf530('0x1a')]){throw new Error(_0xf530('0x1d'));}var _0x52c10f=_0x255bb3[_0xf530('0x1c')];return _[_0xf530('0x1e')]({},_0x47e156,_0x52c10f);});})[_0xf530('0x1f')](function(_0x384f92){throw _0x384f92;});}exports[_0xf530('0x20')]=getRealtimeAgents;function getAgentStatus(_0x3cb0f7){var _0x48f834=_0xf530('0xc');if(isAgentPaused(_0x3cb0f7))_0x48f834=_0xf530('0x11');else if(isAgentPaused(_0x3cb0f7,!![]))_0x48f834=_0xf530('0x21');else if(isAgentIdle(_0x3cb0f7))_0x48f834=_0xf530('0xb');else _0x48f834=_0xf530('0x22');return _0x48f834;}exports['getAgentStatus']=getAgentStatus;function getAgentIdsByQueues(_0x4dbbaf,_0x5679ce){var _0x4375af=_[_0xf530('0x23')](_0x4dbbaf)?_0x4dbbaf:[_0x4dbbaf];var _0x3e6b3b=_[_0xf530('0x24')](_0x5679ce)+_0xf530('0x25');var _0x4bb1b3=_[_0xf530('0x26')](_0x4375af,function(_0x1473b6){return db[_0x3e6b3b][_0xf530('0x27')]({'where':{'id':_0x1473b6}})[_0xf530('0x19')](function(_0x21b89d){if(!_0x21b89d)return[];return _0x21b89d[_0xf530('0x28')]({'attributes':['id'],'raw':!![]});});});return Promise[_0xf530('0x29')](_0x4bb1b3)[_0xf530('0x19')](function(_0x32f17a){var _0x1f3c88=_(_0x32f17a)[_0xf530('0x2a')]()['map']('id')[_0xf530('0x2b')]()[_0xf530('0x2c')]();return _0x1f3c88;});}exports[_0xf530('0x2d')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x58a41a,_0x21b792,_0x5b7837){try{if(_0x21b792['length']>0x0){_0x58a41a=_0x58a41a[_0xf530('0x9')](function(_0x3efab8){return _0x21b792[_0xf530('0x2e')](_0x3efab8['id']);});}var _0x5dea4d=_0x58a41a[_0xf530('0x9')](function(_0x3f3480){var _0x3170f7=_0xf530('0x22');if(isAgentIdle(_0x3f3480)){_0x3170f7=_0xf530('0xb');}return _0x3170f7===_0x5b7837;});return _[_0xf530('0x26')](_0x5dea4d,'id');}catch(_0x39b429){throw _0x39b429;}}exports[_0xf530('0x2f')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x26dece,_0x321fb7,_0x5572ba){return Promise[_0xf530('0x30')]()['then'](function(){if(_0x321fb7[_0xf530('0xa')]>0x0){_0x26dece=_0x26dece[_0xf530('0x9')](function(_0x4d60ad){return _0x321fb7['includes'](_0x4d60ad['id']);});}return _0x26dece;})['then'](function(){return db[_0xf530('0x31')][_0xf530('0x32')]({'attributes':['id',_0xf530('0x33'),_0xf530('0x34'),'chatPause','faxPause',_0xf530('0x35'),_0xf530('0x5'),_0xf530('0x6'),_0xf530('0x7'),_0xf530('0x36'),_0xf530('0x37')],'where':{'id':{'$in':_[_0xf530('0x26')](_0x26dece,'id')}},'raw':!![]});})['then'](function(_0x1cef3b){return _0x1cef3b[_0xf530('0x26')](function(_0x11292b){var _0x1375de=_[_0xf530('0x38')](_0x26dece,['id',_0x11292b['id']]);var _0x4b75af=filterAgentAttributes(_0x1375de);_[_0xf530('0x1e')](_0x11292b,_0x4b75af);_0x11292b['globalStatus']=getAgentStatus(_0x11292b);return _0x11292b;});})[_0xf530('0x19')](function(_0x53c95a){var _0xa3ce3f=sortAgentsByStatus(_0x53c95a,_0x5572ba);return _[_0xf530('0x26')](_0xa3ce3f,'id');})[_0xf530('0x1f')](function(_0x46fe51){throw _0x46fe51;});}exports['getSortedAgentsIdsByStatus']=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x44bd4d){var _0x4b77d9={'fields':[],'order':null};var _0x5b7bfc=_0x44bd4d[_0xf530('0x39')](',');_0x4b77d9[_0xf530('0x3a')]=_[_0xf530('0x9')](_0x5b7bfc,function(_0x43a308){if(!_0x43a308[_0xf530('0x2e')](_0xf530('0x3b'))){return!![];}_0x4b77d9[_0xf530('0x3c')]=_[_0xf530('0x3d')](_0x43a308,'-')?_0xf530('0x3e'):_0xf530('0x3f');return![];});return _0x4b77d9;}exports[_0xf530('0x40')]=getUpdatedSortOptions;function validateSortParameter(_0x2551f1){if(!_0x2551f1){_0x2551f1='fullname,internal';}if(_0x2551f1[_0xf530('0x2e')](_0xf530('0x34'))&&!_0x2551f1[_0xf530('0x2e')](_0xf530('0x41'))){var _0x20aefd=_0x2551f1[_0xf530('0x42')](0x0,_0x2551f1[_0xf530('0x43')]('fullname'));_0x2551f1+=','+_0x20aefd+'internal';}return _0x2551f1;}exports['validateSortParameter']=validateSortParameter;function sortAgentsByStatus(_0xe016,_0x1b4e94){var _0x3e1cda=_0xe016[_0xf530('0x44')](function(_0x1f202f,_0x4cb84f){if(_0x1f202f[_0xf530('0x3b')]===_0x4cb84f['globalStatus']){if(_0x1f202f[_0xf530('0x3b')]===_0xf530('0x11')){if(_0x1b4e94===_0xf530('0x3e')){return(_0x1f202f[_0xf530('0x37')]||'')<(_0x4cb84f[_0xf530('0x37')]||'')||_0x1f202f['fullname'][_0xf530('0x45')]()>_0x4cb84f[_0xf530('0x34')]['toLowerCase']()?0x1:-0x1;}else{return(_0x1f202f['pauseType']||'')<(_0x4cb84f[_0xf530('0x37')]||'')||_0x1f202f[_0xf530('0x34')]['toLowerCase']()>_0x4cb84f[_0xf530('0x34')]['toLowerCase']()?-0x1:0x1;}}else{if(_0x1b4e94===_0xf530('0x3e')){return _0x1f202f[_0xf530('0x34')][_0xf530('0x45')]()<_0x4cb84f['fullname']['toLowerCase']()?0x1:-0x1;}else{return _0x1f202f[_0xf530('0x34')]['toLowerCase']()<_0x4cb84f[_0xf530('0x34')]['toLowerCase']()?-0x1:0x1;}}}else{if(_0x1b4e94===_0xf530('0x3e')){return _0x1f202f[_0xf530('0x3b')]<_0x4cb84f['globalStatus']?0x1:-0x1;}else{return _0x1f202f['globalStatus']<_0x4cb84f['globalStatus']?-0x1:0x1;}}});return _0x3e1cda;}exports[_0xf530('0x46')]=sortAgentsByStatus;function filterAgentAttributes(_0x56063f){var _0x3948e0=[_0xf530('0x47'),_0xf530('0x48'),_0xf530('0x49'),_0xf530('0x4a'),_0xf530('0x37'),_0xf530('0x4a'),_0xf530('0x41'),_0xf530('0x4b'),_0xf530('0x3'),_0xf530('0x5'),_0xf530('0x35'),_0xf530('0x6'),_0xf530('0x36'),_0xf530('0x4'),_0xf530('0x7'),_0xf530('0x4c'),_0xf530('0x4d'),_0xf530('0x4e'),_0xf530('0x4f'),_0xf530('0x50'),_0xf530('0x51'),_0xf530('0x52'),_0xf530('0x53'),'mailCurrentCapacity',_0xf530('0x54'),_0xf530('0x55'),_0xf530('0x56'),_0xf530('0x12'),_0xf530('0x14'),'mailStatus',_0xf530('0x15'),_0xf530('0x16'),'faxStatus',_0xf530('0x10'),_0xf530('0x57'),_0xf530('0x58'),_0xf530('0x59'),'smsStatusTime',_0xf530('0x5a'),_0xf530('0x5b'),_0xf530('0x5c'),_0xf530('0x5d'),_0xf530('0x5e'),_0xf530('0x5f'),'phoneBarEnableScreenRecordingByAgent',_0xf530('0x60')];var _0x769171=[_0xf530('0x3'),_0xf530('0x5'),'mailPause',_0xf530('0x6'),'whatsappPause',_0xf530('0x4'),_0xf530('0x7'),_0xf530('0x48')];var _0x497e3b=_(_0x56063f)[_0xf530('0x61')](_0x769171)['pick'](_0x3948e0)[_0xf530('0x2c')]();return _0x497e3b;}exports[_0xf530('0x62')]=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id',_0xf530('0x33'),_0xf530('0x34'),_0xf530('0x63'),'internal','online','globalStatus',_0xf530('0x47'),_0xf530('0x49'),_0xf530('0x37'),_0xf530('0x4a'),_0xf530('0x4'),'chatPause','mailPause',_0xf530('0x5'),'smsPause',_0xf530('0x7'),_0xf530('0x36'),_0xf530('0x12'),_0xf530('0x64'),'mailStatus',_0xf530('0x14'),_0xf530('0x15'),'voiceStatus',_0xf530('0x16'),_0xf530('0x57'),_0xf530('0x5b'),_0xf530('0x59'),_0xf530('0x58'),_0xf530('0x65'),_0xf530('0x5c'),'whatsappStatusTime','chatCapacity',_0xf530('0x51'),'mailCapacity',_0xf530('0x4d'),_0xf530('0x4f'),_0xf530('0x50'),_0xf530('0x52'),_0xf530('0x56'),_0xf530('0x66'),_0xf530('0x53'),_0xf530('0x54'),_0xf530('0x55'),'phoneBarEnableScreenRecordingByAgent',_0xf530('0x60'),_0xf530('0x5e'),'onhold',_0xf530('0x5d'),_0xf530('0x5f')];}exports['getRealtimeAgentsQueryFields']=getRealtimeAgentsQueryFields; \ No newline at end of file +var _0x315f=['Agents','then','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','request','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','catch','getRealtimeAgents','busy','getAgentStatus','isArray','map','findOne','getAgents','all','flatten','uniq','value','getAgentIdsByQueues','filter','includes','getAgentIdsByStatus','resolve','User','findAll','name','fullname','faxPause','pauseType','globalStatus','getSortedAgentsIdsByStatus','fields','order','startsWith','DESC','getUpdatedSortOptions','internal','validateSortParameter','sort','toLowerCase','sortAgentsByStatus','lastLoginAt','lastPauseAt','address','chatCapacity','mailCapacity','smsCapacity','faxCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','mailStatus','voiceStatus','chatStatusTime','openchannelStatusTime','mailStatusTime','faxStatusTime','voiceStatusTime','queue','destconnectedlinenum','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','online','omit','pick','filterAgentAttributes','role','whatsappStatusTime','openchannelCapacity','whatsappCapacity','chatCurrentCapacity','onhold','screenrecording','getRealtimeAgentsQueryFields','lodash','../../mysqldb','client','chatPause','mailPause','openchannelPause','smsPause','voicePause','whatsappPause','every','length','idle','unknown','unavailable','pause','chatStatus','faxStatus','openchannelStatus','smsStatus','whatsappStatus'];(function(_0xb85af0,_0x2d529d){var _0x3e3cd6=function(_0x1d23f1){while(--_0x1d23f1){_0xb85af0['push'](_0xb85af0['shift']());}};_0x3e3cd6(++_0x2d529d);}(_0x315f,0x174));var _0xf315=function(_0x4147ff,_0x154530){_0x4147ff=_0x4147ff-0x0;var _0x1e71e6=_0x315f[_0x4147ff];return _0x1e71e6;};'use strict';var _=require(_0xf315('0x0'));var jayson=require('jayson/promise');var db=require(_0xf315('0x1'))['db'];var amiClient=jayson['client']['http']({'port':0x232a});var routingClient=jayson[_0xf315('0x2')]['http']({'port':0x232c});function isAgentPaused(_0x4f81c4,_0x513bcd){var _0x571ae5=[_0x4f81c4[_0xf315('0x3')],_0x4f81c4['faxPause'],_0x4f81c4[_0xf315('0x4')],_0x4f81c4[_0xf315('0x5')],_0x4f81c4[_0xf315('0x6')],_0x4f81c4[_0xf315('0x7')],_0x4f81c4[_0xf315('0x8')]];if(!_0x513bcd)return _[_0xf315('0x9')](_0x571ae5);var _0x48679b=_['filter'](_0x571ae5);return _0x48679b[_0xf315('0xa')]>0x0&&_0x48679b['length']<_0x571ae5[_0xf315('0xa')]?!![]:![];}function isIdle(_0x150ba0){return _0x150ba0===_0xf315('0xb')||_0x150ba0===_0xf315('0xc')||_0x150ba0===_0xf315('0xd')||_0x150ba0==='ringing'||_['isNil'](_0x150ba0);}function isAgentIdle(_0x42d26a){if(_0x42d26a['voiceStatus']!=='idle'&&_0x42d26a[_0xf315('0x7')]){_0x42d26a['voiceStatus']=_0xf315('0xe');return![];}return _[_0xf315('0x9')]([_0x42d26a[_0xf315('0xf')],_0x42d26a[_0xf315('0x10')],_0x42d26a['mailStatus'],_0x42d26a[_0xf315('0x11')],_0x42d26a[_0xf315('0x12')],_0x42d26a['voiceStatus'],_0x42d26a[_0xf315('0x13')]],isIdle);}function getRealtimeAgents(){return amiClient['request'](_0xf315('0x14'),{})[_0xf315('0x15')](function(_0x20a72c){if(_0x20a72c[_0xf315('0x16')]){throw new Error(_0xf315('0x17'));}var _0x3c2e05=_0x20a72c[_0xf315('0x18')];return routingClient[_0xf315('0x19')](_0xf315('0x14'),{})[_0xf315('0x15')](function(_0x3cc17b){if(_0x3cc17b[_0xf315('0x16')]){throw new Error(_0xf315('0x1a'));}var _0xb5fcb6=_0x3cc17b['result'];return _[_0xf315('0x1b')]({},_0x3c2e05,_0xb5fcb6);});})[_0xf315('0x1c')](function(_0x28d528){throw _0x28d528;});}exports[_0xf315('0x1d')]=getRealtimeAgents;function getAgentStatus(_0xb91236){var _0xf695e4=_0xf315('0xc');if(isAgentPaused(_0xb91236))_0xf695e4=_0xf315('0xe');else if(isAgentPaused(_0xb91236,!![]))_0xf695e4='*pause';else if(isAgentIdle(_0xb91236))_0xf695e4=_0xf315('0xb');else _0xf695e4=_0xf315('0x1e');return _0xf695e4;}exports[_0xf315('0x1f')]=getAgentStatus;function getAgentIdsByQueues(_0x1c9be5,_0x21dfad){var _0x56f6e3=_[_0xf315('0x20')](_0x1c9be5)?_0x1c9be5:[_0x1c9be5];var _0x5d1ac5=_['startCase'](_0x21dfad)+'Queue';var _0x25d707=_[_0xf315('0x21')](_0x56f6e3,function(_0x14021d){return db[_0x5d1ac5][_0xf315('0x22')]({'where':{'id':_0x14021d}})['then'](function(_0x5b6a9b){if(!_0x5b6a9b)return[];return _0x5b6a9b[_0xf315('0x23')]({'attributes':['id'],'raw':!![]});});});return Promise[_0xf315('0x24')](_0x25d707)['then'](function(_0x325a29){var _0x5bc57e=_(_0x325a29)[_0xf315('0x25')]()['map']('id')[_0xf315('0x26')]()[_0xf315('0x27')]();return _0x5bc57e;});}exports[_0xf315('0x28')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x22f7b8,_0x42d78d,_0x478cca){try{if(_0x42d78d['length']>0x0){_0x22f7b8=_0x22f7b8[_0xf315('0x29')](function(_0x2072db){return _0x42d78d[_0xf315('0x2a')](_0x2072db['id']);});}var _0x46ceb3=_0x22f7b8[_0xf315('0x29')](function(_0x1b3d72){var _0x2915c3=_0xf315('0x1e');if(isAgentIdle(_0x1b3d72)){_0x2915c3=_0xf315('0xb');}return _0x2915c3===_0x478cca;});return _['map'](_0x46ceb3,'id');}catch(_0x373c9e){throw _0x373c9e;}}exports[_0xf315('0x2b')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x41bfdc,_0x2c21cd,_0x3b3ef4){return Promise[_0xf315('0x2c')]()[_0xf315('0x15')](function(){if(_0x2c21cd[_0xf315('0xa')]>0x0){_0x41bfdc=_0x41bfdc['filter'](function(_0x2f0a1b){return _0x2c21cd['includes'](_0x2f0a1b['id']);});}return _0x41bfdc;})[_0xf315('0x15')](function(){return db[_0xf315('0x2d')][_0xf315('0x2e')]({'attributes':['id',_0xf315('0x2f'),_0xf315('0x30'),_0xf315('0x3'),_0xf315('0x31'),'mailPause',_0xf315('0x5'),_0xf315('0x6'),_0xf315('0x7'),'whatsappPause',_0xf315('0x32')],'where':{'id':{'$in':_[_0xf315('0x21')](_0x41bfdc,'id')}},'raw':!![]});})[_0xf315('0x15')](function(_0x357915){return _0x357915[_0xf315('0x21')](function(_0x34d592){var _0x4d1e17=_['find'](_0x41bfdc,['id',_0x34d592['id']]);var _0x202d97=filterAgentAttributes(_0x4d1e17);_['merge'](_0x34d592,_0x202d97);_0x34d592[_0xf315('0x33')]=getAgentStatus(_0x34d592);return _0x34d592;});})['then'](function(_0x5a49dd){var _0x199631=sortAgentsByStatus(_0x5a49dd,_0x3b3ef4);return _['map'](_0x199631,'id');})[_0xf315('0x1c')](function(_0x1a23c3){throw _0x1a23c3;});}exports[_0xf315('0x34')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x1c5e86){var _0x3b3ead={'fields':[],'order':null};var _0x192b76=_0x1c5e86['split'](',');_0x3b3ead[_0xf315('0x35')]=_[_0xf315('0x29')](_0x192b76,function(_0x423d92){if(!_0x423d92[_0xf315('0x2a')](_0xf315('0x33'))){return!![];}_0x3b3ead[_0xf315('0x36')]=_[_0xf315('0x37')](_0x423d92,'-')?_0xf315('0x38'):'ASC';return![];});return _0x3b3ead;}exports[_0xf315('0x39')]=getUpdatedSortOptions;function validateSortParameter(_0x176b99){if(!_0x176b99){_0x176b99='fullname,internal';}if(_0x176b99[_0xf315('0x2a')](_0xf315('0x30'))&&!_0x176b99[_0xf315('0x2a')](_0xf315('0x3a'))){var _0x383e00=_0x176b99['substring'](0x0,_0x176b99['indexOf'](_0xf315('0x30')));_0x176b99+=','+_0x383e00+_0xf315('0x3a');}return _0x176b99;}exports[_0xf315('0x3b')]=validateSortParameter;function sortAgentsByStatus(_0x36cdca,_0x246bc6){var _0x580632=_0x36cdca[_0xf315('0x3c')](function(_0x1f8008,_0x105b97){if(_0x1f8008['globalStatus']===_0x105b97[_0xf315('0x33')]){if(_0x1f8008[_0xf315('0x33')]===_0xf315('0xe')){if(_0x246bc6===_0xf315('0x38')){return(_0x1f8008[_0xf315('0x32')]||'')<(_0x105b97['pauseType']||'')||_0x1f8008[_0xf315('0x30')][_0xf315('0x3d')]()>_0x105b97['fullname']['toLowerCase']()?0x1:-0x1;}else{return(_0x1f8008[_0xf315('0x32')]||'')<(_0x105b97[_0xf315('0x32')]||'')||_0x1f8008['fullname'][_0xf315('0x3d')]()>_0x105b97[_0xf315('0x30')][_0xf315('0x3d')]()?-0x1:0x1;}}else{if(_0x246bc6==='DESC'){return _0x1f8008[_0xf315('0x30')][_0xf315('0x3d')]()<_0x105b97[_0xf315('0x30')][_0xf315('0x3d')]()?0x1:-0x1;}else{return _0x1f8008['fullname'][_0xf315('0x3d')]()<_0x105b97[_0xf315('0x30')]['toLowerCase']()?-0x1:0x1;}}}else{if(_0x246bc6==='DESC'){return _0x1f8008[_0xf315('0x33')]<_0x105b97[_0xf315('0x33')]?0x1:-0x1;}else{return _0x1f8008['globalStatus']<_0x105b97[_0xf315('0x33')]?-0x1:0x1;}}});return _0x580632;}exports[_0xf315('0x3e')]=sortAgentsByStatus;function filterAgentAttributes(_0x5f3414){var _0x184a1d=['userpic','online',_0xf315('0x3f'),'lastPauseAt',_0xf315('0x32'),_0xf315('0x40'),_0xf315('0x3a'),_0xf315('0x41'),'chatPause',_0xf315('0x5'),_0xf315('0x4'),_0xf315('0x6'),_0xf315('0x8'),_0xf315('0x31'),'voicePause',_0xf315('0x42'),'openchannelCapacity',_0xf315('0x43'),_0xf315('0x44'),'whatsappCapacity',_0xf315('0x45'),'chatCurrentCapacity',_0xf315('0x46'),_0xf315('0x47'),_0xf315('0x48'),_0xf315('0x49'),_0xf315('0x4a'),_0xf315('0xf'),_0xf315('0x11'),_0xf315('0x4b'),_0xf315('0x12'),_0xf315('0x13'),_0xf315('0x10'),_0xf315('0x4c'),_0xf315('0x4d'),_0xf315('0x4e'),_0xf315('0x4f'),'smsStatusTime','whatsappStatusTime',_0xf315('0x50'),_0xf315('0x51'),_0xf315('0x52'),_0xf315('0x53'),'screenrecording',_0xf315('0x54'),_0xf315('0x55')];var _0x165c71=[_0xf315('0x3'),'openchannelPause',_0xf315('0x4'),_0xf315('0x6'),_0xf315('0x8'),_0xf315('0x31'),'voicePause',_0xf315('0x56')];var _0x3cf6b2=_(_0x5f3414)[_0xf315('0x57')](_0x165c71)[_0xf315('0x58')](_0x184a1d)[_0xf315('0x27')]();return _0x3cf6b2;}exports[_0xf315('0x59')]=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id',_0xf315('0x2f'),_0xf315('0x30'),_0xf315('0x5a'),_0xf315('0x3a'),_0xf315('0x56'),_0xf315('0x33'),'userpic',_0xf315('0x3f'),_0xf315('0x32'),_0xf315('0x40'),_0xf315('0x31'),_0xf315('0x3'),_0xf315('0x4'),_0xf315('0x5'),_0xf315('0x6'),_0xf315('0x7'),_0xf315('0x8'),_0xf315('0xf'),_0xf315('0x10'),'mailStatus','openchannelStatus',_0xf315('0x12'),_0xf315('0x4c'),_0xf315('0x13'),_0xf315('0x4d'),'faxStatusTime',_0xf315('0x4f'),_0xf315('0x4e'),'smsStatusTime',_0xf315('0x51'),_0xf315('0x5b'),'chatCapacity',_0xf315('0x45'),_0xf315('0x43'),_0xf315('0x5c'),_0xf315('0x44'),_0xf315('0x5d'),_0xf315('0x5e'),_0xf315('0x4a'),_0xf315('0x47'),'openchannelCurrentCapacity',_0xf315('0x48'),_0xf315('0x49'),_0xf315('0x54'),_0xf315('0x55'),'destconnectedlinenum',_0xf315('0x5f'),_0xf315('0x52'),_0xf315('0x60')];}exports[_0xf315('0x61')]=getRealtimeAgentsQueryFields; \ No newline at end of file diff --git a/server/components/realtime/queues.js b/server/components/realtime/queues.js index 5e8dddd..5107227 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 _0xcf64=['initializeQueues','jayson/promise','util','client','http','available','loggedIn','paused','waiting','busy','inUse','invalid','onHold','ringInUse','talking','unavailable','unknown','pTalking','message','statusMessage','dialMethod','Trunk','startPredictive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgTalktime','voice','request','Queues','then','error','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','catch','getRealtimeQueues','inbound','concat','outbound','map','get','loggedInDb','find','merge'];(function(_0x58ced2,_0x189c6d){var _0x1f2617=function(_0x45f5b2){while(--_0x45f5b2){_0x58ced2['push'](_0x58ced2['shift']());}};_0x1f2617(++_0x189c6d);}(_0xcf64,0x1a1));var _0x4cf6=function(_0x11414f,_0x819df){_0x11414f=_0x11414f-0x0;var _0x43de3f=_0xcf64[_0x11414f];return _0x43de3f;};'use strict';var _=require('lodash');var jayson=require(_0x4cf6('0x0'));var util=require(_0x4cf6('0x1'));var amiClient=jayson[_0x4cf6('0x2')]['http']({'port':0x232a});var routingClient=jayson[_0x4cf6('0x2')][_0x4cf6('0x3')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0x4cf6('0x4'),_0x4cf6('0x5'),_0x4cf6('0x6'),_0x4cf6('0x7')];var VOICE_QUEUE_ATTRIBUTES=[_0x4cf6('0x8'),_0x4cf6('0x9'),_0x4cf6('0xa'),'loggedInDb','notInUse',_0x4cf6('0xb'),'ringing',_0x4cf6('0xc'),_0x4cf6('0xd'),_0x4cf6('0xe'),_0x4cf6('0xf')];var OUTBOUND_QUEUE_ATTRIBUTES=[_0x4cf6('0x10'),'originated',_0x4cf6('0x11'),_0x4cf6('0x12'),'dialActive',_0x4cf6('0x13'),_0x4cf6('0x14'),_0x4cf6('0x15'),'startProgressive',_0x4cf6('0x16'),_0x4cf6('0x17'),_0x4cf6('0x18'),_0x4cf6('0x19'),_0x4cf6('0x1a'),'dialPredictiveIntervalMaxThreshold',_0x4cf6('0x1b'),_0x4cf6('0x1c'),_0x4cf6('0x1d'),_0x4cf6('0x1e'),'predictiveIntervalDroppedCallsTimeout',_0x4cf6('0x1f'),'predictiveIntervalAvgHoldtime',_0x4cf6('0x20')];function getRealtimeQueues(_0x4ee7ea,_0x8e630f){var _0x51e2e6=_0x8e630f===_0x4cf6('0x21')?amiClient:routingClient;return _0x51e2e6[_0x4cf6('0x22')](_['startCase'](_0x8e630f)+_0x4cf6('0x23'),_0x4ee7ea)[_0x4cf6('0x24')](function(_0x36185a){if(_0x36185a[_0x4cf6('0x25')])throw new Error(util[_0x4cf6('0x26')](_0x4cf6('0x27'),_0x8e630f));return _0x36185a[_0x4cf6('0x28')];})[_0x4cf6('0x29')](function(_0x1c60d8){throw _0x1c60d8;});}exports[_0x4cf6('0x2a')]=getRealtimeQueues;function initializeQueues(_0x29fc16,_0x298e89,_0x594f33,_0x1de7cc){var _0x6d5847=DEFAULT_QUEUE_ATTRIBUTES;if(_0x594f33===_0x4cf6('0x21')){if(_0x1de7cc===_0x4cf6('0x2b')){_0x6d5847=_0x6d5847[_0x4cf6('0x2c')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x1de7cc===_0x4cf6('0x2d')){_0x6d5847=_0x6d5847['concat'](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x29fc16[_0x4cf6('0x2e')](function(_0x4b3ea3){var _0x10f8c4=_0x4b3ea3[_0x4cf6('0x2f')]({'plain':!![]});_0x10f8c4['paused']=0x0;_0x10f8c4[_0x4cf6('0x30')]=0x0;_0x10f8c4[_0x4cf6('0x5')]=0x0;_0x10f8c4[_0x4cf6('0x4')]=0x0;_0x10f8c4[_0x4cf6('0x7')]=0x0;if(_0x594f33===_0x4cf6('0x21')){_0x10f8c4['talking']=0x0;_0x10f8c4[_0x4cf6('0x8')]=0x0;if(_0x1de7cc==='outbound'){_0x10f8c4['pTalking']=0x0;_0x10f8c4['originated']=0x0;}}var _0x39e469=_[_0x4cf6('0x31')](_0x298e89,['id',_0x10f8c4['id']]);if(_0x39e469){_[_0x4cf6('0x32')](_0x10f8c4,_['pick'](_0x39e469,_0x6d5847));}return _0x10f8c4;});}exports[_0x4cf6('0x33')]=initializeQueues; \ No newline at end of file +var _0x874a=['predictiveIntervalAvgTalktime','voice','request','startCase','then','error','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','catch','getRealtimeQueues','inbound','concat','outbound','map','get','available','waiting','originated','find','merge','initializeQueues','jayson/promise','client','http','loggedIn','paused','busy','inUse','invalid','loggedInDb','notInUse','onHold','ringing','ringInUse','talking','unavailable','pTalking','dialMethod','Trunk','startProgressive','erlangCalls','erlangCallToSecond','erlangBusyFactor','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime'];(function(_0x324035,_0x415e44){var _0x159405=function(_0x1b599c){while(--_0x1b599c){_0x324035['push'](_0x324035['shift']());}};_0x159405(++_0x415e44);}(_0x874a,0xd1));var _0xa874=function(_0x3301bb,_0x20d3f5){_0x3301bb=_0x3301bb-0x0;var _0x53de55=_0x874a[_0x3301bb];return _0x53de55;};'use strict';var _=require('lodash');var jayson=require(_0xa874('0x0'));var util=require('util');var amiClient=jayson[_0xa874('0x1')][_0xa874('0x2')]({'port':0x232a});var routingClient=jayson['client'][_0xa874('0x2')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=['available',_0xa874('0x3'),_0xa874('0x4'),'waiting'];var VOICE_QUEUE_ATTRIBUTES=[_0xa874('0x5'),_0xa874('0x6'),_0xa874('0x7'),_0xa874('0x8'),_0xa874('0x9'),_0xa874('0xa'),_0xa874('0xb'),_0xa874('0xc'),_0xa874('0xd'),_0xa874('0xe'),'unknown'];var OUTBOUND_QUEUE_ATTRIBUTES=[_0xa874('0xf'),'originated','message','statusMessage','dialActive',_0xa874('0x10'),_0xa874('0x11'),'startPredictive',_0xa874('0x12'),_0xa874('0x13'),_0xa874('0x14'),'erlangAbandonmentRate',_0xa874('0x15'),'dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable',_0xa874('0x16'),'predictiveIntervalAnsweredCalls',_0xa874('0x17'),_0xa874('0x18'),_0xa874('0x19'),_0xa874('0x1a')];function getRealtimeQueues(_0x5ba379,_0x243034){var _0x16f8a8=_0x243034===_0xa874('0x1b')?amiClient:routingClient;return _0x16f8a8[_0xa874('0x1c')](_[_0xa874('0x1d')](_0x243034)+'Queues',_0x5ba379)[_0xa874('0x1e')](function(_0x19f9f3){if(_0x19f9f3[_0xa874('0x1f')])throw new Error(util['format'](_0xa874('0x20'),_0x243034));return _0x19f9f3[_0xa874('0x21')];})[_0xa874('0x22')](function(_0x42a36c){throw _0x42a36c;});}exports[_0xa874('0x23')]=getRealtimeQueues;function initializeQueues(_0x29a1ad,_0x59bc81,_0x486294,_0x49ac09){var _0x5a93f6=DEFAULT_QUEUE_ATTRIBUTES;if(_0x486294===_0xa874('0x1b')){if(_0x49ac09===_0xa874('0x24')){_0x5a93f6=_0x5a93f6[_0xa874('0x25')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x49ac09===_0xa874('0x26')){_0x5a93f6=_0x5a93f6[_0xa874('0x25')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x29a1ad[_0xa874('0x27')](function(_0x29ac6b){var _0x5d8c88=_0x29ac6b[_0xa874('0x28')]({'plain':!![]});_0x5d8c88[_0xa874('0x4')]=0x0;_0x5d8c88[_0xa874('0x8')]=0x0;_0x5d8c88['loggedIn']=0x0;_0x5d8c88[_0xa874('0x29')]=0x0;_0x5d8c88[_0xa874('0x2a')]=0x0;if(_0x486294===_0xa874('0x1b')){_0x5d8c88[_0xa874('0xd')]=0x0;_0x5d8c88[_0xa874('0x5')]=0x0;if(_0x49ac09===_0xa874('0x26')){_0x5d8c88[_0xa874('0xf')]=0x0;_0x5d8c88[_0xa874('0x2b')]=0x0;}}var _0x3dba3e=_[_0xa874('0x2c')](_0x59bc81,['id',_0x5d8c88['id']]);if(_0x3dba3e){_[_0xa874('0x2d')](_0x5d8c88,_['pick'](_0x3dba3e,_0x5a93f6));}return _0x5d8c88;});}exports[_0xa874('0x2e')]=initializeQueues; \ No newline at end of file diff --git a/server/config/environment/development.js b/server/config/environment/development.js index e98170d..9753583 100644 --- a/server/config/environment/development.js +++ b/server/config/environment/development.js @@ -88,6 +88,5 @@ module.exports = { baseDN: process.env.AD_BASEDN || '', url: process.env.AD_URL, domain: process.env.AD_DOMAIN - }, - emailMaxHTMLbytesLimit: process.env.XC_EMAIL_MAX_HTML_BYTES_LIMIT || 4000000000, + } }; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index a7b9020..4db9451 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['get','production','set','appPath','public','join','root','client','use','toISOString','split','static','views','/server/views','engine','html','ejs','urlencoded','50mb','json','initialize','express','method-override','cookie-parser','passport','./environment','default'];(function(_0x389213,_0x14a50d){var _0x4ad6ca=function(_0x45203b){while(--_0x45203b){_0x389213['push'](_0x389213['shift']());}};_0x4ad6ca(++_0x14a50d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xa9e0[_0x3054be];return _0x3df150;};'use strict';var express=require(_0x0a9e('0x0'));var methodOverride=require(_0x0a9e('0x1'));var cookieParser=require(_0x0a9e('0x2'));var errorHandler=require('errorhandler');var path=require('path');var passport=require(_0x0a9e('0x3'));var cors=require('cors');var config=require(_0x0a9e('0x4'));exports[_0x0a9e('0x5')]=function(_0x2ab90b){var _0x991246=_0x2ab90b[_0x0a9e('0x6')]('env');if(_0x991246===_0x0a9e('0x7')){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path['join'](config['root'],_0x0a9e('0xa')));}if(_0x991246==='development'||_0x991246==='test'){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path[_0x0a9e('0xb')](config[_0x0a9e('0xc')],_0x0a9e('0xd')));_0x2ab90b[_0x0a9e('0xe')](errorHandler());}_0x2ab90b['set']('json\x20replacer',function(_0x527cdd,_0x4cfe67){if(this[_0x527cdd]instanceof Date){_0x4cfe67=this[_0x527cdd][_0x0a9e('0xf')]()[_0x0a9e('0x10')]('.')[0x0]+'Z';}return _0x4cfe67;});_0x2ab90b[_0x0a9e('0xe')](express[_0x0a9e('0x11')](_0x2ab90b[_0x0a9e('0x6')](_0x0a9e('0x9'))));_0x2ab90b['set'](_0x0a9e('0x12'),config[_0x0a9e('0xc')]+_0x0a9e('0x13'));_0x2ab90b[_0x0a9e('0x14')](_0x0a9e('0x15'),require(_0x0a9e('0x16'))['renderFile']);_0x2ab90b[_0x0a9e('0x8')]('view\x20engine',_0x0a9e('0x15'));_0x2ab90b['use'](express[_0x0a9e('0x17')]({'limit':_0x0a9e('0x18'),'extended':!![]}));_0x2ab90b['use'](express[_0x0a9e('0x19')]({'limit':'50mb'}));_0x2ab90b[_0x0a9e('0xe')](cors());_0x2ab90b[_0x0a9e('0xe')](methodOverride());_0x2ab90b[_0x0a9e('0xe')](cookieParser());_0x2ab90b[_0x0a9e('0xe')](passport[_0x0a9e('0x1a')]());}; \ No newline at end of file +var _0xa9e0=['get','production','set','appPath','public','join','root','client','use','toISOString','split','static','views','/server/views','engine','html','ejs','urlencoded','50mb','json','initialize','express','method-override','cookie-parser','passport','./environment','default'];(function(_0x200aa5,_0x197802){var _0x458200=function(_0x594959){while(--_0x594959){_0x200aa5['push'](_0x200aa5['shift']());}};_0x458200(++_0x197802);}(_0xa9e0,0x123));var _0x0a9e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa9e0[_0x19e35c];return _0x3e1fe8;};'use strict';var express=require(_0x0a9e('0x0'));var methodOverride=require(_0x0a9e('0x1'));var cookieParser=require(_0x0a9e('0x2'));var errorHandler=require('errorhandler');var path=require('path');var passport=require(_0x0a9e('0x3'));var cors=require('cors');var config=require(_0x0a9e('0x4'));exports[_0x0a9e('0x5')]=function(_0x2ab90b){var _0x991246=_0x2ab90b[_0x0a9e('0x6')]('env');if(_0x991246===_0x0a9e('0x7')){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path['join'](config['root'],_0x0a9e('0xa')));}if(_0x991246==='development'||_0x991246==='test'){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path[_0x0a9e('0xb')](config[_0x0a9e('0xc')],_0x0a9e('0xd')));_0x2ab90b[_0x0a9e('0xe')](errorHandler());}_0x2ab90b['set']('json\x20replacer',function(_0x527cdd,_0x4cfe67){if(this[_0x527cdd]instanceof Date){_0x4cfe67=this[_0x527cdd][_0x0a9e('0xf')]()[_0x0a9e('0x10')]('.')[0x0]+'Z';}return _0x4cfe67;});_0x2ab90b[_0x0a9e('0xe')](express[_0x0a9e('0x11')](_0x2ab90b[_0x0a9e('0x6')](_0x0a9e('0x9'))));_0x2ab90b['set'](_0x0a9e('0x12'),config[_0x0a9e('0xc')]+_0x0a9e('0x13'));_0x2ab90b[_0x0a9e('0x14')](_0x0a9e('0x15'),require(_0x0a9e('0x16'))['renderFile']);_0x2ab90b[_0x0a9e('0x8')]('view\x20engine',_0x0a9e('0x15'));_0x2ab90b['use'](express[_0x0a9e('0x17')]({'limit':_0x0a9e('0x18'),'extended':!![]}));_0x2ab90b['use'](express[_0x0a9e('0x19')]({'limit':'50mb'}));_0x2ab90b[_0x0a9e('0xe')](cors());_0x2ab90b[_0x0a9e('0xe')](methodOverride());_0x2ab90b[_0x0a9e('0xe')](cookieParser());_0x2ab90b[_0x0a9e('0xe')](passport[_0x0a9e('0x1a')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 42d4c91..3f9f700 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 _0x7e18=['win32','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync','../environment','networkInterfaces','length','filter','family','internal','concat','head','mac','00:00:00:00:00:00','address','orderBy','cpus','model','join','createHash','md5','update','digest','hex','getUuid','platform','licenseToken','test'];(function(_0x144e23,_0x4a1144){var _0x458f03=function(_0x2ce156){while(--_0x2ce156){_0x144e23['push'](_0x144e23['shift']());}};_0x458f03(++_0x4a1144);}(_0x7e18,0x92));var _0x87e1=function(_0x2b20b3,_0x124c9e){_0x2b20b3=_0x2b20b3-0x0;var _0x4dad4b=_0x7e18[_0x2b20b3];return _0x4dad4b;};'use strict';var _=require(_0x87e1('0x0'));var os=require('os');var crypto=require(_0x87e1('0x1'));var machine=require(_0x87e1('0x2'));var exec=require(_0x87e1('0x3'))[_0x87e1('0x4')];var config=require(_0x87e1('0x5'));function getInterfaces(){var _0x4e5b56=[];var _0x103733=os[_0x87e1('0x6')]();var _0x4868bd=_['orderBy'](_['keys'](_0x103733));for(var _0x395f77=0x0;_0x395f77<_0x4868bd[_0x87e1('0x7')];_0x395f77++){var _0x5c61ba=_0x103733[_0x4868bd[_0x395f77]][_0x87e1('0x8')](function(_0xba5d35){return _0xba5d35[_0x87e1('0x9')]==='IPv4'&&_0xba5d35[_0x87e1('0xa')]===![];});_0x4e5b56=_0x4e5b56[_0x87e1('0xb')](_0x5c61ba);}return _0x4e5b56;}function getFirstInterface(){var _0x23e6a4=_[_0x87e1('0xc')](getInterfaces());return{'macAddress':_0x23e6a4&&_0x23e6a4['mac']?_0x23e6a4[_0x87e1('0xd')]:_0x87e1('0xe'),'ipAddress':_0x23e6a4&&_0x23e6a4[_0x87e1('0xf')]?_0x23e6a4[_0x87e1('0xf')]:'127.0.0.1'};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0x22c7b2=_[_0x87e1('0x10')](os[_0x87e1('0x11')]()['map'](function(_0x5e5947){return _0x5e5947[_0x87e1('0x12')];}))[_0x87e1('0x13')](':');return crypto[_0x87e1('0x14')](_0x87e1('0x15'))[_0x87e1('0x16')](_0x22c7b2)[_0x87e1('0x17')](_0x87e1('0x18'));}exports[_0x87e1('0x19')]=function(){var _0x2a9efa=os[_0x87e1('0x1a')]();var _0x3fe582=/[0-9a-f-]{36}/;if(config[_0x87e1('0x1b')]&&_0x3fe582[_0x87e1('0x1c')](config[_0x87e1('0x1b')])){return config['licenseToken'];}else if(_0x2a9efa===_0x87e1('0x1d')){return exec(_0x87e1('0x1e'),{'encoding':_0x87e1('0x1f')})[_0x87e1('0x20')]('\x0d\x0a','');}else{var _0x419120=getFirstInterface();var _0x31732d=getCPUhash();var _0x3547ee=_0x31732d+'|'+os[_0x87e1('0x21')]()+'|'+_0x419120['macAddress']+'|'+_0x419120['ipAddress'];var _0x1948ac=crypto[_0x87e1('0x14')]('md5')['update'](_0x3547ee)[_0x87e1('0x17')]('hex');return _0x1948ac[_0x87e1('0x22')](0x0,0x8)+'-'+_0x1948ac[_0x87e1('0x22')](0x8,0xc)+'-'+_0x1948ac['substring'](0xc,0x10)+'-'+_0x1948ac[_0x87e1('0x22')](0x10,0x14)+'-'+_0x1948ac[_0x87e1('0x22')](0x14);}}; \ No newline at end of file +var _0x0d18=['00:00:00:00:00:00','address','getFirstInterface','cpus','model','createHash','md5','update','digest','getUuid','platform','test','utf8','hostname','ipAddress','substring','lodash','crypto','child_process','networkInterfaces','orderBy','keys','length','filter','IPv4','internal','head','mac'];(function(_0x3b7a0c,_0xf1a4c2){var _0x3bb70f=function(_0x248b52){while(--_0x248b52){_0x3b7a0c['push'](_0x3b7a0c['shift']());}};_0x3bb70f(++_0xf1a4c2);}(_0x0d18,0x80));var _0x80d1=function(_0xda0714,_0x43de77){_0xda0714=_0xda0714-0x0;var _0x16b3c3=_0x0d18[_0xda0714];return _0x16b3c3;};'use strict';var _=require(_0x80d1('0x0'));var os=require('os');var crypto=require(_0x80d1('0x1'));var machine=require('bimedia-machine-uuid');var exec=require(_0x80d1('0x2'))['execSync'];var config=require('../environment');function getInterfaces(){var _0x417d66=[];var _0x279620=os[_0x80d1('0x3')]();var _0x2936a8=_[_0x80d1('0x4')](_[_0x80d1('0x5')](_0x279620));for(var _0x5482b0=0x0;_0x5482b0<_0x2936a8[_0x80d1('0x6')];_0x5482b0++){var _0x3634dc=_0x279620[_0x2936a8[_0x5482b0]][_0x80d1('0x7')](function(_0x59434c){return _0x59434c['family']===_0x80d1('0x8')&&_0x59434c[_0x80d1('0x9')]===![];});_0x417d66=_0x417d66['concat'](_0x3634dc);}return _0x417d66;}function getFirstInterface(){var _0x780911=_[_0x80d1('0xa')](getInterfaces());return{'macAddress':_0x780911&&_0x780911[_0x80d1('0xb')]?_0x780911['mac']:_0x80d1('0xc'),'ipAddress':_0x780911&&_0x780911[_0x80d1('0xd')]?_0x780911[_0x80d1('0xd')]:'127.0.0.1'};}exports[_0x80d1('0xe')]=getFirstInterface;function getCPUhash(){var _0x3613b8=_['orderBy'](os[_0x80d1('0xf')]()['map'](function(_0x2e7e0e){return _0x2e7e0e[_0x80d1('0x10')];}))['join'](':');return crypto[_0x80d1('0x11')](_0x80d1('0x12'))[_0x80d1('0x13')](_0x3613b8)[_0x80d1('0x14')]('hex');}exports[_0x80d1('0x15')]=function(){var _0xa4e37d=os[_0x80d1('0x16')]();var _0x41d432=/[0-9a-f-]{36}/;if(config['licenseToken']&&_0x41d432[_0x80d1('0x17')](config['licenseToken'])){return config['licenseToken'];}else if(_0xa4e37d==='win32'){return exec('dmidecode\x20--string\x20system-uuid',{'encoding':_0x80d1('0x18')})['replace']('\x0d\x0a','');}else{var _0x2cc73a=getFirstInterface();var _0x51823a=getCPUhash();var _0x3b6649=_0x51823a+'|'+os[_0x80d1('0x19')]()+'|'+_0x2cc73a['macAddress']+'|'+_0x2cc73a[_0x80d1('0x1a')];var _0x34ebd8=crypto['createHash'](_0x80d1('0x12'))['update'](_0x3b6649)[_0x80d1('0x14')]('hex');return _0x34ebd8['substring'](0x0,0x8)+'-'+_0x34ebd8[_0x80d1('0x1b')](0x8,0xc)+'-'+_0x34ebd8[_0x80d1('0x1b')](0xc,0x10)+'-'+_0x34ebd8[_0x80d1('0x1b')](0x10,0x14)+'-'+_0x34ebd8[_0x80d1('0x1b')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index ee80cab..7486c4c 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 _0xb173=['../logger','license','https://www.xcallymotion.com','%s/api/servers/%s/check?version=%s','exports','format','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch','data1','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','data2','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','error','message','finally','getUuid','License','findOrCreate','SERVICE\x20LICENSE\x20STARTED\x20%s','default','moment','bluebird','pkginfo','version','../../mysqldb','../../components/encryptor','./hardware'];(function(_0x2d126e,_0x1e8257){var _0xcb04d3=function(_0x19a2d9){while(--_0x19a2d9){_0x2d126e['push'](_0x2d126e['shift']());}};_0xcb04d3(++_0x1e8257);}(_0xb173,0xfb));var _0x3b17=function(_0x3f5e74,_0x27efd1){_0x3f5e74=_0x3f5e74-0x0;var _0x18c571=_0xb173[_0x3f5e74];return _0x18c571;};'use strict';var util=require('util');var moment=require(_0x3b17('0x0'));var rp=require('request-promise');var BPromise=require(_0x3b17('0x1'));var pkginfo=require(_0x3b17('0x2'))(module,_0x3b17('0x3'));var db=require(_0x3b17('0x4'))['db'];var encryptor=require(_0x3b17('0x5'));var hardware=require(_0x3b17('0x6'));var logger=require(_0x3b17('0x7'))(_0x3b17('0x8'));var HOST=_0x3b17('0x9');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x15e37c){return new BPromise(function(_0x151555,_0x3f62f4){var _0x10a2b9=util['format'](_0x3b17('0xa'),HOST,_0x15e37c,module[_0x3b17('0xb')]['version']);if(oldToken){_0x10a2b9=util[_0x3b17('0xc')](_0x3b17('0xd'),HOST,_0x15e37c,module[_0x3b17('0xb')][_0x3b17('0x3')],oldToken);}var _0x3bc9c9={'uri':_0x10a2b9,'method':_0x3b17('0xe'),'timeout':0xea60,'json':!![]};return rp(_0x3bc9c9)[_0x3b17('0xf')](function(_0x510130){_0x151555(_0x510130);})[_0x3b17('0x10')](function(_0xeae020){_0x3f62f4(_0xeae020);});});}function manageLicense(_0x4f9048,_0x5e6189){var _0x55499b=_0x5e6189['get']({'plain':!![]});if(!isOldTokenSent&&_0x55499b[_0x3b17('0x11')]!==_0x4f9048&&!_0x55499b['data2']){oldToken=_0x55499b['data1'];}httpRequest(_0x4f9048)[_0x3b17('0xf')](function(_0x1cf3b5){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x1cf3b5[_0x3b17('0x12')]){isOldTokenSent=![];if(!_0x55499b[_0x3b17('0x8')]&&_0x55499b['license']!=_0x1cf3b5[_0x3b17('0x8')]||_0x55499b['license']&&_0x55499b['data2']){logger[_0x3b17('0x13')](_0x3b17('0x14'));}if(_0x55499b[_0x3b17('0x8')]&&!_0x55499b[_0x3b17('0x15')]&&_0x55499b[_0x3b17('0x8')]!=_0x1cf3b5[_0x3b17('0x8')]){logger[_0x3b17('0x13')](_0x3b17('0x16'));}if(_0x55499b['license']&&!_0x55499b[_0x3b17('0x15')]&&_0x55499b[_0x3b17('0x8')]==_0x1cf3b5[_0x3b17('0x8')]){return _0x5e6189;}return _0x5e6189[_0x3b17('0x17')]({'data1':_0x4f9048,'data2':null,'license':_0x1cf3b5[_0x3b17('0x8')]});}else{if(_0x1cf3b5[_0x3b17('0x8')]||_0x55499b[_0x3b17('0x8')]){if(!_0x55499b[_0x3b17('0x15')]){if(_0x55499b[_0x3b17('0x11')]==_0x4f9048){GRAY_PERIOD_REASON=_0x3b17('0x18');logger[_0x3b17('0x13')](_0x3b17('0x19'));}else{GRAY_PERIOD_REASON=_0x3b17('0x1a');logger['info']('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x55499b[_0x3b17('0x11')],_0x4f9048);}logger[_0x3b17('0x13')](_0x3b17('0x1b'),GRAY_PERIOD_REASON[_0x3b17('0x1c')](),moment()['format']('YYYY-MM-DD\x20HH:mm'));return _0x5e6189[_0x3b17('0x17')]({'data2':encryptor['encryptString'](moment()[_0x3b17('0xc')](_0x3b17('0x1d')))});}else{if(moment()[_0x3b17('0x1e')](encryptor[_0x3b17('0x1f')](_0x55499b[_0x3b17('0x15')]),_0x3b17('0x20'))>DAYS){logger[_0x3b17('0x13')](_0x3b17('0x21'),moment()['format']('YYYY-MM-DD\x20HH:mm'));isOldTokenSent=![];return _0x5e6189[_0x3b17('0x17')]({'data1':_0x4f9048,'data2':null,'license':null});}}}else{if(_0x55499b[_0x3b17('0x11')]!=_0x4f9048){logger['info'](_0x3b17('0x22'),_0x55499b[_0x3b17('0x11')],_0x4f9048);return _0x5e6189[_0x3b17('0x17')]({'data1':_0x4f9048,'data2':null,'license':null});}}}return _0x5e6189;})[_0x3b17('0xf')](function(_0x352df2){_0x5e6189=_0x352df2;})[_0x3b17('0x10')](function(_0x1535f2){logger[_0x3b17('0x23')](_0x1535f2[_0x3b17('0x24')]);})[_0x3b17('0x25')](function(){setTimeout(function(){manageLicense(hardware[_0x3b17('0x26')](),_0x5e6189);},TIME);});}function defaultLicense(){var _0x54a33e=hardware[_0x3b17('0x26')]();if(_0x54a33e){return db[_0x3b17('0x27')][_0x3b17('0x28')]({'where':{'id':0x1},'defaults':{'data1':_0x54a33e}})['spread'](function(_0x59bbff,_0x1ebfd1){logger['info'](_0x3b17('0x29'),_0x54a33e);manageLicense(_0x54a33e,_0x59bbff);})[_0x3b17('0x10')](function(_0x32e393){logger['error'](_0x32e393['message']);});}}exports[_0x3b17('0x2a')]=defaultLicense; \ No newline at end of file +var _0x8780=['moment','request-promise','bluebird','pkginfo','version','../../mysqldb','../logger','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch','data1','data2','active','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','info','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','YYYY-MM-DD\x20HH:mm','encryptString','days','DEMO\x20START\x20AT\x20%s','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','error','finally','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','message','default','util'];(function(_0x4a303e,_0x31691c){var _0xf4df35=function(_0x1f0496){while(--_0x1f0496){_0x4a303e['push'](_0x4a303e['shift']());}};_0xf4df35(++_0x31691c);}(_0x8780,0xa7));var _0x0878=function(_0x1ddaa7,_0x532342){_0x1ddaa7=_0x1ddaa7-0x0;var _0x5ae216=_0x8780[_0x1ddaa7];return _0x5ae216;};'use strict';var util=require(_0x0878('0x0'));var moment=require(_0x0878('0x1'));var rp=require(_0x0878('0x2'));var BPromise=require(_0x0878('0x3'));var pkginfo=require(_0x0878('0x4'))(module,_0x0878('0x5'));var db=require(_0x0878('0x6'))['db'];var encryptor=require('../../components/encryptor');var hardware=require('./hardware');var logger=require(_0x0878('0x7'))(_0x0878('0x8'));var HOST=_0x0878('0x9');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x5de42b){return new BPromise(function(_0x4fd3f2,_0x26102c){var _0x28cafd=util[_0x0878('0xa')](_0x0878('0xb'),HOST,_0x5de42b,module[_0x0878('0xc')][_0x0878('0x5')]);if(oldToken){_0x28cafd=util['format'](_0x0878('0xd'),HOST,_0x5de42b,module[_0x0878('0xc')][_0x0878('0x5')],oldToken);}var _0x5b306d={'uri':_0x28cafd,'method':_0x0878('0xe'),'timeout':0xea60,'json':!![]};return rp(_0x5b306d)[_0x0878('0xf')](function(_0x9eb78f){_0x4fd3f2(_0x9eb78f);})[_0x0878('0x10')](function(_0x20de57){_0x26102c(_0x20de57);});});}function manageLicense(_0x2a3115,_0x12de91){var _0x548d8e=_0x12de91['get']({'plain':!![]});if(!isOldTokenSent&&_0x548d8e[_0x0878('0x11')]!==_0x2a3115&&!_0x548d8e[_0x0878('0x12')]){oldToken=_0x548d8e[_0x0878('0x11')];}httpRequest(_0x2a3115)[_0x0878('0xf')](function(_0x412352){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x412352[_0x0878('0x13')]){isOldTokenSent=![];if(!_0x548d8e['license']&&_0x548d8e[_0x0878('0x8')]!=_0x412352[_0x0878('0x8')]||_0x548d8e[_0x0878('0x8')]&&_0x548d8e[_0x0878('0x12')]){logger['info'](_0x0878('0x14'));}if(_0x548d8e[_0x0878('0x8')]&&!_0x548d8e[_0x0878('0x12')]&&_0x548d8e[_0x0878('0x8')]!=_0x412352[_0x0878('0x8')]){logger[_0x0878('0x15')](_0x0878('0x16'));}if(_0x548d8e['license']&&!_0x548d8e['data2']&&_0x548d8e[_0x0878('0x8')]==_0x412352[_0x0878('0x8')]){return _0x12de91;}return _0x12de91[_0x0878('0x17')]({'data1':_0x2a3115,'data2':null,'license':_0x412352[_0x0878('0x8')]});}else{if(_0x412352[_0x0878('0x8')]||_0x548d8e['license']){if(!_0x548d8e['data2']){if(_0x548d8e[_0x0878('0x11')]==_0x2a3115){GRAY_PERIOD_REASON=_0x0878('0x18');logger['info'](_0x0878('0x19'));}else{GRAY_PERIOD_REASON=_0x0878('0x1a');logger[_0x0878('0x15')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x548d8e['data1'],_0x2a3115);}logger[_0x0878('0x15')](_0x0878('0x1b'),GRAY_PERIOD_REASON['toUpperCase'](),moment()[_0x0878('0xa')](_0x0878('0x1c')));return _0x12de91['update']({'data2':encryptor[_0x0878('0x1d')](moment()[_0x0878('0xa')](_0x0878('0x1c')))});}else{if(moment()['diff'](encryptor['decryptString'](_0x548d8e[_0x0878('0x12')]),_0x0878('0x1e'))>DAYS){logger[_0x0878('0x15')](_0x0878('0x1f'),moment()['format'](_0x0878('0x1c')));isOldTokenSent=![];return _0x12de91[_0x0878('0x17')]({'data1':_0x2a3115,'data2':null,'license':null});}}}else{if(_0x548d8e['data1']!=_0x2a3115){logger[_0x0878('0x15')](_0x0878('0x20'),_0x548d8e[_0x0878('0x11')],_0x2a3115);return _0x12de91[_0x0878('0x17')]({'data1':_0x2a3115,'data2':null,'license':null});}}}return _0x12de91;})[_0x0878('0xf')](function(_0x3f2b2e){_0x12de91=_0x3f2b2e;})[_0x0878('0x10')](function(_0xdaf653){logger[_0x0878('0x21')](_0xdaf653['message']);})[_0x0878('0x22')](function(){setTimeout(function(){manageLicense(hardware[_0x0878('0x23')](),_0x12de91);},TIME);});}function defaultLicense(){var _0x4ba26c=hardware[_0x0878('0x23')]();if(_0x4ba26c){return db[_0x0878('0x24')][_0x0878('0x25')]({'where':{'id':0x1},'defaults':{'data1':_0x4ba26c}})[_0x0878('0x26')](function(_0x549344,_0x5280d8){logger['info'](_0x0878('0x27'),_0x4ba26c);manageLicense(_0x4ba26c,_0x549344);})['catch'](function(_0x29131d){logger['error'](_0x29131d[_0x0878('0x28')]);});}}exports[_0x0878('0x29')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index a878e33..3883dc9 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 _0x7776=['./hardware','../../components/encryptor','2027-01-01T00:00:00.000Z','Demo\x20license','Breaking\x20license','getUuid','License','find','defaults','then','uuid','data1','license','License\x20key\x20value\x20not\x20found','data2','split','decryptString','format','%s:%s:%s','parse','demo','machineUuid','gray','deadline','add','grayReason','changed','disabled','message','User','findAll','role','sequelize','COUNT','col','count','telephone','users','forEach','user','catch','pick','countBy','admin','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','bluebird'];(function(_0x31ada2,_0x1ff020){var _0x3c1540=function(_0x4e5898){while(--_0x4e5898){_0x31ada2['push'](_0x31ada2['shift']());}};_0x3c1540(++_0x1ff020);}(_0x7776,0x155));var _0x6777=function(_0x1d3c79,_0x974181){_0x1d3c79=_0x1d3c79-0x0;var _0x4b9695=_0x7776[_0x1d3c79];return _0x4b9695;};'use strict';var util=require(_0x6777('0x0'));var _=require('lodash');var moment=require('moment');var BPromise=require(_0x6777('0x1'));var hardware=require(_0x6777('0x2'));var encryptor=require(_0x6777('0x3'));var db=require('../../mysqldb')['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x6777('0x4'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x6777('0x5'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x6777('0x6'),'machineUuid':hardware[_0x6777('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x18d5b8){return new BPromise(function(_0x5e6ca3,_0x58f762){return db[_0x6777('0x8')][_0x6777('0x9')](_[_0x6777('0xa')](_0x18d5b8,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x1bd522){return checkLicense(_0x1bd522,null);})[_0x6777('0xb')](function(_0xa4a27f){_0x5e6ca3(_0xa4a27f);return;})['catch'](function(_0x29299c){_0x58f762(_0x29299c);});});}function checkLicense(_0x5430f0,_0x3549cd){if(!_0x5430f0){demoLicense[_0x6777('0xc')]=_0x5430f0[_0x6777('0xd')];return demoLicense;}try{var _0x584fc1=_0x3549cd||_0x5430f0[_0x6777('0xe')];if(_['isEmpty'](_0x584fc1)){throw new Error(_0x6777('0xf'));}var _0x44dd0e=_0x5430f0['data1'];var _0x5bdd19=_0x5430f0[_0x6777('0x10')];var _0x4bf4bf=_0x44dd0e[_0x6777('0x11')]('-')[0x4];var _0x303843=_0x44dd0e[_0x6777('0x11')]('-')[0x0];var _0x5e378f=encryptor[_0x6777('0x12')](_0x584fc1,util[_0x6777('0x13')](_0x6777('0x14'),_0x4bf4bf,_0x44dd0e,_0x303843));var _0xa582a=JSON[_0x6777('0x15')](_0x5e378f);_0xa582a[_0x6777('0x16')]=![];_0xa582a['uuid']=_0x44dd0e;_0xa582a[_0x6777('0x17')]=hardware[_0x6777('0x7')]();if(_0x5bdd19){var _0x3c72ac=encryptor[_0x6777('0x12')](_0x5bdd19);_0xa582a[_0x6777('0x18')]=_0x3c72ac;_0xa582a[_0x6777('0x19')]=moment(_0x3c72ac)[_0x6777('0x1a')](0x7,'days')[_0x6777('0x13')]();_0xa582a[_0x6777('0x1b')]=_0xa582a[_0x6777('0xc')]!=_0xa582a['machineUuid']?_0x6777('0x1c'):_0x6777('0x1d');}return _0xa582a;}catch(_0x32018f){breakingLicense['uuid']=_0x5430f0[_0x6777('0xd')];breakingLicense[_0x6777('0x1e')]=_0x32018f['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x1621b2,_0x38ba65){getLicense()[_0x6777('0xb')](function(_0x29d6ab){return db[_0x6777('0x1f')][_0x6777('0x20')]({'attributes':[_0x6777('0x21'),[db[_0x6777('0x22')]['fn'](_0x6777('0x23'),db[_0x6777('0x22')][_0x6777('0x24')](_0x6777('0x21'))),_0x6777('0x25')]],'group':_0x6777('0x21'),'where':{'role':{'$or':['admin','user',_0x6777('0x26')]}},'raw':!![]})['then'](function(_0x85baf3){var _0x4adf0e={'user':_0x29d6ab[_0x6777('0x27')]||0x0,'telephone':_0x29d6ab['telephones']||0x0};_0x85baf3[_0x6777('0x28')](function(_0x13aa48){var _0x583fed=_0x13aa48[_0x6777('0x21')]==='admin'?_0x6777('0x29'):_0x13aa48[_0x6777('0x21')];_0x4adf0e[_0x583fed]-=_0x13aa48[_0x6777('0x25')];if(_0x4adf0e[_0x583fed]<0x0)_0x4adf0e[_0x583fed]=0x0;});_0x1621b2(_0x4adf0e);return;});})[_0x6777('0x2a')](function(_0x456f91){_0x38ba65(_0x456f91);});});}function checkUserLimits(_0x55be1a){return new BPromise(function(_0x5cd7bc,_0x245742){getLimits()[_0x6777('0xb')](function(_0x3a7550){var _0x459d06=_[_0x6777('0x2b')](_[_0x6777('0x2c')](_0x55be1a,_0x6777('0x21')),['admin',_0x6777('0x29'),_0x6777('0x26')]);var _0x1997e4=(_0x459d06[_0x6777('0x2d')]||0x0)+(_0x459d06[_0x6777('0x29')]||0x0);var _0x4f7625=_0x459d06[_0x6777('0x26')]||0x0;if(_0x1997e4>_0x3a7550[_0x6777('0x29')])return _0x245742(_0x6777('0x2e'));if(_0x4f7625>_0x3a7550[_0x6777('0x26')])return _0x245742(_0x6777('0x2f'));return _0x5cd7bc();})[_0x6777('0x2a')](function(_0x563988){_0x245742(_0x563988);});});}module[_0x6777('0x30')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x3bb2=['format','demo','gray','deadline','days','grayReason','machineUuid','changed','disabled','message','User','findAll','role','sequelize','COUNT','count','admin','user','users','forEach','countBy','telephone','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','moment','bluebird','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','getUuid','Breaking\x20license','License','find','defaults','then','catch','uuid','data1','license','isEmpty','data2','split'];(function(_0x55d244,_0x3bf14d){var _0x422d81=function(_0x1bc601){while(--_0x1bc601){_0x55d244['push'](_0x55d244['shift']());}};_0x422d81(++_0x3bf14d);}(_0x3bb2,0xc9));var _0x23bb=function(_0x4ca395,_0x2c9ee1){_0x4ca395=_0x4ca395-0x0;var _0x386779=_0x3bb2[_0x4ca395];return _0x386779;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x23bb('0x0'));var BPromise=require(_0x23bb('0x1'));var hardware=require(_0x23bb('0x2'));var encryptor=require(_0x23bb('0x3'));var db=require(_0x23bb('0x4'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x23bb('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':'Demo\x20license','machineUuid':hardware[_0x23bb('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x23bb('0x7'),'machineUuid':hardware[_0x23bb('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x482448){return new BPromise(function(_0x170653,_0x8001ce){return db[_0x23bb('0x8')][_0x23bb('0x9')](_[_0x23bb('0xa')](_0x482448,{'raw':!![],'where':{'id':0x1}}))[_0x23bb('0xb')](function(_0x2464dd){return checkLicense(_0x2464dd,null);})[_0x23bb('0xb')](function(_0x4b6de2){_0x170653(_0x4b6de2);return;})[_0x23bb('0xc')](function(_0x25d2c1){_0x8001ce(_0x25d2c1);});});}function checkLicense(_0xf5ab4e,_0x6cb9a){if(!_0xf5ab4e){demoLicense[_0x23bb('0xd')]=_0xf5ab4e[_0x23bb('0xe')];return demoLicense;}try{var _0xf59b20=_0x6cb9a||_0xf5ab4e[_0x23bb('0xf')];if(_[_0x23bb('0x10')](_0xf59b20)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0xf5512f=_0xf5ab4e[_0x23bb('0xe')];var _0x746495=_0xf5ab4e[_0x23bb('0x11')];var _0x585f8e=_0xf5512f['split']('-')[0x4];var _0x403a5a=_0xf5512f[_0x23bb('0x12')]('-')[0x0];var _0x230a8e=encryptor['decryptString'](_0xf59b20,util[_0x23bb('0x13')]('%s:%s:%s',_0x585f8e,_0xf5512f,_0x403a5a));var _0x5f27bf=JSON['parse'](_0x230a8e);_0x5f27bf[_0x23bb('0x14')]=![];_0x5f27bf[_0x23bb('0xd')]=_0xf5512f;_0x5f27bf['machineUuid']=hardware[_0x23bb('0x6')]();if(_0x746495){var _0x14d819=encryptor['decryptString'](_0x746495);_0x5f27bf[_0x23bb('0x15')]=_0x14d819;_0x5f27bf[_0x23bb('0x16')]=moment(_0x14d819)['add'](0x7,_0x23bb('0x17'))[_0x23bb('0x13')]();_0x5f27bf[_0x23bb('0x18')]=_0x5f27bf[_0x23bb('0xd')]!=_0x5f27bf[_0x23bb('0x19')]?_0x23bb('0x1a'):_0x23bb('0x1b');}return _0x5f27bf;}catch(_0x26dc3e){breakingLicense[_0x23bb('0xd')]=_0xf5ab4e['data1'];breakingLicense[_0x23bb('0x1c')]=_0x26dc3e[_0x23bb('0x1c')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x1f9f8d,_0xdf41d2){getLicense()[_0x23bb('0xb')](function(_0x207ed5){return db[_0x23bb('0x1d')][_0x23bb('0x1e')]({'attributes':[_0x23bb('0x1f'),[db[_0x23bb('0x20')]['fn'](_0x23bb('0x21'),db['sequelize']['col'](_0x23bb('0x1f'))),_0x23bb('0x22')]],'group':_0x23bb('0x1f'),'where':{'role':{'$or':[_0x23bb('0x23'),_0x23bb('0x24'),'telephone']}},'raw':!![]})[_0x23bb('0xb')](function(_0x3d0690){var _0x45598d={'user':_0x207ed5[_0x23bb('0x25')]||0x0,'telephone':_0x207ed5['telephones']||0x0};_0x3d0690[_0x23bb('0x26')](function(_0x2a05f2){var _0x50171f=_0x2a05f2[_0x23bb('0x1f')]===_0x23bb('0x23')?_0x23bb('0x24'):_0x2a05f2[_0x23bb('0x1f')];_0x45598d[_0x50171f]-=_0x2a05f2[_0x23bb('0x22')];if(_0x45598d[_0x50171f]<0x0)_0x45598d[_0x50171f]=0x0;});_0x1f9f8d(_0x45598d);return;});})[_0x23bb('0xc')](function(_0x25d033){_0xdf41d2(_0x25d033);});});}function checkUserLimits(_0x5810f8){return new BPromise(function(_0x285b1f,_0x44041d){getLimits()[_0x23bb('0xb')](function(_0x3d3923){var _0x46e8f9=_['pick'](_[_0x23bb('0x27')](_0x5810f8,_0x23bb('0x1f')),[_0x23bb('0x23'),'user',_0x23bb('0x28')]);var _0x6b542f=(_0x46e8f9[_0x23bb('0x23')]||0x0)+(_0x46e8f9['user']||0x0);var _0x1953fb=_0x46e8f9['telephone']||0x0;if(_0x6b542f>_0x3d3923[_0x23bb('0x24')])return _0x44041d(_0x23bb('0x29'));if(_0x1953fb>_0x3d3923[_0x23bb('0x28')])return _0x44041d(_0x23bb('0x2a'));return _0x285b1f();})[_0x23bb('0xc')](function(_0xe1905){_0x44041d(_0xe1905);});});}module[_0x23bb('0x2b')]={'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 4099dc5..543d9cd 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 _0xb9be=['app-id','secret','exports','http://localhost:9000','myappanuglar-secret'];(function(_0x52cbaa,_0x4dd3d3){var _0x38698e=function(_0x5c3b98){while(--_0x5c3b98){_0x52cbaa['push'](_0x52cbaa['shift']());}};_0x38698e(++_0x4dd3d3);}(_0xb9be,0xc5));var _0xeb9b=function(_0x409353,_0xe9f04d){_0x409353=_0x409353-0x0;var _0x4f4b59=_0xb9be[_0x409353];return _0x4f4b59;};'use strict';module[_0xeb9b('0x0')]={'DOMAIN':_0xeb9b('0x1'),'SESSION_SECRET':_0xeb9b('0x2'),'GOOGLE_ID':_0xeb9b('0x3'),'GOOGLE_SECRET':_0xeb9b('0x4'),'DEBUG':''}; \ No newline at end of file +var _0xdd4f=['exports','secret'];(function(_0xe0aedf,_0xa0b52d){var _0xde7d59=function(_0x4bc03b){while(--_0x4bc03b){_0xe0aedf['push'](_0xe0aedf['shift']());}};_0xde7d59(++_0xa0b52d);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x1d4356,_0x24c13e){_0x1d4356=_0x1d4356-0x0;var _0x8a8576=_0xdd4f[_0x1d4356];return _0x8a8576;};'use strict';module[_0xfdd4('0x0')]={'DOMAIN':'http://localhost:9000','SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':'app-id','GOOGLE_SECRET':_0xfdd4('0x1'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 5b3a85c..7d839eb 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x77ec=['exports','fileLogger'];(function(_0x12cf92,_0x3f7046){var _0x9abbd0=function(_0x1998c6){while(--_0x1998c6){_0x12cf92['push'](_0x12cf92['shift']());}};_0x9abbd0(++_0x3f7046);}(_0x77ec,0x149));var _0xc77e=function(_0x5d9cb2,_0x6aeefa){_0x5d9cb2=_0x5d9cb2-0x0;var _0x508ae3=_0x77ec[_0x5d9cb2];return _0x508ae3;};'use strict';var fileLogger=require('../utils/loggers')[_0xc77e('0x0')];module[_0xc77e('0x1')]=fileLogger; \ No newline at end of file +var _0x25cb=['../utils/loggers','fileLogger'];(function(_0xbf09ab,_0x251a19){var _0x2a9aef=function(_0x22d793){while(--_0x22d793){_0xbf09ab['push'](_0xbf09ab['shift']());}};_0x2a9aef(++_0x251a19);}(_0x25cb,0x92));var _0xb25c=function(_0x57eb2d,_0x5e4918){_0x57eb2d=_0x57eb2d-0x0;var _0xd8e18=_0x25cb[_0x57eb2d];return _0xd8e18;};'use strict';var fileLogger=require(_0xb25c('0x0'))[_0xb25c('0x1')];module['exports']=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index ec69d0b..acc8483 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 _0x161e=['../../services/routing/index.js','xdr','../../services/xdr/index.js','exports','path','../../config/environment','resolve','join','root','legacy-libs','express','../../services/express/index.js','ami','../../services/ami/index.js','agi','../../services/agi/index.js','email','../../services/email/index.js','routing'];(function(_0x40945a,_0x863740){var _0x36e374=function(_0x8d98bc){while(--_0x8d98bc){_0x40945a['push'](_0x40945a['shift']());}};_0x36e374(++_0x863740);}(_0x161e,0x9c));var _0xe161=function(_0xf07990,_0x18e150){_0xf07990=_0xf07990-0x0;var _0x587c6b=_0x161e[_0xf07990];return _0x587c6b;};'use strict';var path=require(_0xe161('0x0'));var cfg=require(_0xe161('0x1'));var env={'NODE_PATH':path[_0xe161('0x2')](path[_0xe161('0x3')](cfg[_0xe161('0x4')],_0xe161('0x5')))};var pm2config={'apps':[{'name':_0xe161('0x6'),'script':path[_0xe161('0x3')](__dirname,_0xe161('0x7')),'env':env},{'name':_0xe161('0x8'),'script':path[_0xe161('0x3')](__dirname,_0xe161('0x9')),'env':env},{'name':_0xe161('0xa'),'script':path[_0xe161('0x3')](__dirname,_0xe161('0xb')),'env':env},{'name':_0xe161('0xc'),'script':path[_0xe161('0x3')](__dirname,_0xe161('0xd')),'env':env},{'name':_0xe161('0xe'),'script':path[_0xe161('0x3')](__dirname,_0xe161('0xf')),'env':env},{'name':_0xe161('0x10'),'script':path['join'](__dirname,_0xe161('0x11')),'env':env}]};module[_0xe161('0x12')]=pm2config; \ No newline at end of file +var _0x6935=['../../services/routing/index.js','xdr','../../services/xdr/index.js','exports','../../config/environment','resolve','join','root','legacy-libs','../../services/express/index.js','ami','agi','../../services/agi/index.js','../../services/email/index.js','routing'];(function(_0x2220b2,_0x3620d5){var _0x3fc8b6=function(_0x20c322){while(--_0x20c322){_0x2220b2['push'](_0x2220b2['shift']());}};_0x3fc8b6(++_0x3620d5);}(_0x6935,0x1f3));var _0x5693=function(_0x5048d5,_0x5641cb){_0x5048d5=_0x5048d5-0x0;var _0x4af3bc=_0x6935[_0x5048d5];return _0x4af3bc;};'use strict';var path=require('path');var cfg=require(_0x5693('0x0'));var env={'NODE_PATH':path[_0x5693('0x1')](path[_0x5693('0x2')](cfg[_0x5693('0x3')],_0x5693('0x4')))};var pm2config={'apps':[{'name':'express','script':path[_0x5693('0x2')](__dirname,_0x5693('0x5')),'env':env},{'name':_0x5693('0x6'),'script':path[_0x5693('0x2')](__dirname,'../../services/ami/index.js'),'env':env},{'name':_0x5693('0x7'),'script':path[_0x5693('0x2')](__dirname,_0x5693('0x8')),'env':env},{'name':'email','script':path[_0x5693('0x2')](__dirname,_0x5693('0x9')),'env':env},{'name':_0x5693('0xa'),'script':path[_0x5693('0x2')](__dirname,_0x5693('0xb')),'env':env},{'name':_0x5693('0xc'),'script':path[_0x5693('0x2')](__dirname,_0x5693('0xd')),'env':env}]};module[_0x5693('0xe')]=pm2config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 6a721ba..f8440bd 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 _0x3ab9=['list','describe','dump','saved','pm2','bluebird','./config','connect','start','disconnect','stop','then','restart'];(function(_0x10e938,_0x3d860b){var _0x33d03c=function(_0x55ed75){while(--_0x55ed75){_0x10e938['push'](_0x10e938['shift']());}};_0x33d03c(++_0x3d860b);}(_0x3ab9,0x108));var _0x93ab=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3ab9[_0x3dd15e];return _0x231fd0;};'use strict';var pm2=require(_0x93ab('0x0'));var BPromise=require(_0x93ab('0x1'));var config=require(_0x93ab('0x2'));function connect(){return new BPromise(function(_0x3afb2e,_0x2a7bc8){return pm2[_0x93ab('0x3')](function(_0x1ce3d2){if(_0x1ce3d2){return _0x2a7bc8(_0x1ce3d2);}return _0x3afb2e('connected');});});};exports[_0x93ab('0x4')]=function(_0x1106e6){return connect()['then'](function(){return new BPromise(function(_0x35e693,_0x36f488){return pm2[_0x93ab('0x4')](_0x1106e6,function(_0x30e5c8,_0x5253af){if(_0x30e5c8){return _0x36f488(_0x30e5c8);}pm2[_0x93ab('0x5')]();return _0x35e693(_0x5253af);});});});};exports[_0x93ab('0x6')]=function(_0x230f3b){return connect()[_0x93ab('0x7')](function(){return new BPromise(function(_0xceec35,_0x106ec8){return pm2[_0x93ab('0x6')](_0x230f3b,function(_0x5b9442,_0x20da1d){if(_0x5b9442){return _0x106ec8(_0x5b9442);}pm2['disconnect']();return _0xceec35(_0x20da1d);});});});};exports[_0x93ab('0x8')]=function(_0xb54672){return connect()['then'](function(){return new BPromise(function(_0x21202a,_0x525451){return pm2[_0x93ab('0x8')](_0xb54672,function(_0x26c655,_0x190f9d){if(_0x26c655){return _0x525451(_0x26c655);}pm2[_0x93ab('0x5')]();return _0x21202a(_0x190f9d);});});});};exports[_0x93ab('0x9')]=function(){return connect()[_0x93ab('0x7')](function(){return new BPromise(function(_0x3ea6c7,_0x38327f){return pm2[_0x93ab('0x9')](function(_0x556e3e,_0x65b017){if(_0x556e3e){return _0x38327f(_0x556e3e);}pm2[_0x93ab('0x5')]();return _0x3ea6c7(_0x65b017);});});});};exports[_0x93ab('0xa')]=function(_0x17a67d){return connect()[_0x93ab('0x7')](function(){return new BPromise(function(_0x4ee7e3,_0xa5d0cd){return pm2['describe'](_0x17a67d,function(_0x16ea74,_0x214919){if(_0x16ea74){return _0xa5d0cd(_0x16ea74);}pm2[_0x93ab('0x5')]();return _0x4ee7e3(_0x214919);});});});};exports['delete']=function(_0x2edefa){return connect()[_0x93ab('0x7')](function(){return new BPromise(function(_0x27acf8,_0x1bfbc6){return pm2['delete'](_0x2edefa,function(_0x2ffe77,_0x2b3e54){if(_0x2ffe77){return _0x1bfbc6(_0x2ffe77);}pm2[_0x93ab('0x5')]();return _0x27acf8(_0x2b3e54);});});});};exports['dump']=function(){return connect()[_0x93ab('0x7')](function(){return new BPromise(function(_0x4073bb,_0x59ccc5){return pm2[_0x93ab('0xb')](function(_0x251f63){if(_0x251f63){return _0x59ccc5(_0x251f63);}return _0x4073bb(_0x93ab('0xc'));});});});}; \ No newline at end of file +var _0xa328=['describe','delete','dump','saved','pm2','bluebird','./config','connected','start','then','disconnect','stop','restart','list'];(function(_0x2f62aa,_0x108e95){var _0x1a341f=function(_0x3aedcf){while(--_0x3aedcf){_0x2f62aa['push'](_0x2f62aa['shift']());}};_0x1a341f(++_0x108e95);}(_0xa328,0x90));var _0x8a32=function(_0x2dbed7,_0x2962d5){_0x2dbed7=_0x2dbed7-0x0;var _0x326efc=_0xa328[_0x2dbed7];return _0x326efc;};'use strict';var pm2=require(_0x8a32('0x0'));var BPromise=require(_0x8a32('0x1'));var config=require(_0x8a32('0x2'));function connect(){return new BPromise(function(_0x3d257f,_0x50a3f5){return pm2['connect'](function(_0x54bd7f){if(_0x54bd7f){return _0x50a3f5(_0x54bd7f);}return _0x3d257f(_0x8a32('0x3'));});});};exports[_0x8a32('0x4')]=function(_0x342f41){return connect()[_0x8a32('0x5')](function(){return new BPromise(function(_0x4a1ade,_0x27c13a){return pm2[_0x8a32('0x4')](_0x342f41,function(_0x20e123,_0x2959c9){if(_0x20e123){return _0x27c13a(_0x20e123);}pm2[_0x8a32('0x6')]();return _0x4a1ade(_0x2959c9);});});});};exports[_0x8a32('0x7')]=function(_0x62382a){return connect()[_0x8a32('0x5')](function(){return new BPromise(function(_0x5f553e,_0x53aa87){return pm2[_0x8a32('0x7')](_0x62382a,function(_0x124502,_0x255844){if(_0x124502){return _0x53aa87(_0x124502);}pm2[_0x8a32('0x6')]();return _0x5f553e(_0x255844);});});});};exports['restart']=function(_0x465940){return connect()[_0x8a32('0x5')](function(){return new BPromise(function(_0x5148bd,_0x1ca145){return pm2[_0x8a32('0x8')](_0x465940,function(_0x2c2e4c,_0x2d1cd2){if(_0x2c2e4c){return _0x1ca145(_0x2c2e4c);}pm2['disconnect']();return _0x5148bd(_0x2d1cd2);});});});};exports[_0x8a32('0x9')]=function(){return connect()['then'](function(){return new BPromise(function(_0xf50849,_0x5c3faf){return pm2[_0x8a32('0x9')](function(_0x2c061a,_0x289c00){if(_0x2c061a){return _0x5c3faf(_0x2c061a);}pm2['disconnect']();return _0xf50849(_0x289c00);});});});};exports[_0x8a32('0xa')]=function(_0x13cc12){return connect()[_0x8a32('0x5')](function(){return new BPromise(function(_0x15b70b,_0x3adc8d){return pm2['describe'](_0x13cc12,function(_0x5d46c6,_0x5b1b9f){if(_0x5d46c6){return _0x3adc8d(_0x5d46c6);}pm2[_0x8a32('0x6')]();return _0x15b70b(_0x5b1b9f);});});});};exports[_0x8a32('0xb')]=function(_0x3b8f20){return connect()['then'](function(){return new BPromise(function(_0x10fb54,_0x3507f6){return pm2[_0x8a32('0xb')](_0x3b8f20,function(_0x44a1df,_0x588e9f){if(_0x44a1df){return _0x3507f6(_0x44a1df);}pm2[_0x8a32('0x6')]();return _0x10fb54(_0x588e9f);});});});};exports[_0x8a32('0xc')]=function(){return connect()[_0x8a32('0x5')](function(){return new BPromise(function(_0x24da39,_0x536933){return pm2[_0x8a32('0xc')](function(_0x4a404e){if(_0x4a404e){return _0x536933(_0x4a404e);}return _0x24da39(_0x8a32('0xd'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 43b5062..c771c93 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 _0xb10c=['timeout','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','start','lodash','moment','ioredis','../../config/environment','../../mysqldb','../logger','schedule','redis','localhost','socket.io-emitter','Setting','find','chatTimeout','then','ChatInteraction','findAll','lastMsgAt','minutes','length','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','system'];(function(_0x2fb87c,_0x2dee49){var _0x43038b=function(_0x7e5396){while(--_0x7e5396){_0x2fb87c['push'](_0x2fb87c['shift']());}};_0x43038b(++_0x2dee49);}(_0xb10c,0xf8));var _0xcb10=function(_0x422f63,_0x40bd6d){_0x422f63=_0x422f63-0x0;var _0x5c61e1=_0xb10c[_0x422f63];return _0x5c61e1;};'use strict';var _=require(_0xcb10('0x0'));var moment=require(_0xcb10('0x1'));var Redis=require(_0xcb10('0x2'));var util=require('util');var config=require(_0xcb10('0x3'));var db=require(_0xcb10('0x4'))['db'];var logger=require(_0xcb10('0x5'))(_0xcb10('0x6'));config[_0xcb10('0x7')]=_['defaults'](config['redis'],{'host':_0xcb10('0x8'),'port':0x18eb});var io=require(_0xcb10('0x9'))(new Redis(config[_0xcb10('0x7')]));function closeInteractions(){var _0x4ab714=0x0;var _0xecfd07=[];return db[_0xcb10('0xa')][_0xcb10('0xb')]({'raw':!![],'attributes':['id',_0xcb10('0xc')],'where':{'id':0x1}})[_0xcb10('0xd')](function(_0x34f4b4){_0x4ab714=_0x34f4b4[_0xcb10('0xc')];if(_0x4ab714){return db[_0xcb10('0xe')][_0xcb10('0xf')]({'raw':!![],'attributes':['id',_0xcb10('0x10')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0x34f4b4[_0xcb10('0xc')],_0xcb10('0x11'))}}});}else{return[];}})[_0xcb10('0xd')](function(_0x66e040){if(_0x66e040&&_0x66e040[_0xcb10('0x12')]){_0xecfd07=_[_0xcb10('0x13')](_0x66e040||[],'id');logger[_0xcb10('0x14')](_0xcb10('0x15'),_0xecfd07[_0xcb10('0x16')]());return db['ChatInteraction']['update']({'closeReason':_0xcb10('0x17'),'disposition':_0xcb10('0x18'),'closed':!![],'closedAt':moment()[_0xcb10('0x19')](_0xcb10('0x1a'))},{'where':{'id':_0xecfd07}});}})[_0xcb10('0xd')](function(){if(_0xecfd07&&_0xecfd07[_0xcb10('0x12')]){logger[_0xcb10('0x14')](_0xcb10('0x1b'),_0xecfd07[_0xcb10('0x16')]());for(var _0xbcc05f=0x0;_0xbcc05f<_0xecfd07[_0xcb10('0x12')];_0xbcc05f++){io[_0xcb10('0x1c')](_0xcb10('0x1d'),{'id':_0xecfd07[_0xbcc05f],'closed':!![]});}}})[_0xcb10('0x1e')](function(_0xff277c){logger[_0xcb10('0x1f')](_0xcb10('0x20'),_0xff277c?util['inspect'](_0xff277c,{'showHidden':![],'depth':null}):'');});}exports[_0xcb10('0x21')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x70a2=['chatTimeout','ChatInteraction','findAll','lastMsgAt','subtract','minutes','length','info','[CHAT]\x20Interactions\x20to\x20close:','join','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','catch','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','redis','localhost','socket.io-emitter','Setting','find','then'];(function(_0x115460,_0x36ac6e){var _0x28448f=function(_0x1e084b){while(--_0x1e084b){_0x115460['push'](_0x115460['shift']());}};_0x28448f(++_0x36ac6e);}(_0x70a2,0x82));var _0x270a=function(_0x429948,_0x1a6851){_0x429948=_0x429948-0x0;var _0x35d5d1=_0x70a2[_0x429948];return _0x35d5d1;};'use strict';var _=require(_0x270a('0x0'));var moment=require(_0x270a('0x1'));var Redis=require(_0x270a('0x2'));var util=require(_0x270a('0x3'));var config=require(_0x270a('0x4'));var db=require(_0x270a('0x5'))['db'];var logger=require(_0x270a('0x6'))(_0x270a('0x7'));config[_0x270a('0x8')]=_['defaults'](config['redis'],{'host':_0x270a('0x9'),'port':0x18eb});var io=require(_0x270a('0xa'))(new Redis(config[_0x270a('0x8')]));function closeInteractions(){var _0x1d385d=0x0;var _0xc987a5=[];return db[_0x270a('0xb')][_0x270a('0xc')]({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})[_0x270a('0xd')](function(_0x1c2163){_0x1d385d=_0x1c2163[_0x270a('0xe')];if(_0x1d385d){return db[_0x270a('0xf')][_0x270a('0x10')]({'raw':!![],'attributes':['id',_0x270a('0x11')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x270a('0x12')](_0x1c2163['chatTimeout'],_0x270a('0x13'))}}});}else{return[];}})['then'](function(_0x1f7392){if(_0x1f7392&&_0x1f7392[_0x270a('0x14')]){_0xc987a5=_['map'](_0x1f7392||[],'id');logger[_0x270a('0x15')](_0x270a('0x16'),_0xc987a5[_0x270a('0x17')]());return db['ChatInteraction'][_0x270a('0x18')]({'closeReason':_0x270a('0x19'),'disposition':_0x270a('0x1a'),'closed':!![],'closedAt':moment()[_0x270a('0x1b')](_0x270a('0x1c'))},{'where':{'id':_0xc987a5}});}})['then'](function(){if(_0xc987a5&&_0xc987a5[_0x270a('0x14')]){logger['info'](_0x270a('0x1d'),_0xc987a5[_0x270a('0x17')]());for(var _0x57c0ba=0x0;_0x57c0ba<_0xc987a5['length'];_0x57c0ba++){io[_0x270a('0x1e')](_0x270a('0x1f'),{'id':_0xc987a5[_0x57c0ba],'closed':!![]});}}})[_0x270a('0x20')](function(_0x1abea3){logger['error'](_0x270a('0x21'),_0x1abea3?util[_0x270a('0x22')](_0x1abea3,{'showHidden':![],'depth':null}):'');});}exports[_0x270a('0x23')]=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 945f933..f91f78d 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 _0xd164=['../../api/cloudProvider/cloudProvider.oauth.js','startAllRefreshIntervals'];(function(_0x2ff10b,_0x527246){var _0x5b617c=function(_0x8455b9){while(--_0x8455b9){_0x2ff10b['push'](_0x2ff10b['shift']());}};_0x5b617c(++_0x527246);}(_0xd164,0xb4));var _0x4d16=function(_0x32f290,_0x3d3677){_0x32f290=_0x32f290-0x0;var _0x20b1c9=_0xd164[_0x32f290];return _0x20b1c9;};'use strict';function start(){var _0x24ebca=require(_0x4d16('0x0'));return _0x24ebca[_0x4d16('0x1')]();}module['exports']={'intervals':{},'start':start}; \ No newline at end of file +var _0xb0d1=['exports','../../api/cloudProvider/cloudProvider.oauth.js'];(function(_0x4b3fe8,_0x185cf7){var _0x2e053f=function(_0x4e9654){while(--_0x4e9654){_0x4b3fe8['push'](_0x4b3fe8['shift']());}};_0x2e053f(++_0x185cf7);}(_0xb0d1,0x6b));var _0x1b0d=function(_0xaf346e,_0x400dcd){_0xaf346e=_0xaf346e-0x0;var _0xbd4467=_0xb0d1[_0xaf346e];return _0xbd4467;};'use strict';function start(){var _0x478bc2=require(_0x1b0d('0x0'));return _0x478bc2['startAllRefreshIntervals']();}module[_0x1b0d('0x1')]={'intervals':{},'start':start}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index bc66c07..959ae1c 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 _0xa5b8=['CloudProvider','keys','map','toString','keyBy','intersection','length','deleteJob','toRun','resolve','run\x20job','cron','active','isBetween','startAt','endAt','start','add\x20cron','exists','stop\x20cron','update','update\x20cron','run','path','moment','cron-job-manager','../logger','schedule','../../mysqldb','retry','../../api/analyticCustomReport/analyticCustomReport.controller','client','http','number','AnalyticExtractedReport','findOne','then','catch','error','info','Try\x20to\x20send\x20a\x20mail\x20to','getSmtpOptions','\x22%s\x22\x20<%s>','MailAccount','name','email','Smtp','user','format','Report\x20%s\x20last\x20%s\x20%s','join','savename','%s.%s','basename','zip','existsSync','Sent','text','stringify','status','message','attachments','Empty','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','Report\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','Failed','Report\x20extraction\x20procedure\x20has\x20run\x20into\x20an\x20unexpected\x20error.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','request','SendMail','email\x20sent','error\x20mail','case\x20loading','currentAttempt','retryOptions','job','operation','stop','still\x20loading','data','case\x20empty','case\x20failed','entity','dataValues','Job\x20ID\x20','report\x20status:','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit','subtractUnit\x20null\x20or\x20undefined','subtract','subtractNumber','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','CustomReportId','exec\x20custom\x20report\x20id:%s','runReport','findAll','MailServerOut'];(function(_0x25e07b,_0x2b6768){var _0x4aeb1d=function(_0x317c50){while(--_0x317c50){_0x25e07b['push'](_0x25e07b['shift']());}};_0x4aeb1d(++_0x2b6768);}(_0xa5b8,0x7d));var _0x8a5b=function(_0x1b4b10,_0x505517){_0x1b4b10=_0x1b4b10-0x0;var _0x28c0b6=_0xa5b8[_0x1b4b10];return _0x28c0b6;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0x8a5b('0x0'));var _=require('lodash');var moment=require(_0x8a5b('0x1'));var CronJobManager=require(_0x8a5b('0x2'));var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0x8a5b('0x3'))(_0x8a5b('0x4'));var db=require(_0x8a5b('0x5'))['db'];const retry=require(_0x8a5b('0x6'));var analyticCustomReportController=require(_0x8a5b('0x7'));var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson[_0x8a5b('0x8')][_0x8a5b('0x9')]({'port':0x232b});var manager=new CronJobManager();function getReportData(_0x1d364c){const _0x2afaee={};if(typeof _0x1d364c===_0x8a5b('0xa')){_0x2afaee['id']=_0x1d364c;}return db[_0x8a5b('0xb')][_0x8a5b('0xc')]({'where':_0x2afaee})[_0x8a5b('0xd')](function(_0x5c1e13){return _0x5c1e13;})[_0x8a5b('0xe')](function(_0x1b7b72){logger[_0x8a5b('0xf')](_0x1b7b72);});}function handleSendEmail(_0x5566e5,_0x261197){logger[_0x8a5b('0x10')](_0x8a5b('0x11'),_0x5566e5['email']);var _0x10fd7a=!![];var _0x3442bc=_0x5566e5['MailAccount'][_0x8a5b('0x12')]();var _0x57243b={'account':_0x3442bc,'message':{'from':util['format'](_0x8a5b('0x13'),_0x5566e5[_0x8a5b('0x14')][_0x8a5b('0x15')],_0x5566e5[_0x8a5b('0x14')][_0x8a5b('0x16')]||_0x5566e5[_0x8a5b('0x14')][_0x8a5b('0x17')][_0x8a5b('0x18')]),'to':_0x5566e5[_0x8a5b('0x16')],'cc':_0x5566e5['cc'],'bcc':_0x5566e5['bcc'],'subject':util[_0x8a5b('0x19')](_0x8a5b('0x1a'),_0x261197[_0x8a5b('0x15')],_0x5566e5['subtractNumber'],_0x5566e5['subtractUnit'])}};var _0x44c8c4=path[_0x8a5b('0x1b')](__dirname,'../../files/reports');var _0x3bde05=_0x261197[_0x8a5b('0x1c')];var _0xca21d7=util['format'](_0x8a5b('0x1d'),path[_0x8a5b('0x1e')](_0x261197[_0x8a5b('0x1c')],path['extname'](_0x261197[_0x8a5b('0x1c')])),_0x8a5b('0x1f'));var _0x218d66=path[_0x8a5b('0x1b')](_0x44c8c4,_0x3bde05);var _0x453091=path[_0x8a5b('0x1b')](_0x44c8c4,_0xca21d7);if(fs[_0x8a5b('0x20')](_0x218d66)){_0x261197['status']=_0x8a5b('0x21');_0x57243b['message']['attachments']=[{'filename':_0x3bde05,'path':_0x218d66}];_0x57243b['message'][_0x8a5b('0x22')]=util[_0x8a5b('0x19')]('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON[_0x8a5b('0x23')](_0x261197,null,0x2));}else if(fs[_0x8a5b('0x20')](_0x453091)){_0x261197[_0x8a5b('0x24')]='Sent';_0x57243b[_0x8a5b('0x25')][_0x8a5b('0x26')]=[{'filename':_0xca21d7,'path':_0x453091}];}else{if(_0x261197[_0x8a5b('0x24')]===_0x8a5b('0x27')){_0x57243b['message'][_0x8a5b('0x22')]=_0x8a5b('0x28');if(!_0x5566e5[_0x8a5b('0x29')]){_0x10fd7a=![];logger[_0x8a5b('0x10')]('empty\x20file,\x20email\x20not\x20sent');}}else if(_0x261197['status']==='Loading'){_0x57243b['message'][_0x8a5b('0x22')]=_0x8a5b('0x2a');}else if(_0x261197[_0x8a5b('0x24')]==='Completed'){_0x57243b[_0x8a5b('0x25')][_0x8a5b('0x22')]='Report\x20file\x20creation\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';}else if(_0x261197[_0x8a5b('0x24')]===_0x8a5b('0x2b')){_0x57243b[_0x8a5b('0x25')][_0x8a5b('0x22')]=_0x8a5b('0x2c');}else{logger[_0x8a5b('0xf')]('[handleSendEmail]\x20Unrecognized\x20status:',_0x261197['status']);}}if(_0x10fd7a){return client[_0x8a5b('0x2d')](_0x8a5b('0x2e'),_0x57243b)[_0x8a5b('0xd')](function(_0x1fc3bc){if(_0x1fc3bc[_0x8a5b('0xf')]){return logger[_0x8a5b('0xf')]('error\x20mail',JSON[_0x8a5b('0x23')](_0x1fc3bc));}return logger[_0x8a5b('0x10')](_0x8a5b('0x2f'));})[_0x8a5b('0xe')](function(_0x4ffd29){return logger[_0x8a5b('0xf')](_0x8a5b('0x30'),JSON[_0x8a5b('0x23')](_0x4ffd29));});}}function handleError(){return function(_0x622588){return logger['error'](JSON['stringify'](_0x622588));};}function loading(_0x1a9751){logger[_0x8a5b('0x10')](_0x8a5b('0x31'));if(_0x1a9751[_0x8a5b('0x32')]===_0x1a9751[_0x8a5b('0x33')]['retries']){handleSendEmail(_0x1a9751[_0x8a5b('0x34')],_0x1a9751['data']);_0x1a9751[_0x8a5b('0x35')][_0x8a5b('0x36')]();}else{_0x1a9751[_0x8a5b('0x35')][_0x8a5b('0x6')](_0x8a5b('0x37'));}}function completed(_0xd95c53){logger[_0x8a5b('0x10')]('case\x20completed');handleSendEmail(_0xd95c53[_0x8a5b('0x34')],_0xd95c53[_0x8a5b('0x38')]);_0xd95c53[_0x8a5b('0x35')][_0x8a5b('0x36')]();}function empty(_0xc4741a){logger['info'](_0x8a5b('0x39'));handleSendEmail(_0xc4741a[_0x8a5b('0x34')],_0xc4741a['data']);_0xc4741a[_0x8a5b('0x35')][_0x8a5b('0x36')]();}function failed(_0x4ddc51){logger['info'](_0x8a5b('0x3a'));handleSendEmail(_0x4ddc51['job'],_0x4ddc51['data']);_0x4ddc51[_0x8a5b('0x35')][_0x8a5b('0x36')]();}function urecognized(_0x1e8921){logger[_0x8a5b('0xf')]('Unrecognized\x20status:',_0x1e8921[_0x8a5b('0x3b')][_0x8a5b('0x3c')][_0x8a5b('0x24')]);_0x1e8921[_0x8a5b('0x35')][_0x8a5b('0x36')]();}const reportStatusStrategies={'Loading':loading,'Completed':completed,'Empty':empty,'Failed':failed,'Unrecognized':urecognized};function retryer(_0xa97f41,_0x5920c1){const _0x2dd56c={'retries':0x3,'factor':0x2,'minTimeout':0x5b*0x3e8,'maxTimeout':0xa*0x3c*0x3e8};const _0x536832=retry[_0x8a5b('0x35')](_0x2dd56c);_0x536832['attempt'](_0x9608b9=>{logger[_0x8a5b('0x10')](_0x8a5b('0x3d')+_0xa97f41['id']+'\x20Attempt\x20#:'+_0x9608b9);try{getReportData(_0x5920c1['id'])[_0x8a5b('0xd')](function(_0x588465){_0x5920c1=_0x588465;logger['info'](_0x8a5b('0x3e'),_0x588465[_0x8a5b('0x3c')][_0x8a5b('0x24')]);if(!reportStatusStrategies[_0x588465[_0x8a5b('0x3c')][_0x8a5b('0x24')]]){logger[_0x8a5b('0xf')]('report\x20status:',_0x588465[_0x8a5b('0x3c')]['status']);_0x536832[_0x8a5b('0x6')]();}reportStatusStrategies[_0x588465[_0x8a5b('0x3c')][_0x8a5b('0x24')]]({'operation':_0x536832,'currentAttempt':_0x9608b9,'retryOptions':_0x2dd56c,'job':_0xa97f41,'data':_0x5920c1,'entity':_0x588465});});}catch(_0x5070b1){_0x536832[_0x8a5b('0x6')](_0x5070b1);}});}function handleResult(_0x22c116){return function(_0x3d13ea){if(_0x22c116['sendMail']&&_0x22c116[_0x8a5b('0x14')]&&_0x22c116['MailAccount'][_0x8a5b('0x17')]&&!_[_0x8a5b('0x3f')](_0x22c116[_0x8a5b('0x16')])){retryer(_0x22c116,_0x3d13ea);}};}function handleJob(_0x172dca){return function(){try{if(_[_0x8a5b('0x3f')](_0x172dca['subtractNumber'])){return logger[_0x8a5b('0x10')](_0x8a5b('0x40'));}if(_[_0x8a5b('0x3f')](_0x172dca[_0x8a5b('0x41')])){return logger[_0x8a5b('0x10')](_0x8a5b('0x42'));}var _0x2e73c7={'startDate':moment()[_0x8a5b('0x43')](_0x172dca[_0x8a5b('0x44')],_0x172dca['subtractUnit'])['format'](_0x8a5b('0x45')),'endDate':moment()[_0x8a5b('0x19')](_0x8a5b('0x45')),'type':_0x8a5b('0x46'),'output':_0x172dca[_0x8a5b('0x47')],'name':_0x172dca[_0x8a5b('0x15')]};if(!_[_0x8a5b('0x3f')](_0x172dca[_0x8a5b('0x48')])){logger[_0x8a5b('0x10')](_0x8a5b('0x49'),_0x172dca[_0x8a5b('0x48')]);return analyticDefaultReportController['runReport']({'id':_0x172dca['DefaultReportId']},_0x2e73c7)[_0x8a5b('0xd')](handleResult(_0x172dca))[_0x8a5b('0xe')](handleError());}if(!_['isNil'](_0x172dca[_0x8a5b('0x4a')])){logger['info'](_0x8a5b('0x4b'),_0x172dca[_0x8a5b('0x4a')]);return analyticCustomReportController[_0x8a5b('0x4c')]({'id':_0x172dca[_0x8a5b('0x4a')]},_0x2e73c7)[_0x8a5b('0xd')](handleResult(_0x172dca))[_0x8a5b('0xe')](handleError());}}catch(_0x54eb90){logger[_0x8a5b('0xf')](JSON['stringify'](_0x54eb90));}return logger[_0x8a5b('0x10')]('no\x20report\x20id');};}function getJobs(_0x5241f9){var _0x18f7e8={};if(_0x5241f9){_0x18f7e8['id']=_0x5241f9;}return db['Schedule'][_0x8a5b('0x4d')]({'where':_0x18f7e8,'include':[{'model':db[_0x8a5b('0x14')],'attributes':['id',_0x8a5b('0x15'),_0x8a5b('0x16')],'include':[{'model':db[_0x8a5b('0x4e')],'as':_0x8a5b('0x17'),'include':[{'model':db[_0x8a5b('0x4f')],'as':'CloudProvider'}]}]}]})[_0x8a5b('0xd')](function(_0x4c8435){var _0x2771f4=_[_0x8a5b('0x50')](manager['jobs']);var _0x254b67=_[_0x8a5b('0x51')](_0x4c8435,function(_0x55d06d){return _0x55d06d['id'][_0x8a5b('0x52')]();});var _0x2d19c9=_[_0x8a5b('0x53')](_0x4c8435,function(_0x48c938){return _0x48c938['id']['toString']();});var _0x3937ff=_0x5241f9?_0x254b67:_['difference'](_0x254b67,_0x2771f4);var _0x1ffde0=_[_0x8a5b('0x54')](_0x254b67,_0x2771f4);var _0x421263=_['difference'](_0x2771f4,_0x254b67);var _0x1ed21a;var _0x54a8ac;for(_0x1ed21a=0x0;_0x1ed21a<_0x421263[_0x8a5b('0x55')]&&!_0x5241f9;_0x1ed21a+=0x1){_0x54a8ac=_0x421263[_0x1ed21a][_0x8a5b('0x52')]();if(manager['exists'](_0x54a8ac)){manager[_0x8a5b('0x36')](_0x54a8ac);manager[_0x8a5b('0x56')](_0x54a8ac);logger[_0x8a5b('0x10')]('delete\x20cron',_0x54a8ac);}}logger[_0x8a5b('0x10')](_0x8a5b('0x57'),JSON[_0x8a5b('0x23')](_0x3937ff));for(_0x1ed21a=0x0;_0x1ed21a<_0x3937ff['length'];_0x1ed21a+=0x1){_0x54a8ac=_0x3937ff[_0x1ed21a][_0x8a5b('0x52')]();if(_0x5241f9){logger['info'](JSON[_0x8a5b('0x23')](_0x2d19c9[_0x54a8ac]));BPromise[_0x8a5b('0x58')]()[_0x8a5b('0xd')](handleJob(_0x2d19c9[_0x54a8ac]));logger[_0x8a5b('0x10')](_0x8a5b('0x59'),_0x2d19c9[_0x54a8ac][_0x8a5b('0x15')],_0x2d19c9[_0x54a8ac][_0x8a5b('0x5a')]);}else if(_0x2d19c9[_0x54a8ac][_0x8a5b('0x5a')]&&_0x2d19c9[_0x54a8ac][_0x8a5b('0x5b')]&&moment()[_0x8a5b('0x5c')](_0x2d19c9[_0x54a8ac][_0x8a5b('0x5d')],_0x2d19c9[_0x54a8ac][_0x8a5b('0x5e')])){manager['add'](_0x54a8ac,_0x2d19c9[_0x54a8ac][_0x8a5b('0x5a')],handleJob(_0x2d19c9[_0x54a8ac]));manager[_0x8a5b('0x5f')](_0x54a8ac);logger[_0x8a5b('0x10')](_0x8a5b('0x60'),_0x2d19c9[_0x54a8ac][_0x8a5b('0x15')],_0x2d19c9[_0x54a8ac][_0x8a5b('0x5a')]);}else if(manager[_0x8a5b('0x61')](_0x54a8ac)){manager[_0x8a5b('0x36')](_0x54a8ac);manager['deleteJob'](_0x54a8ac);logger[_0x8a5b('0x10')](_0x8a5b('0x62'),_0x2d19c9[_0x54a8ac][_0x8a5b('0x15')],_0x2d19c9[_0x54a8ac][_0x8a5b('0x5a')]);}}for(_0x1ed21a=0x0,_0x54a8ac;_0x1ed21a<_0x1ffde0[_0x8a5b('0x55')]&&!_0x5241f9;_0x1ed21a+=0x1){_0x54a8ac=_0x1ffde0[_0x1ed21a][_0x8a5b('0x52')]();if(manager['exists'](_0x54a8ac)){if(_0x2d19c9[_0x54a8ac][_0x8a5b('0x5a')]&&_0x2d19c9[_0x54a8ac]['active']&&moment()[_0x8a5b('0x5c')](_0x2d19c9[_0x54a8ac][_0x8a5b('0x5d')],_0x2d19c9[_0x54a8ac][_0x8a5b('0x5e')])){manager[_0x8a5b('0x63')](_0x54a8ac,_0x2d19c9[_0x54a8ac][_0x8a5b('0x5a')],handleJob(_0x2d19c9[_0x54a8ac]));logger[_0x8a5b('0x10')](_0x8a5b('0x64'),_0x2d19c9[_0x54a8ac][_0x8a5b('0x15')],_0x2d19c9[_0x54a8ac][_0x8a5b('0x5a')]);}else{manager[_0x8a5b('0x36')](_0x54a8ac);manager[_0x8a5b('0x56')](_0x54a8ac);logger[_0x8a5b('0x10')]('stop\x20cron',_0x2d19c9[_0x54a8ac][_0x8a5b('0x15')],_0x2d19c9[_0x54a8ac][_0x8a5b('0x5a')]);}}}})[_0x8a5b('0xe')](function(_0x4ff645){logger['error'](JSON[_0x8a5b('0x23')](_0x4ff645));});}exports[_0x8a5b('0x65')]=function(_0x50ec04){return getJobs(_0x50ec04);};exports['start']=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x175b=['DefaultReportId','exec\x20defaul\x20report\x20id:%s','exec\x20custom\x20report\x20id:%s','CustomReportId','runReport','no\x20report\x20id','Schedule','MailServerOut','CloudProvider','keys','toString','difference','intersection','exists','deleteJob','delete\x20cron','toRun','length','resolve','cron','startAt','add\x20cron','active','update','update\x20cron','run','start','util','path','lodash','moment','cron-job-manager','../logger','schedule','../../mysqldb','retry','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','number','AnalyticExtractedReport','findOne','error','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','getSmtpOptions','format','\x22%s\x22\x20<%s>','name','Smtp','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractUnit','join','../../files/reports','savename','extname','zip','status','message','attachments','text','stringify','Sent','Empty','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','Loading','Report\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','Failed','Report\x20extraction\x20procedure\x20has\x20run\x20into\x20an\x20unexpected\x20error.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','request','SendMail','then','error\x20mail','email\x20sent','catch','case\x20loading','currentAttempt','retryOptions','retries','job','data','operation','still\x20loading','case\x20completed','stop','case\x20empty','Unrecognized\x20status:','entity','dataValues','Job\x20ID\x20','report\x20status:','sendMail','isNil','subtractNumber\x20null\x20or\x20undefined','subtract','subtractNumber','YYYY-MM-DD\x20HH:mm:ss','scheduled'];(function(_0x4394f7,_0x43ee7b){var _0x340a66=function(_0xf8aee8){while(--_0xf8aee8){_0x4394f7['push'](_0x4394f7['shift']());}};_0x340a66(++_0x43ee7b);}(_0x175b,0x81));var _0xb175=function(_0x15c5b8,_0x3b670f){_0x15c5b8=_0x15c5b8-0x0;var _0xd45fe6=_0x175b[_0x15c5b8];return _0xd45fe6;};'use strict';var fs=require('fs');var util=require(_0xb175('0x0'));var path=require(_0xb175('0x1'));var _=require(_0xb175('0x2'));var moment=require(_0xb175('0x3'));var CronJobManager=require(_0xb175('0x4'));var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0xb175('0x5'))(_0xb175('0x6'));var db=require(_0xb175('0x7'))['db'];const retry=require(_0xb175('0x8'));var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require(_0xb175('0x9'));var client=jayson[_0xb175('0xa')][_0xb175('0xb')]({'port':0x232b});var manager=new CronJobManager();function getReportData(_0x1aa5d6){const _0x845f45={};if(typeof _0x1aa5d6===_0xb175('0xc')){_0x845f45['id']=_0x1aa5d6;}return db[_0xb175('0xd')][_0xb175('0xe')]({'where':_0x845f45})['then'](function(_0x15fb84){return _0x15fb84;})['catch'](function(_0x343087){logger[_0xb175('0xf')](_0x343087);});}function handleSendEmail(_0x4129d6,_0x173f11){logger[_0xb175('0x10')](_0xb175('0x11'),_0x4129d6[_0xb175('0x12')]);var _0xb8e60c=!![];var _0x1eefec=_0x4129d6[_0xb175('0x13')][_0xb175('0x14')]();var _0x17e86c={'account':_0x1eefec,'message':{'from':util[_0xb175('0x15')](_0xb175('0x16'),_0x4129d6[_0xb175('0x13')][_0xb175('0x17')],_0x4129d6[_0xb175('0x13')][_0xb175('0x12')]||_0x4129d6[_0xb175('0x13')][_0xb175('0x18')]['user']),'to':_0x4129d6[_0xb175('0x12')],'cc':_0x4129d6['cc'],'bcc':_0x4129d6[_0xb175('0x19')],'subject':util[_0xb175('0x15')](_0xb175('0x1a'),_0x173f11[_0xb175('0x17')],_0x4129d6['subtractNumber'],_0x4129d6[_0xb175('0x1b')])}};var _0x518c6e=path[_0xb175('0x1c')](__dirname,_0xb175('0x1d'));var _0x47d67a=_0x173f11['savename'];var _0x509ecb=util[_0xb175('0x15')]('%s.%s',path['basename'](_0x173f11[_0xb175('0x1e')],path[_0xb175('0x1f')](_0x173f11[_0xb175('0x1e')])),_0xb175('0x20'));var _0xeac425=path[_0xb175('0x1c')](_0x518c6e,_0x47d67a);var _0x413518=path[_0xb175('0x1c')](_0x518c6e,_0x509ecb);if(fs['existsSync'](_0xeac425)){_0x173f11[_0xb175('0x21')]='Sent';_0x17e86c[_0xb175('0x22')][_0xb175('0x23')]=[{'filename':_0x47d67a,'path':_0xeac425}];_0x17e86c['message'][_0xb175('0x24')]=util[_0xb175('0x15')]('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON[_0xb175('0x25')](_0x173f11,null,0x2));}else if(fs['existsSync'](_0x413518)){_0x173f11['status']=_0xb175('0x26');_0x17e86c['message']['attachments']=[{'filename':_0x509ecb,'path':_0x413518}];}else{if(_0x173f11[_0xb175('0x21')]===_0xb175('0x27')){_0x17e86c[_0xb175('0x22')]['text']=_0xb175('0x28');if(!_0x4129d6[_0xb175('0x29')]){_0xb8e60c=![];logger[_0xb175('0x10')]('empty\x20file,\x20email\x20not\x20sent');}}else if(_0x173f11[_0xb175('0x21')]===_0xb175('0x2a')){_0x17e86c['message']['text']=_0xb175('0x2b');}else if(_0x173f11[_0xb175('0x21')]==='Completed'){_0x17e86c[_0xb175('0x22')][_0xb175('0x24')]='Report\x20file\x20creation\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';}else if(_0x173f11[_0xb175('0x21')]===_0xb175('0x2c')){_0x17e86c['message'][_0xb175('0x24')]=_0xb175('0x2d');}else{logger[_0xb175('0xf')]('[handleSendEmail]\x20Unrecognized\x20status:',_0x173f11[_0xb175('0x21')]);}}if(_0xb8e60c){return client[_0xb175('0x2e')](_0xb175('0x2f'),_0x17e86c)[_0xb175('0x30')](function(_0x5d9d41){if(_0x5d9d41[_0xb175('0xf')]){return logger[_0xb175('0xf')](_0xb175('0x31'),JSON['stringify'](_0x5d9d41));}return logger[_0xb175('0x10')](_0xb175('0x32'));})[_0xb175('0x33')](function(_0x4f73d3){return logger[_0xb175('0xf')](_0xb175('0x31'),JSON['stringify'](_0x4f73d3));});}}function handleError(){return function(_0x565998){return logger[_0xb175('0xf')](JSON[_0xb175('0x25')](_0x565998));};}function loading(_0x4e2bde){logger[_0xb175('0x10')](_0xb175('0x34'));if(_0x4e2bde[_0xb175('0x35')]===_0x4e2bde[_0xb175('0x36')][_0xb175('0x37')]){handleSendEmail(_0x4e2bde[_0xb175('0x38')],_0x4e2bde[_0xb175('0x39')]);_0x4e2bde[_0xb175('0x3a')]['stop']();}else{_0x4e2bde[_0xb175('0x3a')][_0xb175('0x8')](_0xb175('0x3b'));}}function completed(_0x50dbb3){logger[_0xb175('0x10')](_0xb175('0x3c'));handleSendEmail(_0x50dbb3['job'],_0x50dbb3[_0xb175('0x39')]);_0x50dbb3[_0xb175('0x3a')][_0xb175('0x3d')]();}function empty(_0x581ac8){logger[_0xb175('0x10')](_0xb175('0x3e'));handleSendEmail(_0x581ac8['job'],_0x581ac8['data']);_0x581ac8[_0xb175('0x3a')][_0xb175('0x3d')]();}function failed(_0x6e9c64){logger[_0xb175('0x10')]('case\x20failed');handleSendEmail(_0x6e9c64[_0xb175('0x38')],_0x6e9c64[_0xb175('0x39')]);_0x6e9c64[_0xb175('0x3a')][_0xb175('0x3d')]();}function urecognized(_0x2678cf){logger[_0xb175('0xf')](_0xb175('0x3f'),_0x2678cf[_0xb175('0x40')][_0xb175('0x41')][_0xb175('0x21')]);_0x2678cf[_0xb175('0x3a')][_0xb175('0x3d')]();}const reportStatusStrategies={'Loading':loading,'Completed':completed,'Empty':empty,'Failed':failed,'Unrecognized':urecognized};function retryer(_0x546076,_0x29a82){const _0x5dd4bd={'retries':0x3,'factor':0x2,'minTimeout':0x5b*0x3e8,'maxTimeout':0xa*0x3c*0x3e8};const _0x3df79f=retry['operation'](_0x5dd4bd);_0x3df79f['attempt'](_0x295858=>{logger[_0xb175('0x10')](_0xb175('0x42')+_0x546076['id']+'\x20Attempt\x20#:'+_0x295858);try{getReportData(_0x29a82['id'])[_0xb175('0x30')](function(_0x58ab21){_0x29a82=_0x58ab21;logger['info'](_0xb175('0x43'),_0x58ab21[_0xb175('0x41')][_0xb175('0x21')]);if(!reportStatusStrategies[_0x58ab21[_0xb175('0x41')][_0xb175('0x21')]]){logger[_0xb175('0xf')]('report\x20status:',_0x58ab21[_0xb175('0x41')][_0xb175('0x21')]);_0x3df79f[_0xb175('0x8')]();}reportStatusStrategies[_0x58ab21[_0xb175('0x41')][_0xb175('0x21')]]({'operation':_0x3df79f,'currentAttempt':_0x295858,'retryOptions':_0x5dd4bd,'job':_0x546076,'data':_0x29a82,'entity':_0x58ab21});});}catch(_0x3da4c1){_0x3df79f[_0xb175('0x8')](_0x3da4c1);}});}function handleResult(_0x3156c8){return function(_0x3caa65){if(_0x3156c8[_0xb175('0x44')]&&_0x3156c8['MailAccount']&&_0x3156c8[_0xb175('0x13')][_0xb175('0x18')]&&!_[_0xb175('0x45')](_0x3156c8[_0xb175('0x12')])){retryer(_0x3156c8,_0x3caa65);}};}function handleJob(_0xf6f01){return function(){try{if(_[_0xb175('0x45')](_0xf6f01['subtractNumber'])){return logger[_0xb175('0x10')](_0xb175('0x46'));}if(_[_0xb175('0x45')](_0xf6f01['subtractUnit'])){return logger[_0xb175('0x10')]('subtractUnit\x20null\x20or\x20undefined');}var _0x3636c1={'startDate':moment()[_0xb175('0x47')](_0xf6f01[_0xb175('0x48')],_0xf6f01[_0xb175('0x1b')])[_0xb175('0x15')]('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()[_0xb175('0x15')](_0xb175('0x49')),'type':_0xb175('0x4a'),'output':_0xf6f01['output'],'name':_0xf6f01[_0xb175('0x17')]};if(!_[_0xb175('0x45')](_0xf6f01[_0xb175('0x4b')])){logger[_0xb175('0x10')](_0xb175('0x4c'),_0xf6f01['DefaultReportId']);return analyticDefaultReportController['runReport']({'id':_0xf6f01[_0xb175('0x4b')]},_0x3636c1)[_0xb175('0x30')](handleResult(_0xf6f01))[_0xb175('0x33')](handleError());}if(!_[_0xb175('0x45')](_0xf6f01['CustomReportId'])){logger[_0xb175('0x10')](_0xb175('0x4d'),_0xf6f01[_0xb175('0x4e')]);return analyticCustomReportController[_0xb175('0x4f')]({'id':_0xf6f01['CustomReportId']},_0x3636c1)[_0xb175('0x30')](handleResult(_0xf6f01))[_0xb175('0x33')](handleError());}}catch(_0xbfb668){logger['error'](JSON[_0xb175('0x25')](_0xbfb668));}return logger['info'](_0xb175('0x50'));};}function getJobs(_0x530680){var _0x95d2b9={};if(_0x530680){_0x95d2b9['id']=_0x530680;}return db[_0xb175('0x51')]['findAll']({'where':_0x95d2b9,'include':[{'model':db[_0xb175('0x13')],'attributes':['id',_0xb175('0x17'),'email'],'include':[{'model':db[_0xb175('0x52')],'as':_0xb175('0x18'),'include':[{'model':db[_0xb175('0x53')],'as':_0xb175('0x53')}]}]}]})['then'](function(_0xa04c8f){var _0x10982c=_[_0xb175('0x54')](manager['jobs']);var _0x433c44=_['map'](_0xa04c8f,function(_0x441a3c){return _0x441a3c['id'][_0xb175('0x55')]();});var _0x6424e5=_['keyBy'](_0xa04c8f,function(_0x472e5b){return _0x472e5b['id'][_0xb175('0x55')]();});var _0x58f98c=_0x530680?_0x433c44:_[_0xb175('0x56')](_0x433c44,_0x10982c);var _0x1ac547=_[_0xb175('0x57')](_0x433c44,_0x10982c);var _0x537930=_[_0xb175('0x56')](_0x10982c,_0x433c44);var _0x59704f;var _0xbaf20b;for(_0x59704f=0x0;_0x59704f<_0x537930['length']&&!_0x530680;_0x59704f+=0x1){_0xbaf20b=_0x537930[_0x59704f][_0xb175('0x55')]();if(manager[_0xb175('0x58')](_0xbaf20b)){manager[_0xb175('0x3d')](_0xbaf20b);manager[_0xb175('0x59')](_0xbaf20b);logger[_0xb175('0x10')](_0xb175('0x5a'),_0xbaf20b);}}logger[_0xb175('0x10')](_0xb175('0x5b'),JSON['stringify'](_0x58f98c));for(_0x59704f=0x0;_0x59704f<_0x58f98c[_0xb175('0x5c')];_0x59704f+=0x1){_0xbaf20b=_0x58f98c[_0x59704f][_0xb175('0x55')]();if(_0x530680){logger[_0xb175('0x10')](JSON[_0xb175('0x25')](_0x6424e5[_0xbaf20b]));BPromise[_0xb175('0x5d')]()[_0xb175('0x30')](handleJob(_0x6424e5[_0xbaf20b]));logger['info']('run\x20job',_0x6424e5[_0xbaf20b]['name'],_0x6424e5[_0xbaf20b][_0xb175('0x5e')]);}else if(_0x6424e5[_0xbaf20b]['cron']&&_0x6424e5[_0xbaf20b]['active']&&moment()['isBetween'](_0x6424e5[_0xbaf20b][_0xb175('0x5f')],_0x6424e5[_0xbaf20b]['endAt'])){manager['add'](_0xbaf20b,_0x6424e5[_0xbaf20b][_0xb175('0x5e')],handleJob(_0x6424e5[_0xbaf20b]));manager['start'](_0xbaf20b);logger[_0xb175('0x10')](_0xb175('0x60'),_0x6424e5[_0xbaf20b]['name'],_0x6424e5[_0xbaf20b]['cron']);}else if(manager[_0xb175('0x58')](_0xbaf20b)){manager['stop'](_0xbaf20b);manager[_0xb175('0x59')](_0xbaf20b);logger['info']('stop\x20cron',_0x6424e5[_0xbaf20b]['name'],_0x6424e5[_0xbaf20b][_0xb175('0x5e')]);}}for(_0x59704f=0x0,_0xbaf20b;_0x59704f<_0x1ac547['length']&&!_0x530680;_0x59704f+=0x1){_0xbaf20b=_0x1ac547[_0x59704f][_0xb175('0x55')]();if(manager['exists'](_0xbaf20b)){if(_0x6424e5[_0xbaf20b][_0xb175('0x5e')]&&_0x6424e5[_0xbaf20b][_0xb175('0x61')]&&moment()['isBetween'](_0x6424e5[_0xbaf20b][_0xb175('0x5f')],_0x6424e5[_0xbaf20b]['endAt'])){manager[_0xb175('0x62')](_0xbaf20b,_0x6424e5[_0xbaf20b][_0xb175('0x5e')],handleJob(_0x6424e5[_0xbaf20b]));logger[_0xb175('0x10')](_0xb175('0x63'),_0x6424e5[_0xbaf20b][_0xb175('0x17')],_0x6424e5[_0xbaf20b][_0xb175('0x5e')]);}else{manager[_0xb175('0x3d')](_0xbaf20b);manager[_0xb175('0x59')](_0xbaf20b);logger['info']('stop\x20cron',_0x6424e5[_0xbaf20b][_0xb175('0x17')],_0x6424e5[_0xbaf20b][_0xb175('0x5e')]);}}}})[_0xb175('0x33')](function(_0x1e8ced){logger[_0xb175('0xf')](JSON[_0xb175('0x25')](_0x1e8ced));});}exports[_0xb175('0x64')]=function(_0x7c1731){return getJobs(_0x7c1731);};exports[_0xb175('0x65')]=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 5380233..3fb1317 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 _0x1eba=['Transcript\x20not\x20available','findOne','Cloud\x20Provider\x20not\x20available','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','sentimentRegion','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','Positive','SentimentScore','Negative','Mixed','Neutral','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','FAILED','FailureReason','resolve','Cloud\x20Provider\x20not\x20configured','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','CloudProvider','forEach','push','start','lodash','aws-sdk','request-promise','util','bluebird','transcribe','TranscribeService','getTranscriptionJob','detectSentiment','substring','info','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','transcribeRegion','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','update','format','tempSentiment','Sequelize','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','language','bucket','ValidationError','Sentiment\x20Analysis\x20not\x20configured'];(function(_0x17c949,_0x2d35f7){var _0x3c72ed=function(_0x5b23a0){while(--_0x5b23a0){_0x17c949['push'](_0x17c949['shift']());}};_0x3c72ed(++_0x2d35f7);}(_0x1eba,0x1d7));var _0xa1eb=function(_0x4c184d,_0x4278ab){_0x4c184d=_0x4c184d-0x0;var _0x23d997=_0x1eba[_0x4c184d];return _0x23d997;};var _=require(_0xa1eb('0x0'));var AWS=require(_0xa1eb('0x1'));var rp=require(_0xa1eb('0x2'));var util=require(_0xa1eb('0x3'));var BPromise=require(_0xa1eb('0x4'));var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')(_0xa1eb('0x5'));function getTranscriptionJob(_0x34be5a,_0x16a13a,_0xf9d704,_0x138789){return new Promise(function(_0x2933d0,_0x1d0d67){var _0x2bfbb0=new AWS[(_0xa1eb('0x6'))]({'accessKeyId':_0x16a13a,'secretAccessKey':_0x34be5a,'region':_0xf9d704});_0x2bfbb0[_0xa1eb('0x7')]({'TranscriptionJobName':_0x138789},function(_0x2aebb6,_0x9d7113){if(_0x2aebb6){return _0x1d0d67(_0x2aebb6);}else{return _0x2933d0(_0x9d7113);}});});}function sentiment(_0x54d235,_0x1ecd20,_0x4d4aaf,_0x219802,_0x54cdad){return new Promise(function(_0x3f53ff,_0x5d7101){var _0x41a7bc=new AWS['Comprehend']({'accessKeyId':_0x1ecd20,'secretAccessKey':_0x54d235,'region':_0x4d4aaf});_0x41a7bc[_0xa1eb('0x8')]({'Text':_0x219802,'LanguageCode':_0x54cdad[_0xa1eb('0x9')](0x0,0x2)},function(_0x151580,_0x5839d3){if(_0x151580){return _0x5d7101(_0x151580);}else{return _0x3f53ff(_0x5839d3);}});});}function checkTranscribeJob(_0x1e28e7,_0x39b4a3,_0x5df92d){var _0x16a623;return new BPromise(function(_0x4a3774,_0x4e65dc){logger[_0xa1eb('0xa')](util['format'](_0xa1eb('0xb'),_0x1e28e7['id'],_0x1e28e7[_0xa1eb('0xc')]));return getTranscriptionJob(_0x5df92d[_0xa1eb('0xd')],_0x5df92d[_0xa1eb('0xe')],_0x39b4a3[_0xa1eb('0xf')],_0x1e28e7[_0xa1eb('0xc')])[_0xa1eb('0x10')](function(_0x45d6dd){logger[_0xa1eb('0xa')](util['format'](_0xa1eb('0x11'),_0x1e28e7['id'],_0x1e28e7['transcribeName'],_0x45d6dd[_0xa1eb('0x12')][_0xa1eb('0x13')]));if(!_0x1e28e7[_0xa1eb('0x14')]){switch(_0x45d6dd[_0xa1eb('0x12')]['TranscriptionJobStatus']){case _0xa1eb('0x15'):var _0x22cd44={'transcribeStatus':_0x45d6dd[_0xa1eb('0x12')][_0xa1eb('0x13')],'fileUri':_0x45d6dd[_0xa1eb('0x12')][_0xa1eb('0x16')][_0xa1eb('0x17')]};logger[_0xa1eb('0xa')](util['format'](_0xa1eb('0x18'),_0x1e28e7['id']));return rp({'uri':_0x45d6dd['TranscriptionJob'][_0xa1eb('0x16')][_0xa1eb('0x17')],'json':!![]})[_0xa1eb('0x10')](function(_0x250f99){logger['info'](util['format'](_0xa1eb('0x19'),_0x1e28e7['id']));if(_0x250f99&&_0x250f99[_0xa1eb('0x1a')]&&_0x250f99['results'][_0xa1eb('0x1b')]&&_0x250f99[_0xa1eb('0x1a')][_0xa1eb('0x1b')][_0xa1eb('0x1c')]){_0x22cd44[_0xa1eb('0x14')]='';for(var _0x1c59e1=0x0;_0x1c59e1<_0x250f99[_0xa1eb('0x1a')][_0xa1eb('0x1b')][_0xa1eb('0x1c')];_0x1c59e1++){_0x22cd44[_0xa1eb('0x14')]+=_0x250f99[_0xa1eb('0x1a')][_0xa1eb('0x1b')][_0x1c59e1]['transcript']+'';}}return _0x1e28e7[_0xa1eb('0x1d')](_0x22cd44);})[_0xa1eb('0x10')](function(){logger['info'](util[_0xa1eb('0x1e')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x1e28e7['id']));if(!_0x1e28e7[_0xa1eb('0x1f')]){throw new db[(_0xa1eb('0x20'))]['ValidationError'](_0xa1eb('0x21'));}if(!_0x39b4a3[_0xa1eb('0x22')]||!_0x39b4a3[_0xa1eb('0x23')]||!_0x39b4a3['sentimentRegion']||!_0x39b4a3[_0xa1eb('0x24')]||!_0x39b4a3[_0xa1eb('0x25')]){throw new db['Sequelize'][(_0xa1eb('0x26'))](_0xa1eb('0x27'));}if(!_0x22cd44[_0xa1eb('0x14')]){throw new Error(_0xa1eb('0x28'));}if(_0x39b4a3[_0xa1eb('0x23')]===_0x5df92d['id']){return _0x5df92d;}else{return db['CloudProvider'][_0xa1eb('0x29')]({'where':{'id':_settings[_0xa1eb('0x23')]}});}})[_0xa1eb('0x10')](function(_0x2ae21d){if(!_0x2ae21d){throw new db[(_0xa1eb('0x20'))][(_0xa1eb('0x26'))](_0xa1eb('0x2a'));}if(!_0x2ae21d[_0xa1eb('0xd')]||!_0x2ae21d[_0xa1eb('0xe')]){throw new db[(_0xa1eb('0x20'))][(_0xa1eb('0x26'))]('Cloud\x20Provider\x20not\x20configured');}_0x16a623=_0x2ae21d;logger['info'](util[_0xa1eb('0x1e')](_0xa1eb('0x2b'),_0x1e28e7['id']));return sentiment(_0x16a623[_0xa1eb('0xd')],_0x16a623[_0xa1eb('0xe')],_0x39b4a3[_0xa1eb('0x2c')],_0x22cd44['fileText'],_0x39b4a3['language']);})[_0xa1eb('0x10')](function(_0x2d2890){logger['info'](util['format'](_0xa1eb('0x2d'),_0x1e28e7['id']));return _0x1e28e7['update']({'sentiment':_0x2d2890[_0xa1eb('0x2e')],'sPositive':_0x2d2890['SentimentScore'][_0xa1eb('0x2f')],'sNegative':_0x2d2890[_0xa1eb('0x30')][_0xa1eb('0x31')],'sMixed':_0x2d2890['SentimentScore'][_0xa1eb('0x32')],'sNeutral':_0x2d2890[_0xa1eb('0x30')][_0xa1eb('0x33')]});})['then'](function(){logger[_0xa1eb('0xa')](util[_0xa1eb('0x1e')](_0xa1eb('0x34'),_0x1e28e7['id']));_0x4a3774();});case _0xa1eb('0x35'):return _0x1e28e7[_0xa1eb('0x1d')]({'transcribeStatus':'FAILED','failureReason':_0x45d6dd[_0xa1eb('0x12')][_0xa1eb('0x36')]})[_0xa1eb('0x10')](function(){logger[_0xa1eb('0xa')](util[_0xa1eb('0x1e')](_0xa1eb('0x34'),_0x1e28e7['id']));_0x4a3774();});default:logger[_0xa1eb('0xa')](util[_0xa1eb('0x1e')]('[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed',_0x1e28e7['id']));break;}}else{return BPromise[_0xa1eb('0x37')]()[_0xa1eb('0x10')](function(){if(!_0x1e28e7[_0xa1eb('0x1f')]){throw new db[(_0xa1eb('0x20'))][(_0xa1eb('0x26'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x39b4a3[_0xa1eb('0x22')]||!_0x39b4a3[_0xa1eb('0x23')]||!_0x39b4a3[_0xa1eb('0x2c')]||!_0x39b4a3['language']||!_0x39b4a3[_0xa1eb('0x25')]){throw new db[(_0xa1eb('0x20'))][(_0xa1eb('0x26'))](_0xa1eb('0x27'));}if(!_0x1e28e7[_0xa1eb('0x14')]){throw new Error(_0xa1eb('0x28'));}if(_0x39b4a3[_0xa1eb('0x23')]===_0x5df92d['id']){return _0x5df92d;}else{return db['CloudProvider'][_0xa1eb('0x29')]({'where':{'id':_settings[_0xa1eb('0x23')]}});}})['then'](function(_0xf6c04b){if(!_0xf6c04b){throw new db['Sequelize'][(_0xa1eb('0x26'))](_0xa1eb('0x2a'));}if(!_0xf6c04b[_0xa1eb('0xd')]||!_0xf6c04b[_0xa1eb('0xe')]){throw new db[(_0xa1eb('0x20'))][(_0xa1eb('0x26'))](_0xa1eb('0x38'));}_0x16a623=_0xf6c04b;logger[_0xa1eb('0xa')](util[_0xa1eb('0x1e')](_0xa1eb('0x2b'),_0x1e28e7['id']));return sentiment(_0x16a623[_0xa1eb('0xd')],_0x16a623[_0xa1eb('0xe')],_0x39b4a3[_0xa1eb('0x2c')],_0x1e28e7[_0xa1eb('0x14')],_0x39b4a3[_0xa1eb('0x24')]);})[_0xa1eb('0x10')](function(_0x4e068d){logger[_0xa1eb('0xa')](util['format'](_0xa1eb('0x2d'),_0x1e28e7['id']));return _0x1e28e7[_0xa1eb('0x1d')]({'sentiment':_0x4e068d['Sentiment'],'sPositive':_0x4e068d['SentimentScore'][_0xa1eb('0x2f')],'sNegative':_0x4e068d[_0xa1eb('0x30')][_0xa1eb('0x31')],'sMixed':_0x4e068d['SentimentScore'][_0xa1eb('0x32')],'sNeutral':_0x4e068d[_0xa1eb('0x30')][_0xa1eb('0x33')],'transcribeStatus':_0xa1eb('0x15')});})[_0xa1eb('0x10')](function(){logger[_0xa1eb('0xa')](util[_0xa1eb('0x1e')](_0xa1eb('0x34'),_0x1e28e7['id']));_0x4a3774();});}})[_0xa1eb('0x39')](function(_0x20c910){if(_0x20c910){if(!_0x20c910[_0xa1eb('0x3a')]||_0x20c910[_0xa1eb('0x3a')]!==_0xa1eb('0x3b')){logger[_0xa1eb('0x3c')](util['format'](_0xa1eb('0x3d'),_0x1e28e7['id']),util[_0xa1eb('0x3e')](_0x20c910,{'showHidden':![],'depth':null}));}}_0x4a3774();});});}function checkTranscribe(){var _0x1c94bc;var _0x977d00;var _0x2b0cbf;return db[_0xa1eb('0x3f')][_0xa1eb('0x40')]({'where':{'transcribeStatus':'IN_PROGRESS'}})[_0xa1eb('0x10')](function(_0x4144cf){if(!_0x4144cf||!_0x4144cf[_0xa1eb('0x1c')]){throw new db[(_0xa1eb('0x20'))][(_0xa1eb('0x26'))](_0xa1eb('0x41'));}_0x1c94bc=_0x4144cf;return db[_0xa1eb('0x42')][_0xa1eb('0x29')]({'where':{'id':0x1}});})[_0xa1eb('0x10')](function(_0x4f7c05){if(!_0x4f7c05){throw new db[(_0xa1eb('0x20'))]['ValidationError'](_0xa1eb('0x43'));}_0x977d00=_0x4f7c05;if(!_0x977d00['transcribe']||!_0x977d00[_0xa1eb('0x44')]||!_0x977d00[_0xa1eb('0xf')]||!_0x977d00[_0xa1eb('0x24')]||!_0x977d00['bucket']){throw new db[(_0xa1eb('0x20'))][(_0xa1eb('0x26'))]('Transcribe\x20not\x20configured');}return db[_0xa1eb('0x45')][_0xa1eb('0x29')]({'where':{'id':_0x977d00[_0xa1eb('0x44')]}});})[_0xa1eb('0x10')](function(_0x11cc84){if(!_0x11cc84){throw new db[(_0xa1eb('0x20'))][(_0xa1eb('0x26'))](_0xa1eb('0x2a'));}if(!_0x11cc84[_0xa1eb('0xd')]||!_0x11cc84[_0xa1eb('0xe')]){throw new db[(_0xa1eb('0x20'))][(_0xa1eb('0x26'))](_0xa1eb('0x38'));}_0x2b0cbf=_0x11cc84;var _0x260c4a=[];_0x1c94bc[_0xa1eb('0x46')](function(_0x2ba6c0){_0x260c4a[_0xa1eb('0x47')](checkTranscribeJob(_0x2ba6c0,_0x977d00,_0x2b0cbf));});return BPromise['all'](_0x260c4a);})[_0xa1eb('0x39')](function(_0x51ce91){if(_0x51ce91){if(!_0x51ce91[_0xa1eb('0x3a')]||_0x51ce91[_0xa1eb('0x3a')]!==_0xa1eb('0x3b')){logger[_0xa1eb('0x3c')](util['inspect'](_0x51ce91,{'showHidden':![],'depth':null}));}}});}exports[_0xa1eb('0x48')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x1131=['Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentRegion','language','bucket','Sequelize','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','sentimentAccountId','CloudProvider','findOne','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','Negative','Mixed','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','Transcribe\x20not\x20configured','Cloud\x20Provider\x20not\x20available','forEach','push','all','aws-sdk','../../mysqldb','../../config/logger','transcribe','Comprehend','detectSentiment','transcribeName','data1','data2','transcribeRegion','then','info','format','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','ValidationError'];(function(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0x1131,0x71));var _0x1113=function(_0x20b1ff,_0x4c9c5b){_0x20b1ff=_0x20b1ff-0x0;var _0x1a09c7=_0x1131[_0x20b1ff];return _0x1a09c7;};var _=require('lodash');var AWS=require(_0x1113('0x0'));var rp=require('request-promise');var util=require('util');var BPromise=require('bluebird');var db=require(_0x1113('0x1'))['db'];var logger=require(_0x1113('0x2'))(_0x1113('0x3'));function getTranscriptionJob(_0x3d255e,_0x2f8f72,_0xb514f9,_0x57dd30){return new Promise(function(_0x3880aa,_0x4e6389){var _0x1f76a7=new AWS['TranscribeService']({'accessKeyId':_0x2f8f72,'secretAccessKey':_0x3d255e,'region':_0xb514f9});_0x1f76a7['getTranscriptionJob']({'TranscriptionJobName':_0x57dd30},function(_0x458f86,_0x53a218){if(_0x458f86){return _0x4e6389(_0x458f86);}else{return _0x3880aa(_0x53a218);}});});}function sentiment(_0x44e3b5,_0x16ddba,_0x3e20dd,_0x36df92,_0x399e4c){return new Promise(function(_0x4deffb,_0x4da83a){var _0x37405f=new AWS[(_0x1113('0x4'))]({'accessKeyId':_0x16ddba,'secretAccessKey':_0x44e3b5,'region':_0x3e20dd});_0x37405f[_0x1113('0x5')]({'Text':_0x36df92,'LanguageCode':_0x399e4c['substring'](0x0,0x2)},function(_0x3658ec,_0xc0b564){if(_0x3658ec){return _0x4da83a(_0x3658ec);}else{return _0x4deffb(_0xc0b564);}});});}function checkTranscribeJob(_0x4e4387,_0x31a919,_0x31b550){var _0x26bf52;return new BPromise(function(_0x3b929e,_0x517a7e){logger['info'](util['format']('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0x4e4387['id'],_0x4e4387[_0x1113('0x6')]));return getTranscriptionJob(_0x31b550[_0x1113('0x7')],_0x31b550[_0x1113('0x8')],_0x31a919[_0x1113('0x9')],_0x4e4387['transcribeName'])[_0x1113('0xa')](function(_0x1f7537){logger[_0x1113('0xb')](util[_0x1113('0xc')](_0x1113('0xd'),_0x4e4387['id'],_0x4e4387[_0x1113('0x6')],_0x1f7537[_0x1113('0xe')][_0x1113('0xf')]));if(!_0x4e4387[_0x1113('0x10')]){switch(_0x1f7537[_0x1113('0xe')]['TranscriptionJobStatus']){case _0x1113('0x11'):var _0x4d3cbe={'transcribeStatus':_0x1f7537[_0x1113('0xe')]['TranscriptionJobStatus'],'fileUri':_0x1f7537[_0x1113('0xe')][_0x1113('0x12')]['TranscriptFileUri']};logger['info'](util['format']('[RECORDING:%d]\x20Get\x20transcript',_0x4e4387['id']));return rp({'uri':_0x1f7537[_0x1113('0xe')][_0x1113('0x12')][_0x1113('0x13')],'json':!![]})[_0x1113('0xa')](function(_0x1ab3ef){logger[_0x1113('0xb')](util[_0x1113('0xc')](_0x1113('0x14'),_0x4e4387['id']));if(_0x1ab3ef&&_0x1ab3ef[_0x1113('0x15')]&&_0x1ab3ef['results'][_0x1113('0x16')]&&_0x1ab3ef[_0x1113('0x15')][_0x1113('0x16')]['length']){_0x4d3cbe[_0x1113('0x10')]='';for(var _0x4d49bb=0x0;_0x4d49bb<_0x1ab3ef[_0x1113('0x15')][_0x1113('0x16')][_0x1113('0x17')];_0x4d49bb++){_0x4d3cbe[_0x1113('0x10')]+=_0x1ab3ef['results'][_0x1113('0x16')][_0x4d49bb][_0x1113('0x18')]+'';}}return _0x4e4387[_0x1113('0x19')](_0x4d3cbe);})[_0x1113('0xa')](function(){logger['info'](util[_0x1113('0xc')](_0x1113('0x1a'),_0x4e4387['id']));if(!_0x4e4387[_0x1113('0x1b')]){throw new db['Sequelize'][(_0x1113('0x1c'))](_0x1113('0x1d'));}if(!_0x31a919[_0x1113('0x1e')]||!_0x31a919['sentimentAccountId']||!_0x31a919[_0x1113('0x1f')]||!_0x31a919[_0x1113('0x20')]||!_0x31a919[_0x1113('0x21')]){throw new db[(_0x1113('0x22'))][(_0x1113('0x1c'))](_0x1113('0x23'));}if(!_0x4d3cbe[_0x1113('0x10')]){throw new Error(_0x1113('0x24'));}if(_0x31a919[_0x1113('0x25')]===_0x31b550['id']){return _0x31b550;}else{return db[_0x1113('0x26')][_0x1113('0x27')]({'where':{'id':_settings[_0x1113('0x25')]}});}})['then'](function(_0x47d165){if(!_0x47d165){throw new db[(_0x1113('0x22'))][(_0x1113('0x1c'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x47d165[_0x1113('0x7')]||!_0x47d165[_0x1113('0x8')]){throw new db['Sequelize'][(_0x1113('0x1c'))](_0x1113('0x28'));}_0x26bf52=_0x47d165;logger['info'](util[_0x1113('0xc')](_0x1113('0x29'),_0x4e4387['id']));return sentiment(_0x26bf52[_0x1113('0x7')],_0x26bf52[_0x1113('0x8')],_0x31a919['sentimentRegion'],_0x4d3cbe['fileText'],_0x31a919[_0x1113('0x20')]);})[_0x1113('0xa')](function(_0x494d69){logger[_0x1113('0xb')](util['format'](_0x1113('0x2a'),_0x4e4387['id']));return _0x4e4387[_0x1113('0x19')]({'sentiment':_0x494d69[_0x1113('0x2b')],'sPositive':_0x494d69[_0x1113('0x2c')][_0x1113('0x2d')],'sNegative':_0x494d69[_0x1113('0x2c')]['Negative'],'sMixed':_0x494d69[_0x1113('0x2c')]['Mixed'],'sNeutral':_0x494d69[_0x1113('0x2c')][_0x1113('0x2e')]});})['then'](function(){logger[_0x1113('0xb')](util['format'](_0x1113('0x1a'),_0x4e4387['id']));_0x3b929e();});case _0x1113('0x2f'):return _0x4e4387['update']({'transcribeStatus':_0x1113('0x2f'),'failureReason':_0x1f7537['TranscriptionJob'][_0x1113('0x30')]})[_0x1113('0xa')](function(){logger[_0x1113('0xb')](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x4e4387['id']));_0x3b929e();});default:logger[_0x1113('0xb')](util[_0x1113('0xc')](_0x1113('0x31'),_0x4e4387['id']));break;}}else{return BPromise[_0x1113('0x32')]()[_0x1113('0xa')](function(){if(!_0x4e4387[_0x1113('0x1b')]){throw new db[(_0x1113('0x22'))]['ValidationError'](_0x1113('0x1d'));}if(!_0x31a919[_0x1113('0x1e')]||!_0x31a919[_0x1113('0x25')]||!_0x31a919[_0x1113('0x1f')]||!_0x31a919['language']||!_0x31a919[_0x1113('0x21')]){throw new db['Sequelize'][(_0x1113('0x1c'))](_0x1113('0x23'));}if(!_0x4e4387[_0x1113('0x10')]){throw new Error(_0x1113('0x24'));}if(_0x31a919[_0x1113('0x25')]===_0x31b550['id']){return _0x31b550;}else{return db[_0x1113('0x26')][_0x1113('0x27')]({'where':{'id':_settings[_0x1113('0x25')]}});}})[_0x1113('0xa')](function(_0x258a23){if(!_0x258a23){throw new db['Sequelize'][(_0x1113('0x1c'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x258a23['data1']||!_0x258a23['data2']){throw new db[(_0x1113('0x22'))][(_0x1113('0x1c'))](_0x1113('0x28'));}_0x26bf52=_0x258a23;logger[_0x1113('0xb')](util['format'](_0x1113('0x29'),_0x4e4387['id']));return sentiment(_0x26bf52['data1'],_0x26bf52[_0x1113('0x8')],_0x31a919[_0x1113('0x1f')],_0x4e4387[_0x1113('0x10')],_0x31a919[_0x1113('0x20')]);})['then'](function(_0x21a577){logger[_0x1113('0xb')](util['format'](_0x1113('0x2a'),_0x4e4387['id']));return _0x4e4387[_0x1113('0x19')]({'sentiment':_0x21a577['Sentiment'],'sPositive':_0x21a577[_0x1113('0x2c')][_0x1113('0x2d')],'sNegative':_0x21a577[_0x1113('0x2c')][_0x1113('0x33')],'sMixed':_0x21a577[_0x1113('0x2c')][_0x1113('0x34')],'sNeutral':_0x21a577[_0x1113('0x2c')]['Neutral'],'transcribeStatus':'COMPLETED'});})[_0x1113('0xa')](function(){logger[_0x1113('0xb')](util[_0x1113('0xc')](_0x1113('0x1a'),_0x4e4387['id']));_0x3b929e();});}})[_0x1113('0x35')](function(_0x969851){if(_0x969851){if(!_0x969851[_0x1113('0x36')]||_0x969851['name']!==_0x1113('0x37')){logger[_0x1113('0x38')](util[_0x1113('0xc')](_0x1113('0x39'),_0x4e4387['id']),util[_0x1113('0x3a')](_0x969851,{'showHidden':![],'depth':null}));}}_0x3b929e();});});}function checkTranscribe(){var _0x130a90;var _0xb8a1d6;var _0xcfe1c0;return db[_0x1113('0x3b')][_0x1113('0x3c')]({'where':{'transcribeStatus':_0x1113('0x3d')}})[_0x1113('0xa')](function(_0xc078c){if(!_0xc078c||!_0xc078c[_0x1113('0x17')]){throw new db[(_0x1113('0x22'))][(_0x1113('0x1c'))](_0x1113('0x3e'));}_0x130a90=_0xc078c;return db[_0x1113('0x3f')][_0x1113('0x27')]({'where':{'id':0x1}});})[_0x1113('0xa')](function(_0x54f9e1){if(!_0x54f9e1){throw new db[(_0x1113('0x22'))][(_0x1113('0x1c'))](_0x1113('0x40'));}_0xb8a1d6=_0x54f9e1;if(!_0xb8a1d6[_0x1113('0x3')]||!_0xb8a1d6[_0x1113('0x41')]||!_0xb8a1d6[_0x1113('0x9')]||!_0xb8a1d6['language']||!_0xb8a1d6[_0x1113('0x21')]){throw new db[(_0x1113('0x22'))]['ValidationError'](_0x1113('0x42'));}return db['CloudProvider'][_0x1113('0x27')]({'where':{'id':_0xb8a1d6[_0x1113('0x41')]}});})['then'](function(_0x502f86){if(!_0x502f86){throw new db[(_0x1113('0x22'))][(_0x1113('0x1c'))](_0x1113('0x43'));}if(!_0x502f86[_0x1113('0x7')]||!_0x502f86['data2']){throw new db[(_0x1113('0x22'))][(_0x1113('0x1c'))]('Cloud\x20Provider\x20not\x20configured');}_0xcfe1c0=_0x502f86;var _0x57f6de=[];_0x130a90[_0x1113('0x44')](function(_0x33ac27){_0x57f6de[_0x1113('0x45')](checkTranscribeJob(_0x33ac27,_0xb8a1d6,_0xcfe1c0));});return BPromise[_0x1113('0x46')](_0x57f6de);})[_0x1113('0x35')](function(_0x4a2705){if(_0x4a2705){if(!_0x4a2705[_0x1113('0x36')]||_0x4a2705[_0x1113('0x36')]!==_0x1113('0x37')){logger[_0x1113('0x38')](util['inspect'](_0x4a2705,{'showHidden':![],'depth':null}));}}});}exports['start']=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file diff --git a/server/config/schedule/whatsapp.js b/server/config/schedule/whatsapp.js index 1670453..5a92d10 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 _0xb829=['YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','../../mysqldb','schedule','redis','socket.io-emitter','subtract','hours','then','length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','WhatsappInteraction','timeout','format'];(function(_0x4a2dab,_0x12845b){var _0x3502b7=function(_0x3e2b1e){while(--_0x3e2b1e){_0x4a2dab['push'](_0x4a2dab['shift']());}};_0x3502b7(++_0x12845b);}(_0xb829,0xf7));var _0x9b82=function(_0x3dff3b,_0xdc5682){_0x3dff3b=_0x3dff3b-0x0;var _0x54b4a6=_0xb829[_0x3dff3b];return _0x54b4a6;};'use strict';var _=require(_0x9b82('0x0'));var moment=require(_0x9b82('0x1'));var Redis=require('ioredis');var util=require('util');var config=require('../../config/environment');var db=require(_0x9b82('0x2'))['db'];var logger=require('../logger')(_0x9b82('0x3'));config[_0x9b82('0x4')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x9b82('0x5'))(new Redis(config[_0x9b82('0x4')]));function closeInteractions(){var _0x1860d7=[];return db['WhatsappInteraction']['findAll']({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x9b82('0x6')](0x18,_0x9b82('0x7'))}}})[_0x9b82('0x8')](function(_0x4a218a){if(_0x4a218a&&_0x4a218a[_0x9b82('0x9')]){_0x1860d7=_[_0x9b82('0xa')](_0x4a218a||[],'id');logger[_0x9b82('0xb')](_0x9b82('0xc'),_0x1860d7[_0x9b82('0xd')]());return db[_0x9b82('0xe')]['update']({'closeReason':'system','disposition':_0x9b82('0xf'),'closed':!![],'closedAt':moment()[_0x9b82('0x10')](_0x9b82('0x11'))},{'where':{'id':_0x1860d7}});}})[_0x9b82('0x8')](function(){if(_0x1860d7&&_0x1860d7[_0x9b82('0x9')]){logger[_0x9b82('0xb')](_0x9b82('0x12'),_0x1860d7[_0x9b82('0xd')]());for(var _0x3bd1ab=0x0;_0x3bd1ab<_0x1860d7[_0x9b82('0x9')];_0x3bd1ab++){io['emit']('whatsappInteraction:update',{'id':_0x1860d7[_0x3bd1ab],'closed':!![]});}}})[_0x9b82('0x13')](function(_0x996111){logger[_0x9b82('0x14')](_0x9b82('0x15'),_0x996111?util[_0x9b82('0x16')](_0x996111,{'showHidden':![],'depth':null}):'');});}exports[_0x9b82('0x17')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x5050=['timeout','format','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','join','whatsappInteraction:update','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','lastMsgAt','subtract','then','length','map','[WHATSAPP]\x20Interactions\x20to\x20close:','update','system'];(function(_0x2b78e4,_0x5b8b3c){var _0x1113f4=function(_0x1ae111){while(--_0x1ae111){_0x2b78e4['push'](_0x2b78e4['shift']());}};_0x1113f4(++_0x5b8b3c);}(_0x5050,0x1dd));var _0x0505=function(_0x551826,_0x38298e){_0x551826=_0x551826-0x0;var _0x507e25=_0x5050[_0x551826];return _0x507e25;};'use strict';var _=require(_0x0505('0x0'));var moment=require(_0x0505('0x1'));var Redis=require(_0x0505('0x2'));var util=require('util');var config=require(_0x0505('0x3'));var db=require(_0x0505('0x4'))['db'];var logger=require('../logger')('schedule');config['redis']=_[_0x0505('0x5')](config[_0x0505('0x6')],{'host':_0x0505('0x7'),'port':0x18eb});var io=require(_0x0505('0x8'))(new Redis(config[_0x0505('0x6')]));function closeInteractions(){var _0x3ac3b2=[];return db['WhatsappInteraction']['findAll']({'raw':!![],'attributes':['id',_0x0505('0x9')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x0505('0xa')](0x18,'hours')}}})[_0x0505('0xb')](function(_0x274f0a){if(_0x274f0a&&_0x274f0a[_0x0505('0xc')]){_0x3ac3b2=_[_0x0505('0xd')](_0x274f0a||[],'id');logger['info'](_0x0505('0xe'),_0x3ac3b2['join']());return db['WhatsappInteraction'][_0x0505('0xf')]({'closeReason':_0x0505('0x10'),'disposition':_0x0505('0x11'),'closed':!![],'closedAt':moment()[_0x0505('0x12')](_0x0505('0x13'))},{'where':{'id':_0x3ac3b2}});}})[_0x0505('0xb')](function(){if(_0x3ac3b2&&_0x3ac3b2[_0x0505('0xc')]){logger['info'](_0x0505('0x14'),_0x3ac3b2[_0x0505('0x15')]());for(var _0x42ac40=0x0;_0x42ac40<_0x3ac3b2[_0x0505('0xc')];_0x42ac40++){io['emit'](_0x0505('0x16'),{'id':_0x3ac3b2[_0x42ac40],'closed':!![]});}}})['catch'](function(_0x52738e){logger['error'](_0x0505('0x17'),_0x52738e?util[_0x0505('0x18')](_0x52738e,{'showHidden':![],'depth':null}):'');});}exports[_0x0505('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 d773b68..760c9d1 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5b1c=['log','finished\x20populating','CmHopper','hopper1','hopper2','catch','Biondo','innocenzo.biondo','@xcally.com','push','now','Innocenzo','CmContact','destroy','then','bulkCreate'];(function(_0x50327a,_0x229594){var _0x1e10da=function(_0x5e0c10){while(--_0x5e0c10){_0x50327a['push'](_0x50327a['shift']());}};_0x1e10da(++_0x229594);}(_0x5b1c,0x1a6));var _0xc5b1=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x5b1c[_0x2641f9];return _0x585741;};'use strict';var util=require('util');var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':'Innocenzo'+i,'lastName':_0xc5b1('0x0')+i,'phone':0xf879fb460+i,'email':_0xc5b1('0x1')+i+_0xc5b1('0x2')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xc5b1('0x3')]({'id':i,'active':![],'scheduledat':Date[_0xc5b1('0x4')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xc5b1('0x4')](),'updatedAt':Date[_0xc5b1('0x4')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xc5b1('0x3')]({'id':i,'firstName':_0xc5b1('0x5')+i,'lastName':_0xc5b1('0x0')+i,'phone':0xf879fb460+i,'email':_0xc5b1('0x1')+i+_0xc5b1('0x2')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date[_0xc5b1('0x4')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xc5b1('0x4')](),'updatedAt':Date[_0xc5b1('0x4')]()});}db[_0xc5b1('0x6')][_0xc5b1('0x7')]({'where':{}})[_0xc5b1('0x8')](function(){return db[_0xc5b1('0x6')][_0xc5b1('0x9')](contacts);})[_0xc5b1('0x8')](function(){console[_0xc5b1('0xa')](_0xc5b1('0xb'),'contacts1');return db['CmHopper'][_0xc5b1('0x7')]({'where':{}});})[_0xc5b1('0x8')](function(){return db[_0xc5b1('0xc')][_0xc5b1('0x9')](hopper);})[_0xc5b1('0x8')](function(){console[_0xc5b1('0xa')](_0xc5b1('0xb'),_0xc5b1('0xd'));return db['CmContact'][_0xc5b1('0x9')](contacts2);})[_0xc5b1('0x8')](function(){console[_0xc5b1('0xa')](_0xc5b1('0xb'),'contacts2');return db[_0xc5b1('0xc')][_0xc5b1('0x9')](hopper2);})[_0xc5b1('0x8')](function(){console[_0xc5b1('0xa')]('finished\x20populating',_0xc5b1('0xe'));})[_0xc5b1('0xf')](function(_0x4e13da){console[_0xc5b1('0xa')](_0x4e13da);}); \ No newline at end of file +var _0xcba4=['innocenzo.biondo','@xcally.com','push','now','destroy','then','CmContact','finished\x20populating','contacts1','CmHopper','bulkCreate','log','hopper1','contacts2','catch','util','../mysqldb','Innocenzo','Biondo'];(function(_0xe957e3,_0x2f333e){var _0x21e397=function(_0x570d5e){while(--_0x570d5e){_0xe957e3['push'](_0xe957e3['shift']());}};_0x21e397(++_0x2f333e);}(_0xcba4,0xba));var _0x4cba=function(_0x4c98c7,_0x301f11){_0x4c98c7=_0x4c98c7-0x0;var _0x2d4d0a=_0xcba4[_0x4c98c7];return _0x2d4d0a;};'use strict';var util=require(_0x4cba('0x0'));var db=require(_0x4cba('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':_0x4cba('0x2')+i,'lastName':_0x4cba('0x3')+i,'phone':0xf879fb460+i,'email':_0x4cba('0x4')+i+_0x4cba('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x4cba('0x6')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x4cba('0x7')](),'updatedAt':Date[_0x4cba('0x7')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x4cba('0x6')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x4cba('0x3')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x4cba('0x6')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x4cba('0x7')](),'updatedAt':Date[_0x4cba('0x7')]()});}db['CmContact'][_0x4cba('0x8')]({'where':{}})[_0x4cba('0x9')](function(){return db[_0x4cba('0xa')]['bulkCreate'](contacts);})[_0x4cba('0x9')](function(){console['log'](_0x4cba('0xb'),_0x4cba('0xc'));return db[_0x4cba('0xd')][_0x4cba('0x8')]({'where':{}});})[_0x4cba('0x9')](function(){return db[_0x4cba('0xd')][_0x4cba('0xe')](hopper);})[_0x4cba('0x9')](function(){console[_0x4cba('0xf')](_0x4cba('0xb'),_0x4cba('0x10'));return db[_0x4cba('0xa')][_0x4cba('0xe')](contacts2);})['then'](function(){console['log'](_0x4cba('0xb'),_0x4cba('0x11'));return db['CmHopper'][_0x4cba('0xe')](hopper2);})[_0x4cba('0x9')](function(){console[_0x4cba('0xf')](_0x4cba('0xb'),'hopper2');})[_0x4cba('0x12')](function(_0x4bcf77){console[_0x4cba('0xf')](_0x4bcf77);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 98e24b1..b4d14b8 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8cef=['/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','bulkCreate','then','catch','log','util','../mysqldb','%s%s','agent','format','%s%s@xcally.com','password','friend','udp','all','ulaw','yes'];(function(_0x491572,_0x3b6a7f){var _0x5e06cf=function(_0xf4bb96){while(--_0xf4bb96){_0x491572['push'](_0x491572['shift']());}};_0x5e06cf(++_0x3b6a7f);}(_0x8cef,0x170));var _0xf8ce=function(_0x3d0b68,_0x3b9d99){_0x3d0b68=_0x3d0b68-0x0;var _0x20dc7a=_0x8cef[_0x3d0b68];return _0x20dc7a;};'use strict';var util=require(_0xf8ce('0x0'));var db=require(_0xf8ce('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util['format'](_0xf8ce('0x2'),'agent',i),'fullname':util['format'](_0xf8ce('0x2'),_0xf8ce('0x3'),i),'email':util[_0xf8ce('0x4')](_0xf8ce('0x5'),'agent',i),'role':'agent','password':_0xf8ce('0x6'),'internal':0xfa0+i,'type':_0xf8ce('0x7'),'transport':[_0xf8ce('0x8'),'ws','wss'],'disallow':[_0xf8ce('0x9')],'allow':[_0xf8ce('0xa')],'defaultuser':util[_0xf8ce('0x4')](_0xf8ce('0x2'),_0xf8ce('0x3'),i),'encryption':_0xf8ce('0xb'),'avpf':_0xf8ce('0xb'),'force_avp':'yes','icesupport':_0xf8ce('0xb'),'dtlsenable':_0xf8ce('0xb'),'dtlsverify':'no','dtlscertfile':_0xf8ce('0xc'),'dtlsprivatekey':_0xf8ce('0xd'),'dtlssetup':_0xf8ce('0xe'),'callerid':util[_0xf8ce('0x4')](_0xf8ce('0xf'),util['format'](_0xf8ce('0x2'),_0xf8ce('0x3'),i),0xfa0+i)});}db['User'][_0xf8ce('0x10')](users)[_0xf8ce('0x11')](function(){console['log']('add\x20user');})[_0xf8ce('0x12')](function(_0x15a3d0){console[_0xf8ce('0x13')](_0x15a3d0);}); \ No newline at end of file +var _0x5a3c=['util','../mysqldb','push','format','%s%s','agent','%s%s@xcally.com','password','friend','udp','all','yes','/etc/pki/tls/certs/motion.crt','actpass','\x22%s\x22\x20<%s>','User','bulkCreate','then','log','add\x20user','catch'];(function(_0x5cabac,_0x5ccb08){var _0x5f47b8=function(_0x1e478b){while(--_0x1e478b){_0x5cabac['push'](_0x5cabac['shift']());}};_0x5f47b8(++_0x5ccb08);}(_0x5a3c,0x1ce));var _0xc5a3=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x5a3c[_0x21a9d9];return _0x46adce;};'use strict';var util=require(_0xc5a3('0x0'));var db=require(_0xc5a3('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xc5a3('0x2')]({'name':util[_0xc5a3('0x3')](_0xc5a3('0x4'),_0xc5a3('0x5'),i),'fullname':util[_0xc5a3('0x3')](_0xc5a3('0x4'),_0xc5a3('0x5'),i),'email':util['format'](_0xc5a3('0x6'),_0xc5a3('0x5'),i),'role':_0xc5a3('0x5'),'password':_0xc5a3('0x7'),'internal':0xfa0+i,'type':_0xc5a3('0x8'),'transport':[_0xc5a3('0x9'),'ws','wss'],'disallow':[_0xc5a3('0xa')],'allow':['ulaw'],'defaultuser':util[_0xc5a3('0x3')](_0xc5a3('0x4'),_0xc5a3('0x5'),i),'encryption':'yes','avpf':_0xc5a3('0xb'),'force_avp':'yes','icesupport':_0xc5a3('0xb'),'dtlsenable':'yes','dtlsverify':'no','dtlscertfile':_0xc5a3('0xc'),'dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':_0xc5a3('0xd'),'callerid':util[_0xc5a3('0x3')](_0xc5a3('0xe'),util['format']('%s%s','agent',i),0xfa0+i)});}db[_0xc5a3('0xf')][_0xc5a3('0x10')](users)[_0xc5a3('0x11')](function(){console[_0xc5a3('0x12')](_0xc5a3('0x13'));})[_0xc5a3('0x14')](function(_0x34d5ba){console[_0xc5a3('0x12')](_0x34d5ba);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 4ca5841..36aa092 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xffd6=['push','VoiceQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','Trunk','user','SmsQueues','WhatsappQueue','getVoiceQueues','getChatQueues','getFaxQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','voice','chat','sms','mail','openchannel','whatsapp','campaign:%s:%s','leave','removeChatInteractions','emit','user_has_chat_interactions:remove','MailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','WhatsappInteractions','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','log','join','connection','setMaxListeners','request','remoteAddress','remotePort','connectedAt','SocketIO\x20','nsp','address','disconnect','DISCONNECTED','CONNECTED','lodash','util','bluebird','name','Agents','User','role','agent','telephone','type','ivr','findOne','then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','MailQueues','OpenchannelQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','map','where','Campaign','length','format','handshake','query','userProfileId','ChatInteractions','MailInteraction','FaxInteractions','SmsInteraction','SmsInteractions','WhatsappInteraction','user:%s','admin','voice:inbound','voice:outbound','hasOwnProperty','include'];(function(_0x28d7b5,_0x1305a4){var _0x1ed035=function(_0x57e1f6){while(--_0x57e1f6){_0x28d7b5['push'](_0x28d7b5['shift']());}};_0x1ed035(++_0x1305a4);}(_0xffd6,0x97));var _0x6ffd=function(_0x188d31,_0x576e87){_0x188d31=_0x188d31-0x0;var _0x30ed33=_0xffd6[_0x188d31];return _0x30ed33;};'use strict';var _=require(_0x6ffd('0x0'));var util=require(_0x6ffd('0x1'));var BPromise=require(_0x6ffd('0x2'));var db=require('../mysqldb')['db'];var config=require('./environment');var queryQueues={'attributes':['id',_0x6ffd('0x3')],'include':[{'as':_0x6ffd('0x4'),'model':db[_0x6ffd('0x5')],'attributes':['id','name',_0x6ffd('0x6')],'raw':!![],'where':{'role':_0x6ffd('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x6ffd('0x3')],'where':{'role':_0x6ffd('0x8')}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id',_0x6ffd('0x3')],'where':{'role':_0x6ffd('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x6ffd('0x3'),_0x6ffd('0x9')],'where':{'type':_0x6ffd('0xa')}};function getAssociatedResources(_0x4a9f85,_0x455dda,_0x417f34){return db['UserProfileSection'][_0x6ffd('0xb')]({'where':{'name':_0x4a9f85,'userProfileId':_0x455dda},'raw':!![]})[_0x6ffd('0xc')](function(_0x23f7f2){if(_0x23f7f2){if(_0x23f7f2[_0x6ffd('0xd')]){switch(_0x4a9f85){case _0x6ffd('0xe'):case _0x6ffd('0xf'):case _0x6ffd('0x10'):case'SmsQueues':case _0x6ffd('0x11'):case _0x6ffd('0x12'):case'WhatsappQueues':return db[_0x417f34][_0x6ffd('0x13')](queryQueues);case _0x6ffd('0x14'):return db[_0x417f34][_0x6ffd('0x13')](queryTelephones);case _0x6ffd('0x15'):return db[_0x417f34]['findAll'](queryTrunks);case _0x6ffd('0x16'):return db[_0x417f34]['findAll'](queryCampaigns);}}else{return db[_0x6ffd('0x17')]['findAll']({'attributes':[_0x6ffd('0x18')],'where':{'sectionId':_0x23f7f2['id']},'raw':!![]})[_0x6ffd('0xc')](function(_0x45db49){if(_0x45db49){var _0x5d8aff={'where':{'id':_[_0x6ffd('0x19')](_0x45db49,_0x6ffd('0x18'))},'raw':!![]};switch(_0x417f34){case _0x6ffd('0x5'):_0x5d8aff[_0x6ffd('0x1a')][_0x6ffd('0x6')]=_0x6ffd('0x8');break;case _0x6ffd('0x1b'):_0x5d8aff[_0x6ffd('0x1a')]['type']=_0x6ffd('0xa');break;}return db[_0x417f34]['findAll'](_0x5d8aff);}else{return[];}});}}else{return[];}})['then'](function(_0x2f5ec4){return _0x2f5ec4;});}function joinOrLeaveQueues(_0x359d09,_0x50aaa2,_0x34c3c1,_0x4612a3){_0x359d09[_0x50aaa2](util['format']('%s:queue:%s',_0x34c3c1,_0x4612a3[_0x6ffd('0x3')]));if(_0x4612a3[_0x6ffd('0x4')]){for(var _0x4dcc50=0x0;_0x4dcc50<_0x4612a3[_0x6ffd('0x4')][_0x6ffd('0x1c')];_0x4dcc50+=0x1){_0x359d09[_0x50aaa2](util[_0x6ffd('0x1d')]('user:%s',_0x4612a3[_0x6ffd('0x4')][_0x4dcc50][_0x6ffd('0x3')]));}}}function joinOrLeave(_0x50896b,_0x356c9c,_0x438d1a){var _0x50c19a;if(_0x50896b[_0x6ffd('0x1e')][_0x6ffd('0x1f')]['id']){db[_0x6ffd('0x5')]['find']({'attributes':['id',_0x6ffd('0x3'),_0x6ffd('0x6'),_0x6ffd('0x20')],'where':{'id':_0x50896b['handshake'][_0x6ffd('0x1f')]['id']},'include':[{'model':db['ChatInteraction'],'as':_0x6ffd('0x21'),'attributes':['id'],'raw':!![]},{'model':db[_0x6ffd('0x22')],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':_0x6ffd('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0x6ffd('0x24')],'as':_0x6ffd('0x25'),'attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x6ffd('0x26')],'as':'WhatsappInteractions','attributes':['id'],'raw':!![]}]})[_0x6ffd('0xc')](function(_0x20c007){if(_0x20c007){_0x50c19a=_0x20c007;_0x50896b[_0x356c9c](util['format'](_0x6ffd('0x27'),_0x20c007[_0x6ffd('0x3')]));var _0x442b2c=[];switch(_0x20c007[_0x6ffd('0x6')]){case _0x6ffd('0x28'):_0x50896b[_0x356c9c](_0x6ffd('0x29'));_0x50896b[_0x356c9c](_0x6ffd('0x2a'));if(queryQueues[_0x6ffd('0x2b')](_0x6ffd('0x2c'))){delete queryQueues[_0x6ffd('0x2c')];}_0x442b2c[_0x6ffd('0x2d')](db[_0x6ffd('0x2e')][_0x6ffd('0x13')](queryQueues));_0x442b2c['push'](db['ChatQueue']['findAll'](queryQueues));_0x442b2c[_0x6ffd('0x2d')](db[_0x6ffd('0x2f')][_0x6ffd('0x13')](queryQueues));_0x442b2c[_0x6ffd('0x2d')](db[_0x6ffd('0x30')][_0x6ffd('0x13')](queryQueues));_0x442b2c[_0x6ffd('0x2d')](db[_0x6ffd('0x31')][_0x6ffd('0x13')](queryQueues));_0x442b2c[_0x6ffd('0x2d')](db[_0x6ffd('0x32')][_0x6ffd('0x13')](queryQueues));_0x442b2c[_0x6ffd('0x2d')](db['WhatsappQueue'][_0x6ffd('0x13')](queryQueues));_0x442b2c[_0x6ffd('0x2d')](db[_0x6ffd('0x5')][_0x6ffd('0x13')](queryTelephones));_0x442b2c['push'](db[_0x6ffd('0x33')]['findAll'](queryTrunks));_0x442b2c['push'](db[_0x6ffd('0x1b')][_0x6ffd('0x13')](queryCampaigns));_0x442b2c[_0x6ffd('0x2d')](db[_0x6ffd('0x5')]['findAll'](queryAgents));break;case _0x6ffd('0x34'):_0x50896b[_0x356c9c]('voice:inbound');_0x50896b[_0x356c9c](_0x6ffd('0x2a'));_0x442b2c[_0x6ffd('0x2d')](getAssociatedResources(_0x6ffd('0xe'),_0x20c007[_0x6ffd('0x20')],_0x6ffd('0x2e')));_0x442b2c['push'](getAssociatedResources('ChatQueues',_0x20c007[_0x6ffd('0x20')],'ChatQueue'));_0x442b2c[_0x6ffd('0x2d')](getAssociatedResources(_0x6ffd('0x10'),_0x20c007[_0x6ffd('0x20')],_0x6ffd('0x2f')));_0x442b2c[_0x6ffd('0x2d')](getAssociatedResources(_0x6ffd('0x35'),_0x20c007['userProfileId'],_0x6ffd('0x30')));_0x442b2c[_0x6ffd('0x2d')](getAssociatedResources(_0x6ffd('0x11'),_0x20c007[_0x6ffd('0x20')],'MailQueue'));_0x442b2c[_0x6ffd('0x2d')](getAssociatedResources('OpenchannelQueues',_0x20c007[_0x6ffd('0x20')],_0x6ffd('0x32')));_0x442b2c[_0x6ffd('0x2d')](getAssociatedResources('WhatsappQueues',_0x20c007[_0x6ffd('0x20')],_0x6ffd('0x36')));_0x442b2c[_0x6ffd('0x2d')](getAssociatedResources(_0x6ffd('0x14'),_0x20c007[_0x6ffd('0x20')],_0x6ffd('0x5')));_0x442b2c[_0x6ffd('0x2d')](getAssociatedResources('Trunks',_0x20c007['userProfileId'],'Trunk'));_0x442b2c[_0x6ffd('0x2d')](getAssociatedResources(_0x6ffd('0x16'),_0x20c007['userProfileId'],_0x6ffd('0x1b')));_0x442b2c[_0x6ffd('0x2d')](db[_0x6ffd('0x5')][_0x6ffd('0x13')](queryAgents));break;case'agent':_0x50896b[_0x356c9c](_0x6ffd('0x29'));_0x50896b[_0x356c9c](_0x6ffd('0x2a'));_0x442b2c[_0x6ffd('0x2d')](_0x20c007[_0x6ffd('0x37')]({'attributes':['id',_0x6ffd('0x3')]}));_0x442b2c[_0x6ffd('0x2d')](_0x20c007[_0x6ffd('0x38')]({'attributes':['id',_0x6ffd('0x3')]}));_0x442b2c[_0x6ffd('0x2d')](_0x20c007[_0x6ffd('0x39')]({'attributes':['id',_0x6ffd('0x3')]}));_0x442b2c['push'](_0x20c007['getSmsQueues']({'attributes':['id','name']}));_0x442b2c[_0x6ffd('0x2d')](_0x20c007[_0x6ffd('0x3a')]({'attributes':['id','name']}));_0x442b2c[_0x6ffd('0x2d')](_0x20c007[_0x6ffd('0x3b')]({'attributes':['id',_0x6ffd('0x3')]}));_0x442b2c[_0x6ffd('0x2d')](_0x20c007[_0x6ffd('0x3c')]({'attributes':['id','name']}));break;}return BPromise[_0x6ffd('0x3d')](_0x442b2c);}})[_0x6ffd('0xc')](function(_0x45f4aa){if(_0x45f4aa&&_0x45f4aa['length']){for(var _0x2bf7c3=0x0;_0x2bf7c3<_0x45f4aa[_0x6ffd('0x1c')];_0x2bf7c3+=0x1){for(var _0x2f8dfb=0x0;_0x2f8dfb<_0x45f4aa[_0x2bf7c3][_0x6ffd('0x1c')];_0x2f8dfb+=0x1){switch(_0x2bf7c3){case 0x0:joinOrLeaveQueues(_0x50896b,_0x356c9c,_0x6ffd('0x3e'),_0x45f4aa[_0x2bf7c3][_0x2f8dfb]);break;case 0x1:joinOrLeaveQueues(_0x50896b,_0x356c9c,_0x6ffd('0x3f'),_0x45f4aa[_0x2bf7c3][_0x2f8dfb]);break;case 0x2:joinOrLeaveQueues(_0x50896b,_0x356c9c,'fax',_0x45f4aa[_0x2bf7c3][_0x2f8dfb]);break;case 0x3:joinOrLeaveQueues(_0x50896b,_0x356c9c,_0x6ffd('0x40'),_0x45f4aa[_0x2bf7c3][_0x2f8dfb]);break;case 0x4:joinOrLeaveQueues(_0x50896b,_0x356c9c,_0x6ffd('0x41'),_0x45f4aa[_0x2bf7c3][_0x2f8dfb]);break;case 0x5:joinOrLeaveQueues(_0x50896b,_0x356c9c,_0x6ffd('0x42'),_0x45f4aa[_0x2bf7c3][_0x2f8dfb]);break;case 0x6:joinOrLeaveQueues(_0x50896b,_0x356c9c,_0x6ffd('0x43'),_0x45f4aa[_0x2bf7c3][_0x2f8dfb]);break;case 0x7:if(_0x50c19a[_0x6ffd('0x6')]!==_0x6ffd('0x7'))_0x50896b[_0x356c9c](util[_0x6ffd('0x1d')]('telephone:%s',_0x45f4aa[_0x2bf7c3][_0x2f8dfb][_0x6ffd('0x3')]));break;case 0x8:if(_0x50c19a[_0x6ffd('0x6')]!=='agent')_0x50896b[_0x356c9c](util['format']('trunk:%s',_0x45f4aa[_0x2bf7c3][_0x2f8dfb][_0x6ffd('0x3')]));break;case 0x9:if(_0x50c19a['role']!==_0x6ffd('0x7'))_0x50896b[_0x356c9c](util[_0x6ffd('0x1d')](_0x6ffd('0x44'),_0x45f4aa[_0x2bf7c3][_0x2f8dfb][_0x6ffd('0x9')],_0x45f4aa[_0x2bf7c3][_0x2f8dfb]['name']));break;case 0xa:_0x50896b[_0x356c9c](util[_0x6ffd('0x1d')](_0x6ffd('0x27'),_0x45f4aa[_0x2bf7c3][_0x2f8dfb][_0x6ffd('0x3')]));break;}}}}})['then'](function(){if(_0x356c9c===_0x6ffd('0x45')){var _0x16b6b5=_['map'](_0x50c19a['ChatInteractions'],'id');return _0x50c19a[_0x6ffd('0x46')](_0x16b6b5)[_0x6ffd('0xc')](function(){for(var _0x25d7e3=0x0;_0x25d7e3<_0x16b6b5[_0x6ffd('0x1c')];_0x25d7e3+=0x1){_0x438d1a[_0x6ffd('0x47')](_0x6ffd('0x48'),{'ChatInteractionId':Number(_0x16b6b5[_0x25d7e3]),'UserId':Number(_0x50c19a['id'])});}});}})[_0x6ffd('0xc')](function(){if(_0x356c9c==='leave'){var _0x1e5834=_[_0x6ffd('0x19')](_0x50c19a[_0x6ffd('0x49')],'id');return _0x50c19a['removeMailInteractions'](_0x1e5834)['then'](function(){for(var _0x41043f=0x0;_0x41043f<_0x1e5834[_0x6ffd('0x1c')];_0x41043f+=0x1){_0x438d1a[_0x6ffd('0x47')](_0x6ffd('0x4a'),{'MailInteractionId':Number(_0x1e5834[_0x41043f]),'UserId':Number(_0x50c19a['id'])});}});}})['then'](function(){if(_0x356c9c===_0x6ffd('0x45')){var _0x3fc72f=_[_0x6ffd('0x19')](_0x50c19a[_0x6ffd('0x23')],'id');return _0x50c19a[_0x6ffd('0x4b')](_0x3fc72f)[_0x6ffd('0xc')](function(){for(var _0x4ca29b=0x0;_0x4ca29b<_0x3fc72f[_0x6ffd('0x1c')];_0x4ca29b+=0x1){_0x438d1a[_0x6ffd('0x47')](_0x6ffd('0x4c'),{'FaxInteractionId':Number(_0x3fc72f[_0x4ca29b]),'UserId':Number(_0x50c19a['id'])});}});}})[_0x6ffd('0xc')](function(){if(_0x356c9c===_0x6ffd('0x45')){var _0x4b87fc=_[_0x6ffd('0x19')](_0x50c19a[_0x6ffd('0x25')],'id');return _0x50c19a[_0x6ffd('0x4d')](_0x4b87fc)[_0x6ffd('0xc')](function(){for(var _0x3f8ef3=0x0;_0x3f8ef3<_0x4b87fc['length'];_0x3f8ef3+=0x1){_0x438d1a[_0x6ffd('0x47')](_0x6ffd('0x4e'),{'SmsInteractionId':Number(_0x4b87fc[_0x3f8ef3]),'UserId':Number(_0x50c19a['id'])});}});}})[_0x6ffd('0xc')](function(){if(_0x356c9c==='leave'){var _0x3ba9c5=_[_0x6ffd('0x19')](_0x50c19a['OpenchannelInteractions'],'id');return _0x50c19a[_0x6ffd('0x4f')](_0x3ba9c5)['then'](function(){for(var _0x1c060a=0x0;_0x1c060a<_0x3ba9c5[_0x6ffd('0x1c')];_0x1c060a+=0x1){_0x438d1a['emit'](_0x6ffd('0x50'),{'OpenchannelInteractionId':Number(_0x3ba9c5[_0x1c060a]),'UserId':Number(_0x50c19a['id'])});}});}})['then'](function(){if(_0x356c9c===_0x6ffd('0x45')){var _0x186f1e=_[_0x6ffd('0x19')](_0x50c19a[_0x6ffd('0x51')],'id');return _0x50c19a[_0x6ffd('0x52')](_0x186f1e)['then'](function(){for(var _0x111a7d=0x0;_0x111a7d<_0x186f1e[_0x6ffd('0x1c')];_0x111a7d+=0x1){_0x438d1a[_0x6ffd('0x47')](_0x6ffd('0x53'),{'WhatsappInteractionId':Number(_0x186f1e[_0x111a7d]),'UserId':Number(_0x50c19a['id'])});}});}})['catch'](function(_0x38a627){_0x50896b[_0x6ffd('0x54')](_0x38a627);});}}function onDisconnect(_0x46f9bc,_0x4e1198){joinOrLeave(_0x46f9bc,_0x6ffd('0x45'),_0x4e1198);}function onConnect(_0x51cf91){joinOrLeave(_0x51cf91,_0x6ffd('0x55'));}exports['default']=function(_0x363959){_0x363959['on'](_0x6ffd('0x56'),function(_0xb618ef){_0xb618ef[_0x6ffd('0x57')](0x0);_0xb618ef['address']=_0xb618ef[_0x6ffd('0x58')][_0x6ffd('0x56')][_0x6ffd('0x59')]+':'+_0xb618ef[_0x6ffd('0x58')][_0x6ffd('0x56')][_0x6ffd('0x5a')];_0xb618ef[_0x6ffd('0x5b')]=new Date();_0xb618ef[_0x6ffd('0x54')]=function(_0x3c9f20){console[_0x6ffd('0x54')](_0x6ffd('0x5c')+_0xb618ef[_0x6ffd('0x5d')][_0x6ffd('0x3')]+'['+_0xb618ef[_0x6ffd('0x5e')]+']',_0x3c9f20);};_0xb618ef['on'](_0x6ffd('0x5f'),function(){onDisconnect(_0xb618ef,_0x363959);_0xb618ef[_0x6ffd('0x54')](_0x6ffd('0x60'));});onConnect(_0xb618ef);_0xb618ef[_0x6ffd('0x54')](_0x6ffd('0x61'));});}; \ No newline at end of file +var _0x1c77=['getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','length','chat','fax','mail','openchannel','whatsapp','trunk:%s','leave','removeChatInteractions','emit','user_has_chat_interactions:remove','removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','catch','log','join','default','connection','address','request','remoteAddress','remotePort','connectedAt','nsp','disconnect','DISCONNECTED','CONNECTED','util','bluebird','../mysqldb','./environment','name','User','role','agent','telephone','type','ivr','then','autoAssociation','VoiceQueues','ChatQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','Telephones','findAll','Trunks','IvrCampaigns','resourceId','map','where','Campaign','format','%s:queue:%s','Agents','user:%s','handshake','query','find','userProfileId','ChatInteractions','MailInteraction','MailInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','admin','voice:outbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','OpenchannelQueue','WhatsappQueue','Trunk','voice:inbound','FaxQueues','MailQueue','getVoiceQueues'];(function(_0x531439,_0x5eded2){var _0x3134a0=function(_0x285bf7){while(--_0x285bf7){_0x531439['push'](_0x531439['shift']());}};_0x3134a0(++_0x5eded2);}(_0x1c77,0xed));var _0x71c7=function(_0x378720,_0xa711f1){_0x378720=_0x378720-0x0;var _0x47920a=_0x1c77[_0x378720];return _0x47920a;};'use strict';var _=require('lodash');var util=require(_0x71c7('0x0'));var BPromise=require(_0x71c7('0x1'));var db=require(_0x71c7('0x2'))['db'];var config=require(_0x71c7('0x3'));var queryQueues={'attributes':['id',_0x71c7('0x4')],'include':[{'as':'Agents','model':db[_0x71c7('0x5')],'attributes':['id',_0x71c7('0x4'),_0x71c7('0x6')],'raw':!![],'where':{'role':_0x71c7('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x71c7('0x4')],'where':{'role':_0x71c7('0x8')}};var queryTrunks={'raw':!![],'attributes':['id',_0x71c7('0x4')]};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id',_0x71c7('0x4'),_0x71c7('0x9')],'where':{'type':_0x71c7('0xa')}};function getAssociatedResources(_0x471bc6,_0x4a2f5e,_0x1f5fc9){return db['UserProfileSection']['findOne']({'where':{'name':_0x471bc6,'userProfileId':_0x4a2f5e},'raw':!![]})[_0x71c7('0xb')](function(_0x302f14){if(_0x302f14){if(_0x302f14[_0x71c7('0xc')]){switch(_0x471bc6){case _0x71c7('0xd'):case _0x71c7('0xe'):case'FaxQueues':case _0x71c7('0xf'):case _0x71c7('0x10'):case _0x71c7('0x11'):case _0x71c7('0x12'):return db[_0x1f5fc9]['findAll'](queryQueues);case _0x71c7('0x13'):return db[_0x1f5fc9][_0x71c7('0x14')](queryTelephones);case _0x71c7('0x15'):return db[_0x1f5fc9][_0x71c7('0x14')](queryTrunks);case _0x71c7('0x16'):return db[_0x1f5fc9][_0x71c7('0x14')](queryCampaigns);}}else{return db['UserProfileResource']['findAll']({'attributes':[_0x71c7('0x17')],'where':{'sectionId':_0x302f14['id']},'raw':!![]})[_0x71c7('0xb')](function(_0xc8b018){if(_0xc8b018){var _0x355b10={'where':{'id':_[_0x71c7('0x18')](_0xc8b018,_0x71c7('0x17'))},'raw':!![]};switch(_0x1f5fc9){case _0x71c7('0x5'):_0x355b10[_0x71c7('0x19')]['role']=_0x71c7('0x8');break;case _0x71c7('0x1a'):_0x355b10[_0x71c7('0x19')][_0x71c7('0x9')]=_0x71c7('0xa');break;}return db[_0x1f5fc9]['findAll'](_0x355b10);}else{return[];}});}}else{return[];}})['then'](function(_0xbe59dc){return _0xbe59dc;});}function joinOrLeaveQueues(_0x1c2fc7,_0x48e8e5,_0x51253b,_0x46aa9f){_0x1c2fc7[_0x48e8e5](util[_0x71c7('0x1b')](_0x71c7('0x1c'),_0x51253b,_0x46aa9f[_0x71c7('0x4')]));if(_0x46aa9f[_0x71c7('0x1d')]){for(var _0x2f5feb=0x0;_0x2f5feb<_0x46aa9f[_0x71c7('0x1d')]['length'];_0x2f5feb+=0x1){_0x1c2fc7[_0x48e8e5](util['format'](_0x71c7('0x1e'),_0x46aa9f[_0x71c7('0x1d')][_0x2f5feb][_0x71c7('0x4')]));}}}function joinOrLeave(_0x4149db,_0x3e3498,_0x8ce599){var _0x2b4712;if(_0x4149db[_0x71c7('0x1f')][_0x71c7('0x20')]['id']){db[_0x71c7('0x5')][_0x71c7('0x21')]({'attributes':['id',_0x71c7('0x4'),_0x71c7('0x6'),_0x71c7('0x22')],'where':{'id':_0x4149db['handshake'][_0x71c7('0x20')]['id']},'include':[{'model':db['ChatInteraction'],'as':_0x71c7('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0x71c7('0x24')],'as':_0x71c7('0x25'),'attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x71c7('0x26')],'as':_0x71c7('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0x71c7('0x28')],'as':_0x71c7('0x29'),'attributes':['id'],'raw':!![]},{'model':db[_0x71c7('0x2a')],'as':_0x71c7('0x2b'),'attributes':['id'],'raw':!![]}]})[_0x71c7('0xb')](function(_0x5912f9){if(_0x5912f9){_0x2b4712=_0x5912f9;_0x4149db[_0x3e3498](util[_0x71c7('0x1b')](_0x71c7('0x1e'),_0x5912f9['name']));var _0x23a0ae=[];switch(_0x5912f9[_0x71c7('0x6')]){case _0x71c7('0x2c'):_0x4149db[_0x3e3498]('voice:inbound');_0x4149db[_0x3e3498](_0x71c7('0x2d'));if(queryQueues[_0x71c7('0x2e')](_0x71c7('0x2f'))){delete queryQueues[_0x71c7('0x2f')];}_0x23a0ae[_0x71c7('0x30')](db[_0x71c7('0x31')]['findAll'](queryQueues));_0x23a0ae[_0x71c7('0x30')](db[_0x71c7('0x32')][_0x71c7('0x14')](queryQueues));_0x23a0ae[_0x71c7('0x30')](db[_0x71c7('0x33')][_0x71c7('0x14')](queryQueues));_0x23a0ae[_0x71c7('0x30')](db[_0x71c7('0x34')]['findAll'](queryQueues));_0x23a0ae[_0x71c7('0x30')](db['MailQueue'][_0x71c7('0x14')](queryQueues));_0x23a0ae[_0x71c7('0x30')](db[_0x71c7('0x35')][_0x71c7('0x14')](queryQueues));_0x23a0ae[_0x71c7('0x30')](db[_0x71c7('0x36')][_0x71c7('0x14')](queryQueues));_0x23a0ae[_0x71c7('0x30')](db[_0x71c7('0x5')][_0x71c7('0x14')](queryTelephones));_0x23a0ae[_0x71c7('0x30')](db[_0x71c7('0x37')]['findAll'](queryTrunks));_0x23a0ae['push'](db['Campaign'][_0x71c7('0x14')](queryCampaigns));_0x23a0ae['push'](db[_0x71c7('0x5')][_0x71c7('0x14')](queryAgents));break;case'user':_0x4149db[_0x3e3498](_0x71c7('0x38'));_0x4149db[_0x3e3498](_0x71c7('0x2d'));_0x23a0ae[_0x71c7('0x30')](getAssociatedResources('VoiceQueues',_0x5912f9[_0x71c7('0x22')],_0x71c7('0x31')));_0x23a0ae[_0x71c7('0x30')](getAssociatedResources(_0x71c7('0xe'),_0x5912f9[_0x71c7('0x22')],_0x71c7('0x32')));_0x23a0ae[_0x71c7('0x30')](getAssociatedResources(_0x71c7('0x39'),_0x5912f9[_0x71c7('0x22')],'FaxQueue'));_0x23a0ae['push'](getAssociatedResources(_0x71c7('0xf'),_0x5912f9[_0x71c7('0x22')],_0x71c7('0x34')));_0x23a0ae['push'](getAssociatedResources(_0x71c7('0x10'),_0x5912f9[_0x71c7('0x22')],_0x71c7('0x3a')));_0x23a0ae[_0x71c7('0x30')](getAssociatedResources(_0x71c7('0x11'),_0x5912f9[_0x71c7('0x22')],'OpenchannelQueue'));_0x23a0ae[_0x71c7('0x30')](getAssociatedResources(_0x71c7('0x12'),_0x5912f9[_0x71c7('0x22')],'WhatsappQueue'));_0x23a0ae[_0x71c7('0x30')](getAssociatedResources('Telephones',_0x5912f9[_0x71c7('0x22')],_0x71c7('0x5')));_0x23a0ae[_0x71c7('0x30')](getAssociatedResources('Trunks',_0x5912f9[_0x71c7('0x22')],'Trunk'));_0x23a0ae[_0x71c7('0x30')](getAssociatedResources('IvrCampaigns',_0x5912f9[_0x71c7('0x22')],_0x71c7('0x1a')));_0x23a0ae[_0x71c7('0x30')](db['User']['findAll'](queryAgents));break;case _0x71c7('0x7'):_0x4149db[_0x3e3498](_0x71c7('0x38'));_0x4149db[_0x3e3498](_0x71c7('0x2d'));_0x23a0ae['push'](_0x5912f9[_0x71c7('0x3b')]({'attributes':['id','name']}));_0x23a0ae[_0x71c7('0x30')](_0x5912f9[_0x71c7('0x3c')]({'attributes':['id','name']}));_0x23a0ae[_0x71c7('0x30')](_0x5912f9[_0x71c7('0x3d')]({'attributes':['id',_0x71c7('0x4')]}));_0x23a0ae[_0x71c7('0x30')](_0x5912f9[_0x71c7('0x3e')]({'attributes':['id','name']}));_0x23a0ae[_0x71c7('0x30')](_0x5912f9[_0x71c7('0x3f')]({'attributes':['id',_0x71c7('0x4')]}));_0x23a0ae['push'](_0x5912f9[_0x71c7('0x40')]({'attributes':['id',_0x71c7('0x4')]}));_0x23a0ae[_0x71c7('0x30')](_0x5912f9['getWhatsappQueues']({'attributes':['id',_0x71c7('0x4')]}));break;}return BPromise['all'](_0x23a0ae);}})[_0x71c7('0xb')](function(_0x3efef2){if(_0x3efef2&&_0x3efef2[_0x71c7('0x41')]){for(var _0x35d652=0x0;_0x35d652<_0x3efef2[_0x71c7('0x41')];_0x35d652+=0x1){for(var _0xa00e70=0x0;_0xa00e70<_0x3efef2[_0x35d652][_0x71c7('0x41')];_0xa00e70+=0x1){switch(_0x35d652){case 0x0:joinOrLeaveQueues(_0x4149db,_0x3e3498,'voice',_0x3efef2[_0x35d652][_0xa00e70]);break;case 0x1:joinOrLeaveQueues(_0x4149db,_0x3e3498,_0x71c7('0x42'),_0x3efef2[_0x35d652][_0xa00e70]);break;case 0x2:joinOrLeaveQueues(_0x4149db,_0x3e3498,_0x71c7('0x43'),_0x3efef2[_0x35d652][_0xa00e70]);break;case 0x3:joinOrLeaveQueues(_0x4149db,_0x3e3498,'sms',_0x3efef2[_0x35d652][_0xa00e70]);break;case 0x4:joinOrLeaveQueues(_0x4149db,_0x3e3498,_0x71c7('0x44'),_0x3efef2[_0x35d652][_0xa00e70]);break;case 0x5:joinOrLeaveQueues(_0x4149db,_0x3e3498,_0x71c7('0x45'),_0x3efef2[_0x35d652][_0xa00e70]);break;case 0x6:joinOrLeaveQueues(_0x4149db,_0x3e3498,_0x71c7('0x46'),_0x3efef2[_0x35d652][_0xa00e70]);break;case 0x7:if(_0x2b4712[_0x71c7('0x6')]!=='agent')_0x4149db[_0x3e3498](util['format']('telephone:%s',_0x3efef2[_0x35d652][_0xa00e70][_0x71c7('0x4')]));break;case 0x8:if(_0x2b4712['role']!==_0x71c7('0x7'))_0x4149db[_0x3e3498](util['format'](_0x71c7('0x47'),_0x3efef2[_0x35d652][_0xa00e70][_0x71c7('0x4')]));break;case 0x9:if(_0x2b4712[_0x71c7('0x6')]!==_0x71c7('0x7'))_0x4149db[_0x3e3498](util['format']('campaign:%s:%s',_0x3efef2[_0x35d652][_0xa00e70][_0x71c7('0x9')],_0x3efef2[_0x35d652][_0xa00e70][_0x71c7('0x4')]));break;case 0xa:_0x4149db[_0x3e3498](util[_0x71c7('0x1b')](_0x71c7('0x1e'),_0x3efef2[_0x35d652][_0xa00e70][_0x71c7('0x4')]));break;}}}}})[_0x71c7('0xb')](function(){if(_0x3e3498===_0x71c7('0x48')){var _0x4fa6c7=_[_0x71c7('0x18')](_0x2b4712[_0x71c7('0x23')],'id');return _0x2b4712[_0x71c7('0x49')](_0x4fa6c7)[_0x71c7('0xb')](function(){for(var _0x4e755d=0x0;_0x4e755d<_0x4fa6c7[_0x71c7('0x41')];_0x4e755d+=0x1){_0x8ce599[_0x71c7('0x4a')](_0x71c7('0x4b'),{'ChatInteractionId':Number(_0x4fa6c7[_0x4e755d]),'UserId':Number(_0x2b4712['id'])});}});}})['then'](function(){if(_0x3e3498===_0x71c7('0x48')){var _0x4ea505=_['map'](_0x2b4712[_0x71c7('0x25')],'id');return _0x2b4712[_0x71c7('0x4c')](_0x4ea505)[_0x71c7('0xb')](function(){for(var _0x12e1cc=0x0;_0x12e1cc<_0x4ea505['length'];_0x12e1cc+=0x1){_0x8ce599[_0x71c7('0x4a')](_0x71c7('0x4d'),{'MailInteractionId':Number(_0x4ea505[_0x12e1cc]),'UserId':Number(_0x2b4712['id'])});}});}})[_0x71c7('0xb')](function(){if(_0x3e3498===_0x71c7('0x48')){var _0x1f5bc1=_[_0x71c7('0x18')](_0x2b4712['FaxInteractions'],'id');return _0x2b4712[_0x71c7('0x4e')](_0x1f5bc1)[_0x71c7('0xb')](function(){for(var _0x8a7d15=0x0;_0x8a7d15<_0x1f5bc1[_0x71c7('0x41')];_0x8a7d15+=0x1){_0x8ce599[_0x71c7('0x4a')](_0x71c7('0x4f'),{'FaxInteractionId':Number(_0x1f5bc1[_0x8a7d15]),'UserId':Number(_0x2b4712['id'])});}});}})['then'](function(){if(_0x3e3498===_0x71c7('0x48')){var _0x386fe9=_[_0x71c7('0x18')](_0x2b4712[_0x71c7('0x27')],'id');return _0x2b4712[_0x71c7('0x50')](_0x386fe9)[_0x71c7('0xb')](function(){for(var _0x45857d=0x0;_0x45857d<_0x386fe9[_0x71c7('0x41')];_0x45857d+=0x1){_0x8ce599[_0x71c7('0x4a')](_0x71c7('0x51'),{'SmsInteractionId':Number(_0x386fe9[_0x45857d]),'UserId':Number(_0x2b4712['id'])});}});}})[_0x71c7('0xb')](function(){if(_0x3e3498===_0x71c7('0x48')){var _0x1dd14b=_[_0x71c7('0x18')](_0x2b4712[_0x71c7('0x29')],'id');return _0x2b4712[_0x71c7('0x52')](_0x1dd14b)['then'](function(){for(var _0x3918ac=0x0;_0x3918ac<_0x1dd14b[_0x71c7('0x41')];_0x3918ac+=0x1){_0x8ce599[_0x71c7('0x4a')](_0x71c7('0x53'),{'OpenchannelInteractionId':Number(_0x1dd14b[_0x3918ac]),'UserId':Number(_0x2b4712['id'])});}});}})['then'](function(){if(_0x3e3498===_0x71c7('0x48')){var _0x29d1af=_[_0x71c7('0x18')](_0x2b4712[_0x71c7('0x2b')],'id');return _0x2b4712[_0x71c7('0x54')](_0x29d1af)[_0x71c7('0xb')](function(){for(var _0x71911=0x0;_0x71911<_0x29d1af['length'];_0x71911+=0x1){_0x8ce599[_0x71c7('0x4a')]('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x29d1af[_0x71911]),'UserId':Number(_0x2b4712['id'])});}});}})[_0x71c7('0x55')](function(_0x2ce69a){_0x4149db[_0x71c7('0x56')](_0x2ce69a);});}}function onDisconnect(_0x102f90,_0x17a595){joinOrLeave(_0x102f90,_0x71c7('0x48'),_0x17a595);}function onConnect(_0x13fbc9){joinOrLeave(_0x13fbc9,_0x71c7('0x57'));}exports[_0x71c7('0x58')]=function(_0x388a0c){_0x388a0c['on'](_0x71c7('0x59'),function(_0x35295f){_0x35295f['setMaxListeners'](0x0);_0x35295f[_0x71c7('0x5a')]=_0x35295f[_0x71c7('0x5b')]['connection'][_0x71c7('0x5c')]+':'+_0x35295f[_0x71c7('0x5b')]['connection'][_0x71c7('0x5d')];_0x35295f[_0x71c7('0x5e')]=new Date();_0x35295f[_0x71c7('0x56')]=function(_0x4c6fe7){console[_0x71c7('0x56')]('SocketIO\x20'+_0x35295f[_0x71c7('0x5f')]['name']+'['+_0x35295f[_0x71c7('0x5a')]+']',_0x4c6fe7);};_0x35295f['on'](_0x71c7('0x60'),function(){onDisconnect(_0x35295f,_0x388a0c);_0x35295f['log'](_0x71c7('0x61'));});onConnect(_0x35295f);_0x35295f[_0x71c7('0x56')](_0x71c7('0x62'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 51edc6a..bd00cd1 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 _0x020a=['query','Sequelize','QueryTypes','UserId','interface','SIP/%s','name','agent','incomingmessage','outgoingmessage','motionChannel','opened','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','SELECT','contact','format','AfterCreate','changed','closed','substatus','AfterUpdate','find','email','internal','hasOwnProperty','model','hook','callback','toLowerCase','condition','util','../../mysqldb','../logger','triggers','http','ChatInteraction','afterCreate','Chat','afterUpdate','closedinteraction','ChatMessage','newmessage','ChatOfflineMessage','Sms','SmsInteraction','newinteraction','SmsMessage','Whatsapp','WhatsappInteraction','WhatsappMessage','Fax','FaxInteraction','FaxMessage','Mail','MailInteraction','Openchannel','OpenchannelInteraction','OpenchannelMessage','request','then','Trigger,\x20%s','error','EventManager','catch','get','channel','event','direction','resolve','ContactId','undefined','sequelize'];(function(_0x13486c,_0x139348){var _0x135738=function(_0x3e494a){while(--_0x3e494a){_0x13486c['push'](_0x13486c['shift']());}};_0x135738(++_0x139348);}(_0x020a,0x13e));var _0xa020=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0x020a[_0x29d94e];return _0x106237;};'use strict';var util=require(_0xa020('0x0'));var db=require(_0xa020('0x1'))['db'];var jayson=require('jayson/promise');var logger=require(_0xa020('0x2'))(_0xa020('0x3'));var client=jayson['client'][_0xa020('0x4')]({'port':0x232a});var triggers=[{'channel':'Chat','model':_0xa020('0x5'),'event':_0xa020('0x6'),'condition':'newinteraction','callback':afterCreate},{'channel':_0xa020('0x7'),'model':_0xa020('0x5'),'event':_0xa020('0x8'),'condition':_0xa020('0x9'),'callback':afterUpdate},{'channel':_0xa020('0x7'),'model':_0xa020('0xa'),'event':_0xa020('0x6'),'condition':_0xa020('0xb'),'callback':afterCreateMessage},{'channel':_0xa020('0x7'),'model':_0xa020('0xc'),'event':'afterCreate','condition':_0xa020('0xb'),'callback':afterCreateOfflineMessage},{'channel':_0xa020('0xd'),'model':_0xa020('0xe'),'event':_0xa020('0x6'),'condition':_0xa020('0xf'),'callback':afterCreate},{'channel':'Sms','model':_0xa020('0xe'),'event':_0xa020('0x8'),'condition':_0xa020('0x9'),'callback':afterUpdate},{'channel':'Sms','model':_0xa020('0x10'),'event':_0xa020('0x6'),'condition':_0xa020('0xb'),'callback':afterCreateMessage},{'channel':_0xa020('0x11'),'model':'WhatsappInteraction','event':_0xa020('0x6'),'condition':_0xa020('0xf'),'callback':afterCreate},{'channel':_0xa020('0x11'),'model':_0xa020('0x12'),'event':_0xa020('0x8'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0xa020('0x11'),'model':_0xa020('0x13'),'event':_0xa020('0x6'),'condition':_0xa020('0xb'),'callback':afterCreateMessage},{'channel':_0xa020('0x14'),'model':_0xa020('0x15'),'event':_0xa020('0x6'),'condition':_0xa020('0xf'),'callback':afterCreate},{'channel':_0xa020('0x14'),'model':_0xa020('0x15'),'event':_0xa020('0x8'),'condition':_0xa020('0x9'),'callback':afterUpdate},{'channel':_0xa020('0x14'),'model':_0xa020('0x16'),'event':_0xa020('0x6'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0xa020('0x17'),'model':'MailInteraction','event':'afterCreate','condition':_0xa020('0xf'),'callback':afterCreate},{'channel':_0xa020('0x17'),'model':_0xa020('0x18'),'event':_0xa020('0x8'),'condition':_0xa020('0x9'),'callback':afterUpdate},{'channel':_0xa020('0x17'),'model':'MailMessage','event':_0xa020('0x6'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0xa020('0x19'),'model':_0xa020('0x1a'),'event':_0xa020('0x6'),'condition':_0xa020('0xf'),'callback':afterCreate},{'channel':_0xa020('0x19'),'model':_0xa020('0x1a'),'event':_0xa020('0x8'),'condition':_0xa020('0x9'),'callback':afterUpdate},{'channel':_0xa020('0x19'),'model':_0xa020('0x1b'),'event':_0xa020('0x6'),'condition':_0xa020('0xb'),'callback':afterCreateMessage}];function request(_0x53dd06){return client[_0xa020('0x1c')]('EventManager',_0x53dd06)[_0xa020('0x1d')](function(_0x368abb){logger['info'](_0xa020('0x1e'),'EventManager',_0x368abb);if(_0x368abb['error']){if(_0x368abb[_0xa020('0x1f')]['code']===0x1f4){logger[_0xa020('0x1f')](_0xa020('0x1e'),_0xa020('0x20'),_0x368abb['error']);}}})[_0xa020('0x21')](function(_0x407916){logger[_0xa020('0x1f')](_0xa020('0x1e'),_0xa020('0x20'),_0x407916);});}function afterCreateMessage(_0x1b812c){return function(_0x299009){_0x299009=_0x299009[_0xa020('0x22')]({'plain':!![]});_0x299009[_0xa020('0x23')]=_0x1b812c;_0x299009['motionChannel']=_0x1b812c;_0x299009[_0xa020('0x24')]=_0x299009[_0xa020('0x25')];Promise[_0xa020('0x26')]()['then'](function(){if(typeof _0x299009[_0xa020('0x27')]===_0xa020('0x28'))return null;var _0x2df6aa='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x299009[_0xa020('0x27')];return db[_0xa020('0x29')][_0xa020('0x2a')](_0x2df6aa,{'type':db[_0xa020('0x2b')][_0xa020('0x2c')]['SELECT'],'raw':!![]});})[_0xa020('0x1d')](function(_0x5a3c3b){if(_0x5a3c3b){_0x299009['contact']=_0x5a3c3b[0x0];}if(typeof _0x299009[_0xa020('0x2d')]===_0xa020('0x28'))return;return getAgent(_0x299009[_0xa020('0x2d')]);})[_0xa020('0x1d')](function(_0x4bb971){if(_0x4bb971){_0x299009[_0xa020('0x2e')]=util['format'](_0xa020('0x2f'),_0x4bb971[_0xa020('0x30')]);_0x299009[_0xa020('0x31')]=_0x4bb971;_0x299009[_0xa020('0x23')]=_0x1b812c;return request({'event':_0xa020('0x32'),'message':_0x299009});}else{return request({'event':_0xa020('0x33'),'message':_0x299009});}})[_0xa020('0x21')](function(_0x3da8ad){logger[_0xa020('0x1f')](_0xa020('0x1e'),'AfterCreateMessage',_0x3da8ad);});};}function afterCreateOfflineMessage(_0x182d4b){return function(_0x3758bf){_0x3758bf=_0x3758bf[_0xa020('0x22')]({'plain':!![]});_0x3758bf[_0xa020('0x23')]=_0x182d4b;_0x3758bf[_0xa020('0x34')]=_0x182d4b;_0x3758bf[_0xa020('0x24')]='offlineMessage';return request({'event':_0x3758bf[_0xa020('0x24')],'message':_0x3758bf});};}function afterCreate(_0xb351f5,_0x3b66ec){return function(_0xc78177){var _0x509096=_0xc78177['get']({'plain':!![]});_0x509096[_0xa020('0x23')]=_0xb351f5;_0x509096[_0xa020('0x34')]=_0xb351f5;_0x509096['event']=_0xa020('0x35');Promise[_0xa020('0x26')]()[_0xa020('0x1d')](function(){var _0x56021c=_0xa020('0x36')+_0x509096[_0xa020('0x27')];return db[_0xa020('0x29')][_0xa020('0x2a')](_0x56021c,{'type':db[_0xa020('0x2b')][_0xa020('0x2c')][_0xa020('0x37')],'raw':!![]});})['then'](function(_0x474330){if(_0x474330){_0x509096[_0xa020('0x38')]=_0x474330[0x0];}if(_0x509096[_0xa020('0x2d')]){return getAgent(_0x509096[_0xa020('0x2d')]);}return;})[_0xa020('0x1d')](function(_0x134688){if(_0x134688){_0x509096[_0xa020('0x2e')]=util[_0xa020('0x39')](_0xa020('0x2f'),_0x134688[_0xa020('0x30')]);_0x509096[_0xa020('0x31')]=_0x134688;}return request({'event':_0x3b66ec,'message':_0x509096});})[_0xa020('0x21')](function(_0x49909c){logger['error'](_0xa020('0x1e'),_0xa020('0x3a'),_0x49909c);});};}function afterUpdate(_0x4d33b6){return function(_0x44a5f3){var _0x4b45bd=_0x44a5f3[_0xa020('0x3b')](_0xa020('0x3c'))&&_0x44a5f3[_0xa020('0x3c')];var _0x28ac28=_0x44a5f3['changed'](_0xa020('0x3d'));if(_0x4b45bd||_0x28ac28){var _0x1d5ce4=_0x4b45bd?'closedinteraction':_0xa020('0x3d');var _0x3e8781=_0x44a5f3[_0xa020('0x22')]({'plain':!![]});_0x3e8781[_0xa020('0x23')]=_0x4d33b6;_0x3e8781[_0xa020('0x34')]=_0x4d33b6;_0x3e8781[_0xa020('0x24')]=_0x4b45bd?_0xa020('0x3c'):_0xa020('0x3d');var _0x5e6542='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x3e8781[_0xa020('0x27')];return db[_0xa020('0x29')]['query'](_0x5e6542,{'type':db[_0xa020('0x2b')][_0xa020('0x2c')][_0xa020('0x37')],'raw':!![]})[_0xa020('0x1d')](function(_0x2be2e3){if(_0x2be2e3){_0x3e8781[_0xa020('0x38')]=_0x2be2e3[0x0];}if(typeof _0x3e8781[_0xa020('0x2d')]===_0xa020('0x28'))return;return getAgent(_0x3e8781[_0xa020('0x2d')]);})[_0xa020('0x1d')](function(_0x3bae73){if(_0x3bae73){_0x3e8781['interface']=util['format'](_0xa020('0x2f'),_0x3bae73[_0xa020('0x30')]);_0x3e8781[_0xa020('0x31')]=_0x3bae73;}return request({'event':_0x1d5ce4,'message':_0x3e8781});})[_0xa020('0x21')](function(_0x3ce1c8){logger[_0xa020('0x1f')](_0xa020('0x1e'),_0xa020('0x3e'),_0x3ce1c8);});}};}function getAgent(_0x13c162){return db['User'][_0xa020('0x3f')]({'where':{'id':_0x13c162},'attributes':['id',_0xa020('0x30'),'fullname',_0xa020('0x40'),_0xa020('0x41')],'raw':!![]})[_0xa020('0x1d')](function(_0x38506b){return _0x38506b;});}exports['default']=function(){for(var _0x34eea9=0x0;_0x34eea9=_0x5c6716[_0x4ba1('0x14')]){throw Error(_0x4ba1('0x15'));}_0x8f0c90(_0x372c87);})[_0x4ba1('0x16')](function(_0x9cdab4){_0xfe7846(_0x9cdab4);});});}; \ No newline at end of file +var _0x6ba9=['count','then','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','catch','lodash','../mysqldb','./license/util','chat','fax','whatsapp','openchannel','getChannels','isValidChannel','includes','clearBlockUser','updateAttributes','role','agent','User'];(function(_0x50e68f,_0x44c2f6){var _0xef3a05=function(_0x116727){while(--_0x116727){_0x50e68f['push'](_0x50e68f['shift']());}};_0xef3a05(++_0x44c2f6);}(_0x6ba9,0x16b));var _0x96ba=function(_0x2518a5,_0x164166){_0x2518a5=_0x2518a5-0x0;var _0x446394=_0x6ba9[_0x2518a5];return _0x446394;};'use strict';var _=require(_0x96ba('0x0'));var BPromise=require('bluebird');var db=require(_0x96ba('0x1'))['db'];var util=require(_0x96ba('0x2'));var channels=['voice','mail',_0x96ba('0x3'),_0x96ba('0x4'),'sms',_0x96ba('0x5'),_0x96ba('0x6')];exports[_0x96ba('0x7')]=function(){return channels;};exports[_0x96ba('0x8')]=function(_0x3d2950){_0x3d2950=_0x3d2950['toLowerCase']();return _[_0x96ba('0x9')](channels,_0x3d2950);};exports[_0x96ba('0xa')]=function(_0x5486ec,_0x3c0b11,_0x4567d7,_0x49f57c){var _0x2b56dd={'loginAttempts':_0x3c0b11,'blocked':_0x4567d7};if(!_['isUndefined'](_0x49f57c)){_0x2b56dd['blockedAt']=_0x49f57c;}return _0x5486ec[_0x96ba('0xb')](_0x2b56dd);};exports['getLicense']=function(_0x6a2ae7){return new BPromise(function(_0x5b4130,_0x3ddd43){var _0x48819b=0x0;if(_0x6a2ae7[_0x96ba('0xc')]!==_0x96ba('0xd')){_0x5b4130(_0x6a2ae7);}db[_0x96ba('0xe')][_0x96ba('0xf')]({'where':{'role':_0x96ba('0xd'),'online':!![],'id':{'$ne':_0x6a2ae7['id']}}})[_0x96ba('0x10')](function(_0x124ce6){_0x48819b=_0x124ce6;return util[_0x96ba('0x11')]();})[_0x96ba('0x10')](function(_0x11b918){if(_0x11b918&&_0x11b918['agents']&&_0x48819b>=_0x11b918[_0x96ba('0x12')]){throw Error(_0x96ba('0x13'));}_0x5b4130(_0x6a2ae7);})[_0x96ba('0x14')](function(_0x3d400d){_0x3ddd43(_0x3d400d);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index 1ae88ee..fedd5d7 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5839=['Resource\x20Conflict','error','stack','statusMessage','exports','util','../config/logger','api','Internal\x20Server\x20Error','name','Error','inherits','message','Bad\x20Request','Forbidden','Not\x20Found','Message\x20sent\x20outside\x20a\x20valid\x20interval','Out\x20Of\x20Interval','code','details'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0x5839,0x1e5));var _0x9583=function(_0x5459b0,_0x4d2ef8){_0x5459b0=_0x5459b0-0x0;var _0x675a35=_0x5839[_0x5459b0];return _0x675a35;};'use strict';var util=require(_0x9583('0x0'));var logger=require(_0x9583('0x1'))(_0x9583('0x2'));var APIError=function(_0x4ab028,_0x195701){this['message']=_0x4ab028||_0x9583('0x3');this[_0x9583('0x4')]=_0x195701||_0x9583('0x5');util[_0x9583('0x6')](APIError,Error);};var APIBadRequestError=function(_0xb2ccc5){this[_0x9583('0x7')]=_0xb2ccc5||'Bad\x20Request';this[_0x9583('0x4')]=_0x9583('0x8');util[_0x9583('0x6')](APIBadRequestError,APIError);};var APIForbiddenError=function(_0x3f01fb){this['message']=_0x3f01fb||_0x9583('0x9');this['name']=_0x9583('0x9');util[_0x9583('0x6')](APIForbiddenError,APIError);};var APINotFoundError=function(_0x18f2dc){this[_0x9583('0x7')]=_0x18f2dc||'Entity\x20not\x20found';this[_0x9583('0x4')]=_0x9583('0xa');util[_0x9583('0x6')](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x12ed67){this[_0x9583('0x7')]=_0x12ed67||_0x9583('0xb');this[_0x9583('0x4')]=_0x9583('0xc');this[_0x9583('0xd')]=0x193;this[_0x9583('0xe')]={'type':'OutOfInterval'};util[_0x9583('0x6')](APIOutOfIntervalError,APIError);};var APIConflictError=function(_0x221c16){this[_0x9583('0x7')]=_0x221c16||_0x9583('0xf');this[_0x9583('0x4')]='Conflict';util[_0x9583('0x6')](APIBadRequestError,APIError);};function getStatusCode(_0x5b81d5){switch(_0x5b81d5){case _0x9583('0x8'):return 0x190;case'Forbidden','Out\x20Of\x20Interval':return 0x193;case'Not\x20Found':return 0x194;case'Conflict':return 0x199;default:return 0x1f4;}}function getCustomStatusMessage(_0x7ef345){if(_0x7ef345===_0x9583('0xc'))return _0x7ef345;return null;}function handleError(_0x1e971d){return function(_0x1afdb2){logger[_0x9583('0x10')](_0x1afdb2[_0x9583('0x11')]);var _0x14471a=getStatusCode(_0x1afdb2['name']);var _0x5eb8ee=getCustomStatusMessage(_0x1afdb2[_0x9583('0x4')]);if(_0x1afdb2[_0x9583('0x4')]){delete _0x1afdb2[_0x9583('0x4')];}if(_0x5eb8ee){_0x1e971d[_0x9583('0x12')]=_0x5eb8ee;}return _0x1e971d['status'](_0x14471a)['send'](_0x1afdb2);};}module[_0x9583('0x13')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIForbiddenError':APIForbiddenError,'APINotFoundError':APINotFoundError,'APIOutOfIntervalError':APIOutOfIntervalError,'APIConflict':APIConflictError,'handleError':handleError}; \ No newline at end of file +var _0x09ef=['Conflict','Out\x20Of\x20Interval','error','stack','statusMessage','status','send','util','../config/logger','api','message','name','Error','Bad\x20Request','inherits','Forbidden','Message\x20sent\x20outside\x20a\x20valid\x20interval','code','OutOfInterval','Resource\x20Conflict'];(function(_0x93bdde,_0x26ca52){var _0x19fb76=function(_0x1f4e72){while(--_0x1f4e72){_0x93bdde['push'](_0x93bdde['shift']());}};_0x19fb76(++_0x26ca52);}(_0x09ef,0x11f));var _0xf09e=function(_0x194e0d,_0x205c17){_0x194e0d=_0x194e0d-0x0;var _0x1b3f8c=_0x09ef[_0x194e0d];return _0x1b3f8c;};'use strict';var util=require(_0xf09e('0x0'));var logger=require(_0xf09e('0x1'))(_0xf09e('0x2'));var APIError=function(_0x29f0ec,_0x3279b0){this[_0xf09e('0x3')]=_0x29f0ec||'Internal\x20Server\x20Error';this[_0xf09e('0x4')]=_0x3279b0||_0xf09e('0x5');util['inherits'](APIError,Error);};var APIBadRequestError=function(_0x431043){this[_0xf09e('0x3')]=_0x431043||_0xf09e('0x6');this[_0xf09e('0x4')]='Bad\x20Request';util[_0xf09e('0x7')](APIBadRequestError,APIError);};var APIForbiddenError=function(_0x30ab3f){this[_0xf09e('0x3')]=_0x30ab3f||_0xf09e('0x8');this[_0xf09e('0x4')]=_0xf09e('0x8');util[_0xf09e('0x7')](APIForbiddenError,APIError);};var APINotFoundError=function(_0x1e7291){this[_0xf09e('0x3')]=_0x1e7291||'Entity\x20not\x20found';this[_0xf09e('0x4')]='Not\x20Found';util['inherits'](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x47b5de){this[_0xf09e('0x3')]=_0x47b5de||_0xf09e('0x9');this[_0xf09e('0x4')]='Out\x20Of\x20Interval';this[_0xf09e('0xa')]=0x193;this['details']={'type':_0xf09e('0xb')};util[_0xf09e('0x7')](APIOutOfIntervalError,APIError);};var APIConflictError=function(_0x6874be){this[_0xf09e('0x3')]=_0x6874be||_0xf09e('0xc');this[_0xf09e('0x4')]=_0xf09e('0xd');util[_0xf09e('0x7')](APIBadRequestError,APIError);};function getStatusCode(_0x52b88d){switch(_0x52b88d){case _0xf09e('0x6'):return 0x190;case _0xf09e('0x8'),'Out\x20Of\x20Interval':return 0x193;case'Not\x20Found':return 0x194;case _0xf09e('0xd'):return 0x199;default:return 0x1f4;}}function getCustomStatusMessage(_0x2e4a06){if(_0x2e4a06===_0xf09e('0xe'))return _0x2e4a06;return null;}function handleError(_0x52ad1d){return function(_0x474f9f){logger[_0xf09e('0xf')](_0x474f9f[_0xf09e('0x10')]);var _0x2c755a=getStatusCode(_0x474f9f['name']);var _0xe274b4=getCustomStatusMessage(_0x474f9f[_0xf09e('0x4')]);if(_0x474f9f['name']){delete _0x474f9f[_0xf09e('0x4')];}if(_0xe274b4){_0x52ad1d[_0xf09e('0x11')]=_0xe274b4;}return _0x52ad1d[_0xf09e('0x12')](_0x2c755a)[_0xf09e('0x13')](_0x474f9f);};}module['exports']={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIForbiddenError':APIForbiddenError,'APINotFoundError':APINotFoundError,'APIOutOfIntervalError':APIOutOfIntervalError,'APIConflict':APIConflictError,'handleError':handleError}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 823b31a..17f60fb 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa454=['status','json','404'];(function(_0x5c869b,_0x1bc7f8){var _0x26e6b8=function(_0x314768){while(--_0x314768){_0x5c869b['push'](_0x5c869b['shift']());}};_0x26e6b8(++_0x1bc7f8);}(_0xa454,0xc8));var _0x4a45=function(_0x4b9e38,_0x47e700){_0x4b9e38=_0x4b9e38-0x0;var _0xfe5081=_0xa454[_0x4b9e38];return _0xfe5081;};'use strict';module['exports'][0x194]=function pageNotFound(_0x3c6ded,_0x26c368){var _0x2c20db=_0x4a45('0x0');var _0x573f8b=0x194;var _0x502b3b={'status':_0x573f8b};_0x26c368[_0x4a45('0x1')](_0x502b3b[_0x4a45('0x1')]);_0x26c368['render'](_0x2c20db,{},function(_0x29c254,_0x5d0cd4){if(_0x29c254){return _0x26c368[_0x4a45('0x1')](_0x502b3b['status'])[_0x4a45('0x2')](_0x502b3b);}_0x26c368['send'](_0x5d0cd4);});}; \ No newline at end of file +var _0x827a=['404','status','render','json','send','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x827a,0x167));var _0xa827=function(_0x3e6247,_0x1d2bb0){_0x3e6247=_0x3e6247-0x0;var _0x1e8056=_0x827a[_0x3e6247];return _0x1e8056;};'use strict';module[_0xa827('0x0')][0x194]=function pageNotFound(_0x5b350a,_0x538465){var _0x4615de=_0xa827('0x1');var _0x1053d0=0x194;var _0xd5d420={'status':_0x1053d0};_0x538465[_0xa827('0x2')](_0xd5d420['status']);_0x538465[_0xa827('0x3')](_0x4615de,{},function(_0x414421,_0x3c7208){if(_0x414421){return _0x538465['status'](_0xd5d420[_0xa827('0x2')])[_0xa827('0x4')](_0xd5d420);}_0x538465[_0xa827('0x5')](_0x3c7208);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index a6702a1..35475de 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa647=['../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','../api/faxTransferReport/faxTransferReport.model','../api/openchannelTransferReport/openchannelTransferReport.model','../api/smsTransferReport/smsTransferReport.model','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','UserProfileSection','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','../api/user-setting/user-setting.model','../api/mailInteractionHasTag/mailInteractionHasTag.model','User','hasOne','VoiceMail','UserSetting','userSetting','cascade','hasMany','Recordings','UserId','VoiceQueuesRt','Extensions','CmHopperHistory','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteractions','MailInteraction','MailInteractions','WhatsappInteraction','WhatsappInteractions','SenderId','Hoppers','belongsTo','userProfileId','belongsToMany','Contacts','Lists','cm_user_has_lists','Team','user_has_teams','user_has_chat_interactions','FaxInteraction','user_has_fax_interactions','user_has_sms_interactions','OpenchannelInteraction','user_has_openchannel_interactions','MailQueue','MailQueues','FaxQueue','FaxQueues','UserFaxQueue','SmsQueues','OpenchannelQueues','UserOpenchannelQueue','WhatsappQueue','WhatsappQueues','CmList','user_has_chat_websites','FaxAccount','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','SmsAccount','SmsAccounts','user_has_sms_accounts','WhatsappAccount','WhatsappAccounts','user_has_whatsapp_accounts','VoiceChanSpy','SpiedAgents','ChanSpyId','Sounds','moh_has_sounds','Members','VoiceQueueId','JscriptySessions','TrunkId','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Teams','voice_queues_has_cm_blacklists','Messages','mailboxuser','mailbox','QueueCalls','uniqueid','AgentReports','CmContact','Contact','ContactId','MailAccountId','CloudProviderId','restrict','MailServerOut','Imap','Dispositions','Answers','Applications','ListId','TemplateId','Agents','team_has_mail_queues','Account','Owner','Tags','mail_interaction_has_tags','ThroughTags','Users','user_has_mail_interactions','MailInteractionId','Attachments','Interaction','ChatWebsiteId','ChatOfflineMessage','ChatOfflineMessageId','TagId','List','Items','FaxAccountId','Interactions','Exntensions','FaxInteractionId','fax_interaction_has_tags','AttachmentId','FaxQueueReport','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelMessage','OpenchannelApplication','OpenchannelInteractionId','openchannel_interaction_has_tags','team_has_openchannel_queues','ChatMessage','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','ChatGroupId','chat_group_has_users','CmCompany','CompanyId','CmContactId','HopperHistories','cm_contact_has_tags','AdditionalPhones','CmHopperId','CampaignId','Condition','OneAll','Any','OneAny','Automation','Actions','MailApplications','FaxApplications','AnalyticDefaultReport','DefaultReportId','CustomReportId','ItemTypeId','Hopper','AllConditions','AllCondition','AnyCondition','TriggerAnyId','TriggerId','Fields','MetricId','Configurations','AccountId','Subjects','SubjectId','FieldId','Subject','Description','DescriptionId','VariableId','SugarcrmAccount','Descriptions','Field','int_desk_configuration_has_tags','ZohoField','Dynamics365Account','Dynamics365Configuration','Dynamics365Field','FreshsalesConfiguration','FromId','ToId','SessionId','JscriptyAnswerReport','ProjectId','VoiceQueues','team_has_chat_queues','ChatQueues','team_has_fax_queues','team_has_whatsapp_queues','VoicePrefixes','HopperFinals','HopperBlacks','TrunkBackup','TrunkBackupId','SquareProjectId','BlackLists','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','FromChatWebsiteId','FromUserId','ToUserId','ToAgent','ToChatQueueId','ToChatWebsiteId','FaxTransferReport','FromFaxAccountId','ToFaxQueueId','OpenchannelTransferReport','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','SmsTransferReport','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','CustomFields','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','whatsapp_interaction_has_tags','FromWhatsappAccountId','ToQueueId','user','Smtp','exports','../config/environment','sequelize','lodash','jstz','determine','defaultsDeep','motion2','xC@LL1234','127.0.0.1','name','utf8','utf8_general_ci','xcall','utf8mb4','database','password','sequelizeHistory','options','import','../api/user/user.model','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','VoiceRecording','../api/screenRecording/screenRecording.model','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','UserMailQueue','../api/userMailQueue/userMailQueue.model','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','../api/faxQueue/faxQueue.model','../api/faxQueueReport/faxQueueReport.model','SmsApplication','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','SmsQueue','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','../api/openchannelApplication/openchannelApplication.model','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','CmCustomField','Action','../api/action/action.model','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/condition/condition.model','Interval','Pause','Cdr','VoiceQueuesLog','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','CmContactHasItem','../api/cmContactHasItem/cmContactHasItem.model','CmHopperAdditionalPhone','Template','Trigger','../api/trigger/trigger.model','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','SalesforceAccount','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','ServicenowField','../api/intDynamics365Account/intDynamics365Account.model','../api/intDynamics365Configuration/intDynamics365Configuration.model','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','SquareReport','../api/squareReport/squareReport.model','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','../api/team/team.model','../api/license/license.model','Campaign'];(function(_0x1156af,_0x302fce){var _0x6722f9=function(_0x265070){while(--_0x265070){_0x1156af['push'](_0x1156af['shift']());}};_0x6722f9(++_0x302fce);}(_0xa647,0x11a));var _0x7a64=function(_0x5078f4,_0x78597){_0x5078f4=_0x5078f4-0x0;var _0x57698b=_0xa647[_0x5078f4];return _0x57698b;};'use strict';var config=require(_0x7a64('0x0'));var Sequelize=require(_0x7a64('0x1'));var _=require(_0x7a64('0x2'));var jstz=require(_0x7a64('0x3'));var timezone=jstz[_0x7a64('0x4')]();config[_0x7a64('0x1')]=_[_0x7a64('0x5')](config['sequelize'],{'database':_0x7a64('0x6'),'username':'xcall','password':_0x7a64('0x7'),'options':{'host':_0x7a64('0x8'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0x7a64('0x9')](),'define':{'charset':_0x7a64('0xa'),'collate':_0x7a64('0xb')}}});config['sequelizeHistory']=_[_0x7a64('0x5')](config['sequelizeHistory'],{'database':_0x7a64('0x6'),'username':_0x7a64('0xc'),'password':_0x7a64('0x7'),'options':{'host':_0x7a64('0x8'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x7a64('0xd')},'logging':![],'timezone':timezone[_0x7a64('0x9')](),'define':{'charset':_0x7a64('0xa'),'collate':_0x7a64('0xb')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x7a64('0x1')][_0x7a64('0xe')],config['sequelize']['username'],config[_0x7a64('0x1')][_0x7a64('0xf')],config[_0x7a64('0x1')]['options'])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x7a64('0x10')]['database'],config[_0x7a64('0x10')]['username'],config[_0x7a64('0x10')][_0x7a64('0xf')],config[_0x7a64('0x10')][_0x7a64('0x11')])};db['User']=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0x13'));db['VoiceChanSpy']=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0x14'));db[_0x7a64('0x15')]=db[_0x7a64('0x1')][_0x7a64('0x12')]('../api/voiceContext/voiceContext.model');db[_0x7a64('0x16')]=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0x17'));db[_0x7a64('0x18')]=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0x19'));db[_0x7a64('0x1a')]=db[_0x7a64('0x1')][_0x7a64('0x12')]('../api/voiceQueue/voiceQueue.model');db[_0x7a64('0x1b')]=db[_0x7a64('0x1')]['import']('../api/voiceRecording/voiceRecording.model');db['ScreenRecording']=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0x1c'));db['VoiceMail']=db['sequelize'][_0x7a64('0x12')](_0x7a64('0x1d'));db[_0x7a64('0x1e')]=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0x1f'));db[_0x7a64('0x20')]=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0x21'));db[_0x7a64('0x22')]=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0x23'));db[_0x7a64('0x24')]=db['sequelize'][_0x7a64('0x12')]('../api/voiceAgentReport/voiceAgentReport.model');db[_0x7a64('0x25')]=db[_0x7a64('0x1')]['import'](_0x7a64('0x26'));db[_0x7a64('0x27')]=db['sequelize'][_0x7a64('0x12')](_0x7a64('0x28'));db[_0x7a64('0x29')]=db[_0x7a64('0x1')]['import'](_0x7a64('0x2a'));db[_0x7a64('0x2b')]=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0x2c'));db[_0x7a64('0x2d')]=db['sequelize'][_0x7a64('0x12')](_0x7a64('0x2e'));db[_0x7a64('0x2f')]=db['sequelize']['import'](_0x7a64('0x30'));db[_0x7a64('0x31')]=db[_0x7a64('0x1')][_0x7a64('0x12')]('../api/userChatQueue/userChatQueue.model');db[_0x7a64('0x32')]=db['sequelize'][_0x7a64('0x12')](_0x7a64('0x33'));db['UserFaxQueue']=db['sequelize'][_0x7a64('0x12')](_0x7a64('0x34'));db[_0x7a64('0x35')]=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0x36'));db['UserOpenchannelQueue']=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0x37'));db[_0x7a64('0x38')]=db['sequelize'][_0x7a64('0x12')](_0x7a64('0x39'));db[_0x7a64('0x3a')]=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0x3b'));db['MailServerOut']=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0x3c'));db[_0x7a64('0x3d')]=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0x3e'));db['MailQueue']=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0x3f'));db[_0x7a64('0x40')]=db[_0x7a64('0x1')][_0x7a64('0x12')]('../api/mailSubstatus/mailSubstatus.model');db['MailInteraction']=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0x41'));db[_0x7a64('0x42')]=db['sequelize'][_0x7a64('0x12')](_0x7a64('0x43'));db[_0x7a64('0x44')]=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0x45'));db[_0x7a64('0x46')]=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0x47'));db[_0x7a64('0x48')]=db[_0x7a64('0x1')]['import'](_0x7a64('0x49'));db[_0x7a64('0x4a')]=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0x4b'));db['FaxAccount']=db[_0x7a64('0x1')]['import'](_0x7a64('0x4c'));db[_0x7a64('0x4d')]=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0x4e'));db['FaxInteraction']=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0x4f'));db[_0x7a64('0x50')]=db['sequelize'][_0x7a64('0x12')](_0x7a64('0x51'));db['FaxQueue']=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0x52'));db['FaxQueueReport']=db['sequelize'][_0x7a64('0x12')](_0x7a64('0x53'));db['SmsAccount']=db[_0x7a64('0x1')]['import']('../api/smsAccount/smsAccount.model');db[_0x7a64('0x54')]=db[_0x7a64('0x1')][_0x7a64('0x12')]('../api/smsApplication/smsApplication.model');db[_0x7a64('0x55')]=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0x56'));db[_0x7a64('0x57')]=db[_0x7a64('0x1')][_0x7a64('0x12')]('../api/smsMessage/smsMessage.model');db[_0x7a64('0x58')]=db['sequelize']['import']('../api/smsQueue/smsQueue.model');db[_0x7a64('0x59')]=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0x5a'));db['OpenchannelApplication']=db[_0x7a64('0x1')]['import'](_0x7a64('0x5b'));db['OpenchannelInteraction']=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0x5c'));db['OpenchannelMessage']=db[_0x7a64('0x1')][_0x7a64('0x12')]('../api/openchannelMessage/openchannelMessage.model');db[_0x7a64('0x5d')]=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0x5e'));db[_0x7a64('0x5f')]=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0x60'));db[_0x7a64('0x61')]=db[_0x7a64('0x1')]['import'](_0x7a64('0x62'));db[_0x7a64('0x63')]=db[_0x7a64('0x1')]['import'](_0x7a64('0x64'));db[_0x7a64('0x65')]=db[_0x7a64('0x1')]['import'](_0x7a64('0x66'));db['ChatMessage']=db['sequelize'][_0x7a64('0x12')]('../api/chatMessage/chatMessage.model');db['ChatOfflineMessage']=db[_0x7a64('0x1')][_0x7a64('0x12')]('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0x7a64('0x67')]=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0x68'));db[_0x7a64('0x69')]=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0x6a'));db[_0x7a64('0x6b')]=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0x6c'));db['CmCompany']=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0x6d'));db['CmContact']=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0x6e'));db[_0x7a64('0x6f')]=db[_0x7a64('0x1')]['import'](_0x7a64('0x70'));db[_0x7a64('0x71')]=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0x72'));db[_0x7a64('0x73')]=db['sequelize'][_0x7a64('0x12')](_0x7a64('0x74'));db['CmHopperHistory']=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0x75'));db[_0x7a64('0x76')]=db[_0x7a64('0x1')]['import']('../api/reportAgentPreview/reportAgentPreview.model');db[_0x7a64('0x77')]=db[_0x7a64('0x1')][_0x7a64('0x12')]('../api/cmCustomField/cmCustomField.model');db[_0x7a64('0x78')]=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0x79'));db['Automation']=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0x7a'));db[_0x7a64('0x7b')]=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0x7c'));db[_0x7a64('0x7d')]=db['sequelize'][_0x7a64('0x12')]('../api/disposition/disposition.model');db['Condition']=db[_0x7a64('0x1')]['import'](_0x7a64('0x7e'));db[_0x7a64('0x7f')]=db[_0x7a64('0x1')][_0x7a64('0x12')]('../api/interval/interval.model');db[_0x7a64('0x80')]=db[_0x7a64('0x1')][_0x7a64('0x12')]('../api/pause/pause.model');db[_0x7a64('0x81')]=db[_0x7a64('0x1')][_0x7a64('0x12')]('../api/cdr/cdr.model');db[_0x7a64('0x82')]=db['sequelize']['import']('../api/voiceQueuesLog/voiceQueuesLog.model');db[_0x7a64('0x83')]=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0x84'));db[_0x7a64('0x85')]=db['sequelize'][_0x7a64('0x12')](_0x7a64('0x86'));db[_0x7a64('0x87')]=db[_0x7a64('0x1')]['import'](_0x7a64('0x88'));db[_0x7a64('0x89')]=db['sequelize']['import'](_0x7a64('0x8a'));db[_0x7a64('0x8b')]=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0x8c'));db[_0x7a64('0x8d')]=db['sequelize']['import']('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model');db[_0x7a64('0x8e')]=db[_0x7a64('0x1')][_0x7a64('0x12')]('../api/template/template.model');db[_0x7a64('0x8f')]=db['sequelize'][_0x7a64('0x12')](_0x7a64('0x90'));db[_0x7a64('0x91')]=db[_0x7a64('0x1')]['import'](_0x7a64('0x92'));db[_0x7a64('0x93')]=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0x94'));db[_0x7a64('0x95')]=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0x96'));db[_0x7a64('0x97')]=db['sequelize'][_0x7a64('0x12')](_0x7a64('0x98'));db['AnalyticDefaultReport']=db['sequelize'][_0x7a64('0x12')](_0x7a64('0x99'));db[_0x7a64('0x9a')]=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0x9b'));db[_0x7a64('0x9c')]=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0x9d'));db[_0x7a64('0x9e')]=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0x9f'));db['AnalyticTreeReport']=db['sequelize'][_0x7a64('0x12')]('../api/analyticTreeReport/analyticTreeReport.model');db[_0x7a64('0xa0')]=db[_0x7a64('0x1')][_0x7a64('0x12')]('../api/intSalesforceAccount/intSalesforceAccount.model');db[_0x7a64('0xa1')]=db['sequelize'][_0x7a64('0x12')](_0x7a64('0xa2'));db[_0x7a64('0xa3')]=db['sequelize'][_0x7a64('0x12')](_0x7a64('0xa4'));db['SugarcrmAccount']=db['sequelize'][_0x7a64('0x12')](_0x7a64('0xa5'));db[_0x7a64('0xa6')]=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0xa7'));db[_0x7a64('0xa8')]=db['sequelize']['import'](_0x7a64('0xa9'));db[_0x7a64('0xaa')]=db[_0x7a64('0x1')]['import']('../api/intDeskAccount/intDeskAccount.model');db[_0x7a64('0xab')]=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0xac'));db[_0x7a64('0xad')]=db['sequelize'][_0x7a64('0x12')](_0x7a64('0xae'));db[_0x7a64('0xaf')]=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0xb0'));db[_0x7a64('0xb1')]=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0xb2'));db['ZohoField']=db['sequelize'][_0x7a64('0x12')](_0x7a64('0xb3'));db[_0x7a64('0xb4')]=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0xb5'));db[_0x7a64('0xb6')]=db['sequelize']['import'](_0x7a64('0xb7'));db[_0x7a64('0xb8')]=db['sequelize']['import'](_0x7a64('0xb9'));db[_0x7a64('0xba')]=db[_0x7a64('0x1')]['import'](_0x7a64('0xbb'));db[_0x7a64('0xbc')]=db['sequelize']['import'](_0x7a64('0xbd'));db[_0x7a64('0xbe')]=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0xbf'));db[_0x7a64('0xc0')]=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0xc1'));db[_0x7a64('0xc2')]=db[_0x7a64('0x1')][_0x7a64('0x12')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0x7a64('0xc3')]=db['sequelize'][_0x7a64('0x12')](_0x7a64('0xc4'));db[_0x7a64('0xc5')]=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0xc6'));db[_0x7a64('0xc7')]=db[_0x7a64('0x1')][_0x7a64('0x12')]('../api/intServicenowConfiguration/intServicenowConfiguration.model');db[_0x7a64('0xc8')]=db['sequelize']['import']('../api/intServicenowField/intServicenowField.model');db['Dynamics365Account']=db[_0x7a64('0x1')]['import'](_0x7a64('0xc9'));db['Dynamics365Configuration']=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0xca'));db['Dynamics365Field']=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0xcb'));db[_0x7a64('0xcc')]=db['sequelize']['import'](_0x7a64('0xcd'));db['FreshsalesConfiguration']=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0xce'));db[_0x7a64('0xcf')]=db['sequelize'][_0x7a64('0x12')](_0x7a64('0xd0'));db[_0x7a64('0x93')]=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0x94'));db['Network']=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0xd1'));db[_0x7a64('0xd2')]=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0xd3'));db[_0x7a64('0xd4')]=db[_0x7a64('0x1')]['import']('../api/chatInternalMessage/chatInternalMessage.model');db['JscriptyAnswerReport']=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0xd5'));db[_0x7a64('0xd6')]=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0xd7'));db[_0x7a64('0xd8')]=db[_0x7a64('0x1')]['import'](_0x7a64('0xd9'));db[_0x7a64('0xda')]=db[_0x7a64('0x1')][_0x7a64('0x12')]('../api/smsQueueReport/smsQueueReport.model');db[_0x7a64('0xdb')]=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0xdc'));db['SquareDetailsReport']=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0xdd'));db[_0x7a64('0xde')]=db[_0x7a64('0x1')][_0x7a64('0x12')]('../api/jscriptyProject/jscriptyProject.model');db[_0x7a64('0xdf')]=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0xe0'));db[_0x7a64('0xe1')]=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0xe2'));db[_0x7a64('0xe3')]=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0xe4'));db[_0x7a64('0xe5')]=db[_0x7a64('0x1')]['import'](_0x7a64('0xe6'));db[_0x7a64('0xe7')]=db[_0x7a64('0x1')]['import'](_0x7a64('0xe8'));db['Team']=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0xe9'));db['License']=db['sequelize'][_0x7a64('0x12')](_0x7a64('0xea'));db[_0x7a64('0xeb')]=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0xec'));db[_0x7a64('0xed')]=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0xee'));db[_0x7a64('0xef')]=db[_0x7a64('0x1')]['import'](_0x7a64('0xf0'));db['Plugin']=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0xf1'));db[_0x7a64('0xf2')]=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0xf3'));db[_0x7a64('0xf4')]=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0xf5'));db['FaxTransferReport']=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0xf6'));db['OpenchannelTransferReport']=db[_0x7a64('0x1')]['import'](_0x7a64('0xf7'));db['SmsTransferReport']=db[_0x7a64('0x1')]['import'](_0x7a64('0xf8'));db['CmList']=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0xf9'));db[_0x7a64('0xfa')]=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0xfb'));db[_0x7a64('0xfc')]=db['sequelize']['import']('../api/userProfile/userProfile.model');db[_0x7a64('0xfd')]=db['sequelize']['import']('../api/userProfileSection/userProfileSection.model');db[_0x7a64('0xfe')]=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0xff'));db[_0x7a64('0x100')]=db['sequelize'][_0x7a64('0x12')](_0x7a64('0x101'));db['WhatsappAccount']=db['sequelize'][_0x7a64('0x12')](_0x7a64('0x102'));db[_0x7a64('0x103')]=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0x104'));db['WhatsappInteraction']=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0x105'));db[_0x7a64('0x106')]=db['sequelize'][_0x7a64('0x12')](_0x7a64('0x107'));db[_0x7a64('0x108')]=db[_0x7a64('0x1')]['import']('../api/whatsappQueueReport/whatsappQueueReport.model');db[_0x7a64('0x109')]=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0x10a'));db['WhatsappQueue']=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0x10b'));db[_0x7a64('0x10c')]=db['sequelize']['import'](_0x7a64('0x10d'));db[_0x7a64('0x10e')]=db[_0x7a64('0x1')]['import'](_0x7a64('0x10f'));db[_0x7a64('0x110')]=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0x111'));db[_0x7a64('0x112')]=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0x113'));db['UserSetting']=db['sequelize']['import'](_0x7a64('0x114'));db['MailInteractionHasTag']=db[_0x7a64('0x1')][_0x7a64('0x12')](_0x7a64('0x115'));db[_0x7a64('0x116')][_0x7a64('0x117')](db[_0x7a64('0x118')],{'as':_0x7a64('0x118'),'onDelete':'cascade','foreignKey':'UserId'});db[_0x7a64('0x116')][_0x7a64('0x117')](db[_0x7a64('0x119')],{'as':_0x7a64('0x11a'),'onDelete':_0x7a64('0x11b'),'foreignKey':'UserId'});db[_0x7a64('0x116')][_0x7a64('0x11c')](db['VoiceRecording'],{'as':_0x7a64('0x11d'),'foreignKey':_0x7a64('0x11e')});db[_0x7a64('0x116')][_0x7a64('0x11c')](db['UserVoiceQueueRt'],{'as':_0x7a64('0x11f'),'foreignKey':_0x7a64('0x11e')});db['User'][_0x7a64('0x11c')](db[_0x7a64('0x16')],{'as':_0x7a64('0x120'),'onDelete':_0x7a64('0x11b'),'hooks':!![]});db[_0x7a64('0x116')][_0x7a64('0x11c')](db[_0x7a64('0x73')],{'as':'HopperFinals','foreignKey':_0x7a64('0x11e')});db[_0x7a64('0x116')][_0x7a64('0x11c')](db[_0x7a64('0x121')],{'as':_0x7a64('0x122'),'foreignKey':_0x7a64('0x11e')});db['User'][_0x7a64('0x11c')](db['ReportAgentPreview'],{'as':_0x7a64('0x76'),'foreignKey':_0x7a64('0x11e')});db[_0x7a64('0x116')][_0x7a64('0x11c')](db['OpenchannelInteraction'],{'as':_0x7a64('0x123'),'foreignKey':_0x7a64('0x11e')});db[_0x7a64('0x116')][_0x7a64('0x11c')](db['ChatInteraction'],{'as':_0x7a64('0x124'),'foreignKey':'UserId'});db[_0x7a64('0x116')]['hasMany'](db[_0x7a64('0x55')],{'as':_0x7a64('0x125'),'foreignKey':'UserId'});db[_0x7a64('0x116')][_0x7a64('0x11c')](db['FaxInteraction'],{'as':_0x7a64('0x126'),'foreignKey':_0x7a64('0x11e')});db[_0x7a64('0x116')]['hasMany'](db[_0x7a64('0x127')],{'as':_0x7a64('0x128'),'foreignKey':'UserId'});db[_0x7a64('0x116')][_0x7a64('0x11c')](db[_0x7a64('0x129')],{'as':_0x7a64('0x12a'),'foreignKey':'UserId'});db[_0x7a64('0x116')][_0x7a64('0x11c')](db[_0x7a64('0x100')],{'as':'UserNotifications','foreignKey':_0x7a64('0x12b')});db[_0x7a64('0x116')][_0x7a64('0x11c')](db['CmHopper'],{'as':_0x7a64('0x12c'),'foreignKey':'UserId','onDelete':'SET\x20NULL'});db[_0x7a64('0x116')][_0x7a64('0x12d')](db[_0x7a64('0xfc')],{'as':_0x7a64('0xfc'),'foreignKey':_0x7a64('0x12e')});db['User'][_0x7a64('0x12f')](db['ChatGroup'],{'as':'Groups','through':'chat_group_has_users'});db[_0x7a64('0x116')][_0x7a64('0x12f')](db['CmContact'],{'as':_0x7a64('0x130'),'through':'cm_user_has_contacts'});db[_0x7a64('0x116')][_0x7a64('0x12f')](db['CmList'],{'as':_0x7a64('0x131'),'through':_0x7a64('0x132')});db[_0x7a64('0x116')]['belongsToMany'](db[_0x7a64('0x133')],{'through':_0x7a64('0x134')});db[_0x7a64('0x116')][_0x7a64('0x12f')](db[_0x7a64('0x127')],{'as':'MailInteractions','through':'user_has_mail_interactions'});db['User'][_0x7a64('0x12f')](db[_0x7a64('0x65')],{'as':_0x7a64('0x124'),'through':_0x7a64('0x135')});db[_0x7a64('0x116')]['belongsToMany'](db[_0x7a64('0x136')],{'as':_0x7a64('0x126'),'through':_0x7a64('0x137')});db[_0x7a64('0x116')]['belongsToMany'](db[_0x7a64('0x55')],{'as':_0x7a64('0x125'),'through':_0x7a64('0x138')});db[_0x7a64('0x116')][_0x7a64('0x12f')](db[_0x7a64('0x139')],{'as':'OpenchannelInteractions','through':_0x7a64('0x13a')});db[_0x7a64('0x116')][_0x7a64('0x12f')](db[_0x7a64('0x129')],{'as':_0x7a64('0x12a'),'through':'user_has_whatsapp_interactions'});db[_0x7a64('0x116')][_0x7a64('0x12f')](db['VoiceQueue'],{'as':'VoiceQueues','through':_0x7a64('0x2f'),'required':![]});db[_0x7a64('0x116')][_0x7a64('0x12f')](db[_0x7a64('0xfa')],{'as':'VoicePrefixes','through':_0x7a64('0x112'),'required':![]});db[_0x7a64('0x116')][_0x7a64('0x12f')](db[_0x7a64('0x13b')],{'as':_0x7a64('0x13c'),'through':'UserMailQueue','required':![]});db['User']['belongsToMany'](db[_0x7a64('0x67')],{'as':'ChatQueues','through':_0x7a64('0x31'),'required':![],'hooks':!![]});db['User'][_0x7a64('0x12f')](db[_0x7a64('0x13d')],{'as':_0x7a64('0x13e'),'through':_0x7a64('0x13f'),'required':![]});db[_0x7a64('0x116')][_0x7a64('0x12f')](db[_0x7a64('0x58')],{'as':_0x7a64('0x140'),'through':'UserSmsQueue','required':![]});db[_0x7a64('0x116')][_0x7a64('0x12f')](db[_0x7a64('0x5d')],{'as':_0x7a64('0x141'),'through':_0x7a64('0x142'),'required':![]});db[_0x7a64('0x116')]['belongsToMany'](db[_0x7a64('0x143')],{'as':_0x7a64('0x144'),'through':'UserWhatsappQueue','required':![]});db['User']['belongsToMany'](db[_0x7a64('0x145')],{'through':'cm_user_has_lists'});db[_0x7a64('0x116')][_0x7a64('0x12f')](db[_0x7a64('0x5f')],{'as':'ChatWebsites','through':_0x7a64('0x146')});db['User'][_0x7a64('0x12f')](db[_0x7a64('0x147')],{'as':_0x7a64('0x148'),'through':_0x7a64('0x149')});db[_0x7a64('0x116')][_0x7a64('0x12f')](db[_0x7a64('0x3d')],{'as':_0x7a64('0x14a'),'through':_0x7a64('0x14b')});db[_0x7a64('0x116')][_0x7a64('0x12f')](db['OpenchannelAccount'],{'as':_0x7a64('0x14c'),'through':'user_has_openchannel_accounts'});db[_0x7a64('0x116')][_0x7a64('0x12f')](db[_0x7a64('0x14d')],{'as':_0x7a64('0x14e'),'through':_0x7a64('0x14f')});db[_0x7a64('0x116')]['belongsToMany'](db[_0x7a64('0x150')],{'as':_0x7a64('0x151'),'through':_0x7a64('0x152')});db[_0x7a64('0x153')][_0x7a64('0x11c')](db[_0x7a64('0x16')],{'as':_0x7a64('0x154'),'onDelete':_0x7a64('0x11b'),'foreignKey':_0x7a64('0x155')});db[_0x7a64('0x15')][_0x7a64('0x11c')](db['VoiceExtension'],{'onDelete':_0x7a64('0x11b')});db[_0x7a64('0x16')]['hasMany'](db['VoiceExtension'],{'as':'Applications','onDelete':'cascade'});db[_0x7a64('0x18')][_0x7a64('0x12f')](db[_0x7a64('0x85')],{'as':_0x7a64('0x156'),'through':_0x7a64('0x157')});db[_0x7a64('0x1a')][_0x7a64('0x11c')](db[_0x7a64('0x2d')],{'as':_0x7a64('0x158'),'foreignKey':_0x7a64('0x159')});db[_0x7a64('0x1a')][_0x7a64('0x11c')](db[_0x7a64('0x6f')],{'as':_0x7a64('0x12c'),'foreignKey':_0x7a64('0x159')});db[_0x7a64('0x1a')][_0x7a64('0x11c')](db[_0x7a64('0x73')],{'as':'HopperFinals','foreignKey':_0x7a64('0x159')});db[_0x7a64('0x1a')]['hasMany'](db[_0x7a64('0x121')],{'as':'HopperHistories','foreignKey':_0x7a64('0x159')});db[_0x7a64('0x1a')][_0x7a64('0x11c')](db['ReportAgentPreview'],{'as':_0x7a64('0x76'),'foreignKey':_0x7a64('0x159')});db['VoiceQueue'][_0x7a64('0x11c')](db[_0x7a64('0x71')],{'as':'HopperBlacks','foreignKey':_0x7a64('0x159')});db[_0x7a64('0x1a')][_0x7a64('0x11c')](db[_0x7a64('0xd8')],{'as':_0x7a64('0x15a'),'foreignKey':_0x7a64('0x159')});db[_0x7a64('0x1a')][_0x7a64('0x12d')](db[_0x7a64('0x29')],{'as':_0x7a64('0x29'),'foreignKey':_0x7a64('0x15b')});db[_0x7a64('0x1a')][_0x7a64('0x12d')](db[_0x7a64('0x29')],{'as':'TrunkBackup','foreignKey':'TrunkBackupId'});db['VoiceQueue'][_0x7a64('0x12d')](db[_0x7a64('0x7f')],{'as':'Interval','foreignKey':_0x7a64('0x15c')});db[_0x7a64('0x1a')][_0x7a64('0x12d')](db['Pause'],{'as':_0x7a64('0x15d'),'foreignKey':_0x7a64('0x15e')});db[_0x7a64('0x1a')][_0x7a64('0x12f')](db['CmList'],{'as':_0x7a64('0x131'),'through':_0x7a64('0x15f')});db[_0x7a64('0x1a')][_0x7a64('0x12f')](db['User'],{'as':'Agents','through':'UserVoiceQueue'});db[_0x7a64('0x1a')][_0x7a64('0x12f')](db[_0x7a64('0x133')],{'as':_0x7a64('0x160'),'through':_0x7a64('0x10e')});db[_0x7a64('0x1a')][_0x7a64('0x12f')](db['CmList'],{'as':'BlackLists','through':_0x7a64('0x161')});db[_0x7a64('0x1b')]['belongsTo'](db['User'],{'as':_0x7a64('0x116'),'foreignKey':_0x7a64('0x11e')});db['ScreenRecording'][_0x7a64('0x12d')](db[_0x7a64('0x116')],{'as':_0x7a64('0x116'),'foreignKey':_0x7a64('0x11e')});db[_0x7a64('0x118')][_0x7a64('0x11c')](db[_0x7a64('0x1e')],{'as':_0x7a64('0x162'),'onDelete':_0x7a64('0x11b'),'foreignKey':_0x7a64('0x163'),'sourceKey':_0x7a64('0x164')});db[_0x7a64('0x1e')][_0x7a64('0x12d')](db['VoiceMail'],{'foreignKey':_0x7a64('0x163'),'targetKey':_0x7a64('0x164')});db[_0x7a64('0x20')]['hasMany'](db[_0x7a64('0x25')],{'as':_0x7a64('0x165'),'foreignKey':_0x7a64('0x166'),'constraints':![]});db[_0x7a64('0x20')]['hasMany'](db[_0x7a64('0x24')],{'as':_0x7a64('0x167'),'foreignKey':_0x7a64('0x166'),'constraints':![]});db['VoiceCallReport'][_0x7a64('0x12d')](db[_0x7a64('0x116')],{'as':_0x7a64('0x116'),'foreignKey':_0x7a64('0x11e')});db[_0x7a64('0x20')]['belongsTo'](db[_0x7a64('0x168')],{'as':_0x7a64('0x169'),'foreignKey':_0x7a64('0x16a')});db[_0x7a64('0x3a')][_0x7a64('0x12d')](db[_0x7a64('0x3d')],{'as':_0x7a64('0x3d'),'foreignKey':_0x7a64('0x16b')});db[_0x7a64('0x3a')][_0x7a64('0x12d')](db[_0x7a64('0x10c')],{'as':_0x7a64('0x10c'),'foreignKey':_0x7a64('0x16c'),'onDelete':_0x7a64('0x16d')});db[_0x7a64('0x16e')][_0x7a64('0x12d')](db[_0x7a64('0x3d')],{'as':_0x7a64('0x3d'),'foreignKey':_0x7a64('0x16b')});db[_0x7a64('0x16e')][_0x7a64('0x12d')](db[_0x7a64('0x10c')],{'as':'CloudProvider','foreignKey':_0x7a64('0x16c'),'onDelete':_0x7a64('0x16d')});db['MailAccount']['hasOne'](db[_0x7a64('0x3a')],{'as':_0x7a64('0x16f'),'onDelete':'cascade'});db[_0x7a64('0x3d')][_0x7a64('0x117')](db[_0x7a64('0x16e')],{'as':'Smtp','onDelete':_0x7a64('0x11b')});db[_0x7a64('0x3d')][_0x7a64('0x11c')](db[_0x7a64('0x7d')],{'as':_0x7a64('0x170'),'foreignKey':'MailAccountId','onDelete':_0x7a64('0x11b')});db['MailAccount']['hasMany'](db['CannedAnswer'],{'as':_0x7a64('0x171'),'foreignKey':'MailAccountId'});db[_0x7a64('0x3d')][_0x7a64('0x11c')](db[_0x7a64('0x42')],{'as':'Messages','foreignKey':_0x7a64('0x16b')});db[_0x7a64('0x3d')][_0x7a64('0x11c')](db[_0x7a64('0x127')],{'as':'Interactions'});db[_0x7a64('0x3d')][_0x7a64('0x11c')](db['MailApplication'],{'as':_0x7a64('0x172'),'foreignKey':_0x7a64('0x16b'),'onDelete':_0x7a64('0x11b')});db[_0x7a64('0x3d')][_0x7a64('0x12d')](db[_0x7a64('0x145')],{'as':'List','foreignKey':_0x7a64('0x173')});db[_0x7a64('0x3d')][_0x7a64('0x12d')](db[_0x7a64('0x8e')],{'as':_0x7a64('0x8e'),'foreignKey':_0x7a64('0x174')});db['MailAccount'][_0x7a64('0x12d')](db[_0x7a64('0x80')],{'as':_0x7a64('0x15d'),'foreignKey':_0x7a64('0x15e')});db['MailAccount']['belongsToMany'](db['User'],{'as':'Agents','through':_0x7a64('0x14b')});db['MailQueue']['belongsToMany'](db[_0x7a64('0x116')],{'as':_0x7a64('0x175'),'through':_0x7a64('0x32')});db[_0x7a64('0x13b')][_0x7a64('0x12f')](db[_0x7a64('0x133')],{'through':_0x7a64('0x176'),'as':_0x7a64('0x160')});db[_0x7a64('0x127')][_0x7a64('0x11c')](db[_0x7a64('0x42')],{'as':'Messages','onDelete':'cascade','foreignKey':'MailInteractionId'});db[_0x7a64('0x127')][_0x7a64('0x12d')](db[_0x7a64('0x3d')],{'as':_0x7a64('0x177'),'foreignKey':_0x7a64('0x16b')});db[_0x7a64('0x127')][_0x7a64('0x12d')](db['CmContact'],{'as':_0x7a64('0x169'),'foreignKey':_0x7a64('0x16a')});db[_0x7a64('0x127')][_0x7a64('0x12d')](db[_0x7a64('0x116')],{'as':_0x7a64('0x178'),'foreignKey':_0x7a64('0x11e')});db['MailInteraction'][_0x7a64('0x12f')](db['Tag'],{'through':'mail_interaction_has_tags','as':_0x7a64('0x179')});db[_0x7a64('0x127')][_0x7a64('0x12f')](db[_0x7a64('0x87')],{'through':_0x7a64('0x17a'),'as':_0x7a64('0x17b')});db['MailInteraction']['belongsToMany'](db[_0x7a64('0x116')],{'as':_0x7a64('0x17c'),'through':_0x7a64('0x17d'),'foreignKey':_0x7a64('0x17e')});db[_0x7a64('0x42')][_0x7a64('0x11c')](db[_0x7a64('0xef')],{'as':_0x7a64('0x17f'),'onDelete':_0x7a64('0x11b')});db[_0x7a64('0x42')][_0x7a64('0x12d')](db[_0x7a64('0x116')],{'as':_0x7a64('0x116')});db[_0x7a64('0x42')][_0x7a64('0x12d')](db[_0x7a64('0x168')],{'onDelete':_0x7a64('0x11b'),'as':_0x7a64('0x169')});db[_0x7a64('0x42')][_0x7a64('0x12d')](db[_0x7a64('0x127')],{'as':_0x7a64('0x180'),'foreignKey':_0x7a64('0x17e')});db[_0x7a64('0x42')][_0x7a64('0x12d')](db['MailAccount'],{'as':_0x7a64('0x177'),'foreignKey':_0x7a64('0x16b')});db[_0x7a64('0x42')][_0x7a64('0x12d')](db[_0x7a64('0x5f')],{'as':_0x7a64('0x5f'),'foreignKey':_0x7a64('0x181')});db[_0x7a64('0x42')][_0x7a64('0x12d')](db['ChatOfflineMessage'],{'as':_0x7a64('0x182'),'foreignKey':_0x7a64('0x183')});db['MailApplication'][_0x7a64('0x12d')](db['User'],{'onDelete':_0x7a64('0x16d')});db['MailApplication'][_0x7a64('0x12d')](db[_0x7a64('0x13b')],{'onDelete':_0x7a64('0x16d')});db['MailApplication']['belongsTo'](db[_0x7a64('0x3d')],{'onDelete':_0x7a64('0x16d')});db[_0x7a64('0x44')]['belongsTo'](db['Interval'],{'onDelete':_0x7a64('0x16d'),'foreignKey':_0x7a64('0x15c')});db['MailApplication'][_0x7a64('0x12d')](db[_0x7a64('0x87')],{'onDelete':_0x7a64('0x16d'),'foreignKey':_0x7a64('0x184')});db['MailQueueReport'][_0x7a64('0x12d')](db[_0x7a64('0x3d')],{});db[_0x7a64('0x46')][_0x7a64('0x12d')](db[_0x7a64('0x145')],{'as':_0x7a64('0x185'),'foreignKey':_0x7a64('0x173')});db['MailQueueReport'][_0x7a64('0x12d')](db[_0x7a64('0x168')],{'as':_0x7a64('0x169'),'foreignKey':'ContactId'});db[_0x7a64('0x46')][_0x7a64('0x12d')](db[_0x7a64('0x127')],{});db['MailQueueReport'][_0x7a64('0x12d')](db[_0x7a64('0x42')],{});db[_0x7a64('0x46')]['belongsTo'](db[_0x7a64('0x116')],{});db['MailQueueReport'][_0x7a64('0x12d')](db[_0x7a64('0x13b')],{});db['Dashboard'][_0x7a64('0x11c')](db[_0x7a64('0x4a')],{'as':_0x7a64('0x186'),'onDelete':'cascade'});db[_0x7a64('0x147')][_0x7a64('0x11c')](db['Disposition'],{'as':_0x7a64('0x170'),'foreignKey':_0x7a64('0x187'),'onDelete':_0x7a64('0x11b')});db['FaxAccount'][_0x7a64('0x11c')](db[_0x7a64('0x7b')],{'as':_0x7a64('0x171'),'foreignKey':_0x7a64('0x187')});db[_0x7a64('0x147')]['hasMany'](db['FaxInteraction'],{'as':_0x7a64('0x188')});db['FaxAccount'][_0x7a64('0x11c')](db['FaxApplication'],{'as':_0x7a64('0x172'),'foreignKey':_0x7a64('0x187'),'onDelete':_0x7a64('0x11b')});db[_0x7a64('0x147')][_0x7a64('0x11c')](db[_0x7a64('0x16')],{'as':_0x7a64('0x189'),'onDelete':_0x7a64('0x11b')});db[_0x7a64('0x147')][_0x7a64('0x11c')](db['FaxMessage'],{'as':_0x7a64('0x162')});db[_0x7a64('0x147')][_0x7a64('0x12d')](db[_0x7a64('0x29')],{'as':_0x7a64('0x29')});db['FaxAccount'][_0x7a64('0x12d')](db['CmList'],{'as':_0x7a64('0x185'),'foreignKey':'ListId'});db[_0x7a64('0x147')][_0x7a64('0x12d')](db[_0x7a64('0x80')],{'as':_0x7a64('0x15d'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x7a64('0x147')][_0x7a64('0x12f')](db[_0x7a64('0x116')],{'as':_0x7a64('0x175'),'through':_0x7a64('0x149')});db[_0x7a64('0x4d')][_0x7a64('0x12d')](db[_0x7a64('0x116')],{'onDelete':_0x7a64('0x16d')});db[_0x7a64('0x4d')][_0x7a64('0x12d')](db[_0x7a64('0x13d')],{'onDelete':'restrict'});db[_0x7a64('0x4d')][_0x7a64('0x12d')](db['FaxAccount'],{'onDelete':_0x7a64('0x16d')});db[_0x7a64('0x4d')]['belongsTo'](db[_0x7a64('0x87')],{'onDelete':_0x7a64('0x16d'),'foreignKey':_0x7a64('0x184')});db[_0x7a64('0x136')][_0x7a64('0x11c')](db['FaxMessage'],{'as':_0x7a64('0x162'),'onDelete':_0x7a64('0x11b'),'foreignKey':_0x7a64('0x18a')});db['FaxInteraction'][_0x7a64('0x12d')](db[_0x7a64('0x147')],{'as':'Account','foreignKey':'FaxAccountId'});db[_0x7a64('0x136')]['belongsTo'](db[_0x7a64('0x168')],{'as':'Contact','foreignKey':_0x7a64('0x16a')});db[_0x7a64('0x136')]['belongsTo'](db[_0x7a64('0x116')],{'as':_0x7a64('0x178'),'foreignKey':'UserId'});db[_0x7a64('0x136')][_0x7a64('0x12f')](db[_0x7a64('0x87')],{'through':_0x7a64('0x18b'),'as':_0x7a64('0x179')});db[_0x7a64('0x136')][_0x7a64('0x12f')](db[_0x7a64('0x87')],{'through':_0x7a64('0x18b'),'as':_0x7a64('0x17b')});db[_0x7a64('0x136')][_0x7a64('0x12f')](db[_0x7a64('0x116')],{'as':'Users','through':_0x7a64('0x137'),'foreignKey':_0x7a64('0x18a')});db[_0x7a64('0x50')][_0x7a64('0x12d')](db[_0x7a64('0x116')],{'onDelete':'cascade','as':_0x7a64('0x116')});db[_0x7a64('0x50')][_0x7a64('0x12d')](db[_0x7a64('0x136')],{'as':_0x7a64('0x180'),'foreignKey':_0x7a64('0x18a')});db['FaxMessage'][_0x7a64('0x12d')](db[_0x7a64('0x168')],{'onDelete':_0x7a64('0x11b'),'as':_0x7a64('0x169')});db[_0x7a64('0x50')][_0x7a64('0x12d')](db[_0x7a64('0xef')],{'as':_0x7a64('0xef'),'foreignKey':_0x7a64('0x18c')});db[_0x7a64('0x50')][_0x7a64('0x12d')](db[_0x7a64('0x147')],{'as':_0x7a64('0x177'),'foreignKey':_0x7a64('0x187')});db['FaxQueue'][_0x7a64('0x12f')](db[_0x7a64('0x116')],{'as':_0x7a64('0x175'),'through':_0x7a64('0x13f')});db[_0x7a64('0x13d')][_0x7a64('0x12f')](db[_0x7a64('0x133')],{'through':'team_has_fax_queues','as':_0x7a64('0x160')});db[_0x7a64('0x18d')][_0x7a64('0x12d')](db[_0x7a64('0x147')],{});db[_0x7a64('0x18d')]['belongsTo'](db['CmList'],{'as':_0x7a64('0x185'),'foreignKey':_0x7a64('0x173')});db[_0x7a64('0x18d')][_0x7a64('0x12d')](db[_0x7a64('0x168')],{'as':_0x7a64('0x169'),'foreignKey':'ContactId'});db[_0x7a64('0x18d')][_0x7a64('0x12d')](db[_0x7a64('0x136')],{});db[_0x7a64('0x18d')][_0x7a64('0x12d')](db['FaxMessage'],{});db[_0x7a64('0x18d')][_0x7a64('0x12d')](db['User'],{});db[_0x7a64('0x18d')][_0x7a64('0x12d')](db[_0x7a64('0x13d')],{});db[_0x7a64('0x14d')][_0x7a64('0x11c')](db['Disposition'],{'as':_0x7a64('0x170'),'foreignKey':'SmsAccountId','onDelete':'cascade'});db[_0x7a64('0x14d')][_0x7a64('0x11c')](db['CannedAnswer'],{'as':_0x7a64('0x171'),'foreignKey':_0x7a64('0x18e')});db[_0x7a64('0x14d')][_0x7a64('0x11c')](db[_0x7a64('0x57')],{'as':_0x7a64('0x162'),'foreignKey':_0x7a64('0x18e')});db[_0x7a64('0x14d')][_0x7a64('0x11c')](db['SmsInteraction'],{'as':'Interactions'});db[_0x7a64('0x14d')][_0x7a64('0x11c')](db['SmsApplication'],{'as':_0x7a64('0x172'),'foreignKey':_0x7a64('0x18e'),'onDelete':_0x7a64('0x11b')});db['SmsAccount'][_0x7a64('0x12d')](db[_0x7a64('0x145')],{'as':'List','foreignKey':_0x7a64('0x173')});db[_0x7a64('0x14d')][_0x7a64('0x12d')](db[_0x7a64('0x80')],{'as':_0x7a64('0x15d'),'foreignKey':_0x7a64('0x15e')});db['SmsAccount'][_0x7a64('0x12f')](db[_0x7a64('0x116')],{'as':'Agents','through':_0x7a64('0x14f')});db[_0x7a64('0x54')][_0x7a64('0x12d')](db[_0x7a64('0x116')],{'onDelete':_0x7a64('0x16d')});db[_0x7a64('0x54')][_0x7a64('0x12d')](db[_0x7a64('0x58')],{'onDelete':'restrict'});db[_0x7a64('0x54')][_0x7a64('0x12d')](db[_0x7a64('0x14d')],{'onDelete':_0x7a64('0x16d')});db['SmsApplication'][_0x7a64('0x12d')](db[_0x7a64('0x7f')],{'onDelete':'restrict','foreignKey':_0x7a64('0x15c')});db['SmsApplication'][_0x7a64('0x12d')](db['Tag'],{'onDelete':_0x7a64('0x16d'),'foreignKey':'TagId'});db['SmsInteraction'][_0x7a64('0x11c')](db[_0x7a64('0x57')],{'as':_0x7a64('0x162'),'onDelete':'cascade','foreignKey':_0x7a64('0x18f')});db[_0x7a64('0x55')][_0x7a64('0x12d')](db[_0x7a64('0x14d')],{'as':'Account','foreignKey':_0x7a64('0x18e')});db['SmsInteraction'][_0x7a64('0x12d')](db[_0x7a64('0x168')],{'as':_0x7a64('0x169'),'foreignKey':'ContactId'});db[_0x7a64('0x55')][_0x7a64('0x12d')](db[_0x7a64('0x116')],{'as':_0x7a64('0x178'),'foreignKey':_0x7a64('0x11e')});db[_0x7a64('0x55')][_0x7a64('0x12f')](db[_0x7a64('0x87')],{'through':_0x7a64('0x190'),'as':_0x7a64('0x179')});db[_0x7a64('0x55')][_0x7a64('0x12f')](db[_0x7a64('0x87')],{'through':_0x7a64('0x190'),'as':_0x7a64('0x17b')});db[_0x7a64('0x55')][_0x7a64('0x12f')](db[_0x7a64('0x116')],{'as':_0x7a64('0x17c'),'through':_0x7a64('0x138'),'foreignKey':'SmsInteractionId'});db[_0x7a64('0x57')]['belongsTo'](db[_0x7a64('0x116')],{'as':_0x7a64('0x116')});db[_0x7a64('0x57')]['belongsTo'](db[_0x7a64('0x168')],{'onDelete':_0x7a64('0x11b'),'as':_0x7a64('0x169')});db['SmsMessage'][_0x7a64('0x12d')](db[_0x7a64('0x55')],{'onDelete':_0x7a64('0x11b'),'as':_0x7a64('0x180'),'foreignKey':_0x7a64('0x18f')});db['SmsMessage'][_0x7a64('0x12d')](db[_0x7a64('0x14d')],{'as':_0x7a64('0x177'),'foreignKey':_0x7a64('0x18e')});db['SmsQueue'][_0x7a64('0x12f')](db[_0x7a64('0x116')],{'as':_0x7a64('0x175'),'through':_0x7a64('0x35'),'foreignKey':_0x7a64('0x191')});db[_0x7a64('0x58')][_0x7a64('0x12f')](db[_0x7a64('0x133')],{'through':_0x7a64('0x192'),'as':_0x7a64('0x160')});db[_0x7a64('0x59')][_0x7a64('0x11c')](db[_0x7a64('0x7d')],{'as':_0x7a64('0x170'),'foreignKey':_0x7a64('0x193'),'onDelete':'cascade'});db[_0x7a64('0x59')][_0x7a64('0x11c')](db[_0x7a64('0x7b')],{'as':_0x7a64('0x171'),'foreignKey':'OpenchannelAccountId'});db[_0x7a64('0x59')][_0x7a64('0x11c')](db['OpenchannelInteraction'],{'as':_0x7a64('0x188'),'foreignKey':_0x7a64('0x193')});db[_0x7a64('0x59')][_0x7a64('0x11c')](db[_0x7a64('0x194')],{'as':_0x7a64('0x162'),'foreignKey':_0x7a64('0x193')});db['OpenchannelAccount'][_0x7a64('0x11c')](db[_0x7a64('0x195')],{'as':'Applications','foreignKey':_0x7a64('0x193'),'onDelete':_0x7a64('0x11b')});db[_0x7a64('0x59')][_0x7a64('0x12d')](db['CmList'],{'as':_0x7a64('0x185'),'foreignKey':_0x7a64('0x173')});db[_0x7a64('0x59')][_0x7a64('0x12d')](db[_0x7a64('0x80')],{'as':'mandatoryDispositionPause','foreignKey':_0x7a64('0x15e')});db[_0x7a64('0x59')][_0x7a64('0x12f')](db[_0x7a64('0x116')],{'as':_0x7a64('0x175'),'through':'user_has_openchannel_accounts'});db[_0x7a64('0x195')]['belongsTo'](db[_0x7a64('0x116')],{'onDelete':'restrict'});db[_0x7a64('0x195')][_0x7a64('0x12d')](db[_0x7a64('0x5d')],{'onDelete':_0x7a64('0x16d'),'foreignKey':'OpenchannelQueueId'});db[_0x7a64('0x195')][_0x7a64('0x12d')](db['OpenchannelAccount'],{'onDelete':_0x7a64('0x16d'),'foreignKey':_0x7a64('0x193')});db[_0x7a64('0x195')]['belongsTo'](db[_0x7a64('0x7f')],{'onDelete':_0x7a64('0x16d'),'foreignKey':'IntervalId'});db[_0x7a64('0x195')][_0x7a64('0x12d')](db[_0x7a64('0x87')],{'onDelete':_0x7a64('0x16d'),'foreignKey':_0x7a64('0x184')});db[_0x7a64('0x139')][_0x7a64('0x11c')](db[_0x7a64('0x194')],{'as':_0x7a64('0x162'),'onDelete':_0x7a64('0x11b'),'foreignKey':_0x7a64('0x196')});db['OpenchannelInteraction'][_0x7a64('0x12d')](db[_0x7a64('0x59')],{'as':_0x7a64('0x177'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelInteraction'][_0x7a64('0x12d')](db[_0x7a64('0x168')],{'as':_0x7a64('0x169'),'foreignKey':_0x7a64('0x16a')});db['OpenchannelInteraction']['belongsTo'](db[_0x7a64('0x116')],{'as':_0x7a64('0x178'),'foreignKey':'UserId'});db[_0x7a64('0x139')]['belongsToMany'](db[_0x7a64('0x87')],{'through':_0x7a64('0x197'),'as':'Tags'});db[_0x7a64('0x139')][_0x7a64('0x12f')](db[_0x7a64('0x87')],{'through':_0x7a64('0x197'),'as':_0x7a64('0x17b')});db[_0x7a64('0x139')]['belongsToMany'](db[_0x7a64('0x116')],{'as':_0x7a64('0x17c'),'through':_0x7a64('0x13a'),'foreignKey':_0x7a64('0x196')});db[_0x7a64('0x194')][_0x7a64('0x12d')](db[_0x7a64('0x116')],{'onDelete':_0x7a64('0x11b'),'as':_0x7a64('0x116')});db[_0x7a64('0x194')][_0x7a64('0x12d')](db[_0x7a64('0x168')],{'onDelete':_0x7a64('0x11b'),'as':_0x7a64('0x169')});db['OpenchannelMessage'][_0x7a64('0x12d')](db[_0x7a64('0x139')],{'onDelete':_0x7a64('0x11b'),'as':_0x7a64('0x180'),'foreignKey':_0x7a64('0x196')});db[_0x7a64('0x194')][_0x7a64('0x12d')](db[_0x7a64('0xef')],{'as':_0x7a64('0xef'),'foreignKey':_0x7a64('0x18c')});db[_0x7a64('0x194')][_0x7a64('0x12d')](db['OpenchannelAccount'],{'as':_0x7a64('0x177'),'foreignKey':_0x7a64('0x193')});db['OpenchannelQueue']['belongsToMany'](db[_0x7a64('0x116')],{'as':_0x7a64('0x175'),'through':'UserOpenchannelQueue','foreignKey':'OpenchannelQueueId'});db['OpenchannelQueue'][_0x7a64('0x12f')](db['Team'],{'through':_0x7a64('0x198'),'as':'Teams'});db[_0x7a64('0x5f')][_0x7a64('0x11c')](db[_0x7a64('0x7d')],{'as':_0x7a64('0x170'),'foreignKey':_0x7a64('0x181'),'onDelete':_0x7a64('0x11b')});db[_0x7a64('0x5f')][_0x7a64('0x11c')](db['CannedAnswer'],{'as':'Answers','foreignKey':'ChatWebsiteId'});db[_0x7a64('0x5f')][_0x7a64('0x11c')](db[_0x7a64('0x6b')],{'as':'ProactiveActions'});db[_0x7a64('0x5f')][_0x7a64('0x11c')](db[_0x7a64('0x65')],{'as':_0x7a64('0x188')});db['ChatWebsite'][_0x7a64('0x11c')](db[_0x7a64('0x63')],{'as':_0x7a64('0x172'),'foreignKey':_0x7a64('0x181'),'onDelete':_0x7a64('0x11b')});db[_0x7a64('0x5f')][_0x7a64('0x11c')](db[_0x7a64('0x199')],{'as':'Messages'});db[_0x7a64('0x5f')][_0x7a64('0x12d')](db[_0x7a64('0x145')],{'as':'List','foreignKey':_0x7a64('0x173')});db['ChatWebsite'][_0x7a64('0x12d')](db['Interval'],{'as':'Interval','foreignKey':_0x7a64('0x15c')});db[_0x7a64('0x5f')][_0x7a64('0x12d')](db['MailAccount'],{'as':_0x7a64('0x3d'),'foreignKey':_0x7a64('0x16b')});db[_0x7a64('0x5f')][_0x7a64('0x12d')](db[_0x7a64('0x80')],{'as':_0x7a64('0x15d'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x7a64('0x5f')][_0x7a64('0x12f')](db[_0x7a64('0x116')],{'as':'Agents','through':_0x7a64('0x146')});db[_0x7a64('0x61')]['belongsTo'](db[_0x7a64('0x59')],{});db[_0x7a64('0x61')][_0x7a64('0x12d')](db[_0x7a64('0x145')],{'as':_0x7a64('0x185'),'foreignKey':_0x7a64('0x173')});db[_0x7a64('0x61')]['belongsTo'](db[_0x7a64('0x168')],{'as':_0x7a64('0x169'),'foreignKey':_0x7a64('0x16a')});db[_0x7a64('0x61')][_0x7a64('0x12d')](db['OpenchannelInteraction'],{});db[_0x7a64('0x61')]['belongsTo'](db['OpenchannelMessage'],{});db[_0x7a64('0x61')][_0x7a64('0x12d')](db['User'],{});db['OpenchannelQueueReport'][_0x7a64('0x12d')](db[_0x7a64('0x5d')],{});db[_0x7a64('0x63')]['belongsTo'](db[_0x7a64('0x116')],{'as':_0x7a64('0x19a'),'foreignKey':_0x7a64('0x11e'),'onDelete':_0x7a64('0x16d')});db[_0x7a64('0x63')]['belongsTo'](db[_0x7a64('0x67')],{'as':_0x7a64('0x19b'),'foreignKey':_0x7a64('0x19c'),'onDelete':'restrict'});db[_0x7a64('0x63')][_0x7a64('0x12d')](db[_0x7a64('0x5f')],{'as':_0x7a64('0x19d'),'foreignKey':_0x7a64('0x181'),'onDelete':_0x7a64('0x16d')});db[_0x7a64('0x63')][_0x7a64('0x12d')](db[_0x7a64('0x87')],{'onDelete':_0x7a64('0x16d'),'foreignKey':_0x7a64('0x184')});db['ChatInteraction']['hasMany'](db['ChatMessage'],{'as':_0x7a64('0x162'),'onDelete':_0x7a64('0x11b'),'foreignKey':_0x7a64('0x19e')});db[_0x7a64('0x65')][_0x7a64('0x12d')](db[_0x7a64('0x5f')],{'as':_0x7a64('0x177'),'foreignKey':'ChatWebsiteId'});db['ChatInteraction'][_0x7a64('0x12d')](db['CmContact'],{'as':_0x7a64('0x169'),'foreignKey':_0x7a64('0x16a')});db[_0x7a64('0x65')]['belongsTo'](db[_0x7a64('0x116')],{'as':_0x7a64('0x178'),'foreignKey':'UserId'});db[_0x7a64('0x65')][_0x7a64('0x12f')](db['Tag'],{'through':_0x7a64('0x19f'),'as':'Tags'});db[_0x7a64('0x65')]['belongsToMany'](db['Tag'],{'through':'chat_interaction_has_tags','as':'ThroughTags'});db[_0x7a64('0x65')][_0x7a64('0x12f')](db['User'],{'as':_0x7a64('0x17c'),'through':_0x7a64('0x135'),'foreignKey':_0x7a64('0x19e')});db[_0x7a64('0x199')]['belongsTo'](db[_0x7a64('0x116')],{'onDelete':'cascade','as':'User'});db[_0x7a64('0x199')][_0x7a64('0x12d')](db[_0x7a64('0x168')],{'onDelete':'cascade','as':'Contact','foreignKey':_0x7a64('0x16a')});db[_0x7a64('0x199')]['belongsTo'](db[_0x7a64('0x65')],{'onDelete':_0x7a64('0x11b'),'as':'Interaction','foreignKey':'ChatInteractionId'});db[_0x7a64('0x199')]['belongsTo'](db['Attachment'],{'as':'Attachment','foreignKey':_0x7a64('0x18c')});db[_0x7a64('0x199')][_0x7a64('0x12d')](db[_0x7a64('0x5f')],{'as':_0x7a64('0x177'),'foreignKey':_0x7a64('0x181')});db[_0x7a64('0x182')][_0x7a64('0x11c')](db[_0x7a64('0xef')],{'as':_0x7a64('0x17f'),'foreignKey':'ChatOfflineMessageId','onDelete':_0x7a64('0x11b'),'hooks':!![]});db[_0x7a64('0x182')]['belongsTo'](db[_0x7a64('0x168')],{'onDelete':_0x7a64('0x11b'),'as':_0x7a64('0x169'),'foreignKey':_0x7a64('0x16a')});db[_0x7a64('0x182')][_0x7a64('0x12d')](db['ChatWebsite'],{'as':_0x7a64('0x177'),'foreignKey':_0x7a64('0x181')});db[_0x7a64('0x67')][_0x7a64('0x12f')](db[_0x7a64('0x116')],{'as':'Agents','through':_0x7a64('0x31'),'hooks':!![]});db[_0x7a64('0x67')][_0x7a64('0x12f')](db[_0x7a64('0x133')],{'through':'team_has_chat_queues','as':_0x7a64('0x160')});db[_0x7a64('0x69')][_0x7a64('0x11c')](db[_0x7a64('0xd4')],{'as':_0x7a64('0x162'),'foreignKey':_0x7a64('0x1a0'),'onDelete':_0x7a64('0x11b')});db[_0x7a64('0x69')][_0x7a64('0x12f')](db['User'],{'as':_0x7a64('0x158'),'through':_0x7a64('0x1a1')});db[_0x7a64('0x6b')][_0x7a64('0x12d')](db[_0x7a64('0x5f')],{'as':_0x7a64('0x19d'),'foreignKey':'ChatWebsiteId'});db[_0x7a64('0x1a2')][_0x7a64('0x11c')](db[_0x7a64('0x168')],{'as':_0x7a64('0x130'),'foreignKey':_0x7a64('0x1a3')});db['CmContact']['hasMany'](db['CmContactHasItem'],{'as':'Phones','foreignKey':_0x7a64('0x1a4')});db['CmContact'][_0x7a64('0x11c')](db[_0x7a64('0x6f')],{'as':_0x7a64('0x12c'),'foreignKey':'ContactId'});db['CmContact'][_0x7a64('0x11c')](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':'ContactId'});db['CmContact'][_0x7a64('0x11c')](db[_0x7a64('0x121')],{'as':_0x7a64('0x1a5'),'foreignKey':_0x7a64('0x16a')});db['CmContact'][_0x7a64('0x11c')](db[_0x7a64('0x76')],{'as':_0x7a64('0x76'),'foreignKey':_0x7a64('0x16a')});db[_0x7a64('0x168')][_0x7a64('0x11c')](db[_0x7a64('0xd8')],{'as':_0x7a64('0x15a'),'foreignKey':_0x7a64('0x16a')});db[_0x7a64('0x168')][_0x7a64('0x11c')](db[_0x7a64('0x139')],{'as':_0x7a64('0x123'),'foreignKey':_0x7a64('0x16a'),'onDelete':_0x7a64('0x16d')});db[_0x7a64('0x168')][_0x7a64('0x11c')](db[_0x7a64('0x65')],{'as':_0x7a64('0x124'),'foreignKey':_0x7a64('0x16a'),'onDelete':_0x7a64('0x16d')});db[_0x7a64('0x168')]['hasMany'](db[_0x7a64('0x55')],{'as':_0x7a64('0x125'),'foreignKey':_0x7a64('0x16a'),'onDelete':_0x7a64('0x16d')});db[_0x7a64('0x168')][_0x7a64('0x11c')](db[_0x7a64('0x136')],{'as':_0x7a64('0x126'),'foreignKey':'ContactId','onDelete':'restrict'});db[_0x7a64('0x168')][_0x7a64('0x11c')](db['MailInteraction'],{'as':_0x7a64('0x128'),'foreignKey':'ContactId','onDelete':_0x7a64('0x16d')});db[_0x7a64('0x168')][_0x7a64('0x12d')](db[_0x7a64('0x1a2')],{'as':'Company','foreignKey':_0x7a64('0x1a3')});db[_0x7a64('0x168')]['belongsTo'](db[_0x7a64('0x145')],{'as':_0x7a64('0x185'),'foreignKey':_0x7a64('0x173'),'onDelete':_0x7a64('0x11b')});db[_0x7a64('0x168')][_0x7a64('0x12f')](db['User'],{'as':_0x7a64('0x17c'),'through':'cm_user_has_contacts'});db['CmContact'][_0x7a64('0x12f')](db[_0x7a64('0x87')],{'as':_0x7a64('0x179'),'through':_0x7a64('0x1a6')});db[_0x7a64('0x168')][_0x7a64('0x12f')](db[_0x7a64('0x87')],{'through':_0x7a64('0x1a6'),'as':_0x7a64('0x17b')});db[_0x7a64('0x6f')][_0x7a64('0x11c')](db[_0x7a64('0x8d')],{'as':_0x7a64('0x1a7'),'foreignKey':_0x7a64('0x1a8')});db['CmHopper'][_0x7a64('0x12d')](db[_0x7a64('0x168')],{'as':_0x7a64('0x169'),'foreignKey':_0x7a64('0x16a'),'onDelete':_0x7a64('0x11b')});db[_0x7a64('0x6f')]['belongsTo'](db[_0x7a64('0x145')],{'as':_0x7a64('0x185'),'foreignKey':'ListId','onDelete':_0x7a64('0x11b')});db['CmHopper'][_0x7a64('0x12d')](db[_0x7a64('0x116')],{'as':'Agent','foreignKey':_0x7a64('0x11e')});db[_0x7a64('0x6f')]['belongsTo'](db[_0x7a64('0x1a')],{'as':'Queue','foreignKey':_0x7a64('0x159'),'onDelete':_0x7a64('0x11b')});db['CmHopper'][_0x7a64('0x12d')](db[_0x7a64('0xeb')],{'as':_0x7a64('0xeb'),'foreignKey':'CampaignId','onDelete':_0x7a64('0x11b')});db[_0x7a64('0x6f')][_0x7a64('0x12d')](db['User'],{'as':'Owner','foreignKey':'OwnerId'});db[_0x7a64('0x71')][_0x7a64('0x12d')](db[_0x7a64('0x168')],{'as':_0x7a64('0x169'),'foreignKey':_0x7a64('0x16a'),'onDelete':_0x7a64('0x11b')});db[_0x7a64('0x71')][_0x7a64('0x12d')](db['CmList'],{'as':_0x7a64('0x185'),'foreignKey':_0x7a64('0x173'),'onDelete':_0x7a64('0x11b')});db[_0x7a64('0x71')][_0x7a64('0x12d')](db['VoiceQueue'],{'as':'Queue','foreignKey':_0x7a64('0x159'),'onDelete':_0x7a64('0x11b')});db[_0x7a64('0x71')][_0x7a64('0x12d')](db[_0x7a64('0xeb')],{'as':_0x7a64('0xeb'),'foreignKey':_0x7a64('0x1a9'),'onDelete':_0x7a64('0x11b')});db['Automation']['hasMany'](db[_0x7a64('0x1aa')],{'as':{'plural':'All','singular':_0x7a64('0x1ab')},'foreignKey':'AutomationAllId','onDelete':_0x7a64('0x11b'),'hooks':!![]});db['Automation'][_0x7a64('0x11c')](db['Condition'],{'as':{'plural':_0x7a64('0x1ac'),'singular':_0x7a64('0x1ad')},'foreignKey':'AutomationAnyId','onDelete':'cascade','hooks':!![]});db[_0x7a64('0x1ae')][_0x7a64('0x11c')](db[_0x7a64('0x78')],{'as':_0x7a64('0x1af'),'foreignKey':'AutomationId','onDelete':_0x7a64('0x11b'),'hooks':!![]});db[_0x7a64('0x7d')][_0x7a64('0x11c')](db[_0x7a64('0x7d')],{'as':_0x7a64('0x170'),'foreignKey':'ParentId','onDelete':_0x7a64('0x11b')});db[_0x7a64('0x7f')][_0x7a64('0x11c')](db['Interval'],{'as':'Intervals','foreignKey':_0x7a64('0x15c'),'onDelete':_0x7a64('0x11b'),'hooks':!![],'required':![]});db['Interval']['hasMany'](db[_0x7a64('0x16')],{'as':_0x7a64('0x120'),'foreignKey':'IntervalId','onDelete':_0x7a64('0x16d')});db['Interval']['hasMany'](db[_0x7a64('0x44')],{'as':_0x7a64('0x1b0'),'foreignKey':_0x7a64('0x15c')});db[_0x7a64('0x7f')][_0x7a64('0x11c')](db[_0x7a64('0x63')],{'as':'ChatApplications','foreignKey':_0x7a64('0x15c')});db['Interval'][_0x7a64('0x11c')](db[_0x7a64('0x4d')],{'as':_0x7a64('0x1b1'),'foreignKey':_0x7a64('0x15c')});db[_0x7a64('0x7f')]['hasMany'](db['SmsApplication'],{'as':'SmsApplications','foreignKey':_0x7a64('0x15c')});db[_0x7a64('0x83')]['belongsTo'](db['MailAccount'],{});db[_0x7a64('0x83')][_0x7a64('0x12d')](db[_0x7a64('0x1b2')],{'foreignKey':_0x7a64('0x1b3')});db[_0x7a64('0x83')][_0x7a64('0x12d')](db[_0x7a64('0x97')],{'foreignKey':_0x7a64('0x1b4')});db[_0x7a64('0x85')]['belongsToMany'](db['VoiceMusicOnHold'],{'as':'Mohs','through':'moh_has_sounds','onDelete':_0x7a64('0x16d')});db['Tag'][_0x7a64('0x12f')](db[_0x7a64('0x168')],{'through':_0x7a64('0x1a6')});db[_0x7a64('0x87')]['belongsToMany'](db['ChatInteraction'],{'through':_0x7a64('0x19f')});db[_0x7a64('0x87')][_0x7a64('0x12f')](db['MailInteraction'],{'through':'mail_interaction_has_tags'});db[_0x7a64('0x87')][_0x7a64('0x12f')](db[_0x7a64('0x55')],{'through':_0x7a64('0x190')});db[_0x7a64('0x87')][_0x7a64('0x12f')](db[_0x7a64('0x136')],{'through':_0x7a64('0x18b')});db[_0x7a64('0x87')][_0x7a64('0x12f')](db[_0x7a64('0x139')],{'through':_0x7a64('0x197')});db['Tag'][_0x7a64('0x12f')](db[_0x7a64('0x129')],{'through':'whatsapp_interaction_has_tags'});db[_0x7a64('0x8b')][_0x7a64('0x12d')](db['ContactItemType'],{'as':'ItemType','foreignKey':_0x7a64('0x1b5')});db['CmHopperAdditionalPhone'][_0x7a64('0x12d')](db[_0x7a64('0x6f')],{'as':_0x7a64('0x1b6'),'foreignKey':'CmHopperId'});db[_0x7a64('0x8b')]['belongsTo'](db[_0x7a64('0x168')],{'as':_0x7a64('0x169'),'foreignKey':_0x7a64('0x1a4')});db['Trigger'][_0x7a64('0x11c')](db[_0x7a64('0x1aa')],{'as':{'plural':_0x7a64('0x1b7'),'singular':_0x7a64('0x1b8')},'foreignKey':'TriggerAllId','onDelete':_0x7a64('0x11b'),'hooks':!![]});db['Trigger'][_0x7a64('0x11c')](db[_0x7a64('0x1aa')],{'as':{'plural':'AnyConditions','singular':_0x7a64('0x1b9')},'foreignKey':_0x7a64('0x1ba'),'onDelete':'cascade','hooks':!![]});db[_0x7a64('0x8f')][_0x7a64('0x11c')](db['Action'],{'as':_0x7a64('0x1af'),'foreignKey':_0x7a64('0x1bb'),'onDelete':_0x7a64('0x11b'),'hooks':!![]});db[_0x7a64('0x97')][_0x7a64('0x11c')](db['AnalyticFieldReport'],{'as':'Fields','onDelete':'cascade','foreignKey':_0x7a64('0x1b4'),'hooks':!![]});db[_0x7a64('0x1b2')][_0x7a64('0x11c')](db[_0x7a64('0x9e')],{'as':_0x7a64('0x1bc'),'onDelete':'cascade','foreignKey':_0x7a64('0x1b3')});db[_0x7a64('0x9c')]['hasMany'](db['AnalyticFieldReport'],{'as':_0x7a64('0x1bc'),'onDelete':_0x7a64('0x11b'),'foreignKey':_0x7a64('0x1bd')});db[_0x7a64('0x9e')][_0x7a64('0x12d')](db[_0x7a64('0x9c')],{'foreignKey':_0x7a64('0x1bd')});db[_0x7a64('0xa0')][_0x7a64('0x11c')](db['SalesforceConfiguration'],{'as':_0x7a64('0x1be'),'onDelete':_0x7a64('0x11b'),'foreignKey':_0x7a64('0x1bf')});db['SalesforceConfiguration']['hasMany'](db['SalesforceField'],{'as':_0x7a64('0x1c0'),'onDelete':_0x7a64('0x11b'),'foreignKey':_0x7a64('0x1c1')});db['SalesforceConfiguration'][_0x7a64('0x11c')](db['SalesforceField'],{'as':'Descriptions','onDelete':'cascade','foreignKey':'DescriptionId'});db[_0x7a64('0xa1')]['hasMany'](db[_0x7a64('0xa3')],{'as':_0x7a64('0x1bc'),'onDelete':_0x7a64('0x11b'),'foreignKey':_0x7a64('0x1c2')});db['SalesforceConfiguration']['belongsTo'](db['SalesforceAccount'],{'as':_0x7a64('0x177'),'foreignKey':_0x7a64('0x1bf')});db[_0x7a64('0xa3')]['hasMany'](db['SalesforceField'],{'as':_0x7a64('0x1c3'),'foreignKey':_0x7a64('0x1c1')});db['SalesforceField'][_0x7a64('0x11c')](db[_0x7a64('0xa3')],{'as':_0x7a64('0x1c4'),'foreignKey':_0x7a64('0x1c5')});db[_0x7a64('0xa3')][_0x7a64('0x11c')](db[_0x7a64('0xa3')],{'as':'Field','foreignKey':_0x7a64('0x1c2')});db[_0x7a64('0xa3')][_0x7a64('0x12d')](db['Variable'],{'as':_0x7a64('0x91'),'foreignKey':_0x7a64('0x1c6')});db[_0x7a64('0x1c7')]['hasMany'](db[_0x7a64('0xa6')],{'as':'Configurations','onDelete':_0x7a64('0x11b'),'foreignKey':_0x7a64('0x1bf')});db[_0x7a64('0xa6')][_0x7a64('0x11c')](db[_0x7a64('0xa8')],{'as':_0x7a64('0x1c0'),'onDelete':'cascade','foreignKey':_0x7a64('0x1c1')});db['SugarcrmConfiguration'][_0x7a64('0x11c')](db[_0x7a64('0xa8')],{'as':_0x7a64('0x1c8'),'onDelete':'cascade','foreignKey':_0x7a64('0x1c5')});db['SugarcrmConfiguration'][_0x7a64('0x11c')](db[_0x7a64('0xa8')],{'as':_0x7a64('0x1bc'),'onDelete':_0x7a64('0x11b'),'foreignKey':'FieldId'});db[_0x7a64('0xa6')][_0x7a64('0x12d')](db[_0x7a64('0x1c7')],{'as':_0x7a64('0x177'),'foreignKey':_0x7a64('0x1bf')});db[_0x7a64('0xa8')][_0x7a64('0x11c')](db[_0x7a64('0xa8')],{'as':_0x7a64('0x1c3'),'foreignKey':_0x7a64('0x1c1')});db[_0x7a64('0xa8')][_0x7a64('0x11c')](db[_0x7a64('0xa8')],{'as':'Description','foreignKey':_0x7a64('0x1c5')});db['SugarcrmField'][_0x7a64('0x11c')](db[_0x7a64('0xa8')],{'as':_0x7a64('0x1c9'),'foreignKey':_0x7a64('0x1c2')});db[_0x7a64('0xa8')]['belongsTo'](db[_0x7a64('0x91')],{'as':_0x7a64('0x91'),'foreignKey':_0x7a64('0x1c6')});db[_0x7a64('0xaa')][_0x7a64('0x11c')](db['DeskConfiguration'],{'as':_0x7a64('0x1be'),'onDelete':_0x7a64('0x11b'),'foreignKey':_0x7a64('0x1bf')});db[_0x7a64('0xab')][_0x7a64('0x11c')](db[_0x7a64('0xad')],{'as':_0x7a64('0x1c0'),'onDelete':'cascade','foreignKey':_0x7a64('0x1c1')});db[_0x7a64('0xab')][_0x7a64('0x11c')](db[_0x7a64('0xad')],{'as':_0x7a64('0x1c8'),'onDelete':_0x7a64('0x11b'),'foreignKey':_0x7a64('0x1c5')});db[_0x7a64('0xab')][_0x7a64('0x11c')](db[_0x7a64('0xad')],{'as':'Fields','onDelete':_0x7a64('0x11b'),'foreignKey':_0x7a64('0x1c2')});db[_0x7a64('0xab')][_0x7a64('0x12d')](db[_0x7a64('0xaa')],{'as':_0x7a64('0x177'),'foreignKey':_0x7a64('0x1bf')});db[_0x7a64('0xab')][_0x7a64('0x12f')](db[_0x7a64('0x87')],{'through':_0x7a64('0x1ca')});db['DeskField'][_0x7a64('0x11c')](db[_0x7a64('0xad')],{'as':_0x7a64('0x1c3'),'foreignKey':_0x7a64('0x1c1')});db[_0x7a64('0xad')][_0x7a64('0x11c')](db[_0x7a64('0xad')],{'as':_0x7a64('0x1c4'),'foreignKey':_0x7a64('0x1c5')});db[_0x7a64('0xad')][_0x7a64('0x11c')](db[_0x7a64('0xad')],{'as':_0x7a64('0x1c9'),'foreignKey':'FieldId'});db['DeskField'][_0x7a64('0x12d')](db[_0x7a64('0x91')],{'as':_0x7a64('0x91'),'foreignKey':'VariableId'});db[_0x7a64('0xaf')][_0x7a64('0x11c')](db[_0x7a64('0xb1')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x7a64('0x1bf')});db[_0x7a64('0xb1')][_0x7a64('0x11c')](db[_0x7a64('0x1cb')],{'as':_0x7a64('0x1c0'),'onDelete':_0x7a64('0x11b'),'foreignKey':_0x7a64('0x1c1')});db[_0x7a64('0xb1')][_0x7a64('0x11c')](db[_0x7a64('0x1cb')],{'as':_0x7a64('0x1c8'),'onDelete':_0x7a64('0x11b'),'foreignKey':_0x7a64('0x1c5')});db[_0x7a64('0xb1')]['hasMany'](db[_0x7a64('0x1cb')],{'as':_0x7a64('0x1bc'),'onDelete':_0x7a64('0x11b'),'foreignKey':_0x7a64('0x1c2')});db[_0x7a64('0xb1')][_0x7a64('0x12d')](db['ZohoAccount'],{'as':_0x7a64('0x177'),'foreignKey':_0x7a64('0x1bf')});db[_0x7a64('0x1cb')][_0x7a64('0x11c')](db['ZohoField'],{'as':_0x7a64('0x1c3'),'foreignKey':_0x7a64('0x1c1')});db[_0x7a64('0x1cb')][_0x7a64('0x11c')](db[_0x7a64('0x1cb')],{'as':_0x7a64('0x1c4'),'foreignKey':_0x7a64('0x1c5')});db[_0x7a64('0x1cb')]['hasMany'](db[_0x7a64('0x1cb')],{'as':_0x7a64('0x1c9'),'foreignKey':_0x7a64('0x1c2')});db[_0x7a64('0x1cb')]['belongsTo'](db['Variable'],{'as':_0x7a64('0x91'),'foreignKey':_0x7a64('0x1c6')});db['ZendeskAccount'][_0x7a64('0x11c')](db['ZendeskConfiguration'],{'as':_0x7a64('0x1be'),'onDelete':_0x7a64('0x11b'),'foreignKey':_0x7a64('0x1bf')});db[_0x7a64('0xb6')]['hasMany'](db['ZendeskField'],{'as':_0x7a64('0x1c0'),'foreignKey':_0x7a64('0x1c1')});db[_0x7a64('0xb6')][_0x7a64('0x11c')](db[_0x7a64('0xb8')],{'as':'Descriptions','foreignKey':_0x7a64('0x1c5')});db['ZendeskConfiguration'][_0x7a64('0x11c')](db['ZendeskField'],{'as':_0x7a64('0x1bc'),'foreignKey':_0x7a64('0x1c2')});db['ZendeskConfiguration'][_0x7a64('0x12d')](db[_0x7a64('0xb4')],{'as':_0x7a64('0x177'),'foreignKey':_0x7a64('0x1bf')});db[_0x7a64('0xb6')][_0x7a64('0x12f')](db[_0x7a64('0x87')],{'through':'int_zendesk_configuration_has_tags'});db[_0x7a64('0xb8')][_0x7a64('0x11c')](db[_0x7a64('0xb8')],{'as':_0x7a64('0x1c3'),'foreignKey':'SubjectId'});db['ZendeskField'][_0x7a64('0x11c')](db['ZendeskField'],{'as':_0x7a64('0x1c4'),'foreignKey':_0x7a64('0x1c5')});db[_0x7a64('0xb8')][_0x7a64('0x11c')](db[_0x7a64('0xb8')],{'as':_0x7a64('0x1c9'),'foreignKey':_0x7a64('0x1c2')});db['ZendeskField'][_0x7a64('0x12d')](db[_0x7a64('0x91')],{'as':_0x7a64('0x91'),'foreignKey':'VariableId'});db[_0x7a64('0xba')][_0x7a64('0x11c')](db['FreshdeskConfiguration'],{'as':'Configurations','onDelete':_0x7a64('0x11b'),'foreignKey':_0x7a64('0x1bf')});db['FreshdeskConfiguration']['hasMany'](db[_0x7a64('0xbe')],{'as':_0x7a64('0x1c0'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0x7a64('0xbc')][_0x7a64('0x11c')](db[_0x7a64('0xbe')],{'as':'Descriptions','onDelete':'cascade','foreignKey':_0x7a64('0x1c5')});db[_0x7a64('0xbc')][_0x7a64('0x11c')](db[_0x7a64('0xbe')],{'as':_0x7a64('0x1bc'),'onDelete':'cascade','foreignKey':_0x7a64('0x1c2')});db[_0x7a64('0xbc')][_0x7a64('0x12d')](db['FreshdeskAccount'],{'as':_0x7a64('0x177'),'foreignKey':_0x7a64('0x1bf')});db[_0x7a64('0xbc')][_0x7a64('0x12f')](db[_0x7a64('0x87')],{'through':'int_freshdesk_configuration_has_tags'});db[_0x7a64('0xbe')][_0x7a64('0x11c')](db[_0x7a64('0xbe')],{'as':_0x7a64('0x1c3'),'foreignKey':'SubjectId'});db[_0x7a64('0xbe')][_0x7a64('0x11c')](db[_0x7a64('0xbe')],{'as':_0x7a64('0x1c4'),'foreignKey':'DescriptionId'});db[_0x7a64('0xbe')][_0x7a64('0x11c')](db['FreshdeskField'],{'as':_0x7a64('0x1c9'),'foreignKey':_0x7a64('0x1c2')});db[_0x7a64('0xbe')]['belongsTo'](db[_0x7a64('0x91')],{'as':'Variable','foreignKey':_0x7a64('0x1c6')});db[_0x7a64('0xc0')][_0x7a64('0x11c')](db['VtigerConfiguration'],{'as':_0x7a64('0x1be'),'onDelete':_0x7a64('0x11b'),'foreignKey':'AccountId'});db[_0x7a64('0xc2')][_0x7a64('0x11c')](db[_0x7a64('0xc3')],{'as':_0x7a64('0x1c0'),'foreignKey':_0x7a64('0x1c1')});db[_0x7a64('0xc2')]['hasMany'](db[_0x7a64('0xc3')],{'as':_0x7a64('0x1c8'),'foreignKey':_0x7a64('0x1c5')});db[_0x7a64('0xc2')][_0x7a64('0x11c')](db['VtigerField'],{'as':'Fields','foreignKey':_0x7a64('0x1c2')});db[_0x7a64('0xc2')][_0x7a64('0x12d')](db[_0x7a64('0xc0')],{'as':_0x7a64('0x177'),'foreignKey':'AccountId'});db['VtigerField'][_0x7a64('0x11c')](db[_0x7a64('0xc3')],{'as':_0x7a64('0x1c3'),'foreignKey':'SubjectId'});db['VtigerField']['hasMany'](db[_0x7a64('0xc3')],{'as':_0x7a64('0x1c4'),'foreignKey':_0x7a64('0x1c5')});db['VtigerField']['hasMany'](db[_0x7a64('0xc3')],{'as':_0x7a64('0x1c9'),'foreignKey':'FieldId'});db[_0x7a64('0xc3')][_0x7a64('0x12d')](db['Variable'],{'as':_0x7a64('0x91'),'foreignKey':_0x7a64('0x1c6')});db[_0x7a64('0xc5')]['hasMany'](db[_0x7a64('0xc7')],{'as':_0x7a64('0x1be'),'onDelete':_0x7a64('0x11b'),'foreignKey':_0x7a64('0x1bf')});db['ServicenowConfiguration']['hasMany'](db['ServicenowField'],{'as':_0x7a64('0x1c0'),'foreignKey':_0x7a64('0x1c1')});db[_0x7a64('0xc7')][_0x7a64('0x11c')](db[_0x7a64('0xc8')],{'as':_0x7a64('0x1c8'),'foreignKey':_0x7a64('0x1c5')});db[_0x7a64('0xc7')][_0x7a64('0x11c')](db['ServicenowField'],{'as':_0x7a64('0x1bc'),'foreignKey':_0x7a64('0x1c2')});db[_0x7a64('0xc7')][_0x7a64('0x12d')](db[_0x7a64('0xc5')],{'as':_0x7a64('0x177'),'foreignKey':_0x7a64('0x1bf')});db[_0x7a64('0xc8')][_0x7a64('0x11c')](db[_0x7a64('0xc8')],{'as':_0x7a64('0x1c3'),'foreignKey':'SubjectId'});db['ServicenowField'][_0x7a64('0x11c')](db['ServicenowField'],{'as':_0x7a64('0x1c4'),'foreignKey':'DescriptionId'});db[_0x7a64('0xc8')][_0x7a64('0x11c')](db[_0x7a64('0xc8')],{'as':'Field','foreignKey':_0x7a64('0x1c2')});db['ServicenowField'][_0x7a64('0x12d')](db[_0x7a64('0x91')],{'as':_0x7a64('0x91'),'foreignKey':'VariableId'});db[_0x7a64('0x1cc')]['hasMany'](db[_0x7a64('0x1cd')],{'as':_0x7a64('0x1be'),'onDelete':_0x7a64('0x11b'),'foreignKey':_0x7a64('0x1bf')});db[_0x7a64('0x1cc')]['belongsTo'](db[_0x7a64('0x10c')],{'as':_0x7a64('0x10c'),'foreignKey':_0x7a64('0x16c')});db[_0x7a64('0x1cd')][_0x7a64('0x11c')](db[_0x7a64('0x1ce')],{'as':_0x7a64('0x1c0'),'onDelete':_0x7a64('0x11b'),'foreignKey':_0x7a64('0x1c1')});db[_0x7a64('0x1cd')]['hasMany'](db['Dynamics365Field'],{'as':_0x7a64('0x1c8'),'onDelete':_0x7a64('0x11b'),'foreignKey':'DescriptionId'});db[_0x7a64('0x1cd')][_0x7a64('0x11c')](db[_0x7a64('0x1ce')],{'as':_0x7a64('0x1bc'),'onDelete':_0x7a64('0x11b'),'foreignKey':_0x7a64('0x1c2')});db['Dynamics365Configuration'][_0x7a64('0x12d')](db[_0x7a64('0x1cc')],{'as':_0x7a64('0x177'),'foreignKey':_0x7a64('0x1bf')});db[_0x7a64('0x1ce')]['hasMany'](db[_0x7a64('0x1ce')],{'as':'Subject','foreignKey':_0x7a64('0x1c1')});db[_0x7a64('0x1ce')][_0x7a64('0x11c')](db[_0x7a64('0x1ce')],{'as':_0x7a64('0x1c4'),'foreignKey':_0x7a64('0x1c5')});db[_0x7a64('0x1ce')][_0x7a64('0x11c')](db[_0x7a64('0x1ce')],{'as':_0x7a64('0x1c9'),'foreignKey':_0x7a64('0x1c2')});db['Dynamics365Field'][_0x7a64('0x12d')](db[_0x7a64('0x91')],{'as':_0x7a64('0x91'),'foreignKey':_0x7a64('0x1c6')});db[_0x7a64('0xcc')][_0x7a64('0x11c')](db[_0x7a64('0x1cf')],{'as':_0x7a64('0x1be'),'onDelete':_0x7a64('0x11b'),'foreignKey':'AccountId'});db['FreshsalesConfiguration'][_0x7a64('0x11c')](db[_0x7a64('0xcf')],{'as':_0x7a64('0x1c0'),'foreignKey':_0x7a64('0x1c1')});db[_0x7a64('0x1cf')][_0x7a64('0x11c')](db[_0x7a64('0xcf')],{'as':_0x7a64('0x1c8'),'foreignKey':_0x7a64('0x1c5')});db[_0x7a64('0x1cf')][_0x7a64('0x11c')](db[_0x7a64('0xcf')],{'as':'Fields','foreignKey':_0x7a64('0x1c2')});db['FreshsalesConfiguration']['belongsTo'](db['FreshsalesAccount'],{'as':'Account','foreignKey':_0x7a64('0x1bf')});db[_0x7a64('0xcf')]['hasMany'](db[_0x7a64('0xcf')],{'as':_0x7a64('0x1c3'),'foreignKey':_0x7a64('0x1c1')});db[_0x7a64('0xcf')][_0x7a64('0x11c')](db[_0x7a64('0xcf')],{'as':'Description','foreignKey':_0x7a64('0x1c5')});db[_0x7a64('0xcf')][_0x7a64('0x11c')](db['FreshsalesField'],{'as':'Field','foreignKey':'FieldId'});db['FreshsalesField'][_0x7a64('0x12d')](db[_0x7a64('0x91')],{'as':_0x7a64('0x91'),'foreignKey':_0x7a64('0x1c6')});db[_0x7a64('0xd2')][_0x7a64('0x12d')](db[_0x7a64('0x5f')],{});db[_0x7a64('0xd2')]['belongsTo'](db['CmList'],{'as':'List','foreignKey':_0x7a64('0x173')});db[_0x7a64('0xd2')][_0x7a64('0x12d')](db['CmContact'],{'as':_0x7a64('0x169'),'foreignKey':_0x7a64('0x16a')});db['ChatQueueReport'][_0x7a64('0x12d')](db[_0x7a64('0x65')],{});db[_0x7a64('0xd2')][_0x7a64('0x12d')](db[_0x7a64('0x199')],{});db['ChatQueueReport'][_0x7a64('0x12d')](db[_0x7a64('0x116')],{});db[_0x7a64('0xd2')][_0x7a64('0x12d')](db[_0x7a64('0x67')],{});db[_0x7a64('0xd4')][_0x7a64('0x12d')](db[_0x7a64('0x116')],{'onDelete':_0x7a64('0x11b'),'foreignKey':_0x7a64('0x1d0')});db[_0x7a64('0xd4')][_0x7a64('0x12d')](db[_0x7a64('0x116')],{'onDelete':_0x7a64('0x11b'),'foreignKey':_0x7a64('0x1d1')});db['JscriptySessionReport'][_0x7a64('0x11c')](db[_0x7a64('0xd6')],{'foreignKey':_0x7a64('0x1d2'),'onDelete':'cascade'});db['JscriptySessionReport'][_0x7a64('0x11c')](db[_0x7a64('0x1d3')],{'foreignKey':'SessionId','onDelete':_0x7a64('0x11b')});db[_0x7a64('0xda')][_0x7a64('0x12d')](db[_0x7a64('0x14d')],{});db[_0x7a64('0xda')][_0x7a64('0x12d')](db[_0x7a64('0x145')],{'as':'List','foreignKey':_0x7a64('0x173')});db['SmsQueueReport']['belongsTo'](db[_0x7a64('0x168')],{'as':'Contact','foreignKey':_0x7a64('0x16a')});db[_0x7a64('0xda')]['belongsTo'](db[_0x7a64('0x55')],{});db['SmsQueueReport'][_0x7a64('0x12d')](db['SmsMessage'],{});db['SmsQueueReport'][_0x7a64('0x12d')](db[_0x7a64('0x116')],{});db['SmsQueueReport']['belongsTo'](db[_0x7a64('0x58')],{});db[_0x7a64('0xde')][_0x7a64('0x11c')](db[_0x7a64('0xd8')],{'foreignKey':_0x7a64('0x1d4')});db[_0x7a64('0xde')][_0x7a64('0x11c')](db[_0x7a64('0xd6')],{'foreignKey':_0x7a64('0x1d4')});db[_0x7a64('0xde')][_0x7a64('0x11c')](db[_0x7a64('0x1d3')],{'foreignKey':_0x7a64('0x1d4')});db[_0x7a64('0x133')][_0x7a64('0x12f')](db[_0x7a64('0x116')],{'as':_0x7a64('0x175'),'through':_0x7a64('0x134')});db[_0x7a64('0x133')][_0x7a64('0x12f')](db[_0x7a64('0x1a')],{'through':_0x7a64('0x10e'),'as':_0x7a64('0x1d5')});db[_0x7a64('0x133')]['belongsToMany'](db[_0x7a64('0x13b')],{'through':_0x7a64('0x176'),'as':'MailQueues'});db[_0x7a64('0x133')]['belongsToMany'](db[_0x7a64('0x67')],{'through':_0x7a64('0x1d6'),'as':_0x7a64('0x1d7')});db['Team'][_0x7a64('0x12f')](db[_0x7a64('0x13d')],{'through':_0x7a64('0x1d8'),'as':_0x7a64('0x13e')});db['Team'][_0x7a64('0x12f')](db[_0x7a64('0x58')],{'through':'team_has_sms_queues','as':'SmsQueues'});db[_0x7a64('0x133')][_0x7a64('0x12f')](db['OpenchannelQueue'],{'through':'team_has_openchannel_queues','as':'OpenchannelQueues'});db[_0x7a64('0x133')]['belongsToMany'](db[_0x7a64('0x143')],{'through':_0x7a64('0x1d9'),'as':_0x7a64('0x144')});db[_0x7a64('0x133')][_0x7a64('0x12f')](db[_0x7a64('0xfa')],{'through':_0x7a64('0x110'),'as':_0x7a64('0x1da')});db['Campaign'][_0x7a64('0x11c')](db[_0x7a64('0x6f')],{'as':'Hoppers','foreignKey':_0x7a64('0x1a9')});db[_0x7a64('0xeb')]['hasMany'](db[_0x7a64('0x73')],{'as':_0x7a64('0x1db'),'foreignKey':_0x7a64('0x1a9')});db[_0x7a64('0xeb')][_0x7a64('0x11c')](db['CmHopperHistory'],{'as':_0x7a64('0x1a5'),'foreignKey':_0x7a64('0x1a9')});db[_0x7a64('0xeb')]['hasMany'](db[_0x7a64('0x71')],{'as':_0x7a64('0x1dc'),'foreignKey':_0x7a64('0x1a9')});db[_0x7a64('0xeb')][_0x7a64('0x12d')](db[_0x7a64('0x29')],{'as':_0x7a64('0x29'),'foreignKey':_0x7a64('0x15b')});db[_0x7a64('0xeb')]['belongsTo'](db[_0x7a64('0x29')],{'as':_0x7a64('0x1dd'),'foreignKey':_0x7a64('0x1de')});db[_0x7a64('0xeb')][_0x7a64('0x12d')](db[_0x7a64('0x7f')],{'as':'Interval','foreignKey':'IntervalId'});db[_0x7a64('0xeb')]['belongsTo'](db[_0x7a64('0xe3')],{'as':_0x7a64('0xe3'),'foreignKey':_0x7a64('0x1df')});db[_0x7a64('0xeb')][_0x7a64('0x12f')](db[_0x7a64('0x145')],{'as':'Lists','through':'campaigns_has_cm_lists'});db[_0x7a64('0xeb')][_0x7a64('0x12f')](db['CmList'],{'as':_0x7a64('0x1e0'),'through':_0x7a64('0x1e1')});db[_0x7a64('0xef')][_0x7a64('0x12d')](db[_0x7a64('0x182')],{'as':_0x7a64('0x182'),'foreignKey':_0x7a64('0x183')});db[_0x7a64('0xf2')][_0x7a64('0x12d')](db[_0x7a64('0x42')],{});db[_0x7a64('0xf2')][_0x7a64('0x12d')](db['MailInteraction'],{});db[_0x7a64('0xf2')][_0x7a64('0x12d')](db[_0x7a64('0x3d')],{'foreignKey':_0x7a64('0x1e2'),'as':_0x7a64('0x1e3')});db[_0x7a64('0xf2')][_0x7a64('0x12d')](db[_0x7a64('0x116')],{'foreignKey':'FromUserId','as':_0x7a64('0x1e4')});db[_0x7a64('0xf2')][_0x7a64('0x12d')](db[_0x7a64('0x116')],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0x7a64('0xf2')][_0x7a64('0x12d')](db[_0x7a64('0x13b')],{'foreignKey':_0x7a64('0x1e5'),'as':_0x7a64('0x1e6')});db['MailTransferReport']['belongsTo'](db[_0x7a64('0x3d')],{'foreignKey':_0x7a64('0x1e7'),'as':_0x7a64('0x1e8')});db[_0x7a64('0xf4')][_0x7a64('0x12d')](db[_0x7a64('0x199')],{});db[_0x7a64('0xf4')][_0x7a64('0x12d')](db[_0x7a64('0x65')],{});db[_0x7a64('0xf4')][_0x7a64('0x12d')](db['ChatWebsite'],{'foreignKey':_0x7a64('0x1e9'),'as':_0x7a64('0x1e3')});db[_0x7a64('0xf4')][_0x7a64('0x12d')](db[_0x7a64('0x116')],{'foreignKey':_0x7a64('0x1ea'),'as':_0x7a64('0x1e4')});db[_0x7a64('0xf4')][_0x7a64('0x12d')](db[_0x7a64('0x116')],{'foreignKey':_0x7a64('0x1eb'),'as':_0x7a64('0x1ec')});db[_0x7a64('0xf4')][_0x7a64('0x12d')](db[_0x7a64('0x67')],{'foreignKey':_0x7a64('0x1ed'),'as':_0x7a64('0x1e6')});db[_0x7a64('0xf4')]['belongsTo'](db[_0x7a64('0x5f')],{'foreignKey':_0x7a64('0x1ee'),'as':'ToAccount'});db[_0x7a64('0x1ef')][_0x7a64('0x12d')](db[_0x7a64('0x50')],{});db[_0x7a64('0x1ef')]['belongsTo'](db[_0x7a64('0x136')],{});db[_0x7a64('0x1ef')][_0x7a64('0x12d')](db['FaxAccount'],{'foreignKey':_0x7a64('0x1f0'),'as':_0x7a64('0x1e3')});db[_0x7a64('0x1ef')]['belongsTo'](db[_0x7a64('0x116')],{'foreignKey':_0x7a64('0x1ea'),'as':_0x7a64('0x1e4')});db['FaxTransferReport'][_0x7a64('0x12d')](db['User'],{'foreignKey':_0x7a64('0x1eb'),'as':_0x7a64('0x1ec')});db['FaxTransferReport'][_0x7a64('0x12d')](db[_0x7a64('0x13d')],{'foreignKey':_0x7a64('0x1f1'),'as':_0x7a64('0x1e6')});db[_0x7a64('0x1ef')][_0x7a64('0x12d')](db[_0x7a64('0x147')],{'foreignKey':'ToFaxAccountId','as':'ToAccount'});db[_0x7a64('0x1f2')][_0x7a64('0x12d')](db[_0x7a64('0x194')],{});db[_0x7a64('0x1f2')][_0x7a64('0x12d')](db[_0x7a64('0x139')],{});db[_0x7a64('0x1f2')]['belongsTo'](db['OpenchannelAccount'],{'foreignKey':_0x7a64('0x1f3'),'as':'FromAccount'});db[_0x7a64('0x1f2')][_0x7a64('0x12d')](db[_0x7a64('0x116')],{'foreignKey':'FromUserId','as':_0x7a64('0x1e4')});db['OpenchannelTransferReport']['belongsTo'](db['User'],{'foreignKey':_0x7a64('0x1eb'),'as':'ToAgent'});db[_0x7a64('0x1f2')][_0x7a64('0x12d')](db[_0x7a64('0x5d')],{'foreignKey':_0x7a64('0x1f4'),'as':_0x7a64('0x1e6')});db['OpenchannelTransferReport'][_0x7a64('0x12d')](db['OpenchannelAccount'],{'foreignKey':_0x7a64('0x1f5'),'as':_0x7a64('0x1e8')});db[_0x7a64('0x1f6')][_0x7a64('0x12d')](db[_0x7a64('0x57')],{});db['SmsTransferReport'][_0x7a64('0x12d')](db['SmsInteraction'],{});db['SmsTransferReport']['belongsTo'](db[_0x7a64('0x14d')],{'foreignKey':_0x7a64('0x1f7'),'as':'FromAccount'});db[_0x7a64('0x1f6')]['belongsTo'](db[_0x7a64('0x116')],{'foreignKey':_0x7a64('0x1ea'),'as':'FromAgent'});db[_0x7a64('0x1f6')][_0x7a64('0x12d')](db[_0x7a64('0x116')],{'foreignKey':_0x7a64('0x1eb'),'as':_0x7a64('0x1ec')});db[_0x7a64('0x1f6')][_0x7a64('0x12d')](db['SmsQueue'],{'foreignKey':_0x7a64('0x1f8'),'as':_0x7a64('0x1e6')});db[_0x7a64('0x1f6')][_0x7a64('0x12d')](db[_0x7a64('0x14d')],{'foreignKey':_0x7a64('0x1f9'),'as':_0x7a64('0x1e8')});db['CmList'][_0x7a64('0x11c')](db[_0x7a64('0x7d')],{'as':_0x7a64('0x170'),'foreignKey':_0x7a64('0x173'),'onDelete':_0x7a64('0x11b')});db[_0x7a64('0x145')][_0x7a64('0x11c')](db['CmCustomField'],{'as':_0x7a64('0x1fa'),'foreignKey':'ListId'});db['CmList']['hasMany'](db['CmContact'],{'as':'Contacts','onDelete':_0x7a64('0x11b'),'foreignKey':'ListId'});db[_0x7a64('0x145')][_0x7a64('0x11c')](db['CmHopperFinal'],{'as':_0x7a64('0x1db'),'foreignKey':_0x7a64('0x173')});db[_0x7a64('0x145')]['hasMany'](db[_0x7a64('0x121')],{'as':_0x7a64('0x122'),'foreignKey':'ListId'});db['CmList'][_0x7a64('0x11c')](db[_0x7a64('0x76')],{'as':_0x7a64('0x76'),'foreignKey':_0x7a64('0x173')});db[_0x7a64('0x145')][_0x7a64('0x12f')](db[_0x7a64('0x1a')],{'as':'Queues','through':_0x7a64('0x15f')});db[_0x7a64('0x145')][_0x7a64('0x12f')](db[_0x7a64('0x116')],{'as':'Agents','through':_0x7a64('0x132')});db['VoicePrefix'][_0x7a64('0x11c')](db[_0x7a64('0x16')],{'as':_0x7a64('0x120'),'onDelete':'cascade'});db[_0x7a64('0xfa')]['belongsToMany'](db[_0x7a64('0x116')],{'as':_0x7a64('0x175'),'through':_0x7a64('0x112')});db[_0x7a64('0xfa')][_0x7a64('0x12f')](db[_0x7a64('0x133')],{'through':_0x7a64('0x110'),'as':_0x7a64('0x160')});db[_0x7a64('0xfc')]['hasMany'](db['User'],{'as':'Users','foreignKey':_0x7a64('0x12e')});db[_0x7a64('0xfc')][_0x7a64('0x11c')](db[_0x7a64('0xfd')],{'as':_0x7a64('0x1fb'),'foreignKey':_0x7a64('0x12e'),'onDelete':_0x7a64('0x11b')});db[_0x7a64('0xfd')][_0x7a64('0x11c')](db['UserProfileResource'],{'as':_0x7a64('0x1fc'),'foreignKey':_0x7a64('0x1fd'),'onDelete':_0x7a64('0x11b')});db[_0x7a64('0x150')]['hasMany'](db[_0x7a64('0x7d')],{'as':'Dispositions','foreignKey':'WhatsappAccountId','onDelete':_0x7a64('0x11b')});db['WhatsappAccount']['hasMany'](db[_0x7a64('0x7b')],{'as':_0x7a64('0x171'),'foreignKey':_0x7a64('0x1fe')});db[_0x7a64('0x150')][_0x7a64('0x11c')](db['WhatsappMessage'],{'as':'Messages','foreignKey':_0x7a64('0x1fe')});db[_0x7a64('0x150')][_0x7a64('0x11c')](db[_0x7a64('0x129')],{'as':_0x7a64('0x188')});db[_0x7a64('0x150')][_0x7a64('0x11c')](db[_0x7a64('0x103')],{'as':_0x7a64('0x172'),'foreignKey':'WhatsappAccountId','onDelete':'cascade'});db[_0x7a64('0x150')][_0x7a64('0x12d')](db['CmList'],{'as':_0x7a64('0x185'),'foreignKey':_0x7a64('0x173')});db[_0x7a64('0x150')][_0x7a64('0x12d')](db[_0x7a64('0x80')],{'as':'mandatoryDispositionPause','foreignKey':_0x7a64('0x15e')});db['WhatsappAccount']['belongsToMany'](db[_0x7a64('0x116')],{'as':_0x7a64('0x175'),'through':_0x7a64('0x152')});db[_0x7a64('0x103')][_0x7a64('0x12d')](db[_0x7a64('0x116')],{'onDelete':_0x7a64('0x16d')});db[_0x7a64('0x103')][_0x7a64('0x12d')](db['WhatsappQueue'],{'onDelete':'restrict'});db[_0x7a64('0x103')][_0x7a64('0x12d')](db[_0x7a64('0x150')],{'onDelete':_0x7a64('0x16d')});db[_0x7a64('0x103')][_0x7a64('0x12d')](db['Interval'],{'onDelete':_0x7a64('0x16d'),'foreignKey':_0x7a64('0x15c')});db[_0x7a64('0x103')][_0x7a64('0x12d')](db['Tag'],{'onDelete':'restrict','foreignKey':_0x7a64('0x184')});db[_0x7a64('0x129')][_0x7a64('0x11c')](db[_0x7a64('0x106')],{'as':_0x7a64('0x162'),'onDelete':_0x7a64('0x11b'),'foreignKey':_0x7a64('0x1ff')});db['WhatsappInteraction'][_0x7a64('0x12d')](db['WhatsappAccount'],{'as':'Account','foreignKey':_0x7a64('0x1fe')});db['WhatsappInteraction']['belongsTo'](db[_0x7a64('0x168')],{'as':_0x7a64('0x169'),'foreignKey':'ContactId'});db[_0x7a64('0x129')][_0x7a64('0x12d')](db['User'],{'as':_0x7a64('0x178'),'foreignKey':_0x7a64('0x11e')});db[_0x7a64('0x129')][_0x7a64('0x12f')](db[_0x7a64('0x87')],{'through':_0x7a64('0x200'),'as':'Tags'});db[_0x7a64('0x129')][_0x7a64('0x12f')](db['Tag'],{'through':_0x7a64('0x200'),'as':'ThroughTags'});db[_0x7a64('0x129')][_0x7a64('0x12f')](db[_0x7a64('0x116')],{'as':_0x7a64('0x17c'),'through':'user_has_whatsapp_interactions','foreignKey':_0x7a64('0x1ff')});db[_0x7a64('0x106')][_0x7a64('0x12d')](db[_0x7a64('0x116')],{'as':'User'});db[_0x7a64('0x106')][_0x7a64('0x12d')](db[_0x7a64('0x168')],{'onDelete':_0x7a64('0x11b'),'as':_0x7a64('0x169')});db[_0x7a64('0x106')][_0x7a64('0x12d')](db[_0x7a64('0x129')],{'onDelete':'cascade','as':_0x7a64('0x180'),'foreignKey':_0x7a64('0x1ff')});db['WhatsappMessage'][_0x7a64('0x12d')](db['WhatsappAccount'],{'as':_0x7a64('0x177'),'foreignKey':_0x7a64('0x1fe')});db['WhatsappQueueReport'][_0x7a64('0x12d')](db[_0x7a64('0x150')],{});db['WhatsappQueueReport'][_0x7a64('0x12d')](db[_0x7a64('0x145')],{'as':_0x7a64('0x185'),'foreignKey':_0x7a64('0x173')});db[_0x7a64('0x108')][_0x7a64('0x12d')](db[_0x7a64('0x168')],{'as':_0x7a64('0x169'),'foreignKey':_0x7a64('0x16a')});db[_0x7a64('0x108')][_0x7a64('0x12d')](db['WhatsappInteraction'],{});db[_0x7a64('0x108')][_0x7a64('0x12d')](db['WhatsappQueue'],{});db[_0x7a64('0x108')][_0x7a64('0x12d')](db[_0x7a64('0x106')],{});db[_0x7a64('0x108')][_0x7a64('0x12d')](db[_0x7a64('0x116')],{});db[_0x7a64('0x109')][_0x7a64('0x12d')](db[_0x7a64('0x106')],{});db[_0x7a64('0x109')][_0x7a64('0x12d')](db[_0x7a64('0x129')],{});db['WhatsappTransferReport'][_0x7a64('0x12d')](db['WhatsappAccount'],{'foreignKey':_0x7a64('0x201'),'as':_0x7a64('0x1e3')});db[_0x7a64('0x109')][_0x7a64('0x12d')](db[_0x7a64('0x150')],{'foreignKey':'ToWhatsappAccountId','as':_0x7a64('0x1e8')});db[_0x7a64('0x109')]['belongsTo'](db[_0x7a64('0x143')],{'foreignKey':_0x7a64('0x202'),'as':_0x7a64('0x1e6')});db['WhatsappTransferReport'][_0x7a64('0x12d')](db[_0x7a64('0x116')],{'foreignKey':_0x7a64('0x1ea'),'as':_0x7a64('0x1e4')});db[_0x7a64('0x109')][_0x7a64('0x12d')](db[_0x7a64('0x116')],{'foreignKey':_0x7a64('0x1eb'),'as':'ToAgent'});db['WhatsappQueue'][_0x7a64('0x12f')](db[_0x7a64('0x116')],{'as':_0x7a64('0x175'),'through':_0x7a64('0x38'),'foreignKey':'WhatsappQueueId'});db[_0x7a64('0x143')][_0x7a64('0x12f')](db[_0x7a64('0x133')],{'through':_0x7a64('0x1d9'),'as':_0x7a64('0x160')});db[_0x7a64('0x119')][_0x7a64('0x12d')](db['User'],{'as':_0x7a64('0x203'),'foreignKey':_0x7a64('0x11e'),'onDelete':_0x7a64('0x11b'),'hooks':!![]});db['CloudProvider']['hasOne'](db[_0x7a64('0x1cc')],{'as':'Dynamics365Account','onDelete':_0x7a64('0x16d')});db[_0x7a64('0x10c')][_0x7a64('0x117')](db['MailServerIn'],{'as':_0x7a64('0x16f'),'onDelete':_0x7a64('0x16d')});db[_0x7a64('0x10c')][_0x7a64('0x117')](db[_0x7a64('0x16e')],{'as':_0x7a64('0x204'),'onDelete':_0x7a64('0x16d')});module[_0x7a64('0x205')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x8a16=['VoiceQueuesRt','Extensions','CmHopperFinal','HopperHistory','OpenchannelInteractions','SmsInteractions','FaxInteractions','MailInteractions','WhatsappInteractions','SenderId','SET\x20NULL','belongsTo','belongsToMany','chat_group_has_users','CmList','user_has_teams','ChatInteractions','user_has_chat_interactions','user_has_fax_interactions','user_has_openchannel_interactions','VoiceQueues','VoicePrefixes','MailQueues','ChatQueue','FaxQueue','FaxQueues','SmsQueues','UserOpenchannelQueue','WhatsappQueues','cm_user_has_lists','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','MailAccount','MailAccounts','user_has_mail_accounts','SmsAccount','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','SpiedAgents','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperHistories','HopperBlacks','JscriptySessionReport','JscriptySessions','TrunkId','TrunkBackup','TrunkBackupId','Interval','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','Lists','voice_queues_has_cm_lists','Agents','Teams','voice_queues_has_cm_blacklists','Messages','mailboxuser','mailbox','uniqueid','ContactId','MailServerIn','MailAccountId','CloudProviderId','Imap','Smtp','Dispositions','Answers','TemplateId','team_has_mail_queues','Account','Contact','Owner','Tags','mail_interaction_has_tags','Users','Attachments','Interaction','ChatWebsiteId','ChatOfflineMessageId','restrict','TagId','MailQueueReport','Items','FaxAccountId','Interactions','Applications','Exntensions','List','Pause','FaxInteractionId','fax_interaction_has_tags','ThroughTags','AttachmentId','ListId','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','user_has_sms_interactions','SmsQueueId','OpenchannelAccountId','OpenchannelQueueId','openchannel_interaction_has_tags','OpenchannelInteractionId','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','team_has_chat_queues','ChatInternalMessage','ChatGroupId','CmCompany','Contacts','Phones','HopperFinals','Company','cm_user_has_contacts','cm_contact_has_tags','CmHopperId','Agent','CampaignId','OwnerId','Condition','OneAll','AutomationAllId','Any','OneAny','AutomationAnyId','AutomationId','ParentId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','VoiceMusicOnHold','Mohs','whatsapp_interaction_has_tags','ItemType','ItemTypeId','CmHopperAdditionalPhone','Hopper','CmContactId','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','Trigger','TriggerId','Fields','AnalyticMetric','MetricId','SalesforceConfiguration','Configurations','AccountId','SubjectId','FieldId','Description','Field','Variable','Subjects','Descriptions','DescriptionId','Subject','VariableId','ZohoConfiguration','ZendeskField','FreshdeskField','int_freshdesk_configuration_has_tags','ServicenowField','Dynamics365Configuration','FreshsalesAccount','FromId','JscriptyQuestionReport','SessionId','JscriptyProject','JscriptyAnswerReport','ChatQueues','team_has_fax_queues','OpenchannelQueues','team_has_whatsapp_queues','SquareProject','SquareProjectId','BlackLists','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToAccount','FromChatWebsiteId','FromFaxAccountId','ToFaxAccountId','OpenchannelTransferReport','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','SmsTransferReport','ToSmsAccountId','CmCustomField','CustomFields','Queues','userProfileId','UserProfileSection','UserProfileSections','sectionId','WhatsappAccountId','WhatsappInteractionId','WhatsappTransferReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','user','../config/environment','lodash','jstz','determine','sequelize','defaultsDeep','motion2','xC@LL1234','127.0.0.1','utf8mb4','utf8','utf8_general_ci','sequelizeHistory','xcall','mysql','name','database','username','options','User','import','../api/user/user.model','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','MemberReport','Trunk','../api/trunk/trunk.model','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','Dashboard','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsApplication','../api/smsApplication/smsApplication.model','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','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','ChatOfflineMessage','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','Action','../api/action/action.model','Automation','CannedAnswer','Disposition','../api/condition/condition.model','../api/interval/interval.model','../api/pause/pause.model','Cdr','VoiceQueuesLog','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','CmContactHasItem','../api/cmContactHasItem/cmContactHasItem.model','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','Template','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','SalesforceAccount','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','Integration','../api/network/network.model','ChatQueueReport','../api/chatInternalMessage/chatInternalMessage.model','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','SmsQueueReport','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','Setting','../api/setting/setting.model','../api/squareOdbc/squareOdbc.model','SquareRecording','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','FaxTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','../api/user-setting/user-setting.model','MailInteractionHasTag','hasOne','cascade','UserId','UserSetting','userSetting','VoiceRecording','Recordings','hasMany'];(function(_0x5d0b4e,_0x54c772){var _0x36b6c1=function(_0x33a00c){while(--_0x33a00c){_0x5d0b4e['push'](_0x5d0b4e['shift']());}};_0x36b6c1(++_0x54c772);}(_0x8a16,0xe6));var _0x68a1=function(_0xc84126,_0x3791bf){_0xc84126=_0xc84126-0x0;var _0x1d64ce=_0x8a16[_0xc84126];return _0x1d64ce;};'use strict';var config=require(_0x68a1('0x0'));var Sequelize=require('sequelize');var _=require(_0x68a1('0x1'));var jstz=require(_0x68a1('0x2'));var timezone=jstz[_0x68a1('0x3')]();config[_0x68a1('0x4')]=_[_0x68a1('0x5')](config[_0x68a1('0x4')],{'database':_0x68a1('0x6'),'username':'xcall','password':_0x68a1('0x7'),'options':{'host':_0x68a1('0x8'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x68a1('0x9')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0x68a1('0xa'),'collate':_0x68a1('0xb')}}});config[_0x68a1('0xc')]=_['defaultsDeep'](config[_0x68a1('0xc')],{'database':_0x68a1('0x6'),'username':_0x68a1('0xd'),'password':_0x68a1('0x7'),'options':{'host':_0x68a1('0x8'),'port':0xcea,'dialect':_0x68a1('0xe'),'dialectOptions':{'charset':_0x68a1('0x9')},'logging':![],'timezone':timezone[_0x68a1('0xf')](),'define':{'charset':_0x68a1('0xa'),'collate':_0x68a1('0xb')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x68a1('0x4')][_0x68a1('0x10')],config[_0x68a1('0x4')][_0x68a1('0x11')],config[_0x68a1('0x4')]['password'],config[_0x68a1('0x4')][_0x68a1('0x12')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory']['database'],config[_0x68a1('0xc')][_0x68a1('0x11')],config[_0x68a1('0xc')]['password'],config[_0x68a1('0xc')][_0x68a1('0x12')])};db[_0x68a1('0x13')]=db['sequelize'][_0x68a1('0x14')](_0x68a1('0x15'));db['VoiceChanSpy']=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0x16'));db[_0x68a1('0x17')]=db['sequelize'][_0x68a1('0x14')](_0x68a1('0x18'));db[_0x68a1('0x19')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0x1a'));db['VoiceMusicOnHold']=db['sequelize'][_0x68a1('0x14')](_0x68a1('0x1b'));db[_0x68a1('0x1c')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0x1d'));db['VoiceRecording']=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0x1e'));db[_0x68a1('0x1f')]=db['sequelize'][_0x68a1('0x14')](_0x68a1('0x20'));db[_0x68a1('0x21')]=db[_0x68a1('0x4')]['import'](_0x68a1('0x22'));db[_0x68a1('0x23')]=db['sequelize'][_0x68a1('0x14')](_0x68a1('0x24'));db[_0x68a1('0x25')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0x26'));db['VoiceDialReport']=db[_0x68a1('0x4')]['import'](_0x68a1('0x27'));db[_0x68a1('0x28')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0x29'));db[_0x68a1('0x2a')]=db[_0x68a1('0x4')][_0x68a1('0x14')]('../api/voiceQueueReport/voiceQueueReport.model');db[_0x68a1('0x2b')]=db[_0x68a1('0x4')][_0x68a1('0x14')]('../api/memberReport/memberReport.model');db[_0x68a1('0x2c')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0x2d'));db['VoiceTransferReport']=db['sequelize'][_0x68a1('0x14')](_0x68a1('0x2e'));db[_0x68a1('0x2f')]=db[_0x68a1('0x4')][_0x68a1('0x14')]('../api/userVoiceQueueRt/userVoiceQueueRt.model');db[_0x68a1('0x30')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0x31'));db[_0x68a1('0x32')]=db[_0x68a1('0x4')]['import'](_0x68a1('0x33'));db[_0x68a1('0x34')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0x35'));db[_0x68a1('0x36')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0x37'));db[_0x68a1('0x38')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0x39'));db['UserOpenchannelQueue']=db['sequelize'][_0x68a1('0x14')](_0x68a1('0x3a'));db[_0x68a1('0x3b')]=db[_0x68a1('0x4')][_0x68a1('0x14')]('../api/userWhatsappQueue/userWhatsappQueue.model');db['MailServerIn']=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0x3c'));db[_0x68a1('0x3d')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0x3e'));db['MailAccount']=db['sequelize']['import'](_0x68a1('0x3f'));db[_0x68a1('0x40')]=db['sequelize'][_0x68a1('0x14')](_0x68a1('0x41'));db[_0x68a1('0x42')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0x43'));db[_0x68a1('0x44')]=db[_0x68a1('0x4')][_0x68a1('0x14')]('../api/mailInteraction/mailInteraction.model');db[_0x68a1('0x45')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0x46'));db[_0x68a1('0x47')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0x48'));db['MailQueueReport']=db['sequelize']['import']('../api/mailQueueReport/mailQueueReport.model');db[_0x68a1('0x49')]=db[_0x68a1('0x4')][_0x68a1('0x14')]('../api/dashboard/dashboard.model');db[_0x68a1('0x4a')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0x4b'));db[_0x68a1('0x4c')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0x4d'));db[_0x68a1('0x4e')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0x4f'));db[_0x68a1('0x50')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0x51'));db[_0x68a1('0x52')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0x53'));db['FaxQueue']=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0x54'));db[_0x68a1('0x55')]=db['sequelize'][_0x68a1('0x14')](_0x68a1('0x56'));db['SmsAccount']=db[_0x68a1('0x4')][_0x68a1('0x14')]('../api/smsAccount/smsAccount.model');db[_0x68a1('0x57')]=db[_0x68a1('0x4')]['import'](_0x68a1('0x58'));db[_0x68a1('0x59')]=db['sequelize'][_0x68a1('0x14')](_0x68a1('0x5a'));db[_0x68a1('0x5b')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0x5c'));db[_0x68a1('0x5d')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0x5e'));db[_0x68a1('0x5f')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0x60'));db[_0x68a1('0x61')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0x62'));db[_0x68a1('0x63')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0x64'));db[_0x68a1('0x65')]=db[_0x68a1('0x4')][_0x68a1('0x14')]('../api/openchannelMessage/openchannelMessage.model');db[_0x68a1('0x66')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0x67'));db[_0x68a1('0x68')]=db[_0x68a1('0x4')][_0x68a1('0x14')]('../api/chatWebsite/chatWebsite.model');db[_0x68a1('0x69')]=db['sequelize'][_0x68a1('0x14')](_0x68a1('0x6a'));db[_0x68a1('0x6b')]=db['sequelize']['import'](_0x68a1('0x6c'));db[_0x68a1('0x6d')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0x6e'));db[_0x68a1('0x6f')]=db[_0x68a1('0x4')][_0x68a1('0x14')]('../api/chatMessage/chatMessage.model');db[_0x68a1('0x70')]=db[_0x68a1('0x4')][_0x68a1('0x14')]('../api/chatOfflineMessage/chatOfflineMessage.model');db['ChatQueue']=db['sequelize'][_0x68a1('0x14')](_0x68a1('0x71'));db[_0x68a1('0x72')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0x73'));db[_0x68a1('0x74')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0x75'));db['CmCompany']=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0x76'));db[_0x68a1('0x77')]=db[_0x68a1('0x4')]['import'](_0x68a1('0x78'));db[_0x68a1('0x79')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0x7a'));db[_0x68a1('0x7b')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0x7c'));db['CmHopperFinal']=db['sequelize'][_0x68a1('0x14')](_0x68a1('0x7d'));db[_0x68a1('0x7e')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0x7f'));db[_0x68a1('0x80')]=db['sequelize']['import'](_0x68a1('0x81'));db['CmCustomField']=db[_0x68a1('0x4')][_0x68a1('0x14')]('../api/cmCustomField/cmCustomField.model');db[_0x68a1('0x82')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0x83'));db[_0x68a1('0x84')]=db[_0x68a1('0x4')][_0x68a1('0x14')]('../api/automation/automation.model');db[_0x68a1('0x85')]=db[_0x68a1('0x4')][_0x68a1('0x14')]('../api/cannedAnswer/cannedAnswer.model');db[_0x68a1('0x86')]=db['sequelize'][_0x68a1('0x14')]('../api/disposition/disposition.model');db['Condition']=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0x87'));db['Interval']=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0x88'));db['Pause']=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0x89'));db[_0x68a1('0x8a')]=db['sequelize'][_0x68a1('0x14')]('../api/cdr/cdr.model');db[_0x68a1('0x8b')]=db[_0x68a1('0x4')][_0x68a1('0x14')]('../api/voiceQueuesLog/voiceQueuesLog.model');db[_0x68a1('0x8c')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0x8d'));db[_0x68a1('0x8e')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0x8f'));db[_0x68a1('0x90')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0x91'));db[_0x68a1('0x92')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0x93'));db[_0x68a1('0x94')]=db[_0x68a1('0x4')]['import'](_0x68a1('0x95'));db['CmHopperAdditionalPhone']=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0x96'));db[_0x68a1('0x97')]=db[_0x68a1('0x4')][_0x68a1('0x14')]('../api/template/template.model');db['Trigger']=db['sequelize'][_0x68a1('0x14')]('../api/trigger/trigger.model');db['Variable']=db[_0x68a1('0x4')][_0x68a1('0x14')]('../api/variable/variable.model');db['Integration']=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0x98'));db[_0x68a1('0x99')]=db[_0x68a1('0x4')]['import'](_0x68a1('0x9a'));db[_0x68a1('0x9b')]=db['sequelize']['import'](_0x68a1('0x9c'));db[_0x68a1('0x9d')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0x9e'));db[_0x68a1('0x9f')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0xa0'));db['AnalyticMetric']=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0xa1'));db[_0x68a1('0xa2')]=db[_0x68a1('0x4')]['import'](_0x68a1('0xa3'));db[_0x68a1('0xa4')]=db[_0x68a1('0x4')][_0x68a1('0x14')]('../api/analyticTreeReport/analyticTreeReport.model');db[_0x68a1('0xa5')]=db[_0x68a1('0x4')][_0x68a1('0x14')]('../api/intSalesforceAccount/intSalesforceAccount.model');db['SalesforceConfiguration']=db[_0x68a1('0x4')][_0x68a1('0x14')]('../api/intSalesforceConfiguration/intSalesforceConfiguration.model');db[_0x68a1('0xa6')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0xa7'));db[_0x68a1('0xa8')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0xa9'));db[_0x68a1('0xaa')]=db[_0x68a1('0x4')]['import'](_0x68a1('0xab'));db[_0x68a1('0xac')]=db['sequelize'][_0x68a1('0x14')]('../api/intSugarcrmField/intSugarcrmField.model');db[_0x68a1('0xad')]=db['sequelize']['import'](_0x68a1('0xae'));db[_0x68a1('0xaf')]=db[_0x68a1('0x4')]['import'](_0x68a1('0xb0'));db[_0x68a1('0xb1')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0xb2'));db[_0x68a1('0xb3')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0xb4'));db['ZohoConfiguration']=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0xb5'));db[_0x68a1('0xb6')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0xb7'));db[_0x68a1('0xb8')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0xb9'));db[_0x68a1('0xba')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0xbb'));db['ZendeskField']=db['sequelize'][_0x68a1('0x14')](_0x68a1('0xbc'));db[_0x68a1('0xbd')]=db[_0x68a1('0x4')][_0x68a1('0x14')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db[_0x68a1('0xbe')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0xbf'));db['FreshdeskField']=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0xc0'));db[_0x68a1('0xc1')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0xc2'));db[_0x68a1('0xc3')]=db[_0x68a1('0x4')]['import'](_0x68a1('0xc4'));db[_0x68a1('0xc5')]=db[_0x68a1('0x4')]['import'](_0x68a1('0xc6'));db[_0x68a1('0xc7')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0xc8'));db[_0x68a1('0xc9')]=db[_0x68a1('0x4')]['import'](_0x68a1('0xca'));db['ServicenowField']=db[_0x68a1('0x4')]['import'](_0x68a1('0xcb'));db[_0x68a1('0xcc')]=db['sequelize'][_0x68a1('0x14')]('../api/intDynamics365Account/intDynamics365Account.model');db['Dynamics365Configuration']=db['sequelize'][_0x68a1('0x14')](_0x68a1('0xcd'));db[_0x68a1('0xce')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0xcf'));db['FreshsalesAccount']=db[_0x68a1('0x4')][_0x68a1('0x14')]('../api/intFreshsalesAccount/intFreshsalesAccount.model');db[_0x68a1('0xd0')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0xd1'));db[_0x68a1('0xd2')]=db[_0x68a1('0x4')][_0x68a1('0x14')]('../api/intFreshsalesField/intFreshsalesField.model');db[_0x68a1('0xd3')]=db['sequelize'][_0x68a1('0x14')]('../api/integration/integration.model');db['Network']=db[_0x68a1('0x4')]['import'](_0x68a1('0xd4'));db[_0x68a1('0xd5')]=db[_0x68a1('0x4')][_0x68a1('0x14')]('../api/chatQueueReport/chatQueueReport.model');db['ChatInternalMessage']=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0xd6'));db['JscriptyAnswerReport']=db[_0x68a1('0x4')]['import'](_0x68a1('0xd7'));db['JscriptyQuestionReport']=db[_0x68a1('0x4')]['import']('../api/jscriptyQuestionReport/jscriptyQuestionReport.model');db['JscriptySessionReport']=db[_0x68a1('0x4')][_0x68a1('0x14')]('../api/jscriptySessionReport/jscriptySessionReport.model');db[_0x68a1('0xd8')]=db[_0x68a1('0x4')]['import']('../api/smsQueueReport/smsQueueReport.model');db[_0x68a1('0xd9')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0xda'));db[_0x68a1('0xdb')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0xdc'));db['JscriptyProject']=db[_0x68a1('0x4')]['import']('../api/jscriptyProject/jscriptyProject.model');db[_0x68a1('0xdd')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0xde'));db['SquareOdbc']=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0xdf'));db['SquareProject']=db[_0x68a1('0x4')]['import']('../api/squareProject/squareProject.model');db[_0x68a1('0xe0')]=db[_0x68a1('0x4')][_0x68a1('0x14')]('../api/squareRecording/squareRecording.model');db[_0x68a1('0xe1')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0xe2'));db[_0x68a1('0xe3')]=db['sequelize']['import'](_0x68a1('0xe4'));db[_0x68a1('0xe5')]=db[_0x68a1('0x4')]['import'](_0x68a1('0xe6'));db[_0x68a1('0xe7')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0xe8'));db[_0x68a1('0xe9')]=db[_0x68a1('0x4')]['import'](_0x68a1('0xea'));db[_0x68a1('0xeb')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0xec'));db[_0x68a1('0xed')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0xee'));db[_0x68a1('0xef')]=db['sequelize'][_0x68a1('0x14')](_0x68a1('0xf0'));db[_0x68a1('0xf1')]=db[_0x68a1('0x4')][_0x68a1('0x14')]('../api/chatTransferReport/chatTransferReport.model');db[_0x68a1('0xf2')]=db[_0x68a1('0x4')]['import']('../api/faxTransferReport/faxTransferReport.model');db['OpenchannelTransferReport']=db[_0x68a1('0x4')]['import'](_0x68a1('0xf3'));db['SmsTransferReport']=db[_0x68a1('0x4')][_0x68a1('0x14')]('../api/smsTransferReport/smsTransferReport.model');db['CmList']=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0xf4'));db[_0x68a1('0xf5')]=db[_0x68a1('0x4')]['import'](_0x68a1('0xf6'));db[_0x68a1('0xf7')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0xf8'));db['UserProfileSection']=db['sequelize'][_0x68a1('0x14')](_0x68a1('0xf9'));db[_0x68a1('0xfa')]=db['sequelize'][_0x68a1('0x14')](_0x68a1('0xfb'));db[_0x68a1('0xfc')]=db['sequelize'][_0x68a1('0x14')](_0x68a1('0xfd'));db[_0x68a1('0xfe')]=db['sequelize'][_0x68a1('0x14')](_0x68a1('0xff'));db[_0x68a1('0x100')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0x101'));db[_0x68a1('0x102')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0x103'));db[_0x68a1('0x104')]=db[_0x68a1('0x4')]['import'](_0x68a1('0x105'));db[_0x68a1('0x106')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0x107'));db['WhatsappTransferReport']=db[_0x68a1('0x4')]['import'](_0x68a1('0x108'));db[_0x68a1('0x109')]=db[_0x68a1('0x4')][_0x68a1('0x14')]('../api/whatsappQueue/whatsappQueue.model');db[_0x68a1('0x10a')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0x10b'));db[_0x68a1('0x10c')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0x10d'));db[_0x68a1('0x10e')]=db[_0x68a1('0x4')][_0x68a1('0x14')]('../api/teamVoicePrefix/teamVoicePrefix.model');db[_0x68a1('0x10f')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0x110'));db['UserSetting']=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0x111'));db[_0x68a1('0x112')]=db[_0x68a1('0x4')][_0x68a1('0x14')]('../api/mailInteractionHasTag/mailInteractionHasTag.model');db['User'][_0x68a1('0x113')](db[_0x68a1('0x21')],{'as':_0x68a1('0x21'),'onDelete':_0x68a1('0x114'),'foreignKey':_0x68a1('0x115')});db[_0x68a1('0x13')][_0x68a1('0x113')](db[_0x68a1('0x116')],{'as':_0x68a1('0x117'),'onDelete':_0x68a1('0x114'),'foreignKey':_0x68a1('0x115')});db[_0x68a1('0x13')]['hasMany'](db[_0x68a1('0x118')],{'as':_0x68a1('0x119'),'foreignKey':_0x68a1('0x115')});db[_0x68a1('0x13')][_0x68a1('0x11a')](db[_0x68a1('0x2f')],{'as':_0x68a1('0x11b'),'foreignKey':_0x68a1('0x115')});db[_0x68a1('0x13')][_0x68a1('0x11a')](db[_0x68a1('0x19')],{'as':_0x68a1('0x11c'),'onDelete':_0x68a1('0x114'),'hooks':!![]});db[_0x68a1('0x13')]['hasMany'](db[_0x68a1('0x11d')],{'as':'HopperFinals','foreignKey':'UserId'});db[_0x68a1('0x13')][_0x68a1('0x11a')](db['CmHopperHistory'],{'as':_0x68a1('0x11e'),'foreignKey':_0x68a1('0x115')});db[_0x68a1('0x13')][_0x68a1('0x11a')](db[_0x68a1('0x80')],{'as':_0x68a1('0x80'),'foreignKey':'UserId'});db[_0x68a1('0x13')][_0x68a1('0x11a')](db[_0x68a1('0x63')],{'as':_0x68a1('0x11f'),'foreignKey':_0x68a1('0x115')});db[_0x68a1('0x13')][_0x68a1('0x11a')](db[_0x68a1('0x6d')],{'as':'ChatInteractions','foreignKey':'UserId'});db['User'][_0x68a1('0x11a')](db[_0x68a1('0x59')],{'as':_0x68a1('0x120'),'foreignKey':_0x68a1('0x115')});db['User'][_0x68a1('0x11a')](db[_0x68a1('0x50')],{'as':_0x68a1('0x121'),'foreignKey':_0x68a1('0x115')});db[_0x68a1('0x13')][_0x68a1('0x11a')](db[_0x68a1('0x44')],{'as':_0x68a1('0x122'),'foreignKey':_0x68a1('0x115')});db[_0x68a1('0x13')][_0x68a1('0x11a')](db[_0x68a1('0x102')],{'as':_0x68a1('0x123'),'foreignKey':'UserId'});db[_0x68a1('0x13')][_0x68a1('0x11a')](db[_0x68a1('0xfc')],{'as':'UserNotifications','foreignKey':_0x68a1('0x124')});db[_0x68a1('0x13')]['hasMany'](db[_0x68a1('0x79')],{'as':'Hoppers','foreignKey':'UserId','onDelete':_0x68a1('0x125')});db['User'][_0x68a1('0x126')](db[_0x68a1('0xf7')],{'as':_0x68a1('0xf7'),'foreignKey':'userProfileId'});db[_0x68a1('0x13')][_0x68a1('0x127')](db['ChatGroup'],{'as':'Groups','through':_0x68a1('0x128')});db[_0x68a1('0x13')][_0x68a1('0x127')](db[_0x68a1('0x77')],{'as':'Contacts','through':'cm_user_has_contacts'});db[_0x68a1('0x13')]['belongsToMany'](db[_0x68a1('0x129')],{'as':'Lists','through':'cm_user_has_lists'});db[_0x68a1('0x13')][_0x68a1('0x127')](db[_0x68a1('0xe3')],{'through':_0x68a1('0x12a')});db[_0x68a1('0x13')][_0x68a1('0x127')](db[_0x68a1('0x44')],{'as':_0x68a1('0x122'),'through':'user_has_mail_interactions'});db[_0x68a1('0x13')][_0x68a1('0x127')](db[_0x68a1('0x6d')],{'as':_0x68a1('0x12b'),'through':_0x68a1('0x12c')});db[_0x68a1('0x13')][_0x68a1('0x127')](db[_0x68a1('0x50')],{'as':_0x68a1('0x121'),'through':_0x68a1('0x12d')});db[_0x68a1('0x13')][_0x68a1('0x127')](db[_0x68a1('0x59')],{'as':'SmsInteractions','through':'user_has_sms_interactions'});db[_0x68a1('0x13')][_0x68a1('0x127')](db[_0x68a1('0x63')],{'as':_0x68a1('0x11f'),'through':_0x68a1('0x12e')});db[_0x68a1('0x13')][_0x68a1('0x127')](db[_0x68a1('0x102')],{'as':_0x68a1('0x123'),'through':'user_has_whatsapp_interactions'});db[_0x68a1('0x13')][_0x68a1('0x127')](db[_0x68a1('0x1c')],{'as':_0x68a1('0x12f'),'through':_0x68a1('0x30'),'required':![]});db[_0x68a1('0x13')][_0x68a1('0x127')](db[_0x68a1('0xf5')],{'as':_0x68a1('0x130'),'through':_0x68a1('0x10f'),'required':![]});db['User']['belongsToMany'](db[_0x68a1('0x40')],{'as':_0x68a1('0x131'),'through':_0x68a1('0x34'),'required':![]});db['User']['belongsToMany'](db[_0x68a1('0x132')],{'as':'ChatQueues','through':_0x68a1('0x32'),'required':![],'hooks':!![]});db[_0x68a1('0x13')][_0x68a1('0x127')](db[_0x68a1('0x133')],{'as':_0x68a1('0x134'),'through':_0x68a1('0x36'),'required':![]});db[_0x68a1('0x13')][_0x68a1('0x127')](db[_0x68a1('0x5d')],{'as':_0x68a1('0x135'),'through':_0x68a1('0x38'),'required':![]});db[_0x68a1('0x13')][_0x68a1('0x127')](db[_0x68a1('0x66')],{'as':'OpenchannelQueues','through':_0x68a1('0x136'),'required':![]});db[_0x68a1('0x13')][_0x68a1('0x127')](db['WhatsappQueue'],{'as':_0x68a1('0x137'),'through':_0x68a1('0x3b'),'required':![]});db[_0x68a1('0x13')]['belongsToMany'](db[_0x68a1('0x129')],{'through':_0x68a1('0x138')});db['User']['belongsToMany'](db['ChatWebsite'],{'as':_0x68a1('0x139'),'through':_0x68a1('0x13a')});db[_0x68a1('0x13')]['belongsToMany'](db[_0x68a1('0x4c')],{'as':_0x68a1('0x13b'),'through':_0x68a1('0x13c')});db[_0x68a1('0x13')]['belongsToMany'](db[_0x68a1('0x13d')],{'as':_0x68a1('0x13e'),'through':_0x68a1('0x13f')});db[_0x68a1('0x13')][_0x68a1('0x127')](db['OpenchannelAccount'],{'as':'OpenchannelAccounts','through':'user_has_openchannel_accounts'});db[_0x68a1('0x13')][_0x68a1('0x127')](db[_0x68a1('0x140')],{'as':_0x68a1('0x141'),'through':_0x68a1('0x142')});db[_0x68a1('0x13')][_0x68a1('0x127')](db['WhatsappAccount'],{'as':_0x68a1('0x143'),'through':_0x68a1('0x144')});db['VoiceChanSpy']['hasMany'](db[_0x68a1('0x19')],{'as':_0x68a1('0x145'),'onDelete':_0x68a1('0x114'),'foreignKey':'ChanSpyId'});db['VoiceContext']['hasMany'](db[_0x68a1('0x19')],{'onDelete':_0x68a1('0x114')});db['VoiceExtension'][_0x68a1('0x11a')](db['VoiceExtension'],{'as':'Applications','onDelete':'cascade'});db['VoiceMusicOnHold'][_0x68a1('0x127')](db[_0x68a1('0x8e')],{'as':'Sounds','through':_0x68a1('0x146')});db[_0x68a1('0x1c')][_0x68a1('0x11a')](db[_0x68a1('0x2f')],{'as':_0x68a1('0x147'),'foreignKey':_0x68a1('0x148')});db[_0x68a1('0x1c')][_0x68a1('0x11a')](db['CmHopper'],{'as':_0x68a1('0x149'),'foreignKey':_0x68a1('0x148')});db[_0x68a1('0x1c')][_0x68a1('0x11a')](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':_0x68a1('0x148')});db[_0x68a1('0x1c')][_0x68a1('0x11a')](db[_0x68a1('0x7e')],{'as':_0x68a1('0x14a'),'foreignKey':_0x68a1('0x148')});db[_0x68a1('0x1c')]['hasMany'](db[_0x68a1('0x80')],{'as':'ReportAgentPreview','foreignKey':_0x68a1('0x148')});db[_0x68a1('0x1c')][_0x68a1('0x11a')](db[_0x68a1('0x7b')],{'as':_0x68a1('0x14b'),'foreignKey':_0x68a1('0x148')});db[_0x68a1('0x1c')]['hasMany'](db[_0x68a1('0x14c')],{'as':_0x68a1('0x14d'),'foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x68a1('0x126')](db['Trunk'],{'as':_0x68a1('0x2c'),'foreignKey':_0x68a1('0x14e')});db[_0x68a1('0x1c')]['belongsTo'](db[_0x68a1('0x2c')],{'as':_0x68a1('0x14f'),'foreignKey':_0x68a1('0x150')});db['VoiceQueue'][_0x68a1('0x126')](db[_0x68a1('0x151')],{'as':'Interval','foreignKey':_0x68a1('0x152')});db['VoiceQueue']['belongsTo'](db['Pause'],{'as':_0x68a1('0x153'),'foreignKey':_0x68a1('0x154')});db[_0x68a1('0x1c')][_0x68a1('0x127')](db[_0x68a1('0x129')],{'as':_0x68a1('0x155'),'through':_0x68a1('0x156')});db['VoiceQueue'][_0x68a1('0x127')](db[_0x68a1('0x13')],{'as':_0x68a1('0x157'),'through':_0x68a1('0x30')});db[_0x68a1('0x1c')][_0x68a1('0x127')](db[_0x68a1('0xe3')],{'as':_0x68a1('0x158'),'through':'TeamVoiceQueue'});db[_0x68a1('0x1c')][_0x68a1('0x127')](db['CmList'],{'as':'BlackLists','through':_0x68a1('0x159')});db[_0x68a1('0x118')][_0x68a1('0x126')](db[_0x68a1('0x13')],{'as':_0x68a1('0x13'),'foreignKey':_0x68a1('0x115')});db[_0x68a1('0x1f')][_0x68a1('0x126')](db[_0x68a1('0x13')],{'as':_0x68a1('0x13'),'foreignKey':_0x68a1('0x115')});db[_0x68a1('0x21')]['hasMany'](db[_0x68a1('0x23')],{'as':_0x68a1('0x15a'),'onDelete':'cascade','foreignKey':_0x68a1('0x15b'),'sourceKey':_0x68a1('0x15c')});db[_0x68a1('0x23')][_0x68a1('0x126')](db['VoiceMail'],{'foreignKey':_0x68a1('0x15b'),'targetKey':_0x68a1('0x15c')});db['VoiceCallReport'][_0x68a1('0x11a')](db[_0x68a1('0x2a')],{'as':'QueueCalls','foreignKey':_0x68a1('0x15d'),'constraints':![]});db[_0x68a1('0x25')][_0x68a1('0x11a')](db['VoiceAgentReport'],{'as':'AgentReports','foreignKey':_0x68a1('0x15d'),'constraints':![]});db[_0x68a1('0x25')][_0x68a1('0x126')](db[_0x68a1('0x13')],{'as':_0x68a1('0x13'),'foreignKey':_0x68a1('0x115')});db[_0x68a1('0x25')][_0x68a1('0x126')](db[_0x68a1('0x77')],{'as':'Contact','foreignKey':_0x68a1('0x15e')});db[_0x68a1('0x15f')][_0x68a1('0x126')](db[_0x68a1('0x13d')],{'as':_0x68a1('0x13d'),'foreignKey':_0x68a1('0x160')});db['MailServerIn']['belongsTo'](db[_0x68a1('0x10a')],{'as':'CloudProvider','foreignKey':_0x68a1('0x161'),'onDelete':'restrict'});db[_0x68a1('0x3d')]['belongsTo'](db['MailAccount'],{'as':_0x68a1('0x13d'),'foreignKey':_0x68a1('0x160')});db[_0x68a1('0x3d')][_0x68a1('0x126')](db[_0x68a1('0x10a')],{'as':_0x68a1('0x10a'),'foreignKey':'CloudProviderId','onDelete':'restrict'});db['MailAccount'][_0x68a1('0x113')](db['MailServerIn'],{'as':_0x68a1('0x162'),'onDelete':'cascade'});db[_0x68a1('0x13d')][_0x68a1('0x113')](db['MailServerOut'],{'as':_0x68a1('0x163'),'onDelete':_0x68a1('0x114')});db[_0x68a1('0x13d')][_0x68a1('0x11a')](db[_0x68a1('0x86')],{'as':_0x68a1('0x164'),'foreignKey':_0x68a1('0x160'),'onDelete':_0x68a1('0x114')});db['MailAccount']['hasMany'](db[_0x68a1('0x85')],{'as':_0x68a1('0x165'),'foreignKey':'MailAccountId'});db[_0x68a1('0x13d')][_0x68a1('0x11a')](db[_0x68a1('0x45')],{'as':_0x68a1('0x15a'),'foreignKey':_0x68a1('0x160')});db['MailAccount'][_0x68a1('0x11a')](db[_0x68a1('0x44')],{'as':'Interactions'});db[_0x68a1('0x13d')]['hasMany'](db[_0x68a1('0x47')],{'as':'Applications','foreignKey':_0x68a1('0x160'),'onDelete':_0x68a1('0x114')});db[_0x68a1('0x13d')]['belongsTo'](db[_0x68a1('0x129')],{'as':'List','foreignKey':'ListId'});db[_0x68a1('0x13d')][_0x68a1('0x126')](db[_0x68a1('0x97')],{'as':_0x68a1('0x97'),'foreignKey':_0x68a1('0x166')});db[_0x68a1('0x13d')][_0x68a1('0x126')](db['Pause'],{'as':_0x68a1('0x153'),'foreignKey':_0x68a1('0x154')});db[_0x68a1('0x13d')][_0x68a1('0x127')](db[_0x68a1('0x13')],{'as':_0x68a1('0x157'),'through':_0x68a1('0x13f')});db[_0x68a1('0x40')][_0x68a1('0x127')](db[_0x68a1('0x13')],{'as':_0x68a1('0x157'),'through':_0x68a1('0x34')});db[_0x68a1('0x40')]['belongsToMany'](db[_0x68a1('0xe3')],{'through':_0x68a1('0x167'),'as':_0x68a1('0x158')});db[_0x68a1('0x44')][_0x68a1('0x11a')](db[_0x68a1('0x45')],{'as':_0x68a1('0x15a'),'onDelete':_0x68a1('0x114'),'foreignKey':'MailInteractionId'});db[_0x68a1('0x44')][_0x68a1('0x126')](db[_0x68a1('0x13d')],{'as':_0x68a1('0x168'),'foreignKey':_0x68a1('0x160')});db[_0x68a1('0x44')][_0x68a1('0x126')](db['CmContact'],{'as':_0x68a1('0x169'),'foreignKey':'ContactId'});db['MailInteraction']['belongsTo'](db['User'],{'as':_0x68a1('0x16a'),'foreignKey':'UserId'});db['MailInteraction']['belongsToMany'](db['Tag'],{'through':'mail_interaction_has_tags','as':_0x68a1('0x16b')});db[_0x68a1('0x44')][_0x68a1('0x127')](db[_0x68a1('0x90')],{'through':_0x68a1('0x16c'),'as':'ThroughTags'});db[_0x68a1('0x44')]['belongsToMany'](db[_0x68a1('0x13')],{'as':_0x68a1('0x16d'),'through':'user_has_mail_interactions','foreignKey':'MailInteractionId'});db[_0x68a1('0x45')][_0x68a1('0x11a')](db['Attachment'],{'as':_0x68a1('0x16e'),'onDelete':_0x68a1('0x114')});db[_0x68a1('0x45')][_0x68a1('0x126')](db[_0x68a1('0x13')],{'as':_0x68a1('0x13')});db[_0x68a1('0x45')]['belongsTo'](db[_0x68a1('0x77')],{'onDelete':_0x68a1('0x114'),'as':'Contact'});db[_0x68a1('0x45')][_0x68a1('0x126')](db['MailInteraction'],{'as':_0x68a1('0x16f'),'foreignKey':'MailInteractionId'});db[_0x68a1('0x45')]['belongsTo'](db['MailAccount'],{'as':_0x68a1('0x168'),'foreignKey':_0x68a1('0x160')});db['MailMessage'][_0x68a1('0x126')](db[_0x68a1('0x68')],{'as':'ChatWebsite','foreignKey':_0x68a1('0x170')});db[_0x68a1('0x45')][_0x68a1('0x126')](db[_0x68a1('0x70')],{'as':_0x68a1('0x70'),'foreignKey':_0x68a1('0x171')});db[_0x68a1('0x47')]['belongsTo'](db[_0x68a1('0x13')],{'onDelete':_0x68a1('0x172')});db[_0x68a1('0x47')][_0x68a1('0x126')](db[_0x68a1('0x40')],{'onDelete':_0x68a1('0x172')});db[_0x68a1('0x47')][_0x68a1('0x126')](db[_0x68a1('0x13d')],{'onDelete':_0x68a1('0x172')});db[_0x68a1('0x47')]['belongsTo'](db[_0x68a1('0x151')],{'onDelete':_0x68a1('0x172'),'foreignKey':_0x68a1('0x152')});db['MailApplication'][_0x68a1('0x126')](db['Tag'],{'onDelete':_0x68a1('0x172'),'foreignKey':_0x68a1('0x173')});db[_0x68a1('0x174')][_0x68a1('0x126')](db['MailAccount'],{});db[_0x68a1('0x174')][_0x68a1('0x126')](db[_0x68a1('0x129')],{'as':'List','foreignKey':'ListId'});db[_0x68a1('0x174')][_0x68a1('0x126')](db[_0x68a1('0x77')],{'as':_0x68a1('0x169'),'foreignKey':_0x68a1('0x15e')});db['MailQueueReport'][_0x68a1('0x126')](db['MailInteraction'],{});db['MailQueueReport'][_0x68a1('0x126')](db[_0x68a1('0x45')],{});db[_0x68a1('0x174')][_0x68a1('0x126')](db[_0x68a1('0x13')],{});db[_0x68a1('0x174')][_0x68a1('0x126')](db[_0x68a1('0x40')],{});db[_0x68a1('0x49')][_0x68a1('0x11a')](db['DashboardItem'],{'as':_0x68a1('0x175'),'onDelete':_0x68a1('0x114')});db[_0x68a1('0x4c')]['hasMany'](db[_0x68a1('0x86')],{'as':_0x68a1('0x164'),'foreignKey':_0x68a1('0x176'),'onDelete':_0x68a1('0x114')});db['FaxAccount'][_0x68a1('0x11a')](db[_0x68a1('0x85')],{'as':_0x68a1('0x165'),'foreignKey':'FaxAccountId'});db[_0x68a1('0x4c')][_0x68a1('0x11a')](db[_0x68a1('0x50')],{'as':_0x68a1('0x177')});db['FaxAccount'][_0x68a1('0x11a')](db[_0x68a1('0x4e')],{'as':_0x68a1('0x178'),'foreignKey':'FaxAccountId','onDelete':'cascade'});db[_0x68a1('0x4c')][_0x68a1('0x11a')](db[_0x68a1('0x19')],{'as':_0x68a1('0x179'),'onDelete':_0x68a1('0x114')});db['FaxAccount'][_0x68a1('0x11a')](db[_0x68a1('0x52')],{'as':_0x68a1('0x15a')});db[_0x68a1('0x4c')][_0x68a1('0x126')](db['Trunk'],{'as':_0x68a1('0x2c')});db[_0x68a1('0x4c')][_0x68a1('0x126')](db[_0x68a1('0x129')],{'as':_0x68a1('0x17a'),'foreignKey':'ListId'});db[_0x68a1('0x4c')][_0x68a1('0x126')](db[_0x68a1('0x17b')],{'as':'mandatoryDispositionPause','foreignKey':_0x68a1('0x154')});db['FaxAccount'][_0x68a1('0x127')](db[_0x68a1('0x13')],{'as':_0x68a1('0x157'),'through':_0x68a1('0x13c')});db[_0x68a1('0x4e')][_0x68a1('0x126')](db[_0x68a1('0x13')],{'onDelete':_0x68a1('0x172')});db[_0x68a1('0x4e')]['belongsTo'](db[_0x68a1('0x133')],{'onDelete':_0x68a1('0x172')});db[_0x68a1('0x4e')]['belongsTo'](db[_0x68a1('0x4c')],{'onDelete':_0x68a1('0x172')});db[_0x68a1('0x4e')][_0x68a1('0x126')](db[_0x68a1('0x90')],{'onDelete':'restrict','foreignKey':_0x68a1('0x173')});db[_0x68a1('0x50')]['hasMany'](db[_0x68a1('0x52')],{'as':_0x68a1('0x15a'),'onDelete':_0x68a1('0x114'),'foreignKey':_0x68a1('0x17c')});db[_0x68a1('0x50')]['belongsTo'](db[_0x68a1('0x4c')],{'as':_0x68a1('0x168'),'foreignKey':'FaxAccountId'});db[_0x68a1('0x50')][_0x68a1('0x126')](db[_0x68a1('0x77')],{'as':_0x68a1('0x169'),'foreignKey':'ContactId'});db[_0x68a1('0x50')]['belongsTo'](db['User'],{'as':_0x68a1('0x16a'),'foreignKey':_0x68a1('0x115')});db[_0x68a1('0x50')][_0x68a1('0x127')](db[_0x68a1('0x90')],{'through':'fax_interaction_has_tags','as':_0x68a1('0x16b')});db[_0x68a1('0x50')][_0x68a1('0x127')](db[_0x68a1('0x90')],{'through':_0x68a1('0x17d'),'as':_0x68a1('0x17e')});db[_0x68a1('0x50')][_0x68a1('0x127')](db[_0x68a1('0x13')],{'as':_0x68a1('0x16d'),'through':_0x68a1('0x12d'),'foreignKey':'FaxInteractionId'});db[_0x68a1('0x52')][_0x68a1('0x126')](db[_0x68a1('0x13')],{'onDelete':_0x68a1('0x114'),'as':_0x68a1('0x13')});db[_0x68a1('0x52')]['belongsTo'](db['FaxInteraction'],{'as':_0x68a1('0x16f'),'foreignKey':'FaxInteractionId'});db[_0x68a1('0x52')][_0x68a1('0x126')](db[_0x68a1('0x77')],{'onDelete':'cascade','as':_0x68a1('0x169')});db['FaxMessage']['belongsTo'](db['Attachment'],{'as':'Attachment','foreignKey':_0x68a1('0x17f')});db[_0x68a1('0x52')]['belongsTo'](db[_0x68a1('0x4c')],{'as':_0x68a1('0x168'),'foreignKey':_0x68a1('0x176')});db[_0x68a1('0x133')][_0x68a1('0x127')](db['User'],{'as':_0x68a1('0x157'),'through':'UserFaxQueue'});db[_0x68a1('0x133')]['belongsToMany'](db[_0x68a1('0xe3')],{'through':'team_has_fax_queues','as':_0x68a1('0x158')});db[_0x68a1('0x55')]['belongsTo'](db[_0x68a1('0x4c')],{});db[_0x68a1('0x55')][_0x68a1('0x126')](db[_0x68a1('0x129')],{'as':_0x68a1('0x17a'),'foreignKey':_0x68a1('0x180')});db['FaxQueueReport'][_0x68a1('0x126')](db[_0x68a1('0x77')],{'as':_0x68a1('0x169'),'foreignKey':'ContactId'});db['FaxQueueReport'][_0x68a1('0x126')](db[_0x68a1('0x50')],{});db['FaxQueueReport'][_0x68a1('0x126')](db['FaxMessage'],{});db['FaxQueueReport'][_0x68a1('0x126')](db[_0x68a1('0x13')],{});db[_0x68a1('0x55')][_0x68a1('0x126')](db['FaxQueue'],{});db['SmsAccount'][_0x68a1('0x11a')](db[_0x68a1('0x86')],{'as':_0x68a1('0x164'),'foreignKey':'SmsAccountId','onDelete':_0x68a1('0x114')});db[_0x68a1('0x140')][_0x68a1('0x11a')](db[_0x68a1('0x85')],{'as':_0x68a1('0x165'),'foreignKey':'SmsAccountId'});db[_0x68a1('0x140')][_0x68a1('0x11a')](db[_0x68a1('0x5b')],{'as':_0x68a1('0x15a'),'foreignKey':_0x68a1('0x181')});db[_0x68a1('0x140')]['hasMany'](db[_0x68a1('0x59')],{'as':_0x68a1('0x177')});db[_0x68a1('0x140')][_0x68a1('0x11a')](db[_0x68a1('0x57')],{'as':_0x68a1('0x178'),'foreignKey':'SmsAccountId','onDelete':_0x68a1('0x114')});db['SmsAccount'][_0x68a1('0x126')](db['CmList'],{'as':_0x68a1('0x17a'),'foreignKey':'ListId'});db[_0x68a1('0x140')][_0x68a1('0x126')](db[_0x68a1('0x17b')],{'as':_0x68a1('0x153'),'foreignKey':_0x68a1('0x154')});db[_0x68a1('0x140')][_0x68a1('0x127')](db[_0x68a1('0x13')],{'as':_0x68a1('0x157'),'through':_0x68a1('0x142')});db[_0x68a1('0x57')][_0x68a1('0x126')](db[_0x68a1('0x13')],{'onDelete':_0x68a1('0x172')});db[_0x68a1('0x57')]['belongsTo'](db[_0x68a1('0x5d')],{'onDelete':_0x68a1('0x172')});db[_0x68a1('0x57')][_0x68a1('0x126')](db[_0x68a1('0x140')],{'onDelete':_0x68a1('0x172')});db['SmsApplication']['belongsTo'](db[_0x68a1('0x151')],{'onDelete':_0x68a1('0x172'),'foreignKey':_0x68a1('0x152')});db[_0x68a1('0x57')][_0x68a1('0x126')](db[_0x68a1('0x90')],{'onDelete':'restrict','foreignKey':_0x68a1('0x173')});db[_0x68a1('0x59')]['hasMany'](db[_0x68a1('0x5b')],{'as':'Messages','onDelete':_0x68a1('0x114'),'foreignKey':_0x68a1('0x182')});db[_0x68a1('0x59')]['belongsTo'](db[_0x68a1('0x140')],{'as':_0x68a1('0x168'),'foreignKey':_0x68a1('0x181')});db[_0x68a1('0x59')][_0x68a1('0x126')](db[_0x68a1('0x77')],{'as':_0x68a1('0x169'),'foreignKey':_0x68a1('0x15e')});db[_0x68a1('0x59')][_0x68a1('0x126')](db[_0x68a1('0x13')],{'as':_0x68a1('0x16a'),'foreignKey':_0x68a1('0x115')});db['SmsInteraction']['belongsToMany'](db[_0x68a1('0x90')],{'through':_0x68a1('0x183'),'as':_0x68a1('0x16b')});db[_0x68a1('0x59')][_0x68a1('0x127')](db['Tag'],{'through':_0x68a1('0x183'),'as':_0x68a1('0x17e')});db[_0x68a1('0x59')][_0x68a1('0x127')](db['User'],{'as':_0x68a1('0x16d'),'through':_0x68a1('0x184'),'foreignKey':_0x68a1('0x182')});db['SmsMessage'][_0x68a1('0x126')](db['User'],{'as':'User'});db[_0x68a1('0x5b')][_0x68a1('0x126')](db[_0x68a1('0x77')],{'onDelete':_0x68a1('0x114'),'as':_0x68a1('0x169')});db['SmsMessage'][_0x68a1('0x126')](db[_0x68a1('0x59')],{'onDelete':_0x68a1('0x114'),'as':_0x68a1('0x16f'),'foreignKey':'SmsInteractionId'});db[_0x68a1('0x5b')][_0x68a1('0x126')](db[_0x68a1('0x140')],{'as':_0x68a1('0x168'),'foreignKey':_0x68a1('0x181')});db[_0x68a1('0x5d')][_0x68a1('0x127')](db[_0x68a1('0x13')],{'as':_0x68a1('0x157'),'through':_0x68a1('0x38'),'foreignKey':_0x68a1('0x185')});db[_0x68a1('0x5d')][_0x68a1('0x127')](db['Team'],{'through':'team_has_sms_queues','as':'Teams'});db[_0x68a1('0x5f')][_0x68a1('0x11a')](db[_0x68a1('0x86')],{'as':_0x68a1('0x164'),'foreignKey':'OpenchannelAccountId','onDelete':_0x68a1('0x114')});db[_0x68a1('0x5f')]['hasMany'](db[_0x68a1('0x85')],{'as':'Answers','foreignKey':_0x68a1('0x186')});db[_0x68a1('0x5f')]['hasMany'](db[_0x68a1('0x63')],{'as':_0x68a1('0x177'),'foreignKey':_0x68a1('0x186')});db[_0x68a1('0x5f')][_0x68a1('0x11a')](db[_0x68a1('0x65')],{'as':'Messages','foreignKey':'OpenchannelAccountId'});db[_0x68a1('0x5f')][_0x68a1('0x11a')](db['OpenchannelApplication'],{'as':_0x68a1('0x178'),'foreignKey':'OpenchannelAccountId','onDelete':_0x68a1('0x114')});db['OpenchannelAccount'][_0x68a1('0x126')](db[_0x68a1('0x129')],{'as':_0x68a1('0x17a'),'foreignKey':_0x68a1('0x180')});db[_0x68a1('0x5f')][_0x68a1('0x126')](db[_0x68a1('0x17b')],{'as':'mandatoryDispositionPause','foreignKey':_0x68a1('0x154')});db[_0x68a1('0x5f')][_0x68a1('0x127')](db[_0x68a1('0x13')],{'as':'Agents','through':'user_has_openchannel_accounts'});db[_0x68a1('0x61')][_0x68a1('0x126')](db[_0x68a1('0x13')],{'onDelete':'restrict'});db[_0x68a1('0x61')][_0x68a1('0x126')](db[_0x68a1('0x66')],{'onDelete':_0x68a1('0x172'),'foreignKey':_0x68a1('0x187')});db[_0x68a1('0x61')][_0x68a1('0x126')](db[_0x68a1('0x5f')],{'onDelete':_0x68a1('0x172'),'foreignKey':_0x68a1('0x186')});db['OpenchannelApplication'][_0x68a1('0x126')](db[_0x68a1('0x151')],{'onDelete':_0x68a1('0x172'),'foreignKey':_0x68a1('0x152')});db[_0x68a1('0x61')][_0x68a1('0x126')](db[_0x68a1('0x90')],{'onDelete':_0x68a1('0x172'),'foreignKey':'TagId'});db[_0x68a1('0x63')][_0x68a1('0x11a')](db[_0x68a1('0x65')],{'as':_0x68a1('0x15a'),'onDelete':_0x68a1('0x114'),'foreignKey':'OpenchannelInteractionId'});db['OpenchannelInteraction'][_0x68a1('0x126')](db['OpenchannelAccount'],{'as':_0x68a1('0x168'),'foreignKey':'OpenchannelAccountId'});db[_0x68a1('0x63')][_0x68a1('0x126')](db[_0x68a1('0x77')],{'as':_0x68a1('0x169'),'foreignKey':_0x68a1('0x15e')});db[_0x68a1('0x63')][_0x68a1('0x126')](db[_0x68a1('0x13')],{'as':_0x68a1('0x16a'),'foreignKey':_0x68a1('0x115')});db[_0x68a1('0x63')][_0x68a1('0x127')](db[_0x68a1('0x90')],{'through':_0x68a1('0x188'),'as':'Tags'});db[_0x68a1('0x63')][_0x68a1('0x127')](db[_0x68a1('0x90')],{'through':_0x68a1('0x188'),'as':'ThroughTags'});db['OpenchannelInteraction'][_0x68a1('0x127')](db[_0x68a1('0x13')],{'as':_0x68a1('0x16d'),'through':_0x68a1('0x12e'),'foreignKey':'OpenchannelInteractionId'});db['OpenchannelMessage'][_0x68a1('0x126')](db[_0x68a1('0x13')],{'onDelete':'cascade','as':'User'});db[_0x68a1('0x65')][_0x68a1('0x126')](db[_0x68a1('0x77')],{'onDelete':_0x68a1('0x114'),'as':_0x68a1('0x169')});db[_0x68a1('0x65')][_0x68a1('0x126')](db[_0x68a1('0x63')],{'onDelete':_0x68a1('0x114'),'as':_0x68a1('0x16f'),'foreignKey':_0x68a1('0x189')});db[_0x68a1('0x65')]['belongsTo'](db[_0x68a1('0xeb')],{'as':'Attachment','foreignKey':_0x68a1('0x17f')});db[_0x68a1('0x65')][_0x68a1('0x126')](db[_0x68a1('0x5f')],{'as':_0x68a1('0x168'),'foreignKey':'OpenchannelAccountId'});db[_0x68a1('0x66')][_0x68a1('0x127')](db[_0x68a1('0x13')],{'as':_0x68a1('0x157'),'through':_0x68a1('0x136'),'foreignKey':_0x68a1('0x187')});db[_0x68a1('0x66')][_0x68a1('0x127')](db[_0x68a1('0xe3')],{'through':'team_has_openchannel_queues','as':_0x68a1('0x158')});db[_0x68a1('0x68')][_0x68a1('0x11a')](db[_0x68a1('0x86')],{'as':_0x68a1('0x164'),'foreignKey':_0x68a1('0x170'),'onDelete':'cascade'});db[_0x68a1('0x68')][_0x68a1('0x11a')](db[_0x68a1('0x85')],{'as':_0x68a1('0x165'),'foreignKey':'ChatWebsiteId'});db[_0x68a1('0x68')]['hasMany'](db[_0x68a1('0x74')],{'as':'ProactiveActions'});db[_0x68a1('0x68')][_0x68a1('0x11a')](db[_0x68a1('0x6d')],{'as':_0x68a1('0x177')});db[_0x68a1('0x68')]['hasMany'](db[_0x68a1('0x6b')],{'as':_0x68a1('0x178'),'foreignKey':_0x68a1('0x170'),'onDelete':_0x68a1('0x114')});db['ChatWebsite'][_0x68a1('0x11a')](db['ChatMessage'],{'as':_0x68a1('0x15a')});db[_0x68a1('0x68')]['belongsTo'](db[_0x68a1('0x129')],{'as':_0x68a1('0x17a'),'foreignKey':_0x68a1('0x180')});db['ChatWebsite'][_0x68a1('0x126')](db[_0x68a1('0x151')],{'as':'Interval','foreignKey':'IntervalId'});db[_0x68a1('0x68')][_0x68a1('0x126')](db['MailAccount'],{'as':_0x68a1('0x13d'),'foreignKey':_0x68a1('0x160')});db['ChatWebsite'][_0x68a1('0x126')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0x68a1('0x68')][_0x68a1('0x127')](db[_0x68a1('0x13')],{'as':_0x68a1('0x157'),'through':_0x68a1('0x13a')});db[_0x68a1('0x69')][_0x68a1('0x126')](db[_0x68a1('0x5f')],{});db[_0x68a1('0x69')][_0x68a1('0x126')](db[_0x68a1('0x129')],{'as':_0x68a1('0x17a'),'foreignKey':_0x68a1('0x180')});db['OpenchannelQueueReport']['belongsTo'](db[_0x68a1('0x77')],{'as':'Contact','foreignKey':_0x68a1('0x15e')});db['OpenchannelQueueReport'][_0x68a1('0x126')](db[_0x68a1('0x63')],{});db[_0x68a1('0x69')][_0x68a1('0x126')](db[_0x68a1('0x65')],{});db[_0x68a1('0x69')][_0x68a1('0x126')](db[_0x68a1('0x13')],{});db[_0x68a1('0x69')]['belongsTo'](db[_0x68a1('0x66')],{});db[_0x68a1('0x6b')]['belongsTo'](db[_0x68a1('0x13')],{'as':'Agent','foreignKey':_0x68a1('0x115'),'onDelete':_0x68a1('0x172')});db['ChatApplication'][_0x68a1('0x126')](db['ChatQueue'],{'as':_0x68a1('0x18a'),'foreignKey':_0x68a1('0x18b'),'onDelete':_0x68a1('0x172')});db[_0x68a1('0x6b')][_0x68a1('0x126')](db[_0x68a1('0x68')],{'as':_0x68a1('0x18c'),'foreignKey':_0x68a1('0x170'),'onDelete':_0x68a1('0x172')});db['ChatApplication'][_0x68a1('0x126')](db[_0x68a1('0x90')],{'onDelete':'restrict','foreignKey':_0x68a1('0x173')});db[_0x68a1('0x6d')][_0x68a1('0x11a')](db[_0x68a1('0x6f')],{'as':_0x68a1('0x15a'),'onDelete':_0x68a1('0x114'),'foreignKey':_0x68a1('0x18d')});db[_0x68a1('0x6d')][_0x68a1('0x126')](db[_0x68a1('0x68')],{'as':_0x68a1('0x168'),'foreignKey':_0x68a1('0x170')});db[_0x68a1('0x6d')][_0x68a1('0x126')](db[_0x68a1('0x77')],{'as':_0x68a1('0x169'),'foreignKey':_0x68a1('0x15e')});db[_0x68a1('0x6d')]['belongsTo'](db[_0x68a1('0x13')],{'as':_0x68a1('0x16a'),'foreignKey':_0x68a1('0x115')});db[_0x68a1('0x6d')]['belongsToMany'](db[_0x68a1('0x90')],{'through':'chat_interaction_has_tags','as':_0x68a1('0x16b')});db['ChatInteraction']['belongsToMany'](db[_0x68a1('0x90')],{'through':_0x68a1('0x18e'),'as':'ThroughTags'});db[_0x68a1('0x6d')][_0x68a1('0x127')](db[_0x68a1('0x13')],{'as':'Users','through':_0x68a1('0x12c'),'foreignKey':_0x68a1('0x18d')});db[_0x68a1('0x6f')][_0x68a1('0x126')](db[_0x68a1('0x13')],{'onDelete':_0x68a1('0x114'),'as':'User'});db[_0x68a1('0x6f')]['belongsTo'](db[_0x68a1('0x77')],{'onDelete':_0x68a1('0x114'),'as':'Contact','foreignKey':_0x68a1('0x15e')});db[_0x68a1('0x6f')][_0x68a1('0x126')](db[_0x68a1('0x6d')],{'onDelete':_0x68a1('0x114'),'as':_0x68a1('0x16f'),'foreignKey':_0x68a1('0x18d')});db['ChatMessage'][_0x68a1('0x126')](db[_0x68a1('0xeb')],{'as':_0x68a1('0xeb'),'foreignKey':_0x68a1('0x17f')});db[_0x68a1('0x6f')]['belongsTo'](db[_0x68a1('0x68')],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0x68a1('0x70')][_0x68a1('0x11a')](db[_0x68a1('0xeb')],{'as':'Attachments','foreignKey':_0x68a1('0x171'),'onDelete':_0x68a1('0x114'),'hooks':!![]});db[_0x68a1('0x70')][_0x68a1('0x126')](db[_0x68a1('0x77')],{'onDelete':_0x68a1('0x114'),'as':_0x68a1('0x169'),'foreignKey':_0x68a1('0x15e')});db[_0x68a1('0x70')][_0x68a1('0x126')](db[_0x68a1('0x68')],{'as':_0x68a1('0x168'),'foreignKey':_0x68a1('0x170')});db[_0x68a1('0x132')][_0x68a1('0x127')](db[_0x68a1('0x13')],{'as':_0x68a1('0x157'),'through':_0x68a1('0x32'),'hooks':!![]});db['ChatQueue'][_0x68a1('0x127')](db[_0x68a1('0xe3')],{'through':_0x68a1('0x18f'),'as':'Teams'});db['ChatGroup']['hasMany'](db[_0x68a1('0x190')],{'as':'Messages','foreignKey':_0x68a1('0x191'),'onDelete':_0x68a1('0x114')});db[_0x68a1('0x72')]['belongsToMany'](db[_0x68a1('0x13')],{'as':'Members','through':_0x68a1('0x128')});db[_0x68a1('0x74')][_0x68a1('0x126')](db[_0x68a1('0x68')],{'as':_0x68a1('0x18c'),'foreignKey':'ChatWebsiteId'});db[_0x68a1('0x192')][_0x68a1('0x11a')](db[_0x68a1('0x77')],{'as':_0x68a1('0x193'),'foreignKey':'CompanyId'});db[_0x68a1('0x77')]['hasMany'](db[_0x68a1('0x94')],{'as':_0x68a1('0x194'),'foreignKey':'CmContactId'});db[_0x68a1('0x77')][_0x68a1('0x11a')](db[_0x68a1('0x79')],{'as':_0x68a1('0x149'),'foreignKey':_0x68a1('0x15e')});db['CmContact']['hasMany'](db[_0x68a1('0x11d')],{'as':_0x68a1('0x195'),'foreignKey':_0x68a1('0x15e')});db[_0x68a1('0x77')][_0x68a1('0x11a')](db['CmHopperHistory'],{'as':_0x68a1('0x14a'),'foreignKey':_0x68a1('0x15e')});db[_0x68a1('0x77')][_0x68a1('0x11a')](db['ReportAgentPreview'],{'as':_0x68a1('0x80'),'foreignKey':_0x68a1('0x15e')});db['CmContact'][_0x68a1('0x11a')](db[_0x68a1('0x14c')],{'as':'JscriptySessions','foreignKey':_0x68a1('0x15e')});db[_0x68a1('0x77')][_0x68a1('0x11a')](db['OpenchannelInteraction'],{'as':'OpenchannelInteractions','foreignKey':'ContactId','onDelete':'restrict'});db[_0x68a1('0x77')][_0x68a1('0x11a')](db[_0x68a1('0x6d')],{'as':'ChatInteractions','foreignKey':_0x68a1('0x15e'),'onDelete':_0x68a1('0x172')});db[_0x68a1('0x77')][_0x68a1('0x11a')](db[_0x68a1('0x59')],{'as':_0x68a1('0x120'),'foreignKey':_0x68a1('0x15e'),'onDelete':_0x68a1('0x172')});db[_0x68a1('0x77')][_0x68a1('0x11a')](db[_0x68a1('0x50')],{'as':_0x68a1('0x121'),'foreignKey':_0x68a1('0x15e'),'onDelete':_0x68a1('0x172')});db[_0x68a1('0x77')]['hasMany'](db[_0x68a1('0x44')],{'as':_0x68a1('0x122'),'foreignKey':_0x68a1('0x15e'),'onDelete':_0x68a1('0x172')});db[_0x68a1('0x77')]['belongsTo'](db[_0x68a1('0x192')],{'as':_0x68a1('0x196'),'foreignKey':'CompanyId'});db['CmContact'][_0x68a1('0x126')](db[_0x68a1('0x129')],{'as':_0x68a1('0x17a'),'foreignKey':'ListId','onDelete':_0x68a1('0x114')});db['CmContact'][_0x68a1('0x127')](db[_0x68a1('0x13')],{'as':_0x68a1('0x16d'),'through':_0x68a1('0x197')});db['CmContact'][_0x68a1('0x127')](db[_0x68a1('0x90')],{'as':'Tags','through':_0x68a1('0x198')});db[_0x68a1('0x77')][_0x68a1('0x127')](db[_0x68a1('0x90')],{'through':_0x68a1('0x198'),'as':_0x68a1('0x17e')});db[_0x68a1('0x79')][_0x68a1('0x11a')](db['CmHopperAdditionalPhone'],{'as':'AdditionalPhones','foreignKey':_0x68a1('0x199')});db[_0x68a1('0x79')][_0x68a1('0x126')](db[_0x68a1('0x77')],{'as':_0x68a1('0x169'),'foreignKey':'ContactId','onDelete':_0x68a1('0x114')});db[_0x68a1('0x79')][_0x68a1('0x126')](db[_0x68a1('0x129')],{'as':_0x68a1('0x17a'),'foreignKey':_0x68a1('0x180'),'onDelete':_0x68a1('0x114')});db[_0x68a1('0x79')][_0x68a1('0x126')](db['User'],{'as':_0x68a1('0x19a'),'foreignKey':'UserId'});db[_0x68a1('0x79')][_0x68a1('0x126')](db['VoiceQueue'],{'as':_0x68a1('0x18a'),'foreignKey':_0x68a1('0x148'),'onDelete':_0x68a1('0x114')});db['CmHopper']['belongsTo'](db[_0x68a1('0xe7')],{'as':_0x68a1('0xe7'),'foreignKey':_0x68a1('0x19b'),'onDelete':_0x68a1('0x114')});db[_0x68a1('0x79')]['belongsTo'](db['User'],{'as':_0x68a1('0x16a'),'foreignKey':_0x68a1('0x19c')});db[_0x68a1('0x7b')][_0x68a1('0x126')](db[_0x68a1('0x77')],{'as':'Contact','foreignKey':_0x68a1('0x15e'),'onDelete':_0x68a1('0x114')});db[_0x68a1('0x7b')]['belongsTo'](db[_0x68a1('0x129')],{'as':_0x68a1('0x17a'),'foreignKey':'ListId','onDelete':_0x68a1('0x114')});db[_0x68a1('0x7b')][_0x68a1('0x126')](db[_0x68a1('0x1c')],{'as':_0x68a1('0x18a'),'foreignKey':_0x68a1('0x148'),'onDelete':'cascade'});db[_0x68a1('0x7b')][_0x68a1('0x126')](db['Campaign'],{'as':_0x68a1('0xe7'),'foreignKey':_0x68a1('0x19b'),'onDelete':_0x68a1('0x114')});db[_0x68a1('0x84')]['hasMany'](db[_0x68a1('0x19d')],{'as':{'plural':'All','singular':_0x68a1('0x19e')},'foreignKey':_0x68a1('0x19f'),'onDelete':_0x68a1('0x114'),'hooks':!![]});db[_0x68a1('0x84')][_0x68a1('0x11a')](db['Condition'],{'as':{'plural':_0x68a1('0x1a0'),'singular':_0x68a1('0x1a1')},'foreignKey':_0x68a1('0x1a2'),'onDelete':_0x68a1('0x114'),'hooks':!![]});db[_0x68a1('0x84')][_0x68a1('0x11a')](db[_0x68a1('0x82')],{'as':'Actions','foreignKey':_0x68a1('0x1a3'),'onDelete':_0x68a1('0x114'),'hooks':!![]});db['Disposition'][_0x68a1('0x11a')](db[_0x68a1('0x86')],{'as':_0x68a1('0x164'),'foreignKey':_0x68a1('0x1a4'),'onDelete':_0x68a1('0x114')});db[_0x68a1('0x151')]['hasMany'](db[_0x68a1('0x151')],{'as':_0x68a1('0x1a5'),'foreignKey':'IntervalId','onDelete':'cascade','hooks':!![],'required':![]});db['Interval'][_0x68a1('0x11a')](db['VoiceExtension'],{'as':_0x68a1('0x11c'),'foreignKey':_0x68a1('0x152'),'onDelete':_0x68a1('0x172')});db[_0x68a1('0x151')][_0x68a1('0x11a')](db[_0x68a1('0x47')],{'as':_0x68a1('0x1a6'),'foreignKey':_0x68a1('0x152')});db[_0x68a1('0x151')]['hasMany'](db['ChatApplication'],{'as':_0x68a1('0x1a7'),'foreignKey':_0x68a1('0x152')});db['Interval']['hasMany'](db[_0x68a1('0x4e')],{'as':_0x68a1('0x1a8'),'foreignKey':_0x68a1('0x152')});db[_0x68a1('0x151')][_0x68a1('0x11a')](db['SmsApplication'],{'as':_0x68a1('0x1a9'),'foreignKey':_0x68a1('0x152')});db[_0x68a1('0x8c')][_0x68a1('0x126')](db[_0x68a1('0x13d')],{});db[_0x68a1('0x8c')][_0x68a1('0x126')](db['AnalyticDefaultReport'],{'foreignKey':_0x68a1('0x1aa')});db[_0x68a1('0x8c')]['belongsTo'](db[_0x68a1('0x9b')],{'foreignKey':_0x68a1('0x1ab')});db[_0x68a1('0x8e')][_0x68a1('0x127')](db[_0x68a1('0x1ac')],{'as':_0x68a1('0x1ad'),'through':_0x68a1('0x146'),'onDelete':_0x68a1('0x172')});db[_0x68a1('0x90')][_0x68a1('0x127')](db[_0x68a1('0x77')],{'through':_0x68a1('0x198')});db[_0x68a1('0x90')][_0x68a1('0x127')](db[_0x68a1('0x6d')],{'through':_0x68a1('0x18e')});db['Tag'][_0x68a1('0x127')](db[_0x68a1('0x44')],{'through':_0x68a1('0x16c')});db[_0x68a1('0x90')][_0x68a1('0x127')](db[_0x68a1('0x59')],{'through':_0x68a1('0x183')});db['Tag'][_0x68a1('0x127')](db[_0x68a1('0x50')],{'through':_0x68a1('0x17d')});db['Tag'][_0x68a1('0x127')](db['OpenchannelInteraction'],{'through':'openchannel_interaction_has_tags'});db[_0x68a1('0x90')]['belongsToMany'](db[_0x68a1('0x102')],{'through':_0x68a1('0x1ae')});db['CmContactHasItem'][_0x68a1('0x126')](db[_0x68a1('0x92')],{'as':_0x68a1('0x1af'),'foreignKey':_0x68a1('0x1b0')});db[_0x68a1('0x1b1')]['belongsTo'](db[_0x68a1('0x79')],{'as':_0x68a1('0x1b2'),'foreignKey':_0x68a1('0x199')});db[_0x68a1('0x94')]['belongsTo'](db[_0x68a1('0x77')],{'as':_0x68a1('0x169'),'foreignKey':_0x68a1('0x1b3')});db['Trigger'][_0x68a1('0x11a')](db[_0x68a1('0x19d')],{'as':{'plural':_0x68a1('0x1b4'),'singular':_0x68a1('0x1b5')},'foreignKey':_0x68a1('0x1b6'),'onDelete':_0x68a1('0x114'),'hooks':!![]});db['Trigger']['hasMany'](db[_0x68a1('0x19d')],{'as':{'plural':_0x68a1('0x1b7'),'singular':_0x68a1('0x1b8')},'foreignKey':_0x68a1('0x1b9'),'onDelete':_0x68a1('0x114'),'hooks':!![]});db[_0x68a1('0x1ba')]['hasMany'](db[_0x68a1('0x82')],{'as':'Actions','foreignKey':_0x68a1('0x1bb'),'onDelete':'cascade','hooks':!![]});db[_0x68a1('0x9b')][_0x68a1('0x11a')](db[_0x68a1('0xa2')],{'as':_0x68a1('0x1bc'),'onDelete':_0x68a1('0x114'),'foreignKey':_0x68a1('0x1ab'),'hooks':!![]});db[_0x68a1('0x9d')][_0x68a1('0x11a')](db[_0x68a1('0xa2')],{'as':_0x68a1('0x1bc'),'onDelete':_0x68a1('0x114'),'foreignKey':_0x68a1('0x1aa')});db[_0x68a1('0x1bd')][_0x68a1('0x11a')](db[_0x68a1('0xa2')],{'as':'Fields','onDelete':_0x68a1('0x114'),'foreignKey':_0x68a1('0x1be')});db[_0x68a1('0xa2')][_0x68a1('0x126')](db[_0x68a1('0x1bd')],{'foreignKey':_0x68a1('0x1be')});db['SalesforceAccount'][_0x68a1('0x11a')](db[_0x68a1('0x1bf')],{'as':_0x68a1('0x1c0'),'onDelete':'cascade','foreignKey':_0x68a1('0x1c1')});db[_0x68a1('0x1bf')]['hasMany'](db[_0x68a1('0xa6')],{'as':'Subjects','onDelete':_0x68a1('0x114'),'foreignKey':_0x68a1('0x1c2')});db[_0x68a1('0x1bf')][_0x68a1('0x11a')](db[_0x68a1('0xa6')],{'as':'Descriptions','onDelete':_0x68a1('0x114'),'foreignKey':'DescriptionId'});db[_0x68a1('0x1bf')]['hasMany'](db['SalesforceField'],{'as':_0x68a1('0x1bc'),'onDelete':'cascade','foreignKey':_0x68a1('0x1c3')});db['SalesforceConfiguration']['belongsTo'](db['SalesforceAccount'],{'as':_0x68a1('0x168'),'foreignKey':_0x68a1('0x1c1')});db[_0x68a1('0xa6')][_0x68a1('0x11a')](db[_0x68a1('0xa6')],{'as':'Subject','foreignKey':_0x68a1('0x1c2')});db[_0x68a1('0xa6')][_0x68a1('0x11a')](db[_0x68a1('0xa6')],{'as':_0x68a1('0x1c4'),'foreignKey':'DescriptionId'});db[_0x68a1('0xa6')][_0x68a1('0x11a')](db[_0x68a1('0xa6')],{'as':_0x68a1('0x1c5'),'foreignKey':_0x68a1('0x1c3')});db[_0x68a1('0xa6')][_0x68a1('0x126')](db[_0x68a1('0x1c6')],{'as':_0x68a1('0x1c6'),'foreignKey':'VariableId'});db['SugarcrmAccount'][_0x68a1('0x11a')](db[_0x68a1('0xaa')],{'as':_0x68a1('0x1c0'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0x68a1('0xaa')][_0x68a1('0x11a')](db[_0x68a1('0xac')],{'as':_0x68a1('0x1c7'),'onDelete':_0x68a1('0x114'),'foreignKey':_0x68a1('0x1c2')});db['SugarcrmConfiguration'][_0x68a1('0x11a')](db[_0x68a1('0xac')],{'as':_0x68a1('0x1c8'),'onDelete':'cascade','foreignKey':_0x68a1('0x1c9')});db[_0x68a1('0xaa')][_0x68a1('0x11a')](db[_0x68a1('0xac')],{'as':_0x68a1('0x1bc'),'onDelete':'cascade','foreignKey':_0x68a1('0x1c3')});db[_0x68a1('0xaa')][_0x68a1('0x126')](db['SugarcrmAccount'],{'as':_0x68a1('0x168'),'foreignKey':_0x68a1('0x1c1')});db[_0x68a1('0xac')][_0x68a1('0x11a')](db[_0x68a1('0xac')],{'as':_0x68a1('0x1ca'),'foreignKey':_0x68a1('0x1c2')});db[_0x68a1('0xac')][_0x68a1('0x11a')](db[_0x68a1('0xac')],{'as':_0x68a1('0x1c4'),'foreignKey':'DescriptionId'});db[_0x68a1('0xac')]['hasMany'](db['SugarcrmField'],{'as':_0x68a1('0x1c5'),'foreignKey':_0x68a1('0x1c3')});db[_0x68a1('0xac')][_0x68a1('0x126')](db[_0x68a1('0x1c6')],{'as':_0x68a1('0x1c6'),'foreignKey':_0x68a1('0x1cb')});db[_0x68a1('0xad')][_0x68a1('0x11a')](db[_0x68a1('0xaf')],{'as':_0x68a1('0x1c0'),'onDelete':'cascade','foreignKey':_0x68a1('0x1c1')});db[_0x68a1('0xaf')][_0x68a1('0x11a')](db['DeskField'],{'as':'Subjects','onDelete':_0x68a1('0x114'),'foreignKey':_0x68a1('0x1c2')});db[_0x68a1('0xaf')][_0x68a1('0x11a')](db[_0x68a1('0xb1')],{'as':_0x68a1('0x1c8'),'onDelete':_0x68a1('0x114'),'foreignKey':_0x68a1('0x1c9')});db[_0x68a1('0xaf')][_0x68a1('0x11a')](db[_0x68a1('0xb1')],{'as':'Fields','onDelete':_0x68a1('0x114'),'foreignKey':_0x68a1('0x1c3')});db['DeskConfiguration']['belongsTo'](db['DeskAccount'],{'as':_0x68a1('0x168'),'foreignKey':_0x68a1('0x1c1')});db[_0x68a1('0xaf')][_0x68a1('0x127')](db[_0x68a1('0x90')],{'through':'int_desk_configuration_has_tags'});db[_0x68a1('0xb1')][_0x68a1('0x11a')](db['DeskField'],{'as':_0x68a1('0x1ca'),'foreignKey':_0x68a1('0x1c2')});db['DeskField'][_0x68a1('0x11a')](db['DeskField'],{'as':_0x68a1('0x1c4'),'foreignKey':_0x68a1('0x1c9')});db['DeskField'][_0x68a1('0x11a')](db[_0x68a1('0xb1')],{'as':_0x68a1('0x1c5'),'foreignKey':_0x68a1('0x1c3')});db[_0x68a1('0xb1')]['belongsTo'](db[_0x68a1('0x1c6')],{'as':_0x68a1('0x1c6'),'foreignKey':_0x68a1('0x1cb')});db[_0x68a1('0xb3')][_0x68a1('0x11a')](db[_0x68a1('0x1cc')],{'as':_0x68a1('0x1c0'),'onDelete':_0x68a1('0x114'),'foreignKey':_0x68a1('0x1c1')});db[_0x68a1('0x1cc')][_0x68a1('0x11a')](db[_0x68a1('0xb6')],{'as':_0x68a1('0x1c7'),'onDelete':'cascade','foreignKey':_0x68a1('0x1c2')});db[_0x68a1('0x1cc')][_0x68a1('0x11a')](db[_0x68a1('0xb6')],{'as':_0x68a1('0x1c8'),'onDelete':_0x68a1('0x114'),'foreignKey':_0x68a1('0x1c9')});db[_0x68a1('0x1cc')][_0x68a1('0x11a')](db[_0x68a1('0xb6')],{'as':_0x68a1('0x1bc'),'onDelete':_0x68a1('0x114'),'foreignKey':'FieldId'});db[_0x68a1('0x1cc')]['belongsTo'](db[_0x68a1('0xb3')],{'as':_0x68a1('0x168'),'foreignKey':'AccountId'});db[_0x68a1('0xb6')]['hasMany'](db['ZohoField'],{'as':_0x68a1('0x1ca'),'foreignKey':_0x68a1('0x1c2')});db[_0x68a1('0xb6')][_0x68a1('0x11a')](db['ZohoField'],{'as':'Description','foreignKey':_0x68a1('0x1c9')});db[_0x68a1('0xb6')][_0x68a1('0x11a')](db[_0x68a1('0xb6')],{'as':'Field','foreignKey':_0x68a1('0x1c3')});db['ZohoField']['belongsTo'](db[_0x68a1('0x1c6')],{'as':_0x68a1('0x1c6'),'foreignKey':_0x68a1('0x1cb')});db[_0x68a1('0xb8')][_0x68a1('0x11a')](db['ZendeskConfiguration'],{'as':'Configurations','onDelete':_0x68a1('0x114'),'foreignKey':_0x68a1('0x1c1')});db[_0x68a1('0xba')]['hasMany'](db[_0x68a1('0x1cd')],{'as':_0x68a1('0x1c7'),'foreignKey':_0x68a1('0x1c2')});db[_0x68a1('0xba')][_0x68a1('0x11a')](db[_0x68a1('0x1cd')],{'as':_0x68a1('0x1c8'),'foreignKey':_0x68a1('0x1c9')});db[_0x68a1('0xba')]['hasMany'](db[_0x68a1('0x1cd')],{'as':_0x68a1('0x1bc'),'foreignKey':'FieldId'});db['ZendeskConfiguration'][_0x68a1('0x126')](db[_0x68a1('0xb8')],{'as':'Account','foreignKey':_0x68a1('0x1c1')});db['ZendeskConfiguration'][_0x68a1('0x127')](db[_0x68a1('0x90')],{'through':'int_zendesk_configuration_has_tags'});db['ZendeskField'][_0x68a1('0x11a')](db[_0x68a1('0x1cd')],{'as':_0x68a1('0x1ca'),'foreignKey':_0x68a1('0x1c2')});db[_0x68a1('0x1cd')][_0x68a1('0x11a')](db[_0x68a1('0x1cd')],{'as':_0x68a1('0x1c4'),'foreignKey':_0x68a1('0x1c9')});db['ZendeskField']['hasMany'](db[_0x68a1('0x1cd')],{'as':_0x68a1('0x1c5'),'foreignKey':'FieldId'});db[_0x68a1('0x1cd')][_0x68a1('0x126')](db[_0x68a1('0x1c6')],{'as':_0x68a1('0x1c6'),'foreignKey':'VariableId'});db['FreshdeskAccount'][_0x68a1('0x11a')](db['FreshdeskConfiguration'],{'as':_0x68a1('0x1c0'),'onDelete':_0x68a1('0x114'),'foreignKey':_0x68a1('0x1c1')});db[_0x68a1('0xbe')][_0x68a1('0x11a')](db['FreshdeskField'],{'as':_0x68a1('0x1c7'),'onDelete':'cascade','foreignKey':_0x68a1('0x1c2')});db['FreshdeskConfiguration'][_0x68a1('0x11a')](db[_0x68a1('0x1ce')],{'as':_0x68a1('0x1c8'),'onDelete':_0x68a1('0x114'),'foreignKey':_0x68a1('0x1c9')});db[_0x68a1('0xbe')][_0x68a1('0x11a')](db[_0x68a1('0x1ce')],{'as':_0x68a1('0x1bc'),'onDelete':_0x68a1('0x114'),'foreignKey':_0x68a1('0x1c3')});db[_0x68a1('0xbe')][_0x68a1('0x126')](db['FreshdeskAccount'],{'as':'Account','foreignKey':_0x68a1('0x1c1')});db[_0x68a1('0xbe')][_0x68a1('0x127')](db['Tag'],{'through':_0x68a1('0x1cf')});db[_0x68a1('0x1ce')][_0x68a1('0x11a')](db[_0x68a1('0x1ce')],{'as':_0x68a1('0x1ca'),'foreignKey':_0x68a1('0x1c2')});db[_0x68a1('0x1ce')][_0x68a1('0x11a')](db['FreshdeskField'],{'as':_0x68a1('0x1c4'),'foreignKey':_0x68a1('0x1c9')});db['FreshdeskField'][_0x68a1('0x11a')](db[_0x68a1('0x1ce')],{'as':'Field','foreignKey':_0x68a1('0x1c3')});db['FreshdeskField']['belongsTo'](db['Variable'],{'as':_0x68a1('0x1c6'),'foreignKey':_0x68a1('0x1cb')});db[_0x68a1('0xc1')][_0x68a1('0x11a')](db[_0x68a1('0xc3')],{'as':_0x68a1('0x1c0'),'onDelete':'cascade','foreignKey':_0x68a1('0x1c1')});db['VtigerConfiguration'][_0x68a1('0x11a')](db[_0x68a1('0xc5')],{'as':'Subjects','foreignKey':_0x68a1('0x1c2')});db[_0x68a1('0xc3')]['hasMany'](db['VtigerField'],{'as':_0x68a1('0x1c8'),'foreignKey':_0x68a1('0x1c9')});db['VtigerConfiguration'][_0x68a1('0x11a')](db[_0x68a1('0xc5')],{'as':_0x68a1('0x1bc'),'foreignKey':_0x68a1('0x1c3')});db[_0x68a1('0xc3')]['belongsTo'](db['VtigerAccount'],{'as':_0x68a1('0x168'),'foreignKey':_0x68a1('0x1c1')});db['VtigerField'][_0x68a1('0x11a')](db['VtigerField'],{'as':_0x68a1('0x1ca'),'foreignKey':_0x68a1('0x1c2')});db[_0x68a1('0xc5')]['hasMany'](db[_0x68a1('0xc5')],{'as':'Description','foreignKey':_0x68a1('0x1c9')});db[_0x68a1('0xc5')][_0x68a1('0x11a')](db[_0x68a1('0xc5')],{'as':_0x68a1('0x1c5'),'foreignKey':'FieldId'});db['VtigerField']['belongsTo'](db[_0x68a1('0x1c6')],{'as':'Variable','foreignKey':_0x68a1('0x1cb')});db[_0x68a1('0xc7')][_0x68a1('0x11a')](db[_0x68a1('0xc9')],{'as':_0x68a1('0x1c0'),'onDelete':_0x68a1('0x114'),'foreignKey':_0x68a1('0x1c1')});db[_0x68a1('0xc9')][_0x68a1('0x11a')](db[_0x68a1('0x1d0')],{'as':'Subjects','foreignKey':_0x68a1('0x1c2')});db['ServicenowConfiguration'][_0x68a1('0x11a')](db[_0x68a1('0x1d0')],{'as':_0x68a1('0x1c8'),'foreignKey':_0x68a1('0x1c9')});db[_0x68a1('0xc9')][_0x68a1('0x11a')](db[_0x68a1('0x1d0')],{'as':'Fields','foreignKey':_0x68a1('0x1c3')});db[_0x68a1('0xc9')][_0x68a1('0x126')](db[_0x68a1('0xc7')],{'as':_0x68a1('0x168'),'foreignKey':_0x68a1('0x1c1')});db[_0x68a1('0x1d0')][_0x68a1('0x11a')](db[_0x68a1('0x1d0')],{'as':_0x68a1('0x1ca'),'foreignKey':'SubjectId'});db[_0x68a1('0x1d0')][_0x68a1('0x11a')](db[_0x68a1('0x1d0')],{'as':'Description','foreignKey':_0x68a1('0x1c9')});db[_0x68a1('0x1d0')][_0x68a1('0x11a')](db[_0x68a1('0x1d0')],{'as':'Field','foreignKey':_0x68a1('0x1c3')});db[_0x68a1('0x1d0')][_0x68a1('0x126')](db[_0x68a1('0x1c6')],{'as':_0x68a1('0x1c6'),'foreignKey':_0x68a1('0x1cb')});db['Dynamics365Account'][_0x68a1('0x11a')](db['Dynamics365Configuration'],{'as':_0x68a1('0x1c0'),'onDelete':_0x68a1('0x114'),'foreignKey':_0x68a1('0x1c1')});db['Dynamics365Account'][_0x68a1('0x126')](db[_0x68a1('0x10a')],{'as':_0x68a1('0x10a'),'foreignKey':_0x68a1('0x161')});db[_0x68a1('0x1d1')][_0x68a1('0x11a')](db[_0x68a1('0xce')],{'as':'Subjects','onDelete':_0x68a1('0x114'),'foreignKey':'SubjectId'});db['Dynamics365Configuration'][_0x68a1('0x11a')](db['Dynamics365Field'],{'as':_0x68a1('0x1c8'),'onDelete':_0x68a1('0x114'),'foreignKey':_0x68a1('0x1c9')});db[_0x68a1('0x1d1')][_0x68a1('0x11a')](db['Dynamics365Field'],{'as':'Fields','onDelete':_0x68a1('0x114'),'foreignKey':_0x68a1('0x1c3')});db[_0x68a1('0x1d1')][_0x68a1('0x126')](db[_0x68a1('0xcc')],{'as':_0x68a1('0x168'),'foreignKey':_0x68a1('0x1c1')});db[_0x68a1('0xce')][_0x68a1('0x11a')](db['Dynamics365Field'],{'as':_0x68a1('0x1ca'),'foreignKey':'SubjectId'});db['Dynamics365Field'][_0x68a1('0x11a')](db[_0x68a1('0xce')],{'as':_0x68a1('0x1c4'),'foreignKey':'DescriptionId'});db[_0x68a1('0xce')][_0x68a1('0x11a')](db[_0x68a1('0xce')],{'as':_0x68a1('0x1c5'),'foreignKey':'FieldId'});db[_0x68a1('0xce')][_0x68a1('0x126')](db['Variable'],{'as':_0x68a1('0x1c6'),'foreignKey':_0x68a1('0x1cb')});db[_0x68a1('0x1d2')]['hasMany'](db[_0x68a1('0xd0')],{'as':_0x68a1('0x1c0'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0x68a1('0xd0')][_0x68a1('0x11a')](db['FreshsalesField'],{'as':_0x68a1('0x1c7'),'foreignKey':_0x68a1('0x1c2')});db[_0x68a1('0xd0')]['hasMany'](db[_0x68a1('0xd2')],{'as':_0x68a1('0x1c8'),'foreignKey':_0x68a1('0x1c9')});db['FreshsalesConfiguration'][_0x68a1('0x11a')](db['FreshsalesField'],{'as':'Fields','foreignKey':_0x68a1('0x1c3')});db[_0x68a1('0xd0')][_0x68a1('0x126')](db['FreshsalesAccount'],{'as':_0x68a1('0x168'),'foreignKey':_0x68a1('0x1c1')});db[_0x68a1('0xd2')][_0x68a1('0x11a')](db[_0x68a1('0xd2')],{'as':_0x68a1('0x1ca'),'foreignKey':'SubjectId'});db[_0x68a1('0xd2')][_0x68a1('0x11a')](db[_0x68a1('0xd2')],{'as':_0x68a1('0x1c4'),'foreignKey':_0x68a1('0x1c9')});db['FreshsalesField']['hasMany'](db[_0x68a1('0xd2')],{'as':_0x68a1('0x1c5'),'foreignKey':'FieldId'});db[_0x68a1('0xd2')][_0x68a1('0x126')](db[_0x68a1('0x1c6')],{'as':_0x68a1('0x1c6'),'foreignKey':_0x68a1('0x1cb')});db[_0x68a1('0xd5')][_0x68a1('0x126')](db[_0x68a1('0x68')],{});db[_0x68a1('0xd5')][_0x68a1('0x126')](db[_0x68a1('0x129')],{'as':_0x68a1('0x17a'),'foreignKey':_0x68a1('0x180')});db[_0x68a1('0xd5')][_0x68a1('0x126')](db[_0x68a1('0x77')],{'as':'Contact','foreignKey':_0x68a1('0x15e')});db['ChatQueueReport'][_0x68a1('0x126')](db[_0x68a1('0x6d')],{});db[_0x68a1('0xd5')][_0x68a1('0x126')](db[_0x68a1('0x6f')],{});db[_0x68a1('0xd5')][_0x68a1('0x126')](db[_0x68a1('0x13')],{});db['ChatQueueReport'][_0x68a1('0x126')](db[_0x68a1('0x132')],{});db[_0x68a1('0x190')]['belongsTo'](db[_0x68a1('0x13')],{'onDelete':_0x68a1('0x114'),'foreignKey':_0x68a1('0x1d3')});db[_0x68a1('0x190')]['belongsTo'](db[_0x68a1('0x13')],{'onDelete':_0x68a1('0x114'),'foreignKey':'ToId'});db[_0x68a1('0x14c')][_0x68a1('0x11a')](db[_0x68a1('0x1d4')],{'foreignKey':_0x68a1('0x1d5'),'onDelete':'cascade'});db['JscriptySessionReport'][_0x68a1('0x11a')](db['JscriptyAnswerReport'],{'foreignKey':_0x68a1('0x1d5'),'onDelete':_0x68a1('0x114')});db[_0x68a1('0xd8')][_0x68a1('0x126')](db['SmsAccount'],{});db[_0x68a1('0xd8')][_0x68a1('0x126')](db['CmList'],{'as':'List','foreignKey':_0x68a1('0x180')});db[_0x68a1('0xd8')]['belongsTo'](db[_0x68a1('0x77')],{'as':'Contact','foreignKey':_0x68a1('0x15e')});db[_0x68a1('0xd8')]['belongsTo'](db['SmsInteraction'],{});db[_0x68a1('0xd8')][_0x68a1('0x126')](db[_0x68a1('0x5b')],{});db['SmsQueueReport'][_0x68a1('0x126')](db[_0x68a1('0x13')],{});db[_0x68a1('0xd8')][_0x68a1('0x126')](db[_0x68a1('0x5d')],{});db['JscriptyProject'][_0x68a1('0x11a')](db[_0x68a1('0x14c')],{'foreignKey':'ProjectId'});db['JscriptyProject'][_0x68a1('0x11a')](db['JscriptyQuestionReport'],{'foreignKey':'ProjectId'});db[_0x68a1('0x1d6')][_0x68a1('0x11a')](db[_0x68a1('0x1d7')],{'foreignKey':'ProjectId'});db[_0x68a1('0xe3')]['belongsToMany'](db['User'],{'as':_0x68a1('0x157'),'through':_0x68a1('0x12a')});db[_0x68a1('0xe3')][_0x68a1('0x127')](db[_0x68a1('0x1c')],{'through':_0x68a1('0x10c'),'as':_0x68a1('0x12f')});db['Team'][_0x68a1('0x127')](db['MailQueue'],{'through':_0x68a1('0x167'),'as':_0x68a1('0x131')});db[_0x68a1('0xe3')][_0x68a1('0x127')](db['ChatQueue'],{'through':'team_has_chat_queues','as':_0x68a1('0x1d8')});db[_0x68a1('0xe3')][_0x68a1('0x127')](db[_0x68a1('0x133')],{'through':_0x68a1('0x1d9'),'as':'FaxQueues'});db['Team'][_0x68a1('0x127')](db[_0x68a1('0x5d')],{'through':'team_has_sms_queues','as':_0x68a1('0x135')});db[_0x68a1('0xe3')]['belongsToMany'](db[_0x68a1('0x66')],{'through':'team_has_openchannel_queues','as':_0x68a1('0x1da')});db[_0x68a1('0xe3')][_0x68a1('0x127')](db[_0x68a1('0x109')],{'through':_0x68a1('0x1db'),'as':_0x68a1('0x137')});db['Team'][_0x68a1('0x127')](db[_0x68a1('0xf5')],{'through':_0x68a1('0x10e'),'as':_0x68a1('0x130')});db['Campaign']['hasMany'](db[_0x68a1('0x79')],{'as':_0x68a1('0x149'),'foreignKey':_0x68a1('0x19b')});db[_0x68a1('0xe7')]['hasMany'](db[_0x68a1('0x11d')],{'as':_0x68a1('0x195'),'foreignKey':'CampaignId'});db['Campaign'][_0x68a1('0x11a')](db[_0x68a1('0x7e')],{'as':_0x68a1('0x14a'),'foreignKey':_0x68a1('0x19b')});db['Campaign'][_0x68a1('0x11a')](db['CmHopperBlack'],{'as':_0x68a1('0x14b'),'foreignKey':'CampaignId'});db[_0x68a1('0xe7')]['belongsTo'](db[_0x68a1('0x2c')],{'as':'Trunk','foreignKey':_0x68a1('0x14e')});db['Campaign'][_0x68a1('0x126')](db['Trunk'],{'as':_0x68a1('0x14f'),'foreignKey':_0x68a1('0x150')});db[_0x68a1('0xe7')][_0x68a1('0x126')](db['Interval'],{'as':'Interval','foreignKey':'IntervalId'});db[_0x68a1('0xe7')][_0x68a1('0x126')](db[_0x68a1('0x1dc')],{'as':_0x68a1('0x1dc'),'foreignKey':_0x68a1('0x1dd')});db[_0x68a1('0xe7')][_0x68a1('0x127')](db[_0x68a1('0x129')],{'as':_0x68a1('0x155'),'through':'campaigns_has_cm_lists'});db[_0x68a1('0xe7')][_0x68a1('0x127')](db[_0x68a1('0x129')],{'as':_0x68a1('0x1de'),'through':_0x68a1('0x1df')});db[_0x68a1('0xeb')][_0x68a1('0x126')](db[_0x68a1('0x70')],{'as':'ChatOfflineMessage','foreignKey':_0x68a1('0x171')});db[_0x68a1('0xef')][_0x68a1('0x126')](db[_0x68a1('0x45')],{});db[_0x68a1('0xef')]['belongsTo'](db[_0x68a1('0x44')],{});db[_0x68a1('0xef')][_0x68a1('0x126')](db[_0x68a1('0x13d')],{'foreignKey':_0x68a1('0x1e0'),'as':_0x68a1('0x1e1')});db['MailTransferReport'][_0x68a1('0x126')](db['User'],{'foreignKey':_0x68a1('0x1e2'),'as':_0x68a1('0x1e3')});db[_0x68a1('0xef')][_0x68a1('0x126')](db[_0x68a1('0x13')],{'foreignKey':_0x68a1('0x1e4'),'as':_0x68a1('0x1e5')});db[_0x68a1('0xef')][_0x68a1('0x126')](db[_0x68a1('0x40')],{'foreignKey':_0x68a1('0x1e6'),'as':_0x68a1('0x1e7')});db['MailTransferReport'][_0x68a1('0x126')](db[_0x68a1('0x13d')],{'foreignKey':'ToMailAccountId','as':_0x68a1('0x1e8')});db[_0x68a1('0xf1')][_0x68a1('0x126')](db[_0x68a1('0x6f')],{});db['ChatTransferReport'][_0x68a1('0x126')](db[_0x68a1('0x6d')],{});db[_0x68a1('0xf1')][_0x68a1('0x126')](db[_0x68a1('0x68')],{'foreignKey':_0x68a1('0x1e9'),'as':_0x68a1('0x1e1')});db[_0x68a1('0xf1')][_0x68a1('0x126')](db[_0x68a1('0x13')],{'foreignKey':'FromUserId','as':_0x68a1('0x1e3')});db[_0x68a1('0xf1')][_0x68a1('0x126')](db[_0x68a1('0x13')],{'foreignKey':_0x68a1('0x1e4'),'as':_0x68a1('0x1e5')});db[_0x68a1('0xf1')]['belongsTo'](db['ChatQueue'],{'foreignKey':'ToChatQueueId','as':_0x68a1('0x1e7')});db[_0x68a1('0xf1')][_0x68a1('0x126')](db[_0x68a1('0x68')],{'foreignKey':'ToChatWebsiteId','as':'ToAccount'});db[_0x68a1('0xf2')][_0x68a1('0x126')](db['FaxMessage'],{});db['FaxTransferReport'][_0x68a1('0x126')](db[_0x68a1('0x50')],{});db[_0x68a1('0xf2')][_0x68a1('0x126')](db[_0x68a1('0x4c')],{'foreignKey':_0x68a1('0x1ea'),'as':_0x68a1('0x1e1')});db[_0x68a1('0xf2')]['belongsTo'](db[_0x68a1('0x13')],{'foreignKey':_0x68a1('0x1e2'),'as':'FromAgent'});db['FaxTransferReport'][_0x68a1('0x126')](db['User'],{'foreignKey':_0x68a1('0x1e4'),'as':_0x68a1('0x1e5')});db[_0x68a1('0xf2')][_0x68a1('0x126')](db[_0x68a1('0x133')],{'foreignKey':'ToFaxQueueId','as':_0x68a1('0x1e7')});db[_0x68a1('0xf2')][_0x68a1('0x126')](db[_0x68a1('0x4c')],{'foreignKey':_0x68a1('0x1eb'),'as':_0x68a1('0x1e8')});db[_0x68a1('0x1ec')][_0x68a1('0x126')](db['OpenchannelMessage'],{});db[_0x68a1('0x1ec')][_0x68a1('0x126')](db['OpenchannelInteraction'],{});db[_0x68a1('0x1ec')]['belongsTo'](db[_0x68a1('0x5f')],{'foreignKey':_0x68a1('0x1ed'),'as':_0x68a1('0x1e1')});db[_0x68a1('0x1ec')][_0x68a1('0x126')](db[_0x68a1('0x13')],{'foreignKey':_0x68a1('0x1e2'),'as':_0x68a1('0x1e3')});db[_0x68a1('0x1ec')][_0x68a1('0x126')](db[_0x68a1('0x13')],{'foreignKey':_0x68a1('0x1e4'),'as':_0x68a1('0x1e5')});db[_0x68a1('0x1ec')][_0x68a1('0x126')](db['OpenchannelQueue'],{'foreignKey':_0x68a1('0x1ee'),'as':_0x68a1('0x1e7')});db[_0x68a1('0x1ec')][_0x68a1('0x126')](db[_0x68a1('0x5f')],{'foreignKey':_0x68a1('0x1ef'),'as':_0x68a1('0x1e8')});db['SmsTransferReport']['belongsTo'](db['SmsMessage'],{});db[_0x68a1('0x1f0')]['belongsTo'](db['SmsInteraction'],{});db[_0x68a1('0x1f0')][_0x68a1('0x126')](db['SmsAccount'],{'foreignKey':'FromSmsAccountId','as':_0x68a1('0x1e1')});db[_0x68a1('0x1f0')][_0x68a1('0x126')](db[_0x68a1('0x13')],{'foreignKey':_0x68a1('0x1e2'),'as':_0x68a1('0x1e3')});db[_0x68a1('0x1f0')][_0x68a1('0x126')](db[_0x68a1('0x13')],{'foreignKey':_0x68a1('0x1e4'),'as':_0x68a1('0x1e5')});db[_0x68a1('0x1f0')][_0x68a1('0x126')](db[_0x68a1('0x5d')],{'foreignKey':'ToSmsQueueId','as':'ToQueue'});db['SmsTransferReport']['belongsTo'](db['SmsAccount'],{'foreignKey':_0x68a1('0x1f1'),'as':'ToAccount'});db['CmList'][_0x68a1('0x11a')](db[_0x68a1('0x86')],{'as':_0x68a1('0x164'),'foreignKey':_0x68a1('0x180'),'onDelete':'cascade'});db['CmList'][_0x68a1('0x11a')](db[_0x68a1('0x1f2')],{'as':_0x68a1('0x1f3'),'foreignKey':_0x68a1('0x180')});db['CmList'][_0x68a1('0x11a')](db[_0x68a1('0x77')],{'as':_0x68a1('0x193'),'onDelete':_0x68a1('0x114'),'foreignKey':_0x68a1('0x180')});db[_0x68a1('0x129')][_0x68a1('0x11a')](db['CmHopperFinal'],{'as':_0x68a1('0x195'),'foreignKey':_0x68a1('0x180')});db[_0x68a1('0x129')][_0x68a1('0x11a')](db['CmHopperHistory'],{'as':_0x68a1('0x11e'),'foreignKey':_0x68a1('0x180')});db[_0x68a1('0x129')]['hasMany'](db[_0x68a1('0x80')],{'as':_0x68a1('0x80'),'foreignKey':_0x68a1('0x180')});db[_0x68a1('0x129')][_0x68a1('0x127')](db[_0x68a1('0x1c')],{'as':_0x68a1('0x1f4'),'through':_0x68a1('0x156')});db[_0x68a1('0x129')][_0x68a1('0x127')](db[_0x68a1('0x13')],{'as':_0x68a1('0x157'),'through':_0x68a1('0x138')});db[_0x68a1('0xf5')][_0x68a1('0x11a')](db[_0x68a1('0x19')],{'as':_0x68a1('0x11c'),'onDelete':_0x68a1('0x114')});db[_0x68a1('0xf5')][_0x68a1('0x127')](db[_0x68a1('0x13')],{'as':_0x68a1('0x157'),'through':_0x68a1('0x10f')});db[_0x68a1('0xf5')][_0x68a1('0x127')](db[_0x68a1('0xe3')],{'through':_0x68a1('0x10e'),'as':_0x68a1('0x158')});db['UserProfile']['hasMany'](db[_0x68a1('0x13')],{'as':_0x68a1('0x16d'),'foreignKey':_0x68a1('0x1f5')});db[_0x68a1('0xf7')][_0x68a1('0x11a')](db[_0x68a1('0x1f6')],{'as':_0x68a1('0x1f7'),'foreignKey':_0x68a1('0x1f5'),'onDelete':_0x68a1('0x114')});db[_0x68a1('0x1f6')][_0x68a1('0x11a')](db[_0x68a1('0xfa')],{'as':'Resources','foreignKey':_0x68a1('0x1f8'),'onDelete':_0x68a1('0x114')});db[_0x68a1('0xfe')][_0x68a1('0x11a')](db[_0x68a1('0x86')],{'as':_0x68a1('0x164'),'foreignKey':_0x68a1('0x1f9'),'onDelete':_0x68a1('0x114')});db['WhatsappAccount'][_0x68a1('0x11a')](db[_0x68a1('0x85')],{'as':_0x68a1('0x165'),'foreignKey':_0x68a1('0x1f9')});db[_0x68a1('0xfe')][_0x68a1('0x11a')](db['WhatsappMessage'],{'as':_0x68a1('0x15a'),'foreignKey':_0x68a1('0x1f9')});db[_0x68a1('0xfe')]['hasMany'](db[_0x68a1('0x102')],{'as':_0x68a1('0x177')});db['WhatsappAccount']['hasMany'](db[_0x68a1('0x100')],{'as':_0x68a1('0x178'),'foreignKey':_0x68a1('0x1f9'),'onDelete':'cascade'});db['WhatsappAccount'][_0x68a1('0x126')](db[_0x68a1('0x129')],{'as':_0x68a1('0x17a'),'foreignKey':_0x68a1('0x180')});db[_0x68a1('0xfe')][_0x68a1('0x126')](db[_0x68a1('0x17b')],{'as':_0x68a1('0x153'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x68a1('0xfe')][_0x68a1('0x127')](db[_0x68a1('0x13')],{'as':'Agents','through':_0x68a1('0x144')});db[_0x68a1('0x100')]['belongsTo'](db[_0x68a1('0x13')],{'onDelete':_0x68a1('0x172')});db['WhatsappApplication']['belongsTo'](db[_0x68a1('0x109')],{'onDelete':_0x68a1('0x172')});db[_0x68a1('0x100')]['belongsTo'](db[_0x68a1('0xfe')],{'onDelete':_0x68a1('0x172')});db[_0x68a1('0x100')][_0x68a1('0x126')](db[_0x68a1('0x151')],{'onDelete':_0x68a1('0x172'),'foreignKey':_0x68a1('0x152')});db[_0x68a1('0x100')][_0x68a1('0x126')](db[_0x68a1('0x90')],{'onDelete':_0x68a1('0x172'),'foreignKey':_0x68a1('0x173')});db[_0x68a1('0x102')][_0x68a1('0x11a')](db['WhatsappMessage'],{'as':'Messages','onDelete':_0x68a1('0x114'),'foreignKey':_0x68a1('0x1fa')});db[_0x68a1('0x102')][_0x68a1('0x126')](db[_0x68a1('0xfe')],{'as':_0x68a1('0x168'),'foreignKey':_0x68a1('0x1f9')});db[_0x68a1('0x102')][_0x68a1('0x126')](db['CmContact'],{'as':_0x68a1('0x169'),'foreignKey':_0x68a1('0x15e')});db[_0x68a1('0x102')][_0x68a1('0x126')](db[_0x68a1('0x13')],{'as':_0x68a1('0x16a'),'foreignKey':_0x68a1('0x115')});db[_0x68a1('0x102')][_0x68a1('0x127')](db['Tag'],{'through':'whatsapp_interaction_has_tags','as':_0x68a1('0x16b')});db[_0x68a1('0x102')][_0x68a1('0x127')](db['Tag'],{'through':'whatsapp_interaction_has_tags','as':_0x68a1('0x17e')});db[_0x68a1('0x102')][_0x68a1('0x127')](db[_0x68a1('0x13')],{'as':_0x68a1('0x16d'),'through':'user_has_whatsapp_interactions','foreignKey':_0x68a1('0x1fa')});db[_0x68a1('0x104')][_0x68a1('0x126')](db['User'],{'as':'User'});db[_0x68a1('0x104')][_0x68a1('0x126')](db[_0x68a1('0x77')],{'onDelete':_0x68a1('0x114'),'as':_0x68a1('0x169')});db['WhatsappMessage'][_0x68a1('0x126')](db[_0x68a1('0x102')],{'onDelete':_0x68a1('0x114'),'as':_0x68a1('0x16f'),'foreignKey':_0x68a1('0x1fa')});db['WhatsappMessage'][_0x68a1('0x126')](db[_0x68a1('0xfe')],{'as':_0x68a1('0x168'),'foreignKey':_0x68a1('0x1f9')});db[_0x68a1('0x106')][_0x68a1('0x126')](db['WhatsappAccount'],{});db[_0x68a1('0x106')][_0x68a1('0x126')](db[_0x68a1('0x129')],{'as':_0x68a1('0x17a'),'foreignKey':_0x68a1('0x180')});db[_0x68a1('0x106')][_0x68a1('0x126')](db['CmContact'],{'as':_0x68a1('0x169'),'foreignKey':_0x68a1('0x15e')});db[_0x68a1('0x106')][_0x68a1('0x126')](db['WhatsappInteraction'],{});db[_0x68a1('0x106')][_0x68a1('0x126')](db['WhatsappQueue'],{});db[_0x68a1('0x106')][_0x68a1('0x126')](db[_0x68a1('0x104')],{});db[_0x68a1('0x106')][_0x68a1('0x126')](db[_0x68a1('0x13')],{});db['WhatsappTransferReport']['belongsTo'](db[_0x68a1('0x104')],{});db[_0x68a1('0x1fb')][_0x68a1('0x126')](db[_0x68a1('0x102')],{});db[_0x68a1('0x1fb')][_0x68a1('0x126')](db[_0x68a1('0xfe')],{'foreignKey':_0x68a1('0x1fc'),'as':_0x68a1('0x1e1')});db[_0x68a1('0x1fb')][_0x68a1('0x126')](db['WhatsappAccount'],{'foreignKey':_0x68a1('0x1fd'),'as':_0x68a1('0x1e8')});db[_0x68a1('0x1fb')]['belongsTo'](db[_0x68a1('0x109')],{'foreignKey':_0x68a1('0x1fe'),'as':'ToQueue'});db[_0x68a1('0x1fb')][_0x68a1('0x126')](db[_0x68a1('0x13')],{'foreignKey':_0x68a1('0x1e2'),'as':_0x68a1('0x1e3')});db['WhatsappTransferReport']['belongsTo'](db[_0x68a1('0x13')],{'foreignKey':_0x68a1('0x1e4'),'as':'ToAgent'});db[_0x68a1('0x109')]['belongsToMany'](db['User'],{'as':_0x68a1('0x157'),'through':'UserWhatsappQueue','foreignKey':_0x68a1('0x1ff')});db['WhatsappQueue'][_0x68a1('0x127')](db[_0x68a1('0xe3')],{'through':_0x68a1('0x1db'),'as':_0x68a1('0x158')});db[_0x68a1('0x116')][_0x68a1('0x126')](db[_0x68a1('0x13')],{'as':_0x68a1('0x200'),'foreignKey':'UserId','onDelete':_0x68a1('0x114'),'hooks':!![]});db[_0x68a1('0x10a')][_0x68a1('0x113')](db['Dynamics365Account'],{'as':'Dynamics365Account','onDelete':_0x68a1('0x172')});db[_0x68a1('0x10a')][_0x68a1('0x113')](db[_0x68a1('0x15f')],{'as':_0x68a1('0x162'),'onDelete':_0x68a1('0x172')});db[_0x68a1('0x10a')]['hasOne'](db['MailServerOut'],{'as':_0x68a1('0x163'),'onDelete':'restrict'});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 7d8f220..aad4817 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc1c6=['/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','./api/voiceAgentReport','./api/voiceQueueReport','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/faxAccount','/api/fax/applications','/api/fax/interactions','/api/fax/messages','/api/fax/queues','./api/faxQueue','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelInteraction','/api/openchannel/messages','/api/openchannel/queues','./api/openchannelQueue','./api/chatWebsite','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/cmCompany','./api/cmContact','./api/cmHopper','/api/cm/hopper_black','/api/cm/hopper_final','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','./api/action','/api/automations','/api/canned_answers','./api/cannedAnswer','/api/dispositions','/api/intervals','./api/interval','/api/pauses','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','/api/sounds','./api/sound','/api/tags','./api/contactItemType','/api/cm_contact_has_items','./api/cmContactHasItem','/api/cm_hopper_additional_phones','/api/templates','/api/triggers','./api/trigger','./api/variable','/api/integrations','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/metrics','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','./api/intDeskAccount','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','./api/intZendeskAccount','/api/integrations/zendesk/configurations','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','/api/integrations/dynamics365/configurations','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/networks','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','/api/square/reports','./api/squareReport','/api/jscripty/projects','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','./api/squareRecording','/api/square/messages','/api/teams','./api/campaign','/api/migrations','/api/attachments','./api/attachment','/api/plugins','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','./api/openchannelTransferReport','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/userProfile','/api/userProfile/sections','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','/api/whatsapp/messages','./api/whatsappMessage','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','/api/whatsapp/queues','./api/cloudProvider','/api/realtime','./api/realtime','/api/user-settings','./api/user-setting','./api/mailInteractionHasTag','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','./api/authActiveDirectory','/api/jira','./api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','/api/pm2','./api/pm2','./api/webbar','/api/logs','/apidoc','static','/www','join','root','/demo','/snippet','snippet','3.13.0','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','appPath','/index.html','path','express','./errors','./utils/client-side-logger','./api/client-side-logs','default','/api/users','use','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues'];(function(_0x54defc,_0x627178){var _0x1955d3=function(_0x299afe){while(--_0x299afe){_0x54defc['push'](_0x54defc['shift']());}};_0x1955d3(++_0x627178);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x55859d,_0x3465b7){_0x55859d=_0x55859d-0x0;var _0x154817=_0xc1c6[_0x55859d];return _0x154817;};'use strict';var path=require(_0x6c1c('0x0'));var express=require(_0x6c1c('0x1'));var errors=require(_0x6c1c('0x2'));var config=require('./config/environment');var setupLoggers=require(_0x6c1c('0x3'))['setupLoggers'];var clientSideLogs=require(_0x6c1c('0x4'));exports[_0x6c1c('0x5')]=function(_0x265d2c){return setupLoggers(_0x265d2c)['then'](function(){_0x265d2c['use'](_0x6c1c('0x6'),require('./api/user'));_0x265d2c[_0x6c1c('0x7')]('/api/voice/chanspy',require(_0x6c1c('0x8')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0x9'),require(_0x6c1c('0xa')));_0x265d2c['use'](_0x6c1c('0xb'),require(_0x6c1c('0xc')));_0x265d2c['use'](_0x6c1c('0xd'),require(_0x6c1c('0xe')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0xf'),require('./api/voiceQueue'));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0x10'),require(_0x6c1c('0x11')));_0x265d2c['use'](_0x6c1c('0x12'),require(_0x6c1c('0x13')));_0x265d2c[_0x6c1c('0x7')]('/api/voice/mails',require(_0x6c1c('0x14')));_0x265d2c['use'](_0x6c1c('0x15'),require(_0x6c1c('0x16')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0x17'),require(_0x6c1c('0x18')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0x19'),require(_0x6c1c('0x1a')));_0x265d2c[_0x6c1c('0x7')]('/api/voice/agents/reports',require(_0x6c1c('0x1b')));_0x265d2c[_0x6c1c('0x7')]('/api/voice/queues/reports',require(_0x6c1c('0x1c')));_0x265d2c[_0x6c1c('0x7')]('/api/members/reports',require(_0x6c1c('0x1d')));_0x265d2c['use'](_0x6c1c('0x1e'),require(_0x6c1c('0x1f')));_0x265d2c['use'](_0x6c1c('0x20'),require('./api/voiceTransferReport'));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0x21'),require(_0x6c1c('0x22')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0x23'),require(_0x6c1c('0x24')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0x25'),require(_0x6c1c('0x26')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0x27'),require(_0x6c1c('0x28')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0x29'),require(_0x6c1c('0x2a')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0x2b'),require(_0x6c1c('0x2c')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0x2d'),require(_0x6c1c('0x2e')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0x2f'),require(_0x6c1c('0x30')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0x31'),require(_0x6c1c('0x32')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0x33'),require('./api/dashboardItem'));_0x265d2c[_0x6c1c('0x7')]('/api/fax/accounts',require(_0x6c1c('0x34')));_0x265d2c['use'](_0x6c1c('0x35'),require('./api/faxApplication'));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0x36'),require('./api/faxInteraction'));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0x37'),require('./api/faxMessage'));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0x38'),require(_0x6c1c('0x39')));_0x265d2c[_0x6c1c('0x7')]('/api/fax/reports/queue',require('./api/faxQueueReport'));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0x3a'),require(_0x6c1c('0x3b')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0x3c'),require(_0x6c1c('0x3d')));_0x265d2c['use'](_0x6c1c('0x3e'),require(_0x6c1c('0x3f')));_0x265d2c['use'](_0x6c1c('0x40'),require(_0x6c1c('0x41')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0x42'),require('./api/smsQueue'));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0x43'),require(_0x6c1c('0x44')));_0x265d2c['use'](_0x6c1c('0x45'),require('./api/openchannelApplication'));_0x265d2c[_0x6c1c('0x7')]('/api/openchannel/interactions',require(_0x6c1c('0x46')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0x47'),require('./api/openchannelMessage'));_0x265d2c['use'](_0x6c1c('0x48'),require(_0x6c1c('0x49')));_0x265d2c[_0x6c1c('0x7')]('/api/chat/websites',require(_0x6c1c('0x4a')));_0x265d2c['use']('/api/openchannel/reports/queue',require(_0x6c1c('0x4b')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0x4c'),require(_0x6c1c('0x4d')));_0x265d2c['use'](_0x6c1c('0x4e'),require(_0x6c1c('0x4f')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0x50'),require(_0x6c1c('0x51')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0x52'),require(_0x6c1c('0x53')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0x54'),require('./api/chatQueue'));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0x55'),require(_0x6c1c('0x56')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0x57'),require('./api/chatProactiveAction'));_0x265d2c['use']('/api/cm/companies',require(_0x6c1c('0x58')));_0x265d2c['use']('/api/cm/contacts',require(_0x6c1c('0x59')));_0x265d2c[_0x6c1c('0x7')]('/api/cm/hopper',require(_0x6c1c('0x5a')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0x5b'),require('./api/cmHopperBlack'));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0x5c'),require('./api/cmHopperFinal'));_0x265d2c[_0x6c1c('0x7')]('/api/cm/hopper_history',require(_0x6c1c('0x5d')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0x5e'),require(_0x6c1c('0x5f')));_0x265d2c[_0x6c1c('0x7')]('/api/actions',require(_0x6c1c('0x60')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0x61'),require('./api/automation'));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0x62'),require(_0x6c1c('0x63')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0x64'),require('./api/disposition'));_0x265d2c[_0x6c1c('0x7')]('/api/conditions',require('./api/condition'));_0x265d2c['use'](_0x6c1c('0x65'),require(_0x6c1c('0x66')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0x67'),require(_0x6c1c('0x68')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0x69'),require(_0x6c1c('0x6a')));_0x265d2c['use'](_0x6c1c('0x6b'),require(_0x6c1c('0x6c')));_0x265d2c['use'](_0x6c1c('0x6d'),require('./api/schedule'));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0x6e'),require(_0x6c1c('0x6f')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0x70'),require('./api/tag'));_0x265d2c[_0x6c1c('0x7')]('/api/contact_item_types',require(_0x6c1c('0x71')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0x72'),require(_0x6c1c('0x73')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0x74'),require('./api/cmHopperAdditionalPhone'));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0x75'),require('./api/template'));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0x76'),require(_0x6c1c('0x77')));_0x265d2c[_0x6c1c('0x7')]('/api/variables',require(_0x6c1c('0x78')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0x79'),require('./api/integration'));_0x265d2c['use']('/api/integrations/reports',require('./api/integrationReport'));_0x265d2c['use'](_0x6c1c('0x7a'),require(_0x6c1c('0x7b')));_0x265d2c['use'](_0x6c1c('0x7c'),require(_0x6c1c('0x7d')));_0x265d2c[_0x6c1c('0x7')]('/api/analytics/extracted_reports',require('./api/analyticExtractedReport'));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0x7e'),require('./api/analyticMetric'));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0x7f'),require(_0x6c1c('0x80')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0x81'),require(_0x6c1c('0x82')));_0x265d2c['use'](_0x6c1c('0x83'),require(_0x6c1c('0x84')));_0x265d2c['use']('/api/integrations/salesforce/configurations',require(_0x6c1c('0x85')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0x86'),require('./api/intSalesforceField'));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0x87'),require(_0x6c1c('0x88')));_0x265d2c[_0x6c1c('0x7')]('/api/integrations/sugarcrm/configurations',require('./api/intSugarcrmConfiguration'));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0x89'),require(_0x6c1c('0x8a')));_0x265d2c['use']('/api/integrations/desk/accounts',require(_0x6c1c('0x8b')));_0x265d2c[_0x6c1c('0x7')]('/api/integrations/desk/configurations',require(_0x6c1c('0x8c')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0x8d'),require(_0x6c1c('0x8e')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0x8f'),require('./api/intZohoAccount'));_0x265d2c[_0x6c1c('0x7')]('/api/integrations/zoho/configurations',require(_0x6c1c('0x90')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0x91'),require(_0x6c1c('0x92')));_0x265d2c['use']('/api/integrations/zendesk/accounts',require(_0x6c1c('0x93')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0x94'),require('./api/intZendeskConfiguration'));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0x95'),require(_0x6c1c('0x96')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0x97'),require(_0x6c1c('0x98')));_0x265d2c[_0x6c1c('0x7')]('/api/integrations/freshdesk/configurations',require(_0x6c1c('0x99')));_0x265d2c['use'](_0x6c1c('0x9a'),require(_0x6c1c('0x9b')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0x9c'),require('./api/intVtigerAccount'));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0x9d'),require(_0x6c1c('0x9e')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0x9f'),require(_0x6c1c('0xa0')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0xa1'),require(_0x6c1c('0xa2')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0xa3'),require('./api/intServicenowConfiguration'));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0xa4'),require(_0x6c1c('0xa5')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0xa6'),require('./api/intDynamics365Account'));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0xa7'),require('./api/intDynamics365Configuration'));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0xa8'),require(_0x6c1c('0xa9')));_0x265d2c['use'](_0x6c1c('0xaa'),require(_0x6c1c('0xab')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0xac'),require(_0x6c1c('0xad')));_0x265d2c[_0x6c1c('0x7')]('/api/integrations/freshsales/fields',require('./api/intFreshsalesField'));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0xae'),require('./api/network'));_0x265d2c['use']('/api/chat/reports/queue',require(_0x6c1c('0xaf')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0xb0'),require(_0x6c1c('0xb1')));_0x265d2c['use'](_0x6c1c('0xb2'),require('./api/jscriptyAnswerReport'));_0x265d2c['use']('/api/jscripty/questions/reports',require(_0x6c1c('0xb3')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0xb4'),require(_0x6c1c('0xb5')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0xb6'),require('./api/smsQueueReport'));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0xb7'),require(_0x6c1c('0xb8')));_0x265d2c['use']('/api/square/details/reports',require('./api/squareReportDetail'));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0xb9'),require('./api/jscriptyProject'));_0x265d2c[_0x6c1c('0x7')]('/api/settings',require(_0x6c1c('0xba')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0xbb'),require(_0x6c1c('0xbc')));_0x265d2c['use'](_0x6c1c('0xbd'),require(_0x6c1c('0xbe')));_0x265d2c['use']('/api/square/recordings',require(_0x6c1c('0xbf')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0xc0'),require('./api/squareMessage'));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0xc1'),require('./api/team'));_0x265d2c['use']('/api/license',require('./api/license'));_0x265d2c[_0x6c1c('0x7')]('/api/campaigns',require(_0x6c1c('0xc2')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0xc3'),require('./api/migration'));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0xc4'),require(_0x6c1c('0xc5')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0xc6'),require('./api/plugin'));_0x265d2c[_0x6c1c('0x7')]('/api/mail/reports/transfer',require(_0x6c1c('0xc7')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0xc8'),require(_0x6c1c('0xc9')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0xca'),require(_0x6c1c('0xcb')));_0x265d2c[_0x6c1c('0x7')]('/api/openchannel/reports/transfer',require(_0x6c1c('0xcc')));_0x265d2c['use']('/api/sms/reports/transfer',require(_0x6c1c('0xcd')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0xce'),require(_0x6c1c('0xcf')));_0x265d2c['use'](_0x6c1c('0xd0'),require('./api/voicePrefix'));_0x265d2c[_0x6c1c('0x7')]('/api/userProfiles',require(_0x6c1c('0xd1')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0xd2'),require('./api/userProfileSection'));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0xd3'),require(_0x6c1c('0xd4')));_0x265d2c['use'](_0x6c1c('0xd5'),require(_0x6c1c('0xd6')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0xd7'),require('./api/whatsappAccount'));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0xd8'),require(_0x6c1c('0xd9')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0xda'),require('./api/whatsappInteraction'));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0xdb'),require(_0x6c1c('0xdc')));_0x265d2c[_0x6c1c('0x7')]('/api/whatsapp/reports/queue',require(_0x6c1c('0xdd')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0xde'),require('./api/whatsappTransferReport'));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0xdf'),require('./api/whatsappQueue'));_0x265d2c[_0x6c1c('0x7')]('/api/cloudProviders',require(_0x6c1c('0xe0')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0xe1'),require(_0x6c1c('0xe2')));_0x265d2c['use'](_0x6c1c('0xe3'),require(_0x6c1c('0xe4')));_0x265d2c[_0x6c1c('0x7')]('/api/mail_interaction_has_tags',require(_0x6c1c('0xe5')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0xe6'),require(_0x6c1c('0xe7')));_0x265d2c['use'](_0x6c1c('0xe8'),require(_0x6c1c('0xe9')));_0x265d2c[_0x6c1c('0x7')]('/api/auth/activedirectory',require(_0x6c1c('0xea')));_0x265d2c['use'](_0x6c1c('0xeb'),require(_0x6c1c('0xec')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0xed'),require(_0x6c1c('0xee')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0xef'),require(_0x6c1c('0xf0')));_0x265d2c['use'](_0x6c1c('0xf1'),require('./api/system'));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0xf2'),require(_0x6c1c('0xf3')));_0x265d2c[_0x6c1c('0x7')]('/api/webbar',require(_0x6c1c('0xf4')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0xf5'),clientSideLogs);_0x265d2c['use'](_0x6c1c('0xf6'),express[_0x6c1c('0xf7')](path['join'](config['root'],_0x6c1c('0xf6'))));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0xf8'),express[_0x6c1c('0xf7')](path[_0x6c1c('0xf9')](config[_0x6c1c('0xfa')],_0x6c1c('0xf8'))));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0xfb'),express[_0x6c1c('0xf7')](path[_0x6c1c('0xf9')](config[_0x6c1c('0xfa')],'/demo')));_0x265d2c[_0x6c1c('0x7')](_0x6c1c('0xfc'),express[_0x6c1c('0xf7')](path[_0x6c1c('0xf9')](config[_0x6c1c('0xfa')],_0x6c1c('0xfd'),_0x6c1c('0xfe'))));_0x265d2c['use'](_0x6c1c('0xff'),express['static'](path['join'](config[_0x6c1c('0xfa')],_0x6c1c('0x100'))));_0x265d2c[_0x6c1c('0x101')](_0x6c1c('0x102'))[_0x6c1c('0x103')](errors[0x194]);_0x265d2c[_0x6c1c('0x101')]('/*')[_0x6c1c('0x103')](function(_0x2a2797,_0x3543c8){_0x3543c8[_0x6c1c('0x104')](path['resolve'](_0x265d2c[_0x6c1c('0x103')](_0x6c1c('0x105'))+_0x6c1c('0x106')));});return _0x265d2c;});}; \ No newline at end of file +var _0x4745=['./api/voiceCallReport','./api/voiceAgentReport','/api/voice/queues/reports','/api/members/reports','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/mailServerOut','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','/api/mail/applications','./api/mailApplication','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/faxAccount','/api/fax/applications','/api/fax/interactions','/api/fax/queues','./api/faxQueueReport','/api/sms/accounts','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','./api/smsMessage','/api/sms/queues','./api/smsQueue','./api/openchannelAccount','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','/api/cm/hopper_black','/api/cm/hopper_final','/api/cm/hopper_history','./api/cmCustomField','./api/action','/api/automations','/api/canned_answers','./api/cannedAnswer','./api/condition','./api/interval','./api/pause','/api/voiceQueuesLog','/api/schedules','./api/schedule','./api/sound','./api/tag','/api/contact_item_types','./api/contactItemType','/api/cm_contact_has_items','./api/cmContactHasItem','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','/api/templates','/api/triggers','./api/trigger','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/metrics','./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/integrations/sugarcrm/accounts','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/zoho/accounts','/api/integrations/zoho/configurations','./api/intZohoConfiguration','./api/intZohoField','/api/integrations/zendesk/accounts','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','./api/intZendeskField','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','/api/integrations/vtiger/accounts','/api/integrations/vtiger/configurations','/api/integrations/vtiger/fields','/api/integrations/servicenow/accounts','./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/integrations/freshsales/configurations','/api/chat/reports/queue','./api/chatQueueReport','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptySessionReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/messages','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','./api/migration','/api/attachments','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','./api/whatsappInteraction','/api/whatsapp/messages','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','./api/realtime','/api/user-settings','./api/user-setting','/api/mail_interaction_has_tags','./api/mailInteractionHasTag','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','./api/jira','./api/rpc','/api/version','/api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/api/logs','/apidoc','static','root','/www','join','/demo','/snippet','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','appPath','path','express','./errors','./config/environment','./utils/client-side-logger','setupLoggers','./api/client-side-logs','default','then','use','/api/users','/api/voice/chanspy','./api/voiceContext','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','/api/voice/calls/reports'];(function(_0x28e25c,_0x1bcef7){var _0x21eb1c=function(_0x3026b8){while(--_0x3026b8){_0x28e25c['push'](_0x28e25c['shift']());}};_0x21eb1c(++_0x1bcef7);}(_0x4745,0x1e7));var _0x5474=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x4745[_0x19e35c];return _0x3e1fe8;};'use strict';var path=require(_0x5474('0x0'));var express=require(_0x5474('0x1'));var errors=require(_0x5474('0x2'));var config=require(_0x5474('0x3'));var setupLoggers=require(_0x5474('0x4'))[_0x5474('0x5')];var clientSideLogs=require(_0x5474('0x6'));exports[_0x5474('0x7')]=function(_0x28d8aa){return setupLoggers(_0x28d8aa)[_0x5474('0x8')](function(){_0x28d8aa[_0x5474('0x9')](_0x5474('0xa'),require('./api/user'));_0x28d8aa[_0x5474('0x9')](_0x5474('0xb'),require('./api/voiceChanSpy'));_0x28d8aa[_0x5474('0x9')]('/api/voice/contexts',require(_0x5474('0xc')));_0x28d8aa[_0x5474('0x9')]('/api/voice/extensions',require(_0x5474('0xd')));_0x28d8aa[_0x5474('0x9')](_0x5474('0xe'),require(_0x5474('0xf')));_0x28d8aa[_0x5474('0x9')](_0x5474('0x10'),require(_0x5474('0x11')));_0x28d8aa[_0x5474('0x9')]('/api/voice/recordings',require(_0x5474('0x12')));_0x28d8aa[_0x5474('0x9')](_0x5474('0x13'),require(_0x5474('0x14')));_0x28d8aa[_0x5474('0x9')](_0x5474('0x15'),require(_0x5474('0x16')));_0x28d8aa[_0x5474('0x9')](_0x5474('0x17'),require('./api/voiceMailMessage'));_0x28d8aa[_0x5474('0x9')](_0x5474('0x18'),require(_0x5474('0x19')));_0x28d8aa[_0x5474('0x9')]('/api/voice/dials/reports',require('./api/voiceDialReport'));_0x28d8aa['use']('/api/voice/agents/reports',require(_0x5474('0x1a')));_0x28d8aa[_0x5474('0x9')](_0x5474('0x1b'),require('./api/voiceQueueReport'));_0x28d8aa[_0x5474('0x9')](_0x5474('0x1c'),require('./api/memberReport'));_0x28d8aa[_0x5474('0x9')](_0x5474('0x1d'),require(_0x5474('0x1e')));_0x28d8aa[_0x5474('0x9')](_0x5474('0x1f'),require('./api/voiceTransferReport'));_0x28d8aa[_0x5474('0x9')]('/api/mail/out_servers',require(_0x5474('0x20')));_0x28d8aa[_0x5474('0x9')]('/api/mail/accounts',require('./api/mailAccount'));_0x28d8aa['use'](_0x5474('0x21'),require(_0x5474('0x22')));_0x28d8aa[_0x5474('0x9')](_0x5474('0x23'),require(_0x5474('0x24')));_0x28d8aa[_0x5474('0x9')](_0x5474('0x25'),require(_0x5474('0x26')));_0x28d8aa[_0x5474('0x9')](_0x5474('0x27'),require('./api/mailMessage'));_0x28d8aa['use'](_0x5474('0x28'),require(_0x5474('0x29')));_0x28d8aa[_0x5474('0x9')]('/api/mail/reports/queue',require(_0x5474('0x2a')));_0x28d8aa['use'](_0x5474('0x2b'),require(_0x5474('0x2c')));_0x28d8aa['use'](_0x5474('0x2d'),require('./api/dashboardItem'));_0x28d8aa[_0x5474('0x9')]('/api/fax/accounts',require(_0x5474('0x2e')));_0x28d8aa[_0x5474('0x9')](_0x5474('0x2f'),require('./api/faxApplication'));_0x28d8aa[_0x5474('0x9')](_0x5474('0x30'),require('./api/faxInteraction'));_0x28d8aa['use']('/api/fax/messages',require('./api/faxMessage'));_0x28d8aa[_0x5474('0x9')](_0x5474('0x31'),require('./api/faxQueue'));_0x28d8aa[_0x5474('0x9')]('/api/fax/reports/queue',require(_0x5474('0x32')));_0x28d8aa['use'](_0x5474('0x33'),require('./api/smsAccount'));_0x28d8aa[_0x5474('0x9')]('/api/sms/applications',require(_0x5474('0x34')));_0x28d8aa[_0x5474('0x9')](_0x5474('0x35'),require(_0x5474('0x36')));_0x28d8aa['use']('/api/sms/messages',require(_0x5474('0x37')));_0x28d8aa[_0x5474('0x9')](_0x5474('0x38'),require(_0x5474('0x39')));_0x28d8aa['use']('/api/openchannel/accounts',require(_0x5474('0x3a')));_0x28d8aa[_0x5474('0x9')]('/api/openchannel/applications',require(_0x5474('0x3b')));_0x28d8aa[_0x5474('0x9')](_0x5474('0x3c'),require(_0x5474('0x3d')));_0x28d8aa['use'](_0x5474('0x3e'),require(_0x5474('0x3f')));_0x28d8aa[_0x5474('0x9')]('/api/openchannel/queues',require(_0x5474('0x40')));_0x28d8aa[_0x5474('0x9')](_0x5474('0x41'),require(_0x5474('0x42')));_0x28d8aa['use']('/api/openchannel/reports/queue',require(_0x5474('0x43')));_0x28d8aa[_0x5474('0x9')](_0x5474('0x44'),require(_0x5474('0x45')));_0x28d8aa['use'](_0x5474('0x46'),require(_0x5474('0x47')));_0x28d8aa[_0x5474('0x9')](_0x5474('0x48'),require('./api/chatMessage'));_0x28d8aa['use']('/api/chat/offline_messages',require(_0x5474('0x49')));_0x28d8aa['use'](_0x5474('0x4a'),require(_0x5474('0x4b')));_0x28d8aa[_0x5474('0x9')](_0x5474('0x4c'),require(_0x5474('0x4d')));_0x28d8aa[_0x5474('0x9')](_0x5474('0x4e'),require(_0x5474('0x4f')));_0x28d8aa[_0x5474('0x9')]('/api/cm/companies',require(_0x5474('0x50')));_0x28d8aa[_0x5474('0x9')](_0x5474('0x51'),require(_0x5474('0x52')));_0x28d8aa['use'](_0x5474('0x53'),require('./api/cmHopper'));_0x28d8aa[_0x5474('0x9')](_0x5474('0x54'),require('./api/cmHopperBlack'));_0x28d8aa[_0x5474('0x9')](_0x5474('0x55'),require('./api/cmHopperFinal'));_0x28d8aa[_0x5474('0x9')](_0x5474('0x56'),require('./api/cmHopperHistory'));_0x28d8aa[_0x5474('0x9')]('/api/cm/custom_fields',require(_0x5474('0x57')));_0x28d8aa[_0x5474('0x9')]('/api/actions',require(_0x5474('0x58')));_0x28d8aa[_0x5474('0x9')](_0x5474('0x59'),require('./api/automation'));_0x28d8aa[_0x5474('0x9')](_0x5474('0x5a'),require(_0x5474('0x5b')));_0x28d8aa[_0x5474('0x9')]('/api/dispositions',require('./api/disposition'));_0x28d8aa[_0x5474('0x9')]('/api/conditions',require(_0x5474('0x5c')));_0x28d8aa[_0x5474('0x9')]('/api/intervals',require(_0x5474('0x5d')));_0x28d8aa[_0x5474('0x9')]('/api/pauses',require(_0x5474('0x5e')));_0x28d8aa[_0x5474('0x9')]('/api/cdr',require('./api/cdr'));_0x28d8aa[_0x5474('0x9')](_0x5474('0x5f'),require('./api/voiceQueuesLog'));_0x28d8aa[_0x5474('0x9')](_0x5474('0x60'),require(_0x5474('0x61')));_0x28d8aa[_0x5474('0x9')]('/api/sounds',require(_0x5474('0x62')));_0x28d8aa[_0x5474('0x9')]('/api/tags',require(_0x5474('0x63')));_0x28d8aa[_0x5474('0x9')](_0x5474('0x64'),require(_0x5474('0x65')));_0x28d8aa[_0x5474('0x9')](_0x5474('0x66'),require(_0x5474('0x67')));_0x28d8aa[_0x5474('0x9')](_0x5474('0x68'),require(_0x5474('0x69')));_0x28d8aa[_0x5474('0x9')](_0x5474('0x6a'),require('./api/template'));_0x28d8aa[_0x5474('0x9')](_0x5474('0x6b'),require(_0x5474('0x6c')));_0x28d8aa[_0x5474('0x9')]('/api/variables',require(_0x5474('0x6d')));_0x28d8aa[_0x5474('0x9')](_0x5474('0x6e'),require(_0x5474('0x6f')));_0x28d8aa[_0x5474('0x9')](_0x5474('0x70'),require(_0x5474('0x71')));_0x28d8aa[_0x5474('0x9')](_0x5474('0x72'),require(_0x5474('0x73')));_0x28d8aa[_0x5474('0x9')](_0x5474('0x74'),require(_0x5474('0x75')));_0x28d8aa['use']('/api/analytics/extracted_reports',require('./api/analyticExtractedReport'));_0x28d8aa[_0x5474('0x9')](_0x5474('0x76'),require(_0x5474('0x77')));_0x28d8aa[_0x5474('0x9')](_0x5474('0x78'),require(_0x5474('0x79')));_0x28d8aa[_0x5474('0x9')](_0x5474('0x7a'),require(_0x5474('0x7b')));_0x28d8aa[_0x5474('0x9')]('/api/integrations/salesforce/accounts',require(_0x5474('0x7c')));_0x28d8aa[_0x5474('0x9')](_0x5474('0x7d'),require(_0x5474('0x7e')));_0x28d8aa[_0x5474('0x9')](_0x5474('0x7f'),require('./api/intSalesforceField'));_0x28d8aa['use'](_0x5474('0x80'),require('./api/intSugarcrmAccount'));_0x28d8aa[_0x5474('0x9')](_0x5474('0x81'),require(_0x5474('0x82')));_0x28d8aa['use'](_0x5474('0x83'),require('./api/intSugarcrmField'));_0x28d8aa[_0x5474('0x9')](_0x5474('0x84'),require(_0x5474('0x85')));_0x28d8aa[_0x5474('0x9')](_0x5474('0x86'),require(_0x5474('0x87')));_0x28d8aa[_0x5474('0x9')]('/api/integrations/desk/fields',require('./api/intDeskField'));_0x28d8aa[_0x5474('0x9')](_0x5474('0x88'),require('./api/intZohoAccount'));_0x28d8aa[_0x5474('0x9')](_0x5474('0x89'),require(_0x5474('0x8a')));_0x28d8aa['use']('/api/integrations/zoho/fields',require(_0x5474('0x8b')));_0x28d8aa['use'](_0x5474('0x8c'),require('./api/intZendeskAccount'));_0x28d8aa[_0x5474('0x9')](_0x5474('0x8d'),require(_0x5474('0x8e')));_0x28d8aa['use']('/api/integrations/zendesk/fields',require(_0x5474('0x8f')));_0x28d8aa[_0x5474('0x9')]('/api/integrations/freshdesk/accounts',require(_0x5474('0x90')));_0x28d8aa[_0x5474('0x9')](_0x5474('0x91'),require(_0x5474('0x92')));_0x28d8aa[_0x5474('0x9')](_0x5474('0x93'),require('./api/intFreshdeskField'));_0x28d8aa[_0x5474('0x9')](_0x5474('0x94'),require('./api/intVtigerAccount'));_0x28d8aa[_0x5474('0x9')](_0x5474('0x95'),require('./api/intVtigerConfiguration'));_0x28d8aa['use'](_0x5474('0x96'),require('./api/intVtigerField'));_0x28d8aa[_0x5474('0x9')](_0x5474('0x97'),require(_0x5474('0x98')));_0x28d8aa[_0x5474('0x9')](_0x5474('0x99'),require(_0x5474('0x9a')));_0x28d8aa['use']('/api/integrations/servicenow/fields',require(_0x5474('0x9b')));_0x28d8aa[_0x5474('0x9')](_0x5474('0x9c'),require(_0x5474('0x9d')));_0x28d8aa[_0x5474('0x9')](_0x5474('0x9e'),require(_0x5474('0x9f')));_0x28d8aa[_0x5474('0x9')](_0x5474('0xa0'),require(_0x5474('0xa1')));_0x28d8aa['use'](_0x5474('0xa2'),require('./api/intFreshsalesAccount'));_0x28d8aa[_0x5474('0x9')](_0x5474('0xa3'),require('./api/intFreshsalesConfiguration'));_0x28d8aa[_0x5474('0x9')]('/api/integrations/freshsales/fields',require('./api/intFreshsalesField'));_0x28d8aa[_0x5474('0x9')]('/api/networks',require('./api/network'));_0x28d8aa[_0x5474('0x9')](_0x5474('0xa4'),require(_0x5474('0xa5')));_0x28d8aa[_0x5474('0x9')]('/api/chat/internal/messages',require(_0x5474('0xa6')));_0x28d8aa[_0x5474('0x9')](_0x5474('0xa7'),require(_0x5474('0xa8')));_0x28d8aa[_0x5474('0x9')](_0x5474('0xa9'),require('./api/jscriptyQuestionReport'));_0x28d8aa[_0x5474('0x9')]('/api/jscripty/sessions/reports',require(_0x5474('0xaa')));_0x28d8aa[_0x5474('0x9')]('/api/sms/reports/queue',require('./api/smsQueueReport'));_0x28d8aa[_0x5474('0x9')](_0x5474('0xab'),require(_0x5474('0xac')));_0x28d8aa[_0x5474('0x9')](_0x5474('0xad'),require(_0x5474('0xae')));_0x28d8aa[_0x5474('0x9')]('/api/jscripty/projects',require('./api/jscriptyProject'));_0x28d8aa[_0x5474('0x9')](_0x5474('0xaf'),require(_0x5474('0xb0')));_0x28d8aa[_0x5474('0x9')](_0x5474('0xb1'),require(_0x5474('0xb2')));_0x28d8aa[_0x5474('0x9')](_0x5474('0xb3'),require(_0x5474('0xb4')));_0x28d8aa['use']('/api/square/recordings',require('./api/squareRecording'));_0x28d8aa['use'](_0x5474('0xb5'),require('./api/squareMessage'));_0x28d8aa[_0x5474('0x9')](_0x5474('0xb6'),require(_0x5474('0xb7')));_0x28d8aa[_0x5474('0x9')](_0x5474('0xb8'),require(_0x5474('0xb9')));_0x28d8aa['use'](_0x5474('0xba'),require(_0x5474('0xbb')));_0x28d8aa[_0x5474('0x9')]('/api/migrations',require(_0x5474('0xbc')));_0x28d8aa[_0x5474('0x9')](_0x5474('0xbd'),require('./api/attachment'));_0x28d8aa[_0x5474('0x9')](_0x5474('0xbe'),require(_0x5474('0xbf')));_0x28d8aa[_0x5474('0x9')](_0x5474('0xc0'),require(_0x5474('0xc1')));_0x28d8aa[_0x5474('0x9')]('/api/chat/reports/transfer',require(_0x5474('0xc2')));_0x28d8aa[_0x5474('0x9')](_0x5474('0xc3'),require(_0x5474('0xc4')));_0x28d8aa[_0x5474('0x9')]('/api/openchannel/reports/transfer',require(_0x5474('0xc5')));_0x28d8aa[_0x5474('0x9')](_0x5474('0xc6'),require(_0x5474('0xc7')));_0x28d8aa[_0x5474('0x9')]('/api/cm/lists',require(_0x5474('0xc8')));_0x28d8aa[_0x5474('0x9')](_0x5474('0xc9'),require(_0x5474('0xca')));_0x28d8aa[_0x5474('0x9')](_0x5474('0xcb'),require(_0x5474('0xcc')));_0x28d8aa[_0x5474('0x9')](_0x5474('0xcd'),require('./api/userProfileSection'));_0x28d8aa['use'](_0x5474('0xce'),require(_0x5474('0xcf')));_0x28d8aa[_0x5474('0x9')](_0x5474('0xd0'),require(_0x5474('0xd1')));_0x28d8aa[_0x5474('0x9')]('/api/whatsapp/accounts',require(_0x5474('0xd2')));_0x28d8aa['use'](_0x5474('0xd3'),require(_0x5474('0xd4')));_0x28d8aa[_0x5474('0x9')]('/api/whatsapp/interactions',require(_0x5474('0xd5')));_0x28d8aa[_0x5474('0x9')](_0x5474('0xd6'),require('./api/whatsappMessage'));_0x28d8aa[_0x5474('0x9')](_0x5474('0xd7'),require(_0x5474('0xd8')));_0x28d8aa['use']('/api/whatsapp/reports/transfer',require('./api/whatsappTransferReport'));_0x28d8aa[_0x5474('0x9')](_0x5474('0xd9'),require(_0x5474('0xda')));_0x28d8aa[_0x5474('0x9')](_0x5474('0xdb'),require(_0x5474('0xdc')));_0x28d8aa[_0x5474('0x9')]('/api/realtime',require(_0x5474('0xdd')));_0x28d8aa[_0x5474('0x9')](_0x5474('0xde'),require(_0x5474('0xdf')));_0x28d8aa[_0x5474('0x9')](_0x5474('0xe0'),require(_0x5474('0xe1')));_0x28d8aa[_0x5474('0x9')](_0x5474('0xe2'),require(_0x5474('0xe3')));_0x28d8aa[_0x5474('0x9')](_0x5474('0xe4'),require(_0x5474('0xe5')));_0x28d8aa[_0x5474('0x9')](_0x5474('0xe6'),require(_0x5474('0xe7')));_0x28d8aa[_0x5474('0x9')](_0x5474('0xe8'),require(_0x5474('0xe9')));_0x28d8aa[_0x5474('0x9')]('/api/rpc',require(_0x5474('0xea')));_0x28d8aa[_0x5474('0x9')](_0x5474('0xeb'),require('./api/version'));_0x28d8aa['use'](_0x5474('0xec'),require('./api/system'));_0x28d8aa[_0x5474('0x9')](_0x5474('0xed'),require(_0x5474('0xee')));_0x28d8aa[_0x5474('0x9')](_0x5474('0xef'),require(_0x5474('0xf0')));_0x28d8aa[_0x5474('0x9')](_0x5474('0xf1'),clientSideLogs);_0x28d8aa[_0x5474('0x9')](_0x5474('0xf2'),express[_0x5474('0xf3')](path['join'](config[_0x5474('0xf4')],_0x5474('0xf2'))));_0x28d8aa[_0x5474('0x9')](_0x5474('0xf5'),express[_0x5474('0xf3')](path[_0x5474('0xf6')](config['root'],_0x5474('0xf5'))));_0x28d8aa['use'](_0x5474('0xf7'),express['static'](path[_0x5474('0xf6')](config[_0x5474('0xf4')],_0x5474('0xf7'))));_0x28d8aa[_0x5474('0x9')](_0x5474('0xf8'),express[_0x5474('0xf3')](path[_0x5474('0xf6')](config[_0x5474('0xf4')],'snippet','3.13.0')));_0x28d8aa[_0x5474('0x9')]('/plugins',express[_0x5474('0xf3')](path['join'](config['root'],_0x5474('0xf9'))));_0x28d8aa[_0x5474('0xfa')](_0x5474('0xfb'))[_0x5474('0xfc')](errors[0x194]);_0x28d8aa['route']('/*')[_0x5474('0xfc')](function(_0x22e42d,_0x50fa68){_0x50fa68[_0x5474('0xfd')](path[_0x5474('0xfe')](_0x28d8aa[_0x5474('0xfc')](_0x5474('0xff'))+'/index.html'));});return _0x28d8aa;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 0330347..934e4c7 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd02a=['../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/pause/pause.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','port','localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','RPC\x20listening\x20on\x20','jayson/promise','../config/environment','listen','../api/user/user.rpc','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/faxAccount/faxAccount.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc'];(function(_0x5ef25f,_0x2bdffa){var _0x39349c=function(_0xb3a53a){while(--_0xb3a53a){_0x5ef25f['push'](_0x5ef25f['shift']());}};_0x39349c(++_0x2bdffa);}(_0xd02a,0x1b2));var _0xad02=function(_0xc1d423,_0x415fa9){_0xc1d423=_0xc1d423-0x0;var _0x5d1b9a=_0xd02a[_0xc1d423];return _0x5d1b9a;};'use strict';var jayson=require(_0xad02('0x0'));var _=require('lodash');var config=require(_0xad02('0x1'));exports[_0xad02('0x2')]=function(){return new Promise(function(_0x529826,_0x306e2d){var _0x31b5ab={};_0x31b5ab=_['merge'](_0x31b5ab,require(_0xad02('0x3')));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require(_0xad02('0x5')));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require(_0xad02('0x6')));_0x31b5ab=_['merge'](_0x31b5ab,require(_0xad02('0x7')));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require('../api/voiceCallReport/voiceCallReport.rpc'));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require(_0xad02('0x8')));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require(_0xad02('0x9')));_0x31b5ab=_['merge'](_0x31b5ab,require(_0xad02('0xa')));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require('../api/trunk/trunk.rpc'));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require(_0xad02('0xb')));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require(_0xad02('0xc')));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require(_0xad02('0xd')));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require(_0xad02('0xe')));_0x31b5ab=_['merge'](_0x31b5ab,require('../api/mailQueue/mailQueue.rpc'));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require(_0xad02('0xf')));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require(_0xad02('0x10')));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require(_0xad02('0x11')));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require(_0xad02('0x12')));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require('../api/faxApplication/faxApplication.rpc'));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require(_0xad02('0x13')));_0x31b5ab=_['merge'](_0x31b5ab,require(_0xad02('0x14')));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require('../api/faxQueue/faxQueue.rpc'));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require('../api/faxQueueReport/faxQueueReport.rpc'));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require(_0xad02('0x15')));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require(_0xad02('0x16')));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require(_0xad02('0x17')));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require(_0xad02('0x18')));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require('../api/openchannelApplication/openchannelApplication.rpc'));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require(_0xad02('0x19')));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require(_0xad02('0x1a')));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require(_0xad02('0x1b')));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require(_0xad02('0x1c')));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require('../api/chatInteraction/chatInteraction.rpc'));_0x31b5ab=_['merge'](_0x31b5ab,require('../api/chatMessage/chatMessage.rpc'));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require('../api/chatQueue/chatQueue.rpc'));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require('../api/cmContact/cmContact.rpc'));_0x31b5ab=_['merge'](_0x31b5ab,require(_0xad02('0x1d')));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require(_0xad02('0x1e')));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require(_0xad02('0x1f')));_0x31b5ab=_['merge'](_0x31b5ab,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require('../api/interval/interval.rpc'));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require(_0xad02('0x20')));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require('../api/sound/sound.rpc'));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require(_0xad02('0x21')));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require('../api/template/template.rpc'));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require(_0xad02('0x22')));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require(_0xad02('0x23')));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require(_0xad02('0x24')));_0x31b5ab=_['merge'](_0x31b5ab,require(_0xad02('0x25')));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require(_0xad02('0x26')));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require(_0xad02('0x27')));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require(_0xad02('0x28')));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require(_0xad02('0x29')));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0x31b5ab=_['merge'](_0x31b5ab,require(_0xad02('0x2a')));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require(_0xad02('0x2b')));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require(_0xad02('0x2c')));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require(_0xad02('0x2d')));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require(_0xad02('0x2e')));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require(_0xad02('0x2f')));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require(_0xad02('0x30')));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require(_0xad02('0x31')));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require(_0xad02('0x32')));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require('../api/squareRecording/squareRecording.rpc'));_0x31b5ab=_['merge'](_0x31b5ab,require(_0xad02('0x33')));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require(_0xad02('0x34')));_0x31b5ab=_['merge'](_0x31b5ab,require(_0xad02('0x35')));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require(_0xad02('0x36')));_0x31b5ab=_['merge'](_0x31b5ab,require(_0xad02('0x37')));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require('../api/whatsappMessage/whatsappMessage.rpc'));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require(_0xad02('0x38')));_0x31b5ab=_[_0xad02('0x4')](_0x31b5ab,require(_0xad02('0x39')));var _0x4511d2=jayson[_0xad02('0x3a')](_0x31b5ab)['http']();var _0x2ea733=config['rpc'][_0xad02('0x3b')]||config[_0xad02('0x3b')]+0x1;var _0x2dbb5e=config['rpc']['ip']||_0xad02('0x3c');_0x4511d2['on'](_0xad02('0x3d'),function(_0x3340c1){return _0x306e2d(_0x3340c1);});_0x4511d2[_0xad02('0x2')](_0x2ea733,_0x2dbb5e,function(){console[_0xad02('0x3e')](_0xad02('0x3f'),_0x2dbb5e,_0x2ea733);require(_0xad02('0x40'))['default']();return _0x529826(_0xad02('0x41')+_0x2dbb5e+':'+_0x2ea733);});});}; \ No newline at end of file +var _0xf8e0=['../api/faxQueueReport/faxQueueReport.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.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/pause/pause.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','http','rpc','port','localhost','error','listen','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','default','lodash','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','merge','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc'];(function(_0x5d72da,_0xb7ce32){var _0x43ebe7=function(_0x503755){while(--_0x503755){_0x5d72da['push'](_0x5d72da['shift']());}};_0x43ebe7(++_0xb7ce32);}(_0xf8e0,0x103));var _0x0f8e=function(_0x3653ab,_0x418bd6){_0x3653ab=_0x3653ab-0x0;var _0x2a79ea=_0xf8e0[_0x3653ab];return _0x2a79ea;};'use strict';var jayson=require('jayson/promise');var _=require(_0x0f8e('0x0'));var config=require('../config/environment');exports['listen']=function(){return new Promise(function(_0x227ddb,_0x321c33){var _0x239ef8={};_0x239ef8=_['merge'](_0x239ef8,require(_0x0f8e('0x1')));_0x239ef8=_['merge'](_0x239ef8,require(_0x0f8e('0x2')));_0x239ef8=_['merge'](_0x239ef8,require(_0x0f8e('0x3')));_0x239ef8=_[_0x0f8e('0x4')](_0x239ef8,require(_0x0f8e('0x5')));_0x239ef8=_[_0x0f8e('0x4')](_0x239ef8,require(_0x0f8e('0x6')));_0x239ef8=_[_0x0f8e('0x4')](_0x239ef8,require('../api/voiceDialReport/voiceDialReport.rpc'));_0x239ef8=_['merge'](_0x239ef8,require(_0x0f8e('0x7')));_0x239ef8=_[_0x0f8e('0x4')](_0x239ef8,require(_0x0f8e('0x8')));_0x239ef8=_[_0x0f8e('0x4')](_0x239ef8,require('../api/memberReport/memberReport.rpc'));_0x239ef8=_[_0x0f8e('0x4')](_0x239ef8,require('../api/trunk/trunk.rpc'));_0x239ef8=_[_0x0f8e('0x4')](_0x239ef8,require(_0x0f8e('0x9')));_0x239ef8=_['merge'](_0x239ef8,require(_0x0f8e('0xa')));_0x239ef8=_[_0x0f8e('0x4')](_0x239ef8,require(_0x0f8e('0xb')));_0x239ef8=_['merge'](_0x239ef8,require('../api/mailAccount/mailAccount.rpc'));_0x239ef8=_[_0x0f8e('0x4')](_0x239ef8,require(_0x0f8e('0xc')));_0x239ef8=_[_0x0f8e('0x4')](_0x239ef8,require(_0x0f8e('0xd')));_0x239ef8=_[_0x0f8e('0x4')](_0x239ef8,require(_0x0f8e('0xe')));_0x239ef8=_[_0x0f8e('0x4')](_0x239ef8,require(_0x0f8e('0xf')));_0x239ef8=_[_0x0f8e('0x4')](_0x239ef8,require(_0x0f8e('0x10')));_0x239ef8=_['merge'](_0x239ef8,require('../api/faxAccount/faxAccount.rpc'));_0x239ef8=_[_0x0f8e('0x4')](_0x239ef8,require(_0x0f8e('0x11')));_0x239ef8=_[_0x0f8e('0x4')](_0x239ef8,require(_0x0f8e('0x12')));_0x239ef8=_['merge'](_0x239ef8,require(_0x0f8e('0x13')));_0x239ef8=_[_0x0f8e('0x4')](_0x239ef8,require(_0x0f8e('0x14')));_0x239ef8=_['merge'](_0x239ef8,require(_0x0f8e('0x15')));_0x239ef8=_[_0x0f8e('0x4')](_0x239ef8,require('../api/smsAccount/smsAccount.rpc'));_0x239ef8=_['merge'](_0x239ef8,require('../api/smsInteraction/smsInteraction.rpc'));_0x239ef8=_[_0x0f8e('0x4')](_0x239ef8,require(_0x0f8e('0x16')));_0x239ef8=_[_0x0f8e('0x4')](_0x239ef8,require(_0x0f8e('0x17')));_0x239ef8=_[_0x0f8e('0x4')](_0x239ef8,require('../api/openchannelApplication/openchannelApplication.rpc'));_0x239ef8=_[_0x0f8e('0x4')](_0x239ef8,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0x239ef8=_[_0x0f8e('0x4')](_0x239ef8,require(_0x0f8e('0x18')));_0x239ef8=_['merge'](_0x239ef8,require(_0x0f8e('0x19')));_0x239ef8=_[_0x0f8e('0x4')](_0x239ef8,require(_0x0f8e('0x1a')));_0x239ef8=_[_0x0f8e('0x4')](_0x239ef8,require(_0x0f8e('0x1b')));_0x239ef8=_[_0x0f8e('0x4')](_0x239ef8,require('../api/chatMessage/chatMessage.rpc'));_0x239ef8=_[_0x0f8e('0x4')](_0x239ef8,require(_0x0f8e('0x1c')));_0x239ef8=_['merge'](_0x239ef8,require(_0x0f8e('0x1d')));_0x239ef8=_[_0x0f8e('0x4')](_0x239ef8,require(_0x0f8e('0x1e')));_0x239ef8=_[_0x0f8e('0x4')](_0x239ef8,require(_0x0f8e('0x1f')));_0x239ef8=_[_0x0f8e('0x4')](_0x239ef8,require(_0x0f8e('0x20')));_0x239ef8=_[_0x0f8e('0x4')](_0x239ef8,require(_0x0f8e('0x21')));_0x239ef8=_['merge'](_0x239ef8,require(_0x0f8e('0x22')));_0x239ef8=_['merge'](_0x239ef8,require('../api/interval/interval.rpc'));_0x239ef8=_[_0x0f8e('0x4')](_0x239ef8,require(_0x0f8e('0x23')));_0x239ef8=_[_0x0f8e('0x4')](_0x239ef8,require(_0x0f8e('0x24')));_0x239ef8=_[_0x0f8e('0x4')](_0x239ef8,require(_0x0f8e('0x25')));_0x239ef8=_[_0x0f8e('0x4')](_0x239ef8,require(_0x0f8e('0x26')));_0x239ef8=_[_0x0f8e('0x4')](_0x239ef8,require(_0x0f8e('0x27')));_0x239ef8=_[_0x0f8e('0x4')](_0x239ef8,require('../api/variable/variable.rpc'));_0x239ef8=_[_0x0f8e('0x4')](_0x239ef8,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x239ef8=_[_0x0f8e('0x4')](_0x239ef8,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x239ef8=_[_0x0f8e('0x4')](_0x239ef8,require('../api/intDeskAccount/intDeskAccount.rpc'));_0x239ef8=_['merge'](_0x239ef8,require(_0x0f8e('0x28')));_0x239ef8=_[_0x0f8e('0x4')](_0x239ef8,require(_0x0f8e('0x29')));_0x239ef8=_['merge'](_0x239ef8,require(_0x0f8e('0x2a')));_0x239ef8=_[_0x0f8e('0x4')](_0x239ef8,require(_0x0f8e('0x2b')));_0x239ef8=_[_0x0f8e('0x4')](_0x239ef8,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0x239ef8=_[_0x0f8e('0x4')](_0x239ef8,require(_0x0f8e('0x2c')));_0x239ef8=_[_0x0f8e('0x4')](_0x239ef8,require(_0x0f8e('0x2d')));_0x239ef8=_['merge'](_0x239ef8,require(_0x0f8e('0x2e')));_0x239ef8=_[_0x0f8e('0x4')](_0x239ef8,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x239ef8=_[_0x0f8e('0x4')](_0x239ef8,require(_0x0f8e('0x2f')));_0x239ef8=_[_0x0f8e('0x4')](_0x239ef8,require(_0x0f8e('0x30')));_0x239ef8=_['merge'](_0x239ef8,require(_0x0f8e('0x31')));_0x239ef8=_['merge'](_0x239ef8,require(_0x0f8e('0x32')));_0x239ef8=_[_0x0f8e('0x4')](_0x239ef8,require(_0x0f8e('0x33')));_0x239ef8=_[_0x0f8e('0x4')](_0x239ef8,require('../api/squareRecording/squareRecording.rpc'));_0x239ef8=_[_0x0f8e('0x4')](_0x239ef8,require(_0x0f8e('0x34')));_0x239ef8=_['merge'](_0x239ef8,require(_0x0f8e('0x35')));_0x239ef8=_[_0x0f8e('0x4')](_0x239ef8,require(_0x0f8e('0x36')));_0x239ef8=_['merge'](_0x239ef8,require(_0x0f8e('0x37')));_0x239ef8=_[_0x0f8e('0x4')](_0x239ef8,require(_0x0f8e('0x38')));_0x239ef8=_['merge'](_0x239ef8,require(_0x0f8e('0x39')));_0x239ef8=_['merge'](_0x239ef8,require(_0x0f8e('0x3a')));_0x239ef8=_[_0x0f8e('0x4')](_0x239ef8,require(_0x0f8e('0x3b')));_0x239ef8=_['merge'](_0x239ef8,require(_0x0f8e('0x3c')));var _0x11cda5=jayson['server'](_0x239ef8)[_0x0f8e('0x3d')]();var _0x5586d7=config[_0x0f8e('0x3e')][_0x0f8e('0x3f')]||config[_0x0f8e('0x3f')]+0x1;var _0x51e346=config[_0x0f8e('0x3e')]['ip']||_0x0f8e('0x40');_0x11cda5['on'](_0x0f8e('0x41'),function(_0x586f7b){return _0x321c33(_0x586f7b);});_0x11cda5[_0x0f8e('0x42')](_0x5586d7,_0x51e346,function(){console[_0x0f8e('0x43')](_0x0f8e('0x44'),_0x51e346,_0x5586d7);require('../config/triggers')[_0x0f8e('0x45')]();return _0x227ddb('RPC\x20listening\x20on\x20'+_0x51e346+':'+_0x5586d7);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 74363d2..cf5d166 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 _0x0427=['SET\x20EXTENSION\x20%s','setPriority','setVariable','isBoolean','isNumber','SET\x20VARIABLE\x20%s\x20\x22%s\x22','toString','replace','sayNumber','SAY\x20NUMBER\x20%s\x20%s','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','setExtension','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','exec','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','lodash','EventEmitter','./reply','./error','call','setEncoding','utf8','setTimeout','headers','emit','ready','line','hangup','substring','search','520\x20End\x20of\x20proper','function','no\x20code','result=','indexOf','startsWith','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','write','prototype','sendRequest','answer','ANSWER','getData','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','isArray','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s'];(function(_0x2ac8f0,_0x21d3df){var _0x4e9e93=function(_0x292289){while(--_0x292289){_0x2ac8f0['push'](_0x2ac8f0['shift']());}};_0x4e9e93(++_0x21d3df);}(_0x0427,0x6c));var _0x7042=function(_0x1eebef,_0x11fd05){_0x1eebef=_0x1eebef-0x0;var _0xda5cb1=_0x0427[_0x1eebef];return _0xda5cb1;};'use strict';var util=require(_0x7042('0x0'));var _=require(_0x7042('0x1'));var EventEmitter=require('events')[_0x7042('0x2')];var AGIReply=require(_0x7042('0x3'));var AGIError=require(_0x7042('0x4'));function AGIChannel(_0x40ee39){var _0x5f9c9b=this,_0x5e33c5=new AGIReply(),_0x1ab30e=![],_0x1c9b6f={};EventEmitter[_0x7042('0x5')](_0x5f9c9b);_0x40ee39[_0x7042('0x6')](_0x7042('0x7'));_0x40ee39[_0x7042('0x8')](0x8*0x3c*0x3c*0x3e8);_0x5e33c5[_0x7042('0x6')]('utf8');_0x5e33c5['on'](_0x7042('0x9'),function(_0x258baa){for(var _0x1d34ae in _0x258baa){_0x5f9c9b[_0x1d34ae]=_0x258baa[_0x1d34ae];}_0x5f9c9b[_0x7042('0xa')](_0x7042('0xb'));});_0x5e33c5['on'](_0x7042('0xc'),function(_0x3d5652){if(_0x3d5652['toLowerCase']()=='hangup'){_0x5f9c9b[_0x7042('0xa')](_0x7042('0xd'));return;}if(_0x3d5652[_0x7042('0xe')](0x0,0xb)=='520-Invalid'){_0x1ab30e=!![];}if(_0x1ab30e){_0x1c9b6f['rx']+=_0x3d5652+'\x0a';if(_0x3d5652[_0x7042('0xf')](_0x7042('0x10'))!=-0x1){_0x1ab30e=![];}}else{_0x1c9b6f['rx']=_0x3d5652;}if(_0x1ab30e){return;}if(typeof _0x1c9b6f['cb']==_0x7042('0x11')){var _0x2c2a4b=_0x1c9b6f['rx'][_0x7042('0xe')](0x0,0x3),_0x11f723=null,_0x22e4dd=null;_0x2c2a4b=parseInt(_0x2c2a4b);if(isNaN(_0x2c2a4b)){_0x1c9b6f['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x7042('0x12')});return;}if(_0x2c2a4b!=0xc8){_0x1c9b6f['cb'](null,{'code':_0x2c2a4b,'result':-0x1,'extra':'KO'});return;}_0x11f723=_0x1c9b6f['rx'][_0x7042('0xe')](0x4)['replace'](_0x7042('0x13'),'');if(_0x11f723[_0x7042('0x14')]('\x20')!=-0x1){_0x11f723=_0x11f723['substr'](0x0,_0x11f723['indexOf']('\x20'));}if(_[_0x7042('0x15')](_0x11f723,'-1')){_0x11f723=parseInt(_0x11f723);}_0x22e4dd=_0x1c9b6f['rx'][_0x7042('0x16')]('\x20');if(_0x22e4dd['length']==0x3){_0x22e4dd=_0x22e4dd[0x2][_0x7042('0xe')](0x1,_0x22e4dd[0x2][_0x7042('0x17')]-0x1);}else if(_0x22e4dd[_0x7042('0x17')]>0x3){var _0x497efe=/\((.+)\)/;var _0x299151=_0x1c9b6f['rx'][_0x7042('0x18')](_0x497efe);if(_0x299151){_0x22e4dd=_0x299151[0x1];}else{_0x22e4dd=null;}}else{_0x22e4dd=null;}_0x1c9b6f['cb'](null,{'code':_0x2c2a4b,'result':_0x11f723,'extra':_0x22e4dd});}});_0x40ee39['on'](_0x7042('0x19'),function(_0x479a0c){_0x5f9c9b[_0x7042('0xa')](_0x7042('0x19'),new AGIError(_0x7042('0x1a'),_0x479a0c[_0x7042('0x1b')]));});_0x40ee39['on'](_0x7042('0x1c'),function(){_0x5f9c9b[_0x7042('0xa')]('close',new AGIError('E_AGI_SOCKET_CLOSE'));});_0x40ee39['on']('timeout',function(){_0x5f9c9b[_0x7042('0xa')](_0x7042('0x1d'),new AGIError(_0x7042('0x1e')));_0x40ee39[_0x7042('0x1f')]();});_0x40ee39[_0x7042('0x20')](_0x5e33c5);this[_0x7042('0x21')]=function(_0x239cf3,_0x5bbc97){var _0x239cf3=_0x239cf3||'',_0x5bbc97=typeof _0x5bbc97==_0x7042('0x11')?_0x5bbc97:new Function();_0x1c9b6f={'tx':_0x239cf3,'rx':'','cb':_0x5bbc97};_0x40ee39[_0x7042('0x22')](_0x239cf3+'\x0a');},this[_0x7042('0x1c')]=function(){_0x40ee39[_0x7042('0x1f')]();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel[_0x7042('0x23')][_0x7042('0x24')]=function(_0x42306f){return this['command']['sync'](this,_0x42306f);};AGIChannel[_0x7042('0x23')][_0x7042('0x25')]=function(){return this['sendRequest'](_0x7042('0x26'));};AGIChannel[_0x7042('0x23')][_0x7042('0x27')]=function(_0x1ddc6f,_0x4ec0bf,_0x599bc4){_0x1ddc6f=_0x1ddc6f===undefined?'beep':_0x1ddc6f;_0x4ec0bf=_0x4ec0bf===undefined?'5':_0x4ec0bf;_0x599bc4=_0x599bc4===undefined?'1':_0x599bc4;return this[_0x7042('0x24')](util[_0x7042('0x28')](_0x7042('0x29'),_0x1ddc6f,_0x4ec0bf*0x3e8,_0x599bc4));};AGIChannel[_0x7042('0x23')][_0x7042('0x2a')]=function(_0x5c4358){_0x5c4358=_0x5c4358||_0x7042('0x2b');return this[_0x7042('0x24')](util[_0x7042('0x28')](_0x7042('0x2c'),_0x5c4358));};AGIChannel[_0x7042('0x23')]['exec']=function(_0x32cf31,_0x5b10c1){if(_[_0x7042('0x2d')](_0x5b10c1)){return this['sendRequest'](util['format'](_0x7042('0x2e'),_0x32cf31,_0x5b10c1[_0x7042('0x2f')](',')));}return this[_0x7042('0x24')](util['format'](_0x7042('0x2e'),_0x32cf31,_0x5b10c1));};AGIChannel[_0x7042('0x23')][_0x7042('0x30')]=function(_0x3c599c){return this[_0x7042('0x24')](util['format'](_0x7042('0x31'),_0x3c599c));};AGIChannel[_0x7042('0x23')]['setExtension']=function(_0x2f9a7a){return this[_0x7042('0x24')](util['format'](_0x7042('0x32'),_0x2f9a7a));};AGIChannel[_0x7042('0x23')][_0x7042('0x33')]=function(_0x2675a8){return this[_0x7042('0x24')](util[_0x7042('0x28')]('SET\x20PRIORITY\x20%s',_0x2675a8));};AGIChannel[_0x7042('0x23')][_0x7042('0xd')]=function(){return this['sendRequest']('HANGUP');};AGIChannel[_0x7042('0x23')][_0x7042('0x34')]=function(_0x5aa5e0,_0x5a3cd7){var _0x557b9c=_[_0x7042('0x35')](_0x5a3cd7)||_[_0x7042('0x36')](_0x5a3cd7)?_0x5a3cd7['toString']():_0x5a3cd7;return this[_0x7042('0x24')](util[_0x7042('0x28')](_0x7042('0x37'),_0x5aa5e0,_0x557b9c?_0x557b9c[_0x7042('0x38')]()[_0x7042('0x39')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x7042('0x23')][_0x7042('0x3a')]=function(_0x59a0b8,_0x266197){return this['sendRequest'](util[_0x7042('0x28')](_0x7042('0x3b'),_0x59a0b8,_0x266197));};AGIChannel[_0x7042('0x23')]['sayDigits']=function(_0x45aaef,_0xb1acee){return this['sendRequest'](util['format'](_0x7042('0x3c'),_0x45aaef,_0xb1acee));};AGIChannel[_0x7042('0x23')][_0x7042('0x3d')]=function(_0x2c891b,_0x1153e7){return this[_0x7042('0x24')](util[_0x7042('0x28')](_0x7042('0x3e'),_0x2c891b,_0x1153e7));};AGIChannel[_0x7042('0x23')][_0x7042('0x3f')]=function(_0x7fa648,_0x5b6a63,_0x27c813){_0x5b6a63=_0x5b6a63||this['extension'];_0x27c813=_0x27c813||0x1;this['setContext'](_0x7fa648);this[_0x7042('0x40')](_0x5b6a63);this['setPriority'](_0x27c813);return this[_0x7042('0x2a')](util[_0x7042('0x28')](_0x7042('0x41'),_0x7fa648,_0x5b6a63,_0x27c813));};AGIChannel[_0x7042('0x23')][_0x7042('0x42')]=function(_0x570db1){return this[_0x7042('0x24')](util[_0x7042('0x28')](_0x7042('0x43'),_0x570db1));};AGIChannel['prototype'][_0x7042('0x44')]=function(_0x5de4ba,_0x2fd47c,_0x15d0fd,_0x3d6d8a,_0x3fd9c0,_0x345f25){_0x2fd47c=_0x2fd47c||'wav';_0x15d0fd=_0x15d0fd||'';_0x3d6d8a=_0x3d6d8a===undefined?-0x1:_0x3d6d8a==='-1'?-0x1:_0x3d6d8a*0x3e8;_0x3fd9c0=_0x3fd9c0===undefined?'':'s='+_0x3fd9c0;_0x345f25=_0x345f25?'BEEP':'';return this[_0x7042('0x24')](util[_0x7042('0x28')](_0x7042('0x45'),_0x5de4ba,_0x2fd47c,_0x15d0fd,_0x3d6d8a,_0x345f25,_0x3fd9c0));};AGIChannel[_0x7042('0x23')][_0x7042('0x46')]=function(_0x2675ca,_0x215346){_0x215346=_0x215346||'';return this['sendRequest'](util[_0x7042('0x28')](_0x7042('0x47'),_0x2675ca,_0x215346));};AGIChannel['prototype']['agi']=function(_0x178395){return this[_0x7042('0x48')](_0x7042('0x49'),_0x178395);};AGIChannel[_0x7042('0x23')][_0x7042('0x4a')]=function(_0x256ed2){return this['exec'](_0x7042('0x4b'),_0x256ed2);};AGIChannel['prototype'][_0x7042('0x19')]=function(_0xef9be9,_0x23d7ca){this[_0x7042('0x2a')](util[_0x7042('0x28')](_0x7042('0x4c'),_0xef9be9['id'],_0xef9be9[_0x7042('0x4d')],_0x23d7ca));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x7042('0x4e')]=AGIChannel; \ No newline at end of file +var _0x20a2=['lodash','./reply','./error','setEncoding','utf8','setTimeout','emit','ready','line','toLowerCase','hangup','520-Invalid','search','function','substring','no\x20code','replace','result=','substr','indexOf','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','write','inherits','prototype','sendRequest','ANSWER','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','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','extension','setExtension','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','agi','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util'];(function(_0x287602,_0x2a258b){var _0x11154b=function(_0x28d826){while(--_0x28d826){_0x287602['push'](_0x287602['shift']());}};_0x11154b(++_0x2a258b);}(_0x20a2,0xf2));var _0x220a=function(_0x2f1a6e,_0x3082cb){_0x2f1a6e=_0x2f1a6e-0x0;var _0x5865e5=_0x20a2[_0x2f1a6e];return _0x5865e5;};'use strict';var util=require(_0x220a('0x0'));var _=require(_0x220a('0x1'));var EventEmitter=require('events')['EventEmitter'];var AGIReply=require(_0x220a('0x2'));var AGIError=require(_0x220a('0x3'));function AGIChannel(_0x2d5d6c){var _0x328d6d=this,_0x40766a=new AGIReply(),_0xe391a4=![],_0x4e339e={};EventEmitter['call'](_0x328d6d);_0x2d5d6c[_0x220a('0x4')](_0x220a('0x5'));_0x2d5d6c[_0x220a('0x6')](0x8*0x3c*0x3c*0x3e8);_0x40766a[_0x220a('0x4')](_0x220a('0x5'));_0x40766a['on']('headers',function(_0x2970ac){for(var _0x3e5e13 in _0x2970ac){_0x328d6d[_0x3e5e13]=_0x2970ac[_0x3e5e13];}_0x328d6d[_0x220a('0x7')](_0x220a('0x8'));});_0x40766a['on'](_0x220a('0x9'),function(_0x43ed6e){if(_0x43ed6e[_0x220a('0xa')]()==_0x220a('0xb')){_0x328d6d[_0x220a('0x7')](_0x220a('0xb'));return;}if(_0x43ed6e['substring'](0x0,0xb)==_0x220a('0xc')){_0xe391a4=!![];}if(_0xe391a4){_0x4e339e['rx']+=_0x43ed6e+'\x0a';if(_0x43ed6e[_0x220a('0xd')]('520\x20End\x20of\x20proper')!=-0x1){_0xe391a4=![];}}else{_0x4e339e['rx']=_0x43ed6e;}if(_0xe391a4){return;}if(typeof _0x4e339e['cb']==_0x220a('0xe')){var _0x502a87=_0x4e339e['rx'][_0x220a('0xf')](0x0,0x3),_0x21c426=null,_0x19158c=null;_0x502a87=parseInt(_0x502a87);if(isNaN(_0x502a87)){_0x4e339e['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x220a('0x10')});return;}if(_0x502a87!=0xc8){_0x4e339e['cb'](null,{'code':_0x502a87,'result':-0x1,'extra':'KO'});return;}_0x21c426=_0x4e339e['rx']['substring'](0x4)[_0x220a('0x11')](_0x220a('0x12'),'');if(_0x21c426['indexOf']('\x20')!=-0x1){_0x21c426=_0x21c426[_0x220a('0x13')](0x0,_0x21c426[_0x220a('0x14')]('\x20'));}if(_['startsWith'](_0x21c426,'-1')){_0x21c426=parseInt(_0x21c426);}_0x19158c=_0x4e339e['rx'][_0x220a('0x15')]('\x20');if(_0x19158c[_0x220a('0x16')]==0x3){_0x19158c=_0x19158c[0x2][_0x220a('0xf')](0x1,_0x19158c[0x2]['length']-0x1);}else if(_0x19158c[_0x220a('0x16')]>0x3){var _0x5498b1=/\((.+)\)/;var _0x18f5e0=_0x4e339e['rx'][_0x220a('0x17')](_0x5498b1);if(_0x18f5e0){_0x19158c=_0x18f5e0[0x1];}else{_0x19158c=null;}}else{_0x19158c=null;}_0x4e339e['cb'](null,{'code':_0x502a87,'result':_0x21c426,'extra':_0x19158c});}});_0x2d5d6c['on'](_0x220a('0x18'),function(_0xcea72b){_0x328d6d[_0x220a('0x7')](_0x220a('0x18'),new AGIError(_0x220a('0x19'),_0xcea72b[_0x220a('0x1a')]));});_0x2d5d6c['on']('close',function(){_0x328d6d[_0x220a('0x7')](_0x220a('0x1b'),new AGIError(_0x220a('0x1c')));});_0x2d5d6c['on'](_0x220a('0x1d'),function(){_0x328d6d[_0x220a('0x7')](_0x220a('0x1d'),new AGIError(_0x220a('0x1e')));_0x2d5d6c[_0x220a('0x1f')]();});_0x2d5d6c[_0x220a('0x20')](_0x40766a);this[_0x220a('0x21')]=function(_0x5be1fb,_0x5e6979){var _0x5be1fb=_0x5be1fb||'',_0x5e6979=typeof _0x5e6979==_0x220a('0xe')?_0x5e6979:new Function();_0x4e339e={'tx':_0x5be1fb,'rx':'','cb':_0x5e6979};_0x2d5d6c[_0x220a('0x22')](_0x5be1fb+'\x0a');},this[_0x220a('0x1b')]=function(){_0x2d5d6c[_0x220a('0x1f')]();};}util[_0x220a('0x23')](AGIChannel,EventEmitter);AGIChannel[_0x220a('0x24')][_0x220a('0x25')]=function(_0x4f2ca1){return this[_0x220a('0x21')]['sync'](this,_0x4f2ca1);};AGIChannel[_0x220a('0x24')]['answer']=function(){return this[_0x220a('0x25')](_0x220a('0x26'));};AGIChannel[_0x220a('0x24')][_0x220a('0x27')]=function(_0x4378b2,_0x3ca893,_0x5be801){_0x4378b2=_0x4378b2===undefined?_0x220a('0x28'):_0x4378b2;_0x3ca893=_0x3ca893===undefined?'5':_0x3ca893;_0x5be801=_0x5be801===undefined?'1':_0x5be801;return this['sendRequest'](util[_0x220a('0x29')](_0x220a('0x2a'),_0x4378b2,_0x3ca893*0x3e8,_0x5be801));};AGIChannel[_0x220a('0x24')][_0x220a('0x2b')]=function(_0xc0225b){_0xc0225b=_0xc0225b||_0x220a('0x2c');return this[_0x220a('0x25')](util[_0x220a('0x29')](_0x220a('0x2d'),_0xc0225b));};AGIChannel[_0x220a('0x24')][_0x220a('0x2e')]=function(_0x573b2a,_0x324415){if(_[_0x220a('0x2f')](_0x324415)){return this[_0x220a('0x25')](util[_0x220a('0x29')](_0x220a('0x30'),_0x573b2a,_0x324415[_0x220a('0x31')](',')));}return this[_0x220a('0x25')](util[_0x220a('0x29')]('EXEC\x20%s\x20%s',_0x573b2a,_0x324415));};AGIChannel[_0x220a('0x24')][_0x220a('0x32')]=function(_0x4fb37e){return this[_0x220a('0x25')](util[_0x220a('0x29')](_0x220a('0x33'),_0x4fb37e));};AGIChannel['prototype']['setExtension']=function(_0x2f7826){return this[_0x220a('0x25')](util[_0x220a('0x29')](_0x220a('0x34'),_0x2f7826));};AGIChannel[_0x220a('0x24')][_0x220a('0x35')]=function(_0x14ee00){return this[_0x220a('0x25')](util['format'](_0x220a('0x36'),_0x14ee00));};AGIChannel['prototype'][_0x220a('0xb')]=function(){return this[_0x220a('0x25')](_0x220a('0x37'));};AGIChannel[_0x220a('0x24')][_0x220a('0x38')]=function(_0x48cda,_0x1c32dc){var _0x451972=_[_0x220a('0x39')](_0x1c32dc)||_[_0x220a('0x3a')](_0x1c32dc)?_0x1c32dc[_0x220a('0x3b')]():_0x1c32dc;return this[_0x220a('0x25')](util[_0x220a('0x29')](_0x220a('0x3c'),_0x48cda,_0x451972?_0x451972['toString']()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x220a('0x24')][_0x220a('0x3d')]=function(_0x502b49,_0x3f27b2){return this[_0x220a('0x25')](util[_0x220a('0x29')](_0x220a('0x3e'),_0x502b49,_0x3f27b2));};AGIChannel[_0x220a('0x24')][_0x220a('0x3f')]=function(_0x1efec4,_0x3028a1){return this['sendRequest'](util['format'](_0x220a('0x40'),_0x1efec4,_0x3028a1));};AGIChannel[_0x220a('0x24')][_0x220a('0x41')]=function(_0x423ae7,_0x1d1fdd){return this[_0x220a('0x25')](util['format'](_0x220a('0x42'),_0x423ae7,_0x1d1fdd));};AGIChannel[_0x220a('0x24')]['continueAt']=function(_0x6da1dc,_0x2f2d39,_0x331efa){_0x2f2d39=_0x2f2d39||this[_0x220a('0x43')];_0x331efa=_0x331efa||0x1;this[_0x220a('0x32')](_0x6da1dc);this[_0x220a('0x44')](_0x2f2d39);this[_0x220a('0x35')](_0x331efa);return this[_0x220a('0x2b')](util[_0x220a('0x29')]('GOTO\x20%s\x20%s\x20%s',_0x6da1dc,_0x2f2d39,_0x331efa));};AGIChannel['prototype'][_0x220a('0x45')]=function(_0x5e7f71){return this['sendRequest'](util[_0x220a('0x29')](_0x220a('0x46'),_0x5e7f71));};AGIChannel[_0x220a('0x24')][_0x220a('0x47')]=function(_0x3421a5,_0x4d6122,_0x122316,_0x1f53c6,_0x419b0b,_0x17162d){_0x4d6122=_0x4d6122||_0x220a('0x48');_0x122316=_0x122316||'';_0x1f53c6=_0x1f53c6===undefined?-0x1:_0x1f53c6==='-1'?-0x1:_0x1f53c6*0x3e8;_0x419b0b=_0x419b0b===undefined?'':'s='+_0x419b0b;_0x17162d=_0x17162d?'BEEP':'';return this[_0x220a('0x25')](util['format'](_0x220a('0x49'),_0x3421a5,_0x4d6122,_0x122316,_0x1f53c6,_0x17162d,_0x419b0b));};AGIChannel['prototype'][_0x220a('0x4a')]=function(_0x4515ae,_0x26c29b){_0x26c29b=_0x26c29b||'';return this[_0x220a('0x25')](util['format']('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x4515ae,_0x26c29b));};AGIChannel[_0x220a('0x24')][_0x220a('0x4b')]=function(_0x468594){return this[_0x220a('0x2e')]('AGI',_0x468594);};AGIChannel[_0x220a('0x24')][_0x220a('0x4c')]=function(_0x34281b){return this[_0x220a('0x2e')](_0x220a('0x4d'),_0x34281b);};AGIChannel['prototype']['error']=function(_0x5de2b6,_0x481fed){this[_0x220a('0x2b')](util[_0x220a('0x29')](_0x220a('0x4e'),_0x5de2b6['id'],_0x5de2b6[_0x220a('0x4f')],_0x481fed));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x220a('0x50')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 4252e60..82539de 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 _0x6321=['Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','apply','message','name','exports','util','Server\x20error.\x20Code:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20closed.','Empty\x20command.'];(function(_0x5bcf1d,_0x4ddf5d){var _0x10655a=function(_0x2cbcc0){while(--_0x2cbcc0){_0x5bcf1d['push'](_0x5bcf1d['shift']());}};_0x10655a(++_0x4ddf5d);}(_0x6321,0xe9));var _0x1632=function(_0x291780,_0x2fc1d8){_0x291780=_0x291780-0x0;var _0x58dae5=_0x6321[_0x291780];return _0x58dae5;};'use strict';var util=require(_0x1632('0x0'));var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':_0x1632('0x1'),'E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':_0x1632('0x2'),'E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':_0x1632('0x3'),'E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':_0x1632('0x4'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x1632('0x5'),'E_AGI_IVR_ENTRY':_0x1632('0x6')};function AGIError(_0x165947){var _0x165947=_0x165947||null,_0x22723c=_0x22723c||[],_0x33576c=0x1,_0x509b99='';if(!error[_0x165947]){_0x165947=_0x1632('0x7');}_0x22723c[_0x1632('0x8')](error[_0x165947]);while(arguments[_0x33576c]){_0x22723c[_0x1632('0x8')](arguments[_0x33576c]);_0x33576c++;}_0x509b99=util[_0x1632('0x9')][_0x1632('0xa')](util,_0x22723c);this[_0x1632('0xb')]=_0x509b99;this[_0x1632('0xc')]=_0x165947;}module[_0x1632('0xd')]=AGIError; \ No newline at end of file +var _0xfef2=['Empty\x20command.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','apply','message','name','exports','util','Undefined\x20error.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20closed.','Socket\x20timeout.'];(function(_0x3b56c0,_0xe100d8){var _0x377efe=function(_0x181589){while(--_0x181589){_0x3b56c0['push'](_0x3b56c0['shift']());}};_0x377efe(++_0xe100d8);}(_0xfef2,0x199));var _0x2fef=function(_0x538bd3,_0x1e3c75){_0x538bd3=_0x538bd3-0x0;var _0x5e2fd7=_0xfef2[_0x538bd3];return _0x5e2fd7;};'use strict';var util=require(_0x2fef('0x0'));var error={'E_AGI_UNDEFINED':_0x2fef('0x1'),'E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':_0x2fef('0x2'),'E_AGI_SERVER_MAXCONNECTION':_0x2fef('0x3'),'E_AGI_SERVER_VOICE_DISABLED':_0x2fef('0x4'),'E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':_0x2fef('0x5'),'E_AGI_SOCKET_TIMEOUT':_0x2fef('0x6'),'E_AGI_COMMAND_EMPTY':_0x2fef('0x7'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':_0x2fef('0x8')};function AGIError(_0x320452){var _0x320452=_0x320452||null,_0x1ca0d1=_0x1ca0d1||[],_0x334a4a=0x1,_0xae9a94='';if(!error[_0x320452]){_0x320452=_0x2fef('0x9');}_0x1ca0d1[_0x2fef('0xa')](error[_0x320452]);while(arguments[_0x334a4a]){_0x1ca0d1[_0x2fef('0xa')](arguments[_0x334a4a]);_0x334a4a++;}_0xae9a94=util[_0x2fef('0xb')][_0x2fef('0xc')](util,_0x1ca0d1);this[_0x2fef('0xd')]=_0xae9a94;this[_0x2fef('0xe')]=_0x320452;}module[_0x2fef('0xf')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index 6c92826..a2e98f3 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 _0xa3bc=['lodash','events','ioredis','./error','../../config/environment','redis','defaults','localhost','subscribe','agi','emit','error','E_AGI_SERVER_ERROR','message','parse','projectUpdate','exports'];(function(_0x432ccd,_0x51dbdc){var _0x4c56c6=function(_0xbc77ad){while(--_0xbc77ad){_0x432ccd['push'](_0x432ccd['shift']());}};_0x4c56c6(++_0x51dbdc);}(_0xa3bc,0x1dc));var _0xca3b=function(_0x280377,_0x453032){_0x280377=_0x280377-0x0;var _0x2e6703=_0xa3bc[_0x280377];return _0x2e6703;};'use strict';var _=require(_0xca3b('0x0'));var EventEmitter=require(_0xca3b('0x1'))['EventEmitter'];var Redis=require(_0xca3b('0x2'));var AGIError=require(_0xca3b('0x3'));var config=require(_0xca3b('0x4'));config[_0xca3b('0x5')]=_[_0xca3b('0x6')](config[_0xca3b('0x5')],{'host':_0xca3b('0x7'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0xca3b('0x5')]);sub[_0xca3b('0x8')](_0xca3b('0x9'),function(_0x374184){if(_0x374184)return eventEmitter[_0xca3b('0xa')](_0xca3b('0xb'),new AGIError(_0xca3b('0xc'),_0x374184));});sub['on'](_0xca3b('0xd'),function(_0x297da7,_0x33b569){if(_0x297da7!=='agi')return;try{var _0x5eaee3=JSON[_0xca3b('0xe')](_0x33b569);eventEmitter[_0xca3b('0xa')](_0xca3b('0xf'),_0x5eaee3);}catch(_0x85d3e0){eventEmitter[_0xca3b('0xa')]('error',new AGIError(_0xca3b('0xc'),_0x85d3e0));}});module[_0xca3b('0x10')]={'EventEmitter':eventEmitter}; \ No newline at end of file +var _0xba96=['./error','../../config/environment','redis','subscribe','agi','emit','error','parse','exports','events','EventEmitter','ioredis'];(function(_0x44e50a,_0x1cc4a2){var _0x1b5994=function(_0x29a487){while(--_0x29a487){_0x44e50a['push'](_0x44e50a['shift']());}};_0x1b5994(++_0x1cc4a2);}(_0xba96,0x111));var _0x6ba9=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xba96[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var EventEmitter=require(_0x6ba9('0x0'))[_0x6ba9('0x1')];var Redis=require(_0x6ba9('0x2'));var AGIError=require(_0x6ba9('0x3'));var config=require(_0x6ba9('0x4'));config[_0x6ba9('0x5')]=_['defaults'](config[_0x6ba9('0x5')],{'host':'localhost','port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config['redis']);sub[_0x6ba9('0x6')](_0x6ba9('0x7'),function(_0x3f7a58){if(_0x3f7a58)return eventEmitter[_0x6ba9('0x8')](_0x6ba9('0x9'),new AGIError('E_AGI_SERVER_ERROR',_0x3f7a58));});sub['on']('message',function(_0x527124,_0x46afc2){if(_0x527124!==_0x6ba9('0x7'))return;try{var _0x46a724=JSON[_0x6ba9('0xa')](_0x46afc2);eventEmitter[_0x6ba9('0x8')]('projectUpdate',_0x46a724);}catch(_0x266437){eventEmitter[_0x6ba9('0x8')](_0x6ba9('0x9'),new AGIError('E_AGI_SERVER_ERROR',_0x266437));}});module[_0x6ba9('0xb')]={'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 aec4ffc..c391960 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 _0x4dfd=['../../../config/logger','menu','getdigits','getsecretdigits','vertices','edges','numberOfEdges','prototype','addVertex','addEdge','push','size','relations','getVertex','traverseBFS','info','no\x20vertex\x20found','stop\x20traverse','length','no\x20edge/s\x20available','condition','split','agicommand','vswitch','target','default','max\x20retry\x20reach','condition\x20not\x20found','exports','lodash'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4dfd,0xef));var _0xd4df=function(_0x430ab4,_0x3fed35){_0x430ab4=_0x430ab4-0x0;var _0x31bbb5=_0x4dfd[_0x430ab4];return _0x31bbb5;};'use strict';var _=require(_0xd4df('0x0'));var logger=require(_0xd4df('0x1'))('agi');var verticesWithRetry=[_0xd4df('0x2'),_0xd4df('0x3'),_0xd4df('0x4')];var Graph=function(){this[_0xd4df('0x5')]={};this[_0xd4df('0x6')]={};this[_0xd4df('0x7')]=0x0;};Graph[_0xd4df('0x8')][_0xd4df('0x9')]=function(_0x2de5cb){this[_0xd4df('0x5')][_0x2de5cb['id']]=_0x2de5cb;this[_0xd4df('0x6')][_0x2de5cb['id']]=[];};Graph[_0xd4df('0x8')][_0xd4df('0xa')]=function(_0x18dcb7,_0x198468,_0x4e08de){this[_0xd4df('0x6')][_0x18dcb7][_0xd4df('0xb')]({'target':_0x198468,'condition':_0x4e08de});this[_0xd4df('0x7')]+=0x1;};Graph['prototype'][_0xd4df('0xc')]=function(){return _['size'](this['vertices']);};Graph[_0xd4df('0x8')][_0xd4df('0xd')]=function(){return this['numberOfEdges'];};Graph[_0xd4df('0x8')][_0xd4df('0xe')]=function(_0xbed544){return this[_0xd4df('0x5')][_0xbed544];};Graph[_0xd4df('0x8')][_0xd4df('0xf')]=function(_0x323990,_0x580cca){if(!this[_0xd4df('0x5')][_0x323990]){return logger[_0xd4df('0x10')](_0xd4df('0x11'));}var _0xc9ec44=_0x580cca(this[_0xd4df('0x5')][_0x323990]);if(!_0xc9ec44){return logger[_0xd4df('0x10')](_0xd4df('0x12'));}if(this[_0xd4df('0x6')][_0x323990][_0xd4df('0x13')]===0x0){return logger[_0xd4df('0x10')](_0xd4df('0x14'));}for(var _0x1f38e9=0x0,_0x5b3f12=[],_0x324b0d=![];_0x1f38e9\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','dnid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','uniqueid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','createSquareReport','then','catch','hasOwnProperty','indexOf','substring','debug','variables','stringify','calleridname','close','timeout','hangup','handleUnpublished','initialize','voice','callysquare','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','./server','listening','connection','lodash','syncho','util','../../config/environment','agi','./project','./events','EventEmitter','projectUpdate','nextTick','stack','findIndex','deleted','splice','push'];(function(_0x4b6bfe,_0x4356cb){var _0x1ceecc=function(_0x192914){while(--_0x192914){_0x4b6bfe['push'](_0x4b6bfe['shift']());}};_0x1ceecc(++_0x4356cb);}(_0xd95c,0x65));var _0xcd95=function(_0x1c3cbe,_0x2725e4){_0x1c3cbe=_0x1c3cbe-0x0;var _0x4aee5d=_0xd95c[_0x1c3cbe];return _0x4aee5d;};'use strict';var _=require(_0xcd95('0x0'));var syncho=require(_0xcd95('0x1'));var util=require(_0xcd95('0x2'));var config=require(_0xcd95('0x3'));var logger=require('../../config/logger')(_0xcd95('0x4'));var utilLicense=require('../../config/license/util');var rpc=require('./rpc');var Project=require(_0xcd95('0x5'));var AGIEmitter=require(_0xcd95('0x6'))[_0xcd95('0x7')];var projects=[];config['agi']=_['defaults'](config[_0xcd95('0x4')],{'ip':'127.0.0.1','port':0x11dd});AGIEmitter['on'](_0xcd95('0x8'),projectUpdateHandler);function connectionHandler(_0x22f791){process[_0xcd95('0x9')](function(){syncho(function(){try{setChannelVariables(_0x22f791);agiHandler(_0x22f791);}catch(_0x2658cd){logger['error'](_0x2658cd[_0xcd95('0xa')]);}});});}function projectUpdateHandler(_0x56560b){try{var _0x2b7c5b=_[_0xcd95('0xb')](projects,['id',_0x56560b['id']]);if(_0x2b7c5b>-0x1){if(_0x56560b[_0xcd95('0xc')]===!![]){projects[_0xcd95('0xd')](_0x2b7c5b,0x1);}else{projects[_0x2b7c5b]=_0x56560b;}}else{projects[_0xcd95('0xe')](_0x56560b);}}catch(_0xd5c4f2){logger['error'](_0xd5c4f2[_0xcd95('0xa')]);}}function listeningHandler(){var _0xdfe4e1=config[_0xcd95('0xf')]===_0xcd95('0x10')||![];console['log'](_0xcd95('0x11'),config['agi']['port']);logger[_0xcd95('0x12')](util[_0xcd95('0x13')]('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',_0xdfe4e1?config['agi']['ip']:_0xcd95('0x14'),config[_0xcd95('0x4')][_0xcd95('0x15')]));}function errorHandler(_0x19acf1){if(_0x19acf1&&_0x19acf1[_0xcd95('0x16')]&&_0x19acf1['message']){logger[_0xcd95('0x17')](util[_0xcd95('0x13')](_0xcd95('0x18'),_0x19acf1[_0xcd95('0x16')],_0x19acf1[_0xcd95('0x19')]));}else{logger['error'](util[_0xcd95('0x13')](_0xcd95('0x1a'),_0x19acf1[_0xcd95('0xa')]));}}function closeHandler(){logger[_0xcd95('0x12')](util['format'](_0xcd95('0x1b'),this[_0xcd95('0x1c')],this['calleridname'],this['callerid'],this[_0xcd95('0x1d')],this['uniqueid']));try{createSquareReport(this);}catch(_0x32457e){logger['error'](_0x32457e['stack']);}}function timeoutHandler(){logger[_0xcd95('0x12')](util[_0xcd95('0x13')](_0xcd95('0x1e'),this[_0xcd95('0x1c')],this['calleridname'],this[_0xcd95('0x1f')],this['dnid'],this[_0xcd95('0x20')]));}function hangupHandler(){logger['info'](util['format'](_0xcd95('0x21'),this['arg_1'],this['calleridname'],this['callerid'],this[_0xcd95('0x1d')],this[_0xcd95('0x20')]));this[_0xcd95('0x22')]=!![];}function createSquareReport(_0x3177bb,_0x36da85){rpc[_0xcd95('0x23')](_0x3177bb)[_0xcd95('0x24')](function(_0x1bffa3){if(_0x36da85){_0x36da85(null,_0x1bffa3);}})[_0xcd95('0x25')](function(_0x4b1d40){if(_0x36da85){_0x36da85(null,_0x4b1d40);}});}function setChannelVariables(_0x46701d){for(var _0x10b3ea in _0x46701d){if(_0x46701d[_0xcd95('0x26')](_0x10b3ea)){if(_0x10b3ea[_0xcd95('0x27')]('agi_')===0x0){_0x46701d[_0x10b3ea[_0xcd95('0x28')](0x4)]=_0x46701d[_0x10b3ea];delete _0x46701d[_0x10b3ea];}}}}function agiHandler(_0x42b203){logger[_0xcd95('0x29')](_0xcd95('0x2a'),JSON[_0xcd95('0x2b')](_0x42b203,null,0x2));logger['info'](util[_0xcd95('0x13')]('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x42b203[_0xcd95('0x1c')],_0x42b203[_0xcd95('0x2c')],_0x42b203[_0xcd95('0x1f')],_0x42b203['dnid'],_0x42b203['uniqueid']));_0x42b203['on'](_0xcd95('0x17'),errorHandler);_0x42b203['on'](_0xcd95('0x2d'),closeHandler);_0x42b203['on'](_0xcd95('0x2e'),timeoutHandler);_0x42b203[_0xcd95('0x22')]=![];_0x42b203['on'](_0xcd95('0x2f'),hangupHandler);var _0x1c7f1b=_['find'](projects,[_0xcd95('0x16'),_0x42b203['arg_1']]);if(!_0x1c7f1b)return Project['handleNotFound'](_0x42b203);if(!_0x1c7f1b['production'])return Project[_0xcd95('0x30')](_0x42b203);return Project[_0xcd95('0x31')](_0x1c7f1b,_0x42b203);}function main(){var _0x2f525d;return utilLicense['getLicense']()[_0xcd95('0x24')](function(_0x5ad2ea){if(!_0x5ad2ea)return;if(_0x5ad2ea[_0xcd95('0x32')]){if(_0x5ad2ea[_0xcd95('0x33')]&&_0x5ad2ea[_0xcd95('0x33')]>0x0){logger[_0xcd95('0x12')](util['format']('[LICENSE]\x20CHANNELS:\x20%s',_0x5ad2ea[_0xcd95('0x33')]));_0x2f525d=_0x5ad2ea[_0xcd95('0x33')];}else{logger['info'](_0xcd95('0x34'));}}else{logger[_0xcd95('0x12')](_0xcd95('0x35'));_0x2f525d=-0x1;}})['then'](function(){return Project['getAll']();})['then'](function(_0x41f876){projects=_0x41f876;return;})[_0xcd95('0x25')](function(_0xd4a7d9){logger['error'](_0xcd95('0x36'),_0xd4a7d9[_0xcd95('0xa')]);})['finally'](function(){var _0x5bbd72=require(_0xcd95('0x37'))(config[_0xcd95('0x4')]['port'],config['agi']['ip'],_0x2f525d);_0x5bbd72['on'](_0xcd95('0x17'),errorHandler);_0x5bbd72['on'](_0xcd95('0x38'),listeningHandler);_0x5bbd72['on'](_0xcd95('0x39'),connectionHandler);_0x5bbd72['on']('close',closeHandler);});}main(); \ No newline at end of file +var _0x11ef=['splice','stack','env','production','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','createSquareReport','then','catch','hasOwnProperty','agi_','substring','debug','variables','stringify','close','timeout','hangup','find','handleNotFound','handleUnpublished','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','getAll','[LICENSE]','finally','./server','listening','connection','lodash','syncho','util','../../config/environment','../../config/license/util','./project','EventEmitter','agi','defaults','127.0.0.1','nextTick','error','findIndex','deleted'];(function(_0x22aabe,_0x1667d4){var _0x7ae05=function(_0x3c3440){while(--_0x3c3440){_0x22aabe['push'](_0x22aabe['shift']());}};_0x7ae05(++_0x1667d4);}(_0x11ef,0x196));var _0xf11e=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x11ef[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0xf11e('0x0'));var syncho=require(_0xf11e('0x1'));var util=require(_0xf11e('0x2'));var config=require(_0xf11e('0x3'));var logger=require('../../config/logger')('agi');var utilLicense=require(_0xf11e('0x4'));var rpc=require('./rpc');var Project=require(_0xf11e('0x5'));var AGIEmitter=require('./events')[_0xf11e('0x6')];var projects=[];config[_0xf11e('0x7')]=_[_0xf11e('0x8')](config[_0xf11e('0x7')],{'ip':_0xf11e('0x9'),'port':0x11dd});AGIEmitter['on']('projectUpdate',projectUpdateHandler);function connectionHandler(_0x291529){process[_0xf11e('0xa')](function(){syncho(function(){try{setChannelVariables(_0x291529);agiHandler(_0x291529);}catch(_0x3f13b9){logger[_0xf11e('0xb')](_0x3f13b9['stack']);}});});}function projectUpdateHandler(_0x4efc9b){try{var _0x2d5e4c=_[_0xf11e('0xc')](projects,['id',_0x4efc9b['id']]);if(_0x2d5e4c>-0x1){if(_0x4efc9b[_0xf11e('0xd')]===!![]){projects[_0xf11e('0xe')](_0x2d5e4c,0x1);}else{projects[_0x2d5e4c]=_0x4efc9b;}}else{projects['push'](_0x4efc9b);}}catch(_0x396a0a){logger[_0xf11e('0xb')](_0x396a0a[_0xf11e('0xf')]);}}function listeningHandler(){var _0x90bebd=config[_0xf11e('0x10')]===_0xf11e('0x11')||![];console[_0xf11e('0x12')](_0xf11e('0x13'),config[_0xf11e('0x7')][_0xf11e('0x14')]);logger[_0xf11e('0x15')](util[_0xf11e('0x16')](_0xf11e('0x17'),_0x90bebd?config[_0xf11e('0x7')]['ip']:'host.docker.internal',config[_0xf11e('0x7')][_0xf11e('0x14')]));}function errorHandler(_0x581e51){if(_0x581e51&&_0x581e51[_0xf11e('0x18')]&&_0x581e51[_0xf11e('0x19')]){logger[_0xf11e('0xb')](util[_0xf11e('0x16')]('[%s]\x20%s',_0x581e51[_0xf11e('0x18')],_0x581e51[_0xf11e('0x19')]));}else{logger[_0xf11e('0xb')](util['format'](_0xf11e('0x1a'),_0x581e51[_0xf11e('0xf')]));}}function closeHandler(){logger['info'](util[_0xf11e('0x16')](_0xf11e('0x1b'),this['arg_1'],this['calleridname'],this['callerid'],this[_0xf11e('0x1c')],this[_0xf11e('0x1d')]));try{createSquareReport(this);}catch(_0x55b96b){logger[_0xf11e('0xb')](_0x55b96b[_0xf11e('0xf')]);}}function timeoutHandler(){logger[_0xf11e('0x15')](util[_0xf11e('0x16')](_0xf11e('0x1e'),this[_0xf11e('0x1f')],this[_0xf11e('0x20')],this[_0xf11e('0x21')],this[_0xf11e('0x1c')],this[_0xf11e('0x1d')]));}function hangupHandler(){logger[_0xf11e('0x15')](util['format'](_0xf11e('0x22'),this[_0xf11e('0x1f')],this[_0xf11e('0x20')],this[_0xf11e('0x21')],this[_0xf11e('0x1c')],this['uniqueid']));this[_0xf11e('0x23')]=!![];}function createSquareReport(_0xec02cd,_0x39f79f){rpc[_0xf11e('0x24')](_0xec02cd)[_0xf11e('0x25')](function(_0x2db49e){if(_0x39f79f){_0x39f79f(null,_0x2db49e);}})[_0xf11e('0x26')](function(_0x40d0d9){if(_0x39f79f){_0x39f79f(null,_0x40d0d9);}});}function setChannelVariables(_0x44c314){for(var _0xf049c6 in _0x44c314){if(_0x44c314[_0xf11e('0x27')](_0xf049c6)){if(_0xf049c6['indexOf'](_0xf11e('0x28'))===0x0){_0x44c314[_0xf049c6[_0xf11e('0x29')](0x4)]=_0x44c314[_0xf049c6];delete _0x44c314[_0xf049c6];}}}}function agiHandler(_0x59d5ac){logger[_0xf11e('0x2a')](_0xf11e('0x2b'),JSON[_0xf11e('0x2c')](_0x59d5ac,null,0x2));logger[_0xf11e('0x15')](util[_0xf11e('0x16')]('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x59d5ac[_0xf11e('0x1f')],_0x59d5ac[_0xf11e('0x20')],_0x59d5ac[_0xf11e('0x21')],_0x59d5ac[_0xf11e('0x1c')],_0x59d5ac[_0xf11e('0x1d')]));_0x59d5ac['on']('error',errorHandler);_0x59d5ac['on'](_0xf11e('0x2d'),closeHandler);_0x59d5ac['on'](_0xf11e('0x2e'),timeoutHandler);_0x59d5ac['evtHangup']=![];_0x59d5ac['on'](_0xf11e('0x2f'),hangupHandler);var _0x559c53=_[_0xf11e('0x30')](projects,[_0xf11e('0x18'),_0x59d5ac[_0xf11e('0x1f')]]);if(!_0x559c53)return Project[_0xf11e('0x31')](_0x59d5ac);if(!_0x559c53[_0xf11e('0x11')])return Project[_0xf11e('0x32')](_0x59d5ac);return Project['initialize'](_0x559c53,_0x59d5ac);}function main(){var _0x2992c1;return utilLicense['getLicense']()[_0xf11e('0x25')](function(_0x4ca9a8){if(!_0x4ca9a8)return;if(_0x4ca9a8['voice']){if(_0x4ca9a8[_0xf11e('0x33')]&&_0x4ca9a8[_0xf11e('0x33')]>0x0){logger[_0xf11e('0x15')](util[_0xf11e('0x16')](_0xf11e('0x34'),_0x4ca9a8[_0xf11e('0x33')]));_0x2992c1=_0x4ca9a8['callysquare'];}else{logger[_0xf11e('0x15')](_0xf11e('0x35'));}}else{logger[_0xf11e('0x15')]('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x2992c1=-0x1;}})['then'](function(){return Project[_0xf11e('0x36')]();})[_0xf11e('0x25')](function(_0x4db2e4){projects=_0x4db2e4;return;})[_0xf11e('0x26')](function(_0x1bd564){logger[_0xf11e('0xb')](_0xf11e('0x37'),_0x1bd564[_0xf11e('0xf')]);})[_0xf11e('0x38')](function(){var _0x3facc6=require(_0xf11e('0x39'))(config[_0xf11e('0x7')][_0xf11e('0x14')],config[_0xf11e('0x7')]['ip'],_0x2992c1);_0x3facc6['on'](_0xf11e('0xb'),errorHandler);_0x3facc6['on'](_0xf11e('0x3a'),listeningHandler);_0x3facc6['on'](_0xf11e('0x3b'),connectionHandler);_0x3facc6['on'](_0xf11e('0x2d'),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 22e2d27..3bf69aa 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 _0x048d=['bluebird','client','http','request','error','message','result','sendMailMessage','SendMail'];(function(_0x46f804,_0x4e5334){var _0x20b6c9=function(_0x1d4140){while(--_0x1d4140){_0x46f804['push'](_0x46f804['shift']());}};_0x20b6c9(++_0x4e5334);}(_0x048d,0x171));var _0xd048=function(_0x49fda7,_0x1d84db){_0x49fda7=_0x49fda7-0x0;var _0x4c6f1f=_0x048d[_0x49fda7];return _0x4c6f1f;};'use strict';var BPromise=require(_0xd048('0x0'));var jayson=require('jayson/promise');var client=jayson[_0xd048('0x1')][_0xd048('0x2')]({'port':0x232b});function request(_0x14b00c,_0x2aa602){return new BPromise(function(_0x1d7f5b,_0x3933e5){return client[_0xd048('0x3')](_0x14b00c,_0x2aa602)['then'](function(_0x1b327f){if(_0x1b327f[_0xd048('0x4')]){return _0x3933e5(_0x1b327f[_0xd048('0x4')][_0xd048('0x5')]);}else{return _0x1d7f5b(_0x1b327f[_0xd048('0x6')]);}})['catch'](function(_0x59469c){return _0x3933e5(_0x59469c);});});}exports[_0xd048('0x7')]=function(_0x131252,_0x5733bb){return request(_0xd048('0x8'),{'account':_0x131252,'message':_0x5733bb});}; \ No newline at end of file +var _0xedab=['then','error','result','catch','sendMailMessage','bluebird','jayson/promise','client','http','request'];(function(_0x525af9,_0x4edd23){var _0x129fbf=function(_0x4f44fe){while(--_0x4f44fe){_0x525af9['push'](_0x525af9['shift']());}};_0x129fbf(++_0x4edd23);}(_0xedab,0x163));var _0xbeda=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0xedab[_0x21549c];return _0x426cbd;};'use strict';var BPromise=require(_0xbeda('0x0'));var jayson=require(_0xbeda('0x1'));var client=jayson[_0xbeda('0x2')][_0xbeda('0x3')]({'port':0x232b});function request(_0x311809,_0x54381e){return new BPromise(function(_0x2cc050,_0x44a22a){return client[_0xbeda('0x4')](_0x311809,_0x54381e)[_0xbeda('0x5')](function(_0x5ebf3d){if(_0x5ebf3d[_0xbeda('0x6')]){return _0x44a22a(_0x5ebf3d[_0xbeda('0x6')]['message']);}else{return _0x2cc050(_0x5ebf3d[_0xbeda('0x7')]);}})[_0xbeda('0x8')](function(_0x8047e9){return _0x44a22a(_0x8047e9);});});}exports[_0xbeda('0x9')]=function(_0x35b9da,_0x439995){return request('SendMail',{'account':_0x35b9da,'message':_0x439995});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index a6d7879..361e117 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 _0x9dc4=['gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','evtHangup','result','toString','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','clear','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','continueAt','close','moment','xml2json','util','../../config/logger','agi','./rpc','./mailRpc','./graph','./vertices','getSquareProjects','error','Unable\x20to\x20download\x20CallySquare\x20projects','stack','retry','maxRetry','addVertex','mxCell','hasOwnProperty','isArray','length','addEdge','source','value','toJson','inspect','production','debug','root','stringify','format','YYYY-MM-DD\x20HH:mm:ss','info','arg_1','calleridname','dnid','uniqueid','traverseBFS','start','vertex','agicommand','gotoc'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x9dc4,0x166));var _0x49dc=function(_0x1605bc,_0x582823){_0x1605bc=_0x1605bc-0x0;var _0x48c10a=_0x9dc4[_0x1605bc];return _0x48c10a;};'use strict';var _=require('lodash');var moment=require(_0x49dc('0x0'));var parser=require(_0x49dc('0x1'));var util=require(_0x49dc('0x2'));var logger=require(_0x49dc('0x3'))(_0x49dc('0x4'));var rpc=require(_0x49dc('0x5'));var mailRpc=require(_0x49dc('0x6'));var Graph=require(_0x49dc('0x7'));var Vertices=require(_0x49dc('0x8'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x49dc('0x9')]()['catch'](function(_0x29b611){logger[_0x49dc('0xa')](_0x49dc('0xb'),_0x29b611[_0x49dc('0xc')]);return[];});}function addVertex(_0x1be2ea,_0x6b8a5c,_0x318eb6){_0x6b8a5c['agicommand']=_0x318eb6;if(_0x6b8a5c['hasOwnProperty'](_0x49dc('0xd'))){_0x6b8a5c[_0x49dc('0xe')]=parseInt(_0x6b8a5c[_0x49dc('0xd')],0xa);}_0x1be2ea[_0x49dc('0xf')](_['omit'](_0x6b8a5c,_0x49dc('0x10')));}function initGraph(_0xb8ad0d,_0x298af0){var _0x57f230=new Graph();for(var _0x2a0319 in _0xb8ad0d){if(_0xb8ad0d[_0x49dc('0x11')](_0x2a0319)){if(_[_0x49dc('0x12')](_0xb8ad0d[_0x2a0319])){for(var _0x48b5e6=0x0;_0x48b5e6<_0xb8ad0d[_0x2a0319][_0x49dc('0x13')];_0x48b5e6+=0x1){addVertex(_0x57f230,_0xb8ad0d[_0x2a0319][_0x48b5e6],_0x2a0319);}}else{addVertex(_0x57f230,_0xb8ad0d[_0x2a0319],_0x2a0319);}}}for(var _0x4ec437=0x0;_0x4ec437<_0x298af0['length'];_0x4ec437+=0x1){if(_0x298af0[_0x4ec437]['source']&&_0x298af0[_0x4ec437]['target']){_0x57f230[_0x49dc('0x14')](_0x298af0[_0x4ec437][_0x49dc('0x15')],_0x298af0[_0x4ec437]['target'],_0x298af0[_0x4ec437][_0x49dc('0x16')]);}}return _0x57f230;}function getRoot(_0x2fc3eb){return parser[_0x49dc('0x17')](_0x2fc3eb,{'object':!![]})['mxGraphModel']['root'];}function inspect(_0x532506){return util[_0x49dc('0x18')](_0x532506,{'showHidden':![],'depth':null});}function initialize(_0x470908,_0x13b512){var _0x3281fc=getRoot(_0x470908[_0x49dc('0x19')]);if(!_0x3281fc||!_0x3281fc['start'])return;var _0x15a3cd,_0x26a962,_0x525240;logger[_0x49dc('0x1a')](_0x49dc('0x1b'),JSON[_0x49dc('0x1c')](_0x3281fc,null,0x2));_0x13b512['joinAt']=moment()[_0x49dc('0x1d')](_0x49dc('0x1e'));_0x15a3cd=initGraph(_['omit'](_0x3281fc,_0x49dc('0x10')),_0x3281fc[_0x49dc('0x10')]);_0x26a962=new Vertices(_0x13b512,rpc,mailRpc);logger[_0x49dc('0x1f')](util['format']('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x13b512[_0x49dc('0x20')],_0x13b512[_0x49dc('0x21')],_0x13b512['callerid'],_0x13b512[_0x49dc('0x22')],_0x13b512[_0x49dc('0x23')]));_0x15a3cd[_0x49dc('0x24')](_0x3281fc[_0x49dc('0x25')]['id'],function(_0x3e8480){try{_0x3e8480=_0x26a962['clear'](_0x3e8480);logger[_0x49dc('0x1a')](_0x49dc('0x26'),JSON[_0x49dc('0x1c')](_0x3e8480,null,0x2));if(_0x3e8480[_0x49dc('0x27')]===_0x49dc('0x28')){logger['info'](_0x49dc('0x29'));_0x13b512[_0x49dc('0x2a')]=_0x3e8480[_0x49dc('0x2a')]||_0x13b512[_0x49dc('0x2a')];_0x13b512[_0x49dc('0x2b')]=_0x3e8480['extension'];_0x13b512[_0x49dc('0x2c')]=_0x3e8480[_0x49dc('0x2c')]?_0x3e8480[_0x49dc('0x2c')]-0x1:0x1;return null;}else if(_0x3e8480&&_0x26a962[_0x3e8480[_0x49dc('0x27')]]){_0x525240=_0x26a962[_0x3e8480[_0x49dc('0x27')]](_0x3e8480);logger[_0x49dc('0x1f')](_0x49dc('0x2d'),JSON[_0x49dc('0x1c')](_0x525240,null,0x2));if(_0x525240&&_0x525240['code']===AGI_CODE_SUCCESS&&_0x525240['result']!==AGI_RESULT_ERROR&&!_0x13b512[_0x49dc('0x2e')]){logger[_0x49dc('0x1a')](_0x49dc('0x2d'),inspect(_0x525240));return _['isUndefined'](_0x525240['result'])?null:_0x525240[_0x49dc('0x2f')][_0x49dc('0x30')]();}else{logger['error'](_0x49dc('0x2d'),inspect(_0x525240));return null;}}else{logger['error'](_0x49dc('0x31'));return null;}}catch(_0x2a7e76){logger[_0x49dc('0xa')](_0x2a7e76[_0x49dc('0xc')]);return null;}});if(_0x3281fc[_0x49dc('0x32')]){logger[_0x49dc('0x1f')](util[_0x49dc('0x1d')](_0x49dc('0x33'),_0x13b512[_0x49dc('0x20')],_0x13b512[_0x49dc('0x21')],_0x13b512[_0x49dc('0x34')],_0x13b512['dnid'],_0x13b512['uniqueid']));_0x15a3cd[_0x49dc('0x24')](_0x3281fc[_0x49dc('0x32')]['id'],function(_0x2477cc){try{_0x2477cc=_0x26a962[_0x49dc('0x35')](_0x2477cc);logger[_0x49dc('0x1a')]('vertex',JSON[_0x49dc('0x1c')](_0x2477cc,null,0x2));if(_0x2477cc&&_0x26a962[_0x2477cc[_0x49dc('0x27')]]){_0x525240=_0x26a962[_0x2477cc[_0x49dc('0x27')]](_0x2477cc);if(_0x525240){logger[_0x49dc('0x1a')](_0x49dc('0x2d'),inspect(_0x525240));return _['isUndefined'](_0x525240[_0x49dc('0x2f')])?null:_0x525240[_0x49dc('0x2f')]['toString']();}else{logger[_0x49dc('0xa')](_0x49dc('0x2d'),inspect(_0x525240));return null;}}else{logger[_0x49dc('0xa')](_0x49dc('0x31'));return null;}}catch(_0x35a0bb){logger['error'](_0x35a0bb['stack']);return null;}});}logger[_0x49dc('0x1f')](util[_0x49dc('0x1d')](_0x49dc('0x36'),_0x13b512[_0x49dc('0x20')],_0x13b512[_0x49dc('0x21')],_0x13b512[_0x49dc('0x34')],_0x13b512[_0x49dc('0x22')],_0x13b512[_0x49dc('0x23')]));logger['info'](util[_0x49dc('0x1d')]('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x13b512[_0x49dc('0x2a')],_0x13b512[_0x49dc('0x2b')],parseInt(_0x13b512['priority'],0xa)+0x1));_0x13b512[_0x49dc('0x37')](_0x13b512[_0x49dc('0x2a')],_0x13b512['extension'],parseInt(_0x13b512[_0x49dc('0x2c')],0xa)+0x1);_0x13b512['close']();}function handleNotFound(_0x57832b){logger['error'](util['format']('Project\x20%s\x20not\x20found',_0x57832b['arg_1']));_0x57832b['continueAt'](_0x57832b['context'],_0x57832b[_0x49dc('0x2b')],parseInt(_0x57832b['priority'],0xa)+0x1);_0x57832b['close']();}function handleUnpublished(_0x10f3c4){logger[_0x49dc('0xa')](util[_0x49dc('0x1d')]('Project\x20%s\x20not\x20published',_0x10f3c4[_0x49dc('0x20')]));_0x10f3c4[_0x49dc('0x37')](_0x10f3c4[_0x49dc('0x2a')],_0x10f3c4[_0x49dc('0x2b')],parseInt(_0x10f3c4[_0x49dc('0x2c')],0xa)+0x1);_0x10f3c4[_0x49dc('0x38')]();}module['exports']={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +var _0x6b38=['agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','clear','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','Project\x20%s\x20not\x20found','Project\x20%s\x20not\x20published','exports','lodash','moment','xml2json','util','../../config/logger','agi','./rpc','./mailRpc','./graph','./vertices','getSquareProjects','catch','Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand','retry','addVertex','hasOwnProperty','isArray','length','source','target','addEdge','value','toJson','root','inspect','production','debug','stringify','joinAt','format','YYYY-MM-DD\x20HH:mm:ss','omit','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','dnid','uniqueid','traverseBFS','vertex','gotoc','context','extension','priority','response','code','result','evtHangup','toString','error'];(function(_0x133779,_0x8707c2){var _0x42e8f3=function(_0x1fa149){while(--_0x1fa149){_0x133779['push'](_0x133779['shift']());}};_0x42e8f3(++_0x8707c2);}(_0x6b38,0x144));var _0x86b3=function(_0x34e169,_0x3b2c31){_0x34e169=_0x34e169-0x0;var _0x43877b=_0x6b38[_0x34e169];return _0x43877b;};'use strict';var _=require(_0x86b3('0x0'));var moment=require(_0x86b3('0x1'));var parser=require(_0x86b3('0x2'));var util=require(_0x86b3('0x3'));var logger=require(_0x86b3('0x4'))(_0x86b3('0x5'));var rpc=require(_0x86b3('0x6'));var mailRpc=require(_0x86b3('0x7'));var Graph=require(_0x86b3('0x8'));var Vertices=require(_0x86b3('0x9'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x86b3('0xa')]()[_0x86b3('0xb')](function(_0x249f54){logger['error'](_0x86b3('0xc'),_0x249f54[_0x86b3('0xd')]);return[];});}function addVertex(_0x3b92e1,_0xf3553,_0x9ab9ec){_0xf3553[_0x86b3('0xe')]=_0x9ab9ec;if(_0xf3553['hasOwnProperty'](_0x86b3('0xf'))){_0xf3553['maxRetry']=parseInt(_0xf3553[_0x86b3('0xf')],0xa);}_0x3b92e1[_0x86b3('0x10')](_['omit'](_0xf3553,'mxCell'));}function initGraph(_0x1583e0,_0x3353eb){var _0x45fa15=new Graph();for(var _0x4abae6 in _0x1583e0){if(_0x1583e0[_0x86b3('0x11')](_0x4abae6)){if(_[_0x86b3('0x12')](_0x1583e0[_0x4abae6])){for(var _0x641866=0x0;_0x641866<_0x1583e0[_0x4abae6][_0x86b3('0x13')];_0x641866+=0x1){addVertex(_0x45fa15,_0x1583e0[_0x4abae6][_0x641866],_0x4abae6);}}else{addVertex(_0x45fa15,_0x1583e0[_0x4abae6],_0x4abae6);}}}for(var _0x58f6e1=0x0;_0x58f6e1<_0x3353eb['length'];_0x58f6e1+=0x1){if(_0x3353eb[_0x58f6e1][_0x86b3('0x14')]&&_0x3353eb[_0x58f6e1][_0x86b3('0x15')]){_0x45fa15[_0x86b3('0x16')](_0x3353eb[_0x58f6e1]['source'],_0x3353eb[_0x58f6e1][_0x86b3('0x15')],_0x3353eb[_0x58f6e1][_0x86b3('0x17')]);}}return _0x45fa15;}function getRoot(_0x134024){return parser[_0x86b3('0x18')](_0x134024,{'object':!![]})['mxGraphModel'][_0x86b3('0x19')];}function inspect(_0x8128f1){return util[_0x86b3('0x1a')](_0x8128f1,{'showHidden':![],'depth':null});}function initialize(_0x3d0b28,_0x5b72f6){var _0x447700=getRoot(_0x3d0b28[_0x86b3('0x1b')]);if(!_0x447700||!_0x447700['start'])return;var _0xd4c709,_0x19df02,_0x3be4b5;logger[_0x86b3('0x1c')](_0x86b3('0x19'),JSON[_0x86b3('0x1d')](_0x447700,null,0x2));_0x5b72f6[_0x86b3('0x1e')]=moment()[_0x86b3('0x1f')](_0x86b3('0x20'));_0xd4c709=initGraph(_[_0x86b3('0x21')](_0x447700,_0x86b3('0x22')),_0x447700[_0x86b3('0x22')]);_0x19df02=new Vertices(_0x5b72f6,rpc,mailRpc);logger[_0x86b3('0x23')](util['format'](_0x86b3('0x24'),_0x5b72f6[_0x86b3('0x25')],_0x5b72f6[_0x86b3('0x26')],_0x5b72f6[_0x86b3('0x27')],_0x5b72f6[_0x86b3('0x28')],_0x5b72f6[_0x86b3('0x29')]));_0xd4c709[_0x86b3('0x2a')](_0x447700['start']['id'],function(_0x21a07f){try{_0x21a07f=_0x19df02['clear'](_0x21a07f);logger['debug'](_0x86b3('0x2b'),JSON['stringify'](_0x21a07f,null,0x2));if(_0x21a07f[_0x86b3('0xe')]===_0x86b3('0x2c')){logger[_0x86b3('0x23')]('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x5b72f6[_0x86b3('0x2d')]=_0x21a07f['context']||_0x5b72f6[_0x86b3('0x2d')];_0x5b72f6[_0x86b3('0x2e')]=_0x21a07f[_0x86b3('0x2e')];_0x5b72f6[_0x86b3('0x2f')]=_0x21a07f[_0x86b3('0x2f')]?_0x21a07f[_0x86b3('0x2f')]-0x1:0x1;return null;}else if(_0x21a07f&&_0x19df02[_0x21a07f[_0x86b3('0xe')]]){_0x3be4b5=_0x19df02[_0x21a07f[_0x86b3('0xe')]](_0x21a07f);logger[_0x86b3('0x23')](_0x86b3('0x30'),JSON[_0x86b3('0x1d')](_0x3be4b5,null,0x2));if(_0x3be4b5&&_0x3be4b5[_0x86b3('0x31')]===AGI_CODE_SUCCESS&&_0x3be4b5[_0x86b3('0x32')]!==AGI_RESULT_ERROR&&!_0x5b72f6[_0x86b3('0x33')]){logger['debug'](_0x86b3('0x30'),inspect(_0x3be4b5));return _['isUndefined'](_0x3be4b5[_0x86b3('0x32')])?null:_0x3be4b5[_0x86b3('0x32')][_0x86b3('0x34')]();}else{logger['error'](_0x86b3('0x30'),inspect(_0x3be4b5));return null;}}else{logger[_0x86b3('0x35')](_0x86b3('0x36'));return null;}}catch(_0x418f31){logger[_0x86b3('0x35')](_0x418f31[_0x86b3('0xd')]);return null;}});if(_0x447700[_0x86b3('0x37')]){logger[_0x86b3('0x23')](util[_0x86b3('0x1f')](_0x86b3('0x38'),_0x5b72f6[_0x86b3('0x25')],_0x5b72f6[_0x86b3('0x26')],_0x5b72f6['callerid'],_0x5b72f6[_0x86b3('0x28')],_0x5b72f6[_0x86b3('0x29')]));_0xd4c709['traverseBFS'](_0x447700['finally']['id'],function(_0x13e294){try{_0x13e294=_0x19df02[_0x86b3('0x39')](_0x13e294);logger['debug']('vertex',JSON['stringify'](_0x13e294,null,0x2));if(_0x13e294&&_0x19df02[_0x13e294[_0x86b3('0xe')]]){_0x3be4b5=_0x19df02[_0x13e294['agicommand']](_0x13e294);if(_0x3be4b5){logger[_0x86b3('0x1c')]('response',inspect(_0x3be4b5));return _['isUndefined'](_0x3be4b5['result'])?null:_0x3be4b5[_0x86b3('0x32')][_0x86b3('0x34')]();}else{logger[_0x86b3('0x35')](_0x86b3('0x30'),inspect(_0x3be4b5));return null;}}else{logger[_0x86b3('0x35')](_0x86b3('0x36'));return null;}}catch(_0x3487d6){logger['error'](_0x3487d6[_0x86b3('0xd')]);return null;}});}logger[_0x86b3('0x23')](util[_0x86b3('0x1f')](_0x86b3('0x3a'),_0x5b72f6['arg_1'],_0x5b72f6[_0x86b3('0x26')],_0x5b72f6[_0x86b3('0x27')],_0x5b72f6[_0x86b3('0x28')],_0x5b72f6['uniqueid']));logger[_0x86b3('0x23')](util[_0x86b3('0x1f')]('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x5b72f6[_0x86b3('0x2d')],_0x5b72f6[_0x86b3('0x2e')],parseInt(_0x5b72f6[_0x86b3('0x2f')],0xa)+0x1));_0x5b72f6['continueAt'](_0x5b72f6[_0x86b3('0x2d')],_0x5b72f6['extension'],parseInt(_0x5b72f6[_0x86b3('0x2f')],0xa)+0x1);_0x5b72f6[_0x86b3('0x3b')]();}function handleNotFound(_0x31141c){logger[_0x86b3('0x35')](util[_0x86b3('0x1f')](_0x86b3('0x3c'),_0x31141c[_0x86b3('0x25')]));_0x31141c['continueAt'](_0x31141c[_0x86b3('0x2d')],_0x31141c[_0x86b3('0x2e')],parseInt(_0x31141c[_0x86b3('0x2f')],0xa)+0x1);_0x31141c[_0x86b3('0x3b')]();}function handleUnpublished(_0x704172){logger[_0x86b3('0x35')](util[_0x86b3('0x1f')](_0x86b3('0x3d'),_0x704172[_0x86b3('0x25')]));_0x704172['continueAt'](_0x704172[_0x86b3('0x2d')],_0x704172[_0x86b3('0x2e')],parseInt(_0x704172[_0x86b3('0x2f')],0xa)+0x1);_0x704172[_0x86b3('0x3b')]();}module[_0x86b3('0x3e')]={'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 7a9a753..07cb11f 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 _0xb50c=['toString','indexOf','substring','split','slice','trim','length','emit','headers','line','exports','util','stream','Transform','_localBuffer','_inBody','prototype','_transform'];(function(_0x4716ae,_0x35a488){var _0x526078=function(_0x9c69b6){while(--_0x9c69b6){_0x4716ae['push'](_0x4716ae['shift']());}};_0x526078(++_0x35a488);}(_0xb50c,0x1bb));var _0xcb50=function(_0xd0c886,_0x4f71a3){_0xd0c886=_0xd0c886-0x0;var _0x4faf54=_0xb50c[_0xd0c886];return _0x4faf54;};'use strict';var util=require(_0xcb50('0x0'));var Transform=require(_0xcb50('0x1'))[_0xcb50('0x2')];function AGIReply(_0x581b63){Transform['call'](this,_0x581b63);this[_0xcb50('0x3')]='';this[_0xcb50('0x4')]=![];}util['inherits'](AGIReply,Transform);AGIReply[_0xcb50('0x5')][_0xcb50('0x6')]=function(_0x360a0a,_0x425944,_0x144411){var _0x59fbb9='\x0a',_0x52127e=['\x0a\x0a','\x0d\x0a\x0d\x0a'],_0x3e0058=-0x1,_0x46f25b=-0x1,_0x4d321a='',_0x32f434=0x0,_0xd84b20='',_0x2671ce='';this[_0xcb50('0x3')]+=_0x360a0a[_0xcb50('0x7')]();_0xd84b20=this[_0xcb50('0x3')];if(!this[_0xcb50('0x4')]){_0x32f434=0x0;while(_0x52127e[_0x32f434]){while((_0x46f25b=_0xd84b20[_0xcb50('0x8')](_0x52127e[_0x32f434]))!=-0x1){_0x4d321a=_0x52127e[_0x32f434];_0x2671ce=_0xd84b20[_0xcb50('0x9')](0x0,_0x46f25b);_0xd84b20=_0xd84b20['substring'](_0x46f25b+_0x4d321a['length']);var _0x123496=_0x2671ce[_0xcb50('0xa')](_0x59fbb9),_0x314d7b=0x0,_0x596de9={},_0x4ac015='',_0x22bf7a='',_0x14f3f9=-0x1;while(_0x123496[_0x314d7b]){_0x14f3f9=_0x123496[_0x314d7b]['indexOf'](':');if(_0x14f3f9!=-0x1){_0x4ac015=_0x123496[_0x314d7b][_0xcb50('0xb')](0x0,_0x14f3f9)[_0xcb50('0xc')]();_0x22bf7a=_0x123496[_0x314d7b][_0xcb50('0xb')](_0x14f3f9+0x1)[_0xcb50('0xc')]();if(_0x4ac015[_0xcb50('0xd')]>0x0){_0x596de9[_0x4ac015]=_0x22bf7a;}}else{}_0x314d7b++;}this[_0xcb50('0xe')](_0xcb50('0xf'),_0x596de9);this['_inBody']=!![];}_0x32f434++;}this[_0xcb50('0x3')]=_0xd84b20;}else{while((_0x3e0058=_0xd84b20[_0xcb50('0x8')](_0x59fbb9))!=-0x1){_0x2671ce=_0xd84b20['substring'](0x0,_0x3e0058);this[_0xcb50('0xe')](_0xcb50('0x10'),_0x2671ce);_0xd84b20=_0xd84b20[_0xcb50('0x9')](_0x3e0058+_0x59fbb9[_0xcb50('0xd')]);}this[_0xcb50('0x3')]=_0xd84b20;}_0x144411();};module[_0xcb50('0x11')]=AGIReply; \ No newline at end of file +var _0x0afa=['length','split','slice','headers','emit','line','exports','stream','Transform','call','_localBuffer','_inBody','inherits','\x0d\x0a\x0d\x0a','indexOf','substring'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x0afa,0x137));var _0xa0af=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x0afa[_0x1ac595];return _0x455fff;};'use strict';var util=require('util');var Transform=require(_0xa0af('0x0'))[_0xa0af('0x1')];function AGIReply(_0xf71ed5){Transform[_0xa0af('0x2')](this,_0xf71ed5);this[_0xa0af('0x3')]='';this[_0xa0af('0x4')]=![];}util[_0xa0af('0x5')](AGIReply,Transform);AGIReply['prototype']['_transform']=function(_0x980631,_0x5581b2,_0x37be43){var _0x2429bf='\x0a',_0x2fbdf3=['\x0a\x0a',_0xa0af('0x6')],_0x44d2c9=-0x1,_0x5e542c=-0x1,_0x27cf5e='',_0x245d32=0x0,_0x50f7d1='',_0x43b5c1='';this[_0xa0af('0x3')]+=_0x980631['toString']();_0x50f7d1=this[_0xa0af('0x3')];if(!this[_0xa0af('0x4')]){_0x245d32=0x0;while(_0x2fbdf3[_0x245d32]){while((_0x5e542c=_0x50f7d1[_0xa0af('0x7')](_0x2fbdf3[_0x245d32]))!=-0x1){_0x27cf5e=_0x2fbdf3[_0x245d32];_0x43b5c1=_0x50f7d1[_0xa0af('0x8')](0x0,_0x5e542c);_0x50f7d1=_0x50f7d1['substring'](_0x5e542c+_0x27cf5e[_0xa0af('0x9')]);var _0xc4fe56=_0x43b5c1[_0xa0af('0xa')](_0x2429bf),_0x4d8a97=0x0,_0x438792={},_0x3e3362='',_0x4e3362='',_0x50063a=-0x1;while(_0xc4fe56[_0x4d8a97]){_0x50063a=_0xc4fe56[_0x4d8a97]['indexOf'](':');if(_0x50063a!=-0x1){_0x3e3362=_0xc4fe56[_0x4d8a97][_0xa0af('0xb')](0x0,_0x50063a)['trim']();_0x4e3362=_0xc4fe56[_0x4d8a97][_0xa0af('0xb')](_0x50063a+0x1)['trim']();if(_0x3e3362['length']>0x0){_0x438792[_0x3e3362]=_0x4e3362;}}else{}_0x4d8a97++;}this['emit'](_0xa0af('0xc'),_0x438792);this[_0xa0af('0x4')]=!![];}_0x245d32++;}this['_localBuffer']=_0x50f7d1;}else{while((_0x44d2c9=_0x50f7d1['indexOf'](_0x2429bf))!=-0x1){_0x43b5c1=_0x50f7d1[_0xa0af('0x8')](0x0,_0x44d2c9);this[_0xa0af('0xd')](_0xa0af('0xe'),_0x43b5c1);_0x50f7d1=_0x50f7d1['substring'](_0x44d2c9+_0x2429bf[_0xa0af('0x9')]);}this[_0xa0af('0x3')]=_0x50f7d1;}_0x37be43();};module[_0xa0af('0xf')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 844546b..a19e302 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 _0xed95=['merge','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','CreateCmContact','getPauseById','ShowPause','agentLogin','agentUnpause','UnpauseUser','agentLogout','LogoutUser','lodash','moment','jayson/promise','client','http','request','then','message','result','catch','getSquareProjects','GetSquareProjects','getSquareProject','ShowSquareProject','production','ShowMailAccount','MailServerOut','Smtp','CloudProvider','name','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','ShowVariable','ShowSquareOdbc','getUserById','GetContactByPhone','phone','getTrunkById','getSoundById','getIntervalById','Interval','Intervals','getSmsAccountById','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareReport'];(function(_0x2f06e0,_0x2e1c2a){var _0xf2711b=function(_0x32036c){while(--_0x32036c){_0x2f06e0['push'](_0x2f06e0['shift']());}};_0xf2711b(++_0x2e1c2a);}(_0xed95,0xb9));var _0x5ed9=function(_0x39b819,_0x2bd3ce){_0x39b819=_0x39b819-0x0;var _0x1c71f1=_0xed95[_0x39b819];return _0x1c71f1;};'use strict';var _=require(_0x5ed9('0x0'));var moment=require(_0x5ed9('0x1'));var jayson=require(_0x5ed9('0x2'));var client=jayson[_0x5ed9('0x3')][_0x5ed9('0x4')]({'port':0x2329});function request(_0x7b6960,_0x453f85){return new Promise(function(_0x3e2272,_0x2a28e9){return client[_0x5ed9('0x5')](_0x7b6960,_0x453f85)[_0x5ed9('0x6')](function(_0x15b734){if(_0x15b734['error']){return _0x2a28e9(_0x15b734['error'][_0x5ed9('0x7')]);}else{return _0x3e2272(_0x15b734[_0x5ed9('0x8')]);}})[_0x5ed9('0x9')](function(_0x34688d){return _0x2a28e9(_0x34688d);});});}exports[_0x5ed9('0xa')]=function(){return request(_0x5ed9('0xb'),{'options':{'raw':![],'attributes':['id','name','production']}});};exports[_0x5ed9('0xc')]=function(_0xbe4c01){return request(_0x5ed9('0xd'),{'options':{'raw':![],'where':{'name':_0xbe4c01},'attributes':[_0x5ed9('0xe')]}});};exports['getMailAccountById']=function(_0x575782){return request(_0x5ed9('0xf'),{'options':{'raw':![],'where':{'id':_0x575782},'include':[{'model':_0x5ed9('0x10'),'as':_0x5ed9('0x11'),'include':[{'model':_0x5ed9('0x12'),'as':'CloudProvider'}]}],'attributes':['id',_0x5ed9('0x13'),_0x5ed9('0x14')],'smtp':!![]}});};exports[_0x5ed9('0x15')]=function(_0x5e463c){return request('ShowSquareProject',{'options':{'where':{'id':_0x5e463c},'attributes':[_0x5ed9('0x13')]}});};exports[_0x5ed9('0x16')]=function(_0x5e952c){return request(_0x5ed9('0x17'),{'options':{'where':{'id':_0x5e952c},'attributes':[_0x5ed9('0x13')]}});};exports['getVariableById']=function(_0x57692b){return request(_0x5ed9('0x18'),{'options':{'where':{'id':_0x57692b},'attributes':[_0x5ed9('0x13')]}});};exports['getSquareOdbcById']=function(_0x3de09e){return request(_0x5ed9('0x19'),{'options':{'where':{'id':_0x3de09e},'attributes':['dsn']}});};exports[_0x5ed9('0x1a')]=function(_0xc6e591){return request('ShowUser',{'options':{'where':{'id':_0xc6e591},'attributes':['name']}});};exports['getContactByPhone']=function(_0x510ffe){return request(_0x5ed9('0x1b'),{'options':{'where':{'phone':_0x510ffe[_0x5ed9('0x1c')]},'attributes':['id']}});};exports[_0x5ed9('0x1d')]=function(_0x44b8ca){return request('ShowTrunk',{'options':{'where':{'id':_0x44b8ca},'attributes':[_0x5ed9('0x13')]}});};exports[_0x5ed9('0x1e')]=function(_0x5cb2c1){return request('ShowSound',{'options':{'where':{'id':_0x5cb2c1},'attributes':['save_name']}});};exports[_0x5ed9('0x1f')]=function(_0x26a3c8){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x26a3c8},'include':[{'model':_0x5ed9('0x20'),'as':_0x5ed9('0x21')}]}});};exports[_0x5ed9('0x22')]=function(_0x71e104){return request('ShowSmsAccount',{'options':{'where':{'id':_0x71e104},'attributes':['id',_0x5ed9('0x13')]}});};exports[_0x5ed9('0x23')]=function(_0x38b462){return request(_0x5ed9('0x24'),{'body':_0x38b462});};exports[_0x5ed9('0x25')]=function(_0x14ae7b){return request('CreateSquareDetailsReport',{'body':_0x14ae7b});};exports['createSquareReport']=function(_0x36d7d5){return request(_0x5ed9('0x26'),{'body':_[_0x5ed9('0x27')](_0x36d7d5,{'project_name':_0x36d7d5['arg_1'],'prev_project_name':_0x36d7d5['arg_2']||'','is_subproject':_0x36d7d5[_0x5ed9('0x28')]?!![]:![],'leaveAt':moment()[_0x5ed9('0x29')](_0x5ed9('0x2a'))})});};exports['createSquareRecording']=function(_0x1bc137){return request(_0x5ed9('0x2b'),{'body':_0x1bc137});};exports[_0x5ed9('0x2c')]=function(_0x5a805b){return request(_0x5ed9('0x2d'),{'body':_0x5a805b});};exports[_0x5ed9('0x2e')]=function(_0x411729){return request(_0x5ed9('0x2f'),{'options':{'raw':![],'where':{'phone':_0x411729['phone'],'ListId':_0x411729['ListId']}}})[_0x5ed9('0x6')](function(_0x5d6599){if(_0x5d6599){return _0x5d6599;}return request(_0x5ed9('0x30'),{'body':_0x411729});});};exports[_0x5ed9('0x31')]=function(_0x1585e3){return request(_0x5ed9('0x32'),{'options':{'where':{'id':_0x1585e3},'attributes':[_0x5ed9('0x13')]}});};exports[_0x5ed9('0x33')]=function(_0xba5b97,_0x4a47f5){return request('LoginUser',{'body':{'interface':_0x4a47f5},'options':{'where':_0xba5b97}});};exports['agentPause']=function(_0x39771f,_0x36d050,_0x2cb3d2){return request('PauseUser',{'body':{'type':_0x36d050,'uniqueid':_0x2cb3d2},'options':{'where':_0x39771f}});};exports[_0x5ed9('0x34')]=function(_0x53575b){return request(_0x5ed9('0x35'),{'body':{},'options':{'where':_0x53575b}});};exports[_0x5ed9('0x36')]=function(_0x3061cd){return request(_0x5ed9('0x37'),{'body':{},'options':{'where':_0x3061cd}});}; \ No newline at end of file +var _0x20ce=['ShowPause','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','lodash','moment','jayson/promise','http','request','then','error','message','result','catch','getSquareProjects','GetSquareProjects','name','production','getSquareProject','ShowSquareProject','getMailAccountById','MailServerOut','Smtp','CloudProvider','getSquareProjectById','getVoiceQueueById','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','ShowUser','getContactByPhone','GetContactByPhone','phone','ShowTrunk','getSoundById','save_name','getIntervalById','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','CreateCmContact','getPauseById'];(function(_0x33c70e,_0xd8cb0b){var _0x5a33e5=function(_0x3b7f9d){while(--_0x3b7f9d){_0x33c70e['push'](_0x33c70e['shift']());}};_0x5a33e5(++_0xd8cb0b);}(_0x20ce,0x10d));var _0xe20c=function(_0x350d17,_0x144a6c){_0x350d17=_0x350d17-0x0;var _0x3c4125=_0x20ce[_0x350d17];return _0x3c4125;};'use strict';var _=require(_0xe20c('0x0'));var moment=require(_0xe20c('0x1'));var jayson=require(_0xe20c('0x2'));var client=jayson['client'][_0xe20c('0x3')]({'port':0x2329});function request(_0x34b536,_0x213486){return new Promise(function(_0x26479b,_0x7e5160){return client[_0xe20c('0x4')](_0x34b536,_0x213486)[_0xe20c('0x5')](function(_0x991abf){if(_0x991abf[_0xe20c('0x6')]){return _0x7e5160(_0x991abf[_0xe20c('0x6')][_0xe20c('0x7')]);}else{return _0x26479b(_0x991abf[_0xe20c('0x8')]);}})[_0xe20c('0x9')](function(_0x8f79ad){return _0x7e5160(_0x8f79ad);});});}exports[_0xe20c('0xa')]=function(){return request(_0xe20c('0xb'),{'options':{'raw':![],'attributes':['id',_0xe20c('0xc'),_0xe20c('0xd')]}});};exports[_0xe20c('0xe')]=function(_0x16aaaa){return request(_0xe20c('0xf'),{'options':{'raw':![],'where':{'name':_0x16aaaa},'attributes':[_0xe20c('0xd')]}});};exports[_0xe20c('0x10')]=function(_0x26ad0a){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x26ad0a},'include':[{'model':_0xe20c('0x11'),'as':_0xe20c('0x12'),'include':[{'model':_0xe20c('0x13'),'as':_0xe20c('0x13')}]}],'attributes':['id',_0xe20c('0xc'),'email'],'smtp':!![]}});};exports[_0xe20c('0x14')]=function(_0x1d8ae9){return request('ShowSquareProject',{'options':{'where':{'id':_0x1d8ae9},'attributes':[_0xe20c('0xc')]}});};exports[_0xe20c('0x15')]=function(_0x2258c1){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x2258c1},'attributes':[_0xe20c('0xc')]}});};exports[_0xe20c('0x16')]=function(_0x374707){return request(_0xe20c('0x17'),{'options':{'where':{'id':_0x374707},'attributes':['name']}});};exports[_0xe20c('0x18')]=function(_0x5a1ed5){return request(_0xe20c('0x19'),{'options':{'where':{'id':_0x5a1ed5},'attributes':[_0xe20c('0x1a')]}});};exports[_0xe20c('0x1b')]=function(_0x1eec43){return request(_0xe20c('0x1c'),{'options':{'where':{'id':_0x1eec43},'attributes':[_0xe20c('0xc')]}});};exports[_0xe20c('0x1d')]=function(_0x3d8df5){return request(_0xe20c('0x1e'),{'options':{'where':{'phone':_0x3d8df5[_0xe20c('0x1f')]},'attributes':['id']}});};exports['getTrunkById']=function(_0x464b23){return request(_0xe20c('0x20'),{'options':{'where':{'id':_0x464b23},'attributes':[_0xe20c('0xc')]}});};exports[_0xe20c('0x21')]=function(_0x563352){return request('ShowSound',{'options':{'where':{'id':_0x563352},'attributes':[_0xe20c('0x22')]}});};exports[_0xe20c('0x23')]=function(_0x3d67a3){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x3d67a3},'include':[{'model':'Interval','as':_0xe20c('0x24')}]}});};exports[_0xe20c('0x25')]=function(_0x3c8556){return request(_0xe20c('0x26'),{'options':{'where':{'id':_0x3c8556},'attributes':['id','name']}});};exports[_0xe20c('0x27')]=function(_0x564605){return request(_0xe20c('0x28'),{'body':_0x564605});};exports[_0xe20c('0x29')]=function(_0x41a519){return request(_0xe20c('0x2a'),{'body':_0x41a519});};exports[_0xe20c('0x2b')]=function(_0x1e725c){return request(_0xe20c('0x2c'),{'body':_['merge'](_0x1e725c,{'project_name':_0x1e725c[_0xe20c('0x2d')],'prev_project_name':_0x1e725c[_0xe20c('0x2e')]||'','is_subproject':_0x1e725c[_0xe20c('0x2e')]?!![]:![],'leaveAt':moment()[_0xe20c('0x2f')](_0xe20c('0x30'))})});};exports[_0xe20c('0x31')]=function(_0x8d061b){return request(_0xe20c('0x32'),{'body':_0x8d061b});};exports[_0xe20c('0x33')]=function(_0x4f7dda){return request(_0xe20c('0x34'),{'body':_0x4f7dda});};exports[_0xe20c('0x35')]=function(_0x3302a9){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x3302a9[_0xe20c('0x1f')],'ListId':_0x3302a9['ListId']}}})['then'](function(_0xe6cc0f){if(_0xe6cc0f){return _0xe6cc0f;}return request(_0xe20c('0x36'),{'body':_0x3302a9});});};exports[_0xe20c('0x37')]=function(_0x4e17e4){return request(_0xe20c('0x38'),{'options':{'where':{'id':_0x4e17e4},'attributes':[_0xe20c('0xc')]}});};exports[_0xe20c('0x39')]=function(_0xc95194,_0x506008){return request(_0xe20c('0x3a'),{'body':{'interface':_0x506008},'options':{'where':_0xc95194}});};exports[_0xe20c('0x3b')]=function(_0x57275d,_0x126772,_0xa95121){return request(_0xe20c('0x3c'),{'body':{'type':_0x126772,'uniqueid':_0xa95121},'options':{'where':_0x57275d}});};exports[_0xe20c('0x3d')]=function(_0xa1b03b){return request(_0xe20c('0x3e'),{'body':{},'options':{'where':_0xa1b03b}});};exports[_0xe20c('0x3f')]=function(_0x445dfc){return request(_0xe20c('0x40'),{'body':{},'options':{'where':_0x445dfc}});}; \ 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 967ab45..eb10a80 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 _0x15b2=['./lex'];(function(_0x146784,_0x599c9f){var _0x22ec90=function(_0x2a983a){while(--_0x2a983a){_0x146784['push'](_0x146784['shift']());}};_0x22ec90(++_0x599c9f);}(_0x15b2,0x145));var _0x215b=function(_0x26c12e,_0x55ef42){_0x26c12e=_0x26c12e-0x0;var _0xbab0c7=_0x15b2[_0x26c12e];return _0xbab0c7;};var polly=require('./polly');var lex=require(_0x215b('0x0'));module['exports']={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x7c1f=['./lex','exports','./polly'];(function(_0x200ab0,_0x57d9ad){var _0x1151f9=function(_0x4ec79a){while(--_0x4ec79a){_0x200ab0['push'](_0x200ab0['shift']());}};_0x1151f9(++_0x57d9ad);}(_0x7c1f,0x194));var _0xf7c1=function(_0x34ca2a,_0xf200ef){_0x34ca2a=_0x34ca2a-0x0;var _0x490455=_0x7c1f[_0x34ca2a];return _0x490455;};var polly=require(_0xf7c1('0x0'));var lex=require(_0xf7c1('0x1'));module[_0xf7c1('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 63c66fb..f71f529 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 _0x0bb5=['./lib/api','exports'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x0bb5,0x148));var _0x50bb=function(_0x3cd5a7,_0x3e3a9f){_0x3cd5a7=_0x3cd5a7-0x0;var _0x53c0c9=_0x0bb5[_0x3cd5a7];return _0x53c0c9;};'use strict';var lex=require(_0x50bb('0x0'));module[_0x50bb('0x1')]=function(_0x5e61cf,_0x5a12b6,_0x348380,_0x1aaa37,_0x6b7575,_0x117e36){return lex(_0x5e61cf,_0x5a12b6,_0x348380,_0x1aaa37,_0x6b7575,_0x117e36);}; \ No newline at end of file +var _0x70e0=['exports','./lib/api'];(function(_0x1757c8,_0x4aa781){var _0x3059f1=function(_0xb9d7f){while(--_0xb9d7f){_0x1757c8['push'](_0x1757c8['shift']());}};_0x3059f1(++_0x4aa781);}(_0x70e0,0x17b));var _0x070e=function(_0x214eb4,_0x508aaf){_0x214eb4=_0x214eb4-0x0;var _0x177d47=_0x70e0[_0x214eb4];return _0x177d47;};'use strict';var lex=require(_0x070e('0x0'));module[_0x070e('0x1')]=function(_0x198c2e,_0x4d95bb,_0x579b83,_0x16e651,_0xee173,_0x277d32){return lex(_0x198c2e,_0x4d95bb,_0x579b83,_0x16e651,_0xee173,_0x277d32);}; \ 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 bb87f61..068aca8 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(_0x3bb897,_0x35e375){var _0x25839f=function(_0x1dfe16){while(--_0x1dfe16){_0x3bb897['push'](_0x3bb897['shift']());}};_0x25839f(++_0x35e375);}(_0xa9e0,0x123));var _0x0a9e=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xa9e0[_0xea8947];return _0x2455e9;};'use strict';var BPromise=require(_0x0a9e('0x0'));var AWS=require(_0x0a9e('0x1'));function lexResult(_0x29929c,_0x5dd881){return new BPromise(function(_0x550fbc,_0x18d5c9){_0x29929c['postText'](_0x5dd881,function(_0x333808,_0x432180){if(_0x333808){_0x18d5c9(_0x333808);}if(_0x432180[_0x0a9e('0x2')]){for(const _0x991246 in _0x432180[_0x0a9e('0x2')]){if(_0x432180['slots'][_0x0a9e('0x3')](_0x991246)){var _0x441e3a=_0x432180[_0x0a9e('0x2')][_0x991246];_0x432180['slot_'+_0x991246]=_0x441e3a;}}}_0x550fbc(_0x432180);});});}module['exports']=function(_0xe42b77,_0x56465b,_0x52cace,_0x39753a,_0xf81284,_0x307b3e){var _0x3ab53f=new AWS[(_0x0a9e('0x4'))]({'accessKeyId':_0x56465b,'secretAccessKey':_0x52cace,'region':_0x39753a});var _0xbd1168={'botAlias':'$LATEST','botName':_0x307b3e,'inputText':_0xf81284,'userId':_0xe42b77};return lexResult(_0x3ab53f,_0xbd1168);}; \ No newline at end of file +var _0xa9e0=['LexRuntime','bluebird','aws-sdk','slots','hasOwnProperty'];(function(_0x589fc7,_0xd6ab92){var _0x271aff=function(_0xada4d8){while(--_0xada4d8){_0x589fc7['push'](_0x589fc7['shift']());}};_0x271aff(++_0xd6ab92);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xa9e0[_0x2160a9];return _0xa88cf7;};'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 52ea151..99b3347 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 _0x33e6=['exports'];(function(_0x7f23c1,_0x2d8e38){var _0x4c4447=function(_0x41f975){while(--_0x41f975){_0x7f23c1['push'](_0x7f23c1['shift']());}};_0x4c4447(++_0x2d8e38);}(_0x33e6,0x175));var _0x633e=function(_0x441da8,_0x47dd43){_0x441da8=_0x441da8-0x0;var _0x52e658=_0x33e6[_0x441da8];return _0x52e658;};'use strict';var polly=require('./lib/api');module[_0x633e('0x0')]=function(_0x142fe4,_0x54f89a,_0x42db6f,_0x58c179,_0x57dcd3,_0x53ef2b,_0x266801){return polly(_0x142fe4,_0x54f89a,_0x42db6f,_0x58c179,_0x57dcd3,_0x53ef2b,_0x266801);}; \ No newline at end of file +var _0xc7b8=['./lib/api','exports'];(function(_0x50b668,_0x113ec1){var _0x1b1775=function(_0x31b9e5){while(--_0x31b9e5){_0x50b668['push'](_0x50b668['shift']());}};_0x1b1775(++_0x113ec1);}(_0xc7b8,0x12e));var _0x8c7b=function(_0x3900cd,_0x2e0f0d){_0x3900cd=_0x3900cd-0x0;var _0x4ba90b=_0xc7b8[_0x3900cd];return _0x4ba90b;};'use strict';var polly=require(_0x8c7b('0x0'));module[_0x8c7b('0x1')]=function(_0x3e0889,_0xa564a,_0x1c1fde,_0x3a48d0,_0x39890e,_0x12ac37,_0x4650f2){return polly(_0x3e0889,_0xa564a,_0x1c1fde,_0x3a48d0,_0x39890e,_0x12ac37,_0x4650f2);}; \ 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 995e50d..8930dda 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 _0x0011=['aws-sdk','AudioStream','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','text','mp3'];(function(_0x5608a3,_0x5b33c5){var _0x1ed50a=function(_0x959171){while(--_0x959171){_0x5608a3['push'](_0x5608a3['shift']());}};_0x1ed50a(++_0x5b33c5);}(_0x0011,0xde));var _0x1001=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x0011[_0x618414];return _0x21c19a;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require('bluebird');var rs=require('randomstring');var AWS=require(_0x1001('0x0'));function pollyResult(_0x2436c6,_0x4984c7,_0x495e74){return new BPromise(function(_0x47e32e,_0xffdc02){_0x2436c6['synthesizeSpeech'](_0x4984c7,function(_0x5befa0,_0x11d356){if(_0x5befa0){_0xffdc02(_0x5befa0);}else if(_0x11d356){if(_0x11d356['AudioStream']instanceof Buffer){fs['writeFile'](_0x495e74,_0x11d356[_0x1001('0x1')],function(_0x549af6){if(_0x549af6){_0xffdc02(_0x549af6);}else{_0x47e32e();}});}else{_0xffdc02(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0xffdc02(new Error(_0x1001('0x2')));}});});}module[_0x1001('0x3')]=function(_0x12d13d,_0x5e0b36,_0x3de0ee,_0x4b914b,_0x55cb9e,_0x189e02,_0x5a77be){var _0x3e82e6=new AWS['Polly']({'accessKeyId':_0x12d13d,'secretAccessKey':_0x5e0b36,'region':_0x3de0ee});var _0x4d2011={'Text':_0x55cb9e,'TextType':_0x189e02||_0x1001('0x4'),'OutputFormat':_0x1001('0x5'),'VoiceId':_0x4b914b};return pollyResult(_0x3e82e6,_0x4d2011,_0x5a77be);}; \ No newline at end of file +var _0xe72d=['Polly','text','mp3','randomstring','synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports'];(function(_0x24cd4e,_0x222e7b){var _0x44f74a=function(_0x57bb13){while(--_0x57bb13){_0x24cd4e['push'](_0x24cd4e['shift']());}};_0x44f74a(++_0x222e7b);}(_0xe72d,0x1ed));var _0xde72=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0xe72d[_0x36ed48];return _0x51c63a;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require('bluebird');var rs=require(_0xde72('0x0'));var AWS=require('aws-sdk');function pollyResult(_0x5e491f,_0x2b478c,_0x530b4d){return new BPromise(function(_0x33b5bc,_0x3cab5a){_0x5e491f[_0xde72('0x1')](_0x2b478c,function(_0x533ef1,_0x345936){if(_0x533ef1){_0x3cab5a(_0x533ef1);}else if(_0x345936){if(_0x345936[_0xde72('0x2')]instanceof Buffer){fs[_0xde72('0x3')](_0x530b4d,_0x345936[_0xde72('0x2')],function(_0x7b7c2c){if(_0x7b7c2c){_0x3cab5a(_0x7b7c2c);}else{_0x33b5bc();}});}else{_0x3cab5a(new Error(_0xde72('0x4')));}}else{_0x3cab5a(new Error(_0xde72('0x5')));}});});}module[_0xde72('0x6')]=function(_0x2a18e5,_0x12f3c8,_0x281ab2,_0x2cfb90,_0x3f744c,_0x598dcb,_0x12c83e){var _0x27bd87=new AWS[(_0xde72('0x7'))]({'accessKeyId':_0x2a18e5,'secretAccessKey':_0x12f3c8,'region':_0x281ab2});var _0x273200={'Text':_0x3f744c,'TextType':_0x598dcb||_0xde72('0x8'),'OutputFormat':_0xde72('0x9'),'VoiceId':_0x2cfb90};return pollyResult(_0x27bd87,_0x273200,_0x12c83e);}; \ 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 b9d4a2c..04d8c3f 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 _0x39e6=['./lib/api','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x39e6,0x1e2));var _0x639e=function(_0x3ae9e5,_0x2464b9){_0x3ae9e5=_0x3ae9e5-0x0;var _0x5204d0=_0x39e6[_0x3ae9e5];return _0x5204d0;};'use strict';var asr=require(_0x639e('0x0'));module[_0x639e('0x1')]=function(_0x1f830a,_0x4b3d45,_0x259484,_0x341d92){return asr(_0x1f830a,_0x4b3d45,_0x259484);}; \ No newline at end of file +var _0x9613=['exports','./lib/api'];(function(_0x44b8cc,_0x533379){var _0x252cc6=function(_0xfc94){while(--_0xfc94){_0x44b8cc['push'](_0x44b8cc['shift']());}};_0x252cc6(++_0x533379);}(_0x9613,0x17d));var _0x3961=function(_0x454c66,_0x3831dc){_0x454c66=_0x454c66-0x0;var _0x4e2938=_0x9613[_0x454c66];return _0x4e2938;};'use strict';var asr=require(_0x3961('0x0'));module[_0x3961('0x1')]=function(_0x405e68,_0xf6a888,_0xe8a58,_0xc8ab65){return asr(_0x405e68,_0xf6a888,_0xe8a58);}; \ 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 2ae1f70..e491f52 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 _0x407f=['readFileSync','toString','base64','8000','exports','string','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','undefined'];(function(_0xa4203f,_0x23eb49){var _0x26e454=function(_0x25f1a6){while(--_0x25f1a6){_0xa4203f['push'](_0xa4203f['shift']());}};_0x26e454(++_0x23eb49);}(_0x407f,0xc2));var _0xf407=function(_0x14bf64,_0x17ebcb){_0x14bf64=_0x14bf64-0x0;var _0x7be0be=_0x407f[_0x14bf64];return _0x7be0be;};'use strict';var url=require('url');var BPromise=require('bluebird');var fs=require('fs');var host='https://speech.googleapis.com';module[_0xf407('0x0')]=function(_0x2fcdc7,_0x6a58dd,_0x1ec297){return new BPromise(function(_0x1441bd,_0x886ba){var _0x185726;if(typeof _0x2fcdc7!==_0xf407('0x1')||_0x2fcdc7[_0xf407('0x2')]===0x0){return _0x886ba(_0xf407('0x3'));}if(typeof _0x6a58dd!==_0xf407('0x1')||_0x6a58dd[_0xf407('0x2')]===0x0){return _0x886ba(_0xf407('0x4'));}if(typeof _0x1ec297!==_0xf407('0x5')&&(typeof _0x1ec297!==_0xf407('0x1')||_0x1ec297[_0xf407('0x2')]===0x0)){return _0x886ba('lang\x20should\x20be\x20a\x20string');}try{_0x185726=fs[_0xf407('0x6')](_0x2fcdc7)[_0xf407('0x7')](_0xf407('0x8'));}catch(_0x5af7b8){return _0x886ba(_0x5af7b8);}return _0x1441bd({'method':'POST','uri':host+'/v1/speech:recognize?key='+_0x6a58dd,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':_0xf407('0x9'),'languageCode':_0x1ec297},'audio':{'content':_0x185726}},'json':!![]});});}; \ No newline at end of file +var _0x750a=['/v1/speech:recognize?key=','bluebird','string','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','toString','base64','POST'];(function(_0x2752e5,_0x30f719){var _0x185861=function(_0x39b294){while(--_0x39b294){_0x2752e5['push'](_0x2752e5['shift']());}};_0x185861(++_0x30f719);}(_0x750a,0x140));var _0xa750=function(_0x1f530d,_0x18a19e){_0x1f530d=_0x1f530d-0x0;var _0x22103f=_0x750a[_0x1f530d];return _0x22103f;};'use strict';var url=require('url');var BPromise=require(_0xa750('0x0'));var fs=require('fs');var host='https://speech.googleapis.com';module['exports']=function(_0x139fa5,_0xeb020d,_0x1b459c){return new BPromise(function(_0x19bd5f,_0x457cae){var _0x43d704;if(typeof _0x139fa5!==_0xa750('0x1')||_0x139fa5[_0xa750('0x2')]===0x0){return _0x457cae(_0xa750('0x3'));}if(typeof _0xeb020d!==_0xa750('0x1')||_0xeb020d[_0xa750('0x2')]===0x0){return _0x457cae(_0xa750('0x4'));}if(typeof _0x1b459c!==_0xa750('0x5')&&(typeof _0x1b459c!=='string'||_0x1b459c['length']===0x0)){return _0x457cae(_0xa750('0x6'));}try{_0x43d704=fs['readFileSync'](_0x139fa5)[_0xa750('0x7')](_0xa750('0x8'));}catch(_0x51f594){return _0x457cae(_0x51f594);}return _0x19bd5f({'method':_0xa750('0x9'),'uri':host+_0xa750('0xa')+_0xeb020d,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':'8000','languageCode':_0x1b459c},'audio':{'content':_0x43d704}},'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 d252278..10cb4be 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 _0x542f=['exports','./asr'];(function(_0x5c1223,_0x1dd2bf){var _0xea34b9=function(_0x2a9a93){while(--_0x2a9a93){_0x5c1223['push'](_0x5c1223['shift']());}};_0xea34b9(++_0x1dd2bf);}(_0x542f,0x16b));var _0xf542=function(_0x382c73,_0x199cab){_0x382c73=_0x382c73-0x0;var _0x1dd0bf=_0x542f[_0x382c73];return _0x1dd0bf;};var asr=require(_0xf542('0x0'));module[_0xf542('0x1')]={'asr':asr}; \ No newline at end of file +var asr=require('./asr');module['exports']={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index 82f414e..1b3c688 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 _0x7d71=['freeform=3','sestekNDA','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','apiai-promise','bluebird','dialogflow','http','path','randomstring','sox','google-tts-api','./aws','./google','../../../config/logger','https://api.ispeech.org/api/rest','protocol','https:','host','WHAT_EVER','error','\x20failed,\x20status\x20code\x20=\x20','statusCode','statusMessage','request\x20to\x20','createWriteStream','finish','info','finish\x20download\x20file','close','pipe','end','get','data','wav','error\x20convert','resolve','generate','.wav','writeFileSync','base64','then','unlink','chmodSync','777','split','readFileSync','toString','googleCloudTTS','?key=','ssml','input','audioConfig','MP3','text:synthesize','tmp','.mp3','from','audioContent','writeFile','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','null','generic','slice','parse\x20response\x20failed:\x0a','length','lang\x20\x22','goggleTTS\x20path','asr','uri','results','map','alternatives','transcript','confidence','googleASR\x20transcription','googleASR\x20confidence','googleDialogflow','textRequest','result','source','action','actionIncomplete','fulfillment','speech','score','metadata','isFallbackIntent','googleDialogflowV2','replace','sessionPath','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','boolValue','fulfillmentText','intent','name','displayName','isFallback','languageCode','queryText','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','awsPolly','polly','awsLex','lex','ispeechTTS','ispeechASR','format','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s'];(function(_0x79b7c0,_0x31862d){var _0xb2c932=function(_0x5711a4){while(--_0x5711a4){_0x79b7c0['push'](_0x79b7c0['shift']());}};_0xb2c932(++_0x31862d);}(_0x7d71,0x18d));var _0x17d7=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0x7d71[_0x68c979];return _0x4f0001;};'use strict';var apiai=require(_0x17d7('0x0'));var BPromise=require(_0x17d7('0x1'));var dialogflow=require(_0x17d7('0x2'));var fs=require('fs');var http=require(_0x17d7('0x3'));var https=require('https');var md5=require('md5');var path=require(_0x17d7('0x4'));var querystring=require('querystring');var rp=require('request-promise');var rs=require(_0x17d7('0x5'));var sox=require(_0x17d7('0x6'));var tts=require(_0x17d7('0x7'));var urlParse=require('url')['parse'];var util=require('util');var aws=require(_0x17d7('0x8'));var google=require(_0x17d7('0x9'));var sestek=require('./sestek');var tilde=require('./tilde');var logger=require(_0x17d7('0xa'))('agi');var ISPEECH_API=_0x17d7('0xb');function downloadFile(_0xe6fdb9,_0x4d4fb1){return new BPromise(function(_0x577807,_0x169383){var _0x4ae9c3=urlParse(_0xe6fdb9);var _0x143bdb=_0x4ae9c3[_0x17d7('0xc')]===_0x17d7('0xd')?https:http;var _0x2380ce={'host':_0x4ae9c3[_0x17d7('0xe')],'path':_0x4ae9c3['path'],'headers':{'user-agent':_0x17d7('0xf')}};_0x143bdb['get'](_0x2380ce,function(_0x66615b){if(_0x66615b['statusCode']!==0xc8){logger[_0x17d7('0x10')]('request\x20to\x20'+_0xe6fdb9+_0x17d7('0x11')+_0x66615b[_0x17d7('0x12')]+'\x20('+_0x66615b[_0x17d7('0x13')]+')');_0x169383(new Error(_0x17d7('0x14')+_0xe6fdb9+_0x17d7('0x11')+_0x66615b['statusCode']+'\x20('+_0x66615b[_0x17d7('0x13')]+')'));return;}var _0x406ba4=fs[_0x17d7('0x15')](_0x4d4fb1);_0x406ba4['on'](_0x17d7('0x16'),function(){logger[_0x17d7('0x17')](_0x17d7('0x18'));_0x406ba4[_0x17d7('0x19')](_0x577807);});_0x406ba4['on'](_0x17d7('0x10'),function(_0x518e1d){fs['unlink'](_0x4d4fb1);logger['error']('download\x20error',_0x518e1d);_0x169383(_0x518e1d);});_0x66615b[_0x17d7('0x1a')](_0x406ba4);})['on']('error',function(_0x203c82){logger[_0x17d7('0x10')](_0x203c82);_0x169383(_0x203c82);})[_0x17d7('0x1b')]();});}function uploadFile(_0x8ca6c7){return new BPromise(function(_0x568d47,_0x562d71){var _0x3f7c0a=urlParse(_0x8ca6c7);var _0x1c0576=_0x3f7c0a[_0x17d7('0xc')]===_0x17d7('0xd')?https:http;var _0x1ee593={'host':_0x3f7c0a[_0x17d7('0xe')],'path':_0x3f7c0a[_0x17d7('0x4')],'headers':{'user-agent':_0x17d7('0xf')}};_0x1c0576[_0x17d7('0x1c')](_0x1ee593,function(_0x53c5a3){if(_0x53c5a3[_0x17d7('0x12')]!==0xc8){_0x562d71(new Error(_0x17d7('0x14')+_0x8ca6c7+_0x17d7('0x11')+_0x53c5a3[_0x17d7('0x12')]+'\x20('+_0x53c5a3[_0x17d7('0x13')]+')'));return;}var _0x53bbd0='';_0x53c5a3['on'](_0x17d7('0x1d'),function(_0x57f614){_0x53bbd0+=_0x57f614;});_0x53c5a3['on'](_0x17d7('0x1b'),function(){_0x568d47(_0x53bbd0);});})['on']('error',function(_0x842871){_0x562d71(_0x842871);})[_0x17d7('0x1b')]();});}function convertFile(_0x202ac7,_0x4afc38){return new BPromise(function(_0x16e077,_0x4ab291){var _0x5bdb8f=sox['transcode'](_0x202ac7,_0x4afc38,{'sampleRate':0x1f40,'format':_0x17d7('0x1e'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x5bdb8f['on'](_0x17d7('0x10'),function(_0x11c4d0){logger[_0x17d7('0x10')](_0x17d7('0x1f'),_0x11c4d0);_0x4ab291(_0x11c4d0);});_0x5bdb8f['on'](_0x17d7('0x1b'),function(){logger[_0x17d7('0x17')]('finish\x20to\x20convert');_0x16e077();});_0x5bdb8f['start']();});}function base64Decode(_0x579d91,_0x71b645){var _0x2fb589=path[_0x17d7('0x20')](__dirname,'tmp',rs[_0x17d7('0x21')](0x4)+_0x17d7('0x22'));fs[_0x17d7('0x23')](_0x2fb589,_0x579d91,_0x17d7('0x24'));return convertFile(_0x2fb589,_0x71b645)[_0x17d7('0x25')](function(){try{fs[_0x17d7('0x26')](_0x2fb589);fs[_0x17d7('0x27')](_0x71b645,_0x17d7('0x28'));}catch(_0x5ac430){logger[_0x17d7('0x10')](_0x5ac430);}return _0x71b645[_0x17d7('0x29')]('.')[0x0];});}function base64Encode(_0x1bc0b7){var _0x184818=fs[_0x17d7('0x2a')](_0x1bc0b7);return new Buffer(_0x184818)[_0x17d7('0x2b')](_0x17d7('0x24'));}exports[_0x17d7('0x2c')]=function(_0x2049ae,_0x3f276b,_0x308726,_0x3736bc,_0x30fc7c,_0x3807d2){var _0x23e97d,_0x46cbd7;var _0x5e2eaf='https://texttospeech.googleapis.com/v1/';var _0x30ddd9=_0x17d7('0x2d')+_0x2049ae;var _0x14d730={};if(_0x3f276b===_0x17d7('0x2e')){_0x14d730[_0x17d7('0x2f')]={'ssml':_0x308726};}else{_0x14d730[_0x17d7('0x2f')]={'text':_0x308726};};_0x14d730['voice']={'languageCode':_0x3736bc,'ssmlGender':_0x30fc7c};_0x14d730[_0x17d7('0x30')]={'audioEncoding':_0x17d7('0x31'),'sampleRateHertz':0x1f40};var _0x3dbc3c={'url':_0x5e2eaf+_0x17d7('0x32')+_0x30ddd9,'method':'POST','json':!![],'body':_0x14d730};return rp(_0x3dbc3c)[_0x17d7('0x25')](function(_0x5f2e1a){return new BPromise(function(_0x2ec4a6,_0x3cb42f){_0x23e97d=path[_0x17d7('0x20')](__dirname,_0x17d7('0x33'),rs[_0x17d7('0x21')](0x4)+_0x17d7('0x34'));var _0x3a00fc=Buffer[_0x17d7('0x35')](_0x5f2e1a[_0x17d7('0x36')],_0x17d7('0x24'));return fs[_0x17d7('0x37')](_0x23e97d,_0x3a00fc,function(_0x4a7b19){_0x3cb42f(_0x4a7b19);},function(_0x370e8b){fs['chmodSync'](_0x23e97d,_0x17d7('0x28'));_0x2ec4a6(_0x370e8b);});});})[_0x17d7('0x25')](function(_0x3369a2){_0x46cbd7=path['resolve'](__dirname,'tmp',rs[_0x17d7('0x21')](0x4)+_0x17d7('0x22'));return convertFile(_0x23e97d,_0x46cbd7);})['then'](function(){try{fs['unlink'](_0x23e97d);fs[_0x17d7('0x27')](_0x46cbd7,_0x17d7('0x28'));}catch(_0x314e91){logger[_0x17d7('0x10')](_0x314e91);}logger[_0x17d7('0x17')](_0x17d7('0x38'),_0x46cbd7[_0x17d7('0x29')]('.')[0x0]);return _0x46cbd7[_0x17d7('0x29')]('.')[0x0];});};exports[_0x17d7('0x39')]=function(_0x2537f9,_0x495f21){var _0x518a90=_0x17d7('0x3a');var _0x532b73,_0x4c280f;var _0x24f571;var _0x40170b={'encoding':_0x17d7('0x3b'),'method':'POST','timeout':0x2710,'url':_0x518a90,'headers':{'Content-Type':_0x17d7('0x3c')},'body':_0x17d7('0x3d')+encodeURIComponent(JSON[_0x17d7('0x3e')]([[[_0x17d7('0x3f'),JSON[_0x17d7('0x3e')]([_0x2537f9,_0x495f21||'en',![],_0x17d7('0x40')]),null,_0x17d7('0x41')]]]))};return rp(_0x40170b)[_0x17d7('0x25')](function(_0x56a2d4){try{_0x24f571=eval(_0x56a2d4[_0x17d7('0x42')](0x5))[0x0][0x2];}catch(_0x286022){throw new Error(_0x17d7('0x43')+_0x56a2d4[_0x17d7('0x1d')]);}if(!_0x24f571){if(_0x2537f9[_0x17d7('0x44')]>0xc8){throw new Error('text\x20length\x20limit\x20reached');}else{throw new Error(_0x17d7('0x45')+_0x495f21+'\x22\x20might\x20not\x20exist');}}try{_0x24f571=eval(_0x24f571)[0x0];}catch(_0x4bc662){throw new Error(_0x17d7('0x43')+res['data']);}const _0x2b2f34=_0x24f571;_0x532b73=path['resolve'](__dirname,'tmp',rs['generate'](0x4)+'.mp3');fs['writeFileSync'](_0x532b73,_0x24f571,{'encoding':_0x17d7('0x24')});_0x4c280f=path[_0x17d7('0x20')](__dirname,_0x17d7('0x33'),rs[_0x17d7('0x21')](0x4)+'.wav');return convertFile(_0x532b73,_0x4c280f);})[_0x17d7('0x25')](function(){try{fs['unlink'](_0x532b73);fs['chmodSync'](_0x4c280f,_0x17d7('0x28'));}catch(_0x1d4a49){logger[_0x17d7('0x10')](_0x1d4a49);}logger[_0x17d7('0x17')](_0x17d7('0x46'),_0x4c280f['split']('.')[0x0]);return _0x4c280f[_0x17d7('0x29')]('.')[0x0];});};exports['googleASR']=function(_0xe3b5e3,_0x803f12,_0x5a770e){return google[_0x17d7('0x47')](_0xe3b5e3,_0x803f12,_0x5a770e)['then'](function(_0x4b9514){logger[_0x17d7('0x17')](_0x4b9514[_0x17d7('0x48')]);return rp(_0x4b9514);})[_0x17d7('0x25')](function(_0x34e343){var _0x4ad205='';var _0x1e7b5e=0x0;try{fs[_0x17d7('0x26')](_0xe3b5e3);}catch(_0x2679dd){logger[_0x17d7('0x10')](_0x2679dd);}if(_0x34e343&&_0x34e343['results']){_0x4ad205=_0x34e343[_0x17d7('0x49')][_0x17d7('0x4a')](function(_0x25257b){return _0x25257b&&_0x25257b[_0x17d7('0x4b')][0x0]&&_0x25257b[_0x17d7('0x4b')][0x0][_0x17d7('0x4c')]?_0x25257b['alternatives'][0x0]['transcript']:'';})['join']('\x0a');_0x1e7b5e=_0x34e343[_0x17d7('0x49')][_0x17d7('0x4a')](function(_0x86f32c){return _0x86f32c&&_0x86f32c[_0x17d7('0x4b')][0x0]&&_0x86f32c['alternatives'][0x0][_0x17d7('0x4d')]?_0x86f32c[_0x17d7('0x4b')][0x0][_0x17d7('0x4d')]:0x0;})['join']('\x0a');}logger[_0x17d7('0x17')](_0x17d7('0x4e'),_0x4ad205);logger[_0x17d7('0x17')](_0x17d7('0x4f'),_0x1e7b5e);return{'transcript':_0x4ad205,'confidence':_0x1e7b5e};})['catch'](function(_0x306a43){logger['error']('[%s]\x20%s:%s',_0x306a43[_0x17d7('0x12')],_0x306a43['name'],_0x306a43['message']);});};exports[_0x17d7('0x50')]=function(_0x11165b,_0x3cd79,_0x56799b,_0x410ce7){var _0x34a6c5=apiai(_0x3cd79,{'language':_0x410ce7||'en'});return _0x34a6c5[_0x17d7('0x51')](_0x56799b,{'sessionId':md5(_0x11165b)})[_0x17d7('0x25')](function(_0x3180c3){logger['info'](JSON[_0x17d7('0x3e')](_0x3180c3));return{'source':_0x3180c3[_0x17d7('0x52')][_0x17d7('0x53')],'resolvedQuery':_0x3180c3[_0x17d7('0x52')]['resolvedQuery'],'action':_0x3180c3[_0x17d7('0x52')][_0x17d7('0x54')],'actionIncomplete':_0x3180c3[_0x17d7('0x52')][_0x17d7('0x55')],'speech':_0x3180c3['result'][_0x17d7('0x56')][_0x17d7('0x57')],'score':_0x3180c3['result'][_0x17d7('0x58')],'statusCode':_0x3180c3['status']['code'],'endConversation':_0x3180c3['result'][_0x17d7('0x59')]['endConversation']||![],'isFallbackIntent':_0x3180c3[_0x17d7('0x52')][_0x17d7('0x59')][_0x17d7('0x5a')]};});};exports[_0x17d7('0x5b')]=function(_0x2666ca,_0x41135f,_0x2de13a,_0x54e6f7,_0x5b50c4,_0x3dc736){var _0x2d2172=_0x54e6f7[_0x17d7('0x5c')](/\\n/g,'\x0a');var _0x13c15b={'credentials':{'private_key':_0x2d2172,'client_email':_0x2de13a}};var _0x37c648=new dialogflow['SessionsClient'](_0x13c15b);var _0x23b1fc=_0x37c648[_0x17d7('0x5d')](_0x41135f,md5(_0x2666ca));var _0x496b72={'session':_0x23b1fc,'queryInput':{'text':{'text':_0x5b50c4,'languageCode':_0x3dc736}}};return _0x37c648['detectIntent'](_0x496b72)['then'](function(_0x281fa0){if(_0x281fa0&&_0x281fa0[_0x17d7('0x44')]){logger[_0x17d7('0x17')](_0x17d7('0x5e'),JSON[_0x17d7('0x3e')](_0x281fa0));var _0x53c17e=_0x281fa0[0x0];if(_0x53c17e){var _0x4da6fe={'action':_0x53c17e['queryResult'][_0x17d7('0x54')],'allRequiredParamsPresent':_0x53c17e[_0x17d7('0x5f')][_0x17d7('0x60')],'endConversation':_0x53c17e[_0x17d7('0x5f')]['diagnosticInfo']&&_0x53c17e[_0x17d7('0x5f')][_0x17d7('0x61')][_0x17d7('0x62')]?_0x53c17e['queryResult'][_0x17d7('0x61')][_0x17d7('0x62')]['end_conversation'][_0x17d7('0x63')]:![],'fulfillmentText':_0x53c17e[_0x17d7('0x5f')][_0x17d7('0x64')],'intentName':_0x53c17e['queryResult'][_0x17d7('0x65')][_0x17d7('0x66')],'intentDisplayName':_0x53c17e[_0x17d7('0x5f')][_0x17d7('0x65')][_0x17d7('0x67')],'isFallbackIntent':_0x53c17e[_0x17d7('0x5f')]['intent'][_0x17d7('0x68')],'languageCode':_0x53c17e[_0x17d7('0x5f')][_0x17d7('0x69')],'queryText':_0x53c17e[_0x17d7('0x5f')][_0x17d7('0x6a')],'responseId':_0x53c17e['responseId'],'score':_0x53c17e['queryResult'][_0x17d7('0x6b')],'speech':_0x53c17e[_0x17d7('0x5f')]['fulfillmentText'],'providerResponse':JSON[_0x17d7('0x3e')](_0x281fa0)};return _0x4da6fe;}}});};exports[_0x17d7('0x6c')]=function(_0xd7eeb3,_0x2ee23e,_0x22a83d,_0x1ff472){return tilde[_0x17d7('0x47')](_0xd7eeb3,_0x2ee23e,_0x22a83d,_0x1ff472)[_0x17d7('0x25')](function(_0x1beff4){try{fs[_0x17d7('0x26')](_0xd7eeb3);}catch(_0x5bd6fe){logger['error'](_0x5bd6fe);}logger[_0x17d7('0x17')](_0x17d7('0x6d'),_0x1beff4['transcript']);logger[_0x17d7('0x17')]('Tilde\x20ASR\x20confidence',_0x1beff4[_0x17d7('0x4d')]);return _0x1beff4;});};exports[_0x17d7('0x6e')]=function(_0x293002,_0x47c72f,_0x2c0b5b,_0x12364c,_0x1f9d64,_0x5f11b1){var _0x1b2f41=path[_0x17d7('0x20')](__dirname,_0x17d7('0x33'),rs['generate'](0x4)+'.mp3');var _0x52d723;return aws[_0x17d7('0x6f')](_0x293002,_0x47c72f,_0x2c0b5b,_0x12364c,_0x1f9d64,_0x5f11b1,_0x1b2f41)[_0x17d7('0x25')](function(){_0x52d723=path[_0x17d7('0x20')](__dirname,_0x17d7('0x33'),rs[_0x17d7('0x21')](0x4)+_0x17d7('0x22'));return convertFile(_0x1b2f41,_0x52d723);})[_0x17d7('0x25')](function(){try{fs[_0x17d7('0x26')](_0x1b2f41);fs['chmodSync'](_0x52d723,_0x17d7('0x28'));}catch(_0x28448d){logger[_0x17d7('0x10')](_0x28448d);}return _0x52d723[_0x17d7('0x29')]('.')[0x0];});};exports[_0x17d7('0x70')]=function(_0x3520f0,_0x432115,_0x5aec3c,_0x37e868,_0x2ed717,_0x344ccb){return aws[_0x17d7('0x71')](_0x3520f0,_0x432115,_0x5aec3c,_0x37e868,_0x2ed717,_0x344ccb)[_0x17d7('0x25')](function(_0x2823aa){logger[_0x17d7('0x17')](JSON['stringify'](_0x2823aa));return _0x2823aa;});};exports[_0x17d7('0x72')]=function(_0xbbcf23,_0x5a21bf,_0x31b204,_0x450853){var _0x3d1900=util['format']('%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3',ISPEECH_API,_0xbbcf23,encodeURIComponent(_0x5a21bf),_0x31b204,_0x450853);var _0x2bccf4=path[_0x17d7('0x20')](__dirname,'tmp',rs['generate'](0x4)+_0x17d7('0x34'));var _0x622d9b;return downloadFile(_0x3d1900,_0x2bccf4)[_0x17d7('0x25')](function(){_0x622d9b=path['resolve'](__dirname,_0x17d7('0x33'),rs[_0x17d7('0x21')](0x4)+_0x17d7('0x22'));return convertFile(_0x2bccf4,_0x622d9b);})[_0x17d7('0x25')](function(){try{fs[_0x17d7('0x26')](_0x2bccf4);fs[_0x17d7('0x27')](_0x622d9b,_0x17d7('0x28'));}catch(_0x13ed77){logger[_0x17d7('0x10')](_0x13ed77);}return _0x622d9b[_0x17d7('0x29')]('.')[0x0];});};exports[_0x17d7('0x73')]=function(_0x37d00c,_0x47d158,_0xd8ac3c,_0x329ee0){var _0x47730d=util[_0x17d7('0x74')](_0x17d7('0x75'),ISPEECH_API,_0x47d158,_0xd8ac3c,base64Encode(_0x37d00c),_0x329ee0?util[_0x17d7('0x74')](_0x17d7('0x76'),encodeURIComponent(_0x329ee0)):_0x17d7('0x77'));return uploadFile(_0x47730d)['then'](function(_0x4af26c){return querystring['parse'](_0x4af26c);});};exports[_0x17d7('0x78')]=function(_0x369f3c,_0x9c0d6f){return sestek[_0x17d7('0x79')](_0x369f3c,_0x9c0d6f)['then'](function(_0x278347){logger[_0x17d7('0x17')](JSON[_0x17d7('0x3e')](_0x278347));var _0x213be5={'speech':_0x278347[_0x17d7('0x7a')],'action':_0x278347[_0x17d7('0x7b')]?_0x278347[_0x17d7('0x7b')][_0x17d7('0x7c')]:undefined,'actiondata':_0x278347['channelData']?_0x278347['channelData'][_0x17d7('0x7d')]:undefined};if(_0x278347['channelData']&&_0x278347[_0x17d7('0x7b')]['AudioFromTts']){return base64Decode(_0x278347[_0x17d7('0x7b')][_0x17d7('0x7e')][_0x17d7('0x7f')],path[_0x17d7('0x20')](__dirname,_0x17d7('0x33'),rs['generate'](0x4)+_0x17d7('0x22')))[_0x17d7('0x25')](function(_0x1a4d7c){_0x213be5[_0x17d7('0x80')]=_0x1a4d7c;return _0x213be5;});}return _0x213be5;});};exports['dirName']=function(){return __dirname;}; \ No newline at end of file +var _0x5578=['googleDialogflowV2','replace','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','fulfillmentText','intent','displayName','isFallback','languageCode','queryText','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','parse','sestekNDA','nda','channelData','CustomAction','CustomActionData','AudioFromTts','Data','dirName','apiai-promise','dialogflow','md5','path','querystring','sox','google-tts-api','url','util','./aws','./sestek','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','host','WHAT_EVER','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','close','unlink','download\x20error','end','data','transcode','wav','error\x20convert','info','finish\x20to\x20convert','start','resolve','tmp','generate','.wav','then','chmodSync','split','readFileSync','toString','base64','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','input','voice','POST','.mp3','from','audioContent','777','googleCloudTTS\x20path','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','application/x-www-form-urlencoded','f.req=','stringify','null','generic','slice','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','lang\x20\x22','writeFileSync','goggleTTS\x20path','googleASR','asr','uri','results','map','alternatives','transcript','join','confidence','catch','name','googleDialogflow','textRequest','source','resolvedQuery','action','result','actionIncomplete','fulfillment','speech','score','status','code','metadata'];(function(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0x5578,0x1be));var _0x8557=function(_0x18f152,_0x41585a){_0x18f152=_0x18f152-0x0;var _0xa10b34=_0x5578[_0x18f152];return _0xa10b34;};'use strict';var apiai=require(_0x8557('0x0'));var BPromise=require('bluebird');var dialogflow=require(_0x8557('0x1'));var fs=require('fs');var http=require('http');var https=require('https');var md5=require(_0x8557('0x2'));var path=require(_0x8557('0x3'));var querystring=require(_0x8557('0x4'));var rp=require('request-promise');var rs=require('randomstring');var sox=require(_0x8557('0x5'));var tts=require(_0x8557('0x6'));var urlParse=require(_0x8557('0x7'))['parse'];var util=require(_0x8557('0x8'));var aws=require(_0x8557('0x9'));var google=require('./google');var sestek=require(_0x8557('0xa'));var tilde=require('./tilde');var logger=require(_0x8557('0xb'))(_0x8557('0xc'));var ISPEECH_API=_0x8557('0xd');function downloadFile(_0x4ceb26,_0x4b2a80){return new BPromise(function(_0x4e726d,_0x4eda81){var _0x597bcd=urlParse(_0x4ceb26);var _0x52d66f=_0x597bcd[_0x8557('0xe')]===_0x8557('0xf')?https:http;var _0x396338={'host':_0x597bcd[_0x8557('0x10')],'path':_0x597bcd[_0x8557('0x3')],'headers':{'user-agent':_0x8557('0x11')}};_0x52d66f[_0x8557('0x12')](_0x396338,function(_0x50847b){if(_0x50847b[_0x8557('0x13')]!==0xc8){logger[_0x8557('0x14')](_0x8557('0x15')+_0x4ceb26+_0x8557('0x16')+_0x50847b[_0x8557('0x13')]+'\x20('+_0x50847b['statusMessage']+')');_0x4eda81(new Error('request\x20to\x20'+_0x4ceb26+'\x20failed,\x20status\x20code\x20=\x20'+_0x50847b[_0x8557('0x13')]+'\x20('+_0x50847b[_0x8557('0x17')]+')'));return;}var _0x4b60bf=fs[_0x8557('0x18')](_0x4b2a80);_0x4b60bf['on']('finish',function(){logger['info']('finish\x20download\x20file');_0x4b60bf[_0x8557('0x19')](_0x4e726d);});_0x4b60bf['on'](_0x8557('0x14'),function(_0x850d7d){fs[_0x8557('0x1a')](_0x4b2a80);logger[_0x8557('0x14')](_0x8557('0x1b'),_0x850d7d);_0x4eda81(_0x850d7d);});_0x50847b['pipe'](_0x4b60bf);})['on']('error',function(_0x17a058){logger[_0x8557('0x14')](_0x17a058);_0x4eda81(_0x17a058);})[_0x8557('0x1c')]();});}function uploadFile(_0x58186e){return new BPromise(function(_0x27ce97,_0x1550aa){var _0x266140=urlParse(_0x58186e);var _0x22b7ca=_0x266140[_0x8557('0xe')]===_0x8557('0xf')?https:http;var _0x2a91ae={'host':_0x266140[_0x8557('0x10')],'path':_0x266140['path'],'headers':{'user-agent':_0x8557('0x11')}};_0x22b7ca[_0x8557('0x12')](_0x2a91ae,function(_0x37b06b){if(_0x37b06b[_0x8557('0x13')]!==0xc8){_0x1550aa(new Error(_0x8557('0x15')+_0x58186e+_0x8557('0x16')+_0x37b06b[_0x8557('0x13')]+'\x20('+_0x37b06b['statusMessage']+')'));return;}var _0x59f24a='';_0x37b06b['on'](_0x8557('0x1d'),function(_0xa54163){_0x59f24a+=_0xa54163;});_0x37b06b['on'](_0x8557('0x1c'),function(){_0x27ce97(_0x59f24a);});})['on'](_0x8557('0x14'),function(_0x1d3989){_0x1550aa(_0x1d3989);})[_0x8557('0x1c')]();});}function convertFile(_0x4b75ff,_0x388732){return new BPromise(function(_0x4d2044,_0x1e8558){var _0x18f2a6=sox[_0x8557('0x1e')](_0x4b75ff,_0x388732,{'sampleRate':0x1f40,'format':_0x8557('0x1f'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x18f2a6['on'](_0x8557('0x14'),function(_0xf37743){logger['error'](_0x8557('0x20'),_0xf37743);_0x1e8558(_0xf37743);});_0x18f2a6['on'](_0x8557('0x1c'),function(){logger[_0x8557('0x21')](_0x8557('0x22'));_0x4d2044();});_0x18f2a6[_0x8557('0x23')]();});}function base64Decode(_0x5e87f1,_0x123afd){var _0x1ad22b=path[_0x8557('0x24')](__dirname,_0x8557('0x25'),rs[_0x8557('0x26')](0x4)+_0x8557('0x27'));fs['writeFileSync'](_0x1ad22b,_0x5e87f1,'base64');return convertFile(_0x1ad22b,_0x123afd)[_0x8557('0x28')](function(){try{fs[_0x8557('0x1a')](_0x1ad22b);fs[_0x8557('0x29')](_0x123afd,'777');}catch(_0x4e4244){logger[_0x8557('0x14')](_0x4e4244);}return _0x123afd[_0x8557('0x2a')]('.')[0x0];});}function base64Encode(_0x199d9f){var _0x1ae031=fs[_0x8557('0x2b')](_0x199d9f);return new Buffer(_0x1ae031)[_0x8557('0x2c')](_0x8557('0x2d'));}exports[_0x8557('0x2e')]=function(_0x48e053,_0x2fe821,_0xac1c11,_0x452dd0,_0xca6d08,_0x32dc7f){var _0x21a868,_0x176119;var _0x1a924d=_0x8557('0x2f');var _0x256185=_0x8557('0x30')+_0x48e053;var _0x2fb6df={};if(_0x2fe821==='ssml'){_0x2fb6df[_0x8557('0x31')]={'ssml':_0xac1c11};}else{_0x2fb6df['input']={'text':_0xac1c11};};_0x2fb6df[_0x8557('0x32')]={'languageCode':_0x452dd0,'ssmlGender':_0xca6d08};_0x2fb6df['audioConfig']={'audioEncoding':'MP3','sampleRateHertz':0x1f40};var _0x48f63e={'url':_0x1a924d+'text:synthesize'+_0x256185,'method':_0x8557('0x33'),'json':!![],'body':_0x2fb6df};return rp(_0x48f63e)['then'](function(_0x16fd00){return new BPromise(function(_0x4f1a44,_0x3d7376){_0x21a868=path[_0x8557('0x24')](__dirname,_0x8557('0x25'),rs[_0x8557('0x26')](0x4)+_0x8557('0x34'));var _0x30117d=Buffer[_0x8557('0x35')](_0x16fd00[_0x8557('0x36')],_0x8557('0x2d'));return fs['writeFile'](_0x21a868,_0x30117d,function(_0x4d8c6e){_0x3d7376(_0x4d8c6e);},function(_0x177f45){fs['chmodSync'](_0x21a868,_0x8557('0x37'));_0x4f1a44(_0x177f45);});});})['then'](function(_0x42e0c2){_0x176119=path['resolve'](__dirname,_0x8557('0x25'),rs[_0x8557('0x26')](0x4)+_0x8557('0x27'));return convertFile(_0x21a868,_0x176119);})[_0x8557('0x28')](function(){try{fs[_0x8557('0x1a')](_0x21a868);fs[_0x8557('0x29')](_0x176119,_0x8557('0x37'));}catch(_0x1e5b8f){logger['error'](_0x1e5b8f);}logger[_0x8557('0x21')](_0x8557('0x38'),_0x176119[_0x8557('0x2a')]('.')[0x0]);return _0x176119[_0x8557('0x2a')]('.')[0x0];});};exports['googleTTS']=function(_0x5a6f31,_0x263898){var _0x50e5f5=_0x8557('0x39');var _0x43f5d3,_0x133838;var _0x4bb718;var _0x4ae85f={'encoding':'utf8','method':'POST','timeout':0x2710,'url':_0x50e5f5,'headers':{'Content-Type':_0x8557('0x3a')},'body':_0x8557('0x3b')+encodeURIComponent(JSON[_0x8557('0x3c')]([[['jQ1olc',JSON[_0x8557('0x3c')]([_0x5a6f31,_0x263898||'en',![],_0x8557('0x3d')]),null,_0x8557('0x3e')]]]))};return rp(_0x4ae85f)['then'](function(_0x23c094){try{_0x4bb718=eval(_0x23c094[_0x8557('0x3f')](0x5))[0x0][0x2];}catch(_0x1215ec){throw new Error(_0x8557('0x40')+_0x23c094['data']);}if(!_0x4bb718){if(_0x5a6f31[_0x8557('0x41')]>0xc8){throw new Error(_0x8557('0x42'));}else{throw new Error(_0x8557('0x43')+_0x263898+'\x22\x20might\x20not\x20exist');}}try{_0x4bb718=eval(_0x4bb718)[0x0];}catch(_0xeb01b4){throw new Error('parse\x20response\x20failed:\x0a'+res['data']);}const _0x1f9263=_0x4bb718;_0x43f5d3=path['resolve'](__dirname,_0x8557('0x25'),rs['generate'](0x4)+_0x8557('0x34'));fs[_0x8557('0x44')](_0x43f5d3,_0x4bb718,{'encoding':_0x8557('0x2d')});_0x133838=path[_0x8557('0x24')](__dirname,'tmp',rs['generate'](0x4)+_0x8557('0x27'));return convertFile(_0x43f5d3,_0x133838);})['then'](function(){try{fs[_0x8557('0x1a')](_0x43f5d3);fs['chmodSync'](_0x133838,_0x8557('0x37'));}catch(_0x40a95b){logger[_0x8557('0x14')](_0x40a95b);}logger[_0x8557('0x21')](_0x8557('0x45'),_0x133838[_0x8557('0x2a')]('.')[0x0]);return _0x133838['split']('.')[0x0];});};exports[_0x8557('0x46')]=function(_0x571610,_0x57a1ef,_0xef9e03){return google[_0x8557('0x47')](_0x571610,_0x57a1ef,_0xef9e03)[_0x8557('0x28')](function(_0x28a200){logger['info'](_0x28a200[_0x8557('0x48')]);return rp(_0x28a200);})[_0x8557('0x28')](function(_0x34d9a4){var _0x45a845='';var _0x2e2042=0x0;try{fs[_0x8557('0x1a')](_0x571610);}catch(_0x1989c6){logger[_0x8557('0x14')](_0x1989c6);}if(_0x34d9a4&&_0x34d9a4[_0x8557('0x49')]){_0x45a845=_0x34d9a4['results'][_0x8557('0x4a')](function(_0x56f527){return _0x56f527&&_0x56f527[_0x8557('0x4b')][0x0]&&_0x56f527[_0x8557('0x4b')][0x0][_0x8557('0x4c')]?_0x56f527[_0x8557('0x4b')][0x0]['transcript']:'';})[_0x8557('0x4d')]('\x0a');_0x2e2042=_0x34d9a4[_0x8557('0x49')]['map'](function(_0xe1b60e){return _0xe1b60e&&_0xe1b60e[_0x8557('0x4b')][0x0]&&_0xe1b60e[_0x8557('0x4b')][0x0][_0x8557('0x4e')]?_0xe1b60e[_0x8557('0x4b')][0x0]['confidence']:0x0;})['join']('\x0a');}logger['info']('googleASR\x20transcription',_0x45a845);logger[_0x8557('0x21')]('googleASR\x20confidence',_0x2e2042);return{'transcript':_0x45a845,'confidence':_0x2e2042};})[_0x8557('0x4f')](function(_0x50bfd1){logger[_0x8557('0x14')]('[%s]\x20%s:%s',_0x50bfd1[_0x8557('0x13')],_0x50bfd1[_0x8557('0x50')],_0x50bfd1['message']);});};exports[_0x8557('0x51')]=function(_0x4220e6,_0xc6b4f1,_0x2eb52f,_0x10dd0f){var _0x1b7406=apiai(_0xc6b4f1,{'language':_0x10dd0f||'en'});return _0x1b7406[_0x8557('0x52')](_0x2eb52f,{'sessionId':md5(_0x4220e6)})[_0x8557('0x28')](function(_0x4233ee){logger[_0x8557('0x21')](JSON[_0x8557('0x3c')](_0x4233ee));return{'source':_0x4233ee['result'][_0x8557('0x53')],'resolvedQuery':_0x4233ee['result'][_0x8557('0x54')],'action':_0x4233ee['result'][_0x8557('0x55')],'actionIncomplete':_0x4233ee[_0x8557('0x56')][_0x8557('0x57')],'speech':_0x4233ee[_0x8557('0x56')][_0x8557('0x58')][_0x8557('0x59')],'score':_0x4233ee[_0x8557('0x56')][_0x8557('0x5a')],'statusCode':_0x4233ee[_0x8557('0x5b')][_0x8557('0x5c')],'endConversation':_0x4233ee['result']['metadata']['endConversation']||![],'isFallbackIntent':_0x4233ee[_0x8557('0x56')][_0x8557('0x5d')]['isFallbackIntent']};});};exports[_0x8557('0x5e')]=function(_0x103b5e,_0x3dfedd,_0x435892,_0x46ad02,_0x5823bf,_0x109dd6){var _0x4c76ac=_0x46ad02[_0x8557('0x5f')](/\\n/g,'\x0a');var _0x8a7f24={'credentials':{'private_key':_0x4c76ac,'client_email':_0x435892}};var _0x288f08=new dialogflow[(_0x8557('0x60'))](_0x8a7f24);var _0x5bcef4=_0x288f08[_0x8557('0x61')](_0x3dfedd,md5(_0x103b5e));var _0xd14bcc={'session':_0x5bcef4,'queryInput':{'text':{'text':_0x5823bf,'languageCode':_0x109dd6}}};return _0x288f08[_0x8557('0x62')](_0xd14bcc)['then'](function(_0x18ee27){if(_0x18ee27&&_0x18ee27[_0x8557('0x41')]){logger[_0x8557('0x21')](_0x8557('0x63'),JSON[_0x8557('0x3c')](_0x18ee27));var _0x159f7b=_0x18ee27[0x0];if(_0x159f7b){var _0x383d4f={'action':_0x159f7b[_0x8557('0x64')]['action'],'allRequiredParamsPresent':_0x159f7b[_0x8557('0x64')][_0x8557('0x65')],'endConversation':_0x159f7b['queryResult'][_0x8557('0x66')]&&_0x159f7b['queryResult']['diagnosticInfo']['fields']?_0x159f7b[_0x8557('0x64')]['diagnosticInfo'][_0x8557('0x67')][_0x8557('0x68')]['boolValue']:![],'fulfillmentText':_0x159f7b[_0x8557('0x64')][_0x8557('0x69')],'intentName':_0x159f7b[_0x8557('0x64')][_0x8557('0x6a')][_0x8557('0x50')],'intentDisplayName':_0x159f7b[_0x8557('0x64')][_0x8557('0x6a')][_0x8557('0x6b')],'isFallbackIntent':_0x159f7b[_0x8557('0x64')]['intent'][_0x8557('0x6c')],'languageCode':_0x159f7b[_0x8557('0x64')][_0x8557('0x6d')],'queryText':_0x159f7b[_0x8557('0x64')][_0x8557('0x6e')],'responseId':_0x159f7b[_0x8557('0x6f')],'score':_0x159f7b[_0x8557('0x64')][_0x8557('0x70')],'speech':_0x159f7b[_0x8557('0x64')]['fulfillmentText'],'providerResponse':JSON[_0x8557('0x3c')](_0x18ee27)};return _0x383d4f;}}});};exports[_0x8557('0x71')]=function(_0x2f4327,_0x4e0bb1,_0x1ff19f,_0x4fcb09){return tilde[_0x8557('0x47')](_0x2f4327,_0x4e0bb1,_0x1ff19f,_0x4fcb09)[_0x8557('0x28')](function(_0x28f22a){try{fs[_0x8557('0x1a')](_0x2f4327);}catch(_0x37d9cd){logger[_0x8557('0x14')](_0x37d9cd);}logger[_0x8557('0x21')](_0x8557('0x72'),_0x28f22a['transcript']);logger[_0x8557('0x21')](_0x8557('0x73'),_0x28f22a[_0x8557('0x4e')]);return _0x28f22a;});};exports[_0x8557('0x74')]=function(_0x45cf2c,_0x39726f,_0x6e9397,_0x424ef2,_0x581a04,_0x3af49f){var _0x53130b=path[_0x8557('0x24')](__dirname,_0x8557('0x25'),rs[_0x8557('0x26')](0x4)+_0x8557('0x34'));var _0x454d92;return aws[_0x8557('0x75')](_0x45cf2c,_0x39726f,_0x6e9397,_0x424ef2,_0x581a04,_0x3af49f,_0x53130b)[_0x8557('0x28')](function(){_0x454d92=path[_0x8557('0x24')](__dirname,_0x8557('0x25'),rs[_0x8557('0x26')](0x4)+_0x8557('0x27'));return convertFile(_0x53130b,_0x454d92);})[_0x8557('0x28')](function(){try{fs[_0x8557('0x1a')](_0x53130b);fs[_0x8557('0x29')](_0x454d92,_0x8557('0x37'));}catch(_0x3dc204){logger['error'](_0x3dc204);}return _0x454d92[_0x8557('0x2a')]('.')[0x0];});};exports[_0x8557('0x76')]=function(_0x35f5c8,_0x458f23,_0x48fb87,_0x114032,_0x16506c,_0x4b189c){return aws[_0x8557('0x77')](_0x35f5c8,_0x458f23,_0x48fb87,_0x114032,_0x16506c,_0x4b189c)[_0x8557('0x28')](function(_0x1cbcb8){logger[_0x8557('0x21')](JSON[_0x8557('0x3c')](_0x1cbcb8));return _0x1cbcb8;});};exports[_0x8557('0x78')]=function(_0x24fb28,_0x4fe4cb,_0x5b2ad8,_0x3869de){var _0x554a0e=util[_0x8557('0x79')](_0x8557('0x7a'),ISPEECH_API,_0x24fb28,encodeURIComponent(_0x4fe4cb),_0x5b2ad8,_0x3869de);var _0xacf0a5=path['resolve'](__dirname,_0x8557('0x25'),rs[_0x8557('0x26')](0x4)+_0x8557('0x34'));var _0x2010a5;return downloadFile(_0x554a0e,_0xacf0a5)['then'](function(){_0x2010a5=path[_0x8557('0x24')](__dirname,'tmp',rs[_0x8557('0x26')](0x4)+'.wav');return convertFile(_0xacf0a5,_0x2010a5);})[_0x8557('0x28')](function(){try{fs[_0x8557('0x1a')](_0xacf0a5);fs[_0x8557('0x29')](_0x2010a5,_0x8557('0x37'));}catch(_0x462aff){logger[_0x8557('0x14')](_0x462aff);}return _0x2010a5[_0x8557('0x2a')]('.')[0x0];});};exports['ispeechASR']=function(_0x59f40f,_0x51bec1,_0x28512a,_0x13b2a8){var _0x3c0244=util[_0x8557('0x79')](_0x8557('0x7b'),ISPEECH_API,_0x51bec1,_0x28512a,base64Encode(_0x59f40f),_0x13b2a8?util[_0x8557('0x79')](_0x8557('0x7c'),encodeURIComponent(_0x13b2a8)):_0x8557('0x7d'));return uploadFile(_0x3c0244)[_0x8557('0x28')](function(_0x268b24){return querystring[_0x8557('0x7e')](_0x268b24);});};exports[_0x8557('0x7f')]=function(_0x25241c,_0x1eb117){return sestek[_0x8557('0x80')](_0x25241c,_0x1eb117)[_0x8557('0x28')](function(_0x3f677a){logger[_0x8557('0x21')](JSON[_0x8557('0x3c')](_0x3f677a));var _0x5ea467={'speech':_0x3f677a['text'],'action':_0x3f677a[_0x8557('0x81')]?_0x3f677a['channelData'][_0x8557('0x82')]:undefined,'actiondata':_0x3f677a['channelData']?_0x3f677a[_0x8557('0x81')][_0x8557('0x83')]:undefined};if(_0x3f677a[_0x8557('0x81')]&&_0x3f677a[_0x8557('0x81')]['AudioFromTts']){return base64Decode(_0x3f677a['channelData'][_0x8557('0x84')][_0x8557('0x85')],path[_0x8557('0x24')](__dirname,_0x8557('0x25'),rs['generate'](0x4)+'.wav'))[_0x8557('0x28')](function(_0x115acc){_0x5ea467['audiofile']=_0x115acc;return _0x5ea467;});}return _0x5ea467;});};exports[_0x8557('0x86')]=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 cf14acd..8eecadc 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 _0x24be=['./nda'];(function(_0x17baf7,_0x36bcba){var _0x3b4ccc=function(_0x358870){while(--_0x358870){_0x17baf7['push'](_0x17baf7['shift']());}};_0x3b4ccc(++_0x36bcba);}(_0x24be,0xd0));var _0xe24b=function(_0x857e60,_0x40a0c4){_0x857e60=_0x857e60-0x0;var _0x21a214=_0x24be[_0x857e60];return _0x21a214;};var nda=require(_0xe24b('0x0'));module['exports']={'nda':nda}; \ No newline at end of file +var _0x52cd=['./nda','exports'];(function(_0x1b2b34,_0x393b05){var _0x3042d2=function(_0x47b7ef){while(--_0x47b7ef){_0x1b2b34['push'](_0x1b2b34['shift']());}};_0x3042d2(++_0x393b05);}(_0x52cd,0x1a6));var _0xd52c=function(_0x1d0ce1,_0x33c1a9){_0x1d0ce1=_0x1d0ce1-0x0;var _0x20d76f=_0x52cd[_0x1d0ce1];return _0x20d76f;};var nda=require(_0xd52c('0x0'));module[_0xd52c('0x1')]={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index 383a1af..8038f1f 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 _0xf2a6=['POST','resolve','ndauth_url','/token','password','username','then','ndassistant_url','ndaactivity_type','Nda','uniqueid','callerid','dnid','text','Bearer\x20','access_token','body','ProjectName','project','ndagenerate_audio','channelData','audio/wav','custom_action','CustomAction','custom_action_data','CustomActionData','info','request-promise','exports'];(function(_0x2c1c4c,_0x40c066){var _0x1907c2=function(_0x4558e8){while(--_0x4558e8){_0x2c1c4c['push'](_0x2c1c4c['shift']());}};_0x1907c2(++_0x40c066);}(_0xf2a6,0x13d));var _0x6f2a=function(_0x5ebd5a,_0x1fe518){_0x5ebd5a=_0x5ebd5a-0x0;var _0xa8c6ff=_0xf2a6[_0x5ebd5a];return _0xa8c6ff;};'use strict';var rp=require(_0x6f2a('0x0'));var url=require('url');var logger=require('../../../../../config/logger')('agi');module[_0x6f2a('0x1')]=function(_0x5b2cbc,_0x3b14e2){var _0xf60faa={'method':_0x6f2a('0x2'),'uri':url[_0x6f2a('0x3')](_0x3b14e2[_0x6f2a('0x4')],_0x6f2a('0x5')),'form':{'grant_type':_0x6f2a('0x6'),'username':_0x3b14e2[_0x6f2a('0x7')],'password':_0x3b14e2[_0x6f2a('0x6')]},'json':!![]};return rp(_0xf60faa)[_0x6f2a('0x8')](function(_0x4b4fde){var _0x379b80={'method':_0x6f2a('0x2'),'uri':url[_0x6f2a('0x3')](_0x3b14e2[_0x6f2a('0x9')],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x3b14e2[_0x6f2a('0xa')]||'message','channelId':_0x6f2a('0xb'),'conversation':{'id':_0x5b2cbc[_0x6f2a('0xc')]},'from':{'id':_0x5b2cbc[_0x6f2a('0xd')],'name':_0x5b2cbc['calleridname']},'recipient':{'id':_0x5b2cbc[_0x6f2a('0xe')],'name':_0x5b2cbc['extension']},'text':_0x3b14e2[_0x6f2a('0xf')],'channelData':{}},'headers':{'Authorization':_0x6f2a('0x10')+_0x4b4fde[_0x6f2a('0x11')]},'json':!![]};if(_0x3b14e2['project']){_0x379b80[_0x6f2a('0x12')]['channelData'][_0x6f2a('0x13')]=_0x3b14e2[_0x6f2a('0x14')];}if(_0x3b14e2[_0x6f2a('0x15')]=='1'){_0x379b80[_0x6f2a('0x12')][_0x6f2a('0x16')]['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x6f2a('0x17')};}if(_0x3b14e2[_0x6f2a('0x18')]){_0x379b80[_0x6f2a('0x12')][_0x6f2a('0x16')][_0x6f2a('0x19')]=_0x3b14e2[_0x6f2a('0x18')];if(_0x3b14e2[_0x6f2a('0x1a')]){_0x379b80[_0x6f2a('0x12')][_0x6f2a('0x16')][_0x6f2a('0x1b')]=_0x3b14e2[_0x6f2a('0x1a')];}}logger[_0x6f2a('0x1c')](JSON['stringify'](_0x379b80));return rp(_0x379b80);});}; \ No newline at end of file +var _0x292b=['audio/wav','custom_action','body','CustomAction','custom_action_data','CustomActionData','info','request-promise','url','../../../../../config/logger','agi','exports','POST','resolve','username','password','then','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','uniqueid','callerid','calleridname','dnid','text','Bearer\x20','access_token','project','channelData','ProjectName','AudioOutputSettings'];(function(_0x4db17d,_0x54d99e){var _0x39a505=function(_0x18b28c){while(--_0x18b28c){_0x4db17d['push'](_0x4db17d['shift']());}};_0x39a505(++_0x54d99e);}(_0x292b,0x64));var _0xb292=function(_0x342700,_0x569f75){_0x342700=_0x342700-0x0;var _0x53406f=_0x292b[_0x342700];return _0x53406f;};'use strict';var rp=require(_0xb292('0x0'));var url=require(_0xb292('0x1'));var logger=require(_0xb292('0x2'))(_0xb292('0x3'));module[_0xb292('0x4')]=function(_0x3b4c2c,_0x40abc6){var _0x9a567d={'method':_0xb292('0x5'),'uri':url[_0xb292('0x6')](_0x40abc6['ndauth_url'],'/token'),'form':{'grant_type':'password','username':_0x40abc6[_0xb292('0x7')],'password':_0x40abc6[_0xb292('0x8')]},'json':!![]};return rp(_0x9a567d)[_0xb292('0x9')](function(_0x47fe8e){var _0x43f8b7={'method':_0xb292('0x5'),'uri':url['resolve'](_0x40abc6['ndassistant_url'],_0xb292('0xa')),'body':{'type':_0x40abc6[_0xb292('0xb')]||_0xb292('0xc'),'channelId':'Nda','conversation':{'id':_0x3b4c2c[_0xb292('0xd')]},'from':{'id':_0x3b4c2c[_0xb292('0xe')],'name':_0x3b4c2c[_0xb292('0xf')]},'recipient':{'id':_0x3b4c2c[_0xb292('0x10')],'name':_0x3b4c2c['extension']},'text':_0x40abc6[_0xb292('0x11')],'channelData':{}},'headers':{'Authorization':_0xb292('0x12')+_0x47fe8e[_0xb292('0x13')]},'json':!![]};if(_0x40abc6[_0xb292('0x14')]){_0x43f8b7['body'][_0xb292('0x15')][_0xb292('0x16')]=_0x40abc6['project'];}if(_0x40abc6['ndagenerate_audio']=='1'){_0x43f8b7['body'][_0xb292('0x15')][_0xb292('0x17')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xb292('0x18')};}if(_0x40abc6[_0xb292('0x19')]){_0x43f8b7[_0xb292('0x1a')][_0xb292('0x15')][_0xb292('0x1b')]=_0x40abc6['custom_action'];if(_0x40abc6[_0xb292('0x1c')]){_0x43f8b7[_0xb292('0x1a')][_0xb292('0x15')][_0xb292('0x1d')]=_0x40abc6[_0xb292('0x1c')];}}logger[_0xb292('0x1e')](JSON['stringify'](_0x43f8b7));return rp(_0x43f8b7);});}; \ 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 bbc8c0c..3bfe888 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 _0xa568=['exports','./lib/api'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa568,0x197));var _0x8a56=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xa568[_0x57b54c];return _0x59cc19;};'use strict';var asr=require(_0x8a56('0x0'));module[_0x8a56('0x1')]=function(_0x4ac5b8,_0xe401a6,_0x25000b,_0x3a94ef){return asr(_0x4ac5b8,_0xe401a6,_0x25000b,_0x3a94ef);}; \ No newline at end of file +var _0x7d84=['./lib/api','exports'];(function(_0x14f53d,_0xd6db59){var _0x3cea5b=function(_0x55e12d){while(--_0x55e12d){_0x14f53d['push'](_0x14f53d['shift']());}};_0x3cea5b(++_0xd6db59);}(_0x7d84,0xd2));var _0x47d8=function(_0x1f6f84,_0x2bab55){_0x1f6f84=_0x1f6f84-0x0;var _0x177f40=_0x7d84[_0x1f6f84];return _0x177f40;};'use strict';var asr=require(_0x47d8('0x0'));module[_0x47d8('0x1')]=function(_0x4b8c34,_0x1ae3d7,_0x2f4f1a,_0x195de0){return asr(_0x4b8c34,_0x1ae3d7,_0x2f4f1a,_0x195de0);}; \ 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 db69bfa..86a70d2 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 _0xfe21=['sha1','update','digest','Open\x20Tilde\x20ASR\x20socket','unix','send','createReadStream','data','close','EOS','Tilde\x20ASR\x20send\x20error','stringify','parse','status','final','Tilde\x20ASR\x20hypoteses','result','hypotheses','likelihood','Success.','terminate','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Close\x20Tilde\x20ASR\x20socket','error','Error\x20Tilde\x20ASR\x20socket','isObject','open','message','bluebird','moment','../../../../../../config/logger','agi','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash'];(function(_0x46f8d6,_0x117e5d){var _0x4fa236=function(_0x341c89){while(--_0x341c89){_0x46f8d6['push'](_0x46f8d6['shift']());}};_0x4fa236(++_0x117e5d);}(_0xfe21,0x1af));var _0x1fe2=function(_0x3094f8,_0x391321){_0x3094f8=_0x3094f8-0x0;var _0x4df439=_0xfe21[_0x3094f8];return _0x4df439;};'use strict';var BPromise=require(_0x1fe2('0x0'));var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x1fe2('0x1'));var crypto=require('crypto');var logger=require(_0x1fe2('0x2'))(_0x1fe2('0x3'));module['exports']=function(_0x3c0f02,_0x5e2f93,_0x1752e0,_0x109fe5){return new BPromise(function(_0x3df235,_0x34b492){logger[_0x1fe2('0x4')](_0x1fe2('0x5'),_0x109fe5||_0x1fe2('0x6'));var _0x12aacf=new WebSocket(_0x109fe5||_0x1fe2('0x6'),{'perMessageDeflate':![]});var _0x484f4b='';var _0x19b205='0';var _0x31262c='1';var _0x133e45=_0x1fe2('0x7');function _0x59ac28(_0xc753cb){var _0x31711b=crypto[_0x1fe2('0x8')](_0x1fe2('0x9'));_0x31711b[_0x1fe2('0xa')](_0xc753cb);return _0x31711b[_0x1fe2('0xb')]('hex');}function _0x518dde(){try{logger[_0x1fe2('0x4')](_0x1fe2('0xc'));var _0x224a96=moment()[_0x1fe2('0xd')]();var _0x1f8b39=_0x59ac28(_0x224a96+_0x5e2f93+_0x1752e0);_0x12aacf[_0x1fe2('0xe')](JSON['stringify']({'appID':_0x5e2f93,'timestamp':_0x224a96,'appKey':_0x1f8b39}));var _0x9064f0=fs[_0x1fe2('0xf')](_0x3c0f02);_0x9064f0['on'](_0x1fe2('0x10'),function(_0x51eeb6){_0x12aacf[_0x1fe2('0xe')](_0x51eeb6);});_0x9064f0['on'](_0x1fe2('0x11'),function(){_0x12aacf[_0x1fe2('0xe')](_0x1fe2('0x12'));});}catch(_0x5d15ad){logger['error'](_0x1fe2('0x13'),JSON[_0x1fe2('0x14')](_0x5d15ad));_0x12aacf['terminate']();}}function _0x448a8b(_0x3e901d){try{if(_0x3e901d){var _0x3500f5=JSON[_0x1fe2('0x15')](_0x3e901d);switch(_0x3500f5[_0x1fe2('0x16')]){case 0x0:if(_0x3500f5['result']){if(_0x3500f5['result'][_0x1fe2('0x17')]){logger[_0x1fe2('0x4')](_0x1fe2('0x18'),JSON[_0x1fe2('0x14')](_0x3500f5[_0x1fe2('0x19')][_0x1fe2('0x1a')]));_0x484f4b=_0x3500f5['result'][_0x1fe2('0x1a')][0x0]['transcript'];_0x19b205=_0x3500f5[_0x1fe2('0x19')][_0x1fe2('0x1a')][0x0][_0x1fe2('0x1b')];_0x31262c='0';_0x133e45=_0x1fe2('0x1c');_0x12aacf[_0x1fe2('0x1d')]();}}break;case 0x1:logger[_0x1fe2('0x4')]('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x31262c='1';_0x133e45=_0x1fe2('0x7');break;case 0x2:logger[_0x1fe2('0x4')](_0x1fe2('0x1e'));_0x31262c='2';_0x133e45='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger[_0x1fe2('0x4')]('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x31262c='9';_0x133e45=_0x1fe2('0x1f');break;case 0xa:logger[_0x1fe2('0x4')](_0x1fe2('0x20'));_0x31262c='10';_0x133e45='Authentication\x20failed.';break;case 0xb:logger[_0x1fe2('0x4')](_0x1fe2('0x21'));_0x31262c='11';_0x133e45=_0x1fe2('0x21');}}}catch(_0xf66fb0){logger['error']('Tilde\x20ASR\x20parse\x20error',JSON['stringify'](_0xf66fb0));_0x12aacf['terminate']();}}function _0x2d0f3e(){logger[_0x1fe2('0x4')](_0x1fe2('0x22'));_0x3df235({'transcript':_0x484f4b,'confidence':_0x19b205,'status':_0x31262c,'status_message':_0x133e45});}function _0x255661(_0x20d685){logger[_0x1fe2('0x23')](_0x1fe2('0x24'));if(!_['isNil'](_0x20d685)){logger[_0x1fe2('0x23')](_[_0x1fe2('0x25')](_0x20d685)?JSON[_0x1fe2('0x14')](_0x20d685):_0x20d685);}}_0x12aacf['on'](_0x1fe2('0x26'),_0x518dde);_0x12aacf['on'](_0x1fe2('0x27'),_0x448a8b);_0x12aacf['on']('close',_0x2d0f3e);_0x12aacf['on'](_0x1fe2('0x23'),_0x255661);});}; \ No newline at end of file +var _0xa2d0=['../../../../../../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','update','digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','createReadStream','data','Tilde\x20ASR\x20send\x20error','terminate','parse','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','error','Tilde\x20ASR\x20parse\x20error','Error\x20Tilde\x20ASR\x20socket','isNil','close','bluebird','moment','crypto'];(function(_0x273dc5,_0x268a81){var _0x46dae7=function(_0x263d62){while(--_0x263d62){_0x273dc5['push'](_0x273dc5['shift']());}};_0x46dae7(++_0x268a81);}(_0xa2d0,0x115));var _0x0a2d=function(_0x54ec37,_0x4288e0){_0x54ec37=_0x54ec37-0x0;var _0x3ecedd=_0xa2d0[_0x54ec37];return _0x3ecedd;};'use strict';var BPromise=require(_0x0a2d('0x0'));var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x0a2d('0x1'));var crypto=require(_0x0a2d('0x2'));var logger=require(_0x0a2d('0x3'))(_0x0a2d('0x4'));module[_0x0a2d('0x5')]=function(_0x38cfdf,_0x21e5e7,_0x23f13b,_0x2f834a){return new BPromise(function(_0xd97847,_0x176656){logger[_0x0a2d('0x6')](_0x0a2d('0x7'),_0x2f834a||_0x0a2d('0x8'));var _0x19260e=new WebSocket(_0x2f834a||_0x0a2d('0x8'),{'perMessageDeflate':![]});var _0x571c65='';var _0x18b46f='0';var _0x32afad='1';var _0xd5dc17=_0x0a2d('0x9');function _0x1160e1(_0x322ee8){var _0x2eee51=crypto[_0x0a2d('0xa')]('sha1');_0x2eee51[_0x0a2d('0xb')](_0x322ee8);return _0x2eee51[_0x0a2d('0xc')](_0x0a2d('0xd'));}function _0xade7fa(){try{logger[_0x0a2d('0x6')](_0x0a2d('0xe'));var _0x5bef2e=moment()[_0x0a2d('0xf')]();var _0x196cf5=_0x1160e1(_0x5bef2e+_0x21e5e7+_0x23f13b);_0x19260e[_0x0a2d('0x10')](JSON[_0x0a2d('0x11')]({'appID':_0x21e5e7,'timestamp':_0x5bef2e,'appKey':_0x196cf5}));var _0x2b6a52=fs[_0x0a2d('0x12')](_0x38cfdf);_0x2b6a52['on'](_0x0a2d('0x13'),function(_0x4110eb){_0x19260e[_0x0a2d('0x10')](_0x4110eb);});_0x2b6a52['on']('close',function(){_0x19260e[_0x0a2d('0x10')]('EOS');});}catch(_0x5ac5e1){logger['error'](_0x0a2d('0x14'),JSON[_0x0a2d('0x11')](_0x5ac5e1));_0x19260e[_0x0a2d('0x15')]();}}function _0x3cc848(_0x30c838){try{if(_0x30c838){var _0x13e10b=JSON[_0x0a2d('0x16')](_0x30c838);switch(_0x13e10b[_0x0a2d('0x17')]){case 0x0:if(_0x13e10b[_0x0a2d('0x18')]){if(_0x13e10b['result'][_0x0a2d('0x19')]){logger[_0x0a2d('0x6')](_0x0a2d('0x1a'),JSON[_0x0a2d('0x11')](_0x13e10b[_0x0a2d('0x18')]['hypotheses']));_0x571c65=_0x13e10b[_0x0a2d('0x18')][_0x0a2d('0x1b')][0x0][_0x0a2d('0x1c')];_0x18b46f=_0x13e10b[_0x0a2d('0x18')][_0x0a2d('0x1b')][0x0][_0x0a2d('0x1d')];_0x32afad='0';_0xd5dc17=_0x0a2d('0x1e');_0x19260e[_0x0a2d('0x15')]();}}break;case 0x1:logger[_0x0a2d('0x6')](_0x0a2d('0x9'));_0x32afad='1';_0xd5dc17=_0x0a2d('0x9');break;case 0x2:logger[_0x0a2d('0x6')]('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x32afad='2';_0xd5dc17=_0x0a2d('0x1f');break;case 0x9:logger['info']('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x32afad='9';_0xd5dc17=_0x0a2d('0x20');break;case 0xa:logger[_0x0a2d('0x6')](_0x0a2d('0x21'));_0x32afad='10';_0xd5dc17=_0x0a2d('0x21');break;case 0xb:logger[_0x0a2d('0x6')](_0x0a2d('0x22'));_0x32afad='11';_0xd5dc17='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x29d8a7){logger[_0x0a2d('0x23')](_0x0a2d('0x24'),JSON['stringify'](_0x29d8a7));_0x19260e[_0x0a2d('0x15')]();}}function _0x11ad44(){logger[_0x0a2d('0x6')]('Close\x20Tilde\x20ASR\x20socket');_0xd97847({'transcript':_0x571c65,'confidence':_0x18b46f,'status':_0x32afad,'status_message':_0xd5dc17});}function _0x1882f4(_0x3b68ef){logger['error'](_0x0a2d('0x25'));if(!_[_0x0a2d('0x26')](_0x3b68ef)){logger[_0x0a2d('0x23')](_['isObject'](_0x3b68ef)?JSON[_0x0a2d('0x11')](_0x3b68ef):_0x3b68ef);}}_0x19260e['on']('open',_0xade7fa);_0x19260e['on']('message',_0x3cc848);_0x19260e['on'](_0x0a2d('0x27'),_0x11ad44);_0x19260e['on'](_0x0a2d('0x23'),_0x1882f4);});}; \ 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 715cab2..4033421 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 _0xf5d9=['./asr'];(function(_0x45fc6a,_0x166adb){var _0x14bcfd=function(_0x3ba718){while(--_0x3ba718){_0x45fc6a['push'](_0x45fc6a['shift']());}};_0x14bcfd(++_0x166adb);}(_0xf5d9,0xbd));var _0x9f5d=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xf5d9[_0x3ab51d];return _0x29a04e;};var asr=require(_0x9f5d('0x0'));module['exports']={'asr':asr}; \ No newline at end of file +var _0x5f91=['./asr'];(function(_0x21a9d3,_0x37ba15){var _0x4f54ec=function(_0x41d36c){while(--_0x41d36c){_0x21a9d3['push'](_0x21a9d3['shift']());}};_0x4f54ec(++_0x37ba15);}(_0x5f91,0x1dd));var _0x15f9=function(_0x235c94,_0x37db0c){_0x235c94=_0x235c94-0x0;var _0x11bf54=_0x5f91[_0x235c94];return _0x11bf54;};var asr=require(_0x15f9('0x0'));module['exports']={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 6c79a70..2abe719 100644 --- a/server/services/agi/server.js +++ b/server/services/agi/server.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['./error','./channel','127.0.0.1','call','emit','error','createServer','listen','listening','getConnections','destroy','E_AGI_SERVER_MAXCONNECTION','ready','connection','E_AGI_SERVER_ERROR','code','close','E_AGI_SERVER_CLOSE','nextTick','events','EventEmitter'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9c44,0x178));var _0x49c4=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x9c44[_0x8c43de];return _0xa6591b;};'use strict';var util=require('util');var net=require('net');var EventEmitter=require(_0x49c4('0x0'))[_0x49c4('0x1')];var AGIError=require(_0x49c4('0x2'));var AGIChannel=require(_0x49c4('0x3'));var AGIServer=function(_0x455700,_0x2ad237,_0x4e0313){var _0x4941f1=this;var _0x41a183=null;var _0x57effd=0x0;if(!_0x455700)_0x455700=0x11dd;if(!_0x2ad237)_0x2ad237=_0x49c4('0x4');EventEmitter[_0x49c4('0x5')](_0x4941f1);function _0x69bc41(){if(!_0x455700){_0x4941f1[_0x49c4('0x6')](_0x49c4('0x7'),new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x41a183=net[_0x49c4('0x8')]();_0x41a183[_0x49c4('0x9')](_0x455700,_0x2ad237);_0x41a183['on'](_0x49c4('0xa'),function(){_0x4941f1[_0x49c4('0x6')]('listening');});_0x41a183['on']('connection',function(_0x451ea6){_0x41a183[_0x49c4('0xb')](function(_0x58cad7,_0xb611a1){if(_0x58cad7){_0x4941f1[_0x49c4('0x6')]('error',new AGIError('E_AGI_SERVER_ERROR',_0x58cad7));}else if(_0x4e0313&&_0x4e0313<0x0){_0x4941f1[_0x49c4('0x6')](_0x49c4('0x7'),new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x451ea6[_0x49c4('0xc')]();}else if(_0x4e0313&&_0x4e0313>0x0&&_0x4e0313<_0xb611a1){_0x57effd+=0x1;_0x4941f1[_0x49c4('0x6')]('error',new AGIError(_0x49c4('0xd'),_0x57effd));_0x451ea6[_0x49c4('0xc')]();}else{var _0x21f15a=new AGIChannel(_0x451ea6);_0x21f15a['on'](_0x49c4('0xe'),function(){_0x4941f1[_0x49c4('0x6')](_0x49c4('0xf'),_0x21f15a);});}});});_0x41a183['on'](_0x49c4('0x7'),function(_0x3de397){_0x4941f1['emit'](_0x49c4('0x7'),new AGIError(_0x49c4('0x10'),_0x3de397[_0x49c4('0x11')]));});_0x41a183['on'](_0x49c4('0x12'),function(){_0x4941f1[_0x49c4('0x6')]('close',new AGIError(_0x49c4('0x13')));});}process[_0x49c4('0x14')](function(){_0x69bc41();});};util['inherits'](AGIServer,EventEmitter);module['exports']=function(_0x3c782d,_0x2f82d5,_0x3addb2){return new AGIServer(_0x3c782d,_0x2f82d5,_0x3addb2);}; \ No newline at end of file +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(_0x32cd29,_0x29f6bb){var _0x2f7e6e=function(_0x20a924){while(--_0x20a924){_0x32cd29['push'](_0x32cd29['shift']());}};_0x2f7e6e(++_0x29f6bb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa9e0[_0x501510];return _0x1e6ee5;};'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 928fe5a..cf11aba 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 _0x0faf=['replaceAll','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','extra','isConfigured','maxRetry','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','exec','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','grammar','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','wait','callback','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','lumenvoxasr','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','sestekasr','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','getQueryOdbc','variable_id','forEach','keys','setVariable','%s[%s][%s]','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','DIAL','SIP/%s','Executed\x20command\x20%s','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','bot','Trying\x20Dialogflow:\x20%s','toUpperCase','speech','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','private_key','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','DIALOGFLOW_%s','out','DialogflowV2\x20Result\x20%s','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','Sestek\x20NDA\x20%s\x20file\x20created','audiofile','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','getTrunk','no\x20trunk\x20found','trunk_name','phone','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','no\x20variable\x20selected\x20for\x20the\x20result','getData','maxdigit','test','mindigit','no\x20variable\x20found','hiddendigitsnum','first','substr','generate','getsecretdigits','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','aws\x20Polly\x20%s\x20file\x20created','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','aws_bot_name','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','awsLex','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','beep','TILDE_ASR_%s','gotoif','condition','no\x20condition\x20configured','true','false','gotoiftime','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','no\x20key\x20configured','%s/recordings/%s','ispeech\x20%s\x20file\x20created','IspeechASR\x20Result\x20%s','ispeechtts','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','findBy','AGENT\x20%s\x20FOUND\x20BY','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','FIND\x20AGENT\x20%s\x20BY\x20%s','success','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','response','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','Enter\x20in\x20PAUSE\x20(%s)\x20block','no\x20find\x20by\x20configured','playback','opts','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','no\x20queue\x20selected','queue_id','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','number','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sendMail','no\x20mail\x20account\x20configured','getMailAccount','account_id','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','user','bcc','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Answer','Skipped\x20Answer','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','no\x20subproject\x20selected','project_id','no\x20subproject\x20found\x20with\x20id\x20%d','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','host','127.0.0.1','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','apiKey','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','tts','googleTTS','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','util','shelljs','odbc','randomstring','moment','mustache','request-promise','../../config/logger','agi','../../config/environment','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getdigits','rpc','mailRpc','prototype','getVariable','getVariableById','catch','getVoiceQueue','getVoiceQueueById','name','getSquareProject','getSquareProjectById','then','getSquareOdbcById','dsn','getUser','getUserById','getTrunkById','getSound','getSoundById','getSoundPath','save_name','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','map','format','%s/sounds/converted/%s','open','query','Error\x20executing\x20query\x20%s','info','Query\x20executed\x20correctly\x20%s','close','error','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccountById','createSmsMessage','createSquareDetailsReport','channel','uniqueid','label','arg_1','callerid','createSquareRecording','calleridname','context','extension','priority','file','createSquareMessage','createCmContact','isNil','callback_','random','isEmpty','lastName','list_id','scheduledAt','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','internal','%s/%s@from-sip/n','LOCAL','agentLogin','shellCommand','trim','replace','googleCloudTTS','google_cloud_tts_text_type','text','en-US','MALE','MP3','google_tts_language','restAPI','method','timeout','includes','POST','body','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','computedVariables','sync','url','render','stringify','parse','statusCode','statusMessage','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','client_email','dialogflowV2_language','sestekNDA','ispeechTTS','ispeechASR','ispeech_asr_language','model','awsPolly','aws_secret_access_key','aws_polly_region','aws_access_key_id','aws_lex_region','googleASR','tildeASR','appid','appsecret','clear','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','isString','hasOwnProperty','saveRestApiResult','%s.%s','split'];(function(_0x544e70,_0x56f122){var _0x1bb38b=function(_0x21418c){while(--_0x21418c){_0x544e70['push'](_0x544e70['shift']());}};_0x1bb38b(++_0x56f122);}(_0x0faf,0x132));var _0xf0fa=function(_0x3f4891,_0x4e6f62){_0x3f4891=_0x3f4891-0x0;var _0x54f2d8=_0x0faf[_0x3f4891];return _0x54f2d8;};'use strict';var fs=require('fs');var util=require(_0xf0fa('0x0'));var _=require('lodash');var sh=require(_0xf0fa('0x1'));var odbc=require(_0xf0fa('0x2'))();var rs=require(_0xf0fa('0x3'));var moment=require(_0xf0fa('0x4'));var Mustache=require(_0xf0fa('0x5'));var rp=require(_0xf0fa('0x6'));var logger=require(_0xf0fa('0x7'))(_0xf0fa('0x8'));var config=require(_0xf0fa('0x9'));var scripts=require('./scripts');var FILES_PATH=_0xf0fa('0xa');var recursiveMapAttributes=[_0xf0fa('0xb'),_0xf0fa('0xc')];var verticesWithRetry=[_0xf0fa('0xd'),_0xf0fa('0xe'),'getsecretdigits'];var AGIVertices=function(_0x42f7fd,_0x18db40,_0x481a42){this['channel']=_0x42f7fd;this[_0xf0fa('0xf')]=_0x18db40;this[_0xf0fa('0x10')]=_0x481a42;};AGIVertices[_0xf0fa('0x11')][_0xf0fa('0x12')]=function(_0x2bd807,_0x1151ea){this[_0xf0fa('0xf')][_0xf0fa('0x13')](_0x2bd807)['then'](function(_0x2b88c1){_0x1151ea(null,_0x2b88c1?_0x2b88c1['name']:![]);})[_0xf0fa('0x14')](function(_0x521034){_0x1151ea(_0x521034);});};AGIVertices[_0xf0fa('0x11')][_0xf0fa('0x15')]=function(_0x39a086,_0x547952){this['rpc'][_0xf0fa('0x16')](_0x39a086)['then'](function(_0x1f7159){_0x547952(null,_0x1f7159?_0x1f7159[_0xf0fa('0x17')]:![]);})[_0xf0fa('0x14')](function(_0x3203ce){_0x547952(_0x3203ce);});};AGIVertices[_0xf0fa('0x11')][_0xf0fa('0x18')]=function(_0x28bab8,_0x3f3bb7){this['rpc'][_0xf0fa('0x19')](_0x28bab8)[_0xf0fa('0x1a')](function(_0x30ce17){_0x3f3bb7(null,_0x30ce17?_0x30ce17[_0xf0fa('0x17')]:![]);})[_0xf0fa('0x14')](function(_0x386e5f){_0x3f3bb7(_0x386e5f);});};AGIVertices['prototype']['getSquareOdbc']=function(_0x2f376d,_0x2751cc){this[_0xf0fa('0xf')][_0xf0fa('0x1b')](_0x2f376d)[_0xf0fa('0x1a')](function(_0x403e7d){_0x2751cc(null,_0x403e7d?_0x403e7d[_0xf0fa('0x1c')]:![]);})[_0xf0fa('0x14')](function(_0x3b87a2){_0x2751cc(_0x3b87a2);});};AGIVertices[_0xf0fa('0x11')][_0xf0fa('0x1d')]=function(_0x5bead8,_0x10c93e){this[_0xf0fa('0xf')][_0xf0fa('0x1e')](_0x5bead8)[_0xf0fa('0x1a')](function(_0x3273b9){_0x10c93e(null,_0x3273b9?_0x3273b9[_0xf0fa('0x17')]:![]);})[_0xf0fa('0x14')](function(_0x1f0eaf){_0x10c93e(_0x1f0eaf);});};AGIVertices[_0xf0fa('0x11')]['getTrunk']=function(_0xeb86a9,_0x19e392){this['rpc'][_0xf0fa('0x1f')](_0xeb86a9)[_0xf0fa('0x1a')](function(_0x2efe88){_0x19e392(null,_0x2efe88?_0x2efe88['name']:![]);})[_0xf0fa('0x14')](function(_0x284499){_0x19e392(_0x284499);});};AGIVertices[_0xf0fa('0x11')][_0xf0fa('0x20')]=function(_0x4e6eef,_0x4be235){var _0x287810=this;this[_0xf0fa('0xf')][_0xf0fa('0x21')](_0x4e6eef)[_0xf0fa('0x1a')](function(_0x57b8e9){_0x4be235(null,_0x57b8e9?_0x287810[_0xf0fa('0x22')](_0x57b8e9[_0xf0fa('0x23')]):![]);})[_0xf0fa('0x14')](function(_0x5a4fd3){_0x4be235(_0x5a4fd3);});};AGIVertices[_0xf0fa('0x11')]['getMailAccount']=function(_0x42c656,_0x1e3875){this[_0xf0fa('0xf')]['getMailAccountById'](_0x42c656)[_0xf0fa('0x1a')](function(_0x33cc64){_0x1e3875(null,_0x33cc64?_0x33cc64:![]);})[_0xf0fa('0x14')](function(_0x212986){_0x1e3875(_0x212986);});};AGIVertices[_0xf0fa('0x11')][_0xf0fa('0x24')]=function(_0x490613,_0x534c10,_0x36173a){this[_0xf0fa('0x10')]['sendMailMessage'](_0x490613,_0x534c10)[_0xf0fa('0x1a')](function(){_0x36173a(null);})['catch'](function(_0x5ca1b2){_0x36173a(_0x5ca1b2);});};AGIVertices['prototype'][_0xf0fa('0x25')]=function(_0x5c82d7,_0x2c0721){this[_0xf0fa('0xf')][_0xf0fa('0x26')](_0x5c82d7)[_0xf0fa('0x1a')](function(_0x19c97e){if(_0x19c97e){if(_0x19c97e[_0xf0fa('0x27')]){_0x2c0721(null,[_0x19c97e[_0xf0fa('0x28')]]);}else{_0x2c0721(null,_[_0xf0fa('0x29')](_0x19c97e['Intervals'],_0xf0fa('0x28')));}}else{_0x2c0721(null,![]);}})[_0xf0fa('0x14')](function(_0x36dd2b){_0x2c0721(_0x36dd2b);});};AGIVertices['prototype'][_0xf0fa('0x22')]=function(_0x114feb){return util[_0xf0fa('0x2a')](_0xf0fa('0x2b'),FILES_PATH,_0x114feb);};AGIVertices['prototype']['getQueryOdbc']=function(_0x2a9f4b,_0x68b3fe,_0x2a6560){odbc[_0xf0fa('0x2c')](_0x2a9f4b,function(_0x3a238d){if(_0x3a238d){logger['error']('Error\x20getting\x20ODBC\x20connection\x20%s',_0x3a238d);_0x2a6560(_0x3a238d);}else{logger['info']('ODBC\x20connection\x20successfully');odbc[_0xf0fa('0x2d')](_0x68b3fe,function(_0x778121,_0x5ef93e){if(_0x778121){logger['info'](_0xf0fa('0x2e'),_0x68b3fe);_0x2a6560(_0x778121);}else{logger[_0xf0fa('0x2f')](_0xf0fa('0x30'),_0x68b3fe);odbc[_0xf0fa('0x31')](function(_0x2202de){if(_0x2202de){logger[_0xf0fa('0x32')](_0xf0fa('0x33'),_0x2202de);}_0x2a6560(null,_0x5ef93e);});}});}});};AGIVertices['prototype']['getSmsAccount']=function(_0x344bb0,_0x1d4830){this[_0xf0fa('0xf')][_0xf0fa('0x34')](_0x344bb0)[_0xf0fa('0x1a')](function(_0x1d0129){_0x1d4830(null,_0x1d0129?_0x1d0129:![]);})['catch'](function(_0x17d3a5){_0x1d4830(_0x17d3a5);});};AGIVertices['prototype'][_0xf0fa('0x35')]=function(_0x466369,_0x6e1fd9){this[_0xf0fa('0xf')][_0xf0fa('0x35')](_0x466369)[_0xf0fa('0x1a')](function(_0x14c962){_0x6e1fd9(null,_0x14c962);})[_0xf0fa('0x14')](function(_0x2fc4b1){_0x6e1fd9(_0x2fc4b1);});};AGIVertices['prototype']['createSquareDetailsReport']=function(_0x52221a,_0x304bae,_0x34be72){this['rpc'][_0xf0fa('0x36')]({'uniqueid':this[_0xf0fa('0x37')][_0xf0fa('0x38')],'node':_0x52221a[_0xf0fa('0x39')],'application':_0x52221a['agicommand'],'data':_0x304bae||null,'project_name':this[_0xf0fa('0x37')][_0xf0fa('0x3a')],'callerid':this[_0xf0fa('0x37')][_0xf0fa('0x3b')]})[_0xf0fa('0x1a')](function(_0x207a9d){if(_0x34be72){_0x34be72(null,_0x207a9d);}})[_0xf0fa('0x14')](function(_0x295edd){if(_0x34be72){_0x34be72(_0x295edd);}});};AGIVertices[_0xf0fa('0x11')]['createSquareRecording']=function(_0x45c0e8,_0x3b5bfa,_0x896adf,_0x24ae12){this[_0xf0fa('0xf')][_0xf0fa('0x3c')]({'uniqueid':this['channel'][_0xf0fa('0x38')],'callerid':this[_0xf0fa('0x37')]['callerid'],'calleridname':this[_0xf0fa('0x37')][_0xf0fa('0x3d')],'context':this[_0xf0fa('0x37')][_0xf0fa('0x3e')],'extension':this[_0xf0fa('0x37')][_0xf0fa('0x3f')],'priority':this[_0xf0fa('0x37')][_0xf0fa('0x40')],'accountcode':this[_0xf0fa('0x37')]['accountcode'],'dnid':this[_0xf0fa('0x37')]['dnid'],'projectName':this[_0xf0fa('0x37')][_0xf0fa('0x3a')],'saveName':_0x3b5bfa,'filename':_0x45c0e8[_0xf0fa('0x41')]||_0x3b5bfa,'savePath':_0x896adf})['then'](function(_0x324765){_0x24ae12(null,_0x324765);})[_0xf0fa('0x14')](function(_0x354f03){_0x24ae12(_0x354f03);});};AGIVertices[_0xf0fa('0x11')][_0xf0fa('0x42')]=function(_0x521106,_0xbfcbff,_0x4cda3e,_0x19c22f,_0x821e40){this[_0xf0fa('0xf')][_0xf0fa('0x42')]({'uniqueid':this[_0xf0fa('0x37')]['uniqueid'],'body':_0x521106,'direction':_0xbfcbff,'providerName':_0x4cda3e,'providerResponse':_0x19c22f})[_0xf0fa('0x1a')](function(_0x1ea31d){if(_0x821e40){_0x821e40(null,_0x1ea31d);}})[_0xf0fa('0x14')](function(_0x401995){if(_0x821e40){_0x821e40(_0x401995);}});};AGIVertices[_0xf0fa('0x11')][_0xf0fa('0x43')]=function(_0x52e781,_0x44a3bf){this['rpc']['createCmContact']({'firstName':_['isEmpty'](_0x52e781[_0xf0fa('0x17')])||_[_0xf0fa('0x44')](_0x52e781[_0xf0fa('0x17')])?_0xf0fa('0x45')+Math[_0xf0fa('0x46')]():_0x52e781[_0xf0fa('0x17')],'lastName':_[_0xf0fa('0x47')](_0x52e781[_0xf0fa('0x48')])||_[_0xf0fa('0x44')](_0x52e781['lastName'])?null:_0x52e781[_0xf0fa('0x48')],'phone':_0x52e781['phone'],'ListId':_0x52e781[_0xf0fa('0x49')],'scheduledat':_0x52e781[_0xf0fa('0x4a')],'callbackUniqueid':this[_0xf0fa('0x37')][_0xf0fa('0x38')],'tags':'callback','description':_0xf0fa('0x4b')+_0x52e781['scheduledAt'][_0xf0fa('0x4c')](),'priority':_0x52e781[_0xf0fa('0x4d')]})[_0xf0fa('0x1a')](function(_0x1d6a27){_0x44a3bf(null,_0x1d6a27);})[_0xf0fa('0x14')](function(_0x1fad44){_0x44a3bf(_0x1fad44);});};AGIVertices['prototype'][_0xf0fa('0x4e')]=function(_0x119816,_0x4a20f4){this[_0xf0fa('0xf')][_0xf0fa('0x4f')](_0x119816)['then'](function(_0x48d769){_0x4a20f4(null,_0x48d769?_0x48d769[_0xf0fa('0x17')]:![]);})['catch'](function(_0xd01a7a){_0x4a20f4(_0xd01a7a);});};AGIVertices[_0xf0fa('0x11')][_0xf0fa('0x50')]=function(_0x4db972,_0x2a3b50,_0x190f2b){var _0x480dc0={'role':_0xf0fa('0x51')};_0x480dc0[_0x4db972]=this[_0xf0fa('0x37')][_0xf0fa('0x3b')];this['rpc'][_0xf0fa('0x50')](_0x480dc0,_0x2a3b50,this[_0xf0fa('0x37')]['uniqueid'])[_0xf0fa('0x1a')](function(_0x76b183){_0x190f2b(null,_[_0xf0fa('0x44')](_0x76b183)?![]:!![]);})[_0xf0fa('0x14')](function(_0x32367e){logger[_0xf0fa('0x32')](_0x32367e);_0x190f2b(null,![]);});};AGIVertices[_0xf0fa('0x11')][_0xf0fa('0x52')]=function(_0x32c846,_0x2c2c30){var _0x53f45c={'role':_0xf0fa('0x51')};_0x53f45c[_0x32c846]=this[_0xf0fa('0x37')][_0xf0fa('0x3b')];this[_0xf0fa('0xf')][_0xf0fa('0x52')](_0x53f45c)[_0xf0fa('0x1a')](function(_0x15010d){_0x2c2c30(null,_['isNil'](_0x15010d)?![]:!![]);})[_0xf0fa('0x14')](function(_0x195632){logger[_0xf0fa('0x32')](_0x195632);_0x2c2c30(null,![]);});};AGIVertices[_0xf0fa('0x11')][_0xf0fa('0x53')]=function(_0x173166,_0x38fd3f){var _0x543a2c={'role':_0xf0fa('0x51')};_0x543a2c[_0x173166]=this[_0xf0fa('0x37')][_0xf0fa('0x3b')];this[_0xf0fa('0xf')][_0xf0fa('0x53')](_0x543a2c)['then'](function(_0x5f023b){_0x38fd3f(null,_['isNil'](_0x5f023b)?![]:!![]);})[_0xf0fa('0x14')](function(_0x29c996){logger[_0xf0fa('0x32')](_0x29c996);_0x38fd3f(null,![]);});};AGIVertices[_0xf0fa('0x11')]['agentLogin']=function(_0x4a7326,_0x2faa6f){var _0x5f4921={'role':_0xf0fa('0x51')};_0x5f4921[_0x4a7326]=this[_0xf0fa('0x37')][_0xf0fa('0x3b')];var _0x23b368=_0x4a7326!=_0xf0fa('0x54')?util['format'](_0xf0fa('0x55'),_0xf0fa('0x56'),this[_0xf0fa('0x37')][_0xf0fa('0x3b')]):undefined;this[_0xf0fa('0xf')][_0xf0fa('0x57')](_0x5f4921,_0x23b368)[_0xf0fa('0x1a')](function(_0x35e7e7){_0x2faa6f(null,_[_0xf0fa('0x44')](_0x35e7e7)?![]:!![]);})['catch'](function(_0x5b166d){logger[_0xf0fa('0x32')](_0x5b166d);_0x2faa6f(null,![]);});};AGIVertices['prototype'][_0xf0fa('0x58')]=function(_0x583a0b,_0x4b3cb6){sh['exec'](_[_0xf0fa('0x59')](_0x583a0b),function(_0x415a1b,_0x735e07){var _0xb31dcf=_0x735e07[_0xf0fa('0x5a')](/(\r\n|\n|\r)/gm,'');_0x4b3cb6(null,_0xb31dcf);});};AGIVertices[_0xf0fa('0x11')][_0xf0fa('0x5b')]=function(_0x2b7965,_0x2a5a11){scripts[_0xf0fa('0x5b')](_0x2b7965['apiKey'],_0x2b7965[_0xf0fa('0x5c')]||'text',_0x2b7965[_0xf0fa('0x5d')],_0x2b7965['languageCode']||_0xf0fa('0x5e'),_0x2b7965['ssmlGender']||_0xf0fa('0x5f'),_0x2b7965['audioEncoding']||_0xf0fa('0x60'))[_0xf0fa('0x1a')](function(_0x274ae3){_0x2a5a11(null,_0x274ae3);})[_0xf0fa('0x14')](function(_0xf11c3c){_0x2a5a11(_0xf11c3c);});};AGIVertices['prototype']['googleTTS']=function(_0x4224ce,_0x157772){scripts['googleTTS'](_0x4224ce['text'],_0x4224ce[_0xf0fa('0x61')]||'en',0x1)[_0xf0fa('0x1a')](function(_0x176ae6){_0x157772(null,_0x176ae6);})[_0xf0fa('0x14')](function(_0x2748ef){_0x157772(_0x2748ef);});};AGIVertices['prototype'][_0xf0fa('0x62')]=function(_0x3bdb88,_0x16492b){var _0x5ab304={'uri':_0x3bdb88['url'],'method':_0x3bdb88[_0xf0fa('0x63')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x3bdb88[_0xf0fa('0x64')])==='number'&&parseInt(_0x3bdb88['timeout'])>=0x1?parseInt(_0x3bdb88[_0xf0fa('0x64')])*0x3e8:0x5*0x3e8};if(_[_0xf0fa('0x65')]([_0xf0fa('0x66'),'PUT'],_0x5ab304['method']['toUpperCase']())){try{_0x5ab304[_0xf0fa('0x67')]=_0x3bdb88['rawBody']?JSON['parse'](_0x3bdb88[_0xf0fa('0xc')]):{};}catch(_0xfb68fd){logger[_0xf0fa('0x32')](_0xf0fa('0x68'),_0xfb68fd);}}try{_0x5ab304[_0xf0fa('0x69')]=_0x3bdb88[_0xf0fa('0xb')]?JSON['parse'](_0x3bdb88[_0xf0fa('0xb')]):{};}catch(_0x18281f){logger[_0xf0fa('0x32')]('An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function',_0x18281f);}if(_0x3bdb88[_0xf0fa('0x6a')]){try{var _0x4b803f=require(_0x3bdb88['computedVariables'])[_0xf0fa('0x6b')](this,_0x5ab304);_0x5ab304['uri']=Mustache['render'](_0x3bdb88[_0xf0fa('0x6c')],_0x4b803f,{},['$$','$$']);if(_0x5ab304[_0xf0fa('0x69')]){_0x5ab304[_0xf0fa('0x69')]=JSON['parse'](Mustache[_0xf0fa('0x6d')](JSON[_0xf0fa('0x6e')](_0x5ab304['headers']),_0x4b803f,{},['$$','$$']));}if(_0x5ab304[_0xf0fa('0x67')]){_0x5ab304[_0xf0fa('0x67')]=JSON[_0xf0fa('0x6f')](Mustache[_0xf0fa('0x6d')](JSON[_0xf0fa('0x6e')](_0x5ab304[_0xf0fa('0x67')]),_0x4b803f,{},['$$','$$']));}}catch(_0x56265f){logger[_0xf0fa('0x32')]('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x56265f);}}rp(_0x5ab304)[_0xf0fa('0x1a')](function(_0x1371d1){var _0x15987a={'statusCode':_0x1371d1[_0xf0fa('0x70')]||0xc8,'statusMessage':_0x1371d1[_0xf0fa('0x71')]||'OK','headers':_0x1371d1[_0xf0fa('0x69')]||{},'body':_0x1371d1[_0xf0fa('0x67')]||{}};_0x16492b(null,_0x15987a);})['catch'](function(_0x5b0bdd){var _0x9700df={'statusCode':_0x5b0bdd[_0xf0fa('0x70')]||0x1f4,'statusMessage':_0x5b0bdd['message']||_0xf0fa('0x72'),'headers':_0x5b0bdd['options']['headers']||{},'body':_0x5b0bdd[_0xf0fa('0x73')][_0xf0fa('0x67')]||{}};_0x16492b(null,_0x9700df);});};AGIVertices['prototype']['googleDialogflow']=function(_0x2fe9b0,_0x5fbd7f){scripts[_0xf0fa('0x74')](this[_0xf0fa('0x37')][_0xf0fa('0x38')],_0x2fe9b0[_0xf0fa('0x75')],_0x2fe9b0['text'],_0x2fe9b0[_0xf0fa('0x76')]||'en')[_0xf0fa('0x1a')](function(_0x4c5de4){_0x5fbd7f(null,_0x4c5de4);})[_0xf0fa('0x14')](function(_0x509d8a){_0x5fbd7f(_0x509d8a);});};AGIVertices[_0xf0fa('0x11')]['googleDialogflowV2']=function(_0x4867ca,_0x2bb0bf){scripts['googleDialogflowV2'](this['channel']['uniqueid'],_0x4867ca['dialogflowV2_project_id'],_0x4867ca[_0xf0fa('0x77')],_0x4867ca['private_key'],_0x4867ca[_0xf0fa('0x5d')],_0x4867ca[_0xf0fa('0x78')]||'en')['then'](function(_0x462917){_0x2bb0bf(null,_0x462917);})[_0xf0fa('0x14')](function(_0x2d22b9){_0x2bb0bf(_0x2d22b9);});};AGIVertices[_0xf0fa('0x11')]['sestekNDA']=function(_0x335e53,_0x5d5adb){scripts[_0xf0fa('0x79')](this['channel'],_0x335e53)[_0xf0fa('0x1a')](function(_0x1c5b5e){_0x5d5adb(null,_0x1c5b5e);})[_0xf0fa('0x14')](function(_0x3c5191){_0x5d5adb(_0x3c5191);});};AGIVertices['prototype']['ispeechTTS']=function(_0x107e5b,_0x516e13){scripts[_0xf0fa('0x7a')](_0x107e5b[_0xf0fa('0x75')],_0x107e5b[_0xf0fa('0x5d')],_0x107e5b['ispeech_tts_language']||_0xf0fa('0x5e'),_0x107e5b['speed'])[_0xf0fa('0x1a')](function(_0x2d4e61){_0x516e13(null,_0x2d4e61);})[_0xf0fa('0x14')](function(_0x52cf85){_0x516e13(_0x52cf85);});};AGIVertices[_0xf0fa('0x11')]['ispeechASR']=function(_0xb03a62,_0x378536,_0x5089d1){scripts[_0xf0fa('0x7b')](_0x378536,_0xb03a62[_0xf0fa('0x75')],_0xb03a62[_0xf0fa('0x7c')]||_0xf0fa('0x5e'),this['isConfigured'](_0xb03a62[_0xf0fa('0x7d')])?_0xb03a62['model']:undefined)['then'](function(_0x2ea054){_0x5089d1(null,_0x2ea054);})[_0xf0fa('0x14')](function(_0x559954){_0x5089d1(_0x559954);});};AGIVertices['prototype'][_0xf0fa('0x7e')]=function(_0x428a1b,_0x518fa0){scripts[_0xf0fa('0x7e')](_0x428a1b['aws_access_key_id'],_0x428a1b[_0xf0fa('0x7f')],_0x428a1b[_0xf0fa('0x80')],_0x428a1b['aws_polly_voice']||'Amy',_0x428a1b[_0xf0fa('0x5d')],_0x428a1b['aws_text_type']||_0xf0fa('0x5d'))[_0xf0fa('0x1a')](function(_0x2b79df){_0x518fa0(null,_0x2b79df);})['catch'](function(_0x577ea1){_0x518fa0(_0x577ea1);});};AGIVertices[_0xf0fa('0x11')]['awsLex']=function(_0x24b4d7,_0x3efb38){scripts['awsLex'](this[_0xf0fa('0x37')]['uniqueid'],_0x24b4d7[_0xf0fa('0x81')],_0x24b4d7[_0xf0fa('0x7f')],_0x24b4d7[_0xf0fa('0x82')],_0x24b4d7[_0xf0fa('0x5d')],_0x24b4d7['aws_bot_name'])['then'](function(_0x13d530){_0x3efb38(null,_0x13d530);})['catch'](function(_0x3185f9){_0x3efb38(_0x3185f9);});};AGIVertices['prototype']['googleASR']=function(_0x1222fa,_0x501bd3,_0x49e7ea){scripts[_0xf0fa('0x83')](_0x501bd3,_0x1222fa['key'],_0x1222fa['google_asr_language']||_0xf0fa('0x5e'))[_0xf0fa('0x1a')](function(_0x4a784d){_0x49e7ea(null,_0x4a784d);})[_0xf0fa('0x14')](function(_0x4e6958){_0x49e7ea(_0x4e6958);});};AGIVertices['prototype'][_0xf0fa('0x84')]=function(_0x5bf4d8,_0x585899,_0x3fa423){scripts['tildeASR'](_0x585899,_0x5bf4d8[_0xf0fa('0x85')],_0x5bf4d8[_0xf0fa('0x86')],_0x5bf4d8['uri'])[_0xf0fa('0x1a')](function(_0x41abf7){_0x3fa423(null,_0x41abf7);})[_0xf0fa('0x14')](function(_0x52f89e){_0x3fa423(_0x52f89e);});};AGIVertices[_0xf0fa('0x11')][_0xf0fa('0x87')]=function(_0x4980fd){var _0x5b641c=_[_0xf0fa('0x65')](verticesWithRetry,_0x4980fd['agicommand'])?_0x4980fd:_['clone'](_0x4980fd);for(var _0xca1bd in _0x5b641c){if(_0x5b641c['hasOwnProperty'](_0xca1bd)){if(_0x5b641c[_0xca1bd]&&_['isString'](_0x5b641c[_0xca1bd])){if(_[_0xf0fa('0x65')](recursiveMapAttributes,_0xca1bd)){_0x5b641c[_0xca1bd]=this['replaceObjectAllVariables'](_0x5b641c[_0xca1bd]);}else{_0x5b641c[_0xca1bd]=this[_0xf0fa('0x88')](_0x5b641c[_0xca1bd]);}}}}return _0x5b641c;};AGIVertices[_0xf0fa('0x11')][_0xf0fa('0x89')]=function(_0x2cb50b){for(var _0x941975 in _0x2cb50b){if(_0x2cb50b['hasOwnProperty'](_0x941975)){if(_[_0xf0fa('0x8a')](_0x2cb50b[_0x941975])){this[_0xf0fa('0x89')](_0x2cb50b[_0x941975]);}else if(_[_0xf0fa('0x8b')](_0x2cb50b[_0x941975])){for(var _0x390a37=0x0;_0x390a37<_0x2cb50b[_0x941975][_0xf0fa('0x8c')];_0x390a37++){this[_0xf0fa('0x89')](_0x2cb50b[_0x941975][_0x390a37]);}}else if(_[_0xf0fa('0x8d')](_0x2cb50b[_0x941975])){_0x2cb50b[_0x941975]=this[_0xf0fa('0x88')](_0x2cb50b[_0x941975]);}}}};AGIVertices['prototype']['saveRestApiResult']=function(_0x397378,_0x55dade){for(var _0x4c3271 in _0x397378){if(_0x397378[_0xf0fa('0x8e')](_0x4c3271)){if(_[_0xf0fa('0x8a')](_0x397378[_0x4c3271])){if(!_[_0xf0fa('0x47')](_0x397378[_0x4c3271])){this[_0xf0fa('0x8f')](_0x397378[_0x4c3271],util[_0xf0fa('0x2a')](_0xf0fa('0x90'),_0x55dade,_0x4c3271));}}else if(_[_0xf0fa('0x8b')](_0x397378[_0x4c3271])){for(var _0x11b75c=0x0;_0x11b75c<_0x397378[_0x4c3271]['length'];_0x11b75c++){this['saveRestApiResult'](_0x397378[_0x4c3271][_0x11b75c],util['format']('%s.%s',_0x55dade,_0x4c3271+'['+_0x11b75c+']'));}}else{if(!_[_0xf0fa('0x44')](_0x397378[_0x4c3271])){this[_0xf0fa('0x37')]['setVariable'](util[_0xf0fa('0x2a')](_0xf0fa('0x90'),_0x55dade,_0x4c3271),_0x397378[_0x4c3271]);}}}}};AGIVertices[_0xf0fa('0x11')]['replaceObjectAllVariables']=function(_0x5c3729){try{var _0x893912=JSON[_0xf0fa('0x6f')](_0x5c3729);this[_0xf0fa('0x89')](_0x893912);return JSON[_0xf0fa('0x6e')](_0x893912);}catch(_0x44b3cf){return this[_0xf0fa('0x88')](_0x5c3729);}};AGIVertices['prototype']['replaceAllVariables']=function(_0x460bbf){var _0x4e1d72=_0x460bbf[_0xf0fa('0x91')]('{');for(var _0x1cfd96=0x1;_0x1cfd96<_0x4e1d72[_0xf0fa('0x8c')];_0x1cfd96+=0x1){var _0x276e6c=_0x4e1d72[_0x1cfd96][_0xf0fa('0x91')]('}');if(_0x276e6c[_0xf0fa('0x8c')]>0x1){_0x460bbf=_0x460bbf[_0xf0fa('0x92')]('{'+_0x276e6c[0x0]+'}',this[_0xf0fa('0x37')][_0xf0fa('0x12')](_0x276e6c[0x0])['extra']||_0x276e6c[0x0]);}}if(_0x4e1d72[_0xf0fa('0x8c')]===0x1){return _0x460bbf['toString']();}return this['replaceAllVariables'](_0x460bbf);};AGIVertices[_0xf0fa('0x11')][_0xf0fa('0x93')]=function(_0x5d67a8,_0x244987){var _0x70f9ac=this['channel'][_0xf0fa('0x12')](_0x5d67a8);if(_0x70f9ac[_0xf0fa('0x94')]===-0x1){return _0x70f9ac;}logger[_0xf0fa('0x2f')](util['format'](_0xf0fa('0x95'),_0x244987,_0x70f9ac[_0xf0fa('0x96')]));return this[_0xf0fa('0x37')]['setVariable'](_0x244987,_0x70f9ac[_0xf0fa('0x96')]);};AGIVertices[_0xf0fa('0x11')][_0xf0fa('0x97')]=function(_0x33b25d){return _0x33b25d&&_0x33b25d!=='0'&&_0x33b25d!=='-1'&&_0x33b25d!=='';};AGIVertices[_0xf0fa('0x11')][_0xf0fa('0x98')]=function(_0x3cdfbb){this[_0xf0fa('0x36')][_0xf0fa('0x6b')](this,_0x3cdfbb,'-');_0x3cdfbb[_0xf0fa('0x99')]=_0x3cdfbb[_0xf0fa('0x98')];return{'code':0xc8,'result':'-'};};AGIVertices[_0xf0fa('0x11')][_0xf0fa('0x9a')]=function(_0x284e7d){logger[_0xf0fa('0x2f')](util[_0xf0fa('0x2a')](_0xf0fa('0x9b'),_0x284e7d[_0xf0fa('0x39')]));if(!this[_0xf0fa('0x97')](_0x284e7d[_0xf0fa('0x5d')])){return this[_0xf0fa('0x37')][_0xf0fa('0x9c')](_0xf0fa('0x9d'));}var _0x4a8cda='\x22'+_0x284e7d['text']+'\x22';if(this[_0xf0fa('0x97')](_0x284e7d[_0xf0fa('0x73')])){_0x4a8cda+=','+_0x284e7d[_0xf0fa('0x73')];}var _0x15291c=this[_0xf0fa('0x37')][_0xf0fa('0x9e')](_0xf0fa('0x9f'),_0x4a8cda);if(_0x15291c[_0xf0fa('0x94')]===-0x1){return _0x15291c;}return this[_0xf0fa('0x37')][_0xf0fa('0x9c')](util[_0xf0fa('0x2a')](_0xf0fa('0xa0'),_0x4a8cda));};AGIVertices['prototype'][_0xf0fa('0xa1')]=function(_0x4c85b9){logger[_0xf0fa('0x2f')](util[_0xf0fa('0x2a')]('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x4c85b9[_0xf0fa('0x39')]));if(!this[_0xf0fa('0x97')](_0x4c85b9[_0xf0fa('0xa2')])){return this[_0xf0fa('0x37')][_0xf0fa('0x9c')](_0xf0fa('0xa3'));}var _0xa1d2e2=_0x4c85b9['grammar'];if(this['isConfigured'](_0x4c85b9[_0xf0fa('0x73')])){_0xa1d2e2+=','+_0x4c85b9[_0xf0fa('0x73')];}var _0x2f2a97=this['channel'][_0xf0fa('0x9e')](_0xf0fa('0xa4'),_0xa1d2e2);if(_0x2f2a97[_0xf0fa('0x94')]===-0x1){return _0x2f2a97;}var _0x37685c=this[_0xf0fa('0x93')](_0xf0fa('0xa5'),_0xf0fa('0xa6'));if(_0x37685c[_0xf0fa('0x94')]===-0x1){return _0x37685c;}var _0x18fe3d=this[_0xf0fa('0x93')]('RECOG_INPUT()',_0xf0fa('0xa7'));if(_0x18fe3d['result']===-0x1){return _0x18fe3d;}var _0x2906b4=this[_0xf0fa('0x93')](_0xf0fa('0xa8'),_0xf0fa('0xa9'));if(_0x2906b4[_0xf0fa('0x94')]===-0x1){return _0x2906b4;}return this[_0xf0fa('0x37')][_0xf0fa('0x9c')](util[_0xf0fa('0x2a')]('Executed\x20command\x20MRCPRecog\x20%s',_0xa1d2e2));};AGIVertices['prototype'][_0xf0fa('0x8')]=function(_0x351a37){logger[_0xf0fa('0x2f')](util[_0xf0fa('0x2a')](_0xf0fa('0xaa'),_0x351a37[_0xf0fa('0x39')]));return this[_0xf0fa('0x37')]['agi']([_0x351a37[_0xf0fa('0xab')],_0x351a37[_0xf0fa('0xac')]]);};AGIVertices[_0xf0fa('0x11')][_0xf0fa('0xad')]=function(_0x3f068f){logger[_0xf0fa('0x2f')](util[_0xf0fa('0x2a')]('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x3f068f[_0xf0fa('0x39')]));if(this[_0xf0fa('0x97')](_0x3f068f[_0xf0fa('0x64')])){logger[_0xf0fa('0x2f')](util[_0xf0fa('0x2a')]('Wait\x20%s\x20seconds\x20before\x20answer',_0x3f068f[_0xf0fa('0x64')]));var _0x5b40d9=this[_0xf0fa('0x37')][_0xf0fa('0xae')](_0x3f068f[_0xf0fa('0x64')]);if(_0x5b40d9['result']===-0x1){return _0x5b40d9;}}return this['channel'][_0xf0fa('0xad')]();};AGIVertices[_0xf0fa('0x11')][_0xf0fa('0xaf')]=function(_0x26ccd4){logger['info'](util[_0xf0fa('0x2a')](_0xf0fa('0xb0'),_0x26ccd4[_0xf0fa('0x39')]));if(!this[_0xf0fa('0x97')](_0x26ccd4[_0xf0fa('0x49')])){return this[_0xf0fa('0x37')]['error'](_0x26ccd4,_0xf0fa('0xb1'));}_0x26ccd4['scheduledAt']=moment();if(this['isConfigured'](_0x26ccd4[_0xf0fa('0xb2')])){_0x26ccd4[_0xf0fa('0x4a')]=moment()['add'](_0x26ccd4[_0xf0fa('0xb2')],'minutes');}if(!this[_0xf0fa('0x97')](_0x26ccd4['callback_priority'])){_0x26ccd4['callback_priority']=0x2;}this[_0xf0fa('0x43')][_0xf0fa('0x6b')](this,_0x26ccd4);return this[_0xf0fa('0x37')][_0xf0fa('0x9c')](util[_0xf0fa('0x2a')](_0xf0fa('0xb3'),_0x26ccd4['phone'],_0x26ccd4[_0xf0fa('0x49')],_0x26ccd4[_0xf0fa('0x4a')]));};AGIVertices[_0xf0fa('0x11')][_0xf0fa('0xb4')]=function(_0x2abf2c){logger[_0xf0fa('0x2f')](util[_0xf0fa('0x2a')](_0xf0fa('0xb5'),_0x2abf2c['label']));var _0x32d4bf=this[_0xf0fa('0x37')][_0xf0fa('0x9e')](_0x2abf2c[_0xf0fa('0xb6')],_0x2abf2c[_0xf0fa('0x73')]);if(_0x32d4bf[_0xf0fa('0x94')]===-0x1){return _0x32d4bf;}return this[_0xf0fa('0x37')][_0xf0fa('0x9c')](util[_0xf0fa('0x2a')](_0xf0fa('0xb7'),_0x2abf2c[_0xf0fa('0xb6')],_0x2abf2c['options']));};AGIVertices[_0xf0fa('0x11')][_0xf0fa('0xb8')]=function(_0x31fd29){logger[_0xf0fa('0x2f')](util[_0xf0fa('0x2a')](_0xf0fa('0xb9'),_0x31fd29[_0xf0fa('0x39')]));if(!this[_0xf0fa('0x97')](_0x31fd29['text'])){return this[_0xf0fa('0x37')][_0xf0fa('0x9c')](_0xf0fa('0x9d'));}var _0x5eb4a1='\x22'+_0x31fd29[_0xf0fa('0x5d')]+'\x22';if(this[_0xf0fa('0x97')](_0x31fd29[_0xf0fa('0x73')])){_0x5eb4a1+=','+_0x31fd29['options'];}var _0x3db914=this[_0xf0fa('0x37')][_0xf0fa('0x9e')]('MRCPSynth',_0x5eb4a1);if(_0x3db914[_0xf0fa('0x94')]===-0x1){return _0x3db914;}return this[_0xf0fa('0x37')][_0xf0fa('0x9c')](util[_0xf0fa('0x2a')](_0xf0fa('0xa0'),_0x5eb4a1));};AGIVertices[_0xf0fa('0x11')][_0xf0fa('0xba')]=function(_0x5252e1){logger['info'](util[_0xf0fa('0x2a')]('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x5252e1[_0xf0fa('0x39')]));if(!this['isConfigured'](_0x5252e1[_0xf0fa('0x5d')])){return this['channel'][_0xf0fa('0x9c')](_0xf0fa('0x9d'));}var _0x5b9e3f='\x22'+_0x5252e1[_0xf0fa('0x5d')]+'\x22';if(this['isConfigured'](_0x5252e1[_0xf0fa('0x73')])){_0x5b9e3f+=','+_0x5252e1[_0xf0fa('0x73')];}var _0xf185c0=this['channel']['exec']('MRCPSynth',_0x5b9e3f);if(_0xf185c0['result']===-0x1){return _0xf185c0;}return this[_0xf0fa('0x37')]['noop'](util['format'](_0xf0fa('0xa0'),_0x5b9e3f));};AGIVertices[_0xf0fa('0x11')][_0xf0fa('0xbb')]=function(_0x22fb88){logger[_0xf0fa('0x2f')](util[_0xf0fa('0x2a')]('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x22fb88[_0xf0fa('0x39')]));if(!this[_0xf0fa('0x97')](_0x22fb88[_0xf0fa('0xa2')])){return this[_0xf0fa('0x37')][_0xf0fa('0x9c')](_0xf0fa('0xa3'));}var _0x54e88d=_0x22fb88[_0xf0fa('0xa2')];if(this['isConfigured'](_0x22fb88[_0xf0fa('0x73')])){_0x54e88d+=','+_0x22fb88[_0xf0fa('0x73')];}var _0x2f236f=this[_0xf0fa('0x37')][_0xf0fa('0x9e')](_0xf0fa('0xa4'),_0x54e88d);if(_0x2f236f[_0xf0fa('0x94')]===-0x1){return _0x2f236f;}var _0x52c1b4=this[_0xf0fa('0x93')](_0xf0fa('0xa5'),_0xf0fa('0xbc'));if(_0x52c1b4[_0xf0fa('0x94')]===-0x1){return _0x52c1b4;}var _0x124343=this[_0xf0fa('0x93')]('RECOG_INPUT()',_0xf0fa('0xbd'));if(_0x124343[_0xf0fa('0x94')]===-0x1){return _0x124343;}var _0x22df0d=this[_0xf0fa('0x93')](_0xf0fa('0xa8'),_0xf0fa('0xbe'));if(_0x22df0d[_0xf0fa('0x94')]===-0x1){return _0x22df0d;}return this[_0xf0fa('0x37')][_0xf0fa('0x9c')](util[_0xf0fa('0x2a')](_0xf0fa('0xbf'),_0x54e88d));};AGIVertices[_0xf0fa('0x11')][_0xf0fa('0xc0')]=function(_0x44415c){logger[_0xf0fa('0x2f')](util[_0xf0fa('0x2a')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x44415c[_0xf0fa('0x39')]));if(!this['isConfigured'](_0x44415c[_0xf0fa('0xa2')])){return this[_0xf0fa('0x37')][_0xf0fa('0x9c')](_0xf0fa('0xa3'));}var _0x218e30=_0x44415c[_0xf0fa('0xa2')];if(this[_0xf0fa('0x97')](_0x44415c[_0xf0fa('0x73')])){_0x218e30+=','+_0x44415c[_0xf0fa('0x73')];}var _0x4fb7e8=this[_0xf0fa('0x37')][_0xf0fa('0x9e')](_0xf0fa('0xa4'),_0x218e30);if(_0x4fb7e8[_0xf0fa('0x94')]===-0x1){return _0x4fb7e8;}var _0x101424=this[_0xf0fa('0x93')]('RECOG_CONFIDENCE()',_0xf0fa('0xc1'));if(_0x101424[_0xf0fa('0x94')]===-0x1){return _0x101424;}var _0x1e8e9f=this[_0xf0fa('0x93')]('RECOG_INPUT()',_0xf0fa('0xc2'));if(_0x1e8e9f[_0xf0fa('0x94')]===-0x1){return _0x1e8e9f;}var _0x19e118=this['getAndSetVariable'](_0xf0fa('0xa8'),_0xf0fa('0xc3'));if(_0x19e118[_0xf0fa('0x94')]===-0x1){return _0x19e118;}return this[_0xf0fa('0x37')][_0xf0fa('0x9c')](util['format'](_0xf0fa('0xbf'),_0x218e30));};AGIVertices[_0xf0fa('0x11')][_0xf0fa('0xc4')]=function(_0xd237e6){logger[_0xf0fa('0x2f')](util['format'](_0xf0fa('0xc5'),_0xd237e6[_0xf0fa('0x39')]));if(!this[_0xf0fa('0x97')](_0xd237e6[_0xf0fa('0xc6')])){return this[_0xf0fa('0x37')][_0xf0fa('0x32')](_0xd237e6,'no\x20database\x20selected');}var _0x2624ee=this['getSquareOdbc'][_0xf0fa('0x6b')](this,_0xd237e6[_0xf0fa('0xc6')]);if(!_0x2624ee){return this[_0xf0fa('0x37')][_0xf0fa('0x32')](_0xd237e6,_0xf0fa('0xc7'));}if(!this[_0xf0fa('0x97')](_0xd237e6[_0xf0fa('0x2d')])){return this['channel'][_0xf0fa('0x32')](_0xd237e6,_0xf0fa('0xc8'));}var _0x2fa4b5=_0xd237e6['query'][_0xf0fa('0x5a')](/(\r\n|\n|\r)/gm,'\x20');this['channel']['noop'](util['format'](_0xf0fa('0xc9'),_0x2fa4b5));var _0x576bb3=this[_0xf0fa('0xca')][_0xf0fa('0x6b')](this,_0x2624ee,_0x2fa4b5);this['createSquareDetailsReport']['sync'](this,_0xd237e6,_0x2fa4b5);if(!this[_0xf0fa('0x97')](_0xd237e6[_0xf0fa('0xcb')])){return this['channel'][_0xf0fa('0x9c')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x5ca895=this[_0xf0fa('0x12')][_0xf0fa('0x6b')](this,_0xd237e6[_0xf0fa('0xcb')]);if(!_0x5ca895){return this[_0xf0fa('0x37')]['error'](_0xd237e6,'no\x20variable\x20found');}var _0x42d32e=this;_0x576bb3[_0xf0fa('0xcc')](function(_0x2fc1e6,_0x22b9b6){Object[_0xf0fa('0xcd')](_0x2fc1e6)['forEach'](function(_0x158f27){_0x42d32e[_0xf0fa('0x37')][_0xf0fa('0xce')](util[_0xf0fa('0x2a')](_0xf0fa('0xcf'),_0x5ca895,_0x22b9b6,_0x158f27),_0x2fc1e6[_0x158f27]);});});this[_0xf0fa('0x37')][_0xf0fa('0xce')](util[_0xf0fa('0x2a')]('%s_ROWS_COUNT',_0x5ca895),_0x576bb3[_0xf0fa('0x8c')]);return this['channel']['noop'](util[_0xf0fa('0x2a')](_0xf0fa('0xd0'),_0x5ca895));};AGIVertices[_0xf0fa('0x11')][_0xf0fa('0xd1')]=function(_0x1282c5){logger[_0xf0fa('0xd2')](util['format'](_0xf0fa('0xd3'),_0x1282c5[_0xf0fa('0x39')]));if(!this[_0xf0fa('0x97')](_0x1282c5[_0xf0fa('0xd4')])){return this[_0xf0fa('0x37')]['error'](_0x1282c5,_0xf0fa('0xd5'));}var _0x5c7a08=this[_0xf0fa('0x1d')]['sync'](this,_0x1282c5[_0xf0fa('0xd4')]);if(!_0x5c7a08){return this[_0xf0fa('0x37')]['error'](_0x1282c5,_0xf0fa('0xd6'));}var _0x44ab6e=this[_0xf0fa('0x37')][_0xf0fa('0x9e')](_0xf0fa('0xd7'),[util['format'](_0xf0fa('0xd8'),_0x5c7a08),_0x1282c5[_0xf0fa('0x64')],_0x1282c5['opts'],_0x1282c5[_0xf0fa('0x6c')]]);if(_0x44ab6e[_0xf0fa('0x94')]===-0x1){return _0x44ab6e;}return this[_0xf0fa('0x37')]['noop'](util[_0xf0fa('0x2a')](_0xf0fa('0xd9'),'DIAL'));};AGIVertices[_0xf0fa('0x11')]['dialogflow']=function(_0x1d8b98){logger[_0xf0fa('0x2f')](util[_0xf0fa('0x2a')](_0xf0fa('0xda'),_0x1d8b98[_0xf0fa('0x39')]));if(!this['isConfigured'](_0x1d8b98[_0xf0fa('0x75')])){return this[_0xf0fa('0x37')]['noop']('no\x20key\x20configured');}if(!this[_0xf0fa('0x97')](_0x1d8b98[_0xf0fa('0x5d')])){return this['channel'][_0xf0fa('0x9c')]('no\x20text\x20configured');}this['channel'][_0xf0fa('0xdb')]=!![];this[_0xf0fa('0x36')](_0x1d8b98);this[_0xf0fa('0x42')](_0x1d8b98['text'],'in','','');this[_0xf0fa('0x37')][_0xf0fa('0x9c')](util[_0xf0fa('0x2a')](_0xf0fa('0xdc'),_0x1d8b98[_0xf0fa('0x5d')]));var _0x5492dc=this['googleDialogflow'][_0xf0fa('0x6b')](this,_0x1d8b98);if(_0x5492dc){for(var _0x4db6c5 in _0x5492dc){if(_0x5492dc[_0xf0fa('0x8e')](_0x4db6c5)){this[_0xf0fa('0x37')][_0xf0fa('0xce')](util[_0xf0fa('0x2a')]('DIALOGFLOW_%s',_0x4db6c5[_0xf0fa('0xdd')]()),_0x5492dc[_0x4db6c5]);}}this['createSquareMessage'](_0x5492dc[_0xf0fa('0xde')],'out','dialogflow','');return this[_0xf0fa('0x37')][_0xf0fa('0x9c')](util[_0xf0fa('0x2a')](_0xf0fa('0xdf'),_0x5492dc[_0xf0fa('0xde')]));}return this['channel'][_0xf0fa('0x32')](_0x1d8b98,_0xf0fa('0xe0'));};AGIVertices[_0xf0fa('0x11')][_0xf0fa('0xe1')]=function(_0x3743b7){logger[_0xf0fa('0x2f')](util['format'](_0xf0fa('0xe2'),_0x3743b7[_0xf0fa('0x39')]));if(!this[_0xf0fa('0x97')](_0x3743b7['dialogflowV2_project_id'])){return this['channel']['noop'](_0xf0fa('0xe3'));}if(!this[_0xf0fa('0x97')](_0x3743b7[_0xf0fa('0x77')])){return this[_0xf0fa('0x37')][_0xf0fa('0x9c')]('no\x20client_email\x20configured');}if(!this['isConfigured'](_0x3743b7[_0xf0fa('0xe4')])){return this[_0xf0fa('0x37')]['noop'](_0xf0fa('0xe5'));}if(!this[_0xf0fa('0x97')](_0x3743b7[_0xf0fa('0x78')])){return this[_0xf0fa('0x37')][_0xf0fa('0x9c')](_0xf0fa('0xe6'));}if(!this[_0xf0fa('0x97')](_0x3743b7[_0xf0fa('0x5d')])){return this[_0xf0fa('0x37')][_0xf0fa('0x9c')](_0xf0fa('0x9d'));}this['channel'][_0xf0fa('0xdb')]=!![];this[_0xf0fa('0x36')](_0x3743b7);this[_0xf0fa('0x42')](_0x3743b7[_0xf0fa('0x5d')],'in','','');this[_0xf0fa('0x37')][_0xf0fa('0x9c')](util['format'](_0xf0fa('0xe7'),_0x3743b7['text']));var _0x4ee033=this['googleDialogflowV2']['sync'](this,_0x3743b7);if(_0x4ee033){for(var _0x2f6641 in _0x4ee033){if(_0x4ee033[_0xf0fa('0x8e')](_0x2f6641)){if(_0x2f6641!=='providerResponse'){this[_0xf0fa('0x37')][_0xf0fa('0xce')](util['format'](_0xf0fa('0xe8'),_0x2f6641['toUpperCase']()),_0x4ee033[_0x2f6641]);}}}this[_0xf0fa('0x42')](_0x4ee033[_0xf0fa('0xde')],_0xf0fa('0xe9'),_0xf0fa('0xe1'),_0x4ee033['providerResponse']);return this['channel'][_0xf0fa('0x9c')](util[_0xf0fa('0x2a')](_0xf0fa('0xea'),_0x4ee033[_0xf0fa('0xde')]));}return this['channel'][_0xf0fa('0x32')](_0x3743b7,'DialogflowV2\x20is\x20unreachable');};AGIVertices[_0xf0fa('0x11')][_0xf0fa('0xeb')]=function(_0x4238f0){logger['info'](util[_0xf0fa('0x2a')](_0xf0fa('0xec'),_0x4238f0['label']));if(!this[_0xf0fa('0x97')](_0x4238f0['ndauth_url'])){return this[_0xf0fa('0x37')][_0xf0fa('0x9c')](_0xf0fa('0xed'));}if(!this['isConfigured'](_0x4238f0[_0xf0fa('0xee')])){return this[_0xf0fa('0x37')][_0xf0fa('0x9c')](_0xf0fa('0xef'));}if(!this[_0xf0fa('0x97')](_0x4238f0[_0xf0fa('0xf0')])){return this[_0xf0fa('0x37')][_0xf0fa('0x9c')](_0xf0fa('0xf1'));}if(!this['isConfigured'](_0x4238f0[_0xf0fa('0xf2')])){return this[_0xf0fa('0x37')]['noop'](_0xf0fa('0x9d'));}this[_0xf0fa('0x37')][_0xf0fa('0xdb')]=!![];this[_0xf0fa('0x36')](_0x4238f0);this[_0xf0fa('0x42')](_0x4238f0['text'],'in','','');this[_0xf0fa('0x37')]['noop'](util['format'](_0xf0fa('0xf3'),_0x4238f0[_0xf0fa('0x5d')]));var _0x569138=this[_0xf0fa('0x79')]['sync'](this,_0x4238f0);if(_0x569138){for(var _0xc56274 in _0x569138){if(_0x569138[_0xf0fa('0x8e')](_0xc56274)){this[_0xf0fa('0x37')][_0xf0fa('0xce')](util[_0xf0fa('0x2a')]('SESTEK_NDA_%s',_0xc56274[_0xf0fa('0xdd')]()),_0x569138[_0xc56274]);}}this['createSquareMessage'](_0x569138[_0xf0fa('0xde')],_0xf0fa('0xe9'),_0xf0fa('0xeb'),'');if(_0x569138['audiofile']){this[_0xf0fa('0x37')]['noop'](util[_0xf0fa('0x2a')](_0xf0fa('0xf4'),_0x569138[_0xf0fa('0xf5')]));var _0xb2d762=this['channel'][_0xf0fa('0xf6')](_0x569138['audiofile']);try{fs[_0xf0fa('0xf7')](_0x569138[_0xf0fa('0xf5')]+_0xf0fa('0xf8'));}catch(_0x2e7035){logger[_0xf0fa('0x32')](_0x2e7035);}return _0xb2d762;}else{return this[_0xf0fa('0x37')][_0xf0fa('0x9c')](util[_0xf0fa('0x2a')](_0xf0fa('0xf9'),_0x569138[_0xf0fa('0xde')]));}}return this['channel']['error'](_0x4238f0,_0xf0fa('0xfa'));};AGIVertices[_0xf0fa('0x11')][_0xf0fa('0xfb')]=function(_0x1b7959){logger['info'](util[_0xf0fa('0x2a')](_0xf0fa('0xfc'),_0x1b7959[_0xf0fa('0x39')]));return this['channel'][_0xf0fa('0x9c')](_0xf0fa('0xfb'));};AGIVertices['prototype'][_0xf0fa('0xfd')]=function(_0x16ec49){logger[_0xf0fa('0x2f')](util[_0xf0fa('0x2a')](_0xf0fa('0xfe'),_0x16ec49[_0xf0fa('0x39')]));var _0x575619='';if(_0x16ec49[_0xf0fa('0xff')]){if(!this['isConfigured'](_0x16ec49[_0xf0fa('0xff')])){return this[_0xf0fa('0x37')]['error'](_0x16ec49,_0xf0fa('0x100'));}else{var _0x2ceef7=parseInt(_0x16ec49[_0xf0fa('0xff')],0xa);if(isNaN(_0x2ceef7)){_0x575619=_0x16ec49[_0xf0fa('0xff')];}else{_0x575619=this[_0xf0fa('0x101')][_0xf0fa('0x6b')](this,_0x16ec49['trunk_id']);if(!_0x575619){return this[_0xf0fa('0x37')]['error'](_0x16ec49,_0xf0fa('0x102'));}}}}else if(_0x16ec49[_0xf0fa('0x103')]){_0x575619=_0x16ec49[_0xf0fa('0x103')];}else{return this['channel']['error'](_0x16ec49,'no\x20trunk\x20selected');}var _0x7fcb48=this['channel'][_0xf0fa('0x9e')]('DIAL',[util[_0xf0fa('0x2a')]('SIP/%s/%s',_0x575619,_0x16ec49[_0xf0fa('0x104')]),_0x16ec49[_0xf0fa('0x64')],_0x16ec49['opts'],_0x16ec49['url']]);if(_0x7fcb48[_0xf0fa('0x94')]===-0x1){return _0x7fcb48;}return this[_0xf0fa('0x37')]['noop'](util[_0xf0fa('0x2a')](_0xf0fa('0xd9'),_0xf0fa('0xd7')));};AGIVertices[_0xf0fa('0x11')][_0xf0fa('0x105')]=function(_0x3ca331){logger[_0xf0fa('0x2f')](util[_0xf0fa('0x2a')](_0xf0fa('0x106'),_0x3ca331[_0xf0fa('0x39')]));return this['channel'][_0xf0fa('0x9c')](_0xf0fa('0x105'));};AGIVertices[_0xf0fa('0x11')][_0xf0fa('0xe')]=function(_0x216e67){logger[_0xf0fa('0x2f')](util[_0xf0fa('0x2a')](_0xf0fa('0x107'),_0x216e67[_0xf0fa('0x39')]));if(_0x216e67['retry']===0x0){return this[_0xf0fa('0x98')](_0x216e67);}_0x216e67['retry']-=0x1;if(!this[_0xf0fa('0x97')](_0x216e67[_0xf0fa('0x108')])){return this['channel'][_0xf0fa('0x32')](_0x216e67,_0xf0fa('0x109'));}var _0x18abdd=this[_0xf0fa('0x20')][_0xf0fa('0x6b')](this,_0x216e67['file_id']);if(!_0x18abdd){return this[_0xf0fa('0x37')]['error'](_0x216e67,_0xf0fa('0x10a'));}if(!this[_0xf0fa('0x97')](_0x216e67[_0xf0fa('0xcb')])){return this['channel'][_0xf0fa('0x32')](_0xf0fa('0x10b'));}var _0x4d3b6d=this['channel'][_0xf0fa('0x10c')](_0x18abdd,_0x216e67['response'],_0x216e67[_0xf0fa('0x10d')]);var _0x288164=_0x4d3b6d['result']?_0x4d3b6d[_0xf0fa('0x94')][_0xf0fa('0x4c')]():'';logger['info'](_0xf0fa('0x10e'),JSON['stringify'](_0x4d3b6d));if(_0x4d3b6d[_0xf0fa('0x94')]===-0x1){this['createSquareDetailsReport'][_0xf0fa('0x6b')](this,_0x216e67,_0x288164);return _0x4d3b6d;}else if(_0x4d3b6d[_0xf0fa('0x96')]===_0xf0fa('0x64')){_0x4d3b6d['result']=_0x288164[_0xf0fa('0x8c')]>=parseInt(_0x216e67['mindigit'])?'x':'i';}else{_0x4d3b6d['result']=_0x288164[_0xf0fa('0x8c')]>=parseInt(_0x216e67[_0xf0fa('0x10f')])&&_0x288164['length']<=parseInt(_0x216e67[_0xf0fa('0x10d')])?'x':'i';}var _0x45be27=this[_0xf0fa('0x12')][_0xf0fa('0x6b')](this,_0x216e67[_0xf0fa('0xcb')]);if(!_0x45be27){return this[_0xf0fa('0x37')][_0xf0fa('0x32')](_0x216e67,_0xf0fa('0x110'));}this[_0xf0fa('0x37')][_0xf0fa('0xce')](_0x45be27,_0x288164);if(this[_0xf0fa('0x97')](_0x216e67[_0xf0fa('0x111')])){var _0x249c71=parseInt(_0x216e67[_0xf0fa('0x111')],0xa);var _0x55817b=rs['generate']({'charset':'*','length':_0x249c71});var _0x958d79=_0x288164[_0xf0fa('0x8c')];if(_0x958d79>0x0){if(_0x958d79>_0x249c71){this[_0xf0fa('0x36')]['sync'](this,_0x216e67,_0x216e67['hiddendigitspos']===_0xf0fa('0x112')?_0x55817b+_0x288164[_0xf0fa('0x113')](_0x249c71):_0x288164[_0xf0fa('0x113')](0x0,_0x958d79-_0x249c71)+_0x55817b);}else{this['createSquareDetailsReport']['sync'](this,_0x216e67,rs[_0xf0fa('0x114')]({'charset':'*','length':_0x958d79}));}}else{this[_0xf0fa('0x36')][_0xf0fa('0x6b')](this,_0x216e67,'');}}else{this['createSquareDetailsReport'][_0xf0fa('0x6b')](this,_0x216e67,_0x288164);}return _0x4d3b6d;};AGIVertices['prototype'][_0xf0fa('0x115')]=function(_0x4a5c05){logger[_0xf0fa('0x2f')](util[_0xf0fa('0x2a')]('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x4a5c05[_0xf0fa('0x39')]));return this[_0xf0fa('0xe')](_0x4a5c05);};AGIVertices[_0xf0fa('0x11')][_0xf0fa('0x116')]=function(_0x530431){logger[_0xf0fa('0x2f')](util[_0xf0fa('0x2a')](_0xf0fa('0x117'),_0x530431[_0xf0fa('0x39')]));this['createSquareDetailsReport'][_0xf0fa('0x6b')](this,_0x530431,_0x530431[_0xf0fa('0x118')]);return this[_0xf0fa('0x37')][_0xf0fa('0x9c')](util[_0xf0fa('0x2a')](_0xf0fa('0x119'),_0x530431['goalname']));};AGIVertices[_0xf0fa('0x11')][_0xf0fa('0x11a')]=function(_0x31b02c){logger[_0xf0fa('0x2f')](util[_0xf0fa('0x2a')](_0xf0fa('0x11b'),_0x31b02c[_0xf0fa('0x39')]));if(!this[_0xf0fa('0x97')](_0x31b02c[_0xf0fa('0x81')])||!this[_0xf0fa('0x97')](_0x31b02c[_0xf0fa('0x7f')])){return this['channel'][_0xf0fa('0x9c')]('no\x20valid\x20credentials\x20configured');}if(!this['isConfigured'](_0x31b02c[_0xf0fa('0x5d')])){return this['channel'][_0xf0fa('0x9c')](_0xf0fa('0x9d'));}this[_0xf0fa('0x37')][_0xf0fa('0x9c')](util[_0xf0fa('0x2a')]('Trying\x20aws\x20Polly\x20%s',_0x31b02c['text']));var _0x10182b=this[_0xf0fa('0x7e')]['sync'](this,_0x31b02c);if(_0x10182b){this[_0xf0fa('0x37')]['noop'](util['format'](_0xf0fa('0x11c'),_0x10182b));var _0x37e3c9=this['channel'][_0xf0fa('0xf6')](_0x10182b);try{fs['unlink'](_0x10182b+'.wav');}catch(_0x47aa5b){logger[_0xf0fa('0x32')](_0x47aa5b);}return _0x37e3c9;}return this[_0xf0fa('0x37')][_0xf0fa('0x32')](_0x31b02c,'aws\x20Polly\x20is\x20unreachable');};AGIVertices[_0xf0fa('0x11')]['awslex']=function(_0x160c3d){logger[_0xf0fa('0x2f')](util[_0xf0fa('0x2a')](_0xf0fa('0x11d'),_0x160c3d[_0xf0fa('0x39')]));if(!this['isConfigured'](_0x160c3d[_0xf0fa('0x81')])||!this[_0xf0fa('0x97')](_0x160c3d[_0xf0fa('0x7f')])){return this['channel'][_0xf0fa('0x9c')](_0xf0fa('0x11e'));}if(!this[_0xf0fa('0x97')](_0x160c3d[_0xf0fa('0x11f')])){return this[_0xf0fa('0x37')][_0xf0fa('0x9c')](_0xf0fa('0x120'));}if(!this['isConfigured'](_0x160c3d[_0xf0fa('0x5d')])){return this[_0xf0fa('0x37')][_0xf0fa('0x9c')](_0xf0fa('0x9d'));}this[_0xf0fa('0x37')][_0xf0fa('0xdb')]=!![];this[_0xf0fa('0x36')](_0x160c3d);this[_0xf0fa('0x42')](_0x160c3d[_0xf0fa('0x5d')],'in','','');this[_0xf0fa('0x37')]['noop'](util[_0xf0fa('0x2a')](_0xf0fa('0x121'),_0x160c3d[_0xf0fa('0x5d')]));var _0x13d202=this[_0xf0fa('0x122')][_0xf0fa('0x6b')](this,_0x160c3d);if(_0x13d202){for(var _0x960a4c in _0x13d202){if(_0x13d202[_0xf0fa('0x8e')](_0x960a4c)&&_['isString'](_0x13d202[_0x960a4c])){this['channel'][_0xf0fa('0xce')](util['format'](_0xf0fa('0x123'),_0x960a4c[_0xf0fa('0xdd')]()),_0x13d202[_0x960a4c]);}}if(_[_0xf0fa('0x44')](_0x13d202['message'])){return this['channel'][_0xf0fa('0x9c')](_0xf0fa('0x124'));}else{this[_0xf0fa('0x42')](_0x13d202['message'],'out',_0xf0fa('0x125'),'');return this[_0xf0fa('0x37')][_0xf0fa('0x9c')](util[_0xf0fa('0x2a')]('Amazon\x20Lex\x20Result\x20%s',_0x13d202['message']));}}return this['channel'][_0xf0fa('0x32')](_0x160c3d,_0xf0fa('0x126'));};AGIVertices[_0xf0fa('0x11')][_0xf0fa('0x127')]=function(_0x33aceb){logger[_0xf0fa('0x2f')](util['format'](_0xf0fa('0x128'),_0x33aceb[_0xf0fa('0x39')],_0x33aceb[_0xf0fa('0x64')]));if(!this[_0xf0fa('0x97')](_0x33aceb[_0xf0fa('0x75')])){return this[_0xf0fa('0x37')]['noop']('no\x20key\x20configured');}var _0x52e00b=_0xf0fa('0x129');var _0x90a29e=util[_0xf0fa('0x2a')]('%s/recordings/%s',FILES_PATH,rs[_0xf0fa('0x114')](0x4));var _0x119673=util[_0xf0fa('0x2a')](_0xf0fa('0x90'),_0x90a29e,_0x52e00b);var _0x246e04=!![];if(_0x33aceb['beep']===_0xf0fa('0x12a')){_0x246e04=![];}var _0x5e5999=this[_0xf0fa('0x37')][_0xf0fa('0x12b')](_0x90a29e,_0x52e00b,_0x33aceb[_0xf0fa('0x12c')],_0x33aceb[_0xf0fa('0x64')],undefined,_0x246e04);if(_0x5e5999[_0xf0fa('0x94')]!==-0x1){this[_0xf0fa('0x37')][_0xf0fa('0x9c')](util[_0xf0fa('0x2a')](_0xf0fa('0x12d'),_0x119673));var _0x815bcd=this[_0xf0fa('0x83')]['sync'](this,_0x33aceb,_0x119673);if(_0x815bcd){for(var _0x3b52dc in _0x815bcd){if(_0x815bcd[_0xf0fa('0x8e')](_0x3b52dc)){this[_0xf0fa('0x37')][_0xf0fa('0xce')](util[_0xf0fa('0x2a')](_0xf0fa('0x12e'),_0x3b52dc[_0xf0fa('0xdd')]()),_0x815bcd[_0x3b52dc]);}}return this['channel'][_0xf0fa('0x9c')](util[_0xf0fa('0x2a')](_0xf0fa('0x12f'),JSON[_0xf0fa('0x6e')](_0x815bcd)));}}return _0x5e5999;};AGIVertices[_0xf0fa('0x11')][_0xf0fa('0x130')]=function(_0x2513f7){logger[_0xf0fa('0x2f')](util[_0xf0fa('0x2a')](_0xf0fa('0x131'),_0x2513f7['label']));if(!this[_0xf0fa('0x97')](_0x2513f7[_0xf0fa('0x85')])){return this['channel']['noop']('no\x20appid\x20configured');}if(!this[_0xf0fa('0x97')](_0x2513f7[_0xf0fa('0x86')])){return this[_0xf0fa('0x37')][_0xf0fa('0x9c')]('no\x20appsecret\x20configured');}var _0x3f1558=_0xf0fa('0x129');var _0xe1fe69=util[_0xf0fa('0x2a')]('%s/recordings/%s',FILES_PATH,rs[_0xf0fa('0x114')](0x4));var _0x5c2ff7=util[_0xf0fa('0x2a')]('%s.%s',_0xe1fe69,_0x3f1558);var _0x339a29=!![];if(_0x2513f7[_0xf0fa('0x132')]==='NOBEEP'){_0x339a29=![];}var _0x54abd0=this['channel'][_0xf0fa('0x12b')](_0xe1fe69,_0x3f1558,_0x2513f7['intKey'],_0x2513f7['timeout'],undefined,_0x339a29);if(_0x54abd0[_0xf0fa('0x94')]!==-0x1){this[_0xf0fa('0x37')][_0xf0fa('0x9c')](util['format']('tilde\x20%s\x20file\x20created',_0x5c2ff7));var _0xdc47ae=this[_0xf0fa('0x84')][_0xf0fa('0x6b')](this,_0x2513f7,_0x5c2ff7);if(_0xdc47ae){for(var _0x22b099 in _0xdc47ae){if(_0xdc47ae[_0xf0fa('0x8e')](_0x22b099)){this[_0xf0fa('0x37')]['setVariable'](util[_0xf0fa('0x2a')](_0xf0fa('0x133'),_0x22b099[_0xf0fa('0xdd')]()),_0xdc47ae[_0x22b099]);}}return this['channel']['noop'](util[_0xf0fa('0x2a')]('TildeASR\x20Result\x20%s',JSON[_0xf0fa('0x6e')](_0xdc47ae)));}}return _0x54abd0;};AGIVertices['prototype']['gotoc']=function(_0x401c07){logger[_0xf0fa('0x2f')](util['format']('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x401c07[_0xf0fa('0x39')]));return this[_0xf0fa('0x37')]['continueAt'](_0x401c07[_0xf0fa('0x3e')],_0x401c07[_0xf0fa('0x3f')],_0x401c07[_0xf0fa('0x40')]);};AGIVertices[_0xf0fa('0x11')][_0xf0fa('0x134')]=function(_0x146b57){logger[_0xf0fa('0x2f')](util[_0xf0fa('0x2a')]('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0x146b57[_0xf0fa('0x39')]));if(!this['isConfigured'](_0x146b57[_0xf0fa('0x135')])){return this[_0xf0fa('0x37')]['error'](_0x146b57,_0xf0fa('0x136'));}try{var _0x261a22=eval(_0x146b57[_0xf0fa('0x135')])?_0xf0fa('0x137'):_0xf0fa('0x138');this[_0xf0fa('0x37')][_0xf0fa('0x9c')](util[_0xf0fa('0x2a')]('EVAL\x20CONDITION\x20%s\x20%s',_0x146b57[_0xf0fa('0x135')],_0x261a22));return{'code':0xc8,'result':_0x261a22};}catch(_0xd24cac){return{'code':0xc8,'result':'false'};}};AGIVertices[_0xf0fa('0x11')][_0xf0fa('0x139')]=function(_0x5a6af3){logger[_0xf0fa('0x2f')](util[_0xf0fa('0x2a')]('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x5a6af3[_0xf0fa('0x39')]));if(!this[_0xf0fa('0x97')](_0x5a6af3[_0xf0fa('0x13a')])){return this[_0xf0fa('0x37')][_0xf0fa('0x32')](_0x5a6af3,_0xf0fa('0x13b'));}var _0x338f3f=this[_0xf0fa('0x25')]['sync'](this,_0x5a6af3[_0xf0fa('0x13a')]);if(!_0x338f3f){return this[_0xf0fa('0x37')][_0xf0fa('0x32')](_0x5a6af3,_0xf0fa('0x13c'));}for(var _0x36570f=0x0;_0x36570f<_0x338f3f[_0xf0fa('0x8c')];_0x36570f+=0x1){var _0x356efb=this[_0xf0fa('0x37')]['getVariable'](util['format'](_0xf0fa('0x13d'),_0x338f3f[_0x36570f]));if(_0x356efb['result']===-0x1){return _0x356efb;}logger['info'](util[_0xf0fa('0x2a')](_0xf0fa('0x13e'),_0x338f3f[_0x36570f],_0x356efb['extra']));if(_0x356efb[_0xf0fa('0x96')]===_0xf0fa('0x137')){logger['info'](util[_0xf0fa('0x2a')](_0xf0fa('0x13e'),_0x338f3f[_0x36570f],_0xf0fa('0x137')));this[_0xf0fa('0x37')][_0xf0fa('0x9c')](util['format'](_0xf0fa('0x13e'),_0x338f3f[_0x36570f],_0xf0fa('0x137')));return{'code':0xc8,'result':_0xf0fa('0x137')};}else{logger[_0xf0fa('0x2f')](util[_0xf0fa('0x2a')](_0xf0fa('0x13e'),_0x338f3f[_0x36570f],_0xf0fa('0x138')));this[_0xf0fa('0x37')][_0xf0fa('0x9c')](util['format']('IFTIME\x20%s\x20%s',_0x338f3f[_0x36570f],_0xf0fa('0x138')));}}return{'code':0xc8,'result':_0xf0fa('0x138')};};AGIVertices[_0xf0fa('0x11')][_0xf0fa('0x13f')]=function(_0x1c15a2){logger[_0xf0fa('0x2f')](util['format']('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x1c15a2['label']));return this[_0xf0fa('0x37')]['hangup']();};AGIVertices['prototype'][_0xf0fa('0x140')]=function(_0x57ef8f){logger['info'](util[_0xf0fa('0x2a')](_0xf0fa('0x141'),_0x57ef8f[_0xf0fa('0x39')]));if(!this['isConfigured'](_0x57ef8f[_0xf0fa('0x75')])){return this['channel'][_0xf0fa('0x9c')](_0xf0fa('0x142'));}var _0x5932e5='wav';var _0x1b796a=util[_0xf0fa('0x2a')](_0xf0fa('0x143'),FILES_PATH,rs[_0xf0fa('0x114')](0x4));var _0x43ccb7=util[_0xf0fa('0x2a')](_0xf0fa('0x90'),_0x1b796a,_0x5932e5);var _0x138c3f=!![];if(_0x57ef8f['beep']==='NOBEEP'){_0x138c3f=![];}var _0x11e8d7=this[_0xf0fa('0x37')]['recordFile'](_0x1b796a,_0x5932e5,_0x57ef8f['intKey'],_0x57ef8f[_0xf0fa('0x64')],undefined,_0x138c3f);if(_0x11e8d7[_0xf0fa('0x94')]!==-0x1){this[_0xf0fa('0x37')][_0xf0fa('0x9c')](util[_0xf0fa('0x2a')](_0xf0fa('0x144'),_0x43ccb7));var _0x226732=this['ispeechASR'][_0xf0fa('0x6b')](this,_0x57ef8f,_0x43ccb7);if(_0x226732){for(var _0x243ab8 in _0x226732){if(_0x226732[_0xf0fa('0x8e')](_0x243ab8)){this[_0xf0fa('0x37')][_0xf0fa('0xce')](util[_0xf0fa('0x2a')]('ISPEECH_ASR_%s',_0x243ab8['toUpperCase']()),_0x226732[_0x243ab8]);}}return this['channel'][_0xf0fa('0x9c')](util[_0xf0fa('0x2a')](_0xf0fa('0x145'),JSON[_0xf0fa('0x6e')](_0x226732)));}}return _0x11e8d7;};AGIVertices[_0xf0fa('0x11')][_0xf0fa('0x146')]=function(_0x76f5e1){logger[_0xf0fa('0x2f')](util[_0xf0fa('0x2a')]('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0x76f5e1['label']));if(!this[_0xf0fa('0x97')](_0x76f5e1[_0xf0fa('0x75')])){return this[_0xf0fa('0x37')][_0xf0fa('0x9c')](_0xf0fa('0x142'));}if(!this[_0xf0fa('0x97')](_0x76f5e1[_0xf0fa('0x5d')])){return this[_0xf0fa('0x37')][_0xf0fa('0x9c')](_0xf0fa('0x9d'));}this['channel'][_0xf0fa('0x9c')](util[_0xf0fa('0x2a')](_0xf0fa('0x147'),_0x76f5e1[_0xf0fa('0x5d')]));var _0x32e875=this['ispeechTTS'][_0xf0fa('0x6b')](this,_0x76f5e1);if(_0x32e875){this[_0xf0fa('0x37')][_0xf0fa('0x9c')](util['format'](_0xf0fa('0x144'),_0x32e875));var _0x1a74f9=this[_0xf0fa('0x37')]['streamFile'](_0x32e875,_0x76f5e1['intKey']);try{fs[_0xf0fa('0xf7')](_0x32e875+_0xf0fa('0xf8'));}catch(_0x2b7dcd){logger['error'](_0x2b7dcd);}return _0x1a74f9;}return this[_0xf0fa('0x37')]['error'](_0x76f5e1,_0xf0fa('0x148'));};AGIVertices['prototype'][_0xf0fa('0x149')]=function(_0x200031){logger[_0xf0fa('0x2f')](util[_0xf0fa('0x2a')]('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0x200031[_0xf0fa('0x39')]));if(!this['isConfigured'](_0x200031[_0xf0fa('0x14a')])){return this[_0xf0fa('0x37')][_0xf0fa('0x32')](_0x200031,'no\x20find\x20by\x20configured');}logger[_0xf0fa('0x2f')](util[_0xf0fa('0x2a')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xf0fa('0x37')][_0xf0fa('0x3b')],_0x200031[_0xf0fa('0x14a')]));var _0x2bcc7b=this[_0xf0fa('0x57')][_0xf0fa('0x6b')](this,_0x200031[_0xf0fa('0x14a')]);if(_0x2bcc7b){logger['info'](util['format'](_0xf0fa('0x14b'),this[_0xf0fa('0x37')]['callerid'],_0x200031[_0xf0fa('0x14a')]));this[_0xf0fa('0x37')][_0xf0fa('0x9c')](util[_0xf0fa('0x2a')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xf0fa('0x37')]['callerid'],_0x200031[_0xf0fa('0x14a')]));return{'code':0xc8,'result':'success'};}else{logger[_0xf0fa('0x2f')](util[_0xf0fa('0x2a')](_0xf0fa('0x14c'),this['channel'][_0xf0fa('0x3b')],_0x200031['findBy']));this[_0xf0fa('0x37')][_0xf0fa('0x9c')](util[_0xf0fa('0x2a')](_0xf0fa('0x14c'),this[_0xf0fa('0x37')][_0xf0fa('0x3b')],_0x200031[_0xf0fa('0x14a')]));return{'code':0xc8,'result':_0xf0fa('0x14d')};}};AGIVertices['prototype'][_0xf0fa('0x14e')]=function(_0x3e3672){logger[_0xf0fa('0x2f')](util[_0xf0fa('0x2a')](_0xf0fa('0x14f'),_0x3e3672['label']));if(!this[_0xf0fa('0x97')](_0x3e3672[_0xf0fa('0x14a')])){return this[_0xf0fa('0x37')][_0xf0fa('0x32')](_0x3e3672,'no\x20find\x20by\x20configured');}logger['info'](util[_0xf0fa('0x2a')](_0xf0fa('0x150'),this[_0xf0fa('0x37')]['callerid'],_0x3e3672[_0xf0fa('0x14a')]));var _0x57878a=this['agentLogout'][_0xf0fa('0x6b')](this,_0x3e3672[_0xf0fa('0x14a')]);if(_0x57878a){logger[_0xf0fa('0x2f')](util[_0xf0fa('0x2a')](_0xf0fa('0x14b'),this[_0xf0fa('0x37')][_0xf0fa('0x3b')],_0x3e3672[_0xf0fa('0x14a')]));this[_0xf0fa('0x37')][_0xf0fa('0x9c')](util[_0xf0fa('0x2a')](_0xf0fa('0x14b'),this['channel'][_0xf0fa('0x3b')],_0x3e3672[_0xf0fa('0x14a')]));return{'code':0xc8,'result':_0xf0fa('0x151')};}else{logger['info'](util[_0xf0fa('0x2a')](_0xf0fa('0x14c'),this[_0xf0fa('0x37')]['callerid'],_0x3e3672['findBy']));this[_0xf0fa('0x37')]['noop'](util['format'](_0xf0fa('0x14c'),this[_0xf0fa('0x37')][_0xf0fa('0x3b')],_0x3e3672['findBy']));return{'code':0xc8,'result':_0xf0fa('0x14d')};}};AGIVertices['prototype'][_0xf0fa('0x152')]=function(_0x22feda){logger[_0xf0fa('0x2f')](util['format'](_0xf0fa('0x153'),_0x22feda[_0xf0fa('0x39')]));if(!this['isConfigured'](_0x22feda[_0xf0fa('0x154')])){return this[_0xf0fa('0x37')][_0xf0fa('0x32')](_0x22feda,_0xf0fa('0x155'));}this[_0xf0fa('0x37')]['noop'](util[_0xf0fa('0x2a')]('math\x20%s',_0x22feda[_0xf0fa('0x154')]));var _0x274673=eval(_0x22feda[_0xf0fa('0x154')]);if(!this[_0xf0fa('0x97')](_0x22feda[_0xf0fa('0xcb')])){return this['channel']['noop'](_0xf0fa('0x10b'));}var _0x4aea20=this['getVariable'][_0xf0fa('0x6b')](this,_0x22feda[_0xf0fa('0xcb')]);if(!_0x4aea20){return this['channel']['error'](_0x22feda,_0xf0fa('0x110'));}if(_[_0xf0fa('0x8b')](_0x274673)){var _0x504b00=this;_0x274673[_0xf0fa('0xcc')](function(_0x500216,_0x12ebc3){_0x504b00['channel']['setVariable'](util[_0xf0fa('0x2a')](_0xf0fa('0x156'),_0x4aea20,_0x12ebc3),_0x500216);});return this[_0xf0fa('0x37')][_0xf0fa('0x9c')](util[_0xf0fa('0x2a')](_0xf0fa('0x157'),_0x4aea20));}else{return this[_0xf0fa('0x37')][_0xf0fa('0xce')](_0x4aea20,_0x274673);}};AGIVertices['prototype'][_0xf0fa('0xd')]=function(_0x593c76){logger[_0xf0fa('0x2f')](util[_0xf0fa('0x2a')](_0xf0fa('0x158'),_0x593c76['label']));if(_0x593c76['retry']===0x0){return this[_0xf0fa('0x98')](_0x593c76);}_0x593c76[_0xf0fa('0x99')]-=0x1;if(!this['isConfigured'](_0x593c76[_0xf0fa('0x108')])){return this[_0xf0fa('0x37')]['error'](_0x593c76,_0xf0fa('0x109'));}var _0x22291e=this[_0xf0fa('0x20')][_0xf0fa('0x6b')](this,_0x593c76[_0xf0fa('0x108')]);if(!_0x22291e){return this[_0xf0fa('0x37')][_0xf0fa('0x32')](_0x593c76,'no\x20file\x20audio\x20found');}var _0x3894d0=this['channel']['getData'](_0x22291e,_0x593c76[_0xf0fa('0x159')],_0x593c76[_0xf0fa('0x15a')]);var _0x558c37=_0x3894d0[_0xf0fa('0x94')];if(_0x3894d0['result']===-0x1){this[_0xf0fa('0x36')][_0xf0fa('0x6b')](this,_0x593c76,'-1');return _0x3894d0;}else if(_0x3894d0[_0xf0fa('0x96')]===_0xf0fa('0x64')){_0x3894d0[_0xf0fa('0x94')]=_0x3894d0[_0xf0fa('0x94')][_0xf0fa('0x8c')]>0x0?_0x3894d0[_0xf0fa('0x94')]:'t';}else if(_['isEmpty'](_0x3894d0[_0xf0fa('0x94')])){_0x3894d0['result']='#';_0x558c37='#';}if(!this['isConfigured'](_0x593c76[_0xf0fa('0xcb')])){this[_0xf0fa('0x37')]['noop'](_0xf0fa('0x10b'));}else{var _0x5abd1d=this[_0xf0fa('0x12')][_0xf0fa('0x6b')](this,_0x593c76[_0xf0fa('0xcb')]);if(!_0x5abd1d){return this[_0xf0fa('0x37')]['error'](_0x593c76,_0xf0fa('0x110'));}this[_0xf0fa('0x37')][_0xf0fa('0xce')](_0x5abd1d,_0x558c37);}this[_0xf0fa('0x36')]['sync'](this,_0x593c76,_0x558c37);return _0x3894d0;};AGIVertices['prototype'][_0xf0fa('0x9c')]=function(_0x131bca){logger[_0xf0fa('0x2f')](util[_0xf0fa('0x2a')](_0xf0fa('0x15b'),_0x131bca[_0xf0fa('0x39')]));return this['channel'][_0xf0fa('0x9c')](_0x131bca[_0xf0fa('0x15c')]||_0x131bca[_0xf0fa('0x39')]);};AGIVertices[_0xf0fa('0x11')]['pause']=function(_0xdbe933){logger[_0xf0fa('0x2f')](util[_0xf0fa('0x2a')](_0xf0fa('0x15d'),_0xdbe933[_0xf0fa('0x39')]));if(!this[_0xf0fa('0x97')](_0xdbe933[_0xf0fa('0x14a')])){return this[_0xf0fa('0x37')][_0xf0fa('0x32')](_0xdbe933,_0xf0fa('0x15e'));}logger[_0xf0fa('0x2f')](util['format'](_0xf0fa('0x150'),this[_0xf0fa('0x37')][_0xf0fa('0x3b')],_0xdbe933['findBy']));var _0x5e3d16=this['getPause'][_0xf0fa('0x6b')](this,_0xdbe933['pause_id']);var _0x484d41=this['agentPause'][_0xf0fa('0x6b')](this,_0xdbe933[_0xf0fa('0x14a')],_0x5e3d16);if(_0x484d41){logger[_0xf0fa('0x2f')](util[_0xf0fa('0x2a')](_0xf0fa('0x14b'),this[_0xf0fa('0x37')]['callerid'],_0xdbe933[_0xf0fa('0x14a')]));this[_0xf0fa('0x37')][_0xf0fa('0x9c')](util[_0xf0fa('0x2a')](_0xf0fa('0x14b'),this['channel'][_0xf0fa('0x3b')],_0xdbe933[_0xf0fa('0x14a')]));return{'code':0xc8,'result':_0xf0fa('0x151')};}else{logger[_0xf0fa('0x2f')](util[_0xf0fa('0x2a')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xf0fa('0x37')][_0xf0fa('0x3b')],_0xdbe933[_0xf0fa('0x14a')]));this[_0xf0fa('0x37')][_0xf0fa('0x9c')](util[_0xf0fa('0x2a')](_0xf0fa('0x14b'),this[_0xf0fa('0x37')][_0xf0fa('0x3b')],_0xdbe933[_0xf0fa('0x14a')]));return{'code':0xc8,'result':_0xf0fa('0x14d')};}};AGIVertices[_0xf0fa('0x11')][_0xf0fa('0x15f')]=function(_0x40358b){logger[_0xf0fa('0x2f')](util['format']('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x40358b[_0xf0fa('0x39')]));if(!this[_0xf0fa('0x97')](_0x40358b['file_id'])){return this[_0xf0fa('0x37')][_0xf0fa('0x32')](_0x40358b,_0xf0fa('0x109'));}var _0x5dcf18=this[_0xf0fa('0x20')][_0xf0fa('0x6b')](this,_0x40358b[_0xf0fa('0x108')]);if(!_0x5dcf18){return this[_0xf0fa('0x37')][_0xf0fa('0x32')](_0x40358b,_0xf0fa('0x10a'));}var _0x3b915d=this['channel'][_0xf0fa('0x9e')]('PLAYBACK',[_0x5dcf18,_0x40358b[_0xf0fa('0x160')]]);if(_0x3b915d[_0xf0fa('0x94')]===-0x1){return _0x3b915d;}return this[_0xf0fa('0x37')]['noop'](util[_0xf0fa('0x2a')](_0xf0fa('0xb7'),_0xf0fa('0x161'),_0x5dcf18));};AGIVertices['prototype'][_0xf0fa('0x162')]=function(_0x16e247){logger[_0xf0fa('0x2f')](util['format'](_0xf0fa('0x163'),_0x16e247['label']));if(!this['isConfigured'](_0x16e247['queue_id'])){return this['channel'][_0xf0fa('0x32')](_0x16e247,_0xf0fa('0x164'));}var _0x3154f9='';var _0x181170=parseInt(_0x16e247[_0xf0fa('0x165')],0xa);if(isNaN(_0x181170)){_0x3154f9=_0x16e247[_0xf0fa('0x165')];}else{_0x3154f9=this['getVoiceQueue'][_0xf0fa('0x6b')](this,_0x16e247[_0xf0fa('0x165')]);if(!_0x3154f9){return this[_0xf0fa('0x37')][_0xf0fa('0x32')](_0x16e247,_0xf0fa('0x166'));}}var _0x5440e1='';if(this[_0xf0fa('0x97')](_0x16e247[_0xf0fa('0x108')])){var _0x5077f9=this[_0xf0fa('0x20')][_0xf0fa('0x6b')](this,_0x16e247[_0xf0fa('0x108')]);if(_0x5077f9){_0x5440e1=_0x5077f9;}}this[_0xf0fa('0x36')][_0xf0fa('0x6b')](this,_0x16e247,_0x3154f9);if(_0x16e247[_0xf0fa('0x160')][_0xf0fa('0x167')]('x')<0x0){_0x16e247[_0xf0fa('0x160')]+='x';}if(_0x16e247['opts']['indexOf']('X')<0x0){_0x16e247[_0xf0fa('0x160')]+='X';}this[_0xf0fa('0x37')][_0xf0fa('0xce')](_0xf0fa('0x168'),_0x3154f9?_0x3154f9[_0xf0fa('0x169')]():'');var _0x1ae1c0=this[_0xf0fa('0x37')][_0xf0fa('0x9e')](_0xf0fa('0x16a'),[_0x3154f9,_0x16e247[_0xf0fa('0x160')],_0x16e247[_0xf0fa('0x6c')],_0x5440e1,_0x16e247[_0xf0fa('0x64')],_0x16e247[_0xf0fa('0x8')],_0x16e247[_0xf0fa('0x16b')],_0x16e247['gosub'],'',_0x16e247['position']]);if(_0x1ae1c0['result']===-0x1){return _0x1ae1c0;}return this[_0xf0fa('0x37')]['noop'](util[_0xf0fa('0x2a')]('Executed\x20command\x20%s\x20%s','QUEUE',_0x3154f9));};AGIVertices['prototype'][_0xf0fa('0x16c')]=function(_0xea4c58){logger[_0xf0fa('0x2f')](util[_0xf0fa('0x2a')](_0xf0fa('0x16d'),_0xea4c58['label']));var _0x2bdbaa=_0xea4c58[_0xf0fa('0x16e')]||_0xf0fa('0x129');var _0x1038fe=util['format'](_0xf0fa('0x16f'),this['channel'][_0xf0fa('0x38')],rs[_0xf0fa('0x114')](0x5));var _0x32ffd9=util[_0xf0fa('0x2a')]('%s/recordings/%s.%s',FILES_PATH,_0x1038fe,_0x2bdbaa);var _0xf71b7f=util[_0xf0fa('0x2a')]('%s/recordings/%s',FILES_PATH,_0x1038fe);this[_0xf0fa('0x3c')][_0xf0fa('0x6b')](this,_0xea4c58,_0x1038fe,_0x32ffd9);this[_0xf0fa('0x37')]['setVariable'](_0xf0fa('0x170'),_0x1038fe);logger['info'](_0xf0fa('0x171'),_0xf71b7f,_0x2bdbaa,_0xea4c58[_0xf0fa('0x172')],_0xea4c58[_0xf0fa('0x64')]);return this[_0xf0fa('0x37')][_0xf0fa('0x12b')](_0xf71b7f,_0x2bdbaa,_0xea4c58['escape_digits'],_0xea4c58[_0xf0fa('0x64')],undefined,!![]);};AGIVertices['prototype'][_0xf0fa('0x173')]=function(_0x39f3f9){logger[_0xf0fa('0x2f')](util[_0xf0fa('0x2a')](_0xf0fa('0x174'),_0x39f3f9[_0xf0fa('0x39')]));if(!this[_0xf0fa('0x97')](_0x39f3f9[_0xf0fa('0x6c')])){return this[_0xf0fa('0x37')][_0xf0fa('0x9c')](_0xf0fa('0x175'));}var _0x481815=this[_0xf0fa('0x62')][_0xf0fa('0x6b')](this,_0x39f3f9);logger[_0xf0fa('0x2f')](util['format'](_0xf0fa('0x176'),util[_0xf0fa('0x177')](_0x481815,{'showHidden':![],'depth':null})));if(!this[_0xf0fa('0x97')](_0x39f3f9[_0xf0fa('0xcb')])){return this[_0xf0fa('0x37')][_0xf0fa('0x9c')](_0xf0fa('0x178'));}var _0x11f1ad=this[_0xf0fa('0x12')][_0xf0fa('0x6b')](this,_0x39f3f9['variable_id']);if(!_0x11f1ad){return this[_0xf0fa('0x37')][_0xf0fa('0x32')](_0x39f3f9,_0xf0fa('0x110'));}this[_0xf0fa('0x37')][_0xf0fa('0xce')](util[_0xf0fa('0x2a')](_0xf0fa('0x179'),_0x11f1ad),_0x481815[_0xf0fa('0x70')]?_0x481815[_0xf0fa('0x70')]:_0xf0fa('0x17a'));this[_0xf0fa('0x37')]['setVariable'](util['format'](_0xf0fa('0x17b'),_0x11f1ad),_0x481815[_0xf0fa('0x71')]?_0x481815[_0xf0fa('0x71')]:'OK');if(_0x481815['body']){try{this[_0xf0fa('0x8f')](_0x481815[_0xf0fa('0x67')],_0x11f1ad);}catch(_0xb04cc4){logger[_0xf0fa('0x32')](util[_0xf0fa('0x2a')](_0xf0fa('0x17c'),_0x11f1ad));}}return this[_0xf0fa('0x37')][_0xf0fa('0x9c')](util[_0xf0fa('0x2a')]('variable\x20%s\x20set',_0x11f1ad));};AGIVertices[_0xf0fa('0x11')][_0xf0fa('0x17d')]=function(_0x57f957){logger[_0xf0fa('0x2f')](util['format'](_0xf0fa('0x17e'),_0x57f957['label']));return this['channel'][_0xf0fa('0x17f')](_0x57f957[_0xf0fa('0x180')][_0xf0fa('0x5a')](/\s+/g,''),_0x57f957['escape_digits']);};AGIVertices[_0xf0fa('0x11')][_0xf0fa('0x181')]=function(_0x105f5e){logger['info'](util[_0xf0fa('0x2a')](_0xf0fa('0x182'),_0x105f5e[_0xf0fa('0x39')]));return this[_0xf0fa('0x37')][_0xf0fa('0x183')](_0x105f5e[_0xf0fa('0x184')][_0xf0fa('0x5a')](/\s+/g,''),_0x105f5e[_0xf0fa('0x172')]);};AGIVertices['prototype'][_0xf0fa('0x185')]=function(_0x39ab19){logger[_0xf0fa('0x2f')](util[_0xf0fa('0x2a')](_0xf0fa('0x186'),_0x39ab19[_0xf0fa('0x39')]));return this[_0xf0fa('0x37')]['sayPhonetic'](_0x39ab19[_0xf0fa('0x5d')],_0x39ab19['escape_digits']);};AGIVertices[_0xf0fa('0x11')][_0xf0fa('0x187')]=function(_0x2f8259){logger[_0xf0fa('0x2f')](util[_0xf0fa('0x2a')]('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x2f8259[_0xf0fa('0x39')]));if(!this['isConfigured'](_0x2f8259['account_id'])){return this[_0xf0fa('0x37')][_0xf0fa('0x9c')](_0xf0fa('0x188'));}var _0x4df27e=this[_0xf0fa('0x189')][_0xf0fa('0x6b')](this,_0x2f8259[_0xf0fa('0x18a')]);if(!_0x4df27e||!_0x4df27e[_0xf0fa('0x18b')]){return this['channel'][_0xf0fa('0x32')](_0x2f8259,_0xf0fa('0x18c'));}var _0x55c261={'from':util[_0xf0fa('0x2a')](_0xf0fa('0x18d'),_0x4df27e[_0xf0fa('0x17')],_0x4df27e[_0xf0fa('0x18e')]||_0x4df27e['Smtp'][_0xf0fa('0x18f')]),'to':_0x2f8259['to']||'','cc':_0x2f8259['cc']||'','bcc':_0x2f8259[_0xf0fa('0x190')]||'','subject':_0x2f8259['subject'],'html':_0x2f8259[_0xf0fa('0x5d')],'text':_0x2f8259[_0xf0fa('0x5d')]};if(this[_0xf0fa('0x97')](_0x2f8259[_0xf0fa('0x191')])){}logger['debug'](_0xf0fa('0x192'),JSON[_0xf0fa('0x6e')](_0x55c261));this[_0xf0fa('0x36')][_0xf0fa('0x6b')](this,_0x2f8259,_0x2f8259[_0xf0fa('0x18a')]);this[_0xf0fa('0x37')][_0xf0fa('0x9c')](util['format'](_0xf0fa('0x193'),_0x4df27e[_0xf0fa('0x17')]));this[_0xf0fa('0x24')][_0xf0fa('0x6b')](this,_0x4df27e[_0xf0fa('0x194')],_0x55c261);return this['channel']['noop'](_0xf0fa('0x195'));};AGIVertices['prototype']['sendFax']=function(_0xf6880b){logger[_0xf0fa('0x2f')](util['format']('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0xf6880b[_0xf0fa('0x39')]));return this[_0xf0fa('0x37')][_0xf0fa('0x9c')](_0xf0fa('0x196'));};AGIVertices['prototype'][_0xf0fa('0x197')]=function(_0x4d71d4){logger['info'](util[_0xf0fa('0x2a')](_0xf0fa('0x198'),_0x4d71d4[_0xf0fa('0x39')]));if(!this['isConfigured'](_0x4d71d4[_0xf0fa('0x199')])){return this[_0xf0fa('0x37')][_0xf0fa('0x9c')]('no\x20sms\x20account\x20configured');}var _0x15abb=this['getSmsAccount']['sync'](this,_0x4d71d4[_0xf0fa('0x199')]);if(!_0x15abb){return this['channel']['error'](_0x4d71d4,_0xf0fa('0x19a'));}var _0x487f92={'body':_0x4d71d4[_0xf0fa('0x19b')],'phone':_0x4d71d4['to']||'','SmsAccountId':_0x15abb['id']};logger[_0xf0fa('0xd2')](_0xf0fa('0x19c'),JSON[_0xf0fa('0x6e')](_0x487f92));this[_0xf0fa('0x36')][_0xf0fa('0x6b')](this,_0x4d71d4,_0x4d71d4['sms_account_id']);this[_0xf0fa('0x37')][_0xf0fa('0x9c')](util[_0xf0fa('0x2a')](_0xf0fa('0x19d'),_0x15abb[_0xf0fa('0x17')]));this[_0xf0fa('0x35')][_0xf0fa('0x6b')](this,_0x487f92);return this[_0xf0fa('0x37')][_0xf0fa('0x9c')]('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0xf0fa('0x11')]['set']=function(_0x1ee0f3){logger[_0xf0fa('0x2f')](util['format'](_0xf0fa('0x19e'),_0x1ee0f3[_0xf0fa('0x39')]));if(!this['isConfigured'](_0x1ee0f3[_0xf0fa('0xcb')])){return this['channel'][_0xf0fa('0x32')](_0x1ee0f3,_0xf0fa('0x19f'));}var _0x573897=this[_0xf0fa('0x12')][_0xf0fa('0x6b')](this,_0x1ee0f3['variable_id']);if(!_0x573897){return this[_0xf0fa('0x37')][_0xf0fa('0x32')](_0x1ee0f3,_0xf0fa('0x110'));}return this[_0xf0fa('0x37')][_0xf0fa('0xce')](_0x573897,_0x1ee0f3[_0xf0fa('0x1a0')]);};AGIVertices[_0xf0fa('0x11')]['start']=function(_0x2d711a){logger[_0xf0fa('0x2f')](util[_0xf0fa('0x2a')](_0xf0fa('0x1a1'),_0x2d711a['label']));this['channel'][_0xf0fa('0x9c')](_0xf0fa('0x1a2'));var _0x5e0522=this[_0xf0fa('0x37')]['getVariable']('XMCS-UNIQUEID');if(!_[_0xf0fa('0x47')](_0x5e0522[_0xf0fa('0x96')])){this[_0xf0fa('0x37')][_0xf0fa('0x38')]=_0x5e0522['extra'];}if(_0x2d711a[_0xf0fa('0xad')]===_0xf0fa('0x1a3')){this[_0xf0fa('0x37')][_0xf0fa('0x9c')](_0xf0fa('0x1a4'));return this[_0xf0fa('0x37')][_0xf0fa('0xad')]();}return this['channel'][_0xf0fa('0x9c')](_0xf0fa('0x1a5'));};AGIVertices[_0xf0fa('0x11')]['subproject']=function(_0x211edb){logger[_0xf0fa('0x2f')](util['format'](_0xf0fa('0x1a6'),_0x211edb[_0xf0fa('0x39')]));if(!this[_0xf0fa('0x97')](_0x211edb['project_id'])){return this[_0xf0fa('0x37')]['error'](_0x211edb,_0xf0fa('0x1a7'));}var _0x4994ec=this[_0xf0fa('0x18')]['sync'](this,_0x211edb[_0xf0fa('0x1a8')]);if(!this['isConfigured'](_0x4994ec)){return this[_0xf0fa('0x37')][_0xf0fa('0x32')](_0x211edb,util[_0xf0fa('0x2a')](_0xf0fa('0x1a9'),_0x211edb['project_id']));}if(_0x4994ec===this[_0xf0fa('0x37')][_0xf0fa('0x3a')]){return this['channel'][_0xf0fa('0x32')](_0x211edb,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this['createSquareDetailsReport'][_0xf0fa('0x6b')](this,_0x211edb,_0x4994ec);var _0xd45105=this[_0xf0fa('0x37')][_0xf0fa('0x9e')](_0xf0fa('0x1aa'),util['format'](_0xf0fa('0x1ab'),config['agi'][_0xf0fa('0x1ac')]||_0xf0fa('0x1ad'),_0x4994ec,this[_0xf0fa('0x37')][_0xf0fa('0x3a')]));if(_0xd45105[_0xf0fa('0x94')]===-0x1){return _0xd45105;}return this['channel'][_0xf0fa('0x9c')](util[_0xf0fa('0x2a')](_0xf0fa('0xb7'),_0xf0fa('0x1aa'),_0x4994ec));};AGIVertices[_0xf0fa('0x11')]['system']=function(_0x2cc938){logger[_0xf0fa('0x2f')](util[_0xf0fa('0x2a')](_0xf0fa('0x1ae'),_0x2cc938[_0xf0fa('0x39')]));var _0x20342a=this[_0xf0fa('0x58')][_0xf0fa('0x6b')](this,_0x2cc938[_0xf0fa('0xab')]);this[_0xf0fa('0x36')][_0xf0fa('0x6b')](this,_0x2cc938,_0x2cc938[_0xf0fa('0xab')]);if(this['isConfigured'](_0x2cc938[_0xf0fa('0xcb')])){var _0x6ef653=this['getVariable'][_0xf0fa('0x6b')](this,_0x2cc938[_0xf0fa('0xcb')]);if(_0x6ef653){this[_0xf0fa('0x37')][_0xf0fa('0xce')](_0x6ef653,_0x20342a);return this[_0xf0fa('0x37')][_0xf0fa('0x9c')](util['format'](_0xf0fa('0x1af'),_0x2cc938['command'],_0x6ef653));}}return this[_0xf0fa('0x37')]['noop'](util[_0xf0fa('0x2a')](_0xf0fa('0x1b0'),_0x2cc938[_0xf0fa('0xab')]));};AGIVertices['prototype'][_0xf0fa('0x1b1')]=function(_0x3c5b1b){logger[_0xf0fa('0x2f')](util['format'](_0xf0fa('0x1b2'),_0x3c5b1b['label']));_0x3c5b1b[_0xf0fa('0x5d')]=_0x3c5b1b['text'][_0xf0fa('0x5a')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xf0fa('0x97')](_0x3c5b1b[_0xf0fa('0x1b3')])){return this[_0xf0fa('0x37')][_0xf0fa('0x9c')](_0xf0fa('0x1b4'));}if(!this[_0xf0fa('0x97')](_0x3c5b1b[_0xf0fa('0x5d')])){return this['channel'][_0xf0fa('0x9c')](_0xf0fa('0x9d'));}this[_0xf0fa('0x37')][_0xf0fa('0x9c')](util[_0xf0fa('0x2a')](_0xf0fa('0x1b5'),_0x3c5b1b['text']));var _0x1db7af=this[_0xf0fa('0x5b')][_0xf0fa('0x6b')](this,_0x3c5b1b);if(_0x1db7af){this[_0xf0fa('0x37')]['noop'](util['format'](_0xf0fa('0x1b6'),_0x1db7af));var _0x45eb9f=this[_0xf0fa('0x37')][_0xf0fa('0xf6')](_0x1db7af);try{fs[_0xf0fa('0xf7')](_0x1db7af+'.wav');}catch(_0x1941bc){logger[_0xf0fa('0x32')](_0x1941bc);}return _0x45eb9f;}return this['channel'][_0xf0fa('0x32')](_0x3c5b1b,'Google\x20Cloud\x20TTS\x20is\x20unreachable');};AGIVertices[_0xf0fa('0x11')][_0xf0fa('0x1b7')]=function(_0x307f5d){logger['info'](util[_0xf0fa('0x2a')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x307f5d[_0xf0fa('0x39')]));_0x307f5d['text']=_0x307f5d[_0xf0fa('0x5d')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x307f5d[_0xf0fa('0x5d')])){return this[_0xf0fa('0x37')]['noop'](_0xf0fa('0x9d'));}this['channel'][_0xf0fa('0x9c')](util[_0xf0fa('0x2a')]('Trying\x20Google\x20TTS\x20%s',_0x307f5d[_0xf0fa('0x5d')]));var _0x1c02e3=this[_0xf0fa('0x1b8')]['sync'](this,_0x307f5d);if(_0x1c02e3){this[_0xf0fa('0x37')]['noop'](util['format'](_0xf0fa('0x1b9'),_0x1c02e3));var _0x223ef2=this[_0xf0fa('0x37')][_0xf0fa('0xf6')](_0x1c02e3);try{fs['unlink'](_0x1c02e3+'.wav');}catch(_0x192bb0){logger[_0xf0fa('0x32')](_0x192bb0);}return _0x223ef2;}return this[_0xf0fa('0x37')]['error'](_0x307f5d,_0xf0fa('0x1ba'));};AGIVertices[_0xf0fa('0x11')]['unpause']=function(_0x3e97d5){logger[_0xf0fa('0x2f')](util['format'](_0xf0fa('0x1bb'),_0x3e97d5['label']));if(!this[_0xf0fa('0x97')](_0x3e97d5[_0xf0fa('0x14a')])){return this[_0xf0fa('0x37')][_0xf0fa('0x32')](_0x3e97d5,_0xf0fa('0x15e'));}logger[_0xf0fa('0x2f')](util[_0xf0fa('0x2a')](_0xf0fa('0x150'),this['channel'][_0xf0fa('0x3b')],_0x3e97d5[_0xf0fa('0x14a')]));var _0xd6fa55=this[_0xf0fa('0x52')][_0xf0fa('0x6b')](this,_0x3e97d5[_0xf0fa('0x14a')]);if(_0xd6fa55){logger['info'](util[_0xf0fa('0x2a')](_0xf0fa('0x14b'),this['channel'][_0xf0fa('0x3b')],_0x3e97d5[_0xf0fa('0x14a')]));this['channel'][_0xf0fa('0x9c')](util[_0xf0fa('0x2a')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xf0fa('0x37')][_0xf0fa('0x3b')],_0x3e97d5[_0xf0fa('0x14a')]));return{'code':0xc8,'result':_0xf0fa('0x151')};}else{logger['info'](util[_0xf0fa('0x2a')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0xf0fa('0x3b')],_0x3e97d5[_0xf0fa('0x14a')]));this[_0xf0fa('0x37')]['noop'](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xf0fa('0x37')][_0xf0fa('0x3b')],_0x3e97d5['findBy']));return{'code':0xc8,'result':_0xf0fa('0x14d')};}};AGIVertices[_0xf0fa('0x11')][_0xf0fa('0x1bc')]=function(_0x10a7fc){logger['info'](util[_0xf0fa('0x2a')](_0xf0fa('0x1bd'),_0x10a7fc['label']));var _0x523177=this['channel'][_0xf0fa('0x9e')](_0xf0fa('0x1be'),[_0x10a7fc[_0xf0fa('0x1bf')],_0x10a7fc['options']]);if(_0x523177[_0xf0fa('0x94')]===-0x1){return _0x523177;}return this[_0xf0fa('0x37')][_0xf0fa('0x9c')](util[_0xf0fa('0x2a')](_0xf0fa('0xb7'),_0xf0fa('0x1be'),_0x10a7fc['mailbox']));};AGIVertices[_0xf0fa('0x11')][_0xf0fa('0x1c0')]=function(_0x4973d7){logger[_0xf0fa('0x2f')](util['format'](_0xf0fa('0x1c1'),_0x4973d7[_0xf0fa('0x39')]));if(!this[_0xf0fa('0x97')](_0x4973d7[_0xf0fa('0xcb')])){return this['channel'][_0xf0fa('0x32')](_0x4973d7,_0xf0fa('0x19f'));}var _0x484fe2=this[_0xf0fa('0x12')][_0xf0fa('0x6b')](this,_0x4973d7[_0xf0fa('0xcb')]);if(!_0x484fe2){return this[_0xf0fa('0x37')][_0xf0fa('0x32')](_0x4973d7,_0xf0fa('0x110'));}var _0x207003=this[_0xf0fa('0x37')][_0xf0fa('0x12')](_0x484fe2);return{'code':0xc8,'result':_0x207003[_0xf0fa('0x96')]?_0x207003['extra']:'-'};};String[_0xf0fa('0x11')][_0xf0fa('0x92')]=function(_0x225e1e,_0x40a915){return this[_0xf0fa('0x91')](_0x225e1e)[_0xf0fa('0x1c2')](_0x40a915);};module[_0xf0fa('0x1c3')]=AGIVertices; \ No newline at end of file +var _0x0ba7=['MP3','googleTTS','restAPI','method','timeout','number','POST','body','parse','headers','computedVariables','sync','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_polly_voice','aws_text_type','awsLex','aws_secret_access_key','aws_bot_name','googleASR','tildeASR','appsecret','uri','clear','clone','hasOwnProperty','isString','includes','replaceAllVariables','recursiveNodeIndex','isArray','saveRestApiResult','%s.%s','length','setVariable','replaceObjectAllVariables','split','replaceAll','extra','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','retry','mrcpsynth','noop','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','MRCP_RECOG_CONFIDENCE','getAndSetVariable','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','list_id','delay','minutes','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','RECOG_CONFIDENCE()','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','getQueryOdbc','variable_id','no\x20variable\x20found','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','dial','sip_id','DIAL','SIP/%s','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','toUpperCase','speech','out','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','client_email','private_key','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','no\x20password\x20configured','SESTEK_NDA_%s','audiofile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','Enter\x20in\x20END\x20(%s)\x20block','end','ext_dial','trunk_id','getTrunk','no\x20trunk\x20found','trunk_name','no\x20trunk\x20selected','SIP/%s/%s','opts','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','no\x20variable\x20selected\x20for\x20the\x20result','response','maxdigit','toString','test','mindigit','hiddendigitsnum','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','Trying\x20aws\x20Polly\x20%s','streamFile','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','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','no\x20key\x20configured','wav','generate','beep','recordFile','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','appid','no\x20appid\x20configured','no\x20appsecret\x20configured','%s/recordings/%s','NOBEEP','intKey','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','priority','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','EVAL\x20CONDITION\x20%s\x20%s','false','no\x20interval\x20configured','interval_id','no\x20intervals\x20found','IFTIME\x20%s\x20%s','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','IspeechASR\x20Result\x20%s','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','agentLogout','failure','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','getData','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','getPause','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','queue_id','no\x20queue\x20selected','indexOf','XMCS-QUEUE','url','macro','gosub','QUEUE','record','recordingFormat','%s/recordings/%s.%s','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','statusCode','200','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','variable\x20%s\x20set','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','account_id','no\x20mail\x20account\x20configured','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','Smtp','user','subject','template_id','debug','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','getSmsAccount','no\x20sms\x20account\x20found','sms_text','sms_account_id','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','XMCS-UNIQUEID','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','host','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','command','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','join','exports','util','shelljs','odbc','randomstring','moment','request-promise','../../config/logger','agi','../../config/environment','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getdigits','getsecretdigits','channel','mailRpc','getVariable','rpc','catch','prototype','getVoiceQueue','getVoiceQueueById','then','name','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUser','getUserById','getTrunkById','getSound','getSoundById','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','IntervalId','map','getSoundPath','format','%s/sounds/converted/%s','open','error','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','arg_1','callerid','createSquareRecording','calleridname','context','extension','accountcode','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','lastName','phone','callback','Callback\x20scheduled\x20at\x20','scheduledAt','callback_priority','getPauseById','agentPause','agentUnpause','agent','internal','%s/%s@from-sip/n','LOCAL','agentLogin','shellCommand','exec','trim','replace','googleCloudTTS','apiKey','text','languageCode','en-US','MALE','audioEncoding'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0ba7,0x16d));var _0x70ba=function(_0x2858b3,_0x100f5d){_0x2858b3=_0x2858b3-0x0;var _0x22dec0=_0x0ba7[_0x2858b3];return _0x22dec0;};'use strict';var fs=require('fs');var util=require(_0x70ba('0x0'));var _=require('lodash');var sh=require(_0x70ba('0x1'));var odbc=require(_0x70ba('0x2'))();var rs=require(_0x70ba('0x3'));var moment=require(_0x70ba('0x4'));var Mustache=require('mustache');var rp=require(_0x70ba('0x5'));var logger=require(_0x70ba('0x6'))(_0x70ba('0x7'));var config=require(_0x70ba('0x8'));var scripts=require(_0x70ba('0x9'));var FILES_PATH=_0x70ba('0xa');var recursiveMapAttributes=[_0x70ba('0xb'),_0x70ba('0xc')];var verticesWithRetry=[_0x70ba('0xd'),_0x70ba('0xe'),_0x70ba('0xf')];var AGIVertices=function(_0x41cd10,_0x1264b0,_0x371629){this[_0x70ba('0x10')]=_0x41cd10;this['rpc']=_0x1264b0;this[_0x70ba('0x11')]=_0x371629;};AGIVertices['prototype'][_0x70ba('0x12')]=function(_0x258604,_0xfc4de3){this[_0x70ba('0x13')]['getVariableById'](_0x258604)['then'](function(_0x12cea8){_0xfc4de3(null,_0x12cea8?_0x12cea8['name']:![]);})[_0x70ba('0x14')](function(_0x5e94c7){_0xfc4de3(_0x5e94c7);});};AGIVertices[_0x70ba('0x15')][_0x70ba('0x16')]=function(_0x4df1e3,_0x1d674b){this['rpc'][_0x70ba('0x17')](_0x4df1e3)[_0x70ba('0x18')](function(_0x211b0e){_0x1d674b(null,_0x211b0e?_0x211b0e[_0x70ba('0x19')]:![]);})[_0x70ba('0x14')](function(_0x29734b){_0x1d674b(_0x29734b);});};AGIVertices[_0x70ba('0x15')][_0x70ba('0x1a')]=function(_0x18334a,_0x3e27e8){this[_0x70ba('0x13')][_0x70ba('0x1b')](_0x18334a)[_0x70ba('0x18')](function(_0xb6d69a){_0x3e27e8(null,_0xb6d69a?_0xb6d69a['name']:![]);})['catch'](function(_0x489cf9){_0x3e27e8(_0x489cf9);});};AGIVertices[_0x70ba('0x15')][_0x70ba('0x1c')]=function(_0x20c2aa,_0xb4dad){this[_0x70ba('0x13')][_0x70ba('0x1d')](_0x20c2aa)[_0x70ba('0x18')](function(_0x2763f3){_0xb4dad(null,_0x2763f3?_0x2763f3[_0x70ba('0x1e')]:![]);})[_0x70ba('0x14')](function(_0x26c039){_0xb4dad(_0x26c039);});};AGIVertices[_0x70ba('0x15')][_0x70ba('0x1f')]=function(_0x4570b0,_0x273ce4){this['rpc'][_0x70ba('0x20')](_0x4570b0)[_0x70ba('0x18')](function(_0x52accf){_0x273ce4(null,_0x52accf?_0x52accf[_0x70ba('0x19')]:![]);})['catch'](function(_0x4868a1){_0x273ce4(_0x4868a1);});};AGIVertices[_0x70ba('0x15')]['getTrunk']=function(_0x45bbf2,_0x304a41){this['rpc'][_0x70ba('0x21')](_0x45bbf2)['then'](function(_0x5ad828){_0x304a41(null,_0x5ad828?_0x5ad828[_0x70ba('0x19')]:![]);})['catch'](function(_0x230d11){_0x304a41(_0x230d11);});};AGIVertices[_0x70ba('0x15')][_0x70ba('0x22')]=function(_0x33e218,_0x2c6d18){var _0x265423=this;this['rpc'][_0x70ba('0x23')](_0x33e218)[_0x70ba('0x18')](function(_0x797467){_0x2c6d18(null,_0x797467?_0x265423['getSoundPath'](_0x797467[_0x70ba('0x24')]):![]);})['catch'](function(_0x5955dc){_0x2c6d18(_0x5955dc);});};AGIVertices['prototype'][_0x70ba('0x25')]=function(_0x345edd,_0x5b6e6e){this['rpc'][_0x70ba('0x26')](_0x345edd)['then'](function(_0x102661){_0x5b6e6e(null,_0x102661?_0x102661:![]);})[_0x70ba('0x14')](function(_0x46b7e3){_0x5b6e6e(_0x46b7e3);});};AGIVertices[_0x70ba('0x15')][_0x70ba('0x27')]=function(_0x269943,_0x1f86cf,_0x9bafd){this[_0x70ba('0x11')][_0x70ba('0x27')](_0x269943,_0x1f86cf)[_0x70ba('0x18')](function(){_0x9bafd(null);})['catch'](function(_0x576ec4){_0x9bafd(_0x576ec4);});};AGIVertices[_0x70ba('0x15')][_0x70ba('0x28')]=function(_0x943e49,_0x563f68){this['rpc']['getIntervalById'](_0x943e49)[_0x70ba('0x18')](function(_0x806866){if(_0x806866){if(_0x806866[_0x70ba('0x29')]){_0x563f68(null,[_0x806866['interval']]);}else{_0x563f68(null,_[_0x70ba('0x2a')](_0x806866['Intervals'],'interval'));}}else{_0x563f68(null,![]);}})[_0x70ba('0x14')](function(_0x591596){_0x563f68(_0x591596);});};AGIVertices[_0x70ba('0x15')][_0x70ba('0x2b')]=function(_0x4f3d6f){return util[_0x70ba('0x2c')](_0x70ba('0x2d'),FILES_PATH,_0x4f3d6f);};AGIVertices[_0x70ba('0x15')]['getQueryOdbc']=function(_0x1402b2,_0x20c3fd,_0xbb0c72){odbc[_0x70ba('0x2e')](_0x1402b2,function(_0x5245f7){if(_0x5245f7){logger[_0x70ba('0x2f')]('Error\x20getting\x20ODBC\x20connection\x20%s',_0x5245f7);_0xbb0c72(_0x5245f7);}else{logger[_0x70ba('0x30')](_0x70ba('0x31'));odbc[_0x70ba('0x32')](_0x20c3fd,function(_0x450eb3,_0x16ce39){if(_0x450eb3){logger[_0x70ba('0x30')](_0x70ba('0x33'),_0x20c3fd);_0xbb0c72(_0x450eb3);}else{logger['info'](_0x70ba('0x34'),_0x20c3fd);odbc[_0x70ba('0x35')](function(_0x31e713){if(_0x31e713){logger[_0x70ba('0x2f')](_0x70ba('0x36'),_0x31e713);}_0xbb0c72(null,_0x16ce39);});}});}});};AGIVertices[_0x70ba('0x15')]['getSmsAccount']=function(_0x452208,_0x175152){this[_0x70ba('0x13')]['getSmsAccountById'](_0x452208)['then'](function(_0x5ee9b1){_0x175152(null,_0x5ee9b1?_0x5ee9b1:![]);})[_0x70ba('0x14')](function(_0x59044){_0x175152(_0x59044);});};AGIVertices[_0x70ba('0x15')]['createSmsMessage']=function(_0x24a8c3,_0x27203b){this[_0x70ba('0x13')][_0x70ba('0x37')](_0x24a8c3)[_0x70ba('0x18')](function(_0x54e732){_0x27203b(null,_0x54e732);})['catch'](function(_0x7b0436){_0x27203b(_0x7b0436);});};AGIVertices[_0x70ba('0x15')][_0x70ba('0x38')]=function(_0x5a1edb,_0x595645,_0x2fc262){this['rpc'][_0x70ba('0x38')]({'uniqueid':this[_0x70ba('0x10')][_0x70ba('0x39')],'node':_0x5a1edb[_0x70ba('0x3a')],'application':_0x5a1edb[_0x70ba('0x3b')],'data':_0x595645||null,'project_name':this['channel'][_0x70ba('0x3c')],'callerid':this[_0x70ba('0x10')][_0x70ba('0x3d')]})[_0x70ba('0x18')](function(_0x817e59){if(_0x2fc262){_0x2fc262(null,_0x817e59);}})[_0x70ba('0x14')](function(_0x900910){if(_0x2fc262){_0x2fc262(_0x900910);}});};AGIVertices[_0x70ba('0x15')][_0x70ba('0x3e')]=function(_0x1f804b,_0x389571,_0x349059,_0x3e3ce5){this[_0x70ba('0x13')][_0x70ba('0x3e')]({'uniqueid':this['channel'][_0x70ba('0x39')],'callerid':this[_0x70ba('0x10')]['callerid'],'calleridname':this[_0x70ba('0x10')][_0x70ba('0x3f')],'context':this[_0x70ba('0x10')][_0x70ba('0x40')],'extension':this[_0x70ba('0x10')][_0x70ba('0x41')],'priority':this[_0x70ba('0x10')]['priority'],'accountcode':this[_0x70ba('0x10')][_0x70ba('0x42')],'dnid':this[_0x70ba('0x10')][_0x70ba('0x43')],'projectName':this[_0x70ba('0x10')][_0x70ba('0x3c')],'saveName':_0x389571,'filename':_0x1f804b[_0x70ba('0x44')]||_0x389571,'savePath':_0x349059})[_0x70ba('0x18')](function(_0xc574b){_0x3e3ce5(null,_0xc574b);})[_0x70ba('0x14')](function(_0x3a4247){_0x3e3ce5(_0x3a4247);});};AGIVertices[_0x70ba('0x15')][_0x70ba('0x45')]=function(_0x16af4d,_0x25f68a,_0x2536cd,_0x9f97c5,_0x4a848b){this[_0x70ba('0x13')][_0x70ba('0x45')]({'uniqueid':this[_0x70ba('0x10')][_0x70ba('0x39')],'body':_0x16af4d,'direction':_0x25f68a,'providerName':_0x2536cd,'providerResponse':_0x9f97c5})['then'](function(_0x47c40c){if(_0x4a848b){_0x4a848b(null,_0x47c40c);}})['catch'](function(_0x471d19){if(_0x4a848b){_0x4a848b(_0x471d19);}});};AGIVertices[_0x70ba('0x15')]['createCmContact']=function(_0x572834,_0x6a3dc6){this[_0x70ba('0x13')][_0x70ba('0x46')]({'firstName':_[_0x70ba('0x47')](_0x572834[_0x70ba('0x19')])||_[_0x70ba('0x48')](_0x572834[_0x70ba('0x19')])?'callback_'+Math['random']():_0x572834[_0x70ba('0x19')],'lastName':_[_0x70ba('0x47')](_0x572834[_0x70ba('0x49')])||_[_0x70ba('0x48')](_0x572834['lastName'])?null:_0x572834[_0x70ba('0x49')],'phone':_0x572834[_0x70ba('0x4a')],'ListId':_0x572834['list_id'],'scheduledat':_0x572834['scheduledAt'],'callbackUniqueid':this['channel']['uniqueid'],'tags':_0x70ba('0x4b'),'description':_0x70ba('0x4c')+_0x572834[_0x70ba('0x4d')]['toString'](),'priority':_0x572834[_0x70ba('0x4e')]})[_0x70ba('0x18')](function(_0x29bb0b){_0x6a3dc6(null,_0x29bb0b);})['catch'](function(_0x1bdcd4){_0x6a3dc6(_0x1bdcd4);});};AGIVertices[_0x70ba('0x15')]['getPause']=function(_0x49f89a,_0x2ccfd4){this[_0x70ba('0x13')][_0x70ba('0x4f')](_0x49f89a)[_0x70ba('0x18')](function(_0x10e824){_0x2ccfd4(null,_0x10e824?_0x10e824[_0x70ba('0x19')]:![]);})[_0x70ba('0x14')](function(_0x5e7a92){_0x2ccfd4(_0x5e7a92);});};AGIVertices[_0x70ba('0x15')][_0x70ba('0x50')]=function(_0x4de412,_0x508da6,_0x137b7d){var _0x26c5a7={'role':'agent'};_0x26c5a7[_0x4de412]=this['channel'][_0x70ba('0x3d')];this['rpc']['agentPause'](_0x26c5a7,_0x508da6,this[_0x70ba('0x10')][_0x70ba('0x39')])[_0x70ba('0x18')](function(_0xb03649){_0x137b7d(null,_[_0x70ba('0x48')](_0xb03649)?![]:!![]);})[_0x70ba('0x14')](function(_0xeac8a8){logger['error'](_0xeac8a8);_0x137b7d(null,![]);});};AGIVertices[_0x70ba('0x15')][_0x70ba('0x51')]=function(_0x16e607,_0xaad21){var _0x355df4={'role':_0x70ba('0x52')};_0x355df4[_0x16e607]=this['channel'][_0x70ba('0x3d')];this['rpc'][_0x70ba('0x51')](_0x355df4)['then'](function(_0x3badfd){_0xaad21(null,_[_0x70ba('0x48')](_0x3badfd)?![]:!![]);})[_0x70ba('0x14')](function(_0x305df9){logger[_0x70ba('0x2f')](_0x305df9);_0xaad21(null,![]);});};AGIVertices[_0x70ba('0x15')]['agentLogout']=function(_0x2a46cd,_0x4d7e67){var _0x490948={'role':_0x70ba('0x52')};_0x490948[_0x2a46cd]=this[_0x70ba('0x10')]['callerid'];this[_0x70ba('0x13')]['agentLogout'](_0x490948)[_0x70ba('0x18')](function(_0x2a8aa9){_0x4d7e67(null,_[_0x70ba('0x48')](_0x2a8aa9)?![]:!![]);})['catch'](function(_0x327219){logger['error'](_0x327219);_0x4d7e67(null,![]);});};AGIVertices[_0x70ba('0x15')]['agentLogin']=function(_0x2ee3d0,_0x3e0aeb){var _0x1bd96e={'role':_0x70ba('0x52')};_0x1bd96e[_0x2ee3d0]=this['channel'][_0x70ba('0x3d')];var _0x530324=_0x2ee3d0!=_0x70ba('0x53')?util[_0x70ba('0x2c')](_0x70ba('0x54'),_0x70ba('0x55'),this['channel'][_0x70ba('0x3d')]):undefined;this[_0x70ba('0x13')][_0x70ba('0x56')](_0x1bd96e,_0x530324)[_0x70ba('0x18')](function(_0x14c761){_0x3e0aeb(null,_[_0x70ba('0x48')](_0x14c761)?![]:!![]);})[_0x70ba('0x14')](function(_0x2e0f08){logger['error'](_0x2e0f08);_0x3e0aeb(null,![]);});};AGIVertices[_0x70ba('0x15')][_0x70ba('0x57')]=function(_0x28294e,_0x157404){sh[_0x70ba('0x58')](_[_0x70ba('0x59')](_0x28294e),function(_0xb2276e,_0x4d83ab){var _0x1bc8c6=_0x4d83ab[_0x70ba('0x5a')](/(\r\n|\n|\r)/gm,'');_0x157404(null,_0x1bc8c6);});};AGIVertices[_0x70ba('0x15')][_0x70ba('0x5b')]=function(_0x30fad7,_0x67628f){scripts[_0x70ba('0x5b')](_0x30fad7[_0x70ba('0x5c')],_0x30fad7['google_cloud_tts_text_type']||'text',_0x30fad7[_0x70ba('0x5d')],_0x30fad7[_0x70ba('0x5e')]||_0x70ba('0x5f'),_0x30fad7['ssmlGender']||_0x70ba('0x60'),_0x30fad7[_0x70ba('0x61')]||_0x70ba('0x62'))['then'](function(_0x3e341a){_0x67628f(null,_0x3e341a);})[_0x70ba('0x14')](function(_0xa9009d){_0x67628f(_0xa9009d);});};AGIVertices[_0x70ba('0x15')][_0x70ba('0x63')]=function(_0x3184cc,_0x22e520){scripts['googleTTS'](_0x3184cc[_0x70ba('0x5d')],_0x3184cc['google_tts_language']||'en',0x1)['then'](function(_0x12f420){_0x22e520(null,_0x12f420);})[_0x70ba('0x14')](function(_0x13cb22){_0x22e520(_0x13cb22);});};AGIVertices[_0x70ba('0x15')][_0x70ba('0x64')]=function(_0x408f46,_0x36eb0f){var _0x315ed4={'uri':_0x408f46['url'],'method':_0x408f46[_0x70ba('0x65')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x408f46[_0x70ba('0x66')])===_0x70ba('0x67')&&parseInt(_0x408f46['timeout'])>=0x1?parseInt(_0x408f46['timeout'])*0x3e8:0x5*0x3e8};if(_['includes']([_0x70ba('0x68'),'PUT'],_0x315ed4['method']['toUpperCase']())){try{_0x315ed4[_0x70ba('0x69')]=_0x408f46[_0x70ba('0xc')]?JSON[_0x70ba('0x6a')](_0x408f46[_0x70ba('0xc')]):{};}catch(_0xe214a7){logger['error']('An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function',_0xe214a7);}}try{_0x315ed4[_0x70ba('0x6b')]=_0x408f46[_0x70ba('0xb')]?JSON['parse'](_0x408f46[_0x70ba('0xb')]):{};}catch(_0x3ba6c3){logger[_0x70ba('0x2f')]('An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function',_0x3ba6c3);}if(_0x408f46[_0x70ba('0x6c')]){try{var _0x534ea9=require(_0x408f46[_0x70ba('0x6c')])[_0x70ba('0x6d')](this,_0x315ed4);_0x315ed4['uri']=Mustache[_0x70ba('0x6e')](_0x408f46['url'],_0x534ea9,{},['$$','$$']);if(_0x315ed4[_0x70ba('0x6b')]){_0x315ed4[_0x70ba('0x6b')]=JSON['parse'](Mustache[_0x70ba('0x6e')](JSON[_0x70ba('0x6f')](_0x315ed4[_0x70ba('0x6b')]),_0x534ea9,{},['$$','$$']));}if(_0x315ed4[_0x70ba('0x69')]){_0x315ed4[_0x70ba('0x69')]=JSON[_0x70ba('0x6a')](Mustache[_0x70ba('0x6e')](JSON[_0x70ba('0x6f')](_0x315ed4[_0x70ba('0x69')]),_0x534ea9,{},['$$','$$']));}}catch(_0xc4c5d3){logger['error'](_0x70ba('0x70'),_0xc4c5d3);}}rp(_0x315ed4)[_0x70ba('0x18')](function(_0x46e1f1){var _0x313a9a={'statusCode':_0x46e1f1['statusCode']||0xc8,'statusMessage':_0x46e1f1[_0x70ba('0x71')]||'OK','headers':_0x46e1f1['headers']||{},'body':_0x46e1f1[_0x70ba('0x69')]||{}};_0x36eb0f(null,_0x313a9a);})['catch'](function(_0x44b3ad){var _0x18d129={'statusCode':_0x44b3ad['statusCode']||0x1f4,'statusMessage':_0x44b3ad[_0x70ba('0x72')]||_0x70ba('0x73'),'headers':_0x44b3ad[_0x70ba('0x74')][_0x70ba('0x6b')]||{},'body':_0x44b3ad[_0x70ba('0x74')][_0x70ba('0x69')]||{}};_0x36eb0f(null,_0x18d129);});};AGIVertices[_0x70ba('0x15')][_0x70ba('0x75')]=function(_0x58e514,_0x3b4036){scripts[_0x70ba('0x75')](this[_0x70ba('0x10')][_0x70ba('0x39')],_0x58e514[_0x70ba('0x76')],_0x58e514[_0x70ba('0x5d')],_0x58e514[_0x70ba('0x77')]||'en')[_0x70ba('0x18')](function(_0x57ec44){_0x3b4036(null,_0x57ec44);})[_0x70ba('0x14')](function(_0x3b4ee6){_0x3b4036(_0x3b4ee6);});};AGIVertices[_0x70ba('0x15')]['googleDialogflowV2']=function(_0x271b69,_0x1a037e){scripts[_0x70ba('0x78')](this['channel']['uniqueid'],_0x271b69[_0x70ba('0x79')],_0x271b69['client_email'],_0x271b69['private_key'],_0x271b69[_0x70ba('0x5d')],_0x271b69[_0x70ba('0x7a')]||'en')[_0x70ba('0x18')](function(_0x10282f){_0x1a037e(null,_0x10282f);})[_0x70ba('0x14')](function(_0x239265){_0x1a037e(_0x239265);});};AGIVertices['prototype']['sestekNDA']=function(_0xa0f12b,_0x312048){scripts[_0x70ba('0x7b')](this[_0x70ba('0x10')],_0xa0f12b)['then'](function(_0x3e4ec7){_0x312048(null,_0x3e4ec7);})[_0x70ba('0x14')](function(_0x459128){_0x312048(_0x459128);});};AGIVertices[_0x70ba('0x15')][_0x70ba('0x7c')]=function(_0x3e3e45,_0x132ff1){scripts[_0x70ba('0x7c')](_0x3e3e45[_0x70ba('0x76')],_0x3e3e45[_0x70ba('0x5d')],_0x3e3e45[_0x70ba('0x7d')]||_0x70ba('0x5f'),_0x3e3e45[_0x70ba('0x7e')])[_0x70ba('0x18')](function(_0x53df7a){_0x132ff1(null,_0x53df7a);})[_0x70ba('0x14')](function(_0x24328e){_0x132ff1(_0x24328e);});};AGIVertices[_0x70ba('0x15')]['ispeechASR']=function(_0x5f2e0a,_0x54849c,_0x1e9f8a){scripts[_0x70ba('0x7f')](_0x54849c,_0x5f2e0a[_0x70ba('0x76')],_0x5f2e0a[_0x70ba('0x80')]||'en-US',this[_0x70ba('0x81')](_0x5f2e0a[_0x70ba('0x82')])?_0x5f2e0a[_0x70ba('0x82')]:undefined)[_0x70ba('0x18')](function(_0x5445e7){_0x1e9f8a(null,_0x5445e7);})['catch'](function(_0x4875e6){_0x1e9f8a(_0x4875e6);});};AGIVertices[_0x70ba('0x15')]['awsPolly']=function(_0x363fa4,_0x5e2822){scripts[_0x70ba('0x83')](_0x363fa4[_0x70ba('0x84')],_0x363fa4['aws_secret_access_key'],_0x363fa4['aws_polly_region'],_0x363fa4[_0x70ba('0x85')]||'Amy',_0x363fa4['text'],_0x363fa4[_0x70ba('0x86')]||_0x70ba('0x5d'))[_0x70ba('0x18')](function(_0x374ed7){_0x5e2822(null,_0x374ed7);})[_0x70ba('0x14')](function(_0x130029){_0x5e2822(_0x130029);});};AGIVertices[_0x70ba('0x15')][_0x70ba('0x87')]=function(_0x152fdb,_0x26c4a7){scripts[_0x70ba('0x87')](this[_0x70ba('0x10')][_0x70ba('0x39')],_0x152fdb[_0x70ba('0x84')],_0x152fdb[_0x70ba('0x88')],_0x152fdb['aws_lex_region'],_0x152fdb[_0x70ba('0x5d')],_0x152fdb[_0x70ba('0x89')])[_0x70ba('0x18')](function(_0x5441f9){_0x26c4a7(null,_0x5441f9);})[_0x70ba('0x14')](function(_0x2fbf2b){_0x26c4a7(_0x2fbf2b);});};AGIVertices['prototype'][_0x70ba('0x8a')]=function(_0x490b96,_0x4cf238,_0xb13413){scripts['googleASR'](_0x4cf238,_0x490b96[_0x70ba('0x76')],_0x490b96['google_asr_language']||_0x70ba('0x5f'))[_0x70ba('0x18')](function(_0x3386fd){_0xb13413(null,_0x3386fd);})[_0x70ba('0x14')](function(_0x365faf){_0xb13413(_0x365faf);});};AGIVertices[_0x70ba('0x15')][_0x70ba('0x8b')]=function(_0x360b23,_0x5a1e70,_0x541fb6){scripts[_0x70ba('0x8b')](_0x5a1e70,_0x360b23['appid'],_0x360b23[_0x70ba('0x8c')],_0x360b23[_0x70ba('0x8d')])[_0x70ba('0x18')](function(_0x1359cc){_0x541fb6(null,_0x1359cc);})[_0x70ba('0x14')](function(_0xa0e34d){_0x541fb6(_0xa0e34d);});};AGIVertices[_0x70ba('0x15')][_0x70ba('0x8e')]=function(_0x1e537b){var _0x5ebb9a=_['includes'](verticesWithRetry,_0x1e537b['agicommand'])?_0x1e537b:_[_0x70ba('0x8f')](_0x1e537b);for(var _0x556c20 in _0x5ebb9a){if(_0x5ebb9a[_0x70ba('0x90')](_0x556c20)){if(_0x5ebb9a[_0x556c20]&&_[_0x70ba('0x91')](_0x5ebb9a[_0x556c20])){if(_[_0x70ba('0x92')](recursiveMapAttributes,_0x556c20)){_0x5ebb9a[_0x556c20]=this['replaceObjectAllVariables'](_0x5ebb9a[_0x556c20]);}else{_0x5ebb9a[_0x556c20]=this[_0x70ba('0x93')](_0x5ebb9a[_0x556c20]);}}}}return _0x5ebb9a;};AGIVertices[_0x70ba('0x15')][_0x70ba('0x94')]=function(_0x363aad){for(var _0x21dff6 in _0x363aad){if(_0x363aad[_0x70ba('0x90')](_0x21dff6)){if(_['isPlainObject'](_0x363aad[_0x21dff6])){this['recursiveNodeIndex'](_0x363aad[_0x21dff6]);}else if(_[_0x70ba('0x95')](_0x363aad[_0x21dff6])){for(var _0x4302e6=0x0;_0x4302e6<_0x363aad[_0x21dff6]['length'];_0x4302e6++){this[_0x70ba('0x94')](_0x363aad[_0x21dff6][_0x4302e6]);}}else if(_['isString'](_0x363aad[_0x21dff6])){_0x363aad[_0x21dff6]=this[_0x70ba('0x93')](_0x363aad[_0x21dff6]);}}}};AGIVertices[_0x70ba('0x15')]['saveRestApiResult']=function(_0x3b3c28,_0x1dc7db){for(var _0x814ec6 in _0x3b3c28){if(_0x3b3c28[_0x70ba('0x90')](_0x814ec6)){if(_['isPlainObject'](_0x3b3c28[_0x814ec6])){if(!_[_0x70ba('0x47')](_0x3b3c28[_0x814ec6])){this[_0x70ba('0x96')](_0x3b3c28[_0x814ec6],util[_0x70ba('0x2c')](_0x70ba('0x97'),_0x1dc7db,_0x814ec6));}}else if(_['isArray'](_0x3b3c28[_0x814ec6])){for(var _0x10acf1=0x0;_0x10acf1<_0x3b3c28[_0x814ec6][_0x70ba('0x98')];_0x10acf1++){this[_0x70ba('0x96')](_0x3b3c28[_0x814ec6][_0x10acf1],util[_0x70ba('0x2c')]('%s.%s',_0x1dc7db,_0x814ec6+'['+_0x10acf1+']'));}}else{if(!_['isNil'](_0x3b3c28[_0x814ec6])){this[_0x70ba('0x10')][_0x70ba('0x99')](util['format'](_0x70ba('0x97'),_0x1dc7db,_0x814ec6),_0x3b3c28[_0x814ec6]);}}}}};AGIVertices[_0x70ba('0x15')][_0x70ba('0x9a')]=function(_0xcdd6c4){try{var _0x2cfbd8=JSON[_0x70ba('0x6a')](_0xcdd6c4);this[_0x70ba('0x94')](_0x2cfbd8);return JSON[_0x70ba('0x6f')](_0x2cfbd8);}catch(_0x1536d6){return this[_0x70ba('0x93')](_0xcdd6c4);}};AGIVertices[_0x70ba('0x15')][_0x70ba('0x93')]=function(_0x1d90be){var _0xa83ff8=_0x1d90be[_0x70ba('0x9b')]('{');for(var _0x203622=0x1;_0x203622<_0xa83ff8[_0x70ba('0x98')];_0x203622+=0x1){var _0x53e87f=_0xa83ff8[_0x203622][_0x70ba('0x9b')]('}');if(_0x53e87f[_0x70ba('0x98')]>0x1){_0x1d90be=_0x1d90be[_0x70ba('0x9c')]('{'+_0x53e87f[0x0]+'}',this[_0x70ba('0x10')][_0x70ba('0x12')](_0x53e87f[0x0])[_0x70ba('0x9d')]||_0x53e87f[0x0]);}}if(_0xa83ff8[_0x70ba('0x98')]===0x1){return _0x1d90be['toString']();}return this['replaceAllVariables'](_0x1d90be);};AGIVertices[_0x70ba('0x15')]['getAndSetVariable']=function(_0x18db80,_0x1a23d9){var _0x12329d=this[_0x70ba('0x10')][_0x70ba('0x12')](_0x18db80);if(_0x12329d[_0x70ba('0x9e')]===-0x1){return _0x12329d;}logger[_0x70ba('0x30')](util['format'](_0x70ba('0x9f'),_0x1a23d9,_0x12329d[_0x70ba('0x9d')]));return this[_0x70ba('0x10')][_0x70ba('0x99')](_0x1a23d9,_0x12329d[_0x70ba('0x9d')]);};AGIVertices[_0x70ba('0x15')]['isConfigured']=function(_0x610164){return _0x610164&&_0x610164!=='0'&&_0x610164!=='-1'&&_0x610164!=='';};AGIVertices[_0x70ba('0x15')][_0x70ba('0xa0')]=function(_0x408378){this[_0x70ba('0x38')][_0x70ba('0x6d')](this,_0x408378,'-');_0x408378[_0x70ba('0xa1')]=_0x408378['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices['prototype'][_0x70ba('0xa2')]=function(_0x312626){logger['info'](util[_0x70ba('0x2c')]('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0x312626[_0x70ba('0x3a')]));if(!this[_0x70ba('0x81')](_0x312626[_0x70ba('0x5d')])){return this[_0x70ba('0x10')][_0x70ba('0xa3')](_0x70ba('0xa4'));}var _0x375b6d='\x22'+_0x312626[_0x70ba('0x5d')]+'\x22';if(this[_0x70ba('0x81')](_0x312626['options'])){_0x375b6d+=','+_0x312626[_0x70ba('0x74')];}var _0x237d3b=this[_0x70ba('0x10')]['exec'](_0x70ba('0xa5'),_0x375b6d);if(_0x237d3b[_0x70ba('0x9e')]===-0x1){return _0x237d3b;}return this['channel'][_0x70ba('0xa3')](util[_0x70ba('0x2c')](_0x70ba('0xa6'),_0x375b6d));};AGIVertices[_0x70ba('0x15')][_0x70ba('0xa7')]=function(_0x3016dd){logger[_0x70ba('0x30')](util[_0x70ba('0x2c')](_0x70ba('0xa8'),_0x3016dd[_0x70ba('0x3a')]));if(!this[_0x70ba('0x81')](_0x3016dd[_0x70ba('0xa9')])){return this[_0x70ba('0x10')]['noop'](_0x70ba('0xaa'));}var _0x491471=_0x3016dd[_0x70ba('0xa9')];if(this[_0x70ba('0x81')](_0x3016dd['options'])){_0x491471+=','+_0x3016dd['options'];}var _0x5e5e6b=this[_0x70ba('0x10')][_0x70ba('0x58')](_0x70ba('0xab'),_0x491471);if(_0x5e5e6b[_0x70ba('0x9e')]===-0x1){return _0x5e5e6b;}var _0x226f09=this['getAndSetVariable']('RECOG_CONFIDENCE()',_0x70ba('0xac'));if(_0x226f09['result']===-0x1){return _0x226f09;}var _0xb1be95=this[_0x70ba('0xad')](_0x70ba('0xae'),_0x70ba('0xaf'));if(_0xb1be95[_0x70ba('0x9e')]===-0x1){return _0xb1be95;}var _0x6b82ab=this[_0x70ba('0xad')](_0x70ba('0xb0'),_0x70ba('0xb1'));if(_0x6b82ab[_0x70ba('0x9e')]===-0x1){return _0x6b82ab;}return this[_0x70ba('0x10')][_0x70ba('0xa3')](util[_0x70ba('0x2c')](_0x70ba('0xb2'),_0x491471));};AGIVertices[_0x70ba('0x15')][_0x70ba('0x7')]=function(_0x569c8a){logger[_0x70ba('0x30')](util['format'](_0x70ba('0xb3'),_0x569c8a['label']));return this[_0x70ba('0x10')][_0x70ba('0x7')]([_0x569c8a['command'],_0x569c8a[_0x70ba('0xb4')]]);};AGIVertices[_0x70ba('0x15')][_0x70ba('0xb5')]=function(_0x2e6661){logger[_0x70ba('0x30')](util[_0x70ba('0x2c')](_0x70ba('0xb6'),_0x2e6661[_0x70ba('0x3a')]));if(this[_0x70ba('0x81')](_0x2e6661[_0x70ba('0x66')])){logger[_0x70ba('0x30')](util['format'](_0x70ba('0xb7'),_0x2e6661[_0x70ba('0x66')]));var _0x1e1133=this['channel'][_0x70ba('0xb8')](_0x2e6661['timeout']);if(_0x1e1133[_0x70ba('0x9e')]===-0x1){return _0x1e1133;}}return this['channel'][_0x70ba('0xb5')]();};AGIVertices[_0x70ba('0x15')][_0x70ba('0x4b')]=function(_0x264058){logger[_0x70ba('0x30')](util[_0x70ba('0x2c')](_0x70ba('0xb9'),_0x264058[_0x70ba('0x3a')]));if(!this[_0x70ba('0x81')](_0x264058[_0x70ba('0xba')])){return this['channel']['error'](_0x264058,'no\x20list\x20selected');}_0x264058[_0x70ba('0x4d')]=moment();if(this[_0x70ba('0x81')](_0x264058[_0x70ba('0xbb')])){_0x264058[_0x70ba('0x4d')]=moment()['add'](_0x264058[_0x70ba('0xbb')],_0x70ba('0xbc'));}if(!this[_0x70ba('0x81')](_0x264058[_0x70ba('0x4e')])){_0x264058['callback_priority']=0x2;}this[_0x70ba('0x46')][_0x70ba('0x6d')](this,_0x264058);return this['channel'][_0x70ba('0xa3')](util[_0x70ba('0x2c')]('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x264058[_0x70ba('0x4a')],_0x264058['list_id'],_0x264058[_0x70ba('0x4d')]));};AGIVertices[_0x70ba('0x15')][_0x70ba('0xbd')]=function(_0x43b8d4){logger['info'](util[_0x70ba('0x2c')](_0x70ba('0xbe'),_0x43b8d4[_0x70ba('0x3a')]));var _0x357fc2=this[_0x70ba('0x10')]['exec'](_0x43b8d4[_0x70ba('0xbf')],_0x43b8d4[_0x70ba('0x74')]);if(_0x357fc2['result']===-0x1){return _0x357fc2;}return this[_0x70ba('0x10')][_0x70ba('0xa3')](util[_0x70ba('0x2c')](_0x70ba('0xc0'),_0x43b8d4[_0x70ba('0xbf')],_0x43b8d4['options']));};AGIVertices[_0x70ba('0x15')]['lumenvoxtts']=function(_0x5a22b1){logger[_0x70ba('0x30')](util[_0x70ba('0x2c')]('Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block',_0x5a22b1[_0x70ba('0x3a')]));if(!this[_0x70ba('0x81')](_0x5a22b1['text'])){return this['channel'][_0x70ba('0xa3')]('no\x20text\x20configured');}var _0x5f5831='\x22'+_0x5a22b1[_0x70ba('0x5d')]+'\x22';if(this[_0x70ba('0x81')](_0x5a22b1[_0x70ba('0x74')])){_0x5f5831+=','+_0x5a22b1['options'];}var _0x29e322=this[_0x70ba('0x10')][_0x70ba('0x58')](_0x70ba('0xa5'),_0x5f5831);if(_0x29e322[_0x70ba('0x9e')]===-0x1){return _0x29e322;}return this['channel'][_0x70ba('0xa3')](util['format'](_0x70ba('0xa6'),_0x5f5831));};AGIVertices[_0x70ba('0x15')]['sestektts']=function(_0x4fb1f0){logger[_0x70ba('0x30')](util[_0x70ba('0x2c')](_0x70ba('0xc1'),_0x4fb1f0[_0x70ba('0x3a')]));if(!this['isConfigured'](_0x4fb1f0[_0x70ba('0x5d')])){return this['channel'][_0x70ba('0xa3')](_0x70ba('0xa4'));}var _0x29b478='\x22'+_0x4fb1f0[_0x70ba('0x5d')]+'\x22';if(this[_0x70ba('0x81')](_0x4fb1f0[_0x70ba('0x74')])){_0x29b478+=','+_0x4fb1f0['options'];}var _0xd4eb4e=this[_0x70ba('0x10')][_0x70ba('0x58')](_0x70ba('0xa5'),_0x29b478);if(_0xd4eb4e['result']===-0x1){return _0xd4eb4e;}return this[_0x70ba('0x10')][_0x70ba('0xa3')](util[_0x70ba('0x2c')](_0x70ba('0xa6'),_0x29b478));};AGIVertices[_0x70ba('0x15')]['lumenvoxasr']=function(_0x3cefff){logger[_0x70ba('0x30')](util[_0x70ba('0x2c')](_0x70ba('0xc2'),_0x3cefff[_0x70ba('0x3a')]));if(!this['isConfigured'](_0x3cefff[_0x70ba('0xa9')])){return this[_0x70ba('0x10')][_0x70ba('0xa3')](_0x70ba('0xaa'));}var _0x4f9305=_0x3cefff['grammar'];if(this[_0x70ba('0x81')](_0x3cefff[_0x70ba('0x74')])){_0x4f9305+=','+_0x3cefff['options'];}var _0x55c471=this[_0x70ba('0x10')][_0x70ba('0x58')](_0x70ba('0xab'),_0x4f9305);if(_0x55c471['result']===-0x1){return _0x55c471;}var _0x138ae3=this['getAndSetVariable'](_0x70ba('0xc3'),_0x70ba('0xc4'));if(_0x138ae3[_0x70ba('0x9e')]===-0x1){return _0x138ae3;}var _0x1ea5b8=this[_0x70ba('0xad')](_0x70ba('0xae'),'LUMENVOX_ASR_TRANSCRIPT');if(_0x1ea5b8[_0x70ba('0x9e')]===-0x1){return _0x1ea5b8;}var _0x5be21f=this[_0x70ba('0xad')](_0x70ba('0xb0'),_0x70ba('0xc5'));if(_0x5be21f[_0x70ba('0x9e')]===-0x1){return _0x5be21f;}return this[_0x70ba('0x10')][_0x70ba('0xa3')](util[_0x70ba('0x2c')](_0x70ba('0xb2'),_0x4f9305));};AGIVertices[_0x70ba('0x15')][_0x70ba('0xc6')]=function(_0xd1f4fc){logger[_0x70ba('0x30')](util[_0x70ba('0x2c')](_0x70ba('0xc7'),_0xd1f4fc[_0x70ba('0x3a')]));if(!this['isConfigured'](_0xd1f4fc['grammar'])){return this[_0x70ba('0x10')][_0x70ba('0xa3')](_0x70ba('0xaa'));}var _0x34e82d=_0xd1f4fc[_0x70ba('0xa9')];if(this[_0x70ba('0x81')](_0xd1f4fc[_0x70ba('0x74')])){_0x34e82d+=','+_0xd1f4fc[_0x70ba('0x74')];}var _0x88e63d=this[_0x70ba('0x10')]['exec'](_0x70ba('0xab'),_0x34e82d);if(_0x88e63d[_0x70ba('0x9e')]===-0x1){return _0x88e63d;}var _0x1bdae4=this[_0x70ba('0xad')](_0x70ba('0xc3'),_0x70ba('0xc8'));if(_0x1bdae4[_0x70ba('0x9e')]===-0x1){return _0x1bdae4;}var _0x1d7db7=this[_0x70ba('0xad')](_0x70ba('0xae'),_0x70ba('0xc9'));if(_0x1d7db7[_0x70ba('0x9e')]===-0x1){return _0x1d7db7;}var _0x1f9bfc=this[_0x70ba('0xad')]('RECOG_INSTANCE()',_0x70ba('0xca'));if(_0x1f9bfc[_0x70ba('0x9e')]===-0x1){return _0x1f9bfc;}return this[_0x70ba('0x10')]['noop'](util[_0x70ba('0x2c')](_0x70ba('0xb2'),_0x34e82d));};AGIVertices[_0x70ba('0x15')][_0x70ba('0xcb')]=function(_0x43a456){logger['info'](util['format'](_0x70ba('0xcc'),_0x43a456[_0x70ba('0x3a')]));if(!this['isConfigured'](_0x43a456[_0x70ba('0xcd')])){return this[_0x70ba('0x10')]['error'](_0x43a456,_0x70ba('0xce'));}var _0x3ab9d8=this[_0x70ba('0x1c')]['sync'](this,_0x43a456[_0x70ba('0xcd')]);if(!_0x3ab9d8){return this[_0x70ba('0x10')][_0x70ba('0x2f')](_0x43a456,_0x70ba('0xcf'));}if(!this['isConfigured'](_0x43a456[_0x70ba('0x32')])){return this['channel']['error'](_0x43a456,_0x70ba('0xd0'));}var _0x3d10d8=_0x43a456[_0x70ba('0x32')][_0x70ba('0x5a')](/(\r\n|\n|\r)/gm,'\x20');this[_0x70ba('0x10')][_0x70ba('0xa3')](util[_0x70ba('0x2c')](_0x70ba('0xd1'),_0x3d10d8));var _0x5c0407=this[_0x70ba('0xd2')][_0x70ba('0x6d')](this,_0x3ab9d8,_0x3d10d8);this[_0x70ba('0x38')][_0x70ba('0x6d')](this,_0x43a456,_0x3d10d8);if(!this['isConfigured'](_0x43a456[_0x70ba('0xd3')])){return this['channel']['noop']('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x4eb230=this[_0x70ba('0x12')][_0x70ba('0x6d')](this,_0x43a456['variable_id']);if(!_0x4eb230){return this[_0x70ba('0x10')][_0x70ba('0x2f')](_0x43a456,_0x70ba('0xd4'));}var _0x36f3ed=this;_0x5c0407[_0x70ba('0xd5')](function(_0x217f66,_0x5d0ac3){Object[_0x70ba('0xd6')](_0x217f66)[_0x70ba('0xd5')](function(_0x39ea4d){_0x36f3ed[_0x70ba('0x10')]['setVariable'](util['format'](_0x70ba('0xd7'),_0x4eb230,_0x5d0ac3,_0x39ea4d),_0x217f66[_0x39ea4d]);});});this[_0x70ba('0x10')][_0x70ba('0x99')](util[_0x70ba('0x2c')](_0x70ba('0xd8'),_0x4eb230),_0x5c0407['length']);return this['channel'][_0x70ba('0xa3')](util['format']('variable\x20%s\x20set',_0x4eb230));};AGIVertices[_0x70ba('0x15')][_0x70ba('0xd9')]=function(_0x1e0375){logger['debug'](util['format']('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x1e0375[_0x70ba('0x3a')]));if(!this[_0x70ba('0x81')](_0x1e0375[_0x70ba('0xda')])){return this[_0x70ba('0x10')]['error'](_0x1e0375,'no\x20user\x20selected');}var _0x4eed89=this[_0x70ba('0x1f')]['sync'](this,_0x1e0375['sip_id']);if(!_0x4eed89){return this[_0x70ba('0x10')][_0x70ba('0x2f')](_0x1e0375,'no\x20user\x20found');}var _0x4909d3=this[_0x70ba('0x10')][_0x70ba('0x58')](_0x70ba('0xdb'),[util['format'](_0x70ba('0xdc'),_0x4eed89),_0x1e0375[_0x70ba('0x66')],_0x1e0375['opts'],_0x1e0375['url']]);if(_0x4909d3[_0x70ba('0x9e')]===-0x1){return _0x4909d3;}return this['channel'][_0x70ba('0xa3')](util[_0x70ba('0x2c')](_0x70ba('0xdd'),'DIAL'));};AGIVertices[_0x70ba('0x15')][_0x70ba('0xde')]=function(_0xed07e2){logger[_0x70ba('0x30')](util[_0x70ba('0x2c')](_0x70ba('0xdf'),_0xed07e2[_0x70ba('0x3a')]));if(!this[_0x70ba('0x81')](_0xed07e2[_0x70ba('0x76')])){return this['channel'][_0x70ba('0xa3')]('no\x20key\x20configured');}if(!this[_0x70ba('0x81')](_0xed07e2['text'])){return this['channel']['noop'](_0x70ba('0xa4'));}this[_0x70ba('0x10')][_0x70ba('0xe0')]=!![];this[_0x70ba('0x38')](_0xed07e2);this[_0x70ba('0x45')](_0xed07e2[_0x70ba('0x5d')],'in','','');this[_0x70ba('0x10')][_0x70ba('0xa3')](util[_0x70ba('0x2c')](_0x70ba('0xe1'),_0xed07e2[_0x70ba('0x5d')]));var _0x401556=this['googleDialogflow'][_0x70ba('0x6d')](this,_0xed07e2);if(_0x401556){for(var _0x1a63b7 in _0x401556){if(_0x401556[_0x70ba('0x90')](_0x1a63b7)){this[_0x70ba('0x10')]['setVariable'](util[_0x70ba('0x2c')](_0x70ba('0xe2'),_0x1a63b7[_0x70ba('0xe3')]()),_0x401556[_0x1a63b7]);}}this['createSquareMessage'](_0x401556[_0x70ba('0xe4')],_0x70ba('0xe5'),_0x70ba('0xde'),'');return this[_0x70ba('0x10')]['noop'](util[_0x70ba('0x2c')]('Dialogflow\x20Result\x20%s',_0x401556[_0x70ba('0xe4')]));}return this[_0x70ba('0x10')][_0x70ba('0x2f')](_0xed07e2,_0x70ba('0xe6'));};AGIVertices['prototype'][_0x70ba('0xe7')]=function(_0x11efa8){logger[_0x70ba('0x30')](util['format'](_0x70ba('0xe8'),_0x11efa8[_0x70ba('0x3a')]));if(!this[_0x70ba('0x81')](_0x11efa8[_0x70ba('0x79')])){return this[_0x70ba('0x10')][_0x70ba('0xa3')](_0x70ba('0xe9'));}if(!this[_0x70ba('0x81')](_0x11efa8[_0x70ba('0xea')])){return this['channel'][_0x70ba('0xa3')]('no\x20client_email\x20configured');}if(!this[_0x70ba('0x81')](_0x11efa8[_0x70ba('0xeb')])){return this[_0x70ba('0x10')][_0x70ba('0xa3')](_0x70ba('0xec'));}if(!this[_0x70ba('0x81')](_0x11efa8[_0x70ba('0x7a')])){return this['channel']['noop'](_0x70ba('0xed'));}if(!this[_0x70ba('0x81')](_0x11efa8[_0x70ba('0x5d')])){return this[_0x70ba('0x10')][_0x70ba('0xa3')]('no\x20text\x20configured');}this[_0x70ba('0x10')]['bot']=!![];this['createSquareDetailsReport'](_0x11efa8);this[_0x70ba('0x45')](_0x11efa8[_0x70ba('0x5d')],'in','','');this['channel'][_0x70ba('0xa3')](util['format'](_0x70ba('0xee'),_0x11efa8[_0x70ba('0x5d')]));var _0x29fd70=this['googleDialogflowV2'][_0x70ba('0x6d')](this,_0x11efa8);if(_0x29fd70){for(var _0x32b3b9 in _0x29fd70){if(_0x29fd70[_0x70ba('0x90')](_0x32b3b9)){if(_0x32b3b9!==_0x70ba('0xef')){this[_0x70ba('0x10')][_0x70ba('0x99')](util['format']('DIALOGFLOW_%s',_0x32b3b9[_0x70ba('0xe3')]()),_0x29fd70[_0x32b3b9]);}}}this[_0x70ba('0x45')](_0x29fd70[_0x70ba('0xe4')],_0x70ba('0xe5'),_0x70ba('0xe7'),_0x29fd70[_0x70ba('0xef')]);return this[_0x70ba('0x10')][_0x70ba('0xa3')](util[_0x70ba('0x2c')]('DialogflowV2\x20Result\x20%s',_0x29fd70[_0x70ba('0xe4')]));}return this[_0x70ba('0x10')][_0x70ba('0x2f')](_0x11efa8,_0x70ba('0xf0'));};AGIVertices[_0x70ba('0x15')][_0x70ba('0xf1')]=function(_0x1c0bfa){logger['info'](util[_0x70ba('0x2c')](_0x70ba('0xf2'),_0x1c0bfa[_0x70ba('0x3a')]));if(!this[_0x70ba('0x81')](_0x1c0bfa[_0x70ba('0xf3')])){return this[_0x70ba('0x10')][_0x70ba('0xa3')](_0x70ba('0xf4'));}if(!this[_0x70ba('0x81')](_0x1c0bfa[_0x70ba('0xf5')])){return this['channel']['noop'](_0x70ba('0xf6'));}if(!this[_0x70ba('0x81')](_0x1c0bfa[_0x70ba('0xf7')])){return this[_0x70ba('0x10')][_0x70ba('0xa3')](_0x70ba('0xf8'));}if(!this[_0x70ba('0x81')](_0x1c0bfa['ndassistant_url'])){return this[_0x70ba('0x10')][_0x70ba('0xa3')](_0x70ba('0xa4'));}this[_0x70ba('0x10')][_0x70ba('0xe0')]=!![];this[_0x70ba('0x38')](_0x1c0bfa);this[_0x70ba('0x45')](_0x1c0bfa[_0x70ba('0x5d')],'in','','');this[_0x70ba('0x10')][_0x70ba('0xa3')](util['format']('Trying\x20SestekNDA:\x20%s',_0x1c0bfa[_0x70ba('0x5d')]));var _0x652fe7=this[_0x70ba('0x7b')][_0x70ba('0x6d')](this,_0x1c0bfa);if(_0x652fe7){for(var _0x2b08c9 in _0x652fe7){if(_0x652fe7[_0x70ba('0x90')](_0x2b08c9)){this[_0x70ba('0x10')][_0x70ba('0x99')](util[_0x70ba('0x2c')](_0x70ba('0xf9'),_0x2b08c9['toUpperCase']()),_0x652fe7[_0x2b08c9]);}}this[_0x70ba('0x45')](_0x652fe7[_0x70ba('0xe4')],_0x70ba('0xe5'),_0x70ba('0xf1'),'');if(_0x652fe7['audiofile']){this['channel'][_0x70ba('0xa3')](util['format']('Sestek\x20NDA\x20%s\x20file\x20created',_0x652fe7[_0x70ba('0xfa')]));var _0x1232b9=this['channel']['streamFile'](_0x652fe7[_0x70ba('0xfa')]);try{fs[_0x70ba('0xfb')](_0x652fe7[_0x70ba('0xfa')]+_0x70ba('0xfc'));}catch(_0x8d2d41){logger[_0x70ba('0x2f')](_0x8d2d41);}return _0x1232b9;}else{return this['channel']['noop'](util[_0x70ba('0x2c')](_0x70ba('0xfd'),_0x652fe7['speech']));}}return this['channel'][_0x70ba('0x2f')](_0x1c0bfa,_0x70ba('0xfe'));};AGIVertices['prototype']['end']=function(_0x3f65c3){logger[_0x70ba('0x30')](util[_0x70ba('0x2c')](_0x70ba('0xff'),_0x3f65c3['label']));return this[_0x70ba('0x10')]['noop'](_0x70ba('0x100'));};AGIVertices['prototype'][_0x70ba('0x101')]=function(_0xe2926f){logger[_0x70ba('0x30')](util[_0x70ba('0x2c')]('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0xe2926f[_0x70ba('0x3a')]));var _0x48014f='';if(_0xe2926f[_0x70ba('0x102')]){if(!this[_0x70ba('0x81')](_0xe2926f[_0x70ba('0x102')])){return this['channel']['error'](_0xe2926f,'no\x20trunk\x20selected');}else{var _0x7a9fdf=parseInt(_0xe2926f['trunk_id'],0xa);if(isNaN(_0x7a9fdf)){_0x48014f=_0xe2926f[_0x70ba('0x102')];}else{_0x48014f=this[_0x70ba('0x103')][_0x70ba('0x6d')](this,_0xe2926f[_0x70ba('0x102')]);if(!_0x48014f){return this[_0x70ba('0x10')][_0x70ba('0x2f')](_0xe2926f,_0x70ba('0x104'));}}}}else if(_0xe2926f[_0x70ba('0x105')]){_0x48014f=_0xe2926f[_0x70ba('0x105')];}else{return this[_0x70ba('0x10')][_0x70ba('0x2f')](_0xe2926f,_0x70ba('0x106'));}var _0x24ae91=this[_0x70ba('0x10')]['exec'](_0x70ba('0xdb'),[util[_0x70ba('0x2c')](_0x70ba('0x107'),_0x48014f,_0xe2926f[_0x70ba('0x4a')]),_0xe2926f[_0x70ba('0x66')],_0xe2926f[_0x70ba('0x108')],_0xe2926f['url']]);if(_0x24ae91[_0x70ba('0x9e')]===-0x1){return _0x24ae91;}return this[_0x70ba('0x10')]['noop'](util[_0x70ba('0x2c')](_0x70ba('0xdd'),_0x70ba('0xdb')));};AGIVertices[_0x70ba('0x15')][_0x70ba('0x109')]=function(_0x473f0f){logger[_0x70ba('0x30')](util[_0x70ba('0x2c')](_0x70ba('0x10a'),_0x473f0f[_0x70ba('0x3a')]));return this[_0x70ba('0x10')][_0x70ba('0xa3')](_0x70ba('0x109'));};AGIVertices[_0x70ba('0x15')]['getdigits']=function(_0x19459b){logger['info'](util['format'](_0x70ba('0x10b'),_0x19459b['label']));if(_0x19459b[_0x70ba('0xa1')]===0x0){return this[_0x70ba('0xa0')](_0x19459b);}_0x19459b[_0x70ba('0xa1')]-=0x1;if(!this[_0x70ba('0x81')](_0x19459b[_0x70ba('0x10c')])){return this[_0x70ba('0x10')][_0x70ba('0x2f')](_0x19459b,_0x70ba('0x10d'));}var _0x2742fe=this[_0x70ba('0x22')][_0x70ba('0x6d')](this,_0x19459b['file_id']);if(!_0x2742fe){return this[_0x70ba('0x10')][_0x70ba('0x2f')](_0x19459b,_0x70ba('0x10e'));}if(!this['isConfigured'](_0x19459b[_0x70ba('0xd3')])){return this['channel']['error'](_0x70ba('0x10f'));}var _0x330f9f=this[_0x70ba('0x10')]['getData'](_0x2742fe,_0x19459b[_0x70ba('0x110')],_0x19459b[_0x70ba('0x111')]);var _0x3c0a25=_0x330f9f[_0x70ba('0x9e')]?_0x330f9f['result'][_0x70ba('0x112')]():'';logger[_0x70ba('0x30')](_0x70ba('0x113'),JSON['stringify'](_0x330f9f));if(_0x330f9f[_0x70ba('0x9e')]===-0x1){this[_0x70ba('0x38')]['sync'](this,_0x19459b,_0x3c0a25);return _0x330f9f;}else if(_0x330f9f[_0x70ba('0x9d')]==='timeout'){_0x330f9f['result']=_0x3c0a25[_0x70ba('0x98')]>=parseInt(_0x19459b['mindigit'])?'x':'i';}else{_0x330f9f[_0x70ba('0x9e')]=_0x3c0a25[_0x70ba('0x98')]>=parseInt(_0x19459b[_0x70ba('0x114')])&&_0x3c0a25[_0x70ba('0x98')]<=parseInt(_0x19459b[_0x70ba('0x111')])?'x':'i';}var _0x46fc83=this['getVariable'][_0x70ba('0x6d')](this,_0x19459b[_0x70ba('0xd3')]);if(!_0x46fc83){return this[_0x70ba('0x10')][_0x70ba('0x2f')](_0x19459b,'no\x20variable\x20found');}this[_0x70ba('0x10')][_0x70ba('0x99')](_0x46fc83,_0x3c0a25);if(this['isConfigured'](_0x19459b['hiddendigitsnum'])){var _0x1cecde=parseInt(_0x19459b[_0x70ba('0x115')],0xa);var _0x344d78=rs['generate']({'charset':'*','length':_0x1cecde});var _0x316cdf=_0x3c0a25['length'];if(_0x316cdf>0x0){if(_0x316cdf>_0x1cecde){this[_0x70ba('0x38')][_0x70ba('0x6d')](this,_0x19459b,_0x19459b['hiddendigitspos']===_0x70ba('0x116')?_0x344d78+_0x3c0a25[_0x70ba('0x117')](_0x1cecde):_0x3c0a25['substr'](0x0,_0x316cdf-_0x1cecde)+_0x344d78);}else{this['createSquareDetailsReport']['sync'](this,_0x19459b,rs['generate']({'charset':'*','length':_0x316cdf}));}}else{this[_0x70ba('0x38')][_0x70ba('0x6d')](this,_0x19459b,'');}}else{this[_0x70ba('0x38')]['sync'](this,_0x19459b,_0x3c0a25);}return _0x330f9f;};AGIVertices[_0x70ba('0x15')]['getsecretdigits']=function(_0x34649b){logger[_0x70ba('0x30')](util[_0x70ba('0x2c')](_0x70ba('0x118'),_0x34649b[_0x70ba('0x3a')]));return this['getdigits'](_0x34649b);};AGIVertices[_0x70ba('0x15')]['goal']=function(_0x5567ce){logger['info'](util[_0x70ba('0x2c')](_0x70ba('0x119'),_0x5567ce[_0x70ba('0x3a')]));this['createSquareDetailsReport'][_0x70ba('0x6d')](this,_0x5567ce,_0x5567ce[_0x70ba('0x11a')]);return this[_0x70ba('0x10')][_0x70ba('0xa3')](util[_0x70ba('0x2c')](_0x70ba('0x11b'),_0x5567ce[_0x70ba('0x11a')]));};AGIVertices[_0x70ba('0x15')][_0x70ba('0x11c')]=function(_0x33ef13){logger[_0x70ba('0x30')](util[_0x70ba('0x2c')](_0x70ba('0x11d'),_0x33ef13[_0x70ba('0x3a')]));if(!this[_0x70ba('0x81')](_0x33ef13[_0x70ba('0x84')])||!this['isConfigured'](_0x33ef13[_0x70ba('0x88')])){return this[_0x70ba('0x10')][_0x70ba('0xa3')]('no\x20valid\x20credentials\x20configured');}if(!this[_0x70ba('0x81')](_0x33ef13[_0x70ba('0x5d')])){return this[_0x70ba('0x10')][_0x70ba('0xa3')]('no\x20text\x20configured');}this[_0x70ba('0x10')][_0x70ba('0xa3')](util[_0x70ba('0x2c')](_0x70ba('0x11e'),_0x33ef13[_0x70ba('0x5d')]));var _0x1c47c0=this['awsPolly'][_0x70ba('0x6d')](this,_0x33ef13);if(_0x1c47c0){this[_0x70ba('0x10')]['noop'](util['format']('aws\x20Polly\x20%s\x20file\x20created',_0x1c47c0));var _0xb8eda0=this['channel'][_0x70ba('0x11f')](_0x1c47c0);try{fs['unlink'](_0x1c47c0+'.wav');}catch(_0x2e49be){logger[_0x70ba('0x2f')](_0x2e49be);}return _0xb8eda0;}return this[_0x70ba('0x10')][_0x70ba('0x2f')](_0x33ef13,_0x70ba('0x120'));};AGIVertices[_0x70ba('0x15')][_0x70ba('0x121')]=function(_0x3f736a){logger[_0x70ba('0x30')](util[_0x70ba('0x2c')](_0x70ba('0x122'),_0x3f736a[_0x70ba('0x3a')]));if(!this[_0x70ba('0x81')](_0x3f736a[_0x70ba('0x84')])||!this[_0x70ba('0x81')](_0x3f736a[_0x70ba('0x88')])){return this['channel']['noop'](_0x70ba('0x123'));}if(!this['isConfigured'](_0x3f736a[_0x70ba('0x89')])){return this[_0x70ba('0x10')]['noop'](_0x70ba('0x124'));}if(!this[_0x70ba('0x81')](_0x3f736a[_0x70ba('0x5d')])){return this[_0x70ba('0x10')]['noop'](_0x70ba('0xa4'));}this[_0x70ba('0x10')][_0x70ba('0xe0')]=!![];this[_0x70ba('0x38')](_0x3f736a);this['createSquareMessage'](_0x3f736a[_0x70ba('0x5d')],'in','','');this[_0x70ba('0x10')][_0x70ba('0xa3')](util[_0x70ba('0x2c')](_0x70ba('0x125'),_0x3f736a[_0x70ba('0x5d')]));var _0x3637a7=this['awsLex'][_0x70ba('0x6d')](this,_0x3f736a);if(_0x3637a7){for(var _0x4912cb in _0x3637a7){if(_0x3637a7[_0x70ba('0x90')](_0x4912cb)&&_[_0x70ba('0x91')](_0x3637a7[_0x4912cb])){this[_0x70ba('0x10')][_0x70ba('0x99')](util['format']('AWS_LEX_%s',_0x4912cb[_0x70ba('0xe3')]()),_0x3637a7[_0x4912cb]);}}if(_[_0x70ba('0x48')](_0x3637a7[_0x70ba('0x72')])){return this[_0x70ba('0x10')][_0x70ba('0xa3')]('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this[_0x70ba('0x45')](_0x3637a7[_0x70ba('0x72')],_0x70ba('0xe5'),_0x70ba('0x126'),'');return this[_0x70ba('0x10')]['noop'](util[_0x70ba('0x2c')](_0x70ba('0x127'),_0x3637a7[_0x70ba('0x72')]));}}return this[_0x70ba('0x10')][_0x70ba('0x2f')](_0x3f736a,_0x70ba('0x128'));};AGIVertices['prototype'][_0x70ba('0x129')]=function(_0x2be697){logger[_0x70ba('0x30')](util[_0x70ba('0x2c')](_0x70ba('0x12a'),_0x2be697[_0x70ba('0x3a')],_0x2be697[_0x70ba('0x66')]));if(!this[_0x70ba('0x81')](_0x2be697[_0x70ba('0x76')])){return this[_0x70ba('0x10')][_0x70ba('0xa3')](_0x70ba('0x12b'));}var _0x27c559=_0x70ba('0x12c');var _0x5996f8=util[_0x70ba('0x2c')]('%s/recordings/%s',FILES_PATH,rs[_0x70ba('0x12d')](0x4));var _0x1c3dca=util['format']('%s.%s',_0x5996f8,_0x27c559);var _0x5a3c96=!![];if(_0x2be697[_0x70ba('0x12e')]==='NOBEEP'){_0x5a3c96=![];}var _0xea2416=this[_0x70ba('0x10')][_0x70ba('0x12f')](_0x5996f8,_0x27c559,_0x2be697['intKey'],_0x2be697['timeout'],undefined,_0x5a3c96);if(_0xea2416[_0x70ba('0x9e')]!==-0x1){this[_0x70ba('0x10')][_0x70ba('0xa3')](util[_0x70ba('0x2c')](_0x70ba('0x130'),_0x1c3dca));var _0x27a850=this[_0x70ba('0x8a')][_0x70ba('0x6d')](this,_0x2be697,_0x1c3dca);if(_0x27a850){for(var _0x43e2a7 in _0x27a850){if(_0x27a850[_0x70ba('0x90')](_0x43e2a7)){this['channel']['setVariable'](util[_0x70ba('0x2c')](_0x70ba('0x131'),_0x43e2a7[_0x70ba('0xe3')]()),_0x27a850[_0x43e2a7]);}}return this['channel'][_0x70ba('0xa3')](util['format'](_0x70ba('0x132'),JSON[_0x70ba('0x6f')](_0x27a850)));}}return _0xea2416;};AGIVertices['prototype'][_0x70ba('0x133')]=function(_0x255d7e){logger[_0x70ba('0x30')](util['format'](_0x70ba('0x134'),_0x255d7e[_0x70ba('0x3a')]));if(!this[_0x70ba('0x81')](_0x255d7e[_0x70ba('0x135')])){return this[_0x70ba('0x10')]['noop'](_0x70ba('0x136'));}if(!this[_0x70ba('0x81')](_0x255d7e[_0x70ba('0x8c')])){return this['channel'][_0x70ba('0xa3')](_0x70ba('0x137'));}var _0x5a36df='wav';var _0x5b2da3=util[_0x70ba('0x2c')](_0x70ba('0x138'),FILES_PATH,rs[_0x70ba('0x12d')](0x4));var _0x4cbd35=util[_0x70ba('0x2c')]('%s.%s',_0x5b2da3,_0x5a36df);var _0xc333d1=!![];if(_0x255d7e[_0x70ba('0x12e')]===_0x70ba('0x139')){_0xc333d1=![];}var _0x2e2856=this['channel']['recordFile'](_0x5b2da3,_0x5a36df,_0x255d7e[_0x70ba('0x13a')],_0x255d7e[_0x70ba('0x66')],undefined,_0xc333d1);if(_0x2e2856[_0x70ba('0x9e')]!==-0x1){this['channel'][_0x70ba('0xa3')](util[_0x70ba('0x2c')](_0x70ba('0x13b'),_0x4cbd35));var _0x34589c=this['tildeASR'][_0x70ba('0x6d')](this,_0x255d7e,_0x4cbd35);if(_0x34589c){for(var _0x44d4e6 in _0x34589c){if(_0x34589c[_0x70ba('0x90')](_0x44d4e6)){this[_0x70ba('0x10')][_0x70ba('0x99')](util[_0x70ba('0x2c')](_0x70ba('0x13c'),_0x44d4e6[_0x70ba('0xe3')]()),_0x34589c[_0x44d4e6]);}}return this[_0x70ba('0x10')]['noop'](util[_0x70ba('0x2c')](_0x70ba('0x13d'),JSON[_0x70ba('0x6f')](_0x34589c)));}}return _0x2e2856;};AGIVertices[_0x70ba('0x15')][_0x70ba('0x13e')]=function(_0x15461f){logger[_0x70ba('0x30')](util['format'](_0x70ba('0x13f'),_0x15461f[_0x70ba('0x3a')]));return this['channel'][_0x70ba('0x140')](_0x15461f[_0x70ba('0x40')],_0x15461f[_0x70ba('0x41')],_0x15461f[_0x70ba('0x141')]);};AGIVertices[_0x70ba('0x15')]['gotoif']=function(_0x3d39a9){logger['info'](util[_0x70ba('0x2c')](_0x70ba('0x142'),_0x3d39a9[_0x70ba('0x3a')]));if(!this[_0x70ba('0x81')](_0x3d39a9[_0x70ba('0x143')])){return this[_0x70ba('0x10')][_0x70ba('0x2f')](_0x3d39a9,_0x70ba('0x144'));}try{var _0x36a943=eval(_0x3d39a9[_0x70ba('0x143')])?_0x70ba('0x145'):'false';this['channel'][_0x70ba('0xa3')](util['format'](_0x70ba('0x146'),_0x3d39a9[_0x70ba('0x143')],_0x36a943));return{'code':0xc8,'result':_0x36a943};}catch(_0x124177){return{'code':0xc8,'result':_0x70ba('0x147')};}};AGIVertices[_0x70ba('0x15')]['gotoiftime']=function(_0x4e46e3){logger['info'](util[_0x70ba('0x2c')]('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x4e46e3[_0x70ba('0x3a')]));if(!this['isConfigured'](_0x4e46e3['interval_id'])){return this[_0x70ba('0x10')]['error'](_0x4e46e3,_0x70ba('0x148'));}var _0x183749=this[_0x70ba('0x28')][_0x70ba('0x6d')](this,_0x4e46e3[_0x70ba('0x149')]);if(!_0x183749){return this[_0x70ba('0x10')][_0x70ba('0x2f')](_0x4e46e3,_0x70ba('0x14a'));}for(var _0x228aa5=0x0;_0x228aa5<_0x183749['length'];_0x228aa5+=0x1){var _0x291d2d=this[_0x70ba('0x10')]['getVariable'](util[_0x70ba('0x2c')]('IFTIME(%s?true:false)',_0x183749[_0x228aa5]));if(_0x291d2d[_0x70ba('0x9e')]===-0x1){return _0x291d2d;}logger['info'](util[_0x70ba('0x2c')]('IFTIME\x20%s\x20%s',_0x183749[_0x228aa5],_0x291d2d['extra']));if(_0x291d2d['extra']===_0x70ba('0x145')){logger['info'](util[_0x70ba('0x2c')](_0x70ba('0x14b'),_0x183749[_0x228aa5],_0x70ba('0x145')));this[_0x70ba('0x10')]['noop'](util[_0x70ba('0x2c')](_0x70ba('0x14b'),_0x183749[_0x228aa5],'true'));return{'code':0xc8,'result':_0x70ba('0x145')};}else{logger['info'](util[_0x70ba('0x2c')](_0x70ba('0x14b'),_0x183749[_0x228aa5],_0x70ba('0x147')));this[_0x70ba('0x10')][_0x70ba('0xa3')](util['format']('IFTIME\x20%s\x20%s',_0x183749[_0x228aa5],_0x70ba('0x147')));}}return{'code':0xc8,'result':_0x70ba('0x147')};};AGIVertices[_0x70ba('0x15')]['hangup']=function(_0x5b86b0){logger['info'](util[_0x70ba('0x2c')](_0x70ba('0x14c'),_0x5b86b0[_0x70ba('0x3a')]));return this['channel']['hangup']();};AGIVertices[_0x70ba('0x15')][_0x70ba('0x14d')]=function(_0xf966b8){logger[_0x70ba('0x30')](util[_0x70ba('0x2c')](_0x70ba('0x14e'),_0xf966b8[_0x70ba('0x3a')]));if(!this[_0x70ba('0x81')](_0xf966b8[_0x70ba('0x76')])){return this['channel'][_0x70ba('0xa3')](_0x70ba('0x12b'));}var _0x14a6ec=_0x70ba('0x12c');var _0x54b253=util[_0x70ba('0x2c')](_0x70ba('0x138'),FILES_PATH,rs['generate'](0x4));var _0x148c21=util['format'](_0x70ba('0x97'),_0x54b253,_0x14a6ec);var _0x3d1cf0=!![];if(_0xf966b8[_0x70ba('0x12e')]===_0x70ba('0x139')){_0x3d1cf0=![];}var _0x2a590a=this['channel'][_0x70ba('0x12f')](_0x54b253,_0x14a6ec,_0xf966b8['intKey'],_0xf966b8['timeout'],undefined,_0x3d1cf0);if(_0x2a590a[_0x70ba('0x9e')]!==-0x1){this[_0x70ba('0x10')][_0x70ba('0xa3')](util['format']('ispeech\x20%s\x20file\x20created',_0x148c21));var _0x3cf5a7=this['ispeechASR'][_0x70ba('0x6d')](this,_0xf966b8,_0x148c21);if(_0x3cf5a7){for(var _0x37b72b in _0x3cf5a7){if(_0x3cf5a7[_0x70ba('0x90')](_0x37b72b)){this[_0x70ba('0x10')][_0x70ba('0x99')](util[_0x70ba('0x2c')]('ISPEECH_ASR_%s',_0x37b72b[_0x70ba('0xe3')]()),_0x3cf5a7[_0x37b72b]);}}return this[_0x70ba('0x10')][_0x70ba('0xa3')](util[_0x70ba('0x2c')](_0x70ba('0x14f'),JSON[_0x70ba('0x6f')](_0x3cf5a7)));}}return _0x2a590a;};AGIVertices['prototype']['ispeechtts']=function(_0x36afbb){logger['info'](util[_0x70ba('0x2c')](_0x70ba('0x150'),_0x36afbb[_0x70ba('0x3a')]));if(!this[_0x70ba('0x81')](_0x36afbb[_0x70ba('0x76')])){return this['channel']['noop'](_0x70ba('0x12b'));}if(!this['isConfigured'](_0x36afbb[_0x70ba('0x5d')])){return this[_0x70ba('0x10')][_0x70ba('0xa3')]('no\x20text\x20configured');}this[_0x70ba('0x10')][_0x70ba('0xa3')](util[_0x70ba('0x2c')](_0x70ba('0x151'),_0x36afbb[_0x70ba('0x5d')]));var _0x49293b=this[_0x70ba('0x7c')][_0x70ba('0x6d')](this,_0x36afbb);if(_0x49293b){this[_0x70ba('0x10')]['noop'](util[_0x70ba('0x2c')]('ispeech\x20%s\x20file\x20created',_0x49293b));var _0x3e6d49=this[_0x70ba('0x10')][_0x70ba('0x11f')](_0x49293b,_0x36afbb['intKey']);try{fs[_0x70ba('0xfb')](_0x49293b+_0x70ba('0xfc'));}catch(_0x43a5ec){logger[_0x70ba('0x2f')](_0x43a5ec);}return _0x3e6d49;}return this[_0x70ba('0x10')][_0x70ba('0x2f')](_0x36afbb,_0x70ba('0x152'));};AGIVertices['prototype'][_0x70ba('0x153')]=function(_0xf4c0f){logger[_0x70ba('0x30')](util[_0x70ba('0x2c')]('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0xf4c0f[_0x70ba('0x3a')]));if(!this[_0x70ba('0x81')](_0xf4c0f[_0x70ba('0x154')])){return this[_0x70ba('0x10')][_0x70ba('0x2f')](_0xf4c0f,_0x70ba('0x155'));}logger['info'](util['format'](_0x70ba('0x156'),this[_0x70ba('0x10')][_0x70ba('0x3d')],_0xf4c0f[_0x70ba('0x154')]));var _0x34832e=this[_0x70ba('0x56')]['sync'](this,_0xf4c0f[_0x70ba('0x154')]);if(_0x34832e){logger[_0x70ba('0x30')](util[_0x70ba('0x2c')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x70ba('0x10')][_0x70ba('0x3d')],_0xf4c0f[_0x70ba('0x154')]));this[_0x70ba('0x10')]['noop'](util[_0x70ba('0x2c')](_0x70ba('0x157'),this[_0x70ba('0x10')][_0x70ba('0x3d')],_0xf4c0f[_0x70ba('0x154')]));return{'code':0xc8,'result':_0x70ba('0x158')};}else{logger[_0x70ba('0x30')](util[_0x70ba('0x2c')](_0x70ba('0x159'),this[_0x70ba('0x10')][_0x70ba('0x3d')],_0xf4c0f[_0x70ba('0x154')]));this[_0x70ba('0x10')]['noop'](util[_0x70ba('0x2c')](_0x70ba('0x159'),this[_0x70ba('0x10')][_0x70ba('0x3d')],_0xf4c0f[_0x70ba('0x154')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x70ba('0x15')][_0x70ba('0x15a')]=function(_0x11d626){logger[_0x70ba('0x30')](util[_0x70ba('0x2c')](_0x70ba('0x15b'),_0x11d626[_0x70ba('0x3a')]));if(!this[_0x70ba('0x81')](_0x11d626[_0x70ba('0x154')])){return this[_0x70ba('0x10')][_0x70ba('0x2f')](_0x11d626,_0x70ba('0x155'));}logger[_0x70ba('0x30')](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x70ba('0x10')][_0x70ba('0x3d')],_0x11d626[_0x70ba('0x154')]));var _0x481ba6=this[_0x70ba('0x15c')][_0x70ba('0x6d')](this,_0x11d626[_0x70ba('0x154')]);if(_0x481ba6){logger[_0x70ba('0x30')](util['format'](_0x70ba('0x157'),this[_0x70ba('0x10')]['callerid'],_0x11d626[_0x70ba('0x154')]));this[_0x70ba('0x10')][_0x70ba('0xa3')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x70ba('0x10')][_0x70ba('0x3d')],_0x11d626[_0x70ba('0x154')]));return{'code':0xc8,'result':_0x70ba('0x158')};}else{logger['info'](util[_0x70ba('0x2c')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x70ba('0x10')][_0x70ba('0x3d')],_0x11d626[_0x70ba('0x154')]));this['channel'][_0x70ba('0xa3')](util['format'](_0x70ba('0x159'),this[_0x70ba('0x10')][_0x70ba('0x3d')],_0x11d626['findBy']));return{'code':0xc8,'result':_0x70ba('0x15d')};}};AGIVertices[_0x70ba('0x15')][_0x70ba('0x15e')]=function(_0x551a95){logger['info'](util[_0x70ba('0x2c')](_0x70ba('0x15f'),_0x551a95[_0x70ba('0x3a')]));if(!this['isConfigured'](_0x551a95[_0x70ba('0x160')])){return this[_0x70ba('0x10')]['error'](_0x551a95,_0x70ba('0x161'));}this[_0x70ba('0x10')][_0x70ba('0xa3')](util[_0x70ba('0x2c')](_0x70ba('0x162'),_0x551a95[_0x70ba('0x160')]));var _0x40a429=eval(_0x551a95[_0x70ba('0x160')]);if(!this[_0x70ba('0x81')](_0x551a95['variable_id'])){return this[_0x70ba('0x10')][_0x70ba('0xa3')](_0x70ba('0x10f'));}var _0x5a7bb7=this[_0x70ba('0x12')][_0x70ba('0x6d')](this,_0x551a95[_0x70ba('0xd3')]);if(!_0x5a7bb7){return this['channel'][_0x70ba('0x2f')](_0x551a95,'no\x20variable\x20found');}if(_['isArray'](_0x40a429)){var _0x58f5d7=this;_0x40a429[_0x70ba('0xd5')](function(_0x223c10,_0x4bab7f){_0x58f5d7[_0x70ba('0x10')]['setVariable'](util['format'](_0x70ba('0x163'),_0x5a7bb7,_0x4bab7f),_0x223c10);});return this['channel'][_0x70ba('0xa3')](util[_0x70ba('0x2c')](_0x70ba('0x164'),_0x5a7bb7));}else{return this[_0x70ba('0x10')]['setVariable'](_0x5a7bb7,_0x40a429);}};AGIVertices[_0x70ba('0x15')][_0x70ba('0xd')]=function(_0x247767){logger[_0x70ba('0x30')](util[_0x70ba('0x2c')]('Enter\x20in\x20MENU\x20(%s)\x20block',_0x247767[_0x70ba('0x3a')]));if(_0x247767['retry']===0x0){return this[_0x70ba('0xa0')](_0x247767);}_0x247767[_0x70ba('0xa1')]-=0x1;if(!this[_0x70ba('0x81')](_0x247767[_0x70ba('0x10c')])){return this[_0x70ba('0x10')]['error'](_0x247767,_0x70ba('0x10d'));}var _0x19e17f=this[_0x70ba('0x22')][_0x70ba('0x6d')](this,_0x247767[_0x70ba('0x10c')]);if(!_0x19e17f){return this['channel'][_0x70ba('0x2f')](_0x247767,_0x70ba('0x10e'));}var _0x1932a4=this[_0x70ba('0x10')][_0x70ba('0x165')](_0x19e17f,_0x247767['response'],_0x247767['digit']);var _0x2cae5f=_0x1932a4[_0x70ba('0x9e')];if(_0x1932a4['result']===-0x1){this[_0x70ba('0x38')][_0x70ba('0x6d')](this,_0x247767,'-1');return _0x1932a4;}else if(_0x1932a4[_0x70ba('0x9d')]===_0x70ba('0x66')){_0x1932a4[_0x70ba('0x9e')]=_0x1932a4[_0x70ba('0x9e')]['length']>0x0?_0x1932a4[_0x70ba('0x9e')]:'t';}else if(_[_0x70ba('0x47')](_0x1932a4['result'])){_0x1932a4['result']='#';_0x2cae5f='#';}if(!this[_0x70ba('0x81')](_0x247767['variable_id'])){this['channel'][_0x70ba('0xa3')](_0x70ba('0x10f'));}else{var _0x45b259=this[_0x70ba('0x12')][_0x70ba('0x6d')](this,_0x247767[_0x70ba('0xd3')]);if(!_0x45b259){return this[_0x70ba('0x10')][_0x70ba('0x2f')](_0x247767,'no\x20variable\x20found');}this[_0x70ba('0x10')][_0x70ba('0x99')](_0x45b259,_0x2cae5f);}this[_0x70ba('0x38')][_0x70ba('0x6d')](this,_0x247767,_0x2cae5f);return _0x1932a4;};AGIVertices[_0x70ba('0x15')]['noop']=function(_0x3600ff){logger[_0x70ba('0x30')](util['format'](_0x70ba('0x166'),_0x3600ff[_0x70ba('0x3a')]));return this[_0x70ba('0x10')][_0x70ba('0xa3')](_0x3600ff[_0x70ba('0x167')]||_0x3600ff[_0x70ba('0x3a')]);};AGIVertices[_0x70ba('0x15')][_0x70ba('0x168')]=function(_0x249a43){logger[_0x70ba('0x30')](util[_0x70ba('0x2c')](_0x70ba('0x169'),_0x249a43['label']));if(!this[_0x70ba('0x81')](_0x249a43['findBy'])){return this[_0x70ba('0x10')][_0x70ba('0x2f')](_0x249a43,_0x70ba('0x155'));}logger['info'](util[_0x70ba('0x2c')](_0x70ba('0x156'),this[_0x70ba('0x10')][_0x70ba('0x3d')],_0x249a43[_0x70ba('0x154')]));var _0x5b7268=this[_0x70ba('0x16a')][_0x70ba('0x6d')](this,_0x249a43[_0x70ba('0x16b')]);var _0x204f52=this[_0x70ba('0x50')]['sync'](this,_0x249a43[_0x70ba('0x154')],_0x5b7268);if(_0x204f52){logger['info'](util[_0x70ba('0x2c')](_0x70ba('0x157'),this[_0x70ba('0x10')][_0x70ba('0x3d')],_0x249a43[_0x70ba('0x154')]));this[_0x70ba('0x10')][_0x70ba('0xa3')](util[_0x70ba('0x2c')](_0x70ba('0x157'),this[_0x70ba('0x10')][_0x70ba('0x3d')],_0x249a43[_0x70ba('0x154')]));return{'code':0xc8,'result':'success'};}else{logger[_0x70ba('0x30')](util[_0x70ba('0x2c')](_0x70ba('0x159'),this[_0x70ba('0x10')]['callerid'],_0x249a43[_0x70ba('0x154')]));this['channel'][_0x70ba('0xa3')](util[_0x70ba('0x2c')](_0x70ba('0x157'),this[_0x70ba('0x10')][_0x70ba('0x3d')],_0x249a43[_0x70ba('0x154')]));return{'code':0xc8,'result':_0x70ba('0x15d')};}};AGIVertices['prototype'][_0x70ba('0x16c')]=function(_0x48135d){logger['info'](util[_0x70ba('0x2c')](_0x70ba('0x16d'),_0x48135d[_0x70ba('0x3a')]));if(!this['isConfigured'](_0x48135d[_0x70ba('0x10c')])){return this[_0x70ba('0x10')][_0x70ba('0x2f')](_0x48135d,_0x70ba('0x10d'));}var _0x111c22=this[_0x70ba('0x22')][_0x70ba('0x6d')](this,_0x48135d[_0x70ba('0x10c')]);if(!_0x111c22){return this[_0x70ba('0x10')]['error'](_0x48135d,'no\x20file\x20audio\x20found');}var _0x4101f7=this[_0x70ba('0x10')][_0x70ba('0x58')](_0x70ba('0x16e'),[_0x111c22,_0x48135d[_0x70ba('0x108')]]);if(_0x4101f7[_0x70ba('0x9e')]===-0x1){return _0x4101f7;}return this[_0x70ba('0x10')][_0x70ba('0xa3')](util[_0x70ba('0x2c')]('Executed\x20command\x20%s\x20%s','PLAYBACK',_0x111c22));};AGIVertices[_0x70ba('0x15')][_0x70ba('0x16f')]=function(_0x4ff4d6){logger[_0x70ba('0x30')](util[_0x70ba('0x2c')]('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0x4ff4d6[_0x70ba('0x3a')]));if(!this['isConfigured'](_0x4ff4d6[_0x70ba('0x170')])){return this[_0x70ba('0x10')][_0x70ba('0x2f')](_0x4ff4d6,_0x70ba('0x171'));}var _0xd51ae3='';var _0x1617a4=parseInt(_0x4ff4d6[_0x70ba('0x170')],0xa);if(isNaN(_0x1617a4)){_0xd51ae3=_0x4ff4d6[_0x70ba('0x170')];}else{_0xd51ae3=this[_0x70ba('0x16')]['sync'](this,_0x4ff4d6['queue_id']);if(!_0xd51ae3){return this[_0x70ba('0x10')][_0x70ba('0x2f')](_0x4ff4d6,'no\x20queue\x20found');}}var _0x1b9173='';if(this[_0x70ba('0x81')](_0x4ff4d6[_0x70ba('0x10c')])){var _0x4fa5ca=this[_0x70ba('0x22')][_0x70ba('0x6d')](this,_0x4ff4d6[_0x70ba('0x10c')]);if(_0x4fa5ca){_0x1b9173=_0x4fa5ca;}}this[_0x70ba('0x38')][_0x70ba('0x6d')](this,_0x4ff4d6,_0xd51ae3);if(_0x4ff4d6[_0x70ba('0x108')][_0x70ba('0x172')]('x')<0x0){_0x4ff4d6[_0x70ba('0x108')]+='x';}if(_0x4ff4d6[_0x70ba('0x108')][_0x70ba('0x172')]('X')<0x0){_0x4ff4d6[_0x70ba('0x108')]+='X';}this[_0x70ba('0x10')]['setVariable'](_0x70ba('0x173'),_0xd51ae3?_0xd51ae3['toLowerCase']():'');var _0x24101b=this['channel'][_0x70ba('0x58')]('QUEUE',[_0xd51ae3,_0x4ff4d6[_0x70ba('0x108')],_0x4ff4d6[_0x70ba('0x174')],_0x1b9173,_0x4ff4d6[_0x70ba('0x66')],_0x4ff4d6[_0x70ba('0x7')],_0x4ff4d6[_0x70ba('0x175')],_0x4ff4d6[_0x70ba('0x176')],'',_0x4ff4d6['position']]);if(_0x24101b[_0x70ba('0x9e')]===-0x1){return _0x24101b;}return this[_0x70ba('0x10')]['noop'](util[_0x70ba('0x2c')](_0x70ba('0xc0'),_0x70ba('0x177'),_0xd51ae3));};AGIVertices[_0x70ba('0x15')][_0x70ba('0x178')]=function(_0x3e5a68){logger[_0x70ba('0x30')](util[_0x70ba('0x2c')]('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x3e5a68[_0x70ba('0x3a')]));var _0x3e4e26=_0x3e5a68[_0x70ba('0x179')]||_0x70ba('0x12c');var _0x3f239d=util['format']('%s_%s',this['channel']['uniqueid'],rs[_0x70ba('0x12d')](0x5));var _0xdc0f1b=util[_0x70ba('0x2c')](_0x70ba('0x17a'),FILES_PATH,_0x3f239d,_0x3e4e26);var _0x5171fd=util[_0x70ba('0x2c')]('%s/recordings/%s',FILES_PATH,_0x3f239d);this[_0x70ba('0x3e')][_0x70ba('0x6d')](this,_0x3e5a68,_0x3f239d,_0xdc0f1b);this[_0x70ba('0x10')][_0x70ba('0x99')]('RECORDING_SAVENAME',_0x3f239d);logger[_0x70ba('0x30')](_0x70ba('0x17b'),_0x5171fd,_0x3e4e26,_0x3e5a68['escape_digits'],_0x3e5a68['timeout']);return this[_0x70ba('0x10')][_0x70ba('0x12f')](_0x5171fd,_0x3e4e26,_0x3e5a68[_0x70ba('0x17c')],_0x3e5a68[_0x70ba('0x66')],undefined,!![]);};AGIVertices[_0x70ba('0x15')]['restapi']=function(_0x5eb281){logger[_0x70ba('0x30')](util['format'](_0x70ba('0x17d'),_0x5eb281[_0x70ba('0x3a')]));if(!this['isConfigured'](_0x5eb281[_0x70ba('0x174')])){return this['channel'][_0x70ba('0xa3')](_0x70ba('0x17e'));}var _0x1f3ce8=this['restAPI'][_0x70ba('0x6d')](this,_0x5eb281);logger[_0x70ba('0x30')](util[_0x70ba('0x2c')](_0x70ba('0x17f'),util[_0x70ba('0x180')](_0x1f3ce8,{'showHidden':![],'depth':null})));if(!this[_0x70ba('0x81')](_0x5eb281['variable_id'])){return this[_0x70ba('0x10')][_0x70ba('0xa3')](_0x70ba('0x181'));}var _0x4fda0a=this[_0x70ba('0x12')]['sync'](this,_0x5eb281[_0x70ba('0xd3')]);if(!_0x4fda0a){return this[_0x70ba('0x10')][_0x70ba('0x2f')](_0x5eb281,_0x70ba('0xd4'));}this[_0x70ba('0x10')][_0x70ba('0x99')](util['format'](_0x70ba('0x182'),_0x4fda0a),_0x1f3ce8[_0x70ba('0x183')]?_0x1f3ce8[_0x70ba('0x183')]:_0x70ba('0x184'));this[_0x70ba('0x10')][_0x70ba('0x99')](util[_0x70ba('0x2c')]('%s_STATUS_MESSAGE',_0x4fda0a),_0x1f3ce8[_0x70ba('0x71')]?_0x1f3ce8[_0x70ba('0x71')]:'OK');if(_0x1f3ce8[_0x70ba('0x69')]){try{this[_0x70ba('0x96')](_0x1f3ce8[_0x70ba('0x69')],_0x4fda0a);}catch(_0x2434fd){logger['error'](util[_0x70ba('0x2c')](_0x70ba('0x185'),_0x4fda0a));}}return this[_0x70ba('0x10')][_0x70ba('0xa3')](util[_0x70ba('0x2c')](_0x70ba('0x186'),_0x4fda0a));};AGIVertices[_0x70ba('0x15')][_0x70ba('0x187')]=function(_0x16b083){logger[_0x70ba('0x30')](util[_0x70ba('0x2c')](_0x70ba('0x188'),_0x16b083['label']));return this[_0x70ba('0x10')][_0x70ba('0x189')](_0x16b083[_0x70ba('0x18a')][_0x70ba('0x5a')](/\s+/g,''),_0x16b083[_0x70ba('0x17c')]);};AGIVertices['prototype'][_0x70ba('0x18b')]=function(_0x14e8f6){logger[_0x70ba('0x30')](util[_0x70ba('0x2c')](_0x70ba('0x18c'),_0x14e8f6['label']));return this['channel'][_0x70ba('0x18d')](_0x14e8f6[_0x70ba('0x67')][_0x70ba('0x5a')](/\s+/g,''),_0x14e8f6['escape_digits']);};AGIVertices['prototype']['sayphonetic']=function(_0x486e9f){logger[_0x70ba('0x30')](util[_0x70ba('0x2c')](_0x70ba('0x18e'),_0x486e9f[_0x70ba('0x3a')]));return this['channel'][_0x70ba('0x18f')](_0x486e9f[_0x70ba('0x5d')],_0x486e9f[_0x70ba('0x17c')]);};AGIVertices[_0x70ba('0x15')][_0x70ba('0x190')]=function(_0x1dc3c0){logger[_0x70ba('0x30')](util[_0x70ba('0x2c')]('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x1dc3c0[_0x70ba('0x3a')]));if(!this[_0x70ba('0x81')](_0x1dc3c0[_0x70ba('0x191')])){return this[_0x70ba('0x10')][_0x70ba('0xa3')](_0x70ba('0x192'));}var _0x293b23=this[_0x70ba('0x25')][_0x70ba('0x6d')](this,_0x1dc3c0['account_id']);if(!_0x293b23||!_0x293b23['Smtp']){return this[_0x70ba('0x10')][_0x70ba('0x2f')](_0x1dc3c0,_0x70ba('0x193'));}var _0x29fbff={'from':util[_0x70ba('0x2c')](_0x70ba('0x194'),_0x293b23['name'],_0x293b23[_0x70ba('0x195')]||_0x293b23[_0x70ba('0x196')][_0x70ba('0x197')]),'to':_0x1dc3c0['to']||'','cc':_0x1dc3c0['cc']||'','bcc':_0x1dc3c0['bcc']||'','subject':_0x1dc3c0[_0x70ba('0x198')],'html':_0x1dc3c0[_0x70ba('0x5d')],'text':_0x1dc3c0[_0x70ba('0x5d')]};if(this[_0x70ba('0x81')](_0x1dc3c0[_0x70ba('0x199')])){}logger[_0x70ba('0x19a')](_0x70ba('0x19b'),JSON['stringify'](_0x29fbff));this[_0x70ba('0x38')][_0x70ba('0x6d')](this,_0x1dc3c0,_0x1dc3c0['account_id']);this[_0x70ba('0x10')][_0x70ba('0xa3')](util['format'](_0x70ba('0x19c'),_0x293b23[_0x70ba('0x19')]));this[_0x70ba('0x27')][_0x70ba('0x6d')](this,_0x293b23[_0x70ba('0x19d')],_0x29fbff);return this[_0x70ba('0x10')][_0x70ba('0xa3')](_0x70ba('0x19e'));};AGIVertices[_0x70ba('0x15')][_0x70ba('0x19f')]=function(_0x4fe497){logger[_0x70ba('0x30')](util['format'](_0x70ba('0x1a0'),_0x4fe497[_0x70ba('0x3a')]));return this[_0x70ba('0x10')][_0x70ba('0xa3')](_0x70ba('0x1a1'));};AGIVertices['prototype'][_0x70ba('0x1a2')]=function(_0x175bf6){logger[_0x70ba('0x30')](util[_0x70ba('0x2c')]('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x175bf6[_0x70ba('0x3a')]));if(!this[_0x70ba('0x81')](_0x175bf6['sms_account_id'])){return this[_0x70ba('0x10')][_0x70ba('0xa3')]('no\x20sms\x20account\x20configured');}var _0xff896a=this[_0x70ba('0x1a3')][_0x70ba('0x6d')](this,_0x175bf6['sms_account_id']);if(!_0xff896a){return this[_0x70ba('0x10')][_0x70ba('0x2f')](_0x175bf6,_0x70ba('0x1a4'));}var _0x52fd64={'body':_0x175bf6[_0x70ba('0x1a5')],'phone':_0x175bf6['to']||'','SmsAccountId':_0xff896a['id']};logger[_0x70ba('0x19a')]('sendSMS\x20message',JSON[_0x70ba('0x6f')](_0x52fd64));this[_0x70ba('0x38')][_0x70ba('0x6d')](this,_0x175bf6,_0x175bf6[_0x70ba('0x1a6')]);this[_0x70ba('0x10')][_0x70ba('0xa3')](util['format'](_0x70ba('0x1a7'),_0xff896a[_0x70ba('0x19')]));this[_0x70ba('0x37')][_0x70ba('0x6d')](this,_0x52fd64);return this['channel']['noop'](_0x70ba('0x1a8'));};AGIVertices[_0x70ba('0x15')][_0x70ba('0x1a9')]=function(_0x4c97fc){logger[_0x70ba('0x30')](util[_0x70ba('0x2c')](_0x70ba('0x1aa'),_0x4c97fc[_0x70ba('0x3a')]));if(!this[_0x70ba('0x81')](_0x4c97fc[_0x70ba('0xd3')])){return this[_0x70ba('0x10')][_0x70ba('0x2f')](_0x4c97fc,_0x70ba('0x1ab'));}var _0x2f2c95=this['getVariable'][_0x70ba('0x6d')](this,_0x4c97fc[_0x70ba('0xd3')]);if(!_0x2f2c95){return this[_0x70ba('0x10')][_0x70ba('0x2f')](_0x4c97fc,_0x70ba('0xd4'));}return this[_0x70ba('0x10')][_0x70ba('0x99')](_0x2f2c95,_0x4c97fc[_0x70ba('0x1ac')]);};AGIVertices[_0x70ba('0x15')]['start']=function(_0xea2390){logger[_0x70ba('0x30')](util['format'](_0x70ba('0x1ad'),_0xea2390[_0x70ba('0x3a')]));this[_0x70ba('0x10')]['noop'](_0x70ba('0x1ae'));var _0x5ae974=this[_0x70ba('0x10')][_0x70ba('0x12')](_0x70ba('0x1af'));if(!_['isEmpty'](_0x5ae974['extra'])){this[_0x70ba('0x10')][_0x70ba('0x39')]=_0x5ae974[_0x70ba('0x9d')];}if(_0xea2390['answer']==='yes'){this[_0x70ba('0x10')]['noop'](_0x70ba('0x1b0'));return this[_0x70ba('0x10')][_0x70ba('0xb5')]();}return this[_0x70ba('0x10')][_0x70ba('0xa3')](_0x70ba('0x1b1'));};AGIVertices[_0x70ba('0x15')][_0x70ba('0x1b2')]=function(_0xbf1224){logger['info'](util[_0x70ba('0x2c')](_0x70ba('0x1b3'),_0xbf1224[_0x70ba('0x3a')]));if(!this[_0x70ba('0x81')](_0xbf1224[_0x70ba('0x1b4')])){return this[_0x70ba('0x10')]['error'](_0xbf1224,_0x70ba('0x1b5'));}var _0x1a6410=this[_0x70ba('0x1a')][_0x70ba('0x6d')](this,_0xbf1224[_0x70ba('0x1b4')]);if(!this[_0x70ba('0x81')](_0x1a6410)){return this[_0x70ba('0x10')][_0x70ba('0x2f')](_0xbf1224,util[_0x70ba('0x2c')](_0x70ba('0x1b6'),_0xbf1224[_0x70ba('0x1b4')]));}if(_0x1a6410===this[_0x70ba('0x10')][_0x70ba('0x3c')]){return this['channel']['error'](_0xbf1224,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this['createSquareDetailsReport'][_0x70ba('0x6d')](this,_0xbf1224,_0x1a6410);var _0x5a41e1=this[_0x70ba('0x10')][_0x70ba('0x58')](_0x70ba('0x1b7'),util[_0x70ba('0x2c')](_0x70ba('0x1b8'),config['agi'][_0x70ba('0x1b9')]||_0x70ba('0x1ba'),_0x1a6410,this[_0x70ba('0x10')]['arg_1']));if(_0x5a41e1['result']===-0x1){return _0x5a41e1;}return this[_0x70ba('0x10')]['noop'](util[_0x70ba('0x2c')](_0x70ba('0xc0'),'AGI',_0x1a6410));};AGIVertices['prototype'][_0x70ba('0x1bb')]=function(_0x53dcf7){logger['info'](util[_0x70ba('0x2c')](_0x70ba('0x1bc'),_0x53dcf7[_0x70ba('0x3a')]));var _0x5c7ca8=this[_0x70ba('0x57')][_0x70ba('0x6d')](this,_0x53dcf7['command']);this[_0x70ba('0x38')][_0x70ba('0x6d')](this,_0x53dcf7,_0x53dcf7[_0x70ba('0x1bd')]);if(this[_0x70ba('0x81')](_0x53dcf7[_0x70ba('0xd3')])){var _0x53647d=this[_0x70ba('0x12')]['sync'](this,_0x53dcf7['variable_id']);if(_0x53647d){this['channel'][_0x70ba('0x99')](_0x53647d,_0x5c7ca8);return this['channel'][_0x70ba('0xa3')](util[_0x70ba('0x2c')](_0x70ba('0x1be'),_0x53dcf7[_0x70ba('0x1bd')],_0x53647d));}}return this[_0x70ba('0x10')][_0x70ba('0xa3')](util[_0x70ba('0x2c')](_0x70ba('0x1bf'),_0x53dcf7[_0x70ba('0x1bd')]));};AGIVertices[_0x70ba('0x15')][_0x70ba('0x1c0')]=function(_0x4936a3){logger[_0x70ba('0x30')](util[_0x70ba('0x2c')](_0x70ba('0x1c1'),_0x4936a3[_0x70ba('0x3a')]));_0x4936a3['text']=_0x4936a3[_0x70ba('0x5d')][_0x70ba('0x5a')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x70ba('0x81')](_0x4936a3[_0x70ba('0x5c')])){return this[_0x70ba('0x10')]['noop'](_0x70ba('0x1c2'));}if(!this['isConfigured'](_0x4936a3[_0x70ba('0x5d')])){return this[_0x70ba('0x10')]['noop'](_0x70ba('0xa4'));}this[_0x70ba('0x10')]['noop'](util[_0x70ba('0x2c')](_0x70ba('0x1c3'),_0x4936a3[_0x70ba('0x5d')]));var _0x8b1cbe=this[_0x70ba('0x5b')][_0x70ba('0x6d')](this,_0x4936a3);if(_0x8b1cbe){this[_0x70ba('0x10')][_0x70ba('0xa3')](util['format']('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x8b1cbe));var _0x38fa5f=this[_0x70ba('0x10')]['streamFile'](_0x8b1cbe);try{fs[_0x70ba('0xfb')](_0x8b1cbe+_0x70ba('0xfc'));}catch(_0x1af05e){logger[_0x70ba('0x2f')](_0x1af05e);}return _0x38fa5f;}return this[_0x70ba('0x10')][_0x70ba('0x2f')](_0x4936a3,'Google\x20Cloud\x20TTS\x20is\x20unreachable');};AGIVertices[_0x70ba('0x15')][_0x70ba('0x1c4')]=function(_0x1dbdca){logger[_0x70ba('0x30')](util[_0x70ba('0x2c')](_0x70ba('0x1c5'),_0x1dbdca['label']));_0x1dbdca[_0x70ba('0x5d')]=_0x1dbdca[_0x70ba('0x5d')][_0x70ba('0x5a')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x1dbdca[_0x70ba('0x5d')])){return this[_0x70ba('0x10')][_0x70ba('0xa3')](_0x70ba('0xa4'));}this[_0x70ba('0x10')][_0x70ba('0xa3')](util[_0x70ba('0x2c')](_0x70ba('0x1c6'),_0x1dbdca[_0x70ba('0x5d')]));var _0x4306e0=this[_0x70ba('0x63')][_0x70ba('0x6d')](this,_0x1dbdca);if(_0x4306e0){this['channel'][_0x70ba('0xa3')](util[_0x70ba('0x2c')](_0x70ba('0x1c7'),_0x4306e0));var _0x1d31ce=this['channel']['streamFile'](_0x4306e0);try{fs[_0x70ba('0xfb')](_0x4306e0+'.wav');}catch(_0x4a4436){logger[_0x70ba('0x2f')](_0x4a4436);}return _0x1d31ce;}return this[_0x70ba('0x10')][_0x70ba('0x2f')](_0x1dbdca,_0x70ba('0x1c8'));};AGIVertices[_0x70ba('0x15')]['unpause']=function(_0x3cc12a){logger[_0x70ba('0x30')](util[_0x70ba('0x2c')]('Enter\x20in\x20UNPAUSE\x20(%s)\x20block',_0x3cc12a[_0x70ba('0x3a')]));if(!this[_0x70ba('0x81')](_0x3cc12a[_0x70ba('0x154')])){return this[_0x70ba('0x10')][_0x70ba('0x2f')](_0x3cc12a,_0x70ba('0x155'));}logger[_0x70ba('0x30')](util[_0x70ba('0x2c')](_0x70ba('0x156'),this[_0x70ba('0x10')]['callerid'],_0x3cc12a[_0x70ba('0x154')]));var _0x57ae81=this[_0x70ba('0x51')][_0x70ba('0x6d')](this,_0x3cc12a[_0x70ba('0x154')]);if(_0x57ae81){logger[_0x70ba('0x30')](util[_0x70ba('0x2c')](_0x70ba('0x157'),this[_0x70ba('0x10')]['callerid'],_0x3cc12a[_0x70ba('0x154')]));this[_0x70ba('0x10')][_0x70ba('0xa3')](util[_0x70ba('0x2c')](_0x70ba('0x157'),this[_0x70ba('0x10')][_0x70ba('0x3d')],_0x3cc12a[_0x70ba('0x154')]));return{'code':0xc8,'result':_0x70ba('0x158')};}else{logger[_0x70ba('0x30')](util[_0x70ba('0x2c')](_0x70ba('0x159'),this[_0x70ba('0x10')][_0x70ba('0x3d')],_0x3cc12a[_0x70ba('0x154')]));this['channel'][_0x70ba('0xa3')](util[_0x70ba('0x2c')](_0x70ba('0x159'),this[_0x70ba('0x10')][_0x70ba('0x3d')],_0x3cc12a[_0x70ba('0x154')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x70ba('0x15')]['voicemail']=function(_0x11ab41){logger[_0x70ba('0x30')](util[_0x70ba('0x2c')](_0x70ba('0x1c9'),_0x11ab41[_0x70ba('0x3a')]));var _0x131c12=this[_0x70ba('0x10')]['exec'](_0x70ba('0x1ca'),[_0x11ab41[_0x70ba('0x1cb')],_0x11ab41[_0x70ba('0x74')]]);if(_0x131c12['result']===-0x1){return _0x131c12;}return this[_0x70ba('0x10')][_0x70ba('0xa3')](util['format'](_0x70ba('0xc0'),_0x70ba('0x1ca'),_0x11ab41['mailbox']));};AGIVertices[_0x70ba('0x15')][_0x70ba('0x1cc')]=function(_0x14578f){logger[_0x70ba('0x30')](util[_0x70ba('0x2c')]('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x14578f[_0x70ba('0x3a')]));if(!this[_0x70ba('0x81')](_0x14578f['variable_id'])){return this[_0x70ba('0x10')][_0x70ba('0x2f')](_0x14578f,_0x70ba('0x1ab'));}var _0x4ea88c=this[_0x70ba('0x12')][_0x70ba('0x6d')](this,_0x14578f[_0x70ba('0xd3')]);if(!_0x4ea88c){return this[_0x70ba('0x10')][_0x70ba('0x2f')](_0x14578f,_0x70ba('0xd4'));}var _0x550887=this['channel'][_0x70ba('0x12')](_0x4ea88c);return{'code':0xc8,'result':_0x550887[_0x70ba('0x9d')]?_0x550887[_0x70ba('0x9d')]:'-'};};String[_0x70ba('0x15')][_0x70ba('0x9c')]=function(_0x19ab44,_0xbb007c){return this['split'](_0x19ab44)[_0x70ba('0x1cd')](_0xbb007c);};module[_0x70ba('0x1ce')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 96bf321..1a5e2e6 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 _0x5325=['savePause','available','paused','acwTimeout','stopAcw','catch','error','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','[ACW][START]\x20%s','message','[%s][TIMER][STOP][AGENT:%s]','pauseType','saveUnpause','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','syncAgentConnect','[ACW][syncAgentConnect]\x20%s','syncAgentConnectPreview','[%s][HANGUP:UNIQUEID]','linkedid','isUndefined','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','deleteChannelAfterTimeout','isNil','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','syncBlindTransfer','[%s][BLINDTRANSFER:UNIQUEID]','transfereruniqueid','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','lodash','../ami','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','agentconnect','bind','syncHangupRequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','milliseconds','diff','prototype','updateAcw','lastPauseAt','timer','update','uniqueid','then','info','[%s][UPDATE][ACWTIME:%s]','[%s][UPDATE][ERRORS:%s]','finally','startAcw','channels','interface','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','getAgent','voicePause','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid'];(function(_0x54b447,_0x4adfc2){var _0x1e0bbd=function(_0x209b5a){while(--_0x209b5a){_0x54b447['push'](_0x54b447['shift']());}};_0x1e0bbd(++_0x4adfc2);}(_0x5325,0x88));var _0x5532=function(_0x571758,_0xf017c1){_0x571758=_0x571758-0x0;var _0x4087b4=_0x5325[_0x571758];return _0x4087b4;};'use strict';var _=require(_0x5532('0x0'));var moment=require('moment');var ami=require(_0x5532('0x1'));var logger=require(_0x5532('0x2'))(_0x5532('0x3'));var RpcUser=require(_0x5532('0x4'));var RpcVoiceAgentReport=require(_0x5532('0x5'));function Acw(_0x1c9142){this[_0x5532('0x6')]=_0x1c9142[_0x5532('0x6')];this['agents']=_0x1c9142[_0x5532('0x7')];this[_0x5532('0x8')]=_0x1c9142[_0x5532('0x8')];this['channels']={};ami['on'](_0x5532('0x9'),this['syncAgentConnect'][_0x5532('0xa')](this));ami['on']('hanguprequest',this[_0x5532('0xb')]['bind'](this));ami['on'](_0x5532('0xc'),this[_0x5532('0xd')]['bind'](this));ami['on'](_0x5532('0xe'),this[_0x5532('0xf')][_0x5532('0xa')](this));ami['on'](_0x5532('0x10'),this[_0x5532('0x11')][_0x5532('0xa')](this));ami['on'](_0x5532('0x12'),this['syncBlindTransfer'][_0x5532('0xa')](this));ami['on']('custom:agentConnectPreview',this['syncAgentConnectPreview'][_0x5532('0xa')](this));}function getDiff(_0xbc2fdc){var _0x1c5725=moment()[_0x5532('0x13')](0x0);var _0x37498a=moment(_0xbc2fdc)['milliseconds'](0x0);return _0x1c5725[_0x5532('0x14')](_0x37498a,'seconds');}Acw[_0x5532('0x15')][_0x5532('0x16')]=function(_0x5f2f94,_0x31a857){var _0x3e8a32=this;var _0x44cbfe=getDiff(_0x3e8a32['timers'][_0x5f2f94][_0x5532('0x17')]);clearTimeout(_0x3e8a32[_0x5532('0x8')][_0x5f2f94][_0x5532('0x18')]);_0x3e8a32[_0x5532('0x8')][_0x5f2f94][_0x5532('0x18')]=![];return RpcVoiceAgentReport[_0x5532('0x19')]({'acwtime':_0x44cbfe},_0x3e8a32[_0x5532('0x8')][_0x5f2f94][_0x5532('0x1a')],_0x5f2f94)[_0x5532('0x1b')](function(_0x2ba8e6){logger[_0x5532('0x1c')](_0x5532('0x1d'),_0x31a857,_0x44cbfe,_0x2ba8e6);})['catch'](function(_0x1a99ee){logger['error'](_0x5532('0x1e'),_0x31a857,_0x1a99ee);})[_0x5532('0x1f')](function(){delete _0x3e8a32[_0x5532('0x8')][_0x5f2f94];});};Acw[_0x5532('0x15')][_0x5532('0x20')]=function(_0x30be03){try{var _0x5c62e1=this;var _0x360905=this[_0x5532('0x21')][_0x30be03][_0x5532('0x22')];var _0x254bc1=this[_0x5532('0x21')][_0x30be03][_0x5532('0x23')];var _0x1617d6=this['voiceQueues'][_0x254bc1];var _0x568f3a=![];var _0x524e52=_0x5532('0x24');if(_0x1617d6[_0x5532('0x25')]&&_0x1617d6[_0x5532('0x26')][_0x5532('0x27')]){_0x568f3a=!![];_0x524e52=_0x1617d6['mandatoryDispositionPause'][_0x5532('0x27')];}return ami[_0x5532('0x28')]({'action':_0x5532('0x29'),'interface':_0x360905,'paused':!![],'reason':_0x524e52})[_0x5532('0x1b')](function(){if(_0x5c62e1[_0x5532('0x7')][_0x360905]){return RpcUser[_0x5532('0x2a')](_0x5c62e1['agents'][_0x360905]['id'])[_0x5532('0x1b')](function(_0x976076){if(!_0x976076||_0x976076[_0x5532('0x2b')]){logger['info'](_0x5532('0x2c'),_0x30be03,_0x360905,_0x254bc1);return;}logger['info'](_0x5532('0x2d'),_0x30be03,_0x360905,_0x254bc1);var _0x4bfbd1=_0x5c62e1[_0x5532('0x21')][_0x30be03][_0x5532('0x2e')]&&_0x5c62e1['channels'][_0x30be03][_0x5532('0x2f')]?_0x5c62e1['channels'][_0x30be03][_0x5532('0x2f')]:_0x30be03;return RpcUser[_0x5532('0x30')](_0x5c62e1['agents'][_0x360905],_0x524e52,_0x4bfbd1)[_0x5532('0x1b')](function(_0x5a1837){_0x5c62e1[_0x5532('0x6')][_0x254bc1][_0x5532('0x31')]-=0x1;_0x5c62e1['voiceQueues'][_0x254bc1][_0x5532('0x32')]+=0x1;return _0x5a1837;});})[_0x5532('0x1b')](function(_0x1d9186){if(_0x568f3a||!_0x1d9186){return;}_0x5c62e1[_0x5532('0x8')][_0x360905]={};logger[_0x5532('0x1c')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x30be03,_0x5c62e1['voiceQueues'][_0x254bc1][_0x5532('0x33')],_0x360905,_0x254bc1);_0x5c62e1[_0x5532('0x8')][_0x360905][_0x5532('0x18')]=setTimeout(_0x5c62e1[_0x5532('0x34')]['bind'](_0x5c62e1,_0x360905),_0x5c62e1['voiceQueues'][_0x254bc1][_0x5532('0x33')]*0x3e8);_0x5c62e1['timers'][_0x360905][_0x5532('0x17')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x5c62e1[_0x5532('0x8')][_0x360905][_0x5532('0x1a')]=_0x30be03;_0x5c62e1[_0x5532('0x8')][_0x360905][_0x5532('0x23')]=_0x254bc1;_0x5c62e1[_0x5532('0x8')][_0x360905]['updateAcw']=_0x5c62e1[_0x5532('0x16')]['bind'](_0x5c62e1,_0x360905,_0x30be03);});}})[_0x5532('0x35')](function(){logger[_0x5532('0x36')](_0x5532('0x37'),_0x30be03,_0x5c62e1[_0x5532('0x6')][_0x254bc1][_0x5532('0x33')],_0x360905,_0x254bc1);})[_0x5532('0x1f')](function(){delete _0x5c62e1[_0x5532('0x21')][_0x30be03];});}catch(_0x5c35e4){logger[_0x5532('0x36')](_0x5532('0x38'),_0x5c35e4[_0x5532('0x39')]);}};Acw[_0x5532('0x15')][_0x5532('0x34')]=function(_0x3e415f){try{var _0x20fd56=this;if(_0x20fd56[_0x5532('0x8')][_0x3e415f]){_0x20fd56['timers'][_0x3e415f][_0x5532('0x18')]=![];var _0x2b8662=_0x20fd56[_0x5532('0x8')][_0x3e415f][_0x5532('0x1a')];var _0x4d68ce=_0x20fd56[_0x5532('0x8')][_0x3e415f]['queue'];var _0x4f674c=_0x20fd56[_0x5532('0x6')][_0x4d68ce][_0x5532('0x33')];logger[_0x5532('0x1c')](_0x5532('0x3a'),_0x2b8662,_0x3e415f);RpcUser[_0x5532('0x2a')](this[_0x5532('0x7')][_0x3e415f]['id'])[_0x5532('0x1b')](function(_0x44f07c){if(_0x44f07c[_0x5532('0x3b')]===_0x5532('0x24')){return RpcUser[_0x5532('0x3c')](_0x20fd56['agents'][_0x3e415f]);}});RpcVoiceAgentReport[_0x5532('0x19')]({'acwtime':_0x4f674c,'agentacw':!![]},_0x2b8662,_0x3e415f)[_0x5532('0x1b')](function(_0x138fe4){logger['info'](_0x5532('0x1d'),_0x2b8662,_0x4f674c,_0x138fe4);})[_0x5532('0x35')](function(_0x2ab6d4){logger['error'](_0x5532('0x1e'),_0x2b8662,_0x2ab6d4);});}else{logger[_0x5532('0x36')](_0x5532('0x3d'),_0x3e415f);if(_0x20fd56['timers']){logger[_0x5532('0x1c')](_0x5532('0x3e'),JSON[_0x5532('0x3f')](_0x20fd56[_0x5532('0x8')]));}}}catch(_0x4d2638){logger[_0x5532('0x36')]('[ACW][STOP]\x20%s',_0x4d2638[_0x5532('0x39')]);}};Acw[_0x5532('0x15')][_0x5532('0x40')]=function(_0x5c052a){try{if(this[_0x5532('0x6')][_0x5c052a[_0x5532('0x23')]]&&(this['voiceQueues'][_0x5c052a[_0x5532('0x23')]][_0x5532('0x3')]||this[_0x5532('0x6')][_0x5c052a[_0x5532('0x23')]]['mandatoryDisposition'])){if(this[_0x5532('0x7')][_0x5c052a['interface']]){this[_0x5532('0x21')][_0x5c052a[_0x5532('0x1a')]]={'queue':_0x5c052a['queue'],'interface':_0x5c052a[_0x5532('0x22')],'destlinkedid':_0x5c052a[_0x5532('0x2f')]};}}}catch(_0x2f1ad6){logger['error'](_0x5532('0x41'),_0x2f1ad6['message']);}};Acw[_0x5532('0x15')][_0x5532('0x42')]=function(_0x69f2bc){try{if(this[_0x5532('0x6')][_0x69f2bc[_0x5532('0x23')]]&&(this[_0x5532('0x6')][_0x69f2bc['queue']][_0x5532('0x3')]||this[_0x5532('0x6')][_0x69f2bc['queue']][_0x5532('0x25')])){if(this[_0x5532('0x7')][_0x69f2bc[_0x5532('0x22')]]){this[_0x5532('0x21')][_0x69f2bc[_0x5532('0x1a')]]={'queue':_0x69f2bc[_0x5532('0x23')],'interface':_0x69f2bc[_0x5532('0x22')]};}}}catch(_0x531b2a){logger['error']('[ACW][syncAgentConnectPreview]\x20%s',_0x531b2a[_0x5532('0x39')]);}};Acw[_0x5532('0x15')]['syncHangupRequest']=function(_0x42f39c){try{if(this[_0x5532('0x21')][_0x42f39c[_0x5532('0x1a')]]&&_['isUndefined'](this[_0x5532('0x21')][_0x42f39c[_0x5532('0x1a')]][_0x5532('0x2e')])){logger[_0x5532('0x1c')](_0x5532('0x43'),_0x42f39c[_0x5532('0x1a')]);this['startAcw'](_0x42f39c[_0x5532('0x1a')]);}else if(this[_0x5532('0x21')][_0x42f39c[_0x5532('0x44')]]&&_[_0x5532('0x45')](this[_0x5532('0x21')][_0x42f39c[_0x5532('0x44')]][_0x5532('0x2e')])){logger[_0x5532('0x1c')](_0x5532('0x46'),_0x42f39c[_0x5532('0x44')]);this['startAcw'](_0x42f39c[_0x5532('0x44')]);}}catch(_0x5c4fb6){logger[_0x5532('0x36')](_0x5532('0x47'),_0x5c4fb6[_0x5532('0x39')]);}};Acw[_0x5532('0x15')]['syncHangup']=function(_0x57d3aa){try{if(this['channels'][_0x57d3aa[_0x5532('0x1a')]]&&this[_0x5532('0x21')][_0x57d3aa[_0x5532('0x1a')]][_0x5532('0x2e')]){logger['info'](_0x5532('0x48'),_0x57d3aa[_0x5532('0x1a')]);this['startAcw'](_0x57d3aa[_0x5532('0x1a')]);}else if(this[_0x5532('0x21')][_0x57d3aa[_0x5532('0x44')]]&&this[_0x5532('0x21')][_0x57d3aa[_0x5532('0x44')]][_0x5532('0x2e')]){logger['info'](_0x5532('0x49'),_0x57d3aa[_0x5532('0x44')]);this['startAcw'](_0x57d3aa['linkedid']);}}catch(_0x567298){logger[_0x5532('0x36')](_0x5532('0x4a'),_0x567298[_0x5532('0x39')]);}};Acw[_0x5532('0x15')][_0x5532('0x11')]=function(_0x290939){try{if(!_['isNil'](this[_0x5532('0x21')][_0x290939['transfereeuniqueid']])){this[_0x5532('0x20')](_0x290939[_0x5532('0x4b')]);if(this[_0x5532('0x21')][_0x290939[_0x5532('0x4c')]]){this[_0x5532('0x21')][_0x290939['secondtransfereruniqueid']][_0x5532('0x2e')]=!![];this[_0x5532('0x21')][_0x290939[_0x5532('0x4d')]]=this[_0x5532('0x21')][_0x290939[_0x5532('0x4c')]];this[_0x5532('0x4e')](_0x290939[_0x5532('0x4c')]);}}else if(!_[_0x5532('0x4f')](this[_0x5532('0x21')][_0x290939['transfertargetuniqueid']])){this['startAcw'](_0x290939[_0x5532('0x4d')]);if(this['channels'][_0x290939[_0x5532('0x50')]]){this['channels'][_0x290939['origtransfereruniqueid']][_0x5532('0x2e')]=!![];this[_0x5532('0x21')][_0x290939[_0x5532('0x4b')]]=this[_0x5532('0x21')][_0x290939['origtransfereruniqueid']];this['deleteChannelAfterTimeout'](_0x290939[_0x5532('0x50')]);}}}catch(_0x112d86){logger[_0x5532('0x36')](_0x5532('0x51'),_0x112d86[_0x5532('0x39')]);}};Acw['prototype'][_0x5532('0x52')]=function(_0x154b93){try{if(this[_0x5532('0x21')][_0x154b93['transfereruniqueid']]){logger[_0x5532('0x1c')](_0x5532('0x53'),JSON[_0x5532('0x3f')](_0x154b93[_0x5532('0x54')]));this[_0x5532('0x20')](_0x154b93[_0x5532('0x54')]);}else if(this['channels'][_0x154b93[_0x5532('0x55')]]){logger['info'](_0x5532('0x56'),JSON[_0x5532('0x3f')](_0x154b93[_0x5532('0x55')]));this[_0x5532('0x20')](_0x154b93['transfererlinkedid']);}}catch(_0x21d0f5){logger[_0x5532('0x36')](_0x5532('0x57'),_0x21d0f5[_0x5532('0x39')]);}};Acw[_0x5532('0x15')][_0x5532('0xf')]=function(_0x1a28da){try{if(this['voiceQueues'][_0x1a28da[_0x5532('0x23')]]&&this['voiceQueues'][_0x1a28da[_0x5532('0x23')]][_0x5532('0x58')]==='all'){if(this[_0x5532('0x7')][_0x1a28da['interface']]){logger['info']('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0x1a28da[_0x5532('0x1a')],_0x1a28da[_0x5532('0x22')],_0x1a28da[_0x5532('0x23')]);return RpcUser['savePause'](this[_0x5532('0x7')][_0x1a28da[_0x5532('0x22')]],_0x5532('0x59'),_0x1a28da[_0x5532('0x1a')]);}}}catch(_0x42950d){logger[_0x5532('0x36')](_0x5532('0x5a'),_0x42950d[_0x5532('0x39')]);}};Acw[_0x5532('0x15')][_0x5532('0x4e')]=function(_0xb833bf,_0x1ea387=0x2710){if(this[_0x5532('0x21')][_0xb833bf]){setTimeout(()=>{delete this['channels'][_0xb833bf];},_0x1ea387);}};module[_0x5532('0x5b')]=Acw; \ No newline at end of file +var _0x96b4=['prototype','lastPauseAt','timer','update','uniqueid','then','[%s][UPDATE][ACWTIME:%s]','catch','error','startAcw','interface','queue','ACW','mandatoryDispositionPause','name','Action','QueuePause','getAgent','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','available','paused','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','stopAcw','format','YYYY-MM-DD\x20HH:mm:ss','updateAcw','finally','[ACW][START]\x20%s','message','pauseType','saveUnpause','[%s][UPDATE][ERRORS:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','[ACW][syncAgentConnect]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','deleteChannelAfterTimeout','isNil','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','stringify','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','autopause','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','exports','moment','../ami','../../../config/logger','acw','../rpc/user','voiceQueues','agents','timers','channels','syncAgentConnect','bind','syncHangupRequest','hangup','syncHangup','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','custom:agentConnectPreview','milliseconds','seconds'];(function(_0x20f52d,_0x37de07){var _0x460238=function(_0x54527f){while(--_0x54527f){_0x20f52d['push'](_0x20f52d['shift']());}};_0x460238(++_0x37de07);}(_0x96b4,0xe4));var _0x496b=function(_0x347b87,_0x5380d8){_0x347b87=_0x347b87-0x0;var _0x4764ba=_0x96b4[_0x347b87];return _0x4764ba;};'use strict';var _=require('lodash');var moment=require(_0x496b('0x0'));var ami=require(_0x496b('0x1'));var logger=require(_0x496b('0x2'))(_0x496b('0x3'));var RpcUser=require(_0x496b('0x4'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x383819){this[_0x496b('0x5')]=_0x383819['voiceQueues'];this[_0x496b('0x6')]=_0x383819['agents'];this['timers']=_0x383819[_0x496b('0x7')];this[_0x496b('0x8')]={};ami['on']('agentconnect',this[_0x496b('0x9')][_0x496b('0xa')](this));ami['on']('hanguprequest',this[_0x496b('0xb')][_0x496b('0xa')](this));ami['on'](_0x496b('0xc'),this[_0x496b('0xd')]['bind'](this));ami['on']('agentringnoanswer',this[_0x496b('0xe')][_0x496b('0xa')](this));ami['on'](_0x496b('0xf'),this[_0x496b('0x10')][_0x496b('0xa')](this));ami['on']('blindtransfer',this[_0x496b('0x11')][_0x496b('0xa')](this));ami['on'](_0x496b('0x12'),this['syncAgentConnectPreview'][_0x496b('0xa')](this));}function getDiff(_0x2bb214){var _0x38fc4f=moment()[_0x496b('0x13')](0x0);var _0x320ba5=moment(_0x2bb214)[_0x496b('0x13')](0x0);return _0x38fc4f['diff'](_0x320ba5,_0x496b('0x14'));}Acw[_0x496b('0x15')]['updateAcw']=function(_0x7d9ae4,_0x1aa778){var _0x1509b5=this;var _0x239322=getDiff(_0x1509b5[_0x496b('0x7')][_0x7d9ae4][_0x496b('0x16')]);clearTimeout(_0x1509b5['timers'][_0x7d9ae4][_0x496b('0x17')]);_0x1509b5[_0x496b('0x7')][_0x7d9ae4][_0x496b('0x17')]=![];return RpcVoiceAgentReport[_0x496b('0x18')]({'acwtime':_0x239322},_0x1509b5['timers'][_0x7d9ae4][_0x496b('0x19')],_0x7d9ae4)[_0x496b('0x1a')](function(_0x18f284){logger['info'](_0x496b('0x1b'),_0x1aa778,_0x239322,_0x18f284);})[_0x496b('0x1c')](function(_0x3674d0){logger[_0x496b('0x1d')]('[%s][UPDATE][ERRORS:%s]',_0x1aa778,_0x3674d0);})['finally'](function(){delete _0x1509b5[_0x496b('0x7')][_0x7d9ae4];});};Acw[_0x496b('0x15')][_0x496b('0x1e')]=function(_0x10ea0c){try{var _0x544993=this;var _0x4f740f=this[_0x496b('0x8')][_0x10ea0c][_0x496b('0x1f')];var _0x37ec29=this['channels'][_0x10ea0c][_0x496b('0x20')];var _0x12f469=this[_0x496b('0x5')][_0x37ec29];var _0x4f02d5=![];var _0x122109=_0x496b('0x21');if(_0x12f469['mandatoryDisposition']&&_0x12f469[_0x496b('0x22')]['name']){_0x4f02d5=!![];_0x122109=_0x12f469['mandatoryDispositionPause'][_0x496b('0x23')];}return ami[_0x496b('0x24')]({'action':_0x496b('0x25'),'interface':_0x4f740f,'paused':!![],'reason':_0x122109})[_0x496b('0x1a')](function(){if(_0x544993['agents'][_0x4f740f]){return RpcUser[_0x496b('0x26')](_0x544993['agents'][_0x4f740f]['id'])['then'](function(_0x287759){if(!_0x287759||_0x287759[_0x496b('0x27')]){logger[_0x496b('0x28')]('[%s][INPAUSE][AGENT:%s][QUEUE:%s]',_0x10ea0c,_0x4f740f,_0x37ec29);return;}logger[_0x496b('0x28')](_0x496b('0x29'),_0x10ea0c,_0x4f740f,_0x37ec29);var _0x26a845=_0x544993[_0x496b('0x8')][_0x10ea0c][_0x496b('0x2a')]&&_0x544993['channels'][_0x10ea0c][_0x496b('0x2b')]?_0x544993['channels'][_0x10ea0c][_0x496b('0x2b')]:_0x10ea0c;return RpcUser[_0x496b('0x2c')](_0x544993[_0x496b('0x6')][_0x4f740f],_0x122109,_0x26a845)['then'](function(_0x246814){_0x544993['voiceQueues'][_0x37ec29][_0x496b('0x2d')]-=0x1;_0x544993[_0x496b('0x5')][_0x37ec29][_0x496b('0x2e')]+=0x1;return _0x246814;});})[_0x496b('0x1a')](function(_0x1e454d){if(_0x4f02d5||!_0x1e454d){return;}_0x544993[_0x496b('0x7')][_0x4f740f]={};logger['info'](_0x496b('0x2f'),_0x10ea0c,_0x544993[_0x496b('0x5')][_0x37ec29][_0x496b('0x30')],_0x4f740f,_0x37ec29);_0x544993[_0x496b('0x7')][_0x4f740f][_0x496b('0x17')]=setTimeout(_0x544993[_0x496b('0x31')][_0x496b('0xa')](_0x544993,_0x4f740f),_0x544993[_0x496b('0x5')][_0x37ec29][_0x496b('0x30')]*0x3e8);_0x544993[_0x496b('0x7')][_0x4f740f]['lastPauseAt']=moment()[_0x496b('0x32')](_0x496b('0x33'));_0x544993['timers'][_0x4f740f][_0x496b('0x19')]=_0x10ea0c;_0x544993[_0x496b('0x7')][_0x4f740f]['queue']=_0x37ec29;_0x544993[_0x496b('0x7')][_0x4f740f][_0x496b('0x34')]=_0x544993[_0x496b('0x34')][_0x496b('0xa')](_0x544993,_0x4f740f,_0x10ea0c);});}})[_0x496b('0x1c')](function(){logger['error'](_0x496b('0x2f'),_0x10ea0c,_0x544993['voiceQueues'][_0x37ec29][_0x496b('0x30')],_0x4f740f,_0x37ec29);})[_0x496b('0x35')](function(){delete _0x544993[_0x496b('0x8')][_0x10ea0c];});}catch(_0x372d59){logger[_0x496b('0x1d')](_0x496b('0x36'),_0x372d59[_0x496b('0x37')]);}};Acw[_0x496b('0x15')][_0x496b('0x31')]=function(_0x206d6d){try{var _0x4e628e=this;if(_0x4e628e[_0x496b('0x7')][_0x206d6d]){_0x4e628e[_0x496b('0x7')][_0x206d6d][_0x496b('0x17')]=![];var _0x2b1777=_0x4e628e[_0x496b('0x7')][_0x206d6d][_0x496b('0x19')];var _0x445555=_0x4e628e[_0x496b('0x7')][_0x206d6d][_0x496b('0x20')];var _0x4bcaf7=_0x4e628e[_0x496b('0x5')][_0x445555][_0x496b('0x30')];logger[_0x496b('0x28')]('[%s][TIMER][STOP][AGENT:%s]',_0x2b1777,_0x206d6d);RpcUser[_0x496b('0x26')](this['agents'][_0x206d6d]['id'])[_0x496b('0x1a')](function(_0x2db81f){if(_0x2db81f[_0x496b('0x38')]===_0x496b('0x21')){return RpcUser[_0x496b('0x39')](_0x4e628e[_0x496b('0x6')][_0x206d6d]);}});RpcVoiceAgentReport[_0x496b('0x18')]({'acwtime':_0x4bcaf7,'agentacw':!![]},_0x2b1777,_0x206d6d)['then'](function(_0x9e425e){logger['info'](_0x496b('0x1b'),_0x2b1777,_0x4bcaf7,_0x9e425e);})['catch'](function(_0x4eaa98){logger['error'](_0x496b('0x3a'),_0x2b1777,_0x4eaa98);});}else{logger['error'](_0x496b('0x3b'),_0x206d6d);if(_0x4e628e[_0x496b('0x7')]){logger[_0x496b('0x28')](_0x496b('0x3c'),JSON['stringify'](_0x4e628e['timers']));}}}catch(_0x4a095d){logger[_0x496b('0x1d')]('[ACW][STOP]\x20%s',_0x4a095d[_0x496b('0x37')]);}};Acw[_0x496b('0x15')][_0x496b('0x9')]=function(_0x109304){try{if(this['voiceQueues'][_0x109304[_0x496b('0x20')]]&&(this[_0x496b('0x5')][_0x109304[_0x496b('0x20')]][_0x496b('0x3')]||this[_0x496b('0x5')][_0x109304[_0x496b('0x20')]]['mandatoryDisposition'])){if(this[_0x496b('0x6')][_0x109304['interface']]){this[_0x496b('0x8')][_0x109304['uniqueid']]={'queue':_0x109304['queue'],'interface':_0x109304[_0x496b('0x1f')],'destlinkedid':_0x109304['destlinkedid']};}}}catch(_0x486037){logger[_0x496b('0x1d')](_0x496b('0x3d'),_0x486037[_0x496b('0x37')]);}};Acw[_0x496b('0x15')]['syncAgentConnectPreview']=function(_0x1d3292){try{if(this['voiceQueues'][_0x1d3292[_0x496b('0x20')]]&&(this['voiceQueues'][_0x1d3292[_0x496b('0x20')]]['acw']||this[_0x496b('0x5')][_0x1d3292[_0x496b('0x20')]]['mandatoryDisposition'])){if(this[_0x496b('0x6')][_0x1d3292[_0x496b('0x1f')]]){this[_0x496b('0x8')][_0x1d3292['uniqueid']]={'queue':_0x1d3292[_0x496b('0x20')],'interface':_0x1d3292[_0x496b('0x1f')]};}}}catch(_0x5efcbc){logger[_0x496b('0x1d')]('[ACW][syncAgentConnectPreview]\x20%s',_0x5efcbc[_0x496b('0x37')]);}};Acw[_0x496b('0x15')]['syncHangupRequest']=function(_0x1d49f7){try{if(this[_0x496b('0x8')][_0x1d49f7[_0x496b('0x19')]]&&_[_0x496b('0x3e')](this[_0x496b('0x8')][_0x1d49f7['uniqueid']][_0x496b('0x2a')])){logger[_0x496b('0x28')](_0x496b('0x3f'),_0x1d49f7[_0x496b('0x19')]);this['startAcw'](_0x1d49f7[_0x496b('0x19')]);}else if(this['channels'][_0x1d49f7['linkedid']]&&_[_0x496b('0x3e')](this['channels'][_0x1d49f7[_0x496b('0x40')]][_0x496b('0x2a')])){logger['info'](_0x496b('0x41'),_0x1d49f7[_0x496b('0x40')]);this[_0x496b('0x1e')](_0x1d49f7[_0x496b('0x40')]);}}catch(_0x81609e){logger[_0x496b('0x1d')](_0x496b('0x42'),_0x81609e[_0x496b('0x37')]);}};Acw[_0x496b('0x15')][_0x496b('0xd')]=function(_0x9c9123){try{if(this[_0x496b('0x8')][_0x9c9123[_0x496b('0x19')]]&&this[_0x496b('0x8')][_0x9c9123[_0x496b('0x19')]][_0x496b('0x2a')]){logger['info'](_0x496b('0x43'),_0x9c9123[_0x496b('0x19')]);this['startAcw'](_0x9c9123[_0x496b('0x19')]);}else if(this[_0x496b('0x8')][_0x9c9123[_0x496b('0x40')]]&&this[_0x496b('0x8')][_0x9c9123[_0x496b('0x40')]][_0x496b('0x2a')]){logger[_0x496b('0x28')](_0x496b('0x44'),_0x9c9123['linkedid']);this['startAcw'](_0x9c9123[_0x496b('0x40')]);}}catch(_0x50d35a){logger[_0x496b('0x1d')]('[ACW][syncHangup]\x20%s',_0x50d35a[_0x496b('0x37')]);}};Acw[_0x496b('0x15')][_0x496b('0x10')]=function(_0x1c24d4){try{if(!_['isNil'](this[_0x496b('0x8')][_0x1c24d4['transfereeuniqueid']])){this['startAcw'](_0x1c24d4[_0x496b('0x45')]);if(this[_0x496b('0x8')][_0x1c24d4[_0x496b('0x46')]]){this[_0x496b('0x8')][_0x1c24d4[_0x496b('0x46')]]['attended']=!![];this['channels'][_0x1c24d4[_0x496b('0x47')]]=this[_0x496b('0x8')][_0x1c24d4[_0x496b('0x46')]];this[_0x496b('0x48')](_0x1c24d4[_0x496b('0x46')]);}}else if(!_[_0x496b('0x49')](this[_0x496b('0x8')][_0x1c24d4[_0x496b('0x47')]])){this[_0x496b('0x1e')](_0x1c24d4[_0x496b('0x47')]);if(this[_0x496b('0x8')][_0x1c24d4['origtransfereruniqueid']]){this[_0x496b('0x8')][_0x1c24d4['origtransfereruniqueid']][_0x496b('0x2a')]=!![];this[_0x496b('0x8')][_0x1c24d4[_0x496b('0x45')]]=this[_0x496b('0x8')][_0x1c24d4['origtransfereruniqueid']];this[_0x496b('0x48')](_0x1c24d4['origtransfereruniqueid']);}}}catch(_0x4a513e){logger[_0x496b('0x1d')](_0x496b('0x4a'),_0x4a513e[_0x496b('0x37')]);}};Acw[_0x496b('0x15')]['syncBlindTransfer']=function(_0x3782fc){try{if(this['channels'][_0x3782fc[_0x496b('0x4b')]]){logger['info']('[%s][BLINDTRANSFER:UNIQUEID]',JSON[_0x496b('0x4c')](_0x3782fc[_0x496b('0x4b')]));this[_0x496b('0x1e')](_0x3782fc[_0x496b('0x4b')]);}else if(this[_0x496b('0x8')][_0x3782fc[_0x496b('0x4d')]]){logger[_0x496b('0x28')](_0x496b('0x4e'),JSON[_0x496b('0x4c')](_0x3782fc[_0x496b('0x4d')]));this['startAcw'](_0x3782fc[_0x496b('0x4d')]);}}catch(_0xac150d){logger['error']('[ACW][syncBlindTransfer]\x20%s',_0xac150d[_0x496b('0x37')]);}};Acw[_0x496b('0x15')]['syncAgentRingNoAnswer']=function(_0x59b397){try{if(this[_0x496b('0x5')][_0x59b397['queue']]&&this[_0x496b('0x5')][_0x59b397[_0x496b('0x20')]][_0x496b('0x4f')]==='all'){if(this[_0x496b('0x6')][_0x59b397[_0x496b('0x1f')]]){logger[_0x496b('0x28')](_0x496b('0x50'),_0x59b397[_0x496b('0x19')],_0x59b397['interface'],_0x59b397['queue']);return RpcUser[_0x496b('0x2c')](this[_0x496b('0x6')][_0x59b397[_0x496b('0x1f')]],_0x496b('0x51'),_0x59b397[_0x496b('0x19')]);}}}catch(_0x43cdb1){logger['error']('[ACW][syncAgentRingNoAnswer]\x20%s',_0x43cdb1[_0x496b('0x37')]);}};Acw[_0x496b('0x15')][_0x496b('0x48')]=function(_0x45a6e9,_0x4bc971=0x2710){if(this['channels'][_0x45a6e9]){setTimeout(()=>{delete this[_0x496b('0x8')][_0x45a6e9];},_0x4bc971);}};module[_0x496b('0x52')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 2ce9796..c740115 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 _0x60f3=['util','asterisk','keepConnected','Action','promisify','action','error','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','username','port','inspect','format','actionSipShowRegistry','sipshowregistry','actionSipPeerStatus','sippeerstatus','actionQueueSummary','actionCoreShowChannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','resolve','then','actionDeviceStateList','catch','[ami.js][fullybooted]','asterisk-manager','bluebird'];(function(_0x281e7f,_0x373eaa){var _0x395242=function(_0x5ca938){while(--_0x5ca938){_0x281e7f['push'](_0x281e7f['shift']());}};_0x395242(++_0x373eaa);}(_0x60f3,0x1de));var _0x360f=function(_0x257841,_0x389b4d){_0x257841=_0x257841-0x0;var _0x1b87ed=_0x60f3[_0x257841];return _0x1b87ed;};'use strict';var Manager=require(_0x360f('0x0'));var BPromise=require(_0x360f('0x1'));var util=require(_0x360f('0x2'));var logger=require('../../config/logger')('ami');var config=require('../../config/environment');var ami=new Manager(config['asterisk']['port'],config[_0x360f('0x3')]['ip'],config[_0x360f('0x3')]['username'],config['asterisk']['password'],!![]);ami[_0x360f('0x4')]();ami[_0x360f('0x5')]=BPromise[_0x360f('0x6')](ami[_0x360f('0x7')]);function error(_0x3a70d4){logger[_0x360f('0x8')](util['format'](_0x360f('0x9'),config[_0x360f('0x3')][_0x360f('0xa')],config[_0x360f('0x3')]['ip'],config[_0x360f('0x3')][_0x360f('0xb')],util[_0x360f('0xc')](_0x3a70d4,![],null)));}function close(){logger[_0x360f('0x8')](util[_0x360f('0xd')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config[_0x360f('0x3')][_0x360f('0xa')],config['asterisk']['ip'],config['asterisk']['port']));}ami[_0x360f('0xe')]=function(){return function(){return ami[_0x360f('0x5')]({'action':_0x360f('0xf')});};};ami['actionDeviceStateList']=function(){return function(){return ami[_0x360f('0x5')]({'action':'devicestatelist'});};};ami[_0x360f('0x10')]=function(){return function(){return ami[_0x360f('0x5')]({'action':_0x360f('0x11')});};};ami[_0x360f('0x12')]=function(){return function(){return ami[_0x360f('0x5')]({'action':'queuesummary'});};};ami[_0x360f('0x13')]=function(){return function(){return ami['Action']({'action':'coreshowchannels'});};};function connect(){logger[_0x360f('0x14')](util[_0x360f('0xd')](_0x360f('0x15'),config[_0x360f('0x3')][_0x360f('0xa')],config[_0x360f('0x3')]['ip'],config[_0x360f('0x3')]['port']));ami[_0x360f('0x16')](_0x360f('0x8'),error);ami[_0x360f('0x16')](_0x360f('0x17'),close);}ami['on'](_0x360f('0x18'),connect);ami['on']('shutdown',function(_0x5a4c4e){logger[_0x360f('0x14')](util[_0x360f('0xd')](_0x360f('0x19'),config[_0x360f('0x3')][_0x360f('0xa')],config[_0x360f('0x3')]['ip'],config[_0x360f('0x3')][_0x360f('0xb')],util['inspect'](_0x5a4c4e,![],null)));});ami['on'](_0x360f('0x1a'),function(){logger['info'](util[_0x360f('0xd')]('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config[_0x360f('0x3')]['username'],config[_0x360f('0x3')]['ip'],config['asterisk'][_0x360f('0xb')]));return Promise[_0x360f('0x1b')]()['then'](ami[_0x360f('0xe')]())[_0x360f('0x1c')](ami[_0x360f('0x1d')]())['then'](ami['actionSipPeerStatus']())[_0x360f('0x1c')](ami[_0x360f('0x12')]())[_0x360f('0x1c')](ami['actionCoreShowChannels']())[_0x360f('0x1e')](function(_0x4d34e7){logger['error'](_0x360f('0x1f'),util[_0x360f('0xc')](_0x4d34e7,{'showHidden':![],'depth':null}));});});ami[_0x360f('0x16')](_0x360f('0x8'),error);ami[_0x360f('0x16')](_0x360f('0x17'),close);module['exports']=ami; \ No newline at end of file +var _0x5b16=['connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionCoreShowChannels','catch','[ami.js][fullybooted]','exports','asterisk-manager','util','ami','../../config/environment','port','asterisk','username','password','keepConnected','Action','promisify','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','coreshowchannels','once','close'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5b16,0x1bb));var _0x65b1=function(_0x23e7c1,_0x35110c){_0x23e7c1=_0x23e7c1-0x0;var _0x1add43=_0x5b16[_0x23e7c1];return _0x1add43;};'use strict';var Manager=require(_0x65b1('0x0'));var BPromise=require('bluebird');var util=require(_0x65b1('0x1'));var logger=require('../../config/logger')(_0x65b1('0x2'));var config=require(_0x65b1('0x3'));var ami=new Manager(config['asterisk'][_0x65b1('0x4')],config[_0x65b1('0x5')]['ip'],config[_0x65b1('0x5')][_0x65b1('0x6')],config[_0x65b1('0x5')][_0x65b1('0x7')],!![]);ami[_0x65b1('0x8')]();ami[_0x65b1('0x9')]=BPromise[_0x65b1('0xa')](ami['action']);function error(_0x5cfd74){logger[_0x65b1('0xb')](util[_0x65b1('0xc')](_0x65b1('0xd'),config[_0x65b1('0x5')][_0x65b1('0x6')],config[_0x65b1('0x5')]['ip'],config[_0x65b1('0x5')][_0x65b1('0x4')],util[_0x65b1('0xe')](_0x5cfd74,![],null)));}function close(){logger[_0x65b1('0xb')](util[_0x65b1('0xc')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config[_0x65b1('0x5')][_0x65b1('0x6')],config[_0x65b1('0x5')]['ip'],config['asterisk'][_0x65b1('0x4')]));}ami[_0x65b1('0xf')]=function(){return function(){return ami[_0x65b1('0x9')]({'action':_0x65b1('0x10')});};};ami[_0x65b1('0x11')]=function(){return function(){return ami[_0x65b1('0x9')]({'action':'devicestatelist'});};};ami[_0x65b1('0x12')]=function(){return function(){return ami[_0x65b1('0x9')]({'action':_0x65b1('0x13')});};};ami[_0x65b1('0x14')]=function(){return function(){return ami[_0x65b1('0x9')]({'action':_0x65b1('0x15')});};};ami['actionCoreShowChannels']=function(){return function(){return ami[_0x65b1('0x9')]({'action':_0x65b1('0x16')});};};function connect(){logger['info'](util[_0x65b1('0xc')]('Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s',config[_0x65b1('0x5')][_0x65b1('0x6')],config['asterisk']['ip'],config[_0x65b1('0x5')]['port']));ami[_0x65b1('0x17')]('error',error);ami['once'](_0x65b1('0x18'),close);}ami['on'](_0x65b1('0x19'),connect);ami['on'](_0x65b1('0x1a'),function(_0x2eacfe){logger['info'](util['format'](_0x65b1('0x1b'),config[_0x65b1('0x5')]['username'],config[_0x65b1('0x5')]['ip'],config['asterisk'][_0x65b1('0x4')],util['inspect'](_0x2eacfe,![],null)));});ami['on'](_0x65b1('0x1c'),function(){logger['info'](util[_0x65b1('0xc')](_0x65b1('0x1d'),config[_0x65b1('0x5')]['username'],config[_0x65b1('0x5')]['ip'],config[_0x65b1('0x5')][_0x65b1('0x4')]));return Promise[_0x65b1('0x1e')]()[_0x65b1('0x1f')](ami[_0x65b1('0xf')]())['then'](ami['actionDeviceStateList']())[_0x65b1('0x1f')](ami['actionSipPeerStatus']())[_0x65b1('0x1f')](ami[_0x65b1('0x14')]())[_0x65b1('0x1f')](ami[_0x65b1('0x20')]())[_0x65b1('0x21')](function(_0x1f3d22){logger[_0x65b1('0xb')](_0x65b1('0x22'),util[_0x65b1('0xe')](_0x1f3d22,{'showHidden':![],'depth':null}));});});ami[_0x65b1('0x17')](_0x65b1('0xb'),error);ami[_0x65b1('0x17')](_0x65b1('0x18'),close);module[_0x65b1('0x23')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 2a9689c..60a731a 100644 --- a/server/services/ami/client.js +++ b/server/services/ami/client.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbdb7=['result','catch','jayson/promise','bluebird','../../config/logger','ami','client','http','Request','debug','error','message'];(function(_0x2aef86,_0x35b7be){var _0x2981bf=function(_0x360496){while(--_0x360496){_0x2aef86['push'](_0x2aef86['shift']());}};_0x2981bf(++_0x35b7be);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x4f0f27,_0x51deba){_0x4f0f27=_0x4f0f27-0x0;var _0x2ce661=_0xbdb7[_0x4f0f27];return _0x2ce661;};'use strict';var jayson=require(_0x7bdb('0x0'));var BPromise=require(_0x7bdb('0x1'));var logger=require(_0x7bdb('0x2'))(_0x7bdb('0x3'));var client=jayson[_0x7bdb('0x4')][_0x7bdb('0x5')]({'port':0x2329});client[_0x7bdb('0x6')]=function(_0x2c7e07,_0x46c068){return new BPromise(function(_0x47aec5,_0x28542c){return client['request'](_0x2c7e07,_0x46c068)['then'](function(_0xffdc86){logger[_0x7bdb('0x7')]('rpc','memberReport',_0x2c7e07,_0x46c068,_0xffdc86);if(_0xffdc86[_0x7bdb('0x8')]){logger[_0x7bdb('0x8')]('rpc','memberReport',_0x2c7e07,_0xffdc86[_0x7bdb('0x8')][_0x7bdb('0x9')],_0x46c068);return _0x28542c(_0xffdc86[_0x7bdb('0x8')][_0x7bdb('0x9')]);}else{return _0x47aec5(_0xffdc86[_0x7bdb('0xa')]);}})[_0x7bdb('0xb')](function(_0x297724){logger[_0x7bdb('0x8')]('rpc','memberReport',_0x2c7e07,_0x297724,_0x46c068);return _0x28542c(_0x297724);});});};module['exports']=client; \ No newline at end of file +var _0xcb91=['request','debug','memberReport','error','rpc','message','result','catch','exports','../../config/logger','ami','client','http'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2ff762,_0x342c0b){_0x2ff762=_0x2ff762-0x0;var _0x158b02=_0xcb91[_0x2ff762];return _0x158b02;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var client=jayson[_0x1cb9('0x2')][_0x1cb9('0x3')]({'port':0x2329});client['Request']=function(_0x8c392f,_0x2c17b8){return new BPromise(function(_0x545a34,_0x13d5fd){return client[_0x1cb9('0x4')](_0x8c392f,_0x2c17b8)['then'](function(_0x226b69){logger[_0x1cb9('0x5')]('rpc',_0x1cb9('0x6'),_0x8c392f,_0x2c17b8,_0x226b69);if(_0x226b69[_0x1cb9('0x7')]){logger['error'](_0x1cb9('0x8'),'memberReport',_0x8c392f,_0x226b69['error'][_0x1cb9('0x9')],_0x2c17b8);return _0x13d5fd(_0x226b69[_0x1cb9('0x7')][_0x1cb9('0x9')]);}else{return _0x545a34(_0x226b69[_0x1cb9('0xa')]);}})[_0x1cb9('0xb')](function(_0x50ce71){logger[_0x1cb9('0x7')](_0x1cb9('0x8'),_0x1cb9('0x6'),_0x8c392f,_0x50ce71,_0x2c17b8);return _0x13d5fd(_0x50ce71);});});};module[_0x1cb9('0xc')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index d244f98..f20e667 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 _0x155d=['[callProgressDetecting]','entity\x20is\x20undefine','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','dialNoSuchNumberRetryFrequency','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','buildNoAnswerEventPayload','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','dialNoAnswerMaxRetry','reason\x203\x20ringing\x20no\x20answer','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','Abandoned','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','agentreject','[syncAgentComplete][createHistory][20]','dialAgentRejectMaxRetry','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','outboundDropCallsDayTimeout','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','round','predictiveIntervalMinThreshold','floor','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','Drop\x20in\x20this\x20interval','avgHandleTime','getDataPredictive','startMethodPredictive','dialPredictiveInterval','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval',')\x20are\x20less\x20than\x20threshold\x20(','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','predictiveIntervalHitRate','dropRate','abandonmentRate','agentBusyFactor','busyFactor','Unknown\x20Predictive','[getDataPredictive]','check\x20failure','getDataPredictiveOld','loggedIn','outboundQueuePauses','predictiveIntervalPauses','[CatchErlangB]','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','[checkContactBlack]','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','Queue:\x20','scheduledat','voicePause','unlockContact','outboundReCallsDay','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','handleIvr','limitCalls','originated','temp','getContactDialerIvr','checkContactEmpty','NO_AVAILABLE_CONTACTS','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','Contact','checkIsBlackListIvr','[getContactCampaign2]','dialLimitQueue','not_inuse','[actionOriginate]\x20','checkIsBlackList','[actionOriginate]','tryOriginatePredictive','[handlePredictive][limitChannel]','getContactDialer','dialOrderByScheduledAt','checkContactLowerLimitOriginate','countReScheduled','[countReScheduled]\x20','[actionOriginatePredictive]','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','erlangb','----\x20Agent\x20Busy\x20Factor\x20----','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','exports','util','lodash','uuid','moment','./utils','./utils/hopper','../../../config/logger','booked','predictive','predictiveCalls','syncQueueSummary','../ami','redis','socket.io-emitter','../rpc/cmHopper','../rpc/voiceQueueRt','../rpc/setting','../rpc/interval','./models/action','./models/history','./models/final','./models/agentComplete','./models/queueCallerAbandon','./models/hangup','XCALLY_IP_AGI','127.0.0.1','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','actions','contactsId','uniqueId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','queuesSummary','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','agentcomplete','syncAgentComplete','custom:queuesummarycomplete','syncQueueSummaryComplete','syncHangup','newexten','syncNewExten','varset','queuemember','syncQueueMember','queuestatuscomplete','loopClearZombieChannels','then','debug','inspect','voice:queue:%s','name','voice_queue:save','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','---------------------------','isUndefined','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','predictiveIntervalAvgHoldtime','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','erlangCalls','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','merge','getSeconds','startPredictive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','error','stack','contactsRescheduled','message','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','contacts','state','endtime','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','stringify','pick','Interval','NULL_INTERVAL','Intervals','\x20INTERVAL_IS_NULL','isIVRCampaignActive','INACTIVE','isIVRCampaign','format','campaign:ivr:%s','campaign:save','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','DISACTIVED','active','reachable','SIP/%s','prototype','Trunk','TrunkBackup','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTimeIvr','checkIfTimeIntervals','ifTime','\x20Intervals\x20is\x20null\x20','isEmpty','EMPTY_INTERVAL','Failure','\x20Intervals\x20is\x20empty\x20','timezones','UNKNOWN_TIMEZONE','\x20Timezone\x20unknow\x20','isArray','length','push','Action','command','iftime\x20%s,%s','interval','content','indexOf','true','catch','all','some','OVERTIME_GLOBAL_INTERVAL','OVERTIME_INTERVAL','\x20Interval\x20is\x20overtime:\x20','resetActiveCalls','syncCampaigns','undefined','checkIsTrunkReachable','dialTimezone','launchHandleIvr','[syncCampaigns]','checkDialMethod','dialMethod','progressive','handlePower','dialPowerLevel','Queue','dialGlobalInterval','Dialer::ifTime()','Voice\x20Queue\x20%s\x20$s','intervalIftime','Global:\x20','Timezone:\x20','silly','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','isGlobal','AMI\x20IfTime','[ifTime][Action]','queue','uniqueid','type','ivr','decrementOriginate','[syncAgentConnect]','answertime','YYYY-MM-DD\x20HH:mm:ss','outboundAnswerCallsDay','reason','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','moveContactManagedDialer','[syncAgentComplete]','[syncQueueCallerAbandon]','droptime','responsetime','dialQueueTimeout','predictiveIntervalErlangCallsDroppedCalls','statedesc','Drop','dropreason','TIMEOUT','dialDropRetryFrequency','verifyAdditionalPhones','voiceQueue','additional','countdropretry','rescheduleContact','add','ContactId','ListId','CampaignId','[rescheduleContact][Drop]','starttime','calleridnum','[syncAgentComplete][createHistory][10]','swapAdditionalPhones','outboundDropCallsDayCallersExit','CALLEREXIT','countabandonedretry','dialAbandonedRetryFrequency','callAdditionalPhoneAfterMin','dialAbandonedMaxRetry','queueCallerAbandonCreateState','minutes','calleridname','createHistory','[syncAgentComplete][createHistory][11]','channel','actionid','rrmemory','status','paused','stateinterface','locked','isNil','idHopper','syncQueueStatusComplete','strategy','roundrobin','run','[Catch][Preview][syncQueueStatusComplete]','[syncQueueStatusComplete]','VoiceQueueId','[unlock][syncQueueStatusComplete]','queueBookedRR','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][RR][finaly]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','syncOriginateResponse','getQueue','Success','[syncOriginateResponse]','callProgressDetecting','variable','amdstatus','exten','xcally-motion-dialer','value','HANGUP','outboundAnswerAgiCallsDay','HangupInAMD','AMD','emit','buildObj','saveInDb','[syncHangupInAMD]','dialAMDActive','Machine','membername','countmachineretry','countglobal','amd','[syncAgentComplete][createHistory][0]','countbusyretry','countnoanswerretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','reason\x2019\x20machine....','dialMachineRetryFrequency','[rescheduleContact][Machine]','[syncVarSet]','[syncHangupInAMDIvr][createHistory]','countcongestionretry','countnosuchnumberretry','createStateFinal','[syncHangup]','ivrAnswerCallsDay','cause-txt','Normal\x20Clearing','[syncAgentCompleteIvr][createHistory]','[syncHangupIvr][createHistory]','dialQueueProject','AnswerAGI','AGI','[syncHangup2]','[syncAgentComplete][createHistory]','outboundUnknownCallsDay','Unknown','[syncHangup][createHistory]','running','isPreviewCampaign','statusMessage','getQueueCampaignStatusMessage','resolve','available','inUse','talking','pTalking','ACTIVE','[syncQueueSummary]','queueSummaryCountersUpdated','updateReportFromOutboundQueue','filter','online','map','Agent','user:%s','user:dialPreviewRecallReminder','checkPreviewRecallReminder','[uniqueid]','[actions]','clearZombieChannels','[clearZombieChannels]','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','emptyContact','notFound','[emptyContact]','UserId','[emptyContact][createHistory]','[syncQueueCallerAbandon]\x20[Drop]','handlePreviewRecallNotifications','actionOriginate','object','phone','originate','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','isOutboundQueue','\x22%s,%s%s,,,%s\x22','dialer','XMD-AMDINITIALSILENCE','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','XMD-AMDTOTALANALYSISTIME','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','assign','isTrunkReachable','getCallerId','callerid','dialOriginateCallerIdName','getCallerIdRandom','dialOriginateCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','extractCalleridName','variables','SIP/%s/%s%s','dialPrefix','trim','substring','dialCutDigit','from-sip','dialOriginateTimeout','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','Error','originate\x20action\x20Error','checkRetriveMax','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','[rescheduleContact][NoSuchNumber]','dialDropMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]'];(function(_0x8d931a,_0x2c5af2){var _0xeb6594=function(_0x5e8e9c){while(--_0x5e8e9c){_0x8d931a['push'](_0x8d931a['shift']());}};_0xeb6594(++_0x2c5af2);}(_0x155d,0x89));var _0xd155=function(_0x403c20,_0x4a7b99){_0x403c20=_0x403c20-0x0;var _0x2b271a=_0x155d[_0x403c20];return _0x2b271a;};'use strict';var util=require(_0xd155('0x0'));var _=require(_0xd155('0x1'));var uuid=require(_0xd155('0x2'));var moment=require(_0xd155('0x3'));var rr=require('rr');var Redis=require('ioredis');var utils=require(_0xd155('0x4'));var hopperUtils=require(_0xd155('0x5'));var ut=require('../preview/util/util');var config=require('../../../config/environment/');var logger=require('../../../config/logger')('dialer');var loggerBooked=require(_0xd155('0x6'))(_0xd155('0x7'));var loggerPredictive=require(_0xd155('0x6'))(_0xd155('0x8'));var loggerPredictiveCalls=require(_0xd155('0x6'))(_0xd155('0x9'));var loggerSyncQueueSummary=require(_0xd155('0x6'))(_0xd155('0xa'));var ami=require(_0xd155('0xb'));config[_0xd155('0xc')]=_['defaults'](config[_0xd155('0xc')],{'host':'localhost','port':0x18eb});var io=require(_0xd155('0xd'))(new Redis(config[_0xd155('0xc')]));var cmHopper=require(_0xd155('0xe'));var voiceQueueRt=require(_0xd155('0xf'));var RpcSetting=require(_0xd155('0x10'));var Interval=require(_0xd155('0x11'));var Action=require(_0xd155('0x12'));var History=require(_0xd155('0x13'));var Final=require(_0xd155('0x14'));var AgentComplete=require(_0xd155('0x15'));var QueueCallerAbandon=require(_0xd155('0x16'));var Hangup=require(_0xd155('0x17'));var ipAgi=process['env'][_0xd155('0x18')]||_0xd155('0x19');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence['prototype']['enqueue']=function(_0x464f3b){this['tail']=this['tail']?this[_0xd155('0x1a')][_0xd155('0x1b')](_0x464f3b):_0x464f3b();};function Dialer(_0x41dc3d,_0x39d2e6){this[_0xd155('0x1c')]=new Sequence();this[_0xd155('0x1d')]=_0x39d2e6;this[_0xd155('0x1e')]=_0x41dc3d[_0xd155('0x1e')];this[_0xd155('0x1f')]=_0x41dc3d['campaigns'];this[_0xd155('0x20')]=_0x41dc3d['agents'];this['trunks']=_0x41dc3d[_0xd155('0x21')];this[_0xd155('0x22')]=config[_0xd155('0x22')]||0x2;this['channels']={};this[_0xd155('0x23')]={};this[_0xd155('0x24')]={};this[_0xd155('0x25')]={};this[_0xd155('0x26')]={};this[_0xd155('0x27')]={};this[_0xd155('0x28')]={};this[_0xd155('0x29')]={};this[_0xd155('0x2a')]={};this['queueBookedRR']={};this[_0xd155('0x2b')]={};ami['on'](_0xd155('0x2c'),this[_0xd155('0x2d')][_0xd155('0x2e')](this));ami['on'](_0xd155('0x2f'),this[_0xd155('0x30')]['bind'](this));ami['on'](_0xd155('0x31'),this['syncOriginateResponse'][_0xd155('0x2e')](this));ami['on'](_0xd155('0x32'),this[_0xd155('0x33')][_0xd155('0x2e')](this));ami['on']('custom:queuesummary',this['syncQueueSummary'][_0xd155('0x2e')](this));ami['on'](_0xd155('0x34'),this[_0xd155('0x35')][_0xd155('0x2e')](this));ami['on']('hangup',this[_0xd155('0x36')][_0xd155('0x2e')](this));ami['on'](_0xd155('0x37'),this[_0xd155('0x38')][_0xd155('0x2e')](this));ami['on'](_0xd155('0x39'),this['syncVarSet']['bind'](this));ami['on'](_0xd155('0x3a'),this[_0xd155('0x3b')][_0xd155('0x2e')](this));ami['on'](_0xd155('0x3c'),this['syncQueueStatusComplete'][_0xd155('0x2e')](this));this['loopCampaigns']();this[_0xd155('0x3d')]();RpcSetting['getSettings']()[_0xd155('0x3e')](function(_0x16bec7){previewRecallmeReminderInterval=_0x16bec7['previewRecallmeReminderInterval'];});}function isNotNull(_0xaf9f39){return _0xaf9f39!==null&&!_['isUndefined'](_0xaf9f39);}function msgResponse(_0x44cc00,_0x26b705,_0x20010a){return{'action':_0x44cc00,'response':_0x26b705,'message':_0x20010a,'stack':_0x20010a};}function emit(_0x2b9cdc,_0x5f5104,_0x1622e0){io['to'](_0x2b9cdc)['emit'](_0x5f5104,_0x1622e0);}function emitOutboundVoiceQueueSummary(_0xec8c83){if(_0xec8c83['type']==='outbound'){logger[_0xd155('0x3f')]('[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:',util[_0xd155('0x40')](_0xec8c83,{'showHidden':![],'depth':null}));emit(util['format'](_0xd155('0x41'),_0xec8c83[_0xd155('0x42')]),_0xd155('0x43'),_0xec8c83);}}function checkGetDataPredictive(_0x27a090){if(isNotNull(_0x27a090)&&!_['isEmpty'](_0x27a090)){loggerPredictive[_0xd155('0x44')](_0xd155('0x45'));loggerPredictive[_0xd155('0x44')](_0xd155('0x46'),_0x27a090[_0xd155('0x47')]);loggerPredictive[_0xd155('0x44')](_0xd155('0x48'),_0x27a090[_0xd155('0x49')]);loggerPredictive[_0xd155('0x44')](_0xd155('0x4a'),_0x27a090[_0xd155('0x4b')]);loggerPredictive[_0xd155('0x44')]('Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x27a090[_0xd155('0x4c')]);loggerPredictive[_0xd155('0x44')](_0xd155('0x4d'),_0x27a090['predictiveIntervalAvgHoldtime']);loggerPredictive[_0xd155('0x44')](_0xd155('0x4e'),_0x27a090[_0xd155('0x4f')]);loggerPredictive['info'](_0xd155('0x50'));if(_0x27a090[_0xd155('0x47')]>0x0){if(!_[_0xd155('0x51')](_0x27a090['predictiveIntervalAvgTalktime'])&&_0x27a090[_0xd155('0x4f')]>0x0){return!![];}loggerPredictive[_0xd155('0x44')](_0xd155('0x52'));if(!_[_0xd155('0x51')](_0x27a090[_0xd155('0x53')])&&_0x27a090[_0xd155('0x53')]>0x0){return!![];}loggerPredictive[_0xd155('0x44')]('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}else{loggerPredictive[_0xd155('0x44')](_0xd155('0x54'));}}else{loggerPredictive[_0xd155('0x44')](_0xd155('0x55'));}return![];}function mergeDataErlangB(_0x5a38ab){return function(_0x264bf6){loggerPredictive[_0xd155('0x44')](_0xd155('0x56'));loggerPredictive['info']('Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x264bf6[_0xd155('0x57')]);loggerPredictive['info'](_0xd155('0x58'),_0x264bf6[_0xd155('0x59')]);loggerPredictive[_0xd155('0x44')](_0xd155('0x5a'),_0x264bf6[_0xd155('0x5b')]);loggerPredictive[_0xd155('0x44')](_0xd155('0x5c'),_0x264bf6[_0xd155('0x5d')]);loggerPredictive[_0xd155('0x44')](_0xd155('0x5a'),_0x264bf6[_0xd155('0x5b')]);loggerPredictive['info'](_0xd155('0x50'));_[_0xd155('0x5e')](_0x5a38ab,_0x264bf6);};}function ifInterval(_0x404d2c,_0x179d80){if(_[_0xd155('0x51')](_0x179d80)){return![];}return utils[_0xd155('0x5f')](undefined,_0x179d80)<_0x404d2c*0x3c;}function clearPredictiveAttributes(_0x306511){if(_0x306511[_0xd155('0x28')]){_0x306511[_0xd155('0x28')]=undefined;loggerPredictive[_0xd155('0x3f')](_0x306511[_0xd155('0x42')],'startProgressive\x20value\x20cleared');}if(_0x306511['startPredictive']){_0x306511['startPredictive']=undefined;loggerPredictive['debug'](_0x306511[_0xd155('0x42')],_0xd155('0x60'));}if(_0x306511['handlePredictive']){clearInterval(_0x306511[_0xd155('0x61')]);_0x306511[_0xd155('0x61')]=undefined;loggerPredictive[_0xd155('0x3f')](_0x306511['name'],_0xd155('0x62'));}}function loggerCatchPredictive(_0x270b17,_0x48105d){return function(_0x4d51f5){loggerPredictive[_0xd155('0x63')](_0x48105d[_0xd155('0x42')],_0x270b17);loggerPredictive[_0xd155('0x63')](_0x4d51f5[_0xd155('0x64')]);clearPredictiveAttributes(_0x48105d);};}function loggerCatch(_0x2fd390){return function(_0x3d921d){logger[_0xd155('0x63')](_0x2fd390,util[_0xd155('0x40')](_0x3d921d,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x506bb7){return function(_0x12a457){if(isNotNull(_0x12a457)&&isNotNull(_0x12a457[0x0])){if(_0x12a457[0x0][_0xd155('0x65')]>0x0){_0x506bb7[_0xd155('0x66')]=utils[_0xd155('0x67')][_0xd155('0x68')];logger['info'](_0xd155('0x69')+_0x506bb7[_0xd155('0x42')],_0x12a457[0x0][_0xd155('0x65')],_0xd155('0x6a'));}else{_0x506bb7[_0xd155('0x66')]=utils[_0xd155('0x67')]['NO_AVAILABLE_CONTACTS'];logger[_0xd155('0x44')]('[getContactDialer2][Empty]'+_0x506bb7[_0xd155('0x42')]);}}};}function createObjHistory(_0x22b627,_0x1327a7,_0x14b3c7,_0x27c06d,_0xbd7bdc){_0x22b627['message']=_0x14b3c7;var _0x565800=new Action(_0x22b627,_0x1327a7);var _0x23a44b=new History(_0x565800);_0x23a44b[_0xd155('0x6b')]=_0x27c06d;_0x23a44b['statedesc']=_0xbd7bdc;_0x23a44b[_0xd155('0x6c')]=_0x565800['starttime'];return _0x23a44b;}function unlockQueueStatus(_0x4ab1ce,_0x4919aa){setTimeout(function(){if(_[_0xd155('0x51')](_0x4ab1ce[_0xd155('0x6d')])){loggerBooked[_0xd155('0x63')](_0xd155('0x6e'),_0x4919aa);}_0x4ab1ce[_0xd155('0x6d')]=!![];loggerBooked[_0xd155('0x44')](_0xd155('0x6f'),_0x4919aa,JSON[_0xd155('0x70')](_[_0xd155('0x71')](_0x4ab1ce,['name',_0xd155('0x6d')])));},0x1f3);}function checkInterval(_0x4b7205){return function(){if(!isNotNull(_0x4b7205[_0xd155('0x72')])){_0x4b7205[_0xd155('0x66')]=utils[_0xd155('0x67')][_0xd155('0x73')];throw _0x4b7205[_0xd155('0x42')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x4b7205[_0xd155('0x72')][_0xd155('0x74')])){_0x4b7205[_0xd155('0x66')]=utils[_0xd155('0x67')][_0xd155('0x73')];throw _0x4b7205[_0xd155('0x42')]+_0xd155('0x75');}if(!isNotNull(_['isEmpty'](_0x4b7205[_0xd155('0x72')][_0xd155('0x74')]))){_0x4b7205[_0xd155('0x66')]=utils[_0xd155('0x67')][_0xd155('0x73')];throw _0x4b7205[_0xd155('0x42')]+_0xd155('0x75');}};}function checkIsIVRCampaignActive(_0x560062){return function(){if(!utils[_0xd155('0x76')](_0x560062)){_0x560062[_0xd155('0x66')]=utils['CAMPAIGN_STATUS'][_0xd155('0x77')];throw _0x560062['name']+'\x20NOT\x20Active';}};}function emitCampaignSummary(_0x84c73e){if(utils[_0xd155('0x78')](_0x84c73e)){emit(util[_0xd155('0x79')](_0xd155('0x7a'),_0x84c73e[_0xd155('0x42')]),_0xd155('0x7b'),_0x84c73e);}}function loggerCatchQueueSummary(_0x32f814,_0x339445){return function(_0x231421){clearPredictiveAttributes(_0x339445);emitCampaignSummary(_0x339445);loggerSyncQueueSummary[_0xd155('0x3f')](_0x32f814,util[_0xd155('0x40')](_0x231421,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x1a2fc8){if(_0x1a2fc8['sendMessageOneNotActive']){if(_0x1a2fc8['originated']===0x0){_0x1a2fc8[_0xd155('0x7c')]=![];_0x1a2fc8[_0xd155('0x66')]=utils[_0xd155('0x67')][_0xd155('0x77')];loggerSyncQueueSummary[_0xd155('0x3f')](_0xd155('0x7d'),_0x1a2fc8[_0xd155('0x42')],_0xd155('0x7e'));}else{_0x1a2fc8['message']=utils[_0xd155('0x67')][_0xd155('0x7f')];loggerSyncQueueSummary[_0xd155('0x3f')](_0xd155('0x7d'),_0x1a2fc8[_0xd155('0x42')],'is\x20deactivated');}emitCampaignSummary(_0x1a2fc8);}}function myreject(_0x4e9084){return function(_0x1f191e){return _0x4e9084(msgResponse('[ifTime][Action]','Error',JSON[_0xd155('0x70')](_0x1f191e)));};}Dialer['prototype']['isTrunkReachable']=function(_0xc9bd06){return!_[_0xd155('0x51')](_0xc9bd06)&&_0xc9bd06&&!_[_0xd155('0x51')](_0xc9bd06[_0xd155('0x42')])&&!_[_0xd155('0x51')](_0xc9bd06['active'])&&_0xc9bd06[_0xd155('0x80')]&&(this[_0xd155('0x21')][util[_0xd155('0x79')]('SIP/%s',_0xc9bd06[_0xd155('0x42')])]['status']===_0xd155('0x81')||this[_0xd155('0x21')][util[_0xd155('0x79')](_0xd155('0x82'),_0xc9bd06[_0xd155('0x42')])]['status']==='unmonitored');};Dialer[_0xd155('0x83')]['checkIsTrunkReachable']=function(_0x359a10){var _0x177e9a=this;return function(){if(!_0x177e9a['isTrunkReachable'](_0x359a10[_0xd155('0x84')])){if(!_0x177e9a['isTrunkReachable'](_0x359a10[_0xd155('0x85')])){_0x359a10['message']=utils[_0xd155('0x67')]['TRUNK_NOT_REACHABLE'];throw _0x359a10[_0xd155('0x42')]+_0xd155('0x86');}}};};Dialer[_0xd155('0x83')][_0xd155('0x87')]=function(_0x5bb63d,_0x4719a8,_0x23f365,_0x314b48){var _0x1c8c4e=this;return function(){var _0xf3a693=!![];return _0x1c8c4e[_0xd155('0x88')](_0x5bb63d,_0x4719a8,_0x23f365,_0x314b48,_0xf3a693);};};Dialer[_0xd155('0x83')][_0xd155('0x89')]=function(_0xf6bbc2,_0x2cbe5e,_0x3b8b9e,_0x1b6d72){var _0xba4744=this;return function(){var _0x404f3b=![];return _0xba4744[_0xd155('0x88')](_0xf6bbc2[_0xd155('0x74')],_0x2cbe5e,_0x3b8b9e,_0x1b6d72,_0x404f3b);};};Dialer[_0xd155('0x83')][_0xd155('0x88')]=function(_0x2282ab,_0x2d8511,_0x2687df,_0x5e44ac,_0x439e66){var _0x5c4490=[];return new Promise(function(_0x573adc,_0x555d1a){if(!isNotNull(_0x2282ab)){_0x5e44ac['message']=utils[_0xd155('0x67')]['NULL_INTERVAL'];return _0x555d1a(msgResponse(_0xd155('0x8a'),'Failure',_0x2687df+_0xd155('0x8b')));}if(_[_0xd155('0x8c')](_0x2282ab)){_0x5e44ac[_0xd155('0x66')]=utils[_0xd155('0x67')][_0xd155('0x8d')];return _0x555d1a(msgResponse('ifTime',_0xd155('0x8e'),_0x2687df+_0xd155('0x8f')));}if(_0x2d8511&&_['isUndefined'](config[_0xd155('0x90')][_0x2d8511])){_0x5e44ac['message']=utils['CAMPAIGN_STATUS'][_0xd155('0x91')];return _0x555d1a(msgResponse(_0xd155('0x8a'),_0xd155('0x8e'),_0x2687df+_0xd155('0x92')+_0x2d8511));}if(_[_0xd155('0x93')](_0x2282ab)){for(var _0x55df94=0x0;_0x55df94<_0x2282ab[_0xd155('0x94')];_0x55df94+=0x1){_0x5c4490[_0xd155('0x95')](ami[_0xd155('0x96')]({'action':_0xd155('0x97'),'command':util[_0xd155('0x79')](_0xd155('0x98'),_0x2282ab[_0x55df94][_0xd155('0x99')],!_[_0xd155('0x51')](config[_0xd155('0x90')][_0x2d8511])?_0x2d8511:'')})['then'](function(_0x383b30){return _0x383b30[_0xd155('0x9a')][_0xd155('0x9b')](_0xd155('0x9c'))>=0x0;})[_0xd155('0x9d')](myreject(_0x555d1a)));}}else{_0x5c4490[_0xd155('0x95')](ami[_0xd155('0x96')]({'action':_0xd155('0x97'),'command':util[_0xd155('0x79')](_0xd155('0x98'),_0x2282ab,!_['isUndefined'](config['timezones'][_0x2d8511])?_0x2d8511:'')})['then'](function(_0xc235b){return _0xc235b['content'][_0xd155('0x9b')]('true')>=0x0;})[_0xd155('0x9d')](myreject(_0x555d1a)));}Promise[_0xd155('0x9e')](_0x5c4490)[_0xd155('0x3e')](function(_0xe2d8da){var _0x345529=_[_0xd155('0x9f')](_0xe2d8da);if(_0x345529){return _0x573adc(_0x345529);}else{_0x5e44ac[_0xd155('0x66')]=_0x439e66?utils[_0xd155('0x67')][_0xd155('0xa0')]:utils[_0xd155('0x67')][_0xd155('0xa1')];return _0x555d1a(msgResponse('[ifTime][promiseAll]',_0xd155('0x8e'),'Global:\x20'+_0x439e66+'\x20'+_0x2687df+_0xd155('0xa2')+util[_0xd155('0x40')](_0x2282ab,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x2d8511));}})[_0xd155('0x9d')](function(_0xd544df){return _0x555d1a(msgResponse(_0xd155('0x8a'),_0xd155('0x8e'),JSON['stringify'](_0xd544df)));});});};Dialer[_0xd155('0x83')]['loopCampaigns']=function(){var _0x503713=this;return cmHopper[_0xd155('0xa3')]({'active':![]},{'where':{'active':!![]}})[_0xd155('0x3e')](function(){setInterval(function(){_0x503713[_0xd155('0xa4')]();},0x3e8);});};Dialer[_0xd155('0x83')][_0xd155('0xa4')]=function(){var _0x36b035=this;var _0x916ba0;for(var _0x540e29 in this[_0xd155('0x1f')]){if(typeof this[_0xd155('0x1f')][_0x540e29]!==_0xd155('0xa5')){_0x916ba0=this['campaigns'][_0x540e29];if(utils[_0xd155('0x78')](_0x916ba0)&&utils[_0xd155('0x76')](_0x916ba0)){_0x916ba0[_0xd155('0x7c')]=!![];Promise['resolve']()[_0xd155('0x3e')](checkIsIVRCampaignActive(_0x916ba0))['then'](checkInterval(_0x916ba0))[_0xd155('0x3e')](_0x36b035[_0xd155('0xa6')](_0x916ba0))[_0xd155('0x3e')](_0x36b035[_0xd155('0x87')](_0x916ba0['dialGlobalInterval'],_0x916ba0[_0xd155('0xa7')],_0x916ba0[_0xd155('0x42')],_0x916ba0))['then'](_0x36b035[_0xd155('0x89')](_0x916ba0[_0xd155('0x72')],_0x916ba0['dialTimezone'],_0x916ba0['name'],_0x916ba0))[_0xd155('0x3e')](_0x36b035[_0xd155('0xa8')](_0x916ba0))['catch'](loggerCatchQueueSummary(_0xd155('0xa9'),_0x916ba0));}else{notSendMessagesCampaign(_0x916ba0);}}}};Dialer[_0xd155('0x83')][_0xd155('0xaa')]=function(_0x299e05){if(_0x299e05[_0xd155('0xab')]!=='predictive'){clearPredictiveAttributes(_0x299e05);}switch(_0x299e05[_0xd155('0xab')]){case _0xd155('0xac'):this['handlePower'](_0x299e05,0x1);break;case'power':this[_0xd155('0xad')](_0x299e05,_0x299e05[_0xd155('0xae')]);break;case'predictive':this[_0xd155('0x8')](_0x299e05);break;case _0xd155('0x7'):this[_0xd155('0xad')](_0x299e05,0x1);break;default:logger[_0xd155('0x63')](_0xd155('0xaf'),_0x299e05['name'],'method\x20not\x20recognized');}};Dialer['prototype'][_0xd155('0x8a')]=function(_0x1251e9,_0x5122d9){var _0x20ce57=_0x1251e9[_0xd155('0xa7')];var _0x112d83=_0x5122d9?_0x1251e9[_0xd155('0xb0')]:_0x1251e9['Interval']['Intervals'];logger['silly'](_0xd155('0xb1'),_0x112d83,_0x20ce57,_0x1251e9[_0xd155('0x42')],util[_0xd155('0x79')](_0xd155('0xb2'),_0x1251e9['name'],_0x1251e9['id']));var _0x9c9465=null;return Interval[_0xd155('0xb3')](_0x112d83,_0x20ce57)[_0xd155('0x3e')](function(_0x3405de){if(_0x3405de===!![]){return _0x3405de;}else{_0x1251e9[_0xd155('0x66')]=_0x5122d9?utils[_0xd155('0x67')][_0xd155('0xa0')]:utils[_0xd155('0x67')][_0xd155('0xa1')];_0x9c9465=msgResponse('[ifTime][promiseAll]',_0xd155('0x8e'),_0xd155('0xb4')+_0x5122d9+'\x20'+_0x1251e9['name']+_0xd155('0xa2')+util['inspect'](_0x112d83,{'showHidden':![],'depth':null})+_0xd155('0xb5')+_0x20ce57);}if(_0x9c9465!==null){logger[_0xd155('0xb6')](_0xd155('0xb7'),_0x9c9465);_0x9c9465[_0xd155('0xb8')]=_0x5122d9;throw _0x9c9465;}})[_0xd155('0x9d')](function(_0x13b806){logger[_0xd155('0x63')](_0xd155('0xb9'),_0x13b806);throw msgResponse(_0xd155('0xba'),'Error',util[_0xd155('0x40')](_0x13b806,{'showHidden':![],'depth':null}));});};Dialer['prototype'][_0xd155('0x2d')]=function(_0x1ac093){if(this[_0xd155('0x1e')][_0x1ac093[_0xd155('0xbb')]]){if(this[_0xd155('0x25')][_0x1ac093[_0xd155('0xbc')]]&&this['uniqueId'][_0x1ac093['uniqueid']][_0xd155('0xbd')]!==_0xd155('0xbe')){utils[_0xd155('0xbf')](this[_0xd155('0x1e')][_0x1ac093[_0xd155('0xbb')]],_0xd155('0xc0'));this[_0xd155('0x25')][_0x1ac093[_0xd155('0xbc')]][_0xd155('0xc1')]=moment()['format'](_0xd155('0xc2'));}}};Dialer[_0xd155('0x83')][_0xd155('0x33')]=function(_0x52f0a3){var _0x2aa25b=this[_0xd155('0x25')][_0x52f0a3[_0xd155('0xbc')]];if(this[_0xd155('0x1e')][_0x52f0a3[_0xd155('0xbb')]]){if(_0x2aa25b&&_0x2aa25b['type']!==_0xd155('0xbe')){delete this[_0xd155('0x25')][_0x52f0a3[_0xd155('0xbc')]];this['voiceQueues'][_0x52f0a3[_0xd155('0xbb')]][_0xd155('0xc3')]+=0x1;var _0x328f5c=new AgentComplete(_0x2aa25b,_0x52f0a3);if(_0x52f0a3[_0xd155('0xc4')]==='agent'){_0x328f5c[_0xd155('0xc5')]=this[_0xd155('0x1e')][_0x52f0a3[_0xd155('0xbb')]][_0xd155('0xc6')]&&this[_0xd155('0x1e')][_0x52f0a3['queue']][_0xd155('0xc7')]?moment()[_0xd155('0x79')](_0xd155('0xc2')):undefined;}hopperUtils['createHistory'](_0x328f5c)[_0xd155('0x9d')](loggerCatch('[syncAgentComplete][createHistory]'));hopperUtils[_0xd155('0xc8')](_0x328f5c)['catch'](loggerCatch(_0xd155('0xc9')));}}};Dialer[_0xd155('0x83')][_0xd155('0x30')]=function(_0x7d4695){var _0x1d6257=this[_0xd155('0x25')][_0x7d4695[_0xd155('0xbc')]];var _0x4398a5=this;var _0x1ed0ff=![];var _0x23f9ac;var _0x2c0292;if(this[_0xd155('0x1e')][_0x7d4695[_0xd155('0xbb')]]){if(_0x1d6257&&_0x1d6257[_0xd155('0xbd')]!==_0xd155('0xbe')){delete this[_0xd155('0x25')][_0x7d4695['uniqueid']];utils[_0xd155('0xbf')](this[_0xd155('0x1e')][_0x7d4695[_0xd155('0xbb')]],_0xd155('0xca'));_0x1d6257[_0xd155('0xcb')]=moment()[_0xd155('0x79')](_0xd155('0xc2'));var _0x5555f9=new QueueCallerAbandon(_0x1d6257,_0x7d4695);if(utils[_0xd155('0x5f')](_0x1d6257['droptime'],_0x1d6257[_0xd155('0xcc')])>=_0x1d6257[_0xd155('0xcd')]){this[_0xd155('0x1e')][_0x7d4695[_0xd155('0xbb')]][_0xd155('0x4b')]+=0x1;this[_0xd155('0x1e')][_0x7d4695[_0xd155('0xbb')]]['outboundDropCallsDayTimeout']+=0x1;this['voiceQueues'][_0x7d4695[_0xd155('0xbb')]][_0xd155('0xce')]+=0x1;_0x5555f9[_0xd155('0x6b')]=0xa;_0x5555f9[_0xd155('0xcf')]=_0xd155('0xd0');_0x5555f9[_0xd155('0xd1')]=_0xd155('0xd2');_0x5555f9['agiafterat']=this['voiceQueues'][_0x7d4695[_0xd155('0xbb')]][_0xd155('0xc6')]?moment()[_0xd155('0x79')](_0xd155('0xc2')):undefined;_0x5555f9['countdropretry']+=0x1;_0x5555f9['countglobal']+=0x1;_0x23f9ac=this['voiceQueues'][_0x7d4695[_0xd155('0xbb')]][_0xd155('0xd3')];_0x2c0292=this['voiceQueues'][_0x7d4695['queue']]['callAdditionalPhoneAfterMin'];hopperUtils[_0xd155('0xd4')](_0x5555f9,_0x5555f9[_0xd155('0x6b')],_0x1d6257[_0xd155('0xd5')])['then'](function(_0x40a9cf){_0x1ed0ff=_0x40a9cf[_0xd155('0xd6')]==0x1;if(_0x5555f9[_0xd155('0xd7')]>=_0x4398a5[_0xd155('0x1e')][_0x7d4695[_0xd155('0xbb')]]['dialDropMaxRetry']){_0x4398a5['queueCallerAbandonCreateState'](_0x5555f9,_0x40a9cf[_0xd155('0xd6')]);}else{hopperUtils[_0xd155('0xd8')]({'active':![],'countdropretry':_0x5555f9[_0xd155('0xd7')],'scheduledat':moment()[_0xd155('0xd9')](_0x4398a5['voiceQueues'][_0x7d4695[_0xd155('0xbb')]][_0xd155('0xd3')],'minutes')[_0xd155('0x79')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1d6257[_0xd155('0xda')],'ListId':_0x1d6257[_0xd155('0xdb')],'VoiceQueueId':_0x1d6257['VoiceQueueId']||undefined,'CampaignId':_0x1d6257[_0xd155('0xdc')]||undefined})[_0xd155('0x9d')](loggerCatch(_0xd155('0xdd')));var _0x310c13=new History(_0x5555f9);_0x310c13['state']=0xa;_0x310c13['statedesc']=_0xd155('0xd0');_0x310c13[_0xd155('0xde')]=moment()[_0xd155('0x79')](_0xd155('0xc2'));_0x310c13[_0xd155('0x6c')]=_0x310c13[_0xd155('0xde')];_0x310c13['calleridname']=_0x5555f9['calleridname'];_0x310c13[_0xd155('0xdf')]=_0x5555f9[_0xd155('0xdf')];hopperUtils['createHistory'](_0x310c13)['catch'](loggerCatch(_0xd155('0xe0')));}})['then'](function(){if(_0x1ed0ff)hopperUtils[_0xd155('0xe1')](_0x5555f9,_0x23f9ac,_0x2c0292)[_0xd155('0x3e')](function(){return 0x1;});});}else{this[_0xd155('0x1e')][_0x7d4695['queue']]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this[_0xd155('0x1e')][_0x7d4695['queue']][_0xd155('0xe2')]+=0x1;_0x5555f9[_0xd155('0x6b')]=0xb;_0x5555f9['statedesc']='Abandoned';_0x5555f9[_0xd155('0xd1')]=_0xd155('0xe3');_0x5555f9[_0xd155('0xe4')]+=0x1;_0x5555f9['countglobal']+=0x1;_0x23f9ac=this[_0xd155('0x1e')][_0x7d4695['queue']][_0xd155('0xe5')];_0x2c0292=this[_0xd155('0x1e')][_0x7d4695['queue']][_0xd155('0xe6')];hopperUtils['verifyAdditionalPhones'](_0x5555f9,_0x5555f9[_0xd155('0x6b')],_0x1d6257[_0xd155('0xd5')])[_0xd155('0x3e')](function(_0x155605){if(_0x5555f9[_0xd155('0xe4')]>=_0x4398a5[_0xd155('0x1e')][_0x7d4695[_0xd155('0xbb')]][_0xd155('0xe7')]){_0x4398a5[_0xd155('0xe8')](_0x5555f9,_0x155605[_0xd155('0xd6')]);}else{hopperUtils[_0xd155('0xd8')]({'active':![],'countabandonedretry':_0x5555f9[_0xd155('0xe4')],'scheduledat':moment()[_0xd155('0xd9')](_0x4398a5[_0xd155('0x1e')][_0x7d4695[_0xd155('0xbb')]]['dialAbandonedRetryFrequency'],_0xd155('0xe9'))[_0xd155('0x79')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1d6257[_0xd155('0xda')],'ListId':_0x1d6257['ListId'],'VoiceQueueId':_0x1d6257['VoiceQueueId']||undefined,'CampaignId':_0x1d6257[_0xd155('0xdc')]||undefined})[_0xd155('0x9d')](loggerCatch('[rescheduleContact][Abandoned]'));var _0x37483f=new History(_0x5555f9);_0x37483f['state']=0xb;_0x37483f[_0xd155('0xcf')]='Abandoned';_0x37483f[_0xd155('0xde')]=moment()[_0xd155('0x79')](_0xd155('0xc2'));_0x37483f[_0xd155('0x6c')]=_0x37483f[_0xd155('0xde')];_0x37483f[_0xd155('0xea')]=_0x5555f9['calleridname'];_0x37483f[_0xd155('0xdf')]=_0x5555f9[_0xd155('0xdf')];hopperUtils[_0xd155('0xeb')](_0x37483f)['catch'](loggerCatch(_0xd155('0xec')));}})[_0xd155('0x3e')](function(){if(_0x1ed0ff)hopperUtils[_0xd155('0xe1')](_0x5555f9,_0x23f9ac,_0x2c0292)[_0xd155('0x3e')](function(){return 0x1;});});}}}};Dialer[_0xd155('0x83')][_0xd155('0x38')]=function(_0x2420b6){if(this[_0xd155('0x23')][_0x2420b6[_0xd155('0xbc')]]){this['actions'][_0x2420b6[_0xd155('0xbc')]][_0xd155('0xed')]=_0x2420b6[_0xd155('0xed')];}if(this[_0xd155('0x25')][_0x2420b6[_0xd155('0xbc')]]){this[_0xd155('0x25')][_0x2420b6[_0xd155('0xbc')]]['channel']=_0x2420b6[_0xd155('0xed')];}};Dialer[_0xd155('0x83')]['syncQueueMember']=function(_0x3cee2){if(!this[_0xd155('0x23')][_0x3cee2[_0xd155('0xee')]]){return;}var _0x4f1987=this[_0xd155('0x1e')][this[_0xd155('0x23')][_0x3cee2[_0xd155('0xee')]][_0xd155('0xbb')]]['strategy']||_0xd155('0xef');if(_0x4f1987==='roundrobin'){if(this[_0xd155('0x23')][_0x3cee2['actionid']]&&_['isNil'](this['actions'][_0x3cee2[_0xd155('0xee')]]['locked'])&&_0x3cee2[_0xd155('0xf0')]==='1'&&_0x3cee2[_0xd155('0xf1')]==='0'){if(this['agents'][_0x3cee2[_0xd155('0xf2')]]){if(!this['agents'][_0x3cee2[_0xd155('0xf2')]][_0xd155('0xf3')]){this['agents'][_0x3cee2[_0xd155('0xf2')]][_0xd155('0xf3')]=!![];this[_0xd155('0x23')][_0x3cee2[_0xd155('0xee')]][_0xd155('0xf3')]=!![];this[_0xd155('0x23')][_0x3cee2[_0xd155('0xee')]][_0xd155('0xf2')]=_0x3cee2[_0xd155('0xf2')];}}}}else if(_0x4f1987===_0xd155('0xef')){if(this[_0xd155('0x23')][_0x3cee2['actionid']]){if(this[_0xd155('0x20')][_0x3cee2['stateinterface']]){this['actions'][_0x3cee2[_0xd155('0xee')]][_0xd155('0xf2')]=_0x3cee2['stateinterface'];if(_[_0xd155('0xf4')](this[_0xd155('0x2a')][this['actions'][_0x3cee2[_0xd155('0xee')]]['queue']])){this[_0xd155('0x2a')][this[_0xd155('0x23')][_0x3cee2[_0xd155('0xee')]][_0xd155('0xbb')]]=[];}this['queueBooked'][this[_0xd155('0x23')][_0x3cee2['actionid']][_0xd155('0xbb')]][_0xd155('0x95')](_[_0xd155('0x5e')](_[_0xd155('0x71')](this['actions'][_0x3cee2[_0xd155('0xee')]],[_0xd155('0xf5'),_0xd155('0xf2')]),{'status':_0x3cee2[_0xd155('0xf0')],'paused':_0x3cee2[_0xd155('0xf1')]}));}}}};Dialer[_0xd155('0x83')][_0xd155('0xf6')]=function(_0x1aef48){if(!this[_0xd155('0x23')][_0x1aef48[_0xd155('0xee')]]){return;}var _0x2d85eb=this;var _0x4bc9ae=this['voiceQueues'][this[_0xd155('0x23')][_0x1aef48[_0xd155('0xee')]][_0xd155('0xbb')]];var _0x3e4080=_0x4bc9ae[_0xd155('0xf7')]||_0xd155('0xef');if(_0x3e4080===_0xd155('0xf8')){if(this['actions'][_0x1aef48['actionid']]&&this[_0xd155('0x23')][_0x1aef48[_0xd155('0xee')]][_0xd155('0xf2')]){this[_0xd155('0x1d')][_0xd155('0xf9')](this['actions'][_0x1aef48[_0xd155('0xee')]]['idHopper'],this[_0xd155('0x23')][_0x1aef48[_0xd155('0xee')]][_0xd155('0xf2')])[_0xd155('0x9d')](function(_0x302c1b){logger[_0xd155('0x63')](_0xd155('0xfa'),util[_0xd155('0x40')](_0x302c1b,{'showHidden':![],'depth':null}));})[_0xd155('0x1b')](function(){utils[_0xd155('0xbf')](_0x2d85eb[_0xd155('0x1e')][_0x2d85eb[_0xd155('0x23')][_0x1aef48[_0xd155('0xee')]]['queue']],_0xd155('0xfb'));_0x2d85eb[_0xd155('0x20')][_0x2d85eb[_0xd155('0x23')][_0x1aef48[_0xd155('0xee')]][_0xd155('0xf2')]][_0xd155('0xf3')]=![];delete _0x2d85eb[_0xd155('0x23')][_0x1aef48[_0xd155('0xee')]];unlockQueueStatus(_0x4bc9ae);});}else{utils[_0xd155('0xbf')](this[_0xd155('0x1e')][this[_0xd155('0x23')][_0x1aef48['actionid']][_0xd155('0xbb')]],_0xd155('0xfb'));hopperUtils[_0xd155('0xd8')]({'active':![],'ContactId':this[_0xd155('0x23')][_0x1aef48[_0xd155('0xee')]][_0xd155('0xda')],'ListId':this[_0xd155('0x23')][_0x1aef48[_0xd155('0xee')]][_0xd155('0xdb')],'VoiceQueueId':this['actions'][_0x1aef48[_0xd155('0xee')]][_0xd155('0xfc')]||undefined,'CampaignId':this[_0xd155('0x23')][_0x1aef48[_0xd155('0xee')]]['CampaignId']||undefined})['catch'](loggerCatch(_0xd155('0xfd')));delete this[_0xd155('0x23')][_0x1aef48[_0xd155('0xee')]];unlockQueueStatus(_0x4bc9ae);}}else if(_0x3e4080===_0xd155('0xef')){var _0x2731ee;if(this[_0xd155('0x23')][_0x1aef48[_0xd155('0xee')]]&&!_[_0xd155('0x8c')](this['queueBooked'][this[_0xd155('0x23')][_0x1aef48[_0xd155('0xee')]][_0xd155('0xbb')]])){if(this['queueBookedRR'][_0x2d85eb[_0xd155('0x23')][_0x1aef48[_0xd155('0xee')]]['queue']]){this[_0xd155('0xfe')][_0x2d85eb['actions'][_0x1aef48['actionid']][_0xd155('0xbb')]]=this['queueBookedRR'][this[_0xd155('0x23')][_0x1aef48[_0xd155('0xee')]][_0xd155('0xbb')]]?this[_0xd155('0xfe')][this[_0xd155('0x23')][_0x1aef48[_0xd155('0xee')]][_0xd155('0xbb')]]:this[_0xd155('0x2a')][this['actions'][_0x1aef48[_0xd155('0xee')]][_0xd155('0xbb')]]?this[_0xd155('0x2a')][this[_0xd155('0x23')][_0x1aef48[_0xd155('0xee')]][_0xd155('0xbb')]][_0xd155('0xff')]||0x0:0x0;}this[_0xd155('0x2a')][this[_0xd155('0x23')][_0x1aef48['actionid']][_0xd155('0xbb')]]['_rr']=this[_0xd155('0xfe')][this['actions'][_0x1aef48['actionid']][_0xd155('0xbb')]];for(var _0x95b632=0x0;_0x95b632=_0x23597c[_0xd155('0x124')]){_0x2a560a[_0xd155('0x125')](_0x2c82ed,_0x169aec,_0x5ba7eb,_0xd155('0x126'));}else{if(_0x2c82ed[_0xd155('0x11d')]>=_0x23597c[_0xd155('0x127')]){_0x2a560a['createStateFinal'](_0x2c82ed,_0x169aec,_0x5ba7eb,_0xd155('0x128'));}else{hopperUtils[_0xd155('0xd8')]({'active':![],'countmachineretry':_0x2c82ed['countmachineretry'],'scheduledat':moment()[_0xd155('0xd9')](_0x23597c[_0xd155('0x129')],_0xd155('0xe9'))[_0xd155('0x79')](_0xd155('0xc2')),'ContactId':_0x2c82ed['ContactId'],'ListId':_0x2c82ed[_0xd155('0xdb')],'VoiceQueueId':_0x2c82ed[_0xd155('0xfc')]||undefined,'CampaignId':_0x2c82ed[_0xd155('0xdc')]||undefined})['catch'](loggerCatch(_0xd155('0x12a')));_0x169aec({'reschedule':0x1});}}});}if(_0x1f6b01['type']==='ivr'&&this[_0xd155('0x1f')][_0x1f6b01[_0xd155('0xbb')]]['dialAMDActive']&&_0xbd0f12[_0xd155('0x111')]===_0xd155('0x112')){delete this['uniqueId'][_0xbd0f12['uniqueid']];utils[_0xd155('0xbf')](this['campaigns'][_0x1f6b01[_0xd155('0xbb')]],_0xd155('0x12b'));_0x11f727=new Hangup(_0x1f6b01,_0xbd0f12);_0x11f727[_0xd155('0x6b')]=0x12;_0x11f727[_0xd155('0xcf')]=_0xd155('0x114');_0x11f727['membername']='AMD';ami[_0xd155('0x116')]('custom:amd',ut['buildObj'](_0x11f727,'amd'));this['saveInDb'](_0x11f727,_0xd155('0x12c'),'[syncHangupInAMDIvr]');}if(_0x1f6b01[_0xd155('0xbd')]===_0xd155('0xbe')&&this[_0xd155('0x1f')][_0x1f6b01['queue']][_0xd155('0x11a')]&&_0xbd0f12['value']==='MACHINE'){return new Promise(function(_0x3f5e7d,_0x13265e){delete _0x2a560a[_0xd155('0x25')][_0xbd0f12[_0xd155('0xbc')]];utils[_0xd155('0xbf')](_0x2a560a[_0xd155('0x1f')][_0x1f6b01[_0xd155('0xbb')]],_0xd155('0x12b'));_0x2a560a[_0xd155('0x1f')][_0x1f6b01['queue']][_0xd155('0xc3')]+=0x1;_0x2a560a[_0xd155('0x1f')][_0x1f6b01['queue']][_0xd155('0x113')]+=0x1;var _0x5d1848=_0x2a560a[_0xd155('0x1f')][_0x1f6b01[_0xd155('0xbb')]];var _0x3f16bd=new Hangup(_0x1f6b01,_0xbd0f12);_0x3f16bd[_0xd155('0x6b')]=0x13;_0x3f16bd[_0xd155('0xcf')]='Machine';_0x3f16bd[_0xd155('0x11c')]=_0xd155('0x115');_0x3f16bd[_0xd155('0x11d')]+=0x1;_0x3f16bd[_0xd155('0x11e')]+=0x1;_0x3f16bd['amd']=!![];ami[_0xd155('0x116')]('custom:amd',ut[_0xd155('0x117')](_0x3f16bd,_0xd155('0x11f')));hopperUtils[_0xd155('0xeb')](_0x3f16bd)[_0xd155('0x9d')](loggerCatch(_0xd155('0x120')));if(_0x3f16bd[_0xd155('0x121')]+_0x3f16bd[_0xd155('0x12d')]+_0x3f16bd[_0xd155('0x122')]+_0x3f16bd[_0xd155('0x12e')]+_0x3f16bd[_0xd155('0xd7')]+_0x3f16bd[_0xd155('0xe4')]+_0x3f16bd[_0xd155('0x11d')]+_0x3f16bd[_0xd155('0x123')]>=_0x5d1848[_0xd155('0x124')]){_0x2a560a[_0xd155('0x125')](_0x3f16bd,_0x3f5e7d,_0x13265e,_0xd155('0x126'));}else{if(_0x3f16bd[_0xd155('0x11d')]>=_0x5d1848[_0xd155('0x127')]){_0x2a560a[_0xd155('0x12f')](_0x3f16bd,_0x3f5e7d,_0x13265e,_0xd155('0x128'));}else{hopperUtils[_0xd155('0xd8')]({'active':![],'countmachineretry':_0x3f16bd[_0xd155('0x11d')],'scheduledat':moment()['add'](_0x5d1848[_0xd155('0x129')],_0xd155('0xe9'))['format'](_0xd155('0xc2')),'ContactId':_0x3f16bd['ContactId'],'ListId':_0x3f16bd['ListId'],'VoiceQueueId':_0x3f16bd[_0xd155('0xfc')]||undefined,'CampaignId':_0x3f16bd[_0xd155('0xdc')]||undefined})['catch'](loggerCatch('[rescheduleContact][Machine]'));_0x3f5e7d({'reschedule':0x1});}}});}}};Dialer[_0xd155('0x83')][_0xd155('0x36')]=function(_0x51d2a4){var _0x2d35cb=this[_0xd155('0x25')][_0x51d2a4[_0xd155('0xbc')]];var _0x506cee;if(!_0x2d35cb){return;}if(_0x2d35cb['type']==='ivr'){delete this['uniqueId'][_0x51d2a4[_0xd155('0xbc')]];utils[_0xd155('0xbf')](this['campaigns'][_0x2d35cb[_0xd155('0xbb')]],_0xd155('0x130'));this['campaigns'][_0x2d35cb[_0xd155('0xbb')]][_0xd155('0x131')]+=0x1;if(_0x51d2a4[_0xd155('0x132')]===_0xd155('0x133')){const _0x3e849b=new AgentComplete(_0x2d35cb,_0x51d2a4);_0x3e849b[_0xd155('0xdc')]=this['campaigns'][_0x2d35cb[_0xd155('0xbb')]]['id'];hopperUtils[_0xd155('0xeb')](_0x3e849b)[_0xd155('0x9d')](loggerCatch(_0xd155('0x134')));hopperUtils[_0xd155('0xc8')](_0x3e849b)[_0xd155('0x9d')](loggerCatch('[syncAgentCompleteIvr]'));}else{_0x506cee=new Hangup(_0x2d35cb,_0x51d2a4);hopperUtils[_0xd155('0xeb')](_0x506cee)[_0xd155('0x9d')](loggerCatch(_0xd155('0x135')));hopperUtils[_0xd155('0xc8')](_0x506cee)[_0xd155('0x9d')](loggerCatch('[syncHangupIvr]'));}}else{if(isNotNull(this['voiceQueues'][_0x2d35cb['queue']][_0xd155('0x136')])){delete this[_0xd155('0x25')][_0x51d2a4[_0xd155('0xbc')]];utils[_0xd155('0xbf')](this[_0xd155('0x1e')][_0x2d35cb[_0xd155('0xbb')]],_0xd155('0x130'));this['voiceQueues'][_0x2d35cb['queue']][_0xd155('0xc3')]+=0x1;this[_0xd155('0x1e')][_0x2d35cb[_0xd155('0xbb')]][_0xd155('0x113')]+=0x1;_0x506cee=new Hangup(_0x2d35cb,_0x51d2a4);_0x506cee['state']=0x10;_0x506cee[_0xd155('0xcf')]=_0xd155('0x137');_0x506cee['membername']=_0xd155('0x138');hopperUtils['createHistory'](_0x506cee)[_0xd155('0x9d')](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils[_0xd155('0xc8')](_0x506cee)[_0xd155('0x9d')](loggerCatch('[syncHangupIvr]'));}else{delete this[_0xd155('0x25')][_0x51d2a4[_0xd155('0xbc')]];utils[_0xd155('0xbf')](this[_0xd155('0x1e')][_0x2d35cb['queue']],_0xd155('0x139'));if(_0x51d2a4[_0xd155('0x132')]===_0xd155('0x133')){this[_0xd155('0x1e')][_0x2d35cb[_0xd155('0xbb')]][_0xd155('0xc3')]+=0x1;const _0x3828bf=new AgentComplete(_0x2d35cb,_0x51d2a4);_0x3828bf[_0xd155('0xfc')]=this[_0xd155('0x1e')][_0x2d35cb[_0xd155('0xbb')]]['id'];hopperUtils[_0xd155('0xeb')](_0x3828bf)[_0xd155('0x9d')](loggerCatch(_0xd155('0x13a')));hopperUtils[_0xd155('0xc8')](_0x3828bf)[_0xd155('0x9d')](loggerCatch(_0xd155('0xc9')));}else{this[_0xd155('0x1e')][_0x2d35cb[_0xd155('0xbb')]][_0xd155('0x13b')]+=0x1;_0x506cee=new Hangup(_0x2d35cb,_0x51d2a4);_0x506cee[_0xd155('0x6b')]=0xc;_0x506cee[_0xd155('0xcf')]=_0x51d2a4['cause-txt'];_0x506cee[_0xd155('0x11c')]=_0xd155('0x13c');hopperUtils[_0xd155('0xeb')](_0x506cee)[_0xd155('0x9d')](loggerCatch(_0xd155('0x13d')));hopperUtils[_0xd155('0xc8')](_0x506cee)['catch'](loggerCatch(_0xd155('0x130')));}}}};Dialer[_0xd155('0x83')][_0xd155('0xa')]=function(_0x459163){var _0x299898=this;if(!_0x299898[_0xd155('0x2b')][_0x459163[_0xd155('0x42')]]){_0x299898['queuesSummary'][_0x459163['name']]={'running':![]};}else if(_0x299898[_0xd155('0x2b')][_0x459163[_0xd155('0x42')]][_0xd155('0x13e')]===!![]){return;}else if(_0x299898['queuesSummary'][_0x459163['name']][_0xd155('0x13e')]===![]){_0x299898[_0xd155('0x2b')][_0x459163[_0xd155('0x42')]][_0xd155('0x13e')]=!![];}var _0x3c6d6f=_0x299898[_0xd155('0x1e')][_0x459163[_0xd155('0x42')]];var _0x55f1a5=_0x3c6d6f[_0xd155('0x66')]!==utils[_0xd155('0x67')][_0xd155('0x77')];var _0x147a58=utils[_0xd155('0x13f')](_0x3c6d6f);_0x3c6d6f[_0xd155('0x140')]=utils[_0xd155('0x141')](_0x3c6d6f,_0x299898['trunks']);Promise[_0xd155('0x142')]()[_0xd155('0x3e')](function(){if(_0x3c6d6f['statusMessage']===utils[_0xd155('0x67')]['INACTIVE']){if(_0x55f1a5){clearPredictiveAttributes(_0x3c6d6f);_0x459163[_0xd155('0x27')]=undefined;_0x459163[_0xd155('0x28')]=undefined;}if(_0x3c6d6f[_0xd155('0x140')]===utils[_0xd155('0x67')][_0xd155('0x77')]){_0x459163[_0xd155('0x143')]=0x0;_0x459163['paused']=0x0;_0x459163[_0xd155('0x144')]=0x0;_0x459163[_0xd155('0x145')]=0x0;_0x459163[_0xd155('0x146')]=0x0;}}else if(_0x3c6d6f['statusMessage']===utils['CAMPAIGN_STATUS'][_0xd155('0x147')]&&!_0x147a58){return _0x299898[_0xd155('0x8a')](_0x3c6d6f,!![])[_0xd155('0x3e')](function(){return _0x299898['ifTime'](_0x3c6d6f,![]);})['then'](function(){return _0x299898[_0xd155('0xaa')](_0x3c6d6f);})['catch'](function(_0x3717d8){loggerSyncQueueSummary['debug'](_0xd155('0x148'),util[_0xd155('0x40')](_0x3717d8,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x3c6d6f);});}else{clearPredictiveAttributes(_0x3c6d6f);}})[_0xd155('0x3e')](function(){var _0x35f77e=_0x459163['compareToOutboundQueue'](_0x3c6d6f);if(_0x35f77e||_0x3c6d6f['queueSummaryCountersUpdated']){_0x3c6d6f[_0xd155('0x149')]=![];_0x459163[_0xd155('0x14a')](_0x3c6d6f);Object['assign'](_0x3c6d6f,_0x459163);emitOutboundVoiceQueueSummary(_0x459163);}_0x299898[_0xd155('0x2b')][_0x3c6d6f['name']][_0xd155('0x13e')]=![];})[_0xd155('0x9d')](function(_0x4c28a2){logger[_0xd155('0x63')](_0xd155('0x148'),util['inspect'](_0x4c28a2,{'showHidden':![],'depth':null}));_0x299898['queuesSummary'][_0x3c6d6f['name']][_0xd155('0x13e')]=![];});};Dialer[_0xd155('0x83')][_0xd155('0x35')]=_['throttle'](function(){var _0x332e60=_[_0xd155('0x14b')](this[_0xd155('0x1e')],function(_0xea64ba){return _0xea64ba['dialPreviewRecallmeReminder'];});var _0x599266=_['filter'](this[_0xd155('0x20')],function(_0x44535d){return _0x44535d[_0xd155('0x14c')]&&_0x44535d['status']==='reachable';});if(_0x332e60[_0xd155('0x94')]>0x0&&_0x599266[_0xd155('0x94')]>0x0){return Promise[_0xd155('0x142')]()[_0xd155('0x3e')](cmHopper['handlePreviewRecallNotifications'](_['map'](_0x332e60,'id'),previewRecallmeReminderInterval,_[_0xd155('0x14d')](_0x599266,'id')))['then'](function(_0x25e54a){for(var _0x179f32=0x0;_0x179f32<_0x25e54a[_0xd155('0x94')];_0x179f32++){var _0xdd1d05=_0x25e54a[_0x179f32][_0xd155('0x14e')][_0xd155('0x42')];if(_0xdd1d05)io['to'](util['format'](_0xd155('0x14f'),_0xdd1d05))[_0xd155('0x116')](_0xd155('0x150'),{'hopper':_0x25e54a[_0x179f32]});}})[_0xd155('0x9d')](function(_0x5198b6){logger['error'](_0xd155('0x151'),_0x5198b6);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0xd155('0x83')]['loopClearZombieChannels']=function(){var _0x31b52c=this;setInterval(function(){_0x31b52c['clearZombieChannels'](_0x31b52c['uniqueId'],_0xd155('0x152'));_0x31b52c['clearZombieChannels'](_0x31b52c[_0xd155('0x23')],_0xd155('0x153'));},0x32c8);};Dialer[_0xd155('0x83')][_0xd155('0x154')]=function(_0x257c8f,_0x4f06ab){var _0x27b878=this;for(var _0x549381 in _0x257c8f){if(typeof _0x257c8f[_0x549381]!==_0xd155('0xa5')){this[_0xd155('0x1c')]['enqueue'](function(){if(!_[_0xd155('0xf4')](_0x257c8f[_0x549381])){return ami['Action']({'action':'status','channel':_0x257c8f[_0x549381][_0xd155('0xed')]})[_0xd155('0x9d')](function(_0x5067a3){if(_0x5067a3[_0xd155('0x66')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x257c8f[_0x549381]&&_0x257c8f[_0x549381][_0xd155('0xbd')]!==_0xd155('0xbe')){utils['decrementOriginate'](_0x27b878[_0xd155('0x1e')][_0x257c8f[_0x549381]['queue']],_0xd155('0x155'));logger[_0xd155('0x63')](_0xd155('0x156'),_0x4f06ab,_0x549381,_0x257c8f[_0x549381][_0xd155('0xbb')]);delete _0x257c8f[_0x549381];}if(_0x257c8f[_0x549381]&&_0x257c8f[_0x549381][_0xd155('0xbd')]===_0xd155('0xbe')){utils['decrementOriginate'](_0x27b878[_0xd155('0x1f')][_0x257c8f[_0x549381]['queue']],_0xd155('0x155'));logger['error'](_0xd155('0x157'),_0x4f06ab,_0x549381,_0x257c8f[_0x549381][_0xd155('0xbb')]);delete _0x257c8f[_0x549381];}},0x2328);}});}});}}};Dialer[_0xd155('0x83')][_0xd155('0x158')]=function(_0x25d3ea){return Promise[_0xd155('0x142')]()[_0xd155('0x3e')](voiceQueueRt[_0xd155('0x158')](_0x25d3ea))[_0xd155('0x9d')](loggerCatch(_0xd155('0x159')));};Dialer['prototype'][_0xd155('0x15a')]=function(_0x5eba10,_0x327150,_0x1bb51d){var _0x1a966f={'state':0x19,'statedesc':_0xd155('0x15b')};utils[_0xd155('0xbf')](_0x327150,_0xd155('0x15c')+_0x5eba10);this[_0xd155('0x118')](_[_0xd155('0x5e')](_0x1a966f,_[_0xd155('0x71')](_0x1bb51d,[_0xd155('0xda'),_0xd155('0xdb'),_0xd155('0x15d'),_0xd155('0xfc'),_0xd155('0xdc')])),_0xd155('0x15e'),'[emptyContact]');logger[_0xd155('0x63')](_0x5eba10);};Dialer[_0xd155('0x83')][_0xd155('0x118')]=function(_0x3388c6,_0x22f04e,_0x20cec7){hopperUtils[_0xd155('0xeb')](_0x3388c6)['catch'](loggerCatch(_0x22f04e));hopperUtils[_0xd155('0xc8')](_0x3388c6)[_0xd155('0x9d')](loggerCatch(_0x20cec7));};Dialer[_0xd155('0x83')][_0xd155('0xe8')]=function(_0x3774d6,_0x38f01f){hopperUtils['createHistory'](_0x3774d6)[_0xd155('0x9d')](loggerCatch(_0xd155('0x13a')));if(_0x38f01f==0x0){hopperUtils[_0xd155('0xc8')](_0x3774d6)[_0xd155('0x9d')](loggerCatch(_0xd155('0x15f')));}};Dialer[_0xd155('0x83')][_0xd155('0x151')]=function(_0x385a9d){return Promise[_0xd155('0x142')]()['then'](cmHopper[_0xd155('0x160')](_0x385a9d['id'],previewRecallmeReminderInterval))['then'](function(_0x377e9e){for(var _0x2272b6=0x0;_0x2272b6<_0x377e9e[_0xd155('0x94')];_0x2272b6++){var _0x2a98e8=_0x377e9e[_0x2272b6][_0xd155('0x14e')][_0xd155('0x42')];if(_0x2a98e8)io['to'](util[_0xd155('0x79')](_0xd155('0x14f'),_0x2a98e8))[_0xd155('0x116')](_0xd155('0x150'),{'hopper':_0x377e9e[_0x2272b6]});}})[_0xd155('0x9d')](function(){});};Dialer[_0xd155('0x83')][_0xd155('0xa8')]=function(_0x34ba3a){var _0x55bba1=this;return function(){_0x55bba1['handleIvr'](_0x34ba3a);};};Dialer[_0xd155('0x83')][_0xd155('0x161')]=function(_0x3add51,_0x3821d7){var _0x2b3093=this;var _0x81828d=uuid['v4']();this['actions'][_0x81828d]=new Action(_0x3add51,_0x3821d7,_0x81828d);return new Promise(function(_0x13e801,_0x4aa012){if(_[_0xd155('0x51')](_0x3add51)&&typeof _0x3add51!==_0xd155('0x162')){return _0x4aa012(msgResponse('originate',_0xd155('0x8e'),'voiceQueue\x20is\x20undefine'));}if(_[_0xd155('0x51')](_0x3821d7[_0xd155('0x163')])||_0x3821d7['phone']===null){return _0x4aa012(msgResponse(_0xd155('0x164'),'Failure',_0xd155('0x165')));}var _0x1b8491={'XMD-CALLERID':_0x2b3093[_0xd155('0x23')][_0x81828d][_0xd155('0x166')](),'XMD-AGI':_0x3add51[_0xd155('0x136')]?util[_0xd155('0x79')]('\x22agi://%s/square,%s\x22',ipAgi,_0x3add51['dialQueueProject']):'NONE','XMD-AGIAFTER':_0x3add51[_0xd155('0xc6')]?util[_0xd155('0x79')](_0xd155('0x167'),ipAgi,_0x3add51[_0xd155('0xc6')]):_0xd155('0x168'),'XMD-QUEUE':utils[_0xd155('0x169')](_0x3add51)?util[_0xd155('0x79')](_0xd155('0x16a'),_0x3add51['name'],_0x3add51['dialQueueOptions']||'',_0x3add51[_0xd155('0xc7')]?'c':'',_0x3add51['dialQueueTimeout']||0x3):'NONE','XMD-CONTACTID':_0x3821d7[_0xd155('0xda')],'XMD-CDRTYPE':_0xd155('0x16b'),'CALLERID(all)':_0x2b3093[_0xd155('0x23')][_0x81828d][_0xd155('0x166')](),'XMD-AMD':_0x3add51[_0xd155('0x11a')]?_0xd155('0x147'):_0xd155('0x168'),'XMD-DESTINATION':_0xd155('0x110')};if(_0x3add51[_0xd155('0x11a')]){_0x1b8491[_0xd155('0x16c')]=_0x3add51['dialAMDInitialSilence']||0x9c4;_0x1b8491[_0xd155('0x16d')]=_0x3add51[_0xd155('0x16e')]||0x5dc;_0x1b8491[_0xd155('0x16f')]=_0x3add51['dialAMDAfterGreetingSilence']||0x320;_0x1b8491[_0xd155('0x170')]=_0x3add51['dialAMDTotalAnalysisTime']||0x1388;_0x1b8491[_0xd155('0x171')]=_0x3add51[_0xd155('0x172')]||0x64;_0x1b8491[_0xd155('0x173')]=_0x3add51[_0xd155('0x174')]||0x32;_0x1b8491[_0xd155('0x175')]=_0x3add51[_0xd155('0x176')]||0x3;_0x1b8491[_0xd155('0x177')]=_0x3add51[_0xd155('0x178')]||0x100;_0x1b8491[_0xd155('0x179')]=_0x3add51['dialAMDMaximumWordLength']||0x1388;}if(utils[_0xd155('0x169')](_0x3add51)){_0x1b8491[_0xd155('0x17a')]=_0x3821d7[_0xd155('0xfc')];}else{_0x1b8491[_0xd155('0x17b')]=_0x3821d7[_0xd155('0xdc')];}var _0x251eec=utils['setXMDContactVariables'](_0x3821d7['Contact']);Object[_0xd155('0x17c')](_0x1b8491,_0x251eec);var _0x37d0d8=_0x2b3093[_0xd155('0x17d')](_0x3add51[_0xd155('0x84')])?utils[_0xd155('0x17e')](_0x3add51[_0xd155('0x84')][_0xd155('0x17f')],_0x3add51[_0xd155('0x180')],_0x3add51['dialRandomLastDigitCallerIdNumber']>0x0?utils[_0xd155('0x181')](_0x3add51[_0xd155('0x182')],_0x3add51['dialRandomLastDigitCallerIdNumber']):_0x3add51[_0xd155('0x182')]):utils[_0xd155('0x17e')](_[_0xd155('0xf4')](_0x3add51[_0xd155('0x85')])?_0x3add51[_0xd155('0x84')][_0xd155('0x17f')]:_0x3add51[_0xd155('0x85')]['callerid'],_0x3add51['dialOriginateCallerIdName'],_0x3add51['dialRandomLastDigitCallerIdNumber']>0x0?utils[_0xd155('0x181')](_0x3add51[_0xd155('0x182')],_0x3add51['dialRandomLastDigitCallerIdNumber']):_0x3add51[_0xd155('0x182')]);if(_0x37d0d8){_0x1b8491[_0xd155('0x183')]=_0x2b3093[_0xd155('0x23')][_0x81828d][_0xd155('0x184')]=utils[_0xd155('0x185')](_0x37d0d8);_0x1b8491['XMD-ORIGINATECALLERIDNUM']=_0x3821d7[_0xd155('0x163')];}_0x3add51[_0xd155('0x186')]=_0x1b8491;return ami[_0xd155('0x96')]({'actionid':_0x81828d,'action':_0xd155('0x164'),'channel':_0x2b3093[_0xd155('0x17d')](_0x3add51[_0xd155('0x84')])?util[_0xd155('0x79')](_0xd155('0x187'),_0x3add51[_0xd155('0x84')][_0xd155('0x42')],isNotNull(_0x3add51[_0xd155('0x188')])?_0x3add51['dialPrefix'][_0xd155('0x189')]()||'':'',_0x3add51['dialCutDigit']>0x0?_0x3821d7[_0xd155('0x163')][_0xd155('0x18a')](_0x3add51[_0xd155('0x18b')]):_0x3821d7[_0xd155('0x163')]):util['format'](_0xd155('0x187'),_[_0xd155('0xf4')](_0x3add51[_0xd155('0x85')])?_0x3add51[_0xd155('0x84')]['name']:_0x3add51[_0xd155('0x85')][_0xd155('0x42')],isNotNull(_0x3add51['dialPrefix'])?_0x3add51[_0xd155('0x188')]['trim']()||'':'',_0x3add51[_0xd155('0x18b')]>0x0?_0x3821d7[_0xd155('0x163')]['substring'](_0x3add51[_0xd155('0x18b')]):_0x3821d7[_0xd155('0x163')]),'callerid':_0x37d0d8,'Exten':_0xd155('0x110'),'Context':_0xd155('0x18c'),'Priority':'1','variable':_0x1b8491,'timeout':(_0x3add51[_0xd155('0x18d')]||0x1e)*0x3e8,'async':!![],'channelid':_0x81828d})[_0xd155('0x3e')](function(_0x2eceb3){return _0x13e801(_0x2eceb3);})['catch'](function(_0x328dcc){_0x3add51[_0xd155('0x18e')]+=0x1;var _0x5d1da3=new History(_0x2b3093['actions'][_0x81828d]);logger[_0xd155('0x63')](util['format'](_0xd155('0x18f'),JSON['stringify'](_0x328dcc)));_0x5d1da3[_0xd155('0x6b')]=0xe;_0x5d1da3[_0xd155('0xcf')]=_0xd155('0x190');_0x5d1da3['starttime']=moment()['format'](_0xd155('0xc2'));_0x5d1da3[_0xd155('0x6c')]=_0x5d1da3[_0xd155('0xde')];hopperUtils[_0xd155('0xeb')](_0x5d1da3)['catch'](loggerCatch(_0xd155('0x191')));_0x2b3093[_0xd155('0xc8')](_0x5d1da3)[_0xd155('0x9d')](loggerCatch(_0xd155('0x191')))[_0xd155('0x1b')](function(){delete _0x2b3093[_0xd155('0x23')][_0x81828d];return _0x4aa012(msgResponse(_0xd155('0x164'),_0xd155('0x192'),_0xd155('0x193')));});});});};Dialer[_0xd155('0x83')][_0xd155('0x194')]=function(_0x43f50d,_0x23a87e,_0x21bcc6){var _0x50ed77=new History(_0x23a87e);if(_0x50ed77[_0xd155('0x121')]+_0x50ed77[_0xd155('0x12d')]+_0x50ed77[_0xd155('0x122')]+_0x50ed77[_0xd155('0x12e')]+_0x50ed77[_0xd155('0xd7')]+_0x50ed77[_0xd155('0xe4')]+_0x50ed77[_0xd155('0x11d')]+_0x50ed77['countagentrejectretry']>=_0x21bcc6['dialGlobalMaxRetry']-0x1){return!![];}switch(_0x43f50d){case 0x3:if(_0x50ed77['countnoanswerretry']>=_0x21bcc6['dialNoAnswerMaxRetry']-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countnoanswerretry':_0x50ed77[_0xd155('0x122')]+=0x1,'scheduledat':moment()[_0xd155('0xd9')](_0x21bcc6[_0xd155('0x195')],_0xd155('0xe9'))[_0xd155('0x79')](_0xd155('0xc2')),'ContactId':_0x50ed77[_0xd155('0xda')],'ListId':_0x50ed77[_0xd155('0xdb')],'VoiceQueueId':_0x50ed77[_0xd155('0xfc')]||undefined,'CampaignId':_0x50ed77[_0xd155('0xdc')]||undefined})[_0xd155('0x9d')](loggerCatch(_0xd155('0x196')));break;case 0x5:if(_0x50ed77[_0xd155('0x121')]>=_0x21bcc6[_0xd155('0x197')]-0x1){return!![];}hopperUtils[_0xd155('0xd8')]({'active':![],'countbusyretry':_0x50ed77['countbusyretry']+=0x1,'scheduledat':moment()[_0xd155('0xd9')](_0x21bcc6[_0xd155('0x198')],_0xd155('0xe9'))['format'](_0xd155('0xc2')),'ContactId':_0x50ed77[_0xd155('0xda')],'ListId':_0x50ed77[_0xd155('0xdb')],'VoiceQueueId':_0x50ed77[_0xd155('0xfc')]||undefined,'CampaignId':_0x50ed77[_0xd155('0xdc')]||undefined})['catch'](loggerCatch('[rescheduleContact]\x20[Busy]'));break;case 0x8:if(_0x50ed77[_0xd155('0x12d')]>=_0x21bcc6[_0xd155('0x199')]-0x1){return!![];}hopperUtils[_0xd155('0xd8')]({'active':![],'countcongestionretry':_0x50ed77['countcongestionretry']+=0x1,'scheduledat':moment()[_0xd155('0xd9')](_0x21bcc6[_0xd155('0x19a')],_0xd155('0xe9'))[_0xd155('0x79')](_0xd155('0xc2')),'ContactId':_0x50ed77[_0xd155('0xda')],'ListId':_0x50ed77[_0xd155('0xdb')],'VoiceQueueId':_0x50ed77[_0xd155('0xfc')]||undefined,'CampaignId':_0x50ed77[_0xd155('0xdc')]||undefined})[_0xd155('0x9d')](loggerCatch(_0xd155('0x19b')));break;case 0x0:if(_0x50ed77['countnosuchnumberretry']>=_0x21bcc6[_0xd155('0x19c')]-0x1){return!![];}else{hopperUtils[_0xd155('0xd8')]({'active':![],'countnosuchnumberretry':_0x50ed77[_0xd155('0x12e')]+=0x1,'scheduledat':moment()[_0xd155('0xd9')](_0x21bcc6['dialNoSuchNumberRetryFrequency'],_0xd155('0xe9'))['format'](_0xd155('0xc2')),'ContactId':_0x50ed77[_0xd155('0xda')],'ListId':_0x50ed77[_0xd155('0xdb')],'VoiceQueueId':_0x50ed77['VoiceQueueId']||undefined,'CampaignId':_0x50ed77[_0xd155('0xdc')]||undefined})[_0xd155('0x9d')](loggerCatch(_0xd155('0x19d')));}break;case 0xa:if(_0x50ed77[_0xd155('0xd7')]>=_0x21bcc6[_0xd155('0x19e')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countdropretry':_0x50ed77['countdropretry']+=0x1,'scheduledat':moment()[_0xd155('0xd9')](_0x21bcc6[_0xd155('0xd3')],'minutes')[_0xd155('0x79')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x50ed77[_0xd155('0xda')],'ListId':_0x50ed77[_0xd155('0xdb')],'VoiceQueueId':_0x50ed77[_0xd155('0xfc')]||undefined,'CampaignId':_0x50ed77[_0xd155('0xdc')]||undefined})[_0xd155('0x9d')](loggerCatch(_0xd155('0xdd')));break;case 0xb:if(_0x50ed77[_0xd155('0xe4')]>=_0x21bcc6['dialAbandonedMaxRetry']-0x1){return!![];}hopperUtils[_0xd155('0xd8')]({'active':![],'countabandonedretry':_0x50ed77['countabandonedretry']+=0x1,'scheduledat':moment()[_0xd155('0xd9')](_0x21bcc6[_0xd155('0xe5')],_0xd155('0xe9'))[_0xd155('0x79')](_0xd155('0xc2')),'ContactId':_0x50ed77['ContactId'],'ListId':_0x50ed77[_0xd155('0xdb')],'VoiceQueueId':_0x50ed77['VoiceQueueId']||undefined,'CampaignId':_0x50ed77[_0xd155('0xdc')]||undefined})['catch'](loggerCatch('[rescheduleContact][Abandoned]'));break;case 0x13:if(_0x50ed77['countmachineretry']>=_0x21bcc6['dialMachineMaxRetry']-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x50ed77[_0xd155('0x11d')]+=0x1,'scheduledat':moment()[_0xd155('0xd9')](_0x21bcc6[_0xd155('0x129')],'minutes')[_0xd155('0x79')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x50ed77[_0xd155('0xda')],'ListId':_0x50ed77[_0xd155('0xdb')],'VoiceQueueId':_0x50ed77[_0xd155('0xfc')]||undefined,'CampaignId':_0x50ed77[_0xd155('0xdc')]||undefined})[_0xd155('0x9d')](loggerCatch(_0xd155('0x12a')));break;case 0x14:if(_0x50ed77[_0xd155('0x123')]>=_0x21bcc6['dialAgentRejectMaxRetry']-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countagentrejectretry':_0x50ed77[_0xd155('0x123')]+=0x1,'scheduledat':moment()['add'](_0x21bcc6[_0xd155('0x19f')],_0xd155('0xe9'))[_0xd155('0x79')](_0xd155('0xc2')),'ContactId':_0x50ed77[_0xd155('0xda')],'ListId':_0x50ed77[_0xd155('0xdb')],'VoiceQueueId':_0x50ed77[_0xd155('0xfc')]||undefined,'CampaignId':_0x50ed77[_0xd155('0xdc')]||undefined})[_0xd155('0x9d')](loggerCatch(_0xd155('0x1a0')));break;default:return!![];}};Dialer[_0xd155('0x83')][_0xd155('0x10c')]=function(_0x314c21,_0x249b17,_0x37a88f){var _0x49270b=this;var _0x5cc76e=new History(_0x314c21);var _0xc50d00=![];var _0x5bebb6;var _0x9d90e8;return new Promise(function(_0x1a84b1,_0x29694c){if(_[_0xd155('0x51')](_0x249b17)&&typeof _0x249b17!==_0xd155('0x162')){return _0x29694c(msgResponse(_0xd155('0x1a1'),_0xd155('0x8e'),_0xd155('0x1a2')));}if(_[_0xd155('0x51')](_0x37a88f)&&typeof _0x37a88f!==_0xd155('0x162')){return _0x29694c(msgResponse(_0xd155('0x1a1'),'Failure','evt\x20is\x20undefine'));}hopperUtils['verifyAdditionalPhones'](_0x5cc76e,_0x37a88f[_0xd155('0xc4')],_0x249b17)[_0xd155('0x3e')](function(_0xe5ec18){if(_0xe5ec18['additional']==0x1)_0xc50d00=!![];switch(_0x37a88f['reason']){case'0':_0x249b17['outboundNoSuchCallsDay']+=0x1;_0x5cc76e[_0xd155('0x6b')]=0x0;_0x5cc76e[_0xd155('0xcf')]=_0xd155('0x1a3');_0x5cc76e[_0xd155('0x12e')]+=0x1;_0x5cc76e[_0xd155('0x11e')]+=0x1;ami[_0xd155('0x116')](_0xd155('0x1a4'),ut[_0xd155('0x117')](_0x314c21,_0xd155('0x1a5')));_0x5bebb6=_0x249b17[_0xd155('0x1a6')];_0x9d90e8=_0x249b17[_0xd155('0xe6')];hopperUtils[_0xd155('0xeb')](_0x5cc76e)[_0xd155('0x9d')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x49270b[_0xd155('0x194')](0x0,_0x314c21,_0x249b17)&&!_0xc50d00){if(_0x5cc76e['countnosuchnumberretry']>=_0x249b17[_0xd155('0x19c')]){_0x49270b['createStateFinal'](_0x5cc76e,_0x1a84b1,_0x29694c,_0xd155('0x1a7'));}else{_0x49270b['stateGlobal'](_0x5cc76e,_0x1a84b1,_0x29694c,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x249b17[_0xd155('0x1a8')]+=0x1;_0x5cc76e[_0xd155('0x6b')]=0x3;_0x5cc76e['statedesc']=_0xd155('0x1a9');_0x5cc76e['countnoanswerretry']+=0x1;_0x5cc76e['countglobal']+=0x1;var _0x560e1a=ut[_0xd155('0x1aa')](_0x314c21,_0x249b17);ami['emit'](_0xd155('0x1ab'),_0x560e1a);_0x5bebb6=_0x249b17['dialNoAnswerRetryFrequency'];_0x9d90e8=_0x249b17['callAdditionalPhoneAfterMin'];hopperUtils[_0xd155('0xeb')](_0x5cc76e)[_0xd155('0x9d')](loggerCatch(_0xd155('0x1ac')));if(_0x49270b['checkRetriveMax'](0x3,_0x314c21,_0x249b17)&&!_0xc50d00){if(_0x5cc76e['countnoanswerretry']>=_0x249b17[_0xd155('0x1ad')]){_0x49270b['createStateFinal'](_0x5cc76e,_0x1a84b1,_0x29694c,_0xd155('0x1ae'));}else{_0x49270b[_0xd155('0x125')](_0x5cc76e,_0x1a84b1,_0x29694c,_0xd155('0x1ae'));}}break;case'5':_0x249b17['outboundBusyCallsDay']+=0x1;_0x5cc76e[_0xd155('0x6b')]=0x5;_0x5cc76e[_0xd155('0xcf')]='Busy';_0x5cc76e[_0xd155('0x121')]+=0x1;_0x5cc76e['countglobal']+=0x1;ami['emit'](_0xd155('0x1af'),ut[_0xd155('0x117')](_0x314c21,_0xd155('0x1b0')));_0x5bebb6=_0x249b17[_0xd155('0x198')];_0x9d90e8=_0x249b17[_0xd155('0xe6')];hopperUtils['createHistory'](_0x5cc76e)['catch'](loggerCatch(_0xd155('0x1b1')));if(_0x49270b['checkRetriveMax'](0x5,_0x314c21,_0x249b17)&&!_0xc50d00){if(_0x5cc76e[_0xd155('0x121')]>=_0x249b17[_0xd155('0x197')]){_0x49270b[_0xd155('0x12f')](_0x5cc76e,_0x1a84b1,_0x29694c,_0xd155('0x1b2'));}else{_0x49270b[_0xd155('0x125')](_0x5cc76e,_0x1a84b1,_0x29694c,'reason\x205\x20busy');}}break;case'8':_0x249b17['outboundCongestionCallsDay']+=0x1;_0x5cc76e[_0xd155('0x6b')]=0x8;_0x5cc76e[_0xd155('0xcf')]=_0xd155('0x1b3');_0x5cc76e[_0xd155('0x12d')]+=0x1;_0x5cc76e[_0xd155('0x11e')]+=0x1;_0x5bebb6=_0x249b17[_0xd155('0x19a')];_0x9d90e8=_0x249b17[_0xd155('0xe6')];ami[_0xd155('0x116')]('custom:agentcongestion',ut[_0xd155('0x117')](_0x314c21,_0xd155('0x1b4')));hopperUtils[_0xd155('0xeb')](_0x5cc76e)[_0xd155('0x9d')](loggerCatch(_0xd155('0x1b5')));if(_0x49270b[_0xd155('0x194')](0x8,_0x314c21,_0x249b17)&&!_0xc50d00){if(_0x5cc76e[_0xd155('0x12d')]>=_0x249b17[_0xd155('0x199')]){_0x49270b[_0xd155('0x12f')](_0x5cc76e,_0x1a84b1,_0x29694c,_0xd155('0x1b6'));}else{_0x49270b[_0xd155('0x125')](_0x5cc76e,_0x1a84b1,_0x29694c,_0xd155('0x1b6'));}}break;case'11':_0x249b17[_0xd155('0x1b7')]+=0x1;_0x5cc76e[_0xd155('0x6b')]=0xb;_0x5cc76e[_0xd155('0xcf')]=_0xd155('0x1b8');_0x5cc76e['countabandonedretry']+=0x1;_0x5cc76e[_0xd155('0x11e')]+=0x1;_0x5bebb6=_0x249b17[_0xd155('0xe5')];_0x9d90e8=_0x249b17[_0xd155('0xe6')];hopperUtils[_0xd155('0xeb')](_0x5cc76e)[_0xd155('0x9d')](loggerCatch(_0xd155('0xec')));if(_0x49270b[_0xd155('0x194')](0xb,_0x314c21,_0x249b17)&&!_0xc50d00){if(_0x5cc76e['countabandonedretry']>=_0x249b17['dialAbandonedMaxRetry']){_0x49270b[_0xd155('0x12f')](_0x5cc76e,_0x1a84b1,_0x29694c,_0xd155('0x1b9'));}else{_0x49270b[_0xd155('0x125')](_0x5cc76e,_0x1a84b1,_0x29694c,'reason\x2011\x20abandoned');}}break;case'20':_0x249b17[_0xd155('0x1ba')]+=0x1;_0x5cc76e[_0xd155('0x6b')]=0x14;_0x5cc76e[_0xd155('0xcf')]=_0xd155('0x1bb');_0x5cc76e['countagentrejectretry']+=0x1;_0x5cc76e[_0xd155('0x11e')]+=0x1;_0x5bebb6=_0x249b17[_0xd155('0x19f')];_0x9d90e8=_0x249b17['callAdditionalPhoneAfterMin'];ami['emit']('custom:agentreject',ut[_0xd155('0x117')](_0x314c21,_0xd155('0x1bc')));hopperUtils[_0xd155('0xeb')](_0x5cc76e)[_0xd155('0x9d')](loggerCatch(_0xd155('0x1bd')));if(_0x49270b[_0xd155('0x194')](0x14,_0x314c21,_0x249b17)&&!_0xc50d00){if(_0x5cc76e[_0xd155('0x123')]>=_0x249b17[_0xd155('0x1be')]){_0x49270b[_0xd155('0x12f')](_0x5cc76e,_0x1a84b1,_0x29694c,_0xd155('0x1bf'));}else{_0x49270b[_0xd155('0x125')](_0x5cc76e,_0x1a84b1,_0x29694c,_0xd155('0x1bf'));}}break;default:_0x249b17[_0xd155('0x13b')]+=0x1;_0x5cc76e[_0xd155('0x6b')]=0xc;_0x5cc76e['statedesc']=_0x37a88f['reason'];_0x5bebb6=_0x249b17[_0xd155('0x19f')];_0x9d90e8=_0x249b17['callAdditionalPhoneAfterMin'];hopperUtils[_0xd155('0xeb')](_0x5cc76e)[_0xd155('0x9d')](loggerCatch(_0xd155('0x1c0')));if(_0x49270b[_0xd155('0x194')](_0x37a88f[_0xd155('0xc4')],_0x314c21,_0x249b17)&&!_0xc50d00){if(_0x5cc76e[_0xd155('0x121')]+_0x5cc76e[_0xd155('0x12d')]+_0x5cc76e[_0xd155('0x122')]+_0x5cc76e[_0xd155('0x12e')]+_0x5cc76e[_0xd155('0xd7')]+_0x5cc76e['countabandonedretry']+_0x5cc76e['countmachineretry']+_0x5cc76e[_0xd155('0x123')]>=_0x249b17['dialGlobalMaxRetry']){_0x49270b[_0xd155('0x125')](_0x5cc76e,_0x1a84b1,_0x29694c,_0x37a88f[_0xd155('0xc4')]);}else{_0x49270b[_0xd155('0x12f')](_0x5cc76e,_0x1a84b1,_0x29694c,_0x37a88f['reason']);}}}})['then'](function(){if(_0xc50d00){hopperUtils['swapAdditionalPhones'](_0x5cc76e,_0x5bebb6,_0x9d90e8)[_0xd155('0x3e')](function(){return _0x1a84b1(0x1);});}});});};Dialer['prototype']['stateGlobal']=function(_0x2a5d44,_0x69a9bb,_0x20bea9,_0x407490){var _0x424ba5=new Final(_0x2a5d44);_0x424ba5[_0xd155('0x6b')]=0xf;_0x424ba5['statedesc']='Global';this[_0xd155('0x12f')](_0x424ba5,_0x69a9bb,_0x20bea9,_0x407490);};Dialer[_0xd155('0x83')][_0xd155('0x12f')]=function(_0x2372ae,_0x2c0305,_0x309742,_0x4cbd8c){hopperUtils['moveContactManagedDialer'](_0x2372ae)[_0xd155('0x3e')](function(){return _0x2c0305(msgResponse(_0xd155('0x1a1'),_0xd155('0x10a'),_0x4cbd8c));})['catch'](function(){return _0x309742(msgResponse('[moveContactManagedDialer][0]',_0xd155('0x8e'),_0xd155('0x1c1')));});};Dialer['prototype'][_0xd155('0x8')]=function(_0x1b3860){var _0x3de9c7=_0x1b3860[_0xd155('0x1c2')]/0x64;var _0x2b9cfe=_0x1b3860['outboundDropCallsDayTimeout']/(_0x1b3860[_0xd155('0x1c3')]+_0x1b3860[_0xd155('0xc3')]);var _0x139eb0=Math['round'](_0x1b3860[_0xd155('0x1c4')]*(_0x1b3860[_0xd155('0x1c5')]/0x64));var _0x5209c6=Math[_0xd155('0x1c6')](_0x1b3860[_0xd155('0x1c4')]*(_0x1b3860[_0xd155('0x1c7')]/0x64));var _0x183044=_0x1b3860[_0xd155('0x143')]+_0x1b3860['talking'];var _0x34c6de=Math[_0xd155('0x1c8')](_0x1b3860['erlangCalls']*_0x1b3860[_0xd155('0x5b')]*_0x1b3860['predictiveIntervalHitRate']*_0x1b3860[_0xd155('0x1c9')]);if(_[_0xd155('0x51')](_0x1b3860['startProgressive'])){if(!_[_0xd155('0x51')](_0x1b3860[_0xd155('0x27')])){_0x1b3860[_0xd155('0x27')]=undefined;loggerPredictive[_0xd155('0x63')](_0xd155('0x1ca'),'check\x20predictive\x20is\x20not\x20undefine');}if(!_[_0xd155('0x51')](_0x1b3860[_0xd155('0x61')])){loggerPredictive[_0xd155('0x63')]('[startMethodPredictive][StartProgressive]',_0xd155('0x1cb'));clearInterval(_0x1b3860[_0xd155('0x61')]);_0x1b3860['handlePredictive']=undefined;}_0x1b3860['startProgressive']=moment()[_0xd155('0x79')](_0xd155('0xc2'));loggerPredictive['info'](_0x1b3860[_0xd155('0x42')],_0xd155('0x1cc'),_0x1b3860['startProgressive']);this[_0xd155('0xad')](_0x1b3860,0x1);}else if(ifInterval(_0x1b3860['dialPredictiveInterval'],_0x1b3860['startProgressive'])){this[_0xd155('0xad')](_0x1b3860,0x1);loggerPredictiveCalls[_0xd155('0x44')](_0xd155('0x1cd'),_0x1b3860[_0xd155('0x28')],_0x1b3860[_0xd155('0x42')]);_0x1b3860[_0xd155('0x57')]=0x0;_0x1b3860['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x3de9c7<_0x2b9cfe&&_0x1b3860[_0xd155('0x1ce')]==='dropRate'){clearPredictiveAttributes(_0x1b3860);loggerPredictive[_0xd155('0x44')](_0xd155('0x1cf'),_0xd155('0x1d0'),_0x2b9cfe,_0xd155('0x28'),_0x1b3860[_0xd155('0x42')]);}else if(_0x34c6de<_0x1b3860[_0xd155('0xce')]&&_0x1b3860[_0xd155('0x1ce')]==='dropRate'){clearPredictiveAttributes(_0x1b3860);loggerPredictive[_0xd155('0x44')]('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20',_0x34c6de,_0xd155('0x1d1'),_0x1b3860['predictiveIntervalErlangCallsDroppedCalls'],_0xd155('0x28'),_0x1b3860[_0xd155('0x42')]);}else if(!ifInterval(_0x1b3860['dialPredictiveInterval'],_0x1b3860[_0xd155('0x28')])&&_[_0xd155('0x51')](_0x1b3860['startPredictive'])&&!_['isUndefined'](_0x1b3860[_0xd155('0x28')])){_0x1b3860[_0xd155('0x27')]=moment()[_0xd155('0x79')](_0xd155('0xc2'));loggerPredictive[_0xd155('0x44')](_0x1b3860['name'],'started\x20in\x20predictive\x20at',_0x1b3860[_0xd155('0x27')]);hopperUtils[_0xd155('0x1d2')](_0x1b3860['dialPredictiveInterval'])[_0xd155('0x3e')](this[_0xd155('0x1d3')](_0x1b3860))[_0xd155('0x3e')](mergeDataErlangB(_0x1b3860))['then'](this[_0xd155('0x1d4')](_0x1b3860))[_0xd155('0x9d')](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x1b3860));}else if(!ifInterval(_0x1b3860[_0xd155('0x1d5')],_0x1b3860[_0xd155('0x27')])){_0x1b3860[_0xd155('0xce')]=0x0;_0x1b3860[_0xd155('0x27')]=moment()['format'](_0xd155('0xc2'));loggerPredictive['info'](_0x1b3860[_0xd155('0x42')],_0xd155('0x1d6'),_0x1b3860['startPredictive']);clearInterval(_0x1b3860[_0xd155('0x61')]);_0x1b3860[_0xd155('0x61')]=undefined;hopperUtils['avgHandleTime'](_0x1b3860[_0xd155('0x1d5')])[_0xd155('0x3e')](this['getDataPredictive'](_0x1b3860))['then'](mergeDataErlangB(_0x1b3860))['then'](this[_0xd155('0x1d4')](_0x1b3860))[_0xd155('0x9d')](loggerCatchPredictive(_0xd155('0x1d7'),_0x1b3860));}else if(_0x1b3860['predictiveIntervalAvailable']&&_0x183044<_0x1b3860['predictiveIntervalAvailable']-_0x5209c6){clearPredictiveAttributes(_0x1b3860);loggerPredictive[_0xd155('0x44')](_0x1b3860['name'],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x183044,_0xd155('0x1d8'),_0x1b3860[_0xd155('0x1c4')],'-',_0x5209c6,'=',_0x1b3860[_0xd155('0x1c4')]-_0x5209c6,')');}else if(_0x1b3860[_0xd155('0x1c4')]&&_0x183044>_0x1b3860['predictiveIntervalAvailable']+_0x139eb0){clearPredictiveAttributes(_0x1b3860);loggerPredictive[_0xd155('0x44')](_0x1b3860[_0xd155('0x42')],_0xd155('0x1d9'),_0x183044,_0xd155('0x1da'),_0x1b3860[_0xd155('0x1c4')],'+',_0x139eb0,'=',_0x1b3860[_0xd155('0x1c4')]+_0x139eb0,')');}};Dialer['prototype'][_0xd155('0x1d3')]=function(_0x281b8f){var _0x411e42=this;return function(_0x558d98){return new Promise(function(_0x43b3a3,_0x3e50ee){_['merge'](_0x281b8f,_0x558d98[0x0]);if(checkGetDataPredictive(_0x558d98[0x0])){var _0x1a599d=_0x281b8f[_0xd155('0x1c4')]=_0x281b8f[_0xd155('0x145')]+_0x281b8f['available'];var _0x2666d7=_0x281b8f[_0xd155('0x1d5')]*0x3c;var _0x246025=_0x558d98[0x0][_0xd155('0x4f')]+_0x558d98[0x0][_0xd155('0x53')];var _0x4803f6=(_0x558d98[0x0][_0xd155('0x49')]+_0x558d98[0x0][_0xd155('0x4b')]+_0x558d98[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x558d98[0x0]['predictiveIntervalTotalCalls'];_0x281b8f[_0xd155('0x1db')]=_0x4803f6>0x0?_0x4803f6:0x1;switch(_0x281b8f[_0xd155('0x1ce')]){case _0xd155('0x1dc'):var _0x263cc6=_0x281b8f[_0xd155('0x1c2')]/0x64;return _0x411e42[_0xd155('0x1dd')](_0x1a599d,_0x2666d7,_0x246025,_0x4803f6,_0x263cc6)[_0xd155('0x3e')](function(_0x6d9d22){return _0x43b3a3(_0x6d9d22);});case _0xd155('0x1de'):var _0x545ee4=_0x281b8f[_0xd155('0x1c2')]/0x64;return _0x411e42[_0xd155('0x1df')](_0x1a599d,_0x2666d7,_0x246025,_0x4803f6,_0x545ee4)['then'](function(_0x34618e){return _0x43b3a3(_0x34618e);});default:return _0x3e50ee(msgResponse('[getDataPredictive]','Failure',_0xd155('0x1e0')));}}else{return _0x3e50ee(msgResponse(_0xd155('0x1e1'),_0xd155('0x8e'),_0xd155('0x1e2')));}});};};Dialer[_0xd155('0x83')][_0xd155('0x1e3')]=function(_0x2f0c11){var _0x52433a=this;return function(_0x34599b){return new Promise(function(_0x2320ab,_0x22449d){_['merge'](_0x2f0c11,_0x34599b[0x0]);if(checkGetDataPredictive(_0x34599b[0x0])){loggerPredictive[_0xd155('0x44')](JSON['stringify'](_0x34599b[0x0]));if(_0x2f0c11[_0xd155('0x1ce')]===_0xd155('0x1dc')){return _0x52433a[_0xd155('0x158')](_0x2f0c11['id'])[_0xd155('0x3e')](function(_0x54e3a2){var _0x3d2ca0=_0x2f0c11[_0xd155('0x1e4')]-_0x54e3a2[0x0][_0xd155('0x1e5')];var _0x4d3f2e=_0x2f0c11[_0xd155('0x1d5')]*0x3c;var _0x5d3649=_0x34599b[0x0][_0xd155('0x4f')]+_0x34599b[0x0][_0xd155('0x53')];var _0x138574=(_0x34599b[0x0][_0xd155('0x49')]+_0x34599b[0x0][_0xd155('0x4b')]+_0x34599b[0x0][_0xd155('0x4c')])/_0x34599b[0x0][_0xd155('0x47')];var _0x48dc7e=_0x2f0c11[_0xd155('0x1c2')]/0x64;_0x2f0c11[_0xd155('0x1e6')]=_0x54e3a2[0x0]['outboundQueuePauses']||0x0;_0x2f0c11[_0xd155('0x1db')]=_0x138574>0x0?_0x138574:0x1;return _0x52433a[_0xd155('0x1dd')](_0x3d2ca0,_0x4d3f2e,_0x5d3649,_0x138574,_0x48dc7e);})[_0xd155('0x3e')](function(_0x4c7204){return _0x2320ab(_0x4c7204);})[_0xd155('0x9d')](function(_0x12adc9){return _0x22449d(msgResponse(_0xd155('0x1e7'),_0xd155('0x8e'),JSON[_0xd155('0x70')](_0x12adc9)));});}if(_0x2f0c11[_0xd155('0x1ce')]===_0xd155('0x1de')){return _0x52433a[_0xd155('0x158')](_0x2f0c11['id'])[_0xd155('0x3e')](function(_0x52c897){var _0x2de4f5=_0x2f0c11[_0xd155('0x1e4')]-_0x52c897[0x0][_0xd155('0x1e5')];var _0x5d3a94=_0x2f0c11[_0xd155('0x1d5')]*0x3c;var _0x226ff8=_0x34599b[0x0][_0xd155('0x4f')]+_0x34599b[0x0][_0xd155('0x53')];var _0x38221c=(_0x34599b[0x0][_0xd155('0x49')]+_0x34599b[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x34599b[0x0][_0xd155('0x4c')])/_0x34599b[0x0][_0xd155('0x47')];var _0x45bd87=_0x2f0c11[_0xd155('0x1c2')]/0x64;_0x2f0c11[_0xd155('0x1e6')]=_0x52c897[0x0]['outboundQueuePauses']||0x0;_0x2f0c11['predictiveIntervalHitRate']=_0x38221c>0x0?_0x38221c:0x1;return _0x52433a[_0xd155('0x1df')](_0x2de4f5,_0x5d3a94,_0x226ff8,_0x38221c,_0x45bd87);})['then'](function(_0x11e783){return _0x2320ab(_0x11e783);})[_0xd155('0x9d')](function(_0x10fd74){return _0x22449d(msgResponse('[CatchErlangB]',_0xd155('0x8e'),JSON[_0xd155('0x70')](_0x10fd74)));});}}else{return _0x22449d(msgResponse('[getDataPredictive]',_0xd155('0x8e'),'check\x20failure'));}});};};Dialer[_0xd155('0x83')][_0xd155('0x1d4')]=function(_0x1528ba){var _0x44f67b=this;return function(){var _0x1853bd=0x0;var _0x3c6b40=Math[_0xd155('0x1c8')](_0x1528ba[_0xd155('0x59')]*0x3e8);if(_0x3c6b40>0x0){_0x3c6b40=_0x3c6b40<0x64?0x64:_0x3c6b40;loggerPredictive[_0xd155('0x44')](_0x1528ba[_0xd155('0x42')],'one\x20call\x20every:',_0x3c6b40,'milliseconds');_0x1528ba[_0xd155('0x61')]=setInterval(function(){_0x44f67b['handlePredictive'](_0x1528ba);loggerPredictiveCalls[_0xd155('0x44')](_0xd155('0x1e8'),_0x1853bd+=0x1);},_0x3c6b40);}else{loggerPredictive[_0xd155('0x44')](_0x1528ba['name'],_0xd155('0x1e9'));}};};Dialer[_0xd155('0x83')][_0xd155('0x1ea')]=function(_0x405211,_0x3bfea5){var _0x2add2b=this;return function(_0x444646){if(_[_0xd155('0x8c')](_0x444646)){if(_[_0xd155('0xf4')](_0x3bfea5[_0xd155('0x15d')])||!_0x3bfea5[_0xd155('0x1eb')]){if(_0x405211[_0xd155('0xab')]===_0xd155('0x7')){_0x405211[_0xd155('0x6d')]=_[_0xd155('0x51')](_0x405211[_0xd155('0x6d')])?!![]:_0x405211[_0xd155('0x6d')];var _0x2de3c0=uuid['v4']();_0x2add2b['actions'][_0x2de3c0]=new Action(_0x405211,_0x3bfea5,_0x2de3c0);loggerBooked[_0xd155('0x44')]('[booked][checkContactBlack]',_0x2de3c0,'queueStatusComplete:\x20',JSON[_0xd155('0x70')](_0x405211['queueStatusComplete']),'Queue:\x20',_0x405211[_0xd155('0x42')]);if(_0x405211[_0xd155('0x6d')]){_0x405211[_0xd155('0x6d')]=![];_0x2add2b[_0xd155('0x2a')][_0x2add2b[_0xd155('0x23')][_0x2de3c0]['queue']]=[];ami[_0xd155('0x96')]({'actionid':_0x2de3c0,'action':'queuestatus','queue':_0x405211['name']})[_0xd155('0x9d')](function(){utils[_0xd155('0xbf')](_0x405211,_0xd155('0x1ec'));hopperUtils[_0xd155('0xd8')]({'active':![],'ContactId':_0x2add2b[_0xd155('0x23')][_0x2de3c0]['ContactId'],'ListId':_0x2add2b[_0xd155('0x23')][_0x2de3c0][_0xd155('0xdb')],'VoiceQueueId':_0x2add2b[_0xd155('0x23')][_0x2de3c0][_0xd155('0xfc')]||undefined,'CampaignId':_0x2add2b[_0xd155('0x23')][_0x2de3c0][_0xd155('0xdc')]||undefined})['catch'](loggerCatch(_0xd155('0x1ed')));delete _0x2add2b[_0xd155('0x23')][_0x2de3c0];});}else{loggerBooked[_0xd155('0x44')](_0xd155('0x1ee'),JSON[_0xd155('0x70')](_0x405211[_0xd155('0x6d')]),_0xd155('0x1ef'),_0x405211[_0xd155('0x42')]);utils[_0xd155('0xbf')](_0x405211,_0xd155('0x1ec'));hopperUtils[_0xd155('0xd8')]({'active':![],'ContactId':_0x2add2b[_0xd155('0x23')][_0x2de3c0][_0xd155('0xda')],'ListId':_0x2add2b[_0xd155('0x23')][_0x2de3c0][_0xd155('0xdb')],'VoiceQueueId':_0x2add2b['actions'][_0x2de3c0][_0xd155('0xfc')]||undefined,'CampaignId':_0x2add2b['actions'][_0x2de3c0]['CampaignId']||undefined})[_0xd155('0x9d')](loggerCatch(_0xd155('0x1ed')));delete _0x2add2b[_0xd155('0x23')][_0x2de3c0];}}else{return _0x2add2b[_0xd155('0x161')](_0x405211,_0x3bfea5);}}else{if(utils[_0xd155('0x5f')](undefined,_0x3bfea5[_0xd155('0x1f0')])<_0x405211['dialRecallMeTimeout']*0x3c){if(_0x3bfea5[_0xd155('0x14e')]&&!_0x3bfea5[_0xd155('0x14e')][_0xd155('0x1f1')]){_0x2add2b[_0xd155('0x1d')][_0xd155('0xf9')](_0x3bfea5['id'])['finally'](function(){utils[_0xd155('0xbf')](_0x405211,'[checkContactBlack]');});}else{hopperUtils[_0xd155('0x1f2')]({'active':![]},_0x3bfea5['id'],0x1)['finally'](function(){utils['decrementOriginate'](_0x405211,_0xd155('0x1ec'));});}}else{_0x405211[_0xd155('0x1f3')]+=0x1;utils['decrementOriginate'](_0x405211,_0xd155('0x1ec'));if(_0x405211[_0xd155('0x1f4')]){hopperUtils[_0xd155('0xd8')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x3bfea5['ContactId'],'ListId':_0x3bfea5[_0xd155('0xdb')],'VoiceQueueId':_0x3bfea5[_0xd155('0xfc')]||undefined,'CampaignId':_0x3bfea5[_0xd155('0xdc')]||undefined})['catch'](loggerCatch(_0xd155('0x1f5')));hopperUtils[_0xd155('0xeb')](createObjHistory(_0x405211,_0x3bfea5,utils[_0xd155('0x67')]['QUEUE_RECALL'],0x17,_0xd155('0x1f6')))['catch'](loggerCatch(_0xd155('0x1f7')));}else{_0x2add2b[_0xd155('0x118')](createObjHistory(_0x405211,_0x3bfea5,utils[_0xd155('0x67')][_0xd155('0x1f8')],0x16,'RecallFailedTimeout'),_0xd155('0x1f9'),_0xd155('0x1fa'));}}}}else{_0x405211[_0xd155('0x1fb')]+=0x1;_0x2add2b[_0xd155('0x118')](createObjHistory(_0x405211,_0x3bfea5,utils[_0xd155('0x67')][_0xd155('0x1fc')],0xd,_0xd155('0x1fd')),_0xd155('0x1fe'),_0xd155('0x1ff'));throw _0xd155('0x200');}};};Dialer['prototype'][_0xd155('0x201')]=function(_0x51be4e){var _0x8a051=this;var _0x7c22f1=_0x51be4e[_0xd155('0x202')]-_0x51be4e[_0xd155('0x203')];emitCampaignSummary(_0x51be4e);if(_0x7c22f1>0x0&&_0x51be4e[_0xd155('0x204')]==0x0){if(_0x7c22f1>this['maxNumberOriginate']){_0x7c22f1=this[_0xd155('0x22')];}_0x51be4e[_0xd155('0x204')]=0x1;hopperUtils[_0xd155('0x205')](_0x51be4e,_0x7c22f1)[_0xd155('0x3e')](function(_0x20a742){_0x51be4e[_0xd155('0x204')]=0x0;if(_0x20a742){if(!utils[_0xd155('0x206')](_0x20a742)){_0x51be4e[_0xd155('0x66')]=utils['CAMPAIGN_STATUS'][_0xd155('0x207')];logger[_0xd155('0x44')](_0xd155('0x208')+_0x51be4e[_0xd155('0x42')]);}else{_0x51be4e[_0xd155('0x203')]+=_0x20a742[_0xd155('0x94')];_0x51be4e['message']=utils[_0xd155('0x67')][_0xd155('0x209')];for(var _0x405bae=0x0;_0x405bae<_0x20a742[_0xd155('0x94')];_0x405bae+=0x1){_0x51be4e[_0xd155('0x20a')]+=0x1;if(_[_0xd155('0xf4')](_0x20a742[_0x405bae])||_[_0xd155('0xf4')](_0x20a742[_0x405bae][_0xd155('0x20b')])||_[_0xd155('0xf4')](_0x20a742[_0x405bae][_0xd155('0x163')])){_0x8a051[_0xd155('0x15a')]('[actionOriginate]\x20',_0x51be4e,_0x20a742[_0x405bae]);}else{hopperUtils[_0xd155('0x20c')](_[_0xd155('0x71')](_0x20a742[_0x405bae],[_0xd155('0xdc'),_0xd155('0x163')]))[_0xd155('0x3e')](_0x8a051['checkContactBlack'](_0x51be4e,_0x20a742[_0x405bae]))[_0xd155('0x9d')](function(_0x52c845){logger['error']('[actionOriginateIvr]',_0x52c845);utils[_0xd155('0xbf')](_0x51be4e,'[handleIvr]');});}}}}})[_0xd155('0x9d')](function(_0xcf3696){_0x51be4e[_0xd155('0x204')]=0x0;logger[_0xd155('0x63')](_0xd155('0x20d'),_0xcf3696);});}};Dialer[_0xd155('0x83')][_0xd155('0xad')]=function(_0x249e5a,_0x2d782a){var _0xdbb133=this;var _0x2ff982=[];if(_0x2d782a<0x1||_0x249e5a[_0xd155('0xab')]===_0xd155('0x7')){_0x2d782a=0x1;}var _0x1c9ff3=Math[_0xd155('0x1c8')](_0x249e5a[_0xd155('0x143')]*_0x2d782a)-_0x249e5a[_0xd155('0x203')];if(_0x249e5a['dialLimitQueue']>0x0){var _0x5ae52d=_0x249e5a[_0xd155('0x20e')]-_0x249e5a[_0xd155('0x203')]-_0x249e5a['talking']-_0x249e5a[_0xd155('0x146')];if(_0x1c9ff3>_0x5ae52d){_0x1c9ff3=_0x5ae52d;}}if(_0x1c9ff3>0x0&&_0x249e5a[_0xd155('0x204')]==0x0){if(_0x249e5a[_0xd155('0xab')]==='booked'){_0x1c9ff3=0x1;}if(_0x1c9ff3>this['maxNumberOriginate']){_0x1c9ff3=this[_0xd155('0x22')];}for(var _0x385197 in this['agents']){if(typeof this[_0xd155('0x20')][_0x385197]!==_0xd155('0xa5')){if(this[_0xd155('0x20')][_0x385197][_0xd155('0x6b')]===_0xd155('0x20f')&&this['agents'][_0x385197][_0xd155('0xf0')]===_0xd155('0x81')){_0x2ff982[_0xd155('0x95')](this[_0xd155('0x20')][_0x385197]['id']);}}}_0x249e5a['temp']=0x1;hopperUtils['getContactDialer'](_0x249e5a,_0x2ff982,_0x1c9ff3)['then'](function(_0x229dd5){_0x249e5a['temp']=0x0;if(_0x229dd5){if(!utils[_0xd155('0x206')](_0x229dd5)){hopperUtils['countReScheduled'](_0x249e5a)[_0xd155('0x3e')](sendMessageReschedule(_0x249e5a))[_0xd155('0x9d')](loggerCatch('[countReScheduled]\x20'));}else{_0x249e5a[_0xd155('0x203')]+=_0x229dd5[_0xd155('0x94')];_0x249e5a[_0xd155('0x66')]=_0x249e5a[_0xd155('0xab')]==='booked'?utils[_0xd155('0x67')][_0xd155('0x147')]:utils[_0xd155('0x67')]['RUNNING'];for(var _0x9193e1=0x0;_0x9193e1<_0x229dd5[_0xd155('0x94')];_0x9193e1+=0x1){if(_[_0xd155('0xf4')](_0x229dd5[_0x9193e1])||_[_0xd155('0xf4')](_0x229dd5[_0x9193e1][_0xd155('0x20b')])||_[_0xd155('0xf4')](_0x229dd5[_0x9193e1]['phone'])){_0xdbb133[_0xd155('0x15a')](_0xd155('0x210'),_0x249e5a,_0x229dd5[_0x9193e1]);}else{hopperUtils[_0xd155('0x211')](_[_0xd155('0x71')](_0x229dd5[_0x9193e1],[_0xd155('0xfc'),_0xd155('0x163')]))[_0xd155('0x3e')](_0xdbb133[_0xd155('0x1ea')](_0x249e5a,_0x229dd5[_0x9193e1]))[_0xd155('0x9d')](function(_0x3aaa63){logger[_0xd155('0x63')](_0xd155('0x212'),_0x3aaa63);utils[_0xd155('0xbf')](_0x249e5a,'[handlePower]');});}}}}})[_0xd155('0x9d')](function(_0x22dcf){_0x249e5a[_0xd155('0x204')]=0x0;logger[_0xd155('0x63')]('[getContactCampaign2]',_0x22dcf);});}};Dialer[_0xd155('0x83')][_0xd155('0x61')]=function(_0x16f9d4){if(_0x16f9d4[_0xd155('0x20e')]>0x0){var _0xe252dd=_0x16f9d4['dialLimitQueue']-_0x16f9d4[_0xd155('0x203')]-_0x16f9d4[_0xd155('0x145')];if(_0xe252dd>0x0&&_0x16f9d4[_0xd155('0x204')]==0x0){this[_0xd155('0x213')](_0x16f9d4);}else{loggerPredictiveCalls[_0xd155('0x44')](_0xd155('0x214'));}}else{this[_0xd155('0x213')](_0x16f9d4);}};Dialer[_0xd155('0x83')]['tryOriginatePredictive']=function(_0x591119){var _0x9309af=this;var _0x11f036=[];_0x591119[_0xd155('0x203')]+=0x1;for(var _0x22b199 in this['agents']){if(typeof this[_0xd155('0x20')][_0x22b199]!==_0xd155('0xa5')){if(this[_0xd155('0x20')][_0x22b199][_0xd155('0x6b')]===_0xd155('0x20f')&&this[_0xd155('0x20')][_0x22b199][_0xd155('0xf0')]===_0xd155('0x81')){_0x11f036[_0xd155('0x95')](this[_0xd155('0x20')][_0x22b199]['id']);}}}_0x591119[_0xd155('0x204')]=0x1;return this[_0xd155('0x215')](_0x591119['id'],_0x11f036,0x1,_0x591119[_0xd155('0x216')],_0x591119)[_0xd155('0x3e')](function(_0x367932){_0x591119['temp']=0x1;if(_0x367932){if(!utils[_0xd155('0x206')](_0x367932)){utils[_0xd155('0x217')](_0x591119,0x1,0x0);return hopperUtils[_0xd155('0x218')](_0x591119)[_0xd155('0x3e')](sendMessageReschedule(_0x591119))[_0xd155('0x9d')](loggerCatch(_0xd155('0x219')));}else{_0x591119[_0xd155('0x66')]=utils[_0xd155('0x67')][_0xd155('0x209')];if(_[_0xd155('0xf4')](_0x367932[0x0])||_[_0xd155('0xf4')](_0x367932[0x0][_0xd155('0x20b')])||_[_0xd155('0xf4')](_0x367932[0x0]['phone'])){_0x9309af[_0xd155('0x15a')](_0xd155('0x210'),_0x591119,_0x367932[0x0]);}else{return hopperUtils['checkIsBlackList'](_[_0xd155('0x71')](_0x367932[0x0],[_0xd155('0xfc'),_0xd155('0x163')]))['then'](_0x9309af[_0xd155('0x1ea')](_0x591119,_0x367932[0x0]))[_0xd155('0x9d')](function(_0x3c9323){logger['error']('[actionOriginatePredictive]',_0x3c9323);utils[_0xd155('0xbf')](_0x591119,_0xd155('0x21a'));});}}}})[_0xd155('0x9d')](function(_0x2a2e45){_0x591119[_0xd155('0x204')]=0x0;logger['error'](_0xd155('0x20d'),_0x2a2e45);});};Dialer[_0xd155('0x83')][_0xd155('0x1dd')]=function(_0x541c75,_0x2dd666,_0x5d1138,_0x524bff,_0x401f44,_0x301ce8){loggerPredictive[_0xd155('0x44')]('--------\x20Drop\x20Rate\x20--------');loggerPredictive[_0xd155('0x44')](_0xd155('0x21b'),_0x541c75);loggerPredictive[_0xd155('0x44')](_0xd155('0x21c'),_0x2dd666);loggerPredictive[_0xd155('0x44')](_0xd155('0x21d'),_0x5d1138);loggerPredictive[_0xd155('0x44')]('P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x524bff);loggerPredictive[_0xd155('0x44')]('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x401f44);loggerPredictive[_0xd155('0x44')](_0xd155('0x50'));return new Promise(function(_0x422278,_0x4cf0aa){if(_0x541c75<=0x0||isNaN(_0x541c75)){return _0x4cf0aa(msgResponse(_0xd155('0x21e'),_0xd155('0x192'),_0xd155('0x21f')+_0x541c75));}if(_0x5d1138<=0x0||isNaN(_0x5d1138)){return _0x4cf0aa(msgResponse(_0xd155('0x21e'),_0xd155('0x192'),_0xd155('0x220')+_0x5d1138));}if(_0x524bff<=0x0||isNaN(_0x524bff)){return _0x4cf0aa(msgResponse(_0xd155('0x21e'),'Error',_0xd155('0x221')+_0x524bff));}if(_0x2dd666<=0x0||isNaN(_0x2dd666)){return _0x4cf0aa(msgResponse(_0xd155('0x21e'),_0xd155('0x192'),_0xd155('0x222')+_0x2dd666));}if(_0x401f44<=0x0||isNaN(_0x401f44)){return _0x4cf0aa(msgResponse('[abandonmentRate]',_0xd155('0x192'),_0xd155('0x223')+_0x401f44));}_0x301ce8=_0x301ce8||0x0;var _0x5a5ba2=0x1/_0x5d1138;var _0x4e180b=0x0;var _0x85987b=0x0;var _0x35dfb9=0x0;var _0xacb256=0x0;for(var _0x24e23f=0x0;_0x35dfb9<_0x401f44;_0x24e23f+=0x1){_0x85987b=_0x24e23f/_0x2dd666;_0x4e180b=(_0x524bff*_0x85987b+_0x301ce8)/_0x5a5ba2;_0x35dfb9=utils[_0xd155('0x224')](_0x4e180b,_0x541c75);_0xacb256=_0x4e180b/_0x541c75*(0x1-utils['erlangb'](_0x4e180b,_0x541c75));}return _0x422278({'erlangCalls':_0x24e23f,'erlangCallToSecond':_0x2dd666/_0x24e23f,'erlangAbandonmentRate':_0x35dfb9,'erlangBusyFactor':_0xacb256});});};Dialer[_0xd155('0x83')][_0xd155('0x1df')]=function(_0x20afdd,_0x5a6599,_0x1afea2,_0x5f6716,_0x267bcf,_0x49546d){loggerPredictive[_0xd155('0x44')](_0xd155('0x225'));loggerPredictive[_0xd155('0x44')](_0xd155('0x21b'),_0x20afdd);loggerPredictive[_0xd155('0x44')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5a6599);loggerPredictive[_0xd155('0x44')](_0xd155('0x21d'),_0x1afea2);loggerPredictive['info'](_0xd155('0x226'),_0x5f6716);loggerPredictive[_0xd155('0x44')](_0xd155('0x227'),_0x267bcf);loggerPredictive[_0xd155('0x44')](_0xd155('0x50'));return new Promise(function(_0x2e6434,_0x514780){if(_0x20afdd<=0x0||isNaN(_0x20afdd)){return _0x514780(msgResponse(_0xd155('0x228'),_0xd155('0x192'),_0xd155('0x21f')+_0x20afdd));}if(_0x1afea2<=0x0||isNaN(_0x1afea2)){return _0x514780(msgResponse(_0xd155('0x228'),_0xd155('0x192'),'Ts\x20=\x20'+_0x1afea2));}if(_0x5f6716<=0x0||isNaN(_0x5f6716)){return _0x514780(msgResponse(_0xd155('0x228'),_0xd155('0x192'),_0xd155('0x221')+_0x5f6716));}if(_0x5a6599<=0x0||isNaN(_0x5a6599)){return _0x514780(msgResponse(_0xd155('0x228'),_0xd155('0x192'),_0xd155('0x222')+_0x5a6599));}if(_0x267bcf<=0x0||isNaN(_0x267bcf)){return _0x514780(msgResponse('[busyFactor]',_0xd155('0x192'),'Umin\x20=\x20'+_0x267bcf));}_0x49546d=_0x49546d||0x0;var _0x17cf35=0x1/_0x1afea2;var _0x567d6d=0x0;var _0x5d02e7=0x0;var _0xae2f31=0x0;var _0x24b5b7=0x0;for(var _0x3c9071=0x0;_0x24b5b7<_0x267bcf;_0x3c9071+=0x1){_0x5d02e7=_0x3c9071/_0x5a6599;_0x567d6d=(_0x5f6716*_0x5d02e7+_0x49546d)/_0x17cf35;_0xae2f31=utils[_0xd155('0x224')](_0x567d6d,_0x20afdd);_0x24b5b7=_0x567d6d/_0x20afdd*(0x1-utils[_0xd155('0x224')](_0x567d6d,_0x20afdd));}return _0x2e6434({'erlangCalls':_0x3c9071,'erlangCallToSecond':_0x5a6599/_0x3c9071,'erlangAbandonmentRate':_0xae2f31,'erlangBusyFactor':_0x24b5b7});});};module[_0xd155('0x229')]=Dialer; \ No newline at end of file +var _0x75ce=['run','[Catch][Preview][syncQueueStatusComplete]','[booked][RR][finaly]','[booked][unlock]','[booked][unlock2]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','getQueue','response','Success','[syncOriginateResponse]','callProgressDetecting','syncVarSet','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','[syncVarSet]','outboundAnswerAgiCallsDay','HangupInAMD','AMD','custom:amd','buildObj','amd','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','outboundAnswerCallsDay','Machine','membername','countmachineretry','countglobal','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','dialMachineRetryFrequency','[rescheduleContact][Machine]','saveInDb','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','createStateFinal','reason\x2019\x20machine....','[syncHangup]','cause-txt','Normal\x20Clearing','[syncAgentCompleteIvr][createHistory]','[syncAgentCompleteIvr]','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','[syncHangup2]','Unknown','[syncHangup][createHistory]','running','isPreviewCampaign','statusMessage','available','inUse','talking','pTalking','ACTIVE','queueSummaryCountersUpdated','updateReportFromOutboundQueue','assign','[syncQueueSummary]','filter','dialPreviewRecallmeReminder','online','handlePreviewRecallNotifications','map','user:%s','user:dialPreviewRecallReminder','checkPreviewRecallReminder','loopClearZombieChannels','clearZombieChannels','No\x20such\x20channel','[clearZombieChannels]','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','notFound','[emptyContact]','Agent','handleIvr','object','originate','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','dialQueueProject2','isOutboundQueue','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialQueueTimeout','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDMAXIMUMWORDLENGTH','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','Contact','callerid','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','getCallerId','TrunkBackup','dialOriginateCallerIdName','originatecalleridname','extractCalleridName','XMD-ORIGINATECALLERIDNUM','variables','dialPrefix','trim','dialCutDigit','substring','SIP/%s/%s%s','from-sip','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','reason','outboundNoSuchCallsDay','custom:agentnosuchnumber','nosuchnumber','dialNoSuchNumberMaxRetry','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','buildNoAnswerEventPayload','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','busy','dialBusyRetryFrequency','reason\x205\x20busy','Congestion','custom:agentcongestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','outboundUnknownCallsDay','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalAvailable','predictiveIntervalMinThreshold','floor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Drop\x20in\x20this\x20interval','dialPredictiveInterval','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','avgHandleTime','getDataPredictive','startMethodPredictive','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','outboundQueuePauses','predictiveIntervalPauses','predictiveIntervalHitRate','[CatchErlangB]','erlangCallToSecond','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','UserId','recallme','queueStatusComplete:\x20','Queue:\x20','[checkContactBlack]','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','actionOriginate','scheduledat','dialRecallMeTimeout','voicePause','unlockContact','outboundReCallsDay','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','limitCalls','originated','getContactDialerIvr','temp','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','emptyContact','[actionOriginate]\x20','[actionOriginateIvr]','[handleIvr]','[getContactCampaign2]','dialLimitQueue','not_inuse','countReScheduled','[countReScheduled]\x20','[handlePower]','tryOriginatePredictive','[handlePredictive][limitChannel]','dialOrderByScheduledAt','checkContactEmpty','checkContactLowerLimitOriginate','checkIsBlackList','[actionOriginatePredictive]','--------\x20Drop\x20Rate\x20--------','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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]','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','erlangb','----\x20Agent\x20Busy\x20Factor\x20----','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','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','moment','./utils','../preview/util/util','../../../config/logger','predictive','syncQueueSummary','redis','defaults','localhost','../rpc/voiceQueueRt','../rpc/setting','../rpc/interval','./models/action','./models/history','./models/final','./models/queueCallerAbandon','env','XCALLY_IP_AGI','prototype','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','optionPredictive','startPredictive','startProgressive','queuesSummary','agentconnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','custom:queuesummary','custom:queuesummarycomplete','syncQueueSummaryComplete','hangup','syncHangup','newexten','syncNewExten','queuemember','syncQueueMember','syncQueueStatusComplete','loopCampaigns','getSettings','then','isUndefined','emit','type','outbound','debug','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','inspect','format','isEmpty','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','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','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','merge','getSeconds','name','handlePredictive','error','contactsRescheduled','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','contacts','message','CAMPAIGN_STATUS','NO_AVAILABLE_CONTACTS','state','statedesc','endtime','starttime','queueStatusComplete','[unlockQueueStatus][undefined]','stringify','\x20INTERVAL_IS_NULL','Interval','Intervals','NULL_INTERVAL','INACTIVE','\x20NOT\x20Active','isIVRCampaign','campaign:ivr:%s','campaign:save','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','DISACTIVED','is\x20deactivated','[ifTime][Action]','Error','isTrunkReachable','active','SIP/%s','status','reachable','checkIsTrunkReachable','Trunk','TRUNK_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTimeIvr','checkIfTimeIntervals','Failure','\x20Intervals\x20is\x20null\x20','timezones','ifTime','isArray','length','push','Action','iftime\x20%s,%s','interval','content','catch','command','all','OVERTIME_GLOBAL_INTERVAL','OVERTIME_INTERVAL','[ifTime][promiseAll]','Global:\x20','Timezone:\x20','syncCampaigns','undefined','isIVRCampaignActive','resolve','dialGlobalInterval','dialTimezone','launchHandleIvr','[syncCampaigns]','checkDialMethod','dialMethod','progressive','power','handlePower','dialPowerLevel','booked','Queue','method\x20not\x20recognized','Dialer::ifTime()','Voice\x20Queue\x20%s\x20$s','\x20Interval\x20is\x20overtime:\x20','silly','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','isGlobal','AMI\x20IfTime','syncAgentConnect','queue','uniqueId','uniqueid','ivr','answertime','YYYY-MM-DD\x20HH:mm:ss','syncAgentComplete','agent','dialAgiAfterHangupAgent','createHistory','[syncAgentComplete][createHistory]','moveContactManagedDialer','[syncAgentComplete]','droptime','responsetime','predictiveIntervalDroppedCallsTimeout','outboundDropCallsDayTimeout','predictiveIntervalErlangCallsDroppedCalls','Drop','dropreason','TIMEOUT','agiafterat','countdropretry','dialDropRetryFrequency','callAdditionalPhoneAfterMin','verifyAdditionalPhones','voiceQueue','additional','dialDropMaxRetry','rescheduleContact','add','ContactId','ListId','VoiceQueueId','CampaignId','[rescheduleContact][Drop]','calleridname','[syncAgentComplete][createHistory][10]','swapAdditionalPhones','outboundDropCallsDayCallersExit','CALLEREXIT','countabandonedretry','dialAbandonedRetryFrequency','dialAbandonedMaxRetry','queueCallerAbandonCreateState','minutes','[rescheduleContact][Abandoned]','Abandoned','calleridnum','[syncAgentComplete][createHistory][11]','channel','actionid','strategy','rrmemory','roundrobin','isNil','locked','paused','stateinterface','queueBooked','pick','idHopper','decrementOriginate','[syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','queueBookedRR','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20'];(function(_0x27314e,_0x5ec6bf){var _0x803d23=function(_0x222072){while(--_0x222072){_0x27314e['push'](_0x27314e['shift']());}};_0x803d23(++_0x5ec6bf);}(_0x75ce,0x125));var _0xe75c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x75ce[_0x321bb2];return _0x9c12ed;};'use strict';var util=require(_0xe75c('0x0'));var _=require(_0xe75c('0x1'));var uuid=require('uuid');var moment=require(_0xe75c('0x2'));var rr=require('rr');var Redis=require('ioredis');var utils=require(_0xe75c('0x3'));var hopperUtils=require('./utils/hopper');var ut=require(_0xe75c('0x4'));var config=require('../../../config/environment/');var logger=require(_0xe75c('0x5'))('dialer');var loggerBooked=require(_0xe75c('0x5'))('booked');var loggerPredictive=require(_0xe75c('0x5'))(_0xe75c('0x6'));var loggerPredictiveCalls=require(_0xe75c('0x5'))('predictiveCalls');var loggerSyncQueueSummary=require(_0xe75c('0x5'))(_0xe75c('0x7'));var ami=require('../ami');config[_0xe75c('0x8')]=_[_0xe75c('0x9')](config[_0xe75c('0x8')],{'host':_0xe75c('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xe75c('0x8')]));var cmHopper=require('../rpc/cmHopper');var voiceQueueRt=require(_0xe75c('0xb'));var RpcSetting=require(_0xe75c('0xc'));var Interval=require(_0xe75c('0xd'));var Action=require(_0xe75c('0xe'));var History=require(_0xe75c('0xf'));var Final=require(_0xe75c('0x10'));var AgentComplete=require('./models/agentComplete');var QueueCallerAbandon=require(_0xe75c('0x11'));var Hangup=require('./models/hangup');var ipAgi=process[_0xe75c('0x12')][_0xe75c('0x13')]||'127.0.0.1';var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0xe75c('0x14')][_0xe75c('0x15')]=function(_0x1cb008){this[_0xe75c('0x16')]=this[_0xe75c('0x16')]?this[_0xe75c('0x16')][_0xe75c('0x17')](_0x1cb008):_0x1cb008();};function Dialer(_0x14fe6e,_0x3b881b){this[_0xe75c('0x18')]=new Sequence();this[_0xe75c('0x19')]=_0x3b881b;this[_0xe75c('0x1a')]=_0x14fe6e['voiceQueues'];this[_0xe75c('0x1b')]=_0x14fe6e[_0xe75c('0x1b')];this[_0xe75c('0x1c')]=_0x14fe6e[_0xe75c('0x1c')];this[_0xe75c('0x1d')]=_0x14fe6e['trunks'];this[_0xe75c('0x1e')]=config[_0xe75c('0x1e')]||0x2;this[_0xe75c('0x1f')]={};this[_0xe75c('0x20')]={};this[_0xe75c('0x21')]={};this['uniqueId']={};this[_0xe75c('0x22')]={};this[_0xe75c('0x23')]={};this[_0xe75c('0x24')]={};this['ivrOriginated']={};this['queueBooked']={};this['queueBookedRR']={};this[_0xe75c('0x25')]={};ami['on'](_0xe75c('0x26'),this['syncAgentConnect'][_0xe75c('0x27')](this));ami['on'](_0xe75c('0x28'),this[_0xe75c('0x29')]['bind'](this));ami['on'](_0xe75c('0x2a'),this[_0xe75c('0x2b')]['bind'](this));ami['on']('agentcomplete',this['syncAgentComplete']['bind'](this));ami['on'](_0xe75c('0x2c'),this[_0xe75c('0x7')][_0xe75c('0x27')](this));ami['on'](_0xe75c('0x2d'),this[_0xe75c('0x2e')][_0xe75c('0x27')](this));ami['on'](_0xe75c('0x2f'),this[_0xe75c('0x30')][_0xe75c('0x27')](this));ami['on'](_0xe75c('0x31'),this[_0xe75c('0x32')][_0xe75c('0x27')](this));ami['on']('varset',this['syncVarSet'][_0xe75c('0x27')](this));ami['on'](_0xe75c('0x33'),this[_0xe75c('0x34')][_0xe75c('0x27')](this));ami['on']('queuestatuscomplete',this[_0xe75c('0x35')][_0xe75c('0x27')](this));this[_0xe75c('0x36')]();this['loopClearZombieChannels']();RpcSetting[_0xe75c('0x37')]()[_0xe75c('0x38')](function(_0x5b7be2){previewRecallmeReminderInterval=_0x5b7be2['previewRecallmeReminderInterval'];});}function isNotNull(_0x11dba3){return _0x11dba3!==null&&!_[_0xe75c('0x39')](_0x11dba3);}function msgResponse(_0x2275f3,_0x29e586,_0x34de27){return{'action':_0x2275f3,'response':_0x29e586,'message':_0x34de27,'stack':_0x34de27};}function emit(_0x1bc47d,_0x2da5dd,_0x28edfb){io['to'](_0x1bc47d)[_0xe75c('0x3a')](_0x2da5dd,_0x28edfb);}function emitOutboundVoiceQueueSummary(_0x33d11c){if(_0x33d11c[_0xe75c('0x3b')]===_0xe75c('0x3c')){logger[_0xe75c('0x3d')](_0xe75c('0x3e'),util[_0xe75c('0x3f')](_0x33d11c,{'showHidden':![],'depth':null}));emit(util[_0xe75c('0x40')]('voice:queue:%s',_0x33d11c['name']),'voice_queue:save',_0x33d11c);}}function checkGetDataPredictive(_0x5819e3){if(isNotNull(_0x5819e3)&&!_[_0xe75c('0x41')](_0x5819e3)){loggerPredictive[_0xe75c('0x42')](_0xe75c('0x43'));loggerPredictive['info'](_0xe75c('0x44'),_0x5819e3[_0xe75c('0x45')]);loggerPredictive[_0xe75c('0x42')]('Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5819e3[_0xe75c('0x46')]);loggerPredictive['info']('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5819e3['predictiveIntervalDroppedCallsTimeout']);loggerPredictive[_0xe75c('0x42')]('Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5819e3[_0xe75c('0x47')]);loggerPredictive['info'](_0xe75c('0x48'),_0x5819e3[_0xe75c('0x49')]);loggerPredictive['info']('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5819e3[_0xe75c('0x4a')]);loggerPredictive[_0xe75c('0x42')]('---------------------------');if(_0x5819e3[_0xe75c('0x45')]>0x0){if(!_[_0xe75c('0x39')](_0x5819e3[_0xe75c('0x4a')])&&_0x5819e3[_0xe75c('0x4a')]>0x0){return!![];}loggerPredictive[_0xe75c('0x42')](_0xe75c('0x4b'));if(!_['isUndefined'](_0x5819e3['predictiveIntervalAvgHoldtime'])&&_0x5819e3[_0xe75c('0x49')]>0x0){return!![];}loggerPredictive[_0xe75c('0x42')](_0xe75c('0x4c'));}else{loggerPredictive['info']('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0xe75c('0x42')]('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x599186){return function(_0x599293){loggerPredictive['info']('---------\x20ErlangB\x20---------');loggerPredictive[_0xe75c('0x42')](_0xe75c('0x4d'),_0x599293[_0xe75c('0x4e')]);loggerPredictive[_0xe75c('0x42')](_0xe75c('0x4f'),_0x599293['erlangCallToSecond']);loggerPredictive[_0xe75c('0x42')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x599293[_0xe75c('0x50')]);loggerPredictive[_0xe75c('0x42')](_0xe75c('0x51'),_0x599293[_0xe75c('0x52')]);loggerPredictive[_0xe75c('0x42')](_0xe75c('0x53'),_0x599293['erlangAbandonmentRate']);loggerPredictive[_0xe75c('0x42')](_0xe75c('0x54'));_[_0xe75c('0x55')](_0x599186,_0x599293);};}function ifInterval(_0xfe22a9,_0xb08462){if(_['isUndefined'](_0xb08462)){return![];}return utils[_0xe75c('0x56')](undefined,_0xb08462)<_0xfe22a9*0x3c;}function clearPredictiveAttributes(_0x300238){if(_0x300238[_0xe75c('0x24')]){_0x300238[_0xe75c('0x24')]=undefined;loggerPredictive['debug'](_0x300238[_0xe75c('0x57')],'startProgressive\x20value\x20cleared');}if(_0x300238[_0xe75c('0x23')]){_0x300238[_0xe75c('0x23')]=undefined;loggerPredictive['debug'](_0x300238[_0xe75c('0x57')],'startPredictive\x20value\x20cleared');}if(_0x300238[_0xe75c('0x58')]){clearInterval(_0x300238['handlePredictive']);_0x300238[_0xe75c('0x58')]=undefined;loggerPredictive[_0xe75c('0x3d')](_0x300238[_0xe75c('0x57')],'handlePredictive\x20interval\x20cleared');}}function loggerCatchPredictive(_0x22f510,_0x3753e0){return function(_0x3a9d07){loggerPredictive['error'](_0x3753e0[_0xe75c('0x57')],_0x22f510);loggerPredictive[_0xe75c('0x59')](_0x3a9d07['stack']);clearPredictiveAttributes(_0x3753e0);};}function loggerCatch(_0x2f5383){return function(_0x26dedd){logger[_0xe75c('0x59')](_0x2f5383,util['inspect'](_0x26dedd,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x1ee90d){return function(_0x246662){if(isNotNull(_0x246662)&&isNotNull(_0x246662[0x0])){if(_0x246662[0x0][_0xe75c('0x5a')]>0x0){_0x1ee90d['message']=utils['CAMPAIGN_STATUS'][_0xe75c('0x5b')];logger[_0xe75c('0x42')](_0xe75c('0x5c')+_0x1ee90d['name'],_0x246662[0x0]['contactsRescheduled'],_0xe75c('0x5d'));}else{_0x1ee90d[_0xe75c('0x5e')]=utils[_0xe75c('0x5f')][_0xe75c('0x60')];logger[_0xe75c('0x42')]('[getContactDialer2][Empty]'+_0x1ee90d[_0xe75c('0x57')]);}}};}function createObjHistory(_0x4d4800,_0x5e4eaa,_0x2ea2a8,_0x44a4d6,_0x87949c){_0x4d4800[_0xe75c('0x5e')]=_0x2ea2a8;var _0x3ababd=new Action(_0x4d4800,_0x5e4eaa);var _0x176ffc=new History(_0x3ababd);_0x176ffc[_0xe75c('0x61')]=_0x44a4d6;_0x176ffc[_0xe75c('0x62')]=_0x87949c;_0x176ffc[_0xe75c('0x63')]=_0x3ababd[_0xe75c('0x64')];return _0x176ffc;}function unlockQueueStatus(_0x309fe4,_0x5a5ae5){setTimeout(function(){if(_['isUndefined'](_0x309fe4[_0xe75c('0x65')])){loggerBooked[_0xe75c('0x59')](_0xe75c('0x66'),_0x5a5ae5);}_0x309fe4[_0xe75c('0x65')]=!![];loggerBooked[_0xe75c('0x42')]('[booked][unlockQueueStatus]',_0x5a5ae5,JSON[_0xe75c('0x67')](_['pick'](_0x309fe4,[_0xe75c('0x57'),_0xe75c('0x65')])));},0x1f3);}function checkInterval(_0x4802b7){return function(){if(!isNotNull(_0x4802b7['Interval'])){_0x4802b7[_0xe75c('0x5e')]=utils['CAMPAIGN_STATUS']['NULL_INTERVAL'];throw _0x4802b7['name']+_0xe75c('0x68');}if(!isNotNull(_0x4802b7[_0xe75c('0x69')][_0xe75c('0x6a')])){_0x4802b7[_0xe75c('0x5e')]=utils['CAMPAIGN_STATUS'][_0xe75c('0x6b')];throw _0x4802b7[_0xe75c('0x57')]+_0xe75c('0x68');}if(!isNotNull(_['isEmpty'](_0x4802b7['Interval']['Intervals']))){_0x4802b7['message']=utils[_0xe75c('0x5f')][_0xe75c('0x6b')];throw _0x4802b7[_0xe75c('0x57')]+'\x20INTERVAL_IS_NULL';}};}function checkIsIVRCampaignActive(_0x21fcad){return function(){if(!utils['isIVRCampaignActive'](_0x21fcad)){_0x21fcad[_0xe75c('0x5e')]=utils[_0xe75c('0x5f')][_0xe75c('0x6c')];throw _0x21fcad[_0xe75c('0x57')]+_0xe75c('0x6d');}};}function emitCampaignSummary(_0x53599e){if(utils[_0xe75c('0x6e')](_0x53599e)){emit(util['format'](_0xe75c('0x6f'),_0x53599e[_0xe75c('0x57')]),_0xe75c('0x70'),_0x53599e);}}function loggerCatchQueueSummary(_0x33628b,_0x224613){return function(_0x2e1b8a){clearPredictiveAttributes(_0x224613);emitCampaignSummary(_0x224613);loggerSyncQueueSummary[_0xe75c('0x3d')](_0x33628b,util[_0xe75c('0x3f')](_0x2e1b8a,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x53c1bd){if(_0x53c1bd[_0xe75c('0x71')]){if(_0x53c1bd['originated']===0x0){_0x53c1bd['sendMessageOneNotActive']=![];_0x53c1bd[_0xe75c('0x5e')]=utils['CAMPAIGN_STATUS'][_0xe75c('0x6c')];loggerSyncQueueSummary['debug'](_0xe75c('0x72'),_0x53c1bd[_0xe75c('0x57')],'is\x20not\x20active');}else{_0x53c1bd['message']=utils[_0xe75c('0x5f')][_0xe75c('0x73')];loggerSyncQueueSummary['debug'](_0xe75c('0x72'),_0x53c1bd[_0xe75c('0x57')],_0xe75c('0x74'));}emitCampaignSummary(_0x53c1bd);}}function myreject(_0x9e7d98){return function(_0x6e8de1){return _0x9e7d98(msgResponse(_0xe75c('0x75'),_0xe75c('0x76'),JSON[_0xe75c('0x67')](_0x6e8de1)));};}Dialer[_0xe75c('0x14')][_0xe75c('0x77')]=function(_0x1653cb){return!_[_0xe75c('0x39')](_0x1653cb)&&_0x1653cb&&!_[_0xe75c('0x39')](_0x1653cb[_0xe75c('0x57')])&&!_[_0xe75c('0x39')](_0x1653cb['active'])&&_0x1653cb[_0xe75c('0x78')]&&(this[_0xe75c('0x1d')][util['format'](_0xe75c('0x79'),_0x1653cb['name'])][_0xe75c('0x7a')]===_0xe75c('0x7b')||this[_0xe75c('0x1d')][util[_0xe75c('0x40')](_0xe75c('0x79'),_0x1653cb[_0xe75c('0x57')])][_0xe75c('0x7a')]==='unmonitored');};Dialer['prototype'][_0xe75c('0x7c')]=function(_0x5c7182){var _0x3a1d0f=this;return function(){if(!_0x3a1d0f[_0xe75c('0x77')](_0x5c7182[_0xe75c('0x7d')])){if(!_0x3a1d0f[_0xe75c('0x77')](_0x5c7182['TrunkBackup'])){_0x5c7182[_0xe75c('0x5e')]=utils['CAMPAIGN_STATUS'][_0xe75c('0x7e')];throw _0x5c7182[_0xe75c('0x57')]+_0xe75c('0x7f');}}};};Dialer[_0xe75c('0x14')][_0xe75c('0x80')]=function(_0x41e9d0,_0x70939c,_0x137077,_0x477bca){var _0x2bdbad=this;return function(){var _0x3e52d5=!![];return _0x2bdbad[_0xe75c('0x81')](_0x41e9d0,_0x70939c,_0x137077,_0x477bca,_0x3e52d5);};};Dialer[_0xe75c('0x14')][_0xe75c('0x82')]=function(_0x55ed47,_0x4ba75d,_0x12cffc,_0x2fd8fb){var _0x253ef4=this;return function(){var _0x4bf86a=![];return _0x253ef4['ifTimeIvr'](_0x55ed47[_0xe75c('0x6a')],_0x4ba75d,_0x12cffc,_0x2fd8fb,_0x4bf86a);};};Dialer[_0xe75c('0x14')][_0xe75c('0x81')]=function(_0x37c018,_0x23c955,_0x1078be,_0x5db489,_0x2cceec){var _0xe6a953=[];return new Promise(function(_0x218fdc,_0xa9d969){if(!isNotNull(_0x37c018)){_0x5db489[_0xe75c('0x5e')]=utils['CAMPAIGN_STATUS'][_0xe75c('0x6b')];return _0xa9d969(msgResponse('ifTime',_0xe75c('0x83'),_0x1078be+_0xe75c('0x84')));}if(_[_0xe75c('0x41')](_0x37c018)){_0x5db489[_0xe75c('0x5e')]=utils[_0xe75c('0x5f')]['EMPTY_INTERVAL'];return _0xa9d969(msgResponse('ifTime',_0xe75c('0x83'),_0x1078be+'\x20Intervals\x20is\x20empty\x20'));}if(_0x23c955&&_[_0xe75c('0x39')](config[_0xe75c('0x85')][_0x23c955])){_0x5db489[_0xe75c('0x5e')]=utils['CAMPAIGN_STATUS']['UNKNOWN_TIMEZONE'];return _0xa9d969(msgResponse(_0xe75c('0x86'),'Failure',_0x1078be+'\x20Timezone\x20unknow\x20'+_0x23c955));}if(_[_0xe75c('0x87')](_0x37c018)){for(var _0x5f2a36=0x0;_0x5f2a36<_0x37c018[_0xe75c('0x88')];_0x5f2a36+=0x1){_0xe6a953[_0xe75c('0x89')](ami[_0xe75c('0x8a')]({'action':'command','command':util[_0xe75c('0x40')](_0xe75c('0x8b'),_0x37c018[_0x5f2a36][_0xe75c('0x8c')],!_[_0xe75c('0x39')](config[_0xe75c('0x85')][_0x23c955])?_0x23c955:'')})[_0xe75c('0x38')](function(_0x3b32ea){return _0x3b32ea[_0xe75c('0x8d')]['indexOf']('true')>=0x0;})[_0xe75c('0x8e')](myreject(_0xa9d969)));}}else{_0xe6a953[_0xe75c('0x89')](ami[_0xe75c('0x8a')]({'action':_0xe75c('0x8f'),'command':util[_0xe75c('0x40')](_0xe75c('0x8b'),_0x37c018,!_[_0xe75c('0x39')](config[_0xe75c('0x85')][_0x23c955])?_0x23c955:'')})[_0xe75c('0x38')](function(_0x293444){return _0x293444['content']['indexOf']('true')>=0x0;})['catch'](myreject(_0xa9d969)));}Promise[_0xe75c('0x90')](_0xe6a953)[_0xe75c('0x38')](function(_0x8f7a68){var _0x1faafc=_['some'](_0x8f7a68);if(_0x1faafc){return _0x218fdc(_0x1faafc);}else{_0x5db489[_0xe75c('0x5e')]=_0x2cceec?utils['CAMPAIGN_STATUS'][_0xe75c('0x91')]:utils[_0xe75c('0x5f')][_0xe75c('0x92')];return _0xa9d969(msgResponse(_0xe75c('0x93'),'Failure',_0xe75c('0x94')+_0x2cceec+'\x20'+_0x1078be+'\x20Interval\x20is\x20overtime:\x20'+util[_0xe75c('0x3f')](_0x37c018,{'showHidden':![],'depth':null})+_0xe75c('0x95')+_0x23c955));}})['catch'](function(_0x39e698){return _0xa9d969(msgResponse(_0xe75c('0x86'),_0xe75c('0x83'),JSON[_0xe75c('0x67')](_0x39e698)));});});};Dialer[_0xe75c('0x14')][_0xe75c('0x36')]=function(){var _0x56e190=this;return cmHopper['resetActiveCalls']({'active':![]},{'where':{'active':!![]}})[_0xe75c('0x38')](function(){setInterval(function(){_0x56e190[_0xe75c('0x96')]();},0x3e8);});};Dialer['prototype']['syncCampaigns']=function(){var _0x5a9aa3=this;var _0x456e8d;for(var _0x18cde3 in this['campaigns']){if(typeof this['campaigns'][_0x18cde3]!==_0xe75c('0x97')){_0x456e8d=this[_0xe75c('0x1b')][_0x18cde3];if(utils[_0xe75c('0x6e')](_0x456e8d)&&utils[_0xe75c('0x98')](_0x456e8d)){_0x456e8d[_0xe75c('0x71')]=!![];Promise[_0xe75c('0x99')]()['then'](checkIsIVRCampaignActive(_0x456e8d))['then'](checkInterval(_0x456e8d))[_0xe75c('0x38')](_0x5a9aa3['checkIsTrunkReachable'](_0x456e8d))['then'](_0x5a9aa3['checkIfTime'](_0x456e8d[_0xe75c('0x9a')],_0x456e8d[_0xe75c('0x9b')],_0x456e8d[_0xe75c('0x57')],_0x456e8d))['then'](_0x5a9aa3['checkIfTimeIntervals'](_0x456e8d[_0xe75c('0x69')],_0x456e8d[_0xe75c('0x9b')],_0x456e8d[_0xe75c('0x57')],_0x456e8d))[_0xe75c('0x38')](_0x5a9aa3[_0xe75c('0x9c')](_0x456e8d))[_0xe75c('0x8e')](loggerCatchQueueSummary(_0xe75c('0x9d'),_0x456e8d));}else{notSendMessagesCampaign(_0x456e8d);}}}};Dialer[_0xe75c('0x14')][_0xe75c('0x9e')]=function(_0x2ef871){if(_0x2ef871[_0xe75c('0x9f')]!==_0xe75c('0x6')){clearPredictiveAttributes(_0x2ef871);}switch(_0x2ef871[_0xe75c('0x9f')]){case _0xe75c('0xa0'):this['handlePower'](_0x2ef871,0x1);break;case _0xe75c('0xa1'):this[_0xe75c('0xa2')](_0x2ef871,_0x2ef871[_0xe75c('0xa3')]);break;case _0xe75c('0x6'):this[_0xe75c('0x6')](_0x2ef871);break;case _0xe75c('0xa4'):this[_0xe75c('0xa2')](_0x2ef871,0x1);break;default:logger[_0xe75c('0x59')](_0xe75c('0xa5'),_0x2ef871[_0xe75c('0x57')],_0xe75c('0xa6'));}};Dialer[_0xe75c('0x14')][_0xe75c('0x86')]=function(_0x2b4eae,_0x2c7230){var _0x5ccc2b=_0x2b4eae[_0xe75c('0x9b')];var _0x121b95=_0x2c7230?_0x2b4eae[_0xe75c('0x9a')]:_0x2b4eae[_0xe75c('0x69')][_0xe75c('0x6a')];logger['silly'](_0xe75c('0xa7'),_0x121b95,_0x5ccc2b,_0x2b4eae[_0xe75c('0x57')],util[_0xe75c('0x40')](_0xe75c('0xa8'),_0x2b4eae[_0xe75c('0x57')],_0x2b4eae['id']));var _0x552c97=null;return Interval['intervalIftime'](_0x121b95,_0x5ccc2b)['then'](function(_0x2a42a9){if(_0x2a42a9===!![]){return _0x2a42a9;}else{_0x2b4eae[_0xe75c('0x5e')]=_0x2c7230?utils['CAMPAIGN_STATUS'][_0xe75c('0x91')]:utils[_0xe75c('0x5f')][_0xe75c('0x92')];_0x552c97=msgResponse(_0xe75c('0x93'),'Failure',_0xe75c('0x94')+_0x2c7230+'\x20'+_0x2b4eae['name']+_0xe75c('0xa9')+util['inspect'](_0x121b95,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x5ccc2b);}if(_0x552c97!==null){logger[_0xe75c('0xaa')](_0xe75c('0xab'),_0x552c97);_0x552c97[_0xe75c('0xac')]=_0x2c7230;throw _0x552c97;}})['catch'](function(_0x5c55c9){logger[_0xe75c('0x59')](_0xe75c('0xad'),_0x5c55c9);throw msgResponse(_0xe75c('0x75'),'Error',util[_0xe75c('0x3f')](_0x5c55c9,{'showHidden':![],'depth':null}));});};Dialer[_0xe75c('0x14')][_0xe75c('0xae')]=function(_0x22049f){if(this['voiceQueues'][_0x22049f[_0xe75c('0xaf')]]){if(this[_0xe75c('0xb0')][_0x22049f[_0xe75c('0xb1')]]&&this[_0xe75c('0xb0')][_0x22049f[_0xe75c('0xb1')]][_0xe75c('0x3b')]!==_0xe75c('0xb2')){utils['decrementOriginate'](this[_0xe75c('0x1a')][_0x22049f[_0xe75c('0xaf')]],'[syncAgentConnect]');this['uniqueId'][_0x22049f[_0xe75c('0xb1')]][_0xe75c('0xb3')]=moment()['format'](_0xe75c('0xb4'));}}};Dialer[_0xe75c('0x14')][_0xe75c('0xb5')]=function(_0x5a8e8){var _0xa250d3=this[_0xe75c('0xb0')][_0x5a8e8[_0xe75c('0xb1')]];if(this['voiceQueues'][_0x5a8e8[_0xe75c('0xaf')]]){if(_0xa250d3&&_0xa250d3['type']!==_0xe75c('0xb2')){delete this[_0xe75c('0xb0')][_0x5a8e8[_0xe75c('0xb1')]];this['voiceQueues'][_0x5a8e8['queue']]['outboundAnswerCallsDay']+=0x1;var _0x3c9eb7=new AgentComplete(_0xa250d3,_0x5a8e8);if(_0x5a8e8['reason']===_0xe75c('0xb6')){_0x3c9eb7['agiafterat']=this[_0xe75c('0x1a')][_0x5a8e8[_0xe75c('0xaf')]]['dialQueueProject2']&&this[_0xe75c('0x1a')][_0x5a8e8['queue']][_0xe75c('0xb7')]?moment()[_0xe75c('0x40')](_0xe75c('0xb4')):undefined;}hopperUtils[_0xe75c('0xb8')](_0x3c9eb7)[_0xe75c('0x8e')](loggerCatch(_0xe75c('0xb9')));hopperUtils[_0xe75c('0xba')](_0x3c9eb7)[_0xe75c('0x8e')](loggerCatch(_0xe75c('0xbb')));}}};Dialer['prototype'][_0xe75c('0x29')]=function(_0x126e91){var _0x337dc7=this[_0xe75c('0xb0')][_0x126e91[_0xe75c('0xb1')]];var _0x4d6f53=this;var _0x138588=![];var _0x3ae3d0;var _0x273ee4;if(this[_0xe75c('0x1a')][_0x126e91[_0xe75c('0xaf')]]){if(_0x337dc7&&_0x337dc7[_0xe75c('0x3b')]!=='ivr'){delete this['uniqueId'][_0x126e91['uniqueid']];utils['decrementOriginate'](this[_0xe75c('0x1a')][_0x126e91[_0xe75c('0xaf')]],'[syncQueueCallerAbandon]');_0x337dc7['droptime']=moment()[_0xe75c('0x40')](_0xe75c('0xb4'));var _0x5292af=new QueueCallerAbandon(_0x337dc7,_0x126e91);if(utils[_0xe75c('0x56')](_0x337dc7[_0xe75c('0xbc')],_0x337dc7[_0xe75c('0xbd')])>=_0x337dc7['dialQueueTimeout']){this['voiceQueues'][_0x126e91[_0xe75c('0xaf')]][_0xe75c('0xbe')]+=0x1;this[_0xe75c('0x1a')][_0x126e91['queue']][_0xe75c('0xbf')]+=0x1;this[_0xe75c('0x1a')][_0x126e91[_0xe75c('0xaf')]][_0xe75c('0xc0')]+=0x1;_0x5292af['state']=0xa;_0x5292af[_0xe75c('0x62')]=_0xe75c('0xc1');_0x5292af[_0xe75c('0xc2')]=_0xe75c('0xc3');_0x5292af[_0xe75c('0xc4')]=this[_0xe75c('0x1a')][_0x126e91['queue']]['dialQueueProject2']?moment()[_0xe75c('0x40')](_0xe75c('0xb4')):undefined;_0x5292af[_0xe75c('0xc5')]+=0x1;_0x5292af['countglobal']+=0x1;_0x3ae3d0=this[_0xe75c('0x1a')][_0x126e91[_0xe75c('0xaf')]][_0xe75c('0xc6')];_0x273ee4=this[_0xe75c('0x1a')][_0x126e91['queue']][_0xe75c('0xc7')];hopperUtils[_0xe75c('0xc8')](_0x5292af,_0x5292af[_0xe75c('0x61')],_0x337dc7[_0xe75c('0xc9')])[_0xe75c('0x38')](function(_0x239f42){_0x138588=_0x239f42[_0xe75c('0xca')]==0x1;if(_0x5292af['countdropretry']>=_0x4d6f53[_0xe75c('0x1a')][_0x126e91['queue']][_0xe75c('0xcb')]){_0x4d6f53['queueCallerAbandonCreateState'](_0x5292af,_0x239f42[_0xe75c('0xca')]);}else{hopperUtils[_0xe75c('0xcc')]({'active':![],'countdropretry':_0x5292af[_0xe75c('0xc5')],'scheduledat':moment()[_0xe75c('0xcd')](_0x4d6f53[_0xe75c('0x1a')][_0x126e91[_0xe75c('0xaf')]][_0xe75c('0xc6')],'minutes')[_0xe75c('0x40')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x337dc7[_0xe75c('0xce')],'ListId':_0x337dc7[_0xe75c('0xcf')],'VoiceQueueId':_0x337dc7[_0xe75c('0xd0')]||undefined,'CampaignId':_0x337dc7[_0xe75c('0xd1')]||undefined})['catch'](loggerCatch(_0xe75c('0xd2')));var _0x46e2ef=new History(_0x5292af);_0x46e2ef[_0xe75c('0x61')]=0xa;_0x46e2ef[_0xe75c('0x62')]=_0xe75c('0xc1');_0x46e2ef[_0xe75c('0x64')]=moment()['format'](_0xe75c('0xb4'));_0x46e2ef[_0xe75c('0x63')]=_0x46e2ef['starttime'];_0x46e2ef[_0xe75c('0xd3')]=_0x5292af['calleridname'];_0x46e2ef['calleridnum']=_0x5292af['calleridnum'];hopperUtils[_0xe75c('0xb8')](_0x46e2ef)['catch'](loggerCatch(_0xe75c('0xd4')));}})['then'](function(){if(_0x138588)hopperUtils[_0xe75c('0xd5')](_0x5292af,_0x3ae3d0,_0x273ee4)[_0xe75c('0x38')](function(){return 0x1;});});}else{this['voiceQueues'][_0x126e91[_0xe75c('0xaf')]][_0xe75c('0x47')]+=0x1;this['voiceQueues'][_0x126e91[_0xe75c('0xaf')]][_0xe75c('0xd6')]+=0x1;_0x5292af['state']=0xb;_0x5292af[_0xe75c('0x62')]='Abandoned';_0x5292af[_0xe75c('0xc2')]=_0xe75c('0xd7');_0x5292af[_0xe75c('0xd8')]+=0x1;_0x5292af['countglobal']+=0x1;_0x3ae3d0=this['voiceQueues'][_0x126e91[_0xe75c('0xaf')]][_0xe75c('0xd9')];_0x273ee4=this[_0xe75c('0x1a')][_0x126e91[_0xe75c('0xaf')]][_0xe75c('0xc7')];hopperUtils['verifyAdditionalPhones'](_0x5292af,_0x5292af['state'],_0x337dc7[_0xe75c('0xc9')])[_0xe75c('0x38')](function(_0x411129){if(_0x5292af[_0xe75c('0xd8')]>=_0x4d6f53[_0xe75c('0x1a')][_0x126e91[_0xe75c('0xaf')]][_0xe75c('0xda')]){_0x4d6f53[_0xe75c('0xdb')](_0x5292af,_0x411129[_0xe75c('0xca')]);}else{hopperUtils[_0xe75c('0xcc')]({'active':![],'countabandonedretry':_0x5292af['countabandonedretry'],'scheduledat':moment()[_0xe75c('0xcd')](_0x4d6f53['voiceQueues'][_0x126e91[_0xe75c('0xaf')]][_0xe75c('0xd9')],_0xe75c('0xdc'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x337dc7['ContactId'],'ListId':_0x337dc7[_0xe75c('0xcf')],'VoiceQueueId':_0x337dc7[_0xe75c('0xd0')]||undefined,'CampaignId':_0x337dc7[_0xe75c('0xd1')]||undefined})[_0xe75c('0x8e')](loggerCatch(_0xe75c('0xdd')));var _0xe875ee=new History(_0x5292af);_0xe875ee['state']=0xb;_0xe875ee[_0xe75c('0x62')]=_0xe75c('0xde');_0xe875ee[_0xe75c('0x64')]=moment()[_0xe75c('0x40')]('YYYY-MM-DD\x20HH:mm:ss');_0xe875ee[_0xe75c('0x63')]=_0xe875ee[_0xe75c('0x64')];_0xe875ee[_0xe75c('0xd3')]=_0x5292af[_0xe75c('0xd3')];_0xe875ee[_0xe75c('0xdf')]=_0x5292af[_0xe75c('0xdf')];hopperUtils['createHistory'](_0xe875ee)[_0xe75c('0x8e')](loggerCatch(_0xe75c('0xe0')));}})['then'](function(){if(_0x138588)hopperUtils[_0xe75c('0xd5')](_0x5292af,_0x3ae3d0,_0x273ee4)[_0xe75c('0x38')](function(){return 0x1;});});}}}};Dialer[_0xe75c('0x14')][_0xe75c('0x32')]=function(_0x460756){if(this[_0xe75c('0x20')][_0x460756[_0xe75c('0xb1')]]){this[_0xe75c('0x20')][_0x460756[_0xe75c('0xb1')]]['channel']=_0x460756[_0xe75c('0xe1')];}if(this[_0xe75c('0xb0')][_0x460756[_0xe75c('0xb1')]]){this['uniqueId'][_0x460756[_0xe75c('0xb1')]]['channel']=_0x460756[_0xe75c('0xe1')];}};Dialer[_0xe75c('0x14')][_0xe75c('0x34')]=function(_0x75b6f4){if(!this[_0xe75c('0x20')][_0x75b6f4[_0xe75c('0xe2')]]){return;}var _0x30abf6=this[_0xe75c('0x1a')][this[_0xe75c('0x20')][_0x75b6f4[_0xe75c('0xe2')]][_0xe75c('0xaf')]][_0xe75c('0xe3')]||_0xe75c('0xe4');if(_0x30abf6===_0xe75c('0xe5')){if(this[_0xe75c('0x20')][_0x75b6f4[_0xe75c('0xe2')]]&&_[_0xe75c('0xe6')](this[_0xe75c('0x20')][_0x75b6f4[_0xe75c('0xe2')]][_0xe75c('0xe7')])&&_0x75b6f4[_0xe75c('0x7a')]==='1'&&_0x75b6f4[_0xe75c('0xe8')]==='0'){if(this['agents'][_0x75b6f4[_0xe75c('0xe9')]]){if(!this[_0xe75c('0x1c')][_0x75b6f4[_0xe75c('0xe9')]][_0xe75c('0xe7')]){this[_0xe75c('0x1c')][_0x75b6f4['stateinterface']][_0xe75c('0xe7')]=!![];this[_0xe75c('0x20')][_0x75b6f4[_0xe75c('0xe2')]][_0xe75c('0xe7')]=!![];this[_0xe75c('0x20')][_0x75b6f4['actionid']][_0xe75c('0xe9')]=_0x75b6f4['stateinterface'];}}}}else if(_0x30abf6===_0xe75c('0xe4')){if(this[_0xe75c('0x20')][_0x75b6f4[_0xe75c('0xe2')]]){if(this[_0xe75c('0x1c')][_0x75b6f4[_0xe75c('0xe9')]]){this[_0xe75c('0x20')][_0x75b6f4[_0xe75c('0xe2')]][_0xe75c('0xe9')]=_0x75b6f4[_0xe75c('0xe9')];if(_['isNil'](this[_0xe75c('0xea')][this[_0xe75c('0x20')][_0x75b6f4[_0xe75c('0xe2')]][_0xe75c('0xaf')]])){this['queueBooked'][this[_0xe75c('0x20')][_0x75b6f4[_0xe75c('0xe2')]]['queue']]=[];}this[_0xe75c('0xea')][this[_0xe75c('0x20')][_0x75b6f4['actionid']]['queue']][_0xe75c('0x89')](_['merge'](_[_0xe75c('0xeb')](this[_0xe75c('0x20')][_0x75b6f4[_0xe75c('0xe2')]],[_0xe75c('0xec'),_0xe75c('0xe9')]),{'status':_0x75b6f4[_0xe75c('0x7a')],'paused':_0x75b6f4[_0xe75c('0xe8')]}));}}}};Dialer[_0xe75c('0x14')][_0xe75c('0x35')]=function(_0x24150f){if(!this[_0xe75c('0x20')][_0x24150f[_0xe75c('0xe2')]]){return;}var _0xc73cf6=this;var _0x2485bf=this[_0xe75c('0x1a')][this['actions'][_0x24150f[_0xe75c('0xe2')]][_0xe75c('0xaf')]];var _0x4a0b15=_0x2485bf[_0xe75c('0xe3')]||_0xe75c('0xe4');if(_0x4a0b15===_0xe75c('0xe5')){if(this[_0xe75c('0x20')][_0x24150f['actionid']]&&this[_0xe75c('0x20')][_0x24150f[_0xe75c('0xe2')]][_0xe75c('0xe9')]){this[_0xe75c('0x19')]['run'](this[_0xe75c('0x20')][_0x24150f['actionid']][_0xe75c('0xec')],this[_0xe75c('0x20')][_0x24150f[_0xe75c('0xe2')]][_0xe75c('0xe9')])[_0xe75c('0x8e')](function(_0x32a92a){logger[_0xe75c('0x59')]('[Catch][Preview][syncQueueStatusComplete]',util[_0xe75c('0x3f')](_0x32a92a,{'showHidden':![],'depth':null}));})[_0xe75c('0x17')](function(){utils[_0xe75c('0xed')](_0xc73cf6[_0xe75c('0x1a')][_0xc73cf6[_0xe75c('0x20')][_0x24150f['actionid']][_0xe75c('0xaf')]],'[syncQueueStatusComplete]');_0xc73cf6[_0xe75c('0x1c')][_0xc73cf6[_0xe75c('0x20')][_0x24150f[_0xe75c('0xe2')]][_0xe75c('0xe9')]][_0xe75c('0xe7')]=![];delete _0xc73cf6[_0xe75c('0x20')][_0x24150f[_0xe75c('0xe2')]];unlockQueueStatus(_0x2485bf);});}else{utils[_0xe75c('0xed')](this[_0xe75c('0x1a')][this[_0xe75c('0x20')][_0x24150f['actionid']]['queue']],_0xe75c('0xee'));hopperUtils[_0xe75c('0xcc')]({'active':![],'ContactId':this[_0xe75c('0x20')][_0x24150f[_0xe75c('0xe2')]][_0xe75c('0xce')],'ListId':this['actions'][_0x24150f[_0xe75c('0xe2')]][_0xe75c('0xcf')],'VoiceQueueId':this[_0xe75c('0x20')][_0x24150f[_0xe75c('0xe2')]][_0xe75c('0xd0')]||undefined,'CampaignId':this[_0xe75c('0x20')][_0x24150f[_0xe75c('0xe2')]]['CampaignId']||undefined})['catch'](loggerCatch(_0xe75c('0xef')));delete this['actions'][_0x24150f[_0xe75c('0xe2')]];unlockQueueStatus(_0x2485bf);}}else if(_0x4a0b15===_0xe75c('0xe4')){var _0x39f195;if(this[_0xe75c('0x20')][_0x24150f['actionid']]&&!_[_0xe75c('0x41')](this[_0xe75c('0xea')][this[_0xe75c('0x20')][_0x24150f['actionid']][_0xe75c('0xaf')]])){if(this[_0xe75c('0xf0')][_0xc73cf6[_0xe75c('0x20')][_0x24150f[_0xe75c('0xe2')]][_0xe75c('0xaf')]]){this[_0xe75c('0xf0')][_0xc73cf6[_0xe75c('0x20')][_0x24150f[_0xe75c('0xe2')]][_0xe75c('0xaf')]]=this[_0xe75c('0xf0')][this['actions'][_0x24150f[_0xe75c('0xe2')]][_0xe75c('0xaf')]]?this['queueBookedRR'][this[_0xe75c('0x20')][_0x24150f[_0xe75c('0xe2')]]['queue']]:this['queueBooked'][this['actions'][_0x24150f[_0xe75c('0xe2')]][_0xe75c('0xaf')]]?this[_0xe75c('0xea')][this['actions'][_0x24150f['actionid']][_0xe75c('0xaf')]][_0xe75c('0xf1')]||0x0:0x0;}this[_0xe75c('0xea')][this[_0xe75c('0x20')][_0x24150f[_0xe75c('0xe2')]]['queue']][_0xe75c('0xf1')]=this['queueBookedRR'][this[_0xe75c('0x20')][_0x24150f[_0xe75c('0xe2')]][_0xe75c('0xaf')]];for(var _0x3f8ae5=0x0;_0x3f8ae5=_0xbf8e5b[_0xe75c('0x11e')]){_0x1dfad2[_0xe75c('0x11f')](_0xf06859,_0x471b96,_0x8c8db1,_0xe75c('0x120'));}else{if(_0xf06859[_0xe75c('0x116')]>=_0xbf8e5b[_0xe75c('0x121')]){_0x1dfad2['createStateFinal'](_0xf06859,_0x471b96,_0x8c8db1,'reason\x2019\x20machine....');}else{hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0xf06859['countmachineretry'],'scheduledat':moment()[_0xe75c('0xcd')](_0xbf8e5b[_0xe75c('0x122')],_0xe75c('0xdc'))[_0xe75c('0x40')](_0xe75c('0xb4')),'ContactId':_0xf06859[_0xe75c('0xce')],'ListId':_0xf06859[_0xe75c('0xcf')],'VoiceQueueId':_0xf06859['VoiceQueueId']||undefined,'CampaignId':_0xf06859[_0xe75c('0xd1')]||undefined})['catch'](loggerCatch(_0xe75c('0x123')));_0x471b96({'reschedule':0x1});}}});}if(_0x44beac['type']==='ivr'&&this[_0xe75c('0x1b')][_0x44beac[_0xe75c('0xaf')]]['dialAMDActive']&&_0x2e88a1[_0xe75c('0x107')]===_0xe75c('0x108')){delete this[_0xe75c('0xb0')][_0x2e88a1[_0xe75c('0xb1')]];utils[_0xe75c('0xed')](this[_0xe75c('0x1b')][_0x44beac[_0xe75c('0xaf')]],'[syncVarSet]');_0x19b04f=new Hangup(_0x44beac,_0x2e88a1);_0x19b04f[_0xe75c('0x61')]=0x12;_0x19b04f[_0xe75c('0x62')]=_0xe75c('0x10b');_0x19b04f[_0xe75c('0x115')]='AMD';ami[_0xe75c('0x3a')](_0xe75c('0x10d'),ut['buildObj'](_0x19b04f,_0xe75c('0x10f')));this[_0xe75c('0x124')](_0x19b04f,_0xe75c('0x125'),_0xe75c('0x126'));}if(_0x44beac[_0xe75c('0x3b')]===_0xe75c('0xb2')&&this['campaigns'][_0x44beac[_0xe75c('0xaf')]]['dialAMDActive']&&_0x2e88a1[_0xe75c('0x107')]==='MACHINE'){return new Promise(function(_0x25cb8c,_0x81c03f){delete _0x1dfad2[_0xe75c('0xb0')][_0x2e88a1[_0xe75c('0xb1')]];utils[_0xe75c('0xed')](_0x1dfad2[_0xe75c('0x1b')][_0x44beac[_0xe75c('0xaf')]],'[syncVarSet]');_0x1dfad2[_0xe75c('0x1b')][_0x44beac[_0xe75c('0xaf')]]['outboundAnswerCallsDay']+=0x1;_0x1dfad2[_0xe75c('0x1b')][_0x44beac['queue']][_0xe75c('0x10a')]+=0x1;var _0x37b800=_0x1dfad2[_0xe75c('0x1b')][_0x44beac['queue']];var _0x5306f6=new Hangup(_0x44beac,_0x2e88a1);_0x5306f6['state']=0x13;_0x5306f6['statedesc']=_0xe75c('0x114');_0x5306f6[_0xe75c('0x115')]='AMD';_0x5306f6['countmachineretry']+=0x1;_0x5306f6[_0xe75c('0x117')]+=0x1;_0x5306f6[_0xe75c('0x10f')]=!![];ami[_0xe75c('0x3a')](_0xe75c('0x10d'),ut['buildObj'](_0x5306f6,_0xe75c('0x10f')));hopperUtils[_0xe75c('0xb8')](_0x5306f6)[_0xe75c('0x8e')](loggerCatch(_0xe75c('0x118')));if(_0x5306f6[_0xe75c('0x119')]+_0x5306f6[_0xe75c('0x11a')]+_0x5306f6[_0xe75c('0x11b')]+_0x5306f6[_0xe75c('0x11c')]+_0x5306f6['countdropretry']+_0x5306f6[_0xe75c('0xd8')]+_0x5306f6[_0xe75c('0x116')]+_0x5306f6[_0xe75c('0x11d')]>=_0x37b800[_0xe75c('0x11e')]){_0x1dfad2[_0xe75c('0x11f')](_0x5306f6,_0x25cb8c,_0x81c03f,_0xe75c('0x120'));}else{if(_0x5306f6['countmachineretry']>=_0x37b800['dialMachineMaxRetry']){_0x1dfad2[_0xe75c('0x127')](_0x5306f6,_0x25cb8c,_0x81c03f,_0xe75c('0x128'));}else{hopperUtils[_0xe75c('0xcc')]({'active':![],'countmachineretry':_0x5306f6['countmachineretry'],'scheduledat':moment()[_0xe75c('0xcd')](_0x37b800[_0xe75c('0x122')],_0xe75c('0xdc'))[_0xe75c('0x40')](_0xe75c('0xb4')),'ContactId':_0x5306f6['ContactId'],'ListId':_0x5306f6[_0xe75c('0xcf')],'VoiceQueueId':_0x5306f6[_0xe75c('0xd0')]||undefined,'CampaignId':_0x5306f6[_0xe75c('0xd1')]||undefined})[_0xe75c('0x8e')](loggerCatch(_0xe75c('0x123')));_0x25cb8c({'reschedule':0x1});}}});}}};Dialer[_0xe75c('0x14')]['syncHangup']=function(_0x4f97ae){var _0x92feec=this[_0xe75c('0xb0')][_0x4f97ae[_0xe75c('0xb1')]];var _0x35eabc;if(!_0x92feec){return;}if(_0x92feec[_0xe75c('0x3b')]===_0xe75c('0xb2')){delete this[_0xe75c('0xb0')][_0x4f97ae[_0xe75c('0xb1')]];utils[_0xe75c('0xed')](this['campaigns'][_0x92feec[_0xe75c('0xaf')]],_0xe75c('0x129'));this['campaigns'][_0x92feec[_0xe75c('0xaf')]]['ivrAnswerCallsDay']+=0x1;if(_0x4f97ae[_0xe75c('0x12a')]===_0xe75c('0x12b')){const _0x1756dc=new AgentComplete(_0x92feec,_0x4f97ae);_0x1756dc[_0xe75c('0xd1')]=this[_0xe75c('0x1b')][_0x92feec[_0xe75c('0xaf')]]['id'];hopperUtils['createHistory'](_0x1756dc)[_0xe75c('0x8e')](loggerCatch(_0xe75c('0x12c')));hopperUtils[_0xe75c('0xba')](_0x1756dc)[_0xe75c('0x8e')](loggerCatch(_0xe75c('0x12d')));}else{_0x35eabc=new Hangup(_0x92feec,_0x4f97ae);hopperUtils[_0xe75c('0xb8')](_0x35eabc)[_0xe75c('0x8e')](loggerCatch(_0xe75c('0x12e')));hopperUtils[_0xe75c('0xba')](_0x35eabc)['catch'](loggerCatch(_0xe75c('0x12f')));}}else{if(isNotNull(this['voiceQueues'][_0x92feec['queue']][_0xe75c('0x130')])){delete this[_0xe75c('0xb0')][_0x4f97ae[_0xe75c('0xb1')]];utils[_0xe75c('0xed')](this[_0xe75c('0x1a')][_0x92feec['queue']],_0xe75c('0x129'));this[_0xe75c('0x1a')][_0x92feec[_0xe75c('0xaf')]]['outboundAnswerCallsDay']+=0x1;this[_0xe75c('0x1a')][_0x92feec[_0xe75c('0xaf')]][_0xe75c('0x10a')]+=0x1;_0x35eabc=new Hangup(_0x92feec,_0x4f97ae);_0x35eabc[_0xe75c('0x61')]=0x10;_0x35eabc[_0xe75c('0x62')]=_0xe75c('0x131');_0x35eabc[_0xe75c('0x115')]=_0xe75c('0x132');hopperUtils['createHistory'](_0x35eabc)[_0xe75c('0x8e')](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils[_0xe75c('0xba')](_0x35eabc)[_0xe75c('0x8e')](loggerCatch('[syncHangupIvr]'));}else{delete this[_0xe75c('0xb0')][_0x4f97ae['uniqueid']];utils[_0xe75c('0xed')](this[_0xe75c('0x1a')][_0x92feec[_0xe75c('0xaf')]],_0xe75c('0x133'));if(_0x4f97ae[_0xe75c('0x12a')]==='Normal\x20Clearing'){this[_0xe75c('0x1a')][_0x92feec[_0xe75c('0xaf')]][_0xe75c('0x113')]+=0x1;const _0x8b10de=new AgentComplete(_0x92feec,_0x4f97ae);_0x8b10de[_0xe75c('0xd0')]=this[_0xe75c('0x1a')][_0x92feec['queue']]['id'];hopperUtils[_0xe75c('0xb8')](_0x8b10de)[_0xe75c('0x8e')](loggerCatch(_0xe75c('0xb9')));hopperUtils[_0xe75c('0xba')](_0x8b10de)[_0xe75c('0x8e')](loggerCatch('[syncAgentComplete]'));}else{this[_0xe75c('0x1a')][_0x92feec[_0xe75c('0xaf')]]['outboundUnknownCallsDay']+=0x1;_0x35eabc=new Hangup(_0x92feec,_0x4f97ae);_0x35eabc['state']=0xc;_0x35eabc[_0xe75c('0x62')]=_0x4f97ae[_0xe75c('0x12a')];_0x35eabc[_0xe75c('0x115')]=_0xe75c('0x134');hopperUtils[_0xe75c('0xb8')](_0x35eabc)[_0xe75c('0x8e')](loggerCatch(_0xe75c('0x135')));hopperUtils[_0xe75c('0xba')](_0x35eabc)['catch'](loggerCatch(_0xe75c('0x129')));}}}};Dialer[_0xe75c('0x14')][_0xe75c('0x7')]=function(_0x5b99b7){var _0x12b907=this;if(!_0x12b907[_0xe75c('0x25')][_0x5b99b7['name']]){_0x12b907[_0xe75c('0x25')][_0x5b99b7[_0xe75c('0x57')]]={'running':![]};}else if(_0x12b907['queuesSummary'][_0x5b99b7[_0xe75c('0x57')]][_0xe75c('0x136')]===!![]){return;}else if(_0x12b907['queuesSummary'][_0x5b99b7[_0xe75c('0x57')]][_0xe75c('0x136')]===![]){_0x12b907[_0xe75c('0x25')][_0x5b99b7[_0xe75c('0x57')]][_0xe75c('0x136')]=!![];}var _0x4a39e1=_0x12b907[_0xe75c('0x1a')][_0x5b99b7[_0xe75c('0x57')]];var _0x3f137b=_0x4a39e1['message']!==utils[_0xe75c('0x5f')]['INACTIVE'];var _0x4b44f1=utils[_0xe75c('0x137')](_0x4a39e1);_0x4a39e1[_0xe75c('0x138')]=utils['getQueueCampaignStatusMessage'](_0x4a39e1,_0x12b907[_0xe75c('0x1d')]);Promise[_0xe75c('0x99')]()[_0xe75c('0x38')](function(){if(_0x4a39e1[_0xe75c('0x138')]===utils[_0xe75c('0x5f')][_0xe75c('0x6c')]){if(_0x3f137b){clearPredictiveAttributes(_0x4a39e1);_0x5b99b7[_0xe75c('0x23')]=undefined;_0x5b99b7[_0xe75c('0x24')]=undefined;}if(_0x4a39e1[_0xe75c('0x138')]===utils[_0xe75c('0x5f')][_0xe75c('0x6c')]){_0x5b99b7[_0xe75c('0x139')]=0x0;_0x5b99b7[_0xe75c('0xe8')]=0x0;_0x5b99b7[_0xe75c('0x13a')]=0x0;_0x5b99b7[_0xe75c('0x13b')]=0x0;_0x5b99b7[_0xe75c('0x13c')]=0x0;}}else if(_0x4a39e1[_0xe75c('0x138')]===utils[_0xe75c('0x5f')][_0xe75c('0x13d')]&&!_0x4b44f1){return _0x12b907[_0xe75c('0x86')](_0x4a39e1,!![])['then'](function(){return _0x12b907['ifTime'](_0x4a39e1,![]);})[_0xe75c('0x38')](function(){return _0x12b907[_0xe75c('0x9e')](_0x4a39e1);})[_0xe75c('0x8e')](function(_0x1ba26f){loggerSyncQueueSummary[_0xe75c('0x3d')]('[syncQueueSummary]',util[_0xe75c('0x3f')](_0x1ba26f,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x4a39e1);});}else{clearPredictiveAttributes(_0x4a39e1);}})['then'](function(){var _0x20444=_0x5b99b7['compareToOutboundQueue'](_0x4a39e1);if(_0x20444||_0x4a39e1[_0xe75c('0x13e')]){_0x4a39e1[_0xe75c('0x13e')]=![];_0x5b99b7[_0xe75c('0x13f')](_0x4a39e1);Object[_0xe75c('0x140')](_0x4a39e1,_0x5b99b7);emitOutboundVoiceQueueSummary(_0x5b99b7);}_0x12b907[_0xe75c('0x25')][_0x4a39e1['name']]['running']=![];})[_0xe75c('0x8e')](function(_0x4f404f){logger[_0xe75c('0x59')](_0xe75c('0x141'),util[_0xe75c('0x3f')](_0x4f404f,{'showHidden':![],'depth':null}));_0x12b907[_0xe75c('0x25')][_0x4a39e1[_0xe75c('0x57')]][_0xe75c('0x136')]=![];});};Dialer[_0xe75c('0x14')][_0xe75c('0x2e')]=_['throttle'](function(){var _0x2fe6bf=_[_0xe75c('0x142')](this[_0xe75c('0x1a')],function(_0x411117){return _0x411117[_0xe75c('0x143')];});var _0x1931b0=_[_0xe75c('0x142')](this['agents'],function(_0x534b1a){return _0x534b1a[_0xe75c('0x144')]&&_0x534b1a[_0xe75c('0x7a')]===_0xe75c('0x7b');});if(_0x2fe6bf[_0xe75c('0x88')]>0x0&&_0x1931b0[_0xe75c('0x88')]>0x0){return Promise[_0xe75c('0x99')]()['then'](cmHopper[_0xe75c('0x145')](_[_0xe75c('0x146')](_0x2fe6bf,'id'),previewRecallmeReminderInterval,_['map'](_0x1931b0,'id')))[_0xe75c('0x38')](function(_0x2bc23b){for(var _0xf7048f=0x0;_0xf7048f<_0x2bc23b['length'];_0xf7048f++){var _0x1b18bd=_0x2bc23b[_0xf7048f]['Agent'][_0xe75c('0x57')];if(_0x1b18bd)io['to'](util[_0xe75c('0x40')](_0xe75c('0x147'),_0x1b18bd))[_0xe75c('0x3a')](_0xe75c('0x148'),{'hopper':_0x2bc23b[_0xf7048f]});}})[_0xe75c('0x8e')](function(_0x7df51e){logger['error'](_0xe75c('0x149'),_0x7df51e);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0xe75c('0x14')][_0xe75c('0x14a')]=function(){var _0x1ccbe4=this;setInterval(function(){_0x1ccbe4[_0xe75c('0x14b')](_0x1ccbe4[_0xe75c('0xb0')],'[uniqueid]');_0x1ccbe4[_0xe75c('0x14b')](_0x1ccbe4[_0xe75c('0x20')],'[actions]');},0x32c8);};Dialer[_0xe75c('0x14')][_0xe75c('0x14b')]=function(_0x50c4a4,_0x1e4994){var _0x20c5b8=this;for(var _0x4d0359 in _0x50c4a4){if(typeof _0x50c4a4[_0x4d0359]!==_0xe75c('0x97')){this[_0xe75c('0x18')][_0xe75c('0x15')](function(){if(!_[_0xe75c('0xe6')](_0x50c4a4[_0x4d0359])){return ami['Action']({'action':'status','channel':_0x50c4a4[_0x4d0359][_0xe75c('0xe1')]})[_0xe75c('0x8e')](function(_0x45d917){if(_0x45d917[_0xe75c('0x5e')]===_0xe75c('0x14c')){setTimeout(function(){if(_0x50c4a4[_0x4d0359]&&_0x50c4a4[_0x4d0359][_0xe75c('0x3b')]!==_0xe75c('0xb2')){utils['decrementOriginate'](_0x20c5b8[_0xe75c('0x1a')][_0x50c4a4[_0x4d0359]['queue']],_0xe75c('0x14d'));logger[_0xe75c('0x59')](_0xe75c('0x14e'),_0x1e4994,_0x4d0359,_0x50c4a4[_0x4d0359][_0xe75c('0xaf')]);delete _0x50c4a4[_0x4d0359];}if(_0x50c4a4[_0x4d0359]&&_0x50c4a4[_0x4d0359]['type']===_0xe75c('0xb2')){utils[_0xe75c('0xed')](_0x20c5b8[_0xe75c('0x1b')][_0x50c4a4[_0x4d0359]['queue']],'[clearZombieChannels]');logger[_0xe75c('0x59')](_0xe75c('0x14f'),_0x1e4994,_0x4d0359,_0x50c4a4[_0x4d0359][_0xe75c('0xaf')]);delete _0x50c4a4[_0x4d0359];}},0x2328);}});}});}}};Dialer[_0xe75c('0x14')][_0xe75c('0x150')]=function(_0xac0f58){return Promise[_0xe75c('0x99')]()[_0xe75c('0x38')](voiceQueueRt['getVoiceQueueRtPauses'](_0xac0f58))['catch'](loggerCatch(_0xe75c('0x151')));};Dialer[_0xe75c('0x14')]['emptyContact']=function(_0x33e791,_0x553ba4,_0x409702){var _0x971a7b={'state':0x19,'statedesc':_0xe75c('0x152')};utils['decrementOriginate'](_0x553ba4,'[emptyContact]'+_0x33e791);this[_0xe75c('0x124')](_[_0xe75c('0x55')](_0x971a7b,_['pick'](_0x409702,[_0xe75c('0xce'),'ListId','UserId',_0xe75c('0xd0'),_0xe75c('0xd1')])),'[emptyContact][createHistory]',_0xe75c('0x153'));logger[_0xe75c('0x59')](_0x33e791);};Dialer[_0xe75c('0x14')][_0xe75c('0x124')]=function(_0x2fcffc,_0x736c30,_0x42a2e6){hopperUtils[_0xe75c('0xb8')](_0x2fcffc)['catch'](loggerCatch(_0x736c30));hopperUtils[_0xe75c('0xba')](_0x2fcffc)['catch'](loggerCatch(_0x42a2e6));};Dialer[_0xe75c('0x14')][_0xe75c('0xdb')]=function(_0x34313f,_0x1abec2){hopperUtils['createHistory'](_0x34313f)['catch'](loggerCatch(_0xe75c('0xb9')));if(_0x1abec2==0x0){hopperUtils['moveContactManagedDialer'](_0x34313f)[_0xe75c('0x8e')](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));}};Dialer[_0xe75c('0x14')]['checkPreviewRecallReminder']=function(_0x3b57be){return Promise[_0xe75c('0x99')]()[_0xe75c('0x38')](cmHopper[_0xe75c('0x145')](_0x3b57be['id'],previewRecallmeReminderInterval))[_0xe75c('0x38')](function(_0x4ea9e6){for(var _0x205ff6=0x0;_0x205ff6<_0x4ea9e6[_0xe75c('0x88')];_0x205ff6++){var _0x3f2cd2=_0x4ea9e6[_0x205ff6][_0xe75c('0x154')][_0xe75c('0x57')];if(_0x3f2cd2)io['to'](util[_0xe75c('0x40')](_0xe75c('0x147'),_0x3f2cd2))[_0xe75c('0x3a')](_0xe75c('0x148'),{'hopper':_0x4ea9e6[_0x205ff6]});}})['catch'](function(){});};Dialer[_0xe75c('0x14')][_0xe75c('0x9c')]=function(_0x27e82b){var _0x2124be=this;return function(){_0x2124be[_0xe75c('0x155')](_0x27e82b);};};Dialer['prototype']['actionOriginate']=function(_0x5d582f,_0x189c09){var _0x1f9cd7=this;var _0x2b5153=uuid['v4']();this[_0xe75c('0x20')][_0x2b5153]=new Action(_0x5d582f,_0x189c09,_0x2b5153);return new Promise(function(_0x154139,_0x5be49b){if(_[_0xe75c('0x39')](_0x5d582f)&&typeof _0x5d582f!==_0xe75c('0x156')){return _0x5be49b(msgResponse(_0xe75c('0x157'),'Failure','voiceQueue\x20is\x20undefine'));}if(_['isUndefined'](_0x189c09['phone'])||_0x189c09[_0xe75c('0x158')]===null){return _0x5be49b(msgResponse('originate',_0xe75c('0x83'),_0xe75c('0x159')));}var _0x214657={'XMD-CALLERID':_0x1f9cd7['actions'][_0x2b5153][_0xe75c('0x15a')](),'XMD-AGI':_0x5d582f['dialQueueProject']?util[_0xe75c('0x40')](_0xe75c('0x15b'),ipAgi,_0x5d582f[_0xe75c('0x130')]):_0xe75c('0x15c'),'XMD-AGIAFTER':_0x5d582f[_0xe75c('0x15d')]?util[_0xe75c('0x40')]('\x22agi://%s/square,%s\x22',ipAgi,_0x5d582f[_0xe75c('0x15d')]):_0xe75c('0x15c'),'XMD-QUEUE':utils[_0xe75c('0x15e')](_0x5d582f)?util[_0xe75c('0x40')](_0xe75c('0x15f'),_0x5d582f['name'],_0x5d582f[_0xe75c('0x160')]||'',_0x5d582f[_0xe75c('0xb7')]?'c':'',_0x5d582f[_0xe75c('0x161')]||0x3):_0xe75c('0x15c'),'XMD-CONTACTID':_0x189c09[_0xe75c('0xce')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x1f9cd7[_0xe75c('0x20')][_0x2b5153]['getCaller'](),'XMD-AMD':_0x5d582f[_0xe75c('0x106')]?_0xe75c('0x13d'):_0xe75c('0x15c'),'XMD-DESTINATION':_0xe75c('0x105')};if(_0x5d582f['dialAMDActive']){_0x214657[_0xe75c('0x162')]=_0x5d582f[_0xe75c('0x163')]||0x9c4;_0x214657[_0xe75c('0x164')]=_0x5d582f['dialAMDGreeting']||0x5dc;_0x214657[_0xe75c('0x165')]=_0x5d582f[_0xe75c('0x166')]||0x320;_0x214657[_0xe75c('0x167')]=_0x5d582f['dialAMDTotalAnalysisTime']||0x1388;_0x214657['XMD-AMDMINWORDLENGTH']=_0x5d582f['dialAMDMinWordLength']||0x64;_0x214657['XMD-AMDBETWEENWORDSSILENCE']=_0x5d582f[_0xe75c('0x168')]||0x32;_0x214657[_0xe75c('0x169')]=_0x5d582f[_0xe75c('0x16a')]||0x3;_0x214657['XMD-AMDSILENCETHRESHOLD']=_0x5d582f['dialAMDSilenceThreshold']||0x100;_0x214657[_0xe75c('0x16b')]=_0x5d582f['dialAMDMaximumWordLength']||0x1388;}if(utils['isOutboundQueue'](_0x5d582f)){_0x214657[_0xe75c('0x16c')]=_0x189c09['VoiceQueueId'];}else{_0x214657[_0xe75c('0x16d')]=_0x189c09[_0xe75c('0xd1')];}var _0x19a6d4=utils['setXMDContactVariables'](_0x189c09[_0xe75c('0x16e')]);Object[_0xe75c('0x140')](_0x214657,_0x19a6d4);var _0x2593fa=_0x1f9cd7[_0xe75c('0x77')](_0x5d582f['Trunk'])?utils['getCallerId'](_0x5d582f[_0xe75c('0x7d')][_0xe75c('0x16f')],_0x5d582f['dialOriginateCallerIdName'],_0x5d582f[_0xe75c('0x170')]>0x0?utils[_0xe75c('0x171')](_0x5d582f['dialOriginateCallerIdNumber'],_0x5d582f[_0xe75c('0x170')]):_0x5d582f[_0xe75c('0x172')]):utils[_0xe75c('0x173')](_[_0xe75c('0xe6')](_0x5d582f['TrunkBackup'])?_0x5d582f[_0xe75c('0x7d')][_0xe75c('0x16f')]:_0x5d582f[_0xe75c('0x174')]['callerid'],_0x5d582f[_0xe75c('0x175')],_0x5d582f['dialRandomLastDigitCallerIdNumber']>0x0?utils[_0xe75c('0x171')](_0x5d582f[_0xe75c('0x172')],_0x5d582f[_0xe75c('0x170')]):_0x5d582f[_0xe75c('0x172')]);if(_0x2593fa){_0x214657['XMD-ORIGINATECALLERIDNAME']=_0x1f9cd7['actions'][_0x2b5153][_0xe75c('0x176')]=utils[_0xe75c('0x177')](_0x2593fa);_0x214657[_0xe75c('0x178')]=_0x189c09[_0xe75c('0x158')];}_0x5d582f[_0xe75c('0x179')]=_0x214657;return ami[_0xe75c('0x8a')]({'actionid':_0x2b5153,'action':'originate','channel':_0x1f9cd7['isTrunkReachable'](_0x5d582f[_0xe75c('0x7d')])?util[_0xe75c('0x40')]('SIP/%s/%s%s',_0x5d582f[_0xe75c('0x7d')]['name'],isNotNull(_0x5d582f[_0xe75c('0x17a')])?_0x5d582f[_0xe75c('0x17a')][_0xe75c('0x17b')]()||'':'',_0x5d582f[_0xe75c('0x17c')]>0x0?_0x189c09[_0xe75c('0x158')][_0xe75c('0x17d')](_0x5d582f[_0xe75c('0x17c')]):_0x189c09[_0xe75c('0x158')]):util['format'](_0xe75c('0x17e'),_[_0xe75c('0xe6')](_0x5d582f[_0xe75c('0x174')])?_0x5d582f[_0xe75c('0x7d')][_0xe75c('0x57')]:_0x5d582f['TrunkBackup'][_0xe75c('0x57')],isNotNull(_0x5d582f[_0xe75c('0x17a')])?_0x5d582f[_0xe75c('0x17a')]['trim']()||'':'',_0x5d582f[_0xe75c('0x17c')]>0x0?_0x189c09[_0xe75c('0x158')][_0xe75c('0x17d')](_0x5d582f[_0xe75c('0x17c')]):_0x189c09[_0xe75c('0x158')]),'callerid':_0x2593fa,'Exten':_0xe75c('0x105'),'Context':_0xe75c('0x17f'),'Priority':'1','variable':_0x214657,'timeout':(_0x5d582f['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x2b5153})['then'](function(_0x3af7f9){return _0x154139(_0x3af7f9);})['catch'](function(_0x219dd3){_0x5d582f[_0xe75c('0x180')]+=0x1;var _0x3bef62=new History(_0x1f9cd7[_0xe75c('0x20')][_0x2b5153]);logger[_0xe75c('0x59')](util[_0xe75c('0x40')](_0xe75c('0x181'),JSON['stringify'](_0x219dd3)));_0x3bef62[_0xe75c('0x61')]=0xe;_0x3bef62[_0xe75c('0x62')]=_0xe75c('0x182');_0x3bef62[_0xe75c('0x64')]=moment()[_0xe75c('0x40')](_0xe75c('0xb4'));_0x3bef62[_0xe75c('0x63')]=_0x3bef62[_0xe75c('0x64')];hopperUtils[_0xe75c('0xb8')](_0x3bef62)['catch'](loggerCatch(_0xe75c('0x183')));_0x1f9cd7[_0xe75c('0xba')](_0x3bef62)[_0xe75c('0x8e')](loggerCatch(_0xe75c('0x183')))[_0xe75c('0x17')](function(){delete _0x1f9cd7['actions'][_0x2b5153];return _0x5be49b(msgResponse(_0xe75c('0x157'),_0xe75c('0x76'),'originate\x20action\x20Error'));});});});};Dialer[_0xe75c('0x14')][_0xe75c('0x184')]=function(_0xd6452a,_0x4b8f1c,_0xaad9){var _0x489d1d=new History(_0x4b8f1c);if(_0x489d1d[_0xe75c('0x119')]+_0x489d1d[_0xe75c('0x11a')]+_0x489d1d[_0xe75c('0x11b')]+_0x489d1d[_0xe75c('0x11c')]+_0x489d1d['countdropretry']+_0x489d1d['countabandonedretry']+_0x489d1d[_0xe75c('0x116')]+_0x489d1d['countagentrejectretry']>=_0xaad9[_0xe75c('0x11e')]-0x1){return!![];}switch(_0xd6452a){case 0x3:if(_0x489d1d[_0xe75c('0x11b')]>=_0xaad9[_0xe75c('0x185')]-0x1){return!![];}hopperUtils[_0xe75c('0xcc')]({'active':![],'countnoanswerretry':_0x489d1d[_0xe75c('0x11b')]+=0x1,'scheduledat':moment()['add'](_0xaad9[_0xe75c('0x186')],'minutes')[_0xe75c('0x40')](_0xe75c('0xb4')),'ContactId':_0x489d1d['ContactId'],'ListId':_0x489d1d[_0xe75c('0xcf')],'VoiceQueueId':_0x489d1d[_0xe75c('0xd0')]||undefined,'CampaignId':_0x489d1d['CampaignId']||undefined})[_0xe75c('0x8e')](loggerCatch(_0xe75c('0x187')));break;case 0x5:if(_0x489d1d['countbusyretry']>=_0xaad9[_0xe75c('0x188')]-0x1){return!![];}hopperUtils[_0xe75c('0xcc')]({'active':![],'countbusyretry':_0x489d1d[_0xe75c('0x119')]+=0x1,'scheduledat':moment()['add'](_0xaad9['dialBusyRetryFrequency'],_0xe75c('0xdc'))[_0xe75c('0x40')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x489d1d[_0xe75c('0xce')],'ListId':_0x489d1d[_0xe75c('0xcf')],'VoiceQueueId':_0x489d1d['VoiceQueueId']||undefined,'CampaignId':_0x489d1d[_0xe75c('0xd1')]||undefined})[_0xe75c('0x8e')](loggerCatch('[rescheduleContact]\x20[Busy]'));break;case 0x8:if(_0x489d1d[_0xe75c('0x11a')]>=_0xaad9[_0xe75c('0x189')]-0x1){return!![];}hopperUtils[_0xe75c('0xcc')]({'active':![],'countcongestionretry':_0x489d1d[_0xe75c('0x11a')]+=0x1,'scheduledat':moment()[_0xe75c('0xcd')](_0xaad9[_0xe75c('0x18a')],_0xe75c('0xdc'))[_0xe75c('0x40')](_0xe75c('0xb4')),'ContactId':_0x489d1d['ContactId'],'ListId':_0x489d1d[_0xe75c('0xcf')],'VoiceQueueId':_0x489d1d[_0xe75c('0xd0')]||undefined,'CampaignId':_0x489d1d['CampaignId']||undefined})[_0xe75c('0x8e')](loggerCatch(_0xe75c('0x18b')));break;case 0x0:if(_0x489d1d['countnosuchnumberretry']>=_0xaad9['dialNoSuchNumberMaxRetry']-0x1){return!![];}else{hopperUtils['rescheduleContact']({'active':![],'countnosuchnumberretry':_0x489d1d['countnosuchnumberretry']+=0x1,'scheduledat':moment()[_0xe75c('0xcd')](_0xaad9[_0xe75c('0x18c')],'minutes')[_0xe75c('0x40')](_0xe75c('0xb4')),'ContactId':_0x489d1d[_0xe75c('0xce')],'ListId':_0x489d1d[_0xe75c('0xcf')],'VoiceQueueId':_0x489d1d[_0xe75c('0xd0')]||undefined,'CampaignId':_0x489d1d[_0xe75c('0xd1')]||undefined})[_0xe75c('0x8e')](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x489d1d[_0xe75c('0xc5')]>=_0xaad9[_0xe75c('0xcb')]-0x1){return!![];}hopperUtils[_0xe75c('0xcc')]({'active':![],'countdropretry':_0x489d1d['countdropretry']+=0x1,'scheduledat':moment()['add'](_0xaad9['dialDropRetryFrequency'],_0xe75c('0xdc'))[_0xe75c('0x40')](_0xe75c('0xb4')),'ContactId':_0x489d1d[_0xe75c('0xce')],'ListId':_0x489d1d[_0xe75c('0xcf')],'VoiceQueueId':_0x489d1d['VoiceQueueId']||undefined,'CampaignId':_0x489d1d[_0xe75c('0xd1')]||undefined})[_0xe75c('0x8e')](loggerCatch(_0xe75c('0xd2')));break;case 0xb:if(_0x489d1d[_0xe75c('0xd8')]>=_0xaad9[_0xe75c('0xda')]-0x1){return!![];}hopperUtils[_0xe75c('0xcc')]({'active':![],'countabandonedretry':_0x489d1d['countabandonedretry']+=0x1,'scheduledat':moment()[_0xe75c('0xcd')](_0xaad9[_0xe75c('0xd9')],'minutes')[_0xe75c('0x40')](_0xe75c('0xb4')),'ContactId':_0x489d1d[_0xe75c('0xce')],'ListId':_0x489d1d[_0xe75c('0xcf')],'VoiceQueueId':_0x489d1d[_0xe75c('0xd0')]||undefined,'CampaignId':_0x489d1d[_0xe75c('0xd1')]||undefined})[_0xe75c('0x8e')](loggerCatch(_0xe75c('0xdd')));break;case 0x13:if(_0x489d1d[_0xe75c('0x116')]>=_0xaad9[_0xe75c('0x121')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x489d1d[_0xe75c('0x116')]+=0x1,'scheduledat':moment()[_0xe75c('0xcd')](_0xaad9[_0xe75c('0x122')],_0xe75c('0xdc'))[_0xe75c('0x40')](_0xe75c('0xb4')),'ContactId':_0x489d1d['ContactId'],'ListId':_0x489d1d[_0xe75c('0xcf')],'VoiceQueueId':_0x489d1d[_0xe75c('0xd0')]||undefined,'CampaignId':_0x489d1d['CampaignId']||undefined})[_0xe75c('0x8e')](loggerCatch(_0xe75c('0x123')));break;case 0x14:if(_0x489d1d['countagentrejectretry']>=_0xaad9[_0xe75c('0x18d')]-0x1){return!![];}hopperUtils[_0xe75c('0xcc')]({'active':![],'countagentrejectretry':_0x489d1d['countagentrejectretry']+=0x1,'scheduledat':moment()['add'](_0xaad9[_0xe75c('0x18e')],'minutes')[_0xe75c('0x40')](_0xe75c('0xb4')),'ContactId':_0x489d1d[_0xe75c('0xce')],'ListId':_0x489d1d['ListId'],'VoiceQueueId':_0x489d1d[_0xe75c('0xd0')]||undefined,'CampaignId':_0x489d1d[_0xe75c('0xd1')]||undefined})[_0xe75c('0x8e')](loggerCatch(_0xe75c('0x18f')));break;default:return!![];}};Dialer[_0xe75c('0x14')][_0xe75c('0x101')]=function(_0x207987,_0x24cd3d,_0x3facd9){var _0x419103=this;var _0x5c5449=new History(_0x207987);var _0x2e4cff=![];var _0x2da198;var _0x33ed77;return new Promise(function(_0x2c0433,_0x3bedf5){if(_[_0xe75c('0x39')](_0x24cd3d)&&typeof _0x24cd3d!==_0xe75c('0x156')){return _0x3bedf5(msgResponse(_0xe75c('0x190'),_0xe75c('0x83'),_0xe75c('0x191')));}if(_['isUndefined'](_0x3facd9)&&typeof _0x3facd9!==_0xe75c('0x156')){return _0x3bedf5(msgResponse(_0xe75c('0x190'),_0xe75c('0x83'),_0xe75c('0x192')));}hopperUtils[_0xe75c('0xc8')](_0x5c5449,_0x3facd9[_0xe75c('0x193')],_0x24cd3d)['then'](function(_0x2dcf72){if(_0x2dcf72[_0xe75c('0xca')]==0x1)_0x2e4cff=!![];switch(_0x3facd9['reason']){case'0':_0x24cd3d[_0xe75c('0x194')]+=0x1;_0x5c5449[_0xe75c('0x61')]=0x0;_0x5c5449[_0xe75c('0x62')]='NoSuchNumber';_0x5c5449['countnosuchnumberretry']+=0x1;_0x5c5449[_0xe75c('0x117')]+=0x1;ami[_0xe75c('0x3a')](_0xe75c('0x195'),ut['buildObj'](_0x207987,_0xe75c('0x196')));_0x2da198=_0x24cd3d[_0xe75c('0x18c')];_0x33ed77=_0x24cd3d['callAdditionalPhoneAfterMin'];hopperUtils[_0xe75c('0xb8')](_0x5c5449)[_0xe75c('0x8e')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x419103[_0xe75c('0x184')](0x0,_0x207987,_0x24cd3d)&&!_0x2e4cff){if(_0x5c5449[_0xe75c('0x11c')]>=_0x24cd3d[_0xe75c('0x197')]){_0x419103[_0xe75c('0x127')](_0x5c5449,_0x2c0433,_0x3bedf5,_0xe75c('0x198'));}else{_0x419103[_0xe75c('0x11f')](_0x5c5449,_0x2c0433,_0x3bedf5,_0xe75c('0x198'));}}break;case'3':_0x24cd3d[_0xe75c('0x199')]+=0x1;_0x5c5449[_0xe75c('0x61')]=0x3;_0x5c5449[_0xe75c('0x62')]='NoAnswer';_0x5c5449['countnoanswerretry']+=0x1;_0x5c5449[_0xe75c('0x117')]+=0x1;var _0x5df731=ut[_0xe75c('0x19a')](_0x207987,_0x24cd3d);ami[_0xe75c('0x3a')](_0xe75c('0x19b'),_0x5df731);_0x2da198=_0x24cd3d[_0xe75c('0x186')];_0x33ed77=_0x24cd3d[_0xe75c('0xc7')];hopperUtils['createHistory'](_0x5c5449)[_0xe75c('0x8e')](loggerCatch(_0xe75c('0x19c')));if(_0x419103['checkRetriveMax'](0x3,_0x207987,_0x24cd3d)&&!_0x2e4cff){if(_0x5c5449['countnoanswerretry']>=_0x24cd3d['dialNoAnswerMaxRetry']){_0x419103[_0xe75c('0x127')](_0x5c5449,_0x2c0433,_0x3bedf5,_0xe75c('0x19d'));}else{_0x419103[_0xe75c('0x11f')](_0x5c5449,_0x2c0433,_0x3bedf5,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x24cd3d[_0xe75c('0x19e')]+=0x1;_0x5c5449[_0xe75c('0x61')]=0x5;_0x5c5449[_0xe75c('0x62')]=_0xe75c('0x19f');_0x5c5449['countbusyretry']+=0x1;_0x5c5449[_0xe75c('0x117')]+=0x1;ami['emit']('custom:agentbusy',ut['buildObj'](_0x207987,_0xe75c('0x1a0')));_0x2da198=_0x24cd3d[_0xe75c('0x1a1')];_0x33ed77=_0x24cd3d[_0xe75c('0xc7')];hopperUtils['createHistory'](_0x5c5449)[_0xe75c('0x8e')](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x419103[_0xe75c('0x184')](0x5,_0x207987,_0x24cd3d)&&!_0x2e4cff){if(_0x5c5449[_0xe75c('0x119')]>=_0x24cd3d[_0xe75c('0x188')]){_0x419103[_0xe75c('0x127')](_0x5c5449,_0x2c0433,_0x3bedf5,_0xe75c('0x1a2'));}else{_0x419103[_0xe75c('0x11f')](_0x5c5449,_0x2c0433,_0x3bedf5,'reason\x205\x20busy');}}break;case'8':_0x24cd3d['outboundCongestionCallsDay']+=0x1;_0x5c5449[_0xe75c('0x61')]=0x8;_0x5c5449[_0xe75c('0x62')]=_0xe75c('0x1a3');_0x5c5449[_0xe75c('0x11a')]+=0x1;_0x5c5449[_0xe75c('0x117')]+=0x1;_0x2da198=_0x24cd3d[_0xe75c('0x18a')];_0x33ed77=_0x24cd3d['callAdditionalPhoneAfterMin'];ami['emit'](_0xe75c('0x1a4'),ut['buildObj'](_0x207987,'congestion'));hopperUtils[_0xe75c('0xb8')](_0x5c5449)['catch'](loggerCatch(_0xe75c('0x1a5')));if(_0x419103['checkRetriveMax'](0x8,_0x207987,_0x24cd3d)&&!_0x2e4cff){if(_0x5c5449['countcongestionretry']>=_0x24cd3d[_0xe75c('0x189')]){_0x419103[_0xe75c('0x127')](_0x5c5449,_0x2c0433,_0x3bedf5,'reason\x208\x20congestion');}else{_0x419103[_0xe75c('0x11f')](_0x5c5449,_0x2c0433,_0x3bedf5,_0xe75c('0x1a6'));}}break;case'11':_0x24cd3d[_0xe75c('0x1a7')]+=0x1;_0x5c5449[_0xe75c('0x61')]=0xb;_0x5c5449['statedesc']='Abandoned';_0x5c5449[_0xe75c('0xd8')]+=0x1;_0x5c5449['countglobal']+=0x1;_0x2da198=_0x24cd3d[_0xe75c('0xd9')];_0x33ed77=_0x24cd3d[_0xe75c('0xc7')];hopperUtils[_0xe75c('0xb8')](_0x5c5449)[_0xe75c('0x8e')](loggerCatch(_0xe75c('0xe0')));if(_0x419103[_0xe75c('0x184')](0xb,_0x207987,_0x24cd3d)&&!_0x2e4cff){if(_0x5c5449[_0xe75c('0xd8')]>=_0x24cd3d[_0xe75c('0xda')]){_0x419103[_0xe75c('0x127')](_0x5c5449,_0x2c0433,_0x3bedf5,_0xe75c('0x1a8'));}else{_0x419103[_0xe75c('0x11f')](_0x5c5449,_0x2c0433,_0x3bedf5,_0xe75c('0x1a8'));}}break;case'20':_0x24cd3d[_0xe75c('0x1a9')]+=0x1;_0x5c5449[_0xe75c('0x61')]=0x14;_0x5c5449[_0xe75c('0x62')]=_0xe75c('0x1aa');_0x5c5449[_0xe75c('0x11d')]+=0x1;_0x5c5449[_0xe75c('0x117')]+=0x1;_0x2da198=_0x24cd3d[_0xe75c('0x18e')];_0x33ed77=_0x24cd3d[_0xe75c('0xc7')];ami[_0xe75c('0x3a')](_0xe75c('0x1ab'),ut[_0xe75c('0x10e')](_0x207987,_0xe75c('0x1ac')));hopperUtils['createHistory'](_0x5c5449)['catch'](loggerCatch(_0xe75c('0x1ad')));if(_0x419103[_0xe75c('0x184')](0x14,_0x207987,_0x24cd3d)&&!_0x2e4cff){if(_0x5c5449[_0xe75c('0x11d')]>=_0x24cd3d[_0xe75c('0x18d')]){_0x419103[_0xe75c('0x127')](_0x5c5449,_0x2c0433,_0x3bedf5,_0xe75c('0x1ae'));}else{_0x419103[_0xe75c('0x11f')](_0x5c5449,_0x2c0433,_0x3bedf5,_0xe75c('0x1ae'));}}break;default:_0x24cd3d[_0xe75c('0x1af')]+=0x1;_0x5c5449[_0xe75c('0x61')]=0xc;_0x5c5449[_0xe75c('0x62')]=_0x3facd9[_0xe75c('0x193')];_0x2da198=_0x24cd3d[_0xe75c('0x18e')];_0x33ed77=_0x24cd3d[_0xe75c('0xc7')];hopperUtils[_0xe75c('0xb8')](_0x5c5449)[_0xe75c('0x8e')](loggerCatch(_0xe75c('0x1b0')));if(_0x419103['checkRetriveMax'](_0x3facd9[_0xe75c('0x193')],_0x207987,_0x24cd3d)&&!_0x2e4cff){if(_0x5c5449[_0xe75c('0x119')]+_0x5c5449[_0xe75c('0x11a')]+_0x5c5449[_0xe75c('0x11b')]+_0x5c5449[_0xe75c('0x11c')]+_0x5c5449[_0xe75c('0xc5')]+_0x5c5449[_0xe75c('0xd8')]+_0x5c5449[_0xe75c('0x116')]+_0x5c5449[_0xe75c('0x11d')]>=_0x24cd3d[_0xe75c('0x11e')]){_0x419103[_0xe75c('0x11f')](_0x5c5449,_0x2c0433,_0x3bedf5,_0x3facd9['reason']);}else{_0x419103[_0xe75c('0x127')](_0x5c5449,_0x2c0433,_0x3bedf5,_0x3facd9[_0xe75c('0x193')]);}}}})[_0xe75c('0x38')](function(){if(_0x2e4cff){hopperUtils[_0xe75c('0xd5')](_0x5c5449,_0x2da198,_0x33ed77)[_0xe75c('0x38')](function(){return _0x2c0433(0x1);});}});});};Dialer[_0xe75c('0x14')]['stateGlobal']=function(_0x5134e9,_0x840f16,_0x3769c3,_0x336347){var _0x556bf9=new Final(_0x5134e9);_0x556bf9[_0xe75c('0x61')]=0xf;_0x556bf9[_0xe75c('0x62')]=_0xe75c('0x1b1');this['createStateFinal'](_0x556bf9,_0x840f16,_0x3769c3,_0x336347);};Dialer['prototype']['createStateFinal']=function(_0x5f07eb,_0xf89d53,_0x5a84a5,_0x2098d7){hopperUtils[_0xe75c('0xba')](_0x5f07eb)[_0xe75c('0x38')](function(){return _0xf89d53(msgResponse(_0xe75c('0x190'),'Success',_0x2098d7));})['catch'](function(){return _0x5a84a5(msgResponse(_0xe75c('0x1b2'),_0xe75c('0x83'),_0xe75c('0x1b3')));});};Dialer[_0xe75c('0x14')]['predictive']=function(_0x2cf9cd){var _0x12b647=_0x2cf9cd[_0xe75c('0x1b4')]/0x64;var _0x1bb0bc=_0x2cf9cd[_0xe75c('0xbf')]/(_0x2cf9cd[_0xe75c('0xbf')]+_0x2cf9cd['outboundAnswerCallsDay']);var _0x4ecfbf=Math[_0xe75c('0x1b5')](_0x2cf9cd['predictiveIntervalAvailable']*(_0x2cf9cd['predictiveIntervalMaxThreshold']/0x64));var _0x39f04b=Math[_0xe75c('0x1b5')](_0x2cf9cd[_0xe75c('0x1b6')]*(_0x2cf9cd[_0xe75c('0x1b7')]/0x64));var _0x2f6ada=_0x2cf9cd['available']+_0x2cf9cd[_0xe75c('0x13b')];var _0x4b18be=Math[_0xe75c('0x1b8')](_0x2cf9cd[_0xe75c('0x4e')]*_0x2cf9cd[_0xe75c('0x50')]*_0x2cf9cd['predictiveIntervalHitRate']*_0x2cf9cd['predictiveIntervalMultiplicativeFactor']);if(_['isUndefined'](_0x2cf9cd[_0xe75c('0x24')])){if(!_[_0xe75c('0x39')](_0x2cf9cd[_0xe75c('0x23')])){_0x2cf9cd[_0xe75c('0x23')]=undefined;loggerPredictive[_0xe75c('0x59')](_0xe75c('0x1b9'),_0xe75c('0x1ba'));}if(!_['isUndefined'](_0x2cf9cd[_0xe75c('0x58')])){loggerPredictive[_0xe75c('0x59')](_0xe75c('0x1b9'),_0xe75c('0x1bb'));clearInterval(_0x2cf9cd[_0xe75c('0x58')]);_0x2cf9cd['handlePredictive']=undefined;}_0x2cf9cd[_0xe75c('0x24')]=moment()[_0xe75c('0x40')](_0xe75c('0xb4'));loggerPredictive[_0xe75c('0x42')](_0x2cf9cd[_0xe75c('0x57')],_0xe75c('0x1bc'),_0x2cf9cd['startProgressive']);this[_0xe75c('0xa2')](_0x2cf9cd,0x1);}else if(ifInterval(_0x2cf9cd['dialPredictiveInterval'],_0x2cf9cd[_0xe75c('0x24')])){this['handlePower'](_0x2cf9cd,0x1);loggerPredictiveCalls[_0xe75c('0x42')]('[startMethodPredictive][StartProgressive][Loop]',_0x2cf9cd[_0xe75c('0x24')],_0x2cf9cd[_0xe75c('0x57')]);_0x2cf9cd[_0xe75c('0x4e')]=0x0;_0x2cf9cd['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x12b647<_0x1bb0bc&&_0x2cf9cd[_0xe75c('0x1bd')]===_0xe75c('0x1be')){clearPredictiveAttributes(_0x2cf9cd);loggerPredictive[_0xe75c('0x42')]('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day',_0x1bb0bc,_0xe75c('0x24'),_0x2cf9cd[_0xe75c('0x57')]);}else if(_0x4b18be<_0x2cf9cd[_0xe75c('0xc0')]&&_0x2cf9cd['dialPredictiveOptimization']===_0xe75c('0x1be')){clearPredictiveAttributes(_0x2cf9cd);loggerPredictive[_0xe75c('0x42')](_0xe75c('0x1bf'),'Max\x20Drop\x20',_0x4b18be,_0xe75c('0x1c0'),_0x2cf9cd[_0xe75c('0xc0')],_0xe75c('0x24'),_0x2cf9cd['name']);}else if(!ifInterval(_0x2cf9cd['dialPredictiveInterval'],_0x2cf9cd[_0xe75c('0x24')])&&_[_0xe75c('0x39')](_0x2cf9cd[_0xe75c('0x23')])&&!_[_0xe75c('0x39')](_0x2cf9cd['startProgressive'])){_0x2cf9cd[_0xe75c('0x23')]=moment()[_0xe75c('0x40')](_0xe75c('0xb4'));loggerPredictive[_0xe75c('0x42')](_0x2cf9cd[_0xe75c('0x57')],'started\x20in\x20predictive\x20at',_0x2cf9cd[_0xe75c('0x23')]);hopperUtils['avgHandleTime'](_0x2cf9cd[_0xe75c('0x1c1')])[_0xe75c('0x38')](this['getDataPredictive'](_0x2cf9cd))['then'](mergeDataErlangB(_0x2cf9cd))['then'](this['startMethodPredictive'](_0x2cf9cd))['catch'](loggerCatchPredictive(_0xe75c('0x1c2'),_0x2cf9cd));}else if(!ifInterval(_0x2cf9cd[_0xe75c('0x1c1')],_0x2cf9cd[_0xe75c('0x23')])){_0x2cf9cd['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x2cf9cd[_0xe75c('0x23')]=moment()[_0xe75c('0x40')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0xe75c('0x42')](_0x2cf9cd[_0xe75c('0x57')],_0xe75c('0x1c3'),_0x2cf9cd[_0xe75c('0x23')]);clearInterval(_0x2cf9cd[_0xe75c('0x58')]);_0x2cf9cd[_0xe75c('0x58')]=undefined;hopperUtils[_0xe75c('0x1c4')](_0x2cf9cd[_0xe75c('0x1c1')])[_0xe75c('0x38')](this[_0xe75c('0x1c5')](_0x2cf9cd))[_0xe75c('0x38')](mergeDataErlangB(_0x2cf9cd))[_0xe75c('0x38')](this[_0xe75c('0x1c6')](_0x2cf9cd))['catch'](loggerCatchPredictive(_0xe75c('0x1c7'),_0x2cf9cd));}else if(_0x2cf9cd[_0xe75c('0x1b6')]&&_0x2f6ada<_0x2cf9cd['predictiveIntervalAvailable']-_0x39f04b){clearPredictiveAttributes(_0x2cf9cd);loggerPredictive[_0xe75c('0x42')](_0x2cf9cd[_0xe75c('0x57')],_0xe75c('0x1c8'),_0x2f6ada,_0xe75c('0x1c9'),_0x2cf9cd[_0xe75c('0x1b6')],'-',_0x39f04b,'=',_0x2cf9cd[_0xe75c('0x1b6')]-_0x39f04b,')');}else if(_0x2cf9cd[_0xe75c('0x1b6')]&&_0x2f6ada>_0x2cf9cd[_0xe75c('0x1b6')]+_0x4ecfbf){clearPredictiveAttributes(_0x2cf9cd);loggerPredictive[_0xe75c('0x42')](_0x2cf9cd['name'],_0xe75c('0x1c8'),_0x2f6ada,')\x20are\x20more\x20than\x20threshold\x20(',_0x2cf9cd[_0xe75c('0x1b6')],'+',_0x4ecfbf,'=',_0x2cf9cd[_0xe75c('0x1b6')]+_0x4ecfbf,')');}};Dialer[_0xe75c('0x14')][_0xe75c('0x1c5')]=function(_0x59ff70){var _0x18f00d=this;return function(_0x2c43b3){return new Promise(function(_0x4d858b,_0x2c1326){_['merge'](_0x59ff70,_0x2c43b3[0x0]);if(checkGetDataPredictive(_0x2c43b3[0x0])){var _0x548ba3=_0x59ff70['predictiveIntervalAvailable']=_0x59ff70[_0xe75c('0x13b')]+_0x59ff70[_0xe75c('0x139')];var _0x5036c7=_0x59ff70[_0xe75c('0x1c1')]*0x3c;var _0x20506a=_0x2c43b3[0x0]['predictiveIntervalAvgTalktime']+_0x2c43b3[0x0][_0xe75c('0x49')];var _0x2f3f3b=(_0x2c43b3[0x0][_0xe75c('0x46')]+_0x2c43b3[0x0][_0xe75c('0xbe')]+_0x2c43b3[0x0][_0xe75c('0x47')])/_0x2c43b3[0x0]['predictiveIntervalTotalCalls'];_0x59ff70['predictiveIntervalHitRate']=_0x2f3f3b>0x0?_0x2f3f3b:0x1;switch(_0x59ff70['dialPredictiveOptimization']){case _0xe75c('0x1be'):var _0x4e27a7=_0x59ff70['dialPredictiveOptimizationPercentage']/0x64;return _0x18f00d[_0xe75c('0x1ca')](_0x548ba3,_0x5036c7,_0x20506a,_0x2f3f3b,_0x4e27a7)[_0xe75c('0x38')](function(_0x1b3071){return _0x4d858b(_0x1b3071);});case _0xe75c('0x1cb'):var _0x58fd2b=_0x59ff70['dialPredictiveOptimizationPercentage']/0x64;return _0x18f00d[_0xe75c('0x1cc')](_0x548ba3,_0x5036c7,_0x20506a,_0x2f3f3b,_0x58fd2b)[_0xe75c('0x38')](function(_0x5c6b4d){return _0x4d858b(_0x5c6b4d);});default:return _0x2c1326(msgResponse(_0xe75c('0x1cd'),'Failure',_0xe75c('0x1ce')));}}else{return _0x2c1326(msgResponse(_0xe75c('0x1cd'),_0xe75c('0x83'),_0xe75c('0x1cf')));}});};};Dialer[_0xe75c('0x14')][_0xe75c('0x1d0')]=function(_0x18cbca){var _0x5b3bb2=this;return function(_0x135b78){return new Promise(function(_0x121717,_0x429d24){_['merge'](_0x18cbca,_0x135b78[0x0]);if(checkGetDataPredictive(_0x135b78[0x0])){loggerPredictive[_0xe75c('0x42')](JSON['stringify'](_0x135b78[0x0]));if(_0x18cbca[_0xe75c('0x1bd')]===_0xe75c('0x1be')){return _0x5b3bb2['getVoiceQueueRtPauses'](_0x18cbca['id'])[_0xe75c('0x38')](function(_0xaf1ae7){var _0x36ced4=_0x18cbca['loggedIn']-_0xaf1ae7[0x0][_0xe75c('0x1d1')];var _0x3d4f0c=_0x18cbca['dialPredictiveInterval']*0x3c;var _0x55bb49=_0x135b78[0x0][_0xe75c('0x4a')]+_0x135b78[0x0][_0xe75c('0x49')];var _0xbf7542=(_0x135b78[0x0][_0xe75c('0x46')]+_0x135b78[0x0][_0xe75c('0xbe')]+_0x135b78[0x0][_0xe75c('0x47')])/_0x135b78[0x0][_0xe75c('0x45')];var _0x19b008=_0x18cbca[_0xe75c('0x1b4')]/0x64;_0x18cbca[_0xe75c('0x1d2')]=_0xaf1ae7[0x0][_0xe75c('0x1d1')]||0x0;_0x18cbca[_0xe75c('0x1d3')]=_0xbf7542>0x0?_0xbf7542:0x1;return _0x5b3bb2['abandonmentRate'](_0x36ced4,_0x3d4f0c,_0x55bb49,_0xbf7542,_0x19b008);})[_0xe75c('0x38')](function(_0x5d7af2){return _0x121717(_0x5d7af2);})[_0xe75c('0x8e')](function(_0x55ad67){return _0x429d24(msgResponse(_0xe75c('0x1d4'),_0xe75c('0x83'),JSON['stringify'](_0x55ad67)));});}if(_0x18cbca[_0xe75c('0x1bd')]==='agentBusyFactor'){return _0x5b3bb2[_0xe75c('0x150')](_0x18cbca['id'])[_0xe75c('0x38')](function(_0x575a22){var _0x1b6eec=_0x18cbca['loggedIn']-_0x575a22[0x0][_0xe75c('0x1d1')];var _0x8fdbf8=_0x18cbca['dialPredictiveInterval']*0x3c;var _0x1d1f7e=_0x135b78[0x0][_0xe75c('0x4a')]+_0x135b78[0x0]['predictiveIntervalAvgHoldtime'];var _0x433603=(_0x135b78[0x0][_0xe75c('0x46')]+_0x135b78[0x0][_0xe75c('0xbe')]+_0x135b78[0x0][_0xe75c('0x47')])/_0x135b78[0x0]['predictiveIntervalTotalCalls'];var _0x4d4f8e=_0x18cbca[_0xe75c('0x1b4')]/0x64;_0x18cbca[_0xe75c('0x1d2')]=_0x575a22[0x0][_0xe75c('0x1d1')]||0x0;_0x18cbca[_0xe75c('0x1d3')]=_0x433603>0x0?_0x433603:0x1;return _0x5b3bb2[_0xe75c('0x1cc')](_0x1b6eec,_0x8fdbf8,_0x1d1f7e,_0x433603,_0x4d4f8e);})[_0xe75c('0x38')](function(_0x46438d){return _0x121717(_0x46438d);})['catch'](function(_0x45e9ed){return _0x429d24(msgResponse('[CatchErlangB]',_0xe75c('0x83'),JSON['stringify'](_0x45e9ed)));});}}else{return _0x429d24(msgResponse('[getDataPredictive]','Failure','check\x20failure'));}});};};Dialer['prototype'][_0xe75c('0x1c6')]=function(_0x28c505){var _0x139963=this;return function(){var _0x371fc8=0x0;var _0x572b18=Math[_0xe75c('0x1b8')](_0x28c505[_0xe75c('0x1d5')]*0x3e8);if(_0x572b18>0x0){_0x572b18=_0x572b18<0x64?0x64:_0x572b18;loggerPredictive['info'](_0x28c505[_0xe75c('0x57')],_0xe75c('0x1d6'),_0x572b18,'milliseconds');_0x28c505[_0xe75c('0x58')]=setInterval(function(){_0x139963[_0xe75c('0x58')](_0x28c505);loggerPredictiveCalls[_0xe75c('0x42')](_0xe75c('0x1d7'),_0x371fc8+=0x1);},_0x572b18);}else{loggerPredictive[_0xe75c('0x42')](_0x28c505[_0xe75c('0x57')],_0xe75c('0x1d8'));}};};Dialer[_0xe75c('0x14')][_0xe75c('0x1d9')]=function(_0x470701,_0x518d9e){var _0x58ee3b=this;return function(_0x2cfe7a){if(_[_0xe75c('0x41')](_0x2cfe7a)){if(_[_0xe75c('0xe6')](_0x518d9e[_0xe75c('0x1da')])||!_0x518d9e[_0xe75c('0x1db')]){if(_0x470701[_0xe75c('0x9f')]===_0xe75c('0xa4')){_0x470701['queueStatusComplete']=_[_0xe75c('0x39')](_0x470701[_0xe75c('0x65')])?!![]:_0x470701[_0xe75c('0x65')];var _0x314d7d=uuid['v4']();_0x58ee3b[_0xe75c('0x20')][_0x314d7d]=new Action(_0x470701,_0x518d9e,_0x314d7d);loggerBooked[_0xe75c('0x42')]('[booked][checkContactBlack]',_0x314d7d,_0xe75c('0x1dc'),JSON['stringify'](_0x470701['queueStatusComplete']),_0xe75c('0x1dd'),_0x470701[_0xe75c('0x57')]);if(_0x470701[_0xe75c('0x65')]){_0x470701['queueStatusComplete']=![];_0x58ee3b['queueBooked'][_0x58ee3b[_0xe75c('0x20')][_0x314d7d]['queue']]=[];ami['Action']({'actionid':_0x314d7d,'action':'queuestatus','queue':_0x470701['name']})[_0xe75c('0x8e')](function(){utils[_0xe75c('0xed')](_0x470701,_0xe75c('0x1de'));hopperUtils[_0xe75c('0xcc')]({'active':![],'ContactId':_0x58ee3b[_0xe75c('0x20')][_0x314d7d][_0xe75c('0xce')],'ListId':_0x58ee3b[_0xe75c('0x20')][_0x314d7d][_0xe75c('0xcf')],'VoiceQueueId':_0x58ee3b[_0xe75c('0x20')][_0x314d7d][_0xe75c('0xd0')]||undefined,'CampaignId':_0x58ee3b[_0xe75c('0x20')][_0x314d7d][_0xe75c('0xd1')]||undefined})['catch'](loggerCatch(_0xe75c('0x1df')));delete _0x58ee3b[_0xe75c('0x20')][_0x314d7d];});}else{loggerBooked[_0xe75c('0x42')](_0xe75c('0x1e0'),JSON['stringify'](_0x470701[_0xe75c('0x65')]),_0xe75c('0x1dd'),_0x470701[_0xe75c('0x57')]);utils[_0xe75c('0xed')](_0x470701,_0xe75c('0x1de'));hopperUtils[_0xe75c('0xcc')]({'active':![],'ContactId':_0x58ee3b[_0xe75c('0x20')][_0x314d7d][_0xe75c('0xce')],'ListId':_0x58ee3b['actions'][_0x314d7d][_0xe75c('0xcf')],'VoiceQueueId':_0x58ee3b['actions'][_0x314d7d][_0xe75c('0xd0')]||undefined,'CampaignId':_0x58ee3b[_0xe75c('0x20')][_0x314d7d][_0xe75c('0xd1')]||undefined})[_0xe75c('0x8e')](loggerCatch(_0xe75c('0x1df')));delete _0x58ee3b[_0xe75c('0x20')][_0x314d7d];}}else{return _0x58ee3b[_0xe75c('0x1e1')](_0x470701,_0x518d9e);}}else{if(utils['getSeconds'](undefined,_0x518d9e[_0xe75c('0x1e2')])<_0x470701[_0xe75c('0x1e3')]*0x3c){if(_0x518d9e[_0xe75c('0x154')]&&!_0x518d9e[_0xe75c('0x154')][_0xe75c('0x1e4')]){_0x58ee3b[_0xe75c('0x19')][_0xe75c('0xf6')](_0x518d9e['id'])[_0xe75c('0x17')](function(){utils[_0xe75c('0xed')](_0x470701,_0xe75c('0x1de'));});}else{hopperUtils[_0xe75c('0x1e5')]({'active':![]},_0x518d9e['id'],0x1)[_0xe75c('0x17')](function(){utils[_0xe75c('0xed')](_0x470701,_0xe75c('0x1de'));});}}else{_0x470701[_0xe75c('0x1e6')]+=0x1;utils[_0xe75c('0xed')](_0x470701,_0xe75c('0x1de'));if(_0x470701[_0xe75c('0x1e7')]){hopperUtils[_0xe75c('0xcc')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x518d9e[_0xe75c('0xce')],'ListId':_0x518d9e[_0xe75c('0xcf')],'VoiceQueueId':_0x518d9e[_0xe75c('0xd0')]||undefined,'CampaignId':_0x518d9e[_0xe75c('0xd1')]||undefined})[_0xe75c('0x8e')](loggerCatch(_0xe75c('0x1e8')));hopperUtils[_0xe75c('0xb8')](createObjHistory(_0x470701,_0x518d9e,utils[_0xe75c('0x5f')][_0xe75c('0x1e9')],0x17,_0xe75c('0x1ea')))[_0xe75c('0x8e')](loggerCatch(_0xe75c('0x1eb')));}else{_0x58ee3b['saveInDb'](createObjHistory(_0x470701,_0x518d9e,utils[_0xe75c('0x5f')][_0xe75c('0x1ec')],0x16,_0xe75c('0x1ed')),_0xe75c('0x1ee'),_0xe75c('0x1ef'));}}}}else{_0x470701[_0xe75c('0x1f0')]+=0x1;_0x58ee3b[_0xe75c('0x124')](createObjHistory(_0x470701,_0x518d9e,utils[_0xe75c('0x5f')]['BLACKLIST'],0xd,_0xe75c('0x1f1')),_0xe75c('0x1f2'),_0xe75c('0x1f3'));throw'inBlackList';}};};Dialer[_0xe75c('0x14')][_0xe75c('0x155')]=function(_0x4fb4f5){var _0x6a5536=this;var _0x41bc47=_0x4fb4f5[_0xe75c('0x1f4')]-_0x4fb4f5[_0xe75c('0x1f5')];emitCampaignSummary(_0x4fb4f5);if(_0x41bc47>0x0&&_0x4fb4f5['temp']==0x0){if(_0x41bc47>this[_0xe75c('0x1e')]){_0x41bc47=this[_0xe75c('0x1e')];}_0x4fb4f5['temp']=0x1;hopperUtils[_0xe75c('0x1f6')](_0x4fb4f5,_0x41bc47)[_0xe75c('0x38')](function(_0x5aa6df){_0x4fb4f5[_0xe75c('0x1f7')]=0x0;if(_0x5aa6df){if(!utils['checkContactEmpty'](_0x5aa6df)){_0x4fb4f5[_0xe75c('0x5e')]=utils[_0xe75c('0x5f')][_0xe75c('0x60')];logger[_0xe75c('0x42')](_0xe75c('0x1f8')+_0x4fb4f5[_0xe75c('0x57')]);}else{_0x4fb4f5['originated']+=_0x5aa6df[_0xe75c('0x88')];_0x4fb4f5[_0xe75c('0x5e')]=utils[_0xe75c('0x5f')][_0xe75c('0x1f9')];for(var _0xa48f7e=0x0;_0xa48f7e<_0x5aa6df[_0xe75c('0x88')];_0xa48f7e+=0x1){_0x4fb4f5[_0xe75c('0x1fa')]+=0x1;if(_[_0xe75c('0xe6')](_0x5aa6df[_0xa48f7e])||_['isNil'](_0x5aa6df[_0xa48f7e][_0xe75c('0x16e')])||_[_0xe75c('0xe6')](_0x5aa6df[_0xa48f7e][_0xe75c('0x158')])){_0x6a5536[_0xe75c('0x1fb')](_0xe75c('0x1fc'),_0x4fb4f5,_0x5aa6df[_0xa48f7e]);}else{hopperUtils['checkIsBlackListIvr'](_['pick'](_0x5aa6df[_0xa48f7e],[_0xe75c('0xd1'),'phone']))[_0xe75c('0x38')](_0x6a5536['checkContactBlack'](_0x4fb4f5,_0x5aa6df[_0xa48f7e]))['catch'](function(_0xeeccb5){logger['error'](_0xe75c('0x1fd'),_0xeeccb5);utils[_0xe75c('0xed')](_0x4fb4f5,_0xe75c('0x1fe'));});}}}}})['catch'](function(_0x33f39f){_0x4fb4f5[_0xe75c('0x1f7')]=0x0;logger[_0xe75c('0x59')](_0xe75c('0x1ff'),_0x33f39f);});}};Dialer['prototype'][_0xe75c('0xa2')]=function(_0x15574e,_0x341a19){var _0x54efec=this;var _0x2a62ae=[];if(_0x341a19<0x1||_0x15574e[_0xe75c('0x9f')]===_0xe75c('0xa4')){_0x341a19=0x1;}var _0x71d1c7=Math[_0xe75c('0x1b8')](_0x15574e['available']*_0x341a19)-_0x15574e[_0xe75c('0x1f5')];if(_0x15574e[_0xe75c('0x200')]>0x0){var _0xeb1eaa=_0x15574e['dialLimitQueue']-_0x15574e['originated']-_0x15574e[_0xe75c('0x13b')]-_0x15574e['pTalking'];if(_0x71d1c7>_0xeb1eaa){_0x71d1c7=_0xeb1eaa;}}if(_0x71d1c7>0x0&&_0x15574e[_0xe75c('0x1f7')]==0x0){if(_0x15574e[_0xe75c('0x9f')]===_0xe75c('0xa4')){_0x71d1c7=0x1;}if(_0x71d1c7>this[_0xe75c('0x1e')]){_0x71d1c7=this[_0xe75c('0x1e')];}for(var _0x3e39bb in this[_0xe75c('0x1c')]){if(typeof this[_0xe75c('0x1c')][_0x3e39bb]!=='undefined'){if(this[_0xe75c('0x1c')][_0x3e39bb]['state']===_0xe75c('0x201')&&this[_0xe75c('0x1c')][_0x3e39bb]['status']===_0xe75c('0x7b')){_0x2a62ae[_0xe75c('0x89')](this[_0xe75c('0x1c')][_0x3e39bb]['id']);}}}_0x15574e[_0xe75c('0x1f7')]=0x1;hopperUtils['getContactDialer'](_0x15574e,_0x2a62ae,_0x71d1c7)[_0xe75c('0x38')](function(_0xd9380){_0x15574e[_0xe75c('0x1f7')]=0x0;if(_0xd9380){if(!utils['checkContactEmpty'](_0xd9380)){hopperUtils[_0xe75c('0x202')](_0x15574e)[_0xe75c('0x38')](sendMessageReschedule(_0x15574e))[_0xe75c('0x8e')](loggerCatch(_0xe75c('0x203')));}else{_0x15574e[_0xe75c('0x1f5')]+=_0xd9380[_0xe75c('0x88')];_0x15574e[_0xe75c('0x5e')]=_0x15574e[_0xe75c('0x9f')]===_0xe75c('0xa4')?utils[_0xe75c('0x5f')]['ACTIVE']:utils[_0xe75c('0x5f')][_0xe75c('0x1f9')];for(var _0x493a42=0x0;_0x493a42<_0xd9380[_0xe75c('0x88')];_0x493a42+=0x1){if(_[_0xe75c('0xe6')](_0xd9380[_0x493a42])||_[_0xe75c('0xe6')](_0xd9380[_0x493a42]['Contact'])||_['isNil'](_0xd9380[_0x493a42][_0xe75c('0x158')])){_0x54efec['emptyContact'](_0xe75c('0x1fc'),_0x15574e,_0xd9380[_0x493a42]);}else{hopperUtils['checkIsBlackList'](_[_0xe75c('0xeb')](_0xd9380[_0x493a42],[_0xe75c('0xd0'),_0xe75c('0x158')]))['then'](_0x54efec['checkContactBlack'](_0x15574e,_0xd9380[_0x493a42]))[_0xe75c('0x8e')](function(_0x3f14e9){logger[_0xe75c('0x59')]('[actionOriginate]',_0x3f14e9);utils[_0xe75c('0xed')](_0x15574e,_0xe75c('0x204'));});}}}}})[_0xe75c('0x8e')](function(_0x44aed8){_0x15574e[_0xe75c('0x1f7')]=0x0;logger[_0xe75c('0x59')](_0xe75c('0x1ff'),_0x44aed8);});}};Dialer[_0xe75c('0x14')][_0xe75c('0x58')]=function(_0xfd8074){if(_0xfd8074[_0xe75c('0x200')]>0x0){var _0x2e6392=_0xfd8074[_0xe75c('0x200')]-_0xfd8074[_0xe75c('0x1f5')]-_0xfd8074[_0xe75c('0x13b')];if(_0x2e6392>0x0&&_0xfd8074['temp']==0x0){this[_0xe75c('0x205')](_0xfd8074);}else{loggerPredictiveCalls[_0xe75c('0x42')](_0xe75c('0x206'));}}else{this[_0xe75c('0x205')](_0xfd8074);}};Dialer[_0xe75c('0x14')][_0xe75c('0x205')]=function(_0x558c9c){var _0x4d7e70=this;var _0x28f42e=[];_0x558c9c[_0xe75c('0x1f5')]+=0x1;for(var _0x265eac in this['agents']){if(typeof this[_0xe75c('0x1c')][_0x265eac]!=='undefined'){if(this[_0xe75c('0x1c')][_0x265eac]['state']===_0xe75c('0x201')&&this[_0xe75c('0x1c')][_0x265eac][_0xe75c('0x7a')]===_0xe75c('0x7b')){_0x28f42e['push'](this['agents'][_0x265eac]['id']);}}}_0x558c9c['temp']=0x1;return this['getContactDialer'](_0x558c9c['id'],_0x28f42e,0x1,_0x558c9c[_0xe75c('0x207')],_0x558c9c)[_0xe75c('0x38')](function(_0x42f25a){_0x558c9c[_0xe75c('0x1f7')]=0x1;if(_0x42f25a){if(!utils[_0xe75c('0x208')](_0x42f25a)){utils[_0xe75c('0x209')](_0x558c9c,0x1,0x0);return hopperUtils[_0xe75c('0x202')](_0x558c9c)[_0xe75c('0x38')](sendMessageReschedule(_0x558c9c))[_0xe75c('0x8e')](loggerCatch(_0xe75c('0x203')));}else{_0x558c9c[_0xe75c('0x5e')]=utils[_0xe75c('0x5f')]['RUNNING'];if(_['isNil'](_0x42f25a[0x0])||_[_0xe75c('0xe6')](_0x42f25a[0x0][_0xe75c('0x16e')])||_[_0xe75c('0xe6')](_0x42f25a[0x0]['phone'])){_0x4d7e70['emptyContact'](_0xe75c('0x1fc'),_0x558c9c,_0x42f25a[0x0]);}else{return hopperUtils[_0xe75c('0x20a')](_[_0xe75c('0xeb')](_0x42f25a[0x0],[_0xe75c('0xd0'),'phone']))['then'](_0x4d7e70[_0xe75c('0x1d9')](_0x558c9c,_0x42f25a[0x0]))[_0xe75c('0x8e')](function(_0x2a43b6){logger[_0xe75c('0x59')](_0xe75c('0x20b'),_0x2a43b6);utils[_0xe75c('0xed')](_0x558c9c,'[actionOriginatePredictive]');});}}}})[_0xe75c('0x8e')](function(_0x6ec4c3){_0x558c9c[_0xe75c('0x1f7')]=0x0;logger[_0xe75c('0x59')]('[getContactCampaign2]',_0x6ec4c3);});};Dialer[_0xe75c('0x14')][_0xe75c('0x1ca')]=function(_0x148a85,_0x124474,_0x319fad,_0x42483e,_0x3c0884,_0x222d69){loggerPredictive[_0xe75c('0x42')](_0xe75c('0x20c'));loggerPredictive['info']('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',_0x148a85);loggerPredictive['info'](_0xe75c('0x20d'),_0x124474);loggerPredictive['info']('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',_0x319fad);loggerPredictive[_0xe75c('0x42')](_0xe75c('0x20e'),_0x42483e);loggerPredictive[_0xe75c('0x42')](_0xe75c('0x20f'),_0x3c0884);loggerPredictive['info'](_0xe75c('0x54'));return new Promise(function(_0x453869,_0x474c08){if(_0x148a85<=0x0||isNaN(_0x148a85)){return _0x474c08(msgResponse('[abandonmentRate]',_0xe75c('0x76'),_0xe75c('0x210')+_0x148a85));}if(_0x319fad<=0x0||isNaN(_0x319fad)){return _0x474c08(msgResponse(_0xe75c('0x211'),_0xe75c('0x76'),'Ts\x20=\x20'+_0x319fad));}if(_0x42483e<=0x0||isNaN(_0x42483e)){return _0x474c08(msgResponse(_0xe75c('0x211'),_0xe75c('0x76'),_0xe75c('0x212')+_0x42483e));}if(_0x124474<=0x0||isNaN(_0x124474)){return _0x474c08(msgResponse('[abandonmentRate]','Error',_0xe75c('0x213')+_0x124474));}if(_0x3c0884<=0x0||isNaN(_0x3c0884)){return _0x474c08(msgResponse(_0xe75c('0x211'),_0xe75c('0x76'),_0xe75c('0x214')+_0x3c0884));}_0x222d69=_0x222d69||0x0;var _0x33d27f=0x1/_0x319fad;var _0x43fa28=0x0;var _0x5e126f=0x0;var _0x53837f=0x0;var _0x5cfe0c=0x0;for(var _0x25ddb5=0x0;_0x53837f<_0x3c0884;_0x25ddb5+=0x1){_0x5e126f=_0x25ddb5/_0x124474;_0x43fa28=(_0x42483e*_0x5e126f+_0x222d69)/_0x33d27f;_0x53837f=utils[_0xe75c('0x215')](_0x43fa28,_0x148a85);_0x5cfe0c=_0x43fa28/_0x148a85*(0x1-utils['erlangb'](_0x43fa28,_0x148a85));}return _0x453869({'erlangCalls':_0x25ddb5,'erlangCallToSecond':_0x124474/_0x25ddb5,'erlangAbandonmentRate':_0x53837f,'erlangBusyFactor':_0x5cfe0c});});};Dialer[_0xe75c('0x14')][_0xe75c('0x1cc')]=function(_0x6616c9,_0x25e7d8,_0x1dc707,_0x3e1a61,_0x5a7a0b,_0x2fbec8){loggerPredictive[_0xe75c('0x42')](_0xe75c('0x216'));loggerPredictive[_0xe75c('0x42')](_0xe75c('0x217'),_0x6616c9);loggerPredictive[_0xe75c('0x42')](_0xe75c('0x20d'),_0x25e7d8);loggerPredictive[_0xe75c('0x42')](_0xe75c('0x218'),_0x1dc707);loggerPredictive[_0xe75c('0x42')](_0xe75c('0x20e'),_0x3e1a61);loggerPredictive['info'](_0xe75c('0x219'),_0x5a7a0b);loggerPredictive[_0xe75c('0x42')](_0xe75c('0x54'));return new Promise(function(_0x4779fa,_0x1ac48a){if(_0x6616c9<=0x0||isNaN(_0x6616c9)){return _0x1ac48a(msgResponse(_0xe75c('0x21a'),'Error',_0xe75c('0x210')+_0x6616c9));}if(_0x1dc707<=0x0||isNaN(_0x1dc707)){return _0x1ac48a(msgResponse(_0xe75c('0x21a'),_0xe75c('0x76'),'Ts\x20=\x20'+_0x1dc707));}if(_0x3e1a61<=0x0||isNaN(_0x3e1a61)){return _0x1ac48a(msgResponse(_0xe75c('0x21a'),_0xe75c('0x76'),_0xe75c('0x212')+_0x3e1a61));}if(_0x25e7d8<=0x0||isNaN(_0x25e7d8)){return _0x1ac48a(msgResponse(_0xe75c('0x21a'),_0xe75c('0x76'),_0xe75c('0x213')+_0x25e7d8));}if(_0x5a7a0b<=0x0||isNaN(_0x5a7a0b)){return _0x1ac48a(msgResponse(_0xe75c('0x21a'),_0xe75c('0x76'),'Umin\x20=\x20'+_0x5a7a0b));}_0x2fbec8=_0x2fbec8||0x0;var _0x1b49ee=0x1/_0x1dc707;var _0x4c1cf1=0x0;var _0x43861e=0x0;var _0x3508ba=0x0;var _0x423a54=0x0;for(var _0x502167=0x0;_0x423a54<_0x5a7a0b;_0x502167+=0x1){_0x43861e=_0x502167/_0x25e7d8;_0x4c1cf1=(_0x3e1a61*_0x43861e+_0x2fbec8)/_0x1b49ee;_0x3508ba=utils[_0xe75c('0x215')](_0x4c1cf1,_0x6616c9);_0x423a54=_0x4c1cf1/_0x6616c9*(0x1-utils[_0xe75c('0x215')](_0x4c1cf1,_0x6616c9));}return _0x4779fa({'erlangCalls':_0x502167,'erlangCallToSecond':_0x25e7d8/_0x502167,'erlangAbandonmentRate':_0x3508ba,'erlangBusyFactor':_0x423a54});});};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 26f3474..6e9b617 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 _0x955a=['\x22%s\x22\x20<%s>','voiceQueue','dialCutDigit','number','substring','getQueue','exports','moment','isNil','string','uniqueid','name','Contact','phone','firstName','lastName','queue','active','type','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','prototype','format'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x955a,0x85));var _0xa955=function(_0x4f8a8f,_0x3ee402){_0x4f8a8f=_0x4f8a8f-0x0;var _0x1c99fb=_0x955a[_0x4f8a8f];return _0x1c99fb;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0xa955('0x0'));function checkNameSurname(_0xaee4f8,_0x3f9184,_0x2f20c4){var _0x242cfc='';if(!_[_0xa955('0x1')](_0x3f9184)&&_0xa955('0x2')===typeof _0x3f9184){_0x242cfc+=_0x3f9184;}if(!_['isNil'](_0x2f20c4)&&_0xa955('0x2')===typeof _0x2f20c4){_0x242cfc+='\x20'+_0x2f20c4;}if(_0x242cfc!==''){return _0x242cfc;}return _0xaee4f8;}function Action(_0xd9e58b,_0x5d4dae,_0xa34a86){this['voiceQueue']=_0xd9e58b;this[_0xa955('0x3')]=_0xa34a86||undefined;this[_0xa955('0x4')]=checkNameSurname(_0x5d4dae[_0xa955('0x5')][_0xa955('0x6')],_0x5d4dae['Contact'][_0xa955('0x7')],_0x5d4dae['Contact'][_0xa955('0x8')]);this['number']=_0x5d4dae[_0xa955('0x6')];this[_0xa955('0x9')]=_0xd9e58b[_0xa955('0x4')];this['active']=_0x5d4dae[_0xa955('0xa')]||![];this[_0xa955('0xb')]=_0xd9e58b[_0xa955('0xb')];this['dialQueueTimeout']=_0xd9e58b['dialQueueTimeout']||0x3;this[_0xa955('0xc')]=_0x5d4dae[_0xa955('0xc')];this['countbusyretry']=_0x5d4dae[_0xa955('0xd')];this[_0xa955('0xe')]=_0x5d4dae[_0xa955('0xe')];this['countnoanswerretry']=_0x5d4dae[_0xa955('0xf')];this[_0xa955('0x10')]=_0x5d4dae[_0xa955('0x10')];this[_0xa955('0x11')]=_0x5d4dae['countdropretry'];this[_0xa955('0x12')]=_0x5d4dae[_0xa955('0x12')];this[_0xa955('0x13')]=_0x5d4dae[_0xa955('0x13')];this[_0xa955('0x14')]=_0x5d4dae[_0xa955('0x14')];this[_0xa955('0x15')]=_0x5d4dae[_0xa955('0x15')];this[_0xa955('0x16')]=_0x5d4dae['ListId'];this[_0xa955('0x17')]=_0x5d4dae[_0xa955('0x17')];this[_0xa955('0x18')]=_0x5d4dae[_0xa955('0x18')];this[_0xa955('0x19')]=_0x5d4dae[_0xa955('0x19')];this[_0xa955('0x1a')]=_0x5d4dae['id'];this['ContactFirstName']=_0x5d4dae[_0xa955('0x5')][_0xa955('0x7')]||'';this['starttime']=moment()['format'](_0xa955('0x1b'));this[_0xa955('0x1c')]=_0x5d4dae[_0xa955('0x1c')];this[_0xa955('0x1d')]=_0x5d4dae['callbackuniqueid'];this['callbackat']=_0x5d4dae[_0xa955('0x1e')];this[_0xa955('0x1f')]=_0x5d4dae[_0xa955('0x1f')];this[_0xa955('0x20')]='';this['originatecalleridname']='';}Action[_0xa955('0x21')]['getCaller']=function(){return util[_0xa955('0x22')](_0xa955('0x23'),this[_0xa955('0x4')],this[_0xa955('0x24')][_0xa955('0x25')]>0x0?this[_0xa955('0x26')][_0xa955('0x27')](this['voiceQueue']['dialCutDigit']):this['number']);};Action['prototype'][_0xa955('0x28')]=function(){return this[_0xa955('0x9')];};module[_0xa955('0x29')]=Action; \ No newline at end of file +var _0x4069=['CampaignId','idHopper','ContactFirstName','starttime','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','prototype','getCaller','format','dialCutDigit','substring','getQueue','exports','util','lodash','isNil','string','voiceQueue','name','Contact','phone','firstName','lastName','number','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId'];(function(_0x13b7fd,_0x4eaf7f){var _0x32a74a=function(_0x2c5d80){while(--_0x2c5d80){_0x13b7fd['push'](_0x13b7fd['shift']());}};_0x32a74a(++_0x4eaf7f);}(_0x4069,0x6b));var _0x9406=function(_0x5a8303,_0x3da7fe){_0x5a8303=_0x5a8303-0x0;var _0x3d301d=_0x4069[_0x5a8303];return _0x3d301d;};'use strict';var util=require(_0x9406('0x0'));var _=require(_0x9406('0x1'));var moment=require('moment');function checkNameSurname(_0x2ae93d,_0x1d1dc6,_0x1407c2){var _0x20f382='';if(!_[_0x9406('0x2')](_0x1d1dc6)&&_0x9406('0x3')===typeof _0x1d1dc6){_0x20f382+=_0x1d1dc6;}if(!_[_0x9406('0x2')](_0x1407c2)&&_0x9406('0x3')===typeof _0x1407c2){_0x20f382+='\x20'+_0x1407c2;}if(_0x20f382!==''){return _0x20f382;}return _0x2ae93d;}function Action(_0x1d30ce,_0x5c4683,_0x1c12e4){this[_0x9406('0x4')]=_0x1d30ce;this['uniqueid']=_0x1c12e4||undefined;this[_0x9406('0x5')]=checkNameSurname(_0x5c4683[_0x9406('0x6')][_0x9406('0x7')],_0x5c4683[_0x9406('0x6')][_0x9406('0x8')],_0x5c4683['Contact'][_0x9406('0x9')]);this[_0x9406('0xa')]=_0x5c4683[_0x9406('0x7')];this[_0x9406('0xb')]=_0x1d30ce[_0x9406('0x5')];this[_0x9406('0xc')]=_0x5c4683[_0x9406('0xc')]||![];this[_0x9406('0xd')]=_0x1d30ce[_0x9406('0xd')];this[_0x9406('0xe')]=_0x1d30ce[_0x9406('0xe')]||0x3;this[_0x9406('0xf')]=_0x5c4683[_0x9406('0xf')];this[_0x9406('0x10')]=_0x5c4683['countbusyretry'];this[_0x9406('0x11')]=_0x5c4683[_0x9406('0x11')];this[_0x9406('0x12')]=_0x5c4683[_0x9406('0x12')];this[_0x9406('0x13')]=_0x5c4683[_0x9406('0x13')];this[_0x9406('0x14')]=_0x5c4683[_0x9406('0x14')];this['countabandonedretry']=_0x5c4683[_0x9406('0x15')];this[_0x9406('0x16')]=_0x5c4683[_0x9406('0x16')];this[_0x9406('0x17')]=_0x5c4683[_0x9406('0x17')];this[_0x9406('0x18')]=_0x5c4683[_0x9406('0x18')];this['ListId']=_0x5c4683[_0x9406('0x19')];this['UserId']=_0x5c4683[_0x9406('0x1a')];this['VoiceQueueId']=_0x5c4683[_0x9406('0x1b')];this[_0x9406('0x1c')]=_0x5c4683[_0x9406('0x1c')];this[_0x9406('0x1d')]=_0x5c4683['id'];this[_0x9406('0x1e')]=_0x5c4683[_0x9406('0x6')][_0x9406('0x8')]||'';this[_0x9406('0x1f')]=moment()['format'](_0x9406('0x20'));this['callback']=_0x5c4683[_0x9406('0x21')];this['callbackuniqueid']=_0x5c4683[_0x9406('0x22')];this[_0x9406('0x23')]=_0x5c4683[_0x9406('0x23')];this[_0x9406('0x24')]=_0x5c4683['recallme'];this[_0x9406('0x25')]='';this['originatecalleridname']='';}Action[_0x9406('0x26')][_0x9406('0x27')]=function(){return util[_0x9406('0x28')]('\x22%s\x22\x20<%s>',this[_0x9406('0x5')],this['voiceQueue'][_0x9406('0x29')]>0x0?this[_0x9406('0xa')][_0x9406('0x2a')](this[_0x9406('0x4')][_0x9406('0x29')]):this[_0x9406('0xa')]);};Action[_0x9406('0x26')][_0x9406('0x2b')]=function(){return this['queue'];};module[_0x9406('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 f90fc91..e6e037f 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 _0xb4fa=['countabandonedretry','countagentrejectretry','countnosuchnumberretry','countmachineretry','uniqueid','name','calleridnum','number','starttime','responsetime','answertime','endtime','YYYY-MM-DD\x20HH:mm:ss','getSeconds','holdtime','queue','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','exports','moment','statedesc','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry'];(function(_0x224ad0,_0x2482bd){var _0x2e04fc=function(_0x5ee761){while(--_0x5ee761){_0x224ad0['push'](_0x224ad0['shift']());}};_0x2e04fc(++_0x2482bd);}(_0xb4fa,0x1ae));var _0xab4f=function(_0x43be7e,_0x21db9e){_0x43be7e=_0x43be7e-0x0;var _0x41b589=_0xb4fa[_0x43be7e];return _0x41b589;};'use strict';var moment=require(_0xab4f('0x0'));var utils=require('../utils');function AgentComplete(_0x57edd2,_0x29ac40){this['state']=0x4;this[_0xab4f('0x1')]='Answer';this[_0xab4f('0x2')]=_0x57edd2[_0xab4f('0x2')];this[_0xab4f('0x3')]=_0x57edd2['type'];this[_0xab4f('0x4')]=_0x57edd2[_0xab4f('0x3')]===_0xab4f('0x5')?'queue':_0x57edd2[_0xab4f('0x3')];this[_0xab4f('0x6')]=_0x57edd2['countbusyretry'];this[_0xab4f('0x7')]=_0x57edd2[_0xab4f('0x7')];this[_0xab4f('0x8')]=_0x57edd2[_0xab4f('0x8')];this['countglobal']=_0x57edd2[_0xab4f('0x6')]+_0x57edd2[_0xab4f('0x7')]+_0x57edd2[_0xab4f('0x8')]+_0x57edd2['countnosuchnumberretry']+_0x57edd2[_0xab4f('0x9')]+_0x57edd2[_0xab4f('0xa')]+_0x57edd2['countmachineretry']+_0x57edd2[_0xab4f('0xb')];this[_0xab4f('0xc')]=_0x57edd2['countnosuchnumberretry'];this[_0xab4f('0x9')]=_0x57edd2[_0xab4f('0x9')];this['countabandonedretry']=_0x57edd2[_0xab4f('0xa')];this[_0xab4f('0xd')]=_0x57edd2[_0xab4f('0xd')];this[_0xab4f('0xb')]=_0x57edd2[_0xab4f('0xb')];this[_0xab4f('0xe')]=_0x29ac40[_0xab4f('0xe')];this['calleridname']=_0x57edd2[_0xab4f('0xf')];this[_0xab4f('0x10')]=_0x57edd2[_0xab4f('0x11')];this[_0xab4f('0x12')]=_0x57edd2[_0xab4f('0x12')];this['responsetime']=_0x57edd2[_0xab4f('0x13')];this[_0xab4f('0x14')]=_0x57edd2['answertime'];this[_0xab4f('0x15')]=moment()['format'](_0xab4f('0x16'));this['ringtime']=utils[_0xab4f('0x17')](_0x57edd2['responsetime'],_0x57edd2[_0xab4f('0x12')]);this[_0xab4f('0x18')]=utils['getSeconds'](_0x57edd2[_0xab4f('0x14')],_0x57edd2[_0xab4f('0x13')]);this['talktime']=utils[_0xab4f('0x17')](this[_0xab4f('0x15')],_0x57edd2[_0xab4f('0x14')]);this[_0xab4f('0x19')]=_0x29ac40[_0xab4f('0x19')];this[_0xab4f('0x1a')]=_0x29ac40[_0xab4f('0x1a')];this[_0xab4f('0x1b')]=_0x29ac40[_0xab4f('0x1b')];this[_0xab4f('0x1c')]=_0x57edd2[_0xab4f('0x1c')];this[_0xab4f('0x1d')]=_0x57edd2['callbackuniqueid'];this[_0xab4f('0x1e')]=_0x57edd2[_0xab4f('0x1e')];this[_0xab4f('0x1f')]=_0x57edd2['recallme'];this[_0xab4f('0x20')]=_0x57edd2['ContactId'];this['ListId']=_0x57edd2[_0xab4f('0x21')];this[_0xab4f('0x22')]=_0x57edd2[_0xab4f('0x22')];this['VoiceQueueId']=_0x57edd2['VoiceQueueId'];this[_0xab4f('0x23')]=_0x57edd2[_0xab4f('0x23')];this[_0xab4f('0x24')]=_0x57edd2['originatecalleridnum']||'';this[_0xab4f('0x25')]=_0x57edd2['originatecalleridname']||'';this[_0xab4f('0x26')]=_0x57edd2[_0xab4f('0x26')];}module[_0xab4f('0x27')]=AgentComplete; \ No newline at end of file +var _0x327b=['countagentrejectretry','countdropretry','countmachineretry','uniqueid','calleridname','number','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','moment','../utils','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countcongestionretry','countnoanswerretry','countglobal','countbusyretry','countnosuchnumberretry','countabandonedretry'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x327b,0x18e));var _0xb327=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0x327b[_0x4ff09b];return _0x3f5c2e;};'use strict';var moment=require(_0xb327('0x0'));var utils=require(_0xb327('0x1'));function AgentComplete(_0x150d5b,_0x4f4049){this[_0xb327('0x2')]=0x4;this[_0xb327('0x3')]=_0xb327('0x4');this[_0xb327('0x5')]=_0x150d5b[_0xb327('0x5')];this[_0xb327('0x6')]=_0x150d5b[_0xb327('0x6')];this[_0xb327('0x7')]=_0x150d5b[_0xb327('0x6')]===_0xb327('0x8')?_0xb327('0x9'):_0x150d5b['type'];this['countbusyretry']=_0x150d5b['countbusyretry'];this[_0xb327('0xa')]=_0x150d5b[_0xb327('0xa')];this[_0xb327('0xb')]=_0x150d5b[_0xb327('0xb')];this[_0xb327('0xc')]=_0x150d5b[_0xb327('0xd')]+_0x150d5b['countcongestionretry']+_0x150d5b[_0xb327('0xb')]+_0x150d5b[_0xb327('0xe')]+_0x150d5b['countdropretry']+_0x150d5b[_0xb327('0xf')]+_0x150d5b['countmachineretry']+_0x150d5b[_0xb327('0x10')];this[_0xb327('0xe')]=_0x150d5b['countnosuchnumberretry'];this[_0xb327('0x11')]=_0x150d5b[_0xb327('0x11')];this[_0xb327('0xf')]=_0x150d5b['countabandonedretry'];this[_0xb327('0x12')]=_0x150d5b[_0xb327('0x12')];this['countagentrejectretry']=_0x150d5b[_0xb327('0x10')];this[_0xb327('0x13')]=_0x4f4049[_0xb327('0x13')];this[_0xb327('0x14')]=_0x150d5b['name'];this['calleridnum']=_0x150d5b[_0xb327('0x15')];this[_0xb327('0x16')]=_0x150d5b[_0xb327('0x16')];this[_0xb327('0x17')]=_0x150d5b[_0xb327('0x17')];this[_0xb327('0x18')]=_0x150d5b['answertime'];this[_0xb327('0x19')]=moment()[_0xb327('0x1a')](_0xb327('0x1b'));this[_0xb327('0x1c')]=utils[_0xb327('0x1d')](_0x150d5b['responsetime'],_0x150d5b[_0xb327('0x16')]);this[_0xb327('0x1e')]=utils[_0xb327('0x1d')](_0x150d5b[_0xb327('0x18')],_0x150d5b[_0xb327('0x17')]);this[_0xb327('0x1f')]=utils[_0xb327('0x1d')](this['endtime'],_0x150d5b[_0xb327('0x18')]);this[_0xb327('0x9')]=_0x4f4049[_0xb327('0x9')];this[_0xb327('0x20')]=_0x4f4049[_0xb327('0x20')];this[_0xb327('0x21')]=_0x4f4049[_0xb327('0x21')];this[_0xb327('0x22')]=_0x150d5b[_0xb327('0x22')];this[_0xb327('0x23')]=_0x150d5b[_0xb327('0x23')];this[_0xb327('0x24')]=_0x150d5b[_0xb327('0x24')];this[_0xb327('0x25')]=_0x150d5b[_0xb327('0x25')];this[_0xb327('0x26')]=_0x150d5b[_0xb327('0x26')];this[_0xb327('0x27')]=_0x150d5b[_0xb327('0x27')];this[_0xb327('0x28')]=_0x150d5b[_0xb327('0x28')];this[_0xb327('0x29')]=_0x150d5b[_0xb327('0x29')];this[_0xb327('0x2a')]=_0x150d5b[_0xb327('0x2a')];this['originatecalleridnum']=_0x150d5b[_0xb327('0x2b')]||'';this[_0xb327('0x2c')]=_0x150d5b['originatecalleridname']||'';this[_0xb327('0x2d')]=_0x150d5b[_0xb327('0x2d')];}module['exports']=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 fb30bd7..fa665f4 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 _0x6af8=['campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','queue','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','type'];(function(_0x2a87fc,_0x30a039){var _0x32d9f5=function(_0x2e157c){while(--_0x2e157c){_0x2a87fc['push'](_0x2a87fc['shift']());}};_0x32d9f5(++_0x30a039);}(_0x6af8,0x64));var _0x86af=function(_0x2eb8df,_0x389390){_0x2eb8df=_0x2eb8df-0x0;var _0x187963=_0x6af8[_0x2eb8df];return _0x187963;};'use strict';function Final(_0x4618ab){this[_0x86af('0x0')]=_0x4618ab[_0x86af('0x0')];this['scheduledat']=_0x4618ab['scheduledat'];this['type']=_0x4618ab[_0x86af('0x1')];this[_0x86af('0x2')]=_0x4618ab[_0x86af('0x1')]===_0x86af('0x3')?'queue':_0x4618ab[_0x86af('0x1')];this[_0x86af('0x4')]=_0x4618ab['countbusyretry'];this[_0x86af('0x5')]=_0x4618ab[_0x86af('0x5')];this[_0x86af('0x6')]=_0x4618ab[_0x86af('0x6')];this[_0x86af('0x7')]=_0x4618ab[_0x86af('0x4')]+_0x4618ab['countcongestionretry']+_0x4618ab[_0x86af('0x6')]+_0x4618ab[_0x86af('0x8')]+_0x4618ab[_0x86af('0x9')]+_0x4618ab[_0x86af('0xa')]+_0x4618ab[_0x86af('0xb')]+_0x4618ab[_0x86af('0xc')];this['countnosuchnumberretry']=_0x4618ab['countnosuchnumberretry'];this[_0x86af('0x9')]=_0x4618ab[_0x86af('0x9')];this[_0x86af('0xa')]=_0x4618ab[_0x86af('0xa')];this[_0x86af('0xb')]=_0x4618ab[_0x86af('0xb')];this[_0x86af('0xc')]=_0x4618ab[_0x86af('0xc')];this['queue']=_0x4618ab[_0x86af('0xd')];this[_0x86af('0xe')]=_0x4618ab[_0x86af('0xe')];this[_0x86af('0xf')]=_0x4618ab[_0x86af('0xf')];this[_0x86af('0x10')]=_0x4618ab[_0x86af('0x10')];this[_0x86af('0x11')]=_0x4618ab[_0x86af('0x11')];this[_0x86af('0x12')]=_0x4618ab[_0x86af('0x11')];this[_0x86af('0x13')]=_0x4618ab[_0x86af('0x13')]||0x0;this[_0x86af('0x14')]=_0x4618ab['holdtime']||0x0;this[_0x86af('0x15')]=_0x4618ab[_0x86af('0x15')]||0x0;this[_0x86af('0x16')]=_0x4618ab[_0x86af('0x16')];this['callbackuniqueid']=_0x4618ab['callbackuniqueid'];this[_0x86af('0x17')]=_0x4618ab[_0x86af('0x17')];this[_0x86af('0x18')]=_0x4618ab[_0x86af('0x18')];this[_0x86af('0x19')]=_0x4618ab['ContactId'];this[_0x86af('0x1a')]=_0x4618ab['ListId'];this['UserId']=_0x4618ab[_0x86af('0x1b')];this['VoiceQueueId']=_0x4618ab[_0x86af('0x1c')];this['CampaignId']=_0x4618ab['CampaignId'];this[_0x86af('0x1d')]=_0x4618ab[_0x86af('0x1d')]||'';this[_0x86af('0x1e')]=_0x4618ab[_0x86af('0x1e')]||'';this[_0x86af('0x1f')]=_0x4618ab[_0x86af('0x1f')];this[_0x86af('0x20')]=_0x4618ab[_0x86af('0x20')];}module[_0x86af('0x21')]=Final; \ No newline at end of file +var _0x9756=['callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type','campaigntype','outbound','queue','countcongestionretry','countnoanswerretry','countglobal','countbusyretry','countnosuchnumberretry','countabandonedretry','countdropretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime'];(function(_0xe02fb7,_0x3554ec){var _0x41e00a=function(_0x1feece){while(--_0x1feece){_0xe02fb7['push'](_0xe02fb7['shift']());}};_0x41e00a(++_0x3554ec);}(_0x9756,0x15b));var _0x6975=function(_0x2112d4,_0x3c863c){_0x2112d4=_0x2112d4-0x0;var _0x434972=_0x9756[_0x2112d4];return _0x434972;};'use strict';function Final(_0x5deabc){this[_0x6975('0x0')]=_0x5deabc[_0x6975('0x0')];this['scheduledat']=_0x5deabc[_0x6975('0x1')];this[_0x6975('0x2')]=_0x5deabc[_0x6975('0x2')];this[_0x6975('0x3')]=_0x5deabc['type']===_0x6975('0x4')?_0x6975('0x5'):_0x5deabc[_0x6975('0x2')];this['countbusyretry']=_0x5deabc['countbusyretry'];this[_0x6975('0x6')]=_0x5deabc[_0x6975('0x6')];this[_0x6975('0x7')]=_0x5deabc[_0x6975('0x7')];this[_0x6975('0x8')]=_0x5deabc[_0x6975('0x9')]+_0x5deabc[_0x6975('0x6')]+_0x5deabc[_0x6975('0x7')]+_0x5deabc[_0x6975('0xa')]+_0x5deabc['countdropretry']+_0x5deabc[_0x6975('0xb')]+_0x5deabc['countmachineretry']+_0x5deabc['countagentrejectretry'];this[_0x6975('0xa')]=_0x5deabc['countnosuchnumberretry'];this['countdropretry']=_0x5deabc[_0x6975('0xc')];this[_0x6975('0xb')]=_0x5deabc[_0x6975('0xb')];this[_0x6975('0xd')]=_0x5deabc[_0x6975('0xd')];this[_0x6975('0xe')]=_0x5deabc[_0x6975('0xe')];this[_0x6975('0x5')]=_0x5deabc[_0x6975('0x5')];this['calleridname']=_0x5deabc[_0x6975('0xf')];this[_0x6975('0x10')]=_0x5deabc['calleridnum'];this[_0x6975('0x11')]=_0x5deabc[_0x6975('0x11')];this[_0x6975('0x12')]=_0x5deabc[_0x6975('0x12')];this[_0x6975('0x13')]=_0x5deabc[_0x6975('0x12')];this[_0x6975('0x14')]=_0x5deabc[_0x6975('0x14')]||0x0;this[_0x6975('0x15')]=_0x5deabc[_0x6975('0x15')]||0x0;this['talktime']=_0x5deabc[_0x6975('0x16')]||0x0;this[_0x6975('0x17')]=_0x5deabc[_0x6975('0x17')];this[_0x6975('0x18')]=_0x5deabc[_0x6975('0x18')];this[_0x6975('0x19')]=_0x5deabc[_0x6975('0x19')];this[_0x6975('0x1a')]=_0x5deabc[_0x6975('0x1a')];this[_0x6975('0x1b')]=_0x5deabc[_0x6975('0x1b')];this[_0x6975('0x1c')]=_0x5deabc[_0x6975('0x1c')];this[_0x6975('0x1d')]=_0x5deabc[_0x6975('0x1d')];this[_0x6975('0x1e')]=_0x5deabc['VoiceQueueId'];this[_0x6975('0x1f')]=_0x5deabc[_0x6975('0x1f')];this['originatecalleridnum']=_0x5deabc[_0x6975('0x20')]||'';this[_0x6975('0x21')]=_0x5deabc[_0x6975('0x21')]||'';this['state']=_0x5deabc[_0x6975('0x22')];this[_0x6975('0x23')]=_0x5deabc[_0x6975('0x23')];}module[_0x6975('0x24')]=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 f037329..4625536 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 _0xab3e=['moment','../utils','statedesc','Answer','scheduledat','type','outbound','amd','countbusyretry','countnoanswerretry','countglobal','countcongestionretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','name','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','holdtime','talktime','queue','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','exports'];(function(_0x18c7a8,_0x5d60a6){var _0x36b1ac=function(_0x16a458){while(--_0x16a458){_0x18c7a8['push'](_0x18c7a8['shift']());}};_0x36b1ac(++_0x5d60a6);}(_0xab3e,0xa8));var _0xeab3=function(_0x358de0,_0x319365){_0x358de0=_0x358de0-0x0;var _0x83f818=_0xab3e[_0x358de0];return _0x83f818;};'use strict';var moment=require(_0xeab3('0x0'));var utils=require(_0xeab3('0x1'));function Hangup(_0x5cb556,_0x49f031){this['state']=0x4;this[_0xeab3('0x2')]=_0xeab3('0x3');this[_0xeab3('0x4')]=_0x5cb556['scheduledat'];this[_0xeab3('0x5')]=_0x5cb556['type'];this['campaigntype']=_0x5cb556[_0xeab3('0x5')]===_0xeab3('0x6')?'queue':_0x5cb556[_0xeab3('0x5')];this[_0xeab3('0x7')]=_0x5cb556['amd']||![];this[_0xeab3('0x8')]=_0x5cb556[_0xeab3('0x8')];this['countcongestionretry']=_0x5cb556['countcongestionretry'];this['countnoanswerretry']=_0x5cb556[_0xeab3('0x9')];this[_0xeab3('0xa')]=_0x5cb556['countbusyretry']+_0x5cb556[_0xeab3('0xb')]+_0x5cb556[_0xeab3('0x9')]+_0x5cb556['countnosuchnumberretry']+_0x5cb556[_0xeab3('0xc')]+_0x5cb556[_0xeab3('0xd')]+_0x5cb556[_0xeab3('0xe')]+_0x5cb556[_0xeab3('0xf')];this['countnosuchnumberretry']=_0x5cb556[_0xeab3('0x10')];this[_0xeab3('0xc')]=_0x5cb556[_0xeab3('0xc')];this[_0xeab3('0xd')]=_0x5cb556[_0xeab3('0xd')];this[_0xeab3('0xe')]=_0x5cb556[_0xeab3('0xe')];this[_0xeab3('0xf')]=_0x5cb556[_0xeab3('0xf')];this[_0xeab3('0x11')]=_0x49f031['uniqueid'];this['calleridname']=_0x5cb556[_0xeab3('0x12')];this['calleridnum']=_0x5cb556[_0xeab3('0x13')];this[_0xeab3('0x14')]=_0x5cb556[_0xeab3('0x14')];this['responsetime']=_0x5cb556[_0xeab3('0x15')];this[_0xeab3('0x16')]=moment()[_0xeab3('0x17')](_0xeab3('0x18'));this[_0xeab3('0x19')]=utils[_0xeab3('0x1a')](_0x5cb556[_0xeab3('0x15')],_0x5cb556[_0xeab3('0x14')]);this[_0xeab3('0x1b')]=0x0;this[_0xeab3('0x1c')]=utils[_0xeab3('0x1a')](this[_0xeab3('0x16')],_0x5cb556[_0xeab3('0x15')]);this['queue']=_0x5cb556[_0xeab3('0x1d')];this['membername']=_0xeab3('0x1e');this[_0xeab3('0x1f')]=_0x49f031[_0xeab3('0x20')];this[_0xeab3('0x21')]=_0x5cb556[_0xeab3('0x21')];this[_0xeab3('0x22')]=_0x5cb556[_0xeab3('0x22')];this[_0xeab3('0x23')]=_0x5cb556[_0xeab3('0x23')];this[_0xeab3('0x24')]=_0x5cb556['recallme'];this[_0xeab3('0x25')]=_0x5cb556[_0xeab3('0x25')];this[_0xeab3('0x26')]=_0x5cb556[_0xeab3('0x26')];this[_0xeab3('0x27')]=_0x5cb556[_0xeab3('0x27')];this[_0xeab3('0x28')]=_0x5cb556['VoiceQueueId'];this['CampaignId']=_0x5cb556['CampaignId'];}module[_0xeab3('0x29')]=Hangup; \ No newline at end of file +var _0xc1b6=['countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countdropretry','uniqueid','name','starttime','format','ringtime','getSeconds','holdtime','talktime','endtime','responsetime','membername','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','moment','../utils','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','amd'];(function(_0x5519a9,_0x1c5147){var _0x32f2cc=function(_0x52ed58){while(--_0x52ed58){_0x5519a9['push'](_0x5519a9['shift']());}};_0x32f2cc(++_0x1c5147);}(_0xc1b6,0x1ce));var _0x6c1b=function(_0x454ea9,_0x4f9868){_0x454ea9=_0x454ea9-0x0;var _0x5dbe48=_0xc1b6[_0x454ea9];return _0x5dbe48;};'use strict';var moment=require(_0x6c1b('0x0'));var utils=require(_0x6c1b('0x1'));function Hangup(_0xf01beb,_0x51e7df){this[_0x6c1b('0x2')]=0x4;this[_0x6c1b('0x3')]=_0x6c1b('0x4');this[_0x6c1b('0x5')]=_0xf01beb[_0x6c1b('0x5')];this[_0x6c1b('0x6')]=_0xf01beb[_0x6c1b('0x6')];this[_0x6c1b('0x7')]=_0xf01beb[_0x6c1b('0x6')]===_0x6c1b('0x8')?_0x6c1b('0x9'):_0xf01beb['type'];this[_0x6c1b('0xa')]=_0xf01beb[_0x6c1b('0xa')]||![];this['countbusyretry']=_0xf01beb[_0x6c1b('0xb')];this[_0x6c1b('0xc')]=_0xf01beb[_0x6c1b('0xc')];this['countnoanswerretry']=_0xf01beb[_0x6c1b('0xd')];this[_0x6c1b('0xe')]=_0xf01beb[_0x6c1b('0xb')]+_0xf01beb[_0x6c1b('0xc')]+_0xf01beb[_0x6c1b('0xd')]+_0xf01beb['countnosuchnumberretry']+_0xf01beb['countdropretry']+_0xf01beb[_0x6c1b('0xf')]+_0xf01beb[_0x6c1b('0x10')]+_0xf01beb[_0x6c1b('0x11')];this['countnosuchnumberretry']=_0xf01beb[_0x6c1b('0x12')];this['countdropretry']=_0xf01beb[_0x6c1b('0x13')];this[_0x6c1b('0xf')]=_0xf01beb[_0x6c1b('0xf')];this[_0x6c1b('0x10')]=_0xf01beb['countmachineretry'];this['countagentrejectretry']=_0xf01beb[_0x6c1b('0x11')];this[_0x6c1b('0x14')]=_0x51e7df[_0x6c1b('0x14')];this['calleridname']=_0xf01beb[_0x6c1b('0x15')];this['calleridnum']=_0xf01beb['number'];this[_0x6c1b('0x16')]=_0xf01beb[_0x6c1b('0x16')];this['responsetime']=_0xf01beb['responsetime'];this['endtime']=moment()[_0x6c1b('0x17')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x6c1b('0x18')]=utils[_0x6c1b('0x19')](_0xf01beb['responsetime'],_0xf01beb['starttime']);this[_0x6c1b('0x1a')]=0x0;this[_0x6c1b('0x1b')]=utils[_0x6c1b('0x19')](this[_0x6c1b('0x1c')],_0xf01beb[_0x6c1b('0x1d')]);this[_0x6c1b('0x9')]=_0xf01beb['queue'];this[_0x6c1b('0x1e')]='IVR';this[_0x6c1b('0x1f')]=_0x51e7df[_0x6c1b('0x20')];this['callback']=_0xf01beb[_0x6c1b('0x21')];this[_0x6c1b('0x22')]=_0xf01beb['callbackuniqueid'];this['callbackat']=_0xf01beb[_0x6c1b('0x23')];this['recallme']=_0xf01beb[_0x6c1b('0x24')];this[_0x6c1b('0x25')]=_0xf01beb[_0x6c1b('0x25')];this[_0x6c1b('0x26')]=_0xf01beb[_0x6c1b('0x26')];this[_0x6c1b('0x27')]=_0xf01beb[_0x6c1b('0x27')];this[_0x6c1b('0x28')]=_0xf01beb['VoiceQueueId'];this[_0x6c1b('0x29')]=_0xf01beb[_0x6c1b('0x29')];}module[_0x6c1b('0x2a')]=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 95031a8..d76ed5a 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 _0xcf34=['countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','queue','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','getSeconds','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','../utils','scheduledat','type','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry'];(function(_0x15d38f,_0x2202e0){var _0x331044=function(_0x390bdd){while(--_0x390bdd){_0x15d38f['push'](_0x15d38f['shift']());}};_0x331044(++_0x2202e0);}(_0xcf34,0x17a));var _0x4cf3=function(_0x1b0597,_0xeffacc){_0x1b0597=_0x1b0597-0x0;var _0x2b6a2a=_0xcf34[_0x1b0597];return _0x2b6a2a;};'use strict';var utils=require(_0x4cf3('0x0'));function History(_0x1b6695){this['uniqueid']=_0x1b6695['uniqueid'];this['scheduledat']=_0x1b6695[_0x4cf3('0x1')]||undefined;this[_0x4cf3('0x2')]=_0x1b6695[_0x4cf3('0x2')];this['campaigntype']=_0x1b6695[_0x4cf3('0x2')]==='outbound'?'queue':_0x1b6695[_0x4cf3('0x2')];this['countbusyretry']=_0x1b6695[_0x4cf3('0x3')];this[_0x4cf3('0x4')]=_0x1b6695[_0x4cf3('0x4')];this[_0x4cf3('0x5')]=_0x1b6695['countnoanswerretry'];this['countglobal']=_0x1b6695[_0x4cf3('0x3')]+_0x1b6695[_0x4cf3('0x4')]+_0x1b6695[_0x4cf3('0x5')]+_0x1b6695[_0x4cf3('0x6')]+_0x1b6695[_0x4cf3('0x7')]+_0x1b6695[_0x4cf3('0x8')]+_0x1b6695[_0x4cf3('0x9')]+_0x1b6695[_0x4cf3('0xa')];this['countnosuchnumberretry']=_0x1b6695[_0x4cf3('0x6')];this[_0x4cf3('0x7')]=_0x1b6695[_0x4cf3('0x7')];this['countabandonedretry']=_0x1b6695[_0x4cf3('0x8')];this[_0x4cf3('0x9')]=_0x1b6695['countmachineretry'];this['countagentrejectretry']=_0x1b6695[_0x4cf3('0xa')];this[_0x4cf3('0xb')]=_0x1b6695[_0x4cf3('0xb')];this[_0x4cf3('0xc')]=_0x1b6695['name'];this[_0x4cf3('0xd')]=_0x1b6695['number'];this['starttime']=_0x1b6695[_0x4cf3('0xe')];this[_0x4cf3('0xf')]=_0x1b6695[_0x4cf3('0xf')];this[_0x4cf3('0x10')]=_0x1b6695[_0x4cf3('0xf')];this[_0x4cf3('0x11')]=utils[_0x4cf3('0x12')](_0x1b6695[_0x4cf3('0xf')],_0x1b6695['starttime']);this[_0x4cf3('0x13')]=0x0;this[_0x4cf3('0x14')]=0x0;this[_0x4cf3('0x15')]=_0x1b6695[_0x4cf3('0x15')];this['callbackuniqueid']=_0x1b6695[_0x4cf3('0x16')];this[_0x4cf3('0x17')]=_0x1b6695[_0x4cf3('0x17')];this[_0x4cf3('0x18')]=_0x1b6695[_0x4cf3('0x18')];this[_0x4cf3('0x19')]=_0x1b6695[_0x4cf3('0x19')];this[_0x4cf3('0x1a')]=_0x1b6695[_0x4cf3('0x1a')];this[_0x4cf3('0x1b')]=_0x1b6695['UserId'];this['VoiceQueueId']=_0x1b6695[_0x4cf3('0x1c')];this[_0x4cf3('0x1d')]=_0x1b6695[_0x4cf3('0x1d')];this[_0x4cf3('0x1e')]=_0x1b6695['originatecalleridnum']||'';this[_0x4cf3('0x1f')]=_0x1b6695[_0x4cf3('0x1f')]||'';this[_0x4cf3('0x20')]=_0x1b6695[_0x4cf3('0x20')];this[_0x4cf3('0x21')]=_0x1b6695[_0x4cf3('0x21')];}module[_0x4cf3('0x22')]=History; \ No newline at end of file +var _0x38ca=['callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','../utils','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countagentrejectretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','name','calleridnum','starttime','responsetime','endtime','ringtime','getSeconds','holdtime','talktime','callback','callbackuniqueid'];(function(_0x303d17,_0x320ca8){var _0x29fb11=function(_0x1d41b1){while(--_0x1d41b1){_0x303d17['push'](_0x303d17['shift']());}};_0x29fb11(++_0x320ca8);}(_0x38ca,0x187));var _0xa38c=function(_0x2f32ec,_0x5711b6){_0x2f32ec=_0x2f32ec-0x0;var _0x6b7008=_0x38ca[_0x2f32ec];return _0x6b7008;};'use strict';var utils=require(_0xa38c('0x0'));function History(_0x26aa24){this[_0xa38c('0x1')]=_0x26aa24[_0xa38c('0x1')];this[_0xa38c('0x2')]=_0x26aa24[_0xa38c('0x2')]||undefined;this[_0xa38c('0x3')]=_0x26aa24['type'];this[_0xa38c('0x4')]=_0x26aa24['type']===_0xa38c('0x5')?_0xa38c('0x6'):_0x26aa24[_0xa38c('0x3')];this['countbusyretry']=_0x26aa24[_0xa38c('0x7')];this[_0xa38c('0x8')]=_0x26aa24[_0xa38c('0x8')];this[_0xa38c('0x9')]=_0x26aa24['countnoanswerretry'];this[_0xa38c('0xa')]=_0x26aa24[_0xa38c('0x7')]+_0x26aa24['countcongestionretry']+_0x26aa24[_0xa38c('0x9')]+_0x26aa24['countnosuchnumberretry']+_0x26aa24['countdropretry']+_0x26aa24['countabandonedretry']+_0x26aa24['countmachineretry']+_0x26aa24[_0xa38c('0xb')];this['countnosuchnumberretry']=_0x26aa24[_0xa38c('0xc')];this[_0xa38c('0xd')]=_0x26aa24[_0xa38c('0xd')];this['countabandonedretry']=_0x26aa24[_0xa38c('0xe')];this[_0xa38c('0xf')]=_0x26aa24[_0xa38c('0xf')];this[_0xa38c('0xb')]=_0x26aa24['countagentrejectretry'];this[_0xa38c('0x6')]=_0x26aa24[_0xa38c('0x6')];this['calleridname']=_0x26aa24[_0xa38c('0x10')];this[_0xa38c('0x11')]=_0x26aa24['number'];this[_0xa38c('0x12')]=_0x26aa24['starttime'];this[_0xa38c('0x13')]=_0x26aa24[_0xa38c('0x13')];this[_0xa38c('0x14')]=_0x26aa24[_0xa38c('0x13')];this[_0xa38c('0x15')]=utils[_0xa38c('0x16')](_0x26aa24['responsetime'],_0x26aa24[_0xa38c('0x12')]);this[_0xa38c('0x17')]=0x0;this[_0xa38c('0x18')]=0x0;this['callback']=_0x26aa24[_0xa38c('0x19')];this[_0xa38c('0x1a')]=_0x26aa24['callbackuniqueid'];this['callbackat']=_0x26aa24[_0xa38c('0x1b')];this[_0xa38c('0x1c')]=_0x26aa24['recallme'];this[_0xa38c('0x1d')]=_0x26aa24[_0xa38c('0x1d')];this[_0xa38c('0x1e')]=_0x26aa24[_0xa38c('0x1e')];this[_0xa38c('0x1f')]=_0x26aa24[_0xa38c('0x1f')];this[_0xa38c('0x20')]=_0x26aa24['VoiceQueueId'];this[_0xa38c('0x21')]=_0x26aa24[_0xa38c('0x21')];this[_0xa38c('0x22')]=_0x26aa24['originatecalleridnum']||'';this[_0xa38c('0x23')]=_0x26aa24['originatecalleridname']||'';this[_0xa38c('0x24')]=_0x26aa24[_0xa38c('0x24')];this['statedesc']=_0x26aa24[_0xa38c('0x25')];}module['exports']=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 dae0b96..dbc4ee1 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 _0x1171=['scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','name','calleridnum','number','starttime','responsetime','droptime','dropreason','endtime','ringtime','holdtime','talktime','queue','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','exports','../utils'];(function(_0x41643f,_0x5743b2){var _0x3ef28c=function(_0x31d548){while(--_0x31d548){_0x41643f['push'](_0x41643f['shift']());}};_0x3ef28c(++_0x5743b2);}(_0x1171,0x83));var _0x1117=function(_0x552041,_0xc34ee7){_0x552041=_0x552041-0x0;var _0x198a1a=_0x1171[_0x552041];return _0x198a1a;};'use strict';var utils=require(_0x1117('0x0'));function QueueCallerAbandon(_0x461b32,_0x3c87c9){this[_0x1117('0x1')]=_0x461b32[_0x1117('0x1')];this[_0x1117('0x2')]=_0x461b32[_0x1117('0x2')];this[_0x1117('0x3')]=_0x461b32['type']===_0x1117('0x4')?'queue':_0x461b32[_0x1117('0x2')];this['countbusyretry']=_0x461b32[_0x1117('0x5')];this['countcongestionretry']=_0x461b32[_0x1117('0x6')];this['countnoanswerretry']=_0x461b32['countnoanswerretry'];this[_0x1117('0x7')]=_0x461b32[_0x1117('0x5')]+_0x461b32[_0x1117('0x6')]+_0x461b32['countnoanswerretry']+_0x461b32[_0x1117('0x8')]+_0x461b32[_0x1117('0x9')]+_0x461b32[_0x1117('0xa')]+_0x461b32[_0x1117('0xb')]+_0x461b32[_0x1117('0xc')];this[_0x1117('0x8')]=_0x461b32['countnosuchnumberretry'];this[_0x1117('0x9')]=_0x461b32['countdropretry'];this[_0x1117('0xa')]=_0x461b32[_0x1117('0xa')];this[_0x1117('0xb')]=_0x461b32[_0x1117('0xb')];this['countagentrejectretry']=_0x461b32[_0x1117('0xc')];this['uniqueid']=_0x3c87c9[_0x1117('0xd')];this['calleridname']=_0x461b32[_0x1117('0xe')];this[_0x1117('0xf')]=_0x461b32[_0x1117('0x10')];this[_0x1117('0x11')]=_0x461b32['starttime'];this[_0x1117('0x12')]=_0x461b32['responsetime'];this[_0x1117('0x13')]=_0x461b32['droptime'];this[_0x1117('0x14')]=_0x461b32[_0x1117('0x14')];this[_0x1117('0x15')]=this[_0x1117('0x13')];this[_0x1117('0x16')]=utils['getSeconds'](_0x461b32[_0x1117('0x12')],_0x461b32[_0x1117('0x11')]);this[_0x1117('0x17')]=utils['getSeconds'](this[_0x1117('0x13')],_0x461b32['responsetime']);this[_0x1117('0x18')]=0x0;this[_0x1117('0x19')]=_0x3c87c9['queue'];this[_0x1117('0x1a')]=_0x3c87c9[_0x1117('0x1b')];this['reason']=_0x3c87c9[_0x1117('0x1c')];this[_0x1117('0x1d')]=_0x461b32[_0x1117('0x1d')];this['callbackuniqueid']=_0x461b32[_0x1117('0x1e')];this[_0x1117('0x1f')]=_0x461b32['callbackat'];this['recallme']=_0x461b32[_0x1117('0x20')];this[_0x1117('0x21')]=_0x461b32[_0x1117('0x21')];this[_0x1117('0x22')]=_0x461b32[_0x1117('0x22')];this[_0x1117('0x23')]=_0x461b32[_0x1117('0x23')];this[_0x1117('0x24')]=_0x461b32[_0x1117('0x24')];this[_0x1117('0x25')]=_0x461b32[_0x1117('0x25')];this[_0x1117('0x26')]=_0x461b32[_0x1117('0x26')]||'';this[_0x1117('0x27')]=_0x461b32['originatecalleridname']||'';this[_0x1117('0x28')]=_0x461b32[_0x1117('0x28')];this[_0x1117('0x29')]=_0x461b32[_0x1117('0x29')];this[_0x1117('0x2a')]=_0x461b32[_0x1117('0x2a')];}module[_0x1117('0x2b')]=QueueCallerAbandon; \ No newline at end of file +var _0xe87b=['statedesc','type','campaigntype','queue','countbusyretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','droptime','dropreason','endtime','ringtime','holdtime','getSeconds','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','agiafterat','state'];(function(_0x56b138,_0x2396d6){var _0x3df878=function(_0x4b3ccc){while(--_0x4b3ccc){_0x56b138['push'](_0x56b138['shift']());}};_0x3df878(++_0x2396d6);}(_0xe87b,0xc9));var _0xbe87=function(_0x53730b,_0x1d7cb6){_0x53730b=_0x53730b-0x0;var _0x1bb992=_0xe87b[_0x53730b];return _0x1bb992;};'use strict';var utils=require('../utils');function QueueCallerAbandon(_0x5c64f7,_0x1ed1c5){this['scheduledat']=_0x5c64f7['scheduledat'];this[_0xbe87('0x0')]=_0x5c64f7[_0xbe87('0x0')];this[_0xbe87('0x1')]=_0x5c64f7[_0xbe87('0x0')]==='outbound'?_0xbe87('0x2'):_0x5c64f7[_0xbe87('0x0')];this[_0xbe87('0x3')]=_0x5c64f7['countbusyretry'];this['countcongestionretry']=_0x5c64f7['countcongestionretry'];this[_0xbe87('0x4')]=_0x5c64f7[_0xbe87('0x4')];this[_0xbe87('0x5')]=_0x5c64f7[_0xbe87('0x3')]+_0x5c64f7['countcongestionretry']+_0x5c64f7[_0xbe87('0x4')]+_0x5c64f7[_0xbe87('0x6')]+_0x5c64f7[_0xbe87('0x7')]+_0x5c64f7[_0xbe87('0x8')]+_0x5c64f7[_0xbe87('0x9')]+_0x5c64f7[_0xbe87('0xa')];this[_0xbe87('0x6')]=_0x5c64f7['countnosuchnumberretry'];this[_0xbe87('0x7')]=_0x5c64f7[_0xbe87('0x7')];this['countabandonedretry']=_0x5c64f7[_0xbe87('0x8')];this['countmachineretry']=_0x5c64f7[_0xbe87('0x9')];this[_0xbe87('0xa')]=_0x5c64f7[_0xbe87('0xa')];this[_0xbe87('0xb')]=_0x1ed1c5[_0xbe87('0xb')];this[_0xbe87('0xc')]=_0x5c64f7[_0xbe87('0xd')];this[_0xbe87('0xe')]=_0x5c64f7[_0xbe87('0xf')];this[_0xbe87('0x10')]=_0x5c64f7[_0xbe87('0x10')];this[_0xbe87('0x11')]=_0x5c64f7[_0xbe87('0x11')];this[_0xbe87('0x12')]=_0x5c64f7['droptime'];this[_0xbe87('0x13')]=_0x5c64f7['dropreason'];this[_0xbe87('0x14')]=this[_0xbe87('0x12')];this[_0xbe87('0x15')]=utils['getSeconds'](_0x5c64f7[_0xbe87('0x11')],_0x5c64f7['starttime']);this[_0xbe87('0x16')]=utils[_0xbe87('0x17')](this['droptime'],_0x5c64f7[_0xbe87('0x11')]);this[_0xbe87('0x18')]=0x0;this['queue']=_0x1ed1c5[_0xbe87('0x2')];this[_0xbe87('0x19')]=_0x1ed1c5[_0xbe87('0x1a')];this[_0xbe87('0x1b')]=_0x1ed1c5[_0xbe87('0x1b')];this['callback']=_0x5c64f7[_0xbe87('0x1c')];this['callbackuniqueid']=_0x5c64f7[_0xbe87('0x1d')];this[_0xbe87('0x1e')]=_0x5c64f7[_0xbe87('0x1e')];this[_0xbe87('0x1f')]=_0x5c64f7[_0xbe87('0x1f')];this['ContactId']=_0x5c64f7['ContactId'];this[_0xbe87('0x20')]=_0x5c64f7[_0xbe87('0x20')];this[_0xbe87('0x21')]=_0x5c64f7[_0xbe87('0x21')];this['VoiceQueueId']=_0x5c64f7[_0xbe87('0x22')];this[_0xbe87('0x23')]=_0x5c64f7['CampaignId'];this[_0xbe87('0x24')]=_0x5c64f7[_0xbe87('0x24')]||'';this['originatecalleridname']=_0x5c64f7['originatecalleridname']||'';this[_0xbe87('0x25')]=_0x5c64f7[_0xbe87('0x25')];this['state']=_0x5c64f7[_0xbe87('0x26')];this[_0xbe87('0x27')]=_0x5c64f7[_0xbe87('0x27')];}module['exports']=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 b3ceb0e..db6ba1a 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 _0x27a0=['[avgHandleTime]','createHistory','../../../../config/logger','dialer','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperBlack','getContactDialer','dialOrderByScheduledAt','catch','error','[getContactDialer]','getContactDialerIvr','temp','[getContactDialerIvr]','countReScheduled','[countReScheduled]','rescheduleContact','unlockContact','moveContactManagedDialer','[moveContactManagedDialer]','checkIsBlackList','checkIsBlackListIvr','verifyAdditionalPhones','[swapAdditionalPhone]','swapAdditionalPhones','avgHandleTime'];(function(_0x284d91,_0xbdba80){var _0xc2df44=function(_0x53adea){while(--_0x53adea){_0x284d91['push'](_0x284d91['shift']());}};_0xc2df44(++_0xbdba80);}(_0x27a0,0xbf));var _0x027a=function(_0x1bd113,_0x39258f){_0x1bd113=_0x1bd113-0x0;var _0x54944b=_0x27a0[_0x1bd113];return _0x54944b;};'use strict';var util=require('util');var logger=require(_0x027a('0x0'))(_0x027a('0x1'));var cmHopper=require(_0x027a('0x2'));var cmHopperAdditionalPhone=require(_0x027a('0x3'));var cmHopperBlack=require(_0x027a('0x4'));var cmHopperHistory=require('../../rpc/cmHopperHistory');function inspectError(_0x58a58b){return util['inspect'](_0x58a58b,{'showHidden':![],'depth':null});}function getContactDialer(_0x47cd65,_0x30a54d,_0x2a409a){return cmHopper[_0x027a('0x5')](_0x47cd65['id'],_0x30a54d,_0x2a409a,_0x47cd65[_0x027a('0x6')])[_0x027a('0x7')](function(_0x3c7d67){_0x47cd65['temp']=0x0;logger[_0x027a('0x8')](_0x027a('0x9'),inspectError(_0x3c7d67));});}exports[_0x027a('0x5')]=getContactDialer;function getContactDialerIvr(_0x4ccee2,_0x44c56a){return cmHopper[_0x027a('0xa')](_0x4ccee2['id'],_0x44c56a,_0x4ccee2[_0x027a('0x6')])['catch'](function(_0x6d5b04){_0x4ccee2[_0x027a('0xb')]=0x0;logger[_0x027a('0x8')](_0x027a('0xc'),inspectError(_0x6d5b04));});}exports[_0x027a('0xa')]=getContactDialerIvr;function countReScheduled(_0x267afc){return cmHopper[_0x027a('0xd')](_0x267afc)[_0x027a('0x7')](function(_0x351d7e){logger[_0x027a('0x8')](_0x027a('0xe'),inspectError(_0x351d7e));});}exports['countReScheduled']=countReScheduled;function rescheduleContact(_0xe64d3a){return cmHopper[_0x027a('0xf')](_0xe64d3a)[_0x027a('0x7')](function(_0x21da53){logger[_0x027a('0x8')]('[rescheduleContact]',inspectError(_0x21da53));});}exports['rescheduleContact']=rescheduleContact;function unlockContact(_0x1d680d,_0x5cfc6d,_0x2b3870){return cmHopper['unlockContact'](_0x1d680d,_0x5cfc6d,_0x2b3870)[_0x027a('0x7')](function(_0x5a1224){logger['error']('[unlockContact]',inspectError(_0x5a1224));});}exports[_0x027a('0x10')]=unlockContact;function moveContactManagedDialer(_0x2f04e9){return cmHopper[_0x027a('0x11')](_0x2f04e9)[_0x027a('0x7')](function(_0x52125e){logger[_0x027a('0x8')](_0x027a('0x12'),inspectError(_0x52125e));});}exports['moveContactManagedDialer']=moveContactManagedDialer;function checkIsBlackList(_0x4f8c3d){return cmHopperBlack[_0x027a('0x13')](_0x4f8c3d)['catch'](function(_0x1d4a7a){logger['error']('[checkIsBlackList]',inspectError(_0x1d4a7a));});}exports['checkIsBlackList']=checkIsBlackList;function checkIsBlackListIvr(_0x4b4f90){return cmHopperBlack[_0x027a('0x14')](_0x4b4f90)[_0x027a('0x7')](function(_0x266c9e){logger[_0x027a('0x8')]('[checkIsBlackListIvr]',inspectError(_0x266c9e));});}exports[_0x027a('0x14')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x119a5c,_0x20e2da,_0x3dee99){return cmHopperAdditionalPhone[_0x027a('0x15')](_0x119a5c,_0x20e2da,_0x3dee99)[_0x027a('0x7')](function(_0x595f0e){logger[_0x027a('0x8')]('[verifyAdditionalPhone]',inspectError(_0x595f0e));});}exports[_0x027a('0x15')]=verifyAdditionalPhones;function swapAdditionalPhones(_0x2e97c5,_0x1b1a13,_0x83fe3e){return cmHopperAdditionalPhone['swapAdditionalPhones'](_0x2e97c5,_0x1b1a13,_0x83fe3e)['catch'](function(_0x18458f){logger[_0x027a('0x8')](_0x027a('0x16'),inspectError(_0x18458f));});}exports[_0x027a('0x17')]=swapAdditionalPhones;function avgHandleTime(_0x511c7a){return cmHopperHistory[_0x027a('0x18')](_0x511c7a)['catch'](function(_0x953887){logger['error'](_0x027a('0x19'),inspectError(_0x953887));});}exports['avgHandleTime']=avgHandleTime;function createHistory(_0x578ea5){return cmHopperHistory[_0x027a('0x1a')](_0x578ea5)['catch'](function(_0x47a365){logger[_0x027a('0x8')]('[createHistory]',inspectError(_0x47a365));});}exports[_0x027a('0x1a')]=createHistory; \ No newline at end of file +var _0xdf55=['createHistory','util','../../../../config/logger','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperHistory','inspect','getContactDialer','dialOrderByScheduledAt','catch','temp','error','countReScheduled','[countReScheduled]','rescheduleContact','unlockContact','moveContactManagedDialer','checkIsBlackList','[checkIsBlackList]','checkIsBlackListIvr','[checkIsBlackListIvr]','verifyAdditionalPhones','[verifyAdditionalPhone]','swapAdditionalPhones','[swapAdditionalPhone]','[avgHandleTime]'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0xdf55,0x83));var _0x5df5=function(_0x547587,_0x48cbd9){_0x547587=_0x547587-0x0;var _0x3d7777=_0xdf55[_0x547587];return _0x3d7777;};'use strict';var util=require(_0x5df5('0x0'));var logger=require(_0x5df5('0x1'))('dialer');var cmHopper=require(_0x5df5('0x2'));var cmHopperAdditionalPhone=require(_0x5df5('0x3'));var cmHopperBlack=require('../../rpc/cmHopperBlack');var cmHopperHistory=require(_0x5df5('0x4'));function inspectError(_0x773e15){return util[_0x5df5('0x5')](_0x773e15,{'showHidden':![],'depth':null});}function getContactDialer(_0x521007,_0x289af4,_0x417341){return cmHopper[_0x5df5('0x6')](_0x521007['id'],_0x289af4,_0x417341,_0x521007[_0x5df5('0x7')])[_0x5df5('0x8')](function(_0x2b7ed9){_0x521007[_0x5df5('0x9')]=0x0;logger[_0x5df5('0xa')]('[getContactDialer]',inspectError(_0x2b7ed9));});}exports[_0x5df5('0x6')]=getContactDialer;function getContactDialerIvr(_0x403d8b,_0x41941e){return cmHopper['getContactDialerIvr'](_0x403d8b['id'],_0x41941e,_0x403d8b['dialOrderByScheduledAt'])[_0x5df5('0x8')](function(_0x4e80bd){_0x403d8b[_0x5df5('0x9')]=0x0;logger[_0x5df5('0xa')]('[getContactDialerIvr]',inspectError(_0x4e80bd));});}exports['getContactDialerIvr']=getContactDialerIvr;function countReScheduled(_0x40322d){return cmHopper[_0x5df5('0xb')](_0x40322d)[_0x5df5('0x8')](function(_0x4c3d6f){logger[_0x5df5('0xa')](_0x5df5('0xc'),inspectError(_0x4c3d6f));});}exports[_0x5df5('0xb')]=countReScheduled;function rescheduleContact(_0x463990){return cmHopper[_0x5df5('0xd')](_0x463990)[_0x5df5('0x8')](function(_0x555d3f){logger[_0x5df5('0xa')]('[rescheduleContact]',inspectError(_0x555d3f));});}exports[_0x5df5('0xd')]=rescheduleContact;function unlockContact(_0x33f818,_0x5b0ad9,_0x3657c8){return cmHopper[_0x5df5('0xe')](_0x33f818,_0x5b0ad9,_0x3657c8)['catch'](function(_0x27b3fb){logger[_0x5df5('0xa')]('[unlockContact]',inspectError(_0x27b3fb));});}exports[_0x5df5('0xe')]=unlockContact;function moveContactManagedDialer(_0x45813f){return cmHopper[_0x5df5('0xf')](_0x45813f)[_0x5df5('0x8')](function(_0x215d59){logger['error']('[moveContactManagedDialer]',inspectError(_0x215d59));});}exports[_0x5df5('0xf')]=moveContactManagedDialer;function checkIsBlackList(_0x5d8dfd){return cmHopperBlack[_0x5df5('0x10')](_0x5d8dfd)[_0x5df5('0x8')](function(_0xa939e4){logger[_0x5df5('0xa')](_0x5df5('0x11'),inspectError(_0xa939e4));});}exports['checkIsBlackList']=checkIsBlackList;function checkIsBlackListIvr(_0x1d6474){return cmHopperBlack[_0x5df5('0x12')](_0x1d6474)[_0x5df5('0x8')](function(_0x34af1d){logger[_0x5df5('0xa')](_0x5df5('0x13'),inspectError(_0x34af1d));});}exports['checkIsBlackListIvr']=checkIsBlackListIvr;function verifyAdditionalPhones(_0x2e99a1,_0x2e862d,_0x8742a7){return cmHopperAdditionalPhone[_0x5df5('0x14')](_0x2e99a1,_0x2e862d,_0x8742a7)['catch'](function(_0x4358ba){logger[_0x5df5('0xa')](_0x5df5('0x15'),inspectError(_0x4358ba));});}exports['verifyAdditionalPhones']=verifyAdditionalPhones;function swapAdditionalPhones(_0x52206d,_0x532923,_0x357fb0){return cmHopperAdditionalPhone[_0x5df5('0x16')](_0x52206d,_0x532923,_0x357fb0)[_0x5df5('0x8')](function(_0xa7f4b3){logger[_0x5df5('0xa')](_0x5df5('0x17'),inspectError(_0xa7f4b3));});}exports[_0x5df5('0x16')]=swapAdditionalPhones;function avgHandleTime(_0x28723e){return cmHopperHistory['avgHandleTime'](_0x28723e)[_0x5df5('0x8')](function(_0x4fc1a1){logger[_0x5df5('0xa')](_0x5df5('0x18'),inspectError(_0x4fc1a1));});}exports['avgHandleTime']=avgHandleTime;function createHistory(_0x3854d0){return cmHopperHistory['createHistory'](_0x3854d0)[_0x5df5('0x8')](function(_0x4cccf1){logger[_0x5df5('0xa')]('[createHistory]',inspectError(_0x4cccf1));});}exports[_0x5df5('0x19')]=createHistory; \ No newline at end of file diff --git a/server/services/ami/dialer/utils/index.js b/server/services/ami/dialer/utils/index.js index 60281f5..2f1d047 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 _0x1f88=['XMD-','toUpperCase','moment','util','../../../../config/logger','dialer','../../../../config/environment/shared','timezones','ACTIVE','BLACKLIST','IS_DISACTIVED','INTERVAL_IS_EMPTY','NOT_ACTIVE','AGENTS_NOT_LOGGED','AVAILABLE_CONTACTS_FINISHED','RECALLINQUEUE','RECALLFAILEDTIMEOUT','RUNNING','TIMEZONE_UNKNOW','TRUNK_IS_NOT_REACHABLE','CAMPAIGN_STATUS','dialMethod','preview','isPreviewCampaign','ivr','isIVRCampaign','type','outbound','isQueueCampaignActive','isIVRCampaignActive','milliseconds','diff','getSeconds','dialActive','available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','originated','Trunk','name','active','hasQueueCampaignDataChanged','dialTimezone','isNil','dialGlobalInterval','Interval','NULL_INTERVAL','isEmpty','Intervals','EMPTY_INTERVAL','UNKNOWN_TIMEZONE','SIP/','unmonitored','includes','TrunkBackup','status','INACTIVE','DISACTIVED','NO_AGENTS_LOGGED','UNREACHABLE_TRUNK','string','isUndefined','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','getCallerId','\x5cw{0,','pow','random','toString','getCallerIdRandom','[decrementOriginate]\x20queue\x20originate\x20value','decrementOriginate','length','checkContactEmpty','erlangb','[checkContactLowerLimitOriginate]\x20','checkContactLowerLimitOriginate','createdAt','updatedAt','undefined','description','substring'];(function(_0x3949b5,_0x4bd4ae){var _0x3ace93=function(_0x4361db){while(--_0x4361db){_0x3949b5['push'](_0x3949b5['shift']());}};_0x3ace93(++_0x4bd4ae);}(_0x1f88,0x10a));var _0x81f8=function(_0x4fafa9,_0x134473){_0x4fafa9=_0x4fafa9-0x0;var _0x5ba9a2=_0x1f88[_0x4fafa9];return _0x5ba9a2;};'use strict';var _=require('lodash');var moment=require(_0x81f8('0x0'));var util=require(_0x81f8('0x1'));var logger=require(_0x81f8('0x2'))(_0x81f8('0x3'));var timezones=require(_0x81f8('0x4'))[_0x81f8('0x5')];var CAMPAIGN_STATUS={'ACTIVE':_0x81f8('0x6'),'BLACKLIST':_0x81f8('0x7'),'CONTACTS_RESCHEDULED':'RESCHEDULED_CONTACTS','DEACTIVATED':'DEACTIVATED','DISACTIVED':_0x81f8('0x8'),'EMPTY_INTERVAL':_0x81f8('0x9'),'INACTIVE':_0x81f8('0xa'),'NO_AGENTS_LOGGED':_0x81f8('0xb'),'NO_AVAILABLE_CONTACTS':_0x81f8('0xc'),'NULL_INTERVAL':'INTERVAL_IS_NULL','OVERTIME_INTERVAL':'INTERVAL_IS_OVERTIME','OVERTIME_GLOBAL_INTERVAL':'GLOBAL_INTERVAL_IS_OVERTIME','QUEUE_RECALL':_0x81f8('0xd'),'RECALL_TIMEOUT':_0x81f8('0xe'),'RUNNING':_0x81f8('0xf'),'UNKNOWN_TIMEZONE':_0x81f8('0x10'),'UNREACHABLE_TRUNK':_0x81f8('0x11')};exports[_0x81f8('0x12')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x5b67cc){return _0x5b67cc[_0x81f8('0x13')]===_0x81f8('0x14');}exports[_0x81f8('0x15')]=isPreviewCampaign;function isIVRCampaign(_0x485607){return _0x485607['type']===_0x81f8('0x16');}exports[_0x81f8('0x17')]=isIVRCampaign;function isOutboundQueue(_0x55af98){return _0x55af98[_0x81f8('0x18')]===_0x81f8('0x19');}exports['isOutboundQueue']=isOutboundQueue;function isQueueCampaignActive(_0x15348c){return _0x15348c['dialActive'];}exports[_0x81f8('0x1a')]=isQueueCampaignActive;function isIVRCampaignActive(_0x386e0f){return _0x386e0f['active'];}exports[_0x81f8('0x1b')]=isIVRCampaignActive;function getSeconds(_0x3b2a16,_0xfe70bf){var _0x1e0311=moment(_0x3b2a16)[_0x81f8('0x1c')](0x0);var _0x42f957=moment(_0xfe70bf)[_0x81f8('0x1c')](0x0);return _0x1e0311[_0x81f8('0x1d')](_0x42f957,'seconds');}exports[_0x81f8('0x1e')]=getSeconds;function hasQueueCampaignDataChanged(_0x3348d2,_0x4e63d0){var _0x114083=![];var _0x508b2a=_0x3348d2[_0x81f8('0x13')]!==_0x4e63d0[_0x81f8('0x13')]||_0x3348d2[_0x81f8('0x1f')]!==_0x4e63d0[_0x81f8('0x1f')]||_0x3348d2['message']!==_0x4e63d0['message'];var _0x3917f6=_0x3348d2['available']!==_0x4e63d0[_0x81f8('0x20')]||_0x3348d2[_0x81f8('0x21')]!==_0x4e63d0[_0x81f8('0x21')]||_0x3348d2[_0x81f8('0x22')]!==_0x4e63d0['loggedInDb']||_0x3348d2[_0x81f8('0x23')]!==_0x4e63d0[_0x81f8('0x23')]||_0x3348d2[_0x81f8('0x24')]!==_0x4e63d0[_0x81f8('0x24')]||_0x3348d2[_0x81f8('0x25')]!==_0x4e63d0[_0x81f8('0x25')]||_0x3348d2[_0x81f8('0x26')]!==_0x4e63d0[_0x81f8('0x26')]||_0x3348d2[_0x81f8('0x27')]!==_0x4e63d0[_0x81f8('0x27')]||_0x3348d2['originated']!==_0x4e63d0[_0x81f8('0x28')];if(_0x3348d2[_0x81f8('0x29')]&&_0x4e63d0['Trunk']){_0x114083=_0x3348d2[_0x81f8('0x29')][_0x81f8('0x2a')]!==_0x4e63d0[_0x81f8('0x29')]['name']||_0x3348d2[_0x81f8('0x29')][_0x81f8('0x2b')]!==_0x4e63d0['Trunk'][_0x81f8('0x2b')];}return _0x508b2a||_0x3917f6||_0x114083;}exports[_0x81f8('0x2c')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0xb44752){var _0x35218a=null;var _0x162bbb=_0xb44752[_0x81f8('0x2d')];if(_[_0x81f8('0x2e')](_0xb44752[_0x81f8('0x2f')])||_[_0x81f8('0x2e')](_0xb44752[_0x81f8('0x30')])||_[_0x81f8('0x2e')](_0xb44752[_0x81f8('0x30')]['Intervals'])){_0x35218a=CAMPAIGN_STATUS[_0x81f8('0x31')];}else if(_[_0x81f8('0x32')](_0xb44752[_0x81f8('0x2f')])||_['isEmpty'](_0xb44752['Interval'][_0x81f8('0x33')])){_0x35218a=CAMPAIGN_STATUS[_0x81f8('0x34')];}else if(_0x162bbb&&!timezones[_0x162bbb]){_0x35218a=CAMPAIGN_STATUS[_0x81f8('0x35')];}return _0x35218a;}function checkAnyValidTrunk(_0x13f57a,_0x3080b4){var _0x4277f3=null;var _0x1a594b=_0x81f8('0x36');var _0xe5802f=['reachable',_0x81f8('0x37')];var _0xec7c8c=!![];if(_0x13f57a[_0x81f8('0x29')]&&_0x13f57a['Trunk'][_0x81f8('0x2b')]){_0x1a594b+=_0x13f57a['Trunk'][_0x81f8('0x2a')];_0x4277f3=_0x3080b4[_0x1a594b];_0xec7c8c=_0xe5802f[_0x81f8('0x38')](_0x4277f3['status']);}else if(_0x13f57a[_0x81f8('0x39')]&&_0x13f57a[_0x81f8('0x39')][_0x81f8('0x2b')]){_0x1a594b+=_0x13f57a[_0x81f8('0x39')][_0x81f8('0x2a')];_0x4277f3=_0x3080b4[_0x1a594b];_0xec7c8c=_0xe5802f[_0x81f8('0x38')](_0x4277f3[_0x81f8('0x3a')]);}return _0xec7c8c;}function getQueueCampaignStatusMessage(_0x2583b4,_0x7bbf5f){var _0x5089e1=CAMPAIGN_STATUS[_0x81f8('0x6')];var _0x1266ba=isPreviewCampaign(_0x2583b4);if(!isQueueCampaignActive(_0x2583b4)){if(_0x1266ba){_0x5089e1=CAMPAIGN_STATUS['INACTIVE'];}else{if(_0x2583b4[_0x81f8('0x28')]===0x0&&_0x2583b4['talking']===0x0&&_0x2583b4[_0x81f8('0x26')]===0x0&&(_0x2583b4[_0x81f8('0x25')]||0x0)===0x0){_0x5089e1=CAMPAIGN_STATUS[_0x81f8('0x3b')];}else{_0x5089e1=CAMPAIGN_STATUS[_0x81f8('0x3c')];}}}else if(_0x2583b4[_0x81f8('0x21')]===0x0){_0x5089e1=CAMPAIGN_STATUS[_0x81f8('0x3d')];}else if(!checkAnyValidTrunk(_0x2583b4,_0x7bbf5f)){_0x5089e1=CAMPAIGN_STATUS[_0x81f8('0x3e')];}else if(!isPreviewCampaign(_0x2583b4)){var _0xb13ffc=checkAnyValidQueueCampaignInterval(_0x2583b4);if(_0xb13ffc){_0x5089e1=_0xb13ffc;}}return _0x5089e1;}exports['getQueueCampaignStatusMessage']=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x3382ac){var _0x4606e8=CAMPAIGN_STATUS[_0x81f8('0x3c')];if(_0x3382ac['originated']===0x0&&_0x3382ac[_0x81f8('0x24')]===0x0&&_0x3382ac[_0x81f8('0x26')]===0x0&&(_0x3382ac['pTalking']||0x0)===0x0){_0x4606e8=CAMPAIGN_STATUS['INACTIVE'];}return _0x4606e8;}exports['getQueueCampaignActiveStatusMessage']=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x285e49){var _0x1ed546=_0x285e49['match'](/"(.*?)"/);return _0x1ed546?_0x1ed546[0x1]:_0x285e49;}exports['extractCalleridName']=extractCalleridName;function getCallerId(_0xdb92d9,_0x448c94,_0x53ec5e){if(!_['isUndefined'](_0x53ec5e)&&typeof _0x53ec5e===_0x81f8('0x3f')&&!_[_0x81f8('0x32')](_0x53ec5e)){if(!_[_0x81f8('0x40')](_0x448c94)&&typeof _0x448c94===_0x81f8('0x3f')&&!_['isEmpty'](_0x448c94)){return util[_0x81f8('0x41')](_0x81f8('0x42'),_0x448c94,_0x53ec5e);}return util[_0x81f8('0x41')](_0x81f8('0x42'),_0x53ec5e,_0x53ec5e);}if(!_[_0x81f8('0x40')](_0xdb92d9)&&typeof _0xdb92d9===_0x81f8('0x3f')&&!_[_0x81f8('0x32')](_0xdb92d9)){return _0xdb92d9;}return _0x81f8('0x43');}exports[_0x81f8('0x44')]=getCallerId;function getCallerIdRandom(_0x35922b,_0x217fa1){var _0x9c399;var _0x2dc72a;var _0x13ea92;if(_0x217fa1<=0x0){_0x217fa1=0x1;}_0x9c399=new RegExp(_0x81f8('0x45')+_0x217fa1+'}$');_0x2dc72a=Math[_0x81f8('0x46')](0xa,_0x217fa1-0x1);_0x13ea92=Math['pow'](0xa,_0x217fa1)-0x1;return util[_0x81f8('0x41')]('%s',_['replace'](_0x35922b,_0x9c399,_[_0x81f8('0x47')](_0x2dc72a,_0x13ea92)[_0x81f8('0x48')]()));}exports[_0x81f8('0x49')]=getCallerIdRandom;function decrementOriginate(_0x4f7209,_0x56d4c3){if(_0x4f7209[_0x81f8('0x28')]&&_0x4f7209[_0x81f8('0x28')]>0x0){_0x4f7209[_0x81f8('0x28')]-=0x1;}else{logger['error'](_0x81f8('0x4a'),_0x56d4c3);}}exports[_0x81f8('0x4b')]=decrementOriginate;function checkContactEmpty(_0x3590c3){return _0x3590c3&&_0x3590c3[_0x81f8('0x4c')]>0x0;}exports[_0x81f8('0x4d')]=checkContactEmpty;function erlangb(_0x37f4d4,_0x9eec9d){if(_0x9eec9d===0x0){return 0x0;}var _0x2ac33a=0x1;for(var _0x22bef0=0x1;_0x22bef0<=_0x9eec9d;_0x22bef0+=0x1){_0x2ac33a=0x1+_0x2ac33a*_0x22bef0/_0x37f4d4;}return 0x1/_0x2ac33a;}exports[_0x81f8('0x4e')]=erlangb;function checkContactLowerLimitOriginate(_0x2546c6,_0x24b2eb,_0x4895ff){if(_0x24b2eb>_0x4895ff){for(var _0x1edb7b=0x0;_0x1edb7b<_0x24b2eb-_0x4895ff;_0x1edb7b+=0x1){decrementOriginate(_0x2546c6,_0x81f8('0x4f'));}}}exports[_0x81f8('0x50')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0xb1824f){var _0x1da83b={};var _0x1d25e1=['id',_0x81f8('0x51'),'tags',_0x81f8('0x52')];const _0x44f7e0=0xfa;if(_0xb1824f){for(var _0x139ebb in _0xb1824f){if(typeof _0xb1824f[_0x139ebb]!==_0x81f8('0x53')){if(!_['isNil'](_0xb1824f[_0x139ebb])&&!_0x1d25e1[_0x81f8('0x38')](_0x139ebb)){if(_0x139ebb===_0x81f8('0x54')&&_0xb1824f[_0x139ebb][_0x81f8('0x4c')]>_0x44f7e0){_0x1da83b['XMD-'+_0x139ebb['toUpperCase']()]=_0xb1824f[_0x139ebb][_0x81f8('0x48')]()[_0x81f8('0x55')](0x0,_0x44f7e0);}else{_0x1da83b[_0x81f8('0x56')+_0x139ebb[_0x81f8('0x57')]()]=_0xb1824f[_0x139ebb];}}}}}return _0x1da83b;}exports['setXMDContactVariables']=setXMDContactVariables; \ No newline at end of file +var _0xd916=['hasQueueCampaignDataChanged','dialTimezone','dialGlobalInterval','Interval','isNil','isEmpty','Intervals','EMPTY_INTERVAL','UNKNOWN_TIMEZONE','reachable','status','TrunkBackup','INACTIVE','DISACTIVED','NO_AGENTS_LOGGED','UNREACHABLE_TRUNK','getQueueCampaignStatusMessage','getQueueCampaignActiveStatusMessage','isUndefined','string','\x22%s\x22\x20<%s>','getCallerId','\x5cw{0,','pow','format','replace','random','getCallerIdRandom','[decrementOriginate]\x20queue\x20originate\x20value','decrementOriginate','length','checkContactEmpty','erlangb','[checkContactLowerLimitOriginate]\x20','createdAt','tags','updatedAt','undefined','includes','XMD-','toUpperCase','toString','setXMDContactVariables','util','../../../../config/logger','timezones','ACTIVE','BLACKLIST','RESCHEDULED_CONTACTS','DEACTIVATED','IS_DISACTIVED','INTERVAL_IS_EMPTY','NOT_ACTIVE','AGENTS_NOT_LOGGED','INTERVAL_IS_NULL','INTERVAL_IS_OVERTIME','RECALLINQUEUE','RECALLFAILEDTIMEOUT','RUNNING','TIMEZONE_UNKNOW','preview','isPreviewCampaign','type','ivr','isIVRCampaign','outbound','isOutboundQueue','dialActive','isQueueCampaignActive','active','isIVRCampaignActive','milliseconds','diff','getSeconds','dialMethod','message','available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','originated','Trunk','name'];(function(_0xfc1e88,_0x447588){var _0x13be8b=function(_0x876b0f){while(--_0x876b0f){_0xfc1e88['push'](_0xfc1e88['shift']());}};_0x13be8b(++_0x447588);}(_0xd916,0x187));var _0x6d91=function(_0xcb389d,_0x2bb392){_0xcb389d=_0xcb389d-0x0;var _0x12c7ef=_0xd916[_0xcb389d];return _0x12c7ef;};'use strict';var _=require('lodash');var moment=require('moment');var util=require(_0x6d91('0x0'));var logger=require(_0x6d91('0x1'))('dialer');var timezones=require('../../../../config/environment/shared')[_0x6d91('0x2')];var CAMPAIGN_STATUS={'ACTIVE':_0x6d91('0x3'),'BLACKLIST':_0x6d91('0x4'),'CONTACTS_RESCHEDULED':_0x6d91('0x5'),'DEACTIVATED':_0x6d91('0x6'),'DISACTIVED':_0x6d91('0x7'),'EMPTY_INTERVAL':_0x6d91('0x8'),'INACTIVE':_0x6d91('0x9'),'NO_AGENTS_LOGGED':_0x6d91('0xa'),'NO_AVAILABLE_CONTACTS':'AVAILABLE_CONTACTS_FINISHED','NULL_INTERVAL':_0x6d91('0xb'),'OVERTIME_INTERVAL':_0x6d91('0xc'),'OVERTIME_GLOBAL_INTERVAL':'GLOBAL_INTERVAL_IS_OVERTIME','QUEUE_RECALL':_0x6d91('0xd'),'RECALL_TIMEOUT':_0x6d91('0xe'),'RUNNING':_0x6d91('0xf'),'UNKNOWN_TIMEZONE':_0x6d91('0x10'),'UNREACHABLE_TRUNK':'TRUNK_IS_NOT_REACHABLE'};exports['CAMPAIGN_STATUS']=CAMPAIGN_STATUS;function isPreviewCampaign(_0x997a6){return _0x997a6['dialMethod']===_0x6d91('0x11');}exports[_0x6d91('0x12')]=isPreviewCampaign;function isIVRCampaign(_0x47aaec){return _0x47aaec[_0x6d91('0x13')]===_0x6d91('0x14');}exports[_0x6d91('0x15')]=isIVRCampaign;function isOutboundQueue(_0x3fc27d){return _0x3fc27d[_0x6d91('0x13')]===_0x6d91('0x16');}exports[_0x6d91('0x17')]=isOutboundQueue;function isQueueCampaignActive(_0x245333){return _0x245333[_0x6d91('0x18')];}exports[_0x6d91('0x19')]=isQueueCampaignActive;function isIVRCampaignActive(_0x54a2cf){return _0x54a2cf[_0x6d91('0x1a')];}exports[_0x6d91('0x1b')]=isIVRCampaignActive;function getSeconds(_0x56c47f,_0x5c3e7d){var _0x4e7a80=moment(_0x56c47f)[_0x6d91('0x1c')](0x0);var _0xe01d9=moment(_0x5c3e7d)['milliseconds'](0x0);return _0x4e7a80[_0x6d91('0x1d')](_0xe01d9,'seconds');}exports[_0x6d91('0x1e')]=getSeconds;function hasQueueCampaignDataChanged(_0x423b8d,_0x158c91){var _0x21949f=![];var _0x146aec=_0x423b8d['dialMethod']!==_0x158c91[_0x6d91('0x1f')]||_0x423b8d[_0x6d91('0x18')]!==_0x158c91['dialActive']||_0x423b8d[_0x6d91('0x20')]!==_0x158c91['message'];var _0x37183f=_0x423b8d['available']!==_0x158c91[_0x6d91('0x21')]||_0x423b8d['loggedIn']!==_0x158c91[_0x6d91('0x22')]||_0x423b8d[_0x6d91('0x23')]!==_0x158c91[_0x6d91('0x23')]||_0x423b8d['paused']!==_0x158c91[_0x6d91('0x24')]||_0x423b8d[_0x6d91('0x25')]!==_0x158c91['talking']||_0x423b8d[_0x6d91('0x26')]!==_0x158c91[_0x6d91('0x26')]||_0x423b8d[_0x6d91('0x27')]!==_0x158c91['waiting']||_0x423b8d[_0x6d91('0x28')]!==_0x158c91['inUse']||_0x423b8d[_0x6d91('0x29')]!==_0x158c91[_0x6d91('0x29')];if(_0x423b8d['Trunk']&&_0x158c91['Trunk']){_0x21949f=_0x423b8d[_0x6d91('0x2a')]['name']!==_0x158c91['Trunk'][_0x6d91('0x2b')]||_0x423b8d[_0x6d91('0x2a')][_0x6d91('0x1a')]!==_0x158c91[_0x6d91('0x2a')][_0x6d91('0x1a')];}return _0x146aec||_0x37183f||_0x21949f;}exports[_0x6d91('0x2c')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x132f8b){var _0x3fe115=null;var _0x3cdfa5=_0x132f8b[_0x6d91('0x2d')];if(_['isNil'](_0x132f8b[_0x6d91('0x2e')])||_['isNil'](_0x132f8b[_0x6d91('0x2f')])||_[_0x6d91('0x30')](_0x132f8b[_0x6d91('0x2f')]['Intervals'])){_0x3fe115=CAMPAIGN_STATUS['NULL_INTERVAL'];}else if(_[_0x6d91('0x31')](_0x132f8b[_0x6d91('0x2e')])||_[_0x6d91('0x31')](_0x132f8b['Interval'][_0x6d91('0x32')])){_0x3fe115=CAMPAIGN_STATUS[_0x6d91('0x33')];}else if(_0x3cdfa5&&!timezones[_0x3cdfa5]){_0x3fe115=CAMPAIGN_STATUS[_0x6d91('0x34')];}return _0x3fe115;}function checkAnyValidTrunk(_0x34f33b,_0xbd4f71){var _0x538331=null;var _0x40989a='SIP/';var _0x59248d=[_0x6d91('0x35'),'unmonitored'];var _0x588d40=!![];if(_0x34f33b[_0x6d91('0x2a')]&&_0x34f33b[_0x6d91('0x2a')][_0x6d91('0x1a')]){_0x40989a+=_0x34f33b['Trunk']['name'];_0x538331=_0xbd4f71[_0x40989a];_0x588d40=_0x59248d['includes'](_0x538331[_0x6d91('0x36')]);}else if(_0x34f33b[_0x6d91('0x37')]&&_0x34f33b['TrunkBackup']['active']){_0x40989a+=_0x34f33b[_0x6d91('0x37')]['name'];_0x538331=_0xbd4f71[_0x40989a];_0x588d40=_0x59248d['includes'](_0x538331[_0x6d91('0x36')]);}return _0x588d40;}function getQueueCampaignStatusMessage(_0x491160,_0x200599){var _0x255c1a=CAMPAIGN_STATUS[_0x6d91('0x3')];var _0x3814b3=isPreviewCampaign(_0x491160);if(!isQueueCampaignActive(_0x491160)){if(_0x3814b3){_0x255c1a=CAMPAIGN_STATUS[_0x6d91('0x38')];}else{if(_0x491160[_0x6d91('0x29')]===0x0&&_0x491160[_0x6d91('0x25')]===0x0&&_0x491160[_0x6d91('0x27')]===0x0&&(_0x491160[_0x6d91('0x26')]||0x0)===0x0){_0x255c1a=CAMPAIGN_STATUS[_0x6d91('0x38')];}else{_0x255c1a=CAMPAIGN_STATUS[_0x6d91('0x39')];}}}else if(_0x491160['loggedIn']===0x0){_0x255c1a=CAMPAIGN_STATUS[_0x6d91('0x3a')];}else if(!checkAnyValidTrunk(_0x491160,_0x200599)){_0x255c1a=CAMPAIGN_STATUS[_0x6d91('0x3b')];}else if(!isPreviewCampaign(_0x491160)){var _0x4ef847=checkAnyValidQueueCampaignInterval(_0x491160);if(_0x4ef847){_0x255c1a=_0x4ef847;}}return _0x255c1a;}exports[_0x6d91('0x3c')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x2100cb){var _0x35ebab=CAMPAIGN_STATUS[_0x6d91('0x39')];if(_0x2100cb[_0x6d91('0x29')]===0x0&&_0x2100cb[_0x6d91('0x25')]===0x0&&_0x2100cb[_0x6d91('0x27')]===0x0&&(_0x2100cb[_0x6d91('0x26')]||0x0)===0x0){_0x35ebab=CAMPAIGN_STATUS['INACTIVE'];}return _0x35ebab;}exports[_0x6d91('0x3d')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x47dd5){var _0x428c3f=_0x47dd5['match'](/"(.*?)"/);return _0x428c3f?_0x428c3f[0x1]:_0x47dd5;}exports['extractCalleridName']=extractCalleridName;function getCallerId(_0x3ac842,_0x3932ae,_0x2dfe23){if(!_[_0x6d91('0x3e')](_0x2dfe23)&&typeof _0x2dfe23===_0x6d91('0x3f')&&!_[_0x6d91('0x31')](_0x2dfe23)){if(!_[_0x6d91('0x3e')](_0x3932ae)&&typeof _0x3932ae===_0x6d91('0x3f')&&!_[_0x6d91('0x31')](_0x3932ae)){return util['format'](_0x6d91('0x40'),_0x3932ae,_0x2dfe23);}return util['format'](_0x6d91('0x40'),_0x2dfe23,_0x2dfe23);}if(!_[_0x6d91('0x3e')](_0x3ac842)&&typeof _0x3ac842===_0x6d91('0x3f')&&!_['isEmpty'](_0x3ac842)){return _0x3ac842;}return'\x22\x22\x20<>';}exports[_0x6d91('0x41')]=getCallerId;function getCallerIdRandom(_0x1bee14,_0x437a15){var _0x56479a;var _0x2c2954;var _0x1723f4;if(_0x437a15<=0x0){_0x437a15=0x1;}_0x56479a=new RegExp(_0x6d91('0x42')+_0x437a15+'}$');_0x2c2954=Math[_0x6d91('0x43')](0xa,_0x437a15-0x1);_0x1723f4=Math[_0x6d91('0x43')](0xa,_0x437a15)-0x1;return util[_0x6d91('0x44')]('%s',_[_0x6d91('0x45')](_0x1bee14,_0x56479a,_[_0x6d91('0x46')](_0x2c2954,_0x1723f4)['toString']()));}exports[_0x6d91('0x47')]=getCallerIdRandom;function decrementOriginate(_0xcaa206,_0x3755ee){if(_0xcaa206[_0x6d91('0x29')]&&_0xcaa206[_0x6d91('0x29')]>0x0){_0xcaa206[_0x6d91('0x29')]-=0x1;}else{logger['error'](_0x6d91('0x48'),_0x3755ee);}}exports[_0x6d91('0x49')]=decrementOriginate;function checkContactEmpty(_0x4c8630){return _0x4c8630&&_0x4c8630[_0x6d91('0x4a')]>0x0;}exports[_0x6d91('0x4b')]=checkContactEmpty;function erlangb(_0x564c46,_0x30203c){if(_0x30203c===0x0){return 0x0;}var _0x5d95cc=0x1;for(var _0x5deac5=0x1;_0x5deac5<=_0x30203c;_0x5deac5+=0x1){_0x5d95cc=0x1+_0x5d95cc*_0x5deac5/_0x564c46;}return 0x1/_0x5d95cc;}exports[_0x6d91('0x4c')]=erlangb;function checkContactLowerLimitOriginate(_0x12b104,_0x28ddcb,_0x5130e7){if(_0x28ddcb>_0x5130e7){for(var _0x514391=0x0;_0x514391<_0x28ddcb-_0x5130e7;_0x514391+=0x1){decrementOriginate(_0x12b104,_0x6d91('0x4d'));}}}exports['checkContactLowerLimitOriginate']=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x45221a){var _0x2b5451={};var _0xb699f1=['id',_0x6d91('0x4e'),_0x6d91('0x4f'),_0x6d91('0x50')];const _0x25dbc4=0xfa;if(_0x45221a){for(var _0x424cfe in _0x45221a){if(typeof _0x45221a[_0x424cfe]!==_0x6d91('0x51')){if(!_[_0x6d91('0x30')](_0x45221a[_0x424cfe])&&!_0xb699f1[_0x6d91('0x52')](_0x424cfe)){if(_0x424cfe==='description'&&_0x45221a[_0x424cfe]['length']>_0x25dbc4){_0x2b5451[_0x6d91('0x53')+_0x424cfe[_0x6d91('0x54')]()]=_0x45221a[_0x424cfe][_0x6d91('0x55')]()['substring'](0x0,_0x25dbc4);}else{_0x2b5451[_0x6d91('0x53')+_0x424cfe['toUpperCase']()]=_0x45221a[_0x424cfe];}}}}}return _0x2b5451;}exports[_0x6d91('0x56')]=setXMDContactVariables; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 1656db3..a2e2816 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(_0x4f2a68,_0x309542){var _0x474071=function(_0xb94b16){while(--_0xb94b16){_0x4f2a68['push'](_0x4f2a68['shift']());}};_0x474071(++_0x309542);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xa9e0[_0x6131cd];return _0x47e916;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));function Action(_0x5dd881,_0x550fbc,_0x18d5c9){this['uniqueid']=_0x5dd881||undefined;this[_0x0a9e('0x3')]=util[_0x0a9e('0x4')](_0x0a9e('0x5'),_0x550fbc[_0x0a9e('0x6')],_0x550fbc[_0x0a9e('0x7')]['name'],_0x18d5c9[_0x0a9e('0x8')]);this[_0x0a9e('0x9')]=_0x550fbc[_0x0a9e('0x9')];this['headerinfo']=_0x550fbc['headerinfo'];this[_0x0a9e('0xa')]=_0x18d5c9['path'];this['AttachmentId']=_0x18d5c9[_0x0a9e('0xb')];}module[_0x0a9e('0xc')]=Action; \ No newline at end of file +var _0xa9e0=['fax','localstationid','path','AttachmentId','exports','util','lodash','moment','channel','format','%s/%s/%s','tech','Trunk'];(function(_0x3d38ba,_0x282e4d){var _0x127d4c=function(_0x71d221){while(--_0x71d221){_0x3d38ba['push'](_0x3d38ba['shift']());}};_0x127d4c(++_0x282e4d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'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 3540652..8ed46db 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 _0xda51=['send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','Trunk','isValid','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','path','execute','format','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','deleteChannelAfterTimeout','exports','util','lodash','bluebird','uuid','moment','./util/gs','../../../config/logger','fax','./channel','./util/util','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','bind','varset','syncVarSet','newstate','syncNewState','newexten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncOriginateResponse','context','from-voip-provider','hasOwnProperty','exten','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','prototype','variable','value','channelstate','channelstatedesc','syncNewExten','operation','status','filename','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','message','create','parse','.pdf','application/pdf','then','notify','error','\x20notify\x20','stringify','catch','\x20receiveFax\x20','pick','reason','AttachmentId','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','syncHangup','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','SENDING\x20FAILED:\x20','faxstatusstring','SENDING\x20FAILED'];(function(_0x975fe0,_0x4b6fd1){var _0x439aae=function(_0x17c7b8){while(--_0x17c7b8){_0x975fe0['push'](_0x975fe0['shift']());}};_0x439aae(++_0x4b6fd1);}(_0xda51,0x192));var _0x1da5=function(_0xf35bc1,_0x510803){_0xf35bc1=_0xf35bc1-0x0;var _0xa6b162=_0xda51[_0xf35bc1];return _0xa6b162;};'use strict';var util=require(_0x1da5('0x0'));var _=require(_0x1da5('0x1'));var BPromise=require(_0x1da5('0x2'));var uuid=require(_0x1da5('0x3'));var moment=require(_0x1da5('0x4'));var path=require('path');var tiff2pdf=require('tiff2pdf');var gs=require(_0x1da5('0x5'));var logger=require(_0x1da5('0x6'))(_0x1da5('0x7'));var ami=require('../ami');var rpcDb=require('./rpcDb');var Channel=require(_0x1da5('0x8'));var ut=require(_0x1da5('0x9'));var Action=require('./action');var faxAccount=require(_0x1da5('0xa'));var attachment=require(_0x1da5('0xb'));var faxMessage=require(_0x1da5('0xc'));function Fax(_0xc3019b){this[_0x1da5('0xd')]={};this[_0x1da5('0xe')]=_0xc3019b[_0x1da5('0xe')];this[_0x1da5('0xf')]=_0xc3019b[_0x1da5('0xf')];this[_0x1da5('0x10')]={};ami['on'](_0x1da5('0x11'),this['syncNewchannel'][_0x1da5('0x12')](this));ami['on'](_0x1da5('0x13'),this[_0x1da5('0x14')][_0x1da5('0x12')](this));ami['on'](_0x1da5('0x15'),this[_0x1da5('0x16')][_0x1da5('0x12')](this));ami['on'](_0x1da5('0x17'),this['syncNewExten'][_0x1da5('0x12')](this));ami['on'](_0x1da5('0x18'),this[_0x1da5('0x19')]['bind'](this));ami['on'](_0x1da5('0x1a'),this[_0x1da5('0x1b')][_0x1da5('0x12')](this));ami['on'](_0x1da5('0x1c'),this['syncHangup'][_0x1da5('0x12')](this));ami['on']('originateresponse',this[_0x1da5('0x1d')][_0x1da5('0x12')](this));}Fax['prototype']['syncNewchannel']=function(_0x33abe1){if(_0x33abe1[_0x1da5('0x1e')]===_0x1da5('0x1f')){for(var _0x45c190 in this[_0x1da5('0xe')]){if(this['faxAccounts'][_0x1da5('0x20')](_0x45c190)){if(_0x33abe1[_0x1da5('0x21')]===this[_0x1da5('0xe')][_0x45c190][_0x1da5('0x22')]){this[_0x1da5('0xd')][_0x33abe1[_0x1da5('0x23')]]={};this[_0x1da5('0xd')][_0x33abe1[_0x1da5('0x23')]]['channel']=_0x33abe1[_0x1da5('0x24')];this['channels'][_0x33abe1['uniqueid']]['id']=this[_0x1da5('0xe')][_0x45c190]['id'];this[_0x1da5('0xd')][_0x33abe1[_0x1da5('0x23')]][_0x1da5('0x25')]=this['faxAccounts'][_0x45c190][_0x1da5('0x25')];logger[_0x1da5('0x26')](_0x33abe1[_0x1da5('0x23')],_0x1da5('0x27'));}}}}if(this['actions'][_0x33abe1[_0x1da5('0x23')]]){this[_0x1da5('0xd')][_0x33abe1[_0x1da5('0x23')]]={};this['channels'][_0x33abe1[_0x1da5('0x23')]][_0x1da5('0x24')]=_0x33abe1['channel'];logger[_0x1da5('0x26')](_0x33abe1[_0x1da5('0x23')],_0x1da5('0x27'));}};Fax[_0x1da5('0x28')][_0x1da5('0x14')]=function(_0x5f281e){if(this[_0x1da5('0xd')][_0x5f281e[_0x1da5('0x23')]]){for(var _0x478cc1 in _0x5f281e[_0x1da5('0x29')]){if(_0x5f281e['variable'][_0x1da5('0x20')](_0x478cc1)){this['channels'][_0x5f281e[_0x1da5('0x23')]][_0x478cc1]=_0x5f281e[_0x1da5('0x2a')];}}}};Fax[_0x1da5('0x28')][_0x1da5('0x16')]=function(_0x37e21e){if(this['channels'][_0x37e21e[_0x1da5('0x23')]]){this['channels'][_0x37e21e['uniqueid']][_0x1da5('0x2b')]=_0x37e21e[_0x1da5('0x2b')];this[_0x1da5('0xd')][_0x37e21e[_0x1da5('0x23')]][_0x1da5('0x2c')]=_0x37e21e['channelstatedesc'];}};Fax[_0x1da5('0x28')][_0x1da5('0x2d')]=function(_0x19afb1){if(this[_0x1da5('0xd')][_0x19afb1[_0x1da5('0x23')]]){for(var _0x382023 in _0x19afb1[_0x1da5('0x29')]){if(_0x19afb1[_0x1da5('0x29')][_0x1da5('0x20')](_0x382023)){this[_0x1da5('0xd')][_0x19afb1[_0x1da5('0x23')]][_0x382023]=_0x19afb1[_0x1da5('0x2a')];}}}};Fax[_0x1da5('0x28')]['syncFaxStatus']=function(_0x50d3c7){if(this[_0x1da5('0xd')][_0x50d3c7['uniqueid']]){this[_0x1da5('0xd')][_0x50d3c7[_0x1da5('0x23')]][_0x1da5('0x2e')]=_0x50d3c7[_0x1da5('0x2e')];this[_0x1da5('0xd')][_0x50d3c7[_0x1da5('0x23')]]['status']=_0x50d3c7[_0x1da5('0x2f')];this[_0x1da5('0xd')][_0x50d3c7[_0x1da5('0x23')]][_0x1da5('0x22')]=_0x50d3c7[_0x1da5('0x22')];this[_0x1da5('0xd')][_0x50d3c7['uniqueid']][_0x1da5('0x30')]=_0x50d3c7[_0x1da5('0x30')];logger[_0x1da5('0x26')](_0x50d3c7[_0x1da5('0x23')],'\x20syncFaxStatus\x20');}};Fax[_0x1da5('0x28')][_0x1da5('0x1b')]=function(_0x4f4463){var _0x23005a=this;if(this[_0x1da5('0xd')][_0x4f4463[_0x1da5('0x23')]]){var _0x17db10=this['channels'][_0x4f4463['uniqueid']]['id'];this[_0x1da5('0xd')][_0x4f4463[_0x1da5('0x23')]][_0x1da5('0x31')]=_0x4f4463['remotestationid'];this[_0x1da5('0xd')][_0x4f4463['uniqueid']][_0x1da5('0x32')]=_0x4f4463[_0x1da5('0x32')];this[_0x1da5('0xd')][_0x4f4463['uniqueid']][_0x1da5('0x22')]=_0x4f4463[_0x1da5('0x22')];this['channels'][_0x4f4463[_0x1da5('0x23')]]['resolution']=_0x4f4463[_0x1da5('0x33')];this[_0x1da5('0xd')][_0x4f4463[_0x1da5('0x23')]]['transferrate']=_0x4f4463[_0x1da5('0x34')];this[_0x1da5('0xd')][_0x4f4463['uniqueid']][_0x1da5('0x30')]=_0x4f4463[_0x1da5('0x30')];this[_0x1da5('0xd')][_0x4f4463[_0x1da5('0x23')]][_0x1da5('0x35')]=_0x4f4463['calleridnum'];if(this['channels'][_0x4f4463[_0x1da5('0x23')]][_0x1da5('0x32')]>0x0){tiff2pdf(_0x4f4463[_0x1da5('0x30')],_0x1da5('0x36'),function(_0x138afc){logger[_0x1da5('0x26')](_0x4f4463['uniqueid'],'\x20result\x20conversion\x20file\x20',_0x138afc[_0x1da5('0x37')]);attachment[_0x1da5('0x38')]({'name':path[_0x1da5('0x39')](_0x4f4463[_0x1da5('0x30')])['name'],'basename':path[_0x1da5('0x39')](_0x4f4463['filename'])[_0x1da5('0x25')]+_0x1da5('0x3a'),'type':_0x1da5('0x3b')})[_0x1da5('0x3c')](function(_0x4671cd){faxAccount[_0x1da5('0x3d')](_0x17db10,{'from':_0x4f4463[_0x1da5('0x35')],'mapKey':'fax','body':path['parse'](_0x4f4463[_0x1da5('0x30')])[_0x1da5('0x25')]+_0x1da5('0x3a'),'AttachmentId':_0x4671cd['id']})['catch'](function(_0x52e912){logger[_0x1da5('0x3e')](_0x4f4463[_0x1da5('0x23')],_0x1da5('0x3f'),JSON[_0x1da5('0x40')](_0x52e912));});})[_0x1da5('0x41')](function(_0x2b9d45){logger[_0x1da5('0x3e')](_0x4f4463[_0x1da5('0x23')],_0x1da5('0x42'),JSON['stringify'](_0x2b9d45));});});}logger['info'](_0x4f4463[_0x1da5('0x23')],_0x1da5('0x42'));}};Fax['prototype'][_0x1da5('0x1d')]=function(_0x2a1438){if(this[_0x1da5('0x10')][_0x2a1438[_0x1da5('0x23')]]){_['merge'](this[_0x1da5('0xd')][_0x2a1438[_0x1da5('0x23')]],_[_0x1da5('0x43')](_0x2a1438,['response',_0x1da5('0x44')]));}};function updateStatus(_0x4b8116){if(_0x4b8116[_0x1da5('0x45')]){faxMessage['update'](_0x4b8116[_0x1da5('0x45')],{'failMessage':_0x1da5('0x46')})[_0x1da5('0x3c')](function(_0x3045f9){ut[_0x1da5('0x47')](_0x1da5('0x48'),_0x3045f9);})[_0x1da5('0x41')](function(_0x1e5672){ut[_0x1da5('0x47')]('[Fax][Message][Error][NoUpdate1]',_0x1e5672);});}else{ut[_0x1da5('0x47')](_0x1da5('0x49'));}}Fax[_0x1da5('0x28')][_0x1da5('0x4a')]=function(_0x2d2595,_0x58719b,_0x18a7df){var _0x561ba8=this;var _0x2a039a={};if(_0x58719b){_0x2a039a={'read':_0x58719b};}else{_0x2a039a={'failMessage':_0x18a7df};}if(this['actions'][_0x2d2595][_0x1da5('0x45')]){faxMessage['update'](this[_0x1da5('0x10')][_0x2d2595][_0x1da5('0x45')],_0x2a039a)['then'](function(_0x57f8d0){ut[_0x1da5('0x47')](_0x1da5('0x4b'),_0x57f8d0);})[_0x1da5('0x41')](function(_0x9d2831){ut[_0x1da5('0x47')](_0x1da5('0x4c'),_0x9d2831);})[_0x1da5('0x4d')](function(){delete _0x561ba8[_0x1da5('0xd')][_0x2d2595];delete _0x561ba8[_0x1da5('0x10')][_0x2d2595];});}else{ut[_0x1da5('0x47')](_0x1da5('0x4e'));this['deleteChannelAfterTimeout'](_0x2d2595);delete this[_0x1da5('0x10')][_0x2d2595];}};Fax[_0x1da5('0x28')][_0x1da5('0x4f')]=function(_0x5792d3){var _0x560ea4=this;if(this[_0x1da5('0xd')][_0x5792d3[_0x1da5('0x23')]]){if(this[_0x1da5('0x10')][_0x5792d3[_0x1da5('0x23')]]){this['channels'][_0x5792d3[_0x1da5('0x23')]]['id']=this['actions'][_0x5792d3[_0x1da5('0x23')]]['id'];this['channels'][_0x5792d3[_0x1da5('0x23')]]['name']=this['actions'][_0x5792d3[_0x1da5('0x23')]][_0x1da5('0x25')];}logger[_0x1da5('0x26')](_0x5792d3[_0x1da5('0x23')],this[_0x1da5('0x10')][_0x5792d3[_0x1da5('0x23')]]?'\x20hangup\x20sendFile\x20':_0x1da5('0x50'),JSON[_0x1da5('0x40')](this[_0x1da5('0xd')][_0x5792d3[_0x1da5('0x23')]]));if(this[_0x1da5('0x10')][_0x5792d3[_0x1da5('0x23')]]){if(this[_0x1da5('0xd')][_0x5792d3[_0x1da5('0x23')]][_0x1da5('0x51')]>0x0&&this[_0x1da5('0xd')][_0x5792d3['uniqueid']][_0x1da5('0x18')]===_0x1da5('0x52')){this[_0x1da5('0x4a')](_0x5792d3[_0x1da5('0x23')],!![]);}else{this['updateStatus'](_0x5792d3[_0x1da5('0x23')],![],this[_0x1da5('0xd')][_0x5792d3[_0x1da5('0x23')]]['faxstatusstring']?_0x1da5('0x53')+this['channels'][_0x5792d3['uniqueid']][_0x1da5('0x54')]:_0x1da5('0x55'));}}}};Fax[_0x1da5('0x28')][_0x1da5('0x56')]=function(_0x48224c){var _0x351d44=this;return new BPromise(function(_0x24cf54,_0x3b097a){_0x351d44[_0x1da5('0x57')](_0x48224c,_0x351d44[_0x1da5('0xe')][_0x48224c[_0x1da5('0x58')]])[_0x1da5('0x3c')](function(_0x34785e){ut[_0x1da5('0x47')](_0x1da5('0x59'),_0x34785e);_0x24cf54(ut['message'](_0x1da5('0x5a')));})[_0x1da5('0x41')](function(_0x1f16b6){ut[_0x1da5('0x47')](_0x1da5('0x5b'),_0x1f16b6);updateStatus(_0x48224c);_0x3b097a(ut[_0x1da5('0x37')](_0x1da5('0x5c')));});});};Fax['prototype'][_0x1da5('0x5d')]=function(_0x34ecb2){var _0x2d2c6e=this;return new BPromise(function(_0x3f5fdb,_0xe40790){var _0x4e0341=_0x2d2c6e[_0x1da5('0x5e')](_0x2d2c6e[_0x1da5('0xe')][_0x34ecb2['FaxAccountId']][_0x1da5('0x5f')],_0x34ecb2);if(_0x4e0341[_0x1da5('0x60')]){_0x3f5fdb(ut['message']('Trunk\x20Reachable'));}else{_0xe40790(ut[_0x1da5('0x37')](_0x4e0341[_0x1da5('0x37')]));}});};function originate(_0x3cfd50,_0x281ab5,_0x2760d9){return new BPromise(function(_0x557875,_0x42c671){if(_0x2760d9){var _0x431595=util['format'](_0x1da5('0x61'),path[_0x1da5('0x39')](_0x3cfd50[_0x1da5('0x62')])[_0x1da5('0x25')],_0x3cfd50[_0x1da5('0x62')]);gs[_0x1da5('0x63')](_0x431595)[_0x1da5('0x3c')](function(){_0x3cfd50[_0x1da5('0x62')]=util[_0x1da5('0x64')]('%s/%s.tif',path[_0x1da5('0x39')](_0x3cfd50[_0x1da5('0x62')])[_0x1da5('0x65')],path[_0x1da5('0x39')](_0x3cfd50[_0x1da5('0x62')])[_0x1da5('0x25')]);_0x281ab5[_0x1da5('0x66')]=_0x3cfd50[_0x1da5('0x62')];ut[_0x1da5('0x47')](_0x1da5('0x67'),'');ami[_0x1da5('0x68')](ut['variablesAction'](_0x3cfd50,_0x281ab5))['then'](function(_0x1afa12){_0x557875(_0x1afa12);})['catch'](function(_0x10d9c2){_0x42c671(_0x10d9c2);});})[_0x1da5('0x41')](function(_0x2e3df8){_0x42c671(_0x2e3df8);});}else{ami[_0x1da5('0x68')](ut[_0x1da5('0x69')](_0x3cfd50,_0x281ab5))[_0x1da5('0x3c')](function(_0x2eec81){_0x557875(_0x2eec81);})[_0x1da5('0x41')](function(_0x3ac483){_0x42c671(_0x3ac483);});}});}Fax[_0x1da5('0x28')][_0x1da5('0x57')]=function(_0x49a51e,_0x15d7b6){var _0x3bbdb5=this;return new BPromise(function(_0x18c582,_0x3f2788){var _0x16e2f5=uuid['v4']();var _0x45b968=ut[_0x1da5('0x6a')](_0x49a51e,_0x15d7b6);_0x3bbdb5[_0x1da5('0x10')][_0x16e2f5]=new Action(_0x16e2f5,_0x15d7b6,_0x49a51e);var _0x51026c=_0x3bbdb5['actions'][_0x16e2f5];if(path[_0x1da5('0x39')](_0x49a51e[_0x1da5('0x62')])['ext']===_0x1da5('0x3a')){originate(_0x51026c,_0x45b968,!![])[_0x1da5('0x3c')](function(_0x556755){_0x18c582(_0x556755);})['catch'](function(_0x5bb1a6){_0x3f2788(_0x5bb1a6);});}else{originate(_0x51026c,_0x45b968,![])[_0x1da5('0x3c')](function(_0x2396bc){_0x18c582(_0x2396bc);})[_0x1da5('0x41')](function(_0x25f11d){_0x3f2788(_0x25f11d);});}});};Fax[_0x1da5('0x28')][_0x1da5('0x6b')]=function(_0x7e6875){return!_[_0x1da5('0x6c')](_0x7e6875)&&!_[_0x1da5('0x6c')](_0x7e6875[_0x1da5('0x25')])&&!_[_0x1da5('0x6c')](_0x7e6875[_0x1da5('0x6d')])&&_0x7e6875[_0x1da5('0x6d')]&&!_[_0x1da5('0x6c')](this[_0x1da5('0xf')][util[_0x1da5('0x64')]('SIP/%s',_0x7e6875['name'])])&&!_[_0x1da5('0x6c')](this[_0x1da5('0xf')][util[_0x1da5('0x64')](_0x1da5('0x6e'),_0x7e6875['name'])][_0x1da5('0x2f')])&&(this['trunks'][util[_0x1da5('0x64')]('SIP/%s',_0x7e6875[_0x1da5('0x25')])][_0x1da5('0x2f')]===_0x1da5('0x6f')||this[_0x1da5('0xf')][util[_0x1da5('0x64')](_0x1da5('0x6e'),_0x7e6875['name'])]['status']===_0x1da5('0x70'));};Fax[_0x1da5('0x28')][_0x1da5('0x5e')]=function(_0x2f1586,_0x571071){if(!this[_0x1da5('0x6b')](_0x2f1586)){ut[_0x1da5('0x47')](_0x1da5('0x71'),_[_0x1da5('0x6c')](_0x2f1586)?'':_0x2f1586[_0x1da5('0x25')]+_0x1da5('0x72'));return{'isValid':![],'message':_0x1da5('0x73')};}if(_[_0x1da5('0x6c')](_0x571071[_0x1da5('0x7')])){ut[_0x1da5('0x47')](_0x1da5('0x74'),JSON[_0x1da5('0x40')](_0x571071));return{'isValid':![],'message':_0x1da5('0x75')};}if(_[_0x1da5('0x6c')](_0x571071[_0x1da5('0x62')])){ut['logger'](_0x1da5('0x76'),JSON[_0x1da5('0x40')](_0x571071));return{'isValid':![],'message':_0x1da5('0x77')};}return{'isValid':!![],'message':'Is\x20Valid'};};Fax[_0x1da5('0x28')][_0x1da5('0x78')]=function(_0x22aad5,_0xf8cd2d=0x2710){if(this[_0x1da5('0xd')][_0x22aad5]){setTimeout(()=>{delete this[_0x1da5('0xd')][_0x22aad5];},_0xf8cd2d);}};module[_0x1da5('0x79')]=Fax; \ No newline at end of file +var _0x24b4=['\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','Trunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif','dir','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','unmonitored','checkTrunk','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Is\x20Valid','exports','util','lodash','bluebird','uuid','path','tiff2pdf','../../../config/logger','../ami','./rpcDb','./channel','./util/util','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','varset','syncVarSet','bind','newstate','syncNewState','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','originateresponse','prototype','hasOwnProperty','exten','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','value','channelstatedesc','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','localstationid','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','message','create','parse','application/pdf','notify','fax','.pdf','error','\x20notify\x20','stringify','catch','\x20receiveFax\x20','syncOriginateResponse','merge','pick','response','reason','update','AttachmentId','then','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','logger','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][NoUpdate1]','finally','deleteChannelAfterTimeout','syncHangup','\x20hangup\x20sendFile\x20'];(function(_0x458f39,_0x319ba6){var _0x455e63=function(_0x99eee0){while(--_0x99eee0){_0x458f39['push'](_0x458f39['shift']());}};_0x455e63(++_0x319ba6);}(_0x24b4,0x199));var _0x424b=function(_0x51fcb,_0x2dd85f){_0x51fcb=_0x51fcb-0x0;var _0x22c1a9=_0x24b4[_0x51fcb];return _0x22c1a9;};'use strict';var util=require(_0x424b('0x0'));var _=require(_0x424b('0x1'));var BPromise=require(_0x424b('0x2'));var uuid=require(_0x424b('0x3'));var moment=require('moment');var path=require(_0x424b('0x4'));var tiff2pdf=require(_0x424b('0x5'));var gs=require('./util/gs');var logger=require(_0x424b('0x6'))('fax');var ami=require(_0x424b('0x7'));var rpcDb=require(_0x424b('0x8'));var Channel=require(_0x424b('0x9'));var ut=require(_0x424b('0xa'));var Action=require('./action');var faxAccount=require('../rpc/faxAccount');var attachment=require(_0x424b('0xb'));var faxMessage=require(_0x424b('0xc'));function Fax(_0x8df8ff){this[_0x424b('0xd')]={};this['faxAccounts']=_0x8df8ff[_0x424b('0xe')];this[_0x424b('0xf')]=_0x8df8ff[_0x424b('0xf')];this[_0x424b('0x10')]={};ami['on'](_0x424b('0x11'),this[_0x424b('0x12')]['bind'](this));ami['on'](_0x424b('0x13'),this[_0x424b('0x14')][_0x424b('0x15')](this));ami['on'](_0x424b('0x16'),this[_0x424b('0x17')][_0x424b('0x15')](this));ami['on'](_0x424b('0x18'),this[_0x424b('0x19')][_0x424b('0x15')](this));ami['on'](_0x424b('0x1a'),this[_0x424b('0x1b')]['bind'](this));ami['on'](_0x424b('0x1c'),this[_0x424b('0x1d')][_0x424b('0x15')](this));ami['on'](_0x424b('0x1e'),this['syncHangup'][_0x424b('0x15')](this));ami['on'](_0x424b('0x1f'),this['syncOriginateResponse'][_0x424b('0x15')](this));}Fax[_0x424b('0x20')]['syncNewchannel']=function(_0x4bd5c1){if(_0x4bd5c1['context']==='from-voip-provider'){for(var _0x5f06a9 in this[_0x424b('0xe')]){if(this[_0x424b('0xe')][_0x424b('0x21')](_0x5f06a9)){if(_0x4bd5c1[_0x424b('0x22')]===this['faxAccounts'][_0x5f06a9]['localstationid']){this[_0x424b('0xd')][_0x4bd5c1[_0x424b('0x23')]]={};this[_0x424b('0xd')][_0x4bd5c1[_0x424b('0x23')]][_0x424b('0x24')]=_0x4bd5c1[_0x424b('0x24')];this['channels'][_0x4bd5c1[_0x424b('0x23')]]['id']=this[_0x424b('0xe')][_0x5f06a9]['id'];this[_0x424b('0xd')][_0x4bd5c1['uniqueid']][_0x424b('0x25')]=this[_0x424b('0xe')][_0x5f06a9][_0x424b('0x25')];logger[_0x424b('0x26')](_0x4bd5c1[_0x424b('0x23')],_0x424b('0x27'));}}}}if(this[_0x424b('0x10')][_0x4bd5c1[_0x424b('0x23')]]){this['channels'][_0x4bd5c1[_0x424b('0x23')]]={};this[_0x424b('0xd')][_0x4bd5c1[_0x424b('0x23')]]['channel']=_0x4bd5c1[_0x424b('0x24')];logger[_0x424b('0x26')](_0x4bd5c1[_0x424b('0x23')],'\x20syncNewchannel\x20');}};Fax[_0x424b('0x20')][_0x424b('0x14')]=function(_0x1f8713){if(this[_0x424b('0xd')][_0x1f8713[_0x424b('0x23')]]){for(var _0x29beac in _0x1f8713[_0x424b('0x28')]){if(_0x1f8713[_0x424b('0x28')][_0x424b('0x21')](_0x29beac)){this['channels'][_0x1f8713[_0x424b('0x23')]][_0x29beac]=_0x1f8713[_0x424b('0x29')];}}}};Fax[_0x424b('0x20')][_0x424b('0x17')]=function(_0xc6dfc){if(this[_0x424b('0xd')][_0xc6dfc[_0x424b('0x23')]]){this[_0x424b('0xd')][_0xc6dfc[_0x424b('0x23')]]['channelstate']=_0xc6dfc['channelstate'];this['channels'][_0xc6dfc[_0x424b('0x23')]][_0x424b('0x2a')]=_0xc6dfc['channelstatedesc'];}};Fax[_0x424b('0x20')]['syncNewExten']=function(_0x2cf691){if(this['channels'][_0x2cf691[_0x424b('0x23')]]){for(var _0x486e29 in _0x2cf691['variable']){if(_0x2cf691[_0x424b('0x28')][_0x424b('0x21')](_0x486e29)){this['channels'][_0x2cf691[_0x424b('0x23')]][_0x486e29]=_0x2cf691[_0x424b('0x29')];}}}};Fax[_0x424b('0x20')][_0x424b('0x1b')]=function(_0x207867){if(this[_0x424b('0xd')][_0x207867[_0x424b('0x23')]]){this['channels'][_0x207867[_0x424b('0x23')]][_0x424b('0x2b')]=_0x207867[_0x424b('0x2b')];this[_0x424b('0xd')][_0x207867[_0x424b('0x23')]][_0x424b('0x2c')]=_0x207867[_0x424b('0x2c')];this['channels'][_0x207867[_0x424b('0x23')]]['localstationid']=_0x207867['localstationid'];this[_0x424b('0xd')][_0x207867[_0x424b('0x23')]]['filename']=_0x207867[_0x424b('0x2d')];logger[_0x424b('0x26')](_0x207867[_0x424b('0x23')],_0x424b('0x2e'));}};Fax[_0x424b('0x20')][_0x424b('0x1d')]=function(_0x599408){var _0x7e8e9c=this;if(this[_0x424b('0xd')][_0x599408[_0x424b('0x23')]]){var _0x5458fc=this['channels'][_0x599408[_0x424b('0x23')]]['id'];this[_0x424b('0xd')][_0x599408[_0x424b('0x23')]][_0x424b('0x2f')]=_0x599408[_0x424b('0x2f')];this[_0x424b('0xd')][_0x599408['uniqueid']][_0x424b('0x30')]=_0x599408[_0x424b('0x30')];this[_0x424b('0xd')][_0x599408[_0x424b('0x23')]][_0x424b('0x31')]=_0x599408[_0x424b('0x31')];this[_0x424b('0xd')][_0x599408[_0x424b('0x23')]]['resolution']=_0x599408['resolution'];this[_0x424b('0xd')][_0x599408[_0x424b('0x23')]]['transferrate']=_0x599408[_0x424b('0x32')];this[_0x424b('0xd')][_0x599408[_0x424b('0x23')]]['filename']=_0x599408[_0x424b('0x2d')];this['channels'][_0x599408[_0x424b('0x23')]][_0x424b('0x33')]=_0x599408['calleridnum'];if(this['channels'][_0x599408[_0x424b('0x23')]][_0x424b('0x30')]>0x0){tiff2pdf(_0x599408[_0x424b('0x2d')],_0x424b('0x34'),function(_0x54863b){logger[_0x424b('0x26')](_0x599408[_0x424b('0x23')],'\x20result\x20conversion\x20file\x20',_0x54863b[_0x424b('0x35')]);attachment[_0x424b('0x36')]({'name':path[_0x424b('0x37')](_0x599408[_0x424b('0x2d')])[_0x424b('0x25')],'basename':path[_0x424b('0x37')](_0x599408[_0x424b('0x2d')])[_0x424b('0x25')]+'.pdf','type':_0x424b('0x38')})['then'](function(_0x10d322){faxAccount[_0x424b('0x39')](_0x5458fc,{'from':_0x599408[_0x424b('0x33')],'mapKey':_0x424b('0x3a'),'body':path[_0x424b('0x37')](_0x599408[_0x424b('0x2d')])[_0x424b('0x25')]+_0x424b('0x3b'),'AttachmentId':_0x10d322['id']})['catch'](function(_0xd94f0d){logger[_0x424b('0x3c')](_0x599408[_0x424b('0x23')],_0x424b('0x3d'),JSON[_0x424b('0x3e')](_0xd94f0d));});})[_0x424b('0x3f')](function(_0x1d6f68){logger[_0x424b('0x3c')](_0x599408[_0x424b('0x23')],_0x424b('0x40'),JSON['stringify'](_0x1d6f68));});});}logger['info'](_0x599408[_0x424b('0x23')],'\x20receiveFax\x20');}};Fax[_0x424b('0x20')][_0x424b('0x41')]=function(_0x4fcec3){if(this[_0x424b('0x10')][_0x4fcec3[_0x424b('0x23')]]){_[_0x424b('0x42')](this['channels'][_0x4fcec3[_0x424b('0x23')]],_[_0x424b('0x43')](_0x4fcec3,[_0x424b('0x44'),_0x424b('0x45')]));}};function updateStatus(_0x9e9eb5){if(_0x9e9eb5['AttachmentId']){faxMessage[_0x424b('0x46')](_0x9e9eb5[_0x424b('0x47')],{'failMessage':'SENDING\x20FAILED\x20'})[_0x424b('0x48')](function(_0xcde92d){ut['logger'](_0x424b('0x49'),_0xcde92d);})[_0x424b('0x3f')](function(_0x4d0a88){ut['logger'](_0x424b('0x4a'),_0x4d0a88);});}else{ut[_0x424b('0x4b')](_0x424b('0x4c'));}}Fax['prototype'][_0x424b('0x4d')]=function(_0x50a87e,_0x5b751a,_0x5b8907){var _0x3831cd=this;var _0x4ed924={};if(_0x5b751a){_0x4ed924={'read':_0x5b751a};}else{_0x4ed924={'failMessage':_0x5b8907};}if(this[_0x424b('0x10')][_0x50a87e][_0x424b('0x47')]){faxMessage[_0x424b('0x46')](this[_0x424b('0x10')][_0x50a87e][_0x424b('0x47')],_0x4ed924)[_0x424b('0x48')](function(_0x158659){ut['logger']('[Fax][Message][Updated]',_0x158659);})[_0x424b('0x3f')](function(_0x38a372){ut[_0x424b('0x4b')](_0x424b('0x4e'),_0x38a372);})[_0x424b('0x4f')](function(){delete _0x3831cd[_0x424b('0xd')][_0x50a87e];delete _0x3831cd[_0x424b('0x10')][_0x50a87e];});}else{ut[_0x424b('0x4b')]('[Fax][Message][NoUpdate2]');this[_0x424b('0x50')](_0x50a87e);delete this[_0x424b('0x10')][_0x50a87e];}};Fax[_0x424b('0x20')][_0x424b('0x51')]=function(_0x599ea2){var _0x73e369=this;if(this['channels'][_0x599ea2[_0x424b('0x23')]]){if(this[_0x424b('0x10')][_0x599ea2[_0x424b('0x23')]]){this['channels'][_0x599ea2[_0x424b('0x23')]]['id']=this['actions'][_0x599ea2[_0x424b('0x23')]]['id'];this[_0x424b('0xd')][_0x599ea2[_0x424b('0x23')]][_0x424b('0x25')]=this[_0x424b('0x10')][_0x599ea2['uniqueid']][_0x424b('0x25')];}logger['info'](_0x599ea2[_0x424b('0x23')],this['actions'][_0x599ea2[_0x424b('0x23')]]?_0x424b('0x52'):_0x424b('0x53'),JSON[_0x424b('0x3e')](this[_0x424b('0xd')][_0x599ea2[_0x424b('0x23')]]));if(this[_0x424b('0x10')][_0x599ea2[_0x424b('0x23')]]){if(this[_0x424b('0xd')][_0x599ea2[_0x424b('0x23')]][_0x424b('0x54')]>0x0&&this[_0x424b('0xd')][_0x599ea2[_0x424b('0x23')]][_0x424b('0x1a')]===_0x424b('0x55')){this['updateStatus'](_0x599ea2[_0x424b('0x23')],!![]);}else{this[_0x424b('0x4d')](_0x599ea2[_0x424b('0x23')],![],this['channels'][_0x599ea2['uniqueid']]['faxstatusstring']?'SENDING\x20FAILED:\x20'+this[_0x424b('0xd')][_0x599ea2[_0x424b('0x23')]][_0x424b('0x56')]:_0x424b('0x57'));}}}};Fax[_0x424b('0x20')][_0x424b('0x58')]=function(_0x5563b7){var _0x2bae42=this;return new BPromise(function(_0xa62330,_0x36d97f){_0x2bae42[_0x424b('0x59')](_0x5563b7,_0x2bae42[_0x424b('0xe')][_0x5563b7[_0x424b('0x5a')]])[_0x424b('0x48')](function(_0x1f44b2){ut['logger'](_0x424b('0x5b'),_0x1f44b2);_0xa62330(ut['message'](_0x424b('0x5c')));})['catch'](function(_0x1b9fbb){ut[_0x424b('0x4b')](_0x424b('0x5d'),_0x1b9fbb);updateStatus(_0x5563b7);_0x36d97f(ut['message'](_0x424b('0x5e')));});});};Fax[_0x424b('0x20')][_0x424b('0x5f')]=function(_0x4d130d){var _0x14033d=this;return new BPromise(function(_0x3f9437,_0x2d1f07){var _0x2212f7=_0x14033d['checkTrunk'](_0x14033d['faxAccounts'][_0x4d130d[_0x424b('0x5a')]][_0x424b('0x60')],_0x4d130d);if(_0x2212f7[_0x424b('0x61')]){_0x3f9437(ut[_0x424b('0x35')](_0x424b('0x62')));}else{_0x2d1f07(ut[_0x424b('0x35')](_0x2212f7['message']));}});};function originate(_0x1c6066,_0x5a9324,_0x4bbfb1){return new BPromise(function(_0x57b0c8,_0xb9c4d2){if(_0x4bbfb1){var _0x5d1ca7=util[_0x424b('0x63')](_0x424b('0x64'),path[_0x424b('0x37')](_0x1c6066[_0x424b('0x4')])[_0x424b('0x25')],_0x1c6066['path']);gs[_0x424b('0x65')](_0x5d1ca7)[_0x424b('0x48')](function(){_0x1c6066[_0x424b('0x4')]=util[_0x424b('0x63')](_0x424b('0x66'),path[_0x424b('0x37')](_0x1c6066[_0x424b('0x4')])[_0x424b('0x67')],path['parse'](_0x1c6066['path'])[_0x424b('0x25')]);_0x5a9324['XMF-PATH']=_0x1c6066['path'];ut[_0x424b('0x4b')](_0x424b('0x68'),'');ami[_0x424b('0x69')](ut['variablesAction'](_0x1c6066,_0x5a9324))[_0x424b('0x48')](function(_0x35631a){_0x57b0c8(_0x35631a);})['catch'](function(_0x5743f8){_0xb9c4d2(_0x5743f8);});})[_0x424b('0x3f')](function(_0x35caf4){_0xb9c4d2(_0x35caf4);});}else{ami[_0x424b('0x69')](ut[_0x424b('0x6a')](_0x1c6066,_0x5a9324))[_0x424b('0x48')](function(_0x3e2d94){_0x57b0c8(_0x3e2d94);})[_0x424b('0x3f')](function(_0x522c9f){_0xb9c4d2(_0x522c9f);});}});}Fax['prototype'][_0x424b('0x59')]=function(_0x36c35d,_0x537a51){var _0x36ea90=this;return new BPromise(function(_0x3ba9ab,_0x45202a){var _0x102789=uuid['v4']();var _0x487483=ut[_0x424b('0x6b')](_0x36c35d,_0x537a51);_0x36ea90[_0x424b('0x10')][_0x102789]=new Action(_0x102789,_0x537a51,_0x36c35d);var _0x420e9a=_0x36ea90[_0x424b('0x10')][_0x102789];if(path[_0x424b('0x37')](_0x36c35d[_0x424b('0x4')])[_0x424b('0x6c')]===_0x424b('0x3b')){originate(_0x420e9a,_0x487483,!![])[_0x424b('0x48')](function(_0x62a6bf){_0x3ba9ab(_0x62a6bf);})[_0x424b('0x3f')](function(_0x1f2add){_0x45202a(_0x1f2add);});}else{originate(_0x420e9a,_0x487483,![])[_0x424b('0x48')](function(_0x4f857b){_0x3ba9ab(_0x4f857b);})[_0x424b('0x3f')](function(_0x531291){_0x45202a(_0x531291);});}});};Fax[_0x424b('0x20')][_0x424b('0x6d')]=function(_0x3cd863){return!_[_0x424b('0x6e')](_0x3cd863)&&!_['isNil'](_0x3cd863['name'])&&!_[_0x424b('0x6e')](_0x3cd863[_0x424b('0x6f')])&&_0x3cd863['active']&&!_[_0x424b('0x6e')](this['trunks'][util[_0x424b('0x63')](_0x424b('0x70'),_0x3cd863[_0x424b('0x25')])])&&!_[_0x424b('0x6e')](this['trunks'][util[_0x424b('0x63')]('SIP/%s',_0x3cd863['name'])][_0x424b('0x2c')])&&(this[_0x424b('0xf')][util['format'](_0x424b('0x70'),_0x3cd863['name'])][_0x424b('0x2c')]==='reachable'||this[_0x424b('0xf')][util[_0x424b('0x63')]('SIP/%s',_0x3cd863[_0x424b('0x25')])][_0x424b('0x2c')]===_0x424b('0x71'));};Fax[_0x424b('0x20')][_0x424b('0x72')]=function(_0x4096f4,_0x3a1d0e){if(!this['isTrunkReachable'](_0x4096f4)){ut[_0x424b('0x4b')](_0x424b('0x73'),_[_0x424b('0x6e')](_0x4096f4)?'':_0x4096f4[_0x424b('0x25')]+_0x424b('0x74'));return{'isValid':![],'message':_0x424b('0x75')};}if(_['isNil'](_0x3a1d0e[_0x424b('0x3a')])){ut[_0x424b('0x4b')](_0x424b('0x76'),JSON[_0x424b('0x3e')](_0x3a1d0e));return{'isValid':![],'message':_0x424b('0x77')};}if(_[_0x424b('0x6e')](_0x3a1d0e['path'])){ut[_0x424b('0x4b')](_0x424b('0x78'),JSON['stringify'](_0x3a1d0e));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':_0x424b('0x79')};};Fax[_0x424b('0x20')][_0x424b('0x50')]=function(_0x50e546,_0x249795=0x2710){if(this['channels'][_0x50e546]){setTimeout(()=>{delete this[_0x424b('0xd')][_0x50e546];},_0x249795);}};module[_0x424b('0x7a')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 0c38591..ad1cb2b 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 _0x22c3=['error','inspect','notify','resolve','then','catch','[Notify]\x20','util','bluebird','preview','lodash','../rpc/faxAccount'];(function(_0x4d6b49,_0x5c6cef){var _0x2a0107=function(_0x143a9a){while(--_0x143a9a){_0x4d6b49['push'](_0x4d6b49['shift']());}};_0x2a0107(++_0x5c6cef);}(_0x22c3,0x8b));var _0x322c=function(_0x2cd548,_0x28b9f6){_0x2cd548=_0x2cd548-0x0;var _0x1c281c=_0x22c3[_0x2cd548];return _0x1c281c;};'use strict';var util=require(_0x322c('0x0'));var BPromise=require(_0x322c('0x1'));var logger=require('../../../config/logger')(_0x322c('0x2'));var _=require(_0x322c('0x3'));var faxAccount=require(_0x322c('0x4'));function loggerCatch(_0x39872e){return function(_0x299fec){logger[_0x322c('0x5')](_0x39872e,util[_0x322c('0x6')](_0x299fec,{'showHidden':![],'depth':null}));};}exports[_0x322c('0x7')]=function(_0x24e76d,_0x59217b){return BPromise[_0x322c('0x8')]()[_0x322c('0x9')](faxAccount[_0x322c('0x7')](_0x24e76d,_0x59217b))[_0x322c('0xa')](loggerCatch(_0x322c('0xb')));}; \ No newline at end of file +var _0x3aa8=['[Notify]\x20','util','bluebird','../../../config/logger','preview','lodash','resolve','then','catch'];(function(_0x461e0c,_0x1ee235){var _0x76010a=function(_0x260604){while(--_0x260604){_0x461e0c['push'](_0x461e0c['shift']());}};_0x76010a(++_0x1ee235);}(_0x3aa8,0x6d));var _0x83aa=function(_0x5b19d9,_0x738c35){_0x5b19d9=_0x5b19d9-0x0;var _0x392218=_0x3aa8[_0x5b19d9];return _0x392218;};'use strict';var util=require(_0x83aa('0x0'));var BPromise=require(_0x83aa('0x1'));var logger=require(_0x83aa('0x2'))(_0x83aa('0x3'));var _=require(_0x83aa('0x4'));var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x553cdd){return function(_0x19ffbb){logger['error'](_0x553cdd,util['inspect'](_0x19ffbb,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0x4186a7,_0x176a5b){return BPromise[_0x83aa('0x5')]()[_0x83aa('0x6')](faxAccount['notify'](_0x4186a7,_0x176a5b))[_0x83aa('0x7')](loggerCatch(_0x83aa('0x8')));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index c2d3c14..1f840b3 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 _0x3c3f=['util','../../../../config/logger','fax','bluebird','exec','\x20Error\x20:','inspect'];(function(_0x450b2a,_0x174591){var _0x37a7ff=function(_0x259a26){while(--_0x259a26){_0x450b2a['push'](_0x450b2a['shift']());}};_0x37a7ff(++_0x174591);}(_0x3c3f,0x7e));var _0xf3c3=function(_0x4e2272,_0x2e1ae0){_0x4e2272=_0x4e2272-0x0;var _0x45511c=_0x3c3f[_0x4e2272];return _0x45511c;};'use strict';var util=require(_0xf3c3('0x0'));var logger=require(_0xf3c3('0x1'))(_0xf3c3('0x2'));var BPromise=require(_0xf3c3('0x3'));var exec=require('child_process')[_0xf3c3('0x4')];exports['execute']=function(_0x33445d){return new BPromise(function(_0x3cba37,_0x38604f){exec(_0x33445d,function(_0x36afe7,_0x524cdf,_0x565534){logger['info']('Exec\x20gs',_0x524cdf);if(_0x36afe7){logger['info']('Exec\x20gs',_0xf3c3('0x5'),util[_0xf3c3('0x6')](_0x36afe7,{'showHidden':![],'depth':null}),_0x524cdf,_0x565534);_0x38604f(_0x36afe7);}_0x3cba37(_0x524cdf);});});}; \ No newline at end of file +var _0x7319=['util','fax','child_process','exec','Exec\x20gs','info','inspect'];(function(_0xf0bc07,_0x510ebf){var _0x1c50c2=function(_0x2e2bdf){while(--_0x2e2bdf){_0xf0bc07['push'](_0xf0bc07['shift']());}};_0x1c50c2(++_0x510ebf);}(_0x7319,0x1c7));var _0x9731=function(_0x298621,_0x1d2180){_0x298621=_0x298621-0x0;var _0x564b62=_0x7319[_0x298621];return _0x564b62;};'use strict';var util=require(_0x9731('0x0'));var logger=require('../../../../config/logger')(_0x9731('0x1'));var BPromise=require('bluebird');var exec=require(_0x9731('0x2'))[_0x9731('0x3')];exports['execute']=function(_0x4048ec){return new BPromise(function(_0x20403f,_0x35b615){exec(_0x4048ec,function(_0x2c0e48,_0x32c0fa,_0x11db81){logger['info'](_0x9731('0x4'),_0x32c0fa);if(_0x2c0e48){logger[_0x9731('0x5')]('Exec\x20gs','\x20Error\x20:',util[_0x9731('0x6')](_0x2c0e48,{'showHidden':![],'depth':null}),_0x32c0fa,_0x11db81);_0x35b615(_0x2c0e48);}_0x20403f(_0x32c0fa);});});}; \ 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 c01e9ee..1bb3c98 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 _0x95fa=['message','inspect','ecm','headerinfo','minrate','maxrate','format','\x22%s\x22','modem','gateway','t38timeout','localstationid','path','variablesAction','uniqueid','originate','channel','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','util','fax'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x95fa,0xda));var _0xa95f=function(_0x439518,_0x473f89){_0x439518=_0x439518-0x0;var _0x446a47=_0x95fa[_0x439518];return _0x446a47;};'use strict';var util=require(_0xa95f('0x0'));var _=require('lodash');var moment=require('moment');var logger=require('../../../../config/logger')(_0xa95f('0x1'));exports[_0xa95f('0x2')]=function(_0x424d1a){return{'message':_0x424d1a};};exports['logger']=function(_0x332c99,_0x4f31a6){logger['info'](_0x332c99,util[_0xa95f('0x3')](_0x4f31a6,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x2e390f,_0x2022d0){var _0x1b4ee1={'XMF-ECM':_0x2022d0[_0xa95f('0x4')],'XMF-HEADERINFO':_0x2022d0[_0xa95f('0x5')],'XMF-MINRATE':_0x2022d0[_0xa95f('0x6')],'XMF-MAXRATE':_0x2022d0[_0xa95f('0x7')],'XMF-MODEM':util[_0xa95f('0x8')](_0xa95f('0x9'),_0x2022d0[_0xa95f('0xa')]),'XMF-GATEWAY':_0x2022d0[_0xa95f('0xb')],'XMF-FAXDETECT':_0x2022d0['faxdetect'],'XMF-T38TIMEOUT':_0x2022d0[_0xa95f('0xc')],'XMF-LOCALSTATIONID':_0x2022d0[_0xa95f('0xd')],'XMF-PATH':_0x2e390f[_0xa95f('0xe')]};return _0x1b4ee1;};exports[_0xa95f('0xf')]=function(_0x39f0fa,_0x2c197c){return{'actionid':_0x39f0fa[_0xa95f('0x10')],'action':_0xa95f('0x11'),'channel':_0x39f0fa[_0xa95f('0x12')],'Exten':_0xa95f('0x13'),'Context':_0xa95f('0x14'),'Priority':'1','callerid':util['format'](_0xa95f('0x15'),_0x39f0fa[_0xa95f('0x5')]?_0x39f0fa[_0xa95f('0x5')]:'',_0x39f0fa['localstationid']),'variable':_0x2c197c,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x39f0fa['uniqueid']};}; \ No newline at end of file +var _0xc233=['path','variablesAction','uniqueid','originate','channel','from-sip','util','lodash','moment','../../../../config/logger','message','logger','addVariables','ecm','headerinfo','format','\x22%s\x22','modem','gateway','faxdetect','t38timeout','localstationid'];(function(_0x2ee285,_0x611be5){var _0x32e656=function(_0x1a63fb){while(--_0x1a63fb){_0x2ee285['push'](_0x2ee285['shift']());}};_0x32e656(++_0x611be5);}(_0xc233,0x150));var _0x3c23=function(_0x4b4b0e,_0x6c674){_0x4b4b0e=_0x4b4b0e-0x0;var _0x4c2d91=_0xc233[_0x4b4b0e];return _0x4c2d91;};'use strict';var util=require(_0x3c23('0x0'));var _=require(_0x3c23('0x1'));var moment=require(_0x3c23('0x2'));var logger=require(_0x3c23('0x3'))('fax');exports[_0x3c23('0x4')]=function(_0x32d930){return{'message':_0x32d930};};exports[_0x3c23('0x5')]=function(_0x701268,_0x292d11){logger['info'](_0x701268,util['inspect'](_0x292d11,{'showHidden':![],'depth':null}));};exports[_0x3c23('0x6')]=function(_0x4e41fc,_0x3da577){var _0x1c362c={'XMF-ECM':_0x3da577[_0x3c23('0x7')],'XMF-HEADERINFO':_0x3da577[_0x3c23('0x8')],'XMF-MINRATE':_0x3da577['minrate'],'XMF-MAXRATE':_0x3da577['maxrate'],'XMF-MODEM':util[_0x3c23('0x9')](_0x3c23('0xa'),_0x3da577[_0x3c23('0xb')]),'XMF-GATEWAY':_0x3da577[_0x3c23('0xc')],'XMF-FAXDETECT':_0x3da577[_0x3c23('0xd')],'XMF-T38TIMEOUT':_0x3da577[_0x3c23('0xe')],'XMF-LOCALSTATIONID':_0x3da577[_0x3c23('0xf')],'XMF-PATH':_0x4e41fc[_0x3c23('0x10')]};return _0x1c362c;};exports[_0x3c23('0x11')]=function(_0x19de56,_0x4318d2){return{'actionid':_0x19de56[_0x3c23('0x12')],'action':_0x3c23('0x13'),'channel':_0x19de56[_0x3c23('0x14')],'Exten':'xcally-motion-fax','Context':_0x3c23('0x15'),'Priority':'1','callerid':util['format']('\x22%s\x22\x20<%s>',_0x19de56[_0x3c23('0x8')]?_0x19de56[_0x3c23('0x8')]:'',_0x19de56[_0x3c23('0xf')]),'variable':_0x4318d2,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x19de56['uniqueid']};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 425bb63..43dc839 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 _0x48ee=['initDynamics365Accounts','getCampaigns','initCampaigns','initVoiceExtensions','getFaxAccounts','resolve','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','error','inspect','listen','sync','[index.js][main]','moment','./server','./realtime','./report','./acw','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/voiceExtension','./rpc/integrations/zendesk','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/servicenow','../../config/logger','ami','get','hour','then','initTelephones','getTrunks','getVoiceQueues','initVoiceQueues','getTriggers','getTemplates','getZendeskAccounts','initZendeskAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getVtigerAccounts','initVtigerAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts'];(function(_0x5f3cf8,_0x415429){var _0xa43c9b=function(_0x2c135e){while(--_0x2c135e){_0x5f3cf8['push'](_0x5f3cf8['shift']());}};_0xa43c9b(++_0x415429);}(_0x48ee,0x9a));var _0xe48e=function(_0x4609dc,_0x233a96){_0x4609dc=_0x4609dc-0x0;var _0x112df7=_0x48ee[_0x4609dc];return _0x112df7;};'use strict';var util=require('util');var moment=require(_0xe48e('0x0'));var server=require(_0xe48e('0x1'));var Realtime=require(_0xe48e('0x2'));var Report=require(_0xe48e('0x3'));var Acw=require(_0xe48e('0x4'));var Trigger=require(_0xe48e('0x5'));var Dialer=require(_0xe48e('0x6'));var Preview=require(_0xe48e('0x7'));var Fax=require(_0xe48e('0x8'));var user=require(_0xe48e('0x9'));var voiceQueue=require(_0xe48e('0xa'));var voiceQueueReport=require(_0xe48e('0xb'));var voiceCallReport=require(_0xe48e('0xc'));var trunk=require(_0xe48e('0xd'));var trigger=require(_0xe48e('0xe'));var template=require(_0xe48e('0xf'));var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require('./rpc/campaign');var voiceExtension=require(_0xe48e('0x10'));var faxAccount=require('./rpc/faxAccount');var zendesk=require(_0xe48e('0x11'));var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require(_0xe48e('0x12'));var desk=require(_0xe48e('0x13'));var zoho=require(_0xe48e('0x14'));var vtiger=require('./rpc/integrations/vtiger');var freshsales=require('./rpc/integrations/freshsales');var servicenow=require(_0xe48e('0x15'));var dynamics365=require('./rpc/integrations/dynamics365');var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0xe48e('0x16'))(_0xe48e('0x17'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0xe48e('0x18')]('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xe48e('0x18')](_0xe48e('0x19'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise['resolve']()[_0xe48e('0x1a')](user['getAgents']())[_0xe48e('0x1a')](realtime['initAgents']())[_0xe48e('0x1a')](user['getTelephones']())['then'](realtime[_0xe48e('0x1b')]())['then'](trunk[_0xe48e('0x1c')]())[_0xe48e('0x1a')](realtime['initTrunks']())[_0xe48e('0x1a')](voiceQueue[_0xe48e('0x1d')]())[_0xe48e('0x1a')](realtime[_0xe48e('0x1e')]())[_0xe48e('0x1a')](trigger[_0xe48e('0x1f')]())[_0xe48e('0x1a')](realtime['initTriggers']())[_0xe48e('0x1a')](template[_0xe48e('0x20')]())[_0xe48e('0x1a')](realtime['initTemplates']())[_0xe48e('0x1a')](zendesk[_0xe48e('0x21')]())['then'](realtime[_0xe48e('0x22')]())['then'](salesforce['getSalesforceAccounts']())[_0xe48e('0x1a')](realtime[_0xe48e('0x23')]())[_0xe48e('0x1a')](sugarcrm[_0xe48e('0x24')]())[_0xe48e('0x1a')](realtime[_0xe48e('0x25')]())['then'](freshdesk[_0xe48e('0x26')]())['then'](realtime[_0xe48e('0x27')]())['then'](desk[_0xe48e('0x28')]())[_0xe48e('0x1a')](realtime[_0xe48e('0x29')]())[_0xe48e('0x1a')](zoho['getZohoAccounts']())[_0xe48e('0x1a')](realtime['initZohoAccounts']())[_0xe48e('0x1a')](vtiger[_0xe48e('0x2a')]())[_0xe48e('0x1a')](realtime[_0xe48e('0x2b')]())[_0xe48e('0x1a')](freshsales['getFreshsalesAccounts']())[_0xe48e('0x1a')](realtime[_0xe48e('0x2c')]())[_0xe48e('0x1a')](servicenow[_0xe48e('0x2d')]())['then'](realtime[_0xe48e('0x2e')]())[_0xe48e('0x1a')](dynamics365['getDynamics365Accounts']())[_0xe48e('0x1a')](realtime[_0xe48e('0x2f')]())[_0xe48e('0x1a')](campaign[_0xe48e('0x30')]())[_0xe48e('0x1a')](realtime[_0xe48e('0x31')]())['then'](voiceExtension['getVoiceExtensions']())[_0xe48e('0x1a')](realtime[_0xe48e('0x32')]())[_0xe48e('0x1a')](faxAccount[_0xe48e('0x33')]())[_0xe48e('0x1a')](realtime['initFaxAccounts']())[_0xe48e('0x1a')](function(){return realtime;});}function initParams(){return Promise[_0xe48e('0x34')]()[_0xe48e('0x1a')](voiceQueueReport[_0xe48e('0x35')]())[_0xe48e('0x1a')](realtime[_0xe48e('0x36')]())[_0xe48e('0x1a')](cmHopperHistory[_0xe48e('0x37')]())[_0xe48e('0x1a')](realtime[_0xe48e('0x38')]())[_0xe48e('0x1a')](cmHopperHistory[_0xe48e('0x39')]())['then'](realtime[_0xe48e('0x3a')]())[_0xe48e('0x1a')](voiceCallReport[_0xe48e('0x3b')]())[_0xe48e('0x1a')](realtime[_0xe48e('0x3c')]())[_0xe48e('0x3d')](function(_0x4bd994){logger[_0xe48e('0x3e')]('[index.js][initParams]',util[_0xe48e('0x3f')](_0x4bd994,{'showHidden':![],'depth':null}));});}function main(){return server[_0xe48e('0x40')](realtime,preview,fax)[_0xe48e('0x1a')](function(){return initRealtime();})[_0xe48e('0x1a')](function(){return initParams();})[_0xe48e('0x1a')](function(){report[_0xe48e('0x41')]();setInterval(initRealtime,0x1388);})[_0xe48e('0x3d')](function(_0x4fe8bf){logger[_0xe48e('0x3e')](_0xe48e('0x42'),util[_0xe48e('0x3f')](_0x4fe8bf,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0xfe42=['getFreshsalesAccounts','initFreshsalesAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','getVoiceExtensions','initVoiceExtensions','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','error','[index.js][initParams]','listen','[index.js][main]','util','./server','./realtime','./report','./trigger','./dialer','./preview','./rpc/user','./rpc/voiceQueue','./rpc/voiceCallReport','./rpc/trunk','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','get','hour','resolve','getAgents','then','getTelephones','initTelephones','getTrunks','initTrunks','getVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts'];(function(_0x3e32b1,_0x487a75){var _0x419327=function(_0x6ad6a3){while(--_0x6ad6a3){_0x3e32b1['push'](_0x3e32b1['shift']());}};_0x419327(++_0x487a75);}(_0xfe42,0x13a));var _0x2fe4=function(_0x1ca333,_0x15d833){_0x1ca333=_0x1ca333-0x0;var _0x2d34bc=_0xfe42[_0x1ca333];return _0x2d34bc;};'use strict';var util=require(_0x2fe4('0x0'));var moment=require('moment');var server=require(_0x2fe4('0x1'));var Realtime=require(_0x2fe4('0x2'));var Report=require(_0x2fe4('0x3'));var Acw=require('./acw');var Trigger=require(_0x2fe4('0x4'));var Dialer=require(_0x2fe4('0x5'));var Preview=require(_0x2fe4('0x6'));var Fax=require('./fax');var user=require(_0x2fe4('0x7'));var voiceQueue=require(_0x2fe4('0x8'));var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require(_0x2fe4('0x9'));var trunk=require(_0x2fe4('0xa'));var trigger=require('./rpc/trigger');var template=require('./rpc/template');var cmHopperHistory=require(_0x2fe4('0xb'));var campaign=require(_0x2fe4('0xc'));var voiceExtension=require(_0x2fe4('0xd'));var faxAccount=require(_0x2fe4('0xe'));var zendesk=require(_0x2fe4('0xf'));var salesforce=require(_0x2fe4('0x10'));var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require(_0x2fe4('0x11'));var desk=require(_0x2fe4('0x12'));var zoho=require(_0x2fe4('0x13'));var vtiger=require('./rpc/integrations/vtiger');var freshsales=require(_0x2fe4('0x14'));var servicenow=require(_0x2fe4('0x15'));var dynamics365=require(_0x2fe4('0x16'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require('../../config/logger')('ami');var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x2fe4('0x17')]('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x2fe4('0x17')](_0x2fe4('0x18'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0x2fe4('0x19')]()['then'](user[_0x2fe4('0x1a')]())[_0x2fe4('0x1b')](realtime['initAgents']())[_0x2fe4('0x1b')](user[_0x2fe4('0x1c')]())[_0x2fe4('0x1b')](realtime[_0x2fe4('0x1d')]())[_0x2fe4('0x1b')](trunk[_0x2fe4('0x1e')]())[_0x2fe4('0x1b')](realtime[_0x2fe4('0x1f')]())[_0x2fe4('0x1b')](voiceQueue[_0x2fe4('0x20')]())[_0x2fe4('0x1b')](realtime['initVoiceQueues']())[_0x2fe4('0x1b')](trigger[_0x2fe4('0x21')]())[_0x2fe4('0x1b')](realtime[_0x2fe4('0x22')]())[_0x2fe4('0x1b')](template[_0x2fe4('0x23')]())[_0x2fe4('0x1b')](realtime[_0x2fe4('0x24')]())[_0x2fe4('0x1b')](zendesk[_0x2fe4('0x25')]())['then'](realtime[_0x2fe4('0x26')]())['then'](salesforce[_0x2fe4('0x27')]())[_0x2fe4('0x1b')](realtime[_0x2fe4('0x28')]())[_0x2fe4('0x1b')](sugarcrm[_0x2fe4('0x29')]())['then'](realtime[_0x2fe4('0x2a')]())[_0x2fe4('0x1b')](freshdesk[_0x2fe4('0x2b')]())[_0x2fe4('0x1b')](realtime[_0x2fe4('0x2c')]())[_0x2fe4('0x1b')](desk[_0x2fe4('0x2d')]())[_0x2fe4('0x1b')](realtime[_0x2fe4('0x2e')]())[_0x2fe4('0x1b')](zoho[_0x2fe4('0x2f')]())[_0x2fe4('0x1b')](realtime[_0x2fe4('0x30')]())[_0x2fe4('0x1b')](vtiger[_0x2fe4('0x31')]())[_0x2fe4('0x1b')](realtime[_0x2fe4('0x32')]())['then'](freshsales[_0x2fe4('0x33')]())[_0x2fe4('0x1b')](realtime[_0x2fe4('0x34')]())[_0x2fe4('0x1b')](servicenow['getServicenowAccounts']())[_0x2fe4('0x1b')](realtime[_0x2fe4('0x35')]())[_0x2fe4('0x1b')](dynamics365[_0x2fe4('0x36')]())['then'](realtime[_0x2fe4('0x37')]())[_0x2fe4('0x1b')](campaign[_0x2fe4('0x38')]())['then'](realtime['initCampaigns']())[_0x2fe4('0x1b')](voiceExtension[_0x2fe4('0x39')]())[_0x2fe4('0x1b')](realtime[_0x2fe4('0x3a')]())[_0x2fe4('0x1b')](faxAccount['getFaxAccounts']())[_0x2fe4('0x1b')](realtime[_0x2fe4('0x3b')]())['then'](function(){return realtime;});}function initParams(){return Promise[_0x2fe4('0x19')]()[_0x2fe4('0x1b')](voiceQueueReport[_0x2fe4('0x3c')]())[_0x2fe4('0x1b')](realtime[_0x2fe4('0x3d')]())[_0x2fe4('0x1b')](cmHopperHistory[_0x2fe4('0x3e')]())[_0x2fe4('0x1b')](realtime[_0x2fe4('0x3f')]())[_0x2fe4('0x1b')](cmHopperHistory[_0x2fe4('0x40')]())[_0x2fe4('0x1b')](realtime[_0x2fe4('0x41')]())['then'](voiceCallReport[_0x2fe4('0x42')]())[_0x2fe4('0x1b')](realtime[_0x2fe4('0x43')]())[_0x2fe4('0x44')](function(_0x318480){logger[_0x2fe4('0x45')](_0x2fe4('0x46'),util['inspect'](_0x318480,{'showHidden':![],'depth':null}));});}function main(){return server[_0x2fe4('0x47')](realtime,preview,fax)[_0x2fe4('0x1b')](function(){return initRealtime();})['then'](function(){return initParams();})[_0x2fe4('0x1b')](function(){report['sync']();setInterval(initRealtime,0x1388);})[_0x2fe4('0x44')](function(_0xb1d490){logger[_0x2fe4('0x45')](_0x2fe4('0x48'),util['inspect'](_0xb1d490,{'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 7d6de6d..728c6f1 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 _0x973b=['fullname','unknown','stateTime','status','mobile','interface','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','local','updateStatusRealtime','state','toLowerCase','not_inuse','idle','inuse','talking','statePause','toNumber','format','address','online','user:ami:update','omit','emit','exports','lodash','util','moment','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','email','accountcode'];(function(_0x400955,_0xd0898a){var _0x2466af=function(_0x5f3b99){while(--_0x5f3b99){_0x400955['push'](_0x400955['shift']());}};_0x2466af(++_0xd0898a);}(_0x973b,0x6e));var _0xb973=function(_0x2cbbad,_0x1cfe1d){_0x2cbbad=_0x2cbbad-0x0;var _0x49aae6=_0x973b[_0x2cbbad];return _0x49aae6;};'use strict';var _=require(_0xb973('0x0'));var util=require(_0xb973('0x1'));var moment=require(_0xb973('0x2'));var md5=require(_0xb973('0x3'));var Redis=require(_0xb973('0x4'));var config=require(_0xb973('0x5'));config[_0xb973('0x6')]=_[_0xb973('0x7')](config[_0xb973('0x6')],{'host':_0xb973('0x8'),'port':0x18eb});var io=require(_0xb973('0x9'))(new Redis(config['redis']));function Agent(_0xa48248){this['id']=_0xa48248['id']||0x0;this[_0xb973('0xa')]=_0xa48248['name']||'';this[_0xb973('0xb')]=_0xa48248['email']||'';this['accountcode']=_0xa48248[_0xb973('0xc')]||'';this[_0xb973('0xd')]=_0xa48248['fullname']||'';this['state']=_0xb973('0xe');this[_0xb973('0xf')]=0x0;this[_0xb973('0x10')]=_0xb973('0xe');this['address']='';this['phone']='';this[_0xb973('0x11')]='';this[_0xb973('0x12')]='';this['online']=_0xa48248['online']||![];this[_0xb973('0x13')]=_0xb973('0xe');this[_0xb973('0x14')]=0x0;this[_0xb973('0x15')]='';this[_0xb973('0x16')]='';this[_0xb973('0x17')]=![];this[_0xb973('0x18')]=![];this[_0xb973('0x3')]='';}Agent['prototype'][_0xb973('0x19')]=function(_0x5721b5){var _0x89fab6;if(_0x5721b5&&_0x5721b5[_0xb973('0x1a')]){_0x89fab6=_0x5721b5[_0xb973('0x1a')][_0xb973('0x1b')]();switch(_0x89fab6){case _0xb973('0x1c'):_0x89fab6=_0xb973('0x1d');break;case _0xb973('0x1e'):_0x89fab6=_0xb973('0x1f');break;}}if(_0x89fab6&&this[_0xb973('0x13')]!==_0x89fab6||_0x5721b5[_0xb973('0x20')]){this[_0xb973('0x14')]=_[_0xb973('0x21')](moment()[_0xb973('0x22')]('x'));}if(_0x89fab6){this[_0xb973('0x13')]=_0x89fab6;}var _0x119d55={'id':this['id'],'name':this['name'],'email':this[_0xb973('0xb')],'accountcode':this['accountcode'],'fullname':this[_0xb973('0xd')],'state':this[_0xb973('0x1a')],'stateTime':this['stateTime'],'status':this[_0xb973('0x10')],'address':this[_0xb973('0x23')],'online':this[_0xb973('0x24')],'voiceStatus':this[_0xb973('0x13')],'voiceStatusTime':this[_0xb973('0x14')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0xb973('0x16')],'interface':this[_0xb973('0x12')],'onhold':this[_0xb973('0x17')]};var _0x51ab30=md5(JSON['stringify'](_0x119d55));if(this[_0xb973('0x3')]!==_0x51ab30){this['md5']=_0x51ab30;io['to'](util[_0xb973('0x22')]('user:%s',_0x119d55[_0xb973('0xa')]))['emit'](_0xb973('0x25'),_[_0xb973('0x26')](_0x119d55,[_0xb973('0x24')]));io[_0xb973('0x27')]('user:presence',_0x119d55);}};module[_0xb973('0x28')]=Agent; \ No newline at end of file +var _0xa37a=['onhold','local','prototype','updateStatusRealtime','state','toLowerCase','not_inuse','idle','inuse','talking','statePause','toNumber','status','voiceStatusCallerIdNumber','stringify','format','emit','omit','user:presence','util','moment','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','email','accountcode','fullname','unknown','address','mobile','interface','online','voiceStatus','voiceStatusTime','voiceStatusQueue'];(function(_0x119629,_0x246787){var _0x49a771=function(_0x23624c){while(--_0x23624c){_0x119629['push'](_0x119629['shift']());}};_0x49a771(++_0x246787);}(_0xa37a,0x103));var _0xaa37=function(_0xcd1e07,_0x597ff3){_0xcd1e07=_0xcd1e07-0x0;var _0x13aa26=_0xa37a[_0xcd1e07];return _0x13aa26;};'use strict';var _=require('lodash');var util=require(_0xaa37('0x0'));var moment=require(_0xaa37('0x1'));var md5=require(_0xaa37('0x2'));var Redis=require(_0xaa37('0x3'));var config=require(_0xaa37('0x4'));config[_0xaa37('0x5')]=_[_0xaa37('0x6')](config['redis'],{'host':_0xaa37('0x7'),'port':0x18eb});var io=require(_0xaa37('0x8'))(new Redis(config[_0xaa37('0x5')]));function Agent(_0x3ef290){this['id']=_0x3ef290['id']||0x0;this[_0xaa37('0x9')]=_0x3ef290[_0xaa37('0x9')]||'';this[_0xaa37('0xa')]=_0x3ef290[_0xaa37('0xa')]||'';this['accountcode']=_0x3ef290[_0xaa37('0xb')]||'';this[_0xaa37('0xc')]=_0x3ef290['fullname']||'';this['state']='unknown';this['stateTime']=0x0;this['status']=_0xaa37('0xd');this[_0xaa37('0xe')]='';this['phone']='';this[_0xaa37('0xf')]='';this[_0xaa37('0x10')]='';this['online']=_0x3ef290[_0xaa37('0x11')]||![];this[_0xaa37('0x12')]='unknown';this[_0xaa37('0x13')]=0x0;this['voiceStatusCallerIdNumber']='';this[_0xaa37('0x14')]='';this[_0xaa37('0x15')]=![];this[_0xaa37('0x16')]=![];this[_0xaa37('0x2')]='';}Agent[_0xaa37('0x17')][_0xaa37('0x18')]=function(_0x472514){var _0x5384f1;if(_0x472514&&_0x472514[_0xaa37('0x19')]){_0x5384f1=_0x472514[_0xaa37('0x19')][_0xaa37('0x1a')]();switch(_0x5384f1){case _0xaa37('0x1b'):_0x5384f1=_0xaa37('0x1c');break;case _0xaa37('0x1d'):_0x5384f1=_0xaa37('0x1e');break;}}if(_0x5384f1&&this[_0xaa37('0x12')]!==_0x5384f1||_0x472514[_0xaa37('0x1f')]){this[_0xaa37('0x13')]=_[_0xaa37('0x20')](moment()['format']('x'));}if(_0x5384f1){this['voiceStatus']=_0x5384f1;}var _0x2f1501={'id':this['id'],'name':this['name'],'email':this[_0xaa37('0xa')],'accountcode':this['accountcode'],'fullname':this[_0xaa37('0xc')],'state':this[_0xaa37('0x19')],'stateTime':this['stateTime'],'status':this[_0xaa37('0x21')],'address':this[_0xaa37('0xe')],'online':this[_0xaa37('0x11')],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this['voiceStatusTime'],'voiceStatusCallerIdNumber':this[_0xaa37('0x22')],'voiceStatusQueue':this[_0xaa37('0x14')],'interface':this[_0xaa37('0x10')],'onhold':this[_0xaa37('0x15')]};var _0x4652e6=md5(JSON[_0xaa37('0x23')](_0x2f1501));if(this[_0xaa37('0x2')]!==_0x4652e6){this[_0xaa37('0x2')]=_0x4652e6;io['to'](util[_0xaa37('0x24')]('user:%s',_0x2f1501[_0xaa37('0x9')]))[_0xaa37('0x25')]('user:ami:update',_[_0xaa37('0x26')](_0x2f1501,[_0xaa37('0x11')]));io[_0xaa37('0x25')](_0xaa37('0x27'),_0x2f1501);}};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 2967a0e..bbd4e5f 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 _0xce02=['dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','type','campaign','originated','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','name','dialAMDActive','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords'];(function(_0x47289f,_0x342476){var _0x3923c8=function(_0x346cbe){while(--_0x346cbe){_0x47289f['push'](_0x47289f['shift']());}};_0x3923c8(++_0x342476);}(_0xce02,0x161));var _0x2ce0=function(_0x3f0b30,_0x159bc8){_0x3f0b30=_0x3f0b30-0x0;var _0x2748a5=_0xce02[_0x3f0b30];return _0x2748a5;};'use strict';function Campaign(_0x405cc6){this['id']=_0x405cc6['id']||0x0;this['name']=_0x405cc6['name']||'';this[_0x2ce0('0x0')]=_0x405cc6[_0x2ce0('0x0')]||_0x2ce0('0x1');this[_0x2ce0('0x2')]=0x0;this['temp']=0x0;this[_0x2ce0('0x3')]=0x0;this[_0x2ce0('0x4')]=0x0;this[_0x2ce0('0x5')]='';this[_0x2ce0('0x6')]=!![];this[_0x2ce0('0x7')]=_0x405cc6[_0x2ce0('0x7')];this[_0x2ce0('0x8')]=_0x405cc6[_0x2ce0('0x8')];this['dialTimezone']=_0x405cc6[_0x2ce0('0x9')]||null;this[_0x2ce0('0xa')]=_0x405cc6['dialGlobalInterval']?_0x405cc6[_0x2ce0('0xa')]:null;this[_0x2ce0('0xb')]=_0x405cc6[_0x2ce0('0xb')];this[_0x2ce0('0xc')]=_0x405cc6[_0x2ce0('0xc')];this[_0x2ce0('0xd')]=_0x405cc6['dialOriginateTimeout']||0x1e;this[_0x2ce0('0xe')]=_0x405cc6[_0x2ce0('0xe')];this['dialCongestionRetryFrequency']=_0x405cc6[_0x2ce0('0xf')];this[_0x2ce0('0x10')]=_0x405cc6['dialBusyMaxRetry'];this[_0x2ce0('0x11')]=_0x405cc6[_0x2ce0('0x11')];this[_0x2ce0('0x12')]=_0x405cc6[_0x2ce0('0x12')];this[_0x2ce0('0x13')]=_0x405cc6[_0x2ce0('0x13')];this['dialGlobalMaxRetry']=_0x405cc6[_0x2ce0('0x14')];this[_0x2ce0('0x15')]=_0x405cc6[_0x2ce0('0x15')]||0x3;this[_0x2ce0('0x16')]=_0x405cc6[_0x2ce0('0x16')]||0x96;this[_0x2ce0('0x17')]=_0x405cc6[_0x2ce0('0x17')]||0x3;this[_0x2ce0('0x18')]=_0x405cc6[_0x2ce0('0x18')]||0x96;this[_0x2ce0('0x19')]=_0x405cc6['dialAbandonedMaxRetry']||0x3;this['dialAbandonedRetryFrequency']=_0x405cc6['dialAbandonedRetryFrequency']||0x96;this[_0x2ce0('0x1a')]=_0x405cc6[_0x2ce0('0x1a')]||0x3;this[_0x2ce0('0x1b')]=_0x405cc6['dialMachineRetryFrequency']||0x96;this[_0x2ce0('0x1c')]=_0x405cc6[_0x2ce0('0x1c')]||0x3;this[_0x2ce0('0x1d')]=_0x405cc6[_0x2ce0('0x1d')]||0x96;this['dialOrderByScheduledAt']=_0x405cc6[_0x2ce0('0x1e')]||_0x2ce0('0x1f');this['dialPrefix']=_0x405cc6[_0x2ce0('0x20')]||undefined;this[_0x2ce0('0x21')]=_0x405cc6['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x2ce0('0x22')]=_0x405cc6[_0x2ce0('0x22')]||undefined;this[_0x2ce0('0x23')]=_0x405cc6[_0x2ce0('0x23')]?_0x405cc6['TrunkBackup']:undefined;this[_0x2ce0('0x24')]=_0x405cc6[_0x2ce0('0x24')]?_0x405cc6[_0x2ce0('0x24')]:undefined;this[_0x2ce0('0x25')]=_0x405cc6[_0x2ce0('0x25')]?_0x405cc6[_0x2ce0('0x25')]:undefined;this['SquareProject']=_0x405cc6[_0x2ce0('0x26')]?_0x405cc6[_0x2ce0('0x26')]:undefined;this[_0x2ce0('0x27')]=_0x405cc6[_0x2ce0('0x26')]?_0x405cc6[_0x2ce0('0x26')][_0x2ce0('0x28')]:undefined;this[_0x2ce0('0x29')]=_0x405cc6['dialAMDActive']||![];this['dialAMDInitialSilence']=_0x405cc6['dialAMDInitialSilence'];this[_0x2ce0('0x2a')]=_0x405cc6['dialAMDGreeting'];this[_0x2ce0('0x2b')]=_0x405cc6[_0x2ce0('0x2b')];this['dialAMDTotalAnalysisTime']=_0x405cc6[_0x2ce0('0x2c')];this['dialAMDMinWordLength']=_0x405cc6['dialAMDMinWordLength'];this['dialAMDBetweenWordsSilence']=_0x405cc6[_0x2ce0('0x2d')];this[_0x2ce0('0x2e')]=_0x405cc6[_0x2ce0('0x2e')];this[_0x2ce0('0x2f')]=_0x405cc6['dialAMDSilenceThreshold'];this[_0x2ce0('0x30')]=_0x405cc6[_0x2ce0('0x30')];}module[_0x2ce0('0x31')]=Campaign; \ No newline at end of file +var _0x5d62=['limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','ivrTotalCallsDays','message','sendMessageOneNotActive','active'];(function(_0x50653b,_0x565ab3){var _0x446b45=function(_0x280f9f){while(--_0x280f9f){_0x50653b['push'](_0x50653b['shift']());}};_0x446b45(++_0x565ab3);}(_0x5d62,0x1d8));var _0x25d6=function(_0x240f9d,_0x1a9975){_0x240f9d=_0x240f9d-0x0;var _0x430385=_0x5d62[_0x240f9d];return _0x430385;};'use strict';function Campaign(_0xa4b9f){this['id']=_0xa4b9f['id']||0x0;this[_0x25d6('0x0')]=_0xa4b9f[_0x25d6('0x0')]||'';this[_0x25d6('0x1')]=_0xa4b9f['type']||_0x25d6('0x2');this[_0x25d6('0x3')]=0x0;this['temp']=0x0;this['ivrAnswerCallsDay']=0x0;this[_0x25d6('0x4')]=0x0;this[_0x25d6('0x5')]='';this[_0x25d6('0x6')]=!![];this[_0x25d6('0x7')]=_0xa4b9f[_0x25d6('0x7')];this[_0x25d6('0x8')]=_0xa4b9f[_0x25d6('0x8')];this[_0x25d6('0x9')]=_0xa4b9f['dialTimezone']||null;this[_0x25d6('0xa')]=_0xa4b9f[_0x25d6('0xa')]?_0xa4b9f[_0x25d6('0xa')]:null;this[_0x25d6('0xb')]=_0xa4b9f[_0x25d6('0xb')];this[_0x25d6('0xc')]=_0xa4b9f[_0x25d6('0xc')];this[_0x25d6('0xd')]=_0xa4b9f[_0x25d6('0xd')]||0x1e;this[_0x25d6('0xe')]=_0xa4b9f['dialCongestionMaxRetry'];this[_0x25d6('0xf')]=_0xa4b9f[_0x25d6('0xf')];this['dialBusyMaxRetry']=_0xa4b9f[_0x25d6('0x10')];this[_0x25d6('0x11')]=_0xa4b9f[_0x25d6('0x11')];this[_0x25d6('0x12')]=_0xa4b9f[_0x25d6('0x12')];this[_0x25d6('0x13')]=_0xa4b9f[_0x25d6('0x13')];this[_0x25d6('0x14')]=_0xa4b9f[_0x25d6('0x14')];this[_0x25d6('0x15')]=_0xa4b9f['dialNoSuchNumberMaxRetry']||0x3;this[_0x25d6('0x16')]=_0xa4b9f[_0x25d6('0x16')]||0x96;this[_0x25d6('0x17')]=_0xa4b9f['dialDropMaxRetry']||0x3;this['dialDropRetryFrequency']=_0xa4b9f[_0x25d6('0x18')]||0x96;this[_0x25d6('0x19')]=_0xa4b9f['dialAbandonedMaxRetry']||0x3;this[_0x25d6('0x1a')]=_0xa4b9f[_0x25d6('0x1a')]||0x96;this['dialMachineMaxRetry']=_0xa4b9f['dialMachineMaxRetry']||0x3;this[_0x25d6('0x1b')]=_0xa4b9f['dialMachineRetryFrequency']||0x96;this[_0x25d6('0x1c')]=_0xa4b9f[_0x25d6('0x1c')]||0x3;this['dialAgentRejectRetryFrequency']=_0xa4b9f[_0x25d6('0x1d')]||0x96;this['dialOrderByScheduledAt']=_0xa4b9f['dialOrderByScheduledAt']||'DESC';this[_0x25d6('0x1e')]=_0xa4b9f[_0x25d6('0x1e')]||undefined;this['dialRandomLastDigitCallerIdNumber']=_0xa4b9f[_0x25d6('0x1f')]||undefined;this[_0x25d6('0x20')]=_0xa4b9f[_0x25d6('0x20')]||undefined;this['TrunkBackup']=_0xa4b9f['TrunkBackup']?_0xa4b9f[_0x25d6('0x21')]:undefined;this[_0x25d6('0x22')]=_0xa4b9f['Trunk']?_0xa4b9f[_0x25d6('0x22')]:undefined;this[_0x25d6('0x23')]=_0xa4b9f[_0x25d6('0x23')]?_0xa4b9f[_0x25d6('0x23')]:undefined;this['SquareProject']=_0xa4b9f[_0x25d6('0x24')]?_0xa4b9f[_0x25d6('0x24')]:undefined;this[_0x25d6('0x25')]=_0xa4b9f['SquareProject']?_0xa4b9f[_0x25d6('0x24')][_0x25d6('0x0')]:undefined;this[_0x25d6('0x26')]=_0xa4b9f[_0x25d6('0x26')]||![];this['dialAMDInitialSilence']=_0xa4b9f['dialAMDInitialSilence'];this[_0x25d6('0x27')]=_0xa4b9f[_0x25d6('0x27')];this[_0x25d6('0x28')]=_0xa4b9f[_0x25d6('0x28')];this[_0x25d6('0x29')]=_0xa4b9f['dialAMDTotalAnalysisTime'];this[_0x25d6('0x2a')]=_0xa4b9f[_0x25d6('0x2a')];this['dialAMDBetweenWordsSilence']=_0xa4b9f[_0x25d6('0x2b')];this[_0x25d6('0x2c')]=_0xa4b9f[_0x25d6('0x2c')];this[_0x25d6('0x2d')]=_0xa4b9f['dialAMDSilenceThreshold'];this[_0x25d6('0x2e')]=_0xa4b9f[_0x25d6('0x2e')];}module[_0x25d6('0x2f')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index eb47aad..683624e 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 _0x8ff9=['disposition','monitor','monitorFilename','monitors','transferconnectedlinenum','exports','starttime','channel','destinationchannel','calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode','context','uniqueid','linkedid','answered','answertime','endtime','unmanaged','abandoned','lastapplication','duration','type','tag'];(function(_0x106200,_0x3e5b7a){var _0xa9ba85=function(_0x362c7b){while(--_0x362c7b){_0x106200['push'](_0x106200['shift']());}};_0xa9ba85(++_0x3e5b7a);}(_0x8ff9,0x1a6));var _0x98ff=function(_0x1b72d1,_0x5581c6){_0x1b72d1=_0x1b72d1-0x0;var _0x14b098=_0x8ff9[_0x1b72d1];return _0x14b098;};'use strict';function Channel(){this[_0x98ff('0x0')]=null;this[_0x98ff('0x1')]='';this[_0x98ff('0x2')]='';this[_0x98ff('0x3')]=0x0;this[_0x98ff('0x4')]='';this[_0x98ff('0x5')]=undefined;this[_0x98ff('0x6')]=undefined;this[_0x98ff('0x7')]=0x0;this[_0x98ff('0x8')]='';this[_0x98ff('0x9')]=0x0;this[_0x98ff('0xa')]=0x0;this['exten']=0x0;this[_0x98ff('0xb')]=![];this[_0x98ff('0xc')]=null;this[_0x98ff('0xd')]=null;this[_0x98ff('0xe')]=![];this[_0x98ff('0xf')]=![];this[_0x98ff('0x10')]='';this['lastdata']='';this[_0x98ff('0x11')]=0x0;this['billableseconds']=0x0;this['holdtime']=0x0;this[_0x98ff('0x12')]=null;this[_0x98ff('0x13')]=null;this[_0x98ff('0x14')]=null;this[_0x98ff('0x15')]=![];this[_0x98ff('0x16')]=null;this['queue']=null;this[_0x98ff('0x17')]=[];this['transfercalleridnum']=undefined;this[_0x98ff('0x18')]=undefined;this['transferType']=undefined;this['mohtime']=0x0;}module[_0x98ff('0x19')]=Channel; \ No newline at end of file +var _0x5eef=['uniqueid','linkedid','endtime','unmanaged','lastapplication','lastdata','duration','billableseconds','holdtime','type','tag','disposition','monitor','monitorFilename','monitors','transferconnectedlinenum','mohtime','exports','destinationchannel','calleridname','connectedlinename','accountcode','context'];(function(_0xd7f799,_0x749051){var _0x587c44=function(_0x466581){while(--_0x466581){_0xd7f799['push'](_0xd7f799['shift']());}};_0x587c44(++_0x749051);}(_0x5eef,0x9c));var _0xf5ee=function(_0x42b967,_0x4e0487){_0x42b967=_0x42b967-0x0;var _0x46b836=_0x5eef[_0x42b967];return _0x46b836;};'use strict';function Channel(){this['starttime']=null;this['channel']='';this[_0xf5ee('0x0')]='';this['calleridnum']=0x0;this[_0xf5ee('0x1')]='';this['connectedlinenum']=undefined;this[_0xf5ee('0x2')]=undefined;this[_0xf5ee('0x3')]=0x0;this[_0xf5ee('0x4')]='';this[_0xf5ee('0x5')]=0x0;this[_0xf5ee('0x6')]=0x0;this['exten']=0x0;this['answered']=![];this['answertime']=null;this[_0xf5ee('0x7')]=null;this[_0xf5ee('0x8')]=![];this['abandoned']=![];this[_0xf5ee('0x9')]='';this[_0xf5ee('0xa')]='';this[_0xf5ee('0xb')]=0x0;this[_0xf5ee('0xc')]=0x0;this[_0xf5ee('0xd')]=0x0;this[_0xf5ee('0xe')]=null;this[_0xf5ee('0xf')]=null;this[_0xf5ee('0x10')]=null;this[_0xf5ee('0x11')]=![];this[_0xf5ee('0x12')]=null;this['queue']=null;this[_0xf5ee('0x13')]=[];this['transfercalleridnum']=undefined;this[_0xf5ee('0x14')]=undefined;this['transferType']=undefined;this[_0xf5ee('0x15')]=0x0;}module[_0xf5ee('0x16')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 4f06bb9..3a08673 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 _0xda6d=['name','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xda6d,0x1b0));var _0xdda6=function(_0x2c388a,_0x3f4e18){_0x2c388a=_0x2c388a-0x0;var _0x47a4a2=_0xda6d[_0x2c388a];return _0x47a4a2;};'use strict';function DeskAccount(_0x265c7e){this['id']=_0x265c7e['id']||0x0;this['name']=_0x265c7e[_0xdda6('0x0')]||'';this['username']=_0x265c7e['username']||'';this[_0xdda6('0x1')]=_0x265c7e[_0xdda6('0x1')]||'';this[_0xdda6('0x2')]=_0x265c7e['authType']||'';this['password']=_0x265c7e[_0xdda6('0x3')]||'';this['consumerKey']=_0x265c7e[_0xdda6('0x4')]||'';this[_0xdda6('0x5')]=_0x265c7e[_0xdda6('0x5')]||'';this[_0xdda6('0x6')]=_0x265c7e[_0xdda6('0x6')]||'';this[_0xdda6('0x7')]=_0x265c7e[_0xdda6('0x7')]||'';this[_0xdda6('0x8')]=_0x265c7e[_0xdda6('0x8')]||'';this[_0xdda6('0x9')]=_0x265c7e['serverUrl']||'';this['Configurations']=_0x265c7e[_0xdda6('0xa')]||{};}module[_0xdda6('0xb')]=DeskAccount; \ No newline at end of file +var _0x76bd=['name','username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports'];(function(_0x2302e4,_0xf288a8){var _0x542187=function(_0x39da64){while(--_0x39da64){_0x2302e4['push'](_0x2302e4['shift']());}};_0x542187(++_0xf288a8);}(_0x76bd,0x1a0));var _0xd76b=function(_0xc421c1,_0x5528a3){_0xc421c1=_0xc421c1-0x0;var _0x1ee4f1=_0x76bd[_0xc421c1];return _0x1ee4f1;};'use strict';function DeskAccount(_0x2a0cbb){this['id']=_0x2a0cbb['id']||0x0;this[_0xd76b('0x0')]=_0x2a0cbb[_0xd76b('0x0')]||'';this[_0xd76b('0x1')]=_0x2a0cbb[_0xd76b('0x1')]||'';this[_0xd76b('0x2')]=_0x2a0cbb[_0xd76b('0x2')]||'';this[_0xd76b('0x3')]=_0x2a0cbb[_0xd76b('0x3')]||'';this[_0xd76b('0x4')]=_0x2a0cbb[_0xd76b('0x4')]||'';this[_0xd76b('0x5')]=_0x2a0cbb['consumerKey']||'';this[_0xd76b('0x6')]=_0x2a0cbb[_0xd76b('0x6')]||'';this[_0xd76b('0x7')]=_0x2a0cbb['token']||'';this['tokenSecret']=_0x2a0cbb[_0xd76b('0x8')]||'';this[_0xd76b('0x9')]=_0x2a0cbb[_0xd76b('0x9')]||'';this['serverUrl']=_0x2a0cbb[_0xd76b('0xa')]||'';this[_0xd76b('0xb')]=_0x2a0cbb[_0xd76b('0xb')]||{};}module[_0xd76b('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 d971521..03b1ab6 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 _0x7408=['username','password','tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider','exports','name'];(function(_0x2a74f5,_0x542b0b){var _0x358258=function(_0x52e19e){while(--_0x52e19e){_0x2a74f5['push'](_0x2a74f5['shift']());}};_0x358258(++_0x542b0b);}(_0x7408,0x18b));var _0x8740=function(_0x3b3cc6,_0x1a6e24){_0x3b3cc6=_0x3b3cc6-0x0;var _0x1161e4=_0x7408[_0x3b3cc6];return _0x1161e4;};'use strict';function Dynamics365Account(_0x4f7f57){this['id']=_0x4f7f57['id']||0x0;this[_0x8740('0x0')]=_0x4f7f57[_0x8740('0x0')]||'';this[_0x8740('0x1')]=_0x4f7f57[_0x8740('0x1')]||'';this[_0x8740('0x2')]=_0x4f7f57[_0x8740('0x2')]||'';this['remoteUri']=_0x4f7f57['remoteUri']||'';this[_0x8740('0x3')]=_0x4f7f57[_0x8740('0x3')]||'';this[_0x8740('0x4')]=_0x4f7f57[_0x8740('0x4')]||'';this[_0x8740('0x5')]=_0x4f7f57[_0x8740('0x5')]||{};this[_0x8740('0x6')]=_0x4f7f57['serverUrl']||'';this[_0x8740('0x7')]=_0x4f7f57['modernAuthentication']||![];this['Configurations']=_0x4f7f57[_0x8740('0x8')]||{};this[_0x8740('0x9')]=_0x4f7f57[_0x8740('0x9')]||{};}module[_0x8740('0xa')]=Dynamics365Account; \ No newline at end of file +var _0xd2f2=['name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider','exports'];(function(_0x48922e,_0x11dc07){var _0x5c56d6=function(_0x29512b){while(--_0x29512b){_0x48922e['push'](_0x48922e['shift']());}};_0x5c56d6(++_0x11dc07);}(_0xd2f2,0x108));var _0x2d2f=function(_0x2f3a6b,_0x4a9016){_0x2f3a6b=_0x2f3a6b-0x0;var _0x225b14=_0xd2f2[_0x2f3a6b];return _0x225b14;};'use strict';function Dynamics365Account(_0xebda86){this['id']=_0xebda86['id']||0x0;this['name']=_0xebda86[_0x2d2f('0x0')]||'';this[_0x2d2f('0x1')]=_0xebda86[_0x2d2f('0x1')]||'';this[_0x2d2f('0x2')]=_0xebda86['password']||'';this[_0x2d2f('0x3')]=_0xebda86[_0x2d2f('0x3')]||'';this[_0x2d2f('0x4')]=_0xebda86['tenantId']||'';this['clientId']=_0xebda86[_0x2d2f('0x5')]||'';this['clientSecret']=_0xebda86[_0x2d2f('0x6')]||{};this[_0x2d2f('0x7')]=_0xebda86[_0x2d2f('0x7')]||'';this[_0x2d2f('0x8')]=_0xebda86[_0x2d2f('0x8')]||![];this[_0x2d2f('0x9')]=_0xebda86['Configurations']||{};this[_0x2d2f('0xa')]=_0xebda86['CloudProvider']||{};}module[_0x2d2f('0xb')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index cd12fc0..ff5c3c0 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 _0x093f=['t38timeout','SIP','Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect'];(function(_0x50c2c3,_0x30ab87){var _0x325469=function(_0x59e226){while(--_0x59e226){_0x50c2c3['push'](_0x50c2c3['shift']());}};_0x325469(++_0x30ab87);}(_0x093f,0xd2));var _0xf093=function(_0x1a630e,_0x10aba9){_0x1a630e=_0x1a630e-0x0;var _0x311f9f=_0x093f[_0x1a630e];return _0x311f9f;};'use strict';function FaxAccount(_0x85209a){this['id']=_0x85209a['id']||0x0;this[_0xf093('0x0')]=_0x85209a[_0xf093('0x0')]||'';this[_0xf093('0x1')]=_0x85209a[_0xf093('0x1')];this[_0xf093('0x2')]=_0x85209a[_0xf093('0x2')];this['headerinfo']=_0x85209a[_0xf093('0x3')];this[_0xf093('0x4')]=_0x85209a['localstationid'];this[_0xf093('0x5')]=_0x85209a[_0xf093('0x5')]||0x960;this[_0xf093('0x6')]=_0x85209a[_0xf093('0x6')]||0x3840;this[_0xf093('0x7')]=_0x85209a[_0xf093('0x7')]||_0xf093('0x8');this[_0xf093('0x9')]=_0x85209a[_0xf093('0x9')]||'no';this[_0xf093('0xa')]=_0x85209a[_0xf093('0xa')]||'no';this[_0xf093('0xb')]=_0x85209a[_0xf093('0xb')]||0x1388;this['tech']=_0x85209a['tech']||_0xf093('0xc');this['Trunk']=_0x85209a[_0xf093('0xd')]?_0x85209a[_0xf093('0xd')]:undefined;this[_0xf093('0xe')]=_0x85209a['ListId'];this[_0xf093('0xf')]=_0x85209a['key'];}module[_0xf093('0x10')]=FaxAccount; \ No newline at end of file +var _0x8b6c=['SIP','Trunk','ListId','key','exports','name','description','ecm','localstationid','maxrate','modem','gateway','t38timeout','tech'];(function(_0x2ee9a9,_0xf80aec){var _0x49bf16=function(_0x56fbe3){while(--_0x56fbe3){_0x2ee9a9['push'](_0x2ee9a9['shift']());}};_0x49bf16(++_0xf80aec);}(_0x8b6c,0x1b7));var _0xc8b6=function(_0x18ff05,_0xf2b320){_0x18ff05=_0x18ff05-0x0;var _0x51382f=_0x8b6c[_0x18ff05];return _0x51382f;};'use strict';function FaxAccount(_0x1db8db){this['id']=_0x1db8db['id']||0x0;this[_0xc8b6('0x0')]=_0x1db8db['name']||'';this[_0xc8b6('0x1')]=_0x1db8db[_0xc8b6('0x1')];this[_0xc8b6('0x2')]=_0x1db8db[_0xc8b6('0x2')];this['headerinfo']=_0x1db8db['headerinfo'];this['localstationid']=_0x1db8db[_0xc8b6('0x3')];this['minrate']=_0x1db8db['minrate']||0x960;this['maxrate']=_0x1db8db[_0xc8b6('0x4')]||0x3840;this[_0xc8b6('0x5')]=_0x1db8db[_0xc8b6('0x5')]||'v17,v27,v29';this['gateway']=_0x1db8db[_0xc8b6('0x6')]||'no';this['faxdetect']=_0x1db8db['faxdetect']||'no';this[_0xc8b6('0x7')]=_0x1db8db[_0xc8b6('0x7')]||0x1388;this[_0xc8b6('0x8')]=_0x1db8db['tech']||_0xc8b6('0x9');this[_0xc8b6('0xa')]=_0x1db8db[_0xc8b6('0xa')]?_0x1db8db[_0xc8b6('0xa')]:undefined;this[_0xc8b6('0xb')]=_0x1db8db[_0xc8b6('0xb')];this[_0xc8b6('0xc')]=_0x1db8db[_0xc8b6('0xc')];}module[_0xc8b6('0xd')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 31da00c..8291d5e 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 _0x7d04=['serverUrl','Configurations','exports','name','username','apiKey','token','remoteUri'];(function(_0x1795df,_0xcb261e){var _0x3f13c0=function(_0x52c5cf){while(--_0x52c5cf){_0x1795df['push'](_0x1795df['shift']());}};_0x3f13c0(++_0xcb261e);}(_0x7d04,0x7b));var _0x47d0=function(_0x106d1c,_0x5edb2c){_0x106d1c=_0x106d1c-0x0;var _0x5c0ae4=_0x7d04[_0x106d1c];return _0x5c0ae4;};'use strict';function FreshdeskAccount(_0x16a301){this['id']=_0x16a301['id']||0x0;this[_0x47d0('0x0')]=_0x16a301[_0x47d0('0x0')]||'';this[_0x47d0('0x1')]=_0x16a301['username']||'';this[_0x47d0('0x2')]=_0x16a301[_0x47d0('0x3')]||'';this[_0x47d0('0x4')]=_0x16a301[_0x47d0('0x4')]||'';this[_0x47d0('0x5')]=_0x16a301[_0x47d0('0x5')]||'';this[_0x47d0('0x6')]=_0x16a301[_0x47d0('0x6')]||{};}module[_0x47d0('0x7')]=FreshdeskAccount; \ No newline at end of file +var _0xc5f8=['remoteUri','serverUrl','Configurations','exports','name','username','token'];(function(_0x19457c,_0x2f778b){var _0x1bb094=function(_0x3371b8){while(--_0x3371b8){_0x19457c['push'](_0x19457c['shift']());}};_0x1bb094(++_0x2f778b);}(_0xc5f8,0xcf));var _0x8c5f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc5f8[_0x3dd15e];return _0x231fd0;};'use strict';function FreshdeskAccount(_0x33ddf8){this['id']=_0x33ddf8['id']||0x0;this[_0x8c5f('0x0')]=_0x33ddf8[_0x8c5f('0x0')]||'';this[_0x8c5f('0x1')]=_0x33ddf8[_0x8c5f('0x1')]||'';this['apiKey']=_0x33ddf8[_0x8c5f('0x2')]||'';this[_0x8c5f('0x3')]=_0x33ddf8[_0x8c5f('0x3')]||'';this[_0x8c5f('0x4')]=_0x33ddf8[_0x8c5f('0x4')]||'';this[_0x8c5f('0x5')]=_0x33ddf8[_0x8c5f('0x5')]||{};}module[_0x8c5f('0x6')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 74cd892..5438ffb 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 _0x07d7=['token','remoteUri','serverUrl','Configurations','exports','name','username','apiKey'];(function(_0x179e11,_0xf65436){var _0x549f04=function(_0x610545){while(--_0x610545){_0x179e11['push'](_0x179e11['shift']());}};_0x549f04(++_0xf65436);}(_0x07d7,0x85));var _0x707d=function(_0x4df1f5,_0x39c6d2){_0x4df1f5=_0x4df1f5-0x0;var _0x56585b=_0x07d7[_0x4df1f5];return _0x56585b;};'use strict';function FreshsalesAccount(_0x3cc60f){this['id']=_0x3cc60f['id']||0x0;this[_0x707d('0x0')]=_0x3cc60f[_0x707d('0x0')]||'';this[_0x707d('0x1')]=_0x3cc60f[_0x707d('0x1')]||'';this[_0x707d('0x2')]=_0x3cc60f[_0x707d('0x3')]||'';this[_0x707d('0x4')]=_0x3cc60f[_0x707d('0x4')]||'';this[_0x707d('0x5')]=_0x3cc60f[_0x707d('0x5')]||'';this[_0x707d('0x6')]=_0x3cc60f[_0x707d('0x6')]||{};}module[_0x707d('0x7')]=FreshsalesAccount; \ No newline at end of file +var _0x9c5a=['serverUrl','Configurations','exports','name','username','apiKey','token','remoteUri'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x11d8b1,_0x35ff22){_0x11d8b1=_0x11d8b1-0x0;var _0x3a16e4=_0x9c5a[_0x11d8b1];return _0x3a16e4;};'use strict';function FreshsalesAccount(_0x4db732){this['id']=_0x4db732['id']||0x0;this[_0xa9c5('0x0')]=_0x4db732['name']||'';this[_0xa9c5('0x1')]=_0x4db732[_0xa9c5('0x1')]||'';this[_0xa9c5('0x2')]=_0x4db732[_0xa9c5('0x3')]||'';this['remoteUri']=_0x4db732[_0xa9c5('0x4')]||'';this[_0xa9c5('0x5')]=_0x4db732['serverUrl']||'';this[_0xa9c5('0x6')]=_0x4db732['Configurations']||{};}module[_0xa9c5('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 b4eceb9..1f43030 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 _0x9f7d=['accountcode','context','exten','priority','holdtime','assigned','lastAssignedTo','voice','mohtime','variables','type','inbound','calleridnum','queue','queuecallerjoinAt','position','count','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','channel','connectedlinenum','connectedlinename'];(function(_0x4e460,_0x15af99){var _0x18b013=function(_0x35478b){while(--_0x35478b){_0x4e460['push'](_0x4e460['shift']());}};_0x18b013(++_0x15af99);}(_0x9f7d,0xfa));var _0xd9f7=function(_0x23b7a7,_0x2fd1bc){_0x23b7a7=_0x23b7a7-0x0;var _0x229859=_0x9f7d[_0x23b7a7];return _0x229859;};'use strict';function QueueReport(){this[_0xd9f7('0x0')]=_0xd9f7('0x1');this['uniqueid']='';this[_0xd9f7('0x2')]='';this['calleridname']='';this[_0xd9f7('0x3')]='';this[_0xd9f7('0x4')]=null;this['queuecallerleaveAt']=null;this[_0xd9f7('0x5')]=0x1;this[_0xd9f7('0x6')]=0x1;this['queuecallerabandon']=![];this[_0xd9f7('0x7')]=null;this[_0xd9f7('0x8')]=![];this[_0xd9f7('0x9')]=null;this[_0xd9f7('0xa')]=![];this['queuecallerexitAt']=null;this['originalposition']=0x1;this[_0xd9f7('0xb')]='';this[_0xd9f7('0xc')]='';this[_0xd9f7('0xd')]='';this[_0xd9f7('0xe')]='';this[_0xd9f7('0xf')]='';this[_0xd9f7('0x10')]='';this[_0xd9f7('0x11')]='';this[_0xd9f7('0x12')]=0x0;this[_0xd9f7('0x13')]=![];this[_0xd9f7('0x14')]='';this['motionChannel']=_0xd9f7('0x15');this[_0xd9f7('0x16')]=0x0;this[_0xd9f7('0x17')]={};}module['exports']=QueueReport; \ No newline at end of file +var _0x76df=['motionChannel','mohtime','variables','exports','uniqueid','calleridnum','calleridname','queue','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinenum','accountcode','context','exten','holdtime','assigned','lastAssignedTo'];(function(_0x1e9992,_0x24a7db){var _0x4204e2=function(_0x43b540){while(--_0x43b540){_0x1e9992['push'](_0x1e9992['shift']());}};_0x4204e2(++_0x24a7db);}(_0x76df,0x16c));var _0xf76d=function(_0xe52657,_0x374354){_0xe52657=_0xe52657-0x0;var _0x4f14ea=_0x76df[_0xe52657];return _0x4f14ea;};'use strict';function QueueReport(){this['type']='inbound';this[_0xf76d('0x0')]='';this[_0xf76d('0x1')]='';this[_0xf76d('0x2')]='';this[_0xf76d('0x3')]='';this['queuecallerjoinAt']=null;this['queuecallerleaveAt']=null;this[_0xf76d('0x4')]=0x1;this[_0xf76d('0x5')]=0x1;this[_0xf76d('0x6')]=![];this[_0xf76d('0x7')]=null;this[_0xf76d('0x8')]=![];this['queuecallercompleteAt']=null;this[_0xf76d('0x9')]=![];this[_0xf76d('0xa')]=null;this[_0xf76d('0xb')]=0x1;this[_0xf76d('0xc')]='';this[_0xf76d('0xd')]='';this['connectedlinename']='';this[_0xf76d('0xe')]='';this[_0xf76d('0xf')]='';this[_0xf76d('0x10')]='';this['priority']='';this[_0xf76d('0x11')]=0x0;this[_0xf76d('0x12')]=![];this[_0xf76d('0x13')]='';this[_0xf76d('0x14')]='voice';this[_0xf76d('0x15')]=0x0;this[_0xf76d('0x16')]={};}module[_0xf76d('0x17')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 8d0ad25..927218a 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 _0x9931=['remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl','exports','name','username'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0x9931,0x1b6));var _0x1993=function(_0x3e529a,_0x2ca07b){_0x3e529a=_0x3e529a-0x0;var _0x32cfa8=_0x9931[_0x3e529a];return _0x32cfa8;};'use strict';function SalesforceAccount(_0xa53aca){this['id']=_0xa53aca['id']||0x0;this[_0x1993('0x0')]=_0xa53aca['name']||'';this[_0x1993('0x1')]=_0xa53aca[_0x1993('0x1')]||'';this[_0x1993('0x2')]=_0xa53aca[_0x1993('0x2')]||'';this[_0x1993('0x3')]=_0xa53aca[_0x1993('0x3')]||'';this[_0x1993('0x4')]=_0xa53aca[_0x1993('0x4')]||'';this[_0x1993('0x5')]=_0xa53aca[_0x1993('0x5')]||'';this[_0x1993('0x6')]=_0xa53aca[_0x1993('0x6')]||'';this[_0x1993('0x7')]=_0xa53aca[_0x1993('0x7')]||_0x1993('0x8');this[_0x1993('0x9')]=_0xa53aca[_0x1993('0x9')]||'';this['Configurations']=_0xa53aca['Configurations']||{};}module[_0x1993('0xa')]=SalesforceAccount; \ No newline at end of file +var _0xf536=['remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','name','username'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xf536,0x106));var _0x6f53=function(_0x367995,_0x129ae2){_0x367995=_0x367995-0x0;var _0x22daa8=_0xf536[_0x367995];return _0x22daa8;};'use strict';function SalesforceAccount(_0x24d96e){this['id']=_0x24d96e['id']||0x0;this[_0x6f53('0x0')]=_0x24d96e['name']||'';this[_0x6f53('0x1')]=_0x24d96e['username']||'';this[_0x6f53('0x2')]=_0x24d96e[_0x6f53('0x2')]||'';this[_0x6f53('0x3')]=_0x24d96e['password']||'';this[_0x6f53('0x4')]=_0x24d96e[_0x6f53('0x4')]||'';this[_0x6f53('0x5')]=_0x24d96e['clientSecret']||'';this[_0x6f53('0x6')]=_0x24d96e['securityToken']||'';this[_0x6f53('0x7')]=_0x24d96e[_0x6f53('0x7')]||_0x6f53('0x8');this[_0x6f53('0x9')]=_0x24d96e[_0x6f53('0x9')]||'';this[_0x6f53('0xa')]=_0x24d96e['Configurations']||{};}module['exports']=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index 1eace99..a539747 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 _0x89d3=['name','username','password','remoteUri','serverUrl','Configurations','exports'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x89d3,0x134));var _0x389d=function(_0x3a2a3c,_0x37bd31){_0x3a2a3c=_0x3a2a3c-0x0;var _0x50ac9a=_0x89d3[_0x3a2a3c];return _0x50ac9a;};'use strict';function ServicenowAccount(_0x21c44d){this['id']=_0x21c44d['id']||0x0;this[_0x389d('0x0')]=_0x21c44d[_0x389d('0x0')]||'';this[_0x389d('0x1')]=_0x21c44d[_0x389d('0x1')]||'';this[_0x389d('0x2')]=_0x21c44d[_0x389d('0x2')]||'';this['remoteUri']=_0x21c44d[_0x389d('0x3')]||'';this[_0x389d('0x4')]=_0x21c44d[_0x389d('0x4')]||'';this[_0x389d('0x5')]=_0x21c44d[_0x389d('0x5')]||{};}module[_0x389d('0x6')]=ServicenowAccount; \ No newline at end of file +var _0x340b=['exports','name','username','password','remoteUri','serverUrl','Configurations'];(function(_0x81fe53,_0x5b8f05){var _0x56f7a7=function(_0x1e7846){while(--_0x1e7846){_0x81fe53['push'](_0x81fe53['shift']());}};_0x56f7a7(++_0x5b8f05);}(_0x340b,0x71));var _0xb340=function(_0x436782,_0x5a7e34){_0x436782=_0x436782-0x0;var _0x3c5ba6=_0x340b[_0x436782];return _0x3c5ba6;};'use strict';function ServicenowAccount(_0x5edbf6){this['id']=_0x5edbf6['id']||0x0;this['name']=_0x5edbf6[_0xb340('0x0')]||'';this[_0xb340('0x1')]=_0x5edbf6[_0xb340('0x1')]||'';this[_0xb340('0x2')]=_0x5edbf6[_0xb340('0x2')]||'';this[_0xb340('0x3')]=_0x5edbf6['remoteUri']||'';this[_0xb340('0x4')]=_0x5edbf6[_0xb340('0x4')]||'';this['Configurations']=_0x5edbf6[_0xb340('0x5')]||{};}module[_0xb340('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 6c90e8c..6411807 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 _0x15a9=['Configurations','exports','name','username','password','remoteUri','serverUrl'];(function(_0xdbac11,_0x4aff44){var _0x5a262a=function(_0x16a8b8){while(--_0x16a8b8){_0xdbac11['push'](_0xdbac11['shift']());}};_0x5a262a(++_0x4aff44);}(_0x15a9,0x18a));var _0x915a=function(_0x1a2b52,_0x2fa31d){_0x1a2b52=_0x1a2b52-0x0;var _0x39c914=_0x15a9[_0x1a2b52];return _0x39c914;};'use strict';function SugarcrmAccount(_0x4199b9){this['id']=_0x4199b9['id']||0x0;this[_0x915a('0x0')]=_0x4199b9[_0x915a('0x0')]||'';this[_0x915a('0x1')]=_0x4199b9['username']||'';this[_0x915a('0x2')]=_0x4199b9[_0x915a('0x2')]||'';this[_0x915a('0x3')]=_0x4199b9[_0x915a('0x3')]||'';this[_0x915a('0x4')]=_0x4199b9[_0x915a('0x4')]||'';this[_0x915a('0x5')]=_0x4199b9[_0x915a('0x5')]||{};}module[_0x915a('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0x1d9c=['Configurations','exports','name','username','password','remoteUri','serverUrl'];(function(_0x4de7ab,_0x44a6c3){var _0x1f3f06=function(_0x55c66b){while(--_0x55c66b){_0x4de7ab['push'](_0x4de7ab['shift']());}};_0x1f3f06(++_0x44a6c3);}(_0x1d9c,0x64));var _0xc1d9=function(_0x457549,_0x3e0f46){_0x457549=_0x457549-0x0;var _0x3c1d6f=_0x1d9c[_0x457549];return _0x3c1d6f;};'use strict';function SugarcrmAccount(_0x383536){this['id']=_0x383536['id']||0x0;this[_0xc1d9('0x0')]=_0x383536[_0xc1d9('0x0')]||'';this[_0xc1d9('0x1')]=_0x383536[_0xc1d9('0x1')]||'';this[_0xc1d9('0x2')]=_0x383536[_0xc1d9('0x2')]||'';this['remoteUri']=_0x383536[_0xc1d9('0x3')]||'';this[_0xc1d9('0x4')]=_0x383536['serverUrl']||'';this['Configurations']=_0x383536[_0xc1d9('0x5')]||{};}module[_0xc1d9('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 a9c6caf..3660bd1 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 _0xe7a0=['stateTime','address','exports','name','accountcode','state','unknown'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe7a0,0x10d));var _0x0e7a=function(_0x179e01,_0x59f71a){_0x179e01=_0x179e01-0x0;var _0x276c89=_0xe7a0[_0x179e01];return _0x276c89;};'use strict';function Telephone(_0x75968b){this['id']=_0x75968b['id']||0x0;this[_0x0e7a('0x0')]=_0x75968b[_0x0e7a('0x0')]||'';this[_0x0e7a('0x1')]=_0x75968b[_0x0e7a('0x1')]||'';this[_0x0e7a('0x2')]=_0x0e7a('0x3');this[_0x0e7a('0x4')]=0x0;this['status']=_0x0e7a('0x3');this[_0x0e7a('0x5')]='';}module[_0x0e7a('0x6')]=Telephone; \ No newline at end of file +var _0xb4e0=['unknown','status','exports','name','accountcode','state'];(function(_0x6c0123,_0x4c8d3b){var _0x5a87d2=function(_0x1ff614){while(--_0x1ff614){_0x6c0123['push'](_0x6c0123['shift']());}};_0x5a87d2(++_0x4c8d3b);}(_0xb4e0,0x10b));var _0x0b4e=function(_0x3d493e,_0x4a6c2d){_0x3d493e=_0x3d493e-0x0;var _0x567672=_0xb4e0[_0x3d493e];return _0x567672;};'use strict';function Telephone(_0x3ec18c){this['id']=_0x3ec18c['id']||0x0;this[_0x0b4e('0x0')]=_0x3ec18c[_0x0b4e('0x0')]||'';this[_0x0b4e('0x1')]=_0x3ec18c[_0x0b4e('0x1')]||'';this[_0x0b4e('0x2')]=_0x0b4e('0x3');this['stateTime']=0x0;this[_0x0b4e('0x4')]='unknown';this['address']='';}module[_0x0b4e('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 1d98b0d..d593e10 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(_0x105fe5,_0x11889d){var _0x5c7eb0=function(_0x14681b){while(--_0x14681b){_0x105fe5['push'](_0x105fe5['shift']());}};_0x5c7eb0(++_0x11889d);}(_0xb10b,0x12a));var _0xbb10=function(_0x35b7b3,_0x62c34e){_0x35b7b3=_0x35b7b3-0x0;var _0x5afb26=_0xb10b[_0x35b7b3];return _0x5afb26;};'use strict';function template(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'';}module['exports']=template; \ No newline at end of file +var _0xb10b=['name','html'];(function(_0x2e2685,_0x36ca03){var _0x2f1a2b=function(_0x22e8be){while(--_0x22e8be){_0x2e2685['push'](_0x2e2685['shift']());}};_0x2f1a2b(++_0x36ca03);}(_0xb10b,0x12a));var _0xbb10=function(_0x42f3a6,_0x45285c){_0x42f3a6=_0x42f3a6-0x0;var _0xdf3c33=_0xb10b[_0x42f3a6];return _0xdf3c33;};'use strict';function template(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'';}module['exports']=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index 09ebd15..da24cc3 100644 --- a/server/services/ami/model/trigger.js +++ b/server/services/ami/model/trigger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['Actions','exports','name','channel','voice','status','AllConditions','AnyConditions'];(function(_0x414655,_0x79d916){var _0x237884=function(_0x2737d9){while(--_0x2737d9){_0x414655['push'](_0x414655['shift']());}};_0x237884(++_0x79d916);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xbaf0[_0x2b4411];return _0x8e41ef;};'use strict';function Trigger(_0x61caa9){this['id']=_0x61caa9['id']||0x0;this[_0x0baf('0x0')]=_0x61caa9[_0x0baf('0x0')]||'';this[_0x0baf('0x1')]=_0x61caa9[_0x0baf('0x1')]||_0x0baf('0x2');this[_0x0baf('0x3')]=_0x61caa9['status']||![];this[_0x0baf('0x4')]=_0x61caa9[_0x0baf('0x4')]||[];this[_0x0baf('0x5')]=_0x61caa9[_0x0baf('0x5')]||[];this[_0x0baf('0x6')]=_0x61caa9[_0x0baf('0x6')]||[];}module[_0x0baf('0x7')]=Trigger; \ No newline at end of file +var _0xbaf0=['Actions','exports','name','channel','voice','status','AllConditions','AnyConditions'];(function(_0x386c3e,_0x44a375){var _0x4b8e13=function(_0x583c8f){while(--_0x583c8f){_0x386c3e['push'](_0x386c3e['shift']());}};_0x4b8e13(++_0x44a375);}(_0xbaf0,0x12a));var _0x0baf=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xbaf0[_0x14add3];return _0x4a174f;};'use strict';function Trigger(_0x61caa9){this['id']=_0x61caa9['id']||0x0;this[_0x0baf('0x0')]=_0x61caa9[_0x0baf('0x0')]||'';this[_0x0baf('0x1')]=_0x61caa9[_0x0baf('0x1')]||_0x0baf('0x2');this[_0x0baf('0x3')]=_0x61caa9['status']||![];this[_0x0baf('0x4')]=_0x61caa9[_0x0baf('0x4')]||[];this[_0x0baf('0x5')]=_0x61caa9[_0x0baf('0x5')]||[];this[_0x0baf('0x6')]=_0x61caa9[_0x0baf('0x6')]||[];}module[_0x0baf('0x7')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 4c6f574..a1e627c 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 _0xfe43=['host','domain','domainport','refresh','address','defaultuser','active','name','state','unknown','stateTime','indexOf','registry','split'];(function(_0x51ac09,_0x383098){var _0x3f827d=function(_0x2d8d0f){while(--_0x2d8d0f){_0x51ac09['push'](_0x51ac09['shift']());}};_0x3f827d(++_0x383098);}(_0xfe43,0xae));var _0x3fe4=function(_0xbabce1,_0x36f0ca){_0xbabce1=_0xbabce1-0x0;var _0x438df0=_0xfe43[_0xbabce1];return _0x438df0;};'use strict';function Trunk(_0x3b6c51){this['id']=_0x3b6c51['id']||0x0;this[_0x3fe4('0x0')]=_0x3b6c51['active']||![];this[_0x3fe4('0x1')]=_0x3b6c51[_0x3fe4('0x1')]||'';this[_0x3fe4('0x2')]=_0x3fe4('0x3');this[_0x3fe4('0x4')]=0x0;this['status']='unknown';this['registry']=_0x3b6c51['registry']&&_0x3b6c51['registry'][_0x3fe4('0x5')](':')?_0x3b6c51[_0x3fe4('0x6')][_0x3fe4('0x7')](':')[0x0]:'';this[_0x3fe4('0x8')]='';this['port']='';this[_0x3fe4('0x9')]='';this[_0x3fe4('0xa')]='';this[_0x3fe4('0xb')]='';this['stateRegistry']=_0x3fe4('0x3');this['registrationtime']='';this[_0x3fe4('0xc')]='';this['defaultuser']=_0x3b6c51[_0x3fe4('0xd')]||'';}module['exports']=Trunk; \ No newline at end of file +var _0xbee8=['unknown','stateTime','status','registry','indexOf','split','host','port','refresh','registrationtime','address','defaultuser','exports','active','name'];(function(_0x5b567e,_0x146470){var _0x4ba29f=function(_0x503f66){while(--_0x503f66){_0x5b567e['push'](_0x5b567e['shift']());}};_0x4ba29f(++_0x146470);}(_0xbee8,0x1b1));var _0x8bee=function(_0x2085f3,_0x50105b){_0x2085f3=_0x2085f3-0x0;var _0x384e3c=_0xbee8[_0x2085f3];return _0x384e3c;};'use strict';function Trunk(_0x97978d){this['id']=_0x97978d['id']||0x0;this['active']=_0x97978d[_0x8bee('0x0')]||![];this[_0x8bee('0x1')]=_0x97978d['name']||'';this['state']=_0x8bee('0x2');this[_0x8bee('0x3')]=0x0;this[_0x8bee('0x4')]=_0x8bee('0x2');this[_0x8bee('0x5')]=_0x97978d[_0x8bee('0x5')]&&_0x97978d[_0x8bee('0x5')][_0x8bee('0x6')](':')?_0x97978d[_0x8bee('0x5')][_0x8bee('0x7')](':')[0x0]:'';this[_0x8bee('0x8')]='';this[_0x8bee('0x9')]='';this['domain']='';this['domainport']='';this[_0x8bee('0xa')]='';this['stateRegistry']='unknown';this[_0x8bee('0xb')]='';this[_0x8bee('0xc')]='';this[_0x8bee('0xd')]=_0x97978d[_0x8bee('0xd')]||'';}module[_0x8bee('0xe')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 9483062..7dd832b 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 _0xb7a8=['mandatoryDisposition','exports','exten','none'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0xb7a8,0x182));var _0x8b7a=function(_0xb926f2,_0x36814f){_0xb926f2=_0xb926f2-0x0;var _0x25ca96=_0xb7a8[_0xb926f2];return _0x25ca96;};'use strict';function voiceExtension(_0x356473){this['id']=_0x356473['id']||0x0;this[_0x8b7a('0x0')]=_0x356473[_0x8b7a('0x0')]||'';this['recordingFormat']=_0x356473['recordingFormat']||_0x8b7a('0x1');this[_0x8b7a('0x2')]=_0x356473[_0x8b7a('0x2')]||![];}module[_0x8b7a('0x3')]=voiceExtension; \ No newline at end of file +var _0x0e56=['mandatoryDisposition','exten','recordingFormat'];(function(_0x18cac4,_0x57a4d5){var _0x2227c6=function(_0x72934d){while(--_0x72934d){_0x18cac4['push'](_0x18cac4['shift']());}};_0x2227c6(++_0x57a4d5);}(_0x0e56,0x112));var _0x60e5=function(_0x249565,_0x2a026a){_0x249565=_0x249565-0x0;var _0x43dee8=_0x0e56[_0x249565];return _0x43dee8;};'use strict';function voiceExtension(_0xc647a1){this['id']=_0xc647a1['id']||0x0;this[_0x60e5('0x0')]=_0xc647a1['exten']||'';this[_0x60e5('0x1')]=_0xc647a1[_0x60e5('0x1')]||'none';this[_0x60e5('0x2')]=_0xc647a1['mandatoryDisposition']||![];}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 18dfad9..6c71a65 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 _0x4233=['dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav49','gsm','fewestcalls','linear','random','ringall','roundrobin','wrandom','monitor_format','inbound','waiting','total','answered','sumDuration','sumHoldTime','sumBillable','busy','inUse','invalid','loggedIn','notInUse','onHold','paused','ringing','talking','unavailable','unknown','acw','acwTimeout','autopause','sendMessageOneNotActive','statusMessage','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalMaxThreshold'];(function(_0x422559,_0x1b67f2){var _0x2e296a=function(_0x39ce06){while(--_0x39ce06){_0x422559['push'](_0x422559['shift']());}};_0x2e296a(++_0x1b67f2);}(_0x4233,0x199));var _0x3423=function(_0x4f064d,_0x18422b){_0x4f064d=_0x4f064d-0x0;var _0x35651f=_0x4233[_0x4f064d];return _0x35651f;};'use strict';var monitorFormat={'wav':'wav','wav49':_0x3423('0x0'),'gsm':_0x3423('0x1')};var strategy={'fewestcalls':_0x3423('0x2'),'leastrecent':'leastrecent','linear':_0x3423('0x3'),'random':_0x3423('0x4'),'ringall':_0x3423('0x5'),'rr':_0x3423('0x6'),'rrmemory':'rrmemory','rrordered':'rrordered','wrandom':_0x3423('0x7')};function VoiceQueue(_0x26c566){this['id']=_0x26c566['id']||0x0;this['name']=_0x26c566['name']||'';this[_0x3423('0x8')]=_0x26c566['monitor_format']||'';this['type']=_0x26c566['type']||_0x3423('0x9');this[_0x3423('0xa')]=0x0;this[_0x3423('0xb')]=0x0;this[_0x3423('0xc')]=0x0;this[_0x3423('0xd')]=0x0;this[_0x3423('0xe')]=0x0;this[_0x3423('0xf')]=0x0;this['unmanaged']=0x0;this['abandoned']=0x0;this['available']=0x0;this[_0x3423('0x10')]=0x0;this[_0x3423('0x11')]=0x0;this[_0x3423('0x12')]=0x0;this[_0x3423('0x13')]=0x0;this[_0x3423('0x14')]=0x0;this[_0x3423('0x15')]=0x0;this[_0x3423('0x16')]=0x0;this[_0x3423('0x17')]=0x0;this['ringInUse']=0x0;this[_0x3423('0x18')]=0x0;this[_0x3423('0x19')]=0x0;this[_0x3423('0x1a')]=0x0;this[_0x3423('0x1b')]=_0x26c566[_0x3423('0x1b')]||![];this[_0x3423('0x1c')]=_0x26c566[_0x3423('0x1c')]||0xa;this[_0x3423('0x1d')]=_0x26c566[_0x3423('0x1d')]||'no';this[_0x3423('0x1e')]=!![];this['message']='';this[_0x3423('0x1f')]='';this[_0x3423('0x20')]=0x0;this[_0x3423('0x21')]=0x0;this[_0x3423('0x22')]=_0x26c566[_0x3423('0x22')]||null;this['dialGlobalInterval']=_0x26c566[_0x3423('0x23')]?_0x26c566[_0x3423('0x23')]:null;this[_0x3423('0x24')]=_0x26c566[_0x3423('0x24')];this[_0x3423('0x25')]=_0x26c566[_0x3423('0x25')]||_0x3423('0x26');this[_0x3423('0x27')]=_0x26c566[_0x3423('0x27')]||0x0;this[_0x3423('0x28')]=_0x26c566['dialLimitQueue']||0x0;this[_0x3423('0x29')]=_0x26c566[_0x3423('0x29')]||0x1;this['dialPredictiveOptimization']=_0x26c566[_0x3423('0x2a')]||_0x3423('0x2b');this[_0x3423('0x2c')]=_0x26c566[_0x3423('0x2c')]||0.03;this[_0x3423('0x2d')]=_0x26c566['dialPredictiveInterval']||0x258;this['dialOriginateCallerIdName']=_0x26c566[_0x3423('0x2e')]||_0x3423('0x2f');this[_0x3423('0x30')]=_0x26c566[_0x3423('0x30')]||_0x3423('0x2f');this[_0x3423('0x31')]=_0x26c566['dialOriginateTimeout']||0x1e;this[_0x3423('0x32')]=_0x26c566[_0x3423('0x32')]||_0x3423('0x33');this['dialQueueTimeout']=_0x26c566[_0x3423('0x34')]||0x3;this[_0x3423('0x35')]=_0x26c566[_0x3423('0x35')]||undefined;this['dialCongestionMaxRetry']=_0x26c566[_0x3423('0x36')]||0x3;this['dialCongestionRetryFrequency']=_0x26c566['dialCongestionRetryFrequency']||0x96;this[_0x3423('0x37')]=_0x26c566['dialBusyMaxRetry']||0x3;this[_0x3423('0x38')]=_0x26c566[_0x3423('0x38')]||0x96;this[_0x3423('0x39')]=_0x26c566['dialNoAnswerMaxRetry']||0x3;this[_0x3423('0x3a')]=_0x26c566[_0x3423('0x3a')]||0x96;this[_0x3423('0x3b')]=_0x26c566[_0x3423('0x3b')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x26c566[_0x3423('0x3c')]||0x96;this[_0x3423('0x3d')]=_0x26c566[_0x3423('0x3d')]||0x3;this['dialDropRetryFrequency']=_0x26c566[_0x3423('0x3e')]||0x96;this[_0x3423('0x3f')]=_0x26c566[_0x3423('0x3f')]||0x3;this['dialAbandonedRetryFrequency']=_0x26c566[_0x3423('0x40')]||0x96;this[_0x3423('0x41')]=_0x26c566['dialMachineMaxRetry']||0x3;this['dialMachineRetryFrequency']=_0x26c566['dialMachineRetryFrequency']||0x96;this[_0x3423('0x42')]=_0x26c566['dialAgentRejectMaxRetry']||0x3;this[_0x3423('0x43')]=_0x26c566['dialAgentRejectRetryFrequency']||0x96;this['callAdditionalPhoneAfterMin']=_0x26c566[_0x3423('0x44')]||0x3;this[_0x3423('0x45')]=_0x26c566[_0x3423('0x45')]||0x4;this[_0x3423('0x46')]=_0x26c566['Trunk']?_0x26c566['Trunk']:undefined;this['TrunkBackup']=_0x26c566['TrunkBackup']?_0x26c566['TrunkBackup']:undefined;this[_0x3423('0x47')]=_0x26c566[_0x3423('0x47')]||undefined;this['Interval']=_0x26c566[_0x3423('0x48')]?_0x26c566[_0x3423('0x48')]:undefined;this[_0x3423('0x49')]=_0x26c566[_0x3423('0x49')]||_0x3423('0x4a');this[_0x3423('0x4b')]=_0x26c566[_0x3423('0x4b')]||undefined;this[_0x3423('0x4c')]=_0x26c566[_0x3423('0x4c')]||undefined;this[_0x3423('0x4d')]=strategy[_0x26c566[_0x3423('0x4d')]];this['queueStatusComplete']=!![];this['dialAMDActive']=_0x26c566[_0x3423('0x4e')]||![];this[_0x3423('0x4f')]=_0x26c566['dialAMDInitialSilence'];this[_0x3423('0x50')]=_0x26c566[_0x3423('0x50')];this[_0x3423('0x51')]=_0x26c566[_0x3423('0x51')];this[_0x3423('0x52')]=_0x26c566[_0x3423('0x52')];this['dialAMDMinWordLength']=_0x26c566[_0x3423('0x53')];this[_0x3423('0x54')]=_0x26c566['dialAMDBetweenWordsSilence'];this[_0x3423('0x55')]=_0x26c566[_0x3423('0x55')];this[_0x3423('0x56')]=_0x26c566[_0x3423('0x56')];this['dialAMDMaximumWordLength']=_0x26c566[_0x3423('0x57')];this[_0x3423('0x58')]=0x0;this['pTalking']=0x0;this[_0x3423('0x59')]=_0x26c566[_0x3423('0x59')];this[_0x3423('0x5a')]=0x0;this[_0x3423('0x5b')]=0x0;this[_0x3423('0x5c')]=0x0;this[_0x3423('0x5d')]=0x0;this['outboundCongestionCallsDay']=0x0;this[_0x3423('0x5e')]=0x0;this['outboundUnknownCallsDay']=0x0;this['outboundBlacklistCallsDay']=0x0;this[_0x3423('0x5f')]=0x0;this[_0x3423('0x60')]=0x0;this[_0x3423('0x61')]=0x0;this['outboundDropCallsDayACS']=0x0;this[_0x3423('0x62')]=0x0;this[_0x3423('0x63')]=0x0;this[_0x3423('0x64')]=undefined;this[_0x3423('0x65')]=undefined;this[_0x3423('0x66')]=undefined;this[_0x3423('0x67')]=1.05;this[_0x3423('0x68')]=0x0;this[_0x3423('0x69')]=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this[_0x3423('0x6a')]=0x0;this[_0x3423('0x6b')]=0x0;this[_0x3423('0x6c')]=0x0;this[_0x3423('0x6d')]=0x0;this['predictiveIntervalAvailable']=0x0;this[_0x3423('0x6e')]=_0x26c566[_0x3423('0x6f')]||0x14;this['predictiveIntervalMinThreshold']=_0x26c566[_0x3423('0x6f')]||0xa;this[_0x3423('0x70')]=0x0;this[_0x3423('0x71')]=0x0;this[_0x3423('0x72')]=0x1;this[_0x3423('0x73')]=0x0;this[_0x3423('0x74')]=0x0;this[_0x3423('0x75')]=0x0;this[_0x3423('0x76')]=0x0;this['dialRecallMeTimeout']=_0x26c566[_0x3423('0x77')]||0x1e;this['dialRecallInQueue']=_0x26c566[_0x3423('0x78')]||![];this[_0x3423('0x79')]=!!_0x26c566[_0x3423('0x79')]||![];this[_0x3423('0x7a')]=!!_0x26c566['dialPreviewRecallmeReminder']||![];this[_0x3423('0x7b')]=_0x26c566['dialQueueProject2']||undefined;this['dialAgiAfterHangupClient']=_0x26c566[_0x3423('0x7c')]||![];this[_0x3423('0x7d')]=_0x26c566['dialAgiAfterHangupAgent']||![];this[_0x3423('0x8')]=monitorFormat[_0x26c566[_0x3423('0x8')]]?monitorFormat[_0x26c566[_0x3423('0x8')]]:undefined;this['mandatoryDisposition']=_0x26c566[_0x3423('0x7e')]||![];this['mandatoryDispositionPause']=_0x26c566[_0x3423('0x7f')]?_0x26c566[_0x3423('0x7f')]:undefined;this[_0x3423('0x80')]=![];}module[_0x3423('0x81')]=VoiceQueue; \ No newline at end of file +var _0x44e8=['dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','anonymous','dialOriginateTimeout','dialQueueOptions','tTxX','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','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','startProgressive','startPredictive','handlePredictive','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','wav','fewestcalls','leastrecent','linear','random','roundrobin','rrmemory','rrordered','wrandom','name','monitor_format','type','inbound','waiting','total','answered','sumDuration','sumBillable','unmanaged','abandoned','available','busy','inUse','invalid','notInUse','onHold','ringing','ringInUse','unavailable','unknown','acw','acwTimeout','autopause','sendMessageOneNotActive','message','statusMessage','originated','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dropRate','dialPredictiveOptimizationPercentage'];(function(_0x22ff86,_0x4644e8){var _0x1e9b56=function(_0x57b1b9){while(--_0x57b1b9){_0x22ff86['push'](_0x22ff86['shift']());}};_0x1e9b56(++_0x4644e8);}(_0x44e8,0xd7));var _0x844e=function(_0x661446,_0x559ab3){_0x661446=_0x661446-0x0;var _0x109719=_0x44e8[_0x661446];return _0x109719;};'use strict';var monitorFormat={'wav':_0x844e('0x0'),'wav49':'wav49','gsm':'gsm'};var strategy={'fewestcalls':_0x844e('0x1'),'leastrecent':_0x844e('0x2'),'linear':_0x844e('0x3'),'random':_0x844e('0x4'),'ringall':'ringall','rr':_0x844e('0x5'),'rrmemory':_0x844e('0x6'),'rrordered':_0x844e('0x7'),'wrandom':_0x844e('0x8')};function VoiceQueue(_0x5c8f67){this['id']=_0x5c8f67['id']||0x0;this[_0x844e('0x9')]=_0x5c8f67[_0x844e('0x9')]||'';this[_0x844e('0xa')]=_0x5c8f67[_0x844e('0xa')]||'';this['type']=_0x5c8f67[_0x844e('0xb')]||_0x844e('0xc');this[_0x844e('0xd')]=0x0;this[_0x844e('0xe')]=0x0;this[_0x844e('0xf')]=0x0;this[_0x844e('0x10')]=0x0;this['sumHoldTime']=0x0;this[_0x844e('0x11')]=0x0;this[_0x844e('0x12')]=0x0;this[_0x844e('0x13')]=0x0;this[_0x844e('0x14')]=0x0;this[_0x844e('0x15')]=0x0;this[_0x844e('0x16')]=0x0;this[_0x844e('0x17')]=0x0;this['loggedIn']=0x0;this[_0x844e('0x18')]=0x0;this[_0x844e('0x19')]=0x0;this['paused']=0x0;this[_0x844e('0x1a')]=0x0;this[_0x844e('0x1b')]=0x0;this['talking']=0x0;this[_0x844e('0x1c')]=0x0;this[_0x844e('0x1d')]=0x0;this[_0x844e('0x1e')]=_0x5c8f67['acw']||![];this[_0x844e('0x1f')]=_0x5c8f67[_0x844e('0x1f')]||0xa;this[_0x844e('0x20')]=_0x5c8f67[_0x844e('0x20')]||'no';this[_0x844e('0x21')]=!![];this[_0x844e('0x22')]='';this[_0x844e('0x23')]='';this[_0x844e('0x24')]=0x0;this['temp']=0x0;this[_0x844e('0x25')]=_0x5c8f67['dialTimezone']||null;this[_0x844e('0x26')]=_0x5c8f67['dialGlobalInterval']?_0x5c8f67[_0x844e('0x26')]:null;this['dialActive']=_0x5c8f67[_0x844e('0x27')];this[_0x844e('0x28')]=_0x5c8f67[_0x844e('0x28')]||_0x844e('0x29');this[_0x844e('0x2a')]=_0x5c8f67[_0x844e('0x2a')]||0x0;this[_0x844e('0x2b')]=_0x5c8f67[_0x844e('0x2b')]||0x0;this['dialPowerLevel']=_0x5c8f67[_0x844e('0x2c')]||0x1;this['dialPredictiveOptimization']=_0x5c8f67['dialPredictiveOptimization']||_0x844e('0x2d');this[_0x844e('0x2e')]=_0x5c8f67[_0x844e('0x2e')]||0.03;this[_0x844e('0x2f')]=_0x5c8f67['dialPredictiveInterval']||0x258;this[_0x844e('0x30')]=_0x5c8f67[_0x844e('0x30')]||'anonymous';this[_0x844e('0x31')]=_0x5c8f67[_0x844e('0x31')]||_0x844e('0x32');this[_0x844e('0x33')]=_0x5c8f67[_0x844e('0x33')]||0x1e;this[_0x844e('0x34')]=_0x5c8f67['dialQueueOptions']||_0x844e('0x35');this[_0x844e('0x36')]=_0x5c8f67[_0x844e('0x36')]||0x3;this[_0x844e('0x37')]=_0x5c8f67[_0x844e('0x37')]||undefined;this['dialCongestionMaxRetry']=_0x5c8f67[_0x844e('0x38')]||0x3;this['dialCongestionRetryFrequency']=_0x5c8f67['dialCongestionRetryFrequency']||0x96;this[_0x844e('0x39')]=_0x5c8f67[_0x844e('0x39')]||0x3;this[_0x844e('0x3a')]=_0x5c8f67['dialBusyRetryFrequency']||0x96;this[_0x844e('0x3b')]=_0x5c8f67[_0x844e('0x3b')]||0x3;this[_0x844e('0x3c')]=_0x5c8f67['dialNoAnswerRetryFrequency']||0x96;this[_0x844e('0x3d')]=_0x5c8f67[_0x844e('0x3d')]||0x3;this[_0x844e('0x3e')]=_0x5c8f67[_0x844e('0x3e')]||0x96;this[_0x844e('0x3f')]=_0x5c8f67[_0x844e('0x3f')]||0x3;this[_0x844e('0x40')]=_0x5c8f67[_0x844e('0x40')]||0x96;this[_0x844e('0x41')]=_0x5c8f67[_0x844e('0x41')]||0x3;this['dialAbandonedRetryFrequency']=_0x5c8f67[_0x844e('0x42')]||0x96;this[_0x844e('0x43')]=_0x5c8f67[_0x844e('0x43')]||0x3;this[_0x844e('0x44')]=_0x5c8f67[_0x844e('0x44')]||0x96;this[_0x844e('0x45')]=_0x5c8f67[_0x844e('0x45')]||0x3;this['dialAgentRejectRetryFrequency']=_0x5c8f67[_0x844e('0x46')]||0x96;this[_0x844e('0x47')]=_0x5c8f67[_0x844e('0x47')]||0x3;this['dialGlobalMaxRetry']=_0x5c8f67[_0x844e('0x48')]||0x4;this[_0x844e('0x49')]=_0x5c8f67['Trunk']?_0x5c8f67[_0x844e('0x49')]:undefined;this[_0x844e('0x4a')]=_0x5c8f67['TrunkBackup']?_0x5c8f67[_0x844e('0x4a')]:undefined;this[_0x844e('0x4b')]=_0x5c8f67[_0x844e('0x4b')]||undefined;this[_0x844e('0x4c')]=_0x5c8f67[_0x844e('0x4c')]?_0x5c8f67[_0x844e('0x4c')]:undefined;this[_0x844e('0x4d')]=_0x5c8f67['dialOrderByScheduledAt']||_0x844e('0x4e');this[_0x844e('0x4f')]=_0x5c8f67[_0x844e('0x4f')]||undefined;this[_0x844e('0x50')]=_0x5c8f67[_0x844e('0x50')]||undefined;this[_0x844e('0x51')]=strategy[_0x5c8f67[_0x844e('0x51')]];this[_0x844e('0x52')]=!![];this[_0x844e('0x53')]=_0x5c8f67[_0x844e('0x53')]||![];this[_0x844e('0x54')]=_0x5c8f67['dialAMDInitialSilence'];this['dialAMDGreeting']=_0x5c8f67[_0x844e('0x55')];this[_0x844e('0x56')]=_0x5c8f67[_0x844e('0x56')];this[_0x844e('0x57')]=_0x5c8f67[_0x844e('0x57')];this[_0x844e('0x58')]=_0x5c8f67[_0x844e('0x58')];this[_0x844e('0x59')]=_0x5c8f67[_0x844e('0x59')];this['dialAMDMaximumNumberOfWords']=_0x5c8f67[_0x844e('0x5a')];this['dialAMDSilenceThreshold']=_0x5c8f67[_0x844e('0x5b')];this['dialAMDMaximumWordLength']=_0x5c8f67[_0x844e('0x5c')];this['outboundRejectCallsDay']=0x0;this[_0x844e('0x5d')]=0x0;this[_0x844e('0x5e')]=_0x5c8f67[_0x844e('0x5e')];this[_0x844e('0x5f')]=0x0;this[_0x844e('0x60')]=0x0;this[_0x844e('0x61')]=0x0;this[_0x844e('0x62')]=0x0;this[_0x844e('0x63')]=0x0;this[_0x844e('0x64')]=0x0;this[_0x844e('0x65')]=0x0;this[_0x844e('0x66')]=0x0;this['outboundOriginateFailureCallsDay']=0x0;this[_0x844e('0x67')]=0x0;this[_0x844e('0x68')]=0x0;this[_0x844e('0x69')]=0x0;this['outboundReCallsDay']=0x0;this['outboundAbandonedDay']=0x0;this[_0x844e('0x6a')]=undefined;this[_0x844e('0x6b')]=undefined;this[_0x844e('0x6c')]=undefined;this['predictiveIntervalMultiplicativeFactor']=1.05;this['predictiveIntervalTotalCalls']=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this[_0x844e('0x6d')]=0x0;this[_0x844e('0x6e')]=0x0;this[_0x844e('0x6f')]=0x0;this[_0x844e('0x70')]=0x0;this[_0x844e('0x71')]=0x0;this['predictiveIntervalMaxThreshold']=_0x5c8f67[_0x844e('0x72')]||0x14;this['predictiveIntervalMinThreshold']=_0x5c8f67['dialPredictiveIntervalMaxThreshold']||0xa;this[_0x844e('0x73')]=0x0;this[_0x844e('0x74')]=0x0;this[_0x844e('0x75')]=0x1;this[_0x844e('0x76')]=0x0;this['erlangCallToSecond']=0x0;this[_0x844e('0x77')]=0x0;this[_0x844e('0x78')]=0x0;this[_0x844e('0x79')]=_0x5c8f67['dialRecallMeTimeout']||0x1e;this[_0x844e('0x7a')]=_0x5c8f67[_0x844e('0x7a')]||![];this['dialPreviewAutoRecallMe']=!!_0x5c8f67[_0x844e('0x7b')]||![];this[_0x844e('0x7c')]=!!_0x5c8f67[_0x844e('0x7c')]||![];this[_0x844e('0x7d')]=_0x5c8f67[_0x844e('0x7d')]||undefined;this[_0x844e('0x7e')]=_0x5c8f67['dialAgiAfterHangupClient']||![];this[_0x844e('0x7f')]=_0x5c8f67[_0x844e('0x7f')]||![];this[_0x844e('0xa')]=monitorFormat[_0x5c8f67[_0x844e('0xa')]]?monitorFormat[_0x5c8f67[_0x844e('0xa')]]:undefined;this[_0x844e('0x80')]=_0x5c8f67[_0x844e('0x80')]||![];this[_0x844e('0x81')]=_0x5c8f67[_0x844e('0x81')]?_0x5c8f67[_0x844e('0x81')]:undefined;this['queueSummaryCountersUpdated']=![];}module[_0x844e('0x82')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueueSummary.js b/server/services/ami/model/voiceQueueSummary.js index 0a01eb3..b067a31 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 _0x7a2d=['type','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','name','active','callerid','prototype','loggedin','callers','length','SIP/','status','keys','queue','dialer','exten','xcally-motion-preview','some','compareToOutboundQueue','updateReportFromOutboundQueue','outboundAbandonedCallsDay','preview','exports','available','loggedIn','loggedInDb','paused','ringing','talking','waiting','inUse','originated','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','pTalking','sumBillable','sumDuration','total','strategy','abandoned','answered','busy','invalid','onHold','notInUse','ringInUse','sumHoldTime','unavailable','unknown','unmanaged'];(function(_0x4c275f,_0x5654bf){var _0x324221=function(_0x31d9f0){while(--_0x31d9f0){_0x4c275f['push'](_0x4c275f['shift']());}};_0x324221(++_0x5654bf);}(_0x7a2d,0x142));var _0xd7a2=function(_0x3f6b0f,_0x5150fc){_0x3f6b0f=_0x3f6b0f-0x0;var _0x472e36=_0x7a2d[_0x3f6b0f];return _0x472e36;};'use strict';var INBOUND_COUNTERS=[_0xd7a2('0x0'),_0xd7a2('0x1'),_0xd7a2('0x2'),_0xd7a2('0x3'),_0xd7a2('0x4'),_0xd7a2('0x5'),_0xd7a2('0x6')];var OUTBOUND_COUNTERS=['available','answered',_0xd7a2('0x7'),_0xd7a2('0x1'),_0xd7a2('0x2'),_0xd7a2('0x8'),'outboundAbandonedCallsDay',_0xd7a2('0x9'),_0xd7a2('0xa'),_0xd7a2('0xb'),_0xd7a2('0xc'),_0xd7a2('0xd'),_0xd7a2('0xe'),_0xd7a2('0xf'),_0xd7a2('0x10'),_0xd7a2('0x11'),'paused',_0xd7a2('0x12'),_0xd7a2('0x5'),_0xd7a2('0x13'),_0xd7a2('0x14'),_0xd7a2('0x15'),_0xd7a2('0x6')];function VoiceQueueSummary(_0xe2feee){this['id']=_0xe2feee['id'];this['name']=_0xe2feee['name'];this[_0xd7a2('0x16')]=_0xe2feee['strategy'];this[_0xd7a2('0x17')]=_0xe2feee[_0xd7a2('0x17')]||0x0;this[_0xd7a2('0x18')]=_0xe2feee[_0xd7a2('0x18')]||0x0;this[_0xd7a2('0x0')]=_0xe2feee[_0xd7a2('0x0')]||0x0;this[_0xd7a2('0x19')]=_0xe2feee[_0xd7a2('0x19')]||0x0;this[_0xd7a2('0x7')]=_0xe2feee[_0xd7a2('0x7')]||0x0;this[_0xd7a2('0x1a')]=_0xe2feee['invalid']||0x0;this[_0xd7a2('0x1')]=_0xe2feee['loggedIn']||0x0;this['loggedInDb']=_0xe2feee[_0xd7a2('0x2')]||0x0;this[_0xd7a2('0x1b')]=_0xe2feee[_0xd7a2('0x1b')]||0x0;this[_0xd7a2('0x1c')]=_0xe2feee[_0xd7a2('0x1c')]||0x0;this[_0xd7a2('0x3')]=_0xe2feee['paused']||0x0;this['ringing']=_0xe2feee[_0xd7a2('0x4')]||0x0;this[_0xd7a2('0x1d')]=_0xe2feee[_0xd7a2('0x1d')];this['sumBillable']=_0xe2feee['sumBillable'];this[_0xd7a2('0x14')]=_0xe2feee['sumDuration'];this['sumHoldTime']=_0xe2feee[_0xd7a2('0x1e')]||0x0;this['talking']=_0xe2feee['talking']||0x0;this[_0xd7a2('0x15')]=_0xe2feee['total']||0x0;this['type']=_0xe2feee['type'];this[_0xd7a2('0x1f')]=_0xe2feee[_0xd7a2('0x1f')]||0x0;this[_0xd7a2('0x20')]=_0xe2feee[_0xd7a2('0x20')]||0x0;this[_0xd7a2('0x21')]=_0xe2feee[_0xd7a2('0x21')]||0x0;this[_0xd7a2('0x6')]=_0xe2feee[_0xd7a2('0x6')]||0x0;if(_0xe2feee[_0xd7a2('0x22')]===_0xd7a2('0x23')){this[_0xd7a2('0x12')]=_0xe2feee[_0xd7a2('0x12')]||0x0;this[_0xd7a2('0x24')]=_0xe2feee['dialActive'];this['dialMethod']=_0xe2feee[_0xd7a2('0x25')];this['dialOriginateCallerIdName']=_0xe2feee[_0xd7a2('0x26')];this['dialOriginateCallerIdNumber']=_0xe2feee[_0xd7a2('0x27')];this[_0xd7a2('0x28')]=_0xe2feee[_0xd7a2('0x28')];this[_0xd7a2('0x29')]=_0xe2feee[_0xd7a2('0x29')];this[_0xd7a2('0x2a')]=_0xe2feee[_0xd7a2('0x2a')];this[_0xd7a2('0x2b')]=_0xe2feee[_0xd7a2('0x2b')];this[_0xd7a2('0x9')]=_0xe2feee[_0xd7a2('0x9')];this[_0xd7a2('0xa')]=_0xe2feee[_0xd7a2('0xa')];this[_0xd7a2('0xb')]=_0xe2feee[_0xd7a2('0xb')];this['outboundCongestionCallsDay']=_0xe2feee[_0xd7a2('0xc')];this[_0xd7a2('0x2c')]=_0xe2feee['outboundDropCallsDayACS'];this[_0xd7a2('0x2d')]=_0xe2feee[_0xd7a2('0x2d')];this['outboundDropCallsDayTimeout']=_0xe2feee[_0xd7a2('0x2e')];this[_0xd7a2('0xd')]=_0xe2feee[_0xd7a2('0xd')];this['outboundNoSuchCallsDay']=_0xe2feee[_0xd7a2('0xe')];this[_0xd7a2('0x2f')]=_0xe2feee[_0xd7a2('0x2f')];this['outboundReCallsDay']=_0xe2feee[_0xd7a2('0xf')];this['outboundRejectCallsDay']=_0xe2feee[_0xd7a2('0x10')];this[_0xd7a2('0x11')]=_0xe2feee[_0xd7a2('0x11')];this[_0xd7a2('0x30')]=_0xe2feee['predictiveIntervalAnsweredCalls'];this[_0xd7a2('0x31')]=_0xe2feee[_0xd7a2('0x31')];this[_0xd7a2('0x32')]=_0xe2feee[_0xd7a2('0x32')];this['predictiveIntervalDroppedCallsCallersExit']=_0xe2feee[_0xd7a2('0x33')];this[_0xd7a2('0x34')]=_0xe2feee[_0xd7a2('0x34')];this[_0xd7a2('0x35')]=_0xe2feee[_0xd7a2('0x35')];this[_0xd7a2('0x36')]=_0xe2feee[_0xd7a2('0x36')];this[_0xd7a2('0x37')]=_0xe2feee[_0xd7a2('0x37')];this['predictiveIntervalMultiplicativeFactor']=_0xe2feee[_0xd7a2('0x38')];this[_0xd7a2('0x39')]=_0xe2feee[_0xd7a2('0x39')];this[_0xd7a2('0x3a')]=_0xe2feee['predictiveIntervalAvailable'];this['predictiveIntervalTotalCalls']=_0xe2feee[_0xd7a2('0x3b')];this['originated']=_0xe2feee[_0xd7a2('0x8')];this[_0xd7a2('0x3c')]=_0xe2feee['erlangCalls'];this[_0xd7a2('0x3d')]=_0xe2feee[_0xd7a2('0x3d')];this[_0xd7a2('0x3e')]=_0xe2feee[_0xd7a2('0x3e')];this[_0xd7a2('0x3f')]=_0xe2feee[_0xd7a2('0x3f')];this[_0xd7a2('0x40')]=_0xe2feee['startPredictive'];this['startProgressive']=_0xe2feee[_0xd7a2('0x41')];this[_0xd7a2('0x42')]=_0xe2feee['message'];this[_0xd7a2('0x43')]=_0xe2feee[_0xd7a2('0x43')];}if(_0xe2feee[_0xd7a2('0x44')]){this[_0xd7a2('0x44')]={'id':_0xe2feee[_0xd7a2('0x44')]['id'],'name':_0xe2feee[_0xd7a2('0x44')][_0xd7a2('0x45')],'active':_0xe2feee[_0xd7a2('0x44')][_0xd7a2('0x46')],'callerid':_0xe2feee['Trunk'][_0xd7a2('0x47')]};}}VoiceQueueSummary[_0xd7a2('0x48')]['createReport']=function(_0x509e00,_0x5c86bd,_0xa77a40,_0x305a63){this[_0xd7a2('0x2')]=0x0;this[_0xd7a2('0x5')]=0x0;this[_0xd7a2('0x3')]=0x0;this['unknown']=0x0;this['notInUse']=0x0;this[_0xd7a2('0x7')]=0x0;this[_0xd7a2('0x19')]=0x0;this[_0xd7a2('0x1a')]=0x0;this[_0xd7a2('0x1f')]=0x0;this['ringing']=0x0;this[_0xd7a2('0x1d')]=0x0;this[_0xd7a2('0x1b')]=0x0;if(_0xa77a40){if(_0xa77a40[_0xd7a2('0x0')]){this[_0xd7a2('0x0')]=Number(_0xa77a40['available']);}if(_0xa77a40[_0xd7a2('0x49')]){this[_0xd7a2('0x1')]=Number(_0xa77a40['loggedin']);}if(_0xa77a40['callers']){this['waiting']=Number(_0xa77a40[_0xd7a2('0x4a')]);}}for(var _0x1b8416=0x0;_0x1b8416<_0x509e00[_0xd7a2('0x4b')];_0x1b8416++){var _0x287426=_0x5c86bd[_0xd7a2('0x4c')+_0x509e00[_0x1b8416][_0xd7a2('0x45')]];if(_0x287426&&_0x287426['online']){this[_0xd7a2('0x2')]+=0x1;}if(_0x509e00[_0x1b8416]['incall']==='1'){this[_0xd7a2('0x5')]+=0x1;}if(_0x509e00[_0x1b8416][_0xd7a2('0x3')]==='1'&&!['2','7','8']['includes'](_0x509e00[_0x1b8416][_0xd7a2('0x4d')])){this[_0xd7a2('0x3')]+=0x1;}switch(_0x509e00[_0x1b8416][_0xd7a2('0x4d')]){case'0':this['unknown']+=0x1;break;case'1':this[_0xd7a2('0x1c')]+=0x1;break;case'2':this[_0xd7a2('0x7')]+=0x1;break;case'3':this[_0xd7a2('0x19')]+=0x1;break;case'4':this[_0xd7a2('0x1a')]+=0x1;break;case'5':this[_0xd7a2('0x1f')]+=0x1;break;case'6':this[_0xd7a2('0x4')]+=0x1;break;case'7':this[_0xd7a2('0x1d')]+=0x1;break;case'8':this[_0xd7a2('0x1b')]+=0x1;break;}}if(this['dialMethod']==='booked'){var _0x3c5c54=Object[_0xd7a2('0x4e')](_0x305a63);for(var _0x5a282c=0x0;_0x5a282c<_0x3c5c54[_0xd7a2('0x4b')];_0x5a282c++){var _0x4cbf90=_0x3c5c54[_0x5a282c];var _0x4382d6=_0x305a63[_0x4cbf90];if(_0x4382d6[_0xd7a2('0x4f')]===this[_0xd7a2('0x45')]&&_0x4382d6[_0xd7a2('0x22')]===_0xd7a2('0x50')&&_0x4382d6[_0xd7a2('0x51')]===_0xd7a2('0x52')){this['talking']+=0x1;}}if(this[_0xd7a2('0x5')]>this[_0xd7a2('0x7')]){this['talking']=this[_0xd7a2('0x7')];}this['pTalking']=0x0;}return this;};VoiceQueueSummary[_0xd7a2('0x48')]['compareToInboundQueue']=function(_0x357ce0){var _0xc420a8=![];if(_0x357ce0){_0xc420a8=INBOUND_COUNTERS[_0xd7a2('0x53')](function(_0x89824d){return this[_0x89824d]!==_0x357ce0[_0x89824d];},this);}return _0xc420a8;};VoiceQueueSummary[_0xd7a2('0x48')][_0xd7a2('0x54')]=function(_0x213f6e){var _0x2d9d5d=![];var _0x1bb573=![];var _0x2f3ec5=![];if(_0x213f6e){_0x2d9d5d=this[_0xd7a2('0x25')]!==_0x213f6e[_0xd7a2('0x25')]||this[_0xd7a2('0x24')]!==_0x213f6e[_0xd7a2('0x24')]||this[_0xd7a2('0x42')]!==_0x213f6e[_0xd7a2('0x42')]||this['statusMessage']!==_0x213f6e['statusMessage'];_0x1bb573=OUTBOUND_COUNTERS[_0xd7a2('0x53')](function(_0x466c30){return this[_0x466c30]!==_0x213f6e[_0x466c30];},this);if(this[_0xd7a2('0x44')]&&_0x213f6e[_0xd7a2('0x44')]){_0x2f3ec5=this[_0xd7a2('0x44')][_0xd7a2('0x45')]!==_0x213f6e[_0xd7a2('0x44')][_0xd7a2('0x45')]||this[_0xd7a2('0x44')][_0xd7a2('0x46')]!==_0x213f6e[_0xd7a2('0x44')]['active'];}}return _0x2d9d5d||_0x1bb573||_0x2f3ec5;};VoiceQueueSummary[_0xd7a2('0x48')][_0xd7a2('0x55')]=function(_0x28751e){this[_0xd7a2('0x18')]=_0x28751e[_0xd7a2('0x18')];this['message']=_0x28751e[_0xd7a2('0x42')];this[_0xd7a2('0x43')]=_0x28751e[_0xd7a2('0x43')];this['originated']=_0x28751e['originated'];this['outboundAbandonedCallsDay']=_0x28751e[_0xd7a2('0x56')];this[_0xd7a2('0x9')]=_0x28751e[_0xd7a2('0x9')];this['outboundBlacklistCallsDay']=_0x28751e[_0xd7a2('0xa')];this['outboundBusyCallsDay']=_0x28751e[_0xd7a2('0xb')];this['outboundCongestionCallsDay']=_0x28751e[_0xd7a2('0xc')];this[_0xd7a2('0xd')]=_0x28751e[_0xd7a2('0xd')];this[_0xd7a2('0xe')]=_0x28751e['outboundNoSuchCallsDay'];this[_0xd7a2('0xf')]=_0x28751e[_0xd7a2('0xf')];this['outboundRejectCallsDay']=_0x28751e['outboundRejectCallsDay'];this['outboundUnknownCallsDay']=_0x28751e[_0xd7a2('0x11')];this[_0xd7a2('0x13')]=_0x28751e[_0xd7a2('0x13')];this['sumDuration']=_0x28751e[_0xd7a2('0x14')];this[_0xd7a2('0x15')]=_0x28751e[_0xd7a2('0x15')];if(this[_0xd7a2('0x25')]===_0xd7a2('0x57')){this[_0xd7a2('0x12')]=_0x28751e[_0xd7a2('0x12')];}};module[_0xd7a2('0x58')]=VoiceQueueSummary; \ No newline at end of file +var _0x7dfd=['booked','keys','queue','exten','xcally-motion-preview','compareToInboundQueue','some','active','updateReportFromOutboundQueue','preview','available','loggedIn','loggedInDb','paused','ringing','talking','waiting','answered','inUse','originated','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','sumDuration','total','name','strategy','abandoned','busy','invalid','onHold','notInUse','ringInUse','sumBillable','sumHoldTime','type','unavailable','unknown','unmanaged','outbound','pTalking','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','callerid','prototype','loggedin','callers','length','SIP/','online','includes','status'];(function(_0x4d8ed9,_0x2ae284){var _0x1e2140=function(_0x9cca89){while(--_0x9cca89){_0x4d8ed9['push'](_0x4d8ed9['shift']());}};_0x1e2140(++_0x2ae284);}(_0x7dfd,0x1c2));var _0xd7df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7dfd[_0x3dd15e];return _0x231fd0;};'use strict';var INBOUND_COUNTERS=[_0xd7df('0x0'),_0xd7df('0x1'),_0xd7df('0x2'),_0xd7df('0x3'),_0xd7df('0x4'),_0xd7df('0x5'),_0xd7df('0x6')];var OUTBOUND_COUNTERS=[_0xd7df('0x0'),_0xd7df('0x7'),_0xd7df('0x8'),_0xd7df('0x1'),_0xd7df('0x2'),_0xd7df('0x9'),_0xd7df('0xa'),_0xd7df('0xb'),_0xd7df('0xc'),_0xd7df('0xd'),'outboundCongestionCallsDay',_0xd7df('0xe'),_0xd7df('0xf'),_0xd7df('0x10'),_0xd7df('0x11'),'outboundUnknownCallsDay',_0xd7df('0x3'),'pTalking',_0xd7df('0x5'),'sumBillable',_0xd7df('0x12'),_0xd7df('0x13'),_0xd7df('0x6')];function VoiceQueueSummary(_0x18d8f8){this['id']=_0x18d8f8['id'];this[_0xd7df('0x14')]=_0x18d8f8[_0xd7df('0x14')];this[_0xd7df('0x15')]=_0x18d8f8[_0xd7df('0x15')];this[_0xd7df('0x16')]=_0x18d8f8[_0xd7df('0x16')]||0x0;this[_0xd7df('0x7')]=_0x18d8f8[_0xd7df('0x7')]||0x0;this[_0xd7df('0x0')]=_0x18d8f8[_0xd7df('0x0')]||0x0;this[_0xd7df('0x17')]=_0x18d8f8[_0xd7df('0x17')]||0x0;this[_0xd7df('0x8')]=_0x18d8f8['inUse']||0x0;this[_0xd7df('0x18')]=_0x18d8f8[_0xd7df('0x18')]||0x0;this['loggedIn']=_0x18d8f8[_0xd7df('0x1')]||0x0;this[_0xd7df('0x2')]=_0x18d8f8['loggedInDb']||0x0;this[_0xd7df('0x19')]=_0x18d8f8[_0xd7df('0x19')]||0x0;this[_0xd7df('0x1a')]=_0x18d8f8['notInUse']||0x0;this[_0xd7df('0x3')]=_0x18d8f8[_0xd7df('0x3')]||0x0;this[_0xd7df('0x4')]=_0x18d8f8['ringing']||0x0;this[_0xd7df('0x1b')]=_0x18d8f8[_0xd7df('0x1b')];this[_0xd7df('0x1c')]=_0x18d8f8['sumBillable'];this[_0xd7df('0x12')]=_0x18d8f8['sumDuration'];this[_0xd7df('0x1d')]=_0x18d8f8['sumHoldTime']||0x0;this[_0xd7df('0x5')]=_0x18d8f8[_0xd7df('0x5')]||0x0;this[_0xd7df('0x13')]=_0x18d8f8['total']||0x0;this[_0xd7df('0x1e')]=_0x18d8f8['type'];this[_0xd7df('0x1f')]=_0x18d8f8[_0xd7df('0x1f')]||0x0;this[_0xd7df('0x20')]=_0x18d8f8[_0xd7df('0x20')]||0x0;this[_0xd7df('0x21')]=_0x18d8f8[_0xd7df('0x21')]||0x0;this[_0xd7df('0x6')]=_0x18d8f8['waiting']||0x0;if(_0x18d8f8['type']===_0xd7df('0x22')){this[_0xd7df('0x23')]=_0x18d8f8[_0xd7df('0x23')]||0x0;this[_0xd7df('0x24')]=_0x18d8f8[_0xd7df('0x24')];this[_0xd7df('0x25')]=_0x18d8f8[_0xd7df('0x25')];this[_0xd7df('0x26')]=_0x18d8f8[_0xd7df('0x26')];this['dialOriginateCallerIdNumber']=_0x18d8f8[_0xd7df('0x27')];this[_0xd7df('0x28')]=_0x18d8f8[_0xd7df('0x28')];this[_0xd7df('0x29')]=_0x18d8f8[_0xd7df('0x29')];this[_0xd7df('0x2a')]=_0x18d8f8[_0xd7df('0x2a')];this[_0xd7df('0x2b')]=_0x18d8f8['outboundAnswerAgiCallsDay'];this['outboundAnswerCallsDay']=_0x18d8f8['outboundAnswerCallsDay'];this['outboundBlacklistCallsDay']=_0x18d8f8['outboundBlacklistCallsDay'];this[_0xd7df('0xd')]=_0x18d8f8['outboundBusyCallsDay'];this[_0xd7df('0x2c')]=_0x18d8f8[_0xd7df('0x2c')];this['outboundDropCallsDayACS']=_0x18d8f8[_0xd7df('0x2d')];this[_0xd7df('0x2e')]=_0x18d8f8['outboundDropCallsDayCallersExit'];this[_0xd7df('0x2f')]=_0x18d8f8[_0xd7df('0x2f')];this[_0xd7df('0xe')]=_0x18d8f8[_0xd7df('0xe')];this[_0xd7df('0xf')]=_0x18d8f8[_0xd7df('0xf')];this['outboundOriginateFailureCallsDay']=_0x18d8f8[_0xd7df('0x30')];this[_0xd7df('0x10')]=_0x18d8f8[_0xd7df('0x10')];this[_0xd7df('0x11')]=_0x18d8f8[_0xd7df('0x11')];this[_0xd7df('0x31')]=_0x18d8f8[_0xd7df('0x31')];this[_0xd7df('0x32')]=_0x18d8f8[_0xd7df('0x32')];this[_0xd7df('0x33')]=_0x18d8f8[_0xd7df('0x33')];this['predictiveIntervalAvgTalktime']=_0x18d8f8['predictiveIntervalAvgTalktime'];this[_0xd7df('0x34')]=_0x18d8f8['predictiveIntervalDroppedCallsCallersExit'];this[_0xd7df('0x35')]=_0x18d8f8[_0xd7df('0x35')];this[_0xd7df('0x36')]=_0x18d8f8[_0xd7df('0x36')];this['predictiveIntervalErlangCallsDroppedCalls']=_0x18d8f8['predictiveIntervalErlangCallsDroppedCalls'];this['predictiveIntervalHitRate']=_0x18d8f8[_0xd7df('0x37')];this[_0xd7df('0x38')]=_0x18d8f8['predictiveIntervalMultiplicativeFactor'];this[_0xd7df('0x39')]=_0x18d8f8[_0xd7df('0x39')];this[_0xd7df('0x3a')]=_0x18d8f8[_0xd7df('0x3a')];this['predictiveIntervalTotalCalls']=_0x18d8f8[_0xd7df('0x3b')];this[_0xd7df('0x9')]=_0x18d8f8['originated'];this[_0xd7df('0x3c')]=_0x18d8f8['erlangCalls'];this[_0xd7df('0x3d')]=_0x18d8f8[_0xd7df('0x3d')];this[_0xd7df('0x3e')]=_0x18d8f8['erlangAbandonmentRate'];this[_0xd7df('0x3f')]=_0x18d8f8[_0xd7df('0x3f')];this[_0xd7df('0x40')]=_0x18d8f8[_0xd7df('0x40')];this['startProgressive']=_0x18d8f8[_0xd7df('0x41')];this[_0xd7df('0x42')]=_0x18d8f8[_0xd7df('0x42')];this['statusMessage']=_0x18d8f8[_0xd7df('0x43')];}if(_0x18d8f8[_0xd7df('0x44')]){this[_0xd7df('0x44')]={'id':_0x18d8f8['Trunk']['id'],'name':_0x18d8f8[_0xd7df('0x44')][_0xd7df('0x14')],'active':_0x18d8f8['Trunk']['active'],'callerid':_0x18d8f8[_0xd7df('0x44')][_0xd7df('0x45')]};}}VoiceQueueSummary[_0xd7df('0x46')]['createReport']=function(_0x5e8cd0,_0x2c149e,_0x4ebdbe,_0xe606f4){this['loggedInDb']=0x0;this['talking']=0x0;this[_0xd7df('0x3')]=0x0;this['unknown']=0x0;this[_0xd7df('0x1a')]=0x0;this[_0xd7df('0x8')]=0x0;this[_0xd7df('0x17')]=0x0;this[_0xd7df('0x18')]=0x0;this[_0xd7df('0x1f')]=0x0;this[_0xd7df('0x4')]=0x0;this[_0xd7df('0x1b')]=0x0;this[_0xd7df('0x19')]=0x0;if(_0x4ebdbe){if(_0x4ebdbe[_0xd7df('0x0')]){this['available']=Number(_0x4ebdbe[_0xd7df('0x0')]);}if(_0x4ebdbe['loggedin']){this[_0xd7df('0x1')]=Number(_0x4ebdbe[_0xd7df('0x47')]);}if(_0x4ebdbe[_0xd7df('0x48')]){this[_0xd7df('0x6')]=Number(_0x4ebdbe[_0xd7df('0x48')]);}}for(var _0x145223=0x0;_0x145223<_0x5e8cd0[_0xd7df('0x49')];_0x145223++){var _0x38056b=_0x2c149e[_0xd7df('0x4a')+_0x5e8cd0[_0x145223]['name']];if(_0x38056b&&_0x38056b[_0xd7df('0x4b')]){this[_0xd7df('0x2')]+=0x1;}if(_0x5e8cd0[_0x145223]['incall']==='1'){this['talking']+=0x1;}if(_0x5e8cd0[_0x145223][_0xd7df('0x3')]==='1'&&!['2','7','8'][_0xd7df('0x4c')](_0x5e8cd0[_0x145223][_0xd7df('0x4d')])){this['paused']+=0x1;}switch(_0x5e8cd0[_0x145223]['status']){case'0':this[_0xd7df('0x20')]+=0x1;break;case'1':this['notInUse']+=0x1;break;case'2':this[_0xd7df('0x8')]+=0x1;break;case'3':this[_0xd7df('0x17')]+=0x1;break;case'4':this[_0xd7df('0x18')]+=0x1;break;case'5':this[_0xd7df('0x1f')]+=0x1;break;case'6':this[_0xd7df('0x4')]+=0x1;break;case'7':this[_0xd7df('0x1b')]+=0x1;break;case'8':this[_0xd7df('0x19')]+=0x1;break;}}if(this[_0xd7df('0x25')]===_0xd7df('0x4e')){var _0x319204=Object[_0xd7df('0x4f')](_0xe606f4);for(var _0x3a7c84=0x0;_0x3a7c84<_0x319204['length'];_0x3a7c84++){var _0x1f2f99=_0x319204[_0x3a7c84];var _0x43de77=_0xe606f4[_0x1f2f99];if(_0x43de77[_0xd7df('0x50')]===this[_0xd7df('0x14')]&&_0x43de77[_0xd7df('0x1e')]==='dialer'&&_0x43de77[_0xd7df('0x51')]===_0xd7df('0x52')){this[_0xd7df('0x5')]+=0x1;}}if(this['talking']>this[_0xd7df('0x8')]){this['talking']=this[_0xd7df('0x8')];}this[_0xd7df('0x23')]=0x0;}return this;};VoiceQueueSummary[_0xd7df('0x46')][_0xd7df('0x53')]=function(_0xc4a51b){var _0x4c5820=![];if(_0xc4a51b){_0x4c5820=INBOUND_COUNTERS['some'](function(_0x53ec02){return this[_0x53ec02]!==_0xc4a51b[_0x53ec02];},this);}return _0x4c5820;};VoiceQueueSummary[_0xd7df('0x46')]['compareToOutboundQueue']=function(_0x12c2b8){var _0x1ed688=![];var _0x32cdfa=![];var _0xdf3046=![];if(_0x12c2b8){_0x1ed688=this[_0xd7df('0x25')]!==_0x12c2b8[_0xd7df('0x25')]||this[_0xd7df('0x24')]!==_0x12c2b8[_0xd7df('0x24')]||this[_0xd7df('0x42')]!==_0x12c2b8[_0xd7df('0x42')]||this[_0xd7df('0x43')]!==_0x12c2b8[_0xd7df('0x43')];_0x32cdfa=OUTBOUND_COUNTERS[_0xd7df('0x54')](function(_0x109707){return this[_0x109707]!==_0x12c2b8[_0x109707];},this);if(this[_0xd7df('0x44')]&&_0x12c2b8[_0xd7df('0x44')]){_0xdf3046=this['Trunk'][_0xd7df('0x14')]!==_0x12c2b8[_0xd7df('0x44')]['name']||this['Trunk'][_0xd7df('0x55')]!==_0x12c2b8['Trunk'][_0xd7df('0x55')];}}return _0x1ed688||_0x32cdfa||_0xdf3046;};VoiceQueueSummary['prototype'][_0xd7df('0x56')]=function(_0x28151a){this[_0xd7df('0x7')]=_0x28151a['answered'];this['message']=_0x28151a['message'];this[_0xd7df('0x43')]=_0x28151a[_0xd7df('0x43')];this[_0xd7df('0x9')]=_0x28151a[_0xd7df('0x9')];this[_0xd7df('0xa')]=_0x28151a[_0xd7df('0xa')];this['outboundAnswerCallsDay']=_0x28151a[_0xd7df('0xb')];this[_0xd7df('0xc')]=_0x28151a[_0xd7df('0xc')];this[_0xd7df('0xd')]=_0x28151a[_0xd7df('0xd')];this[_0xd7df('0x2c')]=_0x28151a[_0xd7df('0x2c')];this[_0xd7df('0xe')]=_0x28151a[_0xd7df('0xe')];this[_0xd7df('0xf')]=_0x28151a[_0xd7df('0xf')];this[_0xd7df('0x10')]=_0x28151a[_0xd7df('0x10')];this[_0xd7df('0x11')]=_0x28151a[_0xd7df('0x11')];this[_0xd7df('0x31')]=_0x28151a[_0xd7df('0x31')];this[_0xd7df('0x1c')]=_0x28151a[_0xd7df('0x1c')];this[_0xd7df('0x12')]=_0x28151a[_0xd7df('0x12')];this[_0xd7df('0x13')]=_0x28151a[_0xd7df('0x13')];if(this[_0xd7df('0x25')]===_0xd7df('0x57')){this[_0xd7df('0x23')]=_0x28151a['pTalking'];}};module['exports']=VoiceQueueSummary; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index eed26f8..f242bf0 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 _0xe299=['exports','name','username','accessKey','remoteUri','serverUrl','Configurations'];(function(_0x1deb72,_0x3f6338){var _0x18bbdf=function(_0x1b4b9b){while(--_0x1b4b9b){_0x1deb72['push'](_0x1deb72['shift']());}};_0x18bbdf(++_0x3f6338);}(_0xe299,0x78));var _0x9e29=function(_0x20ae87,_0x3e9885){_0x20ae87=_0x20ae87-0x0;var _0x62d57d=_0xe299[_0x20ae87];return _0x62d57d;};'use strict';function VtigerAccount(_0x9c970){this['id']=_0x9c970['id']||0x0;this['name']=_0x9c970[_0x9e29('0x0')]||'';this[_0x9e29('0x1')]=_0x9c970[_0x9e29('0x1')]||'';this[_0x9e29('0x2')]=_0x9c970[_0x9e29('0x2')]||'';this['remoteUri']=_0x9c970[_0x9e29('0x3')]||'';this[_0x9e29('0x4')]=_0x9c970[_0x9e29('0x4')]||'';this[_0x9e29('0x5')]=_0x9c970[_0x9e29('0x5')]||{};}module[_0x9e29('0x6')]=VtigerAccount; \ No newline at end of file +var _0x5e11=['serverUrl','Configurations','exports','name','username','accessKey','remoteUri'];(function(_0x45ee03,_0x2f5319){var _0x13d535=function(_0x391904){while(--_0x391904){_0x45ee03['push'](_0x45ee03['shift']());}};_0x13d535(++_0x2f5319);}(_0x5e11,0x1c3));var _0x15e1=function(_0x1aa3fe,_0x27c5fa){_0x1aa3fe=_0x1aa3fe-0x0;var _0x163cee=_0x5e11[_0x1aa3fe];return _0x163cee;};'use strict';function VtigerAccount(_0x5e5647){this['id']=_0x5e5647['id']||0x0;this['name']=_0x5e5647[_0x15e1('0x0')]||'';this[_0x15e1('0x1')]=_0x5e5647[_0x15e1('0x1')]||'';this[_0x15e1('0x2')]=_0x5e5647[_0x15e1('0x2')]||'';this[_0x15e1('0x3')]=_0x5e5647['remoteUri']||'';this[_0x15e1('0x4')]=_0x5e5647['serverUrl']||'';this[_0x15e1('0x5')]=_0x5e5647[_0x15e1('0x5')]||{};}module[_0x15e1('0x6')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index 5566888..6aa0b9b 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 _0xd14c=['password','token','remoteUri','authType','integrationTab','serverUrl','Configurations','exports','name'];(function(_0x419b6a,_0x265b43){var _0x229232=function(_0x514a3e){while(--_0x514a3e){_0x419b6a['push'](_0x419b6a['shift']());}};_0x229232(++_0x265b43);}(_0xd14c,0xa1));var _0xcd14=function(_0x57605e,_0x323f35){_0x57605e=_0x57605e-0x0;var _0x369842=_0xd14c[_0x57605e];return _0x369842;};'use strict';function ZendeskAccount(_0x1ec6a5){this['id']=_0x1ec6a5['id']||0x0;this[_0xcd14('0x0')]=_0x1ec6a5[_0xcd14('0x0')]||'';this['username']=_0x1ec6a5['username']||'';this[_0xcd14('0x1')]=_0x1ec6a5[_0xcd14('0x1')]||'';this[_0xcd14('0x2')]=_0x1ec6a5['token']||'';this['remoteUri']=_0x1ec6a5[_0xcd14('0x3')]||'';this[_0xcd14('0x4')]=_0x1ec6a5['authType']||'';this['type']=_0x1ec6a5['type']||_0xcd14('0x5');this[_0xcd14('0x6')]=_0x1ec6a5[_0xcd14('0x6')]||'';this[_0xcd14('0x7')]=_0x1ec6a5[_0xcd14('0x7')]||{};}module[_0xcd14('0x8')]=ZendeskAccount; \ No newline at end of file +var _0x4929=['name','username','password','token','remoteUri','authType','type','integrationTab','serverUrl','Configurations'];(function(_0x3682ac,_0x4c1c05){var _0x1d93e2=function(_0x25f7bd){while(--_0x25f7bd){_0x3682ac['push'](_0x3682ac['shift']());}};_0x1d93e2(++_0x4c1c05);}(_0x4929,0xdc));var _0x9492=function(_0x5c6e78,_0xf8e716){_0x5c6e78=_0x5c6e78-0x0;var _0x3f076b=_0x4929[_0x5c6e78];return _0x3f076b;};'use strict';function ZendeskAccount(_0xa15666){this['id']=_0xa15666['id']||0x0;this[_0x9492('0x0')]=_0xa15666[_0x9492('0x0')]||'';this[_0x9492('0x1')]=_0xa15666[_0x9492('0x1')]||'';this[_0x9492('0x2')]=_0xa15666[_0x9492('0x2')]||'';this[_0x9492('0x3')]=_0xa15666['token']||'';this[_0x9492('0x4')]=_0xa15666[_0x9492('0x4')]||'';this[_0x9492('0x5')]=_0xa15666[_0x9492('0x5')]||'';this[_0x9492('0x6')]=_0xa15666[_0x9492('0x6')]||_0x9492('0x7');this[_0x9492('0x8')]=_0xa15666[_0x9492('0x8')]||'';this[_0x9492('0x9')]=_0xa15666[_0x9492('0x9')]||{};}module['exports']=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index 27457ae..32b77bc 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 _0xf964=['zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations','exports','name','description','host'];(function(_0x1b6f10,_0x7daab2){var _0x3a6ed5=function(_0x41c4e9){while(--_0x41c4e9){_0x1b6f10['push'](_0x1b6f10['shift']());}};_0x3a6ed5(++_0x7daab2);}(_0xf964,0x152));var _0x4f96=function(_0x37737c,_0x17bcce){_0x37737c=_0x37737c-0x0;var _0x3a403e=_0xf964[_0x37737c];return _0x3a403e;};'use strict';function ZohoAccount(_0x5b8d63){this['id']=_0x5b8d63['id']||0x0;this[_0x4f96('0x0')]=_0x5b8d63[_0x4f96('0x0')]||'';this[_0x4f96('0x1')]=_0x5b8d63[_0x4f96('0x1')]||'';this[_0x4f96('0x2')]=_0x5b8d63['host']||'';this[_0x4f96('0x3')]=_0x5b8d63[_0x4f96('0x3')]||'';this[_0x4f96('0x4')]=_0x5b8d63[_0x4f96('0x4')]||'';this[_0x4f96('0x5')]=_0x5b8d63[_0x4f96('0x5')]||'';this[_0x4f96('0x6')]=_0x5b8d63[_0x4f96('0x6')]||'';this['code']=_0x5b8d63[_0x4f96('0x7')]||'';this[_0x4f96('0x8')]=_0x5b8d63[_0x4f96('0x8')]||'';this[_0x4f96('0x9')]=_0x5b8d63[_0x4f96('0x9')]||{};}module[_0x4f96('0xa')]=ZohoAccount; \ No newline at end of file +var _0xa23a=['Configurations','exports','name','description','host','zone','clientId','clientSecret','serverUrl','code','refreshToken'];(function(_0x27a5b8,_0x10b486){var _0x31d17e=function(_0x4e852){while(--_0x4e852){_0x27a5b8['push'](_0x27a5b8['shift']());}};_0x31d17e(++_0x10b486);}(_0xa23a,0xb2));var _0xaa23=function(_0x581182,_0x4d140b){_0x581182=_0x581182-0x0;var _0x27eed2=_0xa23a[_0x581182];return _0x27eed2;};'use strict';function ZohoAccount(_0x5f021a){this['id']=_0x5f021a['id']||0x0;this['name']=_0x5f021a[_0xaa23('0x0')]||'';this[_0xaa23('0x1')]=_0x5f021a['description']||'';this[_0xaa23('0x2')]=_0x5f021a[_0xaa23('0x2')]||'';this[_0xaa23('0x3')]=_0x5f021a[_0xaa23('0x3')]||'';this[_0xaa23('0x4')]=_0x5f021a[_0xaa23('0x4')]||'';this['clientSecret']=_0x5f021a[_0xaa23('0x5')]||'';this[_0xaa23('0x6')]=_0x5f021a[_0xaa23('0x6')]||'';this['code']=_0x5f021a[_0xaa23('0x7')]||'';this[_0xaa23('0x8')]=_0x5f021a[_0xaa23('0x8')]||'';this[_0xaa23('0x9')]=_0x5f021a[_0xaa23('0x9')]||{};}module[_0xaa23('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 c36c3fb..75604f5 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 _0x7d25=['ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','\x22%s\x22\x20<%s>','number','exports','lodash','moment','isNil','uniqueid','name','type','campaigntype','queue','membername','Agent','channelAgent','format','SIP/%s','calleridname','Contact','phone','firstName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId'];(function(_0x7ced95,_0x350af8){var _0x1296b3=function(_0x5c5331){while(--_0x5c5331){_0x7ced95['push'](_0x7ced95['shift']());}};_0x1296b3(++_0x350af8);}(_0x7d25,0x8a));var _0x57d2=function(_0x4e7d25,_0x58285f){_0x4e7d25=_0x4e7d25-0x0;var _0x526fe6=_0x7d25[_0x4e7d25];return _0x526fe6;};'use strict';var util=require('util');var _=require(_0x57d2('0x0'));var moment=require(_0x57d2('0x1'));function checkNameSurname(_0x35bca8,_0x286bd3,_0x34bad5){var _0x56e08b='';if(!_[_0x57d2('0x2')](_0x286bd3)&&'string'===typeof _0x286bd3){_0x56e08b+=_0x286bd3;}if(!_['isNil'](_0x34bad5)&&'string'===typeof _0x34bad5){_0x56e08b+='\x20'+_0x34bad5;}if(_0x56e08b!==''){return _0x56e08b;}return _0x35bca8;}function Action(_0x5dea84,_0x3c5511,_0x49cc5f,_0x1f43b2,_0x263d35){this[_0x57d2('0x3')]=_0x49cc5f||undefined;this['idContact']=_0x5dea84['id'];this['queue']=_0x3c5511[_0x57d2('0x4')];this['type']=_0x3c5511[_0x57d2('0x5')];this[_0x57d2('0x6')]=_0x57d2('0x7');this['dialAnswer']=![];this[_0x57d2('0x8')]=_[_0x57d2('0x2')](_0x5dea84[_0x57d2('0x9')])?undefined:_0x5dea84[_0x57d2('0x9')][_0x57d2('0x4')];this[_0x57d2('0xa')]=this[_0x57d2('0x8')]?util[_0x57d2('0xb')](_0x57d2('0xc'),this[_0x57d2('0x8')]):_0x1f43b2||undefined;this[_0x57d2('0xd')]=checkNameSurname(_0x5dea84[_0x57d2('0xe')][_0x57d2('0xf')],_0x5dea84[_0x57d2('0xe')][_0x57d2('0x10')],_0x5dea84[_0x57d2('0xe')]['lastName']);this['active']=_0x5dea84[_0x57d2('0x11')]||![];this[_0x57d2('0x12')]=_0x5dea84['phone'];this[_0x57d2('0x13')]=_0x5dea84[_0x57d2('0x13')];this['countbusyretry']=_0x5dea84[_0x57d2('0x14')]||0x0;this['countcongestionretry']=_0x5dea84[_0x57d2('0x15')]||0x0;this['countnoanswerretry']=_0x5dea84[_0x57d2('0x16')]||0x0;this[_0x57d2('0x17')]=(_0x5dea84[_0x57d2('0x14')]||0x0)+(_0x5dea84['countcongestionretry']||0x0)+(_0x5dea84['countnoanswerretry']||0x0)+(_0x5dea84[_0x57d2('0x18')]||0x0)+(_0x5dea84[_0x57d2('0x19')]||0x0)+(_0x5dea84[_0x57d2('0x1a')]||0x0)+(_0x5dea84[_0x57d2('0x1b')]||0x0)+(_0x5dea84['countagentrejectretry']||0x0);this[_0x57d2('0x18')]=_0x5dea84[_0x57d2('0x18')]||0x0;this['countdropretry']=_0x5dea84['countdropretry']||0x0;this[_0x57d2('0x1a')]=_0x5dea84[_0x57d2('0x1a')]||0x0;this[_0x57d2('0x1b')]=_0x5dea84[_0x57d2('0x1b')]||0x0;this[_0x57d2('0x1c')]=_0x5dea84[_0x57d2('0x1c')]||0x0;this[_0x57d2('0x1d')]=_0x5dea84[_0x57d2('0x1d')];this[_0x57d2('0x1e')]=_0x5dea84[_0x57d2('0x1e')];this[_0x57d2('0x1f')]=_0x5dea84[_0x57d2('0x1f')];this[_0x57d2('0x20')]=_0x5dea84[_0x57d2('0x20')];this['ContactId']=_0x5dea84[_0x57d2('0x21')];this[_0x57d2('0x22')]=_0x5dea84[_0x57d2('0x22')];this[_0x57d2('0x23')]=_[_0x57d2('0x2')](_0x5dea84['Agent'])?_0x5dea84[_0x57d2('0x23')]:_0x5dea84[_0x57d2('0x9')]['id'];this[_0x57d2('0x24')]=_0x5dea84[_0x57d2('0x24')];this[_0x57d2('0x25')]='';this[_0x57d2('0x26')]='';}Action[_0x57d2('0x27')]['getCaller']=function(){return util[_0x57d2('0xb')](_0x57d2('0x28'),this[_0x57d2('0xd')],this[_0x57d2('0x29')]);};module[_0x57d2('0x2a')]=Action; \ No newline at end of file +var _0x4e2e=['countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','number','lodash','moment','string','isNil','uniqueid','idContact','queue','name','type','campaigntype','dialAnswer','Agent','channelAgent','format','SIP/%s','membername','calleridname','phone','Contact','firstName','lastName','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry'];(function(_0x45b034,_0x3a57dd){var _0x509cb0=function(_0x3a89d5){while(--_0x3a89d5){_0x45b034['push'](_0x45b034['shift']());}};_0x509cb0(++_0x3a57dd);}(_0x4e2e,0x1f2));var _0xe4e2=function(_0x46a60a,_0x50fb7e){_0x46a60a=_0x46a60a-0x0;var _0x13040c=_0x4e2e[_0x46a60a];return _0x13040c;};'use strict';var util=require('util');var _=require(_0xe4e2('0x0'));var moment=require(_0xe4e2('0x1'));function checkNameSurname(_0x2ae450,_0x1b178f,_0x2041b9){var _0x4284bf='';if(!_['isNil'](_0x1b178f)&&_0xe4e2('0x2')===typeof _0x1b178f){_0x4284bf+=_0x1b178f;}if(!_[_0xe4e2('0x3')](_0x2041b9)&&_0xe4e2('0x2')===typeof _0x2041b9){_0x4284bf+='\x20'+_0x2041b9;}if(_0x4284bf!==''){return _0x4284bf;}return _0x2ae450;}function Action(_0x38c84c,_0x48e83d,_0x322295,_0x36b1c6,_0x1c4e64){this[_0xe4e2('0x4')]=_0x322295||undefined;this[_0xe4e2('0x5')]=_0x38c84c['id'];this[_0xe4e2('0x6')]=_0x48e83d[_0xe4e2('0x7')];this[_0xe4e2('0x8')]=_0x48e83d['type'];this[_0xe4e2('0x9')]=_0xe4e2('0x6');this[_0xe4e2('0xa')]=![];this['membername']=_[_0xe4e2('0x3')](_0x38c84c[_0xe4e2('0xb')])?undefined:_0x38c84c[_0xe4e2('0xb')][_0xe4e2('0x7')];this[_0xe4e2('0xc')]=this['membername']?util[_0xe4e2('0xd')](_0xe4e2('0xe'),this[_0xe4e2('0xf')]):_0x36b1c6||undefined;this[_0xe4e2('0x10')]=checkNameSurname(_0x38c84c['Contact'][_0xe4e2('0x11')],_0x38c84c[_0xe4e2('0x12')][_0xe4e2('0x13')],_0x38c84c[_0xe4e2('0x12')][_0xe4e2('0x14')]);this['active']=_0x38c84c['active']||![];this[_0xe4e2('0x15')]=_0x38c84c[_0xe4e2('0x11')];this[_0xe4e2('0x16')]=_0x38c84c[_0xe4e2('0x16')];this[_0xe4e2('0x17')]=_0x38c84c['countbusyretry']||0x0;this[_0xe4e2('0x18')]=_0x38c84c[_0xe4e2('0x18')]||0x0;this[_0xe4e2('0x19')]=_0x38c84c['countnoanswerretry']||0x0;this[_0xe4e2('0x1a')]=(_0x38c84c['countbusyretry']||0x0)+(_0x38c84c[_0xe4e2('0x18')]||0x0)+(_0x38c84c[_0xe4e2('0x19')]||0x0)+(_0x38c84c[_0xe4e2('0x1b')]||0x0)+(_0x38c84c[_0xe4e2('0x1c')]||0x0)+(_0x38c84c[_0xe4e2('0x1d')]||0x0)+(_0x38c84c[_0xe4e2('0x1e')]||0x0)+(_0x38c84c[_0xe4e2('0x1f')]||0x0);this[_0xe4e2('0x1b')]=_0x38c84c[_0xe4e2('0x1b')]||0x0;this[_0xe4e2('0x1c')]=_0x38c84c['countdropretry']||0x0;this[_0xe4e2('0x1d')]=_0x38c84c[_0xe4e2('0x1d')]||0x0;this[_0xe4e2('0x1e')]=_0x38c84c[_0xe4e2('0x1e')]||0x0;this[_0xe4e2('0x1f')]=_0x38c84c[_0xe4e2('0x1f')]||0x0;this[_0xe4e2('0x20')]=_0x38c84c['callback'];this[_0xe4e2('0x21')]=_0x38c84c[_0xe4e2('0x21')];this[_0xe4e2('0x22')]=_0x38c84c['callbackat'];this[_0xe4e2('0x23')]=_0x38c84c[_0xe4e2('0x23')];this['ContactId']=_0x38c84c[_0xe4e2('0x24')];this[_0xe4e2('0x25')]=_0x38c84c[_0xe4e2('0x25')];this[_0xe4e2('0x26')]=_[_0xe4e2('0x3')](_0x38c84c['Agent'])?_0x38c84c[_0xe4e2('0x26')]:_0x38c84c[_0xe4e2('0xb')]['id'];this[_0xe4e2('0x27')]=_0x38c84c['VoiceQueueId'];this[_0xe4e2('0x28')]='';this[_0xe4e2('0x29')]='';}Action[_0xe4e2('0x2a')]['getCaller']=function(){return util[_0xe4e2('0xd')]('\x22%s\x22\x20<%s>',this[_0xe4e2('0x10')],this[_0xe4e2('0x2b')]);};module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 81d03c4..4f515a2 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 _0xffe6=['attendedtransfer','syncAttendedTransfer','blindtransfer','loopCampaigns','emit','info','stringify','format','voice:queue:%s','name','voice_queue_channel:remove','sendMessageOneNotActive','originated','available','paused','message','INACTIVE','logger','DEACTIVATED','\x20is\x20deactivated','syncCampaigns','hasOwnProperty','dialMethod','preview','booked','type','outbound','clearZombieChannels','dialActive','dialPreviewAutoRecallMe','recallMe','clearZombieChannel','isNil','[clearZombieChannels][talking]','actions','queue','originated:\x20','pTalking:\x20','pTalking','dialAnswer','pick','UserId','ListId','channel','catch','No\x20such\x20channel','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','getContactRecallMe','agentReadyId','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','voicePause','run','[RecallMe]','logger2','disableContact','starttime','outboundReCallsDay','logCustomer','dialRecallInQueue','rescheduleContactInQueue','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','setMessage','IsNotLoggedIn','loggedIn','CAMPAIGN_STATUS','NO_AGENTS_LOGGED','isActive','isTrunkReachable','Trunk','TrunkBackup','UNREACHABLE_TRUNK','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','NoSuchNumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','then','additional','dialNoSuchNumberRetryFrequency','totalGlobal','dialGlobalMaxRetry','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','scheduledAt','unlockAgent','activeContact','linkedid','actioncountonusuch','idContact','incrementPreviewCounters','ANSWER','YYYY-MM-DD\x20HH:mm:ss','[syncHangup][talking][increment]','uniqueid','\x20Queue','connect','acw','mandatoryDisposition','custom:agentConnectPreview','channelAgent','custom:agentcomplete','complete','outboundAnswerCallsDay','answered','decrementTalking','Answer','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','talktime','sumBillable','[syncHangup][talking][decrement]','BUSY','countbusyretry','Busy','callAdditionalPhoneAfterMin','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','cloneAction','rescheduleContact','dialBusyRetryFrequency','NOANSWER','outboundNoAnswerCallsDay','countnoanswerretry','NoAnswer','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','swapAdditionalPhones','CONGESTION','outboundCongestionCallsDay','countcongestionretry','custom:agentcongestion','congestion','dialCongestionMaxRetry','[callProgressDetectingCustomer][logCongestion]','AgentReject','custom:agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','countagentrejectretry','dialAgentRejectRetryFrequency','outboundAbandonedCallsDay','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','outboundUnknownCallsDay','countmachineretry','cause-txt','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','dialstatus','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalking][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','decrementOriginate','[callProgressDetectingCustomer]','queueSummaryCountersUpdated','isUndefined','object','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','Congestion','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent][logCongestion]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','resolve','[incrementPreviewCounters]\x20','checkInBlack','Contact','phone','Contact\x20is\x20undefined','Queue','isEmpty','[Preview][execCall][success]','Queue:\x20','called','[Preview][execCall][failure]','Call\x20failed','outboundBlacklistCallsDay','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','status','reachable','unmonitored','execRun','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','VoiceQueueId','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','Empty\x20Contact','ACTIVE','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Preview][validateContact][Campaign\x20Active]','Is\x20Valid','execCall','dialPrefix','trim','dialCutDigit','substring','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','setXMDContactVariables','assign','toLowerVariables','variables','variablesAction','[originated][increment]','OriginateError','actionid','lookAgent','logLookAgent','clone','responsetime','isFailure','unlockContact','custom:agentringnoanswer','rejected','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','syncDialEnd','destlinkedid','destuniqueid','addVariable','filterKey','variable','keys','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','syncBlindTransfer','transfererlinkedid','exports','util','lodash','uuid','moment','../ami','./rpcDb','./action','./util/util','defaults','redis','localhost','socket.io-emitter','prototype','enqueue','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','agents','clockClearZombieChannels','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','dialend','newexten','syncNewExten','varset','syncVarSet'];(function(_0x4c7fb5,_0x2548ef){var _0x2e10ac=function(_0xf7e27c){while(--_0xf7e27c){_0x4c7fb5['push'](_0x4c7fb5['shift']());}};_0x2e10ac(++_0x2548ef);}(_0xffe6,0x126));var _0x6ffe=function(_0x517b3c,_0x3d8077){_0x517b3c=_0x517b3c-0x0;var _0x4538a1=_0xffe6[_0x517b3c];return _0x4538a1;};'use strict';var util=require(_0x6ffe('0x0'));var _=require(_0x6ffe('0x1'));var uuid=require(_0x6ffe('0x2'));var moment=require(_0x6ffe('0x3'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require('../../../config/logger')('preview');var loggerAction=require('../../../config/logger')('actionPreview');var ami=require(_0x6ffe('0x4'));var rpcDb=require(_0x6ffe('0x5'));var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var Action=require(_0x6ffe('0x6'));var ut=require(_0x6ffe('0x7'));var utils=require('../dialer/utils');config['redis']=_[_0x6ffe('0x8')](config[_0x6ffe('0x9')],{'host':_0x6ffe('0xa'),'port':0x18eb});var io=require(_0x6ffe('0xb'))(new Redis(config[_0x6ffe('0x9')]));var Sequence=function(){};Sequence[_0x6ffe('0xc')][_0x6ffe('0xd')]=function(_0x195593){this[_0x6ffe('0xe')]=this['tail']?this['tail'][_0x6ffe('0xf')](_0x195593):_0x195593();};function Preview(_0x4afac4){this[_0x6ffe('0x10')]=new Sequence();this[_0x6ffe('0x11')]=_0x4afac4[_0x6ffe('0x12')];this[_0x6ffe('0x13')]=_0x4afac4[_0x6ffe('0x13')];this['actions']={};this[_0x6ffe('0x14')]=_0x4afac4['agents'];this[_0x6ffe('0x15')]=0x0;ami['on']('originateresponse',this[_0x6ffe('0x16')][_0x6ffe('0x17')](this));ami['on'](_0x6ffe('0x18'),this[_0x6ffe('0x19')][_0x6ffe('0x17')](this));ami['on'](_0x6ffe('0x1a'),this['syncHangupRequest']['bind'](this));ami['on'](_0x6ffe('0x1b'),this['syncDialEnd'][_0x6ffe('0x17')](this));ami['on'](_0x6ffe('0x1c'),this[_0x6ffe('0x1d')][_0x6ffe('0x17')](this));ami['on'](_0x6ffe('0x1e'),this[_0x6ffe('0x1f')][_0x6ffe('0x17')](this));ami['on'](_0x6ffe('0x20'),this[_0x6ffe('0x21')][_0x6ffe('0x17')](this));ami['on'](_0x6ffe('0x22'),this['syncBlindTransfer'][_0x6ffe('0x17')](this));this[_0x6ffe('0x23')](this[_0x6ffe('0x11')]);}function emit(_0x3bd041,_0x4b353f,_0x54462d){io['to'](_0x3bd041)[_0x6ffe('0x24')](_0x4b353f,_0x54462d);}function emitVoiceQueueChannelRemove(_0x95a2c5){logger[_0x6ffe('0x25')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON[_0x6ffe('0x26')](_0x95a2c5));emit(util[_0x6ffe('0x27')](_0x6ffe('0x28'),_0x95a2c5[_0x6ffe('0x29')]),_0x6ffe('0x2a'),_0x95a2c5);io[_0x6ffe('0x24')]('voice_queue_presence:remove',_0x95a2c5);}function notSendMessagesQueue(_0x20c9c8){if(_0x20c9c8[_0x6ffe('0x2b')]){if(_0x20c9c8[_0x6ffe('0x2c')]===0x0&&_0x20c9c8['pTalking']===0x0){_0x20c9c8[_0x6ffe('0x2b')]=![];_0x20c9c8[_0x6ffe('0x2d')]=0x0;_0x20c9c8[_0x6ffe('0x2e')]=0x0;_0x20c9c8[_0x6ffe('0x2f')]=utils['CAMPAIGN_STATUS'][_0x6ffe('0x30')];ut[_0x6ffe('0x31')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x20c9c8[_0x6ffe('0x29')]+'\x20is\x20not\x20active');}else{_0x20c9c8[_0x6ffe('0x2f')]=utils['CAMPAIGN_STATUS'][_0x6ffe('0x32')];ut[_0x6ffe('0x31')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x20c9c8[_0x6ffe('0x29')]+_0x6ffe('0x33'));}}}Preview[_0x6ffe('0xc')][_0x6ffe('0x23')]=function(){var _0x420627=this;setInterval(function(){_0x420627[_0x6ffe('0x34')]();},0x7cf);};Preview['prototype'][_0x6ffe('0x34')]=function(){var _0x2ca965=this['campaignsPreview'];this[_0x6ffe('0x15')]+=0x1;for(var _0x33de7c in _0x2ca965){if(_0x2ca965[_0x6ffe('0x35')](_0x33de7c)&&(_0x2ca965[_0x33de7c][_0x6ffe('0x36')]===_0x6ffe('0x37')||_0x2ca965[_0x33de7c][_0x6ffe('0x36')]===_0x6ffe('0x38'))&&_0x2ca965[_0x33de7c][_0x6ffe('0x39')]===_0x6ffe('0x3a')){if(this[_0x6ffe('0x15')]>0x7){this[_0x6ffe('0x15')]=0x0;this[_0x6ffe('0x3b')]();}}if(_0x2ca965[_0x6ffe('0x35')](_0x33de7c)&&_0x2ca965[_0x33de7c]['dialMethod']===_0x6ffe('0x37')&&_0x2ca965[_0x33de7c][_0x6ffe('0x39')]===_0x6ffe('0x3a')){if(_0x2ca965[_0x33de7c][_0x6ffe('0x3c')]){this['setMessage'](_0x2ca965[_0x33de7c]);if(_0x2ca965[_0x33de7c][_0x6ffe('0x3d')])this[_0x6ffe('0x3e')](_0x2ca965[_0x33de7c]);}else{notSendMessagesQueue(_0x2ca965[_0x33de7c]);}}}};Preview[_0x6ffe('0xc')][_0x6ffe('0x3f')]=function(_0x5b898d){var _0x35a0b0=this;this[_0x6ffe('0x10')][_0x6ffe('0xd')](function(){if(!_[_0x6ffe('0x40')](_0x35a0b0['actions'][_0x5b898d])){loggerAction[_0x6ffe('0x25')](_0x6ffe('0x41'),_0x5b898d,'Queue',_0x35a0b0[_0x6ffe('0x42')][_0x5b898d][_0x6ffe('0x43')],_0x6ffe('0x44'),JSON[_0x6ffe('0x26')](_0x35a0b0[_0x6ffe('0x11')][_0x35a0b0[_0x6ffe('0x42')][_0x5b898d]['queue']][_0x6ffe('0x2c')]),_0x6ffe('0x45'),JSON[_0x6ffe('0x26')](_0x35a0b0[_0x6ffe('0x11')][_0x35a0b0['actions'][_0x5b898d][_0x6ffe('0x43')]][_0x6ffe('0x46')]),JSON[_0x6ffe('0x26')](_0x35a0b0['actions'][_0x5b898d][_0x6ffe('0x47')]),JSON['stringify'](_[_0x6ffe('0x48')](_0x35a0b0[_0x6ffe('0x42')][_0x5b898d],['contactId',_0x6ffe('0x49'),'VoiceQueueId',_0x6ffe('0x4a')])));return ami['Action']({'action':'status','channel':_0x35a0b0[_0x6ffe('0x42')][_0x5b898d][_0x6ffe('0x4b')]})[_0x6ffe('0x4c')](function(_0x59cd2b){if(_0x59cd2b[_0x6ffe('0x2f')]===_0x6ffe('0x4d')){setTimeout(function(){if(_0x35a0b0[_0x6ffe('0x42')][_0x5b898d]){utils['decrementOriginate'](_0x35a0b0[_0x6ffe('0x11')][_0x35a0b0[_0x6ffe('0x42')][_0x5b898d][_0x6ffe('0x43')]],_0x6ffe('0x4e'));if(_0x35a0b0[_0x6ffe('0x42')][_0x5b898d]['dialAnswer']===!![]){ut['decrementTalking'](_0x35a0b0[_0x6ffe('0x11')][_0x35a0b0[_0x6ffe('0x42')][_0x5b898d][_0x6ffe('0x43')]],_0x6ffe('0x4e'));ut[_0x6ffe('0x4f')](_0x6ffe('0x50')+_0x5b898d,_0x35a0b0[_0x6ffe('0x42')][_0x5b898d][_0x6ffe('0x43')]);}ut['loggerError'](_0x6ffe('0x51')+_0x5b898d,_0x35a0b0[_0x6ffe('0x42')][_0x5b898d][_0x6ffe('0x43')]);delete _0x35a0b0['actions'][_0x5b898d];}},0x2328);}});}});};Preview['prototype'][_0x6ffe('0x3b')]=function(){var _0x497d8a=this;loggerAction[_0x6ffe('0x25')](_0x6ffe('0x52'),_['size'](this[_0x6ffe('0x42')]));for(var _0x40be0b in this[_0x6ffe('0x42')]){if(_0x497d8a[_0x6ffe('0x42')]['hasOwnProperty'](_0x40be0b)){_0x497d8a[_0x6ffe('0x3f')](_0x40be0b);}}};Preview[_0x6ffe('0xc')]['recallMe']=function(_0x38b026){var _0x1981c0=this;rpcDb[_0x6ffe('0x53')](_0x38b026['id'],ut[_0x6ffe('0x54')](this[_0x6ffe('0x14')]))['then'](function(_0x394bff){if(!_[_0x6ffe('0x40')](_0x394bff)){for(var _0x3a8041=0x0;_0x3a8041<_0x394bff[_0x6ffe('0x55')];_0x3a8041+=0x1){if(ut[_0x6ffe('0x56')](_0x394bff[_0x3a8041][_0x6ffe('0x57')])<_0x38b026[_0x6ffe('0x58')]*0x3c){if(_0x394bff[_0x3a8041][_0x6ffe('0x59')]&&!_0x394bff[_0x3a8041][_0x6ffe('0x59')][_0x6ffe('0x5a')]){_0x1981c0[_0x6ffe('0x5b')](_0x394bff[_0x3a8041]['id'])['then'](ut['logger2'](_0x6ffe('0x5c')))[_0x6ffe('0x4c')](ut[_0x6ffe('0x5d')](_0x6ffe('0x5c')));}else{rpcDb[_0x6ffe('0x5e')](_0x394bff[_0x3a8041]['id']);}}else{var _0x2d239e=new Action(_0x394bff[_0x3a8041],_0x38b026);_0x2d239e[_0x6ffe('0x5f')]=moment()[_0x6ffe('0x27')]('YYYY-MM-DD\x20HH:mm:ss');_0x38b026[_0x6ffe('0x60')]+=0x1;ut[_0x6ffe('0x61')](_0x2d239e,0x17,'RecallInQueue');if(_0x38b026[_0x6ffe('0x62')]){rpcDb[_0x6ffe('0x63')](ut['createBody'](_0x394bff[_0x3a8041]));rpcDb[_0x6ffe('0x64')](_0x2d239e,_0x6ffe('0x65'));}else{ut[_0x6ffe('0x61')](_0x2d239e,0x16,'RecallFailedTimeout');rpcDb[_0x6ffe('0x64')](_0x2d239e,_0x6ffe('0x66'));rpcDb[_0x6ffe('0x67')](_0x2d239e,'[HistoryRecallClose]');}}}}})[_0x6ffe('0x4c')](ut[_0x6ffe('0x5d')](_0x6ffe('0x68')));};Preview[_0x6ffe('0xc')][_0x6ffe('0x69')]=function(_0x396e09){_0x396e09[_0x6ffe('0x2b')]=!![];if(ut[_0x6ffe('0x6a')](_0x396e09[_0x6ffe('0x6b')])){_0x396e09[_0x6ffe('0x2f')]=utils[_0x6ffe('0x6c')][_0x6ffe('0x6d')];}else if(!ut[_0x6ffe('0x6e')](_0x396e09[_0x6ffe('0x3c')])){_0x396e09['message']=utils[_0x6ffe('0x6c')][_0x6ffe('0x30')];}else if(!this[_0x6ffe('0x6f')](_0x396e09[_0x6ffe('0x70')])){if(!this['isTrunkReachable'](_0x396e09[_0x6ffe('0x71')])){_0x396e09[_0x6ffe('0x2f')]=utils[_0x6ffe('0x6c')][_0x6ffe('0x72')];}else{_0x396e09[_0x6ffe('0x2f')]=utils[_0x6ffe('0x6c')]['ACTIVE'];}}else{_0x396e09[_0x6ffe('0x2f')]=utils[_0x6ffe('0x6c')]['ACTIVE'];}};Preview[_0x6ffe('0xc')][_0x6ffe('0x73')]=function(_0x36fc8b,_0x11db18,_0x4f98d9){var _0x3621e6=this;var _0xfba65=this['actions'][_0x11db18];var _0x1f5ffd=this[_0x6ffe('0x11')][_0xfba65['queue']];var _0xb3c9f2;var _0xc392e5=![];var _0x116d22=0x2;var _0x379934=0x3;if(_0x1f5ffd){switch(_0x4f98d9){case'1':_0x1f5ffd[_0x6ffe('0x74')]+=0x1;_0xfba65[_0x6ffe('0x75')]+=0x1;_0xfba65[_0x6ffe('0x76')]=ut['totalGlobal'](_0xfba65);ut[_0x6ffe('0x61')](_0xfba65,0x0,_0x6ffe('0x77'));ami[_0x6ffe('0x24')]('custom:agentnosuchnumber',ut[_0x6ffe('0x78')](_0xfba65,_0x6ffe('0x79')));rpcDb[_0x6ffe('0x64')](_0xfba65,_0x6ffe('0x7a'));_0x3621e6[_0x6ffe('0x7b')](_0xfba65,'0',_0x1f5ffd)[_0x6ffe('0x7c')](function(_0x1f19cf){_0xc392e5=_0x1f19cf[_0x6ffe('0x7d')]==0x1;_0x116d22=_0x1f5ffd[_0x6ffe('0x7e')];_0x379934=_0x1f5ffd['callAdditionalPhoneAfterMin'];if(!_0xc392e5){if(ut[_0x6ffe('0x7f')](_0xfba65)>=_0x1f5ffd[_0x6ffe('0x80')]){_0xb3c9f2=ut['cloneAction'](_0xfba65,0xf,_0x6ffe('0x81'));rpcDb[_0x6ffe('0x67')](_0xb3c9f2,_0x6ffe('0x82'));}else{if(_0xfba65['countnosuchnumberretry']>=_0x1f5ffd['dialNoSuchNumberMaxRetry']){rpcDb[_0x6ffe('0x67')](_0xfba65,_0x6ffe('0x82'));}else{rpcDb['rescheduleContact'](ut[_0x6ffe('0x83')](_0xfba65,_0x6ffe('0x75'),_0x1f5ffd[_0x6ffe('0x7e')]),_0xfba65[_0x6ffe('0x84')],_0xfba65[_0x6ffe('0x85')]);}}delete this[_0x6ffe('0x42')][_0x36fc8b[_0x6ffe('0x86')]];}else{_0xfba65['countnosuchnumberretry']++;logger['info'](_0x6ffe('0x87'),_0xfba65[_0x6ffe('0x75')]);logger[_0x6ffe('0x25')]('id',_0xfba65[_0x6ffe('0x88')]);_0x3621e6[_0x6ffe('0x89')]({'id':_0xfba65[_0x6ffe('0x88')],'field':{'countnosuchnumberretry':_0xfba65[_0x6ffe('0x75')]}})[_0x6ffe('0x7c')](function(){_0x3621e6['swapAdditionalPhones'](_0xfba65,_0x116d22,_0x379934)[_0x6ffe('0x7c')](function(){});});}});break;case _0x6ffe('0x8a'):var _0x3259ee=moment()[_0x6ffe('0x27')](_0x6ffe('0x8b'));_0xfba65['responsetime']=_0x3259ee;_0xfba65['answertime']=_0x3259ee;_0xfba65['dialAnswer']=!![];_0x1f5ffd[_0x6ffe('0x46')]+=0x1;logger[_0x6ffe('0x25')](_0x6ffe('0x8c'),_0xfba65[_0x6ffe('0x8d')],_0x6ffe('0x8e'),_0x1f5ffd[_0x6ffe('0x29')],_0x6ffe('0x45'),_0x1f5ffd[_0x6ffe('0x46')]);ami['emit']('custom:agentconnect',ut['buildObj'](_0xfba65,_0x6ffe('0x8f'),this['campaignsPreview'][_0xfba65['queue']]));if(_0x1f5ffd[_0x6ffe('0x90')]||_0x1f5ffd[_0x6ffe('0x91')]){ami[_0x6ffe('0x24')](_0x6ffe('0x92'),{'queue':_0xfba65[_0x6ffe('0x43')],'interface':_0xfba65[_0x6ffe('0x93')],'uniqueid':_0xfba65[_0x6ffe('0x8d')]});}break;case'16':ami[_0x6ffe('0x24')](_0x6ffe('0x94'),ut[_0x6ffe('0x78')](_0xfba65,_0x6ffe('0x95'),this[_0x6ffe('0x11')][_0xfba65[_0x6ffe('0x43')]]));emitVoiceQueueChannelRemove(ut[_0x6ffe('0x78')](_0xfba65,_0x6ffe('0x95')));_0x1f5ffd[_0x6ffe('0x96')]+=0x1;_0x1f5ffd['total']+=0x1;_0x1f5ffd[_0x6ffe('0x97')]+=0x1;ut[_0x6ffe('0x98')](_0x1f5ffd,'[16]');_0xfba65['countglobal']=ut[_0x6ffe('0x7f')](_0xfba65);ut[_0x6ffe('0x61')](_0xfba65,0x4,_0x6ffe('0x99'));rpcDb[_0x6ffe('0x64')](_0xfba65,'[callProgressDetectingCustomer][logAnswer]');rpcDb['createCustomerFinal'](_0xfba65,_0x6ffe('0x9a'));rpcDb[_0x6ffe('0x9b')](_0xfba65);_0x1f5ffd[_0x6ffe('0x9c')]+=_0xfba65[_0x6ffe('0x9d')];_0x1f5ffd[_0x6ffe('0x9e')]+=_0xfba65[_0x6ffe('0x9d')];logger[_0x6ffe('0x25')](_0x6ffe('0x9f'),_0xfba65[_0x6ffe('0x8d')],_0x6ffe('0x8e'),_0x1f5ffd['name'],_0x6ffe('0x45'),_0x1f5ffd[_0x6ffe('0x46')]);delete this[_0x6ffe('0x42')][_0x36fc8b[_0x6ffe('0x86')]];break;case _0x6ffe('0xa0'):_0x1f5ffd['outboundBusyCallsDay']+=0x1;_0xfba65[_0x6ffe('0xa1')]+=0x1;_0xfba65['countglobal']=ut[_0x6ffe('0x7f')](_0xfba65);ut[_0x6ffe('0x61')](_0xfba65,0x5,_0x6ffe('0xa2'));_0x116d22=_0x1f5ffd['dialBusyRetryFrequency'];_0x379934=_0x1f5ffd[_0x6ffe('0xa3')];ami['emit'](_0x6ffe('0xa4'),ut[_0x6ffe('0x78')](_0xfba65,_0x6ffe('0xa5')));rpcDb[_0x6ffe('0x64')](_0xfba65,_0x6ffe('0xa6'));_0x3621e6[_0x6ffe('0x7b')](_0xfba65,'5',_0x1f5ffd)[_0x6ffe('0x7c')](function(_0x48d12b){_0xc392e5=_0x48d12b[_0x6ffe('0x7d')]==0x1;if(!_0xc392e5){if(ut[_0x6ffe('0x7f')](_0xfba65)>=_0x1f5ffd[_0x6ffe('0x80')]){_0xb3c9f2=ut[_0x6ffe('0xa7')](_0xfba65,0xf,_0x6ffe('0x81'));rpcDb[_0x6ffe('0x67')](_0xb3c9f2,'[callProgressDetectingCustomer][logBusyGlobal]');}else{if(_0xfba65[_0x6ffe('0xa1')]>=_0x1f5ffd['dialBusyMaxRetry']){rpcDb[_0x6ffe('0x67')](_0xfba65,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb[_0x6ffe('0xa8')](ut['scheduledAt'](_0xfba65,_0x6ffe('0xa1'),_0x1f5ffd[_0x6ffe('0xa9')]),_0xfba65[_0x6ffe('0x84')],_0xfba65['activeContact']);}}}else{_0xfba65[_0x6ffe('0xa1')]++;_0x3621e6[_0x6ffe('0x89')]({'id':_0xfba65[_0x6ffe('0x88')],'field':{'countbusyretry':_0xfba65['countbusyretry']}})[_0x6ffe('0x7c')](function(){_0x3621e6['swapAdditionalPhones'](_0xfba65,_0x116d22,_0x379934)[_0x6ffe('0x7c')](function(){});});}});break;case _0x6ffe('0xaa'):_0x1f5ffd[_0x6ffe('0xab')]+=0x1;_0xfba65[_0x6ffe('0xac')]+=0x1;_0xfba65[_0x6ffe('0x76')]=ut[_0x6ffe('0x7f')](_0xfba65);ut['logCustomer'](_0xfba65,0x3,_0x6ffe('0xad'));_0x116d22=_0x1f5ffd[_0x6ffe('0xae')];_0x379934=_0x1f5ffd[_0x6ffe('0xa3')];var _0x5c0118=ut[_0x6ffe('0xaf')](_0xfba65,_0x1f5ffd);ami[_0x6ffe('0x24')](_0x6ffe('0xb0'),_0x5c0118);rpcDb['createCustomerHistory'](_0xfba65,'[callProgressDetectingCustomer][logNoAnswer]');_0x3621e6[_0x6ffe('0x7b')](_0xfba65,'3',_0x1f5ffd)[_0x6ffe('0x7c')](function(_0x30900f){_0xc392e5=_0x30900f[_0x6ffe('0x7d')]==0x1;if(!_0xc392e5){if(ut[_0x6ffe('0x7f')](_0xfba65)>=_0x1f5ffd[_0x6ffe('0x80')]){_0xb3c9f2=ut['cloneAction'](_0xfba65,0xf,'Global');rpcDb[_0x6ffe('0x67')](_0xb3c9f2,_0x6ffe('0xb1'));}else{if(_0xfba65[_0x6ffe('0xac')]>=_0x1f5ffd[_0x6ffe('0xb2')]){rpcDb['createCustomerFinal'](_0xfba65,_0x6ffe('0xb3'));}else{rpcDb[_0x6ffe('0xa8')](ut[_0x6ffe('0x83')](_0xfba65,_0x6ffe('0xac'),_0x1f5ffd[_0x6ffe('0xae')]),_0xfba65[_0x6ffe('0x84')],_0xfba65[_0x6ffe('0x85')]);}}}else{_0xfba65['countnoanswerretry']++;_0x3621e6[_0x6ffe('0x89')]({'id':_0xfba65[_0x6ffe('0x88')],'field':{'countnoanswerretry':_0xfba65[_0x6ffe('0xac')]}})['then'](function(){_0x3621e6[_0x6ffe('0xb4')](_0xfba65,_0x116d22,_0x379934)['then'](function(){});});}});break;case _0x6ffe('0xb5'):_0x1f5ffd[_0x6ffe('0xb6')]+=0x1;_0xfba65[_0x6ffe('0xb7')]+=0x1;_0xfba65['countglobal']=ut[_0x6ffe('0x7f')](_0xfba65);ut[_0x6ffe('0x61')](_0xfba65,0x8,'Congestion');_0x116d22=_0x1f5ffd['dialCongestionRetryFrequency'];_0x379934=_0x1f5ffd[_0x6ffe('0xa3')];ami[_0x6ffe('0x24')](_0x6ffe('0xb8'),ut[_0x6ffe('0x78')](_0xfba65,_0x6ffe('0xb9')));rpcDb[_0x6ffe('0x64')](_0xfba65,'[callProgressDetectingCustomer][logCongestion]');_0x3621e6[_0x6ffe('0x7b')](_0xfba65,'8',_0x1f5ffd)[_0x6ffe('0x7c')](function(_0x2bd882){_0xc392e5=_0x2bd882['additional']==0x1;if(!_0xc392e5){if(ut[_0x6ffe('0x7f')](_0xfba65)>=_0x1f5ffd[_0x6ffe('0x80')]){_0xb3c9f2=ut[_0x6ffe('0xa7')](_0xfba65,0xf,_0x6ffe('0x81'));rpcDb[_0x6ffe('0x67')](_0xb3c9f2,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0xfba65['countcongestionretry']>=_0x1f5ffd[_0x6ffe('0xba')]){rpcDb[_0x6ffe('0x67')](_0xfba65,_0x6ffe('0xbb'));}else{rpcDb[_0x6ffe('0xa8')](ut['scheduledAt'](_0xfba65,_0x6ffe('0xb7'),_0x1f5ffd[_0x6ffe('0xa9')]),_0xfba65[_0x6ffe('0x84')],_0xfba65[_0x6ffe('0x85')]);}}}else{_0xfba65[_0x6ffe('0xb7')]++;_0x3621e6[_0x6ffe('0x89')]({'id':_0xfba65[_0x6ffe('0x88')],'field':{'countcongestionretry':_0xfba65['countcongestionretry']}})[_0x6ffe('0x7c')](function(){_0x3621e6[_0x6ffe('0xb4')](_0xfba65,_0x116d22,_0x379934)['then'](function(){});});}});break;case'CANCEL':_0x1f5ffd['outboundRejectCallsDay']+=0x1;_0xfba65['countagentrejectretry']+=0x1;_0xfba65[_0x6ffe('0x76')]=ut[_0x6ffe('0x7f')](_0xfba65);ut[_0x6ffe('0x61')](_0xfba65,0x14,_0x6ffe('0xbc'));_0x116d22=_0x1f5ffd['dialAgentRejectRetryFrequency'];_0x379934=_0x1f5ffd['callAdditionalPhoneAfterMin'];ami[_0x6ffe('0x24')](_0x6ffe('0xbd'),ut[_0x6ffe('0x78')](_0xfba65,'agentreject'));rpcDb[_0x6ffe('0x64')](_0xfba65,_0x6ffe('0xbe'));_0x3621e6['verifyAdditionalPhones'](_0xfba65,'20',_0x1f5ffd)[_0x6ffe('0x7c')](function(_0x218a40){_0xc392e5=_0x218a40[_0x6ffe('0x7d')]==0x1;if(!_0xc392e5){if(ut['totalGlobal'](_0xfba65)>=_0x1f5ffd[_0x6ffe('0x80')]){_0xb3c9f2=ut[_0x6ffe('0xa7')](_0xfba65,0x14,_0x6ffe('0xbc'));rpcDb[_0x6ffe('0x67')](_0xb3c9f2,_0x6ffe('0xbf'));}else{if(_0xfba65['countagentrejectretry']>=_0x1f5ffd[_0x6ffe('0xc0')]){rpcDb[_0x6ffe('0x67')](_0xfba65,_0x6ffe('0xbf'));}else{rpcDb[_0x6ffe('0xa8')](ut[_0x6ffe('0x83')](_0xfba65,_0x6ffe('0xc1'),_0x1f5ffd[_0x6ffe('0xc2')]),_0xfba65[_0x6ffe('0x84')],_0xfba65[_0x6ffe('0x85')]);}}}else{_0xfba65[_0x6ffe('0xac')]++;_0x3621e6[_0x6ffe('0x89')]({'id':_0xfba65[_0x6ffe('0x88')],'field':{'countnoanswerretry':_0xfba65[_0x6ffe('0xac')]}})[_0x6ffe('0x7c')](function(){_0x3621e6['swapAdditionalPhones'](_0xfba65,_0x116d22,_0x379934)[_0x6ffe('0x7c')](function(){});});}});break;case'ABANDONED':_0x1f5ffd[_0x6ffe('0xc3')]+=0x1;_0xfba65[_0x6ffe('0xc4')]+=0x1;_0xfba65['countglobal']=ut['totalGlobal'](_0xfba65);ut['logCustomer'](_0xfba65,0xb,_0x6ffe('0xc5'));rpcDb['createCustomerHistory'](_0xfba65,_0x6ffe('0xc6'));_0x3621e6[_0x6ffe('0x7b')](_0xfba65,'11',_0x1f5ffd)[_0x6ffe('0x7c')](function(_0x3c9e10){_0xc392e5=_0x3c9e10[_0x6ffe('0x7d')]==0x1;if(!_0xc392e5){if(ut['totalGlobal'](_0xfba65)>=_0x1f5ffd[_0x6ffe('0x80')]){_0xb3c9f2=ut[_0x6ffe('0xa7')](_0xfba65,0xf,_0x6ffe('0x81'));rpcDb[_0x6ffe('0x67')](_0xb3c9f2,_0x6ffe('0xc6'));}else{if(_0xfba65[_0x6ffe('0xc7')]>=_0x1f5ffd[_0x6ffe('0xc8')]){rpcDb[_0x6ffe('0x67')](_0xfba65,_0x6ffe('0xc6'));}else{rpcDb[_0x6ffe('0xa8')](ut['scheduledAt'](_0xfba65,_0x6ffe('0xc4'),_0x1f5ffd['dialAbandonedRetryFrequency']),_0xfba65[_0x6ffe('0x84')],_0xfba65['activeContact']);}}}else{_0xfba65[_0x6ffe('0xac')]++;_0x3621e6[_0x6ffe('0x89')]({'id':_0xfba65['idContact'],'field':{'countnoanswerretry':_0xfba65['countnoanswerretry']}})[_0x6ffe('0x7c')](function(){_0x3621e6[_0x6ffe('0xb4')](_0xfba65,_0x116d22,_0x379934)['then'](function(){});});}});break;case'18':_0x1f5ffd[_0x6ffe('0xc9')]+=0x1;_0xfba65[_0x6ffe('0xca')]+=0x1;_0xfba65[_0x6ffe('0x76')]=ut['totalGlobal'](_0xfba65);ut[_0x6ffe('0x61')](_0xfba65,0x12,_0x36fc8b[_0x6ffe('0xcb')]||_0x36fc8b['dialstatus']);ami['emit'](_0x6ffe('0xcc'),ut[_0x6ffe('0x78')](_0xfba65,_0x6ffe('0xcd')));rpcDb[_0x6ffe('0x64')](_0xfba65,_0x6ffe('0xce'));_0x3621e6[_0x6ffe('0x7b')](_0xfba65,'18',_0x1f5ffd)[_0x6ffe('0x7c')](function(_0x3914e0){_0xc392e5=_0x3914e0[_0x6ffe('0x7d')]==0x1;if(!_0xc392e5){if(ut['totalGlobal'](_0xfba65)>=_0x1f5ffd[_0x6ffe('0x80')]){_0xb3c9f2=ut[_0x6ffe('0xa7')](_0xfba65,0x12,_0x6ffe('0x81'));rpcDb['createCustomerFinal'](_0xb3c9f2,_0x6ffe('0xce'));}else{rpcDb[_0x6ffe('0x67')](_0xfba65,_0x6ffe('0xce'));}}else{_0xfba65[_0x6ffe('0xac')]++;_0x3621e6[_0x6ffe('0x89')]({'id':_0xfba65[_0x6ffe('0x88')],'field':{'countnoanswerretry':_0xfba65[_0x6ffe('0xac')]}})[_0x6ffe('0x7c')](function(){_0x3621e6['swapAdditionalPhones'](_0xfba65,_0x116d22,_0x379934)[_0x6ffe('0x7c')](function(){});});}});delete this[_0x6ffe('0x42')][_0x36fc8b['linkedid']];break;case'19':_0x1f5ffd[_0x6ffe('0xc9')]+=0x1;_0xfba65['countglobal']=ut['totalGlobal'](_0xfba65);ut[_0x6ffe('0x61')](_0xfba65,0x13,_0x36fc8b[_0x6ffe('0xcb')]||_0x36fc8b[_0x6ffe('0xcf')]);ami['emit'](_0x6ffe('0xcc'),ut[_0x6ffe('0x78')](_0xfba65,_0x6ffe('0xcd')));rpcDb[_0x6ffe('0x64')](_0xfba65,_0x6ffe('0xd0'));_0x3621e6['verifyAdditionalPhones'](_0xfba65,'18',_0x1f5ffd)[_0x6ffe('0x7c')](function(_0x5b6d20){_0xc392e5=_0x5b6d20['additional']==0x1;if(!_0xc392e5){if(ut['totalGlobal'](_0xfba65)>=_0x1f5ffd[_0x6ffe('0x80')]){_0xb3c9f2=ut[_0x6ffe('0xa7')](_0xfba65,0xf,'Global');rpcDb[_0x6ffe('0x67')](_0xb3c9f2,_0x6ffe('0xd0'));}else{rpcDb[_0x6ffe('0x67')](_0xfba65,'[callProgressDetectingCustomer][machine]');}}else{_0xfba65[_0x6ffe('0xac')]++;_0x3621e6['incrementPreviewCounters']({'id':_0xfba65[_0x6ffe('0x88')],'field':{'countnoanswerretry':_0xfba65[_0x6ffe('0xac')]}})[_0x6ffe('0x7c')](function(){_0x3621e6[_0x6ffe('0xb4')](_0xfba65,_0x116d22,_0x379934)[_0x6ffe('0x7c')](function(){});});}});delete this[_0x6ffe('0x42')][_0x36fc8b[_0x6ffe('0x86')]];break;default:if(_0xfba65['dialAnswer']){ut[_0x6ffe('0x98')](_0x1f5ffd,_0x6ffe('0xd1'));ut['loggerError'](_0x6ffe('0xd2')+_0x1f5ffd[_0x6ffe('0x29')],_0x36fc8b);}_0x1f5ffd[_0x6ffe('0xc9')]+=0x1;_0xfba65[_0x6ffe('0x76')]=ut[_0x6ffe('0x7f')](_0xfba65);ut[_0x6ffe('0x61')](_0xfba65,0xc,_0x36fc8b[_0x6ffe('0xcb')]||_0x36fc8b[_0x6ffe('0xcf')]);_0x116d22=_0x1f5ffd['dialAgentRejectRetryFrequency'];_0x379934=_0x1f5ffd[_0x6ffe('0xa3')];rpcDb[_0x6ffe('0x64')](_0xfba65,_0x6ffe('0xd3'));_0x3621e6[_0x6ffe('0x7b')](_0xfba65,'20',_0x1f5ffd)['then'](function(_0x205841){_0xc392e5=_0x205841[_0x6ffe('0x7d')]==0x1;if(!_0xc392e5){if(ut[_0x6ffe('0x7f')](_0xfba65)>=_0x1f5ffd[_0x6ffe('0x80')]){_0xb3c9f2=ut[_0x6ffe('0xa7')](_0xfba65,0xf,_0x6ffe('0x81'));rpcDb[_0x6ffe('0x67')](_0xb3c9f2,_0x6ffe('0xd4'));}else{rpcDb[_0x6ffe('0x67')](_0xfba65,_0x6ffe('0xd4'));}delete this['actions'][_0x36fc8b[_0x6ffe('0x86')]];}else{_0x3621e6[_0x6ffe('0xb4')](_0xfba65,_0x116d22,_0x379934)[_0x6ffe('0x7c')](function(){});}});}if(!(_0xfba65[_0x6ffe('0x47')]&&_0x4f98d9==='16')){utils[_0x6ffe('0xd5')](_0x1f5ffd,_0x6ffe('0xd6'));logger[_0x6ffe('0x25')]('[originated][decrement][callProgressDetectingCustomer]',_0xfba65[_0x6ffe('0x8d')],'\x20Queue',_0x1f5ffd['name'],_0x6ffe('0x44'),_0x1f5ffd[_0x6ffe('0x2c')]);}if(_0x4f98d9!==_0x6ffe('0x8a')){delete this[_0x6ffe('0x42')][_0x36fc8b[_0x6ffe('0x86')]];delete this[_0x6ffe('0x42')][_0x36fc8b['destlinkedid']];}_0x1f5ffd[_0x6ffe('0xd7')]=!![];}};Preview[_0x6ffe('0xc')]['callProgressDetectingAgent']=function(_0x498ec3,_0x50251c,_0x7b42c){if(_[_0x6ffe('0xd8')](_0x50251c)&&_0x6ffe('0xd9')!==typeof _0x50251c){return;}if(_[_0x6ffe('0xd8')](_0x7b42c)&&_0x6ffe('0xd9')!==typeof _0x7b42c){return;}switch(_0x7b42c[_0x6ffe('0xda')]){case'0':ut[_0x6ffe('0xdb')](_0x498ec3,0x0,_0x6ffe('0x77'));rpcDb[_0x6ffe('0xdc')](_0x498ec3,_0x6ffe('0xdd'));break;case'3':ut[_0x6ffe('0xdb')](_0x498ec3,0x3,'NoAnswer');rpcDb[_0x6ffe('0xdc')](_0x498ec3,_0x6ffe('0xde'));break;case'5':ut['logAgent'](_0x498ec3,0x5,_0x6ffe('0xa2'));rpcDb[_0x6ffe('0xdc')](_0x498ec3,_0x6ffe('0xdf'));break;case'8':ut['logAgent'](_0x498ec3,0x8,_0x6ffe('0xe0'));rpcDb[_0x6ffe('0xdc')](_0x498ec3,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut[_0x6ffe('0xdb')](_0x498ec3,0x16,'AnswerAGI');rpcDb[_0x6ffe('0xdc')](_0x498ec3,_0x6ffe('0xe1'));break;default:ut['logAgent'](_0x498ec3,0xc,_0x7b42c[_0x6ffe('0xda')]);rpcDb[_0x6ffe('0xdc')](_0x498ec3,_0x6ffe('0xe2'));}utils['decrementOriginate'](_0x50251c,'[callProgressDetectingAgent]');logger[_0x6ffe('0x25')](_0x6ffe('0xe3'),_0x498ec3[_0x6ffe('0x8d')],_0x6ffe('0x8e'),_0x50251c[_0x6ffe('0x29')],_0x6ffe('0x44'),_0x50251c[_0x6ffe('0x2c')]);delete this[_0x6ffe('0x42')][_0x498ec3['uniqueid']];};Preview['prototype']['verifyAdditionalPhones']=function(_0x45e369,_0x23afc0,_0x2caa3e){return cmHopperAdditionalPhone['verifyAdditionalPhones'](_0x45e369,_0x23afc0,_0x2caa3e)[_0x6ffe('0x4c')](logger[_0x6ffe('0x25')](_0x6ffe('0xe4')));};Preview[_0x6ffe('0xc')][_0x6ffe('0xb4')]=function(_0x502073,_0x253094,_0x460ad2){return cmHopperAdditionalPhone[_0x6ffe('0xb4')](_0x502073,_0x253094,_0x460ad2)[_0x6ffe('0x4c')](logger['info'](_0x6ffe('0xe5')));};Preview[_0x6ffe('0xc')]['incrementPreviewCounters']=function(_0xf1d1cf){return Promise[_0x6ffe('0xe6')]()[_0x6ffe('0x7c')](cmHopperAdditionalPhone[_0x6ffe('0x89')](_0xf1d1cf))[_0x6ffe('0x4c')](logger[_0x6ffe('0x25')](_0x6ffe('0xe7')));};Preview[_0x6ffe('0xc')][_0x6ffe('0xe8')]=function(_0xc19422,_0x2de4ea,_0x59cd46,_0x29d661,_0x9678af){var _0x50d54f=this;return new Promise(function(_0x1c5f87,_0x2a2b55){if(_[_0x6ffe('0x40')](_0x2de4ea)||_[_0x6ffe('0x40')](_0x2de4ea[_0x6ffe('0xe9')])||_['isNil'](_0x2de4ea[_0x6ffe('0xea')])||_[_0x6ffe('0x40')](_0x2de4ea['VoiceQueueId'])){_0x2a2b55(ut['message'](_0x6ffe('0xeb'),_0x29d661,_0x9678af));return;}var _0x1a23d2=uuid['v4']();var _0x493ae6=_0x50d54f[_0x6ffe('0x11')][_0x2de4ea[_0x6ffe('0xec')][_0x6ffe('0x29')]];var _0x11cb41=_0x59cd46?_0x50d54f['agents'][_0x59cd46]['id']:undefined;_0x50d54f['actions'][_0x1a23d2]=new Action(_0x2de4ea,_0x493ae6,_0x1a23d2,_0x59cd46,_0x11cb41);var _0x556cf3=_0x50d54f[_0x6ffe('0x42')][_0x1a23d2];_0x556cf3[_0x6ffe('0x84')]=_0x29d661;_0x556cf3['activeContact']=_0x9678af;_0x556cf3['lookAgent']=_0x59cd46;if(_[_0x6ffe('0xed')](_0xc19422)){_0x50d54f['execCall'](_0x556cf3,_0x493ae6,_0x2de4ea,_0x59cd46)[_0x6ffe('0x7c')](function(_0x2ad8d0){logger[_0x6ffe('0x25')](_0x6ffe('0xee'),_0x6ffe('0xef')+_0x556cf3[_0x6ffe('0x43')]+'\x20IdHopper:\x20'+_0x556cf3[_0x6ffe('0x88')],JSON[_0x6ffe('0x26')](_0x2ad8d0));ami[_0x6ffe('0x24')]('custom:agentcalled',ut['buildObj'](_0x556cf3,_0x6ffe('0xf0'),_0x50d54f[_0x6ffe('0x11')][_0x556cf3['queue']]));_0x1c5f87(ut[_0x6ffe('0x2f')]('Calling'));})['catch'](function(_0x50476b){ut[_0x6ffe('0x31')](_0x6ffe('0xf1'),_0x50476b);_0x2a2b55(ut[_0x6ffe('0x2f')](_0x6ffe('0xf2'),_0x29d661,_0x9678af));});}else{_0x493ae6[_0x6ffe('0xf3')]+=0x1;ut[_0x6ffe('0xf4')](_0x556cf3);rpcDb[_0x6ffe('0xf5')](_0x556cf3,_0x6ffe('0xf6'));delete _0x50d54f[_0x6ffe('0x42')][_0x1a23d2];_0x2a2b55(ut[_0x6ffe('0x2f')](_0x6ffe('0xf7'),_0x29d661,_0x9678af));}});};Preview[_0x6ffe('0xc')][_0x6ffe('0x6f')]=function(_0x88ada1){return!_[_0x6ffe('0x40')](_0x88ada1)&&!_[_0x6ffe('0x40')](_0x88ada1[_0x6ffe('0x29')])&&!_[_0x6ffe('0x40')](_0x88ada1[_0x6ffe('0xf8')])&&_0x88ada1[_0x6ffe('0xf8')]&&!_[_0x6ffe('0x40')](this[_0x6ffe('0x13')][util[_0x6ffe('0x27')]('SIP/%s',_0x88ada1['name'])])&&!_[_0x6ffe('0x40')](this[_0x6ffe('0x13')][util[_0x6ffe('0x27')](_0x6ffe('0xf9'),_0x88ada1[_0x6ffe('0x29')])][_0x6ffe('0xfa')])&&(this['trunks'][util[_0x6ffe('0x27')]('SIP/%s',_0x88ada1['name'])]['status']===_0x6ffe('0xfb')||this['trunks'][util[_0x6ffe('0x27')](_0x6ffe('0xf9'),_0x88ada1['name'])]['status']===_0x6ffe('0xfc'));};Preview[_0x6ffe('0xc')]['run']=function(_0x213195,_0x5b2f6d){return this[_0x6ffe('0xfd')](_0x213195,_0x5b2f6d)[_0x6ffe('0x7c')](function(_0x1adbb0){return _['pick'](_0x1adbb0,[_0x6ffe('0x2f')]);})[_0x6ffe('0x4c')](function(_0x3e323b){if(_0x3e323b['unlock']){rpcDb['unlockContact'](_0x213195);}if(_0x3e323b[_0x6ffe('0xf8')]){rpcDb[_0x6ffe('0x5e')](_0x213195);}throw _[_0x6ffe('0x48')](_0x3e323b,[_0x6ffe('0x2f')]);});};Preview[_0x6ffe('0xc')][_0x6ffe('0xfd')]=function(_0x2d8e74,_0x5e14a6){var _0x1cf836=this;var _0x3256f7,_0xde2db2;return rpcDb[_0x6ffe('0xfe')](_0x2d8e74)[_0x6ffe('0x7c')](function(_0xdcf73c){if(!_[_0x6ffe('0x40')](_0xdcf73c[0x0])){_0xde2db2=_0xdcf73c[0x0]['recallme']?![]:!![];_0x3256f7=_0xdcf73c[0x0][_0x6ffe('0xff')]?!![]:![];_0x3256f7=_0x5e14a6?!![]:_0x3256f7;}var _0x2c29e5=_0x1cf836[_0x6ffe('0x100')](_0xdcf73c);if(_0x2c29e5[_0x6ffe('0x101')]){rpcDb[_0x6ffe('0x102')](_['pick'](_0xdcf73c[0x0],[_0x6ffe('0x103'),_0x6ffe('0xea')]))[_0x6ffe('0x7c')](function(_0x2673fe){_0x1cf836[_0x6ffe('0xe8')](_0x2673fe,_0xdcf73c[0x0],_0x5e14a6,_0xde2db2,_0x3256f7)[_0x6ffe('0x7c')](function(_0x1a839c){return _0x1a839c;})[_0x6ffe('0x4c')](function(_0x1d780c){throw _0x1d780c;});})[_0x6ffe('0x4c')](function(_0x188109){ut['logger'](_0x6ffe('0x104'),_0x188109);throw ut['message'](_0x6ffe('0x105'),_0xde2db2,_0x3256f7);});}else{throw ut[_0x6ffe('0x2f')](_0x2c29e5['message'],_0xde2db2,_0x3256f7);}})[_0x6ffe('0x4c')](function(_0x2efa26){ut[_0x6ffe('0x31')](_0x6ffe('0x106'),_0x2efa26);throw ut['message']('Call\x20unsuccessful',![],!![]);});};Preview[_0x6ffe('0xc')][_0x6ffe('0x100')]=function(_0x9ae6fc){if(_[_0x6ffe('0x40')](_0x9ae6fc)||_[_0x6ffe('0xed')](_0x9ae6fc)||!_[_0x6ffe('0x40')](_0x9ae6fc[0x0][_0x6ffe('0x59')])&&_[_0x6ffe('0x40')](_0x9ae6fc[0x0][_0x6ffe('0x59')][_0x6ffe('0x29')])){ut['logger']('[Preview][validateContact][Empty\x20Contact]',_0x9ae6fc);return{'isValid':![],'message':_0x6ffe('0x107')};}var _0x3faf13=this['campaignsPreview'][_0x9ae6fc[0x0][_0x6ffe('0xec')][_0x6ffe('0x29')]];_0x3faf13['message']=utils[_0x6ffe('0x6c')][_0x6ffe('0x108')];if(_[_0x6ffe('0x40')](_0x3faf13)){ut[_0x6ffe('0x31')]('[Preview][validateContact][Empty\x20Campaign]',_0x3faf13);return{'isValid':![],'message':'Empty\x20Campaign'};}if(!this[_0x6ffe('0x6f')](_0x3faf13[_0x6ffe('0x70')])){ut[_0x6ffe('0x31')](_0x6ffe('0x109'),_0x6ffe('0x10a')+_0x3faf13['name']+_0x6ffe('0x10b'));if(!this['isTrunkReachable'](_0x3faf13[_0x6ffe('0x71')])){ut[_0x6ffe('0x31')](_0x6ffe('0x109'),_0x3faf13[_0x6ffe('0x29')]+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':_0x6ffe('0x10c')};}}if(!ut['isActive'](_0x3faf13[_0x6ffe('0x3c')])){ut[_0x6ffe('0x31')](_0x6ffe('0x10d'),_0x3faf13[_0x6ffe('0x29')]+'\x20Not\x20Active');return{'isValid':![],'message':_0x6ffe('0x10a')+_0x3faf13[_0x6ffe('0x29')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':_0x6ffe('0x10e')};};Preview[_0x6ffe('0xc')][_0x6ffe('0x10f')]=function(_0x25fbcb,_0x33973c,_0x14e113,_0x4fb42a){var _0x1e7289=this;return new Promise(function(_0x41a80c,_0x1d56f1){var _0x48a6c7=_0x25fbcb['uniqueid'];var _0xdefac4=_0x1e7289[_0x6ffe('0x6f')](_0x33973c[_0x6ffe('0x70')])?util['format']('SIP/%s/%s%s',_0x33973c[_0x6ffe('0x70')][_0x6ffe('0x29')],_[_0x6ffe('0x40')](_0x33973c[_0x6ffe('0x110')])?'':_0x33973c[_0x6ffe('0x110')][_0x6ffe('0x111')]()||'',_0x33973c[_0x6ffe('0x112')]>0x0?_0x14e113['phone'][_0x6ffe('0x113')](_0x33973c['dialCutDigit']):_0x14e113['phone']):util['format']('SIP/%s/%s%s',_[_0x6ffe('0x40')](_0x33973c['TrunkBackup'])?_0x33973c[_0x6ffe('0x70')][_0x6ffe('0x29')]:_0x33973c['TrunkBackup'][_0x6ffe('0x29')],_['isNil'](_0x33973c[_0x6ffe('0x110')])?'':_0x33973c['dialPrefix']['trim']()||'',_0x33973c['dialCutDigit']>0x0?_0x14e113[_0x6ffe('0xea')][_0x6ffe('0x113')](_0x33973c[_0x6ffe('0x112')]):_0x14e113['phone']);var _0xd063ea=_0x1e7289[_0x6ffe('0x6f')](_0x33973c[_0x6ffe('0x70')])?ut[_0x6ffe('0x114')](_0x33973c[_0x6ffe('0x70')][_0x6ffe('0x115')],_0x33973c[_0x6ffe('0x116')],_0x33973c[_0x6ffe('0x117')]>0x0?ut[_0x6ffe('0x118')](_0x33973c[_0x6ffe('0x119')],_0x33973c[_0x6ffe('0x117')]):_0x33973c[_0x6ffe('0x119')]):ut['getCallerId'](_[_0x6ffe('0x40')](_0x33973c[_0x6ffe('0x71')])?_0x33973c[_0x6ffe('0x70')]['callerid']:_0x33973c[_0x6ffe('0x71')][_0x6ffe('0x115')],_0x33973c['dialOriginateCallerIdName'],_0x33973c['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0x6ffe('0x118')](_0x33973c[_0x6ffe('0x119')],_0x33973c[_0x6ffe('0x117')]):_0x33973c[_0x6ffe('0x119')]);if(_0xd063ea){_0x25fbcb[_0x6ffe('0x11a')]=ut[_0x6ffe('0x11b')](_0xd063ea);_0x25fbcb[_0x6ffe('0x11c')]=ut[_0x6ffe('0x11d')](_0xd063ea);}var _0x191321=ut[_0x6ffe('0x11e')](_0x33973c,_0x14e113,_0xdefac4,_0xd063ea,_0x48a6c7,_0x25fbcb);var _0x3067aa=utils[_0x6ffe('0x11f')](_0x14e113[_0x6ffe('0xe9')]);Object[_0x6ffe('0x120')](_0x191321,_0x3067aa);_['merge'](_0x25fbcb,ut[_0x6ffe('0x121')](_0x191321));_0x25fbcb[_0x6ffe('0x5f')]=moment()['format'](_0x6ffe('0x8b'));_0x33973c[_0x6ffe('0x122')]=_0x191321;var _0x15440c=ut[_0x6ffe('0x123')](_0x25fbcb,_0x33973c,_0x191321,_0x25fbcb[_0x6ffe('0x85')],_0x4fb42a);return ami['Action'](_0x15440c)['then'](function(_0x1f4e38){_0x33973c['originated']+=0x1;logger[_0x6ffe('0x25')](_0x6ffe('0x124'),_0x48a6c7,_0x6ffe('0x8e'),_0x33973c[_0x6ffe('0x29')],_0x6ffe('0x44'),_0x33973c[_0x6ffe('0x2c')]);_0x41a80c(_0x1f4e38);})[_0x6ffe('0x4c')](function(_0x5110b0){ut['logAgent'](_0x25fbcb,0xe,_0x6ffe('0x125'));rpcDb[_0x6ffe('0xdc')](_0x25fbcb,'[originateFailure][logOriginateFailure]');_0x1d56f1(_0x5110b0);});});};Preview[_0x6ffe('0xc')][_0x6ffe('0x1d')]=function(_0x20b06f){if(this['actions'][_0x20b06f[_0x6ffe('0x86')]]){this[_0x6ffe('0x42')][_0x20b06f[_0x6ffe('0x86')]][_0x6ffe('0x4b')]=_0x20b06f[_0x6ffe('0x4b')];}};Preview[_0x6ffe('0xc')][_0x6ffe('0x16')]=function(_0x5c3b43){var _0x54fe6f=this;var _0x42dd0c=this[_0x6ffe('0x42')][_0x5c3b43[_0x6ffe('0x126')]];if(_0x42dd0c){if(_0x42dd0c[_0x6ffe('0x127')]&&this['agents'][_0x42dd0c['lookAgent']]){ut[_0x6ffe('0x128')](_0x42dd0c,this[_0x6ffe('0x14')][_0x42dd0c[_0x6ffe('0x127')]][_0x6ffe('0x29')],this['agents'][_0x42dd0c['lookAgent']]['id']);}var _0x1198d5=_[_0x6ffe('0x129')](_0x42dd0c);_0x1198d5[_0x6ffe('0x12a')]=moment()[_0x6ffe('0x27')](_0x6ffe('0x8b'));var _0x57dad7=_0x54fe6f[_0x6ffe('0x11')][_0x42dd0c[_0x6ffe('0x43')]];if(ut[_0x6ffe('0x12b')](_0x5c3b43['response'])){if(_0x42dd0c[_0x6ffe('0x84')]){rpcDb[_0x6ffe('0x12c')](_0x42dd0c[_0x6ffe('0x88')]);}if(_0x42dd0c[_0x6ffe('0x85')]){rpcDb['disableContact'](_0x42dd0c[_0x6ffe('0x88')]);}ami[_0x6ffe('0x24')](_0x6ffe('0x12d'),ut[_0x6ffe('0x78')](_0x42dd0c,_0x6ffe('0x12e'),this[_0x6ffe('0x11')][_0x42dd0c['queue']]));this['callProgressDetectingAgent'](_0x1198d5,_0x57dad7,_0x5c3b43);}else{_0x42dd0c[_0x6ffe('0x5f')]=moment()['format'](_0x6ffe('0x8b'));ut[_0x6ffe('0xdb')](_0x1198d5,0x4,'Answer');rpcDb[_0x6ffe('0xdc')](_0x1198d5,'[callProgressDetectingAgent][logAnswer]');}}};Preview['prototype']['syncHangup']=function(_0x108b69){var _0x11e11e=this[_0x6ffe('0x42')][_0x108b69['linkedid']];var _0x208153;if(_0x11e11e){_0x208153=this[_0x6ffe('0x11')][_0x11e11e[_0x6ffe('0x43')]];logger[_0x6ffe('0x25')](_0x6ffe('0x12f'),_0x108b69[_0x6ffe('0x86')],_0x6ffe('0x8e'),_0x208153[_0x6ffe('0x29')],_0x6ffe('0x45'),_0x208153[_0x6ffe('0x46')]);}if(this[_0x6ffe('0x42')][_0x108b69['linkedid']]&&_0x108b69[_0x6ffe('0x86')]!==_0x108b69[_0x6ffe('0x8d')]){if(_0x108b69[_0x6ffe('0x130')]==='16'&&this[_0x6ffe('0x42')][_0x108b69[_0x6ffe('0x86')]]['dialAnswer']){this[_0x6ffe('0x73')](_0x108b69,_0x108b69['linkedid'],_0x108b69['cause']);}else if(this[_0x6ffe('0x42')][_0x108b69[_0x6ffe('0x86')]][_0x6ffe('0x47')]){logger[_0x6ffe('0x25')](_0x6ffe('0x131'),_0x108b69[_0x6ffe('0x86')],_0x108b69['cause'],_0x6ffe('0x8e'),_0x208153[_0x6ffe('0x29')],_0x6ffe('0x45'),_0x208153['pTalking']);this['callProgressDetectingCustomer'](_0x108b69,_0x108b69[_0x6ffe('0x86')],_0x108b69[_0x6ffe('0x130')]);}}else if(_0x11e11e&&_[_0x6ffe('0x40')](_0x11e11e[_0x6ffe('0x132')])&&_0x208153[_0x6ffe('0x133')]&&_0x108b69[_0x6ffe('0x86')]===_0x108b69[_0x6ffe('0x8d')]&&_[_0x6ffe('0x40')](_0x108b69[_0x6ffe('0xda')])&&_0x108b69[_0x6ffe('0x130')]==='16'&&_0x108b69[_0x6ffe('0x134')]==='6'&&_[_0x6ffe('0xd8')](_0x11e11e[_0x6ffe('0x135')])){if(_0x11e11e[_0x6ffe('0x84')]){rpcDb[_0x6ffe('0x12c')](_0x11e11e[_0x6ffe('0x88')]);}if(_0x11e11e['activeContact']){rpcDb[_0x6ffe('0x5e')](_0x11e11e['idContact']);}_0x108b69['reason']='22';this['callProgressDetectingAgent'](_0x11e11e,_0x208153,_0x108b69);}else if(_0x11e11e&&_0x11e11e[_0x6ffe('0x135')]){if(_0x108b69[_0x6ffe('0x130')]==='16'&&this['actions'][_0x108b69[_0x6ffe('0x86')]][_0x6ffe('0x47')]){logger['info'](_0x6ffe('0x136'),_0x108b69[_0x6ffe('0x86')],_0x108b69[_0x6ffe('0x130')],_0x6ffe('0x8e'),_0x208153[_0x6ffe('0x29')],_0x6ffe('0x45'),_0x208153[_0x6ffe('0x46')]);this[_0x6ffe('0x73')](_0x108b69,_0x108b69[_0x6ffe('0x86')],_0x108b69[_0x6ffe('0x130')]);}else if(this['actions'][_0x108b69['linkedid']]['dialAnswer']){logger['info'](_0x6ffe('0x131'),_0x108b69[_0x6ffe('0x86')],_0x108b69['cause'],'\x20Queue',_0x208153[_0x6ffe('0x29')],_0x6ffe('0x45'),_0x208153['pTalking']);this[_0x6ffe('0x73')](_0x108b69,_0x108b69[_0x6ffe('0x86')],_0x108b69[_0x6ffe('0x130')]);}}};Preview['prototype'][_0x6ffe('0x137')]=function(_0xeeb06c){if(this[_0x6ffe('0x42')][_0xeeb06c['destlinkedid']]&&_0xeeb06c[_0x6ffe('0x138')]!==_0xeeb06c[_0x6ffe('0x139')]){this[_0x6ffe('0x73')](_0xeeb06c,_0xeeb06c[_0x6ffe('0x138')],_0xeeb06c['dialstatus']);}};Preview[_0x6ffe('0xc')]['syncHangupRequest']=function(_0xc4c14d){if(this[_0x6ffe('0x42')][_0xc4c14d[_0x6ffe('0x86')]]&&_0xc4c14d[_0x6ffe('0x86')]!==_0xc4c14d['uniqueid']&&!this[_0x6ffe('0x42')][_0xc4c14d[_0x6ffe('0x86')]][_0x6ffe('0x47')]){if(_0xc4c14d[_0x6ffe('0x130')]==='1'){this[_0x6ffe('0x73')](_0xc4c14d,_0xc4c14d[_0x6ffe('0x86')],_0xc4c14d['cause']);}}};Preview[_0x6ffe('0xc')][_0x6ffe('0x13a')]=function(_0x160da9,_0x29d30e,_0x240d14){if(this['actions'][_0x160da9]){if(_[_0x6ffe('0x40')](this['actions'][_0x160da9][_0x6ffe('0x122')])){this[_0x6ffe('0x42')][_0x160da9][_0x6ffe('0x122')]={};}this[_0x6ffe('0x42')][_0x160da9]['variables'][_0x29d30e]=_0x240d14;}};Preview[_0x6ffe('0xc')][_0x6ffe('0x1f')]=function(_0x27c49a){try{if(!_[_0x6ffe('0x40')](_0x27c49a)){if(ut[_0x6ffe('0x13b')](_['keys'](_0x27c49a[_0x6ffe('0x13c')])[0x0])){this[_0x6ffe('0x13a')](_0x27c49a[_0x6ffe('0x8d')],_[_0x6ffe('0x13d')](_0x27c49a['variable'])[0x0],_0x27c49a[_0x6ffe('0x13e')]);}}}catch(_0x1ac965){logger[_0x6ffe('0x13f')](_0x6ffe('0x140'),util[_0x6ffe('0x141')](_0x1ac965,{'showHidden':![],'depth':null}));}};Preview[_0x6ffe('0xc')][_0x6ffe('0x21')]=function(_0x33819b){if(_0x33819b){if(this[_0x6ffe('0x42')][_0x33819b[_0x6ffe('0x142')]]){this[_0x6ffe('0x42')][_0x33819b[_0x6ffe('0x142')]]['transfer']=!![];}}};Preview[_0x6ffe('0xc')][_0x6ffe('0x143')]=function(_0x4d0222){if(_0x4d0222){if(this[_0x6ffe('0x42')][_0x4d0222[_0x6ffe('0x144')]]){this[_0x6ffe('0x42')][_0x4d0222[_0x6ffe('0x144')]][_0x6ffe('0x135')]=!![];}}};module[_0x6ffe('0x145')]=Preview; \ No newline at end of file +var _0x5ffd=['NO_AGENTS_LOGGED','isActive','isTrunkReachable','Trunk','TrunkBackup','UNREACHABLE_TRUNK','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','scheduledAt','unlockAgent','activeContact','linkedid','actioncountonusuch','incrementPreviewCounters','idContact','swapAdditionalPhones','ANSWER','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','pTalking','custom:agentconnect','buildObj','acw','mandatoryDisposition','custom:agentConnectPreview','channelAgent','custom:agentcomplete','complete','outboundAnswerCallsDay','total','answered','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','sumDuration','sumBillable','talktime','[syncHangup][talking][decrement]','\x20Queue','countbusyretry','Busy','dialBusyRetryFrequency','custom:agentbusy','[callProgressDetectingCustomer][logBusy]','rescheduleContact','outboundNoAnswerCallsDay','countnoanswerretry','NoAnswer','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','[callProgressDetectingCustomer][logNoAnswer]','cloneAction','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','CONGESTION','outboundCongestionCallsDay','countcongestionretry','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','ABANDONED','outboundAbandonedCallsDay','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedRetryFrequency','outboundUnknownCallsDay','countmachineretry','cause-txt','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalking][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','queueSummaryCountersUpdated','callProgressDetectingAgent','isUndefined','object','reason','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','logAgent','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','resolve','[incrementPreviewCounters]\x20','phone','Contact\x20is\x20undefined','Queue','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','outboundBlacklistCallsDay','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','reachable','unmonitored','execRun','unlock','unlockContact','pick','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','checkInBlack','[Preview][checkIsBlackList]','[Preview][getContactPreview]','Call\x20unsuccessful','isEmpty','[Preview][validateContact][Empty\x20Campaign]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','execCall','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','getCallerIdRandom','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','Contact','assign','merge','toLowerVariables','variables','variablesAction','Action','[originated][increment]','OriginateError','syncOriginateResponse','actionid','lookAgent','logLookAgent','isFailure','response','custom:agentringnoanswer','rejected','[callProgressDetectingAgent][logAnswer]','syncHangup','[syncHangup][talking]','[syncHangup][talking][cause]','cause','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','destuniqueid','syncVarSet','filterKey','variable','addVariable','keys','value','[syncVarSet][Preview]','inspect','transfertargetlinkedid','syncBlindTransfer','transfererlinkedid','exports','util','lodash','uuid','moment','ioredis','../../../config/environment','../../../config/logger','preview','actionPreview','../ami','../rpc/cmHopperAdditionalPhone','./action','./util/util','redis','defaults','prototype','enqueue','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','bind','hangup','hanguprequest','syncHangupRequest','dialend','syncDialEnd','newexten','syncNewExten','attendedtransfer','syncAttendedTransfer','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','format','voice:queue:%s','voice_queue_channel:remove','emit','voice_queue_presence:remove','originated','sendMessageOneNotActive','available','paused','message','INACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','name','\x20is\x20not\x20active','CAMPAIGN_STATUS','DEACTIVATED','loopCampaigns','syncCampaigns','dialMethod','booked','outbound','clearZombieChannels','type','dialActive','setMessage','recallMe','clearZombieChannel','isNil','[clearZombieChannels][talking]','queue','originated:\x20','pTalking:\x20','dialAnswer','contactId','VoiceQueueId','ListId','status','channel','catch','No\x20such\x20channel','decrementOriginate','[clearZombieChannel]','decrementTalking','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','hasOwnProperty','getContactRecallMe','agentReadyId','then','scheduledat','dialRecallMeTimeout','Agent','run','logger2','[RecallMe]','disableContact','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','loggedIn'];(function(_0x10bca2,_0xdceda8){var _0x166dee=function(_0x5e6a69){while(--_0x5e6a69){_0x10bca2['push'](_0x10bca2['shift']());}};_0x166dee(++_0xdceda8);}(_0x5ffd,0xdf));var _0xd5ff=function(_0x109798,_0x4e7400){_0x109798=_0x109798-0x0;var _0x466568=_0x5ffd[_0x109798];return _0x466568;};'use strict';var util=require(_0xd5ff('0x0'));var _=require(_0xd5ff('0x1'));var uuid=require(_0xd5ff('0x2'));var moment=require(_0xd5ff('0x3'));var Redis=require(_0xd5ff('0x4'));var config=require(_0xd5ff('0x5'));var logger=require(_0xd5ff('0x6'))(_0xd5ff('0x7'));var loggerAction=require(_0xd5ff('0x6'))(_0xd5ff('0x8'));var ami=require(_0xd5ff('0x9'));var rpcDb=require('./rpcDb');var cmHopperAdditionalPhone=require(_0xd5ff('0xa'));var Action=require(_0xd5ff('0xb'));var ut=require(_0xd5ff('0xc'));var utils=require('../dialer/utils');config[_0xd5ff('0xd')]=_[_0xd5ff('0xe')](config[_0xd5ff('0xd')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var Sequence=function(){};Sequence[_0xd5ff('0xf')][_0xd5ff('0x10')]=function(_0x1bf617){this['tail']=this[_0xd5ff('0x11')]?this['tail'][_0xd5ff('0x12')](_0x1bf617):_0x1bf617();};function Preview(_0x556d4a){this[_0xd5ff('0x13')]=new Sequence();this[_0xd5ff('0x14')]=_0x556d4a[_0xd5ff('0x15')];this[_0xd5ff('0x16')]=_0x556d4a[_0xd5ff('0x16')];this[_0xd5ff('0x17')]={};this[_0xd5ff('0x18')]=_0x556d4a[_0xd5ff('0x18')];this[_0xd5ff('0x19')]=0x0;ami['on'](_0xd5ff('0x1a'),this['syncOriginateResponse'][_0xd5ff('0x1b')](this));ami['on'](_0xd5ff('0x1c'),this['syncHangup'][_0xd5ff('0x1b')](this));ami['on'](_0xd5ff('0x1d'),this[_0xd5ff('0x1e')]['bind'](this));ami['on'](_0xd5ff('0x1f'),this[_0xd5ff('0x20')]['bind'](this));ami['on'](_0xd5ff('0x21'),this[_0xd5ff('0x22')][_0xd5ff('0x1b')](this));ami['on']('varset',this['syncVarSet'][_0xd5ff('0x1b')](this));ami['on'](_0xd5ff('0x23'),this[_0xd5ff('0x24')][_0xd5ff('0x1b')](this));ami['on']('blindtransfer',this['syncBlindTransfer'][_0xd5ff('0x1b')](this));this['loopCampaigns'](this[_0xd5ff('0x14')]);}function emit(_0x513a20,_0x357736,_0x4eae55){io['to'](_0x513a20)['emit'](_0x357736,_0x4eae55);}function emitVoiceQueueChannelRemove(_0x536758){logger[_0xd5ff('0x25')](_0xd5ff('0x26'),JSON[_0xd5ff('0x27')](_0x536758));emit(util[_0xd5ff('0x28')](_0xd5ff('0x29'),_0x536758['name']),_0xd5ff('0x2a'),_0x536758);io[_0xd5ff('0x2b')](_0xd5ff('0x2c'),_0x536758);}function notSendMessagesQueue(_0x3e462b){if(_0x3e462b['sendMessageOneNotActive']){if(_0x3e462b[_0xd5ff('0x2d')]===0x0&&_0x3e462b['pTalking']===0x0){_0x3e462b[_0xd5ff('0x2e')]=![];_0x3e462b[_0xd5ff('0x2f')]=0x0;_0x3e462b[_0xd5ff('0x30')]=0x0;_0x3e462b[_0xd5ff('0x31')]=utils['CAMPAIGN_STATUS'][_0xd5ff('0x32')];ut[_0xd5ff('0x33')](_0xd5ff('0x34'),_0x3e462b[_0xd5ff('0x35')]+_0xd5ff('0x36'));}else{_0x3e462b[_0xd5ff('0x31')]=utils[_0xd5ff('0x37')][_0xd5ff('0x38')];ut[_0xd5ff('0x33')](_0xd5ff('0x34'),_0x3e462b[_0xd5ff('0x35')]+'\x20is\x20deactivated');}}}Preview['prototype'][_0xd5ff('0x39')]=function(){var _0x4cb91d=this;setInterval(function(){_0x4cb91d[_0xd5ff('0x3a')]();},0x7cf);};Preview[_0xd5ff('0xf')][_0xd5ff('0x3a')]=function(){var _0x58e7f6=this['campaignsPreview'];this[_0xd5ff('0x19')]+=0x1;for(var _0x31cffb in _0x58e7f6){if(_0x58e7f6['hasOwnProperty'](_0x31cffb)&&(_0x58e7f6[_0x31cffb][_0xd5ff('0x3b')]==='preview'||_0x58e7f6[_0x31cffb][_0xd5ff('0x3b')]===_0xd5ff('0x3c'))&&_0x58e7f6[_0x31cffb]['type']===_0xd5ff('0x3d')){if(this['clockClearZombieChannels']>0x7){this[_0xd5ff('0x19')]=0x0;this[_0xd5ff('0x3e')]();}}if(_0x58e7f6['hasOwnProperty'](_0x31cffb)&&_0x58e7f6[_0x31cffb][_0xd5ff('0x3b')]==='preview'&&_0x58e7f6[_0x31cffb][_0xd5ff('0x3f')]==='outbound'){if(_0x58e7f6[_0x31cffb][_0xd5ff('0x40')]){this[_0xd5ff('0x41')](_0x58e7f6[_0x31cffb]);if(_0x58e7f6[_0x31cffb]['dialPreviewAutoRecallMe'])this[_0xd5ff('0x42')](_0x58e7f6[_0x31cffb]);}else{notSendMessagesQueue(_0x58e7f6[_0x31cffb]);}}}};Preview[_0xd5ff('0xf')][_0xd5ff('0x43')]=function(_0x5f94c){var _0x130e57=this;this[_0xd5ff('0x13')][_0xd5ff('0x10')](function(){if(!_[_0xd5ff('0x44')](_0x130e57[_0xd5ff('0x17')][_0x5f94c])){loggerAction[_0xd5ff('0x25')](_0xd5ff('0x45'),_0x5f94c,'Queue',_0x130e57[_0xd5ff('0x17')][_0x5f94c][_0xd5ff('0x46')],_0xd5ff('0x47'),JSON['stringify'](_0x130e57[_0xd5ff('0x14')][_0x130e57[_0xd5ff('0x17')][_0x5f94c][_0xd5ff('0x46')]][_0xd5ff('0x2d')]),_0xd5ff('0x48'),JSON['stringify'](_0x130e57[_0xd5ff('0x14')][_0x130e57['actions'][_0x5f94c][_0xd5ff('0x46')]]['pTalking']),JSON[_0xd5ff('0x27')](_0x130e57['actions'][_0x5f94c][_0xd5ff('0x49')]),JSON[_0xd5ff('0x27')](_['pick'](_0x130e57['actions'][_0x5f94c],[_0xd5ff('0x4a'),'UserId',_0xd5ff('0x4b'),_0xd5ff('0x4c')])));return ami['Action']({'action':_0xd5ff('0x4d'),'channel':_0x130e57[_0xd5ff('0x17')][_0x5f94c][_0xd5ff('0x4e')]})[_0xd5ff('0x4f')](function(_0x6ca0f0){if(_0x6ca0f0['message']===_0xd5ff('0x50')){setTimeout(function(){if(_0x130e57[_0xd5ff('0x17')][_0x5f94c]){utils[_0xd5ff('0x51')](_0x130e57[_0xd5ff('0x14')][_0x130e57[_0xd5ff('0x17')][_0x5f94c][_0xd5ff('0x46')]],_0xd5ff('0x52'));if(_0x130e57[_0xd5ff('0x17')][_0x5f94c]['dialAnswer']===!![]){ut[_0xd5ff('0x53')](_0x130e57[_0xd5ff('0x14')][_0x130e57[_0xd5ff('0x17')][_0x5f94c]['queue']],_0xd5ff('0x52'));ut[_0xd5ff('0x54')](_0xd5ff('0x55')+_0x5f94c,_0x130e57[_0xd5ff('0x17')][_0x5f94c][_0xd5ff('0x46')]);}ut['loggerError'](_0xd5ff('0x56')+_0x5f94c,_0x130e57[_0xd5ff('0x17')][_0x5f94c][_0xd5ff('0x46')]);delete _0x130e57[_0xd5ff('0x17')][_0x5f94c];}},0x2328);}});}});};Preview[_0xd5ff('0xf')][_0xd5ff('0x3e')]=function(){var _0x16c820=this;loggerAction['info']('[action]',_['size'](this['actions']));for(var _0x3ecad4 in this[_0xd5ff('0x17')]){if(_0x16c820[_0xd5ff('0x17')][_0xd5ff('0x57')](_0x3ecad4)){_0x16c820['clearZombieChannel'](_0x3ecad4);}}};Preview['prototype'][_0xd5ff('0x42')]=function(_0x572f68){var _0x8c72d=this;rpcDb[_0xd5ff('0x58')](_0x572f68['id'],ut[_0xd5ff('0x59')](this[_0xd5ff('0x18')]))[_0xd5ff('0x5a')](function(_0x5862d9){if(!_[_0xd5ff('0x44')](_0x5862d9)){for(var _0x291ffd=0x0;_0x291ffd<_0x5862d9['length'];_0x291ffd+=0x1){if(ut['getDiff'](_0x5862d9[_0x291ffd][_0xd5ff('0x5b')])<_0x572f68[_0xd5ff('0x5c')]*0x3c){if(_0x5862d9[_0x291ffd]['Agent']&&!_0x5862d9[_0x291ffd][_0xd5ff('0x5d')]['voicePause']){_0x8c72d[_0xd5ff('0x5e')](_0x5862d9[_0x291ffd]['id'])[_0xd5ff('0x5a')](ut[_0xd5ff('0x5f')]('[RecallMe]'))[_0xd5ff('0x4f')](ut['logger2'](_0xd5ff('0x60')));}else{rpcDb[_0xd5ff('0x61')](_0x5862d9[_0x291ffd]['id']);}}else{var _0x9358c8=new Action(_0x5862d9[_0x291ffd],_0x572f68);_0x9358c8['starttime']=moment()[_0xd5ff('0x28')](_0xd5ff('0x62'));_0x572f68['outboundReCallsDay']+=0x1;ut[_0xd5ff('0x63')](_0x9358c8,0x17,_0xd5ff('0x64'));if(_0x572f68[_0xd5ff('0x65')]){rpcDb[_0xd5ff('0x66')](ut[_0xd5ff('0x67')](_0x5862d9[_0x291ffd]));rpcDb[_0xd5ff('0x68')](_0x9358c8,_0xd5ff('0x69'));}else{ut[_0xd5ff('0x63')](_0x9358c8,0x16,_0xd5ff('0x6a'));rpcDb[_0xd5ff('0x68')](_0x9358c8,_0xd5ff('0x6b'));rpcDb[_0xd5ff('0x6c')](_0x9358c8,'[HistoryRecallClose]');}}}}})[_0xd5ff('0x4f')](ut[_0xd5ff('0x5f')](_0xd5ff('0x6d')));};Preview['prototype'][_0xd5ff('0x41')]=function(_0x3aea60){_0x3aea60[_0xd5ff('0x2e')]=!![];if(ut['IsNotLoggedIn'](_0x3aea60[_0xd5ff('0x6e')])){_0x3aea60[_0xd5ff('0x31')]=utils['CAMPAIGN_STATUS'][_0xd5ff('0x6f')];}else if(!ut[_0xd5ff('0x70')](_0x3aea60[_0xd5ff('0x40')])){_0x3aea60['message']=utils['CAMPAIGN_STATUS'][_0xd5ff('0x32')];}else if(!this[_0xd5ff('0x71')](_0x3aea60[_0xd5ff('0x72')])){if(!this[_0xd5ff('0x71')](_0x3aea60[_0xd5ff('0x73')])){_0x3aea60[_0xd5ff('0x31')]=utils[_0xd5ff('0x37')][_0xd5ff('0x74')];}else{_0x3aea60[_0xd5ff('0x31')]=utils[_0xd5ff('0x37')][_0xd5ff('0x75')];}}else{_0x3aea60['message']=utils[_0xd5ff('0x37')][_0xd5ff('0x75')];}};Preview[_0xd5ff('0xf')][_0xd5ff('0x76')]=function(_0x1578e9,_0x316184,_0x2c5b63){var _0xec628f=this;var _0x5a6765=this[_0xd5ff('0x17')][_0x316184];var _0x3b5388=this[_0xd5ff('0x14')][_0x5a6765['queue']];var _0x418525;var _0x1ff21b=![];var _0x24c60a=0x2;var _0x4f7e4b=0x3;if(_0x3b5388){switch(_0x2c5b63){case'1':_0x3b5388['outboundNoSuchCallsDay']+=0x1;_0x5a6765[_0xd5ff('0x77')]+=0x1;_0x5a6765[_0xd5ff('0x78')]=ut[_0xd5ff('0x79')](_0x5a6765);ut[_0xd5ff('0x63')](_0x5a6765,0x0,_0xd5ff('0x7a'));ami[_0xd5ff('0x2b')](_0xd5ff('0x7b'),ut['buildObj'](_0x5a6765,_0xd5ff('0x7c')));rpcDb[_0xd5ff('0x68')](_0x5a6765,_0xd5ff('0x7d'));_0xec628f[_0xd5ff('0x7e')](_0x5a6765,'0',_0x3b5388)[_0xd5ff('0x5a')](function(_0x348c9){_0x1ff21b=_0x348c9[_0xd5ff('0x7f')]==0x1;_0x24c60a=_0x3b5388[_0xd5ff('0x80')];_0x4f7e4b=_0x3b5388[_0xd5ff('0x81')];if(!_0x1ff21b){if(ut['totalGlobal'](_0x5a6765)>=_0x3b5388[_0xd5ff('0x82')]){_0x418525=ut['cloneAction'](_0x5a6765,0xf,_0xd5ff('0x83'));rpcDb['createCustomerFinal'](_0x418525,_0xd5ff('0x84'));}else{if(_0x5a6765['countnosuchnumberretry']>=_0x3b5388[_0xd5ff('0x85')]){rpcDb[_0xd5ff('0x6c')](_0x5a6765,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{rpcDb['rescheduleContact'](ut[_0xd5ff('0x86')](_0x5a6765,_0xd5ff('0x77'),_0x3b5388[_0xd5ff('0x80')]),_0x5a6765[_0xd5ff('0x87')],_0x5a6765[_0xd5ff('0x88')]);}}delete this[_0xd5ff('0x17')][_0x1578e9[_0xd5ff('0x89')]];}else{_0x5a6765[_0xd5ff('0x77')]++;logger[_0xd5ff('0x25')](_0xd5ff('0x8a'),_0x5a6765[_0xd5ff('0x77')]);logger[_0xd5ff('0x25')]('id',_0x5a6765['idContact']);_0xec628f[_0xd5ff('0x8b')]({'id':_0x5a6765[_0xd5ff('0x8c')],'field':{'countnosuchnumberretry':_0x5a6765['countnosuchnumberretry']}})[_0xd5ff('0x5a')](function(){_0xec628f[_0xd5ff('0x8d')](_0x5a6765,_0x24c60a,_0x4f7e4b)['then'](function(){});});}});break;case _0xd5ff('0x8e'):var _0x4ef298=moment()[_0xd5ff('0x28')](_0xd5ff('0x62'));_0x5a6765[_0xd5ff('0x8f')]=_0x4ef298;_0x5a6765[_0xd5ff('0x90')]=_0x4ef298;_0x5a6765[_0xd5ff('0x49')]=!![];_0x3b5388['pTalking']+=0x1;logger[_0xd5ff('0x25')](_0xd5ff('0x91'),_0x5a6765[_0xd5ff('0x92')],'\x20Queue',_0x3b5388[_0xd5ff('0x35')],'pTalking:\x20',_0x3b5388[_0xd5ff('0x93')]);ami[_0xd5ff('0x2b')](_0xd5ff('0x94'),ut[_0xd5ff('0x95')](_0x5a6765,'connect',this[_0xd5ff('0x14')][_0x5a6765[_0xd5ff('0x46')]]));if(_0x3b5388[_0xd5ff('0x96')]||_0x3b5388[_0xd5ff('0x97')]){ami[_0xd5ff('0x2b')](_0xd5ff('0x98'),{'queue':_0x5a6765[_0xd5ff('0x46')],'interface':_0x5a6765[_0xd5ff('0x99')],'uniqueid':_0x5a6765[_0xd5ff('0x92')]});}break;case'16':ami[_0xd5ff('0x2b')](_0xd5ff('0x9a'),ut[_0xd5ff('0x95')](_0x5a6765,_0xd5ff('0x9b'),this[_0xd5ff('0x14')][_0x5a6765[_0xd5ff('0x46')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x5a6765,_0xd5ff('0x9b')));_0x3b5388[_0xd5ff('0x9c')]+=0x1;_0x3b5388[_0xd5ff('0x9d')]+=0x1;_0x3b5388[_0xd5ff('0x9e')]+=0x1;ut['decrementTalking'](_0x3b5388,_0xd5ff('0x9f'));_0x5a6765[_0xd5ff('0x78')]=ut[_0xd5ff('0x79')](_0x5a6765);ut[_0xd5ff('0x63')](_0x5a6765,0x4,_0xd5ff('0xa0'));rpcDb[_0xd5ff('0x68')](_0x5a6765,_0xd5ff('0xa1'));rpcDb[_0xd5ff('0x6c')](_0x5a6765,_0xd5ff('0xa2'));rpcDb['crateCustomerReportQueue'](_0x5a6765);_0x3b5388[_0xd5ff('0xa3')]+=_0x5a6765['talktime'];_0x3b5388[_0xd5ff('0xa4')]+=_0x5a6765[_0xd5ff('0xa5')];logger[_0xd5ff('0x25')](_0xd5ff('0xa6'),_0x5a6765[_0xd5ff('0x92')],_0xd5ff('0xa7'),_0x3b5388[_0xd5ff('0x35')],_0xd5ff('0x48'),_0x3b5388[_0xd5ff('0x93')]);delete this[_0xd5ff('0x17')][_0x1578e9[_0xd5ff('0x89')]];break;case'BUSY':_0x3b5388['outboundBusyCallsDay']+=0x1;_0x5a6765[_0xd5ff('0xa8')]+=0x1;_0x5a6765[_0xd5ff('0x78')]=ut[_0xd5ff('0x79')](_0x5a6765);ut[_0xd5ff('0x63')](_0x5a6765,0x5,_0xd5ff('0xa9'));_0x24c60a=_0x3b5388[_0xd5ff('0xaa')];_0x4f7e4b=_0x3b5388[_0xd5ff('0x81')];ami[_0xd5ff('0x2b')](_0xd5ff('0xab'),ut['buildObj'](_0x5a6765,'busy'));rpcDb[_0xd5ff('0x68')](_0x5a6765,_0xd5ff('0xac'));_0xec628f[_0xd5ff('0x7e')](_0x5a6765,'5',_0x3b5388)[_0xd5ff('0x5a')](function(_0x3b264c){_0x1ff21b=_0x3b264c[_0xd5ff('0x7f')]==0x1;if(!_0x1ff21b){if(ut[_0xd5ff('0x79')](_0x5a6765)>=_0x3b5388['dialGlobalMaxRetry']){_0x418525=ut['cloneAction'](_0x5a6765,0xf,_0xd5ff('0x83'));rpcDb[_0xd5ff('0x6c')](_0x418525,'[callProgressDetectingCustomer][logBusyGlobal]');}else{if(_0x5a6765[_0xd5ff('0xa8')]>=_0x3b5388['dialBusyMaxRetry']){rpcDb['createCustomerFinal'](_0x5a6765,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb[_0xd5ff('0xad')](ut['scheduledAt'](_0x5a6765,_0xd5ff('0xa8'),_0x3b5388['dialBusyRetryFrequency']),_0x5a6765[_0xd5ff('0x87')],_0x5a6765['activeContact']);}}}else{_0x5a6765['countbusyretry']++;_0xec628f[_0xd5ff('0x8b')]({'id':_0x5a6765[_0xd5ff('0x8c')],'field':{'countbusyretry':_0x5a6765[_0xd5ff('0xa8')]}})[_0xd5ff('0x5a')](function(){_0xec628f[_0xd5ff('0x8d')](_0x5a6765,_0x24c60a,_0x4f7e4b)[_0xd5ff('0x5a')](function(){});});}});break;case'NOANSWER':_0x3b5388[_0xd5ff('0xae')]+=0x1;_0x5a6765[_0xd5ff('0xaf')]+=0x1;_0x5a6765[_0xd5ff('0x78')]=ut[_0xd5ff('0x79')](_0x5a6765);ut[_0xd5ff('0x63')](_0x5a6765,0x3,_0xd5ff('0xb0'));_0x24c60a=_0x3b5388[_0xd5ff('0xb1')];_0x4f7e4b=_0x3b5388[_0xd5ff('0x81')];var _0x1b46d0=ut[_0xd5ff('0xb2')](_0x5a6765,_0x3b5388);ami[_0xd5ff('0x2b')]('custom:agentnoanswer',_0x1b46d0);rpcDb['createCustomerHistory'](_0x5a6765,_0xd5ff('0xb3'));_0xec628f[_0xd5ff('0x7e')](_0x5a6765,'3',_0x3b5388)[_0xd5ff('0x5a')](function(_0x93b75e){_0x1ff21b=_0x93b75e[_0xd5ff('0x7f')]==0x1;if(!_0x1ff21b){if(ut[_0xd5ff('0x79')](_0x5a6765)>=_0x3b5388[_0xd5ff('0x82')]){_0x418525=ut[_0xd5ff('0xb4')](_0x5a6765,0xf,'Global');rpcDb[_0xd5ff('0x6c')](_0x418525,_0xd5ff('0xb5'));}else{if(_0x5a6765[_0xd5ff('0xaf')]>=_0x3b5388[_0xd5ff('0xb6')]){rpcDb[_0xd5ff('0x6c')](_0x5a6765,_0xd5ff('0xb3'));}else{rpcDb[_0xd5ff('0xad')](ut[_0xd5ff('0x86')](_0x5a6765,_0xd5ff('0xaf'),_0x3b5388['dialNoAnswerRetryFrequency']),_0x5a6765['unlockAgent'],_0x5a6765[_0xd5ff('0x88')]);}}}else{_0x5a6765[_0xd5ff('0xaf')]++;_0xec628f[_0xd5ff('0x8b')]({'id':_0x5a6765['idContact'],'field':{'countnoanswerretry':_0x5a6765[_0xd5ff('0xaf')]}})[_0xd5ff('0x5a')](function(){_0xec628f[_0xd5ff('0x8d')](_0x5a6765,_0x24c60a,_0x4f7e4b)[_0xd5ff('0x5a')](function(){});});}});break;case _0xd5ff('0xb7'):_0x3b5388[_0xd5ff('0xb8')]+=0x1;_0x5a6765[_0xd5ff('0xb9')]+=0x1;_0x5a6765['countglobal']=ut[_0xd5ff('0x79')](_0x5a6765);ut[_0xd5ff('0x63')](_0x5a6765,0x8,_0xd5ff('0xba'));_0x24c60a=_0x3b5388[_0xd5ff('0xbb')];_0x4f7e4b=_0x3b5388['callAdditionalPhoneAfterMin'];ami[_0xd5ff('0x2b')](_0xd5ff('0xbc'),ut[_0xd5ff('0x95')](_0x5a6765,'congestion'));rpcDb[_0xd5ff('0x68')](_0x5a6765,_0xd5ff('0xbd'));_0xec628f[_0xd5ff('0x7e')](_0x5a6765,'8',_0x3b5388)[_0xd5ff('0x5a')](function(_0x56bffa){_0x1ff21b=_0x56bffa['additional']==0x1;if(!_0x1ff21b){if(ut['totalGlobal'](_0x5a6765)>=_0x3b5388[_0xd5ff('0x82')]){_0x418525=ut['cloneAction'](_0x5a6765,0xf,_0xd5ff('0x83'));rpcDb[_0xd5ff('0x6c')](_0x418525,_0xd5ff('0xbe'));}else{if(_0x5a6765['countcongestionretry']>=_0x3b5388[_0xd5ff('0xbf')]){rpcDb['createCustomerFinal'](_0x5a6765,_0xd5ff('0xbd'));}else{rpcDb[_0xd5ff('0xad')](ut[_0xd5ff('0x86')](_0x5a6765,_0xd5ff('0xb9'),_0x3b5388['dialBusyRetryFrequency']),_0x5a6765[_0xd5ff('0x87')],_0x5a6765['activeContact']);}}}else{_0x5a6765[_0xd5ff('0xb9')]++;_0xec628f[_0xd5ff('0x8b')]({'id':_0x5a6765[_0xd5ff('0x8c')],'field':{'countcongestionretry':_0x5a6765[_0xd5ff('0xb9')]}})['then'](function(){_0xec628f[_0xd5ff('0x8d')](_0x5a6765,_0x24c60a,_0x4f7e4b)['then'](function(){});});}});break;case'CANCEL':_0x3b5388['outboundRejectCallsDay']+=0x1;_0x5a6765[_0xd5ff('0xc0')]+=0x1;_0x5a6765['countglobal']=ut[_0xd5ff('0x79')](_0x5a6765);ut[_0xd5ff('0x63')](_0x5a6765,0x14,_0xd5ff('0xc1'));_0x24c60a=_0x3b5388[_0xd5ff('0xc2')];_0x4f7e4b=_0x3b5388[_0xd5ff('0x81')];ami[_0xd5ff('0x2b')](_0xd5ff('0xc3'),ut[_0xd5ff('0x95')](_0x5a6765,_0xd5ff('0xc4')));rpcDb[_0xd5ff('0x68')](_0x5a6765,_0xd5ff('0xc5'));_0xec628f[_0xd5ff('0x7e')](_0x5a6765,'20',_0x3b5388)['then'](function(_0x2493bf){_0x1ff21b=_0x2493bf[_0xd5ff('0x7f')]==0x1;if(!_0x1ff21b){if(ut[_0xd5ff('0x79')](_0x5a6765)>=_0x3b5388['dialGlobalMaxRetry']){_0x418525=ut[_0xd5ff('0xb4')](_0x5a6765,0x14,_0xd5ff('0xc1'));rpcDb[_0xd5ff('0x6c')](_0x418525,_0xd5ff('0xc6'));}else{if(_0x5a6765[_0xd5ff('0xc0')]>=_0x3b5388[_0xd5ff('0xc7')]){rpcDb['createCustomerFinal'](_0x5a6765,_0xd5ff('0xc6'));}else{rpcDb['rescheduleContact'](ut[_0xd5ff('0x86')](_0x5a6765,_0xd5ff('0xc0'),_0x3b5388[_0xd5ff('0xc2')]),_0x5a6765['unlockAgent'],_0x5a6765[_0xd5ff('0x88')]);}}}else{_0x5a6765[_0xd5ff('0xaf')]++;_0xec628f['incrementPreviewCounters']({'id':_0x5a6765[_0xd5ff('0x8c')],'field':{'countnoanswerretry':_0x5a6765[_0xd5ff('0xaf')]}})[_0xd5ff('0x5a')](function(){_0xec628f[_0xd5ff('0x8d')](_0x5a6765,_0x24c60a,_0x4f7e4b)['then'](function(){});});}});break;case _0xd5ff('0xc8'):_0x3b5388[_0xd5ff('0xc9')]+=0x1;_0x5a6765[_0xd5ff('0xca')]+=0x1;_0x5a6765[_0xd5ff('0x78')]=ut['totalGlobal'](_0x5a6765);ut['logCustomer'](_0x5a6765,0xb,_0xd5ff('0xcb'));rpcDb[_0xd5ff('0x68')](_0x5a6765,_0xd5ff('0xcc'));_0xec628f[_0xd5ff('0x7e')](_0x5a6765,'11',_0x3b5388)[_0xd5ff('0x5a')](function(_0xd887b2){_0x1ff21b=_0xd887b2[_0xd5ff('0x7f')]==0x1;if(!_0x1ff21b){if(ut[_0xd5ff('0x79')](_0x5a6765)>=_0x3b5388['dialGlobalMaxRetry']){_0x418525=ut[_0xd5ff('0xb4')](_0x5a6765,0xf,'Global');rpcDb[_0xd5ff('0x6c')](_0x418525,_0xd5ff('0xcc'));}else{if(_0x5a6765[_0xd5ff('0xcd')]>=_0x3b5388['dialAbandonedMaxRety']){rpcDb[_0xd5ff('0x6c')](_0x5a6765,_0xd5ff('0xcc'));}else{rpcDb[_0xd5ff('0xad')](ut[_0xd5ff('0x86')](_0x5a6765,'countabandonedretry',_0x3b5388[_0xd5ff('0xce')]),_0x5a6765[_0xd5ff('0x87')],_0x5a6765[_0xd5ff('0x88')]);}}}else{_0x5a6765[_0xd5ff('0xaf')]++;_0xec628f[_0xd5ff('0x8b')]({'id':_0x5a6765['idContact'],'field':{'countnoanswerretry':_0x5a6765[_0xd5ff('0xaf')]}})['then'](function(){_0xec628f['swapAdditionalPhones'](_0x5a6765,_0x24c60a,_0x4f7e4b)[_0xd5ff('0x5a')](function(){});});}});break;case'18':_0x3b5388[_0xd5ff('0xcf')]+=0x1;_0x5a6765[_0xd5ff('0xd0')]+=0x1;_0x5a6765['countglobal']=ut[_0xd5ff('0x79')](_0x5a6765);ut['logCustomer'](_0x5a6765,0x12,_0x1578e9[_0xd5ff('0xd1')]||_0x1578e9[_0xd5ff('0xd2')]);ami['emit'](_0xd5ff('0xd3'),ut[_0xd5ff('0x95')](_0x5a6765,_0xd5ff('0xd4')));rpcDb['createCustomerHistory'](_0x5a6765,_0xd5ff('0xd5'));_0xec628f[_0xd5ff('0x7e')](_0x5a6765,'18',_0x3b5388)['then'](function(_0xf5b969){_0x1ff21b=_0xf5b969[_0xd5ff('0x7f')]==0x1;if(!_0x1ff21b){if(ut[_0xd5ff('0x79')](_0x5a6765)>=_0x3b5388[_0xd5ff('0x82')]){_0x418525=ut['cloneAction'](_0x5a6765,0x12,_0xd5ff('0x83'));rpcDb['createCustomerFinal'](_0x418525,_0xd5ff('0xd5'));}else{rpcDb[_0xd5ff('0x6c')](_0x5a6765,'[callProgressDetectingCustomer][hangupInAMD]');}}else{_0x5a6765['countnoanswerretry']++;_0xec628f['incrementPreviewCounters']({'id':_0x5a6765[_0xd5ff('0x8c')],'field':{'countnoanswerretry':_0x5a6765[_0xd5ff('0xaf')]}})[_0xd5ff('0x5a')](function(){_0xec628f[_0xd5ff('0x8d')](_0x5a6765,_0x24c60a,_0x4f7e4b)[_0xd5ff('0x5a')](function(){});});}});delete this[_0xd5ff('0x17')][_0x1578e9[_0xd5ff('0x89')]];break;case'19':_0x3b5388[_0xd5ff('0xcf')]+=0x1;_0x5a6765[_0xd5ff('0x78')]=ut[_0xd5ff('0x79')](_0x5a6765);ut['logCustomer'](_0x5a6765,0x13,_0x1578e9[_0xd5ff('0xd1')]||_0x1578e9['dialstatus']);ami[_0xd5ff('0x2b')](_0xd5ff('0xd3'),ut[_0xd5ff('0x95')](_0x5a6765,_0xd5ff('0xd4')));rpcDb[_0xd5ff('0x68')](_0x5a6765,_0xd5ff('0xd6'));_0xec628f[_0xd5ff('0x7e')](_0x5a6765,'18',_0x3b5388)[_0xd5ff('0x5a')](function(_0x1b1003){_0x1ff21b=_0x1b1003['additional']==0x1;if(!_0x1ff21b){if(ut[_0xd5ff('0x79')](_0x5a6765)>=_0x3b5388['dialGlobalMaxRetry']){_0x418525=ut[_0xd5ff('0xb4')](_0x5a6765,0xf,_0xd5ff('0x83'));rpcDb[_0xd5ff('0x6c')](_0x418525,_0xd5ff('0xd6'));}else{rpcDb[_0xd5ff('0x6c')](_0x5a6765,_0xd5ff('0xd6'));}}else{_0x5a6765['countnoanswerretry']++;_0xec628f[_0xd5ff('0x8b')]({'id':_0x5a6765[_0xd5ff('0x8c')],'field':{'countnoanswerretry':_0x5a6765[_0xd5ff('0xaf')]}})[_0xd5ff('0x5a')](function(){_0xec628f[_0xd5ff('0x8d')](_0x5a6765,_0x24c60a,_0x4f7e4b)[_0xd5ff('0x5a')](function(){});});}});delete this[_0xd5ff('0x17')][_0x1578e9[_0xd5ff('0x89')]];break;default:if(_0x5a6765[_0xd5ff('0x49')]){ut[_0xd5ff('0x53')](_0x3b5388,_0xd5ff('0xd7'));ut[_0xd5ff('0x54')](_0xd5ff('0xd8')+_0x3b5388['name'],_0x1578e9);}_0x3b5388['outboundUnknownCallsDay']+=0x1;_0x5a6765[_0xd5ff('0x78')]=ut[_0xd5ff('0x79')](_0x5a6765);ut[_0xd5ff('0x63')](_0x5a6765,0xc,_0x1578e9[_0xd5ff('0xd1')]||_0x1578e9[_0xd5ff('0xd2')]);_0x24c60a=_0x3b5388[_0xd5ff('0xc2')];_0x4f7e4b=_0x3b5388[_0xd5ff('0x81')];rpcDb['createCustomerHistory'](_0x5a6765,_0xd5ff('0xd9'));_0xec628f[_0xd5ff('0x7e')](_0x5a6765,'20',_0x3b5388)[_0xd5ff('0x5a')](function(_0x1de2a3){_0x1ff21b=_0x1de2a3['additional']==0x1;if(!_0x1ff21b){if(ut['totalGlobal'](_0x5a6765)>=_0x3b5388[_0xd5ff('0x82')]){_0x418525=ut[_0xd5ff('0xb4')](_0x5a6765,0xf,_0xd5ff('0x83'));rpcDb[_0xd5ff('0x6c')](_0x418525,_0xd5ff('0xda'));}else{rpcDb['createCustomerFinal'](_0x5a6765,_0xd5ff('0xda'));}delete this[_0xd5ff('0x17')][_0x1578e9[_0xd5ff('0x89')]];}else{_0xec628f['swapAdditionalPhones'](_0x5a6765,_0x24c60a,_0x4f7e4b)['then'](function(){});}});}if(!(_0x5a6765['dialAnswer']&&_0x2c5b63==='16')){utils[_0xd5ff('0x51')](_0x3b5388,_0xd5ff('0xdb'));logger[_0xd5ff('0x25')](_0xd5ff('0xdc'),_0x5a6765[_0xd5ff('0x92')],_0xd5ff('0xa7'),_0x3b5388[_0xd5ff('0x35')],_0xd5ff('0x47'),_0x3b5388['originated']);}if(_0x2c5b63!==_0xd5ff('0x8e')){delete this[_0xd5ff('0x17')][_0x1578e9[_0xd5ff('0x89')]];delete this[_0xd5ff('0x17')][_0x1578e9[_0xd5ff('0xdd')]];}_0x3b5388[_0xd5ff('0xde')]=!![];}};Preview['prototype'][_0xd5ff('0xdf')]=function(_0x5c2068,_0x3a1a58,_0x393f53){if(_[_0xd5ff('0xe0')](_0x3a1a58)&&_0xd5ff('0xe1')!==typeof _0x3a1a58){return;}if(_['isUndefined'](_0x393f53)&&_0xd5ff('0xe1')!==typeof _0x393f53){return;}switch(_0x393f53[_0xd5ff('0xe2')]){case'0':ut['logAgent'](_0x5c2068,0x0,_0xd5ff('0x7a'));rpcDb[_0xd5ff('0xe3')](_0x5c2068,_0xd5ff('0xe4'));break;case'3':ut[_0xd5ff('0xe5')](_0x5c2068,0x3,_0xd5ff('0xb0'));rpcDb['createAgentHistory'](_0x5c2068,_0xd5ff('0xe6'));break;case'5':ut[_0xd5ff('0xe5')](_0x5c2068,0x5,_0xd5ff('0xa9'));rpcDb[_0xd5ff('0xe3')](_0x5c2068,'[callProgressDetectingAgent][logBusy]');break;case'8':ut['logAgent'](_0x5c2068,0x8,'Congestion');rpcDb[_0xd5ff('0xe3')](_0x5c2068,_0xd5ff('0xe7'));break;case'22':ut[_0xd5ff('0xe5')](_0x5c2068,0x16,_0xd5ff('0xe8'));rpcDb[_0xd5ff('0xe3')](_0x5c2068,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut[_0xd5ff('0xe5')](_0x5c2068,0xc,_0x393f53[_0xd5ff('0xe2')]);rpcDb['createAgentHistory'](_0x5c2068,_0xd5ff('0xe7'));}utils[_0xd5ff('0x51')](_0x3a1a58,_0xd5ff('0xe9'));logger['info'](_0xd5ff('0xea'),_0x5c2068[_0xd5ff('0x92')],_0xd5ff('0xa7'),_0x3a1a58[_0xd5ff('0x35')],_0xd5ff('0x47'),_0x3a1a58['originated']);delete this[_0xd5ff('0x17')][_0x5c2068[_0xd5ff('0x92')]];};Preview['prototype'][_0xd5ff('0x7e')]=function(_0x124453,_0x2f8651,_0x429c87){return cmHopperAdditionalPhone['verifyAdditionalPhones'](_0x124453,_0x2f8651,_0x429c87)[_0xd5ff('0x4f')](logger['info'](_0xd5ff('0xeb')));};Preview[_0xd5ff('0xf')][_0xd5ff('0x8d')]=function(_0xf1e9dd,_0x9f14a2,_0x27eab9){return cmHopperAdditionalPhone['swapAdditionalPhones'](_0xf1e9dd,_0x9f14a2,_0x27eab9)['catch'](logger[_0xd5ff('0x25')]('[swapAdditionalPhone]\x20'));};Preview[_0xd5ff('0xf')][_0xd5ff('0x8b')]=function(_0x330c46){return Promise[_0xd5ff('0xec')]()[_0xd5ff('0x5a')](cmHopperAdditionalPhone['incrementPreviewCounters'](_0x330c46))[_0xd5ff('0x4f')](logger[_0xd5ff('0x25')](_0xd5ff('0xed')));};Preview[_0xd5ff('0xf')]['checkInBlack']=function(_0x4e0fe9,_0xe15796,_0x3ccaf4,_0x272845,_0x3faf5c){var _0x4e6687=this;return new Promise(function(_0x52d2dd,_0x4d360d){if(_[_0xd5ff('0x44')](_0xe15796)||_[_0xd5ff('0x44')](_0xe15796['Contact'])||_[_0xd5ff('0x44')](_0xe15796[_0xd5ff('0xee')])||_['isNil'](_0xe15796[_0xd5ff('0x4b')])){_0x4d360d(ut[_0xd5ff('0x31')](_0xd5ff('0xef'),_0x272845,_0x3faf5c));return;}var _0x5a9358=uuid['v4']();var _0x3d7f5e=_0x4e6687[_0xd5ff('0x14')][_0xe15796[_0xd5ff('0xf0')][_0xd5ff('0x35')]];var _0x54c471=_0x3ccaf4?_0x4e6687[_0xd5ff('0x18')][_0x3ccaf4]['id']:undefined;_0x4e6687[_0xd5ff('0x17')][_0x5a9358]=new Action(_0xe15796,_0x3d7f5e,_0x5a9358,_0x3ccaf4,_0x54c471);var _0x1fd81a=_0x4e6687['actions'][_0x5a9358];_0x1fd81a[_0xd5ff('0x87')]=_0x272845;_0x1fd81a[_0xd5ff('0x88')]=_0x3faf5c;_0x1fd81a['lookAgent']=_0x3ccaf4;if(_['isEmpty'](_0x4e0fe9)){_0x4e6687['execCall'](_0x1fd81a,_0x3d7f5e,_0xe15796,_0x3ccaf4)[_0xd5ff('0x5a')](function(_0x1d2919){logger['info']('[Preview][execCall][success]',_0xd5ff('0xf1')+_0x1fd81a[_0xd5ff('0x46')]+_0xd5ff('0xf2')+_0x1fd81a['idContact'],JSON[_0xd5ff('0x27')](_0x1d2919));ami[_0xd5ff('0x2b')](_0xd5ff('0xf3'),ut[_0xd5ff('0x95')](_0x1fd81a,_0xd5ff('0xf4'),_0x4e6687[_0xd5ff('0x14')][_0x1fd81a[_0xd5ff('0x46')]]));_0x52d2dd(ut[_0xd5ff('0x31')](_0xd5ff('0xf5')));})[_0xd5ff('0x4f')](function(_0xe9a0fe){ut[_0xd5ff('0x33')](_0xd5ff('0xf6'),_0xe9a0fe);_0x4d360d(ut[_0xd5ff('0x31')](_0xd5ff('0xf7'),_0x272845,_0x3faf5c));});}else{_0x3d7f5e[_0xd5ff('0xf8')]+=0x1;ut['logBlacklist'](_0x1fd81a);rpcDb[_0xd5ff('0xf9')](_0x1fd81a,_0xd5ff('0xfa'));delete _0x4e6687[_0xd5ff('0x17')][_0x5a9358];_0x4d360d(ut['message'](_0xd5ff('0xfb'),_0x272845,_0x3faf5c));}});};Preview[_0xd5ff('0xf')][_0xd5ff('0x71')]=function(_0x43fd75){return!_[_0xd5ff('0x44')](_0x43fd75)&&!_[_0xd5ff('0x44')](_0x43fd75[_0xd5ff('0x35')])&&!_[_0xd5ff('0x44')](_0x43fd75[_0xd5ff('0xfc')])&&_0x43fd75[_0xd5ff('0xfc')]&&!_[_0xd5ff('0x44')](this[_0xd5ff('0x16')][util[_0xd5ff('0x28')](_0xd5ff('0xfd'),_0x43fd75[_0xd5ff('0x35')])])&&!_[_0xd5ff('0x44')](this[_0xd5ff('0x16')][util[_0xd5ff('0x28')](_0xd5ff('0xfd'),_0x43fd75[_0xd5ff('0x35')])][_0xd5ff('0x4d')])&&(this['trunks'][util[_0xd5ff('0x28')](_0xd5ff('0xfd'),_0x43fd75[_0xd5ff('0x35')])]['status']===_0xd5ff('0xfe')||this['trunks'][util['format'](_0xd5ff('0xfd'),_0x43fd75[_0xd5ff('0x35')])][_0xd5ff('0x4d')]===_0xd5ff('0xff'));};Preview[_0xd5ff('0xf')]['run']=function(_0x528818,_0x1df2fe){return this[_0xd5ff('0x100')](_0x528818,_0x1df2fe)[_0xd5ff('0x5a')](function(_0x4302da){return _['pick'](_0x4302da,[_0xd5ff('0x31')]);})[_0xd5ff('0x4f')](function(_0x3e2818){if(_0x3e2818[_0xd5ff('0x101')]){rpcDb[_0xd5ff('0x102')](_0x528818);}if(_0x3e2818[_0xd5ff('0xfc')]){rpcDb[_0xd5ff('0x61')](_0x528818);}throw _[_0xd5ff('0x103')](_0x3e2818,[_0xd5ff('0x31')]);});};Preview['prototype'][_0xd5ff('0x100')]=function(_0x48a8d3,_0x294d3c){var _0x3d9b48=this;var _0x538f92,_0x4e3c47;return rpcDb[_0xd5ff('0x104')](_0x48a8d3)[_0xd5ff('0x5a')](function(_0x5c3186){if(!_[_0xd5ff('0x44')](_0x5c3186[0x0])){_0x4e3c47=_0x5c3186[0x0][_0xd5ff('0x105')]?![]:!![];_0x538f92=_0x5c3186[0x0][_0xd5ff('0x105')]?!![]:![];_0x538f92=_0x294d3c?!![]:_0x538f92;}var _0x2d5c7b=_0x3d9b48[_0xd5ff('0x106')](_0x5c3186);if(_0x2d5c7b[_0xd5ff('0x107')]){rpcDb[_0xd5ff('0x108')](_[_0xd5ff('0x103')](_0x5c3186[0x0],[_0xd5ff('0x4b'),_0xd5ff('0xee')]))[_0xd5ff('0x5a')](function(_0x59e340){_0x3d9b48[_0xd5ff('0x109')](_0x59e340,_0x5c3186[0x0],_0x294d3c,_0x4e3c47,_0x538f92)[_0xd5ff('0x5a')](function(_0x138195){return _0x138195;})[_0xd5ff('0x4f')](function(_0x6f69b1){throw _0x6f69b1;});})['catch'](function(_0x4fe4cd){ut[_0xd5ff('0x33')](_0xd5ff('0x10a'),_0x4fe4cd);throw ut['message']('Call\x20unsuccessful',_0x4e3c47,_0x538f92);});}else{throw ut[_0xd5ff('0x31')](_0x2d5c7b[_0xd5ff('0x31')],_0x4e3c47,_0x538f92);}})[_0xd5ff('0x4f')](function(_0x2ce231){ut[_0xd5ff('0x33')](_0xd5ff('0x10b'),_0x2ce231);throw ut['message'](_0xd5ff('0x10c'),![],!![]);});};Preview[_0xd5ff('0xf')][_0xd5ff('0x106')]=function(_0xec9cfb){if(_[_0xd5ff('0x44')](_0xec9cfb)||_[_0xd5ff('0x10d')](_0xec9cfb)||!_[_0xd5ff('0x44')](_0xec9cfb[0x0][_0xd5ff('0x5d')])&&_[_0xd5ff('0x44')](_0xec9cfb[0x0][_0xd5ff('0x5d')]['name'])){ut['logger']('[Preview][validateContact][Empty\x20Contact]',_0xec9cfb);return{'isValid':![],'message':'Empty\x20Contact'};}var _0x21634c=this['campaignsPreview'][_0xec9cfb[0x0]['Queue']['name']];_0x21634c[_0xd5ff('0x31')]=utils[_0xd5ff('0x37')][_0xd5ff('0x75')];if(_[_0xd5ff('0x44')](_0x21634c)){ut[_0xd5ff('0x33')](_0xd5ff('0x10e'),_0x21634c);return{'isValid':![],'message':'Empty\x20Campaign'};}if(!this['isTrunkReachable'](_0x21634c['Trunk'])){ut[_0xd5ff('0x33')]('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]',_0xd5ff('0x10f')+_0x21634c[_0xd5ff('0x35')]+_0xd5ff('0x110'));if(!this[_0xd5ff('0x71')](_0x21634c[_0xd5ff('0x73')])){ut['logger'](_0xd5ff('0x111'),_0x21634c[_0xd5ff('0x35')]+_0xd5ff('0x112'));return{'isValid':![],'message':_0xd5ff('0x113')};}}if(!ut[_0xd5ff('0x70')](_0x21634c[_0xd5ff('0x40')])){ut[_0xd5ff('0x33')](_0xd5ff('0x114'),_0x21634c[_0xd5ff('0x35')]+_0xd5ff('0x115'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x21634c[_0xd5ff('0x35')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':_0xd5ff('0x116')};};Preview[_0xd5ff('0xf')][_0xd5ff('0x117')]=function(_0x46da1d,_0x12c42d,_0x42d07d,_0x566a45){var _0x40eb14=this;return new Promise(function(_0xf77f33,_0x469b01){var _0x374482=_0x46da1d[_0xd5ff('0x92')];var _0x3efae7=_0x40eb14['isTrunkReachable'](_0x12c42d[_0xd5ff('0x72')])?util['format'](_0xd5ff('0x118'),_0x12c42d[_0xd5ff('0x72')][_0xd5ff('0x35')],_[_0xd5ff('0x44')](_0x12c42d[_0xd5ff('0x119')])?'':_0x12c42d['dialPrefix'][_0xd5ff('0x11a')]()||'',_0x12c42d[_0xd5ff('0x11b')]>0x0?_0x42d07d[_0xd5ff('0xee')]['substring'](_0x12c42d[_0xd5ff('0x11b')]):_0x42d07d['phone']):util[_0xd5ff('0x28')](_0xd5ff('0x118'),_['isNil'](_0x12c42d[_0xd5ff('0x73')])?_0x12c42d[_0xd5ff('0x72')][_0xd5ff('0x35')]:_0x12c42d[_0xd5ff('0x73')]['name'],_[_0xd5ff('0x44')](_0x12c42d['dialPrefix'])?'':_0x12c42d['dialPrefix']['trim']()||'',_0x12c42d[_0xd5ff('0x11b')]>0x0?_0x42d07d[_0xd5ff('0xee')][_0xd5ff('0x11c')](_0x12c42d[_0xd5ff('0x11b')]):_0x42d07d['phone']);var _0x1b6fd8=_0x40eb14[_0xd5ff('0x71')](_0x12c42d['Trunk'])?ut[_0xd5ff('0x11d')](_0x12c42d['Trunk'][_0xd5ff('0x11e')],_0x12c42d[_0xd5ff('0x11f')],_0x12c42d[_0xd5ff('0x120')]>0x0?ut['getCallerIdRandom'](_0x12c42d[_0xd5ff('0x121')],_0x12c42d['dialRandomLastDigitCallerIdNumber']):_0x12c42d['dialOriginateCallerIdNumber']):ut[_0xd5ff('0x11d')](_[_0xd5ff('0x44')](_0x12c42d[_0xd5ff('0x73')])?_0x12c42d[_0xd5ff('0x72')][_0xd5ff('0x11e')]:_0x12c42d['TrunkBackup'][_0xd5ff('0x11e')],_0x12c42d[_0xd5ff('0x11f')],_0x12c42d[_0xd5ff('0x120')]>0x0?ut[_0xd5ff('0x122')](_0x12c42d[_0xd5ff('0x121')],_0x12c42d[_0xd5ff('0x120')]):_0x12c42d[_0xd5ff('0x121')]);if(_0x1b6fd8){_0x46da1d['originatecalleridname']=ut[_0xd5ff('0x123')](_0x1b6fd8);_0x46da1d[_0xd5ff('0x124')]=ut[_0xd5ff('0x125')](_0x1b6fd8);}var _0x1ed76d=ut[_0xd5ff('0x126')](_0x12c42d,_0x42d07d,_0x3efae7,_0x1b6fd8,_0x374482,_0x46da1d);var _0x145c57=utils['setXMDContactVariables'](_0x42d07d[_0xd5ff('0x127')]);Object[_0xd5ff('0x128')](_0x1ed76d,_0x145c57);_[_0xd5ff('0x129')](_0x46da1d,ut[_0xd5ff('0x12a')](_0x1ed76d));_0x46da1d['starttime']=moment()[_0xd5ff('0x28')](_0xd5ff('0x62'));_0x12c42d[_0xd5ff('0x12b')]=_0x1ed76d;var _0x4762d6=ut[_0xd5ff('0x12c')](_0x46da1d,_0x12c42d,_0x1ed76d,_0x46da1d[_0xd5ff('0x88')],_0x566a45);return ami[_0xd5ff('0x12d')](_0x4762d6)['then'](function(_0x5a2602){_0x12c42d[_0xd5ff('0x2d')]+=0x1;logger[_0xd5ff('0x25')](_0xd5ff('0x12e'),_0x374482,'\x20Queue',_0x12c42d['name'],'originated:\x20',_0x12c42d['originated']);_0xf77f33(_0x5a2602);})[_0xd5ff('0x4f')](function(_0x29dcc4){ut[_0xd5ff('0xe5')](_0x46da1d,0xe,_0xd5ff('0x12f'));rpcDb[_0xd5ff('0xe3')](_0x46da1d,'[originateFailure][logOriginateFailure]');_0x469b01(_0x29dcc4);});});};Preview['prototype'][_0xd5ff('0x22')]=function(_0x1ac7ee){if(this[_0xd5ff('0x17')][_0x1ac7ee[_0xd5ff('0x89')]]){this[_0xd5ff('0x17')][_0x1ac7ee[_0xd5ff('0x89')]][_0xd5ff('0x4e')]=_0x1ac7ee[_0xd5ff('0x4e')];}};Preview[_0xd5ff('0xf')][_0xd5ff('0x130')]=function(_0x45eb2d){var _0x159b31=this;var _0x4a033f=this[_0xd5ff('0x17')][_0x45eb2d[_0xd5ff('0x131')]];if(_0x4a033f){if(_0x4a033f['lookAgent']&&this[_0xd5ff('0x18')][_0x4a033f[_0xd5ff('0x132')]]){ut[_0xd5ff('0x133')](_0x4a033f,this[_0xd5ff('0x18')][_0x4a033f['lookAgent']][_0xd5ff('0x35')],this[_0xd5ff('0x18')][_0x4a033f['lookAgent']]['id']);}var _0x18cec7=_['clone'](_0x4a033f);_0x18cec7['responsetime']=moment()[_0xd5ff('0x28')](_0xd5ff('0x62'));var _0x5d511f=_0x159b31[_0xd5ff('0x14')][_0x4a033f[_0xd5ff('0x46')]];if(ut[_0xd5ff('0x134')](_0x45eb2d[_0xd5ff('0x135')])){if(_0x4a033f[_0xd5ff('0x87')]){rpcDb[_0xd5ff('0x102')](_0x4a033f[_0xd5ff('0x8c')]);}if(_0x4a033f['activeContact']){rpcDb['disableContact'](_0x4a033f[_0xd5ff('0x8c')]);}ami[_0xd5ff('0x2b')](_0xd5ff('0x136'),ut[_0xd5ff('0x95')](_0x4a033f,_0xd5ff('0x137'),this[_0xd5ff('0x14')][_0x4a033f[_0xd5ff('0x46')]]));this[_0xd5ff('0xdf')](_0x18cec7,_0x5d511f,_0x45eb2d);}else{_0x4a033f['starttime']=moment()['format'](_0xd5ff('0x62'));ut['logAgent'](_0x18cec7,0x4,_0xd5ff('0xa0'));rpcDb['createAgentHistory'](_0x18cec7,_0xd5ff('0x138'));}}};Preview['prototype'][_0xd5ff('0x139')]=function(_0x1495f5){var _0x9bd8b2=this['actions'][_0x1495f5[_0xd5ff('0x89')]];var _0x355c1b;if(_0x9bd8b2){_0x355c1b=this[_0xd5ff('0x14')][_0x9bd8b2['queue']];logger['info'](_0xd5ff('0x13a'),_0x1495f5[_0xd5ff('0x89')],_0xd5ff('0xa7'),_0x355c1b['name'],'pTalking:\x20',_0x355c1b[_0xd5ff('0x93')]);}if(this[_0xd5ff('0x17')][_0x1495f5[_0xd5ff('0x89')]]&&_0x1495f5[_0xd5ff('0x89')]!==_0x1495f5['uniqueid']){if(_0x1495f5['cause']==='16'&&this[_0xd5ff('0x17')][_0x1495f5['linkedid']]['dialAnswer']){this[_0xd5ff('0x76')](_0x1495f5,_0x1495f5[_0xd5ff('0x89')],_0x1495f5['cause']);}else if(this['actions'][_0x1495f5[_0xd5ff('0x89')]][_0xd5ff('0x49')]){logger[_0xd5ff('0x25')](_0xd5ff('0x13b'),_0x1495f5[_0xd5ff('0x89')],_0x1495f5[_0xd5ff('0x13c')],_0xd5ff('0xa7'),_0x355c1b[_0xd5ff('0x35')],_0xd5ff('0x48'),_0x355c1b['pTalking']);this[_0xd5ff('0x76')](_0x1495f5,_0x1495f5['linkedid'],_0x1495f5[_0xd5ff('0x13c')]);}}else if(_0x9bd8b2&&_[_0xd5ff('0x44')](_0x9bd8b2['statedesc'])&&_0x355c1b[_0xd5ff('0x13d')]&&_0x1495f5[_0xd5ff('0x89')]===_0x1495f5[_0xd5ff('0x92')]&&_[_0xd5ff('0x44')](_0x1495f5[_0xd5ff('0xe2')])&&_0x1495f5[_0xd5ff('0x13c')]==='16'&&_0x1495f5[_0xd5ff('0x13e')]==='6'&&_[_0xd5ff('0xe0')](_0x9bd8b2['transfer'])){if(_0x9bd8b2[_0xd5ff('0x87')]){rpcDb['unlockContact'](_0x9bd8b2[_0xd5ff('0x8c')]);}if(_0x9bd8b2[_0xd5ff('0x88')]){rpcDb[_0xd5ff('0x61')](_0x9bd8b2[_0xd5ff('0x8c')]);}_0x1495f5['reason']='22';this[_0xd5ff('0xdf')](_0x9bd8b2,_0x355c1b,_0x1495f5);}else if(_0x9bd8b2&&_0x9bd8b2[_0xd5ff('0x13f')]){if(_0x1495f5[_0xd5ff('0x13c')]==='16'&&this[_0xd5ff('0x17')][_0x1495f5[_0xd5ff('0x89')]][_0xd5ff('0x49')]){logger[_0xd5ff('0x25')](_0xd5ff('0x140'),_0x1495f5[_0xd5ff('0x89')],_0x1495f5[_0xd5ff('0x13c')],_0xd5ff('0xa7'),_0x355c1b[_0xd5ff('0x35')],_0xd5ff('0x48'),_0x355c1b[_0xd5ff('0x93')]);this['callProgressDetectingCustomer'](_0x1495f5,_0x1495f5[_0xd5ff('0x89')],_0x1495f5[_0xd5ff('0x13c')]);}else if(this[_0xd5ff('0x17')][_0x1495f5[_0xd5ff('0x89')]][_0xd5ff('0x49')]){logger['info']('[syncHangup][talking][cause]',_0x1495f5['linkedid'],_0x1495f5['cause'],_0xd5ff('0xa7'),_0x355c1b[_0xd5ff('0x35')],_0xd5ff('0x48'),_0x355c1b[_0xd5ff('0x93')]);this['callProgressDetectingCustomer'](_0x1495f5,_0x1495f5[_0xd5ff('0x89')],_0x1495f5[_0xd5ff('0x13c')]);}}};Preview[_0xd5ff('0xf')][_0xd5ff('0x20')]=function(_0x42302e){if(this[_0xd5ff('0x17')][_0x42302e[_0xd5ff('0xdd')]]&&_0x42302e[_0xd5ff('0xdd')]!==_0x42302e[_0xd5ff('0x141')]){this[_0xd5ff('0x76')](_0x42302e,_0x42302e['destlinkedid'],_0x42302e[_0xd5ff('0xd2')]);}};Preview[_0xd5ff('0xf')][_0xd5ff('0x1e')]=function(_0x5d38c1){if(this[_0xd5ff('0x17')][_0x5d38c1[_0xd5ff('0x89')]]&&_0x5d38c1[_0xd5ff('0x89')]!==_0x5d38c1[_0xd5ff('0x92')]&&!this['actions'][_0x5d38c1[_0xd5ff('0x89')]][_0xd5ff('0x49')]){if(_0x5d38c1['cause']==='1'){this[_0xd5ff('0x76')](_0x5d38c1,_0x5d38c1[_0xd5ff('0x89')],_0x5d38c1[_0xd5ff('0x13c')]);}}};Preview['prototype']['addVariable']=function(_0x4e72d,_0x157203,_0xbdfda1){if(this[_0xd5ff('0x17')][_0x4e72d]){if(_['isNil'](this['actions'][_0x4e72d][_0xd5ff('0x12b')])){this[_0xd5ff('0x17')][_0x4e72d][_0xd5ff('0x12b')]={};}this[_0xd5ff('0x17')][_0x4e72d][_0xd5ff('0x12b')][_0x157203]=_0xbdfda1;}};Preview[_0xd5ff('0xf')][_0xd5ff('0x142')]=function(_0x8eac97){try{if(!_['isNil'](_0x8eac97)){if(ut[_0xd5ff('0x143')](_['keys'](_0x8eac97[_0xd5ff('0x144')])[0x0])){this[_0xd5ff('0x145')](_0x8eac97[_0xd5ff('0x92')],_[_0xd5ff('0x146')](_0x8eac97[_0xd5ff('0x144')])[0x0],_0x8eac97[_0xd5ff('0x147')]);}}}catch(_0x4fefe8){logger['error'](_0xd5ff('0x148'),util[_0xd5ff('0x149')](_0x4fefe8,{'showHidden':![],'depth':null}));}};Preview[_0xd5ff('0xf')][_0xd5ff('0x24')]=function(_0x4d3f0d){if(_0x4d3f0d){if(this[_0xd5ff('0x17')][_0x4d3f0d[_0xd5ff('0x14a')]]){this[_0xd5ff('0x17')][_0x4d3f0d[_0xd5ff('0x14a')]]['transfer']=!![];}}};Preview['prototype'][_0xd5ff('0x14b')]=function(_0x1faf34){if(_0x1faf34){if(this[_0xd5ff('0x17')][_0x1faf34['transfererlinkedid']]){this[_0xd5ff('0x17')][_0x1faf34[_0xd5ff('0x14c')]]['transfer']=!![];}}};module[_0xd5ff('0x14d')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 3ca37fb..48622bb 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 _0xe77e=['../rpc/cmHopperHistory','../rpc/agentReportPreview','../rpc/voiceQueueReport','[createHistory]\x20','then','createHistory','catch','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','getContactPreview','resolve','[getContactPreview]\x20','createAgentHistory','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercompleteAt','connectedlinename','membername','context','from-sip','exten','xcally-motion-preview','holdtime','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','create','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','preview','../rpc/cmHopper'];(function(_0x5dd293,_0x497bee){var _0xde50a4=function(_0x586246){while(--_0x586246){_0x5dd293['push'](_0x5dd293['shift']());}};_0xde50a4(++_0x497bee);}(_0xe77e,0x1ac));var _0xee77=function(_0xc827ef,_0x5eb01c){_0xc827ef=_0xc827ef-0x0;var _0x2b2e55=_0xe77e[_0xc827ef];return _0x2b2e55;};'use strict';var util=require(_0xee77('0x0'));var BPromise=require(_0xee77('0x1'));var logger=require('../../../config/logger')(_0xee77('0x2'));var cmHopper=require(_0xee77('0x3'));var cmHopperHistory=require(_0xee77('0x4'));var cmHopperBlack=require('../rpc/cmHopperBlack');var agentReportPreview=require(_0xee77('0x5'));var voiceQueueReport=require(_0xee77('0x6'));function loggerCatch(_0x2c44e5){return function(_0x4e2734){logger['error'](_0x2c44e5,util['inspect'](_0x4e2734,{'showHidden':![],'depth':null}));};}function create(_0x4d9afa){return cmHopperHistory['createHistory'](_0x4d9afa)['catch'](loggerCatch(_0xee77('0x7')));}function createAgent(_0x33247f){return BPromise['resolve']()[_0xee77('0x8')](agentReportPreview[_0xee77('0x9')](_0x33247f))[_0xee77('0xa')](loggerCatch(_0xee77('0x7')));}function moveContact(_0xd6890d){return cmHopper[_0xee77('0xb')](_0xd6890d,!![])[_0xee77('0xa')](loggerCatch(_0xee77('0xc')));}exports['checkIsBlackList']=function(_0x13eaa4){return cmHopperBlack[_0xee77('0xd')](_0x13eaa4)[_0xee77('0xa')](loggerCatch('[checkIsBlackList]\x20'));};exports[_0xee77('0xe')]=function(_0x14fd0c){return BPromise[_0xee77('0xf')]()[_0xee77('0x8')](cmHopper[_0xee77('0xe')](_0x14fd0c))[_0xee77('0xa')](loggerCatch(_0xee77('0x10')));};exports[_0xee77('0x9')]=function(_0xe383dc,_0x5f2d70){create(_0xe383dc)[_0xee77('0xa')](loggerCatch(_0x5f2d70));moveContact(_0xe383dc)[_0xee77('0xa')](loggerCatch(_0x5f2d70));};exports[_0xee77('0x11')]=function(_0x5edf02,_0x15ab12){createAgent(_0x5edf02)[_0xee77('0xa')](loggerCatch(_0x15ab12));};exports['createCustomerHistory']=function(_0xfd6744,_0x1af4e8){create(_0xfd6744)['catch'](loggerCatch(_0x1af4e8));};exports[_0xee77('0x12')]=function(_0xfc07d1,_0x4cc925){moveContact(_0xfc07d1)['catch'](loggerCatch(_0x4cc925));};exports[_0xee77('0x13')]=function(_0xeeeb25,_0x512d03,_0x5d7016){if(_0x512d03){_0xeeeb25[_0xee77('0x14')]=null;}if(_0x5d7016){_0xeeeb25[_0xee77('0x15')]=![];}return cmHopper[_0xee77('0x13')](_0xeeeb25)[_0xee77('0xa')](loggerCatch(_0xee77('0x16')));};exports[_0xee77('0x17')]=function(_0x51aadc){return cmHopper[_0xee77('0x17')](_0x51aadc)[_0xee77('0xa')](loggerCatch(_0xee77('0x18')));};exports[_0xee77('0x19')]=function(_0x4c05fb){return cmHopper[_0xee77('0x19')]({'UserId':null},_0x4c05fb,0x1)[_0xee77('0xa')](loggerCatch(_0xee77('0x1a')));};exports['disableContact']=function(_0x76d6c2){return cmHopper[_0xee77('0x19')]({'active':![]},_0x76d6c2,0x1)[_0xee77('0xa')](loggerCatch(_0xee77('0x1b')));};exports[_0xee77('0x1c')]=function(_0x343c7e){var _0x105941={};_0x105941[_0xee77('0x1d')]=_0x343c7e[_0xee77('0x1d')];_0x105941[_0xee77('0x1e')]=_0x343c7e[_0xee77('0x1e')];_0x105941[_0xee77('0x1f')]=_0x343c7e[_0xee77('0x1f')];_0x105941[_0xee77('0x20')]=_0x343c7e[_0xee77('0x20')];_0x105941['queue']=_0x343c7e[_0xee77('0x21')];_0x105941[_0xee77('0x22')]=_0x343c7e[_0xee77('0x23')];_0x105941[_0xee77('0x24')]=_0x343c7e[_0xee77('0x23')];_0x105941['queuecallercomplete']=0x1;_0x105941[_0xee77('0x25')]=_0x343c7e['endtime'];_0x105941[_0xee77('0x26')]=_0x343c7e[_0xee77('0x27')];_0x105941[_0xee77('0x28')]=_0xee77('0x29');_0x105941[_0xee77('0x2a')]=_0xee77('0x2b');_0x105941[_0xee77('0x2c')]=0x0;_0x105941[_0xee77('0x2d')]=0x1;_0x105941[_0xee77('0x2e')]=_0x343c7e['membername'];_0x105941[_0xee77('0x2f')]=_0xee77('0x30');return BPromise['resolve']()[_0xee77('0x8')](voiceQueueReport[_0xee77('0x31')](_0x105941))['catch'](loggerCatch('[voiceQueueReport]\x20'));};exports['getContactRecallMe']=function(_0x518300,_0x2130e3){return BPromise[_0xee77('0xf')]()[_0xee77('0x8')](cmHopper[_0xee77('0x32')](_0x518300,_0x2130e3))[_0xee77('0xa')](loggerCatch(_0xee77('0x33')));};exports[_0xee77('0x34')]=function(_0xa568dd){return cmHopper[_0xee77('0x13')](_0xa568dd,!![],!![])[_0xee77('0xa')](loggerCatch(_0xee77('0x35')));}; \ No newline at end of file +var _0x0b76=['../rpc/cmHopperBlack','../rpc/agentReportPreview','../rpc/voiceQueueReport','inspect','createHistory','catch','[createHistory]\x20','then','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','resolve','[getContactPreview]\x20','createCustomerHistory','rescheduleContact','UserId','active','[rescheduleContact]\x20','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerleaveAt','answertime','queuecallercomplete','queuecallercompleteAt','endtime','membername','exten','xcally-motion-preview','holdtime','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','../../../config/logger','preview','../rpc/cmHopper'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x0b76,0xfb));var _0x60b7=function(_0x4ea5cd,_0x58333f){_0x4ea5cd=_0x4ea5cd-0x0;var _0x2a7aaa=_0x0b76[_0x4ea5cd];return _0x2a7aaa;};'use strict';var util=require(_0x60b7('0x0'));var BPromise=require('bluebird');var logger=require(_0x60b7('0x1'))(_0x60b7('0x2'));var cmHopper=require(_0x60b7('0x3'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0x60b7('0x4'));var agentReportPreview=require(_0x60b7('0x5'));var voiceQueueReport=require(_0x60b7('0x6'));function loggerCatch(_0x39db2e){return function(_0x2b94ec){logger['error'](_0x39db2e,util[_0x60b7('0x7')](_0x2b94ec,{'showHidden':![],'depth':null}));};}function create(_0x3eb99c){return cmHopperHistory[_0x60b7('0x8')](_0x3eb99c)[_0x60b7('0x9')](loggerCatch(_0x60b7('0xa')));}function createAgent(_0x11a04e){return BPromise['resolve']()[_0x60b7('0xb')](agentReportPreview[_0x60b7('0x8')](_0x11a04e))[_0x60b7('0x9')](loggerCatch(_0x60b7('0xa')));}function moveContact(_0x57571a){return cmHopper['moveContactManagedDialer'](_0x57571a,!![])[_0x60b7('0x9')](loggerCatch('[moveContactManagedDialer]\x20'));}exports[_0x60b7('0xc')]=function(_0xf7bcec){return cmHopperBlack[_0x60b7('0xc')](_0xf7bcec)[_0x60b7('0x9')](loggerCatch(_0x60b7('0xd')));};exports[_0x60b7('0xe')]=function(_0x40c5f4){return BPromise[_0x60b7('0xf')]()[_0x60b7('0xb')](cmHopper['getContactPreview'](_0x40c5f4))[_0x60b7('0x9')](loggerCatch(_0x60b7('0x10')));};exports[_0x60b7('0x8')]=function(_0x96dc4e,_0x163ef9){create(_0x96dc4e)[_0x60b7('0x9')](loggerCatch(_0x163ef9));moveContact(_0x96dc4e)['catch'](loggerCatch(_0x163ef9));};exports['createAgentHistory']=function(_0x300b0f,_0x3aa533){createAgent(_0x300b0f)[_0x60b7('0x9')](loggerCatch(_0x3aa533));};exports[_0x60b7('0x11')]=function(_0x8aba41,_0x5eeee1){create(_0x8aba41)[_0x60b7('0x9')](loggerCatch(_0x5eeee1));};exports['createCustomerFinal']=function(_0x3d649a,_0x212092){moveContact(_0x3d649a)[_0x60b7('0x9')](loggerCatch(_0x212092));};exports[_0x60b7('0x12')]=function(_0xeed493,_0x21bb91,_0x30cefc){if(_0x21bb91){_0xeed493[_0x60b7('0x13')]=null;}if(_0x30cefc){_0xeed493[_0x60b7('0x14')]=![];}return cmHopper[_0x60b7('0x12')](_0xeed493)['catch'](loggerCatch(_0x60b7('0x15')));};exports['countReScheduled']=function(_0x2343b2){return cmHopper['countReScheduled'](_0x2343b2)[_0x60b7('0x9')](loggerCatch(_0x60b7('0x16')));};exports[_0x60b7('0x17')]=function(_0x54224a){return cmHopper[_0x60b7('0x17')]({'UserId':null},_0x54224a,0x1)[_0x60b7('0x9')](loggerCatch(_0x60b7('0x18')));};exports[_0x60b7('0x19')]=function(_0x5cf8ea){return cmHopper[_0x60b7('0x17')]({'active':![]},_0x5cf8ea,0x1)[_0x60b7('0x9')](loggerCatch(_0x60b7('0x1a')));};exports[_0x60b7('0x1b')]=function(_0x1e1bb1){var _0x142e4c={};_0x142e4c['type']=_0x1e1bb1[_0x60b7('0x1c')];_0x142e4c['uniqueid']=_0x1e1bb1[_0x60b7('0x1d')];_0x142e4c[_0x60b7('0x1e')]=_0x1e1bb1[_0x60b7('0x1e')];_0x142e4c[_0x60b7('0x1f')]=_0x1e1bb1[_0x60b7('0x1f')];_0x142e4c[_0x60b7('0x20')]=_0x1e1bb1[_0x60b7('0x20')];_0x142e4c['queuecallerjoinAt']=_0x1e1bb1['answertime'];_0x142e4c[_0x60b7('0x21')]=_0x1e1bb1[_0x60b7('0x22')];_0x142e4c[_0x60b7('0x23')]=0x1;_0x142e4c[_0x60b7('0x24')]=_0x1e1bb1[_0x60b7('0x25')];_0x142e4c['connectedlinename']=_0x1e1bb1[_0x60b7('0x26')];_0x142e4c['context']='from-sip';_0x142e4c[_0x60b7('0x27')]=_0x60b7('0x28');_0x142e4c[_0x60b7('0x29')]=0x0;_0x142e4c[_0x60b7('0x2a')]=0x1;_0x142e4c[_0x60b7('0x2b')]=_0x1e1bb1[_0x60b7('0x26')];_0x142e4c[_0x60b7('0x2c')]=_0x60b7('0x2d');return BPromise[_0x60b7('0xf')]()[_0x60b7('0xb')](voiceQueueReport[_0x60b7('0x2e')](_0x142e4c))['catch'](loggerCatch(_0x60b7('0x2f')));};exports['getContactRecallMe']=function(_0x240f6f,_0x46cc34){return BPromise[_0x60b7('0xf')]()[_0x60b7('0xb')](cmHopper['getContactRecallMe'](_0x240f6f,_0x46cc34))[_0x60b7('0x9')](loggerCatch(_0x60b7('0x30')));};exports[_0x60b7('0x31')]=function(_0x4bd228){return cmHopper[_0x60b7('0x12')](_0x4bd228,!![],!![])['catch'](loggerCatch(_0x60b7('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 c6622b1..9bc3159 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 _0xd71d=['isNil','addVariables','Queue','name','calleridname','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','\x22agi://%s/square,%s\x22','dialQueueProject','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','toLowerVariables','hasOwnProperty','toLower','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','starttime','responsetime','endtime','logAgent','ringtime','getSeconds','logLookAgent','membername','UserId','logCustomer','talktime','isFailure','variablesAction','BOOKED','uniqueid','originate','channelAgent','calleridnum','from-sip','timeout','countbusyretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','scheduledAt','active','scheduledat','add','minutes','ListId','decrementTalking','info','[decrementTalking]\x20object\x20talking\x20is\x20negative','[decrementTalking]\x20is\x20null\x20or\x20undefined','lastevent','motionChannel','mandatoryDisposition','buildObj','agentReadyId','not_inuse','reachable','push','getDiff','milliseconds','diff','seconds','createBody','filterKey','idContact','queue','type','campaigntype','dialAnswer','countcongestionretry','countglobal','callback','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-dialurl','xmd-dialoptions','xmd-dialid','xmd-cdrtype','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosbridged','rtpaudioqosrtt','bridgepeer','bridgepvtcallid','\x5cw{0,','pow','replace','extractCalleridName','match','noanswer','keys','forEach','lodash','moment','../../../../config/logger','preview','env','XCALLY_IP_AGI','127.0.0.1','loggerCatch','inspect','logger','loggerError','error','message','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive'];(function(_0x41fc70,_0x266337){var _0x56c859=function(_0x3d7449){while(--_0x3d7449){_0x41fc70['push'](_0x41fc70['shift']());}};_0x56c859(++_0x266337);}(_0xd71d,0xfd));var _0xdd71=function(_0x154192,_0x2d360f){_0x154192=_0x154192-0x0;var _0x3c2792=_0xd71d[_0x154192];return _0x3c2792;};'use strict';var util=require('util');var _=require(_0xdd71('0x0'));var moment=require(_0xdd71('0x1'));var logger=require(_0xdd71('0x2'))(_0xdd71('0x3'));var ipAgi=process[_0xdd71('0x4')][_0xdd71('0x5')]||_0xdd71('0x6');var utils=require('../../dialer/utils');exports[_0xdd71('0x7')]=function(_0x4a0f71){return function(_0x50a29b){logger['error'](_0x4a0f71,util[_0xdd71('0x8')](_0x50a29b,{'showHidden':![],'depth':null}));};};exports[_0xdd71('0x9')]=function(_0x12888f,_0x7bb3f4){logger['info'](_0x12888f,util[_0xdd71('0x8')](_0x7bb3f4,{'showHidden':![],'depth':null}));};exports[_0xdd71('0xa')]=function(_0x239fdb,_0x273e73){logger[_0xdd71('0xb')](_0x239fdb,util[_0xdd71('0x8')](_0x273e73,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x2e30f7){return function(_0xc5cc49){logger['info'](_0x2e30f7,util[_0xdd71('0x8')](_0xc5cc49,{'showHidden':![],'depth':null}));};};exports[_0xdd71('0xc')]=function(_0x5f3394,_0x49877c,_0x540c77){return{'message':_0x5f3394,'unlock':_0x49877c,'active':_0x540c77};};exports[_0xdd71('0xd')]=function(_0x54578a,_0x48c4f0,_0x57a533){if(!_[_0xdd71('0xe')](_0x57a533)&&'string'===typeof _0x57a533&&!_['isEmpty'](_0x57a533)){if(!_[_0xdd71('0xe')](_0x48c4f0)&&_0xdd71('0xf')===typeof _0x48c4f0&&!_[_0xdd71('0x10')](_0x48c4f0)){return util[_0xdd71('0x11')]('\x22%s\x22\x20<%s>',_0x48c4f0,_0x57a533);}return util[_0xdd71('0x11')](_0xdd71('0x12'),_0x57a533,_0x57a533);}if(!_['isUndefined'](_0x54578a)&&'string'===typeof _0x54578a&&!_['isEmpty'](_0x54578a)){return _0x54578a;}return _0xdd71('0x13');};exports[_0xdd71('0x14')]=function(_0x241c9c){if(_[_0xdd71('0x15')](_0x241c9c)){return![];}return _0x241c9c;};exports[_0xdd71('0x16')]=function(_0x40a3ef,_0x26dc5c,_0x544dd8,_0x1914de,_0x44c9de,_0x3bd280){var _0xa23d8c={'XMD-QUEUE':_0x26dc5c[_0xdd71('0x17')]?_0x26dc5c[_0xdd71('0x17')][_0xdd71('0x18')]:'','XMD-CALLERID':_0x1914de,'XMD-CALLERID-PREVIEW':_0x3bd280?util[_0xdd71('0x11')]('\x22%s\x22\x20<%s>',_0x3bd280[_0xdd71('0x19')],_0x3bd280['calleridnum']):_0x1914de,'XMD-DIALID':_0x44c9de,'XMD-CONTACTID':_0x26dc5c[_0xdd71('0x1a')],'XMD-CDRTYPE':_0xdd71('0x1b'),'CALLERID(all)':_0x1914de,'XMD-VOICEQUEUEID':_0x26dc5c[_0xdd71('0x1c')],'XMD-DIALCHANNEL':_0x544dd8,'XMD-DIALTIMEOUT':_0x40a3ef[_0xdd71('0x1d')]||0x1e,'XMD-DIALOPTIONS':util['format'](_0xdd71('0x1e'),_0x40a3ef[_0xdd71('0x1f')]?'g':'',_['isEmpty'](_0x40a3ef[_0xdd71('0x20')])?'':_0xdd71('0x21')),'XMD-DIALURL':_0x40a3ef['dialPreviewUrl']||'','XMD-AGI':_0x40a3ef['dialQueueProject']?util[_0xdd71('0x11')](_0xdd71('0x22'),ipAgi,_0x40a3ef[_0xdd71('0x23')]):_0xdd71('0x24'),'XMD-AGIAFTER':_0x40a3ef[_0xdd71('0x1f')]?util[_0xdd71('0x11')]('\x22agi://%s/square,%s\x22',ipAgi,_0x40a3ef[_0xdd71('0x1f')]):_0xdd71('0x24'),'XMD-ORIGINATECALLERIDNUM':_0x3bd280?_0x3bd280[_0xdd71('0x25')]:'','XMD-ORIGINATECALLERIDNAME':_0x3bd280?_0x3bd280[_0xdd71('0x26')]:'','XMD-DESTINATION':_0xdd71('0x27'),'SIPADDHEADER':_0xdd71('0x28')};if(!_[_0xdd71('0x10')](_0x40a3ef[_0xdd71('0x20')])){_0xa23d8c[util[_0xdd71('0x11')]('%s',_0xdd71('0x29'))]=_0x40a3ef['monitor_format'];_0xa23d8c[util['format']('%s',_0xdd71('0x2a'))]=_0x44c9de;}return _0xa23d8c;};exports[_0xdd71('0x2b')]=function(_0x46b231){var _0x40165d={};for(var _0x380135 in _0x46b231){if(_0x46b231[_0xdd71('0x2c')](_0x380135)){_0x40165d[util['format']('%s',_[_0xdd71('0x2d')](_0x380135))]=_0x46b231[_0x380135];}}return{'variables':_0x40165d};};exports[_0xdd71('0x2e')]=function(_0x1f0462){var _0xcaf3b3=moment()['format'](_0xdd71('0x2f'));_0x1f0462[_0xdd71('0x30')]=0xd;_0x1f0462[_0xdd71('0x31')]=_0xdd71('0x32');_0x1f0462[_0xdd71('0x33')]=_0xcaf3b3;_0x1f0462[_0xdd71('0x34')]=_0xcaf3b3;_0x1f0462[_0xdd71('0x35')]=_0xcaf3b3;};exports[_0xdd71('0x36')]=function(_0x530225,_0x244d35,_0x3ad04e){var _0x3f328b=moment()[_0xdd71('0x11')](_0xdd71('0x2f'));_0x530225[_0xdd71('0x30')]=_0x244d35;_0x530225[_0xdd71('0x31')]=_0x3ad04e;_0x530225[_0xdd71('0x34')]=_0x3f328b;_0x530225[_0xdd71('0x37')]=utils[_0xdd71('0x38')](_0x530225[_0xdd71('0x34')],_0x530225[_0xdd71('0x33')]);};exports[_0xdd71('0x39')]=function(_0x1819b9,_0x2a7be7,_0x2814ce){_0x1819b9[_0xdd71('0x3a')]=_0x2a7be7;_0x1819b9[_0xdd71('0x3b')]=_0x2814ce;};exports[_0xdd71('0x3c')]=function(_0x54229a,_0x3d3a61,_0x3b5103){var _0x104446=moment()['format'](_0xdd71('0x2f'));_0x54229a[_0xdd71('0x30')]=_0x3d3a61;_0x54229a[_0xdd71('0x31')]=_0x3b5103;_0x54229a[_0xdd71('0x34')]=_0x54229a['responsetime']?_0x54229a['responsetime']:_0x104446;_0x54229a['endtime']=_0x54229a[_0xdd71('0x35')]?_0x54229a[_0xdd71('0x35')]:_0x104446;_0x54229a['ringtime']=utils[_0xdd71('0x38')](_0x54229a[_0xdd71('0x34')]||0x0,_0x54229a[_0xdd71('0x33')]||0x0);_0x54229a[_0xdd71('0x3d')]=_0x54229a['answertime']?utils[_0xdd71('0x38')](_0x54229a[_0xdd71('0x35')],_0x54229a['answertime']):0x0;};exports[_0xdd71('0x3e')]=function(_0x597647){return _0x597647==='Failure';};exports[_0xdd71('0x3f')]=function(_0x20a7ba,_0x28beb8,_0x5f54bb,_0x291488,_0x34fd95){var _0x47b54a=_0x291488?'RECALL':_0x20a7ba['calleridname'];_0x47b54a=_0x34fd95?_0xdd71('0x40'):_0x47b54a;return{'actionid':_0x20a7ba[_0xdd71('0x41')],'action':_0xdd71('0x42'),'channel':_0x20a7ba[_0xdd71('0x43')],'callerid':util[_0xdd71('0x11')](_0xdd71('0x12'),_0x47b54a,_0x20a7ba[_0xdd71('0x44')]),'Exten':_0xdd71('0x27'),'Context':_0xdd71('0x45'),'Priority':'1','variable':_0x5f54bb,'timeout':(_0x28beb8[_0xdd71('0x46')]||0x1e)*0x3e8,'async':!![],'channelid':_0x20a7ba[_0xdd71('0x41')]};};exports['totalGlobal']=function(_0x6bd20e){return _0x6bd20e[_0xdd71('0x47')]+_0x6bd20e['countcongestionretry']+_0x6bd20e[_0xdd71('0x48')]+_0x6bd20e[_0xdd71('0x49')]+_0x6bd20e[_0xdd71('0x4a')];};exports[_0xdd71('0x4b')]=function(_0x2e8681){var _0x2d1080=_[_0xdd71('0x4c')](_0x2e8681);_0x2d1080[_0xdd71('0x30')]=0xf;_0x2d1080[_0xdd71('0x31')]='Global';return _0x2d1080;};exports[_0xdd71('0x4d')]=function(_0x4df644,_0x3a9d84,_0x1efd92){var _0x310ace={};_0x310ace[_0x3a9d84]=_0x4df644[_0x3a9d84];_0x310ace[_0xdd71('0x4e')]=![];_0x310ace[_0xdd71('0x4f')]=moment()[_0xdd71('0x50')](_0x1efd92,_0xdd71('0x51'))[_0xdd71('0x11')](_0xdd71('0x2f'));_0x310ace[_0xdd71('0x1a')]=_0x4df644[_0xdd71('0x1a')];_0x310ace[_0xdd71('0x52')]=_0x4df644[_0xdd71('0x52')];_0x310ace['VoiceQueueId']=_0x4df644[_0xdd71('0x1c')]||undefined;return _0x310ace;};exports[_0xdd71('0x53')]=function(_0x55718d,_0x146645){if(!_[_0xdd71('0x15')](_0x55718d)){if(_0x55718d['pTalking']>0x0){_0x55718d['pTalking']-=0x1;}else{logger[_0xdd71('0x54')](_0x146645,_0xdd71('0x55'));}}else{logger[_0xdd71('0xb')](_0x146645,_0xdd71('0x56'));}};exports['IsNotLoggedIn']=function(_0x2494a4){if(_0x2494a4<=0x0){return!![];}return![];};function buildObj(_0x462289,_0x3f4eb8,_0x4203a3){_0x462289[_0xdd71('0x57')]=_0x3f4eb8;_0x462289[_0xdd71('0x18')]=_0x462289['queue'];_0x462289['interface']=_0x462289['channelAgent'];_0x462289[_0xdd71('0x58')]='voice';if(_0x4203a3){_0x462289[_0xdd71('0x59')]=_0x4203a3[_0xdd71('0x59')];}return _0x462289;}exports[_0xdd71('0x5a')]=buildObj;exports[_0xdd71('0x5b')]=function(_0x35886a){var _0x753d7=[];for(var _0x598714 in _0x35886a){if(_0x35886a['hasOwnProperty'](_0x598714)){if(!_[_0xdd71('0x15')](_0x35886a[_0x598714])&&_0x35886a[_0x598714][_0xdd71('0x30')]===_0xdd71('0x5c')&&_0x35886a[_0x598714]['status']===_0xdd71('0x5d')){_0x753d7[_0xdd71('0x5e')](_0x35886a[_0x598714]['id']);}}}return _0x753d7;};exports[_0xdd71('0x5f')]=function(_0x1d8c5d){var _0x5d6412=moment()[_0xdd71('0x60')](0x0);var _0x39f547=moment(_0x1d8c5d)[_0xdd71('0x60')](0x0);return _0x5d6412[_0xdd71('0x61')](_0x39f547,_0xdd71('0x62'));};exports[_0xdd71('0x63')]=function(_0x342731){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x342731[_0xdd71('0x1a')],'ListId':_0x342731['ListId'],'VoiceQueueId':_0x342731[_0xdd71('0x1c')]||undefined,'CampaignId':_0x342731['CampaignId']||undefined};};exports[_0xdd71('0x64')]=function(_0xcfc49a){if(_0xcfc49a===_0xdd71('0x41')||_0xcfc49a===_0xdd71('0x65')||_0xcfc49a===_0xdd71('0x66')||_0xcfc49a===_0xdd71('0x67')||_0xcfc49a===_0xdd71('0x68')||_0xcfc49a===_0xdd71('0x69')||_0xcfc49a===_0xdd71('0x3a')||_0xcfc49a===_0xdd71('0x43')||_0xcfc49a===_0xdd71('0x19')||_0xcfc49a===_0xdd71('0x4e')||_0xcfc49a===_0xdd71('0x44')||_0xcfc49a==='scheduledat'||_0xcfc49a===_0xdd71('0x47')||_0xcfc49a===_0xdd71('0x6a')||_0xcfc49a===_0xdd71('0x48')||_0xcfc49a===_0xdd71('0x6b')||_0xcfc49a===_0xdd71('0x6c')||_0xcfc49a==='callbackuniqueid'||_0xcfc49a==='callbackat'||_0xcfc49a===_0xdd71('0x6d')||_0xcfc49a===_0xdd71('0x1a')||_0xcfc49a===_0xdd71('0x52')||_0xcfc49a===_0xdd71('0x3b')||_0xcfc49a===_0xdd71('0x1c')||_0xcfc49a===_0xdd71('0x6e')||_0xcfc49a===_0xdd71('0x6f')||_0xcfc49a===_0xdd71('0x70')||_0xcfc49a===_0xdd71('0x71')||_0xcfc49a==='xmd-listid'||_0xcfc49a===_0xdd71('0x72')||_0xcfc49a==='xmd-dialtimeout'||_0xcfc49a===_0xdd71('0x73')||_0xcfc49a===_0xdd71('0x74')||_0xcfc49a==='xmd-dialchannel'||_0xcfc49a==='xmd-contactid'||_0xcfc49a===_0xdd71('0x75')||_0xcfc49a==='xmd-callerid'||_0xcfc49a===_0xdd71('0x76')||_0xcfc49a===_0xdd71('0x77')||_0xcfc49a===_0xdd71('0x78')||_0xcfc49a==='rtpaudioqosbridged'||_0xcfc49a===_0xdd71('0x79')||_0xcfc49a===_0xdd71('0x7a')||_0xcfc49a===_0xdd71('0x7b')||_0xcfc49a===_0xdd71('0x7c')||_0xcfc49a==='rtpaudioqosrtt'||_0xcfc49a==='rtpaudioqosrttbridged'||_0xcfc49a===_0xdd71('0x78')||_0xcfc49a===_0xdd71('0x7d')||_0xcfc49a==='rtpaudioqosjitter'||_0xcfc49a===_0xdd71('0x7a')||_0xcfc49a===_0xdd71('0x7b')||_0xcfc49a==='rtpaudioqoslossbridged'||_0xcfc49a===_0xdd71('0x7e')||_0xcfc49a==='rtpaudioqosrttbridged'||_0xcfc49a===_0xdd71('0x7f')||_0xcfc49a===_0xdd71('0x80')||_0xcfc49a===_0xdd71('0x30')||_0xcfc49a===_0xdd71('0x31')){return![];}return!![];};exports['getCallerIdRandom']=function(_0x20facd,_0x5b206){var _0x11c4c5,_0x28a772,_0x264238;if(_0x5b206<=0x0){_0x5b206=0x1;}_0x11c4c5=new RegExp(_0xdd71('0x81')+_0x5b206+'}$');_0x28a772=Math['pow'](0xa,_0x5b206-0x1);_0x264238=Math[_0xdd71('0x82')](0xa,_0x5b206)-0x1;return util['format']('%s',_[_0xdd71('0x83')](_0x20facd,_0x11c4c5,_['random'](_0x28a772,_0x264238)));};exports[_0xdd71('0x84')]=function(_0x36485f){var _0x31177f=_0x36485f[_0xdd71('0x85')](/"(.*?)"/);return _0x31177f?_0x31177f[0x1]:_0x36485f;};exports['extractCalleridNumber']=function(_0x306210){var _0x38eb52=_0x306210[_0xdd71('0x85')](/<(.*?)>/);return _0x38eb52?_0x38eb52[0x1]:_0x306210;};function buildNoAnswerEventPayload(_0x1c3b67,_0x5af192){var _0x721077=buildObj(_0x1c3b67,_0xdd71('0x86'));if(!_[_0xdd71('0x10')](_0x5af192['variables'])){Object[_0xdd71('0x87')](_0x5af192['variables'])[_0xdd71('0x88')](function(_0x504444){_0x721077[_0x504444['toLowerCase']()]=_0x5af192['variables'][_0x504444];});}return _0x721077;}exports['buildNoAnswerEventPayload']=buildNoAnswerEventPayload; \ No newline at end of file +var _0xada8=['channelAgent','from-sip','timeout','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','cloneAction','clone','Global','scheduledat','add','minutes','VoiceQueueId','decrementTalking','isNil','pTalking','[decrementTalking]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','interface','motionChannel','voice','mandatoryDisposition','buildObj','agentReadyId','not_inuse','status','reachable','getDiff','milliseconds','diff','seconds','createBody','ListId','filterKey','idContact','queue','type','dialAnswer','active','countglobal','callback','callbackuniqueid','callbackat','recallme','sipcallid','xmd-queue','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrttbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','bridgepeer','bridgepvtcallid','replace','random','extractCalleridName','match','extractCalleridNumber','noanswer','variables','forEach','toLowerCase','lodash','moment','preview','127.0.0.1','loggerCatch','logger','info','error','inspect','message','getCallerId','string','isEmpty','isUndefined','format','\x22%s\x22\x20<%s>','isActive','Queue','name','calleridname','calleridnum','ContactId','dialer','dialOriginateTimeout','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','toLowerVariables','hasOwnProperty','toLower','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','starttime','endtime','logAgent','ringtime','getSeconds','responsetime','logLookAgent','membername','UserId','logCustomer','answertime','isFailure','Failure','variablesAction','RECALL','uniqueid'];(function(_0x57e7f8,_0x328bcd){var _0x39f93b=function(_0x478568){while(--_0x478568){_0x57e7f8['push'](_0x57e7f8['shift']());}};_0x39f93b(++_0x328bcd);}(_0xada8,0xcf));var _0x8ada=function(_0xb886fa,_0x434717){_0xb886fa=_0xb886fa-0x0;var _0x1ee927=_0xada8[_0xb886fa];return _0x1ee927;};'use strict';var util=require('util');var _=require(_0x8ada('0x0'));var moment=require(_0x8ada('0x1'));var logger=require('../../../../config/logger')(_0x8ada('0x2'));var ipAgi=process['env']['XCALLY_IP_AGI']||_0x8ada('0x3');var utils=require('../../dialer/utils');exports[_0x8ada('0x4')]=function(_0x5cdffc){return function(_0x4f5948){logger['error'](_0x5cdffc,util['inspect'](_0x4f5948,{'showHidden':![],'depth':null}));};};exports[_0x8ada('0x5')]=function(_0x5d93b5,_0x20c300){logger[_0x8ada('0x6')](_0x5d93b5,util['inspect'](_0x20c300,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0xd3e649,_0x4ac26e){logger[_0x8ada('0x7')](_0xd3e649,util[_0x8ada('0x8')](_0x4ac26e,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x17e37b){return function(_0x1e5714){logger[_0x8ada('0x6')](_0x17e37b,util['inspect'](_0x1e5714,{'showHidden':![],'depth':null}));};};exports[_0x8ada('0x9')]=function(_0x376c25,_0x318aa8,_0xcf8bd4){return{'message':_0x376c25,'unlock':_0x318aa8,'active':_0xcf8bd4};};exports[_0x8ada('0xa')]=function(_0x1e945d,_0x52dd63,_0x24d8ea){if(!_['isUndefined'](_0x24d8ea)&&_0x8ada('0xb')===typeof _0x24d8ea&&!_[_0x8ada('0xc')](_0x24d8ea)){if(!_[_0x8ada('0xd')](_0x52dd63)&&_0x8ada('0xb')===typeof _0x52dd63&&!_['isEmpty'](_0x52dd63)){return util[_0x8ada('0xe')](_0x8ada('0xf'),_0x52dd63,_0x24d8ea);}return util[_0x8ada('0xe')](_0x8ada('0xf'),_0x24d8ea,_0x24d8ea);}if(!_[_0x8ada('0xd')](_0x1e945d)&&_0x8ada('0xb')===typeof _0x1e945d&&!_[_0x8ada('0xc')](_0x1e945d)){return _0x1e945d;}return'\x22\x22\x20<>';};exports[_0x8ada('0x10')]=function(_0x5665f4){if(_['isNil'](_0x5665f4)){return![];}return _0x5665f4;};exports['addVariables']=function(_0x2d77ba,_0x2ff2e4,_0x287b5e,_0x3a9ed5,_0x42360e,_0x5408f6){var _0x1fe89e={'XMD-QUEUE':_0x2ff2e4['Queue']?_0x2ff2e4[_0x8ada('0x11')][_0x8ada('0x12')]:'','XMD-CALLERID':_0x3a9ed5,'XMD-CALLERID-PREVIEW':_0x5408f6?util[_0x8ada('0xe')]('\x22%s\x22\x20<%s>',_0x5408f6[_0x8ada('0x13')],_0x5408f6[_0x8ada('0x14')]):_0x3a9ed5,'XMD-DIALID':_0x42360e,'XMD-CONTACTID':_0x2ff2e4[_0x8ada('0x15')],'XMD-CDRTYPE':_0x8ada('0x16'),'CALLERID(all)':_0x3a9ed5,'XMD-VOICEQUEUEID':_0x2ff2e4['VoiceQueueId'],'XMD-DIALCHANNEL':_0x287b5e,'XMD-DIALTIMEOUT':_0x2d77ba[_0x8ada('0x17')]||0x1e,'XMD-DIALOPTIONS':util[_0x8ada('0xe')]('\x22rtTxX%s%s\x22',_0x2d77ba[_0x8ada('0x18')]?'g':'',_[_0x8ada('0xc')](_0x2d77ba[_0x8ada('0x19')])?'':_0x8ada('0x1a')),'XMD-DIALURL':_0x2d77ba[_0x8ada('0x1b')]||'','XMD-AGI':_0x2d77ba[_0x8ada('0x1c')]?util[_0x8ada('0xe')](_0x8ada('0x1d'),ipAgi,_0x2d77ba[_0x8ada('0x1c')]):'NONE','XMD-AGIAFTER':_0x2d77ba[_0x8ada('0x18')]?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0x2d77ba[_0x8ada('0x18')]):'NONE','XMD-ORIGINATECALLERIDNUM':_0x5408f6?_0x5408f6['originatecalleridnum']:'','XMD-ORIGINATECALLERIDNAME':_0x5408f6?_0x5408f6['originatecalleridname']:'','XMD-DESTINATION':_0x8ada('0x1e'),'SIPADDHEADER':'Call-Type:\x20PREVIEW'};if(!_[_0x8ada('0xc')](_0x2d77ba[_0x8ada('0x19')])){_0x1fe89e[util[_0x8ada('0xe')]('%s',_0x8ada('0x1f'))]=_0x2d77ba[_0x8ada('0x19')];_0x1fe89e[util['format']('%s',_0x8ada('0x20'))]=_0x42360e;}return _0x1fe89e;};exports[_0x8ada('0x21')]=function(_0x1809e1){var _0x54cc27={};for(var _0x32bedf in _0x1809e1){if(_0x1809e1[_0x8ada('0x22')](_0x32bedf)){_0x54cc27[util['format']('%s',_[_0x8ada('0x23')](_0x32bedf))]=_0x1809e1[_0x32bedf];}}return{'variables':_0x54cc27};};exports['logBlacklist']=function(_0x3be3e9){var _0x1ac539=moment()[_0x8ada('0xe')](_0x8ada('0x24'));_0x3be3e9[_0x8ada('0x25')]=0xd;_0x3be3e9[_0x8ada('0x26')]='Blacklist';_0x3be3e9[_0x8ada('0x27')]=_0x1ac539;_0x3be3e9['responsetime']=_0x1ac539;_0x3be3e9[_0x8ada('0x28')]=_0x1ac539;};exports[_0x8ada('0x29')]=function(_0x4aef23,_0x5817b6,_0x842512){var _0x1147dd=moment()['format'](_0x8ada('0x24'));_0x4aef23[_0x8ada('0x25')]=_0x5817b6;_0x4aef23['statedesc']=_0x842512;_0x4aef23['responsetime']=_0x1147dd;_0x4aef23[_0x8ada('0x2a')]=utils[_0x8ada('0x2b')](_0x4aef23[_0x8ada('0x2c')],_0x4aef23[_0x8ada('0x27')]);};exports[_0x8ada('0x2d')]=function(_0xae3487,_0x13300b,_0x53b943){_0xae3487[_0x8ada('0x2e')]=_0x13300b;_0xae3487[_0x8ada('0x2f')]=_0x53b943;};exports[_0x8ada('0x30')]=function(_0x2ea2f4,_0x1eed08,_0x53a8a2){var _0x3a6f3c=moment()[_0x8ada('0xe')](_0x8ada('0x24'));_0x2ea2f4[_0x8ada('0x25')]=_0x1eed08;_0x2ea2f4[_0x8ada('0x26')]=_0x53a8a2;_0x2ea2f4[_0x8ada('0x2c')]=_0x2ea2f4[_0x8ada('0x2c')]?_0x2ea2f4[_0x8ada('0x2c')]:_0x3a6f3c;_0x2ea2f4['endtime']=_0x2ea2f4[_0x8ada('0x28')]?_0x2ea2f4['endtime']:_0x3a6f3c;_0x2ea2f4[_0x8ada('0x2a')]=utils['getSeconds'](_0x2ea2f4['responsetime']||0x0,_0x2ea2f4[_0x8ada('0x27')]||0x0);_0x2ea2f4['talktime']=_0x2ea2f4[_0x8ada('0x31')]?utils[_0x8ada('0x2b')](_0x2ea2f4['endtime'],_0x2ea2f4[_0x8ada('0x31')]):0x0;};exports[_0x8ada('0x32')]=function(_0x5f14ac){return _0x5f14ac===_0x8ada('0x33');};exports[_0x8ada('0x34')]=function(_0x22f52d,_0x3bf024,_0x11ac83,_0x2ea7d9,_0x5d6552){var _0x21f8e9=_0x2ea7d9?_0x8ada('0x35'):_0x22f52d[_0x8ada('0x13')];_0x21f8e9=_0x5d6552?'BOOKED':_0x21f8e9;return{'actionid':_0x22f52d[_0x8ada('0x36')],'action':'originate','channel':_0x22f52d[_0x8ada('0x37')],'callerid':util[_0x8ada('0xe')](_0x8ada('0xf'),_0x21f8e9,_0x22f52d[_0x8ada('0x14')]),'Exten':_0x8ada('0x1e'),'Context':_0x8ada('0x38'),'Priority':'1','variable':_0x11ac83,'timeout':(_0x3bf024[_0x8ada('0x39')]||0x1e)*0x3e8,'async':!![],'channelid':_0x22f52d[_0x8ada('0x36')]};};exports[_0x8ada('0x3a')]=function(_0x46771f){return _0x46771f[_0x8ada('0x3b')]+_0x46771f[_0x8ada('0x3c')]+_0x46771f[_0x8ada('0x3d')]+_0x46771f['countagentrejectretry']+_0x46771f['countnosuchnumberretry'];};exports[_0x8ada('0x3e')]=function(_0x4ba557){var _0x3807ee=_[_0x8ada('0x3f')](_0x4ba557);_0x3807ee[_0x8ada('0x25')]=0xf;_0x3807ee[_0x8ada('0x26')]=_0x8ada('0x40');return _0x3807ee;};exports['scheduledAt']=function(_0x57ae45,_0x1475b5,_0x1656bc){var _0x39e545={};_0x39e545[_0x1475b5]=_0x57ae45[_0x1475b5];_0x39e545['active']=![];_0x39e545[_0x8ada('0x41')]=moment()[_0x8ada('0x42')](_0x1656bc,_0x8ada('0x43'))[_0x8ada('0xe')](_0x8ada('0x24'));_0x39e545['ContactId']=_0x57ae45[_0x8ada('0x15')];_0x39e545['ListId']=_0x57ae45['ListId'];_0x39e545[_0x8ada('0x44')]=_0x57ae45[_0x8ada('0x44')]||undefined;return _0x39e545;};exports[_0x8ada('0x45')]=function(_0x283e82,_0x304183){if(!_[_0x8ada('0x46')](_0x283e82)){if(_0x283e82[_0x8ada('0x47')]>0x0){_0x283e82[_0x8ada('0x47')]-=0x1;}else{logger[_0x8ada('0x6')](_0x304183,'[decrementTalking]\x20object\x20talking\x20is\x20negative');}}else{logger['error'](_0x304183,_0x8ada('0x48'));}};exports[_0x8ada('0x49')]=function(_0xc8c668){if(_0xc8c668<=0x0){return!![];}return![];};function buildObj(_0x2c7dc0,_0x112b6e,_0x2877f9){_0x2c7dc0['lastevent']=_0x112b6e;_0x2c7dc0[_0x8ada('0x12')]=_0x2c7dc0['queue'];_0x2c7dc0[_0x8ada('0x4a')]=_0x2c7dc0[_0x8ada('0x37')];_0x2c7dc0[_0x8ada('0x4b')]=_0x8ada('0x4c');if(_0x2877f9){_0x2c7dc0[_0x8ada('0x4d')]=_0x2877f9[_0x8ada('0x4d')];}return _0x2c7dc0;}exports[_0x8ada('0x4e')]=buildObj;exports[_0x8ada('0x4f')]=function(_0x1886a9){var _0xa62780=[];for(var _0x2cdd76 in _0x1886a9){if(_0x1886a9[_0x8ada('0x22')](_0x2cdd76)){if(!_[_0x8ada('0x46')](_0x1886a9[_0x2cdd76])&&_0x1886a9[_0x2cdd76][_0x8ada('0x25')]===_0x8ada('0x50')&&_0x1886a9[_0x2cdd76][_0x8ada('0x51')]===_0x8ada('0x52')){_0xa62780['push'](_0x1886a9[_0x2cdd76]['id']);}}}return _0xa62780;};exports[_0x8ada('0x53')]=function(_0x491f53){var _0x3ff651=moment()[_0x8ada('0x54')](0x0);var _0x7e0c78=moment(_0x491f53)[_0x8ada('0x54')](0x0);return _0x3ff651[_0x8ada('0x55')](_0x7e0c78,_0x8ada('0x56'));};exports[_0x8ada('0x57')]=function(_0x4db8fb){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x4db8fb[_0x8ada('0x15')],'ListId':_0x4db8fb[_0x8ada('0x58')],'VoiceQueueId':_0x4db8fb[_0x8ada('0x44')]||undefined,'CampaignId':_0x4db8fb['CampaignId']||undefined};};exports[_0x8ada('0x59')]=function(_0x1e058f){if(_0x1e058f==='uniqueid'||_0x1e058f===_0x8ada('0x5a')||_0x1e058f===_0x8ada('0x5b')||_0x1e058f===_0x8ada('0x5c')||_0x1e058f==='campaigntype'||_0x1e058f===_0x8ada('0x5d')||_0x1e058f==='membername'||_0x1e058f===_0x8ada('0x37')||_0x1e058f===_0x8ada('0x13')||_0x1e058f===_0x8ada('0x5e')||_0x1e058f===_0x8ada('0x14')||_0x1e058f===_0x8ada('0x41')||_0x1e058f===_0x8ada('0x3b')||_0x1e058f===_0x8ada('0x3c')||_0x1e058f===_0x8ada('0x3d')||_0x1e058f===_0x8ada('0x5f')||_0x1e058f===_0x8ada('0x60')||_0x1e058f===_0x8ada('0x61')||_0x1e058f===_0x8ada('0x62')||_0x1e058f===_0x8ada('0x63')||_0x1e058f===_0x8ada('0x15')||_0x1e058f===_0x8ada('0x58')||_0x1e058f==='UserId'||_0x1e058f===_0x8ada('0x44')||_0x1e058f===_0x8ada('0x64')||_0x1e058f==='xmd-voicequeueid'||_0x1e058f===_0x8ada('0x65')||_0x1e058f==='xmd-phone'||_0x1e058f===_0x8ada('0x66')||_0x1e058f===_0x8ada('0x67')||_0x1e058f===_0x8ada('0x68')||_0x1e058f===_0x8ada('0x69')||_0x1e058f===_0x8ada('0x6a')||_0x1e058f===_0x8ada('0x6b')||_0x1e058f===_0x8ada('0x6c')||_0x1e058f===_0x8ada('0x6d')||_0x1e058f===_0x8ada('0x6e')||_0x1e058f==='xmd-agiafter'||_0x1e058f===_0x8ada('0x6f')||_0x1e058f===_0x8ada('0x70')||_0x1e058f===_0x8ada('0x71')||_0x1e058f===_0x8ada('0x72')||_0x1e058f===_0x8ada('0x73')||_0x1e058f===_0x8ada('0x74')||_0x1e058f==='rtpaudioqoslossbridged'||_0x1e058f==='rtpaudioqosrtt'||_0x1e058f===_0x8ada('0x75')||_0x1e058f==='rtpaudioqos'||_0x1e058f===_0x8ada('0x71')||_0x1e058f==='rtpaudioqosjitter'||_0x1e058f===_0x8ada('0x73')||_0x1e058f===_0x8ada('0x74')||_0x1e058f===_0x8ada('0x76')||_0x1e058f===_0x8ada('0x77')||_0x1e058f==='rtpaudioqosrttbridged'||_0x1e058f===_0x8ada('0x78')||_0x1e058f===_0x8ada('0x79')||_0x1e058f===_0x8ada('0x25')||_0x1e058f==='statedesc'){return![];}return!![];};exports['getCallerIdRandom']=function(_0x19afd0,_0x310765){var _0x3b390f,_0x3e6e5c,_0x147316;if(_0x310765<=0x0){_0x310765=0x1;}_0x3b390f=new RegExp('\x5cw{0,'+_0x310765+'}$');_0x3e6e5c=Math['pow'](0xa,_0x310765-0x1);_0x147316=Math['pow'](0xa,_0x310765)-0x1;return util[_0x8ada('0xe')]('%s',_[_0x8ada('0x7a')](_0x19afd0,_0x3b390f,_[_0x8ada('0x7b')](_0x3e6e5c,_0x147316)));};exports[_0x8ada('0x7c')]=function(_0x31b7d9){var _0x353067=_0x31b7d9[_0x8ada('0x7d')](/"(.*?)"/);return _0x353067?_0x353067[0x1]:_0x31b7d9;};exports[_0x8ada('0x7e')]=function(_0x291c5f){var _0x173466=_0x291c5f[_0x8ada('0x7d')](/<(.*?)>/);return _0x173466?_0x173466[0x1]:_0x291c5f;};function buildNoAnswerEventPayload(_0x15ab5c,_0x53cc58){var _0x4533e2=buildObj(_0x15ab5c,_0x8ada('0x7f'));if(!_[_0x8ada('0xc')](_0x53cc58[_0x8ada('0x80')])){Object['keys'](_0x53cc58[_0x8ada('0x80')])[_0x8ada('0x81')](function(_0x1ecece){_0x4533e2[_0x1ecece[_0x8ada('0x82')]()]=_0x53cc58['variables'][_0x1ecece];});}return _0x4533e2;}exports['buildNoAnswerEventPayload']=buildNoAnswerEventPayload; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index bf0ab8c..8e81457 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 _0x8921=['voicequeuechannelhangup','voicequeuechannelredirect','queueadd','string','number','boolean','queueremove','reload','voicequeuechannel','voicechannel'];(function(_0x50fb35,_0x5be470){var _0x5f42e4=function(_0x1d0557){while(--_0x1d0557){_0x50fb35['push'](_0x50fb35['shift']());}};_0x5f42e4(++_0x5be470);}(_0x8921,0x124));var _0x1892=function(_0x487a50,_0x4a04c2){_0x487a50=_0x487a50-0x0;var _0x55a7f7=_0x8921[_0x487a50];return _0x55a7f7;};'use strict';exports[_0x1892('0x0')]={'queue':{'type':_0x1892('0x1'),'required':!![]},'interface':{'type':_0x1892('0x1'),'required':!![]},'membername':{'type':_0x1892('0x1'),'required':!![]},'penalty':{'type':_0x1892('0x2'),'required':![]},'paused':{'type':_0x1892('0x3'),'required':![]}};exports[_0x1892('0x4')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0x1892('0x1'),'required':!![]}};exports['queuepause']={'interface':{'type':_0x1892('0x1'),'required':!![]},'paused':{'type':_0x1892('0x3')},'reason':{'type':_0x1892('0x1'),'required':![]}};exports[_0x1892('0x5')]={'module':{'type':_0x1892('0x1'),'required':![]}};exports[_0x1892('0x6')]={'uniqueid':{'type':'string','required':!![]}};exports[_0x1892('0x7')]={'uniqueid':{'type':'string','required':!![]},'filename':{'type':'string'},'format':{'type':_0x1892('0x1')},'mixmonitorid':{'type':_0x1892('0x1')}};exports[_0x1892('0x8')]={'uniqueid':{'type':_0x1892('0x1'),'required':!![]}};exports[_0x1892('0x9')]={'uniqueid':{'type':_0x1892('0x1'),'required':!![]},'exten':{'type':_0x1892('0x1'),'required':!![]},'context':{'type':'string'}}; \ No newline at end of file +var _0x6298=['queuepause','voicequeuechannelredirect','queueadd','string','boolean','queueremove'];(function(_0x3cceb0,_0x132e6e){var _0x32dae3=function(_0x11925f){while(--_0x11925f){_0x3cceb0['push'](_0x3cceb0['shift']());}};_0x32dae3(++_0x132e6e);}(_0x6298,0xb0));var _0x8629=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6298[_0x3dd15e];return _0x231fd0;};'use strict';exports[_0x8629('0x0')]={'queue':{'type':_0x8629('0x1'),'required':!![]},'interface':{'type':_0x8629('0x1'),'required':!![]},'membername':{'type':'string','required':!![]},'penalty':{'type':'number','required':![]},'paused':{'type':_0x8629('0x2'),'required':![]}};exports[_0x8629('0x3')]={'queue':{'type':_0x8629('0x1'),'required':!![]},'interface':{'type':_0x8629('0x1'),'required':!![]}};exports[_0x8629('0x4')]={'interface':{'type':_0x8629('0x1'),'required':!![]},'paused':{'type':'boolean'},'reason':{'type':_0x8629('0x1'),'required':![]}};exports['reload']={'module':{'type':'string','required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':'string','required':!![]}};exports['voicechannel']={'uniqueid':{'type':_0x8629('0x1'),'required':!![]},'filename':{'type':_0x8629('0x1')},'format':{'type':_0x8629('0x1')},'mixmonitorid':{'type':_0x8629('0x1')}};exports['voicequeuechannelhangup']={'uniqueid':{'type':_0x8629('0x1'),'required':!![]}};exports[_0x8629('0x5')]={'uniqueid':{'type':_0x8629('0x1'),'required':!![]},'exten':{'type':_0x8629('0x1'),'required':!![]},'context':{'type':_0x8629('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index b53d6e9..56fae9f 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(_0x8caa3b,_0x24c42c){var _0x455bc4=function(_0x4bc850){while(--_0x4bc850){_0x8caa3b['push'](_0x8caa3b['shift']());}};_0x455bc4(++_0x24c42c);}(_0xb10b,0x12a));var _0xbb10=function(_0x42e1ec,_0x19aacc){_0x42e1ec=_0x42e1ec-0x0;var _0xe8c124=_0xb10b[_0x42e1ec];return _0xe8c124;};'use strict';var _=require(_0xbb10('0x0'));var moment=require('moment');var util=require(_0xbb10('0x1'));var Agent=require(_0xbb10('0x2'));var Telephone=require(_0xbb10('0x3'));var Trunk=require('../model/trunk');var VoiceQueue=require(_0xbb10('0x4'));var Trigger=require(_0xbb10('0x5'));var Template=require(_0xbb10('0x6'));var Campaign=require(_0xbb10('0x7'));var VoiceExtension=require(_0xbb10('0x8'));var ZendeskAccount=require(_0xbb10('0x9'));var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require(_0xbb10('0xa'));var SugarcrmAccount=require(_0xbb10('0xb'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require(_0xbb10('0xc'));var VtigerAccount=require(_0xbb10('0xd'));var ServicenowAccount=require(_0xbb10('0xe'));var Dynamics365Account=require(_0xbb10('0xf'));var FreshsalesAccount=require(_0xbb10('0x10'));var FaxAccount=require(_0xbb10('0x11'));function Realtime(){this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['trunks']={};this['voiceQueues']={};this[_0xbb10('0x14')]={};this[_0xbb10('0x15')]={};this[_0xbb10('0x16')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xbb10('0x17')]={};this['channels']={};this[_0xbb10('0x18')]={};this[_0xbb10('0x19')]={};this[_0xbb10('0x1a')]={};this[_0xbb10('0x1b')]={};this[_0xbb10('0x1c')]={};this[_0xbb10('0x1d')]={};this['sugarcrmAccounts']={};this[_0xbb10('0x1e')]={};this[_0xbb10('0x1f')]={};this[_0xbb10('0x20')]={};this[_0xbb10('0x21')]={};this[_0xbb10('0x22')]={};this[_0xbb10('0x23')]={};this[_0xbb10('0x24')]={};this[_0xbb10('0x25')]={};}function freeIsNotKey(_0x3e26f4,_0x2b184e,_0x4a2bfc){var _0x2eca0f=_[_0xbb10('0x26')](_0x3e26f4,function(_0x133ac2){return _0x133ac2[_0x4a2bfc];});for(var _0x42db98 in _0x2b184e){if(_0x2b184e[_0xbb10('0x27')](_0x42db98)){if(!_0x2eca0f[_0x42db98]){delete _0x2b184e[_0x42db98];}}}}function freeIsNotKeySip(_0x1682a4,_0x575cca){var _0x30efc6=_[_0xbb10('0x26')](_0x1682a4,function(_0xe1c665){return util['format'](_0xbb10('0x28'),_0xe1c665[_0xbb10('0x29')]);});for(var _0x388fab in _0x575cca){if(_0x575cca[_0xbb10('0x27')](_0x388fab)){if(!_0x30efc6[_0x388fab]){delete _0x575cca[_0x388fab];}}}}function freeIsNotKeyAgent(_0xdf237d,_0x44e563){var _0x4deb49=_[_0xbb10('0x26')](_0xdf237d,function(_0x12ef77){var _0x50aea1=_['isNil'](_0x12ef77[_0xbb10('0x2a')])?util[_0xbb10('0x2b')](_0xbb10('0x28'),_0x12ef77[_0xbb10('0x29')]):_0x12ef77[_0xbb10('0x2a')];return _0x50aea1;});for(var _0x1824b7 in _0x44e563){if(_0x44e563[_0xbb10('0x27')](_0x1824b7)){if(!_0x4deb49[_0x1824b7]){delete _0x44e563[_0x1824b7];}}}}function clearVoiceCallReports(_0x436104){_0x436104[_0xbb10('0x2c')]=0x0;_0x436104[_0xbb10('0x2d')]=0x0;_0x436104[_0xbb10('0x2e')]=0x0;_0x436104[_0xbb10('0x2f')]=0x0;_0x436104['sumBillable']=0x0;}function clearCampaigns(_0x4fedac){if(!_['isEmpty'](_0x4fedac)){for(var _0xc93a04 in _0x4fedac){if(_0x4fedac[_0xbb10('0x27')](_0xc93a04)){_0x4fedac[_0xc93a04][_0xbb10('0x30')]=0x0;_0x4fedac[_0xc93a04]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0x2fdde9){if(!_[_0xbb10('0x31')](_0x2fdde9)){for(var _0x6ed43b in _0x2fdde9){if(_0x2fdde9[_0xbb10('0x27')](_0x6ed43b)){_0x2fdde9[_0x6ed43b][_0xbb10('0x2c')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x2d')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x32')]=0x0;_0x2fdde9[_0x6ed43b]['abandoned']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x2e')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x2f')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x33')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x34')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x35')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x36')]=0x0;_0x2fdde9[_0x6ed43b]['outboundCongestionCallsDay']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x37')]=0x0;_0x2fdde9[_0x6ed43b]['outboundUnknownCallsDay']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x38')]=0x0;_0x2fdde9[_0x6ed43b]['outboundDropCallsDayCallersExit']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x39')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x3a')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x3b')]=0x0;_0x2fdde9[_0x6ed43b]['outboundReCallsDay']=0x0;_0x2fdde9[_0x6ed43b]['outboundAnswerAgiCallsDay']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x3c')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x3d')]=!![];}}}}Realtime['prototype'][_0xbb10('0x3e')]=function(_0x37dde7,_0x2f653f){for(var _0x1c0b57 in _0x2f653f){if(_0x37dde7[_0xbb10('0x27')](_0x1c0b57)){_0x37dde7[_0x1c0b57]=_0x2f653f[_0x1c0b57];}}};Realtime[_0xbb10('0x3f')][_0xbb10('0x40')]=function(){var _0x4975f5=this;return function(_0x25acb3){if(_0x25acb3){freeIsNotKeyAgent(_0x25acb3,_0x4975f5[_0xbb10('0x12')]);for(var _0x441d15=0x0,_0x8c1ce6={};_0x441d15<_0x25acb3[_0xbb10('0x41')];_0x441d15+=0x1){_0x8c1ce6=_0x25acb3[_0x441d15];var _0x9de708=_[_0xbb10('0x42')](_0x8c1ce6[_0xbb10('0x2a')])?util[_0xbb10('0x2b')]('SIP/%s',_0x8c1ce6[_0xbb10('0x29')]):_0x8c1ce6[_0xbb10('0x2a')];if(_[_0xbb10('0x43')](_0x4975f5[_0xbb10('0x12')][_0x9de708])){_0x4975f5['agents'][_0x9de708]=new Agent(_0x8c1ce6);}else{_0x4975f5[_0xbb10('0x3e')](_0x4975f5['agents'][_0x9de708],_0x8c1ce6);}}}return _0x4975f5['agents'];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x44')]=function(){var _0x26e76a=this;return function(_0x120d21){if(_0x120d21){freeIsNotKeySip(_0x120d21,_0x26e76a[_0xbb10('0x13')]);for(var _0x29d11a=0x0,_0x547062={};_0x29d11a<_0x120d21[_0xbb10('0x41')];_0x29d11a+=0x1){_0x547062=_0x120d21[_0x29d11a];if(_[_0xbb10('0x43')](_0x26e76a['telephones'][util['format']('SIP/%s',_0x547062[_0xbb10('0x29')])])){_0x26e76a[_0xbb10('0x13')][util[_0xbb10('0x2b')]('SIP/%s',_0x547062[_0xbb10('0x29')])]=new Telephone(_0x547062);}else{_0x26e76a[_0xbb10('0x3e')](_0x26e76a[_0xbb10('0x13')][util['format'](_0xbb10('0x28'),_0x547062[_0xbb10('0x29')])],_0x547062);}}}return _0x26e76a[_0xbb10('0x13')];};};Realtime[_0xbb10('0x3f')]['initTrunks']=function(){var _0xd238e9=this;return function(_0x110eb5){if(_0x110eb5){freeIsNotKeySip(_0x110eb5,_0xd238e9['trunks']);for(var _0xe2040f=0x0,_0x2e3214={};_0xe2040f<_0x110eb5[_0xbb10('0x41')];_0xe2040f+=0x1){_0x2e3214=_0x110eb5[_0xe2040f];if(_[_0xbb10('0x43')](_0xd238e9[_0xbb10('0x45')][util[_0xbb10('0x2b')]('SIP/%s',_0x2e3214[_0xbb10('0x29')])])){_0xd238e9[_0xbb10('0x45')][util[_0xbb10('0x2b')](_0xbb10('0x28'),_0x2e3214['name'])]=new Trunk(_0x2e3214);}else{_0xd238e9[_0xbb10('0x3e')](_0xd238e9[_0xbb10('0x45')][util[_0xbb10('0x2b')](_0xbb10('0x28'),_0x2e3214['name'])],_0x2e3214);}}}return _0xd238e9[_0xbb10('0x45')];};};Realtime[_0xbb10('0x3f')]['initTriggers']=function(){var _0x5d9a4f=this;return function(_0x38d78f){if(_0x38d78f){freeIsNotKey(_0x38d78f,_0x5d9a4f['triggers'],'id');for(var _0x318984=0x0,_0x180933={};_0x318984<_0x38d78f['length'];_0x318984+=0x1){_0x180933=_0x38d78f[_0x318984];if(_[_0xbb10('0x43')](_0x5d9a4f[_0xbb10('0x14')][_0x180933['id']])){_0x5d9a4f[_0xbb10('0x14')][_0x180933['id']]=new Trigger(_0x180933);}else{_0x5d9a4f['mergeFromDatabase'](_0x5d9a4f[_0xbb10('0x14')][_0x180933['id']],_0x180933);}}}return _0x5d9a4f[_0xbb10('0x14')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x46')]=function(){var _0x36e1fa=this;return function(_0x19f94d){if(_0x19f94d){freeIsNotKey(_0x19f94d,_0x36e1fa[_0xbb10('0x16')],'id');for(var _0x3efa96=0x0,_0x205bb4={};_0x3efa96<_0x19f94d[_0xbb10('0x41')];_0x3efa96+=0x1){_0x205bb4=_0x19f94d[_0x3efa96];if(_[_0xbb10('0x43')](_0x36e1fa[_0xbb10('0x16')][_0x205bb4['id']])){_0x36e1fa['templates'][_0x205bb4['id']]=new Template(_0x205bb4);}else{_0x36e1fa[_0xbb10('0x3e')](_0x36e1fa[_0xbb10('0x16')][_0x205bb4['id']],_0x205bb4);}}}return _0x36e1fa['templates'];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x47')]=function(){var _0x1a7df6=this;return function(_0x5a5226){if(_0x5a5226){freeIsNotKey(_0x5a5226,_0x1a7df6[_0xbb10('0x1c')],'id');for(var _0x39f0de=0x0,_0x3e06b0={};_0x39f0de<_0x5a5226['length'];_0x39f0de+=0x1){_0x3e06b0=_0x5a5226[_0x39f0de];if(_['isUndefined'](_0x1a7df6[_0xbb10('0x1c')][_0x3e06b0['id']])){_0x1a7df6[_0xbb10('0x1c')][_0x3e06b0['id']]=new ZendeskAccount(_0x3e06b0);}else{_0x1a7df6[_0xbb10('0x3e')](_0x1a7df6['zendeskAccounts'][_0x3e06b0['id']],_0x3e06b0);}}}return _0x1a7df6['zendeskAccounts'];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x48')]=function(){var _0x1bd054=this;return function(_0xf820fe){if(_0xf820fe){freeIsNotKey(_0xf820fe,_0x1bd054[_0xbb10('0x1d')],'id');for(var _0x22b315=0x0,_0x2f2552={};_0x22b315<_0xf820fe[_0xbb10('0x41')];_0x22b315+=0x1){_0x2f2552=_0xf820fe[_0x22b315];if(_[_0xbb10('0x43')](_0x1bd054[_0xbb10('0x1d')][_0x2f2552['id']])){_0x1bd054['salesforceAccounts'][_0x2f2552['id']]=new SalesforceAccount(_0x2f2552);}else{_0x1bd054['mergeFromDatabase'](_0x1bd054[_0xbb10('0x1d')][_0x2f2552['id']],_0x2f2552);}}}return _0x1bd054[_0xbb10('0x1d')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x49')]=function(){var _0x36aa7d=this;return function(_0x440f9e){if(_0x440f9e){freeIsNotKey(_0x440f9e,_0x36aa7d[_0xbb10('0x1e')],'id');for(var _0x445870=0x0,_0x1c0d8f={};_0x445870<_0x440f9e[_0xbb10('0x41')];_0x445870+=0x1){_0x1c0d8f=_0x440f9e[_0x445870];if(_[_0xbb10('0x43')](_0x36aa7d[_0xbb10('0x1e')][_0x1c0d8f['id']])){_0x36aa7d[_0xbb10('0x1e')][_0x1c0d8f['id']]=new FreshdeskAccount(_0x1c0d8f);}else{_0x36aa7d[_0xbb10('0x3e')](_0x36aa7d[_0xbb10('0x1e')][_0x1c0d8f['id']],_0x1c0d8f);}}}return _0x36aa7d['freshdeskAccounts'];};};Realtime[_0xbb10('0x3f')]['initZohoAccounts']=function(){var _0x33d60a=this;return function(_0x2e21a0){if(_0x2e21a0){freeIsNotKey(_0x2e21a0,_0x33d60a[_0xbb10('0x1f')],'id');for(var _0x3f27ce=0x0,_0x26e66e={};_0x3f27ce<_0x2e21a0[_0xbb10('0x41')];_0x3f27ce+=0x1){_0x26e66e=_0x2e21a0[_0x3f27ce];if(_[_0xbb10('0x43')](_0x33d60a[_0xbb10('0x1f')][_0x26e66e['id']])){_0x33d60a[_0xbb10('0x1f')][_0x26e66e['id']]=new ZohoAccount(_0x26e66e);}else{_0x33d60a[_0xbb10('0x3e')](_0x33d60a[_0xbb10('0x1f')][_0x26e66e['id']],_0x26e66e);}}}return _0x33d60a[_0xbb10('0x1f')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x4a')]=function(){var _0x4475e1=this;return function(_0x5de0cc){if(_0x5de0cc){freeIsNotKey(_0x5de0cc,_0x4475e1[_0xbb10('0x20')],'id');for(var _0x466eb7=0x0,_0x1b83a9={};_0x466eb7<_0x5de0cc[_0xbb10('0x41')];_0x466eb7+=0x1){_0x1b83a9=_0x5de0cc[_0x466eb7];if(_[_0xbb10('0x43')](_0x4475e1[_0xbb10('0x20')][_0x1b83a9['id']])){_0x4475e1['deskAccounts'][_0x1b83a9['id']]=new DeskAccount(_0x1b83a9);}else{_0x4475e1[_0xbb10('0x3e')](_0x4475e1[_0xbb10('0x20')][_0x1b83a9['id']],_0x1b83a9);}}}return _0x4475e1[_0xbb10('0x20')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x4b')]=function(){var _0x22de7f=this;return function(_0x175872){if(_0x175872){freeIsNotKey(_0x175872,_0x22de7f[_0xbb10('0x4c')],'id');for(var _0x205e01=0x0,_0x40c4fb={};_0x205e01<_0x175872[_0xbb10('0x41')];_0x205e01+=0x1){_0x40c4fb=_0x175872[_0x205e01];if(_[_0xbb10('0x43')](_0x22de7f[_0xbb10('0x4c')][_0x40c4fb['id']])){_0x22de7f['sugarcrmAccounts'][_0x40c4fb['id']]=new SugarcrmAccount(_0x40c4fb);}else{_0x22de7f['mergeFromDatabase'](_0x22de7f[_0xbb10('0x4c')][_0x40c4fb['id']],_0x40c4fb);}}}return _0x22de7f[_0xbb10('0x4c')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x4d')]=function(){var _0x5573bb=this;return function(_0x506498){if(_0x506498){freeIsNotKey(_0x506498,_0x5573bb[_0xbb10('0x21')],'id');for(var _0xaf2cc3=0x0,_0x410bef={};_0xaf2cc3<_0x506498[_0xbb10('0x41')];_0xaf2cc3+=0x1){_0x410bef=_0x506498[_0xaf2cc3];if(_[_0xbb10('0x43')](_0x5573bb[_0xbb10('0x21')][_0x410bef['id']])){_0x5573bb[_0xbb10('0x21')][_0x410bef['id']]=new VtigerAccount(_0x410bef);}else{_0x5573bb['mergeFromDatabase'](_0x5573bb[_0xbb10('0x21')][_0x410bef['id']],_0x410bef);}}}return _0x5573bb[_0xbb10('0x21')];};};Realtime['prototype']['initServicenowAccounts']=function(){var _0x5a231f=this;return function(_0x32c1e8){if(_0x32c1e8){freeIsNotKey(_0x32c1e8,_0x5a231f[_0xbb10('0x22')],'id');for(var _0x155dc5=0x0,_0x5bd1c0={};_0x155dc5<_0x32c1e8['length'];_0x155dc5+=0x1){_0x5bd1c0=_0x32c1e8[_0x155dc5];if(_['isUndefined'](_0x5a231f[_0xbb10('0x22')][_0x5bd1c0['id']])){_0x5a231f[_0xbb10('0x22')][_0x5bd1c0['id']]=new ServicenowAccount(_0x5bd1c0);}else{_0x5a231f[_0xbb10('0x3e')](_0x5a231f['servicenowAccounts'][_0x5bd1c0['id']],_0x5bd1c0);}}}return _0x5a231f[_0xbb10('0x22')];};};Realtime[_0xbb10('0x3f')]['initDynamics365Accounts']=function(){var _0x4a560c=this;return function(_0x27d7b9){if(_0x27d7b9){freeIsNotKey(_0x27d7b9,_0x4a560c[_0xbb10('0x23')],'id');for(var _0xd77753=0x0,_0x237246={};_0xd77753<_0x27d7b9['length'];_0xd77753+=0x1){_0x237246=_0x27d7b9[_0xd77753];if(_[_0xbb10('0x43')](_0x4a560c[_0xbb10('0x23')][_0x237246['id']])){_0x4a560c[_0xbb10('0x23')][_0x237246['id']]=new Dynamics365Account(_0x237246);}else{_0x4a560c['mergeFromDatabase'](_0x4a560c[_0xbb10('0x23')][_0x237246['id']],_0x237246);}}}return _0x4a560c[_0xbb10('0x23')];};};Realtime[_0xbb10('0x3f')]['initFreshsalesAccounts']=function(){var _0x2ca491=this;return function(_0x31e85e){if(_0x31e85e){freeIsNotKey(_0x31e85e,_0x2ca491[_0xbb10('0x24')],'id');for(var _0x37b65f=0x0,_0x5e4a6e={};_0x37b65f<_0x31e85e[_0xbb10('0x41')];_0x37b65f+=0x1){_0x5e4a6e=_0x31e85e[_0x37b65f];if(_[_0xbb10('0x43')](_0x2ca491[_0xbb10('0x24')][_0x5e4a6e['id']])){_0x2ca491[_0xbb10('0x24')][_0x5e4a6e['id']]=new FreshsalesAccount(_0x5e4a6e);}else{_0x2ca491['mergeFromDatabase'](_0x2ca491[_0xbb10('0x24')][_0x5e4a6e['id']],_0x5e4a6e);}}}return _0x2ca491[_0xbb10('0x24')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x4e')]=function(){var _0x12f750=this;return function(_0x17807e){for(var _0x1e4694=0x0;_0x1e4694<_0x17807e['length'];_0x1e4694+=0x1){_['merge'](_0x12f750['voiceQueues'][_0x17807e[_0x1e4694][_0xbb10('0x29')]],_0x17807e[_0x1e4694]);}return _0x12f750[_0xbb10('0x4f')];};};Realtime[_0xbb10('0x3f')]['initVoiceQueueReports']=function(){var _0x5cd089=this;return function(_0x46f462){clearVoiceQueues(_0x5cd089[_0xbb10('0x4f')]);if(_0x46f462){_0x46f462=_[_0xbb10('0x50')](_0x46f462,_0xbb10('0x51'));for(var _0x260e06 in _0x46f462){if(_0x46f462[_0xbb10('0x27')](_0x260e06)){for(var _0x4cf2f3=0x0;_0x4cf2f3<_0x46f462[_0x260e06][_0xbb10('0x41')];_0x4cf2f3+=0x1){var _0x15fae2=_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x52')];if(_0x5cd089[_0xbb10('0x4f')][_0x15fae2]){if(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x53')]){_0x5cd089['voiceQueues'][_0x15fae2]['unmanaged']+=0x1;}if(_0x46f462[_0x260e06][_0x4cf2f3]['queuecallerabandon']){_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x54')]+=0x1;}_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x2e')]+=moment(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x55')])[_0xbb10('0x56')](moment(_0x46f462[_0x260e06][_0x4cf2f3]['queuecallerjoinAt']),_0xbb10('0x57'))||0x0;if(_0x4cf2f3===_0x46f462[_0x260e06]['length']-0x1){_0x5cd089['voiceQueues'][_0x15fae2]['sumDuration']+=moment(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x58')]||_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x59')]||_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x5a')])[_0xbb10('0x56')](moment(_0x46f462[_0x260e06][_0x4cf2f3]['queuecallerjoinAt']),_0xbb10('0x57'))||0x0;_0x5cd089['voiceQueues'][_0x15fae2]['total']+=0x1;if(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x5b')]){_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x2d')]+=0x1;_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x33')]+=moment(_0x46f462[_0x260e06][_0x4cf2f3]['queuecallercompleteAt'])[_0xbb10('0x56')](moment(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x55')]),_0xbb10('0x57'))||0x0;}}else{_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x2f')]+=_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x2e')]||0x0;}}}}}}return _0x5cd089['voiceQueues'];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x5c')]=function(){var _0x30f3ea=this;return function(_0x322b41){clearVoiceCallReports(_0x30f3ea[_0xbb10('0x5d')]);if(_0x322b41){for(var _0x172be3=0x0;_0x172be3<_0x322b41[_0xbb10('0x41')];_0x172be3+=0x1){_0x30f3ea[_0xbb10('0x5d')]['total']+=0x1;_0x30f3ea[_0xbb10('0x5d')][_0xbb10('0x2f')]+=_0x322b41[_0x172be3][_0xbb10('0x5e')];if(_0x322b41[_0x172be3]['disposition']==='ANSWERED'){_0x30f3ea['outbound'][_0xbb10('0x2d')]+=0x1;_0x30f3ea['outbound']['sumHoldTime']+=_0x322b41[_0x172be3][_0xbb10('0x5e')]-_0x322b41[_0x172be3][_0xbb10('0x5f')]||0x0;_0x30f3ea[_0xbb10('0x5d')][_0xbb10('0x33')]+=_0x322b41[_0x172be3][_0xbb10('0x5f')];}}}return _0x30f3ea[_0xbb10('0x5d')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x60')]=function(){var _0x188b97=this;return function(_0x5206e1){if(_0x5206e1){freeIsNotKey(_0x5206e1,_0x188b97[_0xbb10('0x15')],_0xbb10('0x29'));for(var _0x46b6d2=0x0,_0x35b811={};_0x46b6d2<_0x5206e1['length'];_0x46b6d2+=0x1){_0x35b811=_0x5206e1[_0x46b6d2];if(_['isUndefined'](_0x188b97[_0xbb10('0x15')][_0x35b811[_0xbb10('0x29')]])){_0x188b97[_0xbb10('0x15')][_0x35b811[_0xbb10('0x29')]]=new Campaign(_0x35b811);}else{_0x188b97['mergeFromDatabase'](_0x188b97[_0xbb10('0x15')][_0x35b811[_0xbb10('0x29')]],_0x35b811);_0x188b97[_0xbb10('0x15')][_0x35b811[_0xbb10('0x29')]][_0xbb10('0x61')]=_0x35b811['SquareProject']?_0x35b811['SquareProject'][_0xbb10('0x29')]:undefined;}}}return _0x188b97[_0xbb10('0x15')];};};Realtime[_0xbb10('0x3f')]['initVoiceExtensions']=function(){var _0x256b35=this;return function(_0x13e2ab){if(_0x13e2ab){freeIsNotKey(_0x13e2ab,_0x256b35['voiceExtensions'],'id');for(var _0x5caa06=0x0,_0x2f667f={};_0x5caa06<_0x13e2ab[_0xbb10('0x41')];_0x5caa06+=0x1){_0x2f667f=_0x13e2ab[_0x5caa06];if(_[_0xbb10('0x43')](_0x256b35['voiceExtensions'][_0x2f667f['id']])){_0x256b35[_0xbb10('0x17')][_0x2f667f['id']]=new VoiceExtension(_0x2f667f);}else{_0x256b35[_0xbb10('0x3e')](_0x256b35[_0xbb10('0x17')][_0x2f667f['id']],_0x2f667f);}}}return _0x256b35[_0xbb10('0x17')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x62')]=function(){var _0x45bd4e=this;return function(_0x226363){clearCampaigns(_0x45bd4e[_0xbb10('0x15')]);for(var _0x479d51=0x0;_0x479d51<_0x226363[_0xbb10('0x41')];_0x479d51+=0x1){_[_0xbb10('0x63')](_0x45bd4e[_0xbb10('0x15')][_0x226363[_0x479d51][_0xbb10('0x29')]],_0x226363[_0x479d51]);}return _0x45bd4e[_0xbb10('0x15')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x64')]=function(){var _0x305d52=this;return function(_0x17ed20){if(_0x17ed20){freeIsNotKey(_0x17ed20,_0x305d52[_0xbb10('0x25')],'id');for(var _0x15e043=0x0,_0x2a4278={};_0x15e043<_0x17ed20['length'];_0x15e043+=0x1){_0x2a4278=_0x17ed20[_0x15e043];if(_['isUndefined'](_0x305d52[_0xbb10('0x25')][_0x2a4278['id']])){_0x305d52[_0xbb10('0x25')][_0x2a4278['id']]=new FaxAccount(_0x2a4278);}else{_0x305d52[_0xbb10('0x3e')](_0x305d52[_0xbb10('0x25')][_0x2a4278['id']],_0x2a4278);}}}return _0x305d52[_0xbb10('0x25')];};};Realtime['prototype'][_0xbb10('0x65')]=function(){var _0x332fbe=this;return function(_0x3b4d0b){if(_0x3b4d0b){freeIsNotKey(_0x3b4d0b,_0x332fbe[_0xbb10('0x4f')],_0xbb10('0x29'));for(var _0x379d49=0x0,_0x546db5={};_0x379d49<_0x3b4d0b[_0xbb10('0x41')];_0x379d49+=0x1){_0x546db5=_0x3b4d0b[_0x379d49];if(_[_0xbb10('0x43')](_0x332fbe['voiceQueues'][_0x546db5[_0xbb10('0x29')]])){_0x332fbe['voiceQueues'][_0x546db5[_0xbb10('0x29')]]=new VoiceQueue(_0x546db5);}else{_0x332fbe[_0xbb10('0x3e')](_0x332fbe[_0xbb10('0x4f')][_0x546db5[_0xbb10('0x29')]],_0x546db5);}}}return _0x332fbe[_0xbb10('0x4f')];};};module['exports']=Realtime; \ No newline at end of file +var _0x5f2f=['initCampaignHopperHistory','merge','initFaxAccounts','initVoiceQueues','exports','lodash','moment','util','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/faxAccount','agents','telephones','voiceQueues','templates','outbound','channels','queueChannels','outboundChannels','timers','settings','zendeskAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','format','name','isNil','interface','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','total','answered','unmanaged','outboundAnswerAgiCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundRejectCallsDay','queueStatusComplete','prototype','mergeFromDatabase','length','isUndefined','initTelephones','SIP/%s','trunks','initTriggers','triggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','salesforceAccounts','initFreshdeskAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','servicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerexit','abandoned','queuecallerleaveAt','diff','seconds','queuecallercompleteAt','queuecallerexitAt','queuecallercomplete','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','initCampaigns','campaigns','dialQueueProject','SquareProject','initVoiceExtensions','voiceExtensions'];(function(_0x4c5fe3,_0x2dcebe){var _0x588076=function(_0x6f51d2){while(--_0x6f51d2){_0x4c5fe3['push'](_0x4c5fe3['shift']());}};_0x588076(++_0x2dcebe);}(_0x5f2f,0x73));var _0xf5f2=function(_0x48bf52,_0x8c4a24){_0x48bf52=_0x48bf52-0x0;var _0x78d6a6=_0x5f2f[_0x48bf52];return _0x78d6a6;};'use strict';var _=require(_0xf5f2('0x0'));var moment=require(_0xf5f2('0x1'));var util=require(_0xf5f2('0x2'));var Agent=require(_0xf5f2('0x3'));var Telephone=require(_0xf5f2('0x4'));var Trunk=require(_0xf5f2('0x5'));var VoiceQueue=require(_0xf5f2('0x6'));var Trigger=require(_0xf5f2('0x7'));var Template=require('../model/template');var Campaign=require('../model/campaign');var VoiceExtension=require(_0xf5f2('0x8'));var ZendeskAccount=require(_0xf5f2('0x9'));var SalesforceAccount=require(_0xf5f2('0xa'));var FreshdeskAccount=require(_0xf5f2('0xb'));var SugarcrmAccount=require(_0xf5f2('0xc'));var ZohoAccount=require(_0xf5f2('0xd'));var DeskAccount=require('../model/deskAccount');var VtigerAccount=require(_0xf5f2('0xe'));var ServicenowAccount=require(_0xf5f2('0xf'));var Dynamics365Account=require(_0xf5f2('0x10'));var FreshsalesAccount=require('../model/freshsalesAccount');var FaxAccount=require(_0xf5f2('0x11'));function Realtime(){this[_0xf5f2('0x12')]={};this[_0xf5f2('0x13')]={};this['trunks']={};this[_0xf5f2('0x14')]={};this['triggers']={};this['campaigns']={};this[_0xf5f2('0x15')]={};this[_0xf5f2('0x16')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0xf5f2('0x17')]={};this[_0xf5f2('0x18')]={};this[_0xf5f2('0x19')]={};this[_0xf5f2('0x1a')]={};this[_0xf5f2('0x1b')]={};this[_0xf5f2('0x1c')]={};this['salesforceAccounts']={};this[_0xf5f2('0x1d')]={};this[_0xf5f2('0x1e')]={};this[_0xf5f2('0x1f')]={};this[_0xf5f2('0x20')]={};this[_0xf5f2('0x21')]={};this['servicenowAccounts']={};this[_0xf5f2('0x22')]={};this[_0xf5f2('0x23')]={};this[_0xf5f2('0x24')]={};}function freeIsNotKey(_0x1b6dd2,_0x23e23a,_0x3a9dbb){var _0xdb61b3=_[_0xf5f2('0x25')](_0x1b6dd2,function(_0x11f702){return _0x11f702[_0x3a9dbb];});for(var _0x228ace in _0x23e23a){if(_0x23e23a[_0xf5f2('0x26')](_0x228ace)){if(!_0xdb61b3[_0x228ace]){delete _0x23e23a[_0x228ace];}}}}function freeIsNotKeySip(_0x28e097,_0x4ff59b){var _0x3ee69=_[_0xf5f2('0x25')](_0x28e097,function(_0x626999){return util[_0xf5f2('0x27')]('SIP/%s',_0x626999[_0xf5f2('0x28')]);});for(var _0x47101e in _0x4ff59b){if(_0x4ff59b['hasOwnProperty'](_0x47101e)){if(!_0x3ee69[_0x47101e]){delete _0x4ff59b[_0x47101e];}}}}function freeIsNotKeyAgent(_0x47acfc,_0x2d2805){var _0x388e6c=_['mapKeys'](_0x47acfc,function(_0x45b74f){var _0x170042=_[_0xf5f2('0x29')](_0x45b74f[_0xf5f2('0x2a')])?util[_0xf5f2('0x27')]('SIP/%s',_0x45b74f[_0xf5f2('0x28')]):_0x45b74f[_0xf5f2('0x2a')];return _0x170042;});for(var _0x4e8bda in _0x2d2805){if(_0x2d2805[_0xf5f2('0x26')](_0x4e8bda)){if(!_0x388e6c[_0x4e8bda]){delete _0x2d2805[_0x4e8bda];}}}}function clearVoiceCallReports(_0x287ad5){_0x287ad5['total']=0x0;_0x287ad5['answered']=0x0;_0x287ad5[_0xf5f2('0x2b')]=0x0;_0x287ad5[_0xf5f2('0x2c')]=0x0;_0x287ad5[_0xf5f2('0x2d')]=0x0;}function clearCampaigns(_0x1a5bb3){if(!_[_0xf5f2('0x2e')](_0x1a5bb3)){for(var _0x788a8d in _0x1a5bb3){if(_0x1a5bb3[_0xf5f2('0x26')](_0x788a8d)){_0x1a5bb3[_0x788a8d][_0xf5f2('0x2f')]=0x0;_0x1a5bb3[_0x788a8d][_0xf5f2('0x30')]=0x0;}}}}function clearVoiceQueues(_0x4ab014){if(!_[_0xf5f2('0x2e')](_0x4ab014)){for(var _0x102449 in _0x4ab014){if(_0x4ab014[_0xf5f2('0x26')](_0x102449)){_0x4ab014[_0x102449][_0xf5f2('0x31')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x32')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x33')]=0x0;_0x4ab014[_0x102449]['abandoned']=0x0;_0x4ab014[_0x102449]['sumHoldTime']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x2c')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x2d')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x34')]=0x0;_0x4ab014[_0x102449]['outboundNoAnswerCallsDay']=0x0;_0x4ab014[_0x102449]['outboundBusyCallsDay']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x35')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x36')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x37')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x38')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x39')]=0x0;_0x4ab014[_0x102449]['outboundBlacklistCallsDay']=0x0;_0x4ab014[_0x102449]['outboundOriginateFailureCallsDay']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x3a')]=0x0;_0x4ab014[_0x102449]['outboundReCallsDay']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x34')]=0x0;_0x4ab014[_0x102449]['outboundAnswerCallsDay']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x3b')]=!![];}}}}Realtime[_0xf5f2('0x3c')][_0xf5f2('0x3d')]=function(_0x428770,_0x256bd9){for(var _0x277eee in _0x256bd9){if(_0x428770[_0xf5f2('0x26')](_0x277eee)){_0x428770[_0x277eee]=_0x256bd9[_0x277eee];}}};Realtime[_0xf5f2('0x3c')]['initAgents']=function(){var _0x4149e6=this;return function(_0x43e4ff){if(_0x43e4ff){freeIsNotKeyAgent(_0x43e4ff,_0x4149e6[_0xf5f2('0x12')]);for(var _0x43c77d=0x0,_0x1408b9={};_0x43c77d<_0x43e4ff[_0xf5f2('0x3e')];_0x43c77d+=0x1){_0x1408b9=_0x43e4ff[_0x43c77d];var _0x297c0c=_['isNil'](_0x1408b9[_0xf5f2('0x2a')])?util[_0xf5f2('0x27')]('SIP/%s',_0x1408b9[_0xf5f2('0x28')]):_0x1408b9['interface'];if(_[_0xf5f2('0x3f')](_0x4149e6[_0xf5f2('0x12')][_0x297c0c])){_0x4149e6[_0xf5f2('0x12')][_0x297c0c]=new Agent(_0x1408b9);}else{_0x4149e6[_0xf5f2('0x3d')](_0x4149e6['agents'][_0x297c0c],_0x1408b9);}}}return _0x4149e6['agents'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x40')]=function(){var _0x20eb74=this;return function(_0x4ec8fb){if(_0x4ec8fb){freeIsNotKeySip(_0x4ec8fb,_0x20eb74[_0xf5f2('0x13')]);for(var _0x4f7f80=0x0,_0x9da533={};_0x4f7f80<_0x4ec8fb['length'];_0x4f7f80+=0x1){_0x9da533=_0x4ec8fb[_0x4f7f80];if(_[_0xf5f2('0x3f')](_0x20eb74[_0xf5f2('0x13')][util['format'](_0xf5f2('0x41'),_0x9da533[_0xf5f2('0x28')])])){_0x20eb74[_0xf5f2('0x13')][util[_0xf5f2('0x27')]('SIP/%s',_0x9da533['name'])]=new Telephone(_0x9da533);}else{_0x20eb74[_0xf5f2('0x3d')](_0x20eb74[_0xf5f2('0x13')][util[_0xf5f2('0x27')](_0xf5f2('0x41'),_0x9da533[_0xf5f2('0x28')])],_0x9da533);}}}return _0x20eb74[_0xf5f2('0x13')];};};Realtime[_0xf5f2('0x3c')]['initTrunks']=function(){var _0x110fe5=this;return function(_0x3b4ea6){if(_0x3b4ea6){freeIsNotKeySip(_0x3b4ea6,_0x110fe5['trunks']);for(var _0xc6a1ae=0x0,_0x3f3895={};_0xc6a1ae<_0x3b4ea6[_0xf5f2('0x3e')];_0xc6a1ae+=0x1){_0x3f3895=_0x3b4ea6[_0xc6a1ae];if(_[_0xf5f2('0x3f')](_0x110fe5[_0xf5f2('0x42')][util[_0xf5f2('0x27')](_0xf5f2('0x41'),_0x3f3895[_0xf5f2('0x28')])])){_0x110fe5['trunks'][util[_0xf5f2('0x27')](_0xf5f2('0x41'),_0x3f3895[_0xf5f2('0x28')])]=new Trunk(_0x3f3895);}else{_0x110fe5['mergeFromDatabase'](_0x110fe5['trunks'][util['format'](_0xf5f2('0x41'),_0x3f3895[_0xf5f2('0x28')])],_0x3f3895);}}}return _0x110fe5['trunks'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x43')]=function(){var _0x28e33f=this;return function(_0x31f86c){if(_0x31f86c){freeIsNotKey(_0x31f86c,_0x28e33f[_0xf5f2('0x44')],'id');for(var _0x2b3b1c=0x0,_0x1a6ec1={};_0x2b3b1c<_0x31f86c[_0xf5f2('0x3e')];_0x2b3b1c+=0x1){_0x1a6ec1=_0x31f86c[_0x2b3b1c];if(_[_0xf5f2('0x3f')](_0x28e33f[_0xf5f2('0x44')][_0x1a6ec1['id']])){_0x28e33f[_0xf5f2('0x44')][_0x1a6ec1['id']]=new Trigger(_0x1a6ec1);}else{_0x28e33f[_0xf5f2('0x3d')](_0x28e33f[_0xf5f2('0x44')][_0x1a6ec1['id']],_0x1a6ec1);}}}return _0x28e33f[_0xf5f2('0x44')];};};Realtime['prototype'][_0xf5f2('0x45')]=function(){var _0x578c93=this;return function(_0x3d62c1){if(_0x3d62c1){freeIsNotKey(_0x3d62c1,_0x578c93[_0xf5f2('0x15')],'id');for(var _0x218def=0x0,_0x36a4b0={};_0x218def<_0x3d62c1[_0xf5f2('0x3e')];_0x218def+=0x1){_0x36a4b0=_0x3d62c1[_0x218def];if(_[_0xf5f2('0x3f')](_0x578c93['templates'][_0x36a4b0['id']])){_0x578c93[_0xf5f2('0x15')][_0x36a4b0['id']]=new Template(_0x36a4b0);}else{_0x578c93[_0xf5f2('0x3d')](_0x578c93[_0xf5f2('0x15')][_0x36a4b0['id']],_0x36a4b0);}}}return _0x578c93[_0xf5f2('0x15')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x46')]=function(){var _0xf638ff=this;return function(_0x297f07){if(_0x297f07){freeIsNotKey(_0x297f07,_0xf638ff['zendeskAccounts'],'id');for(var _0x35dece=0x0,_0x33ec29={};_0x35dece<_0x297f07[_0xf5f2('0x3e')];_0x35dece+=0x1){_0x33ec29=_0x297f07[_0x35dece];if(_['isUndefined'](_0xf638ff[_0xf5f2('0x1c')][_0x33ec29['id']])){_0xf638ff[_0xf5f2('0x1c')][_0x33ec29['id']]=new ZendeskAccount(_0x33ec29);}else{_0xf638ff[_0xf5f2('0x3d')](_0xf638ff['zendeskAccounts'][_0x33ec29['id']],_0x33ec29);}}}return _0xf638ff['zendeskAccounts'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x47')]=function(){var _0x5db519=this;return function(_0x14aa81){if(_0x14aa81){freeIsNotKey(_0x14aa81,_0x5db519['salesforceAccounts'],'id');for(var _0x740321=0x0,_0x497eb8={};_0x740321<_0x14aa81[_0xf5f2('0x3e')];_0x740321+=0x1){_0x497eb8=_0x14aa81[_0x740321];if(_['isUndefined'](_0x5db519[_0xf5f2('0x48')][_0x497eb8['id']])){_0x5db519[_0xf5f2('0x48')][_0x497eb8['id']]=new SalesforceAccount(_0x497eb8);}else{_0x5db519[_0xf5f2('0x3d')](_0x5db519[_0xf5f2('0x48')][_0x497eb8['id']],_0x497eb8);}}}return _0x5db519['salesforceAccounts'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x49')]=function(){var _0x4f6b01=this;return function(_0x58213b){if(_0x58213b){freeIsNotKey(_0x58213b,_0x4f6b01[_0xf5f2('0x1e')],'id');for(var _0x3dc0c4=0x0,_0x57782c={};_0x3dc0c4<_0x58213b[_0xf5f2('0x3e')];_0x3dc0c4+=0x1){_0x57782c=_0x58213b[_0x3dc0c4];if(_[_0xf5f2('0x3f')](_0x4f6b01[_0xf5f2('0x1e')][_0x57782c['id']])){_0x4f6b01[_0xf5f2('0x1e')][_0x57782c['id']]=new FreshdeskAccount(_0x57782c);}else{_0x4f6b01['mergeFromDatabase'](_0x4f6b01['freshdeskAccounts'][_0x57782c['id']],_0x57782c);}}}return _0x4f6b01[_0xf5f2('0x1e')];};};Realtime[_0xf5f2('0x3c')]['initZohoAccounts']=function(){var _0x40eef=this;return function(_0x43fc49){if(_0x43fc49){freeIsNotKey(_0x43fc49,_0x40eef[_0xf5f2('0x1f')],'id');for(var _0x14029e=0x0,_0x2b038e={};_0x14029e<_0x43fc49[_0xf5f2('0x3e')];_0x14029e+=0x1){_0x2b038e=_0x43fc49[_0x14029e];if(_[_0xf5f2('0x3f')](_0x40eef['zohoAccounts'][_0x2b038e['id']])){_0x40eef['zohoAccounts'][_0x2b038e['id']]=new ZohoAccount(_0x2b038e);}else{_0x40eef[_0xf5f2('0x3d')](_0x40eef[_0xf5f2('0x1f')][_0x2b038e['id']],_0x2b038e);}}}return _0x40eef[_0xf5f2('0x1f')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x4a')]=function(){var _0x5a861d=this;return function(_0xdb1106){if(_0xdb1106){freeIsNotKey(_0xdb1106,_0x5a861d[_0xf5f2('0x20')],'id');for(var _0x18b124=0x0,_0x519c24={};_0x18b124<_0xdb1106[_0xf5f2('0x3e')];_0x18b124+=0x1){_0x519c24=_0xdb1106[_0x18b124];if(_['isUndefined'](_0x5a861d[_0xf5f2('0x20')][_0x519c24['id']])){_0x5a861d[_0xf5f2('0x20')][_0x519c24['id']]=new DeskAccount(_0x519c24);}else{_0x5a861d[_0xf5f2('0x3d')](_0x5a861d[_0xf5f2('0x20')][_0x519c24['id']],_0x519c24);}}}return _0x5a861d['deskAccounts'];};};Realtime['prototype'][_0xf5f2('0x4b')]=function(){var _0x4de303=this;return function(_0xa39c65){if(_0xa39c65){freeIsNotKey(_0xa39c65,_0x4de303[_0xf5f2('0x1d')],'id');for(var _0x572ec1=0x0,_0x3f0579={};_0x572ec1<_0xa39c65[_0xf5f2('0x3e')];_0x572ec1+=0x1){_0x3f0579=_0xa39c65[_0x572ec1];if(_[_0xf5f2('0x3f')](_0x4de303['sugarcrmAccounts'][_0x3f0579['id']])){_0x4de303[_0xf5f2('0x1d')][_0x3f0579['id']]=new SugarcrmAccount(_0x3f0579);}else{_0x4de303[_0xf5f2('0x3d')](_0x4de303[_0xf5f2('0x1d')][_0x3f0579['id']],_0x3f0579);}}}return _0x4de303[_0xf5f2('0x1d')];};};Realtime['prototype'][_0xf5f2('0x4c')]=function(){var _0x506fe5=this;return function(_0x2cbe1e){if(_0x2cbe1e){freeIsNotKey(_0x2cbe1e,_0x506fe5[_0xf5f2('0x21')],'id');for(var _0x2e6f5d=0x0,_0x380c08={};_0x2e6f5d<_0x2cbe1e[_0xf5f2('0x3e')];_0x2e6f5d+=0x1){_0x380c08=_0x2cbe1e[_0x2e6f5d];if(_['isUndefined'](_0x506fe5[_0xf5f2('0x21')][_0x380c08['id']])){_0x506fe5[_0xf5f2('0x21')][_0x380c08['id']]=new VtigerAccount(_0x380c08);}else{_0x506fe5[_0xf5f2('0x3d')](_0x506fe5[_0xf5f2('0x21')][_0x380c08['id']],_0x380c08);}}}return _0x506fe5[_0xf5f2('0x21')];};};Realtime['prototype'][_0xf5f2('0x4d')]=function(){var _0x5ee6bc=this;return function(_0x4c96ee){if(_0x4c96ee){freeIsNotKey(_0x4c96ee,_0x5ee6bc[_0xf5f2('0x4e')],'id');for(var _0x4802c5=0x0,_0x10f2b8={};_0x4802c5<_0x4c96ee[_0xf5f2('0x3e')];_0x4802c5+=0x1){_0x10f2b8=_0x4c96ee[_0x4802c5];if(_[_0xf5f2('0x3f')](_0x5ee6bc[_0xf5f2('0x4e')][_0x10f2b8['id']])){_0x5ee6bc['servicenowAccounts'][_0x10f2b8['id']]=new ServicenowAccount(_0x10f2b8);}else{_0x5ee6bc[_0xf5f2('0x3d')](_0x5ee6bc[_0xf5f2('0x4e')][_0x10f2b8['id']],_0x10f2b8);}}}return _0x5ee6bc[_0xf5f2('0x4e')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x4f')]=function(){var _0x35d868=this;return function(_0x158768){if(_0x158768){freeIsNotKey(_0x158768,_0x35d868['dynamics365Accounts'],'id');for(var _0x1f55af=0x0,_0x2d171d={};_0x1f55af<_0x158768[_0xf5f2('0x3e')];_0x1f55af+=0x1){_0x2d171d=_0x158768[_0x1f55af];if(_[_0xf5f2('0x3f')](_0x35d868['dynamics365Accounts'][_0x2d171d['id']])){_0x35d868[_0xf5f2('0x22')][_0x2d171d['id']]=new Dynamics365Account(_0x2d171d);}else{_0x35d868['mergeFromDatabase'](_0x35d868[_0xf5f2('0x22')][_0x2d171d['id']],_0x2d171d);}}}return _0x35d868[_0xf5f2('0x22')];};};Realtime['prototype'][_0xf5f2('0x50')]=function(){var _0x975bd8=this;return function(_0xa0c139){if(_0xa0c139){freeIsNotKey(_0xa0c139,_0x975bd8[_0xf5f2('0x23')],'id');for(var _0x146462=0x0,_0x4bd113={};_0x146462<_0xa0c139[_0xf5f2('0x3e')];_0x146462+=0x1){_0x4bd113=_0xa0c139[_0x146462];if(_[_0xf5f2('0x3f')](_0x975bd8[_0xf5f2('0x23')][_0x4bd113['id']])){_0x975bd8[_0xf5f2('0x23')][_0x4bd113['id']]=new FreshsalesAccount(_0x4bd113);}else{_0x975bd8[_0xf5f2('0x3d')](_0x975bd8[_0xf5f2('0x23')][_0x4bd113['id']],_0x4bd113);}}}return _0x975bd8['freshsalesAccounts'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x51')]=function(){var _0x4800fe=this;return function(_0x3f677e){for(var _0x36503c=0x0;_0x36503c<_0x3f677e[_0xf5f2('0x3e')];_0x36503c+=0x1){_['merge'](_0x4800fe['voiceQueues'][_0x3f677e[_0x36503c]['name']],_0x3f677e[_0x36503c]);}return _0x4800fe[_0xf5f2('0x14')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x52')]=function(){var _0x450691=this;return function(_0x55da4d){clearVoiceQueues(_0x450691['voiceQueues']);if(_0x55da4d){_0x55da4d=_[_0xf5f2('0x53')](_0x55da4d,_0xf5f2('0x54'));for(var _0xc10cf3 in _0x55da4d){if(_0x55da4d[_0xf5f2('0x26')](_0xc10cf3)){for(var _0x794e0c=0x0;_0x794e0c<_0x55da4d[_0xc10cf3][_0xf5f2('0x3e')];_0x794e0c+=0x1){var _0x11c302=_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x55')];if(_0x450691[_0xf5f2('0x14')][_0x11c302]){if(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x56')]){_0x450691[_0xf5f2('0x14')][_0x11c302]['unmanaged']+=0x1;}if(_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerabandon']){_0x450691['voiceQueues'][_0x11c302][_0xf5f2('0x57')]+=0x1;}_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2b')]+=moment(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x58')])[_0xf5f2('0x59')](moment(_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerjoinAt']),_0xf5f2('0x5a'))||0x0;if(_0x794e0c===_0x55da4d[_0xc10cf3][_0xf5f2('0x3e')]-0x1){_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2c')]+=moment(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x5b')]||_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerabandonAt']||_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x5c')])[_0xf5f2('0x59')](moment(_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerjoinAt']),_0xf5f2('0x5a'))||0x0;_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x31')]+=0x1;if(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x5d')]){_0x450691['voiceQueues'][_0x11c302][_0xf5f2('0x32')]+=0x1;_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2d')]+=moment(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x5b')])[_0xf5f2('0x59')](moment(_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerleaveAt']),'seconds')||0x0;}}else{_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2c')]+=_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2b')]||0x0;}}}}}}return _0x450691['voiceQueues'];};};Realtime['prototype'][_0xf5f2('0x5e')]=function(){var _0x4f2fcc=this;return function(_0x4c4420){clearVoiceCallReports(_0x4f2fcc['outbound']);if(_0x4c4420){for(var _0x57cb18=0x0;_0x57cb18<_0x4c4420[_0xf5f2('0x3e')];_0x57cb18+=0x1){_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x31')]+=0x1;_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x2c')]+=_0x4c4420[_0x57cb18][_0xf5f2('0x5f')];if(_0x4c4420[_0x57cb18][_0xf5f2('0x60')]===_0xf5f2('0x61')){_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x32')]+=0x1;_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x2b')]+=_0x4c4420[_0x57cb18][_0xf5f2('0x5f')]-_0x4c4420[_0x57cb18][_0xf5f2('0x62')]||0x0;_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x2d')]+=_0x4c4420[_0x57cb18][_0xf5f2('0x62')];}}}return _0x4f2fcc[_0xf5f2('0x16')];};};Realtime['prototype'][_0xf5f2('0x63')]=function(){var _0x35299d=this;return function(_0x21043b){if(_0x21043b){freeIsNotKey(_0x21043b,_0x35299d[_0xf5f2('0x64')],_0xf5f2('0x28'));for(var _0x308220=0x0,_0x16491c={};_0x308220<_0x21043b[_0xf5f2('0x3e')];_0x308220+=0x1){_0x16491c=_0x21043b[_0x308220];if(_['isUndefined'](_0x35299d[_0xf5f2('0x64')][_0x16491c['name']])){_0x35299d['campaigns'][_0x16491c['name']]=new Campaign(_0x16491c);}else{_0x35299d['mergeFromDatabase'](_0x35299d['campaigns'][_0x16491c['name']],_0x16491c);_0x35299d[_0xf5f2('0x64')][_0x16491c[_0xf5f2('0x28')]][_0xf5f2('0x65')]=_0x16491c[_0xf5f2('0x66')]?_0x16491c[_0xf5f2('0x66')][_0xf5f2('0x28')]:undefined;}}}return _0x35299d['campaigns'];};};Realtime['prototype'][_0xf5f2('0x67')]=function(){var _0x578a22=this;return function(_0x418ece){if(_0x418ece){freeIsNotKey(_0x418ece,_0x578a22[_0xf5f2('0x68')],'id');for(var _0x59161c=0x0,_0x4f3ad4={};_0x59161c<_0x418ece[_0xf5f2('0x3e')];_0x59161c+=0x1){_0x4f3ad4=_0x418ece[_0x59161c];if(_[_0xf5f2('0x3f')](_0x578a22['voiceExtensions'][_0x4f3ad4['id']])){_0x578a22[_0xf5f2('0x68')][_0x4f3ad4['id']]=new VoiceExtension(_0x4f3ad4);}else{_0x578a22[_0xf5f2('0x3d')](_0x578a22['voiceExtensions'][_0x4f3ad4['id']],_0x4f3ad4);}}}return _0x578a22[_0xf5f2('0x68')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x69')]=function(){var _0x4c1678=this;return function(_0x33e9ad){clearCampaigns(_0x4c1678[_0xf5f2('0x64')]);for(var _0x14db86=0x0;_0x14db86<_0x33e9ad[_0xf5f2('0x3e')];_0x14db86+=0x1){_[_0xf5f2('0x6a')](_0x4c1678[_0xf5f2('0x64')][_0x33e9ad[_0x14db86][_0xf5f2('0x28')]],_0x33e9ad[_0x14db86]);}return _0x4c1678[_0xf5f2('0x64')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x6b')]=function(){var _0x191af3=this;return function(_0x2601aa){if(_0x2601aa){freeIsNotKey(_0x2601aa,_0x191af3[_0xf5f2('0x24')],'id');for(var _0x407dd8=0x0,_0xe900ea={};_0x407dd8<_0x2601aa[_0xf5f2('0x3e')];_0x407dd8+=0x1){_0xe900ea=_0x2601aa[_0x407dd8];if(_[_0xf5f2('0x3f')](_0x191af3[_0xf5f2('0x24')][_0xe900ea['id']])){_0x191af3[_0xf5f2('0x24')][_0xe900ea['id']]=new FaxAccount(_0xe900ea);}else{_0x191af3[_0xf5f2('0x3d')](_0x191af3[_0xf5f2('0x24')][_0xe900ea['id']],_0xe900ea);}}}return _0x191af3['faxAccounts'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x6c')]=function(){var _0x5d6c6e=this;return function(_0x2e49ce){if(_0x2e49ce){freeIsNotKey(_0x2e49ce,_0x5d6c6e[_0xf5f2('0x14')],'name');for(var _0xb56304=0x0,_0x2f54eb={};_0xb56304<_0x2e49ce[_0xf5f2('0x3e')];_0xb56304+=0x1){_0x2f54eb=_0x2e49ce[_0xb56304];if(_['isUndefined'](_0x5d6c6e['voiceQueues'][_0x2f54eb[_0xf5f2('0x28')]])){_0x5d6c6e[_0xf5f2('0x14')][_0x2f54eb[_0xf5f2('0x28')]]=new VoiceQueue(_0x2f54eb);}else{_0x5d6c6e['mergeFromDatabase'](_0x5d6c6e['voiceQueues'][_0x2f54eb[_0xf5f2('0x28')]],_0x2f54eb);}}}return _0x5d6c6e[_0xf5f2('0x14')];};};module[_0xf5f2('0x6d')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/realtime/utils.js b/server/services/ami/realtime/utils.js index daf4d7a..adf6466 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. * // * * // ************************************************************************* -'use strict';function mergeDBDataToRealtime(_0x1ae256,_0x75f433){var _0x57102f=Object['assign']({},_0x1ae256);for(var _0x11fbc8 in _0x75f433){if(_0x57102f['hasOwnProperty'](_0x11fbc8)){_0x57102f[_0x11fbc8]=_0x75f433[_0x11fbc8];}}return _0x57102f;}exports['mergeDBDataToRealtime']=mergeDBDataToRealtime; \ No newline at end of file +var _0x9e38=['hasOwnProperty','mergeDBDataToRealtime'];(function(_0x25bad6,_0x13e776){var _0x4ab3c2=function(_0x3e508e){while(--_0x3e508e){_0x25bad6['push'](_0x25bad6['shift']());}};_0x4ab3c2(++_0x13e776);}(_0x9e38,0xc8));var _0x89e3=function(_0x1b51ea,_0x394fd9){_0x1b51ea=_0x1b51ea-0x0;var _0x18bbdc=_0x9e38[_0x1b51ea];return _0x18bbdc;};'use strict';function mergeDBDataToRealtime(_0x3656c6,_0x1b55ee){var _0x391dc5=Object['assign']({},_0x3656c6);for(var _0x4b6e6f in _0x1b55ee){if(_0x391dc5[_0x89e3('0x0')](_0x4b6e6f)){_0x391dc5[_0x4b6e6f]=_0x1b55ee[_0x4b6e6f];}}return _0x391dc5;}exports[_0x89e3('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 e4aa4ea..84a63f9 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 _0x7699=['from-sip','xcally-motion-preview','calleridpreview','originatecalleridnum','destinationchannel','ANSWERED','\x22%s\x22\x20<%s>','calleridname','linkedid','transfereelinkedid','uniqueid','transfers','type','split','UserId','membername','monitor','monitors','monitorFilename','filename','connectedlinename','xcally-motion-dialer','isArray','forEach','startsWith','Local','substring','indexOf','mobile','phone','lastIndexOf','transfererlinkedid','exports','lodash','util','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/voiceQueueReport','../rpc/voiceRecording','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','agents','telephones','realtime','xdr','disabled','custom:voiceQueueReport','bind','custom:voiceCallReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','findAgent','find','accountcode','name','isNil','interface','format','SIP/%s','prototype','voiceQueueReport','length','connectedlinenum','assigned','YYYY-MM-DD\x20HH:mm:ss','create','match','getAgentByInternal','keys','getCallType','channel','calleridnum','outbound','internal','destination','exten','dialer','lastapplication','lastdata','context','callerid'];(function(_0x5c2d75,_0x4035fc){var _0x48f399=function(_0x576db0){while(--_0x576db0){_0x5c2d75['push'](_0x5c2d75['shift']());}};_0x48f399(++_0x4035fc);}(_0x7699,0x78));var _0x9769=function(_0xd7b0a4,_0x53c7d3){_0xd7b0a4=_0xd7b0a4-0x0;var _0x184e9e=_0x7699[_0xd7b0a4];return _0x184e9e;};'use strict';var _=require(_0x9769('0x0'));var moment=require('moment');var util=require(_0x9769('0x1'));var config=require('../../../config/environment');var ami=require('../ami');var RpcVoiceAgentReport=require(_0x9769('0x2'));var RpcVoiceCallReport=require(_0x9769('0x3'));var RpcVoiceDialReport=require(_0x9769('0x4'));var RpcMemberReport=require('../rpc/memberReport');var RpcVoiceQueueReport=require(_0x9769('0x5'));var RpcVoiceRecording=require(_0x9769('0x6'));var RpcVoiceTransferReport=require('../rpc/voiceTransferReport');var VoiceQueueReport=require(_0x9769('0x7'));var VoiceCallReport=require(_0x9769('0x8'));var VoiceAgentReport=require(_0x9769('0x9'));var VoiceDialReport=require(_0x9769('0xa'));var UserReport=require('./userReport');function Report(_0x4b192c){this['realtime']=_0x4b192c;this[_0x9769('0xb')]=_0x4b192c['agents'];this['telephones']=_0x4b192c[_0x9769('0xc')];}Report['prototype']['sync']=function(_0x4a7651){var _0x1995f9=new VoiceQueueReport(this[_0x9769('0xd')]);var _0x554cd3=new VoiceAgentReport(this['realtime']);var _0x349488=new VoiceDialReport(this[_0x9769('0xd')]);var _0x147e9b=new VoiceCallReport(this[_0x9769('0xd')]);var _0x38cb7a=new UserReport(this[_0x9769('0xd')]);if(config[_0x9769('0xe')]&&config[_0x9769('0xe')][_0x9769('0xf')]){ami['on'](_0x9769('0x10'),this['voiceQueueReport'][_0x9769('0x11')](this));ami['on'](_0x9769('0x12'),this['voiceCallReport'][_0x9769('0x11')](this));ami['on']('custom:voiceAgentReport',this['voiceAgentReport'][_0x9769('0x11')](this));ami['on']('custom:voiceDialReport',this[_0x9769('0x13')]['bind'](this));ami['on'](_0x9769('0x14'),this[_0x9769('0x15')][_0x9769('0x11')](this));ami['on'](_0x9769('0x16'),this[_0x9769('0x17')]['bind'](this));}};Report['prototype'][_0x9769('0x18')]=function(_0xf0cbc7){var _0x363dd2;_0x363dd2=_[_0x9769('0x19')](this[_0x9769('0xb')],function(_0x550d15){return _0x550d15[_0x9769('0x1a')]==_0xf0cbc7||_0x550d15[_0x9769('0x1b')]==_0xf0cbc7;});if(_[_0x9769('0x1c')](_0x363dd2)){var _0x59bbb4=_[_0x9769('0x19')](this[_0x9769('0xc')],function(_0xec0ea1){return _0xec0ea1[_0x9769('0x1a')]==_0xf0cbc7||_0xec0ea1[_0x9769('0x1b')]==_0xf0cbc7;});if(_0x59bbb4){_0x363dd2=_[_0x9769('0x19')](this[_0x9769('0xb')],function(_0x428b84){return _0x428b84[_0x9769('0x1d')]==util[_0x9769('0x1e')](_0x9769('0x1f'),_0x59bbb4['name']);});}}return _0x363dd2;};Report[_0x9769('0x20')][_0x9769('0x21')]=function(_0x1a38fe){for(var _0x3132a3=0x0;_0x3132a3<_0x1a38fe[_0x9769('0x22')];_0x3132a3+=0x1){var _0x1d9948=this[_0x9769('0x18')](_0x1a38fe[_0x3132a3][_0x9769('0x23')]);if(_0x1d9948){_0x1a38fe[_0x3132a3]['accountcode']=_0x1d9948[_0x9769('0x1a')];_0x1a38fe[_0x3132a3][_0x9769('0x24')]=!![];_0x1a38fe[_0x3132a3]['lastAssignedTo']=_0x1d9948[_0x9769('0x1b')];_0x1a38fe[_0x3132a3][_0x9769('0x1d')]=_[_0x9769('0x1c')](_0x1d9948['interface'])?util['format'](_0x9769('0x1f'),_0x1d9948[_0x9769('0x1b')]):_0x1d9948['interface'];if(_0x1a38fe[_0x3132a3]['queuecallercomplete']){_0x1a38fe[_0x3132a3]['queuecallercompleteAt']=moment()[_0x9769('0x1e')](_0x9769('0x25'));}if(_0x1a38fe[_0x3132a3]['queuecallerexit']){_0x1a38fe[_0x3132a3]['queuecallerexitAt']=moment()[_0x9769('0x1e')](_0x9769('0x25'));}RpcMemberReport[_0x9769('0x21')](_0x1a38fe[_0x3132a3]);}RpcVoiceQueueReport[_0x9769('0x26')](_0x1a38fe[_0x3132a3]);}};function extractCalleridNumber(_0x20b934){var _0x50ba3d=_0x20b934[_0x9769('0x27')](/<(.*?)>/);return _0x50ba3d?_0x50ba3d[0x1]:_0x20b934;}Report['prototype'][_0x9769('0x28')]=function(_0x1b2954){for(var _0x53d1f4=0x0;_0x53d1f4/);return _0x3601a9?_0x3601a9[0x1]:_0x1cd77e;}Report['prototype'][_0x920e('0x2f')]=function(_0x4f7c29){for(var _0x1be040=0x0;_0x1be040',_0x336d80['calleridname'],_0x336d80[_0x920e('0x33')]);}if(RpcVoiceTransferReport[_0x920e('0x46')][_0x336d80[_0x920e('0x47')]]){var _0x42bdfa=RpcVoiceTransferReport[_0x920e('0x46')][_0x336d80[_0x920e('0x47')]];_0x42bdfa[_0x920e('0x48')]=_0x336d80[_0x920e('0x49')];RpcVoiceTransferReport[_0x920e('0x1c')](_0x42bdfa);delete RpcVoiceTransferReport[_0x920e('0x46')][_0x336d80[_0x920e('0x47')]];}if(_[_0x920e('0x22')](_0x336d80['type'])){_0x336d80[_0x920e('0x37')]=this[_0x920e('0x4a')](_0x336d80);}if(_[_0x920e('0x22')](_0x336d80['UserId'])){var _0x316e3c=_0x336d80[_0x920e('0x31')][_0x920e('0x32')]('-')[0x0];var _0x43d0e7=this[_0x920e('0xf')][_0x316e3c];if(!_0x43d0e7)_0x43d0e7=this[_0x920e('0x2f')](_0x336d80[_0x920e('0x21')]);if(_0x43d0e7){_0x336d80[_0x920e('0x4b')]=_0x43d0e7['id'];_0x336d80[_0x920e('0x4c')]=_0x43d0e7[_0x920e('0x24')];}}RpcVoiceCallReport['create'](_0x336d80);if(_0x336d80['monitor']){for(var _0x21ce1e=0x0;_0x21ce1e<_0x336d80[_0x920e('0x4d')][_0x920e('0x26')];_0x21ce1e+=0x1){_0x336d80[_0x920e('0x4e')]=_0x336d80[_0x920e('0x4d')][_0x21ce1e][_0x920e('0x4f')];_0x336d80[_0x920e('0x50')]=_0x336d80['monitors'][_0x21ce1e][_0x920e('0x50')];if(_0x336d80[_0x920e('0x51')]==_0x920e('0x40')){_0x336d80[_0x920e('0x33')]=_0x336d80[_0x920e('0x27')];_0x336d80[_0x920e('0x52')]=_0x336d80['connectedlinename'];_0x336d80['connectedlinenum']=_0x336d80[_0x920e('0x21')];_0x336d80[_0x920e('0x53')]=_0x336d80[_0x920e('0x4c')];_0x336d80[_0x920e('0x51')]=_0x336d80[_0x920e('0x42')];}else if(_0x336d80[_0x920e('0x51')]==_0x920e('0x54')){_0x336d80[_0x920e('0x33')]=_0x336d80[_0x920e('0x36')];_0x336d80['exten']=_0x336d80[_0x920e('0x42')];}RpcVoiceRecording[_0x920e('0x2e')](_0x336d80);}}};Report['prototype'][_0x920e('0x19')]=function(_0x5757ad){if(_['isArray'](_0x5757ad)){_0x5757ad[_0x920e('0x55')](function(_0x408b8f){RpcVoiceAgentReport[_0x920e('0x2e')](_0x408b8f);});}else{RpcVoiceAgentReport[_0x920e('0x2e')](_0x5757ad);}};Report['prototype'][_0x920e('0x56')]=function(_0xa86fdd){RpcVoiceDialReport[_0x920e('0x2e')](_0xa86fdd);var _0x132704;var _0x5ac5a3;var _0xe91634=_0xa86fdd['channel'];if(_[_0x920e('0x57')](_0xe91634,_0x920e('0x58'))){_0x5ac5a3=_0xe91634['substring'](_0xe91634[_0x920e('0x59')]('/')+0x1,_0xe91634[_0x920e('0x59')]('@'));_0x132704=_[_0x920e('0x20')](this['agents'],function(_0x24433a){return _0x24433a[_0x920e('0x5a')]==_0x5ac5a3||_0x24433a['phone']==_0x5ac5a3||_0x24433a[_0x920e('0x21')]==_0x5ac5a3;});}else{_0x5ac5a3=_0xe91634['substring'](_0xe91634['indexOf']('/')+0x1,_0xe91634[_0x920e('0x5b')]('-'));_0x132704=this[_0x920e('0x1f')](_0x5ac5a3);}if(_0x132704){_0xa86fdd[_0x920e('0x23')]=_[_0x920e('0x22')](_0x132704[_0x920e('0x23')])?util['format'](_0x920e('0x2a'),_0x132704[_0x920e('0x24')]):_0x132704[_0x920e('0x23')];_0xa86fdd['membername']=_0x132704[_0x920e('0x24')];_0xa86fdd[_0x920e('0x21')]=_0x132704[_0x920e('0x21')];RpcMemberReport[_0x920e('0x56')](_0xa86fdd);}};Report[_0x920e('0x11')][_0x920e('0x1c')]=function(_0x1d444b){RpcVoiceTransferReport[_0x920e('0x46')][_0x1d444b[_0x920e('0x5c')]]=_0x1d444b;};Report[_0x920e('0x11')][_0x920e('0x1e')]=function(_0x1521f5){RpcVoiceTransferReport[_0x920e('0x1e')](_0x1521f5);};module[_0x920e('0x5d')]=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index 06c789a..e766ede 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 _0x940a=['[userReport][devicestatechange]\x20device:%s\x20state:%s','[userReport][devicestatechange]','device','local','toLowerCase','inuse','stateTime','toNumber','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:%s','telephone:save','startsWith','Local','indexOf','mobile','phone','updateStatusRealtime','peerstatus','peer','[userReport][peerstatus]','registered','address','status','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','exports','lodash','moment','util','ioredis','bluebird','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','localhost','socket.io-emitter','trunks','agents','telephones','syncRegistry','bind','registry','syncDeviceState','syncPeerStatus','syncRealtimeShow','then','actionSipShowRegistry','catch','error','[userReport][sipshowregistry]','inspect','resolve','actionDeviceStateList','actionSipPeerStatus','prototype','emit','isNotNull','info','[userReport][registry]\x20registry:%s\x20state:%s','username','state','debug','find','omit','actionid','[userReport][registry]\x20sending\x20trunk:save\x20event:','format','trunk:%s','name','trunk:save'];(function(_0x5f48b2,_0x1bbca2){var _0x52a1ca=function(_0x17d596){while(--_0x17d596){_0x5f48b2['push'](_0x5f48b2['shift']());}};_0x52a1ca(++_0x1bbca2);}(_0x940a,0xa9));var _0xa940=function(_0x39d39d,_0x5586bd){_0x39d39d=_0x39d39d-0x0;var _0x577ac3=_0x940a[_0x39d39d];return _0x577ac3;};'use strict';var _=require(_0xa940('0x0'));var moment=require(_0xa940('0x1'));var util=require(_0xa940('0x2'));var Redis=require(_0xa940('0x3'));var BPromise=require(_0xa940('0x4'));var config=require(_0xa940('0x5'));var logger=require(_0xa940('0x6'))(_0xa940('0x7'));var ami=require(_0xa940('0x8'));config[_0xa940('0x9')]=_[_0xa940('0xa')](config[_0xa940('0x9')],{'host':_0xa940('0xb'),'port':0x18eb});var io=require(_0xa940('0xc'))(new Redis(config[_0xa940('0x9')]));function UserReport(_0x2ca88b){this[_0xa940('0xd')]=_0x2ca88b[_0xa940('0xd')];this[_0xa940('0xe')]=_0x2ca88b[_0xa940('0xe')];this[_0xa940('0xf')]=_0x2ca88b['telephones'];ami['on']('registryentry',this[_0xa940('0x10')][_0xa940('0x11')](this));ami['on'](_0xa940('0x12'),this['syncRegistry']['bind'](this));ami['on']('devicestatechange',this[_0xa940('0x13')]['bind'](this));ami['on']('peerstatus',this[_0xa940('0x14')][_0xa940('0x11')](this));return this[_0xa940('0x15')]();}function showSipRegistrations(){Promise['resolve']()[_0xa940('0x16')](ami[_0xa940('0x17')]())[_0xa940('0x18')](function(_0x27d1da){logger[_0xa940('0x19')](_0xa940('0x1a'),util[_0xa940('0x1b')](_0x27d1da,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0xa940('0x1c')]()[_0xa940('0x16')](ami[_0xa940('0x1d')]())[_0xa940('0x18')](function(_0x166333){logger[_0xa940('0x19')]('[userReport][devicestatelist]',util['inspect'](_0x166333,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0xa940('0x1c')]()[_0xa940('0x16')](ami[_0xa940('0x1e')]())[_0xa940('0x18')](function(_0x509d9f){logger[_0xa940('0x19')]('[userReport][sippeerstatus]',util[_0xa940('0x1b')](_0x509d9f,{'showHidden':![],'depth':null}));});}UserReport[_0xa940('0x1f')][_0xa940('0x15')]=function(){setInterval(function(){BPromise[_0xa940('0x1c')]()[_0xa940('0x16')](showSipRegistrations())[_0xa940('0x16')](listDeviceStates())[_0xa940('0x16')](showPeersStatus());},0x32c8);};UserReport[_0xa940('0x1f')]['isNotNull']=function(_0x3446f6){return _0x3446f6!==null&&!_['isUndefined'](_0x3446f6);};UserReport['prototype'][_0xa940('0x20')]=function(_0x541ee9,_0x1b5041,_0x40611c){io['to'](_0x541ee9)[_0xa940('0x20')](_0x1b5041,_0x40611c);};UserReport['prototype'][_0xa940('0x10')]=function(_0x3c9fed){try{if(this[_0xa940('0x21')](_0x3c9fed)){logger[_0xa940('0x22')](_0xa940('0x23'),_0x3c9fed[_0xa940('0x24')],_0x3c9fed[_0xa940('0x25')]);logger[_0xa940('0x26')]('[userReport][registry]',util[_0xa940('0x1b')](_0x3c9fed,{'showHidden':![],'depth':null}));var _0xfeb14c=_[_0xa940('0x27')](this[_0xa940('0xd')],{'defaultuser':_0x3c9fed[_0xa940('0x24')]});if(_0xfeb14c){_0x3c9fed['stateRegistry']=_0x3c9fed[_0xa940('0x25')];_['merge'](_0xfeb14c,_[_0xa940('0x28')](_0x3c9fed,['event',_0xa940('0x29'),'username',_0xa940('0x25')]));logger[_0xa940('0x26')](_0xa940('0x2a'),util[_0xa940('0x1b')](_0xfeb14c,{'showHidden':![],'depth':null}));this['emit'](util[_0xa940('0x2b')](_0xa940('0x2c'),_0xfeb14c[_0xa940('0x2d')]),_0xa940('0x2e'),_0xfeb14c);}}}catch(_0x5b42ad){logger['error']('[userReport][registry]',util[_0xa940('0x1b')](_0x5b42ad,{'showHidden':![],'depth':null}));}};UserReport[_0xa940('0x1f')]['syncDeviceState']=function(_0x484490){try{if(this[_0xa940('0x21')](_0x484490)){logger['info'](_0xa940('0x2f'),_0x484490['device'],_0x484490[_0xa940('0x25')]);logger['debug'](_0xa940('0x30'),util[_0xa940('0x1b')](_0x484490,{'showHidden':![],'depth':null}));if(this[_0xa940('0xe')][_0x484490[_0xa940('0x31')]]){if(!this[_0xa940('0xe')][_0x484490[_0xa940('0x31')]][_0xa940('0x32')]||_0x484490[_0xa940('0x25')][_0xa940('0x33')]()==_0xa940('0x34')){this[_0xa940('0xe')][_0x484490['device']][_0xa940('0x32')]=![];if(this[_0xa940('0xe')][_0x484490[_0xa940('0x31')]][_0xa940('0x25')]!==_0x484490[_0xa940('0x25')]['toLowerCase']()){this[_0xa940('0xe')][_0x484490[_0xa940('0x31')]][_0xa940('0x35')]=_[_0xa940('0x36')](moment()[_0xa940('0x2b')]('x'));}this['agents'][_0x484490[_0xa940('0x31')]][_0xa940('0x25')]=_0x484490['state'][_0xa940('0x33')]();this[_0xa940('0xe')][_0x484490[_0xa940('0x31')]]['updateStatusRealtime'](_0x484490);}}else if(this[_0xa940('0xf')][_0x484490[_0xa940('0x31')]]){if(this[_0xa940('0xf')][_0x484490['device']][_0xa940('0x25')]!==_0x484490[_0xa940('0x25')][_0xa940('0x33')]()){this['telephones'][_0x484490['device']][_0xa940('0x35')]=_['toNumber'](moment()[_0xa940('0x2b')]('x'));}this[_0xa940('0xf')][_0x484490[_0xa940('0x31')]]['state']=_0x484490[_0xa940('0x25')][_0xa940('0x33')]();logger[_0xa940('0x26')](_0xa940('0x37'),util[_0xa940('0x1b')](this['telephones'][_0x484490['device']],{'showHidden':![],'depth':null}));this['emit'](util[_0xa940('0x2b')](_0xa940('0x38'),this[_0xa940('0xf')][_0x484490[_0xa940('0x31')]][_0xa940('0x2d')]),_0xa940('0x39'),this[_0xa940('0xf')][_0x484490[_0xa940('0x31')]]);}else if(this[_0xa940('0xd')][_0x484490[_0xa940('0x31')]]){if(this[_0xa940('0xd')][_0x484490[_0xa940('0x31')]][_0xa940('0x25')]!==_0x484490[_0xa940('0x25')][_0xa940('0x33')]()){this['trunks'][_0x484490[_0xa940('0x31')]][_0xa940('0x35')]=_['toNumber'](moment()['format']('x'));}this[_0xa940('0xd')][_0x484490['device']][_0xa940('0x25')]=_0x484490[_0xa940('0x25')][_0xa940('0x33')]();logger[_0xa940('0x26')]('[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:',util['inspect'](this[_0xa940('0xd')][_0x484490['device']],{'showHidden':![],'depth':null}));this[_0xa940('0x20')](util[_0xa940('0x2b')](_0xa940('0x2c'),this[_0xa940('0xd')][_0x484490[_0xa940('0x31')]][_0xa940('0x2d')]),'trunk:save',this['trunks'][_0x484490[_0xa940('0x31')]]);}else if(_[_0xa940('0x3a')](_0x484490[_0xa940('0x31')],_0xa940('0x3b'))){var _0x5e6032=_0x484490[_0xa940('0x31')];var _0x57ee93=_0x5e6032['substring'](_0x5e6032[_0xa940('0x3c')]('/')+0x1,_0x5e6032['indexOf']('@'));var _0x2d720a=_[_0xa940('0x27')](this['agents'],function(_0x342571){return _0x342571[_0xa940('0x3d')]==_0x57ee93||_0x342571[_0xa940('0x3e')]==_0x57ee93||_0x342571['accountcode']==_0x57ee93;});if(_0x2d720a){if(_0x2d720a[_0xa940('0x25')]!==_0x484490['state'][_0xa940('0x33')]()){_0x2d720a[_0xa940('0x35')]=_[_0xa940('0x36')](moment()['format']('x'));}_0x2d720a[_0xa940('0x25')]=_0x484490[_0xa940('0x25')]['toLowerCase']();_0x2d720a[_0xa940('0x32')]=!![];_0x2d720a[_0xa940('0x3f')](_0x484490);}}}}catch(_0x4589f0){logger[_0xa940('0x19')](_0xa940('0x30'),util[_0xa940('0x1b')](_0x4589f0,{'showHidden':![],'depth':null}));}};UserReport[_0xa940('0x1f')][_0xa940('0x14')]=function(_0x2465d2){try{if(this['isNotNull'](_0x2465d2)&&this[_0xa940('0x21')](_0x2465d2[_0xa940('0x40')])){logger['info']('[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s',_0x2465d2[_0xa940('0x41')],_0x2465d2['address'],_0x2465d2[_0xa940('0x40')]);logger[_0xa940('0x26')](_0xa940('0x42'),util[_0xa940('0x1b')](_0x2465d2,{'showHidden':![],'depth':null}));if(this[_0xa940('0xe')][_0x2465d2['peer']]){if(!this['agents'][_0x2465d2[_0xa940('0x41')]][_0xa940('0x32')]||_0x2465d2['peerstatus']['toLowerCase']()==_0xa940('0x43')){this[_0xa940('0xe')][_0x2465d2[_0xa940('0x41')]]['local']=![];this[_0xa940('0xe')][_0x2465d2[_0xa940('0x41')]]['status']=_0x2465d2[_0xa940('0x40')][_0xa940('0x33')]();this['agents'][_0x2465d2[_0xa940('0x41')]][_0xa940('0x44')]=_0x2465d2[_0xa940('0x44')];this[_0xa940('0xe')][_0x2465d2[_0xa940('0x41')]][_0xa940('0x3f')](_0x2465d2);}}else if(this[_0xa940('0xf')][_0x2465d2[_0xa940('0x41')]]){this['telephones'][_0x2465d2[_0xa940('0x41')]][_0xa940('0x45')]=_0x2465d2[_0xa940('0x40')][_0xa940('0x33')]();this['telephones'][_0x2465d2[_0xa940('0x41')]][_0xa940('0x44')]=_0x2465d2[_0xa940('0x44')];logger[_0xa940('0x26')](_0xa940('0x46'),util[_0xa940('0x1b')](this[_0xa940('0xf')][_0x2465d2[_0xa940('0x41')]],{'showHidden':![],'depth':null}));this[_0xa940('0x20')](util[_0xa940('0x2b')]('telephone:%s',this[_0xa940('0xf')][_0x2465d2[_0xa940('0x41')]][_0xa940('0x2d')]),'telephone:save',this[_0xa940('0xf')][_0x2465d2[_0xa940('0x41')]]);}else if(this[_0xa940('0xd')][_0x2465d2[_0xa940('0x41')]]){this[_0xa940('0xd')][_0x2465d2[_0xa940('0x41')]][_0xa940('0x45')]=_0x2465d2[_0xa940('0x40')]['toLowerCase']();this['trunks'][_0x2465d2[_0xa940('0x41')]][_0xa940('0x44')]=_0x2465d2[_0xa940('0x44')];logger[_0xa940('0x26')]('[userReport][peerstatus]\x20sending\x20trunk:save\x20event:',util[_0xa940('0x1b')](this[_0xa940('0xd')][_0x2465d2[_0xa940('0x41')]],{'showHidden':![],'depth':null}));this[_0xa940('0x20')](util[_0xa940('0x2b')](_0xa940('0x2c'),this['trunks'][_0x2465d2[_0xa940('0x41')]][_0xa940('0x2d')]),'trunk:save',this[_0xa940('0xd')][_0x2465d2['peer']]);}}}catch(_0x4891ae){logger[_0xa940('0x19')](_0xa940('0x42'),util[_0xa940('0x1b')](_0x4891ae,{'showHidden':![],'depth':null}));}};module[_0xa940('0x47')]=UserReport; \ No newline at end of file +var _0xa1a3=['name','[userReport][devicestatechange]\x20device:%s\x20state:%s','device','local','toLowerCase','inuse','stateTime','toNumber','format','telephone:%s','telephone:save','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','trunk:save','startsWith','Local','indexOf','mobile','phone','accountcode','updateStatusRealtime','[userReport][devicestatechange]','peerstatus','peer','registered','address','status','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','[userReport][peerstatus]','exports','lodash','util','ioredis','bluebird','../../../config/environment','ami','redis','defaults','localhost','socket.io-emitter','trunks','agents','telephones','registryentry','syncRegistry','bind','devicestatechange','syncDeviceState','syncPeerStatus','resolve','then','actionSipShowRegistry','catch','error','[userReport][sipshowregistry]','actionDeviceStateList','[userReport][devicestatelist]','inspect','actionSipPeerStatus','[userReport][sippeerstatus]','prototype','syncRealtimeShow','isNotNull','isUndefined','emit','info','[userReport][registry]\x20registry:%s\x20state:%s','username','[userReport][registry]','find','event','actionid','state','debug','[userReport][registry]\x20sending\x20trunk:save\x20event:','trunk:%s'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa1a3,0x1df));var _0x3a1a=function(_0x91e0ea,_0x3ede28){_0x91e0ea=_0x91e0ea-0x0;var _0x1fcadc=_0xa1a3[_0x91e0ea];return _0x1fcadc;};'use strict';var _=require(_0x3a1a('0x0'));var moment=require('moment');var util=require(_0x3a1a('0x1'));var Redis=require(_0x3a1a('0x2'));var BPromise=require(_0x3a1a('0x3'));var config=require(_0x3a1a('0x4'));var logger=require('../../../config/logger')(_0x3a1a('0x5'));var ami=require('../ami');config[_0x3a1a('0x6')]=_[_0x3a1a('0x7')](config[_0x3a1a('0x6')],{'host':_0x3a1a('0x8'),'port':0x18eb});var io=require(_0x3a1a('0x9'))(new Redis(config['redis']));function UserReport(_0x13d8c4){this[_0x3a1a('0xa')]=_0x13d8c4[_0x3a1a('0xa')];this[_0x3a1a('0xb')]=_0x13d8c4[_0x3a1a('0xb')];this['telephones']=_0x13d8c4[_0x3a1a('0xc')];ami['on'](_0x3a1a('0xd'),this[_0x3a1a('0xe')][_0x3a1a('0xf')](this));ami['on']('registry',this[_0x3a1a('0xe')]['bind'](this));ami['on'](_0x3a1a('0x10'),this[_0x3a1a('0x11')]['bind'](this));ami['on']('peerstatus',this[_0x3a1a('0x12')][_0x3a1a('0xf')](this));return this['syncRealtimeShow']();}function showSipRegistrations(){Promise[_0x3a1a('0x13')]()[_0x3a1a('0x14')](ami[_0x3a1a('0x15')]())[_0x3a1a('0x16')](function(_0x1e1cd9){logger[_0x3a1a('0x17')](_0x3a1a('0x18'),util['inspect'](_0x1e1cd9,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0x3a1a('0x13')]()['then'](ami[_0x3a1a('0x19')]())[_0x3a1a('0x16')](function(_0x594e01){logger[_0x3a1a('0x17')](_0x3a1a('0x1a'),util[_0x3a1a('0x1b')](_0x594e01,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0x3a1a('0x13')]()[_0x3a1a('0x14')](ami[_0x3a1a('0x1c')]())[_0x3a1a('0x16')](function(_0x1d0223){logger['error'](_0x3a1a('0x1d'),util[_0x3a1a('0x1b')](_0x1d0223,{'showHidden':![],'depth':null}));});}UserReport[_0x3a1a('0x1e')][_0x3a1a('0x1f')]=function(){setInterval(function(){BPromise[_0x3a1a('0x13')]()[_0x3a1a('0x14')](showSipRegistrations())[_0x3a1a('0x14')](listDeviceStates())[_0x3a1a('0x14')](showPeersStatus());},0x32c8);};UserReport[_0x3a1a('0x1e')][_0x3a1a('0x20')]=function(_0x416748){return _0x416748!==null&&!_[_0x3a1a('0x21')](_0x416748);};UserReport[_0x3a1a('0x1e')][_0x3a1a('0x22')]=function(_0x34dc87,_0x1594e0,_0x17d7bd){io['to'](_0x34dc87)[_0x3a1a('0x22')](_0x1594e0,_0x17d7bd);};UserReport[_0x3a1a('0x1e')][_0x3a1a('0xe')]=function(_0x2a8c0b){try{if(this[_0x3a1a('0x20')](_0x2a8c0b)){logger[_0x3a1a('0x23')](_0x3a1a('0x24'),_0x2a8c0b[_0x3a1a('0x25')],_0x2a8c0b['state']);logger['debug'](_0x3a1a('0x26'),util[_0x3a1a('0x1b')](_0x2a8c0b,{'showHidden':![],'depth':null}));var _0x390923=_[_0x3a1a('0x27')](this['trunks'],{'defaultuser':_0x2a8c0b['username']});if(_0x390923){_0x2a8c0b['stateRegistry']=_0x2a8c0b['state'];_['merge'](_0x390923,_['omit'](_0x2a8c0b,[_0x3a1a('0x28'),_0x3a1a('0x29'),_0x3a1a('0x25'),_0x3a1a('0x2a')]));logger[_0x3a1a('0x2b')](_0x3a1a('0x2c'),util[_0x3a1a('0x1b')](_0x390923,{'showHidden':![],'depth':null}));this[_0x3a1a('0x22')](util['format'](_0x3a1a('0x2d'),_0x390923[_0x3a1a('0x2e')]),'trunk:save',_0x390923);}}}catch(_0x16c8f8){logger['error'](_0x3a1a('0x26'),util[_0x3a1a('0x1b')](_0x16c8f8,{'showHidden':![],'depth':null}));}};UserReport[_0x3a1a('0x1e')]['syncDeviceState']=function(_0x9eefaf){try{if(this[_0x3a1a('0x20')](_0x9eefaf)){logger[_0x3a1a('0x23')](_0x3a1a('0x2f'),_0x9eefaf[_0x3a1a('0x30')],_0x9eefaf[_0x3a1a('0x2a')]);logger[_0x3a1a('0x2b')]('[userReport][devicestatechange]',util[_0x3a1a('0x1b')](_0x9eefaf,{'showHidden':![],'depth':null}));if(this[_0x3a1a('0xb')][_0x9eefaf['device']]){if(!this[_0x3a1a('0xb')][_0x9eefaf[_0x3a1a('0x30')]][_0x3a1a('0x31')]||_0x9eefaf[_0x3a1a('0x2a')][_0x3a1a('0x32')]()==_0x3a1a('0x33')){this['agents'][_0x9eefaf['device']][_0x3a1a('0x31')]=![];if(this[_0x3a1a('0xb')][_0x9eefaf[_0x3a1a('0x30')]][_0x3a1a('0x2a')]!==_0x9eefaf[_0x3a1a('0x2a')][_0x3a1a('0x32')]()){this[_0x3a1a('0xb')][_0x9eefaf['device']][_0x3a1a('0x34')]=_[_0x3a1a('0x35')](moment()[_0x3a1a('0x36')]('x'));}this[_0x3a1a('0xb')][_0x9eefaf['device']][_0x3a1a('0x2a')]=_0x9eefaf[_0x3a1a('0x2a')][_0x3a1a('0x32')]();this[_0x3a1a('0xb')][_0x9eefaf[_0x3a1a('0x30')]]['updateStatusRealtime'](_0x9eefaf);}}else if(this[_0x3a1a('0xc')][_0x9eefaf[_0x3a1a('0x30')]]){if(this[_0x3a1a('0xc')][_0x9eefaf[_0x3a1a('0x30')]][_0x3a1a('0x2a')]!==_0x9eefaf['state'][_0x3a1a('0x32')]()){this[_0x3a1a('0xc')][_0x9eefaf[_0x3a1a('0x30')]][_0x3a1a('0x34')]=_[_0x3a1a('0x35')](moment()['format']('x'));}this[_0x3a1a('0xc')][_0x9eefaf[_0x3a1a('0x30')]][_0x3a1a('0x2a')]=_0x9eefaf[_0x3a1a('0x2a')][_0x3a1a('0x32')]();logger[_0x3a1a('0x2b')]('[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:',util[_0x3a1a('0x1b')](this[_0x3a1a('0xc')][_0x9eefaf[_0x3a1a('0x30')]],{'showHidden':![],'depth':null}));this[_0x3a1a('0x22')](util[_0x3a1a('0x36')](_0x3a1a('0x37'),this[_0x3a1a('0xc')][_0x9eefaf[_0x3a1a('0x30')]][_0x3a1a('0x2e')]),_0x3a1a('0x38'),this[_0x3a1a('0xc')][_0x9eefaf[_0x3a1a('0x30')]]);}else if(this[_0x3a1a('0xa')][_0x9eefaf[_0x3a1a('0x30')]]){if(this['trunks'][_0x9eefaf[_0x3a1a('0x30')]][_0x3a1a('0x2a')]!==_0x9eefaf['state'][_0x3a1a('0x32')]()){this[_0x3a1a('0xa')][_0x9eefaf[_0x3a1a('0x30')]]['stateTime']=_['toNumber'](moment()[_0x3a1a('0x36')]('x'));}this[_0x3a1a('0xa')][_0x9eefaf[_0x3a1a('0x30')]][_0x3a1a('0x2a')]=_0x9eefaf[_0x3a1a('0x2a')][_0x3a1a('0x32')]();logger[_0x3a1a('0x2b')](_0x3a1a('0x39'),util[_0x3a1a('0x1b')](this['trunks'][_0x9eefaf[_0x3a1a('0x30')]],{'showHidden':![],'depth':null}));this[_0x3a1a('0x22')](util['format'](_0x3a1a('0x2d'),this[_0x3a1a('0xa')][_0x9eefaf['device']][_0x3a1a('0x2e')]),_0x3a1a('0x3a'),this[_0x3a1a('0xa')][_0x9eefaf['device']]);}else if(_[_0x3a1a('0x3b')](_0x9eefaf[_0x3a1a('0x30')],_0x3a1a('0x3c'))){var _0x1038b3=_0x9eefaf[_0x3a1a('0x30')];var _0x4f7a3f=_0x1038b3['substring'](_0x1038b3[_0x3a1a('0x3d')]('/')+0x1,_0x1038b3[_0x3a1a('0x3d')]('@'));var _0xcc13c7=_[_0x3a1a('0x27')](this[_0x3a1a('0xb')],function(_0x4cb85e){return _0x4cb85e[_0x3a1a('0x3e')]==_0x4f7a3f||_0x4cb85e[_0x3a1a('0x3f')]==_0x4f7a3f||_0x4cb85e[_0x3a1a('0x40')]==_0x4f7a3f;});if(_0xcc13c7){if(_0xcc13c7['state']!==_0x9eefaf['state'][_0x3a1a('0x32')]()){_0xcc13c7['stateTime']=_['toNumber'](moment()['format']('x'));}_0xcc13c7[_0x3a1a('0x2a')]=_0x9eefaf[_0x3a1a('0x2a')][_0x3a1a('0x32')]();_0xcc13c7[_0x3a1a('0x31')]=!![];_0xcc13c7[_0x3a1a('0x41')](_0x9eefaf);}}}}catch(_0x4add3e){logger[_0x3a1a('0x17')](_0x3a1a('0x42'),util[_0x3a1a('0x1b')](_0x4add3e,{'showHidden':![],'depth':null}));}};UserReport['prototype'][_0x3a1a('0x12')]=function(_0x1694bd){try{if(this[_0x3a1a('0x20')](_0x1694bd)&&this[_0x3a1a('0x20')](_0x1694bd[_0x3a1a('0x43')])){logger[_0x3a1a('0x23')]('[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s',_0x1694bd[_0x3a1a('0x44')],_0x1694bd['address'],_0x1694bd[_0x3a1a('0x43')]);logger[_0x3a1a('0x2b')]('[userReport][peerstatus]',util['inspect'](_0x1694bd,{'showHidden':![],'depth':null}));if(this[_0x3a1a('0xb')][_0x1694bd[_0x3a1a('0x44')]]){if(!this[_0x3a1a('0xb')][_0x1694bd[_0x3a1a('0x44')]][_0x3a1a('0x31')]||_0x1694bd['peerstatus'][_0x3a1a('0x32')]()==_0x3a1a('0x45')){this[_0x3a1a('0xb')][_0x1694bd[_0x3a1a('0x44')]]['local']=![];this[_0x3a1a('0xb')][_0x1694bd[_0x3a1a('0x44')]]['status']=_0x1694bd[_0x3a1a('0x43')][_0x3a1a('0x32')]();this[_0x3a1a('0xb')][_0x1694bd[_0x3a1a('0x44')]][_0x3a1a('0x46')]=_0x1694bd['address'];this['agents'][_0x1694bd['peer']][_0x3a1a('0x41')](_0x1694bd);}}else if(this[_0x3a1a('0xc')][_0x1694bd[_0x3a1a('0x44')]]){this[_0x3a1a('0xc')][_0x1694bd[_0x3a1a('0x44')]][_0x3a1a('0x47')]=_0x1694bd[_0x3a1a('0x43')][_0x3a1a('0x32')]();this[_0x3a1a('0xc')][_0x1694bd['peer']][_0x3a1a('0x46')]=_0x1694bd[_0x3a1a('0x46')];logger[_0x3a1a('0x2b')](_0x3a1a('0x48'),util[_0x3a1a('0x1b')](this[_0x3a1a('0xc')][_0x1694bd[_0x3a1a('0x44')]],{'showHidden':![],'depth':null}));this[_0x3a1a('0x22')](util['format'](_0x3a1a('0x37'),this[_0x3a1a('0xc')][_0x1694bd[_0x3a1a('0x44')]][_0x3a1a('0x2e')]),_0x3a1a('0x38'),this[_0x3a1a('0xc')][_0x1694bd[_0x3a1a('0x44')]]);}else if(this['trunks'][_0x1694bd[_0x3a1a('0x44')]]){this['trunks'][_0x1694bd[_0x3a1a('0x44')]][_0x3a1a('0x47')]=_0x1694bd[_0x3a1a('0x43')][_0x3a1a('0x32')]();this[_0x3a1a('0xa')][_0x1694bd[_0x3a1a('0x44')]][_0x3a1a('0x46')]=_0x1694bd[_0x3a1a('0x46')];logger[_0x3a1a('0x2b')]('[userReport][peerstatus]\x20sending\x20trunk:save\x20event:',util[_0x3a1a('0x1b')](this[_0x3a1a('0xa')][_0x1694bd[_0x3a1a('0x44')]],{'showHidden':![],'depth':null}));this[_0x3a1a('0x22')](util[_0x3a1a('0x36')](_0x3a1a('0x2d'),this['trunks'][_0x1694bd[_0x3a1a('0x44')]]['name']),'trunk:save',this['trunks'][_0x1694bd[_0x3a1a('0x44')]]);}}}catch(_0x2d682b){logger[_0x3a1a('0x17')](_0x3a1a('0x49'),util[_0x3a1a('0x1b')](_0x2d682b,{'showHidden':![],'depth':null}));}};module[_0x3a1a('0x4a')]=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index 65438dd..2b592c3 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 _0x682a=['seconds','syncMusicOnHoldStart','channel','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','substring','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','moment','util','ioredis','../../../config/environment','../../../config/logger','../ami','defaults','redis','localhost','socket.io-emitter','channels','voiceChannels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','bind','syncAgentRingNoAnswer','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','hangup','syncHangup','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','prototype','emit','isNotNull','isUndefined','info','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','membername','destuniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20event:','uniqueid','inspect','interface','format','YYYY-MM-DD\x20HH:mm:ss','called','mandatoryDisposition','type','inbound','voice','assign','omit','event','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','queue','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','user:%s','user:called','error','syncAgentConnect','hasOwnProperty','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','merge','pick','destconnectedlinenum','name','accountcode','exten','custom:agentconnect','user:agentconnect','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswer','answeredelsewheremembername','lastevent','answered_elsewhere','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','[%s][voiceAgentReport][agentconnect]\x20Else\x20path\x20should\x20never\x20be\x20taken','[%s][voiceAgentReport][agentringnoanswer]\x20event:','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','agentringnoanswerAt','rejected','reason','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','user:agentringnoanswer','custom:agentringnoanswer','[%s][voiceAgentReport][queuecallerabandon]\x20event:','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','[%s][voiceAgentReport][queuecallerabandon]','syncAgentComplete','[%s][voiceAgentReport][agentcomplete]\x20event:','agentconnectAt','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','transfer','agent','talktime','acw','acwtime','acwTimeout','agentacw','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','custom:agentcomplete','destaccountcode','user:agentcomplete','[%s][voiceAgentReport][agentcomplete]','syncVarSet','[%s][voiceAgentReport][varset]\x20event:','addVariable','keys','variable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','[%s][voiceAgentReport][varset]','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','isNil','agentcompleteAt','values','deleteChannelAfterTimeout','[%s][voiceAgentReport][hangup]','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','complete','diff','secondtransfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete'];(function(_0x4b82e9,_0x4252ac){var _0x5247c4=function(_0x2fcf9c){while(--_0x2fcf9c){_0x4b82e9['push'](_0x4b82e9['shift']());}};_0x5247c4(++_0x4252ac);}(_0x682a,0x148));var _0xa682=function(_0x2decb3,_0x5553a8){_0x2decb3=_0x2decb3-0x0;var _0x3e4189=_0x682a[_0x2decb3];return _0x3e4189;};'use strict';var _=require('lodash');var moment=require(_0xa682('0x0'));var util=require(_0xa682('0x1'));var Redis=require(_0xa682('0x2'));var config=require(_0xa682('0x3'));var logger=require(_0xa682('0x4'))('ami');var ami=require(_0xa682('0x5'));config['redis']=_[_0xa682('0x6')](config[_0xa682('0x7')],{'host':_0xa682('0x8'),'port':0x18eb});var io=require(_0xa682('0x9'))(new Redis(config['redis']));function VoiceAgentReport(_0xe11ef7){this[_0xa682('0xa')]={};this[_0xa682('0xb')]=_0xe11ef7[_0xa682('0xa')];this[_0xa682('0xc')]=_0xe11ef7[_0xa682('0xc')];this['agents']=_0xe11ef7[_0xa682('0xd')];this[_0xa682('0xe')]={};ami['on'](_0xa682('0xf'),this[_0xa682('0x10')][_0xa682('0x11')](this));ami['on']('agentconnect',this['syncAgentConnect']['bind'](this));ami['on']('agentringnoanswer',this[_0xa682('0x12')][_0xa682('0x11')](this));ami['on'](_0xa682('0x13'),this[_0xa682('0x14')][_0xa682('0x11')](this));ami['on'](_0xa682('0x15'),this['syncAgentComplete'][_0xa682('0x11')](this));ami['on']('varset',this['syncVarSet'][_0xa682('0x11')](this));ami['on'](_0xa682('0x16'),this[_0xa682('0x17')]['bind'](this));ami['on']('musiconholdstart',this['syncMusicOnHoldStart'][_0xa682('0x11')](this));ami['on'](_0xa682('0x18'),this[_0xa682('0x19')]['bind'](this));ami['on'](_0xa682('0x1a'),this[_0xa682('0x1b')][_0xa682('0x11')](this));ami['on'](_0xa682('0x1c'),this[_0xa682('0x1d')][_0xa682('0x11')](this));}VoiceAgentReport[_0xa682('0x1e')][_0xa682('0x1f')]=function(_0x1c12fa,_0x3b4796,_0x3220a9){io['to'](_0x1c12fa)['emit'](_0x3b4796,_0x3220a9);};VoiceAgentReport['prototype'][_0xa682('0x20')]=function(_0x2f76c5){return _0x2f76c5!==null&&!_[_0xa682('0x21')](_0x2f76c5);};VoiceAgentReport['prototype'][_0xa682('0x10')]=function(_0x363f6c){try{if(this['isNotNull'](_0x363f6c)){logger[_0xa682('0x22')](_0xa682('0x23'),_0x363f6c['uniqueid'],_0x363f6c[_0xa682('0x24')],_0x363f6c[_0xa682('0x25')]);logger[_0xa682('0x26')](_0xa682('0x27'),_0x363f6c[_0xa682('0x28')],util[_0xa682('0x29')](_0x363f6c,{'showHidden':![],'depth':null}));if(_[_0xa682('0x21')](this[_0xa682('0xa')][_0x363f6c[_0xa682('0x28')]])){this[_0xa682('0xa')][_0x363f6c[_0xa682('0x28')]]={};}var _0x102cd2=this['agents'][_0x363f6c[_0xa682('0x2a')]];var _0x1c3fd1=this[_0xa682('0xa')][_0x363f6c[_0xa682('0x28')]][_0x363f6c[_0xa682('0x25')]];var _0x328a72=this[_0xa682('0xc')][_0x363f6c['queue']];var _0x55377c=this[_0xa682('0xe')][_0x363f6c['uniqueid']];if(_['isUndefined'](_0x1c3fd1)){_0x1c3fd1={'agentcalledAt':moment()[_0xa682('0x2b')](_0xa682('0x2c')),'lastevent':_0xa682('0x2d'),'mandatoryDisposition':_0x328a72&&_0x328a72[_0xa682('0x2e')]?_0x328a72['mandatoryDisposition']:![],'type':_0x328a72&&_0x328a72[_0xa682('0x2f')]?_0x328a72['type']:_0xa682('0x30'),'variables':_0x55377c,'motionChannel':_0xa682('0x31')};}Object[_0xa682('0x32')](_0x1c3fd1,_[_0xa682('0x33')](_0x363f6c,[_0xa682('0x34'),_0xa682('0x35')]));this[_0xa682('0xa')][_0x363f6c['uniqueid']][_0x363f6c[_0xa682('0x25')]]=_0x1c3fd1;logger[_0xa682('0x26')](_0xa682('0x36'),_0x363f6c[_0xa682('0x28')],util[_0xa682('0x29')](_0x1c3fd1,{'showHidden':![],'depth':null}));ami[_0xa682('0x1f')](_0xa682('0x37'),_0x1c3fd1);var _0x231f8a={'id':_0x102cd2['id'],'calleridnum':_0x1c3fd1['calleridnum'],'queue':_0x1c3fd1[_0xa682('0x38')],'variables':_0x1c3fd1[_0xa682('0xe')],'uniqueid':_0x363f6c['uniqueid']};logger[_0xa682('0x26')](_0xa682('0x39'),_0x363f6c['uniqueid'],util[_0xa682('0x29')](_0x231f8a,{'showHidden':![],'depth':null}));this[_0xa682('0x1f')](util[_0xa682('0x2b')](_0xa682('0x3a'),_0x363f6c['membername']),_0xa682('0x3b'),_0x231f8a);}}catch(_0x3f242d){logger[_0xa682('0x3c')]('[%s][voiceAgentReport][agentcalled]',_0x363f6c['uniqueid'],util['inspect'](_0x3f242d,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xa682('0x1e')][_0xa682('0x3d')]=function(_0x5cb68b){try{if(this['isNotNull'](_0x5cb68b)){if(this[_0xa682('0xa')][_0x5cb68b[_0xa682('0x28')]]){for(var _0x40739f in this['channels'][_0x5cb68b[_0xa682('0x28')]]){if(this[_0xa682('0xa')][_0x5cb68b[_0xa682('0x28')]][_0xa682('0x3e')](_0x40739f)){if(_0x5cb68b[_0xa682('0x25')]===_0x40739f){logger[_0xa682('0x22')](_0xa682('0x3f'),_0x5cb68b[_0xa682('0x28')],_0x5cb68b[_0xa682('0x24')],_0x5cb68b[_0xa682('0x25')]);this[_0xa682('0xa')][_0x5cb68b[_0xa682('0x28')]][_0x40739f]['agentconnectAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0xa682('0xa')][_0x5cb68b['uniqueid']][_0x40739f][_0xa682('0x40')]=_0x5cb68b['connectedlinename'];this['channels'][_0x5cb68b['uniqueid']][_0x40739f][_0xa682('0x41')]=_0x5cb68b[_0xa682('0x41')];this['channels'][_0x5cb68b['uniqueid']][_0x40739f][_0xa682('0x42')]=_0x5cb68b['destchannelstate'];this['channels'][_0x5cb68b[_0xa682('0x28')]][_0x40739f][_0xa682('0x43')]=_0x5cb68b[_0xa682('0x43')];this[_0xa682('0xa')][_0x5cb68b[_0xa682('0x28')]][_0x40739f]['holdtime']=_0x5cb68b[_0xa682('0x44')];this[_0xa682('0xa')][_0x5cb68b[_0xa682('0x28')]][_0x40739f]['lastevent']='connect';_[_0xa682('0x45')](this[_0xa682('0xd')][_0x5cb68b['interface']],_[_0xa682('0x46')](_0x5cb68b,[_0xa682('0x38'),_0xa682('0x47')]));var _0x12ae68=this[_0xa682('0xd')][_0x5cb68b['interface']];var _0x23e06b={'id':_0x12ae68['id'],'name':_0x12ae68[_0xa682('0x48')],'agentconnected':!![],'destaccountcode':_0x12ae68[_0xa682('0x49')],'destconnectedlinenum':this[_0xa682('0xa')][_0x5cb68b[_0xa682('0x28')]][_0x5cb68b[_0xa682('0x25')]][_0xa682('0x4a')],'queue':this['channels'][_0x5cb68b['uniqueid']][_0x5cb68b[_0xa682('0x25')]][_0xa682('0x38')],'uniqueid':this[_0xa682('0xa')][_0x5cb68b[_0xa682('0x28')]][_0x5cb68b['destuniqueid']]['uniqueid']};ami[_0xa682('0x1f')](_0xa682('0x4b'),this[_0xa682('0xa')][_0x5cb68b['uniqueid']][_0x5cb68b['destuniqueid']]);this[_0xa682('0x1f')](util['format']('user:%s',_0x5cb68b[_0xa682('0x24')]),_0xa682('0x4c'),_0x23e06b);}else if(!this[_0xa682('0xa')][_0x5cb68b['uniqueid']][_0x40739f]['agentringnoanswer']&&!this[_0xa682('0xa')][_0x5cb68b['uniqueid']][_0x40739f][_0xa682('0x15')]){logger['info'](_0xa682('0x4d'),_0x5cb68b['uniqueid'],this[_0xa682('0xa')][_0x5cb68b[_0xa682('0x28')]][_0x40739f]['membername'],_0x40739f);this['channels'][_0x5cb68b[_0xa682('0x28')]][_0x40739f][_0xa682('0x4e')]=!![];this[_0xa682('0xa')][_0x5cb68b[_0xa682('0x28')]][_0x40739f]['agentringnoanswerAt']=moment()[_0xa682('0x2b')](_0xa682('0x2c'));this[_0xa682('0xa')][_0x5cb68b['uniqueid']][_0x40739f]['answeredelsewheredestinationuniqueid']=_0x5cb68b[_0xa682('0x25')];this['channels'][_0x5cb68b[_0xa682('0x28')]][_0x40739f][_0xa682('0x4f')]=_0x5cb68b[_0xa682('0x24')];this[_0xa682('0xa')][_0x5cb68b[_0xa682('0x28')]][_0x40739f][_0xa682('0x50')]=_0xa682('0x51');this[_0xa682('0xa')][_0x5cb68b[_0xa682('0x28')]][_0x40739f]['reason']=_0xa682('0x51');logger[_0xa682('0x26')](_0xa682('0x52'),_0x5cb68b['uniqueid'],util[_0xa682('0x29')](this[_0xa682('0xa')][_0x5cb68b[_0xa682('0x28')]][_0x40739f],{'showHidden':![],'depth':null}));ami[_0xa682('0x1f')](_0xa682('0x53'),this[_0xa682('0xa')][_0x5cb68b[_0xa682('0x28')]][_0x40739f]);}else{logger[_0xa682('0x26')](_0xa682('0x54'),_0x5cb68b[_0xa682('0x28')]);}}}}}}catch(_0x328705){logger[_0xa682('0x3c')]('[%s][voiceAgentReport][agentconnect]',_0x5cb68b[_0xa682('0x28')],util[_0xa682('0x29')](_0x328705,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xa682('0x12')]=function(_0x59ddb3){try{if(this[_0xa682('0x20')](_0x59ddb3)){logger[_0xa682('0x26')](_0xa682('0x55'),_0x59ddb3[_0xa682('0x28')],util['inspect'](_0x59ddb3,{'showHidden':![],'depth':null}));if(this[_0xa682('0xa')][_0x59ddb3[_0xa682('0x28')]]&&this['channels'][_0x59ddb3['uniqueid']][_0x59ddb3[_0xa682('0x25')]]){logger[_0xa682('0x22')](_0xa682('0x56'),_0x59ddb3['uniqueid'],_0x59ddb3[_0xa682('0x24')],_0x59ddb3[_0xa682('0x25')]);var _0x2e2a25=this['agents'][_0x59ddb3['interface']];var _0x58f1b3=this[_0xa682('0xa')][_0x59ddb3[_0xa682('0x28')]][_0x59ddb3[_0xa682('0x25')]];_0x58f1b3[_0xa682('0x4e')]=!![];_0x58f1b3[_0xa682('0x57')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x58f1b3[_0xa682('0x50')]=_0xa682('0x58');_0x58f1b3[_0xa682('0x59')]=_0xa682('0x58');var _0x58f19a={'id':_0x2e2a25['id'],'name':_0x2e2a25[_0xa682('0x48')],'queue':_0x58f1b3[_0xa682('0x38')],'uniqueid':_0x58f1b3[_0xa682('0x28')]};logger[_0xa682('0x26')](_0xa682('0x5a'),_0x59ddb3['uniqueid'],util[_0xa682('0x29')](_0x58f19a,{'showHidden':![],'depth':null}));this[_0xa682('0x1f')](util[_0xa682('0x2b')](_0xa682('0x3a'),_0x2e2a25['name']),_0xa682('0x5b'),_0x58f19a);ami['emit'](_0xa682('0x5c'),_0x58f1b3);this['channels'][_0x59ddb3[_0xa682('0x28')]][_0x59ddb3[_0xa682('0x25')]]=Object[_0xa682('0x32')]({},_0x58f1b3);}}}catch(_0x498744){logger[_0xa682('0x3c')]('[%s][voiceAgentReport][agentringnoanswer]',_0x59ddb3['uniqueid'],util[_0xa682('0x29')](_0x498744,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xa682('0x14')]=function(_0xf8a952){try{if(this['isNotNull'](_0xf8a952)){logger['debug'](_0xa682('0x5d'),_0xf8a952[_0xa682('0x28')],util[_0xa682('0x29')](_0xf8a952,{'showHidden':![],'depth':null}));if(this[_0xa682('0xa')][_0xf8a952[_0xa682('0x28')]]){for(var _0x5e0c81 in this[_0xa682('0xa')][_0xf8a952[_0xa682('0x28')]]){if(this['channels'][_0xf8a952[_0xa682('0x28')]]['hasOwnProperty'](_0x5e0c81)&&!this[_0xa682('0xa')][_0xf8a952[_0xa682('0x28')]][_0x5e0c81]['agentringnoanswer']&&!this[_0xa682('0xa')][_0xf8a952[_0xa682('0x28')]][_0x5e0c81][_0xa682('0x15')]){logger[_0xa682('0x22')]('[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0xf8a952[_0xa682('0x28')],this['channels'][_0xf8a952[_0xa682('0x28')]][_0x5e0c81][_0xa682('0x24')],_0x5e0c81);this['channels'][_0xf8a952[_0xa682('0x28')]][_0x5e0c81]['agentringnoanswer']=!![];this['channels'][_0xf8a952['uniqueid']][_0x5e0c81][_0xa682('0x57')]=moment()[_0xa682('0x2b')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xa682('0xa')][_0xf8a952['uniqueid']][_0x5e0c81][_0xa682('0x50')]=_0xa682('0x5e');this[_0xa682('0xa')][_0xf8a952[_0xa682('0x28')]][_0x5e0c81][_0xa682('0x59')]=_0xa682('0x5e');logger[_0xa682('0x26')](_0xa682('0x5f'),_0xf8a952[_0xa682('0x28')],util[_0xa682('0x29')](this['channels'][_0xf8a952[_0xa682('0x28')]][_0x5e0c81],{'showHidden':![],'depth':null}));ami[_0xa682('0x1f')](_0xa682('0x60'),this['channels'][_0xf8a952['uniqueid']][_0x5e0c81]);}}}}}catch(_0xef453c){logger['error'](_0xa682('0x61'),_0xf8a952[_0xa682('0x28')],util[_0xa682('0x29')](_0xef453c,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xa682('0x1e')][_0xa682('0x62')]=function(_0x2d86ab){try{if(this[_0xa682('0x20')](_0x2d86ab)){logger['debug'](_0xa682('0x63'),_0x2d86ab[_0xa682('0x28')],util[_0xa682('0x29')](_0x2d86ab,{'showHidden':![],'depth':null}));if(this[_0xa682('0xa')][_0x2d86ab[_0xa682('0x28')]]){for(var _0x40b162 in this[_0xa682('0xa')][_0x2d86ab[_0xa682('0x28')]]){if(this['channels'][_0x2d86ab[_0xa682('0x28')]][_0xa682('0x3e')](_0x40b162)){if(this[_0xa682('0xa')][_0x2d86ab['uniqueid']][_0x40b162][_0xa682('0x64')]&&!this[_0xa682('0xa')][_0x2d86ab[_0xa682('0x28')]][_0x40b162][_0xa682('0x15')]){logger[_0xa682('0x22')](_0xa682('0x65'),_0x2d86ab['uniqueid'],this[_0xa682('0xa')][_0x2d86ab[_0xa682('0x28')]][_0x40b162][_0xa682('0x24')],_0x40b162);this[_0xa682('0xa')][_0x2d86ab[_0xa682('0x28')]][_0x40b162][_0xa682('0x15')]=!![];this['channels'][_0x2d86ab[_0xa682('0x28')]][_0x40b162]['agentcompleteAt']=moment()[_0xa682('0x2b')](_0xa682('0x2c'));this[_0xa682('0xa')][_0x2d86ab['uniqueid']][_0x40b162][_0xa682('0x50')]='complete';this[_0xa682('0xa')][_0x2d86ab[_0xa682('0x28')]][_0x40b162]['reason']=_0x2d86ab[_0xa682('0x59')]==_0xa682('0x66')?_0xa682('0x67'):_0x2d86ab[_0xa682('0x59')];this[_0xa682('0xa')][_0x2d86ab[_0xa682('0x28')]][_0x40b162][_0xa682('0x68')]=_0x2d86ab['talktime'];if(this[_0xa682('0xc')][_0x2d86ab[_0xa682('0x38')]]&&this['voiceQueues'][_0x2d86ab['queue']][_0xa682('0x69')]){this[_0xa682('0xa')][_0x2d86ab[_0xa682('0x28')]][_0x40b162][_0xa682('0x6a')]=this[_0xa682('0xc')][_0x2d86ab[_0xa682('0x38')]][_0xa682('0x6b')];this['channels'][_0x2d86ab[_0xa682('0x28')]][_0x40b162][_0xa682('0x6c')]=!![];}this[_0xa682('0xd')][_0x2d86ab[_0xa682('0x2a')]]=_[_0xa682('0x33')](this[_0xa682('0xd')][_0x2d86ab[_0xa682('0x2a')]],[_0xa682('0x38'),_0xa682('0x47')]);logger[_0xa682('0x26')](_0xa682('0x6d'),_0x2d86ab[_0xa682('0x28')],util['inspect'](this['channels'][_0x2d86ab[_0xa682('0x28')]][_0x40b162],{'showHidden':![],'depth':null}));ami[_0xa682('0x1f')](_0xa682('0x6e'),this[_0xa682('0xa')][_0x2d86ab['uniqueid']][_0x40b162]);logger['debug']('[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:',_0x2d86ab['uniqueid'],util[_0xa682('0x29')]({'id':this[_0xa682('0xd')][_0x2d86ab[_0xa682('0x2a')]]['id'],'destaccountcode':_0x2d86ab[_0xa682('0x6f')]},{'showHidden':![],'depth':null}));this[_0xa682('0x1f')](util[_0xa682('0x2b')](_0xa682('0x3a'),_0x2d86ab[_0xa682('0x24')]),_0xa682('0x70'),{'id':this[_0xa682('0xd')][_0x2d86ab[_0xa682('0x2a')]]['id'],'destaccountcode':Number(_0x2d86ab[_0xa682('0x6f')])});}}}}}}catch(_0xd6c38f){logger[_0xa682('0x3c')](_0xa682('0x71'),_0x2d86ab[_0xa682('0x28')],util[_0xa682('0x29')](_0xd6c38f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xa682('0x1e')][_0xa682('0x72')]=function(_0x4393f2){try{if(this[_0xa682('0x20')](_0x4393f2)){logger['debug'](_0xa682('0x73'),_0x4393f2[_0xa682('0x28')],util[_0xa682('0x29')](_0x4393f2,{'showHidden':![],'depth':null}));this[_0xa682('0x74')](_0x4393f2['uniqueid'],_[_0xa682('0x75')](_0x4393f2[_0xa682('0x76')])[0x0],_0x4393f2[_0xa682('0x77')]);if(this[_0xa682('0xa')][_0x4393f2['uniqueid']]){for(var _0x434492 in this[_0xa682('0xa')][_0x4393f2['uniqueid']]){if(this[_0xa682('0xa')][_0x4393f2['uniqueid']][_0xa682('0x3e')](_0x434492)){logger[_0xa682('0x22')](_0xa682('0x78'),_0x4393f2[_0xa682('0x28')],_0x434492,_['keys'](_0x4393f2[_0xa682('0x76')])[0x0],_0x4393f2[_0xa682('0x77')]);if(_[_0xa682('0x21')](this[_0xa682('0xa')][_0x4393f2[_0xa682('0x28')]][_0x434492]['variables'])){this['channels'][_0x4393f2['uniqueid']][_0x434492][_0xa682('0xe')]={};}this[_0xa682('0xa')][_0x4393f2[_0xa682('0x28')]][_0x434492][_0xa682('0xe')]=this['variables'][_0x4393f2[_0xa682('0x28')]];}}}}}catch(_0x451e51){logger[_0xa682('0x3c')](_0xa682('0x79'),_0x4393f2[_0xa682('0x28')],util['inspect'](_0x451e51,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xa682('0x1e')]['addVariable']=function(_0x464063,_0x18b92f,_0x188679){var _0x5962b7=[_0xa682('0x7a'),'rtpaudioqosbridged',_0xa682('0x7b'),_0xa682('0x7c'),_0xa682('0x7d'),_0xa682('0x7e'),'rtpaudioqosrtt',_0xa682('0x7f'),_0xa682('0x80'),_0xa682('0x81'),_0xa682('0x82'),_0xa682('0x83'),_0xa682('0x84'),_0xa682('0x85'),_0xa682('0x86'),_0xa682('0x87'),'membername',_0xa682('0x88'),_0xa682('0x89')];if(!_[_0xa682('0x8a')](_0x18b92f)&&!_['includes'](_0x5962b7,_0x18b92f)){if(_['isUndefined'](this[_0xa682('0xe')][_0x464063])){this[_0xa682('0xe')][_0x464063]={};}this[_0xa682('0xe')][_0x464063][_0x18b92f]=_0x188679;}};VoiceAgentReport[_0xa682('0x1e')][_0xa682('0x17')]=function(_0x5e399b){try{if(this[_0xa682('0x20')](_0x5e399b)){logger[_0xa682('0x26')]('[%s][voiceAgentReport][hangup]\x20event:',_0x5e399b['uniqueid'],util[_0xa682('0x29')](_0x5e399b,{'showHidden':![],'depth':null}));if(this[_0xa682('0xa')][_0x5e399b['uniqueid']]){for(var _0x382533 in this[_0xa682('0xa')][_0x5e399b['uniqueid']]){if(this[_0xa682('0xa')][_0x5e399b[_0xa682('0x28')]][_0xa682('0x3e')](_0x382533)){if(this[_0xa682('0xa')][_0x5e399b['uniqueid']][_0x382533][_0xa682('0x59')]==_0xa682('0x66')&&this[_0xa682('0xa')][_0x5e399b[_0xa682('0x28')]][_0x382533][_0xa682('0x15')]){logger[_0xa682('0x22')]('[%s][voiceAgentReport][hangup]\x20destuniqueid:%s',_0x5e399b[_0xa682('0x28')],_0x382533);this['channels'][_0x5e399b[_0xa682('0x28')]][_0x382533][_0xa682('0x8b')]=moment()[_0xa682('0x2b')](_0xa682('0x2c'));}}}logger['debug']('[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:',_0x5e399b[_0xa682('0x28')],util[_0xa682('0x29')](_[_0xa682('0x8c')](this[_0xa682('0xa')][_0x5e399b[_0xa682('0x28')]]),{'showHidden':![],'depth':null}));ami[_0xa682('0x1f')]('custom:voiceAgentReport',_[_0xa682('0x8c')](this[_0xa682('0xa')][_0x5e399b['uniqueid']]));this[_0xa682('0x8d')](_0x5e399b['uniqueid']);}if(this[_0xa682('0xe')][_0x5e399b[_0xa682('0x28')]]){delete this[_0xa682('0xe')][_0x5e399b[_0xa682('0x28')]];}}}catch(_0x38c691){logger[_0xa682('0x3c')](_0xa682('0x8e'),_0x5e399b['uniqueid'],util[_0xa682('0x29')](_0x38c691,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xa682('0x1e')][_0xa682('0x1b')]=function(_0x4fcb82){try{if(this[_0xa682('0x20')](_0x4fcb82)){logger['debug'](_0xa682('0x8f'),_0x4fcb82[_0xa682('0x28')],util[_0xa682('0x29')](_0x4fcb82,{'showHidden':![],'depth':null}));if(this[_0xa682('0xa')][_0x4fcb82[_0xa682('0x90')]]){for(var _0x523787 in this['channels'][_0x4fcb82[_0xa682('0x90')]]){if(this[_0xa682('0xa')][_0x4fcb82[_0xa682('0x90')]]['hasOwnProperty'](_0x523787)){if(_0x4fcb82['origtransfereruniqueid']===_0x523787){logger[_0xa682('0x22')](_0xa682('0x91'),_0x4fcb82[_0xa682('0x28')],this[_0xa682('0xa')][_0x4fcb82[_0xa682('0x90')]][_0x523787][_0xa682('0x24')],_0x523787);var _0x168aa8=moment();this[_0xa682('0xa')][_0x4fcb82[_0xa682('0x90')]][_0x523787][_0xa682('0x15')]=!![];this['channels'][_0x4fcb82[_0xa682('0x90')]][_0x523787]['agentcompleteAt']=moment()[_0xa682('0x2b')](_0xa682('0x2c'));this[_0xa682('0xa')][_0x4fcb82[_0xa682('0x90')]][_0x523787][_0xa682('0x50')]=_0xa682('0x92');this[_0xa682('0xa')][_0x4fcb82[_0xa682('0x90')]][_0x523787]['reason']='transfer';this['channels'][_0x4fcb82[_0xa682('0x90')]][_0x523787][_0xa682('0x68')]=_0x168aa8[_0xa682('0x93')](this[_0xa682('0xa')][_0x4fcb82['transfereeuniqueid']][_0x523787][_0xa682('0x64')],'seconds');}}}}if(this[_0xa682('0xa')][_0x4fcb82[_0xa682('0x94')]]){var _0x5c8a13=this[_0xa682('0xa')][_0x4fcb82[_0xa682('0x94')]];this[_0xa682('0xa')][_0x4fcb82[_0xa682('0x94')]]=this[_0xa682('0xa')][_0x4fcb82[_0xa682('0x90')]];this[_0xa682('0xa')][_0x4fcb82[_0xa682('0x90')]]=_0x5c8a13;}}}catch(_0x1dfcba){logger[_0xa682('0x3c')]('[%s][voiceAgentReport][attendedtransfer]',_0x4fcb82['uniqueid'],util[_0xa682('0x29')](_0x1dfcba,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xa682('0x1e')][_0xa682('0x1d')]=function(_0x10858d){try{if(this[_0xa682('0x20')](_0x10858d)){logger[_0xa682('0x26')](_0xa682('0x95'),_0x10858d['uniqueid'],util['inspect'](_0x10858d,{'showHidden':![],'depth':null}));if(this[_0xa682('0xa')][_0x10858d['transfereeuniqueid']]){for(var _0x4ad7d9 in this[_0xa682('0xa')][_0x10858d[_0xa682('0x90')]]){if(this[_0xa682('0xa')][_0x10858d[_0xa682('0x90')]]['hasOwnProperty'](_0x4ad7d9)){if(_0x10858d[_0xa682('0x96')]===_0x4ad7d9){logger['info'](_0xa682('0x97'),_0x10858d[_0xa682('0x28')],this[_0xa682('0xa')][_0x10858d[_0xa682('0x90')]][_0x4ad7d9][_0xa682('0x24')],_0x4ad7d9);var _0x12cdcc=moment();this[_0xa682('0xa')][_0x10858d[_0xa682('0x90')]][_0x4ad7d9][_0xa682('0x15')]=!![];this[_0xa682('0xa')][_0x10858d[_0xa682('0x90')]][_0x4ad7d9][_0xa682('0x8b')]=_0x12cdcc;this['channels'][_0x10858d[_0xa682('0x90')]][_0x4ad7d9][_0xa682('0x50')]='complete';this[_0xa682('0xa')][_0x10858d[_0xa682('0x90')]][_0x4ad7d9]['reason']=_0xa682('0x66');this[_0xa682('0xa')][_0x10858d[_0xa682('0x90')]][_0x4ad7d9][_0xa682('0x68')]=_0x12cdcc[_0xa682('0x93')](this[_0xa682('0xa')][_0x10858d[_0xa682('0x90')]][_0x4ad7d9]['agentconnectAt'],_0xa682('0x98'));}}}}}}catch(_0xcec2e3){logger[_0xa682('0x3c')]('[%s][voiceAgentReport][blindtransfer]',_0x10858d[_0xa682('0x28')],util['inspect'](_0xcec2e3,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xa682('0x1e')][_0xa682('0x99')]=function(_0x22ce75){var _0x4a326e='';try{if(this['isNotNull'](_0x22ce75)){logger[_0xa682('0x26')]('[%s][voiceAgentReport][musiconholdstart]\x20event:',_0x22ce75[_0xa682('0x28')],util[_0xa682('0x29')](_0x22ce75,{'showHidden':![],'depth':null}));if(_0x22ce75[_0xa682('0x9a')]){_0x4a326e=_0x22ce75['channel']['substring'](0x0,_0x22ce75['channel'][_0xa682('0x9b')]('-'));if(this[_0xa682('0xd')][_0x4a326e]){logger[_0xa682('0x22')](_0xa682('0x9c'),_0x22ce75[_0xa682('0x28')],_0x4a326e);this[_0xa682('0xd')][_0x4a326e][_0xa682('0x9d')]=!![];}}}}catch(_0x79053b){logger['error']('[%s][voiceAgentReport][musiconholdstart]',_0x22ce75[_0xa682('0x28')],util['inspect'](_0x79053b,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xa682('0x1e')][_0xa682('0x19')]=function(_0x9550bb){var _0x104685='';try{if(this[_0xa682('0x20')](_0x9550bb)){logger[_0xa682('0x26')]('[%s][voiceAgentReport][musiconholdstop]\x20event:',_0x9550bb[_0xa682('0x28')],util[_0xa682('0x29')](_0x9550bb,{'showHidden':![],'depth':null}));if(_0x9550bb[_0xa682('0x9a')]){_0x104685=_0x9550bb['channel'][_0xa682('0x9e')](0x0,_0x9550bb[_0xa682('0x9a')]['lastIndexOf']('-'));if(this[_0xa682('0xd')][_0x104685]){logger[_0xa682('0x22')](_0xa682('0x9f'),_0x9550bb['uniqueid'],_0x104685);this['agents'][_0x104685][_0xa682('0x9d')]=![];}}}}catch(_0x5cbcea){logger[_0xa682('0x3c')]('[%s][voiceAgentReport][musiconholdstop]',_0x9550bb[_0xa682('0x28')],util[_0xa682('0x29')](_0x5cbcea,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xa682('0x1e')]['deleteChannelAfterTimeout']=function(_0x4dee9b,_0x512d56=0x2710){if(this['channels'][_0x4dee9b]){setTimeout(()=>{delete this['channels'][_0x4dee9b];},_0x512d56);}};module['exports']=VoiceAgentReport; \ No newline at end of file +var _0x72d9=['info','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','lastevent','pick','name','exten','custom:agentconnect','user:agentconnect','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','answeredelsewheremembername','answered_elsewhere','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','[%s][voiceAgentReport][agentconnect]\x20Else\x20path\x20should\x20never\x20be\x20taken','[%s][voiceAgentReport][agentconnect]','syncAgentRingNoAnswer','[%s][voiceAgentReport][agentringnoanswer]\x20event:','agentringnoanswerAt','reason','rejected','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','user:agentringnoanswer','custom:agentringnoanswer','error','[%s][voiceAgentReport][queuecallerabandon]\x20event:','hasOwnProperty','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20event:','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','agent','talktime','acw','acwtime','acwTimeout','agentacw','interface','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','destaccountcode','user:agentcomplete','[%s][voiceAgentReport][agentcomplete]','[%s][voiceAgentReport][varset]\x20event:','keys','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','variable','[%s][voiceAgentReport][varset]','addVariable','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','isNil','includes','transfer','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','values','custom:voiceAgentReport','deleteChannelAfterTimeout','[%s][voiceAgentReport][hangup]','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]','channel','substring','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','[%s][voiceAgentReport][musiconholdstart]','[%s][voiceAgentReport][musiconholdstop]\x20event:','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstop]','lodash','moment','util','../../../config/logger','ami','redis','localhost','channels','voiceChannels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','agentconnect','bind','agentringnoanswer','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','hangup','syncHangup','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncAttendedTransfer','syncBlindTransfer','emit','prototype','isNotNull','isUndefined','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','uniqueid','membername','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','destuniqueid','queue','YYYY-MM-DD\x20HH:mm:ss','mandatoryDisposition','type','inbound','voice','assign','omit','event','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','calleridnum','debug','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','format','user:%s','user:called','[%s][voiceAgentReport][agentcalled]','syncAgentConnect'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x72d9,0x19c));var _0x972d=function(_0x9fd887,_0x47f76c){_0x9fd887=_0x9fd887-0x0;var _0x1a54ab=_0x72d9[_0x9fd887];return _0x1a54ab;};'use strict';var _=require(_0x972d('0x0'));var moment=require(_0x972d('0x1'));var util=require(_0x972d('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0x972d('0x3'))(_0x972d('0x4'));var ami=require('../ami');config[_0x972d('0x5')]=_['defaults'](config[_0x972d('0x5')],{'host':_0x972d('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x972d('0x5')]));function VoiceAgentReport(_0x4ad382){this[_0x972d('0x7')]={};this[_0x972d('0x8')]=_0x4ad382['channels'];this[_0x972d('0x9')]=_0x4ad382['voiceQueues'];this['agents']=_0x4ad382[_0x972d('0xa')];this[_0x972d('0xb')]={};ami['on'](_0x972d('0xc'),this[_0x972d('0xd')]['bind'](this));ami['on'](_0x972d('0xe'),this['syncAgentConnect'][_0x972d('0xf')](this));ami['on'](_0x972d('0x10'),this['syncAgentRingNoAnswer']['bind'](this));ami['on']('queuecallerabandon',this[_0x972d('0x11')][_0x972d('0xf')](this));ami['on'](_0x972d('0x12'),this[_0x972d('0x13')]['bind'](this));ami['on'](_0x972d('0x14'),this['syncVarSet'][_0x972d('0xf')](this));ami['on'](_0x972d('0x15'),this[_0x972d('0x16')][_0x972d('0xf')](this));ami['on'](_0x972d('0x17'),this[_0x972d('0x18')][_0x972d('0xf')](this));ami['on'](_0x972d('0x19'),this['syncMusicOnHoldStop'][_0x972d('0xf')](this));ami['on']('attendedtransfer',this[_0x972d('0x1a')][_0x972d('0xf')](this));ami['on']('blindtransfer',this[_0x972d('0x1b')][_0x972d('0xf')](this));}VoiceAgentReport['prototype'][_0x972d('0x1c')]=function(_0x3cb12e,_0x535591,_0x1c086e){io['to'](_0x3cb12e)[_0x972d('0x1c')](_0x535591,_0x1c086e);};VoiceAgentReport[_0x972d('0x1d')][_0x972d('0x1e')]=function(_0xe3c60a){return _0xe3c60a!==null&&!_[_0x972d('0x1f')](_0xe3c60a);};VoiceAgentReport[_0x972d('0x1d')][_0x972d('0xd')]=function(_0x580fed){try{if(this['isNotNull'](_0x580fed)){logger['info'](_0x972d('0x20'),_0x580fed[_0x972d('0x21')],_0x580fed[_0x972d('0x22')],_0x580fed['destuniqueid']);logger['debug'](_0x972d('0x23'),_0x580fed[_0x972d('0x21')],util[_0x972d('0x24')](_0x580fed,{'showHidden':![],'depth':null}));if(_[_0x972d('0x1f')](this[_0x972d('0x7')][_0x580fed[_0x972d('0x21')]])){this[_0x972d('0x7')][_0x580fed[_0x972d('0x21')]]={};}var _0x4cd43d=this[_0x972d('0xa')][_0x580fed['interface']];var _0x11465b=this[_0x972d('0x7')][_0x580fed[_0x972d('0x21')]][_0x580fed[_0x972d('0x25')]];var _0x2a5f18=this[_0x972d('0x9')][_0x580fed[_0x972d('0x26')]];var _0x281f50=this[_0x972d('0xb')][_0x580fed[_0x972d('0x21')]];if(_[_0x972d('0x1f')](_0x11465b)){_0x11465b={'agentcalledAt':moment()['format'](_0x972d('0x27')),'lastevent':'called','mandatoryDisposition':_0x2a5f18&&_0x2a5f18[_0x972d('0x28')]?_0x2a5f18[_0x972d('0x28')]:![],'type':_0x2a5f18&&_0x2a5f18[_0x972d('0x29')]?_0x2a5f18['type']:_0x972d('0x2a'),'variables':_0x281f50,'motionChannel':_0x972d('0x2b')};}Object[_0x972d('0x2c')](_0x11465b,_[_0x972d('0x2d')](_0x580fed,[_0x972d('0x2e'),'privilege']));this['channels'][_0x580fed[_0x972d('0x21')]][_0x580fed['destuniqueid']]=_0x11465b;logger['debug'](_0x972d('0x2f'),_0x580fed[_0x972d('0x21')],util[_0x972d('0x24')](_0x11465b,{'showHidden':![],'depth':null}));ami[_0x972d('0x1c')]('custom:agentcalled',_0x11465b);var _0x51fe7c={'id':_0x4cd43d['id'],'calleridnum':_0x11465b[_0x972d('0x30')],'queue':_0x11465b[_0x972d('0x26')],'variables':_0x11465b[_0x972d('0xb')],'uniqueid':_0x580fed[_0x972d('0x21')]};logger[_0x972d('0x31')](_0x972d('0x32'),_0x580fed[_0x972d('0x21')],util['inspect'](_0x51fe7c,{'showHidden':![],'depth':null}));this['emit'](util[_0x972d('0x33')](_0x972d('0x34'),_0x580fed[_0x972d('0x22')]),_0x972d('0x35'),_0x51fe7c);}}catch(_0x5dbc68){logger['error'](_0x972d('0x36'),_0x580fed[_0x972d('0x21')],util['inspect'](_0x5dbc68,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x972d('0x1d')][_0x972d('0x37')]=function(_0x4cb310){try{if(this['isNotNull'](_0x4cb310)){if(this[_0x972d('0x7')][_0x4cb310[_0x972d('0x21')]]){for(var _0x21d012 in this['channels'][_0x4cb310[_0x972d('0x21')]]){if(this['channels'][_0x4cb310[_0x972d('0x21')]]['hasOwnProperty'](_0x21d012)){if(_0x4cb310[_0x972d('0x25')]===_0x21d012){logger[_0x972d('0x38')](_0x972d('0x39'),_0x4cb310[_0x972d('0x21')],_0x4cb310[_0x972d('0x22')],_0x4cb310[_0x972d('0x25')]);this[_0x972d('0x7')][_0x4cb310[_0x972d('0x21')]][_0x21d012][_0x972d('0x3a')]=moment()[_0x972d('0x33')](_0x972d('0x27'));this['channels'][_0x4cb310[_0x972d('0x21')]][_0x21d012][_0x972d('0x3b')]=_0x4cb310[_0x972d('0x3b')];this[_0x972d('0x7')][_0x4cb310[_0x972d('0x21')]][_0x21d012][_0x972d('0x3c')]=_0x4cb310[_0x972d('0x3c')];this[_0x972d('0x7')][_0x4cb310[_0x972d('0x21')]][_0x21d012][_0x972d('0x3d')]=_0x4cb310['destchannelstate'];this['channels'][_0x4cb310[_0x972d('0x21')]][_0x21d012][_0x972d('0x3e')]=_0x4cb310['destchannelstatedesc'];this[_0x972d('0x7')][_0x4cb310['uniqueid']][_0x21d012]['holdtime']=_0x4cb310[_0x972d('0x3f')];this['channels'][_0x4cb310[_0x972d('0x21')]][_0x21d012][_0x972d('0x40')]='connect';_['merge'](this[_0x972d('0xa')][_0x4cb310['interface']],_[_0x972d('0x41')](_0x4cb310,[_0x972d('0x26'),'destconnectedlinenum']));var _0xc06aa9=this[_0x972d('0xa')][_0x4cb310['interface']];var _0x33f138={'id':_0xc06aa9['id'],'name':_0xc06aa9[_0x972d('0x42')],'agentconnected':!![],'destaccountcode':_0xc06aa9['accountcode'],'destconnectedlinenum':this[_0x972d('0x7')][_0x4cb310[_0x972d('0x21')]][_0x4cb310['destuniqueid']][_0x972d('0x43')],'queue':this[_0x972d('0x7')][_0x4cb310[_0x972d('0x21')]][_0x4cb310[_0x972d('0x25')]][_0x972d('0x26')],'uniqueid':this[_0x972d('0x7')][_0x4cb310[_0x972d('0x21')]][_0x4cb310[_0x972d('0x25')]]['uniqueid']};ami[_0x972d('0x1c')](_0x972d('0x44'),this[_0x972d('0x7')][_0x4cb310['uniqueid']][_0x4cb310[_0x972d('0x25')]]);this[_0x972d('0x1c')](util[_0x972d('0x33')]('user:%s',_0x4cb310[_0x972d('0x22')]),_0x972d('0x45'),_0x33f138);}else if(!this[_0x972d('0x7')][_0x4cb310[_0x972d('0x21')]][_0x21d012]['agentringnoanswer']&&!this[_0x972d('0x7')][_0x4cb310[_0x972d('0x21')]][_0x21d012][_0x972d('0x12')]){logger['info'](_0x972d('0x46'),_0x4cb310[_0x972d('0x21')],this[_0x972d('0x7')][_0x4cb310[_0x972d('0x21')]][_0x21d012][_0x972d('0x22')],_0x21d012);this[_0x972d('0x7')][_0x4cb310[_0x972d('0x21')]][_0x21d012][_0x972d('0x10')]=!![];this[_0x972d('0x7')][_0x4cb310[_0x972d('0x21')]][_0x21d012]['agentringnoanswerAt']=moment()[_0x972d('0x33')](_0x972d('0x27'));this['channels'][_0x4cb310[_0x972d('0x21')]][_0x21d012]['answeredelsewheredestinationuniqueid']=_0x4cb310['destuniqueid'];this['channels'][_0x4cb310[_0x972d('0x21')]][_0x21d012][_0x972d('0x47')]=_0x4cb310['membername'];this[_0x972d('0x7')][_0x4cb310[_0x972d('0x21')]][_0x21d012]['lastevent']='answered_elsewhere';this[_0x972d('0x7')][_0x4cb310[_0x972d('0x21')]][_0x21d012]['reason']=_0x972d('0x48');logger[_0x972d('0x31')](_0x972d('0x49'),_0x4cb310[_0x972d('0x21')],util[_0x972d('0x24')](this['channels'][_0x4cb310['uniqueid']][_0x21d012],{'showHidden':![],'depth':null}));ami[_0x972d('0x1c')](_0x972d('0x4a'),this['channels'][_0x4cb310['uniqueid']][_0x21d012]);}else{logger[_0x972d('0x31')](_0x972d('0x4b'),_0x4cb310['uniqueid']);}}}}}}catch(_0x2862b6){logger['error'](_0x972d('0x4c'),_0x4cb310[_0x972d('0x21')],util[_0x972d('0x24')](_0x2862b6,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x972d('0x4d')]=function(_0x1c2e5f){try{if(this[_0x972d('0x1e')](_0x1c2e5f)){logger[_0x972d('0x31')](_0x972d('0x4e'),_0x1c2e5f[_0x972d('0x21')],util['inspect'](_0x1c2e5f,{'showHidden':![],'depth':null}));if(this['channels'][_0x1c2e5f[_0x972d('0x21')]]&&this[_0x972d('0x7')][_0x1c2e5f[_0x972d('0x21')]][_0x1c2e5f[_0x972d('0x25')]]){logger[_0x972d('0x38')]('[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected',_0x1c2e5f[_0x972d('0x21')],_0x1c2e5f['membername'],_0x1c2e5f[_0x972d('0x25')]);var _0xf76df5=this['agents'][_0x1c2e5f['interface']];var _0x3979b3=this[_0x972d('0x7')][_0x1c2e5f[_0x972d('0x21')]][_0x1c2e5f[_0x972d('0x25')]];_0x3979b3['agentringnoanswer']=!![];_0x3979b3[_0x972d('0x4f')]=moment()['format'](_0x972d('0x27'));_0x3979b3[_0x972d('0x40')]='rejected';_0x3979b3[_0x972d('0x50')]=_0x972d('0x51');var _0x350c51={'id':_0xf76df5['id'],'name':_0xf76df5[_0x972d('0x42')],'queue':_0x3979b3[_0x972d('0x26')],'uniqueid':_0x3979b3[_0x972d('0x21')]};logger[_0x972d('0x31')](_0x972d('0x52'),_0x1c2e5f[_0x972d('0x21')],util['inspect'](_0x350c51,{'showHidden':![],'depth':null}));this[_0x972d('0x1c')](util[_0x972d('0x33')](_0x972d('0x34'),_0xf76df5[_0x972d('0x42')]),_0x972d('0x53'),_0x350c51);ami[_0x972d('0x1c')](_0x972d('0x54'),_0x3979b3);this['channels'][_0x1c2e5f[_0x972d('0x21')]][_0x1c2e5f['destuniqueid']]=Object[_0x972d('0x2c')]({},_0x3979b3);}}}catch(_0x5ed324){logger[_0x972d('0x55')]('[%s][voiceAgentReport][agentringnoanswer]',_0x1c2e5f['uniqueid'],util['inspect'](_0x5ed324,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x972d('0x1d')][_0x972d('0x11')]=function(_0x2c9847){try{if(this['isNotNull'](_0x2c9847)){logger[_0x972d('0x31')](_0x972d('0x56'),_0x2c9847[_0x972d('0x21')],util['inspect'](_0x2c9847,{'showHidden':![],'depth':null}));if(this[_0x972d('0x7')][_0x2c9847[_0x972d('0x21')]]){for(var _0x363b2d in this[_0x972d('0x7')][_0x2c9847['uniqueid']]){if(this[_0x972d('0x7')][_0x2c9847[_0x972d('0x21')]][_0x972d('0x57')](_0x363b2d)&&!this[_0x972d('0x7')][_0x2c9847[_0x972d('0x21')]][_0x363b2d]['agentringnoanswer']&&!this['channels'][_0x2c9847['uniqueid']][_0x363b2d][_0x972d('0x12')]){logger[_0x972d('0x38')](_0x972d('0x58'),_0x2c9847[_0x972d('0x21')],this[_0x972d('0x7')][_0x2c9847[_0x972d('0x21')]][_0x363b2d][_0x972d('0x22')],_0x363b2d);this[_0x972d('0x7')][_0x2c9847[_0x972d('0x21')]][_0x363b2d]['agentringnoanswer']=!![];this[_0x972d('0x7')][_0x2c9847[_0x972d('0x21')]][_0x363b2d][_0x972d('0x4f')]=moment()['format'](_0x972d('0x27'));this[_0x972d('0x7')][_0x2c9847[_0x972d('0x21')]][_0x363b2d][_0x972d('0x40')]='abandoned';this[_0x972d('0x7')][_0x2c9847[_0x972d('0x21')]][_0x363b2d][_0x972d('0x50')]='abandoned';logger[_0x972d('0x31')](_0x972d('0x59'),_0x2c9847[_0x972d('0x21')],util[_0x972d('0x24')](this[_0x972d('0x7')][_0x2c9847[_0x972d('0x21')]][_0x363b2d],{'showHidden':![],'depth':null}));ami['emit']('custom:agentqueuecallerabandon',this[_0x972d('0x7')][_0x2c9847[_0x972d('0x21')]][_0x363b2d]);}}}}}catch(_0x3e40c9){logger[_0x972d('0x55')](_0x972d('0x5a'),_0x2c9847[_0x972d('0x21')],util[_0x972d('0x24')](_0x3e40c9,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x972d('0x1d')][_0x972d('0x13')]=function(_0x4263f6){try{if(this[_0x972d('0x1e')](_0x4263f6)){logger[_0x972d('0x31')](_0x972d('0x5b'),_0x4263f6[_0x972d('0x21')],util[_0x972d('0x24')](_0x4263f6,{'showHidden':![],'depth':null}));if(this[_0x972d('0x7')][_0x4263f6[_0x972d('0x21')]]){for(var _0x1702ff in this[_0x972d('0x7')][_0x4263f6[_0x972d('0x21')]]){if(this[_0x972d('0x7')][_0x4263f6[_0x972d('0x21')]][_0x972d('0x57')](_0x1702ff)){if(this['channels'][_0x4263f6[_0x972d('0x21')]][_0x1702ff][_0x972d('0x3a')]&&!this[_0x972d('0x7')][_0x4263f6[_0x972d('0x21')]][_0x1702ff][_0x972d('0x12')]){logger['info'](_0x972d('0x5c'),_0x4263f6[_0x972d('0x21')],this[_0x972d('0x7')][_0x4263f6[_0x972d('0x21')]][_0x1702ff][_0x972d('0x22')],_0x1702ff);this[_0x972d('0x7')][_0x4263f6['uniqueid']][_0x1702ff]['agentcomplete']=!![];this[_0x972d('0x7')][_0x4263f6[_0x972d('0x21')]][_0x1702ff][_0x972d('0x5d')]=moment()['format'](_0x972d('0x27'));this['channels'][_0x4263f6['uniqueid']][_0x1702ff][_0x972d('0x40')]=_0x972d('0x5e');this['channels'][_0x4263f6[_0x972d('0x21')]][_0x1702ff][_0x972d('0x50')]=_0x4263f6[_0x972d('0x50')]=='transfer'?_0x972d('0x5f'):_0x4263f6[_0x972d('0x50')];this[_0x972d('0x7')][_0x4263f6[_0x972d('0x21')]][_0x1702ff][_0x972d('0x60')]=_0x4263f6['talktime'];if(this[_0x972d('0x9')][_0x4263f6[_0x972d('0x26')]]&&this['voiceQueues'][_0x4263f6['queue']][_0x972d('0x61')]){this[_0x972d('0x7')][_0x4263f6['uniqueid']][_0x1702ff][_0x972d('0x62')]=this[_0x972d('0x9')][_0x4263f6[_0x972d('0x26')]][_0x972d('0x63')];this[_0x972d('0x7')][_0x4263f6[_0x972d('0x21')]][_0x1702ff][_0x972d('0x64')]=!![];}this[_0x972d('0xa')][_0x4263f6[_0x972d('0x65')]]=_[_0x972d('0x2d')](this[_0x972d('0xa')][_0x4263f6[_0x972d('0x65')]],['queue','destconnectedlinenum']);logger[_0x972d('0x31')](_0x972d('0x66'),_0x4263f6['uniqueid'],util['inspect'](this[_0x972d('0x7')][_0x4263f6[_0x972d('0x21')]][_0x1702ff],{'showHidden':![],'depth':null}));ami[_0x972d('0x1c')]('custom:agentcomplete',this[_0x972d('0x7')][_0x4263f6[_0x972d('0x21')]][_0x1702ff]);logger[_0x972d('0x31')]('[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:',_0x4263f6[_0x972d('0x21')],util[_0x972d('0x24')]({'id':this[_0x972d('0xa')][_0x4263f6[_0x972d('0x65')]]['id'],'destaccountcode':_0x4263f6[_0x972d('0x67')]},{'showHidden':![],'depth':null}));this[_0x972d('0x1c')](util[_0x972d('0x33')]('user:%s',_0x4263f6['membername']),_0x972d('0x68'),{'id':this[_0x972d('0xa')][_0x4263f6[_0x972d('0x65')]]['id'],'destaccountcode':Number(_0x4263f6['destaccountcode'])});}}}}}}catch(_0x617118){logger['error'](_0x972d('0x69'),_0x4263f6[_0x972d('0x21')],util[_0x972d('0x24')](_0x617118,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x972d('0x1d')]['syncVarSet']=function(_0x2fe964){try{if(this['isNotNull'](_0x2fe964)){logger[_0x972d('0x31')](_0x972d('0x6a'),_0x2fe964['uniqueid'],util['inspect'](_0x2fe964,{'showHidden':![],'depth':null}));this['addVariable'](_0x2fe964[_0x972d('0x21')],_[_0x972d('0x6b')](_0x2fe964['variable'])[0x0],_0x2fe964[_0x972d('0x6c')]);if(this[_0x972d('0x7')][_0x2fe964[_0x972d('0x21')]]){for(var _0x5eb26b in this['channels'][_0x2fe964[_0x972d('0x21')]]){if(this[_0x972d('0x7')][_0x2fe964['uniqueid']][_0x972d('0x57')](_0x5eb26b)){logger[_0x972d('0x38')](_0x972d('0x6d'),_0x2fe964[_0x972d('0x21')],_0x5eb26b,_['keys'](_0x2fe964[_0x972d('0x6e')])[0x0],_0x2fe964['value']);if(_[_0x972d('0x1f')](this['channels'][_0x2fe964[_0x972d('0x21')]][_0x5eb26b][_0x972d('0xb')])){this[_0x972d('0x7')][_0x2fe964[_0x972d('0x21')]][_0x5eb26b][_0x972d('0xb')]={};}this[_0x972d('0x7')][_0x2fe964[_0x972d('0x21')]][_0x5eb26b][_0x972d('0xb')]=this[_0x972d('0xb')][_0x2fe964[_0x972d('0x21')]];}}}}}catch(_0x3ff9ab){logger['error'](_0x972d('0x6f'),_0x2fe964[_0x972d('0x21')],util[_0x972d('0x24')](_0x3ff9ab,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x972d('0x1d')][_0x972d('0x70')]=function(_0x54eeac,_0x30b08c,_0x282094){var _0x3fde5d=[_0x972d('0x71'),_0x972d('0x72'),_0x972d('0x73'),'rtpaudioqosjitterbridged',_0x972d('0x74'),_0x972d('0x75'),_0x972d('0x76'),_0x972d('0x77'),_0x972d('0x78'),_0x972d('0x79'),_0x972d('0x7a'),_0x972d('0x7b'),_0x972d('0x7c'),_0x972d('0x7d'),_0x972d('0x7e'),_0x972d('0x7f'),_0x972d('0x22'),_0x972d('0x80'),'memberrealtime'];if(!_[_0x972d('0x81')](_0x30b08c)&&!_[_0x972d('0x82')](_0x3fde5d,_0x30b08c)){if(_[_0x972d('0x1f')](this['variables'][_0x54eeac])){this['variables'][_0x54eeac]={};}this[_0x972d('0xb')][_0x54eeac][_0x30b08c]=_0x282094;}};VoiceAgentReport[_0x972d('0x1d')][_0x972d('0x16')]=function(_0x3398c7){try{if(this['isNotNull'](_0x3398c7)){logger['debug']('[%s][voiceAgentReport][hangup]\x20event:',_0x3398c7[_0x972d('0x21')],util[_0x972d('0x24')](_0x3398c7,{'showHidden':![],'depth':null}));if(this['channels'][_0x3398c7[_0x972d('0x21')]]){for(var _0xd70e32 in this[_0x972d('0x7')][_0x3398c7[_0x972d('0x21')]]){if(this[_0x972d('0x7')][_0x3398c7[_0x972d('0x21')]]['hasOwnProperty'](_0xd70e32)){if(this['channels'][_0x3398c7[_0x972d('0x21')]][_0xd70e32]['reason']==_0x972d('0x83')&&this[_0x972d('0x7')][_0x3398c7[_0x972d('0x21')]][_0xd70e32][_0x972d('0x12')]){logger['info'](_0x972d('0x84'),_0x3398c7[_0x972d('0x21')],_0xd70e32);this[_0x972d('0x7')][_0x3398c7['uniqueid']][_0xd70e32]['agentcompleteAt']=moment()[_0x972d('0x33')]('YYYY-MM-DD\x20HH:mm:ss');}}}logger[_0x972d('0x31')]('[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:',_0x3398c7['uniqueid'],util[_0x972d('0x24')](_[_0x972d('0x85')](this['channels'][_0x3398c7[_0x972d('0x21')]]),{'showHidden':![],'depth':null}));ami[_0x972d('0x1c')](_0x972d('0x86'),_['values'](this[_0x972d('0x7')][_0x3398c7[_0x972d('0x21')]]));this[_0x972d('0x87')](_0x3398c7['uniqueid']);}if(this[_0x972d('0xb')][_0x3398c7[_0x972d('0x21')]]){delete this['variables'][_0x3398c7[_0x972d('0x21')]];}}}catch(_0x2a14ee){logger['error'](_0x972d('0x88'),_0x3398c7[_0x972d('0x21')],util[_0x972d('0x24')](_0x2a14ee,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x972d('0x1d')][_0x972d('0x1a')]=function(_0x192645){try{if(this['isNotNull'](_0x192645)){logger['debug'](_0x972d('0x89'),_0x192645[_0x972d('0x21')],util['inspect'](_0x192645,{'showHidden':![],'depth':null}));if(this[_0x972d('0x7')][_0x192645['transfereeuniqueid']]){for(var _0x5e65a5 in this['channels'][_0x192645[_0x972d('0x8a')]]){if(this['channels'][_0x192645['transfereeuniqueid']][_0x972d('0x57')](_0x5e65a5)){if(_0x192645[_0x972d('0x8b')]===_0x5e65a5){logger[_0x972d('0x38')]('[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x192645[_0x972d('0x21')],this[_0x972d('0x7')][_0x192645[_0x972d('0x8a')]][_0x5e65a5]['membername'],_0x5e65a5);var _0xfc66f2=moment();this[_0x972d('0x7')][_0x192645[_0x972d('0x8a')]][_0x5e65a5]['agentcomplete']=!![];this[_0x972d('0x7')][_0x192645['transfereeuniqueid']][_0x5e65a5][_0x972d('0x5d')]=moment()[_0x972d('0x33')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x192645['transfereeuniqueid']][_0x5e65a5][_0x972d('0x40')]=_0x972d('0x5e');this['channels'][_0x192645[_0x972d('0x8a')]][_0x5e65a5][_0x972d('0x50')]=_0x972d('0x83');this[_0x972d('0x7')][_0x192645[_0x972d('0x8a')]][_0x5e65a5][_0x972d('0x60')]=_0xfc66f2[_0x972d('0x8c')](this[_0x972d('0x7')][_0x192645[_0x972d('0x8a')]][_0x5e65a5][_0x972d('0x3a')],_0x972d('0x8d'));}}}}if(this[_0x972d('0x7')][_0x192645[_0x972d('0x8e')]]){var _0x4a7968=this[_0x972d('0x7')][_0x192645[_0x972d('0x8e')]];this[_0x972d('0x7')][_0x192645[_0x972d('0x8e')]]=this[_0x972d('0x7')][_0x192645[_0x972d('0x8a')]];this[_0x972d('0x7')][_0x192645['transfereeuniqueid']]=_0x4a7968;}}}catch(_0x366d02){logger['error'](_0x972d('0x8f'),_0x192645['uniqueid'],util['inspect'](_0x366d02,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x972d('0x1b')]=function(_0x327f55){try{if(this['isNotNull'](_0x327f55)){logger[_0x972d('0x31')](_0x972d('0x90'),_0x327f55[_0x972d('0x21')],util[_0x972d('0x24')](_0x327f55,{'showHidden':![],'depth':null}));if(this[_0x972d('0x7')][_0x327f55[_0x972d('0x8a')]]){for(var _0x371846 in this[_0x972d('0x7')][_0x327f55[_0x972d('0x8a')]]){if(this[_0x972d('0x7')][_0x327f55[_0x972d('0x8a')]][_0x972d('0x57')](_0x371846)){if(_0x327f55[_0x972d('0x91')]===_0x371846){logger[_0x972d('0x38')]('[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x327f55[_0x972d('0x21')],this[_0x972d('0x7')][_0x327f55[_0x972d('0x8a')]][_0x371846][_0x972d('0x22')],_0x371846);var _0x20b3dc=moment();this[_0x972d('0x7')][_0x327f55['transfereeuniqueid']][_0x371846][_0x972d('0x12')]=!![];this['channels'][_0x327f55[_0x972d('0x8a')]][_0x371846][_0x972d('0x5d')]=_0x20b3dc;this[_0x972d('0x7')][_0x327f55['transfereeuniqueid']][_0x371846][_0x972d('0x40')]=_0x972d('0x5e');this[_0x972d('0x7')][_0x327f55['transfereeuniqueid']][_0x371846][_0x972d('0x50')]=_0x972d('0x83');this[_0x972d('0x7')][_0x327f55[_0x972d('0x8a')]][_0x371846][_0x972d('0x60')]=_0x20b3dc[_0x972d('0x8c')](this[_0x972d('0x7')][_0x327f55[_0x972d('0x8a')]][_0x371846][_0x972d('0x3a')],_0x972d('0x8d'));}}}}}}catch(_0x69dcd5){logger[_0x972d('0x55')](_0x972d('0x92'),_0x327f55[_0x972d('0x21')],util[_0x972d('0x24')](_0x69dcd5,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x972d('0x1d')][_0x972d('0x18')]=function(_0x2ce0e7){var _0x1f152d='';try{if(this[_0x972d('0x1e')](_0x2ce0e7)){logger['debug']('[%s][voiceAgentReport][musiconholdstart]\x20event:',_0x2ce0e7[_0x972d('0x21')],util['inspect'](_0x2ce0e7,{'showHidden':![],'depth':null}));if(_0x2ce0e7['channel']){_0x1f152d=_0x2ce0e7[_0x972d('0x93')][_0x972d('0x94')](0x0,_0x2ce0e7['channel'][_0x972d('0x95')]('-'));if(this[_0x972d('0xa')][_0x1f152d]){logger[_0x972d('0x38')](_0x972d('0x96'),_0x2ce0e7['uniqueid'],_0x1f152d);this['agents'][_0x1f152d]['onhold']=!![];}}}}catch(_0x4f9d77){logger['error'](_0x972d('0x97'),_0x2ce0e7[_0x972d('0x21')],util[_0x972d('0x24')](_0x4f9d77,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x972d('0x1d')]['syncMusicOnHoldStop']=function(_0x5ce81e){var _0xa31876='';try{if(this[_0x972d('0x1e')](_0x5ce81e)){logger['debug'](_0x972d('0x98'),_0x5ce81e[_0x972d('0x21')],util['inspect'](_0x5ce81e,{'showHidden':![],'depth':null}));if(_0x5ce81e[_0x972d('0x93')]){_0xa31876=_0x5ce81e[_0x972d('0x93')][_0x972d('0x94')](0x0,_0x5ce81e[_0x972d('0x93')][_0x972d('0x95')]('-'));if(this['agents'][_0xa31876]){logger[_0x972d('0x38')](_0x972d('0x99'),_0x5ce81e[_0x972d('0x21')],_0xa31876);this['agents'][_0xa31876][_0x972d('0x9a')]=![];}}}}catch(_0x4c0f61){logger[_0x972d('0x55')](_0x972d('0x9b'),_0x5ce81e[_0x972d('0x21')],util[_0x972d('0x24')](_0x4c0f61,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x972d('0x1d')][_0x972d('0x87')]=function(_0x3818d5,_0x50378b=0x2710){if(this[_0x972d('0x7')][_0x3818d5]){setTimeout(()=>{delete this[_0x972d('0x7')][_0x3818d5];},_0x50378b);}};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 92a8d69..937f63a 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 _0x494a=['error','[voiceCallReport][coreshowchannels]','inspect','prototype','isNotNull','emit','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridname','calleridnum','[%s][voiceCallReport][newcallerid]\x20event:','linkedid','isUndefined','merge','pick','context','from-sip','agents','channel','split','exten','xcally-motion-preview','destconnectedlinenum','format','name','user:agentconnect','accountcode','connectedlinenum','[%s][voiceCallReport][newcallerid]','debug','[%s][voiceCallReport][newchannel]\x20event:','OutgoingSpoolFailed','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','starttime','disposition','toNumber','channelstate','undefined','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','user:%s','[%s][voiceCallReport][newchannel]','syncNewExten','application','toLowerCase','applicationdata','appdata','subtract','duration','seconds','includes','cdr(','match','type','isNil','[%s][voiceCallReport][newexten]','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','answered','YYYY-MM-DD\x20HH:mm:ss','holdtime','destinationchannel','UserId','membername','answertime','diff','connectedlinename','[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','endsWith','replace','.wav49','monitorFilename','find','monitors','rec','[%s][voiceCallReport][mixMonitorFilename]','variable','mixmonitor_filename','value','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','callerid','xmd-cdrtype','xmd-queue','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','xmd-originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','originatecalleridnum','xmd-destination','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','destination','xmd-callerid-preview','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','calleridpreview','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalluniqueid','parse','sipcalllinkedid','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20event:','deleteChannelAfterTimeout','[%s][voiceCallReport][hangup]\x20reason:%s','cause-txt','endtime','billableseconds','omit','user:agentcomplete','keys','transferType','resolve','then','transferToInternal','isEmpty','getSettings','stopRecordingOnTransfer','Action','StopMixMonitor','catch','finally','webbar:stopmonitors','event','BlindTransfer','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][hangup]','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','origtransferercalleridnum','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','transferconnectedlinenum','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','ATTENDED','origtransfererlinkedid','[%s][voiceCallReport][attendedtransfer]','syncBlindTransfer','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','extension','[%s][voiceCallReport][blindtransfer]\x20event:','BLIND','transfereruniqueid','transfererchannel','syncMusicOnHoldStart','[%s][voiceCallReport][musiconholdstart]\x20event:','mohstarttime','[%s][voiceCallReport][musiconholdstop]\x20event:','mohtime','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','exports','lodash','moment','path','ioredis','../../../config/environment','../ami','../model/channel','set','queue','dial','voicemail','NO\x20ANSWER','FAILED','BUSY','redis','defaults','localhost','channels','blindTransfers','coreshowchannel','bind','newexten','newchannel','syncNewChannel','newstate','varset','syncVarSet','hangup','syncHangup','syncNewCallerId','attendedtransfer','syncAttendedTransfer','musiconholdstop','syncMusicOnHoldStop','info','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels'];(function(_0x5ab26e,_0x3d5c3a){var _0x54a540=function(_0x51c54b){while(--_0x51c54b){_0x5ab26e['push'](_0x5ab26e['shift']());}};_0x54a540(++_0x3d5c3a);}(_0x494a,0x161));var _0xa494=function(_0xdd0412,_0x5dc266){_0xdd0412=_0xdd0412-0x0;var _0x331ac5=_0x494a[_0xdd0412];return _0x331ac5;};'use strict';var _=require(_0xa494('0x0'));var moment=require(_0xa494('0x1'));var util=require('util');var path=require(_0xa494('0x2'));var Redis=require(_0xa494('0x3'));var config=require(_0xa494('0x4'));var logger=require('../../../config/logger')('ami');var ami=require(_0xa494('0x5'));var Channel=require(_0xa494('0x6'));var RpcSetting=require('../rpc/setting');var applications=[_0xa494('0x7'),_0xa494('0x8'),'agi',_0xa494('0x9'),'playback',_0xa494('0xa')];var dispositions=[_0xa494('0xb'),_0xa494('0xc'),_0xa494('0xc'),_0xa494('0xb'),_0xa494('0xb'),_0xa494('0xb'),'ANSWERED',_0xa494('0xd'),_0xa494('0xc'),_0xa494('0xc'),_0xa494('0xc')];config[_0xa494('0xe')]=_[_0xa494('0xf')](config[_0xa494('0xe')],{'host':_0xa494('0x10'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xa494('0xe')]));function VoiceCallReport(_0x8e062){this[_0xa494('0x11')]=_0x8e062[_0xa494('0x11')];this['agents']=_0x8e062['agents'];this[_0xa494('0x12')]={};ami['on'](_0xa494('0x13'),this['syncNewExten'][_0xa494('0x14')](this));ami['on'](_0xa494('0x15'),this['syncNewExten']['bind'](this));ami['on'](_0xa494('0x16'),this[_0xa494('0x17')][_0xa494('0x14')](this));ami['on'](_0xa494('0x18'),this['syncNewState']['bind'](this));ami['on'](_0xa494('0x19'),this[_0xa494('0x1a')][_0xa494('0x14')](this));ami['on'](_0xa494('0x1b'),this[_0xa494('0x1c')][_0xa494('0x14')](this));ami['on']('newcallerid',this[_0xa494('0x1d')][_0xa494('0x14')](this));ami['on'](_0xa494('0x1e'),this[_0xa494('0x1f')]['bind'](this));ami['on']('blindtransfer',this['syncBlindTransfer'][_0xa494('0x14')](this));ami['on']('musiconholdstart',this['syncMusicOnHoldStart'][_0xa494('0x14')](this));ami['on'](_0xa494('0x20'),this[_0xa494('0x21')][_0xa494('0x14')](this));try{logger[_0xa494('0x22')](_0xa494('0x23'));ami[_0xa494('0x24')]();}catch(_0xc74035){logger[_0xa494('0x25')](_0xa494('0x26'),util[_0xa494('0x27')](_0xc74035,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0xa494('0x28')][_0xa494('0x29')]=function(_0x1e99d6){return _0x1e99d6!==null&&!_['isUndefined'](_0x1e99d6);};VoiceCallReport[_0xa494('0x28')][_0xa494('0x2a')]=function(_0x274d7b,_0x19354c,_0x59b1c6){io['to'](_0x274d7b)[_0xa494('0x2a')](_0x19354c,_0x59b1c6);};VoiceCallReport[_0xa494('0x28')][_0xa494('0x1d')]=function(_0x1cf01b){try{if(this[_0xa494('0x29')](_0x1cf01b)){logger[_0xa494('0x22')](_0xa494('0x2b'),_0x1cf01b[_0xa494('0x2c')],_0x1cf01b[_0xa494('0x2d')],_0x1cf01b[_0xa494('0x2e')]);logger['debug'](_0xa494('0x2f'),_0x1cf01b['uniqueid'],util[_0xa494('0x27')](_0x1cf01b,{'showHidden':![],'depth':null}));if(_0x1cf01b[_0xa494('0x2c')]===_0x1cf01b[_0xa494('0x30')]){if(!_[_0xa494('0x31')](this[_0xa494('0x11')][_0x1cf01b[_0xa494('0x2c')]])){_[_0xa494('0x32')](this[_0xa494('0x11')][_0x1cf01b[_0xa494('0x2c')]],_[_0xa494('0x33')](_0x1cf01b,_['keys'](this[_0xa494('0x11')][_0x1cf01b[_0xa494('0x2c')]])));}}if(_0x1cf01b[_0xa494('0x34')]===_0xa494('0x35')){var _0x27840a=this[_0xa494('0x36')][_0x1cf01b[_0xa494('0x37')][_0xa494('0x38')]('-')[0x0]];if(_0x27840a){if(_0x1cf01b[_0xa494('0x39')]==_0xa494('0x3a')){_0x27840a[_0xa494('0x3b')]=_0x1cf01b['connectedlinenum'];this[_0xa494('0x2a')](util[_0xa494('0x3c')]('user:%s',_0x27840a[_0xa494('0x3d')]),_0xa494('0x3e'),{'id':_0x27840a['id'],'destaccountcode':_0x27840a[_0xa494('0x3f')],'destconnectedlinenum':_0x1cf01b[_0xa494('0x40')]});}}}}}catch(_0x2826b9){logger[_0xa494('0x25')](_0xa494('0x41'),_0x1cf01b[_0xa494('0x2c')],util[_0xa494('0x27')](_0x2826b9,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xa494('0x28')][_0xa494('0x17')]=function(_0x13a32d){try{if(this[_0xa494('0x29')](_0x13a32d)){logger[_0xa494('0x42')](_0xa494('0x43'),_0x13a32d['uniqueid'],util[_0xa494('0x27')](_0x13a32d,{'showHidden':![],'depth':null}));if(this[_0xa494('0x11')][_0x13a32d['uniqueid']]){return;}if(_0x13a32d[_0xa494('0x37')]===_0xa494('0x44')){return;}if(_0x13a32d[_0xa494('0x2c')]!==_0x13a32d[_0xa494('0x30')]&&!this[_0xa494('0x12')][_0x13a32d[_0xa494('0x30')]]){return;}logger[_0xa494('0x22')](_0xa494('0x45'),_0x13a32d[_0xa494('0x2c')],_0x13a32d[_0xa494('0x34')],_0x13a32d['exten']);this[_0xa494('0x11')][_0x13a32d[_0xa494('0x2c')]]=new Channel();this[_0xa494('0x11')][_0x13a32d[_0xa494('0x2c')]][_0xa494('0x46')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0xa494('0x11')][_0x13a32d[_0xa494('0x2c')]][_0xa494('0x47')]=dispositions[_[_0xa494('0x48')](_0x13a32d[_0xa494('0x49')])];_['merge'](this['channels'][_0x13a32d[_0xa494('0x2c')]],_[_0xa494('0x33')](_0x13a32d,_['keys'](this[_0xa494('0x11')][_0x13a32d[_0xa494('0x2c')]])));if(_0x13a32d[_0xa494('0x34')]===_0xa494('0x35')){var _0x372678=this[_0xa494('0x36')][_0x13a32d[_0xa494('0x37')][_0xa494('0x38')]('-')[0x0]];if(_0x372678&&typeof _0x372678[_0xa494('0x3b')]===_0xa494('0x4a')){_0x372678[_0xa494('0x3b')]=_0x13a32d['exten'];logger['debug'](_0xa494('0x4b'),_0x13a32d[_0xa494('0x2c')],util[_0xa494('0x27')]({'id':_0x372678['id'],'destaccountcode':_0x372678[_0xa494('0x3f')],'destconnectedlinenum':_0x13a32d[_0xa494('0x39')]},{'showHidden':![],'depth':null}));this['emit'](util['format'](_0xa494('0x4c'),_0x372678[_0xa494('0x3d')]),_0xa494('0x3e'),{'id':_0x372678['id'],'destaccountcode':_0x372678[_0xa494('0x3f')],'destconnectedlinenum':_0x13a32d['exten']});}}}}catch(_0x26ee93){logger[_0xa494('0x25')](_0xa494('0x4d'),_0x13a32d[_0xa494('0x2c')],util[_0xa494('0x27')](_0x26ee93,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xa494('0x28')][_0xa494('0x4e')]=function(_0x2ca212){try{if(this[_0xa494('0x29')](_0x2ca212)){logger[_0xa494('0x42')]('[%s][voiceCallReport][newexten]\x20event:',_0x2ca212[_0xa494('0x2c')],util[_0xa494('0x27')](_0x2ca212,{'showHidden':![],'depth':null}));if(_0x2ca212[_0xa494('0x37')]==='OutgoingSpoolFailed'||_0x2ca212[_0xa494('0x39')]==='h')return;if(_0x2ca212[_0xa494('0x2c')]===_0x2ca212['linkedid']||this['blindTransfers'][_0x2ca212['linkedid']]){_0x2ca212[_0xa494('0x4f')]=_0x2ca212[_0xa494('0x4f')]?_0x2ca212[_0xa494('0x4f')][_0xa494('0x50')]():undefined;_0x2ca212[_0xa494('0x51')]=_0x2ca212['appdata']||_0x2ca212[_0xa494('0x51')];if(_0x2ca212[_0xa494('0x52')]&&_0x2ca212[_0xa494('0x4f')]!=='queue'){_0x2ca212[_0xa494('0x51')]=_0x2ca212[_0xa494('0x51')][_0xa494('0x50')]();}logger[_0xa494('0x22')]('[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s',_0x2ca212[_0xa494('0x2c')],_0x2ca212['application'],_0x2ca212['applicationdata']);if(_[_0xa494('0x31')](this['channels'][_0x2ca212['uniqueid']])){this[_0xa494('0x11')][_0x2ca212[_0xa494('0x2c')]]=new Channel();this[_0xa494('0x11')][_0x2ca212['uniqueid']][_0xa494('0x46')]=_0x2ca212['duration']?moment()[_0xa494('0x53')](moment[_0xa494('0x54')](_0x2ca212[_0xa494('0x54')])[_0xa494('0x55')](),_0xa494('0x55'))['format']('YYYY-MM-DD\x20HH:mm:ss'):moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0xa494('0x11')][_0x2ca212[_0xa494('0x2c')]][_0xa494('0x47')]=_0xa494('0xb');}_[_0xa494('0x32')](this[_0xa494('0x11')][_0x2ca212['uniqueid']],_[_0xa494('0x33')](_0x2ca212,_['keys'](this[_0xa494('0x11')][_0x2ca212[_0xa494('0x2c')]])));if(_[_0xa494('0x56')](applications,_0x2ca212[_0xa494('0x4f')])){this[_0xa494('0x11')][_0x2ca212[_0xa494('0x2c')]]['lastapplication']=_0x2ca212[_0xa494('0x4f')];this['channels'][_0x2ca212[_0xa494('0x2c')]]['lastdata']=_0x2ca212[_0xa494('0x51')];if(_0x2ca212[_0xa494('0x4f')]===_0xa494('0x7')&&_['startsWith'](_0x2ca212['applicationdata'][_0xa494('0x50')](),_0xa494('0x57'))){var _0x3cbe85=_0x2ca212[_0xa494('0x51')][_0xa494('0x38')]('=');var _0xdf6ce=_0x3cbe85[0x0]['toLowerCase']()[_0xa494('0x58')](/cdr\((.*)\)/);if(_0xdf6ce){if(_0xdf6ce[0x1]===_0xa494('0x59')&&!_[_0xa494('0x5a')](this['channels'][_0x2ca212[_0xa494('0x2c')]][_0xdf6ce[0x1]]))return;this[_0xa494('0x11')][_0x2ca212[_0xa494('0x2c')]][_0xdf6ce[0x1]]=_0x3cbe85[0x1];}}else if(_0x2ca212['application']===_0xa494('0x8')){this['channels'][_0x2ca212[_0xa494('0x2c')]]['queue']=_0x2ca212[_0xa494('0x51')][_0xa494('0x38')](',')[0x0];}}}}}catch(_0x494609){logger['error'](_0xa494('0x5b'),_0x2ca212[_0xa494('0x2c')],util[_0xa494('0x27')](_0x494609,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xa494('0x28')]['syncNewState']=function(_0x5346e8){try{if(this['isNotNull'](_0x5346e8)){logger[_0xa494('0x22')](_0xa494('0x5c'),_0x5346e8[_0xa494('0x2c')],_0x5346e8['linkedid'],_0x5346e8['calleridname'],_0x5346e8[_0xa494('0x2e')]);logger['debug']('[%s][voiceCallReport][newstate]\x20event:',_0x5346e8['uniqueid'],util['inspect'](_0x5346e8,{'showHidden':![],'depth':null}));if(_0x5346e8[_0xa494('0x49')]!=='6')return;var _0x4ae68c=this[_0xa494('0x36')][_0x5346e8[_0xa494('0x37')][_0xa494('0x38')]('-')[0x0]];if(_0x5346e8['uniqueid']!==_0x5346e8['linkedid']){var _0x44fbea=moment();if(this[_0xa494('0x11')][_0x5346e8[_0xa494('0x30')]]){if(!this[_0xa494('0x11')][_0x5346e8[_0xa494('0x30')]][_0xa494('0x5d')]){this[_0xa494('0x11')][_0x5346e8[_0xa494('0x30')]]['answered']=!![];this[_0xa494('0x11')][_0x5346e8[_0xa494('0x30')]]['answertime']=_0x44fbea[_0xa494('0x3c')](_0xa494('0x5e'));if(this[_0xa494('0x11')][_0x5346e8['linkedid']][_0xa494('0x46')]){this[_0xa494('0x11')][_0x5346e8[_0xa494('0x30')]][_0xa494('0x5f')]=_0x44fbea['diff'](this[_0xa494('0x11')][_0x5346e8[_0xa494('0x30')]][_0xa494('0x46')],'seconds');}}this[_0xa494('0x11')][_0x5346e8[_0xa494('0x30')]][_0xa494('0x30')]=_0x5346e8[_0xa494('0x2c')];if(_0x5346e8[_0xa494('0x2e')]!==_0xa494('0x3a')){this['channels'][_0x5346e8[_0xa494('0x30')]][_0xa494('0x40')]=_0x5346e8[_0xa494('0x2e')];}this['channels'][_0x5346e8[_0xa494('0x30')]]['connectedlinename']=_0x5346e8['calleridname'];this[_0xa494('0x11')][_0x5346e8[_0xa494('0x30')]][_0xa494('0x60')]=_0x5346e8[_0xa494('0x37')];this[_0xa494('0x11')][_0x5346e8[_0xa494('0x30')]][_0xa494('0x47')]=dispositions[_[_0xa494('0x48')](_0x5346e8[_0xa494('0x49')])];if(_0x4ae68c){this[_0xa494('0x11')][_0x5346e8['linkedid']][_0xa494('0x61')]=_0x4ae68c['id'];this[_0xa494('0x11')][_0x5346e8[_0xa494('0x30')]][_0xa494('0x62')]=_0x4ae68c[_0xa494('0x3d')];}}if(this[_0xa494('0x11')][_0x5346e8['uniqueid']]){if(!this[_0xa494('0x11')][_0x5346e8[_0xa494('0x2c')]][_0xa494('0x5d')]){this[_0xa494('0x11')][_0x5346e8[_0xa494('0x2c')]][_0xa494('0x5d')]=!![];this[_0xa494('0x11')][_0x5346e8[_0xa494('0x2c')]][_0xa494('0x63')]=_0x44fbea['format'](_0xa494('0x5e'));if(this[_0xa494('0x11')][_0x5346e8[_0xa494('0x2c')]][_0xa494('0x46')]){this['channels'][_0x5346e8['uniqueid']][_0xa494('0x5f')]=_0x44fbea[_0xa494('0x64')](this[_0xa494('0x11')][_0x5346e8[_0xa494('0x2c')]][_0xa494('0x46')],_0xa494('0x55'));}}if(_0x5346e8[_0xa494('0x2e')]!==_0xa494('0x3a')){this['channels'][_0x5346e8[_0xa494('0x2c')]][_0xa494('0x40')]=_0x5346e8[_0xa494('0x2e')];}this[_0xa494('0x11')][_0x5346e8[_0xa494('0x2c')]][_0xa494('0x65')]=_0x5346e8[_0xa494('0x2d')];this[_0xa494('0x11')][_0x5346e8['uniqueid']][_0xa494('0x60')]=_0x5346e8[_0xa494('0x37')];this[_0xa494('0x11')][_0x5346e8[_0xa494('0x2c')]][_0xa494('0x47')]=dispositions[_[_0xa494('0x48')](_0x5346e8[_0xa494('0x49')])];}}else{if(this[_0xa494('0x11')][_0x5346e8['uniqueid']]){if(_0x4ae68c){this[_0xa494('0x11')][_0x5346e8[_0xa494('0x2c')]][_0xa494('0x61')]=_0x4ae68c['id'];this[_0xa494('0x11')][_0x5346e8[_0xa494('0x2c')]][_0xa494('0x62')]=_0x4ae68c[_0xa494('0x3d')];}}}if(_0x5346e8[_0xa494('0x34')]===_0xa494('0x35')){if(_0x4ae68c){_0x4ae68c[_0xa494('0x3b')]=_0x5346e8['exten'];var _0x44f6f1;if(this[_0xa494('0x11')][_0x5346e8[_0xa494('0x2c')]]){_0x44f6f1=this['channels'][_0x5346e8[_0xa494('0x2c')]][_0xa494('0x8')];}else if(this[_0xa494('0x11')][_0x5346e8[_0xa494('0x30')]]){_0x44f6f1=this['channels'][_0x5346e8[_0xa494('0x30')]][_0xa494('0x8')];}_0x4ae68c['queue']=_0x44f6f1;var _0x36f5f3={'id':_0x4ae68c['id'],'name':_0x4ae68c['name'],'agentconnected':!![],'destaccountcode':_0x4ae68c[_0xa494('0x3f')],'destconnectedlinenum':_0x5346e8[_0xa494('0x39')],'queue':_0x44f6f1||undefined,'uniqueid':_0x5346e8['linkedid']};logger[_0xa494('0x42')](_0xa494('0x66'),_0x5346e8[_0xa494('0x2c')],util[_0xa494('0x27')](_0x36f5f3,{'showHidden':![],'depth':null}));this[_0xa494('0x2a')](util[_0xa494('0x3c')]('user:%s',_0x4ae68c['name']),_0xa494('0x3e'),_0x36f5f3);}}}}catch(_0x333e89){logger[_0xa494('0x25')]('[%s][voiceCallReport][newstate]',_0x5346e8[_0xa494('0x2c')],util[_0xa494('0x27')](_0x333e89,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xa494('0x28')][_0xa494('0x67')]=function(_0x30087f,_0x6e3999){try{if(this[_0xa494('0x11')][_0x30087f]){logger[_0xa494('0x22')](_0xa494('0x68'),_0x30087f,_0x6e3999);this[_0xa494('0x11')][_0x30087f][_0xa494('0x69')]=!![];if(_[_0xa494('0x6a')](_0x6e3999,'.wav49')){_0x6e3999=_0x6e3999[_0xa494('0x6b')](_0xa494('0x6c'),'.WAV');}this[_0xa494('0x11')][_0x30087f][_0xa494('0x6d')]=_0x6e3999;var _0x526c11=_[_0xa494('0x6e')](this[_0xa494('0x11')][_0x30087f][_0xa494('0x6f')],{'filename':_0x6e3999});if(_[_0xa494('0x5a')](_0x526c11)){this[_0xa494('0x11')][_0x30087f][_0xa494('0x6f')]['push']({'filename':_0x6e3999,'createdAt':moment()[_0xa494('0x3c')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':'','status':_0xa494('0x70')});}}}catch(_0x4a6616){logger[_0xa494('0x25')](_0xa494('0x71'),_0x30087f,util['inspect'](_0x4a6616,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xa494('0x28')][_0xa494('0x1a')]=function(_0x233cbf){try{if(this[_0xa494('0x29')](_0x233cbf)){logger[_0xa494('0x42')]('[%s][voiceCallReport][varset]\x20event:',_0x233cbf[_0xa494('0x2c')],util[_0xa494('0x27')](_0x233cbf,{'showHidden':![],'depth':null}));if(this[_0xa494('0x11')][_0x233cbf[_0xa494('0x2c')]]&&_0x233cbf[_0xa494('0x37')]!=_0xa494('0x44')){if(this[_0xa494('0x29')](_0x233cbf[_0xa494('0x72')])){if(this['isNotNull'](_0x233cbf[_0xa494('0x72')][_0xa494('0x73')])){logger[_0xa494('0x22')]('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0x233cbf[_0xa494('0x2c')],_0x233cbf[_0xa494('0x74')]);this['syncMixMonitorFilename'](_0x233cbf[_0xa494('0x2c')],_0x233cbf[_0xa494('0x74')]);}else if(this['isNotNull'](_0x233cbf[_0xa494('0x72')][_0xa494('0x75')])){logger['info'](_0xa494('0x76'),_0x233cbf['uniqueid'],_0x233cbf[_0xa494('0x74')]);this['channels'][_0x233cbf[_0xa494('0x2c')]][_0xa494('0x2e')]=_0x233cbf[_0xa494('0x74')];}else if(this['isNotNull'](_0x233cbf['variable']['xmd-callerid'])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s',_0x233cbf['uniqueid'],_0x233cbf[_0xa494('0x74')]);this[_0xa494('0x11')][_0x233cbf[_0xa494('0x2c')]][_0xa494('0x77')]=_0x233cbf[_0xa494('0x74')];}else if(this[_0xa494('0x29')](_0x233cbf[_0xa494('0x72')][_0xa494('0x78')])){logger[_0xa494('0x22')]('[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x233cbf[_0xa494('0x2c')],_0x233cbf['value']);this['channels'][_0x233cbf['uniqueid']][_0xa494('0x59')]=_0x233cbf['value'];}else if(this[_0xa494('0x29')](_0x233cbf['variable'][_0xa494('0x79')])){logger[_0xa494('0x22')](_0xa494('0x7a'),_0x233cbf[_0xa494('0x2c')],_0x233cbf['value'][_0xa494('0x38')](',')[0x0]);this[_0xa494('0x11')][_0x233cbf[_0xa494('0x2c')]]['queue']=_0x233cbf[_0xa494('0x74')][_0xa494('0x38')](',')[0x0];}else if(this['isNotNull'](_0x233cbf[_0xa494('0x72')][_0xa494('0x7b')])){logger['info'](_0xa494('0x7c'),_0x233cbf[_0xa494('0x2c')],_0x233cbf['value']);this[_0xa494('0x11')][_0x233cbf[_0xa494('0x2c')]][_0xa494('0x7d')]=_0x233cbf[_0xa494('0x74')];}else if(this['isNotNull'](_0x233cbf[_0xa494('0x72')][_0xa494('0x7e')])){logger['info'](_0xa494('0x7f'),_0x233cbf[_0xa494('0x2c')],_0x233cbf[_0xa494('0x74')]);this[_0xa494('0x11')][_0x233cbf[_0xa494('0x2c')]][_0xa494('0x80')]=_0x233cbf[_0xa494('0x74')];}else if(this['isNotNull'](_0x233cbf[_0xa494('0x72')][_0xa494('0x81')])){logger[_0xa494('0x22')](_0xa494('0x82'),_0x233cbf[_0xa494('0x2c')],_0x233cbf[_0xa494('0x74')]);this[_0xa494('0x11')][_0x233cbf[_0xa494('0x2c')]][_0xa494('0x83')]=_0x233cbf['value'];}else if(this['isNotNull'](_0x233cbf['variable']['xmcs-queue'])){logger[_0xa494('0x22')](_0xa494('0x84'),_0x233cbf['uniqueid'],_0x233cbf[_0xa494('0x74')]);this['channels'][_0x233cbf[_0xa494('0x2c')]]['queue']=_0x233cbf[_0xa494('0x74')];}else if(this[_0xa494('0x29')](_0x233cbf['variable'][_0xa494('0x85')])){logger[_0xa494('0x22')](_0xa494('0x86'),_0x233cbf[_0xa494('0x2c')],_0x233cbf['value']);this[_0xa494('0x11')][_0x233cbf[_0xa494('0x2c')]][_0xa494('0x87')]=_0x233cbf[_0xa494('0x74')];}}}else if(this[_0xa494('0x29')](_0x233cbf[_0xa494('0x72')]['mixmonitor_filename'])){if(_0x233cbf['value']){var _0x4bdb1d=path[_0xa494('0x88')](_0x233cbf[_0xa494('0x74')])[_0xa494('0x3d')];logger[_0xa494('0x22')]('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0x4bdb1d,_0x233cbf[_0xa494('0x74')]);this[_0xa494('0x67')](_0x4bdb1d,_0x233cbf['value']);}}else if(this[_0xa494('0x11')][_0x233cbf[_0xa494('0x30')]]){if(this['isNotNull'](_0x233cbf[_0xa494('0x72')])){if(this[_0xa494('0x29')](_0x233cbf[_0xa494('0x72')][_0xa494('0x85')])){logger[_0xa494('0x22')]('[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s',_0x233cbf[_0xa494('0x30')],_0x233cbf[_0xa494('0x74')]);this['channels'][_0x233cbf['linkedid']][_0xa494('0x89')]=_0x233cbf['value'];}}}}}catch(_0x213438){logger[_0xa494('0x25')](_0xa494('0x8a'),_0x233cbf[_0xa494('0x2c')],util[_0xa494('0x27')](_0x213438,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xa494('0x28')]['syncHangup']=function(_0x273de7){try{if(this[_0xa494('0x29')](_0x273de7)){logger[_0xa494('0x42')](_0xa494('0x8b'),_0x273de7[_0xa494('0x2c')],util['inspect'](_0x273de7,{'showHidden':![],'depth':null}));if(this[_0xa494('0x12')][_0x273de7[_0xa494('0x30')]]){if(this[_0xa494('0x11')][this[_0xa494('0x12')][_0x273de7['linkedid']][_0xa494('0x30')]]){this[_0xa494('0x11')][this['blindTransfers'][_0x273de7[_0xa494('0x30')]][_0xa494('0x30')]]['uniqueid']=_0x273de7['uniqueid'];this['channels'][this['blindTransfers'][_0x273de7['linkedid']][_0xa494('0x30')]]['answered']=this[_0xa494('0x11')][_0x273de7['uniqueid']][_0xa494('0x5d')];this[_0xa494('0x11')][this[_0xa494('0x12')][_0x273de7[_0xa494('0x30')]][_0xa494('0x30')]]['answertime']=this[_0xa494('0x11')][_0x273de7[_0xa494('0x2c')]][_0xa494('0x63')];this['channels'][this['blindTransfers'][_0x273de7['linkedid']][_0xa494('0x30')]]['destinationchannel']=this[_0xa494('0x11')][this['blindTransfers'][_0x273de7[_0xa494('0x30')]][_0xa494('0x30')]]['channel'];this[_0xa494('0x11')][this[_0xa494('0x12')][_0x273de7['linkedid']][_0xa494('0x30')]]['disposition']=this[_0xa494('0x11')][_0x273de7[_0xa494('0x2c')]][_0xa494('0x47')];this[_0xa494('0x11')][_0x273de7['uniqueid']]=this[_0xa494('0x11')][this['blindTransfers'][_0x273de7['linkedid']][_0xa494('0x30')]];this[_0xa494('0x8c')](this[_0xa494('0x12')][_0x273de7[_0xa494('0x30')]][_0xa494('0x30')]);}else if(this[_0xa494('0x11')][this[_0xa494('0x12')][_0x273de7[_0xa494('0x30')]][_0xa494('0x2c')]]){this['channels'][this['blindTransfers'][_0x273de7[_0xa494('0x30')]][_0xa494('0x2c')]][_0xa494('0x2c')]=[this[_0xa494('0x11')][this['blindTransfers'][_0x273de7[_0xa494('0x30')]][_0xa494('0x2c')]][_0xa494('0x30')],this[_0xa494('0x11')][this[_0xa494('0x12')][_0x273de7[_0xa494('0x30')]]['uniqueid']]['linkedid']=this[_0xa494('0x11')][this[_0xa494('0x12')][_0x273de7[_0xa494('0x30')]]['uniqueid']][_0xa494('0x2c')]][0x0];this[_0xa494('0x11')][this[_0xa494('0x12')][_0x273de7[_0xa494('0x30')]][_0xa494('0x2c')]][_0xa494('0x5d')]=this[_0xa494('0x11')][_0x273de7['uniqueid']][_0xa494('0x5d')];this['channels'][this[_0xa494('0x12')][_0x273de7[_0xa494('0x30')]][_0xa494('0x2c')]][_0xa494('0x63')]=this['channels'][_0x273de7[_0xa494('0x2c')]]['answertime'];this[_0xa494('0x11')][this[_0xa494('0x12')][_0x273de7[_0xa494('0x30')]][_0xa494('0x2c')]]['destinationchannel']=this['channels'][this[_0xa494('0x12')][_0x273de7[_0xa494('0x30')]][_0xa494('0x2c')]][_0xa494('0x37')];this[_0xa494('0x11')][this['blindTransfers'][_0x273de7[_0xa494('0x30')]][_0xa494('0x2c')]][_0xa494('0x47')]=this['channels'][_0x273de7[_0xa494('0x2c')]][_0xa494('0x47')];this[_0xa494('0x11')][_0x273de7[_0xa494('0x2c')]]=this[_0xa494('0x11')][this[_0xa494('0x12')][_0x273de7['linkedid']][_0xa494('0x2c')]];this['deleteChannelAfterTimeout'](this[_0xa494('0x12')][_0x273de7[_0xa494('0x30')]][_0xa494('0x2c')]);}}if(this['channels'][_0x273de7[_0xa494('0x2c')]]){logger['info'](_0xa494('0x8d'),_0x273de7[_0xa494('0x2c')],_0x273de7[_0xa494('0x8e')]);var _0x5e1fbb=moment();this[_0xa494('0x11')][_0x273de7[_0xa494('0x2c')]][_0xa494('0x8f')]=_0x5e1fbb[_0xa494('0x3c')](_0xa494('0x5e'));this[_0xa494('0x11')][_0x273de7[_0xa494('0x2c')]][_0xa494('0x54')]=_0x5e1fbb[_0xa494('0x64')](this[_0xa494('0x11')][_0x273de7[_0xa494('0x2c')]]['starttime'],_0xa494('0x55'));if(this[_0xa494('0x11')][_0x273de7[_0xa494('0x2c')]][_0xa494('0x5d')]){this[_0xa494('0x11')][_0x273de7[_0xa494('0x2c')]][_0xa494('0x90')]=_0x5e1fbb[_0xa494('0x64')](this[_0xa494('0x11')][_0x273de7['uniqueid']][_0xa494('0x63')],_0xa494('0x55'));this[_0xa494('0x11')][_0x273de7[_0xa494('0x2c')]][_0xa494('0x5f')]=this[_0xa494('0x11')][_0x273de7[_0xa494('0x2c')]]['duration']-this[_0xa494('0x11')][_0x273de7[_0xa494('0x2c')]][_0xa494('0x90')];}if(_0x273de7['context']==='from-sip'){if(this[_0xa494('0x36')][_0x273de7[_0xa494('0x37')][_0xa494('0x38')]('-')[0x0]]){this[_0xa494('0x36')][_0x273de7[_0xa494('0x37')]['split']('-')[0x0]]=_[_0xa494('0x91')](this[_0xa494('0x36')][_0x273de7[_0xa494('0x37')][_0xa494('0x38')]('-')[0x0]],[_0xa494('0x3b')]);logger['debug']('[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:',_0x273de7['uniqueid'],util[_0xa494('0x27')]({'id':this[_0xa494('0x36')][_0x273de7[_0xa494('0x37')][_0xa494('0x38')]('-')[0x0]]['id'],'destaccountcode':this[_0xa494('0x36')][_0x273de7[_0xa494('0x37')][_0xa494('0x38')]('-')[0x0]][_0xa494('0x3f')]},{'showHidden':![],'depth':null}));this[_0xa494('0x2a')](util['format'](_0xa494('0x4c'),this[_0xa494('0x36')][_0x273de7[_0xa494('0x37')][_0xa494('0x38')]('-')[0x0]][_0xa494('0x3d')]),_0xa494('0x92'),{'id':this['agents'][_0x273de7[_0xa494('0x37')][_0xa494('0x38')]('-')[0x0]]['id'],'destaccountcode':this[_0xa494('0x36')][_0x273de7['channel'][_0xa494('0x38')]('-')[0x0]][_0xa494('0x3f')]});for(var _0x6ceca1=0x0;_0x6ceca1{delete this['channels'][_0x18a41f];},_0x1a6498);}};module[_0xa494('0xc2')]=VoiceCallReport; \ No newline at end of file +var _0x932d=['transfertargetuniqueid','origtransfereruniqueid','ATTENDED','origtransfererlinkedid','[%s][voiceCallReport][attendedtransfer]','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','extension','BLIND','transfereruniqueid','syncMusicOnHoldStart','[%s][voiceCallReport][musiconholdstart]\x20event:','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstart]','[%s][voiceCallReport][musiconholdstop]\x20event:','mohstarttime','mohtime','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','[%s][voiceCallReport][musiconholdstop]','exports','moment','path','ioredis','../../../config/environment','../../../config/logger','ami','../ami','../rpc/setting','queue','dial','playback','NO\x20ANSWER','FAILED','ANSWERED','BUSY','redis','defaults','socket.io-emitter','channels','agents','blindTransfers','coreshowchannel','syncNewExten','newexten','newchannel','syncNewChannel','syncNewState','bind','varset','hangup','syncHangup','newcallerid','syncNewCallerId','attendedtransfer','syncAttendedTransfer','blindtransfer','musiconholdstop','syncMusicOnHoldStop','info','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','inspect','isNotNull','isUndefined','prototype','emit','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','calleridname','debug','[%s][voiceCallReport][newcallerid]\x20event:','uniqueid','linkedid','keys','context','from-sip','split','exten','xcally-motion-preview','destconnectedlinenum','connectedlinenum','format','name','user:agentconnect','accountcode','error','[%s][voiceCallReport][newcallerid]','[%s][voiceCallReport][newchannel]\x20event:','channel','OutgoingSpoolFailed','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','YYYY-MM-DD\x20HH:mm:ss','toNumber','channelstate','merge','pick','undefined','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','user:%s','[%s][voiceCallReport][newexten]\x20event:','application','toLowerCase','applicationdata','appdata','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','starttime','duration','seconds','lastapplication','set','startsWith','cdr(','match','type','isNil','[%s][voiceCallReport][newexten]','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','calleridnum','[%s][voiceCallReport][newstate]\x20event:','answered','holdtime','diff','connectedlinename','destinationchannel','disposition','membername','answertime','UserId','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','endsWith','.wav49','replace','find','monitors','push','rec','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','syncMixMonitorFilename','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','callerid','xmd-cdrtype','xmd-originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','originatecalleridnum','xmd-destination','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','destination','xmd-callerid-preview','calleridpreview','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','sipcallid','parse','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','[%s][voiceCallReport][hangup]\x20event:','deleteChannelAfterTimeout','cause-txt','endtime','billableseconds','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','length','user:agentcomplete','transferType','then','transferToInternal','getSettings','stopRecordingOnTransfer','resolve','Action','StopMixMonitor','catch','finally','webbar:stopmonitors','event','BlindTransfer','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','[%s][voiceCallReport][hangup]','origtransferercalleridnum','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','transferconnectedlinenum','secondtransfereruniqueid'];(function(_0x122ab9,_0x1d3fad){var _0x2620b0=function(_0x125c9d){while(--_0x125c9d){_0x122ab9['push'](_0x122ab9['shift']());}};_0x2620b0(++_0x1d3fad);}(_0x932d,0x195));var _0xd932=function(_0xcb8581,_0x446bd7){_0xcb8581=_0xcb8581-0x0;var _0x4eab07=_0x932d[_0xcb8581];return _0x4eab07;};'use strict';var _=require('lodash');var moment=require(_0xd932('0x0'));var util=require('util');var path=require(_0xd932('0x1'));var Redis=require(_0xd932('0x2'));var config=require(_0xd932('0x3'));var logger=require(_0xd932('0x4'))(_0xd932('0x5'));var ami=require(_0xd932('0x6'));var Channel=require('../model/channel');var RpcSetting=require(_0xd932('0x7'));var applications=['set',_0xd932('0x8'),'agi',_0xd932('0x9'),_0xd932('0xa'),'voicemail'];var dispositions=[_0xd932('0xb'),_0xd932('0xc'),_0xd932('0xc'),'NO\x20ANSWER',_0xd932('0xb'),_0xd932('0xb'),_0xd932('0xd'),_0xd932('0xe'),_0xd932('0xc'),_0xd932('0xc'),_0xd932('0xc')];config[_0xd932('0xf')]=_[_0xd932('0x10')](config[_0xd932('0xf')],{'host':'localhost','port':0x18eb});var io=require(_0xd932('0x11'))(new Redis(config[_0xd932('0xf')]));function VoiceCallReport(_0x5165a9){this[_0xd932('0x12')]=_0x5165a9[_0xd932('0x12')];this[_0xd932('0x13')]=_0x5165a9['agents'];this[_0xd932('0x14')]={};ami['on'](_0xd932('0x15'),this[_0xd932('0x16')]['bind'](this));ami['on'](_0xd932('0x17'),this['syncNewExten']['bind'](this));ami['on'](_0xd932('0x18'),this[_0xd932('0x19')]['bind'](this));ami['on']('newstate',this[_0xd932('0x1a')][_0xd932('0x1b')](this));ami['on'](_0xd932('0x1c'),this['syncVarSet'][_0xd932('0x1b')](this));ami['on'](_0xd932('0x1d'),this[_0xd932('0x1e')][_0xd932('0x1b')](this));ami['on'](_0xd932('0x1f'),this[_0xd932('0x20')]['bind'](this));ami['on'](_0xd932('0x21'),this[_0xd932('0x22')][_0xd932('0x1b')](this));ami['on'](_0xd932('0x23'),this['syncBlindTransfer'][_0xd932('0x1b')](this));ami['on']('musiconholdstart',this['syncMusicOnHoldStart'][_0xd932('0x1b')](this));ami['on'](_0xd932('0x24'),this[_0xd932('0x25')][_0xd932('0x1b')](this));try{logger[_0xd932('0x26')](_0xd932('0x27'));ami[_0xd932('0x28')]();}catch(_0x279c10){logger['error']('[voiceCallReport][coreshowchannels]',util[_0xd932('0x29')](_0x279c10,{'showHidden':![],'depth':null}));}}VoiceCallReport['prototype'][_0xd932('0x2a')]=function(_0x235374){return _0x235374!==null&&!_[_0xd932('0x2b')](_0x235374);};VoiceCallReport[_0xd932('0x2c')][_0xd932('0x2d')]=function(_0x20826d,_0x50fd55,_0x561619){io['to'](_0x20826d)[_0xd932('0x2d')](_0x50fd55,_0x561619);};VoiceCallReport['prototype'][_0xd932('0x20')]=function(_0x5df516){try{if(this[_0xd932('0x2a')](_0x5df516)){logger[_0xd932('0x26')](_0xd932('0x2e'),_0x5df516['uniqueid'],_0x5df516[_0xd932('0x2f')],_0x5df516['calleridnum']);logger[_0xd932('0x30')](_0xd932('0x31'),_0x5df516[_0xd932('0x32')],util[_0xd932('0x29')](_0x5df516,{'showHidden':![],'depth':null}));if(_0x5df516['uniqueid']===_0x5df516[_0xd932('0x33')]){if(!_[_0xd932('0x2b')](this[_0xd932('0x12')][_0x5df516['uniqueid']])){_['merge'](this[_0xd932('0x12')][_0x5df516['uniqueid']],_['pick'](_0x5df516,_[_0xd932('0x34')](this[_0xd932('0x12')][_0x5df516[_0xd932('0x32')]])));}}if(_0x5df516[_0xd932('0x35')]===_0xd932('0x36')){var _0x3997b4=this[_0xd932('0x13')][_0x5df516['channel'][_0xd932('0x37')]('-')[0x0]];if(_0x3997b4){if(_0x5df516[_0xd932('0x38')]==_0xd932('0x39')){_0x3997b4[_0xd932('0x3a')]=_0x5df516[_0xd932('0x3b')];this[_0xd932('0x2d')](util[_0xd932('0x3c')]('user:%s',_0x3997b4[_0xd932('0x3d')]),_0xd932('0x3e'),{'id':_0x3997b4['id'],'destaccountcode':_0x3997b4[_0xd932('0x3f')],'destconnectedlinenum':_0x5df516[_0xd932('0x3b')]});}}}}}catch(_0x4a53a5){logger[_0xd932('0x40')](_0xd932('0x41'),_0x5df516[_0xd932('0x32')],util[_0xd932('0x29')](_0x4a53a5,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xd932('0x2c')][_0xd932('0x19')]=function(_0x5b7348){try{if(this[_0xd932('0x2a')](_0x5b7348)){logger[_0xd932('0x30')](_0xd932('0x42'),_0x5b7348[_0xd932('0x32')],util[_0xd932('0x29')](_0x5b7348,{'showHidden':![],'depth':null}));if(this[_0xd932('0x12')][_0x5b7348['uniqueid']]){return;}if(_0x5b7348[_0xd932('0x43')]===_0xd932('0x44')){return;}if(_0x5b7348[_0xd932('0x32')]!==_0x5b7348[_0xd932('0x33')]&&!this[_0xd932('0x14')][_0x5b7348[_0xd932('0x33')]]){return;}logger[_0xd932('0x26')](_0xd932('0x45'),_0x5b7348[_0xd932('0x32')],_0x5b7348[_0xd932('0x35')],_0x5b7348[_0xd932('0x38')]);this[_0xd932('0x12')][_0x5b7348['uniqueid']]=new Channel();this['channels'][_0x5b7348[_0xd932('0x32')]]['starttime']=moment()[_0xd932('0x3c')](_0xd932('0x46'));this[_0xd932('0x12')][_0x5b7348['uniqueid']]['disposition']=dispositions[_[_0xd932('0x47')](_0x5b7348[_0xd932('0x48')])];_[_0xd932('0x49')](this[_0xd932('0x12')][_0x5b7348[_0xd932('0x32')]],_[_0xd932('0x4a')](_0x5b7348,_['keys'](this[_0xd932('0x12')][_0x5b7348[_0xd932('0x32')]])));if(_0x5b7348[_0xd932('0x35')]===_0xd932('0x36')){var _0x18181e=this[_0xd932('0x13')][_0x5b7348[_0xd932('0x43')]['split']('-')[0x0]];if(_0x18181e&&typeof _0x18181e[_0xd932('0x3a')]===_0xd932('0x4b')){_0x18181e['destconnectedlinenum']=_0x5b7348[_0xd932('0x38')];logger['debug'](_0xd932('0x4c'),_0x5b7348[_0xd932('0x32')],util['inspect']({'id':_0x18181e['id'],'destaccountcode':_0x18181e[_0xd932('0x3f')],'destconnectedlinenum':_0x5b7348['exten']},{'showHidden':![],'depth':null}));this[_0xd932('0x2d')](util['format'](_0xd932('0x4d'),_0x18181e[_0xd932('0x3d')]),_0xd932('0x3e'),{'id':_0x18181e['id'],'destaccountcode':_0x18181e[_0xd932('0x3f')],'destconnectedlinenum':_0x5b7348[_0xd932('0x38')]});}}}}catch(_0x223a50){logger['error']('[%s][voiceCallReport][newchannel]',_0x5b7348[_0xd932('0x32')],util[_0xd932('0x29')](_0x223a50,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xd932('0x16')]=function(_0xcde257){try{if(this['isNotNull'](_0xcde257)){logger[_0xd932('0x30')](_0xd932('0x4e'),_0xcde257[_0xd932('0x32')],util['inspect'](_0xcde257,{'showHidden':![],'depth':null}));if(_0xcde257['channel']==='OutgoingSpoolFailed'||_0xcde257[_0xd932('0x38')]==='h')return;if(_0xcde257[_0xd932('0x32')]===_0xcde257[_0xd932('0x33')]||this[_0xd932('0x14')][_0xcde257[_0xd932('0x33')]]){_0xcde257[_0xd932('0x4f')]=_0xcde257['application']?_0xcde257['application'][_0xd932('0x50')]():undefined;_0xcde257[_0xd932('0x51')]=_0xcde257[_0xd932('0x52')]||_0xcde257[_0xd932('0x51')];if(_0xcde257['appdata']&&_0xcde257[_0xd932('0x4f')]!==_0xd932('0x8')){_0xcde257['applicationdata']=_0xcde257[_0xd932('0x51')]['toLowerCase']();}logger['info'](_0xd932('0x53'),_0xcde257['uniqueid'],_0xcde257[_0xd932('0x4f')],_0xcde257[_0xd932('0x51')]);if(_[_0xd932('0x2b')](this[_0xd932('0x12')][_0xcde257[_0xd932('0x32')]])){this['channels'][_0xcde257['uniqueid']]=new Channel();this[_0xd932('0x12')][_0xcde257[_0xd932('0x32')]][_0xd932('0x54')]=_0xcde257[_0xd932('0x55')]?moment()['subtract'](moment['duration'](_0xcde257[_0xd932('0x55')])[_0xd932('0x56')](),'seconds')[_0xd932('0x3c')](_0xd932('0x46')):moment()[_0xd932('0x3c')](_0xd932('0x46'));this[_0xd932('0x12')][_0xcde257['uniqueid']]['disposition']=_0xd932('0xb');}_[_0xd932('0x49')](this[_0xd932('0x12')][_0xcde257['uniqueid']],_[_0xd932('0x4a')](_0xcde257,_[_0xd932('0x34')](this[_0xd932('0x12')][_0xcde257[_0xd932('0x32')]])));if(_['includes'](applications,_0xcde257[_0xd932('0x4f')])){this[_0xd932('0x12')][_0xcde257['uniqueid']][_0xd932('0x57')]=_0xcde257['application'];this[_0xd932('0x12')][_0xcde257[_0xd932('0x32')]]['lastdata']=_0xcde257[_0xd932('0x51')];if(_0xcde257[_0xd932('0x4f')]===_0xd932('0x58')&&_[_0xd932('0x59')](_0xcde257[_0xd932('0x51')]['toLowerCase'](),_0xd932('0x5a'))){var _0x35d008=_0xcde257[_0xd932('0x51')][_0xd932('0x37')]('=');var _0x265881=_0x35d008[0x0][_0xd932('0x50')]()[_0xd932('0x5b')](/cdr\((.*)\)/);if(_0x265881){if(_0x265881[0x1]===_0xd932('0x5c')&&!_[_0xd932('0x5d')](this['channels'][_0xcde257['uniqueid']][_0x265881[0x1]]))return;this['channels'][_0xcde257['uniqueid']][_0x265881[0x1]]=_0x35d008[0x1];}}else if(_0xcde257[_0xd932('0x4f')]===_0xd932('0x8')){this[_0xd932('0x12')][_0xcde257[_0xd932('0x32')]]['queue']=_0xcde257[_0xd932('0x51')]['split'](',')[0x0];}}}}}catch(_0x3506c0){logger[_0xd932('0x40')](_0xd932('0x5e'),_0xcde257[_0xd932('0x32')],util['inspect'](_0x3506c0,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xd932('0x2c')]['syncNewState']=function(_0x57fe58){try{if(this[_0xd932('0x2a')](_0x57fe58)){logger[_0xd932('0x26')](_0xd932('0x5f'),_0x57fe58['uniqueid'],_0x57fe58['linkedid'],_0x57fe58[_0xd932('0x2f')],_0x57fe58[_0xd932('0x60')]);logger[_0xd932('0x30')](_0xd932('0x61'),_0x57fe58[_0xd932('0x32')],util[_0xd932('0x29')](_0x57fe58,{'showHidden':![],'depth':null}));if(_0x57fe58['channelstate']!=='6')return;var _0xdb2b2a=this[_0xd932('0x13')][_0x57fe58[_0xd932('0x43')][_0xd932('0x37')]('-')[0x0]];if(_0x57fe58[_0xd932('0x32')]!==_0x57fe58[_0xd932('0x33')]){var _0x18dbea=moment();if(this['channels'][_0x57fe58[_0xd932('0x33')]]){if(!this[_0xd932('0x12')][_0x57fe58[_0xd932('0x33')]][_0xd932('0x62')]){this[_0xd932('0x12')][_0x57fe58[_0xd932('0x33')]][_0xd932('0x62')]=!![];this[_0xd932('0x12')][_0x57fe58[_0xd932('0x33')]]['answertime']=_0x18dbea[_0xd932('0x3c')](_0xd932('0x46'));if(this[_0xd932('0x12')][_0x57fe58[_0xd932('0x33')]][_0xd932('0x54')]){this[_0xd932('0x12')][_0x57fe58[_0xd932('0x33')]][_0xd932('0x63')]=_0x18dbea[_0xd932('0x64')](this[_0xd932('0x12')][_0x57fe58[_0xd932('0x33')]][_0xd932('0x54')],_0xd932('0x56'));}}this[_0xd932('0x12')][_0x57fe58['linkedid']][_0xd932('0x33')]=_0x57fe58['uniqueid'];if(_0x57fe58['calleridnum']!==_0xd932('0x39')){this[_0xd932('0x12')][_0x57fe58[_0xd932('0x33')]][_0xd932('0x3b')]=_0x57fe58[_0xd932('0x60')];}this[_0xd932('0x12')][_0x57fe58[_0xd932('0x33')]][_0xd932('0x65')]=_0x57fe58[_0xd932('0x2f')];this[_0xd932('0x12')][_0x57fe58['linkedid']][_0xd932('0x66')]=_0x57fe58['channel'];this[_0xd932('0x12')][_0x57fe58['linkedid']][_0xd932('0x67')]=dispositions[_[_0xd932('0x47')](_0x57fe58['channelstate'])];if(_0xdb2b2a){this[_0xd932('0x12')][_0x57fe58[_0xd932('0x33')]]['UserId']=_0xdb2b2a['id'];this['channels'][_0x57fe58[_0xd932('0x33')]][_0xd932('0x68')]=_0xdb2b2a[_0xd932('0x3d')];}}if(this['channels'][_0x57fe58['uniqueid']]){if(!this[_0xd932('0x12')][_0x57fe58['uniqueid']][_0xd932('0x62')]){this[_0xd932('0x12')][_0x57fe58[_0xd932('0x32')]][_0xd932('0x62')]=!![];this[_0xd932('0x12')][_0x57fe58[_0xd932('0x32')]][_0xd932('0x69')]=_0x18dbea[_0xd932('0x3c')](_0xd932('0x46'));if(this['channels'][_0x57fe58['uniqueid']]['starttime']){this[_0xd932('0x12')][_0x57fe58[_0xd932('0x32')]][_0xd932('0x63')]=_0x18dbea[_0xd932('0x64')](this[_0xd932('0x12')][_0x57fe58['uniqueid']][_0xd932('0x54')],_0xd932('0x56'));}}if(_0x57fe58[_0xd932('0x60')]!=='xcally-motion-preview'){this['channels'][_0x57fe58[_0xd932('0x32')]][_0xd932('0x3b')]=_0x57fe58['calleridnum'];}this[_0xd932('0x12')][_0x57fe58['uniqueid']][_0xd932('0x65')]=_0x57fe58[_0xd932('0x2f')];this[_0xd932('0x12')][_0x57fe58[_0xd932('0x32')]][_0xd932('0x66')]=_0x57fe58[_0xd932('0x43')];this[_0xd932('0x12')][_0x57fe58[_0xd932('0x32')]][_0xd932('0x67')]=dispositions[_['toNumber'](_0x57fe58['channelstate'])];}}else{if(this[_0xd932('0x12')][_0x57fe58[_0xd932('0x32')]]){if(_0xdb2b2a){this[_0xd932('0x12')][_0x57fe58[_0xd932('0x32')]][_0xd932('0x6a')]=_0xdb2b2a['id'];this[_0xd932('0x12')][_0x57fe58['uniqueid']]['membername']=_0xdb2b2a[_0xd932('0x3d')];}}}if(_0x57fe58[_0xd932('0x35')]===_0xd932('0x36')){if(_0xdb2b2a){_0xdb2b2a[_0xd932('0x3a')]=_0x57fe58[_0xd932('0x38')];var _0x42f7af;if(this['channels'][_0x57fe58[_0xd932('0x32')]]){_0x42f7af=this[_0xd932('0x12')][_0x57fe58[_0xd932('0x32')]][_0xd932('0x8')];}else if(this[_0xd932('0x12')][_0x57fe58['linkedid']]){_0x42f7af=this[_0xd932('0x12')][_0x57fe58[_0xd932('0x33')]][_0xd932('0x8')];}_0xdb2b2a[_0xd932('0x8')]=_0x42f7af;var _0x2bebb0={'id':_0xdb2b2a['id'],'name':_0xdb2b2a[_0xd932('0x3d')],'agentconnected':!![],'destaccountcode':_0xdb2b2a['accountcode'],'destconnectedlinenum':_0x57fe58[_0xd932('0x38')],'queue':_0x42f7af||undefined,'uniqueid':_0x57fe58['linkedid']};logger['debug']('[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:',_0x57fe58['uniqueid'],util['inspect'](_0x2bebb0,{'showHidden':![],'depth':null}));this[_0xd932('0x2d')](util['format'](_0xd932('0x4d'),_0xdb2b2a[_0xd932('0x3d')]),_0xd932('0x3e'),_0x2bebb0);}}}}catch(_0x165bc3){logger[_0xd932('0x40')]('[%s][voiceCallReport][newstate]',_0x57fe58['uniqueid'],util[_0xd932('0x29')](_0x165bc3,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xd932('0x2c')]['syncMixMonitorFilename']=function(_0x695fbc,_0x360675){try{if(this[_0xd932('0x12')][_0x695fbc]){logger['info'](_0xd932('0x6b'),_0x695fbc,_0x360675);this[_0xd932('0x12')][_0x695fbc][_0xd932('0x6c')]=!![];if(_[_0xd932('0x6d')](_0x360675,_0xd932('0x6e'))){_0x360675=_0x360675[_0xd932('0x6f')]('.wav49','.WAV');}this[_0xd932('0x12')][_0x695fbc]['monitorFilename']=_0x360675;var _0x215704=_[_0xd932('0x70')](this[_0xd932('0x12')][_0x695fbc][_0xd932('0x71')],{'filename':_0x360675});if(_[_0xd932('0x5d')](_0x215704)){this[_0xd932('0x12')][_0x695fbc]['monitors'][_0xd932('0x72')]({'filename':_0x360675,'createdAt':moment()[_0xd932('0x3c')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':'','status':_0xd932('0x73')});}}}catch(_0x353666){logger[_0xd932('0x40')]('[%s][voiceCallReport][mixMonitorFilename]',_0x695fbc,util[_0xd932('0x29')](_0x353666,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncVarSet']=function(_0x1c214d){try{if(this[_0xd932('0x2a')](_0x1c214d)){logger[_0xd932('0x30')](_0xd932('0x74'),_0x1c214d['uniqueid'],util[_0xd932('0x29')](_0x1c214d,{'showHidden':![],'depth':null}));if(this[_0xd932('0x12')][_0x1c214d[_0xd932('0x32')]]&&_0x1c214d[_0xd932('0x43')]!=_0xd932('0x44')){if(this[_0xd932('0x2a')](_0x1c214d[_0xd932('0x75')])){if(this['isNotNull'](_0x1c214d['variable'][_0xd932('0x76')])){logger[_0xd932('0x26')](_0xd932('0x77'),_0x1c214d[_0xd932('0x32')],_0x1c214d[_0xd932('0x78')]);this[_0xd932('0x79')](_0x1c214d[_0xd932('0x32')],_0x1c214d[_0xd932('0x78')]);}else if(this[_0xd932('0x2a')](_0x1c214d[_0xd932('0x75')][_0xd932('0x7a')])){logger['info'](_0xd932('0x7b'),_0x1c214d['uniqueid'],_0x1c214d[_0xd932('0x78')]);this[_0xd932('0x12')][_0x1c214d[_0xd932('0x32')]][_0xd932('0x60')]=_0x1c214d[_0xd932('0x78')];}else if(this['isNotNull'](_0x1c214d[_0xd932('0x75')][_0xd932('0x7c')])){logger[_0xd932('0x26')](_0xd932('0x7d'),_0x1c214d[_0xd932('0x32')],_0x1c214d[_0xd932('0x78')]);this[_0xd932('0x12')][_0x1c214d['uniqueid']][_0xd932('0x7e')]=_0x1c214d[_0xd932('0x78')];}else if(this['isNotNull'](_0x1c214d[_0xd932('0x75')][_0xd932('0x7f')])){logger[_0xd932('0x26')]('[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x1c214d[_0xd932('0x32')],_0x1c214d['value']);this[_0xd932('0x12')][_0x1c214d[_0xd932('0x32')]][_0xd932('0x5c')]=_0x1c214d[_0xd932('0x78')];}else if(this[_0xd932('0x2a')](_0x1c214d[_0xd932('0x75')]['xmd-queue'])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s',_0x1c214d[_0xd932('0x32')],_0x1c214d[_0xd932('0x78')]['split'](',')[0x0]);this['channels'][_0x1c214d[_0xd932('0x32')]][_0xd932('0x8')]=_0x1c214d['value'][_0xd932('0x37')](',')[0x0];}else if(this[_0xd932('0x2a')](_0x1c214d['variable'][_0xd932('0x80')])){logger[_0xd932('0x26')](_0xd932('0x81'),_0x1c214d[_0xd932('0x32')],_0x1c214d[_0xd932('0x78')]);this[_0xd932('0x12')][_0x1c214d[_0xd932('0x32')]][_0xd932('0x82')]=_0x1c214d[_0xd932('0x78')];}else if(this[_0xd932('0x2a')](_0x1c214d[_0xd932('0x75')][_0xd932('0x83')])){logger[_0xd932('0x26')](_0xd932('0x84'),_0x1c214d[_0xd932('0x32')],_0x1c214d[_0xd932('0x78')]);this['channels'][_0x1c214d['uniqueid']][_0xd932('0x85')]=_0x1c214d[_0xd932('0x78')];}else if(this[_0xd932('0x2a')](_0x1c214d[_0xd932('0x75')][_0xd932('0x86')])){logger[_0xd932('0x26')]('[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s',_0x1c214d[_0xd932('0x32')],_0x1c214d[_0xd932('0x78')]);this[_0xd932('0x12')][_0x1c214d[_0xd932('0x32')]][_0xd932('0x87')]=_0x1c214d[_0xd932('0x78')];}else if(this[_0xd932('0x2a')](_0x1c214d['variable']['xmcs-queue'])){logger[_0xd932('0x26')](_0xd932('0x88'),_0x1c214d[_0xd932('0x32')],_0x1c214d['value']);this[_0xd932('0x12')][_0x1c214d[_0xd932('0x32')]][_0xd932('0x8')]=_0x1c214d['value'];}else if(this[_0xd932('0x2a')](_0x1c214d['variable'][_0xd932('0x89')])){logger[_0xd932('0x26')]('[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s',_0x1c214d[_0xd932('0x32')],_0x1c214d[_0xd932('0x78')]);this[_0xd932('0x12')][_0x1c214d[_0xd932('0x32')]]['sipcalluniqueid']=_0x1c214d['value'];}}}else if(this[_0xd932('0x2a')](_0x1c214d[_0xd932('0x75')][_0xd932('0x76')])){if(_0x1c214d[_0xd932('0x78')]){var _0x31973b=path[_0xd932('0x8a')](_0x1c214d['value'])[_0xd932('0x3d')];logger[_0xd932('0x26')](_0xd932('0x77'),_0x31973b,_0x1c214d['value']);this['syncMixMonitorFilename'](_0x31973b,_0x1c214d[_0xd932('0x78')]);}}else if(this[_0xd932('0x12')][_0x1c214d[_0xd932('0x33')]]){if(this[_0xd932('0x2a')](_0x1c214d[_0xd932('0x75')])){if(this[_0xd932('0x2a')](_0x1c214d[_0xd932('0x75')][_0xd932('0x89')])){logger[_0xd932('0x26')](_0xd932('0x8b'),_0x1c214d[_0xd932('0x33')],_0x1c214d['value']);this[_0xd932('0x12')][_0x1c214d[_0xd932('0x33')]]['sipcalllinkedid']=_0x1c214d[_0xd932('0x78')];}}}}}catch(_0x57a26c){logger[_0xd932('0x40')]('[%s][voiceCallReport][varset]',_0x1c214d[_0xd932('0x32')],util[_0xd932('0x29')](_0x57a26c,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xd932('0x2c')][_0xd932('0x1e')]=function(_0x5a1a10){try{if(this['isNotNull'](_0x5a1a10)){logger['debug'](_0xd932('0x8c'),_0x5a1a10[_0xd932('0x32')],util[_0xd932('0x29')](_0x5a1a10,{'showHidden':![],'depth':null}));if(this[_0xd932('0x14')][_0x5a1a10[_0xd932('0x33')]]){if(this[_0xd932('0x12')][this[_0xd932('0x14')][_0x5a1a10['linkedid']][_0xd932('0x33')]]){this[_0xd932('0x12')][this[_0xd932('0x14')][_0x5a1a10[_0xd932('0x33')]][_0xd932('0x33')]][_0xd932('0x32')]=_0x5a1a10['uniqueid'];this[_0xd932('0x12')][this['blindTransfers'][_0x5a1a10[_0xd932('0x33')]][_0xd932('0x33')]][_0xd932('0x62')]=this[_0xd932('0x12')][_0x5a1a10[_0xd932('0x32')]]['answered'];this[_0xd932('0x12')][this[_0xd932('0x14')][_0x5a1a10[_0xd932('0x33')]][_0xd932('0x33')]][_0xd932('0x69')]=this[_0xd932('0x12')][_0x5a1a10[_0xd932('0x32')]]['answertime'];this[_0xd932('0x12')][this['blindTransfers'][_0x5a1a10[_0xd932('0x33')]][_0xd932('0x33')]][_0xd932('0x66')]=this[_0xd932('0x12')][this[_0xd932('0x14')][_0x5a1a10['linkedid']][_0xd932('0x33')]][_0xd932('0x43')];this[_0xd932('0x12')][this[_0xd932('0x14')][_0x5a1a10[_0xd932('0x33')]][_0xd932('0x33')]][_0xd932('0x67')]=this['channels'][_0x5a1a10['uniqueid']][_0xd932('0x67')];this[_0xd932('0x12')][_0x5a1a10['uniqueid']]=this[_0xd932('0x12')][this['blindTransfers'][_0x5a1a10['linkedid']][_0xd932('0x33')]];this[_0xd932('0x8d')](this[_0xd932('0x14')][_0x5a1a10[_0xd932('0x33')]]['linkedid']);}else if(this[_0xd932('0x12')][this['blindTransfers'][_0x5a1a10[_0xd932('0x33')]]['uniqueid']]){this[_0xd932('0x12')][this[_0xd932('0x14')][_0x5a1a10[_0xd932('0x33')]][_0xd932('0x32')]][_0xd932('0x32')]=[this[_0xd932('0x12')][this[_0xd932('0x14')][_0x5a1a10[_0xd932('0x33')]][_0xd932('0x32')]]['linkedid'],this[_0xd932('0x12')][this[_0xd932('0x14')][_0x5a1a10[_0xd932('0x33')]][_0xd932('0x32')]][_0xd932('0x33')]=this[_0xd932('0x12')][this[_0xd932('0x14')][_0x5a1a10['linkedid']][_0xd932('0x32')]][_0xd932('0x32')]][0x0];this['channels'][this[_0xd932('0x14')][_0x5a1a10[_0xd932('0x33')]][_0xd932('0x32')]]['answered']=this['channels'][_0x5a1a10[_0xd932('0x32')]][_0xd932('0x62')];this[_0xd932('0x12')][this['blindTransfers'][_0x5a1a10[_0xd932('0x33')]][_0xd932('0x32')]][_0xd932('0x69')]=this['channels'][_0x5a1a10[_0xd932('0x32')]][_0xd932('0x69')];this['channels'][this['blindTransfers'][_0x5a1a10[_0xd932('0x33')]][_0xd932('0x32')]][_0xd932('0x66')]=this[_0xd932('0x12')][this[_0xd932('0x14')][_0x5a1a10['linkedid']][_0xd932('0x32')]]['channel'];this[_0xd932('0x12')][this['blindTransfers'][_0x5a1a10['linkedid']]['uniqueid']][_0xd932('0x67')]=this[_0xd932('0x12')][_0x5a1a10[_0xd932('0x32')]]['disposition'];this[_0xd932('0x12')][_0x5a1a10[_0xd932('0x32')]]=this[_0xd932('0x12')][this[_0xd932('0x14')][_0x5a1a10[_0xd932('0x33')]]['uniqueid']];this[_0xd932('0x8d')](this[_0xd932('0x14')][_0x5a1a10[_0xd932('0x33')]][_0xd932('0x32')]);}}if(this[_0xd932('0x12')][_0x5a1a10[_0xd932('0x32')]]){logger[_0xd932('0x26')]('[%s][voiceCallReport][hangup]\x20reason:%s',_0x5a1a10[_0xd932('0x32')],_0x5a1a10[_0xd932('0x8e')]);var _0x3f986f=moment();this[_0xd932('0x12')][_0x5a1a10[_0xd932('0x32')]][_0xd932('0x8f')]=_0x3f986f[_0xd932('0x3c')](_0xd932('0x46'));this[_0xd932('0x12')][_0x5a1a10[_0xd932('0x32')]]['duration']=_0x3f986f[_0xd932('0x64')](this[_0xd932('0x12')][_0x5a1a10['uniqueid']]['starttime'],'seconds');if(this[_0xd932('0x12')][_0x5a1a10[_0xd932('0x32')]][_0xd932('0x62')]){this[_0xd932('0x12')][_0x5a1a10[_0xd932('0x32')]][_0xd932('0x90')]=_0x3f986f['diff'](this[_0xd932('0x12')][_0x5a1a10['uniqueid']]['answertime'],_0xd932('0x56'));this['channels'][_0x5a1a10['uniqueid']][_0xd932('0x63')]=this[_0xd932('0x12')][_0x5a1a10[_0xd932('0x32')]][_0xd932('0x55')]-this['channels'][_0x5a1a10['uniqueid']]['billableseconds'];}if(_0x5a1a10['context']===_0xd932('0x36')){if(this[_0xd932('0x13')][_0x5a1a10['channel'][_0xd932('0x37')]('-')[0x0]]){this['agents'][_0x5a1a10['channel'][_0xd932('0x37')]('-')[0x0]]=_['omit'](this[_0xd932('0x13')][_0x5a1a10[_0xd932('0x43')]['split']('-')[0x0]],[_0xd932('0x3a')]);logger[_0xd932('0x30')](_0xd932('0x91'),_0x5a1a10[_0xd932('0x32')],util['inspect']({'id':this[_0xd932('0x13')][_0x5a1a10[_0xd932('0x43')][_0xd932('0x37')]('-')[0x0]]['id'],'destaccountcode':this[_0xd932('0x13')][_0x5a1a10[_0xd932('0x43')][_0xd932('0x37')]('-')[0x0]][_0xd932('0x3f')]},{'showHidden':![],'depth':null}));this[_0xd932('0x2d')](util[_0xd932('0x3c')]('user:%s',this[_0xd932('0x13')][_0x5a1a10['channel']['split']('-')[0x0]][_0xd932('0x3d')]),'user:agentcomplete',{'id':this[_0xd932('0x13')][_0x5a1a10[_0xd932('0x43')]['split']('-')[0x0]]['id'],'destaccountcode':this[_0xd932('0x13')][_0x5a1a10[_0xd932('0x43')][_0xd932('0x37')]('-')[0x0]][_0xd932('0x3f')]});for(var _0xbf6969=0x0;_0xbf6969{delete this[_0xd932('0x12')][_0x14a3df];},_0x4a2947);}};module[_0xd932('0xbf')]=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index 25177d9..d5ada6b 100644 --- a/server/services/ami/report/voiceDialReport.js +++ b/server/services/ami/report/voiceDialReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x691a=['defaults','localhost','socket.io-emitter','outboundChannels','outbound','applications','dialbegin','syncDialBegin','bind','syncDialEnd','varset','syncHangup','isUndefined','prototype','emit','isNotNull','[%s][voiceDialReport][dialbegin]\x20event:','uniqueid','inspect','channels','merge','format','YYYY-MM-DD\x20HH:mm:ss','called','channel','lastIndexOf','substring','omit','info','membername','interface','debug','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','voice:outbound','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','custom:dialbegin','error','[%s][voiceDialReport][dialbegin]','[%s][voiceDialReport][dialend]\x20event:','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','lastevent','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','custom:dialconnect','[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:','voice_outbound_channel:save','syncVarSet','[%s][voiceDialReport][varset]\x20event:','keys','variable','value','outboundrouteid','variables','voice','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','isNil','includes','[%s][voiceDialReport][hangup]\x20event:','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','cause-txt','endtime','duration','diff','seconds','complete','answered','starttime','billableseconds','sumHoldTime','holdtime','sumBillable','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','custom:voiceDialReport','[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:','voice_outbound:save','stringify','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','deleteChannelAfterTimeout','linkedid','destuniqueid','syncNewExten','[%s][voiceDialReport][newexten]\x20event:','application','toLowerCase','appdata','applicationdata','cdr(','[%s][voiceDialReport][newexten]\x20application:%s\x20appdata:%s','split','match','[%s][voiceDialReport][newexten]','exports','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis'];(function(_0x3c8e9a,_0x384306){var _0x2d4c57=function(_0x43d408){while(--_0x43d408){_0x3c8e9a['push'](_0x3c8e9a['shift']());}};_0x2d4c57(++_0x384306);}(_0x691a,0x1df));var _0xa691=function(_0xb4cc1d,_0x276e3c){_0xb4cc1d=_0xb4cc1d-0x0;var _0xc51935=_0x691a[_0xb4cc1d];return _0xc51935;};'use strict';var _=require(_0xa691('0x0'));var moment=require(_0xa691('0x1'));var util=require(_0xa691('0x2'));var Redis=require(_0xa691('0x3'));var config=require(_0xa691('0x4'));var logger=require(_0xa691('0x5'))(_0xa691('0x6'));var ami=require(_0xa691('0x7'));config[_0xa691('0x8')]=_[_0xa691('0x9')](config['redis'],{'host':_0xa691('0xa'),'port':0x18eb});var io=require(_0xa691('0xb'))(new Redis(config['redis']));function VoiceDialReport(_0x173d1d){this['channels']=_0x173d1d[_0xa691('0xc')];this[_0xa691('0xd')]=_0x173d1d[_0xa691('0xd')];this[_0xa691('0xe')]={};this['variables']={};ami['on'](_0xa691('0xf'),this[_0xa691('0x10')][_0xa691('0x11')](this));ami['on']('dialend',this[_0xa691('0x12')][_0xa691('0x11')](this));ami['on'](_0xa691('0x13'),this['syncVarSet'][_0xa691('0x11')](this));ami['on']('hangup',this[_0xa691('0x14')]['bind'](this));}VoiceDialReport['prototype']['isNotNull']=function(_0x2d66c9){return _0x2d66c9!==null&&!_[_0xa691('0x15')](_0x2d66c9);};VoiceDialReport[_0xa691('0x16')][_0xa691('0x17')]=function(_0x4b8ce0,_0x2c2ac9,_0x3ceecb){io['to'](_0x4b8ce0)[_0xa691('0x17')](_0x2c2ac9,_0x3ceecb);};VoiceDialReport[_0xa691('0x16')]['syncDialBegin']=function(_0x4064ea){try{if(this[_0xa691('0x18')](_0x4064ea)){logger['debug'](_0xa691('0x19'),_0x4064ea[_0xa691('0x1a')],util[_0xa691('0x1b')](_0x4064ea,{'showHidden':![],'depth':null}));if(this[_0xa691('0x1c')][_0x4064ea[_0xa691('0x1a')]]){_[_0xa691('0x1d')](this[_0xa691('0x1c')][_0x4064ea[_0xa691('0x1a')]],{'starttime':moment()[_0xa691('0x1e')](_0xa691('0x1f')),'lastevent':_0xa691('0x20'),'interface':_0x4064ea['channel']['substring'](0x0,_0x4064ea[_0xa691('0x21')][_0xa691('0x22')]('-')),'membername':_0x4064ea[_0xa691('0x21')][_0xa691('0x23')](_0x4064ea[_0xa691('0x21')][_0xa691('0x22')]('/')+0x1,_0x4064ea['channel'][_0xa691('0x22')]('-'))},_[_0xa691('0x24')](_0x4064ea,['event','privilege']));logger[_0xa691('0x25')]('[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called',_0x4064ea[_0xa691('0x1a')],this[_0xa691('0x1c')][_0x4064ea[_0xa691('0x1a')]][_0xa691('0x26')],this[_0xa691('0x1c')][_0x4064ea[_0xa691('0x1a')]][_0xa691('0x27')]);logger[_0xa691('0x28')](_0xa691('0x29'),_0x4064ea[_0xa691('0x1a')],util[_0xa691('0x1b')](this[_0xa691('0x1c')][_0x4064ea[_0xa691('0x1a')]],{'showHidden':![],'depth':null}));if(this['applications'][_0x4064ea[_0xa691('0x1a')]])_[_0xa691('0x1d')](this[_0xa691('0x1c')][_0x4064ea['uniqueid']],this[_0xa691('0xe')][_0x4064ea[_0xa691('0x1a')]]);this[_0xa691('0x17')](_0xa691('0x2a'),'voice_outbound_channel:save',this[_0xa691('0x1c')][_0x4064ea[_0xa691('0x1a')]]);logger[_0xa691('0x28')](_0xa691('0x2b'),_0x4064ea[_0xa691('0x1a')],util[_0xa691('0x1b')](this[_0xa691('0x1c')][_0x4064ea[_0xa691('0x1a')]],{'showHidden':![],'depth':null}));ami['emit'](_0xa691('0x2c'),this[_0xa691('0x1c')][_0x4064ea[_0xa691('0x1a')]]);}}}catch(_0x235381){logger[_0xa691('0x2d')](_0xa691('0x2e'),_0x4064ea[_0xa691('0x1a')],util[_0xa691('0x1b')](_0x235381,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0xa691('0x12')]=function(_0x45489c){try{if(this[_0xa691('0x18')](_0x45489c)){logger[_0xa691('0x28')](_0xa691('0x2f'),_0x45489c[_0xa691('0x1a')],util['inspect'](_0x45489c,{'showHidden':![],'depth':null}));if(this[_0xa691('0x1c')][_0x45489c[_0xa691('0x1a')]]){this[_0xa691('0x1c')][_0x45489c[_0xa691('0x1a')]][_0xa691('0x30')]=_0x45489c['dialstatus'];if(_0x45489c[_0xa691('0x30')]===_0xa691('0x31')){this[_0xa691('0x1c')][_0x45489c[_0xa691('0x1a')]]['connectedlinenum']=_0x45489c[_0xa691('0x32')];this[_0xa691('0x1c')][_0x45489c[_0xa691('0x1a')]][_0xa691('0x33')]=_0x45489c[_0xa691('0x33')];this['channels'][_0x45489c[_0xa691('0x1a')]][_0xa691('0x34')]=moment()[_0xa691('0x1e')](_0xa691('0x1f'));this[_0xa691('0x1c')][_0x45489c[_0xa691('0x1a')]][_0xa691('0x35')]='connect';logger['info']('[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect',_0x45489c[_0xa691('0x1a')],_0x45489c['channel'][_0xa691('0x23')](_0x45489c[_0xa691('0x21')]['lastIndexOf']('/')+0x1,_0x45489c['channel'][_0xa691('0x22')]('-')));logger[_0xa691('0x28')](_0xa691('0x36'),_0x45489c[_0xa691('0x1a')],util['inspect'](this[_0xa691('0x1c')][_0x45489c[_0xa691('0x1a')]],{'showHidden':![],'depth':null}));ami[_0xa691('0x17')](_0xa691('0x37'),this['channels'][_0x45489c[_0xa691('0x1a')]]);}logger[_0xa691('0x28')](_0xa691('0x38'),_0x45489c['uniqueid'],util[_0xa691('0x1b')](this[_0xa691('0x1c')][_0x45489c['uniqueid']],{'showHidden':![],'depth':null}));this[_0xa691('0x17')]('voice:outbound',_0xa691('0x39'),this[_0xa691('0x1c')][_0x45489c[_0xa691('0x1a')]]);}}}catch(_0x525801){logger[_0xa691('0x2d')]('[%s][voiceDialReport][dialend]',_0x45489c[_0xa691('0x1a')],util[_0xa691('0x1b')](_0x525801,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xa691('0x16')][_0xa691('0x3a')]=function(_0x295f9b){try{if(this[_0xa691('0x18')](_0x295f9b)){logger[_0xa691('0x28')](_0xa691('0x3b'),_0x295f9b[_0xa691('0x1a')],util[_0xa691('0x1b')](_0x295f9b,{'showHidden':![],'depth':null}));this['addVariable'](_0x295f9b[_0xa691('0x1a')],_[_0xa691('0x3c')](_0x295f9b[_0xa691('0x3d')])[0x0],_0x295f9b[_0xa691('0x3e')]);if(this['isNotNull'](_0x295f9b[_0xa691('0x3d')])&&this[_0xa691('0x18')](_0x295f9b[_0xa691('0x3d')][_0xa691('0x3f')])){if(_[_0xa691('0x15')](this[_0xa691('0x1c')][_0x295f9b[_0xa691('0x1a')]])){this[_0xa691('0x1c')][_0x295f9b[_0xa691('0x1a')]]={'routeId':_0x295f9b[_0xa691('0x3e')],'variables':this[_0xa691('0x40')][_0x295f9b[_0xa691('0x1a')]],'motionChannel':_0xa691('0x41')};logger[_0xa691('0x25')](_0xa691('0x42'),_0x295f9b[_0xa691('0x1a')],_0x295f9b[_0xa691('0x3d')][_0xa691('0x3f')],_[_0xa691('0x3c')](_0x295f9b[_0xa691('0x3d')])[0x0],_0x295f9b[_0xa691('0x3e')]);logger[_0xa691('0x28')](_0xa691('0x43'),_0x295f9b[_0xa691('0x1a')],util[_0xa691('0x1b')](this[_0xa691('0x1c')][_0x295f9b[_0xa691('0x1a')]],{'showHidden':![],'depth':null}));this[_0xa691('0x17')]('voice:outbound',_0xa691('0x39'),this[_0xa691('0x1c')][_0x295f9b['uniqueid']]);}}}}catch(_0x18cfe0){logger[_0xa691('0x2d')](_0xa691('0x44'),_0x295f9b[_0xa691('0x1a')],util['inspect'](_0x18cfe0,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xa691('0x16')]['addVariable']=function(_0x4ea2c7,_0x32565b,_0xef03b2){var _0x475207=[_0xa691('0x45'),_0xa691('0x46'),_0xa691('0x47'),_0xa691('0x48'),_0xa691('0x49'),_0xa691('0x4a'),_0xa691('0x4b'),_0xa691('0x4c'),_0xa691('0x4d'),_0xa691('0x4e'),_0xa691('0x4f'),_0xa691('0x50'),_0xa691('0x51'),_0xa691('0x52'),_0xa691('0x53'),_0xa691('0x54'),_0xa691('0x26'),'memberpenalty','memberrealtime'];if(!_[_0xa691('0x55')](_0x32565b)&&!_[_0xa691('0x56')](_0x475207,_0x32565b)){if(_[_0xa691('0x15')](this[_0xa691('0x40')][_0x4ea2c7])){this[_0xa691('0x40')][_0x4ea2c7]={};}this['variables'][_0x4ea2c7][_0x32565b]=_0xef03b2;}};VoiceDialReport[_0xa691('0x16')]['syncHangup']=function(_0x1e0abe){try{if(this[_0xa691('0x18')](_0x1e0abe)){logger[_0xa691('0x28')](_0xa691('0x57'),_0x1e0abe[_0xa691('0x1a')],util[_0xa691('0x1b')](_0x1e0abe,{'showHidden':![],'depth':null}));if(this[_0xa691('0x1c')][_0x1e0abe['uniqueid']]){logger[_0xa691('0x25')](_0xa691('0x58'),_0x1e0abe[_0xa691('0x1a')],_0x1e0abe[_0xa691('0x59')]);this['channels'][_0x1e0abe['uniqueid']][_0xa691('0x5a')]=moment()[_0xa691('0x1e')](_0xa691('0x1f'));this['channels'][_0x1e0abe[_0xa691('0x1a')]][_0xa691('0x5b')]=moment(this['channels'][_0x1e0abe[_0xa691('0x1a')]][_0xa691('0x5a')])[_0xa691('0x5c')](this[_0xa691('0x1c')][_0x1e0abe[_0xa691('0x1a')]]['starttime'],_0xa691('0x5d'));this[_0xa691('0x1c')][_0x1e0abe[_0xa691('0x1a')]][_0xa691('0x35')]=_0xa691('0x5e');this['outbound']['total']+=0x1;if(this[_0xa691('0x1c')][_0x1e0abe[_0xa691('0x1a')]][_0xa691('0x34')]){this[_0xa691('0xd')][_0xa691('0x5f')]+=0x1;this[_0xa691('0x1c')][_0x1e0abe[_0xa691('0x1a')]]['holdtime']=moment(this[_0xa691('0x1c')][_0x1e0abe[_0xa691('0x1a')]][_0xa691('0x34')])[_0xa691('0x5c')](this[_0xa691('0x1c')][_0x1e0abe[_0xa691('0x1a')]][_0xa691('0x60')],_0xa691('0x5d'));this[_0xa691('0x1c')][_0x1e0abe[_0xa691('0x1a')]][_0xa691('0x61')]=moment(this[_0xa691('0x1c')][_0x1e0abe[_0xa691('0x1a')]][_0xa691('0x5a')])[_0xa691('0x5c')](this[_0xa691('0x1c')][_0x1e0abe[_0xa691('0x1a')]][_0xa691('0x34')],'seconds');this[_0xa691('0xd')][_0xa691('0x62')]+=this[_0xa691('0x1c')][_0x1e0abe[_0xa691('0x1a')]][_0xa691('0x63')]||0x0;this[_0xa691('0xd')][_0xa691('0x64')]+=this[_0xa691('0x1c')][_0x1e0abe[_0xa691('0x1a')]][_0xa691('0x61')];}this[_0xa691('0xd')]['sumDuration']+=this[_0xa691('0x1c')][_0x1e0abe[_0xa691('0x1a')]][_0xa691('0x5b')];logger[_0xa691('0x28')](_0xa691('0x65'),_0x1e0abe[_0xa691('0x1a')],util[_0xa691('0x1b')](this[_0xa691('0x1c')][_0x1e0abe[_0xa691('0x1a')]],{'showHidden':![],'depth':null}));ami[_0xa691('0x17')](_0xa691('0x66'),this[_0xa691('0x1c')][_0x1e0abe[_0xa691('0x1a')]]);logger[_0xa691('0x28')](_0xa691('0x67'),_0x1e0abe[_0xa691('0x1a')],util[_0xa691('0x1b')](this[_0xa691('0x1c')][_0x1e0abe['uniqueid']],{'showHidden':![],'depth':null}));ami[_0xa691('0x17')]('custom:dialend',this[_0xa691('0x1c')][_0x1e0abe['uniqueid']]);logger[_0xa691('0x28')]('[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:',_0x1e0abe['uniqueid'],util['inspect'](this[_0xa691('0x1c')][_0x1e0abe[_0xa691('0x1a')]],{'showHidden':![],'depth':null}));this[_0xa691('0x17')](_0xa691('0x2a'),_0xa691('0x68'),this[_0xa691('0xd')]);logger['info']('[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event',JSON[_0xa691('0x69')](this[_0xa691('0x1c')][_0x1e0abe['uniqueid']]));logger[_0xa691('0x28')](_0xa691('0x6a'),_0x1e0abe[_0xa691('0x1a')],util[_0xa691('0x1b')](this[_0xa691('0x1c')][_0x1e0abe[_0xa691('0x1a')]],{'showHidden':![],'depth':null}));this[_0xa691('0x17')](_0xa691('0x2a'),'voice_outbound_channel:remove',this[_0xa691('0x1c')][_0x1e0abe[_0xa691('0x1a')]]);this[_0xa691('0x6b')](_0x1e0abe['uniqueid']);}else if(this[_0xa691('0x1c')][_0x1e0abe[_0xa691('0x6c')]]){this[_0xa691('0x1c')][_0x1e0abe[_0xa691('0x6c')]][_0xa691('0x1a')]=this[_0xa691('0x1c')][_0x1e0abe[_0xa691('0x6c')]][_0xa691('0x6d')];}if(this[_0xa691('0x40')][_0x1e0abe[_0xa691('0x1a')]]){delete this[_0xa691('0x40')][_0x1e0abe['uniqueid']];}}}catch(_0x9fa426){logger[_0xa691('0x2d')]('[%s][voiceDialReport][hangup]',_0x1e0abe[_0xa691('0x1a')],util[_0xa691('0x1b')](_0x9fa426,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xa691('0x16')][_0xa691('0x6e')]=function(_0xddf86){try{if(this[_0xa691('0x18')](_0xddf86)){logger[_0xa691('0x28')](_0xa691('0x6f'),_0xddf86['uniqueid'],util['inspect'](_0xddf86,{'showHidden':![],'depth':null}));if(_0xddf86[_0xa691('0x70')][_0xa691('0x71')]()==='set'){_0xddf86['applicationdata']=(_0xddf86[_0xa691('0x72')]||_0xddf86[_0xa691('0x73')])[_0xa691('0x71')]();if(_['startsWith'](_0xddf86['applicationdata'],_0xa691('0x74'))){if(_['isUndefined'](this[_0xa691('0xe')][_0xddf86[_0xa691('0x1a')]]))this[_0xa691('0xe')][_0xddf86[_0xa691('0x1a')]]={};logger[_0xa691('0x25')](_0xa691('0x75'),_0xddf86['uniqueid'],_0xddf86[_0xa691('0x70')],_0xddf86[_0xa691('0x73')]);var _0x53558d=_0xddf86[_0xa691('0x73')][_0xa691('0x76')]('=');var _0x1c1c57=_0x53558d[0x0][_0xa691('0x77')](/cdr\((.*)\)/);if(_0x1c1c57)this[_0xa691('0xe')][_0xddf86[_0xa691('0x1a')]][_0x1c1c57[0x1]]=_0x53558d[0x1];}}}}catch(_0x137716){logger['error'](_0xa691('0x78'),_0xddf86[_0xa691('0x1a')],util[_0xa691('0x1b')](_0x137716,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xa691('0x16')][_0xa691('0x6b')]=function(_0x4b08a0,_0x1da038=0x2710){if(this[_0xa691('0x1c')][_0x4b08a0]){setTimeout(()=>{delete this[_0xa691('0x1c')][_0x4b08a0];},_0x1da038);}};module[_0xa691('0x79')]=VoiceDialReport; \ No newline at end of file +var _0xc95e=['prototype','isNotNull','emit','syncDialBegin','[%s][voiceDialReport][dialbegin]\x20event:','inspect','uniqueid','merge','YYYY-MM-DD\x20HH:mm:ss','called','channel','substring','lastIndexOf','omit','event','privilege','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','membername','interface','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','debug','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','custom:dialbegin','error','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','lastevent','connect','custom:dialconnect','[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:','voice:outbound','voice_outbound_channel:save','addVariable','keys','variable','value','outboundrouteid','isUndefined','voice','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][varset]','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberinterface','memberlastcall','memberpenalty','memberrealtime','isNil','variables','[%s][voiceDialReport][hangup]\x20event:','info','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','cause-txt','endtime','diff','starttime','complete','total','answered','seconds','billableseconds','sumHoldTime','holdtime','sumBillable','sumDuration','duration','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','custom:voiceDialReport','custom:dialend','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:','voice_outbound:save','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','voice_outbound_channel:remove','deleteChannelAfterTimeout','linkedid','[%s][voiceDialReport][hangup]','syncNewExten','application','applicationdata','toLowerCase','startsWith','cdr(','[%s][voiceDialReport][newexten]\x20application:%s\x20appdata:%s','split','match','[%s][voiceDialReport][newexten]','lodash','moment','ioredis','../../../config/environment','redis','socket.io-emitter','channels','outbound','applications','dialbegin','bind','dialend','syncDialEnd','syncVarSet','syncHangup'];(function(_0x10de99,_0xdd42d){var _0x8550e5=function(_0x3c1aae){while(--_0x3c1aae){_0x10de99['push'](_0x10de99['shift']());}};_0x8550e5(++_0xdd42d);}(_0xc95e,0x14d));var _0xec95=function(_0x57d815,_0x125da6){_0x57d815=_0x57d815-0x0;var _0x36f969=_0xc95e[_0x57d815];return _0x36f969;};'use strict';var _=require(_0xec95('0x0'));var moment=require(_0xec95('0x1'));var util=require('util');var Redis=require(_0xec95('0x2'));var config=require(_0xec95('0x3'));var logger=require('../../../config/logger')('ami');var ami=require('../ami');config[_0xec95('0x4')]=_['defaults'](config[_0xec95('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0xec95('0x5'))(new Redis(config[_0xec95('0x4')]));function VoiceDialReport(_0x164243){this[_0xec95('0x6')]=_0x164243['outboundChannels'];this[_0xec95('0x7')]=_0x164243[_0xec95('0x7')];this[_0xec95('0x8')]={};this['variables']={};ami['on'](_0xec95('0x9'),this['syncDialBegin'][_0xec95('0xa')](this));ami['on'](_0xec95('0xb'),this[_0xec95('0xc')][_0xec95('0xa')](this));ami['on']('varset',this[_0xec95('0xd')][_0xec95('0xa')](this));ami['on']('hangup',this[_0xec95('0xe')][_0xec95('0xa')](this));}VoiceDialReport[_0xec95('0xf')][_0xec95('0x10')]=function(_0x121c5b){return _0x121c5b!==null&&!_['isUndefined'](_0x121c5b);};VoiceDialReport[_0xec95('0xf')][_0xec95('0x11')]=function(_0x2b80fe,_0x1d5b6c,_0x3df470){io['to'](_0x2b80fe)[_0xec95('0x11')](_0x1d5b6c,_0x3df470);};VoiceDialReport['prototype'][_0xec95('0x12')]=function(_0x26b4fa){try{if(this['isNotNull'](_0x26b4fa)){logger['debug'](_0xec95('0x13'),_0x26b4fa['uniqueid'],util[_0xec95('0x14')](_0x26b4fa,{'showHidden':![],'depth':null}));if(this[_0xec95('0x6')][_0x26b4fa[_0xec95('0x15')]]){_[_0xec95('0x16')](this[_0xec95('0x6')][_0x26b4fa['uniqueid']],{'starttime':moment()['format'](_0xec95('0x17')),'lastevent':_0xec95('0x18'),'interface':_0x26b4fa[_0xec95('0x19')][_0xec95('0x1a')](0x0,_0x26b4fa['channel']['lastIndexOf']('-')),'membername':_0x26b4fa[_0xec95('0x19')][_0xec95('0x1a')](_0x26b4fa['channel']['lastIndexOf']('/')+0x1,_0x26b4fa[_0xec95('0x19')][_0xec95('0x1b')]('-'))},_[_0xec95('0x1c')](_0x26b4fa,[_0xec95('0x1d'),_0xec95('0x1e')]));logger['info'](_0xec95('0x1f'),_0x26b4fa[_0xec95('0x15')],this[_0xec95('0x6')][_0x26b4fa['uniqueid']][_0xec95('0x20')],this[_0xec95('0x6')][_0x26b4fa[_0xec95('0x15')]][_0xec95('0x21')]);logger['debug'](_0xec95('0x22'),_0x26b4fa['uniqueid'],util[_0xec95('0x14')](this[_0xec95('0x6')][_0x26b4fa[_0xec95('0x15')]],{'showHidden':![],'depth':null}));if(this[_0xec95('0x8')][_0x26b4fa[_0xec95('0x15')]])_[_0xec95('0x16')](this[_0xec95('0x6')][_0x26b4fa[_0xec95('0x15')]],this[_0xec95('0x8')][_0x26b4fa[_0xec95('0x15')]]);this[_0xec95('0x11')]('voice:outbound','voice_outbound_channel:save',this[_0xec95('0x6')][_0x26b4fa[_0xec95('0x15')]]);logger[_0xec95('0x23')](_0xec95('0x24'),_0x26b4fa[_0xec95('0x15')],util['inspect'](this[_0xec95('0x6')][_0x26b4fa[_0xec95('0x15')]],{'showHidden':![],'depth':null}));ami[_0xec95('0x11')](_0xec95('0x25'),this[_0xec95('0x6')][_0x26b4fa[_0xec95('0x15')]]);}}}catch(_0x57670d){logger[_0xec95('0x26')]('[%s][voiceDialReport][dialbegin]',_0x26b4fa[_0xec95('0x15')],util['inspect'](_0x57670d,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xec95('0xf')]['syncDialEnd']=function(_0x3fdaca){try{if(this['isNotNull'](_0x3fdaca)){logger[_0xec95('0x23')]('[%s][voiceDialReport][dialend]\x20event:',_0x3fdaca[_0xec95('0x15')],util[_0xec95('0x14')](_0x3fdaca,{'showHidden':![],'depth':null}));if(this['channels'][_0x3fdaca[_0xec95('0x15')]]){this[_0xec95('0x6')][_0x3fdaca[_0xec95('0x15')]][_0xec95('0x27')]=_0x3fdaca[_0xec95('0x27')];if(_0x3fdaca[_0xec95('0x27')]===_0xec95('0x28')){this[_0xec95('0x6')][_0x3fdaca['uniqueid']][_0xec95('0x29')]=_0x3fdaca[_0xec95('0x29')];this['channels'][_0x3fdaca[_0xec95('0x15')]][_0xec95('0x2a')]=_0x3fdaca['connectedlinename'];this[_0xec95('0x6')][_0x3fdaca[_0xec95('0x15')]][_0xec95('0x2b')]=moment()['format'](_0xec95('0x17'));this[_0xec95('0x6')][_0x3fdaca[_0xec95('0x15')]][_0xec95('0x2c')]=_0xec95('0x2d');logger['info']('[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect',_0x3fdaca[_0xec95('0x15')],_0x3fdaca[_0xec95('0x19')][_0xec95('0x1a')](_0x3fdaca[_0xec95('0x19')][_0xec95('0x1b')]('/')+0x1,_0x3fdaca[_0xec95('0x19')][_0xec95('0x1b')]('-')));logger[_0xec95('0x23')]('[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:',_0x3fdaca[_0xec95('0x15')],util[_0xec95('0x14')](this[_0xec95('0x6')][_0x3fdaca[_0xec95('0x15')]],{'showHidden':![],'depth':null}));ami[_0xec95('0x11')](_0xec95('0x2e'),this[_0xec95('0x6')][_0x3fdaca['uniqueid']]);}logger[_0xec95('0x23')](_0xec95('0x2f'),_0x3fdaca[_0xec95('0x15')],util[_0xec95('0x14')](this[_0xec95('0x6')][_0x3fdaca[_0xec95('0x15')]],{'showHidden':![],'depth':null}));this['emit'](_0xec95('0x30'),_0xec95('0x31'),this[_0xec95('0x6')][_0x3fdaca['uniqueid']]);}}}catch(_0x581ea3){logger[_0xec95('0x26')]('[%s][voiceDialReport][dialend]',_0x3fdaca[_0xec95('0x15')],util[_0xec95('0x14')](_0x581ea3,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype']['syncVarSet']=function(_0x459351){try{if(this[_0xec95('0x10')](_0x459351)){logger[_0xec95('0x23')]('[%s][voiceDialReport][varset]\x20event:',_0x459351[_0xec95('0x15')],util['inspect'](_0x459351,{'showHidden':![],'depth':null}));this[_0xec95('0x32')](_0x459351[_0xec95('0x15')],_[_0xec95('0x33')](_0x459351[_0xec95('0x34')])[0x0],_0x459351[_0xec95('0x35')]);if(this[_0xec95('0x10')](_0x459351[_0xec95('0x34')])&&this['isNotNull'](_0x459351[_0xec95('0x34')][_0xec95('0x36')])){if(_[_0xec95('0x37')](this[_0xec95('0x6')][_0x459351[_0xec95('0x15')]])){this[_0xec95('0x6')][_0x459351['uniqueid']]={'routeId':_0x459351[_0xec95('0x35')],'variables':this['variables'][_0x459351['uniqueid']],'motionChannel':_0xec95('0x38')};logger['info'](_0xec95('0x39'),_0x459351[_0xec95('0x15')],_0x459351['variable'][_0xec95('0x36')],_['keys'](_0x459351[_0xec95('0x34')])[0x0],_0x459351[_0xec95('0x35')]);logger[_0xec95('0x23')](_0xec95('0x3a'),_0x459351['uniqueid'],util[_0xec95('0x14')](this['channels'][_0x459351['uniqueid']],{'showHidden':![],'depth':null}));this[_0xec95('0x11')](_0xec95('0x30'),_0xec95('0x31'),this['channels'][_0x459351['uniqueid']]);}}}}catch(_0x123fa7){logger['error'](_0xec95('0x3b'),_0x459351['uniqueid'],util[_0xec95('0x14')](_0x123fa7,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xec95('0xf')][_0xec95('0x32')]=function(_0x1c5704,_0x470aa6,_0x1c328a){var _0x12c658=['rtpaudioqos',_0xec95('0x3c'),_0xec95('0x3d'),_0xec95('0x3e'),_0xec95('0x3f'),_0xec95('0x40'),_0xec95('0x41'),_0xec95('0x42'),_0xec95('0x43'),_0xec95('0x44'),_0xec95('0x45'),_0xec95('0x46'),_0xec95('0x47'),'memberdynamic',_0xec95('0x48'),_0xec95('0x49'),_0xec95('0x20'),_0xec95('0x4a'),_0xec95('0x4b')];if(!_[_0xec95('0x4c')](_0x470aa6)&&!_['includes'](_0x12c658,_0x470aa6)){if(_[_0xec95('0x37')](this['variables'][_0x1c5704])){this[_0xec95('0x4d')][_0x1c5704]={};}this[_0xec95('0x4d')][_0x1c5704][_0x470aa6]=_0x1c328a;}};VoiceDialReport['prototype'][_0xec95('0xe')]=function(_0x13ce07){try{if(this[_0xec95('0x10')](_0x13ce07)){logger[_0xec95('0x23')](_0xec95('0x4e'),_0x13ce07['uniqueid'],util[_0xec95('0x14')](_0x13ce07,{'showHidden':![],'depth':null}));if(this[_0xec95('0x6')][_0x13ce07[_0xec95('0x15')]]){logger[_0xec95('0x4f')](_0xec95('0x50'),_0x13ce07[_0xec95('0x15')],_0x13ce07[_0xec95('0x51')]);this[_0xec95('0x6')][_0x13ce07[_0xec95('0x15')]][_0xec95('0x52')]=moment()['format'](_0xec95('0x17'));this[_0xec95('0x6')][_0x13ce07['uniqueid']]['duration']=moment(this[_0xec95('0x6')][_0x13ce07['uniqueid']]['endtime'])[_0xec95('0x53')](this[_0xec95('0x6')][_0x13ce07[_0xec95('0x15')]][_0xec95('0x54')],'seconds');this['channels'][_0x13ce07[_0xec95('0x15')]][_0xec95('0x2c')]=_0xec95('0x55');this[_0xec95('0x7')][_0xec95('0x56')]+=0x1;if(this[_0xec95('0x6')][_0x13ce07[_0xec95('0x15')]][_0xec95('0x2b')]){this[_0xec95('0x7')][_0xec95('0x57')]+=0x1;this[_0xec95('0x6')][_0x13ce07['uniqueid']]['holdtime']=moment(this[_0xec95('0x6')][_0x13ce07[_0xec95('0x15')]]['answertime'])['diff'](this['channels'][_0x13ce07[_0xec95('0x15')]][_0xec95('0x54')],_0xec95('0x58'));this['channels'][_0x13ce07['uniqueid']][_0xec95('0x59')]=moment(this[_0xec95('0x6')][_0x13ce07[_0xec95('0x15')]][_0xec95('0x52')])[_0xec95('0x53')](this[_0xec95('0x6')][_0x13ce07[_0xec95('0x15')]][_0xec95('0x2b')],_0xec95('0x58'));this[_0xec95('0x7')][_0xec95('0x5a')]+=this[_0xec95('0x6')][_0x13ce07[_0xec95('0x15')]][_0xec95('0x5b')]||0x0;this[_0xec95('0x7')][_0xec95('0x5c')]+=this[_0xec95('0x6')][_0x13ce07[_0xec95('0x15')]][_0xec95('0x59')];}this[_0xec95('0x7')][_0xec95('0x5d')]+=this['channels'][_0x13ce07[_0xec95('0x15')]][_0xec95('0x5e')];logger['debug'](_0xec95('0x5f'),_0x13ce07[_0xec95('0x15')],util[_0xec95('0x14')](this[_0xec95('0x6')][_0x13ce07[_0xec95('0x15')]],{'showHidden':![],'depth':null}));ami[_0xec95('0x11')](_0xec95('0x60'),this['channels'][_0x13ce07[_0xec95('0x15')]]);logger[_0xec95('0x23')]('[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:',_0x13ce07['uniqueid'],util['inspect'](this['channels'][_0x13ce07[_0xec95('0x15')]],{'showHidden':![],'depth':null}));ami[_0xec95('0x11')](_0xec95('0x61'),this['channels'][_0x13ce07['uniqueid']]);logger[_0xec95('0x23')](_0xec95('0x62'),_0x13ce07[_0xec95('0x15')],util[_0xec95('0x14')](this[_0xec95('0x6')][_0x13ce07[_0xec95('0x15')]],{'showHidden':![],'depth':null}));this[_0xec95('0x11')]('voice:outbound',_0xec95('0x63'),this[_0xec95('0x7')]);logger['info'](_0xec95('0x64'),JSON[_0xec95('0x65')](this[_0xec95('0x6')][_0x13ce07[_0xec95('0x15')]]));logger[_0xec95('0x23')]('[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:',_0x13ce07[_0xec95('0x15')],util['inspect'](this[_0xec95('0x6')][_0x13ce07[_0xec95('0x15')]],{'showHidden':![],'depth':null}));this[_0xec95('0x11')](_0xec95('0x30'),_0xec95('0x66'),this[_0xec95('0x6')][_0x13ce07[_0xec95('0x15')]]);this[_0xec95('0x67')](_0x13ce07['uniqueid']);}else if(this['channels'][_0x13ce07['linkedid']]){this['channels'][_0x13ce07[_0xec95('0x68')]][_0xec95('0x15')]=this[_0xec95('0x6')][_0x13ce07[_0xec95('0x68')]]['destuniqueid'];}if(this[_0xec95('0x4d')][_0x13ce07[_0xec95('0x15')]]){delete this['variables'][_0x13ce07[_0xec95('0x15')]];}}}catch(_0x5d74fc){logger[_0xec95('0x26')](_0xec95('0x69'),_0x13ce07[_0xec95('0x15')],util[_0xec95('0x14')](_0x5d74fc,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xec95('0xf')][_0xec95('0x6a')]=function(_0x249aed){try{if(this['isNotNull'](_0x249aed)){logger['debug']('[%s][voiceDialReport][newexten]\x20event:',_0x249aed[_0xec95('0x15')],util[_0xec95('0x14')](_0x249aed,{'showHidden':![],'depth':null}));if(_0x249aed[_0xec95('0x6b')]['toLowerCase']()==='set'){_0x249aed[_0xec95('0x6c')]=(_0x249aed['appdata']||_0x249aed['applicationdata'])[_0xec95('0x6d')]();if(_[_0xec95('0x6e')](_0x249aed['applicationdata'],_0xec95('0x6f'))){if(_[_0xec95('0x37')](this[_0xec95('0x8')][_0x249aed[_0xec95('0x15')]]))this[_0xec95('0x8')][_0x249aed[_0xec95('0x15')]]={};logger['info'](_0xec95('0x70'),_0x249aed[_0xec95('0x15')],_0x249aed['application'],_0x249aed['applicationdata']);var _0x3d63ef=_0x249aed['applicationdata'][_0xec95('0x71')]('=');var _0x1f5e6b=_0x3d63ef[0x0][_0xec95('0x72')](/cdr\((.*)\)/);if(_0x1f5e6b)this[_0xec95('0x8')][_0x249aed[_0xec95('0x15')]][_0x1f5e6b[0x1]]=_0x3d63ef[0x1];}}}}catch(_0x31f212){logger[_0xec95('0x26')](_0xec95('0x73'),_0x249aed[_0xec95('0x15')],util['inspect'](_0x31f212,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xec95('0xf')][_0xec95('0x67')]=function(_0x3e1902,_0x19d18f=0x2710){if(this['channels'][_0x3e1902]){setTimeout(()=>{delete this[_0xec95('0x6')][_0x3e1902];},_0x19d18f);}};module['exports']=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index 9c5d652..b9f75ea 100644 --- a/server/services/ami/report/voiceQueueReport.js +++ b/server/services/ami/report/voiceQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7179=['emitVoiceQueueChannelRemove','clearqueuereport','emit','emitVoiceQueueChannelSave','debug','[%s][voiceQueueReport][','uniqueid','queue','voice_queue_channel:save','voice_queue_presence:save',']\x20sending\x20voice_queue_channel:remove\x20event:','queuecallerexitreason','ATTENDEDTRANSFER','voice:queue:%s','voice_queue_channel:remove','voice_queue_presence:remove','emitInboundVoiceQueueSummary','inbound','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','format','name','voice_queue:save','isUndefined','Action','queues','catch','[voiceQueueReport][queues]','isRunning','actionid','queuestatus','createReport','realtime','handleInboundQueueSummaryReport','createQueueSummaryReport','compareToInboundQueue','assign','type','custom:queuesummary','statusRequests','completeEvent','push','isNotNull','[voiceQueueReport][queuesummary]\x20event:','[voiceQueueReport][queuesummary]\x20name:%s','then','[voiceQueueReport][queuesummary]','[voiceQueueReport][queuesummarycomplete]\x20event:','custom:queuesummarycomplete','[%s][voiceQueueReport][queuecallerjoin]','YYYY-MM-DD\x20HH:mm:ss','position','count','info','pick','[%s][voiceQueueReport][queuecallerabandon]','last','queuecallercompleteAt','holdtime','originalposition','queuecallerabandonAt','ABANDONED','lastAssignedTo','[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s','[%s][voiceQueueReport][queuecallerleave]','queuecallerleaveAt','connectedlinenum','connectedlinename','[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s','COMPLETEDBYAGENT','[%s][voiceQueueReport][agentcomplete]','assigned','queuecallerexitAt','transfer','reason','COMPLETED','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED','startsWith','channel','local/','linkedid','queuecallerjoinAt','seconds','FORWARDTRANSFER','transfertype','FORWARD','destexten','transferuniqueid','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER','COMPLETEDBY','toUpperCase','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s','keys','value','variable','CONTINUE','TIMEOUT','lastevent','timeout','custom:timeout','varset','queueposition','EXITWITHKEY','[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s','[%s][voiceQueueReport][varset]','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','handleHangup','length','diff','milliseconds','answered','unmanaged','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerunmanaged\x20event:','custom:queuecallerunmanaged','abandoned','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerabandon\x20event:','custom:queuecallerabandon','sumDuration','sumHoldTime','hangup','[%s][voiceQueueReport][hangup]\x20sending\x20voiceQueueReport\x20event:','[%s][voiceQueueReport][hangup]','cause-txt','cause','transferid','[%s][voiceQueueReport][syncHangup]\x20No\x20available\x20data\x20in\x20queueReports\x20structure:\x20clear\x20action\x20in\x20variablea\x20and\x20channels\x20structures\x20needed','transferexten','secondtransfereruniqueid','ATTENDED','transfereeuniqueid','switch','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','transfertargetuniqueid','origtransfererexten','origtransfereruniqueid','secondtransfererexten','[%s][voiceQueueReport][attendedtransfer]','syncBlindTransfer','[%s][voiceQueueReport][blindtransfer]','BLIND','BlindTransfer','context','transfererchannel','[%s][voiceQueueReport][musiconholdstart]','mohstarttime','[%s][voiceQueueReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceQueueReport][musiconholdstop]','mohtime','[%s][voiceQueueReport][musiconholdstop]\x20mohtime:%s','application','toLowerCase','set','applicationdata','appdata','cdr(','[%s][voiceQueueReport][newexten]\x20application:%s\x20appdata:%s','split','match','[%s][voiceQueueReport][newexten]','deleteChannelAfterTimeout','exports','moment','util','../../../config/environment','../../../config/logger','ami','../model/queueReport','../model/voiceQueueSummary','defaults','redis','localhost','socket.io-emitter','enqueue','tail','finally','agents','channels','queueChannels','voiceQueues','campaigns','queuesummary','syncQueueSummary','bind','queuesummarycomplete','syncQueueSummaryComplete','queuemember','queuestatuscomplete','queuecallerjoin','syncQueueCallerJoin','queuecallerabandon','syncQueueCallerAbandon','queuecallerleave','syncQueueCallerLeave','agentcomplete','syncAgentComplete','syncAgentConnect','syncVarSet','syncHangup','syncFullyBooted','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','loopQueueSummary','loopQueueShow','isEmpty','hasOwnProperty','originated','pTalking','waiting','unlockRR','queuecallerexit','queuecallercomplete','prototype','clearZombieChannels','isNil','status','message','No\x20such\x20channel','error','[%s][voiceQueueReport][checkChannel]','inspect','queueReports','[%s][voiceQueueReport][checkQueueReport]','variables','[%s][voiceQueueReport][checkVariables]','summary','clearQueueReport'];(function(_0x172922,_0x1ef014){var _0x5815f2=function(_0x5da309){while(--_0x5da309){_0x172922['push'](_0x172922['shift']());}};_0x5815f2(++_0x1ef014);}(_0x7179,0x1a1));var _0x9717=function(_0x213156,_0x291700){_0x213156=_0x213156-0x0;var _0x33d622=_0x7179[_0x213156];return _0x33d622;};'use strict';var _=require('lodash');var moment=require(_0x9717('0x0'));var util=require(_0x9717('0x1'));var Redis=require('ioredis');var config=require(_0x9717('0x2'));var logger=require(_0x9717('0x3'))(_0x9717('0x4'));var ami=require('../ami');var QueueReport=require(_0x9717('0x5'));var VoiceQueueSummary=require(_0x9717('0x6'));config['redis']=_[_0x9717('0x7')](config[_0x9717('0x8')],{'host':_0x9717('0x9'),'port':0x18eb});var io=require(_0x9717('0xa'))(new Redis(config[_0x9717('0x8')]));var Sequence=function(){};Sequence['prototype'][_0x9717('0xb')]=function(_0x3ca894){this[_0x9717('0xc')]=this['tail']?this['tail'][_0x9717('0xd')](_0x3ca894):_0x3ca894();};function VoiceQueueReport(_0x4c7753){this['sequence']=new Sequence();this['queueReports']={};this['realtime']=_0x4c7753;this[_0x9717('0xe')]=_0x4c7753[_0x9717('0xe')];this[_0x9717('0xf')]=_0x4c7753[_0x9717('0x10')];this[_0x9717('0x11')]=_0x4c7753[_0x9717('0x11')];this[_0x9717('0x12')]=_0x4c7753[_0x9717('0x12')];this['summary']=initializeSummary();this['variables']={};ami['on'](_0x9717('0x13'),this[_0x9717('0x14')][_0x9717('0x15')](this));ami['on'](_0x9717('0x16'),this[_0x9717('0x17')][_0x9717('0x15')](this));ami['on'](_0x9717('0x18'),this['syncQueueMember'][_0x9717('0x15')](this));ami['on'](_0x9717('0x19'),this['syncQueueStatusComplete'][_0x9717('0x15')](this));ami['on'](_0x9717('0x1a'),this[_0x9717('0x1b')][_0x9717('0x15')](this));ami['on'](_0x9717('0x1c'),this[_0x9717('0x1d')]['bind'](this));ami['on'](_0x9717('0x1e'),this[_0x9717('0x1f')]['bind'](this));ami['on'](_0x9717('0x20'),this[_0x9717('0x21')][_0x9717('0x15')](this));ami['on']('agentconnect',this[_0x9717('0x22')]['bind'](this));ami['on']('varset',this[_0x9717('0x23')][_0x9717('0x15')](this));ami['on']('hangup',this[_0x9717('0x24')][_0x9717('0x15')](this));ami['on']('fullybooted',this[_0x9717('0x25')]['bind'](this));ami['on']('musiconholdstart',this[_0x9717('0x26')][_0x9717('0x15')](this));ami['on'](_0x9717('0x27'),this[_0x9717('0x28')][_0x9717('0x15')](this));ami['on'](_0x9717('0x29'),this[_0x9717('0x2a')][_0x9717('0x15')](this));ami['on'](_0x9717('0x2b'),this['syncBlindTransfer']['bind'](this));this[_0x9717('0x2c')]();this[_0x9717('0x2d')]();}function clearChannels(_0x417202){if(!_[_0x9717('0x2e')](_0x417202)){for(var _0xcbfa5d in _0x417202){if(_0x417202['hasOwnProperty'](_0xcbfa5d)){delete _0x417202[_0xcbfa5d];}}}}function clearCampaigns(_0x37081a){if(!_[_0x9717('0x2e')](_0x37081a)){for(var _0x551e58 in _0x37081a){if(_0x37081a[_0x9717('0x2f')](_0x551e58)){_0x37081a[_0x551e58][_0x9717('0x30')]=0x0;}}}}function clearVoiceQueues(_0x4f795c){if(!_['isEmpty'](_0x4f795c)){for(var _0x1c5cd1 in _0x4f795c){if(_0x4f795c['hasOwnProperty'](_0x1c5cd1)){_0x4f795c[_0x1c5cd1][_0x9717('0x30')]=0x0;_0x4f795c[_0x1c5cd1]['talking']=0x0;_0x4f795c[_0x1c5cd1][_0x9717('0x31')]=0x0;_0x4f795c[_0x1c5cd1][_0x9717('0x32')]=0x0;_0x4f795c[_0x1c5cd1]['queueStatusComplete']=!![];}}}}function clearAgentBooked(_0xe7a82f){if(!_[_0x9717('0x2e')](_0xe7a82f)){for(var _0x1f0d61 in _0xe7a82f){if(_0xe7a82f['hasOwnProperty'](_0x1f0d61)){_0xe7a82f[_0x1f0d61][_0x9717('0x33')]=!![];}}}}function initializeSummary(){return{'id':null,'completeEvent':null,'isRunning':![],'queues':{},'queuestatus':{},'statusRequests':0x0};}function hasCallerLeftTheQueue(_0x14fbb9){return _0x14fbb9[_0x9717('0x34')]||_0x14fbb9[_0x9717('0x1c')]||_0x14fbb9[_0x9717('0x35')];}VoiceQueueReport[_0x9717('0x36')][_0x9717('0x37')]=function(){var _0x3f18ab=this;for(var _0x43e69a in this['channels']){if(this[_0x9717('0xf')][_0x9717('0x2f')](_0x43e69a)&&!this['channels'][_0x43e69a]['switch']){this['sequence'][_0x9717('0xb')](function(){if(!_[_0x9717('0x38')](_0x3f18ab[_0x9717('0xf')][_0x43e69a])){return ami['Action']({'action':_0x9717('0x39'),'channel':_0x3f18ab[_0x9717('0xf')][_0x43e69a]['channel']})['catch'](function(_0x4aa45d){if(_0x4aa45d[_0x9717('0x3a')]===_0x9717('0x3b')){setTimeout(function(){if(_0x3f18ab[_0x9717('0xf')][_0x43e69a]){delete _0x3f18ab[_0x9717('0xf')][_0x43e69a];logger[_0x9717('0x3c')](_0x9717('0x3d'),_0x43e69a,util[_0x9717('0x3e')](_0x4aa45d,{'showHidden':![],'depth':null}));}if(_0x3f18ab[_0x9717('0x3f')][_0x43e69a]){delete _0x3f18ab[_0x9717('0x3f')][_0x43e69a];logger['error'](_0x9717('0x40'),_0x43e69a,util[_0x9717('0x3e')](_0x4aa45d,{'showHidden':![],'depth':null}));}if(_0x3f18ab['variables'][_0x43e69a]){delete _0x3f18ab[_0x9717('0x41')][_0x43e69a];logger['error'](_0x9717('0x42'),_0x43e69a,util[_0x9717('0x3e')](_0x4aa45d,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport['prototype'][_0x9717('0x25')]=function(){logger[_0x9717('0x3c')]('[FullyBooted]\x20clear\x20realtime');clearChannels(this['channels']);this['clearQueueReport'](this[_0x9717('0x3f')]);clearAgentBooked(this[_0x9717('0xe')]);clearVoiceQueues(this['voiceQueues']);clearCampaigns(this[_0x9717('0x12')]);this[_0x9717('0x43')]=initializeSummary();};VoiceQueueReport[_0x9717('0x36')][_0x9717('0x44')]=function(_0x234224){var _0x556cea=this;if(!_[_0x9717('0x2e')](_0x234224)){for(var _0x3c4640 in _0x234224){if(_0x234224[_0x9717('0x2f')](_0x3c4640)){_0x556cea[_0x9717('0x45')](_0x234224[_0x3c4640],_0x9717('0x46'));delete _0x234224[_0x3c4640];}}}};VoiceQueueReport[_0x9717('0x36')][_0x9717('0x47')]=function(_0x1e6306,_0x1c7ae7,_0x3a2fb5){io['to'](_0x1e6306)[_0x9717('0x47')](_0x1c7ae7,_0x3a2fb5);};VoiceQueueReport['prototype'][_0x9717('0x48')]=function(_0x3b2b6c,_0x31d425){logger[_0x9717('0x49')](_0x9717('0x4a')+_0x31d425+']\x20sending\x20voice_queue_channel:save\x20event:',_0x3b2b6c[_0x9717('0x4b')],util[_0x9717('0x3e')](_0x3b2b6c,{'showHidden':![],'depth':null}));this[_0x9717('0x47')](util['format']('voice:queue:%s',_0x3b2b6c[_0x9717('0x4c')]),_0x9717('0x4d'),_0x3b2b6c);io[_0x9717('0x47')](_0x9717('0x4e'),_0x3b2b6c);};VoiceQueueReport[_0x9717('0x36')][_0x9717('0x45')]=function(_0x35a127,_0x3bd9d8){logger[_0x9717('0x49')]('[%s][voiceQueueReport]['+_0x3bd9d8+_0x9717('0x4f'),_0x35a127['uniqueid'],util[_0x9717('0x3e')](_0x35a127,{'showHidden':![],'depth':null}));if(_0x35a127[_0x9717('0x50')]===_0x9717('0x51')){return;}this[_0x9717('0x47')](util['format'](_0x9717('0x52'),_0x35a127[_0x9717('0x4c')]),_0x9717('0x53'),_0x35a127);io[_0x9717('0x47')](_0x9717('0x54'),_0x35a127);};VoiceQueueReport[_0x9717('0x36')][_0x9717('0x55')]=function(_0x30b64b){if(_0x30b64b['type']===_0x9717('0x56')){logger[_0x9717('0x49')](_0x9717('0x57'),util[_0x9717('0x3e')](_0x30b64b,{'showHidden':![],'depth':null}));this[_0x9717('0x47')](util[_0x9717('0x58')]('voice:queue:%s',_0x30b64b[_0x9717('0x59')]),_0x9717('0x5a'),_0x30b64b);}};VoiceQueueReport[_0x9717('0x36')]['isNotNull']=function(_0x707ff3){return _0x707ff3!==null&&!_[_0x9717('0x5b')](_0x707ff3);};VoiceQueueReport[_0x9717('0x36')]['loopQueueShow']=function(){var _0x4817cf=this;setInterval(function(){_0x4817cf[_0x9717('0x37')]();ami[_0x9717('0x5c')]({'action':_0x9717('0x5d')})[_0x9717('0x5e')](function(_0x137270){logger[_0x9717('0x3c')](_0x9717('0x5f'),util[_0x9717('0x3e')](_0x137270,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport[_0x9717('0x36')][_0x9717('0x2c')]=function(){var _0x41f7ab=this;setInterval(function(){if(!_0x41f7ab['summary'][_0x9717('0x60')]){return ami[_0x9717('0x5c')]({'action':_0x9717('0x13')})['then'](function(_0x2ce55a){_0x41f7ab[_0x9717('0x43')]['id']=_0x2ce55a[_0x9717('0x61')];_0x41f7ab[_0x9717('0x43')][_0x9717('0x60')]=!![];_0x41f7ab[_0x9717('0x43')][_0x9717('0x62')][_0x2ce55a['actionid']]={};})['catch'](function(_0x479c91){logger['error']('[voiceQueueReport][queuesummary]',util[_0x9717('0x3e')](_0x479c91,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport['prototype']['createQueueSummaryReport']=function(_0x24f2f7,_0x1915f6){var _0x5102a7;if(this['summary']&&this[_0x9717('0x43')][_0x9717('0x5d')]&&this[_0x9717('0x43')][_0x9717('0x5d')][_0x24f2f7[_0x9717('0x59')]]){_0x5102a7=this['summary'][_0x9717('0x5d')][_0x24f2f7[_0x9717('0x59')]]['summaryEvent'];}var _0x598d1a=new VoiceQueueSummary(_0x24f2f7);return _0x598d1a[_0x9717('0x63')](_0x1915f6['agents'],this['agents'],_0x5102a7,this[_0x9717('0x64')]['channels']);};VoiceQueueReport[_0x9717('0x36')][_0x9717('0x65')]=function(_0x24b40d,_0x3e5570){var _0x3ecbe4=this[_0x9717('0x66')](_0x24b40d,_0x3e5570);var _0x1cc150=![];_0x1cc150=_0x3ecbe4[_0x9717('0x67')](_0x24b40d);if(_0x1cc150){Object[_0x9717('0x68')](_0x24b40d,_0x3ecbe4);this[_0x9717('0x64')]['voiceQueues'][_0x24b40d[_0x9717('0x59')]]=_0x24b40d;this['emitInboundVoiceQueueSummary'](_0x3ecbe4);}};VoiceQueueReport['prototype']['syncQueueStatusComplete']=function(_0x359da5){var _0x37632a=null;var _0x3b30a0=this[_0x9717('0x43')]['id'];if(this[_0x9717('0x43')][_0x9717('0x62')][_0x3b30a0]){_0x37632a=this[_0x9717('0x43')][_0x9717('0x62')][_0x3b30a0][_0x359da5[_0x9717('0x61')]];}if(!_0x37632a){this[_0x9717('0x43')]=initializeSummary();return;}var _0x8424fb=this[_0x9717('0x11')][_0x37632a[_0x9717('0x4c')]];if(_0x8424fb[_0x9717('0x69')]===_0x9717('0x56')){this[_0x9717('0x65')](_0x8424fb,_0x37632a);}else if(_0x8424fb[_0x9717('0x69')]==='outbound'){var _0x6d43e1=this[_0x9717('0x66')](_0x8424fb,_0x37632a);ami[_0x9717('0x47')](_0x9717('0x6a'),_0x6d43e1);}this[_0x9717('0x43')]['statusRequests']-=0x1;var _0x5db542=this['summary'][_0x9717('0x6b')]>0x0?!![]:![];if(!_0x5db542){return this[_0x9717('0x17')](this['summary'][_0x9717('0x6c')]);}};VoiceQueueReport[_0x9717('0x36')]['syncQueueMember']=function(_0x116ef3){var _0x55f8f8=this['summary']['id'];if(this[_0x9717('0x43')]['queuestatus'][_0x55f8f8]&&this['summary'][_0x9717('0x62')][_0x55f8f8][_0x116ef3[_0x9717('0x61')]]){this[_0x9717('0x43')][_0x9717('0x62')][_0x55f8f8][_0x116ef3[_0x9717('0x61')]]['agents'][_0x9717('0x6d')](_0x116ef3);}};VoiceQueueReport[_0x9717('0x36')][_0x9717('0x14')]=function(_0x14ca65){var _0x1a564a=this;try{if(this[_0x9717('0x6e')](_0x14ca65)&&this['isNotNull'](_0x14ca65['queue'])){logger['debug'](_0x9717('0x6f'),util[_0x9717('0x3e')](_0x14ca65,{'showHidden':![],'depth':null}));var _0x38960b=this[_0x9717('0x11')][_0x14ca65[_0x9717('0x4c')]];if(_0x38960b){logger['debug'](_0x9717('0x70'),_0x38960b[_0x9717('0x59')]);this['summary'][_0x9717('0x5d')][_0x38960b[_0x9717('0x59')]]={'summaryEvent':_0x14ca65};this[_0x9717('0x43')]['statusRequests']+=0x1;return ami[_0x9717('0x5c')]({'action':'queuestatus','queue':_0x38960b[_0x9717('0x59')]})[_0x9717('0x71')](function(_0x2f43e0){if(!_0x1a564a[_0x9717('0x43')][_0x9717('0x62')][_0x14ca65[_0x9717('0x61')]]){_0x1a564a[_0x9717('0x43')]['queuestatus'][_0x14ca65[_0x9717('0x61')]]={};}_0x1a564a[_0x9717('0x43')][_0x9717('0x62')][_0x14ca65[_0x9717('0x61')]][_0x2f43e0['actionid']]={'queue':_0x38960b['name'],'agents':[]};})[_0x9717('0x5e')](function(_0x3cfe6d){throw _0x3cfe6d;});}}}catch(_0x1e2ab1){logger[_0x9717('0x3c')](_0x9717('0x72'),util[_0x9717('0x3e')](_0x1e2ab1,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9717('0x36')][_0x9717('0x17')]=function(_0x2f4a9c){if(this[_0x9717('0x43')][_0x9717('0x6b')]>0x0){this[_0x9717('0x43')]['completeEvent']=_0x2f4a9c;return;}logger[_0x9717('0x49')](_0x9717('0x73'),util['inspect'](_0x2f4a9c,{'showHidden':![],'depth':null}));this[_0x9717('0x43')]=initializeSummary();ami[_0x9717('0x47')](_0x9717('0x74'),{});};VoiceQueueReport[_0x9717('0x36')][_0x9717('0x1b')]=function(_0x44bda7){try{if(this[_0x9717('0x6e')](_0x44bda7)){logger[_0x9717('0x49')](_0x9717('0x75'),_0x44bda7[_0x9717('0x4b')],util[_0x9717('0x3e')](_0x44bda7,{'showHidden':![],'depth':null}));if(_[_0x9717('0x5b')](this[_0x9717('0x3f')][_0x44bda7['uniqueid']])){this[_0x9717('0x3f')][_0x44bda7[_0x9717('0x4b')]]=[];}if(_['isUndefined'](this[_0x9717('0xf')][_0x44bda7['uniqueid']])){this[_0x9717('0xf')][_0x44bda7[_0x9717('0x4b')]]={};}var _0x511929=new QueueReport();_0x511929[_0x9717('0x4c')]=_0x44bda7['queue'];_0x511929[_0x9717('0x69')]=this['voiceQueues'][_0x511929[_0x9717('0x4c')]]&&this['voiceQueues'][_0x511929['queue']][_0x9717('0x69')]?this['voiceQueues'][_0x511929['queue']][_0x9717('0x69')]||_0x9717('0x56'):_0x9717('0x56');_0x511929['queuecallerjoinAt']=moment()[_0x9717('0x58')](_0x9717('0x76'));_0x511929[_0x9717('0x77')]=_0x44bda7[_0x9717('0x77')];_0x511929['count']=_0x44bda7[_0x9717('0x78')];_0x511929[_0x9717('0x4b')]=_0x44bda7[_0x9717('0x4b')];logger[_0x9717('0x79')]('[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s',_0x511929['queue'],_0x511929[_0x9717('0x69')]);Object[_0x9717('0x68')](_0x511929,_[_0x9717('0x7a')](_0x44bda7,_['keys'](_0x511929)));this['queueReports'][_0x44bda7['uniqueid']][_0x9717('0x6d')](_0x511929);this['channels'][_0x44bda7['uniqueid']]=_0x511929;this['emitVoiceQueueChannelSave'](_0x511929,_0x9717('0x1a'));}}catch(_0x56d210){logger[_0x9717('0x3c')]('[%s][voiceQueueReport][queuecallerjoin]',_0x44bda7[_0x9717('0x4b')],util['inspect'](_0x56d210,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9717('0x36')][_0x9717('0x1d')]=function(_0x31c36f){try{if(this['isNotNull'](_0x31c36f)){logger['debug'](_0x9717('0x7b'),_0x31c36f['uniqueid'],util[_0x9717('0x3e')](_0x31c36f,{'showHidden':![],'depth':null}));if(this[_0x9717('0x3f')][_0x31c36f['uniqueid']]){var _0x446aa9=_[_0x9717('0x7c')](this['queueReports'][_0x31c36f['uniqueid']]);_0x446aa9[_0x9717('0x35')]=![];_0x446aa9[_0x9717('0x7d')]=null;_0x446aa9['holdtime']=_0x31c36f[_0x9717('0x7e')];_0x446aa9['originalposition']=_0x31c36f[_0x9717('0x7f')];_0x446aa9[_0x9717('0x1c')]=!![];_0x446aa9[_0x9717('0x80')]=moment()[_0x9717('0x58')](_0x9717('0x76'));_0x446aa9[_0x9717('0x50')]=_0x9717('0x81');_0x446aa9[_0x9717('0x82')]=null;logger['info'](_0x9717('0x83'),_0x446aa9[_0x9717('0x4c')],_0x446aa9[_0x9717('0x69')]);this[_0x9717('0xf')][_0x31c36f[_0x9717('0x4b')]]=_0x446aa9;this[_0x9717('0x45')](_0x446aa9,'queuecallerabandon');}}}catch(_0x240234){logger[_0x9717('0x3c')](_0x9717('0x7b'),_0x31c36f[_0x9717('0x4b')],util[_0x9717('0x3e')](_0x240234,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9717('0x36')][_0x9717('0x1f')]=function(_0x40d513){try{if(this[_0x9717('0x6e')](_0x40d513)){logger['debug'](_0x9717('0x84'),_0x40d513[_0x9717('0x4b')],util[_0x9717('0x3e')](_0x40d513,{'showHidden':![],'depth':null}));if(this[_0x9717('0x3f')][_0x40d513[_0x9717('0x4b')]]){var _0x1d742d=_[_0x9717('0x7c')](this[_0x9717('0x3f')][_0x40d513[_0x9717('0x4b')]]);_0x1d742d[_0x9717('0x85')]=moment()[_0x9717('0x58')](_0x9717('0x76'));_0x1d742d[_0x9717('0x86')]=_0x40d513['connectedlinenum'];_0x1d742d[_0x9717('0x87')]=_0x40d513[_0x9717('0x87')];logger[_0x9717('0x79')](_0x9717('0x88'),_0x1d742d[_0x9717('0x4c')],_0x1d742d['type'],_0x40d513[_0x9717('0x86')],_0x40d513[_0x9717('0x87')]);this[_0x9717('0xf')][_0x40d513['uniqueid']]=_0x1d742d;this[_0x9717('0x48')](_0x1d742d,_0x9717('0x1e'));}}}catch(_0x56b0ee){logger[_0x9717('0x3c')](_0x9717('0x84'),_0x40d513[_0x9717('0x4b')],util[_0x9717('0x3e')](_0x56b0ee,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x9717('0x22')]=function(_0xbbaf05){try{if(this['isNotNull'](_0xbbaf05)){logger[_0x9717('0x49')]('[%s][voiceQueueReport][agentconnect]',_0xbbaf05[_0x9717('0x4b')],util[_0x9717('0x3e')](_0xbbaf05,{'showHidden':![],'depth':null}));if(this[_0x9717('0x3f')][_0xbbaf05['uniqueid']]){var _0x48d56f=_[_0x9717('0x7c')](this['queueReports'][_0xbbaf05[_0x9717('0x4b')]]);_0x48d56f[_0x9717('0x35')]=!![];_0x48d56f[_0x9717('0x50')]=_0x9717('0x89');logger[_0x9717('0x79')]('[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT',_0x48d56f['queue'],_0x48d56f[_0x9717('0x69')]);}}}catch(_0x271a91){logger['error']('[%s][voiceQueueReport][agentconnect]',_0xbbaf05['uniqueid'],util[_0x9717('0x3e')](_0x271a91,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9717('0x36')]['syncAgentComplete']=function(_0x58076a){try{if(this[_0x9717('0x6e')](_0x58076a)){logger['debug'](_0x9717('0x8a'),_0x58076a[_0x9717('0x4b')],util[_0x9717('0x3e')](_0x58076a,{'showHidden':![],'depth':null}));if(this[_0x9717('0x3f')][_0x58076a[_0x9717('0x4b')]]){var _0xe86a12=_[_0x9717('0x7c')](this[_0x9717('0x3f')][_0x58076a[_0x9717('0x4b')]]);_0xe86a12[_0x9717('0x1c')]=![];_0xe86a12[_0x9717('0x80')]=null;_0xe86a12[_0x9717('0x8b')]=!![];_0xe86a12['lastAssignedTo']=_0x58076a['membername'];_0xe86a12[_0x9717('0x7e')]=_0x58076a['holdtime'];_0xe86a12[_0x9717('0x35')]=!![];_0xe86a12[_0x9717('0x34')]=![];_0xe86a12[_0x9717('0x8c')]=null;if(!_0xe86a12[_0x9717('0x8d')]){if(_0x58076a[_0x9717('0x8e')]==_0x9717('0x8d')){_0xe86a12[_0x9717('0x50')]=_0x9717('0x8f');logger[_0x9717('0x79')](_0x9717('0x90'),_0xe86a12[_0x9717('0x4c')],_0xe86a12[_0x9717('0x69')]);}else{if(_[_0x9717('0x91')](_0x58076a[_0x9717('0x92')]['toLowerCase'](),_0x9717('0x93'))){if(this[_0x9717('0x3f')][_0x58076a[_0x9717('0x94')]]){var _0x5c749a=_[_0x9717('0x7c')](this[_0x9717('0x3f')][_0x58076a[_0x9717('0x94')]]);_0x5c749a[_0x9717('0x35')]=![];_0x5c749a[_0x9717('0x34')]=!![];_0x5c749a['queuecallerexitAt']=moment(_0xe86a12[_0x9717('0x95')])['add'](_0x58076a[_0x9717('0x7e')],_0x9717('0x96'))[_0x9717('0x58')]('YYYY-MM-DD\x20HH:mm:ss');_0x5c749a['queuecallerexitreason']=_0x9717('0x97');_0x5c749a['transfer']=!![];_0x5c749a[_0x9717('0x98')]=_0x9717('0x99');_0x5c749a['transferexten']=_0x58076a[_0x9717('0x9a')];_0x5c749a[_0x9717('0x9b')]=_0x58076a[_0x9717('0x4b')];logger[_0x9717('0x79')](_0x9717('0x9c'),_0x5c749a[_0x9717('0x4c')],_0x5c749a[_0x9717('0x69')]);var _0x540dbe=this[_0x9717('0x3f')][_0x58076a[_0x9717('0x94')]];this[_0x9717('0x3f')][_0x58076a['linkedid']]=this[_0x9717('0x3f')][_0x58076a[_0x9717('0x4b')]];this[_0x9717('0x3f')][_0x58076a[_0x9717('0x4b')]]=_0x540dbe;}}else{_0xe86a12[_0x9717('0x50')]=_0x9717('0x9d')+_0x58076a['reason'][_0x9717('0x9e')]();logger[_0x9717('0x79')](_0x9717('0x9f'),_0xe86a12[_0x9717('0x4c')],_0xe86a12[_0x9717('0x69')],_0xe86a12[_0x9717('0x50')]);}}}this[_0x9717('0xf')][_0x58076a[_0x9717('0x4b')]]=_0xe86a12;}}}catch(_0x12af8e){logger[_0x9717('0x3c')]('[%s][voiceQueueReport][agentcomplete]',_0x58076a[_0x9717('0x4b')],util[_0x9717('0x3e')](_0x12af8e,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9717('0x36')][_0x9717('0x23')]=function(_0x3d1e6f){try{if(this['isNotNull'](_0x3d1e6f)){logger[_0x9717('0x49')]('[%s][voiceQueueReport][varset]',_0x3d1e6f[_0x9717('0x4b')],util[_0x9717('0x3e')](_0x3d1e6f,{'showHidden':![],'depth':null}));this['addVariable'](_0x3d1e6f[_0x9717('0x4b')],_[_0x9717('0xa0')](_0x3d1e6f['variable'])[0x0],_0x3d1e6f[_0x9717('0xa1')]);if(this[_0x9717('0x3f')][_0x3d1e6f[_0x9717('0x4b')]]){var _0x257852=_['last'](this[_0x9717('0x3f')][_0x3d1e6f[_0x9717('0x4b')]]);if(_0x257852){if(this[_0x9717('0x6e')](_0x3d1e6f['variable'])&&this['isNotNull'](_0x3d1e6f[_0x9717('0xa2')][_0x9717('0x62')])){switch(_0x3d1e6f[_0x9717('0xa1')]){case _0x9717('0xa3'):_0x257852['queuecallerexit']=![];_0x257852[_0x9717('0x8c')]=null;break;case _0x9717('0xa4'):_0x257852[_0x9717('0xa5')]=_0x9717('0xa6');_0x257852[_0x9717('0x34')]=!![];_0x257852[_0x9717('0x8c')]=moment()['format'](_0x9717('0x76'));_0x257852[_0x9717('0x85')]=moment()['format'](_0x9717('0x76'));logger['debug']('[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:',_0x3d1e6f[_0x9717('0x4b')],util[_0x9717('0x3e')](_0x257852,{'showHidden':![],'depth':null}));ami[_0x9717('0x47')](_0x9717('0xa7'),_0x257852);break;default:_0x257852[_0x9717('0x34')]=!![];_0x257852['queuecallerexitAt']=moment()[_0x9717('0x58')](_0x9717('0x76'));_0x257852[_0x9717('0x85')]=moment()[_0x9717('0x58')](_0x9717('0x76'));}_0x257852[_0x9717('0x1c')]=![];_0x257852[_0x9717('0x80')]=null;_0x257852['queuecallerexitreason']=_0x3d1e6f[_0x9717('0xa1')];this[_0x9717('0xf')][_0x3d1e6f[_0x9717('0x4b')]]=_0x257852;this['emitVoiceQueueChannelRemove'](_0x257852,_0x9717('0xa8'));}else if(this[_0x9717('0x6e')](_0x3d1e6f[_0x9717('0xa2')])&&this[_0x9717('0x6e')](_0x3d1e6f['variable'][_0x9717('0xa9')])){if(!_0x257852[_0x9717('0x1c')]){_0x257852[_0x9717('0x34')]=!![];_0x257852[_0x9717('0x8c')]=moment()[_0x9717('0x58')]('YYYY-MM-DD\x20HH:mm:ss');_0x257852[_0x9717('0x50')]=_0x9717('0xaa');_0x257852['queuecallerleaveAt']=moment()[_0x9717('0x58')](_0x9717('0x76'));this[_0x9717('0xf')][_0x3d1e6f[_0x9717('0x4b')]]=_0x257852;}}logger[_0x9717('0x79')](_0x9717('0xab'),_0x3d1e6f[_0x9717('0x4b')],_0x257852[_0x9717('0x4c')],_0x257852[_0x9717('0x69')],_[_0x9717('0xa0')](_0x3d1e6f[_0x9717('0xa2')])[0x0],_0x3d1e6f[_0x9717('0xa1')]);_0x257852[_0x9717('0x41')]=this['variables'][_0x3d1e6f[_0x9717('0x4b')]];}}}}catch(_0x3ab6ff){logger[_0x9717('0x3c')](_0x9717('0xac'),_0x3d1e6f[_0x9717('0x4b')],util['inspect'](_0x3ab6ff,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9717('0x36')]['addVariable']=function(_0x3ff294,_0x1599fd,_0x342a1d){var _0x268b4e=['rtpaudioqos',_0x9717('0xad'),_0x9717('0xae'),'rtpaudioqosjitterbridged',_0x9717('0xaf'),_0x9717('0xb0'),'rtpaudioqosrtt',_0x9717('0xb1'),_0x9717('0xb2'),_0x9717('0xb3'),_0x9717('0xb4'),_0x9717('0xb5'),_0x9717('0xb6'),_0x9717('0xb7'),_0x9717('0xb8'),_0x9717('0xb9'),'membername',_0x9717('0xba'),_0x9717('0xbb')];if(!_[_0x9717('0x38')](_0x1599fd)&&!_['includes'](_0x268b4e,_0x1599fd)){if(_['isUndefined'](this['variables'][_0x3ff294])){this[_0x9717('0x41')][_0x3ff294]={};}this[_0x9717('0x41')][_0x3ff294][_0x1599fd]=_0x342a1d;}};VoiceQueueReport['prototype'][_0x9717('0xbc')]=function(_0x448267,_0x468d90,_0x151d6f){try{var _0x556475={};if(this[_0x9717('0x3f')][_0x448267]){for(var _0x46d68a=0x0;_0x46d68a{delete this[_0x9717('0xf')][_0x48d980];},_0x5b34c0);}};module[_0x9717('0xf2')]=VoiceQueueReport; \ No newline at end of file +var _0x9891=['connectedlinenum','connectedlinename','[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s','[%s][voiceQueueReport][agentconnect]','last','queuecallerexitreason','COMPLETEDBYAGENT','[%s][voiceQueueReport][agentcomplete]','assigned','membername','transfer','reason','COMPLETED','channel','toLowerCase','local/','queuecallerexit','queuecallerexitAt','add','seconds','transfertype','FORWARD','transferexten','destexten','transferuniqueid','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER','linkedid','toUpperCase','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s','syncVarSet','[%s][voiceQueueReport][varset]','addVariable','variable','value','TIMEOUT','lastevent','timeout','[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:','custom:timeout','EXITWITHKEY','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','membercalls','memberinterface','memberlastcall','memberpenalty','memberrealtime','includes','handleHangup','length','sumHoldTime','sumDuration','total','answered','sumBillable','unmanaged','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerunmanaged\x20event:','custom:queuecallerunmanaged','abandoned','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerabandon\x20event:','custom:queuecallerabandon','[%s][voiceQueueReport][hangup]\x20sending\x20voiceQueueReport\x20event:','deleteChannelAfterTimeout','[%s][voiceQueueReport][hangup]','cause-txt','syncAttendedTransfer','[%s][voiceQueueReport][attendedtransfer]','transfereeuniqueid','secondtransfererexten','secondtransfereruniqueid','switch','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','transfertargetuniqueid','origtransfererexten','ATTENDED','origtransfereruniqueid','transferid','[%s][voiceQueueReport][blindtransfer]','BLINDTRANSFER','BLIND','extension','[%s][voiceQueueReport][blindTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','BlindTransfer','context','[%s][voiceQueueReport][musiconholdstart]','isNil','[%s][voiceQueueReport][musiconholdstart]\x20mohstarttime:%s','mohstarttime','[%s][voiceQueueReport][musiconholdstop]','mohtime','milliseconds','diff','[%s][voiceQueueReport][musiconholdstop]\x20mohtime:%s','syncNewExten','[%s][voiceQueueReport][newexten]\x20event:','application','set','applicationdata','appdata','cdr(','[%s][voiceQueueReport][newexten]\x20application:%s\x20appdata:%s','match','[%s][voiceQueueReport][newexten]','exports','lodash','moment','util','../../../config/environment','../ami','../model/queueReport','../model/voiceQueueSummary','redis','defaults','prototype','enqueue','tail','finally','sequence','queueReports','realtime','agents','channels','queueChannels','voiceQueues','campaigns','variables','queuesummary','syncQueueSummary','queuesummarycomplete','syncQueueSummaryComplete','bind','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','queuecallerjoin','syncQueueCallerJoin','queuecallerabandon','syncQueueCallerAbandon','queuecallerleave','syncQueueCallerLeave','agentcomplete','syncAgentComplete','agentconnect','syncAgentConnect','varset','syncHangup','syncFullyBooted','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','blindtransfer','syncBlindTransfer','loopQueueShow','isEmpty','hasOwnProperty','talking','waiting','queueStatusComplete','clearZombieChannels','status','catch','message','No\x20such\x20channel','error','[%s][voiceQueueReport][checkChannel]','[%s][voiceQueueReport][checkQueueReport]','inspect','[%s][voiceQueueReport][checkVariables]','[FullyBooted]\x20clear\x20realtime','clearQueueReport','summary','emitVoiceQueueChannelRemove','clearqueuereport','emitVoiceQueueChannelSave','debug','[%s][voiceQueueReport][',']\x20sending\x20voice_queue_channel:save\x20event:','uniqueid','emit','format','voice:queue:%s','voice_queue_channel:save','voice_queue_presence:save',']\x20sending\x20voice_queue_channel:remove\x20event:','ATTENDEDTRANSFER','queue','voice_queue_channel:remove','voice_queue_presence:remove','emitInboundVoiceQueueSummary','name','voice_queue:save','isNotNull','isUndefined','Action','[voiceQueueReport][queues]','loopQueueSummary','then','actionid','isRunning','[voiceQueueReport][queuesummary]','queues','summaryEvent','handleInboundQueueSummaryReport','createQueueSummaryReport','queuestatus','type','statusRequests','completeEvent','push','[voiceQueueReport][queuesummary]\x20event:','[voiceQueueReport][queuesummary]\x20name:%s','custom:queuesummarycomplete','[%s][voiceQueueReport][queuecallerjoin]','inbound','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','position','count','info','assign','pick','keys','[%s][voiceQueueReport][queuecallerabandon]','queuecallercomplete','queuecallercompleteAt','holdtime','originalposition','queuecallerabandonAt','lastAssignedTo','[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s','[%s][voiceQueueReport][queuecallerleave]','queuecallerleaveAt'];(function(_0x533990,_0x21fe8d){var _0x5a5e2a=function(_0x2539c3){while(--_0x2539c3){_0x533990['push'](_0x533990['shift']());}};_0x5a5e2a(++_0x21fe8d);}(_0x9891,0x163));var _0x1989=function(_0x131a70,_0x5f53b2){_0x131a70=_0x131a70-0x0;var _0x212967=_0x9891[_0x131a70];return _0x212967;};'use strict';var _=require(_0x1989('0x0'));var moment=require(_0x1989('0x1'));var util=require(_0x1989('0x2'));var Redis=require('ioredis');var config=require(_0x1989('0x3'));var logger=require('../../../config/logger')('ami');var ami=require(_0x1989('0x4'));var QueueReport=require(_0x1989('0x5'));var VoiceQueueSummary=require(_0x1989('0x6'));config[_0x1989('0x7')]=_[_0x1989('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var Sequence=function(){};Sequence[_0x1989('0x9')][_0x1989('0xa')]=function(_0x57c1c7){this[_0x1989('0xb')]=this[_0x1989('0xb')]?this['tail'][_0x1989('0xc')](_0x57c1c7):_0x57c1c7();};function VoiceQueueReport(_0x155a0d){this[_0x1989('0xd')]=new Sequence();this[_0x1989('0xe')]={};this[_0x1989('0xf')]=_0x155a0d;this[_0x1989('0x10')]=_0x155a0d[_0x1989('0x10')];this[_0x1989('0x11')]=_0x155a0d[_0x1989('0x12')];this[_0x1989('0x13')]=_0x155a0d[_0x1989('0x13')];this[_0x1989('0x14')]=_0x155a0d[_0x1989('0x14')];this['summary']=initializeSummary();this[_0x1989('0x15')]={};ami['on'](_0x1989('0x16'),this[_0x1989('0x17')]['bind'](this));ami['on'](_0x1989('0x18'),this[_0x1989('0x19')][_0x1989('0x1a')](this));ami['on'](_0x1989('0x1b'),this[_0x1989('0x1c')][_0x1989('0x1a')](this));ami['on'](_0x1989('0x1d'),this[_0x1989('0x1e')][_0x1989('0x1a')](this));ami['on'](_0x1989('0x1f'),this[_0x1989('0x20')][_0x1989('0x1a')](this));ami['on'](_0x1989('0x21'),this[_0x1989('0x22')][_0x1989('0x1a')](this));ami['on'](_0x1989('0x23'),this[_0x1989('0x24')]['bind'](this));ami['on'](_0x1989('0x25'),this[_0x1989('0x26')][_0x1989('0x1a')](this));ami['on'](_0x1989('0x27'),this[_0x1989('0x28')][_0x1989('0x1a')](this));ami['on'](_0x1989('0x29'),this['syncVarSet'][_0x1989('0x1a')](this));ami['on']('hangup',this[_0x1989('0x2a')]['bind'](this));ami['on']('fullybooted',this[_0x1989('0x2b')]['bind'](this));ami['on']('musiconholdstart',this['syncMusicOnHoldStart'][_0x1989('0x1a')](this));ami['on'](_0x1989('0x2c'),this[_0x1989('0x2d')][_0x1989('0x1a')](this));ami['on'](_0x1989('0x2e'),this['syncAttendedTransfer'][_0x1989('0x1a')](this));ami['on'](_0x1989('0x2f'),this[_0x1989('0x30')][_0x1989('0x1a')](this));this['loopQueueSummary']();this[_0x1989('0x31')]();}function clearChannels(_0x2dcf97){if(!_[_0x1989('0x32')](_0x2dcf97)){for(var _0x40f365 in _0x2dcf97){if(_0x2dcf97[_0x1989('0x33')](_0x40f365)){delete _0x2dcf97[_0x40f365];}}}}function clearCampaigns(_0xee6712){if(!_[_0x1989('0x32')](_0xee6712)){for(var _0x3425d7 in _0xee6712){if(_0xee6712[_0x1989('0x33')](_0x3425d7)){_0xee6712[_0x3425d7]['originated']=0x0;}}}}function clearVoiceQueues(_0x3ea025){if(!_['isEmpty'](_0x3ea025)){for(var _0x52b454 in _0x3ea025){if(_0x3ea025[_0x1989('0x33')](_0x52b454)){_0x3ea025[_0x52b454]['originated']=0x0;_0x3ea025[_0x52b454][_0x1989('0x34')]=0x0;_0x3ea025[_0x52b454]['pTalking']=0x0;_0x3ea025[_0x52b454][_0x1989('0x35')]=0x0;_0x3ea025[_0x52b454][_0x1989('0x36')]=!![];}}}}function clearAgentBooked(_0x268f55){if(!_[_0x1989('0x32')](_0x268f55)){for(var _0x5cc171 in _0x268f55){if(_0x268f55[_0x1989('0x33')](_0x5cc171)){_0x268f55[_0x5cc171]['unlockRR']=!![];}}}}function initializeSummary(){return{'id':null,'completeEvent':null,'isRunning':![],'queues':{},'queuestatus':{},'statusRequests':0x0};}function hasCallerLeftTheQueue(_0x288faf){return _0x288faf['queuecallerexit']||_0x288faf[_0x1989('0x21')]||_0x288faf['queuecallercomplete'];}VoiceQueueReport[_0x1989('0x9')][_0x1989('0x37')]=function(){var _0x383d30=this;for(var _0x1bcb3a in this[_0x1989('0x11')]){if(this[_0x1989('0x11')]['hasOwnProperty'](_0x1bcb3a)&&!this['channels'][_0x1bcb3a]['switch']){this[_0x1989('0xd')]['enqueue'](function(){if(!_['isNil'](_0x383d30['channels'][_0x1bcb3a])){return ami['Action']({'action':_0x1989('0x38'),'channel':_0x383d30[_0x1989('0x11')][_0x1bcb3a]['channel']})[_0x1989('0x39')](function(_0x2cd860){if(_0x2cd860[_0x1989('0x3a')]===_0x1989('0x3b')){setTimeout(function(){if(_0x383d30['channels'][_0x1bcb3a]){delete _0x383d30[_0x1989('0x11')][_0x1bcb3a];logger[_0x1989('0x3c')](_0x1989('0x3d'),_0x1bcb3a,util['inspect'](_0x2cd860,{'showHidden':![],'depth':null}));}if(_0x383d30['queueReports'][_0x1bcb3a]){delete _0x383d30[_0x1989('0xe')][_0x1bcb3a];logger['error'](_0x1989('0x3e'),_0x1bcb3a,util[_0x1989('0x3f')](_0x2cd860,{'showHidden':![],'depth':null}));}if(_0x383d30[_0x1989('0x15')][_0x1bcb3a]){delete _0x383d30[_0x1989('0x15')][_0x1bcb3a];logger['error'](_0x1989('0x40'),_0x1bcb3a,util[_0x1989('0x3f')](_0x2cd860,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport[_0x1989('0x9')][_0x1989('0x2b')]=function(){logger[_0x1989('0x3c')](_0x1989('0x41'));clearChannels(this['channels']);this[_0x1989('0x42')](this['queueReports']);clearAgentBooked(this[_0x1989('0x10')]);clearVoiceQueues(this[_0x1989('0x13')]);clearCampaigns(this[_0x1989('0x14')]);this[_0x1989('0x43')]=initializeSummary();};VoiceQueueReport[_0x1989('0x9')][_0x1989('0x42')]=function(_0x5e993d){var _0x1f6723=this;if(!_['isEmpty'](_0x5e993d)){for(var _0xf7b0db in _0x5e993d){if(_0x5e993d['hasOwnProperty'](_0xf7b0db)){_0x1f6723[_0x1989('0x44')](_0x5e993d[_0xf7b0db],_0x1989('0x45'));delete _0x5e993d[_0xf7b0db];}}}};VoiceQueueReport[_0x1989('0x9')]['emit']=function(_0x28d308,_0x4c8254,_0x233b50){io['to'](_0x28d308)['emit'](_0x4c8254,_0x233b50);};VoiceQueueReport['prototype'][_0x1989('0x46')]=function(_0x22bdab,_0x1293f8){logger[_0x1989('0x47')](_0x1989('0x48')+_0x1293f8+_0x1989('0x49'),_0x22bdab[_0x1989('0x4a')],util[_0x1989('0x3f')](_0x22bdab,{'showHidden':![],'depth':null}));this[_0x1989('0x4b')](util[_0x1989('0x4c')](_0x1989('0x4d'),_0x22bdab['queue']),_0x1989('0x4e'),_0x22bdab);io['emit'](_0x1989('0x4f'),_0x22bdab);};VoiceQueueReport['prototype']['emitVoiceQueueChannelRemove']=function(_0x418006,_0x58d1da){logger[_0x1989('0x47')](_0x1989('0x48')+_0x58d1da+_0x1989('0x50'),_0x418006[_0x1989('0x4a')],util['inspect'](_0x418006,{'showHidden':![],'depth':null}));if(_0x418006['queuecallerexitreason']===_0x1989('0x51')){return;}this['emit'](util[_0x1989('0x4c')]('voice:queue:%s',_0x418006[_0x1989('0x52')]),_0x1989('0x53'),_0x418006);io['emit'](_0x1989('0x54'),_0x418006);};VoiceQueueReport[_0x1989('0x9')][_0x1989('0x55')]=function(_0x262043){if(_0x262043['type']==='inbound'){logger['debug']('[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:',util[_0x1989('0x3f')](_0x262043,{'showHidden':![],'depth':null}));this[_0x1989('0x4b')](util['format'](_0x1989('0x4d'),_0x262043[_0x1989('0x56')]),_0x1989('0x57'),_0x262043);}};VoiceQueueReport['prototype'][_0x1989('0x58')]=function(_0x37d45b){return _0x37d45b!==null&&!_[_0x1989('0x59')](_0x37d45b);};VoiceQueueReport[_0x1989('0x9')][_0x1989('0x31')]=function(){var _0x46766f=this;setInterval(function(){_0x46766f['clearZombieChannels']();ami[_0x1989('0x5a')]({'action':'queues'})[_0x1989('0x39')](function(_0x1a5994){logger[_0x1989('0x3c')](_0x1989('0x5b'),util[_0x1989('0x3f')](_0x1a5994,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport[_0x1989('0x9')][_0x1989('0x5c')]=function(){var _0x2c4987=this;setInterval(function(){if(!_0x2c4987[_0x1989('0x43')]['isRunning']){return ami[_0x1989('0x5a')]({'action':_0x1989('0x16')})[_0x1989('0x5d')](function(_0x47c5d6){_0x2c4987['summary']['id']=_0x47c5d6[_0x1989('0x5e')];_0x2c4987[_0x1989('0x43')][_0x1989('0x5f')]=!![];_0x2c4987['summary']['queuestatus'][_0x47c5d6[_0x1989('0x5e')]]={};})[_0x1989('0x39')](function(_0x1ad549){logger[_0x1989('0x3c')](_0x1989('0x60'),util[_0x1989('0x3f')](_0x1ad549,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport['prototype']['createQueueSummaryReport']=function(_0x439562,_0x3d6b5d){var _0xcf9d35;if(this['summary']&&this[_0x1989('0x43')][_0x1989('0x61')]&&this[_0x1989('0x43')][_0x1989('0x61')][_0x439562[_0x1989('0x56')]]){_0xcf9d35=this[_0x1989('0x43')][_0x1989('0x61')][_0x439562[_0x1989('0x56')]][_0x1989('0x62')];}var _0x48fd66=new VoiceQueueSummary(_0x439562);return _0x48fd66['createReport'](_0x3d6b5d[_0x1989('0x10')],this[_0x1989('0x10')],_0xcf9d35,this['realtime'][_0x1989('0x11')]);};VoiceQueueReport[_0x1989('0x9')][_0x1989('0x63')]=function(_0x5de260,_0x55978c){var _0x17c642=this[_0x1989('0x64')](_0x5de260,_0x55978c);var _0x1fa342=![];_0x1fa342=_0x17c642['compareToInboundQueue'](_0x5de260);if(_0x1fa342){Object['assign'](_0x5de260,_0x17c642);this[_0x1989('0xf')][_0x1989('0x13')][_0x5de260[_0x1989('0x56')]]=_0x5de260;this[_0x1989('0x55')](_0x17c642);}};VoiceQueueReport['prototype'][_0x1989('0x1e')]=function(_0x228ce2){var _0x491fee=null;var _0x4443d8=this[_0x1989('0x43')]['id'];if(this[_0x1989('0x43')]['queuestatus'][_0x4443d8]){_0x491fee=this[_0x1989('0x43')][_0x1989('0x65')][_0x4443d8][_0x228ce2['actionid']];}if(!_0x491fee){this[_0x1989('0x43')]=initializeSummary();return;}var _0x127bb2=this[_0x1989('0x13')][_0x491fee[_0x1989('0x52')]];if(_0x127bb2[_0x1989('0x66')]==='inbound'){this['handleInboundQueueSummaryReport'](_0x127bb2,_0x491fee);}else if(_0x127bb2[_0x1989('0x66')]==='outbound'){var _0x9c260b=this[_0x1989('0x64')](_0x127bb2,_0x491fee);ami[_0x1989('0x4b')]('custom:queuesummary',_0x9c260b);}this[_0x1989('0x43')]['statusRequests']-=0x1;var _0xfcaf0e=this[_0x1989('0x43')][_0x1989('0x67')]>0x0?!![]:![];if(!_0xfcaf0e){return this[_0x1989('0x19')](this[_0x1989('0x43')][_0x1989('0x68')]);}};VoiceQueueReport[_0x1989('0x9')]['syncQueueMember']=function(_0x551544){var _0x56f820=this['summary']['id'];if(this[_0x1989('0x43')][_0x1989('0x65')][_0x56f820]&&this[_0x1989('0x43')][_0x1989('0x65')][_0x56f820][_0x551544[_0x1989('0x5e')]]){this[_0x1989('0x43')][_0x1989('0x65')][_0x56f820][_0x551544[_0x1989('0x5e')]][_0x1989('0x10')][_0x1989('0x69')](_0x551544);}};VoiceQueueReport[_0x1989('0x9')]['syncQueueSummary']=function(_0xd6b911){var _0x2dbce4=this;try{if(this[_0x1989('0x58')](_0xd6b911)&&this['isNotNull'](_0xd6b911[_0x1989('0x52')])){logger[_0x1989('0x47')](_0x1989('0x6a'),util[_0x1989('0x3f')](_0xd6b911,{'showHidden':![],'depth':null}));var _0x3255d9=this[_0x1989('0x13')][_0xd6b911[_0x1989('0x52')]];if(_0x3255d9){logger[_0x1989('0x47')](_0x1989('0x6b'),_0x3255d9['name']);this[_0x1989('0x43')][_0x1989('0x61')][_0x3255d9[_0x1989('0x56')]]={'summaryEvent':_0xd6b911};this[_0x1989('0x43')][_0x1989('0x67')]+=0x1;return ami[_0x1989('0x5a')]({'action':'queuestatus','queue':_0x3255d9[_0x1989('0x56')]})[_0x1989('0x5d')](function(_0x1e2a15){if(!_0x2dbce4[_0x1989('0x43')][_0x1989('0x65')][_0xd6b911[_0x1989('0x5e')]]){_0x2dbce4['summary']['queuestatus'][_0xd6b911[_0x1989('0x5e')]]={};}_0x2dbce4['summary'][_0x1989('0x65')][_0xd6b911[_0x1989('0x5e')]][_0x1e2a15[_0x1989('0x5e')]]={'queue':_0x3255d9['name'],'agents':[]};})['catch'](function(_0x23113f){throw _0x23113f;});}}}catch(_0x3db214){logger[_0x1989('0x3c')](_0x1989('0x60'),util[_0x1989('0x3f')](_0x3db214,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x1989('0x9')]['syncQueueSummaryComplete']=function(_0x56dc93){if(this[_0x1989('0x43')][_0x1989('0x67')]>0x0){this[_0x1989('0x43')][_0x1989('0x68')]=_0x56dc93;return;}logger['debug']('[voiceQueueReport][queuesummarycomplete]\x20event:',util[_0x1989('0x3f')](_0x56dc93,{'showHidden':![],'depth':null}));this['summary']=initializeSummary();ami[_0x1989('0x4b')](_0x1989('0x6c'),{});};VoiceQueueReport[_0x1989('0x9')][_0x1989('0x20')]=function(_0x2bf70d){try{if(this[_0x1989('0x58')](_0x2bf70d)){logger[_0x1989('0x47')](_0x1989('0x6d'),_0x2bf70d['uniqueid'],util[_0x1989('0x3f')](_0x2bf70d,{'showHidden':![],'depth':null}));if(_[_0x1989('0x59')](this[_0x1989('0xe')][_0x2bf70d[_0x1989('0x4a')]])){this[_0x1989('0xe')][_0x2bf70d['uniqueid']]=[];}if(_[_0x1989('0x59')](this['channels'][_0x2bf70d[_0x1989('0x4a')]])){this[_0x1989('0x11')][_0x2bf70d['uniqueid']]={};}var _0x2ba61e=new QueueReport();_0x2ba61e[_0x1989('0x52')]=_0x2bf70d['queue'];_0x2ba61e[_0x1989('0x66')]=this[_0x1989('0x13')][_0x2ba61e[_0x1989('0x52')]]&&this[_0x1989('0x13')][_0x2ba61e['queue']][_0x1989('0x66')]?this[_0x1989('0x13')][_0x2ba61e['queue']]['type']||_0x1989('0x6e'):_0x1989('0x6e');_0x2ba61e[_0x1989('0x6f')]=moment()[_0x1989('0x4c')](_0x1989('0x70'));_0x2ba61e[_0x1989('0x71')]=_0x2bf70d[_0x1989('0x71')];_0x2ba61e[_0x1989('0x72')]=_0x2bf70d[_0x1989('0x72')];_0x2ba61e['uniqueid']=_0x2bf70d[_0x1989('0x4a')];logger[_0x1989('0x73')]('[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s',_0x2ba61e[_0x1989('0x52')],_0x2ba61e[_0x1989('0x66')]);Object[_0x1989('0x74')](_0x2ba61e,_[_0x1989('0x75')](_0x2bf70d,_[_0x1989('0x76')](_0x2ba61e)));this[_0x1989('0xe')][_0x2bf70d[_0x1989('0x4a')]]['push'](_0x2ba61e);this[_0x1989('0x11')][_0x2bf70d[_0x1989('0x4a')]]=_0x2ba61e;this[_0x1989('0x46')](_0x2ba61e,_0x1989('0x1f'));}}catch(_0x1d2ab3){logger['error'](_0x1989('0x6d'),_0x2bf70d[_0x1989('0x4a')],util[_0x1989('0x3f')](_0x1d2ab3,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x1989('0x9')][_0x1989('0x22')]=function(_0x323815){try{if(this[_0x1989('0x58')](_0x323815)){logger[_0x1989('0x47')](_0x1989('0x77'),_0x323815[_0x1989('0x4a')],util['inspect'](_0x323815,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x323815['uniqueid']]){var _0x46ac54=_['last'](this['queueReports'][_0x323815['uniqueid']]);_0x46ac54[_0x1989('0x78')]=![];_0x46ac54[_0x1989('0x79')]=null;_0x46ac54[_0x1989('0x7a')]=_0x323815[_0x1989('0x7a')];_0x46ac54[_0x1989('0x7b')]=_0x323815[_0x1989('0x7b')];_0x46ac54[_0x1989('0x21')]=!![];_0x46ac54[_0x1989('0x7c')]=moment()[_0x1989('0x4c')](_0x1989('0x70'));_0x46ac54['queuecallerexitreason']='ABANDONED';_0x46ac54[_0x1989('0x7d')]=null;logger[_0x1989('0x73')](_0x1989('0x7e'),_0x46ac54[_0x1989('0x52')],_0x46ac54[_0x1989('0x66')]);this['channels'][_0x323815[_0x1989('0x4a')]]=_0x46ac54;this['emitVoiceQueueChannelRemove'](_0x46ac54,_0x1989('0x21'));}}}catch(_0xad025e){logger[_0x1989('0x3c')]('[%s][voiceQueueReport][queuecallerabandon]',_0x323815['uniqueid'],util[_0x1989('0x3f')](_0xad025e,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x1989('0x9')]['syncQueueCallerLeave']=function(_0x84687){try{if(this[_0x1989('0x58')](_0x84687)){logger[_0x1989('0x47')](_0x1989('0x7f'),_0x84687[_0x1989('0x4a')],util[_0x1989('0x3f')](_0x84687,{'showHidden':![],'depth':null}));if(this[_0x1989('0xe')][_0x84687[_0x1989('0x4a')]]){var _0x45738c=_['last'](this[_0x1989('0xe')][_0x84687[_0x1989('0x4a')]]);_0x45738c[_0x1989('0x80')]=moment()[_0x1989('0x4c')](_0x1989('0x70'));_0x45738c['connectedlinenum']=_0x84687[_0x1989('0x81')];_0x45738c['connectedlinename']=_0x84687[_0x1989('0x82')];logger['info'](_0x1989('0x83'),_0x45738c[_0x1989('0x52')],_0x45738c['type'],_0x84687[_0x1989('0x81')],_0x84687['connectedlinename']);this[_0x1989('0x11')][_0x84687[_0x1989('0x4a')]]=_0x45738c;this['emitVoiceQueueChannelSave'](_0x45738c,_0x1989('0x23'));}}}catch(_0x4f1044){logger['error'](_0x1989('0x7f'),_0x84687[_0x1989('0x4a')],util[_0x1989('0x3f')](_0x4f1044,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x1989('0x9')][_0x1989('0x28')]=function(_0x531044){try{if(this[_0x1989('0x58')](_0x531044)){logger[_0x1989('0x47')](_0x1989('0x84'),_0x531044[_0x1989('0x4a')],util[_0x1989('0x3f')](_0x531044,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x531044[_0x1989('0x4a')]]){var _0x21f4a5=_[_0x1989('0x85')](this[_0x1989('0xe')][_0x531044['uniqueid']]);_0x21f4a5[_0x1989('0x78')]=!![];_0x21f4a5[_0x1989('0x86')]=_0x1989('0x87');logger[_0x1989('0x73')]('[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT',_0x21f4a5[_0x1989('0x52')],_0x21f4a5[_0x1989('0x66')]);}}}catch(_0x5dd115){logger['error'](_0x1989('0x84'),_0x531044[_0x1989('0x4a')],util['inspect'](_0x5dd115,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x1989('0x9')][_0x1989('0x26')]=function(_0x4caf05){try{if(this[_0x1989('0x58')](_0x4caf05)){logger['debug'](_0x1989('0x88'),_0x4caf05['uniqueid'],util[_0x1989('0x3f')](_0x4caf05,{'showHidden':![],'depth':null}));if(this[_0x1989('0xe')][_0x4caf05[_0x1989('0x4a')]]){var _0x4b5c38=_[_0x1989('0x85')](this['queueReports'][_0x4caf05[_0x1989('0x4a')]]);_0x4b5c38[_0x1989('0x21')]=![];_0x4b5c38[_0x1989('0x7c')]=null;_0x4b5c38[_0x1989('0x89')]=!![];_0x4b5c38[_0x1989('0x7d')]=_0x4caf05[_0x1989('0x8a')];_0x4b5c38[_0x1989('0x7a')]=_0x4caf05['holdtime'];_0x4b5c38[_0x1989('0x78')]=!![];_0x4b5c38['queuecallerexit']=![];_0x4b5c38['queuecallerexitAt']=null;if(!_0x4b5c38[_0x1989('0x8b')]){if(_0x4caf05[_0x1989('0x8c')]==_0x1989('0x8b')){_0x4b5c38[_0x1989('0x86')]=_0x1989('0x8d');logger[_0x1989('0x73')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0x4b5c38[_0x1989('0x52')],_0x4b5c38[_0x1989('0x66')]);}else{if(_['startsWith'](_0x4caf05[_0x1989('0x8e')][_0x1989('0x8f')](),_0x1989('0x90'))){if(this[_0x1989('0xe')][_0x4caf05['linkedid']]){var _0x45f7ee=_[_0x1989('0x85')](this[_0x1989('0xe')][_0x4caf05['linkedid']]);_0x45f7ee[_0x1989('0x78')]=![];_0x45f7ee[_0x1989('0x91')]=!![];_0x45f7ee[_0x1989('0x92')]=moment(_0x4b5c38['queuecallerjoinAt'])[_0x1989('0x93')](_0x4caf05[_0x1989('0x7a')],_0x1989('0x94'))[_0x1989('0x4c')]('YYYY-MM-DD\x20HH:mm:ss');_0x45f7ee[_0x1989('0x86')]='FORWARDTRANSFER';_0x45f7ee['transfer']=!![];_0x45f7ee[_0x1989('0x95')]=_0x1989('0x96');_0x45f7ee[_0x1989('0x97')]=_0x4caf05[_0x1989('0x98')];_0x45f7ee[_0x1989('0x99')]=_0x4caf05['uniqueid'];logger[_0x1989('0x73')](_0x1989('0x9a'),_0x45f7ee[_0x1989('0x52')],_0x45f7ee[_0x1989('0x66')]);var _0x15c9e3=this[_0x1989('0xe')][_0x4caf05[_0x1989('0x9b')]];this[_0x1989('0xe')][_0x4caf05[_0x1989('0x9b')]]=this[_0x1989('0xe')][_0x4caf05['uniqueid']];this[_0x1989('0xe')][_0x4caf05['uniqueid']]=_0x15c9e3;}}else{_0x4b5c38[_0x1989('0x86')]='COMPLETEDBY'+_0x4caf05['reason'][_0x1989('0x9c')]();logger[_0x1989('0x73')](_0x1989('0x9d'),_0x4b5c38[_0x1989('0x52')],_0x4b5c38[_0x1989('0x66')],_0x4b5c38[_0x1989('0x86')]);}}}this[_0x1989('0x11')][_0x4caf05[_0x1989('0x4a')]]=_0x4b5c38;}}}catch(_0x2ff374){logger['error']('[%s][voiceQueueReport][agentcomplete]',_0x4caf05[_0x1989('0x4a')],util['inspect'](_0x2ff374,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x1989('0x9')][_0x1989('0x9e')]=function(_0x56f4ea){try{if(this[_0x1989('0x58')](_0x56f4ea)){logger[_0x1989('0x47')](_0x1989('0x9f'),_0x56f4ea[_0x1989('0x4a')],util['inspect'](_0x56f4ea,{'showHidden':![],'depth':null}));this[_0x1989('0xa0')](_0x56f4ea[_0x1989('0x4a')],_[_0x1989('0x76')](_0x56f4ea[_0x1989('0xa1')])[0x0],_0x56f4ea[_0x1989('0xa2')]);if(this[_0x1989('0xe')][_0x56f4ea[_0x1989('0x4a')]]){var _0x3011f3=_[_0x1989('0x85')](this['queueReports'][_0x56f4ea[_0x1989('0x4a')]]);if(_0x3011f3){if(this[_0x1989('0x58')](_0x56f4ea[_0x1989('0xa1')])&&this['isNotNull'](_0x56f4ea[_0x1989('0xa1')][_0x1989('0x65')])){switch(_0x56f4ea[_0x1989('0xa2')]){case'CONTINUE':_0x3011f3[_0x1989('0x91')]=![];_0x3011f3[_0x1989('0x92')]=null;break;case _0x1989('0xa3'):_0x3011f3[_0x1989('0xa4')]=_0x1989('0xa5');_0x3011f3['queuecallerexit']=!![];_0x3011f3[_0x1989('0x92')]=moment()['format'](_0x1989('0x70'));_0x3011f3[_0x1989('0x80')]=moment()[_0x1989('0x4c')](_0x1989('0x70'));logger[_0x1989('0x47')](_0x1989('0xa6'),_0x56f4ea[_0x1989('0x4a')],util[_0x1989('0x3f')](_0x3011f3,{'showHidden':![],'depth':null}));ami[_0x1989('0x4b')](_0x1989('0xa7'),_0x3011f3);break;default:_0x3011f3['queuecallerexit']=!![];_0x3011f3['queuecallerexitAt']=moment()[_0x1989('0x4c')](_0x1989('0x70'));_0x3011f3[_0x1989('0x80')]=moment()['format'](_0x1989('0x70'));}_0x3011f3[_0x1989('0x21')]=![];_0x3011f3[_0x1989('0x7c')]=null;_0x3011f3[_0x1989('0x86')]=_0x56f4ea[_0x1989('0xa2')];this[_0x1989('0x11')][_0x56f4ea[_0x1989('0x4a')]]=_0x3011f3;this['emitVoiceQueueChannelRemove'](_0x3011f3,_0x1989('0x29'));}else if(this[_0x1989('0x58')](_0x56f4ea[_0x1989('0xa1')])&&this[_0x1989('0x58')](_0x56f4ea[_0x1989('0xa1')]['queueposition'])){if(!_0x3011f3[_0x1989('0x21')]){_0x3011f3[_0x1989('0x91')]=!![];_0x3011f3[_0x1989('0x92')]=moment()[_0x1989('0x4c')](_0x1989('0x70'));_0x3011f3['queuecallerexitreason']=_0x1989('0xa8');_0x3011f3[_0x1989('0x80')]=moment()['format'](_0x1989('0x70'));this[_0x1989('0x11')][_0x56f4ea[_0x1989('0x4a')]]=_0x3011f3;}}logger[_0x1989('0x73')]('[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s',_0x56f4ea[_0x1989('0x4a')],_0x3011f3['queue'],_0x3011f3['type'],_[_0x1989('0x76')](_0x56f4ea[_0x1989('0xa1')])[0x0],_0x56f4ea[_0x1989('0xa2')]);_0x3011f3[_0x1989('0x15')]=this[_0x1989('0x15')][_0x56f4ea['uniqueid']];}}}}catch(_0x242034){logger[_0x1989('0x3c')](_0x1989('0x9f'),_0x56f4ea[_0x1989('0x4a')],util[_0x1989('0x3f')](_0x242034,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x1989('0x9')][_0x1989('0xa0')]=function(_0xd0446b,_0x1b8a35,_0xca9c0){var _0x54557a=[_0x1989('0xa9'),_0x1989('0xaa'),_0x1989('0xab'),_0x1989('0xac'),_0x1989('0xad'),_0x1989('0xae'),_0x1989('0xaf'),_0x1989('0xb0'),_0x1989('0xb1'),_0x1989('0xb2'),_0x1989('0xb3'),'bridgepvtcallid',_0x1989('0xb4'),'memberdynamic',_0x1989('0xb5'),_0x1989('0xb6'),_0x1989('0x8a'),_0x1989('0xb7'),_0x1989('0xb8')];if(!_['isNil'](_0x1b8a35)&&!_[_0x1989('0xb9')](_0x54557a,_0x1b8a35)){if(_[_0x1989('0x59')](this[_0x1989('0x15')][_0xd0446b])){this[_0x1989('0x15')][_0xd0446b]={};}this[_0x1989('0x15')][_0xd0446b][_0x1b8a35]=_0xca9c0;}};VoiceQueueReport[_0x1989('0x9')][_0x1989('0xba')]=function(_0xee0627,_0x198bbf,_0x20312b){try{var _0x11d501={};if(this['queueReports'][_0xee0627]){for(var _0x2f63ed=0x0;_0x2f63ed{delete this[_0x1989('0x11')][_0x449f90];},_0x38e410);}};module[_0x1989('0xf1')]=VoiceQueueReport; \ No newline at end of file diff --git a/server/services/ami/rpc/agentReportPreview.js b/server/services/ami/rpc/agentReportPreview.js index 3c9c808..85a2e14 100644 --- a/server/services/ami/rpc/agentReportPreview.js +++ b/server/services/ami/rpc/agentReportPreview.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6c99=['queue','../client','createHistory','campaign'];(function(_0x544512,_0x351ab0){var _0x14c0b1=function(_0x434a10){while(--_0x434a10){_0x544512['push'](_0x544512['shift']());}};_0x14c0b1(++_0x351ab0);}(_0x6c99,0x171));var _0x96c9=function(_0x3de7e0,_0x28cbff){_0x3de7e0=_0x3de7e0-0x0;var _0x11d0b3=_0x6c99[_0x3de7e0];return _0x11d0b3;};'use strict';var client=require(_0x96c9('0x0'));exports[_0x96c9('0x1')]=function(_0x2fb7bf){return function(){_0x2fb7bf[_0x96c9('0x2')]=_0x2fb7bf[_0x96c9('0x3')];return client['Request']('CreateReportAgentPreview',{'body':_0x2fb7bf,'log':'CreateReportAgentPreview'});};}; \ No newline at end of file +var _0xe7fc=['Request','CreateReportAgentPreview','createHistory'];(function(_0x29a015,_0x2094d2){var _0xa4be7b=function(_0x1c1a21){while(--_0x1c1a21){_0x29a015['push'](_0x29a015['shift']());}};_0xa4be7b(++_0x2094d2);}(_0xe7fc,0x1bb));var _0xce7f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe7fc[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports[_0xce7f('0x0')]=function(_0x260b4a){return function(){_0x260b4a['campaign']=_0x260b4a['queue'];return client[_0xce7f('0x1')](_0xce7f('0x2'),{'body':_0x260b4a,'log':_0xce7f('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/attachment.js b/server/services/ami/rpc/attachment.js index 32625ef..18f867e 100644 --- a/server/services/ami/rpc/attachment.js +++ b/server/services/ami/rpc/attachment.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5ec1=['../client','create','Request','CreateAttachment'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x5ec1,0xa4));var _0x15ec=function(_0xee3051,_0xbe4f18){_0xee3051=_0xee3051-0x0;var _0x139e81=_0x5ec1[_0xee3051];return _0x139e81;};'use strict';var client=require(_0x15ec('0x0'));exports[_0x15ec('0x1')]=function(_0x1f7e0f){return client[_0x15ec('0x2')](_0x15ec('0x3'),{'body':_0x1f7e0f,'log':_0x15ec('0x3')});}; \ No newline at end of file +var _0x6bdd=['Request','CreateAttachment','create'];(function(_0x70a3b0,_0x492553){var _0x3693e0=function(_0x596dc9){while(--_0x596dc9){_0x70a3b0['push'](_0x70a3b0['shift']());}};_0x3693e0(++_0x492553);}(_0x6bdd,0xe9));var _0xd6bd=function(_0x35c4b6,_0x3f462e){_0x35c4b6=_0x35c4b6-0x0;var _0x444f74=_0x6bdd[_0x35c4b6];return _0x444f74;};'use strict';var client=require('../client');exports[_0xd6bd('0x0')]=function(_0x1966c){return client[_0xd6bd('0x1')](_0xd6bd('0x2'),{'body':_0x1966c,'log':_0xd6bd('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/campaign.js b/server/services/ami/rpc/campaign.js index 9470980..2b8a1c5 100644 --- a/server/services/ami/rpc/campaign.js +++ b/server/services/ami/rpc/campaign.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialTimezone','dialGlobalInterval','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumWordLength','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','Trunk','active','TrunkBackup','Interval','Intervals','interval','SquareProject','getCampaign','../client','getCampaigns','Request','GetCampaign','name','type','limitCalls','dialOriginateCallerIdName','dialOriginateTimeout','dialCongestionMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry'];(function(_0x4c4037,_0x15054b){var _0x357862=function(_0x480015){while(--_0x480015){_0x4c4037['push'](_0x4c4037['shift']());}};_0x357862(++_0x15054b);}(_0x2ef3,0xba));var _0x32ef=function(_0x26e78a,_0x4b9031){_0x26e78a=_0x26e78a-0x0;var _0x20e970=_0x2ef3[_0x26e78a];return _0x20e970;};'use strict';var client=require(_0x32ef('0x0'));exports[_0x32ef('0x1')]=function(){return function(){return client[_0x32ef('0x2')](_0x32ef('0x3'),{'options':{'raw':![],'attributes':['id',_0x32ef('0x4'),_0x32ef('0x5'),'active',_0x32ef('0x6'),_0x32ef('0x7'),'dialOriginateCallerIdNumber',_0x32ef('0x8'),_0x32ef('0x9'),'dialCongestionRetryFrequency','dialBusyMaxRetry',_0x32ef('0xa'),_0x32ef('0xb'),_0x32ef('0xc'),_0x32ef('0xd'),_0x32ef('0xe'),_0x32ef('0xf'),_0x32ef('0x10'),_0x32ef('0x11'),_0x32ef('0x12'),_0x32ef('0x13'),'dialMachineMaxRetry','dialMachineRetryFrequency',_0x32ef('0x14'),_0x32ef('0x15'),_0x32ef('0x16'),_0x32ef('0x17'),'dialAMDActive',_0x32ef('0x18'),'dialAMDGreeting',_0x32ef('0x19'),'dialAMDTotalAnalysisTime',_0x32ef('0x1a'),_0x32ef('0x1b'),'dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold',_0x32ef('0x1c'),'dialOrderByScheduledAt',_0x32ef('0x1d'),_0x32ef('0x1e'),_0x32ef('0x1f')],'include':[{'model':_0x32ef('0x20'),'as':'Trunk','attributes':['id','name','callerid',_0x32ef('0x21')]},{'model':_0x32ef('0x20'),'as':_0x32ef('0x22'),'attributes':['id','name','callerid',_0x32ef('0x21')]},{'model':_0x32ef('0x23'),'as':_0x32ef('0x23'),'attributes':['id','name'],'include':[{'model':_0x32ef('0x23'),'as':_0x32ef('0x24'),'attributes':['id','name',_0x32ef('0x25')]}]},{'model':_0x32ef('0x26'),'as':_0x32ef('0x26'),'attributes':['id',_0x32ef('0x4')]}]},'log':_0x32ef('0x27')});};}; \ No newline at end of file +var _0xdb28=['dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','Trunk','name','callerid','Interval','interval','SquareProject','getCampaign','../client','getCampaigns','Request','GetCampaign','type','active','limitCalls','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','dialTimezone','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialOrderByScheduledAt'];(function(_0x345db7,_0x19fd44){var _0x5905e7=function(_0x4197e8){while(--_0x4197e8){_0x345db7['push'](_0x345db7['shift']());}};_0x5905e7(++_0x19fd44);}(_0xdb28,0x106));var _0x8db2=function(_0x198fec,_0x526196){_0x198fec=_0x198fec-0x0;var _0x5baa01=_0xdb28[_0x198fec];return _0x5baa01;};'use strict';var client=require(_0x8db2('0x0'));exports[_0x8db2('0x1')]=function(){return function(){return client[_0x8db2('0x2')](_0x8db2('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x8db2('0x4'),_0x8db2('0x5'),_0x8db2('0x6'),_0x8db2('0x7'),_0x8db2('0x8'),'dialOriginateTimeout',_0x8db2('0x9'),_0x8db2('0xa'),'dialBusyMaxRetry','dialBusyRetryFrequency',_0x8db2('0xb'),_0x8db2('0xc'),_0x8db2('0xd'),_0x8db2('0xe'),_0x8db2('0xf'),_0x8db2('0x10'),_0x8db2('0x11'),'dialAbandonedMaxRetry',_0x8db2('0x12'),_0x8db2('0x13'),_0x8db2('0x14'),'dialAgentRejectMaxRetry',_0x8db2('0x15'),_0x8db2('0x16'),'dialGlobalInterval',_0x8db2('0x17'),_0x8db2('0x18'),_0x8db2('0x19'),_0x8db2('0x1a'),_0x8db2('0x1b'),'dialAMDMinWordLength','dialAMDBetweenWordsSilence',_0x8db2('0x1c'),_0x8db2('0x1d'),_0x8db2('0x1e'),_0x8db2('0x1f'),_0x8db2('0x20'),_0x8db2('0x21'),_0x8db2('0x22')],'include':[{'model':_0x8db2('0x23'),'as':_0x8db2('0x23'),'attributes':['id',_0x8db2('0x24'),'callerid',_0x8db2('0x5')]},{'model':_0x8db2('0x23'),'as':'TrunkBackup','attributes':['id',_0x8db2('0x24'),_0x8db2('0x25'),_0x8db2('0x5')]},{'model':_0x8db2('0x26'),'as':_0x8db2('0x26'),'attributes':['id',_0x8db2('0x24')],'include':[{'model':'Interval','as':'Intervals','attributes':['id',_0x8db2('0x24'),_0x8db2('0x27')]}]},{'model':_0x8db2('0x28'),'as':_0x8db2('0x28'),'attributes':['id','name']}]},'log':_0x8db2('0x29')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmContact.js b/server/services/ami/rpc/cmContact.js index ebed859..185430b 100644 --- a/server/services/ami/rpc/cmContact.js +++ b/server/services/ami/rpc/cmContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x384d=['CreateCmContact','getContacts','GetCmContact','../client','createContact','Request'];(function(_0x45b89f,_0x1112f7){var _0xa2d3a6=function(_0x186d45){while(--_0x186d45){_0x45b89f['push'](_0x45b89f['shift']());}};_0xa2d3a6(++_0x1112f7);}(_0x384d,0xab));var _0xd384=function(_0x5efc69,_0x1d90fe){_0x5efc69=_0x5efc69-0x0;var _0xf44b79=_0x384d[_0x5efc69];return _0xf44b79;};'use strict';var client=require(_0xd384('0x0'));exports[_0xd384('0x1')]=function(_0x14acdf){return function(){return client[_0xd384('0x2')]('CreateCmContact',{'body':_0x14acdf,'log':_0xd384('0x3')});};};exports[_0xd384('0x4')]=function(_0x1b401d){return function(){return client[_0xd384('0x2')](_0xd384('0x5'),{'options':_0x1b401d,'log':'GetCmContact'});};}; \ No newline at end of file +var _0xb196=['createContact','Request','CreateCmContact','getContacts','GetCmContact','../client'];(function(_0x160ff7,_0x183a06){var _0x5bd99a=function(_0x4abeda){while(--_0x4abeda){_0x160ff7['push'](_0x160ff7['shift']());}};_0x5bd99a(++_0x183a06);}(_0xb196,0xb3));var _0x6b19=function(_0x38ec03,_0x1d957f){_0x38ec03=_0x38ec03-0x0;var _0x21cc41=_0xb196[_0x38ec03];return _0x21cc41;};'use strict';var client=require(_0x6b19('0x0'));exports[_0x6b19('0x1')]=function(_0x143503){return function(){return client[_0x6b19('0x2')](_0x6b19('0x3'),{'body':_0x143503,'log':_0x6b19('0x3')});};};exports[_0x6b19('0x4')]=function(_0x1233d8){return function(){return client['Request'](_0x6b19('0x5'),{'options':_0x1233d8,'log':'GetCmContact'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopper.js b/server/services/ami/rpc/cmHopper.js index ee2a720..936750b 100644 --- a/server/services/ami/rpc/cmHopper.js +++ b/server/services/ami/rpc/cmHopper.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6869=['Agent','voicePause','db.CmHopper.UserId','resetActiveCalls','ResetActiveCalls','handlePreviewRecallNotifications','../client','moment','getContacts','CmContact','Contact','getCmHopper','updateContacts','Request','UpdateCmHopper','rescheduleContact','ContactId','ListId','VoiceQueueId','CampaignId','DestroyCmHopper','getContactDialer','GetContactDialer','format','YYYY-MM-DD\x20HH:mm:ss','priority','DESC','scheduledat','getContactDialerIvr','ASC','GetContactDialerIvr','moveContactManagedDialer','campaign','queue','MoveContactManagedDialer','countReScheduled','CountReScheduled','getContactPreview','GetCmHopperPreview','name','VoiceQueue','Queue','unlockContact','User'];(function(_0x59e5cb,_0x2b209a){var _0x4e69c1=function(_0x5c77f5){while(--_0x5c77f5){_0x59e5cb['push'](_0x59e5cb['shift']());}};_0x4e69c1(++_0x2b209a);}(_0x6869,0xe2));var _0x9686=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x6869[_0x2f5ac5];return _0x37c9a8;};'use strict';var client=require(_0x9686('0x0'));var moment=require(_0x9686('0x1'));exports[_0x9686('0x2')]=function(_0x5d3664,_0x3b8c92){return function(){return client['Request']('GetCmHopper',{'options':{'where':{'VoiceQueueId':_0x5d3664},'include':[{'model':_0x9686('0x3'),'as':_0x9686('0x4')}],'limit':_0x3b8c92,'raw':![]},'log':_0x9686('0x5')});};};exports[_0x9686('0x6')]=function(_0x27412c,_0x4a0657,_0x35591e){return function(){return client[_0x9686('0x7')](_0x9686('0x8'),{'body':_0x27412c,'options':{'where':{'VoiceQueueId':_0x4a0657,'scheduledat':{'$lte':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}},'limit':_0x35591e},'log':_0x9686('0x8')});};};exports[_0x9686('0x9')]=function(_0x285148){return client[_0x9686('0x7')]('UpdateCmHopper',{'body':_0x285148,'options':{'where':{'ContactId':_0x285148[_0x9686('0xa')],'ListId':_0x285148[_0x9686('0xb')],'VoiceQueueId':_0x285148[_0x9686('0xc')],'CampaignId':_0x285148[_0x9686('0xd')]}},'log':_0x9686('0x9')});};exports['destroyContact']=function(_0x58d9b6,_0x5d5768,_0x2cb7c2){return function(){return client[_0x9686('0x7')](_0x9686('0xe'),{'options':{'where':{'VoiceQueueId':_0x58d9b6,'ListId':_0x5d5768,'ContactId':_0x2cb7c2}},'log':_0x9686('0xe')});};};exports[_0x9686('0xf')]=function(_0x152abf,_0x4b07d8,_0xd24b8f,_0x39ab7e){return client['Request'](_0x9686('0x10'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x152abf,'active':![],'scheduledat':{'$lte':moment()[_0x9686('0x11')](_0x9686('0x12'))},'$or':[{'UserId':null},{'UserId':{'$in':_0x4b07d8}}]},'order':[[_0x9686('0x13'),_0x9686('0x14')],[_0x9686('0x15'),_0x39ab7e],['id','ASC']],'raw':!![],'limit':_0xd24b8f},'log':_0x9686('0x10')});};exports[_0x9686('0x16')]=function(_0x33026f,_0x2b5301,_0x13b6fd){return client[_0x9686('0x7')](_0x9686('0x10'),{'body':{'active':!![]},'options':{'where':{'CampaignId':_0x33026f,'active':![],'scheduledat':{'$lte':moment()[_0x9686('0x11')](_0x9686('0x12'))}},'include':[{'model':'CmContact','as':_0x9686('0x4')}],'order':[[_0x9686('0x13'),_0x9686('0x14')],[_0x9686('0x15'),_0x13b6fd],['id',_0x9686('0x17')]],'raw':!![],'limit':_0x2b5301},'log':_0x9686('0x18')});};exports[_0x9686('0x19')]=function(_0x13f9da,_0x21a0fd){_0x13f9da[_0x9686('0x1a')]=_0x13f9da[_0x9686('0x1b')];return client['Request'](_0x9686('0x1c'),{'body':_0x13f9da,'options':{'where':{'ContactId':_0x13f9da['ContactId'],'ListId':_0x13f9da[_0x9686('0xb')],'VoiceQueueId':_0x13f9da[_0x9686('0xc')],'CampaignId':_0x13f9da[_0x9686('0xd')],'active':_0x21a0fd?undefined:!![]}},'log':_0x9686('0x1c')});};exports[_0x9686('0x1d')]=function(_0x4ec2a8){return client[_0x9686('0x7')](_0x9686('0x1e'),{'options':{'where':{'VoiceQueueId':_0x4ec2a8['id']?_0x4ec2a8['id']||null:null}},'log':_0x9686('0x1d')});};exports[_0x9686('0x1f')]=function(_0x160654){return function(){return client[_0x9686('0x7')](_0x9686('0x20'),{'options':{'where':{'id':_0x160654},'include':[{'model':_0x9686('0x3'),'as':'Contact'},{'model':'User','as':'Agent','attributes':['id',_0x9686('0x21')]},{'model':_0x9686('0x22'),'as':_0x9686('0x23'),'attributes':['id',_0x9686('0x21')]}],'raw':!![]},'log':_0x9686('0x5')});};};exports[_0x9686('0x24')]=function(_0x144c69,_0xe37630,_0x2e45e3){return client[_0x9686('0x7')](_0x9686('0x8'),{'body':_0x144c69,'options':{'where':{'id':_0xe37630},'limit':_0x2e45e3},'log':_0x9686('0x8')});};exports['getContactRecallMe']=function(_0x5b571c,_0x2533c1){return function(){return client['Request']('GetContactRecallMe',{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x5b571c,'active':![],'recallme':!![],'scheduledat':{'$lte':moment()[_0x9686('0x11')]('YYYY-MM-DD\x20HH:mm:ss')},'UserId':{'$in':_0x2533c1}},'order':[[_0x9686('0x13'),'DESC'],[_0x9686('0x15'),_0x9686('0x14')],['id',_0x9686('0x17')]],'include':[{'model':'CmContact','as':_0x9686('0x4')},{'model':_0x9686('0x25'),'as':_0x9686('0x26'),'attributes':['id','name',_0x9686('0x27')]}],'group':_0x9686('0x28'),'raw':!![]},'log':_0x9686('0x10')});};};exports[_0x9686('0x29')]=function(_0x30dec9,_0x4f4acd){return client[_0x9686('0x7')](_0x9686('0x2a'),{'body':_0x30dec9,'options':_0x4f4acd||{},'log':'ResetActiveCalls'});};exports[_0x9686('0x2b')]=function(_0x397f45,_0x2133fb,_0x3bd1ee){return function(){return client[_0x9686('0x7')]('CmHopperHandlePreviewRecallNotifications',{'body':{'where':{'voiceQueueIds':_0x397f45,'interval':_0x2133fb,'availableAgentsIds':_0x3bd1ee}},'log':_0x9686('0x2b')});};}; \ No newline at end of file +var _0xeecc=['unlockContact','getContactRecallMe','GetContactRecallMe','voicePause','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','handlePreviewRecallNotifications','../client','moment','getContacts','Request','getCmHopper','updateContacts','format','YYYY-MM-DD\x20HH:mm:ss','UpdateCmHopper','rescheduleContact','ListId','VoiceQueueId','CampaignId','destroyContact','DestroyCmHopper','DESC','scheduledat','ASC','GetContactDialer','getContactDialerIvr','CmContact','Contact','priority','GetContactDialerIvr','moveContactManagedDialer','queue','MoveContactManagedDialer','ContactId','countReScheduled','CountReScheduled','getContactPreview','User','Agent','name','VoiceQueue'];(function(_0x593d51,_0x183f01){var _0x3799ec=function(_0x3bd3be){while(--_0x3bd3be){_0x593d51['push'](_0x593d51['shift']());}};_0x3799ec(++_0x183f01);}(_0xeecc,0x12d));var _0xceec=function(_0x3e9182,_0x46e628){_0x3e9182=_0x3e9182-0x0;var _0x911bd2=_0xeecc[_0x3e9182];return _0x911bd2;};'use strict';var client=require(_0xceec('0x0'));var moment=require(_0xceec('0x1'));exports[_0xceec('0x2')]=function(_0x34d9cc,_0x4974bf){return function(){return client[_0xceec('0x3')]('GetCmHopper',{'options':{'where':{'VoiceQueueId':_0x34d9cc},'include':[{'model':'CmContact','as':'Contact'}],'limit':_0x4974bf,'raw':![]},'log':_0xceec('0x4')});};};exports[_0xceec('0x5')]=function(_0x3a2c0a,_0x2ae233,_0x5889fb){return function(){return client[_0xceec('0x3')]('UpdateCmHopper',{'body':_0x3a2c0a,'options':{'where':{'VoiceQueueId':_0x2ae233,'scheduledat':{'$lte':moment()[_0xceec('0x6')](_0xceec('0x7'))}},'limit':_0x5889fb},'log':_0xceec('0x8')});};};exports[_0xceec('0x9')]=function(_0x36c362){return client[_0xceec('0x3')](_0xceec('0x8'),{'body':_0x36c362,'options':{'where':{'ContactId':_0x36c362['ContactId'],'ListId':_0x36c362[_0xceec('0xa')],'VoiceQueueId':_0x36c362[_0xceec('0xb')],'CampaignId':_0x36c362[_0xceec('0xc')]}},'log':_0xceec('0x9')});};exports[_0xceec('0xd')]=function(_0x503795,_0x1fe218,_0x299583){return function(){return client[_0xceec('0x3')](_0xceec('0xe'),{'options':{'where':{'VoiceQueueId':_0x503795,'ListId':_0x1fe218,'ContactId':_0x299583}},'log':_0xceec('0xe')});};};exports['getContactDialer']=function(_0x2fa641,_0x5b8216,_0x1df290,_0x11b183){return client[_0xceec('0x3')]('GetContactDialer',{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x2fa641,'active':![],'scheduledat':{'$lte':moment()['format'](_0xceec('0x7'))},'$or':[{'UserId':null},{'UserId':{'$in':_0x5b8216}}]},'order':[['priority',_0xceec('0xf')],[_0xceec('0x10'),_0x11b183],['id',_0xceec('0x11')]],'raw':!![],'limit':_0x1df290},'log':_0xceec('0x12')});};exports[_0xceec('0x13')]=function(_0x3fea07,_0x4470a8,_0x1c8429){return client[_0xceec('0x3')](_0xceec('0x12'),{'body':{'active':!![]},'options':{'where':{'CampaignId':_0x3fea07,'active':![],'scheduledat':{'$lte':moment()[_0xceec('0x6')]('YYYY-MM-DD\x20HH:mm:ss')}},'include':[{'model':_0xceec('0x14'),'as':_0xceec('0x15')}],'order':[[_0xceec('0x16'),_0xceec('0xf')],[_0xceec('0x10'),_0x1c8429],['id',_0xceec('0x11')]],'raw':!![],'limit':_0x4470a8},'log':_0xceec('0x17')});};exports[_0xceec('0x18')]=function(_0x32778b,_0x134002){_0x32778b['campaign']=_0x32778b[_0xceec('0x19')];return client['Request'](_0xceec('0x1a'),{'body':_0x32778b,'options':{'where':{'ContactId':_0x32778b[_0xceec('0x1b')],'ListId':_0x32778b['ListId'],'VoiceQueueId':_0x32778b[_0xceec('0xb')],'CampaignId':_0x32778b['CampaignId'],'active':_0x134002?undefined:!![]}},'log':_0xceec('0x1a')});};exports[_0xceec('0x1c')]=function(_0x3600cb){return client[_0xceec('0x3')](_0xceec('0x1d'),{'options':{'where':{'VoiceQueueId':_0x3600cb['id']?_0x3600cb['id']||null:null}},'log':_0xceec('0x1c')});};exports[_0xceec('0x1e')]=function(_0x505b99){return function(){return client[_0xceec('0x3')]('GetCmHopperPreview',{'options':{'where':{'id':_0x505b99},'include':[{'model':_0xceec('0x14'),'as':_0xceec('0x15')},{'model':_0xceec('0x1f'),'as':_0xceec('0x20'),'attributes':['id',_0xceec('0x21')]},{'model':_0xceec('0x22'),'as':'Queue','attributes':['id',_0xceec('0x21')]}],'raw':!![]},'log':'getCmHopper'});};};exports[_0xceec('0x23')]=function(_0x3b3923,_0x3cb421,_0x1c991c){return client[_0xceec('0x3')](_0xceec('0x8'),{'body':_0x3b3923,'options':{'where':{'id':_0x3cb421},'limit':_0x1c991c},'log':_0xceec('0x8')});};exports[_0xceec('0x24')]=function(_0x475910,_0x500050){return function(){return client[_0xceec('0x3')](_0xceec('0x25'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x475910,'active':![],'recallme':!![],'scheduledat':{'$lte':moment()[_0xceec('0x6')](_0xceec('0x7'))},'UserId':{'$in':_0x500050}},'order':[[_0xceec('0x16'),_0xceec('0xf')],[_0xceec('0x10'),_0xceec('0xf')],['id','ASC']],'include':[{'model':_0xceec('0x14'),'as':_0xceec('0x15')},{'model':_0xceec('0x1f'),'as':'Agent','attributes':['id','name',_0xceec('0x26')]}],'group':'db.CmHopper.UserId','raw':!![]},'log':_0xceec('0x12')});};};exports['resetActiveCalls']=function(_0x30949c,_0x2c93ce){return client[_0xceec('0x3')](_0xceec('0x27'),{'body':_0x30949c,'options':_0x2c93ce||{},'log':'ResetActiveCalls'});};exports['handlePreviewRecallNotifications']=function(_0x45f412,_0x452caf,_0x561893){return function(){return client['Request'](_0xceec('0x28'),{'body':{'where':{'voiceQueueIds':_0x45f412,'interval':_0x452caf,'availableAgentsIds':_0x561893}},'log':_0xceec('0x29')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperAdditionalPhone.js b/server/services/ami/rpc/cmHopperAdditionalPhone.js index 443498d..2d1cdef 100644 --- a/server/services/ami/rpc/cmHopperAdditionalPhone.js +++ b/server/services/ami/rpc/cmHopperAdditionalPhone.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x75aa=['../client','verifyAdditionalPhones','VerifyAdditionalPhones','swapAdditionalPhones','Request','SwapAdditionalPhones','IncrementPreviewCounters'];(function(_0x325b65,_0x745ac3){var _0x53dfb6=function(_0x654a54){while(--_0x654a54){_0x325b65['push'](_0x325b65['shift']());}};_0x53dfb6(++_0x745ac3);}(_0x75aa,0x103));var _0xa75a=function(_0x393e45,_0x2b0b05){_0x393e45=_0x393e45-0x0;var _0x24c7a9=_0x75aa[_0x393e45];return _0x24c7a9;};'use strict';var client=require(_0xa75a('0x0'));exports[_0xa75a('0x1')]=function(_0x20b0e3,_0x39f4f2,_0x5894da){return client['Request'](_0xa75a('0x2'),{'body':_0x20b0e3,'reason':_0x39f4f2,'entity':_0x5894da,'log':_0xa75a('0x2')});};exports[_0xa75a('0x3')]=function(_0xf594d2,_0x5a906f,_0x21fe9b){return client[_0xa75a('0x4')](_0xa75a('0x5'),{'body':_0xf594d2,'duration':_0x5a906f,'waitTime':_0x21fe9b,'log':_0xa75a('0x5')});};exports['incrementPreviewCounters']=function(_0x4b83bf){return function(){return client[_0xa75a('0x4')](_0xa75a('0x6'),{'body':_0x4b83bf,'log':_0xa75a('0x6')});};}; \ No newline at end of file +var _0x7929=['VerifyAdditionalPhones','swapAdditionalPhones','SwapAdditionalPhones','incrementPreviewCounters','IncrementPreviewCounters','../client','verifyAdditionalPhones','Request'];(function(_0x44e150,_0x186030){var _0x49b251=function(_0x8faa5){while(--_0x8faa5){_0x44e150['push'](_0x44e150['shift']());}};_0x49b251(++_0x186030);}(_0x7929,0x12d));var _0x9792=function(_0x533e4e,_0x4eba54){_0x533e4e=_0x533e4e-0x0;var _0x1f14bb=_0x7929[_0x533e4e];return _0x1f14bb;};'use strict';var client=require(_0x9792('0x0'));exports[_0x9792('0x1')]=function(_0x78a313,_0x1bcd48,_0x30f2c2){return client[_0x9792('0x2')](_0x9792('0x3'),{'body':_0x78a313,'reason':_0x1bcd48,'entity':_0x30f2c2,'log':_0x9792('0x3')});};exports[_0x9792('0x4')]=function(_0x1958b1,_0x24439a,_0x50048d){return client[_0x9792('0x2')](_0x9792('0x5'),{'body':_0x1958b1,'duration':_0x24439a,'waitTime':_0x50048d,'log':_0x9792('0x5')});};exports[_0x9792('0x6')]=function(_0x3b6106){return function(){return client[_0x9792('0x2')](_0x9792('0x7'),{'body':_0x3b6106,'log':_0x9792('0x7')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperBlack.js b/server/services/ami/rpc/cmHopperBlack.js index 29c3ef6..89cb7ad 100644 --- a/server/services/ami/rpc/cmHopperBlack.js +++ b/server/services/ami/rpc/cmHopperBlack.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x694b=['GetCmHopperBlackIvr','../client','Request','GetCmHopperBlack','VoiceQueueId','phone','checkIsBlackListIvr','CampaignId'];(function(_0xc67212,_0x3fee2f){var _0x33e7e9=function(_0x40d675){while(--_0x40d675){_0xc67212['push'](_0xc67212['shift']());}};_0x33e7e9(++_0x3fee2f);}(_0x694b,0x119));var _0xb694=function(_0x3477f7,_0x56a2bc){_0x3477f7=_0x3477f7-0x0;var _0x2657bc=_0x694b[_0x3477f7];return _0x2657bc;};'use strict';var client=require(_0xb694('0x0'));exports['checkIsBlackList']=function(_0x55d28a){return client[_0xb694('0x1')](_0xb694('0x2'),{'options':{'where':{'VoiceQueueId':_0x55d28a[_0xb694('0x3')],'phone':_0x55d28a[_0xb694('0x4')]},'raw':![]},'log':_0xb694('0x2')});};exports[_0xb694('0x5')]=function(_0x5527a6){return client[_0xb694('0x1')](_0xb694('0x2'),{'options':{'where':{'CampaignId':_0x5527a6[_0xb694('0x6')],'phone':_0x5527a6['phone']},'raw':![]},'log':_0xb694('0x7')});}; \ No newline at end of file +var _0xaaa6=['../client','checkIsBlackList','Request','VoiceQueueId','phone','GetCmHopperBlack','checkIsBlackListIvr','CampaignId','GetCmHopperBlackIvr'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaaa6,0xc6));var _0x6aaa=function(_0x5c989c,_0x325ddb){_0x5c989c=_0x5c989c-0x0;var _0x4ad1e9=_0xaaa6[_0x5c989c];return _0x4ad1e9;};'use strict';var client=require(_0x6aaa('0x0'));exports[_0x6aaa('0x1')]=function(_0x3755b3){return client[_0x6aaa('0x2')]('GetCmHopperBlack',{'options':{'where':{'VoiceQueueId':_0x3755b3[_0x6aaa('0x3')],'phone':_0x3755b3[_0x6aaa('0x4')]},'raw':![]},'log':_0x6aaa('0x5')});};exports[_0x6aaa('0x6')]=function(_0x477bd6){return client[_0x6aaa('0x2')](_0x6aaa('0x5'),{'options':{'where':{'CampaignId':_0x477bd6[_0x6aaa('0x7')],'phone':_0x477bd6[_0x6aaa('0x4')]},'raw':![]},'log':_0x6aaa('0x8')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperFinal.js b/server/services/ami/rpc/cmHopperFinal.js index 2dc1314..f528cb0 100644 --- a/server/services/ami/rpc/cmHopperFinal.js +++ b/server/services/ami/rpc/cmHopperFinal.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x03d2=['Request','CreateCmHopperFinal','campaign'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x03d2,0x131));var _0x203d=function(_0x3a77b5,_0x21d2b2){_0x3a77b5=_0x3a77b5-0x0;var _0x4ba99e=_0x03d2[_0x3a77b5];return _0x4ba99e;};'use strict';var client=require('../client');exports['createContact']=function(_0x10c878){return function(){_0x10c878[_0x203d('0x0')]=_0x10c878['queue'];return client[_0x203d('0x1')](_0x203d('0x2'),{'body':_0x10c878,'log':_0x203d('0x2')});};}; \ No newline at end of file +var _0x38c1=['createContact','campaign','CreateCmHopperFinal','../client'];(function(_0x4a0bed,_0x3b3632){var _0x31b319=function(_0x1d0d33){while(--_0x1d0d33){_0x4a0bed['push'](_0x4a0bed['shift']());}};_0x31b319(++_0x3b3632);}(_0x38c1,0x16b));var _0x138c=function(_0x584308,_0x1379b3){_0x584308=_0x584308-0x0;var _0x45865b=_0x38c1[_0x584308];return _0x45865b;};'use strict';var client=require(_0x138c('0x0'));exports[_0x138c('0x1')]=function(_0x4d1a6b){return function(){_0x4d1a6b[_0x138c('0x2')]=_0x4d1a6b['queue'];return client['Request']('CreateCmHopperFinal',{'body':_0x4d1a6b,'log':_0x138c('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperHistory.js b/server/services/ami/rpc/cmHopperHistory.js index b82b778..c77bfb3 100644 --- a/server/services/ami/rpc/cmHopperHistory.js +++ b/server/services/ami/rpc/cmHopperHistory.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x71b6=['format','YYYY-MM-DD\x20HH:mm:ss','GetCmHopperHistory','getVoiceQueueHopperHistory','GetVoiceQueueHopperHistory','day','endOf','GetCampaignHopperHistory','ivr','../client','createHistory','queue','Request','CreateCmHopperHistory','AvgHandleTime','minutes'];(function(_0x2fea40,_0x59c8cf){var _0x14a53d=function(_0xe0b263){while(--_0xe0b263){_0x2fea40['push'](_0x2fea40['shift']());}};_0x14a53d(++_0x59c8cf);}(_0x71b6,0xc9));var _0x671b=function(_0xaa6a54,_0x501b52){_0xaa6a54=_0xaa6a54-0x0;var _0x4edf6e=_0x71b6[_0xaa6a54];return _0x4edf6e;};'use strict';var client=require(_0x671b('0x0'));var moment=require('moment');exports[_0x671b('0x1')]=function(_0x1f0c04){_0x1f0c04['campaign']=_0x1f0c04[_0x671b('0x2')];return client[_0x671b('0x3')]('CreateCmHopperHistory',{'body':_0x1f0c04,'log':_0x671b('0x4')});};exports['avgHandleTime']=function(_0x55d783){return client[_0x671b('0x3')](_0x671b('0x5'),{'options':{'where':{'endtime':{'$between':[moment()['subtract'](_0x55d783,_0x671b('0x6'))[_0x671b('0x7')](_0x671b('0x8')),moment()[_0x671b('0x7')](_0x671b('0x8'))]}},'raw':![]},'log':_0x671b('0x9')});};exports[_0x671b('0xa')]=function(){return function(){return client[_0x671b('0x3')](_0x671b('0xb'),{'options':{'where':{'createdAt':{'$between':[moment()['startOf'](_0x671b('0xc'))[_0x671b('0x7')](_0x671b('0x8')),moment()[_0x671b('0xd')](_0x671b('0xc'))[_0x671b('0x7')](_0x671b('0x8'))]},'campaigntype':'queue'},'raw':![]},'log':_0x671b('0xb')});};};exports['getCampaignHopperHistory']=function(){return function(){return client[_0x671b('0x3')](_0x671b('0xe'),{'options':{'where':{'createdAt':{'$between':[moment()['startOf'](_0x671b('0xc'))[_0x671b('0x7')]('YYYY-MM-DD\x20HH:mm:ss'),moment()['endOf'](_0x671b('0xc'))[_0x671b('0x7')](_0x671b('0x8'))]},'campaigntype':_0x671b('0xf')},'raw':![]},'log':_0x671b('0xe')});};}; \ No newline at end of file +var _0xbf48=['startOf','day','endOf','ivr','../client','campaign','queue','Request','AvgHandleTime','subtract','minutes','format','YYYY-MM-DD\x20HH:mm:ss','getVoiceQueueHopperHistory','GetVoiceQueueHopperHistory'];(function(_0x27f0e9,_0x246ce6){var _0x5a9dac=function(_0x12d69a){while(--_0x12d69a){_0x27f0e9['push'](_0x27f0e9['shift']());}};_0x5a9dac(++_0x246ce6);}(_0xbf48,0x1c6));var _0x8bf4=function(_0x1050cd,_0x53a416){_0x1050cd=_0x1050cd-0x0;var _0x3f7e11=_0xbf48[_0x1050cd];return _0x3f7e11;};'use strict';var client=require(_0x8bf4('0x0'));var moment=require('moment');exports['createHistory']=function(_0x249276){_0x249276[_0x8bf4('0x1')]=_0x249276[_0x8bf4('0x2')];return client[_0x8bf4('0x3')]('CreateCmHopperHistory',{'body':_0x249276,'log':'CreateCmHopperHistory'});};exports['avgHandleTime']=function(_0x4dc9e9){return client[_0x8bf4('0x3')](_0x8bf4('0x4'),{'options':{'where':{'endtime':{'$between':[moment()[_0x8bf4('0x5')](_0x4dc9e9,_0x8bf4('0x6'))[_0x8bf4('0x7')]('YYYY-MM-DD\x20HH:mm:ss'),moment()['format'](_0x8bf4('0x8'))]}},'raw':![]},'log':'GetCmHopperHistory'});};exports[_0x8bf4('0x9')]=function(){return function(){return client[_0x8bf4('0x3')](_0x8bf4('0xa'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x8bf4('0xb')](_0x8bf4('0xc'))[_0x8bf4('0x7')](_0x8bf4('0x8')),moment()[_0x8bf4('0xd')](_0x8bf4('0xc'))[_0x8bf4('0x7')](_0x8bf4('0x8'))]},'campaigntype':_0x8bf4('0x2')},'raw':![]},'log':_0x8bf4('0xa')});};};exports['getCampaignHopperHistory']=function(){return function(){return client['Request']('GetCampaignHopperHistory',{'options':{'where':{'createdAt':{'$between':[moment()[_0x8bf4('0xb')](_0x8bf4('0xc'))[_0x8bf4('0x7')](_0x8bf4('0x8')),moment()['endOf'](_0x8bf4('0xc'))[_0x8bf4('0x7')](_0x8bf4('0x8'))]},'campaigntype':_0x8bf4('0xe')},'raw':![]},'log':'GetCampaignHopperHistory'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/faxAccount.js b/server/services/ami/rpc/faxAccount.js index 9a5d7eb..715b985 100644 --- a/server/services/ami/rpc/faxAccount.js +++ b/server/services/ami/rpc/faxAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x02a7=['name','description','ecm','headerinfo','localstationid','minrate','maxrate','faxdetect','tech','TrunkId','callerid','getFaxAccount','notify','NotifyFaxAccount','getFaxAccounts','Request','GetFaxAccount'];(function(_0x43dfd9,_0x4521a5){var _0x4281f7=function(_0x2e011c){while(--_0x2e011c){_0x43dfd9['push'](_0x43dfd9['shift']());}};_0x4281f7(++_0x4521a5);}(_0x02a7,0x1a6));var _0x702a=function(_0x3f3d82,_0x6f4e8f){_0x3f3d82=_0x3f3d82-0x0;var _0x16bd2e=_0x02a7[_0x3f3d82];return _0x16bd2e;};'use strict';var client=require('../client');exports[_0x702a('0x0')]=function(){return function(){return client[_0x702a('0x1')](_0x702a('0x2'),{'options':{'raw':![],'attributes':['id',_0x702a('0x3'),_0x702a('0x4'),_0x702a('0x5'),_0x702a('0x6'),_0x702a('0x7'),_0x702a('0x8'),_0x702a('0x9'),'modem','gateway',_0x702a('0xa'),'t38timeout',_0x702a('0xb'),_0x702a('0xc'),'ListId','key'],'include':[{'model':'Trunk','as':'Trunk','attributes':['id',_0x702a('0x3'),_0x702a('0xd'),'active']}]},'log':_0x702a('0xe')});};};exports[_0x702a('0xf')]=function(_0xebee92,_0x25920c){return client[_0x702a('0x1')](_0x702a('0x10'),{'account':{'id':_0xebee92},'body':_0x25920c,'log':_0x702a('0x10')});}; \ No newline at end of file +var _0x8768=['headerinfo','localstationid','minrate','maxrate','modem','gateway','t38timeout','tech','TrunkId','ListId','key','callerid','notify','NotifyFaxAccount','../client','getFaxAccounts','Request','GetFaxAccount','name','description','ecm'];(function(_0x336c8f,_0x181804){var _0x5b3abd=function(_0xa24276){while(--_0xa24276){_0x336c8f['push'](_0x336c8f['shift']());}};_0x5b3abd(++_0x181804);}(_0x8768,0xa1));var _0x8876=function(_0x59a1ce,_0x24ff0d){_0x59a1ce=_0x59a1ce-0x0;var _0xdb29dd=_0x8768[_0x59a1ce];return _0xdb29dd;};'use strict';var client=require(_0x8876('0x0'));exports[_0x8876('0x1')]=function(){return function(){return client[_0x8876('0x2')](_0x8876('0x3'),{'options':{'raw':![],'attributes':['id',_0x8876('0x4'),_0x8876('0x5'),_0x8876('0x6'),_0x8876('0x7'),_0x8876('0x8'),_0x8876('0x9'),_0x8876('0xa'),_0x8876('0xb'),_0x8876('0xc'),'faxdetect',_0x8876('0xd'),_0x8876('0xe'),_0x8876('0xf'),_0x8876('0x10'),_0x8876('0x11')],'include':[{'model':'Trunk','as':'Trunk','attributes':['id',_0x8876('0x4'),_0x8876('0x12'),'active']}]},'log':'getFaxAccount'});};};exports[_0x8876('0x13')]=function(_0x20fe1e,_0x477cf9){return client[_0x8876('0x2')](_0x8876('0x14'),{'account':{'id':_0x20fe1e},'body':_0x477cf9,'log':_0x8876('0x14')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/faxMessage.js b/server/services/ami/rpc/faxMessage.js index d5a7017..d70ebb1 100644 --- a/server/services/ami/rpc/faxMessage.js +++ b/server/services/ami/rpc/faxMessage.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaf70=['UpdateFaxMessage','../client','update'];(function(_0x36ec99,_0x8d75da){var _0x4db975=function(_0x2a4441){while(--_0x2a4441){_0x36ec99['push'](_0x36ec99['shift']());}};_0x4db975(++_0x8d75da);}(_0xaf70,0x13f));var _0x0af7=function(_0xc7602e,_0x3f1247){_0xc7602e=_0xc7602e-0x0;var _0x151f45=_0xaf70[_0xc7602e];return _0x151f45;};'use strict';var client=require(_0x0af7('0x0'));exports[_0x0af7('0x1')]=function(_0x4371d5,_0x5454b9){return client['Request']('UpdateFaxMessage',{'body':_0x5454b9,'options':{'where':{'AttachmentId':_0x4371d5}},'log':_0x0af7('0x2')});}; \ No newline at end of file +var _0xf88f=['../client','update','Request','UpdateFaxMessage'];(function(_0x332ce2,_0x57c600){var _0x11bf58=function(_0x3d5c72){while(--_0x3d5c72){_0x332ce2['push'](_0x332ce2['shift']());}};_0x11bf58(++_0x57c600);}(_0xf88f,0xc0));var _0xff88=function(_0x5d8cec,_0x5c555e){_0x5d8cec=_0x5d8cec-0x0;var _0x37e0d6=_0xf88f[_0x5d8cec];return _0x37e0d6;};'use strict';var client=require(_0xff88('0x0'));exports[_0xff88('0x1')]=function(_0x43728f,_0x331911){return client[_0xff88('0x2')]('UpdateFaxMessage',{'body':_0x331911,'options':{'where':{'AttachmentId':_0x43728f}},'log':_0xff88('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/desk.js b/server/services/ami/rpc/integrations/desk.js index c366073..7ab830a 100644 --- a/server/services/ami/rpc/integrations/desk.js +++ b/server/services/ami/rpc/integrations/desk.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x32d0=['DeskConfiguration','name','DeskField','Subjects','variableName','Variable','Descriptions','content','keyType','keyContent','Fields','nameField','customField','Tag','Request','description','username','password','remoteUri','authType','type','serverUrl'];(function(_0x32c305,_0x5378eb){var _0x39ecaa=function(_0x1264a5){while(--_0x1264a5){_0x32c305['push'](_0x32c305['shift']());}};_0x39ecaa(++_0x5378eb);}(_0x32d0,0x1f2));var _0x032d=function(_0x3ccffd,_0x525c43){_0x3ccffd=_0x3ccffd-0x0;var _0x3398fc=_0x32d0[_0x3ccffd];return _0x3398fc;};'use strict';var client=require('../../client');exports['getDeskAccounts']=function(){return function(_0x21ec85){return client[_0x032d('0x0')]('GetDeskAccount',{'options':{'raw':![],'attributes':['id','name',_0x032d('0x1'),_0x032d('0x2'),_0x032d('0x3'),_0x032d('0x4'),_0x032d('0x5'),_0x032d('0x6'),_0x032d('0x7')],'include':[{'model':_0x032d('0x8'),'as':'Configurations','attributes':['id',_0x032d('0x9')],'include':[{'model':_0x032d('0xa'),'as':_0x032d('0xb'),'attributes':['id','type','content',_0x032d('0xc')],'include':[{'model':_0x032d('0xd'),'as':_0x032d('0xd'),'attributes':['id','name']}]},{'model':_0x032d('0xa'),'as':_0x032d('0xe'),'attributes':['id','type',_0x032d('0xf'),'key',_0x032d('0x10'),_0x032d('0x11'),_0x032d('0xc')],'include':[{'model':'Variable','as':_0x032d('0xd'),'attributes':['id',_0x032d('0x9')]}]},{'model':_0x032d('0xa'),'as':_0x032d('0x12'),'attributes':['id',_0x032d('0x6'),_0x032d('0xf'),'idField',_0x032d('0x13'),_0x032d('0x14'),_0x032d('0xc')],'include':[{'model':_0x032d('0xd'),'as':_0x032d('0xd'),'attributes':['id',_0x032d('0x9')]}]},{'model':_0x032d('0x15'),'as':'Tags','attributes':['id','name']}]}]},'log':'GetDeskAccount'});};}; \ No newline at end of file +var _0x267f=['Descriptions','key','keyContent','Fields','nameField','customField','../../client','getDeskAccounts','Request','GetDeskAccount','name','description','username','password','remoteUri','authType','type','DeskConfiguration','Configurations','Subjects','content','variableName','Variable','DeskField'];(function(_0x26deb2,_0x217bdd){var _0xa85d20=function(_0x369c4f){while(--_0x369c4f){_0x26deb2['push'](_0x26deb2['shift']());}};_0xa85d20(++_0x217bdd);}(_0x267f,0xf6));var _0xf267=function(_0x592f8a,_0x14aac4){_0x592f8a=_0x592f8a-0x0;var _0xbf30dd=_0x267f[_0x592f8a];return _0xbf30dd;};'use strict';var client=require(_0xf267('0x0'));exports[_0xf267('0x1')]=function(){return function(_0x41fbe9){return client[_0xf267('0x2')](_0xf267('0x3'),{'options':{'raw':![],'attributes':['id',_0xf267('0x4'),_0xf267('0x5'),_0xf267('0x6'),_0xf267('0x7'),_0xf267('0x8'),_0xf267('0x9'),_0xf267('0xa'),'serverUrl'],'include':[{'model':_0xf267('0xb'),'as':_0xf267('0xc'),'attributes':['id','name'],'include':[{'model':'DeskField','as':_0xf267('0xd'),'attributes':['id',_0xf267('0xa'),_0xf267('0xe'),_0xf267('0xf')],'include':[{'model':_0xf267('0x10'),'as':_0xf267('0x10'),'attributes':['id',_0xf267('0x4')]}]},{'model':_0xf267('0x11'),'as':_0xf267('0x12'),'attributes':['id',_0xf267('0xa'),_0xf267('0xe'),_0xf267('0x13'),'keyType',_0xf267('0x14'),'variableName'],'include':[{'model':_0xf267('0x10'),'as':_0xf267('0x10'),'attributes':['id',_0xf267('0x4')]}]},{'model':_0xf267('0x11'),'as':_0xf267('0x15'),'attributes':['id',_0xf267('0xa'),_0xf267('0xe'),'idField',_0xf267('0x16'),_0xf267('0x17'),'variableName'],'include':[{'model':'Variable','as':_0xf267('0x10'),'attributes':['id','name']}]},{'model':'Tag','as':'Tags','attributes':['id',_0xf267('0x4')]}]}]},'log':_0xf267('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/dynamics365.js b/server/services/ami/rpc/integrations/dynamics365.js index f104833..24fd22c 100644 --- a/server/services/ami/rpc/integrations/dynamics365.js +++ b/server/services/ami/rpc/integrations/dynamics365.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0bb4=['description','Dynamics365Configuration','Configurations','ticketType','additionalSearchContact','openNewTab','Dynamics365Field','Subjects','type','content','variableName','Variable','Descriptions','key','keyType','keyContent','Fields','idField','nameField','CloudProvider','data2','data5','data7','../../client','getDynamics365Accounts','Request','GetDynamics365Account','name','username','remoteUri','clientId','serverUrl'];(function(_0x547e20,_0x284545){var _0x359171=function(_0x590250){while(--_0x590250){_0x547e20['push'](_0x547e20['shift']());}};_0x359171(++_0x284545);}(_0x0bb4,0x77));var _0x40bb=function(_0x2a166a,_0xf7981a){_0x2a166a=_0x2a166a-0x0;var _0x1f1ebe=_0x0bb4[_0x2a166a];return _0x1f1ebe;};'use strict';var client=require(_0x40bb('0x0'));exports[_0x40bb('0x1')]=function(){return function(_0x4c9712){return client[_0x40bb('0x2')](_0x40bb('0x3'),{'options':{'raw':![],'attributes':['id',_0x40bb('0x4'),_0x40bb('0x5'),'password',_0x40bb('0x6'),'tenantId',_0x40bb('0x7'),'clientSecret',_0x40bb('0x8'),_0x40bb('0x9'),'modernAuthentication'],'include':[{'model':_0x40bb('0xa'),'as':_0x40bb('0xb'),'attributes':['id','name',_0x40bb('0xc'),'moduleCreate',_0x40bb('0xd'),_0x40bb('0xe')],'include':[{'model':_0x40bb('0xf'),'as':_0x40bb('0x10'),'attributes':['id',_0x40bb('0x11'),_0x40bb('0x12'),_0x40bb('0x13')],'include':[{'model':_0x40bb('0x14'),'as':_0x40bb('0x14'),'attributes':['id',_0x40bb('0x4')]}]},{'model':_0x40bb('0xf'),'as':_0x40bb('0x15'),'attributes':['id',_0x40bb('0x11'),_0x40bb('0x12'),_0x40bb('0x16'),_0x40bb('0x17'),_0x40bb('0x18'),'variableName'],'include':[{'model':'Variable','as':_0x40bb('0x14'),'attributes':['id',_0x40bb('0x4')]}]},{'model':_0x40bb('0xf'),'as':_0x40bb('0x19'),'attributes':['id',_0x40bb('0x11'),_0x40bb('0x12'),_0x40bb('0x1a'),_0x40bb('0x1b'),'customField',_0x40bb('0x13')],'include':[{'model':_0x40bb('0x14'),'as':_0x40bb('0x14'),'attributes':['id',_0x40bb('0x4')]}]}]},{'model':_0x40bb('0x1c'),'as':'CloudProvider','attributes':['id',_0x40bb('0x1d'),_0x40bb('0x1e'),_0x40bb('0x1f')]}]},'log':_0x40bb('0x3')});};}; \ No newline at end of file +var _0x0598=['ticketType','openNewTab','Dynamics365Field','Subjects','type','content','Variable','key','keyType','keyContent','variableName','idField','CloudProvider','data5','data7','GetDynamics365Account','../../client','getDynamics365Accounts','Request','username','password','clientSecret','serverUrl','Dynamics365Configuration','Configurations','name'];(function(_0x26dcb6,_0x2a5ff1){var _0x2b14e5=function(_0x381cc2){while(--_0x381cc2){_0x26dcb6['push'](_0x26dcb6['shift']());}};_0x2b14e5(++_0x2a5ff1);}(_0x0598,0x92));var _0x8059=function(_0x50429c,_0x38e475){_0x50429c=_0x50429c-0x0;var _0x22efc7=_0x0598[_0x50429c];return _0x22efc7;};'use strict';var client=require(_0x8059('0x0'));exports[_0x8059('0x1')]=function(){return function(_0x5c8253){return client[_0x8059('0x2')]('GetDynamics365Account',{'options':{'raw':![],'attributes':['id','name',_0x8059('0x3'),_0x8059('0x4'),'remoteUri','tenantId','clientId',_0x8059('0x5'),_0x8059('0x6'),'description','modernAuthentication'],'include':[{'model':_0x8059('0x7'),'as':_0x8059('0x8'),'attributes':['id',_0x8059('0x9'),_0x8059('0xa'),'moduleCreate','additionalSearchContact',_0x8059('0xb')],'include':[{'model':_0x8059('0xc'),'as':_0x8059('0xd'),'attributes':['id',_0x8059('0xe'),_0x8059('0xf'),'variableName'],'include':[{'model':'Variable','as':_0x8059('0x10'),'attributes':['id',_0x8059('0x9')]}]},{'model':'Dynamics365Field','as':'Descriptions','attributes':['id','type',_0x8059('0xf'),_0x8059('0x11'),_0x8059('0x12'),_0x8059('0x13'),_0x8059('0x14')],'include':[{'model':'Variable','as':_0x8059('0x10'),'attributes':['id','name']}]},{'model':_0x8059('0xc'),'as':'Fields','attributes':['id',_0x8059('0xe'),_0x8059('0xf'),_0x8059('0x15'),'nameField','customField','variableName'],'include':[{'model':_0x8059('0x10'),'as':_0x8059('0x10'),'attributes':['id',_0x8059('0x9')]}]}]},{'model':_0x8059('0x16'),'as':_0x8059('0x16'),'attributes':['id','data2',_0x8059('0x17'),_0x8059('0x18')]}]},'log':_0x8059('0x19')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/freshdesk.js b/server/services/ami/rpc/integrations/freshdesk.js index 7d1b2b4..ca06d77 100644 --- a/server/services/ami/rpc/integrations/freshdesk.js +++ b/server/services/ami/rpc/integrations/freshdesk.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2964=['type','content','variableName','Variable','Descriptions','key','keyType','Fields','idField','nameField','customField','../../client','getFreshdeskAccounts','Request','GetFreshdeskAccount','name','username','apiKey','remoteUri','FreshdeskConfiguration','Configurations','Tag','FreshdeskField'];(function(_0x1e5f0c,_0x31aa12){var _0x3d083b=function(_0x1a8df2){while(--_0x1a8df2){_0x1e5f0c['push'](_0x1e5f0c['shift']());}};_0x3d083b(++_0x31aa12);}(_0x2964,0x108));var _0x4296=function(_0x390d7b,_0x3b893b){_0x390d7b=_0x390d7b-0x0;var _0x2648f3=_0x2964[_0x390d7b];return _0x2648f3;};'use strict';var client=require(_0x4296('0x0'));exports[_0x4296('0x1')]=function(){return function(_0x31be5e){return client[_0x4296('0x2')](_0x4296('0x3'),{'options':{'raw':![],'attributes':['id',_0x4296('0x4'),_0x4296('0x5'),_0x4296('0x6'),_0x4296('0x7'),'serverUrl'],'include':[{'model':_0x4296('0x8'),'as':_0x4296('0x9'),'attributes':['id',_0x4296('0x4')],'include':[{'model':_0x4296('0xa'),'attributes':['id',_0x4296('0x4')]},{'model':_0x4296('0xb'),'as':'Subjects','attributes':['id',_0x4296('0xc'),_0x4296('0xd'),_0x4296('0xe')],'include':[{'model':_0x4296('0xf'),'as':_0x4296('0xf'),'attributes':['id',_0x4296('0x4')]}]},{'model':_0x4296('0xb'),'as':_0x4296('0x10'),'attributes':['id',_0x4296('0xc'),_0x4296('0xd'),_0x4296('0x11'),_0x4296('0x12'),'keyContent',_0x4296('0xe')],'include':[{'model':_0x4296('0xf'),'as':_0x4296('0xf'),'attributes':['id',_0x4296('0x4')]}]},{'model':_0x4296('0xb'),'as':_0x4296('0x13'),'attributes':['id',_0x4296('0xc'),'content',_0x4296('0x14'),_0x4296('0x15'),_0x4296('0x16'),'variableName'],'include':[{'model':_0x4296('0xf'),'as':_0x4296('0xf'),'attributes':['id',_0x4296('0x4')]}]}]}]},'log':'GetFreshdeskAccount'});};}; \ No newline at end of file +var _0x6c9f=['content','variableName','Variable','Descriptions','key','keyType','keyContent','idField','nameField','customField','../../client','GetFreshdeskAccount','name','username','apiKey','remoteUri','serverUrl','Configurations','Tag','FreshdeskField','Subjects','type'];(function(_0xf1a208,_0x4c9c5f){var _0x4b4d76=function(_0x1ad51d){while(--_0x1ad51d){_0xf1a208['push'](_0xf1a208['shift']());}};_0x4b4d76(++_0x4c9c5f);}(_0x6c9f,0x16a));var _0xf6c9=function(_0x2597c3,_0x32be09){_0x2597c3=_0x2597c3-0x0;var _0x1792b7=_0x6c9f[_0x2597c3];return _0x1792b7;};'use strict';var client=require(_0xf6c9('0x0'));exports['getFreshdeskAccounts']=function(){return function(_0x434274){return client['Request'](_0xf6c9('0x1'),{'options':{'raw':![],'attributes':['id',_0xf6c9('0x2'),_0xf6c9('0x3'),_0xf6c9('0x4'),_0xf6c9('0x5'),_0xf6c9('0x6')],'include':[{'model':'FreshdeskConfiguration','as':_0xf6c9('0x7'),'attributes':['id',_0xf6c9('0x2')],'include':[{'model':_0xf6c9('0x8'),'attributes':['id',_0xf6c9('0x2')]},{'model':_0xf6c9('0x9'),'as':_0xf6c9('0xa'),'attributes':['id',_0xf6c9('0xb'),_0xf6c9('0xc'),_0xf6c9('0xd')],'include':[{'model':'Variable','as':_0xf6c9('0xe'),'attributes':['id',_0xf6c9('0x2')]}]},{'model':_0xf6c9('0x9'),'as':_0xf6c9('0xf'),'attributes':['id',_0xf6c9('0xb'),_0xf6c9('0xc'),_0xf6c9('0x10'),_0xf6c9('0x11'),_0xf6c9('0x12'),'variableName'],'include':[{'model':_0xf6c9('0xe'),'as':_0xf6c9('0xe'),'attributes':['id',_0xf6c9('0x2')]}]},{'model':_0xf6c9('0x9'),'as':'Fields','attributes':['id','type',_0xf6c9('0xc'),_0xf6c9('0x13'),_0xf6c9('0x14'),_0xf6c9('0x15'),_0xf6c9('0xd')],'include':[{'model':_0xf6c9('0xe'),'as':'Variable','attributes':['id','name']}]}]}]},'log':_0xf6c9('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/freshsales.js b/server/services/ami/rpc/integrations/freshsales.js index 94373dd..df89ac5 100644 --- a/server/services/ami/rpc/integrations/freshsales.js +++ b/server/services/ami/rpc/integrations/freshsales.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x06ae=['GetFreshsalesAccount','name','username','apiKey','remoteUri','serverUrl','FreshsalesField','Subjects','type','content','variableName','Variable','Descriptions','keyContent','getFreshsalesAccounts','Request'];(function(_0x3d51d6,_0x333eb3){var _0x57b86c=function(_0x299d55){while(--_0x299d55){_0x3d51d6['push'](_0x3d51d6['shift']());}};_0x57b86c(++_0x333eb3);}(_0x06ae,0x16e));var _0xe06a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x06ae[_0x14add3];return _0x4a174f;};'use strict';var client=require('../../client');exports[_0xe06a('0x0')]=function(){return function(_0x188bb9){return client[_0xe06a('0x1')](_0xe06a('0x2'),{'options':{'raw':![],'attributes':['id',_0xe06a('0x3'),_0xe06a('0x4'),_0xe06a('0x5'),_0xe06a('0x6'),_0xe06a('0x7')],'include':[{'model':'FreshsalesConfiguration','as':'Configurations','attributes':['id','name'],'include':[{'model':_0xe06a('0x8'),'as':_0xe06a('0x9'),'attributes':['id',_0xe06a('0xa'),_0xe06a('0xb'),_0xe06a('0xc')],'include':[{'model':'Variable','as':_0xe06a('0xd'),'attributes':['id','name']}]},{'model':'FreshsalesField','as':_0xe06a('0xe'),'attributes':['id','type',_0xe06a('0xb'),'key','keyType',_0xe06a('0xf'),_0xe06a('0xc')],'include':[{'model':'Variable','as':_0xe06a('0xd'),'attributes':['id',_0xe06a('0x3')]}]}]}]},'log':'GetFreshsalesccount'});};}; \ No newline at end of file +var _0x8b8e=['FreshsalesField','Subjects','type','content','Variable','keyContent','variableName','GetFreshsalesccount','../../client','GetFreshsalesAccount','apiKey','remoteUri','serverUrl','FreshsalesConfiguration','Configurations','name'];(function(_0x53bec2,_0x2c8db1){var _0x418497=function(_0x208c89){while(--_0x208c89){_0x53bec2['push'](_0x53bec2['shift']());}};_0x418497(++_0x2c8db1);}(_0x8b8e,0x108));var _0xe8b8=function(_0x5eb88f,_0x5b0442){_0x5eb88f=_0x5eb88f-0x0;var _0x2f086b=_0x8b8e[_0x5eb88f];return _0x2f086b;};'use strict';var client=require(_0xe8b8('0x0'));exports['getFreshsalesAccounts']=function(){return function(_0x33fd9a){return client['Request'](_0xe8b8('0x1'),{'options':{'raw':![],'attributes':['id','name','username',_0xe8b8('0x2'),_0xe8b8('0x3'),_0xe8b8('0x4')],'include':[{'model':_0xe8b8('0x5'),'as':_0xe8b8('0x6'),'attributes':['id',_0xe8b8('0x7')],'include':[{'model':_0xe8b8('0x8'),'as':_0xe8b8('0x9'),'attributes':['id',_0xe8b8('0xa'),_0xe8b8('0xb'),'variableName'],'include':[{'model':_0xe8b8('0xc'),'as':'Variable','attributes':['id',_0xe8b8('0x7')]}]},{'model':'FreshsalesField','as':'Descriptions','attributes':['id',_0xe8b8('0xa'),_0xe8b8('0xb'),'key','keyType',_0xe8b8('0xd'),_0xe8b8('0xe')],'include':[{'model':_0xe8b8('0xc'),'as':_0xe8b8('0xc'),'attributes':['id',_0xe8b8('0x7')]}]}]}]},'log':_0xe8b8('0xf')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/salesforce.js b/server/services/ami/rpc/integrations/salesforce.js index e7a417c..99d9fda 100644 --- a/server/services/ami/rpc/integrations/salesforce.js +++ b/server/services/ami/rpc/integrations/salesforce.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x80e0=['clientSecret','securityToken','serverUrl','name','moduleCreate','leadId','additionalSearchAccount','additionalSearchContact','additionalSearchLead','SalesforceField','Variable','Descriptions','Fields','Request','GetSalesforceAccount','username','password','remoteUri'];(function(_0x2f6c5a,_0x3e32ac){var _0x27dda4=function(_0x19a243){while(--_0x19a243){_0x2f6c5a['push'](_0x2f6c5a['shift']());}};_0x27dda4(++_0x3e32ac);}(_0x80e0,0x9d));var _0x080e=function(_0x4c5070,_0x1dfc46){_0x4c5070=_0x4c5070-0x0;var _0x1c5d59=_0x80e0[_0x4c5070];return _0x1c5d59;};'use strict';var client=require('../../client');exports['getSalesforceAccounts']=function(){return function(_0x148d40){return client[_0x080e('0x0')](_0x080e('0x1'),{'options':{'raw':![],'attributes':['id','name',_0x080e('0x2'),_0x080e('0x3'),_0x080e('0x4'),'clientId',_0x080e('0x5'),_0x080e('0x6'),_0x080e('0x7'),'type'],'include':[{'model':'SalesforceConfiguration','as':'Configurations','attributes':['id',_0x080e('0x8'),'moduleSearch',_0x080e('0x9'),'ticketType',_0x080e('0xa'),_0x080e('0xb'),_0x080e('0xc'),_0x080e('0xd')],'include':[{'model':_0x080e('0xe'),'as':'Subjects','include':[{'model':'Variable','as':_0x080e('0xf'),'attributes':['id',_0x080e('0x8')]}]},{'model':_0x080e('0xe'),'as':_0x080e('0x10'),'include':[{'model':'Variable','as':'Variable','attributes':['id',_0x080e('0x8')]}]},{'model':_0x080e('0xe'),'as':_0x080e('0x11'),'include':[{'model':'Variable','as':_0x080e('0xf'),'attributes':['id',_0x080e('0x8')]}]}]}]},'log':'GetSalesforceAccount'});};}; \ No newline at end of file +var _0xdeb3=['SalesforceField','Variable','GetSalesforceAccount','getSalesforceAccounts','Request','username','password','remoteUri','clientId','clientSecret','serverUrl','SalesforceConfiguration','name','moduleSearch','moduleCreate','ticketType','leadId','additionalSearchAccount','additionalSearchContact','additionalSearchLead'];(function(_0x2cf062,_0x3c15c6){var _0x376203=function(_0x23ca8e){while(--_0x23ca8e){_0x2cf062['push'](_0x2cf062['shift']());}};_0x376203(++_0x3c15c6);}(_0xdeb3,0xb7));var _0x3deb=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xdeb3[_0x42cae2];return _0x5f256f;};'use strict';var client=require('../../client');exports[_0x3deb('0x0')]=function(){return function(_0x2585e2){return client[_0x3deb('0x1')]('GetSalesforceAccount',{'options':{'raw':![],'attributes':['id','name',_0x3deb('0x2'),_0x3deb('0x3'),_0x3deb('0x4'),_0x3deb('0x5'),_0x3deb('0x6'),'securityToken',_0x3deb('0x7'),'type'],'include':[{'model':_0x3deb('0x8'),'as':'Configurations','attributes':['id',_0x3deb('0x9'),_0x3deb('0xa'),_0x3deb('0xb'),_0x3deb('0xc'),_0x3deb('0xd'),_0x3deb('0xe'),_0x3deb('0xf'),_0x3deb('0x10')],'include':[{'model':_0x3deb('0x11'),'as':'Subjects','include':[{'model':'Variable','as':_0x3deb('0x12'),'attributes':['id',_0x3deb('0x9')]}]},{'model':_0x3deb('0x11'),'as':'Descriptions','include':[{'model':_0x3deb('0x12'),'as':_0x3deb('0x12'),'attributes':['id',_0x3deb('0x9')]}]},{'model':_0x3deb('0x11'),'as':'Fields','include':[{'model':'Variable','as':'Variable','attributes':['id',_0x3deb('0x9')]}]}]}]},'log':_0x3deb('0x13')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/servicenow.js b/server/services/ami/rpc/integrations/servicenow.js index 08c7e4e..77e4792 100644 --- a/server/services/ami/rpc/integrations/servicenow.js +++ b/server/services/ami/rpc/integrations/servicenow.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2675=['ServicenowField','type','content','Variable','Descriptions','keyType','variableName','Fields','idField','nameField','customField','GetServicenowkAccount','../../client','GetServicenowAccount','name','username','password','remoteUri','serverUrl','ServicenowConfiguration','Configurations'];(function(_0x24dd1a,_0x51f0fe){var _0x14fc9a=function(_0x294e42){while(--_0x294e42){_0x24dd1a['push'](_0x24dd1a['shift']());}};_0x14fc9a(++_0x51f0fe);}(_0x2675,0x75));var _0x5267=function(_0x4fda50,_0x10b212){_0x4fda50=_0x4fda50-0x0;var _0x15129c=_0x2675[_0x4fda50];return _0x15129c;};'use strict';var client=require(_0x5267('0x0'));exports['getServicenowAccounts']=function(){return function(_0x53e71f){return client['Request'](_0x5267('0x1'),{'options':{'raw':![],'attributes':['id',_0x5267('0x2'),'description',_0x5267('0x3'),_0x5267('0x4'),'email',_0x5267('0x5'),_0x5267('0x6')],'include':[{'model':_0x5267('0x7'),'as':_0x5267('0x8'),'attributes':['id',_0x5267('0x2')],'include':[{'model':_0x5267('0x9'),'as':'Subjects','attributes':['id',_0x5267('0xa'),_0x5267('0xb'),'variableName'],'include':[{'model':_0x5267('0xc'),'as':'Variable','attributes':['id',_0x5267('0x2')]}]},{'model':_0x5267('0x9'),'as':_0x5267('0xd'),'attributes':['id','type',_0x5267('0xb'),'key',_0x5267('0xe'),'keyContent',_0x5267('0xf')],'include':[{'model':_0x5267('0xc'),'as':_0x5267('0xc'),'attributes':['id',_0x5267('0x2')]}]},{'model':_0x5267('0x9'),'as':_0x5267('0x10'),'attributes':['id',_0x5267('0xa'),_0x5267('0xb'),_0x5267('0x11'),_0x5267('0x12'),_0x5267('0x13'),_0x5267('0xf')],'include':[{'model':_0x5267('0xc'),'as':'Variable','attributes':['id','name']}]}]}]},'log':_0x5267('0x14')});};}; \ No newline at end of file +var _0x524e=['name','description','username','password','email','remoteUri','serverUrl','Configurations','ServicenowField','type','content','variableName','Variable','Descriptions','key','keyType','keyContent','Fields','idField','nameField','Request','GetServicenowAccount'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x524e,0x15e));var _0xe524=function(_0x2895c3,_0x44ffdd){_0x2895c3=_0x2895c3-0x0;var _0x39105a=_0x524e[_0x2895c3];return _0x39105a;};'use strict';var client=require('../../client');exports['getServicenowAccounts']=function(){return function(_0x353d8a){return client[_0xe524('0x0')](_0xe524('0x1'),{'options':{'raw':![],'attributes':['id',_0xe524('0x2'),_0xe524('0x3'),_0xe524('0x4'),_0xe524('0x5'),_0xe524('0x6'),_0xe524('0x7'),_0xe524('0x8')],'include':[{'model':'ServicenowConfiguration','as':_0xe524('0x9'),'attributes':['id',_0xe524('0x2')],'include':[{'model':_0xe524('0xa'),'as':'Subjects','attributes':['id',_0xe524('0xb'),_0xe524('0xc'),_0xe524('0xd')],'include':[{'model':_0xe524('0xe'),'as':_0xe524('0xe'),'attributes':['id',_0xe524('0x2')]}]},{'model':_0xe524('0xa'),'as':_0xe524('0xf'),'attributes':['id',_0xe524('0xb'),_0xe524('0xc'),_0xe524('0x10'),_0xe524('0x11'),_0xe524('0x12'),_0xe524('0xd')],'include':[{'model':_0xe524('0xe'),'as':_0xe524('0xe'),'attributes':['id','name']}]},{'model':'ServicenowField','as':_0xe524('0x13'),'attributes':['id',_0xe524('0xb'),_0xe524('0xc'),_0xe524('0x14'),_0xe524('0x15'),'customField',_0xe524('0xd')],'include':[{'model':'Variable','as':_0xe524('0xe'),'attributes':['id',_0xe524('0x2')]}]}]}]},'log':'GetServicenowkAccount'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/sugarcrm.js b/server/services/ami/rpc/integrations/sugarcrm.js index 411149c..5e64fee 100644 --- a/server/services/ami/rpc/integrations/sugarcrm.js +++ b/server/services/ami/rpc/integrations/sugarcrm.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x14a0=['variableName','key','keyContent','Variable','SugarcrmField','Fields','idField','nameField','customField','getSugarcrmAccounts','Request','GetSugarcrmAccount','name','username','password','SugarcrmConfiguration','Configurations','type','content'];(function(_0x7a42d9,_0x5a0c72){var _0x278b78=function(_0x1fa030){while(--_0x1fa030){_0x7a42d9['push'](_0x7a42d9['shift']());}};_0x278b78(++_0x5a0c72);}(_0x14a0,0x8e));var _0x014a=function(_0x4643bc,_0x42f1fb){_0x4643bc=_0x4643bc-0x0;var _0x3ca0a4=_0x14a0[_0x4643bc];return _0x3ca0a4;};'use strict';var client=require('../../client');exports[_0x014a('0x0')]=function(){return function(_0x451138){return client[_0x014a('0x1')](_0x014a('0x2'),{'options':{'raw':![],'attributes':['id',_0x014a('0x3'),_0x014a('0x4'),_0x014a('0x5'),'remoteUri','serverUrl'],'include':[{'model':_0x014a('0x6'),'as':_0x014a('0x7'),'attributes':['id',_0x014a('0x3')],'include':[{'model':'SugarcrmField','as':'Subjects','attributes':['id',_0x014a('0x8'),_0x014a('0x9'),_0x014a('0xa')],'include':[{'model':'Variable','as':'Variable','attributes':['id',_0x014a('0x3')]}]},{'model':'SugarcrmField','as':'Descriptions','attributes':['id','type','content',_0x014a('0xb'),'keyType',_0x014a('0xc'),_0x014a('0xa')],'include':[{'model':'Variable','as':_0x014a('0xd'),'attributes':['id',_0x014a('0x3')]}]},{'model':_0x014a('0xe'),'as':_0x014a('0xf'),'attributes':['id',_0x014a('0x8'),_0x014a('0x9'),_0x014a('0x10'),_0x014a('0x11'),_0x014a('0x12'),_0x014a('0xa')],'include':[{'model':_0x014a('0xd'),'as':_0x014a('0xd'),'attributes':['id','name']}]}]}]},'log':_0x014a('0x2')});};}; \ No newline at end of file +var _0x1a85=['serverUrl','Configurations','SugarcrmField','type','content','Variable','Descriptions','key','keyType','keyContent','variableName','name','Fields','idField','nameField','Request','GetSugarcrmAccount','password','remoteUri'];(function(_0x1c61ec,_0x1bf9b8){var _0x4a3c18=function(_0x1e53be){while(--_0x1e53be){_0x1c61ec['push'](_0x1c61ec['shift']());}};_0x4a3c18(++_0x1bf9b8);}(_0x1a85,0x178));var _0x51a8=function(_0x2a50f7,_0x4c5ed1){_0x2a50f7=_0x2a50f7-0x0;var _0x5123ec=_0x1a85[_0x2a50f7];return _0x5123ec;};'use strict';var client=require('../../client');exports['getSugarcrmAccounts']=function(){return function(_0x305f18){return client[_0x51a8('0x0')](_0x51a8('0x1'),{'options':{'raw':![],'attributes':['id','name','username',_0x51a8('0x2'),_0x51a8('0x3'),_0x51a8('0x4')],'include':[{'model':'SugarcrmConfiguration','as':_0x51a8('0x5'),'attributes':['id','name'],'include':[{'model':_0x51a8('0x6'),'as':'Subjects','attributes':['id',_0x51a8('0x7'),_0x51a8('0x8'),'variableName'],'include':[{'model':_0x51a8('0x9'),'as':'Variable','attributes':['id','name']}]},{'model':_0x51a8('0x6'),'as':_0x51a8('0xa'),'attributes':['id',_0x51a8('0x7'),_0x51a8('0x8'),_0x51a8('0xb'),_0x51a8('0xc'),_0x51a8('0xd'),_0x51a8('0xe')],'include':[{'model':_0x51a8('0x9'),'as':_0x51a8('0x9'),'attributes':['id',_0x51a8('0xf')]}]},{'model':_0x51a8('0x6'),'as':_0x51a8('0x10'),'attributes':['id',_0x51a8('0x7'),_0x51a8('0x8'),_0x51a8('0x11'),_0x51a8('0x12'),'customField',_0x51a8('0xe')],'include':[{'model':_0x51a8('0x9'),'as':_0x51a8('0x9'),'attributes':['id','name']}]}]}]},'log':_0x51a8('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/vtiger.js b/server/services/ami/rpc/integrations/vtiger.js index 6b403c1..4bce14a 100644 --- a/server/services/ami/rpc/integrations/vtiger.js +++ b/server/services/ami/rpc/integrations/vtiger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb82=['Descriptions','type','key','keyType','keyContent','idField','nameField','customField','../../client','getVtigerAccounts','Request','GetVtigerAccount','name','description','username','accessKey','serverUrl','Configurations','Subjects','content','variableName','Variable','VtigerField'];(function(_0xa908d1,_0x221b19){var _0x1c1e0b=function(_0x482c94){while(--_0x482c94){_0xa908d1['push'](_0xa908d1['shift']());}};_0x1c1e0b(++_0x221b19);}(_0xcb82,0xc0));var _0x2cb8=function(_0x2c7125,_0x45d69e){_0x2c7125=_0x2c7125-0x0;var _0x59fb12=_0xcb82[_0x2c7125];return _0x59fb12;};'use strict';var client=require(_0x2cb8('0x0'));exports[_0x2cb8('0x1')]=function(){return function(_0x1d5e6c){return client[_0x2cb8('0x2')](_0x2cb8('0x3'),{'options':{'raw':![],'attributes':['id',_0x2cb8('0x4'),_0x2cb8('0x5'),_0x2cb8('0x6'),_0x2cb8('0x7'),'remoteUri',_0x2cb8('0x8')],'include':[{'model':'VtigerConfiguration','as':_0x2cb8('0x9'),'attributes':['id',_0x2cb8('0x4')],'include':[{'model':'VtigerField','as':_0x2cb8('0xa'),'attributes':['id','type',_0x2cb8('0xb'),_0x2cb8('0xc')],'include':[{'model':_0x2cb8('0xd'),'as':_0x2cb8('0xd'),'attributes':['id','name']}]},{'model':_0x2cb8('0xe'),'as':_0x2cb8('0xf'),'attributes':['id',_0x2cb8('0x10'),_0x2cb8('0xb'),_0x2cb8('0x11'),_0x2cb8('0x12'),_0x2cb8('0x13'),_0x2cb8('0xc')],'include':[{'model':_0x2cb8('0xd'),'as':_0x2cb8('0xd'),'attributes':['id',_0x2cb8('0x4')]}]},{'model':_0x2cb8('0xe'),'as':'Fields','attributes':['id','type',_0x2cb8('0xb'),_0x2cb8('0x14'),_0x2cb8('0x15'),_0x2cb8('0x16'),'variableName'],'include':[{'model':_0x2cb8('0xd'),'as':'Variable','attributes':['id',_0x2cb8('0x4')]}]}]}]},'log':_0x2cb8('0x3')});};}; \ No newline at end of file +var _0xed6b=['../../client','Request','username','accessKey','remoteUri','serverUrl','VtigerConfiguration','Configurations','VtigerField','Subjects','type','content','variableName','Variable','name','Descriptions','key','keyType','keyContent','Fields','idField','nameField','customField','GetVtigerAccount'];(function(_0x421d92,_0x1b8c8f){var _0x9c0b2b=function(_0x4b5ff1){while(--_0x4b5ff1){_0x421d92['push'](_0x421d92['shift']());}};_0x9c0b2b(++_0x1b8c8f);}(_0xed6b,0x90));var _0xbed6=function(_0x4028a3,_0x21b709){_0x4028a3=_0x4028a3-0x0;var _0x742f02=_0xed6b[_0x4028a3];return _0x742f02;};'use strict';var client=require(_0xbed6('0x0'));exports['getVtigerAccounts']=function(){return function(_0x2e5a49){return client[_0xbed6('0x1')]('GetVtigerAccount',{'options':{'raw':![],'attributes':['id','name','description',_0xbed6('0x2'),_0xbed6('0x3'),_0xbed6('0x4'),_0xbed6('0x5')],'include':[{'model':_0xbed6('0x6'),'as':_0xbed6('0x7'),'attributes':['id','name'],'include':[{'model':_0xbed6('0x8'),'as':_0xbed6('0x9'),'attributes':['id',_0xbed6('0xa'),_0xbed6('0xb'),_0xbed6('0xc')],'include':[{'model':_0xbed6('0xd'),'as':_0xbed6('0xd'),'attributes':['id',_0xbed6('0xe')]}]},{'model':_0xbed6('0x8'),'as':_0xbed6('0xf'),'attributes':['id',_0xbed6('0xa'),_0xbed6('0xb'),_0xbed6('0x10'),_0xbed6('0x11'),_0xbed6('0x12'),_0xbed6('0xc')],'include':[{'model':_0xbed6('0xd'),'as':_0xbed6('0xd'),'attributes':['id',_0xbed6('0xe')]}]},{'model':_0xbed6('0x8'),'as':_0xbed6('0x13'),'attributes':['id',_0xbed6('0xa'),_0xbed6('0xb'),_0xbed6('0x14'),_0xbed6('0x15'),_0xbed6('0x16'),_0xbed6('0xc')],'include':[{'model':_0xbed6('0xd'),'as':'Variable','attributes':['id','name']}]}]}]},'log':_0xbed6('0x17')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/zendesk.js b/server/services/ami/rpc/integrations/zendesk.js index 0e71c2d..b2e9204 100644 --- a/server/services/ami/rpc/integrations/zendesk.js +++ b/server/services/ami/rpc/integrations/zendesk.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9059=['name','username','token','remoteUri','authType','serverUrl','type','ZendeskConfiguration','Configurations','ZendeskField','content','variableName','Variable','Descriptions','key','keyType','idField','nameField','customField','GetZendeskAccount','../../client','getZendeskAccounts','Request'];(function(_0x5b06f2,_0x181952){var _0x545785=function(_0x129974){while(--_0x129974){_0x5b06f2['push'](_0x5b06f2['shift']());}};_0x545785(++_0x181952);}(_0x9059,0x1b2));var _0x9905=function(_0x3d1a63,_0x29bc32){_0x3d1a63=_0x3d1a63-0x0;var _0x3b8217=_0x9059[_0x3d1a63];return _0x3b8217;};'use strict';var client=require(_0x9905('0x0'));exports[_0x9905('0x1')]=function(){return function(_0x1425a6){return client[_0x9905('0x2')]('GetZendeskAccount',{'options':{'raw':![],'attributes':['id',_0x9905('0x3'),_0x9905('0x4'),'password',_0x9905('0x5'),_0x9905('0x6'),_0x9905('0x7'),_0x9905('0x8'),_0x9905('0x9')],'include':[{'model':_0x9905('0xa'),'as':_0x9905('0xb'),'attributes':['id','name'],'include':[{'model':'Tag','attributes':['id','name']},{'model':_0x9905('0xc'),'as':'Subjects','attributes':['id','type',_0x9905('0xd'),_0x9905('0xe')],'include':[{'model':_0x9905('0xf'),'as':'Variable','attributes':['id','name']}]},{'model':'ZendeskField','as':_0x9905('0x10'),'attributes':['id','type',_0x9905('0xd'),_0x9905('0x11'),_0x9905('0x12'),'keyContent',_0x9905('0xe')],'include':[{'model':'Variable','as':_0x9905('0xf'),'attributes':['id','name']}]},{'model':_0x9905('0xc'),'as':'Fields','attributes':['id','type',_0x9905('0xd'),_0x9905('0x13'),_0x9905('0x14'),_0x9905('0x15'),'variableName'],'include':[{'model':_0x9905('0xf'),'as':_0x9905('0xf'),'attributes':['id',_0x9905('0x3')]}]}]}]},'log':_0x9905('0x16')});};}; \ No newline at end of file +var _0xb57f=['name','username','password','token','remoteUri','authType','serverUrl','type','ZendeskConfiguration','Configurations','Tag','ZendeskField','Subjects','content','variableName','Variable','key','keyType','Fields','idField','nameField','customField','getZendeskAccounts','Request','GetZendeskAccount'];(function(_0x435fa1,_0x58550a){var _0x845f9f=function(_0x89867e){while(--_0x89867e){_0x435fa1['push'](_0x435fa1['shift']());}};_0x845f9f(++_0x58550a);}(_0xb57f,0x15b));var _0xfb57=function(_0x599abb,_0x5868af){_0x599abb=_0x599abb-0x0;var _0x4b98ae=_0xb57f[_0x599abb];return _0x4b98ae;};'use strict';var client=require('../../client');exports[_0xfb57('0x0')]=function(){return function(_0x304cb9){return client[_0xfb57('0x1')](_0xfb57('0x2'),{'options':{'raw':![],'attributes':['id',_0xfb57('0x3'),_0xfb57('0x4'),_0xfb57('0x5'),_0xfb57('0x6'),_0xfb57('0x7'),_0xfb57('0x8'),_0xfb57('0x9'),_0xfb57('0xa')],'include':[{'model':_0xfb57('0xb'),'as':_0xfb57('0xc'),'attributes':['id','name'],'include':[{'model':_0xfb57('0xd'),'attributes':['id',_0xfb57('0x3')]},{'model':_0xfb57('0xe'),'as':_0xfb57('0xf'),'attributes':['id',_0xfb57('0xa'),_0xfb57('0x10'),_0xfb57('0x11')],'include':[{'model':_0xfb57('0x12'),'as':_0xfb57('0x12'),'attributes':['id',_0xfb57('0x3')]}]},{'model':_0xfb57('0xe'),'as':'Descriptions','attributes':['id',_0xfb57('0xa'),_0xfb57('0x10'),_0xfb57('0x13'),_0xfb57('0x14'),'keyContent',_0xfb57('0x11')],'include':[{'model':_0xfb57('0x12'),'as':'Variable','attributes':['id','name']}]},{'model':_0xfb57('0xe'),'as':_0xfb57('0x15'),'attributes':['id','type',_0xfb57('0x10'),_0xfb57('0x16'),_0xfb57('0x17'),_0xfb57('0x18'),_0xfb57('0x11')],'include':[{'model':_0xfb57('0x12'),'as':_0xfb57('0x12'),'attributes':['id','name']}]}]}]},'log':_0xfb57('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/zoho.js b/server/services/ami/rpc/integrations/zoho.js index bc8d749..e8226d6 100644 --- a/server/services/ami/rpc/integrations/zoho.js +++ b/server/services/ami/rpc/integrations/zoho.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3b2f=['Subjects','type','content','variableName','Variable','Descriptions','key','keyContent','idField','nameField','customField','GetZohoAccount','../../client','getZohoAccounts','Request','name','description','host','zone','clientId','serverUrl','refreshToken','ZohoConfiguration','Configurations','moduleSearch','ZohoField'];(function(_0x2fb1e5,_0x87006a){var _0x61f96c=function(_0x4cc6f0){while(--_0x4cc6f0){_0x2fb1e5['push'](_0x2fb1e5['shift']());}};_0x61f96c(++_0x87006a);}(_0x3b2f,0x15e));var _0xf3b2=function(_0x531f5c,_0x16c5ec){_0x531f5c=_0x531f5c-0x0;var _0x160bc6=_0x3b2f[_0x531f5c];return _0x160bc6;};'use strict';var client=require(_0xf3b2('0x0'));exports[_0xf3b2('0x1')]=function(){return function(_0x49d6f5){return client[_0xf3b2('0x2')]('GetZohoAccount',{'options':{'raw':![],'attributes':['id',_0xf3b2('0x3'),_0xf3b2('0x4'),_0xf3b2('0x5'),_0xf3b2('0x6'),_0xf3b2('0x7'),'clientSecret',_0xf3b2('0x8'),'code',_0xf3b2('0x9')],'include':[{'model':_0xf3b2('0xa'),'as':_0xf3b2('0xb'),'attributes':['id',_0xf3b2('0x3'),'moduleCreate',_0xf3b2('0xc'),_0xf3b2('0x4')],'include':[{'model':_0xf3b2('0xd'),'as':_0xf3b2('0xe'),'attributes':['id',_0xf3b2('0xf'),_0xf3b2('0x10'),_0xf3b2('0x11')],'include':[{'model':_0xf3b2('0x12'),'as':_0xf3b2('0x12'),'attributes':['id',_0xf3b2('0x3')]}]},{'model':_0xf3b2('0xd'),'as':_0xf3b2('0x13'),'attributes':['id',_0xf3b2('0xf'),'content',_0xf3b2('0x14'),'keyType',_0xf3b2('0x15'),_0xf3b2('0x11')],'include':[{'model':_0xf3b2('0x12'),'as':'Variable','attributes':['id',_0xf3b2('0x3')]}]},{'model':_0xf3b2('0xd'),'as':'Fields','attributes':['id',_0xf3b2('0xf'),_0xf3b2('0x10'),_0xf3b2('0x16'),_0xf3b2('0x17'),_0xf3b2('0x18'),_0xf3b2('0x11')],'include':[{'model':_0xf3b2('0x12'),'as':_0xf3b2('0x12'),'attributes':['id','name']}]}]}]},'log':_0xf3b2('0x19')});};}; \ No newline at end of file +var _0x75ed=['Subjects','content','variableName','Variable','Descriptions','type','keyType','keyContent','Fields','idField','nameField','customField','../../client','getZohoAccounts','name','description','serverUrl','code','refreshToken','moduleCreate','moduleSearch','ZohoField'];(function(_0x1c4829,_0x136922){var _0x539d49=function(_0x2a8430){while(--_0x2a8430){_0x1c4829['push'](_0x1c4829['shift']());}};_0x539d49(++_0x136922);}(_0x75ed,0x12a));var _0xd75e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x75ed[_0x1facfa];return _0x9ec701;};'use strict';var client=require(_0xd75e('0x0'));exports[_0xd75e('0x1')]=function(){return function(_0x39b47c){return client['Request']('GetZohoAccount',{'options':{'raw':![],'attributes':['id',_0xd75e('0x2'),_0xd75e('0x3'),'host','zone','clientId','clientSecret',_0xd75e('0x4'),_0xd75e('0x5'),_0xd75e('0x6')],'include':[{'model':'ZohoConfiguration','as':'Configurations','attributes':['id','name',_0xd75e('0x7'),_0xd75e('0x8'),_0xd75e('0x3')],'include':[{'model':_0xd75e('0x9'),'as':_0xd75e('0xa'),'attributes':['id','type',_0xd75e('0xb'),_0xd75e('0xc')],'include':[{'model':_0xd75e('0xd'),'as':_0xd75e('0xd'),'attributes':['id',_0xd75e('0x2')]}]},{'model':_0xd75e('0x9'),'as':_0xd75e('0xe'),'attributes':['id',_0xd75e('0xf'),_0xd75e('0xb'),'key',_0xd75e('0x10'),_0xd75e('0x11'),'variableName'],'include':[{'model':_0xd75e('0xd'),'as':'Variable','attributes':['id',_0xd75e('0x2')]}]},{'model':_0xd75e('0x9'),'as':_0xd75e('0x12'),'attributes':['id','type',_0xd75e('0xb'),_0xd75e('0x13'),_0xd75e('0x14'),_0xd75e('0x15'),_0xd75e('0xc')],'include':[{'model':_0xd75e('0xd'),'as':'Variable','attributes':['id','name']}]}]}]},'log':'GetZohoAccount'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/interval.js b/server/services/ami/rpc/interval.js index 581a81b..36c7a89 100644 --- a/server/services/ami/rpc/interval.js +++ b/server/services/ami/rpc/interval.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x344e=['map','interval','Request','IntervalIftime','intervalIftime','dialer','stack','trim','intervalIftime\x20called\x20with','isArray','length','resolve','every','number','string'];(function(_0x20aadb,_0x5a607a){var _0x520018=function(_0x1d258a){while(--_0x1d258a){_0x20aadb['push'](_0x20aadb['shift']());}};_0x520018(++_0x5a607a);}(_0x344e,0x7d));var _0xe344=function(_0x4ec10d,_0x24c958){_0x4ec10d=_0x4ec10d-0x0;var _0x43d0bc=_0x344e[_0x4ec10d];return _0x43d0bc;};var logger=require('../../../config/logger')(_0xe344('0x0'));var client=require('../client');function intervalIftime(_0x505beb,_0x49a14c){const _0x4a7c51=new Error()[_0xe344('0x1')]['replace'](/^Error/,'')[_0xe344('0x2')]();logger['silly'](_0xe344('0x3'),_0x505beb,_0x49a14c,_0x4a7c51);const _0x1ff35a=Array[_0xe344('0x4')](_0x505beb);if(!_0x505beb||_0x1ff35a&&_0x505beb[_0xe344('0x5')]===0x0){return Promise[_0xe344('0x6')](![]);}else{var _0xd27838=[];var _0x1b5432=[];var _0x25d905=_0x1ff35a?_0x505beb:[_0x505beb];var _0x574825=_0x25d905[_0xe344('0x7')](function(_0x4fe426){return typeof _0x4fe426===_0xe344('0x8');});var _0xdf5055=_0x25d905[_0xe344('0x7')](function(_0x14b6b2){return typeof _0x14b6b2===_0xe344('0x9');});if(!_0x574825&&!_0xdf5055){_0xd27838=_0x25d905[_0xe344('0xa')](function(_0x2d1548){return _0x2d1548['id'];});if(_0xd27838['length']===0x0){_0x1b5432=_0x25d905['map'](function(_0x4537a9){return _0x4537a9[_0xe344('0xb')];});}}else{if(_0x574825){_0xd27838=_0xd27838['concat'](_0x25d905);}if(_0xdf5055){_0x1b5432=_0x1b5432['concat'](_0x25d905);}}return client[_0xe344('0xc')]('IntervalIftime',{'intervalIds':_0xd27838,'intervals':_0x1b5432,'timezone':_0x49a14c,'log':_0xe344('0xd')});}}exports[_0xe344('0xe')]=intervalIftime; \ No newline at end of file +var _0x52e5=['IntervalIftime','intervalIftime','../../../config/logger','dialer','../client','stack','replace','trim','silly','intervalIftime\x20called\x20with','isArray','resolve','every','number','map','length','interval','concat','Request'];(function(_0x1e03c3,_0x5901b9){var _0x1c4343=function(_0x2b4edc){while(--_0x2b4edc){_0x1e03c3['push'](_0x1e03c3['shift']());}};_0x1c4343(++_0x5901b9);}(_0x52e5,0x132));var _0x552e=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x52e5[_0x17d9e3];return _0x14192d;};var logger=require(_0x552e('0x0'))(_0x552e('0x1'));var client=require(_0x552e('0x2'));function intervalIftime(_0x5b0e42,_0x381633){const _0x28dc95=new Error()[_0x552e('0x3')][_0x552e('0x4')](/^Error/,'')[_0x552e('0x5')]();logger[_0x552e('0x6')](_0x552e('0x7'),_0x5b0e42,_0x381633,_0x28dc95);const _0x50220c=Array[_0x552e('0x8')](_0x5b0e42);if(!_0x5b0e42||_0x50220c&&_0x5b0e42['length']===0x0){return Promise[_0x552e('0x9')](![]);}else{var _0x180f7d=[];var _0x1b4d24=[];var _0x52f9d3=_0x50220c?_0x5b0e42:[_0x5b0e42];var _0x519903=_0x52f9d3[_0x552e('0xa')](function(_0x178a0c){return typeof _0x178a0c===_0x552e('0xb');});var _0x3a72e1=_0x52f9d3[_0x552e('0xa')](function(_0x23a726){return typeof _0x23a726==='string';});if(!_0x519903&&!_0x3a72e1){_0x180f7d=_0x52f9d3[_0x552e('0xc')](function(_0x456d04){return _0x456d04['id'];});if(_0x180f7d[_0x552e('0xd')]===0x0){_0x1b4d24=_0x52f9d3[_0x552e('0xc')](function(_0xfdbe07){return _0xfdbe07[_0x552e('0xe')];});}}else{if(_0x519903){_0x180f7d=_0x180f7d[_0x552e('0xf')](_0x52f9d3);}if(_0x3a72e1){_0x1b4d24=_0x1b4d24['concat'](_0x52f9d3);}}return client[_0x552e('0x10')]('IntervalIftime',{'intervalIds':_0x180f7d,'intervals':_0x1b4d24,'timezone':_0x381633,'log':_0x552e('0x11')});}}exports[_0x552e('0x12')]=intervalIftime; \ No newline at end of file diff --git a/server/services/ami/rpc/memberReport.js b/server/services/ami/rpc/memberReport.js index 3939fe5..51141b9 100644 --- a/server/services/ami/rpc/memberReport.js +++ b/server/services/ami/rpc/memberReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdd24=['queuecallerexitAt','Request','voice','lastAssignedTo','isNil','interface','SIP/%s','queuecallerleaveAt','diff','inbound','calleridnum','exten','queue','agent','accountcode','toNumber','CreateMemberReport','voiceDialReport','membername','starttime','endtime','seconds','dialstring','uniqueid','moment','util','../client','voiceQueueReport','queuecallercompleteAt'];(function(_0xf10840,_0xad3916){var _0x1fdf7e=function(_0x463be3){while(--_0x463be3){_0xf10840['push'](_0xf10840['shift']());}};_0x1fdf7e(++_0xad3916);}(_0xdd24,0x174));var _0x4dd2=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xdd24[_0x1facfa];return _0x9ec701;};'use strict';var moment=require(_0x4dd2('0x0'));var _=require('lodash');var util=require(_0x4dd2('0x1'));var client=require(_0x4dd2('0x2'));exports[_0x4dd2('0x3')]=function(_0x4d2c49){var _0x327fbc=_0x4d2c49[_0x4dd2('0x4')]||_0x4d2c49[_0x4dd2('0x5')];return client[_0x4dd2('0x6')]('CreateMemberReport',{'body':{'channel':_0x4dd2('0x7'),'membername':_0x4d2c49[_0x4dd2('0x8')],'interface':_[_0x4dd2('0x9')](_0x4d2c49[_0x4dd2('0xa')])?util['format'](_0x4dd2('0xb'),_0x4d2c49[_0x4dd2('0x8')]):_0x4d2c49[_0x4dd2('0xa')],'type':'TALKING','enterAt':_0x4d2c49[_0x4dd2('0xc')],'exitAt':_0x327fbc,'duration':moment(_0x327fbc)[_0x4dd2('0xd')](_0x4d2c49[_0x4dd2('0xc')],'seconds'),'data1':_0x4dd2('0xe'),'data2':_0x4d2c49[_0x4dd2('0xf')],'data3':_0x4d2c49[_0x4dd2('0x10')],'data4':null,'data5':_0x4d2c49[_0x4dd2('0x11')],'role':_0x4dd2('0x12'),'internal':_0x4d2c49[_0x4dd2('0x13')]?_[_0x4dd2('0x14')](_0x4d2c49['accountcode']):undefined,'uniqueid':_0x4d2c49['uniqueid']},'log':_0x4dd2('0x15')});};exports[_0x4dd2('0x16')]=function(_0x49091e){return client[_0x4dd2('0x6')]('CreateMemberReport',{'body':{'channel':_0x4dd2('0x7'),'membername':_0x49091e[_0x4dd2('0x17')],'interface':_0x49091e['interface'],'type':'TALKING','enterAt':_0x49091e[_0x4dd2('0x18')],'exitAt':_0x49091e['endtime'],'duration':moment(_0x49091e[_0x4dd2('0x19')])[_0x4dd2('0xd')](_0x49091e[_0x4dd2('0x18')],'seconds')>=0x0?moment(_0x49091e[_0x4dd2('0x19')])[_0x4dd2('0xd')](_0x49091e['starttime'],_0x4dd2('0x1a')):null,'data1':'outbound','data2':_0x49091e[_0x4dd2('0x13')],'data3':_0x49091e['exten'],'data4':_0x49091e[_0x4dd2('0x1b')]||null,'role':_0x4dd2('0x12'),'internal':_0x49091e[_0x4dd2('0x13')]?_[_0x4dd2('0x14')](_0x49091e[_0x4dd2('0x13')]):undefined,'uniqueid':_0x49091e[_0x4dd2('0x1c')]},'log':'CreateMemberReport'});}; \ No newline at end of file +var _0x13eb=['calleridnum','exten','queue','accountcode','uniqueid','CreateMemberReport','voiceDialReport','membername','TALKING','starttime','diff','seconds','outbound','dialstring','agent','toNumber','moment','lodash','util','voiceQueueReport','queuecallercompleteAt','queuecallerexitAt','Request','voice','lastAssignedTo','isNil','format','SIP/%s','queuecallerleaveAt'];(function(_0x394f16,_0x4d528d){var _0x5b066c=function(_0x12c604){while(--_0x12c604){_0x394f16['push'](_0x394f16['shift']());}};_0x5b066c(++_0x4d528d);}(_0x13eb,0x132));var _0xb13e=function(_0xc65ae2,_0x53119a){_0xc65ae2=_0xc65ae2-0x0;var _0x2432ea=_0x13eb[_0xc65ae2];return _0x2432ea;};'use strict';var moment=require(_0xb13e('0x0'));var _=require(_0xb13e('0x1'));var util=require(_0xb13e('0x2'));var client=require('../client');exports[_0xb13e('0x3')]=function(_0x574470){var _0x1a79db=_0x574470[_0xb13e('0x4')]||_0x574470[_0xb13e('0x5')];return client[_0xb13e('0x6')]('CreateMemberReport',{'body':{'channel':_0xb13e('0x7'),'membername':_0x574470[_0xb13e('0x8')],'interface':_[_0xb13e('0x9')](_0x574470['interface'])?util[_0xb13e('0xa')](_0xb13e('0xb'),_0x574470[_0xb13e('0x8')]):_0x574470['interface'],'type':'TALKING','enterAt':_0x574470[_0xb13e('0xc')],'exitAt':_0x1a79db,'duration':moment(_0x1a79db)['diff'](_0x574470[_0xb13e('0xc')],'seconds'),'data1':'inbound','data2':_0x574470[_0xb13e('0xd')],'data3':_0x574470[_0xb13e('0xe')],'data4':null,'data5':_0x574470[_0xb13e('0xf')],'role':'agent','internal':_0x574470['accountcode']?_['toNumber'](_0x574470[_0xb13e('0x10')]):undefined,'uniqueid':_0x574470[_0xb13e('0x11')]},'log':_0xb13e('0x12')});};exports[_0xb13e('0x13')]=function(_0x380937){return client[_0xb13e('0x6')](_0xb13e('0x12'),{'body':{'channel':_0xb13e('0x7'),'membername':_0x380937[_0xb13e('0x14')],'interface':_0x380937['interface'],'type':_0xb13e('0x15'),'enterAt':_0x380937[_0xb13e('0x16')],'exitAt':_0x380937['endtime'],'duration':moment(_0x380937['endtime'])[_0xb13e('0x17')](_0x380937[_0xb13e('0x16')],_0xb13e('0x18'))>=0x0?moment(_0x380937['endtime'])[_0xb13e('0x17')](_0x380937[_0xb13e('0x16')],'seconds'):null,'data1':_0xb13e('0x19'),'data2':_0x380937[_0xb13e('0x10')],'data3':_0x380937[_0xb13e('0xe')],'data4':_0x380937[_0xb13e('0x1a')]||null,'role':_0xb13e('0x1b'),'internal':_0x380937[_0xb13e('0x10')]?_[_0xb13e('0x1c')](_0x380937[_0xb13e('0x10')]):undefined,'uniqueid':_0x380937['uniqueid']},'log':'CreateMemberReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index 96e0083..a3bcaaa 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 _0x315f=['../client','Request','previewRecallmeReminderInterval'];(function(_0x4d6c9c,_0x257c78){var _0x1b904f=function(_0x343e68){while(--_0x343e68){_0x4d6c9c['push'](_0x4d6c9c['shift']());}};_0x1b904f(++_0x257c78);}(_0x315f,0x174));var _0xf315=function(_0x1b7368,_0x3286ed){_0x1b7368=_0x1b7368-0x0;var _0x25d54c=_0x315f[_0x1b7368];return _0x25d54c;};'use strict';var client=require(_0xf315('0x0'));exports['getSettings']=function(){return client[_0xf315('0x1')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':['stopRecordingOnTransfer',_0xf315('0x2')]},'log':'GetSettings'});}; \ No newline at end of file +var _0x04d5=['../client','getSettings','ShowSetting','stopRecordingOnTransfer','previewRecallmeReminderInterval'];(function(_0x2d3754,_0x4d6841){var _0x490081=function(_0x2ac4cd){while(--_0x2ac4cd){_0x2d3754['push'](_0x2d3754['shift']());}};_0x490081(++_0x4d6841);}(_0x04d5,0xe1));var _0x504d=function(_0x1d37ad,_0x3a8d51){_0x1d37ad=_0x1d37ad-0x0;var _0x4be89c=_0x04d5[_0x1d37ad];return _0x4be89c;};'use strict';var client=require(_0x504d('0x0'));exports[_0x504d('0x1')]=function(){return client['Request'](_0x504d('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x504d('0x3'),_0x504d('0x4')]},'log':'GetSettings'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index f32f7c0..6783f61 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 _0xf47b=['getTemplates','Request','GetTemplate','html','../client'];(function(_0x42c5cd,_0x5390a6){var _0xd4a04a=function(_0x1ebaaf){while(--_0x1ebaaf){_0x42c5cd['push'](_0x42c5cd['shift']());}};_0xd4a04a(++_0x5390a6);}(_0xf47b,0x15d));var _0xbf47=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0xf47b[_0x173441];return _0x2423a8;};'use strict';var client=require(_0xbf47('0x0'));exports[_0xbf47('0x1')]=function(_0x3585b7){return function(_0x4f851e){return client[_0xbf47('0x2')](_0xbf47('0x3'),{'options':{'raw':!![],'attributes':['id','name',_0xbf47('0x4')]},'log':_0xbf47('0x3')});};}; \ No newline at end of file +var _0x7ef0=['../client','getTemplates','GetTemplate','name','html'];(function(_0x5e211d,_0x26e878){var _0x42e65b=function(_0x487e44){while(--_0x487e44){_0x5e211d['push'](_0x5e211d['shift']());}};_0x42e65b(++_0x26e878);}(_0x7ef0,0x122));var _0x07ef=function(_0x4d244e,_0x2a94fd){_0x4d244e=_0x4d244e-0x0;var _0x5205c7=_0x7ef0[_0x4d244e];return _0x5205c7;};'use strict';var client=require(_0x07ef('0x0'));exports[_0x07ef('0x1')]=function(_0x2daaec){return function(_0x14703b){return client['Request'](_0x07ef('0x2'),{'options':{'raw':!![],'attributes':['id',_0x07ef('0x3'),_0x07ef('0x4')]},'log':_0x07ef('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 05270d7..2d89b1d 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 _0xb34a=['Actions','action','data2','data3','data4','data5','data7','../client','getTriggers','Request','GetTrigger','channel','status','field','operator','value','Condition','Action'];(function(_0x1f27d7,_0x47eda3){var _0x1574b3=function(_0x34782f){while(--_0x34782f){_0x1f27d7['push'](_0x1f27d7['shift']());}};_0x1574b3(++_0x47eda3);}(_0xb34a,0x181));var _0xab34=function(_0x48d75a,_0x92e69e){_0x48d75a=_0x48d75a-0x0;var _0x18a15c=_0xb34a[_0x48d75a];return _0x18a15c;};'use strict';var client=require(_0xab34('0x0'));exports[_0xab34('0x1')]=function(_0x6dea04){return function(_0x256b6d){return client[_0xab34('0x2')](_0xab34('0x3'),{'options':{'raw':![],'attributes':['id','name',_0xab34('0x4'),_0xab34('0x5')],'include':[{'model':'Condition','as':'AllConditions','attributes':['id',_0xab34('0x6'),_0xab34('0x7'),_0xab34('0x8')]},{'model':_0xab34('0x9'),'as':'AnyConditions','attributes':['id',_0xab34('0x6'),_0xab34('0x7'),'value']},{'model':_0xab34('0xa'),'as':_0xab34('0xb'),'attributes':['id',_0xab34('0xc'),'data1',_0xab34('0xd'),_0xab34('0xe'),_0xab34('0xf'),_0xab34('0x10'),'data6',_0xab34('0x11')]}]},'log':_0xab34('0x3')});};}; \ No newline at end of file +var _0x1c34=['data3','data4','data5','data7','../client','getTriggers','Request','GetTrigger','name','channel','status','Condition','AllConditions','field','operator','AnyConditions','value','Action','Actions','action','data1'];(function(_0x98aad4,_0x2573b3){var _0x5527e1=function(_0x1fbc41){while(--_0x1fbc41){_0x98aad4['push'](_0x98aad4['shift']());}};_0x5527e1(++_0x2573b3);}(_0x1c34,0x1e7));var _0x41c3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1c34[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x41c3('0x0'));exports[_0x41c3('0x1')]=function(_0x272c5d){return function(_0x273e68){return client[_0x41c3('0x2')](_0x41c3('0x3'),{'options':{'raw':![],'attributes':['id',_0x41c3('0x4'),_0x41c3('0x5'),_0x41c3('0x6')],'include':[{'model':_0x41c3('0x7'),'as':_0x41c3('0x8'),'attributes':['id',_0x41c3('0x9'),_0x41c3('0xa'),'value']},{'model':_0x41c3('0x7'),'as':_0x41c3('0xb'),'attributes':['id',_0x41c3('0x9'),'operator',_0x41c3('0xc')]},{'model':_0x41c3('0xd'),'as':_0x41c3('0xe'),'attributes':['id',_0x41c3('0xf'),_0x41c3('0x10'),'data2',_0x41c3('0x11'),_0x41c3('0x12'),_0x41c3('0x13'),'data6',_0x41c3('0x14')]}]},'log':_0x41c3('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index d000cc1..a4a6b24 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 _0x0a67=['registry','defaultuser','../client','getTrunks','GetTrunk'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x0a67,0x1c4));var _0x70a6=function(_0x43a8ea,_0x359c48){_0x43a8ea=_0x43a8ea-0x0;var _0x55235b=_0x0a67[_0x43a8ea];return _0x55235b;};'use strict';var client=require(_0x70a6('0x0'));exports[_0x70a6('0x1')]=function(_0x476502){return function(_0x1a00b2){return client['Request'](_0x70a6('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name',_0x70a6('0x3'),_0x70a6('0x4')]},'log':'GetTrunk'});};}; \ No newline at end of file +var _0x6505=['../client','getTrunks','Request','GetTrunk','name','registry','defaultuser'];(function(_0x22e204,_0x35e723){var _0x2b577f=function(_0x1f40c6){while(--_0x1f40c6){_0x22e204['push'](_0x22e204['shift']());}};_0x2b577f(++_0x35e723);}(_0x6505,0x8c));var _0x5650=function(_0x1dcc32,_0x1ffc02){_0x1dcc32=_0x1dcc32-0x0;var _0x56b893=_0x6505[_0x1dcc32];return _0x56b893;};'use strict';var client=require(_0x5650('0x0'));exports[_0x5650('0x1')]=function(_0x2ee4dd){return function(_0x254e0f){return client[_0x5650('0x2')](_0x5650('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x5650('0x4'),_0x5650('0x5'),_0x5650('0x6')]},'log':_0x5650('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 2f1857b..5eee11e 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 _0x34e8=['../client','getAgents','Request','GetUser','name','email','accountcode','fullname','online','lastLoginAt','pauseType','voicePause','mobile','interface','getTelephones','telephone','internal','savePause','PauseUser','saveUnpause','UnpauseUser','getAgent','ShowUser','agent','lastPauseAt'];(function(_0x56161a,_0x536c32){var _0x11a565=function(_0x1b53f7){while(--_0x1b53f7){_0x56161a['push'](_0x56161a['shift']());}};_0x11a565(++_0x536c32);}(_0x34e8,0x12c));var _0x834e=function(_0x2c61c7,_0x2674aa){_0x2c61c7=_0x2c61c7-0x0;var _0x3993d0=_0x34e8[_0x2c61c7];return _0x3993d0;};'use strict';var client=require(_0x834e('0x0'));exports[_0x834e('0x1')]=function(){return function(){return client[_0x834e('0x2')](_0x834e('0x3'),{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0x834e('0x4'),_0x834e('0x5'),_0x834e('0x6'),_0x834e('0x7'),_0x834e('0x8'),_0x834e('0x9'),_0x834e('0xa'),'lastPauseAt',_0x834e('0xb'),'phone',_0x834e('0xc'),_0x834e('0xd')]},'log':_0x834e('0x1')});};};exports[_0x834e('0xe')]=function(){return function(){return client[_0x834e('0x2')](_0x834e('0x3'),{'options':{'raw':!![],'where':{'role':_0x834e('0xf')},'attributes':['id',_0x834e('0x4'),_0x834e('0x6'),_0x834e('0x10')]},'log':_0x834e('0xe')});};};exports[_0x834e('0x11')]=function(_0x14038b,_0x2e1a37,_0x293514){return client[_0x834e('0x2')](_0x834e('0x12'),{'body':{'type':_0x2e1a37,'uniqueid':_0x293514},'options':{'where':{'id':_0x14038b['id']}},'log':'savePause'});};exports[_0x834e('0x13')]=function(_0x6cd9b9){return client['Request'](_0x834e('0x14'),{'body':{},'options':{'where':{'id':_0x6cd9b9['id']}},'log':_0x834e('0x11')});};exports[_0x834e('0x15')]=function(_0x21cc0a){return client['Request'](_0x834e('0x16'),{'options':{'raw':![],'where':{'role':_0x834e('0x17'),'id':_0x21cc0a},'attributes':['id','name',_0x834e('0x5'),'accountcode',_0x834e('0x7'),_0x834e('0x8'),'lastLoginAt',_0x834e('0xa'),_0x834e('0x18'),_0x834e('0xb'),'interface']},'log':_0x834e('0x15')});}; \ No newline at end of file +var _0x0713=['getAgent','Request','GetUser','agent','name','email','fullname','online','lastLoginAt','pauseType','lastPauseAt','voicePause','phone','mobile','interface','getAgents','getTelephones','accountcode','internal','savePause','PauseUser'];(function(_0x27def2,_0x5d1ba2){var _0x21ad50=function(_0x6dfcd1){while(--_0x6dfcd1){_0x27def2['push'](_0x27def2['shift']());}};_0x21ad50(++_0x5d1ba2);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x3071('0x0')](_0x3071('0x1'),{'options':{'raw':![],'where':{'role':_0x3071('0x2')},'attributes':['id',_0x3071('0x3'),_0x3071('0x4'),'accountcode',_0x3071('0x5'),_0x3071('0x6'),_0x3071('0x7'),_0x3071('0x8'),_0x3071('0x9'),_0x3071('0xa'),_0x3071('0xb'),_0x3071('0xc'),_0x3071('0xd')]},'log':_0x3071('0xe')});};};exports[_0x3071('0xf')]=function(){return function(){return client[_0x3071('0x0')](_0x3071('0x1'),{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x3071('0x3'),_0x3071('0x10'),_0x3071('0x11')]},'log':_0x3071('0xf')});};};exports[_0x3071('0x12')]=function(_0x4a470a,_0x2ace21,_0x11a7ee){return client[_0x3071('0x0')](_0x3071('0x13'),{'body':{'type':_0x2ace21,'uniqueid':_0x11a7ee},'options':{'where':{'id':_0x4a470a['id']}},'log':_0x3071('0x12')});};exports['saveUnpause']=function(_0x5330a8){return client[_0x3071('0x0')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x5330a8['id']}},'log':_0x3071('0x12')});};exports[_0x3071('0x14')]=function(_0x5d4883){return client[_0x3071('0x0')]('ShowUser',{'options':{'raw':![],'where':{'role':_0x3071('0x2'),'id':_0x5d4883},'attributes':['id',_0x3071('0x3'),_0x3071('0x4'),_0x3071('0x10'),_0x3071('0x5'),_0x3071('0x6'),_0x3071('0x7'),_0x3071('0x8'),_0x3071('0x9'),_0x3071('0xa'),'interface']},'log':_0x3071('0x14')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index ef7451e..2b0be40 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 _0xe112=['Request','CreateVoiceAgentReport','UpdateVoiceAgentReport','../client','create'];(function(_0xf8be6a,_0x1b7bd7){var _0x471e7f=function(_0x2eacd7){while(--_0x2eacd7){_0xf8be6a['push'](_0xf8be6a['shift']());}};_0x471e7f(++_0x1b7bd7);}(_0xe112,0x148));var _0x2e11=function(_0x3c3d90,_0x3a9723){_0x3c3d90=_0x3c3d90-0x0;var _0x3dea61=_0xe112[_0x3c3d90];return _0x3dea61;};'use strict';var client=require(_0x2e11('0x0'));exports[_0x2e11('0x1')]=function(_0x239b59){return client[_0x2e11('0x2')]('CreateVoiceAgentReport',{'body':_0x239b59,'log':_0x2e11('0x3')});};exports['update']=function(_0x54d542,_0x5543a9,_0x17da0a){return client[_0x2e11('0x2')](_0x2e11('0x4'),{'body':_0x54d542,'options':{'where':{'uniqueid':_0x5543a9,'interface':_0x17da0a,'agentcomplete':!![]}},'log':_0x2e11('0x4')});}; \ No newline at end of file +var _0xad8f=['update','UpdateVoiceAgentReport','../client','create','Request','CreateVoiceAgentReport'];(function(_0xa45dbe,_0x35f905){var _0x341ebc=function(_0x46587d){while(--_0x46587d){_0xa45dbe['push'](_0xa45dbe['shift']());}};_0x341ebc(++_0x35f905);}(_0xad8f,0x92));var _0xfad8=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xad8f[_0x3947c9];return _0x2e7871;};'use strict';var client=require(_0xfad8('0x0'));exports[_0xfad8('0x1')]=function(_0x2e8671){return client[_0xfad8('0x2')](_0xfad8('0x3'),{'body':_0x2e8671,'log':_0xfad8('0x3')});};exports[_0xfad8('0x4')]=function(_0x27d941,_0x3a0879,_0xfbe782){return client[_0xfad8('0x2')](_0xfad8('0x5'),{'body':_0x27d941,'options':{'where':{'uniqueid':_0x3a0879,'interface':_0xfbe782,'agentcomplete':!![]}},'log':'UpdateVoiceAgentReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 6e5f01f..7d98525 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 _0x11cb=['format','endOf','YYYY-MM-DD\x20HH:mm:ss','type','disposition','billableseconds','GetVoiceCallReports','moment','util','lodash','../client','create','CreateVoiceCallReport','calleridnum','context','callerid','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','outbound','startOf','day'];(function(_0x1278b6,_0x24252e){var _0x2cff42=function(_0x46b845){while(--_0x46b845){_0x1278b6['push'](_0x1278b6['shift']());}};_0x2cff42(++_0x24252e);}(_0x11cb,0x167));var _0xb11c=function(_0x58e718,_0x1e757f){_0x58e718=_0x58e718-0x0;var _0x373fb7=_0x11cb[_0x58e718];return _0x373fb7;};'use strict';var moment=require(_0xb11c('0x0'));var util=require(_0xb11c('0x1'));var _=require(_0xb11c('0x2'));var client=require(_0xb11c('0x3'));exports[_0xb11c('0x4')]=function(_0x46fc1c){return client['Request'](_0xb11c('0x5'),{'body':_['merge'](_0x46fc1c,{'source':_0x46fc1c[_0xb11c('0x6')],'destinationcontext':_0x46fc1c[_0xb11c('0x7')],'callerid':_0x46fc1c[_0xb11c('0x8')],'amaflags':_0xb11c('0x9')}),'log':_0xb11c('0x5')});};exports[_0xb11c('0xa')]=function(){return function(){return client['Request'](_0xb11c('0xb'),{'options':{'where':{'type':[_0xb11c('0xc')],'createdAt':{'$between':[moment()[_0xb11c('0xd')](_0xb11c('0xe'))[_0xb11c('0xf')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0xb11c('0x10')]('day')[_0xb11c('0xf')](_0xb11c('0x11'))]}},'attributes':[_0xb11c('0x12'),_0xb11c('0x13'),'duration',_0xb11c('0x14')]},'log':_0xb11c('0x15')});};}; \ No newline at end of file +var _0x92d9=['CreateVoiceCallReport','merge','calleridnum','context','callerid','DOCUMENTATION','Request','GetVoiceCallReport','outbound','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','disposition','duration','billableseconds','GetVoiceCallReports','moment','util','lodash','../client','create'];(function(_0x149965,_0x1ff46a){var _0x56fafa=function(_0x2bd6f5){while(--_0x2bd6f5){_0x149965['push'](_0x149965['shift']());}};_0x56fafa(++_0x1ff46a);}(_0x92d9,0x15b));var _0x992d=function(_0x4da6a3,_0x15f71c){_0x4da6a3=_0x4da6a3-0x0;var _0xd252a6=_0x92d9[_0x4da6a3];return _0xd252a6;};'use strict';var moment=require(_0x992d('0x0'));var util=require(_0x992d('0x1'));var _=require(_0x992d('0x2'));var client=require(_0x992d('0x3'));exports[_0x992d('0x4')]=function(_0xf8887b){return client['Request'](_0x992d('0x5'),{'body':_[_0x992d('0x6')](_0xf8887b,{'source':_0xf8887b[_0x992d('0x7')],'destinationcontext':_0xf8887b[_0x992d('0x8')],'callerid':_0xf8887b[_0x992d('0x9')],'amaflags':_0x992d('0xa')}),'log':_0x992d('0x5')});};exports['getVoiceCallReports']=function(){return function(){return client[_0x992d('0xb')](_0x992d('0xc'),{'options':{'where':{'type':[_0x992d('0xd')],'createdAt':{'$between':[moment()['startOf'](_0x992d('0xe'))[_0x992d('0xf')](_0x992d('0x10')),moment()[_0x992d('0x11')](_0x992d('0xe'))[_0x992d('0xf')](_0x992d('0x10'))]}},'attributes':['type',_0x992d('0x12'),_0x992d('0x13'),_0x992d('0x14')]},'log':_0x992d('0x15')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index a5ac038..fc4a218 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 _0x452b=['../client','create','Request','CreateVoiceDialReport'];(function(_0x1f4982,_0x1a358e){var _0xae85d1=function(_0x11258f){while(--_0x11258f){_0x1f4982['push'](_0x1f4982['shift']());}};_0xae85d1(++_0x1a358e);}(_0x452b,0x100));var _0xb452=function(_0xca9594,_0x9c91c5){_0xca9594=_0xca9594-0x0;var _0x4db75a=_0x452b[_0xca9594];return _0x4db75a;};'use strict';var client=require(_0xb452('0x0'));exports[_0xb452('0x1')]=function(_0x46d098){return client[_0xb452('0x2')](_0xb452('0x3'),{'body':_0x46d098,'log':'CreateVoiceDialReport'});}; \ No newline at end of file +var _0x472d=['create','Request','CreateVoiceDialReport','../client'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0x472d,0xf7));var _0xd472=function(_0x566ebb,_0xe369cf){_0x566ebb=_0x566ebb-0x0;var _0x4ca0ed=_0x472d[_0x566ebb];return _0x4ca0ed;};'use strict';var client=require(_0xd472('0x0'));exports[_0xd472('0x1')]=function(_0x4d9e39){return client[_0xd472('0x2')](_0xd472('0x3'),{'body':_0x4d9e39,'log':'CreateVoiceDialReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index afdb17b..d672c1a 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 _0xc112=['recordingFormat','../client','getVoiceExtensions','Request','exten'];(function(_0x37a7c6,_0x3a84b6){var _0x539905=function(_0xa00c20){while(--_0xa00c20){_0x37a7c6['push'](_0x37a7c6['shift']());}};_0x539905(++_0x3a84b6);}(_0xc112,0xec));var _0x2c11=function(_0x2351e5,_0x4537b5){_0x2351e5=_0x2351e5-0x0;var _0x4f6189=_0xc112[_0x2351e5];return _0x4f6189;};'use strict';var client=require(_0x2c11('0x0'));exports[_0x2c11('0x1')]=function(){return function(){return client[_0x2c11('0x2')]('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id',_0x2c11('0x3'),_0x2c11('0x4')],'where':{'VoiceExtensionId':null}},'log':_0x2c11('0x1')});};}; \ No newline at end of file +var _0x90db=['GetVoiceExtension','getVoiceExtensions','Request'];(function(_0x4b7b62,_0x4920a9){var _0x2280df=function(_0x21e1f8){while(--_0x21e1f8){_0x4b7b62['push'](_0x4b7b62['shift']());}};_0x2280df(++_0x4920a9);}(_0x90db,0x1c0));var _0xb90d=function(_0x68ee8b,_0x3cc6c5){_0x68ee8b=_0x68ee8b-0x0;var _0x5148f7=_0x90db[_0x68ee8b];return _0x5148f7;};'use strict';var client=require('../client');exports[_0xb90d('0x0')]=function(){return function(){return client[_0xb90d('0x1')](_0xb90d('0x2'),{'options':{'raw':!![],'attributes':['id','exten','recordingFormat'],'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 6a39ae1..32d6fc2 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 _0x6483=['timeout','dialRecallMeTimeout','dialOrderByScheduledAt','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','Trunk','callerid','active','TrunkBackup','Interval','Intervals','../client','getVoiceQueues','Request','name','acwTimeout','autopause','monitor_format','type','dialActive','dialLimitQueue','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueProject','dialCongestionMaxRetry','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialCheckDuplicateType','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength'];(function(_0x202c66,_0x380f21){var _0x3548ff=function(_0x4e6d7a){while(--_0x4e6d7a){_0x202c66['push'](_0x202c66['shift']());}};_0x3548ff(++_0x380f21);}(_0x6483,0x1e2));var _0x3648=function(_0x42dfd8,_0x1d246b){_0x42dfd8=_0x42dfd8-0x0;var _0x4e87d9=_0x6483[_0x42dfd8];return _0x4e87d9;};'use strict';var client=require(_0x3648('0x0'));exports[_0x3648('0x1')]=function(){return function(){return client[_0x3648('0x2')]('GetVoiceQueue',{'options':{'raw':![],'attributes':['id',_0x3648('0x3'),'acw',_0x3648('0x4'),_0x3648('0x5'),_0x3648('0x6'),_0x3648('0x7'),_0x3648('0x8'),'dialMethod','dialLimitChannel',_0x3648('0x9'),'dialPowerLevel',_0x3648('0xa'),_0x3648('0xb'),_0x3648('0xc'),_0x3648('0xd'),_0x3648('0xe'),_0x3648('0xf'),'dialQueueOptions','dialQueueTimeout',_0x3648('0x10'),_0x3648('0x11'),'dialCongestionRetryFrequency',_0x3648('0x12'),_0x3648('0x13'),_0x3648('0x14'),'dialNoAnswerRetryFrequency',_0x3648('0x15'),_0x3648('0x16'),_0x3648('0x17'),'dialPrefix',_0x3648('0x18'),'dialAMDActive','dialAMDInitialSilence',_0x3648('0x19'),_0x3648('0x1a'),'dialAMDTotalAnalysisTime',_0x3648('0x1b'),'dialAMDBetweenWordsSilence',_0x3648('0x1c'),_0x3648('0x1d'),_0x3648('0x1e'),_0x3648('0x1f'),_0x3648('0x20'),'dialRecallInQueue',_0x3648('0x21'),'dialAgiAfterHangupAgent',_0x3648('0x22'),_0x3648('0x23'),_0x3648('0x6'),_0x3648('0x24'),_0x3648('0x25'),_0x3648('0x26'),_0x3648('0x27'),_0x3648('0x28'),_0x3648('0x29'),'dialDropRetryFrequency',_0x3648('0x2a'),_0x3648('0x2b'),_0x3648('0x2c'),_0x3648('0x2d'),_0x3648('0x2e'),_0x3648('0x2f'),'mandatoryDisposition',_0x3648('0x30'),_0x3648('0x31'),_0x3648('0x32'),'dialPreviewRecallmeReminder'],'include':[{'model':_0x3648('0x33'),'as':_0x3648('0x33'),'attributes':['id',_0x3648('0x3'),_0x3648('0x34'),_0x3648('0x35')]},{'model':'Pause','as':'mandatoryDispositionPause','attributes':['id','name']},{'model':_0x3648('0x33'),'as':_0x3648('0x36'),'attributes':['id','name','callerid','active']},{'model':_0x3648('0x37'),'as':'Interval','attributes':['id',_0x3648('0x3')],'include':[{'model':_0x3648('0x37'),'as':_0x3648('0x38'),'attributes':['id','name','interval']}]}]},'log':_0x3648('0x1')});};}; \ No newline at end of file +var _0x296f=['Interval','Intervals','interval','../client','getVoiceQueues','GetVoiceQueue','name','acw','acwTimeout','autopause','monitor_format','type','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialQueueOptions','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialAgiAfterHangupAgent','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPreviewRecallmeReminder','Trunk','callerid','active','TrunkBackup'];(function(_0x19fd49,_0x38802e){var _0x149afb=function(_0x37374e){while(--_0x37374e){_0x19fd49['push'](_0x19fd49['shift']());}};_0x149afb(++_0x38802e);}(_0x296f,0x83));var _0xf296=function(_0x304b67,_0x31cb39){_0x304b67=_0x304b67-0x0;var _0x493afb=_0x296f[_0x304b67];return _0x493afb;};'use strict';var client=require(_0xf296('0x0'));exports[_0xf296('0x1')]=function(){return function(){return client['Request'](_0xf296('0x2'),{'options':{'raw':![],'attributes':['id',_0xf296('0x3'),_0xf296('0x4'),_0xf296('0x5'),_0xf296('0x6'),_0xf296('0x7'),_0xf296('0x8'),'dialActive',_0xf296('0x9'),_0xf296('0xa'),_0xf296('0xb'),_0xf296('0xc'),_0xf296('0xd'),_0xf296('0xe'),_0xf296('0xf'),_0xf296('0x10'),_0xf296('0x11'),'dialOriginateTimeout',_0xf296('0x12'),'dialQueueTimeout',_0xf296('0x13'),_0xf296('0x14'),_0xf296('0x15'),_0xf296('0x16'),_0xf296('0x17'),_0xf296('0x18'),_0xf296('0x19'),_0xf296('0x1a'),'dialTimezone',_0xf296('0x1b'),_0xf296('0x1c'),_0xf296('0x1d'),_0xf296('0x1e'),_0xf296('0x1f'),'dialAMDGreeting',_0xf296('0x20'),_0xf296('0x21'),_0xf296('0x22'),_0xf296('0x23'),_0xf296('0x24'),_0xf296('0x25'),_0xf296('0x26'),_0xf296('0x27'),_0xf296('0x28'),_0xf296('0x29'),'dialOrderByScheduledAt',_0xf296('0x2a'),'dialAgiAfterHangupClient','dialQueueProject2','monitor_format','strategy',_0xf296('0x2b'),_0xf296('0x2c'),'dialNoSuchNumberMaxRetry',_0xf296('0x2d'),_0xf296('0x2e'),_0xf296('0x2f'),_0xf296('0x30'),_0xf296('0x31'),_0xf296('0x32'),_0xf296('0x33'),_0xf296('0x34'),_0xf296('0x35'),_0xf296('0x36'),_0xf296('0x37'),'dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe',_0xf296('0x38')],'include':[{'model':_0xf296('0x39'),'as':_0xf296('0x39'),'attributes':['id',_0xf296('0x3'),_0xf296('0x3a'),_0xf296('0x3b')]},{'model':'Pause','as':'mandatoryDispositionPause','attributes':['id',_0xf296('0x3')]},{'model':_0xf296('0x39'),'as':_0xf296('0x3c'),'attributes':['id',_0xf296('0x3'),_0xf296('0x3a'),_0xf296('0x3b')]},{'model':_0xf296('0x3d'),'as':_0xf296('0x3d'),'attributes':['id',_0xf296('0x3')],'include':[{'model':_0xf296('0x3d'),'as':_0xf296('0x3e'),'attributes':['id',_0xf296('0x3'),_0xf296('0x3f')]}]}]},'log':_0xf296('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index dfdd262..66024bc 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(_0x2fd648,_0x30d2ce){var _0x5661a1=function(_0x3ad75a){while(--_0x3ad75a){_0x2fd648['push'](_0x2fd648['shift']());}};_0x5661a1(++_0x30d2ce);}(_0xa9e0,0x123));var _0x0a9e=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa9e0[_0xae7c2f];return _0x5d7001;};'use strict';var moment=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var client=require(_0x0a9e('0x2'));exports['create']=function(_0x550fbc){return client[_0x0a9e('0x3')]('CreateVoiceQueueReport',{'body':_0x550fbc,'log':_0x0a9e('0x4')});};exports[_0x0a9e('0x5')]=function(){return function(){return client[_0x0a9e('0x3')](_0x0a9e('0x6'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x0a9e('0x7')]('day')[_0x0a9e('0x8')](_0x0a9e('0x9')),moment()[_0x0a9e('0xa')]('day')['format'](_0x0a9e('0x9'))]}},'attributes':['uniqueid','queue',_0x0a9e('0xb'),_0x0a9e('0xc'),_0x0a9e('0xd'),_0x0a9e('0xe'),_0x0a9e('0xf'),_0x0a9e('0x10'),'queuecallerabandon','queuecallerabandonAt']},'log':'GetVoiceQueueReports'});};}; \ No newline at end of file +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(_0x33b82c,_0x4cb74b){var _0x30ac29=function(_0x6dba15){while(--_0x6dba15){_0x33b82c['push'](_0x33b82c['shift']());}};_0x30ac29(++_0x4cb74b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xa9e0[_0x3c2a69];return _0x596bc8;};'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 444df8e..a212ddb 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 _0xc3ca=['getVoiceQueueRtPauses','../client','Request','GetVoiceQueueRtPauses'];(function(_0x22c3f6,_0x1ddda0){var _0x18b3cf=function(_0x59572b){while(--_0x59572b){_0x22c3f6['push'](_0x22c3f6['shift']());}};_0x18b3cf(++_0x1ddda0);}(_0xc3ca,0x199));var _0xac3c=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0xc3ca[_0x4b055c];return _0x4b62bb;};'use strict';var client=require(_0xac3c('0x0'));exports['getVoiceQueueRtPauses']=function(_0x4b6031){return function(){return client[_0xac3c('0x1')](_0xac3c('0x2'),{'options':{'where':{'VoiceQueueId':_0x4b6031,'paused':!![]},'raw':!![]},'log':_0xac3c('0x3')});};}; \ No newline at end of file +var _0x6306=['Request','../client'];(function(_0x22d19d,_0x379051){var _0x103fc2=function(_0x10b414){while(--_0x10b414){_0x22d19d['push'](_0x22d19d['shift']());}};_0x103fc2(++_0x379051);}(_0x6306,0x159));var _0x6630=function(_0x1ea9df,_0x2c718b){_0x1ea9df=_0x1ea9df-0x0;var _0x2b2854=_0x6306[_0x1ea9df];return _0x2b2854;};'use strict';var client=require(_0x6630('0x0'));exports['getVoiceQueueRtPauses']=function(_0x553baf){return function(){return client[_0x6630('0x1')]('GetVoiceQueueRtPauses',{'options':{'where':{'VoiceQueueId':_0x553baf,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index b18c45c..7872190 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(_0x530a76,_0x37fd66){var _0x1b7a4d=function(_0xf58347){while(--_0xf58347){_0x530a76['push'](_0x530a76['shift']());}};_0x1b7a4d(++_0x37fd66);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x7995('0x0'));var client=require(_0x7995('0x1'));exports[_0x7995('0x2')]=function(_0x10a05d){return client['Request'](_0x7995('0x3'),{'body':_[_0x7995('0x4')](_0x10a05d,{'value':_0x10a05d[_0x7995('0x5')]}),'log':_0x7995('0x3')});}; \ No newline at end of file +var _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x35673d,_0x557329){var _0x57f591=function(_0x36c9f4){while(--_0x36c9f4){_0x35673d['push'](_0x35673d['shift']());}};_0x57f591(++_0x557329);}(_0x7a54,0x106));var _0x47a5=function(_0x566ca6,_0xa21fc5){_0x566ca6=_0x566ca6-0x0;var _0xf301f5=_0x7a54[_0x566ca6];return _0xf301f5;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index 4bc7b13..c8a074e 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 _0x318b=['transfereeconnectedlinenum','transfereeaccountcode','transfereeexten','transfereelinkedid','isexternal','context','attendedTransfer','origtransfererchannel','origtransferercalleridname','secondtransferercontext','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetexten','origtransferercontext','origtransfererexten','../client','transfers','blindTransfer','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transfererconnectedlinenum','transfererconnectedlinename','transferercontext','transfererexten','transfereechannel','transfereecalleridname'];(function(_0x4a394c,_0x26053d){var _0x1bd9b3=function(_0x583ffd){while(--_0x583ffd){_0x4a394c['push'](_0x4a394c['shift']());}};_0x1bd9b3(++_0x26053d);}(_0x318b,0x146));var _0xb318=function(_0xd9c529,_0x19f8cc){_0xd9c529=_0xd9c529-0x0;var _0x146760=_0x318b[_0xd9c529];return _0x146760;};'use strict';var client=require(_0xb318('0x0'));exports[_0xb318('0x1')]={};exports[_0xb318('0x2')]=function(_0x19bfd7){return client[_0xb318('0x3')](_0xb318('0x4'),{'body':{'result':_0x19bfd7[_0xb318('0x5')],'transfererchannel':_0x19bfd7[_0xb318('0x6')],'transferercalleridnum':_0x19bfd7[_0xb318('0x7')],'transferercalleridname':_0x19bfd7['transferercalleridname'],'transfererconnectedlinenum':_0x19bfd7[_0xb318('0x8')],'transfererconnectedlinename':_0x19bfd7[_0xb318('0x9')],'transfereraccountcode':_0x19bfd7['transfereraccountcode'],'transferercontext':_0x19bfd7[_0xb318('0xa')],'transfererexten':_0x19bfd7[_0xb318('0xb')],'transfererlinkedid':_0x19bfd7['transfererlinkedid'],'transfereechannel':_0x19bfd7[_0xb318('0xc')],'transfereecalleridnum':_0x19bfd7['transfereecalleridnum'],'transfereecalleridname':_0x19bfd7[_0xb318('0xd')],'transfereeconnectedlinenum':_0x19bfd7[_0xb318('0xe')],'transfereeconnectedlinename':_0x19bfd7['transfereeconnectedlinename'],'transfereeaccountcode':_0x19bfd7[_0xb318('0xf')],'transfereecontext':_0x19bfd7['transfereecontext'],'transfereeexten':_0x19bfd7[_0xb318('0x10')],'transfereelinkedid':_0x19bfd7[_0xb318('0x11')],'isexternal':_0x19bfd7[_0xb318('0x12')],'context':_0x19bfd7[_0xb318('0x13')],'extension':_0x19bfd7['extension'],'type':'blind'},'log':_0xb318('0x4')});};exports[_0xb318('0x14')]=function(_0x3a0be2){return client[_0xb318('0x3')](_0xb318('0x4'),{'body':{'result':_0x3a0be2[_0xb318('0x5')],'transfererchannel':_0x3a0be2[_0xb318('0x15')],'transferercalleridnum':_0x3a0be2['origtransferercalleridnum'],'transferercalleridname':_0x3a0be2[_0xb318('0x16')],'transfererconnectedlinenum':_0x3a0be2['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x3a0be2['secondtransfererconnectedlinename'],'transfereraccountcode':_0x3a0be2['origtransfereraccountcode'],'transferercontext':_0x3a0be2[_0xb318('0x17')],'transfererexten':_0x3a0be2['secondtransfererexten'],'transfererlinkedid':_0x3a0be2[_0xb318('0x18')],'transfereechannel':_0x3a0be2[_0xb318('0x19')],'transfereecalleridnum':_0x3a0be2[_0xb318('0x1a')],'transfereecalleridname':_0x3a0be2[_0xb318('0x1b')],'transfereeconnectedlinenum':_0x3a0be2[_0xb318('0x1c')],'transfereeconnectedlinename':_0x3a0be2[_0xb318('0x1d')],'transfereeaccountcode':_0x3a0be2[_0xb318('0x1e')],'transfereecontext':_0x3a0be2['transfertargetcontext'],'transfereeexten':_0x3a0be2[_0xb318('0x1f')],'transfereelinkedid':_0x3a0be2['transfertargetlinkedid'],'isexternal':_0x3a0be2[_0xb318('0x12')],'context':_0x3a0be2[_0xb318('0x20')],'extension':_0x3a0be2[_0xb318('0x21')],'type':'attended'},'log':_0xb318('0x4')});}; \ No newline at end of file +var _0xa649=['origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','transfertargetcalleridnum','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransfererexten','attended','../client','transfers','blindTransfer','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transfererexten','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereecontext','transfereeexten','transfereelinkedid','context','extension','CreateVoiceTransferReport','Request','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum'];(function(_0x39ffd1,_0x299703){var _0x31267e=function(_0x11b420){while(--_0x11b420){_0x39ffd1['push'](_0x39ffd1['shift']());}};_0x31267e(++_0x299703);}(_0xa649,0x1d4));var _0x9a64=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xa649[_0x19950b];return _0x3c6b41;};'use strict';var client=require(_0x9a64('0x0'));exports[_0x9a64('0x1')]={};exports[_0x9a64('0x2')]=function(_0x308a2b){return client['Request']('CreateVoiceTransferReport',{'body':{'result':_0x308a2b[_0x9a64('0x3')],'transfererchannel':_0x308a2b[_0x9a64('0x4')],'transferercalleridnum':_0x308a2b[_0x9a64('0x5')],'transferercalleridname':_0x308a2b[_0x9a64('0x6')],'transfererconnectedlinenum':_0x308a2b[_0x9a64('0x7')],'transfererconnectedlinename':_0x308a2b[_0x9a64('0x8')],'transfereraccountcode':_0x308a2b[_0x9a64('0x9')],'transferercontext':_0x308a2b['transferercontext'],'transfererexten':_0x308a2b[_0x9a64('0xa')],'transfererlinkedid':_0x308a2b['transfererlinkedid'],'transfereechannel':_0x308a2b['transfereechannel'],'transfereecalleridnum':_0x308a2b[_0x9a64('0xb')],'transfereecalleridname':_0x308a2b[_0x9a64('0xc')],'transfereeconnectedlinenum':_0x308a2b[_0x9a64('0xd')],'transfereeconnectedlinename':_0x308a2b[_0x9a64('0xe')],'transfereeaccountcode':_0x308a2b['transfereeaccountcode'],'transfereecontext':_0x308a2b[_0x9a64('0xf')],'transfereeexten':_0x308a2b[_0x9a64('0x10')],'transfereelinkedid':_0x308a2b[_0x9a64('0x11')],'isexternal':_0x308a2b['isexternal'],'context':_0x308a2b[_0x9a64('0x12')],'extension':_0x308a2b[_0x9a64('0x13')],'type':'blind'},'log':_0x9a64('0x14')});};exports['attendedTransfer']=function(_0x332611){return client[_0x9a64('0x15')]('CreateVoiceTransferReport',{'body':{'result':_0x332611[_0x9a64('0x3')],'transfererchannel':_0x332611[_0x9a64('0x16')],'transferercalleridnum':_0x332611[_0x9a64('0x17')],'transferercalleridname':_0x332611[_0x9a64('0x18')],'transfererconnectedlinenum':_0x332611[_0x9a64('0x19')],'transfererconnectedlinename':_0x332611['secondtransfererconnectedlinename'],'transfereraccountcode':_0x332611[_0x9a64('0x1a')],'transferercontext':_0x332611['secondtransferercontext'],'transfererexten':_0x332611[_0x9a64('0x1b')],'transfererlinkedid':_0x332611[_0x9a64('0x1c')],'transfereechannel':_0x332611['transfertargetchannel'],'transfereecalleridnum':_0x332611[_0x9a64('0x1d')],'transfereecalleridname':_0x332611['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x332611[_0x9a64('0x1e')],'transfereeconnectedlinename':_0x332611[_0x9a64('0x1f')],'transfereeaccountcode':_0x332611[_0x9a64('0x20')],'transfereecontext':_0x332611[_0x9a64('0x21')],'transfereeexten':_0x332611[_0x9a64('0x22')],'transfereelinkedid':_0x332611[_0x9a64('0x23')],'isexternal':_0x332611['isexternal'],'context':_0x332611['origtransferercontext'],'extension':_0x332611[_0x9a64('0x24')],'type':_0x9a64('0x25')},'log':_0x9a64('0x14')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index dd28e57..c2caaf2 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(_0x3fa5dd,_0x444d81){var _0x52309f=function(_0x3b8429){while(--_0x3b8429){_0x3fa5dd['push'](_0x3fa5dd['shift']());}};_0x52309f(++_0x444d81);}(_0xb10b,0x12a));var _0xbb10=function(_0x1a6269,_0x5deea5){_0x1a6269=_0x1a6269-0x0;var _0x536f68=_0xb10b[_0x1a6269];return _0x536f68;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var jayson=require(_0xbb10('0x1'));var schema=require(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var config=require('../../../config/environment');var properties=require(_0xbb10('0x4'));var ami=require(_0xbb10('0x5'));var VoiceQueueSummary=require(_0xbb10('0x6'));exports[_0xbb10('0x7')]=function(_0x49baf4,_0x312b72,_0x481979){return new Promise(function(_0x328583,_0x3cdd53){var _0x513741={'QueuePause':function(_0x1b9e94){return new Promise(function(_0x3fb675){var _0x21370f=util[_0xbb10('0x8')](_0xbb10('0x9'),_0xbb10('0xa'),_0x1b9e94[_0xbb10('0xb')]);if(_0x49baf4[_0xbb10('0xc')]&&_0x49baf4['timers'][_0x21370f]&&_0x49baf4['timers'][_0x21370f][_0xbb10('0xd')]){_0x49baf4[_0xbb10('0xc')][_0x21370f][_0xbb10('0xe')]();}if(_0x49baf4['agents'][_0x21370f]){_0x49baf4[_0xbb10('0xf')][_0x21370f]['updateStatusRealtime']({'state':_0x49baf4[_0xbb10('0xf')][_0x21370f][_0xbb10('0x10')],'statePause':_0x1b9e94[_0xbb10('0x11')]?!![]:![]});}_0x3fb675({'code':0xc8,'message':_0xbb10('0x12')});});},'Reload':function(_0x442548){var _0x147230=this;return new Promise(function(_0x58a612,_0x26e021){if(ami[_0xbb10('0x13')]()==![]){return _0x26e021(_0x147230[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}_0x442548=_[_0xbb10('0x19')](_0x442548,_[_0xbb10('0x1a')](properties['reload'][_0xbb10('0x1b')]));_0x442548[_0xbb10('0x1c')]=_0xbb10('0x1d');return ami[_0xbb10('0x1e')](_0x442548)[_0xbb10('0x1f')](function(_0x1682a4){_0x58a612({'code':0xc8,'message':_0x1682a4[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xbf2906){_0x26e021(_0x147230[_0xbb10('0x14')](0x1f5,_0xbf2906['message']));});});},'Command':function(_0x5ff0cf){var _0x19f48d=this;return new Promise(function(_0x388fab,_0x109908){if(ami[_0xbb10('0x13')]()==![]){return _0x109908(_0x19f48d[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected']['join']('\x20')));}_0x5ff0cf=_[_0xbb10('0x19')](_0x5ff0cf,_0xbb10('0x22'));_0x5ff0cf[_0xbb10('0x1c')]=_0xbb10('0x23');return ami[_0xbb10('0x1e')](_0x5ff0cf)[_0xbb10('0x1f')](function(_0x407cb4){_0x388fab({'code':0xc8,'message':_0x407cb4[_0xbb10('0x24')]});})[_0xbb10('0x21')](function(_0x395404){_0x109908(_0x19f48d[_0xbb10('0x14')](0x1f5,_0x395404[_0xbb10('0x20')]));});});},'VoiceQueues':function(){return new Promise(function(_0x537898){var _0x4fedac=[];for(var _0x4fb5e0 in _0x49baf4[_0xbb10('0x25')]){if(_0x49baf4[_0xbb10('0x25')][_0xbb10('0x26')](_0x4fb5e0)){var _0x4e25ff=_0x49baf4[_0xbb10('0x25')][_0x4fb5e0];var _0x24d586=new VoiceQueueSummary(_0x4e25ff);_0x4fedac[_0xbb10('0x27')](_0x24d586);}}_0x537898({'count':_0x4fedac[_0xbb10('0x28')],'rows':_0x4fedac});});},'UpdateVoiceQueue':function(_0x1acce9){return new Promise(function(_0x20d946,_0x2a0e8b){var _0x4aabb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x25')],{'id':parseInt(_0x1acce9['id'])});var _0xfc3595=_[_0xbb10('0x2a')](_0x1acce9,['id']);if(_0x4aabb9){for(var _0x1d30aa in _0xfc3595){if(typeof _0xfc3595[_0x1d30aa]!==_0xbb10('0x2b')&&typeof _0x4aabb9[_0x1d30aa]!=='undefined'){_0x4aabb9[_0x1d30aa]=_0xfc3595[_0x1d30aa];}}_0x20d946(_0x4aabb9);}else{_0x2a0e8b();}});},'VoiceChannels':function(){return new Promise(function(_0x221624){var _0x4ee02e=_[_0xbb10('0x2c')](_0x49baf4['channels']);_0x221624({'count':_0x4ee02e[_0xbb10('0x28')],'rows':_0x4ee02e});});},'VoiceChannelMixMonitor':function(_0x1dcc9c){var _0x1b59f9=this;return new Promise(function(_0x491db4,_0x518d47){if(ami[_0xbb10('0x13')]()==![]){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x37a83f=schema(properties[_0xbb10('0x2d')])[_0xbb10('0x2')](_0x1dcc9c);if(_0x37a83f['length']>0x0){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x37a83f,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0xfb2c5e=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x2f')],{'uniqueid':_0x1dcc9c[_0xbb10('0x30')]});if(_0xfb2c5e&&_0xfb2c5e[_0xbb10('0x31')]){var _0x56943c=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1dcc9c[_0xbb10('0x33')]||_0x1dcc9c[_0xbb10('0x30')],_0x1dcc9c['format']||_0xbb10('0x34'));return ami['Action']({'action':'MixMonitor','channel':_0xfb2c5e[_0xbb10('0x31')],'file':_0x56943c,'options':_0xbb10('0x35')})[_0xbb10('0x1f')](function(_0x120d21){var _0x15d895=_[_0xbb10('0x29')](_0xfb2c5e['monitors'],{'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')]()});if(_['isNil'](_0x15d895)){_0xfb2c5e['monitors']['push']({'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')](),'createdAt':moment()[_0xbb10('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x120d21[_0xbb10('0x38')],'status':_0xbb10('0x39')});}else{_0x15d895[_0xbb10('0x38')]=_0x120d21['mixmonitorid'];_0x15d895[_0xbb10('0x3a')]=_0xbb10('0x39');}_0x491db4({'code':0xc8,'message':[_0x1dcc9c[_0xbb10('0x30')],_0xbb10('0x3b'),_0x120d21['mixmonitorid']][_0xbb10('0x18')]('\x20'),'mixmonitorid':_0x120d21[_0xbb10('0x38')]});})['catch'](function(_0xe2040f){_0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f5,[_0x1dcc9c[_0xbb10('0x30')],_0xe2040f[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x518d47(_0x1b59f9['error'](0x1f5,_0xbb10('0x3c')));}});},'VoiceChannelStopMixMonitor':function(_0x1c7fae){var _0x3e7b4c=this;return new Promise(function(_0x3d3c41,_0x4943d9){if(ami[_0xbb10('0x13')]()==![]){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')]['username'],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x54ac18=schema(properties['voicechannel'])[_0xbb10('0x2')](_0x1c7fae);if(_0x54ac18['length']>0x0){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x54ac18,'message')[_0xbb10('0x18')](',\x20')));}var _0x1d82bf=_[_0xbb10('0x29')](_0x49baf4['channels'],{'uniqueid':_0x1c7fae[_0xbb10('0x30')]});if(_0x1d82bf){return Promise[_0xbb10('0x3d')]()[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x3e'),'channel':_0x1d82bf[_0xbb10('0x31')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})[_0xbb10('0x21')](function(){});}})[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x3f')]){return ami[_0xbb10('0x1e')]({'action':'StopMixMonitor','channel':_0x1d82bf[_0xbb10('0x3f')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})['catch'](function(){});}})[_0xbb10('0x1f')](function(){var _0x2f5027=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]});if(_0x2f5027){_0x2f5027[_0xbb10('0x3a')]=_0xbb10('0x41');}})['then'](function(){var _0x4a9793=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1c7fae[_0xbb10('0x33')]||_0x1c7fae['uniqueid'],_0x1c7fae['format']||_0xbb10('0x34'));var _0x34cf4e=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'filename':_0xbb10('0x36')+_0x4a9793[_0xbb10('0x37')]()});if(_0x34cf4e){_0x34cf4e[_0xbb10('0x3a')]=_0xbb10('0x41');}})[_0xbb10('0x1f')](function(){_0x3d3c41({'code':0xc8,'message':[_0x1c7fae[_0xbb10('0x30')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0xbb10('0x21')](function(_0x467dba){_0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,[_0x1c7fae[_0xbb10('0x30')],_0x467dba[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannels':function(_0x1214f7){var _0x19ca3e=this;return new Promise(function(_0x20e18a){var _0x61e689=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x42')]);var _0x547a7a={'count':_0x61e689[_0xbb10('0x28')],'rows':_0x61e689};if(_0x1214f7&&_0x1214f7['type']){if(![_0xbb10('0x43'),_0xbb10('0x44')][_0xbb10('0x45')](_0x1214f7[_0xbb10('0x46')])){return _0x3cdd53(_0x19ca3e[_0xbb10('0x14')](0x190,_0xbb10('0x47')));}var _0x2e3326=_[_0xbb10('0x48')](_0x61e689,function(_0x180400){return _0x180400[_0xbb10('0x46')]===_0x1214f7[_0xbb10('0x46')];});_0x547a7a[_0xbb10('0x49')]=_0x2e3326[_0xbb10('0x28')];_0x547a7a[_0xbb10('0x4a')]=_0x2e3326;}_0x20e18a(_0x547a7a);});},'VoiceQueuesChannel':function(_0x4475e1){var _0x5de0cc=this;return new Promise(function(_0x4571b6,_0x466eb7){var _0x1b83a9=schema(properties[_0xbb10('0x4b')])[_0xbb10('0x2')](_0x4475e1);if(_0x1b83a9[_0xbb10('0x28')]>0x0){return _0x466eb7(_0x5de0cc['error'](0x1f4,_[_0xbb10('0x2e')](_0x1b83a9,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x14fed3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x4475e1[_0xbb10('0x30')]});if(_0x14fed3){_0x4571b6(_0x14fed3);}else{return _0x466eb7(_0x5de0cc[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelHangup':function(_0x40c4fb){var _0x2eb05a=this;return new Promise(function(_0x2a1ce1,_0x16932f){if(ami['isConnected']()==![]){return _0x16932f(_0x2eb05a['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')]['join']('\x20')));}var _0x506498=schema(properties[_0xbb10('0x4c')])[_0xbb10('0x2')](_0x40c4fb);if(_0x506498[_0xbb10('0x28')]>0x0){return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x506498,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x4a5fb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x40c4fb['uniqueid']});if(_0x4a5fb9&&_0x4a5fb9['channel']){return ami['Action']({'action':_0xbb10('0x4d'),'channel':_0x4a5fb9[_0xbb10('0x31')]})[_0xbb10('0x1f')](function(_0x5bd1c0){_0x2a1ce1({'code':0xc8,'message':[_0x40c4fb['uniqueid'],_0x5bd1c0['message'][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0x4e9fbd){_0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,[_0x40c4fb[_0xbb10('0x30')],_0x4e9fbd['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelRedirect':function(_0x237246){var _0x54b7c5=this;return new Promise(function(_0x43eaec,_0xec48ac){if(ami[_0xbb10('0x13')]()==![]){return _0xec48ac(_0x54b7c5['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected'][_0xbb10('0x18')]('\x20')));}var _0x31e85e=schema(properties[_0xbb10('0x4e')])[_0xbb10('0x2')](_0x237246);if(_0x31e85e['length']>0x0){return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x31e85e,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x56b3a3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x237246[_0xbb10('0x30')]});if(_0x56b3a3&&_0x56b3a3[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x4f'),'channel':_0x56b3a3[_0xbb10('0x31')],'exten':_0x237246['exten'],'context':_0x237246['context']||_0x56b3a3['context'],'priority':0x1})[_0xbb10('0x1f')](function(_0x9c672d){_0x43eaec({'code':0xc8,'message':[_0x237246[_0xbb10('0x30')],_0x9c672d['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0xd9e743){_0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,[_0x237246[_0xbb10('0x30')],_0xd9e743[_0xbb10('0x20')]['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'Agents':function(_0x14f16b){return new Promise(function(_0x2aaaa6){var _0x5bfc68=_['values'](_0x49baf4['agents']);if(_0x14f16b&&_0x14f16b['id']){var _0x329da7=_[_0xbb10('0x29')](_0x5bfc68,function(_0x36917f){return _0x36917f['id']===_0x14f16b['id'];});_0x2aaaa6(_0x329da7);}else{_0x2aaaa6({'count':_0x5bfc68[_0xbb10('0x28')],'rows':_0x5bfc68});}});},'Telephones':function(){return new Promise(function(_0x2f7d2a){var _0x1d40b8=_['values'](_0x49baf4[_0xbb10('0x50')]);_0x2f7d2a({'count':_0x1d40b8['length'],'rows':_0x1d40b8});});},'Trunks':function(){return new Promise(function(_0x4fe3b5){var _0x519a54=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x51')]);_0x4fe3b5({'count':_0x519a54[_0xbb10('0x28')],'rows':_0x519a54});});},'OutboundChannels':function(){return new Promise(function(_0x108f99){var _0x5ce94f=_[_0xbb10('0x2c')](_0x49baf4['outboundChannels']);_0x108f99({'count':_0x5ce94f['length'],'rows':_0x5ce94f});});},'Outbound':function(){return new Promise(function(_0x165fe9){_0x165fe9(_0x49baf4[_0xbb10('0x44')]);});},'Campaigns':function(){return new Promise(function(_0x29529c){var _0x2bd2ab=_[_0xbb10('0x2c')](_0x49baf4['campaigns']);_0x29529c({'count':_0x2bd2ab[_0xbb10('0x28')],'rows':_0x2bd2ab});});},'VoiceQueuesPreview':function(_0x19fcec){var _0x2c6429=this;return new Promise(function(_0x3f3d38,_0x43cdb7){_0x312b72[_0xbb10('0x52')](_0x19fcec['id'])[_0xbb10('0x1f')](function(_0x53fa98){_0x3f3d38({'code':0xc8,'message':_0x53fa98[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x30f3ea){_0x43cdb7(_0x2c6429[_0xbb10('0x14')](0x1f4,_0x30f3ea[_0xbb10('0x20')]));});});},'EventManager':function(_0x172be3){var _0xa3b23=this;return new Promise(function(_0x312a08,_0x5a4429){if(!_0x172be3[_0xbb10('0x53')]){return _0x5a4429(_0xa3b23[_0xbb10('0x14')](0x1f4,_0xbb10('0x54')));}ami['emit']('custom:'+_0x172be3['event'],_0x172be3[_0xbb10('0x20')]);_0x312a08({'code':0xc8,'message':_0x172be3});});},'FaxAccounts':function(){return new Promise(function(_0x5a3c44){var _0x4e3d6a=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x55')]);_0x5a3c44({'count':_0x4e3d6a[_0xbb10('0x28')],'rows':_0x4e3d6a});});},'SendFax':function(_0x12ed63){var _0x32ec27=this;return new Promise(function(_0x24dca6,_0x33116){_0x481979[_0xbb10('0x56')](_0x12ed63)[_0xbb10('0x1f')](function(_0x5206e1){_0x24dca6({'code':0xc8,'message':_0x5206e1[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x46b6d2){_0x33116(_0x32ec27[_0xbb10('0x14')](0x1f4,_0x46b6d2['message']));});});},'CheckAfterSend':function(_0x4c0795){var _0x3547a3=this;return new Promise(function(_0x2280bd,_0x30f0a4){_0x481979[_0xbb10('0x57')](_0x4c0795)['then'](function(_0x17d596){_0x2280bd({'code':0xc8,'message':_0x17d596[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xf7b3e1){_0x30f0a4(_0x3547a3[_0xbb10('0x14')](0x1f4,_0xf7b3e1['message']));});});}};var _0x5f0691=jayson[_0xbb10('0x58')](_0x513741)[_0xbb10('0x59')]();_0x5f0691['on'](_0xbb10('0x14'),function(_0x5239da){return _0x3cdd53(_0x5239da);});_0x5f0691[_0xbb10('0x7')](0x232a,_0xbb10('0x5a'),function(){console['log']('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x328583(_0xbb10('0x5b')+0x232a);});});}; \ No newline at end of file +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(_0x20a2e2,_0xca7418){var _0x28815f=function(_0x5b2ae8){while(--_0x5b2ae8){_0x20a2e2['push'](_0x20a2e2['shift']());}};_0x28815f(++_0xca7418);}(_0xb10b,0x12a));var _0xbb10=function(_0x10a467,_0x4f75be){_0x10a467=_0x10a467-0x0;var _0x39bcbb=_0xb10b[_0x10a467];return _0x39bcbb;};'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 e129595..c3e3b68 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 _0xd5b0=['../../rpc/cmContact','redis','defaults','localhost','socket.io-emitter','info','[CM][%s][%s]','stringify','emit','exec','data1','data2','xmd-contactid','ListId','data3','split','phone','$or','map','routeId','destcalleridnum','firstName','lastName','mobile','fax','createdAt','scheduledAt','updatedAt','union','resolve','then','getContacts','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','isNil','calleridnum','calleridname','','Unknown','destcalleridname','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','format','user:%s','name','trigger:%s','toLowerCase','merge','lodash','bluebird','ioredis','util','../../../../config/logger','trigger'];(function(_0x2d2b5a,_0xd64ef9){var _0x8a90c9=function(_0x1a2352){while(--_0x1a2352){_0x2d2b5a['push'](_0x2d2b5a['shift']());}};_0x8a90c9(++_0xd64ef9);}(_0xd5b0,0x16e));var _0x0d5b=function(_0x396afa,_0x336270){_0x396afa=_0x396afa-0x0;var _0x56aceb=_0xd5b0[_0x396afa];return _0x56aceb;};'use strict';var _=require(_0x0d5b('0x0'));var BPromise=require(_0x0d5b('0x1'));var Redis=require(_0x0d5b('0x2'));var util=require(_0x0d5b('0x3'));var config=require('../../../../config/environment');var logger=require(_0x0d5b('0x4'))(_0x0d5b('0x5'));var cmContactRpc=require(_0x0d5b('0x6'));config[_0x0d5b('0x7')]=_[_0x0d5b('0x8')](config[_0x0d5b('0x7')],{'host':_0x0d5b('0x9'),'port':0x18eb});var io=require(_0x0d5b('0xa'))(new Redis(config[_0x0d5b('0x7')]));function emit(_0x2d9d31,_0x5f118b,_0x5eb09c,_0x275e62,_0x2e70a9){logger[_0x0d5b('0xb')](_0x0d5b('0xc'),_0x2d9d31,_0x5f118b['id'],_0x5eb09c,_0x275e62,JSON[_0x0d5b('0xd')](_0x2e70a9));io['to'](_0x5eb09c)[_0x0d5b('0xe')](_0x275e62,_0x2e70a9);}exports[_0x0d5b('0xf')]=function(_0x534c21,_0x3e6b86,_0x5082ea,_0x207871){var _0x38242e,_0x3e256e;var _0x127974={};var _0x570d70;var _0x29fcd0=Number(_0x5082ea[_0x0d5b('0x10')]);var _0x14d782=_0x5082ea['data2']?Boolean(Number(_0x5082ea[_0x0d5b('0x11')])):![];var _0x4d5318;var _0x1886e8=![];if(!_['isNil'](_0x5082ea['data5'])){if(_0x5082ea['data5']=='1')_0x1886e8=!![];}if(!_0x1886e8){if(_0x207871[_0x0d5b('0x12')]){_0x127974['id']=_0x207871['xmd-contactid'];}}if(!_0x127974['id']){_0x127974[_0x0d5b('0x13')]=_0x29fcd0;_0x4d5318=_0x5082ea[_0x0d5b('0x14')]&&_0x5082ea[_0x0d5b('0x14')]!=='0'?_0x5082ea[_0x0d5b('0x14')][_0x0d5b('0x15')](','):[_0x0d5b('0x16')];_0x127974[_0x0d5b('0x17')]=_[_0x0d5b('0x18')](_0x4d5318,function(_0x3cbae3){var _0x2e482f={};_0x2e482f[_0x3cbae3]=_0x207871[_0x0d5b('0x19')]?_0x207871['destcalleridnum']:_0x207871['calleridnum'];return _0x2e482f;});_0x570d70=_0x207871[_0x0d5b('0x19')]?_0x207871[_0x0d5b('0x1a')]:_0x207871['calleridnum'];}var _0x318e1e=['id',_0x0d5b('0x1b'),_0x0d5b('0x1c'),_0x0d5b('0x16'),_0x0d5b('0x1d'),_0x0d5b('0x1e'),_0x0d5b('0x13'),_0x0d5b('0x1f'),_0x0d5b('0x20'),_0x0d5b('0x21')];var _0x16738b=_[_0x0d5b('0x22')](_0x318e1e,_0x4d5318);BPromise[_0x0d5b('0x23')]()[_0x0d5b('0x24')](cmContactRpc[_0x0d5b('0x25')]({'attributes':_0x16738b,'where':_0x127974,'phone':_0x570d70}))[_0x0d5b('0x24')](function(_0x4e3993){_0x3e256e=_0x4e3993;if(!_[_0x0d5b('0x26')](_0x3e256e)){if(_0x3e256e[_0x0d5b('0x27')]===0x1){_0x38242e=_0x3e256e[0x0];logger[_0x0d5b('0xb')](_0x0d5b('0x28'),_0x207871[_0x0d5b('0x29')],_0x3e6b86['id'],_0x38242e['id']);}else{logger['info'](_0x0d5b('0x2a'),_0x207871[_0x0d5b('0x29')],_0x3e6b86['id'],_['map'](_0x3e256e,'id')[_0x0d5b('0x2b')](','));}return;}else{logger[_0x0d5b('0xb')](_0x0d5b('0x2c'),_0x207871[_0x0d5b('0x29')],_0x3e6b86['id']);var _0xc9a5d9={'ListId':_0x29fcd0};var _0x25abb1=_0x5082ea[_0x0d5b('0x2d')]&&_0x5082ea['data4']!=='0'?_0x5082ea[_0x0d5b('0x2d')]:_0x0d5b('0x16');if(_0x14d782){logger[_0x0d5b('0xb')](_0x0d5b('0x2e'),_0x207871[_0x0d5b('0x29')],_0x3e6b86['id']);_0xc9a5d9[_0x25abb1]=_[_0x0d5b('0x2f')](_0x207871['routeId'])?_0x207871[_0x0d5b('0x30')]:_0x207871['destcalleridnum'];if(_[_0x0d5b('0x2f')](_0x207871[_0x0d5b('0x19')])){_0xc9a5d9[_0x0d5b('0x1b')]=_0x207871[_0x0d5b('0x31')]&&_0x207871[_0x0d5b('0x31')]!==_0x0d5b('0x32')?_0x207871[_0x0d5b('0x31')]:_0x0d5b('0x33');}else{_0xc9a5d9['firstName']=_0x207871[_0x0d5b('0x34')]&&_0x207871[_0x0d5b('0x34')]!==_0x0d5b('0x32')?_0x207871['destcalleridname']:'Unknown';}return BPromise['resolve']()[_0x0d5b('0x24')](cmContactRpc['createContact'](_0xc9a5d9))[_0x0d5b('0x24')](function(_0x33c09a){_0x38242e=_0x33c09a;_0x3e256e[_0x0d5b('0x35')](_0x33c09a);if(_0x38242e){logger['info'](_0x0d5b('0x36'),_0x207871[_0x0d5b('0x29')],_0x3e6b86['id'],_0x38242e['id']);}return;});}else{logger[_0x0d5b('0xb')](_0x0d5b('0x37'),_0x207871[_0x0d5b('0x29')],_0x3e6b86['id']);_0xc9a5d9[_0x25abb1]=_[_0x0d5b('0x2f')](_0x207871[_0x0d5b('0x19')])?_0x207871[_0x0d5b('0x30')]:_0x207871[_0x0d5b('0x1a')];if(_[_0x0d5b('0x2f')](_0x207871['routeId'])){_0xc9a5d9['firstName']=_0x207871[_0x0d5b('0x31')]&&_0x207871['calleridname']!==''?_0x207871['calleridname']:_0x0d5b('0x33');}else{_0xc9a5d9[_0x0d5b('0x1b')]=_0x207871[_0x0d5b('0x34')]&&_0x207871[_0x0d5b('0x34')]!==_0x0d5b('0x32')?_0x207871[_0x0d5b('0x34')]:_0x0d5b('0x33');}_0x38242e=_0xc9a5d9;_0x3e256e[_0x0d5b('0x35')](_0xc9a5d9);return;}}})[_0x0d5b('0x24')](function(){if(_0x534c21){emit(_0x207871['uniqueid'],_0x3e6b86,util[_0x0d5b('0x38')](_0x0d5b('0x39'),_0x534c21[_0x0d5b('0x3a')]),util[_0x0d5b('0x38')](_0x0d5b('0x3b'),_0x5082ea['action'][_0x0d5b('0x3c')]()),{'evt':_[_0x0d5b('0x3d')](_0x207871,{'autoCreate':_0x14d782}),'contact':_0x38242e===undefined?{}:_0x38242e,'contacts':_0x3e256e[_0x0d5b('0x27')]===0x0?undefined:_0x3e256e});}});}; \ No newline at end of file +var _0x4bab=['[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','calleridnum','calleridname','','Unknown','destcalleridname','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','user:%s','name','format','trigger:%s','action','toLowerCase','merge','length','bluebird','ioredis','util','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','localhost','socket.io-emitter','info','[CM][%s][%s]','stringify','emit','exec','data1','data2','isNil','data5','xmd-contactid','ListId','data3','split','phone','routeId','destcalleridnum','firstName','lastName','mobile','fax','createdAt','scheduledAt','updatedAt','union','resolve','then','getContacts','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]'];(function(_0x2bea7a,_0x1fae70){var _0x1006f5=function(_0x5615bc){while(--_0x5615bc){_0x2bea7a['push'](_0x2bea7a['shift']());}};_0x1006f5(++_0x1fae70);}(_0x4bab,0xc8));var _0xb4ba=function(_0x4723d7,_0x191951){_0x4723d7=_0x4723d7-0x0;var _0x83298d=_0x4bab[_0x4723d7];return _0x83298d;};'use strict';var _=require('lodash');var BPromise=require(_0xb4ba('0x0'));var Redis=require(_0xb4ba('0x1'));var util=require(_0xb4ba('0x2'));var config=require(_0xb4ba('0x3'));var logger=require(_0xb4ba('0x4'))(_0xb4ba('0x5'));var cmContactRpc=require(_0xb4ba('0x6'));config[_0xb4ba('0x7')]=_['defaults'](config[_0xb4ba('0x7')],{'host':_0xb4ba('0x8'),'port':0x18eb});var io=require(_0xb4ba('0x9'))(new Redis(config['redis']));function emit(_0xdc04d7,_0x3c25ae,_0x5bba20,_0x4cfc52,_0x5d7245){logger[_0xb4ba('0xa')](_0xb4ba('0xb'),_0xdc04d7,_0x3c25ae['id'],_0x5bba20,_0x4cfc52,JSON[_0xb4ba('0xc')](_0x5d7245));io['to'](_0x5bba20)[_0xb4ba('0xd')](_0x4cfc52,_0x5d7245);}exports[_0xb4ba('0xe')]=function(_0x513b31,_0x910fd3,_0x36fa84,_0xf0f982){var _0x1cf8fa,_0x7310b5;var _0x1e3f82={};var _0x54776a;var _0x3fc089=Number(_0x36fa84[_0xb4ba('0xf')]);var _0x5ccd64=_0x36fa84[_0xb4ba('0x10')]?Boolean(Number(_0x36fa84[_0xb4ba('0x10')])):![];var _0x195359;var _0x1b5206=![];if(!_[_0xb4ba('0x11')](_0x36fa84[_0xb4ba('0x12')])){if(_0x36fa84[_0xb4ba('0x12')]=='1')_0x1b5206=!![];}if(!_0x1b5206){if(_0xf0f982[_0xb4ba('0x13')]){_0x1e3f82['id']=_0xf0f982[_0xb4ba('0x13')];}}if(!_0x1e3f82['id']){_0x1e3f82[_0xb4ba('0x14')]=_0x3fc089;_0x195359=_0x36fa84['data3']&&_0x36fa84[_0xb4ba('0x15')]!=='0'?_0x36fa84['data3'][_0xb4ba('0x16')](','):[_0xb4ba('0x17')];_0x1e3f82['$or']=_['map'](_0x195359,function(_0x52038d){var _0x17b9ae={};_0x17b9ae[_0x52038d]=_0xf0f982[_0xb4ba('0x18')]?_0xf0f982[_0xb4ba('0x19')]:_0xf0f982['calleridnum'];return _0x17b9ae;});_0x54776a=_0xf0f982[_0xb4ba('0x18')]?_0xf0f982[_0xb4ba('0x19')]:_0xf0f982['calleridnum'];}var _0x241bf8=['id',_0xb4ba('0x1a'),_0xb4ba('0x1b'),'phone',_0xb4ba('0x1c'),_0xb4ba('0x1d'),_0xb4ba('0x14'),_0xb4ba('0x1e'),_0xb4ba('0x1f'),_0xb4ba('0x20')];var _0x61c157=_[_0xb4ba('0x21')](_0x241bf8,_0x195359);BPromise[_0xb4ba('0x22')]()[_0xb4ba('0x23')](cmContactRpc[_0xb4ba('0x24')]({'attributes':_0x61c157,'where':_0x1e3f82,'phone':_0x54776a}))[_0xb4ba('0x23')](function(_0x141cb6){_0x7310b5=_0x141cb6;if(!_['isEmpty'](_0x7310b5)){if(_0x7310b5['length']===0x1){_0x1cf8fa=_0x7310b5[0x0];logger['info'](_0xb4ba('0x25'),_0xf0f982[_0xb4ba('0x26')],_0x910fd3['id'],_0x1cf8fa['id']);}else{logger['info'](_0xb4ba('0x27'),_0xf0f982[_0xb4ba('0x26')],_0x910fd3['id'],_['map'](_0x7310b5,'id')['join'](','));}return;}else{logger[_0xb4ba('0xa')](_0xb4ba('0x28'),_0xf0f982['uniqueid'],_0x910fd3['id']);var _0x224ace={'ListId':_0x3fc089};var _0x1ab9bc=_0x36fa84[_0xb4ba('0x29')]&&_0x36fa84[_0xb4ba('0x29')]!=='0'?_0x36fa84['data4']:'phone';if(_0x5ccd64){logger[_0xb4ba('0xa')](_0xb4ba('0x2a'),_0xf0f982[_0xb4ba('0x26')],_0x910fd3['id']);_0x224ace[_0x1ab9bc]=_[_0xb4ba('0x11')](_0xf0f982[_0xb4ba('0x18')])?_0xf0f982[_0xb4ba('0x2b')]:_0xf0f982[_0xb4ba('0x19')];if(_[_0xb4ba('0x11')](_0xf0f982[_0xb4ba('0x18')])){_0x224ace['firstName']=_0xf0f982[_0xb4ba('0x2c')]&&_0xf0f982['calleridname']!==_0xb4ba('0x2d')?_0xf0f982['calleridname']:_0xb4ba('0x2e');}else{_0x224ace[_0xb4ba('0x1a')]=_0xf0f982['destcalleridname']&&_0xf0f982[_0xb4ba('0x2f')]!==''?_0xf0f982[_0xb4ba('0x2f')]:_0xb4ba('0x2e');}return BPromise['resolve']()['then'](cmContactRpc[_0xb4ba('0x30')](_0x224ace))[_0xb4ba('0x23')](function(_0x2414c3){_0x1cf8fa=_0x2414c3;_0x7310b5[_0xb4ba('0x31')](_0x2414c3);if(_0x1cf8fa){logger['info'](_0xb4ba('0x32'),_0xf0f982[_0xb4ba('0x26')],_0x910fd3['id'],_0x1cf8fa['id']);}return;});}else{logger[_0xb4ba('0xa')](_0xb4ba('0x33'),_0xf0f982[_0xb4ba('0x26')],_0x910fd3['id']);_0x224ace[_0x1ab9bc]=_[_0xb4ba('0x11')](_0xf0f982[_0xb4ba('0x18')])?_0xf0f982[_0xb4ba('0x2b')]:_0xf0f982[_0xb4ba('0x19')];if(_[_0xb4ba('0x11')](_0xf0f982[_0xb4ba('0x18')])){_0x224ace[_0xb4ba('0x1a')]=_0xf0f982[_0xb4ba('0x2c')]&&_0xf0f982[_0xb4ba('0x2c')]!==_0xb4ba('0x2d')?_0xf0f982['calleridname']:_0xb4ba('0x2e');}else{_0x224ace[_0xb4ba('0x1a')]=_0xf0f982[_0xb4ba('0x2f')]&&_0xf0f982[_0xb4ba('0x2f')]!==_0xb4ba('0x2d')?_0xf0f982[_0xb4ba('0x2f')]:'Unknown';}_0x1cf8fa=_0x224ace;_0x7310b5['push'](_0x224ace);return;}}})[_0xb4ba('0x23')](function(){if(_0x513b31){emit(_0xf0f982['uniqueid'],_0x910fd3,util['format'](_0xb4ba('0x34'),_0x513b31[_0xb4ba('0x35')]),util[_0xb4ba('0x36')](_0xb4ba('0x37'),_0x36fa84[_0xb4ba('0x38')][_0xb4ba('0x39')]()),{'evt':_[_0xb4ba('0x3a')](_0xf0f982,{'autoCreate':_0x5ccd64}),'contact':_0x1cf8fa===undefined?{}:_0x1cf8fa,'contacts':_0x7310b5[_0xb4ba('0x3b')]===0x0?undefined:_0x7310b5});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 54bafcb..3804ce0 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 _0xdfc0=['name','trigger:%s:%s','toLowerCase','jscripty','data1','trigger:%s','exec','integration','accounts','queue','voiceExtensions','routeId','script','parse','query','search','checkTrigger','channel','AllConditions','every','checkConditions','AnyConditions','some','evt','field','account','chat','operator','value','upperFirst','AccountId','interaction','message','event','agent','membername','lastevent','mailSubstatus','null','substatus','offlineMessage','exports','util','url','mustache','ioredis','./urlforward','./integration','./cmContact','./script','../../../config/logger','../ami','redis','defaults','localhost','winapp','triggers','agents','voiceQueues','templates','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','custom:agentcalled','syncCustomEvent','bind','custom:agentconnect','custom:agentringnoanswer','custom:agentcomplete','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentbusy','custom:agentcongestion','custom:agentreject','custom:amd','custom:timeout','syncAgentDial','custom:dialconnect','custom:closedinteraction','custom:substatus','custom:incomingmessage','custom:outgoingmessage','custom:acceptmessage','custom:rejectmessage','custom:offlineMessage','prototype','emit','stringify','motionChannel','undefined','voice','debug','inspect','checkTriggers','interface','hasOwnProperty','merge','Actions','length','action','contactmanager','browser','popup','TemplateId','data2','html','template\x20not\x20found','uri','buildUri','isNil','data3','data4','data5','windowHeight','data6','600','winApplication','render','winArguments','format','user:%s'];(function(_0x62b71d,_0x36a365){var _0x3c52b1=function(_0x458db9){while(--_0x458db9){_0x62b71d['push'](_0x62b71d['shift']());}};_0x3c52b1(++_0x36a365);}(_0xdfc0,0x1aa));var _0x0dfc=function(_0xb1666b,_0x4c269e){_0xb1666b=_0xb1666b-0x0;var _0x110710=_0xdfc0[_0xb1666b];return _0x110710;};'use strict';var util=require(_0x0dfc('0x0'));var _=require('lodash');var url=require(_0x0dfc('0x1'));var Mustache=require(_0x0dfc('0x2'));var Redis=require(_0x0dfc('0x3'));var urlforward=require(_0x0dfc('0x4'));var integration=require(_0x0dfc('0x5'));var cmContact=require(_0x0dfc('0x6'));var script=require(_0x0dfc('0x7'));var config=require('../../../config/environment');var logger=require(_0x0dfc('0x8'))('trigger');var ami=require(_0x0dfc('0x9'));config[_0x0dfc('0xa')]=_[_0x0dfc('0xb')](config[_0x0dfc('0xa')],{'host':_0x0dfc('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0dfc('0xa')]));var operators={'equals':function(_0x577ef3,_0x2e100a){return _0x577ef3==_0x2e100a;},'not_equals':function(_0x4a9446,_0x7ea776){return _0x4a9446!=_0x7ea776;}};var barAndWebActions=['popup','url',_0x0dfc('0xd')];function Trigger(_0x4806f5){this[_0x0dfc('0xe')]=_0x4806f5[_0x0dfc('0xe')];this['agents']=_0x4806f5[_0x0dfc('0xf')];this[_0x0dfc('0x10')]=_0x4806f5['voiceQueues'];this[_0x0dfc('0x11')]=_0x4806f5['templates'];this['voiceExtensions']=_0x4806f5['voiceExtensions'];this[_0x0dfc('0x12')]=_0x4806f5['zendeskAccounts'];this['freshdeskAccounts']=_0x4806f5[_0x0dfc('0x13')];this[_0x0dfc('0x14')]=_0x4806f5['salesforceAccounts'];this['sugarcrmAccounts']=_0x4806f5[_0x0dfc('0x15')];this[_0x0dfc('0x16')]=_0x4806f5['zohoAccounts'];this[_0x0dfc('0x17')]=_0x4806f5[_0x0dfc('0x17')];this[_0x0dfc('0x18')]=_0x4806f5[_0x0dfc('0x18')];this['servicenowAccounts']=_0x4806f5[_0x0dfc('0x19')];this[_0x0dfc('0x1a')]=_0x4806f5[_0x0dfc('0x1a')];this[_0x0dfc('0x1b')]=_0x4806f5[_0x0dfc('0x1b')];this['accounts']={'zendesk':this[_0x0dfc('0x12')],'salesforce':this[_0x0dfc('0x14')],'freshdesk':this[_0x0dfc('0x13')],'sugarcrm':this['sugarcrmAccounts'],'zoho':this[_0x0dfc('0x16')],'desk':this[_0x0dfc('0x17')],'vtiger':this[_0x0dfc('0x18')],'dynamics365':this[_0x0dfc('0x1a')],'freshsales':this[_0x0dfc('0x1b')],'servicenow':this[_0x0dfc('0x19')]};ami['on'](_0x0dfc('0x1c'),this[_0x0dfc('0x1d')][_0x0dfc('0x1e')](this));ami['on'](_0x0dfc('0x1f'),this[_0x0dfc('0x1d')]['bind'](this));ami['on'](_0x0dfc('0x20'),this[_0x0dfc('0x1d')]['bind'](this));ami['on'](_0x0dfc('0x21'),this[_0x0dfc('0x1d')]['bind'](this));ami['on'](_0x0dfc('0x22'),this[_0x0dfc('0x1d')][_0x0dfc('0x1e')](this));ami['on'](_0x0dfc('0x23'),this['syncCustomEvent'][_0x0dfc('0x1e')](this));ami['on'](_0x0dfc('0x24'),this['syncCustomEvent'][_0x0dfc('0x1e')](this));ami['on'](_0x0dfc('0x25'),this['syncCustomEvent'][_0x0dfc('0x1e')](this));ami['on'](_0x0dfc('0x26'),this[_0x0dfc('0x1d')]['bind'](this));ami['on'](_0x0dfc('0x27'),this[_0x0dfc('0x1d')][_0x0dfc('0x1e')](this));ami['on']('custom:queuecallerabandon',this['syncCustomEvent']['bind'](this));ami['on'](_0x0dfc('0x28'),this[_0x0dfc('0x1d')]['bind'](this));ami['on']('custom:dialbegin',this[_0x0dfc('0x29')]['bind'](this));ami['on'](_0x0dfc('0x2a'),this[_0x0dfc('0x29')][_0x0dfc('0x1e')](this));ami['on']('custom:dialend',this[_0x0dfc('0x29')][_0x0dfc('0x1e')](this));ami['on']('custom:newinteraction',this[_0x0dfc('0x1d')][_0x0dfc('0x1e')](this));ami['on'](_0x0dfc('0x2b'),this['syncCustomEvent'][_0x0dfc('0x1e')](this));ami['on'](_0x0dfc('0x2c'),this[_0x0dfc('0x1d')][_0x0dfc('0x1e')](this));ami['on'](_0x0dfc('0x2d'),this[_0x0dfc('0x1d')][_0x0dfc('0x1e')](this));ami['on'](_0x0dfc('0x2e'),this[_0x0dfc('0x1d')]['bind'](this));ami['on'](_0x0dfc('0x2f'),this[_0x0dfc('0x1d')][_0x0dfc('0x1e')](this));ami['on'](_0x0dfc('0x30'),this[_0x0dfc('0x1d')][_0x0dfc('0x1e')](this));ami['on'](_0x0dfc('0x31'),this[_0x0dfc('0x1d')][_0x0dfc('0x1e')](this));}Trigger[_0x0dfc('0x32')][_0x0dfc('0x33')]=function(_0x4b187c,_0x394e61,_0x17e19f){logger['info'](_0x4b187c,_0x394e61,JSON[_0x0dfc('0x34')](_0x17e19f));io['to'](_0x4b187c)[_0x0dfc('0x33')](_0x394e61,_0x17e19f);};Trigger[_0x0dfc('0x32')]['syncCustomEvent']=function(_0x169680){var _0x4b77be=_['clone'](_0x169680);if(typeof _0x4b77be[_0x0dfc('0x35')]===_0x0dfc('0x36')){_0x4b77be[_0x0dfc('0x35')]=_0x0dfc('0x37');}logger[_0x0dfc('0x38')](_0x0dfc('0x1d'),util[_0x0dfc('0x39')](_0x4b77be,{'showHidden':!![],'depth':null}));this[_0x0dfc('0x3a')](_0x4b77be);};Trigger['prototype'][_0x0dfc('0x29')]=function(_0x3bf293){if(this['agents'][_0x3bf293[_0x0dfc('0x3b')]]){this[_0x0dfc('0x1d')](_0x3bf293);}};Trigger[_0x0dfc('0x32')][_0x0dfc('0x3a')]=function(_0x2641f8){var _0x48780b;for(var _0x175e54 in this[_0x0dfc('0xe')]){if(this[_0x0dfc('0xe')][_0x0dfc('0x3c')](_0x175e54)){if(this[_0x0dfc('0xe')][_0x175e54]['status']){_0x48780b=this['checkTrigger'](this[_0x0dfc('0xe')][_0x175e54],_0x2641f8);if(_0x48780b){_[_0x0dfc('0x3d')](_0x2641f8,_0x2641f8['variables']);for(var _0x529664=0x0,_0x4f95b0,_0x20eedb,_0x268a53;_0x5296640x0){_0x11c1eb=_[_0x7995('0x2b')](_0xf16cc2,_0x132a42);}return _0x11c1eb;}function getCustomFields(_0x514445,_0x456a28){var _0x3250e0=[];var _0x4253e5={'custom_fields':{}};if(_0x514445['length']>0x0){_['forEach'](_0x514445,function(_0x48e573){if(_[_0x7995('0x2c')]([_0x7995('0x2d'),_0x7995('0x2e')],_0x48e573[_0x7995('0x2f')])&&_0x48e573[_0x7995('0x30')]&&!_0x48e573[_0x7995('0x31')]){_0x4253e5[_0x48e573['nameField']['toLowerCase']()]=_0x48e573[_0x7995('0x32')]['toString']();}else if(_[_0x7995('0x2c')]([_0x7995('0x2d'),_0x7995('0x2e')],_0x48e573[_0x7995('0x2f')])&&_0x48e573[_0x7995('0x33')]&&_0x48e573['customField']){_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x48e573['content']['toString']();}else if(_0x48e573['type']===_0x7995('0x35')&&_0x48e573[_0x7995('0x36')]&&_0x48e573['idField']&&_0x48e573[_0x7995('0x31')]){_0x456a28[_0x48e573['variableName']]&&(_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x456a28[_0x48e573[_0x7995('0x36')]]['toString']());}else if(_0x48e573['type']===_0x7995('0x37')&&_0x48e573['Variable']&&_0x48e573['Variable'][_0x7995('0x38')]&&_0x48e573[_0x7995('0x33')]&&_0x48e573['customField']){_0x456a28[_0x48e573[_0x7995('0x39')][_0x7995('0x38')][_0x7995('0x3a')]()]&&(_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x456a28[_0x48e573['Variable'][_0x7995('0x38')][_0x7995('0x3a')]()][_0x7995('0x22')]());}});}if(_0x4253e5[_0x7995('0x3b')]){_0x4253e5['priority']=Number(_0x4253e5[_0x7995('0x3b')]);}return _0x4253e5;}function getTicket(_0x235df7,_0x3eb04f,_0xe5ea43,_0x1f5bee,_0x1035dc){logger['info'](_0x7995('0x3c'));var _0x3be298=_[_0x7995('0x3d')]({'subject':intUtil[_0x7995('0x3e')](_0x1f5bee[_0x7995('0x3f')],_0x1035dc,'\x20'),'type':_0x7995('0x40'),'status':_0x7995('0x41'),'labels':[_0x7995('0x42'),_0x7995('0x43'),_0x7995('0x44')][_0x7995('0x45')](getTags(_0x1f5bee[_0x7995('0x46')],_0x7995('0x38'))),'description':intUtil['getString'](_0x1f5bee['Descriptions'],_0x1035dc,'\x0a'),'_links':{'assigned_user':{'href':util[_0x7995('0x11')](_0x7995('0x47'),_0x3eb04f['id']),'class':'user'}},'message':{'direction':'in','body':intUtil['getString'](_0x1f5bee[_0x7995('0x48')],_0x1035dc,'\x0a')}},getCustomFields(_0x1f5bee['Fields'],_0x1035dc));return request({'uri':util['format'](_0x7995('0x49'),_0x235df7[_0x7995('0x12')],_0xe5ea43['id']),'method':_0x7995('0x29'),'body':_0x3be298});}exports['queue']=function(_0x46ac4f,_0x5e85b9,_0x3993b5,_0x5a8881,_0x493066,_0x39c5b8){var _0x403f54,_0xc04e5;_0x39c5b8[_0x7995('0x12')]=intUtil['stripTrailingSlash'](_0x39c5b8[_0x7995('0x12')]);_0x39c5b8[_0x7995('0x4a')]=intUtil[_0x7995('0x4b')](_0x39c5b8[_0x7995('0x4a')]);if(_0x493066&&_0x493066['monitor_format']){logger['info'](_0x7995('0x4c'),'Recording\x20is\x20enabled!');_0x5e85b9[_0x7995('0x4d')]=util['format'](_0x7995('0x4e'),_0x39c5b8['serverUrl'],_0x5e85b9[_0x7995('0x4f')],md5(_0x5e85b9[_0x7995('0x4f')]));}else{_0x5e85b9['recordingURL']='';}headers[_0x7995('0x50')]=getAuth(_0x39c5b8);return getUser(_0x39c5b8,_0x5a8881[_0x7995('0x51')])[_0x7995('0x13')](function(_0xb70a51){_0x403f54=_0xb70a51;logger['info'](_0x7995('0x52'),_0x403f54['id']);return getEndUser(_0x39c5b8,_0x5e85b9[_0x7995('0x53')],_0x5e85b9[_0x7995('0x54')]);})['then'](function(_0xe228a5){_0xc04e5=_0xe228a5;logger[_0x7995('0xf')](_0x7995('0x55'),_0xc04e5['id']);return getTicket(_0x39c5b8,_0x403f54,_0xc04e5,_0x3993b5,_0x5e85b9);})[_0x7995('0x13')](function(_0x255313){if(_0x255313){logger['info'](_0x7995('0x56'));logger[_0x7995('0xf')]('The\x20Ticket\x20ID\x20is:',_0x255313['id']);switch(_0x39c5b8[_0x7995('0x2f')]){case'integrationTab':logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x57'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x5a8881[_0x7995('0x38')]),_0x7995('0x59'),{'recordId':_0x255313['id']});break;case'newTab':logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x5a'));emit(util['format'](_0x7995('0x58'),_0x5a8881[_0x7995('0x38')]),_0x7995('0x5b'),{'uri':util['format']('https://xcally.desk.com/web/agent/case/%d',_0x255313['id'])});break;default:logger['error'](_0x7995('0x4c'),_0x7995('0x5c'));}}})['catch'](function(_0x1cd85){console[_0x7995('0x5d')](_0x1cd85);logger[_0x7995('0x5d')](_0x7995('0x4c'),JSON[_0x7995('0x1c')](_0x1cd85));});};exports['outbound']=function(_0x29ee32,_0x4ab09f,_0x14fe7f,_0x33c801,_0x206d2a,_0x50c7b5,_0x5e1f34){var _0x54e2b1,_0x563f8e;_0x50c7b5[_0x7995('0x12')]=intUtil[_0x7995('0x4b')](_0x50c7b5[_0x7995('0x12')]);_0x50c7b5[_0x7995('0x4a')]=intUtil[_0x7995('0x4b')](_0x50c7b5[_0x7995('0x4a')]);if(_0x5e1f34&&_0x5e1f34[_0x7995('0x5e')]&&_0x5e1f34[_0x7995('0x5e')]!==_0x7995('0x5f')){logger[_0x7995('0xf')](_0x7995('0x60'),_0x7995('0x61'));_0x4ab09f[_0x7995('0x4d')]=util[_0x7995('0x11')](_0x7995('0x4e'),_0x50c7b5[_0x7995('0x4a')],_0x4ab09f[_0x7995('0x4f')],md5(_0x4ab09f[_0x7995('0x4f')]));}headers[_0x7995('0x50')]=getAuth(_0x50c7b5);return getUser(_0x50c7b5,_0x33c801['email'])[_0x7995('0x13')](function(_0x630737){_0x54e2b1=_0x630737;logger[_0x7995('0xf')](_0x7995('0x52'),_0x54e2b1['id']);return getEndUser(_0x50c7b5,_0x4ab09f['destcalleridname'],_0x4ab09f['destcalleridnum']);})[_0x7995('0x13')](function(_0x197b52){_0x563f8e=_0x197b52;logger[_0x7995('0xf')](_0x7995('0x55'),_0x563f8e['id']);return getTicket(_0x50c7b5,_0x54e2b1,_0x563f8e,_0x14fe7f,_0x4ab09f);})['then'](function(_0x13cd7b){if(_0x13cd7b){logger[_0x7995('0xf')](_0x7995('0x56'));logger[_0x7995('0xf')]('The\x20Ticket\x20ID\x20is:',_0x13cd7b['id']);switch(_0x50c7b5['type']){case _0x7995('0x62'):logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x57'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x33c801[_0x7995('0x38')]),_0x7995('0x59'),{'recordId':_0x13cd7b['id']});break;case _0x7995('0x63'):logger['info'](_0x7995('0x4c'),_0x7995('0x5a'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x33c801['name']),'trigger:browser:url',{'uri':util[_0x7995('0x11')](_0x7995('0x64'),_0x50c7b5['remoteUri'],_0x13cd7b['id'])});break;default:logger[_0x7995('0x5d')](_0x7995('0x60'),_0x7995('0x5c'));}}})[_0x7995('0x65')](function(_0x32cb04){logger['error'](_0x7995('0x60'),JSON['stringify'](_0x32cb04));});};exports[_0x7995('0x66')]=function(_0xe31dcb,_0x1722e2,_0x25b534,_0x4388c1,_0xeb8920,_0x2b3c1d){var _0x44372a,_0x10f012;_0x2b3c1d[_0x7995('0x12')]=intUtil[_0x7995('0x4b')](_0x2b3c1d[_0x7995('0x12')]);_0x2b3c1d['serverUrl']=intUtil[_0x7995('0x4b')](_0x2b3c1d[_0x7995('0x4a')]);if(_0xeb8920&&_0xeb8920[_0x7995('0x67')]){logger[_0x7995('0xf')]('['+_0x1722e2[_0x7995('0x68')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x1722e2[_0x7995('0x4d')]=util[_0x7995('0x11')](_0x7995('0x4e'),_0x2b3c1d[_0x7995('0x4a')],_0x1722e2['uniqueid'],md5(_0x1722e2[_0x7995('0x4f')]));}else{_0x1722e2['recordingURL']='';}headers['Authorization']=getAuth(_0x2b3c1d);return getUser(_0x2b3c1d)[_0x7995('0x13')](function(_0x36d27d){_0x44372a=_0x36d27d;logger[_0x7995('0xf')](_0x7995('0x52'),_0x44372a['id']);return getEndUser(_0x2b3c1d,_0x1722e2[_0x7995('0x53')],_0x1722e2[_0x7995('0x54')]);})[_0x7995('0x13')](function(_0x13dc73){_0x10f012=_0x13dc73;logger[_0x7995('0xf')](_0x7995('0x55'),_0x10f012['id']);return getTicket(_0x2b3c1d,_0x44372a,_0x10f012,_0x25b534,_0x1722e2);})['then'](function(_0x2dc1f7){if(_0x2dc1f7){logger[_0x7995('0xf')](_0x7995('0x56'));logger['info'](_0x7995('0x69'),_0x2dc1f7['id']);}})[_0x7995('0x65')](function(_0x705f0){logger[_0x7995('0x5d')]('['+_0x1722e2[_0x7995('0x68')][_0x7995('0x6a')]()+']',JSON[_0x7995('0x1c')](_0x705f0));});}; \ No newline at end of file +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(_0x3044c5,_0x5ada67){var _0x18bd31=function(_0x3b8cfc){while(--_0x3b8cfc){_0x3044c5['push'](_0x3044c5['shift']());}};_0x18bd31(++_0x5ada67);}(_0x814b,0x1a2));var _0xb814=function(_0x260859,_0x3cfcff){_0x260859=_0x260859-0x0;var _0x4b77f8=_0x814b[_0x260859];return _0x4b77f8;};'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 c2a17b1..b29b02d 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 _0x9cc2=['user:%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','unmanaged','outbound','%s/api/data/v9.0/','format','https://login.microsoftonline.com/%s/oauth2/token','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','moduleCreate',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:','ticketId',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','util','./util','ioredis','../../../../config/logger','../../../../config/environment','redis','localhost','modernAuthentication','remoteUri','data7','tenantId','CloudProvider','resolve','data5','POST','username','then','access_token','catch','error','message','GET','Bearer\x20','4.0','value','isNil','email','userEmail','internalemailaddress','isdisabled','toUpperCase',']\x20Agent\x20found\x20','systemuserid','userId','info',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','toLowerCase','destcalleridnum','calleridnum','/systemusers(','body','substring','lastIndexOf','enduserId','\x20eq\x20\x27','replace','%2b','length','contactid',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','includes','string','picklist','type','nameField','customField','idField','indexOf','content','assign','getString','Subjects','Descriptions','/contacts(','Fields','ticketType','phonecall','queue','callDirection','phonecalls','headers','odata-entityid','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s'];(function(_0x202e6c,_0xb884e1){var _0x342cb0=function(_0x3c385b){while(--_0x3c385b){_0x202e6c['push'](_0x202e6c['shift']());}};_0x342cb0(++_0xb884e1);}(_0x9cc2,0x1bc));var _0x29cc=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0x9cc2[_0x278e3c];return _0x3e2d9b;};'use strict';var _=require(_0x29cc('0x0'));var rp=require(_0x29cc('0x1'));var util=require(_0x29cc('0x2'));var intUtil=require(_0x29cc('0x3'));var md5=require('md5');var Redis=require(_0x29cc('0x4'));var logger=require(_0x29cc('0x5'))('dynamics365');var config=require(_0x29cc('0x6'));config[_0x29cc('0x7')]=_['defaults'](config[_0x29cc('0x7')],{'host':_0x29cc('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x29cc('0x7')]));function getAuthToken(_0x402b86,_0x47e4dd,_0x5e6e64){if(_0x402b86[_0x29cc('0x9')]){_0x402b86[_0x29cc('0xa')]=_0x402b86['CloudProvider'][_0x29cc('0xb')];_0x402b86[_0x29cc('0xc')]=_0x402b86[_0x29cc('0xd')]['data2'];return Promise[_0x29cc('0xe')](_0x402b86['CloudProvider'][_0x29cc('0xf')]);}var _0x436df0={'method':_0x29cc('0x10'),'uri':_0x47e4dd,'form':{'client_id':_0x402b86['clientId'],'resource':_0x402b86[_0x29cc('0xa')],'username':_0x402b86[_0x29cc('0x11')],'password':_0x402b86['password'],'grant_type':'password','client_secret':_0x402b86['clientSecret']},'json':!![]};return rp(_0x436df0)[_0x29cc('0x12')](function(_0xc9bdf){return _0xc9bdf[_0x29cc('0x13')];})[_0x29cc('0x14')](function(_0xd90418){logger[_0x29cc('0x15')]('['+[_0x5e6e64['toUpperCase']()]+']\x20Wrong\x20credentials!');return _0xd90418[_0x29cc('0x16')];});}function getUser(_0x50d448,_0x2eceed,_0x2622c9,_0x1a67a3,_0x3795a2,_0x281c07){return new Promise(function(_0x2de853,_0x8a85){return getAuthToken(_0x2eceed,_0x1a67a3,_0x281c07)[_0x29cc('0x12')](function(_0x2526fa){var _0x201c12={'method':_0x29cc('0x17'),'uri':_0x3795a2+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':_0x29cc('0x18')+_0x2526fa,'OData-Version':_0x29cc('0x19')},'json':!![]};return rp(_0x201c12);})[_0x29cc('0x12')](function(_0x353c90){var _0x5b646f=_0x353c90[_0x29cc('0x1a')];var _0x16210b=![];var _0x8d6249=null;if(!_[_0x29cc('0x1b')](_0x2622c9)){if(intUtil['validateEmail'](_0x2622c9[_0x29cc('0x1c')])){_0x50d448[_0x29cc('0x1d')]=_0x2622c9[_0x29cc('0x1c')];for(_0x8d6249=0x0;_0x8d6249<_0x5b646f['length'];_0x8d6249++){if(_0x5b646f[_0x8d6249][_0x29cc('0x1e')]===_0x2622c9['email']&&!_0x5b646f[_0x8d6249][_0x29cc('0x1f')]){_0x16210b=!![];logger['info']('['+[_0x281c07[_0x29cc('0x20')]()]+_0x29cc('0x21')+_0x5b646f[_0x8d6249][_0x29cc('0x22')]+'!');_0x50d448[_0x29cc('0x23')]=_0x5b646f[_0x8d6249]['systemuserid'];}}}}if(!_0x16210b){logger[_0x29cc('0x24')]('['+[_0x281c07[_0x29cc('0x20')]()]+_0x29cc('0x25'));_0x50d448[_0x29cc('0x1d')]=_0x2eceed[_0x29cc('0x11')];for(_0x8d6249=0x0;_0x8d6249<_0x5b646f['length'];_0x8d6249++){if(_0x5b646f[_0x8d6249][_0x29cc('0x1e')]===_0x2eceed[_0x29cc('0x11')]){_0x50d448['userId']=_0x5b646f[_0x8d6249][_0x29cc('0x22')];}}}_0x2de853(_0x50d448);})[_0x29cc('0x14')](function(_0xf6d539){_0x8a85(_0xf6d539[_0x29cc('0x16')]);});});}function createEndUser(_0x3b880c,_0x1389b8,_0x3ac12d,_0x391c56,_0xbeb895,_0x4510cf,_0x2de132){return new Promise(function(_0x336390,_0x1d7a39){return getAuthToken(_0x1389b8,_0x3ac12d,_0x4510cf)[_0x29cc('0x12')](function(_0x501b15){var _0x194e4d=_0x4510cf[_0x29cc('0x26')]()==='outbound'?_0xbeb895[_0x29cc('0x27')]:_0xbeb895[_0x29cc('0x28')];var _0x204ce0={'method':_0x29cc('0x10'),'uri':_0x391c56+'contacts','body':{'fullname':_0x194e4d,'firstname':_0x194e4d,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x29cc('0x29')+_0x3b880c[_0x29cc('0x23')]+')'},'headers':{'Authorization':'Bearer\x20'+_0x501b15,'OData-Version':_0x29cc('0x19')},'json':!![],'resolveWithFullResponse':!![]};_0x204ce0[_0x29cc('0x2a')][_0x2de132]=_0x194e4d;return rp(_0x204ce0);})['then'](function(_0x23826f){var _0x10ae50=_0x23826f['headers']['odata-entityid'];var _0x54d1d8=_0x10ae50[_0x29cc('0x2b')](_0x10ae50[_0x29cc('0x2c')]('(')+0x1,_0x10ae50[_0x29cc('0x2c')](')'));_0x3b880c[_0x29cc('0x2d')]=_0x54d1d8;_0x336390(_0x3b880c);})[_0x29cc('0x14')](function(_0xad7d35){_0x1d7a39(_0xad7d35[_0x29cc('0x16')]);});});}function getEndUser(_0x43f6be,_0x4f0d00,_0x151c0d,_0x423238,_0x3a0109,_0x54ad32,_0x369333,_0x59fe0c){var _0x158d48=_0x54ad32[_0x29cc('0x26')]()==='outbound'?_0x3a0109[_0x29cc('0x27')]:_0x3a0109[_0x29cc('0x28')];return getAuthToken(_0x4f0d00,_0x151c0d,_0x54ad32)[_0x29cc('0x12')](function(_0xfb50b1){_0x59fe0c=_0x59fe0c?_0x59fe0c:'telephone1';var _0x331a0e={'method':_0x29cc('0x17'),'uri':_0x423238+'contacts?$select='+_0x59fe0c+'&$filter='+_0x59fe0c+_0x29cc('0x2e')+_0x158d48[_0x29cc('0x2f')]('+',_0x29cc('0x30'))+'\x27','headers':{'Authorization':'Bearer\x20'+_0xfb50b1,'If-None-Match':null,'OData-Version':_0x29cc('0x19')},'json':!![]};return rp(_0x331a0e);})[_0x29cc('0x12')](function(_0xd4bcaa){var _0x3da6c6=![];if(!_0xd4bcaa)return _0x3da6c6;var _0x156f0e=_0xd4bcaa['value'];for(var _0x56e8c0=0x0;_0x56e8c0<_0x156f0e[_0x29cc('0x31')];_0x56e8c0++){if(_0x156f0e[_0x56e8c0][_0x59fe0c]===_0x158d48){_0x3da6c6=!![];_0x43f6be['enduserId']=_0x156f0e[_0x56e8c0][_0x29cc('0x32')];}}return _0x3da6c6;})[_0x29cc('0x12')](function(_0x1c3c69){if(_0x1c3c69)return _0x43f6be;if(_0x369333==='nothing'){logger['info']('['+[_0x54ad32['toUpperCase']()]+_0x29cc('0x33'));return _0x43f6be;}return createEndUser(_0x43f6be,_0x4f0d00,_0x151c0d,_0x423238,_0x3a0109,_0x54ad32,_0x59fe0c)['then'](function(_0x1a61ea){logger[_0x29cc('0x24')]('['+[_0x54ad32[_0x29cc('0x20')]()]+_0x29cc('0x34'),_0x1a61ea[_0x29cc('0x2d')]);return _0x1a61ea;});});}function getCustomFields(_0x317aea,_0x3a2cf2,_0x1232db){var _0x29f5c2={};if(_0x317aea['length']>0x0){_['forEach'](_0x317aea,function(_0x1de8a7){if(_[_0x29cc('0x35')]([_0x29cc('0x36'),_0x29cc('0x37')],_0x1de8a7[_0x29cc('0x38')])&&_0x1de8a7[_0x29cc('0x39')]&&!_0x1de8a7[_0x29cc('0x3a')]){var _0x4a66c7=_0x1de8a7[_0x29cc('0x3b')]['toLowerCase']();var _0x3878cb=_0x4a66c7[_0x29cc('0x2b')](0x0,_0x4a66c7[_0x29cc('0x3c')]('_'));var _0x25c8cc=_0x4a66c7[_0x29cc('0x2b')](_0x4a66c7['indexOf']('_')+0x1);if(_0x3878cb===_0x1232db){_0x29f5c2[_0x25c8cc]=_0x1de8a7[_0x29cc('0x3d')];}}});}return _0x29f5c2;}function getTicket(_0x36ffc0,_0x103bc3,_0x4fbb83,_0x15fff7,_0x43681b,_0x769f9e,_0x58ce7c){return new Promise(function(_0x34e949,_0x1da51){var _0x39f152;return getAuthToken(_0x103bc3,_0x4fbb83,_0x58ce7c)['then'](function(_0x473744){if(_0x769f9e['ticketType']==='incident'){_0x39f152={'method':_0x29cc('0x10'),'uri':_0x15fff7+'incidents','body':Object[_0x29cc('0x3e')]({},{'title':intUtil[_0x29cc('0x3f')](_0x769f9e[_0x29cc('0x40')],_0x43681b,'\x20'),'description':intUtil[_0x29cc('0x3f')](_0x769f9e[_0x29cc('0x41')],_0x43681b,'\x0a'),'customerid_contact@odata.bind':_0x36ffc0[_0x29cc('0x2d')]?_0x29cc('0x42')+_0x36ffc0[_0x29cc('0x2d')]+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x36ffc0[_0x29cc('0x23')]+')','caseorigincode':'1'},getCustomFields(_0x769f9e[_0x29cc('0x43')],_0x43681b,_0x769f9e[_0x29cc('0x44')])),'headers':{'Authorization':'Bearer\x20'+_0x473744,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}if(_0x769f9e[_0x29cc('0x44')]===_0x29cc('0x45')){var _0x5bd73b=_0x36ffc0['enduserId']?[{'partyid_systemuser@odata.bind':'/systemusers('+_0x36ffc0[_0x29cc('0x23')]+')','participationtypemask':_0x36ffc0['callDirection']===_0x29cc('0x46')?0x2:0x1},{'partyid_contact@odata.bind':_0x29cc('0x42')+_0x36ffc0['enduserId']+')','participationtypemask':_0x36ffc0[_0x29cc('0x47')]===_0x29cc('0x46')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x29cc('0x29')+_0x36ffc0[_0x29cc('0x23')]+')','participationtypemask':_0x36ffc0[_0x29cc('0x47')]===_0x29cc('0x46')?0x2:0x1}];_0x39f152={'method':'POST','uri':_0x15fff7+_0x29cc('0x48'),'body':Object['assign']({},{'subject':intUtil['getString'](_0x769f9e[_0x29cc('0x40')],_0x43681b,'\x20'),'phonenumber':String(_0x43681b[_0x29cc('0x28')]),'description':intUtil['getString'](_0x769f9e[_0x29cc('0x41')],_0x43681b,'\x0a'),'regardingobjectid_contact@odata.bind':_0x36ffc0[_0x29cc('0x2d')]?_0x29cc('0x42')+_0x36ffc0[_0x29cc('0x2d')]+')':undefined,'ownerid@odata.bind':_0x29cc('0x29')+_0x36ffc0[_0x29cc('0x23')]+')','directioncode':_0x36ffc0[_0x29cc('0x47')]===_0x29cc('0x46')?![]:!![],'phonecall_activity_parties':_0x5bd73b},getCustomFields(_0x769f9e[_0x29cc('0x43')],_0x43681b,_0x769f9e[_0x29cc('0x44')])),'headers':{'Authorization':_0x29cc('0x18')+_0x473744,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x39f152);})[_0x29cc('0x12')](function(_0x54ec79){var _0x27cddf=_0x54ec79[_0x29cc('0x49')][_0x29cc('0x4a')];var _0x157b36=_0x27cddf[_0x29cc('0x2b')](_0x27cddf['lastIndexOf']('(')+0x1,_0x27cddf[_0x29cc('0x2c')](')'));_0x36ffc0['ticketId']=_0x157b36;_0x34e949(_0x36ffc0);})[_0x29cc('0x14')](function(_0x2e8e05){_0x1da51(_0x2e8e05[_0x29cc('0x16')]);});});}function emit(_0x509ec9,_0x1f9799,_0x567576,_0x43bb33){var _0x6fd142={'uri':util['format'](_0x29cc('0x4b'),_0x509ec9,_0x567576,_0x43bb33)};io['to'](util['format'](_0x29cc('0x4c'),_0x1f9799))[_0x29cc('0x4d')](_0x29cc('0x4e'),_0x6fd142);}exports['cs']=function(_0x3e56f,_0x98ffd0,_0x4e1770,_0x1339f0,_0x2e264f,_0x19ea29,_0x21c0ef,_0x40a9b2){var _0x2b38cc={};_0x19ea29[_0x29cc('0xa')]=_0x19ea29[_0x29cc('0x9')]?intUtil[_0x29cc('0x4f')](_0x19ea29['CloudProvider'][_0x29cc('0xb')]):intUtil[_0x29cc('0x4f')](_0x19ea29[_0x29cc('0xa')]);_0x19ea29[_0x29cc('0x50')]=intUtil[_0x29cc('0x4f')](_0x19ea29['serverUrl']);_0x2b38cc[_0x29cc('0x47')]=_0x40a9b2===_0x29cc('0x46')||_0x40a9b2===_0x29cc('0x51')?'queue':_0x29cc('0x52');var _0x295f93=_0x19ea29['modernAuthentication']?util['format'](_0x29cc('0x53'),_0x19ea29[_0x29cc('0xd')][_0x29cc('0xb')]):util[_0x29cc('0x54')](_0x29cc('0x53'),_0x19ea29[_0x29cc('0xa')]);var _0x5c8090=util[_0x29cc('0x54')](_0x29cc('0x55'),_0x19ea29[_0x29cc('0xc')]);var _0x11ae7e=util[_0x29cc('0x54')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x19ea29[_0x29cc('0x50')],_0x98ffd0[_0x29cc('0x56')],md5(_0x98ffd0['uniqueid']));if(_0x2e264f&&_0x2e264f['monitor_format']){logger[_0x29cc('0x24')](_0x29cc('0x57'),_0x29cc('0x58'));_0x98ffd0['recordingURL']=_0x11ae7e;}else if(_0x21c0ef&&_0x21c0ef[_0x29cc('0x59')]&&_0x21c0ef[_0x29cc('0x59')]!==_0x29cc('0x5a')){logger[_0x29cc('0x24')](_0x29cc('0x5b'),_0x29cc('0x58'));_0x98ffd0['recordingURL']=_0x11ae7e;}else{_0x98ffd0[_0x29cc('0x5c')]='';}return getUser(_0x2b38cc,_0x19ea29,_0x1339f0,_0x5c8090,_0x295f93,_0x40a9b2)[_0x29cc('0x12')](function(_0x5a8a17){logger[_0x29cc('0x24')]('['+_0x40a9b2[_0x29cc('0x20')]()+_0x29cc('0x5d'),_0x5a8a17[_0x29cc('0x23')]);logger[_0x29cc('0x24')]('['+_0x40a9b2[_0x29cc('0x20')]()+_0x29cc('0x5e'),_0x5a8a17['userEmail']);return getEndUser(_0x5a8a17,_0x19ea29,_0x5c8090,_0x295f93,_0x98ffd0,_0x40a9b2,_0x4e1770[_0x29cc('0x5f')],_0x4e1770['additionalSearchContact']);})['then'](function(_0x2171ae){logger[_0x29cc('0x24')]('['+_0x40a9b2[_0x29cc('0x20')]()+_0x29cc('0x60'),_0x2171ae[_0x29cc('0x2d')]);logger['info']('['+_0x40a9b2[_0x29cc('0x20')]()+_0x29cc('0x61'),_0x98ffd0[_0x29cc('0x28')]);return getTicket(_0x2171ae,_0x19ea29,_0x5c8090,_0x295f93,_0x98ffd0,_0x4e1770,_0x40a9b2);})['then'](function(_0x5b4172){logger[_0x29cc('0x24')](util[_0x29cc('0x54')]('['+_0x40a9b2[_0x29cc('0x20')]()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x4e1770[_0x29cc('0x44')],_0x5b4172[_0x29cc('0x62')]));logger[_0x29cc('0x24')](util[_0x29cc('0x54')]('['+_0x40a9b2['toUpperCase']()+_0x29cc('0x63'),_0x40a9b2));if(_0x40a9b2!=='unmanaged'&&_0x4e1770['openNewTab']){logger[_0x29cc('0x24')]('['+_0x40a9b2[_0x29cc('0x20')]()+']',_0x29cc('0x64'));emit(_0x19ea29[_0x29cc('0xa')],_0x1339f0[_0x29cc('0x65')],_0x4e1770['ticketType'],_0x5b4172[_0x29cc('0x62')]);}})[_0x29cc('0x14')](function(_0x4614e0){logger[_0x29cc('0x15')]('['+_0x40a9b2['toUpperCase']()+_0x29cc('0x66'),_0x4614e0[_0x29cc('0x16')]);console[_0x29cc('0x15')](_0x29cc('0x67'),_0x4614e0);});}; \ No newline at end of file +var _0xb806=['lodash','request-promise','md5','dynamics365','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','modernAuthentication','remoteUri','data7','data2','CloudProvider','data5','POST','clientId','password','clientSecret','then','access_token','catch','error','toUpperCase',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','validateEmail','email','userEmail','length','internalemailaddress','isdisabled',']\x20Agent\x20found\x20','systemuserid','userId','info',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','toLowerCase','/systemusers(','body','headers','odata-entityid','substring','lastIndexOf','outbound','destcalleridnum','telephone1','&$filter=','replace','%2b','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing','enduserId','string','picklist','nameField','customField','idField','indexOf','content','ticketType','incidents','assign','Subjects','getString','/contacts(','Fields','queue','callDirection','phonecalls','calleridnum','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','tenantId','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration'];(function(_0x48da45,_0x259bea){var _0x5d5687=function(_0x2d0a0f){while(--_0x2d0a0f){_0x48da45['push'](_0x48da45['shift']());}};_0x5d5687(++_0x259bea);}(_0xb806,0x1a8));var _0x6b80=function(_0x119d5a,_0x19b457){_0x119d5a=_0x119d5a-0x0;var _0x15bff4=_0xb806[_0x119d5a];return _0x15bff4;};'use strict';var _=require(_0x6b80('0x0'));var rp=require(_0x6b80('0x1'));var util=require('util');var intUtil=require('./util');var md5=require(_0x6b80('0x2'));var Redis=require('ioredis');var logger=require('../../../../config/logger')(_0x6b80('0x3'));var config=require(_0x6b80('0x4'));config[_0x6b80('0x5')]=_[_0x6b80('0x6')](config['redis'],{'host':_0x6b80('0x7'),'port':0x18eb});var io=require(_0x6b80('0x8'))(new Redis(config['redis']));function getAuthToken(_0x11ba64,_0x285f48,_0xb0b926){if(_0x11ba64[_0x6b80('0x9')]){_0x11ba64[_0x6b80('0xa')]=_0x11ba64['CloudProvider'][_0x6b80('0xb')];_0x11ba64['tenantId']=_0x11ba64['CloudProvider'][_0x6b80('0xc')];return Promise['resolve'](_0x11ba64[_0x6b80('0xd')][_0x6b80('0xe')]);}var _0x3290d0={'method':_0x6b80('0xf'),'uri':_0x285f48,'form':{'client_id':_0x11ba64[_0x6b80('0x10')],'resource':_0x11ba64[_0x6b80('0xa')],'username':_0x11ba64['username'],'password':_0x11ba64[_0x6b80('0x11')],'grant_type':'password','client_secret':_0x11ba64[_0x6b80('0x12')]},'json':!![]};return rp(_0x3290d0)[_0x6b80('0x13')](function(_0x3be51d){return _0x3be51d[_0x6b80('0x14')];})[_0x6b80('0x15')](function(_0x36ea63){logger[_0x6b80('0x16')]('['+[_0xb0b926[_0x6b80('0x17')]()]+_0x6b80('0x18'));return _0x36ea63[_0x6b80('0x19')];});}function getUser(_0x1f3658,_0x48a91c,_0x42e46a,_0x3f3faf,_0x52f7e1,_0x216dce){return new Promise(function(_0x1f58e0,_0x80611f){return getAuthToken(_0x48a91c,_0x3f3faf,_0x216dce)[_0x6b80('0x13')](function(_0x4ce11c){var _0x22f2de={'method':_0x6b80('0x1a'),'uri':_0x52f7e1+_0x6b80('0x1b'),'headers':{'Authorization':_0x6b80('0x1c')+_0x4ce11c,'OData-Version':_0x6b80('0x1d')},'json':!![]};return rp(_0x22f2de);})[_0x6b80('0x13')](function(_0x1db21d){var _0x54ea6b=_0x1db21d[_0x6b80('0x1e')];var _0xd66ec5=![];var _0x213a58=null;if(!_[_0x6b80('0x1f')](_0x42e46a)){if(intUtil[_0x6b80('0x20')](_0x42e46a[_0x6b80('0x21')])){_0x1f3658[_0x6b80('0x22')]=_0x42e46a[_0x6b80('0x21')];for(_0x213a58=0x0;_0x213a58<_0x54ea6b[_0x6b80('0x23')];_0x213a58++){if(_0x54ea6b[_0x213a58][_0x6b80('0x24')]===_0x42e46a[_0x6b80('0x21')]&&!_0x54ea6b[_0x213a58][_0x6b80('0x25')]){_0xd66ec5=!![];logger['info']('['+[_0x216dce[_0x6b80('0x17')]()]+_0x6b80('0x26')+_0x54ea6b[_0x213a58][_0x6b80('0x27')]+'!');_0x1f3658[_0x6b80('0x28')]=_0x54ea6b[_0x213a58][_0x6b80('0x27')];}}}}if(!_0xd66ec5){logger[_0x6b80('0x29')]('['+[_0x216dce[_0x6b80('0x17')]()]+_0x6b80('0x2a'));_0x1f3658[_0x6b80('0x22')]=_0x48a91c['username'];for(_0x213a58=0x0;_0x213a58<_0x54ea6b[_0x6b80('0x23')];_0x213a58++){if(_0x54ea6b[_0x213a58][_0x6b80('0x24')]===_0x48a91c['username']){_0x1f3658[_0x6b80('0x28')]=_0x54ea6b[_0x213a58][_0x6b80('0x27')];}}}_0x1f58e0(_0x1f3658);})[_0x6b80('0x15')](function(_0x167003){_0x80611f(_0x167003[_0x6b80('0x19')]);});});}function createEndUser(_0x32f893,_0x4bbc80,_0x733e4b,_0x399cb5,_0x3a617d,_0x4ae0b8,_0x2212ca){return new Promise(function(_0x3aee33,_0x1de06f){return getAuthToken(_0x4bbc80,_0x733e4b,_0x4ae0b8)['then'](function(_0x49f2dc){var _0x25021d=_0x4ae0b8[_0x6b80('0x2b')]()==='outbound'?_0x3a617d['destcalleridnum']:_0x3a617d['calleridnum'];var _0x30be92={'method':_0x6b80('0xf'),'uri':_0x399cb5+'contacts','body':{'fullname':_0x25021d,'firstname':_0x25021d,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x6b80('0x2c')+_0x32f893[_0x6b80('0x28')]+')'},'headers':{'Authorization':_0x6b80('0x1c')+_0x49f2dc,'OData-Version':_0x6b80('0x1d')},'json':!![],'resolveWithFullResponse':!![]};_0x30be92[_0x6b80('0x2d')][_0x2212ca]=_0x25021d;return rp(_0x30be92);})[_0x6b80('0x13')](function(_0x272057){var _0x1f367f=_0x272057[_0x6b80('0x2e')][_0x6b80('0x2f')];var _0x23055d=_0x1f367f[_0x6b80('0x30')](_0x1f367f[_0x6b80('0x31')]('(')+0x1,_0x1f367f['lastIndexOf'](')'));_0x32f893['enduserId']=_0x23055d;_0x3aee33(_0x32f893);})[_0x6b80('0x15')](function(_0x3f72cb){_0x1de06f(_0x3f72cb[_0x6b80('0x19')]);});});}function getEndUser(_0x4a3732,_0x12b290,_0x2eaa6a,_0x230ba9,_0x4364ba,_0x5c03e6,_0x50cd7a,_0x16f6d1){var _0x4f51d6=_0x5c03e6['toLowerCase']()===_0x6b80('0x32')?_0x4364ba[_0x6b80('0x33')]:_0x4364ba['calleridnum'];return getAuthToken(_0x12b290,_0x2eaa6a,_0x5c03e6)[_0x6b80('0x13')](function(_0xa512de){_0x16f6d1=_0x16f6d1?_0x16f6d1:_0x6b80('0x34');var _0x5065df={'method':_0x6b80('0x1a'),'uri':_0x230ba9+'contacts?$select='+_0x16f6d1+_0x6b80('0x35')+_0x16f6d1+'\x20eq\x20\x27'+_0x4f51d6[_0x6b80('0x36')]('+',_0x6b80('0x37'))+'\x27','headers':{'Authorization':'Bearer\x20'+_0xa512de,'If-None-Match':null,'OData-Version':_0x6b80('0x1d')},'json':!![]};return rp(_0x5065df);})['then'](function(_0x5b67cd){var _0xe68d7c=![];if(!_0x5b67cd)return _0xe68d7c;var _0x4421ec=_0x5b67cd['value'];for(var _0x233f47=0x0;_0x233f47<_0x4421ec[_0x6b80('0x23')];_0x233f47++){if(_0x4421ec[_0x233f47][_0x16f6d1]===_0x4f51d6){_0xe68d7c=!![];_0x4a3732['enduserId']=_0x4421ec[_0x233f47]['contactid'];}}return _0xe68d7c;})['then'](function(_0x16754c){if(_0x16754c)return _0x4a3732;if(_0x50cd7a===_0x6b80('0x38')){logger[_0x6b80('0x29')]('['+[_0x5c03e6[_0x6b80('0x17')]()]+_0x6b80('0x39'));return _0x4a3732;}return createEndUser(_0x4a3732,_0x12b290,_0x2eaa6a,_0x230ba9,_0x4364ba,_0x5c03e6,_0x16f6d1)['then'](function(_0x5bb2fe){logger[_0x6b80('0x29')]('['+[_0x5c03e6['toUpperCase']()]+']\x20Enduser\x20created!',_0x5bb2fe[_0x6b80('0x3a')]);return _0x5bb2fe;});});}function getCustomFields(_0x501d28,_0x1cad00,_0x4c8ac9){var _0x581e29={};if(_0x501d28['length']>0x0){_['forEach'](_0x501d28,function(_0x20fd3e){if(_['includes']([_0x6b80('0x3b'),_0x6b80('0x3c')],_0x20fd3e['type'])&&_0x20fd3e[_0x6b80('0x3d')]&&!_0x20fd3e[_0x6b80('0x3e')]){var _0x1fe28b=_0x20fd3e[_0x6b80('0x3f')][_0x6b80('0x2b')]();var _0x437583=_0x1fe28b[_0x6b80('0x30')](0x0,_0x1fe28b[_0x6b80('0x40')]('_'));var _0xce8721=_0x1fe28b[_0x6b80('0x30')](_0x1fe28b[_0x6b80('0x40')]('_')+0x1);if(_0x437583===_0x4c8ac9){_0x581e29[_0xce8721]=_0x20fd3e[_0x6b80('0x41')];}}});}return _0x581e29;}function getTicket(_0x526cc8,_0x47584e,_0x372c52,_0x20eafc,_0xed8dc,_0x1a6df1,_0x483e7d){return new Promise(function(_0xb8c324,_0x22b276){var _0x5bde97;return getAuthToken(_0x47584e,_0x372c52,_0x483e7d)[_0x6b80('0x13')](function(_0x385ebb){if(_0x1a6df1[_0x6b80('0x42')]==='incident'){_0x5bde97={'method':_0x6b80('0xf'),'uri':_0x20eafc+_0x6b80('0x43'),'body':Object[_0x6b80('0x44')]({},{'title':intUtil['getString'](_0x1a6df1[_0x6b80('0x45')],_0xed8dc,'\x20'),'description':intUtil[_0x6b80('0x46')](_0x1a6df1['Descriptions'],_0xed8dc,'\x0a'),'customerid_contact@odata.bind':_0x526cc8[_0x6b80('0x3a')]?_0x6b80('0x47')+_0x526cc8[_0x6b80('0x3a')]+')':undefined,'ownerid@odata.bind':_0x6b80('0x2c')+_0x526cc8[_0x6b80('0x28')]+')','caseorigincode':'1'},getCustomFields(_0x1a6df1[_0x6b80('0x48')],_0xed8dc,_0x1a6df1[_0x6b80('0x42')])),'headers':{'Authorization':'Bearer\x20'+_0x385ebb,'OData-Version':_0x6b80('0x1d')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x1a6df1[_0x6b80('0x42')]==='phonecall'){var _0xd1fb53=_0x526cc8[_0x6b80('0x3a')]?[{'partyid_systemuser@odata.bind':_0x6b80('0x2c')+_0x526cc8[_0x6b80('0x28')]+')','participationtypemask':_0x526cc8['callDirection']===_0x6b80('0x49')?0x2:0x1},{'partyid_contact@odata.bind':_0x6b80('0x47')+_0x526cc8[_0x6b80('0x3a')]+')','participationtypemask':_0x526cc8[_0x6b80('0x4a')]===_0x6b80('0x49')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':'/systemusers('+_0x526cc8[_0x6b80('0x28')]+')','participationtypemask':_0x526cc8[_0x6b80('0x4a')]===_0x6b80('0x49')?0x2:0x1}];_0x5bde97={'method':_0x6b80('0xf'),'uri':_0x20eafc+_0x6b80('0x4b'),'body':Object[_0x6b80('0x44')]({},{'subject':intUtil['getString'](_0x1a6df1[_0x6b80('0x45')],_0xed8dc,'\x20'),'phonenumber':String(_0xed8dc[_0x6b80('0x4c')]),'description':intUtil[_0x6b80('0x46')](_0x1a6df1['Descriptions'],_0xed8dc,'\x0a'),'regardingobjectid_contact@odata.bind':_0x526cc8[_0x6b80('0x3a')]?_0x6b80('0x47')+_0x526cc8['enduserId']+')':undefined,'ownerid@odata.bind':_0x6b80('0x2c')+_0x526cc8[_0x6b80('0x28')]+')','directioncode':_0x526cc8[_0x6b80('0x4a')]===_0x6b80('0x49')?![]:!![],'phonecall_activity_parties':_0xd1fb53},getCustomFields(_0x1a6df1['Fields'],_0xed8dc,_0x1a6df1[_0x6b80('0x42')])),'headers':{'Authorization':_0x6b80('0x1c')+_0x385ebb,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x5bde97);})[_0x6b80('0x13')](function(_0x2b2579){var _0x5c919e=_0x2b2579[_0x6b80('0x2e')]['odata-entityid'];var _0x232d59=_0x5c919e[_0x6b80('0x30')](_0x5c919e['lastIndexOf']('(')+0x1,_0x5c919e[_0x6b80('0x31')](')'));_0x526cc8[_0x6b80('0x4d')]=_0x232d59;_0xb8c324(_0x526cc8);})[_0x6b80('0x15')](function(_0x42648){_0x22b276(_0x42648[_0x6b80('0x19')]);});});}function emit(_0xe7e083,_0x39865e,_0x5df14c,_0x4e5be0){var _0x5f479c={'uri':util[_0x6b80('0x4e')](_0x6b80('0x4f'),_0xe7e083,_0x5df14c,_0x4e5be0)};io['to'](util[_0x6b80('0x4e')](_0x6b80('0x50'),_0x39865e))[_0x6b80('0x51')](_0x6b80('0x52'),_0x5f479c);}exports['cs']=function(_0x23d5e3,_0x19dd99,_0xd24484,_0x1d7abb,_0x2d18be,_0x5e0987,_0x4f4bbf,_0x284b5e){var _0x533509={};_0x5e0987['remoteUri']=_0x5e0987['modernAuthentication']?intUtil[_0x6b80('0x53')](_0x5e0987[_0x6b80('0xd')][_0x6b80('0xb')]):intUtil['stripTrailingSlash'](_0x5e0987[_0x6b80('0xa')]);_0x5e0987[_0x6b80('0x54')]=intUtil[_0x6b80('0x53')](_0x5e0987[_0x6b80('0x54')]);_0x533509['callDirection']=_0x284b5e===_0x6b80('0x49')||_0x284b5e===_0x6b80('0x55')?_0x6b80('0x49'):_0x6b80('0x32');var _0x5d4b52=_0x5e0987['modernAuthentication']?util['format'](_0x6b80('0x56'),_0x5e0987['CloudProvider'][_0x6b80('0xb')]):util[_0x6b80('0x4e')](_0x6b80('0x56'),_0x5e0987[_0x6b80('0xa')]);var _0x251d1a=util[_0x6b80('0x4e')](_0x6b80('0x57'),_0x5e0987[_0x6b80('0x58')]);var _0x5a8711=util[_0x6b80('0x4e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5e0987[_0x6b80('0x54')],_0x19dd99['uniqueid'],md5(_0x19dd99[_0x6b80('0x59')]));if(_0x2d18be&&_0x2d18be['monitor_format']){logger[_0x6b80('0x29')](_0x6b80('0x5a'),_0x6b80('0x5b'));_0x19dd99[_0x6b80('0x5c')]=_0x5a8711;}else if(_0x4f4bbf&&_0x4f4bbf[_0x6b80('0x5d')]&&_0x4f4bbf['recordingFormat']!=='none'){logger[_0x6b80('0x29')](_0x6b80('0x5e'),_0x6b80('0x5b'));_0x19dd99[_0x6b80('0x5c')]=_0x5a8711;}else{_0x19dd99[_0x6b80('0x5c')]='';}return getUser(_0x533509,_0x5e0987,_0x1d7abb,_0x251d1a,_0x5d4b52,_0x284b5e)['then'](function(_0x3cf7c7){logger[_0x6b80('0x29')]('['+_0x284b5e[_0x6b80('0x17')]()+_0x6b80('0x5f'),_0x3cf7c7[_0x6b80('0x28')]);logger[_0x6b80('0x29')]('['+_0x284b5e[_0x6b80('0x17')]()+_0x6b80('0x60'),_0x3cf7c7[_0x6b80('0x22')]);return getEndUser(_0x3cf7c7,_0x5e0987,_0x251d1a,_0x5d4b52,_0x19dd99,_0x284b5e,_0xd24484[_0x6b80('0x61')],_0xd24484[_0x6b80('0x62')]);})[_0x6b80('0x13')](function(_0x34e4c3){logger[_0x6b80('0x29')]('['+_0x284b5e['toUpperCase']()+_0x6b80('0x63'),_0x34e4c3[_0x6b80('0x3a')]);logger['info']('['+_0x284b5e[_0x6b80('0x17')]()+']\x20The\x20Enduser\x20phone\x20is:',_0x19dd99['calleridnum']);return getTicket(_0x34e4c3,_0x5e0987,_0x251d1a,_0x5d4b52,_0x19dd99,_0xd24484,_0x284b5e);})[_0x6b80('0x13')](function(_0x133770){logger[_0x6b80('0x29')](util[_0x6b80('0x4e')]('['+_0x284b5e[_0x6b80('0x17')]()+_0x6b80('0x64'),_0xd24484[_0x6b80('0x42')],_0x133770[_0x6b80('0x4d')]));logger['info'](util[_0x6b80('0x4e')]('['+_0x284b5e[_0x6b80('0x17')]()+_0x6b80('0x65'),_0x284b5e));if(_0x284b5e!=='unmanaged'&&_0xd24484[_0x6b80('0x66')]){logger[_0x6b80('0x29')]('['+_0x284b5e[_0x6b80('0x17')]()+']',_0x6b80('0x67'));emit(_0x5e0987[_0x6b80('0xa')],_0x1d7abb['name'],_0xd24484[_0x6b80('0x42')],_0x133770['ticketId']);}})[_0x6b80('0x15')](function(_0x2d0277){logger[_0x6b80('0x16')]('['+_0x284b5e['toUpperCase']()+_0x6b80('0x68'),_0x2d0277['message']);console[_0x6b80('0x16')](_0x6b80('0x69'),_0x2d0277);});}; \ 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 db98d45..85894f0 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 _0x6f3a=['Recording\x20is\x20enabled!','recordingURL','uniqueid','Authorization','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','catch','error','outbound','recordingFormat','destcalleridname','destcalleridnum','[OUTBOUND]','user:%s','%s/helpdesk/tickets/%d','unmanaged','lastevent','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','toUpperCase','lodash','request-promise','md5','util','ioredis','../../../../config/logger','defaults','redis','localhost','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','format','Caller\x20-\x20%s','calleridname','calleridnum','Subjects','getString','Descriptions','
','Tags','name','Fields','keyBy','custom_fields','value','remoteUri','POST','then','validateEmail','%s/api/v2/agents','length','Agent\x20found!','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20created.','apiKey','toString','base64','debug','stringify','GET','map','forEach','includes','string','picklist','type','nameField','toLowerCase','content','idField','push','variable','variableName','customField','customVariable','Variable','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]'];(function(_0xf6a62,_0x557fc6){var _0x4361b1=function(_0xa8969e){while(--_0xa8969e){_0xf6a62['push'](_0xf6a62['shift']());}};_0x4361b1(++_0x557fc6);}(_0x6f3a,0x18f));var _0xa6f3=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x6f3a[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0xa6f3('0x0'));var rp=require(_0xa6f3('0x1'));var md5=require(_0xa6f3('0x2'));var util=require(_0xa6f3('0x3'));var Redis=require(_0xa6f3('0x4'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0xa6f3('0x5'))('freshdesk');config['redis']=_[_0xa6f3('0x6')](config[_0xa6f3('0x7')],{'host':_0xa6f3('0x8'),'port':0x18eb});var io=require(_0xa6f3('0x9'))(new Redis(config[_0xa6f3('0x7')]));var headers={'Content-Type':_0xa6f3('0xa'),'Accept':_0xa6f3('0xa')};function emit(_0x439a51,_0x4a7c8b,_0x3c40df){io['to'](_0x439a51)[_0xa6f3('0xb')](_0x4a7c8b,_0x3c40df);}function getTicket(_0x4ef996,_0x10e480,_0x472f3c,_0x170ae6,_0x8af68a){logger[_0xa6f3('0xc')](_0xa6f3('0xd'));var _0x91b616=_['merge']({'responder_id':_0x10e480['id'],'requester_id':_0x472f3c['id'],'name':util[_0xa6f3('0xe')](_0xa6f3('0xf'),_0x8af68a[_0xa6f3('0x10')]),'phone':_0x8af68a[_0xa6f3('0x11')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x170ae6[_0xa6f3('0x12')],_0x8af68a,'\x20'),'description':intUtil[_0xa6f3('0x13')](_0x170ae6[_0xa6f3('0x14')],_0x8af68a,_0xa6f3('0x15')),'tags':getTags(_0x170ae6[_0xa6f3('0x16')],_0xa6f3('0x17'))},getCustomFields(_0x170ae6[_0xa6f3('0x18')],_0x8af68a));_0x91b616['custom_fields']=_['mapValues'](_[_0xa6f3('0x19')](_0x91b616[_0xa6f3('0x1a')],'id'),_0xa6f3('0x1b'));return request({'uri':util[_0xa6f3('0xe')]('%s/api/v2/tickets',_0x4ef996[_0xa6f3('0x1c')]),'method':_0xa6f3('0x1d'),'body':_0x91b616})[_0xa6f3('0x1e')](function(_0x36cf0f){logger[_0xa6f3('0xc')]('Ticket\x20created!');return _0x36cf0f;});}function getUser(_0x3ed175,_0x2e8dbc){if(intUtil[_0xa6f3('0x1f')](_0x2e8dbc)){return request({'uri':util['format'](_0xa6f3('0x20'),_0x3ed175['remoteUri']),'qs':{'email':_0x2e8dbc}})[_0xa6f3('0x1e')](function(_0x1ce294){if(_0x1ce294[_0xa6f3('0x21')]){logger[_0xa6f3('0xc')](_0xa6f3('0x22'));return _[_0xa6f3('0x23')](_0x1ce294,function(_0x2fea85){return _0x2fea85[_0xa6f3('0x24')][_0xa6f3('0x25')]===_0x2e8dbc;});}else{logger[_0xa6f3('0xc')](_0xa6f3('0x26'));return request({'uri':util[_0xa6f3('0xe')](_0xa6f3('0x27'),_0x3ed175[_0xa6f3('0x1c')])})[_0xa6f3('0x1e')](function(_0x46161c){logger['info'](_0xa6f3('0x28'));return _0x46161c;});}});}else{logger[_0xa6f3('0xc')](_0xa6f3('0x29'));return request({'uri':util[_0xa6f3('0xe')](_0xa6f3('0x27'),_0x3ed175[_0xa6f3('0x1c')])})['then'](function(_0x265714){logger[_0xa6f3('0xc')](_0xa6f3('0x28'));return _0x265714;});}}function getEndUser(_0x58340a,_0x4d6d7b,_0x495f17){logger[_0xa6f3('0xc')]('Searching\x20enduser\x20with\x20phone',_0x495f17);return request({'uri':util[_0xa6f3('0xe')](_0xa6f3('0x2a'),_0x58340a[_0xa6f3('0x1c')]),'qs':{'phone':_0x495f17}})[_0xa6f3('0x1e')](function(_0x569500){if(_0x569500['length']){logger['info'](_0xa6f3('0x2b'));return _[_0xa6f3('0x23')](_0x569500,{'phone':_0x495f17});}else{logger[_0xa6f3('0xc')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util['format']('%s/api/v2/contacts',_0x58340a[_0xa6f3('0x1c')]),'method':_0xa6f3('0x1d'),'body':{'name':_0x4d6d7b,'phone':_0x495f17}})['then'](function(_0x6b1c1b){logger['info'](_0xa6f3('0x2c'));return _0x6b1c1b;});}});}function getAuth(_0x1a533e){return util[_0xa6f3('0xe')]('Basic\x20%s',new Buffer(_0x1a533e[_0xa6f3('0x2d')]+':X')[_0xa6f3('0x2e')](_0xa6f3('0x2f')));}function request(_0x4aa0df){logger[_0xa6f3('0x30')]('[HTTP]',JSON[_0xa6f3('0x31')](_0x4aa0df));return rp(_[_0xa6f3('0x6')](_0x4aa0df,{'method':_0xa6f3('0x32'),'headers':headers,'json':!![]}));}function getTags(_0x89eb20,_0x5be1bc){var _0x2effe0=[];if(_0x89eb20&&_0x89eb20[_0xa6f3('0x21')]>0x0){_0x2effe0=_[_0xa6f3('0x33')](_0x89eb20,_0x5be1bc);}return _0x2effe0;}function getCustomFields(_0x33d0fa,_0x2e4f69){var _0x377c4c=[];var _0x566b11={'custom_fields':[]};if(_0x33d0fa[_0xa6f3('0x21')]>0x0){_[_0xa6f3('0x34')](_0x33d0fa,function(_0x4d219d){if(_[_0xa6f3('0x35')]([_0xa6f3('0x36'),_0xa6f3('0x37')],_0x4d219d[_0xa6f3('0x38')])&&_0x4d219d['nameField']&&!_0x4d219d['customField']){_0x566b11[_0x4d219d[_0xa6f3('0x39')][_0xa6f3('0x3a')]()]=_0x4d219d[_0xa6f3('0x3b')][_0xa6f3('0x2e')]();}else if(_[_0xa6f3('0x35')]([_0xa6f3('0x36'),_0xa6f3('0x37')],_0x4d219d[_0xa6f3('0x38')])&&_0x4d219d[_0xa6f3('0x3c')]&&_0x4d219d['customField']){_0x566b11[_0xa6f3('0x1a')][_0xa6f3('0x3d')]({'id':_0x4d219d[_0xa6f3('0x3c')],'value':_0x4d219d[_0xa6f3('0x3b')][_0xa6f3('0x2e')]()});}else if(_0x4d219d[_0xa6f3('0x38')]===_0xa6f3('0x3e')&&_0x4d219d[_0xa6f3('0x3f')]&&_0x4d219d['idField']&&_0x4d219d[_0xa6f3('0x40')]){_0x2e4f69[_0x4d219d[_0xa6f3('0x3f')]]&&_0x566b11[_0xa6f3('0x1a')][_0xa6f3('0x3d')]({'id':_0x4d219d[_0xa6f3('0x3c')],'value':_0x2e4f69[_0x4d219d[_0xa6f3('0x3f')]][_0xa6f3('0x2e')]()});}else if(_0x4d219d[_0xa6f3('0x38')]===_0xa6f3('0x41')&&_0x4d219d[_0xa6f3('0x42')]&&_0x4d219d[_0xa6f3('0x42')][_0xa6f3('0x17')]&&_0x4d219d[_0xa6f3('0x3c')]&&_0x4d219d[_0xa6f3('0x40')]){_0x2e4f69[_0x4d219d[_0xa6f3('0x42')][_0xa6f3('0x17')][_0xa6f3('0x3a')]()]&&_0x566b11[_0xa6f3('0x1a')]['push']({'id':_0x4d219d[_0xa6f3('0x3c')],'value':_0x2e4f69[_0x4d219d['Variable']['name'][_0xa6f3('0x3a')]()][_0xa6f3('0x2e')]()});}});}return _0x566b11;}exports['queue']=function(_0x36c781,_0x39edf7,_0x2c1d56,_0x555698,_0x2c3ef2,_0x5b87ec){var _0x332060,_0x1a36fa;_0x5b87ec[_0xa6f3('0x1c')]=intUtil[_0xa6f3('0x43')](_0x5b87ec['remoteUri']);_0x5b87ec[_0xa6f3('0x44')]=intUtil[_0xa6f3('0x43')](_0x5b87ec['serverUrl']);if(_0x2c3ef2&&_0x2c3ef2[_0xa6f3('0x45')]){logger[_0xa6f3('0xc')](_0xa6f3('0x46'),_0xa6f3('0x47'));_0x39edf7[_0xa6f3('0x48')]=util[_0xa6f3('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5b87ec[_0xa6f3('0x44')],_0x39edf7[_0xa6f3('0x49')],md5(_0x39edf7['uniqueid']));}else{_0x39edf7[_0xa6f3('0x48')]='';}headers[_0xa6f3('0x4a')]=getAuth(_0x5b87ec);return getUser(_0x5b87ec,_0x555698[_0xa6f3('0x25')])['then'](function(_0x247335){_0x332060=_0x247335;logger[_0xa6f3('0xc')](_0xa6f3('0x4b'),_0x332060['id']);return getEndUser(_0x5b87ec,_0x39edf7[_0xa6f3('0x10')],_0x39edf7[_0xa6f3('0x11')]);})[_0xa6f3('0x1e')](function(_0x5ddcc4){_0x1a36fa=_0x5ddcc4;logger['info'](_0xa6f3('0x4c'),_0x1a36fa['id']);return getTicket(_0x5b87ec,_0x332060,_0x1a36fa,_0x2c1d56,_0x39edf7);})['then'](function(_0x5dc03a){if(_0x5dc03a&&_0x5dc03a['id']){logger[_0xa6f3('0xc')](_0xa6f3('0x4d'));logger[_0xa6f3('0xc')](_0xa6f3('0x4e'),_0x5dc03a['id']);logger[_0xa6f3('0xc')](_0xa6f3('0x46'),_0xa6f3('0x4f'));emit(util[_0xa6f3('0xe')]('user:%s',_0x555698[_0xa6f3('0x17')]),_0xa6f3('0x50'),{'uri':util[_0xa6f3('0xe')]('%s/helpdesk/tickets/%d',_0x5b87ec[_0xa6f3('0x1c')],_0x5dc03a['id'])});}})[_0xa6f3('0x51')](function(_0xf0369){logger[_0xa6f3('0x52')](_0xa6f3('0x46'),JSON[_0xa6f3('0x31')](_0xf0369));});};exports[_0xa6f3('0x53')]=function(_0x329767,_0x108eba,_0x38a9be,_0x418d48,_0x4a699d,_0x38d9f8,_0x4956af){var _0x58c413,_0x36d34b;_0x38d9f8[_0xa6f3('0x1c')]=intUtil[_0xa6f3('0x43')](_0x38d9f8[_0xa6f3('0x1c')]);_0x38d9f8[_0xa6f3('0x44')]=intUtil[_0xa6f3('0x43')](_0x38d9f8[_0xa6f3('0x44')]);if(_0x4956af&&_0x4956af['recordingFormat']&&_0x4956af[_0xa6f3('0x54')]!=='none'){logger['info']('[OUTBOUND]',_0xa6f3('0x47'));_0x108eba[_0xa6f3('0x48')]=util[_0xa6f3('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x38d9f8[_0xa6f3('0x44')],_0x108eba['uniqueid'],md5(_0x108eba[_0xa6f3('0x49')]));}headers['Authorization']=getAuth(_0x38d9f8);return getUser(_0x38d9f8,_0x418d48[_0xa6f3('0x25')])[_0xa6f3('0x1e')](function(_0x6f8f6e){_0x58c413=_0x6f8f6e;logger[_0xa6f3('0xc')]('The\x20User\x20ID\x20is:',_0x58c413['id']);return getEndUser(_0x38d9f8,_0x108eba[_0xa6f3('0x55')],_0x108eba[_0xa6f3('0x56')]);})[_0xa6f3('0x1e')](function(_0x166f5c){_0x36d34b=_0x166f5c;logger[_0xa6f3('0xc')]('The\x20Enduser\x20ID\x20is:',_0x36d34b['id']);return getTicket(_0x38d9f8,_0x58c413,_0x36d34b,_0x38a9be,_0x108eba);})[_0xa6f3('0x1e')](function(_0x5dedc9){if(_0x5dedc9&&_0x5dedc9['id']){logger[_0xa6f3('0xc')](_0xa6f3('0x4d'));logger['info'](_0xa6f3('0x4e'),_0x5dedc9['id']);logger[_0xa6f3('0xc')](_0xa6f3('0x57'),_0xa6f3('0x4f'));emit(util['format'](_0xa6f3('0x58'),_0x418d48['name']),_0xa6f3('0x50'),{'uri':util[_0xa6f3('0xe')](_0xa6f3('0x59'),_0x38d9f8[_0xa6f3('0x1c')],_0x5dedc9['id'])});}})['catch'](function(_0x46c16e){logger[_0xa6f3('0x52')](_0xa6f3('0x57'),JSON[_0xa6f3('0x31')](_0x46c16e));});};exports[_0xa6f3('0x5a')]=function(_0x2d6e51,_0x4acf99,_0x27b2eb,_0x1647e2,_0x8e69ae,_0x854e25){var _0x41ed2a,_0xcde183;_0x854e25['remoteUri']=intUtil[_0xa6f3('0x43')](_0x854e25['remoteUri']);_0x854e25[_0xa6f3('0x44')]=intUtil[_0xa6f3('0x43')](_0x854e25[_0xa6f3('0x44')]);if(_0x8e69ae&&_0x8e69ae['monitor_format']){logger[_0xa6f3('0xc')]('['+_0x4acf99[_0xa6f3('0x5b')]['toUpperCase']()+']',_0xa6f3('0x47'));_0x4acf99[_0xa6f3('0x48')]=util['format'](_0xa6f3('0x5c'),_0x854e25[_0xa6f3('0x44')],_0x4acf99['uniqueid'],md5(_0x4acf99[_0xa6f3('0x49')]));}else{_0x4acf99[_0xa6f3('0x48')]='';}headers[_0xa6f3('0x4a')]=getAuth(_0x854e25);return getUser(_0x854e25,'')['then'](function(_0x2e6460){_0x41ed2a=_0x2e6460;logger[_0xa6f3('0xc')](_0xa6f3('0x4b'),_0x41ed2a['id']);return getEndUser(_0x854e25,_0x4acf99[_0xa6f3('0x10')],_0x4acf99['calleridnum']);})['then'](function(_0x65ec39){_0xcde183=_0x65ec39;logger[_0xa6f3('0xc')]('The\x20Enduser\x20ID\x20is:',_0xcde183['id']);return getTicket(_0x854e25,_0x41ed2a,_0xcde183,_0x27b2eb,_0x4acf99);})[_0xa6f3('0x1e')](function(_0x269e3b){if(_0x269e3b){logger['info'](_0xa6f3('0x4d'));logger[_0xa6f3('0xc')](_0xa6f3('0x4e'),_0x269e3b['id']);}})[_0xa6f3('0x51')](function(_0x5c8228){logger[_0xa6f3('0x52')]('['+_0x4acf99[_0xa6f3('0x5b')][_0xa6f3('0x5d')]()+']',JSON[_0xa6f3('0x31')](_0x5c8228));});}; \ No newline at end of file +var _0x329b=['toString','base64','debug','[HTTP]','stringify','GET','map','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','content','idField','variableName','customVariable','Variable','name','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','calleridnum','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','outbound','recordingFormat','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridnum','The\x20Ticket\x20ID\x20is:','user:%s','unmanaged','monitor_format','lastevent','toUpperCase','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','application/json','info','merge','Caller\x20-\x20%s','calleridname','getString','Subjects','Descriptions','
','Tags','Fields','custom_fields','keyBy','value','format','%s/api/v2/tickets','remoteUri','POST','then','Ticket\x20created!','validateEmail','%s/api/v2/agents','length','Agent\x20found!','contact','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','find','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s'];(function(_0x245038,_0xc87660){var _0x5880ec=function(_0x21cefb){while(--_0x21cefb){_0x245038['push'](_0x245038['shift']());}};_0x5880ec(++_0xc87660);}(_0x329b,0x8e));var _0xb329=function(_0x4de1b1,_0x18c64c){_0x4de1b1=_0x4de1b1-0x0;var _0x639f27=_0x329b[_0x4de1b1];return _0x639f27;};'use strict';var _=require('lodash');var rp=require(_0xb329('0x0'));var md5=require(_0xb329('0x1'));var util=require(_0xb329('0x2'));var Redis=require(_0xb329('0x3'));var intUtil=require(_0xb329('0x4'));var config=require(_0xb329('0x5'));var logger=require(_0xb329('0x6'))('freshdesk');config[_0xb329('0x7')]=_[_0xb329('0x8')](config[_0xb329('0x7')],{'host':_0xb329('0x9'),'port':0x18eb});var io=require(_0xb329('0xa'))(new Redis(config[_0xb329('0x7')]));var headers={'Content-Type':_0xb329('0xb'),'Accept':'application/json'};function emit(_0x24dc41,_0x36c6d7,_0x4a4d6b){io['to'](_0x24dc41)['emit'](_0x36c6d7,_0x4a4d6b);}function getTicket(_0x233283,_0x92cf16,_0x17c867,_0x5d10bc,_0x20a9de){logger[_0xb329('0xc')]('Creating\x20new\x20ticket...');var _0x56c08c=_[_0xb329('0xd')]({'responder_id':_0x92cf16['id'],'requester_id':_0x17c867['id'],'name':util['format'](_0xb329('0xe'),_0x20a9de[_0xb329('0xf')]),'phone':_0x20a9de['calleridnum'],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xb329('0x10')](_0x5d10bc[_0xb329('0x11')],_0x20a9de,'\x20'),'description':intUtil['getString'](_0x5d10bc[_0xb329('0x12')],_0x20a9de,_0xb329('0x13')),'tags':getTags(_0x5d10bc[_0xb329('0x14')],'name')},getCustomFields(_0x5d10bc[_0xb329('0x15')],_0x20a9de));_0x56c08c[_0xb329('0x16')]=_['mapValues'](_[_0xb329('0x17')](_0x56c08c[_0xb329('0x16')],'id'),_0xb329('0x18'));return request({'uri':util[_0xb329('0x19')](_0xb329('0x1a'),_0x233283[_0xb329('0x1b')]),'method':_0xb329('0x1c'),'body':_0x56c08c})[_0xb329('0x1d')](function(_0x26de6b){logger[_0xb329('0xc')](_0xb329('0x1e'));return _0x26de6b;});}function getUser(_0x509edc,_0x4bf91e){if(intUtil[_0xb329('0x1f')](_0x4bf91e)){return request({'uri':util['format'](_0xb329('0x20'),_0x509edc[_0xb329('0x1b')]),'qs':{'email':_0x4bf91e}})['then'](function(_0x3393d5){if(_0x3393d5[_0xb329('0x21')]){logger[_0xb329('0xc')](_0xb329('0x22'));return _['find'](_0x3393d5,function(_0x2fd13f){return _0x2fd13f[_0xb329('0x23')]['email']===_0x4bf91e;});}else{logger['info'](_0xb329('0x24'));return request({'uri':util[_0xb329('0x19')](_0xb329('0x25'),_0x509edc[_0xb329('0x1b')])})[_0xb329('0x1d')](function(_0x1a115e){logger[_0xb329('0xc')](_0xb329('0x26'));return _0x1a115e;});}});}else{logger[_0xb329('0xc')](_0xb329('0x27'));return request({'uri':util[_0xb329('0x19')](_0xb329('0x25'),_0x509edc[_0xb329('0x1b')])})[_0xb329('0x1d')](function(_0x1b8114){logger[_0xb329('0xc')](_0xb329('0x26'));return _0x1b8114;});}}function getEndUser(_0x1fe42d,_0x31b24c,_0xa72977){logger[_0xb329('0xc')](_0xb329('0x28'),_0xa72977);return request({'uri':util[_0xb329('0x19')](_0xb329('0x29'),_0x1fe42d[_0xb329('0x1b')]),'qs':{'phone':_0xa72977}})['then'](function(_0x52d09a){if(_0x52d09a[_0xb329('0x21')]){logger['info']('Enduser\x20found!');return _[_0xb329('0x2a')](_0x52d09a,{'phone':_0xa72977});}else{logger['info'](_0xb329('0x2b'));return request({'uri':util['format'](_0xb329('0x29'),_0x1fe42d[_0xb329('0x1b')]),'method':_0xb329('0x1c'),'body':{'name':_0x31b24c,'phone':_0xa72977}})['then'](function(_0x23f332){logger[_0xb329('0xc')](_0xb329('0x2c'));return _0x23f332;});}});}function getAuth(_0x1e04c4){return util[_0xb329('0x19')](_0xb329('0x2d'),new Buffer(_0x1e04c4['apiKey']+':X')[_0xb329('0x2e')](_0xb329('0x2f')));}function request(_0x5bea1f){logger[_0xb329('0x30')](_0xb329('0x31'),JSON[_0xb329('0x32')](_0x5bea1f));return rp(_[_0xb329('0x8')](_0x5bea1f,{'method':_0xb329('0x33'),'headers':headers,'json':!![]}));}function getTags(_0x1563ac,_0x1ecc25){var _0x4c4375=[];if(_0x1563ac&&_0x1563ac[_0xb329('0x21')]>0x0){_0x4c4375=_[_0xb329('0x34')](_0x1563ac,_0x1ecc25);}return _0x4c4375;}function getCustomFields(_0x4f0c66,_0x19b91e){var _0x31b5fa=[];var _0x48f4f7={'custom_fields':[]};if(_0x4f0c66['length']>0x0){_[_0xb329('0x35')](_0x4f0c66,function(_0x59598b){if(_[_0xb329('0x36')]([_0xb329('0x37'),_0xb329('0x38')],_0x59598b[_0xb329('0x39')])&&_0x59598b[_0xb329('0x3a')]&&!_0x59598b[_0xb329('0x3b')]){_0x48f4f7[_0x59598b[_0xb329('0x3a')][_0xb329('0x3c')]()]=_0x59598b[_0xb329('0x3d')][_0xb329('0x2e')]();}else if(_[_0xb329('0x36')]([_0xb329('0x37'),_0xb329('0x38')],_0x59598b[_0xb329('0x39')])&&_0x59598b['idField']&&_0x59598b[_0xb329('0x3b')]){_0x48f4f7[_0xb329('0x16')]['push']({'id':_0x59598b[_0xb329('0x3e')],'value':_0x59598b[_0xb329('0x3d')]['toString']()});}else if(_0x59598b[_0xb329('0x39')]==='variable'&&_0x59598b[_0xb329('0x3f')]&&_0x59598b[_0xb329('0x3e')]&&_0x59598b['customField']){_0x19b91e[_0x59598b['variableName']]&&_0x48f4f7['custom_fields']['push']({'id':_0x59598b[_0xb329('0x3e')],'value':_0x19b91e[_0x59598b[_0xb329('0x3f')]][_0xb329('0x2e')]()});}else if(_0x59598b[_0xb329('0x39')]===_0xb329('0x40')&&_0x59598b[_0xb329('0x41')]&&_0x59598b['Variable'][_0xb329('0x42')]&&_0x59598b['idField']&&_0x59598b[_0xb329('0x3b')]){_0x19b91e[_0x59598b[_0xb329('0x41')][_0xb329('0x42')][_0xb329('0x3c')]()]&&_0x48f4f7[_0xb329('0x16')]['push']({'id':_0x59598b['idField'],'value':_0x19b91e[_0x59598b[_0xb329('0x41')][_0xb329('0x42')][_0xb329('0x3c')]()]['toString']()});}});}return _0x48f4f7;}exports['queue']=function(_0x228470,_0x501356,_0x227add,_0x533846,_0xff2f45,_0x34e56a){var _0x3398b1,_0x178e0e;_0x34e56a[_0xb329('0x1b')]=intUtil[_0xb329('0x43')](_0x34e56a['remoteUri']);_0x34e56a[_0xb329('0x44')]=intUtil[_0xb329('0x43')](_0x34e56a[_0xb329('0x44')]);if(_0xff2f45&&_0xff2f45['monitor_format']){logger[_0xb329('0xc')](_0xb329('0x45'),_0xb329('0x46'));_0x501356[_0xb329('0x47')]=util[_0xb329('0x19')](_0xb329('0x48'),_0x34e56a['serverUrl'],_0x501356['uniqueid'],md5(_0x501356[_0xb329('0x49')]));}else{_0x501356[_0xb329('0x47')]='';}headers[_0xb329('0x4a')]=getAuth(_0x34e56a);return getUser(_0x34e56a,_0x533846[_0xb329('0x4b')])[_0xb329('0x1d')](function(_0x405f22){_0x3398b1=_0x405f22;logger[_0xb329('0xc')]('The\x20User\x20ID\x20is:',_0x3398b1['id']);return getEndUser(_0x34e56a,_0x501356[_0xb329('0xf')],_0x501356[_0xb329('0x4c')]);})[_0xb329('0x1d')](function(_0x726ce7){_0x178e0e=_0x726ce7;logger[_0xb329('0xc')](_0xb329('0x4d'),_0x178e0e['id']);return getTicket(_0x34e56a,_0x3398b1,_0x178e0e,_0x227add,_0x501356);})[_0xb329('0x1d')](function(_0x3f5039){if(_0x3f5039&&_0x3f5039['id']){logger['info'](_0xb329('0x1e'));logger[_0xb329('0xc')]('The\x20Ticket\x20ID\x20is:',_0x3f5039['id']);logger[_0xb329('0xc')](_0xb329('0x45'),_0xb329('0x4e'));emit(util['format']('user:%s',_0x533846['name']),_0xb329('0x4f'),{'uri':util[_0xb329('0x19')](_0xb329('0x50'),_0x34e56a['remoteUri'],_0x3f5039['id'])});}})[_0xb329('0x51')](function(_0x1dfc6c){logger[_0xb329('0x52')](_0xb329('0x45'),JSON[_0xb329('0x32')](_0x1dfc6c));});};exports[_0xb329('0x53')]=function(_0x353187,_0x303293,_0x16d835,_0x244763,_0x1ff3b1,_0x232ab2,_0x543e19){var _0x49565c,_0xb16ce6;_0x232ab2[_0xb329('0x1b')]=intUtil[_0xb329('0x43')](_0x232ab2['remoteUri']);_0x232ab2[_0xb329('0x44')]=intUtil[_0xb329('0x43')](_0x232ab2['serverUrl']);if(_0x543e19&&_0x543e19[_0xb329('0x54')]&&_0x543e19[_0xb329('0x54')]!=='none'){logger[_0xb329('0xc')](_0xb329('0x55'),_0xb329('0x46'));_0x303293[_0xb329('0x47')]=util[_0xb329('0x19')](_0xb329('0x48'),_0x232ab2[_0xb329('0x44')],_0x303293[_0xb329('0x49')],md5(_0x303293['uniqueid']));}headers['Authorization']=getAuth(_0x232ab2);return getUser(_0x232ab2,_0x244763[_0xb329('0x4b')])[_0xb329('0x1d')](function(_0x3b288b){_0x49565c=_0x3b288b;logger[_0xb329('0xc')](_0xb329('0x56'),_0x49565c['id']);return getEndUser(_0x232ab2,_0x303293['destcalleridname'],_0x303293[_0xb329('0x57')]);})[_0xb329('0x1d')](function(_0x1d1830){_0xb16ce6=_0x1d1830;logger[_0xb329('0xc')](_0xb329('0x4d'),_0xb16ce6['id']);return getTicket(_0x232ab2,_0x49565c,_0xb16ce6,_0x16d835,_0x303293);})[_0xb329('0x1d')](function(_0x266e67){if(_0x266e67&&_0x266e67['id']){logger[_0xb329('0xc')](_0xb329('0x1e'));logger[_0xb329('0xc')](_0xb329('0x58'),_0x266e67['id']);logger[_0xb329('0xc')]('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xb329('0x19')](_0xb329('0x59'),_0x244763[_0xb329('0x42')]),_0xb329('0x4f'),{'uri':util[_0xb329('0x19')](_0xb329('0x50'),_0x232ab2[_0xb329('0x1b')],_0x266e67['id'])});}})[_0xb329('0x51')](function(_0x1db766){logger['error'](_0xb329('0x55'),JSON[_0xb329('0x32')](_0x1db766));});};exports[_0xb329('0x5a')]=function(_0x572785,_0x1bd8f2,_0x46657a,_0x20814a,_0x32f59d,_0x431f63){var _0xdd8ea0,_0x9d8d33;_0x431f63[_0xb329('0x1b')]=intUtil['stripTrailingSlash'](_0x431f63[_0xb329('0x1b')]);_0x431f63[_0xb329('0x44')]=intUtil['stripTrailingSlash'](_0x431f63[_0xb329('0x44')]);if(_0x32f59d&&_0x32f59d[_0xb329('0x5b')]){logger[_0xb329('0xc')]('['+_0x1bd8f2[_0xb329('0x5c')][_0xb329('0x5d')]()+']',_0xb329('0x46'));_0x1bd8f2[_0xb329('0x47')]=util[_0xb329('0x19')](_0xb329('0x48'),_0x431f63['serverUrl'],_0x1bd8f2['uniqueid'],md5(_0x1bd8f2[_0xb329('0x49')]));}else{_0x1bd8f2[_0xb329('0x47')]='';}headers[_0xb329('0x4a')]=getAuth(_0x431f63);return getUser(_0x431f63,'')['then'](function(_0x1544c5){_0xdd8ea0=_0x1544c5;logger['info'](_0xb329('0x56'),_0xdd8ea0['id']);return getEndUser(_0x431f63,_0x1bd8f2[_0xb329('0xf')],_0x1bd8f2[_0xb329('0x4c')]);})[_0xb329('0x1d')](function(_0x58bcc2){_0x9d8d33=_0x58bcc2;logger[_0xb329('0xc')]('The\x20Enduser\x20ID\x20is:',_0x9d8d33['id']);return getTicket(_0x431f63,_0xdd8ea0,_0x9d8d33,_0x46657a,_0x1bd8f2);})['then'](function(_0x37bd64){if(_0x37bd64){logger[_0xb329('0xc')](_0xb329('0x1e'));logger['info'](_0xb329('0x58'),_0x37bd64['id']);}})[_0xb329('0x51')](function(_0x2eea2d){logger[_0xb329('0x52')]('['+_0x1bd8f2[_0xb329('0x5c')][_0xb329('0x5d')]()+']',JSON[_0xb329('0x32')](_0x2eea2d));});}; \ 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 e5dcb2c..4749796 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 _0x6754=['username','toLowerCase','outbound','calleridnum','unmanaged','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','[OUTBOUND]','recordingURL','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','util','bluebird','ioredis','../../../../config/environment','freshsales','redis','defaults','localhost','socket.io-emitter','GET','headers','Getting\x20admin\x20information','users','length','adminEmail','info','Admin\x20found:','adminId','Requested\x20Resource\x20not\x20Found','error','toUpperCase','message','/api/selector/owners','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','userEmail','email','userId','User\x20found:','Admin\x20selected','catch','/api/lookup?q=','find','contacts','mobile_number','contactNumber','then','endUserId','work_number','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','format','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','Subjects','Descriptions','Contact','YYYY-MM-DDTHH:mm:ss','add','ticketId','task','Task\x20created:','/contacts/','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl'];(function(_0x317a46,_0xae8c22){var _0x56f054=function(_0x3e75be){while(--_0x3e75be){_0x317a46['push'](_0x317a46['shift']());}};_0x56f054(++_0xae8c22);}(_0x6754,0x159));var _0x4675=function(_0xeb8a5c,_0x5c849a){_0xeb8a5c=_0xeb8a5c-0x0;var _0x12adaf=_0x6754[_0xeb8a5c];return _0x12adaf;};'use strict';var _=require(_0x4675('0x0'));var rp=require(_0x4675('0x1'));var md5=require('md5');var util=require(_0x4675('0x2'));var moment=require('moment');var Promise=require(_0x4675('0x3'));var Redis=require(_0x4675('0x4'));var intUtil=require('./util');var config=require(_0x4675('0x5'));var logger=require('../../../../config/logger')(_0x4675('0x6'));config[_0x4675('0x7')]=_[_0x4675('0x8')](config[_0x4675('0x7')],{'host':_0x4675('0x9'),'port':0x18eb});var io=require(_0x4675('0xa'))(new Redis(config[_0x4675('0x7')]));function getAdminId(_0x59a452,_0x6fa0d7,_0x187911,_0x3e906f){return new Promise(function(_0x29b68f,_0x57e15a){var _0x1a718b=![];var _0x1cb97b={'method':_0x4675('0xb'),'uri':_0x3e906f+'/api/selector/owners','json':!![]};_0x1cb97b[_0x4675('0xc')]=_0x187911;logger['info'](_0x4675('0xd'));return rp(_0x1cb97b)['then'](function(_0x56d3e4){if(_0x56d3e4){var _0x5b5b2b=_0x56d3e4[_0x4675('0xe')];var _0x177222=null;for(_0x177222=0x0;_0x177222<_0x5b5b2b[_0x4675('0xf')];_0x177222++){if(_0x5b5b2b[_0x177222]['email']===_0x59a452[_0x4675('0x10')]){_0x59a452['adminId']=_0x5b5b2b[_0x177222]['id'];_0x1a718b=!![];}}if(_0x1a718b){logger[_0x4675('0x11')](_0x4675('0x12'),_0x59a452[_0x4675('0x13')]);_0x29b68f(_0x59a452);}else{_0x57e15a({'statusCode':0x194,'message':_0x4675('0x14')});}}else{_0x57e15a({'statusCode':0x194,'message':_0x4675('0x14')});}})['catch'](function(_0x2e3ebf){logger[_0x4675('0x15')]('['+[_0x6fa0d7[_0x4675('0x16')]()]+']',_0x2e3ebf[_0x4675('0x17')]);_0x57e15a(_0x2e3ebf);});});}function getUser(_0x41e902,_0x35721c,_0x2a2920){return function(_0x694f5f){return new Promise(function(_0x2a1290,_0x5a8299){var _0x4096cb={'method':_0x4675('0xb'),'uri':_0x2a2920+_0x4675('0x18'),'json':!![]};_0x4096cb[_0x4675('0xc')]=_0x35721c;logger['info'](_0x4675('0x19'));return rp(_0x4096cb)['then'](function(_0xafa6c6){if(_0xafa6c6){var _0x11cb33=_0xafa6c6[_0x4675('0xe')];var _0x8d29b0=![];var _0x5d97e7=null;if(_0x694f5f[_0x4675('0x1a')]!==null){logger[_0x4675('0x11')](_0x4675('0x1b'),_0x694f5f[_0x4675('0x1a')]);_0x694f5f[_0x4675('0x1c')]=_0x694f5f['agentEmail'];for(_0x5d97e7=0x0;_0x5d97e7<_0x11cb33['length'];_0x5d97e7++){if(_0x11cb33[_0x5d97e7][_0x4675('0x1d')]===_0x694f5f['agentEmail']){_0x8d29b0=!![];_0x694f5f[_0x4675('0x1e')]=_0x11cb33[_0x5d97e7]['id'];logger[_0x4675('0x11')](_0x4675('0x1f'),_0x694f5f[_0x4675('0x1e')]);}}}if(!_0x8d29b0){logger[_0x4675('0x11')](_0x4675('0x20'));_0x694f5f[_0x4675('0x1c')]=_0x694f5f[_0x4675('0x10')];_0x694f5f[_0x4675('0x1e')]=_0x694f5f['adminId'];_0x8d29b0=!![];}if(_0x8d29b0){_0x2a1290(_0x694f5f);}else{_0x5a8299({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x5a8299({'statusCode':0x194,'message':_0x4675('0x14')});}})[_0x4675('0x21')](function(_0x41c446){logger[_0x4675('0x15')]('['+[_0x41e902['toUpperCase']()]+']',_0x41c446[_0x4675('0x17')]);_0x5a8299(_0x41c446);});});};}function searchContact(_0x13a0f8,_0x25bd4f,_0x11d8ea,_0x3cd7c4){return new Promise(function(_0xc421ab,_0x2af2a3){var _0x300e37={'method':'GET','headers':_0x25bd4f,'uri':_0x13a0f8+_0x4675('0x22')+_0x3cd7c4+'&f='+_0x11d8ea+'&entities=contact','json':!![]};rp(_0x300e37)['then'](function(_0x6b6109){var _0x165532=_[_0x4675('0x23')](_0x6b6109[_0x4675('0x24')][_0x4675('0x24')],[_0x11d8ea,_0x3cd7c4]);_0xc421ab(_0x165532);})['catch'](function(_0x40c25c){_0x2af2a3(_0x40c25c);});});}function getEndUser(_0x2dcfed,_0x26de4c,_0x4fc24a){return function(_0x20270b){return new Promise(function(_0x14705f,_0x140427){logger['info'](util['format']('Searching\x20contact\x20with\x20phone\x20%s',_0x20270b['contactNumber']));searchContact(_0x4fc24a,_0x26de4c,_0x4675('0x25'),_0x20270b[_0x4675('0x26')])[_0x4675('0x27')](function(_0x11721c){if(_0x11721c){_0x20270b[_0x4675('0x28')]=_0x11721c['id'];logger[_0x4675('0x11')]('Contact\x20found\x20mobile_number:',_0x20270b['endUserId']);return _0x14705f(_0x20270b);}searchContact(_0x4fc24a,_0x26de4c,_0x4675('0x29'),_0x20270b[_0x4675('0x26')])[_0x4675('0x27')](function(_0x529d63){if(_0x529d63){_0x20270b[_0x4675('0x28')]=_0x529d63['id'];logger['info'](_0x4675('0x2a'),_0x20270b[_0x4675('0x28')]);return _0x14705f(_0x20270b);}createEndUser(_0x20270b,_0x2dcfed,_0x26de4c,_0x4fc24a)[_0x4675('0x27')](function(_0x39b7bc){logger[_0x4675('0x11')](_0x4675('0x2b'),_0x39b7bc[_0x4675('0x28')]);return _0x14705f(_0x39b7bc);});});})['catch'](function(_0x356fc6){_0x140427(_0x356fc6);});});};}function createEndUser(_0x2fc213,_0x5af0d5,_0x59611b,_0x2ed18e){return new Promise(function(_0x285e1b,_0x3d2b46){var _0x125271=moment();var _0x1743ce={'method':_0x4675('0x2c'),'uri':_0x2ed18e+_0x4675('0x2d'),'body':{'contact':{'last_name':_0x2fc213[_0x4675('0x26')],'work_number':_0x2fc213[_0x4675('0x26')],'mobile_number':_0x2fc213['contactNumber'],'owner_id':_0x2fc213[_0x4675('0x1e')],'created_at':_0x125271[_0x4675('0x2e')]('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0x1743ce[_0x4675('0xc')]=_0x59611b;logger['info'](_0x4675('0x2f'));return rp(_0x1743ce)[_0x4675('0x27')](function(_0x3e4500){_0x2fc213[_0x4675('0x28')]=_0x3e4500[_0x4675('0x30')]['id'];_0x285e1b(_0x2fc213);})[_0x4675('0x21')](function(_0x5ac625){logger['error']('['+[_0x5af0d5[_0x4675('0x16')]()]+']',_0x5ac625['message']);_0x3d2b46(_0x5ac625[_0x4675('0x17')]);});});}function getTicket(_0x444ee3,_0xc52c18,_0x262ef3,_0x51ceb7,_0x5345de){return function(_0x1cad6d){logger['info'](_0x4675('0x31'));return new Promise(function(_0x4a53a9,_0xe020ab){var _0x380eaa=moment();var _0x5b9d21={'method':_0x4675('0x2c'),'uri':_0x262ef3+'/api/tasks','body':{'title':intUtil['getString'](_0x51ceb7[_0x4675('0x32')],_0x5345de,'\x20'),'description':intUtil['getString'](_0x51ceb7[_0x4675('0x33')],_0x5345de,'\x0a'),'owner_id':_0x1cad6d[_0x4675('0x1e')],'creater_id':_0x1cad6d['adminId'],'targetable_id':_0x1cad6d[_0x4675('0x28')],'targetable_type':_0x4675('0x34'),'created_at':_0x380eaa[_0x4675('0x2e')](_0x4675('0x35')),'due_date':_0x380eaa[_0x4675('0x36')](0x1e,'m')[_0x4675('0x2e')]('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x5b9d21[_0x4675('0xc')]=_0xc52c18;return rp(_0x5b9d21)[_0x4675('0x27')](function(_0x104f22){_0x1cad6d[_0x4675('0x37')]=_0x104f22[_0x4675('0x38')]['id'];logger[_0x4675('0x11')](_0x4675('0x39'),_0x1cad6d[_0x4675('0x37')]);_0x4a53a9(_0x1cad6d);})[_0x4675('0x21')](function(_0x5d04a7){logger['error']('['+[_0x444ee3['toUpperCase']()]+']',_0x5d04a7['message']);_0xe020ab(_0x5d04a7[_0x4675('0x17')]);});});};}function emit(_0x50f3ae,_0x3bfc92,_0x2ec437){var _0x402b55={'uri':_0x50f3ae+_0x4675('0x3a')+_0x2ec437};io['to'](util[_0x4675('0x2e')]('user:%s',_0x3bfc92))['emit'](_0x4675('0x3b'),_0x402b55);}exports['cs']=function(_0x4d4a81,_0x5d3e31,_0x3ee724,_0x16cf39,_0x49464b,_0x379dd2,_0x231015,_0x1ebda1){var _0x101878={};var _0x4bc5df={'Authorization':_0x4675('0x3c')+_0x379dd2[_0x4675('0x3d')]};_0x379dd2[_0x4675('0x3e')]=intUtil[_0x4675('0x3f')](_0x379dd2['remoteUri']);_0x379dd2[_0x4675('0x40')]=intUtil['stripTrailingSlash'](_0x379dd2['serverUrl']);var _0x124f53=_0x379dd2[_0x4675('0x3e')];_0x101878[_0x4675('0x10')]=_0x379dd2[_0x4675('0x41')];_0x101878[_0x4675('0x26')]=_0x1ebda1[_0x4675('0x42')]()===_0x4675('0x43')?_0x5d3e31['destcalleridnum']:_0x5d3e31[_0x4675('0x44')];_0x101878['callDirection']=_0x1ebda1==='queue'||_0x1ebda1===_0x4675('0x45')?_0x4675('0x46'):_0x4675('0x43');if(_0x16cf39){_0x101878[_0x4675('0x1a')]=_0x16cf39[_0x4675('0x1d')];}var _0x5e3f03=util[_0x4675('0x2e')](_0x4675('0x47'),_0x379dd2[_0x4675('0x40')],_0x5d3e31[_0x4675('0x48')],md5(_0x5d3e31['uniqueid']));if(_0x49464b&&_0x49464b[_0x4675('0x49')]){logger[_0x4675('0x11')](_0x4675('0x4a'),_0x4675('0x4b'));_0x5d3e31['recordingURL']=_0x5e3f03;}else if(_0x231015&&_0x231015['recordingFormat']&&_0x231015['recordingFormat']!=='none'){logger['info'](_0x4675('0x4c'),_0x4675('0x4b'));_0x5d3e31[_0x4675('0x4d')]=_0x5e3f03;}else{_0x5d3e31[_0x4675('0x4d')]='';}return getAdminId(_0x101878,_0x1ebda1,_0x4bc5df,_0x124f53)[_0x4675('0x27')](getUser(_0x1ebda1,_0x4bc5df,_0x124f53))['then'](getEndUser(_0x1ebda1,_0x4bc5df,_0x124f53))[_0x4675('0x27')](getTicket(_0x1ebda1,_0x4bc5df,_0x124f53,_0x3ee724,_0x5d3e31))[_0x4675('0x27')](function(_0x4d581f){logger[_0x4675('0x11')](util[_0x4675('0x2e')]('The\x20ticket\x20ID\x20is:\x20%s',_0x4d581f[_0x4675('0x37')]));if(_0x1ebda1!==_0x4675('0x45')){logger['info']('['+[_0x1ebda1[_0x4675('0x16')]()]+']',_0x4675('0x4e'));emit(_0x124f53,_0x16cf39[_0x4675('0x4f')],_0x4d581f[_0x4675('0x28')]);}})[_0x4675('0x21')](function(_0x5a2364){logger['error']('['+[_0x1ebda1[_0x4675('0x16')]()]+_0x4675('0x50'),util[_0x4675('0x51')](_0x5a2364,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x9aef=['Getting\x20admin\x20information','then','length','email','adminEmail','Admin\x20found:','adminId','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','Getting\x20user\x20list','Getting\x20user\x20with\x20email','agentEmail','userEmail','userId','User\x20found:','/api/lookup?q=','&f=','&entities=contact','contacts','format','mobile_number','contactNumber','endUserId','work_number','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','contact','Creating\x20new\x20task','/api/tasks','getString','Subjects','Descriptions','ticketId','Task\x20created:','/contacts/','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey','stripTrailingSlash','username','toLowerCase','outbound','destcalleridnum','calleridnum','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','unmanaged','name',']\x20Error\x20running\x20Freshsales\x20integration','lodash','request-promise','moment','bluebird','ioredis','../../../../config/environment','freshsales','redis','localhost','socket.io-emitter','GET','/api/selector/owners','headers','info'];(function(_0x2adbeb,_0x5581be){var _0x5e18a6=function(_0x84e42b){while(--_0x84e42b){_0x2adbeb['push'](_0x2adbeb['shift']());}};_0x5e18a6(++_0x5581be);}(_0x9aef,0x132));var _0xf9ae=function(_0x3327dd,_0x4dbdbc){_0x3327dd=_0x3327dd-0x0;var _0x58f2a8=_0x9aef[_0x3327dd];return _0x58f2a8;};'use strict';var _=require(_0xf9ae('0x0'));var rp=require(_0xf9ae('0x1'));var md5=require('md5');var util=require('util');var moment=require(_0xf9ae('0x2'));var Promise=require(_0xf9ae('0x3'));var Redis=require(_0xf9ae('0x4'));var intUtil=require('./util');var config=require(_0xf9ae('0x5'));var logger=require('../../../../config/logger')(_0xf9ae('0x6'));config[_0xf9ae('0x7')]=_['defaults'](config[_0xf9ae('0x7')],{'host':_0xf9ae('0x8'),'port':0x18eb});var io=require(_0xf9ae('0x9'))(new Redis(config[_0xf9ae('0x7')]));function getAdminId(_0x32df1a,_0x37fd33,_0x1f0800,_0x48af20){return new Promise(function(_0x383ad7,_0x4de228){var _0x52fb02=![];var _0x46e3cb={'method':_0xf9ae('0xa'),'uri':_0x48af20+_0xf9ae('0xb'),'json':!![]};_0x46e3cb[_0xf9ae('0xc')]=_0x1f0800;logger[_0xf9ae('0xd')](_0xf9ae('0xe'));return rp(_0x46e3cb)[_0xf9ae('0xf')](function(_0x754415){if(_0x754415){var _0x2feaee=_0x754415['users'];var _0x59d9b0=null;for(_0x59d9b0=0x0;_0x59d9b0<_0x2feaee[_0xf9ae('0x10')];_0x59d9b0++){if(_0x2feaee[_0x59d9b0][_0xf9ae('0x11')]===_0x32df1a[_0xf9ae('0x12')]){_0x32df1a['adminId']=_0x2feaee[_0x59d9b0]['id'];_0x52fb02=!![];}}if(_0x52fb02){logger[_0xf9ae('0xd')](_0xf9ae('0x13'),_0x32df1a[_0xf9ae('0x14')]);_0x383ad7(_0x32df1a);}else{_0x4de228({'statusCode':0x194,'message':_0xf9ae('0x15')});}}else{_0x4de228({'statusCode':0x194,'message':_0xf9ae('0x15')});}})[_0xf9ae('0x16')](function(_0x3a7409){logger[_0xf9ae('0x17')]('['+[_0x37fd33[_0xf9ae('0x18')]()]+']',_0x3a7409[_0xf9ae('0x19')]);_0x4de228(_0x3a7409);});});}function getUser(_0x293a71,_0x1e8911,_0xb4b675){return function(_0x226a25){return new Promise(function(_0x524262,_0x30fc0d){var _0x2f6caa={'method':'GET','uri':_0xb4b675+_0xf9ae('0xb'),'json':!![]};_0x2f6caa[_0xf9ae('0xc')]=_0x1e8911;logger['info'](_0xf9ae('0x1a'));return rp(_0x2f6caa)[_0xf9ae('0xf')](function(_0x5060e6){if(_0x5060e6){var _0x4c9dbe=_0x5060e6['users'];var _0x442af1=![];var _0x52be10=null;if(_0x226a25['agentEmail']!==null){logger[_0xf9ae('0xd')](_0xf9ae('0x1b'),_0x226a25[_0xf9ae('0x1c')]);_0x226a25[_0xf9ae('0x1d')]=_0x226a25['agentEmail'];for(_0x52be10=0x0;_0x52be10<_0x4c9dbe[_0xf9ae('0x10')];_0x52be10++){if(_0x4c9dbe[_0x52be10]['email']===_0x226a25[_0xf9ae('0x1c')]){_0x442af1=!![];_0x226a25[_0xf9ae('0x1e')]=_0x4c9dbe[_0x52be10]['id'];logger[_0xf9ae('0xd')](_0xf9ae('0x1f'),_0x226a25[_0xf9ae('0x1e')]);}}}if(!_0x442af1){logger[_0xf9ae('0xd')]('Admin\x20selected');_0x226a25[_0xf9ae('0x1d')]=_0x226a25[_0xf9ae('0x12')];_0x226a25[_0xf9ae('0x1e')]=_0x226a25[_0xf9ae('0x14')];_0x442af1=!![];}if(_0x442af1){_0x524262(_0x226a25);}else{_0x30fc0d({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x30fc0d({'statusCode':0x194,'message':_0xf9ae('0x15')});}})[_0xf9ae('0x16')](function(_0x3e53f7){logger[_0xf9ae('0x17')]('['+[_0x293a71['toUpperCase']()]+']',_0x3e53f7[_0xf9ae('0x19')]);_0x30fc0d(_0x3e53f7);});});};}function searchContact(_0x20cb0c,_0x525512,_0x180ab7,_0x4b9d72){return new Promise(function(_0x2619ad,_0x4d60c7){var _0x2c8ff7={'method':_0xf9ae('0xa'),'headers':_0x525512,'uri':_0x20cb0c+_0xf9ae('0x20')+_0x4b9d72+_0xf9ae('0x21')+_0x180ab7+_0xf9ae('0x22'),'json':!![]};rp(_0x2c8ff7)[_0xf9ae('0xf')](function(_0x28f354){var _0x12365e=_['find'](_0x28f354[_0xf9ae('0x23')][_0xf9ae('0x23')],[_0x180ab7,_0x4b9d72]);_0x2619ad(_0x12365e);})[_0xf9ae('0x16')](function(_0x39ab09){_0x4d60c7(_0x39ab09);});});}function getEndUser(_0x4bfb6b,_0xfc857e,_0x163c1f){return function(_0xf695cf){return new Promise(function(_0x57748b,_0x53a681){logger[_0xf9ae('0xd')](util[_0xf9ae('0x24')]('Searching\x20contact\x20with\x20phone\x20%s',_0xf695cf['contactNumber']));searchContact(_0x163c1f,_0xfc857e,_0xf9ae('0x25'),_0xf695cf[_0xf9ae('0x26')])[_0xf9ae('0xf')](function(_0x1e6c31){if(_0x1e6c31){_0xf695cf['endUserId']=_0x1e6c31['id'];logger[_0xf9ae('0xd')]('Contact\x20found\x20mobile_number:',_0xf695cf[_0xf9ae('0x27')]);return _0x57748b(_0xf695cf);}searchContact(_0x163c1f,_0xfc857e,_0xf9ae('0x28'),_0xf695cf[_0xf9ae('0x26')])[_0xf9ae('0xf')](function(_0x7a4d29){if(_0x7a4d29){_0xf695cf[_0xf9ae('0x27')]=_0x7a4d29['id'];logger[_0xf9ae('0xd')](_0xf9ae('0x29'),_0xf695cf[_0xf9ae('0x27')]);return _0x57748b(_0xf695cf);}createEndUser(_0xf695cf,_0x4bfb6b,_0xfc857e,_0x163c1f)[_0xf9ae('0xf')](function(_0x218018){logger[_0xf9ae('0xd')](_0xf9ae('0x2a'),_0x218018[_0xf9ae('0x27')]);return _0x57748b(_0x218018);});});})[_0xf9ae('0x16')](function(_0x2d0e81){_0x53a681(_0x2d0e81);});});};}function createEndUser(_0x3e756f,_0x4efb23,_0x45eeb0,_0x1f3bae){return new Promise(function(_0x4b5670,_0x34743a){var _0x4741b6=moment();var _0x3820f1={'method':_0xf9ae('0x2b'),'uri':_0x1f3bae+_0xf9ae('0x2c'),'body':{'contact':{'last_name':_0x3e756f[_0xf9ae('0x26')],'work_number':_0x3e756f['contactNumber'],'mobile_number':_0x3e756f[_0xf9ae('0x26')],'owner_id':_0x3e756f[_0xf9ae('0x1e')],'created_at':_0x4741b6[_0xf9ae('0x24')](_0xf9ae('0x2d'))}},'json':!![]};_0x3820f1[_0xf9ae('0xc')]=_0x45eeb0;logger[_0xf9ae('0xd')]('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0x3820f1)[_0xf9ae('0xf')](function(_0x1430ff){_0x3e756f[_0xf9ae('0x27')]=_0x1430ff[_0xf9ae('0x2e')]['id'];_0x4b5670(_0x3e756f);})[_0xf9ae('0x16')](function(_0x4d3326){logger[_0xf9ae('0x17')]('['+[_0x4efb23['toUpperCase']()]+']',_0x4d3326[_0xf9ae('0x19')]);_0x34743a(_0x4d3326['message']);});});}function getTicket(_0xd3307c,_0x4bb971,_0x5188ce,_0x2f8a85,_0x376bdf){return function(_0x50cc25){logger[_0xf9ae('0xd')](_0xf9ae('0x2f'));return new Promise(function(_0x16ea00,_0x133d71){var _0x3cf9d4=moment();var _0x1832e7={'method':'POST','uri':_0x5188ce+_0xf9ae('0x30'),'body':{'title':intUtil[_0xf9ae('0x31')](_0x2f8a85[_0xf9ae('0x32')],_0x376bdf,'\x20'),'description':intUtil[_0xf9ae('0x31')](_0x2f8a85[_0xf9ae('0x33')],_0x376bdf,'\x0a'),'owner_id':_0x50cc25[_0xf9ae('0x1e')],'creater_id':_0x50cc25[_0xf9ae('0x14')],'targetable_id':_0x50cc25[_0xf9ae('0x27')],'targetable_type':'Contact','created_at':_0x3cf9d4[_0xf9ae('0x24')](_0xf9ae('0x2d')),'due_date':_0x3cf9d4['add'](0x1e,'m')[_0xf9ae('0x24')]('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x1832e7[_0xf9ae('0xc')]=_0x4bb971;return rp(_0x1832e7)[_0xf9ae('0xf')](function(_0x13349c){_0x50cc25[_0xf9ae('0x34')]=_0x13349c['task']['id'];logger[_0xf9ae('0xd')](_0xf9ae('0x35'),_0x50cc25[_0xf9ae('0x34')]);_0x16ea00(_0x50cc25);})['catch'](function(_0x324ef7){logger[_0xf9ae('0x17')]('['+[_0xd3307c[_0xf9ae('0x18')]()]+']',_0x324ef7['message']);_0x133d71(_0x324ef7['message']);});});};}function emit(_0x464ed7,_0x4665e7,_0x40be59){var _0x3069f6={'uri':_0x464ed7+_0xf9ae('0x36')+_0x40be59};io['to'](util['format'](_0xf9ae('0x37'),_0x4665e7))[_0xf9ae('0x38')](_0xf9ae('0x39'),_0x3069f6);}exports['cs']=function(_0x18d16b,_0x37a195,_0x447657,_0xab577b,_0x338e07,_0x4be1d3,_0x35d617,_0x6b0d2b){var _0x322eef={};var _0x3f00a5={'Authorization':_0xf9ae('0x3a')+_0x4be1d3[_0xf9ae('0x3b')]};_0x4be1d3['remoteUri']=intUtil[_0xf9ae('0x3c')](_0x4be1d3['remoteUri']);_0x4be1d3['serverUrl']=intUtil[_0xf9ae('0x3c')](_0x4be1d3['serverUrl']);var _0x79357a=_0x4be1d3['remoteUri'];_0x322eef[_0xf9ae('0x12')]=_0x4be1d3[_0xf9ae('0x3d')];_0x322eef[_0xf9ae('0x26')]=_0x6b0d2b[_0xf9ae('0x3e')]()===_0xf9ae('0x3f')?_0x37a195[_0xf9ae('0x40')]:_0x37a195[_0xf9ae('0x41')];_0x322eef['callDirection']=_0x6b0d2b===_0xf9ae('0x42')||_0x6b0d2b==='unmanaged'?_0xf9ae('0x42'):_0xf9ae('0x3f');if(_0xab577b){_0x322eef[_0xf9ae('0x1c')]=_0xab577b[_0xf9ae('0x11')];}var _0x29804c=util['format'](_0xf9ae('0x43'),_0x4be1d3[_0xf9ae('0x44')],_0x37a195['uniqueid'],md5(_0x37a195[_0xf9ae('0x45')]));if(_0x338e07&&_0x338e07[_0xf9ae('0x46')]){logger[_0xf9ae('0xd')](_0xf9ae('0x47'),_0xf9ae('0x48'));_0x37a195[_0xf9ae('0x49')]=_0x29804c;}else if(_0x35d617&&_0x35d617['recordingFormat']&&_0x35d617[_0xf9ae('0x4a')]!==_0xf9ae('0x4b')){logger[_0xf9ae('0xd')](_0xf9ae('0x4c'),_0xf9ae('0x48'));_0x37a195[_0xf9ae('0x49')]=_0x29804c;}else{_0x37a195[_0xf9ae('0x49')]='';}return getAdminId(_0x322eef,_0x6b0d2b,_0x3f00a5,_0x79357a)[_0xf9ae('0xf')](getUser(_0x6b0d2b,_0x3f00a5,_0x79357a))['then'](getEndUser(_0x6b0d2b,_0x3f00a5,_0x79357a))[_0xf9ae('0xf')](getTicket(_0x6b0d2b,_0x3f00a5,_0x79357a,_0x447657,_0x37a195))[_0xf9ae('0xf')](function(_0x1a1fc8){logger[_0xf9ae('0xd')](util[_0xf9ae('0x24')]('The\x20ticket\x20ID\x20is:\x20%s',_0x1a1fc8[_0xf9ae('0x34')]));if(_0x6b0d2b!==_0xf9ae('0x4d')){logger[_0xf9ae('0xd')]('['+[_0x6b0d2b[_0xf9ae('0x18')]()]+']','Displaying\x20task\x20in\x20a\x20new\x20tab...');emit(_0x79357a,_0xab577b[_0xf9ae('0x4e')],_0x1a1fc8[_0xf9ae('0x27')]);}})[_0xf9ae('0x16')](function(_0x2c6dc8){logger[_0xf9ae('0x17')]('['+[_0x6b0d2b[_0xf9ae('0x18')]()]+_0xf9ae('0x4f'),util['inspect'](_0x2c6dc8,{'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 e103140..5982c09 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 _0x0cc1=['format','%s\x20configuration\x20#%s\x20not\x20found','error','%s\x20account\x20#%s\x20not\x20found','lodash','util','./salesforce','./sugarcrm','./freshdesk','./vtiger','./servicenow','./dynamics365','./freshsales','zendesk','freshdesk','desk','vtiger','dynamics365','servicenow','exec','includes','data1','toLowerCase','data2','find','Configurations','data3','queue','routeId','outbound','EVENT\x20UNKNOWN','unmanaged','sugarcrm','zoho','freshsales','log','unknown\x20integration','../../../../config/logger','[EXEC]'];(function(_0x3677a1,_0x368045){var _0x531fd8=function(_0x3abc8e){while(--_0x3abc8e){_0x3677a1['push'](_0x3677a1['shift']());}};_0x531fd8(++_0x368045);}(_0x0cc1,0xc7));var _0x10cc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0cc1[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x10cc('0x0'));var util=require(_0x10cc('0x1'));var zendesk=require('./zendesk');var salesforce=require(_0x10cc('0x2'));var sugarcrm=require(_0x10cc('0x3'));var freshdesk=require(_0x10cc('0x4'));var zoho=require('./zoho');var desk=require('./desk');var vtiger=require(_0x10cc('0x5'));var servicenow=require(_0x10cc('0x6'));var dynamics365=require(_0x10cc('0x7'));var freshsales=require(_0x10cc('0x8'));var integrations=[_0x10cc('0x9'),'salesforce','sugarcrm',_0x10cc('0xa'),'zoho',_0x10cc('0xb'),_0x10cc('0xc'),_0x10cc('0xd'),'freshsales',_0x10cc('0xe')];exports[_0x10cc('0xf')]=function(_0x5b8960,_0x3e951b,_0x3a4ed7,_0x1a4840,_0x6e217c,_0x7f1e8c){if(_0x3a4ed7){if(_[_0x10cc('0x10')](integrations,_0x5b8960[_0x10cc('0x11')][_0x10cc('0x12')]())){try{var _0x4957d3=null;var _0x16b89f='';var _0x2e0a6c=_0x3a4ed7[_0x5b8960['data1'][_0x10cc('0x12')]()];if(_0x2e0a6c){var _0x56d8d9=_0x2e0a6c[_0x5b8960[_0x10cc('0x13')]];if(_0x56d8d9){var _0x4966b3=_[_0x10cc('0x14')](_0x56d8d9[_0x10cc('0x15')],{'id':parseInt(_0x5b8960[_0x10cc('0x16')],0xa)});if(_0x4966b3){if(_0x1a4840){if(_0x6e217c&&_0x3e951b['queue']){_0x16b89f=_0x10cc('0x17');}else if(_0x3e951b[_0x10cc('0x18')]){_0x16b89f=_0x10cc('0x19');}else{console['log'](_0x10cc('0x1a'),_0x3e951b);}}else{_0x16b89f=_0x10cc('0x1b');}switch(_0x5b8960[_0x10cc('0x11')][_0x10cc('0x12')]()){case'zendesk':zendesk[_0x16b89f](_0x5b8960,_0x3e951b,_0x4966b3,_0x1a4840,_0x6e217c,_0x56d8d9,_0x7f1e8c);break;case'salesforce':salesforce[_0x16b89f](_0x5b8960,_0x3e951b,_0x4966b3,_0x1a4840,_0x6e217c,_0x56d8d9,_0x7f1e8c);break;case _0x10cc('0x1c'):sugarcrm[_0x16b89f](_0x5b8960,_0x3e951b,_0x4966b3,_0x1a4840,_0x6e217c,_0x56d8d9,_0x7f1e8c);break;case'freshdesk':freshdesk[_0x16b89f](_0x5b8960,_0x3e951b,_0x4966b3,_0x1a4840,_0x6e217c,_0x56d8d9,_0x7f1e8c);break;case _0x10cc('0x1d'):zoho[_0x16b89f](_0x5b8960,_0x3e951b,_0x4966b3,_0x1a4840,_0x6e217c,_0x56d8d9,_0x7f1e8c);break;case _0x10cc('0xb'):desk[_0x16b89f](_0x5b8960,_0x3e951b,_0x4966b3,_0x1a4840,_0x6e217c,_0x56d8d9,_0x7f1e8c);break;case _0x10cc('0xc'):vtiger[_0x16b89f](_0x5b8960,_0x3e951b,_0x4966b3,_0x1a4840,_0x6e217c,_0x56d8d9,_0x7f1e8c);break;case _0x10cc('0x1e'):freshsales['cs'](_0x5b8960,_0x3e951b,_0x4966b3,_0x1a4840,_0x6e217c,_0x56d8d9,_0x7f1e8c,_0x16b89f);break;case _0x10cc('0xe'):servicenow['cs'](_0x5b8960,_0x3e951b,_0x4966b3,_0x1a4840,_0x6e217c,_0x56d8d9,_0x7f1e8c,_0x16b89f);break;case _0x10cc('0xd'):dynamics365['cs'](_0x5b8960,_0x3e951b,_0x4966b3,_0x1a4840,_0x6e217c,_0x56d8d9,_0x7f1e8c,_0x16b89f);break;default:console[_0x10cc('0x1f')](_0x10cc('0x20'));}}else{_0x4957d3=require(_0x10cc('0x21'))(_0x5b8960[_0x10cc('0x11')][_0x10cc('0x12')]());_0x4957d3['error'](_0x10cc('0x22'),util[_0x10cc('0x23')](_0x10cc('0x24'),_0x5b8960['data1'][_0x10cc('0x12')](),_0x5b8960['data3']));}}else{_0x4957d3=require(_0x10cc('0x21'))(_0x5b8960[_0x10cc('0x11')][_0x10cc('0x12')]());_0x4957d3[_0x10cc('0x25')]('[EXEC]',util['format'](_0x10cc('0x26'),_0x5b8960[_0x10cc('0x11')]['toLowerCase'](),_0x5b8960[_0x10cc('0x13')]));}}else{}}catch(_0x10db48){console[_0x10cc('0x25')](_0x10db48);}}}}; \ No newline at end of file +var _0x85e9=['exec','includes','toLowerCase','data1','data2','find','Configurations','data3','queue','outbound','log','EVENT\x20UNKNOWN','vtiger','freshsales','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','util','./zendesk','./sugarcrm','./freshdesk','./desk','./vtiger','./servicenow','./dynamics365','./freshsales','zendesk','salesforce','sugarcrm','freshdesk','zoho','desk','dynamics365','servicenow'];(function(_0x20f69e,_0x17c9b2){var _0x39c630=function(_0x420bbe){while(--_0x420bbe){_0x20f69e['push'](_0x20f69e['shift']());}};_0x39c630(++_0x17c9b2);}(_0x85e9,0xeb));var _0x985e=function(_0xc3b3ea,_0x10026c){_0xc3b3ea=_0xc3b3ea-0x0;var _0x1d8d48=_0x85e9[_0xc3b3ea];return _0x1d8d48;};'use strict';var _=require('lodash');var util=require(_0x985e('0x0'));var zendesk=require(_0x985e('0x1'));var salesforce=require('./salesforce');var sugarcrm=require(_0x985e('0x2'));var freshdesk=require(_0x985e('0x3'));var zoho=require('./zoho');var desk=require(_0x985e('0x4'));var vtiger=require(_0x985e('0x5'));var servicenow=require(_0x985e('0x6'));var dynamics365=require(_0x985e('0x7'));var freshsales=require(_0x985e('0x8'));var integrations=[_0x985e('0x9'),_0x985e('0xa'),_0x985e('0xb'),_0x985e('0xc'),_0x985e('0xd'),_0x985e('0xe'),'vtiger',_0x985e('0xf'),'freshsales',_0x985e('0x10')];exports[_0x985e('0x11')]=function(_0x390d3b,_0x3edaed,_0x6f6477,_0x2996d2,_0x150866,_0x383ba9){if(_0x6f6477){if(_[_0x985e('0x12')](integrations,_0x390d3b['data1'][_0x985e('0x13')]())){try{var _0x369db8=null;var _0x15bd00='';var _0x210c3e=_0x6f6477[_0x390d3b[_0x985e('0x14')][_0x985e('0x13')]()];if(_0x210c3e){var _0x2a5129=_0x210c3e[_0x390d3b[_0x985e('0x15')]];if(_0x2a5129){var _0x389ece=_[_0x985e('0x16')](_0x2a5129[_0x985e('0x17')],{'id':parseInt(_0x390d3b[_0x985e('0x18')],0xa)});if(_0x389ece){if(_0x2996d2){if(_0x150866&&_0x3edaed[_0x985e('0x19')]){_0x15bd00=_0x985e('0x19');}else if(_0x3edaed['routeId']){_0x15bd00=_0x985e('0x1a');}else{console[_0x985e('0x1b')](_0x985e('0x1c'),_0x3edaed);}}else{_0x15bd00='unmanaged';}switch(_0x390d3b[_0x985e('0x14')]['toLowerCase']()){case _0x985e('0x9'):zendesk[_0x15bd00](_0x390d3b,_0x3edaed,_0x389ece,_0x2996d2,_0x150866,_0x2a5129,_0x383ba9);break;case _0x985e('0xa'):salesforce[_0x15bd00](_0x390d3b,_0x3edaed,_0x389ece,_0x2996d2,_0x150866,_0x2a5129,_0x383ba9);break;case'sugarcrm':sugarcrm[_0x15bd00](_0x390d3b,_0x3edaed,_0x389ece,_0x2996d2,_0x150866,_0x2a5129,_0x383ba9);break;case _0x985e('0xc'):freshdesk[_0x15bd00](_0x390d3b,_0x3edaed,_0x389ece,_0x2996d2,_0x150866,_0x2a5129,_0x383ba9);break;case _0x985e('0xd'):zoho[_0x15bd00](_0x390d3b,_0x3edaed,_0x389ece,_0x2996d2,_0x150866,_0x2a5129,_0x383ba9);break;case _0x985e('0xe'):desk[_0x15bd00](_0x390d3b,_0x3edaed,_0x389ece,_0x2996d2,_0x150866,_0x2a5129,_0x383ba9);break;case _0x985e('0x1d'):vtiger[_0x15bd00](_0x390d3b,_0x3edaed,_0x389ece,_0x2996d2,_0x150866,_0x2a5129,_0x383ba9);break;case _0x985e('0x1e'):freshsales['cs'](_0x390d3b,_0x3edaed,_0x389ece,_0x2996d2,_0x150866,_0x2a5129,_0x383ba9,_0x15bd00);break;case _0x985e('0x10'):servicenow['cs'](_0x390d3b,_0x3edaed,_0x389ece,_0x2996d2,_0x150866,_0x2a5129,_0x383ba9,_0x15bd00);break;case _0x985e('0xf'):dynamics365['cs'](_0x390d3b,_0x3edaed,_0x389ece,_0x2996d2,_0x150866,_0x2a5129,_0x383ba9,_0x15bd00);break;default:console['log']('unknown\x20integration');}}else{_0x369db8=require(_0x985e('0x1f'))(_0x390d3b['data1']['toLowerCase']());_0x369db8[_0x985e('0x20')](_0x985e('0x21'),util[_0x985e('0x22')](_0x985e('0x23'),_0x390d3b[_0x985e('0x14')][_0x985e('0x13')](),_0x390d3b[_0x985e('0x18')]));}}else{_0x369db8=require(_0x985e('0x1f'))(_0x390d3b['data1'][_0x985e('0x13')]());_0x369db8[_0x985e('0x20')](_0x985e('0x21'),util[_0x985e('0x22')]('%s\x20account\x20#%s\x20not\x20found',_0x390d3b[_0x985e('0x14')][_0x985e('0x13')](),_0x390d3b[_0x985e('0x15')]));}}else{}}catch(_0x44a110){console[_0x985e('0x20')](_0x44a110);}}}}; \ 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 7d3befc..e72d2cb 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 _0x3b65=['getString','Subjects','ticketType','Task','ActivityDate','utc','endUserType','contact','lead','WhoId','WhatId','account','AccountId','leadId','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','validateEmail','find','execute','then','Email','Agent\x20%s\x20found.','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','resolve','display_name','info','user_id','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','additionalSearchContact','merge','Contact','length','cloneDeep','additionalSearchLead','additionalSearchAccount','$or','Account','Lead','first','Phone','attributes','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','LastName','Caller\x20-\x20%s','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','Company','No\x20Company','','forEach','includes','picklist','idField','content','toString','variable','variableName','customVariable','Variable','name','concat','securityToken','Connection','remoteUri','https://login.salesforce.com','clientSecret','login','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','recordingURL','format','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridnum','user:%s','trigger:salesforce:display','newTab','%s/%s/e','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Fields','outbound','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','instanceUrl','Salesforce\x20account\x20type\x20not\x20recognized','lastevent','isNil',']\x20Ticket\x20%s\x20created.','toUpperCase',']\x20Integration\x20account\x20type\x20%s.','request-promise','moment','bluebird','md5','jsforce','util','ioredis','./util','../../../../config/logger','salesforce','redis','defaults','localhost','socket.io-emitter','emit'];(function(_0x311069,_0x1f9d3e){var _0x49cd1e=function(_0x3fcb16){while(--_0x3fcb16){_0x311069['push'](_0x311069['shift']());}};_0x49cd1e(++_0x1f9d3e);}(_0x3b65,0x168));var _0x53b6=function(_0xf06cd6,_0x25ebf5){_0xf06cd6=_0xf06cd6-0x0;var _0x50c7c7=_0x3b65[_0xf06cd6];return _0x50c7c7;};'use strict';var _=require('lodash');var rp=require(_0x53b6('0x0'));var moment=require(_0x53b6('0x1'));var BPromise=require(_0x53b6('0x2'));var md5=require(_0x53b6('0x3'));var jsforce=require(_0x53b6('0x4'));var util=require(_0x53b6('0x5'));var Redis=require(_0x53b6('0x6'));var intUtil=require(_0x53b6('0x7'));var config=require('../../../../config/environment');var logger=require(_0x53b6('0x8'))(_0x53b6('0x9'));config[_0x53b6('0xa')]=_[_0x53b6('0xb')](config['redis'],{'host':_0x53b6('0xc'),'port':0x18eb});var io=require(_0x53b6('0xd'))(new Redis(config[_0x53b6('0xa')]));function emit(_0x3fe187,_0xda8f07,_0x4b389f){io['to'](_0x3fe187)[_0x53b6('0xe')](_0xda8f07,_0x4b389f);}function getTicket(_0x2c2bac,_0x407d65,_0x2b5364,_0x112fe6,_0x59eb5e,_0x5813ac,_0x181e98,_0x18556e){var _0x12a671=Object['assign']({},{'OwnerId':_0x407d65['id'],'Subject':intUtil[_0x53b6('0xf')](_0x112fe6[_0x53b6('0x10')],_0x59eb5e,'\x20'),'Description':intUtil['getString'](_0x112fe6['Descriptions'],_0x59eb5e,'\x0a')},getCustomFields(_0x5813ac,_0x59eb5e));if(_0x2b5364){if(_0x112fe6[_0x53b6('0x11')]===_0x53b6('0x12')){_0x12a671[_0x53b6('0x13')]=moment[_0x53b6('0x14')]();_0x12a671['IsReminderSet']=![];_0x12a671['IsRecurrence']=![];if(_0x2b5364[_0x53b6('0x15')]===_0x53b6('0x16')||_0x2b5364[_0x53b6('0x15')]===_0x53b6('0x17')){_0x12a671[_0x53b6('0x18')]=_0x2b5364['id'];}else if(_0x2b5364[_0x53b6('0x15')]==='account'){_0x12a671[_0x53b6('0x19')]=_0x2b5364['id'];}}else if(_0x112fe6[_0x53b6('0x11')]==='Case'){if(_0x2b5364['endUserType']===_0x53b6('0x16')){_0x12a671['ContactId']=_0x2b5364['id'];}else if(_0x2b5364[_0x53b6('0x15')]===_0x53b6('0x1a')){_0x12a671[_0x53b6('0x1b')]=_0x2b5364['id'];}else if(_0x2b5364[_0x53b6('0x15')]===_0x53b6('0x17')&&_0x112fe6[_0x53b6('0x1c')]){_0x12a671[_0x112fe6[_0x53b6('0x1c')]]=_0x2b5364['id'];}else{logger['info'](_0x53b6('0x1d'));}}}return _0x181e98[_0x53b6('0x1e')](_0x112fe6[_0x53b6('0x11')])[_0x53b6('0x1f')](_0x12a671);}function getUser(_0x3c7101,_0x4fafc5,_0x31a5f2){if(!_['isNil'](_0x4fafc5)&&intUtil[_0x53b6('0x20')](_0x4fafc5)){var _0x455c13={'Email':_0x4fafc5};var _0x2412bb={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x31a5f2['sobject']('User')[_0x53b6('0x21')](_0x455c13,_0x2412bb)[_0x53b6('0x22')]()[_0x53b6('0x23')](function(_0x759ef4){if(_0x759ef4['length']){var _0x10727f=_['find'](_0x759ef4,function(_0x5a401a){return _0x5a401a[_0x53b6('0x24')]===_0x4fafc5;});if(_0x10727f){logger['info'](_0x53b6('0x25'),_0x4fafc5);return BPromise['resolve']({'id':_0x10727f['Id'],'name':_0x10727f[_0x53b6('0x26')]});}}else{logger['info'](_0x53b6('0x27'),_0x4fafc5);return _0x31a5f2[_0x53b6('0x28')]()[_0x53b6('0x23')](function(_0x41d3c3){return BPromise[_0x53b6('0x29')]({'id':_0x41d3c3['user_id'],'name':_0x41d3c3[_0x53b6('0x2a')]});});}});}else{logger[_0x53b6('0x2b')](_0x53b6('0x27'),_0x4fafc5);return _0x31a5f2['identity']()['then'](function(_0x260ced){return BPromise['resolve']({'id':_0x260ced[_0x53b6('0x2c')],'name':_0x260ced[_0x53b6('0x2a')]});});}}function getEndUser(_0x2c4262,_0x34991a,_0x329018,_0x51641b,_0x574527){var _0x149dc3={'$or':{'Phone':_0x51641b}};var _0x1374d0={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()[_0x53b6('0x23')](function(){logger[_0x53b6('0x2b')](_0x53b6('0x2d'),_0x51641b,_0x34991a[_0x53b6('0x2e')]);switch(_0x34991a[_0x53b6('0x2e')]){case _0x53b6('0x2f'):var _0x1e4395=_['cloneDeep'](_0x149dc3);if(_0x34991a[_0x53b6('0x30')]){var _0x643374={};_0x643374[_0x34991a[_0x53b6('0x30')]]=_0x51641b;_[_0x53b6('0x31')](_0x1e4395['$or'],_0x643374);}return _0x574527[_0x53b6('0x1e')](_0x53b6('0x32'))[_0x53b6('0x21')](_0x1e4395,_0x1374d0)[_0x53b6('0x22')]()['then'](function(_0x3436c3){if(_0x3436c3&&_0x3436c3[_0x53b6('0x33')]){return _0x3436c3;}else{var _0x271ade=_[_0x53b6('0x34')](_0x149dc3);if(_0x34991a[_0x53b6('0x35')]){var _0x54386f={};_0x54386f[_0x34991a[_0x53b6('0x35')]]=_0x51641b;_[_0x53b6('0x31')](_0x271ade['$or'],_0x54386f);}return _0x574527[_0x53b6('0x1e')]('Lead')[_0x53b6('0x21')](_0x271ade,_0x1374d0);}});case'account_contact_lead':var _0x2c8917=_[_0x53b6('0x34')](_0x149dc3);if(_0x34991a['additionalSearchAccount']){var _0x643374={};_0x643374[_0x34991a[_0x53b6('0x36')]]=_0x51641b;_['merge'](_0x2c8917[_0x53b6('0x37')],_0x643374);}return _0x574527['sobject'](_0x53b6('0x38'))[_0x53b6('0x21')](_0x2c8917,_0x1374d0)[_0x53b6('0x22')]()['then'](function(_0x2fb13c){if(_0x2fb13c&&_0x2fb13c[_0x53b6('0x33')]){return _0x2fb13c;}else{var _0x5261a1=_[_0x53b6('0x34')](_0x149dc3);if(_0x34991a[_0x53b6('0x30')]){var _0x4c4349={};_0x4c4349[_0x34991a[_0x53b6('0x30')]]=_0x51641b;_['merge'](_0x5261a1[_0x53b6('0x37')],_0x4c4349);}return _0x574527[_0x53b6('0x1e')](_0x53b6('0x32'))[_0x53b6('0x21')](_0x5261a1,_0x1374d0)['then'](function(_0x2365cf){if(_0x2365cf&&_0x2365cf[_0x53b6('0x33')]){return _0x2365cf;}else{var _0x2c9bc1=_['cloneDeep'](_0x149dc3);if(_0x34991a[_0x53b6('0x35')]){var _0x2eecc2={};_0x2eecc2[_0x34991a['additionalSearchLead']]=_0x51641b;_[_0x53b6('0x31')](_0x2c9bc1[_0x53b6('0x37')],_0x2eecc2);}return _0x574527[_0x53b6('0x1e')](_0x53b6('0x39'))[_0x53b6('0x21')](_0x2c9bc1,_0x1374d0);}});}});case _0x53b6('0x16'):var _0x1e4395=_[_0x53b6('0x34')](_0x149dc3);if(_0x34991a[_0x53b6('0x30')]){var _0x643374={};_0x643374[_0x34991a[_0x53b6('0x30')]]=_0x51641b;_[_0x53b6('0x31')](_0x1e4395[_0x53b6('0x37')],_0x643374);}return _0x574527[_0x53b6('0x1e')](_0x53b6('0x32'))[_0x53b6('0x21')](_0x1e4395,_0x1374d0)[_0x53b6('0x22')]();case _0x53b6('0x17'):var _0x1df0eb=_[_0x53b6('0x34')](_0x149dc3);if(_0x34991a[_0x53b6('0x35')]){var _0x643374={};_0x643374[_0x34991a[_0x53b6('0x35')]]=_0x51641b;_[_0x53b6('0x31')](_0x1df0eb[_0x53b6('0x37')],_0x643374);}return _0x574527[_0x53b6('0x1e')](_0x53b6('0x39'))[_0x53b6('0x21')](_0x1df0eb,_0x1374d0);case _0x53b6('0x1a'):var _0x2c8917=_[_0x53b6('0x34')](_0x149dc3);if(_0x34991a['additionalSearchAccount']){var _0x643374={};_0x643374[_0x34991a[_0x53b6('0x36')]]=_0x51641b;_[_0x53b6('0x31')](_0x2c8917[_0x53b6('0x37')],_0x643374);}return _0x574527[_0x53b6('0x1e')](_0x53b6('0x38'))['find'](_0x2c8917,_0x1374d0);default:return null;}})[_0x53b6('0x23')](function(_0x3ff5a0){if(_0x3ff5a0&&_0x3ff5a0['length']){var _0x20f631=_[_0x53b6('0x3a')](_0x3ff5a0);if(_0x20f631){return BPromise[_0x53b6('0x29')]({'id':_0x20f631['Id'],'name':_0x20f631[_0x53b6('0x26')],'phone':_0x20f631[_0x53b6('0x3b')],'endUserType':_0x20f631[_0x53b6('0x3c')][_0x53b6('0x3d')][_0x53b6('0x3e')]()});}}})['then'](function(_0x242ab0){if(_0x242ab0){logger[_0x53b6('0x2b')](_0x53b6('0x3f'),_0x242ab0[_0x53b6('0x15')],_0x51641b);return BPromise['resolve'](_0x242ab0);}else{logger[_0x53b6('0x2b')](_0x53b6('0x40'),_0x51641b);var _0x3e7206={'Phone':_0x51641b};if(_0x34991a[_0x53b6('0x41')]){if(_0x34991a[_0x53b6('0x41')]==='contact'){logger[_0x53b6('0x2b')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x51641b,_0x34991a[_0x53b6('0x41')]);_0x3e7206[_0x53b6('0x42')]=_0x329018!==''?_0x329018:util['format'](_0x53b6('0x43'),_0x51641b);}else if(_0x34991a['moduleCreate']===_0x53b6('0x17')){logger[_0x53b6('0x2b')](_0x53b6('0x44'),_0x51641b,_0x34991a[_0x53b6('0x41')]);_0x3e7206[_0x53b6('0x42')]=_0x329018!==''?_0x329018:util['format'](_0x53b6('0x43'),_0x51641b);_0x3e7206[_0x53b6('0x45')]=_0x53b6('0x46');}else if(_0x34991a[_0x53b6('0x41')]===_0x53b6('0x1a')){logger['info'](_0x53b6('0x44'),_0x51641b,_0x34991a[_0x53b6('0x41')]);_0x3e7206[_0x53b6('0x26')]=_0x329018!==_0x53b6('0x47')?_0x329018:util['format'](_0x53b6('0x43'),_0x51641b);}else{return null;}}return _0x574527[_0x53b6('0x1e')](_['upperFirst'](_0x34991a[_0x53b6('0x41')]))[_0x53b6('0x1f')](_0x3e7206)[_0x53b6('0x23')](function(_0xcc3fc4){return BPromise[_0x53b6('0x29')]({'id':_0xcc3fc4['id'],'endUserType':_0x34991a['moduleCreate']});});}});}function getCustomFields(_0xe769fa,_0xea8e1c){var _0x5d295f={};if(_0xe769fa[_0x53b6('0x33')]>0x0){_[_0x53b6('0x48')](_0xe769fa,function(_0x2f2dab){if(_[_0x53b6('0x49')](['string',_0x53b6('0x4a')],_0x2f2dab[_0x53b6('0x3d')])&&_0x2f2dab['idField']){_0x5d295f[_0x2f2dab[_0x53b6('0x4b')]]=_0x2f2dab[_0x53b6('0x4c')][_0x53b6('0x4d')]();}else if(_0x2f2dab['type']===_0x53b6('0x4e')&&_0x2f2dab['variableName']&&_0x2f2dab['idField']){_0xea8e1c[_0x2f2dab[_0x53b6('0x4f')]]&&(_0x5d295f[_0x2f2dab[_0x53b6('0x4b')]]=_0xea8e1c[_0x2f2dab[_0x53b6('0x4f')]][_0x53b6('0x4d')]());}else if(_0x2f2dab[_0x53b6('0x3d')]===_0x53b6('0x50')&&_0x2f2dab[_0x53b6('0x51')]&&_0x2f2dab[_0x53b6('0x51')][_0x53b6('0x52')]&&_0x2f2dab['idField']){_0xea8e1c[_0x2f2dab[_0x53b6('0x51')][_0x53b6('0x52')][_0x53b6('0x3e')]()]&&(_0x5d295f[_0x2f2dab['idField']]=_0xea8e1c[_0x2f2dab[_0x53b6('0x51')][_0x53b6('0x52')][_0x53b6('0x3e')]()][_0x53b6('0x4d')]());}});}return _0x5d295f;}function getConnection(_0x7804c6){var _0x5ed6d1=_0x7804c6['password'][_0x53b6('0x53')](_0x7804c6[_0x53b6('0x54')]);var _0xa33880=new jsforce[(_0x53b6('0x55'))]({'oauth2':{'loginUrl':_0x7804c6[_0x53b6('0x56')]||_0x53b6('0x57'),'clientId':_0x7804c6['clientId'],'clientSecret':_0x7804c6[_0x53b6('0x58')]}});return _0xa33880[_0x53b6('0x59')](_0x7804c6['username'],_0x5ed6d1)[_0x53b6('0x23')](function(){logger[_0x53b6('0x2b')]('Connection\x20established.');return _0xa33880;});}exports[_0x53b6('0x5a')]=function(_0x1df9ef,_0x11a4ff,_0x2858b7,_0x352ea7,_0x30d874,_0x1bbd93){var _0x168782,_0x2d45aa,_0x4b7c0b,_0x34f7ea;_0x1bbd93[_0x53b6('0x5b')]=intUtil[_0x53b6('0x5c')](_0x1bbd93['serverUrl']);_0x1bbd93['remoteUri']=intUtil[_0x53b6('0x5c')](_0x1bbd93[_0x53b6('0x56')]);if(_0x30d874&&_0x30d874[_0x53b6('0x5d')]){logger[_0x53b6('0x2b')](_0x53b6('0x5e'),'Recording\x20is\x20enabled!');_0x11a4ff[_0x53b6('0x5f')]=util[_0x53b6('0x60')](_0x53b6('0x61'),_0x1bbd93[_0x53b6('0x5b')],_0x11a4ff[_0x53b6('0x62')],md5(_0x11a4ff[_0x53b6('0x62')]));}else{_0x11a4ff['recordingURL']='';}return getConnection(_0x1bbd93)[_0x53b6('0x23')](function(_0x1216ee){_0x34f7ea=_0x1216ee;return getUser(_0x1bbd93,_0x352ea7['email'],_0x34f7ea);})['then'](function(_0x377e60){_0x168782=_0x377e60;return getEndUser(_0x1bbd93,_0x2858b7,_0x11a4ff['calleridname'],_0x11a4ff[_0x53b6('0x63')],_0x34f7ea);})[_0x53b6('0x23')](function(_0x40e97f){_0x2d45aa=_0x40e97f;return getTicket(_0x1bbd93,_0x168782,_0x2d45aa,_0x2858b7,_0x11a4ff,_0x2858b7['Fields'],_0x34f7ea,_0x53b6('0x5a'));})['then'](function(_0x4eb16c){_0x4b7c0b=_0x4eb16c;logger[_0x53b6('0x2b')]('[QUEUE]\x20Ticket\x20%s\x20created',_0x4b7c0b['id']);logger[_0x53b6('0x2b')]('[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x4b7c0b['id'],_0x352ea7['name'],_0x1bbd93[_0x53b6('0x3d')]);switch(_0x1bbd93[_0x53b6('0x3d')]){case'integrationTab':emit(util['format'](_0x53b6('0x64'),_0x352ea7[_0x53b6('0x52')]),_0x53b6('0x65'),{'recordId':_0x4b7c0b['id']});break;case _0x53b6('0x66'):emit(util[_0x53b6('0x60')](_0x53b6('0x64'),_0x352ea7[_0x53b6('0x52')]),'trigger:browser:url',{'uri':util[_0x53b6('0x60')](_0x53b6('0x67'),_0x34f7ea['instanceUrl'],_0x4b7c0b['id'])});break;default:logger[_0x53b6('0x68')](_0x53b6('0x69'));}})[_0x53b6('0x6a')](function(_0x1beac5){logger[_0x53b6('0x68')](_0x53b6('0x5e'),_0x1beac5);});};exports['outbound']=function(_0x4d1f01,_0x1b0484,_0x2d2c1e,_0x48f420,_0x4a9152,_0x467b13,_0x73c327){var _0x4e0ec0,_0x4c444e,_0x47ed73,_0x15cec9;_0x467b13[_0x53b6('0x5b')]=intUtil[_0x53b6('0x5c')](_0x467b13['serverUrl']);_0x467b13[_0x53b6('0x56')]=intUtil['stripTrailingSlash'](_0x467b13[_0x53b6('0x56')]);if(_0x73c327&&_0x73c327['recordingFormat']&&_0x73c327[_0x53b6('0x6b')]!==_0x53b6('0x6c')){logger[_0x53b6('0x2b')](_0x53b6('0x6d'),_0x53b6('0x6e'));_0x1b0484['recordingURL']=util[_0x53b6('0x60')](_0x53b6('0x61'),_0x467b13[_0x53b6('0x5b')],_0x1b0484[_0x53b6('0x62')],md5(_0x1b0484[_0x53b6('0x62')]));}return getConnection(_0x467b13)[_0x53b6('0x23')](function(_0x8ce7a2){_0x15cec9=_0x8ce7a2;return getUser(_0x467b13,_0x48f420['email'],_0x15cec9);})[_0x53b6('0x23')](function(_0xa89fd1){_0x4e0ec0=_0xa89fd1;return getEndUser(_0x467b13,_0x2d2c1e,_0x1b0484[_0x53b6('0x6f')],_0x1b0484[_0x53b6('0x70')],_0x15cec9);})[_0x53b6('0x23')](function(_0x542d2b){_0x4c444e=_0x542d2b;return getTicket(_0x467b13,_0x4e0ec0,_0x4c444e,_0x2d2c1e,_0x1b0484,_0x2d2c1e[_0x53b6('0x71')],_0x15cec9,_0x53b6('0x72'));})['then'](function(_0x4f2be6){_0x47ed73=_0x4f2be6;logger['info'](_0x53b6('0x73'),_0x47ed73['id']);logger['info'](_0x53b6('0x74'),_0x47ed73['id'],_0x48f420['name'],_0x467b13[_0x53b6('0x3d')]);switch(_0x467b13[_0x53b6('0x3d')]){case _0x53b6('0x75'):emit(util[_0x53b6('0x60')]('user:%s',_0x48f420[_0x53b6('0x52')]),_0x53b6('0x65'),{'recordId':_0x47ed73['id']});break;case _0x53b6('0x66'):emit(util[_0x53b6('0x60')]('user:%s',_0x48f420[_0x53b6('0x52')]),'trigger:browser:url',{'uri':util[_0x53b6('0x60')]('%s/%s/e',_0x15cec9[_0x53b6('0x76')],_0x47ed73['id'])});break;default:logger[_0x53b6('0x68')](_0x53b6('0x6d'),_0x53b6('0x77'));}})[_0x53b6('0x6a')](function(_0x30dd9){logger[_0x53b6('0x68')](_0x53b6('0x6d'),_0x30dd9);});};exports['unmanaged']=function(_0x8e7496,_0x546866,_0x1ad88c,_0x1cffcd,_0x456bf6,_0x267728){var _0x27a108,_0x356746,_0x1c48fd,_0x1b5c31;_0x267728['serverUrl']=intUtil[_0x53b6('0x5c')](_0x267728['serverUrl']);_0x267728[_0x53b6('0x56')]=intUtil[_0x53b6('0x5c')](_0x267728[_0x53b6('0x56')]);if(_0x456bf6&&_0x456bf6[_0x53b6('0x5d')]){logger['info']('['+_0x546866[_0x53b6('0x78')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x546866['recordingURL']=util[_0x53b6('0x60')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x267728[_0x53b6('0x5b')],_0x546866[_0x53b6('0x62')],md5(_0x546866[_0x53b6('0x62')]));}else{_0x546866['recordingURL']='';}return getConnection(_0x267728)[_0x53b6('0x23')](function(_0x48af3d){_0x1b5c31=_0x48af3d;if(!_[_0x53b6('0x79')](_0x1cffcd)){return getUser(_0x267728,_0x1cffcd[_0x53b6('0x52')],_0x1b5c31);}else{return getUser(_0x267728,null,_0x1b5c31);}})[_0x53b6('0x23')](function(_0x361c7b){_0x27a108=_0x361c7b;return getEndUser(_0x267728,_0x1ad88c,_0x546866['calleridname'],_0x546866[_0x53b6('0x63')],_0x1b5c31);})['then'](function(_0x4bf288){_0x356746=_0x4bf288;return getTicket(_0x267728,_0x27a108,_0x356746,_0x1ad88c,_0x546866,_0x1ad88c[_0x53b6('0x71')],_0x1b5c31);})['then'](function(_0x48fb9c){_0x1c48fd=_0x48fb9c;logger[_0x53b6('0x2b')]('['+_0x546866[_0x53b6('0x78')]['toUpperCase']()+_0x53b6('0x7a'),_0x1c48fd['id']);logger['info']('['+_0x546866['lastevent'][_0x53b6('0x7b')]()+_0x53b6('0x7c'),_0x267728[_0x53b6('0x3d')]);})['catch'](function(_0x407870){logger[_0x53b6('0x68')]('['+_0x546866[_0x53b6('0x78')][_0x53b6('0x7b')]()+']',_0x407870);});}; \ No newline at end of file +var _0x7321=['Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','login','Connection\x20established.','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.','integrationTab','user:%s','trigger:salesforce:display','newTab','instanceUrl','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','error','outbound','none','[OUTBOUND]','destcalleridnum','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','%s/%s/e','Salesforce\x20account\x20type\x20not\x20recognized','catch','unmanaged','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','moment','bluebird','md5','jsforce','util','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','localhost','socket.io-emitter','emit','assign','getString','Subjects','Descriptions','ticketType','Task','ActivityDate','utc','IsRecurrence','contact','endUserType','lead','WhoId','account','WhatId','Case','ContactId','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','User','find','execute','then','length','Email','Agent\x20%s\x20found.','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','display_name','resolve','user_id','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','$or','additionalSearchLead','Lead','account_contact_lead','additionalSearchAccount','Contact','Account','first','attributes','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.','LastName','format','Caller\x20-\x20%s','Company','No\x20Company','','forEach','picklist','type','idField','content','variableName','Variable','name','toString','password','concat','securityToken'];(function(_0x9386ea,_0x19ac6e){var _0x4dd274=function(_0xa86f0a){while(--_0xa86f0a){_0x9386ea['push'](_0x9386ea['shift']());}};_0x4dd274(++_0x19ac6e);}(_0x7321,0xae));var _0x1732=function(_0x436e0a,_0x1fb72c){_0x436e0a=_0x436e0a-0x0;var _0x15759d=_0x7321[_0x436e0a];return _0x15759d;};'use strict';var _=require('lodash');var rp=require('request-promise');var moment=require(_0x1732('0x0'));var BPromise=require(_0x1732('0x1'));var md5=require(_0x1732('0x2'));var jsforce=require(_0x1732('0x3'));var util=require(_0x1732('0x4'));var Redis=require(_0x1732('0x5'));var intUtil=require(_0x1732('0x6'));var config=require(_0x1732('0x7'));var logger=require(_0x1732('0x8'))(_0x1732('0x9'));config[_0x1732('0xa')]=_[_0x1732('0xb')](config[_0x1732('0xa')],{'host':_0x1732('0xc'),'port':0x18eb});var io=require(_0x1732('0xd'))(new Redis(config[_0x1732('0xa')]));function emit(_0x13ae4e,_0xf70cba,_0x39c781){io['to'](_0x13ae4e)[_0x1732('0xe')](_0xf70cba,_0x39c781);}function getTicket(_0x31182f,_0x219c4c,_0x1d188b,_0x4f0f44,_0x1441dd,_0xe3f735,_0x55846f,_0x59ff5d){var _0x390456=Object[_0x1732('0xf')]({},{'OwnerId':_0x219c4c['id'],'Subject':intUtil[_0x1732('0x10')](_0x4f0f44[_0x1732('0x11')],_0x1441dd,'\x20'),'Description':intUtil['getString'](_0x4f0f44[_0x1732('0x12')],_0x1441dd,'\x0a')},getCustomFields(_0xe3f735,_0x1441dd));if(_0x1d188b){if(_0x4f0f44[_0x1732('0x13')]===_0x1732('0x14')){_0x390456[_0x1732('0x15')]=moment[_0x1732('0x16')]();_0x390456['IsReminderSet']=![];_0x390456[_0x1732('0x17')]=![];if(_0x1d188b['endUserType']===_0x1732('0x18')||_0x1d188b[_0x1732('0x19')]===_0x1732('0x1a')){_0x390456[_0x1732('0x1b')]=_0x1d188b['id'];}else if(_0x1d188b['endUserType']===_0x1732('0x1c')){_0x390456[_0x1732('0x1d')]=_0x1d188b['id'];}}else if(_0x4f0f44['ticketType']===_0x1732('0x1e')){if(_0x1d188b[_0x1732('0x19')]===_0x1732('0x18')){_0x390456[_0x1732('0x1f')]=_0x1d188b['id'];}else if(_0x1d188b[_0x1732('0x19')]===_0x1732('0x1c')){_0x390456[_0x1732('0x20')]=_0x1d188b['id'];}else if(_0x1d188b['endUserType']===_0x1732('0x1a')&&_0x4f0f44[_0x1732('0x21')]){_0x390456[_0x4f0f44[_0x1732('0x21')]]=_0x1d188b['id'];}else{logger[_0x1732('0x22')](_0x1732('0x23'));}}}return _0x55846f[_0x1732('0x24')](_0x4f0f44[_0x1732('0x13')])[_0x1732('0x25')](_0x390456);}function getUser(_0x5115f7,_0x744165,_0x4cb144){if(!_[_0x1732('0x26')](_0x744165)&&intUtil['validateEmail'](_0x744165)){var _0x23cd8a={'Email':_0x744165};var _0x20d8bf={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x4cb144[_0x1732('0x24')](_0x1732('0x27'))[_0x1732('0x28')](_0x23cd8a,_0x20d8bf)[_0x1732('0x29')]()[_0x1732('0x2a')](function(_0x11a4a2){if(_0x11a4a2[_0x1732('0x2b')]){var _0x38f032=_[_0x1732('0x28')](_0x11a4a2,function(_0x5013dc){return _0x5013dc[_0x1732('0x2c')]===_0x744165;});if(_0x38f032){logger['info'](_0x1732('0x2d'),_0x744165);return BPromise['resolve']({'id':_0x38f032['Id'],'name':_0x38f032[_0x1732('0x2e')]});}}else{logger['info'](_0x1732('0x2f'),_0x744165);return _0x4cb144[_0x1732('0x30')]()[_0x1732('0x2a')](function(_0x1bb7a2){return BPromise['resolve']({'id':_0x1bb7a2['user_id'],'name':_0x1bb7a2[_0x1732('0x31')]});});}});}else{logger[_0x1732('0x22')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x744165);return _0x4cb144[_0x1732('0x30')]()[_0x1732('0x2a')](function(_0x38bc4f){return BPromise[_0x1732('0x32')]({'id':_0x38bc4f[_0x1732('0x33')],'name':_0x38bc4f[_0x1732('0x31')]});});}}function getEndUser(_0x1baec8,_0x58d435,_0x4a6899,_0x1ae3b8,_0x44a53c){var _0x1518e6={'$or':{'Phone':_0x1ae3b8}};var _0x125f9f={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x1732('0x32')]()[_0x1732('0x2a')](function(){logger[_0x1732('0x22')](_0x1732('0x34'),_0x1ae3b8,_0x58d435[_0x1732('0x35')]);switch(_0x58d435['moduleSearch']){case _0x1732('0x36'):var _0x5bcab4=_[_0x1732('0x37')](_0x1518e6);if(_0x58d435[_0x1732('0x38')]){var _0x425626={};_0x425626[_0x58d435[_0x1732('0x38')]]=_0x1ae3b8;_[_0x1732('0x39')](_0x5bcab4[_0x1732('0x3a')],_0x425626);}return _0x44a53c['sobject']('Contact')[_0x1732('0x28')](_0x5bcab4,_0x125f9f)[_0x1732('0x29')]()['then'](function(_0x36f98d){if(_0x36f98d&&_0x36f98d[_0x1732('0x2b')]){return _0x36f98d;}else{var _0x32bf5e=_['cloneDeep'](_0x1518e6);if(_0x58d435['additionalSearchLead']){var _0x3f62c7={};_0x3f62c7[_0x58d435[_0x1732('0x3b')]]=_0x1ae3b8;_[_0x1732('0x39')](_0x32bf5e[_0x1732('0x3a')],_0x3f62c7);}return _0x44a53c[_0x1732('0x24')](_0x1732('0x3c'))[_0x1732('0x28')](_0x32bf5e,_0x125f9f);}});case _0x1732('0x3d'):var _0x5335c3=_[_0x1732('0x37')](_0x1518e6);if(_0x58d435['additionalSearchAccount']){var _0x425626={};_0x425626[_0x58d435[_0x1732('0x3e')]]=_0x1ae3b8;_[_0x1732('0x39')](_0x5335c3[_0x1732('0x3a')],_0x425626);}return _0x44a53c[_0x1732('0x24')]('Account')[_0x1732('0x28')](_0x5335c3,_0x125f9f)[_0x1732('0x29')]()[_0x1732('0x2a')](function(_0x2a7d93){if(_0x2a7d93&&_0x2a7d93['length']){return _0x2a7d93;}else{var _0x3e64e4=_[_0x1732('0x37')](_0x1518e6);if(_0x58d435[_0x1732('0x38')]){var _0x40444d={};_0x40444d[_0x58d435[_0x1732('0x38')]]=_0x1ae3b8;_[_0x1732('0x39')](_0x3e64e4[_0x1732('0x3a')],_0x40444d);}return _0x44a53c['sobject']('Contact')['find'](_0x3e64e4,_0x125f9f)[_0x1732('0x2a')](function(_0x1dbfdb){if(_0x1dbfdb&&_0x1dbfdb[_0x1732('0x2b')]){return _0x1dbfdb;}else{var _0x53c8e2=_[_0x1732('0x37')](_0x1518e6);if(_0x58d435[_0x1732('0x3b')]){var _0x4db22d={};_0x4db22d[_0x58d435[_0x1732('0x3b')]]=_0x1ae3b8;_['merge'](_0x53c8e2['$or'],_0x4db22d);}return _0x44a53c[_0x1732('0x24')](_0x1732('0x3c'))[_0x1732('0x28')](_0x53c8e2,_0x125f9f);}});}});case'contact':var _0x5bcab4=_['cloneDeep'](_0x1518e6);if(_0x58d435['additionalSearchContact']){var _0x425626={};_0x425626[_0x58d435['additionalSearchContact']]=_0x1ae3b8;_[_0x1732('0x39')](_0x5bcab4[_0x1732('0x3a')],_0x425626);}return _0x44a53c[_0x1732('0x24')](_0x1732('0x3f'))[_0x1732('0x28')](_0x5bcab4,_0x125f9f)[_0x1732('0x29')]();case _0x1732('0x1a'):var _0x143447=_['cloneDeep'](_0x1518e6);if(_0x58d435[_0x1732('0x3b')]){var _0x425626={};_0x425626[_0x58d435[_0x1732('0x3b')]]=_0x1ae3b8;_[_0x1732('0x39')](_0x143447['$or'],_0x425626);}return _0x44a53c['sobject'](_0x1732('0x3c'))[_0x1732('0x28')](_0x143447,_0x125f9f);case _0x1732('0x1c'):var _0x5335c3=_[_0x1732('0x37')](_0x1518e6);if(_0x58d435[_0x1732('0x3e')]){var _0x425626={};_0x425626[_0x58d435['additionalSearchAccount']]=_0x1ae3b8;_['merge'](_0x5335c3[_0x1732('0x3a')],_0x425626);}return _0x44a53c[_0x1732('0x24')](_0x1732('0x40'))[_0x1732('0x28')](_0x5335c3,_0x125f9f);default:return null;}})[_0x1732('0x2a')](function(_0x1e4268){if(_0x1e4268&&_0x1e4268[_0x1732('0x2b')]){var _0x301ba5=_[_0x1732('0x41')](_0x1e4268);if(_0x301ba5){return BPromise[_0x1732('0x32')]({'id':_0x301ba5['Id'],'name':_0x301ba5[_0x1732('0x2e')],'phone':_0x301ba5['Phone'],'endUserType':_0x301ba5[_0x1732('0x42')]['type'][_0x1732('0x43')]()});}}})[_0x1732('0x2a')](function(_0x374d76){if(_0x374d76){logger[_0x1732('0x22')](_0x1732('0x44'),_0x374d76[_0x1732('0x19')],_0x1ae3b8);return BPromise['resolve'](_0x374d76);}else{logger[_0x1732('0x22')](_0x1732('0x45'),_0x1ae3b8);var _0x5502d3={'Phone':_0x1ae3b8};if(_0x58d435[_0x1732('0x46')]){if(_0x58d435[_0x1732('0x46')]===_0x1732('0x18')){logger['info'](_0x1732('0x47'),_0x1ae3b8,_0x58d435[_0x1732('0x46')]);_0x5502d3[_0x1732('0x48')]=_0x4a6899!==''?_0x4a6899:util[_0x1732('0x49')](_0x1732('0x4a'),_0x1ae3b8);}else if(_0x58d435[_0x1732('0x46')]===_0x1732('0x1a')){logger[_0x1732('0x22')](_0x1732('0x47'),_0x1ae3b8,_0x58d435['moduleCreate']);_0x5502d3['LastName']=_0x4a6899!==''?_0x4a6899:util[_0x1732('0x49')](_0x1732('0x4a'),_0x1ae3b8);_0x5502d3[_0x1732('0x4b')]=_0x1732('0x4c');}else if(_0x58d435[_0x1732('0x46')]===_0x1732('0x1c')){logger['info'](_0x1732('0x47'),_0x1ae3b8,_0x58d435[_0x1732('0x46')]);_0x5502d3['Name']=_0x4a6899!==_0x1732('0x4d')?_0x4a6899:util[_0x1732('0x49')](_0x1732('0x4a'),_0x1ae3b8);}else{return null;}}return _0x44a53c[_0x1732('0x24')](_['upperFirst'](_0x58d435[_0x1732('0x46')]))[_0x1732('0x25')](_0x5502d3)['then'](function(_0x15ed26){return BPromise[_0x1732('0x32')]({'id':_0x15ed26['id'],'endUserType':_0x58d435[_0x1732('0x46')]});});}});}function getCustomFields(_0x12bca9,_0xb6d5b5){var _0xbe6748={};if(_0x12bca9[_0x1732('0x2b')]>0x0){_[_0x1732('0x4e')](_0x12bca9,function(_0x3c590c){if(_['includes'](['string',_0x1732('0x4f')],_0x3c590c[_0x1732('0x50')])&&_0x3c590c[_0x1732('0x51')]){_0xbe6748[_0x3c590c[_0x1732('0x51')]]=_0x3c590c[_0x1732('0x52')]['toString']();}else if(_0x3c590c[_0x1732('0x50')]==='variable'&&_0x3c590c[_0x1732('0x53')]&&_0x3c590c[_0x1732('0x51')]){_0xb6d5b5[_0x3c590c['variableName']]&&(_0xbe6748[_0x3c590c[_0x1732('0x51')]]=_0xb6d5b5[_0x3c590c[_0x1732('0x53')]]['toString']());}else if(_0x3c590c[_0x1732('0x50')]==='customVariable'&&_0x3c590c[_0x1732('0x54')]&&_0x3c590c['Variable'][_0x1732('0x55')]&&_0x3c590c[_0x1732('0x51')]){_0xb6d5b5[_0x3c590c[_0x1732('0x54')]['name'][_0x1732('0x43')]()]&&(_0xbe6748[_0x3c590c['idField']]=_0xb6d5b5[_0x3c590c[_0x1732('0x54')][_0x1732('0x55')][_0x1732('0x43')]()][_0x1732('0x56')]());}});}return _0xbe6748;}function getConnection(_0x4f971b){var _0x381b9f=_0x4f971b[_0x1732('0x57')][_0x1732('0x58')](_0x4f971b[_0x1732('0x59')]);var _0x2b7f1b=new jsforce[(_0x1732('0x5a'))]({'oauth2':{'loginUrl':_0x4f971b[_0x1732('0x5b')]||_0x1732('0x5c'),'clientId':_0x4f971b[_0x1732('0x5d')],'clientSecret':_0x4f971b[_0x1732('0x5e')]}});return _0x2b7f1b[_0x1732('0x5f')](_0x4f971b['username'],_0x381b9f)[_0x1732('0x2a')](function(){logger[_0x1732('0x22')](_0x1732('0x60'));return _0x2b7f1b;});}exports[_0x1732('0x61')]=function(_0x4a6da8,_0x5c5755,_0x2b31a5,_0x2394e9,_0x4e031f,_0x393d2d){var _0x5aff47,_0x4d975a,_0x49e13f,_0x509138;_0x393d2d[_0x1732('0x62')]=intUtil[_0x1732('0x63')](_0x393d2d['serverUrl']);_0x393d2d[_0x1732('0x5b')]=intUtil['stripTrailingSlash'](_0x393d2d[_0x1732('0x5b')]);if(_0x4e031f&&_0x4e031f[_0x1732('0x64')]){logger[_0x1732('0x22')](_0x1732('0x65'),_0x1732('0x66'));_0x5c5755[_0x1732('0x67')]=util['format'](_0x1732('0x68'),_0x393d2d['serverUrl'],_0x5c5755['uniqueid'],md5(_0x5c5755[_0x1732('0x69')]));}else{_0x5c5755[_0x1732('0x67')]='';}return getConnection(_0x393d2d)[_0x1732('0x2a')](function(_0x569979){_0x509138=_0x569979;return getUser(_0x393d2d,_0x2394e9[_0x1732('0x6a')],_0x509138);})['then'](function(_0x44b3ed){_0x5aff47=_0x44b3ed;return getEndUser(_0x393d2d,_0x2b31a5,_0x5c5755[_0x1732('0x6b')],_0x5c5755[_0x1732('0x6c')],_0x509138);})[_0x1732('0x2a')](function(_0x26ab61){_0x4d975a=_0x26ab61;return getTicket(_0x393d2d,_0x5aff47,_0x4d975a,_0x2b31a5,_0x5c5755,_0x2b31a5[_0x1732('0x6d')],_0x509138,'queue');})[_0x1732('0x2a')](function(_0x473597){_0x49e13f=_0x473597;logger['info'](_0x1732('0x6e'),_0x49e13f['id']);logger['info'](_0x1732('0x6f'),_0x49e13f['id'],_0x2394e9[_0x1732('0x55')],_0x393d2d[_0x1732('0x50')]);switch(_0x393d2d[_0x1732('0x50')]){case _0x1732('0x70'):emit(util[_0x1732('0x49')](_0x1732('0x71'),_0x2394e9[_0x1732('0x55')]),_0x1732('0x72'),{'recordId':_0x49e13f['id']});break;case _0x1732('0x73'):emit(util[_0x1732('0x49')](_0x1732('0x71'),_0x2394e9[_0x1732('0x55')]),'trigger:browser:url',{'uri':util[_0x1732('0x49')]('%s/%s/e',_0x509138[_0x1732('0x74')],_0x49e13f['id'])});break;default:logger['error'](_0x1732('0x75'));}})['catch'](function(_0x3a5db3){logger[_0x1732('0x76')](_0x1732('0x65'),_0x3a5db3);});};exports[_0x1732('0x77')]=function(_0x5b84d9,_0x1a9cb4,_0x141dd3,_0x470443,_0x2de0e6,_0x347244,_0x50d1a8){var _0x113489,_0x51c966,_0x230541,_0x20b9f5;_0x347244['serverUrl']=intUtil['stripTrailingSlash'](_0x347244[_0x1732('0x62')]);_0x347244[_0x1732('0x5b')]=intUtil[_0x1732('0x63')](_0x347244[_0x1732('0x5b')]);if(_0x50d1a8&&_0x50d1a8['recordingFormat']&&_0x50d1a8['recordingFormat']!==_0x1732('0x78')){logger[_0x1732('0x22')](_0x1732('0x79'),_0x1732('0x66'));_0x1a9cb4[_0x1732('0x67')]=util[_0x1732('0x49')](_0x1732('0x68'),_0x347244[_0x1732('0x62')],_0x1a9cb4[_0x1732('0x69')],md5(_0x1a9cb4[_0x1732('0x69')]));}return getConnection(_0x347244)['then'](function(_0x596e73){_0x20b9f5=_0x596e73;return getUser(_0x347244,_0x470443[_0x1732('0x6a')],_0x20b9f5);})[_0x1732('0x2a')](function(_0x3f4e2b){_0x113489=_0x3f4e2b;return getEndUser(_0x347244,_0x141dd3,_0x1a9cb4['destcalleridname'],_0x1a9cb4[_0x1732('0x7a')],_0x20b9f5);})[_0x1732('0x2a')](function(_0xb584b){_0x51c966=_0xb584b;return getTicket(_0x347244,_0x113489,_0x51c966,_0x141dd3,_0x1a9cb4,_0x141dd3['Fields'],_0x20b9f5,_0x1732('0x77'));})['then'](function(_0x498c29){_0x230541=_0x498c29;logger[_0x1732('0x22')]('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x230541['id']);logger[_0x1732('0x22')](_0x1732('0x7b'),_0x230541['id'],_0x470443[_0x1732('0x55')],_0x347244[_0x1732('0x50')]);switch(_0x347244['type']){case'integrationTab':emit(util[_0x1732('0x49')](_0x1732('0x71'),_0x470443[_0x1732('0x55')]),'trigger:salesforce:display',{'recordId':_0x230541['id']});break;case _0x1732('0x73'):emit(util[_0x1732('0x49')]('user:%s',_0x470443[_0x1732('0x55')]),'trigger:browser:url',{'uri':util[_0x1732('0x49')](_0x1732('0x7c'),_0x20b9f5['instanceUrl'],_0x230541['id'])});break;default:logger[_0x1732('0x76')](_0x1732('0x79'),_0x1732('0x7d'));}})[_0x1732('0x7e')](function(_0x3720de){logger[_0x1732('0x76')]('[OUTBOUND]',_0x3720de);});};exports[_0x1732('0x7f')]=function(_0x2c49bd,_0xf86134,_0x13bdc5,_0x725ae2,_0x559157,_0x9e292c){var _0xad13a5,_0x5674d9,_0x1bd27b,_0x41f8fd;_0x9e292c[_0x1732('0x62')]=intUtil[_0x1732('0x63')](_0x9e292c[_0x1732('0x62')]);_0x9e292c[_0x1732('0x5b')]=intUtil['stripTrailingSlash'](_0x9e292c[_0x1732('0x5b')]);if(_0x559157&&_0x559157[_0x1732('0x64')]){logger[_0x1732('0x22')]('['+_0xf86134[_0x1732('0x80')][_0x1732('0x81')]()+']','Recording\x20is\x20enabled!');_0xf86134[_0x1732('0x67')]=util[_0x1732('0x49')](_0x1732('0x68'),_0x9e292c[_0x1732('0x62')],_0xf86134[_0x1732('0x69')],md5(_0xf86134[_0x1732('0x69')]));}else{_0xf86134[_0x1732('0x67')]='';}return getConnection(_0x9e292c)[_0x1732('0x2a')](function(_0x19cd22){_0x41f8fd=_0x19cd22;if(!_['isNil'](_0x725ae2)){return getUser(_0x9e292c,_0x725ae2[_0x1732('0x55')],_0x41f8fd);}else{return getUser(_0x9e292c,null,_0x41f8fd);}})[_0x1732('0x2a')](function(_0x4228ef){_0xad13a5=_0x4228ef;return getEndUser(_0x9e292c,_0x13bdc5,_0xf86134[_0x1732('0x6b')],_0xf86134[_0x1732('0x6c')],_0x41f8fd);})['then'](function(_0x4c78d7){_0x5674d9=_0x4c78d7;return getTicket(_0x9e292c,_0xad13a5,_0x5674d9,_0x13bdc5,_0xf86134,_0x13bdc5[_0x1732('0x6d')],_0x41f8fd);})[_0x1732('0x2a')](function(_0x2753dd){_0x1bd27b=_0x2753dd;logger[_0x1732('0x22')]('['+_0xf86134[_0x1732('0x80')][_0x1732('0x81')]()+_0x1732('0x82'),_0x1bd27b['id']);logger['info']('['+_0xf86134[_0x1732('0x80')][_0x1732('0x81')]()+_0x1732('0x83'),_0x9e292c['type']);})[_0x1732('0x7e')](function(_0x236062){logger['error']('['+_0xf86134[_0x1732('0x80')][_0x1732('0x81')]()+']',_0x236062);});}; \ 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 35032fe..d1b566f 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 _0x3f84=['number','POST','label','?sysparm_query=name%3D','Incident','Incident\x20-\x20','ticketNumber','forEach',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','push','all','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','format','user:%s','emit','trigger:browser:url','username','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','isNil','email','destcalleridnum','calleridnum','unmanaged','queue','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','Displaying\x20call\x20in\x20a\x20new\x20tab...','lodash','util','md5','ioredis','./util','../../../../config/environment','servicenow','socket.io-emitter','redis','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','adminId','sys_id','info','error','toUpperCase','message','validateEmail','userEmail','sys_user?sysparm_query=email%3D','active','true','userId','adminEmail','],\x20getUser\x20crm','catch',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','sys_user?','endUserNumber','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','includes','string','picklist','type','nameField','idField','toLowerCase','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','assign','Subjects','getString','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId'];(function(_0x32c813,_0xf88851){var _0x5c5879=function(_0x5df10f){while(--_0x5df10f){_0x32c813['push'](_0x32c813['shift']());}};_0x5c5879(++_0xf88851);}(_0x3f84,0x1c0));var _0x43f8=function(_0x526046,_0x154040){_0x526046=_0x526046-0x0;var _0x5b92a2=_0x3f84[_0x526046];return _0x5b92a2;};'use strict';var _=require(_0x43f8('0x0'));var Promise=require('bluebird');var rp=require('request-promise');var util=require(_0x43f8('0x1'));var md5=require(_0x43f8('0x2'));var Redis=require(_0x43f8('0x3'));var intUtil=require(_0x43f8('0x4'));var config=require(_0x43f8('0x5'));var logger=require('../../../../config/logger')(_0x43f8('0x6'));config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x43f8('0x7'))(new Redis(config[_0x43f8('0x8')]));function getAdminUser(_0x35b818,_0x307753,_0x496e77,_0x5450d9,_0x91e5bc,_0x4cc782){return new Promise(function(_0x38145e,_0x5c936f){var _0x35976d={'method':_0x43f8('0x9'),'uri':_0x5450d9+_0x43f8('0xa')+'&'+_0x91e5bc+'&'+_0x4cc782,'auth':_0x307753,'json':!![]};return rp(_0x35976d)[_0x43f8('0xb')](function(_0x4144d8){if(_0x4144d8[_0x43f8('0xc')][_0x43f8('0xd')]>0x0){_0x496e77[_0x43f8('0xe')]=_0x4144d8[_0x43f8('0xc')][0x0][_0x43f8('0xf')];}logger[_0x43f8('0x10')]('['+[_0x35b818['toUpperCase']()]+'],\x20getAdminUser\x20crm',_0x496e77);_0x38145e(_0x496e77);})['catch'](function(_0x4a6e5b){logger[_0x43f8('0x11')]('['+[_0x35b818[_0x43f8('0x12')]()]+']',_0x4a6e5b[_0x43f8('0x13')]);_0x5c936f(_0x4a6e5b[_0x43f8('0x13')]);});});}function getUser(_0x586a35,_0x4c1e44,_0x27df2b,_0x21c65d,_0x45d586){return function(_0x4f6721){logger['info']('['+[_0x586a35[_0x43f8('0x12')]()]+'],\x20getUser\x20input\x20crm',_0x4f6721);return new Promise(function(_0x4aae58,_0x30aca5){if(intUtil[_0x43f8('0x14')](_0x4f6721[_0x43f8('0x15')])){var _0x132d14={'method':'GET','uri':_0x27df2b+_0x43f8('0x16')+_0x4f6721[_0x43f8('0x15')]+'&'+_0x21c65d+'&'+_0x45d586,'auth':_0x4c1e44,'json':!![]};logger['info']('['+[_0x586a35['toUpperCase']()]+'],\x20getUser\x20rp\x20obj',_0x132d14);return rp(_0x132d14)[_0x43f8('0xb')](function(_0x302200){logger[_0x43f8('0x10')]('['+[_0x586a35['toUpperCase']()]+'],\x20getUser\x20entity',_0x302200);if(_0x302200[_0x43f8('0xc')][_0x43f8('0xd')]>0x0&&String(_0x302200['result'][0x0][_0x43f8('0x17')])===_0x43f8('0x18')){_0x4f6721[_0x43f8('0x19')]=_0x302200[_0x43f8('0xc')][0x0]['sys_id'];}else{_0x4f6721[_0x43f8('0x19')]=_0x4f6721[_0x43f8('0xe')];_0x4f6721[_0x43f8('0x15')]=_0x4f6721[_0x43f8('0x1a')];}logger['info']('['+[_0x586a35['toUpperCase']()]+_0x43f8('0x1b'),_0x4f6721);_0x4aae58(_0x4f6721);})[_0x43f8('0x1c')](function(_0x58c679){logger[_0x43f8('0x11')]('['+[_0x586a35[_0x43f8('0x12')]()]+']',_0x58c679[_0x43f8('0x13')]);_0x30aca5(_0x58c679[_0x43f8('0x13')]);});}else{logger[_0x43f8('0x10')]('['+[_0x586a35['toUpperCase']()]+_0x43f8('0x1d'));_0x4f6721[_0x43f8('0x19')]=_0x4f6721[_0x43f8('0xe')];_0x4f6721[_0x43f8('0x15')]=_0x4f6721[_0x43f8('0x1a')];_0x4aae58(_0x4f6721);}});};}function createEndUser(_0x5d4e42,_0xf4925c,_0x25eff1,_0x52af51,_0x19a84d){logger[_0x43f8('0x10')]('['+[_0x5d4e42[_0x43f8('0x12')]()]+_0x43f8('0x1e'),_0x25eff1);return new Promise(function(_0x310554,_0x5bd4ee){var _0x5574b5={'method':'POST','uri':_0x52af51+_0x43f8('0x1f')+_0x19a84d,'body':{'user_name':_0x25eff1['endUserNumber'],'roles':'user','first_name':_0x25eff1[_0x43f8('0x20')],'active':'true','date_format':'System','phone':_0x25eff1[_0x43f8('0x20')]},'auth':_0xf4925c,'json':!![]};return rp(_0x5574b5)[_0x43f8('0xb')](function(_0x20b569){logger[_0x43f8('0x10')]('['+[_0x5d4e42[_0x43f8('0x12')]()]+_0x43f8('0x21'),_0x20b569[_0x43f8('0xc')]);_0x25eff1[_0x43f8('0x22')]=_0x20b569['result']['sys_id'];_0x310554(_0x25eff1);})[_0x43f8('0x1c')](function(_0x3cff0a){logger[_0x43f8('0x11')]('['+[_0x5d4e42[_0x43f8('0x12')]()]+']',_0x3cff0a[_0x43f8('0x13')]);_0x5bd4ee(_0x3cff0a[_0x43f8('0x13')]);});});}function getEndUser(_0x358d5f,_0x5b9294,_0x158e00,_0x4f2f08,_0x3331f4){return function(_0x410299){logger[_0x43f8('0x10')]('['+[_0x358d5f[_0x43f8('0x12')]()]+_0x43f8('0x23'),_0x410299);return new Promise(function(_0x1f0f69,_0x278c44){var _0x5c984c={'method':_0x43f8('0x9'),'uri':_0x158e00+_0x43f8('0x24')+_0x410299[_0x43f8('0x20')]+'&'+_0x4f2f08+'&'+_0x3331f4,'auth':_0x5b9294,'json':!![]};return rp(_0x5c984c)['then'](function(_0x5a4378){if(_0x5a4378['result'][_0x43f8('0xd')]>0x0){_0x410299[_0x43f8('0x22')]=_0x5a4378['result'][0x0]['sys_id'];logger[_0x43f8('0x10')]('['+[_0x358d5f[_0x43f8('0x12')]()]+_0x43f8('0x25'),_0x410299);_0x1f0f69(_0x410299);}else{return createEndUser(_0x358d5f,_0x5b9294,_0x410299,_0x158e00,_0x4f2f08)[_0x43f8('0xb')](function(_0x23738c){logger[_0x43f8('0x10')]('['+[_0x358d5f[_0x43f8('0x12')]()]+_0x43f8('0x26'),_0x23738c);_0x1f0f69(_0x23738c);});}})[_0x43f8('0x1c')](function(_0x804014){logger[_0x43f8('0x11')]('['+[_0x358d5f['toUpperCase']()]+']',_0x804014[_0x43f8('0x13')]);_0x278c44(_0x804014['message']);});});};}function getCustomFields(_0x3e1097,_0x409107){var _0x340c7a={};if(_0x3e1097[_0x43f8('0xd')]>0x0){_['forEach'](_0x3e1097,function(_0x1a9de6){if(_[_0x43f8('0x27')]([_0x43f8('0x28'),_0x43f8('0x29')],_0x1a9de6[_0x43f8('0x2a')])&&_0x1a9de6[_0x43f8('0x2b')]&&!_0x1a9de6['customField']){_0x340c7a[_0x1a9de6[_0x43f8('0x2b')]['toLowerCase']()]=_0x1a9de6['content']['toString']();}else if(_[_0x43f8('0x27')]([_0x43f8('0x28'),'picklist'],_0x1a9de6[_0x43f8('0x2a')])&&_0x1a9de6['idField']&&_0x1a9de6['customField']){_0x340c7a[_0x1a9de6[_0x43f8('0x2c')]['toLowerCase']()]=_0x1a9de6['content']['toString']();}else if(_0x1a9de6[_0x43f8('0x2a')]==='variable'&&_0x1a9de6['variableName']&&_0x1a9de6[_0x43f8('0x2c')]&&_0x1a9de6['customField']){_0x340c7a[_0x1a9de6[_0x43f8('0x2c')][_0x43f8('0x2d')]()]=_0x409107[_0x1a9de6['variableName']]['toString']();}else if(_0x1a9de6[_0x43f8('0x2a')]==='customVariable'&&_0x1a9de6['Variable']&&_0x1a9de6[_0x43f8('0x2e')][_0x43f8('0x2f')]&&_0x1a9de6[_0x43f8('0x2c')]&&_0x1a9de6['customField']){_0x340c7a[_0x1a9de6[_0x43f8('0x2c')][_0x43f8('0x2d')]()]=_0x409107[_0x1a9de6['Variable'][_0x43f8('0x2f')][_0x43f8('0x2d')]()]['toString']();}});}return _0x340c7a;}function getTicket(_0x2c3fa7,_0x237f39,_0x1d8f3e,_0x18aa75,_0x54fc46,_0x54b5ff){return function(_0x32a78d){logger[_0x43f8('0x10')]('['+[_0x2c3fa7[_0x43f8('0x12')]()]+_0x43f8('0x30'),_0x32a78d);return new Promise(function(_0x26c938,_0x4c5244){var _0x8daaeb=_0x2c3fa7['toLowerCase']()===_0x43f8('0x31')?_0x32a78d[_0x43f8('0x19')]:_0x32a78d['endUserId'];var _0x4c4671={'method':'POST','uri':_0x1d8f3e+_0x43f8('0x32')+'?'+_0x54b5ff,'body':Object[_0x43f8('0x33')]({},{'active':_0x43f8('0x18'),'caller_id':_0x8daaeb,'assigned_to':_0x32a78d[_0x43f8('0x19')],'short_description':intUtil['getString'](_0x18aa75[_0x43f8('0x34')],_0x54fc46,'\x20'),'description':intUtil[_0x43f8('0x35')](_0x18aa75['Descriptions'],_0x54fc46,'\x0a')},getCustomFields(_0x18aa75[_0x43f8('0x36')],_0x54fc46)),'auth':_0x237f39,'json':!![]};return rp(_0x4c4671)[_0x43f8('0xb')](function(_0x5b4e34){logger[_0x43f8('0x10')]('['+[_0x2c3fa7[_0x43f8('0x12')]()]+_0x43f8('0x37'),_0x5b4e34[_0x43f8('0xc')]);_0x32a78d[_0x43f8('0x38')]=_0x5b4e34['result']['sys_id'];_0x32a78d['ticketNumber']=_0x5b4e34[_0x43f8('0xc')][_0x43f8('0x39')];logger[_0x43f8('0x10')]('['+[_0x2c3fa7['toUpperCase']()]+']\x20getTicket\x20crm',_0x32a78d);_0x26c938(_0x32a78d);})[_0x43f8('0x1c')](function(_0x41ed74){logger[_0x43f8('0x11')]('['+[_0x2c3fa7['toUpperCase']()]+']',_0x41ed74[_0x43f8('0x13')]);_0x4c5244(_0x41ed74[_0x43f8('0x13')]);});});};}function createRemoteTag(_0x31ba46,_0x51c255,_0x1642e8,_0x44d6d8){return new Promise(function(_0x1e7cb2,_0x507a07){var _0x5db0f3={'method':_0x43f8('0x3a'),'uri':_0x1642e8+_0x43f8('0x3b')+'?'+_0x44d6d8,'body':{'short_description':_0x31ba46,'global':!![],'active':!![],'name':_0x31ba46},'auth':_0x51c255,'json':!![]};return rp(_0x5db0f3)['then'](function(_0x3dd11f){var _0x76f63b=_0x3dd11f['result'][_0x43f8('0xf')];_0x1e7cb2(_0x76f63b);});});}function getRemoteTag(_0x4a5410,_0x51d93a,_0x35813b,_0x312945,_0x5757be){return new Promise(function(_0x1af400,_0x1c64fe){var _0x1a0e0f={'method':_0x43f8('0x9'),'uri':_0x35813b+_0x43f8('0x3b')+_0x43f8('0x3c')+_0x4a5410+'&'+_0x312945,'auth':_0x51d93a,'json':!![]};return rp(_0x1a0e0f)['then'](function(_0x38c24a){if(_0x38c24a[_0x43f8('0xc')][_0x43f8('0xd')]>0x0){var _0x21be5d=_0x38c24a[_0x43f8('0xc')][0x0][_0x43f8('0xf')];_0x1af400(_0x21be5d);}else{return createRemoteTag(_0x4a5410,_0x51d93a,_0x35813b,_0x312945)[_0x43f8('0xb')](function(_0x2ed816){_0x1af400(_0x2ed816);});}});});}function assignTagToIncident(_0xd6261a,_0x2bd2c4,_0x8d76d2,_0x3fa584,_0x309139){return new Promise(function(_0x295c95,_0x14a5fd){var _0x4313da={'method':_0x43f8('0x3a'),'uri':_0x8d76d2+'label_entry'+'?'+_0x309139,'body':{'label':_0xd6261a,'table':_0x43f8('0x32'),'id_type':_0x43f8('0x3d'),'table_key':_0x3fa584[_0x43f8('0x38')],'title':_0x43f8('0x3e')+_0x3fa584[_0x43f8('0x3f')],'id_display':_0x3fa584['ticketNumber']},'auth':_0x2bd2c4,'json':!![]};return rp(_0x4313da)[_0x43f8('0xb')](function(_0x49d244){_0x295c95();})[_0x43f8('0x1c')](function(){_0x295c95();});});}function manageTags(_0x29fe30,_0x16959a,_0x277089,_0x823fb,_0xcfd92e,_0x4a1ff8,_0x53aab8){return new Promise(function(_0x1330ed,_0xf2f6da){var _0x5f284e=[];_0x16959a[_0x43f8('0x40')](function(_0x325819){_0x5f284e['push'](getRemoteTag(_0x325819,_0x277089,_0x823fb,_0x4a1ff8,_0x53aab8));});return Promise['all'](_0x5f284e)['then'](function(_0x28f4eb){if(_0x28f4eb['length']){logger[_0x43f8('0x10')]('['+[_0x29fe30[_0x43f8('0x12')]()]+_0x43f8('0x41'),_0x28f4eb);var _0x35a13a=[];_0x28f4eb[_0x43f8('0x40')](function(_0x24ac8d){_0x35a13a[_0x43f8('0x42')](assignTagToIncident(_0x24ac8d,_0x277089,_0x823fb,_0xcfd92e,_0x4a1ff8));});return Promise[_0x43f8('0x43')](_0x35a13a)['then'](function(){_0x1330ed();})[_0x43f8('0x1c')](function(){_0x1330ed();});}else{_0x1330ed();}});});}function getTags(_0x35b0b6,_0x5164b3,_0x6306ed,_0x33d999,_0x5e3030,_0x41d7ea){return function(_0x37f217){return new Promise(function(_0x3748c7,_0x260fb4){var _0x30d50c=[];var _0x280b73=_0x33d999[_0x43f8('0x44')];if(_0x280b73&&_0x280b73[_0x43f8('0xd')]>0x0){_0x30d50c=_[_0x43f8('0x45')](_0x280b73,_0x43f8('0x2f'));}if(_0x30d50c['length']>0x0){return manageTags(_0x35b0b6,_0x30d50c,_0x5164b3,_0x6306ed,_0x37f217,_0x5e3030,_0x41d7ea)['then'](function(){_0x3748c7(_0x37f217);});}else{_0x3748c7(_0x37f217);}});};}function emit(_0x23d907,_0x14bb6f,_0x29346e){var _0x14ac88=_0x43f8('0x46')+_0x43f8('0x47')+_0x43f8('0x48')+_0x43f8('0x49');var _0x272e06={'uri':_0x23d907+'/nav_to.do?uri=incident.do?sys_id%3D'+_0x29346e+_0x14ac88};io['to'](util[_0x43f8('0x4a')](_0x43f8('0x4b'),_0x14bb6f))[_0x43f8('0x4c')](_0x43f8('0x4d'),_0x272e06);}exports['cs']=function(_0x55121e,_0x4cb3,_0xcb9622,_0x49af14,_0x3c6eae,_0x164d54,_0x18fdda,_0xcb6bb2){var _0x57cc5a={};var _0x3ca036={'user':_0x164d54[_0x43f8('0x4e')],'pass':_0x164d54[_0x43f8('0x4f')]};var _0x5b8684=_0x43f8('0x50');var _0x427809=_0x43f8('0x51');_0x164d54[_0x43f8('0x52')]=intUtil[_0x43f8('0x53')](_0x164d54['remoteUri']);_0x164d54['serverUrl']=intUtil[_0x43f8('0x53')](_0x164d54[_0x43f8('0x54')]);var _0x229426=util[_0x43f8('0x4a')](_0x43f8('0x55'),_0x164d54[_0x43f8('0x52')]);_0x57cc5a[_0x43f8('0x15')]=!_[_0x43f8('0x56')](_0x49af14)?_0x49af14[_0x43f8('0x57')]:null;_0x57cc5a[_0x43f8('0x1a')]=_0x164d54[_0x43f8('0x57')];_0x57cc5a[_0x43f8('0x20')]=_0xcb6bb2['toLowerCase']()===_0x43f8('0x31')?_0x4cb3[_0x43f8('0x58')]:_0x4cb3[_0x43f8('0x59')];_0x57cc5a['callDirection']=_0xcb6bb2==='queue'||_0xcb6bb2===_0x43f8('0x5a')?_0x43f8('0x5b'):_0x43f8('0x31');var _0x456382=util[_0x43f8('0x4a')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x164d54['serverUrl'],_0x4cb3['uniqueid'],md5(_0x4cb3[_0x43f8('0x5c')]));if(_0x3c6eae&&_0x3c6eae[_0x43f8('0x5d')]){logger['info'](_0x43f8('0x5e'),_0x43f8('0x5f'));_0x4cb3[_0x43f8('0x60')]=_0x456382;}else if(_0x18fdda&&_0x18fdda['recordingFormat']&&_0x18fdda[_0x43f8('0x61')]!==_0x43f8('0x62')){logger[_0x43f8('0x10')](_0x43f8('0x63'),_0x43f8('0x5f'));_0x4cb3[_0x43f8('0x60')]=_0x456382;}else{_0x4cb3[_0x43f8('0x60')]='';}return getAdminUser(_0xcb6bb2,_0x3ca036,_0x57cc5a,_0x229426,_0x427809,_0x5b8684)[_0x43f8('0xb')](getUser(_0xcb6bb2,_0x3ca036,_0x229426,_0x427809,_0x5b8684))[_0x43f8('0xb')](getEndUser(_0xcb6bb2,_0x3ca036,_0x229426,_0x427809,_0x5b8684))[_0x43f8('0xb')](getTicket(_0xcb6bb2,_0x3ca036,_0x229426,_0xcb9622,_0x4cb3,_0x427809))[_0x43f8('0xb')](function(_0x3c30f0){logger['info'](util['format']('The\x20ticket\x20ID\x20is:\x20%s',_0x3c30f0['ticketId']));logger[_0x43f8('0x10')](util[_0x43f8('0x4a')]('call\x20direction:\x20%s',_0xcb6bb2));if(_0xcb6bb2!==_0x43f8('0x5a')){logger[_0x43f8('0x10')]('['+[_0xcb6bb2[_0x43f8('0x12')]()]+']',_0x43f8('0x64'));emit(_0x164d54['remoteUri'],_0x49af14[_0x43f8('0x2f')],_0x3c30f0[_0x43f8('0x38')]);}})[_0x43f8('0x1c')](function(_0x1e71aa){logger['error']('['+[_0xcb6bb2[_0x43f8('0x12')]()]+']\x20Error\x20running\x20ServiceNow\x20integration',util['inspect'](_0x1e71aa,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xc34a=['email','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','md5','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','localhost','socket.io-emitter','GET','then','result','length','adminId','toUpperCase','],\x20getAdminUser\x20crm','error','message','info','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20entity','active','sys_id','userId','adminEmail','],\x20getUser\x20crm','catch',']\x20using\x20admin\x20profile','POST','sys_user?','endUserNumber','true','System','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','endUserId','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','string','picklist','type','nameField','customField','toLowerCase','content','includes','idField','toString','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','assign','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number',']\x20getTicket\x20crm','label','label_entry','Incident','Incident\x20-\x20','forEach','push','all','Tags','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','trigger:browser:url','username','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','serverUrl','%s/api/now/table/','isNil'];(function(_0x47b3f3,_0x4685d6){var _0x3212a7=function(_0x1a9d90){while(--_0x1a9d90){_0x47b3f3['push'](_0x47b3f3['shift']());}};_0x3212a7(++_0x4685d6);}(_0xc34a,0x1d7));var _0xac34=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc34a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xac34('0x0'));var Promise=require(_0xac34('0x1'));var rp=require('request-promise');var util=require('util');var md5=require(_0xac34('0x2'));var Redis=require('ioredis');var intUtil=require(_0xac34('0x3'));var config=require(_0xac34('0x4'));var logger=require(_0xac34('0x5'))(_0xac34('0x6'));config[_0xac34('0x7')]=_[_0xac34('0x8')](config['redis'],{'host':_0xac34('0x9'),'port':0x18eb});var io=require(_0xac34('0xa'))(new Redis(config[_0xac34('0x7')]));function getAdminUser(_0x59d24d,_0x53a200,_0x5445fc,_0x57c339,_0x54685f,_0x19510f){return new Promise(function(_0x3c0c1c,_0x577068){var _0x457777={'method':_0xac34('0xb'),'uri':_0x57c339+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x54685f+'&'+_0x19510f,'auth':_0x53a200,'json':!![]};return rp(_0x457777)[_0xac34('0xc')](function(_0x1cdfce){if(_0x1cdfce[_0xac34('0xd')][_0xac34('0xe')]>0x0){_0x5445fc[_0xac34('0xf')]=_0x1cdfce[_0xac34('0xd')][0x0]['sys_id'];}logger['info']('['+[_0x59d24d[_0xac34('0x10')]()]+_0xac34('0x11'),_0x5445fc);_0x3c0c1c(_0x5445fc);})['catch'](function(_0x35ad68){logger[_0xac34('0x12')]('['+[_0x59d24d[_0xac34('0x10')]()]+']',_0x35ad68[_0xac34('0x13')]);_0x577068(_0x35ad68[_0xac34('0x13')]);});});}function getUser(_0x5e6ccb,_0x1f8935,_0x4fa974,_0x3d4a6d,_0x2e8883){return function(_0x13f20d){logger[_0xac34('0x14')]('['+[_0x5e6ccb[_0xac34('0x10')]()]+_0xac34('0x15'),_0x13f20d);return new Promise(function(_0x1fe7af,_0x2a3adb){if(intUtil[_0xac34('0x16')](_0x13f20d[_0xac34('0x17')])){var _0x13d265={'method':_0xac34('0xb'),'uri':_0x4fa974+_0xac34('0x18')+_0x13f20d[_0xac34('0x17')]+'&'+_0x3d4a6d+'&'+_0x2e8883,'auth':_0x1f8935,'json':!![]};logger[_0xac34('0x14')]('['+[_0x5e6ccb[_0xac34('0x10')]()]+'],\x20getUser\x20rp\x20obj',_0x13d265);return rp(_0x13d265)[_0xac34('0xc')](function(_0x3431f0){logger[_0xac34('0x14')]('['+[_0x5e6ccb[_0xac34('0x10')]()]+_0xac34('0x19'),_0x3431f0);if(_0x3431f0['result'][_0xac34('0xe')]>0x0&&String(_0x3431f0[_0xac34('0xd')][0x0][_0xac34('0x1a')])==='true'){_0x13f20d['userId']=_0x3431f0[_0xac34('0xd')][0x0][_0xac34('0x1b')];}else{_0x13f20d[_0xac34('0x1c')]=_0x13f20d[_0xac34('0xf')];_0x13f20d['userEmail']=_0x13f20d[_0xac34('0x1d')];}logger[_0xac34('0x14')]('['+[_0x5e6ccb['toUpperCase']()]+_0xac34('0x1e'),_0x13f20d);_0x1fe7af(_0x13f20d);})[_0xac34('0x1f')](function(_0xd3b499){logger['error']('['+[_0x5e6ccb[_0xac34('0x10')]()]+']',_0xd3b499['message']);_0x2a3adb(_0xd3b499['message']);});}else{logger[_0xac34('0x14')]('['+[_0x5e6ccb[_0xac34('0x10')]()]+_0xac34('0x20'));_0x13f20d['userId']=_0x13f20d[_0xac34('0xf')];_0x13f20d['userEmail']=_0x13f20d['adminEmail'];_0x1fe7af(_0x13f20d);}});};}function createEndUser(_0x278e57,_0x40830a,_0x992ac2,_0x1504b4,_0x3be201){logger['info']('['+[_0x278e57[_0xac34('0x10')]()]+'],\x20createEndUser\x20input\x20crm',_0x992ac2);return new Promise(function(_0x39d940,_0x2cfd66){var _0x90eac2={'method':_0xac34('0x21'),'uri':_0x1504b4+_0xac34('0x22')+_0x3be201,'body':{'user_name':_0x992ac2[_0xac34('0x23')],'roles':'user','first_name':_0x992ac2[_0xac34('0x23')],'active':_0xac34('0x24'),'date_format':_0xac34('0x25'),'phone':_0x992ac2[_0xac34('0x23')]},'auth':_0x40830a,'json':!![]};return rp(_0x90eac2)[_0xac34('0xc')](function(_0x1c1022){logger[_0xac34('0x14')]('['+[_0x278e57['toUpperCase']()]+'],\x20EndUser\x20schema',_0x1c1022[_0xac34('0xd')]);_0x992ac2['endUserId']=_0x1c1022[_0xac34('0xd')]['sys_id'];_0x39d940(_0x992ac2);})[_0xac34('0x1f')](function(_0x241d61){logger['error']('['+[_0x278e57['toUpperCase']()]+']',_0x241d61[_0xac34('0x13')]);_0x2cfd66(_0x241d61[_0xac34('0x13')]);});});}function getEndUser(_0x21b9a7,_0x3c6786,_0x15fa75,_0x102df2,_0x27f48d){return function(_0x3f9799){logger[_0xac34('0x14')]('['+[_0x21b9a7[_0xac34('0x10')]()]+_0xac34('0x26'),_0x3f9799);return new Promise(function(_0x1040c8,_0x5f02db){var _0x2f74a6={'method':_0xac34('0xb'),'uri':_0x15fa75+_0xac34('0x27')+_0x3f9799[_0xac34('0x23')]+'&'+_0x102df2+'&'+_0x27f48d,'auth':_0x3c6786,'json':!![]};return rp(_0x2f74a6)[_0xac34('0xc')](function(_0x340d41){if(_0x340d41[_0xac34('0xd')][_0xac34('0xe')]>0x0){_0x3f9799[_0xac34('0x28')]=_0x340d41[_0xac34('0xd')][0x0][_0xac34('0x1b')];logger[_0xac34('0x14')]('['+[_0x21b9a7[_0xac34('0x10')]()]+_0xac34('0x29'),_0x3f9799);_0x1040c8(_0x3f9799);}else{return createEndUser(_0x21b9a7,_0x3c6786,_0x3f9799,_0x15fa75,_0x102df2)['then'](function(_0x5ec80e){logger[_0xac34('0x14')]('['+[_0x21b9a7['toUpperCase']()]+_0xac34('0x2a'),_0x5ec80e);_0x1040c8(_0x5ec80e);});}})['catch'](function(_0x172f62){logger[_0xac34('0x12')]('['+[_0x21b9a7['toUpperCase']()]+']',_0x172f62[_0xac34('0x13')]);_0x5f02db(_0x172f62[_0xac34('0x13')]);});});};}function getCustomFields(_0x49a04c,_0x5870a2){var _0x77a63c={};if(_0x49a04c[_0xac34('0xe')]>0x0){_['forEach'](_0x49a04c,function(_0x591ce6){if(_['includes']([_0xac34('0x2b'),_0xac34('0x2c')],_0x591ce6[_0xac34('0x2d')])&&_0x591ce6[_0xac34('0x2e')]&&!_0x591ce6[_0xac34('0x2f')]){_0x77a63c[_0x591ce6[_0xac34('0x2e')][_0xac34('0x30')]()]=_0x591ce6[_0xac34('0x31')]['toString']();}else if(_[_0xac34('0x32')]([_0xac34('0x2b'),_0xac34('0x2c')],_0x591ce6['type'])&&_0x591ce6[_0xac34('0x33')]&&_0x591ce6[_0xac34('0x2f')]){_0x77a63c[_0x591ce6[_0xac34('0x33')][_0xac34('0x30')]()]=_0x591ce6[_0xac34('0x31')][_0xac34('0x34')]();}else if(_0x591ce6[_0xac34('0x2d')]==='variable'&&_0x591ce6[_0xac34('0x35')]&&_0x591ce6[_0xac34('0x33')]&&_0x591ce6['customField']){_0x77a63c[_0x591ce6[_0xac34('0x33')][_0xac34('0x30')]()]=_0x5870a2[_0x591ce6['variableName']][_0xac34('0x34')]();}else if(_0x591ce6[_0xac34('0x2d')]===_0xac34('0x36')&&_0x591ce6['Variable']&&_0x591ce6[_0xac34('0x37')][_0xac34('0x38')]&&_0x591ce6[_0xac34('0x33')]&&_0x591ce6[_0xac34('0x2f')]){_0x77a63c[_0x591ce6['idField'][_0xac34('0x30')]()]=_0x5870a2[_0x591ce6[_0xac34('0x37')][_0xac34('0x38')]['toLowerCase']()][_0xac34('0x34')]();}});}return _0x77a63c;}function getTicket(_0x230086,_0x3f3fab,_0x29d963,_0x5d5508,_0x2d502d,_0x2c37ca){return function(_0x556adb){logger['info']('['+[_0x230086[_0xac34('0x10')]()]+_0xac34('0x39'),_0x556adb);return new Promise(function(_0x13bc35,_0x16fa4d){var _0x4e2164=_0x230086[_0xac34('0x30')]()===_0xac34('0x3a')?_0x556adb[_0xac34('0x1c')]:_0x556adb[_0xac34('0x28')];var _0x25c778={'method':'POST','uri':_0x29d963+_0xac34('0x3b')+'?'+_0x2c37ca,'body':Object[_0xac34('0x3c')]({},{'active':_0xac34('0x24'),'caller_id':_0x4e2164,'assigned_to':_0x556adb[_0xac34('0x1c')],'short_description':intUtil[_0xac34('0x3d')](_0x5d5508[_0xac34('0x3e')],_0x2d502d,'\x20'),'description':intUtil['getString'](_0x5d5508[_0xac34('0x3f')],_0x2d502d,'\x0a')},getCustomFields(_0x5d5508[_0xac34('0x40')],_0x2d502d)),'auth':_0x3f3fab,'json':!![]};return rp(_0x25c778)[_0xac34('0xc')](function(_0x396bc7){logger[_0xac34('0x14')]('['+[_0x230086[_0xac34('0x10')]()]+_0xac34('0x41'),_0x396bc7[_0xac34('0xd')]);_0x556adb[_0xac34('0x42')]=_0x396bc7['result'][_0xac34('0x1b')];_0x556adb[_0xac34('0x43')]=_0x396bc7[_0xac34('0xd')][_0xac34('0x44')];logger[_0xac34('0x14')]('['+[_0x230086[_0xac34('0x10')]()]+_0xac34('0x45'),_0x556adb);_0x13bc35(_0x556adb);})['catch'](function(_0x266b79){logger[_0xac34('0x12')]('['+[_0x230086[_0xac34('0x10')]()]+']',_0x266b79['message']);_0x16fa4d(_0x266b79[_0xac34('0x13')]);});});};}function createRemoteTag(_0x1eeabd,_0x45b23d,_0x1c9b16,_0x9c6bf6){return new Promise(function(_0x474778,_0x3253b1){var _0x246e8e={'method':'POST','uri':_0x1c9b16+_0xac34('0x46')+'?'+_0x9c6bf6,'body':{'short_description':_0x1eeabd,'global':!![],'active':!![],'name':_0x1eeabd},'auth':_0x45b23d,'json':!![]};return rp(_0x246e8e)[_0xac34('0xc')](function(_0x47d901){var _0x139790=_0x47d901[_0xac34('0xd')]['sys_id'];_0x474778(_0x139790);});});}function getRemoteTag(_0x2ca0e5,_0x4512dc,_0x374010,_0x1b32c4,_0x8115e1){return new Promise(function(_0x1ba299,_0x5e4947){var _0x28bef1={'method':_0xac34('0xb'),'uri':_0x374010+_0xac34('0x46')+'?sysparm_query=name%3D'+_0x2ca0e5+'&'+_0x1b32c4,'auth':_0x4512dc,'json':!![]};return rp(_0x28bef1)['then'](function(_0x3b2eb1){if(_0x3b2eb1[_0xac34('0xd')][_0xac34('0xe')]>0x0){var _0x55dbcf=_0x3b2eb1[_0xac34('0xd')][0x0]['sys_id'];_0x1ba299(_0x55dbcf);}else{return createRemoteTag(_0x2ca0e5,_0x4512dc,_0x374010,_0x1b32c4)[_0xac34('0xc')](function(_0x2c2c9b){_0x1ba299(_0x2c2c9b);});}});});}function assignTagToIncident(_0x30e5f7,_0x2925fd,_0x8bb7b0,_0x155b91,_0x3bacdc){return new Promise(function(_0x4a1232,_0x183c26){var _0x42534e={'method':'POST','uri':_0x8bb7b0+_0xac34('0x47')+'?'+_0x3bacdc,'body':{'label':_0x30e5f7,'table':_0xac34('0x3b'),'id_type':_0xac34('0x48'),'table_key':_0x155b91[_0xac34('0x42')],'title':_0xac34('0x49')+_0x155b91['ticketNumber'],'id_display':_0x155b91[_0xac34('0x43')]},'auth':_0x2925fd,'json':!![]};return rp(_0x42534e)['then'](function(_0x42298c){_0x4a1232();})[_0xac34('0x1f')](function(){_0x4a1232();});});}function manageTags(_0x444d68,_0x5e0eb3,_0x130438,_0x1ec1e1,_0x2bf9fb,_0x2741f4,_0x459d4e){return new Promise(function(_0x49b6a3,_0x1f35f5){var _0x43eda0=[];_0x5e0eb3[_0xac34('0x4a')](function(_0x2a5462){_0x43eda0[_0xac34('0x4b')](getRemoteTag(_0x2a5462,_0x130438,_0x1ec1e1,_0x2741f4,_0x459d4e));});return Promise[_0xac34('0x4c')](_0x43eda0)['then'](function(_0x47d025){if(_0x47d025[_0xac34('0xe')]){logger[_0xac34('0x14')]('['+[_0x444d68['toUpperCase']()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x47d025);var _0x50cf5e=[];_0x47d025['forEach'](function(_0x39afe4){_0x50cf5e['push'](assignTagToIncident(_0x39afe4,_0x130438,_0x1ec1e1,_0x2bf9fb,_0x2741f4));});return Promise[_0xac34('0x4c')](_0x50cf5e)[_0xac34('0xc')](function(){_0x49b6a3();})['catch'](function(){_0x49b6a3();});}else{_0x49b6a3();}});});}function getTags(_0x3b4a1d,_0x73c177,_0x166dbc,_0x291817,_0x11d2fd,_0x1affd6){return function(_0x55eed7){return new Promise(function(_0x512c70,_0x46a969){var _0x2ad76b=[];var _0x3db48e=_0x291817[_0xac34('0x4d')];if(_0x3db48e&&_0x3db48e[_0xac34('0xe')]>0x0){_0x2ad76b=_['map'](_0x3db48e,_0xac34('0x38'));}if(_0x2ad76b['length']>0x0){return manageTags(_0x3b4a1d,_0x2ad76b,_0x73c177,_0x166dbc,_0x55eed7,_0x11d2fd,_0x1affd6)[_0xac34('0xc')](function(){_0x512c70(_0x55eed7);});}else{_0x512c70(_0x55eed7);}});};}function emit(_0x37fdda,_0x3fa375,_0x3638cd){var _0x2b191f=_0xac34('0x4e')+_0xac34('0x4f')+_0xac34('0x50')+_0xac34('0x51');var _0x1469be={'uri':_0x37fdda+_0xac34('0x52')+_0x3638cd+_0x2b191f};io['to'](util[_0xac34('0x53')](_0xac34('0x54'),_0x3fa375))['emit'](_0xac34('0x55'),_0x1469be);}exports['cs']=function(_0x2fabc7,_0x26efb1,_0x494999,_0x8d2ffd,_0x2a87d8,_0x491f60,_0x38f3e8,_0x468dd2){var _0x540478={};var _0x96a949={'user':_0x491f60[_0xac34('0x56')],'pass':_0x491f60[_0xac34('0x57')]};var _0x50c34a=_0xac34('0x58');var _0x30f2a9=_0xac34('0x59');_0x491f60[_0xac34('0x5a')]=intUtil['stripTrailingSlash'](_0x491f60[_0xac34('0x5a')]);_0x491f60['serverUrl']=intUtil['stripTrailingSlash'](_0x491f60[_0xac34('0x5b')]);var _0x4fdd72=util['format'](_0xac34('0x5c'),_0x491f60[_0xac34('0x5a')]);_0x540478[_0xac34('0x17')]=!_[_0xac34('0x5d')](_0x8d2ffd)?_0x8d2ffd[_0xac34('0x5e')]:null;_0x540478[_0xac34('0x1d')]=_0x491f60[_0xac34('0x5e')];_0x540478[_0xac34('0x23')]=_0x468dd2[_0xac34('0x30')]()===_0xac34('0x3a')?_0x26efb1[_0xac34('0x5f')]:_0x26efb1[_0xac34('0x60')];_0x540478[_0xac34('0x61')]=_0x468dd2===_0xac34('0x62')||_0x468dd2===_0xac34('0x63')?'queue':_0xac34('0x3a');var _0x3f4661=util[_0xac34('0x53')](_0xac34('0x64'),_0x491f60[_0xac34('0x5b')],_0x26efb1['uniqueid'],md5(_0x26efb1[_0xac34('0x65')]));if(_0x2a87d8&&_0x2a87d8[_0xac34('0x66')]){logger[_0xac34('0x14')]('[QUEUE]',_0xac34('0x67'));_0x26efb1[_0xac34('0x68')]=_0x3f4661;}else if(_0x38f3e8&&_0x38f3e8[_0xac34('0x69')]&&_0x38f3e8[_0xac34('0x69')]!==_0xac34('0x6a')){logger['info'](_0xac34('0x6b'),_0xac34('0x67'));_0x26efb1[_0xac34('0x68')]=_0x3f4661;}else{_0x26efb1[_0xac34('0x68')]='';}return getAdminUser(_0x468dd2,_0x96a949,_0x540478,_0x4fdd72,_0x30f2a9,_0x50c34a)['then'](getUser(_0x468dd2,_0x96a949,_0x4fdd72,_0x30f2a9,_0x50c34a))[_0xac34('0xc')](getEndUser(_0x468dd2,_0x96a949,_0x4fdd72,_0x30f2a9,_0x50c34a))[_0xac34('0xc')](getTicket(_0x468dd2,_0x96a949,_0x4fdd72,_0x494999,_0x26efb1,_0x30f2a9))[_0xac34('0xc')](function(_0x41bcde){logger[_0xac34('0x14')](util['format'](_0xac34('0x6c'),_0x41bcde['ticketId']));logger['info'](util[_0xac34('0x53')](_0xac34('0x6d'),_0x468dd2));if(_0x468dd2!==_0xac34('0x63')){logger[_0xac34('0x14')]('['+[_0x468dd2[_0xac34('0x10')]()]+']',_0xac34('0x6e'));emit(_0x491f60['remoteUri'],_0x8d2ffd[_0xac34('0x38')],_0x41bcde['ticketId']);}})[_0xac34('0x1f')](function(_0x55d67b){logger[_0xac34('0x12')]('['+[_0x468dd2[_0xac34('0x10')]()]+_0xac34('0x6f'),util[_0xac34('0x70')](_0x55d67b,{'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 29aa323..0ae0e7a 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 _0xddb4=['users','contacts','charAt','user:%s','unmanaged','lastevent','lodash','request-promise','md5','util','../../../../config/environment','sugarcrm','redis','socket.io-emitter','info','name','getString','Subjects','assigned_user_id','created_by','description','date_start','toISOString','slice','replace','duration_minutes','parent_type','Contacts','length','forEach','variableName','push','idField','JSON','stringify','format','Basic\x20%s','apiKey','toString','base64','get_server_info','isNil','Getting\x20agent\x20with\x20name','get_entry_list','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','then','entry_list','name_value_list','user_name','value','Agent\x20found!','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','user_id','Searching\x20enduser\x20with\x20phone','find','Enduser\x20found!','phone_home','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','set_entry','first_name','','Enduser\x20created.','debug','[HTTP]','merge','type','string','nameField','customField','content','custom_fields','customVariable','Variable','toLowerCase','POST','login','username','password','PLAIN','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','Calls','queue','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','recordingURL','uniqueid','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','version','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','catch','error','outbound','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','The\x20User\x20ID\x20is:','destcalleridnum'];(function(_0x5e33ab,_0x5bc6d5){var _0x4a6d18=function(_0x254cbf){while(--_0x254cbf){_0x5e33ab['push'](_0x5e33ab['shift']());}};_0x4a6d18(++_0x5bc6d5);}(_0xddb4,0x162));var _0x4ddb=function(_0x2384f6,_0x167775){_0x2384f6=_0x2384f6-0x0;var _0x370294=_0xddb4[_0x2384f6];return _0x370294;};'use strict';var _=require(_0x4ddb('0x0'));var rp=require(_0x4ddb('0x1'));var BPromise=require('bluebird');var md5=require(_0x4ddb('0x2'));var util=require(_0x4ddb('0x3'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0x4ddb('0x4'));var logger=require('../../../../config/logger')(_0x4ddb('0x5'));config[_0x4ddb('0x6')]=_['defaults'](config[_0x4ddb('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x4ddb('0x7'))(new Redis(config[_0x4ddb('0x6')]));var def={'method':'POST','json':!![]};function emit(_0x38f61e,_0x9e853f,_0x75c744){io['to'](_0x38f61e)['emit'](_0x9e853f,_0x75c744);}function getTicket(_0x4c1c0c,_0x40bdea,_0x331e42,_0x144350,_0xf5da7a,_0x2db48e,_0x449349,_0x3fa3ae){logger[_0x4ddb('0x8')]('Creating\x20new\x20ticket...');var _0x5af039=new Date();var _0x416c30=[{'name':_0x4ddb('0x9'),'value':intUtil[_0x4ddb('0xa')](_0x144350[_0x4ddb('0xb')],_0xf5da7a,'\x20')},{'name':_0x4ddb('0xc'),'value':_0x40bdea['id']},{'name':_0x4ddb('0xd'),'value':_0x40bdea['id']},{'name':_0x4ddb('0xe'),'value':intUtil[_0x4ddb('0xa')](_0x144350['Descriptions'],_0xf5da7a,'\x0a')},{'name':_0x4ddb('0xf'),'value':_0x5af039[_0x4ddb('0x10')]()[_0x4ddb('0x11')](0x0,0x13)[_0x4ddb('0x12')]('T','\x20')},{'name':'duration_hours','value':'0'},{'name':_0x4ddb('0x13'),'value':'15'},{'name':'parent_id','value':_0x331e42['id']},{'name':_0x4ddb('0x14'),'value':_0x4ddb('0x15')},{'name':'parent_name','value':_0x331e42[_0x4ddb('0x9')]},{'name':'direction','value':_0x3fa3ae}];if(_0x2db48e[_0x4ddb('0x16')]){_[_0x4ddb('0x17')](_0x2db48e,function(_0x1a6487){if(_0xf5da7a[_0x1a6487[_0x4ddb('0x18')]]){_0x416c30[_0x4ddb('0x19')]({'name':_0x1a6487[_0x4ddb('0x1a')],'value':_0xf5da7a[_0x1a6487[_0x4ddb('0x18')]]});}});}return request({'form':{'method':'set_entry','input_type':_0x4ddb('0x1b'),'response_type':_0x4ddb('0x1b'),'rest_data':JSON[_0x4ddb('0x1c')]({'session':_0x449349['id'],'module_name':'Calls','name_value_list':_0x416c30})}});}function getAuth(_0x295dfa){return util[_0x4ddb('0x1d')](_0x4ddb('0x1e'),new Buffer(_0x295dfa[_0x4ddb('0x1f')]+':X')[_0x4ddb('0x20')](_0x4ddb('0x21')));}function getServerInfo(_0xfc390b){return request({'form':{'method':_0x4ddb('0x22'),'input_type':_0x4ddb('0x1b'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0xfc390b['id']})}});}function getUser(_0x404507,_0x48b311,_0x12026f){if(!_[_0x4ddb('0x23')](_0x48b311)){logger['info'](_0x4ddb('0x24'),_0x48b311);return request({'form':{'method':_0x4ddb('0x25'),'input_type':_0x4ddb('0x1b'),'response_type':_0x4ddb('0x1b'),'rest_data':JSON[_0x4ddb('0x1c')]({'session':_0x12026f['id'],'module_name':'Employees','query':util[_0x4ddb('0x1d')](_0x4ddb('0x26'),_0x48b311),'order_by':'','offset':'0','select_fields':['id',_0x4ddb('0x9'),'user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x4ddb('0x27')](function(_0x185987){if(_0x185987[_0x4ddb('0x28')]['length']){var _0x56bd75=_['find'](_0x185987[_0x4ddb('0x28')],function(_0x4aafcf){return _0x4aafcf[_0x4ddb('0x29')][_0x4ddb('0x2a')][_0x4ddb('0x2b')]===_0x48b311;});if(_0x56bd75){logger[_0x4ddb('0x8')](_0x4ddb('0x2c'));return BPromise[_0x4ddb('0x2d')]({'id':_0x56bd75[_0x4ddb('0x29')]['id'][_0x4ddb('0x2b')],'name':_0x56bd75[_0x4ddb('0x29')][_0x4ddb('0x9')][_0x4ddb('0x2b')]});}}logger['info'](_0x4ddb('0x2e'));return BPromise['resolve']({'id':_0x12026f[_0x4ddb('0x29')]['user_id'][_0x4ddb('0x2b')],'name':_0x12026f['name_value_list'][_0x4ddb('0x2a')]['value']});});}else{logger[_0x4ddb('0x8')](_0x4ddb('0x2f'));return BPromise[_0x4ddb('0x2d')]({'id':_0x12026f[_0x4ddb('0x29')][_0x4ddb('0x30')][_0x4ddb('0x2b')],'name':_0x12026f[_0x4ddb('0x29')][_0x4ddb('0x2a')][_0x4ddb('0x2b')]});}}function getEndUser(_0x58bcfc,_0x52ffd7,_0x116b04,_0x5be927){logger[_0x4ddb('0x8')](_0x4ddb('0x31'),_0x116b04);return request({'form':{'method':_0x4ddb('0x25'),'input_type':'JSON','response_type':_0x4ddb('0x1b'),'rest_data':JSON[_0x4ddb('0x1c')]({'session':_0x5be927['id'],'module_name':_0x4ddb('0x15'),'query':util[_0x4ddb('0x1d')]('contacts.phone_home\x20=\x20\x22%s\x22',_0x116b04),'order_by':'','offset':'0','select_fields':['id',_0x4ddb('0x9'),'phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x4ddb('0x27')](function(_0x30c6b){if(_0x30c6b[_0x4ddb('0x28')][_0x4ddb('0x16')]){var _0x154156=_[_0x4ddb('0x32')](_0x30c6b['entry_list'],function(_0x5a85fe){return _0x5a85fe[_0x4ddb('0x29')]['phone_home'][_0x4ddb('0x2b')]===_0x116b04;});if(_0x154156){logger[_0x4ddb('0x8')](_0x4ddb('0x33'));return BPromise['resolve']({'id':_0x154156[_0x4ddb('0x29')]['id'][_0x4ddb('0x2b')],'name':_0x154156[_0x4ddb('0x29')]['name'][_0x4ddb('0x2b')],'phone':_0x154156[_0x4ddb('0x29')][_0x4ddb('0x34')][_0x4ddb('0x2b')]});}}else{logger[_0x4ddb('0x8')](_0x4ddb('0x35'));return request({'form':{'method':_0x4ddb('0x36'),'input_type':'JSON','response_type':_0x4ddb('0x1b'),'rest_data':JSON[_0x4ddb('0x1c')]({'session':_0x5be927['id'],'module_name':_0x4ddb('0x15'),'name_value_list':[{'name':_0x4ddb('0x37'),'value':_0x52ffd7!==_0x4ddb('0x38')?_0x52ffd7:util[_0x4ddb('0x1d')]('Caller\x20-\x20%s',_0x116b04)},{'name':_0x4ddb('0x34'),'value':_0x116b04}]})}})[_0x4ddb('0x27')](function(_0x370a08){logger[_0x4ddb('0x8')](_0x4ddb('0x39'));return BPromise[_0x4ddb('0x2d')]({'id':_0x370a08['id'],'name':_0x370a08[_0x4ddb('0x28')][_0x4ddb('0x37')]['value'],'phone':_0x370a08['entry_list']['phone_home'][_0x4ddb('0x2b')]});});}});}function request(_0x463dd4){logger[_0x4ddb('0x3a')](_0x4ddb('0x3b'),JSON[_0x4ddb('0x1c')](_0x463dd4));return rp(_[_0x4ddb('0x3c')](def,_0x463dd4));}function getTags(_0x4201ce,_0x1bc6c0){var _0x4293de=[];if(_0x4201ce&&_0x4201ce[_0x4ddb('0x16')]>0x0){_0x4293de=_['map'](_0x4201ce,_0x1bc6c0);}return _0x4293de;}function getCustomFields(_0x3b8d6e,_0x48d903){var _0x10d81e=[];var _0x51b871={'custom_fields':[]};if(_0x3b8d6e['length']>0x0){_[_0x4ddb('0x17')](_0x3b8d6e,function(_0x340c49){if(_0x340c49[_0x4ddb('0x3d')]===_0x4ddb('0x3e')&&_0x340c49[_0x4ddb('0x3f')]&&!_0x340c49[_0x4ddb('0x40')]){_0x51b871[_0x340c49[_0x4ddb('0x3f')]['toLowerCase']()]=_0x340c49[_0x4ddb('0x41')]['toString']();}else if(_0x340c49['type']===_0x4ddb('0x3e')&&_0x340c49['idField']&&_0x340c49[_0x4ddb('0x40')]){_0x51b871[_0x4ddb('0x42')][_0x4ddb('0x19')]({'id':_0x340c49[_0x4ddb('0x1a')],'value':_0x340c49['content'][_0x4ddb('0x20')]()});}else if(_0x340c49[_0x4ddb('0x3d')]==='variable'&&_0x340c49[_0x4ddb('0x18')]&&_0x340c49['idField']&&_0x340c49[_0x4ddb('0x40')]){_0x48d903[_0x340c49[_0x4ddb('0x18')]]&&_0x51b871[_0x4ddb('0x42')]['push']({'id':_0x340c49[_0x4ddb('0x1a')],'value':_0x48d903[_0x340c49[_0x4ddb('0x18')]][_0x4ddb('0x20')]()});}else if(_0x340c49[_0x4ddb('0x3d')]===_0x4ddb('0x43')&&_0x340c49['Variable']&&_0x340c49['Variable'][_0x4ddb('0x9')]&&_0x340c49['idField']&&_0x340c49['customField']){_0x48d903[_0x340c49[_0x4ddb('0x44')][_0x4ddb('0x9')]['toLowerCase']()]&&_0x51b871[_0x4ddb('0x42')][_0x4ddb('0x19')]({'id':_0x340c49[_0x4ddb('0x1a')],'value':_0x48d903[_0x340c49[_0x4ddb('0x44')][_0x4ddb('0x9')][_0x4ddb('0x45')]()][_0x4ddb('0x20')]()});}});}return _0x51b871;}function getConnection(_0x22c896){return request({'method':_0x4ddb('0x46'),'form':{'method':_0x4ddb('0x47'),'input_type':_0x4ddb('0x1b'),'response_type':_0x4ddb('0x1b'),'rest_data':JSON[_0x4ddb('0x1c')]({'user_auth':{'user_name':_0x22c896[_0x4ddb('0x48')],'password':_0x22c896[_0x4ddb('0x49')],'encryption':_0x4ddb('0x4a')},'application':'xCALLY\x20Motion\x20integration'})}})[_0x4ddb('0x27')](function(_0x48cf4e){var _0x892ec7=_0x48cf4e;if(_0x892ec7['id']){def[_0x4ddb('0x4b')]=_0x892ec7['id'];return BPromise[_0x4ddb('0x2d')](_0x892ec7);}else{throw new Error(util[_0x4ddb('0x1d')](_0x4ddb('0x4c'),_0x22c896['id']));}});}function setRelationship(_0x13817c,_0x4ea35c,_0x51c01f,_0x29394e){return request({'form':{'method':_0x4ddb('0x4d'),'input_type':_0x4ddb('0x1b'),'response_type':_0x4ddb('0x1b'),'rest_data':JSON[_0x4ddb('0x1c')]({'session':_0x13817c['id'],'module_name':_0x4ddb('0x4e'),'module_id':_0x51c01f['id'],'link_field_name':_0x29394e,'related_ids':[_0x4ea35c['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x4ddb('0x4f')]=function(_0x175508,_0x6995d6,_0x10ad37,_0x1bed5c,_0x219328,_0x2a76cb){var _0xad8318,_0x4b3997,_0x7553b1,_0x3fe16e;_0x2a76cb[_0x4ddb('0x50')]=intUtil[_0x4ddb('0x51')](_0x2a76cb[_0x4ddb('0x50')]);_0x2a76cb[_0x4ddb('0x52')]=intUtil[_0x4ddb('0x51')](_0x2a76cb['serverUrl']);def[_0x4ddb('0x53')]=util[_0x4ddb('0x1d')](_0x4ddb('0x54'),_0x2a76cb[_0x4ddb('0x50')]);if(_0x219328&&_0x219328[_0x4ddb('0x55')]){logger[_0x4ddb('0x8')](_0x4ddb('0x56'),'Recording\x20is\x20enabled!');_0x6995d6[_0x4ddb('0x57')]=util[_0x4ddb('0x1d')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2a76cb[_0x4ddb('0x52')],_0x6995d6[_0x4ddb('0x58')],md5(_0x6995d6[_0x4ddb('0x58')]));}else{_0x6995d6[_0x4ddb('0x57')]='';}return getConnection(_0x2a76cb)[_0x4ddb('0x27')](function(_0x56f7f0){_0x3fe16e=_0x56f7f0;return getUser(_0x2a76cb,_0x1bed5c[_0x4ddb('0x9')],_0x3fe16e);})['then'](function(_0x1fa943){_0xad8318=_0x1fa943;logger[_0x4ddb('0x8')]('The\x20User\x20ID\x20is:',_0xad8318['id']);return getEndUser(_0x2a76cb,_0x6995d6[_0x4ddb('0x59')],_0x6995d6[_0x4ddb('0x5a')],_0x3fe16e);})[_0x4ddb('0x27')](function(_0x3e58c9){_0x4b3997=_0x3e58c9;logger[_0x4ddb('0x8')](_0x4ddb('0x5b'),_0x4b3997['id']);return getTicket(_0x2a76cb,_0xad8318,_0x4b3997,_0x10ad37,_0x6995d6,_0x10ad37[_0x4ddb('0x5c')],_0x3fe16e,_0x4ddb('0x5d'));})['then'](function(_0x2072d7){_0x7553b1=_0x2072d7;logger[_0x4ddb('0x8')](_0x4ddb('0x5e'));logger[_0x4ddb('0x8')](_0x4ddb('0x5f'),_0x7553b1['id']);return setRelationship(_0x3fe16e,_0xad8318,_0x7553b1,'users');})[_0x4ddb('0x27')](function(){return setRelationship(_0x3fe16e,_0x4b3997,_0x7553b1,'contacts');})['then'](function(){return getServerInfo(_0x3fe16e);})[_0x4ddb('0x27')](function(_0x3c8f39){var _0x59f834=parseInt(_0x3c8f39[_0x4ddb('0x60')]['charAt'](0x0));var _0x790420=util['format'](_0x4ddb('0x61'),_0x2a76cb['remoteUri'],_0x7553b1['id']);if(_0x59f834>0x6){_0x790420=util[_0x4ddb('0x1d')](_0x4ddb('0x62'),_0x2a76cb['remoteUri'],_0x7553b1['id']);}logger[_0x4ddb('0x8')]('[QUEUE]',_0x4ddb('0x63'));emit(util[_0x4ddb('0x1d')]('user:%s',_0x1bed5c[_0x4ddb('0x9')]),_0x4ddb('0x64'),{'uri':_0x790420});})[_0x4ddb('0x65')](function(_0x522fa7){logger[_0x4ddb('0x66')](_0x4ddb('0x56'),JSON[_0x4ddb('0x1c')](_0x522fa7));});};exports[_0x4ddb('0x67')]=function(_0x159e8e,_0x1e7085,_0x208a86,_0x1e73f1,_0x4dd4dd,_0x582459,_0xf0832d){var _0x28260a,_0x3fb3d5,_0x1e4aa4,_0x1cfd64;_0x582459[_0x4ddb('0x50')]=intUtil['stripTrailingSlash'](_0x582459[_0x4ddb('0x50')]);_0x582459[_0x4ddb('0x52')]=intUtil['stripTrailingSlash'](_0x582459['serverUrl']);def[_0x4ddb('0x53')]=util['format'](_0x4ddb('0x54'),_0x582459[_0x4ddb('0x50')]);if(_0xf0832d&&_0xf0832d[_0x4ddb('0x68')]&&_0xf0832d[_0x4ddb('0x68')]!=='none'){logger['info'](_0x4ddb('0x69'),_0x4ddb('0x6a'));_0x1e7085[_0x4ddb('0x57')]=util[_0x4ddb('0x1d')](_0x4ddb('0x6b'),_0x582459[_0x4ddb('0x52')],_0x1e7085[_0x4ddb('0x58')],md5(_0x1e7085[_0x4ddb('0x58')]));}return getConnection(_0x582459)[_0x4ddb('0x27')](function(_0x46dd62){_0x1cfd64=_0x46dd62;return getUser(_0x582459,_0x1e73f1['name'],_0x1cfd64);})['then'](function(_0x2d875a){_0x28260a=_0x2d875a;logger[_0x4ddb('0x8')](_0x4ddb('0x6c'),_0x28260a['id']);return getEndUser(_0x582459,_0x1e7085['destcalleridname'],_0x1e7085[_0x4ddb('0x6d')],_0x1cfd64);})[_0x4ddb('0x27')](function(_0x4e239f){_0x3fb3d5=_0x4e239f;logger[_0x4ddb('0x8')](_0x4ddb('0x5b'),_0x3fb3d5['id']);return getTicket(_0x582459,_0x28260a,_0x3fb3d5,_0x208a86,_0x1e7085,_0x208a86[_0x4ddb('0x5c')],_0x1cfd64,'Outbound');})[_0x4ddb('0x27')](function(_0x10c17c){_0x1e4aa4=_0x10c17c;logger['info'](_0x4ddb('0x5e'));logger[_0x4ddb('0x8')](_0x4ddb('0x5f'),_0x1e4aa4['id']);return setRelationship(_0x1cfd64,_0x28260a,_0x1e4aa4,_0x4ddb('0x6e'));})[_0x4ddb('0x27')](function(){return setRelationship(_0x1cfd64,_0x3fb3d5,_0x1e4aa4,_0x4ddb('0x6f'));})[_0x4ddb('0x27')](function(){return getServerInfo(_0x1cfd64);})[_0x4ddb('0x27')](function(_0x5636ea){var _0x492122=parseInt(_0x5636ea[_0x4ddb('0x60')][_0x4ddb('0x70')](0x0));var _0x4ba0e5=util[_0x4ddb('0x1d')](_0x4ddb('0x61'),_0x582459[_0x4ddb('0x50')],_0x1e4aa4['id']);if(_0x492122>0x6){_0x4ba0e5=util[_0x4ddb('0x1d')](_0x4ddb('0x62'),_0x582459[_0x4ddb('0x50')],_0x1e4aa4['id']);}logger[_0x4ddb('0x8')](_0x4ddb('0x69'),_0x4ddb('0x63'));emit(util[_0x4ddb('0x1d')](_0x4ddb('0x71'),_0x1e73f1[_0x4ddb('0x9')]),_0x4ddb('0x64'),{'uri':_0x4ba0e5});})[_0x4ddb('0x65')](function(_0x50b45d){logger[_0x4ddb('0x66')](_0x4ddb('0x69'),JSON['stringify'](_0x50b45d));});};exports[_0x4ddb('0x72')]=function(_0x2b2829,_0x6192,_0x2d265f,_0x111553,_0x56e40d,_0x58178c){var _0x2a77dc,_0x48bd50,_0x32fc1d,_0x24aaf5;_0x58178c[_0x4ddb('0x50')]=intUtil[_0x4ddb('0x51')](_0x58178c['remoteUri']);_0x58178c[_0x4ddb('0x52')]=intUtil[_0x4ddb('0x51')](_0x58178c['serverUrl']);def['uri']=util[_0x4ddb('0x1d')](_0x4ddb('0x54'),_0x58178c[_0x4ddb('0x50')]);if(_0x56e40d&&_0x56e40d[_0x4ddb('0x55')]){logger['info']('['+_0x6192[_0x4ddb('0x73')]['toUpperCase']()+']',_0x4ddb('0x6a'));_0x6192[_0x4ddb('0x57')]=util[_0x4ddb('0x1d')](_0x4ddb('0x6b'),_0x58178c[_0x4ddb('0x52')],_0x6192[_0x4ddb('0x58')],md5(_0x6192[_0x4ddb('0x58')]));}else{_0x6192['recordingURL']='';}return getConnection(_0x58178c)[_0x4ddb('0x27')](function(_0x488795){_0x24aaf5=_0x488795;if(!_['isNil'](_0x111553)){return getUser(_0x58178c,_0x111553[_0x4ddb('0x9')],_0x24aaf5);}else{return getUser(_0x58178c,null,_0x24aaf5);}})[_0x4ddb('0x27')](function(_0x3f7863){_0x2a77dc=_0x3f7863;logger[_0x4ddb('0x8')](_0x4ddb('0x6c'),_0x2a77dc['id']);return getEndUser(_0x58178c,_0x6192[_0x4ddb('0x59')],_0x6192[_0x4ddb('0x5a')],_0x24aaf5);})['then'](function(_0x10a5d2){_0x48bd50=_0x10a5d2;logger[_0x4ddb('0x8')](_0x4ddb('0x5b'),_0x48bd50['id']);return getTicket(_0x58178c,_0x2a77dc,_0x48bd50,_0x2d265f,_0x6192,_0x2d265f[_0x4ddb('0x5c')],_0x24aaf5,'Inbound');})[_0x4ddb('0x27')](function(_0x24aaea){_0x32fc1d=_0x24aaea;logger[_0x4ddb('0x8')](_0x4ddb('0x5e'));logger[_0x4ddb('0x8')](_0x4ddb('0x5f'),_0x32fc1d['id']);return setRelationship(_0x24aaf5,_0x2a77dc,_0x32fc1d,_0x4ddb('0x6e'));})[_0x4ddb('0x27')](function(){return setRelationship(_0x24aaf5,_0x48bd50,_0x32fc1d,_0x4ddb('0x6f'));})[_0x4ddb('0x27')](function(){return getServerInfo(_0x24aaf5);})[_0x4ddb('0x65')](function(_0x434fd7){logger[_0x4ddb('0x66')]('['+_0x6192[_0x4ddb('0x73')]['toUpperCase']()+']',JSON[_0x4ddb('0x1c')](_0x434fd7));});}; \ No newline at end of file +var _0x4496=['calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','outbound','uri','recordingFormat','none','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','[OUTBOUND]','unmanaged','lastevent','toUpperCase','request-promise','bluebird','md5','util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','emit','Creating\x20new\x20ticket...','name','created_by','description','getString','Descriptions','toISOString','slice','replace','duration_hours','duration_minutes','parent_id','Contacts','direction','length','forEach','variableName','push','idField','set_entry','JSON','stringify','Calls','toString','isNil','info','Getting\x20agent\x20with\x20name','Employees','format','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','find','name_value_list','value','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','get_entry_list','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Caller\x20-\x20%s','Enduser\x20created.','first_name','debug','[HTTP]','merge','map','type','string','nameField','customField','toLowerCase','content','custom_fields','variable','customVariable','Variable','POST','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri','stripTrailingSlash','serverUrl','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','uniqueid','The\x20User\x20ID\x20is:','calleridname'];(function(_0x1b5aea,_0x3f04b7){var _0x15cfc6=function(_0x204e92){while(--_0x204e92){_0x1b5aea['push'](_0x1b5aea['shift']());}};_0x15cfc6(++_0x3f04b7);}(_0x4496,0x91));var _0x6449=function(_0x3141aa,_0x14de48){_0x3141aa=_0x3141aa-0x0;var _0x2a55b6=_0x4496[_0x3141aa];return _0x2a55b6;};'use strict';var _=require('lodash');var rp=require(_0x6449('0x0'));var BPromise=require(_0x6449('0x1'));var md5=require(_0x6449('0x2'));var util=require(_0x6449('0x3'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0x6449('0x4'));var logger=require(_0x6449('0x5'))('sugarcrm');config[_0x6449('0x6')]=_[_0x6449('0x7')](config[_0x6449('0x6')],{'host':_0x6449('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x6449('0x6')]));var def={'method':'POST','json':!![]};function emit(_0x523693,_0x3710b2,_0x1db0d9){io['to'](_0x523693)[_0x6449('0x9')](_0x3710b2,_0x1db0d9);}function getTicket(_0x13bb98,_0x258bcf,_0x5367dc,_0x5df2e6,_0x3f1846,_0x4332e0,_0x454d2d,_0x5d2408){logger['info'](_0x6449('0xa'));var _0x4c1333=new Date();var _0x38dba9=[{'name':_0x6449('0xb'),'value':intUtil['getString'](_0x5df2e6['Subjects'],_0x3f1846,'\x20')},{'name':'assigned_user_id','value':_0x258bcf['id']},{'name':_0x6449('0xc'),'value':_0x258bcf['id']},{'name':_0x6449('0xd'),'value':intUtil[_0x6449('0xe')](_0x5df2e6[_0x6449('0xf')],_0x3f1846,'\x0a')},{'name':'date_start','value':_0x4c1333[_0x6449('0x10')]()[_0x6449('0x11')](0x0,0x13)[_0x6449('0x12')]('T','\x20')},{'name':_0x6449('0x13'),'value':'0'},{'name':_0x6449('0x14'),'value':'15'},{'name':_0x6449('0x15'),'value':_0x5367dc['id']},{'name':'parent_type','value':_0x6449('0x16')},{'name':'parent_name','value':_0x5367dc[_0x6449('0xb')]},{'name':_0x6449('0x17'),'value':_0x5d2408}];if(_0x4332e0[_0x6449('0x18')]){_[_0x6449('0x19')](_0x4332e0,function(_0x215c5c){if(_0x3f1846[_0x215c5c[_0x6449('0x1a')]]){_0x38dba9[_0x6449('0x1b')]({'name':_0x215c5c[_0x6449('0x1c')],'value':_0x3f1846[_0x215c5c[_0x6449('0x1a')]]});}});}return request({'form':{'method':_0x6449('0x1d'),'input_type':_0x6449('0x1e'),'response_type':_0x6449('0x1e'),'rest_data':JSON[_0x6449('0x1f')]({'session':_0x454d2d['id'],'module_name':_0x6449('0x20'),'name_value_list':_0x38dba9})}});}function getAuth(_0x35103e){return util['format']('Basic\x20%s',new Buffer(_0x35103e['apiKey']+':X')[_0x6449('0x21')]('base64'));}function getServerInfo(_0x158d29){return request({'form':{'method':'get_server_info','input_type':_0x6449('0x1e'),'response_type':_0x6449('0x1e'),'rest_data':JSON['stringify']({'session':_0x158d29['id']})}});}function getUser(_0x4d72e8,_0x572dae,_0x12b0de){if(!_[_0x6449('0x22')](_0x572dae)){logger[_0x6449('0x23')](_0x6449('0x24'),_0x572dae);return request({'form':{'method':'get_entry_list','input_type':_0x6449('0x1e'),'response_type':_0x6449('0x1e'),'rest_data':JSON['stringify']({'session':_0x12b0de['id'],'module_name':_0x6449('0x25'),'query':util[_0x6449('0x26')](_0x6449('0x27'),_0x572dae),'order_by':'','offset':'0','select_fields':['id',_0x6449('0xb'),_0x6449('0x28')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x6449('0x29')](function(_0x6262cf){if(_0x6262cf[_0x6449('0x2a')][_0x6449('0x18')]){var _0x2748a5=_[_0x6449('0x2b')](_0x6262cf[_0x6449('0x2a')],function(_0x459614){return _0x459614[_0x6449('0x2c')][_0x6449('0x28')][_0x6449('0x2d')]===_0x572dae;});if(_0x2748a5){logger[_0x6449('0x23')]('Agent\x20found!');return BPromise[_0x6449('0x2e')]({'id':_0x2748a5[_0x6449('0x2c')]['id'][_0x6449('0x2d')],'name':_0x2748a5[_0x6449('0x2c')]['name'][_0x6449('0x2d')]});}}logger[_0x6449('0x23')](_0x6449('0x2f'));return BPromise[_0x6449('0x2e')]({'id':_0x12b0de['name_value_list'][_0x6449('0x30')][_0x6449('0x2d')],'name':_0x12b0de[_0x6449('0x2c')][_0x6449('0x28')][_0x6449('0x2d')]});});}else{logger[_0x6449('0x23')](_0x6449('0x31'));return BPromise[_0x6449('0x2e')]({'id':_0x12b0de['name_value_list'][_0x6449('0x30')][_0x6449('0x2d')],'name':_0x12b0de[_0x6449('0x2c')]['user_name']['value']});}}function getEndUser(_0xc8a70e,_0x5d91d9,_0x5c2cc0,_0x5ea892){logger[_0x6449('0x23')](_0x6449('0x32'),_0x5c2cc0);return request({'form':{'method':_0x6449('0x33'),'input_type':_0x6449('0x1e'),'response_type':'JSON','rest_data':JSON[_0x6449('0x1f')]({'session':_0x5ea892['id'],'module_name':_0x6449('0x16'),'query':util[_0x6449('0x26')](_0x6449('0x34'),_0x5c2cc0),'order_by':'','offset':'0','select_fields':['id',_0x6449('0xb'),'phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x5d7fe4){if(_0x5d7fe4[_0x6449('0x2a')][_0x6449('0x18')]){var _0x5d242c=_['find'](_0x5d7fe4['entry_list'],function(_0x4cda43){return _0x4cda43['name_value_list'][_0x6449('0x35')][_0x6449('0x2d')]===_0x5c2cc0;});if(_0x5d242c){logger[_0x6449('0x23')](_0x6449('0x36'));return BPromise[_0x6449('0x2e')]({'id':_0x5d242c[_0x6449('0x2c')]['id']['value'],'name':_0x5d242c[_0x6449('0x2c')]['name'][_0x6449('0x2d')],'phone':_0x5d242c[_0x6449('0x2c')][_0x6449('0x35')][_0x6449('0x2d')]});}}else{logger[_0x6449('0x23')](_0x6449('0x37'));return request({'form':{'method':'set_entry','input_type':'JSON','response_type':_0x6449('0x1e'),'rest_data':JSON[_0x6449('0x1f')]({'session':_0x5ea892['id'],'module_name':_0x6449('0x16'),'name_value_list':[{'name':'first_name','value':_0x5d91d9!==''?_0x5d91d9:util[_0x6449('0x26')](_0x6449('0x38'),_0x5c2cc0)},{'name':'phone_home','value':_0x5c2cc0}]})}})[_0x6449('0x29')](function(_0x22115f){logger[_0x6449('0x23')](_0x6449('0x39'));return BPromise[_0x6449('0x2e')]({'id':_0x22115f['id'],'name':_0x22115f[_0x6449('0x2a')][_0x6449('0x3a')]['value'],'phone':_0x22115f[_0x6449('0x2a')][_0x6449('0x35')][_0x6449('0x2d')]});});}});}function request(_0x4091c7){logger[_0x6449('0x3b')](_0x6449('0x3c'),JSON[_0x6449('0x1f')](_0x4091c7));return rp(_[_0x6449('0x3d')](def,_0x4091c7));}function getTags(_0x2bd099,_0x2cbc8d){var _0x337492=[];if(_0x2bd099&&_0x2bd099[_0x6449('0x18')]>0x0){_0x337492=_[_0x6449('0x3e')](_0x2bd099,_0x2cbc8d);}return _0x337492;}function getCustomFields(_0x2dc29d,_0x1c8510){var _0x44aa4d=[];var _0x33b932={'custom_fields':[]};if(_0x2dc29d['length']>0x0){_[_0x6449('0x19')](_0x2dc29d,function(_0x4827e9){if(_0x4827e9[_0x6449('0x3f')]===_0x6449('0x40')&&_0x4827e9[_0x6449('0x41')]&&!_0x4827e9[_0x6449('0x42')]){_0x33b932[_0x4827e9[_0x6449('0x41')][_0x6449('0x43')]()]=_0x4827e9[_0x6449('0x44')]['toString']();}else if(_0x4827e9['type']===_0x6449('0x40')&&_0x4827e9[_0x6449('0x1c')]&&_0x4827e9[_0x6449('0x42')]){_0x33b932[_0x6449('0x45')][_0x6449('0x1b')]({'id':_0x4827e9[_0x6449('0x1c')],'value':_0x4827e9['content']['toString']()});}else if(_0x4827e9[_0x6449('0x3f')]===_0x6449('0x46')&&_0x4827e9['variableName']&&_0x4827e9[_0x6449('0x1c')]&&_0x4827e9['customField']){_0x1c8510[_0x4827e9[_0x6449('0x1a')]]&&_0x33b932[_0x6449('0x45')][_0x6449('0x1b')]({'id':_0x4827e9['idField'],'value':_0x1c8510[_0x4827e9[_0x6449('0x1a')]]['toString']()});}else if(_0x4827e9[_0x6449('0x3f')]===_0x6449('0x47')&&_0x4827e9[_0x6449('0x48')]&&_0x4827e9['Variable'][_0x6449('0xb')]&&_0x4827e9[_0x6449('0x1c')]&&_0x4827e9['customField']){_0x1c8510[_0x4827e9[_0x6449('0x48')][_0x6449('0xb')][_0x6449('0x43')]()]&&_0x33b932[_0x6449('0x45')][_0x6449('0x1b')]({'id':_0x4827e9[_0x6449('0x1c')],'value':_0x1c8510[_0x4827e9[_0x6449('0x48')][_0x6449('0xb')][_0x6449('0x43')]()]['toString']()});}});}return _0x33b932;}function getConnection(_0x56f584){return request({'method':_0x6449('0x49'),'form':{'method':_0x6449('0x4a'),'input_type':_0x6449('0x1e'),'response_type':_0x6449('0x1e'),'rest_data':JSON[_0x6449('0x1f')]({'user_auth':{'user_name':_0x56f584[_0x6449('0x4b')],'password':_0x56f584[_0x6449('0x4c')],'encryption':_0x6449('0x4d')},'application':_0x6449('0x4e')})}})[_0x6449('0x29')](function(_0x3be1a6){var _0x5f1a52=_0x3be1a6;if(_0x5f1a52['id']){def[_0x6449('0x4f')]=_0x5f1a52['id'];return BPromise[_0x6449('0x2e')](_0x5f1a52);}else{throw new Error(util['format'](_0x6449('0x50'),_0x56f584['id']));}});}function setRelationship(_0x1c428c,_0x52a37a,_0x47e650,_0x482d89){return request({'form':{'method':_0x6449('0x51'),'input_type':'JSON','response_type':'JSON','rest_data':JSON['stringify']({'session':_0x1c428c['id'],'module_name':'Calls','module_id':_0x47e650['id'],'link_field_name':_0x482d89,'related_ids':[_0x52a37a['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x6449('0x52')]=function(_0x5cad27,_0x563981,_0x47de92,_0x32775f,_0x9c93d8,_0x366520){var _0x4633af,_0x3a063b,_0x300d3b,_0x4a8bef;_0x366520[_0x6449('0x53')]=intUtil[_0x6449('0x54')](_0x366520[_0x6449('0x53')]);_0x366520[_0x6449('0x55')]=intUtil['stripTrailingSlash'](_0x366520[_0x6449('0x55')]);def['uri']=util['format'](_0x6449('0x56'),_0x366520[_0x6449('0x53')]);if(_0x9c93d8&&_0x9c93d8[_0x6449('0x57')]){logger[_0x6449('0x23')](_0x6449('0x58'),_0x6449('0x59'));_0x563981['recordingURL']=util[_0x6449('0x26')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x366520[_0x6449('0x55')],_0x563981[_0x6449('0x5a')],md5(_0x563981[_0x6449('0x5a')]));}else{_0x563981['recordingURL']='';}return getConnection(_0x366520)[_0x6449('0x29')](function(_0x4fcaa4){_0x4a8bef=_0x4fcaa4;return getUser(_0x366520,_0x32775f[_0x6449('0xb')],_0x4a8bef);})[_0x6449('0x29')](function(_0x7e537e){_0x4633af=_0x7e537e;logger['info'](_0x6449('0x5b'),_0x4633af['id']);return getEndUser(_0x366520,_0x563981[_0x6449('0x5c')],_0x563981[_0x6449('0x5d')],_0x4a8bef);})[_0x6449('0x29')](function(_0x95ee9b){_0x3a063b=_0x95ee9b;logger[_0x6449('0x23')](_0x6449('0x5e'),_0x3a063b['id']);return getTicket(_0x366520,_0x4633af,_0x3a063b,_0x47de92,_0x563981,_0x47de92[_0x6449('0x5f')],_0x4a8bef,_0x6449('0x60'));})['then'](function(_0x1d2562){_0x300d3b=_0x1d2562;logger[_0x6449('0x23')](_0x6449('0x61'));logger[_0x6449('0x23')](_0x6449('0x62'),_0x300d3b['id']);return setRelationship(_0x4a8bef,_0x4633af,_0x300d3b,_0x6449('0x63'));})[_0x6449('0x29')](function(){return setRelationship(_0x4a8bef,_0x3a063b,_0x300d3b,_0x6449('0x64'));})['then'](function(){return getServerInfo(_0x4a8bef);})[_0x6449('0x29')](function(_0x2d1b9d){var _0x5fabae=parseInt(_0x2d1b9d['version'][_0x6449('0x65')](0x0));var _0x53b395=util[_0x6449('0x26')](_0x6449('0x66'),_0x366520['remoteUri'],_0x300d3b['id']);if(_0x5fabae>0x6){_0x53b395=util[_0x6449('0x26')](_0x6449('0x67'),_0x366520[_0x6449('0x53')],_0x300d3b['id']);}logger['info'](_0x6449('0x58'),_0x6449('0x68'));emit(util[_0x6449('0x26')](_0x6449('0x69'),_0x32775f[_0x6449('0xb')]),_0x6449('0x6a'),{'uri':_0x53b395});})[_0x6449('0x6b')](function(_0x343582){logger[_0x6449('0x6c')](_0x6449('0x58'),JSON[_0x6449('0x1f')](_0x343582));});};exports[_0x6449('0x6d')]=function(_0x292e08,_0x5dca94,_0x16d4c7,_0x501c4d,_0x25e042,_0x3852b6,_0x539cb1){var _0x2a869c,_0x425ff9,_0x33858b,_0x57107b;_0x3852b6[_0x6449('0x53')]=intUtil[_0x6449('0x54')](_0x3852b6[_0x6449('0x53')]);_0x3852b6['serverUrl']=intUtil[_0x6449('0x54')](_0x3852b6['serverUrl']);def[_0x6449('0x6e')]=util[_0x6449('0x26')](_0x6449('0x56'),_0x3852b6[_0x6449('0x53')]);if(_0x539cb1&&_0x539cb1[_0x6449('0x6f')]&&_0x539cb1[_0x6449('0x6f')]!==_0x6449('0x70')){logger[_0x6449('0x23')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x5dca94[_0x6449('0x71')]=util[_0x6449('0x26')](_0x6449('0x72'),_0x3852b6['serverUrl'],_0x5dca94[_0x6449('0x5a')],md5(_0x5dca94['uniqueid']));}return getConnection(_0x3852b6)[_0x6449('0x29')](function(_0x30361f){_0x57107b=_0x30361f;return getUser(_0x3852b6,_0x501c4d[_0x6449('0xb')],_0x57107b);})[_0x6449('0x29')](function(_0x26935c){_0x2a869c=_0x26935c;logger['info'](_0x6449('0x5b'),_0x2a869c['id']);return getEndUser(_0x3852b6,_0x5dca94['destcalleridname'],_0x5dca94['destcalleridnum'],_0x57107b);})[_0x6449('0x29')](function(_0x409d4e){_0x425ff9=_0x409d4e;logger[_0x6449('0x23')]('The\x20Enduser\x20ID\x20is:',_0x425ff9['id']);return getTicket(_0x3852b6,_0x2a869c,_0x425ff9,_0x16d4c7,_0x5dca94,_0x16d4c7[_0x6449('0x5f')],_0x57107b,'Outbound');})[_0x6449('0x29')](function(_0x18aada){_0x33858b=_0x18aada;logger[_0x6449('0x23')]('Ticket\x20created!');logger[_0x6449('0x23')](_0x6449('0x62'),_0x33858b['id']);return setRelationship(_0x57107b,_0x2a869c,_0x33858b,'users');})[_0x6449('0x29')](function(){return setRelationship(_0x57107b,_0x425ff9,_0x33858b,_0x6449('0x64'));})[_0x6449('0x29')](function(){return getServerInfo(_0x57107b);})[_0x6449('0x29')](function(_0x217488){var _0x1c778a=parseInt(_0x217488['version'][_0x6449('0x65')](0x0));var _0x4ec277=util[_0x6449('0x26')](_0x6449('0x66'),_0x3852b6[_0x6449('0x53')],_0x33858b['id']);if(_0x1c778a>0x6){_0x4ec277=util[_0x6449('0x26')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x3852b6[_0x6449('0x53')],_0x33858b['id']);}logger['info'](_0x6449('0x73'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x6449('0x26')](_0x6449('0x69'),_0x501c4d[_0x6449('0xb')]),_0x6449('0x6a'),{'uri':_0x4ec277});})[_0x6449('0x6b')](function(_0x2e5fc6){logger['error'](_0x6449('0x73'),JSON['stringify'](_0x2e5fc6));});};exports[_0x6449('0x74')]=function(_0x107555,_0x4f09ca,_0x3bea58,_0x317f75,_0x5e2441,_0x4da1fd){var _0x11db56,_0x5721ed,_0x1a8430,_0x458450;_0x4da1fd[_0x6449('0x53')]=intUtil[_0x6449('0x54')](_0x4da1fd['remoteUri']);_0x4da1fd[_0x6449('0x55')]=intUtil[_0x6449('0x54')](_0x4da1fd[_0x6449('0x55')]);def['uri']=util[_0x6449('0x26')]('%s/service/v4_1/rest.php',_0x4da1fd[_0x6449('0x53')]);if(_0x5e2441&&_0x5e2441['monitor_format']){logger[_0x6449('0x23')]('['+_0x4f09ca[_0x6449('0x75')]['toUpperCase']()+']',_0x6449('0x59'));_0x4f09ca['recordingURL']=util[_0x6449('0x26')](_0x6449('0x72'),_0x4da1fd['serverUrl'],_0x4f09ca[_0x6449('0x5a')],md5(_0x4f09ca[_0x6449('0x5a')]));}else{_0x4f09ca[_0x6449('0x71')]='';}return getConnection(_0x4da1fd)[_0x6449('0x29')](function(_0x178e66){_0x458450=_0x178e66;if(!_[_0x6449('0x22')](_0x317f75)){return getUser(_0x4da1fd,_0x317f75['name'],_0x458450);}else{return getUser(_0x4da1fd,null,_0x458450);}})[_0x6449('0x29')](function(_0x120484){_0x11db56=_0x120484;logger[_0x6449('0x23')](_0x6449('0x5b'),_0x11db56['id']);return getEndUser(_0x4da1fd,_0x4f09ca[_0x6449('0x5c')],_0x4f09ca[_0x6449('0x5d')],_0x458450);})[_0x6449('0x29')](function(_0x4e5fb0){_0x5721ed=_0x4e5fb0;logger[_0x6449('0x23')]('The\x20Enduser\x20ID\x20is:',_0x5721ed['id']);return getTicket(_0x4da1fd,_0x11db56,_0x5721ed,_0x3bea58,_0x4f09ca,_0x3bea58[_0x6449('0x5f')],_0x458450,_0x6449('0x60'));})[_0x6449('0x29')](function(_0x4bcd47){_0x1a8430=_0x4bcd47;logger['info'](_0x6449('0x61'));logger['info'](_0x6449('0x62'),_0x1a8430['id']);return setRelationship(_0x458450,_0x11db56,_0x1a8430,_0x6449('0x63'));})[_0x6449('0x29')](function(){return setRelationship(_0x458450,_0x5721ed,_0x1a8430,_0x6449('0x64'));})['then'](function(){return getServerInfo(_0x458450);})[_0x6449('0x6b')](function(_0x35ff62){logger[_0x6449('0x6c')]('['+_0x4f09ca[_0x6449('0x75')][_0x6449('0x76')]()+']',JSON['stringify'](_0x35ff62));});}; \ 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 45d4bf5..7312cb9 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 _0xc3df=['keyValue','keyType','key','format','%s:\x20%s','keyContent','join','stripTrailingSlash','lastIndexOf','isNil','test','lodash','util','length','sortBy','string','push','content','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase'];(function(_0x4b52fa,_0x234891){var _0x393f16=function(_0x53eeef){while(--_0x53eeef){_0x4b52fa['push'](_0x4b52fa['shift']());}};_0x393f16(++_0x234891);}(_0xc3df,0x15d));var _0xfc3d=function(_0x4ac2f2,_0x43a291){_0x4ac2f2=_0x4ac2f2-0x0;var _0x4bf328=_0xc3df[_0x4ac2f2];return _0x4bf328;};'use strict';var _=require(_0xfc3d('0x0'));var util=require(_0xfc3d('0x1'));exports['getString']=function(_0xa62593,_0xe120a0,_0x59718e){var _0x538abc=[];if(_0xa62593[_0xfc3d('0x2')]>0x0){var _0x47b1e0=_[_0xfc3d('0x3')](_0xa62593,['id']);for(var _0x35ad26=0x0;_0x35ad26<_0x47b1e0[_0xfc3d('0x2')];_0x35ad26++){var _0x3fa382=_0x47b1e0[_0x35ad26];if(_0x3fa382['type']===_0xfc3d('0x4')){_0x538abc[_0xfc3d('0x5')](_0x3fa382[_0xfc3d('0x6')]);}else if(_0x3fa382[_0xfc3d('0x7')]===_0xfc3d('0x8')&&_0x3fa382['variableName']){_0xe120a0[_0x3fa382[_0xfc3d('0x9')]]&&_0x538abc[_0xfc3d('0x5')](_0xe120a0[_0x3fa382[_0xfc3d('0x9')]][_0xfc3d('0xa')]());}else if(_0x3fa382['type']===_0xfc3d('0xb')&&_0x3fa382[_0xfc3d('0xc')]&&_0x3fa382['Variable'][_0xfc3d('0xd')]){_0xe120a0[_0x3fa382[_0xfc3d('0xc')][_0xfc3d('0xd')][_0xfc3d('0xe')]()]&&_0x538abc['push'](_0xe120a0[_0x3fa382[_0xfc3d('0xc')][_0xfc3d('0xd')][_0xfc3d('0xe')]()]['toString']());}else if(_0x3fa382[_0xfc3d('0x7')]===_0xfc3d('0xf')){if(_0x3fa382[_0xfc3d('0x10')]==='string'&&_0x3fa382[_0xfc3d('0x11')]){_0x538abc['push'](util[_0xfc3d('0x12')](_0xfc3d('0x13'),_0x3fa382[_0xfc3d('0x11')],_0x3fa382[_0xfc3d('0x14')]));}else if(_0x3fa382[_0xfc3d('0x10')]===_0xfc3d('0x8')&&_0x3fa382[_0xfc3d('0x9')]&&_0x3fa382[_0xfc3d('0x11')]){_0xe120a0[_0x3fa382[_0xfc3d('0x9')]]&&_0x538abc['push'](util[_0xfc3d('0x12')](_0xfc3d('0x13'),_0x3fa382[_0xfc3d('0x11')],_0xe120a0[_0x3fa382[_0xfc3d('0x9')]]));}else if(_0x3fa382[_0xfc3d('0x10')]===_0xfc3d('0xb')&&_0x3fa382[_0xfc3d('0xc')]&&_0x3fa382[_0xfc3d('0xc')]['name']&&_0x3fa382['key']){_0xe120a0[_0x3fa382[_0xfc3d('0xc')][_0xfc3d('0xd')][_0xfc3d('0xe')]()]&&_0x538abc[_0xfc3d('0x5')](util[_0xfc3d('0x12')]('%s:\x20%s',_0x3fa382[_0xfc3d('0x11')],_0xe120a0[_0x3fa382['Variable'][_0xfc3d('0xd')][_0xfc3d('0xe')]()]));}}}}return _0x538abc[_0xfc3d('0x15')](_0x59718e);};exports[_0xfc3d('0x16')]=function(_0x3089fa){var _0x32ece4=_0x3089fa['slice'](-0x1);if(_0x32ece4==='/'){_0x3089fa=_0x3089fa['substring'](0x0,_0x3089fa[_0xfc3d('0x17')](_0x32ece4));}return _0x3089fa;};exports['validateEmail']=function(_0x4beb31){if(!_[_0xfc3d('0x18')](_0x4beb31)&&_0x4beb31!==''){var _0xa5f1fe=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;return _0xa5f1fe[_0xfc3d('0x19')](String(_0x4beb31)[_0xfc3d('0xe')]());}else{return![];}}; \ No newline at end of file +var _0x32b3=['toLowerCase','keyValue','keyType','key','format','%s:\x20%s','variable','join','stripTrailingSlash','slice','substring','lastIndexOf','validateEmail','isNil','test','lodash','util','getString','length','type','string','push','content','variableName','toString','customVariable','Variable','name'];(function(_0x4d2487,_0x5cffcb){var _0x2763d3=function(_0x8b6eb){while(--_0x8b6eb){_0x4d2487['push'](_0x4d2487['shift']());}};_0x2763d3(++_0x5cffcb);}(_0x32b3,0x1b3));var _0x332b=function(_0x9ff1c0,_0x207afc){_0x9ff1c0=_0x9ff1c0-0x0;var _0x3e6c23=_0x32b3[_0x9ff1c0];return _0x3e6c23;};'use strict';var _=require(_0x332b('0x0'));var util=require(_0x332b('0x1'));exports[_0x332b('0x2')]=function(_0x568b89,_0x478856,_0x18bc53){var _0x1d402c=[];if(_0x568b89[_0x332b('0x3')]>0x0){var _0x28f68b=_['sortBy'](_0x568b89,['id']);for(var _0x3ce8a5=0x0;_0x3ce8a5<_0x28f68b[_0x332b('0x3')];_0x3ce8a5++){var _0x7cf154=_0x28f68b[_0x3ce8a5];if(_0x7cf154[_0x332b('0x4')]===_0x332b('0x5')){_0x1d402c[_0x332b('0x6')](_0x7cf154[_0x332b('0x7')]);}else if(_0x7cf154['type']==='variable'&&_0x7cf154['variableName']){_0x478856[_0x7cf154[_0x332b('0x8')]]&&_0x1d402c[_0x332b('0x6')](_0x478856[_0x7cf154[_0x332b('0x8')]][_0x332b('0x9')]());}else if(_0x7cf154[_0x332b('0x4')]===_0x332b('0xa')&&_0x7cf154['Variable']&&_0x7cf154[_0x332b('0xb')][_0x332b('0xc')]){_0x478856[_0x7cf154[_0x332b('0xb')]['name']['toLowerCase']()]&&_0x1d402c[_0x332b('0x6')](_0x478856[_0x7cf154['Variable']['name'][_0x332b('0xd')]()][_0x332b('0x9')]());}else if(_0x7cf154[_0x332b('0x4')]===_0x332b('0xe')){if(_0x7cf154[_0x332b('0xf')]==='string'&&_0x7cf154[_0x332b('0x10')]){_0x1d402c[_0x332b('0x6')](util[_0x332b('0x11')](_0x332b('0x12'),_0x7cf154[_0x332b('0x10')],_0x7cf154['keyContent']));}else if(_0x7cf154['keyType']===_0x332b('0x13')&&_0x7cf154[_0x332b('0x8')]&&_0x7cf154[_0x332b('0x10')]){_0x478856[_0x7cf154[_0x332b('0x8')]]&&_0x1d402c[_0x332b('0x6')](util[_0x332b('0x11')](_0x332b('0x12'),_0x7cf154['key'],_0x478856[_0x7cf154[_0x332b('0x8')]]));}else if(_0x7cf154[_0x332b('0xf')]==='customVariable'&&_0x7cf154[_0x332b('0xb')]&&_0x7cf154[_0x332b('0xb')][_0x332b('0xc')]&&_0x7cf154[_0x332b('0x10')]){_0x478856[_0x7cf154[_0x332b('0xb')]['name']['toLowerCase']()]&&_0x1d402c[_0x332b('0x6')](util[_0x332b('0x11')](_0x332b('0x12'),_0x7cf154[_0x332b('0x10')],_0x478856[_0x7cf154[_0x332b('0xb')][_0x332b('0xc')]['toLowerCase']()]));}}}}return _0x1d402c[_0x332b('0x14')](_0x18bc53);};exports[_0x332b('0x15')]=function(_0x2a5e60){var _0x54bee9=_0x2a5e60[_0x332b('0x16')](-0x1);if(_0x54bee9==='/'){_0x2a5e60=_0x2a5e60[_0x332b('0x17')](0x0,_0x2a5e60[_0x332b('0x18')](_0x54bee9));}return _0x2a5e60;};exports[_0x332b('0x19')]=function(_0x4042d0){if(!_[_0x332b('0x1a')](_0x4042d0)&&_0x4042d0!==''){var _0x538aa5=/^(([^<>()\[\]\\.,;:\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 _0x538aa5[_0x332b('0x1b')](String(_0x4042d0)[_0x332b('0xd')]());}else{return![];}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/vtiger.js b/server/services/ami/trigger/integration/vtiger.js index 5c86622..6c9cbf6 100644 --- a/server/services/ami/trigger/integration/vtiger.js +++ b/server/services/ami/trigger/integration/vtiger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['stringify','validateEmail','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','length','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','getUser','admin','Searching\x20end\x20user\x20with\x20phone','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','login','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','stripTrailingSlash','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','recordingURL','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Fields','The\x20Ticket\x20ID\x20is:','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridnum','lastevent','bluebird','md5','util','ioredis','./util','../../../../config/environment','redis','localhost','socket.io-emitter','emit','forEach','string','picklist','idField','content','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','getString','Subjects','POST','remoteUri','create','username','sessionName','then','resolve','result','format','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s'];(function(_0x38fbb9,_0x14226c){var _0x3f6b26=function(_0xbd8dc1){while(--_0xbd8dc1){_0x38fbb9['push'](_0x38fbb9['shift']());}};_0x3f6b26(++_0x14226c);}(_0x9c44,0x178));var _0x49c4=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x9c44[_0x8c43de];return _0xa6591b;};'use strict';var _=require('lodash');var rp=require('request-promise');var BPromise=require(_0x49c4('0x0'));var md5=require(_0x49c4('0x1'));var util=require(_0x49c4('0x2'));var Redis=require(_0x49c4('0x3'));var intUtil=require(_0x49c4('0x4'));var config=require(_0x49c4('0x5'));var logger=require('../../../../config/logger')('vTiger');config[_0x49c4('0x6')]=_['defaults'](config[_0x49c4('0x6')],{'host':_0x49c4('0x7'),'port':0x18eb});var io=require(_0x49c4('0x8'))(new Redis(config[_0x49c4('0x6')]));function emit(_0x436234,_0x511d53,_0x11c586){io['to'](_0x436234)[_0x49c4('0x9')](_0x511d53,_0x11c586);}function getCustomFields(_0x1d13fb,_0x4487ca){var _0x4c7d3a={};if(_0x1d13fb['length']>0x0){_[_0x49c4('0xa')](_0x1d13fb,function(_0x313e73){if(_['includes']([_0x49c4('0xb'),_0x49c4('0xc')],_0x313e73['type'])&&_0x313e73['idField']){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x313e73[_0x49c4('0xe')]['toString']();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x10')&&_0x313e73['variableName']&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x11')]]){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x4487ca[_0x313e73[_0x49c4('0x11')]][_0x49c4('0x12')]();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x13')&&_0x313e73[_0x49c4('0x14')]&&_0x313e73['Variable'][_0x49c4('0x15')]&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')][_0x49c4('0x16')]()]){_0x4c7d3a[_0x313e73['idField']]=_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')]['toLowerCase']()]['toString']();}});}return _0x4c7d3a;}function createTicket(_0x3c782d,_0x2f82d5,_0x3addb2,_0x59f29b,_0x24856d,_0x50b151,_0x2cbd50){logger[_0x49c4('0x17')](_0x49c4('0x18'));var _0x291526=_[_0x49c4('0x19')]({'parent_id':'','assigned_user_id':_0x2f82d5['id'],'ticketpriorities':_0x49c4('0x1a'),'ticketstatus':_0x49c4('0x1b'),'ticket_title':intUtil[_0x49c4('0x1c')](_0x59f29b[_0x49c4('0x1d')],_0x24856d,'\x20'),'description':intUtil['getString'](_0x59f29b['Descriptions'],_0x24856d,'\x0a'),'contact_id':_0x3addb2['id']},getCustomFields(_0x50b151,_0x24856d));var _0x57f502={'method':_0x49c4('0x1e'),'uri':util['format']('%s/webservice.php',_0x3c782d[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x20'),'username':_0x3c782d[_0x49c4('0x21')],'sessionName':_0x2cbd50[_0x49c4('0x22')],'elementType':'HelpDesk','element':JSON['stringify'](_0x291526)},'json':!![]};return request(_0x57f502)[_0x49c4('0x23')](function(_0x9cb797){if(_0x9cb797['success']){return BPromise[_0x49c4('0x24')]({'id':_0x9cb797[_0x49c4('0x25')]['id']});}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x27'),JSON['stringify'](_0x9cb797['error'])));}})[_0x49c4('0x28')](function(_0x53c199){var _0x3800b7=_0x53c199[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'createTicket',_0x3800b7,JSON[_0x49c4('0x2c')](_0x53c199));});}function getUser(_0x2b2793,_0x46e04d,_0x4f28a2){if(intUtil[_0x49c4('0x2d')](_0x46e04d)){logger[_0x49c4('0x17')](_0x49c4('0x2e'),_0x46e04d);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2b2793[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x2b2793['username'],'sessionName':_0x4f28a2['sessionName'],'query':util[_0x49c4('0x26')](_0x49c4('0x31'),_0x46e04d)},'json':!![]})[_0x49c4('0x23')](function(_0x27e467){if(_0x27e467[_0x49c4('0x32')]&&_0x27e467['result'][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x34'));return BPromise[_0x49c4('0x24')]({'id':_0x27e467['result'][0x0]['id'],'email':_0x27e467['result'][0x0][_0x49c4('0x35')],'name':_0x27e467[_0x49c4('0x25')][0x0][_0x49c4('0x36')]+'\x20'+_0x27e467[_0x49c4('0x25')][_0x49c4('0x37')]});}else{logger['info'](_0x49c4('0x38'));return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2[_0x49c4('0x39')],'email':_0x2b2793['username'],'name':'admin'});}})[_0x49c4('0x28')](function(_0x1991e9){var _0x3bec0a=_0x1991e9[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x3a'),_0x3bec0a,JSON[_0x49c4('0x2c')](_0x1991e9));});}else{logger[_0x49c4('0x17')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2['userId'],'email':_0x2b2793[_0x49c4('0x21')],'name':_0x49c4('0x3b')})[_0x49c4('0x28')](function(_0x1c2830){var _0x4ed4f8=_0x1c2830[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'getUser',_0x4ed4f8,JSON[_0x49c4('0x2c')](_0x1c2830));});}}function getEndUser(_0x21d8c7,_0x178987,_0x5e5366,_0x1ba7a0){logger[_0x49c4('0x17')](_0x49c4('0x3c'),_0x5e5366);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x21d8c7[_0x49c4('0x21')],'sessionName':_0x1ba7a0[_0x49c4('0x22')],'query':util[_0x49c4('0x26')](_0x49c4('0x3d'),_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366)},'json':!![]})[_0x49c4('0x23')](function(_0x29dd5d){if(_0x29dd5d[_0x49c4('0x32')]&&_0x29dd5d[_0x49c4('0x25')][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x3e'));return BPromise[_0x49c4('0x24')]({'id':_0x29dd5d[_0x49c4('0x25')][0x0]['id'],'name':_0x29dd5d['result'][0x0][_0x49c4('0x3f')]+'\x20'+_0x29dd5d['result'][0x0][_0x49c4('0x40')],'phone':_0x5e5366});}else{logger[_0x49c4('0x17')](_0x49c4('0x41'));return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7['remoteUri']),'form':{'operation':'create','sessionName':_0x1ba7a0[_0x49c4('0x22')],'elementType':_0x49c4('0x42'),'element':JSON[_0x49c4('0x2c')]({'lastname':_0x178987,'phone':_0x5e5366,'assigned_user_id':'\x20'})},'json':!![]})[_0x49c4('0x23')](function(_0x490823){logger[_0x49c4('0x17')](_0x49c4('0x43'));return BPromise[_0x49c4('0x24')]({'id':_0x490823[_0x49c4('0x25')]['id'],'name':_0x490823[_0x49c4('0x25')][_0x49c4('0x40')],'phone':_0x490823[_0x49c4('0x25')][_0x49c4('0x44')]});})[_0x49c4('0x28')](function(_0x5640d3){var _0x2ad771=_0x5640d3['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x45'),_0x2ad771,JSON[_0x49c4('0x2c')](_0x5640d3));});}});}function getConnection(_0x2d93d8){var _0x5b296d=_0x2d93d8[_0x49c4('0x21')];var _0x15b674=_0x2d93d8[_0x49c4('0x46')];return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'qs':{'operation':'getchallenge','username':_0x5b296d},'json':!![]})[_0x49c4('0x23')](function(_0x5cfff9){if(_0x5cfff9[_0x49c4('0x32')]){return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x47'),'username':_0x5b296d,'accessKey':md5(_0x5cfff9[_0x49c4('0x25')]['token']+_0x15b674)},'json':!![]});}})[_0x49c4('0x23')](function(_0x3feaf0){if(_0x3feaf0['success']){return BPromise[_0x49c4('0x24')](_0x3feaf0[_0x49c4('0x25')]);}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x48'),_0x2d93d8['id']));}})['catch'](function(_0x5d8bf0){var _0x144fd2=_0x5d8bf0['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x49'),_0x144fd2,JSON[_0x49c4('0x2c')](_0x5d8bf0));});}function request(_0x240c20){logger[_0x49c4('0x17')](_0x49c4('0x4a'),JSON['stringify'](_0x240c20));return rp(_0x240c20);}exports[_0x49c4('0x4b')]=function(_0x1550ce,_0x3936d3,_0x3d944c,_0x17ef75,_0x2644c0,_0x156748){var _0x25d174,_0x1e0b4f,_0x1856be,_0x5b822f;_0x156748['remoteUri']=intUtil[_0x49c4('0x4c')](_0x156748[_0x49c4('0x1f')]);if(_0x2644c0&&_0x2644c0['monitor_format']){logger['info'](_0x49c4('0x4d'),'Recording\x20is\x20enabled!');_0x3936d3['recordingURL']=util[_0x49c4('0x26')](_0x49c4('0x4e'),_0x156748[_0x49c4('0x4f')],_0x3936d3[_0x49c4('0x50')],md5(_0x3936d3[_0x49c4('0x50')]));}else{_0x3936d3[_0x49c4('0x51')]='';}return getConnection(_0x156748)[_0x49c4('0x23')](function(_0x50798e){_0x5b822f=_0x50798e;return getUser(_0x156748,_0x17ef75[_0x49c4('0x52')],_0x5b822f);})[_0x49c4('0x23')](function(_0x207572){_0x25d174=_0x207572;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x25d174['id']);return getEndUser(_0x156748,_0x3936d3[_0x49c4('0x54')],_0x3936d3['calleridnum'],_0x5b822f);})['then'](function(_0x1ef0c1){_0x1e0b4f=_0x1ef0c1;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0x1e0b4f['id']);return createTicket(_0x156748,_0x25d174,_0x1e0b4f,_0x3d944c,_0x3936d3,_0x3d944c[_0x49c4('0x56')],_0x5b822f);})[_0x49c4('0x23')](function(_0x6b2592){_0x1856be=_0x6b2592;logger[_0x49c4('0x17')]('Ticket\x20created!');logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x1856be['id']);var _0x4ba4eb=util[_0x49c4('0x26')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x156748[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x1856be['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x4d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x17ef75[_0x49c4('0x15')]),'trigger:browser:url',{'uri':_0x4ba4eb});})[_0x49c4('0x28')](function(_0x27b9c2){logger['error'](_0x49c4('0x4d'),JSON[_0x49c4('0x2c')](_0x27b9c2));});};exports['outbound']=function(_0x39c455,_0x42e0e6,_0x4f50bf,_0x4dc54d,_0x589484,_0x513879,_0xc43386){var _0x54947d,_0xb20a5d,_0x32f344,_0x515240;_0x513879[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x513879['remoteUri']);_0x513879[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x513879[_0x49c4('0x4f')]);if(_0xc43386&&_0xc43386[_0x49c4('0x5b')]&&_0xc43386['recordingFormat']!==_0x49c4('0x5c')){logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x5e'));_0x42e0e6['recordingURL']=util[_0x49c4('0x26')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x513879['serverUrl'],_0x42e0e6['uniqueid'],md5(_0x42e0e6['uniqueid']));}return getConnection(_0x513879)[_0x49c4('0x23')](function(_0x32eaef){_0x515240=_0x32eaef;return getUser(_0x513879,_0x4dc54d[_0x49c4('0x52')],_0x515240);})[_0x49c4('0x23')](function(_0x5b056e){_0x54947d=_0x5b056e;logger['info'](_0x49c4('0x53'),_0x54947d['id']);return getEndUser(_0x513879,_0x42e0e6[_0x49c4('0x5f')],_0x42e0e6[_0x49c4('0x60')],_0x515240);})[_0x49c4('0x23')](function(_0x102c15){_0xb20a5d=_0x102c15;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0xb20a5d['id']);return createTicket(_0x513879,_0x54947d,_0xb20a5d,_0x4f50bf,_0x42e0e6,_0x4f50bf[_0x49c4('0x56')],_0x515240);})['then'](function(_0x2276db){_0x32f344=_0x2276db;logger['info'](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x32f344['id']);var _0x1ea1b4=util[_0x49c4('0x26')](_0x49c4('0x62'),_0x513879[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x32f344['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x4dc54d[_0x49c4('0x15')]),_0x49c4('0x63'),{'uri':_0x1ea1b4});})[_0x49c4('0x28')](function(_0x371e49){logger[_0x49c4('0x2a')]('[OUTBOUND]',JSON['stringify'](_0x371e49));});};exports[_0x49c4('0x64')]=function(_0x16b3e8,_0x4af680,_0x1a15f3,_0x38ad50,_0x2939fd,_0x16e7b1){var _0x4d6aaa,_0x5a14a5,_0x4a85d4,_0x2e90d8;_0x16e7b1[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x1f')]);_0x16e7b1[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x4f')]);if(_0x2939fd&&_0x2939fd[_0x49c4('0x65')]){logger[_0x49c4('0x17')]('['+_0x4af680['lastevent'][_0x49c4('0x66')]()+']',_0x49c4('0x5e'));_0x4af680[_0x49c4('0x51')]=util['format'](_0x49c4('0x4e'),_0x16e7b1[_0x49c4('0x4f')],_0x4af680[_0x49c4('0x50')],md5(_0x4af680[_0x49c4('0x50')]));}else{_0x4af680[_0x49c4('0x51')]='';}return getConnection(_0x16e7b1)[_0x49c4('0x23')](function(_0x35fa39){_0x2e90d8=_0x35fa39;return getUser(_0x16e7b1,'',_0x2e90d8);})[_0x49c4('0x23')](function(_0x4ba198){_0x4d6aaa=_0x4ba198;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x4d6aaa['id']);return getEndUser(_0x16e7b1,_0x4af680[_0x49c4('0x54')],_0x4af680[_0x49c4('0x67')],_0x2e90d8);})[_0x49c4('0x23')](function(_0x4a204d){_0x5a14a5=_0x4a204d;logger['info'](_0x49c4('0x55'),_0x5a14a5['id']);return createTicket(_0x16e7b1,_0x4d6aaa,_0x5a14a5,_0x1a15f3,_0x4af680,_0x1a15f3['Fields'],_0x2e90d8);})[_0x49c4('0x23')](function(_0x558880){_0x4a85d4=_0x558880;logger[_0x49c4('0x17')](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x4a85d4['id']);})['catch'](function(_0x123060){logger[_0x49c4('0x2a')]('['+_0x4af680[_0x49c4('0x68')][_0x49c4('0x66')]()+']',JSON[_0x49c4('0x2c')](_0x123060));});}; \ No newline at end of file +var _0xe706=['result','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','getUser','username','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','phone','catch','accessKey','getchallenge','token','Account\x20%d\x20is\x20not\x20valid','getConnection','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','user:%s','unmanaged','lastevent','toUpperCase','lodash','request-promise','bluebird','util','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','emit','length','forEach','includes','string','idField','content','toString','type','variable','variableName','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','Subjects','getString','Descriptions','POST','format','%s/webservice.php','create','stringify','then','success','resolve','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s','validateEmail','Getting\x20agent\x20with\x20email','GET','query','sessionName','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;'];(function(_0x3de447,_0x147ccd){var _0x29870a=function(_0x5df20a){while(--_0x5df20a){_0x3de447['push'](_0x3de447['shift']());}};_0x29870a(++_0x147ccd);}(_0xe706,0xa3));var _0x6e70=function(_0x1a50a6,_0x400207){_0x1a50a6=_0x1a50a6-0x0;var _0x9cd101=_0xe706[_0x1a50a6];return _0x9cd101;};'use strict';var _=require(_0x6e70('0x0'));var rp=require(_0x6e70('0x1'));var BPromise=require(_0x6e70('0x2'));var md5=require('md5');var util=require(_0x6e70('0x3'));var Redis=require(_0x6e70('0x4'));var intUtil=require(_0x6e70('0x5'));var config=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));config[_0x6e70('0x9')]=_[_0x6e70('0xa')](config[_0x6e70('0x9')],{'host':_0x6e70('0xb'),'port':0x18eb});var io=require(_0x6e70('0xc'))(new Redis(config[_0x6e70('0x9')]));function emit(_0x45a2d4,_0x188ed3,_0x3c4843){io['to'](_0x45a2d4)[_0x6e70('0xd')](_0x188ed3,_0x3c4843);}function getCustomFields(_0x954545,_0x25e61c){var _0x100eb7={};if(_0x954545[_0x6e70('0xe')]>0x0){_[_0x6e70('0xf')](_0x954545,function(_0x3f474a){if(_[_0x6e70('0x10')]([_0x6e70('0x11'),'picklist'],_0x3f474a['type'])&&_0x3f474a[_0x6e70('0x12')]){_0x100eb7[_0x3f474a[_0x6e70('0x12')]]=_0x3f474a[_0x6e70('0x13')][_0x6e70('0x14')]();}else if(_0x3f474a[_0x6e70('0x15')]===_0x6e70('0x16')&&_0x3f474a[_0x6e70('0x17')]&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['variableName']]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['variableName']][_0x6e70('0x14')]();}else if(_0x3f474a['type']==='customVariable'&&_0x3f474a[_0x6e70('0x18')]&&_0x3f474a[_0x6e70('0x18')]['name']&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')][_0x6e70('0x1a')]()]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')]['toLowerCase']()][_0x6e70('0x14')]();}});}return _0x100eb7;}function createTicket(_0x173afe,_0x53acdc,_0x497d61,_0xc238ba,_0x208e21,_0x2368eb,_0x3a9978){logger[_0x6e70('0x1b')](_0x6e70('0x1c'));var _0x1b2453=_[_0x6e70('0x1d')]({'parent_id':'','assigned_user_id':_0x53acdc['id'],'ticketpriorities':_0x6e70('0x1e'),'ticketstatus':_0x6e70('0x1f'),'ticket_title':intUtil['getString'](_0xc238ba[_0x6e70('0x20')],_0x208e21,'\x20'),'description':intUtil[_0x6e70('0x21')](_0xc238ba[_0x6e70('0x22')],_0x208e21,'\x0a'),'contact_id':_0x497d61['id']},getCustomFields(_0x2368eb,_0x208e21));var _0x502b2d={'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x173afe['remoteUri']),'form':{'operation':_0x6e70('0x26'),'username':_0x173afe['username'],'sessionName':_0x3a9978['sessionName'],'elementType':'HelpDesk','element':JSON[_0x6e70('0x27')](_0x1b2453)},'json':!![]};return request(_0x502b2d)[_0x6e70('0x28')](function(_0x51d292){if(_0x51d292[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')]({'id':_0x51d292['result']['id']});}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x2b'),JSON[_0x6e70('0x27')](_0x51d292['error'])));}})['catch'](function(_0x2c4d37){var _0x3af17f=_0x2c4d37[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'createTicket',_0x3af17f,JSON[_0x6e70('0x27')](_0x2c4d37));});}function getUser(_0x406f29,_0xecf336,_0x2864a0){if(intUtil[_0x6e70('0x2f')](_0xecf336)){logger[_0x6e70('0x1b')](_0x6e70('0x30'),_0xecf336);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x406f29['remoteUri']),'qs':{'operation':_0x6e70('0x32'),'username':_0x406f29['username'],'sessionName':_0x2864a0[_0x6e70('0x33')],'query':util['format'](_0x6e70('0x34'),_0xecf336)},'json':!![]})[_0x6e70('0x28')](function(_0x30fa0b){if(_0x30fa0b['success']&&_0x30fa0b[_0x6e70('0x35')][_0x6e70('0xe')]){logger['info'](_0x6e70('0x36'));return BPromise[_0x6e70('0x2a')]({'id':_0x30fa0b['result'][0x0]['id'],'email':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x37')],'name':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x38')]+'\x20'+_0x30fa0b[_0x6e70('0x35')][_0x6e70('0x39')]});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29['username'],'name':_0x6e70('0x3c')});}})['catch'](function(_0x23cd1a){var _0x3222a2=_0x23cd1a[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x3222a2,JSON[_0x6e70('0x27')](_0x23cd1a));});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29[_0x6e70('0x3e')],'name':_0x6e70('0x3c')})['catch'](function(_0x5446a2){var _0x5424eb=_0x5446a2[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x5424eb,JSON[_0x6e70('0x27')](_0x5446a2));});}}function getEndUser(_0x3bdd87,_0x572a71,_0x3b508c,_0x9e7ad2){logger[_0x6e70('0x1b')](_0x6e70('0x3f'),_0x3b508c);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3bdd87[_0x6e70('0x40')]),'qs':{'operation':'query','username':_0x3bdd87[_0x6e70('0x3e')],'sessionName':_0x9e7ad2[_0x6e70('0x33')],'query':util[_0x6e70('0x24')](_0x6e70('0x41'),_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c)},'json':!![]})[_0x6e70('0x28')](function(_0x1de947){if(_0x1de947[_0x6e70('0x29')]&&_0x1de947['result']['length']){logger['info'](_0x6e70('0x42'));return BPromise[_0x6e70('0x2a')]({'id':_0x1de947[_0x6e70('0x35')][0x0]['id'],'name':_0x1de947[_0x6e70('0x35')][0x0][_0x6e70('0x43')]+'\x20'+_0x1de947['result'][0x0][_0x6e70('0x44')],'phone':_0x3b508c});}else{logger[_0x6e70('0x1b')](_0x6e70('0x45'));return request({'method':'POST','uri':util['format']('%s/webservice.php',_0x3bdd87[_0x6e70('0x40')]),'form':{'operation':'create','sessionName':_0x9e7ad2[_0x6e70('0x33')],'elementType':_0x6e70('0x46'),'element':JSON[_0x6e70('0x27')]({'lastname':_0x572a71,'phone':_0x3b508c,'assigned_user_id':'\x20'})},'json':!![]})[_0x6e70('0x28')](function(_0x59c87d){logger[_0x6e70('0x1b')]('Enduser\x20created.');return BPromise[_0x6e70('0x2a')]({'id':_0x59c87d[_0x6e70('0x35')]['id'],'name':_0x59c87d[_0x6e70('0x35')][_0x6e70('0x44')],'phone':_0x59c87d['result'][_0x6e70('0x47')]});})[_0x6e70('0x48')](function(_0x3d39c3){var _0xac87d6=_0x3d39c3[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'getEndUser',_0xac87d6,JSON[_0x6e70('0x27')](_0x3d39c3));});}});}function getConnection(_0x3884a4){var _0x10de2a=_0x3884a4[_0x6e70('0x3e')];var _0x3f86cf=_0x3884a4[_0x6e70('0x49')];return request({'method':_0x6e70('0x31'),'uri':util['format'](_0x6e70('0x25'),_0x3884a4['remoteUri']),'qs':{'operation':_0x6e70('0x4a'),'username':_0x10de2a},'json':!![]})[_0x6e70('0x28')](function(_0x4b351e){if(_0x4b351e['success']){return request({'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3884a4['remoteUri']),'form':{'operation':'login','username':_0x10de2a,'accessKey':md5(_0x4b351e[_0x6e70('0x35')][_0x6e70('0x4b')]+_0x3f86cf)},'json':!![]});}})[_0x6e70('0x28')](function(_0x79653){if(_0x79653[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')](_0x79653['result']);}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x4c'),_0x3884a4['id']));}})[_0x6e70('0x48')](function(_0x6ed023){var _0x2c3a7d=_0x6ed023['statusCode']||0x1f4;logger['error'](_0x6e70('0x2e'),_0x6e70('0x4d'),_0x2c3a7d,JSON[_0x6e70('0x27')](_0x6ed023));});}function request(_0x15f994){logger[_0x6e70('0x1b')]('[HTTP]',JSON[_0x6e70('0x27')](_0x15f994));return rp(_0x15f994);}exports[_0x6e70('0x4e')]=function(_0x1fa320,_0x23ebfb,_0x3aba34,_0x4a111a,_0x1142cd,_0x1dd242){var _0x2c20d3,_0x3fb0d3,_0x8ef4f7,_0x3fd03d;_0x1dd242['remoteUri']=intUtil[_0x6e70('0x4f')](_0x1dd242[_0x6e70('0x40')]);if(_0x1142cd&&_0x1142cd['monitor_format']){logger[_0x6e70('0x1b')](_0x6e70('0x50'),'Recording\x20is\x20enabled!');_0x23ebfb[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x1dd242[_0x6e70('0x53')],_0x23ebfb[_0x6e70('0x54')],md5(_0x23ebfb['uniqueid']));}else{_0x23ebfb[_0x6e70('0x51')]='';}return getConnection(_0x1dd242)[_0x6e70('0x28')](function(_0x10d655){_0x3fd03d=_0x10d655;return getUser(_0x1dd242,_0x4a111a[_0x6e70('0x55')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1fe13a){_0x2c20d3=_0x1fe13a;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x2c20d3['id']);return getEndUser(_0x1dd242,_0x23ebfb[_0x6e70('0x57')],_0x23ebfb[_0x6e70('0x58')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1b12a1){_0x3fb0d3=_0x1b12a1;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x3fb0d3['id']);return createTicket(_0x1dd242,_0x2c20d3,_0x3fb0d3,_0x3aba34,_0x23ebfb,_0x3aba34[_0x6e70('0x5a')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x324fa6){_0x8ef4f7=_0x324fa6;logger[_0x6e70('0x1b')](_0x6e70('0x5b'));logger[_0x6e70('0x1b')]('The\x20Ticket\x20ID\x20is:',_0x8ef4f7['id']);var _0x28898a=util[_0x6e70('0x24')](_0x6e70('0x5c'),_0x1dd242[_0x6e70('0x40')],_[_0x6e70('0x5d')](_0x8ef4f7['id'],'x')[0x1]);logger[_0x6e70('0x1b')]('[QUEUE]',_0x6e70('0x5e'));emit(util[_0x6e70('0x24')]('user:%s',_0x4a111a[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x28898a});})[_0x6e70('0x48')](function(_0x590f7f){logger['error'](_0x6e70('0x50'),JSON[_0x6e70('0x27')](_0x590f7f));});};exports[_0x6e70('0x60')]=function(_0x41a861,_0x10d299,_0x739946,_0x30cd88,_0x57bfe5,_0x4d47e1,_0x2c8dc6){var _0x1e23c5,_0x2bf9ec,_0x2ad395,_0x5b1e6f;_0x4d47e1['remoteUri']=intUtil[_0x6e70('0x4f')](_0x4d47e1[_0x6e70('0x40')]);_0x4d47e1['serverUrl']=intUtil['stripTrailingSlash'](_0x4d47e1[_0x6e70('0x53')]);if(_0x2c8dc6&&_0x2c8dc6['recordingFormat']&&_0x2c8dc6[_0x6e70('0x61')]!==_0x6e70('0x62')){logger[_0x6e70('0x1b')](_0x6e70('0x63'),_0x6e70('0x64'));_0x10d299[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x4d47e1['serverUrl'],_0x10d299[_0x6e70('0x54')],md5(_0x10d299[_0x6e70('0x54')]));}return getConnection(_0x4d47e1)[_0x6e70('0x28')](function(_0x346c79){_0x5b1e6f=_0x346c79;return getUser(_0x4d47e1,_0x30cd88[_0x6e70('0x55')],_0x5b1e6f);})['then'](function(_0x5f5b02){_0x1e23c5=_0x5f5b02;logger['info'](_0x6e70('0x56'),_0x1e23c5['id']);return getEndUser(_0x4d47e1,_0x10d299[_0x6e70('0x65')],_0x10d299[_0x6e70('0x66')],_0x5b1e6f);})['then'](function(_0x58cf1c){_0x2bf9ec=_0x58cf1c;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x2bf9ec['id']);return createTicket(_0x4d47e1,_0x1e23c5,_0x2bf9ec,_0x739946,_0x10d299,_0x739946[_0x6e70('0x5a')],_0x5b1e6f);})[_0x6e70('0x28')](function(_0x2285f1){_0x2ad395=_0x2285f1;logger[_0x6e70('0x1b')]('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x2ad395['id']);var _0x30d11b=util[_0x6e70('0x24')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x4d47e1[_0x6e70('0x40')],_['split'](_0x2ad395['id'],'x')[0x1]);logger['info'](_0x6e70('0x63'),_0x6e70('0x5e'));emit(util[_0x6e70('0x24')](_0x6e70('0x68'),_0x30cd88[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x30d11b});})['catch'](function(_0x370eeb){logger[_0x6e70('0x2d')](_0x6e70('0x63'),JSON[_0x6e70('0x27')](_0x370eeb));});};exports[_0x6e70('0x69')]=function(_0x13c092,_0x363722,_0xd9b4a9,_0x2f1362,_0x29621a,_0x575938){var _0x44c877,_0x303c5a,_0x577c3b,_0x5d398a;_0x575938['remoteUri']=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x40')]);_0x575938[_0x6e70('0x53')]=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x53')]);if(_0x29621a&&_0x29621a['monitor_format']){logger['info']('['+_0x363722[_0x6e70('0x6a')][_0x6e70('0x6b')]()+']','Recording\x20is\x20enabled!');_0x363722[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x575938[_0x6e70('0x53')],_0x363722[_0x6e70('0x54')],md5(_0x363722[_0x6e70('0x54')]));}else{_0x363722[_0x6e70('0x51')]='';}return getConnection(_0x575938)[_0x6e70('0x28')](function(_0x3650e9){_0x5d398a=_0x3650e9;return getUser(_0x575938,'',_0x5d398a);})[_0x6e70('0x28')](function(_0x347cc4){_0x44c877=_0x347cc4;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x44c877['id']);return getEndUser(_0x575938,_0x363722[_0x6e70('0x57')],_0x363722['calleridnum'],_0x5d398a);})['then'](function(_0x39ed95){_0x303c5a=_0x39ed95;logger['info'](_0x6e70('0x59'),_0x303c5a['id']);return createTicket(_0x575938,_0x44c877,_0x303c5a,_0xd9b4a9,_0x363722,_0xd9b4a9['Fields'],_0x5d398a);})['then'](function(_0x402f6f){_0x577c3b=_0x402f6f;logger['info']('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x577c3b['id']);})[_0x6e70('0x48')](function(_0x4e9fda){logger['error']('['+_0x363722['lastevent'][_0x6e70('0x6b')]()+']',JSON['stringify'](_0x4e9fda));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index 1a0cb16..68d86b7 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 _0xad9a=['lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','inspect','request-promise','md5','util','ioredis','./util','redis','defaults','localhost','socket.io-emitter','emit','application/json','info','format','%s/tickets.json','POST','merge','getString','Subjects','Descriptions','Fields','then','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','remoteUri','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','filter','end-user','length','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s:%s','username','token','%s/token:%s','Basic\x20%s','toString','debug','[HTTP]','stringify','GET','map','includes','string','type','nameField','toLowerCase','content','picklist','custom_fields','idField','variable','variableName','customVariable','Variable','name','push','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','%s/channels/voice/agents/%d/tickets/%d/display.json','replace','/api/v2','error','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','Authorization','destcalleridname','destcalleridnum','Displaying\x20ticket\x20to\x20agent...','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','%s/agent/tickets/%s','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged'];(function(_0x454d94,_0x2d5642){var _0x1389b0=function(_0x1202ad){while(--_0x1202ad){_0x454d94['push'](_0x454d94['shift']());}};_0x1389b0(++_0x2d5642);}(_0xad9a,0x1c8));var _0xaad9=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xad9a[_0x47b58b];return _0x46bebe;};'use strict';var _=require('lodash');var rp=require(_0xaad9('0x0'));var md5=require(_0xaad9('0x1'));var util=require(_0xaad9('0x2'));var Redis=require(_0xaad9('0x3'));var intUtil=require(_0xaad9('0x4'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')('zendesk');config[_0xaad9('0x5')]=_[_0xaad9('0x6')](config[_0xaad9('0x5')],{'host':_0xaad9('0x7'),'port':0x18eb});var io=require(_0xaad9('0x8'))(new Redis(config['redis']));function emit(_0x1bd2e3,_0x277dbc,_0x102766){io['to'](_0x1bd2e3)[_0xaad9('0x9')](_0x277dbc,_0x102766);}var headers={'Content-Type':'application/json','Accept':_0xaad9('0xa')};function getTicket(_0x5bc57f,_0x182198,_0x5557d5,_0x2b5436,_0x2b16be){logger[_0xaad9('0xb')]('Creating\x20new\x20ticket...');return request({'uri':util[_0xaad9('0xc')](_0xaad9('0xd'),_0x5bc57f['remoteUri']),'method':_0xaad9('0xe'),'body':{'ticket':_[_0xaad9('0xf')]({'requester_id':_0x5557d5['id'],'submitter_id':_0x182198?_0x182198['id']:undefined,'assignee_id':_0x182198?_0x182198['id']:undefined,'tags':getTags(_0x2b5436['Tags'],'name'),'subject':intUtil[_0xaad9('0x10')](_0x2b5436[_0xaad9('0x11')],_0x2b16be,'\x20'),'description':intUtil[_0xaad9('0x10')](_0x2b5436[_0xaad9('0x12')],_0x2b16be,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x2b5436['Descriptions'],_0x2b16be,'\x0a')}},getCustomFields(_0x2b5436[_0xaad9('0x13')],_0x2b16be))}})[_0xaad9('0x14')](function(_0x2c72b0){logger[_0xaad9('0xb')](_0xaad9('0x15'));return _0x2c72b0[_0xaad9('0x16')];});}function getUser(_0x543df4,_0x4860a3){if(intUtil[_0xaad9('0x17')](_0x4860a3)){logger['info'](_0xaad9('0x18'),_0x4860a3);return request({'uri':util[_0xaad9('0xc')](_0xaad9('0x19'),_0x543df4[_0xaad9('0x1a')]),'qs':{'query':util[_0xaad9('0xc')](_0xaad9('0x1b'),_0x4860a3)}})[_0xaad9('0x14')](function(_0x583ee0){if(_0x583ee0[_0xaad9('0x1c')]){logger[_0xaad9('0xb')](_0xaad9('0x1d'));return _[_0xaad9('0x1e')](_0x583ee0[_0xaad9('0x1f')],{'email':_0x4860a3,'role':_0xaad9('0x20')});}else{logger[_0xaad9('0xb')](_0xaad9('0x21'));return request({'uri':util['format'](_0xaad9('0x22'),_0x543df4['remoteUri'])})['then'](function(_0x159b4b){logger[_0xaad9('0xb')](_0xaad9('0x23'));return _0x159b4b[_0xaad9('0x24')];});}});}else{logger[_0xaad9('0xb')](_0xaad9('0x21'));return request({'uri':util[_0xaad9('0xc')]('%s/users/me.json',_0x543df4[_0xaad9('0x1a')])})['then'](function(_0x1fe2a0){logger[_0xaad9('0xb')]('Admin\x20account\x20selected.');return _0x1fe2a0[_0xaad9('0x24')];});}}function getEndUser(_0x5460a9,_0x2b56aa,_0x58dce7){logger[_0xaad9('0xb')](_0xaad9('0x25'),_0x58dce7);return request({'uri':util[_0xaad9('0xc')](_0xaad9('0x19'),_0x5460a9['remoteUri']),'qs':{'query':util[_0xaad9('0xc')]('type:user\x20role:end-user\x20phone:%s',_0x58dce7)}})[_0xaad9('0x14')](function(_0x318088){var _0x11466f;if(_0x318088['results']['length']){_0x318088['results']=_[_0xaad9('0x26')](_0x318088[_0xaad9('0x1f')],{'suspended':![],'role':_0xaad9('0x27')});if(_0x318088[_0xaad9('0x1f')][_0xaad9('0x28')]){_0x11466f=_['first'](_0x318088[_0xaad9('0x1f')]);}}if(_0x11466f){logger[_0xaad9('0xb')](_0xaad9('0x29'));return _0x11466f;}else{logger['info'](_0xaad9('0x2a'));return request({'uri':util[_0xaad9('0xc')](_0xaad9('0x2b'),_0x5460a9[_0xaad9('0x1a')]),'method':_0xaad9('0xe'),'body':{'user':{'role':_0xaad9('0x27'),'name':util[_0xaad9('0xc')](_0xaad9('0x2c'),_0x2b56aa||_0x58dce7),'phone':_0x58dce7}}})[_0xaad9('0x14')](function(_0x71eba9){logger[_0xaad9('0xb')](_0xaad9('0x2d'));return _0x71eba9['user'];});}});}function getAuth(_0x85d3c4){var _0x15cb6e;if(_0x85d3c4[_0xaad9('0x2e')]===_0xaad9('0x2f')){_0x15cb6e=util[_0xaad9('0xc')](_0xaad9('0x30'),_0x85d3c4[_0xaad9('0x31')],_0x85d3c4['password']);}else if(_0x85d3c4[_0xaad9('0x2e')]===_0xaad9('0x32')){_0x15cb6e=util['format'](_0xaad9('0x33'),_0x85d3c4[_0xaad9('0x31')],_0x85d3c4[_0xaad9('0x32')]);}return util[_0xaad9('0xc')](_0xaad9('0x34'),new Buffer(_0x15cb6e)[_0xaad9('0x35')]('base64'));}function request(_0x29ca25){logger[_0xaad9('0x36')](_0xaad9('0x37'),JSON[_0xaad9('0x38')](_0x29ca25));return rp(_[_0xaad9('0x6')](_0x29ca25,{'method':_0xaad9('0x39'),'headers':headers,'json':!![]}));}function getTags(_0xd1c648,_0xd9ed41){var _0x2b0a12=[];if(_0xd1c648&&_0xd1c648[_0xaad9('0x28')]>0x0){_0x2b0a12=_[_0xaad9('0x3a')](_0xd1c648,_0xd9ed41);}return _0x2b0a12;}function getCustomFields(_0x36ba3e,_0x40cab2){var _0x656f5f=[];var _0x46a525={'custom_fields':[]};if(_0x36ba3e[_0xaad9('0x28')]>0x0){_['forEach'](_0x36ba3e,function(_0xeff407){if(_[_0xaad9('0x3b')]([_0xaad9('0x3c'),'picklist'],_0xeff407[_0xaad9('0x3d')])&&_0xeff407[_0xaad9('0x3e')]&&!_0xeff407['customField']){_0x46a525[_0xeff407[_0xaad9('0x3e')][_0xaad9('0x3f')]()]=_0xeff407[_0xaad9('0x40')][_0xaad9('0x35')]();}else if(_[_0xaad9('0x3b')](['string',_0xaad9('0x41')],_0xeff407[_0xaad9('0x3d')])&&_0xeff407['idField']&&_0xeff407['customField']){_0x46a525[_0xaad9('0x42')]['push']({'id':_0xeff407[_0xaad9('0x43')],'value':_0xeff407[_0xaad9('0x40')]['toString']()});}else if(_0xeff407[_0xaad9('0x3d')]===_0xaad9('0x44')&&_0xeff407[_0xaad9('0x45')]&&_0xeff407[_0xaad9('0x43')]&&_0xeff407['customField']){_0x40cab2[_0xeff407[_0xaad9('0x45')]]&&_0x46a525[_0xaad9('0x42')]['push']({'id':_0xeff407[_0xaad9('0x43')],'value':_0x40cab2[_0xeff407[_0xaad9('0x45')]][_0xaad9('0x35')]()});}else if(_0xeff407[_0xaad9('0x3d')]===_0xaad9('0x46')&&_0xeff407[_0xaad9('0x47')]&&_0xeff407[_0xaad9('0x47')][_0xaad9('0x48')]&&_0xeff407[_0xaad9('0x43')]&&_0xeff407['customField']){_0x40cab2[_0xeff407[_0xaad9('0x47')][_0xaad9('0x48')][_0xaad9('0x3f')]()]&&_0x46a525[_0xaad9('0x42')][_0xaad9('0x49')]({'id':_0xeff407[_0xaad9('0x43')],'value':_0x40cab2[_0xeff407[_0xaad9('0x47')][_0xaad9('0x48')]['toLowerCase']()][_0xaad9('0x35')]()});}});}return _0x46a525;}exports[_0xaad9('0x4a')]=function(_0x1a03fe,_0x13b2f1,_0x43429c,_0x4e1ad8,_0x4b6b5c,_0x59abe8){var _0x367ca8,_0x2553f1;_0x59abe8['remoteUri']=intUtil[_0xaad9('0x4b')](_0x59abe8[_0xaad9('0x1a')]);_0x59abe8[_0xaad9('0x4c')]=intUtil['stripTrailingSlash'](_0x59abe8[_0xaad9('0x4c')]);if(_0x4b6b5c&&_0x4b6b5c[_0xaad9('0x4d')]){logger[_0xaad9('0xb')](_0xaad9('0x4e'),_0xaad9('0x4f'));_0x13b2f1[_0xaad9('0x50')]=util[_0xaad9('0xc')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x59abe8[_0xaad9('0x4c')],_0x13b2f1[_0xaad9('0x51')],md5(_0x13b2f1[_0xaad9('0x51')]));}else{_0x13b2f1[_0xaad9('0x50')]='';}headers['Authorization']=getAuth(_0x59abe8);return getUser(_0x59abe8,_0x4e1ad8[_0xaad9('0x52')])['then'](function(_0x4f9e11){_0x367ca8=_0x4f9e11;logger[_0xaad9('0xb')](_0xaad9('0x53'),_0x367ca8['id']);return getEndUser(_0x59abe8,_0x13b2f1[_0xaad9('0x54')],_0x13b2f1[_0xaad9('0x55')]);})[_0xaad9('0x14')](function(_0x2975dd){_0x2553f1=_0x2975dd;logger[_0xaad9('0xb')](_0xaad9('0x56'),_0x2553f1['id']);return getTicket(_0x59abe8,_0x367ca8,_0x2553f1,_0x43429c,_0x13b2f1);})[_0xaad9('0x14')](function(_0x2a475f){if(_0x2a475f){logger['info'](_0xaad9('0x57'),_0x2a475f['id']);switch(_0x59abe8[_0xaad9('0x3d')]){case _0xaad9('0x58'):logger['info'](_0xaad9('0x4e'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0xaad9('0xc')](_0xaad9('0x59'),_0x59abe8[_0xaad9('0x1a')],_0x367ca8['id'],_0x2a475f['id']),'method':_0xaad9('0xe')});case'newTab':logger[_0xaad9('0xb')](_0xaad9('0x4e'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xaad9('0xc')]('user:%s',_0x4e1ad8['name']),'trigger:browser:url',{'uri':util[_0xaad9('0xc')]('%s/agent/tickets/%s',_0x59abe8[_0xaad9('0x1a')][_0xaad9('0x5a')](_0xaad9('0x5b'),''),_0x2a475f['id'])});break;default:logger[_0xaad9('0x5c')](_0xaad9('0x4e'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0xaad9('0x5d')](function(_0x2a181b){logger[_0xaad9('0x5c')](_0xaad9('0x5e'),util['inspect'](_0x2a181b,{'showHidden':!![],'depth':null}));});};exports['outbound']=function(_0x54df4c,_0x14a67e,_0x161937,_0x3731af,_0x1c0372,_0x48c9e6,_0x191012){var _0x25cbb8,_0x4d180e;_0x48c9e6[_0xaad9('0x1a')]=intUtil[_0xaad9('0x4b')](_0x48c9e6['remoteUri']);_0x48c9e6[_0xaad9('0x4c')]=intUtil[_0xaad9('0x4b')](_0x48c9e6[_0xaad9('0x4c')]);if(_0x191012&&_0x191012[_0xaad9('0x5f')]&&_0x191012['recordingFormat']!==_0xaad9('0x60')){logger['info'](_0xaad9('0x61'),_0xaad9('0x4f'));_0x14a67e[_0xaad9('0x50')]=util[_0xaad9('0xc')](_0xaad9('0x62'),_0x48c9e6[_0xaad9('0x4c')],_0x14a67e[_0xaad9('0x51')],md5(_0x14a67e['uniqueid']));}headers[_0xaad9('0x63')]=getAuth(_0x48c9e6);return getUser(_0x48c9e6,_0x3731af[_0xaad9('0x52')])['then'](function(_0x35aafa){_0x25cbb8=_0x35aafa;logger[_0xaad9('0xb')](_0xaad9('0x53'),_0x25cbb8['id']);return getEndUser(_0x48c9e6,_0x14a67e[_0xaad9('0x64')],_0x14a67e[_0xaad9('0x65')]);})[_0xaad9('0x14')](function(_0x236db8){_0x4d180e=_0x236db8;logger[_0xaad9('0xb')](_0xaad9('0x56'),_0x4d180e['id']);return getTicket(_0x48c9e6,_0x25cbb8,_0x4d180e,_0x161937,_0x14a67e);})[_0xaad9('0x14')](function(_0x5d285e){if(_0x5d285e){logger[_0xaad9('0xb')](_0xaad9('0x57'),_0x5d285e['id']);switch(_0x48c9e6[_0xaad9('0x3d')]){case _0xaad9('0x58'):logger[_0xaad9('0xb')](_0xaad9('0x61'),_0xaad9('0x66'));return request({'uri':util['format'](_0xaad9('0x59'),_0x48c9e6[_0xaad9('0x1a')],_0x25cbb8['id'],_0x5d285e['id']),'method':_0xaad9('0xe')});case _0xaad9('0x67'):logger[_0xaad9('0xb')](_0xaad9('0x61'),_0xaad9('0x68'));emit(util['format']('user:%s',_0x3731af[_0xaad9('0x48')]),_0xaad9('0x69'),{'uri':util[_0xaad9('0xc')](_0xaad9('0x6a'),_0x48c9e6[_0xaad9('0x1a')][_0xaad9('0x5a')](_0xaad9('0x5b'),''),_0x5d285e['id'])});break;default:logger[_0xaad9('0x5c')]('[OUTBOUND]','Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0xaad9('0x5d')](function(_0x1662d8){logger[_0xaad9('0x5c')](_0xaad9('0x6b'),util['inspect'](_0x1662d8,{'showHidden':!![],'depth':null}));});};exports[_0xaad9('0x6c')]=function(_0x5407d0,_0x597176,_0x45b557,_0x52f6e3,_0x8cd7a4,_0x3c65c2){var _0x34c5fd,_0x5b690d;_0x3c65c2[_0xaad9('0x1a')]=intUtil[_0xaad9('0x4b')](_0x3c65c2['remoteUri']);_0x3c65c2[_0xaad9('0x4c')]=intUtil[_0xaad9('0x4b')](_0x3c65c2[_0xaad9('0x4c')]);if(_0x8cd7a4&&_0x8cd7a4[_0xaad9('0x4d')]){logger['info']('['+_0x597176[_0xaad9('0x6d')][_0xaad9('0x6e')]()+']','Recording\x20is\x20enabled!');_0x597176[_0xaad9('0x50')]=util[_0xaad9('0xc')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3c65c2[_0xaad9('0x4c')],_0x597176[_0xaad9('0x51')],md5(_0x597176[_0xaad9('0x51')]));}else{_0x597176[_0xaad9('0x50')]='';}headers[_0xaad9('0x63')]=getAuth(_0x3c65c2);return getUser(_0x3c65c2)[_0xaad9('0x14')](function(_0x69aea5){_0x34c5fd=_0x69aea5;logger[_0xaad9('0xb')](_0xaad9('0x53'),_0x34c5fd['id']);return getEndUser(_0x3c65c2,_0x597176['calleridname'],_0x597176['calleridnum']);})[_0xaad9('0x14')](function(_0xaecdde){_0x5b690d=_0xaecdde;logger['info']('The\x20Enduser\x20ID\x20is:',_0x5b690d['id']);return getTicket(_0x3c65c2,_0x34c5fd,_0x5b690d,_0x45b557,_0x597176);})['then'](function(_0x274b65){if(_0x274b65){logger[_0xaad9('0xb')]('The\x20Ticket\x20ID\x20is:',_0x274b65['id']);}})[_0xaad9('0x5d')](function(_0x4ec109){logger[_0xaad9('0x5c')]('['+_0x597176[_0xaad9('0x6d')][_0xaad9('0x6e')]()+']'+_0xaad9('0x6f'),util[_0xaad9('0x70')](_0x4ec109,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x9992=['/api/v2','error','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','trigger:browser:url','%s/agent/tickets/%s','Zendesk\x20account\x20type\x20not\x20recognized','catch','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','lastevent','toUpperCase','calleridname','\x20Error\x20running\x20Zendesk\x20integration','lodash','md5','ioredis','../../../../config/environment','zendesk','defaults','redis','socket.io-emitter','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','Tags','name','Descriptions','Fields','then','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','count','Agent\x20found!','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','user','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','results','filter','end-user','length','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','POST','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s:%s','username','%s/token:%s','Basic\x20%s','toString','base64','debug','[HTTP]','GET','map','includes','string','picklist','type','nameField','toLowerCase','content','customField','custom_fields','push','idField','variableName','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','replace'];(function(_0xf4d243,_0x51c5cc){var _0x2d9b01=function(_0x1cda1a){while(--_0x1cda1a){_0xf4d243['push'](_0xf4d243['shift']());}};_0x2d9b01(++_0x51c5cc);}(_0x9992,0xee));var _0x2999=function(_0x5ef161,_0x27d16c){_0x5ef161=_0x5ef161-0x0;var _0x1c6e9e=_0x9992[_0x5ef161];return _0x1c6e9e;};'use strict';var _=require(_0x2999('0x0'));var rp=require('request-promise');var md5=require(_0x2999('0x1'));var util=require('util');var Redis=require(_0x2999('0x2'));var intUtil=require('./util');var config=require(_0x2999('0x3'));var logger=require('../../../../config/logger')(_0x2999('0x4'));config['redis']=_[_0x2999('0x5')](config[_0x2999('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x2999('0x7'))(new Redis(config[_0x2999('0x6')]));function emit(_0x3705a0,_0x4fd85b,_0x587f0c){io['to'](_0x3705a0)['emit'](_0x4fd85b,_0x587f0c);}var headers={'Content-Type':_0x2999('0x8'),'Accept':_0x2999('0x8')};function getTicket(_0x20c7eb,_0x3a5e98,_0x3abeca,_0x122eb4,_0x2b1dd2){logger[_0x2999('0x9')](_0x2999('0xa'));return request({'uri':util[_0x2999('0xb')](_0x2999('0xc'),_0x20c7eb[_0x2999('0xd')]),'method':'POST','body':{'ticket':_['merge']({'requester_id':_0x3abeca['id'],'submitter_id':_0x3a5e98?_0x3a5e98['id']:undefined,'assignee_id':_0x3a5e98?_0x3a5e98['id']:undefined,'tags':getTags(_0x122eb4[_0x2999('0xe')],_0x2999('0xf')),'subject':intUtil['getString'](_0x122eb4['Subjects'],_0x2b1dd2,'\x20'),'description':intUtil['getString'](_0x122eb4[_0x2999('0x10')],_0x2b1dd2,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x122eb4[_0x2999('0x10')],_0x2b1dd2,'\x0a')}},getCustomFields(_0x122eb4[_0x2999('0x11')],_0x2b1dd2))}})[_0x2999('0x12')](function(_0x2edb04){logger[_0x2999('0x9')](_0x2999('0x13'));return _0x2edb04[_0x2999('0x14')];});}function getUser(_0x4405e9,_0x195ed2){if(intUtil[_0x2999('0x15')](_0x195ed2)){logger[_0x2999('0x9')](_0x2999('0x16'),_0x195ed2);return request({'uri':util[_0x2999('0xb')](_0x2999('0x17'),_0x4405e9[_0x2999('0xd')]),'qs':{'query':util[_0x2999('0xb')]('type:user\x20role:agent\x20email:%s',_0x195ed2)}})[_0x2999('0x12')](function(_0x23617e){if(_0x23617e[_0x2999('0x18')]){logger[_0x2999('0x9')](_0x2999('0x19'));return _['find'](_0x23617e['results'],{'email':_0x195ed2,'role':_0x2999('0x1a')});}else{logger[_0x2999('0x9')](_0x2999('0x1b'));return request({'uri':util[_0x2999('0xb')](_0x2999('0x1c'),_0x4405e9[_0x2999('0xd')])})['then'](function(_0x19d63f){logger[_0x2999('0x9')]('Admin\x20account\x20selected.');return _0x19d63f[_0x2999('0x1d')];});}});}else{logger[_0x2999('0x9')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x2999('0xb')](_0x2999('0x1c'),_0x4405e9[_0x2999('0xd')])})[_0x2999('0x12')](function(_0xeceaf1){logger[_0x2999('0x9')](_0x2999('0x1e'));return _0xeceaf1['user'];});}}function getEndUser(_0x4ad566,_0x2d921b,_0x377fef){logger[_0x2999('0x9')](_0x2999('0x1f'),_0x377fef);return request({'uri':util[_0x2999('0xb')]('%s/search.json',_0x4ad566[_0x2999('0xd')]),'qs':{'query':util['format'](_0x2999('0x20'),_0x377fef)}})[_0x2999('0x12')](function(_0x31bc5c){var _0x4062fc;if(_0x31bc5c[_0x2999('0x21')]['length']){_0x31bc5c[_0x2999('0x21')]=_[_0x2999('0x22')](_0x31bc5c[_0x2999('0x21')],{'suspended':![],'role':_0x2999('0x23')});if(_0x31bc5c[_0x2999('0x21')][_0x2999('0x24')]){_0x4062fc=_[_0x2999('0x25')](_0x31bc5c['results']);}}if(_0x4062fc){logger[_0x2999('0x9')](_0x2999('0x26'));return _0x4062fc;}else{logger[_0x2999('0x9')](_0x2999('0x27'));return request({'uri':util['format'](_0x2999('0x28'),_0x4ad566[_0x2999('0xd')]),'method':_0x2999('0x29'),'body':{'user':{'role':'end-user','name':util[_0x2999('0xb')](_0x2999('0x2a'),_0x2d921b||_0x377fef),'phone':_0x377fef}}})['then'](function(_0x319c2d){logger[_0x2999('0x9')](_0x2999('0x2b'));return _0x319c2d[_0x2999('0x1d')];});}});}function getAuth(_0x47356d){var _0x502e90;if(_0x47356d[_0x2999('0x2c')]===_0x2999('0x2d')){_0x502e90=util[_0x2999('0xb')](_0x2999('0x2e'),_0x47356d[_0x2999('0x2f')],_0x47356d[_0x2999('0x2d')]);}else if(_0x47356d[_0x2999('0x2c')]==='token'){_0x502e90=util[_0x2999('0xb')](_0x2999('0x30'),_0x47356d[_0x2999('0x2f')],_0x47356d['token']);}return util[_0x2999('0xb')](_0x2999('0x31'),new Buffer(_0x502e90)[_0x2999('0x32')](_0x2999('0x33')));}function request(_0x55e0ca){logger[_0x2999('0x34')](_0x2999('0x35'),JSON['stringify'](_0x55e0ca));return rp(_[_0x2999('0x5')](_0x55e0ca,{'method':_0x2999('0x36'),'headers':headers,'json':!![]}));}function getTags(_0x429393,_0x50275d){var _0x149294=[];if(_0x429393&&_0x429393[_0x2999('0x24')]>0x0){_0x149294=_[_0x2999('0x37')](_0x429393,_0x50275d);}return _0x149294;}function getCustomFields(_0x2cb20e,_0x599110){var _0x233e58=[];var _0x282281={'custom_fields':[]};if(_0x2cb20e[_0x2999('0x24')]>0x0){_['forEach'](_0x2cb20e,function(_0x1b0546){if(_[_0x2999('0x38')]([_0x2999('0x39'),_0x2999('0x3a')],_0x1b0546[_0x2999('0x3b')])&&_0x1b0546['nameField']&&!_0x1b0546['customField']){_0x282281[_0x1b0546[_0x2999('0x3c')][_0x2999('0x3d')]()]=_0x1b0546[_0x2999('0x3e')]['toString']();}else if(_['includes']([_0x2999('0x39'),_0x2999('0x3a')],_0x1b0546[_0x2999('0x3b')])&&_0x1b0546['idField']&&_0x1b0546[_0x2999('0x3f')]){_0x282281[_0x2999('0x40')][_0x2999('0x41')]({'id':_0x1b0546[_0x2999('0x42')],'value':_0x1b0546[_0x2999('0x3e')]['toString']()});}else if(_0x1b0546[_0x2999('0x3b')]==='variable'&&_0x1b0546[_0x2999('0x43')]&&_0x1b0546[_0x2999('0x42')]&&_0x1b0546[_0x2999('0x3f')]){_0x599110[_0x1b0546['variableName']]&&_0x282281['custom_fields']['push']({'id':_0x1b0546['idField'],'value':_0x599110[_0x1b0546[_0x2999('0x43')]][_0x2999('0x32')]()});}else if(_0x1b0546[_0x2999('0x3b')]==='customVariable'&&_0x1b0546[_0x2999('0x44')]&&_0x1b0546[_0x2999('0x44')][_0x2999('0xf')]&&_0x1b0546[_0x2999('0x42')]&&_0x1b0546['customField']){_0x599110[_0x1b0546[_0x2999('0x44')]['name'][_0x2999('0x3d')]()]&&_0x282281['custom_fields'][_0x2999('0x41')]({'id':_0x1b0546['idField'],'value':_0x599110[_0x1b0546[_0x2999('0x44')][_0x2999('0xf')][_0x2999('0x3d')]()][_0x2999('0x32')]()});}});}return _0x282281;}exports[_0x2999('0x45')]=function(_0x4216cd,_0x310f7c,_0x5b8753,_0x1e712d,_0x548d7a,_0x47fcab){var _0x35fb74,_0x5c9134;_0x47fcab[_0x2999('0xd')]=intUtil[_0x2999('0x46')](_0x47fcab[_0x2999('0xd')]);_0x47fcab[_0x2999('0x47')]=intUtil['stripTrailingSlash'](_0x47fcab[_0x2999('0x47')]);if(_0x548d7a&&_0x548d7a[_0x2999('0x48')]){logger[_0x2999('0x9')](_0x2999('0x49'),_0x2999('0x4a'));_0x310f7c[_0x2999('0x4b')]=util[_0x2999('0xb')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x47fcab[_0x2999('0x47')],_0x310f7c[_0x2999('0x4c')],md5(_0x310f7c['uniqueid']));}else{_0x310f7c['recordingURL']='';}headers[_0x2999('0x4d')]=getAuth(_0x47fcab);return getUser(_0x47fcab,_0x1e712d[_0x2999('0x4e')])[_0x2999('0x12')](function(_0x553b1a){_0x35fb74=_0x553b1a;logger['info'](_0x2999('0x4f'),_0x35fb74['id']);return getEndUser(_0x47fcab,_0x310f7c['calleridname'],_0x310f7c[_0x2999('0x50')]);})['then'](function(_0x1da1a9){_0x5c9134=_0x1da1a9;logger['info'](_0x2999('0x51'),_0x5c9134['id']);return getTicket(_0x47fcab,_0x35fb74,_0x5c9134,_0x5b8753,_0x310f7c);})[_0x2999('0x12')](function(_0x30e2b4){if(_0x30e2b4){logger[_0x2999('0x9')](_0x2999('0x52'),_0x30e2b4['id']);switch(_0x47fcab[_0x2999('0x3b')]){case _0x2999('0x53'):logger[_0x2999('0x9')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x2999('0xb')](_0x2999('0x54'),_0x47fcab[_0x2999('0xd')],_0x35fb74['id'],_0x30e2b4['id']),'method':_0x2999('0x29')});case _0x2999('0x55'):logger[_0x2999('0x9')](_0x2999('0x49'),_0x2999('0x56'));emit(util[_0x2999('0xb')](_0x2999('0x57'),_0x1e712d[_0x2999('0xf')]),'trigger:browser:url',{'uri':util[_0x2999('0xb')]('%s/agent/tickets/%s',_0x47fcab[_0x2999('0xd')][_0x2999('0x58')](_0x2999('0x59'),''),_0x30e2b4['id'])});break;default:logger[_0x2999('0x5a')](_0x2999('0x49'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})['catch'](function(_0x3892a0){logger[_0x2999('0x5a')](_0x2999('0x5b'),util[_0x2999('0x5c')](_0x3892a0,{'showHidden':!![],'depth':null}));});};exports[_0x2999('0x5d')]=function(_0x472bc8,_0x53eb72,_0x572cb0,_0x527928,_0x5b258d,_0x37cd20,_0x272ef0){var _0x289ec9,_0x1668b8;_0x37cd20[_0x2999('0xd')]=intUtil[_0x2999('0x46')](_0x37cd20[_0x2999('0xd')]);_0x37cd20[_0x2999('0x47')]=intUtil[_0x2999('0x46')](_0x37cd20[_0x2999('0x47')]);if(_0x272ef0&&_0x272ef0[_0x2999('0x5e')]&&_0x272ef0[_0x2999('0x5e')]!==_0x2999('0x5f')){logger[_0x2999('0x9')](_0x2999('0x60'),_0x2999('0x4a'));_0x53eb72[_0x2999('0x4b')]=util[_0x2999('0xb')](_0x2999('0x61'),_0x37cd20[_0x2999('0x47')],_0x53eb72['uniqueid'],md5(_0x53eb72[_0x2999('0x4c')]));}headers[_0x2999('0x4d')]=getAuth(_0x37cd20);return getUser(_0x37cd20,_0x527928[_0x2999('0x4e')])[_0x2999('0x12')](function(_0x25b734){_0x289ec9=_0x25b734;logger['info'](_0x2999('0x4f'),_0x289ec9['id']);return getEndUser(_0x37cd20,_0x53eb72[_0x2999('0x62')],_0x53eb72[_0x2999('0x63')]);})['then'](function(_0x53f9a3){_0x1668b8=_0x53f9a3;logger[_0x2999('0x9')](_0x2999('0x51'),_0x1668b8['id']);return getTicket(_0x37cd20,_0x289ec9,_0x1668b8,_0x572cb0,_0x53eb72);})[_0x2999('0x12')](function(_0x440dd5){if(_0x440dd5){logger['info'](_0x2999('0x52'),_0x440dd5['id']);switch(_0x37cd20[_0x2999('0x3b')]){case _0x2999('0x53'):logger[_0x2999('0x9')](_0x2999('0x60'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util['format'](_0x2999('0x54'),_0x37cd20[_0x2999('0xd')],_0x289ec9['id'],_0x440dd5['id']),'method':_0x2999('0x29')});case _0x2999('0x55'):logger['info'](_0x2999('0x60'),_0x2999('0x56'));emit(util[_0x2999('0xb')](_0x2999('0x57'),_0x527928[_0x2999('0xf')]),_0x2999('0x64'),{'uri':util[_0x2999('0xb')](_0x2999('0x65'),_0x37cd20[_0x2999('0xd')][_0x2999('0x58')](_0x2999('0x59'),''),_0x440dd5['id'])});break;default:logger[_0x2999('0x5a')](_0x2999('0x60'),_0x2999('0x66'));}}})[_0x2999('0x67')](function(_0x1ba142){logger[_0x2999('0x5a')](_0x2999('0x68'),util[_0x2999('0x5c')](_0x1ba142,{'showHidden':!![],'depth':null}));});};exports['unmanaged']=function(_0x321b1e,_0x383f32,_0x3ecd2d,_0x1e7f49,_0x4f446c,_0x1b19b7){var _0x1a7b76,_0x24d602;_0x1b19b7[_0x2999('0xd')]=intUtil[_0x2999('0x46')](_0x1b19b7[_0x2999('0xd')]);_0x1b19b7[_0x2999('0x47')]=intUtil[_0x2999('0x46')](_0x1b19b7[_0x2999('0x47')]);if(_0x4f446c&&_0x4f446c['monitor_format']){logger[_0x2999('0x9')]('['+_0x383f32[_0x2999('0x69')][_0x2999('0x6a')]()+']',_0x2999('0x4a'));_0x383f32[_0x2999('0x4b')]=util['format'](_0x2999('0x61'),_0x1b19b7[_0x2999('0x47')],_0x383f32[_0x2999('0x4c')],md5(_0x383f32[_0x2999('0x4c')]));}else{_0x383f32['recordingURL']='';}headers[_0x2999('0x4d')]=getAuth(_0x1b19b7);return getUser(_0x1b19b7)[_0x2999('0x12')](function(_0x3816db){_0x1a7b76=_0x3816db;logger[_0x2999('0x9')]('The\x20User\x20ID\x20is:',_0x1a7b76['id']);return getEndUser(_0x1b19b7,_0x383f32[_0x2999('0x6b')],_0x383f32[_0x2999('0x50')]);})[_0x2999('0x12')](function(_0x4cc8f8){_0x24d602=_0x4cc8f8;logger[_0x2999('0x9')](_0x2999('0x51'),_0x24d602['id']);return getTicket(_0x1b19b7,_0x1a7b76,_0x24d602,_0x3ecd2d,_0x383f32);})[_0x2999('0x12')](function(_0x1a7da3){if(_0x1a7da3){logger['info'](_0x2999('0x52'),_0x1a7da3['id']);}})[_0x2999('0x67')](function(_0x24d5ed){logger[_0x2999('0x5a')]('['+_0x383f32[_0x2999('0x69')][_0x2999('0x6a')]()+']'+_0x2999('0x6c'),util['inspect'](_0x24d5ed,{'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 8392a8c..4bb5c2d 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 _0xcc66=['starttime','called','Call_Result','Called','complete','connect','rejected','abandoned','timeout','Timeout','outbound','agentcalledAt','Call_Type','Inbound','merge','Fields','/crm/v2/Calls','err','stripTrailingSlash','serverUrl','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','/downloads?type=uniqueid&token=','host','zoho.eu','com','calleridname','calleridnum','The\x20Call\x20ID\x20is:','[QUEUE]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://crm.','recordingFormat','none','[OUTBOUND]','uniqueid','destcalleridnum','Outbound','user:%s','/crm/EntityInfo.do?module=Calls&id=','monitor_format','lastevent','toUpperCase','lodash','request-promise','md5','util','./util','moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','emit','stringify','length','includes','string','picklist','type','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','split','isNil','access_token','isBefore','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','refreshToken','clientId','refresh_token','add','expires_in','seconds','catch','error','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','Zoho-oauthtoken\x20','then','users','email','Agent\x20found!','Using\x20the\x20admin\x20account!','findIndex','profile','Administrator','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','code','SUCCESS','details','log','CREATE\x20ERROR','moduleSearch','contact_lead','uri','https://www.zohoapis.','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','Leads','contact','nothing','lead','/crm/v2/Leads/search?criteria=((Phone:equals:','Creating\x20new\x20call...','administrator','Subject','getString','Subjects','Description','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','Call_Duration','talktime','mm:ss','utc','endtime','YYYY-MM-DDTHH:mm:ss','diff'];(function(_0x44e012,_0x1bd12b){var _0x263432=function(_0x2b0131){while(--_0x2b0131){_0x44e012['push'](_0x44e012['shift']());}};_0x263432(++_0x1bd12b);}(_0xcc66,0x163));var _0x6cc6=function(_0x4e4da4,_0x511775){_0x4e4da4=_0x4e4da4-0x0;var _0x4b2cc0=_0xcc66[_0x4e4da4];return _0x4b2cc0;};'use strict';var _=require(_0x6cc6('0x0'));var rp=require(_0x6cc6('0x1'));var md5=require(_0x6cc6('0x2'));var util=require(_0x6cc6('0x3'));var intUtil=require(_0x6cc6('0x4'));var moment=require(_0x6cc6('0x5'));var Redis=require(_0x6cc6('0x6'));var BPromise=require(_0x6cc6('0x7'));var config=require(_0x6cc6('0x8'));var logger=require(_0x6cc6('0x9'))('zoho');config[_0x6cc6('0xa')]=_[_0x6cc6('0xb')](config[_0x6cc6('0xa')],{'host':_0x6cc6('0xc'),'port':0x18eb});var io=require(_0x6cc6('0xd'))(new Redis(config[_0x6cc6('0xa')]));function emit(_0x5c59bf,_0x12f9b6,_0x45defe){io['to'](_0x5c59bf)[_0x6cc6('0xe')](_0x12f9b6,_0x45defe);}function request(_0x47a7d3){logger['debug']('[HTTP]',JSON[_0x6cc6('0xf')](_0x47a7d3));return rp(_0x47a7d3);}function getCustomFields(_0x3be26e,_0x2e0f0a){var _0x4ef508={};if(_0x3be26e[_0x6cc6('0x10')]>0x0){_['forEach'](_0x3be26e,function(_0x7ef4f){if(_[_0x6cc6('0x11')]([_0x6cc6('0x12'),_0x6cc6('0x13')],_0x7ef4f[_0x6cc6('0x14')])&&_0x7ef4f[_0x6cc6('0x15')]){_0x4ef508[_0x7ef4f['idField']]=_0x7ef4f[_0x6cc6('0x16')][_0x6cc6('0x17')]();}else if(_0x7ef4f[_0x6cc6('0x14')]===_0x6cc6('0x18')&&_0x7ef4f[_0x6cc6('0x19')]&&_0x7ef4f[_0x6cc6('0x15')]&&_0x2e0f0a[_0x7ef4f[_0x6cc6('0x19')]]){_0x4ef508[_0x7ef4f['idField']]=_0x2e0f0a[_0x7ef4f['variableName']][_0x6cc6('0x17')]();}else if(_0x7ef4f[_0x6cc6('0x14')]===_0x6cc6('0x1a')&&_0x7ef4f[_0x6cc6('0x1b')]&&_0x7ef4f[_0x6cc6('0x1b')]['name']&&_0x7ef4f['idField']&&_0x2e0f0a[_0x7ef4f[_0x6cc6('0x1b')][_0x6cc6('0x1c')]['toLowerCase']()]){_0x4ef508[_0x7ef4f['idField']]=_0x2e0f0a[_0x7ef4f[_0x6cc6('0x1b')][_0x6cc6('0x1c')][_0x6cc6('0x1d')]()][_0x6cc6('0x17')]();}});}return _0x4ef508;}function getName(_0x4818e7){if(_0x4818e7['indexOf']('\x20')>0x0){var _0x56b6ed=_0x4818e7[_0x6cc6('0x1e')](/ (.+)/);if(_0x56b6ed[0x1]){return _0x56b6ed;}}return[_0x4818e7,_0x4818e7];}var accountsTokens={};function getAccessToken(_0x1f922d){return new Promise(function(_0x42f1c8,_0x1ab369){if(!_['isNil'](accountsTokens[_0x1f922d['id']])&&!_[_0x6cc6('0x1f')](accountsTokens[_0x1f922d['id']][_0x6cc6('0x20')])){if(moment()[_0x6cc6('0x21')](accountsTokens[_0x1f922d['id']]['expires_in'])){_0x42f1c8(accountsTokens[_0x1f922d['id']]['access_token']);}}var _0x59775c;switch(_0x1f922d['zone']){case'US':_0x59775c=_0x6cc6('0x22');break;case'AU':_0x59775c=_0x6cc6('0x23');break;case'EU':_0x59775c=_0x6cc6('0x24');break;case'IN':_0x59775c=_0x6cc6('0x25');break;case'CN':_0x59775c=_0x6cc6('0x26');break;default:_0x59775c='https://accounts.zoho.eu';break;}var _0x1cb45b={'method':_0x6cc6('0x27'),'uri':_0x59775c+'/oauth/v2/token','qs':{'refresh_token':_0x1f922d[_0x6cc6('0x28')],'client_id':_0x1f922d[_0x6cc6('0x29')],'client_secret':_0x1f922d['clientSecret'],'grant_type':_0x6cc6('0x2a')},'json':!![]};return rp(_0x1cb45b)['then'](function(_0x328ecf){accountsTokens[_0x1f922d['id']]={'access_token':_0x328ecf[_0x6cc6('0x20')],'expires_in':moment()[_0x6cc6('0x2b')](_0x328ecf[_0x6cc6('0x2c')],_0x6cc6('0x2d'))};_0x42f1c8(_0x328ecf[_0x6cc6('0x20')]);})[_0x6cc6('0x2e')](function(_0x4f9234){logger[_0x6cc6('0x2f')](_0x6cc6('0x30'),_0x4f9234[_0x6cc6('0x31')]);_0x1ab369(_0x4f9234);});});}function getUser(_0x204c8d,_0x1c075e,_0x344e9c,_0x57bb8c){logger[_0x6cc6('0x32')](_0x6cc6('0x33'));return request({'method':_0x6cc6('0x34'),'uri':util[_0x6cc6('0x35')](_0x6cc6('0x36'),_0x1c075e),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':_0x6cc6('0x37')+_0x204c8d},'json':!![]})[_0x6cc6('0x38')](function(_0x1ea16e){if(_0x1ea16e['users']){var _0x262d34=-0x1;if(_['isArrayLikeObject'](_0x1ea16e['users'])){if(!_['isNil'](_0x57bb8c)){_0x262d34=_['findIndex'](_0x1ea16e[_0x6cc6('0x39')],function(_0x38cb91){return _0x38cb91[_0x6cc6('0x3a')]===_0x57bb8c;});}if(_0x262d34>=0x0){logger['info'](_0x6cc6('0x3b'));}else{logger[_0x6cc6('0x32')](_0x6cc6('0x3c'));_0x262d34=_[_0x6cc6('0x3d')](_0x1ea16e[_0x6cc6('0x39')],function(_0xddbf05){return _0xddbf05[_0x6cc6('0x3e')][_0x6cc6('0x1c')]===_0x6cc6('0x3f');});}return _0x1ea16e['users'][_0x262d34];}else{if(_0x1ea16e[_0x6cc6('0x40')][_0x6cc6('0x3e')][_0x6cc6('0x1c')]===_0x6cc6('0x3f')){logger[_0x6cc6('0x32')](_0x6cc6('0x3c'));user=_0x1ea16e['user'];return user;}else{logger[_0x6cc6('0x2f')](_0x6cc6('0x41'),JSON[_0x6cc6('0xf')](_0x1ea16e));throw new Error(_0x6cc6('0x42')+JSON[_0x6cc6('0xf')](_0x1ea16e));}}}else{logger[_0x6cc6('0x2f')](_0x6cc6('0x41'),JSON[_0x6cc6('0xf')](_0x1ea16e));throw new Error(_0x6cc6('0x42')+JSON[_0x6cc6('0xf')](_0x1ea16e));}})[_0x6cc6('0x2e')](function(_0x5a8e7){console[_0x6cc6('0x2f')](_0x5a8e7);});}function getZohoUser(_0x42a72f,_0x172bd8){return new BPromise(function(_0x427ef7,_0x33b3f5){request(_0x42a72f)[_0x6cc6('0x38')](function(_0x2aa56c){var _0x2463ca=null;if(_0x2aa56c){_0x2463ca=_0x2aa56c[_0x6cc6('0x43')][0x0];_0x2463ca[_0x6cc6('0x44')]=_0x172bd8;}_0x427ef7(_0x2463ca);})[_0x6cc6('0x2e')](function(_0x981bc4){_0x33b3f5(_0x981bc4);});});}function createEndUser(_0x376064,_0x5ce7b6,_0x3d8c24,_0x18b054,_0x46705d,_0x96a3ed){var _0x3d8c24=getName(_0x3d8c24);return request({'method':_0x6cc6('0x27'),'uri':'https://www.zohoapis.'+_0x5ce7b6+_0x6cc6('0x45')+_[_0x6cc6('0x46')](_0x96a3ed[_0x6cc6('0x47')])+'s','body':{'data':[{'Last_Name':_0x3d8c24[0x1],'First_Name':_0x3d8c24[0x0],'Phone':_0x18b054,'Owner':{'name':!_[_0x6cc6('0x1f')](_0x46705d[_0x6cc6('0x48')][_0x6cc6('0x1c')])?_0x46705d['role'][_0x6cc6('0x1c')]:!_['isNil'](_0x46705d[_0x6cc6('0x49')])?_0x46705d[_0x6cc6('0x49')]+'\x20'+_0x46705d[_0x6cc6('0x4a')]:_0x46705d[_0x6cc6('0x4a')],'id':_0x46705d['id']}}]},'headers':{'Authorization':_0x6cc6('0x37')+_0x376064},'json':!![]})[_0x6cc6('0x38')](function(_0x557a1a){if(_0x557a1a&&_0x557a1a[_0x6cc6('0x43')][0x0][_0x6cc6('0x4b')]===_0x6cc6('0x4c')){var _0x1c16e1=_0x557a1a[_0x6cc6('0x43')][0x0][_0x6cc6('0x4d')];_0x1c16e1[_0x6cc6('0x44')]=_[_0x6cc6('0x46')](_0x96a3ed['moduleCreate'])+'s';return _0x1c16e1;}logger['error'](_0x6cc6('0x41'),JSON[_0x6cc6('0xf')](data));throw new Error('Error:\x20'+JSON[_0x6cc6('0xf')](data));})['catch'](function(_0x2f52f5){console[_0x6cc6('0x4e')](_0x6cc6('0x4f'),_0x2f52f5);});}function getEndUser(_0x4ddb9a,_0x3ee6d3,_0x45f105,_0x4e045a,_0x2683ad,_0x23f69e,_0x4a3857){var _0x45275b={'method':_0x6cc6('0x34'),'uri':'','headers':{'Authorization':_0x6cc6('0x37')+_0x4ddb9a},'json':!![]};switch(_0x4a3857[_0x6cc6('0x50')]){case _0x6cc6('0x51'):_0x45275b[_0x6cc6('0x52')]=_0x6cc6('0x53')+_0x3ee6d3+_0x6cc6('0x54')+_0x2683ad+'))';return getZohoUser(_0x45275b,_0x6cc6('0x55'))[_0x6cc6('0x38')](function(_0x3c92c5){if(_0x3c92c5)return _0x3c92c5;_0x45275b[_0x6cc6('0x52')]='https://www.zohoapis.'+_0x3ee6d3+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x2683ad+'))';return getZohoUser(_0x45275b,_0x6cc6('0x56'))['then'](function(_0x51faab){if(_0x51faab)return _0x51faab;if(_0x4a3857[_0x6cc6('0x47')]!='nothing'){return createEndUser(_0x4ddb9a,_0x3ee6d3,_0x4e045a,_0x2683ad,_0x23f69e,_0x4a3857);}else{return{};}});});break;case _0x6cc6('0x57'):_0x45275b[_0x6cc6('0x52')]=_0x6cc6('0x53')+_0x3ee6d3+_0x6cc6('0x54')+_0x2683ad+'))';return getZohoUser(_0x45275b,'Contacts')[_0x6cc6('0x38')](function(_0x2c59ad){if(_0x2c59ad)return _0x2c59ad;if(_0x4a3857[_0x6cc6('0x47')]!=_0x6cc6('0x58')){return createEndUser(_0x4ddb9a,_0x3ee6d3,_0x4e045a,_0x2683ad,_0x23f69e,_0x4a3857);}else{return{};}});break;case _0x6cc6('0x59'):_0x45275b[_0x6cc6('0x52')]=_0x6cc6('0x53')+_0x3ee6d3+_0x6cc6('0x5a')+_0x2683ad+'))';return getZohoUser(_0x45275b,_0x6cc6('0x56'))[_0x6cc6('0x38')](function(_0x1b3b11){if(_0x1b3b11)return _0x1b3b11;if(_0x4a3857[_0x6cc6('0x47')]!=_0x6cc6('0x58')){return createEndUser(_0x4ddb9a,_0x3ee6d3,_0x4e045a,_0x2683ad,_0x23f69e,_0x4a3857);}else{return{};}});break;}}function getCall(_0x23ded8,_0x4d207f,_0xdd6d9d,_0x59d17f,_0x26a0d9,_0x36f44f,_0x5367f4,_0x4ada1d){logger[_0x6cc6('0x32')](_0x6cc6('0x5b'));var _0x2c1df2={};_0x2c1df2['Owner']={'name':!_['isNil'](_0x59d17f['role'][_0x6cc6('0x1c')])&&!_[_0x6cc6('0x1f')](_0x59d17f[_0x6cc6('0x3e')][_0x6cc6('0x1c')])&&_0x59d17f[_0x6cc6('0x3e')][_0x6cc6('0x1c')]===_0x6cc6('0x5c')?_0x59d17f['role'][_0x6cc6('0x1c')]:!_[_0x6cc6('0x1f')](_0x59d17f[_0x6cc6('0x49')])?_0x59d17f[_0x6cc6('0x49')]+'\x20'+_0x59d17f[_0x6cc6('0x4a')]:_0x59d17f['last_name'],'id':_0x59d17f['id']};_0x2c1df2[_0x6cc6('0x5d')]=intUtil[_0x6cc6('0x5e')](_0x36f44f[_0x6cc6('0x5f')],_0x5367f4,'\x20');_0x2c1df2[_0x6cc6('0x60')]=intUtil[_0x6cc6('0x5e')](_0x36f44f['Descriptions'],_0x5367f4,'\x0a');if(_0x26a0d9[_0x6cc6('0x44')]===_0x6cc6('0x55')){_0x2c1df2[_0x6cc6('0x61')]={'name':!_['isNil'](_0x26a0d9[_0x6cc6('0x62')])?_0x26a0d9[_0x6cc6('0x62')]:!_[_0x6cc6('0x1f')](_0x26a0d9['First_Name'])?_0x26a0d9[_0x6cc6('0x63')]+'\x20'+_0x26a0d9[_0x6cc6('0x64')]:_0x26a0d9[_0x6cc6('0x64')],'id':_0x26a0d9['id']};}if(_0x26a0d9[_0x6cc6('0x44')]===_0x6cc6('0x56')){_0x2c1df2[_0x6cc6('0x65')]={'name':!_['isNil'](_0x26a0d9[_0x6cc6('0x62')])?_0x26a0d9[_0x6cc6('0x62')]:!_['isNil'](_0x26a0d9[_0x6cc6('0x63')])?_0x26a0d9[_0x6cc6('0x63')]+'\x20'+_0x26a0d9[_0x6cc6('0x64')]:_0x26a0d9['Last_Name'],'id':_0x26a0d9['id']};_0x2c1df2[_0x6cc6('0x66')]=_[_0x6cc6('0x46')](_0x26a0d9['enduserType']);}if(_0x5367f4['talktime']){_0x2c1df2[_0x6cc6('0x67')]=moment['utc'](parseInt(_0x5367f4[_0x6cc6('0x68')])*0x3e8)['format'](_0x6cc6('0x69'));}else if(_0x5367f4['answertime']&&_0x5367f4['endtime']){_0x2c1df2[_0x6cc6('0x67')]=moment[_0x6cc6('0x6a')](moment(_0x5367f4[_0x6cc6('0x6b')],_0x6cc6('0x6c'))[_0x6cc6('0x6d')](moment(_0x5367f4[_0x6cc6('0x6e')],_0x6cc6('0x6c'))))['format'](_0x6cc6('0x69'));}switch(_0x5367f4['lastevent']){case _0x6cc6('0x6f'):_0x2c1df2[_0x6cc6('0x70')]=_0x6cc6('0x71');break;case _0x6cc6('0x72'):case _0x6cc6('0x73'):_0x2c1df2[_0x6cc6('0x70')]='Answered';break;case _0x6cc6('0x74'):_0x2c1df2[_0x6cc6('0x70')]='Rejected';break;case _0x6cc6('0x75'):_0x2c1df2[_0x6cc6('0x70')]='Abandoned';break;case _0x6cc6('0x76'):_0x2c1df2[_0x6cc6('0x70')]=_0x6cc6('0x77');default:}_0x2c1df2['Call_Start_Time']=(_0x4ada1d===_0x6cc6('0x78')?moment(_0x5367f4[_0x6cc6('0x6e')])[_0x6cc6('0x35')]('YYYY-MM-DDTHH:mm:ss'):moment(_0x5367f4[_0x6cc6('0x79')])[_0x6cc6('0x35')](_0x6cc6('0x6c')))||moment()[_0x6cc6('0x35')]('YYYY-MM-DDTHH:mm:ss');_0x2c1df2[_0x6cc6('0x7a')]=_0x4ada1d||_0x6cc6('0x7b');_0x2c1df2=_[_0x6cc6('0x7c')](_0x2c1df2,getCustomFields(_0x36f44f[_0x6cc6('0x7d')],_0x5367f4));return request({'method':'POST','uri':'https://www.zohoapis.'+_0x4d207f+_0x6cc6('0x7e'),'headers':{'Authorization':_0x6cc6('0x37')+_0x23ded8},'body':{'data':[_0x2c1df2]},'json':!![]})[_0x6cc6('0x38')](function(_0x1c8bc1){if(_0x1c8bc1&&_0x1c8bc1[_0x6cc6('0x43')][0x0][_0x6cc6('0x4b')]===_0x6cc6('0x4c')){logger[_0x6cc6('0x32')]('Call\x20created!');return{'id':_0x1c8bc1[_0x6cc6('0x43')][0x0][_0x6cc6('0x4d')]['id']};}})[_0x6cc6('0x2e')](function(_0x4bf3d0){logger[_0x6cc6('0x32')](_0x6cc6('0x7f'),_0x4bf3d0[_0x6cc6('0x31')]);console[_0x6cc6('0x4e')](_0x6cc6('0x7f'),_0x4bf3d0);});}exports['queue']=function(_0x2d2c0b,_0x3fb5ba,_0x3fcd4d,_0x31cb7b,_0x1423ab,_0x340f0f){var _0x580e58,_0x2b9862,_0x53f903;_0x340f0f['host']=intUtil[_0x6cc6('0x80')](_0x340f0f['host']);_0x340f0f[_0x6cc6('0x81')]=intUtil[_0x6cc6('0x80')](_0x340f0f[_0x6cc6('0x81')]);if(_0x1423ab&&_0x1423ab['monitor_format']){logger['info']('[QUEUE]',_0x6cc6('0x82'));_0x3fb5ba[_0x6cc6('0x83')]=_0x340f0f[_0x6cc6('0x81')]+_0x6cc6('0x84')+_0x3fb5ba['uniqueid']+_0x6cc6('0x85')+md5(_0x3fb5ba['uniqueid']);}else{_0x3fb5ba[_0x6cc6('0x83')]='';}var _0x309035=_0x340f0f[_0x6cc6('0x86')]===_0x6cc6('0x87')?'eu':_0x6cc6('0x88');return getAccessToken(_0x340f0f)['then'](function(_0x14511e){_0x53f903=_0x14511e;return getUser(_0x53f903,_0x309035,_0x340f0f,_0x31cb7b[_0x6cc6('0x3a')]);})['then'](function(_0xd454ab){_0x580e58=_0xd454ab;logger[_0x6cc6('0x32')]('The\x20User\x20ID\x20is:',_0x580e58['id']);return getEndUser(_0x53f903,_0x309035,_0x340f0f,_0x3fb5ba[_0x6cc6('0x89')],_0x3fb5ba[_0x6cc6('0x8a')],_0x580e58,_0x3fcd4d);})[_0x6cc6('0x38')](function(_0x5dca3a){_0x2b9862=_0x5dca3a;return getCall(_0x53f903,_0x309035,_0x340f0f,_0x580e58,_0x2b9862,_0x3fcd4d,_0x3fb5ba,_0x6cc6('0x7b'));})[_0x6cc6('0x38')](function(_0x4f387c){if(_0x4f387c){logger[_0x6cc6('0x32')](_0x6cc6('0x8b'),_0x4f387c['id']);logger[_0x6cc6('0x32')](_0x6cc6('0x8c'),_0x6cc6('0x8d'));emit(util[_0x6cc6('0x35')]('user:%s',_0x31cb7b[_0x6cc6('0x1c')]),_0x6cc6('0x8e'),{'uri':_0x6cc6('0x8f')+_0x340f0f['host']+'/crm/EntityInfo.do?module=Calls&id='+_0x4f387c['id']});}})[_0x6cc6('0x2e')](function(_0x317023){logger['error'](_0x6cc6('0x8c'),JSON['stringify'](_0x317023));});};exports[_0x6cc6('0x78')]=function(_0x4d12a8,_0x16e745,_0x4dd7ea,_0x332993,_0x456e89,_0xf85581,_0x47a450){var _0x34c6c2,_0x955582,_0x284bf4;_0xf85581[_0x6cc6('0x86')]=intUtil[_0x6cc6('0x80')](_0xf85581[_0x6cc6('0x86')]);_0xf85581[_0x6cc6('0x81')]=intUtil['stripTrailingSlash'](_0xf85581[_0x6cc6('0x81')]);if(_0x47a450&&_0x47a450[_0x6cc6('0x90')]&&_0x47a450[_0x6cc6('0x90')]!==_0x6cc6('0x91')){logger[_0x6cc6('0x32')](_0x6cc6('0x92'),_0x6cc6('0x82'));_0x16e745['recordingURL']=_0xf85581['serverUrl']+_0x6cc6('0x84')+_0x16e745[_0x6cc6('0x93')]+'/downloads?type=uniqueid&token='+md5(_0x16e745[_0x6cc6('0x93')]);}var _0x21e93c=_0xf85581['host']===_0x6cc6('0x87')?'eu':_0x6cc6('0x88');return getAccessToken(_0xf85581)[_0x6cc6('0x38')](function(_0xff5e79){_0x284bf4=_0xff5e79;return getUser(_0x284bf4,_0x21e93c,_0xf85581,_0x332993[_0x6cc6('0x3a')]);})[_0x6cc6('0x38')](function(_0x13b47d){_0x34c6c2=_0x13b47d;logger[_0x6cc6('0x32')]('The\x20User\x20ID\x20is:',_0x34c6c2['id']);return getEndUser(_0x284bf4,_0x21e93c,_0xf85581,_0x16e745['destcalleridname'],_0x16e745[_0x6cc6('0x94')],_0x34c6c2,_0x4dd7ea);})[_0x6cc6('0x38')](function(_0x371b2d){_0x955582=_0x371b2d;return getCall(_0x284bf4,_0x21e93c,_0xf85581,_0x34c6c2,_0x955582,_0x4dd7ea,_0x16e745,_0x6cc6('0x95'));})['then'](function(_0x1c944f){if(_0x1c944f){logger[_0x6cc6('0x32')](_0x6cc6('0x8b'),_0x1c944f['id']);logger[_0x6cc6('0x32')](_0x6cc6('0x92'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x6cc6('0x35')](_0x6cc6('0x96'),_0x332993[_0x6cc6('0x1c')]),_0x6cc6('0x8e'),{'uri':'https://crm.'+_0xf85581[_0x6cc6('0x86')]+_0x6cc6('0x97')+_0x1c944f['id']});}})['catch'](function(_0x377e21){logger['error'](_0x6cc6('0x92'),JSON[_0x6cc6('0xf')](_0x377e21));});};exports['unmanaged']=function(_0x150b00,_0x51ce67,_0x11a872,_0x4c3cc1,_0x2a3a81,_0x397e86){var _0x2955b8,_0x1d0bb1,_0x9d7d65;_0x397e86[_0x6cc6('0x86')]=intUtil['stripTrailingSlash'](_0x397e86[_0x6cc6('0x86')]);_0x397e86[_0x6cc6('0x81')]=intUtil['stripTrailingSlash'](_0x397e86[_0x6cc6('0x81')]);if(_0x2a3a81&&_0x2a3a81[_0x6cc6('0x98')]){logger[_0x6cc6('0x32')]('['+_0x51ce67[_0x6cc6('0x99')][_0x6cc6('0x9a')]()+']',_0x6cc6('0x82'));_0x51ce67[_0x6cc6('0x83')]=_0x397e86[_0x6cc6('0x81')]+_0x6cc6('0x84')+_0x51ce67[_0x6cc6('0x93')]+_0x6cc6('0x85')+md5(_0x51ce67[_0x6cc6('0x93')]);}else{_0x51ce67['recordingURL']='';}var _0x5aada2=_0x397e86[_0x6cc6('0x86')]===_0x6cc6('0x87')?'eu':_0x6cc6('0x88');return getAccessToken(_0x397e86)['then'](function(_0x1ccf9d){_0x9d7d65=_0x1ccf9d;return getUser(_0x9d7d65,_0x5aada2,_0x397e86);})[_0x6cc6('0x38')](function(_0x1e2245){_0x2955b8=_0x1e2245;logger['info']('The\x20User\x20ID\x20is:',_0x2955b8['id']);return getEndUser(_0x9d7d65,_0x5aada2,_0x397e86,_0x51ce67[_0x6cc6('0x89')],_0x51ce67['calleridnum'],_0x2955b8,_0x11a872);})[_0x6cc6('0x38')](function(_0x5d7799){_0x1d0bb1=_0x5d7799;return getCall(_0x9d7d65,_0x5aada2,_0x397e86,_0x2955b8,_0x1d0bb1,_0x11a872,_0x51ce67,_0x6cc6('0x7b'));})[_0x6cc6('0x38')](function(_0x316258){if(_0x316258){logger[_0x6cc6('0x32')](_0x6cc6('0x8b'),_0x316258['id']);}})[_0x6cc6('0x2e')](function(_0x29afea){logger[_0x6cc6('0x2f')]('['+_0x51ce67[_0x6cc6('0x99')]['toUpperCase']()+']',JSON[_0x6cc6('0xf')](_0x29afea));});}; \ No newline at end of file +var _0x2e68=['administrator','Subject','getString','Subjects','Description','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','Call_Duration','utc','mm:ss','answertime','endtime','diff','starttime','YYYY-MM-DDTHH:mm:ss','Call_Result','connect','timeout','Timeout','Call_Start_Time','outbound','Call_Type','Inbound','merge','/crm/v2/Calls','SUCCESS','Call\x20created!','err','queue','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://crm.','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','Outbound','/crm/EntityInfo.do?module=Calls&id=','unmanaged','lastevent','toUpperCase','calleridnum','lodash','request-promise','md5','util','./util','moment','ioredis','../../../../config/logger','zoho','defaults','redis','localhost','socket.io-emitter','emit','debug','[HTTP]','includes','picklist','idField','content','toString','type','variable','variableName','customVariable','Variable','name','toLowerCase','indexOf','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','refreshToken','clientSecret','refresh_token','then','add','seconds','catch','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','Zoho-oauthtoken\x20','users','findIndex','email','Using\x20the\x20admin\x20account!','user','Administrator','error','The\x20failing\x20result\x20is','stringify','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','code','enduserType','Error:\x20','log','CREATE\x20ERROR','moduleSearch','contact_lead','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','uri','https://www.zohoapis.','Leads','nothing','lead','/crm/v2/Leads/search?criteria=((Phone:equals:','Creating\x20new\x20call...','Owner','profile'];(function(_0x389a12,_0x41a036){var _0x1db8a9=function(_0x273f40){while(--_0x273f40){_0x389a12['push'](_0x389a12['shift']());}};_0x1db8a9(++_0x41a036);}(_0x2e68,0x16e));var _0x82e6=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x2e68[_0x13e741];return _0x3f8bb3;};'use strict';var _=require(_0x82e6('0x0'));var rp=require(_0x82e6('0x1'));var md5=require(_0x82e6('0x2'));var util=require(_0x82e6('0x3'));var intUtil=require(_0x82e6('0x4'));var moment=require(_0x82e6('0x5'));var Redis=require(_0x82e6('0x6'));var BPromise=require('bluebird');var config=require('../../../../config/environment');var logger=require(_0x82e6('0x7'))(_0x82e6('0x8'));config['redis']=_[_0x82e6('0x9')](config[_0x82e6('0xa')],{'host':_0x82e6('0xb'),'port':0x18eb});var io=require(_0x82e6('0xc'))(new Redis(config['redis']));function emit(_0x2125ed,_0x1d40a1,_0x57c77a){io['to'](_0x2125ed)[_0x82e6('0xd')](_0x1d40a1,_0x57c77a);}function request(_0x583781){logger[_0x82e6('0xe')](_0x82e6('0xf'),JSON['stringify'](_0x583781));return rp(_0x583781);}function getCustomFields(_0x1b3f3b,_0x4e5ba8){var _0x440f20={};if(_0x1b3f3b['length']>0x0){_['forEach'](_0x1b3f3b,function(_0x220283){if(_[_0x82e6('0x10')](['string',_0x82e6('0x11')],_0x220283['type'])&&_0x220283[_0x82e6('0x12')]){_0x440f20[_0x220283[_0x82e6('0x12')]]=_0x220283[_0x82e6('0x13')][_0x82e6('0x14')]();}else if(_0x220283[_0x82e6('0x15')]===_0x82e6('0x16')&&_0x220283['variableName']&&_0x220283[_0x82e6('0x12')]&&_0x4e5ba8[_0x220283[_0x82e6('0x17')]]){_0x440f20[_0x220283[_0x82e6('0x12')]]=_0x4e5ba8[_0x220283[_0x82e6('0x17')]][_0x82e6('0x14')]();}else if(_0x220283['type']===_0x82e6('0x18')&&_0x220283[_0x82e6('0x19')]&&_0x220283[_0x82e6('0x19')][_0x82e6('0x1a')]&&_0x220283[_0x82e6('0x12')]&&_0x4e5ba8[_0x220283[_0x82e6('0x19')]['name'][_0x82e6('0x1b')]()]){_0x440f20[_0x220283[_0x82e6('0x12')]]=_0x4e5ba8[_0x220283[_0x82e6('0x19')][_0x82e6('0x1a')][_0x82e6('0x1b')]()][_0x82e6('0x14')]();}});}return _0x440f20;}function getName(_0x23cfef){if(_0x23cfef[_0x82e6('0x1c')]('\x20')>0x0){var _0x4ea67b=_0x23cfef[_0x82e6('0x1d')](/ (.+)/);if(_0x4ea67b[0x1]){return _0x4ea67b;}}return[_0x23cfef,_0x23cfef];}var accountsTokens={};function getAccessToken(_0x348edb){return new Promise(function(_0x27f575,_0x60cefe){if(!_[_0x82e6('0x1e')](accountsTokens[_0x348edb['id']])&&!_[_0x82e6('0x1e')](accountsTokens[_0x348edb['id']]['access_token'])){if(moment()[_0x82e6('0x1f')](accountsTokens[_0x348edb['id']][_0x82e6('0x20')])){_0x27f575(accountsTokens[_0x348edb['id']][_0x82e6('0x21')]);}}var _0x292f6d;switch(_0x348edb['zone']){case'US':_0x292f6d=_0x82e6('0x22');break;case'AU':_0x292f6d=_0x82e6('0x23');break;case'EU':_0x292f6d=_0x82e6('0x24');break;case'IN':_0x292f6d='https://accounts.zoho.in';break;case'CN':_0x292f6d=_0x82e6('0x25');break;default:_0x292f6d=_0x82e6('0x24');break;}var _0x5ba693={'method':_0x82e6('0x26'),'uri':_0x292f6d+_0x82e6('0x27'),'qs':{'refresh_token':_0x348edb[_0x82e6('0x28')],'client_id':_0x348edb['clientId'],'client_secret':_0x348edb[_0x82e6('0x29')],'grant_type':_0x82e6('0x2a')},'json':!![]};return rp(_0x5ba693)[_0x82e6('0x2b')](function(_0x4148c4){accountsTokens[_0x348edb['id']]={'access_token':_0x4148c4['access_token'],'expires_in':moment()[_0x82e6('0x2c')](_0x4148c4['expires_in'],_0x82e6('0x2d'))};_0x27f575(_0x4148c4['access_token']);})[_0x82e6('0x2e')](function(_0x756ef7){logger['error'](_0x82e6('0x2f'),_0x756ef7[_0x82e6('0x30')]);_0x60cefe(_0x756ef7);});});}function getUser(_0x343bc9,_0x36c92c,_0x1c0201,_0x1f8dec){logger[_0x82e6('0x31')](_0x82e6('0x32'));return request({'method':_0x82e6('0x33'),'uri':util[_0x82e6('0x34')](_0x82e6('0x35'),_0x36c92c),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':_0x82e6('0x36')+_0x343bc9},'json':!![]})[_0x82e6('0x2b')](function(_0x4afff5){if(_0x4afff5[_0x82e6('0x37')]){var _0x5eb5ee=-0x1;if(_['isArrayLikeObject'](_0x4afff5[_0x82e6('0x37')])){if(!_[_0x82e6('0x1e')](_0x1f8dec)){_0x5eb5ee=_[_0x82e6('0x38')](_0x4afff5[_0x82e6('0x37')],function(_0x148e5b){return _0x148e5b[_0x82e6('0x39')]===_0x1f8dec;});}if(_0x5eb5ee>=0x0){logger[_0x82e6('0x31')]('Agent\x20found!');}else{logger['info'](_0x82e6('0x3a'));_0x5eb5ee=_[_0x82e6('0x38')](_0x4afff5['users'],function(_0x3b22ad){return _0x3b22ad['profile'][_0x82e6('0x1a')]==='Administrator';});}return _0x4afff5['users'][_0x5eb5ee];}else{if(_0x4afff5[_0x82e6('0x3b')]['profile'][_0x82e6('0x1a')]===_0x82e6('0x3c')){logger[_0x82e6('0x31')](_0x82e6('0x3a'));user=_0x4afff5[_0x82e6('0x3b')];return user;}else{logger[_0x82e6('0x3d')](_0x82e6('0x3e'),JSON[_0x82e6('0x3f')](_0x4afff5));throw new Error(_0x82e6('0x40')+JSON[_0x82e6('0x3f')](_0x4afff5));}}}else{logger['error'](_0x82e6('0x3e'),JSON['stringify'](_0x4afff5));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0x82e6('0x3f')](_0x4afff5));}})[_0x82e6('0x2e')](function(_0x421f37){console[_0x82e6('0x3d')](_0x421f37);});}function getZohoUser(_0xea1e5b,_0x396411){return new BPromise(function(_0x222731,_0x32006f){request(_0xea1e5b)[_0x82e6('0x2b')](function(_0x5bd0d4){var _0x433d8c=null;if(_0x5bd0d4){_0x433d8c=_0x5bd0d4[_0x82e6('0x41')][0x0];_0x433d8c['enduserType']=_0x396411;}_0x222731(_0x433d8c);})[_0x82e6('0x2e')](function(_0x48e46d){_0x32006f(_0x48e46d);});});}function createEndUser(_0x287eaa,_0x41f8a0,_0x139d34,_0x316d41,_0x18d9ad,_0x44c4e9){var _0x139d34=getName(_0x139d34);return request({'method':_0x82e6('0x26'),'uri':'https://www.zohoapis.'+_0x41f8a0+_0x82e6('0x42')+_[_0x82e6('0x43')](_0x44c4e9[_0x82e6('0x44')])+'s','body':{'data':[{'Last_Name':_0x139d34[0x1],'First_Name':_0x139d34[0x0],'Phone':_0x316d41,'Owner':{'name':!_['isNil'](_0x18d9ad[_0x82e6('0x45')]['name'])?_0x18d9ad[_0x82e6('0x45')][_0x82e6('0x1a')]:!_['isNil'](_0x18d9ad['first_name'])?_0x18d9ad[_0x82e6('0x46')]+'\x20'+_0x18d9ad['last_name']:_0x18d9ad[_0x82e6('0x47')],'id':_0x18d9ad['id']}}]},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x287eaa},'json':!![]})['then'](function(_0xe80d75){if(_0xe80d75&&_0xe80d75[_0x82e6('0x41')][0x0][_0x82e6('0x48')]==='SUCCESS'){var _0x593a71=_0xe80d75[_0x82e6('0x41')][0x0]['details'];_0x593a71[_0x82e6('0x49')]=_[_0x82e6('0x43')](_0x44c4e9[_0x82e6('0x44')])+'s';return _0x593a71;}logger[_0x82e6('0x3d')](_0x82e6('0x3e'),JSON[_0x82e6('0x3f')](data));throw new Error(_0x82e6('0x4a')+JSON['stringify'](data));})['catch'](function(_0x2e915e){console[_0x82e6('0x4b')](_0x82e6('0x4c'),_0x2e915e);});}function getEndUser(_0x521386,_0x261c50,_0x221190,_0x54ff54,_0x1f0786,_0x5a8928,_0x5eea88){var _0x27fc2e={'method':_0x82e6('0x33'),'uri':'','headers':{'Authorization':_0x82e6('0x36')+_0x521386},'json':!![]};switch(_0x5eea88[_0x82e6('0x4d')]){case _0x82e6('0x4e'):_0x27fc2e['uri']='https://www.zohoapis.'+_0x261c50+_0x82e6('0x4f')+_0x1f0786+'))';return getZohoUser(_0x27fc2e,_0x82e6('0x50'))['then'](function(_0x457abb){if(_0x457abb)return _0x457abb;_0x27fc2e[_0x82e6('0x51')]=_0x82e6('0x52')+_0x261c50+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x1f0786+'))';return getZohoUser(_0x27fc2e,_0x82e6('0x53'))['then'](function(_0x9b0e79){if(_0x9b0e79)return _0x9b0e79;if(_0x5eea88[_0x82e6('0x44')]!=_0x82e6('0x54')){return createEndUser(_0x521386,_0x261c50,_0x54ff54,_0x1f0786,_0x5a8928,_0x5eea88);}else{return{};}});});break;case'contact':_0x27fc2e[_0x82e6('0x51')]=_0x82e6('0x52')+_0x261c50+_0x82e6('0x4f')+_0x1f0786+'))';return getZohoUser(_0x27fc2e,'Contacts')[_0x82e6('0x2b')](function(_0x138f0c){if(_0x138f0c)return _0x138f0c;if(_0x5eea88[_0x82e6('0x44')]!=_0x82e6('0x54')){return createEndUser(_0x521386,_0x261c50,_0x54ff54,_0x1f0786,_0x5a8928,_0x5eea88);}else{return{};}});break;case _0x82e6('0x55'):_0x27fc2e[_0x82e6('0x51')]=_0x82e6('0x52')+_0x261c50+_0x82e6('0x56')+_0x1f0786+'))';return getZohoUser(_0x27fc2e,_0x82e6('0x53'))[_0x82e6('0x2b')](function(_0x27315b){if(_0x27315b)return _0x27315b;if(_0x5eea88[_0x82e6('0x44')]!=_0x82e6('0x54')){return createEndUser(_0x521386,_0x261c50,_0x54ff54,_0x1f0786,_0x5a8928,_0x5eea88);}else{return{};}});break;}}function getCall(_0x2f5239,_0x16bbe0,_0x46ac6a,_0x5d0c6e,_0x57e52b,_0x318e31,_0x416b78,_0x10bc32){logger[_0x82e6('0x31')](_0x82e6('0x57'));var _0x412ee8={};_0x412ee8[_0x82e6('0x58')]={'name':!_[_0x82e6('0x1e')](_0x5d0c6e[_0x82e6('0x45')][_0x82e6('0x1a')])&&!_[_0x82e6('0x1e')](_0x5d0c6e[_0x82e6('0x59')]['name'])&&_0x5d0c6e[_0x82e6('0x59')]['name']===_0x82e6('0x5a')?_0x5d0c6e[_0x82e6('0x45')][_0x82e6('0x1a')]:!_[_0x82e6('0x1e')](_0x5d0c6e[_0x82e6('0x46')])?_0x5d0c6e['first_name']+'\x20'+_0x5d0c6e[_0x82e6('0x47')]:_0x5d0c6e[_0x82e6('0x47')],'id':_0x5d0c6e['id']};_0x412ee8[_0x82e6('0x5b')]=intUtil[_0x82e6('0x5c')](_0x318e31[_0x82e6('0x5d')],_0x416b78,'\x20');_0x412ee8[_0x82e6('0x5e')]=intUtil[_0x82e6('0x5c')](_0x318e31[_0x82e6('0x5f')],_0x416b78,'\x0a');if(_0x57e52b[_0x82e6('0x49')]===_0x82e6('0x50')){_0x412ee8[_0x82e6('0x60')]={'name':!_[_0x82e6('0x1e')](_0x57e52b['Full_Name'])?_0x57e52b[_0x82e6('0x61')]:!_[_0x82e6('0x1e')](_0x57e52b[_0x82e6('0x62')])?_0x57e52b[_0x82e6('0x62')]+'\x20'+_0x57e52b['Last_Name']:_0x57e52b[_0x82e6('0x63')],'id':_0x57e52b['id']};}if(_0x57e52b[_0x82e6('0x49')]===_0x82e6('0x53')){_0x412ee8[_0x82e6('0x64')]={'name':!_[_0x82e6('0x1e')](_0x57e52b[_0x82e6('0x61')])?_0x57e52b[_0x82e6('0x61')]:!_[_0x82e6('0x1e')](_0x57e52b['First_Name'])?_0x57e52b[_0x82e6('0x62')]+'\x20'+_0x57e52b[_0x82e6('0x63')]:_0x57e52b[_0x82e6('0x63')],'id':_0x57e52b['id']};_0x412ee8['$se_module']=_[_0x82e6('0x43')](_0x57e52b[_0x82e6('0x49')]);}if(_0x416b78['talktime']){_0x412ee8[_0x82e6('0x65')]=moment[_0x82e6('0x66')](parseInt(_0x416b78['talktime'])*0x3e8)['format'](_0x82e6('0x67'));}else if(_0x416b78[_0x82e6('0x68')]&&_0x416b78['endtime']){_0x412ee8[_0x82e6('0x65')]=moment['utc'](moment(_0x416b78[_0x82e6('0x69')],'YYYY-MM-DDTHH:mm:ss')[_0x82e6('0x6a')](moment(_0x416b78[_0x82e6('0x6b')],_0x82e6('0x6c'))))['format']('mm:ss');}switch(_0x416b78['lastevent']){case'called':_0x412ee8[_0x82e6('0x6d')]='Called';break;case'complete':case _0x82e6('0x6e'):_0x412ee8[_0x82e6('0x6d')]='Answered';break;case'rejected':_0x412ee8[_0x82e6('0x6d')]='Rejected';break;case'abandoned':_0x412ee8[_0x82e6('0x6d')]='Abandoned';break;case _0x82e6('0x6f'):_0x412ee8[_0x82e6('0x6d')]=_0x82e6('0x70');default:}_0x412ee8[_0x82e6('0x71')]=(_0x10bc32===_0x82e6('0x72')?moment(_0x416b78[_0x82e6('0x6b')])[_0x82e6('0x34')](_0x82e6('0x6c')):moment(_0x416b78['agentcalledAt'])[_0x82e6('0x34')]('YYYY-MM-DDTHH:mm:ss'))||moment()[_0x82e6('0x34')](_0x82e6('0x6c'));_0x412ee8[_0x82e6('0x73')]=_0x10bc32||_0x82e6('0x74');_0x412ee8=_[_0x82e6('0x75')](_0x412ee8,getCustomFields(_0x318e31['Fields'],_0x416b78));return request({'method':'POST','uri':_0x82e6('0x52')+_0x16bbe0+_0x82e6('0x76'),'headers':{'Authorization':_0x82e6('0x36')+_0x2f5239},'body':{'data':[_0x412ee8]},'json':!![]})[_0x82e6('0x2b')](function(_0x4b1d1f){if(_0x4b1d1f&&_0x4b1d1f['data'][0x0][_0x82e6('0x48')]===_0x82e6('0x77')){logger[_0x82e6('0x31')](_0x82e6('0x78'));return{'id':_0x4b1d1f[_0x82e6('0x41')][0x0]['details']['id']};}})[_0x82e6('0x2e')](function(_0x39f7e4){logger['info'](_0x82e6('0x79'),_0x39f7e4[_0x82e6('0x30')]);console[_0x82e6('0x4b')]('err',_0x39f7e4);});}exports[_0x82e6('0x7a')]=function(_0x2d7ada,_0x42d020,_0x4459db,_0x205667,_0x4576b5,_0x31b23d){var _0x4bbff8,_0x2f22a5,_0x196ae4;_0x31b23d[_0x82e6('0x7b')]=intUtil[_0x82e6('0x7c')](_0x31b23d['host']);_0x31b23d[_0x82e6('0x7d')]=intUtil[_0x82e6('0x7c')](_0x31b23d[_0x82e6('0x7d')]);if(_0x4576b5&&_0x4576b5[_0x82e6('0x7e')]){logger[_0x82e6('0x31')](_0x82e6('0x7f'),_0x82e6('0x80'));_0x42d020[_0x82e6('0x81')]=_0x31b23d[_0x82e6('0x7d')]+_0x82e6('0x82')+_0x42d020[_0x82e6('0x83')]+_0x82e6('0x84')+md5(_0x42d020['uniqueid']);}else{_0x42d020[_0x82e6('0x81')]='';}var _0x28c298=_0x31b23d[_0x82e6('0x7b')]===_0x82e6('0x85')?'eu':_0x82e6('0x86');return getAccessToken(_0x31b23d)[_0x82e6('0x2b')](function(_0x5c58d5){_0x196ae4=_0x5c58d5;return getUser(_0x196ae4,_0x28c298,_0x31b23d,_0x205667[_0x82e6('0x39')]);})[_0x82e6('0x2b')](function(_0x16c217){_0x4bbff8=_0x16c217;logger[_0x82e6('0x31')](_0x82e6('0x87'),_0x4bbff8['id']);return getEndUser(_0x196ae4,_0x28c298,_0x31b23d,_0x42d020[_0x82e6('0x88')],_0x42d020['calleridnum'],_0x4bbff8,_0x4459db);})[_0x82e6('0x2b')](function(_0x488734){_0x2f22a5=_0x488734;return getCall(_0x196ae4,_0x28c298,_0x31b23d,_0x4bbff8,_0x2f22a5,_0x4459db,_0x42d020,_0x82e6('0x74'));})[_0x82e6('0x2b')](function(_0x3e8c07){if(_0x3e8c07){logger['info'](_0x82e6('0x89'),_0x3e8c07['id']);logger[_0x82e6('0x31')](_0x82e6('0x7f'),_0x82e6('0x8a'));emit(util['format']('user:%s',_0x205667[_0x82e6('0x1a')]),_0x82e6('0x8b'),{'uri':_0x82e6('0x8c')+_0x31b23d[_0x82e6('0x7b')]+'/crm/EntityInfo.do?module=Calls&id='+_0x3e8c07['id']});}})[_0x82e6('0x2e')](function(_0x5e42c2){logger[_0x82e6('0x3d')](_0x82e6('0x7f'),JSON[_0x82e6('0x3f')](_0x5e42c2));});};exports[_0x82e6('0x72')]=function(_0x22209d,_0x592f9b,_0x5aaf9d,_0x402f36,_0x1c591d,_0x4805d3,_0x15174f){var _0x28ed18,_0x5941fe,_0x1b2365;_0x4805d3[_0x82e6('0x7b')]=intUtil[_0x82e6('0x7c')](_0x4805d3['host']);_0x4805d3[_0x82e6('0x7d')]=intUtil[_0x82e6('0x7c')](_0x4805d3[_0x82e6('0x7d')]);if(_0x15174f&&_0x15174f[_0x82e6('0x8d')]&&_0x15174f[_0x82e6('0x8d')]!==_0x82e6('0x8e')){logger[_0x82e6('0x31')](_0x82e6('0x8f'),_0x82e6('0x80'));_0x592f9b[_0x82e6('0x81')]=_0x4805d3[_0x82e6('0x7d')]+'/api/voice/recordings/'+_0x592f9b[_0x82e6('0x83')]+'/downloads?type=uniqueid&token='+md5(_0x592f9b['uniqueid']);}var _0x45bcc7=_0x4805d3[_0x82e6('0x7b')]===_0x82e6('0x85')?'eu':_0x82e6('0x86');return getAccessToken(_0x4805d3)[_0x82e6('0x2b')](function(_0x2c2964){_0x1b2365=_0x2c2964;return getUser(_0x1b2365,_0x45bcc7,_0x4805d3,_0x402f36['email']);})['then'](function(_0x5f34b7){_0x28ed18=_0x5f34b7;logger['info'](_0x82e6('0x87'),_0x28ed18['id']);return getEndUser(_0x1b2365,_0x45bcc7,_0x4805d3,_0x592f9b[_0x82e6('0x90')],_0x592f9b[_0x82e6('0x91')],_0x28ed18,_0x5aaf9d);})[_0x82e6('0x2b')](function(_0x384b0c){_0x5941fe=_0x384b0c;return getCall(_0x1b2365,_0x45bcc7,_0x4805d3,_0x28ed18,_0x5941fe,_0x5aaf9d,_0x592f9b,_0x82e6('0x92'));})[_0x82e6('0x2b')](function(_0x174a06){if(_0x174a06){logger[_0x82e6('0x31')](_0x82e6('0x89'),_0x174a06['id']);logger[_0x82e6('0x31')](_0x82e6('0x8f'),_0x82e6('0x8a'));emit(util[_0x82e6('0x34')]('user:%s',_0x402f36[_0x82e6('0x1a')]),_0x82e6('0x8b'),{'uri':'https://crm.'+_0x4805d3['host']+_0x82e6('0x93')+_0x174a06['id']});}})[_0x82e6('0x2e')](function(_0x235a08){logger[_0x82e6('0x3d')]('[OUTBOUND]',JSON['stringify'](_0x235a08));});};exports[_0x82e6('0x94')]=function(_0x4e0611,_0x19edfb,_0x16c4f4,_0x53299c,_0x36802c,_0x4531d3){var _0x3096fd,_0x1129d3,_0x21d8d2;_0x4531d3[_0x82e6('0x7b')]=intUtil[_0x82e6('0x7c')](_0x4531d3[_0x82e6('0x7b')]);_0x4531d3['serverUrl']=intUtil[_0x82e6('0x7c')](_0x4531d3[_0x82e6('0x7d')]);if(_0x36802c&&_0x36802c[_0x82e6('0x7e')]){logger[_0x82e6('0x31')]('['+_0x19edfb[_0x82e6('0x95')][_0x82e6('0x96')]()+']',_0x82e6('0x80'));_0x19edfb[_0x82e6('0x81')]=_0x4531d3['serverUrl']+'/api/voice/recordings/'+_0x19edfb[_0x82e6('0x83')]+_0x82e6('0x84')+md5(_0x19edfb[_0x82e6('0x83')]);}else{_0x19edfb['recordingURL']='';}var _0x10be78=_0x4531d3[_0x82e6('0x7b')]===_0x82e6('0x85')?'eu':_0x82e6('0x86');return getAccessToken(_0x4531d3)[_0x82e6('0x2b')](function(_0x3a4c4f){_0x21d8d2=_0x3a4c4f;return getUser(_0x21d8d2,_0x10be78,_0x4531d3);})[_0x82e6('0x2b')](function(_0x411c28){_0x3096fd=_0x411c28;logger[_0x82e6('0x31')](_0x82e6('0x87'),_0x3096fd['id']);return getEndUser(_0x21d8d2,_0x10be78,_0x4531d3,_0x19edfb[_0x82e6('0x88')],_0x19edfb[_0x82e6('0x97')],_0x3096fd,_0x16c4f4);})['then'](function(_0x4662a1){_0x1129d3=_0x4662a1;return getCall(_0x21d8d2,_0x10be78,_0x4531d3,_0x3096fd,_0x1129d3,_0x16c4f4,_0x19edfb,_0x82e6('0x74'));})['then'](function(_0x409935){if(_0x409935){logger[_0x82e6('0x31')](_0x82e6('0x89'),_0x409935['id']);}})[_0x82e6('0x2e')](function(_0x4b5073){logger[_0x82e6('0x3d')]('['+_0x19edfb[_0x82e6('0x95')]['toUpperCase']()+']',JSON['stringify'](_0x4b5073));});}; \ 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 b95474d..5350aa1 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 _0x0c7d=['format','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','mustache','../../../../config/logger','trigger','exec','Script','data3','render','error'];(function(_0x5ce7b4,_0x404554){var _0x2af81b=function(_0x2b465f){while(--_0x2b465f){_0x5ce7b4['push'](_0x5ce7b4['shift']());}};_0x2af81b(++_0x404554);}(_0x0c7d,0x153));var _0xd0c7=function(_0x2e1e3d,_0x2d6648){_0x2e1e3d=_0x2e1e3d-0x0;var _0x129355=_0x0c7d[_0x2e1e3d];return _0x129355;};'use strict';var util=require(_0xd0c7('0x0'));var sh=require('shelljs');var Mustache=require(_0xd0c7('0x1'));var logger=require(_0xd0c7('0x2'))(_0xd0c7('0x3'));exports[_0xd0c7('0x4')]=function(_0x5ef469,_0x3ad694){var _0x335172=_0x5ef469['data2']?_0x5ef469['data2']:_0xd0c7('0x5');var _0x47da2b=_0x5ef469[_0xd0c7('0x6')]?Mustache[_0xd0c7('0x7')](_0x5ef469[_0xd0c7('0x6')],_0x3ad694):_0x3ad694;sh[_0xd0c7('0x4')](_0x47da2b,function(_0x49c963,_0x580544,_0x1e3d44){if(_0x49c963!==0x0){logger[_0xd0c7('0x8')](util[_0xd0c7('0x9')]('%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s',_0x335172,_0x47da2b,_0x49c963,_0x1e3d44));}else{logger[_0xd0c7('0xa')](util['format'](_0xd0c7('0xb'),_0x335172,_0x47da2b,_0x580544));}});}; \ No newline at end of file +var _0xfb38=['mustache','../../../../config/logger','trigger','data2','Script','data3','error','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','format','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs'];(function(_0x3bbc79,_0x597d06){var _0x468348=function(_0x19d593){while(--_0x19d593){_0x3bbc79['push'](_0x3bbc79['shift']());}};_0x468348(++_0x597d06);}(_0xfb38,0x102));var _0x8fb3=function(_0x165c96,_0x2269de){_0x165c96=_0x165c96-0x0;var _0x5c2420=_0xfb38[_0x165c96];return _0x5c2420;};'use strict';var util=require(_0x8fb3('0x0'));var sh=require(_0x8fb3('0x1'));var Mustache=require(_0x8fb3('0x2'));var logger=require(_0x8fb3('0x3'))(_0x8fb3('0x4'));exports['exec']=function(_0x1f251c,_0x330a0a){var _0x40f152=_0x1f251c[_0x8fb3('0x5')]?_0x1f251c['data2']:_0x8fb3('0x6');var _0xe57d54=_0x1f251c[_0x8fb3('0x7')]?Mustache['render'](_0x1f251c[_0x8fb3('0x7')],_0x330a0a):_0x330a0a;sh['exec'](_0xe57d54,function(_0xc2a8ca,_0x2145c2,_0x14a5ce){if(_0xc2a8ca!==0x0){logger[_0x8fb3('0x8')](util['format'](_0x8fb3('0x9'),_0x40f152,_0xe57d54,_0xc2a8ca,_0x14a5ce));}else{logger[_0x8fb3('0xa')](util[_0x8fb3('0xb')](_0x8fb3('0xc'),_0x40f152,_0xe57d54,_0x2145c2));}});}; \ 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 4b247e8..fa0ffd3 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 _0x8749=['trigger','exec','data1','data2','data5','headers','data6','parse','render','error','toUpperCase','POST','data7','body','stack','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then','isNil',',\x20request\x20body:\x20','info','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','message','request-promise','util','lodash','mustache','../../../../config/logger'];(function(_0x41ecc2,_0x63f3fe){var _0x4ba158=function(_0x535b1){while(--_0x535b1){_0x41ecc2['push'](_0x41ecc2['shift']());}};_0x4ba158(++_0x63f3fe);}(_0x8749,0x1a8));var _0x9874=function(_0x2f2c92,_0xcd7d9f){_0x2f2c92=_0x2f2c92-0x0;var _0x3cdd48=_0x8749[_0x2f2c92];return _0x3cdd48;};'use strict';var rp=require(_0x9874('0x0'));var util=require(_0x9874('0x1'));var _=require(_0x9874('0x2'));var Mustache=require(_0x9874('0x3'));var logger=require(_0x9874('0x4'))(_0x9874('0x5'));exports[_0x9874('0x6')]=function(_0xd0b8b9,_0x8860e4){var _0x9e58eb,_0xd1b1df;var _0x2b4c3b={'method':_0xd0b8b9[_0x9874('0x7')]['toUpperCase'](),'uri':Mustache['render'](_0xd0b8b9[_0x9874('0x8')],_0x8860e4),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0xd0b8b9['data5'])==='number'&&parseInt(_0xd0b8b9[_0x9874('0x9')])>=0x1&&parseInt(_0xd0b8b9[_0x9874('0x9')])<=0xa?parseInt(_0xd0b8b9[_0x9874('0x9')])*0x3e8:0x5*0x3e8};try{_0x2b4c3b[_0x9874('0xa')]=_0xd0b8b9[_0x9874('0xb')]?JSON[_0x9874('0xc')](Mustache[_0x9874('0xd')](_0xd0b8b9['data6'],_0x8860e4)):{};}catch(_0x3be318){logger[_0x9874('0xe')](_0x3be318['stack']);}switch(_0xd0b8b9[_0x9874('0x7')][_0x9874('0xf')]()){case'GET':case'DELETE':_0x9e58eb=null;_0x2b4c3b['qs']=_0x8860e4;break;case _0x9874('0x10'):case'PUT':if(_0xd0b8b9[_0x9874('0x11')]){try{_0x9e58eb=JSON[_0x9874('0xc')](Mustache[_0x9874('0xd')](_0xd0b8b9[_0x9874('0x11')],_0x8860e4));_0x2b4c3b[_0x9874('0x12')]=_0x9e58eb;}catch(_0x36314f){logger[_0x9874('0xe')](_0x36314f[_0x9874('0x13')]);logger[_0x9874('0xe')](_0x9874('0x14'));}}else{_0x9e58eb=_0x8860e4;_0x2b4c3b[_0x9874('0x12')]=_0x9e58eb;}break;}logger['info'](util[_0x9874('0x15')](_0x9874('0x16'),_0xd0b8b9[_0x9874('0x7')],_0xd0b8b9['data2'],JSON[_0x9874('0x17')](_0x2b4c3b)));rp(_0x2b4c3b)[_0x9874('0x18')](function(_0x144615){_0x9e58eb=!_[_0x9874('0x19')](_0x9e58eb)?_0x9874('0x1a')+_0x9e58eb:'';_0xd1b1df=typeof _0x144615['body']==='object'?JSON[_0x9874('0x17')](_0x144615[_0x9874('0x12')]):_0x144615[_0x9874('0x12')];logger[_0x9874('0x1b')](util['format'](_0x9874('0x1c'),_0xd0b8b9[_0x9874('0x7')],_0xd0b8b9[_0x9874('0x8')],_0x144615[_0x9874('0x1d')],_0xd1b1df));})[_0x9874('0x1e')](function(_0x2473d0){logger[_0x9874('0xe')](util['format'](_0x9874('0x1f'),_0xd0b8b9[_0x9874('0x7')],_0xd0b8b9[_0x9874('0x8')],_0x2473d0['statusCode'],_0x2473d0['name'],_0x2473d0[_0x9874('0x20')]));});}; \ No newline at end of file +var _0x0599=['error','stack','GET','PUT','data7','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','data2','stringify','then','isNil',',\x20request\x20body:\x20','object','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','message','util','lodash','mustache','../../../../config/logger','trigger','exec','data1','toUpperCase','render','data5','number','data6','parse'];(function(_0xac30f8,_0x2cc5fb){var _0x1cc073=function(_0x21c9c3){while(--_0x21c9c3){_0xac30f8['push'](_0xac30f8['shift']());}};_0x1cc073(++_0x2cc5fb);}(_0x0599,0xf3));var _0x9059=function(_0x188498,_0x2a73fa){_0x188498=_0x188498-0x0;var _0x2e5a34=_0x0599[_0x188498];return _0x2e5a34;};'use strict';var rp=require('request-promise');var util=require(_0x9059('0x0'));var _=require(_0x9059('0x1'));var Mustache=require(_0x9059('0x2'));var logger=require(_0x9059('0x3'))(_0x9059('0x4'));exports[_0x9059('0x5')]=function(_0x16c401,_0x26d2bc){var _0x19a36a,_0x19d2f6;var _0xca2ca4={'method':_0x16c401[_0x9059('0x6')][_0x9059('0x7')](),'uri':Mustache[_0x9059('0x8')](_0x16c401['data2'],_0x26d2bc),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x16c401[_0x9059('0x9')])===_0x9059('0xa')&&parseInt(_0x16c401['data5'])>=0x1&&parseInt(_0x16c401[_0x9059('0x9')])<=0xa?parseInt(_0x16c401['data5'])*0x3e8:0x5*0x3e8};try{_0xca2ca4['headers']=_0x16c401[_0x9059('0xb')]?JSON[_0x9059('0xc')](Mustache[_0x9059('0x8')](_0x16c401[_0x9059('0xb')],_0x26d2bc)):{};}catch(_0x2739ef){logger[_0x9059('0xd')](_0x2739ef[_0x9059('0xe')]);}switch(_0x16c401[_0x9059('0x6')][_0x9059('0x7')]()){case _0x9059('0xf'):case'DELETE':_0x19a36a=null;_0xca2ca4['qs']=_0x26d2bc;break;case'POST':case _0x9059('0x10'):if(_0x16c401[_0x9059('0x11')]){try{_0x19a36a=JSON[_0x9059('0xc')](Mustache[_0x9059('0x8')](_0x16c401[_0x9059('0x11')],_0x26d2bc));_0xca2ca4[_0x9059('0x12')]=_0x19a36a;}catch(_0x2e9f47){logger[_0x9059('0xd')](_0x2e9f47[_0x9059('0xe')]);logger['error'](_0x9059('0x13'));}}else{_0x19a36a=_0x26d2bc;_0xca2ca4['body']=_0x19a36a;}break;}logger[_0x9059('0x14')](util[_0x9059('0x15')]('%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s',_0x16c401[_0x9059('0x6')],_0x16c401[_0x9059('0x16')],JSON[_0x9059('0x17')](_0xca2ca4)));rp(_0xca2ca4)[_0x9059('0x18')](function(_0x1274ab){_0x19a36a=!_[_0x9059('0x19')](_0x19a36a)?_0x9059('0x1a')+_0x19a36a:'';_0x19d2f6=typeof _0x1274ab[_0x9059('0x12')]===_0x9059('0x1b')?JSON[_0x9059('0x17')](_0x1274ab['body']):_0x1274ab['body'];logger[_0x9059('0x14')](util[_0x9059('0x15')]('%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s',_0x16c401['data1'],_0x16c401[_0x9059('0x16')],_0x1274ab[_0x9059('0x1c')],_0x19d2f6));})[_0x9059('0x1d')](function(_0x44f8be){logger['error'](util[_0x9059('0x15')](_0x9059('0x1e'),_0x16c401[_0x9059('0x6')],_0x16c401[_0x9059('0x16')],_0x44f8be['statusCode'],_0x44f8be['name'],_0x44f8be[_0x9059('0x1f')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 4451869..63f046e 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 _0x313f=['message','result','catch','rpc','exports','jayson/promise','bluebird','../../config/logger','routing','client','http','Request','request','error'];(function(_0x561458,_0x225481){var _0x1a8d5f=function(_0x4fe001){while(--_0x4fe001){_0x561458['push'](_0x561458['shift']());}};_0x1a8d5f(++_0x225481);}(_0x313f,0x1c5));var _0xf313=function(_0x473b41,_0x1c320f){_0x473b41=_0x473b41-0x0;var _0x4e521d=_0x313f[_0x473b41];return _0x4e521d;};'use strict';var jayson=require(_0xf313('0x0'));var BPromise=require(_0xf313('0x1'));var logger=require(_0xf313('0x2'))(_0xf313('0x3'));var client=jayson[_0xf313('0x4')][_0xf313('0x5')]({'port':0x2329});client[_0xf313('0x6')]=function(_0x37dd6e,_0x3f98a3){return new BPromise(function(_0xc3de21,_0x4cb652){return client[_0xf313('0x7')](_0x37dd6e,_0x3f98a3)['then'](function(_0x473431){logger['debug']('rpc','routing',_0x37dd6e,_0x3f98a3,_0x473431);if(_0x473431['error']){logger[_0xf313('0x8')]('rpc',_0xf313('0x3'),_0x37dd6e,_0x473431[_0xf313('0x8')][_0xf313('0x9')],_0x3f98a3);return _0x4cb652(_0x473431[_0xf313('0x8')][_0xf313('0x9')]);}else{return _0xc3de21(_0x473431[_0xf313('0xa')]);}})[_0xf313('0xb')](function(_0x3d33ef){logger[_0xf313('0x8')](_0xf313('0xc'),_0xf313('0x3'),_0x37dd6e,_0x3d33ef,_0x3f98a3);return _0x4cb652(_0x3d33ef);});});};module[_0xf313('0xd')]=client; \ No newline at end of file +var _0xd033=['jayson/promise','bluebird','../../config/logger','routing','client','Request','request','debug','error','rpc','message','result','catch','exports'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xd033,0x1c0));var _0x3d03=function(_0x237546,_0xa81b26){_0x237546=_0x237546-0x0;var _0x233e29=_0xd033[_0x237546];return _0x233e29;};'use strict';var jayson=require(_0x3d03('0x0'));var BPromise=require(_0x3d03('0x1'));var logger=require(_0x3d03('0x2'))(_0x3d03('0x3'));var client=jayson[_0x3d03('0x4')]['http']({'port':0x2329});client[_0x3d03('0x5')]=function(_0x26cb51,_0x4026fd){return new BPromise(function(_0x40c115,_0x3ccb05){return client[_0x3d03('0x6')](_0x26cb51,_0x4026fd)['then'](function(_0x3fe0d2){logger[_0x3d03('0x7')]('rpc','routing',_0x26cb51,_0x4026fd,_0x3fe0d2);if(_0x3fe0d2[_0x3d03('0x8')]){logger['error'](_0x3d03('0x9'),'routing',_0x26cb51,_0x3fe0d2[_0x3d03('0x8')][_0x3d03('0xa')],_0x4026fd);return _0x3ccb05(_0x3fe0d2[_0x3d03('0x8')][_0x3d03('0xa')]);}else{return _0x40c115(_0x3fe0d2[_0x3d03('0xb')]);}})[_0x3d03('0xc')](function(_0x2a0adc){logger[_0x3d03('0x8')](_0x3d03('0x9'),_0x3d03('0x3'),_0x26cb51,_0x2a0adc,_0x4026fd);return _0x3ccb05(_0x2a0adc);});});};module[_0x3d03('0xd')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 69765db..a88ed35 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 _0xf133=['./rpc/setting','../../config/logger','resolve','then','refresh','mailAccounts','listen','loginMailFrequency','catch','error','Email\x20service\x20initialization','./server','./realtime'];(function(_0x4b9978,_0x58eb71){var _0x42f0e5=function(_0x4ff5dc){while(--_0x4ff5dc){_0x4b9978['push'](_0x4b9978['shift']());}};_0x42f0e5(++_0x58eb71);}(_0xf133,0x191));var _0x3f13=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0xf133[_0x68c979];return _0x4f0001;};'use strict';var server=require(_0x3f13('0x0'));var Realtime=require(_0x3f13('0x1'));var EmailChannel=require('./lib/email');var mailAccount=require('./rpc/mailAccount');var setting=require(_0x3f13('0x2'));var logger=require(_0x3f13('0x3'))('email');var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x3f13('0x4')]()['then'](mailAccount['getMailAccounts']())[_0x3f13('0x5')](realtime['initMailAccounts']())['then'](function(){email[_0x3f13('0x6')](realtime[_0x3f13('0x7')]);return realtime;});}function main(){return server[_0x3f13('0x8')](realtime,email)['then'](function(){return initRealtime();})[_0x3f13('0x5')](function(){return setting['getSettings']();})[_0x3f13('0x5')](function(_0xdd367b){return setInterval(initRealtime,_0xdd367b[_0x3f13('0x9')]*0x3e8);})[_0x3f13('0xa')](function(_0x4e81d7){logger[_0x3f13('0xb')](_0x3f13('0xc'),_0x4e81d7);});}main(); \ No newline at end of file +var _0x6040=['./realtime','./rpc/mailAccount','./rpc/setting','email','getMailAccounts','then','initMailAccounts','refresh','mailAccounts','listen','getSettings','loginMailFrequency','error'];(function(_0x43aa79,_0x47b843){var _0x1dbe94=function(_0x3882d1){while(--_0x3882d1){_0x43aa79['push'](_0x43aa79['shift']());}};_0x1dbe94(++_0x47b843);}(_0x6040,0x138));var _0x0604=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x6040[_0x1d1779];return _0x2377e9;};'use strict';var server=require('./server');var Realtime=require(_0x0604('0x0'));var EmailChannel=require('./lib/email');var mailAccount=require(_0x0604('0x1'));var setting=require(_0x0604('0x2'));var logger=require('../../config/logger')(_0x0604('0x3'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise['resolve']()['then'](mailAccount[_0x0604('0x4')]())[_0x0604('0x5')](realtime[_0x0604('0x6')]())['then'](function(){email[_0x0604('0x7')](realtime[_0x0604('0x8')]);return realtime;});}function main(){return server[_0x0604('0x9')](realtime,email)[_0x0604('0x5')](function(){return initRealtime();})[_0x0604('0x5')](function(){return setting[_0x0604('0xa')]();})['then'](function(_0x15ff21){return setInterval(initRealtime,_0x15ff21[_0x0604('0xb')]*0x3e8);})['catch'](function(_0x442288){logger[_0x0604('0xc')]('Email\x20service\x20initialization',_0x442288);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 3caedc8..990e26c 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 _0x63d8=['Smtp','verify','then','verified','catch','lodash','moment','bluebird','md5','../../../config/environment','../../../config/logger','email','redis','localhost','socket.io-emitter','./imap','./smtp','info','mailAccounts','imapAccounts','smtp','prototype','emit','name','key','active','Imap','status','messageStatus','isNil','stringify','refresh','hasOwnProperty','service','provider','custom','box','handleImapBox','bind','handleImapEmail','end','handleImapEnd','handleImapError','connected','messages','total','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','notify','Mail\x20accepted\x20from\x20routing','error','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','sendMail','send','verifySmtp'];(function(_0x26ac19,_0x5a940e){var _0x3cb640=function(_0x40f0b5){while(--_0x40f0b5){_0x26ac19['push'](_0x26ac19['shift']());}};_0x3cb640(++_0x5a940e);}(_0x63d8,0x127));var _0x863d=function(_0xf909d4,_0x50dbaa){_0xf909d4=_0xf909d4-0x0;var _0x50b354=_0x63d8[_0xf909d4];return _0x50b354;};'use strict';var _=require(_0x863d('0x0'));var moment=require(_0x863d('0x1'));var BPromise=require(_0x863d('0x2'));var md5=require(_0x863d('0x3'));var Redis=require('ioredis');var config=require(_0x863d('0x4'));var logger=require(_0x863d('0x5'))(_0x863d('0x6'));config[_0x863d('0x7')]=_['defaults'](config[_0x863d('0x7')],{'host':_0x863d('0x8'),'port':0x18eb});var io=require(_0x863d('0x9'))(new Redis(config[_0x863d('0x7')]));var EmailImap=require(_0x863d('0xa'));var EmailSmtp=require(_0x863d('0xb'));var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x3ec3d5){logger[_0x863d('0xc')]('start\x20email\x20channel');this['mailAccounts']=_0x3ec3d5[_0x863d('0xd')];this[_0x863d('0xe')]={};this[_0x863d('0xf')]=new EmailSmtp();}EmailChannel[_0x863d('0x10')][_0x863d('0x11')]=function(_0xbe585b){var _0x3611a7=this['mailAccounts'][_0xbe585b];var _0xb76bdf={'id':_0x3611a7['id'],'name':_0x3611a7[_0x863d('0x12')],'key':_0x3611a7[_0x863d('0x13')],'active':_0x3611a7[_0x863d('0x14')],'Imap':{'status':_0x3611a7[_0x863d('0x15')][_0x863d('0x16')],'messageStatus':_0x3611a7[_0x863d('0x15')][_0x863d('0x17')],'total':_0x3611a7[_0x863d('0x15')]['total']}};if(_[_0x863d('0x18')](md5Accounts[_0xbe585b])){md5Accounts[_0xbe585b]={};}var _0x28de3b=md5(JSON[_0x863d('0x19')](_0xb76bdf));if(md5Accounts[_0xbe585b][_0x863d('0x3')]!==_0x28de3b){md5Accounts[_0xbe585b]['md5']=_0x28de3b;io[_0x863d('0x11')]('mailAccount:update',_0xb76bdf);}};EmailChannel[_0x863d('0x10')][_0x863d('0x1a')]=function(_0x5536e4){for(var _0x525682 in _0x5536e4){if(_0x5536e4[_0x863d('0x1b')](_0x525682)){if(_0x5536e4[_0x525682]['Imap']&&_0x5536e4[_0x525682][_0x863d('0x14')]){var _0x571f74=_0x5536e4[_0x525682][_0x863d('0x15')];if(!_0x571f74[_0x863d('0x1c')]&&_0x5536e4[_0x525682][_0x863d('0x1d')]!==_0x863d('0x1e'))_0x571f74['service']=_0x5536e4[_0x525682][_0x863d('0x1d')];if(!this[_0x863d('0xe')][_0x863d('0x1b')](_0x571f74['id'])){this['imapAccounts'][_0x571f74['id']]=new EmailImap(_0x571f74,_0x5536e4[_0x525682][_0x863d('0x6')]);this['imapAccounts'][_0x571f74['id']]['on'](_0x863d('0x1f'),this[_0x863d('0x20')][_0x863d('0x21')](this,_0x525682));this[_0x863d('0xe')][_0x571f74['id']]['on']('email',this[_0x863d('0x22')][_0x863d('0x21')](this,_0x525682));this[_0x863d('0xe')][_0x571f74['id']]['on'](_0x863d('0x23'),this[_0x863d('0x24')]['bind'](this,_0x525682));this[_0x863d('0xe')][_0x571f74['id']]['on']('error',this[_0x863d('0x25')][_0x863d('0x21')](this,_0x525682));}}else{if(_[_0x863d('0x18')](this[_0x863d('0xd')][_0x525682][_0x863d('0x15')])){this[_0x863d('0xd')][_0x525682][_0x863d('0x15')]={};}this[_0x863d('0xd')][_0x525682][_0x863d('0x15')][_0x863d('0x16')]='disabled';this[_0x863d('0xd')][_0x525682]['Imap'][_0x863d('0x17')]='';this[_0x863d('0x11')](_0x525682);}}}};EmailChannel['prototype'][_0x863d('0x20')]=function(_0x1bd0ee,_0x460792){if(this[_0x863d('0xd')][_0x1bd0ee]){this[_0x863d('0xd')][_0x1bd0ee]['Imap'][_0x863d('0x16')]=_0x863d('0x26');this[_0x863d('0xd')][_0x1bd0ee][_0x863d('0x15')]['messageStatus']=_0x460792['name'];if(_0x460792[_0x863d('0x27')]){this[_0x863d('0xd')][_0x1bd0ee][_0x863d('0x15')]['total']=_0x460792[_0x863d('0x27')][_0x863d('0x28')];}return this[_0x863d('0x11')](_0x1bd0ee);}};EmailChannel[_0x863d('0x10')]['handleImapEmail']=function(_0x4fb59f,_0x4219ae){logger[_0x863d('0xc')](_0x863d('0x29'),_0x4219ae[_0x863d('0x2a')],_0x4219ae[_0x863d('0x2b')],_0x4219ae[_0x863d('0x2c')],_0x4fb59f);if(this[_0x863d('0xd')][_0x4fb59f]){return mailAccount[_0x863d('0x2d')](_0x4fb59f,_0x4219ae)['then'](function(_0x2a53b3){if(_0x2a53b3){logger[_0x863d('0xc')](_0x863d('0x2e'));}})['catch'](function(_0x3ed975){logger[_0x863d('0x2f')](_0x863d('0x30'),JSON[_0x863d('0x19')](_0x3ed975));});}};EmailChannel[_0x863d('0x10')][_0x863d('0x24')]=function(_0x3a9f09){if(this[_0x863d('0xd')][_0x3a9f09]&&this[_0x863d('0xd')][_0x3a9f09]['Imap']){if(this['imapAccounts'][this[_0x863d('0xd')][_0x3a9f09][_0x863d('0x15')]['id']]){delete this[_0x863d('0xe')][this[_0x863d('0xd')][_0x3a9f09][_0x863d('0x15')]['id']];}this[_0x863d('0xd')][_0x3a9f09][_0x863d('0x15')][_0x863d('0x31')]=moment();this['emit'](_0x3a9f09);}};EmailChannel[_0x863d('0x10')][_0x863d('0x25')]=function(_0x84daa2,_0x2d0624){if(this[_0x863d('0xd')][_0x84daa2]){this[_0x863d('0xd')][_0x84daa2][_0x863d('0x15')][_0x863d('0x16')]='error';this['mailAccounts'][_0x84daa2][_0x863d('0x15')][_0x863d('0x17')]=_0x2d0624;return this[_0x863d('0x11')](_0x84daa2);}};EmailChannel[_0x863d('0x10')][_0x863d('0x32')]=function(_0x1e4dd4,_0x1de8cb){return this['smtp'][_0x863d('0x33')](_0x1e4dd4,_0x1de8cb);};EmailChannel['prototype'][_0x863d('0x34')]=function(_0x2bc4ae){var _0x232352=this;if(this['mailAccounts'][_0x2bc4ae['id']]){if(_[_0x863d('0x18')](this[_0x863d('0xd')][_0x2bc4ae['id']][_0x863d('0x35')])){this[_0x863d('0xd')][_0x2bc4ae['id']][_0x863d('0x35')]={};}this['mailAccounts'][_0x2bc4ae['id']]['Smtp'][_0x863d('0x31')]=moment();return new BPromise(function(_0x45df0f,_0x3ecea5){return _0x232352[_0x863d('0xf')][_0x863d('0x36')](_0x2bc4ae)[_0x863d('0x37')](function(_0x43a9e5){_0x232352['mailAccounts'][_0x2bc4ae['id']][_0x863d('0x35')][_0x863d('0x16')]=_0x863d('0x38');_0x232352[_0x863d('0xd')][_0x2bc4ae['id']][_0x863d('0x35')][_0x863d('0x17')]='';_0x232352[_0x863d('0x11')](_0x2bc4ae['id']);_0x45df0f(_0x43a9e5);})[_0x863d('0x39')](function(_0x3ebc94){_0x232352[_0x863d('0xd')][_0x2bc4ae['id']][_0x863d('0x35')][_0x863d('0x16')]=_0x863d('0x2f');_0x232352[_0x863d('0xd')][_0x2bc4ae['id']]['Smtp'][_0x863d('0x17')]=_0x3ebc94;_0x232352['emit'](_0x2bc4ae['id']);_0x3ecea5(_0x3ebc94);});});}return this[_0x863d('0xf')][_0x863d('0x36')](_0x2bc4ae);};module['exports']=EmailChannel; \ No newline at end of file +var _0x81ff=['hasOwnProperty','box','handleImapBox','bind','handleImapEmail','handleImapEnd','error','status','disabled','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','notify','then','Mail\x20accepted\x20from\x20routing','Mail\x20not\x20accepted\x20from\x20routing\x20%s','stringify','sendMail','send','verifySmtp','Smtp','lastSync','verify','verified','catch','exports','lodash','md5','../../../config/environment','../../../config/logger','email','redis','defaults','localhost','./imap','./smtp','info','mailAccounts','imapAccounts','smtp','prototype','emit','name','key','active','Imap','messageStatus','total','isNil','mailAccount:update','refresh','custom','service','provider'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0x81ff,0xc4));var _0xf81f=function(_0x5ac06b,_0x52cacb){_0x5ac06b=_0x5ac06b-0x0;var _0xb4efa7=_0x81ff[_0x5ac06b];return _0xb4efa7;};'use strict';var _=require(_0xf81f('0x0'));var moment=require('moment');var BPromise=require('bluebird');var md5=require(_0xf81f('0x1'));var Redis=require('ioredis');var config=require(_0xf81f('0x2'));var logger=require(_0xf81f('0x3'))(_0xf81f('0x4'));config[_0xf81f('0x5')]=_[_0xf81f('0x6')](config[_0xf81f('0x5')],{'host':_0xf81f('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xf81f('0x5')]));var EmailImap=require(_0xf81f('0x8'));var EmailSmtp=require(_0xf81f('0x9'));var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x3f8c11){logger[_0xf81f('0xa')]('start\x20email\x20channel');this[_0xf81f('0xb')]=_0x3f8c11[_0xf81f('0xb')];this[_0xf81f('0xc')]={};this[_0xf81f('0xd')]=new EmailSmtp();}EmailChannel[_0xf81f('0xe')][_0xf81f('0xf')]=function(_0x5bd92c){var _0x39938a=this[_0xf81f('0xb')][_0x5bd92c];var _0x232f5a={'id':_0x39938a['id'],'name':_0x39938a[_0xf81f('0x10')],'key':_0x39938a[_0xf81f('0x11')],'active':_0x39938a[_0xf81f('0x12')],'Imap':{'status':_0x39938a[_0xf81f('0x13')]['status'],'messageStatus':_0x39938a[_0xf81f('0x13')][_0xf81f('0x14')],'total':_0x39938a[_0xf81f('0x13')][_0xf81f('0x15')]}};if(_[_0xf81f('0x16')](md5Accounts[_0x5bd92c])){md5Accounts[_0x5bd92c]={};}var _0x59a5cd=md5(JSON['stringify'](_0x232f5a));if(md5Accounts[_0x5bd92c][_0xf81f('0x1')]!==_0x59a5cd){md5Accounts[_0x5bd92c][_0xf81f('0x1')]=_0x59a5cd;io[_0xf81f('0xf')](_0xf81f('0x17'),_0x232f5a);}};EmailChannel[_0xf81f('0xe')][_0xf81f('0x18')]=function(_0x3f4d0b){for(var _0x5e1738 in _0x3f4d0b){if(_0x3f4d0b['hasOwnProperty'](_0x5e1738)){if(_0x3f4d0b[_0x5e1738]['Imap']&&_0x3f4d0b[_0x5e1738]['active']){var _0x4971ac=_0x3f4d0b[_0x5e1738][_0xf81f('0x13')];if(!_0x4971ac['service']&&_0x3f4d0b[_0x5e1738]['provider']!==_0xf81f('0x19'))_0x4971ac[_0xf81f('0x1a')]=_0x3f4d0b[_0x5e1738][_0xf81f('0x1b')];if(!this['imapAccounts'][_0xf81f('0x1c')](_0x4971ac['id'])){this[_0xf81f('0xc')][_0x4971ac['id']]=new EmailImap(_0x4971ac,_0x3f4d0b[_0x5e1738]['email']);this[_0xf81f('0xc')][_0x4971ac['id']]['on'](_0xf81f('0x1d'),this[_0xf81f('0x1e')][_0xf81f('0x1f')](this,_0x5e1738));this[_0xf81f('0xc')][_0x4971ac['id']]['on'](_0xf81f('0x4'),this[_0xf81f('0x20')][_0xf81f('0x1f')](this,_0x5e1738));this['imapAccounts'][_0x4971ac['id']]['on']('end',this[_0xf81f('0x21')]['bind'](this,_0x5e1738));this[_0xf81f('0xc')][_0x4971ac['id']]['on'](_0xf81f('0x22'),this['handleImapError'][_0xf81f('0x1f')](this,_0x5e1738));}}else{if(_[_0xf81f('0x16')](this[_0xf81f('0xb')][_0x5e1738]['Imap'])){this[_0xf81f('0xb')][_0x5e1738]['Imap']={};}this[_0xf81f('0xb')][_0x5e1738][_0xf81f('0x13')][_0xf81f('0x23')]=_0xf81f('0x24');this[_0xf81f('0xb')][_0x5e1738]['Imap']['messageStatus']='';this[_0xf81f('0xf')](_0x5e1738);}}}};EmailChannel['prototype'][_0xf81f('0x1e')]=function(_0x5761c2,_0x23b97d){if(this[_0xf81f('0xb')][_0x5761c2]){this['mailAccounts'][_0x5761c2][_0xf81f('0x13')]['status']='connected';this['mailAccounts'][_0x5761c2][_0xf81f('0x13')][_0xf81f('0x14')]=_0x23b97d['name'];if(_0x23b97d['messages']){this[_0xf81f('0xb')][_0x5761c2][_0xf81f('0x13')][_0xf81f('0x15')]=_0x23b97d[_0xf81f('0x25')][_0xf81f('0x15')];}return this['emit'](_0x5761c2);}};EmailChannel[_0xf81f('0xe')][_0xf81f('0x20')]=function(_0x1f8889,_0x49d97d){logger[_0xf81f('0xa')](_0xf81f('0x26'),_0x49d97d[_0xf81f('0x27')],_0x49d97d[_0xf81f('0x28')],_0x49d97d[_0xf81f('0x29')],_0x1f8889);if(this['mailAccounts'][_0x1f8889]){return mailAccount[_0xf81f('0x2a')](_0x1f8889,_0x49d97d)[_0xf81f('0x2b')](function(_0x1abe25){if(_0x1abe25){logger[_0xf81f('0xa')](_0xf81f('0x2c'));}})['catch'](function(_0x2cd7ab){logger[_0xf81f('0x22')](_0xf81f('0x2d'),JSON[_0xf81f('0x2e')](_0x2cd7ab));});}};EmailChannel[_0xf81f('0xe')][_0xf81f('0x21')]=function(_0x7e243e){if(this[_0xf81f('0xb')][_0x7e243e]&&this['mailAccounts'][_0x7e243e][_0xf81f('0x13')]){if(this[_0xf81f('0xc')][this[_0xf81f('0xb')][_0x7e243e][_0xf81f('0x13')]['id']]){delete this[_0xf81f('0xc')][this['mailAccounts'][_0x7e243e][_0xf81f('0x13')]['id']];}this[_0xf81f('0xb')][_0x7e243e][_0xf81f('0x13')]['lastSync']=moment();this[_0xf81f('0xf')](_0x7e243e);}};EmailChannel[_0xf81f('0xe')]['handleImapError']=function(_0x2e43e5,_0x15734c){if(this[_0xf81f('0xb')][_0x2e43e5]){this[_0xf81f('0xb')][_0x2e43e5][_0xf81f('0x13')][_0xf81f('0x23')]='error';this[_0xf81f('0xb')][_0x2e43e5][_0xf81f('0x13')][_0xf81f('0x14')]=_0x15734c;return this[_0xf81f('0xf')](_0x2e43e5);}};EmailChannel[_0xf81f('0xe')][_0xf81f('0x2f')]=function(_0x3e5844,_0x4a9fbc){return this[_0xf81f('0xd')][_0xf81f('0x30')](_0x3e5844,_0x4a9fbc);};EmailChannel[_0xf81f('0xe')][_0xf81f('0x31')]=function(_0x42e17f){var _0x1a52de=this;if(this[_0xf81f('0xb')][_0x42e17f['id']]){if(_[_0xf81f('0x16')](this[_0xf81f('0xb')][_0x42e17f['id']][_0xf81f('0x32')])){this[_0xf81f('0xb')][_0x42e17f['id']][_0xf81f('0x32')]={};}this[_0xf81f('0xb')][_0x42e17f['id']][_0xf81f('0x32')][_0xf81f('0x33')]=moment();return new BPromise(function(_0xd4aa49,_0x13601d){return _0x1a52de[_0xf81f('0xd')][_0xf81f('0x34')](_0x42e17f)[_0xf81f('0x2b')](function(_0x5c9917){_0x1a52de[_0xf81f('0xb')][_0x42e17f['id']][_0xf81f('0x32')]['status']=_0xf81f('0x35');_0x1a52de[_0xf81f('0xb')][_0x42e17f['id']][_0xf81f('0x32')][_0xf81f('0x14')]='';_0x1a52de['emit'](_0x42e17f['id']);_0xd4aa49(_0x5c9917);})[_0xf81f('0x36')](function(_0x5b50ed){_0x1a52de[_0xf81f('0xb')][_0x42e17f['id']][_0xf81f('0x32')][_0xf81f('0x23')]=_0xf81f('0x22');_0x1a52de['mailAccounts'][_0x42e17f['id']][_0xf81f('0x32')][_0xf81f('0x14')]=_0x5b50ed;_0x1a52de[_0xf81f('0xf')](_0x42e17f['id']);_0x13601d(_0x5b50ed);});});}return this['smtp'][_0xf81f('0x34')](_0x42e17f);};module[_0xf81f('0x37')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 7586b72..477a2e7 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 _0xf83b=['handleEnd','stringify','textCode','hasOwnProperty','upperFirst','exports','lodash','util','imap','mailparser','simpleParser','Iconv','events','./utils','../../../config/logger','email','../../../config/environment','emailMaxHTMLbytesLimit','mailbox','account','once','ready','handleReady','bind','error','handleError','connect','inherits','prototype','connTimeout','authTimeout','service','user','modernAuthentication','xoauth2','generateXOAuth2Token','password','authentication','anonymous@xcally.com','host','port','tls','autotls','required','handleOpenBox','emit','box','end','readUnseen','search','handleReadUnseen','length','fetch','slice','handleFetchMessage','handleFetchError','closeBox','body','handleMessageBody','handleMessageAttributes','handleMessageEnd','handleSimpleParser','html','parser','warn','Email\x20text\x20truncated,\x20max\x20HTML\x20size\x20','\x20bytes,\x20email\x20size:\x20','\x20bytes','\x20[Email\x20text\x20truncated\x20because\x20size\x20more\x20than\x20','\x20bytes]','text','substring','handleCloseBox'];(function(_0x1700e8,_0x5115c1){var _0x15a505=function(_0x469307){while(--_0x469307){_0x1700e8['push'](_0x1700e8['shift']());}};_0x15a505(++_0x5115c1);}(_0xf83b,0x1bc));var _0xbf83=function(_0x503993,_0x45e151){_0x503993=_0x503993-0x0;var _0x1ee2b9=_0xf83b[_0x503993];return _0x1ee2b9;};'use strict';var _=require(_0xbf83('0x0'));var util=require(_0xbf83('0x1'));var Imap=require(_0xbf83('0x2'));var simpleParser=require(_0xbf83('0x3'))[_0xbf83('0x4')];var Iconv=require('iconv')[_0xbf83('0x5')];var EventEmitter=require(_0xbf83('0x6'))['EventEmitter'];var utils=require(_0xbf83('0x7'));var logger=require(_0xbf83('0x8'))(_0xbf83('0x9'));var config=require(_0xbf83('0xa'));const MAX_HTML_BYTES_SIZE=config[_0xbf83('0xb')]||0xee6b2800;function EmailImap(_0x4b43bf,_0x5785f7){this[_0xbf83('0xc')]=_0x4b43bf['mailbox'];this[_0xbf83('0xd')]=this['getAccount'](_0x4b43bf,_0x5785f7);this[_0xbf83('0x2')]=new Imap(this[_0xbf83('0xd')]);this[_0xbf83('0x2')][_0xbf83('0xe')](_0xbf83('0xf'),this[_0xbf83('0x10')][_0xbf83('0x11')](this));this[_0xbf83('0x2')][_0xbf83('0xe')]('end',this['handleEnd'][_0xbf83('0x11')](this));this[_0xbf83('0x2')]['on'](_0xbf83('0x12'),this[_0xbf83('0x13')][_0xbf83('0x11')](this));this['imap'][_0xbf83('0x14')]();}util[_0xbf83('0x15')](EmailImap,EventEmitter);EmailImap[_0xbf83('0x16')]['getAccount']=function(_0x24be58,_0x207502){var _0x52e0fc={'connTimeout':_0x24be58[_0xbf83('0x17')]?_0x24be58[_0xbf83('0x17')]*0x3e8:0x2710,'authTimeout':_0x24be58[_0xbf83('0x18')]?_0x24be58[_0xbf83('0x18')]*0x3e8:0x1388};if(_0x24be58[_0xbf83('0x19')]){_0x52e0fc['user']=_0x24be58[_0xbf83('0x1a')];if(_0x24be58[_0xbf83('0x1b')]){_0x52e0fc[_0xbf83('0x1c')]=utils[_0xbf83('0x1d')](_0x24be58['CloudProvider']['data5'],_0x24be58[_0xbf83('0x1a')]);}else{_0x52e0fc[_0xbf83('0x1e')]=_0x24be58['password'];}}else{if(_0x24be58[_0xbf83('0x1f')]){_0x52e0fc['user']=_0x24be58[_0xbf83('0x1a')];_0x52e0fc['password']=_0x24be58[_0xbf83('0x1e')];}}_0x52e0fc[_0xbf83('0x9')]=_0x207502||_0x24be58[_0xbf83('0x1a')]||_0xbf83('0x20');_0x52e0fc[_0xbf83('0x21')]=_0x24be58[_0xbf83('0x21')];_0x52e0fc[_0xbf83('0x22')]=_0x24be58[_0xbf83('0x22')]||0x3e1;if(_0x24be58['tls']){_0x52e0fc[_0xbf83('0x23')]=!![];}else{_0x52e0fc[_0xbf83('0x23')]=![];_0x52e0fc[_0xbf83('0x24')]=_0xbf83('0x25');}return _0x52e0fc;};EmailImap[_0xbf83('0x16')][_0xbf83('0x10')]=function(){this['imap']['openBox'](this[_0xbf83('0xc')],![],this[_0xbf83('0x26')][_0xbf83('0x11')](this));};EmailImap['prototype'][_0xbf83('0x26')]=function(_0x132172,_0x5ec6ab){if(_0x132172){this[_0xbf83('0x13')](_0x132172,!![]);}else{this[_0xbf83('0x27')](_0xbf83('0x28'),_0x5ec6ab);this['readUnseen']();}};EmailImap[_0xbf83('0x16')]['handleCloseBox']=function(_0x35907c){if(_0x35907c){this[_0xbf83('0x13')](_0x35907c,!![]);}else{this[_0xbf83('0x2')][_0xbf83('0x29')]();}};EmailImap[_0xbf83('0x16')][_0xbf83('0x2a')]=function(){this[_0xbf83('0x2')][_0xbf83('0x2b')](['UNSEEN'],this[_0xbf83('0x2c')]['bind'](this));};EmailImap['prototype'][_0xbf83('0x2c')]=function(_0x32345d,_0x871226){if(_0x32345d){this['handleError'](_0x32345d,!![]);}else{if(_0x871226[_0xbf83('0x2d')]){try{var _0x181b60=this[_0xbf83('0x2')][_0xbf83('0x2e')](_0x871226[_0xbf83('0x2f')](0x0,0xa),{'bodies':'','markSeen':!![]});_0x181b60['on']('message',this[_0xbf83('0x30')][_0xbf83('0x11')](this));_0x181b60['once'](_0xbf83('0x12'),this[_0xbf83('0x31')][_0xbf83('0x11')](this));_0x181b60[_0xbf83('0xe')](_0xbf83('0x29'),this['handleFetchEnd'][_0xbf83('0x11')](this));}catch(_0x1ee2e4){logger[_0xbf83('0x12')](_0x1ee2e4);}}else{this[_0xbf83('0x2')][_0xbf83('0x32')](!![],this['handleCloseBox'][_0xbf83('0x11')](this));}}};EmailImap[_0xbf83('0x16')][_0xbf83('0x30')]=function(_0x8a376d){_0x8a376d['on'](_0xbf83('0x33'),this[_0xbf83('0x34')][_0xbf83('0x11')](this));_0x8a376d[_0xbf83('0xe')]('attributes',this[_0xbf83('0x35')][_0xbf83('0x11')](this));_0x8a376d['once'](_0xbf83('0x29'),this['handleMessageEnd'][_0xbf83('0x11')](this));};EmailImap[_0xbf83('0x16')][_0xbf83('0x34')]=function(_0x130201){simpleParser(_0x130201,{'Iconv':Iconv},this['handleSimpleParser'][_0xbf83('0x11')](this));};EmailImap[_0xbf83('0x16')][_0xbf83('0x35')]=function(){};EmailImap['prototype'][_0xbf83('0x36')]=function(){};EmailImap[_0xbf83('0x16')][_0xbf83('0x37')]=function(_0x3baebd,_0x1cdcc0){if(_0x3baebd){logger[_0xbf83('0x12')](_0x3baebd);}else{var _0x1e2b3b=this;const _0x43c6e1=_0x1cdcc0[_0xbf83('0x38')][_0xbf83('0x2d')];if(_0x43c6e1\x20[Attachment:\x20','\x20]','body','textAsHtml','message','originTo','email','originCc','bcc','attach','type','filename','attachment-','format','%s-%s','root','server/files/attachments/','writeFileSync','content','push','contentType','headerLines','Auto-Submitted:\x20auto-replied','X-Auto-Response-Suppress:\x20All','Precedence:\x20auto_reply','indexOf','line','isAutoreply','parser','from','messageId','inReplyTo','date','filter','application/ms-tnef','info','first','BodyHTML','

Empty\x20message

','Attachments','Title','Data','user=','utf-8','toString','lodash','moment','path','util','node-tnef','../../../config/logger','value','address','anonymous','@xcally.com'];(function(_0x5551b0,_0x3eb7ba){var _0x2b3fb1=function(_0x1375a0){while(--_0x1375a0){_0x5551b0['push'](_0x5551b0['shift']());}};_0x2b3fb1(++_0x3eb7ba);}(_0x1d11,0x8a));var _0x11d1=function(_0x12ccae,_0xb5e7f4){_0x12ccae=_0x12ccae-0x0;var _0x3c505a=_0x1d11[_0x12ccae];return _0x3c505a;};'use strict';var _=require(_0x11d1('0x0'));var moment=require(_0x11d1('0x1'));var random=require('randomstring');var fs=require('fs');var path=require(_0x11d1('0x2'));var util=require(_0x11d1('0x3'));var tnef=require(_0x11d1('0x4'));var logger=require(_0x11d1('0x5'))('email');var config=require('../../../config/environment');function getAddress(_0x2ea7c1){var _0x3779e4=_['head'](_0x2ea7c1[_0x11d1('0x6')]);return _0x3779e4&&_0x3779e4[_0x11d1('0x7')]?_0x3779e4[_0x11d1('0x7')]:_0x11d1('0x8')+random['generate'](0x6)+_0x11d1('0x9');}function getFirstName(_0x2d617f){var _0x447650=_[_0x11d1('0xa')](_0x2d617f[_0x11d1('0x6')]);if(_0x447650&&_0x447650[_0x11d1('0xb')]){if(_0x447650[_0x11d1('0xb')]==_0x447650[_0x11d1('0x7')]){return _0x447650[_0x11d1('0xb')][_0x11d1('0xc')](0x0,_0x447650[_0x11d1('0xb')]['indexOf']('@'));}var _0x4d1b98=_0x447650[_0x11d1('0xb')]['split'](/\s+/);return _0x4d1b98[_0x11d1('0xd')]>0x1?_0x4d1b98[_0x11d1('0xe')](0x0,-0x1)[_0x11d1('0xf')]('\x20'):_0x447650['name'];}return _0x11d1('0x10');}function getLastName(_0x10a4b6){var _0x4a132=_[_0x11d1('0xa')](_0x10a4b6[_0x11d1('0x6')]);if(_0x4a132&&_0x4a132['name']){var _0x375502=_0x4a132[_0x11d1('0xb')][_0x11d1('0x11')](/\s+/);return _0x375502[_0x11d1('0xd')]>0x1?_0x375502[_0x11d1('0x12')]():'';}return'';}function getMails(_0x50366b,_0x2fd082){var _0x36f2bf='';for(var _0x4e189b=0x0;_0x4e189b<_0x2fd082[_0x11d1('0x6')]['length'];_0x4e189b+=0x1){if(_0x2fd082[_0x11d1('0x6')][_0x4e189b][_0x11d1('0x7')]!==_0x50366b){if(!_[_0x11d1('0x13')](_0x36f2bf)){_0x36f2bf+=',';}_0x36f2bf+=_0x2fd082[_0x11d1('0x6')][_0x4e189b][_0x11d1('0xb')]||_0x2fd082[_0x11d1('0x6')][_0x4e189b][_0x11d1('0x7')]||'';_0x36f2bf+='\x20<';_0x36f2bf+=_0x2fd082['value'][_0x4e189b][_0x11d1('0x7')]?_0x2fd082['value'][_0x4e189b][_0x11d1('0x7')]:_0x11d1('0x8')+random[_0x11d1('0x14')](0x6)+'@xcally.com';_0x36f2bf+='>';}}return _0x36f2bf;}function parseEmail(_0x4ffd8b,_0x52a582,_0x9828a5){if(_0x52a582[_0x11d1('0x15')]){var _0x250e56=/)<[^<]*)*<\/script>/gi;while(_0x250e56[_0x11d1('0x16')](_0x52a582[_0x11d1('0x15')])){_0x52a582[_0x11d1('0x15')]=_0x52a582['html'][_0x11d1('0x17')](_0x250e56,'');}if(_0x52a582[_0x11d1('0x15')][_0x11d1('0x18')](_0x11d1('0x19'))){var _0x73c1f8=[];_0x52a582[_0x11d1('0x1a')]['forEach'](_0x26c2af=>{_0x73c1f8['push'](_0x26c2af['filename']);});var _0x550382=/]+>/g;var _0x54be3f=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x31bbd6=_0x52a582[_0x11d1('0x15')]['replace'](_0x54be3f,_0x11d1('0x1b'));var _0x39c9fb=_0x31bbd6[_0x11d1('0x17')](_0x550382,_0x11d1('0x1c'));for(let _0x52311c=0x0;_0x52311c<_0x73c1f8[_0x11d1('0xd')];_0x52311c++){var _0x111b1a=_0x39c9fb[_0x11d1('0x17')](_0x11d1('0x1c'),_0x11d1('0x1d')+_0x73c1f8[_0x52311c]+_0x11d1('0x1e'));_0x39c9fb=_0x111b1a;}_0x52a582['html']=_0x39c9fb;}_0x9828a5[_0x11d1('0x1f')]=_0x52a582[_0x11d1('0x15')];}else{_0x9828a5[_0x11d1('0x1f')]=_0x52a582[_0x11d1('0x20')];}if(_0x9828a5[_0x11d1('0x1f')]){_0x9828a5['body']=_0x9828a5['body']['replace'](/0x0){var _0x1b3c56=[_0x11d1('0x33'),_0x11d1('0x34'),_0x11d1('0x35')];for(var _0x1ac697=0x0;_0x1ac697<_0x52a582[_0x11d1('0x32')]['length'];_0x1ac697++){var _0x1c4947=_[_0x11d1('0x36')](_0x1b3c56,_0x52a582['headerLines'][_0x1ac697][_0x11d1('0x37')]);if(_0x1c4947>=0x0){_0x9828a5[_0x11d1('0x38')]=!![];}}}return _0x9828a5;}exports[_0x11d1('0x39')]=function(_0x4c6324,_0x1d06ea,_0x199fb6){var _0x55dee0={'from':getAddress(_0x1d06ea[_0x11d1('0x3a')]),'firstName':getFirstName(_0x1d06ea[_0x11d1('0x3a')]),'lastName':getLastName(_0x1d06ea[_0x11d1('0x3a')]),'mapKey':_0x11d1('0x23'),'message':{'from':getMails(_0x4c6324[_0x11d1('0x23')],_0x1d06ea['from']),'to':_0x4c6324[_0x11d1('0x23')],'cc':'','subject':_0x1d06ea['subject']||'','messageId':_0x1d06ea[_0x11d1('0x3b')],'inReplyTo':_0x1d06ea[_0x11d1('0x3c')],'sentAt':moment(_0x1d06ea[_0x11d1('0x3d')])['format']('YYYY-MM-DD\x20HH:mm:ss'),'attach':![],'attachments':[]}};if(!_0x1d06ea[_0x11d1('0x15')]&&!_0x1d06ea[_0x11d1('0x20')]){var _0x22611a=_[_0x11d1('0x3e')](_0x1d06ea[_0x11d1('0x1a')],{'contentType':_0x11d1('0x3f')});if(_0x22611a[_0x11d1('0xd')]){logger[_0x11d1('0x40')](util[_0x11d1('0x2a')]('Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system',_0x1d06ea[_0x11d1('0x3b')]));tnef['parseBuffer'](_[_0x11d1('0x41')](_0x22611a)[_0x11d1('0x2f')],function(_0x591df3,_0x2e2f7b){if(_0x2e2f7b){_0x1d06ea[_0x11d1('0x15')]=_0x2e2f7b[_0x11d1('0x42')]||_0x11d1('0x43');if(_0x2e2f7b[_0x11d1('0x44')]){for(var _0x334026=0x0;_0x334026<_0x2e2f7b[_0x11d1('0x44')][_0x11d1('0xd')];_0x334026++){var _0x42b2ec=_0x2e2f7b[_0x11d1('0x44')][_0x334026];_0x55dee0[_0x11d1('0x21')][_0x11d1('0x1a')]['push']({'filename':_0x42b2ec[_0x11d1('0x45')],'content':Buffer[_0x11d1('0x3a')](_0x42b2ec[_0x11d1('0x46')])});}}}_0x199fb6(parseEmail(_0x4c6324,_0x1d06ea,_0x55dee0));});}else{_0x1d06ea[_0x11d1('0x15')]=_0x11d1('0x43');_0x199fb6(parseEmail(_0x4c6324,_0x1d06ea,_0x55dee0));}}else{_0x199fb6(parseEmail(_0x4c6324,_0x1d06ea,_0x55dee0));}};exports['generateXOAuth2Token']=function(_0x2add84,_0x2b2700){var _0xcc8d21=[_0x11d1('0x47')+(_0x2b2700||''),'auth=Bearer\x20'+_0x2add84,'',''];return Buffer[_0x11d1('0x3a')](_0xcc8d21['join'](''),_0x11d1('0x48'))[_0x11d1('0x49')]('base64');}; \ No newline at end of file +var _0xbcff=['address','anonymous','generate','name','substring','split','length','slice','join','Anonymous','pop','isEmpty','@xcally.com','html','test','includes','\x20[Attachment:\x20','\x20]','body','textAsHtml','Empty\x20message

','Attachments','generateXOAuth2Token','user=','utf-8','toString','base64','lodash','moment','randomstring','../../../config/logger','email','../../../config/environment','head','value'];(function(_0x31ba34,_0x485bc1){var _0x35799b=function(_0x5c66cd){while(--_0x5c66cd){_0x31ba34['push'](_0x31ba34['shift']());}};_0x35799b(++_0x485bc1);}(_0xbcff,0x160));var _0xfbcf=function(_0x1f19c3,_0x441fc4){_0x1f19c3=_0x1f19c3-0x0;var _0x1465f5=_0xbcff[_0x1f19c3];return _0x1465f5;};'use strict';var _=require(_0xfbcf('0x0'));var moment=require(_0xfbcf('0x1'));var random=require(_0xfbcf('0x2'));var fs=require('fs');var path=require('path');var util=require('util');var tnef=require('node-tnef');var logger=require(_0xfbcf('0x3'))(_0xfbcf('0x4'));var config=require(_0xfbcf('0x5'));function getAddress(_0x290194){var _0x119c0b=_[_0xfbcf('0x6')](_0x290194[_0xfbcf('0x7')]);return _0x119c0b&&_0x119c0b[_0xfbcf('0x8')]?_0x119c0b[_0xfbcf('0x8')]:_0xfbcf('0x9')+random[_0xfbcf('0xa')](0x6)+'@xcally.com';}function getFirstName(_0x44a805){var _0x45f334=_[_0xfbcf('0x6')](_0x44a805[_0xfbcf('0x7')]);if(_0x45f334&&_0x45f334[_0xfbcf('0xb')]){if(_0x45f334['name']==_0x45f334[_0xfbcf('0x8')]){return _0x45f334[_0xfbcf('0xb')][_0xfbcf('0xc')](0x0,_0x45f334[_0xfbcf('0xb')]['indexOf']('@'));}var _0x402660=_0x45f334[_0xfbcf('0xb')][_0xfbcf('0xd')](/\s+/);return _0x402660[_0xfbcf('0xe')]>0x1?_0x402660[_0xfbcf('0xf')](0x0,-0x1)[_0xfbcf('0x10')]('\x20'):_0x45f334['name'];}return _0xfbcf('0x11');}function getLastName(_0x1d7770){var _0x62e67c=_[_0xfbcf('0x6')](_0x1d7770[_0xfbcf('0x7')]);if(_0x62e67c&&_0x62e67c[_0xfbcf('0xb')]){var _0x5e8f90=_0x62e67c[_0xfbcf('0xb')][_0xfbcf('0xd')](/\s+/);return _0x5e8f90['length']>0x1?_0x5e8f90[_0xfbcf('0x12')]():'';}return'';}function getMails(_0x21c196,_0xd5976f){var _0x1c40b8='';for(var _0x2ba993=0x0;_0x2ba993<_0xd5976f[_0xfbcf('0x7')]['length'];_0x2ba993+=0x1){if(_0xd5976f['value'][_0x2ba993][_0xfbcf('0x8')]!==_0x21c196){if(!_[_0xfbcf('0x13')](_0x1c40b8)){_0x1c40b8+=',';}_0x1c40b8+=_0xd5976f[_0xfbcf('0x7')][_0x2ba993][_0xfbcf('0xb')]||_0xd5976f[_0xfbcf('0x7')][_0x2ba993][_0xfbcf('0x8')]||'';_0x1c40b8+='\x20<';_0x1c40b8+=_0xd5976f[_0xfbcf('0x7')][_0x2ba993][_0xfbcf('0x8')]?_0xd5976f[_0xfbcf('0x7')][_0x2ba993][_0xfbcf('0x8')]:_0xfbcf('0x9')+random[_0xfbcf('0xa')](0x6)+_0xfbcf('0x14');_0x1c40b8+='>';}}return _0x1c40b8;}function parseEmail(_0x310372,_0x128a8d,_0x5ba3ed){if(_0x128a8d[_0xfbcf('0x15')]){var _0x2e9c93=/)<[^<]*)*<\/script>/gi;while(_0x2e9c93[_0xfbcf('0x16')](_0x128a8d[_0xfbcf('0x15')])){_0x128a8d[_0xfbcf('0x15')]=_0x128a8d[_0xfbcf('0x15')]['replace'](_0x2e9c93,'');}if(_0x128a8d['html'][_0xfbcf('0x17')](_0xfbcf('0x18'))){var _0x566c22=[];_0x128a8d[_0xfbcf('0x19')][_0xfbcf('0x1a')](_0x34bc77=>{_0x566c22[_0xfbcf('0x1b')](_0x34bc77[_0xfbcf('0x1c')]);});var _0x4c4c20=/]+>/g;var _0x1eb697=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x519150=_0x128a8d['html'][_0xfbcf('0x1d')](_0x1eb697,_0xfbcf('0x1e'));var _0x459d75=_0x519150[_0xfbcf('0x1d')](_0x4c4c20,_0xfbcf('0x1f'));for(let _0x504593=0x0;_0x504593<_0x566c22[_0xfbcf('0xe')];_0x504593++){var _0x2e37e9=_0x459d75[_0xfbcf('0x1d')]('_IMG',_0xfbcf('0x20')+_0x566c22[_0x504593]+_0xfbcf('0x21'));_0x459d75=_0x2e37e9;}_0x128a8d['html']=_0x459d75;}_0x5ba3ed[_0xfbcf('0x22')]=_0x128a8d[_0xfbcf('0x15')];}else{_0x5ba3ed[_0xfbcf('0x22')]=_0x128a8d[_0xfbcf('0x23')];}if(_0x5ba3ed['body']){_0x5ba3ed[_0xfbcf('0x22')]=_0x5ba3ed[_0xfbcf('0x22')][_0xfbcf('0x1d')](/0x0){var _0x50fa2f=[_0xfbcf('0x30'),_0xfbcf('0x31'),_0xfbcf('0x32')];for(var _0x5b9174=0x0;_0x5b9174<_0x128a8d[_0xfbcf('0x2f')][_0xfbcf('0xe')];_0x5b9174++){var _0x2f554b=_[_0xfbcf('0x33')](_0x50fa2f,_0x128a8d[_0xfbcf('0x2f')][_0x5b9174][_0xfbcf('0x34')]);if(_0x2f554b>=0x0){_0x5ba3ed['isAutoreply']=!![];}}}return _0x5ba3ed;}exports['parser']=function(_0x4ffc29,_0x1b2780,_0x2e7108){var _0x438db8={'from':getAddress(_0x1b2780['from']),'firstName':getFirstName(_0x1b2780[_0xfbcf('0x35')]),'lastName':getLastName(_0x1b2780['from']),'mapKey':_0xfbcf('0x4'),'message':{'from':getMails(_0x4ffc29[_0xfbcf('0x4')],_0x1b2780['from']),'to':_0x4ffc29[_0xfbcf('0x4')],'cc':'','subject':_0x1b2780['subject']||'','messageId':_0x1b2780[_0xfbcf('0x36')],'inReplyTo':_0x1b2780[_0xfbcf('0x37')],'sentAt':moment(_0x1b2780[_0xfbcf('0x38')])[_0xfbcf('0x2a')](_0xfbcf('0x39')),'attach':![],'attachments':[]}};if(!_0x1b2780[_0xfbcf('0x15')]&&!_0x1b2780[_0xfbcf('0x23')]){var _0x145d26=_[_0xfbcf('0x3a')](_0x1b2780[_0xfbcf('0x19')],{'contentType':_0xfbcf('0x3b')});if(_0x145d26[_0xfbcf('0xe')]){logger[_0xfbcf('0x3c')](util[_0xfbcf('0x2a')](_0xfbcf('0x3d'),_0x1b2780[_0xfbcf('0x36')]));tnef[_0xfbcf('0x3e')](_['first'](_0x145d26)[_0xfbcf('0x3f')],function(_0x5f0f8a,_0xd2a170){if(_0xd2a170){_0x1b2780['html']=_0xd2a170[_0xfbcf('0x40')]||_0xfbcf('0x41');if(_0xd2a170[_0xfbcf('0x42')]){for(var _0x15bacd=0x0;_0x15bacd<_0xd2a170[_0xfbcf('0x42')][_0xfbcf('0xe')];_0x15bacd++){var _0x396d86=_0xd2a170['Attachments'][_0x15bacd];_0x438db8['message'][_0xfbcf('0x19')][_0xfbcf('0x1b')]({'filename':_0x396d86['Title'],'content':Buffer[_0xfbcf('0x35')](_0x396d86['Data'])});}}}_0x2e7108(parseEmail(_0x4ffc29,_0x1b2780,_0x438db8));});}else{_0x1b2780[_0xfbcf('0x15')]=_0xfbcf('0x41');_0x2e7108(parseEmail(_0x4ffc29,_0x1b2780,_0x438db8));}}else{_0x2e7108(parseEmail(_0x4ffc29,_0x1b2780,_0x438db8));}};exports[_0xfbcf('0x43')]=function(_0x5b4a07,_0x1a606c){var _0x3d9288=[_0xfbcf('0x44')+(_0x1a606c||''),'auth=Bearer\x20'+_0x5b4a07,'',''];return Buffer['from'](_0x3d9288[_0xfbcf('0x10')](''),_0xfbcf('0x45'))[_0xfbcf('0x46')](_0xfbcf('0x47'));}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 6fc254d..af5c204 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 _0x9e3e=['key','SERV','active','Imap','Smtp','exports','lodash','Service'];(function(_0x4b14b6,_0x195b60){var _0x136472=function(_0x26418e){while(--_0x26418e){_0x4b14b6['push'](_0x4b14b6['shift']());}};_0x136472(++_0x195b60);}(_0x9e3e,0x166));var _0xe9e3=function(_0x1ae417,_0x1b11dc){_0x1ae417=_0x1ae417-0x0;var _0x5ae66c=_0x9e3e[_0x1ae417];return _0x5ae66c;};'use strict';var _=require(_0xe9e3('0x0'));function MailAccount(_0x53bf7f){this['id']=_0x53bf7f['id']||0x0;this['name']=_0x53bf7f['name']||_0xe9e3('0x1');this[_0xe9e3('0x2')]=_0x53bf7f[_0xe9e3('0x2')]||_0xe9e3('0x3');this[_0xe9e3('0x4')]=_0x53bf7f['active']||![];this[_0xe9e3('0x5')]=_0x53bf7f['Imap']||[];this[_0xe9e3('0x6')]=_0x53bf7f[_0xe9e3('0x6')]||[];}module[_0xe9e3('0x7')]=MailAccount; \ No newline at end of file +var _0xb42e=['Service','key','active','Imap','Smtp','exports','lodash'];(function(_0x52e040,_0x583d2f){var _0x4cd278=function(_0xa844b5){while(--_0xa844b5){_0x52e040['push'](_0x52e040['shift']());}};_0x4cd278(++_0x583d2f);}(_0xb42e,0x110));var _0xeb42=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0xb42e[_0x36eaaa];return _0x461349;};'use strict';var _=require(_0xeb42('0x0'));function MailAccount(_0xbf2b65){this['id']=_0xbf2b65['id']||0x0;this['name']=_0xbf2b65['name']||_0xeb42('0x1');this['key']=_0xbf2b65[_0xeb42('0x2')]||'SERV';this[_0xeb42('0x3')]=_0xbf2b65[_0xeb42('0x3')]||![];this[_0xeb42('0x4')]=_0xbf2b65[_0xeb42('0x4')]||[];this[_0xeb42('0x5')]=_0xbf2b65['Smtp']||[];}module[_0xeb42('0x6')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index bb51d7a..647842d 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 _0xe581=['isUndefined','merge','lodash','../model/mailAccount','mailAccounts','hasOwnProperty','prototype','mergeFromDatabase','initMailAccounts','length'];(function(_0x4e1d03,_0x786f3a){var _0x362d4b=function(_0x1924d2){while(--_0x1924d2){_0x4e1d03['push'](_0x4e1d03['shift']());}};_0x362d4b(++_0x786f3a);}(_0xe581,0xc0));var _0x1e58=function(_0x19f166,_0x21fce1){_0x19f166=_0x19f166-0x0;var _0x376cad=_0xe581[_0x19f166];return _0x376cad;};'use strict';var _=require(_0x1e58('0x0'));var MailAccount=require(_0x1e58('0x1'));var Realtime=function(){this[_0x1e58('0x2')]={};};function freeIsNotKey(_0x59e8fb,_0x2c2cdd,_0x176c7d){var _0x2dfcf4=_['mapKeys'](_0x59e8fb,function(_0x41b2fe,_0x81aa57){return _0x41b2fe[_0x176c7d];});for(var _0x20bf67 in _0x2c2cdd){if(_0x2c2cdd[_0x1e58('0x3')](_0x20bf67)){if(!_0x2dfcf4[_0x20bf67]){delete _0x2c2cdd[_0x20bf67];}}}}Realtime[_0x1e58('0x4')][_0x1e58('0x5')]=function(_0x47168f,_0x1ceabb){for(var _0x450bb8 in _0x1ceabb){if(_0x47168f[_0x1e58('0x3')](_0x450bb8)){_0x47168f[_0x450bb8]=_0x1ceabb[_0x450bb8];}}};Realtime[_0x1e58('0x4')][_0x1e58('0x6')]=function(){var _0x4e1349=this;return function(_0x131e64){if(_0x131e64){freeIsNotKey(_0x131e64,_0x4e1349[_0x1e58('0x2')],'id');for(var _0x3dab2d=0x0,_0x5759cf={},_0x55dc58={};_0x3dab2d<_0x131e64[_0x1e58('0x7')];_0x3dab2d+=0x1){_0x5759cf=_0x131e64[_0x3dab2d];if(_[_0x1e58('0x8')](_0x4e1349[_0x1e58('0x2')][_0x5759cf['id']])){_0x4e1349['mailAccounts'][_0x5759cf['id']]=new MailAccount(_0x5759cf);}else{_[_0x1e58('0x9')](_0x4e1349[_0x1e58('0x2')][_0x5759cf['id']],_0x5759cf);}}}return _0x4e1349['mailAccounts'];};};module['exports']=Realtime; \ No newline at end of file +var _0xb776=['../model/mailAccount','mailAccounts','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initMailAccounts','length','isUndefined','merge','lodash'];(function(_0x189305,_0x46c43f){var _0xea3406=function(_0x2aa435){while(--_0x2aa435){_0x189305['push'](_0x189305['shift']());}};_0xea3406(++_0x46c43f);}(_0xb776,0xaf));var _0x6b77=function(_0x4646a3,_0x1aff7f){_0x4646a3=_0x4646a3-0x0;var _0x12208b=_0xb776[_0x4646a3];return _0x12208b;};'use strict';var _=require(_0x6b77('0x0'));var MailAccount=require(_0x6b77('0x1'));var Realtime=function(){this[_0x6b77('0x2')]={};};function freeIsNotKey(_0x59d56d,_0x12d51b,_0x3897a7){var _0x12735b=_[_0x6b77('0x3')](_0x59d56d,function(_0x39df45,_0x41e0f5){return _0x39df45[_0x3897a7];});for(var _0xe9504c in _0x12d51b){if(_0x12d51b[_0x6b77('0x4')](_0xe9504c)){if(!_0x12735b[_0xe9504c]){delete _0x12d51b[_0xe9504c];}}}}Realtime[_0x6b77('0x5')][_0x6b77('0x6')]=function(_0x2b4ce4,_0x1e680a){for(var _0x5bc9f2 in _0x1e680a){if(_0x2b4ce4['hasOwnProperty'](_0x5bc9f2)){_0x2b4ce4[_0x5bc9f2]=_0x1e680a[_0x5bc9f2];}}};Realtime[_0x6b77('0x5')][_0x6b77('0x7')]=function(){var _0x2751a3=this;return function(_0x9f23e2){if(_0x9f23e2){freeIsNotKey(_0x9f23e2,_0x2751a3['mailAccounts'],'id');for(var _0x4e4198=0x0,_0x91a70b={},_0x2a82ea={};_0x4e4198<_0x9f23e2[_0x6b77('0x8')];_0x4e4198+=0x1){_0x91a70b=_0x9f23e2[_0x4e4198];if(_[_0x6b77('0x9')](_0x2751a3[_0x6b77('0x2')][_0x91a70b['id']])){_0x2751a3['mailAccounts'][_0x91a70b['id']]=new MailAccount(_0x91a70b);}else{_[_0x6b77('0xa')](_0x2751a3[_0x6b77('0x2')][_0x91a70b['id']],_0x91a70b);}}}return _0x2751a3[_0x6b77('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 8798230..7c97bee 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 _0xed52=['provider','service','email','active','key','ListId','MailServerIn','CloudProvider','data5','MailServerOut','Smtp','type','Request','NotifyMailAccount','getMailAccounts','name'];(function(_0x36e69a,_0x51e852){var _0x44224a=function(_0x496be2){while(--_0x496be2){_0x36e69a['push'](_0x36e69a['shift']());}};_0x44224a(++_0x51e852);}(_0xed52,0x16e));var _0x2ed5=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xed52[_0x47a7d0];return _0xb9bd08;};'use strict';var client=require('../client');exports[_0x2ed5('0x0')]=function(){return function(){return client['Request']('GetMailAccount',{'options':{'attributes':['id',_0x2ed5('0x1'),_0x2ed5('0x2'),_0x2ed5('0x3'),_0x2ed5('0x4'),_0x2ed5('0x5'),_0x2ed5('0x6'),_0x2ed5('0x7'),'TemplateId'],'raw':![],'include':[{'model':_0x2ed5('0x8'),'as':'Imap','include':[{'model':_0x2ed5('0x9'),'attributes':['id','name',_0x2ed5('0x3'),'type',_0x2ed5('0xa')],'as':_0x2ed5('0x9')}]},{'model':_0x2ed5('0xb'),'as':_0x2ed5('0xc'),'include':[{'model':_0x2ed5('0x9'),'attributes':['id',_0x2ed5('0x1'),'service',_0x2ed5('0xd'),_0x2ed5('0xa')],'as':_0x2ed5('0x9')}]}]},'log':'getMailAccount'});};};exports['notify']=function(_0x4dc83c,_0x55c614){return client[_0x2ed5('0xe')](_0x2ed5('0xf'),{'account':{'id':_0x4dc83c},'body':_0x55c614,'log':_0x2ed5('0xf')});}; \ No newline at end of file +var _0xa93a=['CloudProvider','getMailAccount','notify','NotifyMailAccount','Request','provider','email','key','ListId','TemplateId','MailServerIn','Imap','name','service','data5','MailServerOut','Smtp','type'];(function(_0x1effde,_0xd0676){var _0x297b14=function(_0x11cca0){while(--_0x11cca0){_0x1effde['push'](_0x1effde['shift']());}};_0x297b14(++_0xd0676);}(_0xa93a,0xb8));var _0xaa93=function(_0x2c88b3,_0x39f0bf){_0x2c88b3=_0x2c88b3-0x0;var _0x1b7f49=_0xa93a[_0x2c88b3];return _0x1b7f49;};'use strict';var client=require('../client');exports['getMailAccounts']=function(){return function(){return client[_0xaa93('0x0')]('GetMailAccount',{'options':{'attributes':['id','name',_0xaa93('0x1'),'service',_0xaa93('0x2'),'active',_0xaa93('0x3'),_0xaa93('0x4'),_0xaa93('0x5')],'raw':![],'include':[{'model':_0xaa93('0x6'),'as':_0xaa93('0x7'),'include':[{'model':'CloudProvider','attributes':['id',_0xaa93('0x8'),_0xaa93('0x9'),'type',_0xaa93('0xa')],'as':'CloudProvider'}]},{'model':_0xaa93('0xb'),'as':_0xaa93('0xc'),'include':[{'model':'CloudProvider','attributes':['id','name','service',_0xaa93('0xd'),'data5'],'as':_0xaa93('0xe')}]}]},'log':_0xaa93('0xf')});};};exports[_0xaa93('0x10')]=function(_0x4ded52,_0x5e72fe){return client[_0xaa93('0x0')]('NotifyMailAccount',{'account':{'id':_0x4ded52},'body':_0x5e72fe,'log':_0xaa93('0x11')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index e89ce1b..59d37f2 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 _0x1dfe=['GetSettings','../client','getSettings'];(function(_0x3d7364,_0x12cb1c){var _0x24361e=function(_0x471992){while(--_0x471992){_0x3d7364['push'](_0x3d7364['shift']());}};_0x24361e(++_0x12cb1c);}(_0x1dfe,0xeb));var _0xe1df=function(_0x309171,_0x287e97){_0x309171=_0x309171-0x0;var _0x80627b=_0x1dfe[_0x309171];return _0x80627b;};'use strict';var client=require(_0xe1df('0x0'));exports[_0xe1df('0x1')]=function(){return client['Request']('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':['loginMailFrequency']},'log':_0xe1df('0x2')});}; \ No newline at end of file +var _0xa4ed=['../client','getSettings','Request','loginMailFrequency','GetSettings'];(function(_0x198446,_0x119c8f){var _0x38d7b7=function(_0x293752){while(--_0x293752){_0x198446['push'](_0x198446['shift']());}};_0x38d7b7(++_0x119c8f);}(_0xa4ed,0xdc));var _0xda4e=function(_0x13bc97,_0x4a945e){_0x13bc97=_0x13bc97-0x0;var _0x5acc0f=_0xa4ed[_0x13bc97];return _0x5acc0f;};'use strict';var client=require(_0xda4e('0x0'));exports[_0xda4e('0x1')]=function(){return client[_0xda4e('0x2')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xda4e('0x3')]},'log':_0xda4e('0x4')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index 323a986..7d42ea3 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(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xa9e0[_0x3635ce];return _0x97ecd0;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file +var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xa9e0[_0x3635ce];return _0x97ecd0;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file diff --git a/server/services/express/index.js b/server/services/express/index.js index 7b841ae..e4aae73 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 _0x0fe8=['websocket','polling','redis','defaults','adapter','socket.io-redis','../../config/triggers','default','../../config/socketio','../../routes','once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','http','sticky-session','../../config/environment','createServer','timeout','listen','port','socket.io'];(function(_0xe0f2b7,_0x2bad91){var _0x19f339=function(_0x3dbf64){while(--_0x3dbf64){_0xe0f2b7['push'](_0xe0f2b7['shift']());}};_0x19f339(++_0x2bad91);}(_0x0fe8,0xff));var _0x80fe=function(_0x48c960,_0x485947){_0x48c960=_0x48c960-0x0;var _0x32e3f5=_0x0fe8[_0x48c960];return _0x32e3f5;};'use strict';var _=require(_0x80fe('0x0'));var http=require(_0x80fe('0x1'));var express=require('express');var sticky=require(_0x80fe('0x2'));var Redis=require('ioredis');var config=require(_0x80fe('0x3'));var app=express();var server=http[_0x80fe('0x4')](app);server[_0x80fe('0x5')]=0xdbba0;if(sticky[_0x80fe('0x6')](server,config[_0x80fe('0x7')])){var socketio=require(_0x80fe('0x8'))(server,{'transports':[_0x80fe('0x9'),_0x80fe('0xa')]});config[_0x80fe('0xb')]=_[_0x80fe('0xc')](config[_0x80fe('0xb')],{'host':'localhost','port':0x18eb});socketio[_0x80fe('0xd')](require(_0x80fe('0xe'))({'pubClient':new Redis(config[_0x80fe('0xb')]),'subClient':new Redis(config[_0x80fe('0xb')])}));require(_0x80fe('0xf'))[_0x80fe('0x10')]();require(_0x80fe('0x11'))[_0x80fe('0x10')](socketio);require('../../config/express')['default'](app);require(_0x80fe('0x12'))[_0x80fe('0x10')](app);}else{server[_0x80fe('0x13')](_0x80fe('0x14'),function(){console[_0x80fe('0x15')](_0x80fe('0x16'),config[_0x80fe('0x7')]);});}exports=module[_0x80fe('0x17')]=app; \ No newline at end of file +var _0xc864=['../../config/express','../../routes','once','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','http','express','sticky-session','../../config/environment','timeout','listen','port','polling','defaults','redis','adapter','socket.io-redis','../../config/triggers','default','../../config/socketio'];(function(_0x124f88,_0x3ad501){var _0xed0e3b=function(_0x43a67d){while(--_0x43a67d){_0x124f88['push'](_0x124f88['shift']());}};_0xed0e3b(++_0x3ad501);}(_0xc864,0x1aa));var _0x4c86=function(_0x590381,_0x5c3948){_0x590381=_0x590381-0x0;var _0xe300df=_0xc864[_0x590381];return _0xe300df;};'use strict';var _=require('lodash');var http=require(_0x4c86('0x0'));var express=require(_0x4c86('0x1'));var sticky=require(_0x4c86('0x2'));var Redis=require('ioredis');var config=require(_0x4c86('0x3'));var app=express();var server=http['createServer'](app);server[_0x4c86('0x4')]=0xdbba0;if(sticky[_0x4c86('0x5')](server,config[_0x4c86('0x6')])){var socketio=require('socket.io')(server,{'transports':['websocket',_0x4c86('0x7')]});config['redis']=_[_0x4c86('0x8')](config[_0x4c86('0x9')],{'host':'localhost','port':0x18eb});socketio[_0x4c86('0xa')](require(_0x4c86('0xb'))({'pubClient':new Redis(config['redis']),'subClient':new Redis(config['redis'])}));require(_0x4c86('0xc'))[_0x4c86('0xd')]();require(_0x4c86('0xe'))[_0x4c86('0xd')](socketio);require(_0x4c86('0xf'))[_0x4c86('0xd')](app);require(_0x4c86('0x10'))[_0x4c86('0xd')](app);}else{server[_0x4c86('0x11')]('listening',function(){console[_0x4c86('0x12')](_0x4c86('0x13'),config[_0x4c86('0x6')]);});}exports=module[_0x4c86('0x14')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index dc41a30..5059251 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 _0x34ba=['debug','rpc','error','message','result','catch','exports','bluebird','routing','client','http','Request','request','then'];(function(_0x16c23d,_0x568ecc){var _0x4d0257=function(_0x35f237){while(--_0x35f237){_0x16c23d['push'](_0x16c23d['shift']());}};_0x4d0257(++_0x568ecc);}(_0x34ba,0x1ab));var _0xa34b=function(_0xadd6ee,_0x1382bb){_0xadd6ee=_0xadd6ee-0x0;var _0xb8ef6b=_0x34ba[_0xadd6ee];return _0xb8ef6b;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xa34b('0x0'));var logger=require('../../config/logger')(_0xa34b('0x1'));var client=jayson[_0xa34b('0x2')][_0xa34b('0x3')]({'port':0x2329});client[_0xa34b('0x4')]=function(_0x2302da,_0x509703){return new BPromise(function(_0x4816f8,_0x5beb0e){return client[_0xa34b('0x5')](_0x2302da,_0x509703)[_0xa34b('0x6')](function(_0x3c48c2){logger[_0xa34b('0x7')](_0xa34b('0x8'),_0xa34b('0x1'),_0x2302da,_0x509703,_0x3c48c2);if(_0x3c48c2[_0xa34b('0x9')]){logger[_0xa34b('0x9')]('rpc',_0xa34b('0x1'),_0x2302da,_0x3c48c2[_0xa34b('0x9')]['message'],_0x509703);return _0x5beb0e(_0x3c48c2['error'][_0xa34b('0xa')]);}else{return _0x4816f8(_0x3c48c2[_0xa34b('0xb')]);}})[_0xa34b('0xc')](function(_0x19d33a){logger[_0xa34b('0x9')]('rpc','routing',_0x2302da,_0x19d33a,_0x509703);return _0x5beb0e(_0x19d33a);});});};module[_0xa34b('0xd')]=client; \ No newline at end of file +var _0xdeda=['message','result','catch','exports','bluebird','client','http','Request','request','then','debug','rpc','routing','error'];(function(_0x3f4a45,_0xc4d0a2){var _0x145272=function(_0xad27fc){while(--_0xad27fc){_0x3f4a45['push'](_0x3f4a45['shift']());}};_0x145272(++_0xc4d0a2);}(_0xdeda,0xd6));var _0xaded=function(_0x1e4896,_0x566ad7){_0x1e4896=_0x1e4896-0x0;var _0x50978a=_0xdeda[_0x1e4896];return _0x50978a;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xaded('0x0'));var logger=require('../../config/logger')('routing');var client=jayson[_0xaded('0x1')][_0xaded('0x2')]({'port':0x2329});client[_0xaded('0x3')]=function(_0x4edf95,_0x5721c7){return new BPromise(function(_0x14187d,_0x37cfec){return client[_0xaded('0x4')](_0x4edf95,_0x5721c7)[_0xaded('0x5')](function(_0x3cc331){logger[_0xaded('0x6')](_0xaded('0x7'),_0xaded('0x8'),_0x4edf95,_0x5721c7,_0x3cc331);if(_0x3cc331[_0xaded('0x9')]){logger[_0xaded('0x9')](_0xaded('0x7'),_0xaded('0x8'),_0x4edf95,_0x3cc331['error']['message'],_0x5721c7);return _0x37cfec(_0x3cc331[_0xaded('0x9')][_0xaded('0xa')]);}else{return _0x14187d(_0x3cc331[_0xaded('0xb')]);}})[_0xaded('0xc')](function(_0x3ca436){logger['error'](_0xaded('0x7'),'routing',_0x4edf95,_0x3ca436,_0x5721c7);return _0x37cfec(_0x3ca436);});});};module[_0xaded('0xd')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 0a58027..688a83a 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 _0x823b=['./rpc/chatQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','getAgents','initAgents','getIntervals','initIntervals','getOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','initSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','listen','log','./rpc/user','./rpc/interval','./rpc/openchannelQueue'];(function(_0x7d210e,_0x37f970){var _0x1da9f3=function(_0x48993c){while(--_0x48993c){_0x7d210e['push'](_0x7d210e['shift']());}};_0x1da9f3(++_0x37f970);}(_0x823b,0x1dd));var _0xb823=function(_0x4e4485,_0xfa0fb5){_0x4e4485=_0x4e4485-0x0;var _0x49fd4=_0x823b[_0x4e4485];return _0x49fd4;};'use strict';var BPromise=require('bluebird');var server=require('./server');var Realtime=require('./realtime');var user=require(_0xb823('0x0'));var interval=require(_0xb823('0x1'));var openchannelQueue=require(_0xb823('0x2'));var chatQueue=require(_0xb823('0x3'));var smsQueue=require('./rpc/smsQueue');var mailQueue=require('./rpc/mailQueue');var faxQueue=require(_0xb823('0x4'));var whatsappQueue=require(_0xb823('0x5'));var realtime=new Realtime();function initRealtime(){return BPromise[_0xb823('0x6')]()[_0xb823('0x7')](user[_0xb823('0x8')]())['then'](realtime[_0xb823('0x9')]())['then'](interval[_0xb823('0xa')]())[_0xb823('0x7')](realtime[_0xb823('0xb')]())['then'](openchannelQueue[_0xb823('0xc')]())['then'](realtime['initOpenchannelQueues']())[_0xb823('0x7')](chatQueue[_0xb823('0xd')]())[_0xb823('0x7')](realtime[_0xb823('0xe')]())['then'](smsQueue[_0xb823('0xf')]())[_0xb823('0x7')](realtime[_0xb823('0x10')]())[_0xb823('0x7')](mailQueue[_0xb823('0x11')]())[_0xb823('0x7')](realtime[_0xb823('0x12')]())['then'](faxQueue[_0xb823('0x13')]())['then'](realtime[_0xb823('0x14')]())[_0xb823('0x7')](whatsappQueue[_0xb823('0x15')]())['then'](realtime['initWhatsappQueues']())[_0xb823('0x7')](function(){return realtime;});}function main(){return server[_0xb823('0x16')](realtime)['then'](function(_0x426572){return initRealtime();})['then'](function(_0x4d2630){return setInterval(initRealtime,0x1388);})['catch'](function(_0x3280c8){console[_0xb823('0x17')](_0x3280c8);});}main(); \ No newline at end of file +var _0xec98=['./realtime','./rpc/user','./rpc/interval','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','getAgents','initAgents','then','initIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','listen','catch','log','bluebird','./server'];(function(_0x1981ad,_0x1dfd88){var _0x2a4f55=function(_0x29bfba){while(--_0x29bfba){_0x1981ad['push'](_0x1981ad['shift']());}};_0x2a4f55(++_0x1dfd88);}(_0xec98,0xf1));var _0x8ec9=function(_0x1491fd,_0x2ff71f){_0x1491fd=_0x1491fd-0x0;var _0x141686=_0xec98[_0x1491fd];return _0x141686;};'use strict';var BPromise=require(_0x8ec9('0x0'));var server=require(_0x8ec9('0x1'));var Realtime=require(_0x8ec9('0x2'));var user=require(_0x8ec9('0x3'));var interval=require(_0x8ec9('0x4'));var openchannelQueue=require('./rpc/openchannelQueue');var chatQueue=require(_0x8ec9('0x5'));var smsQueue=require(_0x8ec9('0x6'));var mailQueue=require(_0x8ec9('0x7'));var faxQueue=require(_0x8ec9('0x8'));var whatsappQueue=require(_0x8ec9('0x9'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x8ec9('0xa')]()['then'](user[_0x8ec9('0xb')]())['then'](realtime[_0x8ec9('0xc')]())['then'](interval['getIntervals']())[_0x8ec9('0xd')](realtime[_0x8ec9('0xe')]())[_0x8ec9('0xd')](openchannelQueue[_0x8ec9('0xf')]())[_0x8ec9('0xd')](realtime[_0x8ec9('0x10')]())[_0x8ec9('0xd')](chatQueue[_0x8ec9('0x11')]())[_0x8ec9('0xd')](realtime[_0x8ec9('0x12')]())[_0x8ec9('0xd')](smsQueue[_0x8ec9('0x13')]())[_0x8ec9('0xd')](realtime['initSmsQueues']())[_0x8ec9('0xd')](mailQueue[_0x8ec9('0x14')]())[_0x8ec9('0xd')](realtime[_0x8ec9('0x15')]())['then'](faxQueue[_0x8ec9('0x16')]())[_0x8ec9('0xd')](realtime[_0x8ec9('0x17')]())[_0x8ec9('0xd')](whatsappQueue['getWhatsappQueues']())[_0x8ec9('0xd')](realtime['initWhatsappQueues']())[_0x8ec9('0xd')](function(){return realtime;});}function main(){return server[_0x8ec9('0x18')](realtime)[_0x8ec9('0xd')](function(_0x2cf1ee){return initRealtime();})['then'](function(_0x12a2d6){return setInterval(initRealtime,0x1388);})[_0x8ec9('0x19')](function(_0xadc275){console[_0x8ec9('0x1a')](_0xadc275);});}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 78d0757..e1107e4 100644 --- a/server/services/routing/lib/rule-engine.js +++ b/server/services/routing/lib/rule-engine.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5fc3=['lodash','util','EventEmitter','init','isNil','ignoreFactChanges','inherits','activeRules','prototype','register','isArray','rules','isObject','sync','orderBy','asc','execute','clone','ruleRef','name','index_','push','call','nextTick','next','isEqual','restart','length','condition','matchPath','noop','findRules','filter','prioritize','priority','toJSON','map','consequence','toString','fromJSON','isString','parse'];(function(_0x42eabb,_0x1c8ecb){var _0x2d4655=function(_0x4e6550){while(--_0x4e6550){_0x42eabb['push'](_0x42eabb['shift']());}};_0x2d4655(++_0x1c8ecb);}(_0x5fc3,0xa8));var _0x35fc=function(_0x5280f4,_0x3c36d0){_0x5280f4=_0x5280f4-0x0;var _0xba93e7=_0x5fc3[_0x5280f4];return _0xba93e7;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var EventEmitter=require('events')[_0x35fc('0x2')];function RuleEngine(_0x2ac6da,_0x196bc2){this[_0x35fc('0x3')]();if(!_[_0x35fc('0x4')](_0x2ac6da)){this['register'](_0x2ac6da);}if(_0x196bc2){this[_0x35fc('0x5')]=_0x196bc2[_0x35fc('0x5')];}return this;}util[_0x35fc('0x6')](RuleEngine,EventEmitter);RuleEngine['prototype']['init']=function(_0x19a0d1){this['rules']=[];this[_0x35fc('0x7')]=[];};RuleEngine[_0x35fc('0x8')][_0x35fc('0x9')]=function(_0x1e5f90){if(Array[_0x35fc('0xa')](_0x1e5f90)){this[_0x35fc('0xb')]=this[_0x35fc('0xb')]['concat'](_0x1e5f90);}else if(_0x1e5f90!==null&&_[_0x35fc('0xc')](_0x1e5f90)){this[_0x35fc('0xb')]['push'](_0x1e5f90);}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')]['sync']=function(){this[_0x35fc('0x7')]=this[_0x35fc('0xb')]['filter'](function(_0x4cbe74){if(_[_0x35fc('0x4')](_0x4cbe74['on'])){_0x4cbe74['on']=!![];}if(_0x4cbe74['on']===!![]){return _0x4cbe74;}});this['activeRules']=_[_0x35fc('0xe')](this[_0x35fc('0x7')],['p'],[_0x35fc('0xf')]);};RuleEngine[_0x35fc('0x8')][_0x35fc('0x10')]=function(_0x5cfe94,_0x59507a){var _0x5eac0f=![];_0x5cfe94['result']=!![];var _0x398b67=_[_0x35fc('0x11')](_0x5cfe94);var _0x53b898=_[_0x35fc('0x11')](_0x5cfe94);var _0x227a49=this[_0x35fc('0x7')];var _0x480851=[];var _0x26ba54=this[_0x35fc('0x5')];(function FnRuleLoop(_0x553677){var _0x41e165={'rules':function(){return _0x227a49;},'rule':function(){return _0x227a49[_0x553677];},'when':function(_0x363e47){if(_0x363e47){var _0x2e513b=_0x227a49[_0x553677]['consequence'];_0x2e513b[_0x35fc('0x12')]=_0x227a49[_0x553677]['id']||_0x227a49[_0x553677][_0x35fc('0x13')]||_0x35fc('0x14')+_0x553677;process['nextTick'](function(){_0x480851[_0x35fc('0x15')](_0x2e513b[_0x35fc('0x12')]);_0x2e513b[_0x35fc('0x16')](_0x398b67,_0x41e165);});}else{process[_0x35fc('0x17')](function(){_0x41e165[_0x35fc('0x18')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x5eac0f=!![];return FnRuleLoop(0x0);},'next':function(_0x21f1a9){if(!_0x26ba54&&!_[_0x35fc('0x19')](_0x53b898,_0x398b67)){_0x53b898=_[_0x35fc('0x11')](_0x398b67);process[_0x35fc('0x17')](function(){_0x41e165[_0x35fc('0x1a')]();});}else{process['nextTick'](function(){if(_[_0x35fc('0x4')](_0x21f1a9)){return FnRuleLoop(_0x553677+0x1);}else{return FnRuleLoop(_0x21f1a9);}});}}};if(_0x553677<_0x227a49[_0x35fc('0x1b')]&&_0x5eac0f===![]){var _0x257719=_0x227a49[_0x553677][_0x35fc('0x1c')];_0x257719[_0x35fc('0x16')](_0x398b67,_0x41e165);}else{process['nextTick'](function(){_0x398b67[_0x35fc('0x1d')]=_0x480851;return _0x59507a?_0x59507a(_0x398b67):_[_0x35fc('0x1e')]();});}}(0x0));};RuleEngine['prototype'][_0x35fc('0x1f')]=function(_0x5a93df){if(_[_0x35fc('0x4')](_0x5a93df)){return this['rules'];}else{var _0x4086e9=_['matches'](_0x5a93df);return _[_0x35fc('0x20')](this[_0x35fc('0xb')],_0x4086e9);}};RuleEngine['prototype']['turn']=function(_0x47774c,_0x58edb6){var _0x274208=_0x47774c==='on'||_0x47774c==='ON'?!![]:![];var _0x1a5d92=this['findRules'](_0x58edb6);for(var _0x26b7cb=0x0,_0x645eac=_0x1a5d92[_0x35fc('0x1b')];_0x26b7cb<_0x645eac;_0x26b7cb+=0x1){_0x1a5d92[_0x26b7cb]['on']=_0x274208;}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')][_0x35fc('0x21')]=function(_0x11ccdb,_0x451f0c){_0x11ccdb=parseInt(_0x11ccdb,0xa);var _0x54aedc=this[_0x35fc('0x1f')](_0x451f0c);for(var _0x220931=0x0,_0x22af18=_0x54aedc['length'];_0x220931<_0x22af18;_0x220931+=0x1){_0x54aedc[_0x220931][_0x35fc('0x22')]=_0x11ccdb;}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')][_0x35fc('0x23')]=function(){var _0xd8a4ca=this[_0x35fc('0xb')];if(_0xd8a4ca instanceof Array){_0xd8a4ca=_0xd8a4ca[_0x35fc('0x24')](function(_0x37b435){_0x37b435[_0x35fc('0x1c')]=_0x37b435[_0x35fc('0x1c')]['toString']();_0x37b435['consequence']=_0x37b435[_0x35fc('0x25')]['toString']();return _0x37b435;});}else if(!_[_0x35fc('0x4')](_0xd8a4ca)){_0xd8a4ca[_0x35fc('0x1c')]=_0xd8a4ca[_0x35fc('0x1c')][_0x35fc('0x26')]();_0xd8a4ca[_0x35fc('0x25')]=_0xd8a4ca[_0x35fc('0x25')]['toString']();}return _0xd8a4ca;};RuleEngine[_0x35fc('0x8')][_0x35fc('0x27')]=function(_0x46b9ef){this[_0x35fc('0x3')]();if(_[_0x35fc('0x28')](_0x46b9ef)){_0x46b9ef=JSON[_0x35fc('0x29')](_0x46b9ef);}if(_0x46b9ef instanceof Array){_0x46b9ef=_0x46b9ef['map'](function(_0x2483be){_0x2483be[_0x35fc('0x1c')]=eval('('+_0x2483be[_0x35fc('0x1c')]+')');_0x2483be['consequence']=eval('('+_0x2483be[_0x35fc('0x25')]+')');return _0x2483be;});}else if(_0x46b9ef!==null&&typeof _0x46b9ef=='object'){_0x46b9ef[_0x35fc('0x1c')]=eval('('+_0x46b9ef[_0x35fc('0x1c')]+')');_0x46b9ef[_0x35fc('0x25')]=eval('('+_0x46b9ef[_0x35fc('0x25')]+')');}this['register'](_0x46b9ef);};module['exports']=RuleEngine; \ No newline at end of file +var _0x7a54=['turn','prioritize','priority','toJSON','map','toString','fromJSON','isString','object','exports','lodash','util','events','isNil','register','ignoreFactChanges','inherits','init','rules','activeRules','concat','prototype','sync','filter','orderBy','asc','execute','clone','consequence','ruleRef','name','index_','nextTick','push','call','isEqual','restart','length','condition','matchPath','noop','findRules'];(function(_0x58f097,_0x2749e4){var _0x4f11b1=function(_0x1ea528){while(--_0x1ea528){_0x58f097['push'](_0x58f097['shift']());}};_0x4f11b1(++_0x2749e4);}(_0x7a54,0x106));var _0x47a5=function(_0x485913,_0x163e36){_0x485913=_0x485913-0x0;var _0x576918=_0x7a54[_0x485913];return _0x576918;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var EventEmitter=require(_0x47a5('0x2'))['EventEmitter'];function RuleEngine(_0x1d33e,_0x4086cd){this['init']();if(!_[_0x47a5('0x3')](_0x1d33e)){this[_0x47a5('0x4')](_0x1d33e);}if(_0x4086cd){this[_0x47a5('0x5')]=_0x4086cd[_0x47a5('0x5')];}return this;}util[_0x47a5('0x6')](RuleEngine,EventEmitter);RuleEngine['prototype'][_0x47a5('0x7')]=function(_0x59199c){this[_0x47a5('0x8')]=[];this[_0x47a5('0x9')]=[];};RuleEngine['prototype'][_0x47a5('0x4')]=function(_0x5077f3){if(Array['isArray'](_0x5077f3)){this['rules']=this[_0x47a5('0x8')][_0x47a5('0xa')](_0x5077f3);}else if(_0x5077f3!==null&&_['isObject'](_0x5077f3)){this[_0x47a5('0x8')]['push'](_0x5077f3);}this['sync']();};RuleEngine[_0x47a5('0xb')][_0x47a5('0xc')]=function(){this[_0x47a5('0x9')]=this[_0x47a5('0x8')][_0x47a5('0xd')](function(_0xd308b8){if(_[_0x47a5('0x3')](_0xd308b8['on'])){_0xd308b8['on']=!![];}if(_0xd308b8['on']===!![]){return _0xd308b8;}});this['activeRules']=_[_0x47a5('0xe')](this[_0x47a5('0x9')],['p'],[_0x47a5('0xf')]);};RuleEngine[_0x47a5('0xb')][_0x47a5('0x10')]=function(_0x620ee9,_0x3c6c46){var _0x190faa=![];_0x620ee9['result']=!![];var _0x362359=_[_0x47a5('0x11')](_0x620ee9);var _0x3b001e=_[_0x47a5('0x11')](_0x620ee9);var _0x1ef44c=this['activeRules'];var _0x549de3=[];var _0x138bc0=this['ignoreFactChanges'];(function FnRuleLoop(_0x5247fd){var _0x423a81={'rules':function(){return _0x1ef44c;},'rule':function(){return _0x1ef44c[_0x5247fd];},'when':function(_0xaf70a6){if(_0xaf70a6){var _0x2ce454=_0x1ef44c[_0x5247fd][_0x47a5('0x12')];_0x2ce454[_0x47a5('0x13')]=_0x1ef44c[_0x5247fd]['id']||_0x1ef44c[_0x5247fd][_0x47a5('0x14')]||_0x47a5('0x15')+_0x5247fd;process[_0x47a5('0x16')](function(){_0x549de3[_0x47a5('0x17')](_0x2ce454['ruleRef']);_0x2ce454[_0x47a5('0x18')](_0x362359,_0x423a81);});}else{process[_0x47a5('0x16')](function(){_0x423a81['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x190faa=!![];return FnRuleLoop(0x0);},'next':function(_0x2b0360){if(!_0x138bc0&&!_[_0x47a5('0x19')](_0x3b001e,_0x362359)){_0x3b001e=_[_0x47a5('0x11')](_0x362359);process['nextTick'](function(){_0x423a81[_0x47a5('0x1a')]();});}else{process[_0x47a5('0x16')](function(){if(_[_0x47a5('0x3')](_0x2b0360)){return FnRuleLoop(_0x5247fd+0x1);}else{return FnRuleLoop(_0x2b0360);}});}}};if(_0x5247fd<_0x1ef44c[_0x47a5('0x1b')]&&_0x190faa===![]){var _0x5ef1b1=_0x1ef44c[_0x5247fd][_0x47a5('0x1c')];_0x5ef1b1[_0x47a5('0x18')](_0x362359,_0x423a81);}else{process['nextTick'](function(){_0x362359[_0x47a5('0x1d')]=_0x549de3;return _0x3c6c46?_0x3c6c46(_0x362359):_[_0x47a5('0x1e')]();});}}(0x0));};RuleEngine[_0x47a5('0xb')][_0x47a5('0x1f')]=function(_0x3abd6a){if(_['isNil'](_0x3abd6a)){return this['rules'];}else{var _0x136745=_['matches'](_0x3abd6a);return _[_0x47a5('0xd')](this['rules'],_0x136745);}};RuleEngine[_0x47a5('0xb')][_0x47a5('0x20')]=function(_0x36ad34,_0x1dac65){var _0x21f296=_0x36ad34==='on'||_0x36ad34==='ON'?!![]:![];var _0x3ba0b7=this[_0x47a5('0x1f')](_0x1dac65);for(var _0x136b14=0x0,_0x16631f=_0x3ba0b7[_0x47a5('0x1b')];_0x136b14<_0x16631f;_0x136b14+=0x1){_0x3ba0b7[_0x136b14]['on']=_0x21f296;}this[_0x47a5('0xc')]();};RuleEngine[_0x47a5('0xb')][_0x47a5('0x21')]=function(_0x528582,_0x243210){_0x528582=parseInt(_0x528582,0xa);var _0x51833b=this[_0x47a5('0x1f')](_0x243210);for(var _0x9ac908=0x0,_0x16901f=_0x51833b['length'];_0x9ac908<_0x16901f;_0x9ac908+=0x1){_0x51833b[_0x9ac908][_0x47a5('0x22')]=_0x528582;}this[_0x47a5('0xc')]();};RuleEngine[_0x47a5('0xb')][_0x47a5('0x23')]=function(){var _0x51cc81=this['rules'];if(_0x51cc81 instanceof Array){_0x51cc81=_0x51cc81[_0x47a5('0x24')](function(_0xfb5ddb){_0xfb5ddb['condition']=_0xfb5ddb['condition'][_0x47a5('0x25')]();_0xfb5ddb[_0x47a5('0x12')]=_0xfb5ddb['consequence'][_0x47a5('0x25')]();return _0xfb5ddb;});}else if(!_['isNil'](_0x51cc81)){_0x51cc81[_0x47a5('0x1c')]=_0x51cc81[_0x47a5('0x1c')]['toString']();_0x51cc81['consequence']=_0x51cc81[_0x47a5('0x12')]['toString']();}return _0x51cc81;};RuleEngine[_0x47a5('0xb')][_0x47a5('0x26')]=function(_0xf269a8){this['init']();if(_[_0x47a5('0x27')](_0xf269a8)){_0xf269a8=JSON['parse'](_0xf269a8);}if(_0xf269a8 instanceof Array){_0xf269a8=_0xf269a8['map'](function(_0x65542e){_0x65542e['condition']=eval('('+_0x65542e[_0x47a5('0x1c')]+')');_0x65542e['consequence']=eval('('+_0x65542e[_0x47a5('0x12')]+')');return _0x65542e;});}else if(_0xf269a8!==null&&typeof _0xf269a8==_0x47a5('0x28')){_0xf269a8[_0x47a5('0x1c')]=eval('('+_0xf269a8[_0x47a5('0x1c')]+')');_0xf269a8[_0x47a5('0x12')]=eval('('+_0xf269a8[_0x47a5('0x12')]+')');}this[_0x47a5('0x4')](_0xf269a8);};module[_0x47a5('0x29')]=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index a050d9b..c786bee 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 _0xfbd6=['client','request','then','error','catch','sendMailMessage','SendMail','bluebird','jayson/promise'];(function(_0x311f44,_0x1d7f5b){var _0x46f1e6=function(_0x27342a){while(--_0x27342a){_0x311f44['push'](_0x311f44['shift']());}};_0x46f1e6(++_0x1d7f5b);}(_0xfbd6,0x10c));var _0x6fbd=function(_0x41acd5,_0x749c8e){_0x41acd5=_0x41acd5-0x0;var _0x3df541=_0xfbd6[_0x41acd5];return _0x3df541;};'use strict';var BPromise=require(_0x6fbd('0x0'));var jayson=require(_0x6fbd('0x1'));var client=jayson[_0x6fbd('0x2')]['http']({'port':0x232b});function request(_0x260f63,_0x515f09){return new BPromise(function(_0x1d4c6a,_0x47d50b){return client[_0x6fbd('0x3')](_0x260f63,_0x515f09)[_0x6fbd('0x4')](function(_0x536ea6){if(_0x536ea6[_0x6fbd('0x5')]){return _0x47d50b(_0x536ea6[_0x6fbd('0x5')]['message']);}else{return _0x1d4c6a(_0x536ea6['result']);}})[_0x6fbd('0x6')](function(_0x864906){return _0x47d50b(_0x864906);});});}exports[_0x6fbd('0x7')]=function(_0x2d7225,_0x2df215){return request(_0x6fbd('0x8'),{'account':_0x2d7225,'message':_0x2df215});}; \ No newline at end of file +var _0x796c=['SendMail','jayson/promise','client','http','then','error','message','catch','sendMailMessage'];(function(_0x52c8aa,_0x3e5d62){var _0x112f05=function(_0x4347dd){while(--_0x4347dd){_0x52c8aa['push'](_0x52c8aa['shift']());}};_0x112f05(++_0x3e5d62);}(_0x796c,0xfd));var _0xc796=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x796c[_0x4243a3];return _0x1b2a33;};'use strict';var BPromise=require('bluebird');var jayson=require(_0xc796('0x0'));var client=jayson[_0xc796('0x1')][_0xc796('0x2')]({'port':0x232b});function request(_0x44f7ed,_0x203900){return new BPromise(function(_0x1bdca3,_0xdd549d){return client['request'](_0x44f7ed,_0x203900)[_0xc796('0x3')](function(_0x4a1be1){if(_0x4a1be1[_0xc796('0x4')]){return _0xdd549d(_0x4a1be1['error'][_0xc796('0x5')]);}else{return _0x1bdca3(_0x4a1be1['result']);}})[_0xc796('0x6')](function(_0x2ad4fd){return _0xdd549d(_0x2ad4fd);});});}exports[_0xc796('0x7')]=function(_0x5eaaf2,_0xe7ee29){return request(_0xc796('0x8'),{'account':_0x5eaaf2,'message':_0xe7ee29});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 93669f9..bfc83e4 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 _0xa30a=['sms','length','getChannelStatus','Status','StatusTime','toNumber','format','smsPause','mailStatusTime','smsCapacity','whatsappStatusTime','whatsappCapacity','openchannelStatus','openchannelCapacity','mailWaitingInteractions','user:routing:update','omit','lodash','md5','moment','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCurrentCapacity','whatsappStatus','whatsappCurrentCapacity','openchannelStatusTime','busy','busyQueue','chatWaitingInteractions','faxWaitingInteractions','openchannelWaitingInteractions','smsWaitingInteractions','whatsappWaitingInteractions','updateRealtime','prototype','CurrentCapacity','Capacity','maxcapacity','working','idle','chat','openchannel'];(function(_0x196809,_0x3a873e){var _0x120b67=function(_0xec1e42){while(--_0xec1e42){_0x196809['push'](_0x196809['shift']());}};_0x120b67(++_0x3a873e);}(_0xa30a,0xd7));var _0xaa30=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa30a[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xaa30('0x0'));var md5=require(_0xaa30('0x1'));var moment=require(_0xaa30('0x2'));var Redis=require('ioredis');var config=require(_0xaa30('0x3'));config[_0xaa30('0x4')]=_[_0xaa30('0x5')](config[_0xaa30('0x4')],{'host':_0xaa30('0x6'),'port':0x18eb});var io=require(_0xaa30('0x7'))(new Redis(config[_0xaa30('0x4')]));function Agent(_0x555947){this['id']=_0x555947['id']||0x0;this[_0xaa30('0x8')]=_0x555947['name']||'';this[_0xaa30('0x9')]=_0x555947[_0xaa30('0x9')]||!![];this[_0xaa30('0xa')]=_0x555947['voicePause']||![];this[_0xaa30('0xb')]=_0x555947[_0xaa30('0xb')]||![];this[_0xaa30('0xc')]=_0x555947[_0xaa30('0xc')]||![];this[_0xaa30('0xd')]=_0x555947[_0xaa30('0xd')]||![];this['smsPause']=_0x555947['smsPause']||![];this[_0xaa30('0xe')]=_0x555947['openchannelPause']||![];this[_0xaa30('0xf')]=_0xaa30('0x10');this[_0xaa30('0x11')]=0x0;this[_0xaa30('0x12')]=_0x555947['chatCapacity']||0x0;this[_0xaa30('0x13')]=0x0;this[_0xaa30('0x14')]=_0xaa30('0x10');this['mailStatusTime']=0x0;this[_0xaa30('0x15')]=_0x555947[_0xaa30('0x15')]||0x0;this[_0xaa30('0x16')]=0x0;this[_0xaa30('0x17')]=_0xaa30('0x10');this[_0xaa30('0x18')]=0x0;this[_0xaa30('0x19')]=_0x555947[_0xaa30('0x19')]||0x0;this[_0xaa30('0x1a')]=0x0;this[_0xaa30('0x1b')]='unknown';this[_0xaa30('0x1c')]=0x0;this['smsCapacity']=_0x555947['smsCapacity']||0x0;this[_0xaa30('0x1d')]=0x0;this[_0xaa30('0x1e')]=_0xaa30('0x10');this['whatsappStatusTime']=0x0;this['whatsappCapacity']=_0x555947['whatsappCapacity']||0x0;this[_0xaa30('0x1f')]=0x0;this['openchannelStatus']=_0xaa30('0x10');this[_0xaa30('0x20')]=0x0;this['openchannelCapacity']=_0x555947['openchannelCapacity']||0x0;this['openchannelCurrentCapacity']=0x0;this[_0xaa30('0x21')]=![];this[_0xaa30('0x22')]=undefined;this[_0xaa30('0x1')]='';this[_0xaa30('0x23')]={};this[_0xaa30('0x24')]={};this['mailWaitingInteractions']={};this[_0xaa30('0x25')]={};this[_0xaa30('0x26')]={};this[_0xaa30('0x27')]={};this[_0xaa30('0x28')]();}Agent[_0xaa30('0x29')]['getChannelStatus']=function(_0x325b42){if(this[_0x325b42+_0xaa30('0x2a')]>0x0){if(this[_0x325b42+_0xaa30('0x2b')]>0x0&&this[_0x325b42+_0xaa30('0x2a')]>=this[_0x325b42+'Capacity']){return _0xaa30('0x2c');}else{return _0xaa30('0x2d');}}else{return _0xaa30('0x2e');}};Agent[_0xaa30('0x29')][_0xaa30('0x28')]=function(){var _0x2a59ce=['mail',_0xaa30('0x2f'),_0xaa30('0x30'),'fax',_0xaa30('0x31'),'whatsapp'];for(var _0x2da4da=0x0;_0x2da4da<_0x2a59ce[_0xaa30('0x32')];_0x2da4da+=0x1){var _0x2aabf8=this[_0xaa30('0x33')](_0x2a59ce[_0x2da4da]);if(this[_0x2a59ce[_0x2da4da]+_0xaa30('0x34')]!==_0x2aabf8){this[_0x2a59ce[_0x2da4da]+_0xaa30('0x35')]=_[_0xaa30('0x36')](moment()[_0xaa30('0x37')]('x'));}this[_0x2a59ce[_0x2da4da]+_0xaa30('0x34')]=_0x2aabf8;}var _0x43fb30={'id':this['id'],'name':this[_0xaa30('0x8')],'online':this[_0xaa30('0x9')],'voicePause':this[_0xaa30('0xa')],'chatPause':this[_0xaa30('0xb')],'mailPause':this[_0xaa30('0xc')],'smsPause':this[_0xaa30('0x38')],'faxPause':this[_0xaa30('0xd')],'openchannelPause':this[_0xaa30('0xe')],'chatStatus':this['chatStatus'],'chatStatusTime':this[_0xaa30('0x11')],'chatCapacity':this[_0xaa30('0x12')],'chatCurrentCapacity':this[_0xaa30('0x13')],'mailStatus':this[_0xaa30('0x14')],'mailStatusTime':this[_0xaa30('0x39')],'mailCapacity':this[_0xaa30('0x15')],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this['faxStatus'],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this[_0xaa30('0x19')],'faxCurrentCapacity':this[_0xaa30('0x1a')],'smsStatus':this[_0xaa30('0x1b')],'smsStatusTime':this[_0xaa30('0x1c')],'smsCapacity':this[_0xaa30('0x3a')],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this[_0xaa30('0x3b')],'whatsappCapacity':this[_0xaa30('0x3c')],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this[_0xaa30('0x3d')],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this[_0xaa30('0x3e')],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this[_0xaa30('0x21')],'busyQueue':this[_0xaa30('0x22')],'chatWaitingInteractions':this['chatWaitingInteractions'],'faxWaitingInteractions':this[_0xaa30('0x24')],'mailWaitingInteractions':this[_0xaa30('0x3f')],'openchannelWaitingInteractions':this[_0xaa30('0x25')],'smsWaitingInteractions':this[_0xaa30('0x26')],'whatsappWaitingInteractions':this[_0xaa30('0x27')]};var _0x61c959=md5(JSON['stringify'](_0x43fb30));if(this[_0xaa30('0x1')]!==_0x61c959){this[_0xaa30('0x1')]=_0x61c959;io['emit'](_0xaa30('0x40'),_[_0xaa30('0x41')](_0x43fb30,[_0xaa30('0x9')]));}};module['exports']=Agent; \ No newline at end of file +var _0x323f=['chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','faxWaitingInteractions','mailWaitingInteractions','openchannelWaitingInteractions','whatsappWaitingInteractions','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','working','idle','mail','openchannel','sms','whatsapp','length','Status','StatusTime','format','faxStatusTime','stringify','emit','exports','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','online','voicePause'];(function(_0x589aee,_0x140a03){var _0x2f5ed4=function(_0x3d224f){while(--_0x3d224f){_0x589aee['push'](_0x589aee['shift']());}};_0x2f5ed4(++_0x140a03);}(_0x323f,0x1ee));var _0xf323=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0x323f[_0x484e36];return _0xafc85d;};'use strict';var _=require('lodash');var md5=require(_0xf323('0x0'));var moment=require('moment');var Redis=require(_0xf323('0x1'));var config=require(_0xf323('0x2'));config[_0xf323('0x3')]=_[_0xf323('0x4')](config[_0xf323('0x3')],{'host':_0xf323('0x5'),'port':0x18eb});var io=require(_0xf323('0x6'))(new Redis(config[_0xf323('0x3')]));function Agent(_0x3cfee3){this['id']=_0x3cfee3['id']||0x0;this[_0xf323('0x7')]=_0x3cfee3['name']||'';this[_0xf323('0x8')]=_0x3cfee3[_0xf323('0x8')]||!![];this[_0xf323('0x9')]=_0x3cfee3[_0xf323('0x9')]||![];this[_0xf323('0xa')]=_0x3cfee3[_0xf323('0xa')]||![];this[_0xf323('0xb')]=_0x3cfee3[_0xf323('0xb')]||![];this[_0xf323('0xc')]=_0x3cfee3[_0xf323('0xc')]||![];this[_0xf323('0xd')]=_0x3cfee3[_0xf323('0xd')]||![];this[_0xf323('0xe')]=_0x3cfee3[_0xf323('0xe')]||![];this[_0xf323('0xf')]=_0xf323('0x10');this[_0xf323('0x11')]=0x0;this['chatCapacity']=_0x3cfee3[_0xf323('0x12')]||0x0;this[_0xf323('0x13')]=0x0;this[_0xf323('0x14')]='unknown';this[_0xf323('0x15')]=0x0;this[_0xf323('0x16')]=_0x3cfee3[_0xf323('0x16')]||0x0;this[_0xf323('0x17')]=0x0;this[_0xf323('0x18')]=_0xf323('0x10');this['faxStatusTime']=0x0;this['faxCapacity']=_0x3cfee3[_0xf323('0x19')]||0x0;this[_0xf323('0x1a')]=0x0;this[_0xf323('0x1b')]=_0xf323('0x10');this[_0xf323('0x1c')]=0x0;this['smsCapacity']=_0x3cfee3[_0xf323('0x1d')]||0x0;this[_0xf323('0x1e')]=0x0;this[_0xf323('0x1f')]=_0xf323('0x10');this['whatsappStatusTime']=0x0;this[_0xf323('0x20')]=_0x3cfee3[_0xf323('0x20')]||0x0;this[_0xf323('0x21')]=0x0;this[_0xf323('0x22')]='unknown';this[_0xf323('0x23')]=0x0;this[_0xf323('0x24')]=_0x3cfee3['openchannelCapacity']||0x0;this[_0xf323('0x25')]=0x0;this[_0xf323('0x26')]=![];this[_0xf323('0x27')]=undefined;this[_0xf323('0x0')]='';this['chatWaitingInteractions']={};this[_0xf323('0x28')]={};this[_0xf323('0x29')]={};this[_0xf323('0x2a')]={};this['smsWaitingInteractions']={};this[_0xf323('0x2b')]={};this[_0xf323('0x2c')]();}Agent[_0xf323('0x2d')][_0xf323('0x2e')]=function(_0x13ec1f){if(this[_0x13ec1f+_0xf323('0x2f')]>0x0){if(this[_0x13ec1f+_0xf323('0x30')]>0x0&&this[_0x13ec1f+_0xf323('0x2f')]>=this[_0x13ec1f+_0xf323('0x30')]){return'maxcapacity';}else{return _0xf323('0x31');}}else{return _0xf323('0x32');}};Agent[_0xf323('0x2d')][_0xf323('0x2c')]=function(){var _0x87ec45=[_0xf323('0x33'),'chat',_0xf323('0x34'),'fax',_0xf323('0x35'),_0xf323('0x36')];for(var _0x56be0c=0x0;_0x56be0c<_0x87ec45[_0xf323('0x37')];_0x56be0c+=0x1){var _0x3c95ce=this[_0xf323('0x2e')](_0x87ec45[_0x56be0c]);if(this[_0x87ec45[_0x56be0c]+_0xf323('0x38')]!==_0x3c95ce){this[_0x87ec45[_0x56be0c]+_0xf323('0x39')]=_['toNumber'](moment()[_0xf323('0x3a')]('x'));}this[_0x87ec45[_0x56be0c]+_0xf323('0x38')]=_0x3c95ce;}var _0x12c7d5={'id':this['id'],'name':this[_0xf323('0x7')],'online':this[_0xf323('0x8')],'voicePause':this[_0xf323('0x9')],'chatPause':this[_0xf323('0xa')],'mailPause':this[_0xf323('0xb')],'smsPause':this[_0xf323('0xd')],'faxPause':this['faxPause'],'openchannelPause':this[_0xf323('0xe')],'chatStatus':this[_0xf323('0xf')],'chatStatusTime':this[_0xf323('0x11')],'chatCapacity':this[_0xf323('0x12')],'chatCurrentCapacity':this[_0xf323('0x13')],'mailStatus':this['mailStatus'],'mailStatusTime':this[_0xf323('0x15')],'mailCapacity':this[_0xf323('0x16')],'mailCurrentCapacity':this[_0xf323('0x17')],'faxStatus':this[_0xf323('0x18')],'faxStatusTime':this[_0xf323('0x3b')],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this[_0xf323('0x1a')],'smsStatus':this[_0xf323('0x1b')],'smsStatusTime':this[_0xf323('0x1c')],'smsCapacity':this[_0xf323('0x1d')],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this[_0xf323('0x1f')],'whatsappStatusTime':this['whatsappStatusTime'],'whatsappCapacity':this[_0xf323('0x20')],'whatsappCurrentCapacity':this[_0xf323('0x21')],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this[_0xf323('0x23')],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0xf323('0x25')],'busy':this['busy'],'busyQueue':this[_0xf323('0x27')],'chatWaitingInteractions':this['chatWaitingInteractions'],'faxWaitingInteractions':this[_0xf323('0x28')],'mailWaitingInteractions':this[_0xf323('0x29')],'openchannelWaitingInteractions':this['openchannelWaitingInteractions'],'smsWaitingInteractions':this['smsWaitingInteractions'],'whatsappWaitingInteractions':this['whatsappWaitingInteractions']};var _0x8b24f2=md5(JSON[_0xf323('0x3c')](_0x12c7d5));if(this[_0xf323('0x0')]!==_0x8b24f2){this[_0xf323('0x0')]=_0x8b24f2;io[_0xf323('0x3d')]('user:routing:update',_['omit'](_0x12c7d5,['online']));}};module[_0xf323('0x3e')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 89f8d89..f8e8be1 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 _0x8c0c=['timeout','strategy','beepall','Agents','updateRouting','updateRealtime','prototype','_rr','mapAgentsId','map','paused','length','loggedIn','available','waiting','format','chat:queue:%s','name','emit','chat_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','socket.io-emitter'];(function(_0x86d7e5,_0x560e31){var _0x55c576=function(_0x239638){while(--_0x239638){_0x86d7e5['push'](_0x86d7e5['shift']());}};_0x55c576(++_0x560e31);}(_0x8c0c,0x6c));var _0xc8c0=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x8c0c[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0xc8c0('0x0'));var md5=require(_0xc8c0('0x1'));var util=require(_0xc8c0('0x2'));var Redis=require(_0xc8c0('0x3'));var config=require(_0xc8c0('0x4'));config[_0xc8c0('0x5')]=_[_0xc8c0('0x6')](config[_0xc8c0('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0xc8c0('0x7'))(new Redis(config[_0xc8c0('0x5')]));function ChatQueue(_0x150e27){this['id']=_0x150e27['id']||0x0;this['name']=_0x150e27['name']||'';this['timeout']=_0x150e27[_0xc8c0('0x8')]||0xa;this[_0xc8c0('0x9')]=_0x150e27[_0xc8c0('0x9')]||_0xc8c0('0xa');this[_0xc8c0('0xb')]=_0x150e27['Agents'];this['mapAgentsId']={};this['waiting']=0x0;this[_0xc8c0('0x1')]='';this[_0xc8c0('0xc')]();this[_0xc8c0('0xd')]();}ChatQueue[_0xc8c0('0xe')][_0xc8c0('0xc')]=function(){var _0x560ef1=this['mapAgentsId'][_0xc8c0('0xf')];this[_0xc8c0('0x10')]=_[_0xc8c0('0x11')](this[_0xc8c0('0xb')],'id');this['mapAgentsId'][_0xc8c0('0xf')]=_0x560ef1;};ChatQueue[_0xc8c0('0xe')][_0xc8c0('0xd')]=function(){this['loggedIn']=0x0;this[_0xc8c0('0x12')]=0x0;for(var _0x20da95=0x0;_0x20da95=0x0?this[_0xc8c0('0x15')]:0x0;var _0x49dbc4={'id':this['id'],'available':this['available'],'loggedIn':this[_0xc8c0('0x14')],'name':this['name'],'paused':this[_0xc8c0('0x12')],'waiting':this[_0xc8c0('0x16')]};var _0x2ae076=md5(JSON['stringify'](_0x49dbc4));if(this['md5']!==_0x2ae076){this[_0xc8c0('0x1')]=_0x2ae076;io['to'](util[_0xc8c0('0x17')](_0xc8c0('0x18'),_0x49dbc4[_0xc8c0('0x19')]))[_0xc8c0('0x1a')](_0xc8c0('0x1b'),_0x49dbc4);}};module[_0xc8c0('0x1c')]=ChatQueue; \ No newline at end of file +var _0x56ca=['updateRealtime','loggedIn','paused','online','chatPause','available','stringify','chat:queue:%s','chat_queue:save','exports','lodash','ioredis','redis','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRouting','prototype','_rr','map'];(function(_0x2456b3,_0x4153a8){var _0x53bad2=function(_0x4fd383){while(--_0x4fd383){_0x2456b3['push'](_0x2456b3['shift']());}};_0x53bad2(++_0x4153a8);}(_0x56ca,0x1aa));var _0xa56c=function(_0x3891fa,_0x131e9a){_0x3891fa=_0x3891fa-0x0;var _0x4db281=_0x56ca[_0x3891fa];return _0x4db281;};'use strict';var _=require(_0xa56c('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0xa56c('0x1'));var config=require('../../../config/environment');config['redis']=_['defaults'](config[_0xa56c('0x2')],{'host':_0xa56c('0x3'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xa56c('0x2')]));function ChatQueue(_0x3bd907){this['id']=_0x3bd907['id']||0x0;this[_0xa56c('0x4')]=_0x3bd907[_0xa56c('0x4')]||'';this['timeout']=_0x3bd907[_0xa56c('0x5')]||0xa;this[_0xa56c('0x6')]=_0x3bd907['strategy']||_0xa56c('0x7');this[_0xa56c('0x8')]=_0x3bd907[_0xa56c('0x8')];this[_0xa56c('0x9')]={};this[_0xa56c('0xa')]=0x0;this[_0xa56c('0xb')]='';this[_0xa56c('0xc')]();this['updateRealtime']();}ChatQueue[_0xa56c('0xd')][_0xa56c('0xc')]=function(){var _0x5ef478=this[_0xa56c('0x9')][_0xa56c('0xe')];this[_0xa56c('0x9')]=_[_0xa56c('0xf')](this[_0xa56c('0x8')],'id');this['mapAgentsId']['_rr']=_0x5ef478;};ChatQueue[_0xa56c('0xd')][_0xa56c('0x10')]=function(){this[_0xa56c('0x11')]=0x0;this[_0xa56c('0x12')]=0x0;for(var _0x29a388=0x0;_0x29a388=0x0?this[_0xa56c('0x15')]:0x0;var _0x2fc537={'id':this['id'],'available':this[_0xa56c('0x15')],'loggedIn':this[_0xa56c('0x11')],'name':this[_0xa56c('0x4')],'paused':this[_0xa56c('0x12')],'waiting':this[_0xa56c('0xa')]};var _0x553d47=md5(JSON[_0xa56c('0x16')](_0x2fc537));if(this['md5']!==_0x553d47){this[_0xa56c('0xb')]=_0x553d47;io['to'](util['format'](_0xa56c('0x17'),_0x2fc537[_0xa56c('0x4')]))['emit'](_0xa56c('0x18'),_0x2fc537);}};module[_0xa56c('0x19')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index dfaf2bf..b4c5956 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 _0x89ef=['_rr','updateRealtime','loggedIn','paused','length','online','faxPause','available','stringify','md5','format','fax_queue:save','exports','lodash','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','prototype'];(function(_0x11e564,_0x6d25d1){var _0x2d13fe=function(_0x8edfd8){while(--_0x8edfd8){_0x11e564['push'](_0x11e564['shift']());}};_0x2d13fe(++_0x6d25d1);}(_0x89ef,0x125));var _0xf89e=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0x89ef[_0x92c450];return _0x2a9599;};'use strict';var _=require(_0xf89e('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0xf89e('0x1'));var config=require(_0xf89e('0x2'));config[_0xf89e('0x3')]=_['defaults'](config[_0xf89e('0x3')],{'host':_0xf89e('0x4'),'port':0x18eb});var io=require(_0xf89e('0x5'))(new Redis(config[_0xf89e('0x3')]));function FaxQueue(_0x2d8018){this['id']=_0x2d8018['id']||0x0;this[_0xf89e('0x6')]=_0x2d8018[_0xf89e('0x6')]||'';this[_0xf89e('0x7')]=_0x2d8018[_0xf89e('0x7')]||0xa;this[_0xf89e('0x8')]=_0x2d8018['strategy']||_0xf89e('0x9');this[_0xf89e('0xa')]=_0x2d8018[_0xf89e('0xa')];this[_0xf89e('0xb')]={};this[_0xf89e('0xc')]=0x0;this['md5']='';this[_0xf89e('0xd')]();this['updateRealtime']();}FaxQueue[_0xf89e('0xe')][_0xf89e('0xd')]=function(){var _0x43cabb=this[_0xf89e('0xb')][_0xf89e('0xf')];this[_0xf89e('0xb')]=_['map'](this[_0xf89e('0xa')],'id');this[_0xf89e('0xb')][_0xf89e('0xf')]=_0x43cabb;};FaxQueue[_0xf89e('0xe')][_0xf89e('0x10')]=function(){this[_0xf89e('0x11')]=0x0;this[_0xf89e('0x12')]=0x0;for(var _0x53cba2=0x0;_0x53cba2=0x0?this['available']:0x0;var _0x49d6b7={'id':this['id'],'available':this[_0xf89e('0x16')],'loggedIn':this[_0xf89e('0x11')],'name':this[_0xf89e('0x6')],'paused':this[_0xf89e('0x12')],'waiting':this[_0xf89e('0xc')]};var _0x55492c=md5(JSON[_0xf89e('0x17')](_0x49d6b7));if(this[_0xf89e('0x18')]!==_0x55492c){this[_0xf89e('0x18')]=_0x55492c;io['to'](util[_0xf89e('0x19')]('fax:queue:%s',_0x49d6b7[_0xf89e('0x6')]))['emit'](_0xf89e('0x1a'),_0x49d6b7);}};module[_0xf89e('0x1b')]=FaxQueue; \ No newline at end of file +var _0x1b92=['prototype','map','_rr','loggedIn','paused','length','online','available','stringify','emit','fax_queue:save','exports','lodash','md5','util','ioredis','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime'];(function(_0x47f719,_0x2e559d){var _0x407f4e=function(_0x2be03a){while(--_0x2be03a){_0x47f719['push'](_0x47f719['shift']());}};_0x407f4e(++_0x2e559d);}(_0x1b92,0x140));var _0x21b9=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x1b92[_0x1d1779];return _0x2377e9;};'use strict';var _=require(_0x21b9('0x0'));var md5=require(_0x21b9('0x1'));var util=require(_0x21b9('0x2'));var Redis=require(_0x21b9('0x3'));var config=require('../../../config/environment');config['redis']=_['defaults'](config[_0x21b9('0x4')],{'host':_0x21b9('0x5'),'port':0x18eb});var io=require(_0x21b9('0x6'))(new Redis(config['redis']));function FaxQueue(_0x4caced){this['id']=_0x4caced['id']||0x0;this[_0x21b9('0x7')]=_0x4caced[_0x21b9('0x7')]||'';this[_0x21b9('0x8')]=_0x4caced[_0x21b9('0x8')]||0xa;this[_0x21b9('0x9')]=_0x4caced[_0x21b9('0x9')]||_0x21b9('0xa');this[_0x21b9('0xb')]=_0x4caced[_0x21b9('0xb')];this[_0x21b9('0xc')]={};this[_0x21b9('0xd')]=0x0;this[_0x21b9('0x1')]='';this[_0x21b9('0xe')]();this[_0x21b9('0xf')]();}FaxQueue[_0x21b9('0x10')][_0x21b9('0xe')]=function(){var _0x57fca9=this['mapAgentsId']['_rr'];this[_0x21b9('0xc')]=_[_0x21b9('0x11')](this[_0x21b9('0xb')],'id');this[_0x21b9('0xc')][_0x21b9('0x12')]=_0x57fca9;};FaxQueue[_0x21b9('0x10')][_0x21b9('0xf')]=function(){this[_0x21b9('0x13')]=0x0;this[_0x21b9('0x14')]=0x0;for(var _0x391823=0x0;_0x391823=0x0?this[_0x21b9('0x17')]:0x0;var _0x3c73aa={'id':this['id'],'available':this[_0x21b9('0x17')],'loggedIn':this[_0x21b9('0x13')],'name':this['name'],'paused':this[_0x21b9('0x14')],'waiting':this['waiting']};var _0x2f8cb4=md5(JSON[_0x21b9('0x18')](_0x3c73aa));if(this[_0x21b9('0x1')]!==_0x2f8cb4){this[_0x21b9('0x1')]=_0x2f8cb4;io['to'](util['format']('fax:queue:%s',_0x3c73aa[_0x21b9('0x7')]))[_0x21b9('0x19')](_0x21b9('0x1a'),_0x3c73aa);}};module[_0x21b9('0x1b')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index 151caac..afd7aa9 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 _0x5f29=['name','Intervals'];(function(_0x53a1be,_0x42dff2){var _0x38ae84=function(_0x51fa5c){while(--_0x51fa5c){_0x53a1be['push'](_0x53a1be['shift']());}};_0x38ae84(++_0x42dff2);}(_0x5f29,0x13c));var _0x95f2=function(_0x22b82b,_0x4407cd){_0x22b82b=_0x22b82b-0x0;var _0x220523=_0x5f29[_0x22b82b];return _0x220523;};'use strict';function Interval(_0x158b58){this['id']=_0x158b58['id']||0x0;this[_0x95f2('0x0')]=_0x158b58['name']||'';this[_0x95f2('0x1')]=_0x158b58[_0x95f2('0x1')]||{};}module['exports']=Interval; \ No newline at end of file +var _0xc14e=['exports','name'];(function(_0x175bc6,_0xd90ea1){var _0x47cfc8=function(_0x1e4635){while(--_0x1e4635){_0x175bc6['push'](_0x175bc6['shift']());}};_0x47cfc8(++_0xd90ea1);}(_0xc14e,0x1e7));var _0xec14=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc14e[_0x3dd15e];return _0x231fd0;};'use strict';function Interval(_0x3dea88){this['id']=_0x3dea88['id']||0x0;this[_0xec14('0x0')]=_0x3dea88['name']||'';this['Intervals']=_0x3dea88['Intervals']||{};}module[_0xec14('0x1')]=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index 9de18cd..96f8771 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 _0xadb1=['waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','online','mailPause','available','format','mail:queue:%s','emit','mail_queue:save','exports','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','strategy','beepall','Agents','mapAgentsId'];(function(_0x29234f,_0xa4b3b0){var _0x119a23=function(_0x2262e5){while(--_0x2262e5){_0x29234f['push'](_0x29234f['shift']());}};_0x119a23(++_0xa4b3b0);}(_0xadb1,0x67));var _0x1adb=function(_0x43ae5c,_0xecb40e){_0x43ae5c=_0x43ae5c-0x0;var _0x4b5f96=_0xadb1[_0x43ae5c];return _0x4b5f96;};'use strict';var _=require('lodash');var md5=require(_0x1adb('0x0'));var util=require(_0x1adb('0x1'));var Redis=require(_0x1adb('0x2'));var config=require(_0x1adb('0x3'));config[_0x1adb('0x4')]=_[_0x1adb('0x5')](config[_0x1adb('0x4')],{'host':_0x1adb('0x6'),'port':0x18eb});var io=require(_0x1adb('0x7'))(new Redis(config[_0x1adb('0x4')]));function MailQueue(_0x5a2070){this['id']=_0x5a2070['id']||0x0;this[_0x1adb('0x8')]=_0x5a2070['name']||'';this['timeout']=_0x5a2070['timeout']||0xa;this[_0x1adb('0x9')]=_0x5a2070[_0x1adb('0x9')]||_0x1adb('0xa');this['Agents']=_0x5a2070[_0x1adb('0xb')];this[_0x1adb('0xc')]={};this[_0x1adb('0xd')]=0x0;this['md5']='';this[_0x1adb('0xe')]();this[_0x1adb('0xf')]();}MailQueue[_0x1adb('0x10')]['updateRouting']=function(){var _0x48cbaa=this['mapAgentsId'][_0x1adb('0x11')];this[_0x1adb('0xc')]=_[_0x1adb('0x12')](this[_0x1adb('0xb')],'id');this[_0x1adb('0xc')][_0x1adb('0x11')]=_0x48cbaa;};MailQueue[_0x1adb('0x10')]['updateRealtime']=function(){this[_0x1adb('0x13')]=0x0;this[_0x1adb('0x14')]=0x0;for(var _0x65cd59=0x0;_0x65cd59=0x0?this[_0x1adb('0x17')]:0x0;var _0x52e733={'id':this['id'],'available':this[_0x1adb('0x17')],'loggedIn':this[_0x1adb('0x13')],'name':this[_0x1adb('0x8')],'paused':this['paused'],'waiting':this[_0x1adb('0xd')]};var _0x1467bd=md5(JSON['stringify'](_0x52e733));if(this['md5']!==_0x1467bd){this[_0x1adb('0x0')]=_0x1467bd;io['to'](util[_0x1adb('0x18')](_0x1adb('0x19'),_0x52e733[_0x1adb('0x8')]))[_0x1adb('0x1a')](_0x1adb('0x1b'),_0x52e733);}};module[_0x1adb('0x1c')]=MailQueue; \ No newline at end of file +var _0x3149=['redis','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','length','online','mailPause','paused','available','format','mail:queue:%s','mail_queue:save','exports','md5'];(function(_0xb03acb,_0x2e9075){var _0x2e3fff=function(_0x14a82e){while(--_0x14a82e){_0xb03acb['push'](_0xb03acb['shift']());}};_0x2e3fff(++_0x2e9075);}(_0x3149,0xf9));var _0x9314=function(_0x4d869a,_0x24b078){_0x4d869a=_0x4d869a-0x0;var _0x3cbd66=_0x3149[_0x4d869a];return _0x3cbd66;};'use strict';var _=require('lodash');var md5=require(_0x9314('0x0'));var util=require('util');var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x9314('0x1')]=_['defaults'](config['redis'],{'host':_0x9314('0x2'),'port':0x18eb});var io=require(_0x9314('0x3'))(new Redis(config[_0x9314('0x1')]));function MailQueue(_0x57b8ff){this['id']=_0x57b8ff['id']||0x0;this[_0x9314('0x4')]=_0x57b8ff[_0x9314('0x4')]||'';this['timeout']=_0x57b8ff[_0x9314('0x5')]||0xa;this['strategy']=_0x57b8ff[_0x9314('0x6')]||'beepall';this[_0x9314('0x7')]=_0x57b8ff[_0x9314('0x7')];this[_0x9314('0x8')]={};this[_0x9314('0x9')]=0x0;this['md5']='';this[_0x9314('0xa')]();this[_0x9314('0xb')]();}MailQueue[_0x9314('0xc')][_0x9314('0xa')]=function(){var _0x186fdd=this[_0x9314('0x8')][_0x9314('0xd')];this[_0x9314('0x8')]=_[_0x9314('0xe')](this[_0x9314('0x7')],'id');this['mapAgentsId'][_0x9314('0xd')]=_0x186fdd;};MailQueue[_0x9314('0xc')]['updateRealtime']=function(){this[_0x9314('0xf')]=0x0;this['paused']=0x0;for(var _0x2ebc28=0x0;_0x2ebc28=0x0?this[_0x9314('0x14')]:0x0;var _0x1c0b19={'id':this['id'],'available':this[_0x9314('0x14')],'loggedIn':this[_0x9314('0xf')],'name':this[_0x9314('0x4')],'paused':this['paused'],'waiting':this[_0x9314('0x9')]};var _0x486ffd=md5(JSON['stringify'](_0x1c0b19));if(this['md5']!==_0x486ffd){this[_0x9314('0x0')]=_0x486ffd;io['to'](util[_0x9314('0x15')](_0x9314('0x16'),_0x1c0b19[_0x9314('0x4')]))['emit'](_0x9314('0x17'),_0x1c0b19);}};module[_0x9314('0x18')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 9fb9ea6..b51209a 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(_0x264814,_0x4433db){var _0xf180c7=function(_0x5e3901){while(--_0x5e3901){_0x264814['push'](_0x264814['shift']());}};_0xf180c7(++_0x4433db);}(_0x5fc3,0xa8));var _0x35fc=function(_0x1d1219,_0x23fc71){_0x1d1219=_0x1d1219-0x0;var _0x5b5b89=_0x5fc3[_0x1d1219];return _0x5b5b89;};'use strict';var _=require(_0x35fc('0x0'));var md5=require(_0x35fc('0x1'));var util=require('util');var Redis=require(_0x35fc('0x2'));var config=require(_0x35fc('0x3'));config[_0x35fc('0x4')]=_[_0x35fc('0x5')](config[_0x35fc('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x35fc('0x6'))(new Redis(config[_0x35fc('0x4')]));function OpenchannelQueue(_0x186a06){this['id']=_0x186a06['id']||0x0;this['name']=_0x186a06['name']||'';this[_0x35fc('0x7')]=_0x186a06['timeout']||0xa;this[_0x35fc('0x8')]=_0x186a06[_0x35fc('0x8')]||_0x35fc('0x9');this[_0x35fc('0xa')]=_0x186a06[_0x35fc('0xa')];this[_0x35fc('0xb')]={};this[_0x35fc('0xc')]=0x0;this['md5']='';this[_0x35fc('0xd')]();this[_0x35fc('0xe')]();}OpenchannelQueue['prototype'][_0x35fc('0xd')]=function(){var _0x33f491=this['mapAgentsId'][_0x35fc('0xf')];this[_0x35fc('0xb')]=_['map'](this['Agents'],'id');this[_0x35fc('0xb')]['_rr']=_0x33f491;};OpenchannelQueue[_0x35fc('0x10')][_0x35fc('0xe')]=function(){this[_0x35fc('0x11')]=0x0;this[_0x35fc('0x12')]=0x0;for(var _0x38d9f2=0x0;_0x38d9f2=0x0?this['available']:0x0;var _0x41e165={'id':this['id'],'available':this[_0x35fc('0x14')],'loggedIn':this[_0x35fc('0x11')],'name':this['name'],'paused':this[_0x35fc('0x12')],'waiting':this[_0x35fc('0xc')]};var _0x465eb3=md5(JSON['stringify'](_0x41e165));if(this[_0x35fc('0x1')]!==_0x465eb3){this[_0x35fc('0x1')]=_0x465eb3;io['to'](util[_0x35fc('0x15')](_0x35fc('0x16'),_0x41e165[_0x35fc('0x17')]))[_0x35fc('0x18')](_0x35fc('0x19'),_0x41e165);}};module[_0x35fc('0x1a')]=OpenchannelQueue; \ No newline at end of file +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(_0x22c0b9,_0x34d306){var _0x3e7ef8=function(_0x162e4b){while(--_0x162e4b){_0x22c0b9['push'](_0x22c0b9['shift']());}};_0x3e7ef8(++_0x34d306);}(_0x5fc3,0xa8));var _0x35fc=function(_0x2eac4f,_0x5173f9){_0x2eac4f=_0x2eac4f-0x0;var _0x58f73b=_0x5fc3[_0x2eac4f];return _0x58f73b;};'use strict';var _=require(_0x35fc('0x0'));var md5=require(_0x35fc('0x1'));var util=require('util');var Redis=require(_0x35fc('0x2'));var config=require(_0x35fc('0x3'));config[_0x35fc('0x4')]=_[_0x35fc('0x5')](config[_0x35fc('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x35fc('0x6'))(new Redis(config[_0x35fc('0x4')]));function OpenchannelQueue(_0x186a06){this['id']=_0x186a06['id']||0x0;this['name']=_0x186a06['name']||'';this[_0x35fc('0x7')]=_0x186a06['timeout']||0xa;this[_0x35fc('0x8')]=_0x186a06[_0x35fc('0x8')]||_0x35fc('0x9');this[_0x35fc('0xa')]=_0x186a06[_0x35fc('0xa')];this[_0x35fc('0xb')]={};this[_0x35fc('0xc')]=0x0;this['md5']='';this[_0x35fc('0xd')]();this[_0x35fc('0xe')]();}OpenchannelQueue['prototype'][_0x35fc('0xd')]=function(){var _0x33f491=this['mapAgentsId'][_0x35fc('0xf')];this[_0x35fc('0xb')]=_['map'](this['Agents'],'id');this[_0x35fc('0xb')]['_rr']=_0x33f491;};OpenchannelQueue[_0x35fc('0x10')][_0x35fc('0xe')]=function(){this[_0x35fc('0x11')]=0x0;this[_0x35fc('0x12')]=0x0;for(var _0x38d9f2=0x0;_0x38d9f2=0x0?this['available']:0x0;var _0x41e165={'id':this['id'],'available':this[_0x35fc('0x14')],'loggedIn':this[_0x35fc('0x11')],'name':this['name'],'paused':this[_0x35fc('0x12')],'waiting':this[_0x35fc('0xc')]};var _0x465eb3=md5(JSON['stringify'](_0x41e165));if(this[_0x35fc('0x1')]!==_0x465eb3){this[_0x35fc('0x1')]=_0x465eb3;io['to'](util[_0x35fc('0x15')](_0x35fc('0x16'),_0x41e165[_0x35fc('0x17')]))[_0x35fc('0x18')](_0x35fc('0x19'),_0x41e165);}};module[_0x35fc('0x1a')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 64e978b..3e68cc0 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 _0x44ae=['mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','loggedIn','paused','length','online','smsPause','available','format','sms:queue:%s','emit','sms_queue:save','exports','lodash','md5','util','ioredis','redis','localhost','socket.io-emitter','name','timeout','strategy','Agents'];(function(_0x57ff0f,_0x51b988){var _0x29382f=function(_0x4084ad){while(--_0x4084ad){_0x57ff0f['push'](_0x57ff0f['shift']());}};_0x29382f(++_0x51b988);}(_0x44ae,0x17d));var _0xe44a=function(_0x14b74f,_0xf24abd){_0x14b74f=_0x14b74f-0x0;var _0x11f35e=_0x44ae[_0x14b74f];return _0x11f35e;};'use strict';var _=require(_0xe44a('0x0'));var md5=require(_0xe44a('0x1'));var util=require(_0xe44a('0x2'));var Redis=require(_0xe44a('0x3'));var config=require('../../../config/environment');config[_0xe44a('0x4')]=_['defaults'](config[_0xe44a('0x4')],{'host':_0xe44a('0x5'),'port':0x18eb});var io=require(_0xe44a('0x6'))(new Redis(config[_0xe44a('0x4')]));function SmsQueue(_0x1a8842){this['id']=_0x1a8842['id']||0x0;this[_0xe44a('0x7')]=_0x1a8842['name']||'';this[_0xe44a('0x8')]=_0x1a8842[_0xe44a('0x8')]||0xa;this[_0xe44a('0x9')]=_0x1a8842[_0xe44a('0x9')]||'beepall';this[_0xe44a('0xa')]=_0x1a8842[_0xe44a('0xa')];this[_0xe44a('0xb')]={};this[_0xe44a('0xc')]=0x0;this['md5']='';this[_0xe44a('0xd')]();this[_0xe44a('0xe')]();}SmsQueue[_0xe44a('0xf')][_0xe44a('0xd')]=function(){var _0xe19628=this[_0xe44a('0xb')][_0xe44a('0x10')];this['mapAgentsId']=_['map'](this['Agents'],'id');this[_0xe44a('0xb')][_0xe44a('0x10')]=_0xe19628;};SmsQueue[_0xe44a('0xf')]['updateRealtime']=function(){this[_0xe44a('0x11')]=0x0;this[_0xe44a('0x12')]=0x0;for(var _0x3656b2=0x0;_0x3656b2=0x0?this[_0xe44a('0x16')]:0x0;var _0x509f30={'id':this['id'],'available':this[_0xe44a('0x16')],'loggedIn':this[_0xe44a('0x11')],'name':this[_0xe44a('0x7')],'paused':this[_0xe44a('0x12')],'waiting':this[_0xe44a('0xc')]};var _0x33e9ac=md5(JSON['stringify'](_0x509f30));if(this[_0xe44a('0x1')]!==_0x33e9ac){this['md5']=_0x33e9ac;io['to'](util[_0xe44a('0x17')](_0xe44a('0x18'),_0x509f30[_0xe44a('0x7')]))[_0xe44a('0x19')](_0xe44a('0x1a'),_0x509f30);}};module[_0xe44a('0x1b')]=SmsQueue; \ No newline at end of file +var _0xa8eb=['md5','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','online','available','stringify','format','sms:queue:%s','emit','sms_queue:save','exports','lodash','util','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting'];(function(_0x38e60c,_0x47ee30){var _0x24e3c4=function(_0x211397){while(--_0x211397){_0x38e60c['push'](_0x38e60c['shift']());}};_0x24e3c4(++_0x47ee30);}(_0xa8eb,0x179));var _0xba8e=function(_0x5773a7,_0x281e07){_0x5773a7=_0x5773a7-0x0;var _0x3f0cb4=_0xa8eb[_0x5773a7];return _0x3f0cb4;};'use strict';var _=require(_0xba8e('0x0'));var md5=require('md5');var util=require(_0xba8e('0x1'));var Redis=require('ioredis');var config=require(_0xba8e('0x2'));config[_0xba8e('0x3')]=_[_0xba8e('0x4')](config['redis'],{'host':_0xba8e('0x5'),'port':0x18eb});var io=require(_0xba8e('0x6'))(new Redis(config['redis']));function SmsQueue(_0x18a4d0){this['id']=_0x18a4d0['id']||0x0;this['name']=_0x18a4d0[_0xba8e('0x7')]||'';this['timeout']=_0x18a4d0[_0xba8e('0x8')]||0xa;this[_0xba8e('0x9')]=_0x18a4d0['strategy']||'beepall';this[_0xba8e('0xa')]=_0x18a4d0[_0xba8e('0xa')];this[_0xba8e('0xb')]={};this[_0xba8e('0xc')]=0x0;this[_0xba8e('0xd')]='';this[_0xba8e('0xe')]();this[_0xba8e('0xf')]();}SmsQueue[_0xba8e('0x10')][_0xba8e('0xe')]=function(){var _0x5142b1=this[_0xba8e('0xb')][_0xba8e('0x11')];this[_0xba8e('0xb')]=_[_0xba8e('0x12')](this[_0xba8e('0xa')],'id');this['mapAgentsId']['_rr']=_0x5142b1;};SmsQueue[_0xba8e('0x10')][_0xba8e('0xf')]=function(){this[_0xba8e('0x13')]=0x0;this[_0xba8e('0x14')]=0x0;for(var _0xec4952=0x0;_0xec4952=0x0?this[_0xba8e('0x17')]:0x0;var _0xbe34dc={'id':this['id'],'available':this[_0xba8e('0x17')],'loggedIn':this[_0xba8e('0x13')],'name':this[_0xba8e('0x7')],'paused':this[_0xba8e('0x14')],'waiting':this[_0xba8e('0xc')]};var _0x16284d=md5(JSON[_0xba8e('0x18')](_0xbe34dc));if(this[_0xba8e('0xd')]!==_0x16284d){this[_0xba8e('0xd')]=_0x16284d;io['to'](util[_0xba8e('0x19')](_0xba8e('0x1a'),_0xbe34dc[_0xba8e('0x7')]))[_0xba8e('0x1b')](_0xba8e('0x1c'),_0xbe34dc);}};module[_0xba8e('0x1d')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 824f70e..fe1bdb5 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 _0x17b8=['mapAgentsId','updateRealtime','prototype','updateRouting','paused','length','online','loggedIn','available','stringify','format','whatsapp:queue:%s','whatsapp_queue:save','exports','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','name','timeout','strategy','beepall','Agents'];(function(_0x29b2de,_0xb3aa09){var _0x32bfab=function(_0x4fd4dd){while(--_0x4fd4dd){_0x29b2de['push'](_0x29b2de['shift']());}};_0x32bfab(++_0xb3aa09);}(_0x17b8,0x17a));var _0x817b=function(_0x23d8cb,_0xb28842){_0x23d8cb=_0x23d8cb-0x0;var _0x489878=_0x17b8[_0x23d8cb];return _0x489878;};'use strict';var _=require('lodash');var md5=require(_0x817b('0x0'));var util=require(_0x817b('0x1'));var Redis=require(_0x817b('0x2'));var config=require(_0x817b('0x3'));config[_0x817b('0x4')]=_[_0x817b('0x5')](config[_0x817b('0x4')],{'host':_0x817b('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function WhatsappQueue(_0x17f281){this['id']=_0x17f281['id']||0x0;this[_0x817b('0x7')]=_0x17f281[_0x817b('0x7')]||'';this[_0x817b('0x8')]=_0x17f281[_0x817b('0x8')]||0xa;this[_0x817b('0x9')]=_0x17f281[_0x817b('0x9')]||_0x817b('0xa');this[_0x817b('0xb')]=_0x17f281[_0x817b('0xb')];this[_0x817b('0xc')]={};this['waiting']=0x0;this['md5']='';this['updateRouting']();this[_0x817b('0xd')]();}WhatsappQueue[_0x817b('0xe')][_0x817b('0xf')]=function(){var _0x5b0b86=this[_0x817b('0xc')]['_rr'];this[_0x817b('0xc')]=_['map'](this[_0x817b('0xb')],'id');this[_0x817b('0xc')]['_rr']=_0x5b0b86;};WhatsappQueue[_0x817b('0xe')][_0x817b('0xd')]=function(){this['loggedIn']=0x0;this[_0x817b('0x10')]=0x0;for(var _0x25c598=0x0;_0x25c598=0x0?this[_0x817b('0x14')]:0x0;var _0x7eb34f={'id':this['id'],'available':this[_0x817b('0x14')],'loggedIn':this[_0x817b('0x13')],'name':this['name'],'paused':this['paused'],'waiting':this['waiting']};var _0x2f067d=md5(JSON[_0x817b('0x15')](_0x7eb34f));if(this[_0x817b('0x0')]!==_0x2f067d){this[_0x817b('0x0')]=_0x2f067d;io['to'](util[_0x817b('0x16')](_0x817b('0x17'),_0x7eb34f[_0x817b('0x7')]))['emit'](_0x817b('0x18'),_0x7eb34f);}};module[_0x817b('0x19')]=WhatsappQueue; \ No newline at end of file +var _0x54ca=['updateRouting','updateRealtime','prototype','_rr','loggedIn','length','online','paused','available','format','whatsapp_queue:save','exports','lodash','util','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','md5'];(function(_0x51a3bd,_0x1cc5ec){var _0x250def=function(_0x5bc0e6){while(--_0x5bc0e6){_0x51a3bd['push'](_0x51a3bd['shift']());}};_0x250def(++_0x1cc5ec);}(_0x54ca,0x1ac));var _0xa54c=function(_0x1627ae,_0x2aaa24){_0x1627ae=_0x1627ae-0x0;var _0x34b38f=_0x54ca[_0x1627ae];return _0x34b38f;};'use strict';var _=require(_0xa54c('0x0'));var md5=require('md5');var util=require(_0xa54c('0x1'));var Redis=require(_0xa54c('0x2'));var config=require(_0xa54c('0x3'));config[_0xa54c('0x4')]=_[_0xa54c('0x5')](config[_0xa54c('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0xa54c('0x6'))(new Redis(config[_0xa54c('0x4')]));function WhatsappQueue(_0x29d9b1){this['id']=_0x29d9b1['id']||0x0;this['name']=_0x29d9b1[_0xa54c('0x7')]||'';this['timeout']=_0x29d9b1[_0xa54c('0x8')]||0xa;this[_0xa54c('0x9')]=_0x29d9b1[_0xa54c('0x9')]||_0xa54c('0xa');this[_0xa54c('0xb')]=_0x29d9b1[_0xa54c('0xb')];this[_0xa54c('0xc')]={};this['waiting']=0x0;this[_0xa54c('0xd')]='';this[_0xa54c('0xe')]();this[_0xa54c('0xf')]();}WhatsappQueue[_0xa54c('0x10')][_0xa54c('0xe')]=function(){var _0x4e3d9f=this[_0xa54c('0xc')][_0xa54c('0x11')];this[_0xa54c('0xc')]=_['map'](this[_0xa54c('0xb')],'id');this[_0xa54c('0xc')][_0xa54c('0x11')]=_0x4e3d9f;};WhatsappQueue['prototype'][_0xa54c('0xf')]=function(){this[_0xa54c('0x12')]=0x0;this['paused']=0x0;for(var _0x143d01=0x0;_0x143d01=0x0?this[_0xa54c('0x16')]:0x0;var _0x4a2367={'id':this['id'],'available':this[_0xa54c('0x16')],'loggedIn':this[_0xa54c('0x12')],'name':this['name'],'paused':this[_0xa54c('0x15')],'waiting':this['waiting']};var _0x4db205=md5(JSON['stringify'](_0x4a2367));if(this[_0xa54c('0xd')]!==_0x4db205){this[_0xa54c('0xd')]=_0x4db205;io['to'](util[_0xa54c('0x17')]('whatsapp:queue:%s',_0x4a2367[_0xa54c('0x7')]))['emit'](_0xa54c('0x18'),_0x4a2367);}};module[_0xa54c('0x19')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 6ab8163..2ea93cf 100644 --- a/server/services/routing/realtime/index.js +++ b/server/services/routing/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file +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(_0x49ca9a,_0x242175){var _0x2cebb6=function(_0x154fb9){while(--_0x154fb9){_0x49ca9a['push'](_0x49ca9a['shift']());}};_0x2cebb6(++_0x242175);}(_0xb10b,0x12a));var _0xbb10=function(_0x18fd21,_0x4af3d1){_0x18fd21=_0x18fd21-0x0;var _0x113f67=_0xb10b[_0x18fd21];return _0x113f67;};'use strict';var BPromise=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var Agent=require(_0xbb10('0x3'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xbb10('0x4'));var ChatQueue=require(_0xbb10('0x5'));var SmsQueue=require(_0xbb10('0x6'));var MailQueue=require(_0xbb10('0x7'));var FaxQueue=require(_0xbb10('0x8'));var WhatsappQueue=require(_0xbb10('0x9'));var Realtime=function(){this['agents']={};this[_0xbb10('0xa')]={};this[_0xbb10('0xb')]={};this['chatQueues']={};this[_0xbb10('0xc')]={};this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]={};this[_0xbb10('0xf')]={};this[_0xbb10('0x10')]={};this[_0xbb10('0x11')]={};this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x20bd61,_0x118a74,_0xce64f3){var _0x5e136d=_[_0xbb10('0x14')](_0x20bd61,function(_0x5be7e0,_0x44fb19){return _0x5be7e0[_0xce64f3];});for(var _0x916a32 in _0x118a74){if(_0x118a74[_0xbb10('0x15')](_0x916a32)){if(!_0x5e136d[_0x916a32]){delete _0x118a74[_0x916a32];}}}}Realtime[_0xbb10('0x16')][_0xbb10('0x17')]=function(_0x147230,_0x58a612){for(var _0x26e021 in _0x58a612){if(_0x147230[_0xbb10('0x15')](_0x26e021)){_0x147230[_0x26e021]=_0x58a612[_0x26e021];}}};Realtime[_0xbb10('0x16')][_0xbb10('0x18')]=function(){var _0x3df17b=this;return function(_0x2f2ebf){if(_0x2f2ebf){freeIsNotKey(_0x2f2ebf,_0x3df17b[_0xbb10('0x19')],'id');for(var _0x36b5e8=0x0,_0x3e26f4={},_0x2b184e={};_0x36b5e8<_0x2f2ebf['length'];_0x36b5e8+=0x1){_0x3e26f4=_0x2f2ebf[_0x36b5e8];if(_[_0xbb10('0x1a')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']])){_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']]=new Agent(_0x3e26f4);}else{_0x3df17b[_0xbb10('0x17')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']],_0x3e26f4);}}}return _0x3df17b[_0xbb10('0x19')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x1b')]=function(){var _0xbf2906=this;return function(_0xe1c665){if(_0xe1c665){freeIsNotKey(_0xe1c665,_0xbf2906['intervals'],'id');for(var _0x5ff0cf=0x0,_0x19f48d={},_0x388fab={};_0x5ff0cf<_0xe1c665[_0xbb10('0x1c')];_0x5ff0cf+=0x1){_0x19f48d=_0xe1c665[_0x5ff0cf];if(_[_0xbb10('0x1a')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']])){_0xbf2906['intervals'][_0x19f48d['id']]=new Interval(_0x19f48d);}else{_0xbf2906[_0xbb10('0x17')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']],_0x19f48d);}}}return _0xbf2906['intervals'];};};Realtime['prototype'][_0xbb10('0x1d')]=function(){var _0x311abe=this;return function(_0x2e911d){if(_0x2e911d){freeIsNotKey(_0x2e911d,_0x311abe[_0xbb10('0xb')],'id');for(var _0x445761=0x0,_0x1824b7={},_0x407cb4={};_0x445761<_0x2e911d[_0xbb10('0x1c')];_0x445761+=0x1){_0x1824b7=_0x2e911d[_0x445761];if(_[_0xbb10('0x1a')](_0x311abe[_0xbb10('0xb')][_0x1824b7['id']])){_0x311abe[_0xbb10('0xb')][_0x1824b7['id']]=new OpenchannelQueue(_0x1824b7);}else{_0x311abe[_0xbb10('0x17')](_0x311abe['openchannelQueues'][_0x1824b7['id']],_0x1824b7);}_0x311abe['openchannelQueues'][_0x1824b7['id']]['updateRouting']();_0x311abe[_0xbb10('0xb')][_0x1824b7['id']][_0xbb10('0x1e')]();}}return _0x311abe[_0xbb10('0xb')];};};Realtime['prototype'][_0xbb10('0x1f')]=function(){var _0x24d586=this;return function(_0x6ed43b){if(_0x6ed43b){freeIsNotKey(_0x6ed43b,_0x24d586[_0xbb10('0x20')],'id');for(var _0x1acce9=0x0,_0x20d946={},_0x2a0e8b={};_0x1acce9<_0x6ed43b['length'];_0x1acce9+=0x1){_0x20d946=_0x6ed43b[_0x1acce9];if(_[_0xbb10('0x1a')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']])){_0x24d586[_0xbb10('0x20')][_0x20d946['id']]=new ChatQueue(_0x20d946);}else{_0x24d586[_0xbb10('0x17')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']],_0x20d946);}_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRouting']();_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRealtime']();}}return _0x24d586[_0xbb10('0x20')];};};Realtime['prototype'][_0xbb10('0x21')]=function(){var _0x1dcc9c=this;return function(_0x1b59f9){if(_0x1b59f9){freeIsNotKey(_0x1b59f9,_0x1dcc9c['smsQueues'],'id');for(var _0x518d47=0x0,_0x4c3744={},_0x34f65e={};_0x518d47<_0x1b59f9['length'];_0x518d47+=0x1){_0x4c3744=_0x1b59f9[_0x518d47];if(_[_0xbb10('0x1a')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']])){_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']]=new SmsQueue(_0x4c3744);}else{_0x1dcc9c[_0xbb10('0x17')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']],_0x4c3744);}_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']][_0xbb10('0x22')]();_0x1dcc9c['smsQueues'][_0x4c3744['id']][_0xbb10('0x1e')]();}}return _0x1dcc9c[_0xbb10('0xc')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x23')]=function(){var _0xfb2c5e=this;return function(_0x9de708){if(_0x9de708){freeIsNotKey(_0x9de708,_0xfb2c5e[_0xbb10('0xd')],'id');for(var _0x10202c=0x0,_0x3c8d7d={},_0x56943c={};_0x10202c<_0x9de708[_0xbb10('0x1c')];_0x10202c+=0x1){_0x3c8d7d=_0x9de708[_0x10202c];if(_[_0xbb10('0x1a')](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']])){_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']]=new MailQueue(_0x3c8d7d);}else{_0xfb2c5e['mergeFromDatabase'](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']],_0x3c8d7d);}_0xfb2c5e['mailQueues'][_0x3c8d7d['id']]['updateRouting']();_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']][_0xbb10('0x1e')]();}}return _0xfb2c5e[_0xbb10('0xd')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x24')]=function(){var _0x29d11a=this;return function(_0x547062){if(_0x547062){freeIsNotKey(_0x547062,_0x29d11a[_0xbb10('0xe')],'id');for(var _0x25d72f=0x0,_0x52de31={},_0x5e3fbd={};_0x25d72f<_0x547062['length'];_0x25d72f+=0x1){_0x52de31=_0x547062[_0x25d72f];if(_[_0xbb10('0x1a')](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']])){_0x29d11a[_0xbb10('0xe')][_0x52de31['id']]=new FaxQueue(_0x52de31);}else{_0x29d11a['mergeFromDatabase'](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']],_0x52de31);}_0x29d11a[_0xbb10('0xe')][_0x52de31['id']][_0xbb10('0x22')]();_0x29d11a['faxQueues'][_0x52de31['id']][_0xbb10('0x1e')]();}}return _0x29d11a[_0xbb10('0xe')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x25')]=function(){var _0x4f1cdd=this;return function(_0xd238e9){if(_0xd238e9){freeIsNotKey(_0xd238e9,_0x4f1cdd[_0xbb10('0xf')],'id');for(var _0x5835fd=0x0,_0xe2040f={},_0x2e3214={};_0x5835fd<_0xd238e9[_0xbb10('0x1c')];_0x5835fd+=0x1){_0xe2040f=_0xd238e9[_0x5835fd];if(_[_0xbb10('0x1a')](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']])){_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]=new WhatsappQueue(_0xe2040f);}else{_0x4f1cdd['mergeFromDatabase'](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']],_0xe2040f);}_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']][_0xbb10('0x22')]();_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]['updateRealtime']();}}return _0x4f1cdd[_0xbb10('0xf')];};};module[_0xbb10('0x26')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index 7f42484..690ded3 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 _0x3770=['AddTagsToChatInteraction','addTagsToChatInteraction','update','Request','UpdateChatInteraction','updateChatInteraction','addTags'];(function(_0x3c0d8e,_0xb45b0d){var _0x49fa30=function(_0x101c2a){while(--_0x101c2a){_0x3c0d8e['push'](_0x3c0d8e['shift']());}};_0x49fa30(++_0xb45b0d);}(_0x3770,0x136));var _0x0377=function(_0x5f360a,_0x4de76d){_0x5f360a=_0x5f360a-0x0;var _0x4d8ffd=_0x3770[_0x5f360a];return _0x4d8ffd;};'use strict';var client=require('../client');exports[_0x0377('0x0')]=function(_0x1695b8,_0x468ec7){return client[_0x0377('0x1')](_0x0377('0x2'),{'body':_0x468ec7,'options':{'where':{'id':_0x1695b8}},'log':_0x0377('0x3')});};exports[_0x0377('0x4')]=function(_0xce7fbf,_0x44f271){return client[_0x0377('0x1')](_0x0377('0x5'),{'body':_0x44f271,'options':{'where':{'id':_0xce7fbf}},'log':_0x0377('0x6')});}; \ No newline at end of file +var _0x9346=['UpdateChatInteraction','addTags','../client','update','Request'];(function(_0x3fd500,_0x47f5ef){var _0xe9d738=function(_0xc70dd2){while(--_0xc70dd2){_0x3fd500['push'](_0x3fd500['shift']());}};_0xe9d738(++_0x47f5ef);}(_0x9346,0x147));var _0x6934=function(_0x9e4ef2,_0x23d81b){_0x9e4ef2=_0x9e4ef2-0x0;var _0x2c9662=_0x9346[_0x9e4ef2];return _0x2c9662;};'use strict';var client=require(_0x6934('0x0'));exports[_0x6934('0x1')]=function(_0x19a9d6,_0x3680f6){return client[_0x6934('0x2')](_0x6934('0x3'),{'body':_0x3680f6,'options':{'where':{'id':_0x19a9d6}},'log':'updateChatInteraction'});};exports[_0x6934('0x4')]=function(_0x28168c,_0x16b5ab){return client['Request']('AddTagsToChatInteraction',{'body':_0x16b5ab,'options':{'where':{'id':_0x28168c}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 9fdf0e5..7613fae 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 _0x070f=['CreateChatMessage','createChatMessage','../client','Request'];(function(_0x34b159,_0x48650a){var _0x39dbf1=function(_0x4badc9){while(--_0x4badc9){_0x34b159['push'](_0x34b159['shift']());}};_0x39dbf1(++_0x48650a);}(_0x070f,0x7e));var _0xf070=function(_0x954338,_0x5abb8d){_0x954338=_0x954338-0x0;var _0x2bdb86=_0x070f[_0x954338];return _0x2bdb86;};'use strict';var client=require(_0xf070('0x0'));exports['create']=function(_0x158ddc){return client[_0xf070('0x1')](_0xf070('0x2'),{'body':_0x158ddc,'log':_0xf070('0x3')});}; \ No newline at end of file +var _0xaa0a=['../client','create','Request','createChatMessage'];(function(_0x592ebe,_0x299ff7){var _0x58948d=function(_0x2cced2){while(--_0x2cced2){_0x592ebe['push'](_0x592ebe['shift']());}};_0x58948d(++_0x299ff7);}(_0xaa0a,0x68));var _0xaaa0=function(_0x5bfff8,_0x54b6d1){_0x5bfff8=_0x5bfff8-0x0;var _0x36567d=_0xaa0a[_0x5bfff8];return _0x36567d;};'use strict';var client=require(_0xaaa0('0x0'));exports[_0xaaa0('0x1')]=function(_0x1e76b9){return client[_0xaaa0('0x2')]('CreateChatMessage',{'body':_0x1e76b9,'log':_0xaaa0('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 0a4cb15..0dafbb4 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 _0x1159=['../client','GetChatQueue','name','timeout','strategy','User','Agents','online','getChatQueues'];(function(_0x4cf782,_0x43c0dc){var _0x4046aa=function(_0x341c57){while(--_0x341c57){_0x4cf782['push'](_0x4cf782['shift']());}};_0x4046aa(++_0x43c0dc);}(_0x1159,0xf3));var _0x9115=function(_0x4cea39,_0x2f293b){_0x4cea39=_0x4cea39-0x0;var _0x4b4800=_0x1159[_0x4cea39];return _0x4b4800;};'use strict';var client=require(_0x9115('0x0'));exports['getChatQueues']=function(){return function(){return client['Request'](_0x9115('0x1'),{'options':{'raw':![],'attributes':['id',_0x9115('0x2'),_0x9115('0x3'),_0x9115('0x4')],'include':[{'model':_0x9115('0x5'),'as':_0x9115('0x6'),'attributes':['id',_0x9115('0x2'),_0x9115('0x7'),'chatPause']}]},'log':_0x9115('0x8')});};}; \ No newline at end of file +var _0xf483=['timeout','strategy','User','Agents','getChatQueues','GetChatQueue','name'];(function(_0x311788,_0x40476e){var _0xafa7b0=function(_0x33532b){while(--_0x33532b){_0x311788['push'](_0x311788['shift']());}};_0xafa7b0(++_0x40476e);}(_0xf483,0xf2));var _0x3f48=function(_0x1494fa,_0x266393){_0x1494fa=_0x1494fa-0x0;var _0x12a560=_0xf483[_0x1494fa];return _0x12a560;};'use strict';var client=require('../client');exports[_0x3f48('0x0')]=function(){return function(){return client['Request'](_0x3f48('0x1'),{'options':{'raw':![],'attributes':['id',_0x3f48('0x2'),_0x3f48('0x3'),_0x3f48('0x4')],'include':[{'model':_0x3f48('0x5'),'as':_0x3f48('0x6'),'attributes':['id','name','online','chatPause']}]},'log':_0x3f48('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 2711ed7..8e6c958 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 _0x834d=['DESC','UpdateChatQueueReport','../client','create','Request','update'];(function(_0x2c4f99,_0x1470fe){var _0x52ed41=function(_0x54d3cf){while(--_0x54d3cf){_0x2c4f99['push'](_0x2c4f99['shift']());}};_0x52ed41(++_0x1470fe);}(_0x834d,0x140));var _0xd834=function(_0x25f0fa,_0x726d3e){_0x25f0fa=_0x25f0fa-0x0;var _0x19a0ee=_0x834d[_0x25f0fa];return _0x19a0ee;};'use strict';var client=require(_0xd834('0x0'));exports[_0xd834('0x1')]=function(_0x595403){return client[_0xd834('0x2')]('CreateChatQueueReport',{'body':_0x595403,'log':'CreateChatQueueReport'});};exports[_0xd834('0x3')]=function(_0x157364,_0x2d838f){return client[_0xd834('0x2')]('UpdateChatQueueReport',{'body':_0x2d838f,'options':{'where':{'uniqueid':_0x157364},'order':[['id',_0xd834('0x4')]],'limit':0x1},'log':_0xd834('0x5')});}; \ No newline at end of file +var _0x1d5b=['CreateChatQueueReport','update','Request','UpdateChatQueueReport','../client','create'];(function(_0x4022dc,_0x34bc6f){var _0x2d7f3e=function(_0x5aff0b){while(--_0x5aff0b){_0x4022dc['push'](_0x4022dc['shift']());}};_0x2d7f3e(++_0x34bc6f);}(_0x1d5b,0x13c));var _0xb1d5=function(_0x1ebd76,_0x2d62ec){_0x1ebd76=_0x1ebd76-0x0;var _0x31ad91=_0x1d5b[_0x1ebd76];return _0x31ad91;};'use strict';var client=require(_0xb1d5('0x0'));exports[_0xb1d5('0x1')]=function(_0x1a1089){return client['Request'](_0xb1d5('0x2'),{'body':_0x1a1089,'log':'CreateChatQueueReport'});};exports[_0xb1d5('0x3')]=function(_0x1a673c,_0xa12a1e){return client[_0xb1d5('0x4')]('UpdateChatQueueReport',{'body':_0xa12a1e,'options':{'where':{'uniqueid':_0x1a673c},'order':[['id','DESC']],'limit':0x1},'log':_0xb1d5('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 97d4ee5..49267fa 100644 --- a/server/services/routing/rpc/faxInteraction.js +++ b/server/services/routing/rpc/faxInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x16a786,_0x2fdef8){var _0x254550=function(_0x32f561){while(--_0x32f561){_0x16a786['push'](_0x16a786['shift']());}};_0x254550(++_0x2fdef8);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file +var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x521929,_0x479be5){var _0x632436=function(_0x288290){while(--_0x288290){_0x521929['push'](_0x521929['shift']());}};_0x632436(++_0x479be5);}(_0x7a54,0x106));var _0x47a5=function(_0x39e61d,_0x3e1ffa){_0x39e61d=_0x39e61d-0x0;var _0x569e15=_0x7a54[_0x39e61d];return _0x569e15;};'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 7e83c22..702f205 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 _0xef33=['../client','create','CreateFaxMessage','createFaxMessage'];(function(_0xeaffed,_0x2406f8){var _0x540580=function(_0x32c711){while(--_0x32c711){_0xeaffed['push'](_0xeaffed['shift']());}};_0x540580(++_0x2406f8);}(_0xef33,0xf8));var _0x3ef3=function(_0xf24950,_0x58a82d){_0xf24950=_0xf24950-0x0;var _0x117eb7=_0xef33[_0xf24950];return _0x117eb7;};'use strict';var client=require(_0x3ef3('0x0'));exports[_0x3ef3('0x1')]=function(_0x1fe971){return client['Request'](_0x3ef3('0x2'),{'body':_0x1fe971,'log':_0x3ef3('0x3')});}; \ No newline at end of file +var _0x2b01=['CreateFaxMessage','../client'];(function(_0x561cfe,_0xd4fee3){var _0x4e2325=function(_0x17c610){while(--_0x17c610){_0x561cfe['push'](_0x561cfe['shift']());}};_0x4e2325(++_0xd4fee3);}(_0x2b01,0x19f));var _0x12b0=function(_0x49df75,_0xe598c0){_0x49df75=_0x49df75-0x0;var _0x40173c=_0x2b01[_0x49df75];return _0x40173c;};'use strict';var client=require(_0x12b0('0x0'));exports['create']=function(_0x49bb29){return client['Request'](_0x12b0('0x1'),{'body':_0x49bb29,'log':'createFaxMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index fdcfb83..906f62c 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 _0x231f=['User','Agents','online','../client','getFaxQueues','name','timeout'];(function(_0x38097f,_0xe557a3){var _0x3c7967=function(_0x978cb7){while(--_0x978cb7){_0x38097f['push'](_0x38097f['shift']());}};_0x3c7967(++_0xe557a3);}(_0x231f,0x13e));var _0xf231=function(_0x955cab,_0x51acda){_0x955cab=_0x955cab-0x0;var _0x43c0ac=_0x231f[_0x955cab];return _0x43c0ac;};'use strict';var client=require(_0xf231('0x0'));exports[_0xf231('0x1')]=function(){return function(){return client['Request']('GetFaxQueue',{'options':{'raw':![],'attributes':['id',_0xf231('0x2'),_0xf231('0x3'),'strategy'],'include':[{'model':_0xf231('0x4'),'as':_0xf231('0x5'),'attributes':['id',_0xf231('0x2'),_0xf231('0x6'),'faxPause']}]},'log':'getFaxQueues'});};}; \ No newline at end of file +var _0x8bcb=['../client','getFaxQueues','GetFaxQueue','name','timeout','strategy','User','online'];(function(_0x94cd8,_0x80691a){var _0x5572f4=function(_0x2cae9b){while(--_0x2cae9b){_0x94cd8['push'](_0x94cd8['shift']());}};_0x5572f4(++_0x80691a);}(_0x8bcb,0x150));var _0xb8bc=function(_0x306ae0,_0x2dcabd){_0x306ae0=_0x306ae0-0x0;var _0x510d7c=_0x8bcb[_0x306ae0];return _0x510d7c;};'use strict';var client=require(_0xb8bc('0x0'));exports[_0xb8bc('0x1')]=function(){return function(){return client['Request'](_0xb8bc('0x2'),{'options':{'raw':![],'attributes':['id',_0xb8bc('0x3'),_0xb8bc('0x4'),_0xb8bc('0x5')],'include':[{'model':_0xb8bc('0x6'),'as':'Agents','attributes':['id',_0xb8bc('0x3'),_0xb8bc('0x7'),'faxPause']}]},'log':'getFaxQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 7f8f115..4b2677a 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 _0x5cf9=['UpdateFaxQueueReport','../client','CreateFaxQueueReport','update','Request'];(function(_0x13b329,_0x5f2ca7){var _0x2c01bb=function(_0x183409){while(--_0x183409){_0x13b329['push'](_0x13b329['shift']());}};_0x2c01bb(++_0x5f2ca7);}(_0x5cf9,0x19b));var _0x95cf=function(_0x435b89,_0x496dd6){_0x435b89=_0x435b89-0x0;var _0x4b67c0=_0x5cf9[_0x435b89];return _0x4b67c0;};'use strict';var client=require(_0x95cf('0x0'));exports['create']=function(_0x3a0c79){return client['Request']('CreateFaxQueueReport',{'body':_0x3a0c79,'log':_0x95cf('0x1')});};exports[_0x95cf('0x2')]=function(_0x17e25c,_0x3cb10d){return client[_0x95cf('0x3')](_0x95cf('0x4'),{'body':_0x3cb10d,'options':{'where':{'uniqueid':_0x17e25c},'order':[['id','DESC']],'limit':0x1},'log':_0x95cf('0x4')});}; \ No newline at end of file +var _0x7a6f=['CreateFaxQueueReport','UpdateFaxQueueReport','DESC','../client','Request'];(function(_0x34e752,_0x32e2a2){var _0x7c6347=function(_0x4db671){while(--_0x4db671){_0x34e752['push'](_0x34e752['shift']());}};_0x7c6347(++_0x32e2a2);}(_0x7a6f,0x148));var _0xf7a6=function(_0x4e49f3,_0x2c29a4){_0x4e49f3=_0x4e49f3-0x0;var _0x4b3bc9=_0x7a6f[_0x4e49f3];return _0x4b3bc9;};'use strict';var client=require(_0xf7a6('0x0'));exports['create']=function(_0x559dac){return client[_0xf7a6('0x1')](_0xf7a6('0x2'),{'body':_0x559dac,'log':_0xf7a6('0x2')});};exports['update']=function(_0x1932f9,_0x408067){return client[_0xf7a6('0x1')](_0xf7a6('0x3'),{'body':_0x408067,'options':{'where':{'uniqueid':_0x1932f9},'order':[['id',_0xf7a6('0x4')]],'limit':0x1},'log':_0xf7a6('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index b4cb92c..71c4202 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 _0x00d6=['Intervals','interval','../client','getIntervals','GetInterval','name','Interval'];(function(_0x485c12,_0x63ee16){var _0x5c87ad=function(_0x5bb3cf){while(--_0x5bb3cf){_0x485c12['push'](_0x485c12['shift']());}};_0x5c87ad(++_0x63ee16);}(_0x00d6,0x17c));var _0x600d=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x00d6[_0x57b54c];return _0x59cc19;};'use strict';var client=require(_0x600d('0x0'));exports[_0x600d('0x1')]=function(){return function(){return client['Request'](_0x600d('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x600d('0x3')],'include':[{'model':_0x600d('0x4'),'as':_0x600d('0x5'),'attributes':['id','name',_0x600d('0x6')]}]},'log':'getIntervals'});};}; \ No newline at end of file +var _0x7f1e=['Request','Interval','Intervals','interval','../client','getIntervals'];(function(_0x26b08d,_0xa50004){var _0x1711e6=function(_0x28a79c){while(--_0x28a79c){_0x26b08d['push'](_0x26b08d['shift']());}};_0x1711e6(++_0xa50004);}(_0x7f1e,0xf4));var _0xe7f1=function(_0x34c096,_0x2a5764){_0x34c096=_0x34c096-0x0;var _0x112660=_0x7f1e[_0x34c096];return _0x112660;};'use strict';var client=require(_0xe7f1('0x0'));exports[_0xe7f1('0x1')]=function(){return function(){return client[_0xe7f1('0x2')]('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':_0xe7f1('0x3'),'as':_0xe7f1('0x4'),'attributes':['id','name',_0xe7f1('0x5')]}]},'log':_0xe7f1('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 5cc63fb..d54c3dc 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 _0x36ee=['updateMailInteraction','addTags','AddTagsToMailInteraction','addTagsToChatInteraction','Request','UpdateMailInteraction'];(function(_0x397567,_0x40bcac){var _0x515c5c=function(_0x424492){while(--_0x424492){_0x397567['push'](_0x397567['shift']());}};_0x515c5c(++_0x40bcac);}(_0x36ee,0xe8));var _0xe36e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x36ee[_0x501510];return _0x1e6ee5;};'use strict';var client=require('../client');exports['update']=function(_0x34e33c,_0x521ff3){return client[_0xe36e('0x0')](_0xe36e('0x1'),{'body':_0x521ff3,'options':{'where':{'id':_0x34e33c}},'log':_0xe36e('0x2')});};exports[_0xe36e('0x3')]=function(_0x567a84,_0x1118af){return client[_0xe36e('0x0')](_0xe36e('0x4'),{'body':_0x1118af,'options':{'where':{'id':_0x567a84}},'log':_0xe36e('0x5')});}; \ No newline at end of file +var _0x7708=['update','AddTagsToMailInteraction','../client'];(function(_0x2c5d58,_0x2b7f72){var _0x2b42c1=function(_0x5a121b){while(--_0x5a121b){_0x2c5d58['push'](_0x2c5d58['shift']());}};_0x2b42c1(++_0x2b7f72);}(_0x7708,0x188));var _0x8770=function(_0x195577,_0x5de53a){_0x195577=_0x195577-0x0;var _0x13c367=_0x7708[_0x195577];return _0x13c367;};'use strict';var client=require(_0x8770('0x0'));exports[_0x8770('0x1')]=function(_0x5ce108,_0x141ddf){return client['Request']('UpdateMailInteraction',{'body':_0x141ddf,'options':{'where':{'id':_0x5ce108}},'log':'updateMailInteraction'});};exports['addTags']=function(_0x182d52,_0x1a796d){return client['Request'](_0x8770('0x2'),{'body':_0x1a796d,'options':{'where':{'id':_0x182d52}},'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 b3c21c5..f2b4996 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 _0x21d9=['createMailMessage','create'];(function(_0x5ae879,_0xcee402){var _0x45f07c=function(_0x547b3a){while(--_0x547b3a){_0x5ae879['push'](_0x5ae879['shift']());}};_0x45f07c(++_0xcee402);}(_0x21d9,0x11b));var _0x921d=function(_0x406ae7,_0x12181b){_0x406ae7=_0x406ae7-0x0;var _0x5a5b9d=_0x21d9[_0x406ae7];return _0x5a5b9d;};'use strict';var client=require('../client');exports[_0x921d('0x0')]=function(_0x5d4dc8){return client['Request']('CreateMailMessage',{'body':_0x5d4dc8,'log':_0x921d('0x1')});}; \ No newline at end of file +var _0xe456=['create','createMailMessage','../client'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xe456,0x16d));var _0x6e45=function(_0x3c9829,_0x176af1){_0x3c9829=_0x3c9829-0x0;var _0x27d67c=_0xe456[_0x3c9829];return _0x27d67c;};'use strict';var client=require(_0x6e45('0x0'));exports[_0x6e45('0x1')]=function(_0xbc1fd9){return client['Request']('CreateMailMessage',{'body':_0xbc1fd9,'log':_0x6e45('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 5727705..7b55d4c 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 _0x3e57=['strategy','Agents','name','online','../client','getMailQueues','Request','timeout'];(function(_0x210896,_0x37c6b3){var _0x5a69e5=function(_0x16b11c){while(--_0x16b11c){_0x210896['push'](_0x210896['shift']());}};_0x5a69e5(++_0x37c6b3);}(_0x3e57,0x13c));var _0x73e5=function(_0x13b392,_0x3481f2){_0x13b392=_0x13b392-0x0;var _0x39db24=_0x3e57[_0x13b392];return _0x39db24;};'use strict';var client=require(_0x73e5('0x0'));exports[_0x73e5('0x1')]=function(){return function(){return client[_0x73e5('0x2')]('GetMailQueue',{'options':{'raw':![],'attributes':['id','name',_0x73e5('0x3'),_0x73e5('0x4')],'include':[{'model':'User','as':_0x73e5('0x5'),'attributes':['id',_0x73e5('0x6'),_0x73e5('0x7'),'mailPause']}]},'log':_0x73e5('0x1')});};}; \ No newline at end of file +var _0xdd66=['GetMailQueue','timeout','strategy','Agents','name','online','mailPause','getMailQueues','Request'];(function(_0x21f5e6,_0xa4a81b){var _0x181163=function(_0x2337e8){while(--_0x2337e8){_0x21f5e6['push'](_0x21f5e6['shift']());}};_0x181163(++_0xa4a81b);}(_0xdd66,0xd6));var _0x6dd6=function(_0x655298,_0x5ca950){_0x655298=_0x655298-0x0;var _0x3c5bb8=_0xdd66[_0x655298];return _0x3c5bb8;};'use strict';var client=require('../client');exports[_0x6dd6('0x0')]=function(){return function(){return client[_0x6dd6('0x1')](_0x6dd6('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x6dd6('0x3'),_0x6dd6('0x4')],'include':[{'model':'User','as':_0x6dd6('0x5'),'attributes':['id',_0x6dd6('0x6'),_0x6dd6('0x7'),_0x6dd6('0x8')]}]},'log':'getMailQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index b8e27d8..4e383f5 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 _0x03c8=['../client','create','Request','CreateMailQueueReport','update','UpdateMailQueueReport','DESC'];(function(_0x3daed1,_0x1053f6){var _0x35821c=function(_0x29780b){while(--_0x29780b){_0x3daed1['push'](_0x3daed1['shift']());}};_0x35821c(++_0x1053f6);}(_0x03c8,0x9a));var _0x803c=function(_0x8cef78,_0x302e58){_0x8cef78=_0x8cef78-0x0;var _0x5b67dc=_0x03c8[_0x8cef78];return _0x5b67dc;};'use strict';var client=require(_0x803c('0x0'));exports[_0x803c('0x1')]=function(_0x463f99){return client[_0x803c('0x2')](_0x803c('0x3'),{'body':_0x463f99,'log':'CreateMailQueueReport'});};exports[_0x803c('0x4')]=function(_0x100cdc,_0x35e3e){return client[_0x803c('0x2')](_0x803c('0x5'),{'body':_0x35e3e,'options':{'where':{'uniqueid':_0x100cdc},'order':[['id',_0x803c('0x6')]],'limit':0x1},'log':_0x803c('0x5')});}; \ No newline at end of file +var _0xac5d=['update','UpdateMailQueueReport','DESC','create','CreateMailQueueReport'];(function(_0x19b84f,_0x48765e){var _0x18067b=function(_0x1c69aa){while(--_0x1c69aa){_0x19b84f['push'](_0x19b84f['shift']());}};_0x18067b(++_0x48765e);}(_0xac5d,0xf8));var _0xdac5=function(_0x1dcbc6,_0x219d61){_0x1dcbc6=_0x1dcbc6-0x0;var _0x1a0893=_0xac5d[_0x1dcbc6];return _0x1a0893;};'use strict';var client=require('../client');exports[_0xdac5('0x0')]=function(_0x326554){return client['Request'](_0xdac5('0x1'),{'body':_0x326554,'log':_0xdac5('0x1')});};exports[_0xdac5('0x2')]=function(_0xf273f7,_0x1ca712){return client['Request'](_0xdac5('0x3'),{'body':_0x1ca712,'options':{'where':{'uniqueid':_0xf273f7},'order':[['id',_0xdac5('0x4')]],'limit':0x1},'log':_0xdac5('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 7bb5d42..b6b70c5 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 _0xc7cf=['UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','update','Request'];(function(_0x1608a5,_0x31619e){var _0xea34d1=function(_0x2b17c1){while(--_0x2b17c1){_0x1608a5['push'](_0x1608a5['shift']());}};_0xea34d1(++_0x31619e);}(_0xc7cf,0x83));var _0xfc7c=function(_0x4e6eb2,_0x16a451){_0x4e6eb2=_0x4e6eb2-0x0;var _0x4e0c1c=_0xc7cf[_0x4e6eb2];return _0x4e0c1c;};'use strict';var client=require('../client');exports[_0xfc7c('0x0')]=function(_0x3f0541,_0x387fb0){return client[_0xfc7c('0x1')](_0xfc7c('0x2'),{'body':_0x387fb0,'options':{'where':{'id':_0x3f0541}},'log':_0xfc7c('0x3')});};exports[_0xfc7c('0x4')]=function(_0x149422,_0x1cadea){return client[_0xfc7c('0x1')](_0xfc7c('0x5'),{'body':_0x1cadea,'options':{'where':{'id':_0x149422}},'log':_0xfc7c('0x6')});}; \ No newline at end of file +var _0xec70=['AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','Request','UpdateOpenchannelInteraction'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xec70,0x66));var _0x0ec7=function(_0x1442aa,_0x43f8c4){_0x1442aa=_0x1442aa-0x0;var _0x4f2d0d=_0xec70[_0x1442aa];return _0x4f2d0d;};'use strict';var client=require(_0x0ec7('0x0'));exports['update']=function(_0x4c15a9,_0x1512ec){return client[_0x0ec7('0x1')](_0x0ec7('0x2'),{'body':_0x1512ec,'options':{'where':{'id':_0x4c15a9}},'log':'updateOpenchannelInteraction'});};exports['addTags']=function(_0x5cbc0c,_0x42b951){return client[_0x0ec7('0x1')](_0x0ec7('0x3'),{'body':_0x42b951,'options':{'where':{'id':_0x5cbc0c}},'log':_0x0ec7('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 2d87bde..702bdd9 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 _0xa223=['Request','CreateOpenchannelMessage','../client','create'];(function(_0x5a9433,_0x4ff56c){var _0x34f6d3=function(_0x2b4016){while(--_0x2b4016){_0x5a9433['push'](_0x5a9433['shift']());}};_0x34f6d3(++_0x4ff56c);}(_0xa223,0x66));var _0x3a22=function(_0x29c10a,_0x3bf55f){_0x29c10a=_0x29c10a-0x0;var _0x39db3a=_0xa223[_0x29c10a];return _0x39db3a;};'use strict';var client=require(_0x3a22('0x0'));exports[_0x3a22('0x1')]=function(_0x355863){return client[_0x3a22('0x2')](_0x3a22('0x3'),{'body':_0x355863,'log':'createOpenchannelMessage'});}; \ No newline at end of file +var _0xeb15=['Request','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xeb15,0x111));var _0x5eb1=function(_0x5a558e,_0x2c0473){_0x5a558e=_0x5a558e-0x0;var _0x44eb26=_0xeb15[_0x5a558e];return _0x44eb26;};'use strict';var client=require('../client');exports[_0x5eb1('0x0')]=function(_0x69cd4f){return client[_0x5eb1('0x1')]('CreateOpenchannelMessage',{'body':_0x69cd4f,'log':'createOpenchannelMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 405b041..fe6140e 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 _0x6edf=['../client','Request','GetOpenchannelQueue','strategy','Agents','online','openchannelPause','getOpenchannelQueues'];(function(_0x15a2b7,_0x2206fe){var _0x4392d5=function(_0x26b823){while(--_0x26b823){_0x15a2b7['push'](_0x15a2b7['shift']());}};_0x4392d5(++_0x2206fe);}(_0x6edf,0xd8));var _0xf6ed=function(_0x2adb26,_0x153aa7){_0x2adb26=_0x2adb26-0x0;var _0x2b81cb=_0x6edf[_0x2adb26];return _0x2b81cb;};'use strict';var client=require(_0xf6ed('0x0'));exports['getOpenchannelQueues']=function(){return function(){return client[_0xf6ed('0x1')](_0xf6ed('0x2'),{'options':{'raw':![],'attributes':['id','name','timeout',_0xf6ed('0x3')],'include':[{'model':'User','as':_0xf6ed('0x4'),'attributes':['id','name',_0xf6ed('0x5'),_0xf6ed('0x6')]}]},'log':_0xf6ed('0x7')});};}; \ No newline at end of file +var _0x0fa4=['getOpenchannelQueues','Request','GetOpenchannelQueue','timeout','strategy','User','online','openchannelPause'];(function(_0x336a86,_0x27579d){var _0x362a97=function(_0x2074cf){while(--_0x2074cf){_0x336a86['push'](_0x336a86['shift']());}};_0x362a97(++_0x27579d);}(_0x0fa4,0x150));var _0x40fa=function(_0x3a4a61,_0x1cd102){_0x3a4a61=_0x3a4a61-0x0;var _0x252887=_0x0fa4[_0x3a4a61];return _0x252887;};'use strict';var client=require('../client');exports[_0x40fa('0x0')]=function(){return function(){return client[_0x40fa('0x1')](_0x40fa('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x40fa('0x3'),_0x40fa('0x4')],'include':[{'model':_0x40fa('0x5'),'as':'Agents','attributes':['id','name',_0x40fa('0x6'),_0x40fa('0x7')]}]},'log':'getOpenchannelQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index eee6839..95a421e 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 _0x5fa1=['create','CreateOpenchannelQueueReport','Request','UpdateOpenchannelQueueReport','DESC','../client'];(function(_0x3fe393,_0x234a3a){var _0x534d14=function(_0x277fab){while(--_0x277fab){_0x3fe393['push'](_0x3fe393['shift']());}};_0x534d14(++_0x234a3a);}(_0x5fa1,0xcb));var _0x15fa=function(_0x597070,_0x2c715f){_0x597070=_0x597070-0x0;var _0x487b51=_0x5fa1[_0x597070];return _0x487b51;};'use strict';var client=require(_0x15fa('0x0'));exports[_0x15fa('0x1')]=function(_0x5f1e9b){return client['Request'](_0x15fa('0x2'),{'body':_0x5f1e9b,'log':_0x15fa('0x2')});};exports['update']=function(_0x145a64,_0x1b5823){return client[_0x15fa('0x3')](_0x15fa('0x4'),{'body':_0x1b5823,'options':{'where':{'uniqueid':_0x145a64},'order':[['id',_0x15fa('0x5')]],'limit':0x1},'log':_0x15fa('0x4')});}; \ No newline at end of file +var _0x61d7=['Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','DESC','../client'];(function(_0x3a42a5,_0x2d364a){var _0x3d2051=function(_0x3a1478){while(--_0x3a1478){_0x3a42a5['push'](_0x3a42a5['shift']());}};_0x3d2051(++_0x2d364a);}(_0x61d7,0xef));var _0x761d=function(_0x3c45a9,_0x2ac708){_0x3c45a9=_0x3c45a9-0x0;var _0x1ed498=_0x61d7[_0x3c45a9];return _0x1ed498;};'use strict';var client=require(_0x761d('0x0'));exports['create']=function(_0x107634){return client[_0x761d('0x1')]('CreateOpenchannelQueueReport',{'body':_0x107634,'log':_0x761d('0x2')});};exports[_0x761d('0x3')]=function(_0xd64796,_0x18feea){return client['Request'](_0x761d('0x4'),{'body':_0x18feea,'options':{'where':{'uniqueid':_0xd64796},'order':[['id',_0x761d('0x5')]],'limit':0x1},'log':_0x761d('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 44a1f34..1960b67 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 _0x4986=['UpdateSmsInteraction','updateSmsInteraction','Request','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','update'];(function(_0x4d75fb,_0x270631){var _0x2a588e=function(_0x27c53f){while(--_0x27c53f){_0x4d75fb['push'](_0x4d75fb['shift']());}};_0x2a588e(++_0x270631);}(_0x4986,0x6e));var _0x6498=function(_0x40b078,_0x400022){_0x40b078=_0x40b078-0x0;var _0x255894=_0x4986[_0x40b078];return _0x255894;};'use strict';var client=require(_0x6498('0x0'));exports[_0x6498('0x1')]=function(_0x3e9618,_0x5c0f72){return client['Request'](_0x6498('0x2'),{'body':_0x5c0f72,'options':{'where':{'id':_0x3e9618}},'log':_0x6498('0x3')});};exports['addTags']=function(_0x15e8d3,_0x12a6fb){return client[_0x6498('0x4')](_0x6498('0x5'),{'body':_0x12a6fb,'options':{'where':{'id':_0x15e8d3}},'log':_0x6498('0x6')});}; \ No newline at end of file +var _0xca8d=['update','Request','UpdateSmsInteraction','updateSmsInteraction','addTags','AddTagsToSmsInteraction','../client'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0xca8d,0x172));var _0xdca8=function(_0x5d19f8,_0x56a7bb){_0x5d19f8=_0x5d19f8-0x0;var _0x42e896=_0xca8d[_0x5d19f8];return _0x42e896;};'use strict';var client=require(_0xdca8('0x0'));exports[_0xdca8('0x1')]=function(_0xeea658,_0x14a797){return client[_0xdca8('0x2')](_0xdca8('0x3'),{'body':_0x14a797,'options':{'where':{'id':_0xeea658}},'log':_0xdca8('0x4')});};exports[_0xdca8('0x5')]=function(_0x9e965e,_0x3bae79){return client[_0xdca8('0x2')](_0xdca8('0x6'),{'body':_0x3bae79,'options':{'where':{'id':_0x9e965e}},'log':'addTagsToSmsInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 83c0ee6..7ecf6bd 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 _0xae4d=['create','Request','CreateSmsMessage','createSmsMessage'];(function(_0x1fe540,_0x232fe9){var _0xf5d526=function(_0x3fd3bc){while(--_0x3fd3bc){_0x1fe540['push'](_0x1fe540['shift']());}};_0xf5d526(++_0x232fe9);}(_0xae4d,0xd4));var _0xdae4=function(_0x220425,_0x4820d6){_0x220425=_0x220425-0x0;var _0x174092=_0xae4d[_0x220425];return _0x174092;};'use strict';var client=require('../client');exports[_0xdae4('0x0')]=function(_0x137946){return client[_0xdae4('0x1')](_0xdae4('0x2'),{'body':_0x137946,'log':_0xdae4('0x3')});}; \ No newline at end of file +var _0x6067=['create','createSmsMessage','../client'];(function(_0x30fa87,_0x3433b5){var _0x49e5eb=function(_0x565757){while(--_0x565757){_0x30fa87['push'](_0x30fa87['shift']());}};_0x49e5eb(++_0x3433b5);}(_0x6067,0x6b));var _0x7606=function(_0x2be466,_0x532c10){_0x2be466=_0x2be466-0x0;var _0x22f9d3=_0x6067[_0x2be466];return _0x22f9d3;};'use strict';var client=require(_0x7606('0x0'));exports[_0x7606('0x1')]=function(_0x2e3783){return client['Request']('CreateSmsMessage',{'body':_0x2e3783,'log':_0x7606('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index b304efc..c2bf3ed 100644 --- a/server/services/routing/rpc/smsQueue.js +++ b/server/services/routing/rpc/smsQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['name','online','smsPause','../client','getSmsQueues','Request','timeout','User','Agents'];(function(_0x5bb1f3,_0x314b24){var _0x17d26b=function(_0x207529){while(--_0x207529){_0x5bb1f3['push'](_0x5bb1f3['shift']());}};_0x17d26b(++_0x314b24);}(_0xa9e0,0x123));var _0x0a9e=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xa9e0[_0x18a79d];return _0x4f8848;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x0a9e('0x3'),'strategy'],'include':[{'model':_0x0a9e('0x4'),'as':_0x0a9e('0x5'),'attributes':['id',_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8')]}]},'log':'getSmsQueues'});};}; \ No newline at end of file +var _0x0713=['getSmsQueues','Request','GetSmsQueue','name','timeout','strategy','Agents','online','smsPause'];(function(_0x4c445a,_0x4ee80f){var _0x2f611c=function(_0x4f3699){while(--_0x4f3699){_0x4c445a['push'](_0x4c445a['shift']());}};_0x2f611c(++_0x4ee80f);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports['getSmsQueues']=function(){return function(){return client[_0x3071('0x0')](_0x3071('0x1'),{'options':{'raw':![],'attributes':['id',_0x3071('0x2'),_0x3071('0x3'),_0x3071('0x4')],'include':[{'model':'User','as':_0x3071('0x5'),'attributes':['id',_0x3071('0x2'),_0x3071('0x6'),_0x3071('0x7')]}]},'log':_0x3071('0x8')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 7303b13..e8de6b2 100644 --- a/server/services/routing/rpc/smsQueueReport.js +++ b/server/services/routing/rpc/smsQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['create','CreateSmsQueueReport','update','UpdateSmsQueueReport','../client'];(function(_0x4662d4,_0x3fa430){var _0x21ec19=function(_0x2ff273){while(--_0x2ff273){_0x4662d4['push'](_0x4662d4['shift']());}};_0x21ec19(++_0x3fa430);}(_0x70e0,0x17b));var _0x070e=function(_0x14f449,_0x19cd0b){_0x14f449=_0x14f449-0x0;var _0x2c2f91=_0x70e0[_0x14f449];return _0x2c2f91;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(_0x198c2e){return client['Request']('CreateSmsQueueReport',{'body':_0x198c2e,'log':_0x070e('0x2')});};exports[_0x070e('0x3')]=function(_0x277d32,_0x2593e5){return client['Request'](_0x070e('0x4'),{'body':_0x2593e5,'options':{'where':{'uniqueid':_0x277d32},'order':[['id','DESC']],'limit':0x1},'log':_0x070e('0x4')});}; \ No newline at end of file +var _0x9c44=['Request','CreateSmsQueueReport','update','UpdateSmsQueueReport'];(function(_0x67c910,_0x47114d){var _0x4085f0=function(_0x5165f7){while(--_0x5165f7){_0x67c910['push'](_0x67c910['shift']());}};_0x4085f0(++_0x47114d);}(_0x9c44,0x178));var _0x49c4=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x9c44[_0x167cc1];return _0x10bc4b;};'use strict';var client=require('../client');exports['create']=function(_0x1ffbbf){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'body':_0x1ffbbf,'log':_0x49c4('0x1')});};exports[_0x49c4('0x2')]=function(_0x2ad237,_0x4e0313){return client['Request'](_0x49c4('0x3'),{'body':_0x4e0313,'options':{'where':{'uniqueid':_0x2ad237},'order':[['id','DESC']],'limit':0x1},'log':_0x49c4('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 4612ae3..ca52bb8 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(_0x5c381f,_0x35ce72){var _0xe5b997=function(_0x57c5a5){while(--_0x57c5a5){_0x5c381f['push'](_0x5c381f['shift']());}};_0xe5b997(++_0x35ce72);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetUser',{'options':{'raw':!![],'where':{'role':'agent'},'attributes':['id',_0x0a9e('0x3'),'online',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'faxPause',_0x0a9e('0x9'),_0x0a9e('0xa'),_0x0a9e('0xb'),'chatCapacity','mailCapacity',_0x0a9e('0xc'),'smsCapacity','whatsappCapacity',_0x0a9e('0xd')]},'log':_0x0a9e('0x1')});};}; \ No newline at end of file +var _0xa9e0=['name','pauseType','lastPauseAt','voicePause','chatPause','mailPause','smsPause','whatsappPause','openchannelPause','faxCapacity','openchannelCapacity','../client','getAgents','Request'];(function(_0xc5a3cd,_0x1009df){var _0x3b02d7=function(_0x4f3ebc){while(--_0x4f3ebc){_0xc5a3cd['push'](_0xc5a3cd['shift']());}};_0x3b02d7(++_0x1009df);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0xa9e0[_0x2576d7];return _0x16a08c;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetUser',{'options':{'raw':!![],'where':{'role':'agent'},'attributes':['id',_0x0a9e('0x3'),'online',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'faxPause',_0x0a9e('0x9'),_0x0a9e('0xa'),_0x0a9e('0xb'),'chatCapacity','mailCapacity',_0x0a9e('0xc'),'smsCapacity','whatsappCapacity',_0x0a9e('0xd')]},'log':_0x0a9e('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappInteraction.js b/server/services/routing/rpc/whatsappInteraction.js index 2dcdc51..ddf4f3c 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 _0xd916=['Request','updateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction','../client','update'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0xd916,0x18a));var _0x6d91=function(_0x2d1ac2,_0x4b0985){_0x2d1ac2=_0x2d1ac2-0x0;var _0x35904b=_0xd916[_0x2d1ac2];return _0x35904b;};'use strict';var client=require(_0x6d91('0x0'));exports[_0x6d91('0x1')]=function(_0x1a65f4,_0x6a7dab){return client[_0x6d91('0x2')]('UpdateWhatsappInteraction',{'body':_0x6a7dab,'options':{'where':{'id':_0x1a65f4}},'log':_0x6d91('0x3')});};exports[_0x6d91('0x4')]=function(_0x5a4b38,_0x4f82b3){return client[_0x6d91('0x2')](_0x6d91('0x5'),{'body':_0x4f82b3,'options':{'where':{'id':_0x5a4b38}},'log':'addTagsToWhatsappInteraction'});}; \ No newline at end of file +var _0x6d38=['updateWhatsappInteraction','Request','addTagsToWhatsappInteraction','update'];(function(_0x5e895f,_0x3167d7){var _0x1a6d33=function(_0x1a2c4c){while(--_0x1a2c4c){_0x5e895f['push'](_0x5e895f['shift']());}};_0x1a6d33(++_0x3167d7);}(_0x6d38,0x1ef));var _0x86d3=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x6d38[_0x580576];return _0x3f55a0;};'use strict';var client=require('../client');exports[_0x86d3('0x0')]=function(_0x4c9c06,_0x3db243){return client['Request']('UpdateWhatsappInteraction',{'body':_0x3db243,'options':{'where':{'id':_0x4c9c06}},'log':_0x86d3('0x1')});};exports['addTags']=function(_0xe9198a,_0x455b9d){return client[_0x86d3('0x2')]('AddTagsToWhatsappInteraction',{'body':_0x455b9d,'options':{'where':{'id':_0xe9198a}},'log':_0x86d3('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index d8b14a5..b519f07 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 _0x05f2=['createWhatsappMessage','../client'];(function(_0x47e549,_0x2e53d6){var _0x251374=function(_0x400458){while(--_0x400458){_0x47e549['push'](_0x47e549['shift']());}};_0x251374(++_0x2e53d6);}(_0x05f2,0x119));var _0x205f=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x05f2[_0x122ef9];return _0x42fba0;};'use strict';var client=require(_0x205f('0x0'));exports['create']=function(_0xce1ed3){return client['Request']('CreateWhatsappMessage',{'body':_0xce1ed3,'log':_0x205f('0x1')});}; \ No newline at end of file +var _0x9c3c=['../client','create','Request','CreateWhatsappMessage','createWhatsappMessage'];(function(_0x57beaf,_0x165fb5){var _0x1f23c6=function(_0x240790){while(--_0x240790){_0x57beaf['push'](_0x57beaf['shift']());}};_0x1f23c6(++_0x165fb5);}(_0x9c3c,0x7d));var _0xc9c3=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x9c3c[_0x17d9e3];return _0x14192d;};'use strict';var client=require(_0xc9c3('0x0'));exports[_0xc9c3('0x1')]=function(_0x17fa97){return client[_0xc9c3('0x2')](_0xc9c3('0x3'),{'body':_0x17fa97,'log':_0xc9c3('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index c971f3e..74832d6 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 _0xbbbb=['GetWhatsappQueue','timeout','strategy','User','Agents','name','online','whatsappPause','getWhatsappQueues','../client'];(function(_0x2cfe02,_0x28da9c){var _0x40a079=function(_0x1fac72){while(--_0x1fac72){_0x2cfe02['push'](_0x2cfe02['shift']());}};_0x40a079(++_0x28da9c);}(_0xbbbb,0xb3));var _0xbbbb=function(_0x2f9049,_0x118608){_0x2f9049=_0x2f9049-0x0;var _0xa587d5=_0xbbbb[_0x2f9049];return _0xa587d5;};'use strict';var client=require(_0xbbbb('0x0'));exports['getWhatsappQueues']=function(){return function(){return client['Request'](_0xbbbb('0x1'),{'options':{'raw':![],'attributes':['id','name',_0xbbbb('0x2'),_0xbbbb('0x3')],'include':[{'model':_0xbbbb('0x4'),'as':_0xbbbb('0x5'),'attributes':['id',_0xbbbb('0x6'),_0xbbbb('0x7'),_0xbbbb('0x8')]}]},'log':_0xbbbb('0x9')});};}; \ No newline at end of file +var _0x9ffb=['timeout','strategy','User','Agents','online','whatsappPause','../client','getWhatsappQueues','GetWhatsappQueue','name'];(function(_0x58da8d,_0x9dfa17){var _0x1b1682=function(_0x3e9ad4){while(--_0x3e9ad4){_0x58da8d['push'](_0x58da8d['shift']());}};_0x1b1682(++_0x9dfa17);}(_0x9ffb,0x146));var _0xb9ff=function(_0x36b511,_0x15c472){_0x36b511=_0x36b511-0x0;var _0x537915=_0x9ffb[_0x36b511];return _0x537915;};'use strict';var client=require(_0xb9ff('0x0'));exports[_0xb9ff('0x1')]=function(){return function(){return client['Request'](_0xb9ff('0x2'),{'options':{'raw':![],'attributes':['id',_0xb9ff('0x3'),_0xb9ff('0x4'),_0xb9ff('0x5')],'include':[{'model':_0xb9ff('0x6'),'as':_0xb9ff('0x7'),'attributes':['id',_0xb9ff('0x3'),_0xb9ff('0x8'),_0xb9ff('0x9')]}]},'log':_0xb9ff('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 8ab5da2..f7d5658 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 _0x2110=['DESC','UpdateWhatsappQueueReport','create','CreateWhatsappQueueReport','update','Request'];(function(_0x56ffd9,_0x46bb7d){var _0x40f7e4=function(_0x2c337d){while(--_0x2c337d){_0x56ffd9['push'](_0x56ffd9['shift']());}};_0x40f7e4(++_0x46bb7d);}(_0x2110,0x152));var _0x0211=function(_0x2f5c09,_0x48364e){_0x2f5c09=_0x2f5c09-0x0;var _0x58e5c1=_0x2110[_0x2f5c09];return _0x58e5c1;};'use strict';var client=require('../client');exports[_0x0211('0x0')]=function(_0x324451){return client['Request'](_0x0211('0x1'),{'body':_0x324451,'log':_0x0211('0x1')});};exports[_0x0211('0x2')]=function(_0x2fd868,_0x16a4fe){return client[_0x0211('0x3')]('UpdateWhatsappQueueReport',{'body':_0x16a4fe,'options':{'where':{'uniqueid':_0x2fd868},'order':[['id',_0x0211('0x4')]],'limit':0x1},'log':_0x0211('0x5')});}; \ No newline at end of file +var _0x6c7c=['update','UpdateWhatsappQueueReport','DESC','../client','create','Request','CreateWhatsappQueueReport'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x6c7c,0xc0));var _0xc6c7=function(_0x11d91a,_0x3e0b6c){_0x11d91a=_0x11d91a-0x0;var _0x4373d5=_0x6c7c[_0x11d91a];return _0x4373d5;};'use strict';var client=require(_0xc6c7('0x0'));exports[_0xc6c7('0x1')]=function(_0x23947b){return client[_0xc6c7('0x2')](_0xc6c7('0x3'),{'body':_0x23947b,'log':_0xc6c7('0x3')});};exports[_0xc6c7('0x4')]=function(_0x3f50c8,_0x35a50c){return client[_0xc6c7('0x2')](_0xc6c7('0x5'),{'body':_0x35a50c,'options':{'where':{'uniqueid':_0x3f50c8},'order':[['id',_0xc6c7('0x6')]],'limit':0x1},'log':'UpdateWhatsappQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index 57c1c06..04d4dd7 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 _0x32c0=['START:%s','rules','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','[%s][AGENT]\x20ROUTING\x20END','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','[%s][QUEUE]\x20%s','validate','lodash','util','../../../../config/logger','routing','./strategy','string','number','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','error','map','message','stop','timeout','createQueue','atimeout'];(function(_0x3c24c3,_0x39888b){var _0x23e5e0=function(_0x3b2415){while(--_0x3b2415){_0x3c24c3['push'](_0x3c24c3['shift']());}};_0x23e5e0(++_0x39888b);}(_0x32c0,0x6d));var _0x032c=function(_0x4ba8b0,_0x453734){_0x4ba8b0=_0x4ba8b0-0x0;var _0x265f3f=_0x32c0[_0x4ba8b0];return _0x265f3f;};'use strict';var schema=require(_0x032c('0x0'));var _=require(_0x032c('0x1'));var util=require(_0x032c('0x2'));var seqqueue=require('seq-queue');var logger=require(_0x032c('0x3'))(_0x032c('0x4'));var strategy=require(_0x032c('0x5'));var queue=schema({'name':{'type':_0x032c('0x6'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x032c('0x7'),'message':_0x032c('0x8')}});function writeLog(_0xbeefab,_0x5ea7a3,_0xb2e563){return logger[_0x032c('0x9')](util[_0x032c('0xa')](_0x032c('0xb'),_0xbeefab,_0x5ea7a3[_0x032c('0xc')],_0xb2e563));}function handleFindAgent(_0x1a0ec2){return function(_0x412ec1){return _0x412ec1[_0x032c('0xc')]['toLowerCase']()===_0x1a0ec2[_0x032c('0xd')]();};}exports[_0x032c('0xe')]=function(_0x24d3e9,_0x2fbe44,_0x2867e7,_0x34f343){return function(_0x5f28f3){try{var _0x372124={'name':_0x2fbe44[0x0],'timeout':_0x2fbe44[0x1]};var _0x558e00=queue['validate'](_0x372124,{'typecast':!![]});if(_0x558e00[_0x032c('0xf')]){logger[_0x032c('0x10')]('[%s][AGENT]\x20%s',_0x24d3e9,_[_0x032c('0x11')](_0x558e00,_0x032c('0x12'))['join'](',\x20'));_0x5f28f3[_0x032c('0x13')]();}else{var _0x223dad=_['find'](_0x2867e7['agents'],handleFindAgent(_0x372124[_0x032c('0xc')]));if(_0x223dad){var _0xf0a8ee=(_0x372124[_0x032c('0x14')]||0xa)*0x3e8;var _0x18902c,_0x3732b2;var _0xdb8046=seqqueue[_0x032c('0x15')](_0xf0a8ee);_0xdb8046['id']=_0x24d3e9;_0xdb8046[_0x032c('0x16')]=_0xf0a8ee;_0xdb8046['channel']=_0x34f343['channel'];writeLog(_0x24d3e9,_0x223dad,util[_0x032c('0xa')](_0x032c('0x17'),_0xf0a8ee));_0x2867e7[_0x032c('0x18')][_0x24d3e9]['on']('end',function(){logger[_0x032c('0x9')](_0x032c('0x19'),_0x24d3e9);clearTimeout(_0x3732b2);_0x3732b2=undefined;_0xdb8046[_0x032c('0x1a')]();if(_0x2867e7[_0x032c('0x18')][_0x24d3e9]){delete _0x2867e7[_0x032c('0x18')][_0x24d3e9];}_0x5f28f3['stop']();});_0x2867e7[_0x032c('0x18')][_0x24d3e9]['on'](_0x032c('0x1b'),function(){if(_0x2867e7[_0x032c('0x18')][_0x24d3e9]){delete _0x2867e7[_0x032c('0x18')][_0x24d3e9];}});_0x3732b2=setTimeout(function(){logger[_0x032c('0x9')](_0x032c('0x1c'),_0x24d3e9);clearTimeout(_0x3732b2);_0xdb8046['close']();_0x5f28f3[_0x032c('0x1d')]();},_0xf0a8ee);strategy[_0x032c('0x1e')](_0xdb8046,_0x223dad,_0x2867e7,_0x34f343);}else{logger[_0x032c('0x10')](_0x032c('0x1f'),_0x24d3e9,_0x372124[_0x032c('0xc')]);_0x5f28f3[_0x032c('0x13')]();}}}catch(_0x34c7ba){console['log'](_0x34c7ba);logger[_0x032c('0x10')](_0x032c('0x20'),_0x24d3e9,_0x34c7ba['stack']);_0x5f28f3[_0x032c('0x13')]();}};}; \ No newline at end of file +var _0xa7df=['find','agents','createQueue','atimeout','channel','START:%s','rules','end','info','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','[%s][AGENT]\x20ROUTING\x20END','next','error','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','validate','lodash','util','seq-queue','../../../../config/logger','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','length','[%s][AGENT]\x20%s','map','message','join','stop'];(function(_0x3c7822,_0x2feaa6){var _0x42c512=function(_0x119304){while(--_0x119304){_0x3c7822['push'](_0x3c7822['shift']());}};_0x42c512(++_0x2feaa6);}(_0xa7df,0x198));var _0xfa7d=function(_0x49d07c,_0x2ef765){_0x49d07c=_0x49d07c-0x0;var _0x46217a=_0xa7df[_0x49d07c];return _0x46217a;};'use strict';var schema=require(_0xfa7d('0x0'));var _=require(_0xfa7d('0x1'));var util=require(_0xfa7d('0x2'));var seqqueue=require(_0xfa7d('0x3'));var logger=require(_0xfa7d('0x4'))(_0xfa7d('0x5'));var strategy=require(_0xfa7d('0x6'));var queue=schema({'name':{'type':_0xfa7d('0x7'),'required':!![],'message':_0xfa7d('0x8')},'timeout':{'type':_0xfa7d('0x9'),'message':_0xfa7d('0xa')}});function writeLog(_0x1374cd,_0x2c8462,_0x3cebd2){return logger['info'](util[_0xfa7d('0xb')](_0xfa7d('0xc'),_0x1374cd,_0x2c8462['name'],_0x3cebd2));}function handleFindAgent(_0x49db0c){return function(_0x43e14c){return _0x43e14c[_0xfa7d('0xd')][_0xfa7d('0xe')]()===_0x49db0c[_0xfa7d('0xe')]();};}exports['consequence']=function(_0x154998,_0x13e9ef,_0x3f65a9,_0x490452){return function(_0x4a3e2b){try{var _0x1476e2={'name':_0x13e9ef[0x0],'timeout':_0x13e9ef[0x1]};var _0x31cda2=queue[_0xfa7d('0x0')](_0x1476e2,{'typecast':!![]});if(_0x31cda2[_0xfa7d('0xf')]){logger['error'](_0xfa7d('0x10'),_0x154998,_[_0xfa7d('0x11')](_0x31cda2,_0xfa7d('0x12'))[_0xfa7d('0x13')](',\x20'));_0x4a3e2b[_0xfa7d('0x14')]();}else{var _0x279fd0=_[_0xfa7d('0x15')](_0x3f65a9[_0xfa7d('0x16')],handleFindAgent(_0x1476e2[_0xfa7d('0xd')]));if(_0x279fd0){var _0xe742c2=(_0x1476e2['timeout']||0xa)*0x3e8;var _0x1962a3,_0x40263f;var _0x523ca6=seqqueue[_0xfa7d('0x17')](_0xe742c2);_0x523ca6['id']=_0x154998;_0x523ca6[_0xfa7d('0x18')]=_0xe742c2;_0x523ca6[_0xfa7d('0x19')]=_0x490452['channel'];writeLog(_0x154998,_0x279fd0,util[_0xfa7d('0xb')](_0xfa7d('0x1a'),_0xe742c2));_0x3f65a9[_0xfa7d('0x1b')][_0x154998]['on'](_0xfa7d('0x1c'),function(){logger[_0xfa7d('0x1d')](_0xfa7d('0x1e'),_0x154998);clearTimeout(_0x40263f);_0x40263f=undefined;_0x523ca6[_0xfa7d('0x1f')]();if(_0x3f65a9[_0xfa7d('0x1b')][_0x154998]){delete _0x3f65a9[_0xfa7d('0x1b')][_0x154998];}_0x4a3e2b[_0xfa7d('0x14')]();});_0x3f65a9[_0xfa7d('0x1b')][_0x154998]['on'](_0xfa7d('0x20'),function(){if(_0x3f65a9[_0xfa7d('0x1b')][_0x154998]){delete _0x3f65a9[_0xfa7d('0x1b')][_0x154998];}});_0x40263f=setTimeout(function(){logger[_0xfa7d('0x1d')](_0xfa7d('0x21'),_0x154998);clearTimeout(_0x40263f);_0x523ca6['close']();_0x4a3e2b[_0xfa7d('0x22')]();},_0xe742c2);strategy['agent'](_0x523ca6,_0x279fd0,_0x3f65a9,_0x490452);}else{logger[_0xfa7d('0x23')](_0xfa7d('0x24'),_0x154998,_0x1476e2[_0xfa7d('0xd')]);_0x4a3e2b[_0xfa7d('0x14')]();}}}catch(_0x3233c7){console[_0xfa7d('0x25')](_0x3233c7);logger[_0xfa7d('0x23')](_0xfa7d('0x26'),_0x154998,_0x3233c7['stack']);_0x4a3e2b[_0xfa7d('0x14')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/amazonlex.js b/server/services/routing/server/applications/amazonlex.js index f6bf309..3cf065c 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 _0x4ddb=['upperFirst','created','body','then','info','catch','error','[%s][AMAZONLEX]\x20%s','stringify','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','toString','postText','providerName','amazonlex','providerResponse','create','dialogState','Failed','next','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','isNil','interaction','UserId','contact','format','out','channel','whatsapp','phone','chat','ChatWebsiteId','account','AccountId'];(function(_0x1c2be6,_0x19072d){var _0x14b8a3=function(_0x1711fc){while(--_0x1711fc){_0x1c2be6['push'](_0x1c2be6['shift']());}};_0x14b8a3(++_0x19072d);}(_0x4ddb,0x1ad));var _0xb4dd=function(_0x541a10,_0x53f603){_0x541a10=_0x541a10-0x0;var _0x45a4a6=_0x4ddb[_0x541a10];return _0x45a4a6;};'use strict';var _=require('lodash');var moment=require('moment');var AWS=require('aws-sdk');var utils=require('./utils');var logger=require(_0xb4dd('0x0'))(_0xb4dd('0x1'));var rpc={'chatMessage':require(_0xb4dd('0x2')),'openchannelMessage':require(_0xb4dd('0x3')),'mailMessage':require(_0xb4dd('0x4')),'smsMessage':require(_0xb4dd('0x5')),'faxMessage':require(_0xb4dd('0x6')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0xb4dd('0x7')]=function(_0x2dfbd5,_0x5a98f5){return function(_0x3f704d){try{if(!_[_0xb4dd('0x8')](this[_0xb4dd('0x9')][_0xb4dd('0xa')])){logger['info']('[%s][AMAZONLEX]\x20%s',_0x2dfbd5,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x3f704d['next']();}var _0x32ff6c={'ContactId':this[_0xb4dd('0xb')]['id'],'sentAt':moment()[_0xb4dd('0xc')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0xb4dd('0xd')};if(this['channel']==='sms'||this[_0xb4dd('0xe')]===_0xb4dd('0xf')){_0x32ff6c[_0xb4dd('0x10')]=this[_0xb4dd('0x9')]['phone'];}var _0xc423a5=this['channel'];if(_0xc423a5===_0xb4dd('0x11')){_0x32ff6c[_0xb4dd('0x12')]=this[_0xb4dd('0x13')]['id'];}else{_0x32ff6c[_['upperFirst'](_0xc423a5)+_0xb4dd('0x14')]=this[_0xb4dd('0x13')]['id'];}_0x32ff6c[_[_0xb4dd('0x15')](_0xc423a5)+'InteractionId']=this[_0xb4dd('0x9')]['id'];if(this[_0xb4dd('0x9')][_0xb4dd('0x16')]){var _0x596d06=_0x5a98f5[0x4];if(!_['isEmpty'](_0x596d06)){_0x32ff6c[_0xb4dd('0x17')]=utils['getMustacheRender'](_0x596d06,this);return rpc[_0xc423a5+'Message']['create'](_0x32ff6c)[_0xb4dd('0x18')](function(_0x460084){logger[_0xb4dd('0x19')]('[%s][AMAZONLEX]\x20%s',_0x2dfbd5,_0x32ff6c[_0xb4dd('0x17')]);})[_0xb4dd('0x1a')](function(_0x14ceae){logger[_0xb4dd('0x1b')](_0xb4dd('0x1c'),_0x2dfbd5,JSON[_0xb4dd('0x1d')](_0x14ceae));})['finally'](function(){logger[_0xb4dd('0x19')](_0xb4dd('0x1e'),_0x2dfbd5);_0x3f704d[_0xb4dd('0x1f')]();});}else{logger[_0xb4dd('0x19')](_0xb4dd('0x20'),_0x2dfbd5);_0x3f704d[_0xb4dd('0x1f')]();}}else{var _0x20da57=this;var _0x56044a=new AWS[(_0xb4dd('0x21'))]({'accessKeyId':_0x5a98f5[0x0],'secretAccessKey':_0x5a98f5[0x1],'region':_0x5a98f5[0x2]});var _0x2244ab={'botAlias':_0xb4dd('0x22'),'botName':_0x5a98f5[0x3],'inputText':this[_0xb4dd('0x23')]['body'],'userId':this['channel']+':'+this['interaction']['id'][_0xb4dd('0x24')]()};_0x56044a[_0xb4dd('0x25')](_0x2244ab,function(_0x3edd80,_0x17214f){if(_0x3edd80){logger[_0xb4dd('0x1b')](_0xb4dd('0x1c'),_0x2dfbd5,_0x3edd80['message']);_0x3f704d['next']();}else if(_0x17214f&&_0x17214f[_0xb4dd('0x23')]){_0x20da57[_0xb4dd('0x17')]['amazonlex']=_0x17214f;_0x32ff6c['body']=_0x17214f[_0xb4dd('0x23')];_0x32ff6c[_0xb4dd('0x26')]=_0xb4dd('0x27');_0x32ff6c[_0xb4dd('0x28')]=JSON[_0xb4dd('0x1d')](_0x17214f);return rpc[_0xc423a5+'Message'][_0xb4dd('0x29')](_0x32ff6c)[_0xb4dd('0x18')](function(_0xe07279){logger[_0xb4dd('0x19')](_0xb4dd('0x1c'),_0x2dfbd5,_0x32ff6c[_0xb4dd('0x17')]);if(_0x17214f[_0xb4dd('0x2a')]==_0xb4dd('0x2b')){_0x3f704d[_0xb4dd('0x2c')]();}else{_0x3f704d[_0xb4dd('0x1f')]();}})[_0xb4dd('0x1a')](function(_0xbcb10){logger[_0xb4dd('0x1b')](_0xb4dd('0x1c'),_0x2dfbd5,JSON[_0xb4dd('0x1d')](_0xbcb10));_0x3f704d['next']();});}else{_0x3f704d[_0xb4dd('0x2c')]();}});}}catch(_0x884499){logger['error'](_0xb4dd('0x1c'),_0x2dfbd5,JSON[_0xb4dd('0x1d')](_0x884499));_0x3f704d['stop']();}};}; \ No newline at end of file +var _0x4f85=['moment','aws-sdk','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','isNil','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','YYYY-MM-DD\x20HH:mm:ss','sms','whatsapp','phone','channel','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','body','getMustacheRender','Message','create','then','catch','error','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','$LATEST','message','postText','amazonlex','providerName','dialogState','Failed','stringify','next','lodash'];(function(_0x59daf9,_0x539360){var _0x186b62=function(_0x421499){while(--_0x421499){_0x59daf9['push'](_0x59daf9['shift']());}};_0x186b62(++_0x539360);}(_0x4f85,0x187));var _0x54f8=function(_0x3ad1ab,_0x3c8799){_0x3ad1ab=_0x3ad1ab-0x0;var _0x26d4c9=_0x4f85[_0x3ad1ab];return _0x26d4c9;};'use strict';var _=require(_0x54f8('0x0'));var moment=require(_0x54f8('0x1'));var AWS=require(_0x54f8('0x2'));var utils=require('./utils');var logger=require(_0x54f8('0x3'))(_0x54f8('0x4'));var rpc={'chatMessage':require(_0x54f8('0x5')),'openchannelMessage':require(_0x54f8('0x6')),'mailMessage':require(_0x54f8('0x7')),'smsMessage':require(_0x54f8('0x8')),'faxMessage':require(_0x54f8('0x9')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x54f8('0xa')]=function(_0x4429f4,_0x48000f){return function(_0x392723){try{if(!_[_0x54f8('0xb')](this[_0x54f8('0xc')][_0x54f8('0xd')])){logger[_0x54f8('0xe')](_0x54f8('0xf'),_0x4429f4,_0x54f8('0x10'));return _0x392723['next']();}var _0x47e6e9={'ContactId':this[_0x54f8('0x11')]['id'],'sentAt':moment()['format'](_0x54f8('0x12')),'direction':'out'};if(this['channel']===_0x54f8('0x13')||this['channel']===_0x54f8('0x14')){_0x47e6e9[_0x54f8('0x15')]=this[_0x54f8('0xc')]['phone'];}var _0x6f2b25=this[_0x54f8('0x16')];if(_0x6f2b25===_0x54f8('0x17')){_0x47e6e9[_0x54f8('0x18')]=this[_0x54f8('0x19')]['id'];}else{_0x47e6e9[_[_0x54f8('0x1a')](_0x6f2b25)+_0x54f8('0x1b')]=this[_0x54f8('0x19')]['id'];}_0x47e6e9[_[_0x54f8('0x1a')](_0x6f2b25)+_0x54f8('0x1c')]=this['interaction']['id'];if(this[_0x54f8('0xc')][_0x54f8('0x1d')]){var _0x4bd527=_0x48000f[0x4];if(!_['isEmpty'](_0x4bd527)){_0x47e6e9[_0x54f8('0x1e')]=utils[_0x54f8('0x1f')](_0x4bd527,this);return rpc[_0x6f2b25+_0x54f8('0x20')][_0x54f8('0x21')](_0x47e6e9)[_0x54f8('0x22')](function(_0x30fd43){logger[_0x54f8('0xe')](_0x54f8('0xf'),_0x4429f4,_0x47e6e9[_0x54f8('0x1e')]);})[_0x54f8('0x23')](function(_0x59abc0){logger[_0x54f8('0x24')](_0x54f8('0xf'),_0x4429f4,JSON['stringify'](_0x59abc0));})['finally'](function(){logger[_0x54f8('0xe')](_0x54f8('0x25'),_0x4429f4);_0x392723[_0x54f8('0x26')]();});}else{logger[_0x54f8('0xe')](_0x54f8('0x27'),_0x4429f4);_0x392723[_0x54f8('0x26')]();}}else{var _0xfd392f=this;var _0x199e35=new AWS['LexRuntime']({'accessKeyId':_0x48000f[0x0],'secretAccessKey':_0x48000f[0x1],'region':_0x48000f[0x2]});var _0xec5b48={'botAlias':_0x54f8('0x28'),'botName':_0x48000f[0x3],'inputText':this[_0x54f8('0x29')][_0x54f8('0x1e')],'userId':this[_0x54f8('0x16')]+':'+this[_0x54f8('0xc')]['id']['toString']()};_0x199e35[_0x54f8('0x2a')](_0xec5b48,function(_0x196d14,_0x203a93){if(_0x196d14){logger['error']('[%s][AMAZONLEX]\x20%s',_0x4429f4,_0x196d14[_0x54f8('0x29')]);_0x392723['next']();}else if(_0x203a93&&_0x203a93[_0x54f8('0x29')]){_0xfd392f['body'][_0x54f8('0x2b')]=_0x203a93;_0x47e6e9['body']=_0x203a93[_0x54f8('0x29')];_0x47e6e9[_0x54f8('0x2c')]=_0x54f8('0x2b');_0x47e6e9['providerResponse']=JSON['stringify'](_0x203a93);return rpc[_0x6f2b25+_0x54f8('0x20')][_0x54f8('0x21')](_0x47e6e9)[_0x54f8('0x22')](function(_0x5b1cc2){logger[_0x54f8('0xe')](_0x54f8('0xf'),_0x4429f4,_0x47e6e9[_0x54f8('0x1e')]);if(_0x203a93[_0x54f8('0x2d')]==_0x54f8('0x2e')){_0x392723['next']();}else{_0x392723[_0x54f8('0x26')]();}})[_0x54f8('0x23')](function(_0xfe3de0){logger[_0x54f8('0x24')]('[%s][AMAZONLEX]\x20%s',_0x4429f4,JSON[_0x54f8('0x2f')](_0xfe3de0));_0x392723[_0x54f8('0x30')]();});}else{_0x392723['next']();}});}}catch(_0x4fb56c){logger[_0x54f8('0x24')]('[%s][AMAZONLEX]\x20%s',_0x4429f4,JSON[_0x54f8('0x2f')](_0x4fb56c));_0x392723[_0x54f8('0x26')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/autoreply.js b/server/services/routing/server/applications/autoreply.js index 089e132..4b88825 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 _0xeb72=['from','phone','subject','startsWith','Re:','chat','account','upperFirst','AccountId','Message','inReplyTo','html','','replace','','headers','auto-replied','auto_reply','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','messageId','create','stringify','catch','finally','resolve','Interaction','update','error','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','lodash','moment','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','mail','body','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','interaction','created','Autoreply\x20already\x20sent','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','contact','format','out','channel','getMustacheRender','message'];(function(_0x3e510c,_0x294640){var _0x1003f4=function(_0x25aa38){while(--_0x25aa38){_0x3e510c['push'](_0x3e510c['shift']());}};_0x1003f4(++_0x294640);}(_0xeb72,0x9d));var _0x2eb7=function(_0x16e690,_0x5d4683){_0x16e690=_0x16e690-0x0;var _0x3beb56=_0xeb72[_0x16e690];return _0x3beb56;};'use strict';var _=require(_0x2eb7('0x0'));var moment=require(_0x2eb7('0x1'));var utils=require(_0x2eb7('0x2'));var logger=require(_0x2eb7('0x3'))(_0x2eb7('0x4'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x2eb7('0x5')),'mailMessage':require(_0x2eb7('0x6')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x2eb7('0x7')),'chatInteraction':require(_0x2eb7('0x8')),'openchannelInteraction':require(_0x2eb7('0x9')),'mailInteraction':require('../../rpc/mailInteraction'),'smsInteraction':require(_0x2eb7('0xa')),'faxInteraction':require(_0x2eb7('0xb')),'whatsappInteraction':require(_0x2eb7('0xc'))};var mailRpc=require(_0x2eb7('0xd'));exports['consequence']=function(_0x2f7885,_0x2cf787,_0x1ba8b7,_0x5ab56b){return function(_0x1751b3){try{var _0x45f946=this['channel'];if(_0x45f946===_0x2eb7('0xe')&&_0x5ab56b[_0x2eb7('0xf')]['isAutoreply']){logger[_0x2eb7('0x10')](_0x2eb7('0x11'),_0x2f7885,_0x2eb7('0x12'));return _0x1751b3[_0x2eb7('0x13')]();}if(_0x2cf787[0x0]==='1'&&(_['isNil'](this[_0x2eb7('0x14')][_0x2eb7('0x15')])||!this[_0x2eb7('0x14')]['created'])){logger[_0x2eb7('0x10')](_0x2eb7('0x11'),_0x2f7885,_0x2eb7('0x16'));return _0x1751b3[_0x2eb7('0x13')]();}if(_0x2cf787[0x0]==='2'&&this[_0x2eb7('0x14')][_0x2eb7('0x17')]){logger[_0x2eb7('0x10')](_0x2eb7('0x18'),_0x2f7885,_0x2eb7('0x19'));return _0x1751b3[_0x2eb7('0x13')]();}var _0x4d98a4={'ContactId':this[_0x2eb7('0x1a')]['id'],'sentAt':moment()[_0x2eb7('0x1b')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x2eb7('0x1c')};if(this[_0x2eb7('0x1d')]==='mail'){_0x4d98a4['body']=utils['getMustacheRender'](_0x2cf787[0x2],this);}else{_0x4d98a4[_0x2eb7('0xf')]=utils[_0x2eb7('0x1e')](_0x2cf787[0x1],this);}if(this[_0x2eb7('0x1f')]){_0x4d98a4['to']=this[_0x2eb7('0x1f')][_0x2eb7('0x20')]||'';if(this[_0x2eb7('0x1d')]===_0x2eb7('0xe')&&_0x2cf787[0x1]==='1'){_0x4d98a4['cc']=this['message']['cc']||'';}_0x4d98a4[_0x2eb7('0x20')]=this[_0x2eb7('0x1f')]['to']||'';_0x4d98a4[_0x2eb7('0x21')]=this[_0x2eb7('0x1f')][_0x2eb7('0x21')]||'';_0x4d98a4['read']=!![];if(this[_0x2eb7('0x1f')]['subject']){_0x4d98a4[_0x2eb7('0x22')]='';_0x4d98a4['subject']+=_[_0x2eb7('0x23')](this[_0x2eb7('0x1f')][_0x2eb7('0x22')],_0x2eb7('0x24'))?'':'Re:\x20';_0x4d98a4['subject']+=this[_0x2eb7('0x1f')]['subject'];}}if(this[_0x2eb7('0x1d')]===_0x2eb7('0x25')){_0x4d98a4['ChatWebsiteId']=this[_0x2eb7('0x26')]['id'];}else{_0x4d98a4[_[_0x2eb7('0x27')](this[_0x2eb7('0x1d')])+_0x2eb7('0x28')]=this['account']['id'];}_0x4d98a4[_[_0x2eb7('0x27')](this[_0x2eb7('0x1d')])+'InteractionId']=this[_0x2eb7('0x14')]['id'];var _0xab4304=this[_0x2eb7('0x14')];if(rpc[this[_0x2eb7('0x1d')]+_0x2eb7('0x29')]){if(this[_0x2eb7('0x1d')]==='mail'){_0x4d98a4[_0x2eb7('0x2a')]=this[_0x2eb7('0x1f')]['messageId'];_0x4d98a4[_0x2eb7('0x2b')]=_0x2eb7('0x2c')+_[_0x2eb7('0x2d')](_0x4d98a4[_0x2eb7('0xf')],'','','auto-replied','All','auto_reply','sendMailMessage','smtpOptions','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','messageId','create','stringify','catch','error','finally','autoreplyExecuted','Interaction','update','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','Message','stop','lodash','moment','./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','channel','body','isAutoreply','info'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0x8790,0x74));var _0x0879=function(_0x9bbba1,_0x226ad9){_0x9bbba1=_0x9bbba1-0x0;var _0x66fbf4=_0x8790[_0x9bbba1];return _0x66fbf4;};'use strict';var _=require(_0x0879('0x0'));var moment=require(_0x0879('0x1'));var utils=require(_0x0879('0x2'));var logger=require('../../../../config/logger')(_0x0879('0x3'));var rpc={'chatMessage':require(_0x0879('0x4')),'openchannelMessage':require(_0x0879('0x5')),'mailMessage':require(_0x0879('0x6')),'smsMessage':require(_0x0879('0x7')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x0879('0x8')),'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x0879('0x9')),'mailInteraction':require(_0x0879('0xa')),'smsInteraction':require('../../rpc/smsInteraction'),'faxInteraction':require(_0x0879('0xb')),'whatsappInteraction':require(_0x0879('0xc'))};var mailRpc=require(_0x0879('0xd'));exports['consequence']=function(_0x21a8c7,_0x4b2a17,_0x430800,_0x14188c){return function(_0x1857f6){try{var _0xb80de4=this[_0x0879('0xe')];if(_0xb80de4==='mail'&&_0x14188c[_0x0879('0xf')][_0x0879('0x10')]){logger[_0x0879('0x11')](_0x0879('0x12'),_0x21a8c7,_0x0879('0x13'));return _0x1857f6[_0x0879('0x14')]();}if(_0x4b2a17[0x0]==='1'&&(_['isNil'](this[_0x0879('0x15')][_0x0879('0x16')])||!this[_0x0879('0x15')][_0x0879('0x16')])){logger[_0x0879('0x11')](_0x0879('0x12'),_0x21a8c7,'Autoreply\x20already\x20sent');return _0x1857f6[_0x0879('0x14')]();}if(_0x4b2a17[0x0]==='2'&&this[_0x0879('0x15')]['autoreplyExecuted']){logger['info'](_0x0879('0x17'),_0x21a8c7,_0x0879('0x18'));return _0x1857f6[_0x0879('0x14')]();}var _0xcb2f67={'ContactId':this[_0x0879('0x19')]['id'],'sentAt':moment()[_0x0879('0x1a')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x0879('0x1b')};if(this[_0x0879('0xe')]===_0x0879('0x1c')){_0xcb2f67[_0x0879('0xf')]=utils[_0x0879('0x1d')](_0x4b2a17[0x2],this);}else{_0xcb2f67[_0x0879('0xf')]=utils[_0x0879('0x1d')](_0x4b2a17[0x1],this);}if(this[_0x0879('0x1e')]){_0xcb2f67['to']=this[_0x0879('0x1e')][_0x0879('0x1f')]||'';if(this[_0x0879('0xe')]===_0x0879('0x1c')&&_0x4b2a17[0x1]==='1'){_0xcb2f67['cc']=this[_0x0879('0x1e')]['cc']||'';}_0xcb2f67[_0x0879('0x1f')]=this[_0x0879('0x1e')]['to']||'';_0xcb2f67['phone']=this['message'][_0x0879('0x20')]||'';_0xcb2f67[_0x0879('0x21')]=!![];if(this[_0x0879('0x1e')]['subject']){_0xcb2f67[_0x0879('0x22')]='';_0xcb2f67[_0x0879('0x22')]+=_[_0x0879('0x23')](this[_0x0879('0x1e')][_0x0879('0x22')],'Re:')?'':_0x0879('0x24');_0xcb2f67[_0x0879('0x22')]+=this[_0x0879('0x1e')][_0x0879('0x22')];}}if(this[_0x0879('0xe')]===_0x0879('0x25')){_0xcb2f67[_0x0879('0x26')]=this['account']['id'];}else{_0xcb2f67[_[_0x0879('0x27')](this[_0x0879('0xe')])+_0x0879('0x28')]=this[_0x0879('0x29')]['id'];}_0xcb2f67[_[_0x0879('0x27')](this[_0x0879('0xe')])+_0x0879('0x2a')]=this[_0x0879('0x15')]['id'];var _0x278899=this[_0x0879('0x15')];if(rpc[this[_0x0879('0xe')]+'Message']){if(this['channel']==='mail'){_0xcb2f67[_0x0879('0x2b')]=this[_0x0879('0x1e')]['messageId'];_0xcb2f67[_0x0879('0x2c')]=_0x0879('0x2d')+_['replace'](_0xcb2f67[_0x0879('0xf')],']+(>|$)/g,''),'priorityTrue':_0x2ab047[0x1],'priorityFalse':_0x2ab047[0x2]};var _0x3c6e10=gotoif[_0x4edd('0x0')](_0x4473cb,{'typecast':!![]});if(_0x3c6e10[_0x4edd('0xc')]){logger[_0x4edd('0xd')]('[%s][GOTOIF]\x20%s',_0x243004,_['map'](_0x3c6e10,_0x4edd('0xe'))['join'](',\x20'));_0x32295b[_0x4edd('0xf')]();}else{try{var _0xe4db91=eval('('+_0x4473cb[_0x4edd('0x10')]+')');var _0x4bb9e8=_0xe4db91?_0x4473cb[_0x4edd('0x11')]:_0x4473cb[_0x4edd('0x12')];logger[_0x4edd('0x13')](_0x4edd('0x14'),_0x243004,_0x4473cb['condition'],_0xe4db91,_0x4bb9e8||_0x4edd('0x15'));if(_0x4bb9e8){var _0x196f7e=_[_0x4edd('0x16')](_0x32295b['rules'](),{'p':_0x4bb9e8});if(_0x196f7e>=0x0){logger[_0x4edd('0x13')](_0x4edd('0x17'),_0x243004,_0x4bb9e8||_0x4edd('0x15'),_0x196f7e);_0x32295b[_0x4edd('0x15')](_0x196f7e);}else{logger['info'](_0x4edd('0x18'),_0x243004,_0x4bb9e8||'next');_0x32295b['stop']();}}else{_0x32295b[_0x4edd('0x15')]();}}catch(_0xa974fd){logger['error'](_0x4edd('0x19'),_0x243004,_0xa974fd[_0x4edd('0xe')]);_0x32295b['stop']();}}}catch(_0x3583b2){logger[_0x4edd('0xd')](_0x4edd('0x1a'),_0x243004,JSON[_0x4edd('0x1b')](_0x3583b2));_0x32295b[_0x4edd('0xf')]();}};}; \ No newline at end of file +var _0x59ae=['priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','[%s][GOTOIF]\x20%s','stringify','validate','lodash','html-to-text','./utils','../../../../config/logger','routing','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','consequence','fromString','getMustacheRender','length','error','message','join','stop','condition','priorityTrue'];(function(_0x90790d,_0x18060d){var _0x582a67=function(_0x5e07ab){while(--_0x5e07ab){_0x90790d['push'](_0x90790d['shift']());}};_0x582a67(++_0x18060d);}(_0x59ae,0xce));var _0xe59a=function(_0x3d1387,_0x5606dd){_0x3d1387=_0x3d1387-0x0;var _0x5e19b7=_0x59ae[_0x3d1387];return _0x5e19b7;};'use strict';var schema=require(_0xe59a('0x0'));var _=require(_0xe59a('0x1'));var htmlToText=require(_0xe59a('0x2'));var utils=require(_0xe59a('0x3'));var logger=require(_0xe59a('0x4'))(_0xe59a('0x5'));var gotoif=schema({'condition':{'type':'string','required':!![],'message':_0xe59a('0x6')},'priorityTrue':{'type':_0xe59a('0x7'),'message':'priority\x20true\x20is\x20a\x20number'},'priorityFalse':{'type':_0xe59a('0x7'),'message':'priority\x20false\x20is\x20a\x20number'}});exports[_0xe59a('0x8')]=function(_0x42d820,_0x316d32){return function(_0x1950fd){try{var _0x42bc1d={'condition':htmlToText[_0xe59a('0x9')](utils[_0xe59a('0xa')](_0x316d32[0x0],this),{'wordwrap':![]})['replace'](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x316d32[0x1],'priorityFalse':_0x316d32[0x2]};var _0x5df3ce=gotoif[_0xe59a('0x0')](_0x42bc1d,{'typecast':!![]});if(_0x5df3ce[_0xe59a('0xb')]){logger[_0xe59a('0xc')]('[%s][GOTOIF]\x20%s',_0x42d820,_['map'](_0x5df3ce,_0xe59a('0xd'))[_0xe59a('0xe')](',\x20'));_0x1950fd[_0xe59a('0xf')]();}else{try{var _0x240c04=eval('('+_0x42bc1d[_0xe59a('0x10')]+')');var _0x38d517=_0x240c04?_0x42bc1d[_0xe59a('0x11')]:_0x42bc1d[_0xe59a('0x12')];logger[_0xe59a('0x13')](_0xe59a('0x14'),_0x42d820,_0x42bc1d[_0xe59a('0x10')],_0x240c04,_0x38d517||_0xe59a('0x15'));if(_0x38d517){var _0x57ea46=_[_0xe59a('0x16')](_0x1950fd[_0xe59a('0x17')](),{'p':_0x38d517});if(_0x57ea46>=0x0){logger['info']('[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x42d820,_0x38d517||_0xe59a('0x15'),_0x57ea46);_0x1950fd[_0xe59a('0x15')](_0x57ea46);}else{logger[_0xe59a('0x13')](_0xe59a('0x18'),_0x42d820,_0x38d517||_0xe59a('0x15'));_0x1950fd[_0xe59a('0xf')]();}}else{_0x1950fd[_0xe59a('0x15')]();}}catch(_0x39780c){logger[_0xe59a('0xc')](_0xe59a('0x19'),_0x42d820,_0x39780c['message']);_0x1950fd['stop']();}}}catch(_0x400358){logger[_0xe59a('0xc')](_0xe59a('0x1a'),_0x42d820,JSON[_0xe59a('0x1b')](_0x400358));_0x1950fd[_0xe59a('0xf')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotop.js b/server/services/routing/server/applications/gotop.js index e0ba928..18fc450 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 _0xf09b=['[%s][GOTOP]\x20priority\x20%s','priority','findIndex','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','info','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','validate','lodash','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','error','[%s][GOTOP]\x20%s','map','message','join','stop'];(function(_0x2be6e6,_0x1b63d2){var _0x276550=function(_0x530250){while(--_0x530250){_0x2be6e6['push'](_0x2be6e6['shift']());}};_0x276550(++_0x1b63d2);}(_0xf09b,0x70));var _0xbf09=function(_0x54412a,_0x4962b0){_0x54412a=_0x54412a-0x0;var _0xc409b5=_0xf09b[_0x54412a];return _0xc409b5;};'use strict';var schema=require(_0xbf09('0x0'));var _=require(_0xbf09('0x1'));var logger=require(_0xbf09('0x2'))(_0xbf09('0x3'));var gotop=schema({'priority':{'type':_0xbf09('0x4'),'required':!![],'message':_0xbf09('0x5')}});exports[_0xbf09('0x6')]=function(_0xbad568,_0x11a9cc){return function(_0x1573cb){try{var _0x8439ce={'priority':_0x11a9cc[0x0]};var _0x54969f=gotop[_0xbf09('0x0')](_0x8439ce,{'typecast':!![]});if(_0x54969f[_0xbf09('0x7')]){logger[_0xbf09('0x8')](_0xbf09('0x9'),_0xbad568,_[_0xbf09('0xa')](_0x54969f,_0xbf09('0xb'))[_0xbf09('0xc')](',\x20'));_0x1573cb[_0xbf09('0xd')]();}else{logger['info'](_0xbf09('0xe'),_0xbad568,_0x8439ce[_0xbf09('0xf')]);if(_0x8439ce['priority']){var _0x783827=_[_0xbf09('0x10')](_0x1573cb['rules'](),{'p':_0x8439ce[_0xbf09('0xf')]});if(_0x783827>=0x0){logger['info'](_0xbf09('0x11'),_0xbad568,_0x8439ce[_0xbf09('0xf')]||'next',_0x783827);_0x1573cb[_0xbf09('0x12')](_0x783827);}else{logger[_0xbf09('0x13')](_0xbf09('0x14'),_0xbad568,_0x8439ce['priority']||_0xbf09('0x12'));_0x1573cb[_0xbf09('0xd')]();}}else{_0x1573cb['next']();}}}catch(_0xe77263){logger['error']('[%s][GOTOP]\x20%s',_0xbad568,JSON['stringify'](_0xe77263));_0x1573cb[_0xbf09('0xd')]();}};}; \ No newline at end of file +var _0x843f=['number','consequence','validate','error','[%s][GOTOP]\x20%s','map','message','join','info','[%s][GOTOP]\x20priority\x20%s','priority','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x843f,0xef));var _0xf843=function(_0x53fb6,_0x86681b){_0x53fb6=_0x53fb6-0x0;var _0x2bdcf9=_0x843f[_0x53fb6];return _0x2bdcf9;};'use strict';var schema=require('validate');var _=require(_0xf843('0x0'));var logger=require('../../../../config/logger')('routing');var gotop=schema({'priority':{'type':_0xf843('0x1'),'required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports[_0xf843('0x2')]=function(_0x12cb5d,_0x2e68f1){return function(_0x1c7f59){try{var _0x383996={'priority':_0x2e68f1[0x0]};var _0x306f67=gotop[_0xf843('0x3')](_0x383996,{'typecast':!![]});if(_0x306f67['length']){logger[_0xf843('0x4')](_0xf843('0x5'),_0x12cb5d,_[_0xf843('0x6')](_0x306f67,_0xf843('0x7'))[_0xf843('0x8')](',\x20'));_0x1c7f59['stop']();}else{logger[_0xf843('0x9')](_0xf843('0xa'),_0x12cb5d,_0x383996[_0xf843('0xb')]);if(_0x383996[_0xf843('0xb')]){var _0x3b8bad=_['findIndex'](_0x1c7f59[_0xf843('0xc')](),{'p':_0x383996[_0xf843('0xb')]});if(_0x3b8bad>=0x0){logger['info'](_0xf843('0xd'),_0x12cb5d,_0x383996[_0xf843('0xb')]||_0xf843('0xe'),_0x3b8bad);_0x1c7f59[_0xf843('0xe')](_0x3b8bad);}else{logger[_0xf843('0x9')](_0xf843('0xf'),_0x12cb5d,_0x383996['priority']||_0xf843('0xe'));_0x1c7f59['stop']();}}else{_0x1c7f59['next']();}}}catch(_0x596f8e){logger[_0xf843('0x4')](_0xf843('0x5'),_0x12cb5d,JSON['stringify'](_0x596f8e));_0x1c7f59['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/message.js b/server/services/routing/server/applications/message.js index 8a7fda8..cedb210 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 _0x76ef=['create','then','info','[%s][MESSAGE]\x20%s','body','catch','stop','error','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','channel','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','Message'];(function(_0x456634,_0x436431){var _0x44a131=function(_0x48132){while(--_0x48132){_0x456634['push'](_0x456634['shift']());}};_0x44a131(++_0x436431);}(_0x76ef,0xb6));var _0xf76e=function(_0x609c9c,_0x5d5b75){_0x609c9c=_0x609c9c-0x0;var _0x41e86d=_0x76ef[_0x609c9c];return _0x41e86d;};'use strict';var _=require(_0xf76e('0x0'));var utils=require(_0xf76e('0x1'));var logger=require(_0xf76e('0x2'))(_0xf76e('0x3'));var rpc={'chatMessage':require(_0xf76e('0x4')),'openchannelMessage':require(_0xf76e('0x5')),'mailMessage':require(_0xf76e('0x6')),'smsMessage':require(_0xf76e('0x7')),'faxMessage':require(_0xf76e('0x8')),'whatsappMessage':require(_0xf76e('0x9'))};exports[_0xf76e('0xa')]=function(_0x5f170f,_0x2a8095){return function(_0x502094){try{var _0x4b0ffe={'body':utils[_0xf76e('0xb')](_0x2a8095[0x0],this),'ContactId':this[_0xf76e('0xc')]['id']};if(this[_0xf76e('0xd')]===_0xf76e('0xe')){_0x4b0ffe[_0xf76e('0xf')]=this[_0xf76e('0x10')]['id'];}else{_0x4b0ffe[_[_0xf76e('0x11')](this[_0xf76e('0xd')])+_0xf76e('0x12')]=this[_0xf76e('0x10')]['id'];}_0x4b0ffe[_['upperFirst'](this['channel'])+_0xf76e('0x13')]=this['interaction']['id'];if(rpc[this[_0xf76e('0xd')]+_0xf76e('0x14')]){return rpc[this[_0xf76e('0xd')]+'Message'][_0xf76e('0x15')](_0x4b0ffe)[_0xf76e('0x16')](function(_0x3e1999){logger[_0xf76e('0x17')](_0xf76e('0x18'),_0x5f170f,_0x4b0ffe[_0xf76e('0x19')]);_0x502094['next']();})[_0xf76e('0x1a')](function(_0xd0aea6){logger['error']('[%s][MESSAGE]\x20%s',_0x5f170f,JSON['stringify'](_0xd0aea6));_0x502094[_0xf76e('0x1b')]();});}}catch(_0x515ef9){logger[_0xf76e('0x1c')](_0xf76e('0x18'),_0x5f170f,JSON['stringify'](_0x515ef9));_0x502094[_0xf76e('0x1b')]();}};}; \ No newline at end of file +var _0xceb0=['../../rpc/faxMessage','getMustacheRender','contact','chat','account','upperFirst','channel','InteractionId','interaction','Message','create','then','info','[%s][MESSAGE]\x20%s','body','catch','stringify','stop','error','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage'];(function(_0xd8fefd,_0x2ddbe6){var _0x20b1c6=function(_0x746e55){while(--_0x746e55){_0xd8fefd['push'](_0xd8fefd['shift']());}};_0x20b1c6(++_0x2ddbe6);}(_0xceb0,0x173));var _0x0ceb=function(_0x380ed4,_0x57ed1e){_0x380ed4=_0x380ed4-0x0;var _0x25afed=_0xceb0[_0x380ed4];return _0x25afed;};'use strict';var _=require('lodash');var utils=require('./utils');var logger=require('../../../../config/logger')('routing');var rpc={'chatMessage':require(_0x0ceb('0x0')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x0ceb('0x1')),'smsMessage':require(_0x0ceb('0x2')),'faxMessage':require(_0x0ceb('0x3')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports['consequence']=function(_0x2b4f6b,_0x218237){return function(_0x3f650d){try{var _0x52e6bb={'body':utils[_0x0ceb('0x4')](_0x218237[0x0],this),'ContactId':this[_0x0ceb('0x5')]['id']};if(this['channel']===_0x0ceb('0x6')){_0x52e6bb['ChatWebsiteId']=this[_0x0ceb('0x7')]['id'];}else{_0x52e6bb[_[_0x0ceb('0x8')](this[_0x0ceb('0x9')])+'AccountId']=this['account']['id'];}_0x52e6bb[_[_0x0ceb('0x8')](this[_0x0ceb('0x9')])+_0x0ceb('0xa')]=this[_0x0ceb('0xb')]['id'];if(rpc[this[_0x0ceb('0x9')]+_0x0ceb('0xc')]){return rpc[this['channel']+_0x0ceb('0xc')][_0x0ceb('0xd')](_0x52e6bb)[_0x0ceb('0xe')](function(_0x26cb7a){logger[_0x0ceb('0xf')](_0x0ceb('0x10'),_0x2b4f6b,_0x52e6bb[_0x0ceb('0x11')]);_0x3f650d['next']();})[_0x0ceb('0x12')](function(_0x54a173){logger['error'](_0x0ceb('0x10'),_0x2b4f6b,JSON[_0x0ceb('0x13')](_0x54a173));_0x3f650d[_0x0ceb('0x14')]();});}}catch(_0x536bdd){logger[_0x0ceb('0x15')](_0x0ceb('0x10'),_0x2b4f6b,JSON['stringify'](_0x536bdd));_0x3f650d[_0x0ceb('0x14')]();}};}; \ 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 8d59403..69c9f73 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 _0x7a72=['consequence','info','[%s][NOOP]\x20%s','next','stringify','stop','../../../../config/logger','routing'];(function(_0xfac3a3,_0x51ec20){var _0x4e40e4=function(_0x51023a){while(--_0x51023a){_0xfac3a3['push'](_0xfac3a3['shift']());}};_0x4e40e4(++_0x51ec20);}(_0x7a72,0xbe));var _0x27a7=function(_0x4e61ae,_0x39bf1d){_0x4e61ae=_0x4e61ae-0x0;var _0x57e831=_0x7a72[_0x4e61ae];return _0x57e831;};'use strict';var utils=require('./utils');var logger=require(_0x27a7('0x0'))(_0x27a7('0x1'));exports[_0x27a7('0x2')]=function(_0x334853,_0x131e77){return function(_0x2d901b){try{logger[_0x27a7('0x3')](_0x27a7('0x4'),_0x334853,utils['getMustacheRender'](_0x131e77[0x0],this));_0x2d901b[_0x27a7('0x5')]();}catch(_0x1eb478){logger['error'](_0x27a7('0x4'),_0x334853,JSON[_0x27a7('0x6')](_0x1eb478));_0x2d901b[_0x27a7('0x7')]();}};}; \ No newline at end of file +var _0xbfe3=['../../../../config/logger','routing','consequence','[%s][NOOP]\x20%s','getMustacheRender','error','stringify','./utils'];(function(_0x57f2fe,_0x7f4668){var _0x2b759e=function(_0x3743e6){while(--_0x3743e6){_0x57f2fe['push'](_0x57f2fe['shift']());}};_0x2b759e(++_0x7f4668);}(_0xbfe3,0x197));var _0x3bfe=function(_0xae145e,_0x47cca9){_0xae145e=_0xae145e-0x0;var _0x4c6903=_0xbfe3[_0xae145e];return _0x4c6903;};'use strict';var utils=require(_0x3bfe('0x0'));var logger=require(_0x3bfe('0x1'))(_0x3bfe('0x2'));exports[_0x3bfe('0x3')]=function(_0x276838,_0x4385c7){return function(_0x496c55){try{logger['info'](_0x3bfe('0x4'),_0x276838,utils[_0x3bfe('0x5')](_0x4385c7[0x0],this));_0x496c55['next']();}catch(_0x2a35d8){logger[_0x3bfe('0x6')](_0x3bfe('0x4'),_0x276838,JSON[_0x3bfe('0x7')](_0x2a35d8));_0x496c55['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 9fdd702..ce8f941 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 _0x7990=['%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/chatInteraction','../../rpc/faxInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId','interaction','MessageId','message','AccountId','WebsiteId','account','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','create\x20queue\x20report','accepted','[%s][STOP:QUEUE][NAME:%s]','Interaction','update','then','update\x20queue\x20report','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','[%s][QUEUE]\x20%s','map','join','stop','find','timeout','createQueue','atimeout','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','rules','complete','[%s][QUEUE]\x20APPLICATION\x20END','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','stack','validate','lodash','util','seq-queue','moment','ioredis','../../../../config/logger','./strategy','redis','localhost','queue_id','queue','from','joinAt','emit','clone','format','pick','%s:queue:%s'];(function(_0x49a5d2,_0x3946b9){var _0x174e56=function(_0x3247d9){while(--_0x3247d9){_0x49a5d2['push'](_0x49a5d2['shift']());}};_0x174e56(++_0x3946b9);}(_0x7990,0xe3));var _0x0799=function(_0x3deef7,_0x497511){_0x3deef7=_0x3deef7-0x0;var _0x26f330=_0x7990[_0x3deef7];return _0x26f330;};'use strict';var schema=require(_0x0799('0x0'));var _=require(_0x0799('0x1'));var util=require(_0x0799('0x2'));var seqqueue=require(_0x0799('0x3'));var moment=require(_0x0799('0x4'));var Redis=require(_0x0799('0x5'));var config=require('../../../../config/environment');var logger=require(_0x0799('0x6'))('routing');var strategy=require(_0x0799('0x7'));config[_0x0799('0x8')]=_['defaults'](config[_0x0799('0x8')],{'host':_0x0799('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0799('0x8')]));var attributes=['id',_0x0799('0xa'),'account',_0x0799('0xb'),_0x0799('0xc'),_0x0799('0xd')];function emit(_0x36f15d,_0x3bd304,_0x49b45a){io['to'](_0x36f15d)[_0x0799('0xe')](_0x3bd304,_0x49b45a);}function emitChannelQueueInteraction(_0x1d98cd,_0x329685,_0x544560,_0x82cf61,_0x19e547,_0x3b394c,_0x16ed6a,_0x429c50){var _0x4a6383=_[_0x0799('0xf')](_0x544560);_0x4a6383[_0x0799('0xa')]=_0x429c50;_0x4a6383['queue']=_0x329685;_0x4a6383['account']=_0x82cf61;_0x4a6383['id']=_0x19e547;if(_0x3b394c){attributes['push'](_['capitalize'](_0x1d98cd)+'InteractionId');_0x16ed6a[util[_0x0799('0x10')]('%sQueuesWaitingInteractions',_0x1d98cd)][_0x19e547]=_[_0x0799('0x11')](_0x4a6383,attributes);}else{delete _0x16ed6a[util[_0x0799('0x10')]('%sQueuesWaitingInteractions',_0x1d98cd)][_0x19e547];}emit(util[_0x0799('0x10')](_0x0799('0x12'),_0x1d98cd,_0x329685),util[_0x0799('0x10')](_0x0799('0x13'),_0x1d98cd,_0x3b394c?_0x0799('0x14'):_0x0799('0x15')),_['pick'](_0x4a6383,attributes));}var rpc={'openchannelQueueReport':require(_0x0799('0x16')),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require(_0x0799('0x17')),'smsQueueReport':require(_0x0799('0x18')),'faxQueueReport':require(_0x0799('0x19')),'whatsappQueueReport':require('../../rpc/whatsappQueueReport'),'chatInteraction':require(_0x0799('0x1a')),'faxInteraction':require(_0x0799('0x1b')),'mailInteraction':require(_0x0799('0x1c')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x0799('0x1d')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var queue=schema({'name':{'type':_0x0799('0x1e'),'required':!![],'message':_0x0799('0x1f')},'timeout':{'type':'number','message':_0x0799('0x20')}});function startRouting(_0x42c540,_0x2920c3,_0x23287c,_0x33fbe5){if(_0x42c540&&_0x2920c3&&_0x23287c){_0x2920c3[_0x0799('0x21')]+=0x1;var _0x236b49={'uniqueid':_0x42c540,'from':_0x23287c['body']?_0x23287c[_0x0799('0x22')][_0x0799('0xc')]:'','joinAt':moment()[_0x0799('0x10')](_0x0799('0x23')),'ContactId':_0x23287c[_0x0799('0x24')]?_0x23287c[_0x0799('0x24')]['id']:null,'ListId':_0x23287c['list']?_0x23287c[_0x0799('0x25')]['id']:null};_0x236b49[_[_0x0799('0x26')](_0x23287c[_0x0799('0x27')])+_0x0799('0x28')]=_0x2920c3['id']||null;_0x236b49[_[_0x0799('0x26')](_0x23287c[_0x0799('0x27')])+'InteractionId']=_0x23287c[_0x0799('0x29')]?_0x23287c[_0x0799('0x29')]['id']:null;_0x236b49[_['upperFirst'](_0x23287c[_0x0799('0x27')])+_0x0799('0x2a')]=_0x23287c['message']?_0x23287c[_0x0799('0x2b')]['id']:null;_0x236b49[_['upperFirst'](_0x23287c['channel'])+(_0x23287c[_0x0799('0x27')]!=='chat'?_0x0799('0x2c'):_0x0799('0x2d'))]=_0x23287c['account']?_0x23287c[_0x0799('0x2e')]['id']:null;logger[_0x0799('0x2f')](util['format'](_0x0799('0x30'),_0x42c540,_0x2920c3[_0x0799('0x31')]));emitChannelQueueInteraction(_0x23287c['channel'],_0x2920c3['name'],_0x236b49,_0x23287c['account'][_0x0799('0x31')],_0x23287c[_0x0799('0x2b')]['id'],!![],_0x33fbe5,_0x2920c3['id']);if(rpc[_0x23287c['channel']+_0x0799('0x32')]){return rpc[_0x23287c[_0x0799('0x27')]+_0x0799('0x32')][_0x0799('0x33')](_0x236b49)[_0x0799('0x34')](function(_0x2ace80){logger[_0x0799('0x35')](_0x0799('0x36'),_0x2ace80);});}}}function stopRouting(_0x1d3fe0,_0x298b1,_0x4e1aed,_0x309f90){if(_0x1d3fe0&&_0x298b1){_0x298b1[_0x0799('0x21')]-=0x1;var _0x2c0461={'leaveAt':moment()['format'](_0x0799('0x23')),'acceptAt':moment()[_0x0799('0x10')](_0x0799('0x23')),'reason':_0x0799('0x37')};logger[_0x0799('0x2f')](util[_0x0799('0x10')](_0x0799('0x38'),_0x1d3fe0,_0x298b1[_0x0799('0x31')]));emitChannelQueueInteraction(_0x4e1aed[_0x0799('0x27')],_0x298b1[_0x0799('0x31')],_0x4e1aed[_0x0799('0x22')],_0x4e1aed[_0x0799('0x2e')][_0x0799('0x31')],_0x4e1aed['message']['id'],![],_0x309f90,_0x298b1['id']);return rpc[_0x4e1aed['channel']+_0x0799('0x39')][_0x0799('0x3a')](_0x4e1aed[_0x0799('0x29')]['id'],{'queueId':_0x298b1['id']})[_0x0799('0x3b')](function(){if(rpc[_0x4e1aed[_0x0799('0x27')]+_0x0799('0x32')]){return rpc[_0x4e1aed[_0x0799('0x27')]+'QueueReport']['update'](_0x1d3fe0,_0x2c0461)[_0x0799('0x34')](function(_0x4edec5){logger[_0x0799('0x35')](_0x0799('0x3c'),_0x4edec5);});}});}}function endRouting(_0x483bf9,_0x7b7438,_0x5a612a,_0x358d66){if(_0x483bf9&&_0x7b7438){_0x7b7438['waiting']-=0x1;var _0x4d1dd6={'leaveAt':moment()[_0x0799('0x10')](_0x0799('0x23')),'exitAt':moment()[_0x0799('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':'timeout'};logger[_0x0799('0x2f')](util[_0x0799('0x10')](_0x0799('0x3d'),_0x483bf9,_0x7b7438[_0x0799('0x31')]));emitChannelQueueInteraction(_0x5a612a[_0x0799('0x27')],_0x7b7438[_0x0799('0x31')],_0x5a612a[_0x0799('0x22')],_0x5a612a['account'][_0x0799('0x31')],_0x5a612a[_0x0799('0x2b')]['id'],![],_0x358d66);if(rpc[_0x5a612a[_0x0799('0x27')]+_0x0799('0x32')]){return rpc[_0x5a612a[_0x0799('0x27')]+_0x0799('0x32')][_0x0799('0x3a')](_0x483bf9,_0x4d1dd6)[_0x0799('0x34')](function(_0x17e7ab){logger[_0x0799('0x35')](_0x0799('0x3c'),_0x17e7ab);});}}}function handleFindQueue(_0x689184){return function(_0x336cee){return _0x336cee[_0x0799('0x31')][_0x0799('0x3e')]()===_0x689184[_0x0799('0x3e')]();};}exports[_0x0799('0x3f')]=function(_0x1a7b89,_0x21ca70,_0x46347f,_0x3dcc5c){return function(_0x47da02){try{var _0x40af1a={'name':_0x21ca70[0x0],'timeout':_0x21ca70[0x1]};var _0x4fc621=queue['validate'](_0x40af1a,{'typecast':!![]});if(_0x4fc621['length']){logger[_0x0799('0x35')](_0x0799('0x40'),_0x1a7b89,_[_0x0799('0x41')](_0x4fc621,_0x0799('0x2b'))[_0x0799('0x42')](',\x20'));_0x47da02[_0x0799('0x43')]();}else{var _0x2e458b=_[_0x0799('0x44')](_0x46347f[_0x3dcc5c[_0x0799('0x27')]+'Queues'],handleFindQueue(_0x40af1a['name']));if(_0x2e458b){startRouting(_0x1a7b89,_0x2e458b,_0x3dcc5c,_0x46347f);var _0x2d3346=(_0x2e458b[_0x0799('0x45')]||0xa)*0x3e8;var _0xee3449=(_0x40af1a[_0x0799('0x45')]||0x14)*0x3e8;var _0x1e4549;if(_0x2d3346>_0xee3449){_0xee3449=_0x2d3346;}var _0x3d615e=seqqueue[_0x0799('0x46')](_0x2d3346);_0x3d615e['id']=_0x1a7b89;_0x3d615e[_0x0799('0x47')]=_0x2d3346;_0x3d615e['qtimeout']=_0xee3449;_0x3d615e[_0x0799('0x27')]=_0x3dcc5c['channel'];_0x46347f['rules'][_0x1a7b89]['on'](_0x0799('0x48'),function(){logger[_0x0799('0x2f')](_0x0799('0x49'),_0x1a7b89);stopRouting(_0x1a7b89,_0x2e458b,_0x3dcc5c,_0x46347f);clearTimeout(_0x1e4549);_0x1e4549=undefined;_0x3d615e[_0x0799('0x4a')](!![]);if(_0x46347f[_0x0799('0x4b')][_0x1a7b89]){delete _0x46347f[_0x0799('0x4b')][_0x1a7b89];}_0x47da02[_0x0799('0x43')]();});_0x46347f[_0x0799('0x4b')][_0x1a7b89]['on'](_0x0799('0x4c'),function(){if(_0x46347f[_0x0799('0x4b')][_0x1a7b89]){delete _0x46347f['rules'][_0x1a7b89];}});_0x1e4549=setTimeout(function(){logger['info'](_0x0799('0x4d'),_0x1a7b89);endRouting(_0x1a7b89,_0x2e458b,_0x3dcc5c,_0x46347f);clearTimeout(_0x1e4549);_0x3d615e[_0x0799('0x4a')](!![]);_0x47da02['next']();},_0xee3449);switch(_0x2e458b['strategy']){case _0x0799('0x4e'):strategy[_0x0799('0x4e')](_0x3d615e,_0x2e458b,_0x46347f,_0x3dcc5c);break;default:strategy[_0x0799('0x4f')](_0x3d615e,_0x2e458b,_0x46347f,_0x3dcc5c);}}else{logger['error'](_0x0799('0x50'),_0x1a7b89,_0x40af1a[_0x0799('0x31')]);_0x47da02['stop']();}}}catch(_0x162d89){logger[_0x0799('0x35')](_0x0799('0x40'),_0x1a7b89,_0x162d89[_0x0799('0x51')]);_0x47da02['stop']();}};}; \ No newline at end of file +var _0x1171=['../../rpc/chatInteraction','../../rpc/faxInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','contact','list','channel','interaction','MessageId','message','upperFirst','chat','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','YYYY-MM-DD\x20HH:mm:ss','accepted','body','Interaction','then','update','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','[%s][QUEUE]\x20%s','map','join','find','atimeout','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','rules','stop','complete','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','stack','validate','lodash','util','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','defaults','localhost','queue_id','account','from','joinAt','emit','clone','queue','push','capitalize','InteractionId','%sQueuesWaitingInteractions','format','%s:queue:%s','%s_queue_waiting_interaction:%s','remove','../../rpc/openchannelQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x1171,0x129));var _0x1117=function(_0x5a2d3f,_0x27b04e){_0x5a2d3f=_0x5a2d3f-0x0;var _0x5c65d8=_0x1171[_0x5a2d3f];return _0x5c65d8;};'use strict';var schema=require(_0x1117('0x0'));var _=require(_0x1117('0x1'));var util=require(_0x1117('0x2'));var seqqueue=require('seq-queue');var moment=require('moment');var Redis=require(_0x1117('0x3'));var config=require(_0x1117('0x4'));var logger=require(_0x1117('0x5'))(_0x1117('0x6'));var strategy=require(_0x1117('0x7'));config[_0x1117('0x8')]=_[_0x1117('0x9')](config[_0x1117('0x8')],{'host':_0x1117('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var attributes=['id',_0x1117('0xb'),_0x1117('0xc'),'queue',_0x1117('0xd'),_0x1117('0xe')];function emit(_0x31df26,_0x4fdde9,_0x2aee54){io['to'](_0x31df26)[_0x1117('0xf')](_0x4fdde9,_0x2aee54);}function emitChannelQueueInteraction(_0x51619d,_0x8a2cd,_0x2b8f78,_0x15fc38,_0x367bde,_0x4d1cf3,_0x585387,_0x798b0e){var _0x45f7f5=_[_0x1117('0x10')](_0x2b8f78);_0x45f7f5['queue_id']=_0x798b0e;_0x45f7f5[_0x1117('0x11')]=_0x8a2cd;_0x45f7f5[_0x1117('0xc')]=_0x15fc38;_0x45f7f5['id']=_0x367bde;if(_0x4d1cf3){attributes[_0x1117('0x12')](_[_0x1117('0x13')](_0x51619d)+_0x1117('0x14'));_0x585387[util['format'](_0x1117('0x15'),_0x51619d)][_0x367bde]=_['pick'](_0x45f7f5,attributes);}else{delete _0x585387[util['format'](_0x1117('0x15'),_0x51619d)][_0x367bde];}emit(util[_0x1117('0x16')](_0x1117('0x17'),_0x51619d,_0x8a2cd),util['format'](_0x1117('0x18'),_0x51619d,_0x4d1cf3?'save':_0x1117('0x19')),_['pick'](_0x45f7f5,attributes));}var rpc={'openchannelQueueReport':require(_0x1117('0x1a')),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require(_0x1117('0x1b')),'smsQueueReport':require(_0x1117('0x1c')),'faxQueueReport':require(_0x1117('0x1d')),'whatsappQueueReport':require(_0x1117('0x1e')),'chatInteraction':require(_0x1117('0x1f')),'faxInteraction':require(_0x1117('0x20')),'mailInteraction':require(_0x1117('0x21')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x1117('0x22')),'whatsappInteraction':require(_0x1117('0x23'))};var queue=schema({'name':{'type':_0x1117('0x24'),'required':!![],'message':_0x1117('0x25')},'timeout':{'type':_0x1117('0x26'),'message':_0x1117('0x27')}});function startRouting(_0x4fe77b,_0xc89b1e,_0x283e53,_0x67a7b7){if(_0x4fe77b&&_0xc89b1e&&_0x283e53){_0xc89b1e['waiting']+=0x1;var _0x352d54={'uniqueid':_0x4fe77b,'from':_0x283e53['body']?_0x283e53['body'][_0x1117('0xd')]:'','joinAt':moment()[_0x1117('0x16')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x283e53['contact']?_0x283e53[_0x1117('0x28')]['id']:null,'ListId':_0x283e53[_0x1117('0x29')]?_0x283e53[_0x1117('0x29')]['id']:null};_0x352d54[_['upperFirst'](_0x283e53[_0x1117('0x2a')])+'QueueId']=_0xc89b1e['id']||null;_0x352d54[_['upperFirst'](_0x283e53[_0x1117('0x2a')])+_0x1117('0x14')]=_0x283e53[_0x1117('0x2b')]?_0x283e53[_0x1117('0x2b')]['id']:null;_0x352d54[_['upperFirst'](_0x283e53[_0x1117('0x2a')])+_0x1117('0x2c')]=_0x283e53[_0x1117('0x2d')]?_0x283e53[_0x1117('0x2d')]['id']:null;_0x352d54[_[_0x1117('0x2e')](_0x283e53[_0x1117('0x2a')])+(_0x283e53[_0x1117('0x2a')]!==_0x1117('0x2f')?_0x1117('0x30'):_0x1117('0x31'))]=_0x283e53[_0x1117('0xc')]?_0x283e53[_0x1117('0xc')]['id']:null;logger[_0x1117('0x32')](util[_0x1117('0x16')](_0x1117('0x33'),_0x4fe77b,_0xc89b1e['name']));emitChannelQueueInteraction(_0x283e53[_0x1117('0x2a')],_0xc89b1e[_0x1117('0x34')],_0x352d54,_0x283e53[_0x1117('0xc')][_0x1117('0x34')],_0x283e53[_0x1117('0x2d')]['id'],!![],_0x67a7b7,_0xc89b1e['id']);if(rpc[_0x283e53[_0x1117('0x2a')]+'QueueReport']){return rpc[_0x283e53[_0x1117('0x2a')]+_0x1117('0x35')][_0x1117('0x36')](_0x352d54)[_0x1117('0x37')](function(_0x2298f2){logger[_0x1117('0x38')]('create\x20queue\x20report',_0x2298f2);});}}}function stopRouting(_0x135957,_0x1eaf56,_0x25fd87,_0x133d8d){if(_0x135957&&_0x1eaf56){_0x1eaf56['waiting']-=0x1;var _0x5424cb={'leaveAt':moment()[_0x1117('0x16')](_0x1117('0x39')),'acceptAt':moment()[_0x1117('0x16')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x1117('0x3a')};logger[_0x1117('0x32')](util[_0x1117('0x16')]('[%s][STOP:QUEUE][NAME:%s]',_0x135957,_0x1eaf56[_0x1117('0x34')]));emitChannelQueueInteraction(_0x25fd87[_0x1117('0x2a')],_0x1eaf56[_0x1117('0x34')],_0x25fd87[_0x1117('0x3b')],_0x25fd87[_0x1117('0xc')][_0x1117('0x34')],_0x25fd87[_0x1117('0x2d')]['id'],![],_0x133d8d,_0x1eaf56['id']);return rpc[_0x25fd87['channel']+_0x1117('0x3c')]['update'](_0x25fd87[_0x1117('0x2b')]['id'],{'queueId':_0x1eaf56['id']})[_0x1117('0x3d')](function(){if(rpc[_0x25fd87[_0x1117('0x2a')]+_0x1117('0x35')]){return rpc[_0x25fd87[_0x1117('0x2a')]+_0x1117('0x35')][_0x1117('0x3e')](_0x135957,_0x5424cb)['catch'](function(_0x2a14e5){logger[_0x1117('0x38')](_0x1117('0x3f'),_0x2a14e5);});}});}}function endRouting(_0x546852,_0x41a500,_0x193588,_0x2a5293){if(_0x546852&&_0x41a500){_0x41a500['waiting']-=0x1;var _0x368e78={'leaveAt':moment()[_0x1117('0x16')](_0x1117('0x39')),'exitAt':moment()[_0x1117('0x16')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x1117('0x40')};logger[_0x1117('0x32')](util[_0x1117('0x16')](_0x1117('0x41'),_0x546852,_0x41a500['name']));emitChannelQueueInteraction(_0x193588[_0x1117('0x2a')],_0x41a500['name'],_0x193588['body'],_0x193588[_0x1117('0xc')][_0x1117('0x34')],_0x193588[_0x1117('0x2d')]['id'],![],_0x2a5293);if(rpc[_0x193588['channel']+_0x1117('0x35')]){return rpc[_0x193588[_0x1117('0x2a')]+_0x1117('0x35')][_0x1117('0x3e')](_0x546852,_0x368e78)['catch'](function(_0x54caa4){logger[_0x1117('0x38')]('update\x20queue\x20report',_0x54caa4);});}}}function handleFindQueue(_0x413406){return function(_0x571c94){return _0x571c94[_0x1117('0x34')][_0x1117('0x42')]()===_0x413406[_0x1117('0x42')]();};}exports[_0x1117('0x43')]=function(_0x28f5c6,_0x4e27d2,_0x28e4b2,_0x22543e){return function(_0x4ef0f4){try{var _0x255e6d={'name':_0x4e27d2[0x0],'timeout':_0x4e27d2[0x1]};var _0x194afd=queue[_0x1117('0x0')](_0x255e6d,{'typecast':!![]});if(_0x194afd['length']){logger['error'](_0x1117('0x44'),_0x28f5c6,_[_0x1117('0x45')](_0x194afd,'message')[_0x1117('0x46')](',\x20'));_0x4ef0f4['stop']();}else{var _0x510125=_[_0x1117('0x47')](_0x28e4b2[_0x22543e['channel']+'Queues'],handleFindQueue(_0x255e6d[_0x1117('0x34')]));if(_0x510125){startRouting(_0x28f5c6,_0x510125,_0x22543e,_0x28e4b2);var _0x367542=(_0x510125[_0x1117('0x40')]||0xa)*0x3e8;var _0x25f3a6=(_0x255e6d[_0x1117('0x40')]||0x14)*0x3e8;var _0x3c67f2;if(_0x367542>_0x25f3a6){_0x25f3a6=_0x367542;}var _0x4e8d49=seqqueue['createQueue'](_0x367542);_0x4e8d49['id']=_0x28f5c6;_0x4e8d49[_0x1117('0x48')]=_0x367542;_0x4e8d49['qtimeout']=_0x25f3a6;_0x4e8d49[_0x1117('0x2a')]=_0x22543e['channel'];_0x28e4b2['rules'][_0x28f5c6]['on'](_0x1117('0x49'),function(){logger[_0x1117('0x32')](_0x1117('0x4a'),_0x28f5c6);stopRouting(_0x28f5c6,_0x510125,_0x22543e,_0x28e4b2);clearTimeout(_0x3c67f2);_0x3c67f2=undefined;_0x4e8d49['close'](!![]);if(_0x28e4b2[_0x1117('0x4b')][_0x28f5c6]){delete _0x28e4b2[_0x1117('0x4b')][_0x28f5c6];}_0x4ef0f4[_0x1117('0x4c')]();});_0x28e4b2[_0x1117('0x4b')][_0x28f5c6]['on'](_0x1117('0x4d'),function(){if(_0x28e4b2[_0x1117('0x4b')][_0x28f5c6]){delete _0x28e4b2[_0x1117('0x4b')][_0x28f5c6];}});_0x3c67f2=setTimeout(function(){logger[_0x1117('0x32')]('[%s][QUEUE]\x20APPLICATION\x20END',_0x28f5c6);endRouting(_0x28f5c6,_0x510125,_0x22543e,_0x28e4b2);clearTimeout(_0x3c67f2);_0x4e8d49['close'](!![]);_0x4ef0f4['next']();},_0x25f3a6);switch(_0x510125['strategy']){case'rrmemory':strategy[_0x1117('0x4e')](_0x4e8d49,_0x510125,_0x28e4b2,_0x22543e);break;default:strategy[_0x1117('0x4f')](_0x4e8d49,_0x510125,_0x28e4b2,_0x22543e);}}else{logger[_0x1117('0x38')](_0x1117('0x50'),_0x28f5c6,_0x255e6d[_0x1117('0x34')]);_0x4ef0f4[_0x1117('0x4c')]();}}}catch(_0x2fbc93){logger[_0x1117('0x38')]('[%s][QUEUE]\x20%s',_0x28f5c6,_0x2fbc93[_0x1117('0x51')]);_0x4ef0f4[_0x1117('0x4c')]();}};}; \ 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 841690f..5b22092 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 _0xeec6=['timeout','handleDrained','prototype','debug','[%s][AGENT]\x20try\x20with\x20%s','agent','isNil','agents','forcedOwnership','channel','busy','saveWaitingNotification','writeLog','RINGING','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','hideNotification','busyQueue','removeWaitingNotification','STOP','exports','lodash','uuid','./util','../../../../../config/logger','notificationId','squeue','realtime','routing','push','handleRun','bind','handleTimeout'];(function(_0x564850,_0x229976){var _0x5b257a=function(_0x4de50c){while(--_0x4de50c){_0x564850['push'](_0x564850['shift']());}};_0x5b257a(++_0x229976);}(_0xeec6,0x1c2));var _0x6eec=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xeec6[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x6eec('0x0'));var uuid=require(_0x6eec('0x1'));var util=require(_0x6eec('0x2'));var logger=require(_0x6eec('0x3'))('routing');var Agent=function(_0x471d43,_0x3e4f10,_0x1699ce,_0x2d7a15){this[_0x6eec('0x4')]=uuid['v4']();this[_0x6eec('0x5')]=_0x471d43;this['agent']=_0x3e4f10;this[_0x6eec('0x6')]=_0x1699ce;this[_0x6eec('0x7')]=_0x2d7a15;this['squeue'][_0x6eec('0x8')](this[_0x6eec('0x9')][_0x6eec('0xa')](this),this[_0x6eec('0xb')]['bind'](this));this[_0x6eec('0x5')]['on'](_0x6eec('0xc'),this[_0x6eec('0xb')]['bind'](this));this['squeue']['on']('drained',this[_0x6eec('0xd')][_0x6eec('0xa')](this));};Agent['prototype']['push']=function(){this[_0x6eec('0x5')]['push'](this[_0x6eec('0x9')][_0x6eec('0xa')](this),this[_0x6eec('0xb')][_0x6eec('0xa')](this));};Agent[_0x6eec('0xe')]['handleDrained']=function(){this[_0x6eec('0xb')](!![]);};Agent[_0x6eec('0xe')][_0x6eec('0x9')]=function(){logger[_0x6eec('0xf')](_0x6eec('0x10'),this[_0x6eec('0x5')]['id'],this[_0x6eec('0x11')]['id']);if(_[_0x6eec('0x12')](this[_0x6eec('0x6')][_0x6eec('0x13')][this['agent']['id']])){logger[_0x6eec('0xf')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x6eec('0x5')]['id'],this[_0x6eec('0x11')]['id']);setTimeout(this['push'][_0x6eec('0xa')](this),0x3e8);}else{if(this[_0x6eec('0x7')][_0x6eec('0x14')]||util['isAgentAvailable'](this[_0x6eec('0x5')]['id'],this[_0x6eec('0x6')][_0x6eec('0x13')][this[_0x6eec('0x11')]['id']],this[_0x6eec('0x5')][_0x6eec('0x15')],![])){this['realtime'][_0x6eec('0x13')][this[_0x6eec('0x11')]['id']][_0x6eec('0x16')]=!![];this[_0x6eec('0x6')][_0x6eec('0x13')][this[_0x6eec('0x11')]['id']]['busyQueue']=undefined;util[_0x6eec('0x17')](this[_0x6eec('0x6')],this[_0x6eec('0x7')],this[_0x6eec('0x11')],this[_0x6eec('0x5')][_0x6eec('0x15')]);util['showNotification'](this[_0x6eec('0x4')],this[_0x6eec('0x5')]['id'],this[_0x6eec('0x6')][_0x6eec('0x13')][this[_0x6eec('0x11')]['id']],null,this[_0x6eec('0x7')]);util[_0x6eec('0x18')](this[_0x6eec('0x5')]['id'],this[_0x6eec('0x6')]['agents'][this[_0x6eec('0x11')]['id']],_0x6eec('0x19')+(this[_0x6eec('0x7')][_0x6eec('0x14')]?':FORCED':''));}else{logger[_0x6eec('0xf')](_0x6eec('0x1a'),this['squeue']['id'],this['agent']['id']);setTimeout(this[_0x6eec('0x8')]['bind'](this),0x3e8);}}};Agent[_0x6eec('0xe')][_0x6eec('0xb')]=function(_0x3bbdf8){if(_[_0x6eec('0x12')](this[_0x6eec('0x6')][_0x6eec('0x13')][this[_0x6eec('0x11')]['id']])){return logger[_0x6eec('0xf')](_0x6eec('0x1b'),this[_0x6eec('0x5')]['id'],this['agent']['id']);}else{logger[_0x6eec('0xf')]('[%s][AGENT]\x20timeout\x20with\x20%s',this[_0x6eec('0x5')]['id'],this[_0x6eec('0x11')]['id']);util[_0x6eec('0x1c')](this['notificationId'],this['squeue']['id'],this['realtime'][_0x6eec('0x13')][this[_0x6eec('0x11')]['id']],null,this[_0x6eec('0x7')]);this[_0x6eec('0x6')][_0x6eec('0x13')][this[_0x6eec('0x11')]['id']][_0x6eec('0x16')]=![];this[_0x6eec('0x6')][_0x6eec('0x13')][this[_0x6eec('0x11')]['id']][_0x6eec('0x1d')]=undefined;util[_0x6eec('0x1e')](this['realtime'],this[_0x6eec('0x7')],this[_0x6eec('0x11')],this[_0x6eec('0x5')]['channel']);util[_0x6eec('0x18')](this[_0x6eec('0x5')]['id'],this[_0x6eec('0x6')][_0x6eec('0x13')][this[_0x6eec('0x11')]['id']],_0x3bbdf8?_0x6eec('0x1f'):'TIMEOUT');}if(!_0x3bbdf8){setTimeout(this[_0x6eec('0x8')][_0x6eec('0xa')](this),0x3e8);}};function agent(_0x2f18e9,_0x5128ac,_0x53acd9,_0x28e5fa){return new Agent(_0x2f18e9,_0x5128ac,_0x53acd9,_0x28e5fa);}module[_0x6eec('0x20')]=agent; \ No newline at end of file +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(_0x46cf00,_0x457a43){var _0x3974dc=function(_0x4b5d0a){while(--_0x4b5d0a){_0x46cf00['push'](_0x46cf00['shift']());}};_0x3974dc(++_0x457a43);}(_0x34e8,0x12c));var _0x834e=function(_0x7fe28e,_0x296bb0){_0x7fe28e=_0x7fe28e-0x0;var _0xedfeec=_0x34e8[_0x7fe28e];return _0xedfeec;};'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 a6078fd..a3b7349 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 _0xf405=['Agents','length','agents','debug','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','writeLog','busy','busyQueue','name','saveWaitingNotification','showNotification','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','hideNotification','STOP','TIMEOUT','removeWaitingNotification','exports','lodash','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','realtime','push','handleRun','bind','handleTimeout','timeout','drained','prototype','handleDrained','isNil','queue'];(function(_0x4bc65f,_0x39ec43){var _0x44f85f=function(_0x175343){while(--_0x175343){_0x4bc65f['push'](_0x4bc65f['shift']());}};_0x44f85f(++_0x39ec43);}(_0xf405,0xf1));var _0x5f40=function(_0x3903fe,_0x8e2d98){_0x3903fe=_0x3903fe-0x0;var _0x509479=_0xf405[_0x3903fe];return _0x509479;};'use strict';var _=require(_0x5f40('0x0'));var uuid=require(_0x5f40('0x1'));var util=require(_0x5f40('0x2'));var logger=require(_0x5f40('0x3'))(_0x5f40('0x4'));var Beepall=function(_0x3216dd,_0x2f67b7,_0x242d7f,_0x14834a){this[_0x5f40('0x5')]=uuid['v4']();this[_0x5f40('0x6')]=_0x3216dd;this['queue']=_0x2f67b7;this[_0x5f40('0x7')]=_0x242d7f;this[_0x5f40('0x4')]=_0x14834a;this['squeue'][_0x5f40('0x8')](this[_0x5f40('0x9')][_0x5f40('0xa')](this),this[_0x5f40('0xb')][_0x5f40('0xa')](this));this[_0x5f40('0x6')]['on'](_0x5f40('0xc'),this['handleTimeout'][_0x5f40('0xa')](this));this['squeue']['on'](_0x5f40('0xd'),this['handleDrained'][_0x5f40('0xa')](this));};Beepall['prototype'][_0x5f40('0x8')]=function(){this[_0x5f40('0x6')][_0x5f40('0x8')](this['handleRun'][_0x5f40('0xa')](this),this[_0x5f40('0xb')][_0x5f40('0xa')](this));};Beepall[_0x5f40('0xe')][_0x5f40('0xf')]=function(){this[_0x5f40('0xb')](!![]);};Beepall[_0x5f40('0xe')]['handleRun']=function(){var _0x88c866=!![];if(!_[_0x5f40('0x10')](this[_0x5f40('0x11')])&&!_[_0x5f40('0x10')](this[_0x5f40('0x11')][_0x5f40('0x12')])&&this[_0x5f40('0x11')][_0x5f40('0x12')][_0x5f40('0x13')]>0x0){for(var _0x3018e7=0x0,_0x5c73a2;_0x3018e70x0){for(var _0xa23338=0x0,_0x3d4563;_0xa233380x0&&_0x3fa937[_0x1686dd+'CurrentCapacity']>=_0x3fa937[_0x1686dd+_0xa65d('0x21')]){writeLog(_0x167ed3,_0x3fa937,_0x1686dd[_0xa65d('0x23')]()+_0xa65d('0x24'));return![];}}return!![];};exports[_0xa65d('0x25')]=function(_0x28d92b,_0x563597,_0x36db19,_0x27e6a2,_0x314871){return sendNotification(!![],_0x28d92b,_0x563597,_0x36db19,_0x27e6a2,_0x314871);};exports['hideNotification']=function(_0x5874a6,_0x42dece,_0x9b1557,_0x53175f,_0x101177){return sendNotification(![],_0x5874a6,_0x42dece,_0x9b1557,_0x53175f,_0x101177);};exports[_0xa65d('0x26')]=function(_0x40c1a5,_0x579efe,_0xc48136){var _0x369239=_0x579efe['interaction'][_0xa65d('0x27')];if(!_0x369239&&_0xc48136){_0x369239=_0xc48136['id'];}var _0x32f2df=_[_0xa65d('0x28')](_0x40c1a5[_0x579efe['channel']+_0xa65d('0x29')],function(_0x380bb9){var _0x5c74e0=_['capitalize'](_0x579efe['channel'])+_0xa65d('0x2a');return _0x380bb9[_0x5c74e0]===_0x579efe[_0xa65d('0x2b')]['id'];});if(!_0x32f2df&&_0x369239&&_0x40c1a5['agents'][_0x369239]){_0x32f2df=_['some'](_0x40c1a5['agents'][_0x369239][_0x579efe[_0xa65d('0x2c')]+_0xa65d('0x2d')],function(_0x281417){return _0x281417['id']===_0x579efe[_0xa65d('0x2b')]['id'];});}return _0x32f2df;};exports[_0xa65d('0x2e')]=function(_0x4dbff5,_0x56cf67,_0x50ee17,_0x57a210){if(_0x50ee17&&_0x50ee17['id']&&_0x4dbff5[_0xa65d('0x2f')]&&_0x4dbff5[_0xa65d('0x2f')][_0x50ee17['id']]){_0x4dbff5['agents'][_0x50ee17['id']][_0x57a210+_0xa65d('0x2d')][_0x56cf67[_0xa65d('0x13')]['id']]={'id':_0x56cf67[_0xa65d('0x2b')]['id']};}};exports[_0xa65d('0x30')]=function(_0x419119,_0x2ed60e,_0x2e160e,_0x55bebc){if(_0x2e160e&&_0x2e160e['id']&&_0x419119[_0xa65d('0x2f')]&&_0x419119[_0xa65d('0x2f')][_0x2e160e['id']]){delete _0x419119['agents'][_0x2e160e['id']][_0x55bebc+_0xa65d('0x2d')][_0x2ed60e[_0xa65d('0x13')]['id']];}};exports[_0xa65d('0x31')]=writeLog; \ No newline at end of file +var _0xa770=['ioredis','../../../../../config/environment','../../../../../config/logger','routing','redis','localhost','socket.io-emitter','split','name','account','notificationSound','body','queue','msg','getMustacheRender','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','error','format','[%s][QUEUE]\x20%s','message','user:%s','notification:%s','save','remove','debug','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','busy','online','OFFLINE','Pause','PAUSE','hasOwnProperty','Capacity','CurrentCapacity','\x20MAXCAPACITY','interaction','some','channel','QueuesWaitingInteractions','capitalize','InteractionId','agents','WaitingInteractions','saveWaitingNotification','removeWaitingNotification','writeLog','lodash','../utils'];(function(_0x349367,_0x1cede2){var _0x14179b=function(_0x38a191){while(--_0x38a191){_0x349367['push'](_0x349367['shift']());}};_0x14179b(++_0x1cede2);}(_0xa770,0xc6));var _0x0a77=function(_0x3139e2,_0x416421){_0x3139e2=_0x3139e2-0x0;var _0x3aeea0=_0xa770[_0x3139e2];return _0x3aeea0;};'use strict';var _=require(_0x0a77('0x0'));var util=require('util');var utils=require(_0x0a77('0x1'));var Redis=require(_0x0a77('0x2'));var config=require(_0x0a77('0x3'));var logger=require(_0x0a77('0x4'))(_0x0a77('0x5'));config[_0x0a77('0x6')]=_['defaults'](config[_0x0a77('0x6')],{'host':_0x0a77('0x7'),'port':0x18eb});var io=require(_0x0a77('0x8'))(new Redis(config['redis']));function sendNotification(_0x43c04b,_0x308d16,_0xe08ab0,_0x13ed72,_0x2098b0,_0xc99def){var _0x5c25d3=_0xc99def||{};var _0x4f5585=_0xe08ab0[_0x0a77('0x9')]('.');var _0xb01422={'uniqueid':_0x308d16,'channel':_0x4f5585[0x0],'id':_0x4f5585[0x1],'title':_0x4f5585[0x0]+'\x20interaction','interactionId':_0x4f5585[0x2],'queue':_0x2098b0?_0x2098b0[_0x0a77('0xa')]:null,'sound':_0x5c25d3[_0x0a77('0xb')][_0x0a77('0xc')],'shake':_0x5c25d3[_0x0a77('0xb')]['notificationShake']};try{if(!_0x5c25d3[_0x0a77('0xd')]){_0x5c25d3[_0x0a77('0xd')]={};}if(_0x2098b0){_0x5c25d3[_0x0a77('0xd')][_0x0a77('0xe')]=_0x2098b0;}else if(_0x5c25d3[_0x0a77('0xd')][_0x0a77('0xe')]){delete _0x5c25d3[_0x0a77('0xd')][_0x0a77('0xe')];}_0xb01422[_0x0a77('0xf')]=utils[_0x0a77('0x10')](_0x5c25d3[_0x0a77('0xb')][_0x0a77('0x11')],_0x5c25d3);}catch(_0x37ca79){_0xb01422[_0x0a77('0xf')]=_0x0a77('0x12');logger[_0x0a77('0x13')](util[_0x0a77('0x14')](_0x0a77('0x15'),_0x308d16,_0x37ca79[_0x0a77('0x16')]));}io['to'](util[_0x0a77('0x14')](_0x0a77('0x17'),_0x13ed72[_0x0a77('0xa')]))['emit'](util[_0x0a77('0x14')](_0x0a77('0x18'),_0x43c04b?_0x0a77('0x19'):_0x0a77('0x1a')),_0xb01422);}function writeLog(_0x539921,_0x2ca990,_0x54d2c7){return logger[_0x0a77('0x1b')](util[_0x0a77('0x14')](_0x0a77('0x1c'),_0x539921,_0x2ca990[_0x0a77('0xa')],_0x54d2c7));}exports[_0x0a77('0x1d')]=function(_0x8a84ff,_0x4703e7,_0x4bc201,_0x3b9bdf){if(_0x4703e7[_0x0a77('0x1e')]){writeLog(_0x8a84ff,_0x4703e7,'BUSY');return![];}if(!_0x4703e7[_0x0a77('0x1f')]){writeLog(_0x8a84ff,_0x4703e7,_0x0a77('0x20'));return![];}if(_0x4703e7[_0x4bc201+_0x0a77('0x21')]){writeLog(_0x8a84ff,_0x4703e7,_0x0a77('0x22'));return![];}if(_0x3b9bdf&&_0x4703e7[_0x0a77('0x23')](_0x4bc201+_0x0a77('0x24'))&&_0x4703e7[_0x0a77('0x23')](_0x4bc201+'CurrentCapacity')){if(_0x4703e7[_0x4bc201+_0x0a77('0x24')]>0x0&&_0x4703e7[_0x4bc201+_0x0a77('0x25')]>=_0x4703e7[_0x4bc201+_0x0a77('0x24')]){writeLog(_0x8a84ff,_0x4703e7,_0x4bc201['toUpperCase']()+_0x0a77('0x26'));return![];}}return!![];};exports['showNotification']=function(_0x31143d,_0x21ad75,_0x2e1ee8,_0x2459dc,_0x40afc5){return sendNotification(!![],_0x31143d,_0x21ad75,_0x2e1ee8,_0x2459dc,_0x40afc5);};exports['hideNotification']=function(_0x53262a,_0x359da7,_0x2e758d,_0x2264c7,_0x12828a){return sendNotification(![],_0x53262a,_0x359da7,_0x2e758d,_0x2264c7,_0x12828a);};exports['checkWaitingNotifications']=function(_0x3278f1,_0x385d84,_0x1bfcc9){var _0x274c74=_0x385d84[_0x0a77('0x27')]['UserId'];if(!_0x274c74&&_0x1bfcc9){_0x274c74=_0x1bfcc9['id'];}var _0x111f6d=_[_0x0a77('0x28')](_0x3278f1[_0x385d84[_0x0a77('0x29')]+_0x0a77('0x2a')],function(_0x22eee9){var _0x1fcb67=_[_0x0a77('0x2b')](_0x385d84['channel'])+_0x0a77('0x2c');return _0x22eee9[_0x1fcb67]===_0x385d84[_0x0a77('0x27')]['id'];});if(!_0x111f6d&&_0x274c74&&_0x3278f1['agents'][_0x274c74]){_0x111f6d=_[_0x0a77('0x28')](_0x3278f1[_0x0a77('0x2d')][_0x274c74][_0x385d84['channel']+_0x0a77('0x2e')],function(_0x3a27e5){return _0x3a27e5['id']===_0x385d84[_0x0a77('0x27')]['id'];});}return _0x111f6d;};exports[_0x0a77('0x2f')]=function(_0x5d2cc4,_0x42b823,_0x32e404,_0x2d63ea){if(_0x32e404&&_0x32e404['id']&&_0x5d2cc4[_0x0a77('0x2d')]&&_0x5d2cc4[_0x0a77('0x2d')][_0x32e404['id']]){_0x5d2cc4['agents'][_0x32e404['id']][_0x2d63ea+'WaitingInteractions'][_0x42b823[_0x0a77('0x16')]['id']]={'id':_0x42b823['interaction']['id']};}};exports[_0x0a77('0x30')]=function(_0xc5106c,_0x51cbbc,_0x5f5c12,_0x13fb8f){if(_0x5f5c12&&_0x5f5c12['id']&&_0xc5106c[_0x0a77('0x2d')]&&_0xc5106c[_0x0a77('0x2d')][_0x5f5c12['id']]){delete _0xc5106c[_0x0a77('0x2d')][_0x5f5c12['id']][_0x13fb8f+_0x0a77('0x2e')][_0x51cbbc[_0x0a77('0x16')]['id']];}};exports[_0x0a77('0x31')]=writeLog; \ No newline at end of file diff --git a/server/services/routing/server/applications/system.js b/server/services/routing/server/applications/system.js index fbc6ec7..09c1848 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 _0x27bf=['length','error','[%s][SYSTEM]\x20%s','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','exec','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','body','isObject','validate','shelljs','lodash','./utils','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence'];(function(_0x5b70cb,_0x3ca39f){var _0x2c3412=function(_0x2c99b8){while(--_0x2c99b8){_0x5b70cb['push'](_0x5b70cb['shift']());}};_0x2c3412(++_0x3ca39f);}(_0x27bf,0x117));var _0xf27b=function(_0x25f916,_0x73fc4c){_0x25f916=_0x25f916-0x0;var _0x1a2c3b=_0x27bf[_0x25f916];return _0x1a2c3b;};'use strict';var schema=require(_0xf27b('0x0'));var sh=require(_0xf27b('0x1'));var _=require(_0xf27b('0x2'));var utils=require(_0xf27b('0x3'));var logger=require(_0xf27b('0x4'))(_0xf27b('0x5'));var system=schema({'command':{'type':_0xf27b('0x6'),'required':!![],'message':_0xf27b('0x7')}});exports[_0xf27b('0x8')]=function(_0x1542e3,_0x2e1396){return function(_0x583065){try{var _0x1a18b4={'command':_0x2e1396[0x0]};var _0x39bf1b=system[_0xf27b('0x0')](_0x1a18b4,{'typecast':!![]});if(_0x39bf1b[_0xf27b('0x9')]){logger[_0xf27b('0xa')](_0xf27b('0xb'),_0x1542e3,_['map'](_0x39bf1b,_0xf27b('0xc'))[_0xf27b('0xd')](',\x20'));logger[_0xf27b('0xe')](_0xf27b('0xf'),_0x1542e3);_0x583065[_0xf27b('0x10')]();}else{var _0x65eccf=this;var _0x28fc32=utils['getMustacheRender'](_0x2e1396[0x0],this);logger['info']('[%s][SYSTEM]\x20commnad:\x20%s',_0x1542e3,_0x28fc32);sh[_0xf27b('0x11')](_['trim'](_0x28fc32),function(_0x2cd45c,_0x3d039f){logger[_0xf27b('0xe')](_0xf27b('0x12'),_0x1542e3,_0x2cd45c);if(_0x2cd45c==0x0){var _0x568f6b=_0x3d039f[_0xf27b('0x13')](/(\r\n|\n|\r)/gm,'');if(_[_0xf27b('0x14')](_0x2e1396[0x1])||_[_0xf27b('0x15')](_0x2e1396[0x1])){logger[_0xf27b('0xe')]('[%s][SYSTEM]\x20no\x20variable',_0x1542e3);_0x65eccf[_0xf27b('0x16')][_0x2e1396[0x1]]=_0x568f6b;}else{logger[_0xf27b('0xe')]('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0x1542e3,_0x2e1396[0x1],_0x568f6b);_0x65eccf['body'][_0x2e1396[0x1]]=_0x568f6b;}}_0x583065[_0xf27b('0x10')]();});}}catch(_0x589455){logger[_0xf27b('0xa')](_0xf27b('0xb'),_0x1542e3,_[_0xf27b('0x17')](_0x589455)?JSON['stringify'](_0x589455):_0x589455);logger[_0xf27b('0xe')](_0xf27b('0xf'),_0x1542e3);_0x583065[_0xf27b('0x10')]();}};}; \ No newline at end of file +var _0xdb95=['../../../../config/logger','routing','string','consequence','validate','error','[%s][SYSTEM]\x20%s','map','message','join','info','next','getMustacheRender','exec','trim','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','stringify','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','shelljs','lodash','./utils'];(function(_0x2577c8,_0x579967){var _0x273700=function(_0x36136e){while(--_0x36136e){_0x2577c8['push'](_0x2577c8['shift']());}};_0x273700(++_0x579967);}(_0xdb95,0x1d1));var _0x5db9=function(_0x10cff8,_0x5e9134){_0x10cff8=_0x10cff8-0x0;var _0x1ee5de=_0xdb95[_0x10cff8];return _0x1ee5de;};'use strict';var schema=require('validate');var sh=require(_0x5db9('0x0'));var _=require(_0x5db9('0x1'));var utils=require(_0x5db9('0x2'));var logger=require(_0x5db9('0x3'))(_0x5db9('0x4'));var system=schema({'command':{'type':_0x5db9('0x5'),'required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0x5db9('0x6')]=function(_0x22bfd4,_0x1b821f){return function(_0x5f1902){try{var _0x9bcc70={'command':_0x1b821f[0x0]};var _0x28d12b=system[_0x5db9('0x7')](_0x9bcc70,{'typecast':!![]});if(_0x28d12b['length']){logger[_0x5db9('0x8')](_0x5db9('0x9'),_0x22bfd4,_[_0x5db9('0xa')](_0x28d12b,_0x5db9('0xb'))[_0x5db9('0xc')](',\x20'));logger[_0x5db9('0xd')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x22bfd4);_0x5f1902[_0x5db9('0xe')]();}else{var _0x43e397=this;var _0x994c59=utils[_0x5db9('0xf')](_0x1b821f[0x0],this);logger['info']('[%s][SYSTEM]\x20commnad:\x20%s',_0x22bfd4,_0x994c59);sh[_0x5db9('0x10')](_[_0x5db9('0x11')](_0x994c59),function(_0x30d55d,_0x4c4849){logger[_0x5db9('0xd')]('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x22bfd4,_0x30d55d);if(_0x30d55d==0x0){var _0x379019=_0x4c4849[_0x5db9('0x12')](/(\r\n|\n|\r)/gm,'');if(_[_0x5db9('0x13')](_0x1b821f[0x1])||_[_0x5db9('0x14')](_0x1b821f[0x1])){logger[_0x5db9('0xd')](_0x5db9('0x15'),_0x22bfd4);_0x43e397[_0x5db9('0x16')][_0x1b821f[0x1]]=_0x379019;}else{logger[_0x5db9('0xd')](_0x5db9('0x17'),_0x22bfd4,_0x1b821f[0x1],_0x379019);_0x43e397[_0x5db9('0x16')][_0x1b821f[0x1]]=_0x379019;}}_0x5f1902[_0x5db9('0xe')]();});}}catch(_0x3771e2){logger[_0x5db9('0x8')](_0x5db9('0x9'),_0x22bfd4,_['isObject'](_0x3771e2)?JSON[_0x5db9('0x18')](_0x3771e2):_0x3771e2);logger[_0x5db9('0xd')](_0x5db9('0x19'),_0x22bfd4);_0x5f1902[_0x5db9('0xe')]();}};}; \ 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 0fa543a..9890d83 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 _0x4bee=['interaction','catch','stringify','finally','next','isObject','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][TAG]\x20%s','map','message','join','Interaction','addTags','then','info','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','channel'];(function(_0x2fa850,_0x28a567){var _0x5ebc55=function(_0x4853a0){while(--_0x4853a0){_0x2fa850['push'](_0x2fa850['shift']());}};_0x5ebc55(++_0x28a567);}(_0x4bee,0x1aa));var _0xe4be=function(_0x3817a9,_0x29e215){_0x3817a9=_0x3817a9-0x0;var _0x443f30=_0x4bee[_0x3817a9];return _0x443f30;};'use strict';var schema=require(_0xe4be('0x0'));var _=require(_0xe4be('0x1'));var rpc={'chatInteraction':require(_0xe4be('0x2')),'openchannelInteraction':require(_0xe4be('0x3')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0xe4be('0x4')),'whatsappInteraction':require(_0xe4be('0x5'))};var logger=require('../../../../config/logger')(_0xe4be('0x6'));var tag=schema({'tag':{'type':_0xe4be('0x7'),'required':!![],'message':_0xe4be('0x8')}});exports[_0xe4be('0x9')]=function(_0xcc2e73,_0x4e9a49,_0x51b68a,_0x109587){return function(_0x4d3e77){try{var _0x41b9b4={'tag':_0x4e9a49[0x0]};var _0x1cabe1=tag['validate'](_0x41b9b4,{'typecast':!![]});if(_0x1cabe1[_0xe4be('0xa')]){logger[_0xe4be('0xb')](_0xe4be('0xc'),_0xcc2e73,_[_0xe4be('0xd')](_0x1cabe1,_0xe4be('0xe'))[_0xe4be('0xf')](',\x20'));logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0xcc2e73);_0x4d3e77['next']();}else{var _0x577462={'ids':[_0x4e9a49[0x0]]};if(rpc[_0x109587['channel']+'Interaction']){rpc[_0x109587['channel']+_0xe4be('0x10')][_0xe4be('0x11')](_0x109587['interaction']['id'],_0x577462)[_0xe4be('0x12')](function(_0x255dfa){logger[_0xe4be('0x13')](_0xe4be('0x14'),_0xcc2e73,_0x4e9a49[0x1],_0x109587[_0xe4be('0x15')],_0x109587[_0xe4be('0x16')]['id']);})[_0xe4be('0x17')](function(_0x2a3232){logger['error'](_0xe4be('0xc'),_0xcc2e73,JSON[_0xe4be('0x18')](_0x2a3232));logger[_0xe4be('0x13')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0xcc2e73);})[_0xe4be('0x19')](function(){_0x4d3e77[_0xe4be('0x1a')]();});}}}catch(_0x515b18){logger[_0xe4be('0xb')]('[%s][TAG]\x20%s',_0xcc2e73,_[_0xe4be('0x1b')](_0x515b18)?JSON[_0xe4be('0x18')](_0x515b18):_0x515b18);logger[_0xe4be('0x13')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0xcc2e73);_0x4d3e77['next']();}};}; \ No newline at end of file +var _0x53c9=['../../rpc/mailInteraction','../../rpc/faxInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','validate','length','error','map','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','addTags','interaction','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','[%s][TAG]\x20%s','finally','stringify','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction'];(function(_0x132d9e,_0x4a0839){var _0x40b733=function(_0x30c113){while(--_0x30c113){_0x132d9e['push'](_0x132d9e['shift']());}};_0x40b733(++_0x4a0839);}(_0x53c9,0x1f4));var _0x953c=function(_0x32083e,_0x130a41){_0x32083e=_0x32083e-0x0;var _0x1efcc7=_0x53c9[_0x32083e];return _0x1efcc7;};'use strict';var schema=require('validate');var _=require(_0x953c('0x0'));var rpc={'chatInteraction':require(_0x953c('0x1')),'openchannelInteraction':require(_0x953c('0x2')),'smsInteraction':require(_0x953c('0x3')),'mailInteraction':require(_0x953c('0x4')),'faxInteraction':require(_0x953c('0x5')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require(_0x953c('0x6'))(_0x953c('0x7'));var tag=schema({'tag':{'type':_0x953c('0x8'),'required':!![],'message':_0x953c('0x9')}});exports[_0x953c('0xa')]=function(_0x1a72e8,_0x1a78a1,_0x395fd7,_0x4f3cb6){return function(_0x3f23ac){try{var _0x111f8d={'tag':_0x1a78a1[0x0]};var _0x555bb6=tag[_0x953c('0xb')](_0x111f8d,{'typecast':!![]});if(_0x555bb6[_0x953c('0xc')]){logger[_0x953c('0xd')]('[%s][TAG]\x20%s',_0x1a72e8,_[_0x953c('0xe')](_0x555bb6,_0x953c('0xf'))[_0x953c('0x10')](',\x20'));logger[_0x953c('0x11')](_0x953c('0x12'),_0x1a72e8);_0x3f23ac[_0x953c('0x13')]();}else{var _0x24cb02={'ids':[_0x1a78a1[0x0]]};if(rpc[_0x4f3cb6[_0x953c('0x14')]+'Interaction']){rpc[_0x4f3cb6[_0x953c('0x14')]+'Interaction'][_0x953c('0x15')](_0x4f3cb6[_0x953c('0x16')]['id'],_0x24cb02)['then'](function(_0x3a8c87){logger[_0x953c('0x11')](_0x953c('0x17'),_0x1a72e8,_0x1a78a1[0x1],_0x4f3cb6[_0x953c('0x14')],_0x4f3cb6[_0x953c('0x16')]['id']);})[_0x953c('0x18')](function(_0x5b1518){logger[_0x953c('0xd')](_0x953c('0x19'),_0x1a72e8,JSON['stringify'](_0x5b1518));logger[_0x953c('0x11')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x1a72e8);})[_0x953c('0x1a')](function(){_0x3f23ac[_0x953c('0x13')]();});}}}catch(_0x4cd691){logger[_0x953c('0xd')](_0x953c('0x19'),_0x1a72e8,_['isObject'](_0x4cd691)?JSON[_0x953c('0x1b')](_0x4cd691):_0x4cd691);logger[_0x953c('0x11')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x1a72e8);_0x3f23ac[_0x953c('0x13')]();}};}; \ 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 dff0519..541bc13 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 _0x94ed=['push','stringify','utf8','POST','then','parse','&serviceId=','&sessionId=','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','catch','error','isObject','next','request-promise','../../../../config/logger','lodash','consequence','\x20-\x20','includes','urlOnAnswer','?params=','urlOnRing','title','jsonrpc','2.0','login'];(function(_0x499754,_0x45a36f){var _0x5f11d=function(_0x52792a){while(--_0x52792a){_0x499754['push'](_0x499754['shift']());}};_0x5f11d(++_0x45a36f);}(_0x94ed,0x143));var _0xd94e=function(_0xb0acd8,_0x4cac86){_0xb0acd8=_0xb0acd8-0x0;var _0x491d41=_0x94ed[_0xb0acd8];return _0x491d41;};'use strict';var rp=require(_0xd94e('0x0'));var logger=require(_0xd94e('0x1'))('routing');var _=require(_0xd94e('0x2'));var arr=[];exports[_0xd94e('0x3')]=function(_0x2fc4a0,_0x4e4bf7){return function(_0x48049b){var _0x16ee73=_0x4e4bf7[0xa];var _0x35de94=_0x4e4bf7[0xb];var _0x4a9776=_0x4e4bf7[0xc];var _0x50ed7f=_0x4e4bf7[0xd];var _0x554b2e=_0x4e4bf7[0xe];var _0x5886d1=_0x4e4bf7[0xf]['replace'](/\n/g,_0xd94e('0x4'));var _0x112083=_0x4e4bf7[0x10]['replace'](/\n/g,'\x20');if(!arr[_0xd94e('0x5')](_0x35de94)){arr['push'](_0x35de94);var _0x34299c=_0x4e4bf7[0x3];var _0x2445d5=_0x4e4bf7[0x4];var _0x45f356=_0x4e4bf7[0x1];var _0x5405=_0x4e4bf7[0x0];var _0x31b873={};_0x31b873[_0xd94e('0x6')]=_0x4e4bf7[0x8]+_0xd94e('0x7')+_0x4a9776+'|'+_0x16ee73+'|'+_0x50ed7f+'|'+_0x35de94+'|'+_0x554b2e;_0x31b873[_0xd94e('0x8')]=_0x4e4bf7[0x7]+_0xd94e('0x7')+_0x4a9776+'|'+_0x16ee73+'|'+_0x50ed7f+'|'+_0x35de94+'|'+_0x554b2e+'|'+_0x5886d1+'|'+_0x112083;_0x31b873[_0xd94e('0x9')]=_0x4e4bf7[0x9];var _0x513c7d={};_0x513c7d[_0xd94e('0xa')]=_0xd94e('0xb');_0x513c7d['method']=_0xd94e('0xc');var _0x499d0e=[];_0x499d0e[_0xd94e('0xd')](_0x4e4bf7[0x2]);_0x499d0e[_0xd94e('0xd')](_0x4e4bf7[0x5]);_0x499d0e['push'](_0x4e4bf7[0x6]);_0x513c7d['params']=_0x499d0e;_0x513c7d['id']=0x1;var _0x25ad5b=JSON[_0xd94e('0xe')](_0x513c7d);var _0x4db62e={'encoding':_0xd94e('0xf'),'method':_0xd94e('0x10'),'timeout':0x2710,'url':_0x34299c,'headers':{'Content-Type':'application/json-rpc'},'body':_0x25ad5b};return rp(_0x4db62e)[_0xd94e('0x11')](function(_0x571894){const _0x5978ad=JSON[_0xd94e('0x12')](_0x571894);if(!_0x5978ad['result']['logged']){throw new Error('Unable\x20to\x20login\x20with\x20TVox\x20application');}var _0x1a0db1=_0x35de94;var _0x27a5c9='channelId='+_0x45f356+_0xd94e('0x13')+_0x5405+_0xd94e('0x14')+_0x1a0db1+'&data='+JSON[_0xd94e('0xe')](_0x31b873);var _0xc6455d=_0x2445d5+'?'+_0x27a5c9;return rp(_0xc6455d);})['then'](function(_0x3ae553){logger[_0xd94e('0x15')](_0xd94e('0x16'),_0x2fc4a0,_0x3ae553);_0x48049b[_0xd94e('0x17')]();})[_0xd94e('0x18')](function(_0xf9c256){logger[_0xd94e('0x19')]('[%s][TVOX]\x20%s',_0x2fc4a0,_[_0xd94e('0x1a')](_0xf9c256)?JSON['stringify'](_0xf9c256):_0xf9c256);_0x48049b[_0xd94e('0x17')]();});}else{logger[_0xd94e('0x15')]('[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next',_0x2fc4a0);_0x48049b[_0xd94e('0x1b')]();}};}; \ No newline at end of file +var _0x68f6=['?params=','title','jsonrpc','method','login','params','then','parse','result','channelId=','&serviceId=','&data=','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','isObject','stringify','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','../../../../config/logger','routing','lodash','replace','\x20-\x20','push','urlOnAnswer'];(function(_0x2aad02,_0x556ae7){var _0x546e5b=function(_0x129356){while(--_0x129356){_0x2aad02['push'](_0x2aad02['shift']());}};_0x546e5b(++_0x556ae7);}(_0x68f6,0x7f));var _0x668f=function(_0x28392e,_0x4ddc7f){_0x28392e=_0x28392e-0x0;var _0x381c3a=_0x68f6[_0x28392e];return _0x381c3a;};'use strict';var rp=require(_0x668f('0x0'));var logger=require(_0x668f('0x1'))(_0x668f('0x2'));var _=require(_0x668f('0x3'));var arr=[];exports['consequence']=function(_0x12e42f,_0x513a32){return function(_0x2e960e){var _0x1131fa=_0x513a32[0xa];var _0x54638d=_0x513a32[0xb];var _0x68ca1=_0x513a32[0xc];var _0x131adf=_0x513a32[0xd];var _0x2385f8=_0x513a32[0xe];var _0x32a8f4=_0x513a32[0xf][_0x668f('0x4')](/\n/g,_0x668f('0x5'));var _0xfcd51d=_0x513a32[0x10]['replace'](/\n/g,'\x20');if(!arr['includes'](_0x54638d)){arr[_0x668f('0x6')](_0x54638d);var _0x2b4e78=_0x513a32[0x3];var _0x1f0ce0=_0x513a32[0x4];var _0x2673d3=_0x513a32[0x1];var _0x14f0c4=_0x513a32[0x0];var _0x41bbf2={};_0x41bbf2[_0x668f('0x7')]=_0x513a32[0x8]+_0x668f('0x8')+_0x68ca1+'|'+_0x1131fa+'|'+_0x131adf+'|'+_0x54638d+'|'+_0x2385f8;_0x41bbf2['urlOnRing']=_0x513a32[0x7]+_0x668f('0x8')+_0x68ca1+'|'+_0x1131fa+'|'+_0x131adf+'|'+_0x54638d+'|'+_0x2385f8+'|'+_0x32a8f4+'|'+_0xfcd51d;_0x41bbf2[_0x668f('0x9')]=_0x513a32[0x9];var _0x4b11da={};_0x4b11da[_0x668f('0xa')]='2.0';_0x4b11da[_0x668f('0xb')]=_0x668f('0xc');var _0x3a28c3=[];_0x3a28c3[_0x668f('0x6')](_0x513a32[0x2]);_0x3a28c3['push'](_0x513a32[0x5]);_0x3a28c3[_0x668f('0x6')](_0x513a32[0x6]);_0x4b11da[_0x668f('0xd')]=_0x3a28c3;_0x4b11da['id']=0x1;var _0x22cccf=JSON['stringify'](_0x4b11da);var _0x343330={'encoding':'utf8','method':'POST','timeout':0x2710,'url':_0x2b4e78,'headers':{'Content-Type':'application/json-rpc'},'body':_0x22cccf};return rp(_0x343330)[_0x668f('0xe')](function(_0x529ac9){const _0x2c11ea=JSON[_0x668f('0xf')](_0x529ac9);if(!_0x2c11ea[_0x668f('0x10')]['logged']){throw new Error('Unable\x20to\x20login\x20with\x20TVox\x20application');}var _0x4590d4=_0x54638d;var _0x5f05eb=_0x668f('0x11')+_0x2673d3+_0x668f('0x12')+_0x14f0c4+'&sessionId='+_0x4590d4+_0x668f('0x13')+JSON['stringify'](_0x41bbf2);var _0x34f9ad=_0x1f0ce0+'?'+_0x5f05eb;return rp(_0x34f9ad);})[_0x668f('0xe')](function(_0x5556a7){logger[_0x668f('0x14')](_0x668f('0x15'),_0x12e42f,_0x5556a7);_0x2e960e[_0x668f('0x16')]();})['catch'](function(_0x15fdb0){logger['error']('[%s][TVOX]\x20%s',_0x12e42f,_[_0x668f('0x17')](_0x15fdb0)?JSON[_0x668f('0x18')](_0x15fdb0):_0x15fdb0);_0x2e960e[_0x668f('0x16')]();});}else{logger[_0x668f('0x14')](_0x668f('0x19'),_0x12e42f);_0x2e960e[_0x668f('0x1a')]();}};}; \ 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 47e3442..246e2eb 100644 --- a/server/services/routing/server/applications/utils.js +++ b/server/services/routing/server/applications/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['merge','body','account','list','exports','render'];(function(_0xc85c78,_0x197a50){var _0x25178d=function(_0x2d3185){while(--_0x2d3185){_0xc85c78['push'](_0xc85c78['shift']());}};_0x25178d(++_0x197a50);}(_0x9c44,0x178));var _0x49c4=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0x9c44[_0x15bc81];return _0x59440e;};'use strict';var Mustache=require('mustache');var _=require('lodash');module[_0x49c4('0x0')]={'getMustacheRender':function(_0x18bf2d,_0x26844b){return Mustache[_0x49c4('0x1')](_0x18bf2d,_[_0x49c4('0x2')](_0x26844b[_0x49c4('0x3')],{'contact':_0x26844b['contact'],'message':_0x26844b['message'],'account':_0x26844b[_0x49c4('0x4')],'interaction':_0x26844b['interaction'],'list':_0x26844b[_0x49c4('0x5')]}))||'';}}; \ No newline at end of file +var _0xd8b0=['merge','body','contact','message','list','mustache','lodash','render'];(function(_0x240386,_0x303d98){var _0x1b1f21=function(_0x837d2f){while(--_0x837d2f){_0x240386['push'](_0x240386['shift']());}};_0x1b1f21(++_0x303d98);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Mustache=require(_0x0d8b('0x0'));var _=require(_0x0d8b('0x1'));module['exports']={'getMustacheRender':function(_0x585166,_0x4b72b0){return Mustache[_0x0d8b('0x2')](_0x585166,_[_0x0d8b('0x3')](_0x4b72b0[_0x0d8b('0x4')],{'contact':_0x4b72b0[_0x0d8b('0x5')],'message':_0x4b72b0[_0x0d8b('0x6')],'account':_0x4b72b0['account'],'interaction':_0x4b72b0['interaction'],'list':_0x4b72b0[_0x0d8b('0x7')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 86e1d76..63386ba 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 _0x1c52=['agent\x20not\x20found','values','find','chatQueues','available','name','waiting','mailQueues','loggedIn','paused','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','listen','127.0.0.1','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','../../../config/logger','routing','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','channel','interaction','checkWaitingNotifications','applications','length','existsSync','join','app','toLowerCase','autoreply','split','mail','push','slice','appdata','dialogflowv2','amazonlex','tag','TagId','getMustacheRender','account','message','ChatWebsiteId','ContactId','body','%s:%s:%s','./interval','condition','./applications/','priority','info','Push\x20new\x20rule','intervals','\x20|\x20','error','.js','rules','stringify','matchPath','complete','Skipped\x20routing\x20for\x20%s','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','agents','busy','end','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','emit','hasOwnProperty','capacity','CurrentCapacity'];(function(_0xccf869,_0x2556a5){var _0x21a9db=function(_0xcc4835){while(--_0xcc4835){_0xccf869['push'](_0xccf869['shift']());}};_0x21a9db(++_0x2556a5);}(_0x1c52,0x7c));var _0x21c5=function(_0x46afe1,_0x3ded94){_0x46afe1=_0x46afe1-0x0;var _0x2ff9ef=_0x1c52[_0x46afe1];return _0x2ff9ef;};'use strict';var _=require(_0x21c5('0x0'));var util=require(_0x21c5('0x1'));var path=require(_0x21c5('0x2'));var fs=require('fs');var jayson=require(_0x21c5('0x3'));var BPromise=require('bluebird');var utils=require('./applications/utils');var sUtils=require('./applications/strategy/util');var logger=require(_0x21c5('0x4'))(_0x21c5('0x5'));var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x21c5('0x6')),'chatQueueReport':require(_0x21c5('0x7')),'smsQueueReport':require(_0x21c5('0x8')),'faxQueueReport':require(_0x21c5('0x9')),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require(_0x21c5('0xa'));function getId(_0xb4b1e4,_0x4c5a4f,_0xd34da2){return util[_0x21c5('0xb')](_0x21c5('0xc'),_0xb4b1e4,_0x4c5a4f||0x0,_0xd34da2||0x0);}function getIntervals(_0x27389f,_0x54a640){var _0x38a038=[];if(!_[_0x21c5('0xd')](_0x54a640[_0x21c5('0xe')])&&!_['isNil'](_0x27389f[_0x54a640[_0x21c5('0xe')]])&&!_['isNil'](_0x27389f[_0x54a640[_0x21c5('0xe')]][_0x21c5('0xf')])){_0x38a038=_[_0x21c5('0x10')](_0x27389f[_0x54a640[_0x21c5('0xe')]]['Intervals'],_0x21c5('0x11'));}else if(!_['isNil'](_0x54a640[_0x21c5('0x11')])){_0x38a038=[_0x54a640[_0x21c5('0x11')]];}return _0x38a038;}exports['listen']=function(_0x17be3d){_0x17be3d['rules']={};return new BPromise(function(_0x4791f7,_0x3ba28b){var _0x35d2fe={'Start':function(_0x47030b){var _0x20902a=this;return new Promise(function(_0x15de0c,_0x102433){if(_0x47030b){try{var _0x41b810=[];var _0x4bdf72=getId(_0x47030b[_0x21c5('0x12')],_0x47030b['message']?_0x47030b['message']['id']:0x0,_0x47030b[_0x21c5('0x13')]?_0x47030b['interaction']['id']:0x0);var _0x4daf4d=sUtils[_0x21c5('0x14')](_0x17be3d,_0x47030b);if(_0x47030b['transfer']||!_0x4daf4d&&_0x47030b[_0x21c5('0x15')]&&_['isArray'](_0x47030b[_0x21c5('0x15')])&&_0x47030b['applications']['length']){for(var _0x2d57fc=0x0;_0x2d57fc<_0x47030b[_0x21c5('0x15')][_0x21c5('0x16')];_0x2d57fc+=0x1){var _0x300178=_0x47030b[_0x21c5('0x15')][_0x2d57fc];if(fs[_0x21c5('0x17')](path[_0x21c5('0x18')](__dirname,_0x21c5('0x15'),_0x300178[_0x21c5('0x19')]+'.js'))){var _0x8021db=[];switch(_0x300178[_0x21c5('0x19')][_0x21c5('0x1a')]()){case _0x21c5('0x1b'):var _0x123a7a=_0x300178['appdata'][_0x21c5('0x1c')](',');if(_0x47030b[_0x21c5('0x12')]===_0x21c5('0x1d')){_0x8021db[_0x21c5('0x1e')](_0x123a7a[0x0]);_0x8021db[_0x21c5('0x1e')](_0x123a7a[0x1]);_0x8021db['push'](_0x123a7a['slice'](0x2,_0x123a7a[_0x21c5('0x16')])[_0x21c5('0x18')](','));}else{_0x8021db[_0x21c5('0x1e')](_0x123a7a[0x0]);_0x8021db[_0x21c5('0x1e')](_0x123a7a[_0x21c5('0x1f')](0x1,_0x123a7a[_0x21c5('0x16')])['join'](','));}break;case'dialogflow':var _0x5918df=_0x300178[_0x21c5('0x20')][_0x21c5('0x1c')](',');_0x8021db[_0x21c5('0x1e')](_0x5918df[0x0]);_0x8021db[_0x21c5('0x1e')](_0x5918df[0x1]);_0x8021db['push'](_0x5918df[_0x21c5('0x1f')](0x2,_0x5918df[_0x21c5('0x16')])[_0x21c5('0x18')](','));break;case _0x21c5('0x21'):var _0x3b66f9=_0x300178['appdata']['split'](',');_0x8021db[_0x21c5('0x1e')](_0x3b66f9[0x0]);_0x8021db[_0x21c5('0x1e')](_0x3b66f9[0x1]);_0x8021db[_0x21c5('0x1e')](_0x3b66f9[0x2]);_0x8021db[_0x21c5('0x1e')](_0x3b66f9[0x3]);_0x8021db[_0x21c5('0x1e')](_0x3b66f9[_0x21c5('0x1f')](0x4,_0x3b66f9[_0x21c5('0x16')])[_0x21c5('0x18')](','));break;case _0x21c5('0x22'):var _0x2b075a=_0x300178['appdata']['split'](',');_0x8021db[_0x21c5('0x1e')](_0x2b075a[0x0]);_0x8021db['push'](_0x2b075a[0x1]);_0x8021db[_0x21c5('0x1e')](_0x2b075a[0x2]);_0x8021db[_0x21c5('0x1e')](_0x2b075a[0x3]);_0x8021db[_0x21c5('0x1e')](_0x2b075a[_0x21c5('0x1f')](0x4,_0x2b075a['length'])[_0x21c5('0x18')](','));break;case'message':_0x8021db[_0x21c5('0x1e')](_0x300178['appdata']);break;case _0x21c5('0x23'):_0x8021db[_0x21c5('0x1e')](_0x300178[_0x21c5('0x24')]);_0x8021db['push'](_0x300178[_0x21c5('0x20')]);break;case'tvox':var _0x3540c0=utils[_0x21c5('0x25')](_0x47030b[_0x21c5('0x26')]['notificationTemplate'],_0x47030b);var _0x1a82bb=_0x300178['appdata']['split'](',');_0x8021db[_0x21c5('0x1e')](_0x1a82bb[0x0]);_0x8021db[_0x21c5('0x1e')](_0x1a82bb[0x1]);_0x8021db[_0x21c5('0x1e')](_0x1a82bb[0x2]);_0x8021db[_0x21c5('0x1e')](_0x1a82bb[0x3]);_0x8021db['push'](_0x1a82bb[0x4]);_0x8021db[_0x21c5('0x1e')](_0x1a82bb[0x5]);_0x8021db[_0x21c5('0x1e')](_0x1a82bb[0x6]);_0x8021db[_0x21c5('0x1e')](_0x1a82bb[0x7]);_0x8021db[_0x21c5('0x1e')](_0x1a82bb[0x8]);_0x8021db[_0x21c5('0x1e')](_0x1a82bb[0x9]);_0x8021db[_0x21c5('0x1e')](_0x1a82bb[0xa]);_0x8021db[_0x21c5('0x1e')](_0x47030b[_0x21c5('0x13')]['id']);_0x8021db['push'](_0x47030b[_0x21c5('0x27')]['id']);_0x8021db[_0x21c5('0x1e')](_0x300178[_0x21c5('0x28')]);_0x8021db['push'](_0x47030b[_0x21c5('0x13')][_0x21c5('0x29')]);_0x8021db[_0x21c5('0x1e')](_0x47030b[_0x21c5('0x2a')][_0x21c5('0x2a')]);_0x8021db['push'](_0x3540c0);break;default:_0x8021db=_[_0x21c5('0xd')](_0x300178[_0x21c5('0x20')])?[]:_0x300178[_0x21c5('0x20')][_0x21c5('0x1c')](',');}var _0x31fd72={'id':util['format'](_0x21c5('0x2b'),_0x4bdf72,_0x300178['id'],_0x300178[_0x21c5('0x19')]),'condition':require(_0x21c5('0x2c'))[_0x21c5('0x2d')](_0x4bdf72,getIntervals(_0x17be3d['intervals'],_0x300178),_0x17be3d),'consequence':require(_0x21c5('0x2e')+_0x300178[_0x21c5('0x19')])['consequence'](_0x4bdf72,_0x8021db,_0x17be3d,_0x47030b),'p':_0x300178[_0x21c5('0x2f')]||0x0};logger[_0x21c5('0x30')](_0x21c5('0x31'),_0x31fd72['id'],'on\x20interval',getIntervals(_0x17be3d[_0x21c5('0x32')],_0x300178)[_0x21c5('0x18')](_0x21c5('0x33')));_0x41b810['push'](_0x31fd72);}else{logger[_0x21c5('0x34')]('Please\x20create\x20a\x20new\x20file\x20under',path[_0x21c5('0x18')](__dirname,_0x21c5('0x15'),_0x300178[_0x21c5('0x19')]+_0x21c5('0x35')));}}_0x17be3d[_0x21c5('0x36')][_0x4bdf72]=new RuleEngine(_0x41b810);_0x17be3d['rules'][_0x4bdf72]['execute'](_0x47030b,function(_0x503ffa){logger[_0x21c5('0x30')]('Applications\x20executed',JSON[_0x21c5('0x37')](_0x503ffa[_0x21c5('0x38')]));if(_0x17be3d[_0x21c5('0x36')][_0x4bdf72]){_0x17be3d[_0x21c5('0x36')][_0x4bdf72]['emit'](_0x21c5('0x39'));}});return _0x15de0c({'code':0xc8,'message':_0x47030b});}else{if(_0x4daf4d){logger[_0x21c5('0x30')](util[_0x21c5('0xb')](_0x21c5('0x3a'),_0x4bdf72));}else{logger[_0x21c5('0x30')](_0x21c5('0x3b'));}return _0x15de0c({'code':0xc8,'message':_0x47030b});}}catch(_0x17876f){logger[_0x21c5('0x34')](_0x17876f[_0x21c5('0x3c')]);return _0x102433(_0x20902a['error'](0x1f4,_0x17876f));}}return _0x102433(_0x21c5('0x3d'));});},'AcceptMessage':function(_0x5f3d15){var _0x462537=this;return new Promise(function(_0x3393a6,_0x2cb9f9){if(_0x5f3d15[_0x21c5('0x3e')]&&_0x5f3d15[_0x21c5('0x3e')]['id']){if(_0x17be3d[_0x21c5('0x3f')][_0x5f3d15[_0x21c5('0x3e')]['id']]){_0x17be3d[_0x21c5('0x3f')][_0x5f3d15[_0x21c5('0x3e')]['id']][_0x21c5('0x40')]=![];_0x17be3d[_0x21c5('0x3f')][_0x5f3d15[_0x21c5('0x3e')]['id']]['busyQueue']=undefined;}}if(_0x5f3d15['message']&&_0x5f3d15['message']['id']){try{var _0xe237a5=getId(_0x5f3d15[_0x21c5('0x12')],_0x5f3d15[_0x21c5('0x27')]?_0x5f3d15['message']['id']:0x0,_0x5f3d15[_0x21c5('0x13')]?_0x5f3d15[_0x21c5('0x13')]['id']:0x0);if(_0x17be3d[_0x21c5('0x36')][_0xe237a5]){_0x17be3d['rules'][_0xe237a5]['emit'](_0x21c5('0x41'));if(rpc[_0x5f3d15[_0x21c5('0x12')]+_0x21c5('0x42')]){rpc[_0x5f3d15[_0x21c5('0x12')]+'QueueReport'][_0x21c5('0x43')](_0xe237a5,{'UserId':_0x5f3d15[_0x21c5('0x27')][_0x21c5('0x44')]})[_0x21c5('0x45')](function(){logger['error'](_0x21c5('0x46'));});}}return _0x3393a6({'code':0xc8,'message':_0x5f3d15});}catch(_0x174a7e){logger[_0x21c5('0x34')](_0x174a7e['stack']);return _0x2cb9f9(_0x462537[_0x21c5('0x34')](0x1f4,_0x174a7e));}}logger['error']('message\x20is\x20empty');return _0x2cb9f9(_0x462537[_0x21c5('0x34')](0x1f4,_0x21c5('0x47')));});},'RejectMessage':function(_0x26007f){var _0x4550dc=this;return new Promise(function(_0x3ec91a,_0x5dd4d6){if(_0x26007f['agent']&&_0x26007f['agent']['id']){try{if(_0x17be3d[_0x21c5('0x3f')][_0x26007f[_0x21c5('0x3e')]['id']]){_0x17be3d['agents'][_0x26007f[_0x21c5('0x3e')]['id']][_0x21c5('0x40')]=![];_0x17be3d[_0x21c5('0x3f')][_0x26007f[_0x21c5('0x3e')]['id']]['busyQueue']=undefined;}return _0x3ec91a({'code':0xc8,'message':_0x26007f});}catch(_0x1d366a){logger[_0x21c5('0x34')](_0x1d366a[_0x21c5('0x3c')]);return _0x5dd4d6(_0x4550dc[_0x21c5('0x34')](0x1f4,_0x1d366a));}}logger[_0x21c5('0x34')]('message\x20is\x20empty');return _0x5dd4d6(_0x4550dc['error'](0x1f4,_0x21c5('0x47')));});},'AbandonInteraction':function(_0x3d7144){var _0x100f02=this;return new Promise(function(_0xc3fa2,_0x37aa16){if(_0x3d7144['channel']&&_0x3d7144[_0x21c5('0x13')]&&_0x3d7144[_0x21c5('0x13')]['id']){try{var _0x564acd=getId(_0x3d7144[_0x21c5('0x12')],_0x3d7144[_0x21c5('0x27')]?_0x3d7144['message']['id']:0x0,_0x3d7144[_0x21c5('0x13')]?_0x3d7144['interaction']['id']:0x0);if(_0x17be3d[_0x21c5('0x36')][_0x564acd]){_0x17be3d['rules'][_0x564acd][_0x21c5('0x48')](_0x21c5('0x41'));}return _0xc3fa2({'code':0xc8,'message':_0x3d7144});}catch(_0xd4c091){logger[_0x21c5('0x34')](_0xd4c091[_0x21c5('0x3c')]);return _0x37aa16(_0x100f02['error'](0x1f4,_0xd4c091));}}logger[_0x21c5('0x34')]('message\x20is\x20empty');return _0x37aa16(_0x100f02[_0x21c5('0x34')](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x521729){var _0x35ee5f=this;return new Promise(function(_0x164917,_0x5bde7a){if(_0x17be3d[_0x21c5('0x3f')][_0x21c5('0x49')](_0x521729['id'])){for(var _0x284249 in _0x521729[_0x21c5('0x4a')]){if(_0x521729['capacity'][_0x21c5('0x49')](_0x284249)){if(_0x17be3d['agents'][_0x521729['id']][_0x21c5('0x49')](_0x284249+_0x21c5('0x4b'))){_0x17be3d[_0x21c5('0x3f')][_0x521729['id']][_0x284249+_0x21c5('0x4b')]=parseInt(_0x521729[_0x21c5('0x4a')][_0x284249],0xa);}}}_0x17be3d['agents'][_0x521729['id']]['updateRealtime']();return _0x164917({'code':0xc8,'message':_0x17be3d[_0x21c5('0x3f')][_0x521729['id']]});}else{return _0x5bde7a(_0x35ee5f[_0x21c5('0x34')](0x1f4,_0x21c5('0x4c')));}});},'Agents':function(_0x13059f){return new Promise(function(_0x12bd5d){var _0x5e3c7e=_[_0x21c5('0x4d')](_0x17be3d[_0x21c5('0x3f')]);if(_0x13059f&&_0x13059f['id']){var _0x4bf7ff=_[_0x21c5('0x4e')](_0x5e3c7e,function(_0x500ede){return _0x500ede['id']===_0x13059f['id'];});_0x12bd5d(_0x4bf7ff);}else{_0x12bd5d({'count':_0x5e3c7e[_0x21c5('0x16')],'rows':_0x5e3c7e});}});},'ChatQueues':function(){return new Promise(function(_0x2d79e9){var _0x39ea02=[];for(var _0x149b0e in _0x17be3d[_0x21c5('0x4f')]){if(_0x17be3d['chatQueues'][_0x21c5('0x49')](_0x149b0e)){var _0x23a1f0=_0x17be3d[_0x21c5('0x4f')][_0x149b0e];var _0x47bbe6={'id':_0x23a1f0['id'],'available':_0x23a1f0[_0x21c5('0x50')],'loggedIn':_0x23a1f0['loggedIn'],'name':_0x23a1f0[_0x21c5('0x51')],'paused':_0x23a1f0['paused'],'waiting':_0x23a1f0[_0x21c5('0x52')]};_0x39ea02[_0x21c5('0x1e')](_0x47bbe6);}}_0x2d79e9({'count':_0x39ea02[_0x21c5('0x16')],'rows':_0x39ea02});});},'MailQueues':function(){return new Promise(function(_0x14570a){var _0x2b1b13=[];for(var _0x4ae8cc in _0x17be3d[_0x21c5('0x53')]){if(_0x17be3d[_0x21c5('0x53')]['hasOwnProperty'](_0x4ae8cc)){var _0x289844=_0x17be3d[_0x21c5('0x53')][_0x4ae8cc];var _0xd7bf30={'id':_0x289844['id'],'available':_0x289844['available'],'loggedIn':_0x289844[_0x21c5('0x54')],'name':_0x289844[_0x21c5('0x51')],'paused':_0x289844[_0x21c5('0x55')],'waiting':_0x289844[_0x21c5('0x52')]};_0x2b1b13[_0x21c5('0x1e')](_0xd7bf30);}}_0x14570a({'count':_0x2b1b13['length'],'rows':_0x2b1b13});});},'OpenchannelQueues':function(){return new Promise(function(_0x2f85ec){var _0x2f749c=[];for(var _0x5c29bf in _0x17be3d[_0x21c5('0x56')]){if(_0x17be3d[_0x21c5('0x56')][_0x21c5('0x49')](_0x5c29bf)){var _0x1ca34b=_0x17be3d['openchannelQueues'][_0x5c29bf];var _0x150f0f={'id':_0x1ca34b['id'],'available':_0x1ca34b[_0x21c5('0x50')],'loggedIn':_0x1ca34b[_0x21c5('0x54')],'name':_0x1ca34b[_0x21c5('0x51')],'paused':_0x1ca34b['paused'],'waiting':_0x1ca34b['waiting']};_0x2f749c[_0x21c5('0x1e')](_0x150f0f);}}_0x2f85ec({'count':_0x2f749c['length'],'rows':_0x2f749c});});},'SmsQueues':function(){return new Promise(function(_0x5c40af){var _0x385a9b=[];for(var _0x1cf310 in _0x17be3d[_0x21c5('0x57')]){if(_0x17be3d[_0x21c5('0x57')]['hasOwnProperty'](_0x1cf310)){var _0x181636=_0x17be3d['smsQueues'][_0x1cf310];var _0x11bd17={'id':_0x181636['id'],'available':_0x181636[_0x21c5('0x50')],'loggedIn':_0x181636[_0x21c5('0x54')],'name':_0x181636[_0x21c5('0x51')],'paused':_0x181636[_0x21c5('0x55')],'waiting':_0x181636[_0x21c5('0x52')]};_0x385a9b[_0x21c5('0x1e')](_0x11bd17);}}_0x5c40af({'count':_0x385a9b[_0x21c5('0x16')],'rows':_0x385a9b});});},'FaxQueues':function(){return new Promise(function(_0x9dc5e7){var _0x51336d=[];for(var _0x48c7c8 in _0x17be3d[_0x21c5('0x58')]){if(_0x17be3d['faxQueues'][_0x21c5('0x49')](_0x48c7c8)){var _0x4f5003=_0x17be3d[_0x21c5('0x58')][_0x48c7c8];var _0x4380ba={'id':_0x4f5003['id'],'available':_0x4f5003[_0x21c5('0x50')],'loggedIn':_0x4f5003['loggedIn'],'name':_0x4f5003['name'],'paused':_0x4f5003['paused'],'waiting':_0x4f5003[_0x21c5('0x52')]};_0x51336d[_0x21c5('0x1e')](_0x4380ba);}}_0x9dc5e7({'count':_0x51336d[_0x21c5('0x16')],'rows':_0x51336d});});},'WhatsappQueues':function(){return new Promise(function(_0x1f4513){var _0x4241ab=[];for(var _0x1adb95 in _0x17be3d['whatsappQueues']){if(_0x17be3d['whatsappQueues'][_0x21c5('0x49')](_0x1adb95)){var _0x5697a1=_0x17be3d[_0x21c5('0x59')][_0x1adb95];var _0x183bfb={'id':_0x5697a1['id'],'available':_0x5697a1['available'],'loggedIn':_0x5697a1[_0x21c5('0x54')],'name':_0x5697a1[_0x21c5('0x51')],'paused':_0x5697a1['paused'],'waiting':_0x5697a1[_0x21c5('0x52')]};_0x4241ab[_0x21c5('0x1e')](_0x183bfb);}}_0x1f4513({'count':_0x4241ab[_0x21c5('0x16')],'rows':_0x4241ab});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x738b94){var _0x200738=_[_0x21c5('0x4d')](_0x17be3d[_0x21c5('0x5a')]);_0x738b94({'count':_0x200738[_0x21c5('0x16')],'rows':_0x200738});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x1c145c){var _0x95511a=_['values'](_0x17be3d[_0x21c5('0x5b')]);_0x1c145c({'count':_0x95511a[_0x21c5('0x16')],'rows':_0x95511a});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x3cdeda){var _0x571bd6=_[_0x21c5('0x4d')](_0x17be3d[_0x21c5('0x5c')]);_0x3cdeda({'count':_0x571bd6[_0x21c5('0x16')],'rows':_0x571bd6});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x1cb3c4){var _0x6dce8f=_[_0x21c5('0x4d')](_0x17be3d['smsQueuesWaitingInteractions']);_0x1cb3c4({'count':_0x6dce8f[_0x21c5('0x16')],'rows':_0x6dce8f});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x3f1289){var _0x2b3bbb=_['values'](_0x17be3d['faxQueuesWaitingInteractions']);_0x3f1289({'count':_0x2b3bbb[_0x21c5('0x16')],'rows':_0x2b3bbb});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x5222ab){var _0x49297a=_[_0x21c5('0x4d')](_0x17be3d[_0x21c5('0x5d')]);_0x5222ab({'count':_0x49297a['length'],'rows':_0x49297a});});}};var _0x25e753=jayson[_0x21c5('0x5e')](_0x35d2fe)[_0x21c5('0x5f')]();_0x25e753['on'](_0x21c5('0x34'),function(_0x59ad26){logger[_0x21c5('0x34')](JSON[_0x21c5('0x37')](_0x59ad26));return _0x3ba28b(_0x59ad26);});_0x25e753[_0x21c5('0x60')](0x232c,_0x21c5('0x61'),function(){console['log'](_0x21c5('0x62'),0x232c);return _0x4791f7(_0x21c5('0x63')+0x232c);});});}; \ No newline at end of file +var _0xeb9a=['join','app','.js','toLowerCase','appdata','split','push','slice','dialogflow','dialogflowv2','tag','TagId','getMustacheRender','account','notificationTemplate','ChatWebsiteId','ContactId','body','format','%s:%s:%s','./interval','condition','intervals','priority','Push\x20new\x20rule','\x20|\x20','error','execute','info','Applications\x20executed','stringify','matchPath','rules','emit','complete','Skipped\x20routing\x20for\x20%s','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','agents','busy','busyQueue','end','QueueReport','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','capacity','hasOwnProperty','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','find','chatQueues','available','loggedIn','name','mailQueues','paused','waiting','openchannelQueues','smsQueues','faxQueues','whatsappQueues','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','util','path','jayson/promise','./applications/utils','./applications/strategy/util','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','isNil','IntervalId','Intervals','map','interval','listen','channel','message','interaction','transfer','applications','isArray','length','existsSync'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xeb9a,0x178));var _0xaeb9=function(_0x616290,_0x280b7f){_0x616290=_0x616290-0x0;var _0x453879=_0xeb9a[_0x616290];return _0x453879;};'use strict';var _=require(_0xaeb9('0x0'));var util=require(_0xaeb9('0x1'));var path=require(_0xaeb9('0x2'));var fs=require('fs');var jayson=require(_0xaeb9('0x3'));var BPromise=require('bluebird');var utils=require(_0xaeb9('0x4'));var sUtils=require(_0xaeb9('0x5'));var logger=require('../../../config/logger')(_0xaeb9('0x6'));var rpc={'openchannelQueueReport':require(_0xaeb9('0x7')),'mailQueueReport':require(_0xaeb9('0x8')),'chatQueueReport':require(_0xaeb9('0x9')),'smsQueueReport':require(_0xaeb9('0xa')),'faxQueueReport':require(_0xaeb9('0xb')),'whatsappQueueReport':require(_0xaeb9('0xc'))};var RuleEngine=require(_0xaeb9('0xd'));function getId(_0x4729a5,_0x4a135f,_0x4cf057){return util['format']('%s.%s.%s',_0x4729a5,_0x4a135f||0x0,_0x4cf057||0x0);}function getIntervals(_0x312623,_0x30ba14){var _0x314597=[];if(!_[_0xaeb9('0xe')](_0x30ba14[_0xaeb9('0xf')])&&!_[_0xaeb9('0xe')](_0x312623[_0x30ba14['IntervalId']])&&!_['isNil'](_0x312623[_0x30ba14[_0xaeb9('0xf')]][_0xaeb9('0x10')])){_0x314597=_[_0xaeb9('0x11')](_0x312623[_0x30ba14[_0xaeb9('0xf')]][_0xaeb9('0x10')],'interval');}else if(!_[_0xaeb9('0xe')](_0x30ba14[_0xaeb9('0x12')])){_0x314597=[_0x30ba14['interval']];}return _0x314597;}exports[_0xaeb9('0x13')]=function(_0x3749bf){_0x3749bf['rules']={};return new BPromise(function(_0x2962b8,_0x226c07){var _0x4d3249={'Start':function(_0xe2d32c){var _0x5589ba=this;return new Promise(function(_0x2c1be9,_0x585f05){if(_0xe2d32c){try{var _0x4cee45=[];var _0x21148e=getId(_0xe2d32c[_0xaeb9('0x14')],_0xe2d32c[_0xaeb9('0x15')]?_0xe2d32c['message']['id']:0x0,_0xe2d32c[_0xaeb9('0x16')]?_0xe2d32c[_0xaeb9('0x16')]['id']:0x0);var _0x4196cf=sUtils['checkWaitingNotifications'](_0x3749bf,_0xe2d32c);if(_0xe2d32c[_0xaeb9('0x17')]||!_0x4196cf&&_0xe2d32c[_0xaeb9('0x18')]&&_[_0xaeb9('0x19')](_0xe2d32c[_0xaeb9('0x18')])&&_0xe2d32c[_0xaeb9('0x18')][_0xaeb9('0x1a')]){for(var _0x7bd45f=0x0;_0x7bd45f<_0xe2d32c[_0xaeb9('0x18')]['length'];_0x7bd45f+=0x1){var _0x187a6c=_0xe2d32c[_0xaeb9('0x18')][_0x7bd45f];if(fs[_0xaeb9('0x1b')](path[_0xaeb9('0x1c')](__dirname,'applications',_0x187a6c[_0xaeb9('0x1d')]+_0xaeb9('0x1e')))){var _0x4c672e=[];switch(_0x187a6c['app'][_0xaeb9('0x1f')]()){case'autoreply':var _0x1e5485=_0x187a6c[_0xaeb9('0x20')][_0xaeb9('0x21')](',');if(_0xe2d32c[_0xaeb9('0x14')]==='mail'){_0x4c672e[_0xaeb9('0x22')](_0x1e5485[0x0]);_0x4c672e[_0xaeb9('0x22')](_0x1e5485[0x1]);_0x4c672e[_0xaeb9('0x22')](_0x1e5485[_0xaeb9('0x23')](0x2,_0x1e5485[_0xaeb9('0x1a')])[_0xaeb9('0x1c')](','));}else{_0x4c672e['push'](_0x1e5485[0x0]);_0x4c672e[_0xaeb9('0x22')](_0x1e5485[_0xaeb9('0x23')](0x1,_0x1e5485[_0xaeb9('0x1a')])[_0xaeb9('0x1c')](','));}break;case _0xaeb9('0x24'):var _0x11833f=_0x187a6c[_0xaeb9('0x20')][_0xaeb9('0x21')](',');_0x4c672e[_0xaeb9('0x22')](_0x11833f[0x0]);_0x4c672e[_0xaeb9('0x22')](_0x11833f[0x1]);_0x4c672e[_0xaeb9('0x22')](_0x11833f['slice'](0x2,_0x11833f[_0xaeb9('0x1a')])['join'](','));break;case _0xaeb9('0x25'):var _0x332e7f=_0x187a6c[_0xaeb9('0x20')][_0xaeb9('0x21')](',');_0x4c672e[_0xaeb9('0x22')](_0x332e7f[0x0]);_0x4c672e[_0xaeb9('0x22')](_0x332e7f[0x1]);_0x4c672e[_0xaeb9('0x22')](_0x332e7f[0x2]);_0x4c672e[_0xaeb9('0x22')](_0x332e7f[0x3]);_0x4c672e['push'](_0x332e7f[_0xaeb9('0x23')](0x4,_0x332e7f[_0xaeb9('0x1a')])[_0xaeb9('0x1c')](','));break;case'amazonlex':var _0x358c83=_0x187a6c[_0xaeb9('0x20')][_0xaeb9('0x21')](',');_0x4c672e['push'](_0x358c83[0x0]);_0x4c672e[_0xaeb9('0x22')](_0x358c83[0x1]);_0x4c672e[_0xaeb9('0x22')](_0x358c83[0x2]);_0x4c672e[_0xaeb9('0x22')](_0x358c83[0x3]);_0x4c672e[_0xaeb9('0x22')](_0x358c83[_0xaeb9('0x23')](0x4,_0x358c83['length'])[_0xaeb9('0x1c')](','));break;case _0xaeb9('0x15'):_0x4c672e[_0xaeb9('0x22')](_0x187a6c[_0xaeb9('0x20')]);break;case _0xaeb9('0x26'):_0x4c672e[_0xaeb9('0x22')](_0x187a6c[_0xaeb9('0x27')]);_0x4c672e[_0xaeb9('0x22')](_0x187a6c[_0xaeb9('0x20')]);break;case'tvox':var _0x5bbf20=utils[_0xaeb9('0x28')](_0xe2d32c[_0xaeb9('0x29')][_0xaeb9('0x2a')],_0xe2d32c);var _0x415446=_0x187a6c[_0xaeb9('0x20')][_0xaeb9('0x21')](',');_0x4c672e['push'](_0x415446[0x0]);_0x4c672e[_0xaeb9('0x22')](_0x415446[0x1]);_0x4c672e[_0xaeb9('0x22')](_0x415446[0x2]);_0x4c672e[_0xaeb9('0x22')](_0x415446[0x3]);_0x4c672e['push'](_0x415446[0x4]);_0x4c672e[_0xaeb9('0x22')](_0x415446[0x5]);_0x4c672e[_0xaeb9('0x22')](_0x415446[0x6]);_0x4c672e[_0xaeb9('0x22')](_0x415446[0x7]);_0x4c672e[_0xaeb9('0x22')](_0x415446[0x8]);_0x4c672e[_0xaeb9('0x22')](_0x415446[0x9]);_0x4c672e[_0xaeb9('0x22')](_0x415446[0xa]);_0x4c672e[_0xaeb9('0x22')](_0xe2d32c[_0xaeb9('0x16')]['id']);_0x4c672e[_0xaeb9('0x22')](_0xe2d32c['message']['id']);_0x4c672e[_0xaeb9('0x22')](_0x187a6c[_0xaeb9('0x2b')]);_0x4c672e[_0xaeb9('0x22')](_0xe2d32c['interaction'][_0xaeb9('0x2c')]);_0x4c672e['push'](_0xe2d32c[_0xaeb9('0x2d')][_0xaeb9('0x2d')]);_0x4c672e['push'](_0x5bbf20);break;default:_0x4c672e=_['isNil'](_0x187a6c[_0xaeb9('0x20')])?[]:_0x187a6c[_0xaeb9('0x20')][_0xaeb9('0x21')](',');}var _0x32296c={'id':util[_0xaeb9('0x2e')](_0xaeb9('0x2f'),_0x21148e,_0x187a6c['id'],_0x187a6c['app']),'condition':require(_0xaeb9('0x30'))[_0xaeb9('0x31')](_0x21148e,getIntervals(_0x3749bf[_0xaeb9('0x32')],_0x187a6c),_0x3749bf),'consequence':require('./applications/'+_0x187a6c[_0xaeb9('0x1d')])['consequence'](_0x21148e,_0x4c672e,_0x3749bf,_0xe2d32c),'p':_0x187a6c[_0xaeb9('0x33')]||0x0};logger['info'](_0xaeb9('0x34'),_0x32296c['id'],'on\x20interval',getIntervals(_0x3749bf[_0xaeb9('0x32')],_0x187a6c)['join'](_0xaeb9('0x35')));_0x4cee45[_0xaeb9('0x22')](_0x32296c);}else{logger[_0xaeb9('0x36')]('Please\x20create\x20a\x20new\x20file\x20under',path[_0xaeb9('0x1c')](__dirname,'applications',_0x187a6c[_0xaeb9('0x1d')]+_0xaeb9('0x1e')));}}_0x3749bf['rules'][_0x21148e]=new RuleEngine(_0x4cee45);_0x3749bf['rules'][_0x21148e][_0xaeb9('0x37')](_0xe2d32c,function(_0x26cab2){logger[_0xaeb9('0x38')](_0xaeb9('0x39'),JSON[_0xaeb9('0x3a')](_0x26cab2[_0xaeb9('0x3b')]));if(_0x3749bf['rules'][_0x21148e]){_0x3749bf[_0xaeb9('0x3c')][_0x21148e][_0xaeb9('0x3d')](_0xaeb9('0x3e'));}});return _0x2c1be9({'code':0xc8,'message':_0xe2d32c});}else{if(_0x4196cf){logger[_0xaeb9('0x38')](util[_0xaeb9('0x2e')](_0xaeb9('0x3f'),_0x21148e));}else{logger[_0xaeb9('0x38')](_0xaeb9('0x40'));}return _0x2c1be9({'code':0xc8,'message':_0xe2d32c});}}catch(_0x4c329){logger[_0xaeb9('0x36')](_0x4c329[_0xaeb9('0x41')]);return _0x585f05(_0x5589ba[_0xaeb9('0x36')](0x1f4,_0x4c329));}}return _0x585f05(_0xaeb9('0x42'));});},'AcceptMessage':function(_0x5a8bea){var _0x5cf34f=this;return new Promise(function(_0x53c8c6,_0x436dea){if(_0x5a8bea[_0xaeb9('0x43')]&&_0x5a8bea[_0xaeb9('0x43')]['id']){if(_0x3749bf[_0xaeb9('0x44')][_0x5a8bea[_0xaeb9('0x43')]['id']]){_0x3749bf[_0xaeb9('0x44')][_0x5a8bea[_0xaeb9('0x43')]['id']][_0xaeb9('0x45')]=![];_0x3749bf[_0xaeb9('0x44')][_0x5a8bea['agent']['id']][_0xaeb9('0x46')]=undefined;}}if(_0x5a8bea[_0xaeb9('0x15')]&&_0x5a8bea[_0xaeb9('0x15')]['id']){try{var _0x995fc4=getId(_0x5a8bea[_0xaeb9('0x14')],_0x5a8bea[_0xaeb9('0x15')]?_0x5a8bea[_0xaeb9('0x15')]['id']:0x0,_0x5a8bea[_0xaeb9('0x16')]?_0x5a8bea[_0xaeb9('0x16')]['id']:0x0);if(_0x3749bf[_0xaeb9('0x3c')][_0x995fc4]){_0x3749bf['rules'][_0x995fc4]['emit'](_0xaeb9('0x47'));if(rpc[_0x5a8bea['channel']+_0xaeb9('0x48')]){rpc[_0x5a8bea[_0xaeb9('0x14')]+_0xaeb9('0x48')]['update'](_0x995fc4,{'UserId':_0x5a8bea[_0xaeb9('0x15')][_0xaeb9('0x49')]})[_0xaeb9('0x4a')](function(){logger['error'](_0xaeb9('0x4b'));});}}return _0x53c8c6({'code':0xc8,'message':_0x5a8bea});}catch(_0x7c8123){logger[_0xaeb9('0x36')](_0x7c8123['stack']);return _0x436dea(_0x5cf34f['error'](0x1f4,_0x7c8123));}}logger[_0xaeb9('0x36')](_0xaeb9('0x4c'));return _0x436dea(_0x5cf34f[_0xaeb9('0x36')](0x1f4,_0xaeb9('0x4c')));});},'RejectMessage':function(_0x5ea5ce){var _0x1e97f8=this;return new Promise(function(_0x48db92,_0x24c0a1){if(_0x5ea5ce['agent']&&_0x5ea5ce[_0xaeb9('0x43')]['id']){try{if(_0x3749bf[_0xaeb9('0x44')][_0x5ea5ce[_0xaeb9('0x43')]['id']]){_0x3749bf['agents'][_0x5ea5ce['agent']['id']][_0xaeb9('0x45')]=![];_0x3749bf[_0xaeb9('0x44')][_0x5ea5ce[_0xaeb9('0x43')]['id']]['busyQueue']=undefined;}return _0x48db92({'code':0xc8,'message':_0x5ea5ce});}catch(_0x2cca19){logger[_0xaeb9('0x36')](_0x2cca19['stack']);return _0x24c0a1(_0x1e97f8['error'](0x1f4,_0x2cca19));}}logger[_0xaeb9('0x36')](_0xaeb9('0x4c'));return _0x24c0a1(_0x1e97f8[_0xaeb9('0x36')](0x1f4,_0xaeb9('0x4c')));});},'AbandonInteraction':function(_0x47c6b5){var _0xc185b0=this;return new Promise(function(_0x14a050,_0x1c1256){if(_0x47c6b5[_0xaeb9('0x14')]&&_0x47c6b5[_0xaeb9('0x16')]&&_0x47c6b5[_0xaeb9('0x16')]['id']){try{var _0x2f96d5=getId(_0x47c6b5[_0xaeb9('0x14')],_0x47c6b5[_0xaeb9('0x15')]?_0x47c6b5[_0xaeb9('0x15')]['id']:0x0,_0x47c6b5['interaction']?_0x47c6b5['interaction']['id']:0x0);if(_0x3749bf[_0xaeb9('0x3c')][_0x2f96d5]){_0x3749bf[_0xaeb9('0x3c')][_0x2f96d5][_0xaeb9('0x3d')](_0xaeb9('0x47'));}return _0x14a050({'code':0xc8,'message':_0x47c6b5});}catch(_0x40eb18){logger[_0xaeb9('0x36')](_0x40eb18[_0xaeb9('0x41')]);return _0x1c1256(_0xc185b0[_0xaeb9('0x36')](0x1f4,_0x40eb18));}}logger[_0xaeb9('0x36')](_0xaeb9('0x4c'));return _0x1c1256(_0xc185b0['error'](0x1f4,_0xaeb9('0x4c')));});},'AgentCapacity':function(_0xb169db){var _0x556791=this;return new Promise(function(_0x43bb11,_0x19f853){if(_0x3749bf[_0xaeb9('0x44')]['hasOwnProperty'](_0xb169db['id'])){for(var _0x2958a3 in _0xb169db[_0xaeb9('0x4d')]){if(_0xb169db[_0xaeb9('0x4d')]['hasOwnProperty'](_0x2958a3)){if(_0x3749bf[_0xaeb9('0x44')][_0xb169db['id']][_0xaeb9('0x4e')](_0x2958a3+_0xaeb9('0x4f'))){_0x3749bf[_0xaeb9('0x44')][_0xb169db['id']][_0x2958a3+_0xaeb9('0x4f')]=parseInt(_0xb169db[_0xaeb9('0x4d')][_0x2958a3],0xa);}}}_0x3749bf[_0xaeb9('0x44')][_0xb169db['id']][_0xaeb9('0x50')]();return _0x43bb11({'code':0xc8,'message':_0x3749bf[_0xaeb9('0x44')][_0xb169db['id']]});}else{return _0x19f853(_0x556791[_0xaeb9('0x36')](0x1f4,_0xaeb9('0x51')));}});},'Agents':function(_0x1fae18){return new Promise(function(_0x1a40e9){var _0x295475=_[_0xaeb9('0x52')](_0x3749bf[_0xaeb9('0x44')]);if(_0x1fae18&&_0x1fae18['id']){var _0x5c44cb=_[_0xaeb9('0x53')](_0x295475,function(_0x2e1704){return _0x2e1704['id']===_0x1fae18['id'];});_0x1a40e9(_0x5c44cb);}else{_0x1a40e9({'count':_0x295475[_0xaeb9('0x1a')],'rows':_0x295475});}});},'ChatQueues':function(){return new Promise(function(_0x585d66){var _0x552a57=[];for(var _0x22db2d in _0x3749bf[_0xaeb9('0x54')]){if(_0x3749bf[_0xaeb9('0x54')][_0xaeb9('0x4e')](_0x22db2d)){var _0x4b3890=_0x3749bf[_0xaeb9('0x54')][_0x22db2d];var _0x53caeb={'id':_0x4b3890['id'],'available':_0x4b3890[_0xaeb9('0x55')],'loggedIn':_0x4b3890[_0xaeb9('0x56')],'name':_0x4b3890[_0xaeb9('0x57')],'paused':_0x4b3890['paused'],'waiting':_0x4b3890['waiting']};_0x552a57['push'](_0x53caeb);}}_0x585d66({'count':_0x552a57['length'],'rows':_0x552a57});});},'MailQueues':function(){return new Promise(function(_0x56d56b){var _0x41df21=[];for(var _0x386174 in _0x3749bf[_0xaeb9('0x58')]){if(_0x3749bf['mailQueues']['hasOwnProperty'](_0x386174)){var _0x3e10ab=_0x3749bf[_0xaeb9('0x58')][_0x386174];var _0x134123={'id':_0x3e10ab['id'],'available':_0x3e10ab[_0xaeb9('0x55')],'loggedIn':_0x3e10ab[_0xaeb9('0x56')],'name':_0x3e10ab['name'],'paused':_0x3e10ab[_0xaeb9('0x59')],'waiting':_0x3e10ab[_0xaeb9('0x5a')]};_0x41df21[_0xaeb9('0x22')](_0x134123);}}_0x56d56b({'count':_0x41df21['length'],'rows':_0x41df21});});},'OpenchannelQueues':function(){return new Promise(function(_0x364568){var _0xeb388f=[];for(var _0x7d52da in _0x3749bf['openchannelQueues']){if(_0x3749bf[_0xaeb9('0x5b')][_0xaeb9('0x4e')](_0x7d52da)){var _0x40853b=_0x3749bf[_0xaeb9('0x5b')][_0x7d52da];var _0x195488={'id':_0x40853b['id'],'available':_0x40853b[_0xaeb9('0x55')],'loggedIn':_0x40853b[_0xaeb9('0x56')],'name':_0x40853b[_0xaeb9('0x57')],'paused':_0x40853b['paused'],'waiting':_0x40853b[_0xaeb9('0x5a')]};_0xeb388f[_0xaeb9('0x22')](_0x195488);}}_0x364568({'count':_0xeb388f[_0xaeb9('0x1a')],'rows':_0xeb388f});});},'SmsQueues':function(){return new Promise(function(_0x363b17){var _0x46d4d5=[];for(var _0x4f3c5e in _0x3749bf[_0xaeb9('0x5c')]){if(_0x3749bf[_0xaeb9('0x5c')][_0xaeb9('0x4e')](_0x4f3c5e)){var _0x78e882=_0x3749bf[_0xaeb9('0x5c')][_0x4f3c5e];var _0xd39b73={'id':_0x78e882['id'],'available':_0x78e882[_0xaeb9('0x55')],'loggedIn':_0x78e882[_0xaeb9('0x56')],'name':_0x78e882['name'],'paused':_0x78e882[_0xaeb9('0x59')],'waiting':_0x78e882['waiting']};_0x46d4d5['push'](_0xd39b73);}}_0x363b17({'count':_0x46d4d5[_0xaeb9('0x1a')],'rows':_0x46d4d5});});},'FaxQueues':function(){return new Promise(function(_0xa315f9){var _0x191b98=[];for(var _0x36e5c3 in _0x3749bf[_0xaeb9('0x5d')]){if(_0x3749bf[_0xaeb9('0x5d')][_0xaeb9('0x4e')](_0x36e5c3)){var _0xb5a726=_0x3749bf[_0xaeb9('0x5d')][_0x36e5c3];var _0x657c55={'id':_0xb5a726['id'],'available':_0xb5a726[_0xaeb9('0x55')],'loggedIn':_0xb5a726[_0xaeb9('0x56')],'name':_0xb5a726['name'],'paused':_0xb5a726[_0xaeb9('0x59')],'waiting':_0xb5a726[_0xaeb9('0x5a')]};_0x191b98['push'](_0x657c55);}}_0xa315f9({'count':_0x191b98[_0xaeb9('0x1a')],'rows':_0x191b98});});},'WhatsappQueues':function(){return new Promise(function(_0xaf07aa){var _0x279a18=[];for(var _0x36e78a in _0x3749bf[_0xaeb9('0x5e')]){if(_0x3749bf[_0xaeb9('0x5e')][_0xaeb9('0x4e')](_0x36e78a)){var _0x723443=_0x3749bf[_0xaeb9('0x5e')][_0x36e78a];var _0x517912={'id':_0x723443['id'],'available':_0x723443[_0xaeb9('0x55')],'loggedIn':_0x723443[_0xaeb9('0x56')],'name':_0x723443[_0xaeb9('0x57')],'paused':_0x723443[_0xaeb9('0x59')],'waiting':_0x723443['waiting']};_0x279a18[_0xaeb9('0x22')](_0x517912);}}_0xaf07aa({'count':_0x279a18[_0xaeb9('0x1a')],'rows':_0x279a18});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x2237c9){var _0x1bd1a7=_[_0xaeb9('0x52')](_0x3749bf['chatQueuesWaitingInteractions']);_0x2237c9({'count':_0x1bd1a7[_0xaeb9('0x1a')],'rows':_0x1bd1a7});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0xf19ad7){var _0x5e547d=_[_0xaeb9('0x52')](_0x3749bf['mailQueuesWaitingInteractions']);_0xf19ad7({'count':_0x5e547d[_0xaeb9('0x1a')],'rows':_0x5e547d});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x4206af){var _0x3bab28=_['values'](_0x3749bf[_0xaeb9('0x5f')]);_0x4206af({'count':_0x3bab28[_0xaeb9('0x1a')],'rows':_0x3bab28});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x3436eb){var _0x1b7c3b=_[_0xaeb9('0x52')](_0x3749bf[_0xaeb9('0x60')]);_0x3436eb({'count':_0x1b7c3b[_0xaeb9('0x1a')],'rows':_0x1b7c3b});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x581e95){var _0x290659=_[_0xaeb9('0x52')](_0x3749bf[_0xaeb9('0x61')]);_0x581e95({'count':_0x290659[_0xaeb9('0x1a')],'rows':_0x290659});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x36b403){var _0x55bd95=_[_0xaeb9('0x52')](_0x3749bf['whatsappQueuesWaitingInteractions']);_0x36b403({'count':_0x55bd95[_0xaeb9('0x1a')],'rows':_0x55bd95});});}};var _0x315198=jayson['server'](_0x4d3249)['http']();_0x315198['on']('error',function(_0x2c9af3){logger['error'](JSON[_0xaeb9('0x3a')](_0x2c9af3));return _0x226c07(_0x2c9af3);});_0x315198['listen'](0x232c,_0xaeb9('0x62'),function(){console[_0xaeb9('0x63')](_0xaeb9('0x64'),0x232c);return _0x2962b8('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 074d791..c4e0544 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 _0x0c66=['bluebird','jayson/promise','lodash','../../../config/logger','routing','client','request','then','error','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','Command','format','iftime\x20%s','message','indexOf','true','all','some','[%s][INTERVAL]\x20%s\x20%s','join','when','\x20|\x20','stack','util'];(function(_0x57cb4f,_0x541f57){var _0x29bb45=function(_0x462bee){while(--_0x462bee){_0x57cb4f['push'](_0x57cb4f['shift']());}};_0x29bb45(++_0x541f57);}(_0x0c66,0xd8));var _0x60c6=function(_0x500419,_0x549162){_0x500419=_0x500419-0x0;var _0x241c1a=_0x0c66[_0x500419];return _0x241c1a;};'use strict';var util=require(_0x60c6('0x0'));var BPromise=require(_0x60c6('0x1'));var jayson=require(_0x60c6('0x2'));var _=require(_0x60c6('0x3'));var logger=require(_0x60c6('0x4'))(_0x60c6('0x5'));var client=jayson[_0x60c6('0x6')]['http']({'port':0x232a});function request(_0x44429c,_0x5a2943){return new BPromise(function(_0x2c3d9c,_0x4069cc){return client[_0x60c6('0x7')](_0x44429c,_0x5a2943)[_0x60c6('0x8')](function(_0x1b9abb){if(_0x1b9abb['error']){return _0x4069cc(_0x1b9abb[_0x60c6('0x9')]['message']);}else{return _0x2c3d9c(_0x1b9abb['result']);}})[_0x60c6('0xa')](function(_0x36c8d4){return _0x4069cc(_0x36c8d4);});});}exports[_0x60c6('0xb')]=function(_0x9aea1a,_0x331a52,_0x2b36f0){return function(_0x396e7e){if(_0x2b36f0[_0x60c6('0xc')]&&!_0x2b36f0[_0x60c6('0xc')][_0x9aea1a]){logger[_0x60c6('0xd')](_0x60c6('0xe'),_0x9aea1a);return _0x396e7e[_0x60c6('0xf')]();}var _0x256f5d=[];for(var _0x5cab58=0x0;_0x5cab58<_0x331a52[_0x60c6('0x10')];_0x5cab58+=0x1){_0x256f5d[_0x60c6('0x11')](request(_0x60c6('0x12'),{'command':util[_0x60c6('0x13')](_0x60c6('0x14'),_0x331a52[_0x5cab58])})[_0x60c6('0x8')](function(_0x1a2bc9){return _0x1a2bc9&&_0x1a2bc9[_0x60c6('0x15')]&&_0x1a2bc9['message'][_0x60c6('0x16')](_0x60c6('0x17'))>=0x0?!![]:![];})['catch'](function(){logger['error']('[%s][INTERVAL]\x20%s',_0x9aea1a,_0x331a52[_0x5cab58]);}));}BPromise[_0x60c6('0x18')](_0x256f5d)['then'](function(_0x116fdf){var _0x2f89e8=_[_0x60c6('0x19')](_0x116fdf);logger[_0x60c6('0xd')](_0x60c6('0x1a'),_0x9aea1a,_0x331a52[_0x60c6('0x1b')]('\x20|\x20'),_0x2f89e8);_0x396e7e[_0x60c6('0x1c')](_0x2f89e8);})[_0x60c6('0xa')](function(_0x1281db){logger[_0x60c6('0x9')](_0x60c6('0x1a'),_0x9aea1a,_0x331a52[_0x60c6('0x1b')](_0x60c6('0x1d')),_0x1281db[_0x60c6('0x1e')]);_0x396e7e[_0x60c6('0xf')]();});};}; \ No newline at end of file +var _0x675d=['iftime\x20%s','indexOf','true','catch','[%s][INTERVAL]\x20%s','all','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','stack','util','bluebird','jayson/promise','lodash','../../../config/logger','routing','client','http','request','then','error','message','result','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','push','Command'];(function(_0x5eee9a,_0x39350c){var _0x10866d=function(_0x3fe86e){while(--_0x3fe86e){_0x5eee9a['push'](_0x5eee9a['shift']());}};_0x10866d(++_0x39350c);}(_0x675d,0x103));var _0xd675=function(_0x33a6f7,_0x34720c){_0x33a6f7=_0x33a6f7-0x0;var _0x4b0f0b=_0x675d[_0x33a6f7];return _0x4b0f0b;};'use strict';var util=require(_0xd675('0x0'));var BPromise=require(_0xd675('0x1'));var jayson=require(_0xd675('0x2'));var _=require(_0xd675('0x3'));var logger=require(_0xd675('0x4'))(_0xd675('0x5'));var client=jayson[_0xd675('0x6')][_0xd675('0x7')]({'port':0x232a});function request(_0x312bbd,_0x1721ae){return new BPromise(function(_0x3ebc8b,_0x9eab3e){return client[_0xd675('0x8')](_0x312bbd,_0x1721ae)[_0xd675('0x9')](function(_0x3f655a){if(_0x3f655a[_0xd675('0xa')]){return _0x9eab3e(_0x3f655a[_0xd675('0xa')][_0xd675('0xb')]);}else{return _0x3ebc8b(_0x3f655a[_0xd675('0xc')]);}})['catch'](function(_0x44ef37){return _0x9eab3e(_0x44ef37);});});}exports[_0xd675('0xd')]=function(_0x106194,_0x201322,_0xb4ff46){return function(_0x12a5c3){if(_0xb4ff46['rules']&&!_0xb4ff46[_0xd675('0xe')][_0x106194]){logger[_0xd675('0xf')](_0xd675('0x10'),_0x106194);return _0x12a5c3[_0xd675('0x11')]();}var _0x5886f7=[];for(var _0x25f89f=0x0;_0x25f89f<_0x201322['length'];_0x25f89f+=0x1){_0x5886f7[_0xd675('0x12')](request(_0xd675('0x13'),{'command':util['format'](_0xd675('0x14'),_0x201322[_0x25f89f])})[_0xd675('0x9')](function(_0x2b8b24){return _0x2b8b24&&_0x2b8b24[_0xd675('0xb')]&&_0x2b8b24[_0xd675('0xb')][_0xd675('0x15')](_0xd675('0x16'))>=0x0?!![]:![];})[_0xd675('0x17')](function(){logger[_0xd675('0xa')](_0xd675('0x18'),_0x106194,_0x201322[_0x25f89f]);}));}BPromise[_0xd675('0x19')](_0x5886f7)[_0xd675('0x9')](function(_0x8a8792){var _0x5df678=_['some'](_0x8a8792);logger['info'](_0xd675('0x1a'),_0x106194,_0x201322[_0xd675('0x1b')](_0xd675('0x1c')),_0x5df678);_0x12a5c3[_0xd675('0x1d')](_0x5df678);})['catch'](function(_0x28c22a){logger[_0xd675('0xa')](_0xd675('0x1a'),_0x106194,_0x201322[_0xd675('0x1b')](_0xd675('0x1c')),_0x28c22a[_0xd675('0x1e')]);_0x12a5c3[_0xd675('0x11')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 62e3dfd..7a1a99f 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 _0x57f8=['agentringnoanswer','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','now','timeout','reason','holdtime','ringtime','talktime','push','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][agents][queuecallerabandon]','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','transfer','transfertype','blind','transferexten','extension','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','isNil','secondtransfereruniqueid','transfereeuniqueid','agententerreason','clone','calleridnum','calleridname','secondtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfererexten','transfertargetuniqueid','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','splice','agent','[%s][agents][hangup]','util','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','interface','connectedlinenum','lastevent','then','type','agentacw','agentcomplete','acwtime','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','debug','agentcalledAt','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error'];(function(_0x4c7fb5,_0x2548ef){var _0x2e10ac=function(_0xf7e27c){while(--_0xf7e27c){_0x4c7fb5['push'](_0x4c7fb5['shift']());}};_0x2e10ac(++_0x2548ef);}(_0x57f8,0x198));var _0x857f=function(_0x52b828,_0x359d0f){_0x52b828=_0x52b828-0x0;var _0x2721d8=_0x57f8[_0x52b828];return _0x2721d8;};'use strict';var _=require('lodash');var util=require(_0x857f('0x0'));var utils=require(_0x857f('0x1'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x1e6e52,_0x3c0125){utils[_0x857f('0x2')](util[_0x857f('0x3')](_0x857f('0x4'),_0x1e6e52[_0x857f('0x5')],_0x1e6e52[_0x857f('0x6')],_0x1e6e52[_0x857f('0x7')],_0x1e6e52[_0x857f('0x8')],_0x1e6e52[_0x857f('0x9')],_0x1e6e52['calleridnum'],_0x1e6e52[_0x857f('0xa')],_0x1e6e52[_0x857f('0xb')]));if(_0x1e6e52[_0x857f('0x7')]){utils['getVoiceQueueByName'](_0x1e6e52[_0x857f('0x7')])[_0x857f('0xc')](function(_0x960b76){if(_0x960b76){_0x1e6e52['type']=_0x960b76[_0x857f('0xd')];_0x1e6e52[_0x857f('0xe')]=_0x1e6e52[_0x857f('0xf')]?_0x960b76['acw']:![];_0x1e6e52[_0x857f('0x10')]=_0x1e6e52[_0x857f('0xe')]?_0x960b76[_0x857f('0x11')]:0x0;}utils[_0x857f('0x12')](_0x857f('0x13'),_0x1e6e52);});}else{utils[_0x857f('0x12')](_0x857f('0x13'),_0x1e6e52);}if(_0x3c0125){delete transfers[_0x1e6e52['uniqueid']];}else{delete agents[_0x1e6e52[_0x857f('0x14')]];}}exports[_0x857f('0x15')]=function(_0x373333){try{utils[_0x857f('0x16')](util[_0x857f('0x3')]('[%s][agents][agentcalled]',_0x373333['uniqueid']),_0x373333);agents[_0x373333[_0x857f('0x14')]]=_0x373333;agents[_0x373333['destuniqueid']][_0x857f('0x17')]=utils['now']();agents[_0x373333[_0x857f('0x14')]][_0x857f('0xb')]='called';agents[_0x373333[_0x857f('0x14')]][_0x857f('0xa')]=null;agents[_0x373333[_0x857f('0x14')]][_0x857f('0x18')]=null;utils[_0x857f('0x2')](util[_0x857f('0x3')](_0x857f('0x19'),_0x373333[_0x857f('0x5')],agents[_0x373333[_0x857f('0x14')]][_0x857f('0x8')],_0x373333[_0x857f('0x14')]));}catch(_0x59e0e1){utils[_0x857f('0x1a')](util[_0x857f('0x3')]('[%s][agents][agentcalled]',_0x373333[_0x857f('0x5')]),_0x59e0e1);}};exports[_0x857f('0x1b')]=function(_0x377587){try{if(!_['isNil'](agents[_0x377587['destuniqueid']])){utils[_0x857f('0x16')](util[_0x857f('0x3')](_0x857f('0x1c'),_0x377587['uniqueid']),_0x377587);utils[_0x857f('0x2')](util[_0x857f('0x3')](_0x857f('0x1d'),_0x377587['uniqueid'],agents[_0x377587[_0x857f('0x14')]][_0x857f('0x8')],_0x377587['destuniqueid']));agents[_0x377587[_0x857f('0x14')]][_0x857f('0x1b')]=!![];agents[_0x377587[_0x857f('0x14')]][_0x857f('0x1e')]=utils[_0x857f('0x1f')]();agents[_0x377587[_0x857f('0x14')]][_0x857f('0xb')]=_0x857f('0x20');agents[_0x377587[_0x857f('0x14')]][_0x857f('0x21')]=_0x857f('0x20');agents[_0x377587[_0x857f('0x14')]][_0x857f('0x22')]=_0x377587[_0x857f('0x23')]?parseInt(_0x377587['ringtime'])/0x3e8:0x0;agents[_0x377587[_0x857f('0x14')]][_0x857f('0x24')]=0x0;unanswered[_0x857f('0x25')](_0x377587[_0x857f('0x14')]);}}catch(_0x58c2de){utils[_0x857f('0x1a')](util['format'](_0x857f('0x1c'),_0x377587[_0x857f('0x5')]),_0x58c2de);}};exports[_0x857f('0x26')]=function(_0x2ab814){try{_[_0x857f('0x27')](agents,function(_0x464e8f,_0x1c4fff){if(_0x464e8f[_0x857f('0x5')]==_0x2ab814[_0x857f('0x5')]&&!_[_0x857f('0x28')](unanswered,_0x464e8f[_0x857f('0x14')])){utils[_0x857f('0x16')](util[_0x857f('0x3')]('[%s][agents][queuecallerabandon]',_0x2ab814[_0x857f('0x5')]),_0x2ab814);utils[_0x857f('0x2')](util['format'](_0x857f('0x29'),_0x2ab814[_0x857f('0x5')],_0x464e8f['membername'],_0x464e8f[_0x857f('0x14')]));_0x464e8f[_0x857f('0x1b')]=!![];_0x464e8f['agentringnoanswerAt']=utils[_0x857f('0x1f')]();_0x464e8f[_0x857f('0xb')]=_0x857f('0x2a');_0x464e8f[_0x857f('0x21')]='abandoned';_0x464e8f['holdtime']=_0x2ab814[_0x857f('0x22')];_0x464e8f[_0x857f('0x24')]=0x0;writeDB(_0x464e8f);}});}catch(_0x4c88fa){utils[_0x857f('0x1a')](util['format'](_0x857f('0x2b'),_0x2ab814[_0x857f('0x5')]),_0x4c88fa);}};exports[_0x857f('0x2c')]=function(_0x438ff1){try{if(agents[_0x438ff1[_0x857f('0x14')]]){utils['debug'](util['format'](_0x857f('0x2d'),_0x438ff1['uniqueid']),_0x438ff1);utils[_0x857f('0x2')](util[_0x857f('0x3')](_0x857f('0x2e'),_0x438ff1['uniqueid'],agents[_0x438ff1[_0x857f('0x14')]][_0x857f('0x8')],_0x438ff1[_0x857f('0x14')]));agents[_0x438ff1[_0x857f('0x14')]][_0x857f('0x2f')]=utils[_0x857f('0x1f')]();agents[_0x438ff1[_0x857f('0x14')]]['connectedlinenum']=_0x438ff1[_0x857f('0xa')];agents[_0x438ff1[_0x857f('0x14')]][_0x857f('0x18')]=_0x438ff1[_0x857f('0x18')];agents[_0x438ff1[_0x857f('0x14')]][_0x857f('0x22')]=_0x438ff1[_0x857f('0x23')];agents[_0x438ff1['destuniqueid']][_0x857f('0xb')]=_0x857f('0x30');_[_0x857f('0x27')](agents,function(_0xc2ac41,_0x196c95){if(_0xc2ac41[_0x857f('0x14')]!=_0x438ff1['destuniqueid']&&_0xc2ac41[_0x857f('0x5')]==_0x438ff1[_0x857f('0x5')]){_0xc2ac41[_0x857f('0x24')]=0x0;_0xc2ac41[_0x857f('0x22')]=_0x438ff1[_0x857f('0x23')];_0xc2ac41[_0x857f('0x1b')]=!![];_0xc2ac41[_0x857f('0x1e')]=utils[_0x857f('0x1f')]();_0xc2ac41['lastevent']=_0x857f('0x31');_0xc2ac41[_0x857f('0x21')]=_0x857f('0x31');_0xc2ac41[_0x857f('0x32')]=_0x438ff1[_0x857f('0x14')];_0xc2ac41[_0x857f('0x33')]=_0x438ff1[_0x857f('0x8')];writeDB(_0xc2ac41);}});}}catch(_0x42d922){utils[_0x857f('0x1a')](util[_0x857f('0x3')](_0x857f('0x2d'),_0x438ff1[_0x857f('0x5')]),_0x42d922);}};exports[_0x857f('0xf')]=function(_0x376f71){try{if(!_['isNil'](agents[_0x376f71[_0x857f('0x14')]])){utils['debug'](util[_0x857f('0x3')](_0x857f('0x34'),_0x376f71[_0x857f('0x5')]),_0x376f71);utils[_0x857f('0x2')](util[_0x857f('0x3')](_0x857f('0x35'),_0x376f71[_0x857f('0x5')],agents[_0x376f71[_0x857f('0x14')]][_0x857f('0x8')],_0x376f71[_0x857f('0x14')]));agents[_0x376f71[_0x857f('0x14')]]['agentcomplete']=!![];agents[_0x376f71['destuniqueid']][_0x857f('0x36')]=utils['now']();agents[_0x376f71[_0x857f('0x14')]]['talktime']=utils[_0x857f('0x37')](agents[_0x376f71[_0x857f('0x14')]][_0x857f('0x36')],agents[_0x376f71[_0x857f('0x14')]][_0x857f('0x2f')]);agents[_0x376f71[_0x857f('0x14')]][_0x857f('0x21')]=_0x376f71[_0x857f('0x21')];agents[_0x376f71['destuniqueid']][_0x857f('0xb')]=_0x857f('0x38');writeDB(agents[_0x376f71[_0x857f('0x14')]]);}}catch(_0x19c967){utils['error'](util[_0x857f('0x3')](_0x857f('0x34'),_0x376f71[_0x857f('0x5')]),_0x19c967);}};exports[_0x857f('0x39')]=function(_0x67563){try{if(!_['isNil'](agents[_0x67563[_0x857f('0x3a')]])){utils[_0x857f('0x16')](util['format'](_0x857f('0x3b'),_0x67563[_0x857f('0x5')]),_0x67563);utils['info'](util[_0x857f('0x3')]('[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s',_0x67563[_0x857f('0x5')],agents[_0x67563[_0x857f('0x3a')]][_0x857f('0x8')],agents[_0x67563[_0x857f('0x3a')]][_0x857f('0x5')]));agents[_0x67563[_0x857f('0x3a')]][_0x857f('0x3c')]=!![];agents[_0x67563[_0x857f('0x3a')]][_0x857f('0x3d')]=_0x857f('0x3e');agents[_0x67563['transfereruniqueid']][_0x857f('0x3f')]=_0x67563[_0x857f('0x40')];agents[_0x67563[_0x857f('0x3a')]][_0x857f('0x41')]=agents[_0x67563[_0x857f('0x3a')]][_0x857f('0x5')];}}catch(_0x12712a){utils['error'](util[_0x857f('0x3')](_0x857f('0x3b'),_0x67563[_0x857f('0x5')]),_0x12712a);}};exports[_0x857f('0x42')]=function(_0x22eab9){try{utils[_0x857f('0x16')](util['format'](_0x857f('0x43'),_0x22eab9[_0x857f('0x44')]),_0x22eab9);if(_0x22eab9[_0x857f('0x44')]==_0x22eab9[_0x857f('0x45')]){if(!_[_0x857f('0x46')](agents[_0x22eab9[_0x857f('0x47')]])){utils[_0x857f('0x2')](util[_0x857f('0x3')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x22eab9['origtransfereruniqueid'],agents[_0x22eab9[_0x857f('0x47')]][_0x857f('0x8')]));agents[_0x22eab9[_0x857f('0x47')]][_0x857f('0x3c')]=!![];agents[_0x22eab9[_0x857f('0x47')]][_0x857f('0x3d')]='ATTENDED';agents[_0x22eab9[_0x857f('0x47')]][_0x857f('0x3f')]=_0x22eab9['origtransfererexten'];agents[_0x22eab9[_0x857f('0x47')]]['transferuniqueid']=_0x22eab9[_0x857f('0x44')];}if(_0x22eab9[_0x857f('0x48')]&&agents[_0x22eab9['transfereeuniqueid']]){agents[_0x22eab9[_0x857f('0x48')]][_0x857f('0x49')]=0x1;transfers[_0x22eab9[_0x857f('0x48')]]=_[_0x857f('0x4a')](agents[_0x22eab9[_0x857f('0x48')]]);transfers[_0x22eab9[_0x857f('0x48')]][_0x857f('0x4b')]=agents[_0x22eab9[_0x857f('0x47')]]['calleridnum'];transfers[_0x22eab9[_0x857f('0x48')]][_0x857f('0x4c')]=agents[_0x22eab9[_0x857f('0x47')]][_0x857f('0x4c')];transfers[_0x22eab9[_0x857f('0x48')]][_0x857f('0x17')]=utils[_0x857f('0x1f')]();transfers[_0x22eab9[_0x857f('0x48')]][_0x857f('0x2f')]=utils[_0x857f('0x1f')]();transfers[_0x22eab9[_0x857f('0x48')]]['holdtime']=0x0;transfers[_0x22eab9[_0x857f('0x48')]][_0x857f('0x49')]=0x2;}}else if(_0x22eab9[_0x857f('0x47')]==_0x22eab9[_0x857f('0x4d')]){if(!_['isNil'](agents[_0x22eab9[_0x857f('0x44')]])){utils['info'](util[_0x857f('0x3')](_0x857f('0x4e'),_0x22eab9[_0x857f('0x44')],agents[_0x22eab9[_0x857f('0x44')]]['membername']));agents[_0x22eab9['origtransfereruniqueid']][_0x857f('0x3c')]=!![];agents[_0x22eab9[_0x857f('0x44')]][_0x857f('0x3d')]='ATTENDED';agents[_0x22eab9[_0x857f('0x44')]]['transferexten']=_0x22eab9[_0x857f('0x4f')];agents[_0x22eab9[_0x857f('0x44')]][_0x857f('0x41')]=_0x22eab9['secondtransfereruniqueid'];}if(_0x22eab9['transfertargetuniqueid']&&agents[_0x22eab9[_0x857f('0x50')]]){agents[_0x22eab9[_0x857f('0x50')]][_0x857f('0x49')]=0x1;transfers[_0x22eab9[_0x857f('0x50')]]=_[_0x857f('0x4a')](agents[_0x22eab9[_0x857f('0x50')]]);transfers[_0x22eab9[_0x857f('0x50')]][_0x857f('0x4b')]=agents[_0x22eab9['origtransfereruniqueid']]['calleridnum'];transfers[_0x22eab9[_0x857f('0x50')]][_0x857f('0x4c')]=agents[_0x22eab9[_0x857f('0x44')]][_0x857f('0x4c')];transfers[_0x22eab9[_0x857f('0x50')]][_0x857f('0x17')]=utils['now']();transfers[_0x22eab9[_0x857f('0x50')]][_0x857f('0x2f')]=utils[_0x857f('0x1f')]();transfers[_0x22eab9[_0x857f('0x50')]][_0x857f('0x22')]=0x0;transfers[_0x22eab9[_0x857f('0x50')]][_0x857f('0x49')]=0x2;}}}catch(_0x39ad7c){utils[_0x857f('0x1a')](util[_0x857f('0x3')]('[%s][agents][attendedtransfer]',_0x22eab9[_0x857f('0x44')]),_0x39ad7c);}};exports['hangup']=function(_0x5ec513){try{utils[_0x857f('0x16')](util['format']('[%s][agents][hangup]',_0x5ec513[_0x857f('0x5')]),_0x5ec513);if(agents[_0x5ec513['uniqueid']]&&agents[_0x5ec513[_0x857f('0x5')]]['reason']===_0x857f('0x20')){if(_0x5ec513[_0x857f('0x51')]==='21'){agents[_0x5ec513[_0x857f('0x5')]][_0x857f('0x21')]='rejected';agents[_0x5ec513[_0x857f('0x5')]][_0x857f('0xb')]=_0x857f('0x52');}utils[_0x857f('0x2')](util[_0x857f('0x3')](_0x857f('0x53'),_0x5ec513[_0x857f('0x5')],agents[_0x5ec513['uniqueid']]['membername'],agents[_0x5ec513[_0x857f('0x5')]][_0x857f('0x21')],agents[_0x5ec513[_0x857f('0x5')]][_0x857f('0xb')]));writeDB(agents[_0x5ec513[_0x857f('0x5')]]);var _0x2d7d33=unanswered['indexOf'](_0x5ec513[_0x857f('0x5')]);if(_0x2d7d33>-0x1){unanswered[_0x857f('0x54')](_0x2d7d33,0x1);}}if(transfers[_0x5ec513[_0x857f('0x5')]]){transfers[_0x5ec513['uniqueid']]['agentcomplete']=!![];transfers[_0x5ec513[_0x857f('0x5')]]['agentcompleteAt']=utils['now']();transfers[_0x5ec513[_0x857f('0x5')]][_0x857f('0x24')]=utils['diffTime'](transfers[_0x5ec513[_0x857f('0x5')]][_0x857f('0x36')],transfers[_0x5ec513['uniqueid']][_0x857f('0x2f')]);transfers[_0x5ec513[_0x857f('0x5')]][_0x857f('0x21')]=_0x857f('0x55');transfers[_0x5ec513[_0x857f('0x5')]][_0x857f('0xb')]=_0x857f('0x38');utils[_0x857f('0x2')](util[_0x857f('0x3')](_0x857f('0x53'),_0x5ec513[_0x857f('0x5')],transfers[_0x5ec513[_0x857f('0x5')]]['membername'],transfers[_0x5ec513['uniqueid']]['reason'],transfers[_0x5ec513[_0x857f('0x5')]][_0x857f('0xb')]));writeDB(transfers[_0x5ec513[_0x857f('0x5')]],!![]);}if(agents[_0x5ec513[_0x857f('0x5')]]&&agents[_0x5ec513[_0x857f('0x5')]][_0x857f('0x2f')]){agents[_0x5ec513[_0x857f('0x5')]]['agentcomplete']=!![];agents[_0x5ec513[_0x857f('0x5')]]['agentcompleteAt']=utils[_0x857f('0x1f')]();agents[_0x5ec513['uniqueid']]['talktime']=utils[_0x857f('0x37')](agents[_0x5ec513['uniqueid']][_0x857f('0x36')],agents[_0x5ec513[_0x857f('0x5')]][_0x857f('0x2f')]);agents[_0x5ec513['uniqueid']][_0x857f('0x21')]=agents[_0x5ec513[_0x857f('0x5')]][_0x857f('0x3c')]?_0x857f('0x3c'):_0x857f('0x55');agents[_0x5ec513[_0x857f('0x5')]][_0x857f('0xb')]=_0x857f('0x38');utils[_0x857f('0x2')](util['format'](_0x857f('0x53'),_0x5ec513[_0x857f('0x5')],agents[_0x5ec513[_0x857f('0x5')]][_0x857f('0x8')],agents[_0x5ec513['uniqueid']][_0x857f('0x21')],agents[_0x5ec513['uniqueid']][_0x857f('0xb')]));writeDB(agents[_0x5ec513[_0x857f('0x5')]]);}}catch(_0x15df2f){utils[_0x857f('0x1a')](util['format'](_0x857f('0x56'),_0x5ec513['uniqueid']),_0x15df2f);}}; \ No newline at end of file +var _0x373d=['transfereruniqueid','transfer','blind','extension','transferuniqueid','[%s][agents][blindtransfer]','attendedtransfer','origtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','origtransfereruniqueid','secondtransfereruniqueid','transfertype','ATTENDED','transferexten','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','[%s][agents][attendedtransfer]','hangup','[%s][agents][hangup]','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agent','complete','lodash','./utils','info','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','interface','calleridnum','connectedlinenum','lastevent','getVoiceQueueByName','type','agentcomplete','acw','acwTimeout','request','CreateVoiceAgentReport','agentcalled','format','[%s][agents][agentcalled]','destuniqueid','agentcalledAt','now','called','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','membername','error','agentringnoanswer','debug','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','reason','holdtime','ringtime','talktime','push','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','agentconnect','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','connect','answered_elsewhere','answeredelsewheremembername','isNil','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','blindtransfer','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s'];(function(_0x227b64,_0x1c6f72){var _0xc84cb5=function(_0x12e690){while(--_0x12e690){_0x227b64['push'](_0x227b64['shift']());}};_0xc84cb5(++_0x1c6f72);}(_0x373d,0x1e2));var _0xd373=function(_0x3438e0,_0x140a7f){_0x3438e0=_0x3438e0-0x0;var _0x45cbba=_0x373d[_0x3438e0];return _0x45cbba;};'use strict';var _=require(_0xd373('0x0'));var util=require('util');var utils=require(_0xd373('0x1'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x53f3b7,_0x30e9ce){utils[_0xd373('0x2')](util['format'](_0xd373('0x3'),_0x53f3b7[_0xd373('0x4')],_0x53f3b7[_0xd373('0x5')],_0x53f3b7['queue'],_0x53f3b7['membername'],_0x53f3b7[_0xd373('0x6')],_0x53f3b7[_0xd373('0x7')],_0x53f3b7[_0xd373('0x8')],_0x53f3b7[_0xd373('0x9')]));if(_0x53f3b7['queue']){utils[_0xd373('0xa')](_0x53f3b7['queue'])['then'](function(_0x59ed5e){if(_0x59ed5e){_0x53f3b7[_0xd373('0xb')]=_0x59ed5e[_0xd373('0xb')];_0x53f3b7['agentacw']=_0x53f3b7[_0xd373('0xc')]?_0x59ed5e[_0xd373('0xd')]:![];_0x53f3b7['acwtime']=_0x53f3b7['agentacw']?_0x59ed5e[_0xd373('0xe')]:0x0;}utils[_0xd373('0xf')](_0xd373('0x10'),_0x53f3b7);});}else{utils[_0xd373('0xf')]('CreateVoiceAgentReport',_0x53f3b7);}if(_0x30e9ce){delete transfers[_0x53f3b7['uniqueid']];}else{delete agents[_0x53f3b7['destuniqueid']];}}exports[_0xd373('0x11')]=function(_0x14a0ee){try{utils['debug'](util[_0xd373('0x12')](_0xd373('0x13'),_0x14a0ee[_0xd373('0x4')]),_0x14a0ee);agents[_0x14a0ee[_0xd373('0x14')]]=_0x14a0ee;agents[_0x14a0ee[_0xd373('0x14')]][_0xd373('0x15')]=utils[_0xd373('0x16')]();agents[_0x14a0ee[_0xd373('0x14')]][_0xd373('0x9')]=_0xd373('0x17');agents[_0x14a0ee[_0xd373('0x14')]][_0xd373('0x8')]=null;agents[_0x14a0ee[_0xd373('0x14')]]['connectedlinename']=null;utils[_0xd373('0x2')](util['format'](_0xd373('0x18'),_0x14a0ee[_0xd373('0x4')],agents[_0x14a0ee['destuniqueid']][_0xd373('0x19')],_0x14a0ee['destuniqueid']));}catch(_0x4d7d72){utils[_0xd373('0x1a')](util[_0xd373('0x12')](_0xd373('0x13'),_0x14a0ee[_0xd373('0x4')]),_0x4d7d72);}};exports[_0xd373('0x1b')]=function(_0x181eb2){try{if(!_['isNil'](agents[_0x181eb2[_0xd373('0x14')]])){utils[_0xd373('0x1c')](util[_0xd373('0x12')](_0xd373('0x1d'),_0x181eb2[_0xd373('0x4')]),_0x181eb2);utils[_0xd373('0x2')](util['format'](_0xd373('0x1e'),_0x181eb2[_0xd373('0x4')],agents[_0x181eb2[_0xd373('0x14')]][_0xd373('0x19')],_0x181eb2[_0xd373('0x14')]));agents[_0x181eb2[_0xd373('0x14')]][_0xd373('0x1b')]=!![];agents[_0x181eb2[_0xd373('0x14')]][_0xd373('0x1f')]=utils[_0xd373('0x16')]();agents[_0x181eb2[_0xd373('0x14')]][_0xd373('0x9')]=_0xd373('0x20');agents[_0x181eb2[_0xd373('0x14')]][_0xd373('0x21')]=_0xd373('0x20');agents[_0x181eb2[_0xd373('0x14')]][_0xd373('0x22')]=_0x181eb2[_0xd373('0x23')]?parseInt(_0x181eb2[_0xd373('0x23')])/0x3e8:0x0;agents[_0x181eb2[_0xd373('0x14')]][_0xd373('0x24')]=0x0;unanswered[_0xd373('0x25')](_0x181eb2[_0xd373('0x14')]);}}catch(_0xf85ca8){utils[_0xd373('0x1a')](util[_0xd373('0x12')](_0xd373('0x1d'),_0x181eb2[_0xd373('0x4')]),_0xf85ca8);}};exports[_0xd373('0x26')]=function(_0x5287e7){try{_[_0xd373('0x27')](agents,function(_0x490842,_0x498aaa){if(_0x490842[_0xd373('0x4')]==_0x5287e7[_0xd373('0x4')]&&!_[_0xd373('0x28')](unanswered,_0x490842[_0xd373('0x14')])){utils[_0xd373('0x1c')](util['format'](_0xd373('0x29'),_0x5287e7[_0xd373('0x4')]),_0x5287e7);utils['info'](util[_0xd373('0x12')](_0xd373('0x2a'),_0x5287e7[_0xd373('0x4')],_0x490842[_0xd373('0x19')],_0x490842[_0xd373('0x14')]));_0x490842[_0xd373('0x1b')]=!![];_0x490842[_0xd373('0x1f')]=utils[_0xd373('0x16')]();_0x490842[_0xd373('0x9')]='abandoned';_0x490842[_0xd373('0x21')]=_0xd373('0x2b');_0x490842[_0xd373('0x22')]=_0x5287e7[_0xd373('0x22')];_0x490842[_0xd373('0x24')]=0x0;writeDB(_0x490842);}});}catch(_0x28da03){utils[_0xd373('0x1a')](util[_0xd373('0x12')](_0xd373('0x29'),_0x5287e7[_0xd373('0x4')]),_0x28da03);}};exports[_0xd373('0x2c')]=function(_0x13a1cd){try{if(agents[_0x13a1cd[_0xd373('0x14')]]){utils[_0xd373('0x1c')](util[_0xd373('0x12')]('[%s][agents][agentconnect]',_0x13a1cd[_0xd373('0x4')]),_0x13a1cd);utils[_0xd373('0x2')](util[_0xd373('0x12')](_0xd373('0x2d'),_0x13a1cd['uniqueid'],agents[_0x13a1cd[_0xd373('0x14')]][_0xd373('0x19')],_0x13a1cd[_0xd373('0x14')]));agents[_0x13a1cd[_0xd373('0x14')]][_0xd373('0x2e')]=utils[_0xd373('0x16')]();agents[_0x13a1cd['destuniqueid']]['connectedlinenum']=_0x13a1cd[_0xd373('0x8')];agents[_0x13a1cd['destuniqueid']][_0xd373('0x2f')]=_0x13a1cd[_0xd373('0x2f')];agents[_0x13a1cd[_0xd373('0x14')]]['holdtime']=_0x13a1cd[_0xd373('0x23')];agents[_0x13a1cd[_0xd373('0x14')]][_0xd373('0x9')]=_0xd373('0x30');_['forIn'](agents,function(_0x513038,_0x5de74e){if(_0x513038[_0xd373('0x14')]!=_0x13a1cd['destuniqueid']&&_0x513038[_0xd373('0x4')]==_0x13a1cd[_0xd373('0x4')]){_0x513038['talktime']=0x0;_0x513038['holdtime']=_0x13a1cd['ringtime'];_0x513038[_0xd373('0x1b')]=!![];_0x513038[_0xd373('0x1f')]=utils[_0xd373('0x16')]();_0x513038['lastevent']='answered_elsewhere';_0x513038[_0xd373('0x21')]=_0xd373('0x31');_0x513038['answeredelsewheredestinationuniqueid']=_0x13a1cd[_0xd373('0x14')];_0x513038[_0xd373('0x32')]=_0x13a1cd[_0xd373('0x19')];writeDB(_0x513038);}});}}catch(_0x9989e4){utils[_0xd373('0x1a')](util['format']('[%s][agents][agentconnect]',_0x13a1cd[_0xd373('0x4')]),_0x9989e4);}};exports[_0xd373('0xc')]=function(_0x30b423){try{if(!_[_0xd373('0x33')](agents[_0x30b423['destuniqueid']])){utils[_0xd373('0x1c')](util['format'](_0xd373('0x34'),_0x30b423[_0xd373('0x4')]),_0x30b423);utils[_0xd373('0x2')](util[_0xd373('0x12')](_0xd373('0x35'),_0x30b423['uniqueid'],agents[_0x30b423[_0xd373('0x14')]][_0xd373('0x19')],_0x30b423['destuniqueid']));agents[_0x30b423[_0xd373('0x14')]][_0xd373('0xc')]=!![];agents[_0x30b423[_0xd373('0x14')]][_0xd373('0x36')]=utils[_0xd373('0x16')]();agents[_0x30b423[_0xd373('0x14')]][_0xd373('0x24')]=utils[_0xd373('0x37')](agents[_0x30b423[_0xd373('0x14')]][_0xd373('0x36')],agents[_0x30b423['destuniqueid']]['agentconnectAt']);agents[_0x30b423[_0xd373('0x14')]]['reason']=_0x30b423[_0xd373('0x21')];agents[_0x30b423['destuniqueid']]['lastevent']='complete';writeDB(agents[_0x30b423[_0xd373('0x14')]]);}}catch(_0x39d995){utils[_0xd373('0x1a')](util[_0xd373('0x12')](_0xd373('0x34'),_0x30b423[_0xd373('0x4')]),_0x39d995);}};exports[_0xd373('0x38')]=function(_0x4d1088){try{if(!_[_0xd373('0x33')](agents[_0x4d1088['transfereruniqueid']])){utils[_0xd373('0x1c')](util[_0xd373('0x12')]('[%s][agents][blindtransfer]',_0x4d1088[_0xd373('0x4')]),_0x4d1088);utils['info'](util[_0xd373('0x12')](_0xd373('0x39'),_0x4d1088[_0xd373('0x4')],agents[_0x4d1088[_0xd373('0x3a')]][_0xd373('0x19')],agents[_0x4d1088['transfereruniqueid']]['uniqueid']));agents[_0x4d1088['transfereruniqueid']][_0xd373('0x3b')]=!![];agents[_0x4d1088[_0xd373('0x3a')]]['transfertype']=_0xd373('0x3c');agents[_0x4d1088[_0xd373('0x3a')]]['transferexten']=_0x4d1088[_0xd373('0x3d')];agents[_0x4d1088[_0xd373('0x3a')]][_0xd373('0x3e')]=agents[_0x4d1088[_0xd373('0x3a')]][_0xd373('0x4')];}}catch(_0xa2758){utils[_0xd373('0x1a')](util[_0xd373('0x12')](_0xd373('0x3f'),_0x4d1088[_0xd373('0x4')]),_0xa2758);}};exports[_0xd373('0x40')]=function(_0x5b88ea){try{utils['debug'](util['format']('[%s][agents][attendedtransfer]',_0x5b88ea['origtransfereruniqueid']),_0x5b88ea);if(_0x5b88ea['origtransfereruniqueid']==_0x5b88ea[_0xd373('0x41')]){if(!_[_0xd373('0x33')](agents[_0x5b88ea['secondtransfereruniqueid']])){utils['info'](util['format'](_0xd373('0x42'),_0x5b88ea[_0xd373('0x43')],agents[_0x5b88ea['secondtransfereruniqueid']]['membername']));agents[_0x5b88ea[_0xd373('0x44')]][_0xd373('0x3b')]=!![];agents[_0x5b88ea[_0xd373('0x44')]][_0xd373('0x45')]=_0xd373('0x46');agents[_0x5b88ea['secondtransfereruniqueid']][_0xd373('0x47')]=_0x5b88ea[_0xd373('0x48')];agents[_0x5b88ea[_0xd373('0x44')]][_0xd373('0x3e')]=_0x5b88ea[_0xd373('0x43')];}if(_0x5b88ea[_0xd373('0x49')]&&agents[_0x5b88ea[_0xd373('0x49')]]){agents[_0x5b88ea[_0xd373('0x49')]][_0xd373('0x4a')]=0x1;transfers[_0x5b88ea[_0xd373('0x49')]]=_[_0xd373('0x4b')](agents[_0x5b88ea[_0xd373('0x49')]]);transfers[_0x5b88ea[_0xd373('0x49')]][_0xd373('0x7')]=agents[_0x5b88ea[_0xd373('0x44')]]['calleridnum'];transfers[_0x5b88ea[_0xd373('0x49')]][_0xd373('0x4c')]=agents[_0x5b88ea[_0xd373('0x44')]]['calleridname'];transfers[_0x5b88ea[_0xd373('0x49')]]['agentcalledAt']=utils[_0xd373('0x16')]();transfers[_0x5b88ea['transfereeuniqueid']][_0xd373('0x2e')]=utils[_0xd373('0x16')]();transfers[_0x5b88ea[_0xd373('0x49')]][_0xd373('0x22')]=0x0;transfers[_0x5b88ea[_0xd373('0x49')]][_0xd373('0x4a')]=0x2;}}else if(_0x5b88ea[_0xd373('0x44')]==_0x5b88ea[_0xd373('0x4d')]){if(!_[_0xd373('0x33')](agents[_0x5b88ea[_0xd373('0x43')]])){utils[_0xd373('0x2')](util[_0xd373('0x12')](_0xd373('0x42'),_0x5b88ea[_0xd373('0x43')],agents[_0x5b88ea[_0xd373('0x43')]][_0xd373('0x19')]));agents[_0x5b88ea[_0xd373('0x43')]][_0xd373('0x3b')]=!![];agents[_0x5b88ea[_0xd373('0x43')]][_0xd373('0x45')]=_0xd373('0x46');agents[_0x5b88ea[_0xd373('0x43')]][_0xd373('0x47')]=_0x5b88ea[_0xd373('0x4e')];agents[_0x5b88ea[_0xd373('0x43')]][_0xd373('0x3e')]=_0x5b88ea['secondtransfereruniqueid'];}if(_0x5b88ea[_0xd373('0x4f')]&&agents[_0x5b88ea[_0xd373('0x4f')]]){agents[_0x5b88ea[_0xd373('0x4f')]]['agententerreason']=0x1;transfers[_0x5b88ea[_0xd373('0x4f')]]=_[_0xd373('0x4b')](agents[_0x5b88ea[_0xd373('0x4f')]]);transfers[_0x5b88ea[_0xd373('0x4f')]][_0xd373('0x7')]=agents[_0x5b88ea[_0xd373('0x43')]][_0xd373('0x7')];transfers[_0x5b88ea['transfertargetuniqueid']][_0xd373('0x4c')]=agents[_0x5b88ea[_0xd373('0x43')]][_0xd373('0x4c')];transfers[_0x5b88ea[_0xd373('0x4f')]][_0xd373('0x15')]=utils[_0xd373('0x16')]();transfers[_0x5b88ea[_0xd373('0x4f')]][_0xd373('0x2e')]=utils['now']();transfers[_0x5b88ea[_0xd373('0x4f')]]['holdtime']=0x0;transfers[_0x5b88ea[_0xd373('0x4f')]][_0xd373('0x4a')]=0x2;}}}catch(_0x1337c4){utils[_0xd373('0x1a')](util[_0xd373('0x12')](_0xd373('0x50'),_0x5b88ea[_0xd373('0x43')]),_0x1337c4);}};exports[_0xd373('0x51')]=function(_0x5f1bfd){try{utils[_0xd373('0x1c')](util['format'](_0xd373('0x52'),_0x5f1bfd[_0xd373('0x4')]),_0x5f1bfd);if(agents[_0x5f1bfd[_0xd373('0x4')]]&&agents[_0x5f1bfd[_0xd373('0x4')]][_0xd373('0x21')]===_0xd373('0x20')){if(_0x5f1bfd[_0xd373('0x53')]==='21'){agents[_0x5f1bfd['uniqueid']][_0xd373('0x21')]=_0xd373('0x54');agents[_0x5f1bfd[_0xd373('0x4')]]['lastevent']=_0xd373('0x54');}utils[_0xd373('0x2')](util[_0xd373('0x12')](_0xd373('0x55'),_0x5f1bfd[_0xd373('0x4')],agents[_0x5f1bfd[_0xd373('0x4')]][_0xd373('0x19')],agents[_0x5f1bfd[_0xd373('0x4')]][_0xd373('0x21')],agents[_0x5f1bfd[_0xd373('0x4')]][_0xd373('0x9')]));writeDB(agents[_0x5f1bfd[_0xd373('0x4')]]);var _0x5bbea5=unanswered[_0xd373('0x56')](_0x5f1bfd[_0xd373('0x4')]);if(_0x5bbea5>-0x1){unanswered[_0xd373('0x57')](_0x5bbea5,0x1);}}if(transfers[_0x5f1bfd['uniqueid']]){transfers[_0x5f1bfd[_0xd373('0x4')]][_0xd373('0xc')]=!![];transfers[_0x5f1bfd[_0xd373('0x4')]]['agentcompleteAt']=utils[_0xd373('0x16')]();transfers[_0x5f1bfd['uniqueid']][_0xd373('0x24')]=utils[_0xd373('0x37')](transfers[_0x5f1bfd[_0xd373('0x4')]][_0xd373('0x36')],transfers[_0x5f1bfd['uniqueid']][_0xd373('0x2e')]);transfers[_0x5f1bfd['uniqueid']][_0xd373('0x21')]=_0xd373('0x58');transfers[_0x5f1bfd[_0xd373('0x4')]][_0xd373('0x9')]=_0xd373('0x59');utils[_0xd373('0x2')](util['format'](_0xd373('0x55'),_0x5f1bfd['uniqueid'],transfers[_0x5f1bfd[_0xd373('0x4')]]['membername'],transfers[_0x5f1bfd['uniqueid']][_0xd373('0x21')],transfers[_0x5f1bfd[_0xd373('0x4')]][_0xd373('0x9')]));writeDB(transfers[_0x5f1bfd[_0xd373('0x4')]],!![]);}if(agents[_0x5f1bfd['uniqueid']]&&agents[_0x5f1bfd['uniqueid']][_0xd373('0x2e')]){agents[_0x5f1bfd[_0xd373('0x4')]][_0xd373('0xc')]=!![];agents[_0x5f1bfd[_0xd373('0x4')]][_0xd373('0x36')]=utils[_0xd373('0x16')]();agents[_0x5f1bfd[_0xd373('0x4')]][_0xd373('0x24')]=utils[_0xd373('0x37')](agents[_0x5f1bfd[_0xd373('0x4')]]['agentcompleteAt'],agents[_0x5f1bfd[_0xd373('0x4')]][_0xd373('0x2e')]);agents[_0x5f1bfd[_0xd373('0x4')]][_0xd373('0x21')]=agents[_0x5f1bfd[_0xd373('0x4')]][_0xd373('0x3b')]?_0xd373('0x3b'):'agent';agents[_0x5f1bfd[_0xd373('0x4')]]['lastevent']='complete';utils[_0xd373('0x2')](util[_0xd373('0x12')](_0xd373('0x55'),_0x5f1bfd[_0xd373('0x4')],agents[_0x5f1bfd[_0xd373('0x4')]][_0xd373('0x19')],agents[_0x5f1bfd['uniqueid']][_0xd373('0x21')],agents[_0x5f1bfd[_0xd373('0x4')]][_0xd373('0x9')]));writeDB(agents[_0x5f1bfd['uniqueid']]);}}catch(_0x467ac8){utils[_0xd373('0x1a')](util[_0xd373('0x12')]('[%s][agents][hangup]',_0x5f1bfd[_0xd373('0x4')]),_0x467ac8);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 3315037..c19f3f4 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 _0xc6dc=['ANSWERED','BUSY','info','format','uniqueid','channel','membername','calleridnum','connectedlinenum','accountcode','getUserByInternal','then','UserId','request','CreateVoiceCallReport','newchannel','debug','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','exten','context','now','DOCUMENTATION','error','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','isNil','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','toNumber','[%s][calls][newstate]','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','endtime','duration','diffTime','starttime','billableseconds','attendedtransfer','localtwolinkedid','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','musiconholdstart','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','[%s][calls][musiconholdstart]','musiconholdstop','[%s][calls][musiconholdstop]','varset','variable','xmd-originatecalleridnum','value','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','\x22\x20<','xmd-callerid-preview','xmd-callerid','xmd-queue','xmcs-queue','[%s][calls][varset]\x20variable:%s\x20value:%s','lastapplication','Queue','lastdata','queue','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','[%s][calls][varset]','newexten','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','cdr','split','substring','lastIndexOf','includes','hangup','gotoif','lodash','util','./utils','FAILED','NO\x20ANSWER'];(function(_0x554efc,_0x4ea0c1){var _0x26fc1a=function(_0x10c4f1){while(--_0x10c4f1){_0x554efc['push'](_0x554efc['shift']());}};_0x26fc1a(++_0x4ea0c1);}(_0xc6dc,0x1a3));var _0xcc6d=function(_0x23ce04,_0x2f94fc){_0x23ce04=_0x23ce04-0x0;var _0x7b9a8e=_0xc6dc[_0x23ce04];return _0x7b9a8e;};'use strict';var _=require(_0xcc6d('0x0'));var util=require(_0xcc6d('0x1'));var utils=require(_0xcc6d('0x2'));var dispositions=['NO\x20ANSWER','FAILED',_0xcc6d('0x3'),_0xcc6d('0x4'),_0xcc6d('0x4'),_0xcc6d('0x4'),_0xcc6d('0x5'),_0xcc6d('0x6'),_0xcc6d('0x3'),_0xcc6d('0x3'),'FAILED'];var channels={};function writeDB(_0x24e167){utils[_0xcc6d('0x7')](util[_0xcc6d('0x8')]('[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x24e167[_0xcc6d('0x9')],_0x24e167[_0xcc6d('0xa')],_0x24e167['queue'],_0x24e167[_0xcc6d('0xb')],_0x24e167['interface'],_0x24e167[_0xcc6d('0xc')],_0x24e167[_0xcc6d('0xd')],_0x24e167['lastevent']));if(_0x24e167[_0xcc6d('0xe')]){utils[_0xcc6d('0xf')](_0x24e167['accountcode'])[_0xcc6d('0x10')](function(_0xbec197){if(_0xbec197){_0x24e167[_0xcc6d('0x11')]=_0xbec197['id'];}utils[_0xcc6d('0x12')](_0xcc6d('0x13'),_0x24e167);});}else{utils['request']('CreateVoiceCallReport',_0x24e167);}if(channels[_0x24e167[_0xcc6d('0x9')]]){delete channels[_0x24e167[_0xcc6d('0x9')]];}}exports[_0xcc6d('0x14')]=function(_0x4e5676){try{utils[_0xcc6d('0x15')](util[_0xcc6d('0x8')](_0xcc6d('0x16'),_0x4e5676[_0xcc6d('0x9')]),_0x4e5676);if(_0x4e5676[_0xcc6d('0x9')]==_0x4e5676[_0xcc6d('0x17')]&&_0x4e5676[_0xcc6d('0xa')]!=_0xcc6d('0x18')){utils[_0xcc6d('0x7')](util['format']('[%s][calls][newchannel]\x20context:%s\x20exten:%s',_0x4e5676['uniqueid'],_0x4e5676['context'],_0x4e5676['exten']));channels[_0x4e5676['uniqueid']]={'uniqueid':_0x4e5676[_0xcc6d('0x9')],'accountcode':_0x4e5676[_0xcc6d('0xe')],'source':_0x4e5676[_0xcc6d('0xc')],'destination':_0x4e5676[_0xcc6d('0x19')],'destinationcontext':_0x4e5676[_0xcc6d('0x1a')],'channel':_0x4e5676[_0xcc6d('0xa')],'starttime':utils[_0xcc6d('0x1b')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xcc6d('0x4'),'amaflags':_0xcc6d('0x1c')};}}catch(_0x433fdc){utils[_0xcc6d('0x1d')](util['format'](_0xcc6d('0x16'),_0x4e5676[_0xcc6d('0x9')]),_0x433fdc);}};exports['newstate']=function(_0x56db67){try{utils['debug'](util['format']('[%s][calls][newstate]',_0x56db67[_0xcc6d('0x9')]),_0x56db67);if(!_['isNil'](channels[_0x56db67[_0xcc6d('0x9')]])&&_0x56db67[_0xcc6d('0x1e')]==0x6){utils[_0xcc6d('0x7')](util[_0xcc6d('0x8')](_0xcc6d('0x1f'),_0x56db67['uniqueid'],_0x56db67['context'],_0x56db67[_0xcc6d('0xa')]));if(_[_0xcc6d('0x20')](channels[_0x56db67[_0xcc6d('0x9')]]['systemanswertime'])){channels[_0x56db67[_0xcc6d('0x9')]][_0xcc6d('0x21')]=utils[_0xcc6d('0x1b')]();}}else if(!_[_0xcc6d('0x20')](channels[_0x56db67[_0xcc6d('0x17')]])&&_0x56db67['channelstate']==0x6&&_0x56db67[_0xcc6d('0x1a')]!=_0xcc6d('0x22')){utils[_0xcc6d('0x7')](util[_0xcc6d('0x8')](_0xcc6d('0x23'),_0x56db67[_0xcc6d('0x9')],_0x56db67['linkedid'],_0x56db67[_0xcc6d('0x1a')],_0x56db67[_0xcc6d('0xa')]));channels[_0x56db67[_0xcc6d('0x17')]][_0xcc6d('0xe')]=_0x56db67[_0xcc6d('0xe')];channels[_0x56db67['linkedid']][_0xcc6d('0x24')]=_0x56db67[_0xcc6d('0xa')];if(_[_0xcc6d('0x20')](channels[_0x56db67[_0xcc6d('0x17')]][_0xcc6d('0x25')])){channels[_0x56db67[_0xcc6d('0x17')]][_0xcc6d('0x25')]=utils[_0xcc6d('0x1b')]();}channels[_0x56db67['linkedid']][_0xcc6d('0x26')]=dispositions[_[_0xcc6d('0x27')](_0x56db67[_0xcc6d('0x1e')])]||_0xcc6d('0x5');}}catch(_0xae814a){utils[_0xcc6d('0x1d')](util[_0xcc6d('0x8')](_0xcc6d('0x28'),_0x56db67[_0xcc6d('0x9')]),_0xae814a);}};exports['hangup']=function(_0x59993d){try{if(!_[_0xcc6d('0x20')](channels[_0x59993d[_0xcc6d('0x9')]])){utils[_0xcc6d('0x15')](util[_0xcc6d('0x8')](_0xcc6d('0x29'),_0x59993d[_0xcc6d('0x9')]),_0x59993d);if(_[_0xcc6d('0x20')](channels[_0x59993d[_0xcc6d('0x9')]]['callerid'])){channels[_0x59993d[_0xcc6d('0x9')]][_0xcc6d('0x2a')]=_0x59993d[_0xcc6d('0x2b')]+'\x20<'+_0x59993d[_0xcc6d('0xc')]+'>';}utils[_0xcc6d('0x7')](util[_0xcc6d('0x8')](_0xcc6d('0x2c'),_0x59993d[_0xcc6d('0x9')],channels[_0x59993d[_0xcc6d('0x9')]][_0xcc6d('0x2a')],_0x59993d['cause-txt']));channels[_0x59993d[_0xcc6d('0x9')]][_0xcc6d('0x2d')]=utils[_0xcc6d('0x1b')]();channels[_0x59993d['uniqueid']][_0xcc6d('0x2e')]=utils[_0xcc6d('0x2f')](channels[_0x59993d['uniqueid']][_0xcc6d('0x2d')],channels[_0x59993d[_0xcc6d('0x9')]][_0xcc6d('0x30')]);channels[_0x59993d[_0xcc6d('0x9')]][_0xcc6d('0x31')]=channels[_0x59993d[_0xcc6d('0x9')]][_0xcc6d('0x25')]?utils[_0xcc6d('0x2f')](channels[_0x59993d[_0xcc6d('0x9')]][_0xcc6d('0x2d')],channels[_0x59993d[_0xcc6d('0x9')]][_0xcc6d('0x25')]):0x0;writeDB(channels[_0x59993d[_0xcc6d('0x9')]]);}}catch(_0x467593){utils[_0xcc6d('0x1d')](util[_0xcc6d('0x8')](_0xcc6d('0x29'),_0x59993d[_0xcc6d('0x9')]),_0x467593);}};exports[_0xcc6d('0x32')]=function(_0x464983){try{if(!_['isNil'](channels[_0x464983[_0xcc6d('0x33')]])){utils['debug'](util[_0xcc6d('0x8')]('[%s][calls][attendedtransfer]',_0x464983[_0xcc6d('0x34')]),_0x464983);if(channels[_0x464983[_0xcc6d('0x33')]][_0xcc6d('0xa')]==_0x464983[_0xcc6d('0x35')]){utils[_0xcc6d('0x7')](util[_0xcc6d('0x8')](_0xcc6d('0x36'),_0x464983['origtransfereruniqueid'],_0x464983[_0xcc6d('0x33')],_0x464983[_0xcc6d('0x37')]));channels[_0x464983['localtwolinkedid']][_0xcc6d('0x24')]=_0x464983['secondtransfererchannel'];channels[_0x464983[_0xcc6d('0x33')]][_0xcc6d('0x38')]=_0xcc6d('0x39');}else if(channels[_0x464983[_0xcc6d('0x33')]][_0xcc6d('0xa')]=_0x464983[_0xcc6d('0x3a')]){utils[_0xcc6d('0x7')](util[_0xcc6d('0x8')](_0xcc6d('0x36'),_0x464983[_0xcc6d('0x34')],_0x464983[_0xcc6d('0x33')],_0x464983['origtransfererchannel']));channels[_0x464983[_0xcc6d('0x33')]][_0xcc6d('0x24')]=_0x464983[_0xcc6d('0x3b')];channels[_0x464983[_0xcc6d('0x33')]]['userfield']='_attended';}}}catch(_0x5e666b){utils[_0xcc6d('0x1d')](util[_0xcc6d('0x8')]('[%s][calls][attendedtransfer]',_0x464983[_0xcc6d('0x34')]),_0x5e666b);}};exports[_0xcc6d('0x3c')]=function(_0x51e2fd){try{if(!_['isNil'](channels[_0x51e2fd['uniqueid']])){utils[_0xcc6d('0x15')](util[_0xcc6d('0x8')]('[%s][calls][musiconholdstart]',_0x51e2fd[_0xcc6d('0x9')]),_0x51e2fd);channels[_0x51e2fd[_0xcc6d('0x9')]][_0xcc6d('0x3d')]=utils[_0xcc6d('0x1b')]();utils[_0xcc6d('0x7')](util[_0xcc6d('0x8')](_0xcc6d('0x3e'),_0x51e2fd[_0xcc6d('0x9')],channels[_0x51e2fd[_0xcc6d('0x9')]]['musiconholdstartAt']));}}catch(_0x36f06e){utils[_0xcc6d('0x1d')](util['format'](_0xcc6d('0x3f'),_0x51e2fd[_0xcc6d('0x9')]),_0x36f06e);}};exports[_0xcc6d('0x40')]=function(_0x29ee56){try{if(!_['isNil'](channels[_0x29ee56['uniqueid']])){utils[_0xcc6d('0x15')](util[_0xcc6d('0x8')](_0xcc6d('0x41'),_0x29ee56[_0xcc6d('0x9')]),_0x29ee56);if(!_[_0xcc6d('0x20')](channels[_0x29ee56['uniqueid']][_0xcc6d('0x3d')])){channels[_0x29ee56['uniqueid']]['mohtime']+=utils['diffTime'](utils[_0xcc6d('0x1b')](),channels[_0x29ee56[_0xcc6d('0x9')]][_0xcc6d('0x3d')]);utils[_0xcc6d('0x7')](util[_0xcc6d('0x8')]('[%s][calls][musiconholdstop]\x20mohtime:%s',_0x29ee56[_0xcc6d('0x9')],channels[_0x29ee56[_0xcc6d('0x9')]]['mohtime']));delete channels[_0x29ee56['uniqueid']]['musiconholdstartAt'];}}}catch(_0x2f5139){utils[_0xcc6d('0x1d')](util[_0xcc6d('0x8')]('[%s][calls][musiconholdstop]',_0x29ee56[_0xcc6d('0x9')]),_0x2f5139);}};exports[_0xcc6d('0x42')]=function(_0x4d4721){try{if(!_[_0xcc6d('0x20')](channels[_0x4d4721[_0xcc6d('0x9')]])){utils[_0xcc6d('0x15')](util['format']('[%s][calls][varset]',_0x4d4721[_0xcc6d('0x9')]),_0x4d4721);if(!_[_0xcc6d('0x20')](_0x4d4721[_0xcc6d('0x43')][_0xcc6d('0x44')])){utils[_0xcc6d('0x7')](util[_0xcc6d('0x8')]('[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x4d4721[_0xcc6d('0x9')],_0x4d4721[_0xcc6d('0x45')]));channels[_0x4d4721[_0xcc6d('0x9')]]['source']=_0x4d4721[_0xcc6d('0x45')];}if(!_[_0xcc6d('0x20')](_0x4d4721[_0xcc6d('0x43')][_0xcc6d('0x46')])){utils[_0xcc6d('0x7')](util[_0xcc6d('0x8')](_0xcc6d('0x47'),_0x4d4721['uniqueid'],_0x4d4721[_0xcc6d('0x45')]));channels[_0x4d4721[_0xcc6d('0x9')]]['destination']=_0x4d4721['value'];channels[_0x4d4721['uniqueid']]['callerid']='\x22'+_0x4d4721['value']+_0xcc6d('0x48')+_0x4d4721[_0xcc6d('0x45')]+'>';}if(!_[_0xcc6d('0x20')](_0x4d4721[_0xcc6d('0x43')][_0xcc6d('0x49')])||!_[_0xcc6d('0x20')](_0x4d4721['variable'][_0xcc6d('0x4a')])){utils[_0xcc6d('0x7')](util['format']('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x4d4721[_0xcc6d('0x9')],!_[_0xcc6d('0x20')](_0x4d4721[_0xcc6d('0x43')][_0xcc6d('0x49')])?'xmd-callerid-preview':_0xcc6d('0x4a'),_0x4d4721[_0xcc6d('0x45')]));channels[_0x4d4721[_0xcc6d('0x9')]]['callerid']=_0x4d4721['value'];}if(!_['isNil'](_0x4d4721[_0xcc6d('0x43')][_0xcc6d('0x4b')])||!_[_0xcc6d('0x20')](_0x4d4721[_0xcc6d('0x43')][_0xcc6d('0x4c')])){utils['info'](util[_0xcc6d('0x8')](_0xcc6d('0x4d'),_0x4d4721[_0xcc6d('0x9')],!_[_0xcc6d('0x20')](_0x4d4721[_0xcc6d('0x43')][_0xcc6d('0x4b')])?'xmd-queue':_0xcc6d('0x4c'),_0x4d4721[_0xcc6d('0x45')]));channels[_0x4d4721[_0xcc6d('0x9')]][_0xcc6d('0x4e')]=_0xcc6d('0x4f');channels[_0x4d4721[_0xcc6d('0x9')]][_0xcc6d('0x50')]=_0x4d4721[_0xcc6d('0x45')];channels[_0x4d4721[_0xcc6d('0x9')]][_0xcc6d('0x51')]=!![];}if(!_[_0xcc6d('0x20')](_0x4d4721[_0xcc6d('0x43')][_0xcc6d('0x52')])){utils[_0xcc6d('0x7')](util[_0xcc6d('0x8')](_0xcc6d('0x53'),_0x4d4721[_0xcc6d('0x9')],_0x4d4721[_0xcc6d('0x45')]));channels[_0x4d4721[_0xcc6d('0x9')]][_0xcc6d('0x54')]=_0x4d4721[_0xcc6d('0x45')];}if(!_['isNil'](_0x4d4721[_0xcc6d('0x43')][_0xcc6d('0x55')])){utils[_0xcc6d('0x7')](util['format'](_0xcc6d('0x56'),_0x4d4721['uniqueid'],_0x4d4721[_0xcc6d('0x45')]));channels[_0x4d4721[_0xcc6d('0x9')]]['type']=_0x4d4721[_0xcc6d('0x45')];}if(!_[_0xcc6d('0x20')](_0x4d4721['variable'][_0xcc6d('0x57')])){utils['info'](util[_0xcc6d('0x8')](_0xcc6d('0x58'),_0x4d4721[_0xcc6d('0x9')],_0x4d4721[_0xcc6d('0x45')]));channels[_0x4d4721[_0xcc6d('0x9')]][_0xcc6d('0x59')]=_0x4d4721[_0xcc6d('0x45')];}if(!_[_0xcc6d('0x20')](_0x4d4721[_0xcc6d('0x43')][_0xcc6d('0x5a')])){utils[_0xcc6d('0x7')](util['format'](_0xcc6d('0x5b'),_0x4d4721['uniqueid'],_0x4d4721[_0xcc6d('0x45')]));channels[_0x4d4721[_0xcc6d('0x9')]][_0xcc6d('0x5a')]=_0x4d4721[_0xcc6d('0x45')];}}}catch(_0x3e40eb){utils[_0xcc6d('0x1d')](util[_0xcc6d('0x8')](_0xcc6d('0x5c'),_0x4d4721[_0xcc6d('0x9')]),_0x3e40eb);}};exports[_0xcc6d('0x5d')]=function(_0x19c5ea){try{if(!_[_0xcc6d('0x20')](channels[_0x19c5ea[_0xcc6d('0x9')]])){utils[_0xcc6d('0x15')](util['format']('[%s][calls][newexten]',_0x19c5ea[_0xcc6d('0x9')]),_0x19c5ea);utils[_0xcc6d('0x7')](util['format'](_0xcc6d('0x5e'),_0x19c5ea[_0xcc6d('0x9')],_0x19c5ea[_0xcc6d('0x5f')],_0x19c5ea[_0xcc6d('0x60')]));if(_0x19c5ea[_0xcc6d('0x5f')][_0xcc6d('0x61')]()==_0xcc6d('0x62')&&_['startsWith'](_0x19c5ea['appdata'][_0xcc6d('0x61')](),_0xcc6d('0x63'))){var _0x38c945=_0x19c5ea['appdata'][_0xcc6d('0x64')]('=');var _0xb6a5b8=_0x38c945[0x0][_0xcc6d('0x65')](_0x38c945[0x0][_0xcc6d('0x66')]('(')+0x1,_0x38c945[0x0][_0xcc6d('0x66')](')'));var _0x25b0fe=_0x38c945[0x1];channels[_0x19c5ea['uniqueid']][_0xb6a5b8]=_0x25b0fe;}if(!_[_0xcc6d('0x67')]([_0xcc6d('0x68'),'noop','execif','set',_0xcc6d('0x69')],_0x19c5ea[_0xcc6d('0x5f')][_0xcc6d('0x61')]())){channels[_0x19c5ea[_0xcc6d('0x9')]][_0xcc6d('0x4e')]=_0x19c5ea[_0xcc6d('0x5f')];channels[_0x19c5ea[_0xcc6d('0x9')]]['lastdata']=_0x19c5ea[_0xcc6d('0x60')];}}}catch(_0x380b74){utils['error'](util['format']('[%s][calls][newexten]',_0x19c5ea[_0xcc6d('0x9')]),_0x380b74);}}; \ No newline at end of file +var _0xf623=['CreateVoiceCallReport','newchannel','debug','[%s][calls][newchannel]','linkedid','context','exten','now','DOCUMENTATION','error','newstate','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','ANSWERED','[%s][calls][hangup]','callerid','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','duration','diffTime','starttime','billableseconds','endtime','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','secondtransfererchannel','userfield','transfertargetchannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfererchannel','_attended','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstartAt','[%s][calls][musiconholdstart]','[%s][calls][musiconholdstop]','mohtime','[%s][calls][varset]','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid-preview','xmd-callerid','xmd-queue','[%s][calls][varset]\x20variable:%s\x20value:%s','xmcs-queue','lastapplication','Queue','lastdata','xmd-contactid','[%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','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','set','split','lastIndexOf','includes','hangup','noop','execif','util','./utils','FAILED','NO\x20ANSWER','BUSY','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','UserId','request'];(function(_0x565a40,_0x417e53){var _0x4e1e62=function(_0x1bc2d1){while(--_0x1bc2d1){_0x565a40['push'](_0x565a40['shift']());}};_0x4e1e62(++_0x417e53);}(_0xf623,0x1f4));var _0x3f62=function(_0x40e695,_0x366877){_0x40e695=_0x40e695-0x0;var _0x55a70e=_0xf623[_0x40e695];return _0x55a70e;};'use strict';var _=require('lodash');var util=require(_0x3f62('0x0'));var utils=require(_0x3f62('0x1'));var dispositions=['NO\x20ANSWER',_0x3f62('0x2'),'FAILED',_0x3f62('0x3'),_0x3f62('0x3'),'NO\x20ANSWER','ANSWERED',_0x3f62('0x4'),_0x3f62('0x2'),_0x3f62('0x2'),_0x3f62('0x2')];var channels={};function writeDB(_0x528f84){utils[_0x3f62('0x5')](util[_0x3f62('0x6')](_0x3f62('0x7'),_0x528f84[_0x3f62('0x8')],_0x528f84[_0x3f62('0x9')],_0x528f84[_0x3f62('0xa')],_0x528f84[_0x3f62('0xb')],_0x528f84[_0x3f62('0xc')],_0x528f84[_0x3f62('0xd')],_0x528f84[_0x3f62('0xe')],_0x528f84[_0x3f62('0xf')]));if(_0x528f84[_0x3f62('0x10')]){utils[_0x3f62('0x11')](_0x528f84[_0x3f62('0x10')])['then'](function(_0x324ba7){if(_0x324ba7){_0x528f84[_0x3f62('0x12')]=_0x324ba7['id'];}utils[_0x3f62('0x13')](_0x3f62('0x14'),_0x528f84);});}else{utils[_0x3f62('0x13')]('CreateVoiceCallReport',_0x528f84);}if(channels[_0x528f84[_0x3f62('0x8')]]){delete channels[_0x528f84[_0x3f62('0x8')]];}}exports[_0x3f62('0x15')]=function(_0x30668e){try{utils[_0x3f62('0x16')](util[_0x3f62('0x6')](_0x3f62('0x17'),_0x30668e[_0x3f62('0x8')]),_0x30668e);if(_0x30668e[_0x3f62('0x8')]==_0x30668e[_0x3f62('0x18')]&&_0x30668e[_0x3f62('0x9')]!='OutgoingSpoolFailed'){utils[_0x3f62('0x5')](util[_0x3f62('0x6')]('[%s][calls][newchannel]\x20context:%s\x20exten:%s',_0x30668e[_0x3f62('0x8')],_0x30668e[_0x3f62('0x19')],_0x30668e[_0x3f62('0x1a')]));channels[_0x30668e[_0x3f62('0x8')]]={'uniqueid':_0x30668e[_0x3f62('0x8')],'accountcode':_0x30668e['accountcode'],'source':_0x30668e['calleridnum'],'destination':_0x30668e[_0x3f62('0x1a')],'destinationcontext':_0x30668e[_0x3f62('0x19')],'channel':_0x30668e[_0x3f62('0x9')],'starttime':utils[_0x3f62('0x1b')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x3f62('0x3'),'amaflags':_0x3f62('0x1c')};}}catch(_0x2b5bd6){utils[_0x3f62('0x1d')](util['format'](_0x3f62('0x17'),_0x30668e['uniqueid']),_0x2b5bd6);}};exports[_0x3f62('0x1e')]=function(_0x2f2994){try{utils[_0x3f62('0x16')](util[_0x3f62('0x6')](_0x3f62('0x1f'),_0x2f2994[_0x3f62('0x8')]),_0x2f2994);if(!_[_0x3f62('0x20')](channels[_0x2f2994[_0x3f62('0x8')]])&&_0x2f2994[_0x3f62('0x21')]==0x6){utils[_0x3f62('0x5')](util[_0x3f62('0x6')](_0x3f62('0x22'),_0x2f2994[_0x3f62('0x8')],_0x2f2994['context'],_0x2f2994[_0x3f62('0x9')]));if(_['isNil'](channels[_0x2f2994[_0x3f62('0x8')]][_0x3f62('0x23')])){channels[_0x2f2994['uniqueid']][_0x3f62('0x23')]=utils[_0x3f62('0x1b')]();}}else if(!_['isNil'](channels[_0x2f2994[_0x3f62('0x18')]])&&_0x2f2994['channelstate']==0x6&&_0x2f2994['context']!=_0x3f62('0x24')){utils['info'](util['format'](_0x3f62('0x25'),_0x2f2994[_0x3f62('0x8')],_0x2f2994['linkedid'],_0x2f2994[_0x3f62('0x19')],_0x2f2994[_0x3f62('0x9')]));channels[_0x2f2994[_0x3f62('0x18')]][_0x3f62('0x10')]=_0x2f2994[_0x3f62('0x10')];channels[_0x2f2994['linkedid']][_0x3f62('0x26')]=_0x2f2994[_0x3f62('0x9')];if(_[_0x3f62('0x20')](channels[_0x2f2994[_0x3f62('0x18')]][_0x3f62('0x27')])){channels[_0x2f2994[_0x3f62('0x18')]][_0x3f62('0x27')]=utils[_0x3f62('0x1b')]();}channels[_0x2f2994[_0x3f62('0x18')]][_0x3f62('0x28')]=dispositions[_['toNumber'](_0x2f2994[_0x3f62('0x21')])]||_0x3f62('0x29');}}catch(_0x125222){utils[_0x3f62('0x1d')](util[_0x3f62('0x6')](_0x3f62('0x1f'),_0x2f2994[_0x3f62('0x8')]),_0x125222);}};exports['hangup']=function(_0xb07eeb){try{if(!_['isNil'](channels[_0xb07eeb['uniqueid']])){utils[_0x3f62('0x16')](util[_0x3f62('0x6')](_0x3f62('0x2a'),_0xb07eeb[_0x3f62('0x8')]),_0xb07eeb);if(_[_0x3f62('0x20')](channels[_0xb07eeb[_0x3f62('0x8')]][_0x3f62('0x2b')])){channels[_0xb07eeb[_0x3f62('0x8')]][_0x3f62('0x2b')]=_0xb07eeb['calleridname']+'\x20<'+_0xb07eeb[_0x3f62('0xd')]+'>';}utils['info'](util['format'](_0x3f62('0x2c'),_0xb07eeb['uniqueid'],channels[_0xb07eeb['uniqueid']][_0x3f62('0x2b')],_0xb07eeb[_0x3f62('0x2d')]));channels[_0xb07eeb[_0x3f62('0x8')]]['endtime']=utils[_0x3f62('0x1b')]();channels[_0xb07eeb[_0x3f62('0x8')]][_0x3f62('0x2e')]=utils[_0x3f62('0x2f')](channels[_0xb07eeb[_0x3f62('0x8')]]['endtime'],channels[_0xb07eeb['uniqueid']][_0x3f62('0x30')]);channels[_0xb07eeb['uniqueid']][_0x3f62('0x31')]=channels[_0xb07eeb[_0x3f62('0x8')]][_0x3f62('0x27')]?utils[_0x3f62('0x2f')](channels[_0xb07eeb[_0x3f62('0x8')]][_0x3f62('0x32')],channels[_0xb07eeb[_0x3f62('0x8')]]['answertime']):0x0;writeDB(channels[_0xb07eeb[_0x3f62('0x8')]]);}}catch(_0x4fc5ca){utils[_0x3f62('0x1d')](util[_0x3f62('0x6')]('[%s][calls][hangup]',_0xb07eeb['uniqueid']),_0x4fc5ca);}};exports[_0x3f62('0x33')]=function(_0x168d8a){try{if(!_[_0x3f62('0x20')](channels[_0x168d8a[_0x3f62('0x34')]])){utils['debug'](util['format'](_0x3f62('0x35'),_0x168d8a[_0x3f62('0x36')]),_0x168d8a);if(channels[_0x168d8a[_0x3f62('0x34')]][_0x3f62('0x9')]==_0x168d8a[_0x3f62('0x37')]){utils[_0x3f62('0x5')](util[_0x3f62('0x6')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x168d8a[_0x3f62('0x36')],_0x168d8a['localtwolinkedid'],_0x168d8a[_0x3f62('0x38')]));channels[_0x168d8a['localtwolinkedid']][_0x3f62('0x26')]=_0x168d8a[_0x3f62('0x38')];channels[_0x168d8a[_0x3f62('0x34')]][_0x3f62('0x39')]='_attended';}else if(channels[_0x168d8a[_0x3f62('0x34')]][_0x3f62('0x9')]=_0x168d8a[_0x3f62('0x3a')]){utils[_0x3f62('0x5')](util['format'](_0x3f62('0x3b'),_0x168d8a[_0x3f62('0x36')],_0x168d8a[_0x3f62('0x34')],_0x168d8a[_0x3f62('0x3c')]));channels[_0x168d8a[_0x3f62('0x34')]]['destinationchannel']=_0x168d8a['origtransfererchannel'];channels[_0x168d8a['localtwolinkedid']][_0x3f62('0x39')]=_0x3f62('0x3d');}}}catch(_0x37acd0){utils[_0x3f62('0x1d')](util[_0x3f62('0x6')](_0x3f62('0x35'),_0x168d8a[_0x3f62('0x36')]),_0x37acd0);}};exports['musiconholdstart']=function(_0x6de81f){try{if(!_[_0x3f62('0x20')](channels[_0x6de81f[_0x3f62('0x8')]])){utils['debug'](util[_0x3f62('0x6')]('[%s][calls][musiconholdstart]',_0x6de81f[_0x3f62('0x8')]),_0x6de81f);channels[_0x6de81f[_0x3f62('0x8')]]['musiconholdstartAt']=utils['now']();utils[_0x3f62('0x5')](util[_0x3f62('0x6')](_0x3f62('0x3e'),_0x6de81f[_0x3f62('0x8')],channels[_0x6de81f[_0x3f62('0x8')]][_0x3f62('0x3f')]));}}catch(_0x5c4db1){utils[_0x3f62('0x1d')](util[_0x3f62('0x6')](_0x3f62('0x40'),_0x6de81f[_0x3f62('0x8')]),_0x5c4db1);}};exports['musiconholdstop']=function(_0x3923f3){try{if(!_[_0x3f62('0x20')](channels[_0x3923f3['uniqueid']])){utils['debug'](util[_0x3f62('0x6')](_0x3f62('0x41'),_0x3923f3[_0x3f62('0x8')]),_0x3923f3);if(!_[_0x3f62('0x20')](channels[_0x3923f3[_0x3f62('0x8')]]['musiconholdstartAt'])){channels[_0x3923f3[_0x3f62('0x8')]][_0x3f62('0x42')]+=utils[_0x3f62('0x2f')](utils['now'](),channels[_0x3923f3[_0x3f62('0x8')]][_0x3f62('0x3f')]);utils[_0x3f62('0x5')](util[_0x3f62('0x6')]('[%s][calls][musiconholdstop]\x20mohtime:%s',_0x3923f3['uniqueid'],channels[_0x3923f3[_0x3f62('0x8')]][_0x3f62('0x42')]));delete channels[_0x3923f3['uniqueid']][_0x3f62('0x3f')];}}}catch(_0x17b219){utils[_0x3f62('0x1d')](util[_0x3f62('0x6')](_0x3f62('0x41'),_0x3923f3['uniqueid']),_0x17b219);}};exports['varset']=function(_0x266e99){try{if(!_[_0x3f62('0x20')](channels[_0x266e99[_0x3f62('0x8')]])){utils[_0x3f62('0x16')](util['format'](_0x3f62('0x43'),_0x266e99[_0x3f62('0x8')]),_0x266e99);if(!_[_0x3f62('0x20')](_0x266e99[_0x3f62('0x44')][_0x3f62('0x45')])){utils[_0x3f62('0x5')](util[_0x3f62('0x6')](_0x3f62('0x46'),_0x266e99[_0x3f62('0x8')],_0x266e99[_0x3f62('0x47')]));channels[_0x266e99[_0x3f62('0x8')]][_0x3f62('0x48')]=_0x266e99['value'];}if(!_['isNil'](_0x266e99[_0x3f62('0x44')][_0x3f62('0x49')])){utils['info'](util[_0x3f62('0x6')](_0x3f62('0x4a'),_0x266e99['uniqueid'],_0x266e99['value']));channels[_0x266e99['uniqueid']][_0x3f62('0x4b')]=_0x266e99[_0x3f62('0x47')];channels[_0x266e99[_0x3f62('0x8')]][_0x3f62('0x2b')]='\x22'+_0x266e99['value']+_0x3f62('0x4c')+_0x266e99[_0x3f62('0x47')]+'>';}if(!_['isNil'](_0x266e99[_0x3f62('0x44')][_0x3f62('0x4d')])||!_['isNil'](_0x266e99['variable'][_0x3f62('0x4e')])){utils['info'](util[_0x3f62('0x6')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x266e99['uniqueid'],!_['isNil'](_0x266e99[_0x3f62('0x44')]['xmd-callerid-preview'])?_0x3f62('0x4d'):'xmd-callerid',_0x266e99[_0x3f62('0x47')]));channels[_0x266e99[_0x3f62('0x8')]][_0x3f62('0x2b')]=_0x266e99[_0x3f62('0x47')];}if(!_[_0x3f62('0x20')](_0x266e99[_0x3f62('0x44')][_0x3f62('0x4f')])||!_[_0x3f62('0x20')](_0x266e99['variable']['xmcs-queue'])){utils['info'](util[_0x3f62('0x6')](_0x3f62('0x50'),_0x266e99['uniqueid'],!_['isNil'](_0x266e99['variable'][_0x3f62('0x4f')])?_0x3f62('0x4f'):_0x3f62('0x51'),_0x266e99[_0x3f62('0x47')]));channels[_0x266e99[_0x3f62('0x8')]][_0x3f62('0x52')]=_0x3f62('0x53');channels[_0x266e99[_0x3f62('0x8')]][_0x3f62('0x54')]=_0x266e99[_0x3f62('0x47')];channels[_0x266e99[_0x3f62('0x8')]]['queue']=!![];}if(!_['isNil'](_0x266e99[_0x3f62('0x44')][_0x3f62('0x55')])){utils[_0x3f62('0x5')](util[_0x3f62('0x6')](_0x3f62('0x56'),_0x266e99[_0x3f62('0x8')],_0x266e99[_0x3f62('0x47')]));channels[_0x266e99[_0x3f62('0x8')]][_0x3f62('0x57')]=_0x266e99['value'];}if(!_[_0x3f62('0x20')](_0x266e99[_0x3f62('0x44')]['xmd-cdrtype'])){utils[_0x3f62('0x5')](util[_0x3f62('0x6')]('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x266e99[_0x3f62('0x8')],_0x266e99[_0x3f62('0x47')]));channels[_0x266e99['uniqueid']][_0x3f62('0x58')]=_0x266e99['value'];}if(!_[_0x3f62('0x20')](_0x266e99[_0x3f62('0x44')]['outboundrouteid'])){utils['info'](util[_0x3f62('0x6')](_0x3f62('0x59'),_0x266e99[_0x3f62('0x8')],_0x266e99[_0x3f62('0x47')]));channels[_0x266e99['uniqueid']][_0x3f62('0x5a')]=_0x266e99[_0x3f62('0x47')];}if(!_[_0x3f62('0x20')](_0x266e99['variable'][_0x3f62('0x5b')])){utils[_0x3f62('0x5')](util[_0x3f62('0x6')](_0x3f62('0x5c'),_0x266e99[_0x3f62('0x8')],_0x266e99[_0x3f62('0x47')]));channels[_0x266e99['uniqueid']][_0x3f62('0x5b')]=_0x266e99[_0x3f62('0x47')];}}}catch(_0x214218){utils[_0x3f62('0x1d')](util[_0x3f62('0x6')](_0x3f62('0x43'),_0x266e99[_0x3f62('0x8')]),_0x214218);}};exports['newexten']=function(_0x3a9fee){try{if(!_[_0x3f62('0x20')](channels[_0x3a9fee[_0x3f62('0x8')]])){utils['debug'](util[_0x3f62('0x6')](_0x3f62('0x5d'),_0x3a9fee['uniqueid']),_0x3a9fee);utils[_0x3f62('0x5')](util[_0x3f62('0x6')](_0x3f62('0x5e'),_0x3a9fee['uniqueid'],_0x3a9fee[_0x3f62('0x5f')],_0x3a9fee[_0x3f62('0x60')]));if(_0x3a9fee[_0x3f62('0x5f')]['toLowerCase']()==_0x3f62('0x61')&&_['startsWith'](_0x3a9fee[_0x3f62('0x60')]['toLowerCase'](),'cdr')){var _0x365905=_0x3a9fee['appdata'][_0x3f62('0x62')]('=');var _0x281078=_0x365905[0x0]['substring'](_0x365905[0x0][_0x3f62('0x63')]('(')+0x1,_0x365905[0x0]['lastIndexOf'](')'));var _0x1b8dce=_0x365905[0x1];channels[_0x3a9fee[_0x3f62('0x8')]][_0x281078]=_0x1b8dce;}if(!_[_0x3f62('0x64')]([_0x3f62('0x65'),_0x3f62('0x66'),_0x3f62('0x67'),_0x3f62('0x61'),'gotoif'],_0x3a9fee['application']['toLowerCase']())){channels[_0x3a9fee[_0x3f62('0x8')]][_0x3f62('0x52')]=_0x3a9fee['application'];channels[_0x3a9fee[_0x3f62('0x8')]][_0x3f62('0x54')]=_0x3a9fee['appdata'];}}}catch(_0x4def4e){utils[_0x3f62('0x1d')](util[_0x3f62('0x6')](_0x3f62('0x5d'),_0x3a9fee[_0x3f62('0x8')]),_0x4def4e);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 76d8f02..958e07b 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 _0x2cb5=['error','[core]\x20error','[core]\x20close','managerevent','./utils','connect','[core]\x20connected','shutdown','info','[core]\x20shutdown','fullybooted'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2cb5,0x14e));var _0x52cb=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0x2cb5[_0x5783f4];return _0x28e380;};'use strict';var utils=require(_0x52cb('0x0'));exports[_0x52cb('0x1')]=function(){utils['info'](_0x52cb('0x2'));};exports[_0x52cb('0x3')]=function(){utils[_0x52cb('0x4')](_0x52cb('0x5'));};exports[_0x52cb('0x6')]=function(){utils['info']('[core]\x20fullybooted');};exports['error']=function(_0x3a6dbc){utils[_0x52cb('0x7')](_0x52cb('0x8'),_0x3a6dbc);};exports['close']=function(){utils['info'](_0x52cb('0x9'));};exports[_0x52cb('0xa')]=function(_0x2c480d){}; \ No newline at end of file +var _0x37a2=['connect','[core]\x20connected','shutdown','fullybooted','info','[core]\x20fullybooted','error','[core]\x20error','close','[core]\x20close','managerevent','./utils'];(function(_0x169dff,_0x57be0){var _0x91cf22=function(_0x527498){while(--_0x527498){_0x169dff['push'](_0x169dff['shift']());}};_0x91cf22(++_0x57be0);}(_0x37a2,0xe3));var _0x237a=function(_0x10ea5f,_0xca64dc){_0x10ea5f=_0x10ea5f-0x0;var _0x95532e=_0x37a2[_0x10ea5f];return _0x95532e;};'use strict';var utils=require(_0x237a('0x0'));exports[_0x237a('0x1')]=function(){utils['info'](_0x237a('0x2'));};exports[_0x237a('0x3')]=function(){utils['info']('[core]\x20shutdown');};exports[_0x237a('0x4')]=function(){utils[_0x237a('0x5')](_0x237a('0x6'));};exports[_0x237a('0x7')]=function(_0x13c483){utils[_0x237a('0x7')](_0x237a('0x8'),_0x13c483);};exports[_0x237a('0x9')]=function(){utils[_0x237a('0x5')](_0x237a('0xa'));};exports[_0x237a('0xb')]=function(_0x479303){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index b57ce4b..0b3fb9e 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 _0x7763=['calleridname','cause-txt','complete','duration','diffTime','endtime','holdtime','answertime','[%s][dials][hangup]','lodash','util','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','calleridnum','connectedlinenum','dialstatus','request','CreateVoiceDialReport','newexten','debug','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','startsWith','appdata','cdr(routeid)','split','error','varset','[%s][dials][varset]','isNil','variable','outboundrouteid','value','dialbegin','[%s][dials][dialbegin]','assign','starttime','now','lastevent','called','ANSWER','[%s][dials][dialend]\x20dialstatus:%s','[%s][dials][dialend]','hangup','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s'];(function(_0xd23bf6,_0x4e4718){var _0xccdce5=function(_0x203406){while(--_0x203406){_0xd23bf6['push'](_0xd23bf6['shift']());}};_0xccdce5(++_0x4e4718);}(_0x7763,0x71));var _0x3776=function(_0x463d31,_0x300f00){_0x463d31=_0x463d31-0x0;var _0x54d42f=_0x7763[_0x463d31];return _0x54d42f;};'use strict';var _=require(_0x3776('0x0'));var util=require(_0x3776('0x1'));var utils=require(_0x3776('0x2'));var dials={};function writeDB(_0x26a140){utils[_0x3776('0x3')](util[_0x3776('0x4')](_0x3776('0x5'),_0x26a140[_0x3776('0x6')],_0x26a140[_0x3776('0x7')],_0x26a140[_0x3776('0x8')],_0x26a140[_0x3776('0x9')],_0x26a140[_0x3776('0xa')],_0x26a140[_0x3776('0xb')]));utils[_0x3776('0xc')](_0x3776('0xd'),_0x26a140);delete dials[_0x26a140[_0x3776('0x6')]];}exports[_0x3776('0xe')]=function(_0x75ca){try{utils[_0x3776('0xf')](util[_0x3776('0x4')](_0x3776('0x10'),_0x75ca[_0x3776('0x6')]),_0x75ca);utils[_0x3776('0x3')](util[_0x3776('0x4')](_0x3776('0x11'),_0x75ca['uniqueid'],_0x75ca[_0x3776('0x12')],_0x75ca['appdata']));if(_0x75ca[_0x3776('0x12')][_0x3776('0x13')]()=='set'&&_[_0x3776('0x14')](_0x75ca[_0x3776('0x15')][_0x3776('0x13')](),_0x3776('0x16'))){var _0x190a15=_0x75ca[_0x3776('0x15')][_0x3776('0x17')]('=');dials[_0x75ca[_0x3776('0x6')]]={'routeId':_0x190a15[0x1]};}}catch(_0x31b985){utils[_0x3776('0x18')](util[_0x3776('0x4')]('[%s][dials][newexten]',_0x75ca[_0x3776('0x6')]),_0x31b985);}};exports[_0x3776('0x19')]=function(_0x1be08f){try{utils[_0x3776('0xf')](util[_0x3776('0x4')](_0x3776('0x1a'),_0x1be08f[_0x3776('0x6')]),_0x1be08f);if(!_[_0x3776('0x1b')](_0x1be08f[_0x3776('0x1c')][_0x3776('0x1d')])){utils[_0x3776('0x3')](util[_0x3776('0x4')]('[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s',_0x1be08f[_0x3776('0x6')],_0x1be08f[_0x3776('0x1e')]));dials[_0x1be08f['uniqueid']]={'routeId':_0x1be08f['value']};}}catch(_0x2b01f4){utils[_0x3776('0x18')](util[_0x3776('0x4')](_0x3776('0x1a'),_0x1be08f[_0x3776('0x6')]),_0x2b01f4);}};exports[_0x3776('0x1f')]=function(_0x213ec7){try{if(!_[_0x3776('0x1b')](dials[_0x213ec7[_0x3776('0x6')]])){utils[_0x3776('0xf')](util[_0x3776('0x4')](_0x3776('0x20'),_0x213ec7[_0x3776('0x6')]),_0x213ec7);dials[_0x213ec7[_0x3776('0x6')]]=_[_0x3776('0x21')](dials[_0x213ec7[_0x3776('0x6')]],_0x213ec7);dials[_0x213ec7[_0x3776('0x6')]][_0x3776('0x22')]=utils[_0x3776('0x23')]();dials[_0x213ec7[_0x3776('0x6')]][_0x3776('0x24')]=_0x3776('0x25');utils[_0x3776('0x3')](util[_0x3776('0x4')]('[%s][dials][hangup]\x20starttime:%s\x20lastevent:called',_0x213ec7[_0x3776('0x6')],dials[_0x213ec7[_0x3776('0x6')]][_0x3776('0x22')]));}}catch(_0xf1b964){utils[_0x3776('0x18')](util[_0x3776('0x4')](_0x3776('0x20'),_0x213ec7['uniqueid']),_0xf1b964);}};exports['dialend']=function(_0x3f2e75){try{if(!_['isNil'](dials[_0x3f2e75[_0x3776('0x6')]])){utils['debug'](util[_0x3776('0x4')]('[%s][dials][dialend]',_0x3f2e75[_0x3776('0x6')]),_0x3f2e75);dials[_0x3f2e75[_0x3776('0x6')]][_0x3776('0xb')]=_0x3f2e75['dialstatus'];if(_0x3f2e75[_0x3776('0xb')]==_0x3776('0x26')){dials[_0x3f2e75['uniqueid']]=_[_0x3776('0x21')](dials[_0x3f2e75[_0x3776('0x6')]],_0x3f2e75);dials[_0x3f2e75[_0x3776('0x6')]]['answertime']=utils['now']();dials[_0x3f2e75[_0x3776('0x6')]]['lastevent']='connect';utils[_0x3776('0x3')](util[_0x3776('0x4')]('[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect',_0x3f2e75[_0x3776('0x6')],_0x3f2e75[_0x3776('0xb')],dials[_0x3f2e75[_0x3776('0x6')]]['answertime']));}else{utils[_0x3776('0x3')](util['format'](_0x3776('0x27'),_0x3f2e75[_0x3776('0x6')],_0x3f2e75[_0x3776('0xb')]));}}}catch(_0x2f89d1){utils['error'](util[_0x3776('0x4')](_0x3776('0x28'),_0x3f2e75[_0x3776('0x6')]),_0x2f89d1);}};exports[_0x3776('0x29')]=function(_0x4e8681){try{if(!_[_0x3776('0x1b')](dials[_0x4e8681[_0x3776('0x6')]])){utils[_0x3776('0xf')](util[_0x3776('0x4')]('[%s][dials][hangup]',_0x4e8681[_0x3776('0x6')]),_0x4e8681);utils['info'](util[_0x3776('0x4')](_0x3776('0x2a'),_0x4e8681[_0x3776('0x6')],_0x4e8681[_0x3776('0x9')],_0x4e8681[_0x3776('0x2b')],_0x4e8681[_0x3776('0x2c')]));dials[_0x4e8681[_0x3776('0x6')]]=_[_0x3776('0x21')](dials[_0x4e8681[_0x3776('0x6')]],{'endtime':utils['now'](),'lastevent':_0x3776('0x2d')});dials[_0x4e8681[_0x3776('0x6')]][_0x3776('0x2e')]=utils[_0x3776('0x2f')](dials[_0x4e8681['uniqueid']][_0x3776('0x30')],dials[_0x4e8681[_0x3776('0x6')]][_0x3776('0x22')]);dials[_0x4e8681[_0x3776('0x6')]][_0x3776('0x31')]=utils[_0x3776('0x2f')](dials[_0x4e8681[_0x3776('0x6')]]['answertime']||dials[_0x4e8681[_0x3776('0x6')]][_0x3776('0x30')],dials[_0x4e8681[_0x3776('0x6')]][_0x3776('0x22')]);dials[_0x4e8681[_0x3776('0x6')]]['billableseconds']=dials[_0x4e8681['uniqueid']][_0x3776('0x32')]?utils[_0x3776('0x2f')](dials[_0x4e8681[_0x3776('0x6')]][_0x3776('0x30')],dials[_0x4e8681[_0x3776('0x6')]]['answertime']):0x0;writeDB(dials[_0x4e8681[_0x3776('0x6')]]);}}catch(_0x32f2c4){utils[_0x3776('0x18')](util[_0x3776('0x4')](_0x3776('0x33'),_0x4e8681[_0x3776('0x6')]),_0x32f2c4);}}; \ No newline at end of file +var _0x9147=['[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','starttime','dialend','ANSWER','assign','answertime','now','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','[%s][dials][dialend]','hangup','[%s][dials][hangup]','calleridname','cause-txt','complete','diffTime','holdtime','endtime','billableseconds','lodash','util','./utils','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','calleridnum','connectedlinenum','dialstatus','request','debug','[%s][dials][newexten]','info','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','set','toLowerCase','split','error','varset','[%s][dials][varset]','isNil','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','lastevent','called'];(function(_0x25a857,_0x3a8373){var _0x1866a8=function(_0x5cdf9e){while(--_0x5cdf9e){_0x25a857['push'](_0x25a857['shift']());}};_0x1866a8(++_0x3a8373);}(_0x9147,0x1a4));var _0x7914=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0x9147[_0x2bf141];return _0x48277b;};'use strict';var _=require(_0x7914('0x0'));var util=require(_0x7914('0x1'));var utils=require(_0x7914('0x2'));var dials={};function writeDB(_0x91fda7){utils['info'](util[_0x7914('0x3')](_0x7914('0x4'),_0x91fda7[_0x7914('0x5')],_0x91fda7[_0x7914('0x6')],_0x91fda7['dialstring'],_0x91fda7[_0x7914('0x7')],_0x91fda7[_0x7914('0x8')],_0x91fda7[_0x7914('0x9')]));utils[_0x7914('0xa')]('CreateVoiceDialReport',_0x91fda7);delete dials[_0x91fda7[_0x7914('0x5')]];}exports['newexten']=function(_0x3e629e){try{utils[_0x7914('0xb')](util[_0x7914('0x3')](_0x7914('0xc'),_0x3e629e[_0x7914('0x5')]),_0x3e629e);utils[_0x7914('0xd')](util[_0x7914('0x3')](_0x7914('0xe'),_0x3e629e[_0x7914('0x5')],_0x3e629e[_0x7914('0xf')],_0x3e629e[_0x7914('0x10')]));if(_0x3e629e[_0x7914('0xf')]['toLowerCase']()==_0x7914('0x11')&&_['startsWith'](_0x3e629e[_0x7914('0x10')][_0x7914('0x12')](),'cdr(routeid)')){var _0x210ce1=_0x3e629e[_0x7914('0x10')][_0x7914('0x13')]('=');dials[_0x3e629e[_0x7914('0x5')]]={'routeId':_0x210ce1[0x1]};}}catch(_0x36fb94){utils[_0x7914('0x14')](util[_0x7914('0x3')](_0x7914('0xc'),_0x3e629e[_0x7914('0x5')]),_0x36fb94);}};exports[_0x7914('0x15')]=function(_0x398b62){try{utils[_0x7914('0xb')](util[_0x7914('0x3')](_0x7914('0x16'),_0x398b62[_0x7914('0x5')]),_0x398b62);if(!_[_0x7914('0x17')](_0x398b62['variable'][_0x7914('0x18')])){utils[_0x7914('0xd')](util[_0x7914('0x3')](_0x7914('0x19'),_0x398b62['uniqueid'],_0x398b62[_0x7914('0x1a')]));dials[_0x398b62[_0x7914('0x5')]]={'routeId':_0x398b62[_0x7914('0x1a')]};}}catch(_0x3ac6fc){utils['error'](util[_0x7914('0x3')](_0x7914('0x16'),_0x398b62[_0x7914('0x5')]),_0x3ac6fc);}};exports[_0x7914('0x1b')]=function(_0x4a626a){try{if(!_[_0x7914('0x17')](dials[_0x4a626a[_0x7914('0x5')]])){utils[_0x7914('0xb')](util[_0x7914('0x3')]('[%s][dials][dialbegin]',_0x4a626a[_0x7914('0x5')]),_0x4a626a);dials[_0x4a626a[_0x7914('0x5')]]=_['assign'](dials[_0x4a626a[_0x7914('0x5')]],_0x4a626a);dials[_0x4a626a[_0x7914('0x5')]]['starttime']=utils['now']();dials[_0x4a626a['uniqueid']][_0x7914('0x1c')]=_0x7914('0x1d');utils[_0x7914('0xd')](util[_0x7914('0x3')](_0x7914('0x1e'),_0x4a626a[_0x7914('0x5')],dials[_0x4a626a[_0x7914('0x5')]][_0x7914('0x1f')]));}}catch(_0x1fcb39){utils['error'](util[_0x7914('0x3')]('[%s][dials][dialbegin]',_0x4a626a[_0x7914('0x5')]),_0x1fcb39);}};exports[_0x7914('0x20')]=function(_0x2ca68f){try{if(!_['isNil'](dials[_0x2ca68f[_0x7914('0x5')]])){utils[_0x7914('0xb')](util[_0x7914('0x3')]('[%s][dials][dialend]',_0x2ca68f['uniqueid']),_0x2ca68f);dials[_0x2ca68f['uniqueid']]['dialstatus']=_0x2ca68f['dialstatus'];if(_0x2ca68f['dialstatus']==_0x7914('0x21')){dials[_0x2ca68f[_0x7914('0x5')]]=_[_0x7914('0x22')](dials[_0x2ca68f[_0x7914('0x5')]],_0x2ca68f);dials[_0x2ca68f[_0x7914('0x5')]][_0x7914('0x23')]=utils[_0x7914('0x24')]();dials[_0x2ca68f[_0x7914('0x5')]][_0x7914('0x1c')]=_0x7914('0x25');utils[_0x7914('0xd')](util[_0x7914('0x3')](_0x7914('0x26'),_0x2ca68f[_0x7914('0x5')],_0x2ca68f[_0x7914('0x9')],dials[_0x2ca68f[_0x7914('0x5')]][_0x7914('0x23')]));}else{utils['info'](util[_0x7914('0x3')](_0x7914('0x27'),_0x2ca68f[_0x7914('0x5')],_0x2ca68f[_0x7914('0x9')]));}}}catch(_0x37d05b){utils[_0x7914('0x14')](util[_0x7914('0x3')](_0x7914('0x28'),_0x2ca68f['uniqueid']),_0x37d05b);}};exports[_0x7914('0x29')]=function(_0x3b5cf8){try{if(!_[_0x7914('0x17')](dials[_0x3b5cf8[_0x7914('0x5')]])){utils[_0x7914('0xb')](util['format'](_0x7914('0x2a'),_0x3b5cf8[_0x7914('0x5')]),_0x3b5cf8);utils[_0x7914('0xd')](util[_0x7914('0x3')]('[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s',_0x3b5cf8['uniqueid'],_0x3b5cf8[_0x7914('0x7')],_0x3b5cf8[_0x7914('0x2b')],_0x3b5cf8[_0x7914('0x2c')]));dials[_0x3b5cf8[_0x7914('0x5')]]=_[_0x7914('0x22')](dials[_0x3b5cf8[_0x7914('0x5')]],{'endtime':utils[_0x7914('0x24')](),'lastevent':_0x7914('0x2d')});dials[_0x3b5cf8[_0x7914('0x5')]]['duration']=utils[_0x7914('0x2e')](dials[_0x3b5cf8['uniqueid']]['endtime'],dials[_0x3b5cf8[_0x7914('0x5')]][_0x7914('0x1f')]);dials[_0x3b5cf8[_0x7914('0x5')]][_0x7914('0x2f')]=utils['diffTime'](dials[_0x3b5cf8[_0x7914('0x5')]][_0x7914('0x23')]||dials[_0x3b5cf8[_0x7914('0x5')]][_0x7914('0x30')],dials[_0x3b5cf8[_0x7914('0x5')]][_0x7914('0x1f')]);dials[_0x3b5cf8[_0x7914('0x5')]][_0x7914('0x31')]=dials[_0x3b5cf8['uniqueid']][_0x7914('0x23')]?utils[_0x7914('0x2e')](dials[_0x3b5cf8[_0x7914('0x5')]][_0x7914('0x30')],dials[_0x3b5cf8[_0x7914('0x5')]][_0x7914('0x23')]):0x0;writeDB(dials[_0x3b5cf8[_0x7914('0x5')]]);}}catch(_0x429331){utils['error'](util[_0x7914('0x3')](_0x7914('0x2a'),_0x3b5cf8[_0x7914('0x5')]),_0x429331);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 35c6177..9842f5f 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 _0x33f0=['production','local','asterisk','port','username','password','keepConnected','info','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]','[%s][index][agentcalled]','uniqueid','agentcalled','[%s][index][agentringnoanswer]','agentringnoanswer','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','[%s][index][queuecallerleave]','queuecallerleave','[%s][index][musiconholdstart]','musiconholdstart','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','[%s][index][blindtransfer]','blindtransfer','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','util','xdr','disabled','env'];(function(_0xd17121,_0x143c48){var _0x13dc79=function(_0x75f311){while(--_0x75f311){_0xd17121['push'](_0xd17121['shift']());}};_0x13dc79(++_0x143c48);}(_0x33f0,0x117));var _0x033f=function(_0x2c1597,_0x431467){_0x2c1597=_0x2c1597-0x0;var _0x29f88c=_0x33f0[_0x2c1597];return _0x29f88c;};var AsteriskManager=require(_0x033f('0x0'));var config=require('../../config/environment');var utils=require('./utils');var util=require(_0x033f('0x1'));var isXDREnabled=config[_0x033f('0x2')]&&config[_0x033f('0x2')]['disabled']?!config['xdr'][_0x033f('0x3')]:!![];var isProduction=config[_0x033f('0x4')]===_0x033f('0x5')||![];var isLocalAsterisk=config[_0x033f('0x2')]&&config[_0x033f('0x2')][_0x033f('0x6')]===!![]||![];var ami=new AsteriskManager(config[_0x033f('0x7')][_0x033f('0x8')],config[_0x033f('0x7')]['ip'],config[_0x033f('0x7')][_0x033f('0x9')],config[_0x033f('0x7')][_0x033f('0xa')],!![]);ami[_0x033f('0xb')]();if(!isXDREnabled){utils['info']('XDR\x20DISABLED');}else if(!isProduction&&!isLocalAsterisk){utils[_0x033f('0xc')](_0x033f('0xd'));}else{var agents=require(_0x033f('0xe'));var calls=require(_0x033f('0xf'));var queues=require(_0x033f('0x10'));var recordings=require(_0x033f('0x11'));var members=require(_0x033f('0x12'));var dials=require(_0x033f('0x13'));var transfers=require(_0x033f('0x14'));var core=require(_0x033f('0x15'));ami['on'](_0x033f('0x16'),core[_0x033f('0x16')]);ami['on']('shutdown',core[_0x033f('0x17')]);ami['on']('fullybooted',core[_0x033f('0x18')]);ami['on'](_0x033f('0x19'),core[_0x033f('0x19')]);ami['on'](_0x033f('0x1a'),core[_0x033f('0x1a')]);ami['on'](_0x033f('0x1b'),core[_0x033f('0x1b')]);ami['on'](_0x033f('0x1c'),function(_0x4fd43b){try{utils[_0x033f('0x1d')](util[_0x033f('0x1e')](_0x033f('0x1f'),_0x4fd43b['device']),_0x4fd43b);members['devicestatechange'](_0x4fd43b);}catch(_0x884395){utils[_0x033f('0x19')](util[_0x033f('0x1e')]('[%s][index][devicestatechange]',_0x4fd43b['device']),_0x884395);}});ami['on']('agentcalled',function(_0x4699d8){try{utils[_0x033f('0x1d')](util[_0x033f('0x1e')](_0x033f('0x20'),_0x4699d8[_0x033f('0x21')]),_0x4699d8);agents[_0x033f('0x22')](_0x4699d8);}catch(_0x29569a){utils[_0x033f('0x19')](util[_0x033f('0x1e')]('[%s][index][agentcalled]',_0x4699d8['uniqueid']),_0x29569a);}});ami['on']('agentringnoanswer',function(_0x38bd49){try{utils[_0x033f('0x1d')](util['format'](_0x033f('0x23'),_0x38bd49[_0x033f('0x21')]),_0x38bd49);agents[_0x033f('0x24')](_0x38bd49);}catch(_0x5c2c32){utils[_0x033f('0x19')](util[_0x033f('0x1e')](_0x033f('0x23'),_0x38bd49[_0x033f('0x21')]),_0x5c2c32);}});ami['on'](_0x033f('0x25'),function(_0x655c5c){try{utils[_0x033f('0x1d')](util[_0x033f('0x1e')]('[%s][index][agentconnect]',_0x655c5c[_0x033f('0x21')]),_0x655c5c);agents[_0x033f('0x25')](_0x655c5c);queues[_0x033f('0x25')](_0x655c5c);}catch(_0x38c568){utils[_0x033f('0x19')](util[_0x033f('0x1e')](_0x033f('0x26'),_0x655c5c['uniqueid']),_0x38c568);}});ami['on'](_0x033f('0x27'),function(_0x57e1a3){try{utils[_0x033f('0x1d')](util[_0x033f('0x1e')](_0x033f('0x28'),_0x57e1a3[_0x033f('0x21')]),_0x57e1a3);agents[_0x033f('0x27')](_0x57e1a3);queues['agentcomplete'](_0x57e1a3);members['agentcomplete'](_0x57e1a3);}catch(_0x55090f){utils[_0x033f('0x19')](util['format'](_0x033f('0x28'),_0x57e1a3[_0x033f('0x21')]),_0x55090f);}});ami['on'](_0x033f('0x29'),function(_0x240e69){try{utils['debug'](util['format'](_0x033f('0x2a'),_0x240e69[_0x033f('0x21')]),_0x240e69);agents['queuecallerabandon'](_0x240e69);queues['queuecallerabandon'](_0x240e69);}catch(_0x128000){utils[_0x033f('0x19')](util[_0x033f('0x1e')](_0x033f('0x2a'),_0x240e69['uniqueid']),_0x128000);}});ami['on'](_0x033f('0x2b'),function(_0x256a07){try{utils[_0x033f('0x1d')](util[_0x033f('0x1e')]('[%s][index][queuecallerjoin]',_0x256a07[_0x033f('0x21')]),_0x256a07);queues[_0x033f('0x2b')](_0x256a07);recordings[_0x033f('0x2b')](_0x256a07);}catch(_0x27b342){utils[_0x033f('0x19')](util[_0x033f('0x1e')](_0x033f('0x2c'),_0x256a07[_0x033f('0x21')]),_0x27b342);}});ami['on']('queuecallerleave',function(_0x406b05){try{utils['debug'](util['format'](_0x033f('0x2d'),_0x406b05['uniqueid']),_0x406b05);queues[_0x033f('0x2e')](_0x406b05);}catch(_0x141019){utils['error'](util[_0x033f('0x1e')](_0x033f('0x2d'),_0x406b05['uniqueid']),_0x141019);}});ami['on']('musiconholdstart',function(_0x53b53f){try{utils['debug'](util['format'](_0x033f('0x2f'),_0x53b53f[_0x033f('0x21')]),_0x53b53f);queues[_0x033f('0x30')](_0x53b53f);calls[_0x033f('0x30')](_0x53b53f);}catch(_0x47f07e){utils[_0x033f('0x19')](util[_0x033f('0x1e')]('[%s][index][musiconholdstart]',_0x53b53f[_0x033f('0x21')]),_0x47f07e);}});ami['on'](_0x033f('0x31'),function(_0x5bebf8){try{utils[_0x033f('0x1d')](util[_0x033f('0x1e')](_0x033f('0x32'),_0x5bebf8[_0x033f('0x21')]),_0x5bebf8);queues[_0x033f('0x31')](_0x5bebf8);calls[_0x033f('0x31')](_0x5bebf8);}catch(_0x192cf7){utils[_0x033f('0x19')](util[_0x033f('0x1e')](_0x033f('0x32'),_0x5bebf8[_0x033f('0x21')]),_0x192cf7);}});ami['on']('newstate',function(_0xdf38ad){try{utils['debug'](util[_0x033f('0x1e')]('[%s][index][newstate]',_0xdf38ad[_0x033f('0x21')]),_0xdf38ad);calls['newstate'](_0xdf38ad);recordings[_0x033f('0x33')](_0xdf38ad);}catch(_0x180be3){utils['error'](util['format'](_0x033f('0x34'),_0xdf38ad[_0x033f('0x21')]),_0x180be3);}});ami['on'](_0x033f('0x35'),function(_0x257af0){try{utils[_0x033f('0x1d')](util['format'](_0x033f('0x36'),_0x257af0[_0x033f('0x21')]),_0x257af0);calls[_0x033f('0x35')](_0x257af0);recordings[_0x033f('0x35')](_0x257af0);dials[_0x033f('0x35')](_0x257af0);agents[_0x033f('0x35')](_0x257af0);queues[_0x033f('0x35')](_0x257af0);}catch(_0x36de5){utils[_0x033f('0x19')](util[_0x033f('0x1e')](_0x033f('0x36'),_0x257af0['uniqueid']),_0x36de5);}});ami['on'](_0x033f('0x37'),function(_0x583a0f){try{utils['debug'](util[_0x033f('0x1e')](_0x033f('0x38'),_0x583a0f[_0x033f('0x21')]),_0x583a0f);members[_0x033f('0x37')](_0x583a0f);}catch(_0x4abc96){utils[_0x033f('0x19')](util[_0x033f('0x1e')](_0x033f('0x38'),_0x583a0f['uniqueid']),_0x4abc96);}});ami['on']('blindtransfer',function(_0x18553d){try{utils['debug'](util[_0x033f('0x1e')](_0x033f('0x39'),_0x18553d[_0x033f('0x21')]),_0x18553d);queues[_0x033f('0x3a')](_0x18553d);agents[_0x033f('0x3a')](_0x18553d);transfers['blindtransfer'](_0x18553d);}catch(_0xe3be52){utils['error'](util[_0x033f('0x1e')]('[%s][index][blindtransfer]',_0x18553d[_0x033f('0x21')]),_0xe3be52);}});ami['on'](_0x033f('0x3b'),function(_0x429cea){try{utils[_0x033f('0x1d')](util[_0x033f('0x1e')](_0x033f('0x3c'),_0x429cea[_0x033f('0x3d')]),_0x429cea);queues[_0x033f('0x3b')](_0x429cea);transfers[_0x033f('0x3b')](_0x429cea);agents['attendedtransfer'](_0x429cea);calls['attendedtransfer'](_0x429cea);}catch(_0x42afbc){utils[_0x033f('0x19')](util['format'](_0x033f('0x3c'),_0x429cea[_0x033f('0x3d')]),_0x42afbc);}});ami['on'](_0x033f('0x3e'),function(_0x490c78){try{utils[_0x033f('0x1d')](util['format'](_0x033f('0x3f'),_0x490c78[_0x033f('0x21')]),_0x490c78);queues['varset'](_0x490c78);recordings['varset'](_0x490c78);calls[_0x033f('0x3e')](_0x490c78);dials[_0x033f('0x3e')](_0x490c78);}catch(_0x5e1b7c){utils[_0x033f('0x19')](util['format']('[%s][index][varset]',_0x490c78['uniqueid']),_0x5e1b7c);}});ami['on'](_0x033f('0x40'),function(_0x1c29a9){try{utils[_0x033f('0x1d')](util[_0x033f('0x1e')](_0x033f('0x41'),_0x1c29a9[_0x033f('0x21')]),_0x1c29a9);calls['newexten'](_0x1c29a9);recordings[_0x033f('0x40')](_0x1c29a9);dials[_0x033f('0x40')](_0x1c29a9);}catch(_0x5c6c06){utils[_0x033f('0x19')](util[_0x033f('0x1e')](_0x033f('0x41'),_0x1c29a9[_0x033f('0x21')]),_0x5c6c06);}});ami['on'](_0x033f('0x42'),function(_0x38073f){try{utils[_0x033f('0x1d')](util[_0x033f('0x1e')]('[%s][index][newchannel]',_0x38073f['uniqueid']),_0x38073f);calls[_0x033f('0x42')](_0x38073f);recordings[_0x033f('0x42')](_0x38073f);}catch(_0x4acab5){utils[_0x033f('0x19')](util[_0x033f('0x1e')]('[%s][index][newchannel]',_0x38073f[_0x033f('0x21')]),_0x4acab5);}});ami['on']('dialbegin',function(_0x461b59){try{utils[_0x033f('0x1d')](util[_0x033f('0x1e')](_0x033f('0x43'),_0x461b59['uniqueid']),_0x461b59);dials['dialbegin'](_0x461b59);}catch(_0x2a2dfc){utils[_0x033f('0x19')](util[_0x033f('0x1e')](_0x033f('0x44'),_0x461b59[_0x033f('0x21')]),_0x2a2dfc);}});ami['on'](_0x033f('0x45'),function(_0x20b62e){try{utils[_0x033f('0x1d')](util['format'](_0x033f('0x46'),_0x20b62e[_0x033f('0x21')]),_0x20b62e);dials[_0x033f('0x45')](_0x20b62e);}catch(_0x55892f){utils[_0x033f('0x19')](util[_0x033f('0x1e')](_0x033f('0x46'),_0x20b62e[_0x033f('0x21')]),_0x55892f);}});} \ No newline at end of file +var _0x51b6=['connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]','device','agentcalled','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','[%s][index][musiconholdstart]','musiconholdstart','musiconholdstop','[%s][index][musiconholdstop]','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','../../config/environment','util','xdr','disabled','env','production','local','asterisk','port','username','password','keepConnected','info','XDR\x20DISABLED','./queues.controller','./recordings.controller','./transfers.controller','./core.controller'];(function(_0x433cfe,_0x47ce1e){var _0x1843a8=function(_0x3685bb){while(--_0x3685bb){_0x433cfe['push'](_0x433cfe['shift']());}};_0x1843a8(++_0x47ce1e);}(_0x51b6,0x147));var _0x651b=function(_0x20e443,_0x45c3d6){_0x20e443=_0x20e443-0x0;var _0x5610f5=_0x51b6[_0x20e443];return _0x5610f5;};var AsteriskManager=require('asterisk-manager');var config=require(_0x651b('0x0'));var utils=require('./utils');var util=require(_0x651b('0x1'));var isXDREnabled=config[_0x651b('0x2')]&&config[_0x651b('0x2')][_0x651b('0x3')]?!config[_0x651b('0x2')][_0x651b('0x3')]:!![];var isProduction=config[_0x651b('0x4')]===_0x651b('0x5')||![];var isLocalAsterisk=config[_0x651b('0x2')]&&config['xdr'][_0x651b('0x6')]===!![]||![];var ami=new AsteriskManager(config[_0x651b('0x7')][_0x651b('0x8')],config[_0x651b('0x7')]['ip'],config['asterisk'][_0x651b('0x9')],config[_0x651b('0x7')][_0x651b('0xa')],!![]);ami[_0x651b('0xb')]();if(!isXDREnabled){utils[_0x651b('0xc')](_0x651b('0xd'));}else if(!isProduction&&!isLocalAsterisk){utils[_0x651b('0xc')]('Asterisk\x20disabled\x20on\x20localhost');}else{var agents=require('./agents.controller');var calls=require('./calls.controller');var queues=require(_0x651b('0xe'));var recordings=require(_0x651b('0xf'));var members=require('./members.controller');var dials=require('./dials.controller');var transfers=require(_0x651b('0x10'));var core=require(_0x651b('0x11'));ami['on'](_0x651b('0x12'),core[_0x651b('0x12')]);ami['on'](_0x651b('0x13'),core[_0x651b('0x13')]);ami['on'](_0x651b('0x14'),core['fullybooted']);ami['on'](_0x651b('0x15'),core['error']);ami['on'](_0x651b('0x16'),core[_0x651b('0x16')]);ami['on'](_0x651b('0x17'),core[_0x651b('0x17')]);ami['on'](_0x651b('0x18'),function(_0x41a753){try{utils[_0x651b('0x19')](util[_0x651b('0x1a')](_0x651b('0x1b'),_0x41a753[_0x651b('0x1c')]),_0x41a753);members[_0x651b('0x18')](_0x41a753);}catch(_0x567914){utils['error'](util['format'](_0x651b('0x1b'),_0x41a753[_0x651b('0x1c')]),_0x567914);}});ami['on'](_0x651b('0x1d'),function(_0x2e5274){try{utils[_0x651b('0x19')](util[_0x651b('0x1a')](_0x651b('0x1e'),_0x2e5274[_0x651b('0x1f')]),_0x2e5274);agents['agentcalled'](_0x2e5274);}catch(_0x4efcd3){utils[_0x651b('0x15')](util[_0x651b('0x1a')](_0x651b('0x1e'),_0x2e5274['uniqueid']),_0x4efcd3);}});ami['on'](_0x651b('0x20'),function(_0x32d8c2){try{utils['debug'](util[_0x651b('0x1a')](_0x651b('0x21'),_0x32d8c2[_0x651b('0x1f')]),_0x32d8c2);agents[_0x651b('0x20')](_0x32d8c2);}catch(_0x2751b8){utils[_0x651b('0x15')](util[_0x651b('0x1a')](_0x651b('0x21'),_0x32d8c2['uniqueid']),_0x2751b8);}});ami['on'](_0x651b('0x22'),function(_0x46642e){try{utils[_0x651b('0x19')](util[_0x651b('0x1a')](_0x651b('0x23'),_0x46642e[_0x651b('0x1f')]),_0x46642e);agents[_0x651b('0x22')](_0x46642e);queues[_0x651b('0x22')](_0x46642e);}catch(_0x1b0f5c){utils[_0x651b('0x15')](util[_0x651b('0x1a')](_0x651b('0x23'),_0x46642e[_0x651b('0x1f')]),_0x1b0f5c);}});ami['on']('agentcomplete',function(_0x4bfd7f){try{utils[_0x651b('0x19')](util['format']('[%s][index][agentcomplete]',_0x4bfd7f[_0x651b('0x1f')]),_0x4bfd7f);agents[_0x651b('0x24')](_0x4bfd7f);queues[_0x651b('0x24')](_0x4bfd7f);members[_0x651b('0x24')](_0x4bfd7f);}catch(_0x30e9fd){utils[_0x651b('0x15')](util[_0x651b('0x1a')](_0x651b('0x25'),_0x4bfd7f[_0x651b('0x1f')]),_0x30e9fd);}});ami['on'](_0x651b('0x26'),function(_0x2a7020){try{utils[_0x651b('0x19')](util['format'](_0x651b('0x27'),_0x2a7020[_0x651b('0x1f')]),_0x2a7020);agents[_0x651b('0x26')](_0x2a7020);queues['queuecallerabandon'](_0x2a7020);}catch(_0xf65f5f){utils[_0x651b('0x15')](util[_0x651b('0x1a')](_0x651b('0x27'),_0x2a7020[_0x651b('0x1f')]),_0xf65f5f);}});ami['on'](_0x651b('0x28'),function(_0x36ba08){try{utils[_0x651b('0x19')](util['format'](_0x651b('0x29'),_0x36ba08[_0x651b('0x1f')]),_0x36ba08);queues[_0x651b('0x28')](_0x36ba08);recordings[_0x651b('0x28')](_0x36ba08);}catch(_0x4a1c7d){utils['error'](util[_0x651b('0x1a')](_0x651b('0x29'),_0x36ba08[_0x651b('0x1f')]),_0x4a1c7d);}});ami['on'](_0x651b('0x2a'),function(_0x593286){try{utils[_0x651b('0x19')](util[_0x651b('0x1a')](_0x651b('0x2b'),_0x593286[_0x651b('0x1f')]),_0x593286);queues[_0x651b('0x2a')](_0x593286);}catch(_0x5e850f){utils['error'](util[_0x651b('0x1a')](_0x651b('0x2b'),_0x593286[_0x651b('0x1f')]),_0x5e850f);}});ami['on']('musiconholdstart',function(_0x4777cb){try{utils['debug'](util[_0x651b('0x1a')](_0x651b('0x2c'),_0x4777cb[_0x651b('0x1f')]),_0x4777cb);queues[_0x651b('0x2d')](_0x4777cb);calls['musiconholdstart'](_0x4777cb);}catch(_0xd8701c){utils[_0x651b('0x15')](util[_0x651b('0x1a')](_0x651b('0x2c'),_0x4777cb['uniqueid']),_0xd8701c);}});ami['on'](_0x651b('0x2e'),function(_0x98005e){try{utils['debug'](util[_0x651b('0x1a')]('[%s][index][musiconholdstop]',_0x98005e[_0x651b('0x1f')]),_0x98005e);queues[_0x651b('0x2e')](_0x98005e);calls[_0x651b('0x2e')](_0x98005e);}catch(_0x3caa21){utils[_0x651b('0x15')](util[_0x651b('0x1a')](_0x651b('0x2f'),_0x98005e[_0x651b('0x1f')]),_0x3caa21);}});ami['on']('newstate',function(_0x371f63){try{utils['debug'](util[_0x651b('0x1a')](_0x651b('0x30'),_0x371f63['uniqueid']),_0x371f63);calls['newstate'](_0x371f63);recordings['newstate'](_0x371f63);}catch(_0x4158dc){utils['error'](util['format'](_0x651b('0x30'),_0x371f63[_0x651b('0x1f')]),_0x4158dc);}});ami['on'](_0x651b('0x31'),function(_0x41c25b){try{utils[_0x651b('0x19')](util[_0x651b('0x1a')](_0x651b('0x32'),_0x41c25b[_0x651b('0x1f')]),_0x41c25b);calls[_0x651b('0x31')](_0x41c25b);recordings[_0x651b('0x31')](_0x41c25b);dials['hangup'](_0x41c25b);agents['hangup'](_0x41c25b);queues['hangup'](_0x41c25b);}catch(_0x44ae6b){utils[_0x651b('0x15')](util['format'](_0x651b('0x32'),_0x41c25b[_0x651b('0x1f')]),_0x44ae6b);}});ami['on'](_0x651b('0x33'),function(_0x283933){try{utils[_0x651b('0x19')](util[_0x651b('0x1a')](_0x651b('0x34'),_0x283933[_0x651b('0x1f')]),_0x283933);members[_0x651b('0x33')](_0x283933);}catch(_0x14e72a){utils['error'](util['format'](_0x651b('0x34'),_0x283933[_0x651b('0x1f')]),_0x14e72a);}});ami['on'](_0x651b('0x35'),function(_0x4b55bb){try{utils['debug'](util[_0x651b('0x1a')]('[%s][index][blindtransfer]',_0x4b55bb[_0x651b('0x1f')]),_0x4b55bb);queues['blindtransfer'](_0x4b55bb);agents[_0x651b('0x35')](_0x4b55bb);transfers[_0x651b('0x35')](_0x4b55bb);}catch(_0x1eb87b){utils[_0x651b('0x15')](util[_0x651b('0x1a')](_0x651b('0x36'),_0x4b55bb['uniqueid']),_0x1eb87b);}});ami['on'](_0x651b('0x37'),function(_0x5c604a){try{utils[_0x651b('0x19')](util[_0x651b('0x1a')](_0x651b('0x38'),_0x5c604a['origtransfereruniqueid']),_0x5c604a);queues[_0x651b('0x37')](_0x5c604a);transfers[_0x651b('0x37')](_0x5c604a);agents['attendedtransfer'](_0x5c604a);calls[_0x651b('0x37')](_0x5c604a);}catch(_0x6afc61){utils[_0x651b('0x15')](util[_0x651b('0x1a')](_0x651b('0x38'),_0x5c604a[_0x651b('0x39')]),_0x6afc61);}});ami['on'](_0x651b('0x3a'),function(_0x131b25){try{utils[_0x651b('0x19')](util['format'](_0x651b('0x3b'),_0x131b25['uniqueid']),_0x131b25);queues[_0x651b('0x3a')](_0x131b25);recordings['varset'](_0x131b25);calls[_0x651b('0x3a')](_0x131b25);dials[_0x651b('0x3a')](_0x131b25);}catch(_0x39a568){utils[_0x651b('0x15')](util[_0x651b('0x1a')](_0x651b('0x3b'),_0x131b25[_0x651b('0x1f')]),_0x39a568);}});ami['on'](_0x651b('0x3c'),function(_0x3262a0){try{utils['debug'](util[_0x651b('0x1a')](_0x651b('0x3d'),_0x3262a0[_0x651b('0x1f')]),_0x3262a0);calls[_0x651b('0x3c')](_0x3262a0);recordings[_0x651b('0x3c')](_0x3262a0);dials[_0x651b('0x3c')](_0x3262a0);}catch(_0x338d94){utils[_0x651b('0x15')](util[_0x651b('0x1a')](_0x651b('0x3d'),_0x3262a0[_0x651b('0x1f')]),_0x338d94);}});ami['on'](_0x651b('0x3e'),function(_0x3a26e4){try{utils[_0x651b('0x19')](util[_0x651b('0x1a')](_0x651b('0x3f'),_0x3a26e4[_0x651b('0x1f')]),_0x3a26e4);calls['newchannel'](_0x3a26e4);recordings[_0x651b('0x3e')](_0x3a26e4);}catch(_0x54eed2){utils[_0x651b('0x15')](util[_0x651b('0x1a')](_0x651b('0x3f'),_0x3a26e4[_0x651b('0x1f')]),_0x54eed2);}});ami['on'](_0x651b('0x40'),function(_0x3e99cb){try{utils[_0x651b('0x19')](util[_0x651b('0x1a')](_0x651b('0x41'),_0x3e99cb[_0x651b('0x1f')]),_0x3e99cb);dials[_0x651b('0x40')](_0x3e99cb);}catch(_0x433a19){utils[_0x651b('0x15')](util[_0x651b('0x1a')](_0x651b('0x42'),_0x3e99cb[_0x651b('0x1f')]),_0x433a19);}});ami['on'](_0x651b('0x43'),function(_0x46a8c0){try{utils[_0x651b('0x19')](util[_0x651b('0x1a')](_0x651b('0x44'),_0x46a8c0['uniqueid']),_0x46a8c0);dials[_0x651b('0x43')](_0x46a8c0);}catch(_0x32242c){utils[_0x651b('0x15')](util[_0x651b('0x1a')](_0x651b('0x44'),_0x46a8c0[_0x651b('0x1f')]),_0x32242c);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index d69e672..550bc76 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 _0x2e76=['interface','getUserByInterface','name','internal','request','CreateMemberReport','getUserByName','split','then','membername','error','some','startsWith','devicestatechange','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','voice','TALKING','now','agent','NOT_INUSE','isNil','exitAt','duration','diffTime','enterAt','agentcomplete','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','cdr','channel','data1','source','data3','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','type','[%s][members][cdr]','lodash','Local/_attended@transfer','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','data2'];(function(_0x3e91a9,_0x53c466){var _0x25c9ad=function(_0x69ee2d){while(--_0x69ee2d){_0x3e91a9['push'](_0x3e91a9['shift']());}};_0x25c9ad(++_0x53c466);}(_0x2e76,0x199));var _0x62e7=function(_0x2056c1,_0x1988ba){_0x2056c1=_0x2056c1-0x0;var _0x51c286=_0x2e76[_0x2056c1];return _0x51c286;};'use strict';var _=require(_0x62e7('0x0'));var util=require('util');var utils=require('./utils');var members={};var exclude=[_0x62e7('0x1'),'Queue:'];function writeDB(_0x35f3a7){utils[_0x62e7('0x2')](util[_0x62e7('0x3')](_0x62e7('0x4'),_0x35f3a7[_0x62e7('0x5')],_0x35f3a7['interface'],_0x35f3a7['channel'],_0x35f3a7[_0x62e7('0x6')],_0x35f3a7['membername'],_0x35f3a7['type']));if(_0x35f3a7[_0x62e7('0x7')]){utils[_0x62e7('0x8')](_0x35f3a7['interface'])['then'](function(_0x131265){if(_0x131265){_0x35f3a7['membername']=_0x131265[_0x62e7('0x9')];_0x35f3a7['internal']=_0x131265[_0x62e7('0xa')];utils[_0x62e7('0xb')](_0x62e7('0xc'),_0x35f3a7);}else{utils[_0x62e7('0xd')](_0x35f3a7[_0x62e7('0x7')][_0x62e7('0xe')]('/')[0x1])[_0x62e7('0xf')](function(_0x1ec99b){if(_0x1ec99b){_0x35f3a7[_0x62e7('0x10')]=_0x1ec99b[_0x62e7('0x9')];_0x35f3a7[_0x62e7('0xa')]=_0x1ec99b['internal'];utils[_0x62e7('0xb')](_0x62e7('0xc'),_0x35f3a7);}});}})['catch'](function(_0x2a9691){utils[_0x62e7('0x11')](util[_0x62e7('0x3')]('[%s][members][writeDB]',_0x35f3a7[_0x62e7('0x5')]),_0x2a9691);});}delete members[_0x35f3a7[_0x62e7('0x7')]];}function startsWith(_0x22f30d,_0x4c4378){return _[_0x62e7('0x12')](_0x22f30d,function(_0x692bff){return _[_0x62e7('0x13')](_0x4c4378,_0x692bff);});}exports[_0x62e7('0x14')]=function(_0x4fbce8){try{utils[_0x62e7('0x15')](util[_0x62e7('0x3')](_0x62e7('0x16'),members[_0x4fbce8[_0x62e7('0x17')]]?members[_0x4fbce8[_0x62e7('0x17')]]['uniqueid']:_0x4fbce8[_0x62e7('0x17')]),_0x4fbce8);utils[_0x62e7('0x2')](util[_0x62e7('0x3')](_0x62e7('0x18'),members[_0x4fbce8[_0x62e7('0x17')]]?members[_0x4fbce8[_0x62e7('0x17')]][_0x62e7('0x5')]:_0x4fbce8['device'],_0x4fbce8[_0x62e7('0x19')],_0x4fbce8[_0x62e7('0x17')]));switch(_0x4fbce8[_0x62e7('0x19')]){case _0x62e7('0x1a'):case _0x62e7('0x1b'):if(!startsWith(exclude,_0x4fbce8[_0x62e7('0x17')])){members[_0x4fbce8[_0x62e7('0x17')]]={'channel':_0x62e7('0x1c'),'interface':_0x4fbce8[_0x62e7('0x17')],'type':_0x62e7('0x1d'),'enterAt':utils[_0x62e7('0x1e')](),'role':_0x62e7('0x1f')};}break;case _0x62e7('0x20'):if(!_[_0x62e7('0x21')](members[_0x4fbce8['device']])){members[_0x4fbce8[_0x62e7('0x17')]][_0x62e7('0x22')]=utils[_0x62e7('0x1e')]();members[_0x4fbce8[_0x62e7('0x17')]][_0x62e7('0x23')]=utils[_0x62e7('0x24')](members[_0x4fbce8[_0x62e7('0x17')]][_0x62e7('0x22')],members[_0x4fbce8[_0x62e7('0x17')]][_0x62e7('0x25')]);if(members[_0x4fbce8[_0x62e7('0x17')]]['uniqueid']){writeDB(members[_0x4fbce8[_0x62e7('0x17')]]);}}break;default:break;}}catch(_0x36466e){utils[_0x62e7('0x11')](util[_0x62e7('0x3')](_0x62e7('0x16'),members[_0x4fbce8[_0x62e7('0x17')]]?members[_0x4fbce8['device']][_0x62e7('0x5')]:_0x4fbce8[_0x62e7('0x17')]),_0x36466e);}};exports[_0x62e7('0x26')]=function(_0x6f2e70){try{if(!_[_0x62e7('0x21')](members[_0x6f2e70[_0x62e7('0x7')]])){utils[_0x62e7('0x15')](util['format'](_0x62e7('0x27'),_0x6f2e70[_0x62e7('0x5')]),_0x6f2e70);utils['info'](util[_0x62e7('0x3')](_0x62e7('0x28'),_0x6f2e70[_0x62e7('0x5')],_0x6f2e70[_0x62e7('0x7')],_0x6f2e70[_0x62e7('0x29')]));members[_0x6f2e70[_0x62e7('0x7')]]=_[_0x62e7('0x2a')](members[_0x6f2e70['interface']],{'data4':_0x6f2e70[_0x62e7('0x29')],'uniqueid':_0x6f2e70['uniqueid']});}}catch(_0x4bb257){utils['error'](util['format']('[%s][members][agentcomplete]',_0x6f2e70['uniqueid']),_0x4bb257);}};exports[_0x62e7('0x2b')]=function(_0x1487f7){try{utils[_0x62e7('0x15')](util[_0x62e7('0x3')]('[%s][members][cdr]',_0x1487f7[_0x62e7('0x5')]),_0x1487f7);if(_0x1487f7[_0x62e7('0x2c')]){var _0x11b2e6=_0x1487f7[_0x62e7('0x2c')][_0x62e7('0xe')]('-')[0x0];if(!_[_0x62e7('0x21')](members[_0x11b2e6])){members[_0x11b2e6]=_['assign'](members[_0x11b2e6],{'data1':members[_0x11b2e6][_0x62e7('0x2d')]||_0x1487f7['type'],'data2':members[_0x11b2e6]['data2']||_0x1487f7[_0x62e7('0x2e')],'data3':members[_0x11b2e6][_0x62e7('0x2f')]||_0x1487f7['destination'],'uniqueid':members[_0x11b2e6][_0x62e7('0x5')]||_0x1487f7[_0x62e7('0x5')]});utils[_0x62e7('0x2')](util['format'](_0x62e7('0x30'),_0x1487f7[_0x62e7('0x5')],members[_0x11b2e6][_0x62e7('0x2d')],members[_0x11b2e6][_0x62e7('0x6')],members[_0x11b2e6][_0x62e7('0x2f')]));if(members[_0x11b2e6]['exitAt']){writeDB(members[_0x11b2e6]);}}}if(_0x1487f7[_0x62e7('0x31')]){var _0x35029e=_0x1487f7[_0x62e7('0x31')]['split']('-')[0x0];if(!_[_0x62e7('0x21')](members[_0x35029e])){members[_0x35029e]=_[_0x62e7('0x2a')](members[_0x35029e],{'data1':members[_0x35029e][_0x62e7('0x2d')]||_0x1487f7[_0x62e7('0x32')],'data2':members[_0x35029e]['data2']||_0x1487f7['source'],'data3':members[_0x35029e]['data3']||_0x1487f7['destination'],'uniqueid':members[_0x35029e][_0x62e7('0x5')]||_0x1487f7[_0x62e7('0x5')]});utils['info'](util[_0x62e7('0x3')](_0x62e7('0x30'),_0x1487f7['uniqueid'],members[_0x35029e][_0x62e7('0x2d')],members[_0x35029e][_0x62e7('0x6')],members[_0x35029e][_0x62e7('0x2f')]));if(members[_0x35029e][_0x62e7('0x22')]){writeDB(members[_0x35029e]);}}}}catch(_0x5805bd){utils[_0x62e7('0x11')](util[_0x62e7('0x3')](_0x62e7('0x33'),_0x1487f7['uniqueid']),_0x5805bd);}}; \ No newline at end of file +var _0x7868=['getUserByInterface','then','internal','request','name','CreateMemberReport','catch','error','format','devicestatechange','debug','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','TALKING','now','exitAt','duration','diffTime','[%s][members][devicestatechange]','isNil','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','assign','queue','cdr','[%s][members][cdr]','data1','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','split','lodash','./utils','Local/_attended@transfer','Queue:','info','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','data2','membername','type'];(function(_0x1e51f4,_0x506f6d){var _0x223c1d=function(_0x46dd51){while(--_0x46dd51){_0x1e51f4['push'](_0x1e51f4['shift']());}};_0x223c1d(++_0x506f6d);}(_0x7868,0x1c0));var _0x8786=function(_0x4a1fe1,_0x5845a4){_0x4a1fe1=_0x4a1fe1-0x0;var _0x400a52=_0x7868[_0x4a1fe1];return _0x400a52;};'use strict';var _=require(_0x8786('0x0'));var util=require('util');var utils=require(_0x8786('0x1'));var members={};var exclude=[_0x8786('0x2'),_0x8786('0x3')];function writeDB(_0x229022){utils[_0x8786('0x4')](util['format'](_0x8786('0x5'),_0x229022[_0x8786('0x6')],_0x229022[_0x8786('0x7')],_0x229022[_0x8786('0x8')],_0x229022[_0x8786('0x9')],_0x229022[_0x8786('0xa')],_0x229022[_0x8786('0xb')]));if(_0x229022[_0x8786('0x7')]){utils[_0x8786('0xc')](_0x229022[_0x8786('0x7')])[_0x8786('0xd')](function(_0x34e86e){if(_0x34e86e){_0x229022['membername']=_0x34e86e['name'];_0x229022[_0x8786('0xe')]=_0x34e86e[_0x8786('0xe')];utils[_0x8786('0xf')]('CreateMemberReport',_0x229022);}else{utils['getUserByName'](_0x229022[_0x8786('0x7')]['split']('/')[0x1])[_0x8786('0xd')](function(_0x16f1f9){if(_0x16f1f9){_0x229022[_0x8786('0xa')]=_0x16f1f9[_0x8786('0x10')];_0x229022[_0x8786('0xe')]=_0x16f1f9[_0x8786('0xe')];utils['request'](_0x8786('0x11'),_0x229022);}});}})[_0x8786('0x12')](function(_0x50d09d){utils[_0x8786('0x13')](util[_0x8786('0x14')]('[%s][members][writeDB]',_0x229022[_0x8786('0x6')]),_0x50d09d);});}delete members[_0x229022[_0x8786('0x7')]];}function startsWith(_0x44e19a,_0x438bad){return _['some'](_0x44e19a,function(_0x54d9f6){return _['startsWith'](_0x438bad,_0x54d9f6);});}exports[_0x8786('0x15')]=function(_0x450606){try{utils[_0x8786('0x16')](util[_0x8786('0x14')]('[%s][members][devicestatechange]',members[_0x450606[_0x8786('0x17')]]?members[_0x450606[_0x8786('0x17')]][_0x8786('0x6')]:_0x450606[_0x8786('0x17')]),_0x450606);utils[_0x8786('0x4')](util[_0x8786('0x14')](_0x8786('0x18'),members[_0x450606[_0x8786('0x17')]]?members[_0x450606[_0x8786('0x17')]]['uniqueid']:_0x450606[_0x8786('0x17')],_0x450606[_0x8786('0x19')],_0x450606[_0x8786('0x17')]));switch(_0x450606[_0x8786('0x19')]){case _0x8786('0x1a'):case'BUSY':if(!startsWith(exclude,_0x450606[_0x8786('0x17')])){members[_0x450606[_0x8786('0x17')]]={'channel':'voice','interface':_0x450606[_0x8786('0x17')],'type':_0x8786('0x1b'),'enterAt':utils[_0x8786('0x1c')](),'role':'agent'};}break;case'NOT_INUSE':if(!_['isNil'](members[_0x450606[_0x8786('0x17')]])){members[_0x450606[_0x8786('0x17')]][_0x8786('0x1d')]=utils['now']();members[_0x450606[_0x8786('0x17')]][_0x8786('0x1e')]=utils[_0x8786('0x1f')](members[_0x450606[_0x8786('0x17')]][_0x8786('0x1d')],members[_0x450606['device']]['enterAt']);if(members[_0x450606[_0x8786('0x17')]][_0x8786('0x6')]){writeDB(members[_0x450606[_0x8786('0x17')]]);}}break;default:break;}}catch(_0x91ee61){utils[_0x8786('0x13')](util[_0x8786('0x14')](_0x8786('0x20'),members[_0x450606[_0x8786('0x17')]]?members[_0x450606[_0x8786('0x17')]][_0x8786('0x6')]:_0x450606['device']),_0x91ee61);}};exports['agentcomplete']=function(_0x5966cb){try{if(!_[_0x8786('0x21')](members[_0x5966cb['interface']])){utils[_0x8786('0x16')](util[_0x8786('0x14')]('[%s][members][agentcomplete]',_0x5966cb[_0x8786('0x6')]),_0x5966cb);utils['info'](util[_0x8786('0x14')](_0x8786('0x22'),_0x5966cb[_0x8786('0x6')],_0x5966cb['interface'],_0x5966cb['queue']));members[_0x5966cb[_0x8786('0x7')]]=_[_0x8786('0x23')](members[_0x5966cb[_0x8786('0x7')]],{'data4':_0x5966cb[_0x8786('0x24')],'uniqueid':_0x5966cb['uniqueid']});}}catch(_0x28c862){utils[_0x8786('0x13')](util['format']('[%s][members][agentcomplete]',_0x5966cb[_0x8786('0x6')]),_0x28c862);}};exports[_0x8786('0x25')]=function(_0x39270c){try{utils[_0x8786('0x16')](util['format'](_0x8786('0x26'),_0x39270c[_0x8786('0x6')]),_0x39270c);if(_0x39270c['channel']){var _0x3d38bd=_0x39270c['channel']['split']('-')[0x0];if(!_[_0x8786('0x21')](members[_0x3d38bd])){members[_0x3d38bd]=_[_0x8786('0x23')](members[_0x3d38bd],{'data1':members[_0x3d38bd][_0x8786('0x27')]||_0x39270c['type'],'data2':members[_0x3d38bd][_0x8786('0x9')]||_0x39270c[_0x8786('0x28')],'data3':members[_0x3d38bd][_0x8786('0x29')]||_0x39270c[_0x8786('0x2a')],'uniqueid':members[_0x3d38bd]['uniqueid']||_0x39270c['uniqueid']});utils[_0x8786('0x4')](util[_0x8786('0x14')](_0x8786('0x2b'),_0x39270c[_0x8786('0x6')],members[_0x3d38bd][_0x8786('0x27')],members[_0x3d38bd][_0x8786('0x9')],members[_0x3d38bd]['data3']));if(members[_0x3d38bd][_0x8786('0x1d')]){writeDB(members[_0x3d38bd]);}}}if(_0x39270c[_0x8786('0x2c')]){var _0x689343=_0x39270c[_0x8786('0x2c')][_0x8786('0x2d')]('-')[0x0];if(!_[_0x8786('0x21')](members[_0x689343])){members[_0x689343]=_[_0x8786('0x23')](members[_0x689343],{'data1':members[_0x689343][_0x8786('0x27')]||_0x39270c[_0x8786('0xb')],'data2':members[_0x689343][_0x8786('0x9')]||_0x39270c[_0x8786('0x28')],'data3':members[_0x689343][_0x8786('0x29')]||_0x39270c['destination'],'uniqueid':members[_0x689343][_0x8786('0x6')]||_0x39270c[_0x8786('0x6')]});utils[_0x8786('0x4')](util[_0x8786('0x14')](_0x8786('0x2b'),_0x39270c[_0x8786('0x6')],members[_0x689343]['data1'],members[_0x689343][_0x8786('0x9')],members[_0x689343][_0x8786('0x29')]));if(members[_0x689343]['exitAt']){writeDB(members[_0x689343]);}}}}catch(_0x180b82){utils[_0x8786('0x13')](util[_0x8786('0x14')](_0x8786('0x26'),_0x39270c[_0x8786('0x6')]),_0x180b82);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 0663cb1..30d963c 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 _0xd829=['transfereduniqueid','queuecallerjoin','debug','info','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','now','hangup','isNil','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercompleteAt','queuecallerexitreason','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','error','[%s][queues][varset]','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandonAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','variable','queueposition','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','queuecallerexitAt','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','queuecallerleave','holdtime','diffTime','queuecallerjoinAt','count','[%s][queues][agentconnect]','destaccountcode','assigned','membername','agentcomplete','[%s][queues][agentcomplete]','queuecallercomplete','transfer','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','BLIND','transferexten','extension','transferuniqueid','BLINDTRANSFER','origtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererlinkedid','ATTENDED','origtransfererexten','ATTENDEDTRANSFER','origtransfererlinkedid','transfereelinkedid','transfertargetuniqueid','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','clone','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]','musiconholdstartAt','[%s][queues][musiconholdstart]','musiconholdstop','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','[%s][queues][musiconholdstop]','lodash','./utils','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','lastAssignedTo','calleridnum','accountcode','type','request'];(function(_0x29ce91,_0x444e01){var _0x483a8e=function(_0x58fbb2){while(--_0x58fbb2){_0x29ce91['push'](_0x29ce91['shift']());}};_0x483a8e(++_0x444e01);}(_0xd829,0xbc));var _0x9d82=function(_0x4190a7,_0x4bc4cb){_0x4190a7=_0x4190a7-0x0;var _0x4ad1d4=_0xd829[_0x4190a7];return _0x4ad1d4;};'use strict';var _=require(_0x9d82('0x0'));var util=require('util');var utils=require(_0x9d82('0x1'));var queues={};function writeDB(_0x2cce4a){utils['info'](util[_0x9d82('0x2')](_0x9d82('0x3'),_0x2cce4a[_0x9d82('0x4')],_0x2cce4a[_0x9d82('0x5')],_0x2cce4a[_0x9d82('0x6')],_0x2cce4a[_0x9d82('0x7')],_0x2cce4a[_0x9d82('0x8')],_0x2cce4a[_0x9d82('0x9')],_0x2cce4a['queuecallerexitreason']));if(_0x2cce4a[_0x9d82('0x6')]){utils['getVoiceQueueByName'](_0x2cce4a[_0x9d82('0x6')])['then'](function(_0x345176){if(_0x345176){_0x2cce4a[_0x9d82('0xa')]=_0x345176['type'];}utils[_0x9d82('0xb')]('CreateVoiceQueueReport',_0x2cce4a);});}else{utils['request']('CreateVoiceQueueReport',_0x2cce4a);}if(_0x2cce4a[_0x9d82('0xc')]){delete queues[_0x2cce4a[_0x9d82('0xc')]];}else{delete queues[_0x2cce4a['uniqueid']];}}exports[_0x9d82('0xd')]=function(_0x3f4086){try{utils[_0x9d82('0xe')](util[_0x9d82('0x2')]('[%s][queues][queuecallerjoin]',_0x3f4086['uniqueid']),_0x3f4086);utils[_0x9d82('0xf')](util['format'](_0x9d82('0x10'),_0x3f4086['uniqueid'],_0x3f4086['queue'],_0x3f4086[_0x9d82('0x11')]));queues[_0x3f4086[_0x9d82('0x4')]]=_['assign'](_0x3f4086,{'originalposition':_0x3f4086['position'],'queuecallerjoinAt':utils[_0x9d82('0x12')](),'mohtime':0x0});}catch(_0x513b4b){utils['error'](util['format']('[%s][queues][queuecallerjoin]',_0x3f4086[_0x9d82('0x4')]),_0x513b4b);}};exports[_0x9d82('0x13')]=function(_0x43a8f2){try{if(!_[_0x9d82('0x14')](queues[_0x43a8f2[_0x9d82('0x4')]])){utils[_0x9d82('0xe')](util[_0x9d82('0x2')](_0x9d82('0x15'),_0x43a8f2['uniqueid']),_0x43a8f2);if(queues[_0x43a8f2[_0x9d82('0x4')]][_0x9d82('0x16')]){if(!queues[_0x43a8f2[_0x9d82('0x4')]][_0x9d82('0x17')]&&!queues[_0x43a8f2[_0x9d82('0x4')]][_0x9d82('0x18')]){queues[_0x43a8f2['uniqueid']]['queuecallercomplete']=!![];queues[_0x43a8f2[_0x9d82('0x4')]][_0x9d82('0x19')]=utils[_0x9d82('0x12')]();queues[_0x43a8f2[_0x9d82('0x4')]][_0x9d82('0x1a')]=_0x9d82('0x1b');}utils[_0x9d82('0xf')](util[_0x9d82('0x2')](_0x9d82('0x1c'),_0x43a8f2[_0x9d82('0x4')],queues[_0x43a8f2[_0x9d82('0x4')]][_0x9d82('0x1d')],queues[_0x43a8f2['uniqueid']][_0x9d82('0x1a')]));writeDB(queues[_0x43a8f2['uniqueid']]);}else if(queues[_0x43a8f2['uniqueid']][_0x9d82('0xc')]){utils[_0x9d82('0xf')](util['format'](_0x9d82('0x1e'),_0x43a8f2[_0x9d82('0x4')],queues[_0x43a8f2[_0x9d82('0x4')]]['name'],queues[_0x43a8f2[_0x9d82('0x4')]][_0x9d82('0xc')]));queues[queues[_0x43a8f2[_0x9d82('0x4')]][_0x9d82('0xc')]]=queues[_0x43a8f2[_0x9d82('0x4')]];queues[queues[_0x43a8f2[_0x9d82('0x4')]][_0x9d82('0xc')]][_0x9d82('0x1f')]=0x2;delete queues[_0x43a8f2[_0x9d82('0x4')]];}}}catch(_0x5d2c89){utils[_0x9d82('0x20')](util[_0x9d82('0x2')]('[%s][queues][hangup]',_0x43a8f2['uniqueid']),_0x5d2c89);}};exports['varset']=function(_0x1a9e2a){try{utils[_0x9d82('0xe')](util['format'](_0x9d82('0x21'),_0x1a9e2a[_0x9d82('0x4')]),_0x1a9e2a);if(!_[_0x9d82('0x14')](_0x1a9e2a['variable'][_0x9d82('0x22')])&&_0x1a9e2a[_0x9d82('0x23')][_0x9d82('0x24')]()!==_0x9d82('0x25')){if(!_[_0x9d82('0x14')](queues[_0x1a9e2a['uniqueid']])){queues[_0x1a9e2a[_0x9d82('0x4')]][_0x9d82('0x17')]=![];queues[_0x1a9e2a[_0x9d82('0x4')]][_0x9d82('0x26')]=null;queues[_0x1a9e2a[_0x9d82('0x4')]]['queuecallerexit']=!![];queues[_0x1a9e2a[_0x9d82('0x4')]]['queuecallerexitAt']=utils[_0x9d82('0x12')]();queues[_0x1a9e2a[_0x9d82('0x4')]]['queuecallerexitreason']=_0x1a9e2a[_0x9d82('0x23')][_0x9d82('0x24')]();utils[_0x9d82('0xf')](util[_0x9d82('0x2')](_0x9d82('0x27'),_0x1a9e2a[_0x9d82('0x4')],queues[_0x1a9e2a[_0x9d82('0x4')]][_0x9d82('0x1d')],_0x1a9e2a[_0x9d82('0x23')],queues[_0x1a9e2a['uniqueid']][_0x9d82('0x1a')]));writeDB(queues[_0x1a9e2a[_0x9d82('0x4')]]);}}else if(!_[_0x9d82('0x14')](_0x1a9e2a[_0x9d82('0x28')][_0x9d82('0x29')])){if(!_[_0x9d82('0x14')](queues[_0x1a9e2a[_0x9d82('0x4')]])&&!queues[_0x1a9e2a[_0x9d82('0x4')]][_0x9d82('0x17')]){queues[_0x1a9e2a[_0x9d82('0x4')]][_0x9d82('0x17')]=![];queues[_0x1a9e2a['uniqueid']]['queuecallerabandonAt']=null;queues[_0x1a9e2a[_0x9d82('0x4')]][_0x9d82('0x18')]=!![];queues[_0x1a9e2a[_0x9d82('0x4')]]['queuecallerexitAt']=utils[_0x9d82('0x12')]();queues[_0x1a9e2a[_0x9d82('0x4')]]['queuecallerexitreason']=_0x9d82('0x2a');utils['info'](util[_0x9d82('0x2')](_0x9d82('0x2b'),_0x1a9e2a[_0x9d82('0x4')],queues[_0x1a9e2a[_0x9d82('0x4')]][_0x9d82('0x1d')],_0x1a9e2a['value'],queues[_0x1a9e2a['uniqueid']][_0x9d82('0x1a')]));}}}catch(_0x1b88bf){utils['error'](util['format'](_0x9d82('0x21'),_0x1a9e2a[_0x9d82('0x4')]),_0x1b88bf);}};exports[_0x9d82('0x17')]=function(_0x42c62a){try{if(!_[_0x9d82('0x14')](queues[_0x42c62a[_0x9d82('0x4')]])){utils['debug'](util['format']('[%s][queues][queuecallerabandon]',_0x42c62a[_0x9d82('0x4')]),_0x42c62a);queues[_0x42c62a[_0x9d82('0x4')]][_0x9d82('0x18')]=![];queues[_0x42c62a[_0x9d82('0x4')]][_0x9d82('0x2c')]=null;queues[_0x42c62a[_0x9d82('0x4')]][_0x9d82('0x17')]=!![];queues[_0x42c62a[_0x9d82('0x4')]][_0x9d82('0x26')]=utils['now']();queues[_0x42c62a[_0x9d82('0x4')]][_0x9d82('0x1a')]=_0x9d82('0x2d');utils['info'](util[_0x9d82('0x2')](_0x9d82('0x2e'),_0x42c62a[_0x9d82('0x4')],queues[_0x42c62a[_0x9d82('0x4')]][_0x9d82('0x1d')],queues[_0x42c62a[_0x9d82('0x4')]][_0x9d82('0x1a')]));}}catch(_0xc878c1){utils[_0x9d82('0x20')](util[_0x9d82('0x2')](_0x9d82('0x2f'),_0x42c62a['uniqueid']),_0xc878c1);}};exports['queuecallerleave']=function(_0x18baad){try{if(!_[_0x9d82('0x14')](queues[_0x18baad[_0x9d82('0x4')]])){utils[_0x9d82('0xe')](util[_0x9d82('0x2')](_0x9d82('0x30'),_0x18baad[_0x9d82('0x4')]),_0x18baad);utils[_0x9d82('0xf')](util[_0x9d82('0x2')](_0x9d82('0x31'),_0x18baad[_0x9d82('0x4')],queues[_0x18baad[_0x9d82('0x4')]][_0x9d82('0x1d')],_0x18baad[_0x9d82('0x32')],_0x18baad[_0x9d82('0x33')]));queues[_0x18baad[_0x9d82('0x4')]][_0x9d82('0x34')]=!![];queues[_0x18baad[_0x9d82('0x4')]][_0x9d82('0x16')]=utils[_0x9d82('0x12')]();queues[_0x18baad[_0x9d82('0x4')]][_0x9d82('0x35')]=utils[_0x9d82('0x36')](queues[_0x18baad[_0x9d82('0x4')]][_0x9d82('0x16')],queues[_0x18baad[_0x9d82('0x4')]][_0x9d82('0x37')]);queues[_0x18baad[_0x9d82('0x4')]][_0x9d82('0x11')]=_0x18baad[_0x9d82('0x11')];queues[_0x18baad[_0x9d82('0x4')]][_0x9d82('0x38')]=_0x18baad[_0x9d82('0x38')];queues[_0x18baad[_0x9d82('0x4')]][_0x9d82('0x32')]=_0x18baad['connectedlinenum'];queues[_0x18baad[_0x9d82('0x4')]][_0x9d82('0x33')]=_0x18baad['connectedlinename'];}}catch(_0x3d7a66){utils[_0x9d82('0x20')](util['format'](_0x9d82('0x30'),_0x18baad[_0x9d82('0x4')]),_0x3d7a66);}};exports['agentconnect']=function(_0x2bffa4){try{if(!_[_0x9d82('0x14')](queues[_0x2bffa4[_0x9d82('0x4')]])){utils[_0x9d82('0xe')](util['format'](_0x9d82('0x39'),_0x2bffa4['uniqueid']),_0x2bffa4);utils['info'](util['format']('[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s',_0x2bffa4['uniqueid'],queues[_0x2bffa4['uniqueid']][_0x9d82('0x1d')],_0x2bffa4['membername'],_0x2bffa4[_0x9d82('0x3a')]));queues[_0x2bffa4[_0x9d82('0x4')]][_0x9d82('0x17')]=![];queues[_0x2bffa4[_0x9d82('0x4')]][_0x9d82('0x17')]=![];queues[_0x2bffa4[_0x9d82('0x4')]][_0x9d82('0x26')]=null;queues[_0x2bffa4[_0x9d82('0x4')]][_0x9d82('0x18')]=![];queues[_0x2bffa4[_0x9d82('0x4')]][_0x9d82('0x1a')]=null;queues[_0x2bffa4[_0x9d82('0x4')]]['queuecallerexitAt']=null;queues[_0x2bffa4[_0x9d82('0x4')]][_0x9d82('0x3b')]=!![];queues[_0x2bffa4[_0x9d82('0x4')]][_0x9d82('0x9')]=_0x2bffa4[_0x9d82('0x3a')];queues[_0x2bffa4[_0x9d82('0x4')]][_0x9d82('0x7')]=_0x2bffa4[_0x9d82('0x3c')];}}catch(_0x22e8ba){utils[_0x9d82('0x20')](util[_0x9d82('0x2')](_0x9d82('0x39'),_0x2bffa4[_0x9d82('0x4')]),_0x22e8ba);}};exports[_0x9d82('0x3d')]=function(_0x7f970d){try{if(!_[_0x9d82('0x14')](queues[_0x7f970d[_0x9d82('0x4')]])){if(queues[_0x7f970d['uniqueid']][_0x9d82('0x16')]){utils[_0x9d82('0xe')](util[_0x9d82('0x2')](_0x9d82('0x3e'),_0x7f970d['uniqueid']),_0x7f970d);queues[_0x7f970d[_0x9d82('0x4')]][_0x9d82('0x17')]=![];queues[_0x7f970d['uniqueid']][_0x9d82('0x17')]=![];queues[_0x7f970d[_0x9d82('0x4')]][_0x9d82('0x26')]=null;queues[_0x7f970d['uniqueid']][_0x9d82('0x18')]=![];queues[_0x7f970d[_0x9d82('0x4')]][_0x9d82('0x2c')]=null;queues[_0x7f970d[_0x9d82('0x4')]][_0x9d82('0x3b')]=!![];queues[_0x7f970d[_0x9d82('0x4')]][_0x9d82('0x7')]=_0x7f970d[_0x9d82('0x3c')];queues[_0x7f970d['uniqueid']][_0x9d82('0x3f')]=!![];queues[_0x7f970d[_0x9d82('0x4')]][_0x9d82('0x19')]=utils[_0x9d82('0x12')]();if(_0x7f970d['reason']==_0x9d82('0x40')){if(!queues[_0x7f970d[_0x9d82('0x4')]][_0x9d82('0x40')]){queues[_0x7f970d[_0x9d82('0x4')]][_0x9d82('0x1a')]='TRANSFER';}}else{queues[_0x7f970d[_0x9d82('0x4')]][_0x9d82('0x1a')]=_0x9d82('0x41')+_0x7f970d['reason'][_0x9d82('0x24')]();}utils[_0x9d82('0xf')](util[_0x9d82('0x2')](_0x9d82('0x42'),_0x7f970d['uniqueid'],queues[_0x7f970d[_0x9d82('0x4')]][_0x9d82('0x1d')],_0x7f970d[_0x9d82('0x3c')],queues[_0x7f970d['uniqueid']][_0x9d82('0x1a')]));writeDB(queues[_0x7f970d[_0x9d82('0x4')]]);}}}catch(_0x1007af){utils[_0x9d82('0x20')](util[_0x9d82('0x2')](_0x9d82('0x3e'),_0x7f970d[_0x9d82('0x4')]),_0x1007af);}};exports[_0x9d82('0x43')]=function(_0x2e7c86){try{if(!_[_0x9d82('0x14')](queues[_0x2e7c86[_0x9d82('0x44')]])){utils[_0x9d82('0xe')](util[_0x9d82('0x2')](_0x9d82('0x45'),_0x2e7c86[_0x9d82('0x4')]),_0x2e7c86);queues[_0x2e7c86[_0x9d82('0x44')]][_0x9d82('0x40')]=!![];queues[_0x2e7c86['transfereeuniqueid']][_0x9d82('0x46')]=_0x9d82('0x47');queues[_0x2e7c86[_0x9d82('0x44')]][_0x9d82('0x48')]=_0x2e7c86[_0x9d82('0x49')];queues[_0x2e7c86[_0x9d82('0x44')]][_0x9d82('0x4a')]=_0x2e7c86[_0x9d82('0x44')];queues[_0x2e7c86['transfereeuniqueid']]['queuecallerexitreason']=_0x9d82('0x4b');utils[_0x9d82('0xf')](util[_0x9d82('0x2')]('[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER',_0x2e7c86[_0x9d82('0x4')],queues[_0x2e7c86['transfereeuniqueid']][_0x9d82('0x1d')],_0x2e7c86['transfereeuniqueid'],_0x2e7c86[_0x9d82('0x49')]));}}catch(_0x9fcfc3){utils['error'](util[_0x9d82('0x2')](_0x9d82('0x45'),_0x2e7c86[_0x9d82('0x4')]),_0x9fcfc3);}};exports['attendedtransfer']=function(_0x394646){try{utils['debug'](util[_0x9d82('0x2')]('[%s][queues][attendedtransfer]',_0x394646[_0x9d82('0x4c')]),_0x394646);if(_0x394646[_0x9d82('0x4c')]==_0x394646['origtransfererlinkedid']){if(!_[_0x9d82('0x14')](queues[_0x394646['secondtransfererlinkedid']])){utils[_0x9d82('0xf')](util['format'](_0x9d82('0x4d'),_0x394646[_0x9d82('0x4c')],queues[_0x394646[_0x9d82('0x4e')]][_0x9d82('0x1d')],_0x394646['origtransfererexten']));queues[_0x394646[_0x9d82('0x4e')]][_0x9d82('0x40')]=!![];queues[_0x394646[_0x9d82('0x4e')]][_0x9d82('0x46')]=_0x9d82('0x4f');queues[_0x394646['secondtransfererlinkedid']][_0x9d82('0x48')]=_0x394646[_0x9d82('0x50')];queues[_0x394646['secondtransfererlinkedid']][_0x9d82('0x4a')]=_0x394646[_0x9d82('0x4c')];queues[_0x394646[_0x9d82('0x4e')]][_0x9d82('0x1a')]=_0x9d82('0x51');}if(!_['isNil'](queues[_0x394646[_0x9d82('0x52')]])){if(_0x394646[_0x9d82('0x53')]&&queues[_0x394646[_0x9d82('0x53')]]){queues[_0x394646[_0x9d82('0x53')]]['queuecallerenterreason']=0x1;queues[_0x394646['transfereeuniqueid']]=_['clone'](queues[_0x394646[_0x9d82('0x53')]]);queues[_0x394646[_0x9d82('0x44')]][_0x9d82('0xc')]=_0x394646[_0x9d82('0x54')];queues[_0x394646['transfereeuniqueid']][_0x9d82('0x1f')]=0x2;queues[_0x394646[_0x9d82('0x44')]][_0x9d82('0x8')]=queues[_0x394646['secondtransfererlinkedid']]['calleridnum'];queues[_0x394646[_0x9d82('0x44')]][_0x9d82('0x55')]=queues[_0x394646[_0x9d82('0x4e')]][_0x9d82('0x55')];queues[_0x394646[_0x9d82('0x44')]][_0x9d82('0x37')]=utils['now']();queues[_0x394646['transfereeuniqueid']][_0x9d82('0x16')]=utils[_0x9d82('0x12')]();queues[_0x394646['transfereeuniqueid']][_0x9d82('0x35')]=0x0;queues[_0x394646['transfereeuniqueid']][_0x9d82('0x56')]=0x0;utils[_0x9d82('0xf')](util[_0x9d82('0x2')]('[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s',_0x394646[_0x9d82('0x4c')],queues[_0x394646['transfereeuniqueid']][_0x9d82('0x1d')],queues[_0x394646['transfereeuniqueid']][_0x9d82('0x8')],queues[_0x394646[_0x9d82('0x44')]][_0x9d82('0x55')]));}else{utils[_0x9d82('0xf')](util[_0x9d82('0x2')](_0x9d82('0x57'),_0x394646[_0x9d82('0x4c')],queues[_0x394646[_0x9d82('0x52')]]['name'],_0x394646[_0x9d82('0x4e')]));queues[_0x394646['origtransfererlinkedid']][_0x9d82('0xc')]=_0x394646[_0x9d82('0x4e')];}}}else if(_0x394646[_0x9d82('0x58')]==_0x394646[_0x9d82('0x4e')]){if(!_[_0x9d82('0x14')](queues[_0x394646['origtransfererlinkedid']])){utils[_0x9d82('0xf')](util['format'](_0x9d82('0x59'),_0x394646['origtransfereruniqueid'],queues[_0x394646[_0x9d82('0x52')]][_0x9d82('0x1d')],_0x394646[_0x9d82('0x58')],_0x394646[_0x9d82('0x5a')]));queues[_0x394646['origtransfererlinkedid']][_0x9d82('0x40')]=!![];queues[_0x394646[_0x9d82('0x52')]]['transfertype']=_0x9d82('0x4f');queues[_0x394646['origtransfererlinkedid']][_0x9d82('0x48')]=_0x394646[_0x9d82('0x5a')];queues[_0x394646[_0x9d82('0x52')]][_0x9d82('0x4a')]=_0x394646['secondtransfereruniqueid'];queues[_0x394646[_0x9d82('0x52')]][_0x9d82('0x1a')]=_0x9d82('0x51');}if(!_[_0x9d82('0x14')](queues[_0x394646['secondtransfererlinkedid']])){if(_0x394646[_0x9d82('0x5b')]&&queues[_0x394646[_0x9d82('0x5b')]]){queues[_0x394646[_0x9d82('0x5b')]]['queuecallerenterreason']=0x1;queues[_0x394646[_0x9d82('0x54')]]=_[_0x9d82('0x5c')](queues[_0x394646[_0x9d82('0x5b')]]);queues[_0x394646['transfertargetuniqueid']][_0x9d82('0xc')]=_0x394646[_0x9d82('0x54')];queues[_0x394646[_0x9d82('0x54')]][_0x9d82('0x1f')]=0x2;queues[_0x394646[_0x9d82('0x54')]]['calleridnum']=queues[_0x394646['origtransfererlinkedid']][_0x9d82('0x8')];queues[_0x394646[_0x9d82('0x54')]]['calleridname']=queues[_0x394646[_0x9d82('0x52')]][_0x9d82('0x55')];queues[_0x394646['transfertargetuniqueid']][_0x9d82('0x37')]=utils[_0x9d82('0x12')]();queues[_0x394646[_0x9d82('0x54')]][_0x9d82('0x16')]=utils[_0x9d82('0x12')]();queues[_0x394646[_0x9d82('0x54')]][_0x9d82('0x35')]=0x0;queues[_0x394646[_0x9d82('0x54')]][_0x9d82('0x56')]=0x0;utils[_0x9d82('0xf')](util[_0x9d82('0x2')](_0x9d82('0x5d'),_0x394646[_0x9d82('0x4c')],queues[_0x394646['transfertargetuniqueid']][_0x9d82('0x1d')],queues[_0x394646[_0x9d82('0x54')]]['transfereduniqueid'],queues[_0x394646[_0x9d82('0x54')]][_0x9d82('0x8')],queues[_0x394646[_0x9d82('0x54')]]['calleridname']));}else{utils[_0x9d82('0xf')](util[_0x9d82('0x2')](_0x9d82('0x57'),_0x394646[_0x9d82('0x4c')],queues[_0x394646[_0x9d82('0x4e')]][_0x9d82('0x1d')],_0x394646[_0x9d82('0x52')]));queues[_0x394646[_0x9d82('0x4e')]][_0x9d82('0xc')]=_0x394646['origtransfererlinkedid'];}}}}catch(_0x45f76a){utils[_0x9d82('0x20')](util[_0x9d82('0x2')](_0x9d82('0x5e'),_0x394646['origtransfereruniqueid']),_0x45f76a);}};exports['musiconholdstart']=function(_0x49d837){try{if(!_[_0x9d82('0x14')](queues[_0x49d837[_0x9d82('0x4')]])){utils[_0x9d82('0xe')](util[_0x9d82('0x2')]('[%s][queues][musiconholdstart]',_0x49d837['uniqueid']),_0x49d837);queues[_0x49d837[_0x9d82('0x4')]][_0x9d82('0x5f')]=utils['now']();utils[_0x9d82('0xf')](util[_0x9d82('0x2')]('[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s',_0x49d837[_0x9d82('0x4')],queues[_0x49d837[_0x9d82('0x4')]]['name'],queues[_0x49d837[_0x9d82('0x4')]][_0x9d82('0x5f')]));}}catch(_0x3e9f97){utils['error'](util['format'](_0x9d82('0x60'),_0x49d837['uniqueid']),_0x3e9f97);}};exports[_0x9d82('0x61')]=function(_0x4f9fb5){try{if(!_[_0x9d82('0x14')](queues[_0x4f9fb5[_0x9d82('0x4')]])){if(!_[_0x9d82('0x14')](queues[_0x4f9fb5['uniqueid']][_0x9d82('0x5f')])){utils[_0x9d82('0xe')](util[_0x9d82('0x2')]('[%s][queues][musiconholdstop]',_0x4f9fb5[_0x9d82('0x4')]),_0x4f9fb5);queues[_0x4f9fb5[_0x9d82('0x4')]][_0x9d82('0x56')]+=utils[_0x9d82('0x36')](utils[_0x9d82('0x12')](),queues[_0x4f9fb5[_0x9d82('0x4')]]['musiconholdstartAt']);utils[_0x9d82('0xf')](util['format'](_0x9d82('0x62'),_0x4f9fb5[_0x9d82('0x4')],queues[_0x4f9fb5[_0x9d82('0x4')]][_0x9d82('0x1d')],queues[_0x4f9fb5[_0x9d82('0x4')]][_0x9d82('0x56')]));delete queues[_0x4f9fb5[_0x9d82('0x4')]][_0x9d82('0x5f')];}}}catch(_0x273297){utils[_0x9d82('0x20')](util[_0x9d82('0x2')](_0x9d82('0x63'),_0x4f9fb5[_0x9d82('0x4')]),_0x273297);}}; \ No newline at end of file +var _0xb416=['transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','position','now','error','isNil','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','varset','[%s][queues][varset]','variable','value','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','connectedlinename','holdtime','diffTime','queuecallerjoinAt','count','connectedlinenum','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','agentcomplete','[%s][queues][agentcomplete]','reason','transfer','TRANSFER','COMPLETEDBY','[%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','origtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererlinkedid','origtransfererexten','ATTENDED','transferuniqueid','ATTENDEDTRANSFER','transfereelinkedid','queuecallerenterreason','clone','calleridname','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','secondtransfererexten','transfertargetlinkedid','transfertargetuniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','musiconholdstartAt','[%s][queues][musiconholdstart]','mohtime','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','[%s][queues][musiconholdstop]','lodash','util','./utils','info','format','uniqueid','channel','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','queue','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xb416,0x187));var _0x6b41=function(_0xc74a44,_0x14b7b9){_0xc74a44=_0xc74a44-0x0;var _0x1ba5c6=_0xb416[_0xc74a44];return _0x1ba5c6;};'use strict';var _=require(_0x6b41('0x0'));var util=require(_0x6b41('0x1'));var utils=require(_0x6b41('0x2'));var queues={};function writeDB(_0x39ee7e){utils[_0x6b41('0x3')](util[_0x6b41('0x4')]('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0x39ee7e[_0x6b41('0x5')],_0x39ee7e[_0x6b41('0x6')],_0x39ee7e['queue'],_0x39ee7e[_0x6b41('0x7')],_0x39ee7e[_0x6b41('0x8')],_0x39ee7e[_0x6b41('0x9')],_0x39ee7e[_0x6b41('0xa')]));if(_0x39ee7e[_0x6b41('0xb')]){utils[_0x6b41('0xc')](_0x39ee7e[_0x6b41('0xb')])[_0x6b41('0xd')](function(_0x3ae7e1){if(_0x3ae7e1){_0x39ee7e[_0x6b41('0xe')]=_0x3ae7e1[_0x6b41('0xe')];}utils[_0x6b41('0xf')]('CreateVoiceQueueReport',_0x39ee7e);});}else{utils[_0x6b41('0xf')](_0x6b41('0x10'),_0x39ee7e);}if(_0x39ee7e[_0x6b41('0x11')]){delete queues[_0x39ee7e[_0x6b41('0x11')]];}else{delete queues[_0x39ee7e[_0x6b41('0x5')]];}}exports[_0x6b41('0x12')]=function(_0x352d8f){try{utils[_0x6b41('0x13')](util[_0x6b41('0x4')](_0x6b41('0x14'),_0x352d8f[_0x6b41('0x5')]),_0x352d8f);utils[_0x6b41('0x3')](util[_0x6b41('0x4')]('[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s',_0x352d8f[_0x6b41('0x5')],_0x352d8f['queue'],_0x352d8f[_0x6b41('0x15')]));queues[_0x352d8f['uniqueid']]=_['assign'](_0x352d8f,{'originalposition':_0x352d8f[_0x6b41('0x15')],'queuecallerjoinAt':utils[_0x6b41('0x16')](),'mohtime':0x0});}catch(_0xbd0fba){utils[_0x6b41('0x17')](util[_0x6b41('0x4')](_0x6b41('0x14'),_0x352d8f['uniqueid']),_0xbd0fba);}};exports['hangup']=function(_0x4ab9ac){try{if(!_[_0x6b41('0x18')](queues[_0x4ab9ac['uniqueid']])){utils[_0x6b41('0x13')](util[_0x6b41('0x4')](_0x6b41('0x19'),_0x4ab9ac[_0x6b41('0x5')]),_0x4ab9ac);if(queues[_0x4ab9ac[_0x6b41('0x5')]][_0x6b41('0x1a')]){if(!queues[_0x4ab9ac['uniqueid']][_0x6b41('0x1b')]&&!queues[_0x4ab9ac[_0x6b41('0x5')]][_0x6b41('0x1c')]){queues[_0x4ab9ac['uniqueid']][_0x6b41('0x1d')]=!![];queues[_0x4ab9ac[_0x6b41('0x5')]][_0x6b41('0x1e')]=utils[_0x6b41('0x16')]();queues[_0x4ab9ac['uniqueid']]['queuecallerexitreason']=_0x6b41('0x1f');}utils[_0x6b41('0x3')](util[_0x6b41('0x4')](_0x6b41('0x20'),_0x4ab9ac[_0x6b41('0x5')],queues[_0x4ab9ac[_0x6b41('0x5')]]['name'],queues[_0x4ab9ac[_0x6b41('0x5')]][_0x6b41('0xa')]));writeDB(queues[_0x4ab9ac[_0x6b41('0x5')]]);}else if(queues[_0x4ab9ac[_0x6b41('0x5')]][_0x6b41('0x11')]){utils[_0x6b41('0x3')](util[_0x6b41('0x4')]('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0x4ab9ac[_0x6b41('0x5')],queues[_0x4ab9ac[_0x6b41('0x5')]][_0x6b41('0x21')],queues[_0x4ab9ac[_0x6b41('0x5')]][_0x6b41('0x11')]));queues[queues[_0x4ab9ac[_0x6b41('0x5')]]['transfereduniqueid']]=queues[_0x4ab9ac[_0x6b41('0x5')]];queues[queues[_0x4ab9ac['uniqueid']][_0x6b41('0x11')]]['queuecallerenterreason']=0x2;delete queues[_0x4ab9ac[_0x6b41('0x5')]];}}}catch(_0x5611a1){utils['error'](util[_0x6b41('0x4')](_0x6b41('0x19'),_0x4ab9ac[_0x6b41('0x5')]),_0x5611a1);}};exports[_0x6b41('0x22')]=function(_0x23ed6e){try{utils[_0x6b41('0x13')](util[_0x6b41('0x4')](_0x6b41('0x23'),_0x23ed6e[_0x6b41('0x5')]),_0x23ed6e);if(!_[_0x6b41('0x18')](_0x23ed6e[_0x6b41('0x24')]['queuestatus'])&&_0x23ed6e[_0x6b41('0x25')][_0x6b41('0x26')]()!==_0x6b41('0x27')){if(!_[_0x6b41('0x18')](queues[_0x23ed6e[_0x6b41('0x5')]])){queues[_0x23ed6e[_0x6b41('0x5')]][_0x6b41('0x1b')]=![];queues[_0x23ed6e[_0x6b41('0x5')]][_0x6b41('0x28')]=null;queues[_0x23ed6e[_0x6b41('0x5')]][_0x6b41('0x1c')]=!![];queues[_0x23ed6e['uniqueid']][_0x6b41('0x29')]=utils[_0x6b41('0x16')]();queues[_0x23ed6e[_0x6b41('0x5')]][_0x6b41('0xa')]=_0x23ed6e[_0x6b41('0x25')]['toUpperCase']();utils['info'](util[_0x6b41('0x4')](_0x6b41('0x2a'),_0x23ed6e[_0x6b41('0x5')],queues[_0x23ed6e['uniqueid']]['name'],_0x23ed6e[_0x6b41('0x25')],queues[_0x23ed6e['uniqueid']][_0x6b41('0xa')]));writeDB(queues[_0x23ed6e[_0x6b41('0x5')]]);}}else if(!_['isNil'](_0x23ed6e['variable'][_0x6b41('0x2b')])){if(!_[_0x6b41('0x18')](queues[_0x23ed6e['uniqueid']])&&!queues[_0x23ed6e[_0x6b41('0x5')]]['queuecallerabandon']){queues[_0x23ed6e[_0x6b41('0x5')]][_0x6b41('0x1b')]=![];queues[_0x23ed6e[_0x6b41('0x5')]][_0x6b41('0x28')]=null;queues[_0x23ed6e[_0x6b41('0x5')]]['queuecallerexit']=!![];queues[_0x23ed6e[_0x6b41('0x5')]][_0x6b41('0x29')]=utils[_0x6b41('0x16')]();queues[_0x23ed6e['uniqueid']][_0x6b41('0xa')]='EXITWITHKEY';utils[_0x6b41('0x3')](util[_0x6b41('0x4')]('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0x23ed6e[_0x6b41('0x5')],queues[_0x23ed6e['uniqueid']][_0x6b41('0x21')],_0x23ed6e[_0x6b41('0x25')],queues[_0x23ed6e[_0x6b41('0x5')]]['queuecallerexitreason']));}}}catch(_0x28781c){utils[_0x6b41('0x17')](util[_0x6b41('0x4')](_0x6b41('0x23'),_0x23ed6e['uniqueid']),_0x28781c);}};exports[_0x6b41('0x1b')]=function(_0x57335b){try{if(!_['isNil'](queues[_0x57335b['uniqueid']])){utils[_0x6b41('0x13')](util[_0x6b41('0x4')](_0x6b41('0x2c'),_0x57335b['uniqueid']),_0x57335b);queues[_0x57335b[_0x6b41('0x5')]][_0x6b41('0x1c')]=![];queues[_0x57335b[_0x6b41('0x5')]][_0x6b41('0x29')]=null;queues[_0x57335b['uniqueid']][_0x6b41('0x1b')]=!![];queues[_0x57335b[_0x6b41('0x5')]][_0x6b41('0x28')]=utils[_0x6b41('0x16')]();queues[_0x57335b[_0x6b41('0x5')]]['queuecallerexitreason']=_0x6b41('0x2d');utils[_0x6b41('0x3')](util[_0x6b41('0x4')](_0x6b41('0x2e'),_0x57335b[_0x6b41('0x5')],queues[_0x57335b[_0x6b41('0x5')]]['name'],queues[_0x57335b['uniqueid']][_0x6b41('0xa')]));}}catch(_0x108f35){utils[_0x6b41('0x17')](util['format']('[%s][queues][queuecallerabandon]',_0x57335b[_0x6b41('0x5')]),_0x108f35);}};exports[_0x6b41('0x2f')]=function(_0xeacf54){try{if(!_['isNil'](queues[_0xeacf54['uniqueid']])){utils[_0x6b41('0x13')](util[_0x6b41('0x4')](_0x6b41('0x30'),_0xeacf54[_0x6b41('0x5')]),_0xeacf54);utils[_0x6b41('0x3')](util['format']('[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0xeacf54['uniqueid'],queues[_0xeacf54[_0x6b41('0x5')]][_0x6b41('0x21')],_0xeacf54['connectedlinenum'],_0xeacf54[_0x6b41('0x31')]));queues[_0xeacf54['uniqueid']][_0x6b41('0x2f')]=!![];queues[_0xeacf54['uniqueid']][_0x6b41('0x1a')]=utils[_0x6b41('0x16')]();queues[_0xeacf54[_0x6b41('0x5')]][_0x6b41('0x32')]=utils[_0x6b41('0x33')](queues[_0xeacf54[_0x6b41('0x5')]]['queuecallerleaveAt'],queues[_0xeacf54[_0x6b41('0x5')]][_0x6b41('0x34')]);queues[_0xeacf54[_0x6b41('0x5')]]['position']=_0xeacf54[_0x6b41('0x15')];queues[_0xeacf54[_0x6b41('0x5')]]['count']=_0xeacf54[_0x6b41('0x35')];queues[_0xeacf54[_0x6b41('0x5')]][_0x6b41('0x36')]=_0xeacf54['connectedlinenum'];queues[_0xeacf54[_0x6b41('0x5')]][_0x6b41('0x31')]=_0xeacf54[_0x6b41('0x31')];}}catch(_0x1ecd8c){utils[_0x6b41('0x17')](util['format'](_0x6b41('0x30'),_0xeacf54[_0x6b41('0x5')]),_0x1ecd8c);}};exports['agentconnect']=function(_0x2074c9){try{if(!_[_0x6b41('0x18')](queues[_0x2074c9[_0x6b41('0x5')]])){utils[_0x6b41('0x13')](util[_0x6b41('0x4')](_0x6b41('0x37'),_0x2074c9['uniqueid']),_0x2074c9);utils['info'](util[_0x6b41('0x4')](_0x6b41('0x38'),_0x2074c9[_0x6b41('0x5')],queues[_0x2074c9[_0x6b41('0x5')]][_0x6b41('0x21')],_0x2074c9[_0x6b41('0x39')],_0x2074c9[_0x6b41('0x3a')]));queues[_0x2074c9[_0x6b41('0x5')]]['queuecallerabandon']=![];queues[_0x2074c9[_0x6b41('0x5')]][_0x6b41('0x1b')]=![];queues[_0x2074c9[_0x6b41('0x5')]]['queuecallerabandonAt']=null;queues[_0x2074c9[_0x6b41('0x5')]][_0x6b41('0x1c')]=![];queues[_0x2074c9[_0x6b41('0x5')]][_0x6b41('0xa')]=null;queues[_0x2074c9['uniqueid']][_0x6b41('0x29')]=null;queues[_0x2074c9['uniqueid']][_0x6b41('0x3b')]=!![];queues[_0x2074c9[_0x6b41('0x5')]][_0x6b41('0x9')]=_0x2074c9['destaccountcode'];queues[_0x2074c9[_0x6b41('0x5')]]['lastAssignedTo']=_0x2074c9[_0x6b41('0x39')];}}catch(_0x320abc){utils[_0x6b41('0x17')](util[_0x6b41('0x4')](_0x6b41('0x37'),_0x2074c9[_0x6b41('0x5')]),_0x320abc);}};exports[_0x6b41('0x3c')]=function(_0xbf733c){try{if(!_['isNil'](queues[_0xbf733c[_0x6b41('0x5')]])){if(queues[_0xbf733c[_0x6b41('0x5')]][_0x6b41('0x1a')]){utils[_0x6b41('0x13')](util[_0x6b41('0x4')](_0x6b41('0x3d'),_0xbf733c[_0x6b41('0x5')]),_0xbf733c);queues[_0xbf733c['uniqueid']][_0x6b41('0x1b')]=![];queues[_0xbf733c[_0x6b41('0x5')]][_0x6b41('0x1b')]=![];queues[_0xbf733c['uniqueid']][_0x6b41('0x28')]=null;queues[_0xbf733c[_0x6b41('0x5')]]['queuecallerexit']=![];queues[_0xbf733c[_0x6b41('0x5')]][_0x6b41('0x29')]=null;queues[_0xbf733c[_0x6b41('0x5')]][_0x6b41('0x3b')]=!![];queues[_0xbf733c['uniqueid']][_0x6b41('0x7')]=_0xbf733c[_0x6b41('0x39')];queues[_0xbf733c[_0x6b41('0x5')]]['queuecallercomplete']=!![];queues[_0xbf733c['uniqueid']][_0x6b41('0x1e')]=utils['now']();if(_0xbf733c[_0x6b41('0x3e')]==_0x6b41('0x3f')){if(!queues[_0xbf733c[_0x6b41('0x5')]]['transfer']){queues[_0xbf733c[_0x6b41('0x5')]][_0x6b41('0xa')]=_0x6b41('0x40');}}else{queues[_0xbf733c[_0x6b41('0x5')]][_0x6b41('0xa')]=_0x6b41('0x41')+_0xbf733c[_0x6b41('0x3e')][_0x6b41('0x26')]();}utils['info'](util[_0x6b41('0x4')](_0x6b41('0x42'),_0xbf733c['uniqueid'],queues[_0xbf733c['uniqueid']]['name'],_0xbf733c[_0x6b41('0x39')],queues[_0xbf733c[_0x6b41('0x5')]][_0x6b41('0xa')]));writeDB(queues[_0xbf733c[_0x6b41('0x5')]]);}}}catch(_0x1ba6a1){utils[_0x6b41('0x17')](util['format'](_0x6b41('0x3d'),_0xbf733c[_0x6b41('0x5')]),_0x1ba6a1);}};exports[_0x6b41('0x43')]=function(_0x529683){try{if(!_[_0x6b41('0x18')](queues[_0x529683[_0x6b41('0x44')]])){utils[_0x6b41('0x13')](util[_0x6b41('0x4')](_0x6b41('0x45'),_0x529683['uniqueid']),_0x529683);queues[_0x529683['transfereeuniqueid']][_0x6b41('0x3f')]=!![];queues[_0x529683[_0x6b41('0x44')]][_0x6b41('0x46')]=_0x6b41('0x47');queues[_0x529683[_0x6b41('0x44')]][_0x6b41('0x48')]=_0x529683[_0x6b41('0x49')];queues[_0x529683[_0x6b41('0x44')]]['transferuniqueid']=_0x529683[_0x6b41('0x44')];queues[_0x529683[_0x6b41('0x44')]][_0x6b41('0xa')]='BLINDTRANSFER';utils[_0x6b41('0x3')](util['format'](_0x6b41('0x4a'),_0x529683[_0x6b41('0x5')],queues[_0x529683[_0x6b41('0x44')]]['name'],_0x529683['transfereeuniqueid'],_0x529683['extension']));}}catch(_0x1173c7){utils[_0x6b41('0x17')](util[_0x6b41('0x4')](_0x6b41('0x45'),_0x529683[_0x6b41('0x5')]),_0x1173c7);}};exports[_0x6b41('0x4b')]=function(_0x525dbc){try{utils[_0x6b41('0x13')](util[_0x6b41('0x4')](_0x6b41('0x4c'),_0x525dbc[_0x6b41('0x4d')]),_0x525dbc);if(_0x525dbc[_0x6b41('0x4d')]==_0x525dbc[_0x6b41('0x4e')]){if(!_[_0x6b41('0x18')](queues[_0x525dbc['secondtransfererlinkedid']])){utils['info'](util[_0x6b41('0x4')](_0x6b41('0x4f'),_0x525dbc['origtransfereruniqueid'],queues[_0x525dbc[_0x6b41('0x50')]][_0x6b41('0x21')],_0x525dbc[_0x6b41('0x51')]));queues[_0x525dbc[_0x6b41('0x50')]][_0x6b41('0x3f')]=!![];queues[_0x525dbc[_0x6b41('0x50')]][_0x6b41('0x46')]=_0x6b41('0x52');queues[_0x525dbc[_0x6b41('0x50')]][_0x6b41('0x48')]=_0x525dbc['origtransfererexten'];queues[_0x525dbc['secondtransfererlinkedid']][_0x6b41('0x53')]=_0x525dbc['origtransfereruniqueid'];queues[_0x525dbc[_0x6b41('0x50')]][_0x6b41('0xa')]=_0x6b41('0x54');}if(!_[_0x6b41('0x18')](queues[_0x525dbc[_0x6b41('0x4e')]])){if(_0x525dbc['transfereelinkedid']&&queues[_0x525dbc[_0x6b41('0x55')]]){queues[_0x525dbc['transfereelinkedid']][_0x6b41('0x56')]=0x1;queues[_0x525dbc[_0x6b41('0x44')]]=_[_0x6b41('0x57')](queues[_0x525dbc[_0x6b41('0x55')]]);queues[_0x525dbc['transfereeuniqueid']][_0x6b41('0x11')]=_0x525dbc['transfertargetuniqueid'];queues[_0x525dbc[_0x6b41('0x44')]]['queuecallerenterreason']=0x2;queues[_0x525dbc['transfereeuniqueid']]['calleridnum']=queues[_0x525dbc[_0x6b41('0x50')]][_0x6b41('0x8')];queues[_0x525dbc['transfereeuniqueid']][_0x6b41('0x58')]=queues[_0x525dbc[_0x6b41('0x50')]][_0x6b41('0x58')];queues[_0x525dbc[_0x6b41('0x44')]]['queuecallerjoinAt']=utils['now']();queues[_0x525dbc['transfereeuniqueid']]['queuecallerleaveAt']=utils[_0x6b41('0x16')]();queues[_0x525dbc['transfereeuniqueid']][_0x6b41('0x32')]=0x0;queues[_0x525dbc[_0x6b41('0x44')]]['mohtime']=0x0;utils[_0x6b41('0x3')](util[_0x6b41('0x4')](_0x6b41('0x59'),_0x525dbc[_0x6b41('0x4d')],queues[_0x525dbc[_0x6b41('0x44')]][_0x6b41('0x21')],queues[_0x525dbc['transfereeuniqueid']][_0x6b41('0x8')],queues[_0x525dbc[_0x6b41('0x44')]]['calleridname']));}else{utils[_0x6b41('0x3')](util['format'](_0x6b41('0x5a'),_0x525dbc[_0x6b41('0x4d')],queues[_0x525dbc[_0x6b41('0x4e')]]['name'],_0x525dbc[_0x6b41('0x50')]));queues[_0x525dbc[_0x6b41('0x4e')]]['transfereduniqueid']=_0x525dbc[_0x6b41('0x50')];}}}else if(_0x525dbc[_0x6b41('0x5b')]==_0x525dbc['secondtransfererlinkedid']){if(!_[_0x6b41('0x18')](queues[_0x525dbc[_0x6b41('0x4e')]])){utils[_0x6b41('0x3')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x525dbc[_0x6b41('0x4d')],queues[_0x525dbc[_0x6b41('0x4e')]][_0x6b41('0x21')],_0x525dbc[_0x6b41('0x5b')],_0x525dbc['secondtransfererexten']));queues[_0x525dbc[_0x6b41('0x4e')]][_0x6b41('0x3f')]=!![];queues[_0x525dbc[_0x6b41('0x4e')]][_0x6b41('0x46')]=_0x6b41('0x52');queues[_0x525dbc[_0x6b41('0x4e')]][_0x6b41('0x48')]=_0x525dbc[_0x6b41('0x5c')];queues[_0x525dbc[_0x6b41('0x4e')]][_0x6b41('0x53')]=_0x525dbc['secondtransfereruniqueid'];queues[_0x525dbc[_0x6b41('0x4e')]][_0x6b41('0xa')]=_0x6b41('0x54');}if(!_[_0x6b41('0x18')](queues[_0x525dbc[_0x6b41('0x50')]])){if(_0x525dbc['transfertargetlinkedid']&&queues[_0x525dbc[_0x6b41('0x5d')]]){queues[_0x525dbc[_0x6b41('0x5d')]][_0x6b41('0x56')]=0x1;queues[_0x525dbc[_0x6b41('0x5e')]]=_[_0x6b41('0x57')](queues[_0x525dbc[_0x6b41('0x5d')]]);queues[_0x525dbc[_0x6b41('0x5e')]]['transfereduniqueid']=_0x525dbc[_0x6b41('0x5e')];queues[_0x525dbc[_0x6b41('0x5e')]][_0x6b41('0x56')]=0x2;queues[_0x525dbc[_0x6b41('0x5e')]]['calleridnum']=queues[_0x525dbc[_0x6b41('0x4e')]]['calleridnum'];queues[_0x525dbc[_0x6b41('0x5e')]][_0x6b41('0x58')]=queues[_0x525dbc[_0x6b41('0x4e')]]['calleridname'];queues[_0x525dbc[_0x6b41('0x5e')]]['queuecallerjoinAt']=utils['now']();queues[_0x525dbc[_0x6b41('0x5e')]]['queuecallerleaveAt']=utils['now']();queues[_0x525dbc[_0x6b41('0x5e')]][_0x6b41('0x32')]=0x0;queues[_0x525dbc[_0x6b41('0x5e')]]['mohtime']=0x0;utils[_0x6b41('0x3')](util['format'](_0x6b41('0x5f'),_0x525dbc[_0x6b41('0x4d')],queues[_0x525dbc[_0x6b41('0x5e')]][_0x6b41('0x21')],queues[_0x525dbc[_0x6b41('0x5e')]][_0x6b41('0x11')],queues[_0x525dbc[_0x6b41('0x5e')]]['calleridnum'],queues[_0x525dbc['transfertargetuniqueid']][_0x6b41('0x58')]));}else{utils['info'](util[_0x6b41('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x525dbc[_0x6b41('0x4d')],queues[_0x525dbc[_0x6b41('0x50')]]['name'],_0x525dbc[_0x6b41('0x4e')]));queues[_0x525dbc[_0x6b41('0x50')]]['transfereduniqueid']=_0x525dbc[_0x6b41('0x4e')];}}}}catch(_0x425e80){utils['error'](util[_0x6b41('0x4')](_0x6b41('0x4c'),_0x525dbc[_0x6b41('0x4d')]),_0x425e80);}};exports[_0x6b41('0x60')]=function(_0xa616c8){try{if(!_[_0x6b41('0x18')](queues[_0xa616c8[_0x6b41('0x5')]])){utils[_0x6b41('0x13')](util['format']('[%s][queues][musiconholdstart]',_0xa616c8[_0x6b41('0x5')]),_0xa616c8);queues[_0xa616c8[_0x6b41('0x5')]][_0x6b41('0x61')]=utils[_0x6b41('0x16')]();utils[_0x6b41('0x3')](util['format']('[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s',_0xa616c8[_0x6b41('0x5')],queues[_0xa616c8[_0x6b41('0x5')]]['name'],queues[_0xa616c8[_0x6b41('0x5')]][_0x6b41('0x61')]));}}catch(_0x4fcc7b){utils[_0x6b41('0x17')](util[_0x6b41('0x4')](_0x6b41('0x62'),_0xa616c8[_0x6b41('0x5')]),_0x4fcc7b);}};exports['musiconholdstop']=function(_0x2b79b5){try{if(!_[_0x6b41('0x18')](queues[_0x2b79b5[_0x6b41('0x5')]])){if(!_['isNil'](queues[_0x2b79b5[_0x6b41('0x5')]]['musiconholdstartAt'])){utils[_0x6b41('0x13')](util['format']('[%s][queues][musiconholdstop]',_0x2b79b5[_0x6b41('0x5')]),_0x2b79b5);queues[_0x2b79b5[_0x6b41('0x5')]][_0x6b41('0x63')]+=utils[_0x6b41('0x33')](utils[_0x6b41('0x16')](),queues[_0x2b79b5[_0x6b41('0x5')]][_0x6b41('0x61')]);utils[_0x6b41('0x3')](util[_0x6b41('0x4')](_0x6b41('0x64'),_0x2b79b5['uniqueid'],queues[_0x2b79b5[_0x6b41('0x5')]]['name'],queues[_0x2b79b5['uniqueid']][_0x6b41('0x63')]));delete queues[_0x2b79b5[_0x6b41('0x5')]][_0x6b41('0x61')];}}}catch(_0x99045a){utils[_0x6b41('0x17')](util[_0x6b41('0x4')](_0x6b41('0x65'),_0x2b79b5[_0x6b41('0x5')]),_0x99045a);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index e677a79..178897c 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 _0x6fc1=['accountcode','getUserByInternal','then','membername','name','UserId','CreateVoiceRecording','request','newchannel','debug','format','[%s][recordings][newchannel]','uniqueid','linkedid','info','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','exten','channel','error','newstate','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','context','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','[%s][recordings][newstate]','varset','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','endsWith','value','replace','.wav49','.WAV','find','monitors','hangup','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','connectedlinenum','connectedlinename','type','outbound','forEach','clone','[%s][recordings][hangup]','newexten','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr','substring','lastIndexOf','queuecallerjoin','queue','lodash','./utils','[%s][recordings][writeDB]'];(function(_0x4d8536,_0x4692b8){var _0x36297d=function(_0x1704f7){while(--_0x1704f7){_0x4d8536['push'](_0x4d8536['shift']());}};_0x36297d(++_0x4692b8);}(_0x6fc1,0xc0));var _0x16fc=function(_0x225352,_0x2686db){_0x225352=_0x225352-0x0;var _0x2288ea=_0x6fc1[_0x225352];return _0x2288ea;};'use strict';var _=require(_0x16fc('0x0'));var util=require('util');var utils=require(_0x16fc('0x1'));var recordings={};function writeDB(_0x423175){utils['info'](util['format'](_0x16fc('0x2'),_0x423175['uniqueid']));if(_0x423175[_0x16fc('0x3')]){utils[_0x16fc('0x4')](_0x423175[_0x16fc('0x3')])[_0x16fc('0x5')](function(_0x3051c6){if(_0x3051c6){_0x423175[_0x16fc('0x6')]=_0x3051c6[_0x16fc('0x7')];_0x423175[_0x16fc('0x8')]=_0x3051c6['id'];}utils['request'](_0x16fc('0x9'),_0x423175);});}else{utils[_0x16fc('0xa')](_0x16fc('0x9'),_0x423175);}}exports[_0x16fc('0xb')]=function(_0x1fcdb6){try{utils[_0x16fc('0xc')](util[_0x16fc('0xd')](_0x16fc('0xe'),_0x1fcdb6['uniqueid']),_0x1fcdb6);if(_0x1fcdb6[_0x16fc('0xf')]==_0x1fcdb6[_0x16fc('0x10')]){utils[_0x16fc('0x11')](util[_0x16fc('0xd')](_0x16fc('0x12'),_0x1fcdb6['uniqueid'],_0x1fcdb6['context'],_0x1fcdb6[_0x16fc('0x13')]));recordings[_0x1fcdb6[_0x16fc('0xf')]]={'uniqueid':_0x1fcdb6[_0x16fc('0xf')],'accountcode':_0x1fcdb6[_0x16fc('0x3')],'exten':_0x1fcdb6[_0x16fc('0x13')],'context':_0x1fcdb6['context'],'channel':_0x1fcdb6[_0x16fc('0x14')],'monitors':[]};}}catch(_0x5ec2e2){utils[_0x16fc('0x15')](util[_0x16fc('0xd')](_0x16fc('0xe'),_0x1fcdb6['uniqueid']),_0x5ec2e2);}};exports[_0x16fc('0x16')]=function(_0x504672){try{utils['debug'](util[_0x16fc('0xd')]('[%s][recordings][newstate]',_0x504672[_0x16fc('0xf')]),_0x504672);if(!_[_0x16fc('0x17')](recordings[_0x504672[_0x16fc('0xf')]])&&_0x504672[_0x16fc('0x18')]==0x6){utils[_0x16fc('0x11')](util[_0x16fc('0xd')](_0x16fc('0x19'),_0x504672[_0x16fc('0xf')],_0x504672[_0x16fc('0x1a')],_0x504672[_0x16fc('0x14')]));}else if(!_[_0x16fc('0x17')](recordings[_0x504672['linkedid']])&&_0x504672[_0x16fc('0x18')]==0x6&&_0x504672[_0x16fc('0x1a')]!=_0x16fc('0x1b')){utils[_0x16fc('0x11')](util['format'](_0x16fc('0x1c'),_0x504672['uniqueid'],_0x504672[_0x16fc('0x10')],_0x504672[_0x16fc('0x1a')],_0x504672[_0x16fc('0x14')]));recordings[_0x504672[_0x16fc('0x10')]][_0x16fc('0x3')]=_0x504672[_0x16fc('0x3')];}}catch(_0x41ca17){utils[_0x16fc('0x15')](util['format'](_0x16fc('0x1d'),_0x504672[_0x16fc('0xf')]),_0x41ca17);}};exports[_0x16fc('0x1e')]=function(_0xb2679f){try{if(!_[_0x16fc('0x17')](_0xb2679f[_0x16fc('0x1f')])&&!_[_0x16fc('0x17')](_0xb2679f[_0x16fc('0x1f')][_0x16fc('0x20')])){utils[_0x16fc('0xc')](util[_0x16fc('0xd')](_0x16fc('0x21'),_0xb2679f[_0x16fc('0xf')]),_0xb2679f);utils[_0x16fc('0x11')](util[_0x16fc('0xd')](_0x16fc('0x22'),_0xb2679f[_0x16fc('0xf')],_0xb2679f['variable'],_0xb2679f['value']));if(_[_0x16fc('0x23')](_0xb2679f['value'],'.wav49')){_0xb2679f[_0x16fc('0x24')]=_0xb2679f['value'][_0x16fc('0x25')](_0x16fc('0x26'),_0x16fc('0x27'));}if(recordings[_0xb2679f[_0x16fc('0x10')]]){var _0x28fb87=_[_0x16fc('0x28')](recordings[_0xb2679f[_0x16fc('0x10')]]['monitors'],{'value':_0xb2679f[_0x16fc('0x24')]});if(_['isNil'](_0x28fb87)){recordings[_0xb2679f['linkedid']][_0x16fc('0x29')]['push']({'value':_0xb2679f[_0x16fc('0x24')]});}}}}catch(_0x4dadf4){utils[_0x16fc('0x15')](util[_0x16fc('0xd')]('[%s][recordings][varset]',_0xb2679f[_0x16fc('0xf')]),_0x4dadf4);}};exports[_0x16fc('0x2a')]=function(_0x317f91){try{if(!_[_0x16fc('0x17')](recordings[_0x317f91[_0x16fc('0xf')]])){utils[_0x16fc('0xc')](util[_0x16fc('0xd')]('[%s][recordings][hangup]',_0x317f91[_0x16fc('0xf')]),_0x317f91);utils['info'](util[_0x16fc('0xd')](_0x16fc('0x2b'),_0x317f91[_0x16fc('0xf')],_0x317f91[_0x16fc('0x2c')],_0x317f91[_0x16fc('0x2d')],_0x317f91['cause-txt']));recordings[_0x317f91[_0x16fc('0xf')]][_0x16fc('0x2c')]=_0x317f91[_0x16fc('0x2c')];recordings[_0x317f91[_0x16fc('0xf')]]['calleridname']=_0x317f91['calleridname'];recordings[_0x317f91[_0x16fc('0xf')]][_0x16fc('0x2e')]=_0x317f91[_0x16fc('0x2e')];recordings[_0x317f91[_0x16fc('0xf')]][_0x16fc('0x2f')]=_0x317f91[_0x16fc('0x2f')];if(recordings[_0x317f91[_0x16fc('0xf')]][_0x16fc('0x30')]==_0x16fc('0x31')&&recordings[_0x317f91[_0x16fc('0xf')]][_0x16fc('0x3')]){recordings[_0x317f91[_0x16fc('0xf')]][_0x16fc('0x2e')]=recordings[_0x317f91[_0x16fc('0xf')]]['accountcode'];recordings[_0x317f91[_0x16fc('0xf')]][_0x16fc('0x2f')]='';}recordings[_0x317f91['uniqueid']][_0x16fc('0x29')][_0x16fc('0x32')](function(_0x18d079){var _0x7fc287=_[_0x16fc('0x33')](recordings[_0x317f91[_0x16fc('0xf')]]);_0x7fc287['value']=_0x18d079['value'];writeDB(_0x7fc287);});delete recordings[_0x317f91[_0x16fc('0xf')]];}}catch(_0x3c9168){utils[_0x16fc('0x15')](util[_0x16fc('0xd')](_0x16fc('0x34'),_0x317f91[_0x16fc('0xf')]),_0x3c9168);}};exports[_0x16fc('0x35')]=function(_0xbecf84){try{if(!_[_0x16fc('0x17')](recordings[_0xbecf84[_0x16fc('0xf')]])){utils['debug'](util[_0x16fc('0xd')]('[%s][recordings][newexten]',_0xbecf84['uniqueid']),_0xbecf84);utils['info'](util[_0x16fc('0xd')](_0x16fc('0x36'),_0xbecf84[_0x16fc('0xf')],_0xbecf84[_0x16fc('0x37')],_0xbecf84[_0x16fc('0x38')]));if(_0xbecf84[_0x16fc('0x37')][_0x16fc('0x39')]()==_0x16fc('0x3a')&&_[_0x16fc('0x3b')](_0xbecf84[_0x16fc('0x38')]['toLowerCase'](),_0x16fc('0x3c'))){var _0x289a10=_0xbecf84[_0x16fc('0x38')]['split']('=');var _0x424820=_0x289a10[0x0][_0x16fc('0x3d')](_0x289a10[0x0][_0x16fc('0x3e')]('(')+0x1,_0x289a10[0x0][_0x16fc('0x3e')](')'));var _0xaec7b6=_0x289a10[0x1];recordings[_0xbecf84[_0x16fc('0xf')]][_0x424820]=_0xaec7b6;}}}catch(_0x14a353){utils[_0x16fc('0x15')](util[_0x16fc('0xd')]('[%s][recordings][newexten]',_0xbecf84[_0x16fc('0xf')]),_0x14a353);}};exports[_0x16fc('0x3f')]=function(_0x1e4b87){try{if(!_[_0x16fc('0x17')](recordings[_0x1e4b87['uniqueid']])){utils['debug'](util[_0x16fc('0xd')]('[%s][recordings][queuecallerjoin]',_0x1e4b87[_0x16fc('0xf')]),_0x1e4b87);utils['info'](util[_0x16fc('0xd')]('[%s][recordings][queuecallerjoin]\x20queue:%s',_0x1e4b87[_0x16fc('0xf')],_0x1e4b87[_0x16fc('0x40')]));recordings[_0x1e4b87[_0x16fc('0xf')]]['queue']=_0x1e4b87[_0x16fc('0x40')];}}catch(_0x2bdefe){utils[_0x16fc('0x15')](util[_0x16fc('0xd')]('[%s][recordings][queuecallerjoin]',_0x1e4b87[_0x16fc('0xf')]),_0x2bdefe);}}; \ No newline at end of file +var _0x535d=['uniqueid','accountcode','getUserByInternal','then','membername','name','CreateVoiceRecording','request','newchannel','debug','format','[%s][recordings][newchannel]','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','error','newstate','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','variable','[%s][recordings][varset]','value','.wav49','replace','.WAV','find','monitors','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','clone','newexten','[%s][recordings][newexten]','application','appdata','set','startsWith','toLowerCase','cdr','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','util','./utils','info','[%s][recordings][writeDB]'];(function(_0x189b3b,_0x484de8){var _0x7c4721=function(_0x1ca32b){while(--_0x1ca32b){_0x189b3b['push'](_0x189b3b['shift']());}};_0x7c4721(++_0x484de8);}(_0x535d,0x1eb));var _0xd535=function(_0x1e90cb,_0x20466e){_0x1e90cb=_0x1e90cb-0x0;var _0x23d611=_0x535d[_0x1e90cb];return _0x23d611;};'use strict';var _=require(_0xd535('0x0'));var util=require(_0xd535('0x1'));var utils=require(_0xd535('0x2'));var recordings={};function writeDB(_0x288754){utils[_0xd535('0x3')](util['format'](_0xd535('0x4'),_0x288754[_0xd535('0x5')]));if(_0x288754[_0xd535('0x6')]){utils[_0xd535('0x7')](_0x288754[_0xd535('0x6')])[_0xd535('0x8')](function(_0x19126e){if(_0x19126e){_0x288754[_0xd535('0x9')]=_0x19126e[_0xd535('0xa')];_0x288754['UserId']=_0x19126e['id'];}utils['request'](_0xd535('0xb'),_0x288754);});}else{utils[_0xd535('0xc')](_0xd535('0xb'),_0x288754);}}exports[_0xd535('0xd')]=function(_0x349ba6){try{utils[_0xd535('0xe')](util[_0xd535('0xf')](_0xd535('0x10'),_0x349ba6[_0xd535('0x5')]),_0x349ba6);if(_0x349ba6[_0xd535('0x5')]==_0x349ba6[_0xd535('0x11')]){utils[_0xd535('0x3')](util[_0xd535('0xf')](_0xd535('0x12'),_0x349ba6[_0xd535('0x5')],_0x349ba6[_0xd535('0x13')],_0x349ba6[_0xd535('0x14')]));recordings[_0x349ba6[_0xd535('0x5')]]={'uniqueid':_0x349ba6[_0xd535('0x5')],'accountcode':_0x349ba6[_0xd535('0x6')],'exten':_0x349ba6[_0xd535('0x14')],'context':_0x349ba6[_0xd535('0x13')],'channel':_0x349ba6[_0xd535('0x15')],'monitors':[]};}}catch(_0x29f130){utils[_0xd535('0x16')](util[_0xd535('0xf')](_0xd535('0x10'),_0x349ba6[_0xd535('0x5')]),_0x29f130);}};exports[_0xd535('0x17')]=function(_0x35f5d0){try{utils['debug'](util['format'](_0xd535('0x18'),_0x35f5d0['uniqueid']),_0x35f5d0);if(!_[_0xd535('0x19')](recordings[_0x35f5d0['uniqueid']])&&_0x35f5d0[_0xd535('0x1a')]==0x6){utils[_0xd535('0x3')](util[_0xd535('0xf')](_0xd535('0x1b'),_0x35f5d0['uniqueid'],_0x35f5d0['context'],_0x35f5d0['channel']));}else if(!_[_0xd535('0x19')](recordings[_0x35f5d0['linkedid']])&&_0x35f5d0[_0xd535('0x1a')]==0x6&&_0x35f5d0[_0xd535('0x13')]!=_0xd535('0x1c')){utils['info'](util[_0xd535('0xf')](_0xd535('0x1d'),_0x35f5d0[_0xd535('0x5')],_0x35f5d0[_0xd535('0x11')],_0x35f5d0[_0xd535('0x13')],_0x35f5d0[_0xd535('0x15')]));recordings[_0x35f5d0['linkedid']][_0xd535('0x6')]=_0x35f5d0[_0xd535('0x6')];}}catch(_0x36c5f7){utils['error'](util[_0xd535('0xf')](_0xd535('0x18'),_0x35f5d0[_0xd535('0x5')]),_0x36c5f7);}};exports['varset']=function(_0x2f2a94){try{if(!_[_0xd535('0x19')](_0x2f2a94['variable'])&&!_[_0xd535('0x19')](_0x2f2a94[_0xd535('0x1e')]['mixmonitor_filename'])){utils[_0xd535('0xe')](util[_0xd535('0xf')](_0xd535('0x1f'),_0x2f2a94[_0xd535('0x5')]),_0x2f2a94);utils[_0xd535('0x3')](util[_0xd535('0xf')]('[%s][recordings][varset]\x20variable:%s\x20value:%s',_0x2f2a94[_0xd535('0x5')],_0x2f2a94['variable'],_0x2f2a94[_0xd535('0x20')]));if(_['endsWith'](_0x2f2a94[_0xd535('0x20')],_0xd535('0x21'))){_0x2f2a94[_0xd535('0x20')]=_0x2f2a94[_0xd535('0x20')][_0xd535('0x22')](_0xd535('0x21'),_0xd535('0x23'));}if(recordings[_0x2f2a94['linkedid']]){var _0x253c76=_[_0xd535('0x24')](recordings[_0x2f2a94[_0xd535('0x11')]][_0xd535('0x25')],{'value':_0x2f2a94['value']});if(_['isNil'](_0x253c76)){recordings[_0x2f2a94['linkedid']][_0xd535('0x25')]['push']({'value':_0x2f2a94[_0xd535('0x20')]});}}}}catch(_0x101846){utils['error'](util[_0xd535('0xf')]('[%s][recordings][varset]',_0x2f2a94[_0xd535('0x5')]),_0x101846);}};exports[_0xd535('0x26')]=function(_0x5cb6ff){try{if(!_[_0xd535('0x19')](recordings[_0x5cb6ff[_0xd535('0x5')]])){utils[_0xd535('0xe')](util[_0xd535('0xf')](_0xd535('0x27'),_0x5cb6ff[_0xd535('0x5')]),_0x5cb6ff);utils['info'](util[_0xd535('0xf')](_0xd535('0x28'),_0x5cb6ff[_0xd535('0x5')],_0x5cb6ff[_0xd535('0x29')],_0x5cb6ff[_0xd535('0x2a')],_0x5cb6ff[_0xd535('0x2b')]));recordings[_0x5cb6ff[_0xd535('0x5')]][_0xd535('0x29')]=_0x5cb6ff[_0xd535('0x29')];recordings[_0x5cb6ff[_0xd535('0x5')]][_0xd535('0x2a')]=_0x5cb6ff[_0xd535('0x2a')];recordings[_0x5cb6ff[_0xd535('0x5')]]['connectedlinenum']=_0x5cb6ff[_0xd535('0x2c')];recordings[_0x5cb6ff[_0xd535('0x5')]][_0xd535('0x2d')]=_0x5cb6ff[_0xd535('0x2d')];if(recordings[_0x5cb6ff[_0xd535('0x5')]][_0xd535('0x2e')]=='outbound'&&recordings[_0x5cb6ff[_0xd535('0x5')]][_0xd535('0x6')]){recordings[_0x5cb6ff[_0xd535('0x5')]][_0xd535('0x2c')]=recordings[_0x5cb6ff[_0xd535('0x5')]]['accountcode'];recordings[_0x5cb6ff[_0xd535('0x5')]][_0xd535('0x2d')]='';}recordings[_0x5cb6ff['uniqueid']][_0xd535('0x25')]['forEach'](function(_0x7f0a6e){var _0x52f658=_[_0xd535('0x2f')](recordings[_0x5cb6ff[_0xd535('0x5')]]);_0x52f658['value']=_0x7f0a6e[_0xd535('0x20')];writeDB(_0x52f658);});delete recordings[_0x5cb6ff[_0xd535('0x5')]];}}catch(_0x2f42df){utils[_0xd535('0x16')](util[_0xd535('0xf')](_0xd535('0x27'),_0x5cb6ff['uniqueid']),_0x2f42df);}};exports[_0xd535('0x30')]=function(_0x3358d3){try{if(!_[_0xd535('0x19')](recordings[_0x3358d3[_0xd535('0x5')]])){utils['debug'](util['format'](_0xd535('0x31'),_0x3358d3[_0xd535('0x5')]),_0x3358d3);utils[_0xd535('0x3')](util[_0xd535('0xf')]('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0x3358d3[_0xd535('0x5')],_0x3358d3[_0xd535('0x32')],_0x3358d3[_0xd535('0x33')]));if(_0x3358d3[_0xd535('0x32')]['toLowerCase']()==_0xd535('0x34')&&_[_0xd535('0x35')](_0x3358d3['appdata'][_0xd535('0x36')](),_0xd535('0x37'))){var _0x4c3bc3=_0x3358d3[_0xd535('0x33')]['split']('=');var _0x5315b2=_0x4c3bc3[0x0][_0xd535('0x38')](_0x4c3bc3[0x0][_0xd535('0x39')]('(')+0x1,_0x4c3bc3[0x0][_0xd535('0x39')](')'));var _0x52a0ab=_0x4c3bc3[0x1];recordings[_0x3358d3['uniqueid']][_0x5315b2]=_0x52a0ab;}}}catch(_0x3df3f9){utils['error'](util[_0xd535('0xf')]('[%s][recordings][newexten]',_0x3358d3[_0xd535('0x5')]),_0x3df3f9);}};exports[_0xd535('0x3a')]=function(_0x3f25a8){try{if(!_['isNil'](recordings[_0x3f25a8[_0xd535('0x5')]])){utils[_0xd535('0xe')](util[_0xd535('0xf')](_0xd535('0x3b'),_0x3f25a8[_0xd535('0x5')]),_0x3f25a8);utils[_0xd535('0x3')](util[_0xd535('0xf')](_0xd535('0x3c'),_0x3f25a8[_0xd535('0x5')],_0x3f25a8[_0xd535('0x3d')]));recordings[_0x3f25a8[_0xd535('0x5')]][_0xd535('0x3d')]=_0x3f25a8[_0xd535('0x3d')];}}catch(_0x3a96ce){utils['error'](util[_0xd535('0xf')]('[%s][recordings][queuecallerjoin]',_0x3f25a8[_0xd535('0x5')]),_0x3a96ce);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 1244719..2278309 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 _0x6d2d=['transferercalleridnum','transferercalleridname','transfereecalleridnum','blind','error','[%s][transfers][blindtransfer]','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridname','transfertargetcalleridnum','assign','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','isNil','transfereechannel','transfertargetchannel','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetexten','./utils','info','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','uniqueid','request','CreateVoiceTransferReport','debug','format','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s'];(function(_0x1b4002,_0x5b4094){var _0x1716f3=function(_0x47cfd1){while(--_0x47cfd1){_0x1b4002['push'](_0x1b4002['shift']());}};_0x1716f3(++_0x5b4094);}(_0x6d2d,0xbc));var _0xd6d2=function(_0x246cd3,_0x17306e){_0x246cd3=_0x246cd3-0x0;var _0x490a07=_0x6d2d[_0x246cd3];return _0x490a07;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0xd6d2('0x0'));function writeDB(_0x31b8e0){utils[_0xd6d2('0x1')](util['format'](_0xd6d2('0x2'),_0x31b8e0[_0xd6d2('0x3')]===_0xd6d2('0x4')?_0x31b8e0[_0xd6d2('0x5')]:_0x31b8e0[_0xd6d2('0x6')],_0x31b8e0[_0xd6d2('0x3')]));utils[_0xd6d2('0x7')](_0xd6d2('0x8'),_0x31b8e0);}exports['blindtransfer']=function(_0xd7f991){try{utils[_0xd6d2('0x9')](util[_0xd6d2('0xa')]('[%s][transfers][blindtransfer]',_0xd7f991[_0xd6d2('0x6')]),_0xd7f991);utils[_0xd6d2('0x1')](util[_0xd6d2('0xa')](_0xd6d2('0xb'),_0xd7f991[_0xd6d2('0x6')],_0xd7f991[_0xd6d2('0xc')],_0xd7f991[_0xd6d2('0xd')],_0xd7f991[_0xd6d2('0xe')],_0xd7f991['transfereecalleridname']));_0xd7f991[_0xd6d2('0x3')]=_0xd6d2('0xf');writeDB(_0xd7f991);}catch(_0x3e3704){utils[_0xd6d2('0x10')](util[_0xd6d2('0xa')](_0xd6d2('0x11'),_0xd7f991[_0xd6d2('0x6')]),_0x3e3704);}};exports['attendedtransfer']=function(_0xce1405){try{utils[_0xd6d2('0x9')](util[_0xd6d2('0xa')](_0xd6d2('0x12'),_0xce1405[_0xd6d2('0x5')]),_0xce1405);utils['info'](util[_0xd6d2('0xa')](_0xd6d2('0x13'),_0xce1405['origtransfereruniqueid'],_0xce1405['origtransferercalleridnum'],_0xce1405[_0xd6d2('0x14')],_0xce1405[_0xd6d2('0x15')],_0xce1405['transfertargetcalleridname']));_0xce1405=_[_0xd6d2('0x16')](_0xce1405,{'transfererchannel':_0xce1405[_0xd6d2('0x17')],'transferercalleridnum':_0xce1405['origtransferercalleridnum'],'transferercalleridname':_0xce1405[_0xd6d2('0x14')],'transfererconnectedlinenum':_0xce1405[_0xd6d2('0x18')],'transfererconnectedlinename':_0xce1405[_0xd6d2('0x19')],'transfereraccountcode':_0xce1405[_0xd6d2('0x1a')],'transferercontext':_0xce1405[_0xd6d2('0x1b')],'transfererexten':_0xce1405[_0xd6d2('0x1c')],'transfererlinkedid':_0xce1405[_0xd6d2('0x1d')],'context':_0xce1405[_0xd6d2('0x1e')],'extension':_0xce1405[_0xd6d2('0x1f')],'type':_0xd6d2('0x4')});if(_[_0xd6d2('0x20')](_0xce1405[_0xd6d2('0x21')])){_0xce1405=_[_0xd6d2('0x16')](_0xce1405,{'transfereechannel':_0xce1405[_0xd6d2('0x22')],'transfereecalleridnum':_0xce1405[_0xd6d2('0x15')],'transfereecalleridname':_0xce1405[_0xd6d2('0x23')],'transfereeconnectedlinenum':_0xce1405[_0xd6d2('0x24')],'transfereeconnectedlinename':_0xce1405[_0xd6d2('0x25')],'transfereeaccountcode':_0xce1405[_0xd6d2('0x26')],'transfereecontext':_0xce1405['transfertargetcontext'],'transfereeexten':_0xce1405[_0xd6d2('0x27')],'transfereelinkedid':_0xce1405['transfertargetlinkedid']});}writeDB(_0xce1405);}catch(_0x206a68){utils['error'](util['format'](_0xd6d2('0x12'),_0xce1405['origtransfereruniqueid']),_0x206a68);}}; \ No newline at end of file +var _0x3870=['./utils','info','[%s][transfers][writeDB]\x20type:%s','type','origtransfereruniqueid','uniqueid','CreateVoiceTransferReport','blindtransfer','debug','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridname','transfereecalleridnum','transfereecalleridname','blind','error','format','origtransferercalleridnum','transfertargetcalleridnum','assign','origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','attended','isNil','transfereechannel','transfertargetchannel','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetlinkedid','[%s][transfers][attendedtransfer]','lodash','util'];(function(_0x597484,_0x199340){var _0x218e64=function(_0x390d55){while(--_0x390d55){_0x597484['push'](_0x597484['shift']());}};_0x218e64(++_0x199340);}(_0x3870,0x146));var _0x0387=function(_0x358aaa,_0x5c240a){_0x358aaa=_0x358aaa-0x0;var _0x11c141=_0x3870[_0x358aaa];return _0x11c141;};'use strict';var _=require(_0x0387('0x0'));var util=require(_0x0387('0x1'));var utils=require(_0x0387('0x2'));function writeDB(_0x4ef6bd){utils[_0x0387('0x3')](util['format'](_0x0387('0x4'),_0x4ef6bd[_0x0387('0x5')]==='attended'?_0x4ef6bd[_0x0387('0x6')]:_0x4ef6bd[_0x0387('0x7')],_0x4ef6bd[_0x0387('0x5')]));utils['request'](_0x0387('0x8'),_0x4ef6bd);}exports[_0x0387('0x9')]=function(_0x3169b6){try{utils[_0x0387('0xa')](util['format'](_0x0387('0xb'),_0x3169b6[_0x0387('0x7')]),_0x3169b6);utils[_0x0387('0x3')](util['format'](_0x0387('0xc'),_0x3169b6['uniqueid'],_0x3169b6['transferercalleridnum'],_0x3169b6[_0x0387('0xd')],_0x3169b6[_0x0387('0xe')],_0x3169b6[_0x0387('0xf')]));_0x3169b6[_0x0387('0x5')]=_0x0387('0x10');writeDB(_0x3169b6);}catch(_0x5092c0){utils[_0x0387('0x11')](util[_0x0387('0x12')](_0x0387('0xb'),_0x3169b6['uniqueid']),_0x5092c0);}};exports['attendedtransfer']=function(_0x30e2d5){try{utils[_0x0387('0xa')](util['format']('[%s][transfers][attendedtransfer]',_0x30e2d5[_0x0387('0x6')]),_0x30e2d5);utils[_0x0387('0x3')](util[_0x0387('0x12')]('[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x30e2d5['origtransfereruniqueid'],_0x30e2d5[_0x0387('0x13')],_0x30e2d5['origtransferercalleridname'],_0x30e2d5[_0x0387('0x14')],_0x30e2d5['transfertargetcalleridname']));_0x30e2d5=_[_0x0387('0x15')](_0x30e2d5,{'transfererchannel':_0x30e2d5[_0x0387('0x16')],'transferercalleridnum':_0x30e2d5[_0x0387('0x13')],'transferercalleridname':_0x30e2d5[_0x0387('0x17')],'transfererconnectedlinenum':_0x30e2d5[_0x0387('0x18')],'transfererconnectedlinename':_0x30e2d5[_0x0387('0x19')],'transfereraccountcode':_0x30e2d5['origtransfereraccountcode'],'transferercontext':_0x30e2d5[_0x0387('0x1a')],'transfererexten':_0x30e2d5[_0x0387('0x1b')],'transfererlinkedid':_0x30e2d5[_0x0387('0x1c')],'context':_0x30e2d5[_0x0387('0x1d')],'extension':_0x30e2d5['origtransfererexten'],'type':_0x0387('0x1e')});if(_[_0x0387('0x1f')](_0x30e2d5[_0x0387('0x20')])){_0x30e2d5=_[_0x0387('0x15')](_0x30e2d5,{'transfereechannel':_0x30e2d5[_0x0387('0x21')],'transfereecalleridnum':_0x30e2d5[_0x0387('0x14')],'transfereecalleridname':_0x30e2d5[_0x0387('0x22')],'transfereeconnectedlinenum':_0x30e2d5[_0x0387('0x23')],'transfereeconnectedlinename':_0x30e2d5[_0x0387('0x24')],'transfereeaccountcode':_0x30e2d5[_0x0387('0x25')],'transfereecontext':_0x30e2d5[_0x0387('0x26')],'transfereeexten':_0x30e2d5['transfertargetexten'],'transfereelinkedid':_0x30e2d5[_0x0387('0x27')]});}writeDB(_0x30e2d5);}catch(_0x3c8331){utils[_0x0387('0x11')](util[_0x0387('0x12')](_0x0387('0x28'),_0x30e2d5['origtransfereruniqueid']),_0x3c8331);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 97bf152..fba8d22 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 _0x7370=['moment','util','client','http','../../config/logger','xdr','info','debug','error','request','then','[utils][request]\x20name:%s','inspect','catch','internal','name','interface','[utils][getUser]\x20where:%s','stringify','result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','[utils][getUserByInternal]','[utils][getUserByInterface]\x20interface:%s\x20%s','notfound','[utils][getUserByName]\x20name:%s\x20%s','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s\x20%s','addTime','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diff','sumTime','now','isAfter','isBefore','bluebird','jayson/promise'];(function(_0x389643,_0x2a8400){var _0x2f0aa3=function(_0x59235d){while(--_0x59235d){_0x389643['push'](_0x389643['shift']());}};_0x2f0aa3(++_0x2a8400);}(_0x7370,0x1e2));var _0x0737=function(_0x1c7ad0,_0x448315){_0x1c7ad0=_0x1c7ad0-0x0;var _0x27314b=_0x7370[_0x1c7ad0];return _0x27314b;};'use strict';var BPromise=require(_0x0737('0x0'));var jayson=require(_0x0737('0x1'));var moment=require(_0x0737('0x2'));var util=require(_0x0737('0x3'));var client=jayson[_0x0737('0x4')][_0x0737('0x5')]({'port':0x2329});var logger=require(_0x0737('0x6'))(_0x0737('0x7'));exports[_0x0737('0x8')]=function(_0x863f6c,_0x1c35fe){logger[_0x0737('0x8')](_0x863f6c,_0x1c35fe?util['inspect'](_0x1c35fe,{'showHidden':![],'depth':null}):'');};exports[_0x0737('0x9')]=function(_0xb44b81,_0x3e424a){logger[_0x0737('0x9')](_0xb44b81,_0x3e424a?util['inspect'](_0x3e424a,{'showHidden':![],'depth':null}):'');};exports[_0x0737('0xa')]=function(_0x1cff1b,_0x983a85){logger[_0x0737('0xa')](_0x1cff1b,_0x983a85?util['inspect'](_0x983a85,{'showHidden':![],'depth':null}):'');};exports['request']=function(_0x51c8ce,_0x48e355){return client[_0x0737('0xb')](_0x51c8ce,{'body':_0x48e355})[_0x0737('0xc')](function(_0x4592eb){logger[_0x0737('0x9')](_0x0737('0xd'),_0x51c8ce,_0x4592eb?util[_0x0737('0xe')](_0x4592eb,{'showHidden':![],'depth':null}):'');})[_0x0737('0xf')](function(_0x3f4bee){logger['error']('[utils][request]\x20name:%s',_0x51c8ce,_0x3f4bee?util[_0x0737('0xe')](_0x3f4bee,{'showHidden':![],'depth':null}):'');});};function getUser(_0xf72da){return client['request']('GetUser',{'options':{'raw':!![],'attributes':['id',_0x0737('0x10'),_0x0737('0x11'),_0x0737('0x12')],'where':_0xf72da,'limit':0x1}})[_0x0737('0xc')](function(_0x209f9f){logger[_0x0737('0x9')](_0x0737('0x13'),JSON[_0x0737('0x14')](_0xf72da),_0x209f9f?util[_0x0737('0xe')](_0x209f9f,{'showHidden':![],'depth':null}):'');return _0x209f9f[_0x0737('0x15')]['length']?_0x209f9f[_0x0737('0x15')][0x0]:null;});}exports[_0x0737('0x16')]=function(_0x449198){return new BPromise(function(_0x17c441,_0x3bc633){if(_0x449198){return getUser({'internal':_0x449198})['then'](function(_0x2cadd2){logger['info'](_0x0737('0x17'),_0x449198,_0x2cadd2?_0x0737('0x18'):'notfound');return _0x17c441(_0x2cadd2);})[_0x0737('0xf')](function(_0x34093c){logger[_0x0737('0xa')](_0x0737('0x19'),_0x34093c?util[_0x0737('0xe')](_0x34093c,{'showHidden':![],'depth':null}):'');return _0x17c441(null);});}return _0x17c441(null);});};exports['getUserByInterface']=function(_0x3e09da){return new BPromise(function(_0x59e7be,_0xa26f5b){if(_0x3e09da){return getUser({'interface':_0x3e09da})[_0x0737('0xc')](function(_0x371f62){logger['info'](_0x0737('0x1a'),_0x3e09da,_0x371f62?_0x0737('0x18'):_0x0737('0x1b'));return _0x59e7be(_0x371f62);})[_0x0737('0xf')](function(_0x5ef450){logger[_0x0737('0xa')]('[utils][getUserByInterface]',_0x5ef450?util[_0x0737('0xe')](_0x5ef450,{'showHidden':![],'depth':null}):'');return _0x59e7be(null);});}return _0x59e7be(null);});};exports['getUserByName']=function(_0x10cf86){return new BPromise(function(_0x463874,_0x150f3f){if(_0x10cf86){return getUser({'name':_0x10cf86})[_0x0737('0xc')](function(_0x6a0f41){logger[_0x0737('0x8')](_0x0737('0x1c'),_0x10cf86,_0x6a0f41?_0x0737('0x18'):_0x0737('0x1b'));return _0x463874(_0x6a0f41);})[_0x0737('0xf')](function(_0x11f233){logger['error']('[utils][getUserByName]',_0x11f233?util['inspect'](_0x11f233,{'showHidden':![],'depth':null}):'');return _0x463874(null);});}return _0x463874(null);});};exports['getVoiceQueueByName']=function(_0x161856){return new BPromise(function(_0x4b8886,_0xef0b39){if(_0x161856){return client[_0x0737('0xb')]('GetVoiceQueue',{'options':{'raw':!![],'attributes':['id','name',_0x0737('0x1d'),_0x0737('0x1e'),_0x0737('0x1f')],'where':{'name':_0x161856},'limit':0x1}})['then'](function(_0x458005){logger[_0x0737('0x9')]('[utils][getVoiceQueueByName]\x20name:%s',_0x161856,_0x458005?util['inspect'](_0x458005,{'showHidden':![],'depth':null}):'');logger['info'](_0x0737('0x20'),_0x161856,_0x458005?_0x0737('0x18'):_0x0737('0x1b'));return _0x4b8886(_0x458005[_0x0737('0x15')]['length']?_0x458005[_0x0737('0x15')][0x0]:null);})[_0x0737('0xf')](function(_0x1894dc){logger[_0x0737('0xa')]('[utils][getVoiceQueueByName]',_0x1894dc?util['inspect'](_0x1894dc,{'showHidden':![],'depth':null}):'');return _0x4b8886(null);});}return _0x4b8886(null);});};exports[_0x0737('0x21')]=function(_0xd80616,_0x60f380){return moment(_0xd80616)['add'](_0x60f380,_0x0737('0x22'))[_0x0737('0x23')](_0x0737('0x24'));};exports[_0x0737('0x25')]=function(_0x4d30f3,_0x5a6764){return moment(_0x4d30f3)[_0x0737('0x26')](_0x5a6764,'seconds')['format'](_0x0737('0x24'));};exports['diffTime']=function(_0x5c4c44,_0x26c5aa){return moment(_0x5c4c44)[_0x0737('0x27')](moment(_0x26c5aa),_0x0737('0x22'));};exports[_0x0737('0x28')]=function(_0x24e338,_0x2ff2b5){return parseInt(_0x24e338,0xa)+parseInt(_0x2ff2b5,0xa);};exports[_0x0737('0x29')]=function(){return moment()['format'](_0x0737('0x24'));};exports['isAfter']=function(_0x49faed,_0x2b9a6a){if(_0x2b9a6a){return moment(_0x49faed)[_0x0737('0x2a')](_0x2b9a6a);}return!![];};exports[_0x0737('0x2b')]=function(_0x44d3fe,_0x1c11a7){if(_0x1c11a7){return moment(_0x44d3fe)[_0x0737('0x2b')](_0x1c11a7);}else if(_0x44d3fe){return!![];}return![];}; \ No newline at end of file +var _0x7989=['sumTime','now','isAfter','isBefore','moment','util','http','../../config/logger','info','inspect','debug','error','request','then','[utils][request]\x20name:%s','catch','GetUser','internal','[utils][getUser]\x20where:%s','stringify','result','length','getUserByInternal','found','notfound','[utils][getUserByInternal]','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','name','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtract','diffTime','diff'];(function(_0x1e307a,_0x5f182b){var _0x1ec4a0=function(_0xcbb5b4){while(--_0xcbb5b4){_0x1e307a['push'](_0x1e307a['shift']());}};_0x1ec4a0(++_0x5f182b);}(_0x7989,0x82));var _0x9798=function(_0x68a0b0,_0x2bba91){_0x68a0b0=_0x68a0b0-0x0;var _0x4b4ee6=_0x7989[_0x68a0b0];return _0x4b4ee6;};'use strict';var BPromise=require('bluebird');var jayson=require('jayson/promise');var moment=require(_0x9798('0x0'));var util=require(_0x9798('0x1'));var client=jayson['client'][_0x9798('0x2')]({'port':0x2329});var logger=require(_0x9798('0x3'))('xdr');exports[_0x9798('0x4')]=function(_0x19e492,_0x93883e){logger[_0x9798('0x4')](_0x19e492,_0x93883e?util[_0x9798('0x5')](_0x93883e,{'showHidden':![],'depth':null}):'');};exports[_0x9798('0x6')]=function(_0x3d6486,_0x27ad3c){logger[_0x9798('0x6')](_0x3d6486,_0x27ad3c?util['inspect'](_0x27ad3c,{'showHidden':![],'depth':null}):'');};exports[_0x9798('0x7')]=function(_0x2551f2,_0x5b8eb7){logger[_0x9798('0x7')](_0x2551f2,_0x5b8eb7?util['inspect'](_0x5b8eb7,{'showHidden':![],'depth':null}):'');};exports[_0x9798('0x8')]=function(_0x4d2335,_0x3df4f1){return client[_0x9798('0x8')](_0x4d2335,{'body':_0x3df4f1})[_0x9798('0x9')](function(_0x27bb9e){logger[_0x9798('0x6')](_0x9798('0xa'),_0x4d2335,_0x27bb9e?util[_0x9798('0x5')](_0x27bb9e,{'showHidden':![],'depth':null}):'');})[_0x9798('0xb')](function(_0x5783bb){logger[_0x9798('0x7')]('[utils][request]\x20name:%s',_0x4d2335,_0x5783bb?util['inspect'](_0x5783bb,{'showHidden':![],'depth':null}):'');});};function getUser(_0x3348c7){return client[_0x9798('0x8')](_0x9798('0xc'),{'options':{'raw':!![],'attributes':['id',_0x9798('0xd'),'name','interface'],'where':_0x3348c7,'limit':0x1}})[_0x9798('0x9')](function(_0x2551d1){logger['debug'](_0x9798('0xe'),JSON[_0x9798('0xf')](_0x3348c7),_0x2551d1?util[_0x9798('0x5')](_0x2551d1,{'showHidden':![],'depth':null}):'');return _0x2551d1[_0x9798('0x10')][_0x9798('0x11')]?_0x2551d1[_0x9798('0x10')][0x0]:null;});}exports[_0x9798('0x12')]=function(_0x2e6251){return new BPromise(function(_0x55bd4f,_0x14fbb0){if(_0x2e6251){return getUser({'internal':_0x2e6251})[_0x9798('0x9')](function(_0x3d17aa){logger[_0x9798('0x4')]('[utils][getUserByInternal]\x20internal:%s\x20%s',_0x2e6251,_0x3d17aa?_0x9798('0x13'):_0x9798('0x14'));return _0x55bd4f(_0x3d17aa);})[_0x9798('0xb')](function(_0x21d230){logger[_0x9798('0x7')](_0x9798('0x15'),_0x21d230?util[_0x9798('0x5')](_0x21d230,{'showHidden':![],'depth':null}):'');return _0x55bd4f(null);});}return _0x55bd4f(null);});};exports['getUserByInterface']=function(_0x48c6b3){return new BPromise(function(_0x40d600,_0x203823){if(_0x48c6b3){return getUser({'interface':_0x48c6b3})[_0x9798('0x9')](function(_0x2a26ed){logger['info'](_0x9798('0x16'),_0x48c6b3,_0x2a26ed?_0x9798('0x13'):_0x9798('0x14'));return _0x40d600(_0x2a26ed);})[_0x9798('0xb')](function(_0x327914){logger[_0x9798('0x7')]('[utils][getUserByInterface]',_0x327914?util['inspect'](_0x327914,{'showHidden':![],'depth':null}):'');return _0x40d600(null);});}return _0x40d600(null);});};exports['getUserByName']=function(_0x189ac3){return new BPromise(function(_0x34a9f7,_0x1a7f96){if(_0x189ac3){return getUser({'name':_0x189ac3})[_0x9798('0x9')](function(_0x149ba4){logger[_0x9798('0x4')]('[utils][getUserByName]\x20name:%s\x20%s',_0x189ac3,_0x149ba4?_0x9798('0x13'):'notfound');return _0x34a9f7(_0x149ba4);})[_0x9798('0xb')](function(_0x453fbb){logger['error'](_0x9798('0x17'),_0x453fbb?util[_0x9798('0x5')](_0x453fbb,{'showHidden':![],'depth':null}):'');return _0x34a9f7(null);});}return _0x34a9f7(null);});};exports[_0x9798('0x18')]=function(_0x251f33){return new BPromise(function(_0x53c917,_0x224c60){if(_0x251f33){return client['request']('GetVoiceQueue',{'options':{'raw':!![],'attributes':['id',_0x9798('0x19'),_0x9798('0x1a'),_0x9798('0x1b'),_0x9798('0x1c')],'where':{'name':_0x251f33},'limit':0x1}})[_0x9798('0x9')](function(_0x1cdf52){logger[_0x9798('0x6')](_0x9798('0x1d'),_0x251f33,_0x1cdf52?util['inspect'](_0x1cdf52,{'showHidden':![],'depth':null}):'');logger['info']('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x251f33,_0x1cdf52?_0x9798('0x13'):_0x9798('0x14'));return _0x53c917(_0x1cdf52[_0x9798('0x10')]['length']?_0x1cdf52['result'][0x0]:null);})[_0x9798('0xb')](function(_0x30dfe7){logger[_0x9798('0x7')]('[utils][getVoiceQueueByName]',_0x30dfe7?util[_0x9798('0x5')](_0x30dfe7,{'showHidden':![],'depth':null}):'');return _0x53c917(null);});}return _0x53c917(null);});};exports[_0x9798('0x1e')]=function(_0x1def83,_0x344de6){return moment(_0x1def83)[_0x9798('0x1f')](_0x344de6,_0x9798('0x20'))[_0x9798('0x21')](_0x9798('0x22'));};exports['subtractTime']=function(_0x5c759c,_0x3837b8){return moment(_0x5c759c)[_0x9798('0x23')](_0x3837b8,_0x9798('0x20'))[_0x9798('0x21')](_0x9798('0x22'));};exports[_0x9798('0x24')]=function(_0x406c1c,_0x2e114a){return moment(_0x406c1c)[_0x9798('0x25')](moment(_0x2e114a),'seconds');};exports[_0x9798('0x26')]=function(_0x537dd9,_0x23552e){return parseInt(_0x537dd9,0xa)+parseInt(_0x23552e,0xa);};exports[_0x9798('0x27')]=function(){return moment()[_0x9798('0x21')](_0x9798('0x22'));};exports[_0x9798('0x28')]=function(_0x348621,_0x26fe52){if(_0x26fe52){return moment(_0x348621)[_0x9798('0x28')](_0x26fe52);}return!![];};exports[_0x9798('0x29')]=function(_0x4b5620,_0x4fd6f4){if(_0x4fd6f4){return moment(_0x4b5620)[_0x9798('0x29')](_0x4fd6f4);}else if(_0x4b5620){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 3326e6e..e93787a 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 _0xe78c=['%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','format','method','headers','x-forwarded-for','connection','remoteAddress','url','statusCode','responseTime','role','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','agent_name','test','setupLoggers','fs-extra','express-winston','path','./loggers','fileLogger','./safe-template','safeTemplate','./mask-sensitive-data','maskSensitiveData','/var','log','xcally','name','ensureDir','join','catch','user','then','no-user','data','timestamp','error','api','auth','set','client-side-logger','logger'];(function(_0x413585,_0x3804b5){var _0x436cd3=function(_0x18caaa){while(--_0x18caaa){_0x413585['push'](_0x413585['shift']());}};_0x436cd3(++_0x3804b5);}(_0xe78c,0x16d));var _0xce78=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xe78c[_0x1cc8fe];return _0x230054;};var fs=require(_0xce78('0x0'));var _=require('lodash');var ewinston=require(_0xce78('0x1'));var path=require(_0xce78('0x2'));var util=require('util');var fileLogger=require(_0xce78('0x3'))[_0xce78('0x4')];var safeTemplate=require(_0xce78('0x5'))[_0xce78('0x6')];var maskSensitiveData=require(_0xce78('0x7'))[_0xce78('0x8')];function ClientSideLogger(){function _0x2cf262(_0x397fe1){var _0x356a06=path['join'](_0xce78('0x9'),_0xce78('0xa'),_0xce78('0xb'));var _0x2c2cd3=path['join']('client',_0x397fe1['role']+'-'+_0x397fe1[_0xce78('0xc')]);return fs[_0xce78('0xd')](path[_0xce78('0xe')](_0x356a06,_0x2c2cd3))['then'](function(){var _0x43f4dc=fileLogger('client',path['join'](_0x356a06,_0x2c2cd3));return _0x43f4dc;})[_0xce78('0xf')](function(_0x4526eb){throw _0x4526eb;});}this[_0xce78('0xa')]=function(_0x460c22,_0x959310,_0x48a64b,_0x34eae5){return _0x2cf262(_0x460c22[_0xce78('0x10')])['then'](function(_0x1d58a3){var _0x5ed36c=_0x1d58a3[_0x959310];return _0x5ed36c;})[_0xce78('0x11')](function(_0x473436){var _0x399477=_0x460c22[_0xce78('0x10')]?_0x460c22[_0xce78('0x10')]['id']:_0xce78('0x12');var _0x3118b5=_0x34eae5[_0xce78('0x13')];var _0x3ce64e=_0x34eae5[_0xce78('0x14')];var _0x29927c=new Date(Number(_0x3ce64e));return _0x473436(_0x399477,_0x29927c,_0x48a64b,_0x3118b5);})[_0xce78('0xf')](function(_0xb4c677){fileLogger('client')[_0xce78('0x15')](_0xb4c677);});};}function setupLoggers(_0x3a2454){return new Promise(function(_0x37944a){var _0x1e850f=new ClientSideLogger();var _0xc3333f=fileLogger(_0xce78('0x16'));var _0x44ac6d=fileLogger(_0xce78('0x17'));_0x3a2454[_0xce78('0x18')](_0xce78('0x19'),_0x1e850f);_0x3a2454['use'](ewinston[_0xce78('0x1a')]({'winstonInstance':_0xc3333f,'meta':![],'statusLevels':!![],'msg':function(_0x15523e,_0x59f100){var _0x42f5b1=_0xce78('0x1b');if(!_[_0xce78('0x1c')](_0x15523e[_0xce78('0x1d')])){_0x42f5b1+=_0xce78('0x1e');var _0x239028=_0x15523e['body'];maskSensitiveData(_0x239028);}return safeTemplate(util[_0xce78('0x1f')](_0x42f5b1,_0x15523e[_0xce78('0x20')],_0x15523e[_0xce78('0x21')]['x-forwarded-for']?_0x15523e['headers'][_0xce78('0x22')]:_0x15523e[_0xce78('0x23')][_0xce78('0x24')]||_0x15523e['ip'],_0x15523e[_0xce78('0x25')],_0x59f100[_0xce78('0x26')],_0x59f100[_0xce78('0x27')],_0x15523e[_0xce78('0x10')]?_0x15523e['user']['id']:null,_0x15523e[_0xce78('0x10')]?_0x15523e[_0xce78('0x10')]['name']:null,_0x15523e[_0xce78('0x10')]?_0x15523e['user'][_0xce78('0x28')]:null,_0x239028?util['inspect'](_0x239028,![],null):''));}}));_0x3a2454[_0xce78('0x29')](ewinston[_0xce78('0x1a')]({'winstonInstance':_0x44ac6d,'meta':![],'statusLevels':!![],'msg':function(_0x3c48f5,_0x377588){var _0x5c22f7=_0xce78('0x2a');if(_0x3c48f5[_0xce78('0x1d')]&&_0x3c48f5[_0xce78('0x1d')][_0xce78('0x2b')]&&_0x3c48f5[_0xce78('0x1d')][_0xce78('0x2c')]){_0x5c22f7=_0xce78('0x2d');}return util[_0xce78('0x1f')](_0x5c22f7,_0x3c48f5[_0xce78('0x20')],_0x3c48f5[_0xce78('0x21')][_0xce78('0x22')]?_0x3c48f5[_0xce78('0x21')]['x-forwarded-for']:_0x3c48f5[_0xce78('0x23')][_0xce78('0x24')]||_0x3c48f5['ip'],_0x3c48f5[_0xce78('0x25')],_0x377588[_0xce78('0x26')],_0x377588['responseTime'],_0x3c48f5['user']?_0x3c48f5[_0xce78('0x10')]['id']:null,_0x3c48f5[_0xce78('0x10')]?_0x3c48f5[_0xce78('0x10')][_0xce78('0xc')]:null,_0x3c48f5[_0xce78('0x10')]?_0x3c48f5[_0xce78('0x10')]['role']:null,_0x3c48f5[_0xce78('0x1d')]&&_0x3c48f5['body'][_0xce78('0x2b')]?_0x3c48f5['body']['device']:'other',_0x3c48f5[_0xce78('0x1d')]&&_0x3c48f5[_0xce78('0x1d')]['agent_id']?_0x3c48f5['body'][_0xce78('0x2c')]:'',_0x3c48f5[_0xce78('0x1d')]&&_0x3c48f5[_0xce78('0x1d')][_0xce78('0x2e')]?_0x3c48f5[_0xce78('0x1d')][_0xce78('0x2e')]:'');},'ignoreRoute':function(_0x3d23a8){var _0x509d08=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x509d08[_0xce78('0x2f')](_0x3d23a8['url']);}}));return _0x37944a();});}exports[_0xce78('0x30')]=setupLoggers; \ No newline at end of file +var _0x197c=['api','auth','set','client-side-logger','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','format','method','headers','x-forwarded-for','connection','remoteAddress','url','statusCode','responseTime','inspect','device','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','other','agent_id','lodash','express-winston','path','util','./loggers','fileLogger','./safe-template','safeTemplate','./mask-sensitive-data','maskSensitiveData','join','/var','log','client','role','name','then','user','no-user','data','timestamp','catch','error'];(function(_0x1fd2fa,_0x338bdb){var _0x3da635=function(_0x1c36ab){while(--_0x1c36ab){_0x1fd2fa['push'](_0x1fd2fa['shift']());}};_0x3da635(++_0x338bdb);}(_0x197c,0x132));var _0xc197=function(_0xb4430c,_0x44cc22){_0xb4430c=_0xb4430c-0x0;var _0x551977=_0x197c[_0xb4430c];return _0x551977;};var fs=require('fs-extra');var _=require(_0xc197('0x0'));var ewinston=require(_0xc197('0x1'));var path=require(_0xc197('0x2'));var util=require(_0xc197('0x3'));var fileLogger=require(_0xc197('0x4'))[_0xc197('0x5')];var safeTemplate=require(_0xc197('0x6'))[_0xc197('0x7')];var maskSensitiveData=require(_0xc197('0x8'))[_0xc197('0x9')];function ClientSideLogger(){function _0x63dc9c(_0x1be749){var _0x5f0c70=path[_0xc197('0xa')](_0xc197('0xb'),_0xc197('0xc'),'xcally');var _0x1de884=path['join'](_0xc197('0xd'),_0x1be749[_0xc197('0xe')]+'-'+_0x1be749[_0xc197('0xf')]);return fs['ensureDir'](path['join'](_0x5f0c70,_0x1de884))[_0xc197('0x10')](function(){var _0x2c1cb9=fileLogger(_0xc197('0xd'),path[_0xc197('0xa')](_0x5f0c70,_0x1de884));return _0x2c1cb9;})['catch'](function(_0x249ba9){throw _0x249ba9;});}this['log']=function(_0x1d29c7,_0xc4d1dd,_0x2f10b7,_0x5eea35){return _0x63dc9c(_0x1d29c7[_0xc197('0x11')])[_0xc197('0x10')](function(_0x4b80d8){var _0x425882=_0x4b80d8[_0xc4d1dd];return _0x425882;})['then'](function(_0xc94898){var _0x5fcc72=_0x1d29c7['user']?_0x1d29c7[_0xc197('0x11')]['id']:_0xc197('0x12');var _0x21c94b=_0x5eea35[_0xc197('0x13')];var _0x31da41=_0x5eea35[_0xc197('0x14')];var _0x40ca83=new Date(Number(_0x31da41));return _0xc94898(_0x5fcc72,_0x40ca83,_0x2f10b7,_0x21c94b);})[_0xc197('0x15')](function(_0x488eb4){fileLogger('client')[_0xc197('0x16')](_0x488eb4);});};}function setupLoggers(_0x1f13ac){return new Promise(function(_0x573dcf){var _0x51f68a=new ClientSideLogger();var _0x2218e3=fileLogger(_0xc197('0x17'));var _0x20c880=fileLogger(_0xc197('0x18'));_0x1f13ac[_0xc197('0x19')](_0xc197('0x1a'),_0x51f68a);_0x1f13ac[_0xc197('0x1b')](ewinston[_0xc197('0x1c')]({'winstonInstance':_0x2218e3,'meta':![],'statusLevels':!![],'msg':function(_0x5a26e2,_0x52a1f1){var _0x5a1d3f=_0xc197('0x1d');if(!_[_0xc197('0x1e')](_0x5a26e2[_0xc197('0x1f')])){_0x5a1d3f+=_0xc197('0x20');var _0x394530=_0x5a26e2[_0xc197('0x1f')];maskSensitiveData(_0x394530);}return safeTemplate(util[_0xc197('0x21')](_0x5a1d3f,_0x5a26e2[_0xc197('0x22')],_0x5a26e2[_0xc197('0x23')][_0xc197('0x24')]?_0x5a26e2[_0xc197('0x23')]['x-forwarded-for']:_0x5a26e2[_0xc197('0x25')][_0xc197('0x26')]||_0x5a26e2['ip'],_0x5a26e2[_0xc197('0x27')],_0x52a1f1[_0xc197('0x28')],_0x52a1f1[_0xc197('0x29')],_0x5a26e2[_0xc197('0x11')]?_0x5a26e2[_0xc197('0x11')]['id']:null,_0x5a26e2[_0xc197('0x11')]?_0x5a26e2[_0xc197('0x11')][_0xc197('0xf')]:null,_0x5a26e2[_0xc197('0x11')]?_0x5a26e2[_0xc197('0x11')][_0xc197('0xe')]:null,_0x394530?util[_0xc197('0x2a')](_0x394530,![],null):''));}}));_0x1f13ac[_0xc197('0x1b')](ewinston[_0xc197('0x1c')]({'winstonInstance':_0x20c880,'meta':![],'statusLevels':!![],'msg':function(_0xc86d58,_0x48101c){var _0x5f48fa='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0xc86d58[_0xc197('0x1f')]&&_0xc86d58['body'][_0xc197('0x2b')]&&_0xc86d58['body']['agent_id']){_0x5f48fa=_0xc197('0x2c');}return util[_0xc197('0x21')](_0x5f48fa,_0xc86d58[_0xc197('0x22')],_0xc86d58[_0xc197('0x23')][_0xc197('0x24')]?_0xc86d58[_0xc197('0x23')][_0xc197('0x24')]:_0xc86d58[_0xc197('0x25')][_0xc197('0x26')]||_0xc86d58['ip'],_0xc86d58[_0xc197('0x27')],_0x48101c[_0xc197('0x28')],_0x48101c[_0xc197('0x29')],_0xc86d58['user']?_0xc86d58[_0xc197('0x11')]['id']:null,_0xc86d58[_0xc197('0x11')]?_0xc86d58[_0xc197('0x11')][_0xc197('0xf')]:null,_0xc86d58[_0xc197('0x11')]?_0xc86d58[_0xc197('0x11')]['role']:null,_0xc86d58[_0xc197('0x1f')]&&_0xc86d58[_0xc197('0x1f')][_0xc197('0x2b')]?_0xc86d58[_0xc197('0x1f')][_0xc197('0x2b')]:_0xc197('0x2d'),_0xc86d58[_0xc197('0x1f')]&&_0xc86d58['body'][_0xc197('0x2e')]?_0xc86d58['body'][_0xc197('0x2e')]:'',_0xc86d58[_0xc197('0x1f')]&&_0xc86d58[_0xc197('0x1f')]['agent_name']?_0xc86d58['body']['agent_name']:'');},'ignoreRoute':function(_0x52dfe0){var _0x504173=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x504173['test'](_0x52dfe0[_0xc197('0x27')]);}}));return _0x573dcf();});}exports['setupLoggers']=setupLoggers; \ No newline at end of file diff --git a/server/utils/iftime.js b/server/utils/iftime.js index 49c6734..1c977ba 100644 --- a/server/utils/iftime.js +++ b/server/utils/iftime.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x507c=['exports','clone','minutes','hours','day','endOf','isBetween','ddd','includes','dowCompare','date','daysInMonth','max','min','format','MMM','monthCompare','test','isMoment','padStart','length','iftime','lodash','moment-timezone','source','Interval\x20string\x20not\x20valid','Date\x20not\x20valid','isValid','split','map','locale','weekdaysShort','indexOf','slice','concat','circularDoWInterval','monthsShort','toLowerCase'];(function(_0x16d502,_0x2ce81a){var _0x19f799=function(_0x295329){while(--_0x295329){_0x16d502['push'](_0x16d502['shift']());}};_0x19f799(++_0x2ce81a);}(_0x507c,0xd4));var _0xc507=function(_0x3f8f1b,_0x421983){_0x3f8f1b=_0x3f8f1b-0x0;var _0x25ff15=_0x507c[_0x3f8f1b];return _0x25ff15;};var _=require(_0xc507('0x0'));var moment=require(_0xc507('0x1'));var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx]['map'](function(_0xa98782){return _0xa98782[_0xc507('0x2')];})['join'](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0xc507('0x3');var EINVALID_DATE=_0xc507('0x4');function throwIfDateNotValid(_0x4885d9){if(!_0x4885d9[_0xc507('0x5')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x564d9d){var _0x2cd9e0=_0x564d9d[_0xc507('0x6')](':')[_0xc507('0x7')](function(_0x1ce698){return parseInt(_0x1ce698,0xa);});var _0x461322=_0x2cd9e0[0x0];var _0x30742b=_0x2cd9e0[0x1];if(_0x461322<0x0||_0x461322>0x17||_0x30742b<0x0||_0x30742b>0x3b){throw new Error(EINVALID_DATE);}return[_0x461322,_0x30742b];}function circularDoWInterval(_0x591579,_0x2f4ad8){if(_0x591579===_0x2f4ad8){return[_0x591579];}else{var _0x165219=moment[_0xc507('0x8')]();moment[_0xc507('0x8')]('en');var _0x3b7085=moment[_0xc507('0x9')]()[_0xc507('0x7')](function(_0xfd9bb2){return _0xfd9bb2['toLowerCase']();});moment[_0xc507('0x8')](_0x165219);var _0x24d9b0=_0x3b7085[_0xc507('0xa')](_0x591579);var _0x2d7b36=_0x3b7085[_0xc507('0xa')](_0x2f4ad8);if(_0x2d7b36>_0x24d9b0){return _0x3b7085['slice'](_0x24d9b0,_0x2d7b36+0x1);}else{var _0x5a058d=_0x3b7085[_0xc507('0xb')](0x0,_0x2d7b36+0x1);var _0x1f6a9b=_0x3b7085[_0xc507('0xb')](_0x24d9b0);return _0x1f6a9b[_0xc507('0xc')](_0x5a058d);}}}module['exports'][_0xc507('0xd')]=circularDoWInterval;function circularMonthInterval(_0x4b76e3,_0x1819b9){if(_0x4b76e3===_0x1819b9){return[_0x4b76e3];}else{var _0x230d3f=moment[_0xc507('0x8')]();moment[_0xc507('0x8')]('en');var _0x33fa31=moment[_0xc507('0xe')]()[_0xc507('0x7')](function(_0x5d90b2){return _0x5d90b2[_0xc507('0xf')]();});moment[_0xc507('0x8')](_0x230d3f);var _0x4ef4e1=_0x33fa31['indexOf'](_0x4b76e3);var _0x28beca=_0x33fa31[_0xc507('0xa')](_0x1819b9);if(_0x28beca>_0x4ef4e1){return _0x33fa31[_0xc507('0xb')](_0x4ef4e1,_0x28beca+0x1);}else{var _0x2fa9c8=_0x33fa31['slice'](0x0,_0x28beca+0x1);var _0x1e5eae=_0x33fa31[_0xc507('0xb')](_0x4ef4e1);return _0x1e5eae[_0xc507('0xc')](_0x2fa9c8);}}}module[_0xc507('0x10')]['circularMonthInterval']=circularMonthInterval;function parseDom(_0x2b0bd2){var _0x320d38=parseInt(_0x2b0bd2,0xa);if(_0x320d38<0x1||_0x320d38>0x1f){throw new Error(EINVALID_DATE);}return _0x320d38;}function timeCompare(_0xfb4224,_0x30cac6,_0x653ad0){var _0x526417=_0xfb4224['clone']();var _0x22aa62=extractTime(_0x30cac6);var _0x19bf57=_0x22aa62[0x0];var _0x2189db=_0x22aa62[0x1];var _0x1839d9=_0xfb4224[_0xc507('0x11')]()['hours'](_0x19bf57)[_0xc507('0x12')](_0x2189db);throwIfDateNotValid(_0x1839d9);var _0x564782=extractTime(_0x653ad0);var _0x20b43d=_0x564782[0x0];var _0x404be8=_0x564782[0x1];var _0x13e5f5=_0xfb4224[_0xc507('0x11')]()[_0xc507('0x13')](_0x20b43d)[_0xc507('0x12')](_0x404be8);throwIfDateNotValid(_0x13e5f5);if(_0x13e5f5['isBefore'](_0x1839d9)){var _0x57ed59=_0x526417['clone']()['startOf'](_0xc507('0x14'));var _0x47c590=_0x526417[_0xc507('0x11')]()[_0xc507('0x15')](_0xc507('0x14'));return _0x526417['isBetween'](_0x1839d9,_0x47c590,undefined,'[]')||_0x526417['isBetween'](_0x57ed59,_0x13e5f5,undefined,'[]');}else{return _0x526417[_0xc507('0x16')](_0x1839d9,_0x13e5f5,undefined,'[]');}}module['exports']['timeCompare']=timeCompare;function dowCompare(_0x71d76f,_0xd370b4,_0x39a7a6){var _0x59950b=_0x71d76f[_0xc507('0x8')]('en')['format'](_0xc507('0x17'))['toLowerCase']();return circularDoWInterval(_0xd370b4,_0x39a7a6)[_0xc507('0x18')](_0x59950b);}module['exports'][_0xc507('0x19')]=dowCompare;function domCompare(_0x379e9f,_0x42de50,_0x286848){var _0x57d05e=_0x379e9f[_0xc507('0x1a')]();if(_0x42de50===_0x286848){return _0x57d05e===_0x42de50;}else{var _0x3c6897=_0x379e9f[_0xc507('0x1b')]();var _0x17c118=_0x42de50<_0x286848;let _0x27e8ee=![];var _0x273445=0x0;var _0x42cd47=0x0;if(_0x17c118){_0x273445=Math[_0xc507('0x1c')](0x1,_0x42de50);_0x42cd47=Math[_0xc507('0x1d')](_0x286848,_0x3c6897);_0x27e8ee=_0x57d05e>=_0x273445&&_0x57d05e<=_0x42cd47;}else{_0x273445=Math['min'](_0x42de50,_0x3c6897);_0x42cd47=Math[_0xc507('0x1c')](0x1,_0x286848);_0x27e8ee=_0x57d05e>=_0x273445||_0x57d05e<=_0x42cd47;}return _0x27e8ee;}}module[_0xc507('0x10')]['domCompare']=domCompare;function monthCompare(_0x58c158,_0x57f5c4,_0x583030){var _0x17153e=_0x58c158[_0xc507('0x8')]('en')[_0xc507('0x1e')](_0xc507('0x1f'))[_0xc507('0xf')]();return circularMonthInterval(_0x57f5c4,_0x583030)[_0xc507('0x18')](_0x17153e);}module['exports'][_0xc507('0x20')]=monthCompare;function iftime(_0x56c0c2,_0xc8fb37=moment['tz']['guess'](),_0x45f709=moment()){if(!validateRx[_0xc507('0x21')](_0x56c0c2)){throw new Error(EINVALID_STRING);}else{var _0x1c56c5=(moment[_0xc507('0x22')](_0x45f709)?_0x45f709[_0xc507('0x11')]():moment(_0x45f709))['tz'](_0xc8fb37)[_0xc507('0x8')]('en');throwIfDateNotValid(_0x1c56c5);var _0x2d4368=_0x56c0c2['split'](',');var _0x22e5ba=_0x2d4368[0x0];var _0xafa267=_0x2d4368[0x1];var _0x32c877=_0x2d4368[0x2];var _0x2ed7f5=_0x2d4368[0x3];let _0x28cbc5=!![];if(_0x22e5ba!=='*'){var _0x6efbf5=_0x22e5ba[_0xc507('0x6')]('-');var _0xefb0c6=_[_0xc507('0x23')](_0x6efbf5[0x0],0x5,'0');var _0xc94e42=_0x6efbf5[_0xc507('0x24')]===0x2?_[_0xc507('0x23')](_0x6efbf5[0x1],0x5,'0'):_0xefb0c6;_0x28cbc5=timeCompare(_0x1c56c5,_0xefb0c6,_0xc94e42);}let _0x28a239=!![];if(_0xafa267!=='*'){var _0x1181aa=_0xafa267['split']('-');var _0x396493=_0x1181aa[0x0];var _0x5a1bc6=_0x1181aa[_0xc507('0x24')]===0x2?_0x1181aa[0x1]:_0x396493;_0x28a239=dowCompare(_0x1c56c5,_0x396493,_0x5a1bc6);}let _0x1c7a21=!![];if(_0x32c877!=='*'){var _0xb200b6=_0x32c877[_0xc507('0x6')]('-');var _0x4f332a=parseDom(_0xb200b6[0x0]);var _0x9e458b=_0xb200b6['length']===0x2?parseDom(_0xb200b6[0x1]):_0x4f332a;_0x1c7a21=domCompare(_0x1c56c5,_0x4f332a,_0x9e458b);}let _0x1352b9=!![];if(_0x2ed7f5!=='*'){var _0x5b6b6e=_0x2ed7f5['split']('-');var _0x438586=_0x5b6b6e[0x0];var _0x284016=_0x5b6b6e['length']===0x2?_0x5b6b6e[0x1]:_0x5b6b6e[0x0];_0x1352b9=monthCompare(_0x1c56c5,_0x438586,_0x284016);}return _0x28cbc5&&_0x28a239&&_0x1c7a21&&_0x1352b9;}}module['exports'][_0xc507('0x25')]=iftime; \ No newline at end of file +var _0xb5e1=['startOf','day','endOf','isBetween','format','ddd','includes','dowCompare','date','daysInMonth','max','min','MMM','guess','test','split','padStart','length','iftime','lodash','moment-timezone','map','isValid','locale','toLowerCase','indexOf','slice','concat','exports','circularDoWInterval','monthsShort','circularMonthInterval','clone','hours','minutes'];(function(_0x536486,_0x45a3c9){var _0x54e087=function(_0x5b1de7){while(--_0x5b1de7){_0x536486['push'](_0x536486['shift']());}};_0x54e087(++_0x45a3c9);}(_0xb5e1,0x171));var _0x1b5e=function(_0x3bdcbb,_0x420a2c){_0x3bdcbb=_0x3bdcbb-0x0;var _0x2c90fc=_0xb5e1[_0x3bdcbb];return _0x2c90fc;};var _=require(_0x1b5e('0x0'));var moment=require(_0x1b5e('0x1'));var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx][_0x1b5e('0x2')](function(_0x2b976d){return _0x2b976d['source'];})['join'](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING='Interval\x20string\x20not\x20valid';var EINVALID_DATE='Date\x20not\x20valid';function throwIfDateNotValid(_0x2a91e5){if(!_0x2a91e5[_0x1b5e('0x3')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x9924bb){var _0x5ba75a=_0x9924bb['split'](':')['map'](function(_0x434f78){return parseInt(_0x434f78,0xa);});var _0x36be96=_0x5ba75a[0x0];var _0x31e031=_0x5ba75a[0x1];if(_0x36be96<0x0||_0x36be96>0x17||_0x31e031<0x0||_0x31e031>0x3b){throw new Error(EINVALID_DATE);}return[_0x36be96,_0x31e031];}function circularDoWInterval(_0x23e64b,_0x233b50){if(_0x23e64b===_0x233b50){return[_0x23e64b];}else{var _0x4fdb5d=moment[_0x1b5e('0x4')]();moment['locale']('en');var _0x558812=moment['weekdaysShort']()[_0x1b5e('0x2')](function(_0x49eeb3){return _0x49eeb3[_0x1b5e('0x5')]();});moment['locale'](_0x4fdb5d);var _0x1f9e9c=_0x558812['indexOf'](_0x23e64b);var _0x150011=_0x558812[_0x1b5e('0x6')](_0x233b50);if(_0x150011>_0x1f9e9c){return _0x558812[_0x1b5e('0x7')](_0x1f9e9c,_0x150011+0x1);}else{var _0x29d252=_0x558812['slice'](0x0,_0x150011+0x1);var _0x1395ec=_0x558812[_0x1b5e('0x7')](_0x1f9e9c);return _0x1395ec[_0x1b5e('0x8')](_0x29d252);}}}module[_0x1b5e('0x9')][_0x1b5e('0xa')]=circularDoWInterval;function circularMonthInterval(_0x304033,_0x309e7d){if(_0x304033===_0x309e7d){return[_0x304033];}else{var _0x210571=moment['locale']();moment['locale']('en');var _0x44bc60=moment[_0x1b5e('0xb')]()[_0x1b5e('0x2')](function(_0xf7718e){return _0xf7718e[_0x1b5e('0x5')]();});moment[_0x1b5e('0x4')](_0x210571);var _0xfecf7e=_0x44bc60[_0x1b5e('0x6')](_0x304033);var _0x18d5b0=_0x44bc60[_0x1b5e('0x6')](_0x309e7d);if(_0x18d5b0>_0xfecf7e){return _0x44bc60[_0x1b5e('0x7')](_0xfecf7e,_0x18d5b0+0x1);}else{var _0x50de6f=_0x44bc60[_0x1b5e('0x7')](0x0,_0x18d5b0+0x1);var _0x4064ba=_0x44bc60['slice'](_0xfecf7e);return _0x4064ba[_0x1b5e('0x8')](_0x50de6f);}}}module['exports'][_0x1b5e('0xc')]=circularMonthInterval;function parseDom(_0x50de51){var _0x93000d=parseInt(_0x50de51,0xa);if(_0x93000d<0x1||_0x93000d>0x1f){throw new Error(EINVALID_DATE);}return _0x93000d;}function timeCompare(_0x4cbebb,_0x129d8a,_0x4a1e27){var _0x48a164=_0x4cbebb['clone']();var _0x1bc5a7=extractTime(_0x129d8a);var _0xb47095=_0x1bc5a7[0x0];var _0x18702d=_0x1bc5a7[0x1];var _0x2f63de=_0x4cbebb[_0x1b5e('0xd')]()[_0x1b5e('0xe')](_0xb47095)['minutes'](_0x18702d);throwIfDateNotValid(_0x2f63de);var _0x13ee73=extractTime(_0x4a1e27);var _0x12df23=_0x13ee73[0x0];var _0x38ce19=_0x13ee73[0x1];var _0x39e385=_0x4cbebb[_0x1b5e('0xd')]()[_0x1b5e('0xe')](_0x12df23)[_0x1b5e('0xf')](_0x38ce19);throwIfDateNotValid(_0x39e385);if(_0x39e385['isBefore'](_0x2f63de)){var _0x504550=_0x48a164[_0x1b5e('0xd')]()[_0x1b5e('0x10')](_0x1b5e('0x11'));var _0x561685=_0x48a164[_0x1b5e('0xd')]()[_0x1b5e('0x12')](_0x1b5e('0x11'));return _0x48a164[_0x1b5e('0x13')](_0x2f63de,_0x561685,undefined,'[]')||_0x48a164[_0x1b5e('0x13')](_0x504550,_0x39e385,undefined,'[]');}else{return _0x48a164[_0x1b5e('0x13')](_0x2f63de,_0x39e385,undefined,'[]');}}module[_0x1b5e('0x9')]['timeCompare']=timeCompare;function dowCompare(_0xc40274,_0xa392a5,_0x531797){var _0x520b6a=_0xc40274[_0x1b5e('0x4')]('en')[_0x1b5e('0x14')](_0x1b5e('0x15'))[_0x1b5e('0x5')]();return circularDoWInterval(_0xa392a5,_0x531797)[_0x1b5e('0x16')](_0x520b6a);}module['exports'][_0x1b5e('0x17')]=dowCompare;function domCompare(_0xcbb3cf,_0x485d2b,_0x2500ce){var _0x5132cb=_0xcbb3cf[_0x1b5e('0x18')]();if(_0x485d2b===_0x2500ce){return _0x5132cb===_0x485d2b;}else{var _0x336552=_0xcbb3cf[_0x1b5e('0x19')]();var _0x4eaf02=_0x485d2b<_0x2500ce;let _0x23be76=![];var _0x41bc8a=0x0;var _0x24644a=0x0;if(_0x4eaf02){_0x41bc8a=Math[_0x1b5e('0x1a')](0x1,_0x485d2b);_0x24644a=Math['min'](_0x2500ce,_0x336552);_0x23be76=_0x5132cb>=_0x41bc8a&&_0x5132cb<=_0x24644a;}else{_0x41bc8a=Math[_0x1b5e('0x1b')](_0x485d2b,_0x336552);_0x24644a=Math[_0x1b5e('0x1a')](0x1,_0x2500ce);_0x23be76=_0x5132cb>=_0x41bc8a||_0x5132cb<=_0x24644a;}return _0x23be76;}}module[_0x1b5e('0x9')]['domCompare']=domCompare;function monthCompare(_0x250702,_0x19bb86,_0x360d14){var _0x286c39=_0x250702[_0x1b5e('0x4')]('en')[_0x1b5e('0x14')](_0x1b5e('0x1c'))[_0x1b5e('0x5')]();return circularMonthInterval(_0x19bb86,_0x360d14)[_0x1b5e('0x16')](_0x286c39);}module['exports']['monthCompare']=monthCompare;function iftime(_0x1135c7,_0x2d67b9=moment['tz'][_0x1b5e('0x1d')](),_0x44ad94=moment()){if(!validateRx[_0x1b5e('0x1e')](_0x1135c7)){throw new Error(EINVALID_STRING);}else{var _0x519144=(moment['isMoment'](_0x44ad94)?_0x44ad94['clone']():moment(_0x44ad94))['tz'](_0x2d67b9)['locale']('en');throwIfDateNotValid(_0x519144);var _0x4e90bf=_0x1135c7['split'](',');var _0x14158f=_0x4e90bf[0x0];var _0x4740e2=_0x4e90bf[0x1];var _0x38df87=_0x4e90bf[0x2];var _0x33ae2a=_0x4e90bf[0x3];let _0x410942=!![];if(_0x14158f!=='*'){var _0x4b6684=_0x14158f[_0x1b5e('0x1f')]('-');var _0x1fd527=_[_0x1b5e('0x20')](_0x4b6684[0x0],0x5,'0');var _0x41b6a4=_0x4b6684[_0x1b5e('0x21')]===0x2?_['padStart'](_0x4b6684[0x1],0x5,'0'):_0x1fd527;_0x410942=timeCompare(_0x519144,_0x1fd527,_0x41b6a4);}let _0x5c9bb3=!![];if(_0x4740e2!=='*'){var _0xfd69d2=_0x4740e2[_0x1b5e('0x1f')]('-');var _0x52417a=_0xfd69d2[0x0];var _0x271bf2=_0xfd69d2[_0x1b5e('0x21')]===0x2?_0xfd69d2[0x1]:_0x52417a;_0x5c9bb3=dowCompare(_0x519144,_0x52417a,_0x271bf2);}let _0x39a474=!![];if(_0x38df87!=='*'){var _0x26e710=_0x38df87[_0x1b5e('0x1f')]('-');var _0x330fd2=parseDom(_0x26e710[0x0]);var _0x4c3879=_0x26e710[_0x1b5e('0x21')]===0x2?parseDom(_0x26e710[0x1]):_0x330fd2;_0x39a474=domCompare(_0x519144,_0x330fd2,_0x4c3879);}let _0x3a2f1e=!![];if(_0x33ae2a!=='*'){var _0x4d2311=_0x33ae2a[_0x1b5e('0x1f')]('-');var _0x20876e=_0x4d2311[0x0];var _0x172a05=_0x4d2311[_0x1b5e('0x21')]===0x2?_0x4d2311[0x1]:_0x4d2311[0x0];_0x3a2f1e=monthCompare(_0x519144,_0x20876e,_0x172a05);}return _0x410942&&_0x5c9bb3&&_0x39a474&&_0x3a2f1e;}}module[_0x1b5e('0x9')][_0x1b5e('0x22')]=iftime; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index bfc65af..01ecce7 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x477a=['error','consoleLogger','fileLogger','path','util','moment','winston','../config/environment','debugLevel','toLowerCase','info','bold\x20yellow','white','gray','bold\x20blue','bold\x20cyan','addColors','/var/log/xcally','join','format','message','replace','}}}','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','{{{','keys','length','stringify','meta','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','Logger','transports','Console','warn','File','%s-%s'];(function(_0x580224,_0x5345e1){var _0x5d72a0=function(_0x5af0ba){while(--_0x5af0ba){_0x580224['push'](_0x580224['shift']());}};_0x5d72a0(++_0x5345e1);}(_0x477a,0x75));var _0xa477=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x477a[_0x3dd15e];return _0x231fd0;};'use strict';var path=require(_0xa477('0x0'));var util=require(_0xa477('0x1'));var moment=require(_0xa477('0x2'));var winston=require(_0xa477('0x3'));var config=require(_0xa477('0x4'));var debugLevel=config[_0xa477('0x5')]?config['debugLevel'][_0xa477('0x6')]():_0xa477('0x7');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':'redBG\x20white','error':'red','warn':_0xa477('0x8'),'info':_0xa477('0x9'),'print':'bold\x20white','success':'bold\x20green','http':_0xa477('0xa'),'verbose':'bold\x20magenta','debug':_0xa477('0xb'),'silly':_0xa477('0xc')};winston[_0xa477('0xd')](XC_LOG_COLORS);function getLogFileName(_0x42694f,_0x2e4e16,_0x2f66de){var _0x3d6393=_0x42694f||_0xa477('0xe');return path[_0xa477('0xf')](_0x3d6393,util[_0xa477('0x10')]('%s-%s.log',_0x2e4e16,_0x2f66de));}function formatter(_0x49db25,_0x1ca684){_0x1ca684['message']=_0x1ca684[_0xa477('0x11')][_0xa477('0x12')](/@@{/g,'{{{')[_0xa477('0x12')](/}@@/g,_0xa477('0x13'))[_0xa477('0x12')](/@{/g,'{{')[_0xa477('0x12')](/}@/g,'}}');return util[_0xa477('0x10')]('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()[_0xa477('0x10')](_0xa477('0x14')),_0x1ca684[_0xa477('0x15')][_0xa477('0x16')](),_0x49db25,_0x1ca684[_0xa477('0x11')]);}function fileFormat(_0x9fae4a,_0x43b2a3){_0x43b2a3[_0xa477('0x11')]=_0x43b2a3['message']['replace'](/@@{/g,_0xa477('0x17'))[_0xa477('0x12')](/}@@/g,_0xa477('0x13'))[_0xa477('0x12')](/@{/g,'{{')[_0xa477('0x12')](/}@/g,'}}');var _0x23920=_0x43b2a3['meta']&&Object[_0xa477('0x18')](_0x43b2a3['meta'])[_0xa477('0x19')]?'\x0a\x09'+JSON[_0xa477('0x1a')](_0x43b2a3[_0xa477('0x1b')]):'';return util[_0xa477('0x10')](_0xa477('0x1c'),moment()[_0xa477('0x10')](_0xa477('0x14')),_0x43b2a3[_0xa477('0x15')][_0xa477('0x16')](),_0x9fae4a,_0x43b2a3[_0xa477('0x11')],_0x23920);}function consoleLogger(){var _0x1ba715=new winston[(_0xa477('0x1d'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xa477('0x1e'))][(_0xa477('0x1f'))]({'level':_0xa477('0x20'),'json':![],'formatter':function(_0x55f38f){return formatter('',_0x55f38f);}})]});return _0x1ba715;}function fileLogger(_0x3a70c5,_0x40787a){var _0x43bb76=new winston[(_0xa477('0x1d'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xa477('0x1e'))][(_0xa477('0x21'))]({'name':util[_0xa477('0x10')](_0xa477('0x22'),_0x3a70c5,_0xa477('0x23')),'filename':getLogFileName(_0x40787a,_0x3a70c5,_0xa477('0x23')),'level':_0xa477('0x23'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x2deb12){return fileFormat(_0x3a70c5,_0x2deb12);}}),new winston[(_0xa477('0x1e'))][(_0xa477('0x21'))]({'name':util['format']('%s-%s',_0x3a70c5,debugLevel),'filename':getLogFileName(_0x40787a,_0x3a70c5,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x2d2850){return fileFormat(_0x3a70c5,_0x2d2850);}}),new winston[(_0xa477('0x1e'))][(_0xa477('0x1f'))]({'level':'warn','json':![],'formatter':function(_0x34666f){return fileFormat(_0x3a70c5,_0x34666f);}})]});return _0x43bb76;}exports[_0xa477('0x24')]=consoleLogger;exports[_0xa477('0x25')]=fileLogger; \ No newline at end of file +var _0xa1e2=['winston','../config/environment','debugLevel','toLowerCase','info','redBG\x20white','red','bold\x20yellow','white','bold\x20white','bold\x20green','gray','bold\x20magenta','bold\x20blue','bold\x20cyan','addColors','/var/log/xcally','join','format','message','replace','{{{','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','meta','keys','length','stringify','transports','Console','warn','Logger','error','%s-%s','consoleLogger','fileLogger','moment'];(function(_0x5d2ca1,_0x343504){var _0x484bbf=function(_0x4f5b03){while(--_0x4f5b03){_0x5d2ca1['push'](_0x5d2ca1['shift']());}};_0x484bbf(++_0x343504);}(_0xa1e2,0x9f));var _0x2a1e=function(_0x729eef,_0x4d37a8){_0x729eef=_0x729eef-0x0;var _0x413580=_0xa1e2[_0x729eef];return _0x413580;};'use strict';var path=require('path');var util=require('util');var moment=require(_0x2a1e('0x0'));var winston=require(_0x2a1e('0x1'));var config=require(_0x2a1e('0x2'));var debugLevel=config[_0x2a1e('0x3')]?config[_0x2a1e('0x3')][_0x2a1e('0x4')]():_0x2a1e('0x5');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':_0x2a1e('0x6'),'error':_0x2a1e('0x7'),'warn':_0x2a1e('0x8'),'info':_0x2a1e('0x9'),'print':_0x2a1e('0xa'),'success':_0x2a1e('0xb'),'http':_0x2a1e('0xc'),'verbose':_0x2a1e('0xd'),'debug':_0x2a1e('0xe'),'silly':_0x2a1e('0xf')};winston[_0x2a1e('0x10')](XC_LOG_COLORS);function getLogFileName(_0x3def4d,_0x209d41,_0x140b43){var _0x2086f2=_0x3def4d||_0x2a1e('0x11');return path[_0x2a1e('0x12')](_0x2086f2,util[_0x2a1e('0x13')]('%s-%s.log',_0x209d41,_0x140b43));}function formatter(_0x2861b9,_0x1c9e15){_0x1c9e15[_0x2a1e('0x14')]=_0x1c9e15['message'][_0x2a1e('0x15')](/@@{/g,_0x2a1e('0x16'))[_0x2a1e('0x15')](/}@@/g,_0x2a1e('0x17'))[_0x2a1e('0x15')](/@{/g,'{{')[_0x2a1e('0x15')](/}@/g,'}}');return util['format'](_0x2a1e('0x18'),moment()[_0x2a1e('0x13')](_0x2a1e('0x19')),_0x1c9e15[_0x2a1e('0x1a')][_0x2a1e('0x1b')](),_0x2861b9,_0x1c9e15[_0x2a1e('0x14')]);}function fileFormat(_0x248df2,_0x278882){_0x278882[_0x2a1e('0x14')]=_0x278882[_0x2a1e('0x14')][_0x2a1e('0x15')](/@@{/g,_0x2a1e('0x16'))['replace'](/}@@/g,_0x2a1e('0x17'))['replace'](/@{/g,'{{')['replace'](/}@/g,'}}');var _0x498ea2=_0x278882[_0x2a1e('0x1c')]&&Object[_0x2a1e('0x1d')](_0x278882['meta'])[_0x2a1e('0x1e')]?'\x0a\x09'+JSON[_0x2a1e('0x1f')](_0x278882[_0x2a1e('0x1c')]):'';return util[_0x2a1e('0x13')]('[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s',moment()[_0x2a1e('0x13')](_0x2a1e('0x19')),_0x278882[_0x2a1e('0x1a')][_0x2a1e('0x1b')](),_0x248df2,_0x278882[_0x2a1e('0x14')],_0x498ea2);}function consoleLogger(){var _0x48014e=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x2a1e('0x20'))][(_0x2a1e('0x21'))]({'level':_0x2a1e('0x22'),'json':![],'formatter':function(_0xfdc7e4){return formatter('',_0xfdc7e4);}})]});return _0x48014e;}function fileLogger(_0x324ff1,_0x48713c){var _0x1334be=new winston[(_0x2a1e('0x23'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x2a1e('0x20'))]['File']({'name':util[_0x2a1e('0x13')]('%s-%s',_0x324ff1,_0x2a1e('0x24')),'filename':getLogFileName(_0x48713c,_0x324ff1,_0x2a1e('0x24')),'level':_0x2a1e('0x24'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x23d789){return fileFormat(_0x324ff1,_0x23d789);}}),new winston[(_0x2a1e('0x20'))]['File']({'name':util[_0x2a1e('0x13')](_0x2a1e('0x25'),_0x324ff1,debugLevel),'filename':getLogFileName(_0x48713c,_0x324ff1,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x1554b1){return fileFormat(_0x324ff1,_0x1554b1);}}),new winston[(_0x2a1e('0x20'))][(_0x2a1e('0x21'))]({'level':_0x2a1e('0x22'),'json':![],'formatter':function(_0x1ea445){return fileFormat(_0x324ff1,_0x1ea445);}})]});return _0x1334be;}exports[_0x2a1e('0x26')]=consoleLogger;exports[_0x2a1e('0x27')]=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index 9fda07e..c1dba69 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 _0x0b0e=['}@@','lodash','password','apiKey','firstName','lastName','street','phone','mobile','fax','email','clientId','clientSecret','securityToken','tenantId','token','channelSecret','accessToken','authToken','consumerKey','membername','calleridname','exten','vidaooApiKey','clientEmail','accesskeyid','secretaccesskey','key','user','pass','localstationid','dsn','secret','registry','oldPassword','isArray','length','isString','replace'];(function(_0x339086,_0x277574){var _0x4bedaf=function(_0x2d9829){while(--_0x2d9829){_0x339086['push'](_0x339086['shift']());}};_0x4bedaf(++_0x277574);}(_0x0b0e,0x187));var _0xe0b0=function(_0x3a8dc1,_0x2f03b8){_0x3a8dc1=_0x3a8dc1-0x0;var _0x4b3595=_0x0b0e[_0x3a8dc1];return _0x4b3595;};var _=require(_0xe0b0('0x0'));var sensitiveFields=['username',_0xe0b0('0x1'),'newPassword',_0xe0b0('0x2'),_0xe0b0('0x3'),_0xe0b0('0x4'),_0xe0b0('0x5'),_0xe0b0('0x6'),_0xe0b0('0x7'),_0xe0b0('0x8'),_0xe0b0('0x9'),_0xe0b0('0xa'),_0xe0b0('0xb'),_0xe0b0('0xc'),'code','accessKey',_0xe0b0('0xd'),_0xe0b0('0xe'),_0xe0b0('0xf'),_0xe0b0('0x10'),'accessTokenSecret',_0xe0b0('0x11'),_0xe0b0('0x12'),'consumerSecret',_0xe0b0('0x13'),_0xe0b0('0x14'),'calleridnum',_0xe0b0('0x15'),_0xe0b0('0x16'),_0xe0b0('0x17'),'privateKey',_0xe0b0('0x18'),_0xe0b0('0x19'),_0xe0b0('0x1a'),_0xe0b0('0x1b'),_0xe0b0('0x1c'),'accountSid',_0xe0b0('0x1d'),_0xe0b0('0x1e'),_0xe0b0('0x1f'),_0xe0b0('0x20'),_0xe0b0('0x21')];function maskSensitiveData(_0x55d884){const _0x41a7e2=/(?!^)[\s\S](?!$)/g;if(_['isPlainObject'](_0x55d884)){for(const _0x35cb40 in _0x55d884){if(_[_0xe0b0('0x22')](_0x55d884[_0x35cb40])){for(let _0x519ae8=0x0;_0x519ae8<_0x55d884[_0x35cb40][_0xe0b0('0x23')];_0x519ae8++){maskSensitiveData(_0x55d884[_0x35cb40][_0x519ae8]);}}else if(_['isPlainObject'](_0x55d884[_0x35cb40])){maskSensitiveData(_0x55d884[_0x35cb40]);}else if(_[_0xe0b0('0x24')](_0x55d884[_0x35cb40])){_0x55d884[_0x35cb40]=_0x55d884[_0x35cb40][_0xe0b0('0x25')](/{{{/g,'@@{')['replace'](/}}}/g,_0xe0b0('0x26'))['replace'](/{{/g,'@{')['replace'](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x35cb40)){_0x55d884[_0x35cb40]=_0x55d884[_0x35cb40][_0xe0b0('0x25')](_0x41a7e2,'*');}}}}}module['exports']['maskSensitiveData']=maskSensitiveData; \ No newline at end of file +var _0x14a0=['membername','calleridnum','exten','clientEmail','privateKey','accesskeyid','secretaccesskey','key','user','pass','accountSid','localstationid','dsn','secret','registry','isArray','length','isPlainObject','isString','replace','@@{','}@@','includes','exports','maskSensitiveData','username','password','newPassword','apiKey','firstName','lastName','street','fax','email','clientId','code','accessKey','tenantId','accessToken'];(function(_0x547cbe,_0x5654fb){var _0x50a1c4=function(_0x4b0055){while(--_0x4b0055){_0x547cbe['push'](_0x547cbe['shift']());}};_0x50a1c4(++_0x5654fb);}(_0x14a0,0x8e));var _0x014a=function(_0x3d3b60,_0x5e644e){_0x3d3b60=_0x3d3b60-0x0;var _0x4fc990=_0x14a0[_0x3d3b60];return _0x4fc990;};var _=require('lodash');var sensitiveFields=[_0x014a('0x0'),_0x014a('0x1'),_0x014a('0x2'),_0x014a('0x3'),_0x014a('0x4'),_0x014a('0x5'),_0x014a('0x6'),'phone','mobile',_0x014a('0x7'),_0x014a('0x8'),_0x014a('0x9'),'clientSecret','securityToken',_0x014a('0xa'),_0x014a('0xb'),_0x014a('0xc'),'token','channelSecret',_0x014a('0xd'),'accessTokenSecret','authToken','consumerKey','consumerSecret',_0x014a('0xe'),'calleridname',_0x014a('0xf'),_0x014a('0x10'),'vidaooApiKey',_0x014a('0x11'),_0x014a('0x12'),_0x014a('0x13'),_0x014a('0x14'),_0x014a('0x15'),_0x014a('0x16'),_0x014a('0x17'),_0x014a('0x18'),_0x014a('0x19'),_0x014a('0x1a'),_0x014a('0x1b'),_0x014a('0x1c'),'oldPassword'];function maskSensitiveData(_0x130d13){const _0x3cf92f=/(?!^)[\s\S](?!$)/g;if(_['isPlainObject'](_0x130d13)){for(const _0x3a836f in _0x130d13){if(_[_0x014a('0x1d')](_0x130d13[_0x3a836f])){for(let _0x59a4ea=0x0;_0x59a4ea<_0x130d13[_0x3a836f][_0x014a('0x1e')];_0x59a4ea++){maskSensitiveData(_0x130d13[_0x3a836f][_0x59a4ea]);}}else if(_[_0x014a('0x1f')](_0x130d13[_0x3a836f])){maskSensitiveData(_0x130d13[_0x3a836f]);}else if(_[_0x014a('0x20')](_0x130d13[_0x3a836f])){_0x130d13[_0x3a836f]=_0x130d13[_0x3a836f][_0x014a('0x21')](/{{{/g,_0x014a('0x22'))[_0x014a('0x21')](/}}}/g,_0x014a('0x23'))[_0x014a('0x21')](/{{/g,'@{')[_0x014a('0x21')](/}}/g,'}@');if(_[_0x014a('0x24')](sensitiveFields,_0x3a836f)){_0x130d13[_0x3a836f]=_0x130d13[_0x3a836f][_0x014a('0x21')](_0x3cf92f,'*');}}}}}module[_0x014a('0x25')][_0x014a('0x26')]=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/misc.js b/server/utils/misc.js index 3a0cb74..557dfad 100644 --- a/server/utils/misc.js +++ b/server/utils/misc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x66fa=['exports','replace','\x5c$&'];(function(_0x33cab0,_0x4dc044){var _0x4fbfb7=function(_0x4afd02){while(--_0x4afd02){_0x33cab0['push'](_0x33cab0['shift']());}};_0x4fbfb7(++_0x4dc044);}(_0x66fa,0x117));var _0xa66f=function(_0xcc2811,_0x105054){_0xcc2811=_0xcc2811-0x0;var _0x2e9299=_0x66fa[_0xcc2811];return _0x2e9299;};module[_0xa66f('0x0')]={'escapeRegExp'(_0x3c905a,_0x52947a=/[-[\]{}()*+?.,\\\/^$|#\s]/g){return _0x3c905a[_0xa66f('0x1')](_0x52947a,_0xa66f('0x2'));}}; \ No newline at end of file +var _0x5fab=['exports','replace','\x5c$&'];(function(_0x3fbb91,_0x5ec106){var _0x3eb213=function(_0x118b9f){while(--_0x118b9f){_0x3fbb91['push'](_0x3fbb91['shift']());}};_0x3eb213(++_0x5ec106);}(_0x5fab,0x177));var _0xb5fa=function(_0x30ac04,_0x365f1b){_0x30ac04=_0x30ac04-0x0;var _0x56b497=_0x5fab[_0x30ac04];return _0x56b497;};module[_0xb5fa('0x0')]={'escapeRegExp'(_0x1c67fb,_0x4c67f9=/[-[\]{}()*+?.,\\\/^$|#\s]/g){return _0x1c67fb[_0xb5fa('0x1')](_0x4c67f9,_0xb5fa('0x2'));}}; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index 00cc115..32f4b8b 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 _0x14a0=['string','replace','isPlainObject','keys','exports','safeTemplate','{\x20{\x20','\x20}\x20}'];(function(_0x2555d0,_0x4150a6){var _0x3bb486=function(_0x1eb89f){while(--_0x1eb89f){_0x2555d0['push'](_0x2555d0['shift']());}};_0x3bb486(++_0x4150a6);}(_0x14a0,0x8e));var _0x014a=function(_0x471021,_0x500930){_0x471021=_0x471021-0x0;var _0xd02983=_0x14a0[_0x471021];return _0xd02983;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x105436){return _0x105436==='{{'?_0x014a('0x0'):_0x014a('0x1');}function safeTemplate(_0x28b0f6){var _0x32e88c=_0x28b0f6;if(typeof _0x28b0f6===_0x014a('0x2')){_0x32e88c=_0x28b0f6[_0x014a('0x3')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array['isArray'](_0x28b0f6)){_0x32e88c=_0x28b0f6['map'](function(_0x1730a5){return safeTemplate(_0x1730a5);});}else if(_[_0x014a('0x4')](_0x28b0f6)){_0x32e88c=Object[_0x014a('0x5')](_0x28b0f6)['reduce'](function(_0x5a61ac,_0x11b8ce){_0x5a61ac[_0x11b8ce]=safeTemplate(_0x28b0f6[_0x11b8ce]);return _0x5a61ac;},{});}return _0x32e88c;}module[_0x014a('0x6')][_0x014a('0x7')]=safeTemplate; \ No newline at end of file +var _0x757a=['isArray','map','isPlainObject','reduce','exports','safeTemplate','{\x20{\x20','string','replace'];(function(_0x2cddff,_0xf99e7){var _0x286d69=function(_0x433452){while(--_0x433452){_0x2cddff['push'](_0x2cddff['shift']());}};_0x286d69(++_0xf99e7);}(_0x757a,0xde));var _0xa757=function(_0x3ab899,_0x1db0f2){_0x3ab899=_0x3ab899-0x0;var _0x5c7880=_0x757a[_0x3ab899];return _0x5c7880;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x24afaf){return _0x24afaf==='{{'?_0xa757('0x0'):'\x20}\x20}';}function safeTemplate(_0x5c03c3){var _0x5709ed=_0x5c03c3;if(typeof _0x5c03c3===_0xa757('0x1')){_0x5709ed=_0x5c03c3[_0xa757('0x2')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0xa757('0x3')](_0x5c03c3)){_0x5709ed=_0x5c03c3[_0xa757('0x4')](function(_0x32630d){return safeTemplate(_0x32630d);});}else if(_[_0xa757('0x5')](_0x5c03c3)){_0x5709ed=Object['keys'](_0x5c03c3)[_0xa757('0x6')](function(_0x4343b6,_0x53be0e){_0x4343b6[_0x53be0e]=safeTemplate(_0x5c03c3[_0x53be0e]);return _0x4343b6;},{});}return _0x5709ed;}module[_0xa757('0x7')][_0xa757('0x8')]=safeTemplate; \ No newline at end of file diff --git a/server/utils/update-app-config.js b/server/utils/update-app-config.js index 5e6cf5c..ece0c0d 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 _0x905d=['fs-extra','path','../config/environment','root','resolve','legacy-libs','isArray','apps','name','motion2','env','NODE_PATH','string','pathExists','then','readJSON','updated','info','Updating\x20app.json','writeJSON','exports'];(function(_0x11155f,_0x57b687){var _0xd07e48=function(_0x592615){while(--_0x592615){_0x11155f['push'](_0x11155f['shift']());}};_0xd07e48(++_0x57b687);}(_0x905d,0x150));var _0xd905=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x905d[_0x2dafbe];return _0x58a45a;};var fs=require(_0xd905('0x0'));var path=require(_0xd905('0x1'));var config=require(_0xd905('0x2'));var root=config[_0xd905('0x3')];var APP_JSON_PATH=path['resolve'](root,'server/app.json');var NODEPATH=path[_0xd905('0x4')](root,_0xd905('0x5'));function setLegacyLibsNodeEnvPath(_0x426d22){let _0x10b7ea=![];if(Array[_0xd905('0x6')](_0x426d22[_0xd905('0x7')])){var _0x400f8e=_0x426d22[_0xd905('0x7')]['findIndex'](function(_0x342a89){return _0x342a89[_0xd905('0x8')]===_0xd905('0x9');});if(_0x400f8e>-0x1){var _0x5da7be=_0x426d22[_0xd905('0x7')][_0x400f8e];if(typeof _0x5da7be[_0xd905('0xa')][_0xd905('0xb')]!==_0xd905('0xc')){_0x5da7be[_0xd905('0xa')]['NODE_PATH']=NODEPATH;_0x10b7ea=!![];}}return{'appConfig':_0x426d22,'updated':_0x10b7ea};}}function updateAppConfig(_0x252024){return fs[_0xd905('0xd')](APP_JSON_PATH)[_0xd905('0xe')](function(_0x59e6d9){if(_0x59e6d9){return fs[_0xd905('0xf')](APP_JSON_PATH)[_0xd905('0xe')](function(_0x2a8d5c){var _0x19b8a0=setLegacyLibsNodeEnvPath(_0x2a8d5c);if(_0x19b8a0[_0xd905('0x10')]){_0x252024[_0xd905('0x11')](_0xd905('0x12'));return fs[_0xd905('0x13')](APP_JSON_PATH,_0x2a8d5c,{'spaces':0x2});}else{return Promise[_0xd905('0x4')]();}});}else{return Promise[_0xd905('0x4')]();}});}module[_0xd905('0x14')]=updateAppConfig; \ No newline at end of file +var _0xb635=['then','readJSON','updated','Updating\x20app.json','writeJSON','exports','root','resolve','server/app.json','legacy-libs','isArray','apps','findIndex','name','motion2','NODE_PATH','string','env','pathExists'];(function(_0x389c80,_0x5977d5){var _0x3f643e=function(_0x56dcf6){while(--_0x56dcf6){_0x389c80['push'](_0x389c80['shift']());}};_0x3f643e(++_0x5977d5);}(_0xb635,0x195));var _0x5b63=function(_0x39a4a5,_0x336d77){_0x39a4a5=_0x39a4a5-0x0;var _0x358a51=_0xb635[_0x39a4a5];return _0x358a51;};var fs=require('fs-extra');var path=require('path');var config=require('../config/environment');var root=config[_0x5b63('0x0')];var APP_JSON_PATH=path[_0x5b63('0x1')](root,_0x5b63('0x2'));var NODEPATH=path[_0x5b63('0x1')](root,_0x5b63('0x3'));function setLegacyLibsNodeEnvPath(_0x4616d3){let _0x1fe8a2=![];if(Array[_0x5b63('0x4')](_0x4616d3[_0x5b63('0x5')])){var _0x385b8a=_0x4616d3[_0x5b63('0x5')][_0x5b63('0x6')](function(_0x3bcc75){return _0x3bcc75[_0x5b63('0x7')]===_0x5b63('0x8');});if(_0x385b8a>-0x1){var _0x3182af=_0x4616d3[_0x5b63('0x5')][_0x385b8a];if(typeof _0x3182af['env'][_0x5b63('0x9')]!==_0x5b63('0xa')){_0x3182af[_0x5b63('0xb')]['NODE_PATH']=NODEPATH;_0x1fe8a2=!![];}}return{'appConfig':_0x4616d3,'updated':_0x1fe8a2};}}function updateAppConfig(_0x5e06be){return fs[_0x5b63('0xc')](APP_JSON_PATH)[_0x5b63('0xd')](function(_0x4dfe51){if(_0x4dfe51){return fs[_0x5b63('0xe')](APP_JSON_PATH)[_0x5b63('0xd')](function(_0x15316f){var _0x109b54=setLegacyLibsNodeEnvPath(_0x15316f);if(_0x109b54[_0x5b63('0xf')]){_0x5e06be['info'](_0x5b63('0x10'));return fs[_0x5b63('0x11')](APP_JSON_PATH,_0x15316f,{'spaces':0x2});}else{return Promise[_0x5b63('0x1')]();}});}else{return Promise[_0x5b63('0x1')]();}});}module[_0x5b63('0x12')]=updateAppConfig; \ No newline at end of file